852||2===e&&k>592)return 1;for(;;){d=y-S,a[g]p?(v=T[I+a[g]],m=R[P+a[g]]):(v=96,m=0),u=1<>S)+(c-=u)]=d<<24|v<<16|m|0}while(0!==c);for(u=1<>=1;if(0!==u?(C&=u-1,C+=u):C=0,g++,0==--j[y]){if(y===w)break;y=t[n+a[g]]}if(y>O&&(C&f)!==l){for(0===S&&(S=O),h+=b,x=1<<(E=y-S);E+S852||2===e&&k>592)return 1;o[l=C&f]=O<<24|E<<16|h-i|0}}return 0!==C&&(o[h+C]=y-S<<24|64<<16|0),s.bits=O,0}var Wl=-2,Kl=12,Yl=30;function Gl(e){return(e>>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24)}function Jl(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new kc(320),this.work=new kc(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function $l(e){var t;return e&&e.state?((t=e.state).wsize=0,t.whave=0,t.wnext=0,function(e){var t;return e&&e.state?(t=e.state,e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=1&t.wrap),t.mode=1,t.last=0,t.havedict=0,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new Cc(852),t.distcode=t.distdyn=new Cc(592),t.sane=1,t.back=-1,0):Wl}(e)):Wl}function Xl(e,t){var n,r;return e?(r=new Jl,e.state=r,r.window=null,n=function(e,t){var n,r;return e&&e.state?(r=e.state,t<0?(n=0,t=-t):(n=1+(t>>4),t<48&&(t&=15)),t&&(t<8||t>15)?Wl:(null!==r.window&&r.wbits!==t&&(r.window=null),r.wrap=n,r.wbits=t,$l(e))):Wl}(e,t),0!==n&&(e.state=null),n):Wl}var Ql,ef,tf=!0;function nf(e){if(tf){var t;for(Ql=new Cc(512),ef=new Cc(32),t=0;t<144;)e.lens[t++]=8;for(;t<256;)e.lens[t++]=9;for(;t<280;)e.lens[t++]=7;for(;t<288;)e.lens[t++]=8;for(Vl(1,e.lens,0,288,Ql,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;Vl(2,e.lens,0,32,ef,0,e.work,{bits:5}),tf=!1}e.lencode=Ql,e.lenbits=9,e.distcode=ef,e.distbits=5}function rf(e,t){var n,r,o,i,a,s,u,c,l,f,h,p,d,v,m,_,y,g,b,w,O,E,S,x,k=0,C=new xc(4),R=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!e||!e.state||!e.output||!e.input&&0!==e.avail_in)return Wl;(n=e.state).mode===Kl&&(n.mode=13),a=e.next_out,o=e.output,u=e.avail_out,i=e.next_in,r=e.input,s=e.avail_in,c=n.hold,l=n.bits,f=s,h=u,E=0;e:for(;;)switch(n.mode){case 1:if(0===n.wrap){n.mode=13;break}for(;l<16;){if(0===s)break e;s--,c+=r[i++]<>>8&255,n.check=ml(n.check,C,2,0),c=0,l=0,n.mode=2;break}if(n.flags=0,n.head&&(n.head.done=!1),!(1&n.wrap)||(((255&c)<<8)+(c>>8))%31){e.msg="incorrect header check",n.mode=Yl;break}if(8!=(15&c)){e.msg="unknown compression method",n.mode=Yl;break}if(l-=4,O=8+(15&(c>>>=4)),0===n.wbits)n.wbits=O;else if(O>n.wbits){e.msg="invalid window size",n.mode=Yl;break}n.dmax=1<>8&1),512&n.flags&&(C[0]=255&c,C[1]=c>>>8&255,n.check=ml(n.check,C,2,0)),c=0,l=0,n.mode=3;case 3:for(;l<32;){if(0===s)break e;s--,c+=r[i++]<>>8&255,C[2]=c>>>16&255,C[3]=c>>>24&255,n.check=ml(n.check,C,4,0)),c=0,l=0,n.mode=4;case 4:for(;l<16;){if(0===s)break e;s--,c+=r[i++]<>8),512&n.flags&&(C[0]=255&c,C[1]=c>>>8&255,n.check=ml(n.check,C,2,0)),c=0,l=0,n.mode=5;case 5:if(1024&n.flags){for(;l<16;){if(0===s)break e;s--,c+=r[i++]<>>8&255,n.check=ml(n.check,C,2,0)),c=0,l=0}else n.head&&(n.head.extra=null);n.mode=6;case 6:if(1024&n.flags&&((p=n.length)>s&&(p=s),p&&(n.head&&(O=n.head.extra_len-n.length,n.head.extra||(n.head.extra=new Array(n.head.extra_len)),Sc(n.head.extra,r,i,p,O)),512&n.flags&&(n.check=ml(n.check,r,p,i)),s-=p,i+=p,n.length-=p),n.length))break e;n.length=0,n.mode=7;case 7:if(2048&n.flags){if(0===s)break e;p=0;do{O=r[i+p++],n.head&&O&&n.length<65536&&(n.head.name+=String.fromCharCode(O))}while(O&&p>9&1,n.head.done=!0),e.adler=n.check=0,n.mode=Kl;break;case 10:for(;l<32;){if(0===s)break e;s--,c+=r[i++]<>>=7&l,l-=7&l,n.mode=27;break}for(;l<3;){if(0===s)break e;s--,c+=r[i++]<>>=1)){case 0:n.mode=14;break;case 1:if(nf(n),n.mode=20,6===t){c>>>=2,l-=2;break e}break;case 2:n.mode=17;break;case 3:e.msg="invalid block type",n.mode=Yl}c>>>=2,l-=2;break;case 14:for(c>>>=7&l,l-=7&l;l<32;){if(0===s)break e;s--,c+=r[i++]<>>16^65535)){e.msg="invalid stored block lengths",n.mode=Yl;break}if(n.length=65535&c,c=0,l=0,n.mode=15,6===t)break e;case 15:n.mode=16;case 16:if(p=n.length){if(p>s&&(p=s),p>u&&(p=u),0===p)break e;Sc(o,r,i,p,a),s-=p,i+=p,u-=p,a+=p,n.length-=p;break}n.mode=Kl;break;case 17:for(;l<14;){if(0===s)break e;s--,c+=r[i++]<>>=5,l-=5,n.ndist=1+(31&c),c>>>=5,l-=5,n.ncode=4+(15&c),c>>>=4,l-=4,n.nlen>286||n.ndist>30){e.msg="too many length or distance symbols",n.mode=Yl;break}n.have=0,n.mode=18;case 18:for(;n.have>>=3,l-=3}for(;n.have<19;)n.lens[R[n.have++]]=0;if(n.lencode=n.lendyn,n.lenbits=7,S={bits:n.lenbits},E=Vl(0,n.lens,0,19,n.lencode,0,n.work,S),n.lenbits=S.bits,E){e.msg="invalid code lengths set",n.mode=Yl;break}n.have=0,n.mode=19;case 19:for(;n.have>>16&255,y=65535&k,!((m=k>>>24)<=l);){if(0===s)break e;s--,c+=r[i++]<>>=m,l-=m,n.lens[n.have++]=y;else{if(16===y){for(x=m+2;l>>=m,l-=m,0===n.have){e.msg="invalid bit length repeat",n.mode=Yl;break}O=n.lens[n.have-1],p=3+(3&c),c>>>=2,l-=2}else if(17===y){for(x=m+3;l>>=m)),c>>>=3,l-=3}else{for(x=m+7;l>>=m)),c>>>=7,l-=7}if(n.have+p>n.nlen+n.ndist){e.msg="invalid bit length repeat",n.mode=Yl;break}for(;p--;)n.lens[n.have++]=O}}if(n.mode===Yl)break;if(0===n.lens[256]){e.msg="invalid code -- missing end-of-block",n.mode=Yl;break}if(n.lenbits=9,S={bits:n.lenbits},E=Vl(1,n.lens,0,n.nlen,n.lencode,0,n.work,S),n.lenbits=S.bits,E){e.msg="invalid literal/lengths set",n.mode=Yl;break}if(n.distbits=6,n.distcode=n.distdyn,S={bits:n.distbits},E=Vl(2,n.lens,n.nlen,n.ndist,n.distcode,0,n.work,S),n.distbits=S.bits,E){e.msg="invalid distances set",n.mode=Yl;break}if(n.mode=20,6===t)break e;case 20:n.mode=21;case 21:if(s>=6&&u>=258){e.next_out=a,e.avail_out=u,e.next_in=i,e.avail_in=s,n.hold=c,n.bits=l,Fl(e,h),a=e.next_out,o=e.output,u=e.avail_out,i=e.next_in,r=e.input,s=e.avail_in,c=n.hold,l=n.bits,n.mode===Kl&&(n.back=-1);break}for(n.back=0;_=(k=n.lencode[c&(1<>>16&255,y=65535&k,!((m=k>>>24)<=l);){if(0===s)break e;s--,c+=r[i++]<>g)])>>>16&255,y=65535&k,!(g+(m=k>>>24)<=l);){if(0===s)break e;s--,c+=r[i++]<>>=g,l-=g,n.back+=g}if(c>>>=m,l-=m,n.back+=m,n.length=y,0===_){n.mode=26;break}if(32&_){n.back=-1,n.mode=Kl;break}if(64&_){e.msg="invalid literal/length code",n.mode=Yl;break}n.extra=15&_,n.mode=22;case 22:if(n.extra){for(x=n.extra;l>>=n.extra,l-=n.extra,n.back+=n.extra}n.was=n.length,n.mode=23;case 23:for(;_=(k=n.distcode[c&(1<>>16&255,y=65535&k,!((m=k>>>24)<=l);){if(0===s)break e;s--,c+=r[i++]<>g)])>>>16&255,y=65535&k,!(g+(m=k>>>24)<=l);){if(0===s)break e;s--,c+=r[i++]<>>=g,l-=g,n.back+=g}if(c>>>=m,l-=m,n.back+=m,64&_){e.msg="invalid distance code",n.mode=Yl;break}n.offset=y,n.extra=15&_,n.mode=24;case 24:if(n.extra){for(x=n.extra;l>>=n.extra,l-=n.extra,n.back+=n.extra}if(n.offset>n.dmax){e.msg="invalid distance too far back",n.mode=Yl;break}n.mode=25;case 25:if(0===u)break e;if(p=h-u,n.offset>p){if((p=n.offset-p)>n.whave&&n.sane){e.msg="invalid distance too far back",n.mode=Yl;break}p>n.wnext?(p-=n.wnext,d=n.wsize-p):d=n.wnext-p,p>n.length&&(p=n.length),v=n.window}else v=o,d=a-n.offset,p=n.length;p>u&&(p=u),u-=p,n.length-=p;do{o[a++]=v[d++]}while(--p);0===n.length&&(n.mode=21);break;case 26:if(0===u)break e;o[a++]=n.length,u--,n.mode=21;break;case 27:if(n.wrap){for(;l<32;){if(0===s)break e;s--,c|=r[i++]<=i.wsize?(Sc(i.window,t,n-i.wsize,i.wsize,0),i.wnext=0,i.whave=i.wsize):((o=i.wsize-i.wnext)>r&&(o=r),Sc(i.window,t,n-r,o,i.wnext),(r-=o)?(Sc(i.window,t,n-r,r,0),i.wnext=r,i.whave=i.wsize):(i.wnext+=o,i.wnext===i.wsize&&(i.wnext=0),i.whave7)throw new TypeError("Bad argument");this.mode=e,this.init_done=!1,this.write_in_progress=!1,this.pending_close=!1,this.windowBits=0,this.level=0,this.memLevel=0,this.strategy=0,this.dictionary=null}function sf(e,t){for(var n=0;n15&&(a=2,r-=16),o<1||o>9||8!==n||r<8||r>15||t<0||t>9||i<0||i>4)return Sl(e,yl);8===r&&(r=9);var s=new Dl;return e.state=s,s.strm=e,s.wrap=a,s.gzhead=null,s.w_bits=r,s.w_size=1<cf.Z_MAX_CHUNK))throw new Error("Invalid chunk size: "+e.chunkSize);if(e.windowBits&&(e.windowBitscf.Z_MAX_WINDOWBITS))throw new Error("Invalid windowBits: "+e.windowBits);if(e.level&&(e.levelcf.Z_MAX_LEVEL))throw new Error("Invalid compression level: "+e.level);if(e.memLevel&&(e.memLevelcf.Z_MAX_MEMLEVEL))throw new Error("Invalid memLevel: "+e.memLevel);if(e.strategy&&e.strategy!=cf.Z_FILTERED&&e.strategy!=cf.Z_HUFFMAN_ONLY&&e.strategy!=cf.Z_RLE&&e.strategy!=cf.Z_FIXED&&e.strategy!=cf.Z_DEFAULT_STRATEGY)throw new Error("Invalid strategy: "+e.strategy);if(e.dictionary&&!Ti(e.dictionary))throw new Error("Invalid dictionary: it should be a Buffer instance");this._binding=new cf.Zlib(t);var n=this;this._hadError=!1,this._binding.onerror=function(e,t){n._binding=null,n._hadError=!0;var r=new Error(e);r.errno=t,r.code=cf.codes[t],n.emit("error",r)};var r=cf.Z_DEFAULT_COMPRESSION;"number"==typeof e.level&&(r=e.level);var o=cf.Z_DEFAULT_STRATEGY;"number"==typeof e.strategy&&(o=e.strategy),this._binding.init(e.windowBits||cf.Z_DEFAULT_WINDOWBITS,r,e.memLevel||cf.Z_DEFAULT_MEMLEVEL,o,e.dictionary),this._buffer=new Go(this._chunkSize),this._offset=0,this._closed=!1,this._level=r,this._strategy=o,this.once("end",this.close)}Object.keys(lf).forEach((function(e){lf[lf[e]]=e})),Wi(bf,Es),bf.prototype.params=function(e,t,n){if(ecf.Z_MAX_LEVEL)throw new RangeError("Invalid compression level: "+e);if(t!=cf.Z_FILTERED&&t!=cf.Z_HUFFMAN_ONLY&&t!=cf.Z_RLE&&t!=cf.Z_FIXED&&t!=cf.Z_DEFAULT_STRATEGY)throw new TypeError("Invalid strategy: "+t);if(this._level!==e||this._strategy!==t){var r=this;this.flush(cf.Z_SYNC_FLUSH,(function(){r._binding.params(e,t),r._hadError||(r._level=e,r._strategy=t,n&&n())}))}else co(n)},bf.prototype.reset=function(){return this._binding.reset()},bf.prototype._flush=function(e){this._transform(new Go(0),"",e)},bf.prototype.flush=function(e,t){var n=this._writableState;if(("function"==typeof e||void 0===e&&!t)&&(t=e,e=cf.Z_FULL_FLUSH),n.ended)t&&co(t);else if(n.ending)t&&this.once("end",t);else if(n.needDrain){var r=this;this.once("drain",(function(){r.flush(t)}))}else this._flushFlag=e,this.write(new Go(0),"",t)},bf.prototype.close=function(e){if(e&&co(e),!this._closed){this._closed=!0,this._binding.close();var t=this;co((function(){t.emit("close")}))}},bf.prototype._transform=function(e,t,n){var r,o=this._writableState,i=(o.ending||o.ended)&&(!e||o.length===e.length);if(null===!e&&!Ti(e))return n(new Error("invalid input"));i?r=cf.Z_FINISH:(r=this._flushFlag,e.length>=o.length&&(this._flushFlag=this._opts.flush||cf.Z_NO_FLUSH)),this._processChunk(e,r,n)},bf.prototype._processChunk=function(e,t,n){var r=e&&e.length,o=this._chunkSize-this._offset,i=0,a=this,s="function"==typeof n;if(!s){var u,c=[],l=0;this.on("error",(function(e){u=e}));do{var f=this._binding.writeSync(t,e,i,r,this._buffer,this._offset,o)}while(!this._hadError&&d(f[0],f[1]));if(this._hadError)throw u;var h=Go.concat(c,l);return this.close(),h}var p=this._binding.write(t,e,i,r,this._buffer,this._offset,o);function d(u,f){if(!a._hadError){var h=o-f;if(function(e,t){if(!e)throw new Error(t)}(h>=0,"have should not go down"),h>0){var p=a._buffer.slice(a._offset,a._offset+h);a._offset+=h,s?a.push(p):(c.push(p),l+=p.length)}if((0===f||a._offset>=a._chunkSize)&&(o=a._chunkSize,a._offset=0,a._buffer=new Go(a._chunkSize)),0===f){if(i+=r-u,r=u,!s)return!0;var v=a._binding.write(t,e,i,r,a._buffer,a._offset,a._chunkSize);return v.callback=d,void(v.buffer=e)}if(!s)return!1;n()}}p.buffer=e,p.callback=d},Wi(pf,bf),Wi(df,bf),Wi(vf,bf),Wi(mf,bf),Wi(_f,bf),Wi(yf,bf),Wi(gf,bf);var wf={codes:lf,createDeflate:function(e){return new pf(e)},createInflate:function(e){return new df(e)},createDeflateRaw:function(e){return new _f(e)},createInflateRaw:function(e){return new yf(e)},createGzip:function(e){return new vf(e)},createGunzip:function(e){return new mf(e)},createUnzip:function(e){return new gf(e)},deflate:function(e,t,n){return"function"==typeof t&&(n=t,t={}),ff(new pf(t),e,n)},deflateSync:function(e,t){return hf(new pf(t),e)},gzip:function(e,t,n){return"function"==typeof t&&(n=t,t={}),ff(new vf(t),e,n)},gzipSync:function(e,t){return hf(new vf(t),e)},deflateRaw:function(e,t,n){return"function"==typeof t&&(n=t,t={}),ff(new _f(t),e,n)},deflateRawSync:function(e,t){return hf(new _f(t),e)},unzip:function(e,t,n){return"function"==typeof t&&(n=t,t={}),ff(new gf(t),e,n)},unzipSync:function(e,t){return hf(new gf(t),e)},inflate:function(e,t,n){return"function"==typeof t&&(n=t,t={}),ff(new df(t),e,n)},inflateSync:function(e,t){return hf(new df(t),e)},gunzip:function(e,t,n){return"function"==typeof t&&(n=t,t={}),ff(new mf(t),e,n)},gunzipSync:function(e,t){return hf(new mf(t),e)},inflateRaw:function(e,t,n){return"function"==typeof t&&(n=t,t={}),ff(new yf(t),e,n)},inflateRawSync:function(e,t){return hf(new yf(t),e)},Deflate:pf,Inflate:df,Gzip:vf,Gunzip:mf,DeflateRaw:_f,InflateRaw:yf,Unzip:gf,Zlib:bf},Of="0.26.1",Ef=bc.http,Sf=bc.https,xf=Of,kf=/https:?/;function Cf(e,t,n){if(e.hostname=t.host,e.host=t.host,e.port=t.port,e.path=n,t.auth){var r=Go.from(t.auth.username+":"+t.auth.password,"utf8").toString("base64");e.headers["Proxy-Authorization"]="Basic "+r}e.beforeRedirect=function(e){e.headers.host=e.host,Cf(e,t,e.href)}}var Rf=function(e){return new Promise((function(t,n){var r;function o(){e.cancelToken&&e.cancelToken.unsubscribe(r),e.signal&&e.signal.removeEventListener("abort",r)}var i=function(e){o(),t(e)},a=!1,s=function(e){o(),a=!0,n(e)},u=e.data,c=e.headers,l={};if(Object.keys(c).forEach((function(e){l[e.toLowerCase()]=e})),"user-agent"in l?c[l["user-agent"]]||delete c[l["user-agent"]]:c["User-Agent"]="axios/"+xf,u&&!Wr.isStream(u)){if(Ti(u));else if(Wr.isArrayBuffer(u))u=Go.from(new Uint8Array(u));else{if(!Wr.isString(u))return s(Co("Data after transformation must be a string, an ArrayBuffer, a Buffer, or a Stream",e));u=Go.from(u,"utf-8")}if(e.maxBodyLength>-1&&u.length>e.maxBodyLength)return s(Co("Request body larger than maxBodyLength limit",e));l["content-length"]||(c["Content-Length"]=u.length)}var f=void 0;e.auth&&(f=(e.auth.username||"")+":"+(e.auth.password||""));var h=jo(e.baseURL,e.url),p=Ys.parse(h),d=p.protocol||"http:";if(!f&&p.auth){var v=p.auth.split(":");f=(v[0]||"")+":"+(v[1]||"")}f&&l.authorization&&delete c[l.authorization];var m=kf.test(d),_=m?e.httpsAgent:e.httpAgent;try{Yr(p.path,e.params,e.paramsSerializer).replace(/^\?/,"")}catch(t){var y=new Error(t.message);y.config=e,y.url=e.url,y.exists=!0,s(y)}var g={path:Yr(p.path,e.params,e.paramsSerializer).replace(/^\?/,""),method:e.method.toUpperCase(),headers:c,agent:_,agents:{http:e.httpAgent,https:e.httpsAgent},auth:f};e.socketPath?g.socketPath=e.socketPath:(g.hostname=p.hostname,g.port=p.port);var b,w=e.proxy;if(!w&&!1!==w){var O=d.slice(0,-1)+"_proxy",E=Eo.env[O]||Eo.env[O.toUpperCase()];if(E){var S=Ys.parse(E),x=Eo.env.no_proxy||Eo.env.NO_PROXY,k=!0;if(x){var C=x.split(",").map((function(e){return e.trim()}));k=!C.some((function(e){return!!e&&("*"===e||("."===e[0]&&p.hostname.substr(p.hostname.length-e.length)===e||p.hostname===e))}))}if(k&&(w={host:S.hostname,port:S.port,protocol:S.protocol},S.auth)){var R=S.auth.split(":");w.auth={username:R[0],password:R[1]}}}}w&&(g.headers.host=p.hostname+(p.port?":"+p.port:""),Cf(g,w,d+"//"+p.hostname+(p.port?":"+p.port:"")+g.path));var P=m&&(!w||kf.test(w.protocol));e.transport?b=e.transport:0===e.maxRedirects?b=du:(e.maxRedirects&&(g.maxRedirects=e.maxRedirects),b=P?Sf:Ef),e.maxBodyLength>-1&&(g.maxBodyLength=e.maxBodyLength),e.insecureHTTPParser&&(g.insecureHTTPParser=e.insecureHTTPParser);var j=b.request(g,(function(t){if(!j.aborted){var n=t,r=t.req||j;if(204!==t.statusCode&&"HEAD"!==r.method&&!1!==e.decompress)switch(t.headers["content-encoding"]){case"gzip":case"compress":case"deflate":n=n.pipe(wf.createUnzip()),delete t.headers["content-encoding"]}var o={status:t.statusCode,statusText:t.statusMessage,headers:t.headers,config:e,request:r};if("stream"===e.responseType)o.data=n,Ro(i,s,o);else{var u=[],c=0;n.on("data",(function(t){u.push(t),c+=t.length,e.maxContentLength>-1&&c>e.maxContentLength&&(a=!0,n.destroy(),s(Co("maxContentLength size of "+e.maxContentLength+" exceeded",e,null,r)))})),n.on("aborted",(function(){a||(n.destroy(),s(Co("error request aborted",e,"ERR_REQUEST_ABORTED",r)))})),n.on("error",(function(t){j.aborted||s(xo(t,e,null,r))})),n.on("end",(function(){try{var t=1===u.length?u[0]:Go.concat(u);"arraybuffer"!==e.responseType&&(t=t.toString(e.responseEncoding),e.responseEncoding&&"utf8"!==e.responseEncoding||(t=Wr.stripBOM(t))),o.data=t}catch(t){s(xo(t,e,t.code,o.request,o))}Ro(i,s,o)}))}}}));if(j.on("error",(function(t){j.aborted&&"ERR_FR_TOO_MANY_REDIRECTS"!==t.code||s(xo(t,e,null,j))})),j.on("socket",(function(e){e.setKeepAlive(!0,6e4)})),e.timeout){var A=parseInt(e.timeout,10);if(isNaN(A))return void s(Co("error trying to parse `config.timeout` to int",e,"ERR_PARSE_TIMEOUT",j));j.setTimeout(A,(function(){j.abort();var t="";t=e.timeoutErrorMessage?e.timeoutErrorMessage:"timeout of "+e.timeout+"ms exceeded";var n=e.transitional||ko;s(Co(t,e,n.clarifyTimeoutError?"ETIMEDOUT":"ECONNABORTED",j))}))}(e.cancelToken||e.signal)&&(r=function(e){j.aborted||(j.abort(),s(!e||e&&e.type?new Lo("canceled"):e))},e.cancelToken&&e.cancelToken.subscribe(r),e.signal&&(e.signal.aborted?r():e.signal.addEventListener("abort",r))),Wr.isStream(u)?u.on("error",(function(t){s(xo(t,e,null,j))})).pipe(j):j.end(u)}))},Pf={"Content-Type":"application/x-www-form-urlencoded"};function jf(e,t){!Wr.isUndefined(e)&&Wr.isUndefined(e["Content-Type"])&&(e["Content-Type"]=t)}var Af,Tf={transitional:ko,adapter:("undefined"!=typeof XMLHttpRequest?Af=No:void 0!==Eo&&"[object process]"===Object.prototype.toString.call(Eo)&&(Af=Rf),Af),transformRequest:[function(e,t){return So(t,"Accept"),So(t,"Content-Type"),Wr.isFormData(e)||Wr.isArrayBuffer(e)||Wr.isBuffer(e)||Wr.isStream(e)||Wr.isFile(e)||Wr.isBlob(e)?e:Wr.isArrayBufferView(e)?e.buffer:Wr.isURLSearchParams(e)?(jf(t,"application/x-www-form-urlencoded;charset=utf-8"),e.toString()):Wr.isObject(e)||t&&"application/json"===t["Content-Type"]?(jf(t,"application/json"),function(e,t,n){if(Wr.isString(e))try{return(t||JSON.parse)(e),Wr.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(n||JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){var t=this.transitional||Tf.transitional,n=t&&t.silentJSONParsing,r=t&&t.forcedJSONParsing,o=!n&&"json"===this.responseType;if(o||r&&Wr.isString(e)&&e.length)try{return JSON.parse(e)}catch(e){if(o){if("SyntaxError"===e.name)throw xo(e,this,"E_JSON_PARSE");throw e}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};Wr.forEach(["delete","get","head"],(function(e){Tf.headers[e]={}})),Wr.forEach(["post","put","patch"],(function(e){Tf.headers[e]=Wr.merge(Pf)}));var If=Tf,Lf=function(e,t,n){var r=this||If;return Wr.forEach(n,(function(n){e=n.call(r,e,t)})),e},Nf=function(e){return!(!e||!e.__CANCEL__)};function Df(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new Lo("canceled")}var Mf=function(e){return Df(e),e.headers=e.headers||{},e.data=Lf.call(e,e.data,e.headers,e.transformRequest),e.headers=Wr.merge(e.headers.common||{},e.headers[e.method]||{},e.headers),Wr.forEach(["delete","get","head","post","put","patch","common"],(function(t){delete e.headers[t]})),(e.adapter||If.adapter)(e).then((function(t){return Df(e),t.data=Lf.call(e,t.data,t.headers,e.transformResponse),t}),(function(t){return Nf(t)||(Df(e),t&&t.response&&(t.response.data=Lf.call(e,t.response.data,t.response.headers,e.transformResponse))),Promise.reject(t)}))},Uf=function(e,t){t=t||{};var n={};function r(e,t){return Wr.isPlainObject(e)&&Wr.isPlainObject(t)?Wr.merge(e,t):Wr.isPlainObject(t)?Wr.merge({},t):Wr.isArray(t)?t.slice():t}function o(n){return Wr.isUndefined(t[n])?Wr.isUndefined(e[n])?void 0:r(void 0,e[n]):r(e[n],t[n])}function i(e){if(!Wr.isUndefined(t[e]))return r(void 0,t[e])}function a(n){return Wr.isUndefined(t[n])?Wr.isUndefined(e[n])?void 0:r(void 0,e[n]):r(void 0,t[n])}function s(n){return n in t?r(e[n],t[n]):n in e?r(void 0,e[n]):void 0}var u={url:i,method:i,data:i,baseURL:a,transformRequest:a,transformResponse:a,paramsSerializer:a,timeout:a,timeoutMessage:a,withCredentials:a,adapter:a,responseType:a,xsrfCookieName:a,xsrfHeaderName:a,onUploadProgress:a,onDownloadProgress:a,decompress:a,maxContentLength:a,maxBodyLength:a,transport:a,httpAgent:a,httpsAgent:a,cancelToken:a,socketPath:a,responseEncoding:a,validateStatus:s};return Wr.forEach(Object.keys(e).concat(Object.keys(t)),(function(e){var t=u[e]||o,r=t(e);Wr.isUndefined(r)&&t!==s||(n[e]=r)})),n},Ff=Of,Hf={};["object","boolean","number","function","string","symbol"].forEach((function(t,n){Hf[t]=function(r){return e(r)===t||"a"+(n<1?"n ":" ")+t}}));var qf={};Hf.transitional=function(e,t,n){function r(e,t){return"[Axios v"+Ff+"] Transitional option '"+e+"'"+t+(n?". "+n:"")}return function(n,o,i){if(!1===e)throw new Error(r(o," has been removed"+(t?" in "+t:"")));return t&&!qf[o]&&(qf[o]=!0,console.warn(r(o," has been deprecated since v"+t+" and will be removed in the near future"))),!e||e(n,o,i)}};var Bf={assertOptions:function(t,n,r){if("object"!==e(t))throw new TypeError("options must be an object");for(var o=Object.keys(t),i=o.length;i-- >0;){var a=o[i],s=n[a];if(s){var u=t[a],c=void 0===u||s(u,a,t);if(!0!==c)throw new TypeError("option "+a+" must be "+c)}else if(!0!==r)throw Error("Unknown option "+a)}},validators:Hf},zf=Bf.validators;function Zf(e){this.defaults=e,this.interceptors={request:new Jr,response:new Jr}}Zf.prototype.request=function(e,t){"string"==typeof e?(t=t||{}).url=e:t=e||{},(t=Uf(this.defaults,t)).method?t.method=t.method.toLowerCase():this.defaults.method?t.method=this.defaults.method.toLowerCase():t.method="get";var n=t.transitional;void 0!==n&&Bf.assertOptions(n,{silentJSONParsing:zf.transitional(zf.boolean),forcedJSONParsing:zf.transitional(zf.boolean),clarifyTimeoutError:zf.transitional(zf.boolean)},!1);var r=[],o=!0;this.interceptors.request.forEach((function(e){"function"==typeof e.runWhen&&!1===e.runWhen(t)||(o=o&&e.synchronous,r.unshift(e.fulfilled,e.rejected))}));var i,a=[];if(this.interceptors.response.forEach((function(e){a.push(e.fulfilled,e.rejected)})),!o){var s=[Mf,void 0];for(Array.prototype.unshift.apply(s,r),s=s.concat(a),i=Promise.resolve(t);s.length;)i=i.then(s.shift(),s.shift());return i}for(var u=t;r.length;){var c=r.shift(),l=r.shift();try{u=c(u)}catch(e){l(e);break}}try{i=Mf(u)}catch(e){return Promise.reject(e)}for(;a.length;)i=i.then(a.shift(),a.shift());return i},Zf.prototype.getUri=function(e){return e=Uf(this.defaults,e),Yr(e.url,e.params,e.paramsSerializer).replace(/^\?/,"")},Wr.forEach(["delete","get","head","options"],(function(e){Zf.prototype[e]=function(t,n){return this.request(Uf(n||{},{method:e,url:t,data:(n||{}).data}))}})),Wr.forEach(["post","put","patch"],(function(e){Zf.prototype[e]=function(t,n,r){return this.request(Uf(r||{},{method:e,url:t,data:n}))}}));var Vf=Zf;function Wf(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");var t;this.promise=new Promise((function(e){t=e}));var n=this;this.promise.then((function(e){if(n._listeners){var t,r=n._listeners.length;for(t=0;t0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]0},transformResponse:[function(e,t){var n=e;return void 0!==t&&"string"==typeof e&&t["content-type"]&&t["content-type"].startsWith("application/json")&&(n=JSON.parse(e)),n}]},!0!==O&&(g.timeout=1e3*p.connectionTimeoutSeconds),h&&0!==Object.keys(h).length&&(g.params=h),p.sendApiKeyAsQueryParam&&(g.params=g.params||{},g.params["x-typesense-api-key"]=p.apiKey),d&&("string"==typeof d&&0!==d.length||"object"===e(d)&&0!==Object.keys(d).length)&&(g.data=d),y&&(w=a.default.CancelToken,E=w.source(),_=function(){return E.cancel()},y.addEventListener("abort",_),g.cancelToken=E.token),[4,(0,a.default)(g)];case 2:if((S=o.sent()).status>=1&&S.status<=499&&p.setNodeHealthcheck(v,u),p.logger.debug("Request #".concat(r,": Request to Node ").concat(v.index," was made. Response Code was ").concat(S.status,".")),S.status>=200&&S.status<300)return[2,{value:Promise.resolve(S.data)}];if(S.status<500)return[2,{value:Promise.reject(p.customErrorForResponse(S,null===(s=S.data)||void 0===s?void 0:s.message))}];throw p.customErrorForResponse(S,null===(c=S.data)||void 0===c?void 0:c.message);case 3:return x=o.sent(),p.setNodeHealthcheck(v,false),i=x,p.logger.warn("Request #".concat(r,": Request to Node ").concat(v.index,' failed due to "').concat(x.code," ").concat(x.message).concat(null==x.response?"":" - "+JSON.stringify(null===(l=x.response)||void 0===l?void 0:l.data),'"')),p.logger.warn("Request #".concat(r,": Sleeping for ").concat(p.retryIntervalSeconds,"s and then retrying request...")),[4,p.timer(p.retryIntervalSeconds)];case 4:return o.sent(),[3,6];case 5:return y&&_&&y.removeEventListener("abort",_),[7];case 6:return[2]}}))},p=this,v=1,g.label=1;case 1:return v<=this.numRetriesPerRequest+1?[5,f(v)]:[3,4];case 2:if("object"===e(_=g.sent()))return[2,_.value];g.label=3;case 3:return v++,[3,1];case 4:return this.logger.debug("Request #".concat(r,": No retries left. Raising last error")),[2,Promise.reject(i)]}}))}))},t.prototype.getNextNode=function(e){if(void 0===e&&(e=0),null!=this.nearestNode){if(this.logger.debug("Request #".concat(e,": Nodes Health: Node ").concat(this.nearestNode.index," is ").concat(!0===this.nearestNode.isHealthy?"Healthy":"Unhealthy")),!0===this.nearestNode.isHealthy||this.nodeDueForHealthcheck(this.nearestNode,e))return this.logger.debug("Request #".concat(e,": Updated current node to Node ").concat(this.nearestNode.index)),this.nearestNode;this.logger.debug("Request #".concat(e,": Falling back to individual nodes"))}this.logger.debug("Request #".concat(e,": Nodes Health: ").concat(this.nodes.map((function(e){return"Node ".concat(e.index," is ").concat(!0===e.isHealthy?"Healthy":"Unhealthy")})).join(" || ")));for(var t=this.nodes[0],n=0;n<=this.nodes.length;n++)if(this.currentNodeIndex=(this.currentNodeIndex+1)%this.nodes.length,!0===(t=this.nodes[this.currentNodeIndex]).isHealthy||this.nodeDueForHealthcheck(t,e))return this.logger.debug("Request #".concat(e,": Updated current node to Node ").concat(t.index)),t;return this.logger.debug("Request #".concat(e,": No healthy nodes were found. Returning the next node, Node ").concat(t.index)),t},t.prototype.nodeDueForHealthcheck=function(e,t){void 0===t&&(t=0);var n=Date.now()-e.lastAccessTimestamp>1e3*this.healthcheckIntervalSeconds;return n&&this.logger.debug("Request #".concat(t,": Node ").concat(e.index," has exceeded healtcheckIntervalSeconds of ").concat(this.healthcheckIntervalSeconds,". Adding it back into rotation.")),n},t.prototype.initializeMetadataForNodes=function(){var e=this;null!=this.nearestNode&&(this.nearestNode.index="nearestNode",this.setNodeHealthcheck(this.nearestNode,u)),this.nodes.forEach((function(t,n){t.index=n,e.setNodeHealthcheck(t,u)}))},t.prototype.setNodeHealthcheck=function(e,t){e.isHealthy=t,e.lastAccessTimestamp=Date.now()},t.prototype.uriFor=function(e,t){return null!=t.url?"".concat(t.url).concat(e):"".concat(t.protocol,"://").concat(t.host,":").concat(t.port).concat(t.path).concat(e)},t.prototype.defaultHeaders=function(){var e={};return this.sendApiKeyAsQueryParam||(e["X-TYPESENSE-API-KEY"]=this.apiKey),e["Content-Type"]="application/json",e},t.prototype.timer=function(e){return r(this,void 0,void 0,(function(){return o(this,(function(t){return[2,new Promise((function(t){return setTimeout(t,1e3*e)}))]}))}))},t.prototype.customErrorForResponse=function(e,t){var n="Request failed with HTTP code ".concat(e.status);"string"==typeof t&&""!==t.trim()&&(n+=" | Server said: ".concat(t));var r=new s.default(n);return(r=400===e.status?new Nr.RequestMalformed(n):401===e.status?new Nr.RequestUnauthorized(n):404===e.status?new Nr.ObjectNotFound(n):409===e.status?new Nr.ObjectAlreadyExists(n):422===e.status?new Nr.ObjectUnprocessable(n):e.status>=500&&e.status<=599?new Nr.ServerError(n):new Nr.HTTPError(n)).httpStatus=e.status,r},t}();n.default=c}));De(Xf);var Qf=Me((function(e,t){var n=Ne&&Ne.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{u(r.next(e))}catch(e){i(e)}}function s(e){try{u(r.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}u((r=r.apply(e,t||[])).next())}))},r=Ne&&Ne.__generator||function(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]c&&(m=this.responseCache.keys().next().value,this.responseCache.delete(m)),this.responsePromiseCache.size>c&&(m=this.responsePromiseCache.keys().next().value,this.responsePromiseCache.delete(m)),[2,v]}}))}))},e}();t.default=i}));De(eh);var th=Me((function(e,t){var n=Ne&&Ne.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{u(r.next(e))}catch(e){i(e)}}function s(e){try{u(r.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}u((r=r.apply(e,t||[])).next())}))},r=Ne&&Ne.__generator||function(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]0)throw new Nr.ImportError("".concat(o.length-a.length," documents imported successfully, ").concat(a.length," documents failed during import. Use `error.importResults` from the raised exception to get a detailed error reason for each document."),o);return[2,o]}return[2,r]}}))}))},t.prototype.export=function(e){return void 0===e&&(e={}),o(this,void 0,void 0,(function(){return i(this,(function(t){return[2,this.apiCall.get(this.endpointPath("export"),e)]}))}))},t.prototype.exportStream=function(e){return void 0===e&&(e={}),o(this,void 0,void 0,(function(){return i(this,(function(t){return[2,this.apiCall.get(this.endpointPath("export"),e,{responseType:"stream"})]}))}))},t}(th.SearchOnlyDocuments);t.default=a}));De(nh);var rh=Me((function(e,t){var n=Ne&&Ne.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{u(r.next(e))}catch(e){i(e)}}function s(e){try{u(r.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}u((r=r.apply(e,t||[])).next())}))},r=Ne&&Ne.__generator||function(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]2e3&&(console.warn("[typesense] API Key is longer than 2000 characters which is over the allowed limit, so disabling sending it as a query parameter."),e.sendApiKeyAsQueryParam=!1),this.configuration=new r.default(e),this.apiCall=new o.default(this.configuration),this.multiSearch=new i.default(this.apiCall,this.configuration,!0),this.individualCollections={}}return e.prototype.clearCache=function(){this.multiSearch.clearCache(),Object.entries(this.individualCollections).forEach((function(e){e[0];e[1].documents().clearCache()}))},e.prototype.collections=function(e){if(e)return void 0===this.individualCollections[e]&&(this.individualCollections[e]=new xh.SearchOnlyCollection(e,this.apiCall,this.configuration)),this.individualCollections[e];throw new Error("Typesense.SearchClient only supports search operations, so the collectionName that needs to be searched must be specified. Use Typesense.Client if you need to access the collection object.")},e}();t.default=a}));De(kh);var Ch=Me((function(e,t){var n=Ne&&Ne.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var o=Object.getOwnPropertyDescriptor(t,n);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,o)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),r=Ne&&Ne.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=Ne&&Ne.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var o in e)"default"!==o&&Object.prototype.hasOwnProperty.call(e,o)&&n(t,e,o);return r(t,e),t},i=Ne&&Ne.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.Errors=t.SearchClient=t.Client=void 0;var a=i(Sh);t.Client=a.default;var s=i(kh);t.SearchClient=s.default;var u=o(Nr);t.Errors=u,t.default={Client:a.default,SearchClient:s.default,Errors:u}}));De(Ch);Ch.Errors;var Rh=Ch.SearchClient,Ph=(Ch.Client,Me((function(e){e.exports=function(e){return e&&e.__esModule?e:{default:e}},e.exports.__esModule=!0,e.exports.default=e.exports})));De(Ph);var jh=Me((function(e){e.exports=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},e.exports.__esModule=!0,e.exports.default=e.exports}));De(jh);var Ah=Me((function(e){function t(e,t){for(var n=0;n","g"),t||"").replace(new RegExp("","g"),n||"")},_adaptNumberOfPages:function(){var e=this.typesenseResponse.found/this.typesenseResponse.request_params.per_page;return Number.isFinite(e)?Math.ceil(e):1}};t.utils=n}));De(Th);Th.utils;var Ih=Me((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.SearchResponseAdapter=void 0;var n=Ph(Ke),r=Ph(Ve),o=Ph(Kn),i=Ph(Je),a=Ph(jh),s=Ph(Ah);function u(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function c(e){for(var t=1;t3&&void 0!==arguments[3]?arguments[3]:[];(0,a.default)(this,e),this.typesenseResponse=t,this.instantsearchRequest=n,this.configuration=r,this.allTypesenseResponses=o}return(0,s.default)(e,[{key:"_adaptGroupedHits",value:function(e){var t=this,n=[];return n=e.map((function(e){var n=t._adaptHits(e.hits);return n.forEach((function(t){t.group_key=t._group_key=e.group_key,e.found&&(t._group_found=e.found)})),n})),n=this.configuration.flattenGroupedHits?n.flat():n.map((function(e){return c(c({},e[0]),{},{_grouped_hits:e})}))}},{key:"_adaptHits",value:function(e){var t=this;return e.map((function(e){var n=c({},e.document);n.objectID=e.document.id,n._snippetResult=t._adaptHighlightResult(e,"snippet"),n._highlightResult=t._adaptHighlightResult(e,"value"),n._rawTypesenseHit=e,["text_match","geo_distance_meters","curated","text_match_info","hybrid_search_info","vector_distance"].forEach((function(t){Object.keys(e).includes(t)&&!Object.keys(n).includes(t)&&(n[t]=e[t])}));var r=n[t.configuration.geoLocationField];return r&&(n._geoloc={lat:r[0],lng:r[1]}),n}))}},{key:"_adaptHighlightResult",value:function(e,t){var n={};return null!=e.highlight&&this.isHighlightPost0240RCN32Format(e.highlight)?this.adaptHighlightObject(e,n,t):this.adaptHighlightsArray(e,n,t),n}},{key:"isHighlightPost0240RCN32Format",value:function(e){return null==e.full&&null==e.snippet}},{key:"adaptHighlightsArray",value:function(e,t,a){var s=this;Object.assign.apply(Object,[t].concat((0,o.default)(Object.entries(e.document).map((function(e){var t=(0,r.default)(e,2),n=t[0],o=t[1];return(0,i.default)({},n,{value:o,matchLevel:"none",matchedWords:[]})}))))),e.highlights.forEach((function(e){t[e.field]={value:e[a]||e["".concat(a,"s")],matchLevel:"full",matchedWords:e.matched_tokens},e.indices&&(t[e.field].matchedIndices=e.indices)})),Object.entries(t).forEach((function(o){var i=(0,r.default)(o,2),u=i[0],c=i[1],l=u,f=c.value,h=c.matchLevel,p=c.matchedWords,d=c.matchedIndices;null==f?t[l]=s._adaptHighlightNullValue():Array.isArray(f)?(t[l]=[],e.document[l].forEach((function(e,r){d&&d.includes(r)?t[l].push({value:s._adaptHighlightTag("".concat(f[d.indexOf(r)]),s.instantsearchRequest.params.highlightPreTag,s.instantsearchRequest.params.highlightPostTag),matchLevel:h,matchedWords:p[r]}):"object"===(0,n.default)(e)?t[l].push(s._adaptHighlightInObjectValue(e,{},a)):t[l].push({value:"".concat(e),matchLevel:"none",matchedWords:[]})}))):"object"===(0,n.default)(f)?t[l]=s._adaptHighlightInObjectValue(f,{},a):t[l].value=s._adaptHighlightTag("".concat(f),s.instantsearchRequest.params.highlightPreTag,s.instantsearchRequest.params.highlightPostTag)}))}},{key:"adaptHighlightObject",value:function(e,t,n){Object.assign(t,this._adaptHighlightInObjectValue(e.document,e.highlight,n))}},{key:"_adaptHighlightInObjectValue",value:function(e,t,a){var s=this;return Object.assign.apply(Object,[{}].concat((0,o.default)(Object.entries(e).map((function(e){var o,u=(0,r.default)(e,2),c=u[0],l=u[1];if(null==l)o=s._adaptHighlightNullValue();else if(Array.isArray(l)){var f;o=s._adaptHighlightInArrayValue(l,null!==(f=null==t?void 0:t[c])&&void 0!==f?f:[],a)}else if("object"===(0,n.default)(l)){var h;o=s._adaptHighlightInObjectValue(l,null!==(h=null==t?void 0:t[c])&&void 0!==h?h:{},a)}else o=s._adaptHighlightInPrimitiveValue(l,null==t?void 0:t[c],a);return(0,i.default)({},c,o)})))))}},{key:"_adaptHighlightInArrayValue",value:function(e,t,r){var o=this;return e.map((function(e,i){var a;if(null==e)a=o._adaptHighlightNullValue();else if(Array.isArray(e)){var s;a=o._adaptHighlightInArrayValue(e,null!==(s=null==t?void 0:t[i])&&void 0!==s?s:[],r)}else if("object"===(0,n.default)(e)){var u;a=o._adaptHighlightInObjectValue(e,null!==(u=null==t?void 0:t[i])&&void 0!==u?u:{},r)}else a=o._adaptHighlightInPrimitiveValue(e,null==t?void 0:t[i],r);return a}))}},{key:"_adaptHighlightInPrimitiveValue",value:function(e,t,n){var r,o;return null!=t?{value:this._adaptHighlightTag("".concat(null!==(r=null!==(o=t[n])&&void 0!==o?o:t.highlight)&&void 0!==r?r:t.snippet),this.instantsearchRequest.params.highlightPreTag,this.instantsearchRequest.params.highlightPostTag),matchLevel:(t.matched_tokens||[]).length>0?"full":"none",matchedWords:t.matched_tokens||[]}:{value:this._adaptHighlightTag("".concat(e),this.instantsearchRequest.params.highlightPreTag,this.instantsearchRequest.params.highlightPostTag),matchLevel:"none",matchedWords:[]}}},{key:"_adaptHighlightNullValue",value:function(){return{value:"",matchLevel:"none",matchedWords:[]}}},{key:"_adaptFacets",value:function(e){var t={};return e.forEach((function(e){Object.assign(t,(0,i.default)({},e.field_name,Object.assign.apply(Object,[{}].concat((0,o.default)(e.counts.map((function(e){return(0,i.default)({},e.value,e.count)})))))))})),t}},{key:"_adaptFacetStats",value:function(e){var t={};return e.forEach((function(e){Object.keys(e.stats).length>0&&Object.assign(t,(0,i.default)({},e.field_name,e.stats))})),t}},{key:"_adaptRenderingContent",value:function(e){var t,n=Object.assign({},this.configuration.renderingContent);return null==(null===(t=n.facetOrdering)||void 0===t||null===(t=t.facets)||void 0===t?void 0:t.order)&&(n.facetOrdering=n.facetOrdering||{},n.facetOrdering.facets=n.facetOrdering.facets||{},n.facetOrdering.facets.order=(0,o.default)(new Set(e.map((function(e){return e.field_name})).concat(this.allTypesenseResponses.map((function(e){return e.facet_counts||[]})).flat().map((function(e){return e.field_name})).filter((function(e){return e})))))),n}},{key:"adapt",value:function(){var e=this._adaptRenderingContent(this.typesenseResponse.facet_counts||[]);return c({hits:this.typesenseResponse.grouped_hits?this._adaptGroupedHits(this.typesenseResponse.grouped_hits):this._adaptHits(this.typesenseResponse.hits),nbHits:this.typesenseResponse.found,page:this.typesenseResponse.page-1,nbPages:this._adaptNumberOfPages(),hitsPerPage:this.typesenseResponse.request_params.per_page,facets:this._adaptFacets(this.typesenseResponse.facet_counts||[]),facets_stats:this._adaptFacetStats(this.typesenseResponse.facet_counts||{}),query:this.typesenseResponse.request_params.q,processingTimeMS:this.typesenseResponse.search_time_ms},Object.keys(e).length>0?{renderingContent:e}:null)}}]),e}();t.SearchResponseAdapter=l,Object.assign(l.prototype,Th.utils)}));De(Ih);var Lh=Ih.SearchResponseAdapter;function Nh(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Dh(e){for(var t=1;t",highlightPostTag:""})},{geoLocationField:""}),e.abrupt("return",{results:[a.adapt()]});case 6:case"end":return e.stop()}}),e)}))),function(e){return n.apply(this,arguments)})};return t(o)}),[t,e])}(n,y),B=Le.useRef(yr({key:"__DOCSEARCH_FAVORITE_SEARCHES__".concat(T),limit:10})).current,z=Le.useRef(yr({key:"__DOCSEARCH_RECENT_SEARCHES__".concat(T),limit:4})).current,Z=Le.useCallback((function(e){if(!b){var t="content"===e.type?e.__docsearch_parent:e;t&&-1===B.getAll().findIndex((function(e){return e.objectID===t.objectID}))&&z.add(t)}}),[B,z,b]),V=Le.useMemo((function(){return Pn({id:"docsearch",defaultActiveItemId:0,placeholder:i,openOnFocus:!0,initialState:{query:H,context:{searchSuggestions:[]}},navigator:d,onStateChange:function(e){A(e.state)},getSources:function(e){var n=e.query,o=e.state,i=e.setContext,a=e.setStatus;return n?q.search([Fh({collection:t,q:n,query_by:"hierarchy.lvl0,hierarchy.lvl1,hierarchy.lvl2,hierarchy.lvl3,hierarchy.lvl4,hierarchy.lvl5,hierarchy.lvl6,content",include_fields:"hierarchy.lvl0,hierarchy.lvl1,hierarchy.lvl2,hierarchy.lvl3,hierarchy.lvl4,hierarchy.lvl5,hierarchy.lvl6,content,anchor,url,type,id",highlight_full_fields:"hierarchy.lvl0,hierarchy.lvl1,hierarchy.lvl2,hierarchy.lvl3,hierarchy.lvl4,hierarchy.lvl5,hierarchy.lvl6,content",group_by:"url",group_limit:3,sort_by:"item_priority:desc",snippet_threshold:8,highlight_affix_num_tokens:4},r)]).catch((function(e){throw"RetryError"===e.name&&a("error"),e})).then((function(e){var t=e.results[0],n=t.hits,r=t.nbHits,a=rr(n,(function(e){return ur(e)}));return o.context.searchSuggestions.length0&&(Y(),M.current&&M.current.focus())}),[H,Y]),Le.useEffect((function(){function e(){if(L.current){var e=.01*window.innerHeight;L.current.style.setProperty("--docsearch-vh","".concat(e,"px"))}}return e(),window.addEventListener("resize",e),function(){window.removeEventListener("resize",e)}}),[]),Le.createElement("div",Fe({ref:I},K({"aria-expanded":!0}),{className:["DocSearch","DocSearch-Container","stalled"===j.status&&"DocSearch-Container--Stalled","error"===j.status&&"DocSearch-Container--Errored"].filter(Boolean).join(" "),role:"button",tabIndex:0,onMouseDown:function(e){e.target===e.currentTarget&&s()}}),Le.createElement("div",{className:"DocSearch-Modal",ref:L},Le.createElement("header",{className:"DocSearch-SearchBar",ref:N},Le.createElement(vr,Fe({},V,{state:j,autoFocus:0===H.length,inputRef:M,isFromSelection:Boolean(H)&&H===F,translations:k,onClose:s}))),Le.createElement("div",{className:"DocSearch-Dropdown nc-scrollbar-md",ref:D},Le.createElement(pr,Fe({},V,{indexName:T,state:j,hitComponent:f,resultsFooterComponent:p,disableUserPersonalization:b,recentSearches:z,favoriteSearches:B,inputRef:M,translations:C,getMissingResultsUrl:x,onItemClick:function(e){Z(e),s()}}))),Le.createElement("footer",{className:"DocSearch-Footer"},Le.createElement(An,null))))}function qh(e){var t,n=Le.useState(!1),r=We(n,2),o=r[0],i=r[1],a=Le.useCallback((function(){var e;null!==(e=window)&&void 0!==e&&e.doc_enabled&&i(!0)}),[i]),s=Le.useCallback((function(){i(!1)}),[i]);return J((function(){var e=function(e){var t,n,r;o&&"Escape"===e.key?s():"k"===(null===(t=e.key)||void 0===t?void 0:t.toLocaleLowerCase())&&(e.metaKey||e.ctrlKey)&&o||"l"===(null===(n=e.key)||void 0===n?void 0:n.toLocaleLowerCase())&&(e.metaKey||e.ctrlKey)&&o?(e.preventDefault(),s()):"j"!==(null===(r=e.key)||void 0===r?void 0:r.toLowerCase())||!e.metaKey&&!e.ctrlKey||o||(e.preventDefault(),a())};return document.addEventListener("keydown",e),function(){document.removeEventListener("keydown",e)}}),[o,s,a]),Le.createElement(Le.Fragment,null,o&&ge(Le.createElement(Hh,Fe({},e,{initialScrollY:window.scrollY,placeholder:"Search through our docs",initialQuery:e.initialQuery,translations:null==e||null===(t=e.translations)||void 0===t?void 0:t.modal,onClose:s})),document.body))}return function(e){Ee(Le.createElement(qh,e),function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:window;return"string"==typeof e?t.document.querySelector(e):e}(e.container,e.environment))}}));
+//# sourceMappingURL=index.js.map
diff --git a/packages/nocodb/src/controllers/command-palette.controller.spec.ts b/packages/nocodb/src/controllers/command-palette.controller.spec.ts
new file mode 100644
index 0000000000..9ffdcc8854
--- /dev/null
+++ b/packages/nocodb/src/controllers/command-palette.controller.spec.ts
@@ -0,0 +1,19 @@
+import { Test } from '@nestjs/testing';
+import { CommandPaletteController } from './command-palette.controller';
+import type { TestingModule } from '@nestjs/testing';
+
+describe('CommandPaletteController', () => {
+ let controller: CommandPaletteController;
+
+ beforeEach(async () => {
+ const module: TestingModule = await Test.createTestingModule({
+ controllers: [CommandPaletteController],
+ }).compile();
+
+ controller = module.get(CommandPaletteController);
+ });
+
+ it('should be defined', () => {
+ expect(controller).toBeDefined();
+ });
+});
diff --git a/packages/nocodb/src/controllers/command-palette.controller.ts b/packages/nocodb/src/controllers/command-palette.controller.ts
new file mode 100644
index 0000000000..85e41faae6
--- /dev/null
+++ b/packages/nocodb/src/controllers/command-palette.controller.ts
@@ -0,0 +1,27 @@
+import { Controller, HttpCode, Post, Req, UseGuards } from '@nestjs/common';
+import { Request } from 'express';
+import type { UserType } from 'nocodb-sdk';
+import { GlobalGuard } from '~/guards/global/global.guard';
+import { CommandPaletteService } from '~/services/command-palette.service';
+import { Acl } from '~/middlewares/extract-ids/extract-ids.middleware';
+import { MetaApiLimiterGuard } from '~/guards/meta-api-limiter.guard';
+
+@Controller()
+@UseGuards(MetaApiLimiterGuard, GlobalGuard)
+export class CommandPaletteController {
+ constructor(private commandPaletteService: CommandPaletteService) {}
+
+ @Post('/api/v1/command_palette')
+ @Acl('commandPalette', {
+ scope: 'org',
+ })
+ @HttpCode(200)
+ async commandPalette(@Req() req: Request) {
+ const data = this.commandPaletteService.commandPalette({
+ user: req?.user as UserType,
+ body: req.body,
+ });
+
+ return data;
+ }
+}
diff --git a/packages/nocodb/src/modules/metas/metas.module.ts b/packages/nocodb/src/modules/metas/metas.module.ts
index d11e812fea..ed12b16860 100644
--- a/packages/nocodb/src/modules/metas/metas.module.ts
+++ b/packages/nocodb/src/modules/metas/metas.module.ts
@@ -73,6 +73,8 @@ import { BaseUsersService } from '~/services/base-users/base-users.service';
import { NotificationsService } from '~/services/notifications.service';
import { NotificationsController } from '~/controllers/notifications.controller';
import { NotificationsGateway } from '~/gateways/notifications/notifications.gateway';
+import { CommandPaletteService } from '~/services/command-palette.service';
+import { CommandPaletteController } from '~/controllers/command-palette.controller';
export const metaModuleMetadata = {
imports: [
@@ -122,6 +124,7 @@ export const metaModuleMetadata = {
SortsController,
SharedBasesController,
NotificationsController,
+ CommandPaletteController,
]
: []),
],
@@ -163,6 +166,7 @@ export const metaModuleMetadata = {
BulkDataAliasService,
NotificationsService,
NotificationsGateway,
+ CommandPaletteService,
],
exports: [
TablesService,
diff --git a/packages/nocodb/src/schema/swagger.json b/packages/nocodb/src/schema/swagger.json
index 6881c617e3..40dfff3831 100644
--- a/packages/nocodb/src/schema/swagger.json
+++ b/packages/nocodb/src/schema/swagger.json
@@ -16329,6 +16329,32 @@
]
}
},
+ "/api/v1/command_palette": {
+ "parameters": [],
+ "post": {
+ "summary": "Get command palette suggestions",
+ "operationId": "utils-command-palette",
+ "responses": {
+ "200": {
+ "description": "OK",
+ "content": {
+ "application/json": {
+ "schema": {}
+ }
+ }
+ }
+ },
+ "tags": [
+ "Utils"
+ ],
+ "requestBody": {
+ "content": {
+ "application/json": {}
+ }
+ },
+ "description": "Get dynamic command palette suggestions based on scope"
+ }
+ },
"/jobs/listen": {
"post": {
"summary": "Jobs Listen",
diff --git a/packages/nocodb/src/services/command-palette.service.spec.ts b/packages/nocodb/src/services/command-palette.service.spec.ts
new file mode 100644
index 0000000000..4bce5c3054
--- /dev/null
+++ b/packages/nocodb/src/services/command-palette.service.spec.ts
@@ -0,0 +1,19 @@
+import { Test } from '@nestjs/testing';
+import { CommandPaletteService } from './command-palette.service';
+import type { TestingModule } from '@nestjs/testing';
+
+describe('CommandPaletteService', () => {
+ let service: CommandPaletteService;
+
+ beforeEach(async () => {
+ const module: TestingModule = await Test.createTestingModule({
+ providers: [CommandPaletteService],
+ }).compile();
+
+ service = module.get(CommandPaletteService);
+ });
+
+ it('should be defined', () => {
+ expect(service).toBeDefined();
+ });
+});
diff --git a/packages/nocodb/src/services/command-palette.service.ts b/packages/nocodb/src/services/command-palette.service.ts
new file mode 100644
index 0000000000..7bf3ac2585
--- /dev/null
+++ b/packages/nocodb/src/services/command-palette.service.ts
@@ -0,0 +1,114 @@
+import { Injectable } from '@nestjs/common';
+import { type UserType, ViewTypes } from 'nocodb-sdk';
+import { Base } from '~/models';
+import { TablesService } from '~/services/tables.service';
+
+const viewTypeAlias: Record = {
+ [ViewTypes.GRID]: 'grid',
+ [ViewTypes.FORM]: 'form',
+ [ViewTypes.GALLERY]: 'gallery',
+ [ViewTypes.KANBAN]: 'kanban',
+ [ViewTypes.MAP]: 'map',
+};
+
+@Injectable()
+export class CommandPaletteService {
+ constructor(private tablesService: TablesService) {}
+
+ async commandPalette(param: { body: any; user: UserType }) {
+ const cmdData = [];
+ try {
+ const { scope } = param.body;
+
+ if (scope === 'root') {
+ const bases = await Base.list({ user: param.user });
+
+ for (const base of bases) {
+ cmdData.push({
+ id: `p-${base.id}`,
+ title: base.title,
+ icon: 'project',
+ section: 'Bases',
+ scopePayload: {
+ scope: `p-${base.id}`,
+ data: {
+ base_id: base.id,
+ },
+ },
+ });
+ }
+ } else if (scope.startsWith('p-')) {
+ const allBases = [];
+
+ const bases = await Base.list({ user: param.user });
+
+ allBases.push(...bases);
+
+ const viewList = [];
+
+ for (const base of bases) {
+ viewList.push(
+ ...(
+ (await this.tablesService.xcVisibilityMetaGet(
+ base.id,
+ null,
+ false,
+ )) as any[]
+ ).filter((v) => {
+ return Object.keys(param.user.roles).some(
+ (role) => param.user.roles[role] && !v.disabled[role],
+ );
+ }),
+ );
+ }
+
+ const tableList = [];
+ const vwList = [];
+
+ for (const b of allBases) {
+ cmdData.push({
+ id: `p-${b.id}`,
+ title: b.title,
+ icon: 'project',
+ section: 'Bases',
+ });
+ }
+
+ for (const v of viewList) {
+ if (!tableList.find((el) => el.id === `tbl-${v.fk_model_id}`)) {
+ tableList.push({
+ id: `tbl-${v.fk_model_id}`,
+ title: v._ptn,
+ parent: `p-${v.base_id}`,
+ icon: v?.table_meta?.icon || v.ptype,
+ projectName: bases.find((el) => el.id === v.base_id)?.title,
+ section: 'Tables',
+ });
+ }
+ vwList.push({
+ id: `vw-${v.id}`,
+ title: `${v.title}`,
+ parent: `tbl-${v.fk_model_id}`,
+ icon: v?.meta?.icon || viewTypeAlias[v.type] || 'table',
+ projectName: bases.find((el) => el.id === v.base_id)?.title,
+ section: 'Views',
+ is_default: v?.is_default,
+ handler: {
+ type: 'navigate',
+ payload: `/nc/${v.base_id}/${v.fk_model_id}/${encodeURIComponent(
+ v.id,
+ )}`,
+ },
+ });
+ }
+
+ cmdData.push(...tableList);
+ cmdData.push(...vwList);
+ }
+ } catch (e) {
+ console.log(e);
+ return [];
+ }
+ return cmdData;
+ }
+}