@loaders.gl/parquet 4.0.0-beta.1 → 4.0.0-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/dist.min.js +1 -1
- package/dist/es5/parquet-loader.js +1 -1
- package/dist/es5/parquet-wasm-loader.js +1 -1
- package/dist/es5/parquet-wasm-writer.js +1 -1
- package/dist/es5/parquet-writer.js +1 -1
- package/dist/esm/parquet-loader.js +1 -1
- package/dist/esm/parquet-wasm-loader.js +1 -1
- package/dist/esm/parquet-wasm-writer.js +1 -1
- package/dist/esm/parquet-writer.js +1 -1
- package/dist/parquet-worker.js +2 -2
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +8 -8
package/dist/dist.min.js
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
`))):s=t.stylize("[Circular]","special")),Cf(o)){if(i&&n.match(/^\d+$/))return s;o=JSON.stringify(""+n),o.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(o=o.substr(1,o.length-2),o=t.stylize(o,"name")):(o=o.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),o=t.stylize(o,"string"))}return o+": "+s}function Oq(t,e,f){var r=t.reduce(function(n,i){return i.indexOf(`
|
|
10
10
|
`)>=0,n+i.replace(/\u001b\[\d\d?m/g,"").length+1},0);return r>60?f[0]+(e===""?"":e+`
|
|
11
11
|
`)+" "+t.join(`,
|
|
12
|
-
`)+" "+f[1]:f[0]+e+" "+t.join(", ")+" "+f[1]}function db(t){return Array.isArray(t)}function Gs(t){return typeof t=="boolean"}function Mo(t){return t===null}function Hq(t){return t==null}function hb(t){return typeof t=="number"}function Ko(t){return typeof t=="string"}function Nq(t){return babelHelpers.typeof(t)==="symbol"}function Cf(t){return t===void 0}function Wo(t){return cn(t)&&Qs(t)==="[object RegExp]"}function cn(t){return babelHelpers.typeof(t)==="object"&&t!==null}function Js(t){return cn(t)&&Qs(t)==="[object Date]"}function Yo(t){return cn(t)&&(Qs(t)==="[object Error]"||t instanceof Error)}function Vo(t){return typeof t=="function"}function Rq(t){return t===null||typeof t=="boolean"||typeof t=="number"||typeof t=="string"||babelHelpers.typeof(t)==="symbol"||typeof t=="undefined"}function Pq(t){return Buffer.isBuffer(t)}function Qs(t){return Object.prototype.toString.call(t)}function Xs(t){return t<10?"0"+t.toString(10):t.toString(10)}function Fq(){var t=new Date,e=[Xs(t.getHours()),Xs(t.getMinutes()),Xs(t.getSeconds())].join(":");return[t.getDate(),zq[t.getMonth()],e].join(" ")}function Dq(){console.log("%s - %s",Fq(),Ks.apply(null,arguments))}function gb(t,e){if(!e||!cn(e))return t;for(var f=Object.keys(e),r=f.length;r--;)t[f[r]]=e[f[r]];return t}function jb(t,e){return Object.prototype.hasOwnProperty.call(t,e)}var Co,wq,mq,uq,Tf,tf,bq,Cs,Pr,ub,Ls,yq,vq,bn,se,j_,q_,y_,v_,pr,k_,Us,T_,Gt,__,wr,B_,kq,Ms,Tq,_q,Lo,Ws,zq,Cq,Ce,x_,E_,I_,S_,A_,O_,H_,N_,R_,P_,mf,z_,F_,me,D_,dn,C_,zr,L_,Fr,U_,Go,K_,hn,W_,gn,Y_,Lf,V_,M,G_,J_,Q_,X_,Z_,$_,eB,tB,fB,rB,nB,iB,oB,lB,sB,aB,pB,wB,mB,uB,bB,cB,dB,hB,gB,jB,qB,yB,vB,kB,TB,_B,BB,xB,Zs,EB,mr,IB,jn,SB,ur,AB,OB,Jo,HB,Qo,NB,wi,RB,PB,mi,zB,FB,Xo,DB,ue,CB,LB,UB,qb,MB,yb,KB,WB,YB,VB,GB,JB,QB,XB,ZB,$B,ex,tx,fx,rx,nx,ix,ox,lx,sx,ax,px,wx,mx,ux,bx,cx,dx,hx,gx,jx,qx,yx,vx,kx,Tx,_x,Bx,xx,Ex,Ix,Sx,Ax,Ox,Hx,Nx,Rx,Px,zx,Fx,Dx,Cx,Lx,$s=J(()=>{Co=typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:{};wq=cq,mq=hq,uq=qq,Tf=[],tf=[],bq=typeof Uint8Array!="undefined"?Uint8Array:Array,Cs="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(Pr=0,ub=Cs.length;Pr<ub;++Pr)Tf[Pr]=Cs[Pr],tf[Cs.charCodeAt(Pr)]=Pr;tf["-".charCodeAt(0)]=62;tf["_".charCodeAt(0)]=63;Ls={byteLength:wq,toByteArray:mq,fromByteArray:uq},yq=function(e,f,r,n,i){var o,s,a=i*8-n-1,p=(1<<a)-1,w=p>>1,g=-7,m=r?i-1:0,j=r?-1:1,B=e[f+m];for(m+=j,o=B&(1<<-g)-1,B>>=-g,g+=a;g>0;o=o*256+e[f+m],m+=j,g-=8);for(s=o&(1<<-g)-1,o>>=-g,g+=n;g>0;s=s*256+e[f+m],m+=j,g-=8);if(o===0)o=1-w;else{if(o===p)return s?NaN:(B?-1:1)*(1/0);s=s+Math.pow(2,n),o=o-w}return(B?-1:1)*s*Math.pow(2,o-n)},vq=function(e,f,r,n,i,o){var s,a,p,w=o*8-i-1,g=(1<<w)-1,m=g>>1,j=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,B=n?0:o-1,v=n?1:-1,R=f<0||f===0&&1/f<0?1:0;for(f=Math.abs(f),isNaN(f)||f===1/0?(a=isNaN(f)?1:0,s=g):(s=Math.floor(Math.log(f)/Math.LN2),f*(p=Math.pow(2,-s))<1&&(s--,p*=2),s+m>=1?f+=j/p:f+=j*Math.pow(2,1-m),f*p>=2&&(s++,p/=2),s+m>=g?(a=0,s=g):s+m>=1?(a=(f*p-1)*Math.pow(2,i),s=s+m):(a=f*Math.pow(2,m-1)*Math.pow(2,i),s=0));i>=8;e[r+B]=a&255,B+=v,a/=256,i-=8);for(s=s<<i|a,w+=i;w>0;e[r+B]=s&255,B+=v,s/=256,w-=8);e[r+B-v]|=R*128},bn={read:yq,write:vq},se=Ze(function(t,e){var f=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;e.Buffer=o,e.SlowBuffer=R,e.INSPECT_MAX_BYTES=50;var r=2147483647;e.kMaxLength=r,o.TYPED_ARRAY_SUPPORT=n(),!o.TYPED_ARRAY_SUPPORT&&typeof console!="undefined"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function n(){try{var q=new Uint8Array(1),u={foo:function(){return 42}};return Object.setPrototypeOf(u,Uint8Array.prototype),Object.setPrototypeOf(q,u),q.foo()===42}catch{return!1}}Object.defineProperty(o.prototype,"parent",{enumerable:!0,get:function(){if(!!o.isBuffer(this))return this.buffer}}),Object.defineProperty(o.prototype,"offset",{enumerable:!0,get:function(){if(!!o.isBuffer(this))return this.byteOffset}});function i(q){if(q>r)throw new RangeError('The value "'+q+'" is invalid for option "size"');var u=new Uint8Array(q);return Object.setPrototypeOf(u,o.prototype),u}function o(q,u,b){if(typeof q=="number"){if(typeof u=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return w(q)}return s(q,u,b)}o.poolSize=8192;function s(q,u,b){if(typeof q=="string")return g(q,u);if(ArrayBuffer.isView(q))return m(q);if(q==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+babelHelpers.typeof(q));if(Te(q,ArrayBuffer)||q&&Te(q.buffer,ArrayBuffer)||typeof SharedArrayBuffer!="undefined"&&(Te(q,SharedArrayBuffer)||q&&Te(q.buffer,SharedArrayBuffer)))return j(q,u,b);if(typeof q=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');var k=q.valueOf&&q.valueOf();if(k!=null&&k!==q)return o.from(k,u,b);var N=B(q);if(N)return N;if(typeof Symbol!="undefined"&&Symbol.toPrimitive!=null&&typeof q[Symbol.toPrimitive]=="function")return o.from(q[Symbol.toPrimitive]("string"),u,b);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+babelHelpers.typeof(q))}o.from=function(q,u,b){return s(q,u,b)},Object.setPrototypeOf(o.prototype,Uint8Array.prototype),Object.setPrototypeOf(o,Uint8Array);function a(q){if(typeof q!="number")throw new TypeError('"size" argument must be of type number');if(q<0)throw new RangeError('The value "'+q+'" is invalid for option "size"')}function p(q,u,b){return a(q),q<=0?i(q):u!==void 0?typeof b=="string"?i(q).fill(u,b):i(q).fill(u):i(q)}o.alloc=function(q,u,b){return p(q,u,b)};function w(q){return a(q),i(q<0?0:v(q)|0)}o.allocUnsafe=function(q){return w(q)},o.allocUnsafeSlow=function(q){return w(q)};function g(q,u){if((typeof u!="string"||u==="")&&(u="utf8"),!o.isEncoding(u))throw new TypeError("Unknown encoding: "+u);var b=D(q,u)|0,k=i(b),N=k.write(q,u);return N!==b&&(k=k.slice(0,N)),k}function m(q){for(var u=q.length<0?0:v(q.length)|0,b=i(u),k=0;k<u;k+=1)b[k]=q[k]&255;return b}function j(q,u,b){if(u<0||q.byteLength<u)throw new RangeError('"offset" is outside of buffer bounds');if(q.byteLength<u+(b||0))throw new RangeError('"length" is outside of buffer bounds');var k;return u===void 0&&b===void 0?k=new Uint8Array(q):b===void 0?k=new Uint8Array(q,u):k=new Uint8Array(q,u,b),Object.setPrototypeOf(k,o.prototype),k}function B(q){if(o.isBuffer(q)){var u=v(q.length)|0,b=i(u);return b.length===0||q.copy(b,0,0,u),b}if(q.length!==void 0)return typeof q.length!="number"||ft(q.length)?i(0):m(q);if(q.type==="Buffer"&&Array.isArray(q.data))return m(q.data)}function v(q){if(q>=r)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+r.toString(16)+" bytes");return q|0}function R(q){return+q!=q&&(q=0),o.alloc(+q)}o.isBuffer=function(u){return u!=null&&u._isBuffer===!0&&u!==o.prototype},o.compare=function(u,b){if(Te(u,Uint8Array)&&(u=o.from(u,u.offset,u.byteLength)),Te(b,Uint8Array)&&(b=o.from(b,b.offset,b.byteLength)),!o.isBuffer(u)||!o.isBuffer(b))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(u===b)return 0;for(var k=u.length,N=b.length,$=0,ee=Math.min(k,N);$<ee;++$)if(u[$]!==b[$]){k=u[$],N=b[$];break}return k<N?-1:N<k?1:0},o.isEncoding=function(u){switch(String(u).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},o.concat=function(u,b){if(!Array.isArray(u))throw new TypeError('"list" argument must be an Array of Buffers');if(u.length===0)return o.alloc(0);var k;if(b===void 0)for(b=0,k=0;k<u.length;++k)b+=u[k].length;var N=o.allocUnsafe(b),$=0;for(k=0;k<u.length;++k){var ee=u[k];if(Te(ee,Uint8Array)&&(ee=o.from(ee)),!o.isBuffer(ee))throw new TypeError('"list" argument must be an Array of Buffers');ee.copy(N,$),$+=ee.length}return N};function D(q,u){if(o.isBuffer(q))return q.length;if(ArrayBuffer.isView(q)||Te(q,ArrayBuffer))return q.byteLength;if(typeof q!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+babelHelpers.typeof(q));var b=q.length,k=arguments.length>2&&arguments[2]===!0;if(!k&&b===0)return 0;for(var N=!1;;)switch(u){case"ascii":case"latin1":case"binary":return b;case"utf8":case"utf-8":return ae(q).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return b*2;case"hex":return b>>>1;case"base64":return Xf(q).length;default:if(N)return k?-1:ae(q).length;u=(""+u).toLowerCase(),N=!0}}o.byteLength=D;function z(q,u,b){var k=!1;if((u===void 0||u<0)&&(u=0),u>this.length||((b===void 0||b>this.length)&&(b=this.length),b<=0)||(b>>>=0,u>>>=0,b<=u))return"";for(q||(q="utf8");;)switch(q){case"hex":return I(this,u,b);case"utf8":case"utf-8":return c(this,u,b);case"ascii":return F(this,u,b);case"latin1":case"binary":return Z(this,u,b);case"base64":return A(this,u,b);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ke(this,u,b);default:if(k)throw new TypeError("Unknown encoding: "+q);q=(q+"").toLowerCase(),k=!0}}o.prototype._isBuffer=!0;function G(q,u,b){var k=q[u];q[u]=q[b],q[b]=k}o.prototype.swap16=function(){var u=this.length;if(u%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var b=0;b<u;b+=2)G(this,b,b+1);return this},o.prototype.swap32=function(){var u=this.length;if(u%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var b=0;b<u;b+=4)G(this,b,b+3),G(this,b+1,b+2);return this},o.prototype.swap64=function(){var u=this.length;if(u%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var b=0;b<u;b+=8)G(this,b,b+7),G(this,b+1,b+6),G(this,b+2,b+5),G(this,b+3,b+4);return this},o.prototype.toString=function(){var u=this.length;return u===0?"":arguments.length===0?c(this,0,u):z.apply(this,arguments)},o.prototype.toLocaleString=o.prototype.toString,o.prototype.equals=function(u){if(!o.isBuffer(u))throw new TypeError("Argument must be a Buffer");return this===u?!0:o.compare(this,u)===0},o.prototype.inspect=function(){var u="",b=e.INSPECT_MAX_BYTES;return u=this.toString("hex",0,b).replace(/(.{2})/g,"$1 ").trim(),this.length>b&&(u+=" ... "),"<Buffer "+u+">"},f&&(o.prototype[f]=o.prototype.inspect),o.prototype.compare=function(u,b,k,N,$){if(Te(u,Uint8Array)&&(u=o.from(u,u.offset,u.byteLength)),!o.isBuffer(u))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+babelHelpers.typeof(u));if(b===void 0&&(b=0),k===void 0&&(k=u?u.length:0),N===void 0&&(N=0),$===void 0&&($=this.length),b<0||k>u.length||N<0||$>this.length)throw new RangeError("out of range index");if(N>=$&&b>=k)return 0;if(N>=$)return-1;if(b>=k)return 1;if(b>>>=0,k>>>=0,N>>>=0,$>>>=0,this===u)return 0;for(var ee=$-N,Ee=k-b,_e=Math.min(ee,Ee),Le=this.slice(N,$),ht=u.slice(b,k),we=0;we<_e;++we)if(Le[we]!==ht[we]){ee=Le[we],Ee=ht[we];break}return ee<Ee?-1:Ee<ee?1:0};function fe(q,u,b,k,N){if(q.length===0)return-1;if(typeof b=="string"?(k=b,b=0):b>2147483647?b=2147483647:b<-2147483648&&(b=-2147483648),b=+b,ft(b)&&(b=N?0:q.length-1),b<0&&(b=q.length+b),b>=q.length){if(N)return-1;b=q.length-1}else if(b<0)if(N)b=0;else return-1;if(typeof u=="string"&&(u=o.from(u,k)),o.isBuffer(u))return u.length===0?-1:K(q,u,b,k,N);if(typeof u=="number")return u=u&255,typeof Uint8Array.prototype.indexOf=="function"?N?Uint8Array.prototype.indexOf.call(q,u,b):Uint8Array.prototype.lastIndexOf.call(q,u,b):K(q,[u],b,k,N);throw new TypeError("val must be string, number or Buffer")}function K(q,u,b,k,N){var $=1,ee=q.length,Ee=u.length;if(k!==void 0&&(k=String(k).toLowerCase(),k==="ucs2"||k==="ucs-2"||k==="utf16le"||k==="utf-16le")){if(q.length<2||u.length<2)return-1;$=2,ee/=2,Ee/=2,b/=2}function _e(y,_){return $===1?y[_]:y.readUInt16BE(_*$)}var Le;if(N){var ht=-1;for(Le=b;Le<ee;Le++)if(_e(q,Le)===_e(u,ht===-1?0:Le-ht)){if(ht===-1&&(ht=Le),Le-ht+1===Ee)return ht*$}else ht!==-1&&(Le-=Le-ht),ht=-1}else for(b+Ee>ee&&(b=ee-Ee),Le=b;Le>=0;Le--){for(var we=!0,sf=0;sf<Ee;sf++)if(_e(q,Le+sf)!==_e(u,sf)){we=!1;break}if(we)return Le}return-1}o.prototype.includes=function(u,b,k){return this.indexOf(u,b,k)!==-1},o.prototype.indexOf=function(u,b,k){return fe(this,u,b,k,!0)},o.prototype.lastIndexOf=function(u,b,k){return fe(this,u,b,k,!1)};function O(q,u,b,k){b=Number(b)||0;var N=q.length-b;k?(k=Number(k),k>N&&(k=N)):k=N;var $=u.length;k>$/2&&(k=$/2);for(var ee=0;ee<k;++ee){var Ee=parseInt(u.substr(ee*2,2),16);if(ft(Ee))return ee;q[b+ee]=Ee}return ee}function te(q,u,b,k){return Ye(ae(u,q.length-b),q,b,k)}function L(q,u,b,k){return Ye(tt(u),q,b,k)}function re(q,u,b,k){return L(q,u,b,k)}function h(q,u,b,k){return Ye(Xf(u),q,b,k)}function d(q,u,b,k){return Ye(Qf(u,q.length-b),q,b,k)}o.prototype.write=function(u,b,k,N){if(b===void 0)N="utf8",k=this.length,b=0;else if(k===void 0&&typeof b=="string")N=b,k=this.length,b=0;else if(isFinite(b))b=b>>>0,isFinite(k)?(k=k>>>0,N===void 0&&(N="utf8")):(N=k,k=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var $=this.length-b;if((k===void 0||k>$)&&(k=$),u.length>0&&(k<0||b<0)||b>this.length)throw new RangeError("Attempt to write outside buffer bounds");N||(N="utf8");for(var ee=!1;;)switch(N){case"hex":return O(this,u,b,k);case"utf8":case"utf-8":return te(this,u,b,k);case"ascii":return L(this,u,b,k);case"latin1":case"binary":return re(this,u,b,k);case"base64":return h(this,u,b,k);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return d(this,u,b,k);default:if(ee)throw new TypeError("Unknown encoding: "+N);N=(""+N).toLowerCase(),ee=!0}},o.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function A(q,u,b){return u===0&&b===q.length?Ls.fromByteArray(q):Ls.fromByteArray(q.slice(u,b))}function c(q,u,b){b=Math.min(q.length,b);for(var k=[],N=u;N<b;){var $=q[N],ee=null,Ee=$>239?4:$>223?3:$>191?2:1;if(N+Ee<=b){var _e,Le,ht,we;switch(Ee){case 1:$<128&&(ee=$);break;case 2:_e=q[N+1],(_e&192)==128&&(we=($&31)<<6|_e&63,we>127&&(ee=we));break;case 3:_e=q[N+1],Le=q[N+2],(_e&192)==128&&(Le&192)==128&&(we=($&15)<<12|(_e&63)<<6|Le&63,we>2047&&(we<55296||we>57343)&&(ee=we));break;case 4:_e=q[N+1],Le=q[N+2],ht=q[N+3],(_e&192)==128&&(Le&192)==128&&(ht&192)==128&&(we=($&15)<<18|(_e&63)<<12|(Le&63)<<6|ht&63,we>65535&&we<1114112&&(ee=we))}}ee===null?(ee=65533,Ee=1):ee>65535&&(ee-=65536,k.push(ee>>>10&1023|55296),ee=56320|ee&1023),k.push(ee),N+=Ee}return U(k)}var P=4096;function U(q){var u=q.length;if(u<=P)return String.fromCharCode.apply(String,q);for(var b="",k=0;k<u;)b+=String.fromCharCode.apply(String,q.slice(k,k+=P));return b}function F(q,u,b){var k="";b=Math.min(q.length,b);for(var N=u;N<b;++N)k+=String.fromCharCode(q[N]&127);return k}function Z(q,u,b){var k="";b=Math.min(q.length,b);for(var N=u;N<b;++N)k+=String.fromCharCode(q[N]);return k}function I(q,u,b){var k=q.length;(!u||u<0)&&(u=0),(!b||b<0||b>k)&&(b=k);for(var N="",$=u;$<b;++$)N+=Pe[q[$]];return N}function ke(q,u,b){for(var k=q.slice(u,b),N="",$=0;$<k.length;$+=2)N+=String.fromCharCode(k[$]+k[$+1]*256);return N}o.prototype.slice=function(u,b){var k=this.length;u=~~u,b=b===void 0?k:~~b,u<0?(u+=k,u<0&&(u=0)):u>k&&(u=k),b<0?(b+=k,b<0&&(b=0)):b>k&&(b=k),b<u&&(b=u);var N=this.subarray(u,b);return Object.setPrototypeOf(N,o.prototype),N};function ne(q,u,b){if(q%1!=0||q<0)throw new RangeError("offset is not uint");if(q+u>b)throw new RangeError("Trying to access beyond buffer length")}o.prototype.readUIntLE=function(u,b,k){u=u>>>0,b=b>>>0,k||ne(u,b,this.length);for(var N=this[u],$=1,ee=0;++ee<b&&($*=256);)N+=this[u+ee]*$;return N},o.prototype.readUIntBE=function(u,b,k){u=u>>>0,b=b>>>0,k||ne(u,b,this.length);for(var N=this[u+--b],$=1;b>0&&($*=256);)N+=this[u+--b]*$;return N},o.prototype.readUInt8=function(u,b){return u=u>>>0,b||ne(u,1,this.length),this[u]},o.prototype.readUInt16LE=function(u,b){return u=u>>>0,b||ne(u,2,this.length),this[u]|this[u+1]<<8},o.prototype.readUInt16BE=function(u,b){return u=u>>>0,b||ne(u,2,this.length),this[u]<<8|this[u+1]},o.prototype.readUInt32LE=function(u,b){return u=u>>>0,b||ne(u,4,this.length),(this[u]|this[u+1]<<8|this[u+2]<<16)+this[u+3]*16777216},o.prototype.readUInt32BE=function(u,b){return u=u>>>0,b||ne(u,4,this.length),this[u]*16777216+(this[u+1]<<16|this[u+2]<<8|this[u+3])},o.prototype.readIntLE=function(u,b,k){u=u>>>0,b=b>>>0,k||ne(u,b,this.length);for(var N=this[u],$=1,ee=0;++ee<b&&($*=256);)N+=this[u+ee]*$;return $*=128,N>=$&&(N-=Math.pow(2,8*b)),N},o.prototype.readIntBE=function(u,b,k){u=u>>>0,b=b>>>0,k||ne(u,b,this.length);for(var N=b,$=1,ee=this[u+--N];N>0&&($*=256);)ee+=this[u+--N]*$;return $*=128,ee>=$&&(ee-=Math.pow(2,8*b)),ee},o.prototype.readInt8=function(u,b){return u=u>>>0,b||ne(u,1,this.length),this[u]&128?(255-this[u]+1)*-1:this[u]},o.prototype.readInt16LE=function(u,b){u=u>>>0,b||ne(u,2,this.length);var k=this[u]|this[u+1]<<8;return k&32768?k|4294901760:k},o.prototype.readInt16BE=function(u,b){u=u>>>0,b||ne(u,2,this.length);var k=this[u+1]|this[u]<<8;return k&32768?k|4294901760:k},o.prototype.readInt32LE=function(u,b){return u=u>>>0,b||ne(u,4,this.length),this[u]|this[u+1]<<8|this[u+2]<<16|this[u+3]<<24},o.prototype.readInt32BE=function(u,b){return u=u>>>0,b||ne(u,4,this.length),this[u]<<24|this[u+1]<<16|this[u+2]<<8|this[u+3]},o.prototype.readFloatLE=function(u,b){return u=u>>>0,b||ne(u,4,this.length),bn.read(this,u,!0,23,4)},o.prototype.readFloatBE=function(u,b){return u=u>>>0,b||ne(u,4,this.length),bn.read(this,u,!1,23,4)},o.prototype.readDoubleLE=function(u,b){return u=u>>>0,b||ne(u,8,this.length),bn.read(this,u,!0,52,8)},o.prototype.readDoubleBE=function(u,b){return u=u>>>0,b||ne(u,8,this.length),bn.read(this,u,!1,52,8)};function C(q,u,b,k,N,$){if(!o.isBuffer(q))throw new TypeError('"buffer" argument must be a Buffer instance');if(u>N||u<$)throw new RangeError('"value" argument is out of bounds');if(b+k>q.length)throw new RangeError("Index out of range")}o.prototype.writeUIntLE=function(u,b,k,N){if(u=+u,b=b>>>0,k=k>>>0,!N){var $=Math.pow(2,8*k)-1;C(this,u,b,k,$,0)}var ee=1,Ee=0;for(this[b]=u&255;++Ee<k&&(ee*=256);)this[b+Ee]=u/ee&255;return b+k},o.prototype.writeUIntBE=function(u,b,k,N){if(u=+u,b=b>>>0,k=k>>>0,!N){var $=Math.pow(2,8*k)-1;C(this,u,b,k,$,0)}var ee=k-1,Ee=1;for(this[b+ee]=u&255;--ee>=0&&(Ee*=256);)this[b+ee]=u/Ee&255;return b+k},o.prototype.writeUInt8=function(u,b,k){return u=+u,b=b>>>0,k||C(this,u,b,1,255,0),this[b]=u&255,b+1},o.prototype.writeUInt16LE=function(u,b,k){return u=+u,b=b>>>0,k||C(this,u,b,2,65535,0),this[b]=u&255,this[b+1]=u>>>8,b+2},o.prototype.writeUInt16BE=function(u,b,k){return u=+u,b=b>>>0,k||C(this,u,b,2,65535,0),this[b]=u>>>8,this[b+1]=u&255,b+2},o.prototype.writeUInt32LE=function(u,b,k){return u=+u,b=b>>>0,k||C(this,u,b,4,4294967295,0),this[b+3]=u>>>24,this[b+2]=u>>>16,this[b+1]=u>>>8,this[b]=u&255,b+4},o.prototype.writeUInt32BE=function(u,b,k){return u=+u,b=b>>>0,k||C(this,u,b,4,4294967295,0),this[b]=u>>>24,this[b+1]=u>>>16,this[b+2]=u>>>8,this[b+3]=u&255,b+4},o.prototype.writeIntLE=function(u,b,k,N){if(u=+u,b=b>>>0,!N){var $=Math.pow(2,8*k-1);C(this,u,b,k,$-1,-$)}var ee=0,Ee=1,_e=0;for(this[b]=u&255;++ee<k&&(Ee*=256);)u<0&&_e===0&&this[b+ee-1]!==0&&(_e=1),this[b+ee]=(u/Ee>>0)-_e&255;return b+k},o.prototype.writeIntBE=function(u,b,k,N){if(u=+u,b=b>>>0,!N){var $=Math.pow(2,8*k-1);C(this,u,b,k,$-1,-$)}var ee=k-1,Ee=1,_e=0;for(this[b+ee]=u&255;--ee>=0&&(Ee*=256);)u<0&&_e===0&&this[b+ee+1]!==0&&(_e=1),this[b+ee]=(u/Ee>>0)-_e&255;return b+k},o.prototype.writeInt8=function(u,b,k){return u=+u,b=b>>>0,k||C(this,u,b,1,127,-128),u<0&&(u=255+u+1),this[b]=u&255,b+1},o.prototype.writeInt16LE=function(u,b,k){return u=+u,b=b>>>0,k||C(this,u,b,2,32767,-32768),this[b]=u&255,this[b+1]=u>>>8,b+2},o.prototype.writeInt16BE=function(u,b,k){return u=+u,b=b>>>0,k||C(this,u,b,2,32767,-32768),this[b]=u>>>8,this[b+1]=u&255,b+2},o.prototype.writeInt32LE=function(u,b,k){return u=+u,b=b>>>0,k||C(this,u,b,4,2147483647,-2147483648),this[b]=u&255,this[b+1]=u>>>8,this[b+2]=u>>>16,this[b+3]=u>>>24,b+4},o.prototype.writeInt32BE=function(u,b,k){return u=+u,b=b>>>0,k||C(this,u,b,4,2147483647,-2147483648),u<0&&(u=4294967295+u+1),this[b]=u>>>24,this[b+1]=u>>>16,this[b+2]=u>>>8,this[b+3]=u&255,b+4};function W(q,u,b,k,N,$){if(b+k>q.length)throw new RangeError("Index out of range");if(b<0)throw new RangeError("Index out of range")}function ve(q,u,b,k,N){return u=+u,b=b>>>0,N||W(q,u,b,4),bn.write(q,u,b,k,23,4),b+4}o.prototype.writeFloatLE=function(u,b,k){return ve(this,u,b,!0,k)},o.prototype.writeFloatBE=function(u,b,k){return ve(this,u,b,!1,k)};function oe(q,u,b,k,N){return u=+u,b=b>>>0,N||W(q,u,b,8),bn.write(q,u,b,k,52,8),b+8}o.prototype.writeDoubleLE=function(u,b,k){return oe(this,u,b,!0,k)},o.prototype.writeDoubleBE=function(u,b,k){return oe(this,u,b,!1,k)},o.prototype.copy=function(u,b,k,N){if(!o.isBuffer(u))throw new TypeError("argument should be a Buffer");if(k||(k=0),!N&&N!==0&&(N=this.length),b>=u.length&&(b=u.length),b||(b=0),N>0&&N<k&&(N=k),N===k||u.length===0||this.length===0)return 0;if(b<0)throw new RangeError("targetStart out of bounds");if(k<0||k>=this.length)throw new RangeError("Index out of range");if(N<0)throw new RangeError("sourceEnd out of bounds");N>this.length&&(N=this.length),u.length-b<N-k&&(N=u.length-b+k);var $=N-k;if(this===u&&typeof Uint8Array.prototype.copyWithin=="function")this.copyWithin(b,k,N);else if(this===u&&k<b&&b<N)for(var ee=$-1;ee>=0;--ee)u[ee+b]=this[ee+k];else Uint8Array.prototype.set.call(u,this.subarray(k,N),b);return $},o.prototype.fill=function(u,b,k,N){if(typeof u=="string"){if(typeof b=="string"?(N=b,b=0,k=this.length):typeof k=="string"&&(N=k,k=this.length),N!==void 0&&typeof N!="string")throw new TypeError("encoding must be a string");if(typeof N=="string"&&!o.isEncoding(N))throw new TypeError("Unknown encoding: "+N);if(u.length===1){var $=u.charCodeAt(0);(N==="utf8"&&$<128||N==="latin1")&&(u=$)}}else typeof u=="number"?u=u&255:typeof u=="boolean"&&(u=Number(u));if(b<0||this.length<b||this.length<k)throw new RangeError("Out of range index");if(k<=b)return this;b=b>>>0,k=k===void 0?this.length:k>>>0,u||(u=0);var ee;if(typeof u=="number")for(ee=b;ee<k;++ee)this[ee]=u;else{var Ee=o.isBuffer(u)?u:o.from(u,N),_e=Ee.length;if(_e===0)throw new TypeError('The value "'+u+'" is invalid for argument "value"');for(ee=0;ee<k-b;++ee)this[ee+b]=Ee[ee%_e]}return this};var xe=/[^+/0-9A-Za-z-_]/g;function kt(q){if(q=q.split("=")[0],q=q.trim().replace(xe,""),q.length<2)return"";for(;q.length%4!=0;)q=q+"=";return q}function ae(q,u){u=u||1/0;for(var b,k=q.length,N=null,$=[],ee=0;ee<k;++ee){if(b=q.charCodeAt(ee),b>55295&&b<57344){if(!N){if(b>56319){(u-=3)>-1&&$.push(239,191,189);continue}else if(ee+1===k){(u-=3)>-1&&$.push(239,191,189);continue}N=b;continue}if(b<56320){(u-=3)>-1&&$.push(239,191,189),N=b;continue}b=(N-55296<<10|b-56320)+65536}else N&&(u-=3)>-1&&$.push(239,191,189);if(N=null,b<128){if((u-=1)<0)break;$.push(b)}else if(b<2048){if((u-=2)<0)break;$.push(b>>6|192,b&63|128)}else if(b<65536){if((u-=3)<0)break;$.push(b>>12|224,b>>6&63|128,b&63|128)}else if(b<1114112){if((u-=4)<0)break;$.push(b>>18|240,b>>12&63|128,b>>6&63|128,b&63|128)}else throw new Error("Invalid code point")}return $}function tt(q){for(var u=[],b=0;b<q.length;++b)u.push(q.charCodeAt(b)&255);return u}function Qf(q,u){for(var b,k,N,$=[],ee=0;ee<q.length&&!((u-=2)<0);++ee)b=q.charCodeAt(ee),k=b>>8,N=b%256,$.push(N),$.push(k);return $}function Xf(q){return Ls.toByteArray(kt(q))}function Ye(q,u,b,k){for(var N=0;N<k&&!(N+b>=u.length||N>=q.length);++N)u[N+b]=q[N];return N}function Te(q,u){return q instanceof u||q!=null&&q.constructor!=null&&q.constructor.name!=null&&q.constructor.name===u.name}function ft(q){return q!==q}var Pe=function(){for(var q="0123456789abcdef",u=new Array(256),b=0;b<16;++b)for(var k=b*16,N=0;N<16;++N)u[k+N]=q[b]+q[N];return u}()}),j_=se.Buffer,q_=se.SlowBuffer,y_=se.INSPECT_MAX_BYTES,v_=se.kMaxLength,pr=Ze(function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.ensureBuffer=void 0;function f(r){if(se.Buffer.isBuffer(r))return r;if(ArrayBuffer.isView(r))return se.Buffer.from(r.buffer);if(r instanceof ArrayBuffer)return se.Buffer.from(r);throw new TypeError("Must use either Buffer or TypedArray")}e.ensureBuffer=f});nt(pr);k_=pr.ensureBuffer,Us=Ze(function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.parseUUID=void 0;let f=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function r(n){if(typeof n!="string")throw new TypeError("Invalid type for UUID, expected string but got "+typeof n);if(!f.test(n))throw new TypeError("Invalid format for UUID: "+n);let i,o=new Uint8Array(16);return o[0]=(i=parseInt(n.slice(0,8),16))>>>24,o[1]=i>>>16&255,o[2]=i>>>8&255,o[3]=i&255,o[4]=(i=parseInt(n.slice(9,13),16))>>>8,o[5]=i&255,o[6]=(i=parseInt(n.slice(14,18),16))>>>8,o[7]=i&255,o[8]=(i=parseInt(n.slice(19,23),16))>>>8,o[9]=i&255,o[10]=(i=parseInt(n.slice(24,36),16))/1099511627776&255,o[11]=i/4294967296&255,o[12]=i>>>24&255,o[13]=i>>>16&255,o[14]=i>>>8&255,o[15]=i&255,o}e.parseUUID=r});nt(Us);T_=Us.parseUUID,Gt=Ze(function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.Binary=void 0;class f{constructor(n,i){if(n!=null&&typeof n!="string"&&!ArrayBuffer.isView(n)&&!(n instanceof ArrayBuffer)&&!Array.isArray(n))throw new TypeError("Binary can only be constructed from string, Buffer, TypedArray, or Array<number>");this.sub_type=i??f.BSON_BINARY_SUBTYPE_DEFAULT,n==null?(this.buffer=se.Buffer.alloc(f.BUFFER_SIZE),this.position=0):(typeof n=="string"?this.buffer=se.Buffer.from(n,"binary"):Array.isArray(n)?this.buffer=se.Buffer.from(n):this.buffer=pr.ensureBuffer(n),this.position=this.buffer.byteLength)}put(n){if(typeof n=="string"&&n.length!==1)throw new TypeError("only accepts single character String");if(typeof n!="number"&&n.length!==1)throw new TypeError("only accepts single character Uint8Array or Array");let i;if(typeof n=="string"?i=n.charCodeAt(0):typeof n=="number"?i=n:i=n[0],i<0||i>255)throw new TypeError("only accepts number in a valid unsigned byte range 0-255");if(this.buffer.length>this.position)this.buffer[this.position++]=i;else{let o=se.Buffer.alloc(f.BUFFER_SIZE+this.buffer.length);this.buffer.copy(o,0,0,this.buffer.length),this.buffer=o,this.buffer[this.position++]=i}}write(n,i){if(i=typeof i=="number"?i:this.position,this.buffer.length<i+n.length){let o=se.Buffer.alloc(this.buffer.length+n.length);this.buffer.copy(o,0,0,this.buffer.length),this.buffer=o}ArrayBuffer.isView(n)?(this.buffer.set(pr.ensureBuffer(n),i),this.position=i+n.byteLength>this.position?i+n.length:this.position):typeof n=="string"&&(this.buffer.write(n,i,n.length,"binary"),this.position=i+n.length>this.position?i+n.length:this.position)}read(n,i){return i=i&&i>0?i:this.position,this.buffer.slice(n,n+i)}value(n){return n=!!n,n&&this.buffer.length===this.position?this.buffer:n?this.buffer.slice(0,this.position):this.buffer.toString("binary",0,this.position)}length(){return this.position}toJSON(){return this.buffer.toString("base64")}toString(n){return this.buffer.toString(n)}toExtendedJSON(n){n=n||{};let i=this.buffer.toString("base64"),o=Number(this.sub_type).toString(16);return n.legacy?{$binary:i,$type:o.length===1?"0"+o:o}:{$binary:{base64:i,subType:o.length===1?"0"+o:o}}}static fromExtendedJSON(n,i){i=i||{};let o,s;if("$binary"in n?i.legacy&&typeof n.$binary=="string"&&"$type"in n?(s=n.$type?parseInt(n.$type,16):0,o=se.Buffer.from(n.$binary,"base64")):typeof n.$binary!="string"&&(s=n.$binary.subType?parseInt(n.$binary.subType,16):0,o=se.Buffer.from(n.$binary.base64,"base64")):"$uuid"in n&&(s=4,o=se.Buffer.from(Us.parseUUID(n.$uuid))),!o)throw new TypeError(`Unexpected Binary Extended JSON format ${JSON.stringify(n)}`);return new f(o,s)}}e.Binary=f,f.BSON_BINARY_SUBTYPE_DEFAULT=0,f.BUFFER_SIZE=256,f.SUBTYPE_DEFAULT=0,f.SUBTYPE_FUNCTION=1,f.SUBTYPE_BYTE_ARRAY=2,f.SUBTYPE_UUID_OLD=3,f.SUBTYPE_UUID=4,f.SUBTYPE_MD5=5,f.SUBTYPE_USER_DEFINED=128,Object.defineProperty(f.prototype,"_bsontype",{value:"Binary"})});nt(Gt);__=Gt.Binary,wr=Ze(function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.Code=void 0;class f{constructor(n,i){this.code=n,this.scope=i}toJSON(){return{code:this.code,scope:this.scope}}toExtendedJSON(){return this.scope?{$code:this.code,$scope:this.scope}:{$code:this.code}}static fromExtendedJSON(n){return new f(n.$code,n.$scope)}}e.Code=f,Object.defineProperty(f.prototype,"_bsontype",{value:"Code"})});nt(wr);B_=wr.Code,kq={};typeof Object.create=="function"?Ms=function(e,f){e.super_=f,e.prototype=Object.create(f.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}:Ms=function(e,f){e.super_=f;var r=function(){};r.prototype=f.prototype,e.prototype=new r,e.prototype.constructor=e};Tq=Ms,_q=/%[sdj%]/g;Lo={};Df.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]};Df.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"};zq=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];Cq={inherits:Tq,_extend:gb,log:Dq,isBuffer:Pq,isPrimitive:Rq,isFunction:Vo,isError:Yo,isDate:Js,isObject:cn,isRegExp:Wo,isUndefined:Cf,isSymbol:Nq,isString:Ko,isNumber:hb,isNullOrUndefined:Hq,isNull:Mo,isBoolean:Gs,isArray:db,inspect:Df,deprecate:cb,format:Ks,debuglog:Bq},Ce=Ze(function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.deprecate=e.isObjectLike=e.isDate=e.isBuffer=e.haveBuffer=e.isBigUInt64Array=e.isBigInt64Array=e.isUint8Array=e.randomBytes=e.normalizedFunctionString=void 0;function f(m){return m.toString().replace("function(","function (")}e.normalizedFunctionString=f;function r(m){let j=se.Buffer.alloc(m);for(let B=0;B<m;++B)j[B]=Math.floor(Math.random()*256);return j}if(e.randomBytes=r,typeof window!="undefined"&&window.crypto&&window.crypto.getRandomValues)e.randomBytes=m=>window.crypto.getRandomValues(se.Buffer.alloc(m));else{try{e.randomBytes=kq.randomBytes}catch{}e.randomBytes==null&&(e.randomBytes=r)}function n(m){return Object.prototype.toString.call(m)==="[object Uint8Array]"}e.isUint8Array=n;function i(m){return Object.prototype.toString.call(m)==="[object BigInt64Array]"}e.isBigInt64Array=i;function o(m){return Object.prototype.toString.call(m)==="[object BigUint64Array]"}e.isBigUInt64Array=o;function s(){return typeof Co!="undefined"&&typeof Co.Buffer!="undefined"}e.haveBuffer=s;function a(m){return s()&&se.Buffer.isBuffer(m)}e.isBuffer=a;function p(m){return w(m)&&Object.prototype.toString.call(m)==="[object Date]"}e.isDate=p;function w(m){return typeof m=="object"&&m!==null}e.isObjectLike=w;function g(m,j){if(typeof window=="undefined"||typeof self=="undefined")return Cq.deprecate(m,j);let B=!1;function v(...R){return B||(console.warn(j),B=!0),m.apply(this,...R)}return v}e.deprecate=g});nt(Ce);x_=Ce.deprecate,E_=Ce.isObjectLike,I_=Ce.isDate,S_=Ce.isBuffer,A_=Ce.haveBuffer,O_=Ce.isBigUInt64Array,H_=Ce.isBigInt64Array,N_=Ce.isUint8Array,R_=Ce.randomBytes,P_=Ce.normalizedFunctionString,mf=Ze(function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.DBRef=e.isDBRefLike=void 0;function f(n){return Ce.isObjectLike(n)&&n.$id!=null&&n.$ref!=null}e.isDBRefLike=f;class r{constructor(i,o,s,a){let p=i.split(".");p.length===2&&(s=p.shift(),i=p.shift()),this.collection=i,this.oid=o,this.db=s,this.fields=a||{}}get namespace(){return this.collection}set namespace(i){this.collection=i}toJSON(){let i=Object.assign({$ref:this.collection,$id:this.oid},this.fields);return this.db!=null&&(i.$db=this.db),i}toExtendedJSON(i){i=i||{};let o={$ref:this.collection,$id:this.oid};return i.legacy||(this.db&&(o.$db=this.db),o=Object.assign(o,this.fields)),o}static fromExtendedJSON(i){let o=Object.assign({},i);return delete o.$ref,delete o.$id,delete o.$db,new r(i.$ref,i.$id,i.$db,o)}}e.DBRef=r,Object.defineProperty(r.prototype,"_bsontype",{value:"DBRef"})});nt(mf);z_=mf.DBRef,F_=mf.isDBRefLike,me=Ze(function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.Long=void 0;let f;try{f=new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array([0,97,115,109,1,0,0,0,1,13,2,96,0,1,127,96,4,127,127,127,127,1,127,3,7,6,0,1,1,1,1,1,6,6,1,127,1,65,0,11,7,50,6,3,109,117,108,0,1,5,100,105,118,95,115,0,2,5,100,105,118,95,117,0,3,5,114,101,109,95,115,0,4,5,114,101,109,95,117,0,5,8,103,101,116,95,104,105,103,104,0,0,10,191,1,6,4,0,35,0,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,126,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,127,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,128,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,129,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,130,34,4,66,32,135,167,36,0,32,4,167,11])),{}).exports}catch{}let r=1<<16,n=1<<24,i=r*r,o=i*i,s=o/2,a={},p={};class w{constructor(m=0,j=0,B){this.comp=w.prototype.compare,this.div=w.prototype.divide,this.eq=w.prototype.equals,this.gt=w.prototype.greaterThan,this.gte=w.prototype.greaterThanOrEqual,this.ge=w.prototype.greaterThanOrEqual,this.lt=w.prototype.lessThan,this.lte=w.prototype.lessThanOrEqual,this.mod=w.prototype.modulo,this.rem=w.prototype.modulo,this.mul=w.prototype.multiply,this.neg=w.prototype.negate,this.neq=w.prototype.notEquals,this.ne=w.prototype.notEquals,this.shl=w.prototype.shiftLeft,this.shr=w.prototype.shiftRight,this.shr_u=w.prototype.shiftRightUnsigned,this.shru=w.prototype.shiftRightUnsigned,this.sub=w.prototype.subtract,this.eqz=w.prototype.isZero,this.le=w.prototype.lessThanOrEqual,this.low=m|0,this.high=j|0,this.unsigned=!!B,Object.defineProperty(this,"__isLong__",{value:!0,configurable:!1,writable:!1,enumerable:!1})}static fromBits(m,j,B){return new w(m,j,B)}static fromInt(m,j){let B,v,R;return j?(m>>>=0,(R=0<=m&&m<256)&&(v=p[m],v)?v:(B=w.fromBits(m,(m|0)<0?-1:0,!0),R&&(p[m]=B),B)):(m|=0,(R=-128<=m&&m<128)&&(v=a[m],v)?v:(B=w.fromBits(m,m<0?-1:0,!1),R&&(a[m]=B),B))}static fromNumber(m,j){if(isNaN(m))return j?w.UZERO:w.ZERO;if(j){if(m<0)return w.UZERO;if(m>=o)return w.MAX_UNSIGNED_VALUE}else{if(m<=-s)return w.MIN_VALUE;if(m+1>=s)return w.MAX_VALUE}return m<0?w.fromNumber(-m,j).neg():w.fromBits(m%i|0,m/i|0,j)}static fromBigInt(m,j){return w.fromString(m.toString(),j)}static fromString(m,j,B){if(m.length===0)throw Error("empty string");if(m==="NaN"||m==="Infinity"||m==="+Infinity"||m==="-Infinity")return w.ZERO;if(typeof j=="number"?(B=j,j=!1):j=!!j,B=B||10,B<2||36<B)throw RangeError("radix");let v;if((v=m.indexOf("-"))>0)throw Error("interior hyphen");if(v===0)return w.fromString(m.substring(1),j,B).neg();let R=w.fromNumber(Math.pow(B,8)),D=w.ZERO;for(let z=0;z<m.length;z+=8){let G=Math.min(8,m.length-z),fe=parseInt(m.substring(z,z+G),B);if(G<8){let K=w.fromNumber(Math.pow(B,G));D=D.mul(K).add(w.fromNumber(fe))}else D=D.mul(R),D=D.add(w.fromNumber(fe))}return D.unsigned=j,D}static fromBytes(m,j,B){return B?w.fromBytesLE(m,j):w.fromBytesBE(m,j)}static fromBytesLE(m,j){return new w(m[0]|m[1]<<8|m[2]<<16|m[3]<<24,m[4]|m[5]<<8|m[6]<<16|m[7]<<24,j)}static fromBytesBE(m,j){return new w(m[4]<<24|m[5]<<16|m[6]<<8|m[7],m[0]<<24|m[1]<<16|m[2]<<8|m[3],j)}static isLong(m){return Ce.isObjectLike(m)&&m.__isLong__===!0}static fromValue(m,j){return typeof m=="number"?w.fromNumber(m,j):typeof m=="string"?w.fromString(m,j):w.fromBits(m.low,m.high,typeof j=="boolean"?j:m.unsigned)}add(m){w.isLong(m)||(m=w.fromValue(m));let j=this.high>>>16,B=this.high&65535,v=this.low>>>16,R=this.low&65535,D=m.high>>>16,z=m.high&65535,G=m.low>>>16,fe=m.low&65535,K=0,O=0,te=0,L=0;return L+=R+fe,te+=L>>>16,L&=65535,te+=v+G,O+=te>>>16,te&=65535,O+=B+z,K+=O>>>16,O&=65535,K+=j+D,K&=65535,w.fromBits(te<<16|L,K<<16|O,this.unsigned)}and(m){return w.isLong(m)||(m=w.fromValue(m)),w.fromBits(this.low&m.low,this.high&m.high,this.unsigned)}compare(m){if(w.isLong(m)||(m=w.fromValue(m)),this.eq(m))return 0;let j=this.isNegative(),B=m.isNegative();return j&&!B?-1:!j&&B?1:this.unsigned?m.high>>>0>this.high>>>0||m.high===this.high&&m.low>>>0>this.low>>>0?-1:1:this.sub(m).isNegative()?-1:1}divide(m){if(w.isLong(m)||(m=w.fromValue(m)),m.isZero())throw Error("division by zero");if(f){if(!this.unsigned&&this.high===-2147483648&&m.low===-1&&m.high===-1)return this;let R=(this.unsigned?f.div_u:f.div_s)(this.low,this.high,m.low,m.high);return w.fromBits(R,f.get_high(),this.unsigned)}if(this.isZero())return this.unsigned?w.UZERO:w.ZERO;let j,B,v;if(this.unsigned){if(m.unsigned||(m=m.toUnsigned()),m.gt(this))return w.UZERO;if(m.gt(this.shru(1)))return w.UONE;v=w.UZERO}else{if(this.eq(w.MIN_VALUE))return m.eq(w.ONE)||m.eq(w.NEG_ONE)?w.MIN_VALUE:m.eq(w.MIN_VALUE)?w.ONE:(j=this.shr(1).div(m).shl(1),j.eq(w.ZERO)?m.isNegative()?w.ONE:w.NEG_ONE:(B=this.sub(m.mul(j)),v=j.add(B.div(m)),v));if(m.eq(w.MIN_VALUE))return this.unsigned?w.UZERO:w.ZERO;if(this.isNegative())return m.isNegative()?this.neg().div(m.neg()):this.neg().div(m).neg();if(m.isNegative())return this.div(m.neg()).neg();v=w.ZERO}for(B=this;B.gte(m);){j=Math.max(1,Math.floor(B.toNumber()/m.toNumber()));let R=Math.ceil(Math.log(j)/Math.LN2),D=R<=48?1:Math.pow(2,R-48),z=w.fromNumber(j),G=z.mul(m);for(;G.isNegative()||G.gt(B);)j-=D,z=w.fromNumber(j,this.unsigned),G=z.mul(m);z.isZero()&&(z=w.ONE),v=v.add(z),B=B.sub(G)}return v}equals(m){return w.isLong(m)||(m=w.fromValue(m)),this.unsigned!==m.unsigned&&this.high>>>31==1&&m.high>>>31==1?!1:this.high===m.high&&this.low===m.low}getHighBits(){return this.high}getHighBitsUnsigned(){return this.high>>>0}getLowBits(){return this.low}getLowBitsUnsigned(){return this.low>>>0}getNumBitsAbs(){if(this.isNegative())return this.eq(w.MIN_VALUE)?64:this.neg().getNumBitsAbs();let m=this.high!==0?this.high:this.low,j;for(j=31;j>0&&(m&1<<j)==0;j--);return this.high!==0?j+33:j+1}greaterThan(m){return this.comp(m)>0}greaterThanOrEqual(m){return this.comp(m)>=0}isEven(){return(this.low&1)==0}isNegative(){return!this.unsigned&&this.high<0}isOdd(){return(this.low&1)==1}isPositive(){return this.unsigned||this.high>=0}isZero(){return this.high===0&&this.low===0}lessThan(m){return this.comp(m)<0}lessThanOrEqual(m){return this.comp(m)<=0}modulo(m){if(w.isLong(m)||(m=w.fromValue(m)),f){let j=(this.unsigned?f.rem_u:f.rem_s)(this.low,this.high,m.low,m.high);return w.fromBits(j,f.get_high(),this.unsigned)}return this.sub(this.div(m).mul(m))}multiply(m){if(this.isZero())return w.ZERO;if(w.isLong(m)||(m=w.fromValue(m)),f){let re=f.mul(this.low,this.high,m.low,m.high);return w.fromBits(re,f.get_high(),this.unsigned)}if(m.isZero())return w.ZERO;if(this.eq(w.MIN_VALUE))return m.isOdd()?w.MIN_VALUE:w.ZERO;if(m.eq(w.MIN_VALUE))return this.isOdd()?w.MIN_VALUE:w.ZERO;if(this.isNegative())return m.isNegative()?this.neg().mul(m.neg()):this.neg().mul(m).neg();if(m.isNegative())return this.mul(m.neg()).neg();if(this.lt(w.TWO_PWR_24)&&m.lt(w.TWO_PWR_24))return w.fromNumber(this.toNumber()*m.toNumber(),this.unsigned);let j=this.high>>>16,B=this.high&65535,v=this.low>>>16,R=this.low&65535,D=m.high>>>16,z=m.high&65535,G=m.low>>>16,fe=m.low&65535,K=0,O=0,te=0,L=0;return L+=R*fe,te+=L>>>16,L&=65535,te+=v*fe,O+=te>>>16,te&=65535,te+=R*G,O+=te>>>16,te&=65535,O+=B*fe,K+=O>>>16,O&=65535,O+=v*G,K+=O>>>16,O&=65535,O+=R*z,K+=O>>>16,O&=65535,K+=j*fe+B*G+v*z+R*D,K&=65535,w.fromBits(te<<16|L,K<<16|O,this.unsigned)}negate(){return!this.unsigned&&this.eq(w.MIN_VALUE)?w.MIN_VALUE:this.not().add(w.ONE)}not(){return w.fromBits(~this.low,~this.high,this.unsigned)}notEquals(m){return!this.equals(m)}or(m){return w.isLong(m)||(m=w.fromValue(m)),w.fromBits(this.low|m.low,this.high|m.high,this.unsigned)}shiftLeft(m){return w.isLong(m)&&(m=m.toInt()),(m&=63)==0?this:m<32?w.fromBits(this.low<<m,this.high<<m|this.low>>>32-m,this.unsigned):w.fromBits(0,this.low<<m-32,this.unsigned)}shiftRight(m){return w.isLong(m)&&(m=m.toInt()),(m&=63)==0?this:m<32?w.fromBits(this.low>>>m|this.high<<32-m,this.high>>m,this.unsigned):w.fromBits(this.high>>m-32,this.high>=0?0:-1,this.unsigned)}shiftRightUnsigned(m){if(w.isLong(m)&&(m=m.toInt()),m&=63,m===0)return this;{let j=this.high;if(m<32){let B=this.low;return w.fromBits(B>>>m|j<<32-m,j>>>m,this.unsigned)}else return m===32?w.fromBits(j,0,this.unsigned):w.fromBits(j>>>m-32,0,this.unsigned)}}subtract(m){return w.isLong(m)||(m=w.fromValue(m)),this.add(m.neg())}toInt(){return this.unsigned?this.low>>>0:this.low}toNumber(){return this.unsigned?(this.high>>>0)*i+(this.low>>>0):this.high*i+(this.low>>>0)}toBigInt(){return BigInt(this.toString())}toBytes(m){return m?this.toBytesLE():this.toBytesBE()}toBytesLE(){let m=this.high,j=this.low;return[j&255,j>>>8&255,j>>>16&255,j>>>24,m&255,m>>>8&255,m>>>16&255,m>>>24]}toBytesBE(){let m=this.high,j=this.low;return[m>>>24,m>>>16&255,m>>>8&255,m&255,j>>>24,j>>>16&255,j>>>8&255,j&255]}toSigned(){return this.unsigned?w.fromBits(this.low,this.high,!1):this}toString(m){if(m=m||10,m<2||36<m)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative())if(this.eq(w.MIN_VALUE)){let R=w.fromNumber(m),D=this.div(R),z=D.mul(R).sub(this);return D.toString(m)+z.toInt().toString(m)}else return"-"+this.neg().toString(m);let j=w.fromNumber(Math.pow(m,6),this.unsigned),B=this,v="";for(;;){let R=B.div(j),z=(B.sub(R.mul(j)).toInt()>>>0).toString(m);if(B=R,B.isZero())return z+v;for(;z.length<6;)z="0"+z;v=""+z+v}}toUnsigned(){return this.unsigned?this:w.fromBits(this.low,this.high,!0)}xor(m){return w.isLong(m)||(m=w.fromValue(m)),w.fromBits(this.low^m.low,this.high^m.high,this.unsigned)}toExtendedJSON(m){return m&&m.relaxed?this.toNumber():{$numberLong:this.toString()}}static fromExtendedJSON(m,j){let B=w.fromString(m.$numberLong);return j&&j.relaxed?B.toNumber():B}}e.Long=w,w.TWO_PWR_24=w.fromInt(n),w.MAX_UNSIGNED_VALUE=w.fromBits(4294967295|0,4294967295|0,!0),w.ZERO=w.fromInt(0),w.UZERO=w.fromInt(0,!0),w.ONE=w.fromInt(1),w.UONE=w.fromInt(1,!0),w.NEG_ONE=w.fromInt(-1),w.MAX_VALUE=w.fromBits(4294967295|0,2147483647|0,!1),w.MIN_VALUE=w.fromBits(0,2147483648|0,!1),Object.defineProperty(w.prototype,"__isLong__",{value:!0}),Object.defineProperty(w.prototype,"_bsontype",{value:"Long"})});nt(me);D_=me.Long,dn=Ze(function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.Decimal128=void 0;let f=/^(\+|-)?(\d+|(\d*\.\d*))?(E|e)?([-+])?(\d+)?$/,r=/^(\+|-)?(Infinity|inf)$/i,n=/^(\+|-)?NaN$/i,i=6111,o=-6176,s=6176,a=34,p=[124,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0].reverse(),w=[248,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0].reverse(),g=[120,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0].reverse(),m=/^([-+])?(\d+)?$/,j=31,B=16383,v=30,R=31;function D(te){return!isNaN(parseInt(te,10))}function z(te){let L=me.Long.fromNumber(1e3*1e3*1e3),re=me.Long.fromNumber(0);if(!te.parts[0]&&!te.parts[1]&&!te.parts[2]&&!te.parts[3])return{quotient:te,rem:re};for(let h=0;h<=3;h++)re=re.shiftLeft(32),re=re.add(new me.Long(te.parts[h],0)),te.parts[h]=re.div(L).low,re=re.modulo(L);return{quotient:te,rem:re}}function G(te,L){if(!te&&!L)return{high:me.Long.fromNumber(0),low:me.Long.fromNumber(0)};let re=te.shiftRightUnsigned(32),h=new me.Long(te.getLowBits(),0),d=L.shiftRightUnsigned(32),A=new me.Long(L.getLowBits(),0),c=re.multiply(d),P=re.multiply(A),U=h.multiply(d),F=h.multiply(A);return c=c.add(P.shiftRightUnsigned(32)),P=new me.Long(P.getLowBits(),0).add(U).add(F.shiftRightUnsigned(32)),c=c.add(P.shiftRightUnsigned(32)),F=P.shiftLeft(32).add(new me.Long(F.getLowBits(),0)),{high:c,low:F}}function fe(te,L){let re=te.high>>>0,h=L.high>>>0;if(re<h)return!0;if(re===h){let d=te.low>>>0,A=L.low>>>0;if(d<A)return!0}return!1}function K(te,L){throw new TypeError(`"${te}" is not a valid Decimal128 string - ${L}`)}class O{constructor(L){this.bytes=L}static fromString(L){let re=!1,h=!1,d=!1,A=0,c=0,P=0,U=0,F=0,Z=[0],I=0,ke=0,ne=0,C=0,W=0,ve=0,oe=new me.Long(0,0),xe=new me.Long(0,0),kt=0,ae=0;if(L.length>=7e3)throw new TypeError(""+L+" not a valid Decimal128 string");let tt=L.match(f),Qf=L.match(r),Xf=L.match(n);if(!tt&&!Qf&&!Xf||L.length===0)throw new TypeError(""+L+" not a valid Decimal128 string");if(tt){let Pe=tt[2],q=tt[4],u=tt[5],b=tt[6];q&&b===void 0&&K(L,"missing exponent power"),q&&Pe===void 0&&K(L,"missing exponent base"),q===void 0&&(u||b)&&K(L,"missing e before exponent")}if((L[ae]==="+"||L[ae]==="-")&&(re=L[ae++]==="-"),!D(L[ae])&&L[ae]!=="."){if(L[ae]==="i"||L[ae]==="I")return new O(se.Buffer.from(re?w:g));if(L[ae]==="N")return new O(se.Buffer.from(p))}for(;D(L[ae])||L[ae]===".";){if(L[ae]==="."){h&&K(L,"contains multiple periods"),h=!0,ae=ae+1;continue}I<34&&(L[ae]!=="0"||d)&&(d||(F=c),d=!0,Z[ke++]=parseInt(L[ae],10),I=I+1),d&&(P=P+1),h&&(U=U+1),c=c+1,ae=ae+1}if(h&&!c)throw new TypeError(""+L+" not a valid Decimal128 string");if(L[ae]==="e"||L[ae]==="E"){let Pe=L.substr(++ae).match(m);if(!Pe||!Pe[2])return new O(se.Buffer.from(p));W=parseInt(Pe[0],10),ae=ae+Pe[0].length}if(L[ae])return new O(se.Buffer.from(p));if(ne=0,!I)ne=0,C=0,Z[0]=0,P=1,I=1,A=0;else if(C=I-1,A=P,A!==1)for(;L[F+A-1]==="0";)A=A-1;for(W<=U&&U-W>1<<14?W=o:W=W-U;W>i;){if(C=C+1,C-ne>a){if(Z.join("").match(/^0+$/)){W=i;break}K(L,"overflow")}W=W-1}for(;W<o||I<P;){if(C===0&&A<I){W=o,A=0;break}if(I<P?P=P-1:C=C-1,W<i)W=W+1;else{if(Z.join("").match(/^0+$/)){W=i;break}K(L,"overflow")}}if(C-ne+1<A){let Pe=c;h&&(F=F+1,Pe=Pe+1),re&&(F=F+1,Pe=Pe+1);let q=parseInt(L[F+C+1],10),u=0;if(q>=5&&(u=1,q===5)){for(u=Z[C]%2==1?1:0,ve=F+C+2;ve<Pe;ve++)if(parseInt(L[ve],10)){u=1;break}}if(u){let b=C;for(;b>=0;b--)if(++Z[b]>9&&(Z[b]=0,b===0))if(W<i)W=W+1,Z[b]=1;else return new O(se.Buffer.from(re?w:g))}}if(oe=me.Long.fromNumber(0),xe=me.Long.fromNumber(0),A===0)oe=me.Long.fromNumber(0),xe=me.Long.fromNumber(0);else if(C-ne<17){let Pe=ne;for(xe=me.Long.fromNumber(Z[Pe++]),oe=new me.Long(0,0);Pe<=C;Pe++)xe=xe.multiply(me.Long.fromNumber(10)),xe=xe.add(me.Long.fromNumber(Z[Pe]))}else{let Pe=ne;for(oe=me.Long.fromNumber(Z[Pe++]);Pe<=C-17;Pe++)oe=oe.multiply(me.Long.fromNumber(10)),oe=oe.add(me.Long.fromNumber(Z[Pe]));for(xe=me.Long.fromNumber(Z[Pe++]);Pe<=C;Pe++)xe=xe.multiply(me.Long.fromNumber(10)),xe=xe.add(me.Long.fromNumber(Z[Pe]))}let Ye=G(oe,me.Long.fromString("100000000000000000"));Ye.low=Ye.low.add(xe),fe(Ye.low,xe)&&(Ye.high=Ye.high.add(me.Long.fromNumber(1))),kt=W+s;let Te={low:me.Long.fromNumber(0),high:me.Long.fromNumber(0)};Ye.high.shiftRightUnsigned(49).and(me.Long.fromNumber(1)).equals(me.Long.fromNumber(1))?(Te.high=Te.high.or(me.Long.fromNumber(3).shiftLeft(61)),Te.high=Te.high.or(me.Long.fromNumber(kt).and(me.Long.fromNumber(16383).shiftLeft(47))),Te.high=Te.high.or(Ye.high.and(me.Long.fromNumber(140737488355327)))):(Te.high=Te.high.or(me.Long.fromNumber(kt&16383).shiftLeft(49)),Te.high=Te.high.or(Ye.high.and(me.Long.fromNumber(562949953421311)))),Te.low=Ye.low,re&&(Te.high=Te.high.or(me.Long.fromString("9223372036854775808")));let ft=se.Buffer.alloc(16);return ae=0,ft[ae++]=Te.low.low&255,ft[ae++]=Te.low.low>>8&255,ft[ae++]=Te.low.low>>16&255,ft[ae++]=Te.low.low>>24&255,ft[ae++]=Te.low.high&255,ft[ae++]=Te.low.high>>8&255,ft[ae++]=Te.low.high>>16&255,ft[ae++]=Te.low.high>>24&255,ft[ae++]=Te.high.low&255,ft[ae++]=Te.high.low>>8&255,ft[ae++]=Te.high.low>>16&255,ft[ae++]=Te.high.low>>24&255,ft[ae++]=Te.high.high&255,ft[ae++]=Te.high.high>>8&255,ft[ae++]=Te.high.high>>16&255,ft[ae++]=Te.high.high>>24&255,new O(ft)}toString(){let L,re=0,h=new Array(36);for(let ae=0;ae<h.length;ae++)h[ae]=0;let d=0,A=!1,c,P={parts:[0,0,0,0]},U,F,Z=[];d=0;let I=this.bytes,ke=I[d++]|I[d++]<<8|I[d++]<<16|I[d++]<<24,ne=I[d++]|I[d++]<<8|I[d++]<<16|I[d++]<<24,C=I[d++]|I[d++]<<8|I[d++]<<16|I[d++]<<24,W=I[d++]|I[d++]<<8|I[d++]<<16|I[d++]<<24;d=0,{low:new me.Long(ke,ne),high:new me.Long(C,W)}.high.lessThan(me.Long.ZERO)&&Z.push("-");let oe=W>>26&j;if(oe>>3==3){if(oe===v)return Z.join("")+"Infinity";if(oe===R)return"NaN";L=W>>15&B,c=8+(W>>14&1)}else c=W>>14&7,L=W>>17&B;let xe=L-s;if(P.parts[0]=(W&16383)+((c&15)<<14),P.parts[1]=C,P.parts[2]=ne,P.parts[3]=ke,P.parts[0]===0&&P.parts[1]===0&&P.parts[2]===0&&P.parts[3]===0)A=!0;else for(F=3;F>=0;F--){let ae=0,tt=z(P);if(P=tt.quotient,ae=tt.rem.low,!!ae)for(U=8;U>=0;U--)h[F*9+U]=ae%10,ae=Math.floor(ae/10)}if(A)re=1,h[d]=0;else for(re=36;!h[d];)re=re-1,d=d+1;let kt=re-1+xe;if(kt>=34||kt<=-7||xe>0){if(re>34)return Z.push(`${0}`),xe>0?Z.push("E+"+xe):xe<0&&Z.push("E"+xe),Z.join("");Z.push(`${h[d++]}`),re=re-1,re&&Z.push(".");for(let ae=0;ae<re;ae++)Z.push(`${h[d++]}`);Z.push("E"),kt>0?Z.push("+"+kt):Z.push(`${kt}`)}else if(xe>=0)for(let ae=0;ae<re;ae++)Z.push(`${h[d++]}`);else{let ae=re+xe;if(ae>0)for(let tt=0;tt<ae;tt++)Z.push(`${h[d++]}`);else Z.push("0");for(Z.push(".");ae++<0;)Z.push("0");for(let tt=0;tt<re-Math.max(ae-1,0);tt++)Z.push(`${h[d++]}`)}return Z.join("")}toJSON(){return{$numberDecimal:this.toString()}}toExtendedJSON(){return{$numberDecimal:this.toString()}}static fromExtendedJSON(L){return O.fromString(L.$numberDecimal)}}e.Decimal128=O,Object.defineProperty(O.prototype,"_bsontype",{value:"Decimal128"})});nt(dn);C_=dn.Decimal128,zr=Ze(function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.Double=void 0;class f{constructor(n){n instanceof Number&&(n=n.valueOf()),this.value=+n}valueOf(){return this.value}toJSON(){return this.value}toExtendedJSON(n){if(n&&(n.legacy||n.relaxed&&isFinite(this.value)))return this.value;if(Object.is(Math.sign(this.value),-0))return{$numberDouble:`-${this.value.toFixed(1)}`};let i;return Number.isInteger(this.value)?(i=this.value.toFixed(1),i.length>=13&&(i=this.value.toExponential(13).toUpperCase())):i=this.value.toString(),{$numberDouble:i}}static fromExtendedJSON(n,i){let o=parseFloat(n.$numberDouble);return i&&i.relaxed?o:new f(o)}}e.Double=f,Object.defineProperty(f.prototype,"_bsontype",{value:"Double"})});nt(zr);L_=zr.Double,Fr=Ze(function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.Int32=void 0;class f{constructor(n){n instanceof Number&&(n=n.valueOf()),this.value=+n}valueOf(){return this.value}toJSON(){return this.value}toExtendedJSON(n){return n&&(n.relaxed||n.legacy)?this.value:{$numberInt:this.value.toString()}}static fromExtendedJSON(n,i){return i&&i.relaxed?parseInt(n.$numberInt,10):new f(n.$numberInt)}}e.Int32=f,Object.defineProperty(f.prototype,"_bsontype",{value:"Int32"})});nt(Fr);U_=Fr.Int32,Go=Ze(function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.Map=void 0;let f;e.Map=f;let r=function(o){return o&&o.Math==Math&&o};function n(){return r(typeof globalThis=="object"&&globalThis)||r(typeof window=="object"&&window)||r(typeof self=="object"&&self)||r(typeof Co=="object"&&Co)||Function("return this")()}let i=n();Object.prototype.hasOwnProperty.call(i,"Map")?e.Map=f=i.Map:e.Map=f=class{constructor(s=[]){this._keys=[],this._values={};for(let a=0;a<s.length;a++){if(s[a]==null)continue;let p=s[a],w=p[0],g=p[1];this._keys.push(w),this._values[w]={v:g,i:this._keys.length-1}}}clear(){this._keys=[],this._values={}}delete(s){let a=this._values[s];return a==null?!1:(delete this._values[s],this._keys.splice(a.i,1),!0)}entries(){let s=0;return{next:()=>{let a=this._keys[s++];return{value:a!==void 0?[a,this._values[a].v]:void 0,done:a===void 0}}}}forEach(s,a){a=a||this;for(let p=0;p<this._keys.length;p++){let w=this._keys[p];s.call(a,this._values[w].v,w,a)}}get(s){return this._values[s]?this._values[s].v:void 0}has(s){return this._values[s]!=null}keys(){let s=0;return{next:()=>{let a=this._keys[s++];return{value:a!==void 0?a:void 0,done:a===void 0}}}}set(s,a){return this._values[s]?(this._values[s].v=a,this):(this._keys.push(s),this._values[s]={v:a,i:this._keys.length-1},this)}values(){let s=0;return{next:()=>{let a=this._keys[s++];return{value:a!==void 0?this._values[a].v:void 0,done:a===void 0}}}}get size(){return this._keys.length}}});nt(Go);K_=Go.Map,hn=Ze(function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.MaxKey=void 0;class f{toExtendedJSON(){return{$maxKey:1}}static fromExtendedJSON(){return new f}}e.MaxKey=f,Object.defineProperty(f.prototype,"_bsontype",{value:"MaxKey"})});nt(hn);W_=hn.MaxKey,gn=Ze(function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.MinKey=void 0;class f{toExtendedJSON(){return{$minKey:1}}static fromExtendedJSON(){return new f}}e.MinKey=f,Object.defineProperty(f.prototype,"_bsontype",{value:"MinKey"})});nt(gn);Y_=gn.MinKey,Lf=Ze(function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.ObjectId=void 0;let f=Ce.randomBytes(5),r=new RegExp("^[0-9a-fA-F]{24}$"),n=[];for(let w=0;w<256;w++)n[w]=(w<=15?"0":"")+w.toString(16);let i=[],o=0;for(;o<10;)i[48+o]=o++;for(;o<16;)i[65-10+o]=i[97-10+o]=o++;let s=Symbol("id");class a{constructor(g){if(g instanceof a&&(this[s]=g.id,this.__id=g.__id),typeof g=="object"&&g&&"id"in g&&("toHexString"in g&&typeof g.toHexString=="function"?this[s]=se.Buffer.from(g.toHexString(),"hex"):this[s]=typeof g.id=="string"?se.Buffer.from(g.id):g.id),(g==null||typeof g=="number")&&(this[s]=a.generate(typeof g=="number"?g:void 0),a.cacheHexString&&(this.__id=this.id.toString("hex"))),ArrayBuffer.isView(g)&&g.byteLength===12&&(this[s]=pr.ensureBuffer(g)),typeof g=="string")if(g.length===12){let m=se.Buffer.from(g);m.byteLength===12&&(this[s]=m)}else if(g.length===24&&r.test(g))this[s]=se.Buffer.from(g,"hex");else throw new TypeError("Argument passed in must be a Buffer or string of 12 bytes or a string of 24 hex characters");a.cacheHexString&&(this.__id=this.id.toString("hex"))}get id(){return this[s]}set id(g){this[s]=g,a.cacheHexString&&(this.__id=g.toString("hex"))}get generationTime(){return this.id.readInt32BE(0)}set generationTime(g){this.id.writeUInt32BE(g,0)}toHexString(){if(a.cacheHexString&&this.__id)return this.__id;let g=this.id.toString("hex");return a.cacheHexString&&!this.__id&&(this.__id=g),g}static getInc(){return a.index=(a.index+1)%16777215}static generate(g){typeof g!="number"&&(g=~~(Date.now()/1e3));let m=a.getInc(),j=se.Buffer.alloc(12);return j.writeUInt32BE(g,0),j[4]=f[0],j[5]=f[1],j[6]=f[2],j[7]=f[3],j[8]=f[4],j[11]=m&255,j[10]=m>>8&255,j[9]=m>>16&255,j}toString(g){return g?this.id.toString(g):this.toHexString()}toJSON(){return this.toHexString()}equals(g){return g==null?!1:g instanceof a?this.toString()===g.toString():typeof g=="string"&&a.isValid(g)&&g.length===12&&this.id instanceof se.Buffer?g===this.id.toString("binary"):typeof g=="string"&&a.isValid(g)&&g.length===24?g.toLowerCase()===this.toHexString():typeof g=="string"&&a.isValid(g)&&g.length===12?se.Buffer.from(g).equals(this.id):typeof g=="object"&&"toHexString"in g&&typeof g.toHexString=="function"?g.toHexString()===this.toHexString():!1}getTimestamp(){let g=new Date,m=this.id.readUInt32BE(0);return g.setTime(Math.floor(m)*1e3),g}static createPk(){return new a}static createFromTime(g){let m=se.Buffer.from([0,0,0,0,0,0,0,0,0,0,0,0]);return m.writeUInt32BE(g,0),new a(m)}static createFromHexString(g){if(typeof g=="undefined"||g!=null&&g.length!==24)throw new TypeError("Argument passed in must be a single String of 12 bytes or a string of 24 hex characters");return new a(se.Buffer.from(g,"hex"))}static isValid(g){return g==null?!1:typeof g=="number"?!0:typeof g=="string"?g.length===12||g.length===24&&r.test(g):g instanceof a||g instanceof se.Buffer&&g.length===12?!0:typeof g=="object"&&"toHexString"in g&&typeof g.toHexString=="function"?typeof g.id=="string"?g.id.length===12:g.toHexString().length===24&&r.test(g.id.toString("hex")):!1}toExtendedJSON(){return this.toHexString?{$oid:this.toHexString()}:{$oid:this.toString("hex")}}static fromExtendedJSON(g){return new a(g.$oid)}}e.ObjectId=a,a.index=~~(Math.random()*16777215),Object.defineProperty(a.prototype,"generate",{value:Ce.deprecate(w=>a.generate(w),"Please use the static `ObjectId.generate(time)` instead")}),Object.defineProperty(a.prototype,"getInc",{value:Ce.deprecate(()=>a.getInc(),"Please use the static `ObjectId.getInc()` instead")}),Object.defineProperty(a.prototype,"get_inc",{value:Ce.deprecate(()=>a.getInc(),"Please use the static `ObjectId.getInc()` instead")}),Object.defineProperty(a,"get_inc",{value:Ce.deprecate(()=>a.getInc(),"Please use the static `ObjectId.getInc()` instead")});let p=Symbol.for("nodejs.util.inspect.custom");Object.defineProperty(a.prototype,p,a.prototype.toString),Object.defineProperty(a.prototype,"inspect",a.prototype.toString),Object.defineProperty(a.prototype,"_bsontype",{value:"ObjectID"})});nt(Lf);V_=Lf.ObjectId,M=Ze(function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.BSON_BINARY_SUBTYPE_USER_DEFINED=e.BSON_BINARY_SUBTYPE_MD5=e.BSON_BINARY_SUBTYPE_UUID_NEW=e.BSON_BINARY_SUBTYPE_UUID=e.BSON_BINARY_SUBTYPE_BYTE_ARRAY=e.BSON_BINARY_SUBTYPE_FUNCTION=e.BSON_BINARY_SUBTYPE_DEFAULT=e.BSON_DATA_MAX_KEY=e.BSON_DATA_MIN_KEY=e.BSON_DATA_DECIMAL128=e.BSON_DATA_LONG=e.BSON_DATA_TIMESTAMP=e.BSON_DATA_INT=e.BSON_DATA_CODE_W_SCOPE=e.BSON_DATA_SYMBOL=e.BSON_DATA_CODE=e.BSON_DATA_DBPOINTER=e.BSON_DATA_REGEXP=e.BSON_DATA_NULL=e.BSON_DATA_DATE=e.BSON_DATA_BOOLEAN=e.BSON_DATA_OID=e.BSON_DATA_UNDEFINED=e.BSON_DATA_BINARY=e.BSON_DATA_ARRAY=e.BSON_DATA_OBJECT=e.BSON_DATA_STRING=e.BSON_DATA_NUMBER=e.JS_INT_MIN=e.JS_INT_MAX=e.BSON_INT64_MIN=e.BSON_INT64_MAX=e.BSON_INT32_MIN=e.BSON_INT32_MAX=void 0,e.BSON_INT32_MAX=2147483647,e.BSON_INT32_MIN=-2147483648,e.BSON_INT64_MAX=Math.pow(2,63)-1,e.BSON_INT64_MIN=-Math.pow(2,63),e.JS_INT_MAX=Math.pow(2,53),e.JS_INT_MIN=-Math.pow(2,53),e.BSON_DATA_NUMBER=1,e.BSON_DATA_STRING=2,e.BSON_DATA_OBJECT=3,e.BSON_DATA_ARRAY=4,e.BSON_DATA_BINARY=5,e.BSON_DATA_UNDEFINED=6,e.BSON_DATA_OID=7,e.BSON_DATA_BOOLEAN=8,e.BSON_DATA_DATE=9,e.BSON_DATA_NULL=10,e.BSON_DATA_REGEXP=11,e.BSON_DATA_DBPOINTER=12,e.BSON_DATA_CODE=13,e.BSON_DATA_SYMBOL=14,e.BSON_DATA_CODE_W_SCOPE=15,e.BSON_DATA_INT=16,e.BSON_DATA_TIMESTAMP=17,e.BSON_DATA_LONG=18,e.BSON_DATA_DECIMAL128=19,e.BSON_DATA_MIN_KEY=255,e.BSON_DATA_MAX_KEY=127,e.BSON_BINARY_SUBTYPE_DEFAULT=0,e.BSON_BINARY_SUBTYPE_FUNCTION=1,e.BSON_BINARY_SUBTYPE_BYTE_ARRAY=2,e.BSON_BINARY_SUBTYPE_UUID=3,e.BSON_BINARY_SUBTYPE_UUID_NEW=4,e.BSON_BINARY_SUBTYPE_MD5=5,e.BSON_BINARY_SUBTYPE_USER_DEFINED=128});nt(M);G_=M.BSON_BINARY_SUBTYPE_USER_DEFINED,J_=M.BSON_BINARY_SUBTYPE_MD5,Q_=M.BSON_BINARY_SUBTYPE_UUID_NEW,X_=M.BSON_BINARY_SUBTYPE_UUID,Z_=M.BSON_BINARY_SUBTYPE_BYTE_ARRAY,$_=M.BSON_BINARY_SUBTYPE_FUNCTION,eB=M.BSON_BINARY_SUBTYPE_DEFAULT,tB=M.BSON_DATA_MAX_KEY,fB=M.BSON_DATA_MIN_KEY,rB=M.BSON_DATA_DECIMAL128,nB=M.BSON_DATA_LONG,iB=M.BSON_DATA_TIMESTAMP,oB=M.BSON_DATA_INT,lB=M.BSON_DATA_CODE_W_SCOPE,sB=M.BSON_DATA_SYMBOL,aB=M.BSON_DATA_CODE,pB=M.BSON_DATA_DBPOINTER,wB=M.BSON_DATA_REGEXP,mB=M.BSON_DATA_NULL,uB=M.BSON_DATA_DATE,bB=M.BSON_DATA_BOOLEAN,cB=M.BSON_DATA_OID,dB=M.BSON_DATA_UNDEFINED,hB=M.BSON_DATA_BINARY,gB=M.BSON_DATA_ARRAY,jB=M.BSON_DATA_OBJECT,qB=M.BSON_DATA_STRING,yB=M.BSON_DATA_NUMBER,vB=M.JS_INT_MIN,kB=M.JS_INT_MAX,TB=M.BSON_INT64_MIN,_B=M.BSON_INT64_MAX,BB=M.BSON_INT32_MIN,xB=M.BSON_INT32_MAX,Zs=Ze(function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.calculateObjectSize=void 0;function f(n,i,o){let s=4+1;if(Array.isArray(n))for(let a=0;a<n.length;a++)s+=r(a.toString(),n[a],i,!0,o);else{n.toBSON&&(n=n.toBSON());for(let a in n)s+=r(a,n[a],i,!1,o)}return s}e.calculateObjectSize=f;function r(n,i,o=!1,s=!1,a=!1){switch(i&&i.toBSON&&(i=i.toBSON()),typeof i){case"string":return 1+se.Buffer.byteLength(n,"utf8")+1+4+se.Buffer.byteLength(i,"utf8")+1;case"number":return Math.floor(i)===i&&i>=M.JS_INT_MIN&&i<=M.JS_INT_MAX&&i>=M.BSON_INT32_MIN&&i<=M.BSON_INT32_MAX?(n!=null?se.Buffer.byteLength(n,"utf8")+1:0)+(4+1):(n!=null?se.Buffer.byteLength(n,"utf8")+1:0)+(8+1);case"undefined":return s||!a?(n!=null?se.Buffer.byteLength(n,"utf8")+1:0)+1:0;case"boolean":return(n!=null?se.Buffer.byteLength(n,"utf8")+1:0)+(1+1);case"object":if(i==null||i._bsontype==="MinKey"||i._bsontype==="MaxKey")return(n!=null?se.Buffer.byteLength(n,"utf8")+1:0)+1;if(i._bsontype==="ObjectId"||i._bsontype==="ObjectID")return(n!=null?se.Buffer.byteLength(n,"utf8")+1:0)+(12+1);if(i instanceof Date||Ce.isDate(i))return(n!=null?se.Buffer.byteLength(n,"utf8")+1:0)+(8+1);if(ArrayBuffer.isView(i)||i instanceof ArrayBuffer)return(n!=null?se.Buffer.byteLength(n,"utf8")+1:0)+(1+4+1)+i.byteLength;if(i._bsontype==="Long"||i._bsontype==="Double"||i._bsontype==="Timestamp")return(n!=null?se.Buffer.byteLength(n,"utf8")+1:0)+(8+1);if(i._bsontype==="Decimal128")return(n!=null?se.Buffer.byteLength(n,"utf8")+1:0)+(16+1);if(i._bsontype==="Code")return i.scope!=null&&Object.keys(i.scope).length>0?(n!=null?se.Buffer.byteLength(n,"utf8")+1:0)+1+4+4+se.Buffer.byteLength(i.code.toString(),"utf8")+1+f(i.scope,o,a):(n!=null?se.Buffer.byteLength(n,"utf8")+1:0)+1+4+se.Buffer.byteLength(i.code.toString(),"utf8")+1;if(i._bsontype==="Binary")return i.sub_type===Gt.Binary.SUBTYPE_BYTE_ARRAY?(n!=null?se.Buffer.byteLength(n,"utf8")+1:0)+(i.position+1+4+1+4):(n!=null?se.Buffer.byteLength(n,"utf8")+1:0)+(i.position+1+4+1);if(i._bsontype==="Symbol")return(n!=null?se.Buffer.byteLength(n,"utf8")+1:0)+se.Buffer.byteLength(i.value,"utf8")+4+1+1;if(i._bsontype==="DBRef"){let p=Object.assign({$ref:i.collection,$id:i.oid},i.fields);return i.db!=null&&(p.$db=i.db),(n!=null?se.Buffer.byteLength(n,"utf8")+1:0)+1+f(p,o,a)}else return i instanceof RegExp||Object.prototype.toString.call(i)==="[object RegExp]"?(n!=null?se.Buffer.byteLength(n,"utf8")+1:0)+1+se.Buffer.byteLength(i.source,"utf8")+1+(i.global?1:0)+(i.ignoreCase?1:0)+(i.multiline?1:0)+1:i._bsontype==="BSONRegExp"?(n!=null?se.Buffer.byteLength(n,"utf8")+1:0)+1+se.Buffer.byteLength(i.pattern,"utf8")+1+se.Buffer.byteLength(i.options,"utf8")+1:(n!=null?se.Buffer.byteLength(n,"utf8")+1:0)+f(i,o,a)+1;case"function":if(i instanceof RegExp||Object.prototype.toString.call(i)==="[object RegExp]"||String.call(i)==="[object RegExp]")return(n!=null?se.Buffer.byteLength(n,"utf8")+1:0)+1+se.Buffer.byteLength(i.source,"utf8")+1+(i.global?1:0)+(i.ignoreCase?1:0)+(i.multiline?1:0)+1;if(o&&i.scope!=null&&Object.keys(i.scope).length>0)return(n!=null?se.Buffer.byteLength(n,"utf8")+1:0)+1+4+4+se.Buffer.byteLength(Ce.normalizedFunctionString(i),"utf8")+1+f(i.scope,o,a);if(o)return(n!=null?se.Buffer.byteLength(n,"utf8")+1:0)+1+4+se.Buffer.byteLength(Ce.normalizedFunctionString(i),"utf8")+1}return 0}});nt(Zs);EB=Zs.calculateObjectSize,mr=Ze(function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.BSONRegExp=void 0;function f(n){return n.split("").sort().join("")}class r{constructor(i,o){this.pattern=i,this.options=o??"",f(this.options);for(let s=0;s<this.options.length;s++)if(!(this.options[s]==="i"||this.options[s]==="m"||this.options[s]==="x"||this.options[s]==="l"||this.options[s]==="s"||this.options[s]==="u"))throw new Error(`The regular expression option [${this.options[s]}] is not supported`)}static parseOptions(i){return i?i.split("").sort().join(""):""}toExtendedJSON(i){return i=i||{},i.legacy?{$regex:this.pattern,$options:this.options}:{$regularExpression:{pattern:this.pattern,options:this.options}}}static fromExtendedJSON(i){if("$regex"in i)if(typeof i.$regex!="string"){if(i.$regex._bsontype==="BSONRegExp")return i}else return new r(i.$regex,r.parseOptions(i.$options));if("$regularExpression"in i)return new r(i.$regularExpression.pattern,r.parseOptions(i.$regularExpression.options));throw new TypeError(`Unexpected BSONRegExp EJSON object form: ${JSON.stringify(i)}`)}}e.BSONRegExp=r,Object.defineProperty(r.prototype,"_bsontype",{value:"BSONRegExp"})});nt(mr);IB=mr.BSONRegExp,jn=Ze(function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.BSONSymbol=void 0;class f{constructor(n){this.value=n}valueOf(){return this.value}toString(){return this.value}inspect(){return this.value}toJSON(){return this.value}toExtendedJSON(){return{$symbol:this.value}}static fromExtendedJSON(n){return new f(n.$symbol)}}e.BSONSymbol=f,Object.defineProperty(f.prototype,"_bsontype",{value:"Symbol"})});nt(jn);SB=jn.BSONSymbol,ur=Ze(function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.Timestamp=e.LongWithoutOverridesClass=void 0,e.LongWithoutOverridesClass=me.Long;class f extends e.LongWithoutOverridesClass{constructor(n,i){me.Long.isLong(n)?super(n.low,n.high,!0):super(n,i,!0),Object.defineProperty(this,"_bsontype",{value:"Timestamp",writable:!1,configurable:!1,enumerable:!1})}toJSON(){return{$timestamp:this.toString()}}static fromInt(n){return new f(me.Long.fromInt(n,!0))}static fromNumber(n){return new f(me.Long.fromNumber(n,!0))}static fromBits(n,i){return new f(n,i)}static fromString(n,i){return new f(me.Long.fromString(n,!0,i))}toExtendedJSON(){return{$timestamp:{t:this.high>>>0,i:this.low>>>0}}}static fromExtendedJSON(n){return new f(n.$timestamp.i,n.$timestamp.t)}}e.Timestamp=f,f.MAX_VALUE=me.Long.MAX_UNSIGNED_VALUE});nt(ur);AB=ur.Timestamp,OB=ur.LongWithoutOverridesClass,Jo=Ze(function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.validateUtf8=void 0;let f=128,r=192,n=224,i=240,o=248,s=192,a=224,p=240,w=128;function g(m,j,B){let v=0;for(let R=j;R<B;R+=1){let D=m[R];if(v){if((D&r)!==w)return!1;v-=1}else if(D&f)if((D&n)===s)v=1;else if((D&i)===a)v=2;else if((D&o)===p)v=3;else return!1}return!v}e.validateUtf8=g});nt(Jo);HB=Jo.validateUtf8,Qo=Ze(function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.deserialize=void 0;let f=me.Long.fromNumber(M.JS_INT_MAX),r=me.Long.fromNumber(M.JS_INT_MIN),n={};function i(a,p,w){p=p??{};let g=p&&p.index?p.index:0,m=a[g]|a[g+1]<<8|a[g+2]<<16|a[g+3]<<24;if(m<5)throw new Error(`bson size must be >= 5, is ${m}`);if(p.allowObjectSmallerThanBufferSize&&a.length<m)throw new Error(`buffer length ${a.length} must be >= bson size ${m}`);if(!p.allowObjectSmallerThanBufferSize&&a.length!==m)throw new Error(`buffer length ${a.length} must === bson size ${m}`);if(m+g>a.byteLength)throw new Error(`(bson size ${m} + options.index ${g} must be <= buffer length ${a.byteLength})`);if(a[g+m-1]!==0)throw new Error("One object, sized correctly, with a spot for an EOO, but the EOO isn't 0x00");return o(a,g,p,w)}e.deserialize=i;function o(a,p,w,g=!1){let m=w.evalFunctions==null?!1:w.evalFunctions,j=w.cacheFunctions==null?!1:w.cacheFunctions,B=w.fieldsAsRaw==null?null:w.fieldsAsRaw,v=w.raw==null?!1:w.raw,R=typeof w.bsonRegExp=="boolean"?w.bsonRegExp:!1,D=w.promoteBuffers==null?!1:w.promoteBuffers,z=w.promoteLongs==null?!0:w.promoteLongs,G=w.promoteValues==null?!0:w.promoteValues,fe=p;if(a.length<5)throw new Error("corrupt bson message < 5 bytes long");let K=a[p++]|a[p++]<<8|a[p++]<<16|a[p++]<<24;if(K<5||K>a.length)throw new Error("corrupt bson message");let O=g?[]:{},te=0,L=!1;for(;!L;){let d=a[p++];if(d===0)break;let A=p;for(;a[A]!==0&&A<a.length;)A++;if(A>=a.byteLength)throw new Error("Bad BSON Document: illegal CString");let c=g?te++:a.toString("utf8",p,A);if(p=A+1,d===M.BSON_DATA_STRING){let P=a[p++]|a[p++]<<8|a[p++]<<16|a[p++]<<24;if(P<=0||P>a.length-p||a[p+P-1]!==0)throw new Error("bad string length in bson");if(!Jo.validateUtf8(a,p,p+P-1))throw new Error("Invalid UTF-8 string in BSON document");let U=a.toString("utf8",p,p+P-1);O[c]=U,p=p+P}else if(d===M.BSON_DATA_OID){let P=se.Buffer.alloc(12);a.copy(P,0,p,p+12),O[c]=new Lf.ObjectId(P),p=p+12}else if(d===M.BSON_DATA_INT&&G===!1)O[c]=new Fr.Int32(a[p++]|a[p++]<<8|a[p++]<<16|a[p++]<<24);else if(d===M.BSON_DATA_INT)O[c]=a[p++]|a[p++]<<8|a[p++]<<16|a[p++]<<24;else if(d===M.BSON_DATA_NUMBER&&G===!1)O[c]=new zr.Double(a.readDoubleLE(p)),p=p+8;else if(d===M.BSON_DATA_NUMBER)O[c]=a.readDoubleLE(p),p=p+8;else if(d===M.BSON_DATA_DATE){let P=a[p++]|a[p++]<<8|a[p++]<<16|a[p++]<<24,U=a[p++]|a[p++]<<8|a[p++]<<16|a[p++]<<24;O[c]=new Date(new me.Long(P,U).toNumber())}else if(d===M.BSON_DATA_BOOLEAN){if(a[p]!==0&&a[p]!==1)throw new Error("illegal boolean type value");O[c]=a[p++]===1}else if(d===M.BSON_DATA_OBJECT){let P=p,U=a[p]|a[p+1]<<8|a[p+2]<<16|a[p+3]<<24;if(U<=0||U>a.length-p)throw new Error("bad embedded document length in bson");v?O[c]=a.slice(p,p+U):O[c]=o(a,P,w,!1),p=p+U}else if(d===M.BSON_DATA_ARRAY){let P=p,U=a[p]|a[p+1]<<8|a[p+2]<<16|a[p+3]<<24,F=w,Z=p+U;if(B&&B[c]){F={};for(let I in w)F[I]=w[I];F.raw=!0}if(O[c]=o(a,P,F,!0),p=p+U,a[p-1]!==0)throw new Error("invalid array terminator byte");if(p!==Z)throw new Error("corrupted array bson")}else if(d===M.BSON_DATA_UNDEFINED)O[c]=void 0;else if(d===M.BSON_DATA_NULL)O[c]=null;else if(d===M.BSON_DATA_LONG){let P=a[p++]|a[p++]<<8|a[p++]<<16|a[p++]<<24,U=a[p++]|a[p++]<<8|a[p++]<<16|a[p++]<<24,F=new me.Long(P,U);z&&G===!0?O[c]=F.lessThanOrEqual(f)&&F.greaterThanOrEqual(r)?F.toNumber():F:O[c]=F}else if(d===M.BSON_DATA_DECIMAL128){let P=se.Buffer.alloc(16);a.copy(P,0,p,p+16),p=p+16;let U=new dn.Decimal128(P);"toObject"in U&&typeof U.toObject=="function"?O[c]=U.toObject():O[c]=U}else if(d===M.BSON_DATA_BINARY){let P=a[p++]|a[p++]<<8|a[p++]<<16|a[p++]<<24,U=P,F=a[p++];if(P<0)throw new Error("Negative binary type element size found");if(P>a.byteLength)throw new Error("Binary type size larger than document size");if(a.slice!=null){if(F===Gt.Binary.SUBTYPE_BYTE_ARRAY){if(P=a[p++]|a[p++]<<8|a[p++]<<16|a[p++]<<24,P<0)throw new Error("Negative binary type element size found for subtype 0x02");if(P>U-4)throw new Error("Binary type with subtype 0x02 contains too long binary size");if(P<U-4)throw new Error("Binary type with subtype 0x02 contains too short binary size")}D&&G?O[c]=a.slice(p,p+P):O[c]=new Gt.Binary(a.slice(p,p+P),F)}else{let Z=se.Buffer.alloc(P);if(F===Gt.Binary.SUBTYPE_BYTE_ARRAY){if(P=a[p++]|a[p++]<<8|a[p++]<<16|a[p++]<<24,P<0)throw new Error("Negative binary type element size found for subtype 0x02");if(P>U-4)throw new Error("Binary type with subtype 0x02 contains too long binary size");if(P<U-4)throw new Error("Binary type with subtype 0x02 contains too short binary size")}for(A=0;A<P;A++)Z[A]=a[p+A];D&&G?O[c]=Z:O[c]=new Gt.Binary(Z,F)}p=p+P}else if(d===M.BSON_DATA_REGEXP&&R===!1){for(A=p;a[A]!==0&&A<a.length;)A++;if(A>=a.length)throw new Error("Bad BSON Document: illegal CString");let P=a.toString("utf8",p,A);for(p=A+1,A=p;a[A]!==0&&A<a.length;)A++;if(A>=a.length)throw new Error("Bad BSON Document: illegal CString");let U=a.toString("utf8",p,A);p=A+1;let F=new Array(U.length);for(A=0;A<U.length;A++)switch(U[A]){case"m":F[A]="m";break;case"s":F[A]="g";break;case"i":F[A]="i";break}O[c]=new RegExp(P,F.join(""))}else if(d===M.BSON_DATA_REGEXP&&R===!0){for(A=p;a[A]!==0&&A<a.length;)A++;if(A>=a.length)throw new Error("Bad BSON Document: illegal CString");let P=a.toString("utf8",p,A);for(p=A+1,A=p;a[A]!==0&&A<a.length;)A++;if(A>=a.length)throw new Error("Bad BSON Document: illegal CString");let U=a.toString("utf8",p,A);p=A+1,O[c]=new mr.BSONRegExp(P,U)}else if(d===M.BSON_DATA_SYMBOL){let P=a[p++]|a[p++]<<8|a[p++]<<16|a[p++]<<24;if(P<=0||P>a.length-p||a[p+P-1]!==0)throw new Error("bad string length in bson");let U=a.toString("utf8",p,p+P-1);O[c]=G?U:new jn.BSONSymbol(U),p=p+P}else if(d===M.BSON_DATA_TIMESTAMP){let P=a[p++]|a[p++]<<8|a[p++]<<16|a[p++]<<24,U=a[p++]|a[p++]<<8|a[p++]<<16|a[p++]<<24;O[c]=new ur.Timestamp(P,U)}else if(d===M.BSON_DATA_MIN_KEY)O[c]=new gn.MinKey;else if(d===M.BSON_DATA_MAX_KEY)O[c]=new hn.MaxKey;else if(d===M.BSON_DATA_CODE){let P=a[p++]|a[p++]<<8|a[p++]<<16|a[p++]<<24;if(P<=0||P>a.length-p||a[p+P-1]!==0)throw new Error("bad string length in bson");let U=a.toString("utf8",p,p+P-1);m?j?O[c]=s(U,n,O):O[c]=s(U):O[c]=new wr.Code(U),p=p+P}else if(d===M.BSON_DATA_CODE_W_SCOPE){let P=a[p++]|a[p++]<<8|a[p++]<<16|a[p++]<<24;if(P<4+4+4+1)throw new Error("code_w_scope total size shorter minimum expected length");let U=a[p++]|a[p++]<<8|a[p++]<<16|a[p++]<<24;if(U<=0||U>a.length-p||a[p+U-1]!==0)throw new Error("bad string length in bson");let F=a.toString("utf8",p,p+U-1);p=p+U;let Z=p,I=a[p]|a[p+1]<<8|a[p+2]<<16|a[p+3]<<24,ke=o(a,Z,w,!1);if(p=p+I,P<4+4+I+U)throw new Error("code_w_scope total size is too short, truncating scope");if(P>4+4+I+U)throw new Error("code_w_scope total size is too long, clips outer document");m?(j?O[c]=s(F,n,O):O[c]=s(F),O[c].scope=ke):O[c]=new wr.Code(F,ke)}else if(d===M.BSON_DATA_DBPOINTER){let P=a[p++]|a[p++]<<8|a[p++]<<16|a[p++]<<24;if(P<=0||P>a.length-p||a[p+P-1]!==0)throw new Error("bad string length in bson");if(!Jo.validateUtf8(a,p,p+P-1))throw new Error("Invalid UTF-8 string in BSON document");let U=a.toString("utf8",p,p+P-1);p=p+P;let F=se.Buffer.alloc(12);a.copy(F,0,p,p+12);let Z=new Lf.ObjectId(F);p=p+12,O[c]=new mf.DBRef(U,Z)}else throw new Error("Detected unknown BSON type "+d.toString(16)+' for fieldname "'+c+'"')}if(K!==p-fe)throw g?new Error("corrupt array bson"):new Error("corrupt object bson");let re=Object.keys(O).filter(d=>d.startsWith("$")),h=!0;if(re.forEach(d=>{["$ref","$id","$db"].indexOf(d)===-1&&(h=!1)}),!h)return O;if(mf.isDBRefLike(O)){let d=Object.assign({},O);return delete d.$ref,delete d.$id,delete d.$db,new mf.DBRef(O.$ref,O.$id,O.$db,d)}return O}function s(a,p,w){return p?(p[a]==null&&(p[a]=new Function(a)),p[a].bind(w)):new Function(a)}});nt(Qo);NB=Qo.deserialize,wi=Ze(function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.EJSON=e.isBSONType=void 0;function f(v){return Ce.isObjectLike(v)&&Reflect.has(v,"_bsontype")&&typeof v._bsontype=="string"}e.isBSONType=f;let r=2147483647,n=-2147483648,i=9223372036854776e3,o=-9223372036854776e3,s={$oid:Lf.ObjectId,$binary:Gt.Binary,$uuid:Gt.Binary,$symbol:jn.BSONSymbol,$numberInt:Fr.Int32,$numberDecimal:dn.Decimal128,$numberDouble:zr.Double,$numberLong:me.Long,$minKey:gn.MinKey,$maxKey:hn.MaxKey,$regex:mr.BSONRegExp,$regularExpression:mr.BSONRegExp,$timestamp:ur.Timestamp};function a(v,R={}){if(typeof v=="number"){if(R.relaxed||R.legacy)return v;if(Math.floor(v)===v){if(v>=n&&v<=r)return new Fr.Int32(v);if(v>=o&&v<=i)return me.Long.fromNumber(v)}return new zr.Double(v)}if(v==null||typeof v!="object")return v;if(v.$undefined)return null;let D=Object.keys(v).filter(z=>z.startsWith("$")&&v[z]!=null);for(let z=0;z<D.length;z++){let G=s[D[z]];if(G)return G.fromExtendedJSON(v,R)}if(v.$date!=null){let z=v.$date,G=new Date;return R.legacy?typeof z=="number"?G.setTime(z):typeof z=="string"&&G.setTime(Date.parse(z)):typeof z=="string"?G.setTime(Date.parse(z)):me.Long.isLong(z)?G.setTime(z.toNumber()):typeof z=="number"&&R.relaxed&&G.setTime(z),G}if(v.$code!=null){let z=Object.assign({},v);return v.$scope&&(z.$scope=a(v.$scope)),wr.Code.fromExtendedJSON(v)}if(v.$ref!=null||v.$dbPointer!=null){let z=v.$ref?v:v.$dbPointer;if(z instanceof mf.DBRef)return z;let G=Object.keys(z).filter(K=>K.startsWith("$")),fe=!0;if(G.forEach(K=>{["$ref","$id","$db"].indexOf(K)===-1&&(fe=!1)}),fe)return mf.DBRef.fromExtendedJSON(z)}return v}function p(v,R){return v.map(D=>g(D,R))}function w(v){let R=v.toISOString();return v.getUTCMilliseconds()!==0?R:R.slice(0,-5)+"Z"}function g(v,R){if(Array.isArray(v))return p(v,R);if(v===void 0)return null;if(v instanceof Date){let D=v.getTime(),z=D>-1&&D<2534023188e5;return R.legacy?R.relaxed&&z?{$date:v.getTime()}:{$date:w(v)}:R.relaxed&&z?{$date:w(v)}:{$date:{$numberLong:v.getTime().toString()}}}if(typeof v=="number"&&!R.relaxed){if(Math.floor(v)===v){let D=v>=n&&v<=r,z=v>=o&&v<=i;if(D)return{$numberInt:v.toString()};if(z)return{$numberLong:v.toString()}}return{$numberDouble:v.toString()}}if(v instanceof RegExp){let D=v.flags;if(D===void 0){let G=v.toString().match(/[gimuy]*$/);G&&(D=G[0])}return new mr.BSONRegExp(v.source,D).toExtendedJSON(R)}return v!=null&&typeof v=="object"?j(v,R):v}let m={Binary:v=>new Gt.Binary(v.value(),v.sub_type),Code:v=>new wr.Code(v.code,v.scope),DBRef:v=>new mf.DBRef(v.collection||v.namespace,v.oid,v.db,v.fields),Decimal128:v=>new dn.Decimal128(v.bytes),Double:v=>new zr.Double(v.value),Int32:v=>new Fr.Int32(v.value),Long:v=>me.Long.fromBits(v.low!=null?v.low:v.low_,v.low!=null?v.high:v.high_,v.low!=null?v.unsigned:v.unsigned_),MaxKey:()=>new hn.MaxKey,MinKey:()=>new gn.MinKey,ObjectID:v=>new Lf.ObjectId(v),ObjectId:v=>new Lf.ObjectId(v),BSONRegExp:v=>new mr.BSONRegExp(v.pattern,v.options),Symbol:v=>new jn.BSONSymbol(v.value),Timestamp:v=>ur.Timestamp.fromBits(v.low,v.high)};function j(v,R){if(v==null||typeof v!="object")throw new Error("not an object instance");let D=v._bsontype;if(typeof D=="undefined"){let z={};for(let G in v)z[G]=g(v[G],R);return z}else if(f(v)){let z=v;if(typeof z.toExtendedJSON!="function"){let G=m[v._bsontype];if(!G)throw new TypeError("Unrecognized or invalid _bsontype: "+v._bsontype);z=G(z)}return D==="Code"&&z.scope?z=new wr.Code(z.code,g(z.scope,R)):D==="DBRef"&&z.oid&&(z=new mf.DBRef(z.collection,g(z.oid,R),z.db,z.fields)),z.toExtendedJSON(R)}else throw new Error("_bsontype must be a string, but was: "+typeof D)}var B;(function(v){function R(fe,K){let O=Object.assign({},{relaxed:!0,legacy:!1},K);return typeof O.relaxed=="boolean"&&(O.strict=!O.relaxed),typeof O.strict=="boolean"&&(O.relaxed=!O.strict),JSON.parse(fe,(te,L)=>a(L,O))}v.parse=R;function D(fe,K,O,te){O!=null&&typeof O=="object"&&(te=O,O=0),K!=null&&typeof K=="object"&&!Array.isArray(K)&&(te=K,K=void 0,O=0),te=Object.assign({},{relaxed:!0,legacy:!1},te);let L=g(fe,te);return JSON.stringify(L,K,O)}v.stringify=D;function z(fe,K){return K=K||{},JSON.parse(D(fe,K))}v.serialize=z;function G(fe,K){return K=K||{},R(JSON.stringify(fe),K)}v.deserialize=G})(B=e.EJSON||(e.EJSON={}))});nt(wi);RB=wi.EJSON,PB=wi.isBSONType,mi=Ze(function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.writeIEEE754=e.readIEEE754=void 0;function f(n,i,o,s,a){let p,w,g=o==="big",m=a*8-s-1,j=(1<<m)-1,B=j>>1,v=-7,R=g?0:a-1,D=g?1:-1,z=n[i+R];for(R+=D,p=z&(1<<-v)-1,z>>=-v,v+=m;v>0;p=p*256+n[i+R],R+=D,v-=8);for(w=p&(1<<-v)-1,p>>=-v,v+=s;v>0;w=w*256+n[i+R],R+=D,v-=8);if(p===0)p=1-B;else{if(p===j)return w?NaN:(z?-1:1)*(1/0);w=w+Math.pow(2,s),p=p-B}return(z?-1:1)*w*Math.pow(2,p-s)}e.readIEEE754=f;function r(n,i,o,s,a,p){let w,g,m,j=s==="big",B=p*8-a-1,v=(1<<B)-1,R=v>>1,D=a===23?Math.pow(2,-24)-Math.pow(2,-77):0,z=j?p-1:0,G=j?-1:1,fe=i<0||i===0&&1/i<0?1:0;for(i=Math.abs(i),isNaN(i)||i===1/0?(g=isNaN(i)?1:0,w=v):(w=Math.floor(Math.log(i)/Math.LN2),i*(m=Math.pow(2,-w))<1&&(w--,m*=2),w+R>=1?i+=D/m:i+=D*Math.pow(2,1-R),i*m>=2&&(w++,m/=2),w+R>=v?(g=0,w=v):w+R>=1?(g=(i*m-1)*Math.pow(2,a),w=w+R):(g=i*Math.pow(2,R-1)*Math.pow(2,a),w=0)),isNaN(i)&&(g=0);a>=8;)n[o+z]=g&255,z+=G,g/=256,a-=8;for(w=w<<a|g,isNaN(i)&&(w+=8),B+=a;B>0;)n[o+z]=w&255,z+=G,w/=256,B-=8;n[o+z-G]|=fe*128}e.writeIEEE754=r});nt(mi);zB=mi.writeIEEE754,FB=mi.readIEEE754,Xo=Ze(function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.serializeInto=void 0;let f=/\x00/,r=new Set(["$db","$ref","$id","$clusterTime"]);function n(h){return Object.prototype.toString.call(h)==="[object RegExp]"}function i(h,d,A,c,P){h[c++]=M.BSON_DATA_STRING;let U=P?h.write(d,c,void 0,"ascii"):h.write(d,c,void 0,"utf8");c=c+U+1,h[c-1]=0;let F=h.write(A,c+4,void 0,"utf8");return h[c+3]=F+1>>24&255,h[c+2]=F+1>>16&255,h[c+1]=F+1>>8&255,h[c]=F+1&255,c=c+4+F,h[c++]=0,c}function o(h,d,A,c,P){if(Number.isInteger(A)&&A>=M.BSON_INT32_MIN&&A<=M.BSON_INT32_MAX){h[c++]=M.BSON_DATA_INT;let U=P?h.write(d,c,void 0,"ascii"):h.write(d,c,void 0,"utf8");c=c+U,h[c++]=0,h[c++]=A&255,h[c++]=A>>8&255,h[c++]=A>>16&255,h[c++]=A>>24&255}else{h[c++]=M.BSON_DATA_NUMBER;let U=P?h.write(d,c,void 0,"ascii"):h.write(d,c,void 0,"utf8");c=c+U,h[c++]=0,mi.writeIEEE754(h,A,c,"little",52,8),c=c+8}return c}function s(h,d,A,c,P){h[c++]=M.BSON_DATA_NULL;let U=P?h.write(d,c,void 0,"ascii"):h.write(d,c,void 0,"utf8");return c=c+U,h[c++]=0,c}function a(h,d,A,c,P){h[c++]=M.BSON_DATA_BOOLEAN;let U=P?h.write(d,c,void 0,"ascii"):h.write(d,c,void 0,"utf8");return c=c+U,h[c++]=0,h[c++]=A?1:0,c}function p(h,d,A,c,P){h[c++]=M.BSON_DATA_DATE;let U=P?h.write(d,c,void 0,"ascii"):h.write(d,c,void 0,"utf8");c=c+U,h[c++]=0;let F=me.Long.fromNumber(A.getTime()),Z=F.getLowBits(),I=F.getHighBits();return h[c++]=Z&255,h[c++]=Z>>8&255,h[c++]=Z>>16&255,h[c++]=Z>>24&255,h[c++]=I&255,h[c++]=I>>8&255,h[c++]=I>>16&255,h[c++]=I>>24&255,c}function w(h,d,A,c,P){h[c++]=M.BSON_DATA_REGEXP;let U=P?h.write(d,c,void 0,"ascii"):h.write(d,c,void 0,"utf8");if(c=c+U,h[c++]=0,A.source&&A.source.match(f)!=null)throw Error("value "+A.source+" must not contain null bytes");return c=c+h.write(A.source,c,void 0,"utf8"),h[c++]=0,A.ignoreCase&&(h[c++]=105),A.global&&(h[c++]=115),A.multiline&&(h[c++]=109),h[c++]=0,c}function g(h,d,A,c,P){h[c++]=M.BSON_DATA_REGEXP;let U=P?h.write(d,c,void 0,"ascii"):h.write(d,c,void 0,"utf8");if(c=c+U,h[c++]=0,A.pattern.match(f)!=null)throw Error("pattern "+A.pattern+" must not contain null bytes");return c=c+h.write(A.pattern,c,void 0,"utf8"),h[c++]=0,c=c+h.write(A.options.split("").sort().join(""),c,void 0,"utf8"),h[c++]=0,c}function m(h,d,A,c,P){A===null?h[c++]=M.BSON_DATA_NULL:A._bsontype==="MinKey"?h[c++]=M.BSON_DATA_MIN_KEY:h[c++]=M.BSON_DATA_MAX_KEY;let U=P?h.write(d,c,void 0,"ascii"):h.write(d,c,void 0,"utf8");return c=c+U,h[c++]=0,c}function j(h,d,A,c,P){h[c++]=M.BSON_DATA_OID;let U=P?h.write(d,c,void 0,"ascii"):h.write(d,c,void 0,"utf8");if(c=c+U,h[c++]=0,typeof A.id=="string")h.write(A.id,c,void 0,"binary");else if(A.id&&A.id.copy)A.id.copy(h,c,0,12);else throw new TypeError("object ["+JSON.stringify(A)+"] is not a valid ObjectId");return c+12}function B(h,d,A,c,P){h[c++]=M.BSON_DATA_BINARY;let U=P?h.write(d,c,void 0,"ascii"):h.write(d,c,void 0,"utf8");c=c+U,h[c++]=0;let F=A.length;return h[c++]=F&255,h[c++]=F>>8&255,h[c++]=F>>16&255,h[c++]=F>>24&255,h[c++]=M.BSON_BINARY_SUBTYPE_DEFAULT,h.set(pr.ensureBuffer(A),c),c=c+F,c}function v(h,d,A,c,P=!1,U=0,F=!1,Z=!0,I=!1,ke=[]){for(let W=0;W<ke.length;W++)if(ke[W]===A)throw new Error("cyclic dependency detected");ke.push(A),h[c++]=Array.isArray(A)?M.BSON_DATA_ARRAY:M.BSON_DATA_OBJECT;let ne=I?h.write(d,c,void 0,"ascii"):h.write(d,c,void 0,"utf8");c=c+ne,h[c++]=0;let C=re(h,A,P,c,U+1,F,Z,ke);return ke.pop(),C}function R(h,d,A,c,P){h[c++]=M.BSON_DATA_DECIMAL128;let U=P?h.write(d,c,void 0,"ascii"):h.write(d,c,void 0,"utf8");return c=c+U,h[c++]=0,A.bytes.copy(h,c,0,16),c+16}function D(h,d,A,c,P){h[c++]=A._bsontype==="Long"?M.BSON_DATA_LONG:M.BSON_DATA_TIMESTAMP;let U=P?h.write(d,c,void 0,"ascii"):h.write(d,c,void 0,"utf8");c=c+U,h[c++]=0;let F=A.getLowBits(),Z=A.getHighBits();return h[c++]=F&255,h[c++]=F>>8&255,h[c++]=F>>16&255,h[c++]=F>>24&255,h[c++]=Z&255,h[c++]=Z>>8&255,h[c++]=Z>>16&255,h[c++]=Z>>24&255,c}function z(h,d,A,c,P){A=A.valueOf(),h[c++]=M.BSON_DATA_INT;let U=P?h.write(d,c,void 0,"ascii"):h.write(d,c,void 0,"utf8");return c=c+U,h[c++]=0,h[c++]=A&255,h[c++]=A>>8&255,h[c++]=A>>16&255,h[c++]=A>>24&255,c}function G(h,d,A,c,P){h[c++]=M.BSON_DATA_NUMBER;let U=P?h.write(d,c,void 0,"ascii"):h.write(d,c,void 0,"utf8");return c=c+U,h[c++]=0,mi.writeIEEE754(h,A.value,c,"little",52,8),c=c+8,c}function fe(h,d,A,c,P=!1,U=0,F){h[c++]=M.BSON_DATA_CODE;let Z=F?h.write(d,c,void 0,"ascii"):h.write(d,c,void 0,"utf8");c=c+Z,h[c++]=0;let I=Ce.normalizedFunctionString(A),ke=h.write(I,c+4,void 0,"utf8")+1;return h[c]=ke&255,h[c+1]=ke>>8&255,h[c+2]=ke>>16&255,h[c+3]=ke>>24&255,c=c+4+ke-1,h[c++]=0,c}function K(h,d,A,c,P=!1,U=0,F=!1,Z=!0,I=!1){if(A.scope&&typeof A.scope=="object"){h[c++]=M.BSON_DATA_CODE_W_SCOPE;let ke=I?h.write(d,c,void 0,"ascii"):h.write(d,c,void 0,"utf8");c=c+ke,h[c++]=0;let ne=c,C=typeof A.code=="string"?A.code:A.code.toString();c=c+4;let W=h.write(C,c+4,void 0,"utf8")+1;h[c]=W&255,h[c+1]=W>>8&255,h[c+2]=W>>16&255,h[c+3]=W>>24&255,h[c+4+W-1]=0,c=c+W+4;let ve=re(h,A.scope,P,c,U+1,F,Z);c=ve-1;let oe=ve-ne;h[ne++]=oe&255,h[ne++]=oe>>8&255,h[ne++]=oe>>16&255,h[ne++]=oe>>24&255,h[c++]=0}else{h[c++]=M.BSON_DATA_CODE;let ke=I?h.write(d,c,void 0,"ascii"):h.write(d,c,void 0,"utf8");c=c+ke,h[c++]=0;let ne=A.code.toString(),C=h.write(ne,c+4,void 0,"utf8")+1;h[c]=C&255,h[c+1]=C>>8&255,h[c+2]=C>>16&255,h[c+3]=C>>24&255,c=c+4+C-1,h[c++]=0}return c}function O(h,d,A,c,P){h[c++]=M.BSON_DATA_BINARY;let U=P?h.write(d,c,void 0,"ascii"):h.write(d,c,void 0,"utf8");c=c+U,h[c++]=0;let F=A.value(!0),Z=A.position;return A.sub_type===Gt.Binary.SUBTYPE_BYTE_ARRAY&&(Z=Z+4),h[c++]=Z&255,h[c++]=Z>>8&255,h[c++]=Z>>16&255,h[c++]=Z>>24&255,h[c++]=A.sub_type,A.sub_type===Gt.Binary.SUBTYPE_BYTE_ARRAY&&(Z=Z-4,h[c++]=Z&255,h[c++]=Z>>8&255,h[c++]=Z>>16&255,h[c++]=Z>>24&255),h.set(F,c),c=c+A.position,c}function te(h,d,A,c,P){h[c++]=M.BSON_DATA_SYMBOL;let U=P?h.write(d,c,void 0,"ascii"):h.write(d,c,void 0,"utf8");c=c+U,h[c++]=0;let F=h.write(A.value,c+4,void 0,"utf8")+1;return h[c]=F&255,h[c+1]=F>>8&255,h[c+2]=F>>16&255,h[c+3]=F>>24&255,c=c+4+F-1,h[c++]=0,c}function L(h,d,A,c,P,U,F){h[c++]=M.BSON_DATA_OBJECT;let Z=F?h.write(d,c,void 0,"ascii"):h.write(d,c,void 0,"utf8");c=c+Z,h[c++]=0;let I=c,ke={$ref:A.collection||A.namespace,$id:A.oid};A.db!=null&&(ke.$db=A.db),ke=Object.assign(ke,A.fields);let ne=re(h,ke,!1,c,P+1,U),C=ne-I;return h[I++]=C&255,h[I++]=C>>8&255,h[I++]=C>>16&255,h[I++]=C>>24&255,ne}function re(h,d,A=!1,c=0,P=0,U=!1,F=!0,Z=[]){c=c||0,Z=Z||[],Z.push(d);let I=c+4;if(Array.isArray(d))for(let ne=0;ne<d.length;ne++){let C=""+ne,W=d[ne];if(W&&W.toBSON){if(typeof W.toBSON!="function")throw new TypeError("toBSON is not a function");W=W.toBSON()}if(typeof W=="string")I=i(h,C,W,I,!0);else if(typeof W=="number")I=o(h,C,W,I,!0);else{if(typeof W=="bigint")throw new TypeError("Unsupported type BigInt, please use Decimal128");if(typeof W=="boolean")I=a(h,C,W,I,!0);else if(W instanceof Date||Ce.isDate(W))I=p(h,C,W,I,!0);else if(W===void 0)I=s(h,C,W,I,!0);else if(W===null)I=s(h,C,W,I,!0);else if(W._bsontype==="ObjectId"||W._bsontype==="ObjectID")I=j(h,C,W,I,!0);else if(se.Buffer.isBuffer(W)||Ce.isUint8Array(W))I=B(h,C,W,I,!0);else if(W instanceof RegExp||n(W))I=w(h,C,W,I,!0);else if(typeof W=="object"&&W._bsontype==null)I=v(h,C,W,I,A,P,U,F,!0,Z);else if(typeof W=="object"&&wi.isBSONType(W)&&W._bsontype==="Decimal128")I=R(h,C,W,I,!0);else if(W._bsontype==="Long"||W._bsontype==="Timestamp")I=D(h,C,W,I,!0);else if(W._bsontype==="Double")I=G(h,C,W,I,!0);else if(typeof W=="function"&&U)I=fe(h,C,W,I,A,P,!0);else if(W._bsontype==="Code")I=K(h,C,W,I,A,P,U,F,!0);else if(W._bsontype==="Binary")I=O(h,C,W,I,!0);else if(W._bsontype==="Symbol")I=te(h,C,W,I,!0);else if(W._bsontype==="DBRef")I=L(h,C,W,I,P,U,!0);else if(W._bsontype==="BSONRegExp")I=g(h,C,W,I,!0);else if(W._bsontype==="Int32")I=z(h,C,W,I,!0);else if(W._bsontype==="MinKey"||W._bsontype==="MaxKey")I=m(h,C,W,I,!0);else if(typeof W._bsontype!="undefined")throw new TypeError("Unrecognized or invalid _bsontype: "+W._bsontype)}}else if(d instanceof Go.Map){let ne=d.entries(),C=!1;for(;!C;){let W=ne.next();if(C=!!W.done,C)continue;let ve=W.value[0],oe=W.value[1],xe=typeof oe;if(typeof ve=="string"&&!r.has(ve)){if(ve.match(f)!=null)throw Error("key "+ve+" must not contain null bytes");if(A){if(ve[0]==="$")throw Error("key "+ve+" must not start with '$'");if(~ve.indexOf("."))throw Error("key "+ve+" must not contain '.'")}}if(xe==="string")I=i(h,ve,oe,I);else if(xe==="number")I=o(h,ve,oe,I);else{if(xe==="bigint"||Ce.isBigInt64Array(oe)||Ce.isBigUInt64Array(oe))throw new TypeError("Unsupported type BigInt, please use Decimal128");if(xe==="boolean")I=a(h,ve,oe,I);else if(oe instanceof Date||Ce.isDate(oe))I=p(h,ve,oe,I);else if(oe===null||oe===void 0&&F===!1)I=s(h,ve,oe,I);else if(oe._bsontype==="ObjectId"||oe._bsontype==="ObjectID")I=j(h,ve,oe,I);else if(se.Buffer.isBuffer(oe)||Ce.isUint8Array(oe))I=B(h,ve,oe,I);else if(oe instanceof RegExp||n(oe))I=w(h,ve,oe,I);else if(xe==="object"&&oe._bsontype==null)I=v(h,ve,oe,I,A,P,U,F,!1,Z);else if(xe==="object"&&oe._bsontype==="Decimal128")I=R(h,ve,oe,I);else if(oe._bsontype==="Long"||oe._bsontype==="Timestamp")I=D(h,ve,oe,I);else if(oe._bsontype==="Double")I=G(h,ve,oe,I);else if(oe._bsontype==="Code")I=K(h,ve,oe,I,A,P,U,F);else if(typeof oe=="function"&&U)I=fe(h,ve,oe,I,A,P,U);else if(oe._bsontype==="Binary")I=O(h,ve,oe,I);else if(oe._bsontype==="Symbol")I=te(h,ve,oe,I);else if(oe._bsontype==="DBRef")I=L(h,ve,oe,I,P,U);else if(oe._bsontype==="BSONRegExp")I=g(h,ve,oe,I);else if(oe._bsontype==="Int32")I=z(h,ve,oe,I);else if(oe._bsontype==="MinKey"||oe._bsontype==="MaxKey")I=m(h,ve,oe,I);else if(typeof oe._bsontype!="undefined")throw new TypeError("Unrecognized or invalid _bsontype: "+oe._bsontype)}}}else{if(d.toBSON){if(typeof d.toBSON!="function")throw new TypeError("toBSON is not a function");if(d=d.toBSON(),d!=null&&typeof d!="object")throw new TypeError("toBSON function did not return an object")}for(let ne in d){let C=d[ne];if(C&&C.toBSON){if(typeof C.toBSON!="function")throw new TypeError("toBSON is not a function");C=C.toBSON()}let W=typeof C;if(typeof ne=="string"&&!r.has(ne)){if(ne.match(f)!=null)throw Error("key "+ne+" must not contain null bytes");if(A){if(ne[0]==="$")throw Error("key "+ne+" must not start with '$'");if(~ne.indexOf("."))throw Error("key "+ne+" must not contain '.'")}}if(W==="string")I=i(h,ne,C,I);else if(W==="number")I=o(h,ne,C,I);else{if(W==="bigint")throw new TypeError("Unsupported type BigInt, please use Decimal128");if(W==="boolean")I=a(h,ne,C,I);else if(C instanceof Date||Ce.isDate(C))I=p(h,ne,C,I);else if(C===void 0)F===!1&&(I=s(h,ne,C,I));else if(C===null)I=s(h,ne,C,I);else if(C._bsontype==="ObjectId"||C._bsontype==="ObjectID")I=j(h,ne,C,I);else if(se.Buffer.isBuffer(C)||Ce.isUint8Array(C))I=B(h,ne,C,I);else if(C instanceof RegExp||n(C))I=w(h,ne,C,I);else if(W==="object"&&C._bsontype==null)I=v(h,ne,C,I,A,P,U,F,!1,Z);else if(W==="object"&&C._bsontype==="Decimal128")I=R(h,ne,C,I);else if(C._bsontype==="Long"||C._bsontype==="Timestamp")I=D(h,ne,C,I);else if(C._bsontype==="Double")I=G(h,ne,C,I);else if(C._bsontype==="Code")I=K(h,ne,C,I,A,P,U,F);else if(typeof C=="function"&&U)I=fe(h,ne,C,I,A,P,U);else if(C._bsontype==="Binary")I=O(h,ne,C,I);else if(C._bsontype==="Symbol")I=te(h,ne,C,I);else if(C._bsontype==="DBRef")I=L(h,ne,C,I,P,U);else if(C._bsontype==="BSONRegExp")I=g(h,ne,C,I);else if(C._bsontype==="Int32")I=z(h,ne,C,I);else if(C._bsontype==="MinKey"||C._bsontype==="MaxKey")I=m(h,ne,C,I);else if(typeof C._bsontype!="undefined")throw new TypeError("Unrecognized or invalid _bsontype: "+C._bsontype)}}}Z.pop(),h[I++]=0;let ke=I-c;return h[c++]=ke&255,h[c++]=ke>>8&255,h[c++]=ke>>16&255,h[c++]=ke>>24&255,I}e.serializeInto=re});nt(Xo);DB=Xo.serializeInto,ue=Ze(function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.deserializeStream=e.calculateObjectSize=e.deserialize=e.serializeWithBufferAndIndex=e.serialize=e.setInternalBufferSize=e.ObjectID=e.Decimal128=e.BSONRegExp=e.MaxKey=e.MinKey=e.Int32=e.Double=e.Timestamp=e.Long=e.ObjectId=e.Binary=e.DBRef=e.BSONSymbol=e.Map=e.Code=e.LongWithoutOverridesClass=e.EJSON=e.JS_INT_MIN=e.JS_INT_MAX=e.BSON_INT64_MIN=e.BSON_INT64_MAX=e.BSON_INT32_MIN=e.BSON_INT32_MAX=e.BSON_DATA_UNDEFINED=e.BSON_DATA_TIMESTAMP=e.BSON_DATA_SYMBOL=e.BSON_DATA_STRING=e.BSON_DATA_REGEXP=e.BSON_DATA_OID=e.BSON_DATA_OBJECT=e.BSON_DATA_NUMBER=e.BSON_DATA_NULL=e.BSON_DATA_MIN_KEY=e.BSON_DATA_MAX_KEY=e.BSON_DATA_LONG=e.BSON_DATA_INT=e.BSON_DATA_DECIMAL128=e.BSON_DATA_DBPOINTER=e.BSON_DATA_DATE=e.BSON_DATA_CODE_W_SCOPE=e.BSON_DATA_CODE=e.BSON_DATA_BOOLEAN=e.BSON_DATA_BINARY=e.BSON_DATA_ARRAY=e.BSON_BINARY_SUBTYPE_UUID_NEW=e.BSON_BINARY_SUBTYPE_UUID=e.BSON_BINARY_SUBTYPE_USER_DEFINED=e.BSON_BINARY_SUBTYPE_MD5=e.BSON_BINARY_SUBTYPE_FUNCTION=e.BSON_BINARY_SUBTYPE_DEFAULT=e.BSON_BINARY_SUBTYPE_BYTE_ARRAY=void 0,Object.defineProperty(e,"Binary",{enumerable:!0,get:function(){return Gt.Binary}}),Object.defineProperty(e,"Code",{enumerable:!0,get:function(){return wr.Code}}),Object.defineProperty(e,"DBRef",{enumerable:!0,get:function(){return mf.DBRef}}),Object.defineProperty(e,"Decimal128",{enumerable:!0,get:function(){return dn.Decimal128}}),Object.defineProperty(e,"Double",{enumerable:!0,get:function(){return zr.Double}}),Object.defineProperty(e,"Int32",{enumerable:!0,get:function(){return Fr.Int32}}),Object.defineProperty(e,"Long",{enumerable:!0,get:function(){return me.Long}}),Object.defineProperty(e,"Map",{enumerable:!0,get:function(){return Go.Map}}),Object.defineProperty(e,"MaxKey",{enumerable:!0,get:function(){return hn.MaxKey}}),Object.defineProperty(e,"MinKey",{enumerable:!0,get:function(){return gn.MinKey}}),Object.defineProperty(e,"ObjectId",{enumerable:!0,get:function(){return Lf.ObjectId}}),Object.defineProperty(e,"ObjectID",{enumerable:!0,get:function(){return Lf.ObjectId}}),Object.defineProperty(e,"BSONRegExp",{enumerable:!0,get:function(){return mr.BSONRegExp}}),Object.defineProperty(e,"BSONSymbol",{enumerable:!0,get:function(){return jn.BSONSymbol}}),Object.defineProperty(e,"Timestamp",{enumerable:!0,get:function(){return ur.Timestamp}}),Object.defineProperty(e,"BSON_BINARY_SUBTYPE_BYTE_ARRAY",{enumerable:!0,get:function(){return M.BSON_BINARY_SUBTYPE_BYTE_ARRAY}}),Object.defineProperty(e,"BSON_BINARY_SUBTYPE_DEFAULT",{enumerable:!0,get:function(){return M.BSON_BINARY_SUBTYPE_DEFAULT}}),Object.defineProperty(e,"BSON_BINARY_SUBTYPE_FUNCTION",{enumerable:!0,get:function(){return M.BSON_BINARY_SUBTYPE_FUNCTION}}),Object.defineProperty(e,"BSON_BINARY_SUBTYPE_MD5",{enumerable:!0,get:function(){return M.BSON_BINARY_SUBTYPE_MD5}}),Object.defineProperty(e,"BSON_BINARY_SUBTYPE_USER_DEFINED",{enumerable:!0,get:function(){return M.BSON_BINARY_SUBTYPE_USER_DEFINED}}),Object.defineProperty(e,"BSON_BINARY_SUBTYPE_UUID",{enumerable:!0,get:function(){return M.BSON_BINARY_SUBTYPE_UUID}}),Object.defineProperty(e,"BSON_BINARY_SUBTYPE_UUID_NEW",{enumerable:!0,get:function(){return M.BSON_BINARY_SUBTYPE_UUID_NEW}}),Object.defineProperty(e,"BSON_DATA_ARRAY",{enumerable:!0,get:function(){return M.BSON_DATA_ARRAY}}),Object.defineProperty(e,"BSON_DATA_BINARY",{enumerable:!0,get:function(){return M.BSON_DATA_BINARY}}),Object.defineProperty(e,"BSON_DATA_BOOLEAN",{enumerable:!0,get:function(){return M.BSON_DATA_BOOLEAN}}),Object.defineProperty(e,"BSON_DATA_CODE",{enumerable:!0,get:function(){return M.BSON_DATA_CODE}}),Object.defineProperty(e,"BSON_DATA_CODE_W_SCOPE",{enumerable:!0,get:function(){return M.BSON_DATA_CODE_W_SCOPE}}),Object.defineProperty(e,"BSON_DATA_DATE",{enumerable:!0,get:function(){return M.BSON_DATA_DATE}}),Object.defineProperty(e,"BSON_DATA_DBPOINTER",{enumerable:!0,get:function(){return M.BSON_DATA_DBPOINTER}}),Object.defineProperty(e,"BSON_DATA_DECIMAL128",{enumerable:!0,get:function(){return M.BSON_DATA_DECIMAL128}}),Object.defineProperty(e,"BSON_DATA_INT",{enumerable:!0,get:function(){return M.BSON_DATA_INT}}),Object.defineProperty(e,"BSON_DATA_LONG",{enumerable:!0,get:function(){return M.BSON_DATA_LONG}}),Object.defineProperty(e,"BSON_DATA_MAX_KEY",{enumerable:!0,get:function(){return M.BSON_DATA_MAX_KEY}}),Object.defineProperty(e,"BSON_DATA_MIN_KEY",{enumerable:!0,get:function(){return M.BSON_DATA_MIN_KEY}}),Object.defineProperty(e,"BSON_DATA_NULL",{enumerable:!0,get:function(){return M.BSON_DATA_NULL}}),Object.defineProperty(e,"BSON_DATA_NUMBER",{enumerable:!0,get:function(){return M.BSON_DATA_NUMBER}}),Object.defineProperty(e,"BSON_DATA_OBJECT",{enumerable:!0,get:function(){return M.BSON_DATA_OBJECT}}),Object.defineProperty(e,"BSON_DATA_OID",{enumerable:!0,get:function(){return M.BSON_DATA_OID}}),Object.defineProperty(e,"BSON_DATA_REGEXP",{enumerable:!0,get:function(){return M.BSON_DATA_REGEXP}}),Object.defineProperty(e,"BSON_DATA_STRING",{enumerable:!0,get:function(){return M.BSON_DATA_STRING}}),Object.defineProperty(e,"BSON_DATA_SYMBOL",{enumerable:!0,get:function(){return M.BSON_DATA_SYMBOL}}),Object.defineProperty(e,"BSON_DATA_TIMESTAMP",{enumerable:!0,get:function(){return M.BSON_DATA_TIMESTAMP}}),Object.defineProperty(e,"BSON_DATA_UNDEFINED",{enumerable:!0,get:function(){return M.BSON_DATA_UNDEFINED}}),Object.defineProperty(e,"BSON_INT32_MAX",{enumerable:!0,get:function(){return M.BSON_INT32_MAX}}),Object.defineProperty(e,"BSON_INT32_MIN",{enumerable:!0,get:function(){return M.BSON_INT32_MIN}}),Object.defineProperty(e,"BSON_INT64_MAX",{enumerable:!0,get:function(){return M.BSON_INT64_MAX}}),Object.defineProperty(e,"BSON_INT64_MIN",{enumerable:!0,get:function(){return M.BSON_INT64_MIN}}),Object.defineProperty(e,"JS_INT_MAX",{enumerable:!0,get:function(){return M.JS_INT_MAX}}),Object.defineProperty(e,"JS_INT_MIN",{enumerable:!0,get:function(){return M.JS_INT_MIN}}),Object.defineProperty(e,"EJSON",{enumerable:!0,get:function(){return wi.EJSON}});var f=ur;Object.defineProperty(e,"LongWithoutOverridesClass",{enumerable:!0,get:function(){return f.LongWithoutOverridesClass}});let r=1024*1024*17,n=se.Buffer.alloc(r);function i(g){n.length<g&&(n=se.Buffer.alloc(g))}e.setInternalBufferSize=i;function o(g,m={}){let j=typeof m.checkKeys=="boolean"?m.checkKeys:!1,B=typeof m.serializeFunctions=="boolean"?m.serializeFunctions:!1,v=typeof m.ignoreUndefined=="boolean"?m.ignoreUndefined:!0,R=typeof m.minInternalBufferSize=="number"?m.minInternalBufferSize:r;n.length<R&&(n=se.Buffer.alloc(R));let D=Xo.serializeInto(n,g,j,0,0,B,v,[]),z=se.Buffer.alloc(D);return n.copy(z,0,0,z.length),z}e.serialize=o;function s(g,m,j={}){let B=typeof j.checkKeys=="boolean"?j.checkKeys:!1,v=typeof j.serializeFunctions=="boolean"?j.serializeFunctions:!1,R=typeof j.ignoreUndefined=="boolean"?j.ignoreUndefined:!0,D=typeof j.index=="number"?j.index:0,z=Xo.serializeInto(n,g,B,0,0,v,R);return n.copy(m,D,0,z),D+z-1}e.serializeWithBufferAndIndex=s;function a(g,m={}){return Qo.deserialize(pr.ensureBuffer(g),m)}e.deserialize=a;function p(g,m={}){m=m||{};let j=typeof m.serializeFunctions=="boolean"?m.serializeFunctions:!1,B=typeof m.ignoreUndefined=="boolean"?m.ignoreUndefined:!0;return Zs.calculateObjectSize(g,j,B)}e.calculateObjectSize=p;function w(g,m,j,B,v,R){let D=Object.assign({allowObjectSmallerThanBufferSize:!0,index:0},R),z=pr.ensureBuffer(g),G=m;for(let fe=0;fe<j;fe++){let K=z[G]|z[G+1]<<8|z[G+2]<<16|z[G+3]<<24;D.index=G,B[v+fe]=Qo.deserialize(z,D),G=G+K}return G}e.deserializeStream=w}),CB=nt(ue),LB=ue.deserializeStream,UB=ue.calculateObjectSize,qb=ue.deserialize,MB=ue.serializeWithBufferAndIndex,yb=ue.serialize,KB=ue.setInternalBufferSize,WB=ue.ObjectID,YB=ue.Decimal128,VB=ue.BSONRegExp,GB=ue.MaxKey,JB=ue.MinKey,QB=ue.Int32,XB=ue.Double,ZB=ue.Timestamp,$B=ue.Long,ex=ue.ObjectId,tx=ue.Binary,fx=ue.DBRef,rx=ue.BSONSymbol,nx=ue.Map,ix=ue.Code,ox=ue.LongWithoutOverridesClass,lx=ue.EJSON,sx=ue.JS_INT_MIN,ax=ue.JS_INT_MAX,px=ue.BSON_INT64_MIN,wx=ue.BSON_INT64_MAX,mx=ue.BSON_INT32_MIN,ux=ue.BSON_INT32_MAX,bx=ue.BSON_DATA_UNDEFINED,cx=ue.BSON_DATA_TIMESTAMP,dx=ue.BSON_DATA_SYMBOL,hx=ue.BSON_DATA_STRING,gx=ue.BSON_DATA_REGEXP,jx=ue.BSON_DATA_OID,qx=ue.BSON_DATA_OBJECT,yx=ue.BSON_DATA_NUMBER,vx=ue.BSON_DATA_NULL,kx=ue.BSON_DATA_MIN_KEY,Tx=ue.BSON_DATA_MAX_KEY,_x=ue.BSON_DATA_LONG,Bx=ue.BSON_DATA_INT,xx=ue.BSON_DATA_DECIMAL128,Ex=ue.BSON_DATA_DBPOINTER,Ix=ue.BSON_DATA_DATE,Sx=ue.BSON_DATA_CODE_W_SCOPE,Ax=ue.BSON_DATA_CODE,Ox=ue.BSON_DATA_BOOLEAN,Hx=ue.BSON_DATA_BINARY,Nx=ue.BSON_DATA_ARRAY,Rx=ue.BSON_BINARY_SUBTYPE_UUID_NEW,Px=ue.BSON_BINARY_SUBTYPE_UUID,zx=ue.BSON_BINARY_SUBTYPE_USER_DEFINED,Fx=ue.BSON_BINARY_SUBTYPE_MD5,Dx=ue.BSON_BINARY_SUBTYPE_FUNCTION,Cx=ue.BSON_BINARY_SUBTYPE_DEFAULT,Lx=ue.BSON_BINARY_SUBTYPE_BYTE_ARRAY});function ea(t,e){return qb(new Uint8Array(t),e)}var vb=J(()=>{$s()});async function Uq(t,e){let f={...ui.options.bson,...e==null?void 0:e.bson};return ea(t,f)}function Mq(t,e){let f={...ui.options.bson,...e==null?void 0:e.bson};return ea(t,f)}var Lq,ui,kb=J(()=>{vb();Lq="4.0.0-beta.1",ui={name:"BSON",id:"bson",module:"bson",version:Lq,extensions:["bson"],mimeTypes:["application/bson"],category:"json",binary:!0,parse:Uq,parseSync:Mq,options:{bson:{}}}});function ta(t,e){return yb(t).buffer}var Tb=J(()=>{$s()});var Kq,fa,_b=J(()=>{Tb();Kq="4.0.0-beta.1",fa={name:"BSON",id:"bson",module:"bson",version:Kq,extensions:["bson"],options:{bson:{}},async encode(t,e){return ta(t,{})},encodeSync(t,e){return ta(t,{})}}});var Bb=J(()=>{kb();_b()});function xb(t,e,f){if(!(t in Dr))throw new Error(`invalid type: ${t}`);return Dr[t].toPrimitive(e,f)}function ra(t,e,f){if(!(t in Dr))throw new Error(`invalid type: ${t}`);return"fromPrimitive"in Dr[t]?Dr[t].fromPrimitive?.(e,f):e}function Wq(t){return Boolean(t)}function Yq(t){return Boolean(t)}function Vq(t){let e=parseFloat(t);if(isNaN(e))throw new Error(`invalid value for FLOAT: ${t}`);return e}function Gq(t){let e=parseFloat(t);if(isNaN(e))throw new Error(`invalid value for DOUBLE: ${t}`);return e}function Jq(t){let e=parseInt(t,10);if(e<-128||e>127||isNaN(e))throw new Error(`invalid value for INT8: ${t}`);return e}function Qq(t){let e=parseInt(t,10);if(e<0||e>255||isNaN(e))throw new Error(`invalid value for UINT8: ${t}`);return e}function Xq(t){let e=parseInt(t,10);if(e<-32768||e>32767||isNaN(e))throw new Error(`invalid value for INT16: ${t}`);return e}function Zq(t){let e=parseInt(t,10);if(e<0||e>65535||isNaN(e))throw new Error(`invalid value for UINT16: ${t}`);return e}function Eb(t){let e=parseInt(t,10);if(e<-2147483648||e>2147483647||isNaN(e))throw new Error(`invalid value for INT32: ${t}`);return e}function $q(t,e){let f=t*10**(e.scale||0),r=Math.round(f*10**-e.presision%1*10**e.presision);if(r<-2147483648||r>2147483647||isNaN(r))throw new Error(`invalid value for INT32: ${t}`);return r}function ey(t){let e=parseInt(t,10);if(e<0||e>281474976710655||isNaN(e))throw new Error(`invalid value for UINT32: ${t}`);return e}function Ib(t){let e=parseInt(t,10);if(isNaN(e))throw new Error(`invalid value for INT64: ${t}`);return e}function ty(t,e){let f=t*10**(e.scale||0),r=Math.round(f*10**-e.presision%1*10**e.presision);if(isNaN(r))throw new Error(`invalid value for INT64: ${t}`);return r}function fy(t){let e=parseInt(t,10);if(e<0||isNaN(e))throw new Error(`invalid value for UINT64: ${t}`);return e}function ry(t){let e=parseInt(t,10);if(isNaN(e))throw new Error(`invalid value for INT96: ${t}`);return e}function Sb(t){return Buffer.from(t)}function Ab(t){return Buffer.from(t)}function ny(t){return Buffer.from(t,"utf8")}function iy(t){return t.toString()}function oy(t){return Buffer.from(JSON.stringify(t))}function ly(t){return JSON.parse(t)}function sy(t){let e=fa.encodeSync?.(t);return Buffer.from(e)}function ay(t){return ui.parseSync?.(t)}function py(t){let e=parseInt(t,10);if(e<0||e>18446744073709552e3||isNaN(e))throw new Error(`invalid value for TIME_MILLIS: ${t}`);return e}function wy(t){let e=parseInt(t,10);if(e<0||isNaN(e))throw new Error(`invalid value for TIME_MICROS: ${t}`);return e}function my(t){if(t instanceof Date)return t.getTime()/Ob;{let e=parseInt(t,10);if(e<0||isNaN(e))throw new Error(`invalid value for DATE: ${t}`);return e}}function uy(t){return new Date(t*Ob)}function by(t){if(t instanceof Date)return t.getTime();{let e=parseInt(t,10);if(e<0||isNaN(e))throw new Error(`invalid value for TIMESTAMP_MILLIS: ${t}`);return e}}function cy(t){return new Date(t)}function dy(t){if(t instanceof Date)return t.getTime()*1e3;{let e=parseInt(t,10);if(e<0||isNaN(e))throw new Error(`invalid value for TIMESTAMP_MICROS: ${t}`);return e}}function hy(t){return new Date(t/1e3)}function gy(t){if(!t.months||!t.days||!t.milliseconds)throw new Error("value for INTERVAL must be object { months: ..., days: ..., milliseconds: ... }");let e=Buffer.alloc(12);return e.writeUInt32LE(t.months,0),e.writeUInt32LE(t.days,4),e.writeUInt32LE(t.milliseconds,8),e}function jy(t){let e=Buffer.from(t),f=e.readUInt32LE(0),r=e.readUInt32LE(4),n=e.readUInt32LE(8);return{months:f,days:r,milliseconds:n}}function Hb(t,e){return Math.round(t*10**-e.presision%1*10**e.presision)*10**-(e.scale||0)}function Nb(t,e){let f=0;if(t.length<=4)for(let n=0;n<t.length;n++)f+=t[n]<<8*(t.length-n-1);else for(let n=0;n<t.length;n++)f+=t[n]*2**(8*(t.length-1-n));return Math.round(f*10**-e.presision%1*10**e.presision)*10**-(e.scale||0)}var Dr,Ob,na=J(()=>{Bb();Dr={BOOLEAN:{primitiveType:"BOOLEAN",toPrimitive:Wq,fromPrimitive:Yq},INT32:{primitiveType:"INT32",toPrimitive:Eb},INT64:{primitiveType:"INT64",toPrimitive:Ib},INT96:{primitiveType:"INT96",toPrimitive:ry},FLOAT:{primitiveType:"FLOAT",toPrimitive:Vq},DOUBLE:{primitiveType:"DOUBLE",toPrimitive:Gq},BYTE_ARRAY:{primitiveType:"BYTE_ARRAY",toPrimitive:Sb},FIXED_LEN_BYTE_ARRAY:{primitiveType:"FIXED_LEN_BYTE_ARRAY",toPrimitive:Sb},UTF8:{primitiveType:"BYTE_ARRAY",originalType:"UTF8",toPrimitive:ny,fromPrimitive:iy},TIME_MILLIS:{primitiveType:"INT32",originalType:"TIME_MILLIS",toPrimitive:py},TIME_MICROS:{primitiveType:"INT64",originalType:"TIME_MICROS",toPrimitive:wy},DATE:{primitiveType:"INT32",originalType:"DATE",toPrimitive:my,fromPrimitive:uy},TIMESTAMP_MILLIS:{primitiveType:"INT64",originalType:"TIMESTAMP_MILLIS",toPrimitive:by,fromPrimitive:cy},TIMESTAMP_MICROS:{primitiveType:"INT64",originalType:"TIMESTAMP_MICROS",toPrimitive:dy,fromPrimitive:hy},UINT_8:{primitiveType:"INT32",originalType:"UINT_8",toPrimitive:Qq},UINT_16:{primitiveType:"INT32",originalType:"UINT_16",toPrimitive:Zq},UINT_32:{primitiveType:"INT32",originalType:"UINT_32",toPrimitive:ey},UINT_64:{primitiveType:"INT64",originalType:"UINT_64",toPrimitive:fy},INT_8:{primitiveType:"INT32",originalType:"INT_8",toPrimitive:Jq},INT_16:{primitiveType:"INT32",originalType:"INT_16",toPrimitive:Xq},INT_32:{primitiveType:"INT32",originalType:"INT_32",toPrimitive:Eb},INT_64:{primitiveType:"INT64",originalType:"INT_64",toPrimitive:Ib},JSON:{primitiveType:"BYTE_ARRAY",originalType:"JSON",toPrimitive:oy,fromPrimitive:ly},BSON:{primitiveType:"BYTE_ARRAY",originalType:"BSON",toPrimitive:sy,fromPrimitive:ay},INTERVAL:{primitiveType:"FIXED_LEN_BYTE_ARRAY",originalType:"INTERVAL",typeLength:12,toPrimitive:gy,fromPrimitive:jy},DECIMAL_INT32:{primitiveType:"INT32",originalType:"DECIMAL_INT32",toPrimitive:$q,fromPrimitive:Hb},DECIMAL_INT64:{primitiveType:"INT64",originalType:"DECIMAL_INT64",toPrimitive:ty,fromPrimitive:Hb},DECIMAL_BYTE_ARRAY:{primitiveType:"BYTE_ARRAY",originalType:"DECIMAL_BYTE_ARRAY",toPrimitive:Ab,fromPrimitive:Nb},DECIMAL_FIXED_LEN_BYTE_ARRAY:{primitiveType:"FIXED_LEN_BYTE_ARRAY",originalType:"DECIMAL_FIXED_LEN_BYTE_ARRAY",toPrimitive:Ab,fromPrimitive:Nb}};Ob=864e5});function ia(t){let e={};for(let f of t.fieldList)e[f.key]={dlevels:[],rlevels:[],values:[],pageHeaders:[],count:0};return{rowCount:0,columnData:e}}function Zo(t,e,f){let r=ia(t).columnData;if(oa(t.fields,e,r,0,0),f.rowCount===0){f.rowCount=1,f.columnData=r;return}f.rowCount+=1;for(let n of t.fieldList)Array.prototype.push.apply(f.columnData[n.key].rlevels,r[n.key].rlevels),Array.prototype.push.apply(f.columnData[n.key].dlevels,r[n.key].dlevels),Array.prototype.push.apply(f.columnData[n.key].values,r[n.key].values),f.columnData[n.key].count+=r[n.key].count}function oa(t,e,f,r,n){for(let i in t){let o=t[i],s=[];if(e&&o.name in e&&e[o.name]!==void 0&&e[o.name]!==null&&(e[o.name].constructor===Array?s=e[o.name]:s.push(e[o.name])),s.length===0&&Boolean(e)&&o.repetitionType==="REQUIRED")throw new Error(`missing required field: ${o.name}`);if(s.length>1&&o.repetitionType!=="REPEATED")throw new Error(`too many values for field: ${o.name}`);if(s.length===0){o.isNested?oa(o.fields,null,f,r,n):(f[o.key].count+=1,f[o.key].rlevels.push(r),f[o.key].dlevels.push(n));continue}for(let a=0;a<s.length;a++){let p=a===0?r:o.rLevelMax;o.isNested?oa(o.fields,s[a],f,p,o.dLevelMax):(f[o.key].count+=1,f[o.key].rlevels.push(p),f[o.key].dlevels.push(o.dLevelMax),f[o.key].values.push(xb(o.originalType||o.primitiveType,s[a])))}}}function $o(t,e){let f=[];for(let r=0;r<e.rowCount;r++)f.push({});for(let r in e.columnData){let n=e.columnData[r];n.count&&qy(t,n,r,f)}return f}function qy(t,e,f,r){let n=t.findField(f),i=t.findFieldBranch(f),o=new Array(n.rLevelMax+1).fill(0),s=0;for(let a=0;a<e.count;a++){let p=e.dlevels[a],w=e.rlevels[a];o[w]++,o.fill(0,w+1);let g=0,m=r[o[g++]-1];for(let j of i){if(j===n||p<j.dLevelMax)break;switch(j.repetitionType){case"REPEATED":j.name in m||(m[j.name]=[]);let B=o[g++];for(;m[j.name].length<=B;)m[j.name].push({});m=m[j.name][B];break;default:m[j.name]=m[j.name]||{},m=m[j.name]}}if(p===n.dLevelMax){let j=ra(n.originalType||n.primitiveType,e.values[s],n);switch(s++,n.repetitionType){case"REPEATED":n.name in m||(m[n.name]=[]);let B=o[g];for(;m[n.name].length<=B;)m[n.name].push(null);m[n.name][B]=j;break;default:m[n.name]=j}}}}function Rb(t,e){let f={};for(let r in e.columnData){let n=e.columnData[r];n.count&&yy(t,n,e.rowCount,r,f)}return f}function yy(t,e,f,r,n){if(e.count<=0)return;let i=t.findField(r),o=t.findFieldBranch(r),s=o[0].name,a,{values:p}=e;if(p.length===f&&o[0].primitiveType&&(a=p),a){n[s]=a;return}a=new Array(f);for(let m=0;m<f;m++)a[m]={};n[s]=a;let w=new Array(i.rLevelMax+1).fill(0),g=0;for(let m=0;m<e.count;m++){let j=e.dlevels[m],B=e.rlevels[m];w[B]++,w.fill(0,B+1);let v=0,R=a[w[v++]-1];for(let D of o){if(D===i||j<D.dLevelMax)break;switch(D.repetitionType){case"REPEATED":D.name in R||(R[D.name]=[]);let z=w[v++];for(;R[D.name].length<=z;)R[D.name].push({});R=R[D.name][z];break;default:R[D.name]=R[D.name]||{},R=R[D.name]}}if(j===i.dLevelMax){let D=ra(i.originalType||i.primitiveType,e.values[g],i);switch(g++,i.repetitionType){case"REPEATED":i.name in R||(R[i.name]=[]);let z=w[v];for(;R[i.name].length<=z;)R[i.name].push(null);R[i.name][z]=D;break;default:R[i.name]=D}}}for(let m=0;m<f;++m)s in a[m]&&(a[m]=a[m][s])}var bi=J(()=>{na()});function la(t,e){for(let f in t){let r=t[f];r.fields?la(r.fields,e):r.compression=e}}function Pb(t,e,f,r){let n={};for(let i in t){let o=t[i],s=!o.optional,a=Boolean(o.repeated),p=e,w=f,g="REQUIRED";if(s||(g="OPTIONAL",w++),a&&(g="REPEATED",p++,s&&w++),o.fields){let B=r.concat([i]);n[i]={name:i,path:B,key:B.join(),repetitionType:g,rLevelMax:p,dLevelMax:w,isNested:!0,fieldCount:Object.keys(o.fields).length,fields:Pb(o.fields,p,w,B)};continue}let m=Dr[o.type];if(!m)throw new Error(`invalid parquet type: ${o.type}`);if(o.encoding=o.encoding||"PLAIN",!(o.encoding in rr))throw new Error(`unsupported parquet encoding: ${o.encoding}`);if(o.compression=o.compression||"UNCOMPRESSED",!(o.compression in ai))throw new Error(`unsupported compression method: ${o.compression}`);let j=r.concat([i]);n[i]={name:i,primitiveType:m.primitiveType,originalType:m.originalType,path:j,key:j.join(),repetitionType:g,encoding:o.encoding,compression:o.compression,typeLength:o.typeLength||m.typeLength,presision:o.presision,scale:o.scale,rLevelMax:p,dLevelMax:w}}return n}function zb(t){let e=[];for(let f in t)e.push(t[f]),t[f].isNested&&(e=e.concat(zb(t[f].fields)));return e}var ci,sa=J(()=>{no();pi();bi();na();ci=class{constructor(e){this.schema=e,this.fields=Pb(e,0,0,[]),this.fieldList=zb(this.fields)}findField(e){typeof e=="string"?e=e.split(","):e=e.slice(0);let f=this.fields;for(;e.length>1;e.shift())f=f[e[0]].fields;return f[e[0]]}findFieldBranch(e){typeof e=="string"&&(e=e.split(","));let f=[],r=this.fields;for(;e.length>0;e.shift())f.push(r[e[0]]),e.length>1&&(r=r[e[0]].fields);return f}shredRecord(e,f){Zo(this,e,f)}materializeRows(e){return $o(this,e)}compress(e){return la(this.schema,e),la(this.fields,e),this}rowGroup(){return ia(this)}}});var br=de((_f,aa)=>{var el=fr("util"),di=_f.Type={STOP:0,VOID:1,BOOL:2,BYTE:3,I08:3,DOUBLE:4,I16:6,I32:8,I64:10,STRING:11,UTF7:11,STRUCT:12,MAP:13,SET:14,LIST:15,UTF8:16,UTF16:17};_f.MessageType={CALL:1,REPLY:2,EXCEPTION:3,ONEWAY:4};_f.TException=tl;function tl(t){Error.call(this),Error.captureStackTrace!==void 0&&Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.message=t}el.inherits(tl,Error);var vy=_f.TApplicationExceptionType={UNKNOWN:0,UNKNOWN_METHOD:1,INVALID_MESSAGE_TYPE:2,WRONG_METHOD_NAME:3,BAD_SEQUENCE_ID:4,MISSING_RESULT:5,INTERNAL_ERROR:6,PROTOCOL_ERROR:7,INVALID_TRANSFORM:8,INVALID_PROTOCOL:9,UNSUPPORTED_CLIENT_TYPE:10};_f.TApplicationException=fl;function fl(t,e){tl.call(this),Error.captureStackTrace!==void 0&&Error.captureStackTrace(this,this.constructor),this.type=t||vy.UNKNOWN,this.name=this.constructor.name,this.message=e}el.inherits(fl,tl);fl.prototype.read=function(t){for(var e,f=t.readStructBegin("TApplicationException");f=t.readFieldBegin(),f.ftype!=di.STOP;){switch(f.fid){case 1:f.ftype==di.STRING?(f=t.readString(),this.message=f):f=t.skip(f.ftype);break;case 2:f.ftype==di.I32?(f=t.readI32(),this.type=f):f=t.skip(f.ftype);break;default:f=t.skip(f.ftype);break}t.readFieldEnd()}t.readStructEnd()};fl.prototype.write=function(t){t.writeStructBegin("TApplicationException"),this.message&&(t.writeFieldBegin("message",di.STRING,1),t.writeString(this.message),t.writeFieldEnd()),this.code&&(t.writeFieldBegin("type",di.I32,2),t.writeI32(this.code),t.writeFieldEnd()),t.writeFieldStop(),t.writeStructEnd()};var aE=_f.TProtocolExceptionType={UNKNOWN:0,INVALID_DATA:1,NEGATIVE_SIZE:2,SIZE_LIMIT:3,BAD_VERSION:4,NOT_IMPLEMENTED:5,DEPTH_LIMIT:6};_f.TProtocolException=Fb;function Fb(t,e){Error.call(this),Error.captureStackTrace!==void 0&&Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.type=t,this.message=e}el.inherits(Fb,Error);_f.objectLength=function(t){return Object.keys(t).length};_f.inherits=function(t,e){el.inherits(t,e)};var rl,nl;rl=function(t,e){if(!t)return t;var f;e.shift===void 0?f=e:f=e[0];var r=f,n=t.length,i=[],o,s;for(o=0;o<n;o++)s=t[o],f===null?i.push(s):f===nl||f===rl?i.push(f(s,e.slice(1))):i.push(new r(s));return i};nl=function(t,e){if(!t)return t;var f;e.shift===void 0?f=e:f=e[0];var r=f,n={},i;for(var o in t)t.hasOwnProperty(o)&&(i=t[o],f===null?n[o]=i:f===nl||f===rl?n[o]=f(i,e.slice(1)):n[o]=new r(i));return n};aa.exports.copyMap=nl;aa.exports.copyList=rl});var Cb=de((pE,Db)=>{var qn=null;typeof WebSocket!="undefined"?qn=WebSocket:typeof MozWebSocket!="undefined"?qn=MozWebSocket:typeof global!="undefined"?qn=global.WebSocket||global.MozWebSocket:typeof window!="undefined"?qn=window.WebSocket||window.MozWebSocket:typeof self!="undefined"&&(qn=self.WebSocket||self.MozWebSocket);Db.exports=qn});var wa=de((wE,pa)=>{"use strict";var yn=typeof Reflect=="object"?Reflect:null,Lb=yn&&typeof yn.apply=="function"?yn.apply:function(e,f,r){return Function.prototype.apply.call(e,f,r)},il;yn&&typeof yn.ownKeys=="function"?il=yn.ownKeys:Object.getOwnPropertySymbols?il=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:il=function(e){return Object.getOwnPropertyNames(e)};function ky(t){console&&console.warn&&console.warn(t)}var Ub=Number.isNaN||function(e){return e!==e};function We(){We.init.call(this)}pa.exports=We;pa.exports.once=xy;We.EventEmitter=We;We.prototype._events=void 0;We.prototype._eventsCount=0;We.prototype._maxListeners=void 0;var Mb=10;function ol(t){if(typeof t!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}Object.defineProperty(We,"defaultMaxListeners",{enumerable:!0,get:function(){return Mb},set:function(t){if(typeof t!="number"||t<0||Ub(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");Mb=t}});We.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0};We.prototype.setMaxListeners=function(e){if(typeof e!="number"||e<0||Ub(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this};function Kb(t){return t._maxListeners===void 0?We.defaultMaxListeners:t._maxListeners}We.prototype.getMaxListeners=function(){return Kb(this)};We.prototype.emit=function(e){for(var f=[],r=1;r<arguments.length;r++)f.push(arguments[r]);var n=e==="error",i=this._events;if(i!==void 0)n=n&&i.error===void 0;else if(!n)return!1;if(n){var o;if(f.length>0&&(o=f[0]),o instanceof Error)throw o;var s=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw s.context=o,s}var a=i[e];if(a===void 0)return!1;if(typeof a=="function")Lb(a,this,f);else for(var p=a.length,w=Jb(a,p),r=0;r<p;++r)Lb(w[r],this,f);return!0};function Wb(t,e,f,r){var n,i,o;if(ol(f),i=t._events,i===void 0?(i=t._events=Object.create(null),t._eventsCount=0):(i.newListener!==void 0&&(t.emit("newListener",e,f.listener?f.listener:f),i=t._events),o=i[e]),o===void 0)o=i[e]=f,++t._eventsCount;else if(typeof o=="function"?o=i[e]=r?[f,o]:[o,f]:r?o.unshift(f):o.push(f),n=Kb(t),n>0&&o.length>n&&!o.warned){o.warned=!0;var s=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");s.name="MaxListenersExceededWarning",s.emitter=t,s.type=e,s.count=o.length,ky(s)}return t}We.prototype.addListener=function(e,f){return Wb(this,e,f,!1)};We.prototype.on=We.prototype.addListener;We.prototype.prependListener=function(e,f){return Wb(this,e,f,!0)};function Ty(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function Yb(t,e,f){var r={fired:!1,wrapFn:void 0,target:t,type:e,listener:f},n=Ty.bind(r);return n.listener=f,r.wrapFn=n,n}We.prototype.once=function(e,f){return ol(f),this.on(e,Yb(this,e,f)),this};We.prototype.prependOnceListener=function(e,f){return ol(f),this.prependListener(e,Yb(this,e,f)),this};We.prototype.removeListener=function(e,f){var r,n,i,o,s;if(ol(f),n=this._events,n===void 0)return this;if(r=n[e],r===void 0)return this;if(r===f||r.listener===f)--this._eventsCount==0?this._events=Object.create(null):(delete n[e],n.removeListener&&this.emit("removeListener",e,r.listener||f));else if(typeof r!="function"){for(i=-1,o=r.length-1;o>=0;o--)if(r[o]===f||r[o].listener===f){s=r[o].listener,i=o;break}if(i<0)return this;i===0?r.shift():_y(r,i),r.length===1&&(n[e]=r[0]),n.removeListener!==void 0&&this.emit("removeListener",e,s||f)}return this};We.prototype.off=We.prototype.removeListener;We.prototype.removeAllListeners=function(e){var f,r,n;if(r=this._events,r===void 0)return this;if(r.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):r[e]!==void 0&&(--this._eventsCount==0?this._events=Object.create(null):delete r[e]),this;if(arguments.length===0){var i=Object.keys(r),o;for(n=0;n<i.length;++n)o=i[n],o!=="removeListener"&&this.removeAllListeners(o);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(f=r[e],typeof f=="function")this.removeListener(e,f);else if(f!==void 0)for(n=f.length-1;n>=0;n--)this.removeListener(e,f[n]);return this};function Vb(t,e,f){var r=t._events;if(r===void 0)return[];var n=r[e];return n===void 0?[]:typeof n=="function"?f?[n.listener||n]:[n]:f?By(n):Jb(n,n.length)}We.prototype.listeners=function(e){return Vb(this,e,!0)};We.prototype.rawListeners=function(e){return Vb(this,e,!1)};We.listenerCount=function(t,e){return typeof t.listenerCount=="function"?t.listenerCount(e):Gb.call(t,e)};We.prototype.listenerCount=Gb;function Gb(t){var e=this._events;if(e!==void 0){var f=e[t];if(typeof f=="function")return 1;if(f!==void 0)return f.length}return 0}We.prototype.eventNames=function(){return this._eventsCount>0?il(this._events):[]};function Jb(t,e){for(var f=new Array(e),r=0;r<e;++r)f[r]=t[r];return f}function _y(t,e){for(;e+1<t.length;e++)t[e]=t[e+1];t.pop()}function By(t){for(var e=new Array(t.length),f=0;f<e.length;++f)e[f]=t[f].listener||t[f];return e}function xy(t,e){return new Promise(function(f,r){function n(o){t.removeListener(e,i),r(o)}function i(){typeof t.removeListener=="function"&&t.removeListener("error",n),f([].slice.call(arguments))}Qb(t,e,i,{once:!0}),e!=="error"&&Ey(t,n,{once:!0})})}function Ey(t,e,f){typeof t.on=="function"&&Qb(t,"error",e,f)}function Qb(t,e,f,r){if(typeof t.on=="function")r.once?t.once(e,f):t.on(e,f);else if(typeof t.addEventListener=="function")t.addEventListener(e,function n(i){r.once&&t.removeEventListener(e,n),f(i)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof t)}});var ll=de(cr=>{var ma=Math.pow(2,8),Iy=Math.pow(2,16),Xb=Math.pow(2,24),Zb=Math.pow(2,32),Sy=Math.pow(2,40),Ay=Math.pow(2,48),ua=Math.pow(2,52),Oy=Math.pow(2,1022);cr.readByte=function(t){return t>127?t-256:t};cr.readI16=function(t,e){e=e||0;var f=t[e+1];return f+=t[e]<<8,t[e]&128&&(f-=Iy),f};cr.readI32=function(t,e){e=e||0;var f=t[e+3];return f+=t[e+2]<<8,f+=t[e+1]<<16,f+=t[e]*Xb,t[e]&128&&(f-=Zb),f};cr.writeI16=function(t,e){return t[1]=e&255,e>>=8,t[0]=e&255,t};cr.writeI32=function(t,e){return t[3]=e&255,e>>=8,t[2]=e&255,e>>=8,t[1]=e&255,e>>=8,t[0]=e&255,t};cr.readDouble=function(t,e){e=e||0;var f=t[e]&128,r=(t[e+1]&240)>>4;r+=(t[e]&127)<<4;var n=t[e+7];switch(n+=t[e+6]<<8,n+=t[e+5]<<16,n+=t[e+4]*Xb,n+=t[e+3]*Zb,n+=t[e+2]*Sy,n+=(t[e+1]&15)*Ay,r){case 0:r=-1022;break;case 2047:return n?NaN:f?-1/0:1/0;default:n+=ua,r-=1023}return f&&(n*=-1),n*Math.pow(2,r-52)};cr.writeDouble=function(t,e){var f,r,n;return t[0]=e<0?128:0,e=Math.abs(e),e!==e?(f=2251799813685248,r=2047):e===1/0?(f=0,r=2047):(r=Math.floor(Math.log(e)/Math.LN2),n=Math.pow(2,-r),e*n<1&&(r--,n*=2),r+1023>=2047?(f=0,r=2047):r+1023>=1?(f=(e*n-1)*ua,r+=1023):(f=e*Oy*ua,r=0)),t[1]=r<<4&240,t[0]|=r>>4&127,t[7]=f&255,f=Math.floor(f/ma),t[6]=f&255,f=Math.floor(f/ma),t[5]=f&255,f=Math.floor(f/ma),t[4]=f&255,f>>=8,t[3]=f&255,f>>=8,t[2]=f&255,f>>=8,t[1]|=f&15,t}});var Cr=de((uE,ec)=>{var Hy=fr("util");ec.exports=$b;function $b(t){Error.call(this),Error.captureStackTrace!==void 0&&Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.message=t}Hy.inherits($b,Error)});var al=de(Uf=>{var Ny=fr("util"),vn=function(){},tc=console.log,sl="error";function hi(t){return function(){var e=["thrift: ["+t+"] "].concat(Array.from(arguments));return tc(Ny.format.apply(null,e))}}var ba=vn,ca=vn,da=vn,ha=vn,ga=vn;Uf.setLogFunc=function(t){tc=t};var Ry=Uf.setLogLevel=function(t){switch(ba=ca=da=ha=ga=vn,sl=t,sl){case"trace":ba=hi("TRACE");case"debug":ca=hi("DEBUG");case"error":da=hi("ERROR");case"warning":ha=hi("WARN");case"info":ga=hi("INFO")}};Ry(sl);Uf.getLogLevel=function(){return sl};Uf.trace=function(){return ba.apply(null,arguments)};Uf.debug=function(){return ca.apply(null,arguments)};Uf.error=function(){return da.apply(null,arguments)};Uf.warning=function(){return ha.apply(null,arguments)};Uf.info=function(){return ga.apply(null,arguments)}});var St=de((cE,rc)=>{var ja=4294967296,fc=[];for(kn=0;kn<256;kn++)fc[kn]=(kn>15?"":"0")+kn.toString(16);var kn,gi=rc.exports=function(t,e){t instanceof Buffer?(this.buffer=t,this.offset=e||0):Object.prototype.toString.call(t)=="[object Uint8Array]"?(this.buffer=new Buffer(t),this.offset=e||0):(this.buffer=this.buffer||new Buffer(8),this.offset=0,this.setValue.apply(this,arguments))};gi.MAX_INT=Math.pow(2,53);gi.MIN_INT=-Math.pow(2,53);gi.prototype={constructor:gi,_2scomp:function(){for(var t=this.buffer,e=this.offset,f=1,r=e+7;r>=e;r--){var n=(t[r]^255)+f;t[r]=n&255,f=n>>8}},setValue:function(t,e){var f=!1;if(arguments.length==1)if(typeof t=="number"){if(f=t<0,t=Math.abs(t),e=t%ja,t=t/ja,t>ja)throw new RangeError(t+" is outside Int64 range");t=t|0}else if(typeof t=="string")t=(t+"").replace(/^0x/,""),e=t.substr(-8),t=t.length>8?t.substr(0,t.length-8):"",t=parseInt(t,16),e=parseInt(e,16);else throw new Error(t+" must be a Number or String");for(var r=this.buffer,n=this.offset,i=7;i>=0;i--)r[n+i]=e&255,e=i==4?t:e>>>8;f&&this._2scomp()},toNumber:function(t){for(var e=this.buffer,f=this.offset,r=e[f]&128,n=0,i=1,o=7,s=1;o>=0;o--,s*=256){var a=e[f+o];r&&(a=(a^255)+i,i=a>>8,a=a&255),n+=a*s}return!t&&n>=gi.MAX_INT?r?-1/0:1/0:r?-n:n},valueOf:function(){return this.toNumber(!1)},toString:function(t){return this.valueOf().toString(t||10)},toOctetString:function(t){for(var e=new Array(8),f=this.buffer,r=this.offset,n=0;n<8;n++)e[n]=fc[f[r+n]];return e.join(t||"")},toBuffer:function(t){if(t&&this.offset===0)return this.buffer;var e=new Buffer(8);return this.buffer.copy(e,0,this.offset,this.offset+8),e},copy:function(t,e){this.buffer.copy(t,e||0,this.offset,this.offset+8)},compare:function(t){if((this.buffer[this.offset]&128)!=(t.buffer[t.offset]&128))return t.buffer[t.offset]-this.buffer[this.offset];for(var e=0;e<8;e++)if(this.buffer[this.offset+e]!==t.buffer[t.offset+e])return this.buffer[this.offset+e]-t.buffer[t.offset+e];return 0},equals:function(t){return this.compare(t)===0},inspect:function(){return"[Int64 value:"+this+" octets:"+this.toOctetString(" ")+"]"}}});var va=de((dE,nc)=>{var Py=al(),Mf=St(),lt=br(),Qe=lt.Type;nc.exports=V;var qa=Math.pow(2,8),zy=Math.pow(2,24),Fy=Math.pow(2,32),Dy=Math.pow(2,40),Cy=Math.pow(2,48),ya=Math.pow(2,52),Ly=Math.pow(2,1022);function V(t){this.trans=t,this.lastField_=[],this.lastFieldId_=0,this.string_limit_=0,this.string_buf_=null,this.string_buf_size_=0,this.container_limit_=0,this.booleanField_={name:null,hasBoolValue:!1},this.boolValue_={hasBoolValue:!1,boolValue:!1}}V.PROTOCOL_ID=-126;V.VERSION_N=1;V.VERSION_MASK=31;V.TYPE_MASK=-32;V.TYPE_BITS=7;V.TYPE_SHIFT_AMOUNT=5;V.Types={CT_STOP:0,CT_BOOLEAN_TRUE:1,CT_BOOLEAN_FALSE:2,CT_BYTE:3,CT_I16:4,CT_I32:5,CT_I64:6,CT_DOUBLE:7,CT_BINARY:8,CT_LIST:9,CT_SET:10,CT_MAP:11,CT_STRUCT:12};V.TTypeToCType=[V.Types.CT_STOP,0,V.Types.CT_BOOLEAN_TRUE,V.Types.CT_BYTE,V.Types.CT_DOUBLE,0,V.Types.CT_I16,0,V.Types.CT_I32,0,V.Types.CT_I64,V.Types.CT_BINARY,V.Types.CT_STRUCT,V.Types.CT_MAP,V.Types.CT_SET,V.Types.CT_LIST];V.prototype.getTransport=function(){return this.trans};V.prototype.getCompactType=function(t){return V.TTypeToCType[t]};V.prototype.getTType=function(t){switch(t){case Qe.STOP:return Qe.STOP;case V.Types.CT_BOOLEAN_FALSE:case V.Types.CT_BOOLEAN_TRUE:return Qe.BOOL;case V.Types.CT_BYTE:return Qe.BYTE;case V.Types.CT_I16:return Qe.I16;case V.Types.CT_I32:return Qe.I32;case V.Types.CT_I64:return Qe.I64;case V.Types.CT_DOUBLE:return Qe.DOUBLE;case V.Types.CT_BINARY:return Qe.STRING;case V.Types.CT_LIST:return Qe.LIST;case V.Types.CT_SET:return Qe.SET;case V.Types.CT_MAP:return Qe.MAP;case V.Types.CT_STRUCT:return Qe.STRUCT;default:throw new lt.TProtocolException(lt.TProtocolExceptionType.INVALID_DATA,"Unknown type: "+t)}return Qe.STOP};V.prototype.flush=function(){return this.trans.flush()};V.prototype.writeMessageBegin=function(t,e,f){this.writeByte(V.PROTOCOL_ID),this.writeByte(V.VERSION_N&V.VERSION_MASK|e<<V.TYPE_SHIFT_AMOUNT&V.TYPE_MASK),this.writeVarint32(f),this.writeString(t),this._seqid?Py.warning("SeqId already set",{name:t}):(this._seqid=f,this.trans.setCurrSeqId(f))};V.prototype.writeMessageEnd=function(){};V.prototype.writeStructBegin=function(t){this.lastField_.push(this.lastFieldId_),this.lastFieldId_=0};V.prototype.writeStructEnd=function(){this.lastFieldId_=this.lastField_.pop()};V.prototype.writeFieldBegin=function(t,e,f){if(e!=Qe.BOOL)return this.writeFieldBeginInternal(t,e,f,-1);this.booleanField_.name=t,this.booleanField_.fieldType=e,this.booleanField_.fieldId=f};V.prototype.writeFieldEnd=function(){};V.prototype.writeFieldStop=function(){this.writeByte(V.Types.CT_STOP)};V.prototype.writeMapBegin=function(t,e,f){f===0?this.writeByte(0):(this.writeVarint32(f),this.writeByte(this.getCompactType(t)<<4|this.getCompactType(e)))};V.prototype.writeMapEnd=function(){};V.prototype.writeListBegin=function(t,e){this.writeCollectionBegin(t,e)};V.prototype.writeListEnd=function(){};V.prototype.writeSetBegin=function(t,e){this.writeCollectionBegin(t,e)};V.prototype.writeSetEnd=function(){};V.prototype.writeBool=function(t){this.booleanField_.name!==null?(this.writeFieldBeginInternal(this.booleanField_.name,this.booleanField_.fieldType,this.booleanField_.fieldId,t?V.Types.CT_BOOLEAN_TRUE:V.Types.CT_BOOLEAN_FALSE),this.booleanField_.name=null):this.writeByte(t?V.Types.CT_BOOLEAN_TRUE:V.Types.CT_BOOLEAN_FALSE)};V.prototype.writeByte=function(t){this.trans.write(new Buffer([t]))};V.prototype.writeI16=function(t){this.writeVarint32(this.i32ToZigzag(t))};V.prototype.writeI32=function(t){this.writeVarint32(this.i32ToZigzag(t))};V.prototype.writeI64=function(t){this.writeVarint64(this.i64ToZigzag(t))};V.prototype.writeDouble=function(t){var e=new Buffer(8),f,r,n;e[7]=t<0?128:0,t=Math.abs(t),t!==t?(f=2251799813685248,r=2047):t===1/0?(f=0,r=2047):(r=Math.floor(Math.log(t)/Math.LN2),n=Math.pow(2,-r),t*n<1&&(r--,n*=2),r+1023>=2047?(f=0,r=2047):r+1023>=1?(f=(t*n-1)*ya,r+=1023):(f=t*Ly*ya,r=0)),e[6]=r<<4&240,e[7]|=r>>4&127,e[0]=f&255,f=Math.floor(f/qa),e[1]=f&255,f=Math.floor(f/qa),e[2]=f&255,f=Math.floor(f/qa),e[3]=f&255,f>>=8,e[4]=f&255,f>>=8,e[5]=f&255,f>>=8,e[6]|=f&15,this.trans.write(e)};V.prototype.writeStringOrBinary=function(t,e,f){if(typeof f=="string")this.writeVarint32(Buffer.byteLength(f,e)),this.trans.write(new Buffer(f,e));else if(f instanceof Buffer||Object.prototype.toString.call(f)=="[object Uint8Array]")this.writeVarint32(f.length),this.trans.write(f);else throw new Error(t+" called without a string/Buffer argument: "+f)};V.prototype.writeString=function(t){this.writeStringOrBinary("writeString","utf8",t)};V.prototype.writeBinary=function(t){this.writeStringOrBinary("writeBinary","binary",t)};V.prototype.writeFieldBeginInternal=function(t,e,f,r){var n=r==-1?this.getCompactType(e):r;f>this.lastFieldId_&&f-this.lastFieldId_<=15?this.writeByte(f-this.lastFieldId_<<4|n):(this.writeByte(n),this.writeI16(f)),this.lastFieldId_=f};V.prototype.writeCollectionBegin=function(t,e){e<=14?this.writeByte(e<<4|this.getCompactType(t)):(this.writeByte(240|this.getCompactType(t)),this.writeVarint32(e))};V.prototype.writeVarint32=function(t){for(var e=new Buffer(5),f=0;;)if((t&~127)==0){e[f++]=t;break}else e[f++]=t&127|128,t=t>>>7;var r=new Buffer(f);e.copy(r,0,0,f),this.trans.write(r)};V.prototype.writeVarint64=function(t){if(typeof t=="number"&&(t=new Mf(t)),!(t instanceof Mf))throw new lt.TProtocolException(lt.TProtocolExceptionType.INVALID_DATA,"Expected Int64 or Number, found: "+t);for(var e=new Buffer(10),f=0,r=t.buffer.readUInt32BE(0,!0),n=t.buffer.readUInt32BE(4,!0),i=0;;)if((n&~127)==0&&r===0){e[f++]=n;break}else e[f++]=n&127|128,i=r<<25,n=n>>>7,r=r>>>7,n=n|i;var o=new Buffer(f);e.copy(o,0,0,f),this.trans.write(o)};V.prototype.i64ToZigzag=function(t){if(typeof t=="string"?t=new Mf(parseInt(t,10)):typeof t=="number"&&(t=new Mf(t)),!(t instanceof Mf))throw new lt.TProtocolException(lt.TProtocolExceptionType.INVALID_DATA,"Expected Int64 or Number, found: "+t);var e=t.buffer.readUInt32BE(0,!0),f=t.buffer.readUInt32BE(4,!0),r=e>>>31;return e=(e<<1|f>>>31)^(r?4294967295:0),f=f<<1^(r?4294967295:0),new Mf(e,f)};V.prototype.i32ToZigzag=function(t){return t<<1^(t&2147483648?4294967295:0)};V.prototype.readMessageBegin=function(){var t=this.trans.readByte();if(t!=V.PROTOCOL_ID)throw new lt.TProtocolException(lt.TProtocolExceptionType.BAD_VERSION,"Bad protocol identifier "+t);var e=this.trans.readByte(),f=e&V.VERSION_MASK;if(f!=V.VERSION_N)throw new lt.TProtocolException(lt.TProtocolExceptionType.BAD_VERSION,"Bad protocol version "+f);var r=e>>V.TYPE_SHIFT_AMOUNT&V.TYPE_BITS,n=this.readVarint32(),i=this.readString();return{fname:i,mtype:r,rseqid:n}};V.prototype.readMessageEnd=function(){};V.prototype.readStructBegin=function(){return this.lastField_.push(this.lastFieldId_),this.lastFieldId_=0,{fname:""}};V.prototype.readStructEnd=function(){this.lastFieldId_=this.lastField_.pop()};V.prototype.readFieldBegin=function(){var t=0,e=this.trans.readByte(e),f=e&15;if(f==V.Types.CT_STOP)return{fname:null,ftype:lt.Type.STOP,fid:0};var r=(e&240)>>>4;r===0?t=this.readI16():t=this.lastFieldId_+r;var n=this.getTType(f);return(f==V.Types.CT_BOOLEAN_TRUE||f==V.Types.CT_BOOLEAN_FALSE)&&(this.boolValue_.hasBoolValue=!0,this.boolValue_.boolValue=f==V.Types.CT_BOOLEAN_TRUE),this.lastFieldId_=t,{fname:null,ftype:n,fid:t}};V.prototype.readFieldEnd=function(){};V.prototype.readMapBegin=function(){var t=this.readVarint32();if(t<0)throw new lt.TProtocolException(lt.TProtocolExceptionType.NEGATIVE_SIZE,"Negative map size");var e=0;t!==0&&(e=this.trans.readByte());var f=this.getTType((e&240)>>>4),r=this.getTType(e&15);return{ktype:f,vtype:r,size:t}};V.prototype.readMapEnd=function(){};V.prototype.readListBegin=function(){var t=this.trans.readByte(),e=t>>>4&15;if(e==15&&(e=this.readVarint32()),e<0)throw new lt.TProtocolException(lt.TProtocolExceptionType.NEGATIVE_SIZE,"Negative list size");var f=this.getTType(t&15);return{etype:f,size:e}};V.prototype.readListEnd=function(){};V.prototype.readSetBegin=function(){return this.readListBegin()};V.prototype.readSetEnd=function(){};V.prototype.readBool=function(){var t=!1,e=0;if(this.boolValue_.hasBoolValue===!0)t=this.boolValue_.boolValue,this.boolValue_.hasBoolValue=!1;else{var f=this.trans.readByte();e=f.rsize,t=f.value==V.Types.CT_BOOLEAN_TRUE}return t};V.prototype.readByte=function(){return this.trans.readByte()};V.prototype.readI16=function(){return this.readI32()};V.prototype.readI32=function(){return this.zigzagToI32(this.readVarint32())};V.prototype.readI64=function(){return this.zigzagToI64(this.readVarint64())};V.prototype.readDouble=function(){var t=this.trans.read(8),e=0,f=t[e+7]&128,r=(t[e+6]&240)>>4;r+=(t[e+7]&127)<<4;var n=t[e];switch(n+=t[e+1]<<8,n+=t[e+2]<<16,n+=t[e+3]*zy,n+=t[e+4]*Fy,n+=t[e+5]*Dy,n+=(t[e+6]&15)*Cy,r){case 0:r=-1022;break;case 2047:return n?NaN:f?-1/0:1/0;default:n+=ya,r-=1023}return f&&(n*=-1),n*Math.pow(2,r-52)};V.prototype.readBinary=function(){var t=this.readVarint32();if(t===0)return new Buffer(0);if(t<0)throw new lt.TProtocolException(lt.TProtocolExceptionType.NEGATIVE_SIZE,"Negative binary size");return this.trans.read(t)};V.prototype.readString=function(){var t=this.readVarint32();if(t===0)return"";if(t<0)throw new lt.TProtocolException(lt.TProtocolExceptionType.NEGATIVE_SIZE,"Negative string size");return this.trans.readString(t)};V.prototype.readVarint32=function(){return this.readVarint64().toNumber()};V.prototype.readVarint64=function(){for(var t=0,e=0,f=0,r=0;;){var n=this.trans.readByte();if(t++,r<=25?e=e|(n&127)<<r:25<r&&r<32?(e=e|(n&127)<<r,f=f|(n&127)>>>32-r):f=f|(n&127)<<r-32,r+=7,!(n&128))break;if(t>=10)throw new lt.TProtocolException(lt.TProtocolExceptionType.INVALID_DATA,"Variable-length int over 10 bytes.")}return new Mf(f,e)};V.prototype.zigzagToI32=function(t){return t>>>1^-1*(t&1)};V.prototype.zigzagToI64=function(t){var e=t.buffer.readUInt32BE(0,!0),f=t.buffer.readUInt32BE(4,!0),r=new Mf(e&0,f&1);r._2scomp();var n=r.buffer.readUInt32BE(0,!0),i=r.buffer.readUInt32BE(4,!0),o=e<<31;return e=e>>>1^n,f=(f>>>1|o)^i,new Mf(e,f)};V.prototype.skip=function(t){switch(t){case Qe.BOOL:this.readBool();break;case Qe.BYTE:this.readByte();break;case Qe.I16:this.readI16();break;case Qe.I32:this.readI32();break;case Qe.I64:this.readI64();break;case Qe.DOUBLE:this.readDouble();break;case Qe.STRING:this.readString();break;case Qe.STRUCT:for(this.readStructBegin();;){var e=this.readFieldBegin();if(e.ftype===Qe.STOP)break;this.skip(e.ftype),this.readFieldEnd()}this.readStructEnd();break;case Qe.MAP:for(var f=this.readMapBegin(),r=0;r<f.size;++r)this.skip(f.ktype),this.skip(f.vtype);this.readMapEnd();break;case Qe.SET:for(var n=this.readSetBegin(),i=0;i<n.size;++i)this.skip(n.etype);this.readSetEnd();break;case Qe.LIST:for(var o=this.readListBegin(),s=0;s<o.size;++s)this.skip(o.etype);this.readListEnd();break;default:throw new Error("Invalid type: "+t)}}});var _a=de((hE,ac)=>{var ic=al(),ka=ll(),oc=St(),Kf=br(),zt=Kf.Type;ac.exports=qe;var lc=-65536,Ta=-2147418112,sc=255;qe.VERSION_MASK=lc;qe.VERSION_1=Ta;qe.TYPE_MASK=sc;function qe(t,e,f){this.trans=t,this.strictRead=e!==void 0?e:!1,this.strictWrite=f!==void 0?f:!0,this._seqid=null}qe.prototype.flush=function(){return this.trans.flush()};qe.prototype.writeMessageBegin=function(t,e,f){this.strictWrite?(this.writeI32(Ta|e),this.writeString(t),this.writeI32(f)):(this.writeString(t),this.writeByte(e),this.writeI32(f)),this._seqid!==null?ic.warning("SeqId already set",{name:t}):(this._seqid=f,this.trans.setCurrSeqId(f))};qe.prototype.writeMessageEnd=function(){this._seqid!==null?this._seqid=null:ic.warning("No seqid to unset")};qe.prototype.writeStructBegin=function(t){};qe.prototype.writeStructEnd=function(){};qe.prototype.writeFieldBegin=function(t,e,f){this.writeByte(e),this.writeI16(f)};qe.prototype.writeFieldEnd=function(){};qe.prototype.writeFieldStop=function(){this.writeByte(zt.STOP)};qe.prototype.writeMapBegin=function(t,e,f){this.writeByte(t),this.writeByte(e),this.writeI32(f)};qe.prototype.writeMapEnd=function(){};qe.prototype.writeListBegin=function(t,e){this.writeByte(t),this.writeI32(e)};qe.prototype.writeListEnd=function(){};qe.prototype.writeSetBegin=function(t,e){this.writeByte(t),this.writeI32(e)};qe.prototype.writeSetEnd=function(){};qe.prototype.writeBool=function(t){t?this.writeByte(1):this.writeByte(0)};qe.prototype.writeByte=function(t){this.trans.write(new Buffer([t]))};qe.prototype.writeI16=function(t){this.trans.write(ka.writeI16(new Buffer(2),t))};qe.prototype.writeI32=function(t){this.trans.write(ka.writeI32(new Buffer(4),t))};qe.prototype.writeI64=function(t){t.buffer?this.trans.write(t.buffer):this.trans.write(new oc(t).buffer)};qe.prototype.writeDouble=function(t){this.trans.write(ka.writeDouble(new Buffer(8),t))};qe.prototype.writeStringOrBinary=function(t,e,f){if(typeof f=="string")this.writeI32(Buffer.byteLength(f,e)),this.trans.write(new Buffer(f,e));else if(f instanceof Buffer||Object.prototype.toString.call(f)=="[object Uint8Array]")this.writeI32(f.length),this.trans.write(f);else throw new Error(t+" called without a string/Buffer argument: "+f)};qe.prototype.writeString=function(t){this.writeStringOrBinary("writeString","utf8",t)};qe.prototype.writeBinary=function(t){this.writeStringOrBinary("writeBinary","binary",t)};qe.prototype.readMessageBegin=function(){var t=this.readI32(),e,f,r;if(t<0){var n=t&lc;if(n!=Ta)throw new Kf.TProtocolException(Kf.TProtocolExceptionType.BAD_VERSION,"Bad version in readMessageBegin: "+t);e=t&sc,f=this.readString(),r=this.readI32()}else{if(this.strictRead)throw new Kf.TProtocolException(Kf.TProtocolExceptionType.BAD_VERSION,"No protocol version header");f=this.trans.read(t),e=this.readByte(),r=this.readI32()}return{fname:f,mtype:e,rseqid:r}};qe.prototype.readMessageEnd=function(){};qe.prototype.readStructBegin=function(){return{fname:""}};qe.prototype.readStructEnd=function(){};qe.prototype.readFieldBegin=function(){var t=this.readByte();if(t==zt.STOP)return{fname:null,ftype:t,fid:0};var e=this.readI16();return{fname:null,ftype:t,fid:e}};qe.prototype.readFieldEnd=function(){};qe.prototype.readMapBegin=function(){var t=this.readByte(),e=this.readByte(),f=this.readI32();return{ktype:t,vtype:e,size:f}};qe.prototype.readMapEnd=function(){};qe.prototype.readListBegin=function(){var t=this.readByte(),e=this.readI32();return{etype:t,size:e}};qe.prototype.readListEnd=function(){};qe.prototype.readSetBegin=function(){var t=this.readByte(),e=this.readI32();return{etype:t,size:e}};qe.prototype.readSetEnd=function(){};qe.prototype.readBool=function(){var t=this.readByte();return t!==0};qe.prototype.readByte=function(){return this.trans.readByte()};qe.prototype.readI16=function(){return this.trans.readI16()};qe.prototype.readI32=function(){return this.trans.readI32()};qe.prototype.readI64=function(){var t=this.trans.read(8);return new oc(t)};qe.prototype.readDouble=function(){return this.trans.readDouble()};qe.prototype.readBinary=function(){var t=this.readI32();if(t===0)return new Buffer(0);if(t<0)throw new Kf.TProtocolException(Kf.TProtocolExceptionType.NEGATIVE_SIZE,"Negative binary size");return this.trans.read(t)};qe.prototype.readString=function(){var t=this.readI32();if(t===0)return"";if(t<0)throw new Kf.TProtocolException(Kf.TProtocolExceptionType.NEGATIVE_SIZE,"Negative string size");return this.trans.readString(t)};qe.prototype.getTransport=function(){return this.trans};qe.prototype.skip=function(t){switch(t){case zt.BOOL:this.readBool();break;case zt.BYTE:this.readByte();break;case zt.I16:this.readI16();break;case zt.I32:this.readI32();break;case zt.I64:this.readI64();break;case zt.DOUBLE:this.readDouble();break;case zt.STRING:this.readString();break;case zt.STRUCT:for(this.readStructBegin();;){var e=this.readFieldBegin();if(e.ftype===zt.STOP)break;this.skip(e.ftype),this.readFieldEnd()}this.readStructEnd();break;case zt.MAP:for(var f=this.readMapBegin(),r=0;r<f.size;++r)this.skip(f.ktype),this.skip(f.vtype);this.readMapEnd();break;case zt.SET:for(var n=this.readSetBegin(),i=0;i<n.size;++i)this.skip(n.etype);this.readSetEnd();break;case zt.LIST:for(var o=this.readListBegin(),s=0;s<o.size;++s)this.skip(o.etype);this.readListEnd();break;default:throw new Error("Invalid type: "+t)}}});var Ba=de((gE,cc)=>{var Uy=fr("util"),pl=va(),pc=_a(),My=Cr();function ji(t){Error.call(this),Error.captureStackTrace!==void 0&&Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.message=t}Uy.inherits(ji,Error);cc.exports=mt;var Ky=0,Wy=1,Yy=0,Vy=32/8,Gy=48/8,Jy=64/8,Qy=96/8,wc=112/8,mc=4095,uc=1,Xy=1073741823;function Wf(t){var e=qi();this.outputBuffer=null;var f=this;this.transport=new e(null,function(r){f.outputBuffer=r}),this.transport.inBuf=t||Buffer.alloc(0),this.transport.writeCursor=this.transport.inBuf.length,this.protocol=new pl(this.transport)}Wf.prototype.readVarint32=function(){return this.protocol.readVarint32()};Wf.prototype.writeVarint32=function(t){this.protocol.writeVarint32(t)};Wf.prototype.readString=function(){return this.protocol.readString()};Wf.prototype.writeString=function(t){this.protocol.writeString(t)};Wf.prototype.getOutCount=function(){return this.transport.outCount};Wf.prototype.write=function(t){this.transport.write(t)};Wf.prototype.toBuffer=function(){return this.transport.flush(),this.outputBuffer};mt.SubprotocolId={BINARY:0,JSON:1,COMPACT:2};function mt(){this.maxFrameSize=Xy,this.protocolId=mt.SubprotocolId.BINARY,this.rheaders={},this.wheaders={},this.inBuf=Buffer.alloc(0),this.outCount=0,this.flags=null,this.seqid=0,this.shouldWriteHeaders=!0}var bc=function(t,e){if(typeof t!="string"||typeof e!="string")throw new ji("Header key and values must be strings")},Zy=function(t){for(var e=Object.keys(mt.SubprotocolId),f=0;f<e.length;f++)if(t===mt.SubprotocolId[e[f]])return!0;throw new Error(t+" is not a valid protocol id")};mt.prototype.setSeqId=function(t){this.seqid=t};mt.prototype.getSeqId=function(t){return this.seqid};mt.prototype.setFlags=function(t){this.flags=t};mt.prototype.getReadHeaders=function(){return this.rheaders};mt.prototype.setReadHeader=function(t,e){bc(t,e),this.rheaders[t]=e};mt.prototype.clearReadHeaders=function(){this.rheaders={}};mt.prototype.getWriteHeaders=function(){return this.wheaders};mt.prototype.setWriteHeader=function(t,e){bc(t,e),this.wheaders[t]=e};mt.prototype.clearWriteHeaders=function(){this.wheaders={}};mt.prototype.setMaxFrameSize=function(t){this.maxFrameSize=t};mt.prototype.setProtocolId=function(t){Zy(t),this.protocolId=t};mt.prototype.getProtocolId=function(){return this.protocolId};var $y=function(t){var e=t.readInt32BE();return(e&pc.VERSION_MASK)===pc.VERSION_1},ev=function(t){var e=t.readInt8(Ky),f=t.readInt8(Wy);return e===pl.PROTOCOL_ID&&(f&pl.VERSION_MASK)===pl.VERSION_N};mt.prototype.readHeaders=function(){var t=this.inBuf,e=!1;if($y(t)&&(this.setProtocolId(mt.SubprotocolId.BINARY),e=!0),ev(t)&&(this.setProtocolId(mt.SubprotocolId.COMPACT),e=!0),e){this.shouldWriteHeaders=!1;return}var f=t.readInt32BE(Yy);if(f>this.maxFrameSize)throw new ji("Frame exceeds maximum frame size");var r=t.readInt16BE(Vy);if(this.shouldWriteHeaders=r===mc,!!this.shouldWriteHeaders){this.setFlags(t.readInt16BE(Gy)),this.setSeqId(t.readInt32BE(Jy));var n=t.readInt16BE(Qy)*4,i=wc+n;if(i>t.length)throw new ji("Header size is greater than frame size");var o=Buffer.alloc(n);t.copy(o,0,wc,i);var s=new Wf(o);this.setProtocolId(s.readVarint32());var a=s.readVarint32();if(a>0)throw new ji("Transforms are not yet supported");for(;;)try{var p=s.readVarint32();if(p!==uc)break;for(var w=s.readVarint32(),g=0;g<w;g++){var m=s.readString(),j=s.readString();this.setReadHeader(m,j)}}catch(B){if(B instanceof My)break;throw B}return this.read(i),this.getReadHeaders()}};mt.prototype.writeHeaders=function(){if(!!this.shouldWriteHeaders){var t=this.getWriteHeaders(),e=new Wf;e.writeVarint32(this.protocolId),e.writeVarint32(0);var f=Object.keys(t);if(f.length>0){e.writeVarint32(uc),e.writeVarint32(f.length);for(var r=0;r<f.length;r++){var n=f[r],i=t[n];e.writeString(n),e.writeString(i)}}var o=e.getOutCount(),s=(4-o%4)%4,a=Buffer.alloc(2);a.writeInt16BE(Math.floor((o+s)/4));var p=Buffer.alloc(s);p.fill(0),e.write(p);var w=e.toBuffer(),g=Buffer.alloc(4);g.writeInt32BE(10+this.outCount+w.length);var m=Buffer.alloc(2);m.writeInt16BE(mc);var j=Buffer.alloc(2);j.writeInt16BE(0);var B=Buffer.alloc(4);B.writeInt32BE(this.getSeqId());var v=Buffer.concat([g,m,j,B,a,w]);this.outBuffers.unshift(v),this.outCount+=v.length}}});var qi=de((jE,dc)=>{var wl=ll(),tv=Cr(),fv=Ba();dc.exports=st;function st(t,e){this.defaultReadBufferSize=1024,this.writeBufferSize=512,this.inBuf=new Buffer(this.defaultReadBufferSize),this.readCursor=0,this.writeCursor=0,this.outBuffers=[],this.outCount=0,this.onFlush=e}st.prototype=new fv;st.prototype.reset=function(){this.inBuf=new Buffer(this.defaultReadBufferSize),this.readCursor=0,this.writeCursor=0,this.outBuffers=[],this.outCount=0};st.receiver=function(t,e){var f=new st;return function(r){if(f.writeCursor+r.length>f.inBuf.length){var n=new Buffer(f.writeCursor+r.length);f.inBuf.copy(n,0,0,f.writeCursor),f.inBuf=n}r.copy(f.inBuf,f.writeCursor,0),f.writeCursor+=r.length,t(f,e)}};st.prototype.commitPosition=function(){var t=this.writeCursor-this.readCursor,e=t*2>this.defaultReadBufferSize?t*2:this.defaultReadBufferSize,f=new Buffer(e);t>0&&this.inBuf.copy(f,0,this.readCursor,this.writeCursor),this.readCursor=0,this.writeCursor=t,this.inBuf=f};st.prototype.rollbackPosition=function(){this.readCursor=0};st.prototype.isOpen=function(){return!0};st.prototype.open=function(){};st.prototype.close=function(){};st.prototype.setCurrSeqId=function(t){this._seqid=t};st.prototype.ensureAvailable=function(t){if(this.readCursor+t>this.writeCursor)throw new tv};st.prototype.read=function(t){this.ensureAvailable(t);var e=new Buffer(t);return this.inBuf.copy(e,0,this.readCursor,this.readCursor+t),this.readCursor+=t,e};st.prototype.readByte=function(){return this.ensureAvailable(1),wl.readByte(this.inBuf[this.readCursor++])};st.prototype.readI16=function(){this.ensureAvailable(2);var t=wl.readI16(this.inBuf,this.readCursor);return this.readCursor+=2,t};st.prototype.readI32=function(){this.ensureAvailable(4);var t=wl.readI32(this.inBuf,this.readCursor);return this.readCursor+=4,t};st.prototype.readDouble=function(){this.ensureAvailable(8);var t=wl.readDouble(this.inBuf,this.readCursor);return this.readCursor+=8,t};st.prototype.readString=function(t){this.ensureAvailable(t);var e=this.inBuf.toString("utf8",this.readCursor,this.readCursor+t);return this.readCursor+=t,e};st.prototype.borrow=function(){var t={buf:this.inBuf,readIndex:this.readCursor,writeIndex:this.writeCursor};return t};st.prototype.consume=function(t){this.readCursor+=t};st.prototype.write=function(t){typeof t=="string"&&(t=new Buffer(t,"utf8")),this.outBuffers.push(t),this.outCount+=t.length};st.prototype.flush=function(){var t=this._seqid;if(this._seqid=null,!(this.outCount<1)){var e=new Buffer(this.outCount),f=0;this.outBuffers.forEach(function(r){r.copy(e,f,0),f+=r.length}),this.onFlush&&this.onFlush(e,t),this.outBuffers=[],this.outCount=0}}});var Ea=de((qE,yc)=>{var hc=St(),gc=yc.exports={},rv=Math.pow(2,24),jc=Math.pow(2,31),xa=Math.pow(2,32),qc=Math.pow(10,11);gc.toDecimalString=function(t){var e=t.buffer,f=t.offset;if(!e[f]&&!(e[f+1]&224)||!~e[f]&&!~(e[f+1]&224))return t.toString();var r=e[f]&128;if(r){for(var n=!1,i=new Buffer(8),o=7;o>=0;--o)i[o]=~e[f+o]+(n?0:1)&255,n|=e[f+o];e=i}var s=e[f+1]+(e[f]<<8),a=e[f+7]+(e[f+6]<<8)+(e[f+5]<<16)+e[f+4]*rv+(e[f+3]+(e[f+2]<<8))*xa+s*74976710656,p=Math.floor(a/qc)+s*2814;return a=("00000000000"+String(a%qc)).slice(-11),(r?"-":"")+String(p)+a};gc.fromDecimalString=function(t){var e=t.charAt(0)==="-";if(t.length<(e?17:16))return new hc(+t);if(t.length>(e?20:19))throw new RangeError("Too many digits for Int64: "+t);var f=+t.slice(e?1:0,-15),r=+t.slice(-15)+f*2764472320,n=Math.floor(r/xa)+f*232830;if(r=r%xa,n>=jc&&!(e&&n==jc&&r==0))throw new RangeError("The magnitude is too large for Int64.");return e&&(n=~n,r===0?n=n+1&4294967295:r=~r+1,n=2147483648|n),new hc(n,r)}});var Tc=de((kE,kc)=>{var vc=St(),yE=Ea(),vE=kc.exports=function(){"use strict";var t,e,f={'"':'"',"\\":"\\","/":"/",b:"\b",f:"\f",n:`
|
|
12
|
+
`)+" "+f[1]:f[0]+e+" "+t.join(", ")+" "+f[1]}function db(t){return Array.isArray(t)}function Gs(t){return typeof t=="boolean"}function Mo(t){return t===null}function Hq(t){return t==null}function hb(t){return typeof t=="number"}function Ko(t){return typeof t=="string"}function Nq(t){return babelHelpers.typeof(t)==="symbol"}function Cf(t){return t===void 0}function Wo(t){return cn(t)&&Qs(t)==="[object RegExp]"}function cn(t){return babelHelpers.typeof(t)==="object"&&t!==null}function Js(t){return cn(t)&&Qs(t)==="[object Date]"}function Yo(t){return cn(t)&&(Qs(t)==="[object Error]"||t instanceof Error)}function Vo(t){return typeof t=="function"}function Rq(t){return t===null||typeof t=="boolean"||typeof t=="number"||typeof t=="string"||babelHelpers.typeof(t)==="symbol"||typeof t=="undefined"}function Pq(t){return Buffer.isBuffer(t)}function Qs(t){return Object.prototype.toString.call(t)}function Xs(t){return t<10?"0"+t.toString(10):t.toString(10)}function Fq(){var t=new Date,e=[Xs(t.getHours()),Xs(t.getMinutes()),Xs(t.getSeconds())].join(":");return[t.getDate(),zq[t.getMonth()],e].join(" ")}function Dq(){console.log("%s - %s",Fq(),Ks.apply(null,arguments))}function gb(t,e){if(!e||!cn(e))return t;for(var f=Object.keys(e),r=f.length;r--;)t[f[r]]=e[f[r]];return t}function jb(t,e){return Object.prototype.hasOwnProperty.call(t,e)}var Co,wq,mq,uq,Tf,tf,bq,Cs,Pr,ub,Ls,yq,vq,bn,se,j_,q_,y_,v_,pr,k_,Us,T_,Gt,__,wr,B_,kq,Ms,Tq,_q,Lo,Ws,zq,Cq,Ce,x_,E_,I_,S_,A_,O_,H_,N_,R_,P_,mf,z_,F_,me,D_,dn,C_,zr,L_,Fr,U_,Go,K_,hn,W_,gn,Y_,Lf,V_,M,G_,J_,Q_,X_,Z_,$_,eB,tB,fB,rB,nB,iB,oB,lB,sB,aB,pB,wB,mB,uB,bB,cB,dB,hB,gB,jB,qB,yB,vB,kB,TB,_B,BB,xB,Zs,EB,mr,IB,jn,SB,ur,AB,OB,Jo,HB,Qo,NB,wi,RB,PB,mi,zB,FB,Xo,DB,ue,CB,LB,UB,qb,MB,yb,KB,WB,YB,VB,GB,JB,QB,XB,ZB,$B,ex,tx,fx,rx,nx,ix,ox,lx,sx,ax,px,wx,mx,ux,bx,cx,dx,hx,gx,jx,qx,yx,vx,kx,Tx,_x,Bx,xx,Ex,Ix,Sx,Ax,Ox,Hx,Nx,Rx,Px,zx,Fx,Dx,Cx,Lx,$s=J(()=>{Co=typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:{};wq=cq,mq=hq,uq=qq,Tf=[],tf=[],bq=typeof Uint8Array!="undefined"?Uint8Array:Array,Cs="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(Pr=0,ub=Cs.length;Pr<ub;++Pr)Tf[Pr]=Cs[Pr],tf[Cs.charCodeAt(Pr)]=Pr;tf["-".charCodeAt(0)]=62;tf["_".charCodeAt(0)]=63;Ls={byteLength:wq,toByteArray:mq,fromByteArray:uq},yq=function(e,f,r,n,i){var o,s,a=i*8-n-1,p=(1<<a)-1,w=p>>1,g=-7,m=r?i-1:0,j=r?-1:1,B=e[f+m];for(m+=j,o=B&(1<<-g)-1,B>>=-g,g+=a;g>0;o=o*256+e[f+m],m+=j,g-=8);for(s=o&(1<<-g)-1,o>>=-g,g+=n;g>0;s=s*256+e[f+m],m+=j,g-=8);if(o===0)o=1-w;else{if(o===p)return s?NaN:(B?-1:1)*(1/0);s=s+Math.pow(2,n),o=o-w}return(B?-1:1)*s*Math.pow(2,o-n)},vq=function(e,f,r,n,i,o){var s,a,p,w=o*8-i-1,g=(1<<w)-1,m=g>>1,j=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,B=n?0:o-1,v=n?1:-1,R=f<0||f===0&&1/f<0?1:0;for(f=Math.abs(f),isNaN(f)||f===1/0?(a=isNaN(f)?1:0,s=g):(s=Math.floor(Math.log(f)/Math.LN2),f*(p=Math.pow(2,-s))<1&&(s--,p*=2),s+m>=1?f+=j/p:f+=j*Math.pow(2,1-m),f*p>=2&&(s++,p/=2),s+m>=g?(a=0,s=g):s+m>=1?(a=(f*p-1)*Math.pow(2,i),s=s+m):(a=f*Math.pow(2,m-1)*Math.pow(2,i),s=0));i>=8;e[r+B]=a&255,B+=v,a/=256,i-=8);for(s=s<<i|a,w+=i;w>0;e[r+B]=s&255,B+=v,s/=256,w-=8);e[r+B-v]|=R*128},bn={read:yq,write:vq},se=Ze(function(t,e){var f=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;e.Buffer=o,e.SlowBuffer=R,e.INSPECT_MAX_BYTES=50;var r=2147483647;e.kMaxLength=r,o.TYPED_ARRAY_SUPPORT=n(),!o.TYPED_ARRAY_SUPPORT&&typeof console!="undefined"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function n(){try{var q=new Uint8Array(1),u={foo:function(){return 42}};return Object.setPrototypeOf(u,Uint8Array.prototype),Object.setPrototypeOf(q,u),q.foo()===42}catch{return!1}}Object.defineProperty(o.prototype,"parent",{enumerable:!0,get:function(){if(!!o.isBuffer(this))return this.buffer}}),Object.defineProperty(o.prototype,"offset",{enumerable:!0,get:function(){if(!!o.isBuffer(this))return this.byteOffset}});function i(q){if(q>r)throw new RangeError('The value "'+q+'" is invalid for option "size"');var u=new Uint8Array(q);return Object.setPrototypeOf(u,o.prototype),u}function o(q,u,b){if(typeof q=="number"){if(typeof u=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return w(q)}return s(q,u,b)}o.poolSize=8192;function s(q,u,b){if(typeof q=="string")return g(q,u);if(ArrayBuffer.isView(q))return m(q);if(q==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+babelHelpers.typeof(q));if(Te(q,ArrayBuffer)||q&&Te(q.buffer,ArrayBuffer)||typeof SharedArrayBuffer!="undefined"&&(Te(q,SharedArrayBuffer)||q&&Te(q.buffer,SharedArrayBuffer)))return j(q,u,b);if(typeof q=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');var k=q.valueOf&&q.valueOf();if(k!=null&&k!==q)return o.from(k,u,b);var N=B(q);if(N)return N;if(typeof Symbol!="undefined"&&Symbol.toPrimitive!=null&&typeof q[Symbol.toPrimitive]=="function")return o.from(q[Symbol.toPrimitive]("string"),u,b);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+babelHelpers.typeof(q))}o.from=function(q,u,b){return s(q,u,b)},Object.setPrototypeOf(o.prototype,Uint8Array.prototype),Object.setPrototypeOf(o,Uint8Array);function a(q){if(typeof q!="number")throw new TypeError('"size" argument must be of type number');if(q<0)throw new RangeError('The value "'+q+'" is invalid for option "size"')}function p(q,u,b){return a(q),q<=0?i(q):u!==void 0?typeof b=="string"?i(q).fill(u,b):i(q).fill(u):i(q)}o.alloc=function(q,u,b){return p(q,u,b)};function w(q){return a(q),i(q<0?0:v(q)|0)}o.allocUnsafe=function(q){return w(q)},o.allocUnsafeSlow=function(q){return w(q)};function g(q,u){if((typeof u!="string"||u==="")&&(u="utf8"),!o.isEncoding(u))throw new TypeError("Unknown encoding: "+u);var b=D(q,u)|0,k=i(b),N=k.write(q,u);return N!==b&&(k=k.slice(0,N)),k}function m(q){for(var u=q.length<0?0:v(q.length)|0,b=i(u),k=0;k<u;k+=1)b[k]=q[k]&255;return b}function j(q,u,b){if(u<0||q.byteLength<u)throw new RangeError('"offset" is outside of buffer bounds');if(q.byteLength<u+(b||0))throw new RangeError('"length" is outside of buffer bounds');var k;return u===void 0&&b===void 0?k=new Uint8Array(q):b===void 0?k=new Uint8Array(q,u):k=new Uint8Array(q,u,b),Object.setPrototypeOf(k,o.prototype),k}function B(q){if(o.isBuffer(q)){var u=v(q.length)|0,b=i(u);return b.length===0||q.copy(b,0,0,u),b}if(q.length!==void 0)return typeof q.length!="number"||ft(q.length)?i(0):m(q);if(q.type==="Buffer"&&Array.isArray(q.data))return m(q.data)}function v(q){if(q>=r)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+r.toString(16)+" bytes");return q|0}function R(q){return+q!=q&&(q=0),o.alloc(+q)}o.isBuffer=function(u){return u!=null&&u._isBuffer===!0&&u!==o.prototype},o.compare=function(u,b){if(Te(u,Uint8Array)&&(u=o.from(u,u.offset,u.byteLength)),Te(b,Uint8Array)&&(b=o.from(b,b.offset,b.byteLength)),!o.isBuffer(u)||!o.isBuffer(b))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(u===b)return 0;for(var k=u.length,N=b.length,$=0,ee=Math.min(k,N);$<ee;++$)if(u[$]!==b[$]){k=u[$],N=b[$];break}return k<N?-1:N<k?1:0},o.isEncoding=function(u){switch(String(u).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},o.concat=function(u,b){if(!Array.isArray(u))throw new TypeError('"list" argument must be an Array of Buffers');if(u.length===0)return o.alloc(0);var k;if(b===void 0)for(b=0,k=0;k<u.length;++k)b+=u[k].length;var N=o.allocUnsafe(b),$=0;for(k=0;k<u.length;++k){var ee=u[k];if(Te(ee,Uint8Array)&&(ee=o.from(ee)),!o.isBuffer(ee))throw new TypeError('"list" argument must be an Array of Buffers');ee.copy(N,$),$+=ee.length}return N};function D(q,u){if(o.isBuffer(q))return q.length;if(ArrayBuffer.isView(q)||Te(q,ArrayBuffer))return q.byteLength;if(typeof q!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+babelHelpers.typeof(q));var b=q.length,k=arguments.length>2&&arguments[2]===!0;if(!k&&b===0)return 0;for(var N=!1;;)switch(u){case"ascii":case"latin1":case"binary":return b;case"utf8":case"utf-8":return ae(q).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return b*2;case"hex":return b>>>1;case"base64":return Xf(q).length;default:if(N)return k?-1:ae(q).length;u=(""+u).toLowerCase(),N=!0}}o.byteLength=D;function z(q,u,b){var k=!1;if((u===void 0||u<0)&&(u=0),u>this.length||((b===void 0||b>this.length)&&(b=this.length),b<=0)||(b>>>=0,u>>>=0,b<=u))return"";for(q||(q="utf8");;)switch(q){case"hex":return I(this,u,b);case"utf8":case"utf-8":return c(this,u,b);case"ascii":return F(this,u,b);case"latin1":case"binary":return Z(this,u,b);case"base64":return A(this,u,b);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ke(this,u,b);default:if(k)throw new TypeError("Unknown encoding: "+q);q=(q+"").toLowerCase(),k=!0}}o.prototype._isBuffer=!0;function G(q,u,b){var k=q[u];q[u]=q[b],q[b]=k}o.prototype.swap16=function(){var u=this.length;if(u%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var b=0;b<u;b+=2)G(this,b,b+1);return this},o.prototype.swap32=function(){var u=this.length;if(u%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var b=0;b<u;b+=4)G(this,b,b+3),G(this,b+1,b+2);return this},o.prototype.swap64=function(){var u=this.length;if(u%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var b=0;b<u;b+=8)G(this,b,b+7),G(this,b+1,b+6),G(this,b+2,b+5),G(this,b+3,b+4);return this},o.prototype.toString=function(){var u=this.length;return u===0?"":arguments.length===0?c(this,0,u):z.apply(this,arguments)},o.prototype.toLocaleString=o.prototype.toString,o.prototype.equals=function(u){if(!o.isBuffer(u))throw new TypeError("Argument must be a Buffer");return this===u?!0:o.compare(this,u)===0},o.prototype.inspect=function(){var u="",b=e.INSPECT_MAX_BYTES;return u=this.toString("hex",0,b).replace(/(.{2})/g,"$1 ").trim(),this.length>b&&(u+=" ... "),"<Buffer "+u+">"},f&&(o.prototype[f]=o.prototype.inspect),o.prototype.compare=function(u,b,k,N,$){if(Te(u,Uint8Array)&&(u=o.from(u,u.offset,u.byteLength)),!o.isBuffer(u))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+babelHelpers.typeof(u));if(b===void 0&&(b=0),k===void 0&&(k=u?u.length:0),N===void 0&&(N=0),$===void 0&&($=this.length),b<0||k>u.length||N<0||$>this.length)throw new RangeError("out of range index");if(N>=$&&b>=k)return 0;if(N>=$)return-1;if(b>=k)return 1;if(b>>>=0,k>>>=0,N>>>=0,$>>>=0,this===u)return 0;for(var ee=$-N,Ee=k-b,_e=Math.min(ee,Ee),Le=this.slice(N,$),ht=u.slice(b,k),we=0;we<_e;++we)if(Le[we]!==ht[we]){ee=Le[we],Ee=ht[we];break}return ee<Ee?-1:Ee<ee?1:0};function fe(q,u,b,k,N){if(q.length===0)return-1;if(typeof b=="string"?(k=b,b=0):b>2147483647?b=2147483647:b<-2147483648&&(b=-2147483648),b=+b,ft(b)&&(b=N?0:q.length-1),b<0&&(b=q.length+b),b>=q.length){if(N)return-1;b=q.length-1}else if(b<0)if(N)b=0;else return-1;if(typeof u=="string"&&(u=o.from(u,k)),o.isBuffer(u))return u.length===0?-1:K(q,u,b,k,N);if(typeof u=="number")return u=u&255,typeof Uint8Array.prototype.indexOf=="function"?N?Uint8Array.prototype.indexOf.call(q,u,b):Uint8Array.prototype.lastIndexOf.call(q,u,b):K(q,[u],b,k,N);throw new TypeError("val must be string, number or Buffer")}function K(q,u,b,k,N){var $=1,ee=q.length,Ee=u.length;if(k!==void 0&&(k=String(k).toLowerCase(),k==="ucs2"||k==="ucs-2"||k==="utf16le"||k==="utf-16le")){if(q.length<2||u.length<2)return-1;$=2,ee/=2,Ee/=2,b/=2}function _e(y,_){return $===1?y[_]:y.readUInt16BE(_*$)}var Le;if(N){var ht=-1;for(Le=b;Le<ee;Le++)if(_e(q,Le)===_e(u,ht===-1?0:Le-ht)){if(ht===-1&&(ht=Le),Le-ht+1===Ee)return ht*$}else ht!==-1&&(Le-=Le-ht),ht=-1}else for(b+Ee>ee&&(b=ee-Ee),Le=b;Le>=0;Le--){for(var we=!0,sf=0;sf<Ee;sf++)if(_e(q,Le+sf)!==_e(u,sf)){we=!1;break}if(we)return Le}return-1}o.prototype.includes=function(u,b,k){return this.indexOf(u,b,k)!==-1},o.prototype.indexOf=function(u,b,k){return fe(this,u,b,k,!0)},o.prototype.lastIndexOf=function(u,b,k){return fe(this,u,b,k,!1)};function O(q,u,b,k){b=Number(b)||0;var N=q.length-b;k?(k=Number(k),k>N&&(k=N)):k=N;var $=u.length;k>$/2&&(k=$/2);for(var ee=0;ee<k;++ee){var Ee=parseInt(u.substr(ee*2,2),16);if(ft(Ee))return ee;q[b+ee]=Ee}return ee}function te(q,u,b,k){return Ye(ae(u,q.length-b),q,b,k)}function L(q,u,b,k){return Ye(tt(u),q,b,k)}function re(q,u,b,k){return L(q,u,b,k)}function h(q,u,b,k){return Ye(Xf(u),q,b,k)}function d(q,u,b,k){return Ye(Qf(u,q.length-b),q,b,k)}o.prototype.write=function(u,b,k,N){if(b===void 0)N="utf8",k=this.length,b=0;else if(k===void 0&&typeof b=="string")N=b,k=this.length,b=0;else if(isFinite(b))b=b>>>0,isFinite(k)?(k=k>>>0,N===void 0&&(N="utf8")):(N=k,k=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var $=this.length-b;if((k===void 0||k>$)&&(k=$),u.length>0&&(k<0||b<0)||b>this.length)throw new RangeError("Attempt to write outside buffer bounds");N||(N="utf8");for(var ee=!1;;)switch(N){case"hex":return O(this,u,b,k);case"utf8":case"utf-8":return te(this,u,b,k);case"ascii":return L(this,u,b,k);case"latin1":case"binary":return re(this,u,b,k);case"base64":return h(this,u,b,k);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return d(this,u,b,k);default:if(ee)throw new TypeError("Unknown encoding: "+N);N=(""+N).toLowerCase(),ee=!0}},o.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function A(q,u,b){return u===0&&b===q.length?Ls.fromByteArray(q):Ls.fromByteArray(q.slice(u,b))}function c(q,u,b){b=Math.min(q.length,b);for(var k=[],N=u;N<b;){var $=q[N],ee=null,Ee=$>239?4:$>223?3:$>191?2:1;if(N+Ee<=b){var _e,Le,ht,we;switch(Ee){case 1:$<128&&(ee=$);break;case 2:_e=q[N+1],(_e&192)==128&&(we=($&31)<<6|_e&63,we>127&&(ee=we));break;case 3:_e=q[N+1],Le=q[N+2],(_e&192)==128&&(Le&192)==128&&(we=($&15)<<12|(_e&63)<<6|Le&63,we>2047&&(we<55296||we>57343)&&(ee=we));break;case 4:_e=q[N+1],Le=q[N+2],ht=q[N+3],(_e&192)==128&&(Le&192)==128&&(ht&192)==128&&(we=($&15)<<18|(_e&63)<<12|(Le&63)<<6|ht&63,we>65535&&we<1114112&&(ee=we))}}ee===null?(ee=65533,Ee=1):ee>65535&&(ee-=65536,k.push(ee>>>10&1023|55296),ee=56320|ee&1023),k.push(ee),N+=Ee}return U(k)}var P=4096;function U(q){var u=q.length;if(u<=P)return String.fromCharCode.apply(String,q);for(var b="",k=0;k<u;)b+=String.fromCharCode.apply(String,q.slice(k,k+=P));return b}function F(q,u,b){var k="";b=Math.min(q.length,b);for(var N=u;N<b;++N)k+=String.fromCharCode(q[N]&127);return k}function Z(q,u,b){var k="";b=Math.min(q.length,b);for(var N=u;N<b;++N)k+=String.fromCharCode(q[N]);return k}function I(q,u,b){var k=q.length;(!u||u<0)&&(u=0),(!b||b<0||b>k)&&(b=k);for(var N="",$=u;$<b;++$)N+=Pe[q[$]];return N}function ke(q,u,b){for(var k=q.slice(u,b),N="",$=0;$<k.length;$+=2)N+=String.fromCharCode(k[$]+k[$+1]*256);return N}o.prototype.slice=function(u,b){var k=this.length;u=~~u,b=b===void 0?k:~~b,u<0?(u+=k,u<0&&(u=0)):u>k&&(u=k),b<0?(b+=k,b<0&&(b=0)):b>k&&(b=k),b<u&&(b=u);var N=this.subarray(u,b);return Object.setPrototypeOf(N,o.prototype),N};function ne(q,u,b){if(q%1!=0||q<0)throw new RangeError("offset is not uint");if(q+u>b)throw new RangeError("Trying to access beyond buffer length")}o.prototype.readUIntLE=function(u,b,k){u=u>>>0,b=b>>>0,k||ne(u,b,this.length);for(var N=this[u],$=1,ee=0;++ee<b&&($*=256);)N+=this[u+ee]*$;return N},o.prototype.readUIntBE=function(u,b,k){u=u>>>0,b=b>>>0,k||ne(u,b,this.length);for(var N=this[u+--b],$=1;b>0&&($*=256);)N+=this[u+--b]*$;return N},o.prototype.readUInt8=function(u,b){return u=u>>>0,b||ne(u,1,this.length),this[u]},o.prototype.readUInt16LE=function(u,b){return u=u>>>0,b||ne(u,2,this.length),this[u]|this[u+1]<<8},o.prototype.readUInt16BE=function(u,b){return u=u>>>0,b||ne(u,2,this.length),this[u]<<8|this[u+1]},o.prototype.readUInt32LE=function(u,b){return u=u>>>0,b||ne(u,4,this.length),(this[u]|this[u+1]<<8|this[u+2]<<16)+this[u+3]*16777216},o.prototype.readUInt32BE=function(u,b){return u=u>>>0,b||ne(u,4,this.length),this[u]*16777216+(this[u+1]<<16|this[u+2]<<8|this[u+3])},o.prototype.readIntLE=function(u,b,k){u=u>>>0,b=b>>>0,k||ne(u,b,this.length);for(var N=this[u],$=1,ee=0;++ee<b&&($*=256);)N+=this[u+ee]*$;return $*=128,N>=$&&(N-=Math.pow(2,8*b)),N},o.prototype.readIntBE=function(u,b,k){u=u>>>0,b=b>>>0,k||ne(u,b,this.length);for(var N=b,$=1,ee=this[u+--N];N>0&&($*=256);)ee+=this[u+--N]*$;return $*=128,ee>=$&&(ee-=Math.pow(2,8*b)),ee},o.prototype.readInt8=function(u,b){return u=u>>>0,b||ne(u,1,this.length),this[u]&128?(255-this[u]+1)*-1:this[u]},o.prototype.readInt16LE=function(u,b){u=u>>>0,b||ne(u,2,this.length);var k=this[u]|this[u+1]<<8;return k&32768?k|4294901760:k},o.prototype.readInt16BE=function(u,b){u=u>>>0,b||ne(u,2,this.length);var k=this[u+1]|this[u]<<8;return k&32768?k|4294901760:k},o.prototype.readInt32LE=function(u,b){return u=u>>>0,b||ne(u,4,this.length),this[u]|this[u+1]<<8|this[u+2]<<16|this[u+3]<<24},o.prototype.readInt32BE=function(u,b){return u=u>>>0,b||ne(u,4,this.length),this[u]<<24|this[u+1]<<16|this[u+2]<<8|this[u+3]},o.prototype.readFloatLE=function(u,b){return u=u>>>0,b||ne(u,4,this.length),bn.read(this,u,!0,23,4)},o.prototype.readFloatBE=function(u,b){return u=u>>>0,b||ne(u,4,this.length),bn.read(this,u,!1,23,4)},o.prototype.readDoubleLE=function(u,b){return u=u>>>0,b||ne(u,8,this.length),bn.read(this,u,!0,52,8)},o.prototype.readDoubleBE=function(u,b){return u=u>>>0,b||ne(u,8,this.length),bn.read(this,u,!1,52,8)};function C(q,u,b,k,N,$){if(!o.isBuffer(q))throw new TypeError('"buffer" argument must be a Buffer instance');if(u>N||u<$)throw new RangeError('"value" argument is out of bounds');if(b+k>q.length)throw new RangeError("Index out of range")}o.prototype.writeUIntLE=function(u,b,k,N){if(u=+u,b=b>>>0,k=k>>>0,!N){var $=Math.pow(2,8*k)-1;C(this,u,b,k,$,0)}var ee=1,Ee=0;for(this[b]=u&255;++Ee<k&&(ee*=256);)this[b+Ee]=u/ee&255;return b+k},o.prototype.writeUIntBE=function(u,b,k,N){if(u=+u,b=b>>>0,k=k>>>0,!N){var $=Math.pow(2,8*k)-1;C(this,u,b,k,$,0)}var ee=k-1,Ee=1;for(this[b+ee]=u&255;--ee>=0&&(Ee*=256);)this[b+ee]=u/Ee&255;return b+k},o.prototype.writeUInt8=function(u,b,k){return u=+u,b=b>>>0,k||C(this,u,b,1,255,0),this[b]=u&255,b+1},o.prototype.writeUInt16LE=function(u,b,k){return u=+u,b=b>>>0,k||C(this,u,b,2,65535,0),this[b]=u&255,this[b+1]=u>>>8,b+2},o.prototype.writeUInt16BE=function(u,b,k){return u=+u,b=b>>>0,k||C(this,u,b,2,65535,0),this[b]=u>>>8,this[b+1]=u&255,b+2},o.prototype.writeUInt32LE=function(u,b,k){return u=+u,b=b>>>0,k||C(this,u,b,4,4294967295,0),this[b+3]=u>>>24,this[b+2]=u>>>16,this[b+1]=u>>>8,this[b]=u&255,b+4},o.prototype.writeUInt32BE=function(u,b,k){return u=+u,b=b>>>0,k||C(this,u,b,4,4294967295,0),this[b]=u>>>24,this[b+1]=u>>>16,this[b+2]=u>>>8,this[b+3]=u&255,b+4},o.prototype.writeIntLE=function(u,b,k,N){if(u=+u,b=b>>>0,!N){var $=Math.pow(2,8*k-1);C(this,u,b,k,$-1,-$)}var ee=0,Ee=1,_e=0;for(this[b]=u&255;++ee<k&&(Ee*=256);)u<0&&_e===0&&this[b+ee-1]!==0&&(_e=1),this[b+ee]=(u/Ee>>0)-_e&255;return b+k},o.prototype.writeIntBE=function(u,b,k,N){if(u=+u,b=b>>>0,!N){var $=Math.pow(2,8*k-1);C(this,u,b,k,$-1,-$)}var ee=k-1,Ee=1,_e=0;for(this[b+ee]=u&255;--ee>=0&&(Ee*=256);)u<0&&_e===0&&this[b+ee+1]!==0&&(_e=1),this[b+ee]=(u/Ee>>0)-_e&255;return b+k},o.prototype.writeInt8=function(u,b,k){return u=+u,b=b>>>0,k||C(this,u,b,1,127,-128),u<0&&(u=255+u+1),this[b]=u&255,b+1},o.prototype.writeInt16LE=function(u,b,k){return u=+u,b=b>>>0,k||C(this,u,b,2,32767,-32768),this[b]=u&255,this[b+1]=u>>>8,b+2},o.prototype.writeInt16BE=function(u,b,k){return u=+u,b=b>>>0,k||C(this,u,b,2,32767,-32768),this[b]=u>>>8,this[b+1]=u&255,b+2},o.prototype.writeInt32LE=function(u,b,k){return u=+u,b=b>>>0,k||C(this,u,b,4,2147483647,-2147483648),this[b]=u&255,this[b+1]=u>>>8,this[b+2]=u>>>16,this[b+3]=u>>>24,b+4},o.prototype.writeInt32BE=function(u,b,k){return u=+u,b=b>>>0,k||C(this,u,b,4,2147483647,-2147483648),u<0&&(u=4294967295+u+1),this[b]=u>>>24,this[b+1]=u>>>16,this[b+2]=u>>>8,this[b+3]=u&255,b+4};function W(q,u,b,k,N,$){if(b+k>q.length)throw new RangeError("Index out of range");if(b<0)throw new RangeError("Index out of range")}function ve(q,u,b,k,N){return u=+u,b=b>>>0,N||W(q,u,b,4),bn.write(q,u,b,k,23,4),b+4}o.prototype.writeFloatLE=function(u,b,k){return ve(this,u,b,!0,k)},o.prototype.writeFloatBE=function(u,b,k){return ve(this,u,b,!1,k)};function oe(q,u,b,k,N){return u=+u,b=b>>>0,N||W(q,u,b,8),bn.write(q,u,b,k,52,8),b+8}o.prototype.writeDoubleLE=function(u,b,k){return oe(this,u,b,!0,k)},o.prototype.writeDoubleBE=function(u,b,k){return oe(this,u,b,!1,k)},o.prototype.copy=function(u,b,k,N){if(!o.isBuffer(u))throw new TypeError("argument should be a Buffer");if(k||(k=0),!N&&N!==0&&(N=this.length),b>=u.length&&(b=u.length),b||(b=0),N>0&&N<k&&(N=k),N===k||u.length===0||this.length===0)return 0;if(b<0)throw new RangeError("targetStart out of bounds");if(k<0||k>=this.length)throw new RangeError("Index out of range");if(N<0)throw new RangeError("sourceEnd out of bounds");N>this.length&&(N=this.length),u.length-b<N-k&&(N=u.length-b+k);var $=N-k;if(this===u&&typeof Uint8Array.prototype.copyWithin=="function")this.copyWithin(b,k,N);else if(this===u&&k<b&&b<N)for(var ee=$-1;ee>=0;--ee)u[ee+b]=this[ee+k];else Uint8Array.prototype.set.call(u,this.subarray(k,N),b);return $},o.prototype.fill=function(u,b,k,N){if(typeof u=="string"){if(typeof b=="string"?(N=b,b=0,k=this.length):typeof k=="string"&&(N=k,k=this.length),N!==void 0&&typeof N!="string")throw new TypeError("encoding must be a string");if(typeof N=="string"&&!o.isEncoding(N))throw new TypeError("Unknown encoding: "+N);if(u.length===1){var $=u.charCodeAt(0);(N==="utf8"&&$<128||N==="latin1")&&(u=$)}}else typeof u=="number"?u=u&255:typeof u=="boolean"&&(u=Number(u));if(b<0||this.length<b||this.length<k)throw new RangeError("Out of range index");if(k<=b)return this;b=b>>>0,k=k===void 0?this.length:k>>>0,u||(u=0);var ee;if(typeof u=="number")for(ee=b;ee<k;++ee)this[ee]=u;else{var Ee=o.isBuffer(u)?u:o.from(u,N),_e=Ee.length;if(_e===0)throw new TypeError('The value "'+u+'" is invalid for argument "value"');for(ee=0;ee<k-b;++ee)this[ee+b]=Ee[ee%_e]}return this};var xe=/[^+/0-9A-Za-z-_]/g;function kt(q){if(q=q.split("=")[0],q=q.trim().replace(xe,""),q.length<2)return"";for(;q.length%4!=0;)q=q+"=";return q}function ae(q,u){u=u||1/0;for(var b,k=q.length,N=null,$=[],ee=0;ee<k;++ee){if(b=q.charCodeAt(ee),b>55295&&b<57344){if(!N){if(b>56319){(u-=3)>-1&&$.push(239,191,189);continue}else if(ee+1===k){(u-=3)>-1&&$.push(239,191,189);continue}N=b;continue}if(b<56320){(u-=3)>-1&&$.push(239,191,189),N=b;continue}b=(N-55296<<10|b-56320)+65536}else N&&(u-=3)>-1&&$.push(239,191,189);if(N=null,b<128){if((u-=1)<0)break;$.push(b)}else if(b<2048){if((u-=2)<0)break;$.push(b>>6|192,b&63|128)}else if(b<65536){if((u-=3)<0)break;$.push(b>>12|224,b>>6&63|128,b&63|128)}else if(b<1114112){if((u-=4)<0)break;$.push(b>>18|240,b>>12&63|128,b>>6&63|128,b&63|128)}else throw new Error("Invalid code point")}return $}function tt(q){for(var u=[],b=0;b<q.length;++b)u.push(q.charCodeAt(b)&255);return u}function Qf(q,u){for(var b,k,N,$=[],ee=0;ee<q.length&&!((u-=2)<0);++ee)b=q.charCodeAt(ee),k=b>>8,N=b%256,$.push(N),$.push(k);return $}function Xf(q){return Ls.toByteArray(kt(q))}function Ye(q,u,b,k){for(var N=0;N<k&&!(N+b>=u.length||N>=q.length);++N)u[N+b]=q[N];return N}function Te(q,u){return q instanceof u||q!=null&&q.constructor!=null&&q.constructor.name!=null&&q.constructor.name===u.name}function ft(q){return q!==q}var Pe=function(){for(var q="0123456789abcdef",u=new Array(256),b=0;b<16;++b)for(var k=b*16,N=0;N<16;++N)u[k+N]=q[b]+q[N];return u}()}),j_=se.Buffer,q_=se.SlowBuffer,y_=se.INSPECT_MAX_BYTES,v_=se.kMaxLength,pr=Ze(function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.ensureBuffer=void 0;function f(r){if(se.Buffer.isBuffer(r))return r;if(ArrayBuffer.isView(r))return se.Buffer.from(r.buffer);if(r instanceof ArrayBuffer)return se.Buffer.from(r);throw new TypeError("Must use either Buffer or TypedArray")}e.ensureBuffer=f});nt(pr);k_=pr.ensureBuffer,Us=Ze(function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.parseUUID=void 0;let f=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function r(n){if(typeof n!="string")throw new TypeError("Invalid type for UUID, expected string but got "+typeof n);if(!f.test(n))throw new TypeError("Invalid format for UUID: "+n);let i,o=new Uint8Array(16);return o[0]=(i=parseInt(n.slice(0,8),16))>>>24,o[1]=i>>>16&255,o[2]=i>>>8&255,o[3]=i&255,o[4]=(i=parseInt(n.slice(9,13),16))>>>8,o[5]=i&255,o[6]=(i=parseInt(n.slice(14,18),16))>>>8,o[7]=i&255,o[8]=(i=parseInt(n.slice(19,23),16))>>>8,o[9]=i&255,o[10]=(i=parseInt(n.slice(24,36),16))/1099511627776&255,o[11]=i/4294967296&255,o[12]=i>>>24&255,o[13]=i>>>16&255,o[14]=i>>>8&255,o[15]=i&255,o}e.parseUUID=r});nt(Us);T_=Us.parseUUID,Gt=Ze(function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.Binary=void 0;class f{constructor(n,i){if(n!=null&&typeof n!="string"&&!ArrayBuffer.isView(n)&&!(n instanceof ArrayBuffer)&&!Array.isArray(n))throw new TypeError("Binary can only be constructed from string, Buffer, TypedArray, or Array<number>");this.sub_type=i??f.BSON_BINARY_SUBTYPE_DEFAULT,n==null?(this.buffer=se.Buffer.alloc(f.BUFFER_SIZE),this.position=0):(typeof n=="string"?this.buffer=se.Buffer.from(n,"binary"):Array.isArray(n)?this.buffer=se.Buffer.from(n):this.buffer=pr.ensureBuffer(n),this.position=this.buffer.byteLength)}put(n){if(typeof n=="string"&&n.length!==1)throw new TypeError("only accepts single character String");if(typeof n!="number"&&n.length!==1)throw new TypeError("only accepts single character Uint8Array or Array");let i;if(typeof n=="string"?i=n.charCodeAt(0):typeof n=="number"?i=n:i=n[0],i<0||i>255)throw new TypeError("only accepts number in a valid unsigned byte range 0-255");if(this.buffer.length>this.position)this.buffer[this.position++]=i;else{let o=se.Buffer.alloc(f.BUFFER_SIZE+this.buffer.length);this.buffer.copy(o,0,0,this.buffer.length),this.buffer=o,this.buffer[this.position++]=i}}write(n,i){if(i=typeof i=="number"?i:this.position,this.buffer.length<i+n.length){let o=se.Buffer.alloc(this.buffer.length+n.length);this.buffer.copy(o,0,0,this.buffer.length),this.buffer=o}ArrayBuffer.isView(n)?(this.buffer.set(pr.ensureBuffer(n),i),this.position=i+n.byteLength>this.position?i+n.length:this.position):typeof n=="string"&&(this.buffer.write(n,i,n.length,"binary"),this.position=i+n.length>this.position?i+n.length:this.position)}read(n,i){return i=i&&i>0?i:this.position,this.buffer.slice(n,n+i)}value(n){return n=!!n,n&&this.buffer.length===this.position?this.buffer:n?this.buffer.slice(0,this.position):this.buffer.toString("binary",0,this.position)}length(){return this.position}toJSON(){return this.buffer.toString("base64")}toString(n){return this.buffer.toString(n)}toExtendedJSON(n){n=n||{};let i=this.buffer.toString("base64"),o=Number(this.sub_type).toString(16);return n.legacy?{$binary:i,$type:o.length===1?"0"+o:o}:{$binary:{base64:i,subType:o.length===1?"0"+o:o}}}static fromExtendedJSON(n,i){i=i||{};let o,s;if("$binary"in n?i.legacy&&typeof n.$binary=="string"&&"$type"in n?(s=n.$type?parseInt(n.$type,16):0,o=se.Buffer.from(n.$binary,"base64")):typeof n.$binary!="string"&&(s=n.$binary.subType?parseInt(n.$binary.subType,16):0,o=se.Buffer.from(n.$binary.base64,"base64")):"$uuid"in n&&(s=4,o=se.Buffer.from(Us.parseUUID(n.$uuid))),!o)throw new TypeError(`Unexpected Binary Extended JSON format ${JSON.stringify(n)}`);return new f(o,s)}}e.Binary=f,f.BSON_BINARY_SUBTYPE_DEFAULT=0,f.BUFFER_SIZE=256,f.SUBTYPE_DEFAULT=0,f.SUBTYPE_FUNCTION=1,f.SUBTYPE_BYTE_ARRAY=2,f.SUBTYPE_UUID_OLD=3,f.SUBTYPE_UUID=4,f.SUBTYPE_MD5=5,f.SUBTYPE_USER_DEFINED=128,Object.defineProperty(f.prototype,"_bsontype",{value:"Binary"})});nt(Gt);__=Gt.Binary,wr=Ze(function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.Code=void 0;class f{constructor(n,i){this.code=n,this.scope=i}toJSON(){return{code:this.code,scope:this.scope}}toExtendedJSON(){return this.scope?{$code:this.code,$scope:this.scope}:{$code:this.code}}static fromExtendedJSON(n){return new f(n.$code,n.$scope)}}e.Code=f,Object.defineProperty(f.prototype,"_bsontype",{value:"Code"})});nt(wr);B_=wr.Code,kq={};typeof Object.create=="function"?Ms=function(e,f){e.super_=f,e.prototype=Object.create(f.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}:Ms=function(e,f){e.super_=f;var r=function(){};r.prototype=f.prototype,e.prototype=new r,e.prototype.constructor=e};Tq=Ms,_q=/%[sdj%]/g;Lo={};Df.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]};Df.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"};zq=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];Cq={inherits:Tq,_extend:gb,log:Dq,isBuffer:Pq,isPrimitive:Rq,isFunction:Vo,isError:Yo,isDate:Js,isObject:cn,isRegExp:Wo,isUndefined:Cf,isSymbol:Nq,isString:Ko,isNumber:hb,isNullOrUndefined:Hq,isNull:Mo,isBoolean:Gs,isArray:db,inspect:Df,deprecate:cb,format:Ks,debuglog:Bq},Ce=Ze(function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.deprecate=e.isObjectLike=e.isDate=e.isBuffer=e.haveBuffer=e.isBigUInt64Array=e.isBigInt64Array=e.isUint8Array=e.randomBytes=e.normalizedFunctionString=void 0;function f(m){return m.toString().replace("function(","function (")}e.normalizedFunctionString=f;function r(m){let j=se.Buffer.alloc(m);for(let B=0;B<m;++B)j[B]=Math.floor(Math.random()*256);return j}if(e.randomBytes=r,typeof window!="undefined"&&window.crypto&&window.crypto.getRandomValues)e.randomBytes=m=>window.crypto.getRandomValues(se.Buffer.alloc(m));else{try{e.randomBytes=kq.randomBytes}catch{}e.randomBytes==null&&(e.randomBytes=r)}function n(m){return Object.prototype.toString.call(m)==="[object Uint8Array]"}e.isUint8Array=n;function i(m){return Object.prototype.toString.call(m)==="[object BigInt64Array]"}e.isBigInt64Array=i;function o(m){return Object.prototype.toString.call(m)==="[object BigUint64Array]"}e.isBigUInt64Array=o;function s(){return typeof Co!="undefined"&&typeof Co.Buffer!="undefined"}e.haveBuffer=s;function a(m){return s()&&se.Buffer.isBuffer(m)}e.isBuffer=a;function p(m){return w(m)&&Object.prototype.toString.call(m)==="[object Date]"}e.isDate=p;function w(m){return typeof m=="object"&&m!==null}e.isObjectLike=w;function g(m,j){if(typeof window=="undefined"||typeof self=="undefined")return Cq.deprecate(m,j);let B=!1;function v(...R){return B||(console.warn(j),B=!0),m.apply(this,...R)}return v}e.deprecate=g});nt(Ce);x_=Ce.deprecate,E_=Ce.isObjectLike,I_=Ce.isDate,S_=Ce.isBuffer,A_=Ce.haveBuffer,O_=Ce.isBigUInt64Array,H_=Ce.isBigInt64Array,N_=Ce.isUint8Array,R_=Ce.randomBytes,P_=Ce.normalizedFunctionString,mf=Ze(function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.DBRef=e.isDBRefLike=void 0;function f(n){return Ce.isObjectLike(n)&&n.$id!=null&&n.$ref!=null}e.isDBRefLike=f;class r{constructor(i,o,s,a){let p=i.split(".");p.length===2&&(s=p.shift(),i=p.shift()),this.collection=i,this.oid=o,this.db=s,this.fields=a||{}}get namespace(){return this.collection}set namespace(i){this.collection=i}toJSON(){let i=Object.assign({$ref:this.collection,$id:this.oid},this.fields);return this.db!=null&&(i.$db=this.db),i}toExtendedJSON(i){i=i||{};let o={$ref:this.collection,$id:this.oid};return i.legacy||(this.db&&(o.$db=this.db),o=Object.assign(o,this.fields)),o}static fromExtendedJSON(i){let o=Object.assign({},i);return delete o.$ref,delete o.$id,delete o.$db,new r(i.$ref,i.$id,i.$db,o)}}e.DBRef=r,Object.defineProperty(r.prototype,"_bsontype",{value:"DBRef"})});nt(mf);z_=mf.DBRef,F_=mf.isDBRefLike,me=Ze(function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.Long=void 0;let f;try{f=new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array([0,97,115,109,1,0,0,0,1,13,2,96,0,1,127,96,4,127,127,127,127,1,127,3,7,6,0,1,1,1,1,1,6,6,1,127,1,65,0,11,7,50,6,3,109,117,108,0,1,5,100,105,118,95,115,0,2,5,100,105,118,95,117,0,3,5,114,101,109,95,115,0,4,5,114,101,109,95,117,0,5,8,103,101,116,95,104,105,103,104,0,0,10,191,1,6,4,0,35,0,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,126,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,127,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,128,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,129,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,130,34,4,66,32,135,167,36,0,32,4,167,11])),{}).exports}catch{}let r=1<<16,n=1<<24,i=r*r,o=i*i,s=o/2,a={},p={};class w{constructor(m=0,j=0,B){this.comp=w.prototype.compare,this.div=w.prototype.divide,this.eq=w.prototype.equals,this.gt=w.prototype.greaterThan,this.gte=w.prototype.greaterThanOrEqual,this.ge=w.prototype.greaterThanOrEqual,this.lt=w.prototype.lessThan,this.lte=w.prototype.lessThanOrEqual,this.mod=w.prototype.modulo,this.rem=w.prototype.modulo,this.mul=w.prototype.multiply,this.neg=w.prototype.negate,this.neq=w.prototype.notEquals,this.ne=w.prototype.notEquals,this.shl=w.prototype.shiftLeft,this.shr=w.prototype.shiftRight,this.shr_u=w.prototype.shiftRightUnsigned,this.shru=w.prototype.shiftRightUnsigned,this.sub=w.prototype.subtract,this.eqz=w.prototype.isZero,this.le=w.prototype.lessThanOrEqual,this.low=m|0,this.high=j|0,this.unsigned=!!B,Object.defineProperty(this,"__isLong__",{value:!0,configurable:!1,writable:!1,enumerable:!1})}static fromBits(m,j,B){return new w(m,j,B)}static fromInt(m,j){let B,v,R;return j?(m>>>=0,(R=0<=m&&m<256)&&(v=p[m],v)?v:(B=w.fromBits(m,(m|0)<0?-1:0,!0),R&&(p[m]=B),B)):(m|=0,(R=-128<=m&&m<128)&&(v=a[m],v)?v:(B=w.fromBits(m,m<0?-1:0,!1),R&&(a[m]=B),B))}static fromNumber(m,j){if(isNaN(m))return j?w.UZERO:w.ZERO;if(j){if(m<0)return w.UZERO;if(m>=o)return w.MAX_UNSIGNED_VALUE}else{if(m<=-s)return w.MIN_VALUE;if(m+1>=s)return w.MAX_VALUE}return m<0?w.fromNumber(-m,j).neg():w.fromBits(m%i|0,m/i|0,j)}static fromBigInt(m,j){return w.fromString(m.toString(),j)}static fromString(m,j,B){if(m.length===0)throw Error("empty string");if(m==="NaN"||m==="Infinity"||m==="+Infinity"||m==="-Infinity")return w.ZERO;if(typeof j=="number"?(B=j,j=!1):j=!!j,B=B||10,B<2||36<B)throw RangeError("radix");let v;if((v=m.indexOf("-"))>0)throw Error("interior hyphen");if(v===0)return w.fromString(m.substring(1),j,B).neg();let R=w.fromNumber(Math.pow(B,8)),D=w.ZERO;for(let z=0;z<m.length;z+=8){let G=Math.min(8,m.length-z),fe=parseInt(m.substring(z,z+G),B);if(G<8){let K=w.fromNumber(Math.pow(B,G));D=D.mul(K).add(w.fromNumber(fe))}else D=D.mul(R),D=D.add(w.fromNumber(fe))}return D.unsigned=j,D}static fromBytes(m,j,B){return B?w.fromBytesLE(m,j):w.fromBytesBE(m,j)}static fromBytesLE(m,j){return new w(m[0]|m[1]<<8|m[2]<<16|m[3]<<24,m[4]|m[5]<<8|m[6]<<16|m[7]<<24,j)}static fromBytesBE(m,j){return new w(m[4]<<24|m[5]<<16|m[6]<<8|m[7],m[0]<<24|m[1]<<16|m[2]<<8|m[3],j)}static isLong(m){return Ce.isObjectLike(m)&&m.__isLong__===!0}static fromValue(m,j){return typeof m=="number"?w.fromNumber(m,j):typeof m=="string"?w.fromString(m,j):w.fromBits(m.low,m.high,typeof j=="boolean"?j:m.unsigned)}add(m){w.isLong(m)||(m=w.fromValue(m));let j=this.high>>>16,B=this.high&65535,v=this.low>>>16,R=this.low&65535,D=m.high>>>16,z=m.high&65535,G=m.low>>>16,fe=m.low&65535,K=0,O=0,te=0,L=0;return L+=R+fe,te+=L>>>16,L&=65535,te+=v+G,O+=te>>>16,te&=65535,O+=B+z,K+=O>>>16,O&=65535,K+=j+D,K&=65535,w.fromBits(te<<16|L,K<<16|O,this.unsigned)}and(m){return w.isLong(m)||(m=w.fromValue(m)),w.fromBits(this.low&m.low,this.high&m.high,this.unsigned)}compare(m){if(w.isLong(m)||(m=w.fromValue(m)),this.eq(m))return 0;let j=this.isNegative(),B=m.isNegative();return j&&!B?-1:!j&&B?1:this.unsigned?m.high>>>0>this.high>>>0||m.high===this.high&&m.low>>>0>this.low>>>0?-1:1:this.sub(m).isNegative()?-1:1}divide(m){if(w.isLong(m)||(m=w.fromValue(m)),m.isZero())throw Error("division by zero");if(f){if(!this.unsigned&&this.high===-2147483648&&m.low===-1&&m.high===-1)return this;let R=(this.unsigned?f.div_u:f.div_s)(this.low,this.high,m.low,m.high);return w.fromBits(R,f.get_high(),this.unsigned)}if(this.isZero())return this.unsigned?w.UZERO:w.ZERO;let j,B,v;if(this.unsigned){if(m.unsigned||(m=m.toUnsigned()),m.gt(this))return w.UZERO;if(m.gt(this.shru(1)))return w.UONE;v=w.UZERO}else{if(this.eq(w.MIN_VALUE))return m.eq(w.ONE)||m.eq(w.NEG_ONE)?w.MIN_VALUE:m.eq(w.MIN_VALUE)?w.ONE:(j=this.shr(1).div(m).shl(1),j.eq(w.ZERO)?m.isNegative()?w.ONE:w.NEG_ONE:(B=this.sub(m.mul(j)),v=j.add(B.div(m)),v));if(m.eq(w.MIN_VALUE))return this.unsigned?w.UZERO:w.ZERO;if(this.isNegative())return m.isNegative()?this.neg().div(m.neg()):this.neg().div(m).neg();if(m.isNegative())return this.div(m.neg()).neg();v=w.ZERO}for(B=this;B.gte(m);){j=Math.max(1,Math.floor(B.toNumber()/m.toNumber()));let R=Math.ceil(Math.log(j)/Math.LN2),D=R<=48?1:Math.pow(2,R-48),z=w.fromNumber(j),G=z.mul(m);for(;G.isNegative()||G.gt(B);)j-=D,z=w.fromNumber(j,this.unsigned),G=z.mul(m);z.isZero()&&(z=w.ONE),v=v.add(z),B=B.sub(G)}return v}equals(m){return w.isLong(m)||(m=w.fromValue(m)),this.unsigned!==m.unsigned&&this.high>>>31==1&&m.high>>>31==1?!1:this.high===m.high&&this.low===m.low}getHighBits(){return this.high}getHighBitsUnsigned(){return this.high>>>0}getLowBits(){return this.low}getLowBitsUnsigned(){return this.low>>>0}getNumBitsAbs(){if(this.isNegative())return this.eq(w.MIN_VALUE)?64:this.neg().getNumBitsAbs();let m=this.high!==0?this.high:this.low,j;for(j=31;j>0&&(m&1<<j)==0;j--);return this.high!==0?j+33:j+1}greaterThan(m){return this.comp(m)>0}greaterThanOrEqual(m){return this.comp(m)>=0}isEven(){return(this.low&1)==0}isNegative(){return!this.unsigned&&this.high<0}isOdd(){return(this.low&1)==1}isPositive(){return this.unsigned||this.high>=0}isZero(){return this.high===0&&this.low===0}lessThan(m){return this.comp(m)<0}lessThanOrEqual(m){return this.comp(m)<=0}modulo(m){if(w.isLong(m)||(m=w.fromValue(m)),f){let j=(this.unsigned?f.rem_u:f.rem_s)(this.low,this.high,m.low,m.high);return w.fromBits(j,f.get_high(),this.unsigned)}return this.sub(this.div(m).mul(m))}multiply(m){if(this.isZero())return w.ZERO;if(w.isLong(m)||(m=w.fromValue(m)),f){let re=f.mul(this.low,this.high,m.low,m.high);return w.fromBits(re,f.get_high(),this.unsigned)}if(m.isZero())return w.ZERO;if(this.eq(w.MIN_VALUE))return m.isOdd()?w.MIN_VALUE:w.ZERO;if(m.eq(w.MIN_VALUE))return this.isOdd()?w.MIN_VALUE:w.ZERO;if(this.isNegative())return m.isNegative()?this.neg().mul(m.neg()):this.neg().mul(m).neg();if(m.isNegative())return this.mul(m.neg()).neg();if(this.lt(w.TWO_PWR_24)&&m.lt(w.TWO_PWR_24))return w.fromNumber(this.toNumber()*m.toNumber(),this.unsigned);let j=this.high>>>16,B=this.high&65535,v=this.low>>>16,R=this.low&65535,D=m.high>>>16,z=m.high&65535,G=m.low>>>16,fe=m.low&65535,K=0,O=0,te=0,L=0;return L+=R*fe,te+=L>>>16,L&=65535,te+=v*fe,O+=te>>>16,te&=65535,te+=R*G,O+=te>>>16,te&=65535,O+=B*fe,K+=O>>>16,O&=65535,O+=v*G,K+=O>>>16,O&=65535,O+=R*z,K+=O>>>16,O&=65535,K+=j*fe+B*G+v*z+R*D,K&=65535,w.fromBits(te<<16|L,K<<16|O,this.unsigned)}negate(){return!this.unsigned&&this.eq(w.MIN_VALUE)?w.MIN_VALUE:this.not().add(w.ONE)}not(){return w.fromBits(~this.low,~this.high,this.unsigned)}notEquals(m){return!this.equals(m)}or(m){return w.isLong(m)||(m=w.fromValue(m)),w.fromBits(this.low|m.low,this.high|m.high,this.unsigned)}shiftLeft(m){return w.isLong(m)&&(m=m.toInt()),(m&=63)==0?this:m<32?w.fromBits(this.low<<m,this.high<<m|this.low>>>32-m,this.unsigned):w.fromBits(0,this.low<<m-32,this.unsigned)}shiftRight(m){return w.isLong(m)&&(m=m.toInt()),(m&=63)==0?this:m<32?w.fromBits(this.low>>>m|this.high<<32-m,this.high>>m,this.unsigned):w.fromBits(this.high>>m-32,this.high>=0?0:-1,this.unsigned)}shiftRightUnsigned(m){if(w.isLong(m)&&(m=m.toInt()),m&=63,m===0)return this;{let j=this.high;if(m<32){let B=this.low;return w.fromBits(B>>>m|j<<32-m,j>>>m,this.unsigned)}else return m===32?w.fromBits(j,0,this.unsigned):w.fromBits(j>>>m-32,0,this.unsigned)}}subtract(m){return w.isLong(m)||(m=w.fromValue(m)),this.add(m.neg())}toInt(){return this.unsigned?this.low>>>0:this.low}toNumber(){return this.unsigned?(this.high>>>0)*i+(this.low>>>0):this.high*i+(this.low>>>0)}toBigInt(){return BigInt(this.toString())}toBytes(m){return m?this.toBytesLE():this.toBytesBE()}toBytesLE(){let m=this.high,j=this.low;return[j&255,j>>>8&255,j>>>16&255,j>>>24,m&255,m>>>8&255,m>>>16&255,m>>>24]}toBytesBE(){let m=this.high,j=this.low;return[m>>>24,m>>>16&255,m>>>8&255,m&255,j>>>24,j>>>16&255,j>>>8&255,j&255]}toSigned(){return this.unsigned?w.fromBits(this.low,this.high,!1):this}toString(m){if(m=m||10,m<2||36<m)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative())if(this.eq(w.MIN_VALUE)){let R=w.fromNumber(m),D=this.div(R),z=D.mul(R).sub(this);return D.toString(m)+z.toInt().toString(m)}else return"-"+this.neg().toString(m);let j=w.fromNumber(Math.pow(m,6),this.unsigned),B=this,v="";for(;;){let R=B.div(j),z=(B.sub(R.mul(j)).toInt()>>>0).toString(m);if(B=R,B.isZero())return z+v;for(;z.length<6;)z="0"+z;v=""+z+v}}toUnsigned(){return this.unsigned?this:w.fromBits(this.low,this.high,!0)}xor(m){return w.isLong(m)||(m=w.fromValue(m)),w.fromBits(this.low^m.low,this.high^m.high,this.unsigned)}toExtendedJSON(m){return m&&m.relaxed?this.toNumber():{$numberLong:this.toString()}}static fromExtendedJSON(m,j){let B=w.fromString(m.$numberLong);return j&&j.relaxed?B.toNumber():B}}e.Long=w,w.TWO_PWR_24=w.fromInt(n),w.MAX_UNSIGNED_VALUE=w.fromBits(4294967295|0,4294967295|0,!0),w.ZERO=w.fromInt(0),w.UZERO=w.fromInt(0,!0),w.ONE=w.fromInt(1),w.UONE=w.fromInt(1,!0),w.NEG_ONE=w.fromInt(-1),w.MAX_VALUE=w.fromBits(4294967295|0,2147483647|0,!1),w.MIN_VALUE=w.fromBits(0,2147483648|0,!1),Object.defineProperty(w.prototype,"__isLong__",{value:!0}),Object.defineProperty(w.prototype,"_bsontype",{value:"Long"})});nt(me);D_=me.Long,dn=Ze(function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.Decimal128=void 0;let f=/^(\+|-)?(\d+|(\d*\.\d*))?(E|e)?([-+])?(\d+)?$/,r=/^(\+|-)?(Infinity|inf)$/i,n=/^(\+|-)?NaN$/i,i=6111,o=-6176,s=6176,a=34,p=[124,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0].reverse(),w=[248,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0].reverse(),g=[120,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0].reverse(),m=/^([-+])?(\d+)?$/,j=31,B=16383,v=30,R=31;function D(te){return!isNaN(parseInt(te,10))}function z(te){let L=me.Long.fromNumber(1e3*1e3*1e3),re=me.Long.fromNumber(0);if(!te.parts[0]&&!te.parts[1]&&!te.parts[2]&&!te.parts[3])return{quotient:te,rem:re};for(let h=0;h<=3;h++)re=re.shiftLeft(32),re=re.add(new me.Long(te.parts[h],0)),te.parts[h]=re.div(L).low,re=re.modulo(L);return{quotient:te,rem:re}}function G(te,L){if(!te&&!L)return{high:me.Long.fromNumber(0),low:me.Long.fromNumber(0)};let re=te.shiftRightUnsigned(32),h=new me.Long(te.getLowBits(),0),d=L.shiftRightUnsigned(32),A=new me.Long(L.getLowBits(),0),c=re.multiply(d),P=re.multiply(A),U=h.multiply(d),F=h.multiply(A);return c=c.add(P.shiftRightUnsigned(32)),P=new me.Long(P.getLowBits(),0).add(U).add(F.shiftRightUnsigned(32)),c=c.add(P.shiftRightUnsigned(32)),F=P.shiftLeft(32).add(new me.Long(F.getLowBits(),0)),{high:c,low:F}}function fe(te,L){let re=te.high>>>0,h=L.high>>>0;if(re<h)return!0;if(re===h){let d=te.low>>>0,A=L.low>>>0;if(d<A)return!0}return!1}function K(te,L){throw new TypeError(`"${te}" is not a valid Decimal128 string - ${L}`)}class O{constructor(L){this.bytes=L}static fromString(L){let re=!1,h=!1,d=!1,A=0,c=0,P=0,U=0,F=0,Z=[0],I=0,ke=0,ne=0,C=0,W=0,ve=0,oe=new me.Long(0,0),xe=new me.Long(0,0),kt=0,ae=0;if(L.length>=7e3)throw new TypeError(""+L+" not a valid Decimal128 string");let tt=L.match(f),Qf=L.match(r),Xf=L.match(n);if(!tt&&!Qf&&!Xf||L.length===0)throw new TypeError(""+L+" not a valid Decimal128 string");if(tt){let Pe=tt[2],q=tt[4],u=tt[5],b=tt[6];q&&b===void 0&&K(L,"missing exponent power"),q&&Pe===void 0&&K(L,"missing exponent base"),q===void 0&&(u||b)&&K(L,"missing e before exponent")}if((L[ae]==="+"||L[ae]==="-")&&(re=L[ae++]==="-"),!D(L[ae])&&L[ae]!=="."){if(L[ae]==="i"||L[ae]==="I")return new O(se.Buffer.from(re?w:g));if(L[ae]==="N")return new O(se.Buffer.from(p))}for(;D(L[ae])||L[ae]===".";){if(L[ae]==="."){h&&K(L,"contains multiple periods"),h=!0,ae=ae+1;continue}I<34&&(L[ae]!=="0"||d)&&(d||(F=c),d=!0,Z[ke++]=parseInt(L[ae],10),I=I+1),d&&(P=P+1),h&&(U=U+1),c=c+1,ae=ae+1}if(h&&!c)throw new TypeError(""+L+" not a valid Decimal128 string");if(L[ae]==="e"||L[ae]==="E"){let Pe=L.substr(++ae).match(m);if(!Pe||!Pe[2])return new O(se.Buffer.from(p));W=parseInt(Pe[0],10),ae=ae+Pe[0].length}if(L[ae])return new O(se.Buffer.from(p));if(ne=0,!I)ne=0,C=0,Z[0]=0,P=1,I=1,A=0;else if(C=I-1,A=P,A!==1)for(;L[F+A-1]==="0";)A=A-1;for(W<=U&&U-W>1<<14?W=o:W=W-U;W>i;){if(C=C+1,C-ne>a){if(Z.join("").match(/^0+$/)){W=i;break}K(L,"overflow")}W=W-1}for(;W<o||I<P;){if(C===0&&A<I){W=o,A=0;break}if(I<P?P=P-1:C=C-1,W<i)W=W+1;else{if(Z.join("").match(/^0+$/)){W=i;break}K(L,"overflow")}}if(C-ne+1<A){let Pe=c;h&&(F=F+1,Pe=Pe+1),re&&(F=F+1,Pe=Pe+1);let q=parseInt(L[F+C+1],10),u=0;if(q>=5&&(u=1,q===5)){for(u=Z[C]%2==1?1:0,ve=F+C+2;ve<Pe;ve++)if(parseInt(L[ve],10)){u=1;break}}if(u){let b=C;for(;b>=0;b--)if(++Z[b]>9&&(Z[b]=0,b===0))if(W<i)W=W+1,Z[b]=1;else return new O(se.Buffer.from(re?w:g))}}if(oe=me.Long.fromNumber(0),xe=me.Long.fromNumber(0),A===0)oe=me.Long.fromNumber(0),xe=me.Long.fromNumber(0);else if(C-ne<17){let Pe=ne;for(xe=me.Long.fromNumber(Z[Pe++]),oe=new me.Long(0,0);Pe<=C;Pe++)xe=xe.multiply(me.Long.fromNumber(10)),xe=xe.add(me.Long.fromNumber(Z[Pe]))}else{let Pe=ne;for(oe=me.Long.fromNumber(Z[Pe++]);Pe<=C-17;Pe++)oe=oe.multiply(me.Long.fromNumber(10)),oe=oe.add(me.Long.fromNumber(Z[Pe]));for(xe=me.Long.fromNumber(Z[Pe++]);Pe<=C;Pe++)xe=xe.multiply(me.Long.fromNumber(10)),xe=xe.add(me.Long.fromNumber(Z[Pe]))}let Ye=G(oe,me.Long.fromString("100000000000000000"));Ye.low=Ye.low.add(xe),fe(Ye.low,xe)&&(Ye.high=Ye.high.add(me.Long.fromNumber(1))),kt=W+s;let Te={low:me.Long.fromNumber(0),high:me.Long.fromNumber(0)};Ye.high.shiftRightUnsigned(49).and(me.Long.fromNumber(1)).equals(me.Long.fromNumber(1))?(Te.high=Te.high.or(me.Long.fromNumber(3).shiftLeft(61)),Te.high=Te.high.or(me.Long.fromNumber(kt).and(me.Long.fromNumber(16383).shiftLeft(47))),Te.high=Te.high.or(Ye.high.and(me.Long.fromNumber(140737488355327)))):(Te.high=Te.high.or(me.Long.fromNumber(kt&16383).shiftLeft(49)),Te.high=Te.high.or(Ye.high.and(me.Long.fromNumber(562949953421311)))),Te.low=Ye.low,re&&(Te.high=Te.high.or(me.Long.fromString("9223372036854775808")));let ft=se.Buffer.alloc(16);return ae=0,ft[ae++]=Te.low.low&255,ft[ae++]=Te.low.low>>8&255,ft[ae++]=Te.low.low>>16&255,ft[ae++]=Te.low.low>>24&255,ft[ae++]=Te.low.high&255,ft[ae++]=Te.low.high>>8&255,ft[ae++]=Te.low.high>>16&255,ft[ae++]=Te.low.high>>24&255,ft[ae++]=Te.high.low&255,ft[ae++]=Te.high.low>>8&255,ft[ae++]=Te.high.low>>16&255,ft[ae++]=Te.high.low>>24&255,ft[ae++]=Te.high.high&255,ft[ae++]=Te.high.high>>8&255,ft[ae++]=Te.high.high>>16&255,ft[ae++]=Te.high.high>>24&255,new O(ft)}toString(){let L,re=0,h=new Array(36);for(let ae=0;ae<h.length;ae++)h[ae]=0;let d=0,A=!1,c,P={parts:[0,0,0,0]},U,F,Z=[];d=0;let I=this.bytes,ke=I[d++]|I[d++]<<8|I[d++]<<16|I[d++]<<24,ne=I[d++]|I[d++]<<8|I[d++]<<16|I[d++]<<24,C=I[d++]|I[d++]<<8|I[d++]<<16|I[d++]<<24,W=I[d++]|I[d++]<<8|I[d++]<<16|I[d++]<<24;d=0,{low:new me.Long(ke,ne),high:new me.Long(C,W)}.high.lessThan(me.Long.ZERO)&&Z.push("-");let oe=W>>26&j;if(oe>>3==3){if(oe===v)return Z.join("")+"Infinity";if(oe===R)return"NaN";L=W>>15&B,c=8+(W>>14&1)}else c=W>>14&7,L=W>>17&B;let xe=L-s;if(P.parts[0]=(W&16383)+((c&15)<<14),P.parts[1]=C,P.parts[2]=ne,P.parts[3]=ke,P.parts[0]===0&&P.parts[1]===0&&P.parts[2]===0&&P.parts[3]===0)A=!0;else for(F=3;F>=0;F--){let ae=0,tt=z(P);if(P=tt.quotient,ae=tt.rem.low,!!ae)for(U=8;U>=0;U--)h[F*9+U]=ae%10,ae=Math.floor(ae/10)}if(A)re=1,h[d]=0;else for(re=36;!h[d];)re=re-1,d=d+1;let kt=re-1+xe;if(kt>=34||kt<=-7||xe>0){if(re>34)return Z.push(`${0}`),xe>0?Z.push("E+"+xe):xe<0&&Z.push("E"+xe),Z.join("");Z.push(`${h[d++]}`),re=re-1,re&&Z.push(".");for(let ae=0;ae<re;ae++)Z.push(`${h[d++]}`);Z.push("E"),kt>0?Z.push("+"+kt):Z.push(`${kt}`)}else if(xe>=0)for(let ae=0;ae<re;ae++)Z.push(`${h[d++]}`);else{let ae=re+xe;if(ae>0)for(let tt=0;tt<ae;tt++)Z.push(`${h[d++]}`);else Z.push("0");for(Z.push(".");ae++<0;)Z.push("0");for(let tt=0;tt<re-Math.max(ae-1,0);tt++)Z.push(`${h[d++]}`)}return Z.join("")}toJSON(){return{$numberDecimal:this.toString()}}toExtendedJSON(){return{$numberDecimal:this.toString()}}static fromExtendedJSON(L){return O.fromString(L.$numberDecimal)}}e.Decimal128=O,Object.defineProperty(O.prototype,"_bsontype",{value:"Decimal128"})});nt(dn);C_=dn.Decimal128,zr=Ze(function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.Double=void 0;class f{constructor(n){n instanceof Number&&(n=n.valueOf()),this.value=+n}valueOf(){return this.value}toJSON(){return this.value}toExtendedJSON(n){if(n&&(n.legacy||n.relaxed&&isFinite(this.value)))return this.value;if(Object.is(Math.sign(this.value),-0))return{$numberDouble:`-${this.value.toFixed(1)}`};let i;return Number.isInteger(this.value)?(i=this.value.toFixed(1),i.length>=13&&(i=this.value.toExponential(13).toUpperCase())):i=this.value.toString(),{$numberDouble:i}}static fromExtendedJSON(n,i){let o=parseFloat(n.$numberDouble);return i&&i.relaxed?o:new f(o)}}e.Double=f,Object.defineProperty(f.prototype,"_bsontype",{value:"Double"})});nt(zr);L_=zr.Double,Fr=Ze(function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.Int32=void 0;class f{constructor(n){n instanceof Number&&(n=n.valueOf()),this.value=+n}valueOf(){return this.value}toJSON(){return this.value}toExtendedJSON(n){return n&&(n.relaxed||n.legacy)?this.value:{$numberInt:this.value.toString()}}static fromExtendedJSON(n,i){return i&&i.relaxed?parseInt(n.$numberInt,10):new f(n.$numberInt)}}e.Int32=f,Object.defineProperty(f.prototype,"_bsontype",{value:"Int32"})});nt(Fr);U_=Fr.Int32,Go=Ze(function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.Map=void 0;let f;e.Map=f;let r=function(o){return o&&o.Math==Math&&o};function n(){return r(typeof globalThis=="object"&&globalThis)||r(typeof window=="object"&&window)||r(typeof self=="object"&&self)||r(typeof Co=="object"&&Co)||Function("return this")()}let i=n();Object.prototype.hasOwnProperty.call(i,"Map")?e.Map=f=i.Map:e.Map=f=class{constructor(s=[]){this._keys=[],this._values={};for(let a=0;a<s.length;a++){if(s[a]==null)continue;let p=s[a],w=p[0],g=p[1];this._keys.push(w),this._values[w]={v:g,i:this._keys.length-1}}}clear(){this._keys=[],this._values={}}delete(s){let a=this._values[s];return a==null?!1:(delete this._values[s],this._keys.splice(a.i,1),!0)}entries(){let s=0;return{next:()=>{let a=this._keys[s++];return{value:a!==void 0?[a,this._values[a].v]:void 0,done:a===void 0}}}}forEach(s,a){a=a||this;for(let p=0;p<this._keys.length;p++){let w=this._keys[p];s.call(a,this._values[w].v,w,a)}}get(s){return this._values[s]?this._values[s].v:void 0}has(s){return this._values[s]!=null}keys(){let s=0;return{next:()=>{let a=this._keys[s++];return{value:a!==void 0?a:void 0,done:a===void 0}}}}set(s,a){return this._values[s]?(this._values[s].v=a,this):(this._keys.push(s),this._values[s]={v:a,i:this._keys.length-1},this)}values(){let s=0;return{next:()=>{let a=this._keys[s++];return{value:a!==void 0?this._values[a].v:void 0,done:a===void 0}}}}get size(){return this._keys.length}}});nt(Go);K_=Go.Map,hn=Ze(function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.MaxKey=void 0;class f{toExtendedJSON(){return{$maxKey:1}}static fromExtendedJSON(){return new f}}e.MaxKey=f,Object.defineProperty(f.prototype,"_bsontype",{value:"MaxKey"})});nt(hn);W_=hn.MaxKey,gn=Ze(function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.MinKey=void 0;class f{toExtendedJSON(){return{$minKey:1}}static fromExtendedJSON(){return new f}}e.MinKey=f,Object.defineProperty(f.prototype,"_bsontype",{value:"MinKey"})});nt(gn);Y_=gn.MinKey,Lf=Ze(function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.ObjectId=void 0;let f=Ce.randomBytes(5),r=new RegExp("^[0-9a-fA-F]{24}$"),n=[];for(let w=0;w<256;w++)n[w]=(w<=15?"0":"")+w.toString(16);let i=[],o=0;for(;o<10;)i[48+o]=o++;for(;o<16;)i[65-10+o]=i[97-10+o]=o++;let s=Symbol("id");class a{constructor(g){if(g instanceof a&&(this[s]=g.id,this.__id=g.__id),typeof g=="object"&&g&&"id"in g&&("toHexString"in g&&typeof g.toHexString=="function"?this[s]=se.Buffer.from(g.toHexString(),"hex"):this[s]=typeof g.id=="string"?se.Buffer.from(g.id):g.id),(g==null||typeof g=="number")&&(this[s]=a.generate(typeof g=="number"?g:void 0),a.cacheHexString&&(this.__id=this.id.toString("hex"))),ArrayBuffer.isView(g)&&g.byteLength===12&&(this[s]=pr.ensureBuffer(g)),typeof g=="string")if(g.length===12){let m=se.Buffer.from(g);m.byteLength===12&&(this[s]=m)}else if(g.length===24&&r.test(g))this[s]=se.Buffer.from(g,"hex");else throw new TypeError("Argument passed in must be a Buffer or string of 12 bytes or a string of 24 hex characters");a.cacheHexString&&(this.__id=this.id.toString("hex"))}get id(){return this[s]}set id(g){this[s]=g,a.cacheHexString&&(this.__id=g.toString("hex"))}get generationTime(){return this.id.readInt32BE(0)}set generationTime(g){this.id.writeUInt32BE(g,0)}toHexString(){if(a.cacheHexString&&this.__id)return this.__id;let g=this.id.toString("hex");return a.cacheHexString&&!this.__id&&(this.__id=g),g}static getInc(){return a.index=(a.index+1)%16777215}static generate(g){typeof g!="number"&&(g=~~(Date.now()/1e3));let m=a.getInc(),j=se.Buffer.alloc(12);return j.writeUInt32BE(g,0),j[4]=f[0],j[5]=f[1],j[6]=f[2],j[7]=f[3],j[8]=f[4],j[11]=m&255,j[10]=m>>8&255,j[9]=m>>16&255,j}toString(g){return g?this.id.toString(g):this.toHexString()}toJSON(){return this.toHexString()}equals(g){return g==null?!1:g instanceof a?this.toString()===g.toString():typeof g=="string"&&a.isValid(g)&&g.length===12&&this.id instanceof se.Buffer?g===this.id.toString("binary"):typeof g=="string"&&a.isValid(g)&&g.length===24?g.toLowerCase()===this.toHexString():typeof g=="string"&&a.isValid(g)&&g.length===12?se.Buffer.from(g).equals(this.id):typeof g=="object"&&"toHexString"in g&&typeof g.toHexString=="function"?g.toHexString()===this.toHexString():!1}getTimestamp(){let g=new Date,m=this.id.readUInt32BE(0);return g.setTime(Math.floor(m)*1e3),g}static createPk(){return new a}static createFromTime(g){let m=se.Buffer.from([0,0,0,0,0,0,0,0,0,0,0,0]);return m.writeUInt32BE(g,0),new a(m)}static createFromHexString(g){if(typeof g=="undefined"||g!=null&&g.length!==24)throw new TypeError("Argument passed in must be a single String of 12 bytes or a string of 24 hex characters");return new a(se.Buffer.from(g,"hex"))}static isValid(g){return g==null?!1:typeof g=="number"?!0:typeof g=="string"?g.length===12||g.length===24&&r.test(g):g instanceof a||g instanceof se.Buffer&&g.length===12?!0:typeof g=="object"&&"toHexString"in g&&typeof g.toHexString=="function"?typeof g.id=="string"?g.id.length===12:g.toHexString().length===24&&r.test(g.id.toString("hex")):!1}toExtendedJSON(){return this.toHexString?{$oid:this.toHexString()}:{$oid:this.toString("hex")}}static fromExtendedJSON(g){return new a(g.$oid)}}e.ObjectId=a,a.index=~~(Math.random()*16777215),Object.defineProperty(a.prototype,"generate",{value:Ce.deprecate(w=>a.generate(w),"Please use the static `ObjectId.generate(time)` instead")}),Object.defineProperty(a.prototype,"getInc",{value:Ce.deprecate(()=>a.getInc(),"Please use the static `ObjectId.getInc()` instead")}),Object.defineProperty(a.prototype,"get_inc",{value:Ce.deprecate(()=>a.getInc(),"Please use the static `ObjectId.getInc()` instead")}),Object.defineProperty(a,"get_inc",{value:Ce.deprecate(()=>a.getInc(),"Please use the static `ObjectId.getInc()` instead")});let p=Symbol.for("nodejs.util.inspect.custom");Object.defineProperty(a.prototype,p,a.prototype.toString),Object.defineProperty(a.prototype,"inspect",a.prototype.toString),Object.defineProperty(a.prototype,"_bsontype",{value:"ObjectID"})});nt(Lf);V_=Lf.ObjectId,M=Ze(function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.BSON_BINARY_SUBTYPE_USER_DEFINED=e.BSON_BINARY_SUBTYPE_MD5=e.BSON_BINARY_SUBTYPE_UUID_NEW=e.BSON_BINARY_SUBTYPE_UUID=e.BSON_BINARY_SUBTYPE_BYTE_ARRAY=e.BSON_BINARY_SUBTYPE_FUNCTION=e.BSON_BINARY_SUBTYPE_DEFAULT=e.BSON_DATA_MAX_KEY=e.BSON_DATA_MIN_KEY=e.BSON_DATA_DECIMAL128=e.BSON_DATA_LONG=e.BSON_DATA_TIMESTAMP=e.BSON_DATA_INT=e.BSON_DATA_CODE_W_SCOPE=e.BSON_DATA_SYMBOL=e.BSON_DATA_CODE=e.BSON_DATA_DBPOINTER=e.BSON_DATA_REGEXP=e.BSON_DATA_NULL=e.BSON_DATA_DATE=e.BSON_DATA_BOOLEAN=e.BSON_DATA_OID=e.BSON_DATA_UNDEFINED=e.BSON_DATA_BINARY=e.BSON_DATA_ARRAY=e.BSON_DATA_OBJECT=e.BSON_DATA_STRING=e.BSON_DATA_NUMBER=e.JS_INT_MIN=e.JS_INT_MAX=e.BSON_INT64_MIN=e.BSON_INT64_MAX=e.BSON_INT32_MIN=e.BSON_INT32_MAX=void 0,e.BSON_INT32_MAX=2147483647,e.BSON_INT32_MIN=-2147483648,e.BSON_INT64_MAX=Math.pow(2,63)-1,e.BSON_INT64_MIN=-Math.pow(2,63),e.JS_INT_MAX=Math.pow(2,53),e.JS_INT_MIN=-Math.pow(2,53),e.BSON_DATA_NUMBER=1,e.BSON_DATA_STRING=2,e.BSON_DATA_OBJECT=3,e.BSON_DATA_ARRAY=4,e.BSON_DATA_BINARY=5,e.BSON_DATA_UNDEFINED=6,e.BSON_DATA_OID=7,e.BSON_DATA_BOOLEAN=8,e.BSON_DATA_DATE=9,e.BSON_DATA_NULL=10,e.BSON_DATA_REGEXP=11,e.BSON_DATA_DBPOINTER=12,e.BSON_DATA_CODE=13,e.BSON_DATA_SYMBOL=14,e.BSON_DATA_CODE_W_SCOPE=15,e.BSON_DATA_INT=16,e.BSON_DATA_TIMESTAMP=17,e.BSON_DATA_LONG=18,e.BSON_DATA_DECIMAL128=19,e.BSON_DATA_MIN_KEY=255,e.BSON_DATA_MAX_KEY=127,e.BSON_BINARY_SUBTYPE_DEFAULT=0,e.BSON_BINARY_SUBTYPE_FUNCTION=1,e.BSON_BINARY_SUBTYPE_BYTE_ARRAY=2,e.BSON_BINARY_SUBTYPE_UUID=3,e.BSON_BINARY_SUBTYPE_UUID_NEW=4,e.BSON_BINARY_SUBTYPE_MD5=5,e.BSON_BINARY_SUBTYPE_USER_DEFINED=128});nt(M);G_=M.BSON_BINARY_SUBTYPE_USER_DEFINED,J_=M.BSON_BINARY_SUBTYPE_MD5,Q_=M.BSON_BINARY_SUBTYPE_UUID_NEW,X_=M.BSON_BINARY_SUBTYPE_UUID,Z_=M.BSON_BINARY_SUBTYPE_BYTE_ARRAY,$_=M.BSON_BINARY_SUBTYPE_FUNCTION,eB=M.BSON_BINARY_SUBTYPE_DEFAULT,tB=M.BSON_DATA_MAX_KEY,fB=M.BSON_DATA_MIN_KEY,rB=M.BSON_DATA_DECIMAL128,nB=M.BSON_DATA_LONG,iB=M.BSON_DATA_TIMESTAMP,oB=M.BSON_DATA_INT,lB=M.BSON_DATA_CODE_W_SCOPE,sB=M.BSON_DATA_SYMBOL,aB=M.BSON_DATA_CODE,pB=M.BSON_DATA_DBPOINTER,wB=M.BSON_DATA_REGEXP,mB=M.BSON_DATA_NULL,uB=M.BSON_DATA_DATE,bB=M.BSON_DATA_BOOLEAN,cB=M.BSON_DATA_OID,dB=M.BSON_DATA_UNDEFINED,hB=M.BSON_DATA_BINARY,gB=M.BSON_DATA_ARRAY,jB=M.BSON_DATA_OBJECT,qB=M.BSON_DATA_STRING,yB=M.BSON_DATA_NUMBER,vB=M.JS_INT_MIN,kB=M.JS_INT_MAX,TB=M.BSON_INT64_MIN,_B=M.BSON_INT64_MAX,BB=M.BSON_INT32_MIN,xB=M.BSON_INT32_MAX,Zs=Ze(function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.calculateObjectSize=void 0;function f(n,i,o){let s=4+1;if(Array.isArray(n))for(let a=0;a<n.length;a++)s+=r(a.toString(),n[a],i,!0,o);else{n.toBSON&&(n=n.toBSON());for(let a in n)s+=r(a,n[a],i,!1,o)}return s}e.calculateObjectSize=f;function r(n,i,o=!1,s=!1,a=!1){switch(i&&i.toBSON&&(i=i.toBSON()),typeof i){case"string":return 1+se.Buffer.byteLength(n,"utf8")+1+4+se.Buffer.byteLength(i,"utf8")+1;case"number":return Math.floor(i)===i&&i>=M.JS_INT_MIN&&i<=M.JS_INT_MAX&&i>=M.BSON_INT32_MIN&&i<=M.BSON_INT32_MAX?(n!=null?se.Buffer.byteLength(n,"utf8")+1:0)+(4+1):(n!=null?se.Buffer.byteLength(n,"utf8")+1:0)+(8+1);case"undefined":return s||!a?(n!=null?se.Buffer.byteLength(n,"utf8")+1:0)+1:0;case"boolean":return(n!=null?se.Buffer.byteLength(n,"utf8")+1:0)+(1+1);case"object":if(i==null||i._bsontype==="MinKey"||i._bsontype==="MaxKey")return(n!=null?se.Buffer.byteLength(n,"utf8")+1:0)+1;if(i._bsontype==="ObjectId"||i._bsontype==="ObjectID")return(n!=null?se.Buffer.byteLength(n,"utf8")+1:0)+(12+1);if(i instanceof Date||Ce.isDate(i))return(n!=null?se.Buffer.byteLength(n,"utf8")+1:0)+(8+1);if(ArrayBuffer.isView(i)||i instanceof ArrayBuffer)return(n!=null?se.Buffer.byteLength(n,"utf8")+1:0)+(1+4+1)+i.byteLength;if(i._bsontype==="Long"||i._bsontype==="Double"||i._bsontype==="Timestamp")return(n!=null?se.Buffer.byteLength(n,"utf8")+1:0)+(8+1);if(i._bsontype==="Decimal128")return(n!=null?se.Buffer.byteLength(n,"utf8")+1:0)+(16+1);if(i._bsontype==="Code")return i.scope!=null&&Object.keys(i.scope).length>0?(n!=null?se.Buffer.byteLength(n,"utf8")+1:0)+1+4+4+se.Buffer.byteLength(i.code.toString(),"utf8")+1+f(i.scope,o,a):(n!=null?se.Buffer.byteLength(n,"utf8")+1:0)+1+4+se.Buffer.byteLength(i.code.toString(),"utf8")+1;if(i._bsontype==="Binary")return i.sub_type===Gt.Binary.SUBTYPE_BYTE_ARRAY?(n!=null?se.Buffer.byteLength(n,"utf8")+1:0)+(i.position+1+4+1+4):(n!=null?se.Buffer.byteLength(n,"utf8")+1:0)+(i.position+1+4+1);if(i._bsontype==="Symbol")return(n!=null?se.Buffer.byteLength(n,"utf8")+1:0)+se.Buffer.byteLength(i.value,"utf8")+4+1+1;if(i._bsontype==="DBRef"){let p=Object.assign({$ref:i.collection,$id:i.oid},i.fields);return i.db!=null&&(p.$db=i.db),(n!=null?se.Buffer.byteLength(n,"utf8")+1:0)+1+f(p,o,a)}else return i instanceof RegExp||Object.prototype.toString.call(i)==="[object RegExp]"?(n!=null?se.Buffer.byteLength(n,"utf8")+1:0)+1+se.Buffer.byteLength(i.source,"utf8")+1+(i.global?1:0)+(i.ignoreCase?1:0)+(i.multiline?1:0)+1:i._bsontype==="BSONRegExp"?(n!=null?se.Buffer.byteLength(n,"utf8")+1:0)+1+se.Buffer.byteLength(i.pattern,"utf8")+1+se.Buffer.byteLength(i.options,"utf8")+1:(n!=null?se.Buffer.byteLength(n,"utf8")+1:0)+f(i,o,a)+1;case"function":if(i instanceof RegExp||Object.prototype.toString.call(i)==="[object RegExp]"||String.call(i)==="[object RegExp]")return(n!=null?se.Buffer.byteLength(n,"utf8")+1:0)+1+se.Buffer.byteLength(i.source,"utf8")+1+(i.global?1:0)+(i.ignoreCase?1:0)+(i.multiline?1:0)+1;if(o&&i.scope!=null&&Object.keys(i.scope).length>0)return(n!=null?se.Buffer.byteLength(n,"utf8")+1:0)+1+4+4+se.Buffer.byteLength(Ce.normalizedFunctionString(i),"utf8")+1+f(i.scope,o,a);if(o)return(n!=null?se.Buffer.byteLength(n,"utf8")+1:0)+1+4+se.Buffer.byteLength(Ce.normalizedFunctionString(i),"utf8")+1}return 0}});nt(Zs);EB=Zs.calculateObjectSize,mr=Ze(function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.BSONRegExp=void 0;function f(n){return n.split("").sort().join("")}class r{constructor(i,o){this.pattern=i,this.options=o??"",f(this.options);for(let s=0;s<this.options.length;s++)if(!(this.options[s]==="i"||this.options[s]==="m"||this.options[s]==="x"||this.options[s]==="l"||this.options[s]==="s"||this.options[s]==="u"))throw new Error(`The regular expression option [${this.options[s]}] is not supported`)}static parseOptions(i){return i?i.split("").sort().join(""):""}toExtendedJSON(i){return i=i||{},i.legacy?{$regex:this.pattern,$options:this.options}:{$regularExpression:{pattern:this.pattern,options:this.options}}}static fromExtendedJSON(i){if("$regex"in i)if(typeof i.$regex!="string"){if(i.$regex._bsontype==="BSONRegExp")return i}else return new r(i.$regex,r.parseOptions(i.$options));if("$regularExpression"in i)return new r(i.$regularExpression.pattern,r.parseOptions(i.$regularExpression.options));throw new TypeError(`Unexpected BSONRegExp EJSON object form: ${JSON.stringify(i)}`)}}e.BSONRegExp=r,Object.defineProperty(r.prototype,"_bsontype",{value:"BSONRegExp"})});nt(mr);IB=mr.BSONRegExp,jn=Ze(function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.BSONSymbol=void 0;class f{constructor(n){this.value=n}valueOf(){return this.value}toString(){return this.value}inspect(){return this.value}toJSON(){return this.value}toExtendedJSON(){return{$symbol:this.value}}static fromExtendedJSON(n){return new f(n.$symbol)}}e.BSONSymbol=f,Object.defineProperty(f.prototype,"_bsontype",{value:"Symbol"})});nt(jn);SB=jn.BSONSymbol,ur=Ze(function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.Timestamp=e.LongWithoutOverridesClass=void 0,e.LongWithoutOverridesClass=me.Long;class f extends e.LongWithoutOverridesClass{constructor(n,i){me.Long.isLong(n)?super(n.low,n.high,!0):super(n,i,!0),Object.defineProperty(this,"_bsontype",{value:"Timestamp",writable:!1,configurable:!1,enumerable:!1})}toJSON(){return{$timestamp:this.toString()}}static fromInt(n){return new f(me.Long.fromInt(n,!0))}static fromNumber(n){return new f(me.Long.fromNumber(n,!0))}static fromBits(n,i){return new f(n,i)}static fromString(n,i){return new f(me.Long.fromString(n,!0,i))}toExtendedJSON(){return{$timestamp:{t:this.high>>>0,i:this.low>>>0}}}static fromExtendedJSON(n){return new f(n.$timestamp.i,n.$timestamp.t)}}e.Timestamp=f,f.MAX_VALUE=me.Long.MAX_UNSIGNED_VALUE});nt(ur);AB=ur.Timestamp,OB=ur.LongWithoutOverridesClass,Jo=Ze(function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.validateUtf8=void 0;let f=128,r=192,n=224,i=240,o=248,s=192,a=224,p=240,w=128;function g(m,j,B){let v=0;for(let R=j;R<B;R+=1){let D=m[R];if(v){if((D&r)!==w)return!1;v-=1}else if(D&f)if((D&n)===s)v=1;else if((D&i)===a)v=2;else if((D&o)===p)v=3;else return!1}return!v}e.validateUtf8=g});nt(Jo);HB=Jo.validateUtf8,Qo=Ze(function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.deserialize=void 0;let f=me.Long.fromNumber(M.JS_INT_MAX),r=me.Long.fromNumber(M.JS_INT_MIN),n={};function i(a,p,w){p=p??{};let g=p&&p.index?p.index:0,m=a[g]|a[g+1]<<8|a[g+2]<<16|a[g+3]<<24;if(m<5)throw new Error(`bson size must be >= 5, is ${m}`);if(p.allowObjectSmallerThanBufferSize&&a.length<m)throw new Error(`buffer length ${a.length} must be >= bson size ${m}`);if(!p.allowObjectSmallerThanBufferSize&&a.length!==m)throw new Error(`buffer length ${a.length} must === bson size ${m}`);if(m+g>a.byteLength)throw new Error(`(bson size ${m} + options.index ${g} must be <= buffer length ${a.byteLength})`);if(a[g+m-1]!==0)throw new Error("One object, sized correctly, with a spot for an EOO, but the EOO isn't 0x00");return o(a,g,p,w)}e.deserialize=i;function o(a,p,w,g=!1){let m=w.evalFunctions==null?!1:w.evalFunctions,j=w.cacheFunctions==null?!1:w.cacheFunctions,B=w.fieldsAsRaw==null?null:w.fieldsAsRaw,v=w.raw==null?!1:w.raw,R=typeof w.bsonRegExp=="boolean"?w.bsonRegExp:!1,D=w.promoteBuffers==null?!1:w.promoteBuffers,z=w.promoteLongs==null?!0:w.promoteLongs,G=w.promoteValues==null?!0:w.promoteValues,fe=p;if(a.length<5)throw new Error("corrupt bson message < 5 bytes long");let K=a[p++]|a[p++]<<8|a[p++]<<16|a[p++]<<24;if(K<5||K>a.length)throw new Error("corrupt bson message");let O=g?[]:{},te=0,L=!1;for(;!L;){let d=a[p++];if(d===0)break;let A=p;for(;a[A]!==0&&A<a.length;)A++;if(A>=a.byteLength)throw new Error("Bad BSON Document: illegal CString");let c=g?te++:a.toString("utf8",p,A);if(p=A+1,d===M.BSON_DATA_STRING){let P=a[p++]|a[p++]<<8|a[p++]<<16|a[p++]<<24;if(P<=0||P>a.length-p||a[p+P-1]!==0)throw new Error("bad string length in bson");if(!Jo.validateUtf8(a,p,p+P-1))throw new Error("Invalid UTF-8 string in BSON document");let U=a.toString("utf8",p,p+P-1);O[c]=U,p=p+P}else if(d===M.BSON_DATA_OID){let P=se.Buffer.alloc(12);a.copy(P,0,p,p+12),O[c]=new Lf.ObjectId(P),p=p+12}else if(d===M.BSON_DATA_INT&&G===!1)O[c]=new Fr.Int32(a[p++]|a[p++]<<8|a[p++]<<16|a[p++]<<24);else if(d===M.BSON_DATA_INT)O[c]=a[p++]|a[p++]<<8|a[p++]<<16|a[p++]<<24;else if(d===M.BSON_DATA_NUMBER&&G===!1)O[c]=new zr.Double(a.readDoubleLE(p)),p=p+8;else if(d===M.BSON_DATA_NUMBER)O[c]=a.readDoubleLE(p),p=p+8;else if(d===M.BSON_DATA_DATE){let P=a[p++]|a[p++]<<8|a[p++]<<16|a[p++]<<24,U=a[p++]|a[p++]<<8|a[p++]<<16|a[p++]<<24;O[c]=new Date(new me.Long(P,U).toNumber())}else if(d===M.BSON_DATA_BOOLEAN){if(a[p]!==0&&a[p]!==1)throw new Error("illegal boolean type value");O[c]=a[p++]===1}else if(d===M.BSON_DATA_OBJECT){let P=p,U=a[p]|a[p+1]<<8|a[p+2]<<16|a[p+3]<<24;if(U<=0||U>a.length-p)throw new Error("bad embedded document length in bson");v?O[c]=a.slice(p,p+U):O[c]=o(a,P,w,!1),p=p+U}else if(d===M.BSON_DATA_ARRAY){let P=p,U=a[p]|a[p+1]<<8|a[p+2]<<16|a[p+3]<<24,F=w,Z=p+U;if(B&&B[c]){F={};for(let I in w)F[I]=w[I];F.raw=!0}if(O[c]=o(a,P,F,!0),p=p+U,a[p-1]!==0)throw new Error("invalid array terminator byte");if(p!==Z)throw new Error("corrupted array bson")}else if(d===M.BSON_DATA_UNDEFINED)O[c]=void 0;else if(d===M.BSON_DATA_NULL)O[c]=null;else if(d===M.BSON_DATA_LONG){let P=a[p++]|a[p++]<<8|a[p++]<<16|a[p++]<<24,U=a[p++]|a[p++]<<8|a[p++]<<16|a[p++]<<24,F=new me.Long(P,U);z&&G===!0?O[c]=F.lessThanOrEqual(f)&&F.greaterThanOrEqual(r)?F.toNumber():F:O[c]=F}else if(d===M.BSON_DATA_DECIMAL128){let P=se.Buffer.alloc(16);a.copy(P,0,p,p+16),p=p+16;let U=new dn.Decimal128(P);"toObject"in U&&typeof U.toObject=="function"?O[c]=U.toObject():O[c]=U}else if(d===M.BSON_DATA_BINARY){let P=a[p++]|a[p++]<<8|a[p++]<<16|a[p++]<<24,U=P,F=a[p++];if(P<0)throw new Error("Negative binary type element size found");if(P>a.byteLength)throw new Error("Binary type size larger than document size");if(a.slice!=null){if(F===Gt.Binary.SUBTYPE_BYTE_ARRAY){if(P=a[p++]|a[p++]<<8|a[p++]<<16|a[p++]<<24,P<0)throw new Error("Negative binary type element size found for subtype 0x02");if(P>U-4)throw new Error("Binary type with subtype 0x02 contains too long binary size");if(P<U-4)throw new Error("Binary type with subtype 0x02 contains too short binary size")}D&&G?O[c]=a.slice(p,p+P):O[c]=new Gt.Binary(a.slice(p,p+P),F)}else{let Z=se.Buffer.alloc(P);if(F===Gt.Binary.SUBTYPE_BYTE_ARRAY){if(P=a[p++]|a[p++]<<8|a[p++]<<16|a[p++]<<24,P<0)throw new Error("Negative binary type element size found for subtype 0x02");if(P>U-4)throw new Error("Binary type with subtype 0x02 contains too long binary size");if(P<U-4)throw new Error("Binary type with subtype 0x02 contains too short binary size")}for(A=0;A<P;A++)Z[A]=a[p+A];D&&G?O[c]=Z:O[c]=new Gt.Binary(Z,F)}p=p+P}else if(d===M.BSON_DATA_REGEXP&&R===!1){for(A=p;a[A]!==0&&A<a.length;)A++;if(A>=a.length)throw new Error("Bad BSON Document: illegal CString");let P=a.toString("utf8",p,A);for(p=A+1,A=p;a[A]!==0&&A<a.length;)A++;if(A>=a.length)throw new Error("Bad BSON Document: illegal CString");let U=a.toString("utf8",p,A);p=A+1;let F=new Array(U.length);for(A=0;A<U.length;A++)switch(U[A]){case"m":F[A]="m";break;case"s":F[A]="g";break;case"i":F[A]="i";break}O[c]=new RegExp(P,F.join(""))}else if(d===M.BSON_DATA_REGEXP&&R===!0){for(A=p;a[A]!==0&&A<a.length;)A++;if(A>=a.length)throw new Error("Bad BSON Document: illegal CString");let P=a.toString("utf8",p,A);for(p=A+1,A=p;a[A]!==0&&A<a.length;)A++;if(A>=a.length)throw new Error("Bad BSON Document: illegal CString");let U=a.toString("utf8",p,A);p=A+1,O[c]=new mr.BSONRegExp(P,U)}else if(d===M.BSON_DATA_SYMBOL){let P=a[p++]|a[p++]<<8|a[p++]<<16|a[p++]<<24;if(P<=0||P>a.length-p||a[p+P-1]!==0)throw new Error("bad string length in bson");let U=a.toString("utf8",p,p+P-1);O[c]=G?U:new jn.BSONSymbol(U),p=p+P}else if(d===M.BSON_DATA_TIMESTAMP){let P=a[p++]|a[p++]<<8|a[p++]<<16|a[p++]<<24,U=a[p++]|a[p++]<<8|a[p++]<<16|a[p++]<<24;O[c]=new ur.Timestamp(P,U)}else if(d===M.BSON_DATA_MIN_KEY)O[c]=new gn.MinKey;else if(d===M.BSON_DATA_MAX_KEY)O[c]=new hn.MaxKey;else if(d===M.BSON_DATA_CODE){let P=a[p++]|a[p++]<<8|a[p++]<<16|a[p++]<<24;if(P<=0||P>a.length-p||a[p+P-1]!==0)throw new Error("bad string length in bson");let U=a.toString("utf8",p,p+P-1);m?j?O[c]=s(U,n,O):O[c]=s(U):O[c]=new wr.Code(U),p=p+P}else if(d===M.BSON_DATA_CODE_W_SCOPE){let P=a[p++]|a[p++]<<8|a[p++]<<16|a[p++]<<24;if(P<4+4+4+1)throw new Error("code_w_scope total size shorter minimum expected length");let U=a[p++]|a[p++]<<8|a[p++]<<16|a[p++]<<24;if(U<=0||U>a.length-p||a[p+U-1]!==0)throw new Error("bad string length in bson");let F=a.toString("utf8",p,p+U-1);p=p+U;let Z=p,I=a[p]|a[p+1]<<8|a[p+2]<<16|a[p+3]<<24,ke=o(a,Z,w,!1);if(p=p+I,P<4+4+I+U)throw new Error("code_w_scope total size is too short, truncating scope");if(P>4+4+I+U)throw new Error("code_w_scope total size is too long, clips outer document");m?(j?O[c]=s(F,n,O):O[c]=s(F),O[c].scope=ke):O[c]=new wr.Code(F,ke)}else if(d===M.BSON_DATA_DBPOINTER){let P=a[p++]|a[p++]<<8|a[p++]<<16|a[p++]<<24;if(P<=0||P>a.length-p||a[p+P-1]!==0)throw new Error("bad string length in bson");if(!Jo.validateUtf8(a,p,p+P-1))throw new Error("Invalid UTF-8 string in BSON document");let U=a.toString("utf8",p,p+P-1);p=p+P;let F=se.Buffer.alloc(12);a.copy(F,0,p,p+12);let Z=new Lf.ObjectId(F);p=p+12,O[c]=new mf.DBRef(U,Z)}else throw new Error("Detected unknown BSON type "+d.toString(16)+' for fieldname "'+c+'"')}if(K!==p-fe)throw g?new Error("corrupt array bson"):new Error("corrupt object bson");let re=Object.keys(O).filter(d=>d.startsWith("$")),h=!0;if(re.forEach(d=>{["$ref","$id","$db"].indexOf(d)===-1&&(h=!1)}),!h)return O;if(mf.isDBRefLike(O)){let d=Object.assign({},O);return delete d.$ref,delete d.$id,delete d.$db,new mf.DBRef(O.$ref,O.$id,O.$db,d)}return O}function s(a,p,w){return p?(p[a]==null&&(p[a]=new Function(a)),p[a].bind(w)):new Function(a)}});nt(Qo);NB=Qo.deserialize,wi=Ze(function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.EJSON=e.isBSONType=void 0;function f(v){return Ce.isObjectLike(v)&&Reflect.has(v,"_bsontype")&&typeof v._bsontype=="string"}e.isBSONType=f;let r=2147483647,n=-2147483648,i=9223372036854776e3,o=-9223372036854776e3,s={$oid:Lf.ObjectId,$binary:Gt.Binary,$uuid:Gt.Binary,$symbol:jn.BSONSymbol,$numberInt:Fr.Int32,$numberDecimal:dn.Decimal128,$numberDouble:zr.Double,$numberLong:me.Long,$minKey:gn.MinKey,$maxKey:hn.MaxKey,$regex:mr.BSONRegExp,$regularExpression:mr.BSONRegExp,$timestamp:ur.Timestamp};function a(v,R={}){if(typeof v=="number"){if(R.relaxed||R.legacy)return v;if(Math.floor(v)===v){if(v>=n&&v<=r)return new Fr.Int32(v);if(v>=o&&v<=i)return me.Long.fromNumber(v)}return new zr.Double(v)}if(v==null||typeof v!="object")return v;if(v.$undefined)return null;let D=Object.keys(v).filter(z=>z.startsWith("$")&&v[z]!=null);for(let z=0;z<D.length;z++){let G=s[D[z]];if(G)return G.fromExtendedJSON(v,R)}if(v.$date!=null){let z=v.$date,G=new Date;return R.legacy?typeof z=="number"?G.setTime(z):typeof z=="string"&&G.setTime(Date.parse(z)):typeof z=="string"?G.setTime(Date.parse(z)):me.Long.isLong(z)?G.setTime(z.toNumber()):typeof z=="number"&&R.relaxed&&G.setTime(z),G}if(v.$code!=null){let z=Object.assign({},v);return v.$scope&&(z.$scope=a(v.$scope)),wr.Code.fromExtendedJSON(v)}if(v.$ref!=null||v.$dbPointer!=null){let z=v.$ref?v:v.$dbPointer;if(z instanceof mf.DBRef)return z;let G=Object.keys(z).filter(K=>K.startsWith("$")),fe=!0;if(G.forEach(K=>{["$ref","$id","$db"].indexOf(K)===-1&&(fe=!1)}),fe)return mf.DBRef.fromExtendedJSON(z)}return v}function p(v,R){return v.map(D=>g(D,R))}function w(v){let R=v.toISOString();return v.getUTCMilliseconds()!==0?R:R.slice(0,-5)+"Z"}function g(v,R){if(Array.isArray(v))return p(v,R);if(v===void 0)return null;if(v instanceof Date){let D=v.getTime(),z=D>-1&&D<2534023188e5;return R.legacy?R.relaxed&&z?{$date:v.getTime()}:{$date:w(v)}:R.relaxed&&z?{$date:w(v)}:{$date:{$numberLong:v.getTime().toString()}}}if(typeof v=="number"&&!R.relaxed){if(Math.floor(v)===v){let D=v>=n&&v<=r,z=v>=o&&v<=i;if(D)return{$numberInt:v.toString()};if(z)return{$numberLong:v.toString()}}return{$numberDouble:v.toString()}}if(v instanceof RegExp){let D=v.flags;if(D===void 0){let G=v.toString().match(/[gimuy]*$/);G&&(D=G[0])}return new mr.BSONRegExp(v.source,D).toExtendedJSON(R)}return v!=null&&typeof v=="object"?j(v,R):v}let m={Binary:v=>new Gt.Binary(v.value(),v.sub_type),Code:v=>new wr.Code(v.code,v.scope),DBRef:v=>new mf.DBRef(v.collection||v.namespace,v.oid,v.db,v.fields),Decimal128:v=>new dn.Decimal128(v.bytes),Double:v=>new zr.Double(v.value),Int32:v=>new Fr.Int32(v.value),Long:v=>me.Long.fromBits(v.low!=null?v.low:v.low_,v.low!=null?v.high:v.high_,v.low!=null?v.unsigned:v.unsigned_),MaxKey:()=>new hn.MaxKey,MinKey:()=>new gn.MinKey,ObjectID:v=>new Lf.ObjectId(v),ObjectId:v=>new Lf.ObjectId(v),BSONRegExp:v=>new mr.BSONRegExp(v.pattern,v.options),Symbol:v=>new jn.BSONSymbol(v.value),Timestamp:v=>ur.Timestamp.fromBits(v.low,v.high)};function j(v,R){if(v==null||typeof v!="object")throw new Error("not an object instance");let D=v._bsontype;if(typeof D=="undefined"){let z={};for(let G in v)z[G]=g(v[G],R);return z}else if(f(v)){let z=v;if(typeof z.toExtendedJSON!="function"){let G=m[v._bsontype];if(!G)throw new TypeError("Unrecognized or invalid _bsontype: "+v._bsontype);z=G(z)}return D==="Code"&&z.scope?z=new wr.Code(z.code,g(z.scope,R)):D==="DBRef"&&z.oid&&(z=new mf.DBRef(z.collection,g(z.oid,R),z.db,z.fields)),z.toExtendedJSON(R)}else throw new Error("_bsontype must be a string, but was: "+typeof D)}var B;(function(v){function R(fe,K){let O=Object.assign({},{relaxed:!0,legacy:!1},K);return typeof O.relaxed=="boolean"&&(O.strict=!O.relaxed),typeof O.strict=="boolean"&&(O.relaxed=!O.strict),JSON.parse(fe,(te,L)=>a(L,O))}v.parse=R;function D(fe,K,O,te){O!=null&&typeof O=="object"&&(te=O,O=0),K!=null&&typeof K=="object"&&!Array.isArray(K)&&(te=K,K=void 0,O=0),te=Object.assign({},{relaxed:!0,legacy:!1},te);let L=g(fe,te);return JSON.stringify(L,K,O)}v.stringify=D;function z(fe,K){return K=K||{},JSON.parse(D(fe,K))}v.serialize=z;function G(fe,K){return K=K||{},R(JSON.stringify(fe),K)}v.deserialize=G})(B=e.EJSON||(e.EJSON={}))});nt(wi);RB=wi.EJSON,PB=wi.isBSONType,mi=Ze(function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.writeIEEE754=e.readIEEE754=void 0;function f(n,i,o,s,a){let p,w,g=o==="big",m=a*8-s-1,j=(1<<m)-1,B=j>>1,v=-7,R=g?0:a-1,D=g?1:-1,z=n[i+R];for(R+=D,p=z&(1<<-v)-1,z>>=-v,v+=m;v>0;p=p*256+n[i+R],R+=D,v-=8);for(w=p&(1<<-v)-1,p>>=-v,v+=s;v>0;w=w*256+n[i+R],R+=D,v-=8);if(p===0)p=1-B;else{if(p===j)return w?NaN:(z?-1:1)*(1/0);w=w+Math.pow(2,s),p=p-B}return(z?-1:1)*w*Math.pow(2,p-s)}e.readIEEE754=f;function r(n,i,o,s,a,p){let w,g,m,j=s==="big",B=p*8-a-1,v=(1<<B)-1,R=v>>1,D=a===23?Math.pow(2,-24)-Math.pow(2,-77):0,z=j?p-1:0,G=j?-1:1,fe=i<0||i===0&&1/i<0?1:0;for(i=Math.abs(i),isNaN(i)||i===1/0?(g=isNaN(i)?1:0,w=v):(w=Math.floor(Math.log(i)/Math.LN2),i*(m=Math.pow(2,-w))<1&&(w--,m*=2),w+R>=1?i+=D/m:i+=D*Math.pow(2,1-R),i*m>=2&&(w++,m/=2),w+R>=v?(g=0,w=v):w+R>=1?(g=(i*m-1)*Math.pow(2,a),w=w+R):(g=i*Math.pow(2,R-1)*Math.pow(2,a),w=0)),isNaN(i)&&(g=0);a>=8;)n[o+z]=g&255,z+=G,g/=256,a-=8;for(w=w<<a|g,isNaN(i)&&(w+=8),B+=a;B>0;)n[o+z]=w&255,z+=G,w/=256,B-=8;n[o+z-G]|=fe*128}e.writeIEEE754=r});nt(mi);zB=mi.writeIEEE754,FB=mi.readIEEE754,Xo=Ze(function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.serializeInto=void 0;let f=/\x00/,r=new Set(["$db","$ref","$id","$clusterTime"]);function n(h){return Object.prototype.toString.call(h)==="[object RegExp]"}function i(h,d,A,c,P){h[c++]=M.BSON_DATA_STRING;let U=P?h.write(d,c,void 0,"ascii"):h.write(d,c,void 0,"utf8");c=c+U+1,h[c-1]=0;let F=h.write(A,c+4,void 0,"utf8");return h[c+3]=F+1>>24&255,h[c+2]=F+1>>16&255,h[c+1]=F+1>>8&255,h[c]=F+1&255,c=c+4+F,h[c++]=0,c}function o(h,d,A,c,P){if(Number.isInteger(A)&&A>=M.BSON_INT32_MIN&&A<=M.BSON_INT32_MAX){h[c++]=M.BSON_DATA_INT;let U=P?h.write(d,c,void 0,"ascii"):h.write(d,c,void 0,"utf8");c=c+U,h[c++]=0,h[c++]=A&255,h[c++]=A>>8&255,h[c++]=A>>16&255,h[c++]=A>>24&255}else{h[c++]=M.BSON_DATA_NUMBER;let U=P?h.write(d,c,void 0,"ascii"):h.write(d,c,void 0,"utf8");c=c+U,h[c++]=0,mi.writeIEEE754(h,A,c,"little",52,8),c=c+8}return c}function s(h,d,A,c,P){h[c++]=M.BSON_DATA_NULL;let U=P?h.write(d,c,void 0,"ascii"):h.write(d,c,void 0,"utf8");return c=c+U,h[c++]=0,c}function a(h,d,A,c,P){h[c++]=M.BSON_DATA_BOOLEAN;let U=P?h.write(d,c,void 0,"ascii"):h.write(d,c,void 0,"utf8");return c=c+U,h[c++]=0,h[c++]=A?1:0,c}function p(h,d,A,c,P){h[c++]=M.BSON_DATA_DATE;let U=P?h.write(d,c,void 0,"ascii"):h.write(d,c,void 0,"utf8");c=c+U,h[c++]=0;let F=me.Long.fromNumber(A.getTime()),Z=F.getLowBits(),I=F.getHighBits();return h[c++]=Z&255,h[c++]=Z>>8&255,h[c++]=Z>>16&255,h[c++]=Z>>24&255,h[c++]=I&255,h[c++]=I>>8&255,h[c++]=I>>16&255,h[c++]=I>>24&255,c}function w(h,d,A,c,P){h[c++]=M.BSON_DATA_REGEXP;let U=P?h.write(d,c,void 0,"ascii"):h.write(d,c,void 0,"utf8");if(c=c+U,h[c++]=0,A.source&&A.source.match(f)!=null)throw Error("value "+A.source+" must not contain null bytes");return c=c+h.write(A.source,c,void 0,"utf8"),h[c++]=0,A.ignoreCase&&(h[c++]=105),A.global&&(h[c++]=115),A.multiline&&(h[c++]=109),h[c++]=0,c}function g(h,d,A,c,P){h[c++]=M.BSON_DATA_REGEXP;let U=P?h.write(d,c,void 0,"ascii"):h.write(d,c,void 0,"utf8");if(c=c+U,h[c++]=0,A.pattern.match(f)!=null)throw Error("pattern "+A.pattern+" must not contain null bytes");return c=c+h.write(A.pattern,c,void 0,"utf8"),h[c++]=0,c=c+h.write(A.options.split("").sort().join(""),c,void 0,"utf8"),h[c++]=0,c}function m(h,d,A,c,P){A===null?h[c++]=M.BSON_DATA_NULL:A._bsontype==="MinKey"?h[c++]=M.BSON_DATA_MIN_KEY:h[c++]=M.BSON_DATA_MAX_KEY;let U=P?h.write(d,c,void 0,"ascii"):h.write(d,c,void 0,"utf8");return c=c+U,h[c++]=0,c}function j(h,d,A,c,P){h[c++]=M.BSON_DATA_OID;let U=P?h.write(d,c,void 0,"ascii"):h.write(d,c,void 0,"utf8");if(c=c+U,h[c++]=0,typeof A.id=="string")h.write(A.id,c,void 0,"binary");else if(A.id&&A.id.copy)A.id.copy(h,c,0,12);else throw new TypeError("object ["+JSON.stringify(A)+"] is not a valid ObjectId");return c+12}function B(h,d,A,c,P){h[c++]=M.BSON_DATA_BINARY;let U=P?h.write(d,c,void 0,"ascii"):h.write(d,c,void 0,"utf8");c=c+U,h[c++]=0;let F=A.length;return h[c++]=F&255,h[c++]=F>>8&255,h[c++]=F>>16&255,h[c++]=F>>24&255,h[c++]=M.BSON_BINARY_SUBTYPE_DEFAULT,h.set(pr.ensureBuffer(A),c),c=c+F,c}function v(h,d,A,c,P=!1,U=0,F=!1,Z=!0,I=!1,ke=[]){for(let W=0;W<ke.length;W++)if(ke[W]===A)throw new Error("cyclic dependency detected");ke.push(A),h[c++]=Array.isArray(A)?M.BSON_DATA_ARRAY:M.BSON_DATA_OBJECT;let ne=I?h.write(d,c,void 0,"ascii"):h.write(d,c,void 0,"utf8");c=c+ne,h[c++]=0;let C=re(h,A,P,c,U+1,F,Z,ke);return ke.pop(),C}function R(h,d,A,c,P){h[c++]=M.BSON_DATA_DECIMAL128;let U=P?h.write(d,c,void 0,"ascii"):h.write(d,c,void 0,"utf8");return c=c+U,h[c++]=0,A.bytes.copy(h,c,0,16),c+16}function D(h,d,A,c,P){h[c++]=A._bsontype==="Long"?M.BSON_DATA_LONG:M.BSON_DATA_TIMESTAMP;let U=P?h.write(d,c,void 0,"ascii"):h.write(d,c,void 0,"utf8");c=c+U,h[c++]=0;let F=A.getLowBits(),Z=A.getHighBits();return h[c++]=F&255,h[c++]=F>>8&255,h[c++]=F>>16&255,h[c++]=F>>24&255,h[c++]=Z&255,h[c++]=Z>>8&255,h[c++]=Z>>16&255,h[c++]=Z>>24&255,c}function z(h,d,A,c,P){A=A.valueOf(),h[c++]=M.BSON_DATA_INT;let U=P?h.write(d,c,void 0,"ascii"):h.write(d,c,void 0,"utf8");return c=c+U,h[c++]=0,h[c++]=A&255,h[c++]=A>>8&255,h[c++]=A>>16&255,h[c++]=A>>24&255,c}function G(h,d,A,c,P){h[c++]=M.BSON_DATA_NUMBER;let U=P?h.write(d,c,void 0,"ascii"):h.write(d,c,void 0,"utf8");return c=c+U,h[c++]=0,mi.writeIEEE754(h,A.value,c,"little",52,8),c=c+8,c}function fe(h,d,A,c,P=!1,U=0,F){h[c++]=M.BSON_DATA_CODE;let Z=F?h.write(d,c,void 0,"ascii"):h.write(d,c,void 0,"utf8");c=c+Z,h[c++]=0;let I=Ce.normalizedFunctionString(A),ke=h.write(I,c+4,void 0,"utf8")+1;return h[c]=ke&255,h[c+1]=ke>>8&255,h[c+2]=ke>>16&255,h[c+3]=ke>>24&255,c=c+4+ke-1,h[c++]=0,c}function K(h,d,A,c,P=!1,U=0,F=!1,Z=!0,I=!1){if(A.scope&&typeof A.scope=="object"){h[c++]=M.BSON_DATA_CODE_W_SCOPE;let ke=I?h.write(d,c,void 0,"ascii"):h.write(d,c,void 0,"utf8");c=c+ke,h[c++]=0;let ne=c,C=typeof A.code=="string"?A.code:A.code.toString();c=c+4;let W=h.write(C,c+4,void 0,"utf8")+1;h[c]=W&255,h[c+1]=W>>8&255,h[c+2]=W>>16&255,h[c+3]=W>>24&255,h[c+4+W-1]=0,c=c+W+4;let ve=re(h,A.scope,P,c,U+1,F,Z);c=ve-1;let oe=ve-ne;h[ne++]=oe&255,h[ne++]=oe>>8&255,h[ne++]=oe>>16&255,h[ne++]=oe>>24&255,h[c++]=0}else{h[c++]=M.BSON_DATA_CODE;let ke=I?h.write(d,c,void 0,"ascii"):h.write(d,c,void 0,"utf8");c=c+ke,h[c++]=0;let ne=A.code.toString(),C=h.write(ne,c+4,void 0,"utf8")+1;h[c]=C&255,h[c+1]=C>>8&255,h[c+2]=C>>16&255,h[c+3]=C>>24&255,c=c+4+C-1,h[c++]=0}return c}function O(h,d,A,c,P){h[c++]=M.BSON_DATA_BINARY;let U=P?h.write(d,c,void 0,"ascii"):h.write(d,c,void 0,"utf8");c=c+U,h[c++]=0;let F=A.value(!0),Z=A.position;return A.sub_type===Gt.Binary.SUBTYPE_BYTE_ARRAY&&(Z=Z+4),h[c++]=Z&255,h[c++]=Z>>8&255,h[c++]=Z>>16&255,h[c++]=Z>>24&255,h[c++]=A.sub_type,A.sub_type===Gt.Binary.SUBTYPE_BYTE_ARRAY&&(Z=Z-4,h[c++]=Z&255,h[c++]=Z>>8&255,h[c++]=Z>>16&255,h[c++]=Z>>24&255),h.set(F,c),c=c+A.position,c}function te(h,d,A,c,P){h[c++]=M.BSON_DATA_SYMBOL;let U=P?h.write(d,c,void 0,"ascii"):h.write(d,c,void 0,"utf8");c=c+U,h[c++]=0;let F=h.write(A.value,c+4,void 0,"utf8")+1;return h[c]=F&255,h[c+1]=F>>8&255,h[c+2]=F>>16&255,h[c+3]=F>>24&255,c=c+4+F-1,h[c++]=0,c}function L(h,d,A,c,P,U,F){h[c++]=M.BSON_DATA_OBJECT;let Z=F?h.write(d,c,void 0,"ascii"):h.write(d,c,void 0,"utf8");c=c+Z,h[c++]=0;let I=c,ke={$ref:A.collection||A.namespace,$id:A.oid};A.db!=null&&(ke.$db=A.db),ke=Object.assign(ke,A.fields);let ne=re(h,ke,!1,c,P+1,U),C=ne-I;return h[I++]=C&255,h[I++]=C>>8&255,h[I++]=C>>16&255,h[I++]=C>>24&255,ne}function re(h,d,A=!1,c=0,P=0,U=!1,F=!0,Z=[]){c=c||0,Z=Z||[],Z.push(d);let I=c+4;if(Array.isArray(d))for(let ne=0;ne<d.length;ne++){let C=""+ne,W=d[ne];if(W&&W.toBSON){if(typeof W.toBSON!="function")throw new TypeError("toBSON is not a function");W=W.toBSON()}if(typeof W=="string")I=i(h,C,W,I,!0);else if(typeof W=="number")I=o(h,C,W,I,!0);else{if(typeof W=="bigint")throw new TypeError("Unsupported type BigInt, please use Decimal128");if(typeof W=="boolean")I=a(h,C,W,I,!0);else if(W instanceof Date||Ce.isDate(W))I=p(h,C,W,I,!0);else if(W===void 0)I=s(h,C,W,I,!0);else if(W===null)I=s(h,C,W,I,!0);else if(W._bsontype==="ObjectId"||W._bsontype==="ObjectID")I=j(h,C,W,I,!0);else if(se.Buffer.isBuffer(W)||Ce.isUint8Array(W))I=B(h,C,W,I,!0);else if(W instanceof RegExp||n(W))I=w(h,C,W,I,!0);else if(typeof W=="object"&&W._bsontype==null)I=v(h,C,W,I,A,P,U,F,!0,Z);else if(typeof W=="object"&&wi.isBSONType(W)&&W._bsontype==="Decimal128")I=R(h,C,W,I,!0);else if(W._bsontype==="Long"||W._bsontype==="Timestamp")I=D(h,C,W,I,!0);else if(W._bsontype==="Double")I=G(h,C,W,I,!0);else if(typeof W=="function"&&U)I=fe(h,C,W,I,A,P,!0);else if(W._bsontype==="Code")I=K(h,C,W,I,A,P,U,F,!0);else if(W._bsontype==="Binary")I=O(h,C,W,I,!0);else if(W._bsontype==="Symbol")I=te(h,C,W,I,!0);else if(W._bsontype==="DBRef")I=L(h,C,W,I,P,U,!0);else if(W._bsontype==="BSONRegExp")I=g(h,C,W,I,!0);else if(W._bsontype==="Int32")I=z(h,C,W,I,!0);else if(W._bsontype==="MinKey"||W._bsontype==="MaxKey")I=m(h,C,W,I,!0);else if(typeof W._bsontype!="undefined")throw new TypeError("Unrecognized or invalid _bsontype: "+W._bsontype)}}else if(d instanceof Go.Map){let ne=d.entries(),C=!1;for(;!C;){let W=ne.next();if(C=!!W.done,C)continue;let ve=W.value[0],oe=W.value[1],xe=typeof oe;if(typeof ve=="string"&&!r.has(ve)){if(ve.match(f)!=null)throw Error("key "+ve+" must not contain null bytes");if(A){if(ve[0]==="$")throw Error("key "+ve+" must not start with '$'");if(~ve.indexOf("."))throw Error("key "+ve+" must not contain '.'")}}if(xe==="string")I=i(h,ve,oe,I);else if(xe==="number")I=o(h,ve,oe,I);else{if(xe==="bigint"||Ce.isBigInt64Array(oe)||Ce.isBigUInt64Array(oe))throw new TypeError("Unsupported type BigInt, please use Decimal128");if(xe==="boolean")I=a(h,ve,oe,I);else if(oe instanceof Date||Ce.isDate(oe))I=p(h,ve,oe,I);else if(oe===null||oe===void 0&&F===!1)I=s(h,ve,oe,I);else if(oe._bsontype==="ObjectId"||oe._bsontype==="ObjectID")I=j(h,ve,oe,I);else if(se.Buffer.isBuffer(oe)||Ce.isUint8Array(oe))I=B(h,ve,oe,I);else if(oe instanceof RegExp||n(oe))I=w(h,ve,oe,I);else if(xe==="object"&&oe._bsontype==null)I=v(h,ve,oe,I,A,P,U,F,!1,Z);else if(xe==="object"&&oe._bsontype==="Decimal128")I=R(h,ve,oe,I);else if(oe._bsontype==="Long"||oe._bsontype==="Timestamp")I=D(h,ve,oe,I);else if(oe._bsontype==="Double")I=G(h,ve,oe,I);else if(oe._bsontype==="Code")I=K(h,ve,oe,I,A,P,U,F);else if(typeof oe=="function"&&U)I=fe(h,ve,oe,I,A,P,U);else if(oe._bsontype==="Binary")I=O(h,ve,oe,I);else if(oe._bsontype==="Symbol")I=te(h,ve,oe,I);else if(oe._bsontype==="DBRef")I=L(h,ve,oe,I,P,U);else if(oe._bsontype==="BSONRegExp")I=g(h,ve,oe,I);else if(oe._bsontype==="Int32")I=z(h,ve,oe,I);else if(oe._bsontype==="MinKey"||oe._bsontype==="MaxKey")I=m(h,ve,oe,I);else if(typeof oe._bsontype!="undefined")throw new TypeError("Unrecognized or invalid _bsontype: "+oe._bsontype)}}}else{if(d.toBSON){if(typeof d.toBSON!="function")throw new TypeError("toBSON is not a function");if(d=d.toBSON(),d!=null&&typeof d!="object")throw new TypeError("toBSON function did not return an object")}for(let ne in d){let C=d[ne];if(C&&C.toBSON){if(typeof C.toBSON!="function")throw new TypeError("toBSON is not a function");C=C.toBSON()}let W=typeof C;if(typeof ne=="string"&&!r.has(ne)){if(ne.match(f)!=null)throw Error("key "+ne+" must not contain null bytes");if(A){if(ne[0]==="$")throw Error("key "+ne+" must not start with '$'");if(~ne.indexOf("."))throw Error("key "+ne+" must not contain '.'")}}if(W==="string")I=i(h,ne,C,I);else if(W==="number")I=o(h,ne,C,I);else{if(W==="bigint")throw new TypeError("Unsupported type BigInt, please use Decimal128");if(W==="boolean")I=a(h,ne,C,I);else if(C instanceof Date||Ce.isDate(C))I=p(h,ne,C,I);else if(C===void 0)F===!1&&(I=s(h,ne,C,I));else if(C===null)I=s(h,ne,C,I);else if(C._bsontype==="ObjectId"||C._bsontype==="ObjectID")I=j(h,ne,C,I);else if(se.Buffer.isBuffer(C)||Ce.isUint8Array(C))I=B(h,ne,C,I);else if(C instanceof RegExp||n(C))I=w(h,ne,C,I);else if(W==="object"&&C._bsontype==null)I=v(h,ne,C,I,A,P,U,F,!1,Z);else if(W==="object"&&C._bsontype==="Decimal128")I=R(h,ne,C,I);else if(C._bsontype==="Long"||C._bsontype==="Timestamp")I=D(h,ne,C,I);else if(C._bsontype==="Double")I=G(h,ne,C,I);else if(C._bsontype==="Code")I=K(h,ne,C,I,A,P,U,F);else if(typeof C=="function"&&U)I=fe(h,ne,C,I,A,P,U);else if(C._bsontype==="Binary")I=O(h,ne,C,I);else if(C._bsontype==="Symbol")I=te(h,ne,C,I);else if(C._bsontype==="DBRef")I=L(h,ne,C,I,P,U);else if(C._bsontype==="BSONRegExp")I=g(h,ne,C,I);else if(C._bsontype==="Int32")I=z(h,ne,C,I);else if(C._bsontype==="MinKey"||C._bsontype==="MaxKey")I=m(h,ne,C,I);else if(typeof C._bsontype!="undefined")throw new TypeError("Unrecognized or invalid _bsontype: "+C._bsontype)}}}Z.pop(),h[I++]=0;let ke=I-c;return h[c++]=ke&255,h[c++]=ke>>8&255,h[c++]=ke>>16&255,h[c++]=ke>>24&255,I}e.serializeInto=re});nt(Xo);DB=Xo.serializeInto,ue=Ze(function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.deserializeStream=e.calculateObjectSize=e.deserialize=e.serializeWithBufferAndIndex=e.serialize=e.setInternalBufferSize=e.ObjectID=e.Decimal128=e.BSONRegExp=e.MaxKey=e.MinKey=e.Int32=e.Double=e.Timestamp=e.Long=e.ObjectId=e.Binary=e.DBRef=e.BSONSymbol=e.Map=e.Code=e.LongWithoutOverridesClass=e.EJSON=e.JS_INT_MIN=e.JS_INT_MAX=e.BSON_INT64_MIN=e.BSON_INT64_MAX=e.BSON_INT32_MIN=e.BSON_INT32_MAX=e.BSON_DATA_UNDEFINED=e.BSON_DATA_TIMESTAMP=e.BSON_DATA_SYMBOL=e.BSON_DATA_STRING=e.BSON_DATA_REGEXP=e.BSON_DATA_OID=e.BSON_DATA_OBJECT=e.BSON_DATA_NUMBER=e.BSON_DATA_NULL=e.BSON_DATA_MIN_KEY=e.BSON_DATA_MAX_KEY=e.BSON_DATA_LONG=e.BSON_DATA_INT=e.BSON_DATA_DECIMAL128=e.BSON_DATA_DBPOINTER=e.BSON_DATA_DATE=e.BSON_DATA_CODE_W_SCOPE=e.BSON_DATA_CODE=e.BSON_DATA_BOOLEAN=e.BSON_DATA_BINARY=e.BSON_DATA_ARRAY=e.BSON_BINARY_SUBTYPE_UUID_NEW=e.BSON_BINARY_SUBTYPE_UUID=e.BSON_BINARY_SUBTYPE_USER_DEFINED=e.BSON_BINARY_SUBTYPE_MD5=e.BSON_BINARY_SUBTYPE_FUNCTION=e.BSON_BINARY_SUBTYPE_DEFAULT=e.BSON_BINARY_SUBTYPE_BYTE_ARRAY=void 0,Object.defineProperty(e,"Binary",{enumerable:!0,get:function(){return Gt.Binary}}),Object.defineProperty(e,"Code",{enumerable:!0,get:function(){return wr.Code}}),Object.defineProperty(e,"DBRef",{enumerable:!0,get:function(){return mf.DBRef}}),Object.defineProperty(e,"Decimal128",{enumerable:!0,get:function(){return dn.Decimal128}}),Object.defineProperty(e,"Double",{enumerable:!0,get:function(){return zr.Double}}),Object.defineProperty(e,"Int32",{enumerable:!0,get:function(){return Fr.Int32}}),Object.defineProperty(e,"Long",{enumerable:!0,get:function(){return me.Long}}),Object.defineProperty(e,"Map",{enumerable:!0,get:function(){return Go.Map}}),Object.defineProperty(e,"MaxKey",{enumerable:!0,get:function(){return hn.MaxKey}}),Object.defineProperty(e,"MinKey",{enumerable:!0,get:function(){return gn.MinKey}}),Object.defineProperty(e,"ObjectId",{enumerable:!0,get:function(){return Lf.ObjectId}}),Object.defineProperty(e,"ObjectID",{enumerable:!0,get:function(){return Lf.ObjectId}}),Object.defineProperty(e,"BSONRegExp",{enumerable:!0,get:function(){return mr.BSONRegExp}}),Object.defineProperty(e,"BSONSymbol",{enumerable:!0,get:function(){return jn.BSONSymbol}}),Object.defineProperty(e,"Timestamp",{enumerable:!0,get:function(){return ur.Timestamp}}),Object.defineProperty(e,"BSON_BINARY_SUBTYPE_BYTE_ARRAY",{enumerable:!0,get:function(){return M.BSON_BINARY_SUBTYPE_BYTE_ARRAY}}),Object.defineProperty(e,"BSON_BINARY_SUBTYPE_DEFAULT",{enumerable:!0,get:function(){return M.BSON_BINARY_SUBTYPE_DEFAULT}}),Object.defineProperty(e,"BSON_BINARY_SUBTYPE_FUNCTION",{enumerable:!0,get:function(){return M.BSON_BINARY_SUBTYPE_FUNCTION}}),Object.defineProperty(e,"BSON_BINARY_SUBTYPE_MD5",{enumerable:!0,get:function(){return M.BSON_BINARY_SUBTYPE_MD5}}),Object.defineProperty(e,"BSON_BINARY_SUBTYPE_USER_DEFINED",{enumerable:!0,get:function(){return M.BSON_BINARY_SUBTYPE_USER_DEFINED}}),Object.defineProperty(e,"BSON_BINARY_SUBTYPE_UUID",{enumerable:!0,get:function(){return M.BSON_BINARY_SUBTYPE_UUID}}),Object.defineProperty(e,"BSON_BINARY_SUBTYPE_UUID_NEW",{enumerable:!0,get:function(){return M.BSON_BINARY_SUBTYPE_UUID_NEW}}),Object.defineProperty(e,"BSON_DATA_ARRAY",{enumerable:!0,get:function(){return M.BSON_DATA_ARRAY}}),Object.defineProperty(e,"BSON_DATA_BINARY",{enumerable:!0,get:function(){return M.BSON_DATA_BINARY}}),Object.defineProperty(e,"BSON_DATA_BOOLEAN",{enumerable:!0,get:function(){return M.BSON_DATA_BOOLEAN}}),Object.defineProperty(e,"BSON_DATA_CODE",{enumerable:!0,get:function(){return M.BSON_DATA_CODE}}),Object.defineProperty(e,"BSON_DATA_CODE_W_SCOPE",{enumerable:!0,get:function(){return M.BSON_DATA_CODE_W_SCOPE}}),Object.defineProperty(e,"BSON_DATA_DATE",{enumerable:!0,get:function(){return M.BSON_DATA_DATE}}),Object.defineProperty(e,"BSON_DATA_DBPOINTER",{enumerable:!0,get:function(){return M.BSON_DATA_DBPOINTER}}),Object.defineProperty(e,"BSON_DATA_DECIMAL128",{enumerable:!0,get:function(){return M.BSON_DATA_DECIMAL128}}),Object.defineProperty(e,"BSON_DATA_INT",{enumerable:!0,get:function(){return M.BSON_DATA_INT}}),Object.defineProperty(e,"BSON_DATA_LONG",{enumerable:!0,get:function(){return M.BSON_DATA_LONG}}),Object.defineProperty(e,"BSON_DATA_MAX_KEY",{enumerable:!0,get:function(){return M.BSON_DATA_MAX_KEY}}),Object.defineProperty(e,"BSON_DATA_MIN_KEY",{enumerable:!0,get:function(){return M.BSON_DATA_MIN_KEY}}),Object.defineProperty(e,"BSON_DATA_NULL",{enumerable:!0,get:function(){return M.BSON_DATA_NULL}}),Object.defineProperty(e,"BSON_DATA_NUMBER",{enumerable:!0,get:function(){return M.BSON_DATA_NUMBER}}),Object.defineProperty(e,"BSON_DATA_OBJECT",{enumerable:!0,get:function(){return M.BSON_DATA_OBJECT}}),Object.defineProperty(e,"BSON_DATA_OID",{enumerable:!0,get:function(){return M.BSON_DATA_OID}}),Object.defineProperty(e,"BSON_DATA_REGEXP",{enumerable:!0,get:function(){return M.BSON_DATA_REGEXP}}),Object.defineProperty(e,"BSON_DATA_STRING",{enumerable:!0,get:function(){return M.BSON_DATA_STRING}}),Object.defineProperty(e,"BSON_DATA_SYMBOL",{enumerable:!0,get:function(){return M.BSON_DATA_SYMBOL}}),Object.defineProperty(e,"BSON_DATA_TIMESTAMP",{enumerable:!0,get:function(){return M.BSON_DATA_TIMESTAMP}}),Object.defineProperty(e,"BSON_DATA_UNDEFINED",{enumerable:!0,get:function(){return M.BSON_DATA_UNDEFINED}}),Object.defineProperty(e,"BSON_INT32_MAX",{enumerable:!0,get:function(){return M.BSON_INT32_MAX}}),Object.defineProperty(e,"BSON_INT32_MIN",{enumerable:!0,get:function(){return M.BSON_INT32_MIN}}),Object.defineProperty(e,"BSON_INT64_MAX",{enumerable:!0,get:function(){return M.BSON_INT64_MAX}}),Object.defineProperty(e,"BSON_INT64_MIN",{enumerable:!0,get:function(){return M.BSON_INT64_MIN}}),Object.defineProperty(e,"JS_INT_MAX",{enumerable:!0,get:function(){return M.JS_INT_MAX}}),Object.defineProperty(e,"JS_INT_MIN",{enumerable:!0,get:function(){return M.JS_INT_MIN}}),Object.defineProperty(e,"EJSON",{enumerable:!0,get:function(){return wi.EJSON}});var f=ur;Object.defineProperty(e,"LongWithoutOverridesClass",{enumerable:!0,get:function(){return f.LongWithoutOverridesClass}});let r=1024*1024*17,n=se.Buffer.alloc(r);function i(g){n.length<g&&(n=se.Buffer.alloc(g))}e.setInternalBufferSize=i;function o(g,m={}){let j=typeof m.checkKeys=="boolean"?m.checkKeys:!1,B=typeof m.serializeFunctions=="boolean"?m.serializeFunctions:!1,v=typeof m.ignoreUndefined=="boolean"?m.ignoreUndefined:!0,R=typeof m.minInternalBufferSize=="number"?m.minInternalBufferSize:r;n.length<R&&(n=se.Buffer.alloc(R));let D=Xo.serializeInto(n,g,j,0,0,B,v,[]),z=se.Buffer.alloc(D);return n.copy(z,0,0,z.length),z}e.serialize=o;function s(g,m,j={}){let B=typeof j.checkKeys=="boolean"?j.checkKeys:!1,v=typeof j.serializeFunctions=="boolean"?j.serializeFunctions:!1,R=typeof j.ignoreUndefined=="boolean"?j.ignoreUndefined:!0,D=typeof j.index=="number"?j.index:0,z=Xo.serializeInto(n,g,B,0,0,v,R);return n.copy(m,D,0,z),D+z-1}e.serializeWithBufferAndIndex=s;function a(g,m={}){return Qo.deserialize(pr.ensureBuffer(g),m)}e.deserialize=a;function p(g,m={}){m=m||{};let j=typeof m.serializeFunctions=="boolean"?m.serializeFunctions:!1,B=typeof m.ignoreUndefined=="boolean"?m.ignoreUndefined:!0;return Zs.calculateObjectSize(g,j,B)}e.calculateObjectSize=p;function w(g,m,j,B,v,R){let D=Object.assign({allowObjectSmallerThanBufferSize:!0,index:0},R),z=pr.ensureBuffer(g),G=m;for(let fe=0;fe<j;fe++){let K=z[G]|z[G+1]<<8|z[G+2]<<16|z[G+3]<<24;D.index=G,B[v+fe]=Qo.deserialize(z,D),G=G+K}return G}e.deserializeStream=w}),CB=nt(ue),LB=ue.deserializeStream,UB=ue.calculateObjectSize,qb=ue.deserialize,MB=ue.serializeWithBufferAndIndex,yb=ue.serialize,KB=ue.setInternalBufferSize,WB=ue.ObjectID,YB=ue.Decimal128,VB=ue.BSONRegExp,GB=ue.MaxKey,JB=ue.MinKey,QB=ue.Int32,XB=ue.Double,ZB=ue.Timestamp,$B=ue.Long,ex=ue.ObjectId,tx=ue.Binary,fx=ue.DBRef,rx=ue.BSONSymbol,nx=ue.Map,ix=ue.Code,ox=ue.LongWithoutOverridesClass,lx=ue.EJSON,sx=ue.JS_INT_MIN,ax=ue.JS_INT_MAX,px=ue.BSON_INT64_MIN,wx=ue.BSON_INT64_MAX,mx=ue.BSON_INT32_MIN,ux=ue.BSON_INT32_MAX,bx=ue.BSON_DATA_UNDEFINED,cx=ue.BSON_DATA_TIMESTAMP,dx=ue.BSON_DATA_SYMBOL,hx=ue.BSON_DATA_STRING,gx=ue.BSON_DATA_REGEXP,jx=ue.BSON_DATA_OID,qx=ue.BSON_DATA_OBJECT,yx=ue.BSON_DATA_NUMBER,vx=ue.BSON_DATA_NULL,kx=ue.BSON_DATA_MIN_KEY,Tx=ue.BSON_DATA_MAX_KEY,_x=ue.BSON_DATA_LONG,Bx=ue.BSON_DATA_INT,xx=ue.BSON_DATA_DECIMAL128,Ex=ue.BSON_DATA_DBPOINTER,Ix=ue.BSON_DATA_DATE,Sx=ue.BSON_DATA_CODE_W_SCOPE,Ax=ue.BSON_DATA_CODE,Ox=ue.BSON_DATA_BOOLEAN,Hx=ue.BSON_DATA_BINARY,Nx=ue.BSON_DATA_ARRAY,Rx=ue.BSON_BINARY_SUBTYPE_UUID_NEW,Px=ue.BSON_BINARY_SUBTYPE_UUID,zx=ue.BSON_BINARY_SUBTYPE_USER_DEFINED,Fx=ue.BSON_BINARY_SUBTYPE_MD5,Dx=ue.BSON_BINARY_SUBTYPE_FUNCTION,Cx=ue.BSON_BINARY_SUBTYPE_DEFAULT,Lx=ue.BSON_BINARY_SUBTYPE_BYTE_ARRAY});function ea(t,e){return qb(new Uint8Array(t),e)}var vb=J(()=>{$s()});async function Uq(t,e){let f={...ui.options.bson,...e==null?void 0:e.bson};return ea(t,f)}function Mq(t,e){let f={...ui.options.bson,...e==null?void 0:e.bson};return ea(t,f)}var Lq,ui,kb=J(()=>{vb();Lq="4.0.0-beta.2",ui={name:"BSON",id:"bson",module:"bson",version:Lq,extensions:["bson"],mimeTypes:["application/bson"],category:"json",binary:!0,parse:Uq,parseSync:Mq,options:{bson:{}}}});function ta(t,e){return yb(t).buffer}var Tb=J(()=>{$s()});var Kq,fa,_b=J(()=>{Tb();Kq="4.0.0-beta.2",fa={name:"BSON",id:"bson",module:"bson",version:Kq,extensions:["bson"],options:{bson:{}},async encode(t,e){return ta(t,{})},encodeSync(t,e){return ta(t,{})}}});var Bb=J(()=>{kb();_b()});function xb(t,e,f){if(!(t in Dr))throw new Error(`invalid type: ${t}`);return Dr[t].toPrimitive(e,f)}function ra(t,e,f){if(!(t in Dr))throw new Error(`invalid type: ${t}`);return"fromPrimitive"in Dr[t]?Dr[t].fromPrimitive?.(e,f):e}function Wq(t){return Boolean(t)}function Yq(t){return Boolean(t)}function Vq(t){let e=parseFloat(t);if(isNaN(e))throw new Error(`invalid value for FLOAT: ${t}`);return e}function Gq(t){let e=parseFloat(t);if(isNaN(e))throw new Error(`invalid value for DOUBLE: ${t}`);return e}function Jq(t){let e=parseInt(t,10);if(e<-128||e>127||isNaN(e))throw new Error(`invalid value for INT8: ${t}`);return e}function Qq(t){let e=parseInt(t,10);if(e<0||e>255||isNaN(e))throw new Error(`invalid value for UINT8: ${t}`);return e}function Xq(t){let e=parseInt(t,10);if(e<-32768||e>32767||isNaN(e))throw new Error(`invalid value for INT16: ${t}`);return e}function Zq(t){let e=parseInt(t,10);if(e<0||e>65535||isNaN(e))throw new Error(`invalid value for UINT16: ${t}`);return e}function Eb(t){let e=parseInt(t,10);if(e<-2147483648||e>2147483647||isNaN(e))throw new Error(`invalid value for INT32: ${t}`);return e}function $q(t,e){let f=t*10**(e.scale||0),r=Math.round(f*10**-e.presision%1*10**e.presision);if(r<-2147483648||r>2147483647||isNaN(r))throw new Error(`invalid value for INT32: ${t}`);return r}function ey(t){let e=parseInt(t,10);if(e<0||e>281474976710655||isNaN(e))throw new Error(`invalid value for UINT32: ${t}`);return e}function Ib(t){let e=parseInt(t,10);if(isNaN(e))throw new Error(`invalid value for INT64: ${t}`);return e}function ty(t,e){let f=t*10**(e.scale||0),r=Math.round(f*10**-e.presision%1*10**e.presision);if(isNaN(r))throw new Error(`invalid value for INT64: ${t}`);return r}function fy(t){let e=parseInt(t,10);if(e<0||isNaN(e))throw new Error(`invalid value for UINT64: ${t}`);return e}function ry(t){let e=parseInt(t,10);if(isNaN(e))throw new Error(`invalid value for INT96: ${t}`);return e}function Sb(t){return Buffer.from(t)}function Ab(t){return Buffer.from(t)}function ny(t){return Buffer.from(t,"utf8")}function iy(t){return t.toString()}function oy(t){return Buffer.from(JSON.stringify(t))}function ly(t){return JSON.parse(t)}function sy(t){let e=fa.encodeSync?.(t);return Buffer.from(e)}function ay(t){return ui.parseSync?.(t)}function py(t){let e=parseInt(t,10);if(e<0||e>18446744073709552e3||isNaN(e))throw new Error(`invalid value for TIME_MILLIS: ${t}`);return e}function wy(t){let e=parseInt(t,10);if(e<0||isNaN(e))throw new Error(`invalid value for TIME_MICROS: ${t}`);return e}function my(t){if(t instanceof Date)return t.getTime()/Ob;{let e=parseInt(t,10);if(e<0||isNaN(e))throw new Error(`invalid value for DATE: ${t}`);return e}}function uy(t){return new Date(t*Ob)}function by(t){if(t instanceof Date)return t.getTime();{let e=parseInt(t,10);if(e<0||isNaN(e))throw new Error(`invalid value for TIMESTAMP_MILLIS: ${t}`);return e}}function cy(t){return new Date(t)}function dy(t){if(t instanceof Date)return t.getTime()*1e3;{let e=parseInt(t,10);if(e<0||isNaN(e))throw new Error(`invalid value for TIMESTAMP_MICROS: ${t}`);return e}}function hy(t){return new Date(t/1e3)}function gy(t){if(!t.months||!t.days||!t.milliseconds)throw new Error("value for INTERVAL must be object { months: ..., days: ..., milliseconds: ... }");let e=Buffer.alloc(12);return e.writeUInt32LE(t.months,0),e.writeUInt32LE(t.days,4),e.writeUInt32LE(t.milliseconds,8),e}function jy(t){let e=Buffer.from(t),f=e.readUInt32LE(0),r=e.readUInt32LE(4),n=e.readUInt32LE(8);return{months:f,days:r,milliseconds:n}}function Hb(t,e){return Math.round(t*10**-e.presision%1*10**e.presision)*10**-(e.scale||0)}function Nb(t,e){let f=0;if(t.length<=4)for(let n=0;n<t.length;n++)f+=t[n]<<8*(t.length-n-1);else for(let n=0;n<t.length;n++)f+=t[n]*2**(8*(t.length-1-n));return Math.round(f*10**-e.presision%1*10**e.presision)*10**-(e.scale||0)}var Dr,Ob,na=J(()=>{Bb();Dr={BOOLEAN:{primitiveType:"BOOLEAN",toPrimitive:Wq,fromPrimitive:Yq},INT32:{primitiveType:"INT32",toPrimitive:Eb},INT64:{primitiveType:"INT64",toPrimitive:Ib},INT96:{primitiveType:"INT96",toPrimitive:ry},FLOAT:{primitiveType:"FLOAT",toPrimitive:Vq},DOUBLE:{primitiveType:"DOUBLE",toPrimitive:Gq},BYTE_ARRAY:{primitiveType:"BYTE_ARRAY",toPrimitive:Sb},FIXED_LEN_BYTE_ARRAY:{primitiveType:"FIXED_LEN_BYTE_ARRAY",toPrimitive:Sb},UTF8:{primitiveType:"BYTE_ARRAY",originalType:"UTF8",toPrimitive:ny,fromPrimitive:iy},TIME_MILLIS:{primitiveType:"INT32",originalType:"TIME_MILLIS",toPrimitive:py},TIME_MICROS:{primitiveType:"INT64",originalType:"TIME_MICROS",toPrimitive:wy},DATE:{primitiveType:"INT32",originalType:"DATE",toPrimitive:my,fromPrimitive:uy},TIMESTAMP_MILLIS:{primitiveType:"INT64",originalType:"TIMESTAMP_MILLIS",toPrimitive:by,fromPrimitive:cy},TIMESTAMP_MICROS:{primitiveType:"INT64",originalType:"TIMESTAMP_MICROS",toPrimitive:dy,fromPrimitive:hy},UINT_8:{primitiveType:"INT32",originalType:"UINT_8",toPrimitive:Qq},UINT_16:{primitiveType:"INT32",originalType:"UINT_16",toPrimitive:Zq},UINT_32:{primitiveType:"INT32",originalType:"UINT_32",toPrimitive:ey},UINT_64:{primitiveType:"INT64",originalType:"UINT_64",toPrimitive:fy},INT_8:{primitiveType:"INT32",originalType:"INT_8",toPrimitive:Jq},INT_16:{primitiveType:"INT32",originalType:"INT_16",toPrimitive:Xq},INT_32:{primitiveType:"INT32",originalType:"INT_32",toPrimitive:Eb},INT_64:{primitiveType:"INT64",originalType:"INT_64",toPrimitive:Ib},JSON:{primitiveType:"BYTE_ARRAY",originalType:"JSON",toPrimitive:oy,fromPrimitive:ly},BSON:{primitiveType:"BYTE_ARRAY",originalType:"BSON",toPrimitive:sy,fromPrimitive:ay},INTERVAL:{primitiveType:"FIXED_LEN_BYTE_ARRAY",originalType:"INTERVAL",typeLength:12,toPrimitive:gy,fromPrimitive:jy},DECIMAL_INT32:{primitiveType:"INT32",originalType:"DECIMAL_INT32",toPrimitive:$q,fromPrimitive:Hb},DECIMAL_INT64:{primitiveType:"INT64",originalType:"DECIMAL_INT64",toPrimitive:ty,fromPrimitive:Hb},DECIMAL_BYTE_ARRAY:{primitiveType:"BYTE_ARRAY",originalType:"DECIMAL_BYTE_ARRAY",toPrimitive:Ab,fromPrimitive:Nb},DECIMAL_FIXED_LEN_BYTE_ARRAY:{primitiveType:"FIXED_LEN_BYTE_ARRAY",originalType:"DECIMAL_FIXED_LEN_BYTE_ARRAY",toPrimitive:Ab,fromPrimitive:Nb}};Ob=864e5});function ia(t){let e={};for(let f of t.fieldList)e[f.key]={dlevels:[],rlevels:[],values:[],pageHeaders:[],count:0};return{rowCount:0,columnData:e}}function Zo(t,e,f){let r=ia(t).columnData;if(oa(t.fields,e,r,0,0),f.rowCount===0){f.rowCount=1,f.columnData=r;return}f.rowCount+=1;for(let n of t.fieldList)Array.prototype.push.apply(f.columnData[n.key].rlevels,r[n.key].rlevels),Array.prototype.push.apply(f.columnData[n.key].dlevels,r[n.key].dlevels),Array.prototype.push.apply(f.columnData[n.key].values,r[n.key].values),f.columnData[n.key].count+=r[n.key].count}function oa(t,e,f,r,n){for(let i in t){let o=t[i],s=[];if(e&&o.name in e&&e[o.name]!==void 0&&e[o.name]!==null&&(e[o.name].constructor===Array?s=e[o.name]:s.push(e[o.name])),s.length===0&&Boolean(e)&&o.repetitionType==="REQUIRED")throw new Error(`missing required field: ${o.name}`);if(s.length>1&&o.repetitionType!=="REPEATED")throw new Error(`too many values for field: ${o.name}`);if(s.length===0){o.isNested?oa(o.fields,null,f,r,n):(f[o.key].count+=1,f[o.key].rlevels.push(r),f[o.key].dlevels.push(n));continue}for(let a=0;a<s.length;a++){let p=a===0?r:o.rLevelMax;o.isNested?oa(o.fields,s[a],f,p,o.dLevelMax):(f[o.key].count+=1,f[o.key].rlevels.push(p),f[o.key].dlevels.push(o.dLevelMax),f[o.key].values.push(xb(o.originalType||o.primitiveType,s[a])))}}}function $o(t,e){let f=[];for(let r=0;r<e.rowCount;r++)f.push({});for(let r in e.columnData){let n=e.columnData[r];n.count&&qy(t,n,r,f)}return f}function qy(t,e,f,r){let n=t.findField(f),i=t.findFieldBranch(f),o=new Array(n.rLevelMax+1).fill(0),s=0;for(let a=0;a<e.count;a++){let p=e.dlevels[a],w=e.rlevels[a];o[w]++,o.fill(0,w+1);let g=0,m=r[o[g++]-1];for(let j of i){if(j===n||p<j.dLevelMax)break;switch(j.repetitionType){case"REPEATED":j.name in m||(m[j.name]=[]);let B=o[g++];for(;m[j.name].length<=B;)m[j.name].push({});m=m[j.name][B];break;default:m[j.name]=m[j.name]||{},m=m[j.name]}}if(p===n.dLevelMax){let j=ra(n.originalType||n.primitiveType,e.values[s],n);switch(s++,n.repetitionType){case"REPEATED":n.name in m||(m[n.name]=[]);let B=o[g];for(;m[n.name].length<=B;)m[n.name].push(null);m[n.name][B]=j;break;default:m[n.name]=j}}}}function Rb(t,e){let f={};for(let r in e.columnData){let n=e.columnData[r];n.count&&yy(t,n,e.rowCount,r,f)}return f}function yy(t,e,f,r,n){if(e.count<=0)return;let i=t.findField(r),o=t.findFieldBranch(r),s=o[0].name,a,{values:p}=e;if(p.length===f&&o[0].primitiveType&&(a=p),a){n[s]=a;return}a=new Array(f);for(let m=0;m<f;m++)a[m]={};n[s]=a;let w=new Array(i.rLevelMax+1).fill(0),g=0;for(let m=0;m<e.count;m++){let j=e.dlevels[m],B=e.rlevels[m];w[B]++,w.fill(0,B+1);let v=0,R=a[w[v++]-1];for(let D of o){if(D===i||j<D.dLevelMax)break;switch(D.repetitionType){case"REPEATED":D.name in R||(R[D.name]=[]);let z=w[v++];for(;R[D.name].length<=z;)R[D.name].push({});R=R[D.name][z];break;default:R[D.name]=R[D.name]||{},R=R[D.name]}}if(j===i.dLevelMax){let D=ra(i.originalType||i.primitiveType,e.values[g],i);switch(g++,i.repetitionType){case"REPEATED":i.name in R||(R[i.name]=[]);let z=w[v];for(;R[i.name].length<=z;)R[i.name].push(null);R[i.name][z]=D;break;default:R[i.name]=D}}}for(let m=0;m<f;++m)s in a[m]&&(a[m]=a[m][s])}var bi=J(()=>{na()});function la(t,e){for(let f in t){let r=t[f];r.fields?la(r.fields,e):r.compression=e}}function Pb(t,e,f,r){let n={};for(let i in t){let o=t[i],s=!o.optional,a=Boolean(o.repeated),p=e,w=f,g="REQUIRED";if(s||(g="OPTIONAL",w++),a&&(g="REPEATED",p++,s&&w++),o.fields){let B=r.concat([i]);n[i]={name:i,path:B,key:B.join(),repetitionType:g,rLevelMax:p,dLevelMax:w,isNested:!0,fieldCount:Object.keys(o.fields).length,fields:Pb(o.fields,p,w,B)};continue}let m=Dr[o.type];if(!m)throw new Error(`invalid parquet type: ${o.type}`);if(o.encoding=o.encoding||"PLAIN",!(o.encoding in rr))throw new Error(`unsupported parquet encoding: ${o.encoding}`);if(o.compression=o.compression||"UNCOMPRESSED",!(o.compression in ai))throw new Error(`unsupported compression method: ${o.compression}`);let j=r.concat([i]);n[i]={name:i,primitiveType:m.primitiveType,originalType:m.originalType,path:j,key:j.join(),repetitionType:g,encoding:o.encoding,compression:o.compression,typeLength:o.typeLength||m.typeLength,presision:o.presision,scale:o.scale,rLevelMax:p,dLevelMax:w}}return n}function zb(t){let e=[];for(let f in t)e.push(t[f]),t[f].isNested&&(e=e.concat(zb(t[f].fields)));return e}var ci,sa=J(()=>{no();pi();bi();na();ci=class{constructor(e){this.schema=e,this.fields=Pb(e,0,0,[]),this.fieldList=zb(this.fields)}findField(e){typeof e=="string"?e=e.split(","):e=e.slice(0);let f=this.fields;for(;e.length>1;e.shift())f=f[e[0]].fields;return f[e[0]]}findFieldBranch(e){typeof e=="string"&&(e=e.split(","));let f=[],r=this.fields;for(;e.length>0;e.shift())f.push(r[e[0]]),e.length>1&&(r=r[e[0]].fields);return f}shredRecord(e,f){Zo(this,e,f)}materializeRows(e){return $o(this,e)}compress(e){return la(this.schema,e),la(this.fields,e),this}rowGroup(){return ia(this)}}});var br=de((_f,aa)=>{var el=fr("util"),di=_f.Type={STOP:0,VOID:1,BOOL:2,BYTE:3,I08:3,DOUBLE:4,I16:6,I32:8,I64:10,STRING:11,UTF7:11,STRUCT:12,MAP:13,SET:14,LIST:15,UTF8:16,UTF16:17};_f.MessageType={CALL:1,REPLY:2,EXCEPTION:3,ONEWAY:4};_f.TException=tl;function tl(t){Error.call(this),Error.captureStackTrace!==void 0&&Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.message=t}el.inherits(tl,Error);var vy=_f.TApplicationExceptionType={UNKNOWN:0,UNKNOWN_METHOD:1,INVALID_MESSAGE_TYPE:2,WRONG_METHOD_NAME:3,BAD_SEQUENCE_ID:4,MISSING_RESULT:5,INTERNAL_ERROR:6,PROTOCOL_ERROR:7,INVALID_TRANSFORM:8,INVALID_PROTOCOL:9,UNSUPPORTED_CLIENT_TYPE:10};_f.TApplicationException=fl;function fl(t,e){tl.call(this),Error.captureStackTrace!==void 0&&Error.captureStackTrace(this,this.constructor),this.type=t||vy.UNKNOWN,this.name=this.constructor.name,this.message=e}el.inherits(fl,tl);fl.prototype.read=function(t){for(var e,f=t.readStructBegin("TApplicationException");f=t.readFieldBegin(),f.ftype!=di.STOP;){switch(f.fid){case 1:f.ftype==di.STRING?(f=t.readString(),this.message=f):f=t.skip(f.ftype);break;case 2:f.ftype==di.I32?(f=t.readI32(),this.type=f):f=t.skip(f.ftype);break;default:f=t.skip(f.ftype);break}t.readFieldEnd()}t.readStructEnd()};fl.prototype.write=function(t){t.writeStructBegin("TApplicationException"),this.message&&(t.writeFieldBegin("message",di.STRING,1),t.writeString(this.message),t.writeFieldEnd()),this.code&&(t.writeFieldBegin("type",di.I32,2),t.writeI32(this.code),t.writeFieldEnd()),t.writeFieldStop(),t.writeStructEnd()};var aE=_f.TProtocolExceptionType={UNKNOWN:0,INVALID_DATA:1,NEGATIVE_SIZE:2,SIZE_LIMIT:3,BAD_VERSION:4,NOT_IMPLEMENTED:5,DEPTH_LIMIT:6};_f.TProtocolException=Fb;function Fb(t,e){Error.call(this),Error.captureStackTrace!==void 0&&Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.type=t,this.message=e}el.inherits(Fb,Error);_f.objectLength=function(t){return Object.keys(t).length};_f.inherits=function(t,e){el.inherits(t,e)};var rl,nl;rl=function(t,e){if(!t)return t;var f;e.shift===void 0?f=e:f=e[0];var r=f,n=t.length,i=[],o,s;for(o=0;o<n;o++)s=t[o],f===null?i.push(s):f===nl||f===rl?i.push(f(s,e.slice(1))):i.push(new r(s));return i};nl=function(t,e){if(!t)return t;var f;e.shift===void 0?f=e:f=e[0];var r=f,n={},i;for(var o in t)t.hasOwnProperty(o)&&(i=t[o],f===null?n[o]=i:f===nl||f===rl?n[o]=f(i,e.slice(1)):n[o]=new r(i));return n};aa.exports.copyMap=nl;aa.exports.copyList=rl});var Cb=de((pE,Db)=>{var qn=null;typeof WebSocket!="undefined"?qn=WebSocket:typeof MozWebSocket!="undefined"?qn=MozWebSocket:typeof global!="undefined"?qn=global.WebSocket||global.MozWebSocket:typeof window!="undefined"?qn=window.WebSocket||window.MozWebSocket:typeof self!="undefined"&&(qn=self.WebSocket||self.MozWebSocket);Db.exports=qn});var wa=de((wE,pa)=>{"use strict";var yn=typeof Reflect=="object"?Reflect:null,Lb=yn&&typeof yn.apply=="function"?yn.apply:function(e,f,r){return Function.prototype.apply.call(e,f,r)},il;yn&&typeof yn.ownKeys=="function"?il=yn.ownKeys:Object.getOwnPropertySymbols?il=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:il=function(e){return Object.getOwnPropertyNames(e)};function ky(t){console&&console.warn&&console.warn(t)}var Ub=Number.isNaN||function(e){return e!==e};function We(){We.init.call(this)}pa.exports=We;pa.exports.once=xy;We.EventEmitter=We;We.prototype._events=void 0;We.prototype._eventsCount=0;We.prototype._maxListeners=void 0;var Mb=10;function ol(t){if(typeof t!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}Object.defineProperty(We,"defaultMaxListeners",{enumerable:!0,get:function(){return Mb},set:function(t){if(typeof t!="number"||t<0||Ub(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");Mb=t}});We.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0};We.prototype.setMaxListeners=function(e){if(typeof e!="number"||e<0||Ub(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this};function Kb(t){return t._maxListeners===void 0?We.defaultMaxListeners:t._maxListeners}We.prototype.getMaxListeners=function(){return Kb(this)};We.prototype.emit=function(e){for(var f=[],r=1;r<arguments.length;r++)f.push(arguments[r]);var n=e==="error",i=this._events;if(i!==void 0)n=n&&i.error===void 0;else if(!n)return!1;if(n){var o;if(f.length>0&&(o=f[0]),o instanceof Error)throw o;var s=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw s.context=o,s}var a=i[e];if(a===void 0)return!1;if(typeof a=="function")Lb(a,this,f);else for(var p=a.length,w=Jb(a,p),r=0;r<p;++r)Lb(w[r],this,f);return!0};function Wb(t,e,f,r){var n,i,o;if(ol(f),i=t._events,i===void 0?(i=t._events=Object.create(null),t._eventsCount=0):(i.newListener!==void 0&&(t.emit("newListener",e,f.listener?f.listener:f),i=t._events),o=i[e]),o===void 0)o=i[e]=f,++t._eventsCount;else if(typeof o=="function"?o=i[e]=r?[f,o]:[o,f]:r?o.unshift(f):o.push(f),n=Kb(t),n>0&&o.length>n&&!o.warned){o.warned=!0;var s=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");s.name="MaxListenersExceededWarning",s.emitter=t,s.type=e,s.count=o.length,ky(s)}return t}We.prototype.addListener=function(e,f){return Wb(this,e,f,!1)};We.prototype.on=We.prototype.addListener;We.prototype.prependListener=function(e,f){return Wb(this,e,f,!0)};function Ty(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function Yb(t,e,f){var r={fired:!1,wrapFn:void 0,target:t,type:e,listener:f},n=Ty.bind(r);return n.listener=f,r.wrapFn=n,n}We.prototype.once=function(e,f){return ol(f),this.on(e,Yb(this,e,f)),this};We.prototype.prependOnceListener=function(e,f){return ol(f),this.prependListener(e,Yb(this,e,f)),this};We.prototype.removeListener=function(e,f){var r,n,i,o,s;if(ol(f),n=this._events,n===void 0)return this;if(r=n[e],r===void 0)return this;if(r===f||r.listener===f)--this._eventsCount==0?this._events=Object.create(null):(delete n[e],n.removeListener&&this.emit("removeListener",e,r.listener||f));else if(typeof r!="function"){for(i=-1,o=r.length-1;o>=0;o--)if(r[o]===f||r[o].listener===f){s=r[o].listener,i=o;break}if(i<0)return this;i===0?r.shift():_y(r,i),r.length===1&&(n[e]=r[0]),n.removeListener!==void 0&&this.emit("removeListener",e,s||f)}return this};We.prototype.off=We.prototype.removeListener;We.prototype.removeAllListeners=function(e){var f,r,n;if(r=this._events,r===void 0)return this;if(r.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):r[e]!==void 0&&(--this._eventsCount==0?this._events=Object.create(null):delete r[e]),this;if(arguments.length===0){var i=Object.keys(r),o;for(n=0;n<i.length;++n)o=i[n],o!=="removeListener"&&this.removeAllListeners(o);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(f=r[e],typeof f=="function")this.removeListener(e,f);else if(f!==void 0)for(n=f.length-1;n>=0;n--)this.removeListener(e,f[n]);return this};function Vb(t,e,f){var r=t._events;if(r===void 0)return[];var n=r[e];return n===void 0?[]:typeof n=="function"?f?[n.listener||n]:[n]:f?By(n):Jb(n,n.length)}We.prototype.listeners=function(e){return Vb(this,e,!0)};We.prototype.rawListeners=function(e){return Vb(this,e,!1)};We.listenerCount=function(t,e){return typeof t.listenerCount=="function"?t.listenerCount(e):Gb.call(t,e)};We.prototype.listenerCount=Gb;function Gb(t){var e=this._events;if(e!==void 0){var f=e[t];if(typeof f=="function")return 1;if(f!==void 0)return f.length}return 0}We.prototype.eventNames=function(){return this._eventsCount>0?il(this._events):[]};function Jb(t,e){for(var f=new Array(e),r=0;r<e;++r)f[r]=t[r];return f}function _y(t,e){for(;e+1<t.length;e++)t[e]=t[e+1];t.pop()}function By(t){for(var e=new Array(t.length),f=0;f<e.length;++f)e[f]=t[f].listener||t[f];return e}function xy(t,e){return new Promise(function(f,r){function n(o){t.removeListener(e,i),r(o)}function i(){typeof t.removeListener=="function"&&t.removeListener("error",n),f([].slice.call(arguments))}Qb(t,e,i,{once:!0}),e!=="error"&&Ey(t,n,{once:!0})})}function Ey(t,e,f){typeof t.on=="function"&&Qb(t,"error",e,f)}function Qb(t,e,f,r){if(typeof t.on=="function")r.once?t.once(e,f):t.on(e,f);else if(typeof t.addEventListener=="function")t.addEventListener(e,function n(i){r.once&&t.removeEventListener(e,n),f(i)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof t)}});var ll=de(cr=>{var ma=Math.pow(2,8),Iy=Math.pow(2,16),Xb=Math.pow(2,24),Zb=Math.pow(2,32),Sy=Math.pow(2,40),Ay=Math.pow(2,48),ua=Math.pow(2,52),Oy=Math.pow(2,1022);cr.readByte=function(t){return t>127?t-256:t};cr.readI16=function(t,e){e=e||0;var f=t[e+1];return f+=t[e]<<8,t[e]&128&&(f-=Iy),f};cr.readI32=function(t,e){e=e||0;var f=t[e+3];return f+=t[e+2]<<8,f+=t[e+1]<<16,f+=t[e]*Xb,t[e]&128&&(f-=Zb),f};cr.writeI16=function(t,e){return t[1]=e&255,e>>=8,t[0]=e&255,t};cr.writeI32=function(t,e){return t[3]=e&255,e>>=8,t[2]=e&255,e>>=8,t[1]=e&255,e>>=8,t[0]=e&255,t};cr.readDouble=function(t,e){e=e||0;var f=t[e]&128,r=(t[e+1]&240)>>4;r+=(t[e]&127)<<4;var n=t[e+7];switch(n+=t[e+6]<<8,n+=t[e+5]<<16,n+=t[e+4]*Xb,n+=t[e+3]*Zb,n+=t[e+2]*Sy,n+=(t[e+1]&15)*Ay,r){case 0:r=-1022;break;case 2047:return n?NaN:f?-1/0:1/0;default:n+=ua,r-=1023}return f&&(n*=-1),n*Math.pow(2,r-52)};cr.writeDouble=function(t,e){var f,r,n;return t[0]=e<0?128:0,e=Math.abs(e),e!==e?(f=2251799813685248,r=2047):e===1/0?(f=0,r=2047):(r=Math.floor(Math.log(e)/Math.LN2),n=Math.pow(2,-r),e*n<1&&(r--,n*=2),r+1023>=2047?(f=0,r=2047):r+1023>=1?(f=(e*n-1)*ua,r+=1023):(f=e*Oy*ua,r=0)),t[1]=r<<4&240,t[0]|=r>>4&127,t[7]=f&255,f=Math.floor(f/ma),t[6]=f&255,f=Math.floor(f/ma),t[5]=f&255,f=Math.floor(f/ma),t[4]=f&255,f>>=8,t[3]=f&255,f>>=8,t[2]=f&255,f>>=8,t[1]|=f&15,t}});var Cr=de((uE,ec)=>{var Hy=fr("util");ec.exports=$b;function $b(t){Error.call(this),Error.captureStackTrace!==void 0&&Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.message=t}Hy.inherits($b,Error)});var al=de(Uf=>{var Ny=fr("util"),vn=function(){},tc=console.log,sl="error";function hi(t){return function(){var e=["thrift: ["+t+"] "].concat(Array.from(arguments));return tc(Ny.format.apply(null,e))}}var ba=vn,ca=vn,da=vn,ha=vn,ga=vn;Uf.setLogFunc=function(t){tc=t};var Ry=Uf.setLogLevel=function(t){switch(ba=ca=da=ha=ga=vn,sl=t,sl){case"trace":ba=hi("TRACE");case"debug":ca=hi("DEBUG");case"error":da=hi("ERROR");case"warning":ha=hi("WARN");case"info":ga=hi("INFO")}};Ry(sl);Uf.getLogLevel=function(){return sl};Uf.trace=function(){return ba.apply(null,arguments)};Uf.debug=function(){return ca.apply(null,arguments)};Uf.error=function(){return da.apply(null,arguments)};Uf.warning=function(){return ha.apply(null,arguments)};Uf.info=function(){return ga.apply(null,arguments)}});var St=de((cE,rc)=>{var ja=4294967296,fc=[];for(kn=0;kn<256;kn++)fc[kn]=(kn>15?"":"0")+kn.toString(16);var kn,gi=rc.exports=function(t,e){t instanceof Buffer?(this.buffer=t,this.offset=e||0):Object.prototype.toString.call(t)=="[object Uint8Array]"?(this.buffer=new Buffer(t),this.offset=e||0):(this.buffer=this.buffer||new Buffer(8),this.offset=0,this.setValue.apply(this,arguments))};gi.MAX_INT=Math.pow(2,53);gi.MIN_INT=-Math.pow(2,53);gi.prototype={constructor:gi,_2scomp:function(){for(var t=this.buffer,e=this.offset,f=1,r=e+7;r>=e;r--){var n=(t[r]^255)+f;t[r]=n&255,f=n>>8}},setValue:function(t,e){var f=!1;if(arguments.length==1)if(typeof t=="number"){if(f=t<0,t=Math.abs(t),e=t%ja,t=t/ja,t>ja)throw new RangeError(t+" is outside Int64 range");t=t|0}else if(typeof t=="string")t=(t+"").replace(/^0x/,""),e=t.substr(-8),t=t.length>8?t.substr(0,t.length-8):"",t=parseInt(t,16),e=parseInt(e,16);else throw new Error(t+" must be a Number or String");for(var r=this.buffer,n=this.offset,i=7;i>=0;i--)r[n+i]=e&255,e=i==4?t:e>>>8;f&&this._2scomp()},toNumber:function(t){for(var e=this.buffer,f=this.offset,r=e[f]&128,n=0,i=1,o=7,s=1;o>=0;o--,s*=256){var a=e[f+o];r&&(a=(a^255)+i,i=a>>8,a=a&255),n+=a*s}return!t&&n>=gi.MAX_INT?r?-1/0:1/0:r?-n:n},valueOf:function(){return this.toNumber(!1)},toString:function(t){return this.valueOf().toString(t||10)},toOctetString:function(t){for(var e=new Array(8),f=this.buffer,r=this.offset,n=0;n<8;n++)e[n]=fc[f[r+n]];return e.join(t||"")},toBuffer:function(t){if(t&&this.offset===0)return this.buffer;var e=new Buffer(8);return this.buffer.copy(e,0,this.offset,this.offset+8),e},copy:function(t,e){this.buffer.copy(t,e||0,this.offset,this.offset+8)},compare:function(t){if((this.buffer[this.offset]&128)!=(t.buffer[t.offset]&128))return t.buffer[t.offset]-this.buffer[this.offset];for(var e=0;e<8;e++)if(this.buffer[this.offset+e]!==t.buffer[t.offset+e])return this.buffer[this.offset+e]-t.buffer[t.offset+e];return 0},equals:function(t){return this.compare(t)===0},inspect:function(){return"[Int64 value:"+this+" octets:"+this.toOctetString(" ")+"]"}}});var va=de((dE,nc)=>{var Py=al(),Mf=St(),lt=br(),Qe=lt.Type;nc.exports=V;var qa=Math.pow(2,8),zy=Math.pow(2,24),Fy=Math.pow(2,32),Dy=Math.pow(2,40),Cy=Math.pow(2,48),ya=Math.pow(2,52),Ly=Math.pow(2,1022);function V(t){this.trans=t,this.lastField_=[],this.lastFieldId_=0,this.string_limit_=0,this.string_buf_=null,this.string_buf_size_=0,this.container_limit_=0,this.booleanField_={name:null,hasBoolValue:!1},this.boolValue_={hasBoolValue:!1,boolValue:!1}}V.PROTOCOL_ID=-126;V.VERSION_N=1;V.VERSION_MASK=31;V.TYPE_MASK=-32;V.TYPE_BITS=7;V.TYPE_SHIFT_AMOUNT=5;V.Types={CT_STOP:0,CT_BOOLEAN_TRUE:1,CT_BOOLEAN_FALSE:2,CT_BYTE:3,CT_I16:4,CT_I32:5,CT_I64:6,CT_DOUBLE:7,CT_BINARY:8,CT_LIST:9,CT_SET:10,CT_MAP:11,CT_STRUCT:12};V.TTypeToCType=[V.Types.CT_STOP,0,V.Types.CT_BOOLEAN_TRUE,V.Types.CT_BYTE,V.Types.CT_DOUBLE,0,V.Types.CT_I16,0,V.Types.CT_I32,0,V.Types.CT_I64,V.Types.CT_BINARY,V.Types.CT_STRUCT,V.Types.CT_MAP,V.Types.CT_SET,V.Types.CT_LIST];V.prototype.getTransport=function(){return this.trans};V.prototype.getCompactType=function(t){return V.TTypeToCType[t]};V.prototype.getTType=function(t){switch(t){case Qe.STOP:return Qe.STOP;case V.Types.CT_BOOLEAN_FALSE:case V.Types.CT_BOOLEAN_TRUE:return Qe.BOOL;case V.Types.CT_BYTE:return Qe.BYTE;case V.Types.CT_I16:return Qe.I16;case V.Types.CT_I32:return Qe.I32;case V.Types.CT_I64:return Qe.I64;case V.Types.CT_DOUBLE:return Qe.DOUBLE;case V.Types.CT_BINARY:return Qe.STRING;case V.Types.CT_LIST:return Qe.LIST;case V.Types.CT_SET:return Qe.SET;case V.Types.CT_MAP:return Qe.MAP;case V.Types.CT_STRUCT:return Qe.STRUCT;default:throw new lt.TProtocolException(lt.TProtocolExceptionType.INVALID_DATA,"Unknown type: "+t)}return Qe.STOP};V.prototype.flush=function(){return this.trans.flush()};V.prototype.writeMessageBegin=function(t,e,f){this.writeByte(V.PROTOCOL_ID),this.writeByte(V.VERSION_N&V.VERSION_MASK|e<<V.TYPE_SHIFT_AMOUNT&V.TYPE_MASK),this.writeVarint32(f),this.writeString(t),this._seqid?Py.warning("SeqId already set",{name:t}):(this._seqid=f,this.trans.setCurrSeqId(f))};V.prototype.writeMessageEnd=function(){};V.prototype.writeStructBegin=function(t){this.lastField_.push(this.lastFieldId_),this.lastFieldId_=0};V.prototype.writeStructEnd=function(){this.lastFieldId_=this.lastField_.pop()};V.prototype.writeFieldBegin=function(t,e,f){if(e!=Qe.BOOL)return this.writeFieldBeginInternal(t,e,f,-1);this.booleanField_.name=t,this.booleanField_.fieldType=e,this.booleanField_.fieldId=f};V.prototype.writeFieldEnd=function(){};V.prototype.writeFieldStop=function(){this.writeByte(V.Types.CT_STOP)};V.prototype.writeMapBegin=function(t,e,f){f===0?this.writeByte(0):(this.writeVarint32(f),this.writeByte(this.getCompactType(t)<<4|this.getCompactType(e)))};V.prototype.writeMapEnd=function(){};V.prototype.writeListBegin=function(t,e){this.writeCollectionBegin(t,e)};V.prototype.writeListEnd=function(){};V.prototype.writeSetBegin=function(t,e){this.writeCollectionBegin(t,e)};V.prototype.writeSetEnd=function(){};V.prototype.writeBool=function(t){this.booleanField_.name!==null?(this.writeFieldBeginInternal(this.booleanField_.name,this.booleanField_.fieldType,this.booleanField_.fieldId,t?V.Types.CT_BOOLEAN_TRUE:V.Types.CT_BOOLEAN_FALSE),this.booleanField_.name=null):this.writeByte(t?V.Types.CT_BOOLEAN_TRUE:V.Types.CT_BOOLEAN_FALSE)};V.prototype.writeByte=function(t){this.trans.write(new Buffer([t]))};V.prototype.writeI16=function(t){this.writeVarint32(this.i32ToZigzag(t))};V.prototype.writeI32=function(t){this.writeVarint32(this.i32ToZigzag(t))};V.prototype.writeI64=function(t){this.writeVarint64(this.i64ToZigzag(t))};V.prototype.writeDouble=function(t){var e=new Buffer(8),f,r,n;e[7]=t<0?128:0,t=Math.abs(t),t!==t?(f=2251799813685248,r=2047):t===1/0?(f=0,r=2047):(r=Math.floor(Math.log(t)/Math.LN2),n=Math.pow(2,-r),t*n<1&&(r--,n*=2),r+1023>=2047?(f=0,r=2047):r+1023>=1?(f=(t*n-1)*ya,r+=1023):(f=t*Ly*ya,r=0)),e[6]=r<<4&240,e[7]|=r>>4&127,e[0]=f&255,f=Math.floor(f/qa),e[1]=f&255,f=Math.floor(f/qa),e[2]=f&255,f=Math.floor(f/qa),e[3]=f&255,f>>=8,e[4]=f&255,f>>=8,e[5]=f&255,f>>=8,e[6]|=f&15,this.trans.write(e)};V.prototype.writeStringOrBinary=function(t,e,f){if(typeof f=="string")this.writeVarint32(Buffer.byteLength(f,e)),this.trans.write(new Buffer(f,e));else if(f instanceof Buffer||Object.prototype.toString.call(f)=="[object Uint8Array]")this.writeVarint32(f.length),this.trans.write(f);else throw new Error(t+" called without a string/Buffer argument: "+f)};V.prototype.writeString=function(t){this.writeStringOrBinary("writeString","utf8",t)};V.prototype.writeBinary=function(t){this.writeStringOrBinary("writeBinary","binary",t)};V.prototype.writeFieldBeginInternal=function(t,e,f,r){var n=r==-1?this.getCompactType(e):r;f>this.lastFieldId_&&f-this.lastFieldId_<=15?this.writeByte(f-this.lastFieldId_<<4|n):(this.writeByte(n),this.writeI16(f)),this.lastFieldId_=f};V.prototype.writeCollectionBegin=function(t,e){e<=14?this.writeByte(e<<4|this.getCompactType(t)):(this.writeByte(240|this.getCompactType(t)),this.writeVarint32(e))};V.prototype.writeVarint32=function(t){for(var e=new Buffer(5),f=0;;)if((t&~127)==0){e[f++]=t;break}else e[f++]=t&127|128,t=t>>>7;var r=new Buffer(f);e.copy(r,0,0,f),this.trans.write(r)};V.prototype.writeVarint64=function(t){if(typeof t=="number"&&(t=new Mf(t)),!(t instanceof Mf))throw new lt.TProtocolException(lt.TProtocolExceptionType.INVALID_DATA,"Expected Int64 or Number, found: "+t);for(var e=new Buffer(10),f=0,r=t.buffer.readUInt32BE(0,!0),n=t.buffer.readUInt32BE(4,!0),i=0;;)if((n&~127)==0&&r===0){e[f++]=n;break}else e[f++]=n&127|128,i=r<<25,n=n>>>7,r=r>>>7,n=n|i;var o=new Buffer(f);e.copy(o,0,0,f),this.trans.write(o)};V.prototype.i64ToZigzag=function(t){if(typeof t=="string"?t=new Mf(parseInt(t,10)):typeof t=="number"&&(t=new Mf(t)),!(t instanceof Mf))throw new lt.TProtocolException(lt.TProtocolExceptionType.INVALID_DATA,"Expected Int64 or Number, found: "+t);var e=t.buffer.readUInt32BE(0,!0),f=t.buffer.readUInt32BE(4,!0),r=e>>>31;return e=(e<<1|f>>>31)^(r?4294967295:0),f=f<<1^(r?4294967295:0),new Mf(e,f)};V.prototype.i32ToZigzag=function(t){return t<<1^(t&2147483648?4294967295:0)};V.prototype.readMessageBegin=function(){var t=this.trans.readByte();if(t!=V.PROTOCOL_ID)throw new lt.TProtocolException(lt.TProtocolExceptionType.BAD_VERSION,"Bad protocol identifier "+t);var e=this.trans.readByte(),f=e&V.VERSION_MASK;if(f!=V.VERSION_N)throw new lt.TProtocolException(lt.TProtocolExceptionType.BAD_VERSION,"Bad protocol version "+f);var r=e>>V.TYPE_SHIFT_AMOUNT&V.TYPE_BITS,n=this.readVarint32(),i=this.readString();return{fname:i,mtype:r,rseqid:n}};V.prototype.readMessageEnd=function(){};V.prototype.readStructBegin=function(){return this.lastField_.push(this.lastFieldId_),this.lastFieldId_=0,{fname:""}};V.prototype.readStructEnd=function(){this.lastFieldId_=this.lastField_.pop()};V.prototype.readFieldBegin=function(){var t=0,e=this.trans.readByte(e),f=e&15;if(f==V.Types.CT_STOP)return{fname:null,ftype:lt.Type.STOP,fid:0};var r=(e&240)>>>4;r===0?t=this.readI16():t=this.lastFieldId_+r;var n=this.getTType(f);return(f==V.Types.CT_BOOLEAN_TRUE||f==V.Types.CT_BOOLEAN_FALSE)&&(this.boolValue_.hasBoolValue=!0,this.boolValue_.boolValue=f==V.Types.CT_BOOLEAN_TRUE),this.lastFieldId_=t,{fname:null,ftype:n,fid:t}};V.prototype.readFieldEnd=function(){};V.prototype.readMapBegin=function(){var t=this.readVarint32();if(t<0)throw new lt.TProtocolException(lt.TProtocolExceptionType.NEGATIVE_SIZE,"Negative map size");var e=0;t!==0&&(e=this.trans.readByte());var f=this.getTType((e&240)>>>4),r=this.getTType(e&15);return{ktype:f,vtype:r,size:t}};V.prototype.readMapEnd=function(){};V.prototype.readListBegin=function(){var t=this.trans.readByte(),e=t>>>4&15;if(e==15&&(e=this.readVarint32()),e<0)throw new lt.TProtocolException(lt.TProtocolExceptionType.NEGATIVE_SIZE,"Negative list size");var f=this.getTType(t&15);return{etype:f,size:e}};V.prototype.readListEnd=function(){};V.prototype.readSetBegin=function(){return this.readListBegin()};V.prototype.readSetEnd=function(){};V.prototype.readBool=function(){var t=!1,e=0;if(this.boolValue_.hasBoolValue===!0)t=this.boolValue_.boolValue,this.boolValue_.hasBoolValue=!1;else{var f=this.trans.readByte();e=f.rsize,t=f.value==V.Types.CT_BOOLEAN_TRUE}return t};V.prototype.readByte=function(){return this.trans.readByte()};V.prototype.readI16=function(){return this.readI32()};V.prototype.readI32=function(){return this.zigzagToI32(this.readVarint32())};V.prototype.readI64=function(){return this.zigzagToI64(this.readVarint64())};V.prototype.readDouble=function(){var t=this.trans.read(8),e=0,f=t[e+7]&128,r=(t[e+6]&240)>>4;r+=(t[e+7]&127)<<4;var n=t[e];switch(n+=t[e+1]<<8,n+=t[e+2]<<16,n+=t[e+3]*zy,n+=t[e+4]*Fy,n+=t[e+5]*Dy,n+=(t[e+6]&15)*Cy,r){case 0:r=-1022;break;case 2047:return n?NaN:f?-1/0:1/0;default:n+=ya,r-=1023}return f&&(n*=-1),n*Math.pow(2,r-52)};V.prototype.readBinary=function(){var t=this.readVarint32();if(t===0)return new Buffer(0);if(t<0)throw new lt.TProtocolException(lt.TProtocolExceptionType.NEGATIVE_SIZE,"Negative binary size");return this.trans.read(t)};V.prototype.readString=function(){var t=this.readVarint32();if(t===0)return"";if(t<0)throw new lt.TProtocolException(lt.TProtocolExceptionType.NEGATIVE_SIZE,"Negative string size");return this.trans.readString(t)};V.prototype.readVarint32=function(){return this.readVarint64().toNumber()};V.prototype.readVarint64=function(){for(var t=0,e=0,f=0,r=0;;){var n=this.trans.readByte();if(t++,r<=25?e=e|(n&127)<<r:25<r&&r<32?(e=e|(n&127)<<r,f=f|(n&127)>>>32-r):f=f|(n&127)<<r-32,r+=7,!(n&128))break;if(t>=10)throw new lt.TProtocolException(lt.TProtocolExceptionType.INVALID_DATA,"Variable-length int over 10 bytes.")}return new Mf(f,e)};V.prototype.zigzagToI32=function(t){return t>>>1^-1*(t&1)};V.prototype.zigzagToI64=function(t){var e=t.buffer.readUInt32BE(0,!0),f=t.buffer.readUInt32BE(4,!0),r=new Mf(e&0,f&1);r._2scomp();var n=r.buffer.readUInt32BE(0,!0),i=r.buffer.readUInt32BE(4,!0),o=e<<31;return e=e>>>1^n,f=(f>>>1|o)^i,new Mf(e,f)};V.prototype.skip=function(t){switch(t){case Qe.BOOL:this.readBool();break;case Qe.BYTE:this.readByte();break;case Qe.I16:this.readI16();break;case Qe.I32:this.readI32();break;case Qe.I64:this.readI64();break;case Qe.DOUBLE:this.readDouble();break;case Qe.STRING:this.readString();break;case Qe.STRUCT:for(this.readStructBegin();;){var e=this.readFieldBegin();if(e.ftype===Qe.STOP)break;this.skip(e.ftype),this.readFieldEnd()}this.readStructEnd();break;case Qe.MAP:for(var f=this.readMapBegin(),r=0;r<f.size;++r)this.skip(f.ktype),this.skip(f.vtype);this.readMapEnd();break;case Qe.SET:for(var n=this.readSetBegin(),i=0;i<n.size;++i)this.skip(n.etype);this.readSetEnd();break;case Qe.LIST:for(var o=this.readListBegin(),s=0;s<o.size;++s)this.skip(o.etype);this.readListEnd();break;default:throw new Error("Invalid type: "+t)}}});var _a=de((hE,ac)=>{var ic=al(),ka=ll(),oc=St(),Kf=br(),zt=Kf.Type;ac.exports=qe;var lc=-65536,Ta=-2147418112,sc=255;qe.VERSION_MASK=lc;qe.VERSION_1=Ta;qe.TYPE_MASK=sc;function qe(t,e,f){this.trans=t,this.strictRead=e!==void 0?e:!1,this.strictWrite=f!==void 0?f:!0,this._seqid=null}qe.prototype.flush=function(){return this.trans.flush()};qe.prototype.writeMessageBegin=function(t,e,f){this.strictWrite?(this.writeI32(Ta|e),this.writeString(t),this.writeI32(f)):(this.writeString(t),this.writeByte(e),this.writeI32(f)),this._seqid!==null?ic.warning("SeqId already set",{name:t}):(this._seqid=f,this.trans.setCurrSeqId(f))};qe.prototype.writeMessageEnd=function(){this._seqid!==null?this._seqid=null:ic.warning("No seqid to unset")};qe.prototype.writeStructBegin=function(t){};qe.prototype.writeStructEnd=function(){};qe.prototype.writeFieldBegin=function(t,e,f){this.writeByte(e),this.writeI16(f)};qe.prototype.writeFieldEnd=function(){};qe.prototype.writeFieldStop=function(){this.writeByte(zt.STOP)};qe.prototype.writeMapBegin=function(t,e,f){this.writeByte(t),this.writeByte(e),this.writeI32(f)};qe.prototype.writeMapEnd=function(){};qe.prototype.writeListBegin=function(t,e){this.writeByte(t),this.writeI32(e)};qe.prototype.writeListEnd=function(){};qe.prototype.writeSetBegin=function(t,e){this.writeByte(t),this.writeI32(e)};qe.prototype.writeSetEnd=function(){};qe.prototype.writeBool=function(t){t?this.writeByte(1):this.writeByte(0)};qe.prototype.writeByte=function(t){this.trans.write(new Buffer([t]))};qe.prototype.writeI16=function(t){this.trans.write(ka.writeI16(new Buffer(2),t))};qe.prototype.writeI32=function(t){this.trans.write(ka.writeI32(new Buffer(4),t))};qe.prototype.writeI64=function(t){t.buffer?this.trans.write(t.buffer):this.trans.write(new oc(t).buffer)};qe.prototype.writeDouble=function(t){this.trans.write(ka.writeDouble(new Buffer(8),t))};qe.prototype.writeStringOrBinary=function(t,e,f){if(typeof f=="string")this.writeI32(Buffer.byteLength(f,e)),this.trans.write(new Buffer(f,e));else if(f instanceof Buffer||Object.prototype.toString.call(f)=="[object Uint8Array]")this.writeI32(f.length),this.trans.write(f);else throw new Error(t+" called without a string/Buffer argument: "+f)};qe.prototype.writeString=function(t){this.writeStringOrBinary("writeString","utf8",t)};qe.prototype.writeBinary=function(t){this.writeStringOrBinary("writeBinary","binary",t)};qe.prototype.readMessageBegin=function(){var t=this.readI32(),e,f,r;if(t<0){var n=t&lc;if(n!=Ta)throw new Kf.TProtocolException(Kf.TProtocolExceptionType.BAD_VERSION,"Bad version in readMessageBegin: "+t);e=t&sc,f=this.readString(),r=this.readI32()}else{if(this.strictRead)throw new Kf.TProtocolException(Kf.TProtocolExceptionType.BAD_VERSION,"No protocol version header");f=this.trans.read(t),e=this.readByte(),r=this.readI32()}return{fname:f,mtype:e,rseqid:r}};qe.prototype.readMessageEnd=function(){};qe.prototype.readStructBegin=function(){return{fname:""}};qe.prototype.readStructEnd=function(){};qe.prototype.readFieldBegin=function(){var t=this.readByte();if(t==zt.STOP)return{fname:null,ftype:t,fid:0};var e=this.readI16();return{fname:null,ftype:t,fid:e}};qe.prototype.readFieldEnd=function(){};qe.prototype.readMapBegin=function(){var t=this.readByte(),e=this.readByte(),f=this.readI32();return{ktype:t,vtype:e,size:f}};qe.prototype.readMapEnd=function(){};qe.prototype.readListBegin=function(){var t=this.readByte(),e=this.readI32();return{etype:t,size:e}};qe.prototype.readListEnd=function(){};qe.prototype.readSetBegin=function(){var t=this.readByte(),e=this.readI32();return{etype:t,size:e}};qe.prototype.readSetEnd=function(){};qe.prototype.readBool=function(){var t=this.readByte();return t!==0};qe.prototype.readByte=function(){return this.trans.readByte()};qe.prototype.readI16=function(){return this.trans.readI16()};qe.prototype.readI32=function(){return this.trans.readI32()};qe.prototype.readI64=function(){var t=this.trans.read(8);return new oc(t)};qe.prototype.readDouble=function(){return this.trans.readDouble()};qe.prototype.readBinary=function(){var t=this.readI32();if(t===0)return new Buffer(0);if(t<0)throw new Kf.TProtocolException(Kf.TProtocolExceptionType.NEGATIVE_SIZE,"Negative binary size");return this.trans.read(t)};qe.prototype.readString=function(){var t=this.readI32();if(t===0)return"";if(t<0)throw new Kf.TProtocolException(Kf.TProtocolExceptionType.NEGATIVE_SIZE,"Negative string size");return this.trans.readString(t)};qe.prototype.getTransport=function(){return this.trans};qe.prototype.skip=function(t){switch(t){case zt.BOOL:this.readBool();break;case zt.BYTE:this.readByte();break;case zt.I16:this.readI16();break;case zt.I32:this.readI32();break;case zt.I64:this.readI64();break;case zt.DOUBLE:this.readDouble();break;case zt.STRING:this.readString();break;case zt.STRUCT:for(this.readStructBegin();;){var e=this.readFieldBegin();if(e.ftype===zt.STOP)break;this.skip(e.ftype),this.readFieldEnd()}this.readStructEnd();break;case zt.MAP:for(var f=this.readMapBegin(),r=0;r<f.size;++r)this.skip(f.ktype),this.skip(f.vtype);this.readMapEnd();break;case zt.SET:for(var n=this.readSetBegin(),i=0;i<n.size;++i)this.skip(n.etype);this.readSetEnd();break;case zt.LIST:for(var o=this.readListBegin(),s=0;s<o.size;++s)this.skip(o.etype);this.readListEnd();break;default:throw new Error("Invalid type: "+t)}}});var Ba=de((gE,cc)=>{var Uy=fr("util"),pl=va(),pc=_a(),My=Cr();function ji(t){Error.call(this),Error.captureStackTrace!==void 0&&Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.message=t}Uy.inherits(ji,Error);cc.exports=mt;var Ky=0,Wy=1,Yy=0,Vy=32/8,Gy=48/8,Jy=64/8,Qy=96/8,wc=112/8,mc=4095,uc=1,Xy=1073741823;function Wf(t){var e=qi();this.outputBuffer=null;var f=this;this.transport=new e(null,function(r){f.outputBuffer=r}),this.transport.inBuf=t||Buffer.alloc(0),this.transport.writeCursor=this.transport.inBuf.length,this.protocol=new pl(this.transport)}Wf.prototype.readVarint32=function(){return this.protocol.readVarint32()};Wf.prototype.writeVarint32=function(t){this.protocol.writeVarint32(t)};Wf.prototype.readString=function(){return this.protocol.readString()};Wf.prototype.writeString=function(t){this.protocol.writeString(t)};Wf.prototype.getOutCount=function(){return this.transport.outCount};Wf.prototype.write=function(t){this.transport.write(t)};Wf.prototype.toBuffer=function(){return this.transport.flush(),this.outputBuffer};mt.SubprotocolId={BINARY:0,JSON:1,COMPACT:2};function mt(){this.maxFrameSize=Xy,this.protocolId=mt.SubprotocolId.BINARY,this.rheaders={},this.wheaders={},this.inBuf=Buffer.alloc(0),this.outCount=0,this.flags=null,this.seqid=0,this.shouldWriteHeaders=!0}var bc=function(t,e){if(typeof t!="string"||typeof e!="string")throw new ji("Header key and values must be strings")},Zy=function(t){for(var e=Object.keys(mt.SubprotocolId),f=0;f<e.length;f++)if(t===mt.SubprotocolId[e[f]])return!0;throw new Error(t+" is not a valid protocol id")};mt.prototype.setSeqId=function(t){this.seqid=t};mt.prototype.getSeqId=function(t){return this.seqid};mt.prototype.setFlags=function(t){this.flags=t};mt.prototype.getReadHeaders=function(){return this.rheaders};mt.prototype.setReadHeader=function(t,e){bc(t,e),this.rheaders[t]=e};mt.prototype.clearReadHeaders=function(){this.rheaders={}};mt.prototype.getWriteHeaders=function(){return this.wheaders};mt.prototype.setWriteHeader=function(t,e){bc(t,e),this.wheaders[t]=e};mt.prototype.clearWriteHeaders=function(){this.wheaders={}};mt.prototype.setMaxFrameSize=function(t){this.maxFrameSize=t};mt.prototype.setProtocolId=function(t){Zy(t),this.protocolId=t};mt.prototype.getProtocolId=function(){return this.protocolId};var $y=function(t){var e=t.readInt32BE();return(e&pc.VERSION_MASK)===pc.VERSION_1},ev=function(t){var e=t.readInt8(Ky),f=t.readInt8(Wy);return e===pl.PROTOCOL_ID&&(f&pl.VERSION_MASK)===pl.VERSION_N};mt.prototype.readHeaders=function(){var t=this.inBuf,e=!1;if($y(t)&&(this.setProtocolId(mt.SubprotocolId.BINARY),e=!0),ev(t)&&(this.setProtocolId(mt.SubprotocolId.COMPACT),e=!0),e){this.shouldWriteHeaders=!1;return}var f=t.readInt32BE(Yy);if(f>this.maxFrameSize)throw new ji("Frame exceeds maximum frame size");var r=t.readInt16BE(Vy);if(this.shouldWriteHeaders=r===mc,!!this.shouldWriteHeaders){this.setFlags(t.readInt16BE(Gy)),this.setSeqId(t.readInt32BE(Jy));var n=t.readInt16BE(Qy)*4,i=wc+n;if(i>t.length)throw new ji("Header size is greater than frame size");var o=Buffer.alloc(n);t.copy(o,0,wc,i);var s=new Wf(o);this.setProtocolId(s.readVarint32());var a=s.readVarint32();if(a>0)throw new ji("Transforms are not yet supported");for(;;)try{var p=s.readVarint32();if(p!==uc)break;for(var w=s.readVarint32(),g=0;g<w;g++){var m=s.readString(),j=s.readString();this.setReadHeader(m,j)}}catch(B){if(B instanceof My)break;throw B}return this.read(i),this.getReadHeaders()}};mt.prototype.writeHeaders=function(){if(!!this.shouldWriteHeaders){var t=this.getWriteHeaders(),e=new Wf;e.writeVarint32(this.protocolId),e.writeVarint32(0);var f=Object.keys(t);if(f.length>0){e.writeVarint32(uc),e.writeVarint32(f.length);for(var r=0;r<f.length;r++){var n=f[r],i=t[n];e.writeString(n),e.writeString(i)}}var o=e.getOutCount(),s=(4-o%4)%4,a=Buffer.alloc(2);a.writeInt16BE(Math.floor((o+s)/4));var p=Buffer.alloc(s);p.fill(0),e.write(p);var w=e.toBuffer(),g=Buffer.alloc(4);g.writeInt32BE(10+this.outCount+w.length);var m=Buffer.alloc(2);m.writeInt16BE(mc);var j=Buffer.alloc(2);j.writeInt16BE(0);var B=Buffer.alloc(4);B.writeInt32BE(this.getSeqId());var v=Buffer.concat([g,m,j,B,a,w]);this.outBuffers.unshift(v),this.outCount+=v.length}}});var qi=de((jE,dc)=>{var wl=ll(),tv=Cr(),fv=Ba();dc.exports=st;function st(t,e){this.defaultReadBufferSize=1024,this.writeBufferSize=512,this.inBuf=new Buffer(this.defaultReadBufferSize),this.readCursor=0,this.writeCursor=0,this.outBuffers=[],this.outCount=0,this.onFlush=e}st.prototype=new fv;st.prototype.reset=function(){this.inBuf=new Buffer(this.defaultReadBufferSize),this.readCursor=0,this.writeCursor=0,this.outBuffers=[],this.outCount=0};st.receiver=function(t,e){var f=new st;return function(r){if(f.writeCursor+r.length>f.inBuf.length){var n=new Buffer(f.writeCursor+r.length);f.inBuf.copy(n,0,0,f.writeCursor),f.inBuf=n}r.copy(f.inBuf,f.writeCursor,0),f.writeCursor+=r.length,t(f,e)}};st.prototype.commitPosition=function(){var t=this.writeCursor-this.readCursor,e=t*2>this.defaultReadBufferSize?t*2:this.defaultReadBufferSize,f=new Buffer(e);t>0&&this.inBuf.copy(f,0,this.readCursor,this.writeCursor),this.readCursor=0,this.writeCursor=t,this.inBuf=f};st.prototype.rollbackPosition=function(){this.readCursor=0};st.prototype.isOpen=function(){return!0};st.prototype.open=function(){};st.prototype.close=function(){};st.prototype.setCurrSeqId=function(t){this._seqid=t};st.prototype.ensureAvailable=function(t){if(this.readCursor+t>this.writeCursor)throw new tv};st.prototype.read=function(t){this.ensureAvailable(t);var e=new Buffer(t);return this.inBuf.copy(e,0,this.readCursor,this.readCursor+t),this.readCursor+=t,e};st.prototype.readByte=function(){return this.ensureAvailable(1),wl.readByte(this.inBuf[this.readCursor++])};st.prototype.readI16=function(){this.ensureAvailable(2);var t=wl.readI16(this.inBuf,this.readCursor);return this.readCursor+=2,t};st.prototype.readI32=function(){this.ensureAvailable(4);var t=wl.readI32(this.inBuf,this.readCursor);return this.readCursor+=4,t};st.prototype.readDouble=function(){this.ensureAvailable(8);var t=wl.readDouble(this.inBuf,this.readCursor);return this.readCursor+=8,t};st.prototype.readString=function(t){this.ensureAvailable(t);var e=this.inBuf.toString("utf8",this.readCursor,this.readCursor+t);return this.readCursor+=t,e};st.prototype.borrow=function(){var t={buf:this.inBuf,readIndex:this.readCursor,writeIndex:this.writeCursor};return t};st.prototype.consume=function(t){this.readCursor+=t};st.prototype.write=function(t){typeof t=="string"&&(t=new Buffer(t,"utf8")),this.outBuffers.push(t),this.outCount+=t.length};st.prototype.flush=function(){var t=this._seqid;if(this._seqid=null,!(this.outCount<1)){var e=new Buffer(this.outCount),f=0;this.outBuffers.forEach(function(r){r.copy(e,f,0),f+=r.length}),this.onFlush&&this.onFlush(e,t),this.outBuffers=[],this.outCount=0}}});var Ea=de((qE,yc)=>{var hc=St(),gc=yc.exports={},rv=Math.pow(2,24),jc=Math.pow(2,31),xa=Math.pow(2,32),qc=Math.pow(10,11);gc.toDecimalString=function(t){var e=t.buffer,f=t.offset;if(!e[f]&&!(e[f+1]&224)||!~e[f]&&!~(e[f+1]&224))return t.toString();var r=e[f]&128;if(r){for(var n=!1,i=new Buffer(8),o=7;o>=0;--o)i[o]=~e[f+o]+(n?0:1)&255,n|=e[f+o];e=i}var s=e[f+1]+(e[f]<<8),a=e[f+7]+(e[f+6]<<8)+(e[f+5]<<16)+e[f+4]*rv+(e[f+3]+(e[f+2]<<8))*xa+s*74976710656,p=Math.floor(a/qc)+s*2814;return a=("00000000000"+String(a%qc)).slice(-11),(r?"-":"")+String(p)+a};gc.fromDecimalString=function(t){var e=t.charAt(0)==="-";if(t.length<(e?17:16))return new hc(+t);if(t.length>(e?20:19))throw new RangeError("Too many digits for Int64: "+t);var f=+t.slice(e?1:0,-15),r=+t.slice(-15)+f*2764472320,n=Math.floor(r/xa)+f*232830;if(r=r%xa,n>=jc&&!(e&&n==jc&&r==0))throw new RangeError("The magnitude is too large for Int64.");return e&&(n=~n,r===0?n=n+1&4294967295:r=~r+1,n=2147483648|n),new hc(n,r)}});var Tc=de((kE,kc)=>{var vc=St(),yE=Ea(),vE=kc.exports=function(){"use strict";var t,e,f={'"':'"',"\\":"\\","/":"/",b:"\b",f:"\f",n:`
|
|
13
13
|
`,r:"\r",t:" "},r,n=function(j){throw new SyntaxError(j)},i=function(j){return j&&j!==e&&n("Expected '"+j+"' instead of '"+e+"'"),e=r.charAt(t),t+=1,e},o=function(){var j,B="";for(e==="-"&&(B="-",i("-"));e>="0"&&e<="9";)B+=e,i();if(e===".")for(B+=".";i()&&e>="0"&&e<="9";)B+=e;if(e==="e"||e==="E")for(B+=e,i(),(e==="-"||e==="+")&&(B+=e,i());e>="0"&&e<="9";)B+=e,i();if(j=+B,!isFinite(j))n("Bad number");else return j>=vc.MAX_INT||j<=vc.MIN_INT?B:j},s=function(){var j,B,v="",R;if(e==='"')for(;i();){if(e==='"')return i(),v;if(e==="\\")if(i(),e==="u"){for(R=0,B=0;B<4&&(j=parseInt(i(),16),!!isFinite(j));B+=1)R=R*16+j;v+=String.fromCharCode(R)}else if(typeof f[e]=="string")v+=f[e];else break;else v+=e}n("Bad string")},a=function(){for(;e&&e<=" ";)i()},p=function(){switch(e){case"t":return i("t"),i("r"),i("u"),i("e"),!0;case"f":return i("f"),i("a"),i("l"),i("s"),i("e"),!1;case"n":return i("n"),i("u"),i("l"),i("l"),null}n("Unexpected '"+e+"'")},w,g=function(){var j=[];if(e==="["){if(i("["),a(),e==="]")return i("]"),j;for(;e;){if(j.push(w()),a(),e==="]")return i("]"),j;i(","),a()}}n("Bad array")},m=function(){var j,B={};if(e==="{"){if(i("{"),a(),e==="}")return i("}"),B;for(;e;){if(j=s(),a(),i(":"),Object.hasOwnProperty.call(B,j)&&n('Duplicate key "'+j+'"'),B[j]=w(),a(),e==="}")return i("}"),B;i(","),a()}}n("Bad object")};return w=function(){switch(a(),e){case"{":return m();case"[":return g();case'"':return s();case"-":return o();default:return e>="0"&&e<="9"?o():p()}},function(j){var B;return r=j,t=0,e=" ",B=w(),a(),e&&n("Syntax error"),B}}()});var yi=de((_E,xc)=>{var Ia=St(),nv=br(),Re=nv.Type,TE=fr("util"),_c=Ea(),iv=Tc(),Bc=Cr();xc.exports=ie;function ie(t){this.tstack=[],this.tpos=[],this.trans=t}ie.Type={};ie.Type[Re.BOOL]='"tf"';ie.Type[Re.BYTE]='"i8"';ie.Type[Re.I16]='"i16"';ie.Type[Re.I32]='"i32"';ie.Type[Re.I64]='"i64"';ie.Type[Re.DOUBLE]='"dbl"';ie.Type[Re.STRUCT]='"rec"';ie.Type[Re.STRING]='"str"';ie.Type[Re.MAP]='"map"';ie.Type[Re.LIST]='"lst"';ie.Type[Re.SET]='"set"';ie.RType={};ie.RType.tf=Re.BOOL;ie.RType.i8=Re.BYTE;ie.RType.i16=Re.I16;ie.RType.i32=Re.I32;ie.RType.i64=Re.I64;ie.RType.dbl=Re.DOUBLE;ie.RType.rec=Re.STRUCT;ie.RType.str=Re.STRING;ie.RType.map=Re.MAP;ie.RType.lst=Re.LIST;ie.RType.set=Re.SET;ie.Version=1;ie.prototype.flush=function(){return this.writeToTransportIfStackIsFlushable(),this.trans.flush()};ie.prototype.writeToTransportIfStackIsFlushable=function(){this.tstack.length===1&&this.trans.write(this.tstack.pop())};ie.prototype.writeMessageBegin=function(t,e,f){this.tstack.push([ie.Version,'"'+t+'"',e,f])};ie.prototype.writeMessageEnd=function(){var t=this.tstack.pop();this.wobj=this.tstack.pop(),this.wobj.push(t),this.wbuf="["+this.wobj.join(",")+"]",this.trans.write(this.wbuf)};ie.prototype.writeStructBegin=function(t){this.tpos.push(this.tstack.length),this.tstack.push({})};ie.prototype.writeStructEnd=function(){var t=this.tpos.pop(),e=this.tstack[t],f="{",r=!0;for(var n in e)r?r=!1:f+=",",f+=n+":"+e[n];f+="}",this.tstack[t]=f,this.writeToTransportIfStackIsFlushable()};ie.prototype.writeFieldBegin=function(t,e,f){this.tpos.push(this.tstack.length),this.tstack.push({fieldId:'"'+f+'"',fieldType:ie.Type[e]})};ie.prototype.writeFieldEnd=function(){var t=this.tstack.pop(),e=this.tstack.pop();":"+t==":[object Object]"?this.tstack[this.tstack.length-1][e.fieldId]="{"+e.fieldType+":"+JSON.stringify(t)+"}":this.tstack[this.tstack.length-1][e.fieldId]="{"+e.fieldType+":"+t+"}",this.tpos.pop(),this.writeToTransportIfStackIsFlushable()};ie.prototype.writeFieldStop=function(){};ie.prototype.writeMapBegin=function(t,e,f){this.tpos.push(this.tstack.length),this.tstack.push([ie.Type[t],ie.Type[e],0])};ie.prototype.writeMapEnd=function(){var t=this.tpos.pop();if(t!=this.tstack.length){(this.tstack.length-t-1)%2!=0&&this.tstack.push("");var e=(this.tstack.length-t-1)/2;this.tstack[t][this.tstack[t].length-1]=e;for(var f="}",r=!0;this.tstack.length>t+1;){var n=this.tstack.pop(),i=this.tstack.pop();r?r=!1:f=","+f,isNaN(i)||(i='"'+i+'"'),f=i+":"+n+f}f="{"+f,this.tstack[t].push(f),this.tstack[t]="["+this.tstack[t].join(",")+"]",this.writeToTransportIfStackIsFlushable()}};ie.prototype.writeListBegin=function(t,e){this.tpos.push(this.tstack.length),this.tstack.push([ie.Type[t],e])};ie.prototype.writeListEnd=function(){for(var t=this.tpos.pop();this.tstack.length>t+1;){var e=this.tstack[t+1];this.tstack.splice(t+1,1),this.tstack[t].push(e)}this.tstack[t]="["+this.tstack[t].join(",")+"]",this.writeToTransportIfStackIsFlushable()};ie.prototype.writeSetBegin=function(t,e){this.tpos.push(this.tstack.length),this.tstack.push([ie.Type[t],e])};ie.prototype.writeSetEnd=function(){for(var t=this.tpos.pop();this.tstack.length>t+1;){var e=this.tstack[t+1];this.tstack.splice(t+1,1),this.tstack[t].push(e)}this.tstack[t]="["+this.tstack[t].join(",")+"]",this.writeToTransportIfStackIsFlushable()};ie.prototype.writeBool=function(t){this.tstack.push(t?1:0)};ie.prototype.writeByte=function(t){this.tstack.push(t)};ie.prototype.writeI16=function(t){this.tstack.push(t)};ie.prototype.writeI32=function(t){this.tstack.push(t)};ie.prototype.writeI64=function(t){t instanceof Ia?this.tstack.push(_c.toDecimalString(t)):this.tstack.push(t)};ie.prototype.writeDouble=function(t){this.tstack.push(t)};ie.prototype.writeString=function(t){if(t===null)this.tstack.push(null);else{if(typeof t=="string")var e=t;else if(t instanceof Buffer)var e=t.toString("utf8");else throw new Error("writeString called without a string/Buffer argument: "+t);for(var f="",r=0;r<e.length;r++){var n=e.charAt(r);n==='"'?f+='\\"':n==="\\"?f+="\\\\":n==="\b"?f+="\\b":n==="\f"?f+="\\f":n===`
|
|
14
14
|
`?f+="\\n":n==="\r"?f+="\\r":n===" "?f+="\\t":f+=n}this.tstack.push('"'+f+'"')}};ie.prototype.writeBinary=function(t){if(typeof t=="string")var e=new Buffer(t,"binary");else if(t instanceof Buffer||Object.prototype.toString.call(t)=="[object Uint8Array]")var e=t;else throw new Error("writeBinary called without a string/Buffer argument: "+t);this.tstack.push('"'+e.toString("base64")+'"')};ie.prototype.readMessageBegin=function(){this.rstack=[],this.rpos=[];var t=this.trans.borrow();if(t.readIndex>=t.writeIndex)throw new Bc;var e=t.readIndex;if(t.buf[e]!==91)throw new Error("Malformed JSON input, no opening bracket");e++;for(var f=1,r=!1;e<t.writeIndex;e++){var n=t.buf[e];if(r)n===34?r=!1:n===92&&(e+=1);else if(n===91)f+=1;else if(n===93){if(f-=1,f===0)break}else n===34&&(r=!0)}if(f!==0)throw new Bc;this.robj=iv(t.buf.slice(t.readIndex,e+1).toString()),this.trans.consume(e+1-t.readIndex);var i=this.robj.shift();if(i!=ie.Version)throw new Error("Wrong thrift protocol version: "+i);var o={};return o.fname=this.robj.shift(),o.mtype=this.robj.shift(),o.rseqid=this.robj.shift(),this.rstack.push(this.robj.shift()),o};ie.prototype.readMessageEnd=function(){};ie.prototype.readStructBegin=function(){var t={};return t.fname="",this.rstack[this.rstack.length-1]instanceof Array&&this.rstack.push(this.rstack[this.rstack.length-1].shift()),t};ie.prototype.readStructEnd=function(){this.rstack.pop()};ie.prototype.readFieldBegin=function(){var t={},e=-1,f=Re.STOP;for(var r in this.rstack[this.rstack.length-1])if(r!==null){e=parseInt(r,10),this.rpos.push(this.rstack.length);var n=this.rstack[this.rstack.length-1][e];delete this.rstack[this.rstack.length-1][e],this.rstack.push(n);break}if(e!=-1)for(var i in this.rstack[this.rstack.length-1])ie.RType[i]!==null&&(f=ie.RType[i],this.rstack[this.rstack.length-1]=this.rstack[this.rstack.length-1][i]);return t.fname="",t.ftype=f,t.fid=e,t};ie.prototype.readFieldEnd=function(){for(var t=this.rpos.pop();this.rstack.length>t;)this.rstack.pop()};ie.prototype.readMapBegin=function(){var t=this.rstack.pop(),e=t.shift();e instanceof Array&&(this.rstack.push(t),t=e,e=t.shift());var f={};return f.ktype=ie.RType[e],f.vtype=ie.RType[t.shift()],f.size=t.shift(),this.rpos.push(this.rstack.length),this.rstack.push(t.shift()),f};ie.prototype.readMapEnd=function(){this.readFieldEnd()};ie.prototype.readListBegin=function(){var t=this.rstack[this.rstack.length-1],e={};return e.etype=ie.RType[t.shift()],e.size=t.shift(),this.rpos.push(this.rstack.length),this.rstack.push(t.shift()),e};ie.prototype.readListEnd=function(){var t=this.rpos.pop()-2,e=this.rstack;e.pop(),e instanceof Array&&e.length>t&&e[t].length>0&&e.push(e[t].shift())};ie.prototype.readSetBegin=function(){return this.readListBegin()};ie.prototype.readSetEnd=function(){return this.readListEnd()};ie.prototype.readBool=function(){return this.readValue()=="1"};ie.prototype.readByte=function(){return this.readI32()};ie.prototype.readI16=function(){return this.readI32()};ie.prototype.readI32=function(t){return+this.readValue()};ie.prototype.readValue=function(t){t===void 0&&(t=this.rstack[this.rstack.length-1]);var e={};if(t instanceof Array)t.length===0?e.value=void 0:e.value=t.shift();else if(!(t instanceof Ia)&&t instanceof Object){for(var f in t)if(f!==null){this.rstack.push(t[f]),delete t[f],e.value=f;break}}else e.value=t,this.rstack.pop();return e.value};ie.prototype.readI64=function(){var t=this.readValue();return typeof t=="string"?_c.fromDecimalString(t):new Ia(t)};ie.prototype.readDouble=function(){return this.readI32()};ie.prototype.readBinary=function(){return new Buffer(this.readValue(),"base64")};ie.prototype.readString=function(){return this.readValue()};ie.prototype.getTransport=function(){return this.trans};ie.prototype.skip=function(t){switch(t){case Re.BOOL:this.readBool();break;case Re.BYTE:this.readByte();break;case Re.I16:this.readI16();break;case Re.I32:this.readI32();break;case Re.I64:this.readI64();break;case Re.DOUBLE:this.readDouble();break;case Re.STRING:this.readString();break;case Re.STRUCT:for(this.readStructBegin();;){var e=this.readFieldBegin();if(e.ftype===Re.STOP)break;this.skip(e.ftype),this.readFieldEnd()}this.readStructEnd();break;case Re.MAP:for(var f=this.readMapBegin(),r=0;r<f.size;++r)this.skip(f.ktype),this.skip(f.vtype);this.readMapEnd();break;case Re.SET:for(var n=this.readSetBegin(),i=0;i<n.size;++i)this.skip(n.etype);this.readSetEnd();break;case Re.LIST:for(var o=this.readListBegin(),s=0;s<o.size;++s)this.skip(o.etype);this.readListEnd();break;default:throw new Error("Invalid type: "+t)}}});var Sa=de((BE,Ec)=>{Ec.exports=ov;function ov(t,e){t.Client&&(t=t.Client);var f=function(i,o){e.write(i,o)},r=new e.transport(void 0,f),n=new t(r,e.protocol);return r.client=n,e.client=n,n}});var Ic=de(Tn=>{"use strict";Object.defineProperty(Tn,"__esModule",{value:!0});var lv=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},sv=typeof window!="undefined"&&typeof window.document!="undefined",av=(typeof self=="undefined"?"undefined":lv(self))==="object"&&self.constructor&&self.constructor.name==="DedicatedWorkerGlobalScope",pv=typeof process!="undefined"&&process.versions!=null&&process.versions.node!=null,wv=function(){return typeof window!="undefined"&&window.name==="nodejs"||navigator.userAgent.includes("Node.js")||navigator.userAgent.includes("jsdom")};Tn.isBrowser=sv;Tn.isWebWorker=av;Tn.isNode=pv;Tn.isJsDom=wv});var Hc=de(ml=>{var mv=fr("util"),Sc=Cb(),Ac=wa().EventEmitter,Oc=br(),uv=qi(),bv=yi(),cv=Cr(),dv=Sa(),hv=Ic();ml.WSConnection=At;function At(t,e,f){Ac.call(this),this.options=f||{},this.host=t,this.port=e,this.secure=this.options.secure||!1,this.transport=this.options.transport||uv,this.protocol=this.options.protocol||bv,this.path=this.options.path,this.send_pending=[],this.seqId2Service={},this.wsOptions={host:this.host,port:this.port||80,path:this.options.path||"/",headers:this.options.headers||{}};for(var r in this.options.wsOptions)this.wsOptions[r]=this.options.wsOptions[r]}mv.inherits(At,Ac);At.prototype.__reset=function(){this.socket=null,this.send_pending=[]};At.prototype.__onOpen=function(){this.emit("open"),this.send_pending.length>0&&(this.send_pending.forEach(function(t){this.socket.send(t)},this),this.send_pending=[])};At.prototype.__onClose=function(t){this.emit("close"),this.__reset()};At.prototype.__decodeCallback=function(t){var e=new this.protocol(t);try{for(;;){var f=e.readMessageBegin(),r=f.rseqid*-1,n=this.client,i=this.seqId2Service[f.rseqid];i&&(n=this.client[i],delete this.seqId2Service[f.rseqid]),n._reqs[r]=function(o,s){t.commitPosition();var a=n._reqs[f.rseqid];delete n._reqs[f.rseqid],a&&a(o,s)},n["recv_"+f.fname]?n["recv_"+f.fname](e,f.mtype,r):(delete n._reqs[r],this.emit("error",new Oc.TApplicationException(Oc.TApplicationExceptionType.WRONG_METHOD_NAME,"Received a response to an unknown RPC function")))}}catch(o){if(o instanceof cv)t.rollbackPosition();else throw o}};At.prototype.__onData=function(t){Object.prototype.toString.call(t)==="[object ArrayBuffer]"&&(t=new Uint8Array(t));var e=new Buffer(t);this.transport.receiver(this.__decodeCallback.bind(this))(e)};At.prototype.__onMessage=function(t){this.__onData(t.data)};At.prototype.__onError=function(t){this.emit("error",t),this.socket.close()};At.prototype.isOpen=function(){return this.socket&&this.socket.readyState===this.socket.OPEN};At.prototype.open=function(){this.socket&&this.socket.readyState!==this.socket.CLOSED||(hv.isBrowser?this.socket=new Sc(this.uri()):this.socket=new Sc(this.uri(),"",this.wsOptions),this.socket.binaryType="arraybuffer",this.socket.onopen=this.__onOpen.bind(this),this.socket.onmessage=this.__onMessage.bind(this),this.socket.onerror=this.__onError.bind(this),this.socket.onclose=this.__onClose.bind(this))};At.prototype.close=function(){this.socket.close()};At.prototype.uri=function(){var t=this.secure?"wss":"ws",e="",f=this.path||"/",r=this.host;return this.port&&(t==="wss"&&this.port!==443||t==="ws"&&this.port!==80)&&(e=":"+this.port),t+"://"+r+e+f};At.prototype.write=function(t){this.isOpen()?this.socket.send(t):this.send_pending.push(t)};ml.createWSConnection=function(t,e,f){return new At(t,e,f)};ml.createWSClient=dv});var Rc=de(ul=>{var gv=fr("util"),jv=wa().EventEmitter,Nc=br(),qv=qi(),yv=yi(),vv=Cr(),kv=Sa();ul.XHRConnection=Ft;function Ft(t,e,f){this.options=f||{},this.wpos=0,this.rpos=0,this.useCORS=f&&f.useCORS,this.send_buf="",this.recv_buf="",this.transport=f.transport||qv,this.protocol=f.protocol||yv,this.headers=f.headers||{},t=t||window.location.host,e=e||window.location.port;var r=f.https?"https://":"http://",n=f.path||"/";e===""&&(e=void 0),!e||e===80||e==="80"?this.url=r+t+n:this.url=r+t+":"+e+n,this.seqId2Service={}}gv.inherits(Ft,jv);Ft.prototype.getXmlHttpRequestObject=function(){try{return new XMLHttpRequest}catch{}try{return new ActiveXObject("Msxml2.XMLHTTP")}catch{}try{return new ActiveXObject("Microsoft.XMLHTTP")}catch{}throw"Your browser doesn't support XHR."};Ft.prototype.flush=function(){var t=this;if(this.url===void 0||this.url==="")return this.send_buf;var e=this.getXmlHttpRequestObject();e.overrideMimeType&&e.overrideMimeType("application/json"),e.onreadystatechange=function(){this.readyState==4&&this.status==200&&t.setRecvBuffer(this.responseText)},e.open("POST",this.url,!0),Object.keys(this.headers).forEach(function(f){e.setRequestHeader(f,t.headers[f])}),e.send(this.send_buf)};Ft.prototype.setRecvBuffer=function(t){if(this.recv_buf=t,this.recv_buf_sz=this.recv_buf.length,this.wpos=this.recv_buf.length,this.rpos=0,Object.prototype.toString.call(t)=="[object ArrayBuffer]")var e=new Uint8Array(t);var f=new Buffer(e||t);this.transport.receiver(this.__decodeCallback.bind(this))(f)};Ft.prototype.__decodeCallback=function(t){var e=new this.protocol(t);try{for(;;){var f=e.readMessageBegin(),r=f.rseqid*-1,n=this.client,i=this.seqId2Service[f.rseqid];i&&(n=this.client[i],delete this.seqId2Service[f.rseqid]),n._reqs[r]=function(o,s){t.commitPosition();var a=n._reqs[f.rseqid];delete n._reqs[f.rseqid],a&&a(o,s)},n["recv_"+f.fname]?n["recv_"+f.fname](e,f.mtype,r):(delete n._reqs[r],this.emit("error",new Nc.TApplicationException(Nc.TApplicationExceptionType.WRONG_METHOD_NAME,"Received a response to an unknown RPC function")))}}catch(o){if(o instanceof vv)t.rollbackPosition();else throw o}};Ft.prototype.isOpen=function(){return!0};Ft.prototype.open=function(){};Ft.prototype.close=function(){};Ft.prototype.read=function(t){var e=this.wpos-this.rpos;if(e===0)return"";var f=t;e<t&&(f=e);var r=this.read_buf.substr(this.rpos,f);return this.rpos+=f,r};Ft.prototype.readAll=function(){return this.recv_buf};Ft.prototype.write=function(t){this.send_buf=t,this.flush()};Ft.prototype.getSendBuffer=function(){return this.send_buf};ul.createXHRConnection=function(t,e,f){return new Ft(t,e,f)};ul.createXHRClient=kv});var zc=de((Pc,Aa)=>{(function(t){"use strict";if(typeof bootstrap=="function")bootstrap("promise",t);else if(typeof Pc=="object"&&typeof Aa=="object")Aa.exports=t();else if(typeof define=="function"&&define.amd)define(t);else if(typeof ses!="undefined")if(ses.ok())ses.makeQ=t;else return;else if(typeof window!="undefined"||typeof self!="undefined"){var e=typeof window!="undefined"?window:self,f=e.Q;e.Q=t(),e.Q.noConflict=function(){return e.Q=f,this}}else throw new Error("This environment was not anticipated by Q. Please file a bug.")})(function(){"use strict";var t=!1;try{throw new Error}catch(y){t=!!y.stack}var e=re(),f,r=function(){},n=function(){var y={task:void 0,next:null},_=y,H=!1,X=void 0,ge=!1,Be=[];function ye(){for(var Je,pt;y.next;)y=y.next,Je=y.task,y.task=void 0,pt=y.domain,pt&&(y.domain=void 0,pt.enter()),Ve(Je,pt);for(;Be.length;)Je=Be.pop(),Ve(Je);H=!1}function Ve(Je,pt){try{Je()}catch(Zf){if(ge)throw pt&&pt.exit(),setTimeout(ye,0),pt&&pt.enter(),Zf;setTimeout(function(){throw Zf},0)}pt&&pt.exit()}if(n=function(Je){_=_.next={task:Je,domain:ge&&process.domain,next:null},H||(H=!0,X())},typeof process=="object"&&process.toString()==="[object process]"&&process.nextTick)ge=!0,X=function(){process.nextTick(ye)};else if(typeof setImmediate=="function")typeof window!="undefined"?X=setImmediate.bind(window,ye):X=function(){setImmediate(ye)};else if(typeof MessageChannel!="undefined"){var De=new MessageChannel;De.port1.onmessage=function(){X=Ge,De.port1.onmessage=ye,ye()};var Ge=function(){De.port2.postMessage(0)};X=function(){setTimeout(ye,0),Ge()}}else X=function(){setTimeout(ye,0)};return n.runAfter=function(Je){Be.push(Je),H||(H=!0,X())},n}(),i=Function.call;function o(y){return function(){return i.apply(y,arguments)}}var s=o(Array.prototype.slice),a=o(Array.prototype.reduce||function(y,_){var H=0,X=this.length;if(arguments.length===1)do{if(H in this){_=this[H++];break}if(++H>=X)throw new TypeError}while(1);for(;H<X;H++)H in this&&(_=y(_,this[H],H));return _}),p=o(Array.prototype.indexOf||function(y){for(var _=0;_<this.length;_++)if(this[_]===y)return _;return-1}),w=o(Array.prototype.map||function(y,_){var H=this,X=[];return a(H,function(ge,Be,ye){X.push(y.call(_,Be,ye,H))},void 0),X}),g=Object.create||function(y){function _(){}return _.prototype=y,new _},m=Object.defineProperty||function(y,_,H){return y[_]=H.value,y},j=o(Object.prototype.hasOwnProperty),B=Object.keys||function(y){var _=[];for(var H in y)j(y,H)&&_.push(H);return _},v=o(Object.prototype.toString);function R(y){return y===Object(y)}function D(y){return v(y)==="[object StopIteration]"||y instanceof z}var z;typeof ReturnValue!="undefined"?z=ReturnValue:z=function(y){this.value=y};var G="From previous event:";function fe(y,_){if(t&&_.stack&&typeof y=="object"&&y!==null&&y.stack){for(var H=[],X=_;X;X=X.source)X.stack&&(!y.__minimumStackCounter__||y.__minimumStackCounter__>X.stackCounter)&&(m(y,"__minimumStackCounter__",{value:X.stackCounter,configurable:!0}),H.unshift(X.stack));H.unshift(y.stack);var ge=H.join(`
|
|
15
15
|
`+G+`
|