@mongosh/node-runtime-worker-thread 1.5.4 → 1.6.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.
@@ -1 +1,2 @@
1
- !function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var n=t();for(var r in n)("object"==typeof exports?exports:e)[r]=n[r]}}(global,(function(){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(r,i,function(t){return e[t]}.bind(null,i));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=3)}([function(e,t){e.exports=require("buffer")},function(e,t,n){"use strict";var r,i,o,s=n(13),u="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_-";function f(){o=!1}function a(e){if(e){if(e!==r){if(e.length!==u.length)throw new Error("Custom alphabet for shortid must be "+u.length+" unique characters. You submitted "+e.length+" characters: "+e);var t=e.split("").filter((function(e,t,n){return t!==n.lastIndexOf(e)}));if(t.length)throw new Error("Custom alphabet for shortid must be "+u.length+" unique characters. These characters were not unique: "+t.join(", "));r=e,f()}}else r!==u&&(r=u,f())}function c(){return o||(o=function(){r||a(u);for(var e,t=r.split(""),n=[],i=s.nextValue();t.length>0;)i=s.nextValue(),e=Math.floor(i*t.length),n.push(t.splice(e,1)[0]);return n.join("")}())}e.exports={get:function(){return r||u},characters:function(e){return a(e),r},seed:function(e){s.seed(e),i!==e&&(f(),i=e)},lookup:function(e){return c()[e]},shuffled:c}},function(e,t){e.exports=require("crypto")},function(e,t,n){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const i=n(4),o=n(5),s=r(n(6)),u=n(7),f=n(26),a=process.env.WORKER_RUNTIME_SRC_PATH_DO_NOT_USE_THIS_EXCEPT_FOR_TESTING||s.default.resolve(__dirname,"worker-runtime.js"),c=new o.Worker(a,{env:o.SHARE_ENV}),l=(async()=>{await Promise.race([(async()=>{let e;for(;[e]=await(0,i.once)(c,"message");)if("ready"===e)return})(),(async()=>{const[e]=await(0,i.once)(c,"error");if(e)throw e.message=`Worker thread failed to start with the following error: ${e.message}`,e})()])})();process.setMaxListeners(25),c.setMaxListeners(25);let p=null;const{interrupt:h}=(0,u.createCaller)(["interrupt"],c),d=Object.assign((0,u.createCaller)(["init","evaluate","getCompletions","getShellPrompt"],c),{interrupt:()=>p?((0,f.interrupt)(p),!0):h()});Object.keys(d).forEach((e=>{var t;d[e]=(t=d[e],new Proxy(t,{apply:async(e,t,n)=>(await l,e.call(t,...Array.from(n)))}))})),(0,u.exposeAll)(d,process);const g=Object.assign((0,u.createCaller)(["onPrint","onPrompt","getConfig","setConfig","resetConfig","validateConfig","listConfigOptions","onClearCommand","onExit"],process),{onRunInterruptible(e){p=e}});(0,u.exposeAll)(g,c);const y=(0,u.createCaller)(["emit","on"],process);(0,u.exposeAll)(y,c),process.nextTick((()=>{var e;null===(e=process.send)||void 0===e||e.call(process,"ready")}))},function(e,t){e.exports=require("events")},function(e,t){e.exports=require("worker_threads")},function(e,t){e.exports=require("path")},function(e,t,n){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.createCaller=t.exposeAll=t.cancel=t.close=t.removeTrailingUndefined=t.deserialize=t.serialize=void 0;const i=r(n(8)),o=n(9),s=n(23);function u(e){return`data:;base64,${i.default.serialize(e).toString("base64")}`}function f(e){return/^data:;base64,.+/.test(e)?i.default.deserialize(Buffer.from(e.replace("data:;base64,",""),"base64")):e}var a;function c(e){return e&&"object"==typeof e&&"id"in e&&"sender"in e}function l(e){return c(e)&&"postmsg-rpc/server"===e.sender}function p(e){return c(e)&&"postmsg-rpc/client"===e.sender}function h(e){if(Array.isArray(e))for(e=[...e];e.length>0&&void 0===e[e.length-1];)e.pop();return e}function d(e){return{addListener:e.on.bind(e),removeListener:e.off.bind(e),postMessage(t){if(p(t)&&Array.isArray(t.args)&&(t.args=u(h(t.args))),l(t))try{t.res=u(t.res)}catch(e){t.res=u({type:a.Error,payload:(0,s.serializeError)(e)})}return function(e,t){"postMessage"in e&&"function"==typeof e.postMessage&&e.postMessage(t),"send"in e&&"function"==typeof e.send&&e.send(t)}(e,t)},getMessageData:e=>(p(e)&&e.args&&"string"==typeof e.args&&(e.args=f(e.args)),l(e)&&"string"==typeof e.res&&(e.res=f(e.res)),e)}}t.serialize=u,t.deserialize=f,function(e){e[e.Message=0]="Message",e[e.Error=1]="Error"}(a||(a={})),t.removeTrailingUndefined=h,t.close=Symbol("@@rpc.close"),t.cancel=Symbol("@@rpc.cancel"),t.exposeAll=function(e,n){return Object.entries(e).forEach((([e,t])=>{const{close:r}=(0,o.expose)(e,(async(...e)=>{try{return{type:a.Message,payload:await t(...e)}}catch(e){return{type:a.Error,payload:(0,s.serializeError)(e)}}}),d(n));t.close=r})),Object.defineProperty(e,t.close,{enumerable:!1,value(){Object.values(e).forEach((e=>{e.close()}))}}),e},t.createCaller=function(e,n,r={}){const i={},u=new Set;return e.forEach((e=>{const t=(0,o.caller)(e,d(n));i[e]=async(...n)=>{var i;const o="function"==typeof r[e]?null===(i=r[e])||void 0===i?void 0:i.call(r,...n):n,f=t(...o);u.add(f);const c=await f;if(u.delete(f),(l=c)&&"object"==typeof l&&l.type===a.Error)throw(0,s.deserializeError)(c.payload);var l;return c.payload}})),Object.defineProperty(i,t.cancel,{enumerable:!1,value(){for(const e of u)e.cancel(),u.delete(e)}}),i}},function(e,t){e.exports=require("v8")},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(10);Object.defineProperty(t,"caller",{enumerable:!0,get:function(){return o(r).default}}),Object.defineProperty(t,"call",{enumerable:!0,get:function(){return r.call}});var i=n(22);function o(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"expose",{enumerable:!0,get:function(){return o(i).default}})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=s,t.call=function(e){return s(e).apply(null,[].slice.call(arguments,1))};var r,i=n(11),o=(r=i)&&r.__esModule?r:{default:r};function s(e,t){var n=(t=t||{}).addListener||window.addEventListener,r=t.removeListener||window.removeEventListener,i=t.postMessage||window.postMessage,s=t.targetOrigin||"*",u=t.getMessageData||function(e){return e.data};return function(){var t={sender:"postmsg-rpc/client",id:(0,o.default)(),func:e,args:Array.from(arguments)},f=void 0,a=new Promise((function(o,a){var c=function n(){var i=u.apply(null,arguments);if(i&&"postmsg-rpc/server"===i.sender&&i.id===t.id){if(r("message",n),i.err){var s=new Error("Unexpected error calling "+e);return Object.assign(s,i.err),a(s)}o(i.res)}};f=function(){r("message",c);var t=new Error("Canceled call to "+e);t.isCanceled=!0,a(t)},n("message",c),i(t,s)}));return a.cancel=function(){return f()},a}}},function(e,t,n){"use strict";e.exports=n(12)},function(e,t,n){"use strict";var r=n(1),i=n(14),o=n(19),s=n(20)||0;function u(){return i(s)}e.exports=u,e.exports.generate=u,e.exports.seed=function(t){return r.seed(t),e.exports},e.exports.worker=function(t){return s=t,e.exports},e.exports.characters=function(e){return void 0!==e&&r.characters(e),r.shuffled()},e.exports.isValid=o},function(e,t,n){"use strict";var r=1;e.exports={nextValue:function(){return(r=(9301*r+49297)%233280)/233280},seed:function(e){r=e}}},function(e,t,n){"use strict";var r,i,o=n(15);n(1);e.exports=function(e){var t="",n=Math.floor(.001*(Date.now()-1567752802062));return n===i?r++:(r=0,i=n),t+=o(7),t+=o(e),r>0&&(t+=o(r)),t+=o(n)}},function(e,t,n){"use strict";var r=n(1),i=n(16),o=n(18);e.exports=function(e){for(var t,n=0,s="";!t;)s+=o(i,r.get(),1),t=e<Math.pow(16,n+1),n++;return s}},function(e,t,n){e.exports=n(17)},function(e,t,n){var r=n(2);if(r.randomFillSync){var i={};e.exports=function(e){var t=i[e];return t||(t=Buffer.allocUnsafe(e),e<=255&&(i[e]=t)),r.randomFillSync(t)}}else e.exports=r.randomBytes},function(e,t){e.exports=function(e,t,n){for(var r=(2<<31-Math.clz32(t.length-1|1))-1,i=Math.ceil(1.6*r*n/t.length),o="";;)for(var s=e(i),u=i;u--;)if((o+=t[s[u]&r]||"").length===+n)return o}},function(e,t,n){"use strict";var r=n(1);e.exports=function(e){return!(!e||"string"!=typeof e||e.length<6)&&!new RegExp("[^"+r.get().replace(/[|\\{}()[\]^$+*?.-]/g,"\\$&")+"]").test(e)}},function(e,t,n){"use strict";var r=n(21),i=0;!r.isMaster&&r.worker&&(i=r.worker.id),e.exports=parseInt(process.env.NODE_UNIQUE_ID||i,10)},function(e,t){e.exports=require("cluster")},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t,n){var r=(n=n||{}).addListener||window.addEventListener,i=n.removeListener||window.removeEventListener,o=n.postMessage||window.postMessage,s=n.targetOrigin||"*",u=n.getMessageData||function(e){return e.data},f=n.isCallback||!1,a=function(){var n=u.apply(null,arguments);if(n&&"postmsg-rpc/client"===n.sender&&n.func===e){var r={sender:"postmsg-rpc/server",id:n.id},i=function(e){r.res=e,o(r,s)},a=function(e){r.err=Object.assign({message:e.message},e.output&&e.output.payload),o(r,s)};if(f)t.apply(null,n.args.concat((function(e,t){if(e)return a(e);i(t)})));else{var c=t.apply(null,n.args);Promise.resolve(c).then(i).catch(a)}}};return r("message",a),{close:function(){return i("message",a)}}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.deserializeConnectOptions=t.serializeConnectOptions=t.deserializeEvaluationResult=t.serializeEvaluationResult=t.SerializedResultTypes=t.deserializeError=t.serializeError=void 0;const r=n(24),i=n(25);function o(e){var t;return(t=e,Object.getOwnPropertyNames(t)).concat("name").reduce(((t,n)=>(t[n]=e[n],t)),{})}function s(e){return Object.assign(new Error,e)}var u;t.serializeError=o,t.deserializeError=s,function(e){e.SerializedErrorResult="SerializedErrorResult",e.InspectResult="InspectResult",e.SerializedShellApiResult="SerializedShellApiResult"}(u=t.SerializedResultTypes||(t.SerializedResultTypes={})),t.serializeEvaluationResult=function({type:e,printable:t,source:n}){return"object"!=typeof(s=t)&&"function"!=typeof s||null===s?{type:e,printable:t,source:n}:function(e){return e&&e.name&&e.message&&e.stack}(t)?{type:u.SerializedErrorResult,printable:o(t),source:n}:null===e?{type:u.InspectResult,printable:(0,r.inspect)(t),source:n}:{type:u.SerializedShellApiResult,printable:{origType:e,serializedValue:i.EJSON.serialize(t)}};var s},t.deserializeEvaluationResult=function({type:e,printable:t,source:n}){return e===u.SerializedErrorResult?{type:e,printable:s(t),source:n}:e===u.SerializedShellApiResult?{type:t.origType,printable:i.EJSON.deserialize(t.serializedValue),source:n}:{type:e,printable:t,source:n}};const f=["schemaMap","encryptedFieldsMap"];t.serializeConnectOptions=function(e={}){var t;const n={...e};for(const e of f)(null===(t=n.autoEncryption)||void 0===t?void 0:t[e])&&(n.autoEncryption={...n.autoEncryption,[e]:i.EJSON.serialize(n.autoEncryption[e],{relaxed:!1})});return n},t.deserializeConnectOptions=function(e){var t;const n={...e};for(const e of f)(null===(t=n.autoEncryption)||void 0===t?void 0:t[e])&&(n.autoEncryption={...n.autoEncryption,[e]:i.EJSON.deserialize(n.autoEncryption[e],{relaxed:!1})});return n}},function(e,t){e.exports=require("util")},function(e,t,n){"use strict";n.r(t),n.d(t,"BSONError",(function(){return u})),n.d(t,"BSONRegExp",(function(){return ue})),n.d(t,"BSONSymbol",(function(){return fe})),n.d(t,"BSONTypeError",(function(){return f})),n.d(t,"BSON_BINARY_SUBTYPE_BYTE_ARRAY",(function(){return Qe})),n.d(t,"BSON_BINARY_SUBTYPE_COLUMN",(function(){return it})),n.d(t,"BSON_BINARY_SUBTYPE_DEFAULT",(function(){return Xe})),n.d(t,"BSON_BINARY_SUBTYPE_ENCRYPTED",(function(){return rt})),n.d(t,"BSON_BINARY_SUBTYPE_FUNCTION",(function(){return Ge})),n.d(t,"BSON_BINARY_SUBTYPE_MD5",(function(){return nt})),n.d(t,"BSON_BINARY_SUBTYPE_USER_DEFINED",(function(){return ot})),n.d(t,"BSON_BINARY_SUBTYPE_UUID",(function(){return et})),n.d(t,"BSON_BINARY_SUBTYPE_UUID_NEW",(function(){return tt})),n.d(t,"BSON_DATA_ARRAY",(function(){return Le})),n.d(t,"BSON_DATA_BINARY",(function(){return De})),n.d(t,"BSON_DATA_BOOLEAN",(function(){return Me})),n.d(t,"BSON_DATA_CODE",(function(){return Ye})),n.d(t,"BSON_DATA_CODE_W_SCOPE",(function(){return Ve})),n.d(t,"BSON_DATA_DATE",(function(){return Pe})),n.d(t,"BSON_DATA_DBPOINTER",(function(){return Ce})),n.d(t,"BSON_DATA_DECIMAL128",(function(){return Ze})),n.d(t,"BSON_DATA_INT",(function(){return Fe})),n.d(t,"BSON_DATA_LONG",(function(){return He})),n.d(t,"BSON_DATA_MAX_KEY",(function(){return We})),n.d(t,"BSON_DATA_MIN_KEY",(function(){return Ke})),n.d(t,"BSON_DATA_NULL",(function(){return ze})),n.d(t,"BSON_DATA_NUMBER",(function(){return Ae})),n.d(t,"BSON_DATA_OBJECT",(function(){return Te})),n.d(t,"BSON_DATA_OID",(function(){return Re})),n.d(t,"BSON_DATA_REGEXP",(function(){return Je})),n.d(t,"BSON_DATA_STRING",(function(){return Ue})),n.d(t,"BSON_DATA_SYMBOL",(function(){return ke})),n.d(t,"BSON_DATA_TIMESTAMP",(function(){return qe})),n.d(t,"BSON_DATA_UNDEFINED",(function(){return $e})),n.d(t,"BSON_INT32_MAX",(function(){return xe})),n.d(t,"BSON_INT32_MIN",(function(){return Be})),n.d(t,"BSON_INT64_MAX",(function(){return Ne})),n.d(t,"BSON_INT64_MIN",(function(){return Ee})),n.d(t,"Binary",(function(){return I})),n.d(t,"Code",(function(){return A})),n.d(t,"DBRef",(function(){return T})),n.d(t,"Decimal128",(function(){return G})),n.d(t,"Double",(function(){return Q})),n.d(t,"EJSON",(function(){return we})),n.d(t,"Int32",(function(){return ee})),n.d(t,"Long",(function(){return z})),n.d(t,"LongWithoutOverridesClass",(function(){return ae})),n.d(t,"Map",(function(){return _e})),n.d(t,"MaxKey",(function(){return te})),n.d(t,"MinKey",(function(){return ne})),n.d(t,"ObjectID",(function(){return se})),n.d(t,"ObjectId",(function(){return se})),n.d(t,"Timestamp",(function(){return ce})),n.d(t,"UUID",(function(){return j})),n.d(t,"calculateObjectSize",(function(){return Zt})),n.d(t,"deserialize",(function(){return Ht})),n.d(t,"deserializeStream",(function(){return Kt})),n.d(t,"serialize",(function(){return Ft})),n.d(t,"serializeWithBufferAndIndex",(function(){return qt})),n.d(t,"setInternalBufferSize",(function(){return Vt}));var r=n(0),i=function(e,t){return i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},i(e,t)};function o(e,t){function n(){this.constructor=e}i(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var s=function(){return s=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},s.apply(this,arguments)},u=function(e){function t(n){var r=e.call(this,n)||this;return Object.setPrototypeOf(r,t.prototype),r}return o(t,e),Object.defineProperty(t.prototype,"name",{get:function(){return"BSONError"},enumerable:!1,configurable:!0}),t}(Error),f=function(e){function t(n){var r=e.call(this,n)||this;return Object.setPrototypeOf(r,t.prototype),r}return o(t,e),Object.defineProperty(t.prototype,"name",{get:function(){return"BSONTypeError"},enumerable:!1,configurable:!0}),t}(TypeError);function a(e){return e&&e.Math==Math&&e}function c(){return a("object"==typeof globalThis&&globalThis)||a("object"==typeof window&&window)||a("object"==typeof self&&self)||a("object"==typeof global&&global)||Function("return this")()}function l(e){return e.toString().replace("function(","function (")}var p=function(e){var t,n="object"==typeof(t=c()).navigator&&"ReactNative"===t.navigator.product?"BSON: For React Native please polyfill crypto.getRandomValues, e.g. using: https://www.npmjs.com/package/react-native-get-random-values.":"BSON: No cryptographic implementation for random bytes present, falling back to a less secure implementation.";console.warn(n);for(var i=r.Buffer.alloc(e),o=0;o<e;++o)i[o]=Math.floor(256*Math.random());return i},h=function(){var e=void 0;try{e=n(2).randomBytes}catch(e){}return e||p}();function d(e){return["[object ArrayBuffer]","[object SharedArrayBuffer]"].includes(Object.prototype.toString.call(e))}function g(e){return"[object Uint8Array]"===Object.prototype.toString.call(e)}function y(e){return"[object BigInt64Array]"===Object.prototype.toString.call(e)}function b(e){return"[object BigUint64Array]"===Object.prototype.toString.call(e)}function m(e){return"[object RegExp]"===Object.prototype.toString.call(e)}function v(e){return w(e)&&"[object Date]"===Object.prototype.toString.call(e)}function w(e){return"object"==typeof e&&null!==e}function _(e,t){var n=!1;return function(){for(var r=[],i=0;i<arguments.length;i++)r[i]=arguments[i];return n||(console.warn(t),n=!0),e.apply(this,r)}}function S(e){if(ArrayBuffer.isView(e))return r.Buffer.from(e.buffer,e.byteOffset,e.byteLength);if(d(e))return r.Buffer.from(e);throw new f("Must use either Buffer or TypedArray")}var O=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|[0-9a-f]{12}4[0-9a-f]{3}[89ab][0-9a-f]{15})$/i,x=function(e){return"string"==typeof e&&O.test(e)},B=function(e){if(!x(e))throw new f('UUID string representations must be a 32 or 36 character hex string (dashes excluded/included). Format: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" or "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx".');var t=e.replace(/-/g,"");return r.Buffer.from(t,"hex")},N=function(e,t){return void 0===t&&(t=!0),t?e.toString("hex",0,4)+"-"+e.toString("hex",4,6)+"-"+e.toString("hex",6,8)+"-"+e.toString("hex",8,10)+"-"+e.toString("hex",10,16):e.toString("hex")},E=Symbol("id"),j=function(){function e(t){if(void 0===t)this.id=e.generate();else if(t instanceof e)this[E]=r.Buffer.from(t.id),this.__id=t.__id;else if(ArrayBuffer.isView(t)&&16===t.byteLength)this.id=S(t);else{if("string"!=typeof t)throw new f("Argument passed in UUID constructor must be a UUID, a 16 byte Buffer or a 32/36 character hex string (dashes excluded/included, format: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx).");this.id=B(t)}}return Object.defineProperty(e.prototype,"id",{get:function(){return this[E]},set:function(t){this[E]=t,e.cacheHexString&&(this.__id=N(t))},enumerable:!1,configurable:!0}),e.prototype.toHexString=function(t){if(void 0===t&&(t=!0),e.cacheHexString&&this.__id)return this.__id;var n=N(this.id,t);return e.cacheHexString&&(this.__id=n),n},e.prototype.toString=function(e){return e?this.id.toString(e):this.toHexString()},e.prototype.toJSON=function(){return this.toHexString()},e.prototype.equals=function(t){if(!t)return!1;if(t instanceof e)return t.id.equals(this.id);try{return new e(t).id.equals(this.id)}catch(e){return!1}},e.prototype.toBinary=function(){return new I(this.id,I.SUBTYPE_UUID)},e.generate=function(){var e=h(16);return e[6]=15&e[6]|64,e[8]=63&e[8]|128,r.Buffer.from(e)},e.isValid=function(t){if(!t)return!1;if(t instanceof e)return!0;if("string"==typeof t)return x(t);if(g(t)){if(16!==t.length)return!1;try{return parseInt(t[6].toString(16)[0],10)===I.SUBTYPE_UUID}catch(e){return!1}}return!1},e.createFromHexString=function(t){return new e(B(t))},e.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},e.prototype.inspect=function(){return'new UUID("'.concat(this.toHexString(),'")')},e}();Object.defineProperty(j.prototype,"_bsontype",{value:"UUID"});var I=function(){function e(t,n){if(!(this instanceof e))return new e(t,n);if(!(null==t||"string"==typeof t||ArrayBuffer.isView(t)||t instanceof ArrayBuffer||Array.isArray(t)))throw new f("Binary can only be constructed from string, Buffer, TypedArray, or Array<number>");this.sub_type=null!=n?n:e.BSON_BINARY_SUBTYPE_DEFAULT,null==t?(this.buffer=r.Buffer.alloc(e.BUFFER_SIZE),this.position=0):("string"==typeof t?this.buffer=r.Buffer.from(t,"binary"):Array.isArray(t)?this.buffer=r.Buffer.from(t):this.buffer=S(t),this.position=this.buffer.byteLength)}return e.prototype.put=function(t){if("string"==typeof t&&1!==t.length)throw new f("only accepts single character String");if("number"!=typeof t&&1!==t.length)throw new f("only accepts single character Uint8Array or Array");var n;if((n="string"==typeof t?t.charCodeAt(0):"number"==typeof t?t:t[0])<0||n>255)throw new f("only accepts number in a valid unsigned byte range 0-255");if(this.buffer.length>this.position)this.buffer[this.position++]=n;else{var i=r.Buffer.alloc(e.BUFFER_SIZE+this.buffer.length);this.buffer.copy(i,0,0,this.buffer.length),this.buffer=i,this.buffer[this.position++]=n}},e.prototype.write=function(e,t){if(t="number"==typeof t?t:this.position,this.buffer.length<t+e.length){var n=r.Buffer.alloc(this.buffer.length+e.length);this.buffer.copy(n,0,0,this.buffer.length),this.buffer=n}ArrayBuffer.isView(e)?(this.buffer.set(S(e),t),this.position=t+e.byteLength>this.position?t+e.length:this.position):"string"==typeof e&&(this.buffer.write(e,t,e.length,"binary"),this.position=t+e.length>this.position?t+e.length:this.position)},e.prototype.read=function(e,t){return t=t&&t>0?t:this.position,this.buffer.slice(e,e+t)},e.prototype.value=function(e){return(e=!!e)&&this.buffer.length===this.position?this.buffer:e?this.buffer.slice(0,this.position):this.buffer.toString("binary",0,this.position)},e.prototype.length=function(){return this.position},e.prototype.toJSON=function(){return this.buffer.toString("base64")},e.prototype.toString=function(e){return this.buffer.toString(e)},e.prototype.toExtendedJSON=function(e){e=e||{};var t=this.buffer.toString("base64"),n=Number(this.sub_type).toString(16);return e.legacy?{$binary:t,$type:1===n.length?"0"+n:n}:{$binary:{base64:t,subType:1===n.length?"0"+n:n}}},e.prototype.toUUID=function(){if(this.sub_type===e.SUBTYPE_UUID)return new j(this.buffer.slice(0,this.position));throw new u('Binary sub_type "'.concat(this.sub_type,'" is not supported for converting to UUID. Only "').concat(e.SUBTYPE_UUID,'" is currently supported.'))},e.fromExtendedJSON=function(t,n){var i,o;if(n=n||{},"$binary"in t?n.legacy&&"string"==typeof t.$binary&&"$type"in t?(o=t.$type?parseInt(t.$type,16):0,i=r.Buffer.from(t.$binary,"base64")):"string"!=typeof t.$binary&&(o=t.$binary.subType?parseInt(t.$binary.subType,16):0,i=r.Buffer.from(t.$binary.base64,"base64")):"$uuid"in t&&(o=4,i=B(t.$uuid)),!i)throw new f("Unexpected Binary Extended JSON format ".concat(JSON.stringify(t)));return new e(i,o)},e.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},e.prototype.inspect=function(){var e=this.value(!0);return'new Binary(Buffer.from("'.concat(e.toString("hex"),'", "hex"), ').concat(this.sub_type,")")},e.BSON_BINARY_SUBTYPE_DEFAULT=0,e.BUFFER_SIZE=256,e.SUBTYPE_DEFAULT=0,e.SUBTYPE_FUNCTION=1,e.SUBTYPE_BYTE_ARRAY=2,e.SUBTYPE_UUID_OLD=3,e.SUBTYPE_UUID=4,e.SUBTYPE_MD5=5,e.SUBTYPE_ENCRYPTED=6,e.SUBTYPE_COLUMN=7,e.SUBTYPE_USER_DEFINED=128,e}();Object.defineProperty(I.prototype,"_bsontype",{value:"Binary"});var A=function(){function e(t,n){if(!(this instanceof e))return new e(t,n);this.code=t,this.scope=n}return e.prototype.toJSON=function(){return{code:this.code,scope:this.scope}},e.prototype.toExtendedJSON=function(){return this.scope?{$code:this.code,$scope:this.scope}:{$code:this.code}},e.fromExtendedJSON=function(t){return new e(t.$code,t.$scope)},e.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},e.prototype.inspect=function(){var e=this.toJSON();return'new Code("'.concat(String(e.code),'"').concat(e.scope?", ".concat(JSON.stringify(e.scope)):"",")")},e}();function U(e){return w(e)&&null!=e.$id&&"string"==typeof e.$ref&&(null==e.$db||"string"==typeof e.$db)}Object.defineProperty(A.prototype,"_bsontype",{value:"Code"});var T=function(){function e(t,n,r,i){if(!(this instanceof e))return new e(t,n,r,i);var o=t.split(".");2===o.length&&(r=o.shift(),t=o.shift()),this.collection=t,this.oid=n,this.db=r,this.fields=i||{}}return Object.defineProperty(e.prototype,"namespace",{get:function(){return this.collection},set:function(e){this.collection=e},enumerable:!1,configurable:!0}),e.prototype.toJSON=function(){var e=Object.assign({$ref:this.collection,$id:this.oid},this.fields);return null!=this.db&&(e.$db=this.db),e},e.prototype.toExtendedJSON=function(e){e=e||{};var t={$ref:this.collection,$id:this.oid};return e.legacy?t:(this.db&&(t.$db=this.db),t=Object.assign(t,this.fields))},e.fromExtendedJSON=function(t){var n=Object.assign({},t);return delete n.$ref,delete n.$id,delete n.$db,new e(t.$ref,t.$id,t.$db,n)},e.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},e.prototype.inspect=function(){var e=void 0===this.oid||void 0===this.oid.toString?this.oid:this.oid.toString();return'new DBRef("'.concat(this.namespace,'", new ObjectId("').concat(String(e),'")').concat(this.db?', "'.concat(this.db,'"'):"",")")},e}();Object.defineProperty(T.prototype,"_bsontype",{value:"DBRef"});var L=void 0;try{L=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(e){}var D=4294967296,$=0x10000000000000000,R=$/2,M={},P={},z=function(){function e(t,n,r){if(void 0===t&&(t=0),!(this instanceof e))return new e(t,n,r);"bigint"==typeof t?Object.assign(this,e.fromBigInt(t,!!n)):"string"==typeof t?Object.assign(this,e.fromString(t,!!n)):(this.low=0|t,this.high=0|n,this.unsigned=!!r),Object.defineProperty(this,"__isLong__",{value:!0,configurable:!1,writable:!1,enumerable:!1})}return e.fromBits=function(t,n,r){return new e(t,n,r)},e.fromInt=function(t,n){var r,i,o;return n?(o=0<=(t>>>=0)&&t<256)&&(i=P[t])?i:(r=e.fromBits(t,(0|t)<0?-1:0,!0),o&&(P[t]=r),r):(o=-128<=(t|=0)&&t<128)&&(i=M[t])?i:(r=e.fromBits(t,t<0?-1:0,!1),o&&(M[t]=r),r)},e.fromNumber=function(t,n){if(isNaN(t))return n?e.UZERO:e.ZERO;if(n){if(t<0)return e.UZERO;if(t>=$)return e.MAX_UNSIGNED_VALUE}else{if(t<=-R)return e.MIN_VALUE;if(t+1>=R)return e.MAX_VALUE}return t<0?e.fromNumber(-t,n).neg():e.fromBits(t%D|0,t/D|0,n)},e.fromBigInt=function(t,n){return e.fromString(t.toString(),n)},e.fromString=function(t,n,r){if(0===t.length)throw Error("empty string");if("NaN"===t||"Infinity"===t||"+Infinity"===t||"-Infinity"===t)return e.ZERO;if("number"==typeof n?(r=n,n=!1):n=!!n,(r=r||10)<2||36<r)throw RangeError("radix");var i;if((i=t.indexOf("-"))>0)throw Error("interior hyphen");if(0===i)return e.fromString(t.substring(1),n,r).neg();for(var o=e.fromNumber(Math.pow(r,8)),s=e.ZERO,u=0;u<t.length;u+=8){var f=Math.min(8,t.length-u),a=parseInt(t.substring(u,u+f),r);if(f<8){var c=e.fromNumber(Math.pow(r,f));s=s.mul(c).add(e.fromNumber(a))}else s=(s=s.mul(o)).add(e.fromNumber(a))}return s.unsigned=n,s},e.fromBytes=function(t,n,r){return r?e.fromBytesLE(t,n):e.fromBytesBE(t,n)},e.fromBytesLE=function(t,n){return new e(t[0]|t[1]<<8|t[2]<<16|t[3]<<24,t[4]|t[5]<<8|t[6]<<16|t[7]<<24,n)},e.fromBytesBE=function(t,n){return new e(t[4]<<24|t[5]<<16|t[6]<<8|t[7],t[0]<<24|t[1]<<16|t[2]<<8|t[3],n)},e.isLong=function(e){return w(e)&&!0===e.__isLong__},e.fromValue=function(t,n){return"number"==typeof t?e.fromNumber(t,n):"string"==typeof t?e.fromString(t,n):e.fromBits(t.low,t.high,"boolean"==typeof n?n:t.unsigned)},e.prototype.add=function(t){e.isLong(t)||(t=e.fromValue(t));var n=this.high>>>16,r=65535&this.high,i=this.low>>>16,o=65535&this.low,s=t.high>>>16,u=65535&t.high,f=t.low>>>16,a=0,c=0,l=0,p=0;return l+=(p+=o+(65535&t.low))>>>16,p&=65535,c+=(l+=i+f)>>>16,l&=65535,a+=(c+=r+u)>>>16,c&=65535,a+=n+s,a&=65535,e.fromBits(l<<16|p,a<<16|c,this.unsigned)},e.prototype.and=function(t){return e.isLong(t)||(t=e.fromValue(t)),e.fromBits(this.low&t.low,this.high&t.high,this.unsigned)},e.prototype.compare=function(t){if(e.isLong(t)||(t=e.fromValue(t)),this.eq(t))return 0;var n=this.isNegative(),r=t.isNegative();return n&&!r?-1:!n&&r?1:this.unsigned?t.high>>>0>this.high>>>0||t.high===this.high&&t.low>>>0>this.low>>>0?-1:1:this.sub(t).isNegative()?-1:1},e.prototype.comp=function(e){return this.compare(e)},e.prototype.divide=function(t){if(e.isLong(t)||(t=e.fromValue(t)),t.isZero())throw Error("division by zero");if(L){if(!this.unsigned&&-2147483648===this.high&&-1===t.low&&-1===t.high)return this;var n=(this.unsigned?L.div_u:L.div_s)(this.low,this.high,t.low,t.high);return e.fromBits(n,L.get_high(),this.unsigned)}if(this.isZero())return this.unsigned?e.UZERO:e.ZERO;var r,i,o;if(this.unsigned){if(t.unsigned||(t=t.toUnsigned()),t.gt(this))return e.UZERO;if(t.gt(this.shru(1)))return e.UONE;o=e.UZERO}else{if(this.eq(e.MIN_VALUE))return t.eq(e.ONE)||t.eq(e.NEG_ONE)?e.MIN_VALUE:t.eq(e.MIN_VALUE)?e.ONE:(r=this.shr(1).div(t).shl(1)).eq(e.ZERO)?t.isNegative()?e.ONE:e.NEG_ONE:(i=this.sub(t.mul(r)),o=r.add(i.div(t)));if(t.eq(e.MIN_VALUE))return this.unsigned?e.UZERO:e.ZERO;if(this.isNegative())return t.isNegative()?this.neg().div(t.neg()):this.neg().div(t).neg();if(t.isNegative())return this.div(t.neg()).neg();o=e.ZERO}for(i=this;i.gte(t);){r=Math.max(1,Math.floor(i.toNumber()/t.toNumber()));for(var s=Math.ceil(Math.log(r)/Math.LN2),u=s<=48?1:Math.pow(2,s-48),f=e.fromNumber(r),a=f.mul(t);a.isNegative()||a.gt(i);)r-=u,a=(f=e.fromNumber(r,this.unsigned)).mul(t);f.isZero()&&(f=e.ONE),o=o.add(f),i=i.sub(a)}return o},e.prototype.div=function(e){return this.divide(e)},e.prototype.equals=function(t){return e.isLong(t)||(t=e.fromValue(t)),(this.unsigned===t.unsigned||this.high>>>31!=1||t.high>>>31!=1)&&(this.high===t.high&&this.low===t.low)},e.prototype.eq=function(e){return this.equals(e)},e.prototype.getHighBits=function(){return this.high},e.prototype.getHighBitsUnsigned=function(){return this.high>>>0},e.prototype.getLowBits=function(){return this.low},e.prototype.getLowBitsUnsigned=function(){return this.low>>>0},e.prototype.getNumBitsAbs=function(){if(this.isNegative())return this.eq(e.MIN_VALUE)?64:this.neg().getNumBitsAbs();var t,n=0!==this.high?this.high:this.low;for(t=31;t>0&&0==(n&1<<t);t--);return 0!==this.high?t+33:t+1},e.prototype.greaterThan=function(e){return this.comp(e)>0},e.prototype.gt=function(e){return this.greaterThan(e)},e.prototype.greaterThanOrEqual=function(e){return this.comp(e)>=0},e.prototype.gte=function(e){return this.greaterThanOrEqual(e)},e.prototype.ge=function(e){return this.greaterThanOrEqual(e)},e.prototype.isEven=function(){return 0==(1&this.low)},e.prototype.isNegative=function(){return!this.unsigned&&this.high<0},e.prototype.isOdd=function(){return 1==(1&this.low)},e.prototype.isPositive=function(){return this.unsigned||this.high>=0},e.prototype.isZero=function(){return 0===this.high&&0===this.low},e.prototype.lessThan=function(e){return this.comp(e)<0},e.prototype.lt=function(e){return this.lessThan(e)},e.prototype.lessThanOrEqual=function(e){return this.comp(e)<=0},e.prototype.lte=function(e){return this.lessThanOrEqual(e)},e.prototype.modulo=function(t){if(e.isLong(t)||(t=e.fromValue(t)),L){var n=(this.unsigned?L.rem_u:L.rem_s)(this.low,this.high,t.low,t.high);return e.fromBits(n,L.get_high(),this.unsigned)}return this.sub(this.div(t).mul(t))},e.prototype.mod=function(e){return this.modulo(e)},e.prototype.rem=function(e){return this.modulo(e)},e.prototype.multiply=function(t){if(this.isZero())return e.ZERO;if(e.isLong(t)||(t=e.fromValue(t)),L){var n=L.mul(this.low,this.high,t.low,t.high);return e.fromBits(n,L.get_high(),this.unsigned)}if(t.isZero())return e.ZERO;if(this.eq(e.MIN_VALUE))return t.isOdd()?e.MIN_VALUE:e.ZERO;if(t.eq(e.MIN_VALUE))return this.isOdd()?e.MIN_VALUE:e.ZERO;if(this.isNegative())return t.isNegative()?this.neg().mul(t.neg()):this.neg().mul(t).neg();if(t.isNegative())return this.mul(t.neg()).neg();if(this.lt(e.TWO_PWR_24)&&t.lt(e.TWO_PWR_24))return e.fromNumber(this.toNumber()*t.toNumber(),this.unsigned);var r=this.high>>>16,i=65535&this.high,o=this.low>>>16,s=65535&this.low,u=t.high>>>16,f=65535&t.high,a=t.low>>>16,c=65535&t.low,l=0,p=0,h=0,d=0;return h+=(d+=s*c)>>>16,d&=65535,p+=(h+=o*c)>>>16,h&=65535,p+=(h+=s*a)>>>16,h&=65535,l+=(p+=i*c)>>>16,p&=65535,l+=(p+=o*a)>>>16,p&=65535,l+=(p+=s*f)>>>16,p&=65535,l+=r*c+i*a+o*f+s*u,l&=65535,e.fromBits(h<<16|d,l<<16|p,this.unsigned)},e.prototype.mul=function(e){return this.multiply(e)},e.prototype.negate=function(){return!this.unsigned&&this.eq(e.MIN_VALUE)?e.MIN_VALUE:this.not().add(e.ONE)},e.prototype.neg=function(){return this.negate()},e.prototype.not=function(){return e.fromBits(~this.low,~this.high,this.unsigned)},e.prototype.notEquals=function(e){return!this.equals(e)},e.prototype.neq=function(e){return this.notEquals(e)},e.prototype.ne=function(e){return this.notEquals(e)},e.prototype.or=function(t){return e.isLong(t)||(t=e.fromValue(t)),e.fromBits(this.low|t.low,this.high|t.high,this.unsigned)},e.prototype.shiftLeft=function(t){return e.isLong(t)&&(t=t.toInt()),0==(t&=63)?this:t<32?e.fromBits(this.low<<t,this.high<<t|this.low>>>32-t,this.unsigned):e.fromBits(0,this.low<<t-32,this.unsigned)},e.prototype.shl=function(e){return this.shiftLeft(e)},e.prototype.shiftRight=function(t){return e.isLong(t)&&(t=t.toInt()),0==(t&=63)?this:t<32?e.fromBits(this.low>>>t|this.high<<32-t,this.high>>t,this.unsigned):e.fromBits(this.high>>t-32,this.high>=0?0:-1,this.unsigned)},e.prototype.shr=function(e){return this.shiftRight(e)},e.prototype.shiftRightUnsigned=function(t){if(e.isLong(t)&&(t=t.toInt()),0===(t&=63))return this;var n=this.high;if(t<32){var r=this.low;return e.fromBits(r>>>t|n<<32-t,n>>>t,this.unsigned)}return 32===t?e.fromBits(n,0,this.unsigned):e.fromBits(n>>>t-32,0,this.unsigned)},e.prototype.shr_u=function(e){return this.shiftRightUnsigned(e)},e.prototype.shru=function(e){return this.shiftRightUnsigned(e)},e.prototype.subtract=function(t){return e.isLong(t)||(t=e.fromValue(t)),this.add(t.neg())},e.prototype.sub=function(e){return this.subtract(e)},e.prototype.toInt=function(){return this.unsigned?this.low>>>0:this.low},e.prototype.toNumber=function(){return this.unsigned?(this.high>>>0)*D+(this.low>>>0):this.high*D+(this.low>>>0)},e.prototype.toBigInt=function(){return BigInt(this.toString())},e.prototype.toBytes=function(e){return e?this.toBytesLE():this.toBytesBE()},e.prototype.toBytesLE=function(){var e=this.high,t=this.low;return[255&t,t>>>8&255,t>>>16&255,t>>>24,255&e,e>>>8&255,e>>>16&255,e>>>24]},e.prototype.toBytesBE=function(){var e=this.high,t=this.low;return[e>>>24,e>>>16&255,e>>>8&255,255&e,t>>>24,t>>>16&255,t>>>8&255,255&t]},e.prototype.toSigned=function(){return this.unsigned?e.fromBits(this.low,this.high,!1):this},e.prototype.toString=function(t){if((t=t||10)<2||36<t)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative()){if(this.eq(e.MIN_VALUE)){var n=e.fromNumber(t),r=this.div(n),i=r.mul(n).sub(this);return r.toString(t)+i.toInt().toString(t)}return"-"+this.neg().toString(t)}for(var o=e.fromNumber(Math.pow(t,6),this.unsigned),s=this,u="";;){var f=s.div(o),a=(s.sub(f.mul(o)).toInt()>>>0).toString(t);if((s=f).isZero())return a+u;for(;a.length<6;)a="0"+a;u=""+a+u}},e.prototype.toUnsigned=function(){return this.unsigned?this:e.fromBits(this.low,this.high,!0)},e.prototype.xor=function(t){return e.isLong(t)||(t=e.fromValue(t)),e.fromBits(this.low^t.low,this.high^t.high,this.unsigned)},e.prototype.eqz=function(){return this.isZero()},e.prototype.le=function(e){return this.lessThanOrEqual(e)},e.prototype.toExtendedJSON=function(e){return e&&e.relaxed?this.toNumber():{$numberLong:this.toString()}},e.fromExtendedJSON=function(t,n){var r=e.fromString(t.$numberLong);return n&&n.relaxed?r.toNumber():r},e.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},e.prototype.inspect=function(){return'new Long("'.concat(this.toString(),'"').concat(this.unsigned?", true":"",")")},e.TWO_PWR_24=e.fromInt(16777216),e.MAX_UNSIGNED_VALUE=e.fromBits(-1,-1,!0),e.ZERO=e.fromInt(0),e.UZERO=e.fromInt(0,!0),e.ONE=e.fromInt(1),e.UONE=e.fromInt(1,!0),e.NEG_ONE=e.fromInt(-1),e.MAX_VALUE=e.fromBits(-1,2147483647,!1),e.MIN_VALUE=e.fromBits(0,-2147483648,!1),e}();Object.defineProperty(z.prototype,"__isLong__",{value:!0}),Object.defineProperty(z.prototype,"_bsontype",{value:"Long"});var J=/^(\+|-)?(\d+|(\d*\.\d*))?(E|e)?([-+])?(\d+)?$/,C=/^(\+|-)?(Infinity|inf)$/i,Y=/^(\+|-)?NaN$/i,k=6111,V=-6176,F=[124,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0].reverse(),q=[248,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0].reverse(),H=[120,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0].reverse(),Z=/^([-+])?(\d+)?$/;function K(e){return!isNaN(parseInt(e,10))}function W(e){var t=z.fromNumber(1e9),n=z.fromNumber(0);if(!(e.parts[0]||e.parts[1]||e.parts[2]||e.parts[3]))return{quotient:e,rem:n};for(var r=0;r<=3;r++)n=(n=n.shiftLeft(32)).add(new z(e.parts[r],0)),e.parts[r]=n.div(t).low,n=n.modulo(t);return{quotient:e,rem:n}}function X(e,t){throw new f('"'.concat(e,'" is not a valid Decimal128 string - ').concat(t))}var G=function(){function e(t){if(!(this instanceof e))return new e(t);if("string"==typeof t)this.bytes=e.fromString(t).bytes;else{if(!g(t))throw new f("Decimal128 must take a Buffer or string");if(16!==t.byteLength)throw new f("Decimal128 must take a Buffer of 16 bytes");this.bytes=t}}return e.fromString=function(t){var n,i=!1,o=!1,s=!1,u=0,a=0,c=0,l=0,p=0,h=[0],d=0,g=0,y=0,b=0,m=0,v=0,w=new z(0,0),_=new z(0,0),S=0;if(t.length>=7e3)throw new f(t+" not a valid Decimal128 string");var O=t.match(J),x=t.match(C),B=t.match(Y);if(!O&&!x&&!B||0===t.length)throw new f(t+" not a valid Decimal128 string");if(O){var N=O[2],E=O[4],j=O[5],I=O[6];E&&void 0===I&&X(t,"missing exponent power"),E&&void 0===N&&X(t,"missing exponent base"),void 0===E&&(j||I)&&X(t,"missing e before exponent")}if("+"!==t[S]&&"-"!==t[S]||(i="-"===t[S++]),!K(t[S])&&"."!==t[S]){if("i"===t[S]||"I"===t[S])return new e(r.Buffer.from(i?q:H));if("N"===t[S])return new e(r.Buffer.from(F))}for(;K(t[S])||"."===t[S];)"."!==t[S]?(d<34&&("0"!==t[S]||s)&&(s||(p=a),s=!0,h[g++]=parseInt(t[S],10),d+=1),s&&(c+=1),o&&(l+=1),a+=1,S+=1):(o&&X(t,"contains multiple periods"),o=!0,S+=1);if(o&&!a)throw new f(t+" not a valid Decimal128 string");if("e"===t[S]||"E"===t[S]){var A=t.substr(++S).match(Z);if(!A||!A[2])return new e(r.Buffer.from(F));m=parseInt(A[0],10),S+=A[0].length}if(t[S])return new e(r.Buffer.from(F));if(y=0,d){if(b=d-1,1!==(u=c))for(;0===h[p+u-1];)u-=1}else y=0,b=0,h[0]=0,c=1,d=1,u=0;for(m<=l&&l-m>16384?m=V:m-=l;m>k;){if((b+=1)-y>34){if(h.join("").match(/^0+$/)){m=k;break}X(t,"overflow")}m-=1}for(;m<V||d<c;){if(0===b&&u<d){m=V,u=0;break}if(d<c?c-=1:b-=1,m<k)m+=1;else{if(h.join("").match(/^0+$/)){m=k;break}X(t,"overflow")}}if(b-y+1<u){var U=a;o&&(p+=1,U+=1),i&&(p+=1,U+=1);var T=parseInt(t[p+b+1],10),L=0;if(T>=5&&(L=1,5===T))for(L=h[b]%2==1?1:0,v=p+b+2;v<U;v++)if(parseInt(t[v],10)){L=1;break}if(L)for(var D=b;D>=0;D--)if(++h[D]>9&&(h[D]=0,0===D)){if(!(m<k))return new e(r.Buffer.from(i?q:H));m+=1,h[D]=1}}if(w=z.fromNumber(0),_=z.fromNumber(0),0===u)w=z.fromNumber(0),_=z.fromNumber(0);else if(b-y<17){D=y;for(_=z.fromNumber(h[D++]),w=new z(0,0);D<=b;D++)_=(_=_.multiply(z.fromNumber(10))).add(z.fromNumber(h[D]))}else{D=y;for(w=z.fromNumber(h[D++]);D<=b-17;D++)w=(w=w.multiply(z.fromNumber(10))).add(z.fromNumber(h[D]));for(_=z.fromNumber(h[D++]);D<=b;D++)_=(_=_.multiply(z.fromNumber(10))).add(z.fromNumber(h[D]))}var $,R,M,P,W=function(e,t){if(!e&&!t)return{high:z.fromNumber(0),low:z.fromNumber(0)};var n=e.shiftRightUnsigned(32),r=new z(e.getLowBits(),0),i=t.shiftRightUnsigned(32),o=new z(t.getLowBits(),0),s=n.multiply(i),u=n.multiply(o),f=r.multiply(i),a=r.multiply(o);return s=s.add(u.shiftRightUnsigned(32)),u=new z(u.getLowBits(),0).add(f).add(a.shiftRightUnsigned(32)),{high:s=s.add(u.shiftRightUnsigned(32)),low:a=u.shiftLeft(32).add(new z(a.getLowBits(),0))}}(w,z.fromString("100000000000000000"));W.low=W.low.add(_),$=W.low,R=_,M=$.high>>>0,P=R.high>>>0,(M<P||M===P&&$.low>>>0<R.low>>>0)&&(W.high=W.high.add(z.fromNumber(1))),n=m+6176;var G={low:z.fromNumber(0),high:z.fromNumber(0)};W.high.shiftRightUnsigned(49).and(z.fromNumber(1)).equals(z.fromNumber(1))?(G.high=G.high.or(z.fromNumber(3).shiftLeft(61)),G.high=G.high.or(z.fromNumber(n).and(z.fromNumber(16383).shiftLeft(47))),G.high=G.high.or(W.high.and(z.fromNumber(0x7fffffffffff)))):(G.high=G.high.or(z.fromNumber(16383&n).shiftLeft(49)),G.high=G.high.or(W.high.and(z.fromNumber(562949953421311)))),G.low=W.low,i&&(G.high=G.high.or(z.fromString("9223372036854775808")));var Q=r.Buffer.alloc(16);return S=0,Q[S++]=255&G.low.low,Q[S++]=G.low.low>>8&255,Q[S++]=G.low.low>>16&255,Q[S++]=G.low.low>>24&255,Q[S++]=255&G.low.high,Q[S++]=G.low.high>>8&255,Q[S++]=G.low.high>>16&255,Q[S++]=G.low.high>>24&255,Q[S++]=255&G.high.low,Q[S++]=G.high.low>>8&255,Q[S++]=G.high.low>>16&255,Q[S++]=G.high.low>>24&255,Q[S++]=255&G.high.high,Q[S++]=G.high.high>>8&255,Q[S++]=G.high.high>>16&255,Q[S++]=G.high.high>>24&255,new e(Q)},e.prototype.toString=function(){for(var e,t=0,n=new Array(36),r=0;r<n.length;r++)n[r]=0;var i,o,s,u=0,f=!1,a={parts:[0,0,0,0]},c=[];u=0;var l=this.bytes,p=l[u++]|l[u++]<<8|l[u++]<<16|l[u++]<<24,h=l[u++]|l[u++]<<8|l[u++]<<16|l[u++]<<24,d=l[u++]|l[u++]<<8|l[u++]<<16|l[u++]<<24,g=l[u++]|l[u++]<<8|l[u++]<<16|l[u++]<<24;u=0,{low:new z(p,h),high:new z(d,g)}.high.lessThan(z.ZERO)&&c.push("-");var y=g>>26&31;if(y>>3==3){if(30===y)return c.join("")+"Infinity";if(31===y)return"NaN";e=g>>15&16383,i=8+(g>>14&1)}else i=g>>14&7,e=g>>17&16383;var b=e-6176;if(a.parts[0]=(16383&g)+((15&i)<<14),a.parts[1]=d,a.parts[2]=h,a.parts[3]=p,0===a.parts[0]&&0===a.parts[1]&&0===a.parts[2]&&0===a.parts[3])f=!0;else for(s=3;s>=0;s--){var m=0,v=W(a);if(a=v.quotient,m=v.rem.low)for(o=8;o>=0;o--)n[9*s+o]=m%10,m=Math.floor(m/10)}if(f)t=1,n[u]=0;else for(t=36;!n[u];)t-=1,u+=1;var w=t-1+b;if(w>=34||w<=-7||b>0){if(t>34)return c.push("".concat(0)),b>0?c.push("E+".concat(b)):b<0&&c.push("E".concat(b)),c.join("");c.push("".concat(n[u++])),(t-=1)&&c.push(".");for(r=0;r<t;r++)c.push("".concat(n[u++]));c.push("E"),w>0?c.push("+".concat(w)):c.push("".concat(w))}else if(b>=0)for(r=0;r<t;r++)c.push("".concat(n[u++]));else{var _=t+b;if(_>0)for(r=0;r<_;r++)c.push("".concat(n[u++]));else c.push("0");for(c.push(".");_++<0;)c.push("0");for(r=0;r<t-Math.max(_-1,0);r++)c.push("".concat(n[u++]))}return c.join("")},e.prototype.toJSON=function(){return{$numberDecimal:this.toString()}},e.prototype.toExtendedJSON=function(){return{$numberDecimal:this.toString()}},e.fromExtendedJSON=function(t){return e.fromString(t.$numberDecimal)},e.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},e.prototype.inspect=function(){return'new Decimal128("'.concat(this.toString(),'")')},e}();Object.defineProperty(G.prototype,"_bsontype",{value:"Decimal128"});var Q=function(){function e(t){if(!(this instanceof e))return new e(t);t instanceof Number&&(t=t.valueOf()),this.value=+t}return e.prototype.valueOf=function(){return this.value},e.prototype.toJSON=function(){return this.value},e.prototype.toString=function(e){return this.value.toString(e)},e.prototype.toExtendedJSON=function(e){return e&&(e.legacy||e.relaxed&&isFinite(this.value))?this.value:Object.is(Math.sign(this.value),-0)?{$numberDouble:"-".concat(this.value.toFixed(1))}:(Number.isInteger(this.value)?(t=this.value.toFixed(1)).length>=13&&(t=this.value.toExponential(13).toUpperCase()):t=this.value.toString(),{$numberDouble:t});var t},e.fromExtendedJSON=function(t,n){var r=parseFloat(t.$numberDouble);return n&&n.relaxed?r:new e(r)},e.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},e.prototype.inspect=function(){var e=this.toExtendedJSON();return"new Double(".concat(e.$numberDouble,")")},e}();Object.defineProperty(Q.prototype,"_bsontype",{value:"Double"});var ee=function(){function e(t){if(!(this instanceof e))return new e(t);t instanceof Number&&(t=t.valueOf()),this.value=0|+t}return e.prototype.valueOf=function(){return this.value},e.prototype.toString=function(e){return this.value.toString(e)},e.prototype.toJSON=function(){return this.value},e.prototype.toExtendedJSON=function(e){return e&&(e.relaxed||e.legacy)?this.value:{$numberInt:this.value.toString()}},e.fromExtendedJSON=function(t,n){return n&&n.relaxed?parseInt(t.$numberInt,10):new e(t.$numberInt)},e.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},e.prototype.inspect=function(){return"new Int32(".concat(this.valueOf(),")")},e}();Object.defineProperty(ee.prototype,"_bsontype",{value:"Int32"});var te=function(){function e(){if(!(this instanceof e))return new e}return e.prototype.toExtendedJSON=function(){return{$maxKey:1}},e.fromExtendedJSON=function(){return new e},e.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},e.prototype.inspect=function(){return"new MaxKey()"},e}();Object.defineProperty(te.prototype,"_bsontype",{value:"MaxKey"});var ne=function(){function e(){if(!(this instanceof e))return new e}return e.prototype.toExtendedJSON=function(){return{$minKey:1}},e.fromExtendedJSON=function(){return new e},e.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},e.prototype.inspect=function(){return"new MinKey()"},e}();Object.defineProperty(ne.prototype,"_bsontype",{value:"MinKey"});var re=new RegExp("^[0-9a-fA-F]{24}$"),ie=null,oe=Symbol("id"),se=function(){function e(t){if(!(this instanceof e))return new e(t);var n;if("object"==typeof t&&t&&"id"in t){if("string"!=typeof t.id&&!ArrayBuffer.isView(t.id))throw new f("Argument passed in must have an id that is of type string or Buffer");n="toHexString"in t&&"function"==typeof t.toHexString?r.Buffer.from(t.toHexString(),"hex"):t.id}else n=t;if(null==n||"number"==typeof n)this[oe]=e.generate("number"==typeof n?n:void 0);else if(ArrayBuffer.isView(n)&&12===n.byteLength)this[oe]=n instanceof r.Buffer?n:S(n);else{if("string"!=typeof n)throw new f("Argument passed in does not match the accepted types");if(12===n.length){var i=r.Buffer.from(n);if(12!==i.byteLength)throw new f("Argument passed in must be a string of 12 bytes");this[oe]=i}else{if(24!==n.length||!re.test(n))throw new f("Argument passed in must be a string of 12 bytes or a string of 24 hex characters or an integer");this[oe]=r.Buffer.from(n,"hex")}}e.cacheHexString&&(this.__id=this.id.toString("hex"))}return Object.defineProperty(e.prototype,"id",{get:function(){return this[oe]},set:function(t){this[oe]=t,e.cacheHexString&&(this.__id=t.toString("hex"))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"generationTime",{get:function(){return this.id.readInt32BE(0)},set:function(e){this.id.writeUInt32BE(e,0)},enumerable:!1,configurable:!0}),e.prototype.toHexString=function(){if(e.cacheHexString&&this.__id)return this.__id;var t=this.id.toString("hex");return e.cacheHexString&&!this.__id&&(this.__id=t),t},e.getInc=function(){return e.index=(e.index+1)%16777215},e.generate=function(t){"number"!=typeof t&&(t=Math.floor(Date.now()/1e3));var n=e.getInc(),i=r.Buffer.alloc(12);return i.writeUInt32BE(t,0),null===ie&&(ie=h(5)),i[4]=ie[0],i[5]=ie[1],i[6]=ie[2],i[7]=ie[3],i[8]=ie[4],i[11]=255&n,i[10]=n>>8&255,i[9]=n>>16&255,i},e.prototype.toString=function(e){return e?this.id.toString(e):this.toHexString()},e.prototype.toJSON=function(){return this.toHexString()},e.prototype.equals=function(t){if(null==t)return!1;if(t instanceof e)return this[oe][11]===t[oe][11]&&this[oe].equals(t[oe]);if("string"==typeof t&&e.isValid(t)&&12===t.length&&g(this.id))return t===r.Buffer.prototype.toString.call(this.id,"latin1");if("string"==typeof t&&e.isValid(t)&&24===t.length)return t.toLowerCase()===this.toHexString();if("string"==typeof t&&e.isValid(t)&&12===t.length)return r.Buffer.from(t).equals(this.id);if("object"==typeof t&&"toHexString"in t&&"function"==typeof t.toHexString){var n=t.toHexString(),i=this.toHexString().toLowerCase();return"string"==typeof n&&n.toLowerCase()===i}return!1},e.prototype.getTimestamp=function(){var e=new Date,t=this.id.readUInt32BE(0);return e.setTime(1e3*Math.floor(t)),e},e.createPk=function(){return new e},e.createFromTime=function(t){var n=r.Buffer.from([0,0,0,0,0,0,0,0,0,0,0,0]);return n.writeUInt32BE(t,0),new e(n)},e.createFromHexString=function(t){if(void 0===t||null!=t&&24!==t.length)throw new f("Argument passed in must be a single String of 12 bytes or a string of 24 hex characters");return new e(r.Buffer.from(t,"hex"))},e.isValid=function(t){if(null==t)return!1;try{return new e(t),!0}catch(e){return!1}},e.prototype.toExtendedJSON=function(){return this.toHexString?{$oid:this.toHexString()}:{$oid:this.toString("hex")}},e.fromExtendedJSON=function(t){return new e(t.$oid)},e.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},e.prototype.inspect=function(){return'new ObjectId("'.concat(this.toHexString(),'")')},e.index=Math.floor(16777215*Math.random()),e}();Object.defineProperty(se.prototype,"generate",{value:_((function(e){return se.generate(e)}),"Please use the static `ObjectId.generate(time)` instead")}),Object.defineProperty(se.prototype,"getInc",{value:_((function(){return se.getInc()}),"Please use the static `ObjectId.getInc()` instead")}),Object.defineProperty(se.prototype,"get_inc",{value:_((function(){return se.getInc()}),"Please use the static `ObjectId.getInc()` instead")}),Object.defineProperty(se,"get_inc",{value:_((function(){return se.getInc()}),"Please use the static `ObjectId.getInc()` instead")}),Object.defineProperty(se.prototype,"_bsontype",{value:"ObjectID"});var ue=function(){function e(t,n){if(!(this instanceof e))return new e(t,n);if(this.pattern=t,this.options=(null!=n?n:"").split("").sort().join(""),-1!==this.pattern.indexOf("\0"))throw new u("BSON Regex patterns cannot contain null bytes, found: ".concat(JSON.stringify(this.pattern)));if(-1!==this.options.indexOf("\0"))throw new u("BSON Regex options cannot contain null bytes, found: ".concat(JSON.stringify(this.options)));for(var r=0;r<this.options.length;r++)if("i"!==this.options[r]&&"m"!==this.options[r]&&"x"!==this.options[r]&&"l"!==this.options[r]&&"s"!==this.options[r]&&"u"!==this.options[r])throw new u("The regular expression option [".concat(this.options[r],"] is not supported"))}return e.parseOptions=function(e){return e?e.split("").sort().join(""):""},e.prototype.toExtendedJSON=function(e){return(e=e||{}).legacy?{$regex:this.pattern,$options:this.options}:{$regularExpression:{pattern:this.pattern,options:this.options}}},e.fromExtendedJSON=function(t){if("$regex"in t){if("string"==typeof t.$regex)return new e(t.$regex,e.parseOptions(t.$options));if("BSONRegExp"===t.$regex._bsontype)return t}if("$regularExpression"in t)return new e(t.$regularExpression.pattern,e.parseOptions(t.$regularExpression.options));throw new f("Unexpected BSONRegExp EJSON object form: ".concat(JSON.stringify(t)))},e}();Object.defineProperty(ue.prototype,"_bsontype",{value:"BSONRegExp"});var fe=function(){function e(t){if(!(this instanceof e))return new e(t);this.value=t}return e.prototype.valueOf=function(){return this.value},e.prototype.toString=function(){return this.value},e.prototype.inspect=function(){return'new BSONSymbol("'.concat(this.value,'")')},e.prototype.toJSON=function(){return this.value},e.prototype.toExtendedJSON=function(){return{$symbol:this.value}},e.fromExtendedJSON=function(t){return new e(t.$symbol)},e.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},e}();Object.defineProperty(fe.prototype,"_bsontype",{value:"Symbol"});var ae=z,ce=function(e){function t(n,r){var i=this;return i instanceof t?(i=z.isLong(n)?e.call(this,n.low,n.high,!0)||this:w(n)&&void 0!==n.t&&void 0!==n.i?e.call(this,n.i,n.t,!0)||this:e.call(this,n,r,!0)||this,Object.defineProperty(i,"_bsontype",{value:"Timestamp",writable:!1,configurable:!1,enumerable:!1}),i):new t(n,r)}return o(t,e),t.prototype.toJSON=function(){return{$timestamp:this.toString()}},t.fromInt=function(e){return new t(z.fromInt(e,!0))},t.fromNumber=function(e){return new t(z.fromNumber(e,!0))},t.fromBits=function(e,n){return new t(e,n)},t.fromString=function(e,n){return new t(z.fromString(e,!0,n))},t.prototype.toExtendedJSON=function(){return{$timestamp:{t:this.high>>>0,i:this.low>>>0}}},t.fromExtendedJSON=function(e){return new t(e.$timestamp)},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){return"new Timestamp({ t: ".concat(this.getHighBits(),", i: ").concat(this.getLowBits()," })")},t.MAX_VALUE=z.MAX_UNSIGNED_VALUE,t}(ae);function le(e){return w(e)&&Reflect.has(e,"_bsontype")&&"string"==typeof e._bsontype}var pe=2147483647,he=-2147483648,de=0x8000000000000000,ge=-0x8000000000000000,ye={$oid:se,$binary:I,$uuid:I,$symbol:fe,$numberInt:ee,$numberDecimal:G,$numberDouble:Q,$numberLong:z,$minKey:ne,$maxKey:te,$regex:ue,$regularExpression:ue,$timestamp:ce};function be(e,t){if(void 0===t&&(t={}),"number"==typeof e){if(t.relaxed||t.legacy)return e;if(Math.floor(e)===e){if(e>=he&&e<=pe)return new ee(e);if(e>=ge&&e<=de)return z.fromNumber(e)}return new Q(e)}if(null==e||"object"!=typeof e)return e;if(e.$undefined)return null;for(var n=Object.keys(e).filter((function(t){return t.startsWith("$")&&null!=e[t]})),r=0;r<n.length;r++){var i=ye[n[r]];if(i)return i.fromExtendedJSON(e,t)}if(null!=e.$date){var o=e.$date,s=new Date;return t.legacy?"number"==typeof o?s.setTime(o):"string"==typeof o&&s.setTime(Date.parse(o)):"string"==typeof o?s.setTime(Date.parse(o)):z.isLong(o)?s.setTime(o.toNumber()):"number"==typeof o&&t.relaxed&&s.setTime(o),s}if(null!=e.$code){var u=Object.assign({},e);return e.$scope&&(u.$scope=be(e.$scope)),A.fromExtendedJSON(e)}if(U(e)||e.$dbPointer){var f=e.$ref?e:e.$dbPointer;if(f instanceof T)return f;var a=Object.keys(f).filter((function(e){return e.startsWith("$")})),c=!0;if(a.forEach((function(e){-1===["$ref","$id","$db"].indexOf(e)&&(c=!1)})),c)return T.fromExtendedJSON(f)}return e}function me(e){var t=e.toISOString();return 0!==e.getUTCMilliseconds()?t:t.slice(0,-5)+"Z"}function ve(e,t){if(("object"==typeof e||"function"==typeof e)&&null!==e){var n=t.seenObjects.findIndex((function(t){return t.obj===e}));if(-1!==n){var r=t.seenObjects.map((function(e){return e.propertyName})),i=r.slice(0,n).map((function(e){return"".concat(e," -> ")})).join(""),o=r[n],s=" -> "+r.slice(n+1,r.length-1).map((function(e){return"".concat(e," -> ")})).join(""),a=r[r.length-1],c=" ".repeat(i.length+o.length/2),l="-".repeat(s.length+(o.length+a.length)/2-1);throw new f("Converting circular structure to EJSON:\n"+" ".concat(i).concat(o).concat(s).concat(a,"\n")+" ".concat(c,"\\").concat(l,"/"))}t.seenObjects[t.seenObjects.length-1].obj=e}if(Array.isArray(e))return function(e,t){return e.map((function(e,n){t.seenObjects.push({propertyName:"index ".concat(n),obj:null});try{return ve(e,t)}finally{t.seenObjects.pop()}}))}(e,t);if(void 0===e)return null;if(e instanceof Date||v(e)){var p=e.getTime(),h=p>-1&&p<2534023188e5;return t.legacy?t.relaxed&&h?{$date:e.getTime()}:{$date:me(e)}:t.relaxed&&h?{$date:me(e)}:{$date:{$numberLong:e.getTime().toString()}}}if(!("number"!=typeof e||t.relaxed&&isFinite(e))){if(Math.floor(e)===e){var d=e>=ge&&e<=de;if(e>=he&&e<=pe)return{$numberInt:e.toString()};if(d)return{$numberLong:e.toString()}}return{$numberDouble:e.toString()}}if(e instanceof RegExp||m(e)){var g=e.flags;if(void 0===g){var y=e.toString().match(/[gimuy]*$/);y&&(g=y[0])}return new ue(e.source,g).toExtendedJSON(t)}return null!=e&&"object"==typeof e?function(e,t){if(null==e||"object"!=typeof e)throw new u("not an object instance");var n=e._bsontype;if(void 0===n){var r={};for(var i in e){t.seenObjects.push({propertyName:i,obj:null});try{var o=ve(e[i],t);"__proto__"===i?Object.defineProperty(r,i,{value:o,writable:!0,enumerable:!0,configurable:!0}):r[i]=o}finally{t.seenObjects.pop()}}return r}if(le(e)){var s=e;if("function"!=typeof s.toExtendedJSON){var a=Se[e._bsontype];if(!a)throw new f("Unrecognized or invalid _bsontype: "+e._bsontype);s=a(s)}return"Code"===n&&s.scope?s=new A(s.code,ve(s.scope,t)):"DBRef"===n&&s.oid&&(s=new T(ve(s.collection,t),ve(s.oid,t),ve(s.db,t),ve(s.fields,t))),s.toExtendedJSON(t)}throw new u("_bsontype must be a string, but was: "+typeof n)}(e,t):e}var we,_e,Se={Binary:function(e){return new I(e.value(),e.sub_type)},Code:function(e){return new A(e.code,e.scope)},DBRef:function(e){return new T(e.collection||e.namespace,e.oid,e.db,e.fields)},Decimal128:function(e){return new G(e.bytes)},Double:function(e){return new Q(e.value)},Int32:function(e){return new ee(e.value)},Long:function(e){return z.fromBits(null!=e.low?e.low:e.low_,null!=e.low?e.high:e.high_,null!=e.low?e.unsigned:e.unsigned_)},MaxKey:function(){return new te},MinKey:function(){return new ne},ObjectID:function(e){return new se(e)},ObjectId:function(e){return new se(e)},BSONRegExp:function(e){return new ue(e.pattern,e.options)},Symbol:function(e){return new fe(e.value)},Timestamp:function(e){return ce.fromBits(e.low,e.high)}};!function(e){function t(e,t){var n=Object.assign({},{relaxed:!0,legacy:!1},t);return"boolean"==typeof n.relaxed&&(n.strict=!n.relaxed),"boolean"==typeof n.strict&&(n.relaxed=!n.strict),JSON.parse(e,(function(e,t){if(-1!==e.indexOf("\0"))throw new u("BSON Document field names cannot contain null bytes, found: ".concat(JSON.stringify(e)));return be(t,n)}))}function n(e,t,n,r){null!=n&&"object"==typeof n&&(r=n,n=0),null==t||"object"!=typeof t||Array.isArray(t)||(r=t,t=void 0,n=0);var i=ve(e,Object.assign({relaxed:!0,legacy:!1},r,{seenObjects:[{propertyName:"(root)",obj:null}]}));return JSON.stringify(i,t,n)}e.parse=t,e.stringify=n,e.serialize=function(e,t){return t=t||{},JSON.parse(n(e,t))},e.deserialize=function(e,n){return n=n||{},t(JSON.stringify(e),n)}}(we||(we={}));var Oe=c();_e=Oe.Map?Oe.Map:function(){function e(e){void 0===e&&(e=[]),this._keys=[],this._values={};for(var t=0;t<e.length;t++)if(null!=e[t]){var n=e[t],r=n[0],i=n[1];this._keys.push(r),this._values[r]={v:i,i:this._keys.length-1}}}return e.prototype.clear=function(){this._keys=[],this._values={}},e.prototype.delete=function(e){var t=this._values[e];return null!=t&&(delete this._values[e],this._keys.splice(t.i,1),!0)},e.prototype.entries=function(){var e=this,t=0;return{next:function(){var n=e._keys[t++];return{value:void 0!==n?[n,e._values[n].v]:void 0,done:void 0===n}}}},e.prototype.forEach=function(e,t){t=t||this;for(var n=0;n<this._keys.length;n++){var r=this._keys[n];e.call(t,this._values[r].v,r,t)}},e.prototype.get=function(e){return this._values[e]?this._values[e].v:void 0},e.prototype.has=function(e){return null!=this._values[e]},e.prototype.keys=function(){var e=this,t=0;return{next:function(){var n=e._keys[t++];return{value:void 0!==n?n:void 0,done:void 0===n}}}},e.prototype.set=function(e,t){return this._values[e]?(this._values[e].v=t,this):(this._keys.push(e),this._values[e]={v:t,i:this._keys.length-1},this)},e.prototype.values=function(){var e=this,t=0;return{next:function(){var n=e._keys[t++];return{value:void 0!==n?e._values[n].v:void 0,done:void 0===n}}}},Object.defineProperty(e.prototype,"size",{get:function(){return this._keys.length},enumerable:!1,configurable:!0}),e}();var xe=2147483647,Be=-2147483648,Ne=Math.pow(2,63)-1,Ee=-Math.pow(2,63),je=Math.pow(2,53),Ie=-Math.pow(2,53),Ae=1,Ue=2,Te=3,Le=4,De=5,$e=6,Re=7,Me=8,Pe=9,ze=10,Je=11,Ce=12,Ye=13,ke=14,Ve=15,Fe=16,qe=17,He=18,Ze=19,Ke=255,We=127,Xe=0,Ge=1,Qe=2,et=3,tt=4,nt=5,rt=6,it=7,ot=128;function st(e,t,n){var r=5;if(Array.isArray(e))for(var i=0;i<e.length;i++)r+=ut(i.toString(),e[i],t,!0,n);else for(var o in"function"==typeof(null==e?void 0:e.toBSON)&&(e=e.toBSON()),e)r+=ut(o,e[o],t,!1,n);return r}function ut(e,t,n,i,o){switch(void 0===n&&(n=!1),void 0===i&&(i=!1),void 0===o&&(o=!1),"function"==typeof(null==t?void 0:t.toBSON)&&(t=t.toBSON()),typeof t){case"string":return 1+r.Buffer.byteLength(e,"utf8")+1+4+r.Buffer.byteLength(t,"utf8")+1;case"number":return Math.floor(t)===t&&t>=Ie&&t<=je&&t>=Be&&t<=xe?(null!=e?r.Buffer.byteLength(e,"utf8")+1:0)+5:(null!=e?r.Buffer.byteLength(e,"utf8")+1:0)+9;case"undefined":return i||!o?(null!=e?r.Buffer.byteLength(e,"utf8")+1:0)+1:0;case"boolean":return(null!=e?r.Buffer.byteLength(e,"utf8")+1:0)+2;case"object":if(null==t||"MinKey"===t._bsontype||"MaxKey"===t._bsontype)return(null!=e?r.Buffer.byteLength(e,"utf8")+1:0)+1;if("ObjectId"===t._bsontype||"ObjectID"===t._bsontype)return(null!=e?r.Buffer.byteLength(e,"utf8")+1:0)+13;if(t instanceof Date||v(t))return(null!=e?r.Buffer.byteLength(e,"utf8")+1:0)+9;if(ArrayBuffer.isView(t)||t instanceof ArrayBuffer||d(t))return(null!=e?r.Buffer.byteLength(e,"utf8")+1:0)+6+t.byteLength;if("Long"===t._bsontype||"Double"===t._bsontype||"Timestamp"===t._bsontype)return(null!=e?r.Buffer.byteLength(e,"utf8")+1:0)+9;if("Decimal128"===t._bsontype)return(null!=e?r.Buffer.byteLength(e,"utf8")+1:0)+17;if("Code"===t._bsontype)return null!=t.scope&&Object.keys(t.scope).length>0?(null!=e?r.Buffer.byteLength(e,"utf8")+1:0)+1+4+4+r.Buffer.byteLength(t.code.toString(),"utf8")+1+st(t.scope,n,o):(null!=e?r.Buffer.byteLength(e,"utf8")+1:0)+1+4+r.Buffer.byteLength(t.code.toString(),"utf8")+1;if("Binary"===t._bsontype){var s=t;return s.sub_type===I.SUBTYPE_BYTE_ARRAY?(null!=e?r.Buffer.byteLength(e,"utf8")+1:0)+(s.position+1+4+1+4):(null!=e?r.Buffer.byteLength(e,"utf8")+1:0)+(s.position+1+4+1)}if("Symbol"===t._bsontype)return(null!=e?r.Buffer.byteLength(e,"utf8")+1:0)+r.Buffer.byteLength(t.value,"utf8")+4+1+1;if("DBRef"===t._bsontype){var u=Object.assign({$ref:t.collection,$id:t.oid},t.fields);return null!=t.db&&(u.$db=t.db),(null!=e?r.Buffer.byteLength(e,"utf8")+1:0)+1+st(u,n,o)}return t instanceof RegExp||m(t)?(null!=e?r.Buffer.byteLength(e,"utf8")+1:0)+1+r.Buffer.byteLength(t.source,"utf8")+1+(t.global?1:0)+(t.ignoreCase?1:0)+(t.multiline?1:0)+1:"BSONRegExp"===t._bsontype?(null!=e?r.Buffer.byteLength(e,"utf8")+1:0)+1+r.Buffer.byteLength(t.pattern,"utf8")+1+r.Buffer.byteLength(t.options,"utf8")+1:(null!=e?r.Buffer.byteLength(e,"utf8")+1:0)+st(t,n,o)+1;case"function":if(t instanceof RegExp||m(t)||"[object RegExp]"===String.call(t))return(null!=e?r.Buffer.byteLength(e,"utf8")+1:0)+1+r.Buffer.byteLength(t.source,"utf8")+1+(t.global?1:0)+(t.ignoreCase?1:0)+(t.multiline?1:0)+1;if(n&&null!=t.scope&&Object.keys(t.scope).length>0)return(null!=e?r.Buffer.byteLength(e,"utf8")+1:0)+1+4+4+r.Buffer.byteLength(l(t),"utf8")+1+st(t.scope,n,o);if(n)return(null!=e?r.Buffer.byteLength(e,"utf8")+1:0)+1+4+r.Buffer.byteLength(l(t),"utf8")+1}return 0}function ft(e,t,n){for(var r=0,i=t;i<n;i+=1){var o=e[i];if(r){if(128!=(192&o))return!1;r-=1}else if(128&o)if(192==(224&o))r=1;else if(224==(240&o))r=2;else{if(240!=(248&o))return!1;r=3}}return!r}var at=z.fromNumber(je),ct=z.fromNumber(Ie),lt={};function pt(e,t,n){var r=(t=null==t?{}:t)&&t.index?t.index:0,i=e[r]|e[r+1]<<8|e[r+2]<<16|e[r+3]<<24;if(i<5)throw new u("bson size must be >= 5, is ".concat(i));if(t.allowObjectSmallerThanBufferSize&&e.length<i)throw new u("buffer length ".concat(e.length," must be >= bson size ").concat(i));if(!t.allowObjectSmallerThanBufferSize&&e.length!==i)throw new u("buffer length ".concat(e.length," must === bson size ").concat(i));if(i+r>e.byteLength)throw new u("(bson size ".concat(i," + options.index ").concat(r," must be <= buffer length ").concat(e.byteLength,")"));if(0!==e[r+i-1])throw new u("One object, sized correctly, with a spot for an EOO, but the EOO isn't 0x00");return dt(e,r,t,n)}var ht=/^\$ref$|^\$id$|^\$db$/;function dt(e,t,n,i){void 0===i&&(i=!1);var o,f=null!=n.evalFunctions&&n.evalFunctions,a=null!=n.cacheFunctions&&n.cacheFunctions,c=null==n.fieldsAsRaw?null:n.fieldsAsRaw,l=null!=n.raw&&n.raw,p="boolean"==typeof n.bsonRegExp&&n.bsonRegExp,h=null!=n.promoteBuffers&&n.promoteBuffers,d=null==n.promoteLongs||n.promoteLongs,g=null==n.promoteValues||n.promoteValues,y=null==n.validation?{utf8:!0}:n.validation,b=!0,m=new Set,v=y.utf8;if("boolean"==typeof v)o=v;else{b=!1;var w=Object.keys(v).map((function(e){return v[e]}));if(0===w.length)throw new u("UTF-8 validation setting cannot be empty");if("boolean"!=typeof w[0])throw new u("Invalid UTF-8 validation option, must specify boolean values");if(o=w[0],!w.every((function(e){return e===o})))throw new u("Invalid UTF-8 validation option - keys must be all true or all false")}if(!b)for(var _=0,S=Object.keys(v);_<S.length;_++){var O=S[_];m.add(O)}var x=t;if(e.length<5)throw new u("corrupt bson message < 5 bytes long");var B=e[t++]|e[t++]<<8|e[t++]<<16|e[t++]<<24;if(B<5||B>e.length)throw new u("corrupt bson message");for(var N=i?[]:{},E=0,j=!i&&null,L=new DataView(e.buffer,e.byteOffset,e.byteLength);;){var D=e[t++];if(0===D)break;for(var $=t;0!==e[$]&&$<e.length;)$++;if($>=e.byteLength)throw new u("Bad BSON Document: illegal CString");var R=i?E++:e.toString("utf8",t,$),M=!0;M=b||m.has(R)?o:!o,!1!==j&&"$"===R[0]&&(j=ht.test(R));var P=void 0;if(t=$+1,D===Ue){if((me=e[t++]|e[t++]<<8|e[t++]<<16|e[t++]<<24)<=0||me>e.length-t||0!==e[t+me-1])throw new u("bad string length in bson");P=yt(e,t,t+me-1,M),t+=me}else if(D===Re){var J=r.Buffer.alloc(12);e.copy(J,0,t,t+12),P=new se(J),t+=12}else if(D===Fe&&!1===g)P=new ee(e[t++]|e[t++]<<8|e[t++]<<16|e[t++]<<24);else if(D===Fe)P=e[t++]|e[t++]<<8|e[t++]<<16|e[t++]<<24;else if(D===Ae&&!1===g)P=new Q(L.getFloat64(t,!0)),t+=8;else if(D===Ae)P=L.getFloat64(t,!0),t+=8;else if(D===Pe){var C=e[t++]|e[t++]<<8|e[t++]<<16|e[t++]<<24,Y=e[t++]|e[t++]<<8|e[t++]<<16|e[t++]<<24;P=new Date(new z(C,Y).toNumber())}else if(D===Me){if(0!==e[t]&&1!==e[t])throw new u("illegal boolean type value");P=1===e[t++]}else if(D===Te){var k=t;if((ye=e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)<=0||ye>e.length-t)throw new u("bad embedded document length in bson");if(l)P=e.slice(t,t+ye);else{var V=n;b||(V=s(s({},n),{validation:{utf8:M}})),P=dt(e,k,V,!1)}t+=ye}else if(D===Le){k=t;var F=n,q=t+(ye=e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24);if(c&&c[R]){for(var H in F={},n)F[H]=n[H];F.raw=!0}if(b||(F=s(s({},F),{validation:{utf8:M}})),P=dt(e,k,F,!0),0!==e[(t+=ye)-1])throw new u("invalid array terminator byte");if(t!==q)throw new u("corrupted array bson")}else if(D===$e)P=void 0;else if(D===ze)P=null;else if(D===He){C=e[t++]|e[t++]<<8|e[t++]<<16|e[t++]<<24,Y=e[t++]|e[t++]<<8|e[t++]<<16|e[t++]<<24;var Z=new z(C,Y);P=d&&!0===g&&Z.lessThanOrEqual(at)&&Z.greaterThanOrEqual(ct)?Z.toNumber():Z}else if(D===Ze){var K=r.Buffer.alloc(16);e.copy(K,0,t,t+16),t+=16;var W=new G(K);P="toObject"in W&&"function"==typeof W.toObject?W.toObject():W}else if(D===De){var X=e[t++]|e[t++]<<8|e[t++]<<16|e[t++]<<24,re=X,ie=e[t++];if(X<0)throw new u("Negative binary type element size found");if(X>e.byteLength)throw new u("Binary type size larger than document size");if(null!=e.slice){if(ie===I.SUBTYPE_BYTE_ARRAY){if((X=e[t++]|e[t++]<<8|e[t++]<<16|e[t++]<<24)<0)throw new u("Negative binary type element size found for subtype 0x02");if(X>re-4)throw new u("Binary type with subtype 0x02 contains too long binary size");if(X<re-4)throw new u("Binary type with subtype 0x02 contains too short binary size")}P=h&&g?e.slice(t,t+X):new I(e.slice(t,t+X),ie)}else{var oe=r.Buffer.alloc(X);if(ie===I.SUBTYPE_BYTE_ARRAY){if((X=e[t++]|e[t++]<<8|e[t++]<<16|e[t++]<<24)<0)throw new u("Negative binary type element size found for subtype 0x02");if(X>re-4)throw new u("Binary type with subtype 0x02 contains too long binary size");if(X<re-4)throw new u("Binary type with subtype 0x02 contains too short binary size")}for($=0;$<X;$++)oe[$]=e[t+$];P=h&&g?oe:new I(oe,ie)}t+=X}else if(D===Je&&!1===p){for($=t;0!==e[$]&&$<e.length;)$++;if($>=e.length)throw new u("Bad BSON Document: illegal CString");var ae=e.toString("utf8",t,$);for($=t=$+1;0!==e[$]&&$<e.length;)$++;if($>=e.length)throw new u("Bad BSON Document: illegal CString");var le=e.toString("utf8",t,$);t=$+1;var pe=new Array(le.length);for($=0;$<le.length;$++)switch(le[$]){case"m":pe[$]="m";break;case"s":pe[$]="g";break;case"i":pe[$]="i"}P=new RegExp(ae,pe.join(""))}else if(D===Je&&!0===p){for($=t;0!==e[$]&&$<e.length;)$++;if($>=e.length)throw new u("Bad BSON Document: illegal CString");ae=e.toString("utf8",t,$);for($=t=$+1;0!==e[$]&&$<e.length;)$++;if($>=e.length)throw new u("Bad BSON Document: illegal CString");le=e.toString("utf8",t,$);t=$+1,P=new ue(ae,le)}else if(D===ke){if((me=e[t++]|e[t++]<<8|e[t++]<<16|e[t++]<<24)<=0||me>e.length-t||0!==e[t+me-1])throw new u("bad string length in bson");var he=yt(e,t,t+me-1,M);P=g?he:new fe(he),t+=me}else if(D===qe){C=e[t++]|e[t++]<<8|e[t++]<<16|e[t++]<<24,Y=e[t++]|e[t++]<<8|e[t++]<<16|e[t++]<<24;P=new ce(C,Y)}else if(D===Ke)P=new ne;else if(D===We)P=new te;else if(D===Ye){if((me=e[t++]|e[t++]<<8|e[t++]<<16|e[t++]<<24)<=0||me>e.length-t||0!==e[t+me-1])throw new u("bad string length in bson");var de=yt(e,t,t+me-1,M);P=f?a?gt(de,lt,N):gt(de):new A(de),t+=me}else if(D===Ve){var ge=e[t++]|e[t++]<<8|e[t++]<<16|e[t++]<<24;if(ge<13)throw new u("code_w_scope total size shorter minimum expected length");if((me=e[t++]|e[t++]<<8|e[t++]<<16|e[t++]<<24)<=0||me>e.length-t||0!==e[t+me-1])throw new u("bad string length in bson");de=yt(e,t,t+me-1,M),k=t+=me;var ye=e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24,be=dt(e,k,n,!1);if(t+=ye,ge<8+ye+me)throw new u("code_w_scope total size is too short, truncating scope");if(ge>8+ye+me)throw new u("code_w_scope total size is too long, clips outer document");f?(P=a?gt(de,lt,N):gt(de)).scope=be:P=new A(de,be)}else{if(D!==Ce)throw new u("Detected unknown BSON type ".concat(D.toString(16),' for fieldname "').concat(R,'"'));var me;if((me=e[t++]|e[t++]<<8|e[t++]<<16|e[t++]<<24)<=0||me>e.length-t||0!==e[t+me-1])throw new u("bad string length in bson");if(null!=y&&y.utf8&&!ft(e,t,t+me-1))throw new u("Invalid UTF-8 string in BSON document");var ve=e.toString("utf8",t,t+me-1);t+=me;var we=r.Buffer.alloc(12);e.copy(we,0,t,t+12);J=new se(we);t+=12,P=new T(ve,J)}"__proto__"===R?Object.defineProperty(N,R,{value:P,writable:!0,enumerable:!0,configurable:!0}):N[R]=P}if(B!==t-x){if(i)throw new u("corrupt array bson");throw new u("corrupt object bson")}if(!j)return N;if(U(N)){var _e=Object.assign({},N);return delete _e.$ref,delete _e.$id,delete _e.$db,new T(N.$ref,N.$id,N.$db,_e)}return N}function gt(e,t,n){return t?(null==t[e]&&(t[e]=new Function(e)),t[e].bind(n)):new Function(e)}function yt(e,t,n,r){var i=e.toString("utf8",t,n);if(r)for(var o=0;o<i.length;o++)if(65533===i.charCodeAt(o)){if(!ft(e,t,n))throw new u("Invalid UTF-8 string in BSON document");break}return i}var bt=/\x00/,mt=new Set(["$db","$ref","$id","$clusterTime"]);function vt(e,t,n,r,i){e[r++]=Ue;var o=i?e.write(t,r,void 0,"ascii"):e.write(t,r,void 0,"utf8");e[(r=r+o+1)-1]=0;var s=e.write(n,r+4,void 0,"utf8");return e[r+3]=s+1>>24&255,e[r+2]=s+1>>16&255,e[r+1]=s+1>>8&255,e[r]=s+1&255,r=r+4+s,e[r++]=0,r}var wt=new Uint8Array(8),_t=new DataView(wt.buffer,wt.byteOffset,wt.byteLength);function St(e,t,n,r,i){Number.isInteger(n)&&n>=Be&&n<=xe?(e[r++]=Fe,r+=i?e.write(t,r,void 0,"ascii"):e.write(t,r,void 0,"utf8"),e[r++]=0,e[r++]=255&n,e[r++]=n>>8&255,e[r++]=n>>16&255,e[r++]=n>>24&255):(e[r++]=Ae,r+=i?e.write(t,r,void 0,"ascii"):e.write(t,r,void 0,"utf8"),e[r++]=0,_t.setFloat64(0,n,!0),e.set(wt,r),r+=8);return r}function Ot(e,t,n,r,i){return e[r++]=ze,r+=i?e.write(t,r,void 0,"ascii"):e.write(t,r,void 0,"utf8"),e[r++]=0,r}function xt(e,t,n,r,i){return e[r++]=Me,r+=i?e.write(t,r,void 0,"ascii"):e.write(t,r,void 0,"utf8"),e[r++]=0,e[r++]=n?1:0,r}function Bt(e,t,n,r,i){e[r++]=Pe,r+=i?e.write(t,r,void 0,"ascii"):e.write(t,r,void 0,"utf8"),e[r++]=0;var o=z.fromNumber(n.getTime()),s=o.getLowBits(),u=o.getHighBits();return e[r++]=255&s,e[r++]=s>>8&255,e[r++]=s>>16&255,e[r++]=s>>24&255,e[r++]=255&u,e[r++]=u>>8&255,e[r++]=u>>16&255,e[r++]=u>>24&255,r}function Nt(e,t,n,r,i){if(e[r++]=Je,r+=i?e.write(t,r,void 0,"ascii"):e.write(t,r,void 0,"utf8"),e[r++]=0,n.source&&null!=n.source.match(bt))throw Error("value "+n.source+" must not contain null bytes");return r+=e.write(n.source,r,void 0,"utf8"),e[r++]=0,n.ignoreCase&&(e[r++]=105),n.global&&(e[r++]=115),n.multiline&&(e[r++]=109),e[r++]=0,r}function Et(e,t,n,r,i){if(e[r++]=Je,r+=i?e.write(t,r,void 0,"ascii"):e.write(t,r,void 0,"utf8"),e[r++]=0,null!=n.pattern.match(bt))throw Error("pattern "+n.pattern+" must not contain null bytes");return r+=e.write(n.pattern,r,void 0,"utf8"),e[r++]=0,r+=e.write(n.options.split("").sort().join(""),r,void 0,"utf8"),e[r++]=0,r}function jt(e,t,n,r,i){return null===n?e[r++]=ze:"MinKey"===n._bsontype?e[r++]=Ke:e[r++]=We,r+=i?e.write(t,r,void 0,"ascii"):e.write(t,r,void 0,"utf8"),e[r++]=0,r}function It(e,t,n,r,i){if(e[r++]=Re,r+=i?e.write(t,r,void 0,"ascii"):e.write(t,r,void 0,"utf8"),e[r++]=0,"string"==typeof n.id)e.write(n.id,r,void 0,"binary");else{if(!g(n.id))throw new f("object ["+JSON.stringify(n)+"] is not a valid ObjectId");e.set(n.id.subarray(0,12),r)}return r+12}function At(e,t,n,r,i){e[r++]=De,r+=i?e.write(t,r,void 0,"ascii"):e.write(t,r,void 0,"utf8"),e[r++]=0;var o=n.length;return e[r++]=255&o,e[r++]=o>>8&255,e[r++]=o>>16&255,e[r++]=o>>24&255,e[r++]=Xe,e.set(S(n),r),r+=o}function Ut(e,t,n,r,i,o,s,f,a,c){void 0===i&&(i=!1),void 0===o&&(o=0),void 0===s&&(s=!1),void 0===f&&(f=!0),void 0===a&&(a=!1),void 0===c&&(c=[]);for(var l=0;l<c.length;l++)if(c[l]===n)throw new u("cyclic dependency detected");c.push(n),e[r++]=Array.isArray(n)?Le:Te,r+=a?e.write(t,r,void 0,"ascii"):e.write(t,r,void 0,"utf8"),e[r++]=0;var p=Ct(e,n,i,r,o+1,s,f,c);return c.pop(),p}function Tt(e,t,n,r,i){return e[r++]=Ze,r+=i?e.write(t,r,void 0,"ascii"):e.write(t,r,void 0,"utf8"),e[r++]=0,e.set(n.bytes.subarray(0,16),r),r+16}function Lt(e,t,n,r,i){e[r++]="Long"===n._bsontype?He:qe,r+=i?e.write(t,r,void 0,"ascii"):e.write(t,r,void 0,"utf8"),e[r++]=0;var o=n.getLowBits(),s=n.getHighBits();return e[r++]=255&o,e[r++]=o>>8&255,e[r++]=o>>16&255,e[r++]=o>>24&255,e[r++]=255&s,e[r++]=s>>8&255,e[r++]=s>>16&255,e[r++]=s>>24&255,r}function Dt(e,t,n,r,i){return n=n.valueOf(),e[r++]=Fe,r+=i?e.write(t,r,void 0,"ascii"):e.write(t,r,void 0,"utf8"),e[r++]=0,e[r++]=255&n,e[r++]=n>>8&255,e[r++]=n>>16&255,e[r++]=n>>24&255,r}function $t(e,t,n,r,i){return e[r++]=Ae,r+=i?e.write(t,r,void 0,"ascii"):e.write(t,r,void 0,"utf8"),e[r++]=0,_t.setFloat64(0,n.value,!0),e.set(wt,r),r+=8}function Rt(e,t,n,r,i,o,s){e[r++]=Ye,r+=s?e.write(t,r,void 0,"ascii"):e.write(t,r,void 0,"utf8"),e[r++]=0;var u=l(n),f=e.write(u,r+4,void 0,"utf8")+1;return e[r]=255&f,e[r+1]=f>>8&255,e[r+2]=f>>16&255,e[r+3]=f>>24&255,r=r+4+f-1,e[r++]=0,r}function Mt(e,t,n,r,i,o,s,u,f){if(void 0===i&&(i=!1),void 0===o&&(o=0),void 0===s&&(s=!1),void 0===u&&(u=!0),void 0===f&&(f=!1),n.scope&&"object"==typeof n.scope){e[r++]=Ve,r+=f?e.write(t,r,void 0,"ascii"):e.write(t,r,void 0,"utf8"),e[r++]=0;var a=r,c="string"==typeof n.code?n.code:n.code.toString();r+=4;var l=e.write(c,r+4,void 0,"utf8")+1;e[r]=255&l,e[r+1]=l>>8&255,e[r+2]=l>>16&255,e[r+3]=l>>24&255,e[r+4+l-1]=0,r=r+l+4;var p=Ct(e,n.scope,i,r,o+1,s,u);r=p-1;var h=p-a;e[a++]=255&h,e[a++]=h>>8&255,e[a++]=h>>16&255,e[a++]=h>>24&255,e[r++]=0}else{e[r++]=Ye,r+=f?e.write(t,r,void 0,"ascii"):e.write(t,r,void 0,"utf8"),e[r++]=0;c=n.code.toString();var d=e.write(c,r+4,void 0,"utf8")+1;e[r]=255&d,e[r+1]=d>>8&255,e[r+2]=d>>16&255,e[r+3]=d>>24&255,r=r+4+d-1,e[r++]=0}return r}function Pt(e,t,n,r,i){e[r++]=De,r+=i?e.write(t,r,void 0,"ascii"):e.write(t,r,void 0,"utf8"),e[r++]=0;var o=n.value(!0),s=n.position;return n.sub_type===I.SUBTYPE_BYTE_ARRAY&&(s+=4),e[r++]=255&s,e[r++]=s>>8&255,e[r++]=s>>16&255,e[r++]=s>>24&255,e[r++]=n.sub_type,n.sub_type===I.SUBTYPE_BYTE_ARRAY&&(s-=4,e[r++]=255&s,e[r++]=s>>8&255,e[r++]=s>>16&255,e[r++]=s>>24&255),e.set(o,r),r+=n.position}function zt(e,t,n,r,i){e[r++]=ke,r+=i?e.write(t,r,void 0,"ascii"):e.write(t,r,void 0,"utf8"),e[r++]=0;var o=e.write(n.value,r+4,void 0,"utf8")+1;return e[r]=255&o,e[r+1]=o>>8&255,e[r+2]=o>>16&255,e[r+3]=o>>24&255,r=r+4+o-1,e[r++]=0,r}function Jt(e,t,n,r,i,o,s){e[r++]=Te,r+=s?e.write(t,r,void 0,"ascii"):e.write(t,r,void 0,"utf8"),e[r++]=0;var u=r,f={$ref:n.collection||n.namespace,$id:n.oid};null!=n.db&&(f.$db=n.db);var a=Ct(e,f=Object.assign(f,n.fields),!1,r,i+1,o),c=a-u;return e[u++]=255&c,e[u++]=c>>8&255,e[u++]=c>>16&255,e[u++]=c>>24&255,a}function Ct(e,t,n,r,i,o,s,u){void 0===n&&(n=!1),void 0===r&&(r=0),void 0===i&&(i=0),void 0===o&&(o=!1),void 0===s&&(s=!0),void 0===u&&(u=[]),r=r||0,(u=u||[]).push(t);var a,c=r+4;if(Array.isArray(t))for(var l=0;l<t.length;l++){var p="".concat(l);if("function"==typeof(null==(S=t[l])?void 0:S.toBSON)&&(S=S.toBSON()),"string"==typeof S)c=vt(e,p,S,c,!0);else if("number"==typeof S)c=St(e,p,S,c,!0);else{if("bigint"==typeof S)throw new f("Unsupported type BigInt, please use Decimal128");if("boolean"==typeof S)c=xt(e,p,S,c,!0);else if(S instanceof Date||v(S))c=Bt(e,p,S,c,!0);else if(void 0===S)c=Ot(e,p,0,c,!0);else if(null===S)c=Ot(e,p,0,c,!0);else if("ObjectId"===S._bsontype||"ObjectID"===S._bsontype)c=It(e,p,S,c,!0);else if(g(S))c=At(e,p,S,c,!0);else if(S instanceof RegExp||m(S))c=Nt(e,p,S,c,!0);else if("object"==typeof S&&null==S._bsontype)c=Ut(e,p,S,c,n,i,o,s,!0,u);else if("object"==typeof S&&le(S)&&"Decimal128"===S._bsontype)c=Tt(e,p,S,c,!0);else if("Long"===S._bsontype||"Timestamp"===S._bsontype)c=Lt(e,p,S,c,!0);else if("Double"===S._bsontype)c=$t(e,p,S,c,!0);else if("function"==typeof S&&o)c=Rt(e,p,S,c,0,0,!0);else if("Code"===S._bsontype)c=Mt(e,p,S,c,n,i,o,s,!0);else if("Binary"===S._bsontype)c=Pt(e,p,S,c,!0);else if("Symbol"===S._bsontype)c=zt(e,p,S,c,!0);else if("DBRef"===S._bsontype)c=Jt(e,p,S,c,i,o,!0);else if("BSONRegExp"===S._bsontype)c=Et(e,p,S,c,!0);else if("Int32"===S._bsontype)c=Dt(e,p,S,c,!0);else if("MinKey"===S._bsontype||"MaxKey"===S._bsontype)c=jt(e,p,S,c,!0);else if(void 0!==S._bsontype)throw new f("Unrecognized or invalid _bsontype: ".concat(String(S._bsontype)))}}else if(t instanceof _e||(a=t,"[object Map]"===Object.prototype.toString.call(a)))for(var h=t.entries(),d=!1;!d;){var w=h.next();if(!(d=!!w.done)){p=w.value[0];var _=typeof(S=w.value[1]);if("string"==typeof p&&!mt.has(p)){if(null!=p.match(bt))throw Error("key "+p+" must not contain null bytes");if(n){if("$"===p[0])throw Error("key "+p+" must not start with '$'");if(~p.indexOf("."))throw Error("key "+p+" must not contain '.'")}}if("string"===_)c=vt(e,p,S,c);else if("number"===_)c=St(e,p,S,c);else{if("bigint"===_||y(S)||b(S))throw new f("Unsupported type BigInt, please use Decimal128");if("boolean"===_)c=xt(e,p,S,c);else if(S instanceof Date||v(S))c=Bt(e,p,S,c);else if(null===S||void 0===S&&!1===s)c=Ot(e,p,0,c);else if("ObjectId"===S._bsontype||"ObjectID"===S._bsontype)c=It(e,p,S,c);else if(g(S))c=At(e,p,S,c);else if(S instanceof RegExp||m(S))c=Nt(e,p,S,c);else if("object"===_&&null==S._bsontype)c=Ut(e,p,S,c,n,i,o,s,!1,u);else if("object"===_&&"Decimal128"===S._bsontype)c=Tt(e,p,S,c);else if("Long"===S._bsontype||"Timestamp"===S._bsontype)c=Lt(e,p,S,c);else if("Double"===S._bsontype)c=$t(e,p,S,c);else if("Code"===S._bsontype)c=Mt(e,p,S,c,n,i,o,s);else if("function"==typeof S&&o)c=Rt(e,p,S,c,0,0,o);else if("Binary"===S._bsontype)c=Pt(e,p,S,c);else if("Symbol"===S._bsontype)c=zt(e,p,S,c);else if("DBRef"===S._bsontype)c=Jt(e,p,S,c,i,o);else if("BSONRegExp"===S._bsontype)c=Et(e,p,S,c);else if("Int32"===S._bsontype)c=Dt(e,p,S,c);else if("MinKey"===S._bsontype||"MaxKey"===S._bsontype)c=jt(e,p,S,c);else if(void 0!==S._bsontype)throw new f("Unrecognized or invalid _bsontype: ".concat(String(S._bsontype)))}}}else{if("function"==typeof(null==t?void 0:t.toBSON)&&null!=(t=t.toBSON())&&"object"!=typeof t)throw new f("toBSON function did not return an object");for(var p in t){var S;"function"==typeof(null==(S=t[p])?void 0:S.toBSON)&&(S=S.toBSON());_=typeof S;if("string"==typeof p&&!mt.has(p)){if(null!=p.match(bt))throw Error("key "+p+" must not contain null bytes");if(n){if("$"===p[0])throw Error("key "+p+" must not start with '$'");if(~p.indexOf("."))throw Error("key "+p+" must not contain '.'")}}if("string"===_)c=vt(e,p,S,c);else if("number"===_)c=St(e,p,S,c);else{if("bigint"===_)throw new f("Unsupported type BigInt, please use Decimal128");if("boolean"===_)c=xt(e,p,S,c);else if(S instanceof Date||v(S))c=Bt(e,p,S,c);else if(void 0===S)!1===s&&(c=Ot(e,p,0,c));else if(null===S)c=Ot(e,p,0,c);else if("ObjectId"===S._bsontype||"ObjectID"===S._bsontype)c=It(e,p,S,c);else if(g(S))c=At(e,p,S,c);else if(S instanceof RegExp||m(S))c=Nt(e,p,S,c);else if("object"===_&&null==S._bsontype)c=Ut(e,p,S,c,n,i,o,s,!1,u);else if("object"===_&&"Decimal128"===S._bsontype)c=Tt(e,p,S,c);else if("Long"===S._bsontype||"Timestamp"===S._bsontype)c=Lt(e,p,S,c);else if("Double"===S._bsontype)c=$t(e,p,S,c);else if("Code"===S._bsontype)c=Mt(e,p,S,c,n,i,o,s);else if("function"==typeof S&&o)c=Rt(e,p,S,c,0,0,o);else if("Binary"===S._bsontype)c=Pt(e,p,S,c);else if("Symbol"===S._bsontype)c=zt(e,p,S,c);else if("DBRef"===S._bsontype)c=Jt(e,p,S,c,i,o);else if("BSONRegExp"===S._bsontype)c=Et(e,p,S,c);else if("Int32"===S._bsontype)c=Dt(e,p,S,c);else if("MinKey"===S._bsontype||"MaxKey"===S._bsontype)c=jt(e,p,S,c);else if(void 0!==S._bsontype)throw new f("Unrecognized or invalid _bsontype: ".concat(String(S._bsontype)))}}}u.pop(),e[c++]=0;var O=c-r;return e[r++]=255&O,e[r++]=O>>8&255,e[r++]=O>>16&255,e[r++]=O>>24&255,c}var Yt=17825792,kt=r.Buffer.alloc(Yt);function Vt(e){kt.length<e&&(kt=r.Buffer.alloc(e))}function Ft(e,t){void 0===t&&(t={});var n="boolean"==typeof t.checkKeys&&t.checkKeys,i="boolean"==typeof t.serializeFunctions&&t.serializeFunctions,o="boolean"!=typeof t.ignoreUndefined||t.ignoreUndefined,s="number"==typeof t.minInternalBufferSize?t.minInternalBufferSize:Yt;kt.length<s&&(kt=r.Buffer.alloc(s));var u=Ct(kt,e,n,0,0,i,o,[]),f=r.Buffer.alloc(u);return kt.copy(f,0,0,f.length),f}function qt(e,t,n){void 0===n&&(n={});var r="boolean"==typeof n.checkKeys&&n.checkKeys,i="boolean"==typeof n.serializeFunctions&&n.serializeFunctions,o="boolean"!=typeof n.ignoreUndefined||n.ignoreUndefined,s="number"==typeof n.index?n.index:0,u=Ct(kt,e,r,0,0,i,o);return kt.copy(t,s,0,u),s+u-1}function Ht(e,t){return void 0===t&&(t={}),pt(e instanceof r.Buffer?e:S(e),t)}function Zt(e,t){return void 0===t&&(t={}),st(e,"boolean"==typeof(t=t||{}).serializeFunctions&&t.serializeFunctions,"boolean"!=typeof t.ignoreUndefined||t.ignoreUndefined)}function Kt(e,t,n,r,i,o){for(var s=Object.assign({allowObjectSmallerThanBufferSize:!0,index:0},o),u=S(e),f=t,a=0;a<n;a++){var c=u[f]|u[f+1]<<8|u[f+2]<<16|u[f+3]<<24;s.index=f,r[i+a]=pt(u,s),f+=c}return f}var Wt={Binary:I,Code:A,DBRef:T,Decimal128:G,Double:Q,Int32:ee,Long:z,UUID:j,Map:_e,MaxKey:te,MinKey:ne,ObjectId:se,ObjectID:se,BSONRegExp:ue,BSONSymbol:fe,Timestamp:ce,EJSON:we,setInternalBufferSize:Vt,serialize:Ft,serializeWithBufferAndIndex:qt,deserialize:Ht,calculateObjectSize:Zt,deserializeStream:Kt,BSONError:u,BSONTypeError:f};t.default=Wt},function(e,t){e.exports=require("interruptor")}])}));
1
+ /*! For license information please see child-process-proxy.js.LICENSE.txt */
2
+ !function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var n=t();for(var r in n)("object"==typeof exports?exports:e)[r]=n[r]}}(global,(()=>(()=>{var e={699:(e,t,n)=>{"use strict";n.r(t),n.d(t,{BSONError:()=>u,BSONRegExp:()=>Ye,BSONSymbol:()=>ke,BSONTypeError:()=>f,BSON_BINARY_SUBTYPE_BYTE_ARRAY:()=>ne,BSON_BINARY_SUBTYPE_COLUMN:()=>ue,BSON_BINARY_SUBTYPE_DEFAULT:()=>ee,BSON_BINARY_SUBTYPE_ENCRYPTED:()=>se,BSON_BINARY_SUBTYPE_FUNCTION:()=>te,BSON_BINARY_SUBTYPE_MD5:()=>oe,BSON_BINARY_SUBTYPE_USER_DEFINED:()=>fe,BSON_BINARY_SUBTYPE_UUID:()=>re,BSON_BINARY_SUBTYPE_UUID_NEW:()=>ie,BSON_DATA_ARRAY:()=>R,BSON_DATA_BINARY:()=>M,BSON_DATA_BOOLEAN:()=>J,BSON_DATA_CODE:()=>F,BSON_DATA_CODE_W_SCOPE:()=>H,BSON_DATA_DATE:()=>C,BSON_DATA_DBPOINTER:()=>V,BSON_DATA_DECIMAL128:()=>X,BSON_DATA_INT:()=>Z,BSON_DATA_LONG:()=>W,BSON_DATA_MAX_KEY:()=>Q,BSON_DATA_MIN_KEY:()=>G,BSON_DATA_NULL:()=>Y,BSON_DATA_NUMBER:()=>T,BSON_DATA_OBJECT:()=>$,BSON_DATA_OID:()=>z,BSON_DATA_REGEXP:()=>k,BSON_DATA_STRING:()=>D,BSON_DATA_SYMBOL:()=>q,BSON_DATA_TIMESTAMP:()=>K,BSON_DATA_UNDEFINED:()=>P,BSON_INT32_MAX:()=>E,BSON_INT32_MIN:()=>j,BSON_INT64_MAX:()=>I,BSON_INT64_MIN:()=>A,Binary:()=>ae,Code:()=>ce,DBRef:()=>he,Decimal128:()=>Te,Double:()=>De,EJSON:()=>tt,Int32:()=>$e,Long:()=>we,LongWithoutOverridesClass:()=>Ve,Map:()=>nt,MaxKey:()=>Re,MinKey:()=>Me,ObjectID:()=>Ce,ObjectId:()=>Ce,Timestamp:()=>Fe,UUID:()=>le,calculateObjectSize:()=>Ht,default:()=>Kt,deserialize:()=>qt,deserializeStream:()=>Zt,serialize:()=>Vt,serializeWithBufferAndIndex:()=>Ft,setInternalBufferSize:()=>kt});const r=require("buffer");var i=function(e,t){return i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},i(e,t)};function o(e,t){function n(){this.constructor=e}i(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var s=function(){return s=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},s.apply(this,arguments)},u=function(e){function t(n){var r=e.call(this,n)||this;return Object.setPrototypeOf(r,t.prototype),r}return o(t,e),Object.defineProperty(t.prototype,"name",{get:function(){return"BSONError"},enumerable:!1,configurable:!0}),t}(Error),f=function(e){function t(n){var r=e.call(this,n)||this;return Object.setPrototypeOf(r,t.prototype),r}return o(t,e),Object.defineProperty(t.prototype,"name",{get:function(){return"BSONTypeError"},enumerable:!1,configurable:!0}),t}(TypeError);function a(e){return e&&e.Math==Math&&e}function l(){return a("object"==typeof globalThis&&globalThis)||a("object"==typeof window&&window)||a("object"==typeof self&&self)||a("object"==typeof global&&global)||Function("return this")()}function c(e){return e.toString().replace("function(","function (")}var p=function(e){var t,n="object"==typeof(t=l()).navigator&&"ReactNative"===t.navigator.product?"BSON: For React Native please polyfill crypto.getRandomValues, e.g. using: https://www.npmjs.com/package/react-native-get-random-values.":"BSON: No cryptographic implementation for random bytes present, falling back to a less secure implementation.";console.warn(n);for(var i=r.Buffer.alloc(e),o=0;o<e;++o)i[o]=Math.floor(256*Math.random());return i},h=function(){var e=void 0;try{e=n(113).randomBytes}catch(e){}return e||p}();function g(e){return["[object ArrayBuffer]","[object SharedArrayBuffer]"].includes(Object.prototype.toString.call(e))}function d(e){return"[object Uint8Array]"===Object.prototype.toString.call(e)}function y(e){return"[object BigInt64Array]"===Object.prototype.toString.call(e)}function b(e){return"[object BigUint64Array]"===Object.prototype.toString.call(e)}function m(e){return"[object RegExp]"===Object.prototype.toString.call(e)}function v(e){return w(e)&&"[object Date]"===Object.prototype.toString.call(e)}function w(e){return"object"==typeof e&&null!==e}function _(e,t){var n=!1;return function(){for(var r=[],i=0;i<arguments.length;i++)r[i]=arguments[i];return n||(console.warn(t),n=!0),e.apply(this,r)}}function S(e){if(ArrayBuffer.isView(e))return r.Buffer.from(e.buffer,e.byteOffset,e.byteLength);if(g(e))return r.Buffer.from(e);throw new f("Must use either Buffer or TypedArray")}var O=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|[0-9a-f]{12}4[0-9a-f]{3}[89ab][0-9a-f]{15})$/i,x=function(e){return"string"==typeof e&&O.test(e)},B=function(e){if(!x(e))throw new f('UUID string representations must be a 32 or 36 character hex string (dashes excluded/included). Format: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" or "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx".');var t=e.replace(/-/g,"");return r.Buffer.from(t,"hex")},N=function(e,t){return void 0===t&&(t=!0),t?e.toString("hex",0,4)+"-"+e.toString("hex",4,6)+"-"+e.toString("hex",6,8)+"-"+e.toString("hex",8,10)+"-"+e.toString("hex",10,16):e.toString("hex")},E=2147483647,j=-2147483648,I=Math.pow(2,63)-1,A=-Math.pow(2,63),U=Math.pow(2,53),L=-Math.pow(2,53),T=1,D=2,$=3,R=4,M=5,P=6,z=7,J=8,C=9,Y=10,k=11,V=12,F=13,q=14,H=15,Z=16,K=17,W=18,X=19,G=255,Q=127,ee=0,te=1,ne=2,re=3,ie=4,oe=5,se=6,ue=7,fe=128,ae=function(){function e(t,n){if(!(this instanceof e))return new e(t,n);if(!(null==t||"string"==typeof t||ArrayBuffer.isView(t)||t instanceof ArrayBuffer||Array.isArray(t)))throw new f("Binary can only be constructed from string, Buffer, TypedArray, or Array<number>");this.sub_type=null!=n?n:e.BSON_BINARY_SUBTYPE_DEFAULT,null==t?(this.buffer=r.Buffer.alloc(e.BUFFER_SIZE),this.position=0):("string"==typeof t?this.buffer=r.Buffer.from(t,"binary"):Array.isArray(t)?this.buffer=r.Buffer.from(t):this.buffer=S(t),this.position=this.buffer.byteLength)}return e.prototype.put=function(t){if("string"==typeof t&&1!==t.length)throw new f("only accepts single character String");if("number"!=typeof t&&1!==t.length)throw new f("only accepts single character Uint8Array or Array");var n;if((n="string"==typeof t?t.charCodeAt(0):"number"==typeof t?t:t[0])<0||n>255)throw new f("only accepts number in a valid unsigned byte range 0-255");if(this.buffer.length>this.position)this.buffer[this.position++]=n;else{var i=r.Buffer.alloc(e.BUFFER_SIZE+this.buffer.length);this.buffer.copy(i,0,0,this.buffer.length),this.buffer=i,this.buffer[this.position++]=n}},e.prototype.write=function(e,t){if(t="number"==typeof t?t:this.position,this.buffer.length<t+e.length){var n=r.Buffer.alloc(this.buffer.length+e.length);this.buffer.copy(n,0,0,this.buffer.length),this.buffer=n}ArrayBuffer.isView(e)?(this.buffer.set(S(e),t),this.position=t+e.byteLength>this.position?t+e.length:this.position):"string"==typeof e&&(this.buffer.write(e,t,e.length,"binary"),this.position=t+e.length>this.position?t+e.length:this.position)},e.prototype.read=function(e,t){return t=t&&t>0?t:this.position,this.buffer.slice(e,e+t)},e.prototype.value=function(e){return(e=!!e)&&this.buffer.length===this.position?this.buffer:e?this.buffer.slice(0,this.position):this.buffer.toString("binary",0,this.position)},e.prototype.length=function(){return this.position},e.prototype.toJSON=function(){return this.buffer.toString("base64")},e.prototype.toString=function(e){return this.buffer.toString(e)},e.prototype.toExtendedJSON=function(e){e=e||{};var t=this.buffer.toString("base64"),n=Number(this.sub_type).toString(16);return e.legacy?{$binary:t,$type:1===n.length?"0"+n:n}:{$binary:{base64:t,subType:1===n.length?"0"+n:n}}},e.prototype.toUUID=function(){if(this.sub_type===e.SUBTYPE_UUID)return new le(this.buffer.slice(0,this.position));throw new u('Binary sub_type "'.concat(this.sub_type,'" is not supported for converting to UUID. Only "').concat(e.SUBTYPE_UUID,'" is currently supported.'))},e.fromExtendedJSON=function(t,n){var i,o;if(n=n||{},"$binary"in t?n.legacy&&"string"==typeof t.$binary&&"$type"in t?(o=t.$type?parseInt(t.$type,16):0,i=r.Buffer.from(t.$binary,"base64")):"string"!=typeof t.$binary&&(o=t.$binary.subType?parseInt(t.$binary.subType,16):0,i=r.Buffer.from(t.$binary.base64,"base64")):"$uuid"in t&&(o=4,i=B(t.$uuid)),!i)throw new f("Unexpected Binary Extended JSON format ".concat(JSON.stringify(t)));return o===ie?new le(i):new e(i,o)},e.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},e.prototype.inspect=function(){var e=this.value(!0);return'new Binary(Buffer.from("'.concat(e.toString("hex"),'", "hex"), ').concat(this.sub_type,")")},e.BSON_BINARY_SUBTYPE_DEFAULT=0,e.BUFFER_SIZE=256,e.SUBTYPE_DEFAULT=0,e.SUBTYPE_FUNCTION=1,e.SUBTYPE_BYTE_ARRAY=2,e.SUBTYPE_UUID_OLD=3,e.SUBTYPE_UUID=4,e.SUBTYPE_MD5=5,e.SUBTYPE_ENCRYPTED=6,e.SUBTYPE_COLUMN=7,e.SUBTYPE_USER_DEFINED=128,e}();Object.defineProperty(ae.prototype,"_bsontype",{value:"Binary"});var le=function(e){function t(n){var i,o,s=this;if(null==n)i=t.generate();else if(n instanceof t)i=r.Buffer.from(n.buffer),o=n.__id;else if(ArrayBuffer.isView(n)&&16===n.byteLength)i=S(n);else{if("string"!=typeof n)throw new f("Argument passed in UUID constructor must be a UUID, a 16 byte Buffer or a 32/36 character hex string (dashes excluded/included, format: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx).");i=B(n)}return(s=e.call(this,i,ie)||this).__id=o,s}return o(t,e),Object.defineProperty(t.prototype,"id",{get:function(){return this.buffer},set:function(e){this.buffer=e,t.cacheHexString&&(this.__id=N(e))},enumerable:!1,configurable:!0}),t.prototype.toHexString=function(e){if(void 0===e&&(e=!0),t.cacheHexString&&this.__id)return this.__id;var n=N(this.id,e);return t.cacheHexString&&(this.__id=n),n},t.prototype.toString=function(e){return e?this.id.toString(e):this.toHexString()},t.prototype.toJSON=function(){return this.toHexString()},t.prototype.equals=function(e){if(!e)return!1;if(e instanceof t)return e.id.equals(this.id);try{return new t(e).id.equals(this.id)}catch(e){return!1}},t.prototype.toBinary=function(){return new ae(this.id,ae.SUBTYPE_UUID)},t.generate=function(){var e=h(16);return e[6]=15&e[6]|64,e[8]=63&e[8]|128,r.Buffer.from(e)},t.isValid=function(e){return!!e&&(e instanceof t||("string"==typeof e?x(e):!!d(e)&&(16===e.length&&(64==(240&e[6])&&128==(128&e[8])))))},t.createFromHexString=function(e){return new t(B(e))},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){return'new UUID("'.concat(this.toHexString(),'")')},t}(ae),ce=function(){function e(t,n){if(!(this instanceof e))return new e(t,n);this.code=t,this.scope=n}return e.prototype.toJSON=function(){return{code:this.code,scope:this.scope}},e.prototype.toExtendedJSON=function(){return this.scope?{$code:this.code,$scope:this.scope}:{$code:this.code}},e.fromExtendedJSON=function(t){return new e(t.$code,t.$scope)},e.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},e.prototype.inspect=function(){var e=this.toJSON();return'new Code("'.concat(String(e.code),'"').concat(e.scope?", ".concat(JSON.stringify(e.scope)):"",")")},e}();function pe(e){return w(e)&&null!=e.$id&&"string"==typeof e.$ref&&(null==e.$db||"string"==typeof e.$db)}Object.defineProperty(ce.prototype,"_bsontype",{value:"Code"});var he=function(){function e(t,n,r,i){if(!(this instanceof e))return new e(t,n,r,i);var o=t.split(".");2===o.length&&(r=o.shift(),t=o.shift()),this.collection=t,this.oid=n,this.db=r,this.fields=i||{}}return Object.defineProperty(e.prototype,"namespace",{get:function(){return this.collection},set:function(e){this.collection=e},enumerable:!1,configurable:!0}),e.prototype.toJSON=function(){var e=Object.assign({$ref:this.collection,$id:this.oid},this.fields);return null!=this.db&&(e.$db=this.db),e},e.prototype.toExtendedJSON=function(e){e=e||{};var t={$ref:this.collection,$id:this.oid};return e.legacy?t:(this.db&&(t.$db=this.db),t=Object.assign(t,this.fields))},e.fromExtendedJSON=function(t){var n=Object.assign({},t);return delete n.$ref,delete n.$id,delete n.$db,new e(t.$ref,t.$id,t.$db,n)},e.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},e.prototype.inspect=function(){var e=void 0===this.oid||void 0===this.oid.toString?this.oid:this.oid.toString();return'new DBRef("'.concat(this.namespace,'", new ObjectId("').concat(String(e),'")').concat(this.db?', "'.concat(this.db,'"'):"",")")},e}();Object.defineProperty(he.prototype,"_bsontype",{value:"DBRef"});var ge=void 0;try{ge=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(e){}var de=4294967296,ye=0x10000000000000000,be=ye/2,me={},ve={},we=function(){function e(t,n,r){if(void 0===t&&(t=0),!(this instanceof e))return new e(t,n,r);"bigint"==typeof t?Object.assign(this,e.fromBigInt(t,!!n)):"string"==typeof t?Object.assign(this,e.fromString(t,!!n)):(this.low=0|t,this.high=0|n,this.unsigned=!!r),Object.defineProperty(this,"__isLong__",{value:!0,configurable:!1,writable:!1,enumerable:!1})}return e.fromBits=function(t,n,r){return new e(t,n,r)},e.fromInt=function(t,n){var r,i,o;return n?(o=0<=(t>>>=0)&&t<256)&&(i=ve[t])?i:(r=e.fromBits(t,(0|t)<0?-1:0,!0),o&&(ve[t]=r),r):(o=-128<=(t|=0)&&t<128)&&(i=me[t])?i:(r=e.fromBits(t,t<0?-1:0,!1),o&&(me[t]=r),r)},e.fromNumber=function(t,n){if(isNaN(t))return n?e.UZERO:e.ZERO;if(n){if(t<0)return e.UZERO;if(t>=ye)return e.MAX_UNSIGNED_VALUE}else{if(t<=-be)return e.MIN_VALUE;if(t+1>=be)return e.MAX_VALUE}return t<0?e.fromNumber(-t,n).neg():e.fromBits(t%de|0,t/de|0,n)},e.fromBigInt=function(t,n){return e.fromString(t.toString(),n)},e.fromString=function(t,n,r){if(0===t.length)throw Error("empty string");if("NaN"===t||"Infinity"===t||"+Infinity"===t||"-Infinity"===t)return e.ZERO;if("number"==typeof n?(r=n,n=!1):n=!!n,(r=r||10)<2||36<r)throw RangeError("radix");var i;if((i=t.indexOf("-"))>0)throw Error("interior hyphen");if(0===i)return e.fromString(t.substring(1),n,r).neg();for(var o=e.fromNumber(Math.pow(r,8)),s=e.ZERO,u=0;u<t.length;u+=8){var f=Math.min(8,t.length-u),a=parseInt(t.substring(u,u+f),r);if(f<8){var l=e.fromNumber(Math.pow(r,f));s=s.mul(l).add(e.fromNumber(a))}else s=(s=s.mul(o)).add(e.fromNumber(a))}return s.unsigned=n,s},e.fromBytes=function(t,n,r){return r?e.fromBytesLE(t,n):e.fromBytesBE(t,n)},e.fromBytesLE=function(t,n){return new e(t[0]|t[1]<<8|t[2]<<16|t[3]<<24,t[4]|t[5]<<8|t[6]<<16|t[7]<<24,n)},e.fromBytesBE=function(t,n){return new e(t[4]<<24|t[5]<<16|t[6]<<8|t[7],t[0]<<24|t[1]<<16|t[2]<<8|t[3],n)},e.isLong=function(e){return w(e)&&!0===e.__isLong__},e.fromValue=function(t,n){return"number"==typeof t?e.fromNumber(t,n):"string"==typeof t?e.fromString(t,n):e.fromBits(t.low,t.high,"boolean"==typeof n?n:t.unsigned)},e.prototype.add=function(t){e.isLong(t)||(t=e.fromValue(t));var n=this.high>>>16,r=65535&this.high,i=this.low>>>16,o=65535&this.low,s=t.high>>>16,u=65535&t.high,f=t.low>>>16,a=0,l=0,c=0,p=0;return c+=(p+=o+(65535&t.low))>>>16,p&=65535,l+=(c+=i+f)>>>16,c&=65535,a+=(l+=r+u)>>>16,l&=65535,a+=n+s,a&=65535,e.fromBits(c<<16|p,a<<16|l,this.unsigned)},e.prototype.and=function(t){return e.isLong(t)||(t=e.fromValue(t)),e.fromBits(this.low&t.low,this.high&t.high,this.unsigned)},e.prototype.compare=function(t){if(e.isLong(t)||(t=e.fromValue(t)),this.eq(t))return 0;var n=this.isNegative(),r=t.isNegative();return n&&!r?-1:!n&&r?1:this.unsigned?t.high>>>0>this.high>>>0||t.high===this.high&&t.low>>>0>this.low>>>0?-1:1:this.sub(t).isNegative()?-1:1},e.prototype.comp=function(e){return this.compare(e)},e.prototype.divide=function(t){if(e.isLong(t)||(t=e.fromValue(t)),t.isZero())throw Error("division by zero");if(ge){if(!this.unsigned&&-2147483648===this.high&&-1===t.low&&-1===t.high)return this;var n=(this.unsigned?ge.div_u:ge.div_s)(this.low,this.high,t.low,t.high);return e.fromBits(n,ge.get_high(),this.unsigned)}if(this.isZero())return this.unsigned?e.UZERO:e.ZERO;var r,i,o;if(this.unsigned){if(t.unsigned||(t=t.toUnsigned()),t.gt(this))return e.UZERO;if(t.gt(this.shru(1)))return e.UONE;o=e.UZERO}else{if(this.eq(e.MIN_VALUE))return t.eq(e.ONE)||t.eq(e.NEG_ONE)?e.MIN_VALUE:t.eq(e.MIN_VALUE)?e.ONE:(r=this.shr(1).div(t).shl(1)).eq(e.ZERO)?t.isNegative()?e.ONE:e.NEG_ONE:(i=this.sub(t.mul(r)),o=r.add(i.div(t)));if(t.eq(e.MIN_VALUE))return this.unsigned?e.UZERO:e.ZERO;if(this.isNegative())return t.isNegative()?this.neg().div(t.neg()):this.neg().div(t).neg();if(t.isNegative())return this.div(t.neg()).neg();o=e.ZERO}for(i=this;i.gte(t);){r=Math.max(1,Math.floor(i.toNumber()/t.toNumber()));for(var s=Math.ceil(Math.log(r)/Math.LN2),u=s<=48?1:Math.pow(2,s-48),f=e.fromNumber(r),a=f.mul(t);a.isNegative()||a.gt(i);)r-=u,a=(f=e.fromNumber(r,this.unsigned)).mul(t);f.isZero()&&(f=e.ONE),o=o.add(f),i=i.sub(a)}return o},e.prototype.div=function(e){return this.divide(e)},e.prototype.equals=function(t){return e.isLong(t)||(t=e.fromValue(t)),(this.unsigned===t.unsigned||this.high>>>31!=1||t.high>>>31!=1)&&(this.high===t.high&&this.low===t.low)},e.prototype.eq=function(e){return this.equals(e)},e.prototype.getHighBits=function(){return this.high},e.prototype.getHighBitsUnsigned=function(){return this.high>>>0},e.prototype.getLowBits=function(){return this.low},e.prototype.getLowBitsUnsigned=function(){return this.low>>>0},e.prototype.getNumBitsAbs=function(){if(this.isNegative())return this.eq(e.MIN_VALUE)?64:this.neg().getNumBitsAbs();var t,n=0!==this.high?this.high:this.low;for(t=31;t>0&&0==(n&1<<t);t--);return 0!==this.high?t+33:t+1},e.prototype.greaterThan=function(e){return this.comp(e)>0},e.prototype.gt=function(e){return this.greaterThan(e)},e.prototype.greaterThanOrEqual=function(e){return this.comp(e)>=0},e.prototype.gte=function(e){return this.greaterThanOrEqual(e)},e.prototype.ge=function(e){return this.greaterThanOrEqual(e)},e.prototype.isEven=function(){return 0==(1&this.low)},e.prototype.isNegative=function(){return!this.unsigned&&this.high<0},e.prototype.isOdd=function(){return 1==(1&this.low)},e.prototype.isPositive=function(){return this.unsigned||this.high>=0},e.prototype.isZero=function(){return 0===this.high&&0===this.low},e.prototype.lessThan=function(e){return this.comp(e)<0},e.prototype.lt=function(e){return this.lessThan(e)},e.prototype.lessThanOrEqual=function(e){return this.comp(e)<=0},e.prototype.lte=function(e){return this.lessThanOrEqual(e)},e.prototype.modulo=function(t){if(e.isLong(t)||(t=e.fromValue(t)),ge){var n=(this.unsigned?ge.rem_u:ge.rem_s)(this.low,this.high,t.low,t.high);return e.fromBits(n,ge.get_high(),this.unsigned)}return this.sub(this.div(t).mul(t))},e.prototype.mod=function(e){return this.modulo(e)},e.prototype.rem=function(e){return this.modulo(e)},e.prototype.multiply=function(t){if(this.isZero())return e.ZERO;if(e.isLong(t)||(t=e.fromValue(t)),ge){var n=ge.mul(this.low,this.high,t.low,t.high);return e.fromBits(n,ge.get_high(),this.unsigned)}if(t.isZero())return e.ZERO;if(this.eq(e.MIN_VALUE))return t.isOdd()?e.MIN_VALUE:e.ZERO;if(t.eq(e.MIN_VALUE))return this.isOdd()?e.MIN_VALUE:e.ZERO;if(this.isNegative())return t.isNegative()?this.neg().mul(t.neg()):this.neg().mul(t).neg();if(t.isNegative())return this.mul(t.neg()).neg();if(this.lt(e.TWO_PWR_24)&&t.lt(e.TWO_PWR_24))return e.fromNumber(this.toNumber()*t.toNumber(),this.unsigned);var r=this.high>>>16,i=65535&this.high,o=this.low>>>16,s=65535&this.low,u=t.high>>>16,f=65535&t.high,a=t.low>>>16,l=65535&t.low,c=0,p=0,h=0,g=0;return h+=(g+=s*l)>>>16,g&=65535,p+=(h+=o*l)>>>16,h&=65535,p+=(h+=s*a)>>>16,h&=65535,c+=(p+=i*l)>>>16,p&=65535,c+=(p+=o*a)>>>16,p&=65535,c+=(p+=s*f)>>>16,p&=65535,c+=r*l+i*a+o*f+s*u,c&=65535,e.fromBits(h<<16|g,c<<16|p,this.unsigned)},e.prototype.mul=function(e){return this.multiply(e)},e.prototype.negate=function(){return!this.unsigned&&this.eq(e.MIN_VALUE)?e.MIN_VALUE:this.not().add(e.ONE)},e.prototype.neg=function(){return this.negate()},e.prototype.not=function(){return e.fromBits(~this.low,~this.high,this.unsigned)},e.prototype.notEquals=function(e){return!this.equals(e)},e.prototype.neq=function(e){return this.notEquals(e)},e.prototype.ne=function(e){return this.notEquals(e)},e.prototype.or=function(t){return e.isLong(t)||(t=e.fromValue(t)),e.fromBits(this.low|t.low,this.high|t.high,this.unsigned)},e.prototype.shiftLeft=function(t){return e.isLong(t)&&(t=t.toInt()),0==(t&=63)?this:t<32?e.fromBits(this.low<<t,this.high<<t|this.low>>>32-t,this.unsigned):e.fromBits(0,this.low<<t-32,this.unsigned)},e.prototype.shl=function(e){return this.shiftLeft(e)},e.prototype.shiftRight=function(t){return e.isLong(t)&&(t=t.toInt()),0==(t&=63)?this:t<32?e.fromBits(this.low>>>t|this.high<<32-t,this.high>>t,this.unsigned):e.fromBits(this.high>>t-32,this.high>=0?0:-1,this.unsigned)},e.prototype.shr=function(e){return this.shiftRight(e)},e.prototype.shiftRightUnsigned=function(t){if(e.isLong(t)&&(t=t.toInt()),0===(t&=63))return this;var n=this.high;if(t<32){var r=this.low;return e.fromBits(r>>>t|n<<32-t,n>>>t,this.unsigned)}return 32===t?e.fromBits(n,0,this.unsigned):e.fromBits(n>>>t-32,0,this.unsigned)},e.prototype.shr_u=function(e){return this.shiftRightUnsigned(e)},e.prototype.shru=function(e){return this.shiftRightUnsigned(e)},e.prototype.subtract=function(t){return e.isLong(t)||(t=e.fromValue(t)),this.add(t.neg())},e.prototype.sub=function(e){return this.subtract(e)},e.prototype.toInt=function(){return this.unsigned?this.low>>>0:this.low},e.prototype.toNumber=function(){return this.unsigned?(this.high>>>0)*de+(this.low>>>0):this.high*de+(this.low>>>0)},e.prototype.toBigInt=function(){return BigInt(this.toString())},e.prototype.toBytes=function(e){return e?this.toBytesLE():this.toBytesBE()},e.prototype.toBytesLE=function(){var e=this.high,t=this.low;return[255&t,t>>>8&255,t>>>16&255,t>>>24,255&e,e>>>8&255,e>>>16&255,e>>>24]},e.prototype.toBytesBE=function(){var e=this.high,t=this.low;return[e>>>24,e>>>16&255,e>>>8&255,255&e,t>>>24,t>>>16&255,t>>>8&255,255&t]},e.prototype.toSigned=function(){return this.unsigned?e.fromBits(this.low,this.high,!1):this},e.prototype.toString=function(t){if((t=t||10)<2||36<t)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative()){if(this.eq(e.MIN_VALUE)){var n=e.fromNumber(t),r=this.div(n),i=r.mul(n).sub(this);return r.toString(t)+i.toInt().toString(t)}return"-"+this.neg().toString(t)}for(var o=e.fromNumber(Math.pow(t,6),this.unsigned),s=this,u="";;){var f=s.div(o),a=(s.sub(f.mul(o)).toInt()>>>0).toString(t);if((s=f).isZero())return a+u;for(;a.length<6;)a="0"+a;u=""+a+u}},e.prototype.toUnsigned=function(){return this.unsigned?this:e.fromBits(this.low,this.high,!0)},e.prototype.xor=function(t){return e.isLong(t)||(t=e.fromValue(t)),e.fromBits(this.low^t.low,this.high^t.high,this.unsigned)},e.prototype.eqz=function(){return this.isZero()},e.prototype.le=function(e){return this.lessThanOrEqual(e)},e.prototype.toExtendedJSON=function(e){return e&&e.relaxed?this.toNumber():{$numberLong:this.toString()}},e.fromExtendedJSON=function(t,n){var r=e.fromString(t.$numberLong);return n&&n.relaxed?r.toNumber():r},e.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},e.prototype.inspect=function(){return'new Long("'.concat(this.toString(),'"').concat(this.unsigned?", true":"",")")},e.TWO_PWR_24=e.fromInt(16777216),e.MAX_UNSIGNED_VALUE=e.fromBits(-1,-1,!0),e.ZERO=e.fromInt(0),e.UZERO=e.fromInt(0,!0),e.ONE=e.fromInt(1),e.UONE=e.fromInt(1,!0),e.NEG_ONE=e.fromInt(-1),e.MAX_VALUE=e.fromBits(-1,2147483647,!1),e.MIN_VALUE=e.fromBits(0,-2147483648,!1),e}();Object.defineProperty(we.prototype,"__isLong__",{value:!0}),Object.defineProperty(we.prototype,"_bsontype",{value:"Long"});var _e=/^(\+|-)?(\d+|(\d*\.\d*))?(E|e)?([-+])?(\d+)?$/,Se=/^(\+|-)?(Infinity|inf)$/i,Oe=/^(\+|-)?NaN$/i,xe=6111,Be=-6176,Ne=[124,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0].reverse(),Ee=[248,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0].reverse(),je=[120,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0].reverse(),Ie=/^([-+])?(\d+)?$/;function Ae(e){return!isNaN(parseInt(e,10))}function Ue(e){var t=we.fromNumber(1e9),n=we.fromNumber(0);if(!(e.parts[0]||e.parts[1]||e.parts[2]||e.parts[3]))return{quotient:e,rem:n};for(var r=0;r<=3;r++)n=(n=n.shiftLeft(32)).add(new we(e.parts[r],0)),e.parts[r]=n.div(t).low,n=n.modulo(t);return{quotient:e,rem:n}}function Le(e,t){throw new f('"'.concat(e,'" is not a valid Decimal128 string - ').concat(t))}var Te=function(){function e(t){if(!(this instanceof e))return new e(t);if("string"==typeof t)this.bytes=e.fromString(t).bytes;else{if(!d(t))throw new f("Decimal128 must take a Buffer or string");if(16!==t.byteLength)throw new f("Decimal128 must take a Buffer of 16 bytes");this.bytes=t}}return e.fromString=function(t){var n,i=!1,o=!1,s=!1,u=0,a=0,l=0,c=0,p=0,h=[0],g=0,d=0,y=0,b=0,m=0,v=0,w=new we(0,0),_=new we(0,0),S=0;if(t.length>=7e3)throw new f(t+" not a valid Decimal128 string");var O=t.match(_e),x=t.match(Se),B=t.match(Oe);if(!O&&!x&&!B||0===t.length)throw new f(t+" not a valid Decimal128 string");if(O){var N=O[2],E=O[4],j=O[5],I=O[6];E&&void 0===I&&Le(t,"missing exponent power"),E&&void 0===N&&Le(t,"missing exponent base"),void 0===E&&(j||I)&&Le(t,"missing e before exponent")}if("+"!==t[S]&&"-"!==t[S]||(i="-"===t[S++]),!Ae(t[S])&&"."!==t[S]){if("i"===t[S]||"I"===t[S])return new e(r.Buffer.from(i?Ee:je));if("N"===t[S])return new e(r.Buffer.from(Ne))}for(;Ae(t[S])||"."===t[S];)"."!==t[S]?(g<34&&("0"!==t[S]||s)&&(s||(p=a),s=!0,h[d++]=parseInt(t[S],10),g+=1),s&&(l+=1),o&&(c+=1),a+=1,S+=1):(o&&Le(t,"contains multiple periods"),o=!0,S+=1);if(o&&!a)throw new f(t+" not a valid Decimal128 string");if("e"===t[S]||"E"===t[S]){var A=t.substr(++S).match(Ie);if(!A||!A[2])return new e(r.Buffer.from(Ne));m=parseInt(A[0],10),S+=A[0].length}if(t[S])return new e(r.Buffer.from(Ne));if(y=0,g){if(b=g-1,1!==(u=l))for(;0===h[p+u-1];)u-=1}else y=0,b=0,h[0]=0,l=1,g=1,u=0;for(m<=c&&c-m>16384?m=Be:m-=c;m>xe;){if((b+=1)-y>34){if(h.join("").match(/^0+$/)){m=xe;break}Le(t,"overflow")}m-=1}for(;m<Be||g<l;){if(0===b&&u<g){m=Be,u=0;break}if(g<l?l-=1:b-=1,m<xe)m+=1;else{if(h.join("").match(/^0+$/)){m=xe;break}Le(t,"overflow")}}if(b-y+1<u){var U=a;o&&(p+=1,U+=1),i&&(p+=1,U+=1);var L=parseInt(t[p+b+1],10),T=0;if(L>=5&&(T=1,5===L))for(T=h[b]%2==1?1:0,v=p+b+2;v<U;v++)if(parseInt(t[v],10)){T=1;break}if(T)for(var D=b;D>=0;D--)if(++h[D]>9&&(h[D]=0,0===D)){if(!(m<xe))return new e(r.Buffer.from(i?Ee:je));m+=1,h[D]=1}}if(w=we.fromNumber(0),_=we.fromNumber(0),0===u)w=we.fromNumber(0),_=we.fromNumber(0);else if(b-y<17){D=y;for(_=we.fromNumber(h[D++]),w=new we(0,0);D<=b;D++)_=(_=_.multiply(we.fromNumber(10))).add(we.fromNumber(h[D]))}else{D=y;for(w=we.fromNumber(h[D++]);D<=b-17;D++)w=(w=w.multiply(we.fromNumber(10))).add(we.fromNumber(h[D]));for(_=we.fromNumber(h[D++]);D<=b;D++)_=(_=_.multiply(we.fromNumber(10))).add(we.fromNumber(h[D]))}var $,R,M,P,z=function(e,t){if(!e&&!t)return{high:we.fromNumber(0),low:we.fromNumber(0)};var n=e.shiftRightUnsigned(32),r=new we(e.getLowBits(),0),i=t.shiftRightUnsigned(32),o=new we(t.getLowBits(),0),s=n.multiply(i),u=n.multiply(o),f=r.multiply(i),a=r.multiply(o);return s=s.add(u.shiftRightUnsigned(32)),u=new we(u.getLowBits(),0).add(f).add(a.shiftRightUnsigned(32)),{high:s=s.add(u.shiftRightUnsigned(32)),low:a=u.shiftLeft(32).add(new we(a.getLowBits(),0))}}(w,we.fromString("100000000000000000"));z.low=z.low.add(_),$=z.low,R=_,M=$.high>>>0,P=R.high>>>0,(M<P||M===P&&$.low>>>0<R.low>>>0)&&(z.high=z.high.add(we.fromNumber(1))),n=m+6176;var J={low:we.fromNumber(0),high:we.fromNumber(0)};z.high.shiftRightUnsigned(49).and(we.fromNumber(1)).equals(we.fromNumber(1))?(J.high=J.high.or(we.fromNumber(3).shiftLeft(61)),J.high=J.high.or(we.fromNumber(n).and(we.fromNumber(16383).shiftLeft(47))),J.high=J.high.or(z.high.and(we.fromNumber(0x7fffffffffff)))):(J.high=J.high.or(we.fromNumber(16383&n).shiftLeft(49)),J.high=J.high.or(z.high.and(we.fromNumber(562949953421311)))),J.low=z.low,i&&(J.high=J.high.or(we.fromString("9223372036854775808")));var C=r.Buffer.alloc(16);return S=0,C[S++]=255&J.low.low,C[S++]=J.low.low>>8&255,C[S++]=J.low.low>>16&255,C[S++]=J.low.low>>24&255,C[S++]=255&J.low.high,C[S++]=J.low.high>>8&255,C[S++]=J.low.high>>16&255,C[S++]=J.low.high>>24&255,C[S++]=255&J.high.low,C[S++]=J.high.low>>8&255,C[S++]=J.high.low>>16&255,C[S++]=J.high.low>>24&255,C[S++]=255&J.high.high,C[S++]=J.high.high>>8&255,C[S++]=J.high.high>>16&255,C[S++]=J.high.high>>24&255,new e(C)},e.prototype.toString=function(){for(var e,t=0,n=new Array(36),r=0;r<n.length;r++)n[r]=0;var i,o,s,u=0,f=!1,a={parts:[0,0,0,0]},l=[];u=0;var c=this.bytes,p=c[u++]|c[u++]<<8|c[u++]<<16|c[u++]<<24,h=c[u++]|c[u++]<<8|c[u++]<<16|c[u++]<<24,g=c[u++]|c[u++]<<8|c[u++]<<16|c[u++]<<24,d=c[u++]|c[u++]<<8|c[u++]<<16|c[u++]<<24;u=0,{low:new we(p,h),high:new we(g,d)}.high.lessThan(we.ZERO)&&l.push("-");var y=d>>26&31;if(y>>3==3){if(30===y)return l.join("")+"Infinity";if(31===y)return"NaN";e=d>>15&16383,i=8+(d>>14&1)}else i=d>>14&7,e=d>>17&16383;var b=e-6176;if(a.parts[0]=(16383&d)+((15&i)<<14),a.parts[1]=g,a.parts[2]=h,a.parts[3]=p,0===a.parts[0]&&0===a.parts[1]&&0===a.parts[2]&&0===a.parts[3])f=!0;else for(s=3;s>=0;s--){var m=0,v=Ue(a);if(a=v.quotient,m=v.rem.low)for(o=8;o>=0;o--)n[9*s+o]=m%10,m=Math.floor(m/10)}if(f)t=1,n[u]=0;else for(t=36;!n[u];)t-=1,u+=1;var w=t-1+b;if(w>=34||w<=-7||b>0){if(t>34)return l.push("".concat(0)),b>0?l.push("E+".concat(b)):b<0&&l.push("E".concat(b)),l.join("");l.push("".concat(n[u++])),(t-=1)&&l.push(".");for(r=0;r<t;r++)l.push("".concat(n[u++]));l.push("E"),w>0?l.push("+".concat(w)):l.push("".concat(w))}else if(b>=0)for(r=0;r<t;r++)l.push("".concat(n[u++]));else{var _=t+b;if(_>0)for(r=0;r<_;r++)l.push("".concat(n[u++]));else l.push("0");for(l.push(".");_++<0;)l.push("0");for(r=0;r<t-Math.max(_-1,0);r++)l.push("".concat(n[u++]))}return l.join("")},e.prototype.toJSON=function(){return{$numberDecimal:this.toString()}},e.prototype.toExtendedJSON=function(){return{$numberDecimal:this.toString()}},e.fromExtendedJSON=function(t){return e.fromString(t.$numberDecimal)},e.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},e.prototype.inspect=function(){return'new Decimal128("'.concat(this.toString(),'")')},e}();Object.defineProperty(Te.prototype,"_bsontype",{value:"Decimal128"});var De=function(){function e(t){if(!(this instanceof e))return new e(t);t instanceof Number&&(t=t.valueOf()),this.value=+t}return e.prototype.valueOf=function(){return this.value},e.prototype.toJSON=function(){return this.value},e.prototype.toString=function(e){return this.value.toString(e)},e.prototype.toExtendedJSON=function(e){return e&&(e.legacy||e.relaxed&&isFinite(this.value))?this.value:Object.is(Math.sign(this.value),-0)?{$numberDouble:"-".concat(this.value.toFixed(1))}:(Number.isInteger(this.value)?(t=this.value.toFixed(1)).length>=13&&(t=this.value.toExponential(13).toUpperCase()):t=this.value.toString(),{$numberDouble:t});var t},e.fromExtendedJSON=function(t,n){var r=parseFloat(t.$numberDouble);return n&&n.relaxed?r:new e(r)},e.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},e.prototype.inspect=function(){var e=this.toExtendedJSON();return"new Double(".concat(e.$numberDouble,")")},e}();Object.defineProperty(De.prototype,"_bsontype",{value:"Double"});var $e=function(){function e(t){if(!(this instanceof e))return new e(t);t instanceof Number&&(t=t.valueOf()),this.value=0|+t}return e.prototype.valueOf=function(){return this.value},e.prototype.toString=function(e){return this.value.toString(e)},e.prototype.toJSON=function(){return this.value},e.prototype.toExtendedJSON=function(e){return e&&(e.relaxed||e.legacy)?this.value:{$numberInt:this.value.toString()}},e.fromExtendedJSON=function(t,n){return n&&n.relaxed?parseInt(t.$numberInt,10):new e(t.$numberInt)},e.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},e.prototype.inspect=function(){return"new Int32(".concat(this.valueOf(),")")},e}();Object.defineProperty($e.prototype,"_bsontype",{value:"Int32"});var Re=function(){function e(){if(!(this instanceof e))return new e}return e.prototype.toExtendedJSON=function(){return{$maxKey:1}},e.fromExtendedJSON=function(){return new e},e.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},e.prototype.inspect=function(){return"new MaxKey()"},e}();Object.defineProperty(Re.prototype,"_bsontype",{value:"MaxKey"});var Me=function(){function e(){if(!(this instanceof e))return new e}return e.prototype.toExtendedJSON=function(){return{$minKey:1}},e.fromExtendedJSON=function(){return new e},e.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},e.prototype.inspect=function(){return"new MinKey()"},e}();Object.defineProperty(Me.prototype,"_bsontype",{value:"MinKey"});var Pe=new RegExp("^[0-9a-fA-F]{24}$"),ze=null,Je=Symbol("id"),Ce=function(){function e(t){if(!(this instanceof e))return new e(t);var n;if("object"==typeof t&&t&&"id"in t){if("string"!=typeof t.id&&!ArrayBuffer.isView(t.id))throw new f("Argument passed in must have an id that is of type string or Buffer");n="toHexString"in t&&"function"==typeof t.toHexString?r.Buffer.from(t.toHexString(),"hex"):t.id}else n=t;if(null==n||"number"==typeof n)this[Je]=e.generate("number"==typeof n?n:void 0);else if(ArrayBuffer.isView(n)&&12===n.byteLength)this[Je]=n instanceof r.Buffer?n:S(n);else{if("string"!=typeof n)throw new f("Argument passed in does not match the accepted types");if(12===n.length){var i=r.Buffer.from(n);if(12!==i.byteLength)throw new f("Argument passed in must be a string of 12 bytes");this[Je]=i}else{if(24!==n.length||!Pe.test(n))throw new f("Argument passed in must be a string of 12 bytes or a string of 24 hex characters or an integer");this[Je]=r.Buffer.from(n,"hex")}}e.cacheHexString&&(this.__id=this.id.toString("hex"))}return Object.defineProperty(e.prototype,"id",{get:function(){return this[Je]},set:function(t){this[Je]=t,e.cacheHexString&&(this.__id=t.toString("hex"))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"generationTime",{get:function(){return this.id.readInt32BE(0)},set:function(e){this.id.writeUInt32BE(e,0)},enumerable:!1,configurable:!0}),e.prototype.toHexString=function(){if(e.cacheHexString&&this.__id)return this.__id;var t=this.id.toString("hex");return e.cacheHexString&&!this.__id&&(this.__id=t),t},e.getInc=function(){return e.index=(e.index+1)%16777215},e.generate=function(t){"number"!=typeof t&&(t=Math.floor(Date.now()/1e3));var n=e.getInc(),i=r.Buffer.alloc(12);return i.writeUInt32BE(t,0),null===ze&&(ze=h(5)),i[4]=ze[0],i[5]=ze[1],i[6]=ze[2],i[7]=ze[3],i[8]=ze[4],i[11]=255&n,i[10]=n>>8&255,i[9]=n>>16&255,i},e.prototype.toString=function(e){return e?this.id.toString(e):this.toHexString()},e.prototype.toJSON=function(){return this.toHexString()},e.prototype.equals=function(t){if(null==t)return!1;if(t instanceof e)return this[Je][11]===t[Je][11]&&this[Je].equals(t[Je]);if("string"==typeof t&&e.isValid(t)&&12===t.length&&d(this.id))return t===r.Buffer.prototype.toString.call(this.id,"latin1");if("string"==typeof t&&e.isValid(t)&&24===t.length)return t.toLowerCase()===this.toHexString();if("string"==typeof t&&e.isValid(t)&&12===t.length)return r.Buffer.from(t).equals(this.id);if("object"==typeof t&&"toHexString"in t&&"function"==typeof t.toHexString){var n=t.toHexString(),i=this.toHexString().toLowerCase();return"string"==typeof n&&n.toLowerCase()===i}return!1},e.prototype.getTimestamp=function(){var e=new Date,t=this.id.readUInt32BE(0);return e.setTime(1e3*Math.floor(t)),e},e.createPk=function(){return new e},e.createFromTime=function(t){var n=r.Buffer.from([0,0,0,0,0,0,0,0,0,0,0,0]);return n.writeUInt32BE(t,0),new e(n)},e.createFromHexString=function(t){if(void 0===t||null!=t&&24!==t.length)throw new f("Argument passed in must be a single String of 12 bytes or a string of 24 hex characters");return new e(r.Buffer.from(t,"hex"))},e.isValid=function(t){if(null==t)return!1;try{return new e(t),!0}catch(e){return!1}},e.prototype.toExtendedJSON=function(){return this.toHexString?{$oid:this.toHexString()}:{$oid:this.toString("hex")}},e.fromExtendedJSON=function(t){return new e(t.$oid)},e.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},e.prototype.inspect=function(){return'new ObjectId("'.concat(this.toHexString(),'")')},e.index=Math.floor(16777215*Math.random()),e}();Object.defineProperty(Ce.prototype,"generate",{value:_((function(e){return Ce.generate(e)}),"Please use the static `ObjectId.generate(time)` instead")}),Object.defineProperty(Ce.prototype,"getInc",{value:_((function(){return Ce.getInc()}),"Please use the static `ObjectId.getInc()` instead")}),Object.defineProperty(Ce.prototype,"get_inc",{value:_((function(){return Ce.getInc()}),"Please use the static `ObjectId.getInc()` instead")}),Object.defineProperty(Ce,"get_inc",{value:_((function(){return Ce.getInc()}),"Please use the static `ObjectId.getInc()` instead")}),Object.defineProperty(Ce.prototype,"_bsontype",{value:"ObjectID"});var Ye=function(){function e(t,n){if(!(this instanceof e))return new e(t,n);if(this.pattern=t,this.options=(null!=n?n:"").split("").sort().join(""),-1!==this.pattern.indexOf("\0"))throw new u("BSON Regex patterns cannot contain null bytes, found: ".concat(JSON.stringify(this.pattern)));if(-1!==this.options.indexOf("\0"))throw new u("BSON Regex options cannot contain null bytes, found: ".concat(JSON.stringify(this.options)));for(var r=0;r<this.options.length;r++)if("i"!==this.options[r]&&"m"!==this.options[r]&&"x"!==this.options[r]&&"l"!==this.options[r]&&"s"!==this.options[r]&&"u"!==this.options[r])throw new u("The regular expression option [".concat(this.options[r],"] is not supported"))}return e.parseOptions=function(e){return e?e.split("").sort().join(""):""},e.prototype.toExtendedJSON=function(e){return(e=e||{}).legacy?{$regex:this.pattern,$options:this.options}:{$regularExpression:{pattern:this.pattern,options:this.options}}},e.fromExtendedJSON=function(t){if("$regex"in t){if("string"==typeof t.$regex)return new e(t.$regex,e.parseOptions(t.$options));if("BSONRegExp"===t.$regex._bsontype)return t}if("$regularExpression"in t)return new e(t.$regularExpression.pattern,e.parseOptions(t.$regularExpression.options));throw new f("Unexpected BSONRegExp EJSON object form: ".concat(JSON.stringify(t)))},e}();Object.defineProperty(Ye.prototype,"_bsontype",{value:"BSONRegExp"});var ke=function(){function e(t){if(!(this instanceof e))return new e(t);this.value=t}return e.prototype.valueOf=function(){return this.value},e.prototype.toString=function(){return this.value},e.prototype.inspect=function(){return'new BSONSymbol("'.concat(this.value,'")')},e.prototype.toJSON=function(){return this.value},e.prototype.toExtendedJSON=function(){return{$symbol:this.value}},e.fromExtendedJSON=function(t){return new e(t.$symbol)},e.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},e}();Object.defineProperty(ke.prototype,"_bsontype",{value:"Symbol"});var Ve=we,Fe=function(e){function t(n,r){var i=this;return i instanceof t?(i=we.isLong(n)?e.call(this,n.low,n.high,!0)||this:w(n)&&void 0!==n.t&&void 0!==n.i?e.call(this,n.i,n.t,!0)||this:e.call(this,n,r,!0)||this,Object.defineProperty(i,"_bsontype",{value:"Timestamp",writable:!1,configurable:!1,enumerable:!1}),i):new t(n,r)}return o(t,e),t.prototype.toJSON=function(){return{$timestamp:this.toString()}},t.fromInt=function(e){return new t(we.fromInt(e,!0))},t.fromNumber=function(e){return new t(we.fromNumber(e,!0))},t.fromBits=function(e,n){return new t(e,n)},t.fromString=function(e,n){return new t(we.fromString(e,!0,n))},t.prototype.toExtendedJSON=function(){return{$timestamp:{t:this.high>>>0,i:this.low>>>0}}},t.fromExtendedJSON=function(e){return new t(e.$timestamp)},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){return"new Timestamp({ t: ".concat(this.getHighBits(),", i: ").concat(this.getLowBits()," })")},t.MAX_VALUE=we.MAX_UNSIGNED_VALUE,t}(Ve);function qe(e){return w(e)&&Reflect.has(e,"_bsontype")&&"string"==typeof e._bsontype}var He=2147483647,Ze=-2147483648,Ke=0x8000000000000000,We=-0x8000000000000000,Xe={$oid:Ce,$binary:ae,$uuid:ae,$symbol:ke,$numberInt:$e,$numberDecimal:Te,$numberDouble:De,$numberLong:we,$minKey:Me,$maxKey:Re,$regex:Ye,$regularExpression:Ye,$timestamp:Fe};function Ge(e,t){if(void 0===t&&(t={}),"number"==typeof e){if(t.relaxed||t.legacy)return e;if(Math.floor(e)===e){if(e>=Ze&&e<=He)return new $e(e);if(e>=We&&e<=Ke)return we.fromNumber(e)}return new De(e)}if(null==e||"object"!=typeof e)return e;if(e.$undefined)return null;for(var n=Object.keys(e).filter((function(t){return t.startsWith("$")&&null!=e[t]})),r=0;r<n.length;r++){var i=Xe[n[r]];if(i)return i.fromExtendedJSON(e,t)}if(null!=e.$date){var o=e.$date,s=new Date;return t.legacy?"number"==typeof o?s.setTime(o):"string"==typeof o&&s.setTime(Date.parse(o)):"string"==typeof o?s.setTime(Date.parse(o)):we.isLong(o)?s.setTime(o.toNumber()):"number"==typeof o&&t.relaxed&&s.setTime(o),s}if(null!=e.$code){var u=Object.assign({},e);return e.$scope&&(u.$scope=Ge(e.$scope)),ce.fromExtendedJSON(e)}if(pe(e)||e.$dbPointer){var f=e.$ref?e:e.$dbPointer;if(f instanceof he)return f;var a=Object.keys(f).filter((function(e){return e.startsWith("$")})),l=!0;if(a.forEach((function(e){-1===["$ref","$id","$db"].indexOf(e)&&(l=!1)})),l)return he.fromExtendedJSON(f)}return e}function Qe(e){var t=e.toISOString();return 0!==e.getUTCMilliseconds()?t:t.slice(0,-5)+"Z"}function et(e,t){if(("object"==typeof e||"function"==typeof e)&&null!==e){var n=t.seenObjects.findIndex((function(t){return t.obj===e}));if(-1!==n){var r=t.seenObjects.map((function(e){return e.propertyName})),i=r.slice(0,n).map((function(e){return"".concat(e," -> ")})).join(""),o=r[n],s=" -> "+r.slice(n+1,r.length-1).map((function(e){return"".concat(e," -> ")})).join(""),a=r[r.length-1],l=" ".repeat(i.length+o.length/2),c="-".repeat(s.length+(o.length+a.length)/2-1);throw new f("Converting circular structure to EJSON:\n"+" ".concat(i).concat(o).concat(s).concat(a,"\n")+" ".concat(l,"\\").concat(c,"/"))}t.seenObjects[t.seenObjects.length-1].obj=e}if(Array.isArray(e))return function(e,t){return e.map((function(e,n){t.seenObjects.push({propertyName:"index ".concat(n),obj:null});try{return et(e,t)}finally{t.seenObjects.pop()}}))}(e,t);if(void 0===e)return null;if(e instanceof Date||v(e)){var p=e.getTime(),h=p>-1&&p<2534023188e5;return t.legacy?t.relaxed&&h?{$date:e.getTime()}:{$date:Qe(e)}:t.relaxed&&h?{$date:Qe(e)}:{$date:{$numberLong:e.getTime().toString()}}}if(!("number"!=typeof e||t.relaxed&&isFinite(e))){if(Math.floor(e)===e){var g=e>=We&&e<=Ke;if(e>=Ze&&e<=He)return{$numberInt:e.toString()};if(g)return{$numberLong:e.toString()}}return{$numberDouble:e.toString()}}if(e instanceof RegExp||m(e)){var d=e.flags;if(void 0===d){var y=e.toString().match(/[gimuy]*$/);y&&(d=y[0])}return new Ye(e.source,d).toExtendedJSON(t)}return null!=e&&"object"==typeof e?function(e,t){if(null==e||"object"!=typeof e)throw new u("not an object instance");var n=e._bsontype;if(void 0===n){var r={};for(var i in e){t.seenObjects.push({propertyName:i,obj:null});try{var o=et(e[i],t);"__proto__"===i?Object.defineProperty(r,i,{value:o,writable:!0,enumerable:!0,configurable:!0}):r[i]=o}finally{t.seenObjects.pop()}}return r}if(qe(e)){var s=e;if("function"!=typeof s.toExtendedJSON){var a=rt[e._bsontype];if(!a)throw new f("Unrecognized or invalid _bsontype: "+e._bsontype);s=a(s)}return"Code"===n&&s.scope?s=new ce(s.code,et(s.scope,t)):"DBRef"===n&&s.oid&&(s=new he(et(s.collection,t),et(s.oid,t),et(s.db,t),et(s.fields,t))),s.toExtendedJSON(t)}throw new u("_bsontype must be a string, but was: "+typeof n)}(e,t):e}var tt,nt,rt={Binary:function(e){return new ae(e.value(),e.sub_type)},Code:function(e){return new ce(e.code,e.scope)},DBRef:function(e){return new he(e.collection||e.namespace,e.oid,e.db,e.fields)},Decimal128:function(e){return new Te(e.bytes)},Double:function(e){return new De(e.value)},Int32:function(e){return new $e(e.value)},Long:function(e){return we.fromBits(null!=e.low?e.low:e.low_,null!=e.low?e.high:e.high_,null!=e.low?e.unsigned:e.unsigned_)},MaxKey:function(){return new Re},MinKey:function(){return new Me},ObjectID:function(e){return new Ce(e)},ObjectId:function(e){return new Ce(e)},BSONRegExp:function(e){return new Ye(e.pattern,e.options)},Symbol:function(e){return new ke(e.value)},Timestamp:function(e){return Fe.fromBits(e.low,e.high)}};!function(e){function t(e,t){var n=Object.assign({},{relaxed:!0,legacy:!1},t);return"boolean"==typeof n.relaxed&&(n.strict=!n.relaxed),"boolean"==typeof n.strict&&(n.relaxed=!n.strict),JSON.parse(e,(function(e,t){if(-1!==e.indexOf("\0"))throw new u("BSON Document field names cannot contain null bytes, found: ".concat(JSON.stringify(e)));return Ge(t,n)}))}function n(e,t,n,r){null!=n&&"object"==typeof n&&(r=n,n=0),null==t||"object"!=typeof t||Array.isArray(t)||(r=t,t=void 0,n=0);var i=et(e,Object.assign({relaxed:!0,legacy:!1},r,{seenObjects:[{propertyName:"(root)",obj:null}]}));return JSON.stringify(i,t,n)}e.parse=t,e.stringify=n,e.serialize=function(e,t){return t=t||{},JSON.parse(n(e,t))},e.deserialize=function(e,n){return n=n||{},t(JSON.stringify(e),n)}}(tt||(tt={}));var it=l();function ot(e,t,n){var r=5;if(Array.isArray(e))for(var i=0;i<e.length;i++)r+=st(i.toString(),e[i],t,!0,n);else for(var o in"function"==typeof(null==e?void 0:e.toBSON)&&(e=e.toBSON()),e)r+=st(o,e[o],t,!1,n);return r}function st(e,t,n,i,o){switch(void 0===n&&(n=!1),void 0===i&&(i=!1),void 0===o&&(o=!1),"function"==typeof(null==t?void 0:t.toBSON)&&(t=t.toBSON()),typeof t){case"string":return 1+r.Buffer.byteLength(e,"utf8")+1+4+r.Buffer.byteLength(t,"utf8")+1;case"number":return Math.floor(t)===t&&t>=L&&t<=U&&t>=j&&t<=E?(null!=e?r.Buffer.byteLength(e,"utf8")+1:0)+5:(null!=e?r.Buffer.byteLength(e,"utf8")+1:0)+9;case"undefined":return i||!o?(null!=e?r.Buffer.byteLength(e,"utf8")+1:0)+1:0;case"boolean":return(null!=e?r.Buffer.byteLength(e,"utf8")+1:0)+2;case"object":if(null==t||"MinKey"===t._bsontype||"MaxKey"===t._bsontype)return(null!=e?r.Buffer.byteLength(e,"utf8")+1:0)+1;if("ObjectId"===t._bsontype||"ObjectID"===t._bsontype)return(null!=e?r.Buffer.byteLength(e,"utf8")+1:0)+13;if(t instanceof Date||v(t))return(null!=e?r.Buffer.byteLength(e,"utf8")+1:0)+9;if(ArrayBuffer.isView(t)||t instanceof ArrayBuffer||g(t))return(null!=e?r.Buffer.byteLength(e,"utf8")+1:0)+6+t.byteLength;if("Long"===t._bsontype||"Double"===t._bsontype||"Timestamp"===t._bsontype)return(null!=e?r.Buffer.byteLength(e,"utf8")+1:0)+9;if("Decimal128"===t._bsontype)return(null!=e?r.Buffer.byteLength(e,"utf8")+1:0)+17;if("Code"===t._bsontype)return null!=t.scope&&Object.keys(t.scope).length>0?(null!=e?r.Buffer.byteLength(e,"utf8")+1:0)+1+4+4+r.Buffer.byteLength(t.code.toString(),"utf8")+1+ot(t.scope,n,o):(null!=e?r.Buffer.byteLength(e,"utf8")+1:0)+1+4+r.Buffer.byteLength(t.code.toString(),"utf8")+1;if("Binary"===t._bsontype){var s=t;return s.sub_type===ae.SUBTYPE_BYTE_ARRAY?(null!=e?r.Buffer.byteLength(e,"utf8")+1:0)+(s.position+1+4+1+4):(null!=e?r.Buffer.byteLength(e,"utf8")+1:0)+(s.position+1+4+1)}if("Symbol"===t._bsontype)return(null!=e?r.Buffer.byteLength(e,"utf8")+1:0)+r.Buffer.byteLength(t.value,"utf8")+4+1+1;if("DBRef"===t._bsontype){var u=Object.assign({$ref:t.collection,$id:t.oid},t.fields);return null!=t.db&&(u.$db=t.db),(null!=e?r.Buffer.byteLength(e,"utf8")+1:0)+1+ot(u,n,o)}return t instanceof RegExp||m(t)?(null!=e?r.Buffer.byteLength(e,"utf8")+1:0)+1+r.Buffer.byteLength(t.source,"utf8")+1+(t.global?1:0)+(t.ignoreCase?1:0)+(t.multiline?1:0)+1:"BSONRegExp"===t._bsontype?(null!=e?r.Buffer.byteLength(e,"utf8")+1:0)+1+r.Buffer.byteLength(t.pattern,"utf8")+1+r.Buffer.byteLength(t.options,"utf8")+1:(null!=e?r.Buffer.byteLength(e,"utf8")+1:0)+ot(t,n,o)+1;case"function":if(t instanceof RegExp||m(t)||"[object RegExp]"===String.call(t))return(null!=e?r.Buffer.byteLength(e,"utf8")+1:0)+1+r.Buffer.byteLength(t.source,"utf8")+1+(t.global?1:0)+(t.ignoreCase?1:0)+(t.multiline?1:0)+1;if(n&&null!=t.scope&&Object.keys(t.scope).length>0)return(null!=e?r.Buffer.byteLength(e,"utf8")+1:0)+1+4+4+r.Buffer.byteLength(c(t),"utf8")+1+ot(t.scope,n,o);if(n)return(null!=e?r.Buffer.byteLength(e,"utf8")+1:0)+1+4+r.Buffer.byteLength(c(t),"utf8")+1}return 0}nt=it.Map?it.Map:function(){function e(e){void 0===e&&(e=[]),this._keys=[],this._values={};for(var t=0;t<e.length;t++)if(null!=e[t]){var n=e[t],r=n[0],i=n[1];this._keys.push(r),this._values[r]={v:i,i:this._keys.length-1}}}return e.prototype.clear=function(){this._keys=[],this._values={}},e.prototype.delete=function(e){var t=this._values[e];return null!=t&&(delete this._values[e],this._keys.splice(t.i,1),!0)},e.prototype.entries=function(){var e=this,t=0;return{next:function(){var n=e._keys[t++];return{value:void 0!==n?[n,e._values[n].v]:void 0,done:void 0===n}}}},e.prototype.forEach=function(e,t){t=t||this;for(var n=0;n<this._keys.length;n++){var r=this._keys[n];e.call(t,this._values[r].v,r,t)}},e.prototype.get=function(e){return this._values[e]?this._values[e].v:void 0},e.prototype.has=function(e){return null!=this._values[e]},e.prototype.keys=function(){var e=this,t=0;return{next:function(){var n=e._keys[t++];return{value:void 0!==n?n:void 0,done:void 0===n}}}},e.prototype.set=function(e,t){return this._values[e]?(this._values[e].v=t,this):(this._keys.push(e),this._values[e]={v:t,i:this._keys.length-1},this)},e.prototype.values=function(){var e=this,t=0;return{next:function(){var n=e._keys[t++];return{value:void 0!==n?e._values[n].v:void 0,done:void 0===n}}}},Object.defineProperty(e.prototype,"size",{get:function(){return this._keys.length},enumerable:!1,configurable:!0}),e}();function ut(e,t,n){for(var r=0,i=t;i<n;i+=1){var o=e[i];if(r){if(128!=(192&o))return!1;r-=1}else if(128&o)if(192==(224&o))r=1;else if(224==(240&o))r=2;else{if(240!=(248&o))return!1;r=3}}return!r}var ft=we.fromNumber(U),at=we.fromNumber(L),lt={};function ct(e,t,n){var r=(t=null==t?{}:t)&&t.index?t.index:0,i=e[r]|e[r+1]<<8|e[r+2]<<16|e[r+3]<<24;if(i<5)throw new u("bson size must be >= 5, is ".concat(i));if(t.allowObjectSmallerThanBufferSize&&e.length<i)throw new u("buffer length ".concat(e.length," must be >= bson size ").concat(i));if(!t.allowObjectSmallerThanBufferSize&&e.length!==i)throw new u("buffer length ".concat(e.length," must === bson size ").concat(i));if(i+r>e.byteLength)throw new u("(bson size ".concat(i," + options.index ").concat(r," must be <= buffer length ").concat(e.byteLength,")"));if(0!==e[r+i-1])throw new u("One object, sized correctly, with a spot for an EOO, but the EOO isn't 0x00");return ht(e,r,t,n)}var pt=/^\$ref$|^\$id$|^\$db$/;function ht(e,t,n,i){void 0===i&&(i=!1);var o,f=null!=n.evalFunctions&&n.evalFunctions,a=null!=n.cacheFunctions&&n.cacheFunctions,l=null==n.fieldsAsRaw?null:n.fieldsAsRaw,c=null!=n.raw&&n.raw,p="boolean"==typeof n.bsonRegExp&&n.bsonRegExp,h=null!=n.promoteBuffers&&n.promoteBuffers,g=null==n.promoteLongs||n.promoteLongs,d=null==n.promoteValues||n.promoteValues,y=null==n.validation?{utf8:!0}:n.validation,b=!0,m=new Set,v=y.utf8;if("boolean"==typeof v)o=v;else{b=!1;var w=Object.keys(v).map((function(e){return v[e]}));if(0===w.length)throw new u("UTF-8 validation setting cannot be empty");if("boolean"!=typeof w[0])throw new u("Invalid UTF-8 validation option, must specify boolean values");if(o=w[0],!w.every((function(e){return e===o})))throw new u("Invalid UTF-8 validation option - keys must be all true or all false")}if(!b)for(var _=0,S=Object.keys(v);_<S.length;_++){var O=S[_];m.add(O)}var x=t;if(e.length<5)throw new u("corrupt bson message < 5 bytes long");var B=e[t++]|e[t++]<<8|e[t++]<<16|e[t++]<<24;if(B<5||B>e.length)throw new u("corrupt bson message");for(var N=i?[]:{},E=0,j=!i&&null,I=new DataView(e.buffer,e.byteOffset,e.byteLength);;){var A=e[t++];if(0===A)break;for(var U=t;0!==e[U]&&U<e.length;)U++;if(U>=e.byteLength)throw new u("Bad BSON Document: illegal CString");var L=i?E++:e.toString("utf8",t,U),ee=!0;ee=b||m.has(L)?o:!o,!1!==j&&"$"===L[0]&&(j=pt.test(L));var te=void 0;if(t=U+1,A===D){if((Ue=e[t++]|e[t++]<<8|e[t++]<<16|e[t++]<<24)<=0||Ue>e.length-t||0!==e[t+Ue-1])throw new u("bad string length in bson");te=dt(e,t,t+Ue-1,ee),t+=Ue}else if(A===z){var ne=r.Buffer.alloc(12);e.copy(ne,0,t,t+12),te=new Ce(ne),t+=12}else if(A===Z&&!1===d)te=new $e(e[t++]|e[t++]<<8|e[t++]<<16|e[t++]<<24);else if(A===Z)te=e[t++]|e[t++]<<8|e[t++]<<16|e[t++]<<24;else if(A===T&&!1===d)te=new De(I.getFloat64(t,!0)),t+=8;else if(A===T)te=I.getFloat64(t,!0),t+=8;else if(A===C){var re=e[t++]|e[t++]<<8|e[t++]<<16|e[t++]<<24,oe=e[t++]|e[t++]<<8|e[t++]<<16|e[t++]<<24;te=new Date(new we(re,oe).toNumber())}else if(A===J){if(0!==e[t]&&1!==e[t])throw new u("illegal boolean type value");te=1===e[t++]}else if(A===$){var se=t;if((Ie=e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)<=0||Ie>e.length-t)throw new u("bad embedded document length in bson");if(c)te=e.slice(t,t+Ie);else{var ue=n;b||(ue=s(s({},n),{validation:{utf8:ee}})),te=ht(e,se,ue,!1)}t+=Ie}else if(A===R){se=t;var fe=n,le=t+(Ie=e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24);if(l&&l[L]){for(var ge in fe={},n)fe[ge]=n[ge];fe.raw=!0}if(b||(fe=s(s({},fe),{validation:{utf8:ee}})),te=ht(e,se,fe,!0),0!==e[(t+=Ie)-1])throw new u("invalid array terminator byte");if(t!==le)throw new u("corrupted array bson")}else if(A===P)te=void 0;else if(A===Y)te=null;else if(A===W){re=e[t++]|e[t++]<<8|e[t++]<<16|e[t++]<<24,oe=e[t++]|e[t++]<<8|e[t++]<<16|e[t++]<<24;var de=new we(re,oe);te=g&&!0===d&&de.lessThanOrEqual(ft)&&de.greaterThanOrEqual(at)?de.toNumber():de}else if(A===X){var ye=r.Buffer.alloc(16);e.copy(ye,0,t,t+16),t+=16;var be=new Te(ye);te="toObject"in be&&"function"==typeof be.toObject?be.toObject():be}else if(A===M){var me=e[t++]|e[t++]<<8|e[t++]<<16|e[t++]<<24,ve=me,_e=e[t++];if(me<0)throw new u("Negative binary type element size found");if(me>e.byteLength)throw new u("Binary type size larger than document size");if(null!=e.slice){if(_e===ae.SUBTYPE_BYTE_ARRAY){if((me=e[t++]|e[t++]<<8|e[t++]<<16|e[t++]<<24)<0)throw new u("Negative binary type element size found for subtype 0x02");if(me>ve-4)throw new u("Binary type with subtype 0x02 contains too long binary size");if(me<ve-4)throw new u("Binary type with subtype 0x02 contains too short binary size")}h&&d?te=e.slice(t,t+me):(te=new ae(e.slice(t,t+me),_e),_e===ie&&(te=te.toUUID()))}else{var Se=r.Buffer.alloc(me);if(_e===ae.SUBTYPE_BYTE_ARRAY){if((me=e[t++]|e[t++]<<8|e[t++]<<16|e[t++]<<24)<0)throw new u("Negative binary type element size found for subtype 0x02");if(me>ve-4)throw new u("Binary type with subtype 0x02 contains too long binary size");if(me<ve-4)throw new u("Binary type with subtype 0x02 contains too short binary size")}for(U=0;U<me;U++)Se[U]=e[t+U];te=h&&d?Se:_e===ie?new ae(e.slice(t,t+me),_e).toUUID():new ae(e.slice(t,t+me),_e)}t+=me}else if(A===k&&!1===p){for(U=t;0!==e[U]&&U<e.length;)U++;if(U>=e.length)throw new u("Bad BSON Document: illegal CString");var Oe=e.toString("utf8",t,U);for(U=t=U+1;0!==e[U]&&U<e.length;)U++;if(U>=e.length)throw new u("Bad BSON Document: illegal CString");var xe=e.toString("utf8",t,U);t=U+1;var Be=new Array(xe.length);for(U=0;U<xe.length;U++)switch(xe[U]){case"m":Be[U]="m";break;case"s":Be[U]="g";break;case"i":Be[U]="i"}te=new RegExp(Oe,Be.join(""))}else if(A===k&&!0===p){for(U=t;0!==e[U]&&U<e.length;)U++;if(U>=e.length)throw new u("Bad BSON Document: illegal CString");Oe=e.toString("utf8",t,U);for(U=t=U+1;0!==e[U]&&U<e.length;)U++;if(U>=e.length)throw new u("Bad BSON Document: illegal CString");xe=e.toString("utf8",t,U);t=U+1,te=new Ye(Oe,xe)}else if(A===q){if((Ue=e[t++]|e[t++]<<8|e[t++]<<16|e[t++]<<24)<=0||Ue>e.length-t||0!==e[t+Ue-1])throw new u("bad string length in bson");var Ne=dt(e,t,t+Ue-1,ee);te=d?Ne:new ke(Ne),t+=Ue}else if(A===K){re=e[t++]|e[t++]<<8|e[t++]<<16|e[t++]<<24,oe=e[t++]|e[t++]<<8|e[t++]<<16|e[t++]<<24;te=new Fe(re,oe)}else if(A===G)te=new Me;else if(A===Q)te=new Re;else if(A===F){if((Ue=e[t++]|e[t++]<<8|e[t++]<<16|e[t++]<<24)<=0||Ue>e.length-t||0!==e[t+Ue-1])throw new u("bad string length in bson");var Ee=dt(e,t,t+Ue-1,ee);te=f?a?gt(Ee,lt,N):gt(Ee):new ce(Ee),t+=Ue}else if(A===H){var je=e[t++]|e[t++]<<8|e[t++]<<16|e[t++]<<24;if(je<13)throw new u("code_w_scope total size shorter minimum expected length");if((Ue=e[t++]|e[t++]<<8|e[t++]<<16|e[t++]<<24)<=0||Ue>e.length-t||0!==e[t+Ue-1])throw new u("bad string length in bson");Ee=dt(e,t,t+Ue-1,ee),se=t+=Ue;var Ie=e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24,Ae=ht(e,se,n,!1);if(t+=Ie,je<8+Ie+Ue)throw new u("code_w_scope total size is too short, truncating scope");if(je>8+Ie+Ue)throw new u("code_w_scope total size is too long, clips outer document");f?(te=a?gt(Ee,lt,N):gt(Ee)).scope=Ae:te=new ce(Ee,Ae)}else{if(A!==V)throw new u("Detected unknown BSON type ".concat(A.toString(16),' for fieldname "').concat(L,'"'));var Ue;if((Ue=e[t++]|e[t++]<<8|e[t++]<<16|e[t++]<<24)<=0||Ue>e.length-t||0!==e[t+Ue-1])throw new u("bad string length in bson");if(null!=y&&y.utf8&&!ut(e,t,t+Ue-1))throw new u("Invalid UTF-8 string in BSON document");var Le=e.toString("utf8",t,t+Ue-1);t+=Ue;var Pe=r.Buffer.alloc(12);e.copy(Pe,0,t,t+12);ne=new Ce(Pe);t+=12,te=new he(Le,ne)}"__proto__"===L?Object.defineProperty(N,L,{value:te,writable:!0,enumerable:!0,configurable:!0}):N[L]=te}if(B!==t-x){if(i)throw new u("corrupt array bson");throw new u("corrupt object bson")}if(!j)return N;if(pe(N)){var ze=Object.assign({},N);return delete ze.$ref,delete ze.$id,delete ze.$db,new he(N.$ref,N.$id,N.$db,ze)}return N}function gt(e,t,n){return t?(null==t[e]&&(t[e]=new Function(e)),t[e].bind(n)):new Function(e)}function dt(e,t,n,r){var i=e.toString("utf8",t,n);if(r)for(var o=0;o<i.length;o++)if(65533===i.charCodeAt(o)){if(!ut(e,t,n))throw new u("Invalid UTF-8 string in BSON document");break}return i}var yt=/\x00/,bt=new Set(["$db","$ref","$id","$clusterTime"]);function mt(e,t,n,r,i){e[r++]=D;var o=i?e.write(t,r,void 0,"ascii"):e.write(t,r,void 0,"utf8");e[(r=r+o+1)-1]=0;var s=e.write(n,r+4,void 0,"utf8");return e[r+3]=s+1>>24&255,e[r+2]=s+1>>16&255,e[r+1]=s+1>>8&255,e[r]=s+1&255,r=r+4+s,e[r++]=0,r}var vt=new Uint8Array(8),wt=new DataView(vt.buffer,vt.byteOffset,vt.byteLength);function _t(e,t,n,r,i){Number.isInteger(n)&&n>=j&&n<=E?(e[r++]=Z,r+=i?e.write(t,r,void 0,"ascii"):e.write(t,r,void 0,"utf8"),e[r++]=0,e[r++]=255&n,e[r++]=n>>8&255,e[r++]=n>>16&255,e[r++]=n>>24&255):(e[r++]=T,r+=i?e.write(t,r,void 0,"ascii"):e.write(t,r,void 0,"utf8"),e[r++]=0,wt.setFloat64(0,n,!0),e.set(vt,r),r+=8);return r}function St(e,t,n,r,i){return e[r++]=Y,r+=i?e.write(t,r,void 0,"ascii"):e.write(t,r,void 0,"utf8"),e[r++]=0,r}function Ot(e,t,n,r,i){return e[r++]=J,r+=i?e.write(t,r,void 0,"ascii"):e.write(t,r,void 0,"utf8"),e[r++]=0,e[r++]=n?1:0,r}function xt(e,t,n,r,i){e[r++]=C,r+=i?e.write(t,r,void 0,"ascii"):e.write(t,r,void 0,"utf8"),e[r++]=0;var o=we.fromNumber(n.getTime()),s=o.getLowBits(),u=o.getHighBits();return e[r++]=255&s,e[r++]=s>>8&255,e[r++]=s>>16&255,e[r++]=s>>24&255,e[r++]=255&u,e[r++]=u>>8&255,e[r++]=u>>16&255,e[r++]=u>>24&255,r}function Bt(e,t,n,r,i){if(e[r++]=k,r+=i?e.write(t,r,void 0,"ascii"):e.write(t,r,void 0,"utf8"),e[r++]=0,n.source&&null!=n.source.match(yt))throw Error("value "+n.source+" must not contain null bytes");return r+=e.write(n.source,r,void 0,"utf8"),e[r++]=0,n.ignoreCase&&(e[r++]=105),n.global&&(e[r++]=115),n.multiline&&(e[r++]=109),e[r++]=0,r}function Nt(e,t,n,r,i){if(e[r++]=k,r+=i?e.write(t,r,void 0,"ascii"):e.write(t,r,void 0,"utf8"),e[r++]=0,null!=n.pattern.match(yt))throw Error("pattern "+n.pattern+" must not contain null bytes");return r+=e.write(n.pattern,r,void 0,"utf8"),e[r++]=0,r+=e.write(n.options.split("").sort().join(""),r,void 0,"utf8"),e[r++]=0,r}function Et(e,t,n,r,i){return null===n?e[r++]=Y:"MinKey"===n._bsontype?e[r++]=G:e[r++]=Q,r+=i?e.write(t,r,void 0,"ascii"):e.write(t,r,void 0,"utf8"),e[r++]=0,r}function jt(e,t,n,r,i){if(e[r++]=z,r+=i?e.write(t,r,void 0,"ascii"):e.write(t,r,void 0,"utf8"),e[r++]=0,"string"==typeof n.id)e.write(n.id,r,void 0,"binary");else{if(!d(n.id))throw new f("object ["+JSON.stringify(n)+"] is not a valid ObjectId");e.set(n.id.subarray(0,12),r)}return r+12}function It(e,t,n,r,i){e[r++]=M,r+=i?e.write(t,r,void 0,"ascii"):e.write(t,r,void 0,"utf8"),e[r++]=0;var o=n.length;return e[r++]=255&o,e[r++]=o>>8&255,e[r++]=o>>16&255,e[r++]=o>>24&255,e[r++]=ee,e.set(S(n),r),r+=o}function At(e,t,n,r,i,o,s,f,a,l){void 0===i&&(i=!1),void 0===o&&(o=0),void 0===s&&(s=!1),void 0===f&&(f=!0),void 0===a&&(a=!1),void 0===l&&(l=[]);for(var c=0;c<l.length;c++)if(l[c]===n)throw new u("cyclic dependency detected");l.push(n),e[r++]=Array.isArray(n)?R:$,r+=a?e.write(t,r,void 0,"ascii"):e.write(t,r,void 0,"utf8"),e[r++]=0;var p=Jt(e,n,i,r,o+1,s,f,l);return l.pop(),p}function Ut(e,t,n,r,i){return e[r++]=X,r+=i?e.write(t,r,void 0,"ascii"):e.write(t,r,void 0,"utf8"),e[r++]=0,e.set(n.bytes.subarray(0,16),r),r+16}function Lt(e,t,n,r,i){e[r++]="Long"===n._bsontype?W:K,r+=i?e.write(t,r,void 0,"ascii"):e.write(t,r,void 0,"utf8"),e[r++]=0;var o=n.getLowBits(),s=n.getHighBits();return e[r++]=255&o,e[r++]=o>>8&255,e[r++]=o>>16&255,e[r++]=o>>24&255,e[r++]=255&s,e[r++]=s>>8&255,e[r++]=s>>16&255,e[r++]=s>>24&255,r}function Tt(e,t,n,r,i){return n=n.valueOf(),e[r++]=Z,r+=i?e.write(t,r,void 0,"ascii"):e.write(t,r,void 0,"utf8"),e[r++]=0,e[r++]=255&n,e[r++]=n>>8&255,e[r++]=n>>16&255,e[r++]=n>>24&255,r}function Dt(e,t,n,r,i){return e[r++]=T,r+=i?e.write(t,r,void 0,"ascii"):e.write(t,r,void 0,"utf8"),e[r++]=0,wt.setFloat64(0,n.value,!0),e.set(vt,r),r+=8}function $t(e,t,n,r,i,o,s){e[r++]=F,r+=s?e.write(t,r,void 0,"ascii"):e.write(t,r,void 0,"utf8"),e[r++]=0;var u=c(n),f=e.write(u,r+4,void 0,"utf8")+1;return e[r]=255&f,e[r+1]=f>>8&255,e[r+2]=f>>16&255,e[r+3]=f>>24&255,r=r+4+f-1,e[r++]=0,r}function Rt(e,t,n,r,i,o,s,u,f){if(void 0===i&&(i=!1),void 0===o&&(o=0),void 0===s&&(s=!1),void 0===u&&(u=!0),void 0===f&&(f=!1),n.scope&&"object"==typeof n.scope){e[r++]=H,r+=f?e.write(t,r,void 0,"ascii"):e.write(t,r,void 0,"utf8"),e[r++]=0;var a=r,l="string"==typeof n.code?n.code:n.code.toString();r+=4;var c=e.write(l,r+4,void 0,"utf8")+1;e[r]=255&c,e[r+1]=c>>8&255,e[r+2]=c>>16&255,e[r+3]=c>>24&255,e[r+4+c-1]=0,r=r+c+4;var p=Jt(e,n.scope,i,r,o+1,s,u);r=p-1;var h=p-a;e[a++]=255&h,e[a++]=h>>8&255,e[a++]=h>>16&255,e[a++]=h>>24&255,e[r++]=0}else{e[r++]=F,r+=f?e.write(t,r,void 0,"ascii"):e.write(t,r,void 0,"utf8"),e[r++]=0;l=n.code.toString();var g=e.write(l,r+4,void 0,"utf8")+1;e[r]=255&g,e[r+1]=g>>8&255,e[r+2]=g>>16&255,e[r+3]=g>>24&255,r=r+4+g-1,e[r++]=0}return r}function Mt(e,t,n,r,i){e[r++]=M,r+=i?e.write(t,r,void 0,"ascii"):e.write(t,r,void 0,"utf8"),e[r++]=0;var o=n.value(!0),s=n.position;return n.sub_type===ae.SUBTYPE_BYTE_ARRAY&&(s+=4),e[r++]=255&s,e[r++]=s>>8&255,e[r++]=s>>16&255,e[r++]=s>>24&255,e[r++]=n.sub_type,n.sub_type===ae.SUBTYPE_BYTE_ARRAY&&(s-=4,e[r++]=255&s,e[r++]=s>>8&255,e[r++]=s>>16&255,e[r++]=s>>24&255),e.set(o,r),r+=n.position}function Pt(e,t,n,r,i){e[r++]=q,r+=i?e.write(t,r,void 0,"ascii"):e.write(t,r,void 0,"utf8"),e[r++]=0;var o=e.write(n.value,r+4,void 0,"utf8")+1;return e[r]=255&o,e[r+1]=o>>8&255,e[r+2]=o>>16&255,e[r+3]=o>>24&255,r=r+4+o-1,e[r++]=0,r}function zt(e,t,n,r,i,o,s){e[r++]=$,r+=s?e.write(t,r,void 0,"ascii"):e.write(t,r,void 0,"utf8"),e[r++]=0;var u=r,f={$ref:n.collection||n.namespace,$id:n.oid};null!=n.db&&(f.$db=n.db);var a=Jt(e,f=Object.assign(f,n.fields),!1,r,i+1,o),l=a-u;return e[u++]=255&l,e[u++]=l>>8&255,e[u++]=l>>16&255,e[u++]=l>>24&255,a}function Jt(e,t,n,r,i,o,s,u){void 0===n&&(n=!1),void 0===r&&(r=0),void 0===i&&(i=0),void 0===o&&(o=!1),void 0===s&&(s=!0),void 0===u&&(u=[]),r=r||0,(u=u||[]).push(t);var a,l=r+4;if(Array.isArray(t))for(var c=0;c<t.length;c++){var p="".concat(c);if("function"==typeof(null==(S=t[c])?void 0:S.toBSON)&&(S=S.toBSON()),"string"==typeof S)l=mt(e,p,S,l,!0);else if("number"==typeof S)l=_t(e,p,S,l,!0);else{if("bigint"==typeof S)throw new f("Unsupported type BigInt, please use Decimal128");if("boolean"==typeof S)l=Ot(e,p,S,l,!0);else if(S instanceof Date||v(S))l=xt(e,p,S,l,!0);else if(void 0===S)l=St(e,p,0,l,!0);else if(null===S)l=St(e,p,0,l,!0);else if("ObjectId"===S._bsontype||"ObjectID"===S._bsontype)l=jt(e,p,S,l,!0);else if(d(S))l=It(e,p,S,l,!0);else if(S instanceof RegExp||m(S))l=Bt(e,p,S,l,!0);else if("object"==typeof S&&null==S._bsontype)l=At(e,p,S,l,n,i,o,s,!0,u);else if("object"==typeof S&&qe(S)&&"Decimal128"===S._bsontype)l=Ut(e,p,S,l,!0);else if("Long"===S._bsontype||"Timestamp"===S._bsontype)l=Lt(e,p,S,l,!0);else if("Double"===S._bsontype)l=Dt(e,p,S,l,!0);else if("function"==typeof S&&o)l=$t(e,p,S,l,0,0,!0);else if("Code"===S._bsontype)l=Rt(e,p,S,l,n,i,o,s,!0);else if("Binary"===S._bsontype)l=Mt(e,p,S,l,!0);else if("Symbol"===S._bsontype)l=Pt(e,p,S,l,!0);else if("DBRef"===S._bsontype)l=zt(e,p,S,l,i,o,!0);else if("BSONRegExp"===S._bsontype)l=Nt(e,p,S,l,!0);else if("Int32"===S._bsontype)l=Tt(e,p,S,l,!0);else if("MinKey"===S._bsontype||"MaxKey"===S._bsontype)l=Et(e,p,S,l,!0);else if(void 0!==S._bsontype)throw new f("Unrecognized or invalid _bsontype: ".concat(String(S._bsontype)))}}else if(t instanceof nt||(a=t,"[object Map]"===Object.prototype.toString.call(a)))for(var h=t.entries(),g=!1;!g;){var w=h.next();if(!(g=!!w.done)){p=w.value[0];var _=typeof(S=w.value[1]);if("string"==typeof p&&!bt.has(p)){if(null!=p.match(yt))throw Error("key "+p+" must not contain null bytes");if(n){if("$"===p[0])throw Error("key "+p+" must not start with '$'");if(~p.indexOf("."))throw Error("key "+p+" must not contain '.'")}}if("string"===_)l=mt(e,p,S,l);else if("number"===_)l=_t(e,p,S,l);else{if("bigint"===_||y(S)||b(S))throw new f("Unsupported type BigInt, please use Decimal128");if("boolean"===_)l=Ot(e,p,S,l);else if(S instanceof Date||v(S))l=xt(e,p,S,l);else if(null===S||void 0===S&&!1===s)l=St(e,p,0,l);else if("ObjectId"===S._bsontype||"ObjectID"===S._bsontype)l=jt(e,p,S,l);else if(d(S))l=It(e,p,S,l);else if(S instanceof RegExp||m(S))l=Bt(e,p,S,l);else if("object"===_&&null==S._bsontype)l=At(e,p,S,l,n,i,o,s,!1,u);else if("object"===_&&"Decimal128"===S._bsontype)l=Ut(e,p,S,l);else if("Long"===S._bsontype||"Timestamp"===S._bsontype)l=Lt(e,p,S,l);else if("Double"===S._bsontype)l=Dt(e,p,S,l);else if("Code"===S._bsontype)l=Rt(e,p,S,l,n,i,o,s);else if("function"==typeof S&&o)l=$t(e,p,S,l,0,0,o);else if("Binary"===S._bsontype)l=Mt(e,p,S,l);else if("Symbol"===S._bsontype)l=Pt(e,p,S,l);else if("DBRef"===S._bsontype)l=zt(e,p,S,l,i,o);else if("BSONRegExp"===S._bsontype)l=Nt(e,p,S,l);else if("Int32"===S._bsontype)l=Tt(e,p,S,l);else if("MinKey"===S._bsontype||"MaxKey"===S._bsontype)l=Et(e,p,S,l);else if(void 0!==S._bsontype)throw new f("Unrecognized or invalid _bsontype: ".concat(String(S._bsontype)))}}}else{if("function"==typeof(null==t?void 0:t.toBSON)&&null!=(t=t.toBSON())&&"object"!=typeof t)throw new f("toBSON function did not return an object");for(var p in t){var S;"function"==typeof(null==(S=t[p])?void 0:S.toBSON)&&(S=S.toBSON());_=typeof S;if("string"==typeof p&&!bt.has(p)){if(null!=p.match(yt))throw Error("key "+p+" must not contain null bytes");if(n){if("$"===p[0])throw Error("key "+p+" must not start with '$'");if(~p.indexOf("."))throw Error("key "+p+" must not contain '.'")}}if("string"===_)l=mt(e,p,S,l);else if("number"===_)l=_t(e,p,S,l);else{if("bigint"===_)throw new f("Unsupported type BigInt, please use Decimal128");if("boolean"===_)l=Ot(e,p,S,l);else if(S instanceof Date||v(S))l=xt(e,p,S,l);else if(void 0===S)!1===s&&(l=St(e,p,0,l));else if(null===S)l=St(e,p,0,l);else if("ObjectId"===S._bsontype||"ObjectID"===S._bsontype)l=jt(e,p,S,l);else if(d(S))l=It(e,p,S,l);else if(S instanceof RegExp||m(S))l=Bt(e,p,S,l);else if("object"===_&&null==S._bsontype)l=At(e,p,S,l,n,i,o,s,!1,u);else if("object"===_&&"Decimal128"===S._bsontype)l=Ut(e,p,S,l);else if("Long"===S._bsontype||"Timestamp"===S._bsontype)l=Lt(e,p,S,l);else if("Double"===S._bsontype)l=Dt(e,p,S,l);else if("Code"===S._bsontype)l=Rt(e,p,S,l,n,i,o,s);else if("function"==typeof S&&o)l=$t(e,p,S,l,0,0,o);else if("Binary"===S._bsontype)l=Mt(e,p,S,l);else if("Symbol"===S._bsontype)l=Pt(e,p,S,l);else if("DBRef"===S._bsontype)l=zt(e,p,S,l,i,o);else if("BSONRegExp"===S._bsontype)l=Nt(e,p,S,l);else if("Int32"===S._bsontype)l=Tt(e,p,S,l);else if("MinKey"===S._bsontype||"MaxKey"===S._bsontype)l=Et(e,p,S,l);else if(void 0!==S._bsontype)throw new f("Unrecognized or invalid _bsontype: ".concat(String(S._bsontype)))}}}u.pop(),e[l++]=0;var O=l-r;return e[r++]=255&O,e[r++]=O>>8&255,e[r++]=O>>16&255,e[r++]=O>>24&255,l}var Ct=17825792,Yt=r.Buffer.alloc(Ct);function kt(e){Yt.length<e&&(Yt=r.Buffer.alloc(e))}function Vt(e,t){void 0===t&&(t={});var n="boolean"==typeof t.checkKeys&&t.checkKeys,i="boolean"==typeof t.serializeFunctions&&t.serializeFunctions,o="boolean"!=typeof t.ignoreUndefined||t.ignoreUndefined,s="number"==typeof t.minInternalBufferSize?t.minInternalBufferSize:Ct;Yt.length<s&&(Yt=r.Buffer.alloc(s));var u=Jt(Yt,e,n,0,0,i,o,[]),f=r.Buffer.alloc(u);return Yt.copy(f,0,0,f.length),f}function Ft(e,t,n){void 0===n&&(n={});var r="boolean"==typeof n.checkKeys&&n.checkKeys,i="boolean"==typeof n.serializeFunctions&&n.serializeFunctions,o="boolean"!=typeof n.ignoreUndefined||n.ignoreUndefined,s="number"==typeof n.index?n.index:0,u=Jt(Yt,e,r,0,0,i,o);return Yt.copy(t,s,0,u),s+u-1}function qt(e,t){return void 0===t&&(t={}),ct(e instanceof r.Buffer?e:S(e),t)}function Ht(e,t){return void 0===t&&(t={}),ot(e,"boolean"==typeof(t=t||{}).serializeFunctions&&t.serializeFunctions,"boolean"!=typeof t.ignoreUndefined||t.ignoreUndefined)}function Zt(e,t,n,r,i,o){for(var s=Object.assign({allowObjectSmallerThanBufferSize:!0,index:0},o),u=S(e),f=t,a=0;a<n;a++){var l=u[f]|u[f+1]<<8|u[f+2]<<16|u[f+3]<<24;s.index=f,r[i+a]=ct(u,s),f+=l}return f}const Kt={Binary:ae,Code:ce,DBRef:he,Decimal128:Te,Double:De,Int32:$e,Long:we,UUID:le,Map:nt,MaxKey:Re,MinKey:Me,ObjectId:Ce,ObjectID:Ce,BSONRegExp:Ye,BSONSymbol:ke,Timestamp:Fe,EJSON:tt,setInternalBufferSize:kt,serialize:Vt,serializeWithBufferAndIndex:Ft,deserialize:qt,calculateObjectSize:Ht,deserializeStream:Zt,BSONError:u,BSONTypeError:f}},698:e=>{e.exports=function(e,t,n){for(var r=(2<<31-Math.clz32(t.length-1|1))-1,i=Math.ceil(1.6*r*n/t.length),o="";;)for(var s=e(i),u=i;u--;)if((o+=t[s[u]&r]||"").length===+n)return o}},986:(e,t,n)=>{var r=n(113);if(r.randomFillSync){var i={};e.exports=function(e){var t=i[e];return t||(t=Buffer.allocUnsafe(e),e<=255&&(i[e]=t)),r.randomFillSync(t)}}else e.exports=r.randomBytes},605:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=s,t.call=function(e){return s(e).apply(null,[].slice.call(arguments,1))};var r,i=n(670),o=(r=i)&&r.__esModule?r:{default:r};function s(e,t){var n=(t=t||{}).addListener||window.addEventListener,r=t.removeListener||window.removeEventListener,i=t.postMessage||window.postMessage,s=t.targetOrigin||"*",u=t.getMessageData||function(e){return e.data};return function(){var t={sender:"postmsg-rpc/client",id:(0,o.default)(),func:e,args:Array.from(arguments)},f=void 0,a=new Promise((function(o,a){var l=function n(){var i=u.apply(null,arguments);if(i&&"postmsg-rpc/server"===i.sender&&i.id===t.id){if(r("message",n),i.err){var s=new Error("Unexpected error calling "+e);return Object.assign(s,i.err),a(s)}o(i.res)}};f=function(){r("message",l);var t=new Error("Canceled call to "+e);t.isCanceled=!0,a(t)},n("message",l),i(t,s)}));return a.cancel=function(){return f()},a}}},429:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(605);Object.defineProperty(t,"caller",{enumerable:!0,get:function(){return o(r).default}}),Object.defineProperty(t,"call",{enumerable:!0,get:function(){return r.call}});var i=n(858);function o(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"expose",{enumerable:!0,get:function(){return o(i).default}})},858:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t,n){var r=(n=n||{}).addListener||window.addEventListener,i=n.removeListener||window.removeEventListener,o=n.postMessage||window.postMessage,s=n.targetOrigin||"*",u=n.getMessageData||function(e){return e.data},f=n.isCallback||!1,a=function(){var n=u.apply(null,arguments);if(n&&"postmsg-rpc/client"===n.sender&&n.func===e){var r={sender:"postmsg-rpc/server",id:n.id},i=function(e){r.res=e,o(r,s)},a=function(e){r.err=Object.assign({message:e.message},e.output&&e.output.payload),o(r,s)};if(f)t.apply(null,n.args.concat((function(e,t){if(e)return a(e);i(t)})));else{var l=t.apply(null,n.args);Promise.resolve(l).then(i).catch(a)}}};return r("message",a),{close:function(){return i("message",a)}}}},670:(e,t,n)=>{"use strict";e.exports=n(607)},829:(e,t,n)=>{"use strict";var r,i,o,s=n(946),u="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_-";function f(){o=!1}function a(e){if(e){if(e!==r){if(e.length!==u.length)throw new Error("Custom alphabet for shortid must be "+u.length+" unique characters. You submitted "+e.length+" characters: "+e);var t=e.split("").filter((function(e,t,n){return t!==n.lastIndexOf(e)}));if(t.length)throw new Error("Custom alphabet for shortid must be "+u.length+" unique characters. These characters were not unique: "+t.join(", "));r=e,f()}}else r!==u&&(r=u,f())}function l(){return o||(o=function(){r||a(u);for(var e,t=r.split(""),n=[],i=s.nextValue();t.length>0;)i=s.nextValue(),e=Math.floor(i*t.length),n.push(t.splice(e,1)[0]);return n.join("")}())}e.exports={get:function(){return r||u},characters:function(e){return a(e),r},seed:function(e){s.seed(e),i!==e&&(f(),i=e)},lookup:function(e){return l()[e]},shuffled:l}},480:(e,t,n)=>{"use strict";var r,i,o=n(416);n(829);e.exports=function(e){var t="",n=Math.floor(.001*(Date.now()-1567752802062));return n===i?r++:(r=0,i=n),t+=o(7),t+=o(e),r>0&&(t+=o(r)),t+=o(n)}},416:(e,t,n)=>{"use strict";var r=n(829),i=n(859),o=n(698);e.exports=function(e){for(var t,n=0,s="";!t;)s+=o(i,r.get(),1),t=e<Math.pow(16,n+1),n++;return s}},607:(e,t,n)=>{"use strict";var r=n(829),i=n(480),o=n(82),s=n(49)||0;function u(){return i(s)}e.exports=u,e.exports.generate=u,e.exports.seed=function(t){return r.seed(t),e.exports},e.exports.worker=function(t){return s=t,e.exports},e.exports.characters=function(e){return void 0!==e&&r.characters(e),r.shuffled()},e.exports.isValid=o},82:(e,t,n)=>{"use strict";var r=n(829);e.exports=function(e){return!(!e||"string"!=typeof e||e.length<6)&&!new RegExp("[^"+r.get().replace(/[|\\{}()[\]^$+*?.-]/g,"\\$&")+"]").test(e)}},859:(e,t,n)=>{e.exports=n(986)},946:e=>{"use strict";var t=1;e.exports={nextValue:function(){return(t=(9301*t+49297)%233280)/233280},seed:function(e){t=e}}},49:(e,t,n)=>{"use strict";var r=n(1),i=0;!r.isMaster&&r.worker&&(i=r.worker.id),e.exports=parseInt(process.env.NODE_UNIQUE_ID||i,10)},327:function(e,t,n){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const i=n(361),o=n(267),s=r(n(17)),u=n(156),f=n(59),a=process.env.WORKER_RUNTIME_SRC_PATH_DO_NOT_USE_THIS_EXCEPT_FOR_TESTING||s.default.resolve(__dirname,"worker-runtime.js"),l=new o.Worker(a,{env:o.SHARE_ENV}),c=(async()=>{await Promise.race([(async()=>{let e;for(;[e]=await(0,i.once)(l,"message");)if("ready"===e)return})(),(async()=>{const[e]=await(0,i.once)(l,"error");if(e)throw e.message=`Worker thread failed to start with the following error: ${e.message}`,e})()])})();process.setMaxListeners(25),l.setMaxListeners(25);let p=null;const{interrupt:h}=(0,u.createCaller)(["interrupt"],l),g=Object.assign((0,u.createCaller)(["init","evaluate","getCompletions","getShellPrompt"],l),{interrupt:()=>p?((0,f.interrupt)(p),!0):h()});Object.keys(g).forEach((e=>{var t;g[e]=(t=g[e],new Proxy(t,{apply:async(e,t,n)=>(await c,e.call(t,...Array.from(n)))}))})),(0,u.exposeAll)(g,process);const d=Object.assign((0,u.createCaller)(["onPrint","onPrompt","getConfig","setConfig","resetConfig","validateConfig","listConfigOptions","onClearCommand","onExit"],process),{onRunInterruptible(e){p=e}});(0,u.exposeAll)(d,l);const y=(0,u.createCaller)(["emit","on"],process);(0,u.exposeAll)(y,l),process.once("disconnect",(()=>process.exit())),process.nextTick((()=>{var e;null===(e=process.send)||void 0===e||e.call(process,"ready")}))},156:function(e,t,n){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.createCaller=t.exposeAll=t.cancel=t.close=t.removeTrailingUndefined=t.deserialize=t.serialize=void 0;const i=r(n(655)),o=n(429),s=n(825);function u(e){return`data:;base64,${i.default.serialize(e).toString("base64")}`}function f(e){return/^data:;base64,.+/.test(e)?i.default.deserialize(Buffer.from(e.replace("data:;base64,",""),"base64")):e}var a;function l(e){return e&&"object"==typeof e&&"id"in e&&"sender"in e}function c(e){return l(e)&&"postmsg-rpc/server"===e.sender}function p(e){return l(e)&&"postmsg-rpc/client"===e.sender}function h(e){if(Array.isArray(e))for(e=[...e];e.length>0&&void 0===e[e.length-1];)e.pop();return e}function g(e){return{addListener:e.on.bind(e),removeListener:e.off.bind(e),postMessage(t){if(p(t)&&Array.isArray(t.args)&&(t.args=u(h(t.args))),c(t))try{t.res=u(t.res)}catch(e){t.res=u({type:a.Error,payload:(0,s.serializeError)(e)})}return function(e,t){"postMessage"in e&&"function"==typeof e.postMessage&&e.postMessage(t),"send"in e&&"function"==typeof e.send&&e.send(t)}(e,t)},getMessageData:e=>(p(e)&&e.args&&"string"==typeof e.args&&(e.args=f(e.args)),c(e)&&"string"==typeof e.res&&(e.res=f(e.res)),e)}}t.serialize=u,t.deserialize=f,function(e){e[e.Message=0]="Message",e[e.Error=1]="Error"}(a||(a={})),t.removeTrailingUndefined=h,t.close=Symbol("@@rpc.close"),t.cancel=Symbol("@@rpc.cancel"),t.exposeAll=function(e,n){return Object.entries(e).forEach((([e,t])=>{const{close:r}=(0,o.expose)(e,(async(...e)=>{try{return{type:a.Message,payload:await t(...e)}}catch(e){return{type:a.Error,payload:(0,s.serializeError)(e)}}}),g(n));t.close=r})),Object.defineProperty(e,t.close,{enumerable:!1,value(){Object.values(e).forEach((e=>{e.close()}))}}),e},t.createCaller=function(e,n,r={}){const i={},u=new Set;return e.forEach((e=>{const t=(0,o.caller)(e,g(n));i[e]=async(...n)=>{var i;const o="function"==typeof r[e]?null===(i=r[e])||void 0===i?void 0:i.call(r,...n):n,f=t(...o);u.add(f);const l=await f;if(u.delete(f),(c=l)&&"object"==typeof c&&c.type===a.Error)throw(0,s.deserializeError)(l.payload);var c;return l.payload}})),Object.defineProperty(i,t.cancel,{enumerable:!1,value(){for(const e of u)e.cancel(),u.delete(e)}}),i}},825:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.deserializeConnectOptions=t.serializeConnectOptions=t.deserializeEvaluationResult=t.serializeEvaluationResult=t.SerializedResultTypes=t.deserializeError=t.serializeError=void 0;const r=n(837),i=n(699);function o(e){var t;return(t=e,Object.getOwnPropertyNames(t)).concat("name").reduce(((t,n)=>(t[n]=e[n],t)),{})}function s(e){return Object.assign(new Error,e)}var u;t.serializeError=o,t.deserializeError=s,function(e){e.SerializedErrorResult="SerializedErrorResult",e.InspectResult="InspectResult",e.SerializedShellApiResult="SerializedShellApiResult"}(u=t.SerializedResultTypes||(t.SerializedResultTypes={})),t.serializeEvaluationResult=function({type:e,printable:t,source:n}){return"object"!=typeof(s=t)&&"function"!=typeof s||null===s?{type:e,printable:t,source:n}:function(e){return e&&e.name&&e.message&&e.stack}(t)?{type:u.SerializedErrorResult,printable:o(t),source:n}:null===e?{type:u.InspectResult,printable:(0,r.inspect)(t),source:n}:{type:u.SerializedShellApiResult,printable:{origType:e,serializedValue:i.EJSON.serialize(t)}};var s},t.deserializeEvaluationResult=function({type:e,printable:t,source:n}){return e===u.SerializedErrorResult?{type:e,printable:s(t),source:n}:e===u.SerializedShellApiResult?{type:t.origType,printable:i.EJSON.deserialize(t.serializedValue),source:n}:{type:e,printable:t,source:n}};const f=["schemaMap","encryptedFieldsMap"];t.serializeConnectOptions=function(e={}){var t;const n={...e};for(const e of f)(null===(t=n.autoEncryption)||void 0===t?void 0:t[e])&&(n.autoEncryption={...n.autoEncryption,[e]:i.EJSON.serialize(n.autoEncryption[e],{relaxed:!1})});return n},t.deserializeConnectOptions=function(e){var t;const n={...e};for(const e of f)(null===(t=n.autoEncryption)||void 0===t?void 0:t[e])&&(n.autoEncryption={...n.autoEncryption,[e]:i.EJSON.deserialize(n.autoEncryption[e],{relaxed:!1})});return n}},59:e=>{"use strict";e.exports=require("interruptor")},1:e=>{"use strict";e.exports=require("cluster")},113:e=>{"use strict";e.exports=require("crypto")},361:e=>{"use strict";e.exports=require("events")},17:e=>{"use strict";e.exports=require("path")},837:e=>{"use strict";e.exports=require("util")},655:e=>{"use strict";e.exports=require("v8")},267:e=>{"use strict";e.exports=require("worker_threads")}},t={};function n(r){var i=t[r];if(void 0!==i)return i.exports;var o=t[r]={exports:{}};return e[r].call(o.exports,o,o.exports,n),o.exports}return n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n(327)})()));
@@ -0,0 +1,14 @@
1
+ /*! *****************************************************************************
2
+ Copyright (c) Microsoft Corporation.
3
+
4
+ Permission to use, copy, modify, and/or distribute this software for any
5
+ purpose with or without fee is hereby granted.
6
+
7
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
8
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
9
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
10
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
11
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
12
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
13
+ PERFORMANCE OF THIS SOFTWARE.
14
+ ***************************************************************************** */
@@ -1 +1 @@
1
- {"version":3,"file":"child-process-proxy.js","sourceRoot":"","sources":["../src/child-process-proxy.ts"],"names":[],"mappings":";;;;;AAeA,mCAA8B;AAC9B,mDAAmD;AACnD,gDAAwB;AACxB,+BAAgD;AAChD,6CAA4E;AAE5E,MAAM,oBAAoB,GACxB,OAAO,CAAC,GAAG,CAAC,0DAA0D;IACtE,cAAI,CAAC,OAAO,CAAC,SAAS,EAAE,mBAAmB,CAAC,CAAC;AAE/C,MAAM,aAAa,GAAG,IAAI,uBAAM,CAAC,oBAAoB,EAAE,EAAE,GAAG,EAAE,0BAAS,EAAE,CAAC,CAAC;AAE3E,MAAM,kBAAkB,GAAkB,CAAC,KAAK,IAAG,EAAE;IACnD,MAAM,mBAAmB,GAAG,KAAK,IAAG,EAAE;QACpC,IAAI,GAAW,CAAC;QAChB,OAAO,CAAC,CAAC,GAAG,CAAC,GAAG,MAAM,IAAA,aAAI,EAAC,aAAa,EAAE,SAAS,CAAC,CAAC,EAAE;YACrD,IAAI,GAAG,KAAK,OAAO;gBAAE,OAAO;SAC7B;IACH,CAAC,CAAC;IAEF,MAAM,YAAY,GAAG,KAAK,IAAG,EAAE;QAC7B,MAAM,CAAC,GAAG,CAAC,GAAG,MAAM,IAAA,aAAI,EAAC,aAAa,EAAE,OAAO,CAAC,CAAC;QACjD,IAAI,GAAG,EAAE;YACP,GAAG,CAAC,OAAO,GAAG,2DAA2D,GAAG,CAAC,OAAO,EAAE,CAAC;YACvF,MAAM,GAAG,CAAC;SACX;IACH,CAAC,CAAC;IAEF,MAAM,OAAO,CAAC,IAAI,CAAC;QACjB,mBAAmB,EAAE;QACrB,YAAY,EAAE;KACf,CAAC,CAAC;AACL,CAAC,CAAC,EAAE,CAAC;AAML,OAAO,CAAC,eAAe,CAAC,EAAE,CAAC,CAAC;AAC5B,aAAa,CAAC,eAAe,CAAC,EAAE,CAAC,CAAC;AAGlC,IAAI,eAAe,GAA2B,IAAI,CAAC;AAEnD,MAAM,EAAE,SAAS,EAAE,GAAG,IAAA,kBAAY,EAAC,CAAC,WAAW,CAAC,EAAE,aAAa,CAAC,CAAC;AAEjE,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,CAC1B,IAAA,kBAAY,EACV,CAAC,MAAM,EAAE,UAAU,EAAE,gBAAgB,EAAE,gBAAgB,CAAC,EACxD,aAAa,CACd,EACD;IACE,SAAS;QACP,IAAI,eAAe,EAAE;YACnB,IAAA,uBAAe,EAAC,eAAe,CAAC,CAAC;YACjC,OAAO,IAAI,CAAC;SACb;QAED,OAAO,SAAS,EAAE,CAAC;IACrB,CAAC;CACF,CACF,CAAC;AAEF,SAAS,uBAAuB,CAAqB,EAAK;IACxD,OAAO,IAAI,KAAK,CAAC,EAAE,EAAE;QACnB,KAAK,CAAC,KAAK,CAAC,MAAM,EAAE,OAAO,EAAE,aAAa;YACxC,MAAM,kBAAkB,CAAC;YACzB,OAAO,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,GAAG,KAAK,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC;QAC5D,CAAC;KACF,CAAC,CAAC;AACL,CAAC;AAIA,MAAM,CAAC,IAAI,CAAC,MAAM,CAA6B,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,EAAE;IAC/D,MAAM,CAAC,GAAG,CAAC,GAAG,uBAAuB,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC;AACrD,CAAC,CAAC,CAAC;AAEH,IAAA,eAAS,EAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAE3B,MAAM,kBAAkB,GAAG,MAAM,CAAC,MAAM,CACtC,IAAA,kBAAY,EACV;IACE,SAAS,EAAE,UAAU,EAAE,WAAW,EAAE,WAAW,EAAE,aAAa;IAC9D,gBAAgB,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,QAAQ;CAClE,EACD,OAAO,CACR,EACD;IACE,kBAAkB,CAAC,MAA8B;QAC/C,eAAe,GAAG,MAAM,CAAC;IAC3B,CAAC;CACF,CACF,CAAC;AAEF,IAAA,eAAS,EAAC,kBAAkB,EAAE,aAAa,CAAC,CAAC;AAE7C,MAAM,UAAU,GAAG,IAAA,kBAAY,EAAC,CAAC,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO,CAAC,CAAC;AAEzD,IAAA,eAAS,EAAC,UAAU,EAAE,aAAa,CAAC,CAAC;AAErC,OAAO,CAAC,QAAQ,CAAC,GAAG,EAAE;;IAEpB,MAAA,OAAO,CAAC,IAAI,wDAAG,OAAO,CAAC,CAAC;AAC1B,CAAC,CAAC,CAAC"}
1
+ {"version":3,"file":"child-process-proxy.js","sourceRoot":"","sources":["../src/child-process-proxy.ts"],"names":[],"mappings":";;;;;AAeA,mCAA8B;AAC9B,mDAAmD;AACnD,gDAAwB;AACxB,+BAAgD;AAChD,6CAA4E;AAE5E,MAAM,oBAAoB,GACxB,OAAO,CAAC,GAAG,CAAC,0DAA0D;IACtE,cAAI,CAAC,OAAO,CAAC,SAAS,EAAE,mBAAmB,CAAC,CAAC;AAE/C,MAAM,aAAa,GAAG,IAAI,uBAAM,CAAC,oBAAoB,EAAE,EAAE,GAAG,EAAE,0BAAS,EAAE,CAAC,CAAC;AAE3E,MAAM,kBAAkB,GAAkB,CAAC,KAAK,IAAG,EAAE;IACnD,MAAM,mBAAmB,GAAG,KAAK,IAAG,EAAE;QACpC,IAAI,GAAW,CAAC;QAChB,OAAO,CAAC,CAAC,GAAG,CAAC,GAAG,MAAM,IAAA,aAAI,EAAC,aAAa,EAAE,SAAS,CAAC,CAAC,EAAE;YACrD,IAAI,GAAG,KAAK,OAAO;gBAAE,OAAO;SAC7B;IACH,CAAC,CAAC;IAEF,MAAM,YAAY,GAAG,KAAK,IAAG,EAAE;QAC7B,MAAM,CAAC,GAAG,CAAC,GAAG,MAAM,IAAA,aAAI,EAAC,aAAa,EAAE,OAAO,CAAC,CAAC;QACjD,IAAI,GAAG,EAAE;YACP,GAAG,CAAC,OAAO,GAAG,2DAA2D,GAAG,CAAC,OAAO,EAAE,CAAC;YACvF,MAAM,GAAG,CAAC;SACX;IACH,CAAC,CAAC;IAEF,MAAM,OAAO,CAAC,IAAI,CAAC;QACjB,mBAAmB,EAAE;QACrB,YAAY,EAAE;KACf,CAAC,CAAC;AACL,CAAC,CAAC,EAAE,CAAC;AAML,OAAO,CAAC,eAAe,CAAC,EAAE,CAAC,CAAC;AAC5B,aAAa,CAAC,eAAe,CAAC,EAAE,CAAC,CAAC;AAGlC,IAAI,eAAe,GAA2B,IAAI,CAAC;AAEnD,MAAM,EAAE,SAAS,EAAE,GAAG,IAAA,kBAAY,EAAC,CAAC,WAAW,CAAC,EAAE,aAAa,CAAC,CAAC;AAEjE,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,CAC1B,IAAA,kBAAY,EACV,CAAC,MAAM,EAAE,UAAU,EAAE,gBAAgB,EAAE,gBAAgB,CAAC,EACxD,aAAa,CACd,EACD;IACE,SAAS;QACP,IAAI,eAAe,EAAE;YACnB,IAAA,uBAAe,EAAC,eAAe,CAAC,CAAC;YACjC,OAAO,IAAI,CAAC;SACb;QAED,OAAO,SAAS,EAAE,CAAC;IACrB,CAAC;CACF,CACF,CAAC;AAEF,SAAS,uBAAuB,CAAqB,EAAK;IACxD,OAAO,IAAI,KAAK,CAAC,EAAE,EAAE;QACnB,KAAK,CAAC,KAAK,CAAC,MAAM,EAAE,OAAO,EAAE,aAAa;YACxC,MAAM,kBAAkB,CAAC;YACzB,OAAO,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,GAAG,KAAK,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC;QAC5D,CAAC;KACF,CAAC,CAAC;AACL,CAAC;AAIA,MAAM,CAAC,IAAI,CAAC,MAAM,CAA6B,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,EAAE;IAC/D,MAAM,CAAC,GAAG,CAAC,GAAG,uBAAuB,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC;AACrD,CAAC,CAAC,CAAC;AAEH,IAAA,eAAS,EAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAE3B,MAAM,kBAAkB,GAAG,MAAM,CAAC,MAAM,CACtC,IAAA,kBAAY,EACV;IACE,SAAS,EAAE,UAAU,EAAE,WAAW,EAAE,WAAW,EAAE,aAAa;IAC9D,gBAAgB,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,QAAQ;CAClE,EACD,OAAO,CACR,EACD;IACE,kBAAkB,CAAC,MAA8B;QAC/C,eAAe,GAAG,MAAM,CAAC;IAC3B,CAAC;CACF,CACF,CAAC;AAEF,IAAA,eAAS,EAAC,kBAAkB,EAAE,aAAa,CAAC,CAAC;AAE7C,MAAM,UAAU,GAAG,IAAA,kBAAY,EAAC,CAAC,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO,CAAC,CAAC;AAEzD,IAAA,eAAS,EAAC,UAAU,EAAE,aAAa,CAAC,CAAC;AAErC,OAAO,CAAC,IAAI,CAAC,YAAY,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC;AACjD,OAAO,CAAC,QAAQ,CAAC,GAAG,EAAE;;IAEpB,MAAA,OAAO,CAAC,IAAI,wDAAG,OAAO,CAAC,CAAC;AAC1B,CAAC,CAAC,CAAC"}