@loaders.gl/bson 4.3.1 → 4.4.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bson-format.d.ts +10 -0
- package/dist/bson-format.d.ts.map +1 -0
- package/dist/bson-format.js +12 -0
- package/dist/bson-loader.d.ts.map +1 -1
- package/dist/bson-loader.js +6 -1
- package/dist/bson-writer.d.ts +3 -0
- package/dist/bson-writer.d.ts.map +1 -1
- package/dist/bson-writer.js +3 -1
- package/dist/dist.dev.js +13 -0
- package/dist/dist.min.js +4 -4
- package/dist/index.cjs +15 -2
- package/dist/index.cjs.map +3 -3
- package/package.json +6 -6
- package/src/bson-format.ts +15 -0
- package/src/bson-loader.ts +3 -0
- package/src/bson-writer.ts +2 -0
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare const BSONFormat: {
|
|
2
|
+
readonly name: "BSON";
|
|
3
|
+
readonly id: "bson";
|
|
4
|
+
readonly module: "bson";
|
|
5
|
+
readonly extensions: ["bson"];
|
|
6
|
+
readonly mimeTypes: ["application/bson"];
|
|
7
|
+
readonly category: "json";
|
|
8
|
+
readonly binary: true;
|
|
9
|
+
};
|
|
10
|
+
//# sourceMappingURL=bson-format.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bson-format.d.ts","sourceRoot":"","sources":["../src/bson-format.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,UAAU;;;;;;;;CAQI,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
// loaders.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// Copyright (c) vis.gl contributors
|
|
4
|
+
export const BSONFormat = {
|
|
5
|
+
name: 'BSON',
|
|
6
|
+
id: 'bson',
|
|
7
|
+
module: 'bson',
|
|
8
|
+
extensions: ['bson'],
|
|
9
|
+
mimeTypes: ['application/bson'],
|
|
10
|
+
category: 'json',
|
|
11
|
+
binary: true
|
|
12
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bson-loader.d.ts","sourceRoot":"","sources":["../src/bson-loader.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"bson-loader.d.ts","sourceRoot":"","sources":["../src/bson-loader.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAmB,aAAa,EAAC,MAAM,0BAA0B,CAAC;AAC9E,OAAO,KAAK,EAAC,gBAAgB,EAAC,oCAAiC;AAQ/D;;;GAGG;AACH,MAAM,MAAM,iBAAiB,GAAG,aAAa,GAAG;IAC9C,IAAI,CAAC,EAAE,gBAAgB,CAAC;CACzB,CAAC;AAEF,eAAO,MAAM,UAAU,KAiBiE,CAAC"}
|
package/dist/bson-loader.js
CHANGED
|
@@ -1,8 +1,13 @@
|
|
|
1
|
+
// loaders.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// Copyright (c) vis.gl contributors
|
|
1
4
|
import { parseBSONSync } from "./lib/parsers/parse-bson.js";
|
|
5
|
+
import { BSONFormat } from "./bson-format.js";
|
|
2
6
|
// __VERSION__ is injected by babel-plugin-version-inline
|
|
3
7
|
// @ts-ignore TS2304: Cannot find name '__VERSION__'.
|
|
4
|
-
const VERSION = typeof "4.
|
|
8
|
+
const VERSION = typeof "4.4.0-alpha.0" !== 'undefined' ? "4.4.0-alpha.0" : 'latest';
|
|
5
9
|
export const BSONLoader = {
|
|
10
|
+
...BSONFormat,
|
|
6
11
|
dataType: null,
|
|
7
12
|
batchType: null,
|
|
8
13
|
name: 'BSON',
|
package/dist/bson-writer.d.ts
CHANGED
|
@@ -14,5 +14,8 @@ export declare const BSONWriter: {
|
|
|
14
14
|
};
|
|
15
15
|
readonly encode: (data: Record<string, unknown>, options?: WriterOptions) => Promise<ArrayBuffer>;
|
|
16
16
|
readonly encodeSync: (data: Record<string, unknown>, options?: WriterOptions) => ArrayBuffer;
|
|
17
|
+
readonly mimeTypes: ["application/bson"];
|
|
18
|
+
readonly category: "json";
|
|
19
|
+
readonly binary: true;
|
|
17
20
|
};
|
|
18
21
|
//# sourceMappingURL=bson-writer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bson-writer.d.ts","sourceRoot":"","sources":["../src/bson-writer.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAoB,aAAa,EAAC,MAAM,0BAA0B,CAAC;AAC/E,OAAO,KAAK,EAAC,iBAAiB,EAAC,sCAAmC;
|
|
1
|
+
{"version":3,"file":"bson-writer.d.ts","sourceRoot":"","sources":["../src/bson-writer.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAoB,aAAa,EAAC,MAAM,0BAA0B,CAAC;AAC/E,OAAO,KAAK,EAAC,iBAAiB,EAAC,sCAAmC;AAQlE,MAAM,MAAM,iBAAiB,GAAG,aAAa,GAAG;IAC9C,IAAI,CAAC,EAAE,iBAAiB,CAAA;CACzB,CAAA;AAED,eAAO,MAAM,UAAU;;;;;;;;;4BAUF,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,YAAY,aAAa,KAAG,OAAO,CAAC,WAAW,CAAC;gCAGzE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,YAAY,aAAa,KAAG,WAAW;;;;CAGQ,CAAC"}
|
package/dist/bson-writer.js
CHANGED
|
@@ -2,10 +2,12 @@
|
|
|
2
2
|
// SPDX-License-Identifier: MIT
|
|
3
3
|
// Copyright (c) vis.gl contributors
|
|
4
4
|
import { encodeBSONSync } from "./lib/encoders/encode-bson.js";
|
|
5
|
+
import { BSONFormat } from "./bson-format.js";
|
|
5
6
|
// __VERSION__ is injected by babel-plugin-version-inline
|
|
6
7
|
// @ts-ignore TS2304: Cannot find name '__VERSION__'.
|
|
7
|
-
const VERSION = typeof "4.
|
|
8
|
+
const VERSION = typeof "4.4.0-alpha.0" !== 'undefined' ? "4.4.0-alpha.0" : 'latest';
|
|
8
9
|
export const BSONWriter = {
|
|
10
|
+
...BSONFormat,
|
|
9
11
|
name: 'BSON',
|
|
10
12
|
id: 'bson',
|
|
11
13
|
module: 'bson',
|
package/dist/dist.dev.js
CHANGED
|
@@ -6135,9 +6135,21 @@ var __exports__ = (() => {
|
|
|
6135
6135
|
return parsedData;
|
|
6136
6136
|
}
|
|
6137
6137
|
|
|
6138
|
+
// src/bson-format.ts
|
|
6139
|
+
var BSONFormat = {
|
|
6140
|
+
name: "BSON",
|
|
6141
|
+
id: "bson",
|
|
6142
|
+
module: "bson",
|
|
6143
|
+
extensions: ["bson"],
|
|
6144
|
+
mimeTypes: ["application/bson"],
|
|
6145
|
+
category: "json",
|
|
6146
|
+
binary: true
|
|
6147
|
+
};
|
|
6148
|
+
|
|
6138
6149
|
// src/bson-loader.ts
|
|
6139
6150
|
var VERSION = typeof __VERSION__ !== "undefined" ? __VERSION__ : "latest";
|
|
6140
6151
|
var BSONLoader = {
|
|
6152
|
+
...BSONFormat,
|
|
6141
6153
|
dataType: null,
|
|
6142
6154
|
batchType: null,
|
|
6143
6155
|
name: "BSON",
|
|
@@ -6172,6 +6184,7 @@ var __exports__ = (() => {
|
|
|
6172
6184
|
// src/bson-writer.ts
|
|
6173
6185
|
var VERSION2 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "latest";
|
|
6174
6186
|
var BSONWriter = {
|
|
6187
|
+
...BSONFormat,
|
|
6175
6188
|
name: "BSON",
|
|
6176
6189
|
id: "bson",
|
|
6177
6190
|
module: "bson",
|
package/dist/dist.min.js
CHANGED
|
@@ -4,15 +4,15 @@
|
|
|
4
4
|
else if (typeof define === 'function' && define.amd) define([], factory);
|
|
5
5
|
else if (typeof exports === 'object') exports['loaders'] = factory();
|
|
6
6
|
else root['loaders'] = factory();})(globalThis, function () {
|
|
7
|
-
"use strict";var __exports__=(()=>{var Me=Object.create;var zt=Object.defineProperty;var Pe=Object.getOwnPropertyDescriptor;var je=Object.getOwnPropertyNames;var Ye=Object.getPrototypeOf,ve=Object.prototype.hasOwnProperty;var Fe=(B,e)=>()=>(e||B((e={exports:{}}).exports,e),e.exports),Le=(B,e)=>{for(var y in e)zt(B,y,{get:e[y],enumerable:!0})},Ct=(B,e,y,b)=>{if(e&&typeof e=="object"||typeof e=="function")for(let l of je(e))!ve.call(B,l)&&l!==y&&zt(B,l,{get:()=>e[l],enumerable:!(b=Pe(e,l))||b.enumerable});return B},Jt=(B,e,y)=>(Ct(B,e,"default"),y&&Ct(y,e,"default")),Ce=(B,e,y)=>(y=B!=null?Me(Ye(B)):{},Ct(e||!B||!B.__esModule?zt(y,"default",{value:B,enumerable:!0}):y,B)),ze=B=>Ct(zt({},"__esModule",{value:!0}),B);var Se=Fe((Er,Oe)=>{Oe.exports=globalThis.loaders});var vt={};Le(vt,{BSONLoader:()=>te,BSONWriter:()=>Ue});Jt(vt,Ce(Se(),1));var Ht=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function st(B){return B&&B.__esModule&&Object.prototype.hasOwnProperty.call(B,"default")?B.default:B}function ot(B,e){return e={exports:{}},B(e,e.exports),e.exports}var Je=Ke,We=Ge,Xe=qe,gt=[],yt=[],ke=typeof Uint8Array<"u"?Uint8Array:Array,re="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(Tt=0,Ae=re.length;Tt<Ae;++Tt)gt[Tt]=re[Tt],yt[re.charCodeAt(Tt)]=Tt;var Tt,Ae;yt["-".charCodeAt(0)]=62;yt["_".charCodeAt(0)]=63;function Ee(B){var e=B.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var y=B.indexOf("=");y===-1&&(y=e);var b=y===e?0:4-y%4;return[y,b]}function Ke(B){var e=Ee(B),y=e[0],b=e[1];return(y+b)*3/4-b}function He(B,e,y){return(e+y)*3/4-y}function Ge(B){var e,y=Ee(B),b=y[0],l=y[1],f=new ke(He(B,b,l)),a=0,E=l>0?b-4:b,o;for(o=0;o<E;o+=4)e=yt[B.charCodeAt(o)]<<18|yt[B.charCodeAt(o+1)]<<12|yt[B.charCodeAt(o+2)]<<6|yt[B.charCodeAt(o+3)],f[a++]=e>>16&255,f[a++]=e>>8&255,f[a++]=e&255;return l===2&&(e=yt[B.charCodeAt(o)]<<2|yt[B.charCodeAt(o+1)]>>4,f[a++]=e&255),l===1&&(e=yt[B.charCodeAt(o)]<<10|yt[B.charCodeAt(o+1)]<<4|yt[B.charCodeAt(o+2)]>>2,f[a++]=e>>8&255,f[a++]=e&255),f}function Ve(B){return gt[B>>18&63]+gt[B>>12&63]+gt[B>>6&63]+gt[B&63]}function Ze(B,e,y){for(var b,l=[],f=e;f<y;f+=3)b=(B[f]<<16&16711680)+(B[f+1]<<8&65280)+(B[f+2]&255),l.push(Ve(b));return l.join("")}function qe(B){for(var e,y=B.length,b=y%3,l=[],f=16383,a=0,E=y-b;a<E;a+=f)l.push(Ze(B,a,a+f>E?E:a+f));return b===1?(e=B[y-1],l.push(gt[e>>2]+gt[e<<4&63]+"==")):b===2&&(e=(B[y-2]<<8)+B[y-1],l.push(gt[e>>10]+gt[e>>4&63]+gt[e<<2&63]+"=")),l.join("")}var ne={byteLength:Je,toByteArray:We,fromByteArray:Xe},Qe=function(e,y,b,l,f){var a,E,o=f*8-l-1,c=(1<<o)-1,h=c>>1,p=-7,n=b?f-1:0,w=b?-1:1,U=e[y+n];for(n+=w,a=U&(1<<-p)-1,U>>=-p,p+=o;p>0;a=a*256+e[y+n],n+=w,p-=8);for(E=a&(1<<-p)-1,a>>=-p,p+=l;p>0;E=E*256+e[y+n],n+=w,p-=8);if(a===0)a=1-h;else{if(a===c)return E?NaN:(U?-1:1)*(1/0);E=E+Math.pow(2,l),a=a-h}return(U?-1:1)*E*Math.pow(2,a-l)},xe=function(e,y,b,l,f,a){var E,o,c,h=a*8-f-1,p=(1<<h)-1,n=p>>1,w=f===23?Math.pow(2,-24)-Math.pow(2,-77):0,U=l?0:a-1,N=l?1:-1,Y=y<0||y===0&&1/y<0?1:0;for(y=Math.abs(y),isNaN(y)||y===1/0?(o=isNaN(y)?1:0,E=p):(E=Math.floor(Math.log(y)/Math.LN2),y*(c=Math.pow(2,-E))<1&&(E--,c*=2),E+n>=1?y+=w/c:y+=w*Math.pow(2,1-n),y*c>=2&&(E++,c/=2),E+n>=p?(o=0,E=p):E+n>=1?(o=(y*c-1)*Math.pow(2,f),E=E+n):(o=y*Math.pow(2,n-1)*Math.pow(2,f),E=0));f>=8;e[b+U]=o&255,U+=N,o/=256,f-=8);for(E=E<<f|o,h+=f;h>0;e[b+U]=E&255,U+=N,E/=256,h-=8);e[b+U-N]|=Y*128},bt={read:Qe,write:xe},C=ot(function(B,e){var y=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;e.Buffer=a,e.SlowBuffer=Y,e.INSPECT_MAX_BYTES=50;var b=2147483647;e.kMaxLength=b,a.TYPED_ARRAY_SUPPORT=l(),!a.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&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 l(){try{var u=new Uint8Array(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,Uint8Array.prototype),Object.setPrototypeOf(u,t),u.foo()===42}catch{return!1}}Object.defineProperty(a.prototype,"parent",{enumerable:!0,get:function(){if(a.isBuffer(this))return this.buffer}}),Object.defineProperty(a.prototype,"offset",{enumerable:!0,get:function(){if(a.isBuffer(this))return this.byteOffset}});function f(u){if(u>b)throw new RangeError('The value "'+u+'" is invalid for option "size"');var t=new Uint8Array(u);return Object.setPrototypeOf(t,a.prototype),t}function a(u,t,r){if(typeof u=="number"){if(typeof t=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return h(u)}return E(u,t,r)}a.poolSize=8192;function E(u,t,r){if(typeof u=="string")return p(u,t);if(ArrayBuffer.isView(u))return n(u);if(u==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+babelHelpers.typeof(u));if(Q(u,ArrayBuffer)||u&&Q(u.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(Q(u,SharedArrayBuffer)||u&&Q(u.buffer,SharedArrayBuffer)))return w(u,t,r);if(typeof u=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');var _=u.valueOf&&u.valueOf();if(_!=null&&_!==u)return a.from(_,t,r);var S=U(u);if(S)return S;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof u[Symbol.toPrimitive]=="function")return a.from(u[Symbol.toPrimitive]("string"),t,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+babelHelpers.typeof(u))}a.from=function(u,t,r){return E(u,t,r)},Object.setPrototypeOf(a.prototype,Uint8Array.prototype),Object.setPrototypeOf(a,Uint8Array);function o(u){if(typeof u!="number")throw new TypeError('"size" argument must be of type number');if(u<0)throw new RangeError('The value "'+u+'" is invalid for option "size"')}function c(u,t,r){return o(u),u<=0?f(u):t!==void 0?typeof r=="string"?f(u).fill(t,r):f(u).fill(t):f(u)}a.alloc=function(u,t,r){return c(u,t,r)};function h(u){return o(u),f(u<0?0:N(u)|0)}a.allocUnsafe=function(u){return h(u)},a.allocUnsafeSlow=function(u){return h(u)};function p(u,t){if((typeof t!="string"||t==="")&&(t="utf8"),!a.isEncoding(t))throw new TypeError("Unknown encoding: "+t);var r=J(u,t)|0,_=f(r),S=_.write(u,t);return S!==r&&(_=_.slice(0,S)),_}function n(u){for(var t=u.length<0?0:N(u.length)|0,r=f(t),_=0;_<t;_+=1)r[_]=u[_]&255;return r}function w(u,t,r){if(t<0||u.byteLength<t)throw new RangeError('"offset" is outside of buffer bounds');if(u.byteLength<t+(r||0))throw new RangeError('"length" is outside of buffer bounds');var _;return t===void 0&&r===void 0?_=new Uint8Array(u):r===void 0?_=new Uint8Array(u,t):_=new Uint8Array(u,t,r),Object.setPrototypeOf(_,a.prototype),_}function U(u){if(a.isBuffer(u)){var t=N(u.length)|0,r=f(t);return r.length===0||u.copy(r,0,0,t),r}if(u.length!==void 0)return typeof u.length!="number"||at(u.length)?f(0):n(u);if(u.type==="Buffer"&&Array.isArray(u.data))return n(u.data)}function N(u){if(u>=b)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+b.toString(16)+" bytes");return u|0}function Y(u){return+u!=u&&(u=0),a.alloc(+u)}a.isBuffer=function(t){return t!=null&&t._isBuffer===!0&&t!==a.prototype},a.compare=function(t,r){if(Q(t,Uint8Array)&&(t=a.from(t,t.offset,t.byteLength)),Q(r,Uint8Array)&&(r=a.from(r,r.offset,r.byteLength)),!a.isBuffer(t)||!a.isBuffer(r))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(t===r)return 0;for(var _=t.length,S=r.length,P=0,v=Math.min(_,S);P<v;++P)if(t[P]!==r[P]){_=t[P],S=r[P];break}return _<S?-1:S<_?1:0},a.isEncoding=function(t){switch(String(t).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}},a.concat=function(t,r){if(!Array.isArray(t))throw new TypeError('"list" argument must be an Array of Buffers');if(t.length===0)return a.alloc(0);var _;if(r===void 0)for(r=0,_=0;_<t.length;++_)r+=t[_].length;var S=a.allocUnsafe(r),P=0;for(_=0;_<t.length;++_){var v=t[_];if(Q(v,Uint8Array)&&(v=a.from(v)),!a.isBuffer(v))throw new TypeError('"list" argument must be an Array of Buffers');v.copy(S,P),P+=v.length}return S};function J(u,t){if(a.isBuffer(u))return u.length;if(ArrayBuffer.isView(u)||Q(u,ArrayBuffer))return u.byteLength;if(typeof u!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+babelHelpers.typeof(u));var r=u.length,_=arguments.length>2&&arguments[2]===!0;if(!_&&r===0)return 0;for(var S=!1;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return k(u).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return r*2;case"hex":return r>>>1;case"base64":return Ft(u).length;default:if(S)return _?-1:k(u).length;t=(""+t).toLowerCase(),S=!0}}a.byteLength=J;function R(u,t,r){var _=!1;if((t===void 0||t<0)&&(t=0),t>this.length||((r===void 0||r>this.length)&&(r=this.length),r<=0)||(r>>>=0,t>>>=0,r<=t))return"";for(u||(u="utf8");;)switch(u){case"hex":return g(this,t,r);case"utf8":case"utf-8":return i(this,t,r);case"ascii":return j(this,t,r);case"latin1":case"binary":return F(this,t,r);case"base64":return O(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return $(this,t,r);default:if(_)throw new TypeError("Unknown encoding: "+u);u=(u+"").toLowerCase(),_=!0}}a.prototype._isBuffer=!0;function W(u,t,r){var _=u[t];u[t]=u[r],u[r]=_}a.prototype.swap16=function(){var t=this.length;if(t%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var r=0;r<t;r+=2)W(this,r,r+1);return this},a.prototype.swap32=function(){var t=this.length;if(t%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var r=0;r<t;r+=4)W(this,r,r+3),W(this,r+1,r+2);return this},a.prototype.swap64=function(){var t=this.length;if(t%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var r=0;r<t;r+=8)W(this,r,r+7),W(this,r+1,r+6),W(this,r+2,r+5),W(this,r+3,r+4);return this},a.prototype.toString=function(){var t=this.length;return t===0?"":arguments.length===0?i(this,0,t):R.apply(this,arguments)},a.prototype.toLocaleString=a.prototype.toString,a.prototype.equals=function(t){if(!a.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t?!0:a.compare(this,t)===0},a.prototype.inspect=function(){var t="",r=e.INSPECT_MAX_BYTES;return t=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(t+=" ... "),"<Buffer "+t+">"},y&&(a.prototype[y]=a.prototype.inspect),a.prototype.compare=function(t,r,_,S,P){if(Q(t,Uint8Array)&&(t=a.from(t,t.offset,t.byteLength)),!a.isBuffer(t))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+babelHelpers.typeof(t));if(r===void 0&&(r=0),_===void 0&&(_=t?t.length:0),S===void 0&&(S=0),P===void 0&&(P=this.length),r<0||_>t.length||S<0||P>this.length)throw new RangeError("out of range index");if(S>=P&&r>=_)return 0;if(S>=P)return-1;if(r>=_)return 1;if(r>>>=0,_>>>=0,S>>>=0,P>>>=0,this===t)return 0;for(var v=P-S,tt=_-r,it=Math.min(v,tt),ft=this.slice(S,P),ct=t.slice(r,_),ut=0;ut<it;++ut)if(ft[ut]!==ct[ut]){v=ft[ut],tt=ct[ut];break}return v<tt?-1:tt<v?1:0};function x(u,t,r,_,S){if(u.length===0)return-1;if(typeof r=="string"?(_=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,at(r)&&(r=S?0:u.length-1),r<0&&(r=u.length+r),r>=u.length){if(S)return-1;r=u.length-1}else if(r<0)if(S)r=0;else return-1;if(typeof t=="string"&&(t=a.from(t,_)),a.isBuffer(t))return t.length===0?-1:G(u,t,r,_,S);if(typeof t=="number")return t=t&255,typeof Uint8Array.prototype.indexOf=="function"?S?Uint8Array.prototype.indexOf.call(u,t,r):Uint8Array.prototype.lastIndexOf.call(u,t,r):G(u,[t],r,_,S);throw new TypeError("val must be string, number or Buffer")}function G(u,t,r,_,S){var P=1,v=u.length,tt=t.length;if(_!==void 0&&(_=String(_).toLowerCase(),_==="ucs2"||_==="ucs-2"||_==="utf16le"||_==="utf-16le")){if(u.length<2||t.length<2)return-1;P=2,v/=2,tt/=2,r/=2}function it(ge,pe){return P===1?ge[pe]:ge.readUInt16BE(pe*P)}var ft;if(S){var ct=-1;for(ft=r;ft<v;ft++)if(it(u,ft)===it(t,ct===-1?0:ft-ct)){if(ct===-1&&(ct=ft),ft-ct+1===tt)return ct*P}else ct!==-1&&(ft-=ft-ct),ct=-1}else for(r+tt>v&&(r=v-tt),ft=r;ft>=0;ft--){for(var ut=!0,Lt=0;Lt<tt;Lt++)if(it(u,ft+Lt)!==it(t,Lt)){ut=!1;break}if(ut)return ft}return-1}a.prototype.includes=function(t,r,_){return this.indexOf(t,r,_)!==-1},a.prototype.indexOf=function(t,r,_){return x(this,t,r,_,!0)},a.prototype.lastIndexOf=function(t,r,_){return x(this,t,r,_,!1)};function M(u,t,r,_){r=Number(r)||0;var S=u.length-r;_?(_=Number(_),_>S&&(_=S)):_=S;var P=t.length;_>P/2&&(_=P/2);for(var v=0;v<_;++v){var tt=parseInt(t.substr(v*2,2),16);if(at(tt))return v;u[r+v]=tt}return v}function V(u,t,r,_){return ht(k(t,u.length-r),u,r,_)}function z(u,t,r,_){return ht(lt(t),u,r,_)}function Z(u,t,r,_){return z(u,t,r,_)}function s(u,t,r,_){return ht(Ft(t),u,r,_)}function A(u,t,r,_){return ht(ee(t,u.length-r),u,r,_)}a.prototype.write=function(t,r,_,S){if(r===void 0)S="utf8",_=this.length,r=0;else if(_===void 0&&typeof r=="string")S=r,_=this.length,r=0;else if(isFinite(r))r=r>>>0,isFinite(_)?(_=_>>>0,S===void 0&&(S="utf8")):(S=_,_=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var P=this.length-r;if((_===void 0||_>P)&&(_=P),t.length>0&&(_<0||r<0)||r>this.length)throw new RangeError("Attempt to write outside buffer bounds");S||(S="utf8");for(var v=!1;;)switch(S){case"hex":return M(this,t,r,_);case"utf8":case"utf-8":return V(this,t,r,_);case"ascii":return z(this,t,r,_);case"latin1":case"binary":return Z(this,t,r,_);case"base64":return s(this,t,r,_);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return A(this,t,r,_);default:if(v)throw new TypeError("Unknown encoding: "+S);S=(""+S).toLowerCase(),v=!0}},a.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function O(u,t,r){return t===0&&r===u.length?ne.fromByteArray(u):ne.fromByteArray(u.slice(t,r))}function i(u,t,r){r=Math.min(u.length,r);for(var _=[],S=t;S<r;){var P=u[S],v=null,tt=P>239?4:P>223?3:P>191?2:1;if(S+tt<=r){var it,ft,ct,ut;switch(tt){case 1:P<128&&(v=P);break;case 2:it=u[S+1],(it&192)===128&&(ut=(P&31)<<6|it&63,ut>127&&(v=ut));break;case 3:it=u[S+1],ft=u[S+2],(it&192)===128&&(ft&192)===128&&(ut=(P&15)<<12|(it&63)<<6|ft&63,ut>2047&&(ut<55296||ut>57343)&&(v=ut));break;case 4:it=u[S+1],ft=u[S+2],ct=u[S+3],(it&192)===128&&(ft&192)===128&&(ct&192)===128&&(ut=(P&15)<<18|(it&63)<<12|(ft&63)<<6|ct&63,ut>65535&&ut<1114112&&(v=ut))}}v===null?(v=65533,tt=1):v>65535&&(v-=65536,_.push(v>>>10&1023|55296),v=56320|v&1023),_.push(v),S+=tt}return D(_)}var m=4096;function D(u){var t=u.length;if(t<=m)return String.fromCharCode.apply(String,u);for(var r="",_=0;_<t;)r+=String.fromCharCode.apply(String,u.slice(_,_+=m));return r}function j(u,t,r){var _="";r=Math.min(u.length,r);for(var S=t;S<r;++S)_+=String.fromCharCode(u[S]&127);return _}function F(u,t,r){var _="";r=Math.min(u.length,r);for(var S=t;S<r;++S)_+=String.fromCharCode(u[S]);return _}function g(u,t,r){var _=u.length;(!t||t<0)&&(t=0),(!r||r<0||r>_)&&(r=_);for(var S="",P=t;P<r;++P)S+=nt[u[P]];return S}function $(u,t,r){for(var _=u.slice(t,r),S="",P=0;P<_.length;P+=2)S+=String.fromCharCode(_[P]+_[P+1]*256);return S}a.prototype.slice=function(t,r){var _=this.length;t=~~t,r=r===void 0?_:~~r,t<0?(t+=_,t<0&&(t=0)):t>_&&(t=_),r<0?(r+=_,r<0&&(r=0)):r>_&&(r=_),r<t&&(r=t);var S=this.subarray(t,r);return Object.setPrototypeOf(S,a.prototype),S};function L(u,t,r){if(u%1!==0||u<0)throw new RangeError("offset is not uint");if(u+t>r)throw new RangeError("Trying to access beyond buffer length")}a.prototype.readUIntLE=function(t,r,_){t=t>>>0,r=r>>>0,_||L(t,r,this.length);for(var S=this[t],P=1,v=0;++v<r&&(P*=256);)S+=this[t+v]*P;return S},a.prototype.readUIntBE=function(t,r,_){t=t>>>0,r=r>>>0,_||L(t,r,this.length);for(var S=this[t+--r],P=1;r>0&&(P*=256);)S+=this[t+--r]*P;return S},a.prototype.readUInt8=function(t,r){return t=t>>>0,r||L(t,1,this.length),this[t]},a.prototype.readUInt16LE=function(t,r){return t=t>>>0,r||L(t,2,this.length),this[t]|this[t+1]<<8},a.prototype.readUInt16BE=function(t,r){return t=t>>>0,r||L(t,2,this.length),this[t]<<8|this[t+1]},a.prototype.readUInt32LE=function(t,r){return t=t>>>0,r||L(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+this[t+3]*16777216},a.prototype.readUInt32BE=function(t,r){return t=t>>>0,r||L(t,4,this.length),this[t]*16777216+(this[t+1]<<16|this[t+2]<<8|this[t+3])},a.prototype.readIntLE=function(t,r,_){t=t>>>0,r=r>>>0,_||L(t,r,this.length);for(var S=this[t],P=1,v=0;++v<r&&(P*=256);)S+=this[t+v]*P;return P*=128,S>=P&&(S-=Math.pow(2,8*r)),S},a.prototype.readIntBE=function(t,r,_){t=t>>>0,r=r>>>0,_||L(t,r,this.length);for(var S=r,P=1,v=this[t+--S];S>0&&(P*=256);)v+=this[t+--S]*P;return P*=128,v>=P&&(v-=Math.pow(2,8*r)),v},a.prototype.readInt8=function(t,r){return t=t>>>0,r||L(t,1,this.length),this[t]&128?(255-this[t]+1)*-1:this[t]},a.prototype.readInt16LE=function(t,r){t=t>>>0,r||L(t,2,this.length);var _=this[t]|this[t+1]<<8;return _&32768?_|4294901760:_},a.prototype.readInt16BE=function(t,r){t=t>>>0,r||L(t,2,this.length);var _=this[t+1]|this[t]<<8;return _&32768?_|4294901760:_},a.prototype.readInt32LE=function(t,r){return t=t>>>0,r||L(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},a.prototype.readInt32BE=function(t,r){return t=t>>>0,r||L(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},a.prototype.readFloatLE=function(t,r){return t=t>>>0,r||L(t,4,this.length),bt.read(this,t,!0,23,4)},a.prototype.readFloatBE=function(t,r){return t=t>>>0,r||L(t,4,this.length),bt.read(this,t,!1,23,4)},a.prototype.readDoubleLE=function(t,r){return t=t>>>0,r||L(t,8,this.length),bt.read(this,t,!0,52,8)},a.prototype.readDoubleBE=function(t,r){return t=t>>>0,r||L(t,8,this.length),bt.read(this,t,!1,52,8)};function T(u,t,r,_,S,P){if(!a.isBuffer(u))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>S||t<P)throw new RangeError('"value" argument is out of bounds');if(r+_>u.length)throw new RangeError("Index out of range")}a.prototype.writeUIntLE=function(t,r,_,S){if(t=+t,r=r>>>0,_=_>>>0,!S){var P=Math.pow(2,8*_)-1;T(this,t,r,_,P,0)}var v=1,tt=0;for(this[r]=t&255;++tt<_&&(v*=256);)this[r+tt]=t/v&255;return r+_},a.prototype.writeUIntBE=function(t,r,_,S){if(t=+t,r=r>>>0,_=_>>>0,!S){var P=Math.pow(2,8*_)-1;T(this,t,r,_,P,0)}var v=_-1,tt=1;for(this[r+v]=t&255;--v>=0&&(tt*=256);)this[r+v]=t/tt&255;return r+_},a.prototype.writeUInt8=function(t,r,_){return t=+t,r=r>>>0,_||T(this,t,r,1,255,0),this[r]=t&255,r+1},a.prototype.writeUInt16LE=function(t,r,_){return t=+t,r=r>>>0,_||T(this,t,r,2,65535,0),this[r]=t&255,this[r+1]=t>>>8,r+2},a.prototype.writeUInt16BE=function(t,r,_){return t=+t,r=r>>>0,_||T(this,t,r,2,65535,0),this[r]=t>>>8,this[r+1]=t&255,r+2},a.prototype.writeUInt32LE=function(t,r,_){return t=+t,r=r>>>0,_||T(this,t,r,4,4294967295,0),this[r+3]=t>>>24,this[r+2]=t>>>16,this[r+1]=t>>>8,this[r]=t&255,r+4},a.prototype.writeUInt32BE=function(t,r,_){return t=+t,r=r>>>0,_||T(this,t,r,4,4294967295,0),this[r]=t>>>24,this[r+1]=t>>>16,this[r+2]=t>>>8,this[r+3]=t&255,r+4},a.prototype.writeIntLE=function(t,r,_,S){if(t=+t,r=r>>>0,!S){var P=Math.pow(2,8*_-1);T(this,t,r,_,P-1,-P)}var v=0,tt=1,it=0;for(this[r]=t&255;++v<_&&(tt*=256);)t<0&&it===0&&this[r+v-1]!==0&&(it=1),this[r+v]=(t/tt>>0)-it&255;return r+_},a.prototype.writeIntBE=function(t,r,_,S){if(t=+t,r=r>>>0,!S){var P=Math.pow(2,8*_-1);T(this,t,r,_,P-1,-P)}var v=_-1,tt=1,it=0;for(this[r+v]=t&255;--v>=0&&(tt*=256);)t<0&&it===0&&this[r+v+1]!==0&&(it=1),this[r+v]=(t/tt>>0)-it&255;return r+_},a.prototype.writeInt8=function(t,r,_){return t=+t,r=r>>>0,_||T(this,t,r,1,127,-128),t<0&&(t=255+t+1),this[r]=t&255,r+1},a.prototype.writeInt16LE=function(t,r,_){return t=+t,r=r>>>0,_||T(this,t,r,2,32767,-32768),this[r]=t&255,this[r+1]=t>>>8,r+2},a.prototype.writeInt16BE=function(t,r,_){return t=+t,r=r>>>0,_||T(this,t,r,2,32767,-32768),this[r]=t>>>8,this[r+1]=t&255,r+2},a.prototype.writeInt32LE=function(t,r,_){return t=+t,r=r>>>0,_||T(this,t,r,4,2147483647,-2147483648),this[r]=t&255,this[r+1]=t>>>8,this[r+2]=t>>>16,this[r+3]=t>>>24,r+4},a.prototype.writeInt32BE=function(t,r,_){return t=+t,r=r>>>0,_||T(this,t,r,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),this[r]=t>>>24,this[r+1]=t>>>16,this[r+2]=t>>>8,this[r+3]=t&255,r+4};function d(u,t,r,_,S,P){if(r+_>u.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function q(u,t,r,_,S){return t=+t,r=r>>>0,S||d(u,t,r,4),bt.write(u,t,r,_,23,4),r+4}a.prototype.writeFloatLE=function(t,r,_){return q(this,t,r,!0,_)},a.prototype.writeFloatBE=function(t,r,_){return q(this,t,r,!1,_)};function X(u,t,r,_,S){return t=+t,r=r>>>0,S||d(u,t,r,8),bt.write(u,t,r,_,52,8),r+8}a.prototype.writeDoubleLE=function(t,r,_){return X(this,t,r,!0,_)},a.prototype.writeDoubleBE=function(t,r,_){return X(this,t,r,!1,_)},a.prototype.copy=function(t,r,_,S){if(!a.isBuffer(t))throw new TypeError("argument should be a Buffer");if(_||(_=0),!S&&S!==0&&(S=this.length),r>=t.length&&(r=t.length),r||(r=0),S>0&&S<_&&(S=_),S===_||t.length===0||this.length===0)return 0;if(r<0)throw new RangeError("targetStart out of bounds");if(_<0||_>=this.length)throw new RangeError("Index out of range");if(S<0)throw new RangeError("sourceEnd out of bounds");S>this.length&&(S=this.length),t.length-r<S-_&&(S=t.length-r+_);var P=S-_;if(this===t&&typeof Uint8Array.prototype.copyWithin=="function")this.copyWithin(r,_,S);else if(this===t&&_<r&&r<S)for(var v=P-1;v>=0;--v)t[v+r]=this[v+_];else Uint8Array.prototype.set.call(t,this.subarray(_,S),r);return P},a.prototype.fill=function(t,r,_,S){if(typeof t=="string"){if(typeof r=="string"?(S=r,r=0,_=this.length):typeof _=="string"&&(S=_,_=this.length),S!==void 0&&typeof S!="string")throw new TypeError("encoding must be a string");if(typeof S=="string"&&!a.isEncoding(S))throw new TypeError("Unknown encoding: "+S);if(t.length===1){var P=t.charCodeAt(0);(S==="utf8"&&P<128||S==="latin1")&&(t=P)}}else typeof t=="number"?t=t&255:typeof t=="boolean"&&(t=Number(t));if(r<0||this.length<r||this.length<_)throw new RangeError("Out of range index");if(_<=r)return this;r=r>>>0,_=_===void 0?this.length:_>>>0,t||(t=0);var v;if(typeof t=="number")for(v=r;v<_;++v)this[v]=t;else{var tt=a.isBuffer(t)?t:a.from(t,S),it=tt.length;if(it===0)throw new TypeError('The value "'+t+'" is invalid for argument "value"');for(v=0;v<_-r;++v)this[v+r]=tt[v%it]}return this};var et=/[^+/0-9A-Za-z-_]/g;function Bt(u){if(u=u.split("=")[0],u=u.trim().replace(et,""),u.length<2)return"";for(;u.length%4!==0;)u=u+"=";return u}function k(u,t){t=t||1/0;for(var r,_=u.length,S=null,P=[],v=0;v<_;++v){if(r=u.charCodeAt(v),r>55295&&r<57344){if(!S){if(r>56319){(t-=3)>-1&&P.push(239,191,189);continue}else if(v+1===_){(t-=3)>-1&&P.push(239,191,189);continue}S=r;continue}if(r<56320){(t-=3)>-1&&P.push(239,191,189),S=r;continue}r=(S-55296<<10|r-56320)+65536}else S&&(t-=3)>-1&&P.push(239,191,189);if(S=null,r<128){if((t-=1)<0)break;P.push(r)}else if(r<2048){if((t-=2)<0)break;P.push(r>>6|192,r&63|128)}else if(r<65536){if((t-=3)<0)break;P.push(r>>12|224,r>>6&63|128,r&63|128)}else if(r<1114112){if((t-=4)<0)break;P.push(r>>18|240,r>>12&63|128,r>>6&63|128,r&63|128)}else throw new Error("Invalid code point")}return P}function lt(u){for(var t=[],r=0;r<u.length;++r)t.push(u.charCodeAt(r)&255);return t}function ee(u,t){for(var r,_,S,P=[],v=0;v<u.length&&!((t-=2)<0);++v)r=u.charCodeAt(v),_=r>>8,S=r%256,P.push(S),P.push(_);return P}function Ft(u){return ne.toByteArray(Bt(u))}function ht(u,t,r,_){for(var S=0;S<_&&!(S+r>=t.length||S>=u.length);++S)t[S+r]=u[S];return S}function Q(u,t){return u instanceof t||u!=null&&u.constructor!=null&&u.constructor.name!=null&&u.constructor.name===t.name}function at(u){return u!==u}var nt=function(){for(var u="0123456789abcdef",t=new Array(256),r=0;r<16;++r)for(var _=r*16,S=0;S<16;++S)t[_+S]=u[r]+u[S];return t}()}),mr=C.Buffer,wr=C.SlowBuffer,Tr=C.INSPECT_MAX_BYTES,Ir=C.kMaxLength,mt=ot(function(B,e){Object.defineProperty(e,"__esModule",{value:!0}),e.ensureBuffer=void 0;function y(b){if(C.Buffer.isBuffer(b))return b;if(ArrayBuffer.isView(b))return C.Buffer.from(b.buffer);if(b instanceof ArrayBuffer)return C.Buffer.from(b);throw new TypeError("Must use either Buffer or TypedArray")}e.ensureBuffer=y});st(mt);var Dr=mt.ensureBuffer,le=ot(function(B,e){Object.defineProperty(e,"__esModule",{value:!0}),e.parseUUID=void 0;let y=/^(?:[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 b(l){if(typeof l!="string")throw new TypeError("Invalid type for UUID, expected string but got "+typeof l);if(!y.test(l))throw new TypeError("Invalid format for UUID: "+l);let f,a=new Uint8Array(16);return a[0]=(f=parseInt(l.slice(0,8),16))>>>24,a[1]=f>>>16&255,a[2]=f>>>8&255,a[3]=f&255,a[4]=(f=parseInt(l.slice(9,13),16))>>>8,a[5]=f&255,a[6]=(f=parseInt(l.slice(14,18),16))>>>8,a[7]=f&255,a[8]=(f=parseInt(l.slice(19,23),16))>>>8,a[9]=f&255,a[10]=(f=parseInt(l.slice(24,36),16))/1099511627776&255,a[11]=f/4294967296&255,a[12]=f>>>24&255,a[13]=f>>>16&255,a[14]=f>>>8&255,a[15]=f&255,a}e.parseUUID=b});st(le);var br=le.parseUUID,_t=ot(function(B,e){Object.defineProperty(e,"__esModule",{value:!0}),e.Binary=void 0;class y{constructor(l,f){if(l!=null&&typeof l!="string"&&!ArrayBuffer.isView(l)&&!(l instanceof ArrayBuffer)&&!Array.isArray(l))throw new TypeError("Binary can only be constructed from string, Buffer, TypedArray, or Array<number>");this.sub_type=f??y.BSON_BINARY_SUBTYPE_DEFAULT,l==null?(this.buffer=C.Buffer.alloc(y.BUFFER_SIZE),this.position=0):(typeof l=="string"?this.buffer=C.Buffer.from(l,"binary"):Array.isArray(l)?this.buffer=C.Buffer.from(l):this.buffer=mt.ensureBuffer(l),this.position=this.buffer.byteLength)}put(l){if(typeof l=="string"&&l.length!==1)throw new TypeError("only accepts single character String");if(typeof l!="number"&&l.length!==1)throw new TypeError("only accepts single character Uint8Array or Array");let f;if(typeof l=="string"?f=l.charCodeAt(0):typeof l=="number"?f=l:f=l[0],f<0||f>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++]=f;else{let a=C.Buffer.alloc(y.BUFFER_SIZE+this.buffer.length);this.buffer.copy(a,0,0,this.buffer.length),this.buffer=a,this.buffer[this.position++]=f}}write(l,f){if(f=typeof f=="number"?f:this.position,this.buffer.length<f+l.length){let a=C.Buffer.alloc(this.buffer.length+l.length);this.buffer.copy(a,0,0,this.buffer.length),this.buffer=a}ArrayBuffer.isView(l)?(this.buffer.set(mt.ensureBuffer(l),f),this.position=f+l.byteLength>this.position?f+l.length:this.position):typeof l=="string"&&(this.buffer.write(l,f,l.length,"binary"),this.position=f+l.length>this.position?f+l.length:this.position)}read(l,f){return f=f&&f>0?f:this.position,this.buffer.slice(l,l+f)}value(l){return l=!!l,l&&this.buffer.length===this.position?this.buffer:l?this.buffer.slice(0,this.position):this.buffer.toString("binary",0,this.position)}length(){return this.position}toJSON(){return this.buffer.toString("base64")}toString(l){return this.buffer.toString(l)}toExtendedJSON(l){l=l||{};let f=this.buffer.toString("base64"),a=Number(this.sub_type).toString(16);return l.legacy?{$binary:f,$type:a.length===1?"0"+a:a}:{$binary:{base64:f,subType:a.length===1?"0"+a:a}}}static fromExtendedJSON(l,f){f=f||{};let a,E;if("$binary"in l?f.legacy&&typeof l.$binary=="string"&&"$type"in l?(E=l.$type?parseInt(l.$type,16):0,a=C.Buffer.from(l.$binary,"base64")):typeof l.$binary!="string"&&(E=l.$binary.subType?parseInt(l.$binary.subType,16):0,a=C.Buffer.from(l.$binary.base64,"base64")):"$uuid"in l&&(E=4,a=C.Buffer.from(le.parseUUID(l.$uuid))),!a)throw new TypeError(`Unexpected Binary Extended JSON format ${JSON.stringify(l)}`);return new y(a,E)}}e.Binary=y,y.BSON_BINARY_SUBTYPE_DEFAULT=0,y.BUFFER_SIZE=256,y.SUBTYPE_DEFAULT=0,y.SUBTYPE_FUNCTION=1,y.SUBTYPE_BYTE_ARRAY=2,y.SUBTYPE_UUID_OLD=3,y.SUBTYPE_UUID=4,y.SUBTYPE_MD5=5,y.SUBTYPE_USER_DEFINED=128,Object.defineProperty(y.prototype,"_bsontype",{value:"Binary"})});st(_t);var dr=_t.Binary,Et=ot(function(B,e){Object.defineProperty(e,"__esModule",{value:!0}),e.Code=void 0;class y{constructor(l,f){this.code=l,this.scope=f}toJSON(){return{code:this.code,scope:this.scope}}toExtendedJSON(){return this.scope?{$code:this.code,$scope:this.scope}:{$code:this.code}}static fromExtendedJSON(l){return new y(l.$code,l.$scope)}}e.Code=y,Object.defineProperty(y.prototype,"_bsontype",{value:"Code"})});st(Et);var Rr=Et.Code,$e={},fe;typeof Object.create=="function"?fe=function(e,y){e.super_=y,e.prototype=Object.create(y.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}:fe=function(e,y){e.super_=y;var b=function(){};b.prototype=y.prototype,e.prototype=new b,e.prototype.constructor=e};var tr=fe,er=/%[sdj%]/g;function ce(B){if(!xt(B)){for(var e=[],y=0;y<arguments.length;y++)e.push(Ot(arguments[y]));return e.join(" ")}for(var y=1,b=arguments,l=b.length,f=String(B).replace(er,function(E){if(E==="%%")return"%";if(y>=l)return E;switch(E){case"%s":return String(b[y++]);case"%d":return Number(b[y++]);case"%j":try{return JSON.stringify(b[y++])}catch{return"[Circular]"}default:return E}}),a=b[y];y<l;a=b[++y])Qt(a)||!Pt(a)?f+=" "+a:f+=" "+Ot(a);return f}function me(B,e){if(pt(global.process))return function(){return me(B,e).apply(this,arguments)};var y=!1;function b(){return y||(console.error(e),y=!0),B.apply(this,arguments)}return b}var Wt={},ie;function rr(B){if(pt(ie)&&(ie=""),B=B.toUpperCase(),!Wt[B])if(new RegExp("\\b"+B+"\\b","i").test(ie)){var e=0;Wt[B]=function(){var y=ce.apply(null,arguments);console.error("%s %d: %s",B,e,y)}}else Wt[B]=function(){};return Wt[B]}function Ot(B,e){var y={seen:[],stylize:ir};return arguments.length>=3&&(y.depth=arguments[2]),arguments.length>=4&&(y.colors=arguments[3]),he(e)?y.showHidden=e:e&&Ie(y,e),pt(y.showHidden)&&(y.showHidden=!1),pt(y.depth)&&(y.depth=2),pt(y.colors)&&(y.colors=!1),pt(y.customInspect)&&(y.customInspect=!0),y.colors&&(y.stylize=nr),Gt(y,B,y.depth)}Ot.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]};Ot.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"};function nr(B,e){var y=Ot.styles[e];return y?"\x1B["+Ot.colors[y][0]+"m"+B+"\x1B["+Ot.colors[y][1]+"m":B}function ir(B,e){return B}function or(B){var e={};return B.forEach(function(y,b){e[y]=!0}),e}function Gt(B,e,y){if(B.customInspect&&e&&Kt(e.inspect)&&e.inspect!==Ot&&!(e.constructor&&e.constructor.prototype===e)){var b=e.inspect(y,B);return xt(b)||(b=Gt(B,b,y)),b}var l=sr(B,e);if(l)return l;var f=Object.keys(e),a=or(f);if(B.showHidden&&(f=Object.getOwnPropertyNames(e)),kt(e)&&(f.indexOf("message")>=0||f.indexOf("description")>=0))return oe(e);if(f.length===0){if(Kt(e)){var E=e.name?": "+e.name:"";return B.stylize("[Function"+E+"]","special")}if(Xt(e))return B.stylize(RegExp.prototype.toString.call(e),"regexp");if(ae(e))return B.stylize(Date.prototype.toString.call(e),"date");if(kt(e))return oe(e)}var o="",c=!1,h=["{","}"];if(we(e)&&(c=!0,h=["[","]"]),Kt(e)){var p=e.name?": "+e.name:"";o=" [Function"+p+"]"}if(Xt(e)&&(o=" "+RegExp.prototype.toString.call(e)),ae(e)&&(o=" "+Date.prototype.toUTCString.call(e)),kt(e)&&(o=" "+oe(e)),f.length===0&&(!c||e.length==0))return h[0]+o+h[1];if(y<0)return Xt(e)?B.stylize(RegExp.prototype.toString.call(e),"regexp"):B.stylize("[Object]","special");B.seen.push(e);var n;return c?n=fr(B,e,y,a,f):n=f.map(function(w){return ue(B,e,y,a,w,c)}),B.seen.pop(),ur(n,o,h)}function sr(B,e){if(pt(e))return B.stylize("undefined","undefined");if(xt(e)){var y="'"+JSON.stringify(e).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return B.stylize(y,"string")}if(Te(e))return B.stylize(""+e,"number");if(he(e))return B.stylize(""+e,"boolean");if(Qt(e))return B.stylize("null","null")}function oe(B){return"["+Error.prototype.toString.call(B)+"]"}function fr(B,e,y,b,l){for(var f=[],a=0,E=e.length;a<E;++a)De(e,String(a))?f.push(ue(B,e,y,b,String(a),!0)):f.push("");return l.forEach(function(o){o.match(/^\d+$/)||f.push(ue(B,e,y,b,o,!0))}),f}function ue(B,e,y,b,l,f){var a,E,o;if(o=Object.getOwnPropertyDescriptor(e,l)||{value:e[l]},o.get?o.set?E=B.stylize("[Getter/Setter]","special"):E=B.stylize("[Getter]","special"):o.set&&(E=B.stylize("[Setter]","special")),De(b,l)||(a="["+l+"]"),E||(B.seen.indexOf(o.value)<0?(Qt(y)?E=Gt(B,o.value,null):E=Gt(B,o.value,y-1),E.indexOf(`
|
|
7
|
+
"use strict";var __exports__=(()=>{var Pe=Object.create;var zt=Object.defineProperty;var je=Object.getOwnPropertyDescriptor;var Ye=Object.getOwnPropertyNames;var ve=Object.getPrototypeOf,Fe=Object.prototype.hasOwnProperty;var Le=(B,e)=>()=>(e||B((e={exports:{}}).exports,e),e.exports),Ce=(B,e)=>{for(var y in e)zt(B,y,{get:e[y],enumerable:!0})},Ct=(B,e,y,D)=>{if(e&&typeof e=="object"||typeof e=="function")for(let l of Ye(e))!Fe.call(B,l)&&l!==y&&zt(B,l,{get:()=>e[l],enumerable:!(D=je(e,l))||D.enumerable});return B},Jt=(B,e,y)=>(Ct(B,e,"default"),y&&Ct(y,e,"default")),ze=(B,e,y)=>(y=B!=null?Pe(ve(B)):{},Ct(e||!B||!B.__esModule?zt(y,"default",{value:B,enumerable:!0}):y,B)),Je=B=>Ct(zt({},"__esModule",{value:!0}),B);var Ae=Le((mr,Se)=>{Se.exports=globalThis.loaders});var vt={};Ce(vt,{BSONLoader:()=>ee,BSONWriter:()=>Me});Jt(vt,ze(Ae(),1));var Ht=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function st(B){return B&&B.__esModule&&Object.prototype.hasOwnProperty.call(B,"default")?B.default:B}function ot(B,e){return e={exports:{}},B(e,e.exports),e.exports}var We=He,Xe=Ve,ke=Qe,gt=[],yt=[],Ke=typeof Uint8Array<"u"?Uint8Array:Array,ne="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(Tt=0,Ee=ne.length;Tt<Ee;++Tt)gt[Tt]=ne[Tt],yt[ne.charCodeAt(Tt)]=Tt;var Tt,Ee;yt["-".charCodeAt(0)]=62;yt["_".charCodeAt(0)]=63;function me(B){var e=B.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var y=B.indexOf("=");y===-1&&(y=e);var D=y===e?0:4-y%4;return[y,D]}function He(B){var e=me(B),y=e[0],D=e[1];return(y+D)*3/4-D}function Ge(B,e,y){return(e+y)*3/4-y}function Ve(B){var e,y=me(B),D=y[0],l=y[1],f=new Ke(Ge(B,D,l)),u=0,E=l>0?D-4:D,o;for(o=0;o<E;o+=4)e=yt[B.charCodeAt(o)]<<18|yt[B.charCodeAt(o+1)]<<12|yt[B.charCodeAt(o+2)]<<6|yt[B.charCodeAt(o+3)],f[u++]=e>>16&255,f[u++]=e>>8&255,f[u++]=e&255;return l===2&&(e=yt[B.charCodeAt(o)]<<2|yt[B.charCodeAt(o+1)]>>4,f[u++]=e&255),l===1&&(e=yt[B.charCodeAt(o)]<<10|yt[B.charCodeAt(o+1)]<<4|yt[B.charCodeAt(o+2)]>>2,f[u++]=e>>8&255,f[u++]=e&255),f}function Ze(B){return gt[B>>18&63]+gt[B>>12&63]+gt[B>>6&63]+gt[B&63]}function qe(B,e,y){for(var D,l=[],f=e;f<y;f+=3)D=(B[f]<<16&16711680)+(B[f+1]<<8&65280)+(B[f+2]&255),l.push(Ze(D));return l.join("")}function Qe(B){for(var e,y=B.length,D=y%3,l=[],f=16383,u=0,E=y-D;u<E;u+=f)l.push(qe(B,u,u+f>E?E:u+f));return D===1?(e=B[y-1],l.push(gt[e>>2]+gt[e<<4&63]+"==")):D===2&&(e=(B[y-2]<<8)+B[y-1],l.push(gt[e>>10]+gt[e>>4&63]+gt[e<<2&63]+"=")),l.join("")}var ie={byteLength:We,toByteArray:Xe,fromByteArray:ke},xe=function(e,y,D,l,f){var u,E,o=f*8-l-1,c=(1<<o)-1,h=c>>1,p=-7,n=D?f-1:0,w=D?-1:1,U=e[y+n];for(n+=w,u=U&(1<<-p)-1,U>>=-p,p+=o;p>0;u=u*256+e[y+n],n+=w,p-=8);for(E=u&(1<<-p)-1,u>>=-p,p+=l;p>0;E=E*256+e[y+n],n+=w,p-=8);if(u===0)u=1-h;else{if(u===c)return E?NaN:(U?-1:1)*(1/0);E=E+Math.pow(2,l),u=u-h}return(U?-1:1)*E*Math.pow(2,u-l)},$e=function(e,y,D,l,f,u){var E,o,c,h=u*8-f-1,p=(1<<h)-1,n=p>>1,w=f===23?Math.pow(2,-24)-Math.pow(2,-77):0,U=l?0:u-1,N=l?1:-1,Y=y<0||y===0&&1/y<0?1:0;for(y=Math.abs(y),isNaN(y)||y===1/0?(o=isNaN(y)?1:0,E=p):(E=Math.floor(Math.log(y)/Math.LN2),y*(c=Math.pow(2,-E))<1&&(E--,c*=2),E+n>=1?y+=w/c:y+=w*Math.pow(2,1-n),y*c>=2&&(E++,c/=2),E+n>=p?(o=0,E=p):E+n>=1?(o=(y*c-1)*Math.pow(2,f),E=E+n):(o=y*Math.pow(2,n-1)*Math.pow(2,f),E=0));f>=8;e[D+U]=o&255,U+=N,o/=256,f-=8);for(E=E<<f|o,h+=f;h>0;e[D+U]=E&255,U+=N,E/=256,h-=8);e[D+U-N]|=Y*128},Dt={read:xe,write:$e},C=ot(function(B,e){var y=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;e.Buffer=u,e.SlowBuffer=Y,e.INSPECT_MAX_BYTES=50;var D=2147483647;e.kMaxLength=D,u.TYPED_ARRAY_SUPPORT=l(),!u.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&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 l(){try{var a=new Uint8Array(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,Uint8Array.prototype),Object.setPrototypeOf(a,t),a.foo()===42}catch{return!1}}Object.defineProperty(u.prototype,"parent",{enumerable:!0,get:function(){if(u.isBuffer(this))return this.buffer}}),Object.defineProperty(u.prototype,"offset",{enumerable:!0,get:function(){if(u.isBuffer(this))return this.byteOffset}});function f(a){if(a>D)throw new RangeError('The value "'+a+'" is invalid for option "size"');var t=new Uint8Array(a);return Object.setPrototypeOf(t,u.prototype),t}function u(a,t,r){if(typeof a=="number"){if(typeof t=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return h(a)}return E(a,t,r)}u.poolSize=8192;function E(a,t,r){if(typeof a=="string")return p(a,t);if(ArrayBuffer.isView(a))return n(a);if(a==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+babelHelpers.typeof(a));if(Q(a,ArrayBuffer)||a&&Q(a.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(Q(a,SharedArrayBuffer)||a&&Q(a.buffer,SharedArrayBuffer)))return w(a,t,r);if(typeof a=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');var _=a.valueOf&&a.valueOf();if(_!=null&&_!==a)return u.from(_,t,r);var S=U(a);if(S)return S;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof a[Symbol.toPrimitive]=="function")return u.from(a[Symbol.toPrimitive]("string"),t,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+babelHelpers.typeof(a))}u.from=function(a,t,r){return E(a,t,r)},Object.setPrototypeOf(u.prototype,Uint8Array.prototype),Object.setPrototypeOf(u,Uint8Array);function o(a){if(typeof a!="number")throw new TypeError('"size" argument must be of type number');if(a<0)throw new RangeError('The value "'+a+'" is invalid for option "size"')}function c(a,t,r){return o(a),a<=0?f(a):t!==void 0?typeof r=="string"?f(a).fill(t,r):f(a).fill(t):f(a)}u.alloc=function(a,t,r){return c(a,t,r)};function h(a){return o(a),f(a<0?0:N(a)|0)}u.allocUnsafe=function(a){return h(a)},u.allocUnsafeSlow=function(a){return h(a)};function p(a,t){if((typeof t!="string"||t==="")&&(t="utf8"),!u.isEncoding(t))throw new TypeError("Unknown encoding: "+t);var r=J(a,t)|0,_=f(r),S=_.write(a,t);return S!==r&&(_=_.slice(0,S)),_}function n(a){for(var t=a.length<0?0:N(a.length)|0,r=f(t),_=0;_<t;_+=1)r[_]=a[_]&255;return r}function w(a,t,r){if(t<0||a.byteLength<t)throw new RangeError('"offset" is outside of buffer bounds');if(a.byteLength<t+(r||0))throw new RangeError('"length" is outside of buffer bounds');var _;return t===void 0&&r===void 0?_=new Uint8Array(a):r===void 0?_=new Uint8Array(a,t):_=new Uint8Array(a,t,r),Object.setPrototypeOf(_,u.prototype),_}function U(a){if(u.isBuffer(a)){var t=N(a.length)|0,r=f(t);return r.length===0||a.copy(r,0,0,t),r}if(a.length!==void 0)return typeof a.length!="number"||ut(a.length)?f(0):n(a);if(a.type==="Buffer"&&Array.isArray(a.data))return n(a.data)}function N(a){if(a>=D)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+D.toString(16)+" bytes");return a|0}function Y(a){return+a!=a&&(a=0),u.alloc(+a)}u.isBuffer=function(t){return t!=null&&t._isBuffer===!0&&t!==u.prototype},u.compare=function(t,r){if(Q(t,Uint8Array)&&(t=u.from(t,t.offset,t.byteLength)),Q(r,Uint8Array)&&(r=u.from(r,r.offset,r.byteLength)),!u.isBuffer(t)||!u.isBuffer(r))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(t===r)return 0;for(var _=t.length,S=r.length,P=0,v=Math.min(_,S);P<v;++P)if(t[P]!==r[P]){_=t[P],S=r[P];break}return _<S?-1:S<_?1:0},u.isEncoding=function(t){switch(String(t).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}},u.concat=function(t,r){if(!Array.isArray(t))throw new TypeError('"list" argument must be an Array of Buffers');if(t.length===0)return u.alloc(0);var _;if(r===void 0)for(r=0,_=0;_<t.length;++_)r+=t[_].length;var S=u.allocUnsafe(r),P=0;for(_=0;_<t.length;++_){var v=t[_];if(Q(v,Uint8Array)&&(v=u.from(v)),!u.isBuffer(v))throw new TypeError('"list" argument must be an Array of Buffers');v.copy(S,P),P+=v.length}return S};function J(a,t){if(u.isBuffer(a))return a.length;if(ArrayBuffer.isView(a)||Q(a,ArrayBuffer))return a.byteLength;if(typeof a!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+babelHelpers.typeof(a));var r=a.length,_=arguments.length>2&&arguments[2]===!0;if(!_&&r===0)return 0;for(var S=!1;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return k(a).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return r*2;case"hex":return r>>>1;case"base64":return Ft(a).length;default:if(S)return _?-1:k(a).length;t=(""+t).toLowerCase(),S=!0}}u.byteLength=J;function R(a,t,r){var _=!1;if((t===void 0||t<0)&&(t=0),t>this.length||((r===void 0||r>this.length)&&(r=this.length),r<=0)||(r>>>=0,t>>>=0,r<=t))return"";for(a||(a="utf8");;)switch(a){case"hex":return g(this,t,r);case"utf8":case"utf-8":return i(this,t,r);case"ascii":return j(this,t,r);case"latin1":case"binary":return F(this,t,r);case"base64":return O(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return $(this,t,r);default:if(_)throw new TypeError("Unknown encoding: "+a);a=(a+"").toLowerCase(),_=!0}}u.prototype._isBuffer=!0;function W(a,t,r){var _=a[t];a[t]=a[r],a[r]=_}u.prototype.swap16=function(){var t=this.length;if(t%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var r=0;r<t;r+=2)W(this,r,r+1);return this},u.prototype.swap32=function(){var t=this.length;if(t%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var r=0;r<t;r+=4)W(this,r,r+3),W(this,r+1,r+2);return this},u.prototype.swap64=function(){var t=this.length;if(t%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var r=0;r<t;r+=8)W(this,r,r+7),W(this,r+1,r+6),W(this,r+2,r+5),W(this,r+3,r+4);return this},u.prototype.toString=function(){var t=this.length;return t===0?"":arguments.length===0?i(this,0,t):R.apply(this,arguments)},u.prototype.toLocaleString=u.prototype.toString,u.prototype.equals=function(t){if(!u.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t?!0:u.compare(this,t)===0},u.prototype.inspect=function(){var t="",r=e.INSPECT_MAX_BYTES;return t=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(t+=" ... "),"<Buffer "+t+">"},y&&(u.prototype[y]=u.prototype.inspect),u.prototype.compare=function(t,r,_,S,P){if(Q(t,Uint8Array)&&(t=u.from(t,t.offset,t.byteLength)),!u.isBuffer(t))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+babelHelpers.typeof(t));if(r===void 0&&(r=0),_===void 0&&(_=t?t.length:0),S===void 0&&(S=0),P===void 0&&(P=this.length),r<0||_>t.length||S<0||P>this.length)throw new RangeError("out of range index");if(S>=P&&r>=_)return 0;if(S>=P)return-1;if(r>=_)return 1;if(r>>>=0,_>>>=0,S>>>=0,P>>>=0,this===t)return 0;for(var v=P-S,tt=_-r,it=Math.min(v,tt),ft=this.slice(S,P),ct=t.slice(r,_),at=0;at<it;++at)if(ft[at]!==ct[at]){v=ft[at],tt=ct[at];break}return v<tt?-1:tt<v?1:0};function x(a,t,r,_,S){if(a.length===0)return-1;if(typeof r=="string"?(_=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,ut(r)&&(r=S?0:a.length-1),r<0&&(r=a.length+r),r>=a.length){if(S)return-1;r=a.length-1}else if(r<0)if(S)r=0;else return-1;if(typeof t=="string"&&(t=u.from(t,_)),u.isBuffer(t))return t.length===0?-1:G(a,t,r,_,S);if(typeof t=="number")return t=t&255,typeof Uint8Array.prototype.indexOf=="function"?S?Uint8Array.prototype.indexOf.call(a,t,r):Uint8Array.prototype.lastIndexOf.call(a,t,r):G(a,[t],r,_,S);throw new TypeError("val must be string, number or Buffer")}function G(a,t,r,_,S){var P=1,v=a.length,tt=t.length;if(_!==void 0&&(_=String(_).toLowerCase(),_==="ucs2"||_==="ucs-2"||_==="utf16le"||_==="utf-16le")){if(a.length<2||t.length<2)return-1;P=2,v/=2,tt/=2,r/=2}function it(pe,Oe){return P===1?pe[Oe]:pe.readUInt16BE(Oe*P)}var ft;if(S){var ct=-1;for(ft=r;ft<v;ft++)if(it(a,ft)===it(t,ct===-1?0:ft-ct)){if(ct===-1&&(ct=ft),ft-ct+1===tt)return ct*P}else ct!==-1&&(ft-=ft-ct),ct=-1}else for(r+tt>v&&(r=v-tt),ft=r;ft>=0;ft--){for(var at=!0,Lt=0;Lt<tt;Lt++)if(it(a,ft+Lt)!==it(t,Lt)){at=!1;break}if(at)return ft}return-1}u.prototype.includes=function(t,r,_){return this.indexOf(t,r,_)!==-1},u.prototype.indexOf=function(t,r,_){return x(this,t,r,_,!0)},u.prototype.lastIndexOf=function(t,r,_){return x(this,t,r,_,!1)};function M(a,t,r,_){r=Number(r)||0;var S=a.length-r;_?(_=Number(_),_>S&&(_=S)):_=S;var P=t.length;_>P/2&&(_=P/2);for(var v=0;v<_;++v){var tt=parseInt(t.substr(v*2,2),16);if(ut(tt))return v;a[r+v]=tt}return v}function V(a,t,r,_){return ht(k(t,a.length-r),a,r,_)}function z(a,t,r,_){return ht(lt(t),a,r,_)}function Z(a,t,r,_){return z(a,t,r,_)}function s(a,t,r,_){return ht(Ft(t),a,r,_)}function A(a,t,r,_){return ht(re(t,a.length-r),a,r,_)}u.prototype.write=function(t,r,_,S){if(r===void 0)S="utf8",_=this.length,r=0;else if(_===void 0&&typeof r=="string")S=r,_=this.length,r=0;else if(isFinite(r))r=r>>>0,isFinite(_)?(_=_>>>0,S===void 0&&(S="utf8")):(S=_,_=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var P=this.length-r;if((_===void 0||_>P)&&(_=P),t.length>0&&(_<0||r<0)||r>this.length)throw new RangeError("Attempt to write outside buffer bounds");S||(S="utf8");for(var v=!1;;)switch(S){case"hex":return M(this,t,r,_);case"utf8":case"utf-8":return V(this,t,r,_);case"ascii":return z(this,t,r,_);case"latin1":case"binary":return Z(this,t,r,_);case"base64":return s(this,t,r,_);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return A(this,t,r,_);default:if(v)throw new TypeError("Unknown encoding: "+S);S=(""+S).toLowerCase(),v=!0}},u.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function O(a,t,r){return t===0&&r===a.length?ie.fromByteArray(a):ie.fromByteArray(a.slice(t,r))}function i(a,t,r){r=Math.min(a.length,r);for(var _=[],S=t;S<r;){var P=a[S],v=null,tt=P>239?4:P>223?3:P>191?2:1;if(S+tt<=r){var it,ft,ct,at;switch(tt){case 1:P<128&&(v=P);break;case 2:it=a[S+1],(it&192)===128&&(at=(P&31)<<6|it&63,at>127&&(v=at));break;case 3:it=a[S+1],ft=a[S+2],(it&192)===128&&(ft&192)===128&&(at=(P&15)<<12|(it&63)<<6|ft&63,at>2047&&(at<55296||at>57343)&&(v=at));break;case 4:it=a[S+1],ft=a[S+2],ct=a[S+3],(it&192)===128&&(ft&192)===128&&(ct&192)===128&&(at=(P&15)<<18|(it&63)<<12|(ft&63)<<6|ct&63,at>65535&&at<1114112&&(v=at))}}v===null?(v=65533,tt=1):v>65535&&(v-=65536,_.push(v>>>10&1023|55296),v=56320|v&1023),_.push(v),S+=tt}return b(_)}var m=4096;function b(a){var t=a.length;if(t<=m)return String.fromCharCode.apply(String,a);for(var r="",_=0;_<t;)r+=String.fromCharCode.apply(String,a.slice(_,_+=m));return r}function j(a,t,r){var _="";r=Math.min(a.length,r);for(var S=t;S<r;++S)_+=String.fromCharCode(a[S]&127);return _}function F(a,t,r){var _="";r=Math.min(a.length,r);for(var S=t;S<r;++S)_+=String.fromCharCode(a[S]);return _}function g(a,t,r){var _=a.length;(!t||t<0)&&(t=0),(!r||r<0||r>_)&&(r=_);for(var S="",P=t;P<r;++P)S+=nt[a[P]];return S}function $(a,t,r){for(var _=a.slice(t,r),S="",P=0;P<_.length;P+=2)S+=String.fromCharCode(_[P]+_[P+1]*256);return S}u.prototype.slice=function(t,r){var _=this.length;t=~~t,r=r===void 0?_:~~r,t<0?(t+=_,t<0&&(t=0)):t>_&&(t=_),r<0?(r+=_,r<0&&(r=0)):r>_&&(r=_),r<t&&(r=t);var S=this.subarray(t,r);return Object.setPrototypeOf(S,u.prototype),S};function L(a,t,r){if(a%1!==0||a<0)throw new RangeError("offset is not uint");if(a+t>r)throw new RangeError("Trying to access beyond buffer length")}u.prototype.readUIntLE=function(t,r,_){t=t>>>0,r=r>>>0,_||L(t,r,this.length);for(var S=this[t],P=1,v=0;++v<r&&(P*=256);)S+=this[t+v]*P;return S},u.prototype.readUIntBE=function(t,r,_){t=t>>>0,r=r>>>0,_||L(t,r,this.length);for(var S=this[t+--r],P=1;r>0&&(P*=256);)S+=this[t+--r]*P;return S},u.prototype.readUInt8=function(t,r){return t=t>>>0,r||L(t,1,this.length),this[t]},u.prototype.readUInt16LE=function(t,r){return t=t>>>0,r||L(t,2,this.length),this[t]|this[t+1]<<8},u.prototype.readUInt16BE=function(t,r){return t=t>>>0,r||L(t,2,this.length),this[t]<<8|this[t+1]},u.prototype.readUInt32LE=function(t,r){return t=t>>>0,r||L(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+this[t+3]*16777216},u.prototype.readUInt32BE=function(t,r){return t=t>>>0,r||L(t,4,this.length),this[t]*16777216+(this[t+1]<<16|this[t+2]<<8|this[t+3])},u.prototype.readIntLE=function(t,r,_){t=t>>>0,r=r>>>0,_||L(t,r,this.length);for(var S=this[t],P=1,v=0;++v<r&&(P*=256);)S+=this[t+v]*P;return P*=128,S>=P&&(S-=Math.pow(2,8*r)),S},u.prototype.readIntBE=function(t,r,_){t=t>>>0,r=r>>>0,_||L(t,r,this.length);for(var S=r,P=1,v=this[t+--S];S>0&&(P*=256);)v+=this[t+--S]*P;return P*=128,v>=P&&(v-=Math.pow(2,8*r)),v},u.prototype.readInt8=function(t,r){return t=t>>>0,r||L(t,1,this.length),this[t]&128?(255-this[t]+1)*-1:this[t]},u.prototype.readInt16LE=function(t,r){t=t>>>0,r||L(t,2,this.length);var _=this[t]|this[t+1]<<8;return _&32768?_|4294901760:_},u.prototype.readInt16BE=function(t,r){t=t>>>0,r||L(t,2,this.length);var _=this[t+1]|this[t]<<8;return _&32768?_|4294901760:_},u.prototype.readInt32LE=function(t,r){return t=t>>>0,r||L(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},u.prototype.readInt32BE=function(t,r){return t=t>>>0,r||L(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},u.prototype.readFloatLE=function(t,r){return t=t>>>0,r||L(t,4,this.length),Dt.read(this,t,!0,23,4)},u.prototype.readFloatBE=function(t,r){return t=t>>>0,r||L(t,4,this.length),Dt.read(this,t,!1,23,4)},u.prototype.readDoubleLE=function(t,r){return t=t>>>0,r||L(t,8,this.length),Dt.read(this,t,!0,52,8)},u.prototype.readDoubleBE=function(t,r){return t=t>>>0,r||L(t,8,this.length),Dt.read(this,t,!1,52,8)};function T(a,t,r,_,S,P){if(!u.isBuffer(a))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>S||t<P)throw new RangeError('"value" argument is out of bounds');if(r+_>a.length)throw new RangeError("Index out of range")}u.prototype.writeUIntLE=function(t,r,_,S){if(t=+t,r=r>>>0,_=_>>>0,!S){var P=Math.pow(2,8*_)-1;T(this,t,r,_,P,0)}var v=1,tt=0;for(this[r]=t&255;++tt<_&&(v*=256);)this[r+tt]=t/v&255;return r+_},u.prototype.writeUIntBE=function(t,r,_,S){if(t=+t,r=r>>>0,_=_>>>0,!S){var P=Math.pow(2,8*_)-1;T(this,t,r,_,P,0)}var v=_-1,tt=1;for(this[r+v]=t&255;--v>=0&&(tt*=256);)this[r+v]=t/tt&255;return r+_},u.prototype.writeUInt8=function(t,r,_){return t=+t,r=r>>>0,_||T(this,t,r,1,255,0),this[r]=t&255,r+1},u.prototype.writeUInt16LE=function(t,r,_){return t=+t,r=r>>>0,_||T(this,t,r,2,65535,0),this[r]=t&255,this[r+1]=t>>>8,r+2},u.prototype.writeUInt16BE=function(t,r,_){return t=+t,r=r>>>0,_||T(this,t,r,2,65535,0),this[r]=t>>>8,this[r+1]=t&255,r+2},u.prototype.writeUInt32LE=function(t,r,_){return t=+t,r=r>>>0,_||T(this,t,r,4,4294967295,0),this[r+3]=t>>>24,this[r+2]=t>>>16,this[r+1]=t>>>8,this[r]=t&255,r+4},u.prototype.writeUInt32BE=function(t,r,_){return t=+t,r=r>>>0,_||T(this,t,r,4,4294967295,0),this[r]=t>>>24,this[r+1]=t>>>16,this[r+2]=t>>>8,this[r+3]=t&255,r+4},u.prototype.writeIntLE=function(t,r,_,S){if(t=+t,r=r>>>0,!S){var P=Math.pow(2,8*_-1);T(this,t,r,_,P-1,-P)}var v=0,tt=1,it=0;for(this[r]=t&255;++v<_&&(tt*=256);)t<0&&it===0&&this[r+v-1]!==0&&(it=1),this[r+v]=(t/tt>>0)-it&255;return r+_},u.prototype.writeIntBE=function(t,r,_,S){if(t=+t,r=r>>>0,!S){var P=Math.pow(2,8*_-1);T(this,t,r,_,P-1,-P)}var v=_-1,tt=1,it=0;for(this[r+v]=t&255;--v>=0&&(tt*=256);)t<0&&it===0&&this[r+v+1]!==0&&(it=1),this[r+v]=(t/tt>>0)-it&255;return r+_},u.prototype.writeInt8=function(t,r,_){return t=+t,r=r>>>0,_||T(this,t,r,1,127,-128),t<0&&(t=255+t+1),this[r]=t&255,r+1},u.prototype.writeInt16LE=function(t,r,_){return t=+t,r=r>>>0,_||T(this,t,r,2,32767,-32768),this[r]=t&255,this[r+1]=t>>>8,r+2},u.prototype.writeInt16BE=function(t,r,_){return t=+t,r=r>>>0,_||T(this,t,r,2,32767,-32768),this[r]=t>>>8,this[r+1]=t&255,r+2},u.prototype.writeInt32LE=function(t,r,_){return t=+t,r=r>>>0,_||T(this,t,r,4,2147483647,-2147483648),this[r]=t&255,this[r+1]=t>>>8,this[r+2]=t>>>16,this[r+3]=t>>>24,r+4},u.prototype.writeInt32BE=function(t,r,_){return t=+t,r=r>>>0,_||T(this,t,r,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),this[r]=t>>>24,this[r+1]=t>>>16,this[r+2]=t>>>8,this[r+3]=t&255,r+4};function d(a,t,r,_,S,P){if(r+_>a.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function q(a,t,r,_,S){return t=+t,r=r>>>0,S||d(a,t,r,4),Dt.write(a,t,r,_,23,4),r+4}u.prototype.writeFloatLE=function(t,r,_){return q(this,t,r,!0,_)},u.prototype.writeFloatBE=function(t,r,_){return q(this,t,r,!1,_)};function X(a,t,r,_,S){return t=+t,r=r>>>0,S||d(a,t,r,8),Dt.write(a,t,r,_,52,8),r+8}u.prototype.writeDoubleLE=function(t,r,_){return X(this,t,r,!0,_)},u.prototype.writeDoubleBE=function(t,r,_){return X(this,t,r,!1,_)},u.prototype.copy=function(t,r,_,S){if(!u.isBuffer(t))throw new TypeError("argument should be a Buffer");if(_||(_=0),!S&&S!==0&&(S=this.length),r>=t.length&&(r=t.length),r||(r=0),S>0&&S<_&&(S=_),S===_||t.length===0||this.length===0)return 0;if(r<0)throw new RangeError("targetStart out of bounds");if(_<0||_>=this.length)throw new RangeError("Index out of range");if(S<0)throw new RangeError("sourceEnd out of bounds");S>this.length&&(S=this.length),t.length-r<S-_&&(S=t.length-r+_);var P=S-_;if(this===t&&typeof Uint8Array.prototype.copyWithin=="function")this.copyWithin(r,_,S);else if(this===t&&_<r&&r<S)for(var v=P-1;v>=0;--v)t[v+r]=this[v+_];else Uint8Array.prototype.set.call(t,this.subarray(_,S),r);return P},u.prototype.fill=function(t,r,_,S){if(typeof t=="string"){if(typeof r=="string"?(S=r,r=0,_=this.length):typeof _=="string"&&(S=_,_=this.length),S!==void 0&&typeof S!="string")throw new TypeError("encoding must be a string");if(typeof S=="string"&&!u.isEncoding(S))throw new TypeError("Unknown encoding: "+S);if(t.length===1){var P=t.charCodeAt(0);(S==="utf8"&&P<128||S==="latin1")&&(t=P)}}else typeof t=="number"?t=t&255:typeof t=="boolean"&&(t=Number(t));if(r<0||this.length<r||this.length<_)throw new RangeError("Out of range index");if(_<=r)return this;r=r>>>0,_=_===void 0?this.length:_>>>0,t||(t=0);var v;if(typeof t=="number")for(v=r;v<_;++v)this[v]=t;else{var tt=u.isBuffer(t)?t:u.from(t,S),it=tt.length;if(it===0)throw new TypeError('The value "'+t+'" is invalid for argument "value"');for(v=0;v<_-r;++v)this[v+r]=tt[v%it]}return this};var et=/[^+/0-9A-Za-z-_]/g;function Bt(a){if(a=a.split("=")[0],a=a.trim().replace(et,""),a.length<2)return"";for(;a.length%4!==0;)a=a+"=";return a}function k(a,t){t=t||1/0;for(var r,_=a.length,S=null,P=[],v=0;v<_;++v){if(r=a.charCodeAt(v),r>55295&&r<57344){if(!S){if(r>56319){(t-=3)>-1&&P.push(239,191,189);continue}else if(v+1===_){(t-=3)>-1&&P.push(239,191,189);continue}S=r;continue}if(r<56320){(t-=3)>-1&&P.push(239,191,189),S=r;continue}r=(S-55296<<10|r-56320)+65536}else S&&(t-=3)>-1&&P.push(239,191,189);if(S=null,r<128){if((t-=1)<0)break;P.push(r)}else if(r<2048){if((t-=2)<0)break;P.push(r>>6|192,r&63|128)}else if(r<65536){if((t-=3)<0)break;P.push(r>>12|224,r>>6&63|128,r&63|128)}else if(r<1114112){if((t-=4)<0)break;P.push(r>>18|240,r>>12&63|128,r>>6&63|128,r&63|128)}else throw new Error("Invalid code point")}return P}function lt(a){for(var t=[],r=0;r<a.length;++r)t.push(a.charCodeAt(r)&255);return t}function re(a,t){for(var r,_,S,P=[],v=0;v<a.length&&!((t-=2)<0);++v)r=a.charCodeAt(v),_=r>>8,S=r%256,P.push(S),P.push(_);return P}function Ft(a){return ie.toByteArray(Bt(a))}function ht(a,t,r,_){for(var S=0;S<_&&!(S+r>=t.length||S>=a.length);++S)t[S+r]=a[S];return S}function Q(a,t){return a instanceof t||a!=null&&a.constructor!=null&&a.constructor.name!=null&&a.constructor.name===t.name}function ut(a){return a!==a}var nt=function(){for(var a="0123456789abcdef",t=new Array(256),r=0;r<16;++r)for(var _=r*16,S=0;S<16;++S)t[_+S]=a[r]+a[S];return t}()}),wr=C.Buffer,Tr=C.SlowBuffer,Ir=C.INSPECT_MAX_BYTES,br=C.kMaxLength,mt=ot(function(B,e){Object.defineProperty(e,"__esModule",{value:!0}),e.ensureBuffer=void 0;function y(D){if(C.Buffer.isBuffer(D))return D;if(ArrayBuffer.isView(D))return C.Buffer.from(D.buffer);if(D instanceof ArrayBuffer)return C.Buffer.from(D);throw new TypeError("Must use either Buffer or TypedArray")}e.ensureBuffer=y});st(mt);var Dr=mt.ensureBuffer,ce=ot(function(B,e){Object.defineProperty(e,"__esModule",{value:!0}),e.parseUUID=void 0;let y=/^(?:[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 D(l){if(typeof l!="string")throw new TypeError("Invalid type for UUID, expected string but got "+typeof l);if(!y.test(l))throw new TypeError("Invalid format for UUID: "+l);let f,u=new Uint8Array(16);return u[0]=(f=parseInt(l.slice(0,8),16))>>>24,u[1]=f>>>16&255,u[2]=f>>>8&255,u[3]=f&255,u[4]=(f=parseInt(l.slice(9,13),16))>>>8,u[5]=f&255,u[6]=(f=parseInt(l.slice(14,18),16))>>>8,u[7]=f&255,u[8]=(f=parseInt(l.slice(19,23),16))>>>8,u[9]=f&255,u[10]=(f=parseInt(l.slice(24,36),16))/1099511627776&255,u[11]=f/4294967296&255,u[12]=f>>>24&255,u[13]=f>>>16&255,u[14]=f>>>8&255,u[15]=f&255,u}e.parseUUID=D});st(ce);var dr=ce.parseUUID,_t=ot(function(B,e){Object.defineProperty(e,"__esModule",{value:!0}),e.Binary=void 0;class y{constructor(l,f){if(l!=null&&typeof l!="string"&&!ArrayBuffer.isView(l)&&!(l instanceof ArrayBuffer)&&!Array.isArray(l))throw new TypeError("Binary can only be constructed from string, Buffer, TypedArray, or Array<number>");this.sub_type=f??y.BSON_BINARY_SUBTYPE_DEFAULT,l==null?(this.buffer=C.Buffer.alloc(y.BUFFER_SIZE),this.position=0):(typeof l=="string"?this.buffer=C.Buffer.from(l,"binary"):Array.isArray(l)?this.buffer=C.Buffer.from(l):this.buffer=mt.ensureBuffer(l),this.position=this.buffer.byteLength)}put(l){if(typeof l=="string"&&l.length!==1)throw new TypeError("only accepts single character String");if(typeof l!="number"&&l.length!==1)throw new TypeError("only accepts single character Uint8Array or Array");let f;if(typeof l=="string"?f=l.charCodeAt(0):typeof l=="number"?f=l:f=l[0],f<0||f>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++]=f;else{let u=C.Buffer.alloc(y.BUFFER_SIZE+this.buffer.length);this.buffer.copy(u,0,0,this.buffer.length),this.buffer=u,this.buffer[this.position++]=f}}write(l,f){if(f=typeof f=="number"?f:this.position,this.buffer.length<f+l.length){let u=C.Buffer.alloc(this.buffer.length+l.length);this.buffer.copy(u,0,0,this.buffer.length),this.buffer=u}ArrayBuffer.isView(l)?(this.buffer.set(mt.ensureBuffer(l),f),this.position=f+l.byteLength>this.position?f+l.length:this.position):typeof l=="string"&&(this.buffer.write(l,f,l.length,"binary"),this.position=f+l.length>this.position?f+l.length:this.position)}read(l,f){return f=f&&f>0?f:this.position,this.buffer.slice(l,l+f)}value(l){return l=!!l,l&&this.buffer.length===this.position?this.buffer:l?this.buffer.slice(0,this.position):this.buffer.toString("binary",0,this.position)}length(){return this.position}toJSON(){return this.buffer.toString("base64")}toString(l){return this.buffer.toString(l)}toExtendedJSON(l){l=l||{};let f=this.buffer.toString("base64"),u=Number(this.sub_type).toString(16);return l.legacy?{$binary:f,$type:u.length===1?"0"+u:u}:{$binary:{base64:f,subType:u.length===1?"0"+u:u}}}static fromExtendedJSON(l,f){f=f||{};let u,E;if("$binary"in l?f.legacy&&typeof l.$binary=="string"&&"$type"in l?(E=l.$type?parseInt(l.$type,16):0,u=C.Buffer.from(l.$binary,"base64")):typeof l.$binary!="string"&&(E=l.$binary.subType?parseInt(l.$binary.subType,16):0,u=C.Buffer.from(l.$binary.base64,"base64")):"$uuid"in l&&(E=4,u=C.Buffer.from(ce.parseUUID(l.$uuid))),!u)throw new TypeError(`Unexpected Binary Extended JSON format ${JSON.stringify(l)}`);return new y(u,E)}}e.Binary=y,y.BSON_BINARY_SUBTYPE_DEFAULT=0,y.BUFFER_SIZE=256,y.SUBTYPE_DEFAULT=0,y.SUBTYPE_FUNCTION=1,y.SUBTYPE_BYTE_ARRAY=2,y.SUBTYPE_UUID_OLD=3,y.SUBTYPE_UUID=4,y.SUBTYPE_MD5=5,y.SUBTYPE_USER_DEFINED=128,Object.defineProperty(y.prototype,"_bsontype",{value:"Binary"})});st(_t);var Rr=_t.Binary,Et=ot(function(B,e){Object.defineProperty(e,"__esModule",{value:!0}),e.Code=void 0;class y{constructor(l,f){this.code=l,this.scope=f}toJSON(){return{code:this.code,scope:this.scope}}toExtendedJSON(){return this.scope?{$code:this.code,$scope:this.scope}:{$code:this.code}}static fromExtendedJSON(l){return new y(l.$code,l.$scope)}}e.Code=y,Object.defineProperty(y.prototype,"_bsontype",{value:"Code"})});st(Et);var Ur=Et.Code,tr={},ae;typeof Object.create=="function"?ae=function(e,y){e.super_=y,e.prototype=Object.create(y.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}:ae=function(e,y){e.super_=y;var D=function(){};D.prototype=y.prototype,e.prototype=new D,e.prototype.constructor=e};var er=ae,rr=/%[sdj%]/g;function he(B){if(!xt(B)){for(var e=[],y=0;y<arguments.length;y++)e.push(Ot(arguments[y]));return e.join(" ")}for(var y=1,D=arguments,l=D.length,f=String(B).replace(rr,function(E){if(E==="%%")return"%";if(y>=l)return E;switch(E){case"%s":return String(D[y++]);case"%d":return Number(D[y++]);case"%j":try{return JSON.stringify(D[y++])}catch{return"[Circular]"}default:return E}}),u=D[y];y<l;u=D[++y])Qt(u)||!Pt(u)?f+=" "+u:f+=" "+Ot(u);return f}function we(B,e){if(pt(global.process))return function(){return we(B,e).apply(this,arguments)};var y=!1;function D(){return y||(console.error(e),y=!0),B.apply(this,arguments)}return D}var Wt={},oe;function nr(B){if(pt(oe)&&(oe=""),B=B.toUpperCase(),!Wt[B])if(new RegExp("\\b"+B+"\\b","i").test(oe)){var e=0;Wt[B]=function(){var y=he.apply(null,arguments);console.error("%s %d: %s",B,e,y)}}else Wt[B]=function(){};return Wt[B]}function Ot(B,e){var y={seen:[],stylize:or};return arguments.length>=3&&(y.depth=arguments[2]),arguments.length>=4&&(y.colors=arguments[3]),_e(e)?y.showHidden=e:e&&be(y,e),pt(y.showHidden)&&(y.showHidden=!1),pt(y.depth)&&(y.depth=2),pt(y.colors)&&(y.colors=!1),pt(y.customInspect)&&(y.customInspect=!0),y.colors&&(y.stylize=ir),Gt(y,B,y.depth)}Ot.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]};Ot.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"};function ir(B,e){var y=Ot.styles[e];return y?"\x1B["+Ot.colors[y][0]+"m"+B+"\x1B["+Ot.colors[y][1]+"m":B}function or(B,e){return B}function sr(B){var e={};return B.forEach(function(y,D){e[y]=!0}),e}function Gt(B,e,y){if(B.customInspect&&e&&Kt(e.inspect)&&e.inspect!==Ot&&!(e.constructor&&e.constructor.prototype===e)){var D=e.inspect(y,B);return xt(D)||(D=Gt(B,D,y)),D}var l=fr(B,e);if(l)return l;var f=Object.keys(e),u=sr(f);if(B.showHidden&&(f=Object.getOwnPropertyNames(e)),kt(e)&&(f.indexOf("message")>=0||f.indexOf("description")>=0))return se(e);if(f.length===0){if(Kt(e)){var E=e.name?": "+e.name:"";return B.stylize("[Function"+E+"]","special")}if(Xt(e))return B.stylize(RegExp.prototype.toString.call(e),"regexp");if(le(e))return B.stylize(Date.prototype.toString.call(e),"date");if(kt(e))return se(e)}var o="",c=!1,h=["{","}"];if(Te(e)&&(c=!0,h=["[","]"]),Kt(e)){var p=e.name?": "+e.name:"";o=" [Function"+p+"]"}if(Xt(e)&&(o=" "+RegExp.prototype.toString.call(e)),le(e)&&(o=" "+Date.prototype.toUTCString.call(e)),kt(e)&&(o=" "+se(e)),f.length===0&&(!c||e.length==0))return h[0]+o+h[1];if(y<0)return Xt(e)?B.stylize(RegExp.prototype.toString.call(e),"regexp"):B.stylize("[Object]","special");B.seen.push(e);var n;return c?n=ar(B,e,y,u,f):n=f.map(function(w){return ue(B,e,y,u,w,c)}),B.seen.pop(),ur(n,o,h)}function fr(B,e){if(pt(e))return B.stylize("undefined","undefined");if(xt(e)){var y="'"+JSON.stringify(e).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return B.stylize(y,"string")}if(Ie(e))return B.stylize(""+e,"number");if(_e(e))return B.stylize(""+e,"boolean");if(Qt(e))return B.stylize("null","null")}function se(B){return"["+Error.prototype.toString.call(B)+"]"}function ar(B,e,y,D,l){for(var f=[],u=0,E=e.length;u<E;++u)De(e,String(u))?f.push(ue(B,e,y,D,String(u),!0)):f.push("");return l.forEach(function(o){o.match(/^\d+$/)||f.push(ue(B,e,y,D,o,!0))}),f}function ue(B,e,y,D,l,f){var u,E,o;if(o=Object.getOwnPropertyDescriptor(e,l)||{value:e[l]},o.get?o.set?E=B.stylize("[Getter/Setter]","special"):E=B.stylize("[Getter]","special"):o.set&&(E=B.stylize("[Setter]","special")),De(D,l)||(u="["+l+"]"),E||(B.seen.indexOf(o.value)<0?(Qt(y)?E=Gt(B,o.value,null):E=Gt(B,o.value,y-1),E.indexOf(`
|
|
8
8
|
`)>-1&&(f?E=E.split(`
|
|
9
9
|
`).map(function(c){return" "+c}).join(`
|
|
10
10
|
`).substr(2):E=`
|
|
11
11
|
`+E.split(`
|
|
12
12
|
`).map(function(c){return" "+c}).join(`
|
|
13
|
-
`))):E=B.stylize("[Circular]","special")),pt(
|
|
14
|
-
`)>=0,l+f.replace(/\u001b\[\d\d?m/g,"").length+1},0);return
|
|
13
|
+
`))):E=B.stylize("[Circular]","special")),pt(u)){if(f&&l.match(/^\d+$/))return E;u=JSON.stringify(""+l),u.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(u=u.substr(1,u.length-2),u=B.stylize(u,"name")):(u=u.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),u=B.stylize(u,"string"))}return u+": "+E}function ur(B,e,y){var D=B.reduce(function(l,f){return f.indexOf(`
|
|
14
|
+
`)>=0,l+f.replace(/\u001b\[\d\d?m/g,"").length+1},0);return D>60?y[0]+(e===""?"":e+`
|
|
15
15
|
`)+" "+B.join(`,
|
|
16
|
-
`)+" "+y[1]:y[0]+e+" "+B.join(", ")+" "+y[1]}function we(B){return Array.isArray(B)}function he(B){return typeof B=="boolean"}function Qt(B){return B===null}function ar(B){return B==null}function Te(B){return typeof B=="number"}function xt(B){return typeof B=="string"}function lr(B){return babelHelpers.typeof(B)==="symbol"}function pt(B){return B===void 0}function Xt(B){return Pt(B)&&_e(B)==="[object RegExp]"}function Pt(B){return babelHelpers.typeof(B)==="object"&&B!==null}function ae(B){return Pt(B)&&_e(B)==="[object Date]"}function kt(B){return Pt(B)&&(_e(B)==="[object Error]"||B instanceof Error)}function Kt(B){return typeof B=="function"}function cr(B){return B===null||typeof B=="boolean"||typeof B=="number"||typeof B=="string"||babelHelpers.typeof(B)==="symbol"||typeof B>"u"}function hr(B){return Buffer.isBuffer(B)}function _e(B){return Object.prototype.toString.call(B)}function se(B){return B<10?"0"+B.toString(10):B.toString(10)}var _r=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function yr(){var B=new Date,e=[se(B.getHours()),se(B.getMinutes()),se(B.getSeconds())].join(":");return[B.getDate(),_r[B.getMonth()],e].join(" ")}function Br(){console.log("%s - %s",yr(),ce.apply(null,arguments))}function Ie(B,e){if(!e||!Pt(e))return B;for(var y=Object.keys(e),b=y.length;b--;)B[y[b]]=e[y[b]];return B}function De(B,e){return Object.prototype.hasOwnProperty.call(B,e)}var Nr={inherits:tr,_extend:Ie,log:Br,isBuffer:hr,isPrimitive:cr,isFunction:Kt,isError:kt,isDate:ae,isObject:Pt,isRegExp:Xt,isUndefined:pt,isSymbol:lr,isString:xt,isNumber:Te,isNullOrUndefined:ar,isNull:Qt,isBoolean:he,isArray:we,inspect:Ot,deprecate:me,format:ce,debuglog:rr},rt=ot(function(B,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 y(n){return n.toString().replace("function(","function (")}e.normalizedFunctionString=y;function b(n){let w=C.Buffer.alloc(n);for(let U=0;U<n;++U)w[U]=Math.floor(Math.random()*256);return w}if(e.randomBytes=b,typeof window<"u"&&window.crypto&&window.crypto.getRandomValues)e.randomBytes=n=>window.crypto.getRandomValues(C.Buffer.alloc(n));else{try{e.randomBytes=$e.randomBytes}catch{}e.randomBytes==null&&(e.randomBytes=b)}function l(n){return Object.prototype.toString.call(n)==="[object Uint8Array]"}e.isUint8Array=l;function f(n){return Object.prototype.toString.call(n)==="[object BigInt64Array]"}e.isBigInt64Array=f;function a(n){return Object.prototype.toString.call(n)==="[object BigUint64Array]"}e.isBigUInt64Array=a;function E(){return typeof Ht<"u"&&typeof Ht.Buffer<"u"}e.haveBuffer=E;function o(n){return E()&&C.Buffer.isBuffer(n)}e.isBuffer=o;function c(n){return h(n)&&Object.prototype.toString.call(n)==="[object Date]"}e.isDate=c;function h(n){return typeof n=="object"&&n!==null}e.isObjectLike=h;function p(n,w){if(typeof window>"u"||typeof self>"u")return Nr.deprecate(n,w);let U=!1;function N(...Y){return U||(console.warn(w),U=!0),n.apply(this,...Y)}return N}e.deprecate=p});st(rt);var Ur=rt.deprecate,Mr=rt.isObjectLike,Pr=rt.isDate,jr=rt.isBuffer,Yr=rt.haveBuffer,vr=rt.isBigUInt64Array,Fr=rt.isBigInt64Array,Lr=rt.isUint8Array,Cr=rt.randomBytes,zr=rt.normalizedFunctionString,Nt=ot(function(B,e){Object.defineProperty(e,"__esModule",{value:!0}),e.DBRef=e.isDBRefLike=void 0;function y(l){return rt.isObjectLike(l)&&l.$id!=null&&l.$ref!=null}e.isDBRefLike=y;class b{constructor(f,a,E,o){let c=f.split(".");c.length===2&&(E=c.shift(),f=c.shift()),this.collection=f,this.oid=a,this.db=E,this.fields=o||{}}get namespace(){return this.collection}set namespace(f){this.collection=f}toJSON(){let f=Object.assign({$ref:this.collection,$id:this.oid},this.fields);return this.db!=null&&(f.$db=this.db),f}toExtendedJSON(f){f=f||{};let a={$ref:this.collection,$id:this.oid};return f.legacy||(this.db&&(a.$db=this.db),a=Object.assign(a,this.fields)),a}static fromExtendedJSON(f){let a=Object.assign({},f);return delete a.$ref,delete a.$id,delete a.$db,new b(f.$ref,f.$id,f.$db,a)}}e.DBRef=b,Object.defineProperty(b.prototype,"_bsontype",{value:"DBRef"})});st(Nt);var Jr=Nt.DBRef,Wr=Nt.isDBRefLike,K=ot(function(B,e){Object.defineProperty(e,"__esModule",{value:!0}),e.Long=void 0;let y;try{y=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 b=1<<16,l=1<<24,f=b*b,a=f*f,E=a/2,o={},c={};class h{constructor(n=0,w=0,U){this.comp=h.prototype.compare,this.div=h.prototype.divide,this.eq=h.prototype.equals,this.gt=h.prototype.greaterThan,this.gte=h.prototype.greaterThanOrEqual,this.ge=h.prototype.greaterThanOrEqual,this.lt=h.prototype.lessThan,this.lte=h.prototype.lessThanOrEqual,this.mod=h.prototype.modulo,this.rem=h.prototype.modulo,this.mul=h.prototype.multiply,this.neg=h.prototype.negate,this.neq=h.prototype.notEquals,this.ne=h.prototype.notEquals,this.shl=h.prototype.shiftLeft,this.shr=h.prototype.shiftRight,this.shr_u=h.prototype.shiftRightUnsigned,this.shru=h.prototype.shiftRightUnsigned,this.sub=h.prototype.subtract,this.eqz=h.prototype.isZero,this.le=h.prototype.lessThanOrEqual,this.low=n|0,this.high=w|0,this.unsigned=!!U,Object.defineProperty(this,"__isLong__",{value:!0,configurable:!1,writable:!1,enumerable:!1})}static fromBits(n,w,U){return new h(n,w,U)}static fromInt(n,w){let U,N,Y;return w?(n>>>=0,(Y=0<=n&&n<256)&&(N=c[n],N)?N:(U=h.fromBits(n,(n|0)<0?-1:0,!0),Y&&(c[n]=U),U)):(n|=0,(Y=-128<=n&&n<128)&&(N=o[n],N)?N:(U=h.fromBits(n,n<0?-1:0,!1),Y&&(o[n]=U),U))}static fromNumber(n,w){if(isNaN(n))return w?h.UZERO:h.ZERO;if(w){if(n<0)return h.UZERO;if(n>=a)return h.MAX_UNSIGNED_VALUE}else{if(n<=-E)return h.MIN_VALUE;if(n+1>=E)return h.MAX_VALUE}return n<0?h.fromNumber(-n,w).neg():h.fromBits(n%f|0,n/f|0,w)}static fromBigInt(n,w){return h.fromString(n.toString(),w)}static fromString(n,w,U){if(n.length===0)throw Error("empty string");if(n==="NaN"||n==="Infinity"||n==="+Infinity"||n==="-Infinity")return h.ZERO;if(typeof w=="number"?(U=w,w=!1):w=!!w,U=U||10,U<2||36<U)throw RangeError("radix");let N;if((N=n.indexOf("-"))>0)throw Error("interior hyphen");if(N===0)return h.fromString(n.substring(1),w,U).neg();let Y=h.fromNumber(Math.pow(U,8)),J=h.ZERO;for(let R=0;R<n.length;R+=8){let W=Math.min(8,n.length-R),x=parseInt(n.substring(R,R+W),U);if(W<8){let G=h.fromNumber(Math.pow(U,W));J=J.mul(G).add(h.fromNumber(x))}else J=J.mul(Y),J=J.add(h.fromNumber(x))}return J.unsigned=w,J}static fromBytes(n,w,U){return U?h.fromBytesLE(n,w):h.fromBytesBE(n,w)}static fromBytesLE(n,w){return new h(n[0]|n[1]<<8|n[2]<<16|n[3]<<24,n[4]|n[5]<<8|n[6]<<16|n[7]<<24,w)}static fromBytesBE(n,w){return new h(n[4]<<24|n[5]<<16|n[6]<<8|n[7],n[0]<<24|n[1]<<16|n[2]<<8|n[3],w)}static isLong(n){return rt.isObjectLike(n)&&n.__isLong__===!0}static fromValue(n,w){return typeof n=="number"?h.fromNumber(n,w):typeof n=="string"?h.fromString(n,w):h.fromBits(n.low,n.high,typeof w=="boolean"?w:n.unsigned)}add(n){h.isLong(n)||(n=h.fromValue(n));let w=this.high>>>16,U=this.high&65535,N=this.low>>>16,Y=this.low&65535,J=n.high>>>16,R=n.high&65535,W=n.low>>>16,x=n.low&65535,G=0,M=0,V=0,z=0;return z+=Y+x,V+=z>>>16,z&=65535,V+=N+W,M+=V>>>16,V&=65535,M+=U+R,G+=M>>>16,M&=65535,G+=w+J,G&=65535,h.fromBits(V<<16|z,G<<16|M,this.unsigned)}and(n){return h.isLong(n)||(n=h.fromValue(n)),h.fromBits(this.low&n.low,this.high&n.high,this.unsigned)}compare(n){if(h.isLong(n)||(n=h.fromValue(n)),this.eq(n))return 0;let w=this.isNegative(),U=n.isNegative();return w&&!U?-1:!w&&U?1:this.unsigned?n.high>>>0>this.high>>>0||n.high===this.high&&n.low>>>0>this.low>>>0?-1:1:this.sub(n).isNegative()?-1:1}divide(n){if(h.isLong(n)||(n=h.fromValue(n)),n.isZero())throw Error("division by zero");if(y){if(!this.unsigned&&this.high===-2147483648&&n.low===-1&&n.high===-1)return this;let Y=(this.unsigned?y.div_u:y.div_s)(this.low,this.high,n.low,n.high);return h.fromBits(Y,y.get_high(),this.unsigned)}if(this.isZero())return this.unsigned?h.UZERO:h.ZERO;let w,U,N;if(this.unsigned){if(n.unsigned||(n=n.toUnsigned()),n.gt(this))return h.UZERO;if(n.gt(this.shru(1)))return h.UONE;N=h.UZERO}else{if(this.eq(h.MIN_VALUE))return n.eq(h.ONE)||n.eq(h.NEG_ONE)?h.MIN_VALUE:n.eq(h.MIN_VALUE)?h.ONE:(w=this.shr(1).div(n).shl(1),w.eq(h.ZERO)?n.isNegative()?h.ONE:h.NEG_ONE:(U=this.sub(n.mul(w)),N=w.add(U.div(n)),N));if(n.eq(h.MIN_VALUE))return this.unsigned?h.UZERO:h.ZERO;if(this.isNegative())return n.isNegative()?this.neg().div(n.neg()):this.neg().div(n).neg();if(n.isNegative())return this.div(n.neg()).neg();N=h.ZERO}for(U=this;U.gte(n);){w=Math.max(1,Math.floor(U.toNumber()/n.toNumber()));let Y=Math.ceil(Math.log(w)/Math.LN2),J=Y<=48?1:Math.pow(2,Y-48),R=h.fromNumber(w),W=R.mul(n);for(;W.isNegative()||W.gt(U);)w-=J,R=h.fromNumber(w,this.unsigned),W=R.mul(n);R.isZero()&&(R=h.ONE),N=N.add(R),U=U.sub(W)}return N}equals(n){return h.isLong(n)||(n=h.fromValue(n)),this.unsigned!==n.unsigned&&this.high>>>31===1&&n.high>>>31===1?!1:this.high===n.high&&this.low===n.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(h.MIN_VALUE)?64:this.neg().getNumBitsAbs();let n=this.high!==0?this.high:this.low,w;for(w=31;w>0&&!(n&1<<w);w--);return this.high!==0?w+33:w+1}greaterThan(n){return this.comp(n)>0}greaterThanOrEqual(n){return this.comp(n)>=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(n){return this.comp(n)<0}lessThanOrEqual(n){return this.comp(n)<=0}modulo(n){if(h.isLong(n)||(n=h.fromValue(n)),y){let w=(this.unsigned?y.rem_u:y.rem_s)(this.low,this.high,n.low,n.high);return h.fromBits(w,y.get_high(),this.unsigned)}return this.sub(this.div(n).mul(n))}multiply(n){if(this.isZero())return h.ZERO;if(h.isLong(n)||(n=h.fromValue(n)),y){let Z=y.mul(this.low,this.high,n.low,n.high);return h.fromBits(Z,y.get_high(),this.unsigned)}if(n.isZero())return h.ZERO;if(this.eq(h.MIN_VALUE))return n.isOdd()?h.MIN_VALUE:h.ZERO;if(n.eq(h.MIN_VALUE))return this.isOdd()?h.MIN_VALUE:h.ZERO;if(this.isNegative())return n.isNegative()?this.neg().mul(n.neg()):this.neg().mul(n).neg();if(n.isNegative())return this.mul(n.neg()).neg();if(this.lt(h.TWO_PWR_24)&&n.lt(h.TWO_PWR_24))return h.fromNumber(this.toNumber()*n.toNumber(),this.unsigned);let w=this.high>>>16,U=this.high&65535,N=this.low>>>16,Y=this.low&65535,J=n.high>>>16,R=n.high&65535,W=n.low>>>16,x=n.low&65535,G=0,M=0,V=0,z=0;return z+=Y*x,V+=z>>>16,z&=65535,V+=N*x,M+=V>>>16,V&=65535,V+=Y*W,M+=V>>>16,V&=65535,M+=U*x,G+=M>>>16,M&=65535,M+=N*W,G+=M>>>16,M&=65535,M+=Y*R,G+=M>>>16,M&=65535,G+=w*x+U*W+N*R+Y*J,G&=65535,h.fromBits(V<<16|z,G<<16|M,this.unsigned)}negate(){return!this.unsigned&&this.eq(h.MIN_VALUE)?h.MIN_VALUE:this.not().add(h.ONE)}not(){return h.fromBits(~this.low,~this.high,this.unsigned)}notEquals(n){return!this.equals(n)}or(n){return h.isLong(n)||(n=h.fromValue(n)),h.fromBits(this.low|n.low,this.high|n.high,this.unsigned)}shiftLeft(n){return h.isLong(n)&&(n=n.toInt()),(n&=63)===0?this:n<32?h.fromBits(this.low<<n,this.high<<n|this.low>>>32-n,this.unsigned):h.fromBits(0,this.low<<n-32,this.unsigned)}shiftRight(n){return h.isLong(n)&&(n=n.toInt()),(n&=63)===0?this:n<32?h.fromBits(this.low>>>n|this.high<<32-n,this.high>>n,this.unsigned):h.fromBits(this.high>>n-32,this.high>=0?0:-1,this.unsigned)}shiftRightUnsigned(n){if(h.isLong(n)&&(n=n.toInt()),n&=63,n===0)return this;{let w=this.high;if(n<32){let U=this.low;return h.fromBits(U>>>n|w<<32-n,w>>>n,this.unsigned)}else return n===32?h.fromBits(w,0,this.unsigned):h.fromBits(w>>>n-32,0,this.unsigned)}}subtract(n){return h.isLong(n)||(n=h.fromValue(n)),this.add(n.neg())}toInt(){return this.unsigned?this.low>>>0:this.low}toNumber(){return this.unsigned?(this.high>>>0)*f+(this.low>>>0):this.high*f+(this.low>>>0)}toBigInt(){return BigInt(this.toString())}toBytes(n){return n?this.toBytesLE():this.toBytesBE()}toBytesLE(){let n=this.high,w=this.low;return[w&255,w>>>8&255,w>>>16&255,w>>>24,n&255,n>>>8&255,n>>>16&255,n>>>24]}toBytesBE(){let n=this.high,w=this.low;return[n>>>24,n>>>16&255,n>>>8&255,n&255,w>>>24,w>>>16&255,w>>>8&255,w&255]}toSigned(){return this.unsigned?h.fromBits(this.low,this.high,!1):this}toString(n){if(n=n||10,n<2||36<n)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative())if(this.eq(h.MIN_VALUE)){let Y=h.fromNumber(n),J=this.div(Y),R=J.mul(Y).sub(this);return J.toString(n)+R.toInt().toString(n)}else return"-"+this.neg().toString(n);let w=h.fromNumber(Math.pow(n,6),this.unsigned),U=this,N="";for(;;){let Y=U.div(w),R=(U.sub(Y.mul(w)).toInt()>>>0).toString(n);if(U=Y,U.isZero())return R+N;for(;R.length<6;)R="0"+R;N=""+R+N}}toUnsigned(){return this.unsigned?this:h.fromBits(this.low,this.high,!0)}xor(n){return h.isLong(n)||(n=h.fromValue(n)),h.fromBits(this.low^n.low,this.high^n.high,this.unsigned)}toExtendedJSON(n){return n&&n.relaxed?this.toNumber():{$numberLong:this.toString()}}static fromExtendedJSON(n,w){let U=h.fromString(n.$numberLong);return w&&w.relaxed?U.toNumber():U}}e.Long=h,h.TWO_PWR_24=h.fromInt(l),h.MAX_UNSIGNED_VALUE=h.fromBits(-1,-1,!0),h.ZERO=h.fromInt(0),h.UZERO=h.fromInt(0,!0),h.ONE=h.fromInt(1),h.UONE=h.fromInt(1,!0),h.NEG_ONE=h.fromInt(-1),h.MAX_VALUE=h.fromBits(-1,2147483647,!1),h.MIN_VALUE=h.fromBits(0,-2147483648,!1),Object.defineProperty(h.prototype,"__isLong__",{value:!0}),Object.defineProperty(h.prototype,"_bsontype",{value:"Long"})});st(K);var Xr=K.Long,dt=ot(function(B,e){Object.defineProperty(e,"__esModule",{value:!0}),e.Decimal128=void 0;let y=/^(\+|-)?(\d+|(\d*\.\d*))?(E|e)?([-+])?(\d+)?$/,b=/^(\+|-)?(Infinity|inf)$/i,l=/^(\+|-)?NaN$/i,f=6111,a=-6176,E=6176,o=34,c=[124,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0].reverse(),h=[248,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0].reverse(),p=[120,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0].reverse(),n=/^([-+])?(\d+)?$/,w=31,U=16383,N=30,Y=31;function J(V){return!isNaN(parseInt(V,10))}function R(V){let z=K.Long.fromNumber(1e9),Z=K.Long.fromNumber(0);if(!V.parts[0]&&!V.parts[1]&&!V.parts[2]&&!V.parts[3])return{quotient:V,rem:Z};for(let s=0;s<=3;s++)Z=Z.shiftLeft(32),Z=Z.add(new K.Long(V.parts[s],0)),V.parts[s]=Z.div(z).low,Z=Z.modulo(z);return{quotient:V,rem:Z}}function W(V,z){if(!V&&!z)return{high:K.Long.fromNumber(0),low:K.Long.fromNumber(0)};let Z=V.shiftRightUnsigned(32),s=new K.Long(V.getLowBits(),0),A=z.shiftRightUnsigned(32),O=new K.Long(z.getLowBits(),0),i=Z.multiply(A),m=Z.multiply(O),D=s.multiply(A),j=s.multiply(O);return i=i.add(m.shiftRightUnsigned(32)),m=new K.Long(m.getLowBits(),0).add(D).add(j.shiftRightUnsigned(32)),i=i.add(m.shiftRightUnsigned(32)),j=m.shiftLeft(32).add(new K.Long(j.getLowBits(),0)),{high:i,low:j}}function x(V,z){let Z=V.high>>>0,s=z.high>>>0;if(Z<s)return!0;if(Z===s){let A=V.low>>>0,O=z.low>>>0;if(A<O)return!0}return!1}function G(V,z){throw new TypeError(`"${V}" is not a valid Decimal128 string - ${z}`)}class M{constructor(z){this.bytes=z}static fromString(z){let Z=!1,s=!1,A=!1,O=0,i=0,m=0,D=0,j=0,F=[0],g=0,$=0,L=0,T=0,d=0,q=0,X=new K.Long(0,0),et=new K.Long(0,0),Bt=0,k=0;if(z.length>=7e3)throw new TypeError(""+z+" not a valid Decimal128 string");let lt=z.match(y),ee=z.match(b),Ft=z.match(l);if(!lt&&!ee&&!Ft||z.length===0)throw new TypeError(""+z+" not a valid Decimal128 string");if(lt){let nt=lt[2],u=lt[4],t=lt[5],r=lt[6];u&&r===void 0&&G(z,"missing exponent power"),u&&nt===void 0&&G(z,"missing exponent base"),u===void 0&&(t||r)&&G(z,"missing e before exponent")}if((z[k]==="+"||z[k]==="-")&&(Z=z[k++]==="-"),!J(z[k])&&z[k]!=="."){if(z[k]==="i"||z[k]==="I")return new M(C.Buffer.from(Z?h:p));if(z[k]==="N")return new M(C.Buffer.from(c))}for(;J(z[k])||z[k]===".";){if(z[k]==="."){s&&G(z,"contains multiple periods"),s=!0,k=k+1;continue}g<34&&(z[k]!=="0"||A)&&(A||(j=i),A=!0,F[$++]=parseInt(z[k],10),g=g+1),A&&(m=m+1),s&&(D=D+1),i=i+1,k=k+1}if(s&&!i)throw new TypeError(""+z+" not a valid Decimal128 string");if(z[k]==="e"||z[k]==="E"){let nt=z.substr(++k).match(n);if(!nt||!nt[2])return new M(C.Buffer.from(c));d=parseInt(nt[0],10),k=k+nt[0].length}if(z[k])return new M(C.Buffer.from(c));if(L=0,!g)L=0,T=0,F[0]=0,m=1,g=1,O=0;else if(T=g-1,O=m,O!==1)for(;z[j+O-1]==="0";)O=O-1;for(d<=D&&D-d>1<<14?d=a:d=d-D;d>f;){if(T=T+1,T-L>o){if(F.join("").match(/^0+$/)){d=f;break}G(z,"overflow")}d=d-1}for(;d<a||g<m;){if(T===0&&O<g){d=a,O=0;break}if(g<m?m=m-1:T=T-1,d<f)d=d+1;else{if(F.join("").match(/^0+$/)){d=f;break}G(z,"overflow")}}if(T-L+1<O){let nt=i;s&&(j=j+1,nt=nt+1),Z&&(j=j+1,nt=nt+1);let u=parseInt(z[j+T+1],10),t=0;if(u>=5&&(t=1,u===5)){for(t=F[T]%2===1?1:0,q=j+T+2;q<nt;q++)if(parseInt(z[q],10)){t=1;break}}if(t){let r=T;for(;r>=0;r--)if(++F[r]>9&&(F[r]=0,r===0))if(d<f)d=d+1,F[r]=1;else return new M(C.Buffer.from(Z?h:p))}}if(X=K.Long.fromNumber(0),et=K.Long.fromNumber(0),O===0)X=K.Long.fromNumber(0),et=K.Long.fromNumber(0);else if(T-L<17){let nt=L;for(et=K.Long.fromNumber(F[nt++]),X=new K.Long(0,0);nt<=T;nt++)et=et.multiply(K.Long.fromNumber(10)),et=et.add(K.Long.fromNumber(F[nt]))}else{let nt=L;for(X=K.Long.fromNumber(F[nt++]);nt<=T-17;nt++)X=X.multiply(K.Long.fromNumber(10)),X=X.add(K.Long.fromNumber(F[nt]));for(et=K.Long.fromNumber(F[nt++]);nt<=T;nt++)et=et.multiply(K.Long.fromNumber(10)),et=et.add(K.Long.fromNumber(F[nt]))}let ht=W(X,K.Long.fromString("100000000000000000"));ht.low=ht.low.add(et),x(ht.low,et)&&(ht.high=ht.high.add(K.Long.fromNumber(1))),Bt=d+E;let Q={low:K.Long.fromNumber(0),high:K.Long.fromNumber(0)};ht.high.shiftRightUnsigned(49).and(K.Long.fromNumber(1)).equals(K.Long.fromNumber(1))?(Q.high=Q.high.or(K.Long.fromNumber(3).shiftLeft(61)),Q.high=Q.high.or(K.Long.fromNumber(Bt).and(K.Long.fromNumber(16383).shiftLeft(47))),Q.high=Q.high.or(ht.high.and(K.Long.fromNumber(0x7fffffffffff)))):(Q.high=Q.high.or(K.Long.fromNumber(Bt&16383).shiftLeft(49)),Q.high=Q.high.or(ht.high.and(K.Long.fromNumber(562949953421311)))),Q.low=ht.low,Z&&(Q.high=Q.high.or(K.Long.fromString("9223372036854775808")));let at=C.Buffer.alloc(16);return k=0,at[k++]=Q.low.low&255,at[k++]=Q.low.low>>8&255,at[k++]=Q.low.low>>16&255,at[k++]=Q.low.low>>24&255,at[k++]=Q.low.high&255,at[k++]=Q.low.high>>8&255,at[k++]=Q.low.high>>16&255,at[k++]=Q.low.high>>24&255,at[k++]=Q.high.low&255,at[k++]=Q.high.low>>8&255,at[k++]=Q.high.low>>16&255,at[k++]=Q.high.low>>24&255,at[k++]=Q.high.high&255,at[k++]=Q.high.high>>8&255,at[k++]=Q.high.high>>16&255,at[k++]=Q.high.high>>24&255,new M(at)}toString(){let z,Z=0,s=new Array(36);for(let k=0;k<s.length;k++)s[k]=0;let A=0,O=!1,i,m={parts:[0,0,0,0]},D,j,F=[];A=0;let g=this.bytes,$=g[A++]|g[A++]<<8|g[A++]<<16|g[A++]<<24,L=g[A++]|g[A++]<<8|g[A++]<<16|g[A++]<<24,T=g[A++]|g[A++]<<8|g[A++]<<16|g[A++]<<24,d=g[A++]|g[A++]<<8|g[A++]<<16|g[A++]<<24;A=0,{low:new K.Long($,L),high:new K.Long(T,d)}.high.lessThan(K.Long.ZERO)&&F.push("-");let X=d>>26&w;if(X>>3===3){if(X===N)return F.join("")+"Infinity";if(X===Y)return"NaN";z=d>>15&U,i=8+(d>>14&1)}else i=d>>14&7,z=d>>17&U;let et=z-E;if(m.parts[0]=(d&16383)+((i&15)<<14),m.parts[1]=T,m.parts[2]=L,m.parts[3]=$,m.parts[0]===0&&m.parts[1]===0&&m.parts[2]===0&&m.parts[3]===0)O=!0;else for(j=3;j>=0;j--){let k=0,lt=R(m);if(m=lt.quotient,k=lt.rem.low,!!k)for(D=8;D>=0;D--)s[j*9+D]=k%10,k=Math.floor(k/10)}if(O)Z=1,s[A]=0;else for(Z=36;!s[A];)Z=Z-1,A=A+1;let Bt=Z-1+et;if(Bt>=34||Bt<=-7||et>0){if(Z>34)return F.push(`${0}`),et>0?F.push("E+"+et):et<0&&F.push("E"+et),F.join("");F.push(`${s[A++]}`),Z=Z-1,Z&&F.push(".");for(let k=0;k<Z;k++)F.push(`${s[A++]}`);F.push("E"),Bt>0?F.push("+"+Bt):F.push(`${Bt}`)}else if(et>=0)for(let k=0;k<Z;k++)F.push(`${s[A++]}`);else{let k=Z+et;if(k>0)for(let lt=0;lt<k;lt++)F.push(`${s[A++]}`);else F.push("0");for(F.push(".");k++<0;)F.push("0");for(let lt=0;lt<Z-Math.max(k-1,0);lt++)F.push(`${s[A++]}`)}return F.join("")}toJSON(){return{$numberDecimal:this.toString()}}toExtendedJSON(){return{$numberDecimal:this.toString()}}static fromExtendedJSON(z){return M.fromString(z.$numberDecimal)}}e.Decimal128=M,Object.defineProperty(M.prototype,"_bsontype",{value:"Decimal128"})});st(dt);var kr=dt.Decimal128,It=ot(function(B,e){Object.defineProperty(e,"__esModule",{value:!0}),e.Double=void 0;class y{constructor(l){l instanceof Number&&(l=l.valueOf()),this.value=+l}valueOf(){return this.value}toJSON(){return this.value}toExtendedJSON(l){if(l&&(l.legacy||l.relaxed&&isFinite(this.value)))return this.value;if(Object.is(Math.sign(this.value),-0))return{$numberDouble:`-${this.value.toFixed(1)}`};let f;return Number.isInteger(this.value)?(f=this.value.toFixed(1),f.length>=13&&(f=this.value.toExponential(13).toUpperCase())):f=this.value.toString(),{$numberDouble:f}}static fromExtendedJSON(l,f){let a=parseFloat(l.$numberDouble);return f&&f.relaxed?a:new y(a)}}e.Double=y,Object.defineProperty(y.prototype,"_bsontype",{value:"Double"})});st(It);var Kr=It.Double,Dt=ot(function(B,e){Object.defineProperty(e,"__esModule",{value:!0}),e.Int32=void 0;class y{constructor(l){l instanceof Number&&(l=l.valueOf()),this.value=+l}valueOf(){return this.value}toJSON(){return this.value}toExtendedJSON(l){return l&&(l.relaxed||l.legacy)?this.value:{$numberInt:this.value.toString()}}static fromExtendedJSON(l,f){return f&&f.relaxed?parseInt(l.$numberInt,10):new y(l.$numberInt)}}e.Int32=y,Object.defineProperty(y.prototype,"_bsontype",{value:"Int32"})});st(Dt);var Hr=Dt.Int32,$t=ot(function(B,e){Object.defineProperty(e,"__esModule",{value:!0}),e.Map=void 0;let y;e.Map=y;let b=function(a){return a&&a.Math==Math&&a};function l(){return b(typeof globalThis=="object"&&globalThis)||b(typeof window=="object"&&window)||b(typeof self=="object"&&self)||b(typeof Ht=="object"&&Ht)||Function("return this")()}let f=l();Object.prototype.hasOwnProperty.call(f,"Map")?e.Map=y=f.Map:e.Map=y=class{constructor(E=[]){this._keys=[],this._values={};for(let o=0;o<E.length;o++){if(E[o]==null)continue;let c=E[o],h=c[0],p=c[1];this._keys.push(h),this._values[h]={v:p,i:this._keys.length-1}}}clear(){this._keys=[],this._values={}}delete(E){let o=this._values[E];return o==null?!1:(delete this._values[E],this._keys.splice(o.i,1),!0)}entries(){let E=0;return{next:()=>{let o=this._keys[E++];return{value:o!==void 0?[o,this._values[o].v]:void 0,done:o===void 0}}}}forEach(E,o){o=o||this;for(let c=0;c<this._keys.length;c++){let h=this._keys[c];E.call(o,this._values[h].v,h,o)}}get(E){return this._values[E]?this._values[E].v:void 0}has(E){return this._values[E]!=null}keys(){let E=0;return{next:()=>{let o=this._keys[E++];return{value:o!==void 0?o:void 0,done:o===void 0}}}}set(E,o){return this._values[E]?(this._values[E].v=o,this):(this._keys.push(E),this._values[E]={v:o,i:this._keys.length-1},this)}values(){let E=0;return{next:()=>{let o=this._keys[E++];return{value:o!==void 0?this._values[o].v:void 0,done:o===void 0}}}}get size(){return this._keys.length}}});st($t);var Vr=$t.Map,Rt=ot(function(B,e){Object.defineProperty(e,"__esModule",{value:!0}),e.MaxKey=void 0;class y{toExtendedJSON(){return{$maxKey:1}}static fromExtendedJSON(){return new y}}e.MaxKey=y,Object.defineProperty(y.prototype,"_bsontype",{value:"MaxKey"})});st(Rt);var Zr=Rt.MaxKey,Ut=ot(function(B,e){Object.defineProperty(e,"__esModule",{value:!0}),e.MinKey=void 0;class y{toExtendedJSON(){return{$minKey:1}}static fromExtendedJSON(){return new y}}e.MinKey=y,Object.defineProperty(y.prototype,"_bsontype",{value:"MinKey"})});st(Ut);var qr=Ut.MinKey,St=ot(function(B,e){Object.defineProperty(e,"__esModule",{value:!0}),e.ObjectId=void 0;let y=rt.randomBytes(5),b=new RegExp("^[0-9a-fA-F]{24}$"),l=[];for(let h=0;h<256;h++)l[h]=(h<=15?"0":"")+h.toString(16);let f=[],a=0;for(;a<10;)f[48+a]=a++;for(;a<16;)f[65-10+a]=f[97-10+a]=a++;let E=Symbol("id");class o{constructor(p){if(p instanceof o&&(this[E]=p.id,this.__id=p.__id),typeof p=="object"&&p&&"id"in p&&("toHexString"in p&&typeof p.toHexString=="function"?this[E]=C.Buffer.from(p.toHexString(),"hex"):this[E]=typeof p.id=="string"?C.Buffer.from(p.id):p.id),(p==null||typeof p=="number")&&(this[E]=o.generate(typeof p=="number"?p:void 0),o.cacheHexString&&(this.__id=this.id.toString("hex"))),ArrayBuffer.isView(p)&&p.byteLength===12&&(this[E]=mt.ensureBuffer(p)),typeof p=="string")if(p.length===12){let n=C.Buffer.from(p);n.byteLength===12&&(this[E]=n)}else if(p.length===24&&b.test(p))this[E]=C.Buffer.from(p,"hex");else throw new TypeError("Argument passed in must be a Buffer or string of 12 bytes or a string of 24 hex characters");o.cacheHexString&&(this.__id=this.id.toString("hex"))}get id(){return this[E]}set id(p){this[E]=p,o.cacheHexString&&(this.__id=p.toString("hex"))}get generationTime(){return this.id.readInt32BE(0)}set generationTime(p){this.id.writeUInt32BE(p,0)}toHexString(){if(o.cacheHexString&&this.__id)return this.__id;let p=this.id.toString("hex");return o.cacheHexString&&!this.__id&&(this.__id=p),p}static getInc(){return o.index=(o.index+1)%16777215}static generate(p){typeof p!="number"&&(p=~~(Date.now()/1e3));let n=o.getInc(),w=C.Buffer.alloc(12);return w.writeUInt32BE(p,0),w[4]=y[0],w[5]=y[1],w[6]=y[2],w[7]=y[3],w[8]=y[4],w[11]=n&255,w[10]=n>>8&255,w[9]=n>>16&255,w}toString(p){return p?this.id.toString(p):this.toHexString()}toJSON(){return this.toHexString()}equals(p){return p==null?!1:p instanceof o?this.toString()===p.toString():typeof p=="string"&&o.isValid(p)&&p.length===12&&this.id instanceof C.Buffer?p===this.id.toString("binary"):typeof p=="string"&&o.isValid(p)&&p.length===24?p.toLowerCase()===this.toHexString():typeof p=="string"&&o.isValid(p)&&p.length===12?C.Buffer.from(p).equals(this.id):typeof p=="object"&&"toHexString"in p&&typeof p.toHexString=="function"?p.toHexString()===this.toHexString():!1}getTimestamp(){let p=new Date,n=this.id.readUInt32BE(0);return p.setTime(Math.floor(n)*1e3),p}static createPk(){return new o}static createFromTime(p){let n=C.Buffer.from([0,0,0,0,0,0,0,0,0,0,0,0]);return n.writeUInt32BE(p,0),new o(n)}static createFromHexString(p){if(typeof p>"u"||p!=null&&p.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 o(C.Buffer.from(p,"hex"))}static isValid(p){return p==null?!1:typeof p=="number"?!0:typeof p=="string"?p.length===12||p.length===24&&b.test(p):p instanceof o||p instanceof C.Buffer&&p.length===12?!0:typeof p=="object"&&"toHexString"in p&&typeof p.toHexString=="function"?typeof p.id=="string"?p.id.length===12:p.toHexString().length===24&&b.test(p.id.toString("hex")):!1}toExtendedJSON(){return this.toHexString?{$oid:this.toHexString()}:{$oid:this.toString("hex")}}static fromExtendedJSON(p){return new o(p.$oid)}}e.ObjectId=o,o.index=~~(Math.random()*16777215),Object.defineProperty(o.prototype,"generate",{value:rt.deprecate(h=>o.generate(h),"Please use the static `ObjectId.generate(time)` instead")}),Object.defineProperty(o.prototype,"getInc",{value:rt.deprecate(()=>o.getInc(),"Please use the static `ObjectId.getInc()` instead")}),Object.defineProperty(o.prototype,"get_inc",{value:rt.deprecate(()=>o.getInc(),"Please use the static `ObjectId.getInc()` instead")}),Object.defineProperty(o,"get_inc",{value:rt.deprecate(()=>o.getInc(),"Please use the static `ObjectId.getInc()` instead")});let c=Symbol.for("nodejs.util.inspect.custom");Object.defineProperty(o.prototype,c,o.prototype.toString),Object.defineProperty(o.prototype,"inspect",o.prototype.toString),Object.defineProperty(o.prototype,"_bsontype",{value:"ObjectID"})});st(St);var Qr=St.ObjectId,I=ot(function(B,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});st(I);var xr=I.BSON_BINARY_SUBTYPE_USER_DEFINED,$r=I.BSON_BINARY_SUBTYPE_MD5,tn=I.BSON_BINARY_SUBTYPE_UUID_NEW,en=I.BSON_BINARY_SUBTYPE_UUID,rn=I.BSON_BINARY_SUBTYPE_BYTE_ARRAY,nn=I.BSON_BINARY_SUBTYPE_FUNCTION,on=I.BSON_BINARY_SUBTYPE_DEFAULT,sn=I.BSON_DATA_MAX_KEY,fn=I.BSON_DATA_MIN_KEY,un=I.BSON_DATA_DECIMAL128,an=I.BSON_DATA_LONG,ln=I.BSON_DATA_TIMESTAMP,cn=I.BSON_DATA_INT,hn=I.BSON_DATA_CODE_W_SCOPE,_n=I.BSON_DATA_SYMBOL,yn=I.BSON_DATA_CODE,Bn=I.BSON_DATA_DBPOINTER,Nn=I.BSON_DATA_REGEXP,gn=I.BSON_DATA_NULL,pn=I.BSON_DATA_DATE,On=I.BSON_DATA_BOOLEAN,Sn=I.BSON_DATA_OID,An=I.BSON_DATA_UNDEFINED,En=I.BSON_DATA_BINARY,mn=I.BSON_DATA_ARRAY,wn=I.BSON_DATA_OBJECT,Tn=I.BSON_DATA_STRING,In=I.BSON_DATA_NUMBER,Dn=I.JS_INT_MIN,bn=I.JS_INT_MAX,dn=I.BSON_INT64_MIN,Rn=I.BSON_INT64_MAX,Un=I.BSON_INT32_MIN,Mn=I.BSON_INT32_MAX,ye=ot(function(B,e){Object.defineProperty(e,"__esModule",{value:!0}),e.calculateObjectSize=void 0;function y(l,f,a){let E=5;if(Array.isArray(l))for(let o=0;o<l.length;o++)E+=b(o.toString(),l[o],f,!0,a);else{l.toBSON&&(l=l.toBSON());for(let o in l)E+=b(o,l[o],f,!1,a)}return E}e.calculateObjectSize=y;function b(l,f,a=!1,E=!1,o=!1){switch(f&&f.toBSON&&(f=f.toBSON()),typeof f){case"string":return 1+C.Buffer.byteLength(l,"utf8")+1+4+C.Buffer.byteLength(f,"utf8")+1;case"number":return Math.floor(f)===f&&f>=I.JS_INT_MIN&&f<=I.JS_INT_MAX&&f>=I.BSON_INT32_MIN&&f<=I.BSON_INT32_MAX?(l!=null?C.Buffer.byteLength(l,"utf8")+1:0)+(4+1):(l!=null?C.Buffer.byteLength(l,"utf8")+1:0)+(8+1);case"undefined":return E||!o?(l!=null?C.Buffer.byteLength(l,"utf8")+1:0)+1:0;case"boolean":return(l!=null?C.Buffer.byteLength(l,"utf8")+1:0)+(1+1);case"object":if(f==null||f._bsontype==="MinKey"||f._bsontype==="MaxKey")return(l!=null?C.Buffer.byteLength(l,"utf8")+1:0)+1;if(f._bsontype==="ObjectId"||f._bsontype==="ObjectID")return(l!=null?C.Buffer.byteLength(l,"utf8")+1:0)+(12+1);if(f instanceof Date||rt.isDate(f))return(l!=null?C.Buffer.byteLength(l,"utf8")+1:0)+(8+1);if(ArrayBuffer.isView(f)||f instanceof ArrayBuffer)return(l!=null?C.Buffer.byteLength(l,"utf8")+1:0)+(1+4+1)+f.byteLength;if(f._bsontype==="Long"||f._bsontype==="Double"||f._bsontype==="Timestamp")return(l!=null?C.Buffer.byteLength(l,"utf8")+1:0)+(8+1);if(f._bsontype==="Decimal128")return(l!=null?C.Buffer.byteLength(l,"utf8")+1:0)+(16+1);if(f._bsontype==="Code")return f.scope!=null&&Object.keys(f.scope).length>0?(l!=null?C.Buffer.byteLength(l,"utf8")+1:0)+1+4+4+C.Buffer.byteLength(f.code.toString(),"utf8")+1+y(f.scope,a,o):(l!=null?C.Buffer.byteLength(l,"utf8")+1:0)+1+4+C.Buffer.byteLength(f.code.toString(),"utf8")+1;if(f._bsontype==="Binary")return f.sub_type===_t.Binary.SUBTYPE_BYTE_ARRAY?(l!=null?C.Buffer.byteLength(l,"utf8")+1:0)+(f.position+1+4+1+4):(l!=null?C.Buffer.byteLength(l,"utf8")+1:0)+(f.position+1+4+1);if(f._bsontype==="Symbol")return(l!=null?C.Buffer.byteLength(l,"utf8")+1:0)+C.Buffer.byteLength(f.value,"utf8")+4+1+1;if(f._bsontype==="DBRef"){let c=Object.assign({$ref:f.collection,$id:f.oid},f.fields);return f.db!=null&&(c.$db=f.db),(l!=null?C.Buffer.byteLength(l,"utf8")+1:0)+1+y(c,a,o)}else return f instanceof RegExp||Object.prototype.toString.call(f)==="[object RegExp]"?(l!=null?C.Buffer.byteLength(l,"utf8")+1:0)+1+C.Buffer.byteLength(f.source,"utf8")+1+(f.global?1:0)+(f.ignoreCase?1:0)+(f.multiline?1:0)+1:f._bsontype==="BSONRegExp"?(l!=null?C.Buffer.byteLength(l,"utf8")+1:0)+1+C.Buffer.byteLength(f.pattern,"utf8")+1+C.Buffer.byteLength(f.options,"utf8")+1:(l!=null?C.Buffer.byteLength(l,"utf8")+1:0)+y(f,a,o)+1;case"function":if(f instanceof RegExp||Object.prototype.toString.call(f)==="[object RegExp]"||String.call(f)==="[object RegExp]")return(l!=null?C.Buffer.byteLength(l,"utf8")+1:0)+1+C.Buffer.byteLength(f.source,"utf8")+1+(f.global?1:0)+(f.ignoreCase?1:0)+(f.multiline?1:0)+1;if(a&&f.scope!=null&&Object.keys(f.scope).length>0)return(l!=null?C.Buffer.byteLength(l,"utf8")+1:0)+1+4+4+C.Buffer.byteLength(rt.normalizedFunctionString(f),"utf8")+1+y(f.scope,a,o);if(a)return(l!=null?C.Buffer.byteLength(l,"utf8")+1:0)+1+4+C.Buffer.byteLength(rt.normalizedFunctionString(f),"utf8")+1}return 0}});st(ye);var Pn=ye.calculateObjectSize,At=ot(function(B,e){Object.defineProperty(e,"__esModule",{value:!0}),e.BSONRegExp=void 0;function y(l){return l.split("").sort().join("")}class b{constructor(f,a){this.pattern=f,this.options=a??"",y(this.options);for(let E=0;E<this.options.length;E++)if(!(this.options[E]==="i"||this.options[E]==="m"||this.options[E]==="x"||this.options[E]==="l"||this.options[E]==="s"||this.options[E]==="u"))throw new Error(`The regular expression option [${this.options[E]}] is not supported`)}static parseOptions(f){return f?f.split("").sort().join(""):""}toExtendedJSON(f){return f=f||{},f.legacy?{$regex:this.pattern,$options:this.options}:{$regularExpression:{pattern:this.pattern,options:this.options}}}static fromExtendedJSON(f){if("$regex"in f)if(typeof f.$regex!="string"){if(f.$regex._bsontype==="BSONRegExp")return f}else return new b(f.$regex,b.parseOptions(f.$options));if("$regularExpression"in f)return new b(f.$regularExpression.pattern,b.parseOptions(f.$regularExpression.options));throw new TypeError(`Unexpected BSONRegExp EJSON object form: ${JSON.stringify(f)}`)}}e.BSONRegExp=b,Object.defineProperty(b.prototype,"_bsontype",{value:"BSONRegExp"})});st(At);var jn=At.BSONRegExp,Mt=ot(function(B,e){Object.defineProperty(e,"__esModule",{value:!0}),e.BSONSymbol=void 0;class y{constructor(l){this.value=l}valueOf(){return this.value}toString(){return this.value}inspect(){return this.value}toJSON(){return this.value}toExtendedJSON(){return{$symbol:this.value}}static fromExtendedJSON(l){return new y(l.$symbol)}}e.BSONSymbol=y,Object.defineProperty(y.prototype,"_bsontype",{value:"Symbol"})});st(Mt);var Yn=Mt.BSONSymbol,wt=ot(function(B,e){Object.defineProperty(e,"__esModule",{value:!0}),e.Timestamp=e.LongWithoutOverridesClass=void 0,e.LongWithoutOverridesClass=K.Long;class y extends e.LongWithoutOverridesClass{constructor(l,f){K.Long.isLong(l)?super(l.low,l.high,!0):super(l,f,!0),Object.defineProperty(this,"_bsontype",{value:"Timestamp",writable:!1,configurable:!1,enumerable:!1})}toJSON(){return{$timestamp:this.toString()}}static fromInt(l){return new y(K.Long.fromInt(l,!0))}static fromNumber(l){return new y(K.Long.fromNumber(l,!0))}static fromBits(l,f){return new y(l,f)}static fromString(l,f){return new y(K.Long.fromString(l,!0,f))}toExtendedJSON(){return{$timestamp:{t:this.high>>>0,i:this.low>>>0}}}static fromExtendedJSON(l){return new y(l.$timestamp.i,l.$timestamp.t)}}e.Timestamp=y,y.MAX_VALUE=K.Long.MAX_UNSIGNED_VALUE});st(wt);var vn=wt.Timestamp,Fn=wt.LongWithoutOverridesClass,Vt=ot(function(B,e){Object.defineProperty(e,"__esModule",{value:!0}),e.validateUtf8=void 0;let y=128,b=192,l=224,f=240,a=248,E=192,o=224,c=240,h=128;function p(n,w,U){let N=0;for(let Y=w;Y<U;Y+=1){let J=n[Y];if(N){if((J&b)!==h)return!1;N-=1}else if(J&y)if((J&l)===E)N=1;else if((J&f)===o)N=2;else if((J&a)===c)N=3;else return!1}return!N}e.validateUtf8=p});st(Vt);var Ln=Vt.validateUtf8,Zt=ot(function(B,e){Object.defineProperty(e,"__esModule",{value:!0}),e.deserialize=void 0;let y=K.Long.fromNumber(I.JS_INT_MAX),b=K.Long.fromNumber(I.JS_INT_MIN),l={};function f(o,c,h){c=c??{};let p=c&&c.index?c.index:0,n=o[p]|o[p+1]<<8|o[p+2]<<16|o[p+3]<<24;if(n<5)throw new Error(`bson size must be >= 5, is ${n}`);if(c.allowObjectSmallerThanBufferSize&&o.length<n)throw new Error(`buffer length ${o.length} must be >= bson size ${n}`);if(!c.allowObjectSmallerThanBufferSize&&o.length!==n)throw new Error(`buffer length ${o.length} must === bson size ${n}`);if(n+p>o.byteLength)throw new Error(`(bson size ${n} + options.index ${p} must be <= buffer length ${o.byteLength})`);if(o[p+n-1]!==0)throw new Error("One object, sized correctly, with a spot for an EOO, but the EOO isn't 0x00");return a(o,p,c,h)}e.deserialize=f;function a(o,c,h,p=!1){let n=h.evalFunctions==null?!1:h.evalFunctions,w=h.cacheFunctions==null?!1:h.cacheFunctions,U=h.fieldsAsRaw==null?null:h.fieldsAsRaw,N=h.raw==null?!1:h.raw,Y=typeof h.bsonRegExp=="boolean"?h.bsonRegExp:!1,J=h.promoteBuffers==null?!1:h.promoteBuffers,R=h.promoteLongs==null?!0:h.promoteLongs,W=h.promoteValues==null?!0:h.promoteValues,x=c;if(o.length<5)throw new Error("corrupt bson message < 5 bytes long");let G=o[c++]|o[c++]<<8|o[c++]<<16|o[c++]<<24;if(G<5||G>o.length)throw new Error("corrupt bson message");let M=p?[]:{},V=0,z=!1;for(;!z;){let A=o[c++];if(A===0)break;let O=c;for(;o[O]!==0&&O<o.length;)O++;if(O>=o.byteLength)throw new Error("Bad BSON Document: illegal CString");let i=p?V++:o.toString("utf8",c,O);if(c=O+1,A===I.BSON_DATA_STRING){let m=o[c++]|o[c++]<<8|o[c++]<<16|o[c++]<<24;if(m<=0||m>o.length-c||o[c+m-1]!==0)throw new Error("bad string length in bson");if(!Vt.validateUtf8(o,c,c+m-1))throw new Error("Invalid UTF-8 string in BSON document");let D=o.toString("utf8",c,c+m-1);M[i]=D,c=c+m}else if(A===I.BSON_DATA_OID){let m=C.Buffer.alloc(12);o.copy(m,0,c,c+12),M[i]=new St.ObjectId(m),c=c+12}else if(A===I.BSON_DATA_INT&&W===!1)M[i]=new Dt.Int32(o[c++]|o[c++]<<8|o[c++]<<16|o[c++]<<24);else if(A===I.BSON_DATA_INT)M[i]=o[c++]|o[c++]<<8|o[c++]<<16|o[c++]<<24;else if(A===I.BSON_DATA_NUMBER&&W===!1)M[i]=new It.Double(o.readDoubleLE(c)),c=c+8;else if(A===I.BSON_DATA_NUMBER)M[i]=o.readDoubleLE(c),c=c+8;else if(A===I.BSON_DATA_DATE){let m=o[c++]|o[c++]<<8|o[c++]<<16|o[c++]<<24,D=o[c++]|o[c++]<<8|o[c++]<<16|o[c++]<<24;M[i]=new Date(new K.Long(m,D).toNumber())}else if(A===I.BSON_DATA_BOOLEAN){if(o[c]!==0&&o[c]!==1)throw new Error("illegal boolean type value");M[i]=o[c++]===1}else if(A===I.BSON_DATA_OBJECT){let m=c,D=o[c]|o[c+1]<<8|o[c+2]<<16|o[c+3]<<24;if(D<=0||D>o.length-c)throw new Error("bad embedded document length in bson");N?M[i]=o.slice(c,c+D):M[i]=a(o,m,h,!1),c=c+D}else if(A===I.BSON_DATA_ARRAY){let m=c,D=o[c]|o[c+1]<<8|o[c+2]<<16|o[c+3]<<24,j=h,F=c+D;if(U&&U[i]){j={};for(let g in h)j[g]=h[g];j.raw=!0}if(M[i]=a(o,m,j,!0),c=c+D,o[c-1]!==0)throw new Error("invalid array terminator byte");if(c!==F)throw new Error("corrupted array bson")}else if(A===I.BSON_DATA_UNDEFINED)M[i]=void 0;else if(A===I.BSON_DATA_NULL)M[i]=null;else if(A===I.BSON_DATA_LONG){let m=o[c++]|o[c++]<<8|o[c++]<<16|o[c++]<<24,D=o[c++]|o[c++]<<8|o[c++]<<16|o[c++]<<24,j=new K.Long(m,D);R&&W===!0?M[i]=j.lessThanOrEqual(y)&&j.greaterThanOrEqual(b)?j.toNumber():j:M[i]=j}else if(A===I.BSON_DATA_DECIMAL128){let m=C.Buffer.alloc(16);o.copy(m,0,c,c+16),c=c+16;let D=new dt.Decimal128(m);"toObject"in D&&typeof D.toObject=="function"?M[i]=D.toObject():M[i]=D}else if(A===I.BSON_DATA_BINARY){let m=o[c++]|o[c++]<<8|o[c++]<<16|o[c++]<<24,D=m,j=o[c++];if(m<0)throw new Error("Negative binary type element size found");if(m>o.byteLength)throw new Error("Binary type size larger than document size");if(o.slice!=null){if(j===_t.Binary.SUBTYPE_BYTE_ARRAY){if(m=o[c++]|o[c++]<<8|o[c++]<<16|o[c++]<<24,m<0)throw new Error("Negative binary type element size found for subtype 0x02");if(m>D-4)throw new Error("Binary type with subtype 0x02 contains too long binary size");if(m<D-4)throw new Error("Binary type with subtype 0x02 contains too short binary size")}J&&W?M[i]=o.slice(c,c+m):M[i]=new _t.Binary(o.slice(c,c+m),j)}else{let F=C.Buffer.alloc(m);if(j===_t.Binary.SUBTYPE_BYTE_ARRAY){if(m=o[c++]|o[c++]<<8|o[c++]<<16|o[c++]<<24,m<0)throw new Error("Negative binary type element size found for subtype 0x02");if(m>D-4)throw new Error("Binary type with subtype 0x02 contains too long binary size");if(m<D-4)throw new Error("Binary type with subtype 0x02 contains too short binary size")}for(O=0;O<m;O++)F[O]=o[c+O];J&&W?M[i]=F:M[i]=new _t.Binary(F,j)}c=c+m}else if(A===I.BSON_DATA_REGEXP&&Y===!1){for(O=c;o[O]!==0&&O<o.length;)O++;if(O>=o.length)throw new Error("Bad BSON Document: illegal CString");let m=o.toString("utf8",c,O);for(c=O+1,O=c;o[O]!==0&&O<o.length;)O++;if(O>=o.length)throw new Error("Bad BSON Document: illegal CString");let D=o.toString("utf8",c,O);c=O+1;let j=new Array(D.length);for(O=0;O<D.length;O++)switch(D[O]){case"m":j[O]="m";break;case"s":j[O]="g";break;case"i":j[O]="i";break}M[i]=new RegExp(m,j.join(""))}else if(A===I.BSON_DATA_REGEXP&&Y===!0){for(O=c;o[O]!==0&&O<o.length;)O++;if(O>=o.length)throw new Error("Bad BSON Document: illegal CString");let m=o.toString("utf8",c,O);for(c=O+1,O=c;o[O]!==0&&O<o.length;)O++;if(O>=o.length)throw new Error("Bad BSON Document: illegal CString");let D=o.toString("utf8",c,O);c=O+1,M[i]=new At.BSONRegExp(m,D)}else if(A===I.BSON_DATA_SYMBOL){let m=o[c++]|o[c++]<<8|o[c++]<<16|o[c++]<<24;if(m<=0||m>o.length-c||o[c+m-1]!==0)throw new Error("bad string length in bson");let D=o.toString("utf8",c,c+m-1);M[i]=W?D:new Mt.BSONSymbol(D),c=c+m}else if(A===I.BSON_DATA_TIMESTAMP){let m=o[c++]|o[c++]<<8|o[c++]<<16|o[c++]<<24,D=o[c++]|o[c++]<<8|o[c++]<<16|o[c++]<<24;M[i]=new wt.Timestamp(m,D)}else if(A===I.BSON_DATA_MIN_KEY)M[i]=new Ut.MinKey;else if(A===I.BSON_DATA_MAX_KEY)M[i]=new Rt.MaxKey;else if(A===I.BSON_DATA_CODE){let m=o[c++]|o[c++]<<8|o[c++]<<16|o[c++]<<24;if(m<=0||m>o.length-c||o[c+m-1]!==0)throw new Error("bad string length in bson");let D=o.toString("utf8",c,c+m-1);n?w?M[i]=E(D,l,M):M[i]=E(D):M[i]=new Et.Code(D),c=c+m}else if(A===I.BSON_DATA_CODE_W_SCOPE){let m=o[c++]|o[c++]<<8|o[c++]<<16|o[c++]<<24;if(m<4+4+4+1)throw new Error("code_w_scope total size shorter minimum expected length");let D=o[c++]|o[c++]<<8|o[c++]<<16|o[c++]<<24;if(D<=0||D>o.length-c||o[c+D-1]!==0)throw new Error("bad string length in bson");let j=o.toString("utf8",c,c+D-1);c=c+D;let F=c,g=o[c]|o[c+1]<<8|o[c+2]<<16|o[c+3]<<24,$=a(o,F,h,!1);if(c=c+g,m<4+4+g+D)throw new Error("code_w_scope total size is too short, truncating scope");if(m>4+4+g+D)throw new Error("code_w_scope total size is too long, clips outer document");n?(w?M[i]=E(j,l,M):M[i]=E(j),M[i].scope=$):M[i]=new Et.Code(j,$)}else if(A===I.BSON_DATA_DBPOINTER){let m=o[c++]|o[c++]<<8|o[c++]<<16|o[c++]<<24;if(m<=0||m>o.length-c||o[c+m-1]!==0)throw new Error("bad string length in bson");if(!Vt.validateUtf8(o,c,c+m-1))throw new Error("Invalid UTF-8 string in BSON document");let D=o.toString("utf8",c,c+m-1);c=c+m;let j=C.Buffer.alloc(12);o.copy(j,0,c,c+12);let F=new St.ObjectId(j);c=c+12,M[i]=new Nt.DBRef(D,F)}else throw new Error("Detected unknown BSON type "+A.toString(16)+' for fieldname "'+i+'"')}if(G!==c-x)throw p?new Error("corrupt array bson"):new Error("corrupt object bson");let Z=Object.keys(M).filter(A=>A.startsWith("$")),s=!0;if(Z.forEach(A=>{["$ref","$id","$db"].indexOf(A)===-1&&(s=!1)}),!s)return M;if(Nt.isDBRefLike(M)){let A=Object.assign({},M);return delete A.$ref,delete A.$id,delete A.$db,new Nt.DBRef(M.$ref,M.$id,M.$db,A)}return M}function E(o,c,h){return c?(c[o]==null&&(c[o]=new Function(o)),c[o].bind(h)):new Function(o)}});st(Zt);var Cn=Zt.deserialize,Yt=ot(function(B,e){Object.defineProperty(e,"__esModule",{value:!0}),e.EJSON=e.isBSONType=void 0;function y(N){return rt.isObjectLike(N)&&Reflect.has(N,"_bsontype")&&typeof N._bsontype=="string"}e.isBSONType=y;let b=2147483647,l=-2147483648,f=9223372036854776e3,a=-9223372036854776e3,E={$oid:St.ObjectId,$binary:_t.Binary,$uuid:_t.Binary,$symbol:Mt.BSONSymbol,$numberInt:Dt.Int32,$numberDecimal:dt.Decimal128,$numberDouble:It.Double,$numberLong:K.Long,$minKey:Ut.MinKey,$maxKey:Rt.MaxKey,$regex:At.BSONRegExp,$regularExpression:At.BSONRegExp,$timestamp:wt.Timestamp};function o(N,Y={}){if(typeof N=="number"){if(Y.relaxed||Y.legacy)return N;if(Math.floor(N)===N){if(N>=l&&N<=b)return new Dt.Int32(N);if(N>=a&&N<=f)return K.Long.fromNumber(N)}return new It.Double(N)}if(N==null||typeof N!="object")return N;if(N.$undefined)return null;let J=Object.keys(N).filter(R=>R.startsWith("$")&&N[R]!=null);for(let R=0;R<J.length;R++){let W=E[J[R]];if(W)return W.fromExtendedJSON(N,Y)}if(N.$date!=null){let R=N.$date,W=new Date;return Y.legacy?typeof R=="number"?W.setTime(R):typeof R=="string"&&W.setTime(Date.parse(R)):typeof R=="string"?W.setTime(Date.parse(R)):K.Long.isLong(R)?W.setTime(R.toNumber()):typeof R=="number"&&Y.relaxed&&W.setTime(R),W}if(N.$code!=null){let R=Object.assign({},N);return N.$scope&&(R.$scope=o(N.$scope)),Et.Code.fromExtendedJSON(N)}if(N.$ref!=null||N.$dbPointer!=null){let R=N.$ref?N:N.$dbPointer;if(R instanceof Nt.DBRef)return R;let W=Object.keys(R).filter(G=>G.startsWith("$")),x=!0;if(W.forEach(G=>{["$ref","$id","$db"].indexOf(G)===-1&&(x=!1)}),x)return Nt.DBRef.fromExtendedJSON(R)}return N}function c(N,Y){return N.map(J=>p(J,Y))}function h(N){let Y=N.toISOString();return N.getUTCMilliseconds()!==0?Y:Y.slice(0,-5)+"Z"}function p(N,Y){if(Array.isArray(N))return c(N,Y);if(N===void 0)return null;if(N instanceof Date){let J=N.getTime(),R=J>-1&&J<2534023188e5;return Y.legacy?Y.relaxed&&R?{$date:N.getTime()}:{$date:h(N)}:Y.relaxed&&R?{$date:h(N)}:{$date:{$numberLong:N.getTime().toString()}}}if(typeof N=="number"&&!Y.relaxed){if(Math.floor(N)===N){let J=N>=l&&N<=b,R=N>=a&&N<=f;if(J)return{$numberInt:N.toString()};if(R)return{$numberLong:N.toString()}}return{$numberDouble:N.toString()}}if(N instanceof RegExp){let J=N.flags;if(J===void 0){let W=N.toString().match(/[gimuy]*$/);W&&(J=W[0])}return new At.BSONRegExp(N.source,J).toExtendedJSON(Y)}return N!=null&&typeof N=="object"?w(N,Y):N}let n={Binary:N=>new _t.Binary(N.value(),N.sub_type),Code:N=>new Et.Code(N.code,N.scope),DBRef:N=>new Nt.DBRef(N.collection||N.namespace,N.oid,N.db,N.fields),Decimal128:N=>new dt.Decimal128(N.bytes),Double:N=>new It.Double(N.value),Int32:N=>new Dt.Int32(N.value),Long:N=>K.Long.fromBits(N.low!=null?N.low:N.low_,N.low!=null?N.high:N.high_,N.low!=null?N.unsigned:N.unsigned_),MaxKey:()=>new Rt.MaxKey,MinKey:()=>new Ut.MinKey,ObjectID:N=>new St.ObjectId(N),ObjectId:N=>new St.ObjectId(N),BSONRegExp:N=>new At.BSONRegExp(N.pattern,N.options),Symbol:N=>new Mt.BSONSymbol(N.value),Timestamp:N=>wt.Timestamp.fromBits(N.low,N.high)};function w(N,Y){if(N==null||typeof N!="object")throw new Error("not an object instance");let J=N._bsontype;if(typeof J>"u"){let R={};for(let W in N)R[W]=p(N[W],Y);return R}else if(y(N)){let R=N;if(typeof R.toExtendedJSON!="function"){let W=n[N._bsontype];if(!W)throw new TypeError("Unrecognized or invalid _bsontype: "+N._bsontype);R=W(R)}return J==="Code"&&R.scope?R=new Et.Code(R.code,p(R.scope,Y)):J==="DBRef"&&R.oid&&(R=new Nt.DBRef(R.collection,p(R.oid,Y),R.db,R.fields)),R.toExtendedJSON(Y)}else throw new Error("_bsontype must be a string, but was: "+typeof J)}var U;(function(N){function Y(x,G){let M=Object.assign({},{relaxed:!0,legacy:!1},G);return typeof M.relaxed=="boolean"&&(M.strict=!M.relaxed),typeof M.strict=="boolean"&&(M.relaxed=!M.strict),JSON.parse(x,(V,z)=>o(z,M))}N.parse=Y;function J(x,G,M,V){M!=null&&typeof M=="object"&&(V=M,M=0),G!=null&&typeof G=="object"&&!Array.isArray(G)&&(V=G,G=void 0,M=0),V=Object.assign({},{relaxed:!0,legacy:!1},V);let z=p(x,V);return JSON.stringify(z,G,M)}N.stringify=J;function R(x,G){return G=G||{},JSON.parse(J(x,G))}N.serialize=R;function W(x,G){return G=G||{},Y(JSON.stringify(x),G)}N.deserialize=W})(U=e.EJSON||(e.EJSON={}))});st(Yt);var zn=Yt.EJSON,Jn=Yt.isBSONType,jt=ot(function(B,e){Object.defineProperty(e,"__esModule",{value:!0}),e.writeIEEE754=e.readIEEE754=void 0;function y(l,f,a,E,o){let c,h,p=a==="big",n=o*8-E-1,w=(1<<n)-1,U=w>>1,N=-7,Y=p?0:o-1,J=p?1:-1,R=l[f+Y];for(Y+=J,c=R&(1<<-N)-1,R>>=-N,N+=n;N>0;c=c*256+l[f+Y],Y+=J,N-=8);for(h=c&(1<<-N)-1,c>>=-N,N+=E;N>0;h=h*256+l[f+Y],Y+=J,N-=8);if(c===0)c=1-U;else{if(c===w)return h?NaN:(R?-1:1)*(1/0);h=h+Math.pow(2,E),c=c-U}return(R?-1:1)*h*Math.pow(2,c-E)}e.readIEEE754=y;function b(l,f,a,E,o,c){let h,p,n,w=E==="big",U=c*8-o-1,N=(1<<U)-1,Y=N>>1,J=o===23?Math.pow(2,-24)-Math.pow(2,-77):0,R=w?c-1:0,W=w?-1:1,x=f<0||f===0&&1/f<0?1:0;for(f=Math.abs(f),isNaN(f)||f===1/0?(p=isNaN(f)?1:0,h=N):(h=Math.floor(Math.log(f)/Math.LN2),f*(n=Math.pow(2,-h))<1&&(h--,n*=2),h+Y>=1?f+=J/n:f+=J*Math.pow(2,1-Y),f*n>=2&&(h++,n/=2),h+Y>=N?(p=0,h=N):h+Y>=1?(p=(f*n-1)*Math.pow(2,o),h=h+Y):(p=f*Math.pow(2,Y-1)*Math.pow(2,o),h=0)),isNaN(f)&&(p=0);o>=8;)l[a+R]=p&255,R+=W,p/=256,o-=8;for(h=h<<o|p,isNaN(f)&&(h+=8),U+=o;U>0;)l[a+R]=h&255,R+=W,h/=256,U-=8;l[a+R-W]|=x*128}e.writeIEEE754=b});st(jt);var Wn=jt.writeIEEE754,Xn=jt.readIEEE754,qt=ot(function(B,e){Object.defineProperty(e,"__esModule",{value:!0}),e.serializeInto=void 0;let y=/\x00/,b=new Set(["$db","$ref","$id","$clusterTime"]);function l(s){return Object.prototype.toString.call(s)==="[object RegExp]"}function f(s,A,O,i,m){s[i++]=I.BSON_DATA_STRING;let D=m?s.write(A,i,void 0,"ascii"):s.write(A,i,void 0,"utf8");i=i+D+1,s[i-1]=0;let j=s.write(O,i+4,void 0,"utf8");return s[i+3]=j+1>>24&255,s[i+2]=j+1>>16&255,s[i+1]=j+1>>8&255,s[i]=j+1&255,i=i+4+j,s[i++]=0,i}function a(s,A,O,i,m){if(Number.isInteger(O)&&O>=I.BSON_INT32_MIN&&O<=I.BSON_INT32_MAX){s[i++]=I.BSON_DATA_INT;let D=m?s.write(A,i,void 0,"ascii"):s.write(A,i,void 0,"utf8");i=i+D,s[i++]=0,s[i++]=O&255,s[i++]=O>>8&255,s[i++]=O>>16&255,s[i++]=O>>24&255}else{s[i++]=I.BSON_DATA_NUMBER;let D=m?s.write(A,i,void 0,"ascii"):s.write(A,i,void 0,"utf8");i=i+D,s[i++]=0,jt.writeIEEE754(s,O,i,"little",52,8),i=i+8}return i}function E(s,A,O,i,m){s[i++]=I.BSON_DATA_NULL;let D=m?s.write(A,i,void 0,"ascii"):s.write(A,i,void 0,"utf8");return i=i+D,s[i++]=0,i}function o(s,A,O,i,m){s[i++]=I.BSON_DATA_BOOLEAN;let D=m?s.write(A,i,void 0,"ascii"):s.write(A,i,void 0,"utf8");return i=i+D,s[i++]=0,s[i++]=O?1:0,i}function c(s,A,O,i,m){s[i++]=I.BSON_DATA_DATE;let D=m?s.write(A,i,void 0,"ascii"):s.write(A,i,void 0,"utf8");i=i+D,s[i++]=0;let j=K.Long.fromNumber(O.getTime()),F=j.getLowBits(),g=j.getHighBits();return s[i++]=F&255,s[i++]=F>>8&255,s[i++]=F>>16&255,s[i++]=F>>24&255,s[i++]=g&255,s[i++]=g>>8&255,s[i++]=g>>16&255,s[i++]=g>>24&255,i}function h(s,A,O,i,m){s[i++]=I.BSON_DATA_REGEXP;let D=m?s.write(A,i,void 0,"ascii"):s.write(A,i,void 0,"utf8");if(i=i+D,s[i++]=0,O.source&&O.source.match(y)!=null)throw Error("value "+O.source+" must not contain null bytes");return i=i+s.write(O.source,i,void 0,"utf8"),s[i++]=0,O.ignoreCase&&(s[i++]=105),O.global&&(s[i++]=115),O.multiline&&(s[i++]=109),s[i++]=0,i}function p(s,A,O,i,m){s[i++]=I.BSON_DATA_REGEXP;let D=m?s.write(A,i,void 0,"ascii"):s.write(A,i,void 0,"utf8");if(i=i+D,s[i++]=0,O.pattern.match(y)!=null)throw Error("pattern "+O.pattern+" must not contain null bytes");return i=i+s.write(O.pattern,i,void 0,"utf8"),s[i++]=0,i=i+s.write(O.options.split("").sort().join(""),i,void 0,"utf8"),s[i++]=0,i}function n(s,A,O,i,m){O===null?s[i++]=I.BSON_DATA_NULL:O._bsontype==="MinKey"?s[i++]=I.BSON_DATA_MIN_KEY:s[i++]=I.BSON_DATA_MAX_KEY;let D=m?s.write(A,i,void 0,"ascii"):s.write(A,i,void 0,"utf8");return i=i+D,s[i++]=0,i}function w(s,A,O,i,m){s[i++]=I.BSON_DATA_OID;let D=m?s.write(A,i,void 0,"ascii"):s.write(A,i,void 0,"utf8");if(i=i+D,s[i++]=0,typeof O.id=="string")s.write(O.id,i,void 0,"binary");else if(O.id&&O.id.copy)O.id.copy(s,i,0,12);else throw new TypeError("object ["+JSON.stringify(O)+"] is not a valid ObjectId");return i+12}function U(s,A,O,i,m){s[i++]=I.BSON_DATA_BINARY;let D=m?s.write(A,i,void 0,"ascii"):s.write(A,i,void 0,"utf8");i=i+D,s[i++]=0;let j=O.length;return s[i++]=j&255,s[i++]=j>>8&255,s[i++]=j>>16&255,s[i++]=j>>24&255,s[i++]=I.BSON_BINARY_SUBTYPE_DEFAULT,s.set(mt.ensureBuffer(O),i),i=i+j,i}function N(s,A,O,i,m=!1,D=0,j=!1,F=!0,g=!1,$=[]){for(let d=0;d<$.length;d++)if($[d]===O)throw new Error("cyclic dependency detected");$.push(O),s[i++]=Array.isArray(O)?I.BSON_DATA_ARRAY:I.BSON_DATA_OBJECT;let L=g?s.write(A,i,void 0,"ascii"):s.write(A,i,void 0,"utf8");i=i+L,s[i++]=0;let T=Z(s,O,m,i,D+1,j,F,$);return $.pop(),T}function Y(s,A,O,i,m){s[i++]=I.BSON_DATA_DECIMAL128;let D=m?s.write(A,i,void 0,"ascii"):s.write(A,i,void 0,"utf8");return i=i+D,s[i++]=0,O.bytes.copy(s,i,0,16),i+16}function J(s,A,O,i,m){s[i++]=O._bsontype==="Long"?I.BSON_DATA_LONG:I.BSON_DATA_TIMESTAMP;let D=m?s.write(A,i,void 0,"ascii"):s.write(A,i,void 0,"utf8");i=i+D,s[i++]=0;let j=O.getLowBits(),F=O.getHighBits();return s[i++]=j&255,s[i++]=j>>8&255,s[i++]=j>>16&255,s[i++]=j>>24&255,s[i++]=F&255,s[i++]=F>>8&255,s[i++]=F>>16&255,s[i++]=F>>24&255,i}function R(s,A,O,i,m){O=O.valueOf(),s[i++]=I.BSON_DATA_INT;let D=m?s.write(A,i,void 0,"ascii"):s.write(A,i,void 0,"utf8");return i=i+D,s[i++]=0,s[i++]=O&255,s[i++]=O>>8&255,s[i++]=O>>16&255,s[i++]=O>>24&255,i}function W(s,A,O,i,m){s[i++]=I.BSON_DATA_NUMBER;let D=m?s.write(A,i,void 0,"ascii"):s.write(A,i,void 0,"utf8");return i=i+D,s[i++]=0,jt.writeIEEE754(s,O.value,i,"little",52,8),i=i+8,i}function x(s,A,O,i,m=!1,D=0,j){s[i++]=I.BSON_DATA_CODE;let F=j?s.write(A,i,void 0,"ascii"):s.write(A,i,void 0,"utf8");i=i+F,s[i++]=0;let g=rt.normalizedFunctionString(O),$=s.write(g,i+4,void 0,"utf8")+1;return s[i]=$&255,s[i+1]=$>>8&255,s[i+2]=$>>16&255,s[i+3]=$>>24&255,i=i+4+$-1,s[i++]=0,i}function G(s,A,O,i,m=!1,D=0,j=!1,F=!0,g=!1){if(O.scope&&typeof O.scope=="object"){s[i++]=I.BSON_DATA_CODE_W_SCOPE;let $=g?s.write(A,i,void 0,"ascii"):s.write(A,i,void 0,"utf8");i=i+$,s[i++]=0;let L=i,T=typeof O.code=="string"?O.code:O.code.toString();i=i+4;let d=s.write(T,i+4,void 0,"utf8")+1;s[i]=d&255,s[i+1]=d>>8&255,s[i+2]=d>>16&255,s[i+3]=d>>24&255,s[i+4+d-1]=0,i=i+d+4;let q=Z(s,O.scope,m,i,D+1,j,F);i=q-1;let X=q-L;s[L++]=X&255,s[L++]=X>>8&255,s[L++]=X>>16&255,s[L++]=X>>24&255,s[i++]=0}else{s[i++]=I.BSON_DATA_CODE;let $=g?s.write(A,i,void 0,"ascii"):s.write(A,i,void 0,"utf8");i=i+$,s[i++]=0;let L=O.code.toString(),T=s.write(L,i+4,void 0,"utf8")+1;s[i]=T&255,s[i+1]=T>>8&255,s[i+2]=T>>16&255,s[i+3]=T>>24&255,i=i+4+T-1,s[i++]=0}return i}function M(s,A,O,i,m){s[i++]=I.BSON_DATA_BINARY;let D=m?s.write(A,i,void 0,"ascii"):s.write(A,i,void 0,"utf8");i=i+D,s[i++]=0;let j=O.value(!0),F=O.position;return O.sub_type===_t.Binary.SUBTYPE_BYTE_ARRAY&&(F=F+4),s[i++]=F&255,s[i++]=F>>8&255,s[i++]=F>>16&255,s[i++]=F>>24&255,s[i++]=O.sub_type,O.sub_type===_t.Binary.SUBTYPE_BYTE_ARRAY&&(F=F-4,s[i++]=F&255,s[i++]=F>>8&255,s[i++]=F>>16&255,s[i++]=F>>24&255),s.set(j,i),i=i+O.position,i}function V(s,A,O,i,m){s[i++]=I.BSON_DATA_SYMBOL;let D=m?s.write(A,i,void 0,"ascii"):s.write(A,i,void 0,"utf8");i=i+D,s[i++]=0;let j=s.write(O.value,i+4,void 0,"utf8")+1;return s[i]=j&255,s[i+1]=j>>8&255,s[i+2]=j>>16&255,s[i+3]=j>>24&255,i=i+4+j-1,s[i++]=0,i}function z(s,A,O,i,m,D,j){s[i++]=I.BSON_DATA_OBJECT;let F=j?s.write(A,i,void 0,"ascii"):s.write(A,i,void 0,"utf8");i=i+F,s[i++]=0;let g=i,$={$ref:O.collection||O.namespace,$id:O.oid};O.db!=null&&($.$db=O.db),$=Object.assign($,O.fields);let L=Z(s,$,!1,i,m+1,D),T=L-g;return s[g++]=T&255,s[g++]=T>>8&255,s[g++]=T>>16&255,s[g++]=T>>24&255,L}function Z(s,A,O=!1,i=0,m=0,D=!1,j=!0,F=[]){i=i||0,F=F||[],F.push(A);let g=i+4;if(Array.isArray(A))for(let L=0;L<A.length;L++){let T=""+L,d=A[L];if(d&&d.toBSON){if(typeof d.toBSON!="function")throw new TypeError("toBSON is not a function");d=d.toBSON()}if(typeof d=="string")g=f(s,T,d,g,!0);else if(typeof d=="number")g=a(s,T,d,g,!0);else{if(typeof d=="bigint")throw new TypeError("Unsupported type BigInt, please use Decimal128");if(typeof d=="boolean")g=o(s,T,d,g,!0);else if(d instanceof Date||rt.isDate(d))g=c(s,T,d,g,!0);else if(d===void 0)g=E(s,T,d,g,!0);else if(d===null)g=E(s,T,d,g,!0);else if(d._bsontype==="ObjectId"||d._bsontype==="ObjectID")g=w(s,T,d,g,!0);else if(C.Buffer.isBuffer(d)||rt.isUint8Array(d))g=U(s,T,d,g,!0);else if(d instanceof RegExp||l(d))g=h(s,T,d,g,!0);else if(typeof d=="object"&&d._bsontype==null)g=N(s,T,d,g,O,m,D,j,!0,F);else if(typeof d=="object"&&Yt.isBSONType(d)&&d._bsontype==="Decimal128")g=Y(s,T,d,g,!0);else if(d._bsontype==="Long"||d._bsontype==="Timestamp")g=J(s,T,d,g,!0);else if(d._bsontype==="Double")g=W(s,T,d,g,!0);else if(typeof d=="function"&&D)g=x(s,T,d,g,O,m,!0);else if(d._bsontype==="Code")g=G(s,T,d,g,O,m,D,j,!0);else if(d._bsontype==="Binary")g=M(s,T,d,g,!0);else if(d._bsontype==="Symbol")g=V(s,T,d,g,!0);else if(d._bsontype==="DBRef")g=z(s,T,d,g,m,D,!0);else if(d._bsontype==="BSONRegExp")g=p(s,T,d,g,!0);else if(d._bsontype==="Int32")g=R(s,T,d,g,!0);else if(d._bsontype==="MinKey"||d._bsontype==="MaxKey")g=n(s,T,d,g,!0);else if(typeof d._bsontype<"u")throw new TypeError("Unrecognized or invalid _bsontype: "+d._bsontype)}}else if(A instanceof $t.Map){let L=A.entries(),T=!1;for(;!T;){let d=L.next();if(T=!!d.done,T)continue;let q=d.value[0],X=d.value[1],et=typeof X;if(typeof q=="string"&&!b.has(q)){if(q.match(y)!=null)throw Error("key "+q+" must not contain null bytes");if(O){if(q[0]==="$")throw Error("key "+q+" must not start with '$'");if(~q.indexOf("."))throw Error("key "+q+" must not contain '.'")}}if(et==="string")g=f(s,q,X,g);else if(et==="number")g=a(s,q,X,g);else{if(et==="bigint"||rt.isBigInt64Array(X)||rt.isBigUInt64Array(X))throw new TypeError("Unsupported type BigInt, please use Decimal128");if(et==="boolean")g=o(s,q,X,g);else if(X instanceof Date||rt.isDate(X))g=c(s,q,X,g);else if(X===null||X===void 0&&j===!1)g=E(s,q,X,g);else if(X._bsontype==="ObjectId"||X._bsontype==="ObjectID")g=w(s,q,X,g);else if(C.Buffer.isBuffer(X)||rt.isUint8Array(X))g=U(s,q,X,g);else if(X instanceof RegExp||l(X))g=h(s,q,X,g);else if(et==="object"&&X._bsontype==null)g=N(s,q,X,g,O,m,D,j,!1,F);else if(et==="object"&&X._bsontype==="Decimal128")g=Y(s,q,X,g);else if(X._bsontype==="Long"||X._bsontype==="Timestamp")g=J(s,q,X,g);else if(X._bsontype==="Double")g=W(s,q,X,g);else if(X._bsontype==="Code")g=G(s,q,X,g,O,m,D,j);else if(typeof X=="function"&&D)g=x(s,q,X,g,O,m,D);else if(X._bsontype==="Binary")g=M(s,q,X,g);else if(X._bsontype==="Symbol")g=V(s,q,X,g);else if(X._bsontype==="DBRef")g=z(s,q,X,g,m,D);else if(X._bsontype==="BSONRegExp")g=p(s,q,X,g);else if(X._bsontype==="Int32")g=R(s,q,X,g);else if(X._bsontype==="MinKey"||X._bsontype==="MaxKey")g=n(s,q,X,g);else if(typeof X._bsontype<"u")throw new TypeError("Unrecognized or invalid _bsontype: "+X._bsontype)}}}else{if(A.toBSON){if(typeof A.toBSON!="function")throw new TypeError("toBSON is not a function");if(A=A.toBSON(),A!=null&&typeof A!="object")throw new TypeError("toBSON function did not return an object")}for(let L in A){let T=A[L];if(T&&T.toBSON){if(typeof T.toBSON!="function")throw new TypeError("toBSON is not a function");T=T.toBSON()}let d=typeof T;if(typeof L=="string"&&!b.has(L)){if(L.match(y)!=null)throw Error("key "+L+" must not contain null bytes");if(O){if(L[0]==="$")throw Error("key "+L+" must not start with '$'");if(~L.indexOf("."))throw Error("key "+L+" must not contain '.'")}}if(d==="string")g=f(s,L,T,g);else if(d==="number")g=a(s,L,T,g);else{if(d==="bigint")throw new TypeError("Unsupported type BigInt, please use Decimal128");if(d==="boolean")g=o(s,L,T,g);else if(T instanceof Date||rt.isDate(T))g=c(s,L,T,g);else if(T===void 0)j===!1&&(g=E(s,L,T,g));else if(T===null)g=E(s,L,T,g);else if(T._bsontype==="ObjectId"||T._bsontype==="ObjectID")g=w(s,L,T,g);else if(C.Buffer.isBuffer(T)||rt.isUint8Array(T))g=U(s,L,T,g);else if(T instanceof RegExp||l(T))g=h(s,L,T,g);else if(d==="object"&&T._bsontype==null)g=N(s,L,T,g,O,m,D,j,!1,F);else if(d==="object"&&T._bsontype==="Decimal128")g=Y(s,L,T,g);else if(T._bsontype==="Long"||T._bsontype==="Timestamp")g=J(s,L,T,g);else if(T._bsontype==="Double")g=W(s,L,T,g);else if(T._bsontype==="Code")g=G(s,L,T,g,O,m,D,j);else if(typeof T=="function"&&D)g=x(s,L,T,g,O,m,D);else if(T._bsontype==="Binary")g=M(s,L,T,g);else if(T._bsontype==="Symbol")g=V(s,L,T,g);else if(T._bsontype==="DBRef")g=z(s,L,T,g,m,D);else if(T._bsontype==="BSONRegExp")g=p(s,L,T,g);else if(T._bsontype==="Int32")g=R(s,L,T,g);else if(T._bsontype==="MinKey"||T._bsontype==="MaxKey")g=n(s,L,T,g);else if(typeof T._bsontype<"u")throw new TypeError("Unrecognized or invalid _bsontype: "+T._bsontype)}}}F.pop(),s[g++]=0;let $=g-i;return s[i++]=$&255,s[i++]=$>>8&255,s[i++]=$>>16&255,s[i++]=$>>24&255,g}e.serializeInto=Z});st(qt);var kn=qt.serializeInto,H=ot(function(B,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 _t.Binary}}),Object.defineProperty(e,"Code",{enumerable:!0,get:function(){return Et.Code}}),Object.defineProperty(e,"DBRef",{enumerable:!0,get:function(){return Nt.DBRef}}),Object.defineProperty(e,"Decimal128",{enumerable:!0,get:function(){return dt.Decimal128}}),Object.defineProperty(e,"Double",{enumerable:!0,get:function(){return It.Double}}),Object.defineProperty(e,"Int32",{enumerable:!0,get:function(){return Dt.Int32}}),Object.defineProperty(e,"Long",{enumerable:!0,get:function(){return K.Long}}),Object.defineProperty(e,"Map",{enumerable:!0,get:function(){return $t.Map}}),Object.defineProperty(e,"MaxKey",{enumerable:!0,get:function(){return Rt.MaxKey}}),Object.defineProperty(e,"MinKey",{enumerable:!0,get:function(){return Ut.MinKey}}),Object.defineProperty(e,"ObjectId",{enumerable:!0,get:function(){return St.ObjectId}}),Object.defineProperty(e,"ObjectID",{enumerable:!0,get:function(){return St.ObjectId}}),Object.defineProperty(e,"BSONRegExp",{enumerable:!0,get:function(){return At.BSONRegExp}}),Object.defineProperty(e,"BSONSymbol",{enumerable:!0,get:function(){return Mt.BSONSymbol}}),Object.defineProperty(e,"Timestamp",{enumerable:!0,get:function(){return wt.Timestamp}}),Object.defineProperty(e,"BSON_BINARY_SUBTYPE_BYTE_ARRAY",{enumerable:!0,get:function(){return I.BSON_BINARY_SUBTYPE_BYTE_ARRAY}}),Object.defineProperty(e,"BSON_BINARY_SUBTYPE_DEFAULT",{enumerable:!0,get:function(){return I.BSON_BINARY_SUBTYPE_DEFAULT}}),Object.defineProperty(e,"BSON_BINARY_SUBTYPE_FUNCTION",{enumerable:!0,get:function(){return I.BSON_BINARY_SUBTYPE_FUNCTION}}),Object.defineProperty(e,"BSON_BINARY_SUBTYPE_MD5",{enumerable:!0,get:function(){return I.BSON_BINARY_SUBTYPE_MD5}}),Object.defineProperty(e,"BSON_BINARY_SUBTYPE_USER_DEFINED",{enumerable:!0,get:function(){return I.BSON_BINARY_SUBTYPE_USER_DEFINED}}),Object.defineProperty(e,"BSON_BINARY_SUBTYPE_UUID",{enumerable:!0,get:function(){return I.BSON_BINARY_SUBTYPE_UUID}}),Object.defineProperty(e,"BSON_BINARY_SUBTYPE_UUID_NEW",{enumerable:!0,get:function(){return I.BSON_BINARY_SUBTYPE_UUID_NEW}}),Object.defineProperty(e,"BSON_DATA_ARRAY",{enumerable:!0,get:function(){return I.BSON_DATA_ARRAY}}),Object.defineProperty(e,"BSON_DATA_BINARY",{enumerable:!0,get:function(){return I.BSON_DATA_BINARY}}),Object.defineProperty(e,"BSON_DATA_BOOLEAN",{enumerable:!0,get:function(){return I.BSON_DATA_BOOLEAN}}),Object.defineProperty(e,"BSON_DATA_CODE",{enumerable:!0,get:function(){return I.BSON_DATA_CODE}}),Object.defineProperty(e,"BSON_DATA_CODE_W_SCOPE",{enumerable:!0,get:function(){return I.BSON_DATA_CODE_W_SCOPE}}),Object.defineProperty(e,"BSON_DATA_DATE",{enumerable:!0,get:function(){return I.BSON_DATA_DATE}}),Object.defineProperty(e,"BSON_DATA_DBPOINTER",{enumerable:!0,get:function(){return I.BSON_DATA_DBPOINTER}}),Object.defineProperty(e,"BSON_DATA_DECIMAL128",{enumerable:!0,get:function(){return I.BSON_DATA_DECIMAL128}}),Object.defineProperty(e,"BSON_DATA_INT",{enumerable:!0,get:function(){return I.BSON_DATA_INT}}),Object.defineProperty(e,"BSON_DATA_LONG",{enumerable:!0,get:function(){return I.BSON_DATA_LONG}}),Object.defineProperty(e,"BSON_DATA_MAX_KEY",{enumerable:!0,get:function(){return I.BSON_DATA_MAX_KEY}}),Object.defineProperty(e,"BSON_DATA_MIN_KEY",{enumerable:!0,get:function(){return I.BSON_DATA_MIN_KEY}}),Object.defineProperty(e,"BSON_DATA_NULL",{enumerable:!0,get:function(){return I.BSON_DATA_NULL}}),Object.defineProperty(e,"BSON_DATA_NUMBER",{enumerable:!0,get:function(){return I.BSON_DATA_NUMBER}}),Object.defineProperty(e,"BSON_DATA_OBJECT",{enumerable:!0,get:function(){return I.BSON_DATA_OBJECT}}),Object.defineProperty(e,"BSON_DATA_OID",{enumerable:!0,get:function(){return I.BSON_DATA_OID}}),Object.defineProperty(e,"BSON_DATA_REGEXP",{enumerable:!0,get:function(){return I.BSON_DATA_REGEXP}}),Object.defineProperty(e,"BSON_DATA_STRING",{enumerable:!0,get:function(){return I.BSON_DATA_STRING}}),Object.defineProperty(e,"BSON_DATA_SYMBOL",{enumerable:!0,get:function(){return I.BSON_DATA_SYMBOL}}),Object.defineProperty(e,"BSON_DATA_TIMESTAMP",{enumerable:!0,get:function(){return I.BSON_DATA_TIMESTAMP}}),Object.defineProperty(e,"BSON_DATA_UNDEFINED",{enumerable:!0,get:function(){return I.BSON_DATA_UNDEFINED}}),Object.defineProperty(e,"BSON_INT32_MAX",{enumerable:!0,get:function(){return I.BSON_INT32_MAX}}),Object.defineProperty(e,"BSON_INT32_MIN",{enumerable:!0,get:function(){return I.BSON_INT32_MIN}}),Object.defineProperty(e,"BSON_INT64_MAX",{enumerable:!0,get:function(){return I.BSON_INT64_MAX}}),Object.defineProperty(e,"BSON_INT64_MIN",{enumerable:!0,get:function(){return I.BSON_INT64_MIN}}),Object.defineProperty(e,"JS_INT_MAX",{enumerable:!0,get:function(){return I.JS_INT_MAX}}),Object.defineProperty(e,"JS_INT_MIN",{enumerable:!0,get:function(){return I.JS_INT_MIN}}),Object.defineProperty(e,"EJSON",{enumerable:!0,get:function(){return Yt.EJSON}});var y=wt;Object.defineProperty(e,"LongWithoutOverridesClass",{enumerable:!0,get:function(){return y.LongWithoutOverridesClass}});let b=1024*1024*17,l=C.Buffer.alloc(b);function f(p){l.length<p&&(l=C.Buffer.alloc(p))}e.setInternalBufferSize=f;function a(p,n={}){let w=typeof n.checkKeys=="boolean"?n.checkKeys:!1,U=typeof n.serializeFunctions=="boolean"?n.serializeFunctions:!1,N=typeof n.ignoreUndefined=="boolean"?n.ignoreUndefined:!0,Y=typeof n.minInternalBufferSize=="number"?n.minInternalBufferSize:b;l.length<Y&&(l=C.Buffer.alloc(Y));let J=qt.serializeInto(l,p,w,0,0,U,N,[]),R=C.Buffer.alloc(J);return l.copy(R,0,0,R.length),R}e.serialize=a;function E(p,n,w={}){let U=typeof w.checkKeys=="boolean"?w.checkKeys:!1,N=typeof w.serializeFunctions=="boolean"?w.serializeFunctions:!1,Y=typeof w.ignoreUndefined=="boolean"?w.ignoreUndefined:!0,J=typeof w.index=="number"?w.index:0,R=qt.serializeInto(l,p,U,0,0,N,Y);return l.copy(n,J,0,R),J+R-1}e.serializeWithBufferAndIndex=E;function o(p,n={}){return Zt.deserialize(mt.ensureBuffer(p),n)}e.deserialize=o;function c(p,n={}){n=n||{};let w=typeof n.serializeFunctions=="boolean"?n.serializeFunctions:!1,U=typeof n.ignoreUndefined=="boolean"?n.ignoreUndefined:!0;return ye.calculateObjectSize(p,w,U)}e.calculateObjectSize=c;function h(p,n,w,U,N,Y){let J=Object.assign({allowObjectSmallerThanBufferSize:!0,index:0},Y),R=mt.ensureBuffer(p),W=n;for(let x=0;x<w;x++){let G=R[W]|R[W+1]<<8|R[W+2]<<16|R[W+3]<<24;J.index=W,U[N+x]=Zt.deserialize(R,J),W=W+G}return W}e.deserializeStream=h}),Kn=st(H),Hn=H.deserializeStream,Gn=H.calculateObjectSize,be=H.deserialize,Vn=H.serializeWithBufferAndIndex,de=H.serialize,Zn=H.setInternalBufferSize,qn=H.ObjectID,Qn=H.Decimal128,xn=H.BSONRegExp,$n=H.MaxKey,ti=H.MinKey,ei=H.Int32,ri=H.Double,ni=H.Timestamp,ii=H.Long,oi=H.ObjectId,si=H.Binary,fi=H.DBRef,ui=H.BSONSymbol,ai=H.Map,li=H.Code,ci=H.LongWithoutOverridesClass,hi=H.EJSON,_i=H.JS_INT_MIN,yi=H.JS_INT_MAX,Bi=H.BSON_INT64_MIN,Ni=H.BSON_INT64_MAX,gi=H.BSON_INT32_MIN,pi=H.BSON_INT32_MAX,Oi=H.BSON_DATA_UNDEFINED,Si=H.BSON_DATA_TIMESTAMP,Ai=H.BSON_DATA_SYMBOL,Ei=H.BSON_DATA_STRING,mi=H.BSON_DATA_REGEXP,wi=H.BSON_DATA_OID,Ti=H.BSON_DATA_OBJECT,Ii=H.BSON_DATA_NUMBER,Di=H.BSON_DATA_NULL,bi=H.BSON_DATA_MIN_KEY,di=H.BSON_DATA_MAX_KEY,Ri=H.BSON_DATA_LONG,Ui=H.BSON_DATA_INT,Mi=H.BSON_DATA_DECIMAL128,Pi=H.BSON_DATA_DBPOINTER,ji=H.BSON_DATA_DATE,Yi=H.BSON_DATA_CODE_W_SCOPE,vi=H.BSON_DATA_CODE,Fi=H.BSON_DATA_BOOLEAN,Li=H.BSON_DATA_BINARY,Ci=H.BSON_DATA_ARRAY,zi=H.BSON_BINARY_SUBTYPE_UUID_NEW,Ji=H.BSON_BINARY_SUBTYPE_UUID,Wi=H.BSON_BINARY_SUBTYPE_USER_DEFINED,Xi=H.BSON_BINARY_SUBTYPE_MD5,ki=H.BSON_BINARY_SUBTYPE_FUNCTION,Ki=H.BSON_BINARY_SUBTYPE_DEFAULT,Hi=H.BSON_BINARY_SUBTYPE_BYTE_ARRAY;function Be(B,e){return be(new Uint8Array(B),e)}var gr="4.3.0",te={dataType:null,batchType:null,name:"BSON",id:"bson",module:"bson",version:gr,extensions:["bson"],mimeTypes:["application/bson"],category:"json",binary:!0,parse:pr,parseSync:Or,options:{bson:{}}};async function pr(B,e){let y={...te.options.bson,...e?.bson};return Be(B,y)}function Or(B,e){let y={...te.options.bson,...e?.bson};return Be(B,y)}function Ne(B,e){return de(B).buffer}var Sr="4.3.0",Ue={name:"BSON",id:"bson",module:"bson",version:Sr,extensions:["bson"],options:{bson:{}},async encode(B,e){return Ne(B,{})},encodeSync(B,e){return Ne(B,{})}};return ze(vt);})();
|
|
16
|
+
`)+" "+y[1]:y[0]+e+" "+B.join(", ")+" "+y[1]}function Te(B){return Array.isArray(B)}function _e(B){return typeof B=="boolean"}function Qt(B){return B===null}function lr(B){return B==null}function Ie(B){return typeof B=="number"}function xt(B){return typeof B=="string"}function cr(B){return babelHelpers.typeof(B)==="symbol"}function pt(B){return B===void 0}function Xt(B){return Pt(B)&&ye(B)==="[object RegExp]"}function Pt(B){return babelHelpers.typeof(B)==="object"&&B!==null}function le(B){return Pt(B)&&ye(B)==="[object Date]"}function kt(B){return Pt(B)&&(ye(B)==="[object Error]"||B instanceof Error)}function Kt(B){return typeof B=="function"}function hr(B){return B===null||typeof B=="boolean"||typeof B=="number"||typeof B=="string"||babelHelpers.typeof(B)==="symbol"||typeof B>"u"}function _r(B){return Buffer.isBuffer(B)}function ye(B){return Object.prototype.toString.call(B)}function fe(B){return B<10?"0"+B.toString(10):B.toString(10)}var yr=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function Br(){var B=new Date,e=[fe(B.getHours()),fe(B.getMinutes()),fe(B.getSeconds())].join(":");return[B.getDate(),yr[B.getMonth()],e].join(" ")}function Nr(){console.log("%s - %s",Br(),he.apply(null,arguments))}function be(B,e){if(!e||!Pt(e))return B;for(var y=Object.keys(e),D=y.length;D--;)B[y[D]]=e[y[D]];return B}function De(B,e){return Object.prototype.hasOwnProperty.call(B,e)}var gr={inherits:er,_extend:be,log:Nr,isBuffer:_r,isPrimitive:hr,isFunction:Kt,isError:kt,isDate:le,isObject:Pt,isRegExp:Xt,isUndefined:pt,isSymbol:cr,isString:xt,isNumber:Ie,isNullOrUndefined:lr,isNull:Qt,isBoolean:_e,isArray:Te,inspect:Ot,deprecate:we,format:he,debuglog:nr},rt=ot(function(B,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 y(n){return n.toString().replace("function(","function (")}e.normalizedFunctionString=y;function D(n){let w=C.Buffer.alloc(n);for(let U=0;U<n;++U)w[U]=Math.floor(Math.random()*256);return w}if(e.randomBytes=D,typeof window<"u"&&window.crypto&&window.crypto.getRandomValues)e.randomBytes=n=>window.crypto.getRandomValues(C.Buffer.alloc(n));else{try{e.randomBytes=tr.randomBytes}catch{}e.randomBytes==null&&(e.randomBytes=D)}function l(n){return Object.prototype.toString.call(n)==="[object Uint8Array]"}e.isUint8Array=l;function f(n){return Object.prototype.toString.call(n)==="[object BigInt64Array]"}e.isBigInt64Array=f;function u(n){return Object.prototype.toString.call(n)==="[object BigUint64Array]"}e.isBigUInt64Array=u;function E(){return typeof Ht<"u"&&typeof Ht.Buffer<"u"}e.haveBuffer=E;function o(n){return E()&&C.Buffer.isBuffer(n)}e.isBuffer=o;function c(n){return h(n)&&Object.prototype.toString.call(n)==="[object Date]"}e.isDate=c;function h(n){return typeof n=="object"&&n!==null}e.isObjectLike=h;function p(n,w){if(typeof window>"u"||typeof self>"u")return gr.deprecate(n,w);let U=!1;function N(...Y){return U||(console.warn(w),U=!0),n.apply(this,...Y)}return N}e.deprecate=p});st(rt);var Mr=rt.deprecate,Pr=rt.isObjectLike,jr=rt.isDate,Yr=rt.isBuffer,vr=rt.haveBuffer,Fr=rt.isBigUInt64Array,Lr=rt.isBigInt64Array,Cr=rt.isUint8Array,zr=rt.randomBytes,Jr=rt.normalizedFunctionString,Nt=ot(function(B,e){Object.defineProperty(e,"__esModule",{value:!0}),e.DBRef=e.isDBRefLike=void 0;function y(l){return rt.isObjectLike(l)&&l.$id!=null&&l.$ref!=null}e.isDBRefLike=y;class D{constructor(f,u,E,o){let c=f.split(".");c.length===2&&(E=c.shift(),f=c.shift()),this.collection=f,this.oid=u,this.db=E,this.fields=o||{}}get namespace(){return this.collection}set namespace(f){this.collection=f}toJSON(){let f=Object.assign({$ref:this.collection,$id:this.oid},this.fields);return this.db!=null&&(f.$db=this.db),f}toExtendedJSON(f){f=f||{};let u={$ref:this.collection,$id:this.oid};return f.legacy||(this.db&&(u.$db=this.db),u=Object.assign(u,this.fields)),u}static fromExtendedJSON(f){let u=Object.assign({},f);return delete u.$ref,delete u.$id,delete u.$db,new D(f.$ref,f.$id,f.$db,u)}}e.DBRef=D,Object.defineProperty(D.prototype,"_bsontype",{value:"DBRef"})});st(Nt);var Wr=Nt.DBRef,Xr=Nt.isDBRefLike,K=ot(function(B,e){Object.defineProperty(e,"__esModule",{value:!0}),e.Long=void 0;let y;try{y=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 D=1<<16,l=1<<24,f=D*D,u=f*f,E=u/2,o={},c={};class h{constructor(n=0,w=0,U){this.comp=h.prototype.compare,this.div=h.prototype.divide,this.eq=h.prototype.equals,this.gt=h.prototype.greaterThan,this.gte=h.prototype.greaterThanOrEqual,this.ge=h.prototype.greaterThanOrEqual,this.lt=h.prototype.lessThan,this.lte=h.prototype.lessThanOrEqual,this.mod=h.prototype.modulo,this.rem=h.prototype.modulo,this.mul=h.prototype.multiply,this.neg=h.prototype.negate,this.neq=h.prototype.notEquals,this.ne=h.prototype.notEquals,this.shl=h.prototype.shiftLeft,this.shr=h.prototype.shiftRight,this.shr_u=h.prototype.shiftRightUnsigned,this.shru=h.prototype.shiftRightUnsigned,this.sub=h.prototype.subtract,this.eqz=h.prototype.isZero,this.le=h.prototype.lessThanOrEqual,this.low=n|0,this.high=w|0,this.unsigned=!!U,Object.defineProperty(this,"__isLong__",{value:!0,configurable:!1,writable:!1,enumerable:!1})}static fromBits(n,w,U){return new h(n,w,U)}static fromInt(n,w){let U,N,Y;return w?(n>>>=0,(Y=0<=n&&n<256)&&(N=c[n],N)?N:(U=h.fromBits(n,(n|0)<0?-1:0,!0),Y&&(c[n]=U),U)):(n|=0,(Y=-128<=n&&n<128)&&(N=o[n],N)?N:(U=h.fromBits(n,n<0?-1:0,!1),Y&&(o[n]=U),U))}static fromNumber(n,w){if(isNaN(n))return w?h.UZERO:h.ZERO;if(w){if(n<0)return h.UZERO;if(n>=u)return h.MAX_UNSIGNED_VALUE}else{if(n<=-E)return h.MIN_VALUE;if(n+1>=E)return h.MAX_VALUE}return n<0?h.fromNumber(-n,w).neg():h.fromBits(n%f|0,n/f|0,w)}static fromBigInt(n,w){return h.fromString(n.toString(),w)}static fromString(n,w,U){if(n.length===0)throw Error("empty string");if(n==="NaN"||n==="Infinity"||n==="+Infinity"||n==="-Infinity")return h.ZERO;if(typeof w=="number"?(U=w,w=!1):w=!!w,U=U||10,U<2||36<U)throw RangeError("radix");let N;if((N=n.indexOf("-"))>0)throw Error("interior hyphen");if(N===0)return h.fromString(n.substring(1),w,U).neg();let Y=h.fromNumber(Math.pow(U,8)),J=h.ZERO;for(let R=0;R<n.length;R+=8){let W=Math.min(8,n.length-R),x=parseInt(n.substring(R,R+W),U);if(W<8){let G=h.fromNumber(Math.pow(U,W));J=J.mul(G).add(h.fromNumber(x))}else J=J.mul(Y),J=J.add(h.fromNumber(x))}return J.unsigned=w,J}static fromBytes(n,w,U){return U?h.fromBytesLE(n,w):h.fromBytesBE(n,w)}static fromBytesLE(n,w){return new h(n[0]|n[1]<<8|n[2]<<16|n[3]<<24,n[4]|n[5]<<8|n[6]<<16|n[7]<<24,w)}static fromBytesBE(n,w){return new h(n[4]<<24|n[5]<<16|n[6]<<8|n[7],n[0]<<24|n[1]<<16|n[2]<<8|n[3],w)}static isLong(n){return rt.isObjectLike(n)&&n.__isLong__===!0}static fromValue(n,w){return typeof n=="number"?h.fromNumber(n,w):typeof n=="string"?h.fromString(n,w):h.fromBits(n.low,n.high,typeof w=="boolean"?w:n.unsigned)}add(n){h.isLong(n)||(n=h.fromValue(n));let w=this.high>>>16,U=this.high&65535,N=this.low>>>16,Y=this.low&65535,J=n.high>>>16,R=n.high&65535,W=n.low>>>16,x=n.low&65535,G=0,M=0,V=0,z=0;return z+=Y+x,V+=z>>>16,z&=65535,V+=N+W,M+=V>>>16,V&=65535,M+=U+R,G+=M>>>16,M&=65535,G+=w+J,G&=65535,h.fromBits(V<<16|z,G<<16|M,this.unsigned)}and(n){return h.isLong(n)||(n=h.fromValue(n)),h.fromBits(this.low&n.low,this.high&n.high,this.unsigned)}compare(n){if(h.isLong(n)||(n=h.fromValue(n)),this.eq(n))return 0;let w=this.isNegative(),U=n.isNegative();return w&&!U?-1:!w&&U?1:this.unsigned?n.high>>>0>this.high>>>0||n.high===this.high&&n.low>>>0>this.low>>>0?-1:1:this.sub(n).isNegative()?-1:1}divide(n){if(h.isLong(n)||(n=h.fromValue(n)),n.isZero())throw Error("division by zero");if(y){if(!this.unsigned&&this.high===-2147483648&&n.low===-1&&n.high===-1)return this;let Y=(this.unsigned?y.div_u:y.div_s)(this.low,this.high,n.low,n.high);return h.fromBits(Y,y.get_high(),this.unsigned)}if(this.isZero())return this.unsigned?h.UZERO:h.ZERO;let w,U,N;if(this.unsigned){if(n.unsigned||(n=n.toUnsigned()),n.gt(this))return h.UZERO;if(n.gt(this.shru(1)))return h.UONE;N=h.UZERO}else{if(this.eq(h.MIN_VALUE))return n.eq(h.ONE)||n.eq(h.NEG_ONE)?h.MIN_VALUE:n.eq(h.MIN_VALUE)?h.ONE:(w=this.shr(1).div(n).shl(1),w.eq(h.ZERO)?n.isNegative()?h.ONE:h.NEG_ONE:(U=this.sub(n.mul(w)),N=w.add(U.div(n)),N));if(n.eq(h.MIN_VALUE))return this.unsigned?h.UZERO:h.ZERO;if(this.isNegative())return n.isNegative()?this.neg().div(n.neg()):this.neg().div(n).neg();if(n.isNegative())return this.div(n.neg()).neg();N=h.ZERO}for(U=this;U.gte(n);){w=Math.max(1,Math.floor(U.toNumber()/n.toNumber()));let Y=Math.ceil(Math.log(w)/Math.LN2),J=Y<=48?1:Math.pow(2,Y-48),R=h.fromNumber(w),W=R.mul(n);for(;W.isNegative()||W.gt(U);)w-=J,R=h.fromNumber(w,this.unsigned),W=R.mul(n);R.isZero()&&(R=h.ONE),N=N.add(R),U=U.sub(W)}return N}equals(n){return h.isLong(n)||(n=h.fromValue(n)),this.unsigned!==n.unsigned&&this.high>>>31===1&&n.high>>>31===1?!1:this.high===n.high&&this.low===n.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(h.MIN_VALUE)?64:this.neg().getNumBitsAbs();let n=this.high!==0?this.high:this.low,w;for(w=31;w>0&&!(n&1<<w);w--);return this.high!==0?w+33:w+1}greaterThan(n){return this.comp(n)>0}greaterThanOrEqual(n){return this.comp(n)>=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(n){return this.comp(n)<0}lessThanOrEqual(n){return this.comp(n)<=0}modulo(n){if(h.isLong(n)||(n=h.fromValue(n)),y){let w=(this.unsigned?y.rem_u:y.rem_s)(this.low,this.high,n.low,n.high);return h.fromBits(w,y.get_high(),this.unsigned)}return this.sub(this.div(n).mul(n))}multiply(n){if(this.isZero())return h.ZERO;if(h.isLong(n)||(n=h.fromValue(n)),y){let Z=y.mul(this.low,this.high,n.low,n.high);return h.fromBits(Z,y.get_high(),this.unsigned)}if(n.isZero())return h.ZERO;if(this.eq(h.MIN_VALUE))return n.isOdd()?h.MIN_VALUE:h.ZERO;if(n.eq(h.MIN_VALUE))return this.isOdd()?h.MIN_VALUE:h.ZERO;if(this.isNegative())return n.isNegative()?this.neg().mul(n.neg()):this.neg().mul(n).neg();if(n.isNegative())return this.mul(n.neg()).neg();if(this.lt(h.TWO_PWR_24)&&n.lt(h.TWO_PWR_24))return h.fromNumber(this.toNumber()*n.toNumber(),this.unsigned);let w=this.high>>>16,U=this.high&65535,N=this.low>>>16,Y=this.low&65535,J=n.high>>>16,R=n.high&65535,W=n.low>>>16,x=n.low&65535,G=0,M=0,V=0,z=0;return z+=Y*x,V+=z>>>16,z&=65535,V+=N*x,M+=V>>>16,V&=65535,V+=Y*W,M+=V>>>16,V&=65535,M+=U*x,G+=M>>>16,M&=65535,M+=N*W,G+=M>>>16,M&=65535,M+=Y*R,G+=M>>>16,M&=65535,G+=w*x+U*W+N*R+Y*J,G&=65535,h.fromBits(V<<16|z,G<<16|M,this.unsigned)}negate(){return!this.unsigned&&this.eq(h.MIN_VALUE)?h.MIN_VALUE:this.not().add(h.ONE)}not(){return h.fromBits(~this.low,~this.high,this.unsigned)}notEquals(n){return!this.equals(n)}or(n){return h.isLong(n)||(n=h.fromValue(n)),h.fromBits(this.low|n.low,this.high|n.high,this.unsigned)}shiftLeft(n){return h.isLong(n)&&(n=n.toInt()),(n&=63)===0?this:n<32?h.fromBits(this.low<<n,this.high<<n|this.low>>>32-n,this.unsigned):h.fromBits(0,this.low<<n-32,this.unsigned)}shiftRight(n){return h.isLong(n)&&(n=n.toInt()),(n&=63)===0?this:n<32?h.fromBits(this.low>>>n|this.high<<32-n,this.high>>n,this.unsigned):h.fromBits(this.high>>n-32,this.high>=0?0:-1,this.unsigned)}shiftRightUnsigned(n){if(h.isLong(n)&&(n=n.toInt()),n&=63,n===0)return this;{let w=this.high;if(n<32){let U=this.low;return h.fromBits(U>>>n|w<<32-n,w>>>n,this.unsigned)}else return n===32?h.fromBits(w,0,this.unsigned):h.fromBits(w>>>n-32,0,this.unsigned)}}subtract(n){return h.isLong(n)||(n=h.fromValue(n)),this.add(n.neg())}toInt(){return this.unsigned?this.low>>>0:this.low}toNumber(){return this.unsigned?(this.high>>>0)*f+(this.low>>>0):this.high*f+(this.low>>>0)}toBigInt(){return BigInt(this.toString())}toBytes(n){return n?this.toBytesLE():this.toBytesBE()}toBytesLE(){let n=this.high,w=this.low;return[w&255,w>>>8&255,w>>>16&255,w>>>24,n&255,n>>>8&255,n>>>16&255,n>>>24]}toBytesBE(){let n=this.high,w=this.low;return[n>>>24,n>>>16&255,n>>>8&255,n&255,w>>>24,w>>>16&255,w>>>8&255,w&255]}toSigned(){return this.unsigned?h.fromBits(this.low,this.high,!1):this}toString(n){if(n=n||10,n<2||36<n)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative())if(this.eq(h.MIN_VALUE)){let Y=h.fromNumber(n),J=this.div(Y),R=J.mul(Y).sub(this);return J.toString(n)+R.toInt().toString(n)}else return"-"+this.neg().toString(n);let w=h.fromNumber(Math.pow(n,6),this.unsigned),U=this,N="";for(;;){let Y=U.div(w),R=(U.sub(Y.mul(w)).toInt()>>>0).toString(n);if(U=Y,U.isZero())return R+N;for(;R.length<6;)R="0"+R;N=""+R+N}}toUnsigned(){return this.unsigned?this:h.fromBits(this.low,this.high,!0)}xor(n){return h.isLong(n)||(n=h.fromValue(n)),h.fromBits(this.low^n.low,this.high^n.high,this.unsigned)}toExtendedJSON(n){return n&&n.relaxed?this.toNumber():{$numberLong:this.toString()}}static fromExtendedJSON(n,w){let U=h.fromString(n.$numberLong);return w&&w.relaxed?U.toNumber():U}}e.Long=h,h.TWO_PWR_24=h.fromInt(l),h.MAX_UNSIGNED_VALUE=h.fromBits(-1,-1,!0),h.ZERO=h.fromInt(0),h.UZERO=h.fromInt(0,!0),h.ONE=h.fromInt(1),h.UONE=h.fromInt(1,!0),h.NEG_ONE=h.fromInt(-1),h.MAX_VALUE=h.fromBits(-1,2147483647,!1),h.MIN_VALUE=h.fromBits(0,-2147483648,!1),Object.defineProperty(h.prototype,"__isLong__",{value:!0}),Object.defineProperty(h.prototype,"_bsontype",{value:"Long"})});st(K);var kr=K.Long,dt=ot(function(B,e){Object.defineProperty(e,"__esModule",{value:!0}),e.Decimal128=void 0;let y=/^(\+|-)?(\d+|(\d*\.\d*))?(E|e)?([-+])?(\d+)?$/,D=/^(\+|-)?(Infinity|inf)$/i,l=/^(\+|-)?NaN$/i,f=6111,u=-6176,E=6176,o=34,c=[124,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0].reverse(),h=[248,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0].reverse(),p=[120,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0].reverse(),n=/^([-+])?(\d+)?$/,w=31,U=16383,N=30,Y=31;function J(V){return!isNaN(parseInt(V,10))}function R(V){let z=K.Long.fromNumber(1e9),Z=K.Long.fromNumber(0);if(!V.parts[0]&&!V.parts[1]&&!V.parts[2]&&!V.parts[3])return{quotient:V,rem:Z};for(let s=0;s<=3;s++)Z=Z.shiftLeft(32),Z=Z.add(new K.Long(V.parts[s],0)),V.parts[s]=Z.div(z).low,Z=Z.modulo(z);return{quotient:V,rem:Z}}function W(V,z){if(!V&&!z)return{high:K.Long.fromNumber(0),low:K.Long.fromNumber(0)};let Z=V.shiftRightUnsigned(32),s=new K.Long(V.getLowBits(),0),A=z.shiftRightUnsigned(32),O=new K.Long(z.getLowBits(),0),i=Z.multiply(A),m=Z.multiply(O),b=s.multiply(A),j=s.multiply(O);return i=i.add(m.shiftRightUnsigned(32)),m=new K.Long(m.getLowBits(),0).add(b).add(j.shiftRightUnsigned(32)),i=i.add(m.shiftRightUnsigned(32)),j=m.shiftLeft(32).add(new K.Long(j.getLowBits(),0)),{high:i,low:j}}function x(V,z){let Z=V.high>>>0,s=z.high>>>0;if(Z<s)return!0;if(Z===s){let A=V.low>>>0,O=z.low>>>0;if(A<O)return!0}return!1}function G(V,z){throw new TypeError(`"${V}" is not a valid Decimal128 string - ${z}`)}class M{constructor(z){this.bytes=z}static fromString(z){let Z=!1,s=!1,A=!1,O=0,i=0,m=0,b=0,j=0,F=[0],g=0,$=0,L=0,T=0,d=0,q=0,X=new K.Long(0,0),et=new K.Long(0,0),Bt=0,k=0;if(z.length>=7e3)throw new TypeError(""+z+" not a valid Decimal128 string");let lt=z.match(y),re=z.match(D),Ft=z.match(l);if(!lt&&!re&&!Ft||z.length===0)throw new TypeError(""+z+" not a valid Decimal128 string");if(lt){let nt=lt[2],a=lt[4],t=lt[5],r=lt[6];a&&r===void 0&&G(z,"missing exponent power"),a&&nt===void 0&&G(z,"missing exponent base"),a===void 0&&(t||r)&&G(z,"missing e before exponent")}if((z[k]==="+"||z[k]==="-")&&(Z=z[k++]==="-"),!J(z[k])&&z[k]!=="."){if(z[k]==="i"||z[k]==="I")return new M(C.Buffer.from(Z?h:p));if(z[k]==="N")return new M(C.Buffer.from(c))}for(;J(z[k])||z[k]===".";){if(z[k]==="."){s&&G(z,"contains multiple periods"),s=!0,k=k+1;continue}g<34&&(z[k]!=="0"||A)&&(A||(j=i),A=!0,F[$++]=parseInt(z[k],10),g=g+1),A&&(m=m+1),s&&(b=b+1),i=i+1,k=k+1}if(s&&!i)throw new TypeError(""+z+" not a valid Decimal128 string");if(z[k]==="e"||z[k]==="E"){let nt=z.substr(++k).match(n);if(!nt||!nt[2])return new M(C.Buffer.from(c));d=parseInt(nt[0],10),k=k+nt[0].length}if(z[k])return new M(C.Buffer.from(c));if(L=0,!g)L=0,T=0,F[0]=0,m=1,g=1,O=0;else if(T=g-1,O=m,O!==1)for(;z[j+O-1]==="0";)O=O-1;for(d<=b&&b-d>1<<14?d=u:d=d-b;d>f;){if(T=T+1,T-L>o){if(F.join("").match(/^0+$/)){d=f;break}G(z,"overflow")}d=d-1}for(;d<u||g<m;){if(T===0&&O<g){d=u,O=0;break}if(g<m?m=m-1:T=T-1,d<f)d=d+1;else{if(F.join("").match(/^0+$/)){d=f;break}G(z,"overflow")}}if(T-L+1<O){let nt=i;s&&(j=j+1,nt=nt+1),Z&&(j=j+1,nt=nt+1);let a=parseInt(z[j+T+1],10),t=0;if(a>=5&&(t=1,a===5)){for(t=F[T]%2===1?1:0,q=j+T+2;q<nt;q++)if(parseInt(z[q],10)){t=1;break}}if(t){let r=T;for(;r>=0;r--)if(++F[r]>9&&(F[r]=0,r===0))if(d<f)d=d+1,F[r]=1;else return new M(C.Buffer.from(Z?h:p))}}if(X=K.Long.fromNumber(0),et=K.Long.fromNumber(0),O===0)X=K.Long.fromNumber(0),et=K.Long.fromNumber(0);else if(T-L<17){let nt=L;for(et=K.Long.fromNumber(F[nt++]),X=new K.Long(0,0);nt<=T;nt++)et=et.multiply(K.Long.fromNumber(10)),et=et.add(K.Long.fromNumber(F[nt]))}else{let nt=L;for(X=K.Long.fromNumber(F[nt++]);nt<=T-17;nt++)X=X.multiply(K.Long.fromNumber(10)),X=X.add(K.Long.fromNumber(F[nt]));for(et=K.Long.fromNumber(F[nt++]);nt<=T;nt++)et=et.multiply(K.Long.fromNumber(10)),et=et.add(K.Long.fromNumber(F[nt]))}let ht=W(X,K.Long.fromString("100000000000000000"));ht.low=ht.low.add(et),x(ht.low,et)&&(ht.high=ht.high.add(K.Long.fromNumber(1))),Bt=d+E;let Q={low:K.Long.fromNumber(0),high:K.Long.fromNumber(0)};ht.high.shiftRightUnsigned(49).and(K.Long.fromNumber(1)).equals(K.Long.fromNumber(1))?(Q.high=Q.high.or(K.Long.fromNumber(3).shiftLeft(61)),Q.high=Q.high.or(K.Long.fromNumber(Bt).and(K.Long.fromNumber(16383).shiftLeft(47))),Q.high=Q.high.or(ht.high.and(K.Long.fromNumber(0x7fffffffffff)))):(Q.high=Q.high.or(K.Long.fromNumber(Bt&16383).shiftLeft(49)),Q.high=Q.high.or(ht.high.and(K.Long.fromNumber(562949953421311)))),Q.low=ht.low,Z&&(Q.high=Q.high.or(K.Long.fromString("9223372036854775808")));let ut=C.Buffer.alloc(16);return k=0,ut[k++]=Q.low.low&255,ut[k++]=Q.low.low>>8&255,ut[k++]=Q.low.low>>16&255,ut[k++]=Q.low.low>>24&255,ut[k++]=Q.low.high&255,ut[k++]=Q.low.high>>8&255,ut[k++]=Q.low.high>>16&255,ut[k++]=Q.low.high>>24&255,ut[k++]=Q.high.low&255,ut[k++]=Q.high.low>>8&255,ut[k++]=Q.high.low>>16&255,ut[k++]=Q.high.low>>24&255,ut[k++]=Q.high.high&255,ut[k++]=Q.high.high>>8&255,ut[k++]=Q.high.high>>16&255,ut[k++]=Q.high.high>>24&255,new M(ut)}toString(){let z,Z=0,s=new Array(36);for(let k=0;k<s.length;k++)s[k]=0;let A=0,O=!1,i,m={parts:[0,0,0,0]},b,j,F=[];A=0;let g=this.bytes,$=g[A++]|g[A++]<<8|g[A++]<<16|g[A++]<<24,L=g[A++]|g[A++]<<8|g[A++]<<16|g[A++]<<24,T=g[A++]|g[A++]<<8|g[A++]<<16|g[A++]<<24,d=g[A++]|g[A++]<<8|g[A++]<<16|g[A++]<<24;A=0,{low:new K.Long($,L),high:new K.Long(T,d)}.high.lessThan(K.Long.ZERO)&&F.push("-");let X=d>>26&w;if(X>>3===3){if(X===N)return F.join("")+"Infinity";if(X===Y)return"NaN";z=d>>15&U,i=8+(d>>14&1)}else i=d>>14&7,z=d>>17&U;let et=z-E;if(m.parts[0]=(d&16383)+((i&15)<<14),m.parts[1]=T,m.parts[2]=L,m.parts[3]=$,m.parts[0]===0&&m.parts[1]===0&&m.parts[2]===0&&m.parts[3]===0)O=!0;else for(j=3;j>=0;j--){let k=0,lt=R(m);if(m=lt.quotient,k=lt.rem.low,!!k)for(b=8;b>=0;b--)s[j*9+b]=k%10,k=Math.floor(k/10)}if(O)Z=1,s[A]=0;else for(Z=36;!s[A];)Z=Z-1,A=A+1;let Bt=Z-1+et;if(Bt>=34||Bt<=-7||et>0){if(Z>34)return F.push(`${0}`),et>0?F.push("E+"+et):et<0&&F.push("E"+et),F.join("");F.push(`${s[A++]}`),Z=Z-1,Z&&F.push(".");for(let k=0;k<Z;k++)F.push(`${s[A++]}`);F.push("E"),Bt>0?F.push("+"+Bt):F.push(`${Bt}`)}else if(et>=0)for(let k=0;k<Z;k++)F.push(`${s[A++]}`);else{let k=Z+et;if(k>0)for(let lt=0;lt<k;lt++)F.push(`${s[A++]}`);else F.push("0");for(F.push(".");k++<0;)F.push("0");for(let lt=0;lt<Z-Math.max(k-1,0);lt++)F.push(`${s[A++]}`)}return F.join("")}toJSON(){return{$numberDecimal:this.toString()}}toExtendedJSON(){return{$numberDecimal:this.toString()}}static fromExtendedJSON(z){return M.fromString(z.$numberDecimal)}}e.Decimal128=M,Object.defineProperty(M.prototype,"_bsontype",{value:"Decimal128"})});st(dt);var Kr=dt.Decimal128,It=ot(function(B,e){Object.defineProperty(e,"__esModule",{value:!0}),e.Double=void 0;class y{constructor(l){l instanceof Number&&(l=l.valueOf()),this.value=+l}valueOf(){return this.value}toJSON(){return this.value}toExtendedJSON(l){if(l&&(l.legacy||l.relaxed&&isFinite(this.value)))return this.value;if(Object.is(Math.sign(this.value),-0))return{$numberDouble:`-${this.value.toFixed(1)}`};let f;return Number.isInteger(this.value)?(f=this.value.toFixed(1),f.length>=13&&(f=this.value.toExponential(13).toUpperCase())):f=this.value.toString(),{$numberDouble:f}}static fromExtendedJSON(l,f){let u=parseFloat(l.$numberDouble);return f&&f.relaxed?u:new y(u)}}e.Double=y,Object.defineProperty(y.prototype,"_bsontype",{value:"Double"})});st(It);var Hr=It.Double,bt=ot(function(B,e){Object.defineProperty(e,"__esModule",{value:!0}),e.Int32=void 0;class y{constructor(l){l instanceof Number&&(l=l.valueOf()),this.value=+l}valueOf(){return this.value}toJSON(){return this.value}toExtendedJSON(l){return l&&(l.relaxed||l.legacy)?this.value:{$numberInt:this.value.toString()}}static fromExtendedJSON(l,f){return f&&f.relaxed?parseInt(l.$numberInt,10):new y(l.$numberInt)}}e.Int32=y,Object.defineProperty(y.prototype,"_bsontype",{value:"Int32"})});st(bt);var Gr=bt.Int32,$t=ot(function(B,e){Object.defineProperty(e,"__esModule",{value:!0}),e.Map=void 0;let y;e.Map=y;let D=function(u){return u&&u.Math==Math&&u};function l(){return D(typeof globalThis=="object"&&globalThis)||D(typeof window=="object"&&window)||D(typeof self=="object"&&self)||D(typeof Ht=="object"&&Ht)||Function("return this")()}let f=l();Object.prototype.hasOwnProperty.call(f,"Map")?e.Map=y=f.Map:e.Map=y=class{constructor(E=[]){this._keys=[],this._values={};for(let o=0;o<E.length;o++){if(E[o]==null)continue;let c=E[o],h=c[0],p=c[1];this._keys.push(h),this._values[h]={v:p,i:this._keys.length-1}}}clear(){this._keys=[],this._values={}}delete(E){let o=this._values[E];return o==null?!1:(delete this._values[E],this._keys.splice(o.i,1),!0)}entries(){let E=0;return{next:()=>{let o=this._keys[E++];return{value:o!==void 0?[o,this._values[o].v]:void 0,done:o===void 0}}}}forEach(E,o){o=o||this;for(let c=0;c<this._keys.length;c++){let h=this._keys[c];E.call(o,this._values[h].v,h,o)}}get(E){return this._values[E]?this._values[E].v:void 0}has(E){return this._values[E]!=null}keys(){let E=0;return{next:()=>{let o=this._keys[E++];return{value:o!==void 0?o:void 0,done:o===void 0}}}}set(E,o){return this._values[E]?(this._values[E].v=o,this):(this._keys.push(E),this._values[E]={v:o,i:this._keys.length-1},this)}values(){let E=0;return{next:()=>{let o=this._keys[E++];return{value:o!==void 0?this._values[o].v:void 0,done:o===void 0}}}}get size(){return this._keys.length}}});st($t);var Zr=$t.Map,Rt=ot(function(B,e){Object.defineProperty(e,"__esModule",{value:!0}),e.MaxKey=void 0;class y{toExtendedJSON(){return{$maxKey:1}}static fromExtendedJSON(){return new y}}e.MaxKey=y,Object.defineProperty(y.prototype,"_bsontype",{value:"MaxKey"})});st(Rt);var qr=Rt.MaxKey,Ut=ot(function(B,e){Object.defineProperty(e,"__esModule",{value:!0}),e.MinKey=void 0;class y{toExtendedJSON(){return{$minKey:1}}static fromExtendedJSON(){return new y}}e.MinKey=y,Object.defineProperty(y.prototype,"_bsontype",{value:"MinKey"})});st(Ut);var Qr=Ut.MinKey,St=ot(function(B,e){Object.defineProperty(e,"__esModule",{value:!0}),e.ObjectId=void 0;let y=rt.randomBytes(5),D=new RegExp("^[0-9a-fA-F]{24}$"),l=[];for(let h=0;h<256;h++)l[h]=(h<=15?"0":"")+h.toString(16);let f=[],u=0;for(;u<10;)f[48+u]=u++;for(;u<16;)f[65-10+u]=f[97-10+u]=u++;let E=Symbol("id");class o{constructor(p){if(p instanceof o&&(this[E]=p.id,this.__id=p.__id),typeof p=="object"&&p&&"id"in p&&("toHexString"in p&&typeof p.toHexString=="function"?this[E]=C.Buffer.from(p.toHexString(),"hex"):this[E]=typeof p.id=="string"?C.Buffer.from(p.id):p.id),(p==null||typeof p=="number")&&(this[E]=o.generate(typeof p=="number"?p:void 0),o.cacheHexString&&(this.__id=this.id.toString("hex"))),ArrayBuffer.isView(p)&&p.byteLength===12&&(this[E]=mt.ensureBuffer(p)),typeof p=="string")if(p.length===12){let n=C.Buffer.from(p);n.byteLength===12&&(this[E]=n)}else if(p.length===24&&D.test(p))this[E]=C.Buffer.from(p,"hex");else throw new TypeError("Argument passed in must be a Buffer or string of 12 bytes or a string of 24 hex characters");o.cacheHexString&&(this.__id=this.id.toString("hex"))}get id(){return this[E]}set id(p){this[E]=p,o.cacheHexString&&(this.__id=p.toString("hex"))}get generationTime(){return this.id.readInt32BE(0)}set generationTime(p){this.id.writeUInt32BE(p,0)}toHexString(){if(o.cacheHexString&&this.__id)return this.__id;let p=this.id.toString("hex");return o.cacheHexString&&!this.__id&&(this.__id=p),p}static getInc(){return o.index=(o.index+1)%16777215}static generate(p){typeof p!="number"&&(p=~~(Date.now()/1e3));let n=o.getInc(),w=C.Buffer.alloc(12);return w.writeUInt32BE(p,0),w[4]=y[0],w[5]=y[1],w[6]=y[2],w[7]=y[3],w[8]=y[4],w[11]=n&255,w[10]=n>>8&255,w[9]=n>>16&255,w}toString(p){return p?this.id.toString(p):this.toHexString()}toJSON(){return this.toHexString()}equals(p){return p==null?!1:p instanceof o?this.toString()===p.toString():typeof p=="string"&&o.isValid(p)&&p.length===12&&this.id instanceof C.Buffer?p===this.id.toString("binary"):typeof p=="string"&&o.isValid(p)&&p.length===24?p.toLowerCase()===this.toHexString():typeof p=="string"&&o.isValid(p)&&p.length===12?C.Buffer.from(p).equals(this.id):typeof p=="object"&&"toHexString"in p&&typeof p.toHexString=="function"?p.toHexString()===this.toHexString():!1}getTimestamp(){let p=new Date,n=this.id.readUInt32BE(0);return p.setTime(Math.floor(n)*1e3),p}static createPk(){return new o}static createFromTime(p){let n=C.Buffer.from([0,0,0,0,0,0,0,0,0,0,0,0]);return n.writeUInt32BE(p,0),new o(n)}static createFromHexString(p){if(typeof p>"u"||p!=null&&p.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 o(C.Buffer.from(p,"hex"))}static isValid(p){return p==null?!1:typeof p=="number"?!0:typeof p=="string"?p.length===12||p.length===24&&D.test(p):p instanceof o||p instanceof C.Buffer&&p.length===12?!0:typeof p=="object"&&"toHexString"in p&&typeof p.toHexString=="function"?typeof p.id=="string"?p.id.length===12:p.toHexString().length===24&&D.test(p.id.toString("hex")):!1}toExtendedJSON(){return this.toHexString?{$oid:this.toHexString()}:{$oid:this.toString("hex")}}static fromExtendedJSON(p){return new o(p.$oid)}}e.ObjectId=o,o.index=~~(Math.random()*16777215),Object.defineProperty(o.prototype,"generate",{value:rt.deprecate(h=>o.generate(h),"Please use the static `ObjectId.generate(time)` instead")}),Object.defineProperty(o.prototype,"getInc",{value:rt.deprecate(()=>o.getInc(),"Please use the static `ObjectId.getInc()` instead")}),Object.defineProperty(o.prototype,"get_inc",{value:rt.deprecate(()=>o.getInc(),"Please use the static `ObjectId.getInc()` instead")}),Object.defineProperty(o,"get_inc",{value:rt.deprecate(()=>o.getInc(),"Please use the static `ObjectId.getInc()` instead")});let c=Symbol.for("nodejs.util.inspect.custom");Object.defineProperty(o.prototype,c,o.prototype.toString),Object.defineProperty(o.prototype,"inspect",o.prototype.toString),Object.defineProperty(o.prototype,"_bsontype",{value:"ObjectID"})});st(St);var xr=St.ObjectId,I=ot(function(B,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});st(I);var $r=I.BSON_BINARY_SUBTYPE_USER_DEFINED,tn=I.BSON_BINARY_SUBTYPE_MD5,en=I.BSON_BINARY_SUBTYPE_UUID_NEW,rn=I.BSON_BINARY_SUBTYPE_UUID,nn=I.BSON_BINARY_SUBTYPE_BYTE_ARRAY,on=I.BSON_BINARY_SUBTYPE_FUNCTION,sn=I.BSON_BINARY_SUBTYPE_DEFAULT,fn=I.BSON_DATA_MAX_KEY,an=I.BSON_DATA_MIN_KEY,un=I.BSON_DATA_DECIMAL128,ln=I.BSON_DATA_LONG,cn=I.BSON_DATA_TIMESTAMP,hn=I.BSON_DATA_INT,_n=I.BSON_DATA_CODE_W_SCOPE,yn=I.BSON_DATA_SYMBOL,Bn=I.BSON_DATA_CODE,Nn=I.BSON_DATA_DBPOINTER,gn=I.BSON_DATA_REGEXP,pn=I.BSON_DATA_NULL,On=I.BSON_DATA_DATE,Sn=I.BSON_DATA_BOOLEAN,An=I.BSON_DATA_OID,En=I.BSON_DATA_UNDEFINED,mn=I.BSON_DATA_BINARY,wn=I.BSON_DATA_ARRAY,Tn=I.BSON_DATA_OBJECT,In=I.BSON_DATA_STRING,bn=I.BSON_DATA_NUMBER,Dn=I.JS_INT_MIN,dn=I.JS_INT_MAX,Rn=I.BSON_INT64_MIN,Un=I.BSON_INT64_MAX,Mn=I.BSON_INT32_MIN,Pn=I.BSON_INT32_MAX,Be=ot(function(B,e){Object.defineProperty(e,"__esModule",{value:!0}),e.calculateObjectSize=void 0;function y(l,f,u){let E=5;if(Array.isArray(l))for(let o=0;o<l.length;o++)E+=D(o.toString(),l[o],f,!0,u);else{l.toBSON&&(l=l.toBSON());for(let o in l)E+=D(o,l[o],f,!1,u)}return E}e.calculateObjectSize=y;function D(l,f,u=!1,E=!1,o=!1){switch(f&&f.toBSON&&(f=f.toBSON()),typeof f){case"string":return 1+C.Buffer.byteLength(l,"utf8")+1+4+C.Buffer.byteLength(f,"utf8")+1;case"number":return Math.floor(f)===f&&f>=I.JS_INT_MIN&&f<=I.JS_INT_MAX&&f>=I.BSON_INT32_MIN&&f<=I.BSON_INT32_MAX?(l!=null?C.Buffer.byteLength(l,"utf8")+1:0)+(4+1):(l!=null?C.Buffer.byteLength(l,"utf8")+1:0)+(8+1);case"undefined":return E||!o?(l!=null?C.Buffer.byteLength(l,"utf8")+1:0)+1:0;case"boolean":return(l!=null?C.Buffer.byteLength(l,"utf8")+1:0)+(1+1);case"object":if(f==null||f._bsontype==="MinKey"||f._bsontype==="MaxKey")return(l!=null?C.Buffer.byteLength(l,"utf8")+1:0)+1;if(f._bsontype==="ObjectId"||f._bsontype==="ObjectID")return(l!=null?C.Buffer.byteLength(l,"utf8")+1:0)+(12+1);if(f instanceof Date||rt.isDate(f))return(l!=null?C.Buffer.byteLength(l,"utf8")+1:0)+(8+1);if(ArrayBuffer.isView(f)||f instanceof ArrayBuffer)return(l!=null?C.Buffer.byteLength(l,"utf8")+1:0)+(1+4+1)+f.byteLength;if(f._bsontype==="Long"||f._bsontype==="Double"||f._bsontype==="Timestamp")return(l!=null?C.Buffer.byteLength(l,"utf8")+1:0)+(8+1);if(f._bsontype==="Decimal128")return(l!=null?C.Buffer.byteLength(l,"utf8")+1:0)+(16+1);if(f._bsontype==="Code")return f.scope!=null&&Object.keys(f.scope).length>0?(l!=null?C.Buffer.byteLength(l,"utf8")+1:0)+1+4+4+C.Buffer.byteLength(f.code.toString(),"utf8")+1+y(f.scope,u,o):(l!=null?C.Buffer.byteLength(l,"utf8")+1:0)+1+4+C.Buffer.byteLength(f.code.toString(),"utf8")+1;if(f._bsontype==="Binary")return f.sub_type===_t.Binary.SUBTYPE_BYTE_ARRAY?(l!=null?C.Buffer.byteLength(l,"utf8")+1:0)+(f.position+1+4+1+4):(l!=null?C.Buffer.byteLength(l,"utf8")+1:0)+(f.position+1+4+1);if(f._bsontype==="Symbol")return(l!=null?C.Buffer.byteLength(l,"utf8")+1:0)+C.Buffer.byteLength(f.value,"utf8")+4+1+1;if(f._bsontype==="DBRef"){let c=Object.assign({$ref:f.collection,$id:f.oid},f.fields);return f.db!=null&&(c.$db=f.db),(l!=null?C.Buffer.byteLength(l,"utf8")+1:0)+1+y(c,u,o)}else return f instanceof RegExp||Object.prototype.toString.call(f)==="[object RegExp]"?(l!=null?C.Buffer.byteLength(l,"utf8")+1:0)+1+C.Buffer.byteLength(f.source,"utf8")+1+(f.global?1:0)+(f.ignoreCase?1:0)+(f.multiline?1:0)+1:f._bsontype==="BSONRegExp"?(l!=null?C.Buffer.byteLength(l,"utf8")+1:0)+1+C.Buffer.byteLength(f.pattern,"utf8")+1+C.Buffer.byteLength(f.options,"utf8")+1:(l!=null?C.Buffer.byteLength(l,"utf8")+1:0)+y(f,u,o)+1;case"function":if(f instanceof RegExp||Object.prototype.toString.call(f)==="[object RegExp]"||String.call(f)==="[object RegExp]")return(l!=null?C.Buffer.byteLength(l,"utf8")+1:0)+1+C.Buffer.byteLength(f.source,"utf8")+1+(f.global?1:0)+(f.ignoreCase?1:0)+(f.multiline?1:0)+1;if(u&&f.scope!=null&&Object.keys(f.scope).length>0)return(l!=null?C.Buffer.byteLength(l,"utf8")+1:0)+1+4+4+C.Buffer.byteLength(rt.normalizedFunctionString(f),"utf8")+1+y(f.scope,u,o);if(u)return(l!=null?C.Buffer.byteLength(l,"utf8")+1:0)+1+4+C.Buffer.byteLength(rt.normalizedFunctionString(f),"utf8")+1}return 0}});st(Be);var jn=Be.calculateObjectSize,At=ot(function(B,e){Object.defineProperty(e,"__esModule",{value:!0}),e.BSONRegExp=void 0;function y(l){return l.split("").sort().join("")}class D{constructor(f,u){this.pattern=f,this.options=u??"",y(this.options);for(let E=0;E<this.options.length;E++)if(!(this.options[E]==="i"||this.options[E]==="m"||this.options[E]==="x"||this.options[E]==="l"||this.options[E]==="s"||this.options[E]==="u"))throw new Error(`The regular expression option [${this.options[E]}] is not supported`)}static parseOptions(f){return f?f.split("").sort().join(""):""}toExtendedJSON(f){return f=f||{},f.legacy?{$regex:this.pattern,$options:this.options}:{$regularExpression:{pattern:this.pattern,options:this.options}}}static fromExtendedJSON(f){if("$regex"in f)if(typeof f.$regex!="string"){if(f.$regex._bsontype==="BSONRegExp")return f}else return new D(f.$regex,D.parseOptions(f.$options));if("$regularExpression"in f)return new D(f.$regularExpression.pattern,D.parseOptions(f.$regularExpression.options));throw new TypeError(`Unexpected BSONRegExp EJSON object form: ${JSON.stringify(f)}`)}}e.BSONRegExp=D,Object.defineProperty(D.prototype,"_bsontype",{value:"BSONRegExp"})});st(At);var Yn=At.BSONRegExp,Mt=ot(function(B,e){Object.defineProperty(e,"__esModule",{value:!0}),e.BSONSymbol=void 0;class y{constructor(l){this.value=l}valueOf(){return this.value}toString(){return this.value}inspect(){return this.value}toJSON(){return this.value}toExtendedJSON(){return{$symbol:this.value}}static fromExtendedJSON(l){return new y(l.$symbol)}}e.BSONSymbol=y,Object.defineProperty(y.prototype,"_bsontype",{value:"Symbol"})});st(Mt);var vn=Mt.BSONSymbol,wt=ot(function(B,e){Object.defineProperty(e,"__esModule",{value:!0}),e.Timestamp=e.LongWithoutOverridesClass=void 0,e.LongWithoutOverridesClass=K.Long;class y extends e.LongWithoutOverridesClass{constructor(l,f){K.Long.isLong(l)?super(l.low,l.high,!0):super(l,f,!0),Object.defineProperty(this,"_bsontype",{value:"Timestamp",writable:!1,configurable:!1,enumerable:!1})}toJSON(){return{$timestamp:this.toString()}}static fromInt(l){return new y(K.Long.fromInt(l,!0))}static fromNumber(l){return new y(K.Long.fromNumber(l,!0))}static fromBits(l,f){return new y(l,f)}static fromString(l,f){return new y(K.Long.fromString(l,!0,f))}toExtendedJSON(){return{$timestamp:{t:this.high>>>0,i:this.low>>>0}}}static fromExtendedJSON(l){return new y(l.$timestamp.i,l.$timestamp.t)}}e.Timestamp=y,y.MAX_VALUE=K.Long.MAX_UNSIGNED_VALUE});st(wt);var Fn=wt.Timestamp,Ln=wt.LongWithoutOverridesClass,Vt=ot(function(B,e){Object.defineProperty(e,"__esModule",{value:!0}),e.validateUtf8=void 0;let y=128,D=192,l=224,f=240,u=248,E=192,o=224,c=240,h=128;function p(n,w,U){let N=0;for(let Y=w;Y<U;Y+=1){let J=n[Y];if(N){if((J&D)!==h)return!1;N-=1}else if(J&y)if((J&l)===E)N=1;else if((J&f)===o)N=2;else if((J&u)===c)N=3;else return!1}return!N}e.validateUtf8=p});st(Vt);var Cn=Vt.validateUtf8,Zt=ot(function(B,e){Object.defineProperty(e,"__esModule",{value:!0}),e.deserialize=void 0;let y=K.Long.fromNumber(I.JS_INT_MAX),D=K.Long.fromNumber(I.JS_INT_MIN),l={};function f(o,c,h){c=c??{};let p=c&&c.index?c.index:0,n=o[p]|o[p+1]<<8|o[p+2]<<16|o[p+3]<<24;if(n<5)throw new Error(`bson size must be >= 5, is ${n}`);if(c.allowObjectSmallerThanBufferSize&&o.length<n)throw new Error(`buffer length ${o.length} must be >= bson size ${n}`);if(!c.allowObjectSmallerThanBufferSize&&o.length!==n)throw new Error(`buffer length ${o.length} must === bson size ${n}`);if(n+p>o.byteLength)throw new Error(`(bson size ${n} + options.index ${p} must be <= buffer length ${o.byteLength})`);if(o[p+n-1]!==0)throw new Error("One object, sized correctly, with a spot for an EOO, but the EOO isn't 0x00");return u(o,p,c,h)}e.deserialize=f;function u(o,c,h,p=!1){let n=h.evalFunctions==null?!1:h.evalFunctions,w=h.cacheFunctions==null?!1:h.cacheFunctions,U=h.fieldsAsRaw==null?null:h.fieldsAsRaw,N=h.raw==null?!1:h.raw,Y=typeof h.bsonRegExp=="boolean"?h.bsonRegExp:!1,J=h.promoteBuffers==null?!1:h.promoteBuffers,R=h.promoteLongs==null?!0:h.promoteLongs,W=h.promoteValues==null?!0:h.promoteValues,x=c;if(o.length<5)throw new Error("corrupt bson message < 5 bytes long");let G=o[c++]|o[c++]<<8|o[c++]<<16|o[c++]<<24;if(G<5||G>o.length)throw new Error("corrupt bson message");let M=p?[]:{},V=0,z=!1;for(;!z;){let A=o[c++];if(A===0)break;let O=c;for(;o[O]!==0&&O<o.length;)O++;if(O>=o.byteLength)throw new Error("Bad BSON Document: illegal CString");let i=p?V++:o.toString("utf8",c,O);if(c=O+1,A===I.BSON_DATA_STRING){let m=o[c++]|o[c++]<<8|o[c++]<<16|o[c++]<<24;if(m<=0||m>o.length-c||o[c+m-1]!==0)throw new Error("bad string length in bson");if(!Vt.validateUtf8(o,c,c+m-1))throw new Error("Invalid UTF-8 string in BSON document");let b=o.toString("utf8",c,c+m-1);M[i]=b,c=c+m}else if(A===I.BSON_DATA_OID){let m=C.Buffer.alloc(12);o.copy(m,0,c,c+12),M[i]=new St.ObjectId(m),c=c+12}else if(A===I.BSON_DATA_INT&&W===!1)M[i]=new bt.Int32(o[c++]|o[c++]<<8|o[c++]<<16|o[c++]<<24);else if(A===I.BSON_DATA_INT)M[i]=o[c++]|o[c++]<<8|o[c++]<<16|o[c++]<<24;else if(A===I.BSON_DATA_NUMBER&&W===!1)M[i]=new It.Double(o.readDoubleLE(c)),c=c+8;else if(A===I.BSON_DATA_NUMBER)M[i]=o.readDoubleLE(c),c=c+8;else if(A===I.BSON_DATA_DATE){let m=o[c++]|o[c++]<<8|o[c++]<<16|o[c++]<<24,b=o[c++]|o[c++]<<8|o[c++]<<16|o[c++]<<24;M[i]=new Date(new K.Long(m,b).toNumber())}else if(A===I.BSON_DATA_BOOLEAN){if(o[c]!==0&&o[c]!==1)throw new Error("illegal boolean type value");M[i]=o[c++]===1}else if(A===I.BSON_DATA_OBJECT){let m=c,b=o[c]|o[c+1]<<8|o[c+2]<<16|o[c+3]<<24;if(b<=0||b>o.length-c)throw new Error("bad embedded document length in bson");N?M[i]=o.slice(c,c+b):M[i]=u(o,m,h,!1),c=c+b}else if(A===I.BSON_DATA_ARRAY){let m=c,b=o[c]|o[c+1]<<8|o[c+2]<<16|o[c+3]<<24,j=h,F=c+b;if(U&&U[i]){j={};for(let g in h)j[g]=h[g];j.raw=!0}if(M[i]=u(o,m,j,!0),c=c+b,o[c-1]!==0)throw new Error("invalid array terminator byte");if(c!==F)throw new Error("corrupted array bson")}else if(A===I.BSON_DATA_UNDEFINED)M[i]=void 0;else if(A===I.BSON_DATA_NULL)M[i]=null;else if(A===I.BSON_DATA_LONG){let m=o[c++]|o[c++]<<8|o[c++]<<16|o[c++]<<24,b=o[c++]|o[c++]<<8|o[c++]<<16|o[c++]<<24,j=new K.Long(m,b);R&&W===!0?M[i]=j.lessThanOrEqual(y)&&j.greaterThanOrEqual(D)?j.toNumber():j:M[i]=j}else if(A===I.BSON_DATA_DECIMAL128){let m=C.Buffer.alloc(16);o.copy(m,0,c,c+16),c=c+16;let b=new dt.Decimal128(m);"toObject"in b&&typeof b.toObject=="function"?M[i]=b.toObject():M[i]=b}else if(A===I.BSON_DATA_BINARY){let m=o[c++]|o[c++]<<8|o[c++]<<16|o[c++]<<24,b=m,j=o[c++];if(m<0)throw new Error("Negative binary type element size found");if(m>o.byteLength)throw new Error("Binary type size larger than document size");if(o.slice!=null){if(j===_t.Binary.SUBTYPE_BYTE_ARRAY){if(m=o[c++]|o[c++]<<8|o[c++]<<16|o[c++]<<24,m<0)throw new Error("Negative binary type element size found for subtype 0x02");if(m>b-4)throw new Error("Binary type with subtype 0x02 contains too long binary size");if(m<b-4)throw new Error("Binary type with subtype 0x02 contains too short binary size")}J&&W?M[i]=o.slice(c,c+m):M[i]=new _t.Binary(o.slice(c,c+m),j)}else{let F=C.Buffer.alloc(m);if(j===_t.Binary.SUBTYPE_BYTE_ARRAY){if(m=o[c++]|o[c++]<<8|o[c++]<<16|o[c++]<<24,m<0)throw new Error("Negative binary type element size found for subtype 0x02");if(m>b-4)throw new Error("Binary type with subtype 0x02 contains too long binary size");if(m<b-4)throw new Error("Binary type with subtype 0x02 contains too short binary size")}for(O=0;O<m;O++)F[O]=o[c+O];J&&W?M[i]=F:M[i]=new _t.Binary(F,j)}c=c+m}else if(A===I.BSON_DATA_REGEXP&&Y===!1){for(O=c;o[O]!==0&&O<o.length;)O++;if(O>=o.length)throw new Error("Bad BSON Document: illegal CString");let m=o.toString("utf8",c,O);for(c=O+1,O=c;o[O]!==0&&O<o.length;)O++;if(O>=o.length)throw new Error("Bad BSON Document: illegal CString");let b=o.toString("utf8",c,O);c=O+1;let j=new Array(b.length);for(O=0;O<b.length;O++)switch(b[O]){case"m":j[O]="m";break;case"s":j[O]="g";break;case"i":j[O]="i";break}M[i]=new RegExp(m,j.join(""))}else if(A===I.BSON_DATA_REGEXP&&Y===!0){for(O=c;o[O]!==0&&O<o.length;)O++;if(O>=o.length)throw new Error("Bad BSON Document: illegal CString");let m=o.toString("utf8",c,O);for(c=O+1,O=c;o[O]!==0&&O<o.length;)O++;if(O>=o.length)throw new Error("Bad BSON Document: illegal CString");let b=o.toString("utf8",c,O);c=O+1,M[i]=new At.BSONRegExp(m,b)}else if(A===I.BSON_DATA_SYMBOL){let m=o[c++]|o[c++]<<8|o[c++]<<16|o[c++]<<24;if(m<=0||m>o.length-c||o[c+m-1]!==0)throw new Error("bad string length in bson");let b=o.toString("utf8",c,c+m-1);M[i]=W?b:new Mt.BSONSymbol(b),c=c+m}else if(A===I.BSON_DATA_TIMESTAMP){let m=o[c++]|o[c++]<<8|o[c++]<<16|o[c++]<<24,b=o[c++]|o[c++]<<8|o[c++]<<16|o[c++]<<24;M[i]=new wt.Timestamp(m,b)}else if(A===I.BSON_DATA_MIN_KEY)M[i]=new Ut.MinKey;else if(A===I.BSON_DATA_MAX_KEY)M[i]=new Rt.MaxKey;else if(A===I.BSON_DATA_CODE){let m=o[c++]|o[c++]<<8|o[c++]<<16|o[c++]<<24;if(m<=0||m>o.length-c||o[c+m-1]!==0)throw new Error("bad string length in bson");let b=o.toString("utf8",c,c+m-1);n?w?M[i]=E(b,l,M):M[i]=E(b):M[i]=new Et.Code(b),c=c+m}else if(A===I.BSON_DATA_CODE_W_SCOPE){let m=o[c++]|o[c++]<<8|o[c++]<<16|o[c++]<<24;if(m<4+4+4+1)throw new Error("code_w_scope total size shorter minimum expected length");let b=o[c++]|o[c++]<<8|o[c++]<<16|o[c++]<<24;if(b<=0||b>o.length-c||o[c+b-1]!==0)throw new Error("bad string length in bson");let j=o.toString("utf8",c,c+b-1);c=c+b;let F=c,g=o[c]|o[c+1]<<8|o[c+2]<<16|o[c+3]<<24,$=u(o,F,h,!1);if(c=c+g,m<4+4+g+b)throw new Error("code_w_scope total size is too short, truncating scope");if(m>4+4+g+b)throw new Error("code_w_scope total size is too long, clips outer document");n?(w?M[i]=E(j,l,M):M[i]=E(j),M[i].scope=$):M[i]=new Et.Code(j,$)}else if(A===I.BSON_DATA_DBPOINTER){let m=o[c++]|o[c++]<<8|o[c++]<<16|o[c++]<<24;if(m<=0||m>o.length-c||o[c+m-1]!==0)throw new Error("bad string length in bson");if(!Vt.validateUtf8(o,c,c+m-1))throw new Error("Invalid UTF-8 string in BSON document");let b=o.toString("utf8",c,c+m-1);c=c+m;let j=C.Buffer.alloc(12);o.copy(j,0,c,c+12);let F=new St.ObjectId(j);c=c+12,M[i]=new Nt.DBRef(b,F)}else throw new Error("Detected unknown BSON type "+A.toString(16)+' for fieldname "'+i+'"')}if(G!==c-x)throw p?new Error("corrupt array bson"):new Error("corrupt object bson");let Z=Object.keys(M).filter(A=>A.startsWith("$")),s=!0;if(Z.forEach(A=>{["$ref","$id","$db"].indexOf(A)===-1&&(s=!1)}),!s)return M;if(Nt.isDBRefLike(M)){let A=Object.assign({},M);return delete A.$ref,delete A.$id,delete A.$db,new Nt.DBRef(M.$ref,M.$id,M.$db,A)}return M}function E(o,c,h){return c?(c[o]==null&&(c[o]=new Function(o)),c[o].bind(h)):new Function(o)}});st(Zt);var zn=Zt.deserialize,Yt=ot(function(B,e){Object.defineProperty(e,"__esModule",{value:!0}),e.EJSON=e.isBSONType=void 0;function y(N){return rt.isObjectLike(N)&&Reflect.has(N,"_bsontype")&&typeof N._bsontype=="string"}e.isBSONType=y;let D=2147483647,l=-2147483648,f=9223372036854776e3,u=-9223372036854776e3,E={$oid:St.ObjectId,$binary:_t.Binary,$uuid:_t.Binary,$symbol:Mt.BSONSymbol,$numberInt:bt.Int32,$numberDecimal:dt.Decimal128,$numberDouble:It.Double,$numberLong:K.Long,$minKey:Ut.MinKey,$maxKey:Rt.MaxKey,$regex:At.BSONRegExp,$regularExpression:At.BSONRegExp,$timestamp:wt.Timestamp};function o(N,Y={}){if(typeof N=="number"){if(Y.relaxed||Y.legacy)return N;if(Math.floor(N)===N){if(N>=l&&N<=D)return new bt.Int32(N);if(N>=u&&N<=f)return K.Long.fromNumber(N)}return new It.Double(N)}if(N==null||typeof N!="object")return N;if(N.$undefined)return null;let J=Object.keys(N).filter(R=>R.startsWith("$")&&N[R]!=null);for(let R=0;R<J.length;R++){let W=E[J[R]];if(W)return W.fromExtendedJSON(N,Y)}if(N.$date!=null){let R=N.$date,W=new Date;return Y.legacy?typeof R=="number"?W.setTime(R):typeof R=="string"&&W.setTime(Date.parse(R)):typeof R=="string"?W.setTime(Date.parse(R)):K.Long.isLong(R)?W.setTime(R.toNumber()):typeof R=="number"&&Y.relaxed&&W.setTime(R),W}if(N.$code!=null){let R=Object.assign({},N);return N.$scope&&(R.$scope=o(N.$scope)),Et.Code.fromExtendedJSON(N)}if(N.$ref!=null||N.$dbPointer!=null){let R=N.$ref?N:N.$dbPointer;if(R instanceof Nt.DBRef)return R;let W=Object.keys(R).filter(G=>G.startsWith("$")),x=!0;if(W.forEach(G=>{["$ref","$id","$db"].indexOf(G)===-1&&(x=!1)}),x)return Nt.DBRef.fromExtendedJSON(R)}return N}function c(N,Y){return N.map(J=>p(J,Y))}function h(N){let Y=N.toISOString();return N.getUTCMilliseconds()!==0?Y:Y.slice(0,-5)+"Z"}function p(N,Y){if(Array.isArray(N))return c(N,Y);if(N===void 0)return null;if(N instanceof Date){let J=N.getTime(),R=J>-1&&J<2534023188e5;return Y.legacy?Y.relaxed&&R?{$date:N.getTime()}:{$date:h(N)}:Y.relaxed&&R?{$date:h(N)}:{$date:{$numberLong:N.getTime().toString()}}}if(typeof N=="number"&&!Y.relaxed){if(Math.floor(N)===N){let J=N>=l&&N<=D,R=N>=u&&N<=f;if(J)return{$numberInt:N.toString()};if(R)return{$numberLong:N.toString()}}return{$numberDouble:N.toString()}}if(N instanceof RegExp){let J=N.flags;if(J===void 0){let W=N.toString().match(/[gimuy]*$/);W&&(J=W[0])}return new At.BSONRegExp(N.source,J).toExtendedJSON(Y)}return N!=null&&typeof N=="object"?w(N,Y):N}let n={Binary:N=>new _t.Binary(N.value(),N.sub_type),Code:N=>new Et.Code(N.code,N.scope),DBRef:N=>new Nt.DBRef(N.collection||N.namespace,N.oid,N.db,N.fields),Decimal128:N=>new dt.Decimal128(N.bytes),Double:N=>new It.Double(N.value),Int32:N=>new bt.Int32(N.value),Long:N=>K.Long.fromBits(N.low!=null?N.low:N.low_,N.low!=null?N.high:N.high_,N.low!=null?N.unsigned:N.unsigned_),MaxKey:()=>new Rt.MaxKey,MinKey:()=>new Ut.MinKey,ObjectID:N=>new St.ObjectId(N),ObjectId:N=>new St.ObjectId(N),BSONRegExp:N=>new At.BSONRegExp(N.pattern,N.options),Symbol:N=>new Mt.BSONSymbol(N.value),Timestamp:N=>wt.Timestamp.fromBits(N.low,N.high)};function w(N,Y){if(N==null||typeof N!="object")throw new Error("not an object instance");let J=N._bsontype;if(typeof J>"u"){let R={};for(let W in N)R[W]=p(N[W],Y);return R}else if(y(N)){let R=N;if(typeof R.toExtendedJSON!="function"){let W=n[N._bsontype];if(!W)throw new TypeError("Unrecognized or invalid _bsontype: "+N._bsontype);R=W(R)}return J==="Code"&&R.scope?R=new Et.Code(R.code,p(R.scope,Y)):J==="DBRef"&&R.oid&&(R=new Nt.DBRef(R.collection,p(R.oid,Y),R.db,R.fields)),R.toExtendedJSON(Y)}else throw new Error("_bsontype must be a string, but was: "+typeof J)}var U;(function(N){function Y(x,G){let M=Object.assign({},{relaxed:!0,legacy:!1},G);return typeof M.relaxed=="boolean"&&(M.strict=!M.relaxed),typeof M.strict=="boolean"&&(M.relaxed=!M.strict),JSON.parse(x,(V,z)=>o(z,M))}N.parse=Y;function J(x,G,M,V){M!=null&&typeof M=="object"&&(V=M,M=0),G!=null&&typeof G=="object"&&!Array.isArray(G)&&(V=G,G=void 0,M=0),V=Object.assign({},{relaxed:!0,legacy:!1},V);let z=p(x,V);return JSON.stringify(z,G,M)}N.stringify=J;function R(x,G){return G=G||{},JSON.parse(J(x,G))}N.serialize=R;function W(x,G){return G=G||{},Y(JSON.stringify(x),G)}N.deserialize=W})(U=e.EJSON||(e.EJSON={}))});st(Yt);var Jn=Yt.EJSON,Wn=Yt.isBSONType,jt=ot(function(B,e){Object.defineProperty(e,"__esModule",{value:!0}),e.writeIEEE754=e.readIEEE754=void 0;function y(l,f,u,E,o){let c,h,p=u==="big",n=o*8-E-1,w=(1<<n)-1,U=w>>1,N=-7,Y=p?0:o-1,J=p?1:-1,R=l[f+Y];for(Y+=J,c=R&(1<<-N)-1,R>>=-N,N+=n;N>0;c=c*256+l[f+Y],Y+=J,N-=8);for(h=c&(1<<-N)-1,c>>=-N,N+=E;N>0;h=h*256+l[f+Y],Y+=J,N-=8);if(c===0)c=1-U;else{if(c===w)return h?NaN:(R?-1:1)*(1/0);h=h+Math.pow(2,E),c=c-U}return(R?-1:1)*h*Math.pow(2,c-E)}e.readIEEE754=y;function D(l,f,u,E,o,c){let h,p,n,w=E==="big",U=c*8-o-1,N=(1<<U)-1,Y=N>>1,J=o===23?Math.pow(2,-24)-Math.pow(2,-77):0,R=w?c-1:0,W=w?-1:1,x=f<0||f===0&&1/f<0?1:0;for(f=Math.abs(f),isNaN(f)||f===1/0?(p=isNaN(f)?1:0,h=N):(h=Math.floor(Math.log(f)/Math.LN2),f*(n=Math.pow(2,-h))<1&&(h--,n*=2),h+Y>=1?f+=J/n:f+=J*Math.pow(2,1-Y),f*n>=2&&(h++,n/=2),h+Y>=N?(p=0,h=N):h+Y>=1?(p=(f*n-1)*Math.pow(2,o),h=h+Y):(p=f*Math.pow(2,Y-1)*Math.pow(2,o),h=0)),isNaN(f)&&(p=0);o>=8;)l[u+R]=p&255,R+=W,p/=256,o-=8;for(h=h<<o|p,isNaN(f)&&(h+=8),U+=o;U>0;)l[u+R]=h&255,R+=W,h/=256,U-=8;l[u+R-W]|=x*128}e.writeIEEE754=D});st(jt);var Xn=jt.writeIEEE754,kn=jt.readIEEE754,qt=ot(function(B,e){Object.defineProperty(e,"__esModule",{value:!0}),e.serializeInto=void 0;let y=/\x00/,D=new Set(["$db","$ref","$id","$clusterTime"]);function l(s){return Object.prototype.toString.call(s)==="[object RegExp]"}function f(s,A,O,i,m){s[i++]=I.BSON_DATA_STRING;let b=m?s.write(A,i,void 0,"ascii"):s.write(A,i,void 0,"utf8");i=i+b+1,s[i-1]=0;let j=s.write(O,i+4,void 0,"utf8");return s[i+3]=j+1>>24&255,s[i+2]=j+1>>16&255,s[i+1]=j+1>>8&255,s[i]=j+1&255,i=i+4+j,s[i++]=0,i}function u(s,A,O,i,m){if(Number.isInteger(O)&&O>=I.BSON_INT32_MIN&&O<=I.BSON_INT32_MAX){s[i++]=I.BSON_DATA_INT;let b=m?s.write(A,i,void 0,"ascii"):s.write(A,i,void 0,"utf8");i=i+b,s[i++]=0,s[i++]=O&255,s[i++]=O>>8&255,s[i++]=O>>16&255,s[i++]=O>>24&255}else{s[i++]=I.BSON_DATA_NUMBER;let b=m?s.write(A,i,void 0,"ascii"):s.write(A,i,void 0,"utf8");i=i+b,s[i++]=0,jt.writeIEEE754(s,O,i,"little",52,8),i=i+8}return i}function E(s,A,O,i,m){s[i++]=I.BSON_DATA_NULL;let b=m?s.write(A,i,void 0,"ascii"):s.write(A,i,void 0,"utf8");return i=i+b,s[i++]=0,i}function o(s,A,O,i,m){s[i++]=I.BSON_DATA_BOOLEAN;let b=m?s.write(A,i,void 0,"ascii"):s.write(A,i,void 0,"utf8");return i=i+b,s[i++]=0,s[i++]=O?1:0,i}function c(s,A,O,i,m){s[i++]=I.BSON_DATA_DATE;let b=m?s.write(A,i,void 0,"ascii"):s.write(A,i,void 0,"utf8");i=i+b,s[i++]=0;let j=K.Long.fromNumber(O.getTime()),F=j.getLowBits(),g=j.getHighBits();return s[i++]=F&255,s[i++]=F>>8&255,s[i++]=F>>16&255,s[i++]=F>>24&255,s[i++]=g&255,s[i++]=g>>8&255,s[i++]=g>>16&255,s[i++]=g>>24&255,i}function h(s,A,O,i,m){s[i++]=I.BSON_DATA_REGEXP;let b=m?s.write(A,i,void 0,"ascii"):s.write(A,i,void 0,"utf8");if(i=i+b,s[i++]=0,O.source&&O.source.match(y)!=null)throw Error("value "+O.source+" must not contain null bytes");return i=i+s.write(O.source,i,void 0,"utf8"),s[i++]=0,O.ignoreCase&&(s[i++]=105),O.global&&(s[i++]=115),O.multiline&&(s[i++]=109),s[i++]=0,i}function p(s,A,O,i,m){s[i++]=I.BSON_DATA_REGEXP;let b=m?s.write(A,i,void 0,"ascii"):s.write(A,i,void 0,"utf8");if(i=i+b,s[i++]=0,O.pattern.match(y)!=null)throw Error("pattern "+O.pattern+" must not contain null bytes");return i=i+s.write(O.pattern,i,void 0,"utf8"),s[i++]=0,i=i+s.write(O.options.split("").sort().join(""),i,void 0,"utf8"),s[i++]=0,i}function n(s,A,O,i,m){O===null?s[i++]=I.BSON_DATA_NULL:O._bsontype==="MinKey"?s[i++]=I.BSON_DATA_MIN_KEY:s[i++]=I.BSON_DATA_MAX_KEY;let b=m?s.write(A,i,void 0,"ascii"):s.write(A,i,void 0,"utf8");return i=i+b,s[i++]=0,i}function w(s,A,O,i,m){s[i++]=I.BSON_DATA_OID;let b=m?s.write(A,i,void 0,"ascii"):s.write(A,i,void 0,"utf8");if(i=i+b,s[i++]=0,typeof O.id=="string")s.write(O.id,i,void 0,"binary");else if(O.id&&O.id.copy)O.id.copy(s,i,0,12);else throw new TypeError("object ["+JSON.stringify(O)+"] is not a valid ObjectId");return i+12}function U(s,A,O,i,m){s[i++]=I.BSON_DATA_BINARY;let b=m?s.write(A,i,void 0,"ascii"):s.write(A,i,void 0,"utf8");i=i+b,s[i++]=0;let j=O.length;return s[i++]=j&255,s[i++]=j>>8&255,s[i++]=j>>16&255,s[i++]=j>>24&255,s[i++]=I.BSON_BINARY_SUBTYPE_DEFAULT,s.set(mt.ensureBuffer(O),i),i=i+j,i}function N(s,A,O,i,m=!1,b=0,j=!1,F=!0,g=!1,$=[]){for(let d=0;d<$.length;d++)if($[d]===O)throw new Error("cyclic dependency detected");$.push(O),s[i++]=Array.isArray(O)?I.BSON_DATA_ARRAY:I.BSON_DATA_OBJECT;let L=g?s.write(A,i,void 0,"ascii"):s.write(A,i,void 0,"utf8");i=i+L,s[i++]=0;let T=Z(s,O,m,i,b+1,j,F,$);return $.pop(),T}function Y(s,A,O,i,m){s[i++]=I.BSON_DATA_DECIMAL128;let b=m?s.write(A,i,void 0,"ascii"):s.write(A,i,void 0,"utf8");return i=i+b,s[i++]=0,O.bytes.copy(s,i,0,16),i+16}function J(s,A,O,i,m){s[i++]=O._bsontype==="Long"?I.BSON_DATA_LONG:I.BSON_DATA_TIMESTAMP;let b=m?s.write(A,i,void 0,"ascii"):s.write(A,i,void 0,"utf8");i=i+b,s[i++]=0;let j=O.getLowBits(),F=O.getHighBits();return s[i++]=j&255,s[i++]=j>>8&255,s[i++]=j>>16&255,s[i++]=j>>24&255,s[i++]=F&255,s[i++]=F>>8&255,s[i++]=F>>16&255,s[i++]=F>>24&255,i}function R(s,A,O,i,m){O=O.valueOf(),s[i++]=I.BSON_DATA_INT;let b=m?s.write(A,i,void 0,"ascii"):s.write(A,i,void 0,"utf8");return i=i+b,s[i++]=0,s[i++]=O&255,s[i++]=O>>8&255,s[i++]=O>>16&255,s[i++]=O>>24&255,i}function W(s,A,O,i,m){s[i++]=I.BSON_DATA_NUMBER;let b=m?s.write(A,i,void 0,"ascii"):s.write(A,i,void 0,"utf8");return i=i+b,s[i++]=0,jt.writeIEEE754(s,O.value,i,"little",52,8),i=i+8,i}function x(s,A,O,i,m=!1,b=0,j){s[i++]=I.BSON_DATA_CODE;let F=j?s.write(A,i,void 0,"ascii"):s.write(A,i,void 0,"utf8");i=i+F,s[i++]=0;let g=rt.normalizedFunctionString(O),$=s.write(g,i+4,void 0,"utf8")+1;return s[i]=$&255,s[i+1]=$>>8&255,s[i+2]=$>>16&255,s[i+3]=$>>24&255,i=i+4+$-1,s[i++]=0,i}function G(s,A,O,i,m=!1,b=0,j=!1,F=!0,g=!1){if(O.scope&&typeof O.scope=="object"){s[i++]=I.BSON_DATA_CODE_W_SCOPE;let $=g?s.write(A,i,void 0,"ascii"):s.write(A,i,void 0,"utf8");i=i+$,s[i++]=0;let L=i,T=typeof O.code=="string"?O.code:O.code.toString();i=i+4;let d=s.write(T,i+4,void 0,"utf8")+1;s[i]=d&255,s[i+1]=d>>8&255,s[i+2]=d>>16&255,s[i+3]=d>>24&255,s[i+4+d-1]=0,i=i+d+4;let q=Z(s,O.scope,m,i,b+1,j,F);i=q-1;let X=q-L;s[L++]=X&255,s[L++]=X>>8&255,s[L++]=X>>16&255,s[L++]=X>>24&255,s[i++]=0}else{s[i++]=I.BSON_DATA_CODE;let $=g?s.write(A,i,void 0,"ascii"):s.write(A,i,void 0,"utf8");i=i+$,s[i++]=0;let L=O.code.toString(),T=s.write(L,i+4,void 0,"utf8")+1;s[i]=T&255,s[i+1]=T>>8&255,s[i+2]=T>>16&255,s[i+3]=T>>24&255,i=i+4+T-1,s[i++]=0}return i}function M(s,A,O,i,m){s[i++]=I.BSON_DATA_BINARY;let b=m?s.write(A,i,void 0,"ascii"):s.write(A,i,void 0,"utf8");i=i+b,s[i++]=0;let j=O.value(!0),F=O.position;return O.sub_type===_t.Binary.SUBTYPE_BYTE_ARRAY&&(F=F+4),s[i++]=F&255,s[i++]=F>>8&255,s[i++]=F>>16&255,s[i++]=F>>24&255,s[i++]=O.sub_type,O.sub_type===_t.Binary.SUBTYPE_BYTE_ARRAY&&(F=F-4,s[i++]=F&255,s[i++]=F>>8&255,s[i++]=F>>16&255,s[i++]=F>>24&255),s.set(j,i),i=i+O.position,i}function V(s,A,O,i,m){s[i++]=I.BSON_DATA_SYMBOL;let b=m?s.write(A,i,void 0,"ascii"):s.write(A,i,void 0,"utf8");i=i+b,s[i++]=0;let j=s.write(O.value,i+4,void 0,"utf8")+1;return s[i]=j&255,s[i+1]=j>>8&255,s[i+2]=j>>16&255,s[i+3]=j>>24&255,i=i+4+j-1,s[i++]=0,i}function z(s,A,O,i,m,b,j){s[i++]=I.BSON_DATA_OBJECT;let F=j?s.write(A,i,void 0,"ascii"):s.write(A,i,void 0,"utf8");i=i+F,s[i++]=0;let g=i,$={$ref:O.collection||O.namespace,$id:O.oid};O.db!=null&&($.$db=O.db),$=Object.assign($,O.fields);let L=Z(s,$,!1,i,m+1,b),T=L-g;return s[g++]=T&255,s[g++]=T>>8&255,s[g++]=T>>16&255,s[g++]=T>>24&255,L}function Z(s,A,O=!1,i=0,m=0,b=!1,j=!0,F=[]){i=i||0,F=F||[],F.push(A);let g=i+4;if(Array.isArray(A))for(let L=0;L<A.length;L++){let T=""+L,d=A[L];if(d&&d.toBSON){if(typeof d.toBSON!="function")throw new TypeError("toBSON is not a function");d=d.toBSON()}if(typeof d=="string")g=f(s,T,d,g,!0);else if(typeof d=="number")g=u(s,T,d,g,!0);else{if(typeof d=="bigint")throw new TypeError("Unsupported type BigInt, please use Decimal128");if(typeof d=="boolean")g=o(s,T,d,g,!0);else if(d instanceof Date||rt.isDate(d))g=c(s,T,d,g,!0);else if(d===void 0)g=E(s,T,d,g,!0);else if(d===null)g=E(s,T,d,g,!0);else if(d._bsontype==="ObjectId"||d._bsontype==="ObjectID")g=w(s,T,d,g,!0);else if(C.Buffer.isBuffer(d)||rt.isUint8Array(d))g=U(s,T,d,g,!0);else if(d instanceof RegExp||l(d))g=h(s,T,d,g,!0);else if(typeof d=="object"&&d._bsontype==null)g=N(s,T,d,g,O,m,b,j,!0,F);else if(typeof d=="object"&&Yt.isBSONType(d)&&d._bsontype==="Decimal128")g=Y(s,T,d,g,!0);else if(d._bsontype==="Long"||d._bsontype==="Timestamp")g=J(s,T,d,g,!0);else if(d._bsontype==="Double")g=W(s,T,d,g,!0);else if(typeof d=="function"&&b)g=x(s,T,d,g,O,m,!0);else if(d._bsontype==="Code")g=G(s,T,d,g,O,m,b,j,!0);else if(d._bsontype==="Binary")g=M(s,T,d,g,!0);else if(d._bsontype==="Symbol")g=V(s,T,d,g,!0);else if(d._bsontype==="DBRef")g=z(s,T,d,g,m,b,!0);else if(d._bsontype==="BSONRegExp")g=p(s,T,d,g,!0);else if(d._bsontype==="Int32")g=R(s,T,d,g,!0);else if(d._bsontype==="MinKey"||d._bsontype==="MaxKey")g=n(s,T,d,g,!0);else if(typeof d._bsontype<"u")throw new TypeError("Unrecognized or invalid _bsontype: "+d._bsontype)}}else if(A instanceof $t.Map){let L=A.entries(),T=!1;for(;!T;){let d=L.next();if(T=!!d.done,T)continue;let q=d.value[0],X=d.value[1],et=typeof X;if(typeof q=="string"&&!D.has(q)){if(q.match(y)!=null)throw Error("key "+q+" must not contain null bytes");if(O){if(q[0]==="$")throw Error("key "+q+" must not start with '$'");if(~q.indexOf("."))throw Error("key "+q+" must not contain '.'")}}if(et==="string")g=f(s,q,X,g);else if(et==="number")g=u(s,q,X,g);else{if(et==="bigint"||rt.isBigInt64Array(X)||rt.isBigUInt64Array(X))throw new TypeError("Unsupported type BigInt, please use Decimal128");if(et==="boolean")g=o(s,q,X,g);else if(X instanceof Date||rt.isDate(X))g=c(s,q,X,g);else if(X===null||X===void 0&&j===!1)g=E(s,q,X,g);else if(X._bsontype==="ObjectId"||X._bsontype==="ObjectID")g=w(s,q,X,g);else if(C.Buffer.isBuffer(X)||rt.isUint8Array(X))g=U(s,q,X,g);else if(X instanceof RegExp||l(X))g=h(s,q,X,g);else if(et==="object"&&X._bsontype==null)g=N(s,q,X,g,O,m,b,j,!1,F);else if(et==="object"&&X._bsontype==="Decimal128")g=Y(s,q,X,g);else if(X._bsontype==="Long"||X._bsontype==="Timestamp")g=J(s,q,X,g);else if(X._bsontype==="Double")g=W(s,q,X,g);else if(X._bsontype==="Code")g=G(s,q,X,g,O,m,b,j);else if(typeof X=="function"&&b)g=x(s,q,X,g,O,m,b);else if(X._bsontype==="Binary")g=M(s,q,X,g);else if(X._bsontype==="Symbol")g=V(s,q,X,g);else if(X._bsontype==="DBRef")g=z(s,q,X,g,m,b);else if(X._bsontype==="BSONRegExp")g=p(s,q,X,g);else if(X._bsontype==="Int32")g=R(s,q,X,g);else if(X._bsontype==="MinKey"||X._bsontype==="MaxKey")g=n(s,q,X,g);else if(typeof X._bsontype<"u")throw new TypeError("Unrecognized or invalid _bsontype: "+X._bsontype)}}}else{if(A.toBSON){if(typeof A.toBSON!="function")throw new TypeError("toBSON is not a function");if(A=A.toBSON(),A!=null&&typeof A!="object")throw new TypeError("toBSON function did not return an object")}for(let L in A){let T=A[L];if(T&&T.toBSON){if(typeof T.toBSON!="function")throw new TypeError("toBSON is not a function");T=T.toBSON()}let d=typeof T;if(typeof L=="string"&&!D.has(L)){if(L.match(y)!=null)throw Error("key "+L+" must not contain null bytes");if(O){if(L[0]==="$")throw Error("key "+L+" must not start with '$'");if(~L.indexOf("."))throw Error("key "+L+" must not contain '.'")}}if(d==="string")g=f(s,L,T,g);else if(d==="number")g=u(s,L,T,g);else{if(d==="bigint")throw new TypeError("Unsupported type BigInt, please use Decimal128");if(d==="boolean")g=o(s,L,T,g);else if(T instanceof Date||rt.isDate(T))g=c(s,L,T,g);else if(T===void 0)j===!1&&(g=E(s,L,T,g));else if(T===null)g=E(s,L,T,g);else if(T._bsontype==="ObjectId"||T._bsontype==="ObjectID")g=w(s,L,T,g);else if(C.Buffer.isBuffer(T)||rt.isUint8Array(T))g=U(s,L,T,g);else if(T instanceof RegExp||l(T))g=h(s,L,T,g);else if(d==="object"&&T._bsontype==null)g=N(s,L,T,g,O,m,b,j,!1,F);else if(d==="object"&&T._bsontype==="Decimal128")g=Y(s,L,T,g);else if(T._bsontype==="Long"||T._bsontype==="Timestamp")g=J(s,L,T,g);else if(T._bsontype==="Double")g=W(s,L,T,g);else if(T._bsontype==="Code")g=G(s,L,T,g,O,m,b,j);else if(typeof T=="function"&&b)g=x(s,L,T,g,O,m,b);else if(T._bsontype==="Binary")g=M(s,L,T,g);else if(T._bsontype==="Symbol")g=V(s,L,T,g);else if(T._bsontype==="DBRef")g=z(s,L,T,g,m,b);else if(T._bsontype==="BSONRegExp")g=p(s,L,T,g);else if(T._bsontype==="Int32")g=R(s,L,T,g);else if(T._bsontype==="MinKey"||T._bsontype==="MaxKey")g=n(s,L,T,g);else if(typeof T._bsontype<"u")throw new TypeError("Unrecognized or invalid _bsontype: "+T._bsontype)}}}F.pop(),s[g++]=0;let $=g-i;return s[i++]=$&255,s[i++]=$>>8&255,s[i++]=$>>16&255,s[i++]=$>>24&255,g}e.serializeInto=Z});st(qt);var Kn=qt.serializeInto,H=ot(function(B,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 _t.Binary}}),Object.defineProperty(e,"Code",{enumerable:!0,get:function(){return Et.Code}}),Object.defineProperty(e,"DBRef",{enumerable:!0,get:function(){return Nt.DBRef}}),Object.defineProperty(e,"Decimal128",{enumerable:!0,get:function(){return dt.Decimal128}}),Object.defineProperty(e,"Double",{enumerable:!0,get:function(){return It.Double}}),Object.defineProperty(e,"Int32",{enumerable:!0,get:function(){return bt.Int32}}),Object.defineProperty(e,"Long",{enumerable:!0,get:function(){return K.Long}}),Object.defineProperty(e,"Map",{enumerable:!0,get:function(){return $t.Map}}),Object.defineProperty(e,"MaxKey",{enumerable:!0,get:function(){return Rt.MaxKey}}),Object.defineProperty(e,"MinKey",{enumerable:!0,get:function(){return Ut.MinKey}}),Object.defineProperty(e,"ObjectId",{enumerable:!0,get:function(){return St.ObjectId}}),Object.defineProperty(e,"ObjectID",{enumerable:!0,get:function(){return St.ObjectId}}),Object.defineProperty(e,"BSONRegExp",{enumerable:!0,get:function(){return At.BSONRegExp}}),Object.defineProperty(e,"BSONSymbol",{enumerable:!0,get:function(){return Mt.BSONSymbol}}),Object.defineProperty(e,"Timestamp",{enumerable:!0,get:function(){return wt.Timestamp}}),Object.defineProperty(e,"BSON_BINARY_SUBTYPE_BYTE_ARRAY",{enumerable:!0,get:function(){return I.BSON_BINARY_SUBTYPE_BYTE_ARRAY}}),Object.defineProperty(e,"BSON_BINARY_SUBTYPE_DEFAULT",{enumerable:!0,get:function(){return I.BSON_BINARY_SUBTYPE_DEFAULT}}),Object.defineProperty(e,"BSON_BINARY_SUBTYPE_FUNCTION",{enumerable:!0,get:function(){return I.BSON_BINARY_SUBTYPE_FUNCTION}}),Object.defineProperty(e,"BSON_BINARY_SUBTYPE_MD5",{enumerable:!0,get:function(){return I.BSON_BINARY_SUBTYPE_MD5}}),Object.defineProperty(e,"BSON_BINARY_SUBTYPE_USER_DEFINED",{enumerable:!0,get:function(){return I.BSON_BINARY_SUBTYPE_USER_DEFINED}}),Object.defineProperty(e,"BSON_BINARY_SUBTYPE_UUID",{enumerable:!0,get:function(){return I.BSON_BINARY_SUBTYPE_UUID}}),Object.defineProperty(e,"BSON_BINARY_SUBTYPE_UUID_NEW",{enumerable:!0,get:function(){return I.BSON_BINARY_SUBTYPE_UUID_NEW}}),Object.defineProperty(e,"BSON_DATA_ARRAY",{enumerable:!0,get:function(){return I.BSON_DATA_ARRAY}}),Object.defineProperty(e,"BSON_DATA_BINARY",{enumerable:!0,get:function(){return I.BSON_DATA_BINARY}}),Object.defineProperty(e,"BSON_DATA_BOOLEAN",{enumerable:!0,get:function(){return I.BSON_DATA_BOOLEAN}}),Object.defineProperty(e,"BSON_DATA_CODE",{enumerable:!0,get:function(){return I.BSON_DATA_CODE}}),Object.defineProperty(e,"BSON_DATA_CODE_W_SCOPE",{enumerable:!0,get:function(){return I.BSON_DATA_CODE_W_SCOPE}}),Object.defineProperty(e,"BSON_DATA_DATE",{enumerable:!0,get:function(){return I.BSON_DATA_DATE}}),Object.defineProperty(e,"BSON_DATA_DBPOINTER",{enumerable:!0,get:function(){return I.BSON_DATA_DBPOINTER}}),Object.defineProperty(e,"BSON_DATA_DECIMAL128",{enumerable:!0,get:function(){return I.BSON_DATA_DECIMAL128}}),Object.defineProperty(e,"BSON_DATA_INT",{enumerable:!0,get:function(){return I.BSON_DATA_INT}}),Object.defineProperty(e,"BSON_DATA_LONG",{enumerable:!0,get:function(){return I.BSON_DATA_LONG}}),Object.defineProperty(e,"BSON_DATA_MAX_KEY",{enumerable:!0,get:function(){return I.BSON_DATA_MAX_KEY}}),Object.defineProperty(e,"BSON_DATA_MIN_KEY",{enumerable:!0,get:function(){return I.BSON_DATA_MIN_KEY}}),Object.defineProperty(e,"BSON_DATA_NULL",{enumerable:!0,get:function(){return I.BSON_DATA_NULL}}),Object.defineProperty(e,"BSON_DATA_NUMBER",{enumerable:!0,get:function(){return I.BSON_DATA_NUMBER}}),Object.defineProperty(e,"BSON_DATA_OBJECT",{enumerable:!0,get:function(){return I.BSON_DATA_OBJECT}}),Object.defineProperty(e,"BSON_DATA_OID",{enumerable:!0,get:function(){return I.BSON_DATA_OID}}),Object.defineProperty(e,"BSON_DATA_REGEXP",{enumerable:!0,get:function(){return I.BSON_DATA_REGEXP}}),Object.defineProperty(e,"BSON_DATA_STRING",{enumerable:!0,get:function(){return I.BSON_DATA_STRING}}),Object.defineProperty(e,"BSON_DATA_SYMBOL",{enumerable:!0,get:function(){return I.BSON_DATA_SYMBOL}}),Object.defineProperty(e,"BSON_DATA_TIMESTAMP",{enumerable:!0,get:function(){return I.BSON_DATA_TIMESTAMP}}),Object.defineProperty(e,"BSON_DATA_UNDEFINED",{enumerable:!0,get:function(){return I.BSON_DATA_UNDEFINED}}),Object.defineProperty(e,"BSON_INT32_MAX",{enumerable:!0,get:function(){return I.BSON_INT32_MAX}}),Object.defineProperty(e,"BSON_INT32_MIN",{enumerable:!0,get:function(){return I.BSON_INT32_MIN}}),Object.defineProperty(e,"BSON_INT64_MAX",{enumerable:!0,get:function(){return I.BSON_INT64_MAX}}),Object.defineProperty(e,"BSON_INT64_MIN",{enumerable:!0,get:function(){return I.BSON_INT64_MIN}}),Object.defineProperty(e,"JS_INT_MAX",{enumerable:!0,get:function(){return I.JS_INT_MAX}}),Object.defineProperty(e,"JS_INT_MIN",{enumerable:!0,get:function(){return I.JS_INT_MIN}}),Object.defineProperty(e,"EJSON",{enumerable:!0,get:function(){return Yt.EJSON}});var y=wt;Object.defineProperty(e,"LongWithoutOverridesClass",{enumerable:!0,get:function(){return y.LongWithoutOverridesClass}});let D=1024*1024*17,l=C.Buffer.alloc(D);function f(p){l.length<p&&(l=C.Buffer.alloc(p))}e.setInternalBufferSize=f;function u(p,n={}){let w=typeof n.checkKeys=="boolean"?n.checkKeys:!1,U=typeof n.serializeFunctions=="boolean"?n.serializeFunctions:!1,N=typeof n.ignoreUndefined=="boolean"?n.ignoreUndefined:!0,Y=typeof n.minInternalBufferSize=="number"?n.minInternalBufferSize:D;l.length<Y&&(l=C.Buffer.alloc(Y));let J=qt.serializeInto(l,p,w,0,0,U,N,[]),R=C.Buffer.alloc(J);return l.copy(R,0,0,R.length),R}e.serialize=u;function E(p,n,w={}){let U=typeof w.checkKeys=="boolean"?w.checkKeys:!1,N=typeof w.serializeFunctions=="boolean"?w.serializeFunctions:!1,Y=typeof w.ignoreUndefined=="boolean"?w.ignoreUndefined:!0,J=typeof w.index=="number"?w.index:0,R=qt.serializeInto(l,p,U,0,0,N,Y);return l.copy(n,J,0,R),J+R-1}e.serializeWithBufferAndIndex=E;function o(p,n={}){return Zt.deserialize(mt.ensureBuffer(p),n)}e.deserialize=o;function c(p,n={}){n=n||{};let w=typeof n.serializeFunctions=="boolean"?n.serializeFunctions:!1,U=typeof n.ignoreUndefined=="boolean"?n.ignoreUndefined:!0;return Be.calculateObjectSize(p,w,U)}e.calculateObjectSize=c;function h(p,n,w,U,N,Y){let J=Object.assign({allowObjectSmallerThanBufferSize:!0,index:0},Y),R=mt.ensureBuffer(p),W=n;for(let x=0;x<w;x++){let G=R[W]|R[W+1]<<8|R[W+2]<<16|R[W+3]<<24;J.index=W,U[N+x]=Zt.deserialize(R,J),W=W+G}return W}e.deserializeStream=h}),Hn=st(H),Gn=H.deserializeStream,Vn=H.calculateObjectSize,de=H.deserialize,Zn=H.serializeWithBufferAndIndex,Re=H.serialize,qn=H.setInternalBufferSize,Qn=H.ObjectID,xn=H.Decimal128,$n=H.BSONRegExp,ti=H.MaxKey,ei=H.MinKey,ri=H.Int32,ni=H.Double,ii=H.Timestamp,oi=H.Long,si=H.ObjectId,fi=H.Binary,ai=H.DBRef,ui=H.BSONSymbol,li=H.Map,ci=H.Code,hi=H.LongWithoutOverridesClass,_i=H.EJSON,yi=H.JS_INT_MIN,Bi=H.JS_INT_MAX,Ni=H.BSON_INT64_MIN,gi=H.BSON_INT64_MAX,pi=H.BSON_INT32_MIN,Oi=H.BSON_INT32_MAX,Si=H.BSON_DATA_UNDEFINED,Ai=H.BSON_DATA_TIMESTAMP,Ei=H.BSON_DATA_SYMBOL,mi=H.BSON_DATA_STRING,wi=H.BSON_DATA_REGEXP,Ti=H.BSON_DATA_OID,Ii=H.BSON_DATA_OBJECT,bi=H.BSON_DATA_NUMBER,Di=H.BSON_DATA_NULL,di=H.BSON_DATA_MIN_KEY,Ri=H.BSON_DATA_MAX_KEY,Ui=H.BSON_DATA_LONG,Mi=H.BSON_DATA_INT,Pi=H.BSON_DATA_DECIMAL128,ji=H.BSON_DATA_DBPOINTER,Yi=H.BSON_DATA_DATE,vi=H.BSON_DATA_CODE_W_SCOPE,Fi=H.BSON_DATA_CODE,Li=H.BSON_DATA_BOOLEAN,Ci=H.BSON_DATA_BINARY,zi=H.BSON_DATA_ARRAY,Ji=H.BSON_BINARY_SUBTYPE_UUID_NEW,Wi=H.BSON_BINARY_SUBTYPE_UUID,Xi=H.BSON_BINARY_SUBTYPE_USER_DEFINED,ki=H.BSON_BINARY_SUBTYPE_MD5,Ki=H.BSON_BINARY_SUBTYPE_FUNCTION,Hi=H.BSON_BINARY_SUBTYPE_DEFAULT,Gi=H.BSON_BINARY_SUBTYPE_BYTE_ARRAY;function Ne(B,e){return de(new Uint8Array(B),e)}var te={name:"BSON",id:"bson",module:"bson",extensions:["bson"],mimeTypes:["application/bson"],category:"json",binary:!0};var pr="4.4.0-alpha.0",ee={...te,dataType:null,batchType:null,name:"BSON",id:"bson",module:"bson",version:pr,extensions:["bson"],mimeTypes:["application/bson"],category:"json",binary:!0,parse:Or,parseSync:Sr,options:{bson:{}}};async function Or(B,e){let y={...ee.options.bson,...e?.bson};return Ne(B,y)}function Sr(B,e){let y={...ee.options.bson,...e?.bson};return Ne(B,y)}function ge(B,e){return Re(B).buffer}var Ar="4.4.0-alpha.0",Me={...te,name:"BSON",id:"bson",module:"bson",version:Ar,extensions:["bson"],options:{bson:{}},async encode(B,e){return ge(B,{})},encodeSync(B,e){return ge(B,{})}};return Je(vt);})();
|
|
17
17
|
return __exports__;
|
|
18
18
|
});
|
package/dist/index.cjs
CHANGED
|
@@ -42,9 +42,21 @@ function parseBSONSync(value, options) {
|
|
|
42
42
|
return parsedData;
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
+
// dist/bson-format.js
|
|
46
|
+
var BSONFormat = {
|
|
47
|
+
name: "BSON",
|
|
48
|
+
id: "bson",
|
|
49
|
+
module: "bson",
|
|
50
|
+
extensions: ["bson"],
|
|
51
|
+
mimeTypes: ["application/bson"],
|
|
52
|
+
category: "json",
|
|
53
|
+
binary: true
|
|
54
|
+
};
|
|
55
|
+
|
|
45
56
|
// dist/bson-loader.js
|
|
46
|
-
var VERSION = true ? "4.
|
|
57
|
+
var VERSION = true ? "4.4.0-alpha.0" : "latest";
|
|
47
58
|
var BSONLoader = {
|
|
59
|
+
...BSONFormat,
|
|
48
60
|
dataType: null,
|
|
49
61
|
batchType: null,
|
|
50
62
|
name: "BSON",
|
|
@@ -78,8 +90,9 @@ function encodeBSONSync(value, options) {
|
|
|
78
90
|
}
|
|
79
91
|
|
|
80
92
|
// dist/bson-writer.js
|
|
81
|
-
var VERSION2 = true ? "4.
|
|
93
|
+
var VERSION2 = true ? "4.4.0-alpha.0" : "latest";
|
|
82
94
|
var BSONWriter = {
|
|
95
|
+
...BSONFormat,
|
|
83
96
|
name: "BSON",
|
|
84
97
|
id: "bson",
|
|
85
98
|
module: "bson",
|
package/dist/index.cjs.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["index.js", "lib/parsers/parse-bson.js", "bson-loader.js", "lib/encoders/encode-bson.js", "bson-writer.js"],
|
|
4
|
-
"sourcesContent": ["// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nexport { BSONLoader } from \"./bson-loader.js\";\nexport { BSONWriter } from \"./bson-writer.js\";\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nimport * as BSON from 'bson';\nexport function parseBSONSync(value, options) {\n const parsedData = BSON.deserialize(new Uint8Array(value), options);\n return parsedData;\n}\n", "
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACGA,WAAsB;AACf,SAAS,cAAc,OAAO,SAAS;AAC1C,QAAM,aAAkB,iBAAY,IAAI,WAAW,KAAK,GAAG,OAAO;AAClE,SAAO;AACX;;;ACJA,IAAM,UAAU,
|
|
3
|
+
"sources": ["index.js", "lib/parsers/parse-bson.js", "bson-format.js", "bson-loader.js", "lib/encoders/encode-bson.js", "bson-writer.js"],
|
|
4
|
+
"sourcesContent": ["// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nexport { BSONLoader } from \"./bson-loader.js\";\nexport { BSONWriter } from \"./bson-writer.js\";\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nimport * as BSON from 'bson';\nexport function parseBSONSync(value, options) {\n const parsedData = BSON.deserialize(new Uint8Array(value), options);\n return parsedData;\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nexport const BSONFormat = {\n name: 'BSON',\n id: 'bson',\n module: 'bson',\n extensions: ['bson'],\n mimeTypes: ['application/bson'],\n category: 'json',\n binary: true\n};\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nimport { parseBSONSync } from \"./lib/parsers/parse-bson.js\";\nimport { BSONFormat } from \"./bson-format.js\";\n// __VERSION__ is injected by babel-plugin-version-inline\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\nconst VERSION = typeof \"4.4.0-alpha.0\" !== 'undefined' ? \"4.4.0-alpha.0\" : 'latest';\nexport const BSONLoader = {\n ...BSONFormat,\n dataType: null,\n batchType: null,\n name: 'BSON',\n id: 'bson',\n module: 'bson',\n version: VERSION,\n extensions: ['bson'],\n mimeTypes: ['application/bson'],\n category: 'json',\n binary: true,\n parse,\n parseSync,\n options: {\n bson: {}\n }\n};\nasync function parse(arrayBuffer, options) {\n const bsonOptions = { ...BSONLoader.options.bson, ...options?.bson };\n return parseBSONSync(arrayBuffer, bsonOptions);\n}\nfunction parseSync(arrayBuffer, options) {\n const bsonOptions = { ...BSONLoader.options.bson, ...options?.bson };\n return parseBSONSync(arrayBuffer, bsonOptions);\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nimport * as BSON from 'bson';\nexport function encodeBSONSync(value, options) {\n const uint8Array = BSON.serialize(value);\n // TODO - make sure the uint8array occupies the entire buffer.\n return uint8Array.buffer;\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nimport { encodeBSONSync } from \"./lib/encoders/encode-bson.js\";\nimport { BSONFormat } from \"./bson-format.js\";\n// __VERSION__ is injected by babel-plugin-version-inline\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\nconst VERSION = typeof \"4.4.0-alpha.0\" !== 'undefined' ? \"4.4.0-alpha.0\" : 'latest';\nexport const BSONWriter = {\n ...BSONFormat,\n name: 'BSON',\n id: 'bson',\n module: 'bson',\n version: VERSION,\n extensions: ['bson'],\n options: {\n bson: {}\n },\n async encode(data, options) {\n return encodeBSONSync(data, {}); // options\n },\n encodeSync(data, options) {\n return encodeBSONSync(data, {}); // options\n }\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACGA,WAAsB;AACf,SAAS,cAAc,OAAO,SAAS;AAC1C,QAAM,aAAkB,iBAAY,IAAI,WAAW,KAAK,GAAG,OAAO;AAClE,SAAO;AACX;;;ACJO,IAAM,aAAa;AAAA,EACtB,MAAM;AAAA,EACN,IAAI;AAAA,EACJ,QAAQ;AAAA,EACR,YAAY,CAAC,MAAM;AAAA,EACnB,WAAW,CAAC,kBAAkB;AAAA,EAC9B,UAAU;AAAA,EACV,QAAQ;AACZ;;;ACJA,IAAM,UAAU,OAAyC,kBAAkB;AACpE,IAAM,aAAa;AAAA,EACtB,GAAG;AAAA,EACH,UAAU;AAAA,EACV,WAAW;AAAA,EACX,MAAM;AAAA,EACN,IAAI;AAAA,EACJ,QAAQ;AAAA,EACR,SAAS;AAAA,EACT,YAAY,CAAC,MAAM;AAAA,EACnB,WAAW,CAAC,kBAAkB;AAAA,EAC9B,UAAU;AAAA,EACV,QAAQ;AAAA,EACR;AAAA,EACA;AAAA,EACA,SAAS;AAAA,IACL,MAAM,CAAC;AAAA,EACX;AACJ;AACA,eAAe,MAAM,aAAa,SAAS;AACvC,QAAM,cAAc,EAAE,GAAG,WAAW,QAAQ,MAAM,GAAG,mCAAS,KAAK;AACnE,SAAO,cAAc,aAAa,WAAW;AACjD;AACA,SAAS,UAAU,aAAa,SAAS;AACrC,QAAM,cAAc,EAAE,GAAG,WAAW,QAAQ,MAAM,GAAG,mCAAS,KAAK;AACnE,SAAO,cAAc,aAAa,WAAW;AACjD;;;AC9BA,IAAAA,QAAsB;AACf,SAAS,eAAe,OAAO,SAAS;AAC3C,QAAM,aAAkB,gBAAU,KAAK;AAEvC,SAAO,WAAW;AACtB;;;ACDA,IAAMC,WAAU,OAAyC,kBAAkB;AACpE,IAAM,aAAa;AAAA,EACtB,GAAG;AAAA,EACH,MAAM;AAAA,EACN,IAAI;AAAA,EACJ,QAAQ;AAAA,EACR,SAASA;AAAA,EACT,YAAY,CAAC,MAAM;AAAA,EACnB,SAAS;AAAA,IACL,MAAM,CAAC;AAAA,EACX;AAAA,EACA,MAAM,OAAO,MAAM,SAAS;AACxB,WAAO,eAAe,MAAM,CAAC,CAAC;AAAA,EAClC;AAAA,EACA,WAAW,MAAM,SAAS;AACtB,WAAO,eAAe,MAAM,CAAC,CAAC;AAAA,EAClC;AACJ;",
|
|
6
6
|
"names": ["BSON", "VERSION"]
|
|
7
7
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@loaders.gl/bson",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.4.0-alpha.1",
|
|
4
4
|
"description": "Framework-independent loader for JSON and streaming JSON formats",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -40,14 +40,14 @@
|
|
|
40
40
|
"build-bundle-dev": "ocular-bundle ./bundle.ts --env=dev --output=dist/dist.dev.js"
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@loaders.gl/gis": "4.
|
|
44
|
-
"@loaders.gl/loader-utils": "4.
|
|
45
|
-
"@loaders.gl/schema": "4.
|
|
43
|
+
"@loaders.gl/gis": "4.4.0-alpha.1",
|
|
44
|
+
"@loaders.gl/loader-utils": "4.4.0-alpha.1",
|
|
45
|
+
"@loaders.gl/schema": "4.4.0-alpha.1",
|
|
46
46
|
"@types/bson": "4.2.0",
|
|
47
47
|
"bson": "4.2.0"
|
|
48
48
|
},
|
|
49
49
|
"peerDependencies": {
|
|
50
|
-
"@loaders.gl/core": "
|
|
50
|
+
"@loaders.gl/core": "4.4.0-alpha.0"
|
|
51
51
|
},
|
|
52
|
-
"gitHead": "
|
|
52
|
+
"gitHead": "f1732de45907bd500bf4eedb4803beca8bf4bfb0"
|
|
53
53
|
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
// loaders.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// Copyright (c) vis.gl contributors
|
|
4
|
+
|
|
5
|
+
import type {Format} from '@loaders.gl/loader-utils';
|
|
6
|
+
|
|
7
|
+
export const BSONFormat = {
|
|
8
|
+
name: 'BSON',
|
|
9
|
+
id: 'bson',
|
|
10
|
+
module: 'bson',
|
|
11
|
+
extensions: ['bson'],
|
|
12
|
+
mimeTypes: ['application/bson'],
|
|
13
|
+
category: 'json',
|
|
14
|
+
binary: true
|
|
15
|
+
} as const satisfies Format;
|
package/src/bson-loader.ts
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
// loaders.gl
|
|
2
2
|
// SPDX-License-Identifier: MIT
|
|
3
3
|
// Copyright (c) vis.gl contributors
|
|
4
|
+
|
|
4
5
|
import type {LoaderWithParser, LoaderOptions} from '@loaders.gl/loader-utils';
|
|
5
6
|
import type {ParseBSONOptions} from './lib/parsers/parse-bson';
|
|
6
7
|
import {parseBSONSync} from './lib/parsers/parse-bson';
|
|
8
|
+
import {BSONFormat} from './bson-format';
|
|
7
9
|
|
|
8
10
|
// __VERSION__ is injected by babel-plugin-version-inline
|
|
9
11
|
// @ts-ignore TS2304: Cannot find name '__VERSION__'.
|
|
@@ -18,6 +20,7 @@ export type BSONLoaderOptions = LoaderOptions & {
|
|
|
18
20
|
};
|
|
19
21
|
|
|
20
22
|
export const BSONLoader = {
|
|
23
|
+
...BSONFormat,
|
|
21
24
|
dataType: null as unknown as Record<string, unknown>,
|
|
22
25
|
batchType: null as never,
|
|
23
26
|
name: 'BSON',
|
package/src/bson-writer.ts
CHANGED
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
import type {WriterWithEncoder, WriterOptions} from '@loaders.gl/loader-utils';
|
|
6
6
|
import type {EncodeBSONOptions} from './lib/encoders/encode-bson';
|
|
7
7
|
import {encodeBSONSync} from './lib/encoders/encode-bson';
|
|
8
|
+
import {BSONFormat} from './bson-format';
|
|
8
9
|
|
|
9
10
|
// __VERSION__ is injected by babel-plugin-version-inline
|
|
10
11
|
// @ts-ignore TS2304: Cannot find name '__VERSION__'.
|
|
@@ -15,6 +16,7 @@ export type BSONWriterOptions = WriterOptions & {
|
|
|
15
16
|
}
|
|
16
17
|
|
|
17
18
|
export const BSONWriter = {
|
|
19
|
+
...BSONFormat,
|
|
18
20
|
name: 'BSON',
|
|
19
21
|
id: 'bson',
|
|
20
22
|
module: 'bson',
|