mongoose 6.0.13 → 6.1.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.
@@ -45,6 +45,10 @@ e.last=function(t){if(t.length>0)return t[t.length-1]},e.clone=p,
45
45
  * ignore
46
46
  */
47
47
  e.promiseOrCallback=w,
48
+ /*!
49
+ * ignore
50
+ */
51
+ e.cloneArrays=function(t){return Array.isArray(t)?t.map((function(t){return e.cloneArrays(t)})):t},
48
52
  /*!
49
53
  * ignore
50
54
  */
@@ -276,11 +280,11 @@ w.prototype._applySetters=function(t,e,r,n){var i=t;if(r)return i;for(var o=this
276
280
  /*!
277
281
  * ignore
278
282
  */
279
- w.prototype._castNullish=function(t){return t},w.prototype.applySetters=function(t,e,r,n,i){var o=this._applySetters(t,e,r,n,i);return null==o?this._castNullish(o):o=this.cast(o,e,r,n,i)},w.prototype.applyGetters=function(t,e){var r=t,n=this.getters,i=n.length;if(0===i)return r;for(var o=0;o<i;++o)r=n[o].call(e,r,this);return r},w.prototype.select=function(t){return this.selected=!!t,this},w.prototype.doValidate=function(t,e,r,n){var o=!1,s=this.path,a=this.validators.filter((function(t){return null!=t&&"object"===i(t)})),u=a.length;if(!u)return e(null);var h=this;function f(t,r){if(!o)if(void 0===t||t)--u<=0&&l((function(){e(null)}));else{var n=r.ErrorConstructor||g;(o=new n(r))[m]=!0,l((function(){e(o)}))}}a.forEach((function(e){if(!o){var i,a=e.validator,u=p.clone(e);if(u.path=n&&n.path?n.path:s,u.value=t,a instanceof RegExp)f(a.test(t),u);else if("function"==typeof a)if(void 0!==t||a===h.requiredValidator){try{i=u.propsParameter?a.call(r,t,u):a.call(r,t)}catch(t){i=!1,u.reason=t,t.message&&(u.message=t.message)}null!=i&&"function"==typeof i.then?i.then((function(t){f(t,u)}),(function(t){u.reason=t,u.message=t.message,f(i=!1,u)})):f(i,u)}else f(!0,u)}}))},w.prototype.doValidateSync=function(t,e,r){var n=this.path;if(!this.validators.length)return null;var o=this.validators;if(void 0===t){if(!(this.validators.length>0&&"required"===this.validators[0].type))return null;o=[this.validators[0]]}var s=null;return o.forEach((function(o){if(!s&&null!=o&&"object"===i(o)){var u,h=o.validator,f=p.clone(o);if(f.path=r&&r.path?r.path:n,f.value=t,!c(h))if(h instanceof RegExp)a(h.test(t),f);else if("function"==typeof h){try{u=f.propsParameter?h.call(e,t,f):h.call(e,t)}catch(t){u=!1,f.reason=t}null!=u&&"function"==typeof u.then||a(u,f)}}})),s;function a(t,e){if(!s&&void 0!==t&&!t){var r=e.ErrorConstructor||g;(s=new r(e))[m]=!0}}},w._isRef=function(t,e,r,i){var o=i&&t.options&&(t.options.ref||t.options.refPath);if(!o&&r&&null!=r.$__){var s=r.$__fullPath(t.path,!0),a=r.ownerDocument?r.ownerDocument():r;o=null!=s&&a.$populated(s)||r.$populated(t.path)}return!!o&&(null==e||(!(n.isBuffer(e)||"Binary"===e._bsontype||!p.isObject(e))||i))},
283
+ w.prototype._castNullish=function(t){return t},w.prototype.applySetters=function(t,e,r,n,i){var o=this._applySetters(t,e,r,n,i);return null==o?this._castNullish(o):o=this.cast(o,e,r,n,i)},w.prototype.applyGetters=function(t,e){var r=t,n=this.getters,i=n.length;if(0===i)return r;for(var o=0;o<i;++o)r=n[o].call(e,r,this);return r},w.prototype.select=function(t){return this.selected=!!t,this},w.prototype.doValidate=function(t,e,r,n){var o=!1,s=this.path,a=this.validators.filter((function(t){return null!=t&&"object"===i(t)})),u=a.length;if(!u)return e(null);var h=this;function f(t,r){if(!o)if(void 0===t||t)--u<=0&&l((function(){e(null)}));else{var n=r.ErrorConstructor||g;(o=new n(r))[m]=!0,l((function(){e(o)}))}}a.forEach((function(e){if(!o){var i,a=e.validator,u=p.clone(e);if(u.path=n&&n.path?n.path:s,u.value=t,a instanceof RegExp)f(a.test(t),u);else if("function"==typeof a)if(void 0!==t||a===h.requiredValidator){try{i=u.propsParameter?a.call(r,t,u):a.call(r,t)}catch(t){i=!1,u.reason=t,t.message&&(u.message=t.message)}null!=i&&"function"==typeof i.then?i.then((function(t){f(t,u)}),(function(t){u.reason=t,u.message=t.message,f(i=!1,u)})):f(i,u)}else f(!0,u)}}))},w.prototype.doValidateSync=function(t,e,r){var n=this.path;if(!this.validators.length)return null;var o=this.validators;if(void 0===t){if(!(this.validators.length>0&&"required"===this.validators[0].type))return null;o=[this.validators[0]]}var s=null;return o.forEach((function(o){if(!s&&null!=o&&"object"===i(o)){var u,h=o.validator,f=p.clone(o);if(f.path=r&&r.path?r.path:n,f.value=t,!c(h))if(h instanceof RegExp)a(h.test(t),f);else if("function"==typeof h){try{u=f.propsParameter?h.call(e,t,f):h.call(e,t)}catch(t){u=!1,f.reason=t}null!=u&&"function"==typeof u.then||a(u,f)}}})),s;function a(t,e){if(!s&&void 0!==t&&!t){var r=e.ErrorConstructor||g;(s=new r(e))[m]=!0}}},w._isRef=function(t,e,r,i){var o=i&&t.options&&(t.options.ref||t.options.refPath);if(!o&&r&&null!=r.$__){var s=r.$__fullPath(t.path,!0),a=r.ownerDocument();o=null!=s&&a.$populated(s)||r.$populated(t.path)}return!!o&&(null==e||(!(n.isBuffer(e)||"Binary"===e._bsontype||!p.isObject(e))||i))},
280
284
  /*!
281
285
  * ignore
282
286
  */
283
- w.prototype._castRef=function(t,e,r){if(null==t)return t;if(null!=t.$__)return t.$__.wasPopulated=!0,t;if(n.isBuffer(t)||!p.isObject(t)){if(r)return t;throw new v(this.instance,t,this.path,null,this)}var i=e.$__fullPath(this.path,!0),o=(e.ownerDocument?e.ownerDocument():e).$populated(i,!0),s=t;return e.$__.populated&&e.$__.populated[i]&&e.$__.populated[i].options&&e.$__.populated[i].options.options&&e.$__.populated[i].options.options.lean||((s=new o.options[b](t)).$__.wasPopulated=!0),s},w.prototype.$conditionalHandlers={$all:function(t){var e=this;return Array.isArray(t)?t.map((function(t){return e.castForQuery(t)})):[this.castForQuery(t)]},$eq:_,$in:M,$ne:_,$nin:M,$exists:a,$type:u},
287
+ w.prototype._castRef=function(t,e,r){if(null==t)return t;if(null!=t.$__)return t.$__.wasPopulated=!0,t;if(n.isBuffer(t)||!p.isObject(t)){if(r)return t;throw new v(this.instance,t,this.path,null,this)}var i=e.$__fullPath(this.path,!0),o=e.ownerDocument().$populated(i,!0),s=t;return e.$__.populated&&e.$__.populated[i]&&e.$__.populated[i].options&&e.$__.populated[i].options.options&&e.$__.populated[i].options.options.lean||((s=new o.options[b](t)).$__.wasPopulated=!0),s},w.prototype.$conditionalHandlers={$all:function(t){var e=this;return Array.isArray(t)?t.map((function(t){return e.castForQuery(t)})):[this.castForQuery(t)]},$eq:_,$in:M,$ne:_,$nin:M,$exists:a,$type:u},
284
288
  /*!
285
289
  * Wraps `castForQuery` to handle context
286
290
  */
@@ -301,7 +305,7 @@ w.prototype.clone=function(){var t=Object.assign({},this.options),e=new this.con
301
305
  t.exports=e=w,e.CastError=v,e.ValidatorError=g}).call(this,r(3).Buffer)},function(t,e,r){"use strict";function n(t){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var i,o="object"===("undefined"==typeof Reflect?"undefined":n(Reflect))?Reflect:null,s=o&&"function"==typeof o.apply?o.apply:function(t,e,r){return Function.prototype.apply.call(t,e,r)};i=o&&"function"==typeof o.ownKeys?o.ownKeys:Object.getOwnPropertySymbols?function(t){return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t))}:function(t){return Object.getOwnPropertyNames(t)};var a=Number.isNaN||function(t){return t!=t};function u(){u.init.call(this)}t.exports=u,t.exports.once=function(t,e){return new Promise((function(r,n){function i(r){t.removeListener(e,o),n(r)}function o(){"function"==typeof t.removeListener&&t.removeListener("error",i),r([].slice.call(arguments))}v(t,e,o,{once:!0}),"error"!==e&&function(t,e,r){"function"==typeof t.on&&v(t,"error",e,r)}(t,i,{once:!0})}))},u.EventEmitter=u,u.prototype._events=void 0,u.prototype._eventsCount=0,u.prototype._maxListeners=void 0;var h=10;function f(t){if("function"!=typeof t)throw new TypeError('The "listener" argument must be of type Function. Received type '+n(t))}function c(t){return void 0===t._maxListeners?u.defaultMaxListeners:t._maxListeners}function l(t,e,r,n){var i,o,s,a;if(f(r),void 0===(o=t._events)?(o=t._events=Object.create(null),t._eventsCount=0):(void 0!==o.newListener&&(t.emit("newListener",e,r.listener?r.listener:r),o=t._events),s=o[e]),void 0===s)s=o[e]=r,++t._eventsCount;else if("function"==typeof s?s=o[e]=n?[r,s]:[s,r]:n?s.unshift(r):s.push(r),(i=c(t))>0&&s.length>i&&!s.warned){s.warned=!0;var u=new Error("Possible EventEmitter memory leak detected. "+s.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");u.name="MaxListenersExceededWarning",u.emitter=t,u.type=e,u.count=s.length,a=u,console&&console.warn&&console.warn(a)}return t}function d(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function p(t,e,r){var n={fired:!1,wrapFn:void 0,target:t,type:e,listener:r},i=d.bind(n);return i.listener=r,n.wrapFn=i,i}function m(t,e,r){var n=t._events;if(void 0===n)return[];var i=n[e];return void 0===i?[]:"function"==typeof i?r?[i.listener||i]:[i]:r?function(t){for(var e=new Array(t.length),r=0;r<e.length;++r)e[r]=t[r].listener||t[r];return e}(i):b(i,i.length)}function y(t){var e=this._events;if(void 0!==e){var r=e[t];if("function"==typeof r)return 1;if(void 0!==r)return r.length}return 0}function b(t,e){for(var r=new Array(e),n=0;n<e;++n)r[n]=t[n];return r}function v(t,e,r,i){if("function"==typeof t.on)i.once?t.once(e,r):t.on(e,r);else{if("function"!=typeof t.addEventListener)throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+n(t));t.addEventListener(e,(function n(o){i.once&&t.removeEventListener(e,n),r(o)}))}}Object.defineProperty(u,"defaultMaxListeners",{enumerable:!0,get:function(){return h},set:function(t){if("number"!=typeof t||t<0||a(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");h=t}}),u.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},u.prototype.setMaxListeners=function(t){if("number"!=typeof t||t<0||a(t))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+t+".");return this._maxListeners=t,this},u.prototype.getMaxListeners=function(){return c(this)},u.prototype.emit=function(t){for(var e=[],r=1;r<arguments.length;r++)e.push(arguments[r]);var n="error"===t,i=this._events;if(void 0!==i)n=n&&void 0===i.error;else if(!n)return!1;if(n){var o;if(e.length>0&&(o=e[0]),o instanceof Error)throw o;var a=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw a.context=o,a}var u=i[t];if(void 0===u)return!1;if("function"==typeof u)s(u,this,e);else{var h=u.length,f=b(u,h);for(r=0;r<h;++r)s(f[r],this,e)}return!0},u.prototype.addListener=function(t,e){return l(this,t,e,!1)},u.prototype.on=u.prototype.addListener,u.prototype.prependListener=function(t,e){return l(this,t,e,!0)},u.prototype.once=function(t,e){return f(e),this.on(t,p(this,t,e)),this},u.prototype.prependOnceListener=function(t,e){return f(e),this.prependListener(t,p(this,t,e)),this},u.prototype.removeListener=function(t,e){var r,n,i,o,s;if(f(e),void 0===(n=this._events))return this;if(void 0===(r=n[t]))return this;if(r===e||r.listener===e)0==--this._eventsCount?this._events=Object.create(null):(delete n[t],n.removeListener&&this.emit("removeListener",t,r.listener||e));else if("function"!=typeof r){for(i=-1,o=r.length-1;o>=0;o--)if(r[o]===e||r[o].listener===e){s=r[o].listener,i=o;break}if(i<0)return this;0===i?r.shift():function(t,e){for(;e+1<t.length;e++)t[e]=t[e+1];t.pop()}(r,i),1===r.length&&(n[t]=r[0]),void 0!==n.removeListener&&this.emit("removeListener",t,s||e)}return this},u.prototype.off=u.prototype.removeListener,u.prototype.removeAllListeners=function(t){var e,r,n;if(void 0===(r=this._events))return this;if(void 0===r.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==r[t]&&(0==--this._eventsCount?this._events=Object.create(null):delete r[t]),this;if(0===arguments.length){var i,o=Object.keys(r);for(n=0;n<o.length;++n)"removeListener"!==(i=o[n])&&this.removeAllListeners(i);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(e=r[t]))this.removeListener(t,e);else if(void 0!==e)for(n=e.length-1;n>=0;n--)this.removeListener(t,e[n]);return this},u.prototype.listeners=function(t){return m(this,t,!0)},u.prototype.rawListeners=function(t){return m(this,t,!1)},u.listenerCount=function(t,e){return"function"==typeof t.listenerCount?t.listenerCount(e):y.call(t,e)},u.prototype.listenerCount=y,u.prototype.eventNames=function(){return this._eventsCount>0?i(this._events):[]}},function(t,e){function r(t,e){if(!t)throw new Error(e||"Assertion failed")}t.exports=r,r.equal=function(t,e,r){if(t!=e)throw new Error(r||"Assertion failed: "+t+" != "+e)}},function(t,e,r){"use strict";var n=e,i=r(19),o=r(12),s=r(136);n.assert=o,n.toArray=s.toArray,n.zero2=s.zero2,n.toHex=s.toHex,n.encode=s.encode,n.getNAF=function(t,e,r){var n=new Array(Math.max(t.bitLength(),r)+1);n.fill(0);for(var i=1<<e+1,o=t.clone(),s=0;s<n.length;s++){var a,u=o.andln(i-1);o.isOdd()?(a=u>(i>>1)-1?(i>>1)-u:u,o.isubn(a)):a=0,n[s]=a,o.iushrn(1)}return n},n.getJSF=function(t,e){var r=[[],[]];t=t.clone(),e=e.clone();for(var n,i=0,o=0;t.cmpn(-i)>0||e.cmpn(-o)>0;){var s,a,u=t.andln(3)+i&3,h=e.andln(3)+o&3;3===u&&(u=-1),3===h&&(h=-1),s=0==(1&u)?0:3!==(n=t.andln(7)+i&7)&&5!==n||2!==h?u:-u,r[0].push(s),a=0==(1&h)?0:3!==(n=e.andln(7)+o&7)&&5!==n||2!==u?h:-h,r[1].push(a),2*i===s+1&&(i=1-i),2*o===a+1&&(o=1-o),t.iushrn(1),e.iushrn(1)}return r},n.cachedProperty=function(t,e,r){var n="_"+e;t.prototype[e]=function(){return void 0!==this[n]?this[n]:this[n]=r.call(this)}},n.parseBytes=function(t){return"string"==typeof t?n.toArray(t,"hex"):t},n.intFromLE=function(t){return new i(t,"hex","le")}},function(t,e,r){"use strict";
302
306
  /*!
303
307
  * Module dependencies.
304
- */function n(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function i(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=function(t,e){if(!t)return;if("string"==typeof t)return o(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return o(t,e)}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,i=function(){};return{s:i,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var s,a=!0,u=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){u=!0,s=t},f:function(){try{a||null==r.return||r.return()}finally{if(u)throw s}}}}function o(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function s(t){return(s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var a,u,h,f=r(11).EventEmitter,c=r(293),l=r(8),d=r(46),p=r(164),m=r(316),y=r(317),b=r(89),v=r(56),g=r(161),w=r(162),_=r(90),M=r(54),S=r(176),O=r(95).compile,A=r(95).defineKey,E=r(354).flatten,x=r(355),k=r(6),j=r(357),$=r(358),R=r(180),P=r(45),B=r(96),T=r(359),I=r(9).inspect,N=r(38).internalToObjectOptions,D=r(360),C=r(85),L=r(361),q=r(4),U=r(363),F=q.clone,z=q.deepEqual,V=q.isMongooseObject,K=r(1).arrayAtomicsBackupSymbol,H=r(1).arrayAtomicsSymbol,W=r(1).documentArrayParent,Z=r(1).documentIsModified,J=r(1).documentModifiedPaths,Y=r(1).documentSchemaSymbol,G=r(1).getSymbol,Q=r(1).populateModelSymbol,X=r(1).scopeSymbol,tt=r(57).schemaMixedSymbol,et=r(364),rt=q.specialProperties;function nt(t,e,r,n){var o=this;if("object"===s(r)&&null!=r&&(r=(n=r).skipId),n=Object.assign({},n),null==this.$__schema){var a=q.isObject(e)&&!e.instanceOfSchema?new b(e):e;this.$__setSchema(a),e=r,r=n,n=arguments[4]||{}}if(this.$__=new c,this.$__.emitter=new f,this.$isNew=!("isNew"in n)||n.isNew,"priorDoc"in n&&(this.$__.priorDoc=n.priorDoc),null!=t&&"object"!==s(t))throw new m(t,"obj","Document");var u=!0;void 0!==n.defaults&&(this.$__.defaults=n.defaults,u=n.defaults);var h=this.$__schema;"boolean"==typeof e||"throw"===e?(this.$__.strictMode=e,e=void 0):(this.$__.strictMode=h.options.strict,void 0!==e&&(this.$__.selected=e));var l,d=h.requiredPaths(!0),p=i(d);try{for(p.s();!(l=p.n()).done;){var y=l.value;this.$__.activePaths.require(y)}}catch(t){p.e(t)}finally{p.f()}this.$__.emitter.setMaxListeners(0);var v=null;q.isPOJO(e)&&(v=T(e));var g=!1===v&&e?ot(e):{};if(null==this._doc&&(this.$__buildDoc(t,e,r,v,g,!1),u&&st(this,e,r,v,g,!0,{isNew:this.$isNew})),t&&(this.$__original_set?this.$__original_set(t,void 0,!0):this.$set(t,void 0,!0),t instanceof nt&&(this.$isNew=t.$isNew)),n.willInit&&u?f.prototype.once.call(this,"init",(function(){st(o,e,r,v,g,!1,n.skipDefaults,o.$isNew)})):u&&st(this,e,r,v,g,!1,n.skipDefaults,this.$isNew),this.$__._id=this._id,!this.$__.strictMode&&t){var w=this,_=Object.keys(this._doc);_.forEach((function(t){t in h.tree||A({prop:t,subprops:null,prototype:w})}))}lt(this)}for(var it in Object.defineProperty(nt.prototype,"isNew",{get:function(){return this.$isNew},set:function(t){this.$isNew=t}}),Object.defineProperty(nt.prototype,"errors",{get:function(){return this.$errors},set:function(t){this.$errors=t}}),
308
+ */function n(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function i(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=function(t,e){if(!t)return;if("string"==typeof t)return o(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return o(t,e)}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,i=function(){};return{s:i,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var s,a=!0,u=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){u=!0,s=t},f:function(){try{a||null==r.return||r.return()}finally{if(u)throw s}}}}function o(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function s(t){return(s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var a,u,h,f=r(11).EventEmitter,c=r(293),l=r(8),d=r(46),p=r(164),m=r(316),y=r(317),b=r(89),v=r(56),g=r(161),w=r(162),_=r(90),M=r(54),S=r(176),O=r(95).compile,A=r(95).defineKey,E=r(354).flatten,x=r(355),k=r(6),j=r(357),$=r(358),R=r(180),P=r(45),B=r(96),T=r(359),I=r(9).inspect,N=r(38).internalToObjectOptions,D=r(360),C=r(85),L=r(361),q=r(4),U=r(363),F=q.clone,z=q.deepEqual,V=q.isMongooseObject,K=r(1).arrayAtomicsBackupSymbol,H=r(1).arrayAtomicsSymbol,W=r(1).documentArrayParent,Z=r(1).documentIsModified,J=r(1).documentModifiedPaths,Y=r(1).documentSchemaSymbol,G=r(1).getSymbol,Q=r(1).populateModelSymbol,X=r(1).scopeSymbol,tt=r(57).schemaMixedSymbol,et=r(364),rt=q.specialProperties;function nt(t,e,r,n){var o=this;if("object"===s(r)&&null!=r&&(r=(n=r).skipId),n=Object.assign({},n),null==this.$__schema){var a=q.isObject(e)&&!e.instanceOfSchema?new b(e):e;this.$__setSchema(a),e=r,r=n,n=arguments[4]||{}}if(this.$__=new c,this.$__.emitter=new f,this.$isNew=!("isNew"in n)||n.isNew,"priorDoc"in n&&(this.$__.priorDoc=n.priorDoc),null!=t&&"object"!==s(t))throw new m(t,"obj","Document");var u=!0;void 0!==n.defaults&&(this.$__.defaults=n.defaults,u=n.defaults);var h=this.$__schema;"boolean"==typeof e||"throw"===e?(this.$__.strictMode=e,e=void 0):(this.$__.strictMode=h.options.strict,void 0!==e&&(this.$__.selected=e));var l,d=h.requiredPaths(!0),p=i(d);try{for(p.s();!(l=p.n()).done;){var y=l.value;this.$__.activePaths.require(y)}}catch(t){p.e(t)}finally{p.f()}this.$__.emitter.setMaxListeners(0);var v=null;q.isPOJO(e)&&(v=T(e));var g=!1===v&&e?ot(e):{};if(null==this._doc&&(this.$__buildDoc(t,e,r,v,g,!1),u&&st(this,e,r,v,g,!0,{isNew:this.$isNew})),t&&(this.$__original_set?this.$__original_set(t,void 0,!0):this.$set(t,void 0,!0),t instanceof nt&&(this.$isNew=t.$isNew)),n.willInit&&u?f.prototype.once.call(this,"init",(function(){st(o,e,r,v,g,!1,n.skipDefaults,o.$isNew)})):u&&st(this,e,r,v,g,!1,n.skipDefaults,this.$isNew),this.$__._id=this._id,!this.$__.strictMode&&t){var w=this,_=Object.keys(this._doc);_.forEach((function(t){t in h.tree||t in h.methods||t in h.virtuals||t.startsWith("$")||A({prop:t,subprops:null,prototype:w})}))}lt(this)}for(var it in Object.defineProperty(nt.prototype,"isNew",{get:function(){return this.$isNew},set:function(t){this.$isNew=t}}),Object.defineProperty(nt.prototype,"errors",{get:function(){return this.$errors},set:function(t){this.$errors=t}}),
305
309
  /*!
306
310
  * Document exposes the NodeJS event emitter API, so you can use
307
311
  * `on`, `once`, etc.
@@ -324,7 +328,7 @@ function ht(t){var e={};!
324
328
  /*!
325
329
  * ignore
326
330
  */
327
- function(t){Object.keys(t.$__.activePaths.states.require).forEach((function(e){var r=t.$__schema.path(e);null!=r&&"function"==typeof r.originalRequiredValue&&(t.$__.cachedRequired=t.$__.cachedRequired||{},t.$__.cachedRequired[e]=r.originalRequiredValue.call(t,t))}))}(t);var r=new Set(Object.keys(t.$__.activePaths.states.require).filter((function(e){return!(!t.$__isSelected(e)&&!t.$isModified(e))&&(null==t.$__.cachedRequired||!(e in t.$__.cachedRequired)||t.$__.cachedRequired[e])})));function n(t){r.add(t)}Object.keys(t.$__.activePaths.states.init).forEach(n),Object.keys(t.$__.activePaths.states.modify).forEach(n),Object.keys(t.$__.activePaths.states.default).forEach(n);var o,s=t.$getAllSubdocs(),a=t.modifiedPaths(),u=i(s);try{for(u.s();!(o=u.n()).done;){var h=o.value;if(h.$basePath){var f,c=i(r);try{for(c.s();!(f=c.n()).done;){var l=f.value;(null===l||l.startsWith(h.$basePath+"."))&&r.delete(l)}}catch(t){c.e(t)}finally{c.f()}!t.$isModified(h.$basePath,a)||t.isDirectModified(h.$basePath)||t.$isDefault(h.$basePath)||(r.add(h.$basePath),e[h.$basePath]=!0)}}}catch(t){u.e(t)}finally{u.f()}var d,p=i(r);try{for(p.s();!(d=p.n()).done;){var m=d.value,y=t.$__schema.path(m);if(y&&y.$isMongooseArray&&(!y.$isMongooseDocumentArray||k(y,"schemaOptions.required")))b(t.$__getValue(m),r,m)}}catch(t){p.e(t)}finally{p.f()}function b(t,e,r){if(null!=t)for(var n=t.length,i=0;i<n;++i)Array.isArray(t[i])?b(t[i],e,r+"."+i):e.add(r+"."+i)}var v,g={skipArrays:!0},w=i(r);try{for(w.s();!(v=w.n()).done;){var _=v.value;if(t.$__schema.nested[_]){var M=t.$__getValue(_);V(M)&&(M=M.toObject({transform:!1}));var S=E(M,_,g,t.$__schema);Object.keys(S).forEach(n)}}}catch(t){w.e(t)}finally{w.f()}var O,A=i(r);try{for(A.s();!(O=A.n()).done;){var x=O.value;if(t.$__schema.singleNestedPaths.hasOwnProperty(x))r.delete(x);else{var j=t.$__schema.path(x);if(j&&j.$isSchemaMap){var $=t.$__getValue(x);if(null!=$){var R,P=i($.keys());try{for(P.s();!(R=P.n()).done;){var B=R.value;r.add(x+"."+B)}}catch(t){P.e(t)}finally{P.f()}}}}}}catch(t){A.e(t)}finally{A.f()}return[r=Array.from(r),e]}
331
+ function(t){Object.keys(t.$__.activePaths.states.require).forEach((function(e){var r=t.$__schema.path(e);if(null!=r&&"function"==typeof r.originalRequiredValue){t.$__.cachedRequired=t.$__.cachedRequired||{};try{t.$__.cachedRequired[e]=r.originalRequiredValue.call(t,t)}catch(r){t.invalidate(e,r)}}}))}(t);var r=new Set(Object.keys(t.$__.activePaths.states.require).filter((function(e){return!(!t.$__isSelected(e)&&!t.$isModified(e))&&(null==t.$__.cachedRequired||!(e in t.$__.cachedRequired)||t.$__.cachedRequired[e])})));function n(t){r.add(t)}Object.keys(t.$__.activePaths.states.init).forEach(n),Object.keys(t.$__.activePaths.states.modify).forEach(n),Object.keys(t.$__.activePaths.states.default).forEach(n);var o,s=t.$getAllSubdocs(),a=t.modifiedPaths(),u=i(s);try{for(u.s();!(o=u.n()).done;){var h=o.value;if(h.$basePath){var f,c=i(r);try{for(c.s();!(f=c.n()).done;){var l=f.value;(null===l||l.startsWith(h.$basePath+"."))&&r.delete(l)}}catch(t){c.e(t)}finally{c.f()}!t.$isModified(h.$basePath,a)||t.isDirectModified(h.$basePath)||t.$isDefault(h.$basePath)||(r.add(h.$basePath),e[h.$basePath]=!0)}}}catch(t){u.e(t)}finally{u.f()}var d,p=i(r);try{for(p.s();!(d=p.n()).done;){var m=d.value,y=t.$__schema.path(m);if(y&&y.$isMongooseArray&&(!y.$isMongooseDocumentArray||k(y,"schemaOptions.required")))b(t.$__getValue(m),r,m)}}catch(t){p.e(t)}finally{p.f()}function b(t,e,r){if(null!=t)for(var n=t.length,i=0;i<n;++i)Array.isArray(t[i])?b(t[i],e,r+"."+i):e.add(r+"."+i)}var v,g={skipArrays:!0},w=i(r);try{for(w.s();!(v=w.n()).done;){var _=v.value;if(t.$__schema.nested[_]){var M=t.$__getValue(_);V(M)&&(M=M.toObject({transform:!1}));var S=E(M,_,g,t.$__schema);Object.keys(S).forEach(n)}}}catch(t){w.e(t)}finally{w.f()}var O,A=i(r);try{for(A.s();!(O=A.n()).done;){var x=O.value;if(t.$__schema.singleNestedPaths.hasOwnProperty(x))r.delete(x);else{var j=t.$__schema.path(x);if(j&&j.$isSchemaMap){var $=t.$__getValue(x);if(null!=$){var R,P=i($.keys());try{for(P.s();!(R=P.n()).done;){var B=R.value;r.add(x+"."+B)}}catch(t){P.e(t)}finally{P.f()}}}}}}catch(t){A.e(t)}finally{A.f()}return[r=Array.from(r),e]}
328
332
  /*!
329
333
  * ignore
330
334
  */
@@ -372,22 +376,22 @@ nt.prototype.$__init=function(t,e){if(this.$isNew=!1,this.$init=!0,e=e||{},null!
372
376
  * @param {Object} doc object we are initializing
373
377
  * @api private
374
378
  */
375
- return function t(e,r,n,i,o){o=o||"";var s,a,u,h=Object.keys(r),f=h.length,c=0,l=e.$__.strictMode;for(;c<f;)d(c++);function d(f){if(u=h[f],a=o+u,s=e.$__schema.path(a),!e.$__schema.$isRootDiscriminator||e.$__isSelected(a))if(!s&&q.isPOJO(r[u]))n[u]||(n[u]={}),t(e,r[u],n[u],i,a+".");else if(s){if(n.hasOwnProperty(u)&&void 0!==r[u]&&delete n[u],null===r[u])n[u]=s._castNullish(null);else if(void 0!==r[u]){var c=(r[u].$__||{}).wasPopulated||null;if(s&&!c)try{n[u]=s.cast(r[u],e,!0)}catch(t){e.invalidate(t.path,new w({path:t.path,message:t.message,type:"cast",value:t.value,reason:t}))}else n[u]=r[u]}e.$isModified(a)||e.$__.activePaths.init(a)}else n[u]=r[u],l||(e[u]=r[u])}}(this,t,this._doc,e),D(this,e.populated),this.$emit("init",this),this.constructor.emit("init",this),this.$__._id=this._id,this},nt.prototype.update=function(){var t=q.args(arguments);t.unshift({_id:this._id});var e=this.constructor.update.apply(this.constructor,t);return null!=this.$session()&&("session"in e.options||(e.options.session=this.$session())),e},nt.prototype.updateOne=function(t,e,r){var n=this,i=this.constructor.updateOne({_id:this._id},t,e);return i.pre((function(t){n.constructor._middleware.execPre("updateOne",n,[n],t)})),i.post((function(t){n.constructor._middleware.execPost("updateOne",n,[n],{},t)})),null!=this.$session()&&("session"in i.options||(i.options.session=this.$session())),null!=r?i.exec(r):i},nt.prototype.replaceOne=function(){var t=q.args(arguments);return t.unshift({_id:this._id}),this.constructor.replaceOne.apply(this.constructor,t)},nt.prototype.$session=function(t){if(0===arguments.length)return null!=this.$__.session&&this.$__.session.hasEnded?(this.$__.session=null,null):this.$__.session;if(null!=t&&t.hasEnded)throw new l("Cannot set a document's session to a session that has ended. Make sure you haven't called `endSession()` on the session you are passing to `$session()`.");if(this.$__.session=t,!this.ownerDocument){var e,r=this.$getAllSubdocs(),n=i(r);try{for(n.s();!(e=n.n()).done;){var o=e.value;o.$session(t)}}catch(t){n.e(t)}finally{n.f()}}return t},nt.prototype.overwrite=function(t){for(var e=0,r=Array.from(new Set(Object.keys(this._doc).concat(Object.keys(t))));e<r.length;e++){var n=r[e];"_id"!==n&&(this.$__schema.options.versionKey&&n===this.$__schema.options.versionKey||this.$__schema.options.discriminatorKey&&n===this.$__schema.options.discriminatorKey||this.$set(n,t[n]))}return this},nt.prototype.$set=function(t,e,r,o){var a=this;q.isPOJO(r)&&(o=r,r=void 0);var u,h,f,c,m=(o=o||{}).merge,y=r&&!0!==r,b=!0===r,g=this.$__schema.options.typeKey,w=0,_="strict"in o?o.strict:this.$__.strictMode;if(y&&((this.$__.adhocPaths||(this.$__.adhocPaths={}))[t]=this.$__schema.interpretAsType(t,r,this.$__schema.options)),null==t){var M=[e,t];t=M[0],e=M[1]}else if("string"!=typeof t){if(t instanceof nt&&(t=t.$__isNested?t.toObject():t._doc),null==t){var O=[e,t];t=O[0],e=O[1]}c=e?e+".":"";var A=(u=$(this.$__schema,t)).length,E=k(o,"_skipMinimizeTopLevel",!1);if(0===A&&E)return delete o._skipMinimizeTopLevel,e&&this.$set(e,{}),this;for(var x=0;x<A;++x){var P=c+(f=u[x]);h=this.$__schema.pathType(P);var B=t[f];if(!0!==r||c||null==t[f]||"nested"!==h||null==this._doc[f]?o=Object.assign({},o,{_skipMinimizeTopLevel:!1}):(delete this._doc[f],o=Object.assign({},o,{_skipMinimizeTopLevel:!0})),q.isNonBuiltinObject(B)&&"nested"===h)at(t[f],c+f,this),this.$set(c+f,t[f],b,Object.assign({},o,{_skipMarkModified:!0}));else if(_){if(b&&void 0===t[f]&&void 0!==this.$get(P))continue;if("adhocOrUndefined"===h&&(h=j(this,P,{typeOnly:!0})),"real"===h||"virtual"===h){var T=t[f];this.$__schema.paths[P]&&this.$__schema.paths[P].$isSingleNested&&t[f]instanceof nt&&(T=T.toObject({virtuals:!1,transform:!1})),this.$set(c+f,T,b,o)}else if("nested"===h&&t[f]instanceof nt)this.$set(c+f,t[f].toObject({transform:!1}),b,o);else if("throw"===_)throw"nested"===h?new p(f,t[f]):new v(f)}else void 0!==t[f]&&this.$set(c+f,t[f],b,o)}for(var I=0,N=Object.keys(this.$__schema.tree);I<N.length;I++){var D=N[I];if(this._doc.hasOwnProperty(D)){var L=this._doc[D];delete this._doc[D],this._doc[D]=L}}return this}var U=this.$__schema.pathType(t);"adhocOrUndefined"===U&&(U=j(this,t,{typeOnly:!0})),e=R(e);var F,z=null!=a.$__.priorDoc?a.$__.priorDoc.$__getValue(t):b?void 0:a.$__getValue(t);if("nested"===U&&e){if("object"===s(e)&&null!=e){var V=null!=this.$__.savedState&&this.$__.savedState.hasOwnProperty(t);if(null!=this.$__.savedState&&!this.$isNew&&!this.$__.savedState.hasOwnProperty(t)){var K=this.$__getValue(t);this.$__.savedState[t]=K;for(var H=0,W=Object.keys(K||{});H<W.length;H++){var Z=W[H];this.$__.savedState[t+"."+Z]=K[Z]}}if(m)return this.$set(e,t,b);this.$__setValue(t,null),S(this,t);var J=$(this.$__schema,e,t);this.$__setValue(t,{});var Y,G=i(J);try{for(G.s();!(Y=G.n()).done;){var X=Y.value;this.$set(t+"."+X,e[X],b,o)}}catch(t){G.e(t)}finally{G.f()}return null!=z&&q.deepEqual(V?this.$__.savedState[t]:z,e)?this.unmarkModified(t):this.markModified(t),S(this,t,{skipDocArrays:!0}),this}return this.invalidate(t,new l.CastError("Object",e,t)),this}var tt=-1===t.indexOf(".")?[t]:t.split(".");if("string"==typeof this.$__schema.aliases[tt[0]]&&(tt[0]=this.$__schema.aliases[tt[0]]),"adhocOrUndefined"===U&&_){var et;for(w=0;w<tt.length;++w){var rt=tt.slice(0,w+1).join(".");if(w+1<tt.length&&"virtual"===this.$__schema.pathType(rt))return C.set(t,e,this),this;if(null!=(F=this.$__schema.path(rt))&&F instanceof d){et=!0;break}}if(null==F&&(F=j(this,t)),!et&&!F){if("throw"===_)throw new v(t);return this}}else{if("virtual"===U)return(F=this.$__schema.virtualpath(t)).applySetters(e,this),this;F=this.$__path(t)}var it,ot=this._doc,st="";for(w=0;w<tt.length-1;++w)ot=ot[tt[w]],st+=(st.length>0?".":"")+tt[w],ot||(this.$set(st,{}),this.$__isSelected(st)||this.unmarkModified(st),ot=this.$__getValue(st));if(tt.length<=1)it=t;else{for(w=0;w<tt.length;++w){var ut=tt.slice(0,w+1).join(".");if(null===this.$get(ut,null,{getters:!1})){it=ut;break}}it||(it=t)}if(!F)return this.$__set(it,t,o,b,tt,F,e,z),this;if((F.$isSingleNested||F.$isMongooseArray)&&
379
+ return function t(e,r,n,i,o){o=o||"";var s,a,u,h=Object.keys(r),f=h.length,c=0,l=e.$__.strictMode;for(;c<f;)d(c++);function d(f){if(u=h[f],a=o+u,s=e.$__schema.path(a),!e.$__schema.$isRootDiscriminator||e.$__isSelected(a))if(!s&&q.isPOJO(r[u]))n[u]||(n[u]={}),t(e,r[u],n[u],i,a+".");else if(s){if(n.hasOwnProperty(u)&&void 0!==r[u]&&delete n[u],null===r[u])n[u]=s._castNullish(null);else if(void 0!==r[u]){var c=(r[u].$__||{}).wasPopulated||null;if(s&&!c)try{n[u]=s.cast(r[u],e,!0)}catch(t){e.invalidate(t.path,new w({path:t.path,message:t.message,type:"cast",value:t.value,reason:t}))}else n[u]=r[u]}e.$isModified(a)||e.$__.activePaths.init(a)}else n[u]=r[u],l||o||(e[u]=r[u])}}(this,t,this._doc,e),D(this,e.populated),this.$emit("init",this),this.constructor.emit("init",this),this.$__._id=this._id,this},nt.prototype.update=function(){var t=q.args(arguments);t.unshift({_id:this._id});var e=this.constructor.update.apply(this.constructor,t);return null!=this.$session()&&("session"in e.options||(e.options.session=this.$session())),e},nt.prototype.updateOne=function(t,e,r){var n=this,i=this.constructor.updateOne({_id:this._id},t,e);return i.pre((function(t){n.constructor._middleware.execPre("updateOne",n,[n],t)})),i.post((function(t){n.constructor._middleware.execPost("updateOne",n,[n],{},t)})),null!=this.$session()&&("session"in i.options||(i.options.session=this.$session())),null!=r?i.exec(r):i},nt.prototype.replaceOne=function(){var t=q.args(arguments);return t.unshift({_id:this._id}),this.constructor.replaceOne.apply(this.constructor,t)},nt.prototype.$session=function(t){if(0===arguments.length)return null!=this.$__.session&&this.$__.session.hasEnded?(this.$__.session=null,null):this.$__.session;if(null!=t&&t.hasEnded)throw new l("Cannot set a document's session to a session that has ended. Make sure you haven't called `endSession()` on the session you are passing to `$session()`.");if(this.$__.session=t,!this.$__.isSubDocument){var e,r=this.$getAllSubdocs(),n=i(r);try{for(n.s();!(e=n.n()).done;){var o=e.value;o.$session(t)}}catch(t){n.e(t)}finally{n.f()}}return t},nt.prototype.overwrite=function(t){for(var e=0,r=Array.from(new Set(Object.keys(this._doc).concat(Object.keys(t))));e<r.length;e++){var n=r[e];"_id"!==n&&(this.$__schema.options.versionKey&&n===this.$__schema.options.versionKey||this.$__schema.options.discriminatorKey&&n===this.$__schema.options.discriminatorKey||this.$set(n,t[n]))}return this},nt.prototype.$set=function(t,e,r,o){var a=this;q.isPOJO(r)&&(o=r,r=void 0);var u,h,f,c,m=(o=o||{}).merge,y=r&&!0!==r,b=!0===r,g=this.$__schema.options.typeKey,w=0,_="strict"in o?o.strict:this.$__.strictMode;if(y&&((this.$__.adhocPaths||(this.$__.adhocPaths={}))[t]=this.$__schema.interpretAsType(t,r,this.$__schema.options)),null==t){var M=[e,t];t=M[0],e=M[1]}else if("string"!=typeof t){if(t instanceof nt&&(t=t.$__isNested?t.toObject():t._doc),null==t){var O=[e,t];t=O[0],e=O[1]}c=e?e+".":"";var A=(u=$(this.$__schema,t)).length,E=k(o,"_skipMinimizeTopLevel",!1);if(0===A&&E)return delete o._skipMinimizeTopLevel,e&&this.$set(e,{}),this;for(var x=0;x<A;++x){var P=c+(f=u[x]);h=this.$__schema.pathType(P);var B=t[f];if(!0!==r||c||null==t[f]||"nested"!==h||null==this._doc[f]?o=Object.assign({},o,{_skipMinimizeTopLevel:!1}):(delete this._doc[f],o=Object.assign({},o,{_skipMinimizeTopLevel:!0})),q.isNonBuiltinObject(B)&&"nested"===h)at(t[f],c+f,this),this.$set(c+f,t[f],b,Object.assign({},o,{_skipMarkModified:!0}));else if(_){if(b&&void 0===t[f]&&void 0!==this.$get(P))continue;if("adhocOrUndefined"===h&&(h=j(this,P,{typeOnly:!0})),"real"===h||"virtual"===h){var T=t[f];this.$__schema.paths[P]&&this.$__schema.paths[P].$isSingleNested&&t[f]instanceof nt&&(T=T.toObject({virtuals:!1,transform:!1})),this.$set(c+f,T,b,o)}else if("nested"===h&&t[f]instanceof nt)this.$set(c+f,t[f].toObject({transform:!1}),b,o);else if("throw"===_)throw"nested"===h?new p(f,t[f]):new v(f)}else void 0!==t[f]&&this.$set(c+f,t[f],b,o)}for(var I=0,D=Object.keys(this.$__schema.tree);I<D.length;I++){var L=D[I];if(this._doc.hasOwnProperty(L)){var U=this._doc[L];delete this._doc[L],this._doc[L]=U}}return this}var F=this.$__schema.pathType(t);"adhocOrUndefined"===F&&(F=j(this,t,{typeOnly:!0})),e=R(e);var z,V=null!=a.$__.priorDoc?a.$__.priorDoc.$__getValue(t):b?void 0:a.$__getValue(t);if("nested"===F&&e){if("object"===s(e)&&null!=e){if(null!=e.$__&&(e=e.toObject(N)),null==e)return this.invalidate(t,new l.CastError("Object",e,t)),this;var K=null!=this.$__.savedState&&this.$__.savedState.hasOwnProperty(t);if(null!=this.$__.savedState&&!this.$isNew&&!this.$__.savedState.hasOwnProperty(t)){var H=this.$__getValue(t);this.$__.savedState[t]=H;for(var W=0,Z=Object.keys(H||{});W<Z.length;W++){var J=Z[W];this.$__.savedState[t+"."+J]=H[J]}}if(m)return this.$set(e,t,b);this.$__setValue(t,null),S(this,t);var Y=$(this.$__schema,e,t);this.$__setValue(t,{});var G,X=i(Y);try{for(X.s();!(G=X.n()).done;){var tt=G.value;this.$set(t+"."+tt,e[tt],b,o)}}catch(t){X.e(t)}finally{X.f()}return null!=V&&q.deepEqual(K?this.$__.savedState[t]:V,e)?this.unmarkModified(t):this.markModified(t),S(this,t,{skipDocArrays:!0}),this}return this.invalidate(t,new l.CastError("Object",e,t)),this}var et=-1===t.indexOf(".")?[t]:t.split(".");if("string"==typeof this.$__schema.aliases[et[0]]&&(et[0]=this.$__schema.aliases[et[0]]),"adhocOrUndefined"===F&&_){var rt;for(w=0;w<et.length;++w){var it=et.slice(0,w+1).join(".");if(w+1<et.length&&"virtual"===this.$__schema.pathType(it))return C.set(t,e,this),this;if(null!=(z=this.$__schema.path(it))&&z instanceof d){rt=!0;break}}if(null==z&&(z=j(this,t)),!rt&&!z){if("throw"===_)throw new v(t);return this}}else{if("virtual"===F)return(z=this.$__schema.virtualpath(t)).applySetters(e,this),this;z=this.$__path(t)}var ot,st=this._doc,ut="";for(w=0;w<et.length-1;++w)st=st[et[w]],ut+=(ut.length>0?".":"")+et[w],st||(this.$set(ut,{}),this.$__isSelected(ut)||this.unmarkModified(ut),st=this.$__getValue(ut));if(et.length<=1)ot=t;else{for(w=0;w<et.length;++w){var ht=et.slice(0,w+1).join(".");if(null===this.$get(ht,null,{getters:!1})){ot=ht;break}}ot||(ot=t)}if(!z)return this.$__set(ot,t,o,b,et,z,e,V),this;if((z.$isSingleNested||z.$isMongooseArray)&&
376
380
  /*!
377
381
  * ignore
378
382
  */
379
383
  function(t,e){if(!t.$__.validationError)return;for(var r=Object.keys(t.$__.validationError.errors),n=0,i=r;n<i.length;n++){var o=i[n];o.startsWith(e+".")&&delete t.$__.validationError.errors[o]}0===Object.keys(t.$__.validationError.errors).length&&(t.$__.validationError=null)}
380
384
  /*!
381
385
  * ignore
382
- */(this,t),F.$isSingleNested&&null!=e&&m){e instanceof nt&&(e=e.toObject({virtuals:!1,transform:!1}));for(var ht=0,ft=Object.keys(e);ht<ft.length;ht++){var ct=ft[ht];this.$set(t+"."+ct,e[ct],b,o)}return this}var lt=!0;try{var dt,pt=function(){if(null==F.options)return!1;if(!(e instanceof nt))return!1;var t=e.constructor,r=F.options.ref;if(null!=r&&(r===t.modelName||r===t.baseModelName))return!0;var n=F.options.refPath;if(null==n)return!1;var i=e.get(n);return i===t.modelName||i===t.baseModelName}(),mt=!1;if(pt&&e instanceof nt&&(this.$populated(t,e._id,n({},Q,e.constructor)),e.$__.wasPopulated=!0,mt=!0),F.options&&Array.isArray(F.options[g])&&F.options[g].length&&F.options[g][0].ref&&
386
+ */(this,t),z.$isSingleNested&&null!=e&&m){e instanceof nt&&(e=e.toObject({virtuals:!1,transform:!1}));for(var ft=0,ct=Object.keys(e);ft<ct.length;ft++){var lt=ct[ft];this.$set(t+"."+lt,e[lt],b,o)}return this}var dt=!0;try{var pt,mt=function(){if(null==z.options)return!1;if(!(e instanceof nt))return!1;var t=e.constructor,r=z.options.ref;if(null!=r&&(r===t.modelName||r===t.baseModelName))return!0;var n=z.options.refPath;if(null==n)return!1;var i=e.get(n);return i===t.modelName||i===t.baseModelName}(),yt=!1;if(mt&&e instanceof nt&&(this.$populated(t,e._id,n({},Q,e.constructor)),e.$__.wasPopulated=!0,yt=!0),z.options&&Array.isArray(z.options[g])&&z.options[g].length&&z.options[g][0].ref&&
383
387
  /*!
384
388
  * ignore
385
389
  */
386
- function(t,e){if(!Array.isArray(t))return!1;if(0===t.length)return!1;var r,n=i(t);try{for(n.s();!(r=n.n()).done;){var o=r.value;if(!(o instanceof nt))return!1;if(null==o.constructor.modelName)return!1;if(o.constructor.modelName!=e&&o.constructor.baseModelName!=e)return!1}}catch(t){n.e(t)}finally{n.f()}return!0}(e,F.options[g][0].ref)){dt=n({},Q,e[0].constructor),this.$populated(t,e.map((function(t){return t._id})),dt);var yt,bt=i(e);try{for(bt.s();!(yt=bt.n()).done;){yt.value.$__.wasPopulated=!0}}catch(t){bt.e(t)}finally{bt.f()}mt=!0}if(null==this.$__schema.singleNestedPaths[t]&&(e=F.applySetters(e,this,!1,z)),F.$isMongooseDocumentArray&&Array.isArray(e)&&e.length>0&&null!=e[0]&&null!=e[0].$__&&null!=e[0].$__.populated){for(var vt=Object.keys(e[0].$__.populated),gt=function(){var r=_t[wt];a.$populated(t+"."+r,e.map((function(t){return t.$populated(r)})),e[0].$__.populated[r].options)},wt=0,_t=vt;wt<_t.length;wt++)gt();mt=!0}if(!mt&&this.$__.populated){if(Array.isArray(e)&&this.$__.populated[t])for(var Mt=0;Mt<e.length;++Mt)e[Mt]instanceof nt&&e.set(Mt,e[Mt]._id,!0);delete this.$__.populated[t]}F.$isSingleNested&&null!=e&&function(t,e,r){var n=e.schema;if(null==n)return;for(var i=0,o=Object.keys(n.paths);i<o.length;i++){var s=o[i],a=n.paths[s];if(null!=a.$immutableSetter){var u=null==r?void 0:r.$__getValue(s);a.$immutableSetter.call(t,u)}}}(e,F,z),this.$markValid(t)}catch(r){r instanceof l.StrictModeError&&r.isImmutableError?this.invalidate(t,r):r instanceof l.CastError?(this.invalidate(r.path,r),r.$originalErrorPath&&this.invalidate(t,new l.CastError(F.instance,e,t,r.$originalErrorPath))):this.invalidate(t,new l.CastError(F.instance,e,t,r)),lt=!1}if(lt){var St=this.ownerDocument?this.ownerDocument():this,Ot=St.$__.savedState,At=this.ownerDocument?this.$__.fullPath+"."+t:t;if(null!=Ot){var Et=At.indexOf("."),xt=-1===Et?At:At.slice(0,Et);Ot.hasOwnProperty(xt)||(Ot[xt]=q.clone(St.$__getValue(xt)))}this.$__set(it,t,o,b,tt,F,e,z),null!=Ot&&Ot.hasOwnProperty(At)&&q.deepEqual(e,Ot[At])&&this.unmarkModified(t)}return F.$isSingleNested&&(this.isDirectModified(t)||null==e)&&S(this,t),this},nt.prototype.set=nt.prototype.$set,nt.prototype.$__shouldModify=function(t,e,r,n,i,o,s,a){return!r._skipMarkModified&&(!!this.$isNew||null==this.$__schema.singleNestedPaths[e]&&(void 0===s&&!this.$__isSelected(e)||(void 0!==s||!(e in this.$__.activePaths.states.default))&&(!(this.$populated(e)&&s instanceof nt&&z(s._id,a))&&(!z(s,a||q.getValue(e,this))||!(n||null==s||!(e in this.$__.activePaths.states.default)||!z(s,o.getDefault(this,n)))))))},nt.prototype.$__set=function(t,e,n,i,o,s,a,f){h=h||r(47);var c=this.$__shouldModify(t,e,n,i,o,s,a,f),l=this;c?(this.markModified(t),u||(u=r(175)),a&&a.isMongooseArray&&(a._registerAtomic("$set",a),a.isMongooseDocumentArray&&a.forEach((function(t){t&&t.__parentArray&&(t.__parentArray=a)})),this.$__.activePaths.forEach((function(t){t.startsWith(e+".")&&l.$__.activePaths.ignore(t)})))):Array.isArray(a)&&a.isMongooseArray&&Array.isArray(f)&&f.isMongooseArray&&(a[H]=f[H],a[K]=f[K]);for(var d=this._doc,p=0,m=o.length,y="";p<m;p++){var b=p+1===m;if(y+=y?"."+o[p]:o[p],rt.has(o[p]))return;b?d instanceof Map?d.set(o[p],a):d[o[p]]=a:(q.isPOJO(d[o[p]])||d[o[p]]&&d[o[p]]instanceof h||d[o[p]]&&d[o[p]].$isSingleNested||d[o[p]]&&Array.isArray(d[o[p]])||(d[o[p]]=d[o[p]]||{}),d=d[o[p]])}},nt.prototype.$__getValue=function(t){return q.getValue(t,this._doc)},nt.prototype.$__setValue=function(t,e){return q.setValue(t,e,this._doc),this},nt.prototype.get=function(t,e,r){var n;r=r||{},e&&(n=this.$__schema.interpretAsType(t,e,this.$__schema.options));var i=this.$__path(t);if(null==i&&(i=this.$__schema.virtualpath(t)),i instanceof d){var o=this.$__schema.virtualpath(t);null!=o&&(i=o)}var s=-1===t.indexOf(".")?[t]:t.split("."),a=this._doc;if(i instanceof _)return i.applyGetters(void 0,this);"string"==typeof this.$__schema.aliases[s[0]]&&(s[0]=this.$__schema.aliases[s[0]]);for(var u=0,h=s.length;u<h;u++)a&&a._doc&&(a=a._doc),a=null==a?void 0:a instanceof Map?a.get(s[u],{getters:!1}):u===h-1?q.getValue(s[u],a):a[s[u]];if(n&&(a=n.cast(a)),null!=i&&!1!==r.getters)a=i.applyGetters(a,this);else if(this.$__schema.nested[t]&&r.virtuals)return dt(this,q.clone(a)||{},{path:t});return a},
390
+ function(t,e){if(!Array.isArray(t))return!1;if(0===t.length)return!1;var r,n=i(t);try{for(n.s();!(r=n.n()).done;){var o=r.value;if(!(o instanceof nt))return!1;if(null==o.constructor.modelName)return!1;if(o.constructor.modelName!=e&&o.constructor.baseModelName!=e)return!1}}catch(t){n.e(t)}finally{n.f()}return!0}(e,z.options[g][0].ref)){pt=n({},Q,e[0].constructor),this.$populated(t,e.map((function(t){return t._id})),pt);var bt,vt=i(e);try{for(vt.s();!(bt=vt.n()).done;){bt.value.$__.wasPopulated=!0}}catch(t){vt.e(t)}finally{vt.f()}yt=!0}if(null==this.$__schema.singleNestedPaths[t]&&(e=z.applySetters(e,this,!1,V)),z.$isMongooseDocumentArray&&Array.isArray(e)&&e.length>0&&null!=e[0]&&null!=e[0].$__&&null!=e[0].$__.populated){for(var gt=Object.keys(e[0].$__.populated),wt=function(){var r=Mt[_t];a.$populated(t+"."+r,e.map((function(t){return t.$populated(r)})),e[0].$__.populated[r].options)},_t=0,Mt=gt;_t<Mt.length;_t++)wt();yt=!0}if(!yt&&this.$__.populated){if(Array.isArray(e)&&this.$__.populated[t])for(var St=0;St<e.length;++St)e[St]instanceof nt&&e.set(St,e[St]._id,!0);delete this.$__.populated[t]}z.$isSingleNested&&null!=e&&function(t,e,r){var n=e.schema;if(null==n)return;for(var i=0,o=Object.keys(n.paths);i<o.length;i++){var s=o[i],a=n.paths[s];if(null!=a.$immutableSetter){var u=null==r?void 0:r.$__getValue(s);a.$immutableSetter.call(t,u)}}}(e,z,V),this.$markValid(t)}catch(r){r instanceof l.StrictModeError&&r.isImmutableError?this.invalidate(t,r):r instanceof l.CastError?(this.invalidate(r.path,r),r.$originalErrorPath&&this.invalidate(t,new l.CastError(z.instance,e,t,r.$originalErrorPath))):this.invalidate(t,new l.CastError(z.instance,e,t,r)),dt=!1}if(dt){var Ot=this.$__.isSubDocument?this.ownerDocument():this,At=Ot.$__.savedState,Et=this.$__.isSubDocument?this.$__.fullPath+"."+t:t;if(null!=At){var xt=Et.indexOf("."),kt=-1===xt?Et:Et.slice(0,xt);At.hasOwnProperty(kt)||(At[kt]=q.clone(Ot.$__getValue(kt)))}this.$__set(ot,t,o,b,et,z,e,V),null!=At&&At.hasOwnProperty(Et)&&q.deepEqual(e,At[Et])&&this.unmarkModified(t)}return z.$isSingleNested&&(this.isDirectModified(t)||null==e)&&S(this,t),this},nt.prototype.set=nt.prototype.$set,nt.prototype.$__shouldModify=function(t,e,r,n,i,o,s,a){return!r._skipMarkModified&&(!!this.$isNew||null==this.$__schema.singleNestedPaths[e]&&(void 0===s&&!this.$__isSelected(e)||(void 0!==s||!(e in this.$__.activePaths.states.default))&&(!(this.$populated(e)&&s instanceof nt&&z(s._id,a))&&(!z(s,a||q.getValue(e,this))||!(n||null==s||!(e in this.$__.activePaths.states.default)||!z(s,o.getDefault(this,n)))))))},nt.prototype.$__set=function(t,e,n,i,o,s,a,f){h=h||r(47);var c=this.$__shouldModify(t,e,n,i,o,s,a,f),l=this;c?(this.markModified(t),u||(u=r(175)),a&&a.isMongooseArray&&(a._registerAtomic("$set",a),a.isMongooseDocumentArray&&a.forEach((function(t){t&&t.__parentArray&&(t.__parentArray=a)})),this.$__.activePaths.forEach((function(t){t.startsWith(e+".")&&l.$__.activePaths.ignore(t)})))):Array.isArray(a)&&a.isMongooseArray&&Array.isArray(f)&&f.isMongooseArray&&(a[H]=f[H],a[K]=f[K]);for(var d=this._doc,p=0,m=o.length,y="";p<m;p++){var b=p+1===m;if(y+=y?"."+o[p]:o[p],rt.has(o[p]))return;b?d instanceof Map?d.set(o[p],a):d[o[p]]=a:(q.isPOJO(d[o[p]])||d[o[p]]&&d[o[p]]instanceof h||d[o[p]]&&d[o[p]].$isSingleNested||d[o[p]]&&Array.isArray(d[o[p]])||(d[o[p]]=d[o[p]]||{}),d=d[o[p]])}},nt.prototype.$__getValue=function(t){return q.getValue(t,this._doc)},nt.prototype.$__setValue=function(t,e){return q.setValue(t,e,this._doc),this},nt.prototype.get=function(t,e,r){var n;r=r||{},e&&(n=this.$__schema.interpretAsType(t,e,this.$__schema.options));var i=this.$__path(t);if(null==i&&(i=this.$__schema.virtualpath(t)),i instanceof d){var o=this.$__schema.virtualpath(t);null!=o&&(i=o)}var s=-1===t.indexOf(".")?[t]:t.split("."),a=this._doc;if(i instanceof _)return i.applyGetters(void 0,this);"string"==typeof this.$__schema.aliases[s[0]]&&(s[0]=this.$__schema.aliases[s[0]]);for(var u=0,h=s.length;u<h;u++)a&&a._doc&&(a=a._doc),a=null==a?void 0:a instanceof Map?a.get(s[u],{getters:!1}):u===h-1?q.getValue(s[u],a):a[s[u]];if(n&&(a=n.cast(a)),null!=i&&!1!==r.getters)a=i.applyGetters(a,this);else if(this.$__schema.nested[t]&&r.virtuals)return dt(this,q.clone(a)||{},{path:t});return a},
387
391
  /*!
388
392
  * ignore
389
393
  */
390
- nt.prototype[G]=nt.prototype.get,nt.prototype.$get=nt.prototype.get,nt.prototype.$__path=function(t){var e=this.$__.adhocPaths,r=e&&e.hasOwnProperty(t)?e[t]:null;return r||this.$__schema.path(t)},nt.prototype.markModified=function(t,e){this.$__.activePaths.modify(t),null==e||this.ownerDocument||(this.$__.pathsToScopes=this.$__pathsToScopes||{},this.$__.pathsToScopes[t]=e)},nt.prototype.unmarkModified=function(t){this.$__.activePaths.init(t),null!=this.$__.pathsToScopes&&delete this.$__.pathsToScopes[t]},nt.prototype.$ignore=function(t){this.$__.activePaths.ignore(t)},nt.prototype.directModifiedPaths=function(){return Object.keys(this.$__.activePaths.states.modify)},nt.prototype.$isEmpty=function(t){var e={minimize:!0,virtuals:!1,getters:!1,transform:!1};if(arguments.length>0){var r=this.$get(t);return null==r||"object"===s(r)&&(q.isPOJO(r)?ut(r):0===Object.keys(r.toObject(e)).length)}return 0===Object.keys(this.toObject(e)).length},nt.prototype.modifiedPaths=function(t){t=t||{};var e=Object.keys(this.$__.activePaths.states.modify),r=this;return e.reduce((function(e,n){var o=n.split(".");if(e=e.concat(o.reduce((function(t,e,r){return t.concat(o.slice(0,r).concat(e).join("."))}),[]).filter((function(t){return-1===e.indexOf(t)}))),!t.includeChildren)return e;var a=r.$get(n);if(null!=a&&"object"===s(a))if(a._doc&&(a=a._doc),Array.isArray(a)){for(var u=a.length,h=0;h<u;++h)if(-1===e.indexOf(n+"."+h)&&(e.push(n+"."+h),null!=a[h]&&a[h].$__)){var f,c=i(a[h].modifiedPaths());try{for(c.s();!(f=c.n()).done;){var l=f.value;e.push(n+"."+h+"."+l)}}catch(t){c.e(t)}finally{c.f()}}}else Object.keys(a).filter((function(t){return-1===e.indexOf(n+"."+t)})).forEach((function(t){e.push(n+"."+t)}));return e}),[])},nt.prototype[J]=nt.prototype.modifiedPaths,nt.prototype.isModified=function(t,e){if(t){Array.isArray(t)||(t=t.split(" "));var r=e||this[J](),n=Object.keys(this.$__.activePaths.states.modify);return t.some((function(t){return!!~r.indexOf(t)}))||t.some((function(t){return n.some((function(e){return e===t||t.startsWith(e+".")}))}))}return this.$__.activePaths.some("modify")},nt.prototype.$isModified=nt.prototype.isModified,nt.prototype[Z]=nt.prototype.isModified,nt.prototype.$isDefault=function(t){var e=this;if(null==t)return this.$__.activePaths.some("default");if("string"==typeof t&&-1===t.indexOf(" "))return this.$__.activePaths.states.default.hasOwnProperty(t);var r=t;return Array.isArray(r)||(r=r.split(" ")),r.some((function(t){return e.$__.activePaths.states.default.hasOwnProperty(t)}))},nt.prototype.$isDeleted=function(t){return 0===arguments.length?!!this.$__.isDeleted:(this.$__.isDeleted=!!t,this)},nt.prototype.isDirectModified=function(t){var e=this;if(null==t)return this.$__.activePaths.some("modify");if("string"==typeof t&&-1===t.indexOf(" "))return this.$__.activePaths.states.modify.hasOwnProperty(t);var r=t;return Array.isArray(r)||(r=r.split(" ")),r.some((function(t){return e.$__.activePaths.states.modify.hasOwnProperty(t)}))},nt.prototype.isInit=function(t){var e=this;if(null==t)return this.$__.activePaths.some("init");if("string"==typeof t&&-1===t.indexOf(" "))return this.$__.activePaths.states.init.hasOwnProperty(t);var r=t;return Array.isArray(r)||(r=r.split(" ")),r.some((function(t){return e.$__.activePaths.states.init.hasOwnProperty(t)}))},nt.prototype.isSelected=function(t){var e=this;if(null==this.$__.selected)return!0;if("_id"===t)return 0!==this.$__.selected._id;if(-1!==t.indexOf(" ")&&(t=t.split(" ")),Array.isArray(t))return t.some((function(t){return e.$__isSelected(t)}));var r=Object.keys(this.$__.selected),n=null;if(1===r.length&&"_id"===r[0])return 0===this.$__.selected._id;for(var i=0,o=r;i<o.length;i++){var s=o[i];if("_id"!==s&&B(this.$__.selected[s])){n=!!this.$__.selected[s];break}}if(null===n)return!0;if(t in this.$__.selected)return n;for(var a=t+".",u=0,h=r;u<h.length;u++){var f=h[u];if("_id"!==f){if(f.startsWith(a))return n||f!==a;if(a.startsWith(f+"."))return n}}return!n},nt.prototype.$__isSelected=nt.prototype.isSelected,nt.prototype.isDirectSelected=function(t){var e=this;if(null==this.$__.selected)return!0;if("_id"===t)return 0!==this.$__.selected._id;if(-1!==t.indexOf(" ")&&(t=t.split(" ")),Array.isArray(t))return t.some((function(t){return e.isDirectSelected(t)}));var r=Object.keys(this.$__.selected),n=null;if(1===r.length&&"_id"===r[0])return 0===this.$__.selected._id;for(var i=0,o=r;i<o.length;i++){var s=o[i];if("_id"!==s&&B(this.$__.selected[s])){n=!!this.$__.selected[s];break}}return null===n||(this.$__.selected.hasOwnProperty(t)?n:!n)},nt.prototype.validate=function(t,e,r){var n,i=this;if(this.$op="validate",null!=this.ownerDocument||(this.$__.validating?n=new y(this,{parentStack:e&&e.parentStack,conflictStack:this.$__.validating.stack}):this.$__.validating=new y(this,{parentStack:e&&e.parentStack})),1===arguments.length?"object"!==s(arguments[0])||Array.isArray(arguments[0])?"function"==typeof arguments[0]&&(r=arguments[0],e=null,t=null):(e=arguments[0],r=null,t=null):"function"==typeof t?(r=t,e=null,t=null):"function"==typeof e&&(r=e,e=t,t=null),e&&"string"==typeof e.pathsToSkip){var o=-1===e.pathsToSkip.indexOf(" ");e.pathsToSkip=o?[e.pathsToSkip]:e.pathsToSkip.split(" ")}return M(r,(function(r){if(null!=n)return r(n);i.$__validate(t,e,(function(t){i.$op=null,r(t)}))}),this.constructor.events)},nt.prototype.$validate=nt.prototype.validate,nt.prototype.$__validate=function(t,e,r){var n=this;"function"==typeof t?(r=t,e=null,t=null):"function"==typeof e&&(r=e,e=null);var o,a=e&&"object"===s(e)&&"validateModifiedOnly"in e,u=k(e,"pathsToSkip",null);o=a?!!e.validateModifiedOnly:this.$__schema.options.validateModifiedOnly;var h=this,f=function(){var t=n.$__.validationError;if(n.$__.validationError=void 0,o&&null!=t){for(var e=0,r=Object.keys(t.errors);e<r.length;e++){var i=r[e];n.$isModified(i)||delete t.errors[i]}0===Object.keys(t.errors).length&&(t=void 0)}if(n.$__.cachedRequired={},n.$emit("validate",h),n.constructor.emit("validate",h),t){for(var s in t.errors)!n[W]&&t.errors[s]instanceof l.CastError&&n.invalidate(s,t.errors[s]);return t}},c=ht(this),d=o?c[0].filter((function(t){return n.$isModified(t)})):c[0],p=c[1];if("string"==typeof t&&(t=t.split(" ")),Array.isArray(t)?d=ft(d,t):u&&(d=ct(d,u)),0===d.length)return P((function(){var t=f();if(t)return h.$__schema.s.hooks.execPost("validate:error",h,[h],{error:t},(function(t){r(t)}));r(null,h)}));var m,y={},b=0,v=i(d);try{for(v.s();!(m=v.n()).done;){w(m.value)}}catch(t){v.e(t)}finally{v.f()}function w(t){null==t||y[t]||(y[t]=!0,b++,P((function(){var e=h.$__schema.path(t);if(!e)return--b||_();if(h.$isValid(t)){if(null!=e[tt]&&t!==e.path)return--b||_();var r,n=h.$__getValue(t);(r=h.$populated(t))?n=r:null!=n&&null!=n.$__&&n.$__.wasPopulated&&(n=n._id);var i=null!=h.$__.pathsToScopes&&t in h.$__.pathsToScopes?h.$__.pathsToScopes[t]:h,s={skipSchemaValidators:p[t],path:t,validateModifiedOnly:o};e.doValidate(n,(function(r){if(r){if((e.$isSingleNested||e.$isArraySubdocument||e.$isMongooseDocumentArray)&&r instanceof g)return--b||_();h.invalidate(t,r,void 0,!0)}--b||_()}),i,s)}else--b||_()})))}function _(){var t=f();if(t)return h.$__schema.s.hooks.execPost("validate:error",h,[h],{error:t},(function(t){r(t)}));r(null,h)}},nt.prototype.validateSync=function(t,e){var r=this,n=this;1!==arguments.length||"object"!==s(arguments[0])||Array.isArray(arguments[0])||(e=arguments[0],t=null);var i,o=e&&"object"===s(e)&&"validateModifiedOnly"in e;i=o?!!e.validateModifiedOnly:this.$__schema.options.validateModifiedOnly;var a=e&&e.pathsToSkip;if("string"==typeof t){var u=-1===t.indexOf(" ");t=u?[t]:t.split(" ")}else"string"==typeof a&&-1!==a.indexOf(" ")&&(a=a.split(" "));var h=ht(this),f=i?h[0].filter((function(t){return r.$isModified(t)})):h[0],c=h[1];Array.isArray(t)?f=ft(f,t):Array.isArray(a)&&(f=ct(f,a));var d={};f.forEach((function(t){if(!d[t]){d[t]=!0;var e=n.$__schema.path(t);if(e&&n.$isValid(t)){var r=n.$__getValue(t),o=e.doValidateSync(r,n,{skipSchemaValidators:c[t],path:t,validateModifiedOnly:i});if(o){if((e.$isSingleNested||e.$isArraySubdocument||e.$isMongooseDocumentArray)&&o instanceof g)return;n.invalidate(t,o,void 0,!0)}}}}));var p=n.$__.validationError;if(n.$__.validationError=void 0,n.$emit("validate",n),n.constructor.emit("validate",n),p)for(var m in p.errors)p.errors[m]instanceof l.CastError&&n.invalidate(m,p.errors[m]);return p},nt.prototype.invalidate=function(t,e,r,n){if(this.$__.validationError||(this.$__.validationError=new g(this)),!this.$__.validationError.errors[t])return e&&"string"!=typeof e||(e=new w({path:t,message:e,type:n||"user defined",value:r})),this.$__.validationError===e||this.$__.validationError.addError(t,e),this.$__.validationError},nt.prototype.$markValid=function(t){this.$__.validationError&&this.$__.validationError.errors[t]&&(delete this.$__.validationError.errors[t],0===Object.keys(this.$__.validationError.errors).length&&(this.$__.validationError=null))},nt.prototype.$isValid=function(t){var e=this;return null==this.$__.validationError||0===Object.keys(this.$__.validationError.errors).length||null!=t&&(-1!==t.indexOf(" ")&&(t=t.split(" ")),Array.isArray(t)?t.some((function(t){return null==e.$__.validationError.errors[t]})):null==this.$__.validationError.errors[t])},nt.prototype.$__reset=function(){var t=this;return a||(a=r(27)),this.$__.activePaths.map("init","modify",(function(e){return t.$__getValue(e)})).filter((function(t){return t&&t instanceof Array&&t.isMongooseDocumentArray&&t.length})).forEach((function(e){for(var r=e.length;r--;){var n=e[r];n&&n.$__reset()}t.$__.activePaths.init(e.$path()),e[K]=e[H],e[H]={}})),this.$__.activePaths.map("init","modify",(function(e){return t.$__getValue(e)})).filter((function(t){return t&&t.$isSingleNested})).forEach((function(e){e.$__reset(),e.$parent()===t?t.$__.activePaths.init(e.$basePath):null!=e.$parent()&&e.$parent().ownerDocument&&e.$parent().$__reset()})),this.$__dirty().forEach((function(t){var e=t.value;e&&e[H]&&(e[K]=e[H],e[H]={})})),this.$__.backup={},this.$__.backup.activePaths={modify:Object.assign({},this.$__.activePaths.states.modify),default:Object.assign({},this.$__.activePaths.states.default)},this.$__.backup.validationError=this.$__.validationError,this.$__.backup.errors=this.$errors,this.$__.activePaths.clear("modify"),this.$__.activePaths.clear("default"),this.$__.validationError=void 0,this.$errors=void 0,t=this,this.$__schema.requiredPaths().forEach((function(e){t.$__.activePaths.require(e)})),this},
394
+ nt.prototype[G]=nt.prototype.get,nt.prototype.$get=nt.prototype.get,nt.prototype.$__path=function(t){var e=this.$__.adhocPaths,r=e&&e.hasOwnProperty(t)?e[t]:null;return r||this.$__schema.path(t)},nt.prototype.markModified=function(t,e){this.$__.activePaths.modify(t),null==e||this.$__.isSubDocument||(this.$__.pathsToScopes=this.$__pathsToScopes||{},this.$__.pathsToScopes[t]=e)},nt.prototype.unmarkModified=function(t){this.$__.activePaths.init(t),null!=this.$__.pathsToScopes&&delete this.$__.pathsToScopes[t]},nt.prototype.$ignore=function(t){this.$__.activePaths.ignore(t)},nt.prototype.directModifiedPaths=function(){return Object.keys(this.$__.activePaths.states.modify)},nt.prototype.$isEmpty=function(t){var e={minimize:!0,virtuals:!1,getters:!1,transform:!1};if(arguments.length>0){var r=this.$get(t);return null==r||"object"===s(r)&&(q.isPOJO(r)?ut(r):0===Object.keys(r.toObject(e)).length)}return 0===Object.keys(this.toObject(e)).length},nt.prototype.modifiedPaths=function(t){t=t||{};var e=Object.keys(this.$__.activePaths.states.modify),r=this;return e.reduce((function(e,n){var o=n.split(".");if(e=e.concat(o.reduce((function(t,e,r){return t.concat(o.slice(0,r).concat(e).join("."))}),[]).filter((function(t){return-1===e.indexOf(t)}))),!t.includeChildren)return e;var a=r.$get(n);if(null!=a&&"object"===s(a))if(a._doc&&(a=a._doc),Array.isArray(a)){for(var u=a.length,h=0;h<u;++h)if(-1===e.indexOf(n+"."+h)&&(e.push(n+"."+h),null!=a[h]&&a[h].$__)){var f,c=i(a[h].modifiedPaths());try{for(c.s();!(f=c.n()).done;){var l=f.value;e.push(n+"."+h+"."+l)}}catch(t){c.e(t)}finally{c.f()}}}else Object.keys(a).filter((function(t){return-1===e.indexOf(n+"."+t)})).forEach((function(t){e.push(n+"."+t)}));return e}),[])},nt.prototype[J]=nt.prototype.modifiedPaths,nt.prototype.isModified=function(t,e){if(t){Array.isArray(t)||(t=t.split(" "));var r=e||this[J](),n=Object.keys(this.$__.activePaths.states.modify);return t.some((function(t){return!!~r.indexOf(t)}))||t.some((function(t){return n.some((function(e){return e===t||t.startsWith(e+".")}))}))}return this.$__.activePaths.some("modify")},nt.prototype.$isModified=nt.prototype.isModified,nt.prototype[Z]=nt.prototype.isModified,nt.prototype.$isDefault=function(t){var e=this;if(null==t)return this.$__.activePaths.some("default");if("string"==typeof t&&-1===t.indexOf(" "))return this.$__.activePaths.states.default.hasOwnProperty(t);var r=t;return Array.isArray(r)||(r=r.split(" ")),r.some((function(t){return e.$__.activePaths.states.default.hasOwnProperty(t)}))},nt.prototype.$isDeleted=function(t){return 0===arguments.length?!!this.$__.isDeleted:(this.$__.isDeleted=!!t,this)},nt.prototype.isDirectModified=function(t){var e=this;if(null==t)return this.$__.activePaths.some("modify");if("string"==typeof t&&-1===t.indexOf(" "))return this.$__.activePaths.states.modify.hasOwnProperty(t);var r=t;return Array.isArray(r)||(r=r.split(" ")),r.some((function(t){return e.$__.activePaths.states.modify.hasOwnProperty(t)}))},nt.prototype.isInit=function(t){var e=this;if(null==t)return this.$__.activePaths.some("init");if("string"==typeof t&&-1===t.indexOf(" "))return this.$__.activePaths.states.init.hasOwnProperty(t);var r=t;return Array.isArray(r)||(r=r.split(" ")),r.some((function(t){return e.$__.activePaths.states.init.hasOwnProperty(t)}))},nt.prototype.isSelected=function(t){var e=this;if(null==this.$__.selected)return!0;if("_id"===t)return 0!==this.$__.selected._id;if(-1!==t.indexOf(" ")&&(t=t.split(" ")),Array.isArray(t))return t.some((function(t){return e.$__isSelected(t)}));var r=Object.keys(this.$__.selected),n=null;if(1===r.length&&"_id"===r[0])return 0===this.$__.selected._id;for(var i=0,o=r;i<o.length;i++){var s=o[i];if("_id"!==s&&B(this.$__.selected[s])){n=!!this.$__.selected[s];break}}if(null===n)return!0;if(t in this.$__.selected)return n;for(var a=t+".",u=0,h=r;u<h.length;u++){var f=h[u];if("_id"!==f){if(f.startsWith(a))return n||f!==a;if(a.startsWith(f+"."))return n}}return!n},nt.prototype.$__isSelected=nt.prototype.isSelected,nt.prototype.isDirectSelected=function(t){var e=this;if(null==this.$__.selected)return!0;if("_id"===t)return 0!==this.$__.selected._id;if(-1!==t.indexOf(" ")&&(t=t.split(" ")),Array.isArray(t))return t.some((function(t){return e.isDirectSelected(t)}));var r=Object.keys(this.$__.selected),n=null;if(1===r.length&&"_id"===r[0])return 0===this.$__.selected._id;for(var i=0,o=r;i<o.length;i++){var s=o[i];if("_id"!==s&&B(this.$__.selected[s])){n=!!this.$__.selected[s];break}}return null===n||(this.$__.selected.hasOwnProperty(t)?n:!n)},nt.prototype.validate=function(t,e,r){var n,i=this;if(this.$op="validate",null!=this.$__.isSubDocument||(this.$__.validating?n=new y(this,{parentStack:e&&e.parentStack,conflictStack:this.$__.validating.stack}):this.$__.validating=new y(this,{parentStack:e&&e.parentStack})),1===arguments.length?"object"!==s(arguments[0])||Array.isArray(arguments[0])?"function"==typeof arguments[0]&&(r=arguments[0],e=null,t=null):(e=arguments[0],r=null,t=null):"function"==typeof t?(r=t,e=null,t=null):"function"==typeof e&&(r=e,e=t,t=null),e&&"string"==typeof e.pathsToSkip){var o=-1===e.pathsToSkip.indexOf(" ");e.pathsToSkip=o?[e.pathsToSkip]:e.pathsToSkip.split(" ")}return M(r,(function(r){if(null!=n)return r(n);i.$__validate(t,e,(function(t){i.$op=null,r(t)}))}),this.constructor.events)},nt.prototype.$validate=nt.prototype.validate,nt.prototype.$__validate=function(t,e,r){var n=this;"function"==typeof t?(r=t,e=null,t=null):"function"==typeof e&&(r=e,e=null);var o,a=e&&"object"===s(e)&&"validateModifiedOnly"in e,u=k(e,"pathsToSkip",null);o=a?!!e.validateModifiedOnly:this.$__schema.options.validateModifiedOnly;var h=this,f=function(){var t=n.$__.validationError;if(n.$__.validationError=void 0,o&&null!=t){for(var e=0,r=Object.keys(t.errors);e<r.length;e++){var i=r[e];n.$isModified(i)||delete t.errors[i]}0===Object.keys(t.errors).length&&(t=void 0)}if(n.$__.cachedRequired={},n.$emit("validate",h),n.constructor.emit("validate",h),t){for(var s in t.errors)!n[W]&&t.errors[s]instanceof l.CastError&&n.invalidate(s,t.errors[s]);return t}},c=ht(this),d=o?c[0].filter((function(t){return n.$isModified(t)})):c[0],p=c[1];if("string"==typeof t&&(t=t.split(" ")),Array.isArray(t)?d=ft(d,t):u&&(d=ct(d,u)),0===d.length)return P((function(){var t=f();if(t)return h.$__schema.s.hooks.execPost("validate:error",h,[h],{error:t},(function(t){r(t)}));r(null,h)}));var m,y={},b=0,v=i(d);try{for(v.s();!(m=v.n()).done;){w(m.value)}}catch(t){v.e(t)}finally{v.f()}function w(t){null==t||y[t]||(y[t]=!0,b++,P((function(){var e=h.$__schema.path(t);if(!e)return--b||_();if(h.$isValid(t)){if(null!=e[tt]&&t!==e.path)return--b||_();var r,n=h.$__getValue(t);(r=h.$populated(t))?n=r:null!=n&&null!=n.$__&&n.$__.wasPopulated&&(n=n._id);var i=null!=h.$__.pathsToScopes&&t in h.$__.pathsToScopes?h.$__.pathsToScopes[t]:h,s={skipSchemaValidators:p[t],path:t,validateModifiedOnly:o};e.doValidate(n,(function(r){if(r){if((e.$isSingleNested||e.$isArraySubdocument||e.$isMongooseDocumentArray)&&r instanceof g)return--b||_();h.invalidate(t,r,void 0,!0)}--b||_()}),i,s)}else--b||_()})))}function _(){var t=f();if(t)return h.$__schema.s.hooks.execPost("validate:error",h,[h],{error:t},(function(t){r(t)}));r(null,h)}},nt.prototype.validateSync=function(t,e){var r=this,n=this;1!==arguments.length||"object"!==s(arguments[0])||Array.isArray(arguments[0])||(e=arguments[0],t=null);var i,o=e&&"object"===s(e)&&"validateModifiedOnly"in e;i=o?!!e.validateModifiedOnly:this.$__schema.options.validateModifiedOnly;var a=e&&e.pathsToSkip;if("string"==typeof t){var u=-1===t.indexOf(" ");t=u?[t]:t.split(" ")}else"string"==typeof a&&-1!==a.indexOf(" ")&&(a=a.split(" "));var h=ht(this),f=i?h[0].filter((function(t){return r.$isModified(t)})):h[0],c=h[1];Array.isArray(t)?f=ft(f,t):Array.isArray(a)&&(f=ct(f,a));var d={};f.forEach((function(t){if(!d[t]){d[t]=!0;var e=n.$__schema.path(t);if(e&&n.$isValid(t)){var r=n.$__getValue(t),o=e.doValidateSync(r,n,{skipSchemaValidators:c[t],path:t,validateModifiedOnly:i});if(o){if((e.$isSingleNested||e.$isArraySubdocument||e.$isMongooseDocumentArray)&&o instanceof g)return;n.invalidate(t,o,void 0,!0)}}}}));var p=n.$__.validationError;if(n.$__.validationError=void 0,n.$emit("validate",n),n.constructor.emit("validate",n),p)for(var m in p.errors)p.errors[m]instanceof l.CastError&&n.invalidate(m,p.errors[m]);return p},nt.prototype.invalidate=function(t,e,r,n){if(this.$__.validationError||(this.$__.validationError=new g(this)),!this.$__.validationError.errors[t])return e&&"string"!=typeof e||(e=new w({path:t,message:e,type:n||"user defined",value:r})),this.$__.validationError===e||this.$__.validationError.addError(t,e),this.$__.validationError},nt.prototype.$markValid=function(t){this.$__.validationError&&this.$__.validationError.errors[t]&&(delete this.$__.validationError.errors[t],0===Object.keys(this.$__.validationError.errors).length&&(this.$__.validationError=null))},nt.prototype.$isValid=function(t){var e=this;return null==this.$__.validationError||0===Object.keys(this.$__.validationError.errors).length||null!=t&&(-1!==t.indexOf(" ")&&(t=t.split(" ")),Array.isArray(t)?t.some((function(t){return null==e.$__.validationError.errors[t]})):null==this.$__.validationError.errors[t])},nt.prototype.$__reset=function(){var t=this;return a||(a=r(27)),this.$__.activePaths.map("init","modify",(function(e){return t.$__getValue(e)})).filter((function(t){return t&&t instanceof Array&&t.isMongooseDocumentArray&&t.length})).forEach((function(e){for(var r=e.length;r--;){var n=e[r];n&&n.$__reset()}t.$__.activePaths.init(e.$path()),e[K]=e[H],e[H]={}})),this.$__.activePaths.map("init","modify",(function(e){return t.$__getValue(e)})).filter((function(t){return t&&t.$isSingleNested})).forEach((function(e){e.$__reset(),e.$parent()===t?t.$__.activePaths.init(e.$basePath):null!=e.$parent()&&e.$parent().$__.isSubDocument&&e.$parent().$__reset()})),this.$__dirty().forEach((function(t){var e=t.value;e&&e[H]&&(e[K]=e[H],e[H]={})})),this.$__.backup={},this.$__.backup.activePaths={modify:Object.assign({},this.$__.activePaths.states.modify),default:Object.assign({},this.$__.activePaths.states.default)},this.$__.backup.validationError=this.$__.validationError,this.$__.backup.errors=this.$errors,this.$__.activePaths.clear("modify"),this.$__.activePaths.clear("default"),this.$__.validationError=void 0,this.$errors=void 0,t=this,this.$__schema.requiredPaths().forEach((function(e){t.$__.activePaths.require(e)})),this},
391
395
  /*!
392
396
  * ignore
393
397
  */
@@ -405,7 +409,7 @@ nt.prototype.$__undoReset=function(){if(null!=this.$__.backup&&null!=this.$__.ba
405
409
  * @param {Object} object to minimize
406
410
  * @return {Object}
407
411
  */
408
- function t(e){var r,n,i,o=Object.keys(e),s=o.length;for(;s--;)n=o[s],i=e[n],q.isPOJO(i)&&(e[n]=t(i)),void 0!==e[n]?r=!0:delete e[n];return r?e:void 0}(c)||{})),(t.virtuals||t.getters&&!1!==t.virtuals)&&dt(this,c,h,t),!1===t.versionKey&&this.$__schema.options.versionKey&&delete c[this.$__schema.options.versionKey];var l=t.transform;if(l&&function(t,e){var r=t.$__schema,n=Object.keys(r.paths||{});if(!t._doc)return e;for(var i=0,o=n;i<o.length;i++){var s=o[i],a=r.paths[s];if("function"==typeof a.options.transform){var u=t.$get(s),h=a.options.transform.call(t,u);pt(s,h),q.setValue(s,h,e)}else if(null!=a.$embeddedSchemaType&&"function"==typeof a.$embeddedSchemaType.options.transform){for(var f=[].concat(t.$get(s)),c=a.$embeddedSchemaType.options.transform,l=0;l<f.length;++l){var d=c.call(t,f[l]);f[l]=d,pt(s,d)}e[s]=f}}}(this,c),t.useProjection&&function(t,e){var r=t.$__schema,n=Object.keys(r.paths||{});if(!t._doc)return e;var i=t.$__.selected;void 0===i&&(i={},L.applyPaths(i,r));if(null==i||0===Object.keys(i).length)return e;for(var o=0,s=n;o<s.length;o++){var a=s[o];null==i[a]||i[a]||delete e[a]}}(this,c),!0===l||a.toObject&&l){var d=t.json?a.toJSON:a.toObject;d&&(l="function"==typeof t.transform?t.transform:d.transform)}else t.transform=f;if("function"==typeof l){var p=l(this,c,t);void 0!==p&&(c=p)}return c},nt.prototype.toObject=function(t){return this.$toObject(t)},nt.prototype.toJSON=function(t){return this.$toObject(t,!0)},nt.prototype.parent=function(){return this.$__.parent},nt.prototype.$parent=nt.prototype.parent,nt.prototype.inspect=function(t){var e;q.isPOJO(t)&&((e=t).minimize=!1);var r=this.toObject(e);return null==r?"MongooseDocument { "+r+" }":r},I.custom&&(
412
+ function t(e){var r,n,i,o=Object.keys(e),s=o.length;for(;s--;)n=o[s],i=e[n],q.isPOJO(i)&&(e[n]=t(i)),void 0!==e[n]?r=!0:delete e[n];return r?e:void 0}(c)||{})),(t.virtuals||t.getters&&!1!==t.virtuals)&&dt(this,c,h,t),!1===t.versionKey&&this.$__schema.options.versionKey&&delete c[this.$__schema.options.versionKey];var l=t.transform;if(l&&function(t,e){var r=t.$__schema,n=Object.keys(r.paths||{});if(!t._doc)return e;for(var i=0,o=n;i<o.length;i++){var s=o[i],a=r.paths[s];if("function"==typeof a.options.transform){var u=t.$get(s),h=a.options.transform.call(t,u);pt(s,h),q.setValue(s,h,e)}else if(null!=a.$embeddedSchemaType&&"function"==typeof a.$embeddedSchemaType.options.transform){for(var f=[].concat(t.$get(s)),c=a.$embeddedSchemaType.options.transform,l=0;l<f.length;++l){var d=c.call(t,f[l]);f[l]=d,pt(s,d)}e[s]=f}}}(this,c),t.useProjection&&function(t,e){var r=t.$__schema,n=Object.keys(r.paths||{});if(!t._doc)return e;var i=t.$__.selected;void 0===i&&(i={},L.applyPaths(i,r));if(null==i||0===Object.keys(i).length)return e;for(var o=0,s=n;o<s.length;o++){var a=s[o];null==i[a]||i[a]||delete e[a]}}(this,c),!0===l||a.toObject&&l){var d=t.json?a.toJSON:a.toObject;d&&(l="function"==typeof t.transform?t.transform:d.transform)}else t.transform=f;if("function"==typeof l){var p=l(this,c,t);void 0!==p&&(c=p)}return c},nt.prototype.toObject=function(t){return this.$toObject(t)},nt.prototype.toJSON=function(t){return this.$toObject(t,!0)},nt.prototype.ownerDocument=function(){return this},nt.prototype.parent=function(){return this.$__.isSubDocument||this.$__.wasPopulated?this.$__.parent:this},nt.prototype.$parent=nt.prototype.parent,nt.prototype.inspect=function(t){var e;q.isPOJO(t)&&((e=t).minimize=!1);var r=this.toObject(e);return null==r?"MongooseDocument { "+r+" }":r},I.custom&&(
409
413
  /*!
410
414
  * Avoid Node deprecation warning DEP0079
411
415
  */
@@ -568,7 +572,7 @@ function i(t){return n.cast()(t)}e.castToNumber=i,e.castArraysOfNumbers=function
568
572
  */t.exports=function(t,e){if(null==t)return null;for(var r=0,i=Object.keys(t);r<i.length;r++){var o=t[i[r]];if(o.schema&&o.schema.discriminatorMapping&&n(o.schema.discriminatorMapping.value,e))return o}return null}},function(t,e,r){"use strict";
569
573
  /*!
570
574
  * Module exports.
571
- */e.Array=r(175),e.Buffer=r(177),e.Document=e.Embedded=r(47),e.DocumentArray=r(27),e.Decimal128=r(34),e.ObjectId=r(18),e.Map=r(179),e.Subdocument=r(94)},function(t,e,r){"use strict";r.r(e),function(t){function n(t){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}r.d(e,"BSONError",(function(){return M})),r.d(e,"BSONRegExp",(function(){return bt})),r.d(e,"BSONSymbol",(function(){return vt})),r.d(e,"BSONTypeError",(function(){return S})),r.d(e,"BSON_BINARY_SUBTYPE_BYTE_ARRAY",(function(){return ie})),r.d(e,"BSON_BINARY_SUBTYPE_COLUMN",(function(){return he})),r.d(e,"BSON_BINARY_SUBTYPE_DEFAULT",(function(){return re})),r.d(e,"BSON_BINARY_SUBTYPE_ENCRYPTED",(function(){return ue})),r.d(e,"BSON_BINARY_SUBTYPE_FUNCTION",(function(){return ne})),r.d(e,"BSON_BINARY_SUBTYPE_MD5",(function(){return ae})),r.d(e,"BSON_BINARY_SUBTYPE_USER_DEFINED",(function(){return fe})),r.d(e,"BSON_BINARY_SUBTYPE_UUID",(function(){return oe})),r.d(e,"BSON_BINARY_SUBTYPE_UUID_NEW",(function(){return se})),r.d(e,"BSON_DATA_ARRAY",(function(){return Ct})),r.d(e,"BSON_DATA_BINARY",(function(){return Lt})),r.d(e,"BSON_DATA_BOOLEAN",(function(){return Ft})),r.d(e,"BSON_DATA_CODE",(function(){return Wt})),r.d(e,"BSON_DATA_CODE_W_SCOPE",(function(){return Jt})),r.d(e,"BSON_DATA_DATE",(function(){return zt})),r.d(e,"BSON_DATA_DBPOINTER",(function(){return Ht})),r.d(e,"BSON_DATA_DECIMAL128",(function(){return Xt})),r.d(e,"BSON_DATA_INT",(function(){return Yt})),r.d(e,"BSON_DATA_LONG",(function(){return Qt})),r.d(e,"BSON_DATA_MAX_KEY",(function(){return ee})),r.d(e,"BSON_DATA_MIN_KEY",(function(){return te})),r.d(e,"BSON_DATA_NULL",(function(){return Vt})),r.d(e,"BSON_DATA_NUMBER",(function(){return It})),r.d(e,"BSON_DATA_OBJECT",(function(){return Dt})),r.d(e,"BSON_DATA_OID",(function(){return Ut})),r.d(e,"BSON_DATA_REGEXP",(function(){return Kt})),r.d(e,"BSON_DATA_STRING",(function(){return Nt})),r.d(e,"BSON_DATA_SYMBOL",(function(){return Zt})),r.d(e,"BSON_DATA_TIMESTAMP",(function(){return Gt})),r.d(e,"BSON_DATA_UNDEFINED",(function(){return qt})),r.d(e,"BSON_INT32_MAX",(function(){return jt})),r.d(e,"BSON_INT32_MIN",(function(){return $t})),r.d(e,"BSON_INT64_MAX",(function(){return Rt})),r.d(e,"BSON_INT64_MIN",(function(){return Pt})),r.d(e,"Binary",(function(){return V})),r.d(e,"Code",(function(){return K})),r.d(e,"DBRef",(function(){return W})),r.d(e,"Decimal128",(function(){return ut})),r.d(e,"Double",(function(){return ht})),r.d(e,"EJSON",(function(){return At})),r.d(e,"Int32",(function(){return ft})),r.d(e,"Long",(function(){return G})),r.d(e,"LongWithoutOverridesClass",(function(){return gt})),r.d(e,"Map",(function(){return Et})),r.d(e,"MaxKey",(function(){return ct})),r.d(e,"MinKey",(function(){return lt})),r.d(e,"ObjectID",(function(){return yt})),r.d(e,"ObjectId",(function(){return yt})),r.d(e,"Timestamp",(function(){return wt})),r.d(e,"UUID",(function(){return z})),r.d(e,"calculateObjectSize",(function(){return Ye})),r.d(e,"deserialize",(function(){return Je})),r.d(e,"deserializeStream",(function(){return Ge})),r.d(e,"serialize",(function(){return We})),r.d(e,"serializeWithBufferAndIndex",(function(){return Ze})),r.d(e,"setInternalBufferSize",(function(){return He}));for(var i=function(t){var e=d(t),r=e[0],n=e[1];return 3*(r+n)/4-n},o=function(t){var e,r,n=d(t),i=n[0],o=n[1],s=new h(function(t,e,r){return 3*(e+r)/4-r}(0,i,o)),a=0,f=o>0?i-4:i;for(r=0;r<f;r+=4)e=u[t.charCodeAt(r)]<<18|u[t.charCodeAt(r+1)]<<12|u[t.charCodeAt(r+2)]<<6|u[t.charCodeAt(r+3)],s[a++]=e>>16&255,s[a++]=e>>8&255,s[a++]=255&e;2===o&&(e=u[t.charCodeAt(r)]<<2|u[t.charCodeAt(r+1)]>>4,s[a++]=255&e);1===o&&(e=u[t.charCodeAt(r)]<<10|u[t.charCodeAt(r+1)]<<4|u[t.charCodeAt(r+2)]>>2,s[a++]=e>>8&255,s[a++]=255&e);return s},s=function(t){for(var e,r=t.length,n=r%3,i=[],o=0,s=r-n;o<s;o+=16383)i.push(p(t,o,o+16383>s?s:o+16383));1===n?(e=t[r-1],i.push(a[e>>2]+a[e<<4&63]+"==")):2===n&&(e=(t[r-2]<<8)+t[r-1],i.push(a[e>>10]+a[e>>4&63]+a[e<<2&63]+"="));return i.join("")},a=[],u=[],h="undefined"!=typeof Uint8Array?Uint8Array:Array,f="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",c=0,l=f.length;c<l;++c)a[c]=f[c],u[f.charCodeAt(c)]=c;function d(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");return-1===r&&(r=e),[r,r===e?0:4-r%4]}function p(t,e,r){for(var n,i,o=[],s=e;s<r;s+=3)n=(t[s]<<16&16711680)+(t[s+1]<<8&65280)+(255&t[s+2]),o.push(a[(i=n)>>18&63]+a[i>>12&63]+a[i>>6&63]+a[63&i]);return o.join("")}u["-".charCodeAt(0)]=62,u["_".charCodeAt(0)]=63;var m={byteLength:i,toByteArray:o,fromByteArray:s},y=function(t,e,r,n,i){var o,s,a=8*i-n-1,u=(1<<a)-1,h=u>>1,f=-7,c=r?i-1:0,l=r?-1:1,d=t[e+c];for(c+=l,o=d&(1<<-f)-1,d>>=-f,f+=a;f>0;o=256*o+t[e+c],c+=l,f-=8);for(s=o&(1<<-f)-1,o>>=-f,f+=n;f>0;s=256*s+t[e+c],c+=l,f-=8);if(0===o)o=1-h;else{if(o===u)return s?NaN:1/0*(d?-1:1);s+=Math.pow(2,n),o-=h}return(d?-1:1)*s*Math.pow(2,o-n)},b=function(t,e,r,n,i,o){var s,a,u,h=8*o-i-1,f=(1<<h)-1,c=f>>1,l=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,d=n?0:o-1,p=n?1:-1,m=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,s=f):(s=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-s))<1&&(s--,u*=2),(e+=s+c>=1?l/u:l*Math.pow(2,1-c))*u>=2&&(s++,u/=2),s+c>=f?(a=0,s=f):s+c>=1?(a=(e*u-1)*Math.pow(2,i),s+=c):(a=e*Math.pow(2,c-1)*Math.pow(2,i),s=0));i>=8;t[r+d]=255&a,d+=p,a/=256,i-=8);for(s=s<<i|a,h+=i;h>0;t[r+d]=255&s,d+=p,s/=256,h-=8);t[r+d-p]|=128*m},v=function(t,e){return t(e={exports:{}},e.exports),e.exports}((function(t,e){var r="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;e.Buffer=i,e.SlowBuffer=function(t){+t!=t&&(t=0);return i.alloc(+t)},e.INSPECT_MAX_BYTES=50;function n(t){if(t>2147483647)throw new RangeError('The value "'+t+'" is invalid for option "size"');var e=new Uint8Array(t);return Object.setPrototypeOf(e,i.prototype),e}function i(t,e,r){if("number"==typeof t){if("string"==typeof e)throw new TypeError('The "string" argument must be of type string. Received type number');return a(t)}return o(t,e,r)}function o(t,e,r){if("string"==typeof t)return function(t,e){"string"==typeof e&&""!==e||(e="utf8");if(!i.isEncoding(e))throw new TypeError("Unknown encoding: "+e);var r=0|c(t,e),o=n(r),s=o.write(t,e);s!==r&&(o=o.slice(0,s));return o}(t,e);if(ArrayBuffer.isView(t))return function(t){if(L(t,Uint8Array)){var e=new Uint8Array(t);return h(e.buffer,e.byteOffset,e.byteLength)}return u(t)}(t);if(null==t)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+babelHelpers.typeof(t));if(L(t,ArrayBuffer)||t&&L(t.buffer,ArrayBuffer))return h(t,e,r);if("undefined"!=typeof SharedArrayBuffer&&(L(t,SharedArrayBuffer)||t&&L(t.buffer,SharedArrayBuffer)))return h(t,e,r);if("number"==typeof t)throw new TypeError('The "value" argument must not be of type number. Received type number');var o=t.valueOf&&t.valueOf();if(null!=o&&o!==t)return i.from(o,e,r);var s=function(t){if(i.isBuffer(t)){var e=0|f(t.length),r=n(e);return 0===r.length||t.copy(r,0,0,e),r}if(void 0!==t.length)return"number"!=typeof t.length||q(t.length)?n(0):u(t);if("Buffer"===t.type&&Array.isArray(t.data))return u(t.data)}(t);if(s)return s;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof t[Symbol.toPrimitive])return i.from(t[Symbol.toPrimitive]("string"),e,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+babelHelpers.typeof(t))}function s(t){if("number"!=typeof t)throw new TypeError('"size" argument must be of type number');if(t<0)throw new RangeError('The value "'+t+'" is invalid for option "size"')}function a(t){return s(t),n(t<0?0:0|f(t))}function u(t){for(var e=t.length<0?0:0|f(t.length),r=n(e),i=0;i<e;i+=1)r[i]=255&t[i];return r}function h(t,e,r){if(e<0||t.byteLength<e)throw new RangeError('"offset" is outside of buffer bounds');if(t.byteLength<e+(r||0))throw new RangeError('"length" is outside of buffer bounds');var n;return n=void 0===e&&void 0===r?new Uint8Array(t):void 0===r?new Uint8Array(t,e):new Uint8Array(t,e,r),Object.setPrototypeOf(n,i.prototype),n}function f(t){if(t>=2147483647)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+2147483647..toString(16)+" bytes");return 0|t}function c(t,e){if(i.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||L(t,ArrayBuffer))return t.byteLength;if("string"!=typeof t)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+babelHelpers.typeof(t));var r=t.length,n=arguments.length>2&&!0===arguments[2];if(!n&&0===r)return 0;for(var o=!1;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return N(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return D(t).length;default:if(o)return n?-1:N(t).length;e=(""+e).toLowerCase(),o=!0}}function l(t,e,r){var n=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return k(this,e,r);case"utf8":case"utf-8":return A(this,e,r);case"ascii":return E(this,e,r);case"latin1":case"binary":return x(this,e,r);case"base64":return O(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return j(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}function d(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function p(t,e,r,n,o){if(0===t.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),q(r=+r)&&(r=o?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(o)return-1;r=t.length-1}else if(r<0){if(!o)return-1;r=0}if("string"==typeof e&&(e=i.from(e,n)),i.isBuffer(e))return 0===e.length?-1:v(t,e,r,n,o);if("number"==typeof e)return e&=255,"function"==typeof Uint8Array.prototype.indexOf?o?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):v(t,[e],r,n,o);throw new TypeError("val must be string, number or Buffer")}function v(t,e,r,n,i){var o,s=1,a=t.length,u=e.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(t.length<2||e.length<2)return-1;s=2,a/=2,u/=2,r/=2}function h(t,e){return 1===s?t[e]:t.readUInt16BE(e*s)}if(i){var f=-1;for(o=r;o<a;o++)if(h(t,o)===h(e,-1===f?0:o-f)){if(-1===f&&(f=o),o-f+1===u)return f*s}else-1!==f&&(o-=o-f),f=-1}else for(r+u>a&&(r=a-u),o=r;o>=0;o--){for(var c=!0,l=0;l<u;l++)if(h(t,o+l)!==h(e,l)){c=!1;break}if(c)return o}return-1}function g(t,e,r,n){r=Number(r)||0;var i=t.length-r;n?(n=Number(n))>i&&(n=i):n=i;var o=e.length;n>o/2&&(n=o/2);for(var s=0;s<n;++s){var a=parseInt(e.substr(2*s,2),16);if(q(a))return s;t[r+s]=a}return s}function w(t,e,r,n){return C(N(e,t.length-r),t,r,n)}function _(t,e,r,n){return C(function(t){for(var e=[],r=0;r<t.length;++r)e.push(255&t.charCodeAt(r));return e}(e),t,r,n)}function M(t,e,r,n){return C(D(e),t,r,n)}function S(t,e,r,n){return C(function(t,e){for(var r,n,i,o=[],s=0;s<t.length&&!((e-=2)<0);++s)r=t.charCodeAt(s),n=r>>8,i=r%256,o.push(i),o.push(n);return o}(e,t.length-r),t,r,n)}function O(t,e,r){return 0===e&&r===t.length?m.fromByteArray(t):m.fromByteArray(t.slice(e,r))}function A(t,e,r){r=Math.min(t.length,r);for(var n=[],i=e;i<r;){var o,s,a,u,h=t[i],f=null,c=h>239?4:h>223?3:h>191?2:1;if(i+c<=r)switch(c){case 1:h<128&&(f=h);break;case 2:128==(192&(o=t[i+1]))&&(u=(31&h)<<6|63&o)>127&&(f=u);break;case 3:o=t[i+1],s=t[i+2],128==(192&o)&&128==(192&s)&&(u=(15&h)<<12|(63&o)<<6|63&s)>2047&&(u<55296||u>57343)&&(f=u);break;case 4:o=t[i+1],s=t[i+2],a=t[i+3],128==(192&o)&&128==(192&s)&&128==(192&a)&&(u=(15&h)<<18|(63&o)<<12|(63&s)<<6|63&a)>65535&&u<1114112&&(f=u)}null===f?(f=65533,c=1):f>65535&&(f-=65536,n.push(f>>>10&1023|55296),f=56320|1023&f),n.push(f),i+=c}return function(t){var e=t.length;if(e<=4096)return String.fromCharCode.apply(String,t);var r="",n=0;for(;n<e;)r+=String.fromCharCode.apply(String,t.slice(n,n+=4096));return r}(n)}e.kMaxLength=2147483647,i.TYPED_ARRAY_SUPPORT=function(){try{var t=new Uint8Array(1),e={foo:function(){return 42}};return Object.setPrototypeOf(e,Uint8Array.prototype),Object.setPrototypeOf(t,e),42===t.foo()}catch(t){return!1}}(),i.TYPED_ARRAY_SUPPORT||"undefined"==typeof console||"function"!=typeof console.error||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(i.prototype,"parent",{enumerable:!0,get:function(){if(i.isBuffer(this))return this.buffer}}),Object.defineProperty(i.prototype,"offset",{enumerable:!0,get:function(){if(i.isBuffer(this))return this.byteOffset}}),i.poolSize=8192,i.from=function(t,e,r){return o(t,e,r)},Object.setPrototypeOf(i.prototype,Uint8Array.prototype),Object.setPrototypeOf(i,Uint8Array),i.alloc=function(t,e,r){return function(t,e,r){return s(t),t<=0?n(t):void 0!==e?"string"==typeof r?n(t).fill(e,r):n(t).fill(e):n(t)}(t,e,r)},i.allocUnsafe=function(t){return a(t)},i.allocUnsafeSlow=function(t){return a(t)},i.isBuffer=function(t){return null!=t&&!0===t._isBuffer&&t!==i.prototype},i.compare=function(t,e){if(L(t,Uint8Array)&&(t=i.from(t,t.offset,t.byteLength)),L(e,Uint8Array)&&(e=i.from(e,e.offset,e.byteLength)),!i.isBuffer(t)||!i.isBuffer(e))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(t===e)return 0;for(var r=t.length,n=e.length,o=0,s=Math.min(r,n);o<s;++o)if(t[o]!==e[o]){r=t[o],n=e[o];break}return r<n?-1:n<r?1:0},i.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},i.concat=function(t,e){if(!Array.isArray(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return i.alloc(0);var r;if(void 0===e)for(e=0,r=0;r<t.length;++r)e+=t[r].length;var n=i.allocUnsafe(e),o=0;for(r=0;r<t.length;++r){var s=t[r];if(L(s,Uint8Array))o+s.length>n.length?i.from(s).copy(n,o):Uint8Array.prototype.set.call(n,s,o);else{if(!i.isBuffer(s))throw new TypeError('"list" argument must be an Array of Buffers');s.copy(n,o)}o+=s.length}return n},i.byteLength=c,i.prototype._isBuffer=!0,i.prototype.swap16=function(){var t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var e=0;e<t;e+=2)d(this,e,e+1);return this},i.prototype.swap32=function(){var t=this.length;if(t%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var e=0;e<t;e+=4)d(this,e,e+3),d(this,e+1,e+2);return this},i.prototype.swap64=function(){var t=this.length;if(t%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var e=0;e<t;e+=8)d(this,e,e+7),d(this,e+1,e+6),d(this,e+2,e+5),d(this,e+3,e+4);return this},i.prototype.toString=function(){var t=this.length;return 0===t?"":0===arguments.length?A(this,0,t):l.apply(this,arguments)},i.prototype.toLocaleString=i.prototype.toString,i.prototype.equals=function(t){if(!i.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===i.compare(this,t)},i.prototype.inspect=function(){var t="",r=e.INSPECT_MAX_BYTES;return t=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(t+=" ... "),"<Buffer "+t+">"},r&&(i.prototype[r]=i.prototype.inspect),i.prototype.compare=function(t,e,r,n,o){if(L(t,Uint8Array)&&(t=i.from(t,t.offset,t.byteLength)),!i.isBuffer(t))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+babelHelpers.typeof(t));if(void 0===e&&(e=0),void 0===r&&(r=t?t.length:0),void 0===n&&(n=0),void 0===o&&(o=this.length),e<0||r>t.length||n<0||o>this.length)throw new RangeError("out of range index");if(n>=o&&e>=r)return 0;if(n>=o)return-1;if(e>=r)return 1;if(this===t)return 0;for(var s=(o>>>=0)-(n>>>=0),a=(r>>>=0)-(e>>>=0),u=Math.min(s,a),h=this.slice(n,o),f=t.slice(e,r),c=0;c<u;++c)if(h[c]!==f[c]){s=h[c],a=f[c];break}return s<a?-1:a<s?1:0},i.prototype.includes=function(t,e,r){return-1!==this.indexOf(t,e,r)},i.prototype.indexOf=function(t,e,r){return p(this,t,e,r,!0)},i.prototype.lastIndexOf=function(t,e,r){return p(this,t,e,r,!1)},i.prototype.write=function(t,e,r,n){if(void 0===e)n="utf8",r=this.length,e=0;else if(void 0===r&&"string"==typeof e)n=e,r=this.length,e=0;else{if(!isFinite(e))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");e>>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var i=this.length-e;if((void 0===r||r>i)&&(r=i),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var o=!1;;)switch(n){case"hex":return g(this,t,e,r);case"utf8":case"utf-8":return w(this,t,e,r);case"ascii":case"latin1":case"binary":return _(this,t,e,r);case"base64":return M(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return S(this,t,e,r);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}},i.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function E(t,e,r){var n="";r=Math.min(t.length,r);for(var i=e;i<r;++i)n+=String.fromCharCode(127&t[i]);return n}function x(t,e,r){var n="";r=Math.min(t.length,r);for(var i=e;i<r;++i)n+=String.fromCharCode(t[i]);return n}function k(t,e,r){var n=t.length;(!e||e<0)&&(e=0),(!r||r<0||r>n)&&(r=n);for(var i="",o=e;o<r;++o)i+=U[t[o]];return i}function j(t,e,r){for(var n=t.slice(e,r),i="",o=0;o<n.length-1;o+=2)i+=String.fromCharCode(n[o]+256*n[o+1]);return i}function $(t,e,r){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(t+e>r)throw new RangeError("Trying to access beyond buffer length")}function R(t,e,r,n,o,s){if(!i.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>o||e<s)throw new RangeError('"value" argument is out of bounds');if(r+n>t.length)throw new RangeError("Index out of range")}function P(t,e,r,n,i,o){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function B(t,e,r,n,i){return e=+e,r>>>=0,i||P(t,0,r,4),b(t,e,r,n,23,4),r+4}function T(t,e,r,n,i){return e=+e,r>>>=0,i||P(t,0,r,8),b(t,e,r,n,52,8),r+8}i.prototype.slice=function(t,e){var r=this.length;(t=~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),(e=void 0===e?r:~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),e<t&&(e=t);var n=this.subarray(t,e);return Object.setPrototypeOf(n,i.prototype),n},i.prototype.readUintLE=i.prototype.readUIntLE=function(t,e,r){t>>>=0,e>>>=0,r||$(t,e,this.length);for(var n=this[t],i=1,o=0;++o<e&&(i*=256);)n+=this[t+o]*i;return n},i.prototype.readUintBE=i.prototype.readUIntBE=function(t,e,r){t>>>=0,e>>>=0,r||$(t,e,this.length);for(var n=this[t+--e],i=1;e>0&&(i*=256);)n+=this[t+--e]*i;return n},i.prototype.readUint8=i.prototype.readUInt8=function(t,e){return t>>>=0,e||$(t,1,this.length),this[t]},i.prototype.readUint16LE=i.prototype.readUInt16LE=function(t,e){return t>>>=0,e||$(t,2,this.length),this[t]|this[t+1]<<8},i.prototype.readUint16BE=i.prototype.readUInt16BE=function(t,e){return t>>>=0,e||$(t,2,this.length),this[t]<<8|this[t+1]},i.prototype.readUint32LE=i.prototype.readUInt32LE=function(t,e){return t>>>=0,e||$(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},i.prototype.readUint32BE=i.prototype.readUInt32BE=function(t,e){return t>>>=0,e||$(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},i.prototype.readIntLE=function(t,e,r){t>>>=0,e>>>=0,r||$(t,e,this.length);for(var n=this[t],i=1,o=0;++o<e&&(i*=256);)n+=this[t+o]*i;return n>=(i*=128)&&(n-=Math.pow(2,8*e)),n},i.prototype.readIntBE=function(t,e,r){t>>>=0,e>>>=0,r||$(t,e,this.length);for(var n=e,i=1,o=this[t+--n];n>0&&(i*=256);)o+=this[t+--n]*i;return o>=(i*=128)&&(o-=Math.pow(2,8*e)),o},i.prototype.readInt8=function(t,e){return t>>>=0,e||$(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},i.prototype.readInt16LE=function(t,e){t>>>=0,e||$(t,2,this.length);var r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},i.prototype.readInt16BE=function(t,e){t>>>=0,e||$(t,2,this.length);var r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},i.prototype.readInt32LE=function(t,e){return t>>>=0,e||$(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},i.prototype.readInt32BE=function(t,e){return t>>>=0,e||$(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},i.prototype.readFloatLE=function(t,e){return t>>>=0,e||$(t,4,this.length),y(this,t,!0,23,4)},i.prototype.readFloatBE=function(t,e){return t>>>=0,e||$(t,4,this.length),y(this,t,!1,23,4)},i.prototype.readDoubleLE=function(t,e){return t>>>=0,e||$(t,8,this.length),y(this,t,!0,52,8)},i.prototype.readDoubleBE=function(t,e){return t>>>=0,e||$(t,8,this.length),y(this,t,!1,52,8)},i.prototype.writeUintLE=i.prototype.writeUIntLE=function(t,e,r,n){(t=+t,e>>>=0,r>>>=0,n)||R(this,t,e,r,Math.pow(2,8*r)-1,0);var i=1,o=0;for(this[e]=255&t;++o<r&&(i*=256);)this[e+o]=t/i&255;return e+r},i.prototype.writeUintBE=i.prototype.writeUIntBE=function(t,e,r,n){(t=+t,e>>>=0,r>>>=0,n)||R(this,t,e,r,Math.pow(2,8*r)-1,0);var i=r-1,o=1;for(this[e+i]=255&t;--i>=0&&(o*=256);)this[e+i]=t/o&255;return e+r},i.prototype.writeUint8=i.prototype.writeUInt8=function(t,e,r){return t=+t,e>>>=0,r||R(this,t,e,1,255,0),this[e]=255&t,e+1},i.prototype.writeUint16LE=i.prototype.writeUInt16LE=function(t,e,r){return t=+t,e>>>=0,r||R(this,t,e,2,65535,0),this[e]=255&t,this[e+1]=t>>>8,e+2},i.prototype.writeUint16BE=i.prototype.writeUInt16BE=function(t,e,r){return t=+t,e>>>=0,r||R(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=255&t,e+2},i.prototype.writeUint32LE=i.prototype.writeUInt32LE=function(t,e,r){return t=+t,e>>>=0,r||R(this,t,e,4,4294967295,0),this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t,e+4},i.prototype.writeUint32BE=i.prototype.writeUInt32BE=function(t,e,r){return t=+t,e>>>=0,r||R(this,t,e,4,4294967295,0),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},i.prototype.writeIntLE=function(t,e,r,n){if(t=+t,e>>>=0,!n){var i=Math.pow(2,8*r-1);R(this,t,e,r,i-1,-i)}var o=0,s=1,a=0;for(this[e]=255&t;++o<r&&(s*=256);)t<0&&0===a&&0!==this[e+o-1]&&(a=1),this[e+o]=(t/s>>0)-a&255;return e+r},i.prototype.writeIntBE=function(t,e,r,n){if(t=+t,e>>>=0,!n){var i=Math.pow(2,8*r-1);R(this,t,e,r,i-1,-i)}var o=r-1,s=1,a=0;for(this[e+o]=255&t;--o>=0&&(s*=256);)t<0&&0===a&&0!==this[e+o+1]&&(a=1),this[e+o]=(t/s>>0)-a&255;return e+r},i.prototype.writeInt8=function(t,e,r){return t=+t,e>>>=0,r||R(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=255&t,e+1},i.prototype.writeInt16LE=function(t,e,r){return t=+t,e>>>=0,r||R(this,t,e,2,32767,-32768),this[e]=255&t,this[e+1]=t>>>8,e+2},i.prototype.writeInt16BE=function(t,e,r){return t=+t,e>>>=0,r||R(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=255&t,e+2},i.prototype.writeInt32LE=function(t,e,r){return t=+t,e>>>=0,r||R(this,t,e,4,2147483647,-2147483648),this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24,e+4},i.prototype.writeInt32BE=function(t,e,r){return t=+t,e>>>=0,r||R(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},i.prototype.writeFloatLE=function(t,e,r){return B(this,t,e,!0,r)},i.prototype.writeFloatBE=function(t,e,r){return B(this,t,e,!1,r)},i.prototype.writeDoubleLE=function(t,e,r){return T(this,t,e,!0,r)},i.prototype.writeDoubleBE=function(t,e,r){return T(this,t,e,!1,r)},i.prototype.copy=function(t,e,r,n){if(!i.isBuffer(t))throw new TypeError("argument should be a Buffer");if(r||(r=0),n||0===n||(n=this.length),e>=t.length&&(e=t.length),e||(e=0),n>0&&n<r&&(n=r),n===r)return 0;if(0===t.length||0===this.length)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),t.length-e<n-r&&(n=t.length-e+r);var o=n-r;return this===t&&"function"==typeof Uint8Array.prototype.copyWithin?this.copyWithin(e,r,n):Uint8Array.prototype.set.call(t,this.subarray(r,n),e),o},i.prototype.fill=function(t,e,r,n){if("string"==typeof t){if("string"==typeof e?(n=e,e=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!i.isEncoding(n))throw new TypeError("Unknown encoding: "+n);if(1===t.length){var o=t.charCodeAt(0);("utf8"===n&&o<128||"latin1"===n)&&(t=o)}}else"number"==typeof t?t&=255:"boolean"==typeof t&&(t=Number(t));if(e<0||this.length<e||this.length<r)throw new RangeError("Out of range index");if(r<=e)return this;var s;if(e>>>=0,r=void 0===r?this.length:r>>>0,t||(t=0),"number"==typeof t)for(s=e;s<r;++s)this[s]=t;else{var a=i.isBuffer(t)?t:i.from(t,n),u=a.length;if(0===u)throw new TypeError('The value "'+t+'" is invalid for argument "value"');for(s=0;s<r-e;++s)this[s+e]=a[s%u]}return this};var I=/[^+/0-9A-Za-z-_]/g;function N(t,e){var r;e=e||1/0;for(var n=t.length,i=null,o=[],s=0;s<n;++s){if((r=t.charCodeAt(s))>55295&&r<57344){if(!i){if(r>56319){(e-=3)>-1&&o.push(239,191,189);continue}if(s+1===n){(e-=3)>-1&&o.push(239,191,189);continue}i=r;continue}if(r<56320){(e-=3)>-1&&o.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320)}else i&&(e-=3)>-1&&o.push(239,191,189);if(i=null,r<128){if((e-=1)<0)break;o.push(r)}else if(r<2048){if((e-=2)<0)break;o.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function D(t){return m.toByteArray(function(t){if((t=(t=t.split("=")[0]).trim().replace(I,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function C(t,e,r,n){for(var i=0;i<n&&!(i+r>=e.length||i>=t.length);++i)e[i+r]=t[i];return i}function L(t,e){return t instanceof e||null!=t&&null!=t.constructor&&null!=t.constructor.name&&t.constructor.name===e.name}function q(t){return t!=t}var U=function(){for(var t=new Array(256),e=0;e<16;++e)for(var r=16*e,n=0;n<16;++n)t[r+n]="0123456789abcdef"[e]+"0123456789abcdef"[n];return t}()})),g=v.Buffer;
575
+ */e.Array=r(175),e.Buffer=r(177),e.Document=e.Embedded=r(47),e.DocumentArray=r(27),e.Decimal128=r(34),e.ObjectId=r(18),e.Map=r(179),e.Subdocument=r(94)},function(t,e,r){"use strict";r.r(e),function(t){function n(t){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}r.d(e,"BSONError",(function(){return S})),r.d(e,"BSONRegExp",(function(){return vt})),r.d(e,"BSONSymbol",(function(){return gt})),r.d(e,"BSONTypeError",(function(){return O})),r.d(e,"BSON_BINARY_SUBTYPE_BYTE_ARRAY",(function(){return oe})),r.d(e,"BSON_BINARY_SUBTYPE_COLUMN",(function(){return fe})),r.d(e,"BSON_BINARY_SUBTYPE_DEFAULT",(function(){return ne})),r.d(e,"BSON_BINARY_SUBTYPE_ENCRYPTED",(function(){return he})),r.d(e,"BSON_BINARY_SUBTYPE_FUNCTION",(function(){return ie})),r.d(e,"BSON_BINARY_SUBTYPE_MD5",(function(){return ue})),r.d(e,"BSON_BINARY_SUBTYPE_USER_DEFINED",(function(){return ce})),r.d(e,"BSON_BINARY_SUBTYPE_UUID",(function(){return se})),r.d(e,"BSON_BINARY_SUBTYPE_UUID_NEW",(function(){return ae})),r.d(e,"BSON_DATA_ARRAY",(function(){return Lt})),r.d(e,"BSON_DATA_BINARY",(function(){return qt})),r.d(e,"BSON_DATA_BOOLEAN",(function(){return zt})),r.d(e,"BSON_DATA_CODE",(function(){return Zt})),r.d(e,"BSON_DATA_CODE_W_SCOPE",(function(){return Yt})),r.d(e,"BSON_DATA_DATE",(function(){return Vt})),r.d(e,"BSON_DATA_DBPOINTER",(function(){return Wt})),r.d(e,"BSON_DATA_DECIMAL128",(function(){return te})),r.d(e,"BSON_DATA_INT",(function(){return Gt})),r.d(e,"BSON_DATA_LONG",(function(){return Xt})),r.d(e,"BSON_DATA_MAX_KEY",(function(){return re})),r.d(e,"BSON_DATA_MIN_KEY",(function(){return ee})),r.d(e,"BSON_DATA_NULL",(function(){return Kt})),r.d(e,"BSON_DATA_NUMBER",(function(){return Nt})),r.d(e,"BSON_DATA_OBJECT",(function(){return Ct})),r.d(e,"BSON_DATA_OID",(function(){return Ft})),r.d(e,"BSON_DATA_REGEXP",(function(){return Ht})),r.d(e,"BSON_DATA_STRING",(function(){return Dt})),r.d(e,"BSON_DATA_SYMBOL",(function(){return Jt})),r.d(e,"BSON_DATA_TIMESTAMP",(function(){return Qt})),r.d(e,"BSON_DATA_UNDEFINED",(function(){return Ut})),r.d(e,"BSON_INT32_MAX",(function(){return $t})),r.d(e,"BSON_INT32_MIN",(function(){return Rt})),r.d(e,"BSON_INT64_MAX",(function(){return Pt})),r.d(e,"BSON_INT64_MIN",(function(){return Bt})),r.d(e,"Binary",(function(){return K})),r.d(e,"Code",(function(){return H})),r.d(e,"DBRef",(function(){return Z})),r.d(e,"Decimal128",(function(){return ht})),r.d(e,"Double",(function(){return ft})),r.d(e,"EJSON",(function(){return Et})),r.d(e,"Int32",(function(){return ct})),r.d(e,"Long",(function(){return Q})),r.d(e,"LongWithoutOverridesClass",(function(){return wt})),r.d(e,"Map",(function(){return xt})),r.d(e,"MaxKey",(function(){return lt})),r.d(e,"MinKey",(function(){return dt})),r.d(e,"ObjectID",(function(){return bt})),r.d(e,"ObjectId",(function(){return bt})),r.d(e,"Timestamp",(function(){return _t})),r.d(e,"UUID",(function(){return V})),r.d(e,"calculateObjectSize",(function(){return Ge})),r.d(e,"deserialize",(function(){return Ye})),r.d(e,"deserializeStream",(function(){return Qe})),r.d(e,"serialize",(function(){return Ze})),r.d(e,"serializeWithBufferAndIndex",(function(){return Je})),r.d(e,"setInternalBufferSize",(function(){return We}));for(var i=function(t){var e=d(t),r=e[0],n=e[1];return 3*(r+n)/4-n},o=function(t){var e,r,n=d(t),i=n[0],o=n[1],s=new h(function(t,e,r){return 3*(e+r)/4-r}(0,i,o)),a=0,f=o>0?i-4:i;for(r=0;r<f;r+=4)e=u[t.charCodeAt(r)]<<18|u[t.charCodeAt(r+1)]<<12|u[t.charCodeAt(r+2)]<<6|u[t.charCodeAt(r+3)],s[a++]=e>>16&255,s[a++]=e>>8&255,s[a++]=255&e;2===o&&(e=u[t.charCodeAt(r)]<<2|u[t.charCodeAt(r+1)]>>4,s[a++]=255&e);1===o&&(e=u[t.charCodeAt(r)]<<10|u[t.charCodeAt(r+1)]<<4|u[t.charCodeAt(r+2)]>>2,s[a++]=e>>8&255,s[a++]=255&e);return s},s=function(t){for(var e,r=t.length,n=r%3,i=[],o=0,s=r-n;o<s;o+=16383)i.push(p(t,o,o+16383>s?s:o+16383));1===n?(e=t[r-1],i.push(a[e>>2]+a[e<<4&63]+"==")):2===n&&(e=(t[r-2]<<8)+t[r-1],i.push(a[e>>10]+a[e>>4&63]+a[e<<2&63]+"="));return i.join("")},a=[],u=[],h="undefined"!=typeof Uint8Array?Uint8Array:Array,f="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",c=0,l=f.length;c<l;++c)a[c]=f[c],u[f.charCodeAt(c)]=c;function d(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");return-1===r&&(r=e),[r,r===e?0:4-r%4]}function p(t,e,r){for(var n,i,o=[],s=e;s<r;s+=3)n=(t[s]<<16&16711680)+(t[s+1]<<8&65280)+(255&t[s+2]),o.push(a[(i=n)>>18&63]+a[i>>12&63]+a[i>>6&63]+a[63&i]);return o.join("")}u["-".charCodeAt(0)]=62,u["_".charCodeAt(0)]=63;var m={byteLength:i,toByteArray:o,fromByteArray:s},y=function(t,e,r,n,i){var o,s,a=8*i-n-1,u=(1<<a)-1,h=u>>1,f=-7,c=r?i-1:0,l=r?-1:1,d=t[e+c];for(c+=l,o=d&(1<<-f)-1,d>>=-f,f+=a;f>0;o=256*o+t[e+c],c+=l,f-=8);for(s=o&(1<<-f)-1,o>>=-f,f+=n;f>0;s=256*s+t[e+c],c+=l,f-=8);if(0===o)o=1-h;else{if(o===u)return s?NaN:1/0*(d?-1:1);s+=Math.pow(2,n),o-=h}return(d?-1:1)*s*Math.pow(2,o-n)},b=function(t,e,r,n,i,o){var s,a,u,h=8*o-i-1,f=(1<<h)-1,c=f>>1,l=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,d=n?0:o-1,p=n?1:-1,m=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,s=f):(s=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-s))<1&&(s--,u*=2),(e+=s+c>=1?l/u:l*Math.pow(2,1-c))*u>=2&&(s++,u/=2),s+c>=f?(a=0,s=f):s+c>=1?(a=(e*u-1)*Math.pow(2,i),s+=c):(a=e*Math.pow(2,c-1)*Math.pow(2,i),s=0));i>=8;t[r+d]=255&a,d+=p,a/=256,i-=8);for(s=s<<i|a,h+=i;h>0;t[r+d]=255&s,d+=p,s/=256,h-=8);t[r+d-p]|=128*m},v=function(t,e){return t(e={exports:{}},e.exports),e.exports}((function(t,e){var r="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;e.Buffer=i,e.SlowBuffer=function(t){+t!=t&&(t=0);return i.alloc(+t)},e.INSPECT_MAX_BYTES=50;function n(t){if(t>2147483647)throw new RangeError('The value "'+t+'" is invalid for option "size"');var e=new Uint8Array(t);return Object.setPrototypeOf(e,i.prototype),e}function i(t,e,r){if("number"==typeof t){if("string"==typeof e)throw new TypeError('The "string" argument must be of type string. Received type number');return a(t)}return o(t,e,r)}function o(t,e,r){if("string"==typeof t)return function(t,e){"string"==typeof e&&""!==e||(e="utf8");if(!i.isEncoding(e))throw new TypeError("Unknown encoding: "+e);var r=0|c(t,e),o=n(r),s=o.write(t,e);s!==r&&(o=o.slice(0,s));return o}(t,e);if(ArrayBuffer.isView(t))return function(t){if(L(t,Uint8Array)){var e=new Uint8Array(t);return h(e.buffer,e.byteOffset,e.byteLength)}return u(t)}(t);if(null==t)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+babelHelpers.typeof(t));if(L(t,ArrayBuffer)||t&&L(t.buffer,ArrayBuffer))return h(t,e,r);if("undefined"!=typeof SharedArrayBuffer&&(L(t,SharedArrayBuffer)||t&&L(t.buffer,SharedArrayBuffer)))return h(t,e,r);if("number"==typeof t)throw new TypeError('The "value" argument must not be of type number. Received type number');var o=t.valueOf&&t.valueOf();if(null!=o&&o!==t)return i.from(o,e,r);var s=function(t){if(i.isBuffer(t)){var e=0|f(t.length),r=n(e);return 0===r.length||t.copy(r,0,0,e),r}if(void 0!==t.length)return"number"!=typeof t.length||q(t.length)?n(0):u(t);if("Buffer"===t.type&&Array.isArray(t.data))return u(t.data)}(t);if(s)return s;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof t[Symbol.toPrimitive])return i.from(t[Symbol.toPrimitive]("string"),e,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+babelHelpers.typeof(t))}function s(t){if("number"!=typeof t)throw new TypeError('"size" argument must be of type number');if(t<0)throw new RangeError('The value "'+t+'" is invalid for option "size"')}function a(t){return s(t),n(t<0?0:0|f(t))}function u(t){for(var e=t.length<0?0:0|f(t.length),r=n(e),i=0;i<e;i+=1)r[i]=255&t[i];return r}function h(t,e,r){if(e<0||t.byteLength<e)throw new RangeError('"offset" is outside of buffer bounds');if(t.byteLength<e+(r||0))throw new RangeError('"length" is outside of buffer bounds');var n;return n=void 0===e&&void 0===r?new Uint8Array(t):void 0===r?new Uint8Array(t,e):new Uint8Array(t,e,r),Object.setPrototypeOf(n,i.prototype),n}function f(t){if(t>=2147483647)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+2147483647..toString(16)+" bytes");return 0|t}function c(t,e){if(i.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||L(t,ArrayBuffer))return t.byteLength;if("string"!=typeof t)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+babelHelpers.typeof(t));var r=t.length,n=arguments.length>2&&!0===arguments[2];if(!n&&0===r)return 0;for(var o=!1;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return N(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return D(t).length;default:if(o)return n?-1:N(t).length;e=(""+e).toLowerCase(),o=!0}}function l(t,e,r){var n=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return k(this,e,r);case"utf8":case"utf-8":return A(this,e,r);case"ascii":return E(this,e,r);case"latin1":case"binary":return x(this,e,r);case"base64":return O(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return j(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}function d(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function p(t,e,r,n,o){if(0===t.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),q(r=+r)&&(r=o?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(o)return-1;r=t.length-1}else if(r<0){if(!o)return-1;r=0}if("string"==typeof e&&(e=i.from(e,n)),i.isBuffer(e))return 0===e.length?-1:v(t,e,r,n,o);if("number"==typeof e)return e&=255,"function"==typeof Uint8Array.prototype.indexOf?o?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):v(t,[e],r,n,o);throw new TypeError("val must be string, number or Buffer")}function v(t,e,r,n,i){var o,s=1,a=t.length,u=e.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(t.length<2||e.length<2)return-1;s=2,a/=2,u/=2,r/=2}function h(t,e){return 1===s?t[e]:t.readUInt16BE(e*s)}if(i){var f=-1;for(o=r;o<a;o++)if(h(t,o)===h(e,-1===f?0:o-f)){if(-1===f&&(f=o),o-f+1===u)return f*s}else-1!==f&&(o-=o-f),f=-1}else for(r+u>a&&(r=a-u),o=r;o>=0;o--){for(var c=!0,l=0;l<u;l++)if(h(t,o+l)!==h(e,l)){c=!1;break}if(c)return o}return-1}function g(t,e,r,n){r=Number(r)||0;var i=t.length-r;n?(n=Number(n))>i&&(n=i):n=i;var o=e.length;n>o/2&&(n=o/2);for(var s=0;s<n;++s){var a=parseInt(e.substr(2*s,2),16);if(q(a))return s;t[r+s]=a}return s}function w(t,e,r,n){return C(N(e,t.length-r),t,r,n)}function _(t,e,r,n){return C(function(t){for(var e=[],r=0;r<t.length;++r)e.push(255&t.charCodeAt(r));return e}(e),t,r,n)}function M(t,e,r,n){return C(D(e),t,r,n)}function S(t,e,r,n){return C(function(t,e){for(var r,n,i,o=[],s=0;s<t.length&&!((e-=2)<0);++s)r=t.charCodeAt(s),n=r>>8,i=r%256,o.push(i),o.push(n);return o}(e,t.length-r),t,r,n)}function O(t,e,r){return 0===e&&r===t.length?m.fromByteArray(t):m.fromByteArray(t.slice(e,r))}function A(t,e,r){r=Math.min(t.length,r);for(var n=[],i=e;i<r;){var o,s,a,u,h=t[i],f=null,c=h>239?4:h>223?3:h>191?2:1;if(i+c<=r)switch(c){case 1:h<128&&(f=h);break;case 2:128==(192&(o=t[i+1]))&&(u=(31&h)<<6|63&o)>127&&(f=u);break;case 3:o=t[i+1],s=t[i+2],128==(192&o)&&128==(192&s)&&(u=(15&h)<<12|(63&o)<<6|63&s)>2047&&(u<55296||u>57343)&&(f=u);break;case 4:o=t[i+1],s=t[i+2],a=t[i+3],128==(192&o)&&128==(192&s)&&128==(192&a)&&(u=(15&h)<<18|(63&o)<<12|(63&s)<<6|63&a)>65535&&u<1114112&&(f=u)}null===f?(f=65533,c=1):f>65535&&(f-=65536,n.push(f>>>10&1023|55296),f=56320|1023&f),n.push(f),i+=c}return function(t){var e=t.length;if(e<=4096)return String.fromCharCode.apply(String,t);var r="",n=0;for(;n<e;)r+=String.fromCharCode.apply(String,t.slice(n,n+=4096));return r}(n)}e.kMaxLength=2147483647,i.TYPED_ARRAY_SUPPORT=function(){try{var t=new Uint8Array(1),e={foo:function(){return 42}};return Object.setPrototypeOf(e,Uint8Array.prototype),Object.setPrototypeOf(t,e),42===t.foo()}catch(t){return!1}}(),i.TYPED_ARRAY_SUPPORT||"undefined"==typeof console||"function"!=typeof console.error||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(i.prototype,"parent",{enumerable:!0,get:function(){if(i.isBuffer(this))return this.buffer}}),Object.defineProperty(i.prototype,"offset",{enumerable:!0,get:function(){if(i.isBuffer(this))return this.byteOffset}}),i.poolSize=8192,i.from=function(t,e,r){return o(t,e,r)},Object.setPrototypeOf(i.prototype,Uint8Array.prototype),Object.setPrototypeOf(i,Uint8Array),i.alloc=function(t,e,r){return function(t,e,r){return s(t),t<=0?n(t):void 0!==e?"string"==typeof r?n(t).fill(e,r):n(t).fill(e):n(t)}(t,e,r)},i.allocUnsafe=function(t){return a(t)},i.allocUnsafeSlow=function(t){return a(t)},i.isBuffer=function(t){return null!=t&&!0===t._isBuffer&&t!==i.prototype},i.compare=function(t,e){if(L(t,Uint8Array)&&(t=i.from(t,t.offset,t.byteLength)),L(e,Uint8Array)&&(e=i.from(e,e.offset,e.byteLength)),!i.isBuffer(t)||!i.isBuffer(e))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(t===e)return 0;for(var r=t.length,n=e.length,o=0,s=Math.min(r,n);o<s;++o)if(t[o]!==e[o]){r=t[o],n=e[o];break}return r<n?-1:n<r?1:0},i.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},i.concat=function(t,e){if(!Array.isArray(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return i.alloc(0);var r;if(void 0===e)for(e=0,r=0;r<t.length;++r)e+=t[r].length;var n=i.allocUnsafe(e),o=0;for(r=0;r<t.length;++r){var s=t[r];if(L(s,Uint8Array))o+s.length>n.length?i.from(s).copy(n,o):Uint8Array.prototype.set.call(n,s,o);else{if(!i.isBuffer(s))throw new TypeError('"list" argument must be an Array of Buffers');s.copy(n,o)}o+=s.length}return n},i.byteLength=c,i.prototype._isBuffer=!0,i.prototype.swap16=function(){var t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var e=0;e<t;e+=2)d(this,e,e+1);return this},i.prototype.swap32=function(){var t=this.length;if(t%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var e=0;e<t;e+=4)d(this,e,e+3),d(this,e+1,e+2);return this},i.prototype.swap64=function(){var t=this.length;if(t%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var e=0;e<t;e+=8)d(this,e,e+7),d(this,e+1,e+6),d(this,e+2,e+5),d(this,e+3,e+4);return this},i.prototype.toString=function(){var t=this.length;return 0===t?"":0===arguments.length?A(this,0,t):l.apply(this,arguments)},i.prototype.toLocaleString=i.prototype.toString,i.prototype.equals=function(t){if(!i.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===i.compare(this,t)},i.prototype.inspect=function(){var t="",r=e.INSPECT_MAX_BYTES;return t=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(t+=" ... "),"<Buffer "+t+">"},r&&(i.prototype[r]=i.prototype.inspect),i.prototype.compare=function(t,e,r,n,o){if(L(t,Uint8Array)&&(t=i.from(t,t.offset,t.byteLength)),!i.isBuffer(t))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+babelHelpers.typeof(t));if(void 0===e&&(e=0),void 0===r&&(r=t?t.length:0),void 0===n&&(n=0),void 0===o&&(o=this.length),e<0||r>t.length||n<0||o>this.length)throw new RangeError("out of range index");if(n>=o&&e>=r)return 0;if(n>=o)return-1;if(e>=r)return 1;if(this===t)return 0;for(var s=(o>>>=0)-(n>>>=0),a=(r>>>=0)-(e>>>=0),u=Math.min(s,a),h=this.slice(n,o),f=t.slice(e,r),c=0;c<u;++c)if(h[c]!==f[c]){s=h[c],a=f[c];break}return s<a?-1:a<s?1:0},i.prototype.includes=function(t,e,r){return-1!==this.indexOf(t,e,r)},i.prototype.indexOf=function(t,e,r){return p(this,t,e,r,!0)},i.prototype.lastIndexOf=function(t,e,r){return p(this,t,e,r,!1)},i.prototype.write=function(t,e,r,n){if(void 0===e)n="utf8",r=this.length,e=0;else if(void 0===r&&"string"==typeof e)n=e,r=this.length,e=0;else{if(!isFinite(e))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");e>>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var i=this.length-e;if((void 0===r||r>i)&&(r=i),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var o=!1;;)switch(n){case"hex":return g(this,t,e,r);case"utf8":case"utf-8":return w(this,t,e,r);case"ascii":case"latin1":case"binary":return _(this,t,e,r);case"base64":return M(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return S(this,t,e,r);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}},i.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function E(t,e,r){var n="";r=Math.min(t.length,r);for(var i=e;i<r;++i)n+=String.fromCharCode(127&t[i]);return n}function x(t,e,r){var n="";r=Math.min(t.length,r);for(var i=e;i<r;++i)n+=String.fromCharCode(t[i]);return n}function k(t,e,r){var n=t.length;(!e||e<0)&&(e=0),(!r||r<0||r>n)&&(r=n);for(var i="",o=e;o<r;++o)i+=U[t[o]];return i}function j(t,e,r){for(var n=t.slice(e,r),i="",o=0;o<n.length-1;o+=2)i+=String.fromCharCode(n[o]+256*n[o+1]);return i}function $(t,e,r){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(t+e>r)throw new RangeError("Trying to access beyond buffer length")}function R(t,e,r,n,o,s){if(!i.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>o||e<s)throw new RangeError('"value" argument is out of bounds');if(r+n>t.length)throw new RangeError("Index out of range")}function P(t,e,r,n,i,o){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function B(t,e,r,n,i){return e=+e,r>>>=0,i||P(t,0,r,4),b(t,e,r,n,23,4),r+4}function T(t,e,r,n,i){return e=+e,r>>>=0,i||P(t,0,r,8),b(t,e,r,n,52,8),r+8}i.prototype.slice=function(t,e){var r=this.length;(t=~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),(e=void 0===e?r:~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),e<t&&(e=t);var n=this.subarray(t,e);return Object.setPrototypeOf(n,i.prototype),n},i.prototype.readUintLE=i.prototype.readUIntLE=function(t,e,r){t>>>=0,e>>>=0,r||$(t,e,this.length);for(var n=this[t],i=1,o=0;++o<e&&(i*=256);)n+=this[t+o]*i;return n},i.prototype.readUintBE=i.prototype.readUIntBE=function(t,e,r){t>>>=0,e>>>=0,r||$(t,e,this.length);for(var n=this[t+--e],i=1;e>0&&(i*=256);)n+=this[t+--e]*i;return n},i.prototype.readUint8=i.prototype.readUInt8=function(t,e){return t>>>=0,e||$(t,1,this.length),this[t]},i.prototype.readUint16LE=i.prototype.readUInt16LE=function(t,e){return t>>>=0,e||$(t,2,this.length),this[t]|this[t+1]<<8},i.prototype.readUint16BE=i.prototype.readUInt16BE=function(t,e){return t>>>=0,e||$(t,2,this.length),this[t]<<8|this[t+1]},i.prototype.readUint32LE=i.prototype.readUInt32LE=function(t,e){return t>>>=0,e||$(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},i.prototype.readUint32BE=i.prototype.readUInt32BE=function(t,e){return t>>>=0,e||$(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},i.prototype.readIntLE=function(t,e,r){t>>>=0,e>>>=0,r||$(t,e,this.length);for(var n=this[t],i=1,o=0;++o<e&&(i*=256);)n+=this[t+o]*i;return n>=(i*=128)&&(n-=Math.pow(2,8*e)),n},i.prototype.readIntBE=function(t,e,r){t>>>=0,e>>>=0,r||$(t,e,this.length);for(var n=e,i=1,o=this[t+--n];n>0&&(i*=256);)o+=this[t+--n]*i;return o>=(i*=128)&&(o-=Math.pow(2,8*e)),o},i.prototype.readInt8=function(t,e){return t>>>=0,e||$(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},i.prototype.readInt16LE=function(t,e){t>>>=0,e||$(t,2,this.length);var r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},i.prototype.readInt16BE=function(t,e){t>>>=0,e||$(t,2,this.length);var r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},i.prototype.readInt32LE=function(t,e){return t>>>=0,e||$(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},i.prototype.readInt32BE=function(t,e){return t>>>=0,e||$(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},i.prototype.readFloatLE=function(t,e){return t>>>=0,e||$(t,4,this.length),y(this,t,!0,23,4)},i.prototype.readFloatBE=function(t,e){return t>>>=0,e||$(t,4,this.length),y(this,t,!1,23,4)},i.prototype.readDoubleLE=function(t,e){return t>>>=0,e||$(t,8,this.length),y(this,t,!0,52,8)},i.prototype.readDoubleBE=function(t,e){return t>>>=0,e||$(t,8,this.length),y(this,t,!1,52,8)},i.prototype.writeUintLE=i.prototype.writeUIntLE=function(t,e,r,n){(t=+t,e>>>=0,r>>>=0,n)||R(this,t,e,r,Math.pow(2,8*r)-1,0);var i=1,o=0;for(this[e]=255&t;++o<r&&(i*=256);)this[e+o]=t/i&255;return e+r},i.prototype.writeUintBE=i.prototype.writeUIntBE=function(t,e,r,n){(t=+t,e>>>=0,r>>>=0,n)||R(this,t,e,r,Math.pow(2,8*r)-1,0);var i=r-1,o=1;for(this[e+i]=255&t;--i>=0&&(o*=256);)this[e+i]=t/o&255;return e+r},i.prototype.writeUint8=i.prototype.writeUInt8=function(t,e,r){return t=+t,e>>>=0,r||R(this,t,e,1,255,0),this[e]=255&t,e+1},i.prototype.writeUint16LE=i.prototype.writeUInt16LE=function(t,e,r){return t=+t,e>>>=0,r||R(this,t,e,2,65535,0),this[e]=255&t,this[e+1]=t>>>8,e+2},i.prototype.writeUint16BE=i.prototype.writeUInt16BE=function(t,e,r){return t=+t,e>>>=0,r||R(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=255&t,e+2},i.prototype.writeUint32LE=i.prototype.writeUInt32LE=function(t,e,r){return t=+t,e>>>=0,r||R(this,t,e,4,4294967295,0),this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t,e+4},i.prototype.writeUint32BE=i.prototype.writeUInt32BE=function(t,e,r){return t=+t,e>>>=0,r||R(this,t,e,4,4294967295,0),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},i.prototype.writeIntLE=function(t,e,r,n){if(t=+t,e>>>=0,!n){var i=Math.pow(2,8*r-1);R(this,t,e,r,i-1,-i)}var o=0,s=1,a=0;for(this[e]=255&t;++o<r&&(s*=256);)t<0&&0===a&&0!==this[e+o-1]&&(a=1),this[e+o]=(t/s>>0)-a&255;return e+r},i.prototype.writeIntBE=function(t,e,r,n){if(t=+t,e>>>=0,!n){var i=Math.pow(2,8*r-1);R(this,t,e,r,i-1,-i)}var o=r-1,s=1,a=0;for(this[e+o]=255&t;--o>=0&&(s*=256);)t<0&&0===a&&0!==this[e+o+1]&&(a=1),this[e+o]=(t/s>>0)-a&255;return e+r},i.prototype.writeInt8=function(t,e,r){return t=+t,e>>>=0,r||R(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=255&t,e+1},i.prototype.writeInt16LE=function(t,e,r){return t=+t,e>>>=0,r||R(this,t,e,2,32767,-32768),this[e]=255&t,this[e+1]=t>>>8,e+2},i.prototype.writeInt16BE=function(t,e,r){return t=+t,e>>>=0,r||R(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=255&t,e+2},i.prototype.writeInt32LE=function(t,e,r){return t=+t,e>>>=0,r||R(this,t,e,4,2147483647,-2147483648),this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24,e+4},i.prototype.writeInt32BE=function(t,e,r){return t=+t,e>>>=0,r||R(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},i.prototype.writeFloatLE=function(t,e,r){return B(this,t,e,!0,r)},i.prototype.writeFloatBE=function(t,e,r){return B(this,t,e,!1,r)},i.prototype.writeDoubleLE=function(t,e,r){return T(this,t,e,!0,r)},i.prototype.writeDoubleBE=function(t,e,r){return T(this,t,e,!1,r)},i.prototype.copy=function(t,e,r,n){if(!i.isBuffer(t))throw new TypeError("argument should be a Buffer");if(r||(r=0),n||0===n||(n=this.length),e>=t.length&&(e=t.length),e||(e=0),n>0&&n<r&&(n=r),n===r)return 0;if(0===t.length||0===this.length)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),t.length-e<n-r&&(n=t.length-e+r);var o=n-r;return this===t&&"function"==typeof Uint8Array.prototype.copyWithin?this.copyWithin(e,r,n):Uint8Array.prototype.set.call(t,this.subarray(r,n),e),o},i.prototype.fill=function(t,e,r,n){if("string"==typeof t){if("string"==typeof e?(n=e,e=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!i.isEncoding(n))throw new TypeError("Unknown encoding: "+n);if(1===t.length){var o=t.charCodeAt(0);("utf8"===n&&o<128||"latin1"===n)&&(t=o)}}else"number"==typeof t?t&=255:"boolean"==typeof t&&(t=Number(t));if(e<0||this.length<e||this.length<r)throw new RangeError("Out of range index");if(r<=e)return this;var s;if(e>>>=0,r=void 0===r?this.length:r>>>0,t||(t=0),"number"==typeof t)for(s=e;s<r;++s)this[s]=t;else{var a=i.isBuffer(t)?t:i.from(t,n),u=a.length;if(0===u)throw new TypeError('The value "'+t+'" is invalid for argument "value"');for(s=0;s<r-e;++s)this[s+e]=a[s%u]}return this};var I=/[^+/0-9A-Za-z-_]/g;function N(t,e){var r;e=e||1/0;for(var n=t.length,i=null,o=[],s=0;s<n;++s){if((r=t.charCodeAt(s))>55295&&r<57344){if(!i){if(r>56319){(e-=3)>-1&&o.push(239,191,189);continue}if(s+1===n){(e-=3)>-1&&o.push(239,191,189);continue}i=r;continue}if(r<56320){(e-=3)>-1&&o.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320)}else i&&(e-=3)>-1&&o.push(239,191,189);if(i=null,r<128){if((e-=1)<0)break;o.push(r)}else if(r<2048){if((e-=2)<0)break;o.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function D(t){return m.toByteArray(function(t){if((t=(t=t.split("=")[0]).trim().replace(I,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function C(t,e,r,n){for(var i=0;i<n&&!(i+r>=e.length||i>=t.length);++i)e[i+r]=t[i];return i}function L(t,e){return t instanceof e||null!=t&&null!=t.constructor&&null!=t.constructor.name&&t.constructor.name===e.name}function q(t){return t!=t}var U=function(){for(var t=new Array(256),e=0;e<16;++e)for(var r=16*e,n=0;n<16;++n)t[r+n]="0123456789abcdef"[e]+"0123456789abcdef"[n];return t}()})),g=v.Buffer;
572
576
  /*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */v.SlowBuffer,v.INSPECT_MAX_BYTES,v.kMaxLength;
573
577
  /*! *****************************************************************************
574
578
  Copyright (c) Microsoft Corporation.
@@ -584,7 +588,7 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
584
588
  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
585
589
  PERFORMANCE OF THIS SOFTWARE.
586
590
  ***************************************************************************** */
587
- var w=function(t,e){return(w=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,e)};function _(t,e){function r(){this.constructor=t}w(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}var M=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return _(e,t),Object.defineProperty(e.prototype,"name",{get:function(){return"BSONError"},enumerable:!1,configurable:!0}),e}(Error),S=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return _(e,t),Object.defineProperty(e.prototype,"name",{get:function(){return"BSONTypeError"},enumerable:!1,configurable:!0}),e}(TypeError);function O(t){return t&&t.Math==Math&&t}function A(){return O("object"===("undefined"==typeof globalThis?"undefined":n(globalThis))&&globalThis)||O("object"===("undefined"==typeof window?"undefined":n(window))&&window)||O("object"===("undefined"==typeof self?"undefined":n(self))&&self)||O("object"===(void 0===t?"undefined":n(t))&&t)||Function("return this")()}function E(t){return t.toString().replace("function(","function (")}var x=function(t){var e,r="object"===n((e=A()).navigator)&&"ReactNative"===e.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(r);for(var i=g.alloc(t),o=0;o<t;++o)i[o]=Math.floor(256*Math.random());return i},k=function(){if("undefined"!=typeof window){var e=window.crypto||window.msCrypto;if(e&&e.getRandomValues)return function(t){return e.getRandomValues(g.alloc(t))}}if(void 0!==t&&t.crypto&&t.crypto.getRandomValues)return function(e){return t.crypto.getRandomValues(g.alloc(e))};var n;try{n=r(190).randomBytes}catch(t){}return n||x}();function j(t){return["[object ArrayBuffer]","[object SharedArrayBuffer]"].includes(Object.prototype.toString.call(t))}function $(t){return"[object Uint8Array]"===Object.prototype.toString.call(t)}function R(t){return"[object BigInt64Array]"===Object.prototype.toString.call(t)}function P(t){return"[object BigUint64Array]"===Object.prototype.toString.call(t)}function B(t){return"[object RegExp]"===Object.prototype.toString.call(t)}function T(t){return I(t)&&"[object Date]"===Object.prototype.toString.call(t)}function I(t){return"object"===n(t)&&null!==t}function N(t,e){var r=!1;return function(){for(var n=[],i=0;i<arguments.length;i++)n[i]=arguments[i];return r||(console.warn(e),r=!0),t.apply(this,n)}}function D(t){if(ArrayBuffer.isView(t))return g.from(t.buffer,t.byteOffset,t.byteLength);if(j(t))return g.from(t);throw new S("Must use either Buffer or TypedArray")}var C=/^(?:[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,L=function(t){return"string"==typeof t&&C.test(t)},q=function(t){if(!L(t))throw new S('UUID string representations must be a 32 or 36 character hex string (dashes excluded/included). Format: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" or "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx".');var e=t.replace(/-/g,"");return g.from(e,"hex")},U=function(t,e){return void 0===e&&(e=!0),e?t.toString("hex",0,4)+"-"+t.toString("hex",4,6)+"-"+t.toString("hex",6,8)+"-"+t.toString("hex",8,10)+"-"+t.toString("hex",10,16):t.toString("hex")},F=Symbol("id"),z=function(){function t(e){if(void 0===e)this.id=t.generate();else if(e instanceof t)this[F]=g.from(e.id),this.__id=e.__id;else if(ArrayBuffer.isView(e)&&16===e.byteLength)this.id=D(e);else{if("string"!=typeof e)throw new S("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=q(e)}}return Object.defineProperty(t.prototype,"id",{get:function(){return this[F]},set:function(e){this[F]=e,t.cacheHexString&&(this.__id=U(e))},enumerable:!1,configurable:!0}),t.prototype.toHexString=function(e){if(void 0===e&&(e=!0),t.cacheHexString&&this.__id)return this.__id;var r=U(this.id,e);return t.cacheHexString&&(this.__id=r),r},t.prototype.toString=function(t){return t?this.id.toString(t):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(t){return!1}},t.prototype.toBinary=function(){return new V(this.id,V.SUBTYPE_UUID)},t.generate=function(){var t=k(16);return t[6]=15&t[6]|64,t[8]=63&t[8]|128,g.from(t)},t.isValid=function(e){if(!e)return!1;if(e instanceof t)return!0;if("string"==typeof e)return L(e);if($(e)){if(16!==e.length)return!1;try{return parseInt(e[6].toString(16)[0],10)===V.SUBTYPE_UUID}catch(t){return!1}}return!1},t.createFromHexString=function(e){return new t(q(e))},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){return'new UUID("'+this.toHexString()+'")'},t}();Object.defineProperty(z.prototype,"_bsontype",{value:"UUID"});var V=function(){function t(e,r){if(!(this instanceof t))return new t(e,r);if(!(null==e||"string"==typeof e||ArrayBuffer.isView(e)||e instanceof ArrayBuffer||Array.isArray(e)))throw new S("Binary can only be constructed from string, Buffer, TypedArray, or Array<number>");this.sub_type=null!=r?r:t.BSON_BINARY_SUBTYPE_DEFAULT,null==e?(this.buffer=g.alloc(t.BUFFER_SIZE),this.position=0):("string"==typeof e?this.buffer=g.from(e,"binary"):Array.isArray(e)?this.buffer=g.from(e):this.buffer=D(e),this.position=this.buffer.byteLength)}return t.prototype.put=function(e){if("string"==typeof e&&1!==e.length)throw new S("only accepts single character String");if("number"!=typeof e&&1!==e.length)throw new S("only accepts single character Uint8Array or Array");var r;if((r="string"==typeof e?e.charCodeAt(0):"number"==typeof e?e:e[0])<0||r>255)throw new S("only accepts number in a valid unsigned byte range 0-255");if(this.buffer.length>this.position)this.buffer[this.position++]=r;else{var n=g.alloc(t.BUFFER_SIZE+this.buffer.length);this.buffer.copy(n,0,0,this.buffer.length),this.buffer=n,this.buffer[this.position++]=r}},t.prototype.write=function(t,e){if(e="number"==typeof e?e:this.position,this.buffer.length<e+t.length){var r=g.alloc(this.buffer.length+t.length);this.buffer.copy(r,0,0,this.buffer.length),this.buffer=r}ArrayBuffer.isView(t)?(this.buffer.set(D(t),e),this.position=e+t.byteLength>this.position?e+t.length:this.position):"string"==typeof t&&(this.buffer.write(t,e,t.length,"binary"),this.position=e+t.length>this.position?e+t.length:this.position)},t.prototype.read=function(t,e){return e=e&&e>0?e:this.position,this.buffer.slice(t,t+e)},t.prototype.value=function(t){return(t=!!t)&&this.buffer.length===this.position?this.buffer:t?this.buffer.slice(0,this.position):this.buffer.toString("binary",0,this.position)},t.prototype.length=function(){return this.position},t.prototype.toJSON=function(){return this.buffer.toString("base64")},t.prototype.toString=function(t){return this.buffer.toString(t)},t.prototype.toExtendedJSON=function(t){t=t||{};var e=this.buffer.toString("base64"),r=Number(this.sub_type).toString(16);return t.legacy?{$binary:e,$type:1===r.length?"0"+r:r}:{$binary:{base64:e,subType:1===r.length?"0"+r:r}}},t.prototype.toUUID=function(){if(this.sub_type===t.SUBTYPE_UUID)return new z(this.buffer.slice(0,this.position));throw new M('Binary sub_type "'+this.sub_type+'" is not supported for converting to UUID. Only "'+t.SUBTYPE_UUID+'" is currently supported.')},t.fromExtendedJSON=function(e,r){var n,i;if(r=r||{},"$binary"in e?r.legacy&&"string"==typeof e.$binary&&"$type"in e?(i=e.$type?parseInt(e.$type,16):0,n=g.from(e.$binary,"base64")):"string"!=typeof e.$binary&&(i=e.$binary.subType?parseInt(e.$binary.subType,16):0,n=g.from(e.$binary.base64,"base64")):"$uuid"in e&&(i=4,n=q(e.$uuid)),!n)throw new S("Unexpected Binary Extended JSON format "+JSON.stringify(e));return new t(n,i)},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){return'new Binary(Buffer.from("'+this.value(!0).toString("hex")+'", "hex"), '+this.sub_type+")"},t.BSON_BINARY_SUBTYPE_DEFAULT=0,t.BUFFER_SIZE=256,t.SUBTYPE_DEFAULT=0,t.SUBTYPE_FUNCTION=1,t.SUBTYPE_BYTE_ARRAY=2,t.SUBTYPE_UUID_OLD=3,t.SUBTYPE_UUID=4,t.SUBTYPE_MD5=5,t.SUBTYPE_ENCRYPTED=6,t.SUBTYPE_COLUMN=7,t.SUBTYPE_USER_DEFINED=128,t}();Object.defineProperty(V.prototype,"_bsontype",{value:"Binary"});var K=function(){function t(e,r){if(!(this instanceof t))return new t(e,r);this.code=e,this.scope=r}return t.prototype.toJSON=function(){return{code:this.code,scope:this.scope}},t.prototype.toExtendedJSON=function(){return this.scope?{$code:this.code,$scope:this.scope}:{$code:this.code}},t.fromExtendedJSON=function(e){return new t(e.$code,e.$scope)},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){var t=this.toJSON();return'new Code("'+t.code+'"'+(t.scope?", "+JSON.stringify(t.scope):"")+")"},t}();function H(t){return I(t)&&null!=t.$id&&"string"==typeof t.$ref&&(null==t.$db||"string"==typeof t.$db)}Object.defineProperty(K.prototype,"_bsontype",{value:"Code"});var W=function(){function t(e,r,n,i){if(!(this instanceof t))return new t(e,r,n,i);var o=e.split(".");2===o.length&&(n=o.shift(),e=o.shift()),this.collection=e,this.oid=r,this.db=n,this.fields=i||{}}return Object.defineProperty(t.prototype,"namespace",{get:function(){return this.collection},set:function(t){this.collection=t},enumerable:!1,configurable:!0}),t.prototype.toJSON=function(){var t=Object.assign({$ref:this.collection,$id:this.oid},this.fields);return null!=this.db&&(t.$db=this.db),t},t.prototype.toExtendedJSON=function(t){t=t||{};var e={$ref:this.collection,$id:this.oid};return t.legacy?e:(this.db&&(e.$db=this.db),e=Object.assign(e,this.fields))},t.fromExtendedJSON=function(e){var r=Object.assign({},e);return delete r.$ref,delete r.$id,delete r.$db,new t(e.$ref,e.$id,e.$db,r)},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){var t=void 0===this.oid||void 0===this.oid.toString?this.oid:this.oid.toString();return'new DBRef("'+this.namespace+'", new ObjectId("'+t+'")'+(this.db?', "'+this.db+'"':"")+")"},t}();Object.defineProperty(W.prototype,"_bsontype",{value:"DBRef"});var Z=void 0;try{Z=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(t){}var J={},Y={},G=function(){function t(e,r,n){if(void 0===e&&(e=0),!(this instanceof t))return new t(e,r,n);"bigint"==typeof e?Object.assign(this,t.fromBigInt(e,!!r)):"string"==typeof e?Object.assign(this,t.fromString(e,!!r)):(this.low=0|e,this.high=0|r,this.unsigned=!!n),Object.defineProperty(this,"__isLong__",{value:!0,configurable:!1,writable:!1,enumerable:!1})}return t.fromBits=function(e,r,n){return new t(e,r,n)},t.fromInt=function(e,r){var n,i,o;return r?(o=0<=(e>>>=0)&&e<256)&&(i=Y[e])?i:(n=t.fromBits(e,(0|e)<0?-1:0,!0),o&&(Y[e]=n),n):(o=-128<=(e|=0)&&e<128)&&(i=J[e])?i:(n=t.fromBits(e,e<0?-1:0,!1),o&&(J[e]=n),n)},t.fromNumber=function(e,r){if(isNaN(e))return r?t.UZERO:t.ZERO;if(r){if(e<0)return t.UZERO;if(e>=0x10000000000000000)return t.MAX_UNSIGNED_VALUE}else{if(e<=-0x8000000000000000)return t.MIN_VALUE;if(e+1>=0x8000000000000000)return t.MAX_VALUE}return e<0?t.fromNumber(-e,r).neg():t.fromBits(e%4294967296|0,e/4294967296|0,r)},t.fromBigInt=function(e,r){return t.fromString(e.toString(),r)},t.fromString=function(e,r,n){if(0===e.length)throw Error("empty string");if("NaN"===e||"Infinity"===e||"+Infinity"===e||"-Infinity"===e)return t.ZERO;if("number"==typeof r?(n=r,r=!1):r=!!r,(n=n||10)<2||36<n)throw RangeError("radix");var i;if((i=e.indexOf("-"))>0)throw Error("interior hyphen");if(0===i)return t.fromString(e.substring(1),r,n).neg();for(var o=t.fromNumber(Math.pow(n,8)),s=t.ZERO,a=0;a<e.length;a+=8){var u=Math.min(8,e.length-a),h=parseInt(e.substring(a,a+u),n);if(u<8){var f=t.fromNumber(Math.pow(n,u));s=s.mul(f).add(t.fromNumber(h))}else s=(s=s.mul(o)).add(t.fromNumber(h))}return s.unsigned=r,s},t.fromBytes=function(e,r,n){return n?t.fromBytesLE(e,r):t.fromBytesBE(e,r)},t.fromBytesLE=function(e,r){return new t(e[0]|e[1]<<8|e[2]<<16|e[3]<<24,e[4]|e[5]<<8|e[6]<<16|e[7]<<24,r)},t.fromBytesBE=function(e,r){return new t(e[4]<<24|e[5]<<16|e[6]<<8|e[7],e[0]<<24|e[1]<<16|e[2]<<8|e[3],r)},t.isLong=function(t){return I(t)&&!0===t.__isLong__},t.fromValue=function(e,r){return"number"==typeof e?t.fromNumber(e,r):"string"==typeof e?t.fromString(e,r):t.fromBits(e.low,e.high,"boolean"==typeof r?r:e.unsigned)},t.prototype.add=function(e){t.isLong(e)||(e=t.fromValue(e));var r=this.high>>>16,n=65535&this.high,i=this.low>>>16,o=65535&this.low,s=e.high>>>16,a=65535&e.high,u=e.low>>>16,h=0,f=0,c=0,l=0;return c+=(l+=o+(65535&e.low))>>>16,l&=65535,f+=(c+=i+u)>>>16,c&=65535,h+=(f+=n+a)>>>16,f&=65535,h+=r+s,h&=65535,t.fromBits(c<<16|l,h<<16|f,this.unsigned)},t.prototype.and=function(e){return t.isLong(e)||(e=t.fromValue(e)),t.fromBits(this.low&e.low,this.high&e.high,this.unsigned)},t.prototype.compare=function(e){if(t.isLong(e)||(e=t.fromValue(e)),this.eq(e))return 0;var r=this.isNegative(),n=e.isNegative();return r&&!n?-1:!r&&n?1:this.unsigned?e.high>>>0>this.high>>>0||e.high===this.high&&e.low>>>0>this.low>>>0?-1:1:this.sub(e).isNegative()?-1:1},t.prototype.comp=function(t){return this.compare(t)},t.prototype.divide=function(e){if(t.isLong(e)||(e=t.fromValue(e)),e.isZero())throw Error("division by zero");if(Z){if(!this.unsigned&&-2147483648===this.high&&-1===e.low&&-1===e.high)return this;var r=(this.unsigned?Z.div_u:Z.div_s)(this.low,this.high,e.low,e.high);return t.fromBits(r,Z.get_high(),this.unsigned)}if(this.isZero())return this.unsigned?t.UZERO:t.ZERO;var n,i,o;if(this.unsigned){if(e.unsigned||(e=e.toUnsigned()),e.gt(this))return t.UZERO;if(e.gt(this.shru(1)))return t.UONE;o=t.UZERO}else{if(this.eq(t.MIN_VALUE))return e.eq(t.ONE)||e.eq(t.NEG_ONE)?t.MIN_VALUE:e.eq(t.MIN_VALUE)?t.ONE:(n=this.shr(1).div(e).shl(1)).eq(t.ZERO)?e.isNegative()?t.ONE:t.NEG_ONE:(i=this.sub(e.mul(n)),o=n.add(i.div(e)));if(e.eq(t.MIN_VALUE))return this.unsigned?t.UZERO:t.ZERO;if(this.isNegative())return e.isNegative()?this.neg().div(e.neg()):this.neg().div(e).neg();if(e.isNegative())return this.div(e.neg()).neg();o=t.ZERO}for(i=this;i.gte(e);){n=Math.max(1,Math.floor(i.toNumber()/e.toNumber()));for(var s=Math.ceil(Math.log(n)/Math.LN2),a=s<=48?1:Math.pow(2,s-48),u=t.fromNumber(n),h=u.mul(e);h.isNegative()||h.gt(i);)n-=a,h=(u=t.fromNumber(n,this.unsigned)).mul(e);u.isZero()&&(u=t.ONE),o=o.add(u),i=i.sub(h)}return o},t.prototype.div=function(t){return this.divide(t)},t.prototype.equals=function(e){return t.isLong(e)||(e=t.fromValue(e)),(this.unsigned===e.unsigned||this.high>>>31!=1||e.high>>>31!=1)&&(this.high===e.high&&this.low===e.low)},t.prototype.eq=function(t){return this.equals(t)},t.prototype.getHighBits=function(){return this.high},t.prototype.getHighBitsUnsigned=function(){return this.high>>>0},t.prototype.getLowBits=function(){return this.low},t.prototype.getLowBitsUnsigned=function(){return this.low>>>0},t.prototype.getNumBitsAbs=function(){if(this.isNegative())return this.eq(t.MIN_VALUE)?64:this.neg().getNumBitsAbs();var e,r=0!==this.high?this.high:this.low;for(e=31;e>0&&0==(r&1<<e);e--);return 0!==this.high?e+33:e+1},t.prototype.greaterThan=function(t){return this.comp(t)>0},t.prototype.gt=function(t){return this.greaterThan(t)},t.prototype.greaterThanOrEqual=function(t){return this.comp(t)>=0},t.prototype.gte=function(t){return this.greaterThanOrEqual(t)},t.prototype.ge=function(t){return this.greaterThanOrEqual(t)},t.prototype.isEven=function(){return 0==(1&this.low)},t.prototype.isNegative=function(){return!this.unsigned&&this.high<0},t.prototype.isOdd=function(){return 1==(1&this.low)},t.prototype.isPositive=function(){return this.unsigned||this.high>=0},t.prototype.isZero=function(){return 0===this.high&&0===this.low},t.prototype.lessThan=function(t){return this.comp(t)<0},t.prototype.lt=function(t){return this.lessThan(t)},t.prototype.lessThanOrEqual=function(t){return this.comp(t)<=0},t.prototype.lte=function(t){return this.lessThanOrEqual(t)},t.prototype.modulo=function(e){if(t.isLong(e)||(e=t.fromValue(e)),Z){var r=(this.unsigned?Z.rem_u:Z.rem_s)(this.low,this.high,e.low,e.high);return t.fromBits(r,Z.get_high(),this.unsigned)}return this.sub(this.div(e).mul(e))},t.prototype.mod=function(t){return this.modulo(t)},t.prototype.rem=function(t){return this.modulo(t)},t.prototype.multiply=function(e){if(this.isZero())return t.ZERO;if(t.isLong(e)||(e=t.fromValue(e)),Z){var r=Z.mul(this.low,this.high,e.low,e.high);return t.fromBits(r,Z.get_high(),this.unsigned)}if(e.isZero())return t.ZERO;if(this.eq(t.MIN_VALUE))return e.isOdd()?t.MIN_VALUE:t.ZERO;if(e.eq(t.MIN_VALUE))return this.isOdd()?t.MIN_VALUE:t.ZERO;if(this.isNegative())return e.isNegative()?this.neg().mul(e.neg()):this.neg().mul(e).neg();if(e.isNegative())return this.mul(e.neg()).neg();if(this.lt(t.TWO_PWR_24)&&e.lt(t.TWO_PWR_24))return t.fromNumber(this.toNumber()*e.toNumber(),this.unsigned);var n=this.high>>>16,i=65535&this.high,o=this.low>>>16,s=65535&this.low,a=e.high>>>16,u=65535&e.high,h=e.low>>>16,f=65535&e.low,c=0,l=0,d=0,p=0;return d+=(p+=s*f)>>>16,p&=65535,l+=(d+=o*f)>>>16,d&=65535,l+=(d+=s*h)>>>16,d&=65535,c+=(l+=i*f)>>>16,l&=65535,c+=(l+=o*h)>>>16,l&=65535,c+=(l+=s*u)>>>16,l&=65535,c+=n*f+i*h+o*u+s*a,c&=65535,t.fromBits(d<<16|p,c<<16|l,this.unsigned)},t.prototype.mul=function(t){return this.multiply(t)},t.prototype.negate=function(){return!this.unsigned&&this.eq(t.MIN_VALUE)?t.MIN_VALUE:this.not().add(t.ONE)},t.prototype.neg=function(){return this.negate()},t.prototype.not=function(){return t.fromBits(~this.low,~this.high,this.unsigned)},t.prototype.notEquals=function(t){return!this.equals(t)},t.prototype.neq=function(t){return this.notEquals(t)},t.prototype.ne=function(t){return this.notEquals(t)},t.prototype.or=function(e){return t.isLong(e)||(e=t.fromValue(e)),t.fromBits(this.low|e.low,this.high|e.high,this.unsigned)},t.prototype.shiftLeft=function(e){return t.isLong(e)&&(e=e.toInt()),0==(e&=63)?this:e<32?t.fromBits(this.low<<e,this.high<<e|this.low>>>32-e,this.unsigned):t.fromBits(0,this.low<<e-32,this.unsigned)},t.prototype.shl=function(t){return this.shiftLeft(t)},t.prototype.shiftRight=function(e){return t.isLong(e)&&(e=e.toInt()),0==(e&=63)?this:e<32?t.fromBits(this.low>>>e|this.high<<32-e,this.high>>e,this.unsigned):t.fromBits(this.high>>e-32,this.high>=0?0:-1,this.unsigned)},t.prototype.shr=function(t){return this.shiftRight(t)},t.prototype.shiftRightUnsigned=function(e){if(t.isLong(e)&&(e=e.toInt()),0===(e&=63))return this;var r=this.high;if(e<32){var n=this.low;return t.fromBits(n>>>e|r<<32-e,r>>>e,this.unsigned)}return 32===e?t.fromBits(r,0,this.unsigned):t.fromBits(r>>>e-32,0,this.unsigned)},t.prototype.shr_u=function(t){return this.shiftRightUnsigned(t)},t.prototype.shru=function(t){return this.shiftRightUnsigned(t)},t.prototype.subtract=function(e){return t.isLong(e)||(e=t.fromValue(e)),this.add(e.neg())},t.prototype.sub=function(t){return this.subtract(t)},t.prototype.toInt=function(){return this.unsigned?this.low>>>0:this.low},t.prototype.toNumber=function(){return this.unsigned?4294967296*(this.high>>>0)+(this.low>>>0):4294967296*this.high+(this.low>>>0)},t.prototype.toBigInt=function(){return BigInt(this.toString())},t.prototype.toBytes=function(t){return t?this.toBytesLE():this.toBytesBE()},t.prototype.toBytesLE=function(){var t=this.high,e=this.low;return[255&e,e>>>8&255,e>>>16&255,e>>>24,255&t,t>>>8&255,t>>>16&255,t>>>24]},t.prototype.toBytesBE=function(){var t=this.high,e=this.low;return[t>>>24,t>>>16&255,t>>>8&255,255&t,e>>>24,e>>>16&255,e>>>8&255,255&e]},t.prototype.toSigned=function(){return this.unsigned?t.fromBits(this.low,this.high,!1):this},t.prototype.toString=function(e){if((e=e||10)<2||36<e)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative()){if(this.eq(t.MIN_VALUE)){var r=t.fromNumber(e),n=this.div(r),i=n.mul(r).sub(this);return n.toString(e)+i.toInt().toString(e)}return"-"+this.neg().toString(e)}for(var o=t.fromNumber(Math.pow(e,6),this.unsigned),s=this,a="";;){var u=s.div(o),h=(s.sub(u.mul(o)).toInt()>>>0).toString(e);if((s=u).isZero())return h+a;for(;h.length<6;)h="0"+h;a=""+h+a}},t.prototype.toUnsigned=function(){return this.unsigned?this:t.fromBits(this.low,this.high,!0)},t.prototype.xor=function(e){return t.isLong(e)||(e=t.fromValue(e)),t.fromBits(this.low^e.low,this.high^e.high,this.unsigned)},t.prototype.eqz=function(){return this.isZero()},t.prototype.le=function(t){return this.lessThanOrEqual(t)},t.prototype.toExtendedJSON=function(t){return t&&t.relaxed?this.toNumber():{$numberLong:this.toString()}},t.fromExtendedJSON=function(e,r){var n=t.fromString(e.$numberLong);return r&&r.relaxed?n.toNumber():n},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){return'new Long("'+this.toString()+'"'+(this.unsigned?", true":"")+")"},t.TWO_PWR_24=t.fromInt(1<<24),t.MAX_UNSIGNED_VALUE=t.fromBits(-1,-1,!0),t.ZERO=t.fromInt(0),t.UZERO=t.fromInt(0,!0),t.ONE=t.fromInt(1),t.UONE=t.fromInt(1,!0),t.NEG_ONE=t.fromInt(-1),t.MAX_VALUE=t.fromBits(-1,2147483647,!1),t.MIN_VALUE=t.fromBits(0,-2147483648,!1),t}();Object.defineProperty(G.prototype,"__isLong__",{value:!0}),Object.defineProperty(G.prototype,"_bsontype",{value:"Long"});var Q=/^(\+|-)?(\d+|(\d*\.\d*))?(E|e)?([-+])?(\d+)?$/,X=/^(\+|-)?(Infinity|inf)$/i,tt=/^(\+|-)?NaN$/i,et=[124,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0].reverse(),rt=[248,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0].reverse(),nt=[120,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0].reverse(),it=/^([-+])?(\d+)?$/;function ot(t){return!isNaN(parseInt(t,10))}function st(t){var e=G.fromNumber(1e9),r=G.fromNumber(0);if(!(t.parts[0]||t.parts[1]||t.parts[2]||t.parts[3]))return{quotient:t,rem:r};for(var n=0;n<=3;n++)r=(r=r.shiftLeft(32)).add(new G(t.parts[n],0)),t.parts[n]=r.div(e).low,r=r.modulo(e);return{quotient:t,rem:r}}function at(t,e){throw new S('"'+t+'" is not a valid Decimal128 string - '+e)}var ut=function(){function t(e){if(!(this instanceof t))return new t(e);this.bytes="string"==typeof e?t.fromString(e).bytes:e}return t.fromString=function(e){var r,n=!1,i=!1,o=!1,s=0,a=0,u=0,h=0,f=0,c=[0],l=0,d=0,p=0,m=0,y=0,b=0,v=new G(0,0),w=new G(0,0),_=0;if(e.length>=7e3)throw new S(e+" not a valid Decimal128 string");var M=e.match(Q),O=e.match(X),A=e.match(tt);if(!M&&!O&&!A||0===e.length)throw new S(e+" not a valid Decimal128 string");if(M){var E=M[2],x=M[4],k=M[5],j=M[6];x&&void 0===j&&at(e,"missing exponent power"),x&&void 0===E&&at(e,"missing exponent base"),void 0===x&&(k||j)&&at(e,"missing e before exponent")}if("+"!==e[_]&&"-"!==e[_]||(n="-"===e[_++]),!ot(e[_])&&"."!==e[_]){if("i"===e[_]||"I"===e[_])return new t(g.from(n?rt:nt));if("N"===e[_])return new t(g.from(et))}for(;ot(e[_])||"."===e[_];)"."!==e[_]?(l<34&&("0"!==e[_]||o)&&(o||(f=a),o=!0,c[d++]=parseInt(e[_],10),l+=1),o&&(u+=1),i&&(h+=1),a+=1,_+=1):(i&&at(e,"contains multiple periods"),i=!0,_+=1);if(i&&!a)throw new S(e+" not a valid Decimal128 string");if("e"===e[_]||"E"===e[_]){var $=e.substr(++_).match(it);if(!$||!$[2])return new t(g.from(et));y=parseInt($[0],10),_+=$[0].length}if(e[_])return new t(g.from(et));if(p=0,l){if(m=l-1,1!==(s=u))for(;0===c[f+s-1];)s-=1}else p=0,m=0,c[0]=0,u=1,l=1,s=0;for(y<=h&&h-y>16384?y=-6176:y-=h;y>6111;){if((m+=1)-p>34){if(c.join("").match(/^0+$/)){y=6111;break}at(e,"overflow")}y-=1}for(;y<-6176||l<u;){if(0===m&&s<l){y=-6176,s=0;break}if(l<u?u-=1:m-=1,y<6111)y+=1;else{if(c.join("").match(/^0+$/)){y=6111;break}at(e,"overflow")}}if(m-p+1<s){var R=a;i&&(f+=1,R+=1),n&&(f+=1,R+=1);var P=parseInt(e[f+m+1],10),B=0;if(P>=5&&(B=1,5===P))for(B=c[m]%2==1?1:0,b=f+m+2;b<R;b++)if(parseInt(e[b],10)){B=1;break}if(B)for(var T=m;T>=0;T--)if(++c[T]>9&&(c[T]=0,0===T)){if(!(y<6111))return new t(g.from(n?rt:nt));y+=1,c[T]=1}}if(v=G.fromNumber(0),w=G.fromNumber(0),0===s)v=G.fromNumber(0),w=G.fromNumber(0);else if(m-p<17){T=p;for(w=G.fromNumber(c[T++]),v=new G(0,0);T<=m;T++)w=(w=w.multiply(G.fromNumber(10))).add(G.fromNumber(c[T]))}else{T=p;for(v=G.fromNumber(c[T++]);T<=m-17;T++)v=(v=v.multiply(G.fromNumber(10))).add(G.fromNumber(c[T]));for(w=G.fromNumber(c[T++]);T<=m;T++)w=(w=w.multiply(G.fromNumber(10))).add(G.fromNumber(c[T]))}var I,N,D,C,L=function(t,e){if(!t&&!e)return{high:G.fromNumber(0),low:G.fromNumber(0)};var r=t.shiftRightUnsigned(32),n=new G(t.getLowBits(),0),i=e.shiftRightUnsigned(32),o=new G(e.getLowBits(),0),s=r.multiply(i),a=r.multiply(o),u=n.multiply(i),h=n.multiply(o);return s=s.add(a.shiftRightUnsigned(32)),a=new G(a.getLowBits(),0).add(u).add(h.shiftRightUnsigned(32)),{high:s=s.add(a.shiftRightUnsigned(32)),low:h=a.shiftLeft(32).add(new G(h.getLowBits(),0))}}(v,G.fromString("100000000000000000"));L.low=L.low.add(w),I=L.low,N=w,D=I.high>>>0,C=N.high>>>0,(D<C||D===C&&I.low>>>0<N.low>>>0)&&(L.high=L.high.add(G.fromNumber(1))),r=y+6176;var q={low:G.fromNumber(0),high:G.fromNumber(0)};L.high.shiftRightUnsigned(49).and(G.fromNumber(1)).equals(G.fromNumber(1))?(q.high=q.high.or(G.fromNumber(3).shiftLeft(61)),q.high=q.high.or(G.fromNumber(r).and(G.fromNumber(16383).shiftLeft(47))),q.high=q.high.or(L.high.and(G.fromNumber(0x7fffffffffff)))):(q.high=q.high.or(G.fromNumber(16383&r).shiftLeft(49)),q.high=q.high.or(L.high.and(G.fromNumber(562949953421311)))),q.low=L.low,n&&(q.high=q.high.or(G.fromString("9223372036854775808")));var U=g.alloc(16);return _=0,U[_++]=255&q.low.low,U[_++]=q.low.low>>8&255,U[_++]=q.low.low>>16&255,U[_++]=q.low.low>>24&255,U[_++]=255&q.low.high,U[_++]=q.low.high>>8&255,U[_++]=q.low.high>>16&255,U[_++]=q.low.high>>24&255,U[_++]=255&q.high.low,U[_++]=q.high.low>>8&255,U[_++]=q.high.low>>16&255,U[_++]=q.high.low>>24&255,U[_++]=255&q.high.high,U[_++]=q.high.high>>8&255,U[_++]=q.high.high>>16&255,U[_++]=q.high.high>>24&255,new t(U)},t.prototype.toString=function(){for(var t,e=0,r=new Array(36),n=0;n<r.length;n++)r[n]=0;var i,o,s,a=0,u=!1,h={parts:[0,0,0,0]},f=[];a=0;var c=this.bytes,l=c[a++]|c[a++]<<8|c[a++]<<16|c[a++]<<24,d=c[a++]|c[a++]<<8|c[a++]<<16|c[a++]<<24,p=c[a++]|c[a++]<<8|c[a++]<<16|c[a++]<<24,m=c[a++]|c[a++]<<8|c[a++]<<16|c[a++]<<24;a=0,{low:new G(l,d),high:new G(p,m)}.high.lessThan(G.ZERO)&&f.push("-");var y=m>>26&31;if(y>>3==3){if(30===y)return f.join("")+"Infinity";if(31===y)return"NaN";t=m>>15&16383,i=8+(m>>14&1)}else i=m>>14&7,t=m>>17&16383;var b=t-6176;if(h.parts[0]=(16383&m)+((15&i)<<14),h.parts[1]=p,h.parts[2]=d,h.parts[3]=l,0===h.parts[0]&&0===h.parts[1]&&0===h.parts[2]&&0===h.parts[3])u=!0;else for(s=3;s>=0;s--){var v=0,g=st(h);if(h=g.quotient,v=g.rem.low)for(o=8;o>=0;o--)r[9*s+o]=v%10,v=Math.floor(v/10)}if(u)e=1,r[a]=0;else for(e=36;!r[a];)e-=1,a+=1;var w=e-1+b;if(w>=34||w<=-7||b>0){if(e>34)return f.push("0"),b>0?f.push("E+"+b):b<0&&f.push("E"+b),f.join("");f.push(""+r[a++]),(e-=1)&&f.push(".");for(n=0;n<e;n++)f.push(""+r[a++]);f.push("E"),w>0?f.push("+"+w):f.push(""+w)}else if(b>=0)for(n=0;n<e;n++)f.push(""+r[a++]);else{var _=e+b;if(_>0)for(n=0;n<_;n++)f.push(""+r[a++]);else f.push("0");for(f.push(".");_++<0;)f.push("0");for(n=0;n<e-Math.max(_-1,0);n++)f.push(""+r[a++])}return f.join("")},t.prototype.toJSON=function(){return{$numberDecimal:this.toString()}},t.prototype.toExtendedJSON=function(){return{$numberDecimal:this.toString()}},t.fromExtendedJSON=function(e){return t.fromString(e.$numberDecimal)},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){return'new Decimal128("'+this.toString()+'")'},t}();Object.defineProperty(ut.prototype,"_bsontype",{value:"Decimal128"});var ht=function(){function t(e){if(!(this instanceof t))return new t(e);e instanceof Number&&(e=e.valueOf()),this.value=+e}return t.prototype.valueOf=function(){return this.value},t.prototype.toJSON=function(){return this.value},t.prototype.toString=function(t){return this.value.toString(t)},t.prototype.toExtendedJSON=function(t){return t&&(t.legacy||t.relaxed&&isFinite(this.value))?this.value:Object.is(Math.sign(this.value),-0)?{$numberDouble:"-"+this.value.toFixed(1)}:(Number.isInteger(this.value)?(e=this.value.toFixed(1)).length>=13&&(e=this.value.toExponential(13).toUpperCase()):e=this.value.toString(),{$numberDouble:e});var e},t.fromExtendedJSON=function(e,r){var n=parseFloat(e.$numberDouble);return r&&r.relaxed?n:new t(n)},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){return"new Double("+this.toExtendedJSON().$numberDouble+")"},t}();Object.defineProperty(ht.prototype,"_bsontype",{value:"Double"});var ft=function(){function t(e){if(!(this instanceof t))return new t(e);e instanceof Number&&(e=e.valueOf()),this.value=0|+e}return t.prototype.valueOf=function(){return this.value},t.prototype.toString=function(t){return this.value.toString(t)},t.prototype.toJSON=function(){return this.value},t.prototype.toExtendedJSON=function(t){return t&&(t.relaxed||t.legacy)?this.value:{$numberInt:this.value.toString()}},t.fromExtendedJSON=function(e,r){return r&&r.relaxed?parseInt(e.$numberInt,10):new t(e.$numberInt)},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){return"new Int32("+this.valueOf()+")"},t}();Object.defineProperty(ft.prototype,"_bsontype",{value:"Int32"});var ct=function(){function t(){if(!(this instanceof t))return new t}return t.prototype.toExtendedJSON=function(){return{$maxKey:1}},t.fromExtendedJSON=function(){return new t},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){return"new MaxKey()"},t}();Object.defineProperty(ct.prototype,"_bsontype",{value:"MaxKey"});var lt=function(){function t(){if(!(this instanceof t))return new t}return t.prototype.toExtendedJSON=function(){return{$minKey:1}},t.fromExtendedJSON=function(){return new t},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){return"new MinKey()"},t}();Object.defineProperty(lt.prototype,"_bsontype",{value:"MinKey"});var dt=new RegExp("^[0-9a-fA-F]{24}$"),pt=null,mt=Symbol("id"),yt=function(){function t(e){if(!(this instanceof t))return new t(e);var r;if("object"===n(e)&&e&&"id"in e){if("string"!=typeof e.id&&!ArrayBuffer.isView(e.id))throw new S("Argument passed in must have an id that is of type string or Buffer");r="toHexString"in e&&"function"==typeof e.toHexString?g.from(e.toHexString(),"hex"):e.id}else r=e;if(null==r||"number"==typeof r)this[mt]=t.generate("number"==typeof r?r:void 0);else if(ArrayBuffer.isView(r)&&12===r.byteLength)this[mt]=D(r);else{if("string"!=typeof r)throw new S("Argument passed in does not match the accepted types");if(12===r.length){var i=g.from(r);if(12!==i.byteLength)throw new S("Argument passed in must be a string of 12 bytes");this[mt]=i}else{if(24!==r.length||!dt.test(r))throw new S("Argument passed in must be a string of 12 bytes or a string of 24 hex characters");this[mt]=g.from(r,"hex")}}t.cacheHexString&&(this.__id=this.id.toString("hex"))}return Object.defineProperty(t.prototype,"id",{get:function(){return this[mt]},set:function(e){this[mt]=e,t.cacheHexString&&(this.__id=e.toString("hex"))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"generationTime",{get:function(){return this.id.readInt32BE(0)},set:function(t){this.id.writeUInt32BE(t,0)},enumerable:!1,configurable:!0}),t.prototype.toHexString=function(){if(t.cacheHexString&&this.__id)return this.__id;var e=this.id.toString("hex");return t.cacheHexString&&!this.__id&&(this.__id=e),e},t.getInc=function(){return t.index=(t.index+1)%16777215},t.generate=function(e){"number"!=typeof e&&(e=Math.floor(Date.now()/1e3));var r=t.getInc(),n=g.alloc(12);return n.writeUInt32BE(e,0),null===pt&&(pt=k(5)),n[4]=pt[0],n[5]=pt[1],n[6]=pt[2],n[7]=pt[3],n[8]=pt[4],n[11]=255&r,n[10]=r>>8&255,n[9]=r>>16&255,n},t.prototype.toString=function(t){return t?this.id.toString(t):this.toHexString()},t.prototype.toJSON=function(){return this.toHexString()},t.prototype.equals=function(e){return null!=e&&(e instanceof t?this.toString()===e.toString():"string"==typeof e&&t.isValid(e)&&12===e.length&&$(this.id)?e===g.prototype.toString.call(this.id,"latin1"):"string"==typeof e&&t.isValid(e)&&24===e.length?e.toLowerCase()===this.toHexString():"string"==typeof e&&t.isValid(e)&&12===e.length?g.from(e).equals(this.id):"object"===n(e)&&"toHexString"in e&&"function"==typeof e.toHexString&&e.toHexString()===this.toHexString())},t.prototype.getTimestamp=function(){var t=new Date,e=this.id.readUInt32BE(0);return t.setTime(1e3*Math.floor(e)),t},t.createPk=function(){return new t},t.createFromTime=function(e){var r=g.from([0,0,0,0,0,0,0,0,0,0,0,0]);return r.writeUInt32BE(e,0),new t(r)},t.createFromHexString=function(e){if(void 0===e||null!=e&&24!==e.length)throw new S("Argument passed in must be a single String of 12 bytes or a string of 24 hex characters");return new t(g.from(e,"hex"))},t.isValid=function(e){return null!=e&&("number"==typeof e||("string"==typeof e?12===e.length||24===e.length&&dt.test(e):e instanceof t||(!(!$(e)||12!==e.length)||"object"===n(e)&&"toHexString"in e&&"function"==typeof e.toHexString&&("string"==typeof e.id?12===e.id.length:24===e.toHexString().length&&dt.test(e.id.toString("hex"))))))},t.prototype.toExtendedJSON=function(){return this.toHexString?{$oid:this.toHexString()}:{$oid:this.toString("hex")}},t.fromExtendedJSON=function(e){return new t(e.$oid)},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){return'new ObjectId("'+this.toHexString()+'")'},t.index=Math.floor(16777215*Math.random()),t}();Object.defineProperty(yt.prototype,"generate",{value:N((function(t){return yt.generate(t)}),"Please use the static `ObjectId.generate(time)` instead")}),Object.defineProperty(yt.prototype,"getInc",{value:N((function(){return yt.getInc()}),"Please use the static `ObjectId.getInc()` instead")}),Object.defineProperty(yt.prototype,"get_inc",{value:N((function(){return yt.getInc()}),"Please use the static `ObjectId.getInc()` instead")}),Object.defineProperty(yt,"get_inc",{value:N((function(){return yt.getInc()}),"Please use the static `ObjectId.getInc()` instead")}),Object.defineProperty(yt.prototype,"_bsontype",{value:"ObjectID"});var bt=function(){function t(e,r){if(!(this instanceof t))return new t(e,r);if(this.pattern=e,this.options=(null!=r?r:"").split("").sort().join(""),-1!==this.pattern.indexOf("\0"))throw new M("BSON Regex patterns cannot contain null bytes, found: "+JSON.stringify(this.pattern));if(-1!==this.options.indexOf("\0"))throw new M("BSON Regex options cannot contain null bytes, found: "+JSON.stringify(this.options));for(var n=0;n<this.options.length;n++)if("i"!==this.options[n]&&"m"!==this.options[n]&&"x"!==this.options[n]&&"l"!==this.options[n]&&"s"!==this.options[n]&&"u"!==this.options[n])throw new M("The regular expression option ["+this.options[n]+"] is not supported")}return t.parseOptions=function(t){return t?t.split("").sort().join(""):""},t.prototype.toExtendedJSON=function(t){return(t=t||{}).legacy?{$regex:this.pattern,$options:this.options}:{$regularExpression:{pattern:this.pattern,options:this.options}}},t.fromExtendedJSON=function(e){if("$regex"in e){if("string"==typeof e.$regex)return new t(e.$regex,t.parseOptions(e.$options));if("BSONRegExp"===e.$regex._bsontype)return e}if("$regularExpression"in e)return new t(e.$regularExpression.pattern,t.parseOptions(e.$regularExpression.options));throw new S("Unexpected BSONRegExp EJSON object form: "+JSON.stringify(e))},t}();Object.defineProperty(bt.prototype,"_bsontype",{value:"BSONRegExp"});var vt=function(){function t(e){if(!(this instanceof t))return new t(e);this.value=e}return t.prototype.valueOf=function(){return this.value},t.prototype.toString=function(){return this.value},t.prototype.inspect=function(){return'new BSONSymbol("'+this.value+'")'},t.prototype.toJSON=function(){return this.value},t.prototype.toExtendedJSON=function(){return{$symbol:this.value}},t.fromExtendedJSON=function(e){return new t(e.$symbol)},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t}();Object.defineProperty(vt.prototype,"_bsontype",{value:"Symbol"});var gt=G,wt=function(t){function e(r,n){var i=this;return i instanceof e?(i=G.isLong(r)?t.call(this,r.low,r.high,!0)||this:I(r)&&void 0!==r.t&&void 0!==r.i?t.call(this,r.i,r.t,!0)||this:t.call(this,r,n,!0)||this,Object.defineProperty(i,"_bsontype",{value:"Timestamp",writable:!1,configurable:!1,enumerable:!1}),i):new e(r,n)}return _(e,t),e.prototype.toJSON=function(){return{$timestamp:this.toString()}},e.fromInt=function(t){return new e(G.fromInt(t,!0))},e.fromNumber=function(t){return new e(G.fromNumber(t,!0))},e.fromBits=function(t,r){return new e(t,r)},e.fromString=function(t,r){return new e(G.fromString(t,!0,r))},e.prototype.toExtendedJSON=function(){return{$timestamp:{t:this.high>>>0,i:this.low>>>0}}},e.fromExtendedJSON=function(t){return new e(t.$timestamp)},e.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},e.prototype.inspect=function(){return"new Timestamp({ t: "+this.getHighBits()+", i: "+this.getLowBits()+" })"},e.MAX_VALUE=G.MAX_UNSIGNED_VALUE,e}(gt);function _t(t){return I(t)&&Reflect.has(t,"_bsontype")&&"string"==typeof t._bsontype}var Mt={$oid:yt,$binary:V,$uuid:V,$symbol:vt,$numberInt:ft,$numberDecimal:ut,$numberDouble:ht,$numberLong:G,$minKey:lt,$maxKey:ct,$regex:bt,$regularExpression:bt,$timestamp:wt};function St(t){var e=t.toISOString();return 0!==t.getUTCMilliseconds()?e:e.slice(0,-5)+"Z"}function Ot(t,e){if(("object"===n(t)||"function"==typeof t)&&null!==t){var r=e.seenObjects.findIndex((function(e){return e.obj===t}));if(-1!==r){var i=e.seenObjects.map((function(t){return t.propertyName})),o=i.slice(0,r).map((function(t){return t+" -> "})).join(""),s=i[r],a=" -> "+i.slice(r+1,i.length-1).map((function(t){return t+" -> "})).join(""),u=i[i.length-1],h=" ".repeat(o.length+s.length/2),f="-".repeat(a.length+(s.length+u.length)/2-1);throw new S("Converting circular structure to EJSON:\n "+o+s+a+u+"\n "+h+"\\"+f+"/")}e.seenObjects[e.seenObjects.length-1].obj=t}if(Array.isArray(t))return function(t,e){return t.map((function(t,r){e.seenObjects.push({propertyName:"index "+r,obj:null});try{return Ot(t,e)}finally{e.seenObjects.pop()}}))}(t,e);if(void 0===t)return null;if(t instanceof Date||T(t)){var c=t.getTime(),l=c>-1&&c<2534023188e5;return e.legacy?e.relaxed&&l?{$date:t.getTime()}:{$date:St(t)}:e.relaxed&&l?{$date:St(t)}:{$date:{$numberLong:t.getTime().toString()}}}if(!("number"!=typeof t||e.relaxed&&isFinite(t))){if(Math.floor(t)===t){var d=t>=-0x8000000000000000&&t<=0x8000000000000000;if(t>=-2147483648&&t<=2147483647)return{$numberInt:t.toString()};if(d)return{$numberLong:t.toString()}}return{$numberDouble:t.toString()}}if(t instanceof RegExp||B(t)){var p=t.flags;if(void 0===p){var m=t.toString().match(/[gimuy]*$/);m&&(p=m[0])}return new bt(t.source,p).toExtendedJSON(e)}return null!=t&&"object"===n(t)?function(t,e){if(null==t||"object"!==n(t))throw new M("not an object instance");var r=t._bsontype;if(void 0===r){var i={};for(var o in t){e.seenObjects.push({propertyName:o,obj:null});try{i[o]=Ot(t[o],e)}finally{e.seenObjects.pop()}}return i}if(_t(t)){var s=t;if("function"!=typeof s.toExtendedJSON){var a=xt[t._bsontype];if(!a)throw new S("Unrecognized or invalid _bsontype: "+t._bsontype);s=a(s)}return"Code"===r&&s.scope?s=new K(s.code,Ot(s.scope,e)):"DBRef"===r&&s.oid&&(s=new W(Ot(s.collection,e),Ot(s.oid,e),Ot(s.db,e),Ot(s.fields,e))),s.toExtendedJSON(e)}throw new M("_bsontype must be a string, but was: "+n(r))}(t,e):t}var At,Et,xt={Binary:function(t){return new V(t.value(),t.sub_type)},Code:function(t){return new K(t.code,t.scope)},DBRef:function(t){return new W(t.collection||t.namespace,t.oid,t.db,t.fields)},Decimal128:function(t){return new ut(t.bytes)},Double:function(t){return new ht(t.value)},Int32:function(t){return new ft(t.value)},Long:function(t){return G.fromBits(null!=t.low?t.low:t.low_,null!=t.low?t.high:t.high_,null!=t.low?t.unsigned:t.unsigned_)},MaxKey:function(){return new ct},MinKey:function(){return new lt},ObjectID:function(t){return new yt(t)},ObjectId:function(t){return new yt(t)},BSONRegExp:function(t){return new bt(t.pattern,t.options)},Symbol:function(t){return new vt(t.value)},Timestamp:function(t){return wt.fromBits(t.low,t.high)}};!function(t){function e(t,e){var r=Object.assign({},{relaxed:!0,legacy:!1},e);return"boolean"==typeof r.relaxed&&(r.strict=!r.relaxed),"boolean"==typeof r.strict&&(r.relaxed=!r.strict),JSON.parse(t,(function(t,e){if(-1!==t.indexOf("\0"))throw new M("BSON Document field names cannot contain null bytes, found: "+JSON.stringify(t));return function t(e,r){if(void 0===r&&(r={}),"number"==typeof e){if(r.relaxed||r.legacy)return e;if(Math.floor(e)===e){if(e>=-2147483648&&e<=2147483647)return new ft(e);if(e>=-0x8000000000000000&&e<=0x8000000000000000)return G.fromNumber(e)}return new ht(e)}if(null==e||"object"!==n(e))return e;if(e.$undefined)return null;for(var i=Object.keys(e).filter((function(t){return t.startsWith("$")&&null!=e[t]})),o=0;o<i.length;o++){var s=Mt[i[o]];if(s)return s.fromExtendedJSON(e,r)}if(null!=e.$date){var a=e.$date,u=new Date;return r.legacy?"number"==typeof a?u.setTime(a):"string"==typeof a&&u.setTime(Date.parse(a)):"string"==typeof a?u.setTime(Date.parse(a)):G.isLong(a)?u.setTime(a.toNumber()):"number"==typeof a&&r.relaxed&&u.setTime(a),u}if(null!=e.$code){var h=Object.assign({},e);return e.$scope&&(h.$scope=t(e.$scope)),K.fromExtendedJSON(e)}if(H(e)||e.$dbPointer){var f=e.$ref?e:e.$dbPointer;if(f instanceof W)return f;var c=Object.keys(f).filter((function(t){return t.startsWith("$")})),l=!0;if(c.forEach((function(t){-1===["$ref","$id","$db"].indexOf(t)&&(l=!1)})),l)return W.fromExtendedJSON(f)}return e}(e,r)}))}function r(t,e,r,i){null!=r&&"object"===n(r)&&(i=r,r=0),null==e||"object"!==n(e)||Array.isArray(e)||(i=e,e=void 0,r=0);var o=Ot(t,Object.assign({relaxed:!0,legacy:!1},i,{seenObjects:[{propertyName:"(root)",obj:null}]}));return JSON.stringify(o,e,r)}t.parse=e,t.stringify=r,t.serialize=function(t,e){return e=e||{},JSON.parse(r(t,e))},t.deserialize=function(t,r){return r=r||{},e(JSON.stringify(t),r)}}(At||(At={}));var kt=A();Et=kt.Map?kt.Map:function(){function t(t){void 0===t&&(t=[]),this._keys=[],this._values={};for(var e=0;e<t.length;e++)if(null!=t[e]){var r=t[e],n=r[0],i=r[1];this._keys.push(n),this._values[n]={v:i,i:this._keys.length-1}}}return t.prototype.clear=function(){this._keys=[],this._values={}},t.prototype.delete=function(t){var e=this._values[t];return null!=e&&(delete this._values[t],this._keys.splice(e.i,1),!0)},t.prototype.entries=function(){var t=this,e=0;return{next:function(){var r=t._keys[e++];return{value:void 0!==r?[r,t._values[r].v]:void 0,done:void 0===r}}}},t.prototype.forEach=function(t,e){e=e||this;for(var r=0;r<this._keys.length;r++){var n=this._keys[r];t.call(e,this._values[n].v,n,e)}},t.prototype.get=function(t){return this._values[t]?this._values[t].v:void 0},t.prototype.has=function(t){return null!=this._values[t]},t.prototype.keys=function(){var t=this,e=0;return{next:function(){var r=t._keys[e++];return{value:void 0!==r?r:void 0,done:void 0===r}}}},t.prototype.set=function(t,e){return this._values[t]?(this._values[t].v=e,this):(this._keys.push(t),this._values[t]={v:e,i:this._keys.length-1},this)},t.prototype.values=function(){var t=this,e=0;return{next:function(){var r=t._keys[e++];return{value:void 0!==r?t._values[r].v:void 0,done:void 0===r}}}},Object.defineProperty(t.prototype,"size",{get:function(){return this._keys.length},enumerable:!1,configurable:!0}),t}();var jt=2147483647,$t=-2147483648,Rt=Math.pow(2,63)-1,Pt=-Math.pow(2,63),Bt=Math.pow(2,53),Tt=-Math.pow(2,53),It=1,Nt=2,Dt=3,Ct=4,Lt=5,qt=6,Ut=7,Ft=8,zt=9,Vt=10,Kt=11,Ht=12,Wt=13,Zt=14,Jt=15,Yt=16,Gt=17,Qt=18,Xt=19,te=255,ee=127,re=0,ne=1,ie=2,oe=3,se=4,ae=5,ue=6,he=7,fe=128;function ce(t,e,r){var n=5;if(Array.isArray(t))for(var i=0;i<t.length;i++)n+=le(i.toString(),t[i],e,!0,r);else for(var o in t.toBSON&&(t=t.toBSON()),t)n+=le(o,t[o],e,!1,r);return n}function le(t,e,r,i,o){switch(void 0===r&&(r=!1),void 0===i&&(i=!1),void 0===o&&(o=!1),e&&e.toBSON&&(e=e.toBSON()),n(e)){case"string":return 1+g.byteLength(t,"utf8")+1+4+g.byteLength(e,"utf8")+1;case"number":return Math.floor(e)===e&&e>=Tt&&e<=Bt&&e>=$t&&e<=jt?(null!=t?g.byteLength(t,"utf8")+1:0)+5:(null!=t?g.byteLength(t,"utf8")+1:0)+9;case"undefined":return i||!o?(null!=t?g.byteLength(t,"utf8")+1:0)+1:0;case"boolean":return(null!=t?g.byteLength(t,"utf8")+1:0)+2;case"object":if(null==e||"MinKey"===e._bsontype||"MaxKey"===e._bsontype)return(null!=t?g.byteLength(t,"utf8")+1:0)+1;if("ObjectId"===e._bsontype||"ObjectID"===e._bsontype)return(null!=t?g.byteLength(t,"utf8")+1:0)+13;if(e instanceof Date||T(e))return(null!=t?g.byteLength(t,"utf8")+1:0)+9;if(ArrayBuffer.isView(e)||e instanceof ArrayBuffer||j(e))return(null!=t?g.byteLength(t,"utf8")+1:0)+6+e.byteLength;if("Long"===e._bsontype||"Double"===e._bsontype||"Timestamp"===e._bsontype)return(null!=t?g.byteLength(t,"utf8")+1:0)+9;if("Decimal128"===e._bsontype)return(null!=t?g.byteLength(t,"utf8")+1:0)+17;if("Code"===e._bsontype)return null!=e.scope&&Object.keys(e.scope).length>0?(null!=t?g.byteLength(t,"utf8")+1:0)+1+4+4+g.byteLength(e.code.toString(),"utf8")+1+ce(e.scope,r,o):(null!=t?g.byteLength(t,"utf8")+1:0)+1+4+g.byteLength(e.code.toString(),"utf8")+1;if("Binary"===e._bsontype)return e.sub_type===V.SUBTYPE_BYTE_ARRAY?(null!=t?g.byteLength(t,"utf8")+1:0)+(e.position+1+4+1+4):(null!=t?g.byteLength(t,"utf8")+1:0)+(e.position+1+4+1);if("Symbol"===e._bsontype)return(null!=t?g.byteLength(t,"utf8")+1:0)+g.byteLength(e.value,"utf8")+4+1+1;if("DBRef"===e._bsontype){var s=Object.assign({$ref:e.collection,$id:e.oid},e.fields);return null!=e.db&&(s.$db=e.db),(null!=t?g.byteLength(t,"utf8")+1:0)+1+ce(s,r,o)}return e instanceof RegExp||B(e)?(null!=t?g.byteLength(t,"utf8")+1:0)+1+g.byteLength(e.source,"utf8")+1+(e.global?1:0)+(e.ignoreCase?1:0)+(e.multiline?1:0)+1:"BSONRegExp"===e._bsontype?(null!=t?g.byteLength(t,"utf8")+1:0)+1+g.byteLength(e.pattern,"utf8")+1+g.byteLength(e.options,"utf8")+1:(null!=t?g.byteLength(t,"utf8")+1:0)+ce(e,r,o)+1;case"function":if(e instanceof RegExp||B(e)||"[object RegExp]"===String.call(e))return(null!=t?g.byteLength(t,"utf8")+1:0)+1+g.byteLength(e.source,"utf8")+1+(e.global?1:0)+(e.ignoreCase?1:0)+(e.multiline?1:0)+1;if(r&&null!=e.scope&&Object.keys(e.scope).length>0)return(null!=t?g.byteLength(t,"utf8")+1:0)+1+4+4+g.byteLength(E(e),"utf8")+1+ce(e.scope,r,o);if(r)return(null!=t?g.byteLength(t,"utf8")+1:0)+1+4+g.byteLength(E(e),"utf8")+1}return 0}function de(t,e,r){for(var n=0,i=e;i<r;i+=1){var o=t[i];if(n){if(128!=(192&o))return!1;n-=1}else if(128&o)if(192==(224&o))n=1;else if(224==(240&o))n=2;else{if(240!=(248&o))return!1;n=3}}return!n}var pe=G.fromNumber(Bt),me=G.fromNumber(Tt),ye={};function be(t,e,r){var n=(e=null==e?{}:e)&&e.index?e.index:0,i=t[n]|t[n+1]<<8|t[n+2]<<16|t[n+3]<<24;if(i<5)throw new M("bson size must be >= 5, is "+i);if(e.allowObjectSmallerThanBufferSize&&t.length<i)throw new M("buffer length "+t.length+" must be >= bson size "+i);if(!e.allowObjectSmallerThanBufferSize&&t.length!==i)throw new M("buffer length "+t.length+" must === bson size "+i);if(i+n>t.byteLength)throw new M("(bson size "+i+" + options.index "+n+" must be <= buffer length "+t.byteLength+")");if(0!==t[n+i-1])throw new M("One object, sized correctly, with a spot for an EOO, but the EOO isn't 0x00");return function t(e,r,n,i){void 0===i&&(i=!1);var o=null!=n.evalFunctions&&n.evalFunctions,s=null!=n.cacheFunctions&&n.cacheFunctions,a=null==n.fieldsAsRaw?null:n.fieldsAsRaw,u=null!=n.raw&&n.raw,h="boolean"==typeof n.bsonRegExp&&n.bsonRegExp,f=null!=n.promoteBuffers&&n.promoteBuffers,c=null==n.promoteLongs||n.promoteLongs,l=null==n.promoteValues||n.promoteValues,d=r;if(e.length<5)throw new M("corrupt bson message < 5 bytes long");var p=e[r++]|e[r++]<<8|e[r++]<<16|e[r++]<<24;if(p<5||p>e.length)throw new M("corrupt bson message");var m=i?[]:{},y=0,b=!i&&null;for(;;){var v=e[r++];if(0===v)break;for(var w=r;0!==e[w]&&w<e.length;)w++;if(w>=e.byteLength)throw new M("Bad BSON Document: illegal CString");var _=i?y++:e.toString("utf8",r,w);!1!==b&&"$"===_[0]&&(b=ve.test(_));var S=void 0;if(r=w+1,v===Nt){if((Y=e[r++]|e[r++]<<8|e[r++]<<16|e[r++]<<24)<=0||Y>e.length-r||0!==e[r+Y-1])throw new M("bad string length in bson");S=we(e,r,r+Y-1),r+=Y}else if(v===Ut){var O=g.alloc(12);e.copy(O,0,r,r+12),S=new yt(O),r+=12}else if(v===Yt&&!1===l)S=new ft(e[r++]|e[r++]<<8|e[r++]<<16|e[r++]<<24);else if(v===Yt)S=e[r++]|e[r++]<<8|e[r++]<<16|e[r++]<<24;else if(v===It&&!1===l)S=new ht(e.readDoubleLE(r)),r+=8;else if(v===It)S=e.readDoubleLE(r),r+=8;else if(v===zt){var A=e[r++]|e[r++]<<8|e[r++]<<16|e[r++]<<24,E=e[r++]|e[r++]<<8|e[r++]<<16|e[r++]<<24;S=new Date(new G(A,E).toNumber())}else if(v===Ft){if(0!==e[r]&&1!==e[r])throw new M("illegal boolean type value");S=1===e[r++]}else if(v===Dt){var x=r;if((k=e[r]|e[r+1]<<8|e[r+2]<<16|e[r+3]<<24)<=0||k>e.length-r)throw new M("bad embedded document length in bson");S=u?e.slice(r,r+k):t(e,x,n,!1),r+=k}else if(v===Ct){x=r;var k=e[r]|e[r+1]<<8|e[r+2]<<16|e[r+3]<<24,j=n,$=r+k;if(a&&a[_]){for(var R in j={},n)j[R]=n[R];j.raw=!0}if(S=t(e,x,j,!0),0!==e[(r+=k)-1])throw new M("invalid array terminator byte");if(r!==$)throw new M("corrupted array bson")}else if(v===qt)S=void 0;else if(v===Vt)S=null;else if(v===Qt){A=e[r++]|e[r++]<<8|e[r++]<<16|e[r++]<<24,E=e[r++]|e[r++]<<8|e[r++]<<16|e[r++]<<24;var P=new G(A,E);S=c&&!0===l&&P.lessThanOrEqual(pe)&&P.greaterThanOrEqual(me)?P.toNumber():P}else if(v===Xt){var B=g.alloc(16);e.copy(B,0,r,r+16),r+=16;var T=new ut(B);S="toObject"in T&&"function"==typeof T.toObject?T.toObject():T}else if(v===Lt){var I=e[r++]|e[r++]<<8|e[r++]<<16|e[r++]<<24,N=I,D=e[r++];if(I<0)throw new M("Negative binary type element size found");if(I>e.byteLength)throw new M("Binary type size larger than document size");if(null!=e.slice){if(D===V.SUBTYPE_BYTE_ARRAY){if((I=e[r++]|e[r++]<<8|e[r++]<<16|e[r++]<<24)<0)throw new M("Negative binary type element size found for subtype 0x02");if(I>N-4)throw new M("Binary type with subtype 0x02 contains too long binary size");if(I<N-4)throw new M("Binary type with subtype 0x02 contains too short binary size")}S=f&&l?e.slice(r,r+I):new V(e.slice(r,r+I),D)}else{var C=g.alloc(I);if(D===V.SUBTYPE_BYTE_ARRAY){if((I=e[r++]|e[r++]<<8|e[r++]<<16|e[r++]<<24)<0)throw new M("Negative binary type element size found for subtype 0x02");if(I>N-4)throw new M("Binary type with subtype 0x02 contains too long binary size");if(I<N-4)throw new M("Binary type with subtype 0x02 contains too short binary size")}for(w=0;w<I;w++)C[w]=e[r+w];S=f&&l?C:new V(C,D)}r+=I}else if(v===Kt&&!1===h){for(w=r;0!==e[w]&&w<e.length;)w++;if(w>=e.length)throw new M("Bad BSON Document: illegal CString");var L=e.toString("utf8",r,w);for(w=r=w+1;0!==e[w]&&w<e.length;)w++;if(w>=e.length)throw new M("Bad BSON Document: illegal CString");var q=e.toString("utf8",r,w);r=w+1;var U=new Array(q.length);for(w=0;w<q.length;w++)switch(q[w]){case"m":U[w]="m";break;case"s":U[w]="g";break;case"i":U[w]="i"}S=new RegExp(L,U.join(""))}else if(v===Kt&&!0===h){for(w=r;0!==e[w]&&w<e.length;)w++;if(w>=e.length)throw new M("Bad BSON Document: illegal CString");L=e.toString("utf8",r,w);for(w=r=w+1;0!==e[w]&&w<e.length;)w++;if(w>=e.length)throw new M("Bad BSON Document: illegal CString");q=e.toString("utf8",r,w);r=w+1,S=new bt(L,q)}else if(v===Zt){if((Y=e[r++]|e[r++]<<8|e[r++]<<16|e[r++]<<24)<=0||Y>e.length-r||0!==e[r+Y-1])throw new M("bad string length in bson");var F=we(e,r,r+Y-1);S=l?F:new vt(F),r+=Y}else if(v===Gt){A=e[r++]|e[r++]<<8|e[r++]<<16|e[r++]<<24,E=e[r++]|e[r++]<<8|e[r++]<<16|e[r++]<<24;S=new wt(A,E)}else if(v===te)S=new lt;else if(v===ee)S=new ct;else if(v===Wt){if((Y=e[r++]|e[r++]<<8|e[r++]<<16|e[r++]<<24)<=0||Y>e.length-r||0!==e[r+Y-1])throw new M("bad string length in bson");var z=we(e,r,r+Y-1);S=o?s?ge(z,ye,m):ge(z):new K(z),r+=Y}else if(v===Jt){var Z=e[r++]|e[r++]<<8|e[r++]<<16|e[r++]<<24;if(Z<13)throw new M("code_w_scope total size shorter minimum expected length");if((Y=e[r++]|e[r++]<<8|e[r++]<<16|e[r++]<<24)<=0||Y>e.length-r||0!==e[r+Y-1])throw new M("bad string length in bson");z=we(e,r,r+Y-1),x=r+=Y,k=e[r]|e[r+1]<<8|e[r+2]<<16|e[r+3]<<24;var J=t(e,x,n,!1);if(r+=k,Z<8+k+Y)throw new M("code_w_scope total size is too short, truncating scope");if(Z>8+k+Y)throw new M("code_w_scope total size is too long, clips outer document");o?(S=s?ge(z,ye,m):ge(z)).scope=J:S=new K(z,J)}else{if(v!==Ht)throw new M("Detected unknown BSON type "+v.toString(16)+' for fieldname "'+_+'"');var Y;if((Y=e[r++]|e[r++]<<8|e[r++]<<16|e[r++]<<24)<=0||Y>e.length-r||0!==e[r+Y-1])throw new M("bad string length in bson");if(!de(e,r,r+Y-1))throw new M("Invalid UTF-8 string in BSON document");var Q=e.toString("utf8",r,r+Y-1);r+=Y;var X=g.alloc(12);e.copy(X,0,r,r+12);O=new yt(X);r+=12,S=new W(Q,O)}"__proto__"===_?Object.defineProperty(m,_,{value:S,writable:!0,enumerable:!0,configurable:!0}):m[_]=S}if(p!==r-d){if(i)throw new M("corrupt array bson");throw new M("corrupt object bson")}if(!b)return m;if(H(m)){var tt=Object.assign({},m);return delete tt.$ref,delete tt.$id,delete tt.$db,new W(m.$ref,m.$id,m.$db,tt)}return m}(t,n,e,r)}var ve=/^\$ref$|^\$id$|^\$db$/;function ge(t,e,r){return e?(null==e[t]&&(e[t]=new Function(t)),e[t].bind(r)):new Function(t)}function we(t,e,r){for(var n=t.toString("utf8",e,r),i=0;i<n.length;i++)if(65533===n.charCodeAt(i)){if(!de(t,e,r))throw new M("Invalid UTF-8 string in BSON document");break}return n}function _e(t,e,r,n,i,o){var s,a,u,h="big"===n,f=8*o-i-1,c=(1<<f)-1,l=c>>1,d=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,p=h?o-1:0,m=h?-1:1,y=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,s=c):(s=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-s))<1&&(s--,u*=2),(e+=s+l>=1?d/u:d*Math.pow(2,1-l))*u>=2&&(s++,u/=2),s+l>=c?(a=0,s=c):s+l>=1?(a=(e*u-1)*Math.pow(2,i),s+=l):(a=e*Math.pow(2,l-1)*Math.pow(2,i),s=0)),isNaN(e)&&(a=0);i>=8;)t[r+p]=255&a,p+=m,a/=256,i-=8;for(s=s<<i|a,isNaN(e)&&(s+=8),f+=i;f>0;)t[r+p]=255&s,p+=m,s/=256,f-=8;t[r+p-m]|=128*y}var Me=/\x00/,Se=new Set(["$db","$ref","$id","$clusterTime"]);function Oe(t,e,r,n,i){t[n++]=Nt;var o=i?t.write(e,n,void 0,"ascii"):t.write(e,n,void 0,"utf8");t[(n=n+o+1)-1]=0;var s=t.write(r,n+4,void 0,"utf8");return t[n+3]=s+1>>24&255,t[n+2]=s+1>>16&255,t[n+1]=s+1>>8&255,t[n]=s+1&255,n=n+4+s,t[n++]=0,n}function Ae(t,e,r,n,i){Number.isInteger(r)&&r>=$t&&r<=jt?(t[n++]=Yt,n+=i?t.write(e,n,void 0,"ascii"):t.write(e,n,void 0,"utf8"),t[n++]=0,t[n++]=255&r,t[n++]=r>>8&255,t[n++]=r>>16&255,t[n++]=r>>24&255):(t[n++]=It,n+=i?t.write(e,n,void 0,"ascii"):t.write(e,n,void 0,"utf8"),t[n++]=0,_e(t,r,n,"little",52,8),n+=8);return n}function Ee(t,e,r,n,i){return t[n++]=Vt,n+=i?t.write(e,n,void 0,"ascii"):t.write(e,n,void 0,"utf8"),t[n++]=0,n}function xe(t,e,r,n,i){return t[n++]=Ft,n+=i?t.write(e,n,void 0,"ascii"):t.write(e,n,void 0,"utf8"),t[n++]=0,t[n++]=r?1:0,n}function ke(t,e,r,n,i){t[n++]=zt,n+=i?t.write(e,n,void 0,"ascii"):t.write(e,n,void 0,"utf8"),t[n++]=0;var o=G.fromNumber(r.getTime()),s=o.getLowBits(),a=o.getHighBits();return t[n++]=255&s,t[n++]=s>>8&255,t[n++]=s>>16&255,t[n++]=s>>24&255,t[n++]=255&a,t[n++]=a>>8&255,t[n++]=a>>16&255,t[n++]=a>>24&255,n}function je(t,e,r,n,i){if(t[n++]=Kt,n+=i?t.write(e,n,void 0,"ascii"):t.write(e,n,void 0,"utf8"),t[n++]=0,r.source&&null!=r.source.match(Me))throw Error("value "+r.source+" must not contain null bytes");return n+=t.write(r.source,n,void 0,"utf8"),t[n++]=0,r.ignoreCase&&(t[n++]=105),r.global&&(t[n++]=115),r.multiline&&(t[n++]=109),t[n++]=0,n}function $e(t,e,r,n,i){if(t[n++]=Kt,n+=i?t.write(e,n,void 0,"ascii"):t.write(e,n,void 0,"utf8"),t[n++]=0,null!=r.pattern.match(Me))throw Error("pattern "+r.pattern+" must not contain null bytes");return n+=t.write(r.pattern,n,void 0,"utf8"),t[n++]=0,n+=t.write(r.options.split("").sort().join(""),n,void 0,"utf8"),t[n++]=0,n}function Re(t,e,r,n,i){return null===r?t[n++]=Vt:"MinKey"===r._bsontype?t[n++]=te:t[n++]=ee,n+=i?t.write(e,n,void 0,"ascii"):t.write(e,n,void 0,"utf8"),t[n++]=0,n}function Pe(t,e,r,n,i){if(t[n++]=Ut,n+=i?t.write(e,n,void 0,"ascii"):t.write(e,n,void 0,"utf8"),t[n++]=0,"string"==typeof r.id)t.write(r.id,n,void 0,"binary");else{if(!$(r.id))throw new S("object ["+JSON.stringify(r)+"] is not a valid ObjectId");t.set(r.id.subarray(0,12),n)}return n+12}function Be(t,e,r,n,i){t[n++]=Lt,n+=i?t.write(e,n,void 0,"ascii"):t.write(e,n,void 0,"utf8"),t[n++]=0;var o=r.length;return t[n++]=255&o,t[n++]=o>>8&255,t[n++]=o>>16&255,t[n++]=o>>24&255,t[n++]=re,t.set(D(r),n),n+=o}function Te(t,e,r,n,i,o,s,a,u,h){void 0===i&&(i=!1),void 0===o&&(o=0),void 0===s&&(s=!1),void 0===a&&(a=!0),void 0===u&&(u=!1),void 0===h&&(h=[]);for(var f=0;f<h.length;f++)if(h[f]===r)throw new M("cyclic dependency detected");h.push(r),t[n++]=Array.isArray(r)?Ct:Dt,n+=u?t.write(e,n,void 0,"ascii"):t.write(e,n,void 0,"utf8"),t[n++]=0;var c=Ve(t,r,i,n,o+1,s,a,h);return h.pop(),c}function Ie(t,e,r,n,i){return t[n++]=Xt,n+=i?t.write(e,n,void 0,"ascii"):t.write(e,n,void 0,"utf8"),t[n++]=0,t.set(r.bytes.subarray(0,16),n),n+16}function Ne(t,e,r,n,i){t[n++]="Long"===r._bsontype?Qt:Gt,n+=i?t.write(e,n,void 0,"ascii"):t.write(e,n,void 0,"utf8"),t[n++]=0;var o=r.getLowBits(),s=r.getHighBits();return t[n++]=255&o,t[n++]=o>>8&255,t[n++]=o>>16&255,t[n++]=o>>24&255,t[n++]=255&s,t[n++]=s>>8&255,t[n++]=s>>16&255,t[n++]=s>>24&255,n}function De(t,e,r,n,i){return r=r.valueOf(),t[n++]=Yt,n+=i?t.write(e,n,void 0,"ascii"):t.write(e,n,void 0,"utf8"),t[n++]=0,t[n++]=255&r,t[n++]=r>>8&255,t[n++]=r>>16&255,t[n++]=r>>24&255,n}function Ce(t,e,r,n,i){return t[n++]=It,n+=i?t.write(e,n,void 0,"ascii"):t.write(e,n,void 0,"utf8"),t[n++]=0,_e(t,r.value,n,"little",52,8),n+=8}function Le(t,e,r,n,i,o,s){t[n++]=Wt,n+=s?t.write(e,n,void 0,"ascii"):t.write(e,n,void 0,"utf8"),t[n++]=0;var a=E(r),u=t.write(a,n+4,void 0,"utf8")+1;return t[n]=255&u,t[n+1]=u>>8&255,t[n+2]=u>>16&255,t[n+3]=u>>24&255,n=n+4+u-1,t[n++]=0,n}function qe(t,e,r,i,o,s,a,u,h){if(void 0===o&&(o=!1),void 0===s&&(s=0),void 0===a&&(a=!1),void 0===u&&(u=!0),void 0===h&&(h=!1),r.scope&&"object"===n(r.scope)){t[i++]=Jt,i+=h?t.write(e,i,void 0,"ascii"):t.write(e,i,void 0,"utf8"),t[i++]=0;var f=i,c="string"==typeof r.code?r.code:r.code.toString();i+=4;var l=t.write(c,i+4,void 0,"utf8")+1;t[i]=255&l,t[i+1]=l>>8&255,t[i+2]=l>>16&255,t[i+3]=l>>24&255,t[i+4+l-1]=0,i=i+l+4;var d=Ve(t,r.scope,o,i,s+1,a,u);i=d-1;var p=d-f;t[f++]=255&p,t[f++]=p>>8&255,t[f++]=p>>16&255,t[f++]=p>>24&255,t[i++]=0}else{t[i++]=Wt,i+=h?t.write(e,i,void 0,"ascii"):t.write(e,i,void 0,"utf8"),t[i++]=0;c=r.code.toString();var m=t.write(c,i+4,void 0,"utf8")+1;t[i]=255&m,t[i+1]=m>>8&255,t[i+2]=m>>16&255,t[i+3]=m>>24&255,i=i+4+m-1,t[i++]=0}return i}function Ue(t,e,r,n,i){t[n++]=Lt,n+=i?t.write(e,n,void 0,"ascii"):t.write(e,n,void 0,"utf8"),t[n++]=0;var o=r.value(!0),s=r.position;return r.sub_type===V.SUBTYPE_BYTE_ARRAY&&(s+=4),t[n++]=255&s,t[n++]=s>>8&255,t[n++]=s>>16&255,t[n++]=s>>24&255,t[n++]=r.sub_type,r.sub_type===V.SUBTYPE_BYTE_ARRAY&&(s-=4,t[n++]=255&s,t[n++]=s>>8&255,t[n++]=s>>16&255,t[n++]=s>>24&255),t.set(o,n),n+=r.position}function Fe(t,e,r,n,i){t[n++]=Zt,n+=i?t.write(e,n,void 0,"ascii"):t.write(e,n,void 0,"utf8"),t[n++]=0;var o=t.write(r.value,n+4,void 0,"utf8")+1;return t[n]=255&o,t[n+1]=o>>8&255,t[n+2]=o>>16&255,t[n+3]=o>>24&255,n=n+4+o-1,t[n++]=0,n}function ze(t,e,r,n,i,o,s){t[n++]=Dt,n+=s?t.write(e,n,void 0,"ascii"):t.write(e,n,void 0,"utf8"),t[n++]=0;var a=n,u={$ref:r.collection||r.namespace,$id:r.oid};null!=r.db&&(u.$db=r.db);var h=Ve(t,u=Object.assign(u,r.fields),!1,n,i+1,o),f=h-a;return t[a++]=255&f,t[a++]=f>>8&255,t[a++]=f>>16&255,t[a++]=f>>24&255,h}function Ve(t,e,r,i,o,s,a,u){void 0===r&&(r=!1),void 0===i&&(i=0),void 0===o&&(o=0),void 0===s&&(s=!1),void 0===a&&(a=!0),void 0===u&&(u=[]),i=i||0,(u=u||[]).push(e);var h,f=i+4;if(Array.isArray(e))for(var c=0;c<e.length;c++){var l=""+c;if((b=e[c])&&b.toBSON){if("function"!=typeof b.toBSON)throw new S("toBSON is not a function");b=b.toBSON()}if("string"==typeof b)f=Oe(t,l,b,f,!0);else if("number"==typeof b)f=Ae(t,l,b,f,!0);else{if("bigint"==typeof b)throw new S("Unsupported type BigInt, please use Decimal128");if("boolean"==typeof b)f=xe(t,l,b,f,!0);else if(b instanceof Date||T(b))f=ke(t,l,b,f,!0);else if(void 0===b)f=Ee(t,l,0,f,!0);else if(null===b)f=Ee(t,l,0,f,!0);else if("ObjectId"===b._bsontype||"ObjectID"===b._bsontype)f=Pe(t,l,b,f,!0);else if($(b))f=Be(t,l,b,f,!0);else if(b instanceof RegExp||B(b))f=je(t,l,b,f,!0);else if("object"===n(b)&&null==b._bsontype)f=Te(t,l,b,f,r,o,s,a,!0,u);else if("object"===n(b)&&_t(b)&&"Decimal128"===b._bsontype)f=Ie(t,l,b,f,!0);else if("Long"===b._bsontype||"Timestamp"===b._bsontype)f=Ne(t,l,b,f,!0);else if("Double"===b._bsontype)f=Ce(t,l,b,f,!0);else if("function"==typeof b&&s)f=Le(t,l,b,f,0,0,!0);else if("Code"===b._bsontype)f=qe(t,l,b,f,r,o,s,a,!0);else if("Binary"===b._bsontype)f=Ue(t,l,b,f,!0);else if("Symbol"===b._bsontype)f=Fe(t,l,b,f,!0);else if("DBRef"===b._bsontype)f=ze(t,l,b,f,o,s,!0);else if("BSONRegExp"===b._bsontype)f=$e(t,l,b,f,!0);else if("Int32"===b._bsontype)f=De(t,l,b,f,!0);else if("MinKey"===b._bsontype||"MaxKey"===b._bsontype)f=Re(t,l,b,f,!0);else if(void 0!==b._bsontype)throw new S("Unrecognized or invalid _bsontype: "+b._bsontype)}}else if(e instanceof Et||(h=e,"[object Map]"===Object.prototype.toString.call(h)))for(var d=e.entries(),p=!1;!p;){var m=d.next();if(!(p=!!m.done)){l=m.value[0];var y=n(b=m.value[1]);if("string"==typeof l&&!Se.has(l)){if(null!=l.match(Me))throw Error("key "+l+" must not contain null bytes");if(r){if("$"===l[0])throw Error("key "+l+" must not start with '$'");if(~l.indexOf("."))throw Error("key "+l+" must not contain '.'")}}if("string"===y)f=Oe(t,l,b,f);else if("number"===y)f=Ae(t,l,b,f);else{if("bigint"===y||R(b)||P(b))throw new S("Unsupported type BigInt, please use Decimal128");if("boolean"===y)f=xe(t,l,b,f);else if(b instanceof Date||T(b))f=ke(t,l,b,f);else if(null===b||void 0===b&&!1===a)f=Ee(t,l,0,f);else if("ObjectId"===b._bsontype||"ObjectID"===b._bsontype)f=Pe(t,l,b,f);else if($(b))f=Be(t,l,b,f);else if(b instanceof RegExp||B(b))f=je(t,l,b,f);else if("object"===y&&null==b._bsontype)f=Te(t,l,b,f,r,o,s,a,!1,u);else if("object"===y&&"Decimal128"===b._bsontype)f=Ie(t,l,b,f);else if("Long"===b._bsontype||"Timestamp"===b._bsontype)f=Ne(t,l,b,f);else if("Double"===b._bsontype)f=Ce(t,l,b,f);else if("Code"===b._bsontype)f=qe(t,l,b,f,r,o,s,a);else if("function"==typeof b&&s)f=Le(t,l,b,f,0,0,s);else if("Binary"===b._bsontype)f=Ue(t,l,b,f);else if("Symbol"===b._bsontype)f=Fe(t,l,b,f);else if("DBRef"===b._bsontype)f=ze(t,l,b,f,o,s);else if("BSONRegExp"===b._bsontype)f=$e(t,l,b,f);else if("Int32"===b._bsontype)f=De(t,l,b,f);else if("MinKey"===b._bsontype||"MaxKey"===b._bsontype)f=Re(t,l,b,f);else if(void 0!==b._bsontype)throw new S("Unrecognized or invalid _bsontype: "+b._bsontype)}}}else{if(e.toBSON){if("function"!=typeof e.toBSON)throw new S("toBSON is not a function");if(null!=(e=e.toBSON())&&"object"!==n(e))throw new S("toBSON function did not return an object")}for(var l in e){var b;if((b=e[l])&&b.toBSON){if("function"!=typeof b.toBSON)throw new S("toBSON is not a function");b=b.toBSON()}y=n(b);if("string"==typeof l&&!Se.has(l)){if(null!=l.match(Me))throw Error("key "+l+" must not contain null bytes");if(r){if("$"===l[0])throw Error("key "+l+" must not start with '$'");if(~l.indexOf("."))throw Error("key "+l+" must not contain '.'")}}if("string"===y)f=Oe(t,l,b,f);else if("number"===y)f=Ae(t,l,b,f);else{if("bigint"===y)throw new S("Unsupported type BigInt, please use Decimal128");if("boolean"===y)f=xe(t,l,b,f);else if(b instanceof Date||T(b))f=ke(t,l,b,f);else if(void 0===b)!1===a&&(f=Ee(t,l,0,f));else if(null===b)f=Ee(t,l,0,f);else if("ObjectId"===b._bsontype||"ObjectID"===b._bsontype)f=Pe(t,l,b,f);else if($(b))f=Be(t,l,b,f);else if(b instanceof RegExp||B(b))f=je(t,l,b,f);else if("object"===y&&null==b._bsontype)f=Te(t,l,b,f,r,o,s,a,!1,u);else if("object"===y&&"Decimal128"===b._bsontype)f=Ie(t,l,b,f);else if("Long"===b._bsontype||"Timestamp"===b._bsontype)f=Ne(t,l,b,f);else if("Double"===b._bsontype)f=Ce(t,l,b,f);else if("Code"===b._bsontype)f=qe(t,l,b,f,r,o,s,a);else if("function"==typeof b&&s)f=Le(t,l,b,f,0,0,s);else if("Binary"===b._bsontype)f=Ue(t,l,b,f);else if("Symbol"===b._bsontype)f=Fe(t,l,b,f);else if("DBRef"===b._bsontype)f=ze(t,l,b,f,o,s);else if("BSONRegExp"===b._bsontype)f=$e(t,l,b,f);else if("Int32"===b._bsontype)f=De(t,l,b,f);else if("MinKey"===b._bsontype||"MaxKey"===b._bsontype)f=Re(t,l,b,f);else if(void 0!==b._bsontype)throw new S("Unrecognized or invalid _bsontype: "+b._bsontype)}}}u.pop(),t[f++]=0;var v=f-i;return t[i++]=255&v,t[i++]=v>>8&255,t[i++]=v>>16&255,t[i++]=v>>24&255,f}var Ke=g.alloc(17825792);function He(t){Ke.length<t&&(Ke=g.alloc(t))}function We(t,e){void 0===e&&(e={});var r="boolean"==typeof e.checkKeys&&e.checkKeys,n="boolean"==typeof e.serializeFunctions&&e.serializeFunctions,i="boolean"!=typeof e.ignoreUndefined||e.ignoreUndefined,o="number"==typeof e.minInternalBufferSize?e.minInternalBufferSize:17825792;Ke.length<o&&(Ke=g.alloc(o));var s=Ve(Ke,t,r,0,0,n,i,[]),a=g.alloc(s);return Ke.copy(a,0,0,a.length),a}function Ze(t,e,r){void 0===r&&(r={});var n="boolean"==typeof r.checkKeys&&r.checkKeys,i="boolean"==typeof r.serializeFunctions&&r.serializeFunctions,o="boolean"!=typeof r.ignoreUndefined||r.ignoreUndefined,s="number"==typeof r.index?r.index:0,a=Ve(Ke,t,n,0,0,i,o);return Ke.copy(e,s,0,a),s+a-1}function Je(t,e){return void 0===e&&(e={}),be(t instanceof g?t:D(t),e)}function Ye(t,e){return void 0===e&&(e={}),ce(t,"boolean"==typeof(e=e||{}).serializeFunctions&&e.serializeFunctions,"boolean"!=typeof e.ignoreUndefined||e.ignoreUndefined)}function Ge(t,e,r,n,i,o){for(var s=Object.assign({allowObjectSmallerThanBufferSize:!0,index:0},o),a=D(t),u=e,h=0;h<r;h++){var f=a[u]|a[u+1]<<8|a[u+2]<<16|a[u+3]<<24;s.index=u,n[i+h]=be(a,s),u+=f}return u}var Qe={Binary:V,Code:K,DBRef:W,Decimal128:ut,Double:ht,Int32:ft,Long:G,UUID:z,Map:Et,MaxKey:ct,MinKey:lt,ObjectId:yt,ObjectID:yt,BSONRegExp:bt,BSONSymbol:vt,Timestamp:wt,EJSON:At,setInternalBufferSize:He,serialize:We,serializeWithBufferAndIndex:Ze,deserialize:Je,calculateObjectSize:Ye,deserializeStream:Ge,BSONError:M,BSONTypeError:S};e.default=Qe}.call(this,r(7))},function(t,e,r){"use strict";var n=r(0),i=r(98),o=r(2).Buffer,s=new Array(16);function a(){i.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878}function u(t,e){return t<<e|t>>>32-e}function h(t,e,r,n,i,o,s){return u(t+(e&r|~e&n)+i+o|0,s)+e|0}function f(t,e,r,n,i,o,s){return u(t+(e&n|r&~n)+i+o|0,s)+e|0}function c(t,e,r,n,i,o,s){return u(t+(e^r^n)+i+o|0,s)+e|0}function l(t,e,r,n,i,o,s){return u(t+(r^(e|~n))+i+o|0,s)+e|0}n(a,i),a.prototype._update=function(){for(var t=s,e=0;e<16;++e)t[e]=this._block.readInt32LE(4*e);var r=this._a,n=this._b,i=this._c,o=this._d;r=h(r,n,i,o,t[0],3614090360,7),o=h(o,r,n,i,t[1],3905402710,12),i=h(i,o,r,n,t[2],606105819,17),n=h(n,i,o,r,t[3],3250441966,22),r=h(r,n,i,o,t[4],4118548399,7),o=h(o,r,n,i,t[5],1200080426,12),i=h(i,o,r,n,t[6],2821735955,17),n=h(n,i,o,r,t[7],4249261313,22),r=h(r,n,i,o,t[8],1770035416,7),o=h(o,r,n,i,t[9],2336552879,12),i=h(i,o,r,n,t[10],4294925233,17),n=h(n,i,o,r,t[11],2304563134,22),r=h(r,n,i,o,t[12],1804603682,7),o=h(o,r,n,i,t[13],4254626195,12),i=h(i,o,r,n,t[14],2792965006,17),r=f(r,n=h(n,i,o,r,t[15],1236535329,22),i,o,t[1],4129170786,5),o=f(o,r,n,i,t[6],3225465664,9),i=f(i,o,r,n,t[11],643717713,14),n=f(n,i,o,r,t[0],3921069994,20),r=f(r,n,i,o,t[5],3593408605,5),o=f(o,r,n,i,t[10],38016083,9),i=f(i,o,r,n,t[15],3634488961,14),n=f(n,i,o,r,t[4],3889429448,20),r=f(r,n,i,o,t[9],568446438,5),o=f(o,r,n,i,t[14],3275163606,9),i=f(i,o,r,n,t[3],4107603335,14),n=f(n,i,o,r,t[8],1163531501,20),r=f(r,n,i,o,t[13],2850285829,5),o=f(o,r,n,i,t[2],4243563512,9),i=f(i,o,r,n,t[7],1735328473,14),r=c(r,n=f(n,i,o,r,t[12],2368359562,20),i,o,t[5],4294588738,4),o=c(o,r,n,i,t[8],2272392833,11),i=c(i,o,r,n,t[11],1839030562,16),n=c(n,i,o,r,t[14],4259657740,23),r=c(r,n,i,o,t[1],2763975236,4),o=c(o,r,n,i,t[4],1272893353,11),i=c(i,o,r,n,t[7],4139469664,16),n=c(n,i,o,r,t[10],3200236656,23),r=c(r,n,i,o,t[13],681279174,4),o=c(o,r,n,i,t[0],3936430074,11),i=c(i,o,r,n,t[3],3572445317,16),n=c(n,i,o,r,t[6],76029189,23),r=c(r,n,i,o,t[9],3654602809,4),o=c(o,r,n,i,t[12],3873151461,11),i=c(i,o,r,n,t[15],530742520,16),r=l(r,n=c(n,i,o,r,t[2],3299628645,23),i,o,t[0],4096336452,6),o=l(o,r,n,i,t[7],1126891415,10),i=l(i,o,r,n,t[14],2878612391,15),n=l(n,i,o,r,t[5],4237533241,21),r=l(r,n,i,o,t[12],1700485571,6),o=l(o,r,n,i,t[3],2399980690,10),i=l(i,o,r,n,t[10],4293915773,15),n=l(n,i,o,r,t[1],2240044497,21),r=l(r,n,i,o,t[8],1873313359,6),o=l(o,r,n,i,t[15],4264355552,10),i=l(i,o,r,n,t[6],2734768916,15),n=l(n,i,o,r,t[13],1309151649,21),r=l(r,n,i,o,t[4],4149444226,6),o=l(o,r,n,i,t[11],3174756917,10),i=l(i,o,r,n,t[2],718787259,15),n=l(n,i,o,r,t[9],3951481745,21),this._a=this._a+r|0,this._b=this._b+n|0,this._c=this._c+i|0,this._d=this._d+o|0},a.prototype._digest=function(){this._block[this._blockOffset++]=128,this._blockOffset>56&&(this._block.fill(0,this._blockOffset,64),this._update(),this._blockOffset=0),this._block.fill(0,this._blockOffset,56),this._block.writeUInt32LE(this._length[0],56),this._block.writeUInt32LE(this._length[1],60),this._update();var t=o.allocUnsafe(16);return t.writeInt32LE(this._a,0),t.writeInt32LE(this._b,4),t.writeInt32LE(this._c,8),t.writeInt32LE(this._d,12),t},t.exports=a},function(t,e,r){(function(e){function r(t){try{if(!e.localStorage)return!1}catch(t){return!1}var r=e.localStorage[t];return null!=r&&"true"===String(r).toLowerCase()}t.exports=function(t,e){if(r("noDeprecation"))return t;var n=!1;return function(){if(!n){if(r("throwDeprecation"))throw new Error(e);r("traceDeprecation")?console.trace(e):console.warn(e),n=!0}return t.apply(this,arguments)}}}).call(this,r(7))},function(t,e,r){"use strict";var n=r(29).codes.ERR_STREAM_PREMATURE_CLOSE;function i(){}t.exports=function t(e,r,o){if("function"==typeof r)return t(e,null,r);r||(r={}),o=function(t){var e=!1;return function(){if(!e){e=!0;for(var r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];t.apply(this,n)}}}(o||i);var s=r.readable||!1!==r.readable&&e.readable,a=r.writable||!1!==r.writable&&e.writable,u=function(){e.writable||f()},h=e._writableState&&e._writableState.finished,f=function(){a=!1,h=!0,s||o.call(e)},c=e._readableState&&e._readableState.endEmitted,l=function(){s=!1,c=!0,a||o.call(e)},d=function(t){o.call(e,t)},p=function(){var t;return s&&!c?(e._readableState&&e._readableState.ended||(t=new n),o.call(e,t)):a&&!h?(e._writableState&&e._writableState.ended||(t=new n),o.call(e,t)):void 0},m=function(){e.req.on("finish",f)};return!function(t){return t.setHeader&&"function"==typeof t.abort}(e)?a&&!e._writableState&&(e.on("end",u),e.on("close",u)):(e.on("complete",f),e.on("abort",p),e.req?m():e.on("request",m)),e.on("end",l),e.on("finish",f),!1!==r.error&&e.on("error",d),e.on("close",p),function(){e.removeListener("complete",f),e.removeListener("abort",p),e.removeListener("request",m),e.req&&e.req.removeListener("finish",f),e.removeListener("end",u),e.removeListener("close",u),e.removeListener("finish",f),e.removeListener("end",l),e.removeListener("error",d),e.removeListener("close",p)}}},function(t,e,r){"use strict";var n=r(3).Buffer,i=r(0),o=r(98),s=new Array(16),a=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13],u=[5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11],h=[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6],f=[8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11],c=[0,1518500249,1859775393,2400959708,2840853838],l=[1352829926,1548603684,1836072691,2053994217,0];function d(){o.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520}function p(t,e){return t<<e|t>>>32-e}function m(t,e,r,n,i,o,s,a){return p(t+(e^r^n)+o+s|0,a)+i|0}function y(t,e,r,n,i,o,s,a){return p(t+(e&r|~e&n)+o+s|0,a)+i|0}function b(t,e,r,n,i,o,s,a){return p(t+((e|~r)^n)+o+s|0,a)+i|0}function v(t,e,r,n,i,o,s,a){return p(t+(e&n|r&~n)+o+s|0,a)+i|0}function g(t,e,r,n,i,o,s,a){return p(t+(e^(r|~n))+o+s|0,a)+i|0}i(d,o),d.prototype._update=function(){for(var t=s,e=0;e<16;++e)t[e]=this._block.readInt32LE(4*e);for(var r=0|this._a,n=0|this._b,i=0|this._c,o=0|this._d,d=0|this._e,w=0|this._a,_=0|this._b,M=0|this._c,S=0|this._d,O=0|this._e,A=0;A<80;A+=1){var E,x;A<16?(E=m(r,n,i,o,d,t[a[A]],c[0],h[A]),x=g(w,_,M,S,O,t[u[A]],l[0],f[A])):A<32?(E=y(r,n,i,o,d,t[a[A]],c[1],h[A]),x=v(w,_,M,S,O,t[u[A]],l[1],f[A])):A<48?(E=b(r,n,i,o,d,t[a[A]],c[2],h[A]),x=b(w,_,M,S,O,t[u[A]],l[2],f[A])):A<64?(E=v(r,n,i,o,d,t[a[A]],c[3],h[A]),x=y(w,_,M,S,O,t[u[A]],l[3],f[A])):(E=g(r,n,i,o,d,t[a[A]],c[4],h[A]),x=m(w,_,M,S,O,t[u[A]],l[4],f[A])),r=d,d=o,o=p(i,10),i=n,n=E,w=O,O=S,S=p(M,10),M=_,_=x}var k=this._b+i+S|0;this._b=this._c+o+O|0,this._c=this._d+d+w|0,this._d=this._e+r+_|0,this._e=this._a+n+M|0,this._a=k},d.prototype._digest=function(){this._block[this._blockOffset++]=128,this._blockOffset>56&&(this._block.fill(0,this._blockOffset,64),this._update(),this._blockOffset=0),this._block.fill(0,this._blockOffset,56),this._block.writeUInt32LE(this._length[0],56),this._block.writeUInt32LE(this._length[1],60),this._update();var t=n.alloc?n.alloc(20):new n(20);return t.writeInt32LE(this._a,0),t.writeInt32LE(this._b,4),t.writeInt32LE(this._c,8),t.writeInt32LE(this._d,12),t.writeInt32LE(this._e,16),t},t.exports=d},function(t,e,r){(e=t.exports=function(t){t=t.toLowerCase();var r=e[t];if(!r)throw new Error(t+" is not supported (we accept pull requests)");return new r}).sha=r(201),e.sha1=r(202),e.sha224=r(203),e.sha256=r(105),e.sha384=r(204),e.sha512=r(106)},function(t,e,r){(e=t.exports=r(107)).Stream=e,e.Readable=e,e.Writable=r(68),e.Duplex=r(26),e.Transform=r(111),e.PassThrough=r(210)},function(t,e,r){"use strict";(function(e,n,i){var o=r(48);function s(t){var e=this;this.next=null,this.entry=null,this.finish=function(){!function(t,e,r){var n=t.entry;t.entry=null;for(;n;){var i=n.callback;e.pendingcb--,i(r),n=n.next}e.corkedRequestsFree?e.corkedRequestsFree.next=t:e.corkedRequestsFree=t}(e,t)}}t.exports=v;var a,u=!e.browser&&["v0.10","v0.9."].indexOf(e.version.slice(0,5))>-1?n:o.nextTick;v.WritableState=b;var h=Object.create(r(40));h.inherits=r(0);var f={deprecate:r(63)},c=r(108),l=r(2).Buffer,d=i.Uint8Array||function(){};var p,m=r(109);function y(){}function b(t,e){a=a||r(26),t=t||{};var n=e instanceof a;this.objectMode=!!t.objectMode,n&&(this.objectMode=this.objectMode||!!t.writableObjectMode);var i=t.highWaterMark,h=t.writableHighWaterMark,f=this.objectMode?16:16384;this.highWaterMark=i||0===i?i:n&&(h||0===h)?h:f,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var c=!1===t.decodeStrings;this.decodeStrings=!c,this.defaultEncoding=t.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(t){!function(t,e){var r=t._writableState,n=r.sync,i=r.writecb;if(function(t){t.writing=!1,t.writecb=null,t.length-=t.writelen,t.writelen=0}(r),e)!function(t,e,r,n,i){--e.pendingcb,r?(o.nextTick(i,n),o.nextTick(O,t,e),t._writableState.errorEmitted=!0,t.emit("error",n)):(i(n),t._writableState.errorEmitted=!0,t.emit("error",n),O(t,e))}(t,r,n,e,i);else{var s=M(r);s||r.corked||r.bufferProcessing||!r.bufferedRequest||_(t,r),n?u(w,t,r,s,i):w(t,r,s,i)}}(e,t)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new s(this)}function v(t){if(a=a||r(26),!(p.call(v,this)||this instanceof a))return new v(t);this._writableState=new b(t,this),this.writable=!0,t&&("function"==typeof t.write&&(this._write=t.write),"function"==typeof t.writev&&(this._writev=t.writev),"function"==typeof t.destroy&&(this._destroy=t.destroy),"function"==typeof t.final&&(this._final=t.final)),c.call(this)}function g(t,e,r,n,i,o,s){e.writelen=n,e.writecb=s,e.writing=!0,e.sync=!0,r?t._writev(i,e.onwrite):t._write(i,o,e.onwrite),e.sync=!1}function w(t,e,r,n){r||function(t,e){0===e.length&&e.needDrain&&(e.needDrain=!1,t.emit("drain"))}(t,e),e.pendingcb--,n(),O(t,e)}function _(t,e){e.bufferProcessing=!0;var r=e.bufferedRequest;if(t._writev&&r&&r.next){var n=e.bufferedRequestCount,i=new Array(n),o=e.corkedRequestsFree;o.entry=r;for(var a=0,u=!0;r;)i[a]=r,r.isBuf||(u=!1),r=r.next,a+=1;i.allBuffers=u,g(t,e,!0,e.length,i,"",o.finish),e.pendingcb++,e.lastBufferedRequest=null,o.next?(e.corkedRequestsFree=o.next,o.next=null):e.corkedRequestsFree=new s(e),e.bufferedRequestCount=0}else{for(;r;){var h=r.chunk,f=r.encoding,c=r.callback;if(g(t,e,!1,e.objectMode?1:h.length,h,f,c),r=r.next,e.bufferedRequestCount--,e.writing)break}null===r&&(e.lastBufferedRequest=null)}e.bufferedRequest=r,e.bufferProcessing=!1}function M(t){return t.ending&&0===t.length&&null===t.bufferedRequest&&!t.finished&&!t.writing}function S(t,e){t._final((function(r){e.pendingcb--,r&&t.emit("error",r),e.prefinished=!0,t.emit("prefinish"),O(t,e)}))}function O(t,e){var r=M(e);return r&&(!function(t,e){e.prefinished||e.finalCalled||("function"==typeof t._final?(e.pendingcb++,e.finalCalled=!0,o.nextTick(S,t,e)):(e.prefinished=!0,t.emit("prefinish")))}(t,e),0===e.pendingcb&&(e.finished=!0,t.emit("finish"))),r}h.inherits(v,c),b.prototype.getBuffer=function(){for(var t=this.bufferedRequest,e=[];t;)e.push(t),t=t.next;return e},function(){try{Object.defineProperty(b.prototype,"buffer",{get:f.deprecate((function(){return this.getBuffer()}),"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(t){}}(),"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(p=Function.prototype[Symbol.hasInstance],Object.defineProperty(v,Symbol.hasInstance,{value:function(t){return!!p.call(this,t)||this===v&&(t&&t._writableState instanceof b)}})):p=function(t){return t instanceof this},v.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))},v.prototype.write=function(t,e,r){var n,i=this._writableState,s=!1,a=!i.objectMode&&(n=t,l.isBuffer(n)||n instanceof d);return a&&!l.isBuffer(t)&&(t=function(t){return l.from(t)}(t)),"function"==typeof e&&(r=e,e=null),a?e="buffer":e||(e=i.defaultEncoding),"function"!=typeof r&&(r=y),i.ended?function(t,e){var r=new Error("write after end");t.emit("error",r),o.nextTick(e,r)}(this,r):(a||function(t,e,r,n){var i=!0,s=!1;return null===r?s=new TypeError("May not write null values to stream"):"string"==typeof r||void 0===r||e.objectMode||(s=new TypeError("Invalid non-string/buffer chunk")),s&&(t.emit("error",s),o.nextTick(n,s),i=!1),i}(this,i,t,r))&&(i.pendingcb++,s=function(t,e,r,n,i,o){if(!r){var s=function(t,e,r){t.objectMode||!1===t.decodeStrings||"string"!=typeof e||(e=l.from(e,r));return e}(e,n,i);n!==s&&(r=!0,i="buffer",n=s)}var a=e.objectMode?1:n.length;e.length+=a;var u=e.length<e.highWaterMark;u||(e.needDrain=!0);if(e.writing||e.corked){var h=e.lastBufferedRequest;e.lastBufferedRequest={chunk:n,encoding:i,isBuf:r,callback:o,next:null},h?h.next=e.lastBufferedRequest:e.bufferedRequest=e.lastBufferedRequest,e.bufferedRequestCount+=1}else g(t,e,!1,a,n,i,o);return u}(this,i,a,t,e,r)),s},v.prototype.cork=function(){this._writableState.corked++},v.prototype.uncork=function(){var t=this._writableState;t.corked&&(t.corked--,t.writing||t.corked||t.finished||t.bufferProcessing||!t.bufferedRequest||_(this,t))},v.prototype.setDefaultEncoding=function(t){if("string"==typeof t&&(t=t.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((t+"").toLowerCase())>-1))throw new TypeError("Unknown encoding: "+t);return this._writableState.defaultEncoding=t,this},Object.defineProperty(v.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),v.prototype._write=function(t,e,r){r(new Error("_write() is not implemented"))},v.prototype._writev=null,v.prototype.end=function(t,e,r){var n=this._writableState;"function"==typeof t?(r=t,t=null,e=null):"function"==typeof e&&(r=e,e=null),null!=t&&this.write(t,e),n.corked&&(n.corked=1,this.uncork()),n.ending||n.finished||function(t,e,r){e.ending=!0,O(t,e),r&&(e.finished?o.nextTick(r):t.once("finish",r));e.ended=!0,t.writable=!1}(this,n,r)},Object.defineProperty(v.prototype,"destroyed",{get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(t){this._writableState&&(this._writableState.destroyed=t)}}),v.prototype.destroy=m.destroy,v.prototype._undestroy=m.undestroy,v.prototype._destroy=function(t,e){this.end(),e(t)}}).call(this,r(5),r(110).setImmediate,r(7))},function(t,e,r){"use strict";var n=r(12);function i(t){this.options=t,this.type=this.options.type,this.blockSize=8,this._init(),this.buffer=new Array(this.blockSize),this.bufferOff=0}t.exports=i,i.prototype._init=function(){},i.prototype.update=function(t){return 0===t.length?[]:"decrypt"===this.type?this._updateDecrypt(t):this._updateEncrypt(t)},i.prototype._buffer=function(t,e){for(var r=Math.min(this.buffer.length-this.bufferOff,t.length-e),n=0;n<r;n++)this.buffer[this.bufferOff+n]=t[e+n];return this.bufferOff+=r,r},i.prototype._flushBuffer=function(t,e){return this._update(this.buffer,0,t,e),this.bufferOff=0,this.blockSize},i.prototype._updateEncrypt=function(t){var e=0,r=0,n=(this.bufferOff+t.length)/this.blockSize|0,i=new Array(n*this.blockSize);0!==this.bufferOff&&(e+=this._buffer(t,e),this.bufferOff===this.buffer.length&&(r+=this._flushBuffer(i,r)));for(var o=t.length-(t.length-e)%this.blockSize;e<o;e+=this.blockSize)this._update(t,e,i,r),r+=this.blockSize;for(;e<t.length;e++,this.bufferOff++)this.buffer[this.bufferOff]=t[e];return i},i.prototype._updateDecrypt=function(t){for(var e=0,r=0,n=Math.ceil((this.bufferOff+t.length)/this.blockSize)-1,i=new Array(n*this.blockSize);n>0;n--)e+=this._buffer(t,e),r+=this._flushBuffer(i,r);return e+=this._buffer(t,e),i},i.prototype.final=function(t){var e,r;return t&&(e=this.update(t)),r="encrypt"===this.type?this._finalEncrypt():this._finalDecrypt(),e?e.concat(r):r},i.prototype._pad=function(t,e){if(0===e)return!1;for(;e<t.length;)t[e++]=0;return!0},i.prototype._finalEncrypt=function(){if(!this._pad(this.buffer,this.bufferOff))return[];var t=new Array(this.blockSize);return this._update(this.buffer,0,t,0),t},i.prototype._unpad=function(t){return t},i.prototype._finalDecrypt=function(){n.equal(this.bufferOff,this.blockSize,"Not enough data to decrypt");var t=new Array(this.blockSize);return this._flushBuffer(t,0),this._unpad(t)}},function(t,e,r){var n=r(223),i=r(231),o=r(124);e.createCipher=e.Cipher=n.createCipher,e.createCipheriv=e.Cipheriv=n.createCipheriv,e.createDecipher=e.Decipher=i.createDecipher,e.createDecipheriv=e.Decipheriv=i.createDecipheriv,e.listCiphers=e.getCiphers=function(){return Object.keys(o)}},function(t,e,r){var n={ECB:r(224),CBC:r(225),CFB:r(226),CFB8:r(227),CFB1:r(228),OFB:r(229),CTR:r(122),GCM:r(122)},i=r(124);for(var o in i)i[o].module=n[i[o].mode];t.exports=i},function(t,e,r){function n(t){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var i;function o(t){this.rand=t}if(t.exports=function(t){return i||(i=new o(null)),i.generate(t)},t.exports.Rand=o,o.prototype.generate=function(t){return this._rand(t)},o.prototype._rand=function(t){if(this.rand.getBytes)return this.rand.getBytes(t);for(var e=new Uint8Array(t),r=0;r<e.length;r++)e[r]=this.rand.getByte();return e},"object"===("undefined"==typeof self?"undefined":n(self)))self.crypto&&self.crypto.getRandomValues?o.prototype._rand=function(t){var e=new Uint8Array(t);return self.crypto.getRandomValues(e),e}:self.msCrypto&&self.msCrypto.getRandomValues?o.prototype._rand=function(t){var e=new Uint8Array(t);return self.msCrypto.getRandomValues(e),e}:"object"===("undefined"==typeof window?"undefined":n(window))&&(o.prototype._rand=function(){throw new Error("Not implemented yet")});else try{var s=r(237);if("function"!=typeof s.randomBytes)throw new Error("Not supported");o.prototype._rand=function(t){return s.randomBytes(t)}}catch(t){}},function(t,e,r){
591
+ var w=function(t,e){return(w=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,e)};function _(t,e){function r(){this.constructor=t}w(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}var M=function(){return(M=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var i in e=arguments[r])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t}).apply(this,arguments)},S=function(t){function e(r){var n=t.call(this,r)||this;return Object.setPrototypeOf(n,e.prototype),n}return _(e,t),Object.defineProperty(e.prototype,"name",{get:function(){return"BSONError"},enumerable:!1,configurable:!0}),e}(Error),O=function(t){function e(r){var n=t.call(this,r)||this;return Object.setPrototypeOf(n,e.prototype),n}return _(e,t),Object.defineProperty(e.prototype,"name",{get:function(){return"BSONTypeError"},enumerable:!1,configurable:!0}),e}(TypeError);function A(t){return t&&t.Math==Math&&t}function E(){return A("object"===("undefined"==typeof globalThis?"undefined":n(globalThis))&&globalThis)||A("object"===("undefined"==typeof window?"undefined":n(window))&&window)||A("object"===("undefined"==typeof self?"undefined":n(self))&&self)||A("object"===(void 0===t?"undefined":n(t))&&t)||Function("return this")()}function x(t){return t.toString().replace("function(","function (")}var k=function(t){var e,r="object"===n((e=E()).navigator)&&"ReactNative"===e.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(r);for(var i=g.alloc(t),o=0;o<t;++o)i[o]=Math.floor(256*Math.random());return i},j=function(){if("undefined"!=typeof window){var e=window.crypto||window.msCrypto;if(e&&e.getRandomValues)return function(t){return e.getRandomValues(g.alloc(t))}}if(void 0!==t&&t.crypto&&t.crypto.getRandomValues)return function(e){return t.crypto.getRandomValues(g.alloc(e))};var n;try{n=r(190).randomBytes}catch(t){}return n||k}();function $(t){return["[object ArrayBuffer]","[object SharedArrayBuffer]"].includes(Object.prototype.toString.call(t))}function R(t){return"[object Uint8Array]"===Object.prototype.toString.call(t)}function P(t){return"[object BigInt64Array]"===Object.prototype.toString.call(t)}function B(t){return"[object BigUint64Array]"===Object.prototype.toString.call(t)}function T(t){return"[object RegExp]"===Object.prototype.toString.call(t)}function I(t){return N(t)&&"[object Date]"===Object.prototype.toString.call(t)}function N(t){return"object"===n(t)&&null!==t}function D(t,e){var r=!1;return function(){for(var n=[],i=0;i<arguments.length;i++)n[i]=arguments[i];return r||(console.warn(e),r=!0),t.apply(this,n)}}function C(t){if(ArrayBuffer.isView(t))return g.from(t.buffer,t.byteOffset,t.byteLength);if($(t))return g.from(t);throw new O("Must use either Buffer or TypedArray")}var L=/^(?:[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,q=function(t){return"string"==typeof t&&L.test(t)},U=function(t){if(!q(t))throw new O('UUID string representations must be a 32 or 36 character hex string (dashes excluded/included). Format: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" or "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx".');var e=t.replace(/-/g,"");return g.from(e,"hex")},F=function(t,e){return void 0===e&&(e=!0),e?t.toString("hex",0,4)+"-"+t.toString("hex",4,6)+"-"+t.toString("hex",6,8)+"-"+t.toString("hex",8,10)+"-"+t.toString("hex",10,16):t.toString("hex")},z=Symbol("id"),V=function(){function t(e){if(void 0===e)this.id=t.generate();else if(e instanceof t)this[z]=g.from(e.id),this.__id=e.__id;else if(ArrayBuffer.isView(e)&&16===e.byteLength)this.id=C(e);else{if("string"!=typeof e)throw new O("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=U(e)}}return Object.defineProperty(t.prototype,"id",{get:function(){return this[z]},set:function(e){this[z]=e,t.cacheHexString&&(this.__id=F(e))},enumerable:!1,configurable:!0}),t.prototype.toHexString=function(e){if(void 0===e&&(e=!0),t.cacheHexString&&this.__id)return this.__id;var r=F(this.id,e);return t.cacheHexString&&(this.__id=r),r},t.prototype.toString=function(t){return t?this.id.toString(t):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(t){return!1}},t.prototype.toBinary=function(){return new K(this.id,K.SUBTYPE_UUID)},t.generate=function(){var t=j(16);return t[6]=15&t[6]|64,t[8]=63&t[8]|128,g.from(t)},t.isValid=function(e){if(!e)return!1;if(e instanceof t)return!0;if("string"==typeof e)return q(e);if(R(e)){if(16!==e.length)return!1;try{return parseInt(e[6].toString(16)[0],10)===K.SUBTYPE_UUID}catch(t){return!1}}return!1},t.createFromHexString=function(e){return new t(U(e))},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){return'new UUID("'+this.toHexString()+'")'},t}();Object.defineProperty(V.prototype,"_bsontype",{value:"UUID"});var K=function(){function t(e,r){if(!(this instanceof t))return new t(e,r);if(!(null==e||"string"==typeof e||ArrayBuffer.isView(e)||e instanceof ArrayBuffer||Array.isArray(e)))throw new O("Binary can only be constructed from string, Buffer, TypedArray, or Array<number>");this.sub_type=null!=r?r:t.BSON_BINARY_SUBTYPE_DEFAULT,null==e?(this.buffer=g.alloc(t.BUFFER_SIZE),this.position=0):("string"==typeof e?this.buffer=g.from(e,"binary"):Array.isArray(e)?this.buffer=g.from(e):this.buffer=C(e),this.position=this.buffer.byteLength)}return t.prototype.put=function(e){if("string"==typeof e&&1!==e.length)throw new O("only accepts single character String");if("number"!=typeof e&&1!==e.length)throw new O("only accepts single character Uint8Array or Array");var r;if((r="string"==typeof e?e.charCodeAt(0):"number"==typeof e?e:e[0])<0||r>255)throw new O("only accepts number in a valid unsigned byte range 0-255");if(this.buffer.length>this.position)this.buffer[this.position++]=r;else{var n=g.alloc(t.BUFFER_SIZE+this.buffer.length);this.buffer.copy(n,0,0,this.buffer.length),this.buffer=n,this.buffer[this.position++]=r}},t.prototype.write=function(t,e){if(e="number"==typeof e?e:this.position,this.buffer.length<e+t.length){var r=g.alloc(this.buffer.length+t.length);this.buffer.copy(r,0,0,this.buffer.length),this.buffer=r}ArrayBuffer.isView(t)?(this.buffer.set(C(t),e),this.position=e+t.byteLength>this.position?e+t.length:this.position):"string"==typeof t&&(this.buffer.write(t,e,t.length,"binary"),this.position=e+t.length>this.position?e+t.length:this.position)},t.prototype.read=function(t,e){return e=e&&e>0?e:this.position,this.buffer.slice(t,t+e)},t.prototype.value=function(t){return(t=!!t)&&this.buffer.length===this.position?this.buffer:t?this.buffer.slice(0,this.position):this.buffer.toString("binary",0,this.position)},t.prototype.length=function(){return this.position},t.prototype.toJSON=function(){return this.buffer.toString("base64")},t.prototype.toString=function(t){return this.buffer.toString(t)},t.prototype.toExtendedJSON=function(t){t=t||{};var e=this.buffer.toString("base64"),r=Number(this.sub_type).toString(16);return t.legacy?{$binary:e,$type:1===r.length?"0"+r:r}:{$binary:{base64:e,subType:1===r.length?"0"+r:r}}},t.prototype.toUUID=function(){if(this.sub_type===t.SUBTYPE_UUID)return new V(this.buffer.slice(0,this.position));throw new S('Binary sub_type "'+this.sub_type+'" is not supported for converting to UUID. Only "'+t.SUBTYPE_UUID+'" is currently supported.')},t.fromExtendedJSON=function(e,r){var n,i;if(r=r||{},"$binary"in e?r.legacy&&"string"==typeof e.$binary&&"$type"in e?(i=e.$type?parseInt(e.$type,16):0,n=g.from(e.$binary,"base64")):"string"!=typeof e.$binary&&(i=e.$binary.subType?parseInt(e.$binary.subType,16):0,n=g.from(e.$binary.base64,"base64")):"$uuid"in e&&(i=4,n=U(e.$uuid)),!n)throw new O("Unexpected Binary Extended JSON format "+JSON.stringify(e));return new t(n,i)},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){return'new Binary(Buffer.from("'+this.value(!0).toString("hex")+'", "hex"), '+this.sub_type+")"},t.BSON_BINARY_SUBTYPE_DEFAULT=0,t.BUFFER_SIZE=256,t.SUBTYPE_DEFAULT=0,t.SUBTYPE_FUNCTION=1,t.SUBTYPE_BYTE_ARRAY=2,t.SUBTYPE_UUID_OLD=3,t.SUBTYPE_UUID=4,t.SUBTYPE_MD5=5,t.SUBTYPE_ENCRYPTED=6,t.SUBTYPE_COLUMN=7,t.SUBTYPE_USER_DEFINED=128,t}();Object.defineProperty(K.prototype,"_bsontype",{value:"Binary"});var H=function(){function t(e,r){if(!(this instanceof t))return new t(e,r);this.code=e,this.scope=r}return t.prototype.toJSON=function(){return{code:this.code,scope:this.scope}},t.prototype.toExtendedJSON=function(){return this.scope?{$code:this.code,$scope:this.scope}:{$code:this.code}},t.fromExtendedJSON=function(e){return new t(e.$code,e.$scope)},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){var t=this.toJSON();return'new Code("'+t.code+'"'+(t.scope?", "+JSON.stringify(t.scope):"")+")"},t}();function W(t){return N(t)&&null!=t.$id&&"string"==typeof t.$ref&&(null==t.$db||"string"==typeof t.$db)}Object.defineProperty(H.prototype,"_bsontype",{value:"Code"});var Z=function(){function t(e,r,n,i){if(!(this instanceof t))return new t(e,r,n,i);var o=e.split(".");2===o.length&&(n=o.shift(),e=o.shift()),this.collection=e,this.oid=r,this.db=n,this.fields=i||{}}return Object.defineProperty(t.prototype,"namespace",{get:function(){return this.collection},set:function(t){this.collection=t},enumerable:!1,configurable:!0}),t.prototype.toJSON=function(){var t=Object.assign({$ref:this.collection,$id:this.oid},this.fields);return null!=this.db&&(t.$db=this.db),t},t.prototype.toExtendedJSON=function(t){t=t||{};var e={$ref:this.collection,$id:this.oid};return t.legacy?e:(this.db&&(e.$db=this.db),e=Object.assign(e,this.fields))},t.fromExtendedJSON=function(e){var r=Object.assign({},e);return delete r.$ref,delete r.$id,delete r.$db,new t(e.$ref,e.$id,e.$db,r)},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){var t=void 0===this.oid||void 0===this.oid.toString?this.oid:this.oid.toString();return'new DBRef("'+this.namespace+'", new ObjectId("'+t+'")'+(this.db?', "'+this.db+'"':"")+")"},t}();Object.defineProperty(Z.prototype,"_bsontype",{value:"DBRef"});var J=void 0;try{J=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(t){}var Y={},G={},Q=function(){function t(e,r,n){if(void 0===e&&(e=0),!(this instanceof t))return new t(e,r,n);"bigint"==typeof e?Object.assign(this,t.fromBigInt(e,!!r)):"string"==typeof e?Object.assign(this,t.fromString(e,!!r)):(this.low=0|e,this.high=0|r,this.unsigned=!!n),Object.defineProperty(this,"__isLong__",{value:!0,configurable:!1,writable:!1,enumerable:!1})}return t.fromBits=function(e,r,n){return new t(e,r,n)},t.fromInt=function(e,r){var n,i,o;return r?(o=0<=(e>>>=0)&&e<256)&&(i=G[e])?i:(n=t.fromBits(e,(0|e)<0?-1:0,!0),o&&(G[e]=n),n):(o=-128<=(e|=0)&&e<128)&&(i=Y[e])?i:(n=t.fromBits(e,e<0?-1:0,!1),o&&(Y[e]=n),n)},t.fromNumber=function(e,r){if(isNaN(e))return r?t.UZERO:t.ZERO;if(r){if(e<0)return t.UZERO;if(e>=0x10000000000000000)return t.MAX_UNSIGNED_VALUE}else{if(e<=-0x8000000000000000)return t.MIN_VALUE;if(e+1>=0x8000000000000000)return t.MAX_VALUE}return e<0?t.fromNumber(-e,r).neg():t.fromBits(e%4294967296|0,e/4294967296|0,r)},t.fromBigInt=function(e,r){return t.fromString(e.toString(),r)},t.fromString=function(e,r,n){if(0===e.length)throw Error("empty string");if("NaN"===e||"Infinity"===e||"+Infinity"===e||"-Infinity"===e)return t.ZERO;if("number"==typeof r?(n=r,r=!1):r=!!r,(n=n||10)<2||36<n)throw RangeError("radix");var i;if((i=e.indexOf("-"))>0)throw Error("interior hyphen");if(0===i)return t.fromString(e.substring(1),r,n).neg();for(var o=t.fromNumber(Math.pow(n,8)),s=t.ZERO,a=0;a<e.length;a+=8){var u=Math.min(8,e.length-a),h=parseInt(e.substring(a,a+u),n);if(u<8){var f=t.fromNumber(Math.pow(n,u));s=s.mul(f).add(t.fromNumber(h))}else s=(s=s.mul(o)).add(t.fromNumber(h))}return s.unsigned=r,s},t.fromBytes=function(e,r,n){return n?t.fromBytesLE(e,r):t.fromBytesBE(e,r)},t.fromBytesLE=function(e,r){return new t(e[0]|e[1]<<8|e[2]<<16|e[3]<<24,e[4]|e[5]<<8|e[6]<<16|e[7]<<24,r)},t.fromBytesBE=function(e,r){return new t(e[4]<<24|e[5]<<16|e[6]<<8|e[7],e[0]<<24|e[1]<<16|e[2]<<8|e[3],r)},t.isLong=function(t){return N(t)&&!0===t.__isLong__},t.fromValue=function(e,r){return"number"==typeof e?t.fromNumber(e,r):"string"==typeof e?t.fromString(e,r):t.fromBits(e.low,e.high,"boolean"==typeof r?r:e.unsigned)},t.prototype.add=function(e){t.isLong(e)||(e=t.fromValue(e));var r=this.high>>>16,n=65535&this.high,i=this.low>>>16,o=65535&this.low,s=e.high>>>16,a=65535&e.high,u=e.low>>>16,h=0,f=0,c=0,l=0;return c+=(l+=o+(65535&e.low))>>>16,l&=65535,f+=(c+=i+u)>>>16,c&=65535,h+=(f+=n+a)>>>16,f&=65535,h+=r+s,h&=65535,t.fromBits(c<<16|l,h<<16|f,this.unsigned)},t.prototype.and=function(e){return t.isLong(e)||(e=t.fromValue(e)),t.fromBits(this.low&e.low,this.high&e.high,this.unsigned)},t.prototype.compare=function(e){if(t.isLong(e)||(e=t.fromValue(e)),this.eq(e))return 0;var r=this.isNegative(),n=e.isNegative();return r&&!n?-1:!r&&n?1:this.unsigned?e.high>>>0>this.high>>>0||e.high===this.high&&e.low>>>0>this.low>>>0?-1:1:this.sub(e).isNegative()?-1:1},t.prototype.comp=function(t){return this.compare(t)},t.prototype.divide=function(e){if(t.isLong(e)||(e=t.fromValue(e)),e.isZero())throw Error("division by zero");if(J){if(!this.unsigned&&-2147483648===this.high&&-1===e.low&&-1===e.high)return this;var r=(this.unsigned?J.div_u:J.div_s)(this.low,this.high,e.low,e.high);return t.fromBits(r,J.get_high(),this.unsigned)}if(this.isZero())return this.unsigned?t.UZERO:t.ZERO;var n,i,o;if(this.unsigned){if(e.unsigned||(e=e.toUnsigned()),e.gt(this))return t.UZERO;if(e.gt(this.shru(1)))return t.UONE;o=t.UZERO}else{if(this.eq(t.MIN_VALUE))return e.eq(t.ONE)||e.eq(t.NEG_ONE)?t.MIN_VALUE:e.eq(t.MIN_VALUE)?t.ONE:(n=this.shr(1).div(e).shl(1)).eq(t.ZERO)?e.isNegative()?t.ONE:t.NEG_ONE:(i=this.sub(e.mul(n)),o=n.add(i.div(e)));if(e.eq(t.MIN_VALUE))return this.unsigned?t.UZERO:t.ZERO;if(this.isNegative())return e.isNegative()?this.neg().div(e.neg()):this.neg().div(e).neg();if(e.isNegative())return this.div(e.neg()).neg();o=t.ZERO}for(i=this;i.gte(e);){n=Math.max(1,Math.floor(i.toNumber()/e.toNumber()));for(var s=Math.ceil(Math.log(n)/Math.LN2),a=s<=48?1:Math.pow(2,s-48),u=t.fromNumber(n),h=u.mul(e);h.isNegative()||h.gt(i);)n-=a,h=(u=t.fromNumber(n,this.unsigned)).mul(e);u.isZero()&&(u=t.ONE),o=o.add(u),i=i.sub(h)}return o},t.prototype.div=function(t){return this.divide(t)},t.prototype.equals=function(e){return t.isLong(e)||(e=t.fromValue(e)),(this.unsigned===e.unsigned||this.high>>>31!=1||e.high>>>31!=1)&&(this.high===e.high&&this.low===e.low)},t.prototype.eq=function(t){return this.equals(t)},t.prototype.getHighBits=function(){return this.high},t.prototype.getHighBitsUnsigned=function(){return this.high>>>0},t.prototype.getLowBits=function(){return this.low},t.prototype.getLowBitsUnsigned=function(){return this.low>>>0},t.prototype.getNumBitsAbs=function(){if(this.isNegative())return this.eq(t.MIN_VALUE)?64:this.neg().getNumBitsAbs();var e,r=0!==this.high?this.high:this.low;for(e=31;e>0&&0==(r&1<<e);e--);return 0!==this.high?e+33:e+1},t.prototype.greaterThan=function(t){return this.comp(t)>0},t.prototype.gt=function(t){return this.greaterThan(t)},t.prototype.greaterThanOrEqual=function(t){return this.comp(t)>=0},t.prototype.gte=function(t){return this.greaterThanOrEqual(t)},t.prototype.ge=function(t){return this.greaterThanOrEqual(t)},t.prototype.isEven=function(){return 0==(1&this.low)},t.prototype.isNegative=function(){return!this.unsigned&&this.high<0},t.prototype.isOdd=function(){return 1==(1&this.low)},t.prototype.isPositive=function(){return this.unsigned||this.high>=0},t.prototype.isZero=function(){return 0===this.high&&0===this.low},t.prototype.lessThan=function(t){return this.comp(t)<0},t.prototype.lt=function(t){return this.lessThan(t)},t.prototype.lessThanOrEqual=function(t){return this.comp(t)<=0},t.prototype.lte=function(t){return this.lessThanOrEqual(t)},t.prototype.modulo=function(e){if(t.isLong(e)||(e=t.fromValue(e)),J){var r=(this.unsigned?J.rem_u:J.rem_s)(this.low,this.high,e.low,e.high);return t.fromBits(r,J.get_high(),this.unsigned)}return this.sub(this.div(e).mul(e))},t.prototype.mod=function(t){return this.modulo(t)},t.prototype.rem=function(t){return this.modulo(t)},t.prototype.multiply=function(e){if(this.isZero())return t.ZERO;if(t.isLong(e)||(e=t.fromValue(e)),J){var r=J.mul(this.low,this.high,e.low,e.high);return t.fromBits(r,J.get_high(),this.unsigned)}if(e.isZero())return t.ZERO;if(this.eq(t.MIN_VALUE))return e.isOdd()?t.MIN_VALUE:t.ZERO;if(e.eq(t.MIN_VALUE))return this.isOdd()?t.MIN_VALUE:t.ZERO;if(this.isNegative())return e.isNegative()?this.neg().mul(e.neg()):this.neg().mul(e).neg();if(e.isNegative())return this.mul(e.neg()).neg();if(this.lt(t.TWO_PWR_24)&&e.lt(t.TWO_PWR_24))return t.fromNumber(this.toNumber()*e.toNumber(),this.unsigned);var n=this.high>>>16,i=65535&this.high,o=this.low>>>16,s=65535&this.low,a=e.high>>>16,u=65535&e.high,h=e.low>>>16,f=65535&e.low,c=0,l=0,d=0,p=0;return d+=(p+=s*f)>>>16,p&=65535,l+=(d+=o*f)>>>16,d&=65535,l+=(d+=s*h)>>>16,d&=65535,c+=(l+=i*f)>>>16,l&=65535,c+=(l+=o*h)>>>16,l&=65535,c+=(l+=s*u)>>>16,l&=65535,c+=n*f+i*h+o*u+s*a,c&=65535,t.fromBits(d<<16|p,c<<16|l,this.unsigned)},t.prototype.mul=function(t){return this.multiply(t)},t.prototype.negate=function(){return!this.unsigned&&this.eq(t.MIN_VALUE)?t.MIN_VALUE:this.not().add(t.ONE)},t.prototype.neg=function(){return this.negate()},t.prototype.not=function(){return t.fromBits(~this.low,~this.high,this.unsigned)},t.prototype.notEquals=function(t){return!this.equals(t)},t.prototype.neq=function(t){return this.notEquals(t)},t.prototype.ne=function(t){return this.notEquals(t)},t.prototype.or=function(e){return t.isLong(e)||(e=t.fromValue(e)),t.fromBits(this.low|e.low,this.high|e.high,this.unsigned)},t.prototype.shiftLeft=function(e){return t.isLong(e)&&(e=e.toInt()),0==(e&=63)?this:e<32?t.fromBits(this.low<<e,this.high<<e|this.low>>>32-e,this.unsigned):t.fromBits(0,this.low<<e-32,this.unsigned)},t.prototype.shl=function(t){return this.shiftLeft(t)},t.prototype.shiftRight=function(e){return t.isLong(e)&&(e=e.toInt()),0==(e&=63)?this:e<32?t.fromBits(this.low>>>e|this.high<<32-e,this.high>>e,this.unsigned):t.fromBits(this.high>>e-32,this.high>=0?0:-1,this.unsigned)},t.prototype.shr=function(t){return this.shiftRight(t)},t.prototype.shiftRightUnsigned=function(e){if(t.isLong(e)&&(e=e.toInt()),0===(e&=63))return this;var r=this.high;if(e<32){var n=this.low;return t.fromBits(n>>>e|r<<32-e,r>>>e,this.unsigned)}return 32===e?t.fromBits(r,0,this.unsigned):t.fromBits(r>>>e-32,0,this.unsigned)},t.prototype.shr_u=function(t){return this.shiftRightUnsigned(t)},t.prototype.shru=function(t){return this.shiftRightUnsigned(t)},t.prototype.subtract=function(e){return t.isLong(e)||(e=t.fromValue(e)),this.add(e.neg())},t.prototype.sub=function(t){return this.subtract(t)},t.prototype.toInt=function(){return this.unsigned?this.low>>>0:this.low},t.prototype.toNumber=function(){return this.unsigned?4294967296*(this.high>>>0)+(this.low>>>0):4294967296*this.high+(this.low>>>0)},t.prototype.toBigInt=function(){return BigInt(this.toString())},t.prototype.toBytes=function(t){return t?this.toBytesLE():this.toBytesBE()},t.prototype.toBytesLE=function(){var t=this.high,e=this.low;return[255&e,e>>>8&255,e>>>16&255,e>>>24,255&t,t>>>8&255,t>>>16&255,t>>>24]},t.prototype.toBytesBE=function(){var t=this.high,e=this.low;return[t>>>24,t>>>16&255,t>>>8&255,255&t,e>>>24,e>>>16&255,e>>>8&255,255&e]},t.prototype.toSigned=function(){return this.unsigned?t.fromBits(this.low,this.high,!1):this},t.prototype.toString=function(e){if((e=e||10)<2||36<e)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative()){if(this.eq(t.MIN_VALUE)){var r=t.fromNumber(e),n=this.div(r),i=n.mul(r).sub(this);return n.toString(e)+i.toInt().toString(e)}return"-"+this.neg().toString(e)}for(var o=t.fromNumber(Math.pow(e,6),this.unsigned),s=this,a="";;){var u=s.div(o),h=(s.sub(u.mul(o)).toInt()>>>0).toString(e);if((s=u).isZero())return h+a;for(;h.length<6;)h="0"+h;a=""+h+a}},t.prototype.toUnsigned=function(){return this.unsigned?this:t.fromBits(this.low,this.high,!0)},t.prototype.xor=function(e){return t.isLong(e)||(e=t.fromValue(e)),t.fromBits(this.low^e.low,this.high^e.high,this.unsigned)},t.prototype.eqz=function(){return this.isZero()},t.prototype.le=function(t){return this.lessThanOrEqual(t)},t.prototype.toExtendedJSON=function(t){return t&&t.relaxed?this.toNumber():{$numberLong:this.toString()}},t.fromExtendedJSON=function(e,r){var n=t.fromString(e.$numberLong);return r&&r.relaxed?n.toNumber():n},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){return'new Long("'+this.toString()+'"'+(this.unsigned?", true":"")+")"},t.TWO_PWR_24=t.fromInt(1<<24),t.MAX_UNSIGNED_VALUE=t.fromBits(-1,-1,!0),t.ZERO=t.fromInt(0),t.UZERO=t.fromInt(0,!0),t.ONE=t.fromInt(1),t.UONE=t.fromInt(1,!0),t.NEG_ONE=t.fromInt(-1),t.MAX_VALUE=t.fromBits(-1,2147483647,!1),t.MIN_VALUE=t.fromBits(0,-2147483648,!1),t}();Object.defineProperty(Q.prototype,"__isLong__",{value:!0}),Object.defineProperty(Q.prototype,"_bsontype",{value:"Long"});var X=/^(\+|-)?(\d+|(\d*\.\d*))?(E|e)?([-+])?(\d+)?$/,tt=/^(\+|-)?(Infinity|inf)$/i,et=/^(\+|-)?NaN$/i,rt=[124,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0].reverse(),nt=[248,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0].reverse(),it=[120,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0].reverse(),ot=/^([-+])?(\d+)?$/;function st(t){return!isNaN(parseInt(t,10))}function at(t){var e=Q.fromNumber(1e9),r=Q.fromNumber(0);if(!(t.parts[0]||t.parts[1]||t.parts[2]||t.parts[3]))return{quotient:t,rem:r};for(var n=0;n<=3;n++)r=(r=r.shiftLeft(32)).add(new Q(t.parts[n],0)),t.parts[n]=r.div(e).low,r=r.modulo(e);return{quotient:t,rem:r}}function ut(t,e){throw new O('"'+t+'" is not a valid Decimal128 string - '+e)}var ht=function(){function t(e){if(!(this instanceof t))return new t(e);this.bytes="string"==typeof e?t.fromString(e).bytes:e}return t.fromString=function(e){var r,n=!1,i=!1,o=!1,s=0,a=0,u=0,h=0,f=0,c=[0],l=0,d=0,p=0,m=0,y=0,b=0,v=new Q(0,0),w=new Q(0,0),_=0;if(e.length>=7e3)throw new O(e+" not a valid Decimal128 string");var M=e.match(X),S=e.match(tt),A=e.match(et);if(!M&&!S&&!A||0===e.length)throw new O(e+" not a valid Decimal128 string");if(M){var E=M[2],x=M[4],k=M[5],j=M[6];x&&void 0===j&&ut(e,"missing exponent power"),x&&void 0===E&&ut(e,"missing exponent base"),void 0===x&&(k||j)&&ut(e,"missing e before exponent")}if("+"!==e[_]&&"-"!==e[_]||(n="-"===e[_++]),!st(e[_])&&"."!==e[_]){if("i"===e[_]||"I"===e[_])return new t(g.from(n?nt:it));if("N"===e[_])return new t(g.from(rt))}for(;st(e[_])||"."===e[_];)"."!==e[_]?(l<34&&("0"!==e[_]||o)&&(o||(f=a),o=!0,c[d++]=parseInt(e[_],10),l+=1),o&&(u+=1),i&&(h+=1),a+=1,_+=1):(i&&ut(e,"contains multiple periods"),i=!0,_+=1);if(i&&!a)throw new O(e+" not a valid Decimal128 string");if("e"===e[_]||"E"===e[_]){var $=e.substr(++_).match(ot);if(!$||!$[2])return new t(g.from(rt));y=parseInt($[0],10),_+=$[0].length}if(e[_])return new t(g.from(rt));if(p=0,l){if(m=l-1,1!==(s=u))for(;0===c[f+s-1];)s-=1}else p=0,m=0,c[0]=0,u=1,l=1,s=0;for(y<=h&&h-y>16384?y=-6176:y-=h;y>6111;){if((m+=1)-p>34){if(c.join("").match(/^0+$/)){y=6111;break}ut(e,"overflow")}y-=1}for(;y<-6176||l<u;){if(0===m&&s<l){y=-6176,s=0;break}if(l<u?u-=1:m-=1,y<6111)y+=1;else{if(c.join("").match(/^0+$/)){y=6111;break}ut(e,"overflow")}}if(m-p+1<s){var R=a;i&&(f+=1,R+=1),n&&(f+=1,R+=1);var P=parseInt(e[f+m+1],10),B=0;if(P>=5&&(B=1,5===P))for(B=c[m]%2==1?1:0,b=f+m+2;b<R;b++)if(parseInt(e[b],10)){B=1;break}if(B)for(var T=m;T>=0;T--)if(++c[T]>9&&(c[T]=0,0===T)){if(!(y<6111))return new t(g.from(n?nt:it));y+=1,c[T]=1}}if(v=Q.fromNumber(0),w=Q.fromNumber(0),0===s)v=Q.fromNumber(0),w=Q.fromNumber(0);else if(m-p<17){T=p;for(w=Q.fromNumber(c[T++]),v=new Q(0,0);T<=m;T++)w=(w=w.multiply(Q.fromNumber(10))).add(Q.fromNumber(c[T]))}else{T=p;for(v=Q.fromNumber(c[T++]);T<=m-17;T++)v=(v=v.multiply(Q.fromNumber(10))).add(Q.fromNumber(c[T]));for(w=Q.fromNumber(c[T++]);T<=m;T++)w=(w=w.multiply(Q.fromNumber(10))).add(Q.fromNumber(c[T]))}var I,N,D,C,L=function(t,e){if(!t&&!e)return{high:Q.fromNumber(0),low:Q.fromNumber(0)};var r=t.shiftRightUnsigned(32),n=new Q(t.getLowBits(),0),i=e.shiftRightUnsigned(32),o=new Q(e.getLowBits(),0),s=r.multiply(i),a=r.multiply(o),u=n.multiply(i),h=n.multiply(o);return s=s.add(a.shiftRightUnsigned(32)),a=new Q(a.getLowBits(),0).add(u).add(h.shiftRightUnsigned(32)),{high:s=s.add(a.shiftRightUnsigned(32)),low:h=a.shiftLeft(32).add(new Q(h.getLowBits(),0))}}(v,Q.fromString("100000000000000000"));L.low=L.low.add(w),I=L.low,N=w,D=I.high>>>0,C=N.high>>>0,(D<C||D===C&&I.low>>>0<N.low>>>0)&&(L.high=L.high.add(Q.fromNumber(1))),r=y+6176;var q={low:Q.fromNumber(0),high:Q.fromNumber(0)};L.high.shiftRightUnsigned(49).and(Q.fromNumber(1)).equals(Q.fromNumber(1))?(q.high=q.high.or(Q.fromNumber(3).shiftLeft(61)),q.high=q.high.or(Q.fromNumber(r).and(Q.fromNumber(16383).shiftLeft(47))),q.high=q.high.or(L.high.and(Q.fromNumber(0x7fffffffffff)))):(q.high=q.high.or(Q.fromNumber(16383&r).shiftLeft(49)),q.high=q.high.or(L.high.and(Q.fromNumber(562949953421311)))),q.low=L.low,n&&(q.high=q.high.or(Q.fromString("9223372036854775808")));var U=g.alloc(16);return _=0,U[_++]=255&q.low.low,U[_++]=q.low.low>>8&255,U[_++]=q.low.low>>16&255,U[_++]=q.low.low>>24&255,U[_++]=255&q.low.high,U[_++]=q.low.high>>8&255,U[_++]=q.low.high>>16&255,U[_++]=q.low.high>>24&255,U[_++]=255&q.high.low,U[_++]=q.high.low>>8&255,U[_++]=q.high.low>>16&255,U[_++]=q.high.low>>24&255,U[_++]=255&q.high.high,U[_++]=q.high.high>>8&255,U[_++]=q.high.high>>16&255,U[_++]=q.high.high>>24&255,new t(U)},t.prototype.toString=function(){for(var t,e=0,r=new Array(36),n=0;n<r.length;n++)r[n]=0;var i,o,s,a=0,u=!1,h={parts:[0,0,0,0]},f=[];a=0;var c=this.bytes,l=c[a++]|c[a++]<<8|c[a++]<<16|c[a++]<<24,d=c[a++]|c[a++]<<8|c[a++]<<16|c[a++]<<24,p=c[a++]|c[a++]<<8|c[a++]<<16|c[a++]<<24,m=c[a++]|c[a++]<<8|c[a++]<<16|c[a++]<<24;a=0,{low:new Q(l,d),high:new Q(p,m)}.high.lessThan(Q.ZERO)&&f.push("-");var y=m>>26&31;if(y>>3==3){if(30===y)return f.join("")+"Infinity";if(31===y)return"NaN";t=m>>15&16383,i=8+(m>>14&1)}else i=m>>14&7,t=m>>17&16383;var b=t-6176;if(h.parts[0]=(16383&m)+((15&i)<<14),h.parts[1]=p,h.parts[2]=d,h.parts[3]=l,0===h.parts[0]&&0===h.parts[1]&&0===h.parts[2]&&0===h.parts[3])u=!0;else for(s=3;s>=0;s--){var v=0,g=at(h);if(h=g.quotient,v=g.rem.low)for(o=8;o>=0;o--)r[9*s+o]=v%10,v=Math.floor(v/10)}if(u)e=1,r[a]=0;else for(e=36;!r[a];)e-=1,a+=1;var w=e-1+b;if(w>=34||w<=-7||b>0){if(e>34)return f.push("0"),b>0?f.push("E+"+b):b<0&&f.push("E"+b),f.join("");f.push(""+r[a++]),(e-=1)&&f.push(".");for(n=0;n<e;n++)f.push(""+r[a++]);f.push("E"),w>0?f.push("+"+w):f.push(""+w)}else if(b>=0)for(n=0;n<e;n++)f.push(""+r[a++]);else{var _=e+b;if(_>0)for(n=0;n<_;n++)f.push(""+r[a++]);else f.push("0");for(f.push(".");_++<0;)f.push("0");for(n=0;n<e-Math.max(_-1,0);n++)f.push(""+r[a++])}return f.join("")},t.prototype.toJSON=function(){return{$numberDecimal:this.toString()}},t.prototype.toExtendedJSON=function(){return{$numberDecimal:this.toString()}},t.fromExtendedJSON=function(e){return t.fromString(e.$numberDecimal)},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){return'new Decimal128("'+this.toString()+'")'},t}();Object.defineProperty(ht.prototype,"_bsontype",{value:"Decimal128"});var ft=function(){function t(e){if(!(this instanceof t))return new t(e);e instanceof Number&&(e=e.valueOf()),this.value=+e}return t.prototype.valueOf=function(){return this.value},t.prototype.toJSON=function(){return this.value},t.prototype.toString=function(t){return this.value.toString(t)},t.prototype.toExtendedJSON=function(t){return t&&(t.legacy||t.relaxed&&isFinite(this.value))?this.value:Object.is(Math.sign(this.value),-0)?{$numberDouble:"-"+this.value.toFixed(1)}:(Number.isInteger(this.value)?(e=this.value.toFixed(1)).length>=13&&(e=this.value.toExponential(13).toUpperCase()):e=this.value.toString(),{$numberDouble:e});var e},t.fromExtendedJSON=function(e,r){var n=parseFloat(e.$numberDouble);return r&&r.relaxed?n:new t(n)},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){return"new Double("+this.toExtendedJSON().$numberDouble+")"},t}();Object.defineProperty(ft.prototype,"_bsontype",{value:"Double"});var ct=function(){function t(e){if(!(this instanceof t))return new t(e);e instanceof Number&&(e=e.valueOf()),this.value=0|+e}return t.prototype.valueOf=function(){return this.value},t.prototype.toString=function(t){return this.value.toString(t)},t.prototype.toJSON=function(){return this.value},t.prototype.toExtendedJSON=function(t){return t&&(t.relaxed||t.legacy)?this.value:{$numberInt:this.value.toString()}},t.fromExtendedJSON=function(e,r){return r&&r.relaxed?parseInt(e.$numberInt,10):new t(e.$numberInt)},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){return"new Int32("+this.valueOf()+")"},t}();Object.defineProperty(ct.prototype,"_bsontype",{value:"Int32"});var lt=function(){function t(){if(!(this instanceof t))return new t}return t.prototype.toExtendedJSON=function(){return{$maxKey:1}},t.fromExtendedJSON=function(){return new t},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){return"new MaxKey()"},t}();Object.defineProperty(lt.prototype,"_bsontype",{value:"MaxKey"});var dt=function(){function t(){if(!(this instanceof t))return new t}return t.prototype.toExtendedJSON=function(){return{$minKey:1}},t.fromExtendedJSON=function(){return new t},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){return"new MinKey()"},t}();Object.defineProperty(dt.prototype,"_bsontype",{value:"MinKey"});var pt=new RegExp("^[0-9a-fA-F]{24}$"),mt=null,yt=Symbol("id"),bt=function(){function t(e){if(!(this instanceof t))return new t(e);var r;if("object"===n(e)&&e&&"id"in e){if("string"!=typeof e.id&&!ArrayBuffer.isView(e.id))throw new O("Argument passed in must have an id that is of type string or Buffer");r="toHexString"in e&&"function"==typeof e.toHexString?g.from(e.toHexString(),"hex"):e.id}else r=e;if(null==r||"number"==typeof r)this[yt]=t.generate("number"==typeof r?r:void 0);else if(ArrayBuffer.isView(r)&&12===r.byteLength)this[yt]=C(r);else{if("string"!=typeof r)throw new O("Argument passed in does not match the accepted types");if(12===r.length){var i=g.from(r);if(12!==i.byteLength)throw new O("Argument passed in must be a string of 12 bytes");this[yt]=i}else{if(24!==r.length||!pt.test(r))throw new O("Argument passed in must be a string of 12 bytes or a string of 24 hex characters");this[yt]=g.from(r,"hex")}}t.cacheHexString&&(this.__id=this.id.toString("hex"))}return Object.defineProperty(t.prototype,"id",{get:function(){return this[yt]},set:function(e){this[yt]=e,t.cacheHexString&&(this.__id=e.toString("hex"))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"generationTime",{get:function(){return this.id.readInt32BE(0)},set:function(t){this.id.writeUInt32BE(t,0)},enumerable:!1,configurable:!0}),t.prototype.toHexString=function(){if(t.cacheHexString&&this.__id)return this.__id;var e=this.id.toString("hex");return t.cacheHexString&&!this.__id&&(this.__id=e),e},t.getInc=function(){return t.index=(t.index+1)%16777215},t.generate=function(e){"number"!=typeof e&&(e=Math.floor(Date.now()/1e3));var r=t.getInc(),n=g.alloc(12);return n.writeUInt32BE(e,0),null===mt&&(mt=j(5)),n[4]=mt[0],n[5]=mt[1],n[6]=mt[2],n[7]=mt[3],n[8]=mt[4],n[11]=255&r,n[10]=r>>8&255,n[9]=r>>16&255,n},t.prototype.toString=function(t){return t?this.id.toString(t):this.toHexString()},t.prototype.toJSON=function(){return this.toHexString()},t.prototype.equals=function(e){return null!=e&&(e instanceof t?this.toString()===e.toString():"string"==typeof e&&t.isValid(e)&&12===e.length&&R(this.id)?e===g.prototype.toString.call(this.id,"latin1"):"string"==typeof e&&t.isValid(e)&&24===e.length?e.toLowerCase()===this.toHexString():"string"==typeof e&&t.isValid(e)&&12===e.length?g.from(e).equals(this.id):"object"===n(e)&&"toHexString"in e&&"function"==typeof e.toHexString&&e.toHexString()===this.toHexString())},t.prototype.getTimestamp=function(){var t=new Date,e=this.id.readUInt32BE(0);return t.setTime(1e3*Math.floor(e)),t},t.createPk=function(){return new t},t.createFromTime=function(e){var r=g.from([0,0,0,0,0,0,0,0,0,0,0,0]);return r.writeUInt32BE(e,0),new t(r)},t.createFromHexString=function(e){if(void 0===e||null!=e&&24!==e.length)throw new O("Argument passed in must be a single String of 12 bytes or a string of 24 hex characters");return new t(g.from(e,"hex"))},t.isValid=function(e){return null!=e&&("number"==typeof e||("string"==typeof e?12===e.length||24===e.length&&pt.test(e):e instanceof t||(!(!R(e)||12!==e.length)||"object"===n(e)&&"toHexString"in e&&"function"==typeof e.toHexString&&("string"==typeof e.id?12===e.id.length:24===e.toHexString().length&&pt.test(e.id.toString("hex"))))))},t.prototype.toExtendedJSON=function(){return this.toHexString?{$oid:this.toHexString()}:{$oid:this.toString("hex")}},t.fromExtendedJSON=function(e){return new t(e.$oid)},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){return'new ObjectId("'+this.toHexString()+'")'},t.index=Math.floor(16777215*Math.random()),t}();Object.defineProperty(bt.prototype,"generate",{value:D((function(t){return bt.generate(t)}),"Please use the static `ObjectId.generate(time)` instead")}),Object.defineProperty(bt.prototype,"getInc",{value:D((function(){return bt.getInc()}),"Please use the static `ObjectId.getInc()` instead")}),Object.defineProperty(bt.prototype,"get_inc",{value:D((function(){return bt.getInc()}),"Please use the static `ObjectId.getInc()` instead")}),Object.defineProperty(bt,"get_inc",{value:D((function(){return bt.getInc()}),"Please use the static `ObjectId.getInc()` instead")}),Object.defineProperty(bt.prototype,"_bsontype",{value:"ObjectID"});var vt=function(){function t(e,r){if(!(this instanceof t))return new t(e,r);if(this.pattern=e,this.options=(null!=r?r:"").split("").sort().join(""),-1!==this.pattern.indexOf("\0"))throw new S("BSON Regex patterns cannot contain null bytes, found: "+JSON.stringify(this.pattern));if(-1!==this.options.indexOf("\0"))throw new S("BSON Regex options cannot contain null bytes, found: "+JSON.stringify(this.options));for(var n=0;n<this.options.length;n++)if("i"!==this.options[n]&&"m"!==this.options[n]&&"x"!==this.options[n]&&"l"!==this.options[n]&&"s"!==this.options[n]&&"u"!==this.options[n])throw new S("The regular expression option ["+this.options[n]+"] is not supported")}return t.parseOptions=function(t){return t?t.split("").sort().join(""):""},t.prototype.toExtendedJSON=function(t){return(t=t||{}).legacy?{$regex:this.pattern,$options:this.options}:{$regularExpression:{pattern:this.pattern,options:this.options}}},t.fromExtendedJSON=function(e){if("$regex"in e){if("string"==typeof e.$regex)return new t(e.$regex,t.parseOptions(e.$options));if("BSONRegExp"===e.$regex._bsontype)return e}if("$regularExpression"in e)return new t(e.$regularExpression.pattern,t.parseOptions(e.$regularExpression.options));throw new O("Unexpected BSONRegExp EJSON object form: "+JSON.stringify(e))},t}();Object.defineProperty(vt.prototype,"_bsontype",{value:"BSONRegExp"});var gt=function(){function t(e){if(!(this instanceof t))return new t(e);this.value=e}return t.prototype.valueOf=function(){return this.value},t.prototype.toString=function(){return this.value},t.prototype.inspect=function(){return'new BSONSymbol("'+this.value+'")'},t.prototype.toJSON=function(){return this.value},t.prototype.toExtendedJSON=function(){return{$symbol:this.value}},t.fromExtendedJSON=function(e){return new t(e.$symbol)},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t}();Object.defineProperty(gt.prototype,"_bsontype",{value:"Symbol"});var wt=Q,_t=function(t){function e(r,n){var i=this;return i instanceof e?(i=Q.isLong(r)?t.call(this,r.low,r.high,!0)||this:N(r)&&void 0!==r.t&&void 0!==r.i?t.call(this,r.i,r.t,!0)||this:t.call(this,r,n,!0)||this,Object.defineProperty(i,"_bsontype",{value:"Timestamp",writable:!1,configurable:!1,enumerable:!1}),i):new e(r,n)}return _(e,t),e.prototype.toJSON=function(){return{$timestamp:this.toString()}},e.fromInt=function(t){return new e(Q.fromInt(t,!0))},e.fromNumber=function(t){return new e(Q.fromNumber(t,!0))},e.fromBits=function(t,r){return new e(t,r)},e.fromString=function(t,r){return new e(Q.fromString(t,!0,r))},e.prototype.toExtendedJSON=function(){return{$timestamp:{t:this.high>>>0,i:this.low>>>0}}},e.fromExtendedJSON=function(t){return new e(t.$timestamp)},e.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},e.prototype.inspect=function(){return"new Timestamp({ t: "+this.getHighBits()+", i: "+this.getLowBits()+" })"},e.MAX_VALUE=Q.MAX_UNSIGNED_VALUE,e}(wt);function Mt(t){return N(t)&&Reflect.has(t,"_bsontype")&&"string"==typeof t._bsontype}var St={$oid:bt,$binary:K,$uuid:K,$symbol:gt,$numberInt:ct,$numberDecimal:ht,$numberDouble:ft,$numberLong:Q,$minKey:dt,$maxKey:lt,$regex:vt,$regularExpression:vt,$timestamp:_t};function Ot(t){var e=t.toISOString();return 0!==t.getUTCMilliseconds()?e:e.slice(0,-5)+"Z"}function At(t,e){if(("object"===n(t)||"function"==typeof t)&&null!==t){var r=e.seenObjects.findIndex((function(e){return e.obj===t}));if(-1!==r){var i=e.seenObjects.map((function(t){return t.propertyName})),o=i.slice(0,r).map((function(t){return t+" -> "})).join(""),s=i[r],a=" -> "+i.slice(r+1,i.length-1).map((function(t){return t+" -> "})).join(""),u=i[i.length-1],h=" ".repeat(o.length+s.length/2),f="-".repeat(a.length+(s.length+u.length)/2-1);throw new O("Converting circular structure to EJSON:\n "+o+s+a+u+"\n "+h+"\\"+f+"/")}e.seenObjects[e.seenObjects.length-1].obj=t}if(Array.isArray(t))return function(t,e){return t.map((function(t,r){e.seenObjects.push({propertyName:"index "+r,obj:null});try{return At(t,e)}finally{e.seenObjects.pop()}}))}(t,e);if(void 0===t)return null;if(t instanceof Date||I(t)){var c=t.getTime(),l=c>-1&&c<2534023188e5;return e.legacy?e.relaxed&&l?{$date:t.getTime()}:{$date:Ot(t)}:e.relaxed&&l?{$date:Ot(t)}:{$date:{$numberLong:t.getTime().toString()}}}if(!("number"!=typeof t||e.relaxed&&isFinite(t))){if(Math.floor(t)===t){var d=t>=-0x8000000000000000&&t<=0x8000000000000000;if(t>=-2147483648&&t<=2147483647)return{$numberInt:t.toString()};if(d)return{$numberLong:t.toString()}}return{$numberDouble:t.toString()}}if(t instanceof RegExp||T(t)){var p=t.flags;if(void 0===p){var m=t.toString().match(/[gimuy]*$/);m&&(p=m[0])}return new vt(t.source,p).toExtendedJSON(e)}return null!=t&&"object"===n(t)?function(t,e){if(null==t||"object"!==n(t))throw new S("not an object instance");var r=t._bsontype;if(void 0===r){var i={};for(var o in t){e.seenObjects.push({propertyName:o,obj:null});try{i[o]=At(t[o],e)}finally{e.seenObjects.pop()}}return i}if(Mt(t)){var s=t;if("function"!=typeof s.toExtendedJSON){var a=kt[t._bsontype];if(!a)throw new O("Unrecognized or invalid _bsontype: "+t._bsontype);s=a(s)}return"Code"===r&&s.scope?s=new H(s.code,At(s.scope,e)):"DBRef"===r&&s.oid&&(s=new Z(At(s.collection,e),At(s.oid,e),At(s.db,e),At(s.fields,e))),s.toExtendedJSON(e)}throw new S("_bsontype must be a string, but was: "+n(r))}(t,e):t}var Et,xt,kt={Binary:function(t){return new K(t.value(),t.sub_type)},Code:function(t){return new H(t.code,t.scope)},DBRef:function(t){return new Z(t.collection||t.namespace,t.oid,t.db,t.fields)},Decimal128:function(t){return new ht(t.bytes)},Double:function(t){return new ft(t.value)},Int32:function(t){return new ct(t.value)},Long:function(t){return Q.fromBits(null!=t.low?t.low:t.low_,null!=t.low?t.high:t.high_,null!=t.low?t.unsigned:t.unsigned_)},MaxKey:function(){return new lt},MinKey:function(){return new dt},ObjectID:function(t){return new bt(t)},ObjectId:function(t){return new bt(t)},BSONRegExp:function(t){return new vt(t.pattern,t.options)},Symbol:function(t){return new gt(t.value)},Timestamp:function(t){return _t.fromBits(t.low,t.high)}};!function(t){function e(t,e){var r=Object.assign({},{relaxed:!0,legacy:!1},e);return"boolean"==typeof r.relaxed&&(r.strict=!r.relaxed),"boolean"==typeof r.strict&&(r.relaxed=!r.strict),JSON.parse(t,(function(t,e){if(-1!==t.indexOf("\0"))throw new S("BSON Document field names cannot contain null bytes, found: "+JSON.stringify(t));return function t(e,r){if(void 0===r&&(r={}),"number"==typeof e){if(r.relaxed||r.legacy)return e;if(Math.floor(e)===e){if(e>=-2147483648&&e<=2147483647)return new ct(e);if(e>=-0x8000000000000000&&e<=0x8000000000000000)return Q.fromNumber(e)}return new ft(e)}if(null==e||"object"!==n(e))return e;if(e.$undefined)return null;for(var i=Object.keys(e).filter((function(t){return t.startsWith("$")&&null!=e[t]})),o=0;o<i.length;o++){var s=St[i[o]];if(s)return s.fromExtendedJSON(e,r)}if(null!=e.$date){var a=e.$date,u=new Date;return r.legacy?"number"==typeof a?u.setTime(a):"string"==typeof a&&u.setTime(Date.parse(a)):"string"==typeof a?u.setTime(Date.parse(a)):Q.isLong(a)?u.setTime(a.toNumber()):"number"==typeof a&&r.relaxed&&u.setTime(a),u}if(null!=e.$code){var h=Object.assign({},e);return e.$scope&&(h.$scope=t(e.$scope)),H.fromExtendedJSON(e)}if(W(e)||e.$dbPointer){var f=e.$ref?e:e.$dbPointer;if(f instanceof Z)return f;var c=Object.keys(f).filter((function(t){return t.startsWith("$")})),l=!0;if(c.forEach((function(t){-1===["$ref","$id","$db"].indexOf(t)&&(l=!1)})),l)return Z.fromExtendedJSON(f)}return e}(e,r)}))}function r(t,e,r,i){null!=r&&"object"===n(r)&&(i=r,r=0),null==e||"object"!==n(e)||Array.isArray(e)||(i=e,e=void 0,r=0);var o=At(t,Object.assign({relaxed:!0,legacy:!1},i,{seenObjects:[{propertyName:"(root)",obj:null}]}));return JSON.stringify(o,e,r)}t.parse=e,t.stringify=r,t.serialize=function(t,e){return e=e||{},JSON.parse(r(t,e))},t.deserialize=function(t,r){return r=r||{},e(JSON.stringify(t),r)}}(Et||(Et={}));var jt=E();xt=jt.Map?jt.Map:function(){function t(t){void 0===t&&(t=[]),this._keys=[],this._values={};for(var e=0;e<t.length;e++)if(null!=t[e]){var r=t[e],n=r[0],i=r[1];this._keys.push(n),this._values[n]={v:i,i:this._keys.length-1}}}return t.prototype.clear=function(){this._keys=[],this._values={}},t.prototype.delete=function(t){var e=this._values[t];return null!=e&&(delete this._values[t],this._keys.splice(e.i,1),!0)},t.prototype.entries=function(){var t=this,e=0;return{next:function(){var r=t._keys[e++];return{value:void 0!==r?[r,t._values[r].v]:void 0,done:void 0===r}}}},t.prototype.forEach=function(t,e){e=e||this;for(var r=0;r<this._keys.length;r++){var n=this._keys[r];t.call(e,this._values[n].v,n,e)}},t.prototype.get=function(t){return this._values[t]?this._values[t].v:void 0},t.prototype.has=function(t){return null!=this._values[t]},t.prototype.keys=function(){var t=this,e=0;return{next:function(){var r=t._keys[e++];return{value:void 0!==r?r:void 0,done:void 0===r}}}},t.prototype.set=function(t,e){return this._values[t]?(this._values[t].v=e,this):(this._keys.push(t),this._values[t]={v:e,i:this._keys.length-1},this)},t.prototype.values=function(){var t=this,e=0;return{next:function(){var r=t._keys[e++];return{value:void 0!==r?t._values[r].v:void 0,done:void 0===r}}}},Object.defineProperty(t.prototype,"size",{get:function(){return this._keys.length},enumerable:!1,configurable:!0}),t}();var $t=2147483647,Rt=-2147483648,Pt=Math.pow(2,63)-1,Bt=-Math.pow(2,63),Tt=Math.pow(2,53),It=-Math.pow(2,53),Nt=1,Dt=2,Ct=3,Lt=4,qt=5,Ut=6,Ft=7,zt=8,Vt=9,Kt=10,Ht=11,Wt=12,Zt=13,Jt=14,Yt=15,Gt=16,Qt=17,Xt=18,te=19,ee=255,re=127,ne=0,ie=1,oe=2,se=3,ae=4,ue=5,he=6,fe=7,ce=128;function le(t,e,r){var n=5;if(Array.isArray(t))for(var i=0;i<t.length;i++)n+=de(i.toString(),t[i],e,!0,r);else for(var o in t.toBSON&&(t=t.toBSON()),t)n+=de(o,t[o],e,!1,r);return n}function de(t,e,r,i,o){switch(void 0===r&&(r=!1),void 0===i&&(i=!1),void 0===o&&(o=!1),e&&e.toBSON&&(e=e.toBSON()),n(e)){case"string":return 1+g.byteLength(t,"utf8")+1+4+g.byteLength(e,"utf8")+1;case"number":return Math.floor(e)===e&&e>=It&&e<=Tt&&e>=Rt&&e<=$t?(null!=t?g.byteLength(t,"utf8")+1:0)+5:(null!=t?g.byteLength(t,"utf8")+1:0)+9;case"undefined":return i||!o?(null!=t?g.byteLength(t,"utf8")+1:0)+1:0;case"boolean":return(null!=t?g.byteLength(t,"utf8")+1:0)+2;case"object":if(null==e||"MinKey"===e._bsontype||"MaxKey"===e._bsontype)return(null!=t?g.byteLength(t,"utf8")+1:0)+1;if("ObjectId"===e._bsontype||"ObjectID"===e._bsontype)return(null!=t?g.byteLength(t,"utf8")+1:0)+13;if(e instanceof Date||I(e))return(null!=t?g.byteLength(t,"utf8")+1:0)+9;if(ArrayBuffer.isView(e)||e instanceof ArrayBuffer||$(e))return(null!=t?g.byteLength(t,"utf8")+1:0)+6+e.byteLength;if("Long"===e._bsontype||"Double"===e._bsontype||"Timestamp"===e._bsontype)return(null!=t?g.byteLength(t,"utf8")+1:0)+9;if("Decimal128"===e._bsontype)return(null!=t?g.byteLength(t,"utf8")+1:0)+17;if("Code"===e._bsontype)return null!=e.scope&&Object.keys(e.scope).length>0?(null!=t?g.byteLength(t,"utf8")+1:0)+1+4+4+g.byteLength(e.code.toString(),"utf8")+1+le(e.scope,r,o):(null!=t?g.byteLength(t,"utf8")+1:0)+1+4+g.byteLength(e.code.toString(),"utf8")+1;if("Binary"===e._bsontype)return e.sub_type===K.SUBTYPE_BYTE_ARRAY?(null!=t?g.byteLength(t,"utf8")+1:0)+(e.position+1+4+1+4):(null!=t?g.byteLength(t,"utf8")+1:0)+(e.position+1+4+1);if("Symbol"===e._bsontype)return(null!=t?g.byteLength(t,"utf8")+1:0)+g.byteLength(e.value,"utf8")+4+1+1;if("DBRef"===e._bsontype){var s=Object.assign({$ref:e.collection,$id:e.oid},e.fields);return null!=e.db&&(s.$db=e.db),(null!=t?g.byteLength(t,"utf8")+1:0)+1+le(s,r,o)}return e instanceof RegExp||T(e)?(null!=t?g.byteLength(t,"utf8")+1:0)+1+g.byteLength(e.source,"utf8")+1+(e.global?1:0)+(e.ignoreCase?1:0)+(e.multiline?1:0)+1:"BSONRegExp"===e._bsontype?(null!=t?g.byteLength(t,"utf8")+1:0)+1+g.byteLength(e.pattern,"utf8")+1+g.byteLength(e.options,"utf8")+1:(null!=t?g.byteLength(t,"utf8")+1:0)+le(e,r,o)+1;case"function":if(e instanceof RegExp||T(e)||"[object RegExp]"===String.call(e))return(null!=t?g.byteLength(t,"utf8")+1:0)+1+g.byteLength(e.source,"utf8")+1+(e.global?1:0)+(e.ignoreCase?1:0)+(e.multiline?1:0)+1;if(r&&null!=e.scope&&Object.keys(e.scope).length>0)return(null!=t?g.byteLength(t,"utf8")+1:0)+1+4+4+g.byteLength(x(e),"utf8")+1+le(e.scope,r,o);if(r)return(null!=t?g.byteLength(t,"utf8")+1:0)+1+4+g.byteLength(x(e),"utf8")+1}return 0}function pe(t,e,r){for(var n=0,i=e;i<r;i+=1){var o=t[i];if(n){if(128!=(192&o))return!1;n-=1}else if(128&o)if(192==(224&o))n=1;else if(224==(240&o))n=2;else{if(240!=(248&o))return!1;n=3}}return!n}var me=Q.fromNumber(Tt),ye=Q.fromNumber(It),be={};function ve(t,e,r){var n=(e=null==e?{}:e)&&e.index?e.index:0,i=t[n]|t[n+1]<<8|t[n+2]<<16|t[n+3]<<24;if(i<5)throw new S("bson size must be >= 5, is "+i);if(e.allowObjectSmallerThanBufferSize&&t.length<i)throw new S("buffer length "+t.length+" must be >= bson size "+i);if(!e.allowObjectSmallerThanBufferSize&&t.length!==i)throw new S("buffer length "+t.length+" must === bson size "+i);if(i+n>t.byteLength)throw new S("(bson size "+i+" + options.index "+n+" must be <= buffer length "+t.byteLength+")");if(0!==t[n+i-1])throw new S("One object, sized correctly, with a spot for an EOO, but the EOO isn't 0x00");return function t(e,r,n,i){void 0===i&&(i=!1);var o,s=null!=n.evalFunctions&&n.evalFunctions,a=null!=n.cacheFunctions&&n.cacheFunctions,u=null==n.fieldsAsRaw?null:n.fieldsAsRaw,h=null!=n.raw&&n.raw,f="boolean"==typeof n.bsonRegExp&&n.bsonRegExp,c=null!=n.promoteBuffers&&n.promoteBuffers,l=null==n.promoteLongs||n.promoteLongs,d=null==n.promoteValues||n.promoteValues,p=null==n.validation?{utf8:!0}:n.validation,m=!0,y=new Set,b=p.utf8;if("boolean"==typeof b)o=b;else{m=!1;var v=Object.keys(b).map((function(t){return b[t]}));if(0===v.length)throw new S("UTF-8 validation setting cannot be empty");if("boolean"!=typeof v[0])throw new S("Invalid UTF-8 validation option, must specify boolean values");if(o=v[0],!v.every((function(t){return t===o})))throw new S("Invalid UTF-8 validation option - keys must be all true or all false")}if(!m)for(var w=0,_=Object.keys(b);w<_.length;w++){var O=_[w];y.add(O)}var A=r;if(e.length<5)throw new S("corrupt bson message < 5 bytes long");var E=e[r++]|e[r++]<<8|e[r++]<<16|e[r++]<<24;if(E<5||E>e.length)throw new S("corrupt bson message");var x=i?[]:{},k=0,j=!i&&null;for(;;){var $=e[r++];if(0===$)break;for(var R=r;0!==e[R]&&R<e.length;)R++;if(R>=e.byteLength)throw new S("Bad BSON Document: illegal CString");var P=i?k++:e.toString("utf8",r,R),B=!0;B=m||y.has(P)?o:!o,!1!==j&&"$"===P[0]&&(j=ge.test(P));var T=void 0;if(r=R+1,$===Dt){if((pt=e[r++]|e[r++]<<8|e[r++]<<16|e[r++]<<24)<=0||pt>e.length-r||0!==e[r+pt-1])throw new S("bad string length in bson");T=_e(e,r,r+pt-1,B),r+=pt}else if($===Ft){var I=g.alloc(12);e.copy(I,0,r,r+12),T=new bt(I),r+=12}else if($===Gt&&!1===d)T=new ct(e[r++]|e[r++]<<8|e[r++]<<16|e[r++]<<24);else if($===Gt)T=e[r++]|e[r++]<<8|e[r++]<<16|e[r++]<<24;else if($===Nt&&!1===d)T=new ft(e.readDoubleLE(r)),r+=8;else if($===Nt)T=e.readDoubleLE(r),r+=8;else if($===Vt){var N=e[r++]|e[r++]<<8|e[r++]<<16|e[r++]<<24,D=e[r++]|e[r++]<<8|e[r++]<<16|e[r++]<<24;T=new Date(new Q(N,D).toNumber())}else if($===zt){if(0!==e[r]&&1!==e[r])throw new S("illegal boolean type value");T=1===e[r++]}else if($===Ct){var C=r;if((q=e[r]|e[r+1]<<8|e[r+2]<<16|e[r+3]<<24)<=0||q>e.length-r)throw new S("bad embedded document length in bson");if(h)T=e.slice(r,r+q);else{var L=n;m||(L=M(M({},n),{validation:{utf8:B}})),T=t(e,C,L,!1)}r+=q}else if($===Lt){C=r;var q=e[r]|e[r+1]<<8|e[r+2]<<16|e[r+3]<<24,U=n,F=r+q;if(u&&u[P]){for(var z in U={},n)U[z]=n[z];U.raw=!0}if(m||(U=M(M({},U),{validation:{utf8:B}})),T=t(e,C,U,!0),0!==e[(r+=q)-1])throw new S("invalid array terminator byte");if(r!==F)throw new S("corrupted array bson")}else if($===Ut)T=void 0;else if($===Kt)T=null;else if($===Xt){N=e[r++]|e[r++]<<8|e[r++]<<16|e[r++]<<24,D=e[r++]|e[r++]<<8|e[r++]<<16|e[r++]<<24;var V=new Q(N,D);T=l&&!0===d&&V.lessThanOrEqual(me)&&V.greaterThanOrEqual(ye)?V.toNumber():V}else if($===te){var J=g.alloc(16);e.copy(J,0,r,r+16),r+=16;var Y=new ht(J);T="toObject"in Y&&"function"==typeof Y.toObject?Y.toObject():Y}else if($===qt){var G=e[r++]|e[r++]<<8|e[r++]<<16|e[r++]<<24,X=G,tt=e[r++];if(G<0)throw new S("Negative binary type element size found");if(G>e.byteLength)throw new S("Binary type size larger than document size");if(null!=e.slice){if(tt===K.SUBTYPE_BYTE_ARRAY){if((G=e[r++]|e[r++]<<8|e[r++]<<16|e[r++]<<24)<0)throw new S("Negative binary type element size found for subtype 0x02");if(G>X-4)throw new S("Binary type with subtype 0x02 contains too long binary size");if(G<X-4)throw new S("Binary type with subtype 0x02 contains too short binary size")}T=c&&d?e.slice(r,r+G):new K(e.slice(r,r+G),tt)}else{var et=g.alloc(G);if(tt===K.SUBTYPE_BYTE_ARRAY){if((G=e[r++]|e[r++]<<8|e[r++]<<16|e[r++]<<24)<0)throw new S("Negative binary type element size found for subtype 0x02");if(G>X-4)throw new S("Binary type with subtype 0x02 contains too long binary size");if(G<X-4)throw new S("Binary type with subtype 0x02 contains too short binary size")}for(R=0;R<G;R++)et[R]=e[r+R];T=c&&d?et:new K(et,tt)}r+=G}else if($===Ht&&!1===f){for(R=r;0!==e[R]&&R<e.length;)R++;if(R>=e.length)throw new S("Bad BSON Document: illegal CString");var rt=e.toString("utf8",r,R);for(R=r=R+1;0!==e[R]&&R<e.length;)R++;if(R>=e.length)throw new S("Bad BSON Document: illegal CString");var nt=e.toString("utf8",r,R);r=R+1;var it=new Array(nt.length);for(R=0;R<nt.length;R++)switch(nt[R]){case"m":it[R]="m";break;case"s":it[R]="g";break;case"i":it[R]="i"}T=new RegExp(rt,it.join(""))}else if($===Ht&&!0===f){for(R=r;0!==e[R]&&R<e.length;)R++;if(R>=e.length)throw new S("Bad BSON Document: illegal CString");rt=e.toString("utf8",r,R);for(R=r=R+1;0!==e[R]&&R<e.length;)R++;if(R>=e.length)throw new S("Bad BSON Document: illegal CString");nt=e.toString("utf8",r,R);r=R+1,T=new vt(rt,nt)}else if($===Jt){if((pt=e[r++]|e[r++]<<8|e[r++]<<16|e[r++]<<24)<=0||pt>e.length-r||0!==e[r+pt-1])throw new S("bad string length in bson");var ot=_e(e,r,r+pt-1,B);T=d?ot:new gt(ot),r+=pt}else if($===Qt){N=e[r++]|e[r++]<<8|e[r++]<<16|e[r++]<<24,D=e[r++]|e[r++]<<8|e[r++]<<16|e[r++]<<24;T=new _t(N,D)}else if($===ee)T=new dt;else if($===re)T=new lt;else if($===Zt){if((pt=e[r++]|e[r++]<<8|e[r++]<<16|e[r++]<<24)<=0||pt>e.length-r||0!==e[r+pt-1])throw new S("bad string length in bson");var st=_e(e,r,r+pt-1,B);T=s?a?we(st,be,x):we(st):new H(st),r+=pt}else if($===Yt){var at=e[r++]|e[r++]<<8|e[r++]<<16|e[r++]<<24;if(at<13)throw new S("code_w_scope total size shorter minimum expected length");if((pt=e[r++]|e[r++]<<8|e[r++]<<16|e[r++]<<24)<=0||pt>e.length-r||0!==e[r+pt-1])throw new S("bad string length in bson");st=_e(e,r,r+pt-1,B),C=r+=pt,q=e[r]|e[r+1]<<8|e[r+2]<<16|e[r+3]<<24;var ut=t(e,C,n,!1);if(r+=q,at<8+q+pt)throw new S("code_w_scope total size is too short, truncating scope");if(at>8+q+pt)throw new S("code_w_scope total size is too long, clips outer document");s?(T=a?we(st,be,x):we(st)).scope=ut:T=new H(st,ut)}else{if($!==Wt)throw new S("Detected unknown BSON type "+$.toString(16)+' for fieldname "'+P+'"');var pt;if((pt=e[r++]|e[r++]<<8|e[r++]<<16|e[r++]<<24)<=0||pt>e.length-r||0!==e[r+pt-1])throw new S("bad string length in bson");if(null!=p&&p.utf8&&!pe(e,r,r+pt-1))throw new S("Invalid UTF-8 string in BSON document");var mt=e.toString("utf8",r,r+pt-1);r+=pt;var yt=g.alloc(12);e.copy(yt,0,r,r+12);I=new bt(yt);r+=12,T=new Z(mt,I)}"__proto__"===P?Object.defineProperty(x,P,{value:T,writable:!0,enumerable:!0,configurable:!0}):x[P]=T}if(E!==r-A){if(i)throw new S("corrupt array bson");throw new S("corrupt object bson")}if(!j)return x;if(W(x)){var wt=Object.assign({},x);return delete wt.$ref,delete wt.$id,delete wt.$db,new Z(x.$ref,x.$id,x.$db,wt)}return x}(t,n,e,r)}var ge=/^\$ref$|^\$id$|^\$db$/;function we(t,e,r){return e?(null==e[t]&&(e[t]=new Function(t)),e[t].bind(r)):new Function(t)}function _e(t,e,r,n){var i=t.toString("utf8",e,r);if(n)for(var o=0;o<i.length;o++)if(65533===i.charCodeAt(o)){if(!pe(t,e,r))throw new S("Invalid UTF-8 string in BSON document");break}return i}function Me(t,e,r,n,i,o){var s,a,u,h="big"===n,f=8*o-i-1,c=(1<<f)-1,l=c>>1,d=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,p=h?o-1:0,m=h?-1:1,y=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,s=c):(s=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-s))<1&&(s--,u*=2),(e+=s+l>=1?d/u:d*Math.pow(2,1-l))*u>=2&&(s++,u/=2),s+l>=c?(a=0,s=c):s+l>=1?(a=(e*u-1)*Math.pow(2,i),s+=l):(a=e*Math.pow(2,l-1)*Math.pow(2,i),s=0)),isNaN(e)&&(a=0);i>=8;)t[r+p]=255&a,p+=m,a/=256,i-=8;for(s=s<<i|a,isNaN(e)&&(s+=8),f+=i;f>0;)t[r+p]=255&s,p+=m,s/=256,f-=8;t[r+p-m]|=128*y}var Se=/\x00/,Oe=new Set(["$db","$ref","$id","$clusterTime"]);function Ae(t,e,r,n,i){t[n++]=Dt;var o=i?t.write(e,n,void 0,"ascii"):t.write(e,n,void 0,"utf8");t[(n=n+o+1)-1]=0;var s=t.write(r,n+4,void 0,"utf8");return t[n+3]=s+1>>24&255,t[n+2]=s+1>>16&255,t[n+1]=s+1>>8&255,t[n]=s+1&255,n=n+4+s,t[n++]=0,n}function Ee(t,e,r,n,i){Number.isInteger(r)&&r>=Rt&&r<=$t?(t[n++]=Gt,n+=i?t.write(e,n,void 0,"ascii"):t.write(e,n,void 0,"utf8"),t[n++]=0,t[n++]=255&r,t[n++]=r>>8&255,t[n++]=r>>16&255,t[n++]=r>>24&255):(t[n++]=Nt,n+=i?t.write(e,n,void 0,"ascii"):t.write(e,n,void 0,"utf8"),t[n++]=0,Me(t,r,n,"little",52,8),n+=8);return n}function xe(t,e,r,n,i){return t[n++]=Kt,n+=i?t.write(e,n,void 0,"ascii"):t.write(e,n,void 0,"utf8"),t[n++]=0,n}function ke(t,e,r,n,i){return t[n++]=zt,n+=i?t.write(e,n,void 0,"ascii"):t.write(e,n,void 0,"utf8"),t[n++]=0,t[n++]=r?1:0,n}function je(t,e,r,n,i){t[n++]=Vt,n+=i?t.write(e,n,void 0,"ascii"):t.write(e,n,void 0,"utf8"),t[n++]=0;var o=Q.fromNumber(r.getTime()),s=o.getLowBits(),a=o.getHighBits();return t[n++]=255&s,t[n++]=s>>8&255,t[n++]=s>>16&255,t[n++]=s>>24&255,t[n++]=255&a,t[n++]=a>>8&255,t[n++]=a>>16&255,t[n++]=a>>24&255,n}function $e(t,e,r,n,i){if(t[n++]=Ht,n+=i?t.write(e,n,void 0,"ascii"):t.write(e,n,void 0,"utf8"),t[n++]=0,r.source&&null!=r.source.match(Se))throw Error("value "+r.source+" must not contain null bytes");return n+=t.write(r.source,n,void 0,"utf8"),t[n++]=0,r.ignoreCase&&(t[n++]=105),r.global&&(t[n++]=115),r.multiline&&(t[n++]=109),t[n++]=0,n}function Re(t,e,r,n,i){if(t[n++]=Ht,n+=i?t.write(e,n,void 0,"ascii"):t.write(e,n,void 0,"utf8"),t[n++]=0,null!=r.pattern.match(Se))throw Error("pattern "+r.pattern+" must not contain null bytes");return n+=t.write(r.pattern,n,void 0,"utf8"),t[n++]=0,n+=t.write(r.options.split("").sort().join(""),n,void 0,"utf8"),t[n++]=0,n}function Pe(t,e,r,n,i){return null===r?t[n++]=Kt:"MinKey"===r._bsontype?t[n++]=ee:t[n++]=re,n+=i?t.write(e,n,void 0,"ascii"):t.write(e,n,void 0,"utf8"),t[n++]=0,n}function Be(t,e,r,n,i){if(t[n++]=Ft,n+=i?t.write(e,n,void 0,"ascii"):t.write(e,n,void 0,"utf8"),t[n++]=0,"string"==typeof r.id)t.write(r.id,n,void 0,"binary");else{if(!R(r.id))throw new O("object ["+JSON.stringify(r)+"] is not a valid ObjectId");t.set(r.id.subarray(0,12),n)}return n+12}function Te(t,e,r,n,i){t[n++]=qt,n+=i?t.write(e,n,void 0,"ascii"):t.write(e,n,void 0,"utf8"),t[n++]=0;var o=r.length;return t[n++]=255&o,t[n++]=o>>8&255,t[n++]=o>>16&255,t[n++]=o>>24&255,t[n++]=ne,t.set(C(r),n),n+=o}function Ie(t,e,r,n,i,o,s,a,u,h){void 0===i&&(i=!1),void 0===o&&(o=0),void 0===s&&(s=!1),void 0===a&&(a=!0),void 0===u&&(u=!1),void 0===h&&(h=[]);for(var f=0;f<h.length;f++)if(h[f]===r)throw new S("cyclic dependency detected");h.push(r),t[n++]=Array.isArray(r)?Lt:Ct,n+=u?t.write(e,n,void 0,"ascii"):t.write(e,n,void 0,"utf8"),t[n++]=0;var c=Ke(t,r,i,n,o+1,s,a,h);return h.pop(),c}function Ne(t,e,r,n,i){return t[n++]=te,n+=i?t.write(e,n,void 0,"ascii"):t.write(e,n,void 0,"utf8"),t[n++]=0,t.set(r.bytes.subarray(0,16),n),n+16}function De(t,e,r,n,i){t[n++]="Long"===r._bsontype?Xt:Qt,n+=i?t.write(e,n,void 0,"ascii"):t.write(e,n,void 0,"utf8"),t[n++]=0;var o=r.getLowBits(),s=r.getHighBits();return t[n++]=255&o,t[n++]=o>>8&255,t[n++]=o>>16&255,t[n++]=o>>24&255,t[n++]=255&s,t[n++]=s>>8&255,t[n++]=s>>16&255,t[n++]=s>>24&255,n}function Ce(t,e,r,n,i){return r=r.valueOf(),t[n++]=Gt,n+=i?t.write(e,n,void 0,"ascii"):t.write(e,n,void 0,"utf8"),t[n++]=0,t[n++]=255&r,t[n++]=r>>8&255,t[n++]=r>>16&255,t[n++]=r>>24&255,n}function Le(t,e,r,n,i){return t[n++]=Nt,n+=i?t.write(e,n,void 0,"ascii"):t.write(e,n,void 0,"utf8"),t[n++]=0,Me(t,r.value,n,"little",52,8),n+=8}function qe(t,e,r,n,i,o,s){t[n++]=Zt,n+=s?t.write(e,n,void 0,"ascii"):t.write(e,n,void 0,"utf8"),t[n++]=0;var a=x(r),u=t.write(a,n+4,void 0,"utf8")+1;return t[n]=255&u,t[n+1]=u>>8&255,t[n+2]=u>>16&255,t[n+3]=u>>24&255,n=n+4+u-1,t[n++]=0,n}function Ue(t,e,r,i,o,s,a,u,h){if(void 0===o&&(o=!1),void 0===s&&(s=0),void 0===a&&(a=!1),void 0===u&&(u=!0),void 0===h&&(h=!1),r.scope&&"object"===n(r.scope)){t[i++]=Yt,i+=h?t.write(e,i,void 0,"ascii"):t.write(e,i,void 0,"utf8"),t[i++]=0;var f=i,c="string"==typeof r.code?r.code:r.code.toString();i+=4;var l=t.write(c,i+4,void 0,"utf8")+1;t[i]=255&l,t[i+1]=l>>8&255,t[i+2]=l>>16&255,t[i+3]=l>>24&255,t[i+4+l-1]=0,i=i+l+4;var d=Ke(t,r.scope,o,i,s+1,a,u);i=d-1;var p=d-f;t[f++]=255&p,t[f++]=p>>8&255,t[f++]=p>>16&255,t[f++]=p>>24&255,t[i++]=0}else{t[i++]=Zt,i+=h?t.write(e,i,void 0,"ascii"):t.write(e,i,void 0,"utf8"),t[i++]=0;c=r.code.toString();var m=t.write(c,i+4,void 0,"utf8")+1;t[i]=255&m,t[i+1]=m>>8&255,t[i+2]=m>>16&255,t[i+3]=m>>24&255,i=i+4+m-1,t[i++]=0}return i}function Fe(t,e,r,n,i){t[n++]=qt,n+=i?t.write(e,n,void 0,"ascii"):t.write(e,n,void 0,"utf8"),t[n++]=0;var o=r.value(!0),s=r.position;return r.sub_type===K.SUBTYPE_BYTE_ARRAY&&(s+=4),t[n++]=255&s,t[n++]=s>>8&255,t[n++]=s>>16&255,t[n++]=s>>24&255,t[n++]=r.sub_type,r.sub_type===K.SUBTYPE_BYTE_ARRAY&&(s-=4,t[n++]=255&s,t[n++]=s>>8&255,t[n++]=s>>16&255,t[n++]=s>>24&255),t.set(o,n),n+=r.position}function ze(t,e,r,n,i){t[n++]=Jt,n+=i?t.write(e,n,void 0,"ascii"):t.write(e,n,void 0,"utf8"),t[n++]=0;var o=t.write(r.value,n+4,void 0,"utf8")+1;return t[n]=255&o,t[n+1]=o>>8&255,t[n+2]=o>>16&255,t[n+3]=o>>24&255,n=n+4+o-1,t[n++]=0,n}function Ve(t,e,r,n,i,o,s){t[n++]=Ct,n+=s?t.write(e,n,void 0,"ascii"):t.write(e,n,void 0,"utf8"),t[n++]=0;var a=n,u={$ref:r.collection||r.namespace,$id:r.oid};null!=r.db&&(u.$db=r.db);var h=Ke(t,u=Object.assign(u,r.fields),!1,n,i+1,o),f=h-a;return t[a++]=255&f,t[a++]=f>>8&255,t[a++]=f>>16&255,t[a++]=f>>24&255,h}function Ke(t,e,r,i,o,s,a,u){void 0===r&&(r=!1),void 0===i&&(i=0),void 0===o&&(o=0),void 0===s&&(s=!1),void 0===a&&(a=!0),void 0===u&&(u=[]),i=i||0,(u=u||[]).push(e);var h,f=i+4;if(Array.isArray(e))for(var c=0;c<e.length;c++){var l=""+c;if((b=e[c])&&b.toBSON){if("function"!=typeof b.toBSON)throw new O("toBSON is not a function");b=b.toBSON()}if("string"==typeof b)f=Ae(t,l,b,f,!0);else if("number"==typeof b)f=Ee(t,l,b,f,!0);else{if("bigint"==typeof b)throw new O("Unsupported type BigInt, please use Decimal128");if("boolean"==typeof b)f=ke(t,l,b,f,!0);else if(b instanceof Date||I(b))f=je(t,l,b,f,!0);else if(void 0===b)f=xe(t,l,0,f,!0);else if(null===b)f=xe(t,l,0,f,!0);else if("ObjectId"===b._bsontype||"ObjectID"===b._bsontype)f=Be(t,l,b,f,!0);else if(R(b))f=Te(t,l,b,f,!0);else if(b instanceof RegExp||T(b))f=$e(t,l,b,f,!0);else if("object"===n(b)&&null==b._bsontype)f=Ie(t,l,b,f,r,o,s,a,!0,u);else if("object"===n(b)&&Mt(b)&&"Decimal128"===b._bsontype)f=Ne(t,l,b,f,!0);else if("Long"===b._bsontype||"Timestamp"===b._bsontype)f=De(t,l,b,f,!0);else if("Double"===b._bsontype)f=Le(t,l,b,f,!0);else if("function"==typeof b&&s)f=qe(t,l,b,f,0,0,!0);else if("Code"===b._bsontype)f=Ue(t,l,b,f,r,o,s,a,!0);else if("Binary"===b._bsontype)f=Fe(t,l,b,f,!0);else if("Symbol"===b._bsontype)f=ze(t,l,b,f,!0);else if("DBRef"===b._bsontype)f=Ve(t,l,b,f,o,s,!0);else if("BSONRegExp"===b._bsontype)f=Re(t,l,b,f,!0);else if("Int32"===b._bsontype)f=Ce(t,l,b,f,!0);else if("MinKey"===b._bsontype||"MaxKey"===b._bsontype)f=Pe(t,l,b,f,!0);else if(void 0!==b._bsontype)throw new O("Unrecognized or invalid _bsontype: "+b._bsontype)}}else if(e instanceof xt||(h=e,"[object Map]"===Object.prototype.toString.call(h)))for(var d=e.entries(),p=!1;!p;){var m=d.next();if(!(p=!!m.done)){l=m.value[0];var y=n(b=m.value[1]);if("string"==typeof l&&!Oe.has(l)){if(null!=l.match(Se))throw Error("key "+l+" must not contain null bytes");if(r){if("$"===l[0])throw Error("key "+l+" must not start with '$'");if(~l.indexOf("."))throw Error("key "+l+" must not contain '.'")}}if("string"===y)f=Ae(t,l,b,f);else if("number"===y)f=Ee(t,l,b,f);else{if("bigint"===y||P(b)||B(b))throw new O("Unsupported type BigInt, please use Decimal128");if("boolean"===y)f=ke(t,l,b,f);else if(b instanceof Date||I(b))f=je(t,l,b,f);else if(null===b||void 0===b&&!1===a)f=xe(t,l,0,f);else if("ObjectId"===b._bsontype||"ObjectID"===b._bsontype)f=Be(t,l,b,f);else if(R(b))f=Te(t,l,b,f);else if(b instanceof RegExp||T(b))f=$e(t,l,b,f);else if("object"===y&&null==b._bsontype)f=Ie(t,l,b,f,r,o,s,a,!1,u);else if("object"===y&&"Decimal128"===b._bsontype)f=Ne(t,l,b,f);else if("Long"===b._bsontype||"Timestamp"===b._bsontype)f=De(t,l,b,f);else if("Double"===b._bsontype)f=Le(t,l,b,f);else if("Code"===b._bsontype)f=Ue(t,l,b,f,r,o,s,a);else if("function"==typeof b&&s)f=qe(t,l,b,f,0,0,s);else if("Binary"===b._bsontype)f=Fe(t,l,b,f);else if("Symbol"===b._bsontype)f=ze(t,l,b,f);else if("DBRef"===b._bsontype)f=Ve(t,l,b,f,o,s);else if("BSONRegExp"===b._bsontype)f=Re(t,l,b,f);else if("Int32"===b._bsontype)f=Ce(t,l,b,f);else if("MinKey"===b._bsontype||"MaxKey"===b._bsontype)f=Pe(t,l,b,f);else if(void 0!==b._bsontype)throw new O("Unrecognized or invalid _bsontype: "+b._bsontype)}}}else{if(e.toBSON){if("function"!=typeof e.toBSON)throw new O("toBSON is not a function");if(null!=(e=e.toBSON())&&"object"!==n(e))throw new O("toBSON function did not return an object")}for(var l in e){var b;if((b=e[l])&&b.toBSON){if("function"!=typeof b.toBSON)throw new O("toBSON is not a function");b=b.toBSON()}y=n(b);if("string"==typeof l&&!Oe.has(l)){if(null!=l.match(Se))throw Error("key "+l+" must not contain null bytes");if(r){if("$"===l[0])throw Error("key "+l+" must not start with '$'");if(~l.indexOf("."))throw Error("key "+l+" must not contain '.'")}}if("string"===y)f=Ae(t,l,b,f);else if("number"===y)f=Ee(t,l,b,f);else{if("bigint"===y)throw new O("Unsupported type BigInt, please use Decimal128");if("boolean"===y)f=ke(t,l,b,f);else if(b instanceof Date||I(b))f=je(t,l,b,f);else if(void 0===b)!1===a&&(f=xe(t,l,0,f));else if(null===b)f=xe(t,l,0,f);else if("ObjectId"===b._bsontype||"ObjectID"===b._bsontype)f=Be(t,l,b,f);else if(R(b))f=Te(t,l,b,f);else if(b instanceof RegExp||T(b))f=$e(t,l,b,f);else if("object"===y&&null==b._bsontype)f=Ie(t,l,b,f,r,o,s,a,!1,u);else if("object"===y&&"Decimal128"===b._bsontype)f=Ne(t,l,b,f);else if("Long"===b._bsontype||"Timestamp"===b._bsontype)f=De(t,l,b,f);else if("Double"===b._bsontype)f=Le(t,l,b,f);else if("Code"===b._bsontype)f=Ue(t,l,b,f,r,o,s,a);else if("function"==typeof b&&s)f=qe(t,l,b,f,0,0,s);else if("Binary"===b._bsontype)f=Fe(t,l,b,f);else if("Symbol"===b._bsontype)f=ze(t,l,b,f);else if("DBRef"===b._bsontype)f=Ve(t,l,b,f,o,s);else if("BSONRegExp"===b._bsontype)f=Re(t,l,b,f);else if("Int32"===b._bsontype)f=Ce(t,l,b,f);else if("MinKey"===b._bsontype||"MaxKey"===b._bsontype)f=Pe(t,l,b,f);else if(void 0!==b._bsontype)throw new O("Unrecognized or invalid _bsontype: "+b._bsontype)}}}u.pop(),t[f++]=0;var v=f-i;return t[i++]=255&v,t[i++]=v>>8&255,t[i++]=v>>16&255,t[i++]=v>>24&255,f}var He=g.alloc(17825792);function We(t){He.length<t&&(He=g.alloc(t))}function Ze(t,e){void 0===e&&(e={});var r="boolean"==typeof e.checkKeys&&e.checkKeys,n="boolean"==typeof e.serializeFunctions&&e.serializeFunctions,i="boolean"!=typeof e.ignoreUndefined||e.ignoreUndefined,o="number"==typeof e.minInternalBufferSize?e.minInternalBufferSize:17825792;He.length<o&&(He=g.alloc(o));var s=Ke(He,t,r,0,0,n,i,[]),a=g.alloc(s);return He.copy(a,0,0,a.length),a}function Je(t,e,r){void 0===r&&(r={});var n="boolean"==typeof r.checkKeys&&r.checkKeys,i="boolean"==typeof r.serializeFunctions&&r.serializeFunctions,o="boolean"!=typeof r.ignoreUndefined||r.ignoreUndefined,s="number"==typeof r.index?r.index:0,a=Ke(He,t,n,0,0,i,o);return He.copy(e,s,0,a),s+a-1}function Ye(t,e){return void 0===e&&(e={}),ve(t instanceof g?t:C(t),e)}function Ge(t,e){return void 0===e&&(e={}),le(t,"boolean"==typeof(e=e||{}).serializeFunctions&&e.serializeFunctions,"boolean"!=typeof e.ignoreUndefined||e.ignoreUndefined)}function Qe(t,e,r,n,i,o){for(var s=Object.assign({allowObjectSmallerThanBufferSize:!0,index:0},o),a=C(t),u=e,h=0;h<r;h++){var f=a[u]|a[u+1]<<8|a[u+2]<<16|a[u+3]<<24;s.index=u,n[i+h]=ve(a,s),u+=f}return u}var Xe={Binary:K,Code:H,DBRef:Z,Decimal128:ht,Double:ft,Int32:ct,Long:Q,UUID:V,Map:xt,MaxKey:lt,MinKey:dt,ObjectId:bt,ObjectID:bt,BSONRegExp:vt,BSONSymbol:gt,Timestamp:_t,EJSON:Et,setInternalBufferSize:We,serialize:Ze,serializeWithBufferAndIndex:Je,deserialize:Ye,calculateObjectSize:Ge,deserializeStream:Qe,BSONError:S,BSONTypeError:O};e.default=Xe}.call(this,r(7))},function(t,e,r){"use strict";var n=r(0),i=r(98),o=r(2).Buffer,s=new Array(16);function a(){i.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878}function u(t,e){return t<<e|t>>>32-e}function h(t,e,r,n,i,o,s){return u(t+(e&r|~e&n)+i+o|0,s)+e|0}function f(t,e,r,n,i,o,s){return u(t+(e&n|r&~n)+i+o|0,s)+e|0}function c(t,e,r,n,i,o,s){return u(t+(e^r^n)+i+o|0,s)+e|0}function l(t,e,r,n,i,o,s){return u(t+(r^(e|~n))+i+o|0,s)+e|0}n(a,i),a.prototype._update=function(){for(var t=s,e=0;e<16;++e)t[e]=this._block.readInt32LE(4*e);var r=this._a,n=this._b,i=this._c,o=this._d;r=h(r,n,i,o,t[0],3614090360,7),o=h(o,r,n,i,t[1],3905402710,12),i=h(i,o,r,n,t[2],606105819,17),n=h(n,i,o,r,t[3],3250441966,22),r=h(r,n,i,o,t[4],4118548399,7),o=h(o,r,n,i,t[5],1200080426,12),i=h(i,o,r,n,t[6],2821735955,17),n=h(n,i,o,r,t[7],4249261313,22),r=h(r,n,i,o,t[8],1770035416,7),o=h(o,r,n,i,t[9],2336552879,12),i=h(i,o,r,n,t[10],4294925233,17),n=h(n,i,o,r,t[11],2304563134,22),r=h(r,n,i,o,t[12],1804603682,7),o=h(o,r,n,i,t[13],4254626195,12),i=h(i,o,r,n,t[14],2792965006,17),r=f(r,n=h(n,i,o,r,t[15],1236535329,22),i,o,t[1],4129170786,5),o=f(o,r,n,i,t[6],3225465664,9),i=f(i,o,r,n,t[11],643717713,14),n=f(n,i,o,r,t[0],3921069994,20),r=f(r,n,i,o,t[5],3593408605,5),o=f(o,r,n,i,t[10],38016083,9),i=f(i,o,r,n,t[15],3634488961,14),n=f(n,i,o,r,t[4],3889429448,20),r=f(r,n,i,o,t[9],568446438,5),o=f(o,r,n,i,t[14],3275163606,9),i=f(i,o,r,n,t[3],4107603335,14),n=f(n,i,o,r,t[8],1163531501,20),r=f(r,n,i,o,t[13],2850285829,5),o=f(o,r,n,i,t[2],4243563512,9),i=f(i,o,r,n,t[7],1735328473,14),r=c(r,n=f(n,i,o,r,t[12],2368359562,20),i,o,t[5],4294588738,4),o=c(o,r,n,i,t[8],2272392833,11),i=c(i,o,r,n,t[11],1839030562,16),n=c(n,i,o,r,t[14],4259657740,23),r=c(r,n,i,o,t[1],2763975236,4),o=c(o,r,n,i,t[4],1272893353,11),i=c(i,o,r,n,t[7],4139469664,16),n=c(n,i,o,r,t[10],3200236656,23),r=c(r,n,i,o,t[13],681279174,4),o=c(o,r,n,i,t[0],3936430074,11),i=c(i,o,r,n,t[3],3572445317,16),n=c(n,i,o,r,t[6],76029189,23),r=c(r,n,i,o,t[9],3654602809,4),o=c(o,r,n,i,t[12],3873151461,11),i=c(i,o,r,n,t[15],530742520,16),r=l(r,n=c(n,i,o,r,t[2],3299628645,23),i,o,t[0],4096336452,6),o=l(o,r,n,i,t[7],1126891415,10),i=l(i,o,r,n,t[14],2878612391,15),n=l(n,i,o,r,t[5],4237533241,21),r=l(r,n,i,o,t[12],1700485571,6),o=l(o,r,n,i,t[3],2399980690,10),i=l(i,o,r,n,t[10],4293915773,15),n=l(n,i,o,r,t[1],2240044497,21),r=l(r,n,i,o,t[8],1873313359,6),o=l(o,r,n,i,t[15],4264355552,10),i=l(i,o,r,n,t[6],2734768916,15),n=l(n,i,o,r,t[13],1309151649,21),r=l(r,n,i,o,t[4],4149444226,6),o=l(o,r,n,i,t[11],3174756917,10),i=l(i,o,r,n,t[2],718787259,15),n=l(n,i,o,r,t[9],3951481745,21),this._a=this._a+r|0,this._b=this._b+n|0,this._c=this._c+i|0,this._d=this._d+o|0},a.prototype._digest=function(){this._block[this._blockOffset++]=128,this._blockOffset>56&&(this._block.fill(0,this._blockOffset,64),this._update(),this._blockOffset=0),this._block.fill(0,this._blockOffset,56),this._block.writeUInt32LE(this._length[0],56),this._block.writeUInt32LE(this._length[1],60),this._update();var t=o.allocUnsafe(16);return t.writeInt32LE(this._a,0),t.writeInt32LE(this._b,4),t.writeInt32LE(this._c,8),t.writeInt32LE(this._d,12),t},t.exports=a},function(t,e,r){(function(e){function r(t){try{if(!e.localStorage)return!1}catch(t){return!1}var r=e.localStorage[t];return null!=r&&"true"===String(r).toLowerCase()}t.exports=function(t,e){if(r("noDeprecation"))return t;var n=!1;return function(){if(!n){if(r("throwDeprecation"))throw new Error(e);r("traceDeprecation")?console.trace(e):console.warn(e),n=!0}return t.apply(this,arguments)}}}).call(this,r(7))},function(t,e,r){"use strict";var n=r(29).codes.ERR_STREAM_PREMATURE_CLOSE;function i(){}t.exports=function t(e,r,o){if("function"==typeof r)return t(e,null,r);r||(r={}),o=function(t){var e=!1;return function(){if(!e){e=!0;for(var r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];t.apply(this,n)}}}(o||i);var s=r.readable||!1!==r.readable&&e.readable,a=r.writable||!1!==r.writable&&e.writable,u=function(){e.writable||f()},h=e._writableState&&e._writableState.finished,f=function(){a=!1,h=!0,s||o.call(e)},c=e._readableState&&e._readableState.endEmitted,l=function(){s=!1,c=!0,a||o.call(e)},d=function(t){o.call(e,t)},p=function(){var t;return s&&!c?(e._readableState&&e._readableState.ended||(t=new n),o.call(e,t)):a&&!h?(e._writableState&&e._writableState.ended||(t=new n),o.call(e,t)):void 0},m=function(){e.req.on("finish",f)};return!function(t){return t.setHeader&&"function"==typeof t.abort}(e)?a&&!e._writableState&&(e.on("end",u),e.on("close",u)):(e.on("complete",f),e.on("abort",p),e.req?m():e.on("request",m)),e.on("end",l),e.on("finish",f),!1!==r.error&&e.on("error",d),e.on("close",p),function(){e.removeListener("complete",f),e.removeListener("abort",p),e.removeListener("request",m),e.req&&e.req.removeListener("finish",f),e.removeListener("end",u),e.removeListener("close",u),e.removeListener("finish",f),e.removeListener("end",l),e.removeListener("error",d),e.removeListener("close",p)}}},function(t,e,r){"use strict";var n=r(3).Buffer,i=r(0),o=r(98),s=new Array(16),a=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13],u=[5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11],h=[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6],f=[8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11],c=[0,1518500249,1859775393,2400959708,2840853838],l=[1352829926,1548603684,1836072691,2053994217,0];function d(){o.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520}function p(t,e){return t<<e|t>>>32-e}function m(t,e,r,n,i,o,s,a){return p(t+(e^r^n)+o+s|0,a)+i|0}function y(t,e,r,n,i,o,s,a){return p(t+(e&r|~e&n)+o+s|0,a)+i|0}function b(t,e,r,n,i,o,s,a){return p(t+((e|~r)^n)+o+s|0,a)+i|0}function v(t,e,r,n,i,o,s,a){return p(t+(e&n|r&~n)+o+s|0,a)+i|0}function g(t,e,r,n,i,o,s,a){return p(t+(e^(r|~n))+o+s|0,a)+i|0}i(d,o),d.prototype._update=function(){for(var t=s,e=0;e<16;++e)t[e]=this._block.readInt32LE(4*e);for(var r=0|this._a,n=0|this._b,i=0|this._c,o=0|this._d,d=0|this._e,w=0|this._a,_=0|this._b,M=0|this._c,S=0|this._d,O=0|this._e,A=0;A<80;A+=1){var E,x;A<16?(E=m(r,n,i,o,d,t[a[A]],c[0],h[A]),x=g(w,_,M,S,O,t[u[A]],l[0],f[A])):A<32?(E=y(r,n,i,o,d,t[a[A]],c[1],h[A]),x=v(w,_,M,S,O,t[u[A]],l[1],f[A])):A<48?(E=b(r,n,i,o,d,t[a[A]],c[2],h[A]),x=b(w,_,M,S,O,t[u[A]],l[2],f[A])):A<64?(E=v(r,n,i,o,d,t[a[A]],c[3],h[A]),x=y(w,_,M,S,O,t[u[A]],l[3],f[A])):(E=g(r,n,i,o,d,t[a[A]],c[4],h[A]),x=m(w,_,M,S,O,t[u[A]],l[4],f[A])),r=d,d=o,o=p(i,10),i=n,n=E,w=O,O=S,S=p(M,10),M=_,_=x}var k=this._b+i+S|0;this._b=this._c+o+O|0,this._c=this._d+d+w|0,this._d=this._e+r+_|0,this._e=this._a+n+M|0,this._a=k},d.prototype._digest=function(){this._block[this._blockOffset++]=128,this._blockOffset>56&&(this._block.fill(0,this._blockOffset,64),this._update(),this._blockOffset=0),this._block.fill(0,this._blockOffset,56),this._block.writeUInt32LE(this._length[0],56),this._block.writeUInt32LE(this._length[1],60),this._update();var t=n.alloc?n.alloc(20):new n(20);return t.writeInt32LE(this._a,0),t.writeInt32LE(this._b,4),t.writeInt32LE(this._c,8),t.writeInt32LE(this._d,12),t.writeInt32LE(this._e,16),t},t.exports=d},function(t,e,r){(e=t.exports=function(t){t=t.toLowerCase();var r=e[t];if(!r)throw new Error(t+" is not supported (we accept pull requests)");return new r}).sha=r(201),e.sha1=r(202),e.sha224=r(203),e.sha256=r(105),e.sha384=r(204),e.sha512=r(106)},function(t,e,r){(e=t.exports=r(107)).Stream=e,e.Readable=e,e.Writable=r(68),e.Duplex=r(26),e.Transform=r(111),e.PassThrough=r(210)},function(t,e,r){"use strict";(function(e,n,i){var o=r(48);function s(t){var e=this;this.next=null,this.entry=null,this.finish=function(){!function(t,e,r){var n=t.entry;t.entry=null;for(;n;){var i=n.callback;e.pendingcb--,i(r),n=n.next}e.corkedRequestsFree?e.corkedRequestsFree.next=t:e.corkedRequestsFree=t}(e,t)}}t.exports=v;var a,u=!e.browser&&["v0.10","v0.9."].indexOf(e.version.slice(0,5))>-1?n:o.nextTick;v.WritableState=b;var h=Object.create(r(40));h.inherits=r(0);var f={deprecate:r(63)},c=r(108),l=r(2).Buffer,d=i.Uint8Array||function(){};var p,m=r(109);function y(){}function b(t,e){a=a||r(26),t=t||{};var n=e instanceof a;this.objectMode=!!t.objectMode,n&&(this.objectMode=this.objectMode||!!t.writableObjectMode);var i=t.highWaterMark,h=t.writableHighWaterMark,f=this.objectMode?16:16384;this.highWaterMark=i||0===i?i:n&&(h||0===h)?h:f,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var c=!1===t.decodeStrings;this.decodeStrings=!c,this.defaultEncoding=t.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(t){!function(t,e){var r=t._writableState,n=r.sync,i=r.writecb;if(function(t){t.writing=!1,t.writecb=null,t.length-=t.writelen,t.writelen=0}(r),e)!function(t,e,r,n,i){--e.pendingcb,r?(o.nextTick(i,n),o.nextTick(O,t,e),t._writableState.errorEmitted=!0,t.emit("error",n)):(i(n),t._writableState.errorEmitted=!0,t.emit("error",n),O(t,e))}(t,r,n,e,i);else{var s=M(r);s||r.corked||r.bufferProcessing||!r.bufferedRequest||_(t,r),n?u(w,t,r,s,i):w(t,r,s,i)}}(e,t)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new s(this)}function v(t){if(a=a||r(26),!(p.call(v,this)||this instanceof a))return new v(t);this._writableState=new b(t,this),this.writable=!0,t&&("function"==typeof t.write&&(this._write=t.write),"function"==typeof t.writev&&(this._writev=t.writev),"function"==typeof t.destroy&&(this._destroy=t.destroy),"function"==typeof t.final&&(this._final=t.final)),c.call(this)}function g(t,e,r,n,i,o,s){e.writelen=n,e.writecb=s,e.writing=!0,e.sync=!0,r?t._writev(i,e.onwrite):t._write(i,o,e.onwrite),e.sync=!1}function w(t,e,r,n){r||function(t,e){0===e.length&&e.needDrain&&(e.needDrain=!1,t.emit("drain"))}(t,e),e.pendingcb--,n(),O(t,e)}function _(t,e){e.bufferProcessing=!0;var r=e.bufferedRequest;if(t._writev&&r&&r.next){var n=e.bufferedRequestCount,i=new Array(n),o=e.corkedRequestsFree;o.entry=r;for(var a=0,u=!0;r;)i[a]=r,r.isBuf||(u=!1),r=r.next,a+=1;i.allBuffers=u,g(t,e,!0,e.length,i,"",o.finish),e.pendingcb++,e.lastBufferedRequest=null,o.next?(e.corkedRequestsFree=o.next,o.next=null):e.corkedRequestsFree=new s(e),e.bufferedRequestCount=0}else{for(;r;){var h=r.chunk,f=r.encoding,c=r.callback;if(g(t,e,!1,e.objectMode?1:h.length,h,f,c),r=r.next,e.bufferedRequestCount--,e.writing)break}null===r&&(e.lastBufferedRequest=null)}e.bufferedRequest=r,e.bufferProcessing=!1}function M(t){return t.ending&&0===t.length&&null===t.bufferedRequest&&!t.finished&&!t.writing}function S(t,e){t._final((function(r){e.pendingcb--,r&&t.emit("error",r),e.prefinished=!0,t.emit("prefinish"),O(t,e)}))}function O(t,e){var r=M(e);return r&&(!function(t,e){e.prefinished||e.finalCalled||("function"==typeof t._final?(e.pendingcb++,e.finalCalled=!0,o.nextTick(S,t,e)):(e.prefinished=!0,t.emit("prefinish")))}(t,e),0===e.pendingcb&&(e.finished=!0,t.emit("finish"))),r}h.inherits(v,c),b.prototype.getBuffer=function(){for(var t=this.bufferedRequest,e=[];t;)e.push(t),t=t.next;return e},function(){try{Object.defineProperty(b.prototype,"buffer",{get:f.deprecate((function(){return this.getBuffer()}),"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(t){}}(),"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(p=Function.prototype[Symbol.hasInstance],Object.defineProperty(v,Symbol.hasInstance,{value:function(t){return!!p.call(this,t)||this===v&&(t&&t._writableState instanceof b)}})):p=function(t){return t instanceof this},v.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))},v.prototype.write=function(t,e,r){var n,i=this._writableState,s=!1,a=!i.objectMode&&(n=t,l.isBuffer(n)||n instanceof d);return a&&!l.isBuffer(t)&&(t=function(t){return l.from(t)}(t)),"function"==typeof e&&(r=e,e=null),a?e="buffer":e||(e=i.defaultEncoding),"function"!=typeof r&&(r=y),i.ended?function(t,e){var r=new Error("write after end");t.emit("error",r),o.nextTick(e,r)}(this,r):(a||function(t,e,r,n){var i=!0,s=!1;return null===r?s=new TypeError("May not write null values to stream"):"string"==typeof r||void 0===r||e.objectMode||(s=new TypeError("Invalid non-string/buffer chunk")),s&&(t.emit("error",s),o.nextTick(n,s),i=!1),i}(this,i,t,r))&&(i.pendingcb++,s=function(t,e,r,n,i,o){if(!r){var s=function(t,e,r){t.objectMode||!1===t.decodeStrings||"string"!=typeof e||(e=l.from(e,r));return e}(e,n,i);n!==s&&(r=!0,i="buffer",n=s)}var a=e.objectMode?1:n.length;e.length+=a;var u=e.length<e.highWaterMark;u||(e.needDrain=!0);if(e.writing||e.corked){var h=e.lastBufferedRequest;e.lastBufferedRequest={chunk:n,encoding:i,isBuf:r,callback:o,next:null},h?h.next=e.lastBufferedRequest:e.bufferedRequest=e.lastBufferedRequest,e.bufferedRequestCount+=1}else g(t,e,!1,a,n,i,o);return u}(this,i,a,t,e,r)),s},v.prototype.cork=function(){this._writableState.corked++},v.prototype.uncork=function(){var t=this._writableState;t.corked&&(t.corked--,t.writing||t.corked||t.finished||t.bufferProcessing||!t.bufferedRequest||_(this,t))},v.prototype.setDefaultEncoding=function(t){if("string"==typeof t&&(t=t.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((t+"").toLowerCase())>-1))throw new TypeError("Unknown encoding: "+t);return this._writableState.defaultEncoding=t,this},Object.defineProperty(v.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),v.prototype._write=function(t,e,r){r(new Error("_write() is not implemented"))},v.prototype._writev=null,v.prototype.end=function(t,e,r){var n=this._writableState;"function"==typeof t?(r=t,t=null,e=null):"function"==typeof e&&(r=e,e=null),null!=t&&this.write(t,e),n.corked&&(n.corked=1,this.uncork()),n.ending||n.finished||function(t,e,r){e.ending=!0,O(t,e),r&&(e.finished?o.nextTick(r):t.once("finish",r));e.ended=!0,t.writable=!1}(this,n,r)},Object.defineProperty(v.prototype,"destroyed",{get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(t){this._writableState&&(this._writableState.destroyed=t)}}),v.prototype.destroy=m.destroy,v.prototype._undestroy=m.undestroy,v.prototype._destroy=function(t,e){this.end(),e(t)}}).call(this,r(5),r(110).setImmediate,r(7))},function(t,e,r){"use strict";var n=r(12);function i(t){this.options=t,this.type=this.options.type,this.blockSize=8,this._init(),this.buffer=new Array(this.blockSize),this.bufferOff=0}t.exports=i,i.prototype._init=function(){},i.prototype.update=function(t){return 0===t.length?[]:"decrypt"===this.type?this._updateDecrypt(t):this._updateEncrypt(t)},i.prototype._buffer=function(t,e){for(var r=Math.min(this.buffer.length-this.bufferOff,t.length-e),n=0;n<r;n++)this.buffer[this.bufferOff+n]=t[e+n];return this.bufferOff+=r,r},i.prototype._flushBuffer=function(t,e){return this._update(this.buffer,0,t,e),this.bufferOff=0,this.blockSize},i.prototype._updateEncrypt=function(t){var e=0,r=0,n=(this.bufferOff+t.length)/this.blockSize|0,i=new Array(n*this.blockSize);0!==this.bufferOff&&(e+=this._buffer(t,e),this.bufferOff===this.buffer.length&&(r+=this._flushBuffer(i,r)));for(var o=t.length-(t.length-e)%this.blockSize;e<o;e+=this.blockSize)this._update(t,e,i,r),r+=this.blockSize;for(;e<t.length;e++,this.bufferOff++)this.buffer[this.bufferOff]=t[e];return i},i.prototype._updateDecrypt=function(t){for(var e=0,r=0,n=Math.ceil((this.bufferOff+t.length)/this.blockSize)-1,i=new Array(n*this.blockSize);n>0;n--)e+=this._buffer(t,e),r+=this._flushBuffer(i,r);return e+=this._buffer(t,e),i},i.prototype.final=function(t){var e,r;return t&&(e=this.update(t)),r="encrypt"===this.type?this._finalEncrypt():this._finalDecrypt(),e?e.concat(r):r},i.prototype._pad=function(t,e){if(0===e)return!1;for(;e<t.length;)t[e++]=0;return!0},i.prototype._finalEncrypt=function(){if(!this._pad(this.buffer,this.bufferOff))return[];var t=new Array(this.blockSize);return this._update(this.buffer,0,t,0),t},i.prototype._unpad=function(t){return t},i.prototype._finalDecrypt=function(){n.equal(this.bufferOff,this.blockSize,"Not enough data to decrypt");var t=new Array(this.blockSize);return this._flushBuffer(t,0),this._unpad(t)}},function(t,e,r){var n=r(223),i=r(231),o=r(124);e.createCipher=e.Cipher=n.createCipher,e.createCipheriv=e.Cipheriv=n.createCipheriv,e.createDecipher=e.Decipher=i.createDecipher,e.createDecipheriv=e.Decipheriv=i.createDecipheriv,e.listCiphers=e.getCiphers=function(){return Object.keys(o)}},function(t,e,r){var n={ECB:r(224),CBC:r(225),CFB:r(226),CFB8:r(227),CFB1:r(228),OFB:r(229),CTR:r(122),GCM:r(122)},i=r(124);for(var o in i)i[o].module=n[i[o].mode];t.exports=i},function(t,e,r){function n(t){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var i;function o(t){this.rand=t}if(t.exports=function(t){return i||(i=new o(null)),i.generate(t)},t.exports.Rand=o,o.prototype.generate=function(t){return this._rand(t)},o.prototype._rand=function(t){if(this.rand.getBytes)return this.rand.getBytes(t);for(var e=new Uint8Array(t),r=0;r<e.length;r++)e[r]=this.rand.getByte();return e},"object"===("undefined"==typeof self?"undefined":n(self)))self.crypto&&self.crypto.getRandomValues?o.prototype._rand=function(t){var e=new Uint8Array(t);return self.crypto.getRandomValues(e),e}:self.msCrypto&&self.msCrypto.getRandomValues?o.prototype._rand=function(t){var e=new Uint8Array(t);return self.msCrypto.getRandomValues(e),e}:"object"===("undefined"==typeof window?"undefined":n(window))&&(o.prototype._rand=function(){throw new Error("Not implemented yet")});else try{var s=r(237);if("function"!=typeof s.randomBytes)throw new Error("Not supported");o.prototype._rand=function(t){return s.randomBytes(t)}}catch(t){}},function(t,e,r){
588
592
  /*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
589
593
  var n=r(3),i=n.Buffer;function o(t,e){for(var r in t)e[r]=t[r]}function s(t,e,r){return i(t,e,r)}i.from&&i.alloc&&i.allocUnsafe&&i.allocUnsafeSlow?t.exports=n:(o(n,e),e.Buffer=s),s.prototype=Object.create(i.prototype),o(i,s),s.from=function(t,e,r){if("number"==typeof t)throw new TypeError("Argument must not be a number");return i(t,e,r)},s.alloc=function(t,e,r){if("number"!=typeof t)throw new TypeError("Argument must be a number");var n=i(t);return void 0!==e?"string"==typeof r?n.fill(e,r):n.fill(e):n.fill(0),n},s.allocUnsafe=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return i(t)},s.allocUnsafeSlow=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return n.SlowBuffer(t)}},function(t,e,r){"use strict";var n=r(32).codes.ERR_STREAM_PREMATURE_CLOSE;function i(){}t.exports=function t(e,r,o){if("function"==typeof r)return t(e,null,r);r||(r={}),o=function(t){var e=!1;return function(){if(!e){e=!0;for(var r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];t.apply(this,n)}}}(o||i);var s=r.readable||!1!==r.readable&&e.readable,a=r.writable||!1!==r.writable&&e.writable,u=function(){e.writable||f()},h=e._writableState&&e._writableState.finished,f=function(){a=!1,h=!0,s||o.call(e)},c=e._readableState&&e._readableState.endEmitted,l=function(){s=!1,c=!0,a||o.call(e)},d=function(t){o.call(e,t)},p=function(){var t;return s&&!c?(e._readableState&&e._readableState.ended||(t=new n),o.call(e,t)):a&&!h?(e._writableState&&e._writableState.ended||(t=new n),o.call(e,t)):void 0},m=function(){e.req.on("finish",f)};return!function(t){return t.setHeader&&"function"==typeof t.abort}(e)?a&&!e._writableState&&(e.on("end",u),e.on("close",u)):(e.on("complete",f),e.on("abort",p),e.req?m():e.on("request",m)),e.on("end",l),e.on("finish",f),!1!==r.error&&e.on("error",d),e.on("close",p),function(){e.removeListener("complete",f),e.removeListener("abort",p),e.removeListener("request",m),e.req&&e.req.removeListener("finish",f),e.removeListener("end",u),e.removeListener("close",u),e.removeListener("finish",f),e.removeListener("end",l),e.removeListener("error",d),e.removeListener("close",p)}}},function(t,e,r){(function(e){var n=r(76),i=r(28);function o(t){var e,r=t.modulus.byteLength();do{e=new n(i(r))}while(e.cmp(t.modulus)>=0||!e.umod(t.prime1)||!e.umod(t.prime2));return e}function s(t,r){var i=function(t){var e=o(t);return{blinder:e.toRed(n.mont(t.modulus)).redPow(new n(t.publicExponent)).fromRed(),unblinder:e.invm(t.modulus)}}(r),s=r.modulus.byteLength(),a=new n(t).mul(i.blinder).umod(r.modulus),u=a.toRed(n.mont(r.prime1)),h=a.toRed(n.mont(r.prime2)),f=r.coefficient,c=r.prime1,l=r.prime2,d=u.redPow(r.exponent1).fromRed(),p=h.redPow(r.exponent2).fromRed(),m=d.isub(p).imul(f).umod(c).imul(l);return p.iadd(m).imul(i.unblinder).umod(r.modulus).toArrayLike(e,"be",s)}s.getr=o,t.exports=s}).call(this,r(3).Buffer)},function(t,e,r){(function(t){function e(t){return(e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}!function(t,n){"use strict";function i(t,e){if(!t)throw new Error(e||"Assertion failed")}function o(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}function s(t,e,r){if(s.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==e&&"be"!==e||(r=e,e=10),this._init(t||0,e||10,r||"be"))}var a;"object"===e(t)?t.exports=s:n.BN=s,s.BN=s,s.wordSize=26;try{a="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:r(250).Buffer}catch(t){}function u(t,e){var r=t.charCodeAt(e);return r>=48&&r<=57?r-48:r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:void i(!1,"Invalid character in "+t)}function h(t,e,r){var n=u(t,r);return r-1>=e&&(n|=u(t,r-1)<<4),n}function f(t,e,r,n){for(var o=0,s=0,a=Math.min(t.length,r),u=e;u<a;u++){var h=t.charCodeAt(u)-48;o*=n,s=h>=49?h-49+10:h>=17?h-17+10:h,i(h>=0&&s<n,"Invalid character"),o+=s}return o}function c(t,e){t.words=e.words,t.length=e.length,t.negative=e.negative,t.red=e.red}if(s.isBN=function(t){return t instanceof s||null!==t&&"object"===e(t)&&t.constructor.wordSize===s.wordSize&&Array.isArray(t.words)},s.max=function(t,e){return t.cmp(e)>0?t:e},s.min=function(t,e){return t.cmp(e)<0?t:e},s.prototype._init=function(t,r,n){if("number"==typeof t)return this._initNumber(t,r,n);if("object"===e(t))return this._initArray(t,r,n);"hex"===r&&(r=16),i(r===(0|r)&&r>=2&&r<=36);var o=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&(o++,this.negative=1),o<t.length&&(16===r?this._parseHex(t,o,n):(this._parseBase(t,r,o),"le"===n&&this._initArray(this.toArray(),r,n)))},s.prototype._initNumber=function(t,e,r){t<0&&(this.negative=1,t=-t),t<67108864?(this.words=[67108863&t],this.length=1):t<4503599627370496?(this.words=[67108863&t,t/67108864&67108863],this.length=2):(i(t<9007199254740992),this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===r&&this._initArray(this.toArray(),e,r)},s.prototype._initArray=function(t,e,r){if(i("number"==typeof t.length),t.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(t.length/3),this.words=new Array(this.length);for(var n=0;n<this.length;n++)this.words[n]=0;var o,s,a=0;if("be"===r)for(n=t.length-1,o=0;n>=0;n-=3)s=t[n]|t[n-1]<<8|t[n-2]<<16,this.words[o]|=s<<a&67108863,this.words[o+1]=s>>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);else if("le"===r)for(n=0,o=0;n<t.length;n+=3)s=t[n]|t[n+1]<<8|t[n+2]<<16,this.words[o]|=s<<a&67108863,this.words[o+1]=s>>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);return this._strip()},s.prototype._parseHex=function(t,e,r){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var n=0;n<this.length;n++)this.words[n]=0;var i,o=0,s=0;if("be"===r)for(n=t.length-1;n>=e;n-=2)i=h(t,e,n)<<o,this.words[s]|=67108863&i,o>=18?(o-=18,s+=1,this.words[s]|=i>>>26):o+=8;else for(n=(t.length-e)%2==0?e+1:e;n<t.length;n+=2)i=h(t,e,n)<<o,this.words[s]|=67108863&i,o>=18?(o-=18,s+=1,this.words[s]|=i>>>26):o+=8;this._strip()},s.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var n=0,i=1;i<=67108863;i*=e)n++;n--,i=i/e|0;for(var o=t.length-r,s=o%n,a=Math.min(o,o-s)+r,u=0,h=r;h<a;h+=n)u=f(t,h,h+n,e),this.imuln(i),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u);if(0!==s){var c=1;for(u=f(t,h,t.length,e),h=0;h<s;h++)c*=e;this.imuln(c),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u)}this._strip()},s.prototype.copy=function(t){t.words=new Array(this.length);for(var e=0;e<this.length;e++)t.words[e]=this.words[e];t.length=this.length,t.negative=this.negative,t.red=this.red},s.prototype._move=function(t){c(t,this)},s.prototype.clone=function(){var t=new s(null);return this.copy(t),t},s.prototype._expand=function(t){for(;this.length<t;)this.words[this.length++]=0;return this},s.prototype._strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},s.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},"undefined"!=typeof Symbol&&"function"==typeof Symbol.for)try{s.prototype[Symbol.for("nodejs.util.inspect.custom")]=l}catch(t){s.prototype.inspect=l}else s.prototype.inspect=l;function l(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"}var d=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],p=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],m=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];s.prototype.toString=function(t,e){var r;if(e=0|e||1,16===(t=t||10)||"hex"===t){r="";for(var n=0,o=0,s=0;s<this.length;s++){var a=this.words[s],u=(16777215&(a<<n|o)).toString(16);r=0!==(o=a>>>24-n&16777215)||s!==this.length-1?d[6-u.length]+u+r:u+r,(n+=2)>=26&&(n-=26,s--)}for(0!==o&&(r=o.toString(16)+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(t===(0|t)&&t>=2&&t<=36){var h=p[t],f=m[t];r="";var c=this.clone();for(c.negative=0;!c.isZero();){var l=c.modrn(f).toString(t);r=(c=c.idivn(f)).isZero()?l+r:d[h-l.length]+l+r}for(this.isZero()&&(r="0"+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}i(!1,"Base should be between 2 and 36")},s.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&i(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},s.prototype.toJSON=function(){return this.toString(16,2)},a&&(s.prototype.toBuffer=function(t,e){return this.toArrayLike(a,t,e)}),s.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)};function y(t,e,r){r.negative=e.negative^t.negative;var n=t.length+e.length|0;r.length=n,n=n-1|0;var i=0|t.words[0],o=0|e.words[0],s=i*o,a=67108863&s,u=s/67108864|0;r.words[0]=a;for(var h=1;h<n;h++){for(var f=u>>>26,c=67108863&u,l=Math.min(h,e.length-1),d=Math.max(0,h-t.length+1);d<=l;d++){var p=h-d|0;f+=(s=(i=0|t.words[p])*(o=0|e.words[d])+c)/67108864|0,c=67108863&s}r.words[h]=0|c,u=0|f}return 0!==u?r.words[h]=0|u:r.length--,r._strip()}s.prototype.toArrayLike=function(t,e,r){this._strip();var n=this.byteLength(),o=r||Math.max(1,n);i(n<=o,"byte array longer than desired length"),i(o>0,"Requested array length <= 0");var s=function(t,e){return t.allocUnsafe?t.allocUnsafe(e):new t(e)}(t,o);return this["_toArrayLike"+("le"===e?"LE":"BE")](s,n),s},s.prototype._toArrayLikeLE=function(t,e){for(var r=0,n=0,i=0,o=0;i<this.length;i++){var s=this.words[i]<<o|n;t[r++]=255&s,r<t.length&&(t[r++]=s>>8&255),r<t.length&&(t[r++]=s>>16&255),6===o?(r<t.length&&(t[r++]=s>>24&255),n=0,o=0):(n=s>>>24,o+=2)}if(r<t.length)for(t[r++]=n;r<t.length;)t[r++]=0},s.prototype._toArrayLikeBE=function(t,e){for(var r=t.length-1,n=0,i=0,o=0;i<this.length;i++){var s=this.words[i]<<o|n;t[r--]=255&s,r>=0&&(t[r--]=s>>8&255),r>=0&&(t[r--]=s>>16&255),6===o?(r>=0&&(t[r--]=s>>24&255),n=0,o=0):(n=s>>>24,o+=2)}if(r>=0)for(t[r--]=n;r>=0;)t[r--]=0},Math.clz32?s.prototype._countBits=function(t){return 32-Math.clz32(t)}:s.prototype._countBits=function(t){var e=t,r=0;return e>=4096&&(r+=13,e>>>=13),e>=64&&(r+=7,e>>>=7),e>=8&&(r+=4,e>>>=4),e>=2&&(r+=2,e>>>=2),r+e},s.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,r=0;return 0==(8191&e)&&(r+=13,e>>>=13),0==(127&e)&&(r+=7,e>>>=7),0==(15&e)&&(r+=4,e>>>=4),0==(3&e)&&(r+=2,e>>>=2),0==(1&e)&&r++,r},s.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},s.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;e<this.length;e++){var r=this._zeroBits(this.words[e]);if(t+=r,26!==r)break}return t},s.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},s.prototype.toTwos=function(t){return 0!==this.negative?this.abs().inotn(t).iaddn(1):this.clone()},s.prototype.fromTwos=function(t){return this.testn(t-1)?this.notn(t).iaddn(1).ineg():this.clone()},s.prototype.isNeg=function(){return 0!==this.negative},s.prototype.neg=function(){return this.clone().ineg()},s.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},s.prototype.iuor=function(t){for(;this.length<t.length;)this.words[this.length++]=0;for(var e=0;e<t.length;e++)this.words[e]=this.words[e]|t.words[e];return this._strip()},s.prototype.ior=function(t){return i(0==(this.negative|t.negative)),this.iuor(t)},s.prototype.or=function(t){return this.length>t.length?this.clone().ior(t):t.clone().ior(this)},s.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},s.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var r=0;r<e.length;r++)this.words[r]=this.words[r]&t.words[r];return this.length=e.length,this._strip()},s.prototype.iand=function(t){return i(0==(this.negative|t.negative)),this.iuand(t)},s.prototype.and=function(t){return this.length>t.length?this.clone().iand(t):t.clone().iand(this)},s.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},s.prototype.iuxor=function(t){var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var n=0;n<r.length;n++)this.words[n]=e.words[n]^r.words[n];if(this!==e)for(;n<e.length;n++)this.words[n]=e.words[n];return this.length=e.length,this._strip()},s.prototype.ixor=function(t){return i(0==(this.negative|t.negative)),this.iuxor(t)},s.prototype.xor=function(t){return this.length>t.length?this.clone().ixor(t):t.clone().ixor(this)},s.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},s.prototype.inotn=function(t){i("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),r=t%26;this._expand(e),r>0&&e--;for(var n=0;n<e;n++)this.words[n]=67108863&~this.words[n];return r>0&&(this.words[n]=~this.words[n]&67108863>>26-r),this._strip()},s.prototype.notn=function(t){return this.clone().inotn(t)},s.prototype.setn=function(t,e){i("number"==typeof t&&t>=0);var r=t/26|0,n=t%26;return this._expand(r+1),this.words[r]=e?this.words[r]|1<<n:this.words[r]&~(1<<n),this._strip()},s.prototype.iadd=function(t){var e,r,n;if(0!==this.negative&&0===t.negative)return this.negative=0,e=this.isub(t),this.negative^=1,this._normSign();if(0===this.negative&&0!==t.negative)return t.negative=0,e=this.isub(t),t.negative=1,e._normSign();this.length>t.length?(r=this,n=t):(r=t,n=this);for(var i=0,o=0;o<n.length;o++)e=(0|r.words[o])+(0|n.words[o])+i,this.words[o]=67108863&e,i=e>>>26;for(;0!==i&&o<r.length;o++)e=(0|r.words[o])+i,this.words[o]=67108863&e,i=e>>>26;if(this.length=r.length,0!==i)this.words[this.length]=i,this.length++;else if(r!==this)for(;o<r.length;o++)this.words[o]=r.words[o];return this},s.prototype.add=function(t){var e;return 0!==t.negative&&0===this.negative?(t.negative=0,e=this.sub(t),t.negative^=1,e):0===t.negative&&0!==this.negative?(this.negative=0,e=t.sub(this),this.negative=1,e):this.length>t.length?this.clone().iadd(t):t.clone().iadd(this)},s.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r,n,i=this.cmp(t);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(r=this,n=t):(r=t,n=this);for(var o=0,s=0;s<n.length;s++)o=(e=(0|r.words[s])-(0|n.words[s])+o)>>26,this.words[s]=67108863&e;for(;0!==o&&s<r.length;s++)o=(e=(0|r.words[s])+o)>>26,this.words[s]=67108863&e;if(0===o&&s<r.length&&r!==this)for(;s<r.length;s++)this.words[s]=r.words[s];return this.length=Math.max(this.length,s),r!==this&&(this.negative=1),this._strip()},s.prototype.sub=function(t){return this.clone().isub(t)};var b=function(t,e,r){var n,i,o,s=t.words,a=e.words,u=r.words,h=0,f=0|s[0],c=8191&f,l=f>>>13,d=0|s[1],p=8191&d,m=d>>>13,y=0|s[2],b=8191&y,v=y>>>13,g=0|s[3],w=8191&g,_=g>>>13,M=0|s[4],S=8191&M,O=M>>>13,A=0|s[5],E=8191&A,x=A>>>13,k=0|s[6],j=8191&k,$=k>>>13,R=0|s[7],P=8191&R,B=R>>>13,T=0|s[8],I=8191&T,N=T>>>13,D=0|s[9],C=8191&D,L=D>>>13,q=0|a[0],U=8191&q,F=q>>>13,z=0|a[1],V=8191&z,K=z>>>13,H=0|a[2],W=8191&H,Z=H>>>13,J=0|a[3],Y=8191&J,G=J>>>13,Q=0|a[4],X=8191&Q,tt=Q>>>13,et=0|a[5],rt=8191&et,nt=et>>>13,it=0|a[6],ot=8191&it,st=it>>>13,at=0|a[7],ut=8191&at,ht=at>>>13,ft=0|a[8],ct=8191&ft,lt=ft>>>13,dt=0|a[9],pt=8191&dt,mt=dt>>>13;r.negative=t.negative^e.negative,r.length=19;var yt=(h+(n=Math.imul(c,U))|0)+((8191&(i=(i=Math.imul(c,F))+Math.imul(l,U)|0))<<13)|0;h=((o=Math.imul(l,F))+(i>>>13)|0)+(yt>>>26)|0,yt&=67108863,n=Math.imul(p,U),i=(i=Math.imul(p,F))+Math.imul(m,U)|0,o=Math.imul(m,F);var bt=(h+(n=n+Math.imul(c,V)|0)|0)+((8191&(i=(i=i+Math.imul(c,K)|0)+Math.imul(l,V)|0))<<13)|0;h=((o=o+Math.imul(l,K)|0)+(i>>>13)|0)+(bt>>>26)|0,bt&=67108863,n=Math.imul(b,U),i=(i=Math.imul(b,F))+Math.imul(v,U)|0,o=Math.imul(v,F),n=n+Math.imul(p,V)|0,i=(i=i+Math.imul(p,K)|0)+Math.imul(m,V)|0,o=o+Math.imul(m,K)|0;var vt=(h+(n=n+Math.imul(c,W)|0)|0)+((8191&(i=(i=i+Math.imul(c,Z)|0)+Math.imul(l,W)|0))<<13)|0;h=((o=o+Math.imul(l,Z)|0)+(i>>>13)|0)+(vt>>>26)|0,vt&=67108863,n=Math.imul(w,U),i=(i=Math.imul(w,F))+Math.imul(_,U)|0,o=Math.imul(_,F),n=n+Math.imul(b,V)|0,i=(i=i+Math.imul(b,K)|0)+Math.imul(v,V)|0,o=o+Math.imul(v,K)|0,n=n+Math.imul(p,W)|0,i=(i=i+Math.imul(p,Z)|0)+Math.imul(m,W)|0,o=o+Math.imul(m,Z)|0;var gt=(h+(n=n+Math.imul(c,Y)|0)|0)+((8191&(i=(i=i+Math.imul(c,G)|0)+Math.imul(l,Y)|0))<<13)|0;h=((o=o+Math.imul(l,G)|0)+(i>>>13)|0)+(gt>>>26)|0,gt&=67108863,n=Math.imul(S,U),i=(i=Math.imul(S,F))+Math.imul(O,U)|0,o=Math.imul(O,F),n=n+Math.imul(w,V)|0,i=(i=i+Math.imul(w,K)|0)+Math.imul(_,V)|0,o=o+Math.imul(_,K)|0,n=n+Math.imul(b,W)|0,i=(i=i+Math.imul(b,Z)|0)+Math.imul(v,W)|0,o=o+Math.imul(v,Z)|0,n=n+Math.imul(p,Y)|0,i=(i=i+Math.imul(p,G)|0)+Math.imul(m,Y)|0,o=o+Math.imul(m,G)|0;var wt=(h+(n=n+Math.imul(c,X)|0)|0)+((8191&(i=(i=i+Math.imul(c,tt)|0)+Math.imul(l,X)|0))<<13)|0;h=((o=o+Math.imul(l,tt)|0)+(i>>>13)|0)+(wt>>>26)|0,wt&=67108863,n=Math.imul(E,U),i=(i=Math.imul(E,F))+Math.imul(x,U)|0,o=Math.imul(x,F),n=n+Math.imul(S,V)|0,i=(i=i+Math.imul(S,K)|0)+Math.imul(O,V)|0,o=o+Math.imul(O,K)|0,n=n+Math.imul(w,W)|0,i=(i=i+Math.imul(w,Z)|0)+Math.imul(_,W)|0,o=o+Math.imul(_,Z)|0,n=n+Math.imul(b,Y)|0,i=(i=i+Math.imul(b,G)|0)+Math.imul(v,Y)|0,o=o+Math.imul(v,G)|0,n=n+Math.imul(p,X)|0,i=(i=i+Math.imul(p,tt)|0)+Math.imul(m,X)|0,o=o+Math.imul(m,tt)|0;var _t=(h+(n=n+Math.imul(c,rt)|0)|0)+((8191&(i=(i=i+Math.imul(c,nt)|0)+Math.imul(l,rt)|0))<<13)|0;h=((o=o+Math.imul(l,nt)|0)+(i>>>13)|0)+(_t>>>26)|0,_t&=67108863,n=Math.imul(j,U),i=(i=Math.imul(j,F))+Math.imul($,U)|0,o=Math.imul($,F),n=n+Math.imul(E,V)|0,i=(i=i+Math.imul(E,K)|0)+Math.imul(x,V)|0,o=o+Math.imul(x,K)|0,n=n+Math.imul(S,W)|0,i=(i=i+Math.imul(S,Z)|0)+Math.imul(O,W)|0,o=o+Math.imul(O,Z)|0,n=n+Math.imul(w,Y)|0,i=(i=i+Math.imul(w,G)|0)+Math.imul(_,Y)|0,o=o+Math.imul(_,G)|0,n=n+Math.imul(b,X)|0,i=(i=i+Math.imul(b,tt)|0)+Math.imul(v,X)|0,o=o+Math.imul(v,tt)|0,n=n+Math.imul(p,rt)|0,i=(i=i+Math.imul(p,nt)|0)+Math.imul(m,rt)|0,o=o+Math.imul(m,nt)|0;var Mt=(h+(n=n+Math.imul(c,ot)|0)|0)+((8191&(i=(i=i+Math.imul(c,st)|0)+Math.imul(l,ot)|0))<<13)|0;h=((o=o+Math.imul(l,st)|0)+(i>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,n=Math.imul(P,U),i=(i=Math.imul(P,F))+Math.imul(B,U)|0,o=Math.imul(B,F),n=n+Math.imul(j,V)|0,i=(i=i+Math.imul(j,K)|0)+Math.imul($,V)|0,o=o+Math.imul($,K)|0,n=n+Math.imul(E,W)|0,i=(i=i+Math.imul(E,Z)|0)+Math.imul(x,W)|0,o=o+Math.imul(x,Z)|0,n=n+Math.imul(S,Y)|0,i=(i=i+Math.imul(S,G)|0)+Math.imul(O,Y)|0,o=o+Math.imul(O,G)|0,n=n+Math.imul(w,X)|0,i=(i=i+Math.imul(w,tt)|0)+Math.imul(_,X)|0,o=o+Math.imul(_,tt)|0,n=n+Math.imul(b,rt)|0,i=(i=i+Math.imul(b,nt)|0)+Math.imul(v,rt)|0,o=o+Math.imul(v,nt)|0,n=n+Math.imul(p,ot)|0,i=(i=i+Math.imul(p,st)|0)+Math.imul(m,ot)|0,o=o+Math.imul(m,st)|0;var St=(h+(n=n+Math.imul(c,ut)|0)|0)+((8191&(i=(i=i+Math.imul(c,ht)|0)+Math.imul(l,ut)|0))<<13)|0;h=((o=o+Math.imul(l,ht)|0)+(i>>>13)|0)+(St>>>26)|0,St&=67108863,n=Math.imul(I,U),i=(i=Math.imul(I,F))+Math.imul(N,U)|0,o=Math.imul(N,F),n=n+Math.imul(P,V)|0,i=(i=i+Math.imul(P,K)|0)+Math.imul(B,V)|0,o=o+Math.imul(B,K)|0,n=n+Math.imul(j,W)|0,i=(i=i+Math.imul(j,Z)|0)+Math.imul($,W)|0,o=o+Math.imul($,Z)|0,n=n+Math.imul(E,Y)|0,i=(i=i+Math.imul(E,G)|0)+Math.imul(x,Y)|0,o=o+Math.imul(x,G)|0,n=n+Math.imul(S,X)|0,i=(i=i+Math.imul(S,tt)|0)+Math.imul(O,X)|0,o=o+Math.imul(O,tt)|0,n=n+Math.imul(w,rt)|0,i=(i=i+Math.imul(w,nt)|0)+Math.imul(_,rt)|0,o=o+Math.imul(_,nt)|0,n=n+Math.imul(b,ot)|0,i=(i=i+Math.imul(b,st)|0)+Math.imul(v,ot)|0,o=o+Math.imul(v,st)|0,n=n+Math.imul(p,ut)|0,i=(i=i+Math.imul(p,ht)|0)+Math.imul(m,ut)|0,o=o+Math.imul(m,ht)|0;var Ot=(h+(n=n+Math.imul(c,ct)|0)|0)+((8191&(i=(i=i+Math.imul(c,lt)|0)+Math.imul(l,ct)|0))<<13)|0;h=((o=o+Math.imul(l,lt)|0)+(i>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,n=Math.imul(C,U),i=(i=Math.imul(C,F))+Math.imul(L,U)|0,o=Math.imul(L,F),n=n+Math.imul(I,V)|0,i=(i=i+Math.imul(I,K)|0)+Math.imul(N,V)|0,o=o+Math.imul(N,K)|0,n=n+Math.imul(P,W)|0,i=(i=i+Math.imul(P,Z)|0)+Math.imul(B,W)|0,o=o+Math.imul(B,Z)|0,n=n+Math.imul(j,Y)|0,i=(i=i+Math.imul(j,G)|0)+Math.imul($,Y)|0,o=o+Math.imul($,G)|0,n=n+Math.imul(E,X)|0,i=(i=i+Math.imul(E,tt)|0)+Math.imul(x,X)|0,o=o+Math.imul(x,tt)|0,n=n+Math.imul(S,rt)|0,i=(i=i+Math.imul(S,nt)|0)+Math.imul(O,rt)|0,o=o+Math.imul(O,nt)|0,n=n+Math.imul(w,ot)|0,i=(i=i+Math.imul(w,st)|0)+Math.imul(_,ot)|0,o=o+Math.imul(_,st)|0,n=n+Math.imul(b,ut)|0,i=(i=i+Math.imul(b,ht)|0)+Math.imul(v,ut)|0,o=o+Math.imul(v,ht)|0,n=n+Math.imul(p,ct)|0,i=(i=i+Math.imul(p,lt)|0)+Math.imul(m,ct)|0,o=o+Math.imul(m,lt)|0;var At=(h+(n=n+Math.imul(c,pt)|0)|0)+((8191&(i=(i=i+Math.imul(c,mt)|0)+Math.imul(l,pt)|0))<<13)|0;h=((o=o+Math.imul(l,mt)|0)+(i>>>13)|0)+(At>>>26)|0,At&=67108863,n=Math.imul(C,V),i=(i=Math.imul(C,K))+Math.imul(L,V)|0,o=Math.imul(L,K),n=n+Math.imul(I,W)|0,i=(i=i+Math.imul(I,Z)|0)+Math.imul(N,W)|0,o=o+Math.imul(N,Z)|0,n=n+Math.imul(P,Y)|0,i=(i=i+Math.imul(P,G)|0)+Math.imul(B,Y)|0,o=o+Math.imul(B,G)|0,n=n+Math.imul(j,X)|0,i=(i=i+Math.imul(j,tt)|0)+Math.imul($,X)|0,o=o+Math.imul($,tt)|0,n=n+Math.imul(E,rt)|0,i=(i=i+Math.imul(E,nt)|0)+Math.imul(x,rt)|0,o=o+Math.imul(x,nt)|0,n=n+Math.imul(S,ot)|0,i=(i=i+Math.imul(S,st)|0)+Math.imul(O,ot)|0,o=o+Math.imul(O,st)|0,n=n+Math.imul(w,ut)|0,i=(i=i+Math.imul(w,ht)|0)+Math.imul(_,ut)|0,o=o+Math.imul(_,ht)|0,n=n+Math.imul(b,ct)|0,i=(i=i+Math.imul(b,lt)|0)+Math.imul(v,ct)|0,o=o+Math.imul(v,lt)|0;var Et=(h+(n=n+Math.imul(p,pt)|0)|0)+((8191&(i=(i=i+Math.imul(p,mt)|0)+Math.imul(m,pt)|0))<<13)|0;h=((o=o+Math.imul(m,mt)|0)+(i>>>13)|0)+(Et>>>26)|0,Et&=67108863,n=Math.imul(C,W),i=(i=Math.imul(C,Z))+Math.imul(L,W)|0,o=Math.imul(L,Z),n=n+Math.imul(I,Y)|0,i=(i=i+Math.imul(I,G)|0)+Math.imul(N,Y)|0,o=o+Math.imul(N,G)|0,n=n+Math.imul(P,X)|0,i=(i=i+Math.imul(P,tt)|0)+Math.imul(B,X)|0,o=o+Math.imul(B,tt)|0,n=n+Math.imul(j,rt)|0,i=(i=i+Math.imul(j,nt)|0)+Math.imul($,rt)|0,o=o+Math.imul($,nt)|0,n=n+Math.imul(E,ot)|0,i=(i=i+Math.imul(E,st)|0)+Math.imul(x,ot)|0,o=o+Math.imul(x,st)|0,n=n+Math.imul(S,ut)|0,i=(i=i+Math.imul(S,ht)|0)+Math.imul(O,ut)|0,o=o+Math.imul(O,ht)|0,n=n+Math.imul(w,ct)|0,i=(i=i+Math.imul(w,lt)|0)+Math.imul(_,ct)|0,o=o+Math.imul(_,lt)|0;var xt=(h+(n=n+Math.imul(b,pt)|0)|0)+((8191&(i=(i=i+Math.imul(b,mt)|0)+Math.imul(v,pt)|0))<<13)|0;h=((o=o+Math.imul(v,mt)|0)+(i>>>13)|0)+(xt>>>26)|0,xt&=67108863,n=Math.imul(C,Y),i=(i=Math.imul(C,G))+Math.imul(L,Y)|0,o=Math.imul(L,G),n=n+Math.imul(I,X)|0,i=(i=i+Math.imul(I,tt)|0)+Math.imul(N,X)|0,o=o+Math.imul(N,tt)|0,n=n+Math.imul(P,rt)|0,i=(i=i+Math.imul(P,nt)|0)+Math.imul(B,rt)|0,o=o+Math.imul(B,nt)|0,n=n+Math.imul(j,ot)|0,i=(i=i+Math.imul(j,st)|0)+Math.imul($,ot)|0,o=o+Math.imul($,st)|0,n=n+Math.imul(E,ut)|0,i=(i=i+Math.imul(E,ht)|0)+Math.imul(x,ut)|0,o=o+Math.imul(x,ht)|0,n=n+Math.imul(S,ct)|0,i=(i=i+Math.imul(S,lt)|0)+Math.imul(O,ct)|0,o=o+Math.imul(O,lt)|0;var kt=(h+(n=n+Math.imul(w,pt)|0)|0)+((8191&(i=(i=i+Math.imul(w,mt)|0)+Math.imul(_,pt)|0))<<13)|0;h=((o=o+Math.imul(_,mt)|0)+(i>>>13)|0)+(kt>>>26)|0,kt&=67108863,n=Math.imul(C,X),i=(i=Math.imul(C,tt))+Math.imul(L,X)|0,o=Math.imul(L,tt),n=n+Math.imul(I,rt)|0,i=(i=i+Math.imul(I,nt)|0)+Math.imul(N,rt)|0,o=o+Math.imul(N,nt)|0,n=n+Math.imul(P,ot)|0,i=(i=i+Math.imul(P,st)|0)+Math.imul(B,ot)|0,o=o+Math.imul(B,st)|0,n=n+Math.imul(j,ut)|0,i=(i=i+Math.imul(j,ht)|0)+Math.imul($,ut)|0,o=o+Math.imul($,ht)|0,n=n+Math.imul(E,ct)|0,i=(i=i+Math.imul(E,lt)|0)+Math.imul(x,ct)|0,o=o+Math.imul(x,lt)|0;var jt=(h+(n=n+Math.imul(S,pt)|0)|0)+((8191&(i=(i=i+Math.imul(S,mt)|0)+Math.imul(O,pt)|0))<<13)|0;h=((o=o+Math.imul(O,mt)|0)+(i>>>13)|0)+(jt>>>26)|0,jt&=67108863,n=Math.imul(C,rt),i=(i=Math.imul(C,nt))+Math.imul(L,rt)|0,o=Math.imul(L,nt),n=n+Math.imul(I,ot)|0,i=(i=i+Math.imul(I,st)|0)+Math.imul(N,ot)|0,o=o+Math.imul(N,st)|0,n=n+Math.imul(P,ut)|0,i=(i=i+Math.imul(P,ht)|0)+Math.imul(B,ut)|0,o=o+Math.imul(B,ht)|0,n=n+Math.imul(j,ct)|0,i=(i=i+Math.imul(j,lt)|0)+Math.imul($,ct)|0,o=o+Math.imul($,lt)|0;var $t=(h+(n=n+Math.imul(E,pt)|0)|0)+((8191&(i=(i=i+Math.imul(E,mt)|0)+Math.imul(x,pt)|0))<<13)|0;h=((o=o+Math.imul(x,mt)|0)+(i>>>13)|0)+($t>>>26)|0,$t&=67108863,n=Math.imul(C,ot),i=(i=Math.imul(C,st))+Math.imul(L,ot)|0,o=Math.imul(L,st),n=n+Math.imul(I,ut)|0,i=(i=i+Math.imul(I,ht)|0)+Math.imul(N,ut)|0,o=o+Math.imul(N,ht)|0,n=n+Math.imul(P,ct)|0,i=(i=i+Math.imul(P,lt)|0)+Math.imul(B,ct)|0,o=o+Math.imul(B,lt)|0;var Rt=(h+(n=n+Math.imul(j,pt)|0)|0)+((8191&(i=(i=i+Math.imul(j,mt)|0)+Math.imul($,pt)|0))<<13)|0;h=((o=o+Math.imul($,mt)|0)+(i>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,n=Math.imul(C,ut),i=(i=Math.imul(C,ht))+Math.imul(L,ut)|0,o=Math.imul(L,ht),n=n+Math.imul(I,ct)|0,i=(i=i+Math.imul(I,lt)|0)+Math.imul(N,ct)|0,o=o+Math.imul(N,lt)|0;var Pt=(h+(n=n+Math.imul(P,pt)|0)|0)+((8191&(i=(i=i+Math.imul(P,mt)|0)+Math.imul(B,pt)|0))<<13)|0;h=((o=o+Math.imul(B,mt)|0)+(i>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,n=Math.imul(C,ct),i=(i=Math.imul(C,lt))+Math.imul(L,ct)|0,o=Math.imul(L,lt);var Bt=(h+(n=n+Math.imul(I,pt)|0)|0)+((8191&(i=(i=i+Math.imul(I,mt)|0)+Math.imul(N,pt)|0))<<13)|0;h=((o=o+Math.imul(N,mt)|0)+(i>>>13)|0)+(Bt>>>26)|0,Bt&=67108863;var Tt=(h+(n=Math.imul(C,pt))|0)+((8191&(i=(i=Math.imul(C,mt))+Math.imul(L,pt)|0))<<13)|0;return h=((o=Math.imul(L,mt))+(i>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,u[0]=yt,u[1]=bt,u[2]=vt,u[3]=gt,u[4]=wt,u[5]=_t,u[6]=Mt,u[7]=St,u[8]=Ot,u[9]=At,u[10]=Et,u[11]=xt,u[12]=kt,u[13]=jt,u[14]=$t,u[15]=Rt,u[16]=Pt,u[17]=Bt,u[18]=Tt,0!==h&&(u[19]=h,r.length++),r};function v(t,e,r){r.negative=e.negative^t.negative,r.length=t.length+e.length;for(var n=0,i=0,o=0;o<r.length-1;o++){var s=i;i=0;for(var a=67108863&n,u=Math.min(o,e.length-1),h=Math.max(0,o-t.length+1);h<=u;h++){var f=o-h,c=(0|t.words[f])*(0|e.words[h]),l=67108863&c;a=67108863&(l=l+a|0),i+=(s=(s=s+(c/67108864|0)|0)+(l>>>26)|0)>>>26,s&=67108863}r.words[o]=a,n=s,s=i}return 0!==n?r.words[o]=n:r.length--,r._strip()}function g(t,e,r){return v(t,e,r)}function w(t,e){this.x=t,this.y=e}Math.imul||(b=y),s.prototype.mulTo=function(t,e){var r=this.length+t.length;return 10===this.length&&10===t.length?b(this,t,e):r<63?y(this,t,e):r<1024?v(this,t,e):g(this,t,e)},w.prototype.makeRBT=function(t){for(var e=new Array(t),r=s.prototype._countBits(t)-1,n=0;n<t;n++)e[n]=this.revBin(n,r,t);return e},w.prototype.revBin=function(t,e,r){if(0===t||t===r-1)return t;for(var n=0,i=0;i<e;i++)n|=(1&t)<<e-i-1,t>>=1;return n},w.prototype.permute=function(t,e,r,n,i,o){for(var s=0;s<o;s++)n[s]=e[t[s]],i[s]=r[t[s]]},w.prototype.transform=function(t,e,r,n,i,o){this.permute(o,t,e,r,n,i);for(var s=1;s<i;s<<=1)for(var a=s<<1,u=Math.cos(2*Math.PI/a),h=Math.sin(2*Math.PI/a),f=0;f<i;f+=a)for(var c=u,l=h,d=0;d<s;d++){var p=r[f+d],m=n[f+d],y=r[f+d+s],b=n[f+d+s],v=c*y-l*b;b=c*b+l*y,y=v,r[f+d]=p+y,n[f+d]=m+b,r[f+d+s]=p-y,n[f+d+s]=m-b,d!==a&&(v=u*c-h*l,l=u*l+h*c,c=v)}},w.prototype.guessLen13b=function(t,e){var r=1|Math.max(e,t),n=1&r,i=0;for(r=r/2|0;r;r>>>=1)i++;return 1<<i+1+n},w.prototype.conjugate=function(t,e,r){if(!(r<=1))for(var n=0;n<r/2;n++){var i=t[n];t[n]=t[r-n-1],t[r-n-1]=i,i=e[n],e[n]=-e[r-n-1],e[r-n-1]=-i}},w.prototype.normalize13b=function(t,e){for(var r=0,n=0;n<e/2;n++){var i=8192*Math.round(t[2*n+1]/e)+Math.round(t[2*n]/e)+r;t[n]=67108863&i,r=i<67108864?0:i/67108864|0}return t},w.prototype.convert13b=function(t,e,r,n){for(var o=0,s=0;s<e;s++)o+=0|t[s],r[2*s]=8191&o,o>>>=13,r[2*s+1]=8191&o,o>>>=13;for(s=2*e;s<n;++s)r[s]=0;i(0===o),i(0==(-8192&o))},w.prototype.stub=function(t){for(var e=new Array(t),r=0;r<t;r++)e[r]=0;return e},w.prototype.mulp=function(t,e,r){var n=2*this.guessLen13b(t.length,e.length),i=this.makeRBT(n),o=this.stub(n),s=new Array(n),a=new Array(n),u=new Array(n),h=new Array(n),f=new Array(n),c=new Array(n),l=r.words;l.length=n,this.convert13b(t.words,t.length,s,n),this.convert13b(e.words,e.length,h,n),this.transform(s,o,a,u,n,i),this.transform(h,o,f,c,n,i);for(var d=0;d<n;d++){var p=a[d]*f[d]-u[d]*c[d];u[d]=a[d]*c[d]+u[d]*f[d],a[d]=p}return this.conjugate(a,u,n),this.transform(a,u,l,o,n,i),this.conjugate(l,o,n),this.normalize13b(l,n),r.negative=t.negative^e.negative,r.length=t.length+e.length,r._strip()},s.prototype.mul=function(t){var e=new s(null);return e.words=new Array(this.length+t.length),this.mulTo(t,e)},s.prototype.mulf=function(t){var e=new s(null);return e.words=new Array(this.length+t.length),g(this,t,e)},s.prototype.imul=function(t){return this.clone().mulTo(t,this)},s.prototype.imuln=function(t){var e=t<0;e&&(t=-t),i("number"==typeof t),i(t<67108864);for(var r=0,n=0;n<this.length;n++){var o=(0|this.words[n])*t,s=(67108863&o)+(67108863&r);r>>=26,r+=o/67108864|0,r+=s>>>26,this.words[n]=67108863&s}return 0!==r&&(this.words[n]=r,this.length++),e?this.ineg():this},s.prototype.muln=function(t){return this.clone().imuln(t)},s.prototype.sqr=function(){return this.mul(this)},s.prototype.isqr=function(){return this.imul(this.clone())},s.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),r=0;r<e.length;r++){var n=r/26|0,i=r%26;e[r]=t.words[n]>>>i&1}return e}(t);if(0===e.length)return new s(1);for(var r=this,n=0;n<e.length&&0===e[n];n++,r=r.sqr());if(++n<e.length)for(var i=r.sqr();n<e.length;n++,i=i.sqr())0!==e[n]&&(r=r.mul(i));return r},s.prototype.iushln=function(t){i("number"==typeof t&&t>=0);var e,r=t%26,n=(t-r)/26,o=67108863>>>26-r<<26-r;if(0!==r){var s=0;for(e=0;e<this.length;e++){var a=this.words[e]&o,u=(0|this.words[e])-a<<r;this.words[e]=u|s,s=a>>>26-r}s&&(this.words[e]=s,this.length++)}if(0!==n){for(e=this.length-1;e>=0;e--)this.words[e+n]=this.words[e];for(e=0;e<n;e++)this.words[e]=0;this.length+=n}return this._strip()},s.prototype.ishln=function(t){return i(0===this.negative),this.iushln(t)},s.prototype.iushrn=function(t,e,r){var n;i("number"==typeof t&&t>=0),n=e?(e-e%26)/26:0;var o=t%26,s=Math.min((t-o)/26,this.length),a=67108863^67108863>>>o<<o,u=r;if(n-=s,n=Math.max(0,n),u){for(var h=0;h<s;h++)u.words[h]=this.words[h];u.length=s}if(0===s);else if(this.length>s)for(this.length-=s,h=0;h<this.length;h++)this.words[h]=this.words[h+s];else this.words[0]=0,this.length=1;var f=0;for(h=this.length-1;h>=0&&(0!==f||h>=n);h--){var c=0|this.words[h];this.words[h]=f<<26-o|c>>>o,f=c&a}return u&&0!==f&&(u.words[u.length++]=f),0===this.length&&(this.words[0]=0,this.length=1),this._strip()},s.prototype.ishrn=function(t,e,r){return i(0===this.negative),this.iushrn(t,e,r)},s.prototype.shln=function(t){return this.clone().ishln(t)},s.prototype.ushln=function(t){return this.clone().iushln(t)},s.prototype.shrn=function(t){return this.clone().ishrn(t)},s.prototype.ushrn=function(t){return this.clone().iushrn(t)},s.prototype.testn=function(t){i("number"==typeof t&&t>=0);var e=t%26,r=(t-e)/26,n=1<<e;return!(this.length<=r)&&!!(this.words[r]&n)},s.prototype.imaskn=function(t){i("number"==typeof t&&t>=0);var e=t%26,r=(t-e)/26;if(i(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==e&&r++,this.length=Math.min(r,this.length),0!==e){var n=67108863^67108863>>>e<<e;this.words[this.length-1]&=n}return this._strip()},s.prototype.maskn=function(t){return this.clone().imaskn(t)},s.prototype.iaddn=function(t){return i("number"==typeof t),i(t<67108864),t<0?this.isubn(-t):0!==this.negative?1===this.length&&(0|this.words[0])<=t?(this.words[0]=t-(0|this.words[0]),this.negative=0,this):(this.negative=0,this.isubn(t),this.negative=1,this):this._iaddn(t)},s.prototype._iaddn=function(t){this.words[0]+=t;for(var e=0;e<this.length&&this.words[e]>=67108864;e++)this.words[e]-=67108864,e===this.length-1?this.words[e+1]=1:this.words[e+1]++;return this.length=Math.max(this.length,e+1),this},s.prototype.isubn=function(t){if(i("number"==typeof t),i(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var e=0;e<this.length&&this.words[e]<0;e++)this.words[e]+=67108864,this.words[e+1]-=1;return this._strip()},s.prototype.addn=function(t){return this.clone().iaddn(t)},s.prototype.subn=function(t){return this.clone().isubn(t)},s.prototype.iabs=function(){return this.negative=0,this},s.prototype.abs=function(){return this.clone().iabs()},s.prototype._ishlnsubmul=function(t,e,r){var n,o,s=t.length+r;this._expand(s);var a=0;for(n=0;n<t.length;n++){o=(0|this.words[n+r])+a;var u=(0|t.words[n])*e;a=((o-=67108863&u)>>26)-(u/67108864|0),this.words[n+r]=67108863&o}for(;n<this.length-r;n++)a=(o=(0|this.words[n+r])+a)>>26,this.words[n+r]=67108863&o;if(0===a)return this._strip();for(i(-1===a),a=0,n=0;n<this.length;n++)a=(o=-(0|this.words[n])+a)>>26,this.words[n]=67108863&o;return this.negative=1,this._strip()},s.prototype._wordDiv=function(t,e){var r=(this.length,t.length),n=this.clone(),i=t,o=0|i.words[i.length-1];0!==(r=26-this._countBits(o))&&(i=i.ushln(r),n.iushln(r),o=0|i.words[i.length-1]);var a,u=n.length-i.length;if("mod"!==e){(a=new s(null)).length=u+1,a.words=new Array(a.length);for(var h=0;h<a.length;h++)a.words[h]=0}var f=n.clone()._ishlnsubmul(i,1,u);0===f.negative&&(n=f,a&&(a.words[u]=1));for(var c=u-1;c>=0;c--){var l=67108864*(0|n.words[i.length+c])+(0|n.words[i.length+c-1]);for(l=Math.min(l/o|0,67108863),n._ishlnsubmul(i,l,c);0!==n.negative;)l--,n.negative=0,n._ishlnsubmul(i,1,c),n.isZero()||(n.negative^=1);a&&(a.words[c]=l)}return a&&a._strip(),n._strip(),"div"!==e&&0!==r&&n.iushrn(r),{div:a||null,mod:n}},s.prototype.divmod=function(t,e,r){return i(!t.isZero()),this.isZero()?{div:new s(0),mod:new s(0)}:0!==this.negative&&0===t.negative?(a=this.neg().divmod(t,e),"mod"!==e&&(n=a.div.neg()),"div"!==e&&(o=a.mod.neg(),r&&0!==o.negative&&o.iadd(t)),{div:n,mod:o}):0===this.negative&&0!==t.negative?(a=this.divmod(t.neg(),e),"mod"!==e&&(n=a.div.neg()),{div:n,mod:a.mod}):0!=(this.negative&t.negative)?(a=this.neg().divmod(t.neg(),e),"div"!==e&&(o=a.mod.neg(),r&&0!==o.negative&&o.isub(t)),{div:a.div,mod:o}):t.length>this.length||this.cmp(t)<0?{div:new s(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new s(this.modrn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new s(this.modrn(t.words[0]))}:this._wordDiv(t,e);var n,o,a},s.prototype.div=function(t){return this.divmod(t,"div",!1).div},s.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},s.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},s.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var r=0!==e.div.negative?e.mod.isub(t):e.mod,n=t.ushrn(1),i=t.andln(1),o=r.cmp(n);return o<0||1===i&&0===o?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},s.prototype.modrn=function(t){var e=t<0;e&&(t=-t),i(t<=67108863);for(var r=(1<<26)%t,n=0,o=this.length-1;o>=0;o--)n=(r*n+(0|this.words[o]))%t;return e?-n:n},s.prototype.modn=function(t){return this.modrn(t)},s.prototype.idivn=function(t){var e=t<0;e&&(t=-t),i(t<=67108863);for(var r=0,n=this.length-1;n>=0;n--){var o=(0|this.words[n])+67108864*r;this.words[n]=o/t|0,r=o%t}return this._strip(),e?this.ineg():this},s.prototype.divn=function(t){return this.clone().idivn(t)},s.prototype.egcd=function(t){i(0===t.negative),i(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var n=new s(1),o=new s(0),a=new s(0),u=new s(1),h=0;e.isEven()&&r.isEven();)e.iushrn(1),r.iushrn(1),++h;for(var f=r.clone(),c=e.clone();!e.isZero();){for(var l=0,d=1;0==(e.words[0]&d)&&l<26;++l,d<<=1);if(l>0)for(e.iushrn(l);l-- >0;)(n.isOdd()||o.isOdd())&&(n.iadd(f),o.isub(c)),n.iushrn(1),o.iushrn(1);for(var p=0,m=1;0==(r.words[0]&m)&&p<26;++p,m<<=1);if(p>0)for(r.iushrn(p);p-- >0;)(a.isOdd()||u.isOdd())&&(a.iadd(f),u.isub(c)),a.iushrn(1),u.iushrn(1);e.cmp(r)>=0?(e.isub(r),n.isub(a),o.isub(u)):(r.isub(e),a.isub(n),u.isub(o))}return{a:a,b:u,gcd:r.iushln(h)}},s.prototype._invmp=function(t){i(0===t.negative),i(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var n,o=new s(1),a=new s(0),u=r.clone();e.cmpn(1)>0&&r.cmpn(1)>0;){for(var h=0,f=1;0==(e.words[0]&f)&&h<26;++h,f<<=1);if(h>0)for(e.iushrn(h);h-- >0;)o.isOdd()&&o.iadd(u),o.iushrn(1);for(var c=0,l=1;0==(r.words[0]&l)&&c<26;++c,l<<=1);if(c>0)for(r.iushrn(c);c-- >0;)a.isOdd()&&a.iadd(u),a.iushrn(1);e.cmp(r)>=0?(e.isub(r),o.isub(a)):(r.isub(e),a.isub(o))}return(n=0===e.cmpn(1)?o:a).cmpn(0)<0&&n.iadd(t),n},s.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),r=t.clone();e.negative=0,r.negative=0;for(var n=0;e.isEven()&&r.isEven();n++)e.iushrn(1),r.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;r.isEven();)r.iushrn(1);var i=e.cmp(r);if(i<0){var o=e;e=r,r=o}else if(0===i||0===r.cmpn(1))break;e.isub(r)}return r.iushln(n)},s.prototype.invm=function(t){return this.egcd(t).a.umod(t)},s.prototype.isEven=function(){return 0==(1&this.words[0])},s.prototype.isOdd=function(){return 1==(1&this.words[0])},s.prototype.andln=function(t){return this.words[0]&t},s.prototype.bincn=function(t){i("number"==typeof t);var e=t%26,r=(t-e)/26,n=1<<e;if(this.length<=r)return this._expand(r+1),this.words[r]|=n,this;for(var o=n,s=r;0!==o&&s<this.length;s++){var a=0|this.words[s];o=(a+=o)>>>26,a&=67108863,this.words[s]=a}return 0!==o&&(this.words[s]=o,this.length++),this},s.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},s.prototype.cmpn=function(t){var e,r=t<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this._strip(),this.length>1)e=1;else{r&&(t=-t),i(t<=67108863,"Number is too big");var n=0|this.words[0];e=n===t?0:n<t?-1:1}return 0!==this.negative?0|-e:e},s.prototype.cmp=function(t){if(0!==this.negative&&0===t.negative)return-1;if(0===this.negative&&0!==t.negative)return 1;var e=this.ucmp(t);return 0!==this.negative?0|-e:e},s.prototype.ucmp=function(t){if(this.length>t.length)return 1;if(this.length<t.length)return-1;for(var e=0,r=this.length-1;r>=0;r--){var n=0|this.words[r],i=0|t.words[r];if(n!==i){n<i?e=-1:n>i&&(e=1);break}}return e},s.prototype.gtn=function(t){return 1===this.cmpn(t)},s.prototype.gt=function(t){return 1===this.cmp(t)},s.prototype.gten=function(t){return this.cmpn(t)>=0},s.prototype.gte=function(t){return this.cmp(t)>=0},s.prototype.ltn=function(t){return-1===this.cmpn(t)},s.prototype.lt=function(t){return-1===this.cmp(t)},s.prototype.lten=function(t){return this.cmpn(t)<=0},s.prototype.lte=function(t){return this.cmp(t)<=0},s.prototype.eqn=function(t){return 0===this.cmpn(t)},s.prototype.eq=function(t){return 0===this.cmp(t)},s.red=function(t){return new x(t)},s.prototype.toRed=function(t){return i(!this.red,"Already a number in reduction context"),i(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},s.prototype.fromRed=function(){return i(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},s.prototype._forceRed=function(t){return this.red=t,this},s.prototype.forceRed=function(t){return i(!this.red,"Already a number in reduction context"),this._forceRed(t)},s.prototype.redAdd=function(t){return i(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},s.prototype.redIAdd=function(t){return i(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},s.prototype.redSub=function(t){return i(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},s.prototype.redISub=function(t){return i(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},s.prototype.redShl=function(t){return i(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},s.prototype.redMul=function(t){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},s.prototype.redIMul=function(t){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},s.prototype.redSqr=function(){return i(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},s.prototype.redISqr=function(){return i(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},s.prototype.redSqrt=function(){return i(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},s.prototype.redInvm=function(){return i(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},s.prototype.redNeg=function(){return i(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},s.prototype.redPow=function(t){return i(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var _={k256:null,p224:null,p192:null,p25519:null};function M(t,e){this.name=t,this.p=new s(e,16),this.n=this.p.bitLength(),this.k=new s(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function S(){M.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function O(){M.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function A(){M.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function E(){M.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function x(t){if("string"==typeof t){var e=s._prime(t);this.m=e.p,this.prime=e}else i(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function k(t){x.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new s(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}M.prototype._tmp=function(){var t=new s(null);return t.words=new Array(Math.ceil(this.n/13)),t},M.prototype.ireduce=function(t){var e,r=t;do{this.split(r,this.tmp),e=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(e>this.n);var n=e<this.n?-1:r.ucmp(this.p);return 0===n?(r.words[0]=0,r.length=1):n>0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},M.prototype.split=function(t,e){t.iushrn(this.n,0,e)},M.prototype.imulK=function(t){return t.imul(this.k)},o(S,M),S.prototype.split=function(t,e){for(var r=Math.min(t.length,9),n=0;n<r;n++)e.words[n]=t.words[n];if(e.length=r,t.length<=9)return t.words[0]=0,void(t.length=1);var i=t.words[9];for(e.words[e.length++]=4194303&i,n=10;n<t.length;n++){var o=0|t.words[n];t.words[n-10]=(4194303&o)<<4|i>>>22,i=o}i>>>=22,t.words[n-10]=i,0===i&&t.length>10?t.length-=10:t.length-=9},S.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,r=0;r<t.length;r++){var n=0|t.words[r];e+=977*n,t.words[r]=67108863&e,e=64*n+(e/67108864|0)}return 0===t.words[t.length-1]&&(t.length--,0===t.words[t.length-1]&&t.length--),t},o(O,M),o(A,M),o(E,M),E.prototype.imulK=function(t){for(var e=0,r=0;r<t.length;r++){var n=19*(0|t.words[r])+e,i=67108863&n;n>>>=26,t.words[r]=i,e=n}return 0!==e&&(t.words[t.length++]=e),t},s._prime=function(t){if(_[t])return _[t];var e;if("k256"===t)e=new S;else if("p224"===t)e=new O;else if("p192"===t)e=new A;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new E}return _[t]=e,e},x.prototype._verify1=function(t){i(0===t.negative,"red works only with positives"),i(t.red,"red works only with red numbers")},x.prototype._verify2=function(t,e){i(0==(t.negative|e.negative),"red works only with positives"),i(t.red&&t.red===e.red,"red works only with red numbers")},x.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):(c(t,t.umod(this.m)._forceRed(this)),t)},x.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},x.prototype.add=function(t,e){this._verify2(t,e);var r=t.add(e);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},x.prototype.iadd=function(t,e){this._verify2(t,e);var r=t.iadd(e);return r.cmp(this.m)>=0&&r.isub(this.m),r},x.prototype.sub=function(t,e){this._verify2(t,e);var r=t.sub(e);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},x.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},x.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},x.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},x.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},x.prototype.isqr=function(t){return this.imul(t,t.clone())},x.prototype.sqr=function(t){return this.mul(t,t)},x.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(i(e%2==1),3===e){var r=this.m.add(new s(1)).iushrn(2);return this.pow(t,r)}for(var n=this.m.subn(1),o=0;!n.isZero()&&0===n.andln(1);)o++,n.iushrn(1);i(!n.isZero());var a=new s(1).toRed(this),u=a.redNeg(),h=this.m.subn(1).iushrn(1),f=this.m.bitLength();for(f=new s(2*f*f).toRed(this);0!==this.pow(f,h).cmp(u);)f.redIAdd(u);for(var c=this.pow(f,n),l=this.pow(t,n.addn(1).iushrn(1)),d=this.pow(t,n),p=o;0!==d.cmp(a);){for(var m=d,y=0;0!==m.cmp(a);y++)m=m.redSqr();i(y<p);var b=this.pow(c,new s(1).iushln(p-y-1));l=l.redMul(b),c=b.redSqr(),d=d.redMul(c),p=y}return l},x.prototype.invm=function(t){var e=t._invmp(this.m);return 0!==e.negative?(e.negative=0,this.imod(e).redNeg()):this.imod(e)},x.prototype.pow=function(t,e){if(e.isZero())return new s(1).toRed(this);if(0===e.cmpn(1))return t.clone();var r=new Array(16);r[0]=new s(1).toRed(this),r[1]=t;for(var n=2;n<r.length;n++)r[n]=this.mul(r[n-1],t);var i=r[0],o=0,a=0,u=e.bitLength()%26;for(0===u&&(u=26),n=e.length-1;n>=0;n--){for(var h=e.words[n],f=u-1;f>=0;f--){var c=h>>f&1;i!==r[0]&&(i=this.sqr(i)),0!==c||0!==o?(o<<=1,o|=c,(4===++a||0===n&&0===f)&&(i=this.mul(i,r[o]),a=0,o=0)):a=0}u=26}return i},x.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},x.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},s.mont=function(t){return new k(t)},o(k,x),k.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},k.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},k.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(e),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},k.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new s(0)._forceRed(this);var r=t.mul(e),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},k.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t,this)}).call(this,r(23)(t))},function(t,e,r){"use strict";var n=e;n.version=r(251).version,n.utils=r(13),n.rand=r(72),n.curve=r(137),n.curves=r(78),n.ec=r(263),n.eddsa=r(267)},function(t,e,r){"use strict";var n,i=e,o=r(79),s=r(137),a=r(13).assert;function u(t){"short"===t.type?this.curve=new s.short(t):"edwards"===t.type?this.curve=new s.edwards(t):this.curve=new s.mont(t),this.g=this.curve.g,this.n=this.curve.n,this.hash=t.hash,a(this.g.validate(),"Invalid curve"),a(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}function h(t,e){Object.defineProperty(i,t,{configurable:!0,enumerable:!0,get:function(){var r=new u(e);return Object.defineProperty(i,t,{configurable:!0,enumerable:!0,value:r}),r}})}i.PresetCurve=u,h("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:o.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),h("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:o.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),h("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:o.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),h("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:o.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),h("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:o.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),h("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:o.sha256,gRed:!1,g:["9"]}),h("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:o.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});try{n=r(262)}catch(t){n=void 0}h("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:o.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",n]})},function(t,e,r){var n=e;n.utils=r(17),n.common=r(42),n.sha=r(256),n.ripemd=r(260),n.hmac=r(261),n.sha1=n.sha.sha1,n.sha256=n.sha.sha256,n.sha224=n.sha.sha224,n.sha384=n.sha.sha384,n.sha512=n.sha.sha512,n.ripemd160=n.ripemd.ripemd160},function(t,e,r){"use strict";(function(e){function n(t){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var i,o=r(3),s=o.Buffer,a={};for(i in o)o.hasOwnProperty(i)&&"SlowBuffer"!==i&&"Buffer"!==i&&(a[i]=o[i]);var u=a.Buffer={};for(i in s)s.hasOwnProperty(i)&&"allocUnsafe"!==i&&"allocUnsafeSlow"!==i&&(u[i]=s[i]);if(a.Buffer.prototype=s.prototype,u.from&&u.from!==Uint8Array.from||(u.from=function(t,e,r){if("number"==typeof t)throw new TypeError('The "value" argument must not be of type number. Received type '+n(t));if(t&&void 0===t.length)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+n(t));return s(t,e,r)}),u.alloc||(u.alloc=function(t,e,r){if("number"!=typeof t)throw new TypeError('The "size" argument must be of type number. Received type '+n(t));if(t<0||t>=2*(1<<30))throw new RangeError('The value "'+t+'" is invalid for option "size"');var i=s(t);return e&&0!==e.length?"string"==typeof r?i.fill(e,r):i.fill(e):i.fill(0),i}),!a.kStringMaxLength)try{a.kStringMaxLength=e.binding("buffer").kStringMaxLength}catch(t){}a.constants||(a.constants={MAX_LENGTH:a.kMaxLength},a.kStringMaxLength&&(a.constants.MAX_STRING_LENGTH=a.kStringMaxLength)),t.exports=a}).call(this,r(5))},function(t,e,r){"use strict";function n(t){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var i=r(82).Reporter,o=r(43).EncoderBuffer,s=r(43).DecoderBuffer,a=r(12),u=["seq","seqof","set","setof","objid","bool","gentime","utctime","null_","enum","int","objDesc","bitstr","bmpstr","charstr","genstr","graphstr","ia5str","iso646str","numstr","octstr","printstr","t61str","unistr","utf8str","videostr"],h=["key","obj","use","optional","explicit","implicit","def","choice","any","contains"].concat(u);function f(t,e,r){var n={};this._baseState=n,n.name=r,n.enc=t,n.parent=e||null,n.children=null,n.tag=null,n.args=null,n.reverseArgs=null,n.choice=null,n.optional=!1,n.any=!1,n.obj=!1,n.use=null,n.useDecoder=null,n.key=null,n.default=null,n.explicit=null,n.implicit=null,n.contains=null,n.parent||(n.children=[],this._wrap())}t.exports=f;var c=["enc","parent","children","tag","args","reverseArgs","choice","optional","any","obj","use","alteredUse","key","default","explicit","implicit","contains"];f.prototype.clone=function(){var t=this._baseState,e={};c.forEach((function(r){e[r]=t[r]}));var r=new this.constructor(e.parent);return r._baseState=e,r},f.prototype._wrap=function(){var t=this._baseState;h.forEach((function(e){this[e]=function(){var r=new this.constructor(this);return t.children.push(r),r[e].apply(r,arguments)}}),this)},f.prototype._init=function(t){var e=this._baseState;a(null===e.parent),t.call(this),e.children=e.children.filter((function(t){return t._baseState.parent===this}),this),a.equal(e.children.length,1,"Root node can have only one child")},f.prototype._useArgs=function(t){var e=this._baseState,r=t.filter((function(t){return t instanceof this.constructor}),this);t=t.filter((function(t){return!(t instanceof this.constructor)}),this),0!==r.length&&(a(null===e.children),e.children=r,r.forEach((function(t){t._baseState.parent=this}),this)),0!==t.length&&(a(null===e.args),e.args=t,e.reverseArgs=t.map((function(t){if("object"!==n(t)||t.constructor!==Object)return t;var e={};return Object.keys(t).forEach((function(r){r==(0|r)&&(r|=0);var n=t[r];e[n]=r})),e})))},["_peekTag","_decodeTag","_use","_decodeStr","_decodeObjid","_decodeTime","_decodeNull","_decodeInt","_decodeBool","_decodeList","_encodeComposite","_encodeStr","_encodeObjid","_encodeTime","_encodeNull","_encodeInt","_encodeBool"].forEach((function(t){f.prototype[t]=function(){var e=this._baseState;throw new Error(t+" not implemented for encoding: "+e.enc)}})),u.forEach((function(t){f.prototype[t]=function(){var e=this._baseState,r=Array.prototype.slice.call(arguments);return a(null===e.tag),e.tag=t,this._useArgs(r),this}})),f.prototype.use=function(t){a(t);var e=this._baseState;return a(null===e.use),e.use=t,this},f.prototype.optional=function(){return this._baseState.optional=!0,this},f.prototype.def=function(t){var e=this._baseState;return a(null===e.default),e.default=t,e.optional=!0,this},f.prototype.explicit=function(t){var e=this._baseState;return a(null===e.explicit&&null===e.implicit),e.explicit=t,this},f.prototype.implicit=function(t){var e=this._baseState;return a(null===e.explicit&&null===e.implicit),e.implicit=t,this},f.prototype.obj=function(){var t=this._baseState,e=Array.prototype.slice.call(arguments);return t.obj=!0,0!==e.length&&this._useArgs(e),this},f.prototype.key=function(t){var e=this._baseState;return a(null===e.key),e.key=t,this},f.prototype.any=function(){return this._baseState.any=!0,this},f.prototype.choice=function(t){var e=this._baseState;return a(null===e.choice),e.choice=t,this._useArgs(Object.keys(t).map((function(e){return t[e]}))),this},f.prototype.contains=function(t){var e=this._baseState;return a(null===e.use),e.contains=t,this},f.prototype._decode=function(t,e){var r=this._baseState;if(null===r.parent)return t.wrapResult(r.children[0]._decode(t,e));var n,i=r.default,o=!0,a=null;if(null!==r.key&&(a=t.enterKey(r.key)),r.optional){var u=null;if(null!==r.explicit?u=r.explicit:null!==r.implicit?u=r.implicit:null!==r.tag&&(u=r.tag),null!==u||r.any){if(o=this._peekTag(t,u,r.any),t.isError(o))return o}else{var h=t.save();try{null===r.choice?this._decodeGeneric(r.tag,t,e):this._decodeChoice(t,e),o=!0}catch(t){o=!1}t.restore(h)}}if(r.obj&&o&&(n=t.enterObject()),o){if(null!==r.explicit){var f=this._decodeTag(t,r.explicit);if(t.isError(f))return f;t=f}var c=t.offset;if(null===r.use&&null===r.choice){var l;r.any&&(l=t.save());var d=this._decodeTag(t,null!==r.implicit?r.implicit:r.tag,r.any);if(t.isError(d))return d;r.any?i=t.raw(l):t=d}if(e&&e.track&&null!==r.tag&&e.track(t.path(),c,t.length,"tagged"),e&&e.track&&null!==r.tag&&e.track(t.path(),t.offset,t.length,"content"),r.any||(i=null===r.choice?this._decodeGeneric(r.tag,t,e):this._decodeChoice(t,e)),t.isError(i))return i;if(r.any||null!==r.choice||null===r.children||r.children.forEach((function(r){r._decode(t,e)})),r.contains&&("octstr"===r.tag||"bitstr"===r.tag)){var p=new s(i);i=this._getUse(r.contains,t._reporterState.obj)._decode(p,e)}}return r.obj&&o&&(i=t.leaveObject(n)),null===r.key||null===i&&!0!==o?null!==a&&t.exitKey(a):t.leaveKey(a,r.key,i),i},f.prototype._decodeGeneric=function(t,e,r){var n=this._baseState;return"seq"===t||"set"===t?null:"seqof"===t||"setof"===t?this._decodeList(e,t,n.args[0],r):/str$/.test(t)?this._decodeStr(e,t,r):"objid"===t&&n.args?this._decodeObjid(e,n.args[0],n.args[1],r):"objid"===t?this._decodeObjid(e,null,null,r):"gentime"===t||"utctime"===t?this._decodeTime(e,t,r):"null_"===t?this._decodeNull(e,r):"bool"===t?this._decodeBool(e,r):"objDesc"===t?this._decodeStr(e,t,r):"int"===t||"enum"===t?this._decodeInt(e,n.args&&n.args[0],r):null!==n.use?this._getUse(n.use,e._reporterState.obj)._decode(e,r):e.error("unknown tag: "+t)},f.prototype._getUse=function(t,e){var r=this._baseState;return r.useDecoder=this._use(t,e),a(null===r.useDecoder._baseState.parent),r.useDecoder=r.useDecoder._baseState.children[0],r.implicit!==r.useDecoder._baseState.implicit&&(r.useDecoder=r.useDecoder.clone(),r.useDecoder._baseState.implicit=r.implicit),r.useDecoder},f.prototype._decodeChoice=function(t,e){var r=this._baseState,n=null,i=!1;return Object.keys(r.choice).some((function(o){var s=t.save(),a=r.choice[o];try{var u=a._decode(t,e);if(t.isError(u))return!1;n={type:o,value:u},i=!0}catch(e){return t.restore(s),!1}return!0}),this),i?n:t.error("Choice not matched")},f.prototype._createEncoderBuffer=function(t){return new o(t,this.reporter)},f.prototype._encode=function(t,e,r){var n=this._baseState;if(null===n.default||n.default!==t){var i=this._encodeValue(t,e,r);if(void 0!==i&&!this._skipDefault(i,e,r))return i}},f.prototype._encodeValue=function(t,e,r){var o=this._baseState;if(null===o.parent)return o.children[0]._encode(t,e||new i);var s=null;if(this.reporter=e,o.optional&&void 0===t){if(null===o.default)return;t=o.default}var a=null,u=!1;if(o.any)s=this._createEncoderBuffer(t);else if(o.choice)s=this._encodeChoice(t,e);else if(o.contains)a=this._getUse(o.contains,r)._encode(t,e),u=!0;else if(o.children)a=o.children.map((function(r){if("null_"===r._baseState.tag)return r._encode(null,e,t);if(null===r._baseState.key)return e.error("Child should have a key");var i=e.enterKey(r._baseState.key);if("object"!==n(t))return e.error("Child expected, but input is not object");var o=r._encode(t[r._baseState.key],e,t);return e.leaveKey(i),o}),this).filter((function(t){return t})),a=this._createEncoderBuffer(a);else if("seqof"===o.tag||"setof"===o.tag){if(!o.args||1!==o.args.length)return e.error("Too many args for : "+o.tag);if(!Array.isArray(t))return e.error("seqof/setof, but data is not Array");var h=this.clone();h._baseState.implicit=null,a=this._createEncoderBuffer(t.map((function(r){var n=this._baseState;return this._getUse(n.args[0],t)._encode(r,e)}),h))}else null!==o.use?s=this._getUse(o.use,r)._encode(t,e):(a=this._encodePrimitive(o.tag,t),u=!0);if(!o.any&&null===o.choice){var f=null!==o.implicit?o.implicit:o.tag,c=null===o.implicit?"universal":"context";null===f?null===o.use&&e.error("Tag could be omitted only for .use()"):null===o.use&&(s=this._encodeComposite(f,u,c,a))}return null!==o.explicit&&(s=this._encodeComposite(o.explicit,!1,"context",s)),s},f.prototype._encodeChoice=function(t,e){var r=this._baseState,n=r.choice[t.type];return n||a(!1,t.type+" not found in "+JSON.stringify(Object.keys(r.choice))),n._encode(t.value,e)},f.prototype._encodePrimitive=function(t,e){var r=this._baseState;if(/str$/.test(t))return this._encodeStr(e,t);if("objid"===t&&r.args)return this._encodeObjid(e,r.reverseArgs[0],r.args[1]);if("objid"===t)return this._encodeObjid(e,null,null);if("gentime"===t||"utctime"===t)return this._encodeTime(e,t);if("null_"===t)return this._encodeNull();if("int"===t||"enum"===t)return this._encodeInt(e,r.args&&r.reverseArgs[0]);if("bool"===t)return this._encodeBool(e);if("objDesc"===t)return this._encodeStr(e,t);throw new Error("Unsupported tag: "+t)},f.prototype._isNumstr=function(t){return/^[0-9 ]*$/.test(t)},f.prototype._isPrintstr=function(t){return/^[A-Za-z0-9 '()+,-./:=?]*$/.test(t)}},function(t,e,r){"use strict";var n=r(0);function i(t){this._reporterState={obj:null,path:[],options:t||{},errors:[]}}function o(t,e){this.path=t,this.rethrow(e)}e.Reporter=i,i.prototype.isError=function(t){return t instanceof o},i.prototype.save=function(){var t=this._reporterState;return{obj:t.obj,pathLen:t.path.length}},i.prototype.restore=function(t){var e=this._reporterState;e.obj=t.obj,e.path=e.path.slice(0,t.pathLen)},i.prototype.enterKey=function(t){return this._reporterState.path.push(t)},i.prototype.exitKey=function(t){var e=this._reporterState;e.path=e.path.slice(0,t-1)},i.prototype.leaveKey=function(t,e,r){var n=this._reporterState;this.exitKey(t),null!==n.obj&&(n.obj[e]=r)},i.prototype.path=function(){return this._reporterState.path.join("/")},i.prototype.enterObject=function(){var t=this._reporterState,e=t.obj;return t.obj={},e},i.prototype.leaveObject=function(t){var e=this._reporterState,r=e.obj;return e.obj=t,r},i.prototype.error=function(t){var e,r=this._reporterState,n=t instanceof o;if(e=n?t:new o(r.path.map((function(t){return"["+JSON.stringify(t)+"]"})).join(""),t.message||t,t.stack),!r.options.partial)throw e;return n||r.errors.push(e),e},i.prototype.wrapResult=function(t){var e=this._reporterState;return e.options.partial?{result:this.isError(t)?null:t,errors:e.errors}:t},n(o,Error),o.prototype.rethrow=function(t){if(this.message=t+" at: "+(this.path||"(shallow)"),Error.captureStackTrace&&Error.captureStackTrace(this,o),!this.stack)try{throw new Error(this.message)}catch(t){this.stack=t.stack}return this}},function(t,e,r){"use strict";function n(t){var e={};return Object.keys(t).forEach((function(r){(0|r)==r&&(r|=0);var n=t[r];e[n]=r})),e}e.tagClass={0:"universal",1:"application",2:"context",3:"private"},e.tagClassByName=n(e.tagClass),e.tag={0:"end",1:"bool",2:"int",3:"bitstr",4:"octstr",5:"null_",6:"objid",7:"objDesc",8:"external",9:"real",10:"enum",11:"embed",12:"utf8str",13:"relativeOid",16:"seq",17:"set",18:"numstr",19:"printstr",20:"t61str",21:"videostr",22:"ia5str",23:"utctime",24:"gentime",25:"graphstr",26:"iso646str",27:"genstr",28:"unistr",29:"charstr",30:"bmpstr"},e.tagByName=n(e.tag)},function(t,e,r){(function(t){function e(t){return(e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}!function(t,n){"use strict";function i(t,e){if(!t)throw new Error(e||"Assertion failed")}function o(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}function s(t,e,r){if(s.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==e&&"be"!==e||(r=e,e=10),this._init(t||0,e||10,r||"be"))}var a;"object"===e(t)?t.exports=s:n.BN=s,s.BN=s,s.wordSize=26;try{a="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:r(286).Buffer}catch(t){}function u(t,e){var r=t.charCodeAt(e);return r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:r-48&15}function h(t,e,r){var n=u(t,r);return r-1>=e&&(n|=u(t,r-1)<<4),n}function f(t,e,r,n){for(var i=0,o=Math.min(t.length,r),s=e;s<o;s++){var a=t.charCodeAt(s)-48;i*=n,i+=a>=49?a-49+10:a>=17?a-17+10:a}return i}s.isBN=function(t){return t instanceof s||null!==t&&"object"===e(t)&&t.constructor.wordSize===s.wordSize&&Array.isArray(t.words)},s.max=function(t,e){return t.cmp(e)>0?t:e},s.min=function(t,e){return t.cmp(e)<0?t:e},s.prototype._init=function(t,r,n){if("number"==typeof t)return this._initNumber(t,r,n);if("object"===e(t))return this._initArray(t,r,n);"hex"===r&&(r=16),i(r===(0|r)&&r>=2&&r<=36);var o=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&(o++,this.negative=1),o<t.length&&(16===r?this._parseHex(t,o,n):(this._parseBase(t,r,o),"le"===n&&this._initArray(this.toArray(),r,n)))},s.prototype._initNumber=function(t,e,r){t<0&&(this.negative=1,t=-t),t<67108864?(this.words=[67108863&t],this.length=1):t<4503599627370496?(this.words=[67108863&t,t/67108864&67108863],this.length=2):(i(t<9007199254740992),this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===r&&this._initArray(this.toArray(),e,r)},s.prototype._initArray=function(t,e,r){if(i("number"==typeof t.length),t.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(t.length/3),this.words=new Array(this.length);for(var n=0;n<this.length;n++)this.words[n]=0;var o,s,a=0;if("be"===r)for(n=t.length-1,o=0;n>=0;n-=3)s=t[n]|t[n-1]<<8|t[n-2]<<16,this.words[o]|=s<<a&67108863,this.words[o+1]=s>>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);else if("le"===r)for(n=0,o=0;n<t.length;n+=3)s=t[n]|t[n+1]<<8|t[n+2]<<16,this.words[o]|=s<<a&67108863,this.words[o+1]=s>>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);return this.strip()},s.prototype._parseHex=function(t,e,r){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var n=0;n<this.length;n++)this.words[n]=0;var i,o=0,s=0;if("be"===r)for(n=t.length-1;n>=e;n-=2)i=h(t,e,n)<<o,this.words[s]|=67108863&i,o>=18?(o-=18,s+=1,this.words[s]|=i>>>26):o+=8;else for(n=(t.length-e)%2==0?e+1:e;n<t.length;n+=2)i=h(t,e,n)<<o,this.words[s]|=67108863&i,o>=18?(o-=18,s+=1,this.words[s]|=i>>>26):o+=8;this.strip()},s.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var n=0,i=1;i<=67108863;i*=e)n++;n--,i=i/e|0;for(var o=t.length-r,s=o%n,a=Math.min(o,o-s)+r,u=0,h=r;h<a;h+=n)u=f(t,h,h+n,e),this.imuln(i),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u);if(0!==s){var c=1;for(u=f(t,h,t.length,e),h=0;h<s;h++)c*=e;this.imuln(c),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u)}this.strip()},s.prototype.copy=function(t){t.words=new Array(this.length);for(var e=0;e<this.length;e++)t.words[e]=this.words[e];t.length=this.length,t.negative=this.negative,t.red=this.red},s.prototype.clone=function(){var t=new s(null);return this.copy(t),t},s.prototype._expand=function(t){for(;this.length<t;)this.words[this.length++]=0;return this},s.prototype.strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},s.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},s.prototype.inspect=function(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"};var c=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],l=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],d=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function p(t,e,r){r.negative=e.negative^t.negative;var n=t.length+e.length|0;r.length=n,n=n-1|0;var i=0|t.words[0],o=0|e.words[0],s=i*o,a=67108863&s,u=s/67108864|0;r.words[0]=a;for(var h=1;h<n;h++){for(var f=u>>>26,c=67108863&u,l=Math.min(h,e.length-1),d=Math.max(0,h-t.length+1);d<=l;d++){var p=h-d|0;f+=(s=(i=0|t.words[p])*(o=0|e.words[d])+c)/67108864|0,c=67108863&s}r.words[h]=0|c,u=0|f}return 0!==u?r.words[h]=0|u:r.length--,r.strip()}s.prototype.toString=function(t,e){var r;if(e=0|e||1,16===(t=t||10)||"hex"===t){r="";for(var n=0,o=0,s=0;s<this.length;s++){var a=this.words[s],u=(16777215&(a<<n|o)).toString(16);r=0!==(o=a>>>24-n&16777215)||s!==this.length-1?c[6-u.length]+u+r:u+r,(n+=2)>=26&&(n-=26,s--)}for(0!==o&&(r=o.toString(16)+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(t===(0|t)&&t>=2&&t<=36){var h=l[t],f=d[t];r="";var p=this.clone();for(p.negative=0;!p.isZero();){var m=p.modn(f).toString(t);r=(p=p.idivn(f)).isZero()?m+r:c[h-m.length]+m+r}for(this.isZero()&&(r="0"+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}i(!1,"Base should be between 2 and 36")},s.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&i(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},s.prototype.toJSON=function(){return this.toString(16)},s.prototype.toBuffer=function(t,e){return i(void 0!==a),this.toArrayLike(a,t,e)},s.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},s.prototype.toArrayLike=function(t,e,r){var n=this.byteLength(),o=r||Math.max(1,n);i(n<=o,"byte array longer than desired length"),i(o>0,"Requested array length <= 0"),this.strip();var s,a,u="le"===e,h=new t(o),f=this.clone();if(u){for(a=0;!f.isZero();a++)s=f.andln(255),f.iushrn(8),h[a]=s;for(;a<o;a++)h[a]=0}else{for(a=0;a<o-n;a++)h[a]=0;for(a=0;!f.isZero();a++)s=f.andln(255),f.iushrn(8),h[o-a-1]=s}return h},Math.clz32?s.prototype._countBits=function(t){return 32-Math.clz32(t)}:s.prototype._countBits=function(t){var e=t,r=0;return e>=4096&&(r+=13,e>>>=13),e>=64&&(r+=7,e>>>=7),e>=8&&(r+=4,e>>>=4),e>=2&&(r+=2,e>>>=2),r+e},s.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,r=0;return 0==(8191&e)&&(r+=13,e>>>=13),0==(127&e)&&(r+=7,e>>>=7),0==(15&e)&&(r+=4,e>>>=4),0==(3&e)&&(r+=2,e>>>=2),0==(1&e)&&r++,r},s.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},s.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;e<this.length;e++){var r=this._zeroBits(this.words[e]);if(t+=r,26!==r)break}return t},s.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},s.prototype.toTwos=function(t){return 0!==this.negative?this.abs().inotn(t).iaddn(1):this.clone()},s.prototype.fromTwos=function(t){return this.testn(t-1)?this.notn(t).iaddn(1).ineg():this.clone()},s.prototype.isNeg=function(){return 0!==this.negative},s.prototype.neg=function(){return this.clone().ineg()},s.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},s.prototype.iuor=function(t){for(;this.length<t.length;)this.words[this.length++]=0;for(var e=0;e<t.length;e++)this.words[e]=this.words[e]|t.words[e];return this.strip()},s.prototype.ior=function(t){return i(0==(this.negative|t.negative)),this.iuor(t)},s.prototype.or=function(t){return this.length>t.length?this.clone().ior(t):t.clone().ior(this)},s.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},s.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var r=0;r<e.length;r++)this.words[r]=this.words[r]&t.words[r];return this.length=e.length,this.strip()},s.prototype.iand=function(t){return i(0==(this.negative|t.negative)),this.iuand(t)},s.prototype.and=function(t){return this.length>t.length?this.clone().iand(t):t.clone().iand(this)},s.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},s.prototype.iuxor=function(t){var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var n=0;n<r.length;n++)this.words[n]=e.words[n]^r.words[n];if(this!==e)for(;n<e.length;n++)this.words[n]=e.words[n];return this.length=e.length,this.strip()},s.prototype.ixor=function(t){return i(0==(this.negative|t.negative)),this.iuxor(t)},s.prototype.xor=function(t){return this.length>t.length?this.clone().ixor(t):t.clone().ixor(this)},s.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},s.prototype.inotn=function(t){i("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),r=t%26;this._expand(e),r>0&&e--;for(var n=0;n<e;n++)this.words[n]=67108863&~this.words[n];return r>0&&(this.words[n]=~this.words[n]&67108863>>26-r),this.strip()},s.prototype.notn=function(t){return this.clone().inotn(t)},s.prototype.setn=function(t,e){i("number"==typeof t&&t>=0);var r=t/26|0,n=t%26;return this._expand(r+1),this.words[r]=e?this.words[r]|1<<n:this.words[r]&~(1<<n),this.strip()},s.prototype.iadd=function(t){var e,r,n;if(0!==this.negative&&0===t.negative)return this.negative=0,e=this.isub(t),this.negative^=1,this._normSign();if(0===this.negative&&0!==t.negative)return t.negative=0,e=this.isub(t),t.negative=1,e._normSign();this.length>t.length?(r=this,n=t):(r=t,n=this);for(var i=0,o=0;o<n.length;o++)e=(0|r.words[o])+(0|n.words[o])+i,this.words[o]=67108863&e,i=e>>>26;for(;0!==i&&o<r.length;o++)e=(0|r.words[o])+i,this.words[o]=67108863&e,i=e>>>26;if(this.length=r.length,0!==i)this.words[this.length]=i,this.length++;else if(r!==this)for(;o<r.length;o++)this.words[o]=r.words[o];return this},s.prototype.add=function(t){var e;return 0!==t.negative&&0===this.negative?(t.negative=0,e=this.sub(t),t.negative^=1,e):0===t.negative&&0!==this.negative?(this.negative=0,e=t.sub(this),this.negative=1,e):this.length>t.length?this.clone().iadd(t):t.clone().iadd(this)},s.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r,n,i=this.cmp(t);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(r=this,n=t):(r=t,n=this);for(var o=0,s=0;s<n.length;s++)o=(e=(0|r.words[s])-(0|n.words[s])+o)>>26,this.words[s]=67108863&e;for(;0!==o&&s<r.length;s++)o=(e=(0|r.words[s])+o)>>26,this.words[s]=67108863&e;if(0===o&&s<r.length&&r!==this)for(;s<r.length;s++)this.words[s]=r.words[s];return this.length=Math.max(this.length,s),r!==this&&(this.negative=1),this.strip()},s.prototype.sub=function(t){return this.clone().isub(t)};var m=function(t,e,r){var n,i,o,s=t.words,a=e.words,u=r.words,h=0,f=0|s[0],c=8191&f,l=f>>>13,d=0|s[1],p=8191&d,m=d>>>13,y=0|s[2],b=8191&y,v=y>>>13,g=0|s[3],w=8191&g,_=g>>>13,M=0|s[4],S=8191&M,O=M>>>13,A=0|s[5],E=8191&A,x=A>>>13,k=0|s[6],j=8191&k,$=k>>>13,R=0|s[7],P=8191&R,B=R>>>13,T=0|s[8],I=8191&T,N=T>>>13,D=0|s[9],C=8191&D,L=D>>>13,q=0|a[0],U=8191&q,F=q>>>13,z=0|a[1],V=8191&z,K=z>>>13,H=0|a[2],W=8191&H,Z=H>>>13,J=0|a[3],Y=8191&J,G=J>>>13,Q=0|a[4],X=8191&Q,tt=Q>>>13,et=0|a[5],rt=8191&et,nt=et>>>13,it=0|a[6],ot=8191&it,st=it>>>13,at=0|a[7],ut=8191&at,ht=at>>>13,ft=0|a[8],ct=8191&ft,lt=ft>>>13,dt=0|a[9],pt=8191&dt,mt=dt>>>13;r.negative=t.negative^e.negative,r.length=19;var yt=(h+(n=Math.imul(c,U))|0)+((8191&(i=(i=Math.imul(c,F))+Math.imul(l,U)|0))<<13)|0;h=((o=Math.imul(l,F))+(i>>>13)|0)+(yt>>>26)|0,yt&=67108863,n=Math.imul(p,U),i=(i=Math.imul(p,F))+Math.imul(m,U)|0,o=Math.imul(m,F);var bt=(h+(n=n+Math.imul(c,V)|0)|0)+((8191&(i=(i=i+Math.imul(c,K)|0)+Math.imul(l,V)|0))<<13)|0;h=((o=o+Math.imul(l,K)|0)+(i>>>13)|0)+(bt>>>26)|0,bt&=67108863,n=Math.imul(b,U),i=(i=Math.imul(b,F))+Math.imul(v,U)|0,o=Math.imul(v,F),n=n+Math.imul(p,V)|0,i=(i=i+Math.imul(p,K)|0)+Math.imul(m,V)|0,o=o+Math.imul(m,K)|0;var vt=(h+(n=n+Math.imul(c,W)|0)|0)+((8191&(i=(i=i+Math.imul(c,Z)|0)+Math.imul(l,W)|0))<<13)|0;h=((o=o+Math.imul(l,Z)|0)+(i>>>13)|0)+(vt>>>26)|0,vt&=67108863,n=Math.imul(w,U),i=(i=Math.imul(w,F))+Math.imul(_,U)|0,o=Math.imul(_,F),n=n+Math.imul(b,V)|0,i=(i=i+Math.imul(b,K)|0)+Math.imul(v,V)|0,o=o+Math.imul(v,K)|0,n=n+Math.imul(p,W)|0,i=(i=i+Math.imul(p,Z)|0)+Math.imul(m,W)|0,o=o+Math.imul(m,Z)|0;var gt=(h+(n=n+Math.imul(c,Y)|0)|0)+((8191&(i=(i=i+Math.imul(c,G)|0)+Math.imul(l,Y)|0))<<13)|0;h=((o=o+Math.imul(l,G)|0)+(i>>>13)|0)+(gt>>>26)|0,gt&=67108863,n=Math.imul(S,U),i=(i=Math.imul(S,F))+Math.imul(O,U)|0,o=Math.imul(O,F),n=n+Math.imul(w,V)|0,i=(i=i+Math.imul(w,K)|0)+Math.imul(_,V)|0,o=o+Math.imul(_,K)|0,n=n+Math.imul(b,W)|0,i=(i=i+Math.imul(b,Z)|0)+Math.imul(v,W)|0,o=o+Math.imul(v,Z)|0,n=n+Math.imul(p,Y)|0,i=(i=i+Math.imul(p,G)|0)+Math.imul(m,Y)|0,o=o+Math.imul(m,G)|0;var wt=(h+(n=n+Math.imul(c,X)|0)|0)+((8191&(i=(i=i+Math.imul(c,tt)|0)+Math.imul(l,X)|0))<<13)|0;h=((o=o+Math.imul(l,tt)|0)+(i>>>13)|0)+(wt>>>26)|0,wt&=67108863,n=Math.imul(E,U),i=(i=Math.imul(E,F))+Math.imul(x,U)|0,o=Math.imul(x,F),n=n+Math.imul(S,V)|0,i=(i=i+Math.imul(S,K)|0)+Math.imul(O,V)|0,o=o+Math.imul(O,K)|0,n=n+Math.imul(w,W)|0,i=(i=i+Math.imul(w,Z)|0)+Math.imul(_,W)|0,o=o+Math.imul(_,Z)|0,n=n+Math.imul(b,Y)|0,i=(i=i+Math.imul(b,G)|0)+Math.imul(v,Y)|0,o=o+Math.imul(v,G)|0,n=n+Math.imul(p,X)|0,i=(i=i+Math.imul(p,tt)|0)+Math.imul(m,X)|0,o=o+Math.imul(m,tt)|0;var _t=(h+(n=n+Math.imul(c,rt)|0)|0)+((8191&(i=(i=i+Math.imul(c,nt)|0)+Math.imul(l,rt)|0))<<13)|0;h=((o=o+Math.imul(l,nt)|0)+(i>>>13)|0)+(_t>>>26)|0,_t&=67108863,n=Math.imul(j,U),i=(i=Math.imul(j,F))+Math.imul($,U)|0,o=Math.imul($,F),n=n+Math.imul(E,V)|0,i=(i=i+Math.imul(E,K)|0)+Math.imul(x,V)|0,o=o+Math.imul(x,K)|0,n=n+Math.imul(S,W)|0,i=(i=i+Math.imul(S,Z)|0)+Math.imul(O,W)|0,o=o+Math.imul(O,Z)|0,n=n+Math.imul(w,Y)|0,i=(i=i+Math.imul(w,G)|0)+Math.imul(_,Y)|0,o=o+Math.imul(_,G)|0,n=n+Math.imul(b,X)|0,i=(i=i+Math.imul(b,tt)|0)+Math.imul(v,X)|0,o=o+Math.imul(v,tt)|0,n=n+Math.imul(p,rt)|0,i=(i=i+Math.imul(p,nt)|0)+Math.imul(m,rt)|0,o=o+Math.imul(m,nt)|0;var Mt=(h+(n=n+Math.imul(c,ot)|0)|0)+((8191&(i=(i=i+Math.imul(c,st)|0)+Math.imul(l,ot)|0))<<13)|0;h=((o=o+Math.imul(l,st)|0)+(i>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,n=Math.imul(P,U),i=(i=Math.imul(P,F))+Math.imul(B,U)|0,o=Math.imul(B,F),n=n+Math.imul(j,V)|0,i=(i=i+Math.imul(j,K)|0)+Math.imul($,V)|0,o=o+Math.imul($,K)|0,n=n+Math.imul(E,W)|0,i=(i=i+Math.imul(E,Z)|0)+Math.imul(x,W)|0,o=o+Math.imul(x,Z)|0,n=n+Math.imul(S,Y)|0,i=(i=i+Math.imul(S,G)|0)+Math.imul(O,Y)|0,o=o+Math.imul(O,G)|0,n=n+Math.imul(w,X)|0,i=(i=i+Math.imul(w,tt)|0)+Math.imul(_,X)|0,o=o+Math.imul(_,tt)|0,n=n+Math.imul(b,rt)|0,i=(i=i+Math.imul(b,nt)|0)+Math.imul(v,rt)|0,o=o+Math.imul(v,nt)|0,n=n+Math.imul(p,ot)|0,i=(i=i+Math.imul(p,st)|0)+Math.imul(m,ot)|0,o=o+Math.imul(m,st)|0;var St=(h+(n=n+Math.imul(c,ut)|0)|0)+((8191&(i=(i=i+Math.imul(c,ht)|0)+Math.imul(l,ut)|0))<<13)|0;h=((o=o+Math.imul(l,ht)|0)+(i>>>13)|0)+(St>>>26)|0,St&=67108863,n=Math.imul(I,U),i=(i=Math.imul(I,F))+Math.imul(N,U)|0,o=Math.imul(N,F),n=n+Math.imul(P,V)|0,i=(i=i+Math.imul(P,K)|0)+Math.imul(B,V)|0,o=o+Math.imul(B,K)|0,n=n+Math.imul(j,W)|0,i=(i=i+Math.imul(j,Z)|0)+Math.imul($,W)|0,o=o+Math.imul($,Z)|0,n=n+Math.imul(E,Y)|0,i=(i=i+Math.imul(E,G)|0)+Math.imul(x,Y)|0,o=o+Math.imul(x,G)|0,n=n+Math.imul(S,X)|0,i=(i=i+Math.imul(S,tt)|0)+Math.imul(O,X)|0,o=o+Math.imul(O,tt)|0,n=n+Math.imul(w,rt)|0,i=(i=i+Math.imul(w,nt)|0)+Math.imul(_,rt)|0,o=o+Math.imul(_,nt)|0,n=n+Math.imul(b,ot)|0,i=(i=i+Math.imul(b,st)|0)+Math.imul(v,ot)|0,o=o+Math.imul(v,st)|0,n=n+Math.imul(p,ut)|0,i=(i=i+Math.imul(p,ht)|0)+Math.imul(m,ut)|0,o=o+Math.imul(m,ht)|0;var Ot=(h+(n=n+Math.imul(c,ct)|0)|0)+((8191&(i=(i=i+Math.imul(c,lt)|0)+Math.imul(l,ct)|0))<<13)|0;h=((o=o+Math.imul(l,lt)|0)+(i>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,n=Math.imul(C,U),i=(i=Math.imul(C,F))+Math.imul(L,U)|0,o=Math.imul(L,F),n=n+Math.imul(I,V)|0,i=(i=i+Math.imul(I,K)|0)+Math.imul(N,V)|0,o=o+Math.imul(N,K)|0,n=n+Math.imul(P,W)|0,i=(i=i+Math.imul(P,Z)|0)+Math.imul(B,W)|0,o=o+Math.imul(B,Z)|0,n=n+Math.imul(j,Y)|0,i=(i=i+Math.imul(j,G)|0)+Math.imul($,Y)|0,o=o+Math.imul($,G)|0,n=n+Math.imul(E,X)|0,i=(i=i+Math.imul(E,tt)|0)+Math.imul(x,X)|0,o=o+Math.imul(x,tt)|0,n=n+Math.imul(S,rt)|0,i=(i=i+Math.imul(S,nt)|0)+Math.imul(O,rt)|0,o=o+Math.imul(O,nt)|0,n=n+Math.imul(w,ot)|0,i=(i=i+Math.imul(w,st)|0)+Math.imul(_,ot)|0,o=o+Math.imul(_,st)|0,n=n+Math.imul(b,ut)|0,i=(i=i+Math.imul(b,ht)|0)+Math.imul(v,ut)|0,o=o+Math.imul(v,ht)|0,n=n+Math.imul(p,ct)|0,i=(i=i+Math.imul(p,lt)|0)+Math.imul(m,ct)|0,o=o+Math.imul(m,lt)|0;var At=(h+(n=n+Math.imul(c,pt)|0)|0)+((8191&(i=(i=i+Math.imul(c,mt)|0)+Math.imul(l,pt)|0))<<13)|0;h=((o=o+Math.imul(l,mt)|0)+(i>>>13)|0)+(At>>>26)|0,At&=67108863,n=Math.imul(C,V),i=(i=Math.imul(C,K))+Math.imul(L,V)|0,o=Math.imul(L,K),n=n+Math.imul(I,W)|0,i=(i=i+Math.imul(I,Z)|0)+Math.imul(N,W)|0,o=o+Math.imul(N,Z)|0,n=n+Math.imul(P,Y)|0,i=(i=i+Math.imul(P,G)|0)+Math.imul(B,Y)|0,o=o+Math.imul(B,G)|0,n=n+Math.imul(j,X)|0,i=(i=i+Math.imul(j,tt)|0)+Math.imul($,X)|0,o=o+Math.imul($,tt)|0,n=n+Math.imul(E,rt)|0,i=(i=i+Math.imul(E,nt)|0)+Math.imul(x,rt)|0,o=o+Math.imul(x,nt)|0,n=n+Math.imul(S,ot)|0,i=(i=i+Math.imul(S,st)|0)+Math.imul(O,ot)|0,o=o+Math.imul(O,st)|0,n=n+Math.imul(w,ut)|0,i=(i=i+Math.imul(w,ht)|0)+Math.imul(_,ut)|0,o=o+Math.imul(_,ht)|0,n=n+Math.imul(b,ct)|0,i=(i=i+Math.imul(b,lt)|0)+Math.imul(v,ct)|0,o=o+Math.imul(v,lt)|0;var Et=(h+(n=n+Math.imul(p,pt)|0)|0)+((8191&(i=(i=i+Math.imul(p,mt)|0)+Math.imul(m,pt)|0))<<13)|0;h=((o=o+Math.imul(m,mt)|0)+(i>>>13)|0)+(Et>>>26)|0,Et&=67108863,n=Math.imul(C,W),i=(i=Math.imul(C,Z))+Math.imul(L,W)|0,o=Math.imul(L,Z),n=n+Math.imul(I,Y)|0,i=(i=i+Math.imul(I,G)|0)+Math.imul(N,Y)|0,o=o+Math.imul(N,G)|0,n=n+Math.imul(P,X)|0,i=(i=i+Math.imul(P,tt)|0)+Math.imul(B,X)|0,o=o+Math.imul(B,tt)|0,n=n+Math.imul(j,rt)|0,i=(i=i+Math.imul(j,nt)|0)+Math.imul($,rt)|0,o=o+Math.imul($,nt)|0,n=n+Math.imul(E,ot)|0,i=(i=i+Math.imul(E,st)|0)+Math.imul(x,ot)|0,o=o+Math.imul(x,st)|0,n=n+Math.imul(S,ut)|0,i=(i=i+Math.imul(S,ht)|0)+Math.imul(O,ut)|0,o=o+Math.imul(O,ht)|0,n=n+Math.imul(w,ct)|0,i=(i=i+Math.imul(w,lt)|0)+Math.imul(_,ct)|0,o=o+Math.imul(_,lt)|0;var xt=(h+(n=n+Math.imul(b,pt)|0)|0)+((8191&(i=(i=i+Math.imul(b,mt)|0)+Math.imul(v,pt)|0))<<13)|0;h=((o=o+Math.imul(v,mt)|0)+(i>>>13)|0)+(xt>>>26)|0,xt&=67108863,n=Math.imul(C,Y),i=(i=Math.imul(C,G))+Math.imul(L,Y)|0,o=Math.imul(L,G),n=n+Math.imul(I,X)|0,i=(i=i+Math.imul(I,tt)|0)+Math.imul(N,X)|0,o=o+Math.imul(N,tt)|0,n=n+Math.imul(P,rt)|0,i=(i=i+Math.imul(P,nt)|0)+Math.imul(B,rt)|0,o=o+Math.imul(B,nt)|0,n=n+Math.imul(j,ot)|0,i=(i=i+Math.imul(j,st)|0)+Math.imul($,ot)|0,o=o+Math.imul($,st)|0,n=n+Math.imul(E,ut)|0,i=(i=i+Math.imul(E,ht)|0)+Math.imul(x,ut)|0,o=o+Math.imul(x,ht)|0,n=n+Math.imul(S,ct)|0,i=(i=i+Math.imul(S,lt)|0)+Math.imul(O,ct)|0,o=o+Math.imul(O,lt)|0;var kt=(h+(n=n+Math.imul(w,pt)|0)|0)+((8191&(i=(i=i+Math.imul(w,mt)|0)+Math.imul(_,pt)|0))<<13)|0;h=((o=o+Math.imul(_,mt)|0)+(i>>>13)|0)+(kt>>>26)|0,kt&=67108863,n=Math.imul(C,X),i=(i=Math.imul(C,tt))+Math.imul(L,X)|0,o=Math.imul(L,tt),n=n+Math.imul(I,rt)|0,i=(i=i+Math.imul(I,nt)|0)+Math.imul(N,rt)|0,o=o+Math.imul(N,nt)|0,n=n+Math.imul(P,ot)|0,i=(i=i+Math.imul(P,st)|0)+Math.imul(B,ot)|0,o=o+Math.imul(B,st)|0,n=n+Math.imul(j,ut)|0,i=(i=i+Math.imul(j,ht)|0)+Math.imul($,ut)|0,o=o+Math.imul($,ht)|0,n=n+Math.imul(E,ct)|0,i=(i=i+Math.imul(E,lt)|0)+Math.imul(x,ct)|0,o=o+Math.imul(x,lt)|0;var jt=(h+(n=n+Math.imul(S,pt)|0)|0)+((8191&(i=(i=i+Math.imul(S,mt)|0)+Math.imul(O,pt)|0))<<13)|0;h=((o=o+Math.imul(O,mt)|0)+(i>>>13)|0)+(jt>>>26)|0,jt&=67108863,n=Math.imul(C,rt),i=(i=Math.imul(C,nt))+Math.imul(L,rt)|0,o=Math.imul(L,nt),n=n+Math.imul(I,ot)|0,i=(i=i+Math.imul(I,st)|0)+Math.imul(N,ot)|0,o=o+Math.imul(N,st)|0,n=n+Math.imul(P,ut)|0,i=(i=i+Math.imul(P,ht)|0)+Math.imul(B,ut)|0,o=o+Math.imul(B,ht)|0,n=n+Math.imul(j,ct)|0,i=(i=i+Math.imul(j,lt)|0)+Math.imul($,ct)|0,o=o+Math.imul($,lt)|0;var $t=(h+(n=n+Math.imul(E,pt)|0)|0)+((8191&(i=(i=i+Math.imul(E,mt)|0)+Math.imul(x,pt)|0))<<13)|0;h=((o=o+Math.imul(x,mt)|0)+(i>>>13)|0)+($t>>>26)|0,$t&=67108863,n=Math.imul(C,ot),i=(i=Math.imul(C,st))+Math.imul(L,ot)|0,o=Math.imul(L,st),n=n+Math.imul(I,ut)|0,i=(i=i+Math.imul(I,ht)|0)+Math.imul(N,ut)|0,o=o+Math.imul(N,ht)|0,n=n+Math.imul(P,ct)|0,i=(i=i+Math.imul(P,lt)|0)+Math.imul(B,ct)|0,o=o+Math.imul(B,lt)|0;var Rt=(h+(n=n+Math.imul(j,pt)|0)|0)+((8191&(i=(i=i+Math.imul(j,mt)|0)+Math.imul($,pt)|0))<<13)|0;h=((o=o+Math.imul($,mt)|0)+(i>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,n=Math.imul(C,ut),i=(i=Math.imul(C,ht))+Math.imul(L,ut)|0,o=Math.imul(L,ht),n=n+Math.imul(I,ct)|0,i=(i=i+Math.imul(I,lt)|0)+Math.imul(N,ct)|0,o=o+Math.imul(N,lt)|0;var Pt=(h+(n=n+Math.imul(P,pt)|0)|0)+((8191&(i=(i=i+Math.imul(P,mt)|0)+Math.imul(B,pt)|0))<<13)|0;h=((o=o+Math.imul(B,mt)|0)+(i>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,n=Math.imul(C,ct),i=(i=Math.imul(C,lt))+Math.imul(L,ct)|0,o=Math.imul(L,lt);var Bt=(h+(n=n+Math.imul(I,pt)|0)|0)+((8191&(i=(i=i+Math.imul(I,mt)|0)+Math.imul(N,pt)|0))<<13)|0;h=((o=o+Math.imul(N,mt)|0)+(i>>>13)|0)+(Bt>>>26)|0,Bt&=67108863;var Tt=(h+(n=Math.imul(C,pt))|0)+((8191&(i=(i=Math.imul(C,mt))+Math.imul(L,pt)|0))<<13)|0;return h=((o=Math.imul(L,mt))+(i>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,u[0]=yt,u[1]=bt,u[2]=vt,u[3]=gt,u[4]=wt,u[5]=_t,u[6]=Mt,u[7]=St,u[8]=Ot,u[9]=At,u[10]=Et,u[11]=xt,u[12]=kt,u[13]=jt,u[14]=$t,u[15]=Rt,u[16]=Pt,u[17]=Bt,u[18]=Tt,0!==h&&(u[19]=h,r.length++),r};function y(t,e,r){return(new b).mulp(t,e,r)}function b(t,e){this.x=t,this.y=e}Math.imul||(m=p),s.prototype.mulTo=function(t,e){var r=this.length+t.length;return 10===this.length&&10===t.length?m(this,t,e):r<63?p(this,t,e):r<1024?function(t,e,r){r.negative=e.negative^t.negative,r.length=t.length+e.length;for(var n=0,i=0,o=0;o<r.length-1;o++){var s=i;i=0;for(var a=67108863&n,u=Math.min(o,e.length-1),h=Math.max(0,o-t.length+1);h<=u;h++){var f=o-h,c=(0|t.words[f])*(0|e.words[h]),l=67108863&c;a=67108863&(l=l+a|0),i+=(s=(s=s+(c/67108864|0)|0)+(l>>>26)|0)>>>26,s&=67108863}r.words[o]=a,n=s,s=i}return 0!==n?r.words[o]=n:r.length--,r.strip()}(this,t,e):y(this,t,e)},b.prototype.makeRBT=function(t){for(var e=new Array(t),r=s.prototype._countBits(t)-1,n=0;n<t;n++)e[n]=this.revBin(n,r,t);return e},b.prototype.revBin=function(t,e,r){if(0===t||t===r-1)return t;for(var n=0,i=0;i<e;i++)n|=(1&t)<<e-i-1,t>>=1;return n},b.prototype.permute=function(t,e,r,n,i,o){for(var s=0;s<o;s++)n[s]=e[t[s]],i[s]=r[t[s]]},b.prototype.transform=function(t,e,r,n,i,o){this.permute(o,t,e,r,n,i);for(var s=1;s<i;s<<=1)for(var a=s<<1,u=Math.cos(2*Math.PI/a),h=Math.sin(2*Math.PI/a),f=0;f<i;f+=a)for(var c=u,l=h,d=0;d<s;d++){var p=r[f+d],m=n[f+d],y=r[f+d+s],b=n[f+d+s],v=c*y-l*b;b=c*b+l*y,y=v,r[f+d]=p+y,n[f+d]=m+b,r[f+d+s]=p-y,n[f+d+s]=m-b,d!==a&&(v=u*c-h*l,l=u*l+h*c,c=v)}},b.prototype.guessLen13b=function(t,e){var r=1|Math.max(e,t),n=1&r,i=0;for(r=r/2|0;r;r>>>=1)i++;return 1<<i+1+n},b.prototype.conjugate=function(t,e,r){if(!(r<=1))for(var n=0;n<r/2;n++){var i=t[n];t[n]=t[r-n-1],t[r-n-1]=i,i=e[n],e[n]=-e[r-n-1],e[r-n-1]=-i}},b.prototype.normalize13b=function(t,e){for(var r=0,n=0;n<e/2;n++){var i=8192*Math.round(t[2*n+1]/e)+Math.round(t[2*n]/e)+r;t[n]=67108863&i,r=i<67108864?0:i/67108864|0}return t},b.prototype.convert13b=function(t,e,r,n){for(var o=0,s=0;s<e;s++)o+=0|t[s],r[2*s]=8191&o,o>>>=13,r[2*s+1]=8191&o,o>>>=13;for(s=2*e;s<n;++s)r[s]=0;i(0===o),i(0==(-8192&o))},b.prototype.stub=function(t){for(var e=new Array(t),r=0;r<t;r++)e[r]=0;return e},b.prototype.mulp=function(t,e,r){var n=2*this.guessLen13b(t.length,e.length),i=this.makeRBT(n),o=this.stub(n),s=new Array(n),a=new Array(n),u=new Array(n),h=new Array(n),f=new Array(n),c=new Array(n),l=r.words;l.length=n,this.convert13b(t.words,t.length,s,n),this.convert13b(e.words,e.length,h,n),this.transform(s,o,a,u,n,i),this.transform(h,o,f,c,n,i);for(var d=0;d<n;d++){var p=a[d]*f[d]-u[d]*c[d];u[d]=a[d]*c[d]+u[d]*f[d],a[d]=p}return this.conjugate(a,u,n),this.transform(a,u,l,o,n,i),this.conjugate(l,o,n),this.normalize13b(l,n),r.negative=t.negative^e.negative,r.length=t.length+e.length,r.strip()},s.prototype.mul=function(t){var e=new s(null);return e.words=new Array(this.length+t.length),this.mulTo(t,e)},s.prototype.mulf=function(t){var e=new s(null);return e.words=new Array(this.length+t.length),y(this,t,e)},s.prototype.imul=function(t){return this.clone().mulTo(t,this)},s.prototype.imuln=function(t){i("number"==typeof t),i(t<67108864);for(var e=0,r=0;r<this.length;r++){var n=(0|this.words[r])*t,o=(67108863&n)+(67108863&e);e>>=26,e+=n/67108864|0,e+=o>>>26,this.words[r]=67108863&o}return 0!==e&&(this.words[r]=e,this.length++),this},s.prototype.muln=function(t){return this.clone().imuln(t)},s.prototype.sqr=function(){return this.mul(this)},s.prototype.isqr=function(){return this.imul(this.clone())},s.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),r=0;r<e.length;r++){var n=r/26|0,i=r%26;e[r]=(t.words[n]&1<<i)>>>i}return e}(t);if(0===e.length)return new s(1);for(var r=this,n=0;n<e.length&&0===e[n];n++,r=r.sqr());if(++n<e.length)for(var i=r.sqr();n<e.length;n++,i=i.sqr())0!==e[n]&&(r=r.mul(i));return r},s.prototype.iushln=function(t){i("number"==typeof t&&t>=0);var e,r=t%26,n=(t-r)/26,o=67108863>>>26-r<<26-r;if(0!==r){var s=0;for(e=0;e<this.length;e++){var a=this.words[e]&o,u=(0|this.words[e])-a<<r;this.words[e]=u|s,s=a>>>26-r}s&&(this.words[e]=s,this.length++)}if(0!==n){for(e=this.length-1;e>=0;e--)this.words[e+n]=this.words[e];for(e=0;e<n;e++)this.words[e]=0;this.length+=n}return this.strip()},s.prototype.ishln=function(t){return i(0===this.negative),this.iushln(t)},s.prototype.iushrn=function(t,e,r){var n;i("number"==typeof t&&t>=0),n=e?(e-e%26)/26:0;var o=t%26,s=Math.min((t-o)/26,this.length),a=67108863^67108863>>>o<<o,u=r;if(n-=s,n=Math.max(0,n),u){for(var h=0;h<s;h++)u.words[h]=this.words[h];u.length=s}if(0===s);else if(this.length>s)for(this.length-=s,h=0;h<this.length;h++)this.words[h]=this.words[h+s];else this.words[0]=0,this.length=1;var f=0;for(h=this.length-1;h>=0&&(0!==f||h>=n);h--){var c=0|this.words[h];this.words[h]=f<<26-o|c>>>o,f=c&a}return u&&0!==f&&(u.words[u.length++]=f),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},s.prototype.ishrn=function(t,e,r){return i(0===this.negative),this.iushrn(t,e,r)},s.prototype.shln=function(t){return this.clone().ishln(t)},s.prototype.ushln=function(t){return this.clone().iushln(t)},s.prototype.shrn=function(t){return this.clone().ishrn(t)},s.prototype.ushrn=function(t){return this.clone().iushrn(t)},s.prototype.testn=function(t){i("number"==typeof t&&t>=0);var e=t%26,r=(t-e)/26,n=1<<e;return!(this.length<=r)&&!!(this.words[r]&n)},s.prototype.imaskn=function(t){i("number"==typeof t&&t>=0);var e=t%26,r=(t-e)/26;if(i(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==e&&r++,this.length=Math.min(r,this.length),0!==e){var n=67108863^67108863>>>e<<e;this.words[this.length-1]&=n}return this.strip()},s.prototype.maskn=function(t){return this.clone().imaskn(t)},s.prototype.iaddn=function(t){return i("number"==typeof t),i(t<67108864),t<0?this.isubn(-t):0!==this.negative?1===this.length&&(0|this.words[0])<t?(this.words[0]=t-(0|this.words[0]),this.negative=0,this):(this.negative=0,this.isubn(t),this.negative=1,this):this._iaddn(t)},s.prototype._iaddn=function(t){this.words[0]+=t;for(var e=0;e<this.length&&this.words[e]>=67108864;e++)this.words[e]-=67108864,e===this.length-1?this.words[e+1]=1:this.words[e+1]++;return this.length=Math.max(this.length,e+1),this},s.prototype.isubn=function(t){if(i("number"==typeof t),i(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var e=0;e<this.length&&this.words[e]<0;e++)this.words[e]+=67108864,this.words[e+1]-=1;return this.strip()},s.prototype.addn=function(t){return this.clone().iaddn(t)},s.prototype.subn=function(t){return this.clone().isubn(t)},s.prototype.iabs=function(){return this.negative=0,this},s.prototype.abs=function(){return this.clone().iabs()},s.prototype._ishlnsubmul=function(t,e,r){var n,o,s=t.length+r;this._expand(s);var a=0;for(n=0;n<t.length;n++){o=(0|this.words[n+r])+a;var u=(0|t.words[n])*e;a=((o-=67108863&u)>>26)-(u/67108864|0),this.words[n+r]=67108863&o}for(;n<this.length-r;n++)a=(o=(0|this.words[n+r])+a)>>26,this.words[n+r]=67108863&o;if(0===a)return this.strip();for(i(-1===a),a=0,n=0;n<this.length;n++)a=(o=-(0|this.words[n])+a)>>26,this.words[n]=67108863&o;return this.negative=1,this.strip()},s.prototype._wordDiv=function(t,e){var r=(this.length,t.length),n=this.clone(),i=t,o=0|i.words[i.length-1];0!==(r=26-this._countBits(o))&&(i=i.ushln(r),n.iushln(r),o=0|i.words[i.length-1]);var a,u=n.length-i.length;if("mod"!==e){(a=new s(null)).length=u+1,a.words=new Array(a.length);for(var h=0;h<a.length;h++)a.words[h]=0}var f=n.clone()._ishlnsubmul(i,1,u);0===f.negative&&(n=f,a&&(a.words[u]=1));for(var c=u-1;c>=0;c--){var l=67108864*(0|n.words[i.length+c])+(0|n.words[i.length+c-1]);for(l=Math.min(l/o|0,67108863),n._ishlnsubmul(i,l,c);0!==n.negative;)l--,n.negative=0,n._ishlnsubmul(i,1,c),n.isZero()||(n.negative^=1);a&&(a.words[c]=l)}return a&&a.strip(),n.strip(),"div"!==e&&0!==r&&n.iushrn(r),{div:a||null,mod:n}},s.prototype.divmod=function(t,e,r){return i(!t.isZero()),this.isZero()?{div:new s(0),mod:new s(0)}:0!==this.negative&&0===t.negative?(a=this.neg().divmod(t,e),"mod"!==e&&(n=a.div.neg()),"div"!==e&&(o=a.mod.neg(),r&&0!==o.negative&&o.iadd(t)),{div:n,mod:o}):0===this.negative&&0!==t.negative?(a=this.divmod(t.neg(),e),"mod"!==e&&(n=a.div.neg()),{div:n,mod:a.mod}):0!=(this.negative&t.negative)?(a=this.neg().divmod(t.neg(),e),"div"!==e&&(o=a.mod.neg(),r&&0!==o.negative&&o.isub(t)),{div:a.div,mod:o}):t.length>this.length||this.cmp(t)<0?{div:new s(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new s(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new s(this.modn(t.words[0]))}:this._wordDiv(t,e);var n,o,a},s.prototype.div=function(t){return this.divmod(t,"div",!1).div},s.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},s.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},s.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var r=0!==e.div.negative?e.mod.isub(t):e.mod,n=t.ushrn(1),i=t.andln(1),o=r.cmp(n);return o<0||1===i&&0===o?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},s.prototype.modn=function(t){i(t<=67108863);for(var e=(1<<26)%t,r=0,n=this.length-1;n>=0;n--)r=(e*r+(0|this.words[n]))%t;return r},s.prototype.idivn=function(t){i(t<=67108863);for(var e=0,r=this.length-1;r>=0;r--){var n=(0|this.words[r])+67108864*e;this.words[r]=n/t|0,e=n%t}return this.strip()},s.prototype.divn=function(t){return this.clone().idivn(t)},s.prototype.egcd=function(t){i(0===t.negative),i(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var n=new s(1),o=new s(0),a=new s(0),u=new s(1),h=0;e.isEven()&&r.isEven();)e.iushrn(1),r.iushrn(1),++h;for(var f=r.clone(),c=e.clone();!e.isZero();){for(var l=0,d=1;0==(e.words[0]&d)&&l<26;++l,d<<=1);if(l>0)for(e.iushrn(l);l-- >0;)(n.isOdd()||o.isOdd())&&(n.iadd(f),o.isub(c)),n.iushrn(1),o.iushrn(1);for(var p=0,m=1;0==(r.words[0]&m)&&p<26;++p,m<<=1);if(p>0)for(r.iushrn(p);p-- >0;)(a.isOdd()||u.isOdd())&&(a.iadd(f),u.isub(c)),a.iushrn(1),u.iushrn(1);e.cmp(r)>=0?(e.isub(r),n.isub(a),o.isub(u)):(r.isub(e),a.isub(n),u.isub(o))}return{a:a,b:u,gcd:r.iushln(h)}},s.prototype._invmp=function(t){i(0===t.negative),i(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var n,o=new s(1),a=new s(0),u=r.clone();e.cmpn(1)>0&&r.cmpn(1)>0;){for(var h=0,f=1;0==(e.words[0]&f)&&h<26;++h,f<<=1);if(h>0)for(e.iushrn(h);h-- >0;)o.isOdd()&&o.iadd(u),o.iushrn(1);for(var c=0,l=1;0==(r.words[0]&l)&&c<26;++c,l<<=1);if(c>0)for(r.iushrn(c);c-- >0;)a.isOdd()&&a.iadd(u),a.iushrn(1);e.cmp(r)>=0?(e.isub(r),o.isub(a)):(r.isub(e),a.isub(o))}return(n=0===e.cmpn(1)?o:a).cmpn(0)<0&&n.iadd(t),n},s.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),r=t.clone();e.negative=0,r.negative=0;for(var n=0;e.isEven()&&r.isEven();n++)e.iushrn(1),r.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;r.isEven();)r.iushrn(1);var i=e.cmp(r);if(i<0){var o=e;e=r,r=o}else if(0===i||0===r.cmpn(1))break;e.isub(r)}return r.iushln(n)},s.prototype.invm=function(t){return this.egcd(t).a.umod(t)},s.prototype.isEven=function(){return 0==(1&this.words[0])},s.prototype.isOdd=function(){return 1==(1&this.words[0])},s.prototype.andln=function(t){return this.words[0]&t},s.prototype.bincn=function(t){i("number"==typeof t);var e=t%26,r=(t-e)/26,n=1<<e;if(this.length<=r)return this._expand(r+1),this.words[r]|=n,this;for(var o=n,s=r;0!==o&&s<this.length;s++){var a=0|this.words[s];o=(a+=o)>>>26,a&=67108863,this.words[s]=a}return 0!==o&&(this.words[s]=o,this.length++),this},s.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},s.prototype.cmpn=function(t){var e,r=t<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this.strip(),this.length>1)e=1;else{r&&(t=-t),i(t<=67108863,"Number is too big");var n=0|this.words[0];e=n===t?0:n<t?-1:1}return 0!==this.negative?0|-e:e},s.prototype.cmp=function(t){if(0!==this.negative&&0===t.negative)return-1;if(0===this.negative&&0!==t.negative)return 1;var e=this.ucmp(t);return 0!==this.negative?0|-e:e},s.prototype.ucmp=function(t){if(this.length>t.length)return 1;if(this.length<t.length)return-1;for(var e=0,r=this.length-1;r>=0;r--){var n=0|this.words[r],i=0|t.words[r];if(n!==i){n<i?e=-1:n>i&&(e=1);break}}return e},s.prototype.gtn=function(t){return 1===this.cmpn(t)},s.prototype.gt=function(t){return 1===this.cmp(t)},s.prototype.gten=function(t){return this.cmpn(t)>=0},s.prototype.gte=function(t){return this.cmp(t)>=0},s.prototype.ltn=function(t){return-1===this.cmpn(t)},s.prototype.lt=function(t){return-1===this.cmp(t)},s.prototype.lten=function(t){return this.cmpn(t)<=0},s.prototype.lte=function(t){return this.cmp(t)<=0},s.prototype.eqn=function(t){return 0===this.cmpn(t)},s.prototype.eq=function(t){return 0===this.cmp(t)},s.red=function(t){return new O(t)},s.prototype.toRed=function(t){return i(!this.red,"Already a number in reduction context"),i(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},s.prototype.fromRed=function(){return i(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},s.prototype._forceRed=function(t){return this.red=t,this},s.prototype.forceRed=function(t){return i(!this.red,"Already a number in reduction context"),this._forceRed(t)},s.prototype.redAdd=function(t){return i(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},s.prototype.redIAdd=function(t){return i(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},s.prototype.redSub=function(t){return i(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},s.prototype.redISub=function(t){return i(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},s.prototype.redShl=function(t){return i(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},s.prototype.redMul=function(t){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},s.prototype.redIMul=function(t){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},s.prototype.redSqr=function(){return i(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},s.prototype.redISqr=function(){return i(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},s.prototype.redSqrt=function(){return i(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},s.prototype.redInvm=function(){return i(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},s.prototype.redNeg=function(){return i(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},s.prototype.redPow=function(t){return i(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var v={k256:null,p224:null,p192:null,p25519:null};function g(t,e){this.name=t,this.p=new s(e,16),this.n=this.p.bitLength(),this.k=new s(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function w(){g.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function _(){g.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function M(){g.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function S(){g.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function O(t){if("string"==typeof t){var e=s._prime(t);this.m=e.p,this.prime=e}else i(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function A(t){O.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new s(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}g.prototype._tmp=function(){var t=new s(null);return t.words=new Array(Math.ceil(this.n/13)),t},g.prototype.ireduce=function(t){var e,r=t;do{this.split(r,this.tmp),e=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(e>this.n);var n=e<this.n?-1:r.ucmp(this.p);return 0===n?(r.words[0]=0,r.length=1):n>0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},g.prototype.split=function(t,e){t.iushrn(this.n,0,e)},g.prototype.imulK=function(t){return t.imul(this.k)},o(w,g),w.prototype.split=function(t,e){for(var r=Math.min(t.length,9),n=0;n<r;n++)e.words[n]=t.words[n];if(e.length=r,t.length<=9)return t.words[0]=0,void(t.length=1);var i=t.words[9];for(e.words[e.length++]=4194303&i,n=10;n<t.length;n++){var o=0|t.words[n];t.words[n-10]=(4194303&o)<<4|i>>>22,i=o}i>>>=22,t.words[n-10]=i,0===i&&t.length>10?t.length-=10:t.length-=9},w.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,r=0;r<t.length;r++){var n=0|t.words[r];e+=977*n,t.words[r]=67108863&e,e=64*n+(e/67108864|0)}return 0===t.words[t.length-1]&&(t.length--,0===t.words[t.length-1]&&t.length--),t},o(_,g),o(M,g),o(S,g),S.prototype.imulK=function(t){for(var e=0,r=0;r<t.length;r++){var n=19*(0|t.words[r])+e,i=67108863&n;n>>>=26,t.words[r]=i,e=n}return 0!==e&&(t.words[t.length++]=e),t},s._prime=function(t){if(v[t])return v[t];var e;if("k256"===t)e=new w;else if("p224"===t)e=new _;else if("p192"===t)e=new M;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new S}return v[t]=e,e},O.prototype._verify1=function(t){i(0===t.negative,"red works only with positives"),i(t.red,"red works only with red numbers")},O.prototype._verify2=function(t,e){i(0==(t.negative|e.negative),"red works only with positives"),i(t.red&&t.red===e.red,"red works only with red numbers")},O.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},O.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},O.prototype.add=function(t,e){this._verify2(t,e);var r=t.add(e);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},O.prototype.iadd=function(t,e){this._verify2(t,e);var r=t.iadd(e);return r.cmp(this.m)>=0&&r.isub(this.m),r},O.prototype.sub=function(t,e){this._verify2(t,e);var r=t.sub(e);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},O.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},O.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},O.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},O.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},O.prototype.isqr=function(t){return this.imul(t,t.clone())},O.prototype.sqr=function(t){return this.mul(t,t)},O.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(i(e%2==1),3===e){var r=this.m.add(new s(1)).iushrn(2);return this.pow(t,r)}for(var n=this.m.subn(1),o=0;!n.isZero()&&0===n.andln(1);)o++,n.iushrn(1);i(!n.isZero());var a=new s(1).toRed(this),u=a.redNeg(),h=this.m.subn(1).iushrn(1),f=this.m.bitLength();for(f=new s(2*f*f).toRed(this);0!==this.pow(f,h).cmp(u);)f.redIAdd(u);for(var c=this.pow(f,n),l=this.pow(t,n.addn(1).iushrn(1)),d=this.pow(t,n),p=o;0!==d.cmp(a);){for(var m=d,y=0;0!==m.cmp(a);y++)m=m.redSqr();i(y<p);var b=this.pow(c,new s(1).iushln(p-y-1));l=l.redMul(b),c=b.redSqr(),d=d.redMul(c),p=y}return l},O.prototype.invm=function(t){var e=t._invmp(this.m);return 0!==e.negative?(e.negative=0,this.imod(e).redNeg()):this.imod(e)},O.prototype.pow=function(t,e){if(e.isZero())return new s(1).toRed(this);if(0===e.cmpn(1))return t.clone();var r=new Array(16);r[0]=new s(1).toRed(this),r[1]=t;for(var n=2;n<r.length;n++)r[n]=this.mul(r[n-1],t);var i=r[0],o=0,a=0,u=e.bitLength()%26;for(0===u&&(u=26),n=e.length-1;n>=0;n--){for(var h=e.words[n],f=u-1;f>=0;f--){var c=h>>f&1;i!==r[0]&&(i=this.sqr(i)),0!==c||0!==o?(o<<=1,o|=c,(4===++a||0===n&&0===f)&&(i=this.mul(i,r[o]),a=0,o=0)):a=0}u=26}return i},O.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},O.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},s.mont=function(t){return new A(t)},o(A,O),A.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},A.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},A.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(e),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},A.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new s(0)._forceRed(this);var r=t.mul(e),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},A.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t,this)}).call(this,r(23)(t))},function(t,e,r){"use strict";t.exports=r(295)},function(t,e,r){"use strict";t.exports=new Set(["__proto__","constructor","prototype"])},function(t,e,r){"use strict";var n=r(88);
590
594
  /*!
@@ -737,7 +741,7 @@ function _(t,e){var r,i,s,a=null==t?null:f(t[y],"caster.options.ref",null);0===t
737
741
  /*!
738
742
  * ignore
739
743
  */
740
- function(t,e){if(!e)return!1;var r,i=n(t);try{for(i.s();!(r=i.n()).done;){var s=r.value;if(null==s)return!1;var a=s.constructor;if(!(s instanceof o)||a.modelName!==e&&a.baseModelName!==e)return!1}}catch(t){i.e(t)}finally{i.f()}return!0}(e,a)&&t[p].$populated(t[m],[],(r={},i=b,s=e[0].constructor,i in r?Object.defineProperty(r,i,{value:s,enumerable:!0,configurable:!0,writable:!0}):r[i]=s,r))}for(var M=function(){var t=O[S];if(null==Array.prototype[t])return"continue";w[t]=function(){var e=this.isMongooseArrayProxy?this.__array:this,r=[].concat(e);return r[t].apply(r,arguments)}},S=0,O=["filter","flat","flatMap","map","slice"];S<O.length;S++)M();t.exports=w}).call(this,r(3).Buffer)},function(t,e,r){"use strict";var n=r(14),i=r(45),o=r(38).internalToObjectOptions,s=r(54),a=r(9),u=r(4);function h(t,e,r,i,o){if(null!=r){var s={isNew:r.isNew,defaults:!("defaults"in r.$__)||r.$__.defaults};o=Object.assign({},s,o)}null!=o&&null!=o.path&&(this.$basePath=o.path),n.call(this,t,e,i,o),delete this.$__.priorDoc}t.exports=h,h.prototype=Object.create(n.prototype),Object.defineProperty(h.prototype,"$isSingleNested",{configurable:!1,writable:!1,value:!0}),
744
+ function(t,e){if(!e)return!1;var r,i=n(t);try{for(i.s();!(r=i.n()).done;){var s=r.value;if(null==s)return!1;var a=s.constructor;if(!(s instanceof o)||a.modelName!==e&&a.baseModelName!==e)return!1}}catch(t){i.e(t)}finally{i.f()}return!0}(e,a)&&t[p].$populated(t[m],[],(r={},i=b,s=e[0].constructor,i in r?Object.defineProperty(r,i,{value:s,enumerable:!0,configurable:!0,writable:!0}):r[i]=s,r))}for(var M=function(){var t=O[S];if(null==Array.prototype[t])return"continue";w[t]=function(){var e=this.isMongooseArrayProxy?this.__array:this,r=[].concat(e);return r[t].apply(r,arguments)}},S=0,O=["filter","flat","flatMap","map","slice"];S<O.length;S++)M();t.exports=w}).call(this,r(3).Buffer)},function(t,e,r){"use strict";var n=r(14),i=r(45),o=r(38).internalToObjectOptions,s=r(54),a=r(9),u=r(4);function h(t,e,r,i,o){if(null!=r){var s={isNew:r.isNew,defaults:!("defaults"in r.$__)||r.$__.defaults};o=Object.assign({},s,o)}null!=o&&null!=o.path&&(this.$basePath=o.path),n.call(this,t,e,i,o),this.$__.isSubDocument=!0,delete this.$__.priorDoc}t.exports=h,h.prototype=Object.create(n.prototype),Object.defineProperty(h.prototype,"$isSingleNested",{configurable:!1,writable:!1,value:!0}),
741
745
  /*!
742
746
  * ignore
743
747
  */
@@ -1041,7 +1045,7 @@ t.exports=n},function(t,e,r){"use strict";
1041
1045
  t.exports.setBrowser=function(t){o=t}},function(t,e,r){"use strict";
1042
1046
  /*!
1043
1047
  * Dependencies
1044
- */var n=r(294).ctor("require","modify","init","default","ignore");function i(){this.activePaths=new n,this.ownerDocument=void 0,this.fullPath=void 0}t.exports=i,i.prototype.strictMode=void 0,i.prototype.selected=void 0,i.prototype.shardval=void 0,i.prototype.saveError=void 0,i.prototype.validationError=void 0,i.prototype.adhocPaths=void 0,i.prototype.removing=void 0,i.prototype.inserting=void 0,i.prototype.saving=void 0,i.prototype.version=void 0,i.prototype._id=void 0,i.prototype.populate=void 0,i.prototype.populated=void 0,i.prototype.wasPopulated=!1,i.prototype.scope=void 0,i.prototype.session=null,i.prototype.pathsToScopes=null,i.prototype.cachedRequired=null},function(t,e,r){"use strict";
1048
+ */var n=r(294).ctor("require","modify","init","default","ignore");function i(){this.activePaths=new n,this.ownerDocument=void 0,this.isSubDocument=void 0,this.fullPath=void 0}t.exports=i,i.prototype.strictMode=void 0,i.prototype.selected=void 0,i.prototype.shardval=void 0,i.prototype.saveError=void 0,i.prototype.validationError=void 0,i.prototype.adhocPaths=void 0,i.prototype.removing=void 0,i.prototype.inserting=void 0,i.prototype.saving=void 0,i.prototype.version=void 0,i.prototype._id=void 0,i.prototype.populate=void 0,i.prototype.populated=void 0,i.prototype.wasPopulated=!1,i.prototype.scope=void 0,i.prototype.session=null,i.prototype.pathsToScopes=null,i.prototype.cachedRequired=null},function(t,e,r){"use strict";
1045
1049
  /*!
1046
1050
  * Module dependencies.
1047
1051
  */var n=r(4),i=t.exports=function(){};
@@ -1255,7 +1259,7 @@ function(t,r){for(var n=t._indexes,i=n.length,o=0;o<i;++o){for(var s=n[o][0],a=n
1255
1259
  /*!
1256
1260
  * Returns this documents _id cast to a string.
1257
1261
  */
1258
- function n(){return null!=this._id?String(this._id):null}t.exports=function(t){return!t.paths.id&&t.paths._id&&t.options.id?(t.virtual("id").get(n),t):t}},function(t,e,r){"use strict";function n(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var i=r(323),o=r(325),s=r(6),a=r(166),u=r(57);t.exports=function(t,e){var r=t.childSchemas.find((function(t){return!!t.schema.options.timestamps}));if(e||r){var h,f=a(e,"createdAt"),c=a(e,"updatedAt"),l=null!=e&&e.hasOwnProperty("currentTime")?e.currentTime:null,d={};if(t.$timestamps={createdAt:f,updatedAt:c},c&&!t.paths[c]&&(d[c]=Date),f&&!t.paths[f])d[f]=(n(h={},t.options.typeKey||"type",Date),n(h,"immutable",!0),h);t.add(d),t.pre("save",(function(t){var e=s(this,"$__.saveOptions.timestamps");if(!1===e)return t();var r=null!=e&&!1===e.updatedAt,n=null!=e&&!1===e.createdAt,i=null!=l?l():(this.ownerDocument?this.ownerDocument():this).constructor.base.now(),o=this._id&&this._id.auto;if(!n&&f&&!this.$__getValue(f)&&this.$__isSelected(f)&&this.$set(f,o?this._id.getTimestamp():i),!r&&c&&(this.isNew||this.$isModified())){var a=i;this.isNew&&(null!=f?a=this.$__getValue(f):o&&(a=this._id.getTimestamp())),this.$set(c,a)}t()})),t.methods.initializeTimestamps=function(){var t=null!=l?l():this.constructor.base.now();return f&&!this.get(f)&&this.$set(f,t),c&&!this.get(c)&&this.$set(c,t),this},m[u.builtInMiddleware]=!0;var p={query:!0,model:!1};t.pre("findOneAndReplace",p,m),t.pre("findOneAndUpdate",p,m),t.pre("replaceOne",p,m),t.pre("update",p,m),t.pre("updateOne",p,m),t.pre("updateMany",p,m)}function m(t){var e=null!=l?l():this.model.base.now();"findOneAndReplace"===this.op&&null==this.getUpdate()&&this.setUpdate({}),o(e,f,c,this.getUpdate(),this.options,this.schema),i(e,this.getUpdate(),this.model.schema),t()}}},function(t,e,r){"use strict";function n(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=function(t,e){if(!t)return;if("string"==typeof t)return i(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return i(t,e)}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var s,a=!0,u=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){u=!0,s=t},f:function(){try{a||null==r.return||r.return()}finally{if(u)throw s}}}}function i(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}var o=r(324),s=r(166);
1262
+ function n(){return null!=this._id?String(this._id):null}t.exports=function(t){return!t.paths.id&&t.paths._id&&t.options.id?(t.virtual("id").get(n),t):t}},function(t,e,r){"use strict";function n(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var i=r(323),o=r(325),s=r(6),a=r(166),u=r(57);t.exports=function(t,e){var r=t.childSchemas.find((function(t){return!!t.schema.options.timestamps}));if(e||r){var h,f=a(e,"createdAt"),c=a(e,"updatedAt"),l=null!=e&&e.hasOwnProperty("currentTime")?e.currentTime:null,d={};if(t.$timestamps={createdAt:f,updatedAt:c},c&&!t.paths[c]&&(d[c]=Date),f&&!t.paths[f])d[f]=(n(h={},t.options.typeKey||"type",Date),n(h,"immutable",!0),h);t.add(d),t.pre("save",(function(t){var e=s(this,"$__.saveOptions.timestamps");if(!1===e)return t();var r=null!=e&&!1===e.updatedAt,n=null!=e&&!1===e.createdAt,i=null!=l?l():this.ownerDocument().constructor.base.now(),o=this._id&&this._id.auto;if(!n&&f&&!this.$__getValue(f)&&this.$__isSelected(f)&&this.$set(f,o?this._id.getTimestamp():i),!r&&c&&(this.isNew||this.$isModified())){var a=i;this.isNew&&(null!=f?a=this.$__getValue(f):o&&(a=this._id.getTimestamp())),this.$set(c,a)}t()})),t.methods.initializeTimestamps=function(){var t=null!=l?l():this.constructor.base.now();return f&&!this.get(f)&&this.$set(f,t),c&&!this.get(c)&&this.$set(c,t),this},m[u.builtInMiddleware]=!0;var p={query:!0,model:!1};t.pre("findOneAndReplace",p,m),t.pre("findOneAndUpdate",p,m),t.pre("replaceOne",p,m),t.pre("update",p,m),t.pre("updateOne",p,m),t.pre("updateMany",p,m)}function m(t){var e=null!=l?l():this.model.base.now();"findOneAndReplace"===this.op&&null==this.getUpdate()&&this.setUpdate({}),o(e,f,c,this.getUpdate(),this.options,this.schema),i(e,this.getUpdate(),this.model.schema),t()}}},function(t,e,r){"use strict";function n(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=function(t,e){if(!t)return;if("string"==typeof t)return i(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return i(t,e)}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var s,a=!0,u=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){u=!0,s=t},f:function(){try{a||null==r.return||r.return()}finally{if(u)throw s}}}}function i(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}var o=r(324),s=r(166);
1259
1263
  /*!
1260
1264
  * ignore
1261
1265
  */