MOOver.js/node_modules/mongoose/dist/browser.umd.js

1674 lines
1 MiB
JavaScript
Raw Normal View History

2022-02-18 12:54:33 +00:00
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.mongoose=e():t.mongoose=e()}("undefined"!=typeof self?self:this,(function(){return function(t){var e={};function r(n){if(e[n])return e[n].exports;var i=e[n]={i:n,l:!1,exports:{}};return t[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}return r.m=t,r.c=e,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)r.d(n,i,function(e){return t[e]}.bind(null,i));return n},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=175)}([function(t,e){"function"==typeof Object.create?t.exports=function(t,e){e&&(t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}))}:t.exports=function(t,e){if(e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}}},function(t,e,r){"use strict";e.arrayAtomicsBackupSymbol=Symbol("mongoose#Array#atomicsBackup"),e.arrayAtomicsSymbol=Symbol("mongoose#Array#_atomics"),e.arrayParentSymbol=Symbol("mongoose#Array#_parent"),e.arrayPathSymbol=Symbol("mongoose#Array#_path"),e.arraySchemaSymbol=Symbol("mongoose#Array#_schema"),e.documentArrayParent=Symbol("mongoose:documentArrayParent"),e.documentIsSelected=Symbol("mongoose#Document#isSelected"),e.documentIsModified=Symbol("mongoose#Document#isModified"),e.documentModifiedPaths=Symbol("mongoose#Document#modifiedPaths"),e.documentSchemaSymbol=Symbol("mongoose#Document#schema"),e.getSymbol=Symbol("mongoose#Document#get"),e.modelSymbol=Symbol("mongoose#Model"),e.objectIdSymbol=Symbol("mongoose#ObjectId"),e.populateModelSymbol=Symbol("mongoose.PopulateOptions#Model"),e.schemaTypeSymbol=Symbol("mongoose#schemaType"),e.sessionNewDocuments=Symbol("mongoose:ClientSession#newDocuments"),e.scopeSymbol=Symbol("mongoose#Document#scope"),e.validatorErrorSymbol=Symbol("mongoose:validatorError")},function(t,e,r){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),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";(function(t){
/*!
* The buffer module from node.js, for the browser.
*
* @author Feross Aboukhadijeh <http://feross.org>
* @license MIT
*/
var n=r(177),i=r(178),o=r(93);function s(){return u.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function a(t,e){if(s()<e)throw new RangeError("Invalid typed array length");return u.TYPED_ARRAY_SUPPORT?(t=new Uint8Array(e)).__proto__=u.prototype:(null===t&&(t=new u(e)),t.length=e),t}function u(t,e,r){if(!(u.TYPED_ARRAY_SUPPORT||this instanceof u))return new u(t,e,r);if("number"==typeof t){if("string"==typeof e)throw new Error("If encoding is specified then the first argument must be a string");return c(this,t)}return h(this,t,e,r)}function h(t,e,r,n){if("number"==typeof e)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&e instanceof ArrayBuffer?function(t,e,r,n){if(e.byteLength,r<0||e.byteLength<r)throw new RangeError("'offset' is out of bounds");if(e.byteLength<r+(n||0))throw new RangeError("'length' is out of bounds");e=void 0===r&&void 0===n?new Uint8Array(e):void 0===n?new Uint8Array(e,r):new Uint8Array(e,r,n);u.TYPED_ARRAY_SUPPORT?(t=e).__proto__=u.prototype:t=l(t,e);return t}(t,e,r,n):"string"==typeof e?function(t,e,r){"string"==typeof r&&""!==r||(r="utf8");if(!u.isEncoding(r))throw new TypeError('"encoding" must be a valid string encoding');var n=0|p(e,r),i=(t=a(t,n)).write(e,r);i!==n&&(t=t.slice(0,i));return t}(t,e,r):function(t,e){if(u.isBuffer(e)){var r=0|d(e.length);return 0===(t=a(t,r)).length||e.copy(t,0,0,r),t}if(e){if("undefined"!=typeof ArrayBuffer&&e.buffer instanceof ArrayBuffer||"length"in e)return"number"!=typeof e.length||(n=e.length)!=n?a(t,0):l(t,e);if("Buffer"===e.type&&o(e.data))return l(t,e.data)}var n;throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(t,e)}function f(t){if("number"!=typeof t)throw new TypeError('"size" argument must be a number');if(t<0)throw new RangeError('"size" argument must not be negative')}function c(t,e){if(f(e),t=a(t,e<0?0:0|d(e)),!u.TYPED_ARRAY_SUPPORT)for(var r=0;r<e;++r)t[r]=0;return t}function l(t,e){var r=e.length<0?0:0|d(e.length);t=a(t,r);for(var n=0;n<r;n+=1)t[n]=255&e[n];return t}function d(t){if(t>=s())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s().toString(16)+" bytes");return 0|t}function p(t,e){if(u.isBuffer(t))return t.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;"string"!=typeof t&&(t=""+t);var r=t.length;if(0===r)return 0;for(var n=!1;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return q(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return U(t).length;default:if(n)return q(t).length;e=(""+e).toLowerCase(),n=!0}}function y(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 j(this,e,r);case"utf8":case"utf-8":return E(this,e,r);case"ascii":return x(this,e,r);case"latin1":case"binary":return k(this,e,r);case"base64":return A(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return $(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}function m(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function b(t,e,r,n,i){if(0===t.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,isNaN(r)&&(r=i?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(i)return-1;r=t.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof e&&(e=u.from(e,n)),u.isBuffer(e))return 0===e.length?-1:v(t,e,r,n,i);if("number"==typeof e)return e&=255,u.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):v(t,[e],r,n,i);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())||"u
/*!
* Module dependencies.
*/
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=r(143),h=r(81),f=r(32),c=r(18),l=r(279),d=r(41),p=r(42),y=r(33),m=r(144),b=r(280),v=r(146),g=r(145),w=r(52),_=r(53),M=r(150),S=r(82),O=r(147).trustedSymbol;function A(t){if(Array.isArray(t.populate)){var r=[];t.populate.forEach((function(t){if(/[\s]/.test(t.path)){var n=Object.assign({},t);n.path.split(" ").forEach((function(t){n.path=t,r.push(e.populate(n)[0])}))}else r.push(e.populate(t)[0])})),t.populate=e.populate(r)}else null!=t.populate&&"object"===s(t.populate)&&(t.populate=e.populate(t.populate));var n=[],o=t.path.split(" ");null!=t.options&&(t.options=e.clone(t.options));var a,u=i(o);try{for(u.s();!(a=u.n()).done;){var h=a.value;n.push(new l(Object.assign({},t,{path:h})))}}catch(t){u.e(t)}finally{u.f()}return n}
/*!
* Return the value of `obj` at the given `path`.
*
* @param {String} path
* @param {Object} obj
*/e.specialProperties=S,e.isMongooseArray=m.isMongooseArray,e.isMongooseDocumentArray=b.isMongooseDocumentArray,e.registerMongooseArray=m.registerMongooseArray,e.registerMongooseDocumentArray=b.registerMongooseDocumentArray,
/*!
* Produces a collection name from model `name`. By default, just returns
* the model name
*
* @param {String} name a model name
* @param {Function} pluralize function that pluralizes the collection name
* @return {String} a collection name
* @api private
*/
e.toCollectionName=function(t,e){return"system.profile"===t||"system.indexes"===t?t:"function"==typeof e?e(t):t},
/*!
* Determines if `a` and `b` are deep equal.
*
* Modified from node/lib/assert.js
*
* @param {any} a a value to compare to `b`
* @param {any} b a value to compare to `a`
* @return {Boolean}
* @api private
*/
e.deepEqual=function r(n,i){if(n===i)return!0;if("object"!==s(n)&&"object"!==s(i))return n===i;if(n instanceof Date&&i instanceof Date)return n.getTime()===i.getTime();if(v(n,"ObjectID")&&v(i,"ObjectID")||v(n,"Decimal128")&&v(i,"Decimal128"))return n.toString()===i.toString();if(n instanceof RegExp&&i instanceof RegExp)return n.source===i.source&&n.ignoreCase===i.ignoreCase&&n.multiline===i.multiline&&n.global===i.global&&n.dotAll===i.dotAll&&n.unicode===i.unicode&&n.sticky===i.sticky&&n.hasIndices===i.hasIndices;if(null==n||null==i)return!1;if(n.prototype!==i.prototype)return!1;if(n instanceof Map&&i instanceof Map)return r(Array.from(n.keys()),Array.from(i.keys()))&&r(Array.from(n.values()),Array.from(i.values()));if(n instanceof Number&&i instanceof Number)return n.valueOf()===i.valueOf();if(t.isBuffer(n))return e.buffer.areEqual(n,i);if(Array.isArray(n)&&Array.isArray(i)){var o=n.length;if(o!==i.length)return!1;for(var a=0;a<o;++a)if(!r(n[a],i[a]))return!1;return!0}null!=n.$__?n=n._doc:w(n)&&(n=n.toObject()),null!=i.$__?i=i._doc:w(i)&&(i=i.toObject());var u=Object.keys(n),h=Object.keys(i),f=u.length;if(f!==h.length)return!1;for(var c=f-1;c>=0;c--)if(u[c]!==h[c])return!1;for(var l=0,d=u;l<d.length;l++){var p=d[l];if(!r(n[p],i[p]))return!1}return!0},
/*!
* Get the last element of an array
*/
e.last=function(t){if(t.length>0)return t[t.length-1]},e.clone=d,
/*!
* ignore
*/
e.promiseOrCallback=_,
/*!
* ignore
*/
e.cloneArrays=function(t){return Array.isArray(t)?t.map((function(t){return e.cloneArrays(t)})):t},
/*!
* ignore
*/
e.omit=function(t,e){if(null==e)return Object.assign({},t);Array.isArray(e)||(e=[e]);var r,n=Object.assign({},t),o=i(e);try{for(o.s();!(r=o.n()).done;){delete n[r.value]}}catch(t){o.e(t)}finally{o.f()}return n},
/*!
* Shallow copies defaults into options.
*
* @param {Object} defaults
* @param {Object} options
* @return {Object} the merged object
* @api private
*/
e.options=function(t,e){var r,n=Object.keys(t),i=n.length;for(e=e||{};i--;)(r=n[i])in e||(e[r]=t[r]);return e},
/*!
* Merges `from` into `to` without overwriting existing properties.
*
* @param {Object} to
* @param {Object} from
* @api private
*/
e.merge=function t(r,n,i,o){i=i||{};var s,a=Object.keys(n),u=0,h=a.length;n[O]&&(r[O]=n[O]),o=o||"";for(var f=i.omitNested||{};u<h;)if(s=a[u++],!(i.omit&&i.omit[s]||f[o]||S.has(s)))if(null==r[s])r[s]=n[s];else if(e.isObject(n[s])){if(e.isObject(r[s])||(r[s]={}),null!=n[s]){if(i.isDiscriminatorSchemaMerge&&n[s].$isSingleNested&&r[s].$isMongooseDocumentArray||n[s].$isMongooseDocumentArray&&r[s].$isSingleNested)continue;if(n[s].instanceOfSchema){r[s].instanceOfSchema?M(r[s],n[s].clone(),i.isDiscriminatorSchemaMerge):r[s]=n[s].clone();continue}if(n[s]instanceof c){r[s]=new c(n[s]);continue}}t(r[s],n[s],i,o?o+"."+s:s)}else i.overwrite&&(r[s]=n[s])},
/*!
* Applies toObject recursively.
*
* @param {Document|Array|Object} obj
* @return {Object}
* @api private
*/
e.toObject=function t(n){var o;if(a||(a=r(14)),null==n)return n;if(n instanceof a)return n.toObject();if(Array.isArray(n)){o=[];var s,u=i(n);try{for(u.s();!(s=u.n()).done;){var h=s.value;o.push(t(h))}}catch(t){u.e(t)}finally{u.f()}return o}if(e.isPOJO(n)){o={},n[O]&&(o[O]=n[O]);for(var f=0,c=Object.keys(n);f<c.length;f++){var l=c[f];S.has(l)||(o[l]=t(n[l]))}return o}return n},e.isObject=y,
/*!
* Determines if `arg` is a plain old JavaScript object (POJO). Specifically,
* `arg` must be an object but not an instance of any special class, like String,
* ObjectId, etc.
*
* `Object.getPrototypeOf()` is part of ES5: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/getPrototypeOf
*
* @param {Object|Array|String|Function|RegExp|any} arg
* @api private
* @return {Boolean}
*/
e.isPOJO=function(t){if(null==t||"object"!==s(t))return!1;var e=Object.getPrototypeOf(t);return!e||"Object"===e.constructor.name},
/*!
* Determines if `arg` is an object that isn't an instance of a built-in value
* class, like Array, Buffer, ObjectId, etc.
*/
e.isNonBuiltinObject=function(t){return"object"===s(t)&&!e.isNativeObject(t)&&!e.isMongooseType(t)&&null!=t},
/*!
* Determines if `obj` is a built-in object like an array, date, boolean,
* etc.
*/
e.isNativeObject=function(t){return Array.isArray(t)||t instanceof Date||t instanceof Boolean||t instanceof Number||t instanceof String},
/*!
* Determines if `val` is an object that has no own keys
*/
e.isEmptyObject=function(t){return null!=t&&"object"===s(t)&&0===Object.keys(t).length},
/*!
* Search if `obj` or any POJOs nested underneath `obj` has a property named
* `key`
*/
e.hasKey=function(t,r){for(var n=0,i=Object.keys(t);n<i.length;n++){var o=i[n];if(o===r)return!0;if(e.isPOJO(t[o])&&e.hasKey(t[o],r))return!0}return!1},
/*!
* process.nextTick helper.
*
* Wraps `callback` in a try/catch + nextTick.
*
* node-mongodb-native has a habit of state corruption when an error is immediately thrown from within a collection callback.
*
* @param {Function} callback
* @api private
*/
e.tick=function(t){if("function"==typeof t)return function(){try{t.apply(this,arguments)}catch(t){p((function(){throw t}))}}},
/*!
* Returns true if `v` is an object that can be serialized as a primitive in
* MongoDB
*/
e.isMongooseType=function(e){return e instanceof c||e instanceof f||e instanceof t},e.isMongooseObject=w,
/*!
* Converts `expires` options of index objects to `expiresAfterSeconds` options for MongoDB.
*
* @param {Object} object
* @api private
*/
e.expires=function(t){t&&"Object"===t.constructor.name&&"expires"in t&&(t.expireAfterSeconds="string"!=typeof t.expires?t.expires:Math.round(u(t.expires)/1e3),delete t.expires)},
/*!
* populate helper
*/
e.populate=function(t,r,n,i,o,a,u,h){var f=null;if(1===arguments.length){if(t instanceof l)return[t];if(Array.isArray(t)){var c=d(t);return c.map((function(t){return e.populate(t)[0]}))}f=e.isObject(t)?Object.assign({},t):{path:t}}else f="object"===s(n)?{path:t,select:r,match:n,options:i}:{path:t,select:r,model:n,match:i,options:o,populate:a,justOne:u,count:h};if("string"!=typeof f.path)throw new TypeError("utils.populate: invalid path. Expected string. Got typeof `"+s(t)+"`");return A(f);function d(t){var e=[];return t.forEach((function(t){/[\s]/.test(t.path)?t.path.split(" ").forEach((function(r){var n=Object.assign({},t);n.path=r,e.push(n)})):e.push(t)})),e}},e.getValue=function(t,e,r){return h.get(t,e,"_doc",r)},
/*!
* Sets the value of `obj` at the given `path`.
*
* @param {String} path
* @param {Anything} val
* @param {Object} obj
*/
e.setValue=function(t,e,r,n,i){h.set(t,e,r,"_doc",n,i)},
/*!
* Returns an array of values from object `o`.
*
* @param {Object} o
* @return {Array}
* @private
*/
e.object={},e.object.vals=function(t){for(var e=Object.keys(t),r=e.length,n=[];r--;)n.push(t[e[r]]);return n},
/*!
* @see exports.options
*/
e.object.shallowCopy=e.options;
/*!
* Safer helper for hasOwnProperty checks
*
* @param {Object} obj
* @param {String} prop
*/
var E=Object.prototype.hasOwnProperty;e.object.hasOwnProperty=function(t,e){return E.call(t,e)},
/*!
* Determine if `val` is null or undefined
*
* @return {Boolean}
*/
e.isNullOrUndefined=function(t){return null==t},
/*!
* ignore
*/
e.array={},
/*!
* Flattens an array.
*
* [ 1, [ 2, 3, [4] ]] -> [1,2,3,4]
*
* @param {Array} arr
* @param {Function} [filter] If passed, will be invoked with each item in the array. If `filter` returns a falsy value, the item will not be included in the results.
* @return {Array}
* @private
*/
e.array.flatten=function t(e,r,n){return n||(n=[]),e.forEach((function(e){Array.isArray(e)?t(e,r,n):r&&!r(e)||n.push(e)})),n};
/*!
* ignore
*/
var x=Object.prototype.hasOwnProperty;e.hasUserDefinedProperty=function(t,r){if(null==t)return!1;if(Array.isArray(r)){var n,o=i(r);try{for(o.s();!(n=o.n()).done;){var a=n.value;if(e.hasUserDefinedProperty(t,a))return!0}}catch(t){o.e(t)}finally{o.f()}return!1}if(x.call(t,r))return!0;if("object"===s(t)&&r in t){var u=t[r];return u!==Object.prototype[r]&&u!==Array.prototype[r]}return!1};
/*!
* ignore
*/
var k=Math.pow(2,32)-1;e.isArrayIndex=function(t){return"number"==typeof t?t>=0&&t<=k:"string"==typeof t&&(!!/^\d+$/.test(t)&&((t=+t)>=0&&t<=k))},
/*!
* Removes duplicate values from an array
*
* [1, 2, 3, 3, 5] => [1, 2, 3, 5]
* [ ObjectId("550988ba0c19d57f697dc45e"), ObjectId("550988ba0c19d57f697dc45e") ]
* => [ObjectId("550988ba0c19d57f697dc45e")]
*
* @param {Array} arr
* @return {Array}
* @private
*/
e.array.unique=function(t){var e,r=new Set,n=new Set,o=[],s=i(t);try{for(s.s();!(e=s.n()).done;){var a=e.value;if("number"==typeof a||"string"==typeof a||null==a){if(r.has(a))continue;o.push(a),r.add(a)}else if(a instanceof c){if(n.has(a.toString()))continue;o.push(a),n.add(a.toString())}else o.push(a)}}catch(t){s.e(t)}finally{s.f()}return o},
/*!
* Determines if two buffers are equal.
*
* @param {Buffer} a
* @param {Object} b
*/
e.buffer={},e.buffer.areEqual=function(e,r){if(!t.isBuffer(e))return!1;if(!t.isBuffer(r))return!1;if(e.length!==r.length)return!1;for(var n=0,i=e.length;n<i;++n)if(e[n]!==r[n])return!1;return!0},e.getFunctionName=g,
/*!
* Decorate buffers
*/
e.decorate=function(t,e){for(var r in e)S.has(r)||(t[r]=e[r])},e.mergeClone=function(r,n){w(n)&&(n=n.toObject({transform:!1,virtuals:!1,depopulate:!0,getters:!1,flattenDecimals:!1}));for(var i,o=Object.keys(n),s=o.length,a=0;a<s;)if(i=o[a++],!S.has(i))if(void 0===r[i])r[i]=e.clone(n[i],{transform:!1,virtuals:!1,depopulate:!0,getters:!1,flattenDecimals:!1});else{var u=n[i];if(null==u||!u.valueOf||u instanceof Date||(u=u.valueOf()),e.isObject(u)){var h=u;w(u)&&!u.isMongooseBuffer&&(h=h.toObject({transform:!1,virtuals:!1,depopulate:!0,getters:!1,flattenDecimals:!1})),u.isMongooseBuffer&&(h=t.from(h)),e.mergeClone(r[i],h)}else r[i]=e.clone(u,{flattenDecimals:!1})}},e.each=function(t,e){var r,n=i(t);try{for(n.s();!(r=n.n()).done;){e(r.value)}}catch(t){n.e(t)}finally{n.f()}},
/*!
* ignore
*/
e.getOption=function(t){var e,r=Array.prototype.slice.call(arguments,1),n=i(r);try{for(n.s();!(e=n.n()).done;){var o=e.value;if(null!=o[t])return o[t]}}catch(t){n.e(t)}finally{n.f()}return null},
/*!
* ignore
*/
e.noop=function(){},e.errorToPOJO=function(t){if(!(t instanceof Error))throw new Error("`error` must be `instanceof Error`.");var e,r={},n=i(Object.getOwnPropertyNames(t));try{for(n.s();!(e=n.n()).done;){var o=e.value;r[o]=t[o]}}catch(t){n.e(t)}finally{n.f()}return r},
/*!
* ignore
*/
e.warn=function(t){return n.emitWarning(t,{code:"MONGOOSE"})}}).call(this,r(3).Buffer,r(5))},function(t,e){var r,n,i=t.exports={};function o(){throw new Error("setTimeout has not been defined")}function s(){throw new Error("clearTimeout has not been defined")}function a(t){if(r===setTimeout)return setTimeout(t,0);if((r===o||!r)&&setTimeout)return r=setTimeout,setTimeout(t,0);try{return r(t,0)}catch(e){try{return r.call(null,t,0)}catch(e){return r.call(this,t,0)}}}!function(){try{r="function"==typeof setTimeout?setTimeout:o}catch(t){r=o}try{n="function"==typeof clearTimeout?clearTimeout:s}catch(t){n=s}}();var u,h=[],f=!1,c=-1;function l(){f&&u&&(f=!1,u.length?h=u.concat(h):c=-1,h.length&&d())}function d(){if(!f){var t=a(l);f=!0;for(var e=h.length;e;){for(u=h,h=[];++c<e;)u&&u[c].run();c=-1,e=h.length}u=null,f=!1,function(t){if(n===clearTimeout)return clearTimeout(t);if((n===s||!n)&&clearTimeout)return n=clearTimeout,clearTimeout(t);try{n(t)}catch(e){try{return n.call(null,t)}catch(e){return n.call(this,t)}}}(t)}}function p(t,e){this.fun=t,this.array=e}function y(){}i.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)e[r-1]=arguments[r];h.push(new p(t,e)),1!==h.length||f||a(d)},p.prototype.run=function(){this.fun.apply(null,this.array)},i.title="browser",i.browser=!0,i.env={},i.argv=[],i.version="",i.versions={},i.on=y,i.addListener=y,i.once=y,i.off=y,i.removeListener=y,i.removeAllListeners=y,i.emit=y,i.prependListener=y,i.prependOnceListener=y,i.listeners=function(t){return[]},i.binding=function(t){throw new Error("process.binding is not supported")},i.cwd=function(){return"/"},i.chdir=function(t){throw new Error("process.chdir is not supported")},i.umask=function(){return 0}},function(t,e,r){"use strict";
/*!
* Simplified lodash.get to work around the annoying null quirk. See:
* https://github.com/lodash/lodash/issues/3659
*/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}function o(t,e){return null==t?t:t instanceof Map?t.get(e):t[e]}t.exports=function(t,e,r){var i,s=!1;if("string"==typeof e){if(-1===e.indexOf(".")){var a=o(t,e);return null==a?r:a}i=e.split(".")}else if(s=!0,1===(i=e).length){var u=o(t,i[0]);return null==u?r:u}var h,f=e,c=t,l=n(i);try{for(l.s();!(h=l.n()).done;){var d=h.value;if(null==c)return r;if(!s&&null!=c[f])return c[f];c=o(c,d),s||(f=f.substr(d.length+1))}}catch(t){l.e(t)}finally{l.f()}return null==c?r:c}},function(t,e){function r(t){return(r="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 n;n=function(){return this}();try{n=n||new Function("return this")()}catch(t){"object"===("undefined"==typeof window?"undefined":r(window))&&(n=window)}t.exports=n},function(t,e,r){"use strict";var n=r(19);
/*!
* Module exports.
*/t.exports=n,n.messages=r(291),n.Messages=n.messages,n.DocumentNotFoundError=r(292),n.CastError=r(20),n.ValidationError=r(151),n.ValidatorError=r(152),n.VersionError=r(293),n.ParallelSaveError=r(294),n.OverwriteModelError=r(295),n.MissingSchemaError=r(296),n.MongooseServerSelectionError=r(297),n.DivergentArrayError=r(301),n.StrictModeError=r(44)},function(t,e,r){(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)}var i=Object.getOwnPropertyDescriptors||function(t){for(var e=Object.keys(t),r={},n=0;n<e.length;n++)r[e[n]]=Object.getOwnPropertyDescriptor(t,e[n]);return r},o=/%[sdj%]/g;e.format=function(t){if(!v(t)){for(var e=[],r=0;r<arguments.length;r++)e.push(u(arguments[r]));return e.join(" ")}r=1;for(var n=arguments,i=n.length,s=String(t).replace(o,(function(t){if("%%"===t)return"%";if(r>=i)return t;switch(t){case"%s":return String(n[r++]);case"%d":return Number(n[r++]);case"%j":try{return JSON.stringify(n[r++])}catch(t){return"[Circular]"}default:return t}})),a=n[r];r<i;a=n[++r])m(a)||!_(a)?s+=" "+a:s+=" "+u(a);return s},e.deprecate=function(r,n){if(void 0!==t&&!0===t.noDeprecation)return r;if(void 0===t)return function(){return e.deprecate(r,n).apply(this,arguments)};var i=!1;return function(){if(!i){if(t.throwDeprecation)throw new Error(n);t.traceDeprecation?console.trace(n):console.error(n),i=!0}return r.apply(this,arguments)}};var s,a={};function u(t,r){var n={seen:[],stylize:f};return arguments.length>=3&&(n.depth=arguments[2]),arguments.length>=4&&(n.colors=arguments[3]),y(r)?n.showHidden=r:r&&e._extend(n,r),g(n.showHidden)&&(n.showHidden=!1),g(n.depth)&&(n.depth=2),g(n.colors)&&(n.colors=!1),g(n.customInspect)&&(n.customInspect=!0),n.colors&&(n.stylize=h),c(n,t,n.depth)}function h(t,e){var r=u.styles[e];return r?"["+u.colors[r][0]+"m"+t+"["+u.colors[r][1]+"m":t}function f(t,e){return t}function c(t,r,n){if(t.customInspect&&r&&O(r.inspect)&&r.inspect!==e.inspect&&(!r.constructor||r.constructor.prototype!==r)){var i=r.inspect(n,t);return v(i)||(i=c(t,i,n)),i}var o=function(t,e){if(g(e))return t.stylize("undefined","undefined");if(v(e)){var r="'"+JSON.stringify(e).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return t.stylize(r,"string")}if(b(e))return t.stylize(""+e,"number");if(y(e))return t.stylize(""+e,"boolean");if(m(e))return t.stylize("null","null")}(t,r);if(o)return o;var s=Object.keys(r),a=function(t){var e={};return t.forEach((function(t,r){e[t]=!0})),e}(s);if(t.showHidden&&(s=Object.getOwnPropertyNames(r)),S(r)&&(s.indexOf("message")>=0||s.indexOf("description")>=0))return l(r);if(0===s.length){if(O(r)){var u=r.name?": "+r.name:"";return t.stylize("[Function"+u+"]","special")}if(w(r))return t.stylize(RegExp.prototype.toString.call(r),"regexp");if(M(r))return t.stylize(Date.prototype.toString.call(r),"date");if(S(r))return l(r)}var h,f="",_=!1,A=["{","}"];(p(r)&&(_=!0,A=["[","]"]),O(r))&&(f=" [Function"+(r.name?": "+r.name:"")+"]");return w(r)&&(f=" "+RegExp.prototype.toString.call(r)),M(r)&&(f=" "+Date.prototype.toUTCString.call(r)),S(r)&&(f=" "+l(r)),0!==s.length||_&&0!=r.length?n<0?w(r)?t.stylize(RegExp.prototype.toString.call(r),"regexp"):t.stylize("[Object]","special"):(t.seen.push(r),h=_?function(t,e,r,n,i){for(var o=[],s=0,a=e.length;s<a;++s)j(e,String(s))?o.push(d(t,e,r,n,String(s),!0)):o.push("");return i.forEach((function(i){i.match(/^\d+$/)||o.push(d(t,e,r,n,i,!0))})),o}(t,r,n,a,s):s.map((function(e){return d(t,r,n,a,e,_)})),t.seen.pop(),function(t,e,r){if(t.reduce((function(t,e){return e.indexOf("\n")>=0&&0,t+e.replace(/\u001b\[\d\d?m/g,"").length+1}),0)>60)return r[0]+(""===e?"":e+"\n ")+" "+t.join(",\n ")+" "+r[1];return r[0]+e+" "+t.join(", ")+" "+r[1]}(h,f,A)):A[0]+f+A[1]}function l(t){return"["+Error.prototype.toString.call(t)+"]"}function d(t,e,r,n,i,o){var s,a,u;if((u=Object.getOwnPropertyDescriptor(e,i)||{value:e[i]}).get?a=u.set?t.stylize("[Getter/Setter]","special"):t.styl
/*!
* Module dependencies.
*/
function i(t){return(i="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 o=r(8),s=r(15),a=r(83),u=r(153),h=r(6),f=r(302),c=r(303),l=r(42),d=r(1).schemaTypeSymbol,p=r(4),y=r(1).validatorErrorSymbol,m=r(1).documentIsModified,b=r(1).populateModelSymbol,v=o.CastError,g=o.ValidatorError;function w(t,e,r){this[d]=!0,this.path=t,this.instance=r,this.validators=[],this.getters=this.constructor.hasOwnProperty("getters")?this.constructor.getters.slice():[],this.setters=[],this.splitPath(),e=e||{};for(var n=this.constructor.defaultOptions||{},o=0,a=Object.keys(n);o<a.length;o++){var u=a[o];n.hasOwnProperty(u)&&!e.hasOwnProperty(u)&&(e[u]=n[u])}null==e.select&&delete e.select;var h=this.OptionsConstructor||s;this.options=new h(e),this._index=null,p.hasUserDefinedProperty(this.options,"immutable")&&(this.$immutable=this.options.immutable,f(this));for(var c=0,l=Object.keys(this.options);c<l.length;c++){var y=l[c];if("cast"!==y){if(p.hasUserDefinedProperty(this.options,y)&&"function"==typeof this[y]){if("index"===y&&this._index){if(!1===e.index){var m=this._index;if("object"===i(m)&&null!=m){if(m.unique)throw new Error('Path "'+this.path+'" may not have `index` set to false and `unique` set to true');if(m.sparse)throw new Error('Path "'+this.path+'" may not have `index` set to false and `sparse` set to true')}this._index=!1}continue}var b=e[y];if("default"===y){this.default(b);continue}var v=Array.isArray(b)?b:[b];this[y].apply(this,v)}}else this.castFunction(this.options[y])}Object.defineProperty(this,"$$context",{enumerable:!1,configurable:!1,writable:!0,value:null})}
/*!
* The class that Mongoose uses internally to instantiate this SchemaType's `options` property.
*/function _(t,e){if(void 0!==t&&!t){var r=new(e.ErrorConstructor||g)(e);return r[y]=!0,r}}
/*!
* ignore
*/
function M(t){return this.castForQuery(t)}
/*!
* ignore
*/
/*!
* Just like handleArray, except also allows `[]` because surprisingly
* `$in: [1, []]` works fine
*/
function S(t){var e=this;return Array.isArray(t)?t.map((function(t){return Array.isArray(t)&&0===t.length?t:e.castForQuery(t)})):[this.castForQuery(t)]}
/*!
* ignore
*/w.prototype.OptionsConstructor=s,w.prototype.path,w.prototype.validators,w.prototype.validators,
/*!
* ignore
*/
w.prototype.splitPath=function(){return null!=this._presplitPath?this._presplitPath:null!=this.path?(this._presplitPath=-1===this.path.indexOf(".")?[this.path]:this.path.split("."),this._presplitPath):void 0},w.cast=function(t){return 0===arguments.length||(!1===t&&(t=function(t){return t}),this._cast=t),this._cast},w.prototype.castFunction=function(t){return 0===arguments.length||(!1===t&&(t=this.constructor._defaultCaster||function(t){return t}),this._castFunction=t),this._castFunction},w.prototype.cast=function(){throw new Error("Base SchemaType class does not implement a `cast()` function")},w.set=function(t,e){this.hasOwnProperty("defaultOptions")||(this.defaultOptions=Object.assign({},this.defaultOptions)),this.defaultOptions[t]=e},w.get=function(t){this.getters=this.hasOwnProperty("getters")?this.getters:[],this.getters.push(t)},w.prototype.default=function(t){if(1===arguments.length){if(void 0===t)return void(this.defaultValue=void 0);if(null!=t&&t.instanceOfSchema)throw new o("Cannot set default value of path `"+this.path+"` to a mongoose Schema instance.");return this.defaultValue=t,this.defaultValue}return arguments.length>1&&(this.defaultValue=Array.prototype.slice.call(arguments)),this.defaultValue},w.prototype.index=function(t){return this._index=t,p.expires(this._index),this},w.prototype.unique=function(t){if(!1===this._index){if(!t)return;throw new Error('Path "'+this.path+'" may not have `index` set to false and `unique` set to true')}return this.options.hasOwnProperty("index")||!1!==t?(null==this._index||!0===this._index?this._index={}:"string"==typeof this._index&&(this._index={type:this._index}),this._index.unique=t,this):this},w.prototype.text=function(t){if(!1===this._index){if(!t)return;throw new Error('Path "'+this.path+'" may not have `index` set to false and `text` set to true')}return this.options.hasOwnProperty("index")||!1!==t?(null===this._index||void 0===this._index||"boolean"==typeof this._index?this._index={}:"string"==typeof this._index&&(this._index={type:this._index}),this._index.text=t,this):this},w.prototype.sparse=function(t){if(!1===this._index){if(!t)return;throw new Error('Path "'+this.path+'" may not have `index` set to false and `sparse` set to true')}return this.options.hasOwnProperty("index")||!1!==t?(null==this._index||"boolean"==typeof this._index?this._index={}:"string"==typeof this._index&&(this._index={type:this._index}),this._index.sparse=t,this):this},w.prototype.immutable=function(t){return this.$immutable=t,f(this),this},w.prototype.transform=function(t){return this.options.transform=t,this},w.prototype.set=function(t){if("function"!=typeof t)throw new TypeError("A setter must be a function.");return this.setters.push(t),this},w.prototype.get=function(t){if("function"!=typeof t)throw new TypeError("A getter must be a function.");return this.getters.push(t),this},w.prototype.validate=function(t,e,r){var n,s,a,u;if("function"==typeof t||t&&"RegExp"===p.getFunctionName(t.constructor))return"function"==typeof e?(n={validator:t,message:e}).type=r||"user defined":e instanceof Object&&!r?((n=p.clone(e)).message||(n.message=n.msg),n.validator=t,n.type=n.type||"user defined"):(null==e&&(e=o.messages.general.default),r||(r="user defined"),n={message:e,type:r,validator:t}),this.validators.push(n),this;for(s=0,a=arguments.length;s<a;s++){if(u=arguments[s],!p.isPOJO(u)){var h="Invalid validator. Received ("+i(u)+") "+u+". See http://mongoosejs.com/docs/api.html#schematype_SchemaType-validate";throw new Error(h)}this.validate(u.validator,u)}return this},w.prototype.required=function(t,e){var r={};if(arguments.length>0&&null==t)return this.validators=this.validators.filter((function(t){return t.validator!==this.requiredValidator}),this),this.isRequired=!1,delete this.originalRequiredValue,this;if("object"===i(t)&&(e=(r=t).message||e,t=t.isRequired),!1===t)return this.validators=this.validators.filter((function(t){return t.validator!==this.requiredValidator}),this),this.isRequired=!1,delete this.originalRequiredValue,this;var n=this;this.isRequired=!0,this.requiredValidator=functio
/*!
* Applies setters without casting
*
* @api private
*/
w.prototype._applySetters=function(t,e,r,n){var i=t;if(r)return i;for(var o=this.setters,s=o.length-1;s>=0;s--)i=o[s].call(e,i,n,this);return i},
/*!
* ignore
*/
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))[y]=!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(0===this.validators.length||"required"!==this.validators[0].type)return null;o=[this.validators[0]]}var s=null,a=0,u=o.length;for(a=0;a<u;++a){var h=o[a];if(null!=h&&"object"===i(h)){var f=h.validator,l=p.clone(h);l.path=r&&r.path?r.path:n,l.value=t;var d=!1;if(!c(f))if(f instanceof RegExp)s=_(f.test(t),l);else if("function"==typeof f){try{d=l.propsParameter?f.call(e,t,l):f.call(e,t)}catch(t){d=!1,l.reason=t}if((null==d||"function"!=typeof d.then)&&(s=_(d,l)))break}}}return s},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))},
/*!
* ignore
*/
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:M,$in:S,$ne:M,$nin:S,$exists:a,$type:u},
/*!
* Wraps `castForQuery` to handle context
*/
w.prototype.castForQueryWrapper=function(t){if(this.$$context=t.context,"$conditional"in t){var e=this.castForQuery(t.$conditional,t.val);return this.$$context=null,e}if(t.$skipQueryCastForUpdate||t.$applySetters){var r=this._castForQuery(t.val);return this.$$context=null,r}var n=this.castForQuery(t.val);return this.$$context=null,n},w.prototype.castForQuery=function(t,e){var r;if(2===arguments.length){if(!(r=this.$conditionalHandlers[t]))throw new Error("Can't use "+t);return r.call(this,e)}return e=t,this._castForQuery(e)},
/*!
* Internal switch for runSetters
*
* @api private
*/
w.prototype._castForQuery=function(t){return this.applySetters(t,this.$$context)},w.checkRequired=function(t){return 0!==arguments.length&&(this._checkRequired=t),this._checkRequired},w.prototype.checkRequired=function(t){return null!=t},
/*!
* ignore
*/
w.prototype.clone=function(){var t=Object.assign({},this.options),e=new this.constructor(this.path,t,this.instance);return e.validators=this.validators.slice(),void 0!==this.requiredValidator&&(e.requiredValidator=this.requiredValidator),void 0!==this.defaultValue&&(e.defaultValue=this.defaultValue),void 0!==this.$immutable&&void 0===this.options.immutable&&(e.$immutable=this.$immutable,f(e)),void 0!==this._index&&(e._index=this._index),void 0!==this.selected&&(e.selected=this.selected),void 0!==this.isRequired&&(e.isRequired=this.isRequired),void 0!==this.originalRequiredValue&&(e.originalRequiredValue=this.originalRequiredValue),e.getters=this.getters.slice(),e.setters=this.setters.slice(),e},
/*!
* Module exports.
*/
t.exports=e=w,e.CastError=v,e.ValidatorError=g}).call(this,r(3).Buffer)},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(21),o=r(11),s=r(128);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";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 y(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 m(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
/*!
* Module dependencies.
*/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(13).EventEmitter,c=r(275),l=r(8),d=r(45),p=r(154),y=r(304),m=r(305),b=r(85),v=r(44),g=r(151),w=r(152),_=r(86),M=r(53),S=r(167),O=r(91).compile,A=r(91).defineKey,E=r(342).flatten,x=r(343),k=r(6),j=r(345),$=r(346),P=r(171),R=r(42),B=r(92),T=r(347),I=r(9).inspect,N=r(34).internalToObjectOptions,D=r(348),C=r(81),L=r(349),q=r(4),U=r(351),F=q.clone,z=q.deepEqual,V=q.isMongooseObject,K=r(1).arrayAtomicsBackupSymbol,H=r(1).arrayAtomicsSymbol,Z=r(1).documentArrayParent,W=r(1).documentIsModified,J=r(1).documentModifiedPaths,Y=r(1).documentSchemaSymbol,Q=r(1).getSymbol,G=r(1).populateModelSymbol,X=r(1).scopeSymbol,tt=r(55).schemaMixedSymbol,et=r(352),rt=q.specialProperties;function nt(t,e,r,n){if("object"===s(r)&&null!=r&&(r=(n=r).skipId),n=Object.assign({},n),null==this.$__schema){var o=q.isObject(e)&&!e.instanceOfSchema?new b(e):e;this.$__setSchema(o),e=r,r=n,n=arguments[4]||{}}if(this.$__=new c,this.$isNew=!("isNew"in n)||n.isNew,"priorDoc"in n&&(this.$__.priorDoc=n.priorDoc),r&&(this.$__.skipId=r),null!=t&&"object"!==s(t))throw new y(t,"obj","Document");var a=!0;void 0!==n.defaults&&(this.$__.defaults=n.defaults,a=n.defaults);var u=this.$__schema;"boolean"==typeof e||"throw"===e?(this.$__.strictMode=e,e=void 0):(this.$__.strictMode=u.options.strict,void 0!==e&&(this.$__.selected=e));var h,f=u.requiredPaths(!0),l=i(f);try{for(l.s();!(h=l.n()).done;){var d=h.value;this.$__.activePaths.require(d)}}catch(t){l.e(t)}finally{l.f()}var p=null;q.isPOJO(e)&&(p=T(e),this.$__.fields=e,this.$__.exclude=p);var m=!1===p&&e?ot(e):{};if(null==this._doc&&(this.$__buildDoc(t,e,r,p,m,!1),a&&st(this,e,p,m,!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&&a?n.skipDefaults&&(this.$__.skipDefaults=n.skipDefaults):a&&st(this,e,p,m,!1,n.skipDefaults,this.$isNew),this.$__._id=this._id,!this.$__.strictMode&&t){var v=this,g=Object.keys(this._doc);g.forEach((function(t){t in u.tree||t in u.methods||t in u.virtuals||t.startsWith("$")||A({prop:t,subprops:null,prototype:v})}))}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}}),
/*!
* Document exposes the NodeJS event emitter API, so you can use
* `on`, `once`, etc.
*/
q.each(["on","once","emit","listeners","removeListener","setMaxListeners","removeAllListeners","addListener"],(function(t){nt.prototype[t]=function(){if(!this.$__.emitter){if("emit"===t)return;this.$__.emitter=new f,this.$__.emitter.setMaxListeners(0)}return this.$__.emitter[t].apply(this.$__.emitter,arguments)},nt.prototype["$".concat(t)]=nt.prototype[t]})),nt.prototype.constructor=nt,f.prototype)nt[it]=f.prototype[it];
/*!
* ignore
*/
function ot(t){for(var e={},r=0,n=Object.keys(t);r<n.length;r++){var i=n[r];if(-1!==i.indexOf("."))for(var o=i.split("."),s=o[0],a=0;a<o.length;++a)e[s]=1,a+1<o.length&&(s=s+"."+o[a+1]);else e[i]=1}return e}
/*!
* ignore
*/function st(t,e,r,n,i,o){for(var s=Object.keys(t.$__schema.paths),a=s.length,u=0;u<a;++u){var h=void 0,f="",c=s[u];if("_id"!==c||!t.$__.skipId)for(var l=t.$__schema.paths[c],d=l.splitPath(),p=d.length,y=!1,m=t._doc,b=0;b<p&&null!=m;++b){var v=d[b];if(f+=(f.length?".":"")+v,!0===r){if(f in e)break}else if(!1===r&&e&&!y)if(f in e||l.$isSingleNested&&n[f])y=!0;else if(!n[f])break;if(b===p-1){if(void 0!==m[v])break;if("function"==typeof l.defaultValue){if(!l.defaultValue.$runBeforeSetters&&i)break;if(l.defaultValue.$runBeforeSetters&&!i)break}else if(!i)continue;if(o&&o[f])break;if(e&&null!==r){if(!0===r){if(c in e)continue;try{h=l.getDefault(t,!1)}catch(e){t.invalidate(c,e);break}void 0!==h&&(m[v]=h,t.$__.activePaths.default(c))}else if(y){try{h=l.getDefault(t,!1)}catch(e){t.invalidate(c,e);break}void 0!==h&&(m[v]=h,t.$__.activePaths.default(c))}}else{try{h=l.getDefault(t,!1)}catch(e){t.invalidate(c,e);break}void 0!==h&&(m[v]=h,t.$__.activePaths.default(c))}}else m=m[v]}}}
/*!
* ignore
*/function at(t,e,r){if(null!=t){x(t);for(var n=Object.keys(r.$__schema.paths),i=n.length,o=-1===e.indexOf(".")?[e]:e.split("."),s=0;s<i;++s){var a="",u=n[s];if(u.startsWith(e+".")){var h=r.$__schema.paths[u],f=h.splitPath().slice(o.length),c=f.length;if(void 0!==h.defaultValue)for(var l=t,d=0;d<c&&null!=l;++d){var p=f[d];if(d===c-1){if(void 0!==l[p])break;try{var y=h.getDefault(r,!1);void 0!==y&&(l[p]=y)}catch(t){r.invalidate(e+"."+a,t);break}break}a+=(a.length?".":"")+p,l[p]=l[p]||{},l=l[p]}}}}}function ut(t){if(null==t)return!0;if("object"!==s(t)||Array.isArray(t))return!1;for(var e=0,r=Object.keys(t);e<r.length;e++){if(!ut(t[r[e]]))return!1}return!0}
/*!
* ignore
*/
function ht(t){var e={};!
/*!
* ignore
*/
function(t){var e=Object.keys(t.$__.activePaths.states.require),r=0,n=e.length;for(r=0;r<n;++r){var i=e[r],o=t.$__schema.path(i);if(null!=o&&"function"==typeof o.originalRequiredValue){t.$__.cachedRequired=t.$__.cachedRequired||{};try{t.$__.cachedRequired[i]=o.originalRequiredValue.call(t,t)}catch(e){t.invalidate(i,e)}}}}(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 y=d.value,m=t.$__schema.path(y);if(m&&m.$isMongooseArray&&(Array.isArray(m)||!m.$isMongooseDocumentArray||k(m,"schemaOptions.required")))b(t.$__getValue(y),r,y)}}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 P,R=i($.keys());try{for(R.s();!(P=R.n()).done;){var B=P.value;r.add(x+"."+B)}}catch(t){R.e(t)}finally{R.f()}}}}}}catch(t){A.e(t)}finally{A.f()}return[r=Array.from(r),e]}
/*!
* ignore
*/
/*!
* ignore
*/
function ft(t,e){var r,n=new Set(e),o=new Map([]),s=i(e);try{for(s.s();!(r=s.n()).done;){var a=r.value;if(-1!==a.indexOf("."))for(var u=a.split("."),h=u[0],f=1;f<u.length;++f)o.set(h,a),h=h+"."+u[f]}}catch(t){s.e(t)}finally{s.f()}var c,l=[],d=i(t);try{for(d.s();!(c=d.n()).done;){var p=c.value;n.has(p)?l.push(p):o.has(p)&&l.push(o.get(p))}}catch(t){d.e(t)}finally{d.f()}return l}
/*!
* ignore
*/function ct(t,e){return e=new Set(e),t=t.filter((function(t){return!e.has(t)}))}
/*!
* Runs queued functions
*/
function lt(t){var e=t.$__schema&&t.$__schema.callQueue;if(e.length){var r,n=i(e);try{for(n.s();!(r=n.n()).done;){var o=r.value;"pre"!==o[0]&&"post"!==o[0]&&"on"!==o[0]&&t[o[0]].apply(t,o[1])}}catch(t){n.e(t)}finally{n.f()}}}
/*!
* ignore
*/
/*!
* Applies virtuals properties to `json`.
*/
function dt(t,e,r,n){var i,o,s,a=t.$__schema,u=Object.keys(a.virtuals),h=u.length,f=h,c=t._doc,l=k(n,"aliases",!0),d=null;if(Array.isArray(r.virtuals))d=new Set(r.virtuals);else if(r.virtuals&&r.virtuals.pathsToSkip){d=new Set(u);for(var p=0;p<r.virtuals.pathsToSkip.length;p++)d.has(r.virtuals.pathsToSkip[p])&&d.delete(r.virtuals.pathsToSkip[p])}if(!c)return e;for(r=r||{},h=0;h<f;++h)if(i=u[h],(null==d||d.has(i))&&(l||!a.aliases.hasOwnProperty(i))){if(o=i,null!=r.path){if(!i.startsWith(r.path+"."))continue;o=i.substring(r.path.length+1)}var y=o.split(".");if(void 0!==(s=F(t.get(i),r))){var m=y.length;c=e;for(var b=0;b<m-1;++b)c[y[b]]=c[y[b]]||{},c=c[y[b]];c[y[m-1]]=s}}return e}
/*!
* Applies virtuals properties to `json`.
*
* @param {Document} self
* @param {Object} json
* @return {Object} `json`
*/function pt(t,e){if(U(e))throw new Error("`transform` function must be synchronous, but the transform on path `"+t+"` returned a promise.")}
/*!
* ignore
*/nt.prototype.$__schema,nt.prototype.schema,Object.defineProperty(nt.prototype,"$locals",{configurable:!1,enumerable:!1,get:function(){return null==this.$__.locals&&(this.$__.locals={}),this.$__.locals},set:function(t){this.$__.locals=t}}),nt.prototype.$isNew,nt.prototype.isNew,Object.defineProperty(nt.prototype,"$where",{configurable:!1,enumerable:!1,writable:!0}),nt.prototype.id,nt.prototype.$errors,nt.prototype.errors,Object.defineProperty(nt.prototype,"$op",{get:function(){return this.$__.op||null},set:function(t){this.$__.op=t}}),nt.prototype.$__buildDoc=function(t,e,r,n,i){for(var o={},s=Object.keys(this.$__schema.paths).filter((function(t){return!t.includes("$*")})),a=s.length,u=0;u<a;++u){var h=s[u];if("_id"===h){if(r)continue;if(t&&"_id"in t)continue}for(var f=this.$__schema.paths[h].splitPath(),c=f.length,l=c-1,d="",p=o,y=!1,m=0;m<c;++m){var b=f[m];if(d+=(d.length?".":"")+b,!0===n){if(d in e)break}else if(!1===n&&e&&!y)if(d in e)y=!0;else if(!i[d])break;m<l&&(p=p[b]||(p[b]={}))}}this._doc=o},
/*!
* Converts to POJO when you use the document for querying
*/
nt.prototype.toBSON=function(){return this.toObject(N)},nt.prototype.init=function(t,e,r){return"function"==typeof e&&(r=e,e=null),this.$__init(t,e),r&&r(null,this),this},nt.prototype.$init=function(){return this.constructor.prototype.init.apply(this,arguments)},nt.prototype.$__init=function(t,e){if(this.$isNew=!1,e=e||{},null!=t._id&&e.populated&&e.populated.length){var r,n=String(t._id),o=i(e.populated);try{for(o.s();!(r=o.n()).done;){var s=r.value;if(s.isVirtual?this.$populated(s.path,q.getValue(s.path,t),s):this.$populated(s.path,s._docs[n],s),null!=s._childDocs){var a,u=i(s._childDocs);try{for(u.s();!(a=u.n()).done;){var h=a.value;null!=h&&null!=h.$__&&(h.$__.parent=this)}}catch(t){u.e(t)}finally{u.f()}s._childDocs=[]}}}catch(t){o.e(t)}finally{o.f()}}!
/*!
* Init helper.
*
* @param {Object} self document instance
* @param {Object} obj raw mongodb doc
* @param {Object} doc object we are initializing
* @api private
*/
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,d=e.$__schema;for(;c<f;)p(c++);function p(f){if(u=h[f],a=o+u,s=d.path(a),!d.$isRootDiscriminator||e.$__isSelected(a))if(!s&&q.isPOJO(r[u]))n[u]||(n[u]={},l||u in d.tree||u in d.methods||u in d.virtuals||(e[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=null==r[u].$__?null:r[u].$__.wasPopulated;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;var f=!1===this.$__.exclude&&this.$__.fields?ot(this.$__.fields):{};return st(this,this.$__.fields,this.$__.exclude,f,!1,this.$__.skipDefaults),this},nt.prototype.update=function(){var t=Array.prototype.slice.call(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=Array.prototype.slice.call(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(null!=t||null!=this.$__.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,y=(o=o||{}).merge,m=r&&!0!==r,b=!0===r,g=this.$__schema.options.typeKey,w=0,_="strict"in o?o.strict:this.$__.strictMode;if(m&&((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 R=c+(f=u[x]);h=this.$__schema.pathType(R);var B=t[f];if(!0!==r||c||null==B||"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(R))continue;if("adhocOrUndefined"===h&&(h=j(this,R,{typeOnly:!0})),"real"===h||"virtual"===h){var T=t[f];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)}
/*!
* ignore
*/
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)}
/*!
* ignore
*/(this,t),null!=e&&y&&z.$isSingleNested){e instanceof nt&&(e=e.toObject({virtuals:!1,transform:!1}));for(var ct=0,lt=Object.keys(e);ct<lt.length;ct++){var dt=lt[ct];this.$set(t+"."+dt,e[dt],b,o)}return this}var pt=!0;try{var yt,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}(),bt=!1;if(mt&&e instanceof nt&&(this.$populated(t,e._id,n({},G,e.constructor)),e.$__.wasPopulated=!0,bt=!0),z.options&&Array.isArray(z.options[g])&&z.options[g].length&&z.options[g][0].ref&&
/*!
* ignore
*/
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)){yt=n({},G,e[0].constructor),this.$populated(t,e.map((function(t){return t._id})),yt);var vt,gt=i(e);try{for(gt.s();!(vt=gt.n()).done;){vt.value.$__.wasPopulated=!0}}catch(t){gt.e(t)}finally{gt.f()}bt=!0}if(null!=this.$__schema.singleNestedPaths[t]||mt&&z.$isSingleNested&&e.$__||(e=z.applySetters(e,this,!1,V)),Array.isArray(e)&&!Array.isArray(z)&&z.$isMongooseDocumentArray&&0!==e.length&&null!=e[0]&&null!=e[0].$__&&null!=e[0].$__.populated){for(var wt=Object.keys(e[0].$__.populated),_t=function(){var r=St[Mt];a.$populated(t+"."+r,e.map((function(t){return t.$populated(r)})),e[0].$__.populated[r].options)},Mt=0,St=wt;Mt<St.length;Mt++)_t();bt=!0}if(!bt&&this.$__.populated){if(Array.isArray(e)&&this.$__.populated[t])for(var Ot=0;Ot<e.length;++Ot)e[Ot]instanceof nt&&e.set(Ot,e[Ot]._id,!0);delete this.$__.populated[t]}null!=e&&z.$isSingleNested&&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)),pt=!1}if(pt){var At=this.$isSubdocument?this.ownerDocument():this,Et=At.$__.savedState,xt=this.$isSubdocument?this.$__.fullPath+"."+t:t;if(null!=Et){var kt=xt.indexOf("."),jt=-1===kt?xt:xt.slice(0,kt);Et.hasOwnProperty(jt)||(Et[jt]=q.clone(At.$__getValue(jt)))}this.$__set(ot,t,o,b,et,z,e,V),null!=Et&&Et.hasOwnProperty(xt)&&q.deepEqual(e,Et[xt])&&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(46);var c=this.$__shouldModify(t,e,n,i,o,s,a,f),l=this;c?(this.markModified(t),u||(u=r(166)),a&&q.isMongooseArray(a)&&(a._registerAtomic("$set",a),q.isMongooseDocumentArray(a)&&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)&&Array.isArray(f)&&q.isMongooseArray(a)&&q.isMongooseArray(f)&&(a[H]=f[H],a[K]=f[K],q.isMongooseDocumentArray(a)&&a.forEach((function(t){t.isNew=!1})));for(var d=this._doc,p=0,y=o.length,m="";p<y;p++){var b=p+1===y;if(m+=m?"."+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]]&&!Array.isArray(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(v
/*!
* ignore
*/
nt.prototype[Q]=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(0!==arguments.length){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=new Set,n=0,i=0,o=e.length;for(n=0;n<o;++n){var a=e[n],u=et(a),h=u.length;for(i=0;i<h;++i)r.add(u[i]);if(t.includeChildren){var f=0,c=this.$get(a);if("object"===s(c)&&null!==c){c._doc&&(c=c._doc);var l=c.length;if(Array.isArray(c))for(f=0;f<l;++f){var d=a+"."+f;if(!r.has(d)&&(r.add(d),null!=c[f]&&c[f].$__)){var p=c[f].modifiedPaths(),y=0,m=p.length;for(y=0;y<m;++y)r.add(d+"."+p[y])}}else{var b=Object.keys(c),v=0,g=b.length;for(v=0;v<g;++v)r.add(a+"."+b[v])}}}}return Array.from(r)},nt.prototype[J]=nt.prototype.modifiedPaths,nt.prototype.isModified=function(t,e){if(t){var r=Object.keys(this.$__.activePaths.states.modify);if(0===r.length)return!1;Array.isArray(t)||(t=-1===t.indexOf(" ")?[t]:t.split(" "));var n=e||this[J]();return t.some((function(t){return!!~n.indexOf(t)}))||t.some((function(t){return r.some((function(e){return e===t||t.startsWith(e+".")}))}))}return this.$__.activePaths.some("modify")},nt.prototype.$isModified=nt.prototype.isModified,nt.prototype[W]=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(!t)return!1;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
/*!
* ignore
*/
nt.prototype.$__undoReset=function(){if(null!=this.$__.backup&&null!=this.$__.backup.activePaths){this.$__.activePaths.states.modify=this.$__.backup.activePaths.modify,this.$__.activePaths.states.default=this.$__.backup.activePaths.default,this.$__.validationError=this.$__.backup.validationError,this.$errors=this.$__.backup.errors;var t,e=i(this.$__dirty());try{for(e.s();!(t=e.n()).done;){var r=t.value.value;r&&r[H]&&r[K]&&(r[H]=r[K])}}catch(t){e.e(t)}finally{e.f()}var n,o=i(this.$getAllSubdocs());try{for(o.s();!(n=o.n()).done;){n.value.$__undoReset()}}catch(t){o.e(t)}finally{o.f()}}},nt.prototype.$__dirty=function(){var t=this,e=this.$__.activePaths.map("modify",(function(e){return{path:e,value:t.$__getValue(e),schema:t.$__path(e)}}));e=e.concat(this.$__.activePaths.map("default",(function(e){if("_id"!==e&&null!=t.$__getValue(e))return{path:e,value:t.$__getValue(e),schema:t.$__path(e)}})));var r=new Map(e.filter((function(t){return null!=t})).map((function(t){return[t.path,t.value]}))),n=[];return e.forEach((function(t){if(t){for(var e=null,i=et(t.path),o=0;o<i.length-1;o++)if(r.has(i[o])){e=r.get(i[o]);break}null==e?n.push(t):null!=e&&null!=e[H]&&e.hasAtomics()&&(e[H]={},e[H].$set=e)}})),n},nt.prototype.$__setSchema=function(t){O(t.tree,this,void 0,t.options);for(var e=0,r=Object.keys(t.virtuals);e<r.length;e++){var n=r[e];t.virtuals[n]._applyDefaultGetters()}null==t.path("schema")&&(this.schema=t),this.$__schema=t,this[Y]=t},nt.prototype.$__getArrayPathsToValidate=function(){return a||(a=r(27)),this.$__.activePaths.map("init","modify",function(t){return this.$__getValue(t)}.bind(this)).filter((function(t){return t&&t instanceof Array&&q.isMongooseDocumentArray(t)&&t.length})).reduce((function(t,e){return t.concat(e)}),[]).filter((function(t){return t}))},nt.prototype.$getAllSubdocs=function(){function t(e,r,n){var i=e,o=!1;if(n&&(e instanceof nt&&e[Y].paths[n]?i=e._doc[n]:e instanceof nt&&e[Y].nested[n]?(i=e._doc[n],o=!0):i=e[n]),i instanceof h)r.push(i);else if(i instanceof Map)r=Array.from(i.keys()).reduce((function(e,r){return t(i.get(r),e,null)}),r);else if(i&&!Array.isArray(i)&&i.$isSingleNested)(r=Object.keys(i._doc).reduce((function(e,r){return t(i._doc,e,r)}),r)).push(i);else if(i&&q.isMongooseDocumentArray(i))i.forEach((function(e){e&&e._doc&&(r=Object.keys(e._doc).reduce((function(r,n){return t(e._doc,r,n)}),r),e instanceof h&&r.push(e))}));else if(o&&null!=i)for(var s=0,a=Object.keys(i);s<a.length;s++){var u=a[s];t(i,r,u)}return r}a||(a=r(27)),h=h||r(46);for(var e=[],n=0,i=Object.keys(this._doc);n<i.length;n++){t(this,e,i[n])}return e},nt.prototype.$__handleReject=function(t){this.$listeners("error").length?this.$emit("error",t):this.constructor.listeners&&this.constructor.listeners("error").length&&this.constructor.emit("error",t)},nt.prototype.$toObject=function(t,e){var r,n,i={transform:!0,flattenDecimals:!0},o=e?"toJSON":"toObject",s=k(this,"constructor.base.options."+o,{}),a=k(this,"$__schema.options",{});i=q.options(i,F(s)),i=q.options(i,F(a[o]||{})),(t=q.isPOJO(t)?F(t):{})._calledWithOptions=t._calledWithOptions||F(t),r=null!=t._calledWithOptions.minimize?t.minimize:null!=i.minimize?i.minimize:a.minimize,n=null!=t._calledWithOptions.flattenMaps?t.flattenMaps:null!=i.flattenMaps?i.flattenMaps:a.flattenMaps;var u=Object.assign(q.clone(t),{_isNested:!0,json:e,minimize:r,flattenMaps:n});if(q.hasUserDefinedProperty(t,"getters")&&(u.getters=t.getters),q.hasUserDefinedProperty(t,"virtuals")&&(u.virtuals=t.virtuals),(t.depopulate||k(t,"_parentOptions.depopulate",!1))&&t._isNested&&this.$__.wasPopulated)return F(this._id,u);(t=q.options(i,t))._isNested=!0,t.json=e,t.minimize=r,u._parentOptions=t,u._skipSingleNestedGetters=!0;var h=Object.assign({},u);h._skipSingleNestedGetters=!1;var f=t.transform,c=F(this._doc,u)||{};t.getters&&(!function(t,e,r){var n,i,o=t.$__schema,s=Object.keys(o.paths),a=s.length,u=t._doc;if(!u)return e;for(;a--;){var h=(n=s[a]).split("."),f=h.length,c=f-1,l=e,d=void 0;if(u=t._doc,t.$__isSelected(n))for(var p=0;p<f;++p){if(d=h[p],i=u[d],p===c){var y=t.$get(n);l[d]=F(y,r)}else{if(null==i
/*!
* Applies schema type transforms to `json`.
*
* @param {Document} self
* @param {Object} json
* @return {Object} `json`
*/(this,c,h),t.minimize&&(c=
/*!
* Minimizes an object, removing undefined values and empty objects
*
* @param {Object} object to minimize
* @return {Object}
*/
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&&(
/*!
* Avoid Node deprecation warning DEP0079
*/
nt.prototype[I.custom]=nt.prototype.inspect),nt.prototype.toString=function(){var t=this.inspect();return"string"==typeof t?t:I(t)},nt.prototype.equals=function(t){if(!t)return!1;var e=this.$__getValue("_id"),r=null!=t.$__?t.$__getValue("_id"):t;return e||r?e&&e.equals?e.equals(r):e===r:z(this,t)},nt.prototype.populate=function(){var t,e={},r=Array.prototype.slice.call(arguments);if(0!==r.length){"function"==typeof r[r.length-1]&&(t=r.pop());var n,o=q.populate.apply(null,r),s=i(o);try{for(s.s();!(n=s.n()).done;){var a=n.value;e[a.path]=a}}catch(t){s.e(t)}finally{s.f()}}var u=q.object.vals(e),h=this.constructor;if(this.$__isNested){h=this.$__[X].constructor;var f=this.$__.nestedPath;u.forEach((function(t){t.path=f+"."+t.path}))}if(null!=this.$session()){var c=this.$session();u.forEach((function(t){null!=t.options?"session"in t.options||(t.options.session=c):t.options={session:c}}))}return u.forEach((function(t){t._localModel=h})),h.populate(this,u,t)},nt.prototype.$getPopulatedDocs=function(){var t=[];null!=this.$__.populated&&(t=t.concat(Object.keys(this.$__.populated)));var e,r=[],n=i(t);try{for(n.s();!(e=n.n()).done;){var o=e.value,s=this.$get(o);Array.isArray(s)?r=r.concat(s):s instanceof nt&&r.push(s)}}catch(t){n.e(t)}finally{n.f()}return r},nt.prototype.populated=function(t,e,r){if(null==e||!0===e){if(!this.$__.populated)return;if("string"!=typeof t)return;var n=t.endsWith(".$*")?t.replace(/\.\$\*$/,""):t,i=this.$__.populated[n];return i?!0===e?i:i.value:void 0}this.$__.populated||(this.$__.populated={}),this.$__.populated[t]={value:e,options:r};for(var o=t.split("."),s=0;s<o.length-1;++s){var a=o.slice(0,s+1).join("."),u=this.$get(a);if(null!=u&&null!=u.$__&&this.$populated(a)){var h=o.slice(s+1).join(".");u.$populated(h,e,r);break}}return e},nt.prototype.$populated=nt.prototype.populated,nt.prototype.depopulate=function(t){var e;"string"==typeof t&&(t=-1===t.indexOf(" ")?[t]:t.split(" "));var r=this.$$populatedVirtuals?Object.keys(this.$$populatedVirtuals):[],n=k(this,"$__.populated",{});if(0===arguments.length){var o,s=i(r);try{for(s.s();!(o=s.n()).done;){var a=o.value;delete this.$$populatedVirtuals[a],delete this._doc[a],delete n[a]}}catch(t){s.e(t)}finally{s.f()}for(var u=Object.keys(n),h=0,f=u;h<f.length;h++){var c=f[h];(e=this.$populated(c))&&(delete n[c],q.setValue(c,e,this._doc))}return this}var l,d=i(t);try{for(d.s();!(l=d.n()).done;){var p=l.value;e=this.$populated(p),delete n[p],-1!==r.indexOf(p)?(delete this.$$populatedVirtuals[p],delete this._doc[p]):e&&q.setValue(p,e,this._doc)}}catch(t){d.e(t)}finally{d.f()}return this},nt.prototype.$__fullPath=function(t){return t||""},nt.prototype.getChanges=function(){var t=this.$__delta();return t?t[1]:{}},
/*!
* Module exports.
*/
nt.ValidationError=g,t.exports=nt},function(t,e,r){"use strict";function n(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function i(t,e,r){return e&&n(t.prototype,e),r&&n(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}var o=r(41),s=i((function t(e){if(function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),null==e)return this;Object.assign(this,o(e))})),a=r(16);Object.defineProperty(s.prototype,"type",a),Object.defineProperty(s.prototype,"validate",a),Object.defineProperty(s.prototype,"cast",a),Object.defineProperty(s.prototype,"required",a),Object.defineProperty(s.prototype,"default",a),Object.defineProperty(s.prototype,"ref",a),Object.defineProperty(s.prototype,"select",a),Object.defineProperty(s.prototype,"index",a),Object.defineProperty(s.prototype,"unique",a),Object.defineProperty(s.prototype,"immutable",a),Object.defineProperty(s.prototype,"sparse",a),Object.defineProperty(s.prototype,"text",a),Object.defineProperty(s.prototype,"transform",a),t.exports=s},function(t,e,r){"use strict";t.exports=Object.freeze({enumerable:!0,configurable:!0,writable:!0,value:void 0})},function(t,e,r){"use strict";var n=r(11),i=r(0);function o(t,e){return 55296==(64512&t.charCodeAt(e))&&(!(e<0||e+1>=t.length)&&56320==(64512&t.charCodeAt(e+1)))}function s(t){return(t>>>24|t>>>8&65280|t<<8&16711680|(255&t)<<24)>>>0}function a(t){return 1===t.length?"0"+t:t}function u(t){return 7===t.length?"0"+t:6===t.length?"00"+t:5===t.length?"000"+t:4===t.length?"0000"+t:3===t.length?"00000"+t:2===t.length?"000000"+t:1===t.length?"0000000"+t:t}e.inherits=i,e.toArray=function(t,e){if(Array.isArray(t))return t.slice();if(!t)return[];var r=[];if("string"==typeof t)if(e){if("hex"===e)for((t=t.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(t="0"+t),i=0;i<t.length;i+=2)r.push(parseInt(t[i]+t[i+1],16))}else for(var n=0,i=0;i<t.length;i++){var s=t.charCodeAt(i);s<128?r[n++]=s:s<2048?(r[n++]=s>>6|192,r[n++]=63&s|128):o(t,i)?(s=65536+((1023&s)<<10)+(1023&t.charCodeAt(++i)),r[n++]=s>>18|240,r[n++]=s>>12&63|128,r[n++]=s>>6&63|128,r[n++]=63&s|128):(r[n++]=s>>12|224,r[n++]=s>>6&63|128,r[n++]=63&s|128)}else for(i=0;i<t.length;i++)r[i]=0|t[i];return r},e.toHex=function(t){for(var e="",r=0;r<t.length;r++)e+=a(t[r].toString(16));return e},e.htonl=s,e.toHex32=function(t,e){for(var r="",n=0;n<t.length;n++){var i=t[n];"little"===e&&(i=s(i)),r+=u(i.toString(16))}return r},e.zero2=a,e.zero8=u,e.join32=function(t,e,r,i){var o=r-e;n(o%4==0);for(var s=new Array(o/4),a=0,u=e;a<s.length;a++,u+=4){var h;h="big"===i?t[u]<<24|t[u+1]<<16|t[u+2]<<8|t[u+3]:t[u+3]<<24|t[u+2]<<16|t[u+1]<<8|t[u],s[a]=h>>>0}return s},e.split32=function(t,e){for(var r=new Array(4*t.length),n=0,i=0;n<t.length;n++,i+=4){var o=t[n];"big"===e?(r[i]=o>>>24,r[i+1]=o>>>16&255,r[i+2]=o>>>8&255,r[i+3]=255&o):(r[i+3]=o>>>24,r[i+2]=o>>>16&255,r[i+1]=o>>>8&255,r[i]=255&o)}return r},e.rotr32=function(t,e){return t>>>e|t<<32-e},e.rotl32=function(t,e){return t<<e|t>>>32-e},e.sum32=function(t,e){return t+e>>>0},e.sum32_3=function(t,e,r){return t+e+r>>>0},e.sum32_4=function(t,e,r,n){return t+e+r+n>>>0},e.sum32_5=function(t,e,r,n,i){return t+e+r+n+i>>>0},e.sum64=function(t,e,r,n){var i=t[e],o=n+t[e+1]>>>0,s=(o<n?1:0)+r+i;t[e]=s>>>0,t[e+1]=o},e.sum64_hi=function(t,e,r,n){return(e+n>>>0<e?1:0)+t+r>>>0},e.sum64_lo=function(t,e,r,n){return e+n>>>0},e.sum64_4_hi=function(t,e,r,n,i,o,s,a){var u=0,h=e;return u+=(h=h+n>>>0)<e?1:0,u+=(h=h+o>>>0)<o?1:0,t+r+i+s+(u+=(h=h+a>>>0)<a?1:0)>>>0},e.sum64_4_lo=function(t,e,r,n,i,o,s,a){return e+n+o+a>>>0},e.sum64_5_hi=function(t,e,r,n,i,o,s,a,u,h){var f=0,c=e;return f+=(c=c+n>>>0)<e?1:0,f+=(c=c+o>>>0)<o?1:0,f+=(c=c+a>>>0)<a?1:0,t+r+i+s+u+(f+=(c=c+h>>>0)<h?1:0)>>>0},e.sum64_5_lo=function(t,e,r,n,i,o,s,a,u,h){return e+n+o+a+h>>>0},e.rotr64_hi=function(t,e,r){return(e<<32-r|t>>>r)>>>0},e.rotr64_lo=function(t,e,r){return(t<<32-r|e>>>r)>>>0},e.shr64_hi=function(t,e,r){return t>>>r},e.shr64_lo=function(t,e,r){return(t<<32-r|e>>>r)>>>0}},func
/*!
* Getter for convenience with populate, see gh-6115
*/
Object.defineProperty(n.prototype,"_id",{enumerable:!1,configurable:!0,get:function(){return this}}),
/*!
* Convenience `valueOf()` to allow comparing ObjectIds using double equals re: gh-7299
*/
n.prototype.hasOwnProperty("valueOf")||(n.prototype.valueOf=function(){return this.toString()}),n.prototype[i]=!0,t.exports=n},function(t,e,r){"use strict";
/*!
* ignore
*/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)}function i(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function s(t,e){if(e&&("object"===n(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function a(t){var e="function"==typeof Map?new Map:void 0;return(a=function(t){if(null===t||(r=t,-1===Function.toString.call(r).indexOf("[native code]")))return t;var r;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==e){if(e.has(t))return e.get(t);e.set(t,n)}function n(){return u(t,arguments,c(this).constructor)}return n.prototype=Object.create(t.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),f(n,t)})(t)}function u(t,e,r){return(u=h()?Reflect.construct:function(t,e,r){var n=[null];n.push.apply(n,e);var i=new(Function.bind.apply(t,n));return r&&f(i,r.prototype),i}).apply(null,arguments)}function h(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}function f(t,e){return(f=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function c(t){return(c=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var l=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&f(t,e)}(d,t);var e,r,n,a,u,l=(e=d,r=h(),function(){var t,n=c(e);if(r){var i=c(this).constructor;t=Reflect.construct(n,arguments,i)}else t=n.apply(this,arguments);return s(this,t)});function d(){return o(this,d),l.apply(this,arguments)}return n=d,a&&i(n.prototype,a),u&&i(n,u),Object.defineProperty(n,"prototype",{writable:!1}),n}(a(Error));Object.defineProperty(l.prototype,"name",{value:"MongooseError"}),t.exports=l},function(t,e,r){"use strict";
/*!
* Module dependencies.
*/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)}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function s(t,e){return(s=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function a(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=h(t);if(e){var i=h(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return u(this,r)}}function u(t,e){if(e&&("object"===n(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function h(t){return(h=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var f=r(19),c=r(6),l=r(9),d=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&s(t,e)}(f,t);var e,r,n,h=a(f);function f(t,e,r,n,o){var s;if(i(this,f),arguments.length>0){var a=p(e),c=y(e),l=m(o),d=b(null,t,a,r,l,c);(s=h.call(this,d)).init(t,e,r,n,o)}else s=h.call(this,b());return u(s)}return e=f,(r=[{key:"toJSON",value:function(){return{stringValue:this.stringValue,valueType:this.valueType,kind:this.kind,value:this.value,path:this.path,reason:this.reason,name:this.name,message:this.message}}
/*!
* ignore
*/},{key:"init",value:function(t,e,r,n,i){this.stringValue=p(e),this.messageFormat=m(i),this.kind=t,this.value=e,this.path=r,this.reason=n,this.valueType=y(e)}
/*!
* ignore
* @param {Readonly<CastError>} other
*/},{key:"copy",value:function(t){this.messageFormat=t.messageFormat,this.stringValue=t.stringValue,this.kind=t.kind,this.value=t.value,this.path=t.path,this.reason=t.reason,this.message=t.message,this.valueType=t.valueType}
/*!
* ignore
*/},{key:"setModel",value:function(t){this.model=t,this.message=b(t,this.kind,this.stringValue,this.path,this.messageFormat,this.valueType)}}])&&o(e.prototype,r),n&&o(e,n),Object.defineProperty(e,"prototype",{writable:!1}),f}(f);function p(t){var e=l.inspect(t);return(e=e.replace(/^'|'$/g,'"')).startsWith('"')||(e='"'+e+'"'),e}function y(t){if(null==t)return""+t;var e=n(t);return"object"!==e||"function"!=typeof t.constructor?e:t.constructor.name}function m(t){var e=c(t,"options.cast",null);if("string"==typeof e)return e}
/*!
* ignore
*/function b(t,e,r,n,i,o){if(null!=i){var s=i.replace("{KIND}",e).replace("{VALUE}",r).replace("{PATH}",n);return null!=t&&(s=s.replace("{MODEL}",t.modelName)),s}var a="Cast to "+e+" failed for value "+r+(o?" (type "+o+")":"")+' at path "'+n+'"';return null!=t&&(a+=' for model "'+t.modelName+'"'),a}
/*!
* exports
*/Object.defineProperty(d.prototype,"name",{value:"CastError"}),t.exports=d},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(234).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.proto
/*!
* If `val` is an object, returns constructor name, if possible. Otherwise returns undefined.
*/t.exports=function(t){if(null!=t&&"function"==typeof t.constructor)return t.constructor.name}},function(t,e,r){var n=r(2).Buffer,i=r(195).Transform,o=r(36).StringDecoder;function s(t){i.call(this),this.hashMode="string"==typeof t,this.hashMode?this[t]=this._finalOrDigest:this.final=this._finalOrDigest,this._final&&(this.__final=this._final,this._final=null),this._decoder=null,this._encoding=null}r(0)(s,i),s.prototype.update=function(t,e,r){"string"==typeof t&&(t=n.from(t,e));var i=this._update(t);return this.hashMode?this:(r&&(i=this._toString(i,r)),i)},s.prototype.setAutoPadding=function(){},s.prototype.getAuthTag=function(){throw new Error("trying to get auth tag in unsupported state")},s.prototype.setAuthTag=function(){throw new Error("trying to set auth tag in unsupported state")},s.prototype.setAAD=function(){throw new Error("trying to set aad in unsupported state")},s.prototype._transform=function(t,e,r){var n;try{this.hashMode?this._update(t):this.push(this._update(t))}catch(t){n=t}finally{r(n)}},s.prototype._flush=function(t){var e;try{this.push(this.__final())}catch(t){e=t}t(e)},s.prototype._finalOrDigest=function(t){var e=this.__final()||n.alloc(0);return t&&(e=this._toString(e,t,!0)),e},s.prototype._toString=function(t,e,r){if(this._decoder||(this._decoder=new o(e),this._encoding=e),this._encoding!==e)throw new Error("can't switch encodings");var n=this._decoder.write(t);return r&&(n+=this._decoder.end()),n},t.exports=s},function(t,e){t.exports=function(t){return t.webpackPolyfill||(t.deprecate=function(){},t.paths=[],t.children||(t.children=[]),Object.defineProperty(t,"loaded",{enumerable:!0,get:function(){return t.l}}),Object.defineProperty(t,"id",{enumerable:!0,get:function(){return t.i}}),t.webpackPolyfill=1),t}},function(t,e,r){"use strict";
/*!
* ignore
*/var n=null;t.exports.get=function(){return n},t.exports.set=function(t){n=t}},function(t,e,r){"use strict";var n=r(47),i=Object.keys||function(t){var e=[];for(var r in t)e.push(r);return e};t.exports=c;var o=Object.create(r(37));o.inherits=r(0);var s=r(105),a=r(65);o.inherits(c,s);for(var u=i(a.prototype),h=0;h<u.length;h++){var f=u[h];c.prototype[f]||(c.prototype[f]=a.prototype[f])}function c(t){if(!(this instanceof c))return new c(t);s.call(this,t),a.call(this,t),t&&!1===t.readable&&(this.readable=!1),t&&!1===t.writable&&(this.writable=!1),this.allowHalfOpen=!0,t&&!1===t.allowHalfOpen&&(this.allowHalfOpen=!1),this.once("end",l)}function l(){this.allowHalfOpen||this._writableState.ended||n.nextTick(d,this)}function d(t){t.end()}Object.defineProperty(c.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(c.prototype,"destroyed",{get:function(){return void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed&&this._writableState.destroyed)},set:function(t){void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed=t,this._writableState.destroyed=t)}}),c.prototype._destroy=function(t,e){this.push(null),this.end(),n.nextTick(e,t)}},function(t,e,r){"use strict";
/*!
* Module dependencies.
*/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(89),o=r(327),s=r(14),a=r(1).arrayAtomicsSymbol,u=r(1).arrayAtomicsBackupSymbol,h=r(1).arrayParentSymbol,f=r(1).arrayPathSymbol,c=r(1).arraySchemaSymbol,l=Array.prototype.push,d=/^\d+$/;
/*!
* Module exports.
*/
t.exports=function(t,e,r){var p,y=[],m=(n(p={},a,{}),n(p,u,void 0),n(p,f,e),n(p,c,void 0),n(p,h,void 0),p);if(Array.isArray(t)&&(t[f]===e&&t[h]===r&&(m[a]=Object.assign({},t[a])),t.forEach((function(t){l.call(y,t)}))),m[f]=e,m.__array=y,r&&r instanceof s)for(m[h]=r,m[c]=r.schema.path(e);null!=m[c]&&m[c].$isMongooseArray&&!m[c].$isMongooseDocumentArray;)m[c]=m[c].casterConstructor;var b=new Proxy(y,{get:function(t,e){return"isMongooseArray"===e||"isMongooseArrayProxy"===e||"isMongooseDocumentArray"===e||"isMongooseDocumentArrayProxy"===e||(m.hasOwnProperty(e)?m[e]:o.hasOwnProperty(e)?o[e]:i.hasOwnProperty(e)?i[e]:y[e])},set:function(t,e,r){return"string"==typeof e&&d.test(e)?o.set.call(b,e,r,!1):m.hasOwnProperty(e)?m[e]=r:y[e]=r,!0}});return b}},function(t,e,r){"use strict";(function(e,n){var i=r(2).Buffer,o=e.crypto||e.msCrypto;o&&o.getRandomValues?t.exports=function(t,e){if(t>4294967295)throw new RangeError("requested too many random bytes");var r=i.allocUnsafe(t);if(t>0)if(t>65536)for(var s=0;s<t;s+=65536)o.getRandomValues(r.slice(s,s+65536));else o.getRandomValues(r);if("function"==typeof e)return n.nextTick((function(){e(null,r)}));return r}:t.exports=function(){throw new Error("Secure random number generation is not supported by this browser.\nUse Chrome, Firefox or Internet Explorer 11")}}).call(this,r(7),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={};function o(t,e,r){r||(r=Error);var n=function(t){var r,n;function i(r,n,i){return t.call(this,function(t,r,n){return"string"==typeof e?e:e(t,r,n)}(r,n,i))||this}return n=t,(r=i).prototype=Object.create(n.prototype),r.prototype.constructor=r,r.__proto__=n,i}(r);n.prototype.name=r.name,n.prototype.code=t,i[t]=n}function s(t,e){if(Array.isArray(t)){var r=t.length;return t=t.map((function(t){return String(t)})),r>2?"one of ".concat(e," ").concat(t.slice(0,r-1).join(", "),", or ")+t[r-1]:2===r?"one of ".concat(e," ").concat(t[0]," or ").concat(t[1]):"of ".concat(e," ").concat(t[0])}return"of ".concat(e," ").concat(String(t))}o("ERR_INVALID_OPT_VALUE",(function(t,e){return'The value "'+e+'" is invalid for option "'+t+'"'}),TypeError),o("ERR_INVALID_ARG_TYPE",(function(t,e,r){var i,o,a,u;if("string"==typeof e&&(o="not ",e.substr(!a||a<0?0:+a,o.length)===o)?(i="must not be",e=e.replace(/^not /,"")):i="must be",function(t,e,r){return(void 0===r||r>t.length)&&(r=t.length),t.substring(r-e.length,r)===e}(t," argument"))u="The ".concat(t," ").concat(i," ").concat(s(e,"type"));else{var h=function(t,e,r){return"number"!=typeof r&&(r=0),!(r+e.length>t.length)&&-1!==t.indexOf(e,r)}(t,".")?"property":"argument";u='The "'.concat(t,'" ').concat(h," ").concat(i," ").concat(s(e,"type"))}return u+=". Received type ".concat(n(r))}),TypeError),o("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),o("ERR_METHOD_NOT_IMPLEMENTED",(function(t){return"The "+t+" method is not implemented"})),o("ERR_STREAM_PREMATURE_CLOSE","Premature close"),o("ERR_STREAM_DESTROYED",(function(t){return"Cannot call "+t+" after a stream was destroyed"})),o("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),o("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),o("ERR_STREAM_WRITE_AFTER_END","write after end"),o("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),o("ERR_UNKNOWN_ENCODING",(function(t){return"Unknown encoding: "+t}),TypeError),o("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),t.exports.codes=i},function(t,e,r){"use strict";(function(e){var n=Object.keys||function(t){var e=[];for(var r in t)e.push(r);return e};t.exports=h;var i=r(96),o=r(100);r(0)(h,i);for(var s=n(o.prototype),a=0;a<s.length;a++){var u=s[a];h.prototype[u]||(h.prototype[u]=o.prototype[u])}function h(t){if(!(this instanceof h))return new h(t);i.call(this,t),o.call(this,t),this.allowHalfOpen=!0,t&&(!1===t.readable&&(this.readable=!1),!1===t.writable&&(this.writ
/*!
* Determines if `arg` is an object.
*
* @param {Object|Array|String|Function|RegExp|any} arg
* @api private
* @return {Boolean}
*/
t.exports=function(t){return e.isBuffer(t)||"[object Object]"===Object.prototype.toString.call(t)}}).call(this,r(3).Buffer)},function(t,e,r){"use strict";
/*!
* ignore
*/e.internalToObjectOptions={transform:!1,virtuals:!1,getters:!1,_skipDepopulateTopLevel:!0,depopulate:!0,flattenDecimals:!1,useProjection:!1}},function(t,e,r){"use strict";var n=r(0),i=r(60),o=r(62),s=r(63),a=r(23);function u(t){a.call(this,"digest"),this._hash=t}n(u,a),u.prototype._update=function(t){this._hash.update(t)},u.prototype._final=function(){return this._hash.digest()},t.exports=function(t){return"md5"===(t=t.toLowerCase())?new i:"rmd160"===t||"ripemd160"===t?new o:new u(s(t))}},function(t,e,r){"use strict";var n=r(186).Buffer,i=n.isEncoding||function(t){switch((t=""+t)&&t.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function o(t){var e;switch(this.encoding=function(t){var e=function(t){if(!t)return"utf8";for(var e;;)switch(t){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return t;default:if(e)return;t=(""+t).toLowerCase(),e=!0}}(t);if("string"!=typeof e&&(n.isEncoding===i||!i(t)))throw new Error("Unknown encoding: "+t);return e||t}(t),this.encoding){case"utf16le":this.text=u,this.end=h,e=4;break;case"utf8":this.fillLast=a,e=4;break;case"base64":this.text=f,this.end=c,e=3;break;default:return this.write=l,void(this.end=d)}this.lastNeed=0,this.lastTotal=0,this.lastChar=n.allocUnsafe(e)}function s(t){return t<=127?0:t>>5==6?2:t>>4==14?3:t>>3==30?4:t>>6==2?-1:-2}function a(t){var e=this.lastTotal-this.lastNeed,r=function(t,e,r){if(128!=(192&e[0]))return t.lastNeed=0,"<EFBFBD>";if(t.lastNeed>1&&e.length>1){if(128!=(192&e[1]))return t.lastNeed=1,"<EFBFBD>";if(t.lastNeed>2&&e.length>2&&128!=(192&e[2]))return t.lastNeed=2,"<EFBFBD>"}}(this,t);return void 0!==r?r:this.lastNeed<=t.length?(t.copy(this.lastChar,e,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(t.copy(this.lastChar,e,0,t.length),void(this.lastNeed-=t.length))}function u(t,e){if((t.length-e)%2==0){var r=t.toString("utf16le",e);if(r){var n=r.charCodeAt(r.length-1);if(n>=55296&&n<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1],r.slice(0,-1)}return r}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=t[t.length-1],t.toString("utf16le",e,t.length-1)}function h(t){var e=t&&t.length?this.write(t):"";if(this.lastNeed){var r=this.lastTotal-this.lastNeed;return e+this.lastChar.toString("utf16le",0,r)}return e}function f(t,e){var r=(t.length-e)%3;return 0===r?t.toString("base64",e):(this.lastNeed=3-r,this.lastTotal=3,1===r?this.lastChar[0]=t[t.length-1]:(this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1]),t.toString("base64",e,t.length-r))}function c(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+this.lastChar.toString("base64",0,3-this.lastNeed):e}function l(t){return t.toString(this.encoding)}function d(t){return t&&t.length?this.write(t):""}e.StringDecoder=o,o.prototype.write=function(t){if(0===t.length)return"";var e,r;if(this.lastNeed){if(void 0===(e=this.fillLast(t)))return"";r=this.lastNeed,this.lastNeed=0}else r=0;return r<t.length?e?e+this.text(t,r):this.text(t,r):e||""},o.prototype.end=function(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+"<EFBFBD>":e},o.prototype.text=function(t,e){var r=function(t,e,r){var n=e.length-1;if(n<r)return 0;var i=s(e[n]);if(i>=0)return i>0&&(t.lastNeed=i-1),i;if(--n<r||-2===i)return 0;if((i=s(e[n]))>=0)return i>0&&(t.lastNeed=i-2),i;if(--n<r||-2===i)return 0;if((i=s(e[n]))>=0)return i>0&&(2===i?i=0:t.lastNeed=i-3),i;return 0}(this,t,e);if(!this.lastNeed)return t.toString("utf8",e);this.lastTotal=r;var n=t.length-(r-this.lastNeed);return t.copy(this.lastChar,0,n),t.toString("utf8",e,n)},o.prototype.fillLast=function(t){if(this.lastNeed<=t.length)return t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,t.length),this.lastNeed-=t.len
/*!
* Object clone with Mongoose natives support.
*
* If options.minimize is true, creates a minimal data object. Empty objects and undefined values will not be cloned. This makes the data payload sent to MongoDB as small as possible.
*
* Functions are never cloned.
*
* @param {Object} obj the object to clone
* @param {Object} options
* @param {Boolean} isArrayChild true if cloning immediately underneath an array. Special case for minimize.
* @return {Object} the cloned object
* @api private
*/
function p(t,e,r){if(null==t)return t;if(Array.isArray(t))return function(t,e){var r=0,n=t.length,i=new Array(n);for(r=0;r<n;++r)i[r]=p(t[r],e,!0);return i}(d.isMongooseArray(t)?t.__array:t,e);if(a(t))return e&&e._skipSingleNestedGetters&&t.$isSingleNested&&(e=Object.assign({},e,{getters:!1})),d.isPOJO(t)&&null!=t.$__&&null!=t._doc?t._doc:e&&e.json&&"function"==typeof t.toJSON?t.toJSON(e):t.toObject(e);var s=t.constructor;if(s)switch(u(s)){case"Object":return y(t,e,r);case"Date":return new s(+t);case"RegExp":return function(t){var e=new RegExp(t.source,t.flags);e.lastIndex!==t.lastIndex&&(e.lastIndex=t.lastIndex);return e}(t)}return t instanceof o?new o(t.id):h(t,"Decimal128")?e&&e.flattenDecimals?t.toJSON():i.fromString(t.toString()):!s&&f(t)?y(t,e,r):"object"===n(t)&&t[c.schemaTypeSymbol]?t.clone():e&&e.bson&&"function"==typeof t.toBSON?t:"function"==typeof t.valueOf?t.valueOf():y(t,e,r)}
/*!
* ignore
*/
function y(t,e,r){var n,i=e&&e.minimize,o={};l in t&&(o[l]=t[l]);var a=0,u="",h=Object.keys(t),f=h.length;for(a=0;a<f;++a)if(!s.has(u=h[a])){var c=p(t[u],e,!1);!1===i&&void 0===c?delete o[u]:!0===i&&void 0===c||(n||(n=!0),o[u]=c)}return i&&!r?n&&o:o}t.exports=p},function(t,e,r){"use strict";(function(e){
/*!
* Centralize this so we can more easily work around issues with people
* stubbing out `process.nextTick()` in tests using sinon:
* https://github.com/sinonjs/lolex#automatically-incrementing-mocked-time
* See gh-6074
*/
var r=e.nextTick.bind(e);t.exports=function(t){return r(t)}}).call(this,r(5))},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=r(281);
/*!
* The buffer module from node.js, for the browser.
*
* @author Feross Aboukhadijeh <feross@feross.org> <http://feross.org>
* @license MIT
*/function o(t,e){if(t===e)return 0;for(var r=t.length,n=e.length,i=0,o=Math.min(r,n);i<o;++i)if(t[i]!==e[i]){r=t[i],n=e[i];break}return r<n?-1:n<r?1:0}function s(t){return e.Buffer&&"function"==typeof e.Buffer.isBuffer?e.Buffer.isBuffer(t):!(null==t||!t._isBuffer)}var a=r(9),u=Object.prototype.hasOwnProperty,h=Array.prototype.slice,f="foo"===function(){}.name;function c(t){return Object.prototype.toString.call(t)}function l(t){return!s(t)&&("function"==typeof e.ArrayBuffer&&("function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(t):!!t&&(t instanceof DataView||!!(t.buffer&&t.buffer instanceof ArrayBuffer))))}var d=t.exports=g,p=/\s*function\s+([^\(\s]*)\s*/;function y(t){if(a.isFunction(t)){if(f)return t.name;var e=t.toString().match(p);return e&&e[1]}}function m(t,e){return"string"==typeof t?t.length<e?t:t.slice(0,e):t}function b(t){if(f||!a.isFunction(t))return a.inspect(t);var e=y(t);return"[Function"+(e?": "+e:"")+"]"}function v(t,e,r,n,i){throw new d.AssertionError({message:r,actual:t,expected:e,operator:n,stackStartFunction:i})}function g(t,e){t||v(t,!0,e,"==",d.ok)}function w(t,e,r,i){if(t===e)return!0;if(s(t)&&s(e))return 0===o(t,e);if(a.isDate(t)&&a.isDate(e))return t.getTime()===e.getTime();if(a.isRegExp(t)&&a.isRegExp(e))return t.source===e.source&&t.global===e.global&&t.multiline===e.multiline&&t.lastIndex===e.lastIndex&&t.ignoreCase===e.ignoreCase;if(null!==t&&"object"===n(t)||null!==e&&"object"===n(e)){if(l(t)&&l(e)&&c(t)===c(e)&&!(t instanceof Float32Array||t instanceof Float64Array))return 0===o(new Uint8Array(t.buffer),new Uint8Array(e.buffer));if(s(t)!==s(e))return!1;var u=(i=i||{actual:[],expected:[]}).actual.indexOf(t);return-1!==u&&u===i.expected.indexOf(e)||(i.actual.push(t),i.expected.push(e),function(t,e,r,n){if(null==t||null==e)return!1;if(a.isPrimitive(t)||a.isPrimitive(e))return t===e;if(r&&Object.getPrototypeOf(t)!==Object.getPrototypeOf(e))return!1;var i=_(t),o=_(e);if(i&&!o||!i&&o)return!1;if(i)return t=h.call(t),e=h.call(e),w(t,e,r);var s,u,f=O(t),c=O(e);if(f.length!==c.length)return!1;for(f.sort(),c.sort(),u=f.length-1;u>=0;u--)if(f[u]!==c[u])return!1;for(u=f.length-1;u>=0;u--)if(s=f[u],!w(t[s],e[s],r,n))return!1;return!0}(t,e,r,i))}return r?t===e:t==e}function _(t){return"[object Arguments]"==Object.prototype.toString.call(t)}function M(t,e){if(!t||!e)return!1;if("[object RegExp]"==Object.prototype.toString.call(e))return e.test(t);try{if(t instanceof e)return!0}catch(t){}return!Error.isPrototypeOf(e)&&!0===e.call({},t)}function S(t,e,r,n){var i;if("function"!=typeof e)throw new TypeError('"block" argument must be a function');"string"==typeof r&&(n=r,r=null),i=function(t){var e;try{t()}catch(t){e=t}return e}(e),n=(r&&r.name?" ("+r.name+").":".")+(n?" "+n:"."),t&&!i&&v(i,r,"Missing expected exception"+n);var o="string"==typeof n,s=!t&&i&&!r;if((!t&&a.isError(i)&&o&&M(i,r)||s)&&v(i,r,"Got unwanted exception"+n),t&&i&&r&&!M(i,r)||!t&&i)throw i}d.AssertionError=function(t){this.name="AssertionError",this.actual=t.actual,this.expected=t.expected,this.operator=t.operator,t.message?(this.message=t.message,this.generatedMessage=!1):(this.message=function(t){return m(b(t.actual),128)+" "+t.operator+" "+m(b(t.expected),128)}(this),this.generatedMessage=!0);var e=t.stackStartFunction||v;if(Error.captureStackTrace)Error.captureStackTrace(this,e);else{var r=new Error;if(r.stack){var n=r.stack,i=y(e),o=n.indexOf("\n"+i);if(o>=0){var s=n.indexOf("\n",o+1);n=n.substring(s+1)}this.stack=n}}},a.inherits(d.AssertionError,Error),d.fail=v,d.ok=g,d.equal=function(t,e,r){t!=e&&v(t,e,r,"==",d.equal)},d.notEqual=function(t,e,r){t==e&&v(t,e,r,"!=",d.notEqual)},d.deepEqual=function(t,e,r){w(t,e,!1)||v(t,e,r,"deepEqual",d.deepEqual)},d.deepStrictEqual=function(t,e,r){w(t,e,!0)||v(t,e,r,"deepStrictEqual",d.deepStrictEqual)},d.notDeepEqual=function(t,e,r){w(t,e,!1)&&v(t,e,r,"notDeepEqual",d.notDeepEqual)},d.notDeepStrictEqual=function t(e,r,n){w(e,r,!0)&&v(e,r,n,"notDeepStrictEqual",t)},d.strictEqual=function(t,e,r){t!==e&&v(t,e,r,"===",d.strictEqual)},d.notStrictEqual=function(t,e,r){t===e&&v(t,e,r,"!==",d.notS
/*!
* Module dependencies.
*/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)}function i(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function o(t,e){return(o=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function s(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=u(t);if(e){var i=u(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return a(this,r)}}function a(t,e){if(e&&("object"===n(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function u(t){return(u=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var h=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&o(t,e)}(u,t);var e,r,n,a=s(u);function u(t,e,r){var n;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,u),e=e||"Field `"+t+"` is not in schema and strict mode is set to throw.",(n=a.call(this,e)).isImmutableError=!!r,n.path=t,n}return e=u,r&&i(e.prototype,r),n&&i(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}(r(8));Object.defineProperty(h.prototype,"name",{value:"StrictModeError"}),t.exports=h},function(t,e,r){"use strict";
/*!
* Module dependencies.
*/var n=r(10),i=r(55),o=r(33),s=r(4);function a(t,e){if(e&&e.default){var r=e.default;Array.isArray(r)&&0===r.length?e.default=Array:!e.shared&&o(r)&&0===Object.keys(r).length&&(e.default=function(){return{}})}n.call(this,t,e,"Mixed"),this[i.schemaMixedSymbol]=!0}a.schemaName="Mixed",a.defaultOptions={},
/*!
* Inherits from SchemaType.
*/
a.prototype=Object.create(n.prototype),a.prototype.constructor=a,a.get=n.get,a.set=n.set,a.prototype.cast=function(t){return t instanceof Error?s.errorToPOJO(t):t},a.prototype.castForQuery=function(t,e){return 2===arguments.length?e:t},
/*!
* Module exports.
*/
t.exports=a},function(t,e,r){"use strict";
/*!
* Module dependencies.
*/var n=r(13).EventEmitter,i=r(90),o=r(4),s=r(1).documentArrayParent;
/*!
* A constructor.
*
* @param {Object} obj js object returned from the db
* @param {MongooseDocumentArray} parentArr the parent array of this document
* @param {Boolean} skipId
* @inherits Document
* @api private
*/
function a(t,e,r,n,a){o.isMongooseDocumentArray(e)?(this.__parentArray=e,this[s]=e.$parent()):(this.__parentArray=void 0,this[s]=void 0),this.$setIndex(a),this.$__parent=this[s],i.call(this,t,n,this[s],void 0,{isNew:!0})}
/*!
* Inherit from Subdocument
*/for(var u in a.prototype=Object.create(i.prototype),a.prototype.constructor=a,Object.defineProperty(a.prototype,"$isSingleNested",{configurable:!1,writable:!1,value:!1}),Object.defineProperty(a.prototype,"$isDocumentArrayElement",{configurable:!1,writable:!1,value:!0}),n.prototype)a[u]=n.prototype[u];
/*!
* ignore
*/a.prototype.$setIndex=function(t){if(this.__index=t,null!=this.$__&&null!=this.$__.validationError)for(var e=0,r=Object.keys(this.$__.validationError.errors);e<r.length;e++){var n=r[e];this.invalidate(n,this.$__.validationError.errors[n])}},
/*!
* ignore
*/
a.prototype.populate=function(){throw new Error('Mongoose does not support calling populate() on nested docs. Instead of `doc.arr[0].populate("path")`, use `doc.populate("arr.0.path")`')},
/*!
* ignore
*/
a.prototype.$__removeFromParent=function(){var t=this._doc._id;if(!t)throw new Error("For your own good, Mongoose does not know how to remove an ArraySubdocument that has no _id");this.__parentArray.pull({_id:t})},a.prototype.$__fullPath=function(t,e){return null==this.__index?null:(this.$__.fullPath||this.ownerDocument(),e?t?this.$__.fullPath+"."+t:this.$__.fullPath:t?this.$__.fullPath+"."+this.__index+"."+t:this.$__.fullPath+"."+this.__index)},
/*!
* Given a path relative to this document, return the path relative
* to the top-level document.
*/
a.prototype.$__pathRelativeToParent=function(t,e){return null==this.__index?null:e?null==t?this.__parentArray.$path():this.__parentArray.$path()+"."+t:null==t?this.__parentArray.$path()+"."+this.__index:this.__parentArray.$path()+"."+this.__index+"."+t},
/*!
* Returns this sub-documents parent document.
*/
a.prototype.$parent=function(){return this[s]},a.prototype.parentArray=function(){return this.__parentArray},
/*!
* Module exports.
*/
t.exports=a},function(t,e,r){"use strict";(function(e){void 0===e||!e.version||0===e.version.indexOf("v0.")||0===e.version.indexOf("v1.")&&0!==e.version.indexOf("v1.8.")?t.exports={nextTick:function(t,r,n,i){if("function"!=typeof t)throw new TypeError('"callback" argument must be a function');var o,s,a=arguments.length;switch(a){case 0:case 1:return e.nextTick(t);case 2:return e.nextTick((function(){t.call(null,r)}));case 3:return e.nextTick((function(){t.call(null,r,n)}));case 4:return e.nextTick((function(){t.call(null,r,n,i)}));default:for(o=new Array(a-1),s=0;s<o.length;)o[s++]=arguments[s];return e.nextTick((function(){t.apply(null,o)}))}}}:t.exports=e}).call(this,r(5))},function(t,e,r){var n=r(2).Buffer;function i(t){n.isBuffer(t)||(t=n.from(t));for(var e=t.length/4|0,r=new Array(e),i=0;i<e;i++)r[i]=t.readUInt32BE(4*i);return r}function o(t){for(;0<t.length;t++)t[0]=0}function s(t,e,r,n,i){for(var o,s,a,u,h=r[0],f=r[1],c=r[2],l=r[3],d=t[0]^e[0],p=t[1]^e[1],y=t[2]^e[2],m=t[3]^e[3],b=4,v=1;v<i;v++)o=h[d>>>24]^f[p>>>16&255]^c[y>>>8&255]^l[255&m]^e[b++],s=h[p>>>24]^f[y>>>16&255]^c[m>>>8&255]^l[255&d]^e[b++],a=h[y>>>24]^f[m>>>16&255]^c[d>>>8&255]^l[255&p]^e[b++],u=h[m>>>24]^f[d>>>16&255]^c[p>>>8&255]^l[255&y]^e[b++],d=o,p=s,y=a,m=u;return o=(n[d>>>24]<<24|n[p>>>16&255]<<16|n[y>>>8&255]<<8|n[255&m])^e[b++],s=(n[p>>>24]<<24|n[y>>>16&255]<<16|n[m>>>8&255]<<8|n[255&d])^e[b++],a=(n[y>>>24]<<24|n[m>>>16&255]<<16|n[d>>>8&255]<<8|n[255&p])^e[b++],u=(n[m>>>24]<<24|n[d>>>16&255]<<16|n[p>>>8&255]<<8|n[255&y])^e[b++],[o>>>=0,s>>>=0,a>>>=0,u>>>=0]}var a=[0,1,2,4,8,16,32,64,128,27,54],u=function(){for(var t=new Array(256),e=0;e<256;e++)t[e]=e<128?e<<1:e<<1^283;for(var r=[],n=[],i=[[],[],[],[]],o=[[],[],[],[]],s=0,a=0,u=0;u<256;++u){var h=a^a<<1^a<<2^a<<3^a<<4;h=h>>>8^255&h^99,r[s]=h,n[h]=s;var f=t[s],c=t[f],l=t[c],d=257*t[h]^16843008*h;i[0][s]=d<<24|d>>>8,i[1][s]=d<<16|d>>>16,i[2][s]=d<<8|d>>>24,i[3][s]=d,d=16843009*l^65537*c^257*f^16843008*s,o[0][h]=d<<24|d>>>8,o[1][h]=d<<16|d>>>16,o[2][h]=d<<8|d>>>24,o[3][h]=d,0===s?s=a=1:(s=f^t[t[t[l^f]]],a^=t[t[a]])}return{SBOX:r,INV_SBOX:n,SUB_MIX:i,INV_SUB_MIX:o}}();function h(t){this._key=i(t),this._reset()}h.blockSize=16,h.keySize=32,h.prototype.blockSize=h.blockSize,h.prototype.keySize=h.keySize,h.prototype._reset=function(){for(var t=this._key,e=t.length,r=e+6,n=4*(r+1),i=[],o=0;o<e;o++)i[o]=t[o];for(o=e;o<n;o++){var s=i[o-1];o%e==0?(s=s<<8|s>>>24,s=u.SBOX[s>>>24]<<24|u.SBOX[s>>>16&255]<<16|u.SBOX[s>>>8&255]<<8|u.SBOX[255&s],s^=a[o/e|0]<<24):e>6&&o%e==4&&(s=u.SBOX[s>>>24]<<24|u.SBOX[s>>>16&255]<<16|u.SBOX[s>>>8&255]<<8|u.SBOX[255&s]),i[o]=i[o-e]^s}for(var h=[],f=0;f<n;f++){var c=n-f,l=i[c-(f%4?0:4)];h[f]=f<4||c<=4?l:u.INV_SUB_MIX[0][u.SBOX[l>>>24]]^u.INV_SUB_MIX[1][u.SBOX[l>>>16&255]]^u.INV_SUB_MIX[2][u.SBOX[l>>>8&255]]^u.INV_SUB_MIX[3][u.SBOX[255&l]]}this._nRounds=r,this._keySchedule=i,this._invKeySchedule=h},h.prototype.encryptBlockRaw=function(t){return s(t=i(t),this._keySchedule,u.SUB_MIX,u.SBOX,this._nRounds)},h.prototype.encryptBlock=function(t){var e=this.encryptBlockRaw(t),r=n.allocUnsafe(16);return r.writeUInt32BE(e[0],0),r.writeUInt32BE(e[1],4),r.writeUInt32BE(e[2],8),r.writeUInt32BE(e[3],12),r},h.prototype.decryptBlock=function(t){var e=(t=i(t))[1];t[1]=t[3],t[3]=e;var r=s(t,this._invKeySchedule,u.INV_SUB_MIX,u.INV_SBOX,this._nRounds),o=n.allocUnsafe(16);return o.writeUInt32BE(r[0],0),o.writeUInt32BE(r[3],4),o.writeUInt32BE(r[2],8),o.writeUInt32BE(r[1],12),o},h.prototype.scrub=function(){o(this._keySchedule),o(this._invKeySchedule),o(this._key)},t.exports.AES=h},function(t,e,r){var n=r(2).Buffer,i=r(60);t.exports=function(t,e,r,o){if(n.isBuffer(t)||(t=n.from(t,"binary")),e&&(n.isBuffer(e)||(e=n.from(e,"binary")),8!==e.length))throw new RangeError("salt should be Buffer with 8 byte length");for(var s=r/8,a=n.alloc(s),u=n.alloc(o||0),h=n.alloc(0);s>0||o>0;){var f=new i;f.update(h),f.update(t),e&&f.update(e),h=f.digest();var c=0;if(s>0){var l=a.length-s;c=Math.min(s,h.length),h.copy(a,l,0,c),s-=c}if(c<h.length&&o>0){var d=u.length-o,p=Math.min(o,h.length-c);h.copy(u,d,c,c+p),o-=p}}
/*!
* Returns if `v` is a mongoose object that has a `toObject()` method we can use.
*
* This is for compatibility with libs like Date.js which do foolish things to Natives.
*
* @param {any} v
* @api private
*/t.exports=function(t){return null!=t&&(n(t)||null!=t.$__||t.isMongooseBuffer||t.$isMongooseMap)}},function(t,e,r){"use strict";var n=r(148),i=r(42),o=Symbol("mongoose:emitted");t.exports=function(t,e,r,s){return"function"==typeof t?e((function(e){if(null==e)t.apply(this,arguments);else{null!=r&&null!=r.listeners&&r.listeners("error").length>0&&!e[o]&&(e[o]=!0,r.emit("error",e));try{t(e)}catch(e){return i((function(){throw e}))}}})):new(s=s||n.get())((function(t,n){e((function(e,i){return null!=e?(null!=r&&null!=r.listeners&&r.listeners("error").length>0&&!e[o]&&(e[o]=!0,r.emit("error",e)),n(e)):arguments.length>2?t(Array.prototype.slice.call(arguments,1)):void t(i)}))}))}},function(t,e,r){"use strict";var n=["find","findOne","update","updateMany","updateOne","replaceOne","remove","count","distinct","findOneAndDelete","findOneAndUpdate","aggregate","findCursor","deleteOne","deleteMany"];function i(){}for(var o=0,s=n.length;o<s;++o){var a=n[o];i.prototype[a]=u(a)}function u(t){return function(){throw new Error("collection."+t+" not implemented")}}t.exports=i,i.methods=n},function(t,e,r){"use strict";e.schemaMixedSymbol=Symbol.for("mongoose:schema_mixed"),e.builtInMiddleware=Symbol.for("mongoose:built-in-middleware")},function(t,e,r){"use strict";
/*!
* Module requirements.
*/var n=r(159);
/*!
* @ignore
*/
/*!
* @ignore
*/
function i(t){return n.cast()(t)}e.castToNumber=i,e.castArraysOfNumbers=function t(e,r){e.forEach((function(n,o){Array.isArray(n)?t(n,r):e[o]=i.call(r,n)}))}},function(t,e,r){"use strict";var n=r(163);
/*!
* returns discriminator by discriminatorMapping.value
*
* @param {Model} model
* @param {string} value
*/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";
/*!
* Module exports.
*/e.Array=r(166),e.Buffer=r(168),e.Document=e.Embedded=r(46),e.DocumentArray=r(27),e.Decimal128=r(32),e.ObjectId=r(18),e.Map=r(170),e.Subdocument=r(90)},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 Wt})),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 Zt})),r.d(e,"BSON_DATA_DECIMAL128",(function(){return te})),r.d(e,"BSON_DATA_INT",(function(){return Qt})),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 Gt})),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 Pt})),r.d(e,"BSON_INT64_MAX",(function(){return Rt})),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 W})),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 G})),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 Qe})),r.d(e,"deserialize",(function(){return Ye})),r.d(e,"deserializeStream",(function(){return Ge})),r.d(e,"serialize",(function(){return We})),r.d(e,"serializeWithBufferAndIndex",(function(){return Je})),r.d(e,"setInternalBufferSize",(function(){return Ze}));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]+
/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */v.SlowBuffer,v.INSPECT_MAX_BYTES,v.kMaxLength;
/*! *****************************************************************************
Copyright (c) Microsoft Corporation.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */
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(181).randomBytes}catch(t){}return n||k}();function $(t){return["[object ArrayBuffer]","[object SharedArrayBuffer]"].includes(Object.prototype.toString.call(t))}function P(t){return"[object Uint8Array]"===Object.prototype.toString.call(t)}function R(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-x
/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
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){(function(e){var n=r(72),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(),y=d.isub(p).imul(f).umod(c).imul(l);return p.iadd(y).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(232).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
/*!
* ignore
*/t.exports=function(t){var e=null!=this?this.path:null;return n(t,e)}},function(t,e,r){"use strict";var n=r(20);
/*!
* Given a value, cast it to a boolean, or throw a `CastError` if the value
* cannot be casted. `null` and `undefined` are considered valid.
*
* @param {Any} value
* @param {String} [path] optional the path to set on the CastError
* @return {Boolean|null|undefined}
* @throws {CastError} if `value` is not one of the allowed values
* @api private
*/t.exports=function(e,r){if(t.exports.convertToTrue.has(e))return!0;if(t.exports.convertToFalse.has(e))return!1;if(null==e)return e;throw new n("boolean",e,r)},t.exports.convertToTrue=new Set([!0,"true",1,"1","yes"]),t.exports.convertToFalse=new Set([!1,"false",0,"0","no"])},function(t,e,r){"use strict";(function(n){
/*!
* Module dependencies.
*/
function i(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function o(t){return(o="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 s(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 a(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 a(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 o,s=!0,u=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return s=t.done,t},e:function(t){u=!0,o=t},f:function(){try{s||null==r.return||r.return()}finally{if(u)throw o}}}}function a(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 u,h=r(13).EventEmitter,f=r(306),c=r(19),l=r(10),d=r(15),p=r(307),y=r(86),m=r(155),b=r(6),v=r(22),g=r(308),w=r(309),_=r(150),M=r(81),S=r(25).get().ReadPreference,O=r(310),A=r(4),E=r(314),x=r(315).middlewareFunctions,k=r(157).middlewareFunctions,j=x.concat(k).reduce((function(t,e){return t.add(e)}),new Set),$=A.isPOJO,P=0;function R(t,e){if(!(this instanceof R))return new R(t,e);if(this.obj=t,this.paths={},this.aliases={},this.subpaths={},this.virtuals={},this.singleNestedPaths={},this.nested={},this.inherits={},this.callQueue=[],this._indexes=[],this.methods={},this.methodOptions={},this.statics={},this.tree={},this.query={},this.childSchemas=[],this.plugins=[],this.$id=++P,this.mapPaths=[],this.s={hooks:new f},this.options=this.defaultOptions(e),Array.isArray(t)){var r,n=s(t);try{for(n.s();!(r=n.n()).done;){var i=r.value;this.add(i)}}catch(t){n.e(t)}finally{n.f()}}else t&&this.add(t);var o=t&&t._id&&A.isObject(t._id);!this.paths._id&&this.options._id&&!o&&m(this),this.setupTimestamp(this.options.timestamps)}
/*!
* Create virtual properties with alias field
*/
/*!
* Inherit from EventEmitter.
*/
R.prototype=Object.create(h.prototype),R.prototype.constructor=R,R.prototype.instanceOfSchema=!0,
/*!
* ignore
*/
Object.defineProperty(R.prototype,"$schemaType",{configurable:!1,enumerable:!1,writable:!0}),Object.defineProperty(R.prototype,"childSchemas",{configurable:!1,enumerable:!0,writable:!0}),Object.defineProperty(R.prototype,"virtuals",{configurable:!1,enumerable:!0,writable:!0}),R.prototype.obj,R.prototype.paths,R.prototype.tree,R.prototype.clone=function(){var t=this,e=this._clone();return e.on("init",(function(e){return t.emit("init",e)})),e},R.prototype._clone=function(t){var e=new(t=t||(null==this.base?R:this.base.Schema))({},this._userProvidedOptions);return e.base=this.base,e.obj=this.obj,e.options=A.clone(this.options),e.callQueue=this.callQueue.map((function(t){return t})),e.methods=A.clone(this.methods),e.methodOptions=A.clone(this.methodOptions),e.statics=A.clone(this.statics),e.query=A.clone(this.query),e.plugins=Array.prototype.slice.call(this.plugins),e._indexes=A.clone(this._indexes),e.s.hooks=this.s.hooks.clone(),e.tree=A.clone(this.tree),e.paths=A.clone(this.paths),e.nested=A.clone(this.nested),e.subpaths=A.clone(this.subpaths),e.singleNestedPaths=A.clone(this.singleNestedPaths),e.childSchemas=
/*!
* ignore
*/
function(t){for(var e=[],r=0,n=Object.keys(t.paths);r<n.length;r++){var i=n[r],o=t.paths[i];(o.$isMongooseDocumentArray||o.$isSingleNested)&&e.push({schema:o.schema,model:o.caster})}return e}
/*!
* ignore
*/(e),e.virtuals=A.clone(this.virtuals),e.$globalPluginsApplied=this.$globalPluginsApplied,e.$isRootDiscriminator=this.$isRootDiscriminator,e.$implicitlyCreated=this.$implicitlyCreated,e.$id=++P,e.$originalSchemaId=this.$id,e.mapPaths=[].concat(this.mapPaths),null!=this.discriminatorMapping&&(e.discriminatorMapping=Object.assign({},this.discriminatorMapping)),null!=this.discriminators&&(e.discriminators=Object.assign({},this.discriminators)),e.aliases=Object.assign({},this.aliases),e},R.prototype.pick=function(t,e){var r=new R({},e||this.options);if(!Array.isArray(t))throw new c('Schema#pick() only accepts an array argument, got "'+o(t)+'"');var n,a=s(t);try{for(a.s();!(n=a.n()).done;){var u=n.value;if(this.nested[u])r.add(i({},u,b(this.tree,u)));else{var h=this.path(u);if(null==h)throw new c("Path `"+u+"` is not in the schema");r.add(i({},u,h))}}}catch(t){a.e(t)}finally{a.f()}return r},R.prototype.defaultOptions=function(t){this._userProvidedOptions=null==t?{}:A.clone(t);var e=b(this,"base.options",{}),r=!("strict"in e)||e.strict;if((t=A.options({strict:r,strictQuery:"strict"in this._userProvidedOptions?this._userProvidedOptions.strict:"strictQuery"in e?e.strictQuery:r,bufferCommands:!0,capped:!1,versionKey:"__v",optimisticConcurrency:!1,minimize:!0,autoIndex:null,discriminatorKey:"__t",shardKey:null,read:null,validateBeforeSave:!0,_id:!0,id:!0,typeKey:"type"},A.clone(t))).read&&(t.read=S(t.read)),t.versionKey&&"string"!=typeof t.versionKey)throw new c("`versionKey` must be falsy or string, got `"+o(t.versionKey)+"`");if(t.optimisticConcurrency&&!t.versionKey)throw new c("Must set `versionKey` if using `optimisticConcurrency`");return t},R.prototype.add=function(t,e){if(t instanceof R||null!=t&&t.instanceOfSchema)return _(this,t),this;if(!1===t._id&&null==e&&(this.options._id=!1),"__proto__."===(e=e||"")||"constructor."===e||"prototype."===e)return this;for(var r=Object.keys(t),n=this.options.typeKey,i=0,o=r;i<o.length;i++){var a=o[i],u=e+a,h=t[a];if(null==h)throw new TypeError("Invalid value for schema path `"+u+'`, got value "'+h+'"');if("_id"!==a||!1!==h)if(h instanceof y||"VirtualType"===b(h,"constructor.name",null))this.virtual(h);else{if(Array.isArray(h)&&1===h.length&&null==h[0])throw new TypeError("Invalid value for schema Array path `"+u+'`, got value "'+h[0]+'"');if($(h)||h instanceof d)if(Object.keys(h).length<1)e&&(this.nested[e.substring(0,e.length-1)]=!0),this.path(u,h);else if(!h[n]||"type"===n&&$(h.type)&&h.type.type)this.nested[u]=!0,this.add(h,u+".");else{var f=h[n];if($(f)&&Object.keys(f).length>0){e&&(this.nested[e.substring(0,e.length-1)]=!0);var c=new R(f),l=Object.assign({},h,{type:c});this.path(e+a,l)}else e&&(this.nested[e.substring(0,e.length-1)]=!0),this.path(e+a,h)}else e&&(this.nested[e.substring(0,e.length-1)]=!0),this.path(e+a,h)}}return function(t,e){var r,n=s(e=e||Object.keys(t.paths));try{for(n.s();!(r=n.n()).done;){var i=r.value,o=b(t.paths[i],"options");if(null!=o){var a=t.paths[i].path,u=o.alias;if(u){if("string"!=typeof u)throw new Error("Invalid value for alias option on "+a+", got "+u);t.aliases[u]=a,t.virtual(u).get(function(t){return function(){return"function"==typeof this.get?this.get(t):this[t]}}(a)).set(function(t){return function(e){return this.$set(t,e)}}(a))}}}}catch(t){n.e(t)}finally{n.f()}}(this,Object.keys(t).map((function(t){return e?e+t:t}))),this},R.reserved=Object.create(null),R.prototype.reserved=R.reserved;var B=R.reserved;
/*!
* ignore
*/
function T(t){return/\.\d+/.test(t)?t.replace(/\.\d+\./g,".$.").replace(/\.\d+$/,".$"):t}
/*!
* ignore
*/function I(t,e){if(0===t.mapPaths.length)return null;var r,n=s(t.mapPaths);try{for(n.s();!(r=n.n()).done;){var i=r.value.path;if(new RegExp("^"+i.replace(/\.\$\*/g,"\\.[^.]+")+"$").test(e))return t.paths[i]}}catch(t){n.e(t)}finally{n.f()}return null}
/*!
* ignore. Deprecated re: #6405
*/
function N(t,e){var r=e.split(/\.(\d+)\.|\.(\d+)$/).filter(Boolean);if(r.length<2)return t.paths.hasOwnProperty(r[0])?t.paths[r[0]]:"adhocOrUndefined";var n=t.path(r[0]),i=!1;if(!n)return"adhocOrUndefined";for(var o=r.length-1,s=1;s<r.length;++s){i=!1;var a=r[s];if(s===o&&n&&!/\D/.test(a)){n=n.$isMongooseDocumentArray?n.$embeddedSchemaType:n instanceof u.Array?n.caster:void 0;break}if(/\D/.test(a)){if(!n||!n.schema){n=void 0;break}i="nested"===n.schema.pathType(a),n=n.schema.path(a)}else n instanceof u.Array&&s!==o&&(n=n.caster)}return t.subpaths[e]=n,n?"real":i?"nested":"adhocOrUndefined"}
/*!
* ignore
*/B.prototype=B.emit=B.listeners=B.on=B.removeListener=B.collection=B.errors=B.get=B.init=B.isModified=B.isNew=B.populated=B.remove=B.save=B.toObject=B.validate=1,B.collection=1,R.prototype.path=function(t,e){var r=T(t);if(void 0===e){var n=function(t,e,r){if(t.paths.hasOwnProperty(e))return t.paths[e];if(t.subpaths.hasOwnProperty(r))return t.subpaths[r];if(t.singleNestedPaths.hasOwnProperty(r)&&"object"===o(t.singleNestedPaths[r]))return t.singleNestedPaths[r];return null}(this,t,r);if(null!=n)return n;var i=I(this,t);return null!=i?i:null!=(n=this.hasMixedParent(r))?n:/\.\d+\.?.*$/.test(t)?function(t,e){return N(t,e),t.subpaths[e]}(this,t):void 0}var a=t.split(".")[0];if(B[a]&&!this.options.supressReservedKeysWarning){var u="`".concat(a,"` is a reserved schema pathname and may break some functionality. ")+"You are allowed to use it, but use at your own risk. To disable this warning pass `supressReservedKeysWarning` as a schema option.";A.warn(u)}"object"===o(e)&&A.hasUserDefinedProperty(e,"ref")&&E(e.ref,t);var h,f=t.split(/\./),c=f.pop(),d=this.tree,p="",y=s(f);try{for(y.s();!(h=y.n()).done;){var m=h.value;if(p=p+=(p.length>0?".":"")+m,d[m]||(this.nested[p]=!0,d[m]={}),"object"!==o(d[m])){var b="Cannot set nested path `"+t+"`. Parent path `"+p+"` already set to type "+d[m].name+".";throw new Error(b)}d=d[m]}}catch(t){y.e(t)}finally{y.f()}d[c]=A.clone(e),this.paths[t]=this.interpretAsType(t,e,this.options);var v=this.paths[t];if(v.$isSchemaMap){var g=t+".$*";this.paths[g]=v.$__schemaType,this.mapPaths.push(this.paths[g])}if(v.$isSingleNested){for(var w=0,_=Object.keys(v.schema.paths);w<_.length;w++){var M=_[w];this.singleNestedPaths[t+"."+M]=v.schema.paths[M]}for(var S=0,O=Object.keys(v.schema.singleNestedPaths);S<O.length;S++){var x=O[S];this.singleNestedPaths[t+"."+x]=v.schema.singleNestedPaths[x]}for(var k=0,j=Object.keys(v.schema.subpaths);k<j.length;k++){var $=j[k];this.singleNestedPaths[t+"."+$]=v.schema.subpaths[$]}for(var P=0,R=Object.keys(v.schema.nested);P<R.length;P++){var D=R[P];this.singleNestedPaths[t+"."+D]="nested"}Object.defineProperty(v.schema,"base",{configurable:!0,enumerable:!1,writable:!1,value:this.base}),v.caster.base=this.base,this.childSchemas.push({schema:v.schema,model:v.caster})}else v.$isMongooseDocumentArray&&(Object.defineProperty(v.schema,"base",{configurable:!0,enumerable:!1,writable:!1,value:this.base}),v.casterConstructor.base=this.base,this.childSchemas.push({schema:v.schema,model:v.casterConstructor}));if(v.$isMongooseArray&&v.caster instanceof l){for(var C=t,L=v,q=[];L.$isMongooseArray;)C+=".$",L.$isMongooseDocumentArray?(L.$embeddedSchemaType._arrayPath=C,L.$embeddedSchemaType._arrayParentPath=t,L=L.$embeddedSchemaType.clone()):(L.caster._arrayPath=C,L.caster._arrayParentPath=t,L=L.caster.clone()),L.path=C,q.push(L);for(var U=0,F=q;U<F.length;U++){var z=F[U];this.subpaths[z.path]=z}}if(v.$isMongooseDocumentArray){for(var V=0,K=Object.keys(v.schema.paths);V<K.length;V++){var H=K[V],Z=v.schema.paths[H];this.subpaths[t+"."+H]=Z,"object"===o(Z)&&null!=Z&&(Z.$isUnderneathDocArray=!0)}for(var W=0,J=Object.keys(v.schema.subpaths);W<J.length;W++){var Y=J[W],Q=v.schema.subpaths[Y];this.subpaths[t+"."+Y]=Q,"object"===o(Q)&&null!=Q&&(Q.$isUnderneathDocArray=!0)}for(var G=0,X=Object.keys(v.schema.singleNestedPaths);G<X.length;G++){var tt=X[G],et=v.schema.singleNestedPaths[tt];this.subpaths[t+"."+tt]=et,"object"===o(et)&&null!=et&&(et.$isUnderneathDocArray=!0)}}return this},Object.defineProperty(R.prototype,"base",{configurable:!0,enumerable:!1,writable:!0,value:null}),R.prototype.interpretAsType=function(t,e,r){if(e instanceof l){if(e.path===t)return e;var s=e.clone();return s.path=t,s}var a=null!=this.base?this.base.Schema.Types:R.Types;if(!(A.isPOJO(e)||e instanceof d)&&"Object"!==A.getFunctionName(e.constructor)){var u=e;(e={})[r.typeKey]=u}var h,f=e[r.typeKey]&&(e[r.typeKey]instanceof Function||"type"!==r.typeKey||!e.type.type)?e[r.typeKey]:{};if(A.isPOJO(f)||"mixed"===f)return new a.Mixed(t,e);if(Array.isArray(f)||f===Array||"array"===f||f===a.Array){var c=f===Array||"array"===f?e.cas
/*!
* ignore
*/
function(t,e,r,n,o){var s=r+".$*",a={type:{}};if(A.hasUserDefinedProperty(n,"of")){var u=A.isPOJO(n.of)&&Object.keys(n.of).length>0&&!A.hasUserDefinedProperty(n.of,t.options.typeKey);a=u?i({},t.options.typeKey,new R(n.of)):A.isPOJO(n.of)?Object.assign({},n.of):i({},t.options.typeKey,n.of),A.hasUserDefinedProperty(n,"ref")&&(a.ref=n.ref)}e.$__schemaType=t.interpretAsType(s,a,o)}(this,b,t,e,r),b},R.prototype.eachPath=function(t){for(var e=Object.keys(this.paths),r=e.length,n=0;n<r;++n)t(e[n],this.paths[e[n]]);return this},R.prototype.requiredPaths=function(t){if(this._requiredpaths&&!t)return this._requiredpaths;for(var e=Object.keys(this.paths),r=e.length,n=[];r--;){var i=e[r];this.paths[i].isRequired&&n.push(i)}return this._requiredpaths=n,this._requiredpaths},R.prototype.indexedPaths=function(){return this._indexedpaths||(this._indexedpaths=this.indexes()),this._indexedpaths},R.prototype.pathType=function(t){var e=T(t);if(this.paths.hasOwnProperty(t))return"real";if(this.virtuals.hasOwnProperty(t))return"virtual";if(this.nested.hasOwnProperty(t))return"nested";if(this.subpaths.hasOwnProperty(e)||this.subpaths.hasOwnProperty(t))return"real";var r=this.singleNestedPaths.hasOwnProperty(e)||this.singleNestedPaths.hasOwnProperty(t);return r?"nested"===r?"nested":"real":null!=I(this,t)?"real":/\.\d+\.|\.\d+$/.test(t)?N(this,t):"adhocOrUndefined"},R.prototype.hasMixedParent=function(t){var e=t.split(/\./g);t="";for(var r=0;r<e.length;++r)if(t=r>0?t+"."+e[r]:e[r],this.paths.hasOwnProperty(t)&&this.paths[t]instanceof u.Mixed)return this.paths[t];return null},R.prototype.setupTimestamp=function(t){return O(this,t)},R.prototype.queue=function(t,e){return this.callQueue.push([t,e]),this},R.prototype.pre=function(t){if(t instanceof RegExp){var e,r=Array.prototype.slice.call(arguments,1),n=s(j);try{for(n.s();!(e=n.n()).done;){var i=e.value;t.test(i)&&this.pre.apply(this,[i].concat(r))}}catch(t){n.e(t)}finally{n.f()}return this}if(Array.isArray(t)){var o,a=Array.prototype.slice.call(arguments,1),u=s(t);try{for(u.s();!(o=u.n()).done;){var h=o.value;this.pre.apply(this,[h].concat(a))}}catch(t){u.e(t)}finally{u.f()}return this}return this.s.hooks.pre.apply(this.s.hooks,arguments),this},R.prototype.post=function(t){if(t instanceof RegExp){var e,r=Array.prototype.slice.call(arguments,1),n=s(j);try{for(n.s();!(e=n.n()).done;){var i=e.value;t.test(i)&&this.post.apply(this,[i].concat(r))}}catch(t){n.e(t)}finally{n.f()}return this}if(Array.isArray(t)){var o,a=Array.prototype.slice.call(arguments,1),u=s(t);try{for(u.s();!(o=u.n()).done;){var h=o.value;this.post.apply(this,[h].concat(a))}}catch(t){u.e(t)}finally{u.f()}return this}return this.s.hooks.post.apply(this.s.hooks,arguments),this},R.prototype.plugin=function(t,e){if("function"!=typeof t)throw new Error('First param to `schema.plugin()` must be a function, got "'+o(t)+'"');if(e&&e.deduplicate){var r,n=s(this.plugins);try{for(n.s();!(r=n.n()).done;){if(r.value.fn===t)return this}}catch(t){n.e(t)}finally{n.f()}}return this.plugins.push({fn:t,opts:e}),t(this,e),this},R.prototype.method=function(t,e,r){if("string"!=typeof t)for(var n in t)this.methods[n]=t[n],this.methodOptions[n]=A.clone(r);else this.methods[t]=e,this.methodOptions[t]=A.clone(r);return this},R.prototype.static=function(t,e){if("string"!=typeof t)for(var r in t)this.statics[r]=t[r];else this.statics[t]=e;return this},R.prototype.index=function(t,e){return t||(t={}),e||(e={}),e.expires&&A.expires(e),this._indexes.push([t,e]),this},R.prototype.set=function(t,e,r){if(1===arguments.length)return this.options[t];switch(t){case"read":this.options[t]=S(e,r),this._userProvidedOptions[t]=this.options[t];break;case"timestamps":this.setupTimestamp(e),this.options[t]=e,this._userProvidedOptions[t]=this.options[t];break;case"_id":this.options[t]=e,this._userProvidedOptions[t]=this.options[t],e&&!this.paths._id?m(this):!e&&null!=this.paths._id&&this.paths._id.auto&&this.remove("_id");break;default:this.options[t]=e,this._userProvidedOptions[t]=this.options[t]}return this},R.prototype.get=function(t){return this.options[t]};var D="2d 2dsp
/*!
* ignore
*/
function C(t,e){var r,n=e.split("."),i=n.pop(),o=t.tree,a=s(n);try{for(a.s();!(r=a.n()).done;){o=o[r.value]}}catch(t){a.e(t)}finally{a.f()}delete o[i]}
/*!
* ignore
*/
function L(t){return t.startsWith("$[")&&t.endsWith("]")}
/*!
* Called by `compile()` _right before_ compiling. Good for making any changes to
* the schema that should respect options set by plugins, like `id`
*/Object.defineProperty(R,"indexTypes",{get:function(){return D},set:function(){throw new Error("Cannot overwrite Schema.indexTypes")}}),R.prototype.indexes=function(){return g(this)},R.prototype.virtual=function(t,e){if(t instanceof y||"VirtualType"===v(t))return this.virtual(t.path,t.options);if(e=new p(e),A.hasUserDefinedProperty(e,["ref","refPath"])){if(null==e.localField)throw new Error("Reference virtuals require `localField` option");if(null==e.foreignField)throw new Error("Reference virtuals require `foreignField` option");this.pre("init",(function(r){if(M.has(t,r)){var n=M.get(t,r);this.$$populatedVirtuals||(this.$$populatedVirtuals={}),e.justOne||e.count?this.$$populatedVirtuals[t]=Array.isArray(n)?n[0]:n:this.$$populatedVirtuals[t]=Array.isArray(n)?n:null==n?[]:[n],M.unset(t,r)}}));var r=this.virtual(t);r.options=e,r.set((function(r){this.$$populatedVirtuals||(this.$$populatedVirtuals={}),e.justOne||e.count?(this.$$populatedVirtuals[t]=Array.isArray(r)?r[0]:r,"object"!==o(this.$$populatedVirtuals[t])&&(this.$$populatedVirtuals[t]=e.count?r:null)):(this.$$populatedVirtuals[t]=Array.isArray(r)?r:null==r?[]:[r],this.$$populatedVirtuals[t]=this.$$populatedVirtuals[t].filter((function(t){return t&&"object"===o(t)})))})),"function"==typeof e.get&&r.get(e.get);for(var n=t.split("."),i=n[0],s=0;s<n.length-1;++s){if(null!=this.paths[i]&&this.paths[i].$isMongooseDocumentArray){var a=n.slice(s+1).join(".");this.paths[i].schema.virtual(a,e);break}i+="."+n[s+1]}return r}var u=this.virtuals,h=t.split(".");if("real"===this.pathType(t))throw new Error('Virtual path "'+t+'" conflicts with a real path in the schema');return u[t]=h.reduce((function(r,n,i){return r[n]||(r[n]=i===h.length-1?new y(e,t):{}),r[n]}),this.tree),u[t]},R.prototype.virtualpath=function(t){return this.virtuals.hasOwnProperty(t)?this.virtuals[t]:null},R.prototype.remove=function(t){return"string"==typeof t&&(t=[t]),Array.isArray(t)&&t.forEach((function(t){if(null!=this.path(t)||this.nested[t]){if(this.nested[t]){var e,r=s(Object.keys(this.paths).concat(Object.keys(this.nested)));try{for(r.s();!(e=r.n()).done;){var n=e.value;n.startsWith(t+".")&&(delete this.paths[n],delete this.nested[n],C(this,n))}}catch(t){r.e(t)}finally{r.f()}return delete this.nested[t],void C(this,t)}delete this.paths[t],C(this,t)}}),this),this},R.prototype.loadClass=function(t,e){return t===Object.prototype||t===Function.prototype||t.prototype.hasOwnProperty("$isMongooseModelPrototype")||(this.loadClass(Object.getPrototypeOf(t),e),e||Object.getOwnPropertyNames(t).forEach((function(e){if(!e.match(/^(length|name|prototype|constructor|__proto__)$/)){var r=Object.getOwnPropertyDescriptor(t,e);r.hasOwnProperty("value")&&this.static(e,r.value)}}),this),Object.getOwnPropertyNames(t.prototype).forEach((function(r){if(!r.match(/^(constructor)$/)){var n=Object.getOwnPropertyDescriptor(t.prototype,r);e||"function"==typeof n.value&&this.method(r,n.value),"function"==typeof n.get&&(this.virtuals[r]&&(this.virtuals[r].getters=[]),this.virtual(r).get(n.get)),"function"==typeof n.set&&(this.virtuals[r]&&(this.virtuals[r].setters=[]),this.virtual(r).set(n.set))}}),this)),this},
/*!
* ignore
*/
R.prototype._getSchema=function(t){var e=this.path(t),r=[];if(e)return e.$fullPath=t,e;for(var n=t.split("."),i=0;i<n.length;++i)("$"===n[i]||L(n[i]))&&(n[i]="0");return function t(e,n){for(var i,o,s=e.length+1;s--;)if(o=e.slice(0,s).join("."),i=n.path(o)){if(r.push(o),i.caster){if(i.caster instanceof u.Mixed)return i.caster.$fullPath=r.join("."),i.caster;if(s!==e.length&&i.schema){var a=void 0;return"$"===e[s]||L(e[s])?s+1===e.length?i:((a=t(e.slice(s+1),i.schema))&&(a.$isUnderneathDocArray=a.$isUnderneathDocArray||!i.schema.$isSingleNested),a):((a=t(e.slice(s),i.schema))&&(a.$isUnderneathDocArray=a.$isUnderneathDocArray||!i.schema.$isSingleNested),a)}}else if(i.$isSchemaMap){return s>=e.length?i:s+1>=e.length?i.$__schemaType:t(e.slice(s+1),i.$__schemaType.schema)}return i.$fullPath=r.join("."),i}}(n,this)},
/*!
* ignore
*/
R.prototype._getPathType=function(t){if(this.path(t))return"real";return function t(e,r){for(var n,i,o=e.length+1;o--;){if(i=e.slice(0,o).join("."),n=r.path(i))return n.caster?n.caster instanceof u.Mixed?{schema:n,pathType:"mixed"}:o!==e.length&&n.schema?"$"===e[o]||L(e[o])?o===e.length-1?{schema:n,pathType:"nested"}:t(e.slice(o+1),n.schema):t(e.slice(o),n.schema):{schema:n,pathType:n.$isSingleNested?"nested":"array"}:{schema:n,pathType:"real"};if(o===e.length&&r.nested[i])return{schema:r,pathType:"nested"}}return{schema:n||r,pathType:"undefined"}}(t.split("."),this)},R.prototype._preCompile=function(){w(this)},
/*!
* Module exports.
*/
t.exports=e=R,R.Types=u=r(87),
/*!
* ignore
*/
e.ObjectId=u.ObjectId}).call(this,r(3).Buffer)},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(4);function s(t,e){this.path=e,this.getters=[],this.setters=[],this.options=Object.assign({},t)}s.prototype._applyDefaultGetters=function(){if(!(this.getters.length>0||this.setters.length>0)){var t="$"+this.path;this.getters.push((function(){return this[t]})),this.setters.push((function(e){this[t]=e}))}},
/*!
* ignore
*/
s.prototype.clone=function(){var t=new s(this.options,this.path);return t.getters=[].concat(this.getters),t.setters=[].concat(this.setters),t},s.prototype.get=function(t){return this.getters.push(t),this},s.prototype.set=function(t){return this.setters.push(t),this},s.prototype.applyGetters=function(t,e){o.hasUserDefinedProperty(this.options,["ref","refPath"])&&e.$$populatedVirtuals&&e.$$populatedVirtuals.hasOwnProperty(this.path)&&(t=e.$$populatedVirtuals[this.path]);var r,i=t,s=n(this.getters);try{for(s.s();!(r=s.n()).done;){i=r.value.call(e,i,this,e)}}catch(t){s.e(t)}finally{s.f()}return i},s.prototype.applySetters=function(t,e){var r,i=t,o=n(this.setters);try{for(o.s();!(r=o.n()).done;){i=r.value.call(e,i,this,e)}}catch(t){o.e(t)}finally{o.f()}return i},
/*!
* exports
*/
t.exports=s},function(t,e,r){"use strict";
/*!
* Module exports.
*/e.String=r(317),e.Number=r(159),e.Boolean=r(320),e.DocumentArray=r(321),e.Subdocument=r(329),e.Array=r(88),e.Buffer=r(331),e.Date=r(333),e.ObjectId=r(336),e.Mixed=r(45),e.Decimal128=e.Decimal=r(338),e.Map=r(340),e.Oid=e.ObjectId,e.Object=e.Mixed,e.Bool=e.Boolean,e.ObjectID=e.ObjectId},function(t,e,r){"use strict";
/*!
* Module dependencies.
*/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,s,a=r(83),u=r(153),h=r(19),f=r(322),c=r(10),l=c.CastError,d=r(45),p=r(323),y=r(324),m=r(6),b=r(164),v=r(9),g=r(4),w=r(56).castToNumber,_=r(165),M=r(57),S=Symbol("mongoose#isNestedArray"),O=Object.freeze({});function A(t,e,n,i){s||(s=r(58).Embedded);var o,a,u="type";if(i&&i.typeKey&&(u=i.typeKey),this.schemaOptions=i,e){var h={};g.isPOJO(e)&&(e[u]?(delete(h=g.clone(e))[u],e=e[u]):e=d),null!=n&&null!=n.ref&&null==h.ref&&(h.ref=n.ref),e===Object&&(e=d);var f="string"==typeof e?e:g.getFunctionName(e),l=r(87),p=l.hasOwnProperty(f)?l[f]:e;if(this.casterConstructor=p,this.casterConstructor instanceof A&&(this.casterConstructor[S]=!0),"function"!=typeof p||p.$isArraySubdocument||p.$isSchemaMap)this.caster=p,this.caster instanceof s||(this.caster.path=t);else{var y=this.caster instanceof s?null:t;this.caster=new p(y,h)}this.$embeddedSchemaType=this.caster}if(this.$isMongooseArray=!0,c.call(this,t,n,"Array"),null!=this.defaultValue&&(o=this.defaultValue,a="function"==typeof o),!("defaultValue"in this)||void 0!==this.defaultValue){var m=function(){return a?o.call(this):null!=o?[].concat(o):[]};m.$runBeforeSetters=!a,this.default(m)}}A.schemaName="Array",A.options={castNonArrays:!0},
/*!
* ignore
*/
A.defaultOptions={},A.set=c.set,
/*!
* Inherits from SchemaType.
*/
A.prototype=Object.create(c.prototype),A.prototype.constructor=A,A.prototype.OptionsConstructor=f,
/*!
* ignore
*/
A._checkRequired=c.prototype.checkRequired,A.checkRequired=c.checkRequired,A.prototype.checkRequired=function(t,e){return c._isRef(this,t,e,!0)?!!t:("function"==typeof this.constructor.checkRequired?this.constructor.checkRequired():A.checkRequired())(t)},A.prototype.enum=function(){for(var t=this;;){var e=m(t,"caster.instance");if("Array"!==e){if("String"!==e&&"Number"!==e)throw new Error("`enum` can only be set on an array of strings or numbers , not "+e);break}t=t.caster}var r=arguments;return!Array.isArray(arguments)&&g.isObject(arguments)&&(r=g.object.vals(r)),t.caster.enum.apply(t.caster,r),this},A.prototype.applyGetters=function(t,e){if(null!=e&&null!=e.$__&&e.$populated(this.path))return t;var r=c.prototype.applyGetters.call(this,t,e);if(Array.isArray(r))for(var n=g.isMongooseArray(r)?r.__array:r,i=n.length,o=0;o<i;++o)n[o]=this.caster.applyGetters(n[o],e);return r},A.prototype._applySetters=function(t,e,r,n){if(this.casterConstructor.$isMongooseArray&&A.options.castNonArrays&&!this[S]){for(var i=0,o=this;null!=o&&o.$isMongooseArray&&!o.$isMongooseDocumentArray;)++i,o=o.casterConstructor;if(null!=t&&0!==t.length){var s=p(t);if(s.min===s.max&&s.max<i&&s.containsNonArrayItem)for(var a=s.max;a<i;++a)t=[t]}}return c.prototype._applySetters.call(this,t,e,r,n)},A.prototype.cast=function(t,e,n,i,s){var a,u;if(o||(o=r(58).Array),Array.isArray(t)){if(!t.length&&e){var h=e.schema.indexedPaths(),f=this.path;for(a=0,u=h.length;a<u;++a){var c=h[a][0][f];if("2dsphere"===c||"2d"===c)return}var p=this.path.endsWith(".coordinates")?this.path.substring(0,this.path.lastIndexOf(".")):null;if(null!=p)for(a=0,u=h.length;a<u;++a){if("2dsphere"===h[a][0][p])return}}s=s||O;var y=g.isMongooseArray(t)?t.__array:t;if(y=(t=o(y,s.path||this._arrayPath||this.path,e,this)).__array,n&&null!=e&&null!=e.$__&&e.$populated(this.path))return t;var m=this.caster,b=m.$isMongooseArray;if(m&&this.casterConstructor!==d)try{var w=y.length;for(a=0;a<w;a++){var _={};b&&(null!=s.arrayPath||null!=m._arrayParentPath)&&(_.arrayPathIndex=a),y[a]=m.applySetters(y[a],e,n,void 0,_)}}catch(e){throw new l("["+e.kind+"]",v.inspect(t),this.path+"."+a,e,this)}return t}if(n||A.options.castNonArrays)return e&&n&&e.markModified(this.path),this.cast([t],e,n);throw new l("Array",v.inspect(t),this.path,null,this)},
/*!
* ignore
*/
A.prototype._castForPopulate=function(t,e){if(o||(o=r(58).Array),Array.isArray(t)){var n,i=t.__array?t.__array:t,s=i.length,a=this.caster;if(a&&this.casterConstructor!==d)try{for(n=0;n<s;n++){var u={};a.$isMongooseArray&&null!=a._arrayParentPath&&(u.arrayPathIndex=n),i[n]=a.cast(i[n],e,!1,void 0,u)}}catch(e){throw new l("["+e.kind+"]",v.inspect(t),this.path+"."+n,e,this)}return t}throw new l("Array",v.inspect(t),this.path,null,this)},A.prototype.$toObject=A.prototype.toObject,
/*!
* Ignore
*/
A.prototype.discriminator=function(t,e){for(var r=this;r.$isMongooseArray&&!r.$isMongooseDocumentArray;)if(null==(r=r.casterConstructor)||"function"==typeof r)throw new h("You can only add an embedded discriminator on a document array, "+this.path+" is a plain array");return r.discriminator(t,e)},
/*!
* ignore
*/
A.prototype.clone=function(){var t=Object.assign({},this.options),e=new this.constructor(this.path,this.caster,t,this.schemaOptions);return e.validators=this.validators.slice(),void 0!==this.requiredValidator&&(e.requiredValidator=this.requiredValidator),e},A.prototype.castForQuery=function(t,e){var r,n,i=this;if(2===arguments.length){if(!(r=this.$conditionalHandlers[t]))throw new Error("Can't use "+t+" with Array.");n=r.call(this,e)}else{n=t;var o=this.casterConstructor;if(n&&o.discriminators&&o.schema&&o.schema.options&&o.schema.options.discriminatorKey)if("string"==typeof n[o.schema.options.discriminatorKey]&&o.discriminators[n[o.schema.options.discriminatorKey]])o=o.discriminators[n[o.schema.options.discriminatorKey]];else{var s=M(o.discriminators,n[o.schema.options.discriminatorKey]);s&&(o=s)}var a=this.casterConstructor.prototype,u=a&&(a.castForQuery||a.cast);!u&&o.castForQuery&&(u=o.castForQuery);var h=this.caster;Array.isArray(n)?(this.setters.reverse().forEach((function(t){n=t.call(i,n,i)})),n=n.map((function(t){return g.isObject(t)&&t.$elemMatch?t:u?t=u.call(h,t):null!=t?t=new o(t):t}))):u?n=u.call(h,n):null!=n&&(n=new o(n))}return n};var E=A.prototype.$conditionalHandlers={};function x(t){return function(e){if(!Array.isArray(e))throw new TypeError("conditional "+t+" requires an array");var r,i=[],o=n(e);try{for(o.s();!(r=o.n()).done;){var s=r.value;i.push(y(this.casterConstructor.schema,s))}}catch(t){o.e(t)}finally{o.f()}return i}}E.$all=function(t){return Array.isArray(t)||(t=[t]),t=t.map((function(t){if(!g.isObject(t))return t;if(null!=t.$elemMatch)return{$elemMatch:y(this.casterConstructor.schema,t.$elemMatch)};var e={};return e[this.path]=t,y(this.casterConstructor.schema,e)[this.path]}),this),this.castForQuery(t)},E.$options=String,E.$elemMatch=function(t){for(var e=Object.keys(t),r=e.length,n=0;n<r;++n){var i=e[n],o=t[i];b(i)&&null!=o&&(t[i]=this.castForQuery(i,o))}var s=m(this,"casterConstructor.schema.options.discriminatorKey"),a=m(this,"casterConstructor.schema.discriminators",{});return null!=s&&null!=t[s]&&null!=a[t[s]]?y(a[t[s]],t):y(this.casterConstructor.schema,t)},E.$geoIntersects=_.cast$geoIntersects,E.$or=x("$or"),E.$and=x("$and"),E.$nor=x("$nor"),E.$near=E.$nearSphere=_.cast$near,E.$within=E.$geoWithin=_.cast$within,E.$size=E.$minDistance=E.$maxDistance=w,E.$exists=a,E.$type=u,E.$eq=E.$gt=E.$gte=E.$lt=E.$lte=E.$ne=E.$regex=A.prototype.castForQuery,E.$nin=c.prototype.$conditionalHandlers.$nin,E.$in=c.prototype.$conditionalHandlers.$in,
/*!
* Module exports.
*/
t.exports=A},function(t,e,r){"use strict";(function(e){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(14),s=r(46),a=r(19),u=r(18),h=r(167),f=r(6),c=r(34).internalToObjectOptions,l=r(4),d=r(1).arrayAtomicsSymbol,p=r(1).arrayParentSymbol,y=r(1).arrayPathSymbol,m=r(1).arraySchemaSymbol,b=r(1).populateModelSymbol,v=Symbol("mongoose#Array#sliced"),g=Array.prototype.push,w={$__getAtomics:function(){var t=[],e=Object.keys(this[d]||{}),r=e.length,n=Object.assign({},c,{_isNested:!0});if(0===r)return t[0]=["$set",this.toObject(n)],t;for(;r--;){var i=e[r],o=this[d][i];l.isMongooseObject(o)?o=o.toObject(n):Array.isArray(o)?o=this.toObject.call(o,n):null!=o&&Array.isArray(o.$each)?o.$each=this.toObject.call(o.$each,n):null!=o&&"function"==typeof o.valueOf&&(o=o.valueOf()),"$addToSet"===i&&(o={$each:o}),t.push([i,o])}return t},
/*!
* ignore
*/
$atomics:function(){return this[d]},
/*!
* ignore
*/
$parent:function(){return this[p]},
/*!
* ignore
*/
$path:function(){return this[y]},$shift:function(){if(this._registerAtomic("$pop",-1),this._markModified(),!this._shifted)return this._shifted=!0,[].shift.call(this)},$pop:function(){if(this._registerAtomic("$pop",1),this._markModified(),!this._popped)return this._popped=!0,[].pop.call(this)},
/*!
* ignore
*/
$schema:function(){return this[m]},_cast:function(t){var r,n=!1,i=this[p];return i&&(n=i.$populated(this[y],!0)),n&&null!=t?(r=n.options[b],(e.isBuffer(t)||t instanceof u||!l.isObject(t))&&(t={_id:t}),t.schema&&t.schema.discriminatorMapping&&void 0!==t.schema.discriminatorMapping.key||(t=new r(t)),this[m].caster.applySetters(t,i,!0)):this[m].caster.applySetters(t,i,!1)},_mapCast:function(t,e){return this._cast(t,this.length+e)},_markModified:function(t){var e,r=this[p];if(r){if(e=this[y],arguments.length&&(e=e+"."+t),null!=e&&e.endsWith(".$"))return this;r.markModified(e,0!==arguments.length?t:r)}return this},_registerAtomic:function(t,e){if(!this[v]){if("$set"===t)return this[d]={$set:e},h(this[p],this[y]),this._markModified(),this;var r,n=this[d];if("$pop"===t&&!("$pop"in n)){var i=this;this[p].once("save",(function(){i._popped=i._shifted=null}))}if(n.$set||Object.keys(n).length&&!(t in n))return this[d]={$set:this},this;if("$pullAll"===t||"$addToSet"===t)n[t]||(n[t]=[]),n[t]=n[t].concat(e);else if("$pullDocs"===t){var o=n.$pull||(n.$pull={});e[0]instanceof s?(r=o.$or||(o.$or=[]),Array.prototype.push.apply(r,e.map((function(t){return t.toObject({transform:!1,virtuals:!1})})))):(r=o._id||(o._id={$in:[]})).$in=r.$in.concat(e)}else"$push"===t?(n.$push=n.$push||{$each:[]},null!=e&&l.hasUserDefinedProperty(e,"$each")?n.$push=e:n.$push.$each=n.$push.$each.concat(e)):n[t]=e;return this}},addToSet:function(){_(this,arguments);var t=[].map.call(arguments,this._mapCast,this);t=this[m].applySetters(t,this[p]);var e=[],r="";t[0]instanceof s?r="doc":t[0]instanceof Date&&(r="date");var n=l.isMongooseArray(t)?t.__array:this,i=l.isMongooseArray(this)?this.__array:this;return n.forEach((function(t){var n,o=+t;switch(r){case"doc":n=this.some((function(e){return e.equals(t)}));break;case"date":n=this.some((function(t){return+t===o}));break;default:n=~this.indexOf(t)}n||(i.push(t),this._registerAtomic("$addToSet",t),this._markModified(),[].push.call(e,t))}),this),e},hasAtomics:function(){return l.isPOJO(this[d])?Object.keys(this[d]).length:0},includes:function(t,e){return-1!==this.indexOf(t,e)},indexOf:function(t,e){t instanceof u&&(t=t.toString()),e=null==e?0:e;for(var r=this.length,n=e;n<r;++n)if(t==this[n])return n;return-1},inspect:function(){return JSON.stringify(this)},nonAtomicPush:function(){var t=[].map.call(arguments,this._mapCast,this),e=[].push.apply(this,t);return this._registerAtomic("$set",this),this._markModified(),e},pop:function(){var t=[].pop.call(this);return this._registerAtomic("$set",this),this._markModified(),t},pull:function(){for(var t,e=[].map.call(arguments,this._cast,this),r=this[p].get(this[y]),n=r.length;n--;)if((t=r[n])instanceof o){var i=e.some((function(e){return t.equals(e)}));i&&[].splice.call(r,n,1)}else~r.indexOf.call(e,t)&&[].splice.call(r,n,1);return e[0]instanceof s?this._registerAtomic("$pullDocs",e.map((function(t){return t.$__getValue("_id")||t}))):this._registerAtomic("$pullAll",e),this._markModified(),h(this[p],this[y])>0&&this._registerAtomic("$set",this),this},push:function(){var t=arguments,e=t,r=null!=t[0]&&l.hasUserDefinedProperty(t[0],"$each"),n=l.isMongooseArray(this)?this.__array:this;if(r&&(e=t[0],t=t[0].$each),null==this[m])return g.apply(this,t);_(this,t);var i,o=this[p];t=[].map.call(t,this._mapCast,this),t=this[m].applySetters(t,o,void 0,void 0,{skipDocumentArrayCast:!0});var s=this[d];if(r){if(e.$each=t,f(s,"$push.$each.length",0)>0&&s.$push.$position!=e.$position)throw new a("Cannot call `Array#push()` multiple times with different `$position`");null!=e.$position?([].splice.apply(n,[e.$position,0].concat(t)),i=this.length):i=[].push.apply(n,t)}else{if(f(s,"$push.$each.length",0)>0&&null!=s.$push.$position)throw new a("Cannot call `Array#push()` multiple times with different `$position`");e=t,i=[].push.apply(n,t)}return this._registerAtomic("$push",e),this._markModified(),i},remove:function(){return this.pull.apply(this,arguments)},set:function(t,e,r){var n=this.__array;if(r)return n[t]=e,this;var i=w._cast.call(this,e,t);return n[t]=i,w._markModified.call(this,t),this},shift:fu
/*!
* ignore
*/
toBSON:function(){return this.toObject(c)},toObject:function(t){var e=l.isMongooseArray(this)?this.__array:this;return t&&t.depopulate?((t=l.clone(t))._isNested=!0,[].concat(e).map((function(e){return e instanceof o?e.toObject(t):e}))):[].concat(e)},$toObject:function(){return this.constructor.prototype.toObject.apply(this,arguments)},unshift:function(){var t;_(this,arguments),null==this[m]?t=arguments:(t=[].map.call(arguments,this._cast,this),t=this[m].applySetters(t,this[p]));var e=l.isMongooseArray(this)?this.__array:this;return[].unshift.apply(e,t),this._registerAtomic("$set",this),this._markModified(),this.length}};
/*!
* ignore
*/
function _(t,e){var r,i,s,a=null==t?null:f(t[m],"caster.options.ref",null);0===t.length&&0!==e.length&&
/*!
* ignore
*/
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[y],[],(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=l.isMongooseArray(this)?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(42),o=r(34).internalToObjectOptions,s=r(53),a=r(9),u=r(4);function h(t,e,r,i,o){if(null!=r){var s={isNew:r.isNew};"defaults"in r.$__&&(s.defaults=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,"$isSubdocument",{configurable:!1,writable:!1,value:!0}),Object.defineProperty(h.prototype,"$isSingleNested",{configurable:!1,writable:!1,value:!0}),
/*!
* ignore
*/
h.prototype.toBSON=function(){return this.toObject(o)},h.prototype.save=function(t,e){var r=this;return"function"==typeof t&&(e=t,t={}),(t=t||{}).suppressWarning||u.warn("mongoose: calling `save()` on a subdoc does **not** save the document to MongoDB, it only runs save middleware. Use `subdoc.save({ suppressWarning: true })` to hide this warning if you're sure this behavior is right for your app."),s(e,(function(t){r.$__save(t)}))},
/*!
* Given a path relative to this document, return the path relative
* to the top-level document.
*/
h.prototype.$__fullPath=function(t){return this.$__.fullPath||this.ownerDocument(),t?this.$__.fullPath+"."+t:this.$__.fullPath},
/*!
* Given a path relative to this document, return the path relative
* to the top-level document.
*/
h.prototype.$__pathRelativeToParent=function(t){return null==t?this.$basePath:[this.$basePath,t].join(".")},h.prototype.$__save=function(t){var e=this;return i((function(){return t(null,e)}))},
/*!
* ignore
*/
h.prototype.$isValid=function(t){var e=this.$parent(),r=this.$__pathRelativeToParent(t);return null!=e&&null!=r?e.$isValid(r):n.prototype.$isValid.call(this,t)},
/*!
* ignore
*/
h.prototype.markModified=function(t){n.prototype.markModified.call(this,t);var e=this.$parent(),r=this.$__pathRelativeToParent(t);if(null!=e&&null!=r){var i=this.$__pathRelativeToParent().replace(/\.$/,"");e.isDirectModified(i)||this.isNew||this.$__parent.markModified(r,this)}},
/*!
* ignore
*/
h.prototype.isModified=function(t,e){var r=this,i=this.$parent();return null!=i?(Array.isArray(t)||"string"==typeof t?t=(t=Array.isArray(t)?t:t.split(" ")).map((function(t){return r.$__pathRelativeToParent(t)})).filter((function(t){return null!=t})):t||(t=this.$__pathRelativeToParent()),i.$isModified(t,e)):n.prototype.isModified.call(this,t,e)},h.prototype.$markValid=function(t){n.prototype.$markValid.call(this,t);var e=this.$parent(),r=this.$__pathRelativeToParent(t);null!=e&&null!=r&&e.$markValid(r)},
/*!
* ignore
*/
h.prototype.invalidate=function(t,e,r){n.prototype.invalidate.call(this,t,e,r);var i=this.$parent(),o=this.$__pathRelativeToParent(t);if(null!=i&&null!=o)i.invalidate(o,e,r);else if("cast"===e.kind||"CastError"===e.name||null==o)throw e;return this.ownerDocument().$__.validationError},
/*!
* ignore
*/
h.prototype.$ignore=function(t){n.prototype.$ignore.call(this,t);var e=this.$parent(),r=this.$__pathRelativeToParent(t);null!=e&&null!=r&&e.$ignore(r)},h.prototype.ownerDocument=function(){if(this.$__.ownerDocument)return this.$__.ownerDocument;for(var t=this,e=[],r=new Set([t]);"function"==typeof t.$__pathRelativeToParent;){e.unshift(t.$__pathRelativeToParent(void 0,!0));var n=t.$parent();if(null==n)break;if(t=n,r.has(t))throw new Error("Infinite subdocument loop: subdoc with _id "+t._id+" is a parent of itself");r.add(t)}return this.$__.fullPath=e.join("."),this.$__.ownerDocument=t,this.$__.ownerDocument},h.prototype.parent=function(){return this.$__parent},h.prototype.$parent=h.prototype.parent,
/*!
* no-op for hooks
*/
h.prototype.$__remove=function(t){if(null!=t)return t(null,this)},h.prototype.$__removeFromParent=function(){this.$__parent.set(this.$basePath,null)},h.prototype.remove=function(t,e){return"function"==typeof t&&(e=t,t=null),
/*!
* Registers remove event listeners for triggering
* on subdocuments.
*
* @param {Subdocument} sub
* @api private
*/
function(t){var e=t.ownerDocument();function r(){e.$removeListener("save",r),e.$removeListener("remove",r),t.emit("remove",t),t.constructor.emit("remove",t),e=t=null}e.$on("save",r),e.$on("remove",r)}(this),t&&t.noop||this.$__removeFromParent(),this.$__remove(e)},
/*!
* ignore
*/
h.prototype.populate=function(){throw new Error('Mongoose does not support calling populate() on nested docs. Instead of `doc.nested.populate("path")`, use `doc.populate("nested.path")`')},h.prototype.inspect=function(){return this.toObject({transform:!1,virtuals:!1,flattenDecimals:!1})},a.inspect.custom&&(
/*!
* Avoid Node deprecation warning DEP0079
*/
h.prototype[a.inspect.custom]=h.prototype.inspect)},function(t,e,r){"use strict";var n,i=r(1).documentSchemaSymbol,o=r(6),s=r(34).internalToObjectOptions,a=r(4),u=r(1).getSymbol,h=r(1).scopeSymbol,f=a.isPOJO;
/*!
* Compiles schemas.
*/
function c(t,e,i,o){n=n||r(14);for(var s=o.typeKey,a=0,u=Object.keys(t);a<u.length;a++){var h=u[a],c=t[h];l({prop:h,subprops:f(c)&&Object.keys(c).length>0&&(!c[s]||"type"===s&&f(c.type)&&c.type.type)?c:null,prototype:e,prefix:i,options:o})}}
/*!
* Defines the accessor named prop on the incoming prototype.
*/function l(t){var e=t.prop,f=t.subprops,l=t.prototype,d=t.prefix,p=t.options;n=n||r(14);var y=(d?d+".":"")+e;d=d||"",f?Object.defineProperty(l,e,{enumerable:!0,configurable:!0,get:function(){var t,e,r=this;if(this.$__.getters||(this.$__.getters={}),!this.$__.getters[y]){var s=Object.create(n.prototype,(t=this,e={},Object.getOwnPropertyNames(t).forEach((function(r){-1===["isNew","$__","$errors","errors","_doc","$locals","$op","__parentArray","__index","$isDocumentArrayElement"].indexOf(r)||(e[r]=Object.getOwnPropertyDescriptor(t,r),e[r].enumerable=!1)})),e));d||(s.$__[h]=this),s.$__.nestedPath=y,Object.defineProperty(s,"schema",{enumerable:!1,configurable:!0,writable:!1,value:l.schema}),Object.defineProperty(s,"$__schema",{enumerable:!1,configurable:!0,writable:!1,value:l.schema}),Object.defineProperty(s,i,{enumerable:!1,configurable:!0,writable:!1,value:l.schema}),Object.defineProperty(s,"toObject",{enumerable:!1,configurable:!0,writable:!1,value:function(){return a.clone(r.get(y,null,{virtuals:o(this,"schema.options.toObject.virtuals",null)}))}}),Object.defineProperty(s,"$__get",{enumerable:!1,configurable:!0,writable:!1,value:function(){return r.get(y,null,{virtuals:o(this,"schema.options.toObject.virtuals",null)})}}),Object.defineProperty(s,"toJSON",{enumerable:!1,configurable:!0,writable:!1,value:function(){return r.get(y,null,{virtuals:o(r,"schema.options.toJSON.virtuals",null)})}}),Object.defineProperty(s,"$__isNested",{enumerable:!1,configurable:!0,writable:!1,value:!0});var u=Object.freeze({minimize:!0,virtuals:!1,getters:!1,transform:!1});Object.defineProperty(s,"$isEmpty",{enumerable:!1,configurable:!0,writable:!1,value:function(){return 0===Object.keys(this.get(y,null,u)||{}).length}}),Object.defineProperty(s,"$__parent",{enumerable:!1,configurable:!0,writable:!1,value:this}),c(f,s,y,p),this.$__.getters[y]=s}return this.$__.getters[y]},set:function(t){null!=t&&t.$__isNested?t=t.$__get():t instanceof n&&!t.$__isNested&&(t=t.$toObject(s)),(this.$__[h]||this).$set(y,t)}}):Object.defineProperty(l,e,{enumerable:!0,configurable:!0,get:function(){return this[u].call(this.$__[h]||this,y)},set:function(t){this.$set.call(this.$__[h]||this,y,t)}})}
/*!
* exports
*/
e.compile=c,e.defineKey=l},function(t,e,r){"use strict";
/*!
* ignore
*/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)}t.exports=function(t){return null==t||("object"!==n(t)||!("$meta"in t)&&!("$slice"in t))}},function(t,e){var r={}.toString;t.exports=Array.isArray||function(t){return"[object Array]"==r.call(t)}},function(t,e,r){"use strict";var n=r(182).Buffer,i=r(95).Transform;function o(t){i.call(this),this._block=n.allocUnsafe(t),this._blockSize=t,this._blockOffset=0,this._length=[0,0,0,0],this._finalized=!1}r(0)(o,i),o.prototype._transform=function(t,e,r){var n=null;try{this.update(t,e)}catch(t){n=t}r(n)},o.prototype._flush=function(t){var e=null;try{this.push(this.digest())}catch(t){e=t}t(e)},o.prototype.update=function(t,e){if(function(t,e){if(!n.isBuffer(t)&&"string"!=typeof t)throw new TypeError(e+" must be a string or a buffer")}(t,"Data"),this._finalized)throw new Error("Digest already called");n.isBuffer(t)||(t=n.from(t,e));for(var r=this._block,i=0;this._blockOffset+t.length-i>=this._blockSize;){for(var o=this._blockOffset;o<this._blockSize;)r[o++]=t[i++];this._update(),this._blockOffset=0}for(;i<t.length;)r[this._blockOffset++]=t[i++];for(var s=0,a=8*t.length;a>0;++s)this._length[s]+=a,(a=this._length[s]/4294967296|0)>0&&(this._length[s]-=4294967296*a);return this},o.prototype._update=function(){throw new Error("_update is not implemented")},o.prototype.digest=function(t){if(this._finalized)throw new Error("Digest already called");this._finalized=!0;var e=this._digest();void 0!==t&&(e=e.toString(t)),this._block.fill(0),this._blockOffset=0;for(var r=0;r<4;++r)this._length[r]=0;return e},o.prototype._digest=function(){throw new Error("_digest is not implemented")},t.exports=o},function(t,e,r){(e=t.exports=r(96)).Stream=e,e.Readable=e,e.Writable=r(100),e.Duplex=r(30),e.Transform=r(102),e.PassThrough=r(189),e.finished=r(61),e.pipeline=r(190)},function(t,e,r){"use strict";(function(e,n){var i;t.exports=A,A.ReadableState=O;r(13).EventEmitter;var o=function(t,e){return t.listeners(e).length},s=r(97),a=r(3).Buffer,u=e.Uint8Array||function(){};var h,f=r(183);h=f&&f.debuglog?f.debuglog("stream"):function(){};var c,l,d,p=r(184),y=r(98),m=r(99).getHighWaterMark,b=r(29).codes,v=b.ERR_INVALID_ARG_TYPE,g=b.ERR_STREAM_PUSH_AFTER_EOF,w=b.ERR_METHOD_NOT_IMPLEMENTED,_=b.ERR_STREAM_UNSHIFT_AFTER_END_EVENT;r(0)(A,s);var M=y.errorOrDestroy,S=["error","close","destroy","pause","resume"];function O(t,e,n){i=i||r(30),t=t||{},"boolean"!=typeof n&&(n=e instanceof i),this.objectMode=!!t.objectMode,n&&(this.objectMode=this.objectMode||!!t.readableObjectMode),this.highWaterMark=m(this,t,"readableHighWaterMark",n),this.buffer=new p,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.paused=!0,this.emitClose=!1!==t.emitClose,this.autoDestroy=!!t.autoDestroy,this.destroyed=!1,this.defaultEncoding=t.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,t.encoding&&(c||(c=r(36).StringDecoder),this.decoder=new c(t.encoding),this.encoding=t.encoding)}function A(t){if(i=i||r(30),!(this instanceof A))return new A(t);var e=this instanceof i;this._readableState=new O(t,this,e),this.readable=!0,t&&("function"==typeof t.read&&(this._read=t.read),"function"==typeof t.destroy&&(this._destroy=t.destroy)),s.call(this)}function E(t,e,r,n,i){h("readableAddChunk",e);var o,s=t._readableState;if(null===e)s.reading=!1,function(t,e){if(h("onEofChunk"),e.ended)return;if(e.decoder){var r=e.decoder.end();r&&r.length&&(e.buffer.push(r),e.length+=e.objectMode?1:r.length)}e.ended=!0,e.sync?j(t):(e.needReadable=!1,e.emittedReadable||(e.emittedReadable=!0,$(t)))}(t,s);else if(i||(o=function(t,e){var r;n=e,a.isBuffer(n)||n instanceof u||"string"==typeof e||void 0===e||t.objectMode||(r=new v("chunk",["string","Buffer","Uint8Array"],e));var n
/*!
* Get the bson type, if it exists
*/t.exports=function(t,e){return n(t,"_bsontype",void 0)===e}},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=Symbol("mongoose#trustedSymbol");e.trustedSymbol=i,e.trusted=function(t){return null==t||"object"!==n(t)||(t[i]=!0),t}},function(t,e,r){"use strict";(function(e){
/*!
* ignore
*/
var n=r(43),i=r(284),o={_promise:null,get:function(){return o._promise},set:function(t){n.ok("function"==typeof t,"mongoose.Promise must be a function, got ".concat(t)),o._promise=t,i.Promise=t}};
/*!
* Use native promises by default
*/
o.set(e.Promise),t.exports=o}).call(this,r(7))},function(t,e,r){"use strict";(function(t,r,n,i){function o(t){return(o="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)}e.isNode=void 0!==t&&"object"==o(r)&&"object"==(void 0===n?"undefined":o(n))&&"function"==typeof i&&t.argv,e.isMongo=!e.isNode&&"function"==typeof printjson&&"function"==typeof ObjectId&&"function"==typeof rs&&"function"==typeof sh,e.isBrowser=!e.isNode&&!e.isMongo&&"undefined"!=typeof window,e.type=e.isNode?"node":e.isMongo?"mongo":e.isBrowser?"browser":"unknown"}).call(this,r(5),r(24)(t),r(7),r(3).Buffer)},function(t,e,r){"use strict";t.exports=function(t,e,r){for(var n={},i=0,o=Object.keys(e.tree);i<o.length;i++){var s=o[i];r&&(t.paths[s]||t.nested[s]||t.singleNestedPaths[s])||(n[s]=e.tree[s])}for(var a in t.add(n),t.callQueue=t.callQueue.concat(e.callQueue),t.method(e.methods),t.static(e.statics),e.query)t.query[a]=e.query[a];for(var u in e.virtuals)t.virtuals[u]=e.virtuals[u].clone();t.s.hooks.merge(e.s.hooks,!1)}},function(t,e,r){"use strict";
/*!
* Module requirements
*/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)}function i(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function o(t,e){return(o=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function s(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=u(t);if(e){var i=u(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return a(this,r)}}function a(t,e){if(e&&("object"===n(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function u(t){return(u=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var h=r(19),f=r(22),c=r(9),l=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&o(t,e)}(u,t);var e,r,n,a=s(u);function u(t){var e,r;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,u),r="model"===f(t)?t.constructor.modelName+" validation failed":"Validation failed",(e=a.call(this,r)).errors={},e._message=r,t&&(t.$errors=e.errors),e}return e=u,(r=[{key:"toString",value:function(){return this.name+": "+d(this)}
/*!
* inspect helper
*/},{key:"inspect",value:function(){return Object.assign(new Error(this.message),this)}
/*!
* add message
*/},{key:"addError",value:function(t,e){this.errors[t]=e,this.message=this._message+": "+d(this)}}])&&i(e.prototype,r),n&&i(e,n),Object.defineProperty(e,"prototype",{writable:!1}),u}(h);
/*!
* ignore
*/
function d(t){for(var e,r=Object.keys(t.errors||{}),n=r.length,i=[],o=0;o<n;++o)e=r[o],t!==t.errors[e]&&i.push(e+": "+t.errors[e].message);return i.join(", ")}
/*!
* Module exports
*/c.inspect.custom&&(
/*!
* Avoid Node deprecation warning DEP0079
*/
l.prototype[c.inspect.custom]=l.prototype.inspect)
/*!
* Helper for JSON.stringify
* Ensure `name` and `message` show up in toJSON output re: gh-9847
*/,Object.defineProperty(l.prototype,"toJSON",{enumerable:!1,writable:!1,configurable:!0,value:function(){return Object.assign({},this,{name:this.name,message:this.message})}}),Object.defineProperty(l.prototype,"name",{value:"ValidationError"}),t.exports=l},function(t,e,r){"use strict";
/*!
* Module dependencies.
*/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)}function i(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function o(t,e){return(o=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function s(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=u(t);if(e){var i=u(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return a(this,r)}}function a(t,e){if(e&&("object"===n(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function u(t){return(u=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var h=r(8),f=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&o(t,e)}(u,t);var e,r,n,a=s(u);function u(t){var e;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,u);var r=t.message;r||(r=h.messages.general.default);var n=c(r,t);return e=a.call(this,n),t=Object.assign({},t,{message:n}),e.properties=t,e.kind=t.type,e.path=t.path,e.value=t.value,e.reason=t.reason,e}
/*!
* toString helper
* TODO remove? This defaults to `${this.name}: ${this.message}`
*/return e=u,(r=[{key:"toString",value:function(){return this.message}
/*!
* Ensure `name` and `message` show up in toJSON output re: gh-9296
*/},{key:"toJSON",value:function(){return Object.assign({name:this.name,message:this.message},this)}}])&&i(e.prototype,r),n&&i(e,n),Object.defineProperty(e,"prototype",{writable:!1}),u}(h);
/*!
* Formats error messages
*/
function c(t,e){if("function"==typeof t)return t(e);for(var r=0,n=Object.keys(e);r<n.length;r++){var i=n[r];"message"!==i&&(t=t.replace("{"+i.toUpperCase()+"}",e[i]))}return t}
/*!
* exports
*/Object.defineProperty(f.prototype,"name",{value:"ValidatorError"}),
/*!
* The object used to define this validator. Not enumerable to hide
* it from `require('util').inspect()` output re: gh-3925
*/
Object.defineProperty(f.prototype,"properties",{enumerable:!1,writable:!0,value:null}),f.prototype.formatMessage=c,t.exports=f},function(t,e,r){"use strict";
/*!
* ignore
*/t.exports=function(t){if(Array.isArray(t)){if(!t.every((function(t){return"number"==typeof t||"string"==typeof t})))throw new Error("$type array values must be strings or numbers");return t}if("number"!=typeof t&&"string"!=typeof t)throw new Error("$type parameter must be number, string, or array of numbers and strings");return t}},function(t,e,r){"use strict";
/*!
* Module dependencies.
*/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)}function i(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function o(t,e){return(o=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function s(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=u(t);if(e){var i=u(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return a(this,r)}}function a(t,e){if(e&&("object"===n(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function u(t){return(u=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var h=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&o(t,e)}(u,t);var e,r,n,a=s(u);function u(t,e){var r;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,u);var n=Array.isArray(e)?"array":"primitive value";return(r=a.call(this,"Tried to set nested object field `"+t+"` to ".concat(n," `")+e+"`")).path=t,r}return e=u,r&&i(e.prototype,r),n&&i(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}(r(8));Object.defineProperty(h.prototype,"name",{value:"ObjectExpectedError"}),t.exports=h},function(t,e,r){"use strict";t.exports=function(t){var e={_id:{auto:!0}};e._id[t.options.typeKey]="ObjectId",t.add(e)}},function(t,e,r){"use strict";t.exports=
/*!
* ignore
*/
function(t,e){if(null==t)return null;if("boolean"==typeof t)return e;if("boolean"==typeof t[e])return t[e]?e:null;if(!(e in t))return e;return t[e]}},function(t,e,r){"use strict";var n=r(55),i=r(53);
/*!
* Register hooks for this model
*
* @param {Model} model
* @param {Schema} schema
*/
function o(t,e,r){var s={useErrorHandlers:!0,numCallbackParams:1,nullResultByDefault:!0,contextParameter:!0},a=(r=r||{}).decorateDoc?t:t.prototype;t.$appliedHooks=!0;for(var u=0,h=Object.keys(e.paths);u<h.length;u++){var f=h[u],c=e.paths[f],l=null;if(c.$isSingleNested)l=c.caster;else{if(!c.$isMongooseDocumentArray)continue;l=c.Constructor}if(!l.$appliedHooks&&(o(l,c.schema,r),null!=l.discriminators))for(var d=0,p=Object.keys(l.discriminators);d<p.length;d++){var y=p[d];o(l.discriminators[y],l.discriminators[y].schema,r)}}var m=e.s.hooks.filter((function(t){return"updateOne"===t.name||"deleteOne"===t.name?!!t.document:"remove"===t.name||"init"===t.name?null==t.document||!!t.document:null==t.query&&null==t.document||!1!==t.document})).filter((function(t){return!e.methods[t.name]||!t.fn[n.builtInMiddleware]}));t._middleware=m,a.$__originalValidate=a.$__originalValidate||a.$__validate;for(var b=0,v=["save","validate","remove","deleteOne"];b<v.length;b++){var g=v[b],w="validate"===g?"$__originalValidate":"$__".concat(g),_=m.createWrapper(g,a[w],null,s);a["$__".concat(g)]=_}a.$__init=m.createWrapperSync("init",a.$__init,null,s);for(var M=Object.keys(e.methods),S=Object.assign({},s,{checkForPromise:!0}),O=function(){var e=E[A];if(!m.hasHooks(e))return"continue";var r=a[e];a[e]=function(){var r=this,n=Array.prototype.slice.call(arguments),o=n.slice(-1).pop(),s="function"==typeof o?n.slice(0,n.length-1):n;return i(o,(function(t){return r["$__".concat(e)].apply(r,s.concat([t]))}),t.events)},a["$__".concat(e)]=m.createWrapper(e,r,null,S)},A=0,E=M;A<E.length;A++)O()}
/*!
* ignore
*/
t.exports=o,
/*!
* ignore
*/
o.middlewareFunctions=["deleteOne","save","validate","remove","updateOne","init"]},function(t,e,r){"use strict";var n=r(20);
/*!
* Given a value, cast it to a string, or throw a `CastError` if the value
* cannot be casted. `null` and `undefined` are considered valid.
*
* @param {Any} value
* @param {String} [path] optional the path to set on the CastError
* @return {string|null|undefined}
* @throws {CastError}
* @api private
*/t.exports=function(t,e){if(null==t)return t;if(t._id&&"string"==typeof t._id)return t._id;if(t.toString&&t.toString!==Object.prototype.toString&&!Array.isArray(t))return t.toString();throw new n("string",t,e)}},function(t,e,r){"use strict";
/*!
* Module requirements.
*/var n=r(8),i=r(319),o=r(10),s=r(160),a=r(161),u=r(4),h=o.CastError;function f(t,e){o.call(this,t,e,"Number")}
/*!
* ignore
*/
function c(t){return this.cast(t)}f.get=o.get,f.set=o.set,
/*!
* ignore
*/
f._cast=s,f.cast=function(t){return 0===arguments.length||(!1===t&&(t=this._defaultCaster),this._cast=t),this._cast},
/*!
* ignore
*/
f._defaultCaster=function(t){if("number"!=typeof t)throw new Error;return t},f.schemaName="Number",f.defaultOptions={},
/*!
* Inherits from SchemaType.
*/
f.prototype=Object.create(o.prototype),f.prototype.constructor=f,f.prototype.OptionsConstructor=i,
/*!
* ignore
*/
f._checkRequired=function(t){return"number"==typeof t||t instanceof Number},f.checkRequired=o.checkRequired,f.prototype.checkRequired=function(t,e){return o._isRef(this,t,e,!0)?!!t:("function"==typeof this.constructor.checkRequired?this.constructor.checkRequired():f.checkRequired())(t)},f.prototype.min=function(t,e){if(this.minValidator&&(this.validators=this.validators.filter((function(t){return t.validator!==this.minValidator}),this)),null!=t){var r=e||n.messages.Number.min;r=r.replace(/{MIN}/,t),this.validators.push({validator:this.minValidator=function(e){return null==e||e>=t},message:r,type:"min",min:t})}return this},f.prototype.max=function(t,e){if(this.maxValidator&&(this.validators=this.validators.filter((function(t){return t.validator!==this.maxValidator}),this)),null!=t){var r=e||n.messages.Number.max;r=r.replace(/{MAX}/,t),this.validators.push({validator:this.maxValidator=function(e){return null==e||e<=t},message:r,type:"max",max:t})}return this},f.prototype.enum=function(t,e){if(this.enumValidator&&(this.validators=this.validators.filter((function(t){return t.validator!==this.enumValidator}),this)),!Array.isArray(t)){var r=u.isPOJO(t)&&null!=t.values;r?(e=t.message,t=t.values):"number"==typeof t&&(t=Array.prototype.slice.call(arguments),e=null),u.isPOJO(t)&&(t=Object.values(t)),e=e||n.messages.Number.enum}return e=null==e?n.messages.Number.enum:e,this.enumValidator=function(e){return null==e||-1!==t.indexOf(e)},this.validators.push({validator:this.enumValidator,message:e,type:"enum",enumValues:t}),this},f.prototype.cast=function(t,e,r){if(o._isRef(this,t,e,r)){if("number"==typeof t)return t;if(null==t||u.isNonBuiltinObject(t))return this._castRef(t,e,r)}var n,i=t&&void 0!==t._id?t._id:t;n="function"==typeof this._castFunction?this._castFunction:"function"==typeof this.constructor.cast?this.constructor.cast():f.cast();try{return n(i)}catch(t){throw new h("Number",i,this.path,t,this)}},f.prototype.$conditionalHandlers=u.options(o.prototype.$conditionalHandlers,{$bitsAllClear:a,$bitsAnyClear:a,$bitsAllSet:a,$bitsAnySet:a,$gt:c,$gte:c,$lt:c,$lte:c,$mod:function(t){var e=this;return Array.isArray(t)?t.map((function(t){return e.cast(t)})):[this.cast(t)]}}),f.prototype.castForQuery=function(t,e){var r;if(2===arguments.length){if(!(r=this.$conditionalHandlers[t]))throw new h("number",e,this.path,null,this);return r.call(this,e)}return e=this._castForQuery(t)},
/*!
* Module exports.
*/
t.exports=f},function(t,e,r){"use strict";var n=r(43);
/*!
* Given a value, cast it to a number, or throw a `CastError` if the value
* cannot be casted. `null` and `undefined` are considered valid.
*
* @param {Any} value
* @param {String} [path] optional the path to set on the CastError
* @return {Boolean|null|undefined}
* @throws {Error} if `value` is not one of the allowed values
* @api private
*/t.exports=function(t){return null==t?t:""===t?null:("string"!=typeof t&&"boolean"!=typeof t||(t=Number(t)),n.ok(!isNaN(t)),t instanceof Number?t.valueOf():"number"==typeof t?t:Array.isArray(t)||"function"!=typeof t.valueOf?t.toString&&!Array.isArray(t)&&t.toString()==Number(t)?Number(t):void n.ok(!1):Number(t.valueOf()))}},function(t,e,r){"use strict";(function(e){
/*!
* Module requirements.
*/
var n=r(20);
/*!
* ignore
*/
/*!
* ignore
*/
function i(t,e){var r=Number(e);if(isNaN(r))throw new n("number",e,t);return r}t.exports=function(t){var r=this;return Array.isArray(t)?t.map((function(t){return i(r.path,t)})):e.isBuffer(t)?t:i(r.path,t)}}).call(this,r(3).Buffer)},function(t,e,r){"use strict";var n=r(163);
/*!
* returns discriminator by discriminatorMapping.value
*
* @param {Schema} schema
* @param {string} value
*/t.exports=function(t,e){if(null==t||null==t.discriminators)return null;for(var r=0,i=Object.keys(t.discriminators);r<i.length;r++){var o=i[r],s=t.discriminators[o];if(null!=s.discriminatorMapping&&n(s.discriminatorMapping.value,e))return s}return null}},function(t,e,r){"use strict";var n=r(18);t.exports=function(t,e){return"string"==typeof t&&"string"==typeof e||"number"==typeof t&&"number"==typeof e?t===e:t instanceof n&&e instanceof n&&t.toString()===e.toString()}},function(t,e,r){"use strict";var n=new Set(["$ref","$id","$db"]);t.exports=function(t){return t.startsWith("$")&&!n.has(t)}},function(t,e,r){"use strict";
/*!
* Module requirements.
*/var n=r(56).castArraysOfNumbers,i=r(56).castToNumber;function o(t,e){switch(t.$geometry.type){case"Polygon":case"LineString":case"Point":n(t.$geometry.coordinates,e)}return s(e,t),t}function s(t,e){e.$maxDistance&&(e.$maxDistance=i.call(t,e.$maxDistance)),e.$minDistance&&(e.$minDistance=i.call(t,e.$minDistance))}
/*!
* ignore
*/
e.cast$geoIntersects=function(t){if(!t.$geometry)return;return o(t,this),t},e.cast$near=function(t){var e=r(88);if(Array.isArray(t))return n(t,this),t;if(s(this,t),t&&t.$geometry)return o(t,this);if(!Array.isArray(t))throw new TypeError("$near must be either an array or an object with a $geometry property");return e.prototype.castForQuery.call(this,t)},e.cast$within=function(t){var e=this;if(s(this,t),t.$box||t.$polygon){var r=t.$box?"$box":"$polygon";t[r].forEach((function(t){if(!Array.isArray(t))throw new TypeError("Invalid $within $box argument. Expected an array, received "+t);t.forEach((function(r,n){t[n]=i.call(e,r)}))}))}else if(t.$center||t.$centerSphere){var n=t.$center?"$center":"$centerSphere";t[n].forEach((function(r,o){Array.isArray(r)?r.forEach((function(t,n){r[n]=i.call(e,t)})):t[n][o]=i.call(e,r)}))}else t.$geometry&&o(t,this);return t}},function(t,e,r){"use strict";
/*!
* Module dependencies.
*/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(14),o=r(89),s=r(1).arrayAtomicsSymbol,a=r(1).arrayAtomicsBackupSymbol,u=r(1).arrayParentSymbol,h=r(1).arrayPathSymbol,f=r(1).arraySchemaSymbol,c=Array.prototype.push,l=/^\d+$/;
/*!
* Module exports.
*/
t.exports=function(t,e,r,d){var p,y;if(Array.isArray(t)){var m=t.length;if(0===m)y=new Array;else if(1===m)(y=new Array(1))[0]=t[0];else if(m<1e4)y=new Array,c.apply(y,t);else{y=new Array;for(var b=0;b<m;++b)c.apply(y,t[b])}}else y=[];var v=(n(p={},s,{}),n(p,a,void 0),n(p,h,e),n(p,f,d),n(p,u,void 0),n(p,"isMongooseArray",!0),n(p,"isMongooseArrayProxy",!0),n(p,"__array",y),p);t&&null!=t[s]&&(v[s]=t[s]),null!=r&&r instanceof i&&(v[u]=r,v[f]=d||r.schema.path(e));var g=new Proxy(y,{get:function(t,e){return v.hasOwnProperty(e)?v[e]:o.hasOwnProperty(e)?o[e]:y[e]},set:function(t,e,r){return"string"==typeof e&&l.test(e)?o.set.call(g,e,r,!1):v.hasOwnProperty(e)?v[e]=r:y[e]=r,!0}});return g}},function(t,e,r){"use strict";
/*!
* ignore
*/t.exports=function(t,e,r){var n=(r=r||{}).skipDocArrays,i=0;if(!t)return i;for(var o=0,s=Object.keys(t.$__.activePaths.states.modify);o<s.length;o++){var a=s[o];if(n){var u=t.$__schema.path(a);if(u&&u.$isMongooseDocumentArray)continue}if(a.startsWith(e+".")&&(delete t.$__.activePaths.states.modify[a],++i,t.$isSubdocument)){var h=t.ownerDocument(),f=t.$__fullPath(a);delete h.$__.activePaths.states.modify[f]}}return i}},function(t,e,r){"use strict";(function(e){
/*!
* Module dependencies.
*/
var n=r(25).get().Binary,i=r(4);function o(t,r,n){var s,u,h,f,c=t;return null==t&&(c=0),Array.isArray(r)?(u=r[0],h=r[1]):s=r,f="number"==typeof c||c instanceof Number?e.alloc(c):e.from(c,s,n),i.decorate(f,o.mixin),f.isMongooseBuffer=!0,f[o.pathSymbol]=u,f[a]=h,f._subtype=0,f}var s=Symbol.for("mongoose#Buffer#_path"),a=Symbol.for("mongoose#Buffer#_parent");o.pathSymbol=s,
/*!
* Inherit from Buffer.
*/
o.mixin={_subtype:void 0,_markModified:function(){var t=this[a];return t&&t.markModified(this[o.pathSymbol]),this},write:function(){var t=e.prototype.write.apply(this,arguments);return t>0&&this._markModified(),t},copy:function(t){var r=e.prototype.copy.apply(this,arguments);return t&&t.isMongooseBuffer&&t._markModified(),r}},
/*!
* Compile other Buffer methods marking this buffer as modified.
*/
"writeUInt8 writeUInt16 writeUInt32 writeInt8 writeInt16 writeInt32 writeFloat writeDouble fill utf8Write binaryWrite asciiWrite set writeUInt16LE writeUInt16BE writeUInt32LE writeUInt32BE writeInt16LE writeInt16BE writeInt32LE writeInt32BE writeFloatLE writeFloatBE writeDoubleLE writeDoubleBE".split(" ").forEach((function(t){e.prototype[t]&&(o.mixin[t]=function(){var r=e.prototype[t].apply(this,arguments);return this._markModified(),r})})),o.mixin.toObject=function(t){var r="number"==typeof t?t:this._subtype||0;return new n(e.from(this),r)},o.mixin.$toObject=o.mixin.toObject,o.mixin.toBSON=function(){return new n(this,this._subtype||0)},o.mixin.equals=function(t){if(!e.isBuffer(t))return!1;if(this.length!==t.length)return!1;for(var r=0;r<this.length;++r)if(this[r]!==t[r])return!1;return!0},o.mixin.subtype=function(t){if("number"!=typeof t)throw new TypeError("Invalid subtype. Expected a number");this._subtype!==t&&this._markModified(),this._subtype=t},
/*!
* Module exports.
*/
o.Binary=n,t.exports=o}).call(this,r(3).Buffer)},function(t,e,r){"use strict";var n=r(25).get().ObjectId;t.exports=function(t){if(null==t)return t;if(t instanceof n)return t;if(t._id){if(t._id instanceof n)return t._id;if(t._id.toString instanceof Function)return new n(t._id.toString())}return t.toString instanceof Function?new n(t.toString()):new n(t)}},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)}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,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function a(){return(a="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,e,r){var n=u(t,e);if(n){var i=Object.getOwnPropertyDescriptor(n,e);return i.get?i.get.call(arguments.length<3?t:r):i.value}}).apply(this,arguments)}function u(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=p(t)););return t}function h(t,e){if(e&&("object"===n(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function f(t){var e="function"==typeof Map?new Map:void 0;return(f=function(t){if(null===t||(r=t,-1===Function.toString.call(r).indexOf("[native code]")))return t;var r;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==e){if(e.has(t))return e.get(t);e.set(t,n)}function n(){return c(t,arguments,p(this).constructor)}return n.prototype=Object.create(t.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),d(n,t)})(t)}function c(t,e,r){return(c=l()?Reflect.construct:function(t,e,r){var n=[null];n.push.apply(n,e);var i=new(Function.bind.apply(t,n));return r&&d(i,r.prototype),i}).apply(null,arguments)}function l(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}function d(t,e){return(d=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function p(t){return(p=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var y=r(45),m=r(18),b=r(41),v=r(4).deepEqual,g=r(6),w=r(22),_=r(171),M=r(9),S=r(82),O=r(1).populateModelSymbol,A=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&d(t,e)}(c,t);var e,r,n,o,u,f=(e=c,r=l(),function(){var t,n=p(e);if(r){var i=p(this).constr
/*!
* Since maps are stored as objects under the hood, keys must be strings
* and can't contain any invalid characters
*/
function E(t){var e=n(t);if("string"!==e)throw new TypeError("Mongoose maps only support string keys, got ".concat(e));if(t.startsWith("$"))throw new Error('Mongoose maps do not support keys that start with "$", got "'.concat(t,'"'));if(t.includes("."))throw new Error('Mongoose maps do not support keys that contain ".", got "'.concat(t,'"'));if(S.has(t))throw new Error('Mongoose maps do not support reserved key name "'.concat(t,'"'))}M.inspect.custom&&Object.defineProperty(A.prototype,M.inspect.custom,{enumerable:!1,writable:!1,configurable:!1,value:A.prototype.inspect}),Object.defineProperty(A.prototype,"$__set",{enumerable:!1,writable:!0,configurable:!1}),Object.defineProperty(A.prototype,"$__parent",{enumerable:!1,writable:!0,configurable:!1}),Object.defineProperty(A.prototype,"$__path",{enumerable:!1,writable:!0,configurable:!1}),Object.defineProperty(A.prototype,"$__schemaType",{enumerable:!1,writable:!0,configurable:!1}),Object.defineProperty(A.prototype,"$isMongooseMap",{enumerable:!1,writable:!1,configurable:!1,value:!0}),Object.defineProperty(A.prototype,"$__deferredCalls",{enumerable:!1,writable:!1,configurable:!1,value:!0}),t.exports=A},function(t,e,r){"use strict";var n=r(4);t.exports=function(t){return n.isPOJO(t)&&null!=t.$__&&null!=t._doc?t._doc: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(45),s=r(91).defineKey,a=r(6),u=r(4),h={toJSON:!0,toObject:!0,_id:!0,id:!0};
/*!
* ignore
*/
t.exports=function(t,e,r,i,f){if(!r||!r.instanceOfSchema)throw new Error("You must pass a valid discriminator Schema");if(t.schema.discriminatorMapping&&!t.schema.discriminatorMapping.isRoot)throw new Error('Discriminator "'+e+'" can only be a discriminator of the root model');if(f){var c=a(t.base,"options.applyPluginsToDiscriminators",!1);t.base._applyPlugins(r,{skipTopLevel:!c})}var l=t.schema.options.discriminatorKey,d=t.schema.path(l);if(null!=d)u.hasUserDefinedProperty(d.options,"select")||(d.options.select=!0),d.options.$skipDiscriminatorCheck=!0;else{var p={};p[l]={default:void 0,select:!0,$skipDiscriminatorCheck:!0},p[l][t.schema.options.typeKey]=String,t.schema.add(p),s({prop:l,prototype:t.prototype,options:t.schema.options})}if(r.path(l)&&!0!==r.path(l).options.$skipDiscriminatorCheck)throw new Error('Discriminator "'+e+'" cannot have field with name "'+l+'"');var y=e;if(("string"==typeof i&&i.length||null!=i)&&(y=i),function(e,r){e._baseSchema=r,r.paths._id&&r.paths._id.options&&!r.paths._id.options.auto&&e.remove("_id");for(var i=[],s=0,a=Object.keys(r.paths);s<a.length;s++){var f=a[s];if(e.nested[f])i.push(f);else if(-1!==f.indexOf(".")){var c,p="",m=n(f.split(".").slice(0,-1));try{for(m.s();!(c=m.n()).done;){var b=c.value;p+=(p.length?".":"")+b,(e.paths[p]instanceof o||e.singleNestedPaths[p]instanceof o)&&i.push(f)}}catch(t){m.e(t)}finally{m.f()}}}u.merge(e,r,{isDiscriminatorSchemaMerge:!0,omit:{discriminators:!0,base:!0},omitNested:i.reduce((function(t,e){return t["tree."+e]=!0,t}),{})});for(var v=0,g=i;v<g.length;v++){var w=g[v];delete e.paths[w]}e.childSchemas.forEach((function(t){t.model.prototype.$__setSchema(t.schema)}));var _={};_[l]={default:y,select:!0,set:function(t){if(t===y||Array.isArray(y)&&u.deepEqual(t,y))return y;throw new Error("Can't set discriminator key \""+l+'"')},$skipDiscriminatorCheck:!0},_[l][e.options.typeKey]=d?d.options[e.options.typeKey]:String,e.add(_),e.discriminatorMapping={key:l,value:y,isRoot:!1},r.options.collection&&(e.options.collection=r.options.collection);var M=e.options.toJSON,S=e.options.toObject,O=e.options._id,A=e.options.id,E=Object.keys(e.options);e.options.discriminatorKey=r.options.discriminatorKey;for(var x=0,k=E;x<k.length;x++){var j=k[x];if(!h[j]){if("pluralization"===j&&1==e.options[j]&&null==r.options[j])continue;if(!u.deepEqual(e.options[j],r.options[j]))throw new Error("Can't customize discriminator option "+j+" (can only modify "+Object.keys(h).join(", ")+")")}}e.options=u.clone(r.options),M&&(e.options.toJSON=M),S&&(e.options.toObject=S),void 0!==O&&(e.options._id=O),e.options.id=A,e.s.hooks=t.schema.s.hooks.merge(e.s.hooks),e.plugins=Array.prototype.slice.call(r.plugins),e.callQueue=r.callQueue.concat(e.callQueue),delete e._requiredpaths}(r,t.schema),t.discriminators||(t.discriminators={}),t.schema.discriminatorMapping||(t.schema.discriminatorMapping={key:l,value:null,isRoot:!0}),t.schema.discriminators||(t.schema.discriminators={}),t.schema.discriminators[e]=r,t.discriminators[e]&&!r.options.overwriteModels)throw new Error('Discriminator with name "'+e+'" already exists');return r}},function(t,e,r){"use strict";var n=r(155);t.exports=function(t,e){return null==e||null==e._id||(t=t.clone(),e._id?t.paths._id||(n(t),t.options._id=!0):(t.remove("_id"),t.options._id=!1)),t}},function(t,e,r){"use strict";var n=r(57);
/*!
* Find the correct constructor, taking into account discriminators
*/t.exports=function(t,e){var r=t.schema.options.discriminatorKey;if(null!=e&&t.discriminators&&null!=e[r])if(t.discriminators[e[r]])t=t.discriminators[e[r]];else{var i=n(t.discriminators,e[r]);i&&(t=i)}return t}},function(t,e,r){"use strict";t.exports=r(176)},function(t,e,r){"use strict";(function(n){function i(t){return(i="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 o(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function s(t,e){return(s=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function a(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=h(t);if(e){var i=h(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return u(this,r)}}function u(t,e){if(e&&("object"===i(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function h(t){return(h=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}r(25).set(r(179));var f=r(274),c=r(148);f.setBrowser(!0),Object.defineProperty(e,"Promise",{get:function(){return c.get()},set:function(t){c.set(t)}}),e.PromiseProvider=c,e.Error=r(8),e.Schema=r(85),e.Types=r(58),e.VirtualType=r(86),e.SchemaType=r(10),e.utils=r(4),e.Document=f(),e.model=function(t,r){var n=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&s(t,e)}(h,t);var e,n,i,u=a(h);function h(t,e){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,h),u.call(this,t,r,e)}return e=h,n&&o(e.prototype,n),i&&o(e,i),Object.defineProperty(e,"prototype",{writable:!1}),e}(e.Document);return n.modelName=t,n},
/*!
* Module exports.
*/
"undefined"!=typeof window&&(window.mongoose=t.exports,window.Buffer=n)}).call(this,r(3).Buffer)},function(t,e,r){"use strict";e.byteLength=function(t){var e=h(t),r=e[0],n=e[1];return 3*(r+n)/4-n},e.toByteArray=function(t){var e,r,n=h(t),s=n[0],a=n[1],u=new o(function(t,e,r){return 3*(e+r)/4-r}(0,s,a)),f=0,c=a>0?s-4:s;for(r=0;r<c;r+=4)e=i[t.charCodeAt(r)]<<18|i[t.charCodeAt(r+1)]<<12|i[t.charCodeAt(r+2)]<<6|i[t.charCodeAt(r+3)],u[f++]=e>>16&255,u[f++]=e>>8&255,u[f++]=255&e;2===a&&(e=i[t.charCodeAt(r)]<<2|i[t.charCodeAt(r+1)]>>4,u[f++]=255&e);1===a&&(e=i[t.charCodeAt(r)]<<10|i[t.charCodeAt(r+1)]<<4|i[t.charCodeAt(r+2)]>>2,u[f++]=e>>8&255,u[f++]=255&e);return u},e.fromByteArray=function(t){for(var e,r=t.length,i=r%3,o=[],s=0,a=r-i;s<a;s+=16383)o.push(f(t,s,s+16383>a?a:s+16383));1===i?(e=t[r-1],o.push(n[e>>2]+n[e<<4&63]+"==")):2===i&&(e=(t[r-2]<<8)+t[r-1],o.push(n[e>>10]+n[e>>4&63]+n[e<<2&63]+"="));return o.join("")};for(var n=[],i=[],o="undefined"!=typeof Uint8Array?Uint8Array:Array,s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0,u=s.length;a<u;++a)n[a]=s[a],i[s.charCodeAt(a)]=a;function h(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 f(t,e,r){for(var i,o,s=[],a=e;a<r;a+=3)i=(t[a]<<16&16711680)+(t[a+1]<<8&65280)+(255&t[a+2]),s.push(n[(o=i)>>18&63]+n[o>>12&63]+n[o>>6&63]+n[63&o]);return s.join("")}i["-".charCodeAt(0)]=62,i["_".charCodeAt(0)]=63},function(t,e){
/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
e.read=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)},e.write=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,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=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*y}},function(t,e,r){"use strict";
/*!
* Module exports.
*/e.Binary=r(180),e.Collection=function(){throw new Error("Cannot create a collection from browser library")},e.getConnection=function(){return function(){throw new Error("Cannot create a connection from browser library")}},e.Decimal128=r(271),e.ObjectId=r(272),e.ReadPreference=r(273)},function(t,e,r){"use strict";
/*!
* Module dependencies.
*/var n=r(59).Binary;
/*!
* Module exports.
*/t.exports=n},function(t,e,r){"use strict";e.randomBytes=e.rng=e.pseudoRandomBytes=e.prng=r(28),e.createHash=e.Hash=r(35),e.createHmac=e.Hmac=r(110);var n=r(206),i=Object.keys(n),o=["sha1","sha224","sha256","sha384","sha512","md5","rmd160"].concat(i);e.getHashes=function(){return o};var s=r(113);e.pbkdf2=s.pbkdf2,e.pbkdf2Sync=s.pbkdf2Sync;var a=r(208);e.Cipher=a.Cipher,e.createCipher=a.createCipher,e.Cipheriv=a.Cipheriv,e.createCipheriv=a.createCipheriv,e.Decipher=a.Decipher,e.createDecipher=a.createDecipher,e.Decipheriv=a.Decipheriv,e.createDecipheriv=a.createDecipheriv,e.getCiphers=a.getCiphers,e.listCiphers=a.listCiphers;var u=r(223);e.DiffieHellmanGroup=u.DiffieHellmanGroup,e.createDiffieHellmanGroup=u.createDiffieHellmanGroup,e.getDiffieHellman=u.getDiffieHellman,e.createDiffieHellman=u.createDiffieHellman,e.DiffieHellman=u.DiffieHellman;var h=r(230);e.createSign=h.createSign,e.Sign=h.Sign,e.createVerify=h.createVerify,e.Verify=h.Verify,e.createECDH=r(263);var f=r(266);e.publicEncrypt=f.publicEncrypt,e.privateEncrypt=f.privateEncrypt,e.publicDecrypt=f.publicDecrypt,e.privateDecrypt=f.privateDecrypt;var c=r(270);e.randomFill=c.randomFill,e.randomFillSync=c.randomFillSync,e.createCredentials=function(){throw new Error(["sorry, createCredentials is not implemented yet","we accept pull requests","https://github.com/crypto-browserify/crypto-browserify"].join("\n"))},e.constants={DH_CHECK_P_NOT_SAFE_PRIME:2,DH_CHECK_P_NOT_PRIME:1,DH_UNABLE_TO_CHECK_GENERATOR:4,DH_NOT_SUITABLE_GENERATOR:8,NPN_ENABLED:1,ALPN_ENABLED:1,RSA_PKCS1_PADDING:1,RSA_SSLV23_PADDING:2,RSA_NO_PADDING:3,RSA_PKCS1_OAEP_PADDING:4,RSA_X931_PADDING:5,RSA_PKCS1_PSS_PADDING:6,POINT_CONVERSION_COMPRESSED:2,POINT_CONVERSION_UNCOMPRESSED:4,POINT_CONVERSION_HYBRID:6}},function(t,e,r){
/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
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){},function(t,e,r){"use strict";function n(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function i(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function o(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}var s=r(3).Buffer,a=r(185).inspect,u=a&&a.custom||"inspect";t.exports=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.head=null,this.tail=null,this.length=0}var e,r,h;return e=t,(r=[{key:"push",value:function(t){var e={data:t,next:null};this.length>0?this.tail.next=e:this.head=e,this.tail=e,++this.length}},{key:"unshift",value:function(t){var e={data:t,next:this.head};0===this.length&&(this.tail=e),this.head=e,++this.length}},{key:"shift",value:function(){if(0!==this.length){var t=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,t}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(t){if(0===this.length)return"";for(var e=this.head,r=""+e.data;e=e.next;)r+=t+e.data;return r}},{key:"concat",value:function(t){if(0===this.length)return s.alloc(0);for(var e,r,n,i=s.allocUnsafe(t>>>0),o=this.head,a=0;o;)e=o.data,r=i,n=a,s.prototype.copy.call(e,r,n),a+=o.data.length,o=o.next;return i}},{key:"consume",value:function(t,e){var r;return t<this.head.data.length?(r=this.head.data.slice(0,t),this.head.data=this.head.data.slice(t)):r=t===this.head.data.length?this.shift():e?this._getString(t):this._getBuffer(t),r}},{key:"first",value:function(){return this.head.data}},{key:"_getString",value:function(t){var e=this.head,r=1,n=e.data;for(t-=n.length;e=e.next;){var i=e.data,o=t>i.length?i.length:t;if(o===i.length?n+=i:n+=i.slice(0,t),0==(t-=o)){o===i.length?(++r,e.next?this.head=e.next:this.head=this.tail=null):(this.head=e,e.data=i.slice(o));break}++r}return this.length-=r,n}},{key:"_getBuffer",value:function(t){var e=s.allocUnsafe(t),r=this.head,n=1;for(r.data.copy(e),t-=r.data.length;r=r.next;){var i=r.data,o=t>i.length?i.length:t;if(i.copy(e,e.length-t,0,o),0==(t-=o)){o===i.length?(++n,r.next?this.head=r.next:this.head=this.tail=null):(this.head=r,r.data=i.slice(o));break}++n}return this.length-=n,e}},{key:u,value:function(t,e){return a(this,function(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?n(Object(r),!0).forEach((function(e){i(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):n(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}({},e,{depth:0,customInspect:!1}))}}])&&o(e.prototype,r),h&&o(e,h),t}()},function(t,e){},function(t,e,r){
/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
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";(function(e){var n;function i(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var o=r(61),s=Symbol("lastResolve"),a=Symbol("lastReject"),u=Symbol("error"),h=Symbol("ended"),f=Symbol("lastPromise"),c=Symbol("handlePromise"),l=Symbol("stream");function d(t,e){return{value:t,done:e}}function p(t){var e=t[s];if(null!==e){var r=t[l].read();null!==r&&(t[f]=null,t[s]=null,t[a]=null,e(d(r,!1)))}}function y(t){e.nextTick(p,t)}var m=Object.getPrototypeOf((function(){})),b=Object.setPrototypeOf((i(n={get stream(){return this[l]},next:function(){var t=this,r=this[u];if(null!==r)return Promise.reject(r);if(this[h])return Promise.resolve(d(void 0,!0));if(this[l].destroyed)return new Promise((function(r,n){e.nextTick((function(){t[u]?n(t[u]):r(d(void 0,!0))}))}));var n,i=this[f];if(i)n=new Promise(function(t,e){return function(r,n){t.then((function(){e[h]?r(d(void 0,!0)):e[c](r,n)}),n)}}(i,this));else{var o=this[l].read();if(null!==o)return Promise.resolve(d(o,!1));n=new Promise(this[c])}return this[f]=n,n}},Symbol.asyncIterator,(function(){return this})),i(n,"return",(function(){var t=this;return new Promise((function(e,r){t[l].destroy(null,(function(t){t?r(t):e(d(void 0,!0))}))}))})),n),m);t.exports=function(t){var e,r=Object.create(b,(i(e={},l,{value:t,writable:!0}),i(e,s,{value:null,writable:!0}),i(e,a,{value:null,writable:!0}),i(e,u,{value:null,writable:!0}),i(e,h,{value:t._readableState.endEmitted,writable:!0}),i(e,c,{value:function(t,e){var n=r[l].read();n?(r[f]=null,r[s]=null,r[a]=null,t(d(n,!1))):(r[s]=t,r[a]=e)},writable:!0}),e));return r[f]=null,o(t,(function(t){if(t&&"ERR_STREAM_PREMATURE_CLOSE"!==t.code){var e=r[a];return null!==e&&(r[f]=null,r[s]=null,r[a]=null,e(t)),void(r[u]=t)}var n=r[s];null!==n&&(r[f]=null,r[s]=null,r[a]=null,n(d(void 0,!0))),r[h]=!0})),t.on("readable",y.bind(null,r)),r}}).call(this,r(5))},function(t,e){t.exports=function(){throw new Error("Readable.from is not available in the browser")}},function(t,e,r){"use strict";t.exports=i;var n=r(102);function i(t){if(!(this instanceof i))return new i(t);n.call(this,t)}r(0)(i,n),i.prototype._transform=function(t,e,r){r(null,t)}},function(t,e,r){"use strict";var n;var i=r(29).codes,o=i.ERR_MISSING_ARGS,s=i.ERR_STREAM_DESTROYED;function a(t){if(t)throw t}function u(t,e,i,o){o=function(t){var e=!1;return function(){e||(e=!0,t.apply(void 0,arguments))}}(o);var a=!1;t.on("close",(function(){a=!0})),void 0===n&&(n=r(61)),n(t,{readable:e,writable:i},(function(t){if(t)return o(t);a=!0,o()}));var u=!1;return function(e){if(!a&&!u)return u=!0,function(t){return t.setHeader&&"function"==typeof t.abort}(t)?t.abort():"function"==typeof t.destroy?t.destroy():void o(e||new s("pipe"))}}function h(t){t()}function f(t,e){return t.pipe(e)}function c(t){return t.length?"function"!=typeof t[t.length-1]?a:t.pop():a}t.exports=function(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];var n,i=c(e);if(Array.isArray(e[0])&&(e=e[0]),e.length<2)throw new o("streams");var s=e.map((function(t,r){var o=r<e.length-1;return u(t,o,r>0,(function(t){n||(n=t),t&&s.forEach(h),o||(s.forEach(h),i(n))}))}));return e.reduce(f)}},function(t,e,r){var n=r(0),i=r(31),o=r(2).Buffer,s=[1518500249,1859775393,-1894007588,-899497514],a=new Array(80);functio
/*!
* ignore
*/t.exports=r(59).Decimal128},function(t,e,r){"use strict";
/*!
* [node-mongodb-native](https://github.com/mongodb/node-mongodb-native) ObjectId
* @constructor NodeMongoDbObjectId
* @see ObjectId
*/var n=r(59).ObjectID;
/*!
* Getter for convenience with populate, see gh-6115
*/Object.defineProperty(n.prototype,"_id",{enumerable:!1,configurable:!0,get:function(){return this}}),
/*!
* ignore
*/
t.exports=n},function(t,e,r){"use strict";
/*!
* ignore
*/t.exports=function(){}},function(t,e,r){"use strict";
/*!
* Module dependencies.
*/var n=r(14),i=r(353),o=!1;t.exports=function(){return o?i:n},
/*!
* ignore
*/
t.exports.setBrowser=function(t){o=t}},function(t,e,r){"use strict";
/*!
* Dependencies
*/var n=r(276).ctor("require","modify","init","default","ignore");function i(){this.activePaths=new n,this.strictMode=void 0}t.exports=i,i.prototype.fullPath=void 0,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.ownerDocument=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";
/*!
* Module dependencies.
*/r(4);
/*!
* StateMachine represents a minimal `interface` for the
* constructors it builds via StateMachine.ctor(...).
*
* @api private
*/var n=t.exports=function(){};
/*!
* StateMachine.ctor('state1', 'state2', ...)
* A factory method for subclassing StateMachine.
* The arguments are a list of states. For each state,
* the constructor's prototype gets state transition
* methods named after each state. These transition methods
* place their path argument into the given state.
*
* @param {String} state
* @param {String} [state]
* @return {Function} subclass constructor
* @private
*/
n.ctor=function(){var t=Array.prototype.slice.call(arguments),e=function(){n.apply(this,arguments),this.paths={},this.states={},this.stateNames=t;for(var e,r=t.length;r--;)e=t[r],this.states[e]={}};return e.prototype=new n,t.forEach((function(t){e.prototype[t]=function(e){this._changeState(e,t)}})),e},
/*!
* This function is wrapped by the state change functions:
*
* - `require(path)`
* - `modify(path)`
* - `init(path)`
*
* @api private
*/
n.prototype._changeState=function(t,e){var r=this.states[this.paths[t]];r&&delete r[t],this.paths[t]=e,this.states[e][t]=!0},
/*!
* ignore
*/
n.prototype.clear=function(t){for(var e,r=Object.keys(this.states[t]),n=r.length;n--;)e=r[n],delete this.states[t][e],delete this.paths[e]},
/*!
* Checks to see if at least one path is in the states passed in via `arguments`
* e.g., this.some('required', 'inited')
*
* @param {String} state that we want to check for.
* @private
*/
n.prototype.some=function(){var t=this,e=arguments.length?arguments:this.stateNames;return Array.prototype.some.call(e,(function(e){return Object.keys(t.states[e]).length}))},
/*!
* This function builds the functions that get assigned to `forEach` and `map`,
* since both of those methods share a lot of the same logic.
*
* @param {String} iterMethod is either 'forEach' or 'map'
* @return {Function}
* @api private
*/
n.prototype._iter=function(t){return function(){var e=Array.prototype.slice.call(arguments),r=e.pop();e.length||(e=this.stateNames);var n=this,i=e.reduce((function(t,e){return t.concat(Object.keys(n.states[e]))}),[]);return i[t]((function(t,e,n){return r(t,e,n)}))}},
/*!
* Iterates over the paths that belong to one of the parameter states.
*
* The function profile can look like:
* this.forEach(state1, fn); // iterates over all paths in state1
* this.forEach(state1, state2, fn); // iterates over all paths in state1 or state2
* this.forEach(fn); // iterates over all paths in all states
*
* @param {String} [state]
* @param {String} [state]
* @param {Function} callback
* @private
*/
n.prototype.forEach=function(){return this.forEach=this._iter("forEach"),this.forEach.apply(this,arguments)},
/*!
* Maps over the paths that belong to one of the parameter states.
*
* The function profile can look like:
* this.forEach(state1, fn); // iterates over all paths in state1
* this.forEach(state1, state2, fn); // iterates over all paths in state1 or state2
* this.forEach(fn); // iterates over all paths in all states
*
* @param {String} [state]
* @param {String} [state]
* @param {Function} callback
* @return {Array}
* @private
*/
n.prototype.map=function(){return this.map=this._iter("map"),this.map.apply(this,arguments)}},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=r(278),o=["__proto__","constructor","prototype"];
/*!
* Returns the value passed to it.
*/
function s(t){return t}e.get=function(t,r,o,a){var u;"function"==typeof o&&(o.length<2?(a=o,o=void 0):(u=o,o=void 0)),a||(a=s);var h="string"==typeof t?i(t):t;if(!Array.isArray(h))throw new TypeError("Invalid `path`. Must be either string or array");for(var f,c=r,l=0;l<h.length;++l){if(f=h[l],"string"!=typeof h[l]&&"number"!=typeof h[l])throw new TypeError("Each segment of path to `get()` must be a string or number, got "+n(h[l]));if(Array.isArray(c)&&!/^\d+$/.test(f)){var d=h.slice(l);return[].concat(c).map((function(t){return t?e.get(d,t,o||u,a):a(void 0)}))}if(u)c=u(c,f);else{var p=o&&c[o]?c[o]:c;c=p instanceof Map?p.get(f):p[f]}if(!c)return a(c)}return a(c)},e.has=function(t,e){var r="string"==typeof t?i(t):t;if(!Array.isArray(r))throw new TypeError("Invalid `path`. Must be either string or array");for(var o=r.length,s=e,a=0;a<o;++a){if("string"!=typeof r[a]&&"number"!=typeof r[a])throw new TypeError("Each segment of path to `has()` must be a string or number, got "+n(r[a]));if(null==s||"object"!==n(s)||!(r[a]in s))return!1;s=s[r[a]]}return!0},e.unset=function(t,e){var r="string"==typeof t?i(t):t;if(!Array.isArray(r))throw new TypeError("Invalid `path`. Must be either string or array");for(var s=r.length,a=e,u=0;u<s;++u){if(null==a||"object"!==n(a)||!(r[u]in a))return!1;if("string"!=typeof r[u]&&"number"!=typeof r[u])throw new TypeError("Each segment of path to `unset()` must be a string or number, got "+n(r[u]));if(-1!==o.indexOf(r[u]))return!1;if(u===s-1)return delete a[r[u]],!0;a=a instanceof Map?a.get(r[u]):a[r[u]]}return!0},e.set=function(t,r,a,u,h,f){var c;"function"==typeof u&&(u.length<2?(h=u,u=void 0):(c=u,u=void 0)),h||(h=s);var l="string"==typeof t?i(t):t;if(!Array.isArray(l))throw new TypeError("Invalid `path`. Must be either string or array");if(null!=a){for(var d=0;d<l.length;++d){if("string"!=typeof l[d]&&"number"!=typeof l[d])throw new TypeError("Each segment of path to `set()` must be a string or number, got "+n(l[d]));if(-1!==o.indexOf(l[d]))return}for(var p,y=f||/\$/.test(t)&&!1!==f,m=a,b=(d=0,l.length-1);d<b;++d)if("$"!=(p=l[d])){if(Array.isArray(m)&&!/^\d+$/.test(p)){var v=l.slice(d);if(!y&&Array.isArray(r))for(var g=0;g<m.length&&g<r.length;++g)e.set(v,r[g],m[g],u||c,h,y);else for(g=0;g<m.length;++g)e.set(v,r,m[g],u||c,h,y);return}if(c)m=c(m,p);else{var w=u&&m[u]?m[u]:m;m=w instanceof Map?w.get(p):w[p]}if(!m)return}else if(d==b-1)break;if(p=l[b],u&&m[u]&&(m=m[u]),Array.isArray(m)&&!/^\d+$/.test(p))if(!y&&Array.isArray(r))!
/*!
* Recursively set nested arrays
*/
function t(e,r,n,i,o,s){for(var a,u=0;u<e.length&&u<r.length;++u)a=e[u],Array.isArray(a)&&Array.isArray(r[u])?t(a,r[u],n,i,o,s):a&&(i?i(a,n,s(r[u])):(a[o]&&(a=a[o]),a[n]=s(r[u])))}(m,r,p,c,u,h);else for(g=0;g<m.length;++g){var _=m[g];_&&(c?c(_,p,h(r)):(_[u]&&(_=_[u]),_[p]=h(r)))}else c?c(m,p,h(r)):m instanceof Map?m.set(p,h(r)):m[p]=h(r)}}},function(t,e,r){"use strict";t.exports=function(t){for(var e=[],r="",n="DEFAULT",i=0;i<t.length;++i)"IN_SQUARE_BRACKETS"!==n||/\d/.test(t[i])||"]"===t[i]||(n="DEFAULT",r=e[e.length-1]+"["+r,e.splice(e.length-1,1)),"["===t[i]?("IMMEDIATELY_AFTER_SQUARE_BRACKETS"!==n&&(e.push(r),r=""),n="IN_SQUARE_BRACKETS"):"]"===t[i]?"IN_SQUARE_BRACKETS"===n?(n="IMMEDIATELY_AFTER_SQUARE_BRACKETS",e.push(r),r=""):(n="DEFAULT",r+=t[i]):"."===t[i]?("IMMEDIATELY_AFTER_SQUARE_BRACKETS"!==n&&(e.push(r),r=""),n="DEFAULT"):r+=t[i];return"IMMEDIATELY_AFTER_SQUARE_BRACKETS"!==n&&e.push(r),e}},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)}function i(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function o(t,e,r){return e&&i(t.prototype,e),r&&i(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}var s=r(41),a=o((function t(e){if(function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this._docs={},this._childDocs=[],null!=e&&(e=s(e),Object.assign(this,e),"object"===n(e.subPopulate)&&(this.populate=e.subPopulate),null!=e.perDocumentLimit&&null!=e.limit))throw new Error("Can not use `limit` and `perDocumentLimit` at the same time. Path: `"+e.path+"`.")}));t.exports=a},function(t,e,r){"use strict";e.isMongooseDocumentArray=function(t){return Array.isArray(t)&&t.isMongooseDocumentArray}},function(t,e,r){"use strict";
/*
object-assign
(c) Sindre Sorhus
@license MIT
*/var n=Object.getOwnPropertySymbols,i=Object.prototype.hasOwnProperty,o=Object.prototype.propertyIsEnumerable;function s(t){if(null==t)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(t)}t.exports=function(){try{if(!Object.assign)return!1;var t=new String("abc");if(t[5]="de","5"===Object.getOwnPropertyNames(t)[0])return!1;for(var e={},r=0;r<10;r++)e["_"+String.fromCharCode(r)]=r;if("0123456789"!==Object.getOwnPropertyNames(e).map((function(t){return e[t]})).join(""))return!1;var n={};return"abcdefghijklmnopqrst".split("").forEach((function(t){n[t]=t})),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},n)).join("")}catch(t){return!1}}()?Object.assign:function(t,e){for(var r,a,u=s(t),h=1;h<arguments.length;h++){for(var f in r=Object(arguments[h]))i.call(r,f)&&(u[f]=r[f]);if(n){a=n(r);for(var c=0;c<a.length;c++)o.call(r,a[c])&&(u[a[c]]=r[a[c]])}}return u}},function(t,e){function r(t){return(r="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)}t.exports=function(t){return t&&"object"===r(t)&&"function"==typeof t.copy&&"function"==typeof t.fill&&"function"==typeof t.readUInt8}},function(t,e){"function"==typeof Object.create?t.exports=function(t,e){t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}})}:t.exports=function(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=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}function o(t){return(o="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 s=r(43),a=r(9),u=r(285),h=r(286)("mquery");function f(t,e){if(!(this instanceof f))return new f(t,e);var r=this.constructor.prototype;this.op=r.op||void 0,this.options=Object.assign({},r.options),this._conditions=r._conditions?u.clone(r._conditions):{},this._fields=r._fields?u.clone(r._fields):void 0,this._update=r._update?u.clone(r._update):void 0,this._path=r._path||void 0,this._distinct=r._distinct||void 0,this._collection=r._collection||void 0,this._traceFunction=r._traceFunction||void 0,e&&this.setOptions(e),t&&(t.find&&t.remove&&t.update?this.collection(t):this.find(t))}var c="$geoWithin";Object.defineProperty(f,"use$geoWithin",{get:function(){return"$geoWithin"==c},set:function(t){c=!0===t?"$geoWithin":"$within"}}),f.prototype.toConstructor=function(){function t(e,r){if(!(this instanceof t))return new t(e,r);f.call(this,e,r)}u.inherits(t,f);var e=t.prototype;return e.options={},e.setOptions(this.options),e.op=this.op,e._conditions=u.clone(this._conditions),e._fields=u.clone(this._fields),e._update=u.clone(this._update),e._path=this._path,e._distinct=this._distinct,e._collection=this._collection,e._traceFunction=this._traceFunction,t},f.prototype.setOptions=fun
/*!
* gt, gte, lt, lte, ne, in, nin, all, regex, size, maxDistance
*
* Thing.where('type').nin(array)
*/
"gt gte lt lte ne in nin all regex size maxDistance minDistance".split(" ").forEach((function(t){f.prototype[t]=function(){var e,r;1===arguments.length?(this._ensurePath(t),r=arguments[0],e=this._path):(r=arguments[1],e=arguments[0]);var n=null===this._conditions[e]||"object"===o(this._conditions[e])?this._conditions[e]:this._conditions[e]={};return n["$"+t]=r,this}})),f.prototype.mod=function(){var t,e;1===arguments.length?(this._ensurePath("mod"),t=arguments[0],e=this._path):2!==arguments.length||Array.isArray(arguments[1])?3===arguments.length?(t=[arguments[1],arguments[2]],e=arguments[0]):(t=arguments[1],e=arguments[0]):(this._ensurePath("mod"),t=[arguments[0],arguments[1]],e=this._path);var r=this._conditions[e]||(this._conditions[e]={});return r.$mod=t,this},f.prototype.exists=function(){var t,e;0===arguments.length?(this._ensurePath("exists"),t=this._path,e=!0):1===arguments.length?"boolean"==typeof arguments[0]?(this._ensurePath("exists"),t=this._path,e=arguments[0]):(t=arguments[0],e=!0):2===arguments.length&&(t=arguments[0],e=arguments[1]);var r=this._conditions[t]||(this._conditions[t]={});return r.$exists=e,this},f.prototype.elemMatch=function(){if(null==arguments[0])throw new TypeError("Invalid argument");var t,e,r;if("function"==typeof arguments[0])this._ensurePath("elemMatch"),e=this._path,t=arguments[0];else if(u.isObject(arguments[0]))this._ensurePath("elemMatch"),e=this._path,r=arguments[0];else if("function"==typeof arguments[1])e=arguments[0],t=arguments[1];else{if(!arguments[1]||!u.isObject(arguments[1]))throw new TypeError("Invalid argument");e=arguments[0],r=arguments[1]}t&&(t(r=new f),r=r._conditions);var n=this._conditions[e]||(this._conditions[e]={});return n.$elemMatch=r,this},f.prototype.within=function(){if(this._ensurePath("within"),this._geoComparison=c,0===arguments.length)return this;if(2===arguments.length)return this.box.apply(this,arguments);if(2<arguments.length)return this.polygon.apply(this,arguments);var t=arguments[0];if(!t)throw new TypeError("Invalid argument");if(t.center)return this.circle(t);if(t.box)return this.box.apply(this,t.box);if(t.polygon)return this.polygon.apply(this,t.polygon);if(t.type&&t.coordinates)return this.geometry(t);throw new TypeError("Invalid argument")},f.prototype.box=function(){var t,e;if(3===arguments.length)t=arguments[0],e=[arguments[1],arguments[2]];else{if(2!==arguments.length)throw new TypeError("Invalid argument");this._ensurePath("box"),t=this._path,e=[arguments[0],arguments[1]]}var r=this._conditions[t]||(this._conditions[t]={});return r[this._geoComparison||c]={$box:e},this},f.prototype.polygon=function(){var t,e;"string"==typeof arguments[0]?e=(t=Array.from(arguments)).shift():(this._ensurePath("polygon"),e=this._path,t=Array.from(arguments));var r=this._conditions[e]||(this._conditions[e]={});return r[this._geoComparison||c]={$polygon:t},this},f.prototype.circle=function(){var t,e;if(1===arguments.length)this._ensurePath("circle"),t=this._path,e=arguments[0];else{if(2!==arguments.length)throw new TypeError("Invalid argument");t=arguments[0],e=arguments[1]}if(!("radius"in e)||!e.center)throw new Error("center and radius are required");var r=this._conditions[t]||(this._conditions[t]={}),n=e.spherical?"$centerSphere":"$center",i=this._geoComparison||c;return r[i]={},r[i][n]=[e.center,e.radius],"unique"in e&&(r[i].$uniqueDocs=!!e.unique),this},f.prototype.near=function(){var t,e;if(this._geoComparison="$near",0===arguments.length)return this;if(1===arguments.length)this._ensurePath("near"),t=this._path,e=arguments[0];else{if(2!==arguments.length)throw new TypeError("Invalid argument");t=arguments[0],e=arguments[1]}if(!e.center)throw new Error("center is required");var r=this._conditions[t]||(this._conditions[t]={}),n=e.spherical?"$nearSphere":"$near";if(Array.isArray(e.center)){r[n]=e.center;var i="maxDistance"in e?e.maxDistance:null;null!=i&&(r.$maxDistance=i),null!=e.minDistance&&(r.$minDistance=e.minDistance)}else{if("Point"!=e.center.type||!Array.isArray(e.center.coordinates))throw new Error(a.format("Invalid GeoJSON specified for %s",n))
/*!
* @ignore
*/
var l={1:1,"-1":-1,asc:1,ascending:1,desc:-1,descending:-1};function d(t,e,r){if(Array.isArray(t.sort))throw new TypeError("Can't mix sort syntaxes. Use either array or object:\n- `.sort([['field', 1], ['test', -1]])`\n- `.sort({ field: 1, test: -1 })`");var n;if(r&&r.$meta)(n=t.sort||(t.sort={}))[e]={$meta:r.$meta};else{n=t.sort||(t.sort={});var i=String(r||1).toLowerCase();if(!(i=l[i]))throw new TypeError("Invalid sort value: { "+e+": "+r+" }");n[e]=i}}function p(t,e,r){if(t.sort=t.sort||[],!Array.isArray(t.sort))throw new TypeError("Can't mix sort syntaxes. Use either array or object:\n- `.sort([['field', 1], ['test', -1]])`\n- `.sort({ field: 1, test: -1 })`");var n=String(r||1).toLowerCase();if(!(n=l[n]))throw new TypeError("Invalid sort value: [ "+e+", "+r+" ]");t.sort.push([e,n])}function y(t,e){if(t.sort=t.sort||new Map,!(t.sort instanceof Map))throw new TypeError("Can't mix sort syntaxes. Use either array or object or map consistently");e.forEach((function(e,r){var n=String(e||1).toLowerCase();if(!(n=l[n]))throw new TypeError("Invalid sort value: < "+r+": "+e+" >");t.sort.set(r,n)}))}
/*!
* limit, skip, maxScan, batchSize, comment
*
* Sets these associated options.
*
* query.comment('feed query');
*/
/*!
* Internal helper for update, updateMany, updateOne
*/
function m(t,e,r,n,i,o,s){return t.op=e,f.canMerge(r)&&t.merge(r),n&&t._mergeUpdate(n),u.isObject(i)&&t.setOptions(i),o||s?!t._update||!t.options.overwrite&&0===u.keys(t._update).length?(s&&u.soon(s.bind(null,null,0)),t):(i=t._optionsForExec(),s||(i.safe=!1),r=t._conditions,n=t._updateForExec(),h("update",t._collection.collectionName,r,n,i),s=t._wrapCallback(e,s,{conditions:r,doc:n,options:i}),t._collection[e](r,n,i,u.tick(s)),t):t}["limit","skip","maxScan","batchSize","comment"].forEach((function(t){f.prototype[t]=function(e){return this._validate(t),this.options[t]=e,this}})),f.prototype.maxTime=f.prototype.maxTimeMS=function(t){return this._validate("maxTime"),this.options.maxTimeMS=t,this},f.prototype.snapshot=function(){return this._validate("snapshot"),this.options.snapshot=!arguments.length||!!arguments[0],this},f.prototype.hint=function(){if(0===arguments.length)return this;this._validate("hint");var t=arguments[0];if(u.isObject(t)){var e=this.options.hint||(this.options.hint={});for(var r in t)e[r]=t[r];return this}if("string"==typeof t)return this.options.hint=t,this;throw new TypeError("Invalid hint. "+t)},f.prototype.j=function(t){return this.options.j=t,this},f.prototype.slaveOk=function(t){return this.options.slaveOk=!arguments.length||!!t,this},f.prototype.read=f.prototype.setReadPreference=function(t){return arguments.length>1&&!f.prototype.read.deprecationWarningIssued&&(console.error("Deprecation warning: 'tags' argument is not supported anymore in Query.read() method. Please use mongodb.ReadPreference object instead."),f.prototype.read.deprecationWarningIssued=!0),this.options.readPreference=u.readPref(t),this},f.prototype.readConcern=f.prototype.r=function(t){return this.options.readConcern=u.readConcern(t),this},f.prototype.tailable=function(){return this._validate("tailable"),this.options.tailable=!arguments.length||!!arguments[0],this},f.prototype.writeConcern=f.prototype.w=function(t){return"object"===o(t)?(void 0!==t.j&&(this.options.j=t.j),void 0!==t.w&&(this.options.w=t.w),void 0!==t.wtimeout&&(this.options.wtimeout=t.wtimeout)):this.options.w="m"===t?"majority":t,this},f.prototype.wtimeout=f.prototype.wTimeout=function(t){return this.options.wtimeout=t,this},f.prototype.merge=function(t){if(!t)return this;if(!f.canMerge(t))throw new TypeError("Invalid argument. Expected instanceof mquery or plain object");return t instanceof f?(t._conditions&&u.merge(this._conditions,t._conditions),t._fields&&(this._fields||(this._fields={}),u.merge(this._fields,t._fields)),t.options&&(this.options||(this.options={}),u.merge(this.options,t.options)),t._update&&(this._update||(this._update={}),u.mergeClone(this._update,t._update)),t._distinct&&(this._distinct=t._distinct),this):(u.merge(this._conditions,t),this)},f.prototype.find=function(t,e){if(this.op="find","function"==typeof t?(e=t,t=void 0):f.canMerge(t)&&this.merge(t),!e)return this;var r=this._conditions,n=this._optionsForExec();return this.$useProjection?n.projection=this._fieldsForExec():n.fields=this._fieldsForExec(),h("find",this._collection.collectionName,r,n),e=this._wrapCallback("find",e,{conditions:r,options:n}),this._collection.find(r,n,u.tick(e)),this},f.prototype.cursor=function(t){if(this.op){if("find"!==this.op)throw new TypeError(".cursor only support .find method")}else this.find(t);var e=this._conditions,r=this._optionsForExec();return this.$useProjection?r.projection=this._fieldsForExec():r.fields=this._fieldsForExec(),h("findCursor",this._collection.collectionName,e,r),this._collection.findCursor(e,r)},f.prototype.findOne=function(t,e){if(this.op="findOne","function"==typeof t?(e=t,t=void 0):f.canMerge(t)&&this.merge(t),!e)return this;var r=this._conditions,n=this._optionsForExec();return this.$useProjection?n.projection=this._fieldsForExec():n.fields=this._fieldsForExec(),h("findOne",this._collection.collectionName,r,n),e=this._wrapCallback("findOne",e,{conditions:r,options:n}),this._collection.findOne(r,n,u.tick(e)),this},f.prototype.count=function(t,e){if(this.op="count",this._validate(),"function"==typeof t?(e=t,t=void 0):f.canMer
/*!
* Permissions
*/
f.permissions=r(288),f._isPermitted=function(t,e){var r=f.permissions[e];return!r||!0!==r[t]},f.prototype._validate=function(t){var e,r;if(void 0===t){if("function"!=typeof(r=f.permissions[this.op]))return!0;e=r(this)}else f._isPermitted(t,this.op)||(e=t);if(e)throw new Error(e+" cannot be used with "+this.op)},f.canMerge=function(t){return t instanceof f||u.isObject(t)},f.setGlobalTraceFunction=function(t){f.traceFunction=t},
/*!
* Exports.
*/
f.utils=u,f.env=r(149),f.Collection=r(289),f.BaseCollection=r(54),f.Promise=Promise,t.exports=f},function(t,e,r){"use strict";(function(t,r,n){
/*!
* Module dependencies.
*/
var i=["__proto__","constructor","prototype"],o=e.clone=function r(n,i){if(null==n)return n;if(Array.isArray(n))return e.cloneArray(n,i);if(n.constructor){if(/ObjectI[dD]$/.test(n.constructor.name))return"function"==typeof n.clone?n.clone():new n.constructor(n.id);if("ReadPreference"===n.constructor.name)return new n.constructor(n.mode,r(n.tags,i));if("Binary"==n._bsontype&&n.buffer&&n.value)return"function"==typeof n.clone?n.clone():new n.constructor(n.value(!0),n.sub_type);if("Date"===n.constructor.name||"Function"===n.constructor.name)return new n.constructor(+n);if("RegExp"===n.constructor.name)return new RegExp(n);if("Buffer"===n.constructor.name)return t.from(n)}return a(n)?e.cloneObject(n,i):n.valueOf?n.valueOf():void 0};
/*!
* ignore
*/
e.cloneObject=function(t,e){var r,n=e&&e.minimize,s={},a=Object.keys(t),u=a.length,h=!1,f="",c=0;for(c=0;c<u;++c)f=a[c],-1===i.indexOf(f)&&(r=o(t[f],e),n&&void 0===r||(h||(h=!0),s[f]=r));return n?h&&s:s},e.cloneArray=function(t,e){for(var r=[],n=t.length,i=0;i<n;i++)r.push(o(t[i],e));return r},e.tick=function(t){if("function"==typeof t)return function(){var e=arguments;u((function(){t.apply(this,e)}))}},e.merge=function t(r,n){for(var o=0,s=Object.keys(n);o<s.length;o++){var a=s[o];-1===i.indexOf(a)&&(void 0===r[a]?r[a]=n[a]:e.isObject(n[a])?t(r[a],n[a]):r[a]=n[a])}},e.mergeClone=function t(r,n){for(var s=0,a=Object.keys(n);s<a.length;s++){var u=a[s];-1===i.indexOf(u)&&(void 0===r[u]?r[u]=o(n[u]):e.isObject(n[u])?t(r[u],n[u]):r[u]=o(n[u]))}},e.readPref=function(t){switch(t){case"p":t="primary";break;case"pp":t="primaryPreferred";break;case"s":t="secondary";break;case"sp":t="secondaryPreferred";break;case"n":t="nearest"}return t},e.readConcern=function(t){if("string"==typeof t){switch(t){case"l":t="local";break;case"a":t="available";break;case"m":t="majority";break;case"lz":t="linearizable";break;case"s":t="snapshot"}t={level:t}}return t};var s=Object.prototype.toString;e.toString=function(t){return s.call(t)};var a=e.isObject=function(t){return"[object Object]"==e.toString(t)};e.keys=Object.keys,e.create="function"==typeof Object.create?Object.create:function(t){if(arguments.length>1)throw new Error("Adding properties is not supported");function e(){}return e.prototype=t,new e},e.inherits=function(t,r){t.prototype=e.create(r.prototype),t.prototype.constructor=t};var u=e.soon="function"==typeof r?r:n.nextTick;e.isArgumentsObject=function(t){return"[object Arguments]"===Object.prototype.toString.call(t)}}).call(this,r(3).Buffer,r(108).setImmediate,r(5))},function(t,e,r){(function(n){var i;e.formatArgs=function(e){if(e[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+e[0]+(this.useColors?"%c ":" ")+"+"+t.exports.humanize(this.diff),!this.useColors)return;var r="color: "+this.color;e.splice(1,0,r,"color: inherit");var n=0,i=0;e[0].replace(/%[a-zA-Z%]/g,(function(t){"%%"!==t&&(n++,"%c"===t&&(i=n))})),e.splice(i,0,r)},e.save=function(t){try{t?e.storage.setItem("debug",t):e.storage.removeItem("debug")}catch(t){}},e.load=function(){var t;try{t=e.storage.getItem("debug")}catch(t){}!t&&void 0!==n&&"env"in n&&(t=n.env.DEBUG);return t},e.useColors=function(){if("undefined"!=typeof window&&window.process&&("renderer"===window.process.type||window.process.__nwjs))return!0;if("undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;return"undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)},e.storage=function(){try{return localStorage}catch(t){}}(),e.destroy=(i=!1,function(){i||(i=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}),e.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366"
/*!
* Module dependencies.
*/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)}function i(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function o(t,e){return(o=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function s(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=u(t);if(e){var i=u(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return a(this,r)}}function a(t,e){if(e&&("object"===n(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function u(t){return(u=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var h=r(8),f=r(9),c=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&o(t,e)}(u,t);var e,r,n,a=s(u);
/*!
* OverwriteModel Error constructor.
*/function u(t,e,r,n){var i,o;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,u);var s=h.messages;return o=null!=s.DocumentNotFoundError?"function"==typeof s.DocumentNotFoundError?s.DocumentNotFoundError(t,e):s.DocumentNotFoundError:'No document found for query "'+f.inspect(t)+'" on model "'+e+'"',(i=a.call(this,o)).result=n,i.numAffected=r,i.filter=t,i.query=t,i}return e=u,r&&i(e.prototype,r),n&&i(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}(h);Object.defineProperty(c.prototype,"name",{value:"DocumentNotFoundError"}),
/*!
* exports
*/
t.exports=c},function(t,e,r){"use strict";
/*!
* Module dependencies.
*/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)}function i(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function o(t,e){return(o=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function s(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=u(t);if(e){var i=u(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return a(this,r)}}function a(t,e){if(e&&("object"===n(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function u(t){return(u=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var h=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&o(t,e)}(u,t);var e,r,n,a=s(u);function u(t,e,r){var n;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,u);var i=r.join(", ");return(n=a.call(this,'No matching document found for id "'+t._id+'" version '+e+' modifiedPaths "'+i+'"')).version=e,n.modifiedPaths=r,n}return e=u,r&&i(e.prototype,r),n&&i(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}(r(8));Object.defineProperty(h.prototype,"name",{value:"VersionError"}),
/*!
* exports
*/
t.exports=h},function(t,e,r){"use strict";
/*!
* Module dependencies.
*/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)}function i(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function o(t,e){return(o=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function s(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=u(t);if(e){var i=u(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return a(this,r)}}function a(t,e){if(e&&("object"===n(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function u(t){return(u=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var h=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&o(t,e)}(u,t);var e,r,n,a=s(u);function u(t){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,u);return a.call(this,"Can't save() the same doc multiple times in parallel. Document: "+t._id)}return e=u,r&&i(e.prototype,r),n&&i(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}(r(8));Object.defineProperty(h.prototype,"name",{value:"ParallelSaveError"}),
/*!
* exports
*/
t.exports=h},function(t,e,r){"use strict";
/*!
* Module dependencies.
*/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)}function i(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function o(t,e){return(o=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function s(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=u(t);if(e){var i=u(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return a(this,r)}}function a(t,e){if(e&&("object"===n(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function u(t){return(u=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var h=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&o(t,e)}(u,t);var e,r,n,a=s(u);
/*!
* OverwriteModel Error constructor.
* @param {String} name
*/function u(t){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,u),a.call(this,"Cannot overwrite `"+t+"` model once compiled.")}return e=u,r&&i(e.prototype,r),n&&i(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}(r(8));Object.defineProperty(h.prototype,"name",{value:"OverwriteModelError"}),
/*!
* exports
*/
t.exports=h},function(t,e,r){"use strict";
/*!
* Module dependencies.
*/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)}function i(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function o(t,e){return(o=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function s(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=u(t);if(e){var i=u(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return a(this,r)}}function a(t,e){if(e&&("object"===n(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function u(t){return(u=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var h=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&o(t,e)}(u,t);var e,r,n,a=s(u);
/*!
* MissingSchema Error constructor.
* @param {String} name
*/function u(t){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,u);var e="Schema hasn't been registered for model \""+t+'".\nUse mongoose.model(name, schema)';return a.call(this,e)}return e=u,r&&i(e.prototype,r),n&&i(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}(r(8));Object.defineProperty(h.prototype,"name",{value:"MissingSchemaError"}),
/*!
* exports
*/
t.exports=h},function(t,e,r){"use strict";
/*!
* Module dependencies.
*/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)}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function s(t,e){return(s=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function a(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=h(t);if(e){var i=h(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return u(this,r)}}function u(t,e){if(e&&("object"===n(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function h(t){return(h=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var f=r(19),c=r(298),l=r(299),d=r(300),p=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&s(t,e)}(h,t);var e,r,n,u=a(h);function h(){return i(this,h),u.apply(this,arguments)}return e=h,(r=[{key:"assimilateError",value:function(t){var e=t.reason,r=l(e)&&c(e)&&-1===t.message.indexOf("bad auth")&&-1===t.message.indexOf("Authentication failed");for(var n in r?this.message="Could not connect to any servers in your MongoDB Atlas cluster. One common reason is that you're trying to access the database from an IP that isn't whitelisted. Make sure your current IP address is on your Atlas cluster's IP whitelist: https://docs.atlas.mongodb.com/security-whitelist/":d(e)?this.message="Mongoose is connecting with SSL enabled, but the server is not accepting SSL connections. Please ensure that the MongoDB server you are connecting to is configured to accept SSL connections. Learn more: https://mongoosejs.com/docs/tutorials/ssl.html":this.message=t.message,t)"name"!==n&&(this[n]=t[n]);return this}}])&&o(e.prototype,r),n&&o(e,n),Object.defineProperty(e,"prototype",{writable:!1}),h}(f);Object.defineProperty(p.prototype,"name",{value:"MongooseServerSelectionError"}),t.exports=p},function(t,e,r){"use strict";var n=r(22);t.exports=function(t){if("TopologyDescription"!==n(t))return!1;var e=Array.from(t.servers.values());return e.length>0&&e.every((function(t){return"Unknown"===t.type}))}},function(t,e,r){"use strict";var n=r(22);t.exports=function(t){if("TopologyDescription"!==n(t))return!1;var e=Array.from(t.servers.keys());return e.length>0&&e.every((function(t){return t.endsWith(".mongodb.net:27017")}))}},function(t,e,r){"use strict";var n=r(22);t.exports=function(t){if("TopologyDescription"!==n(t))return!1;var e=Array.from(t.servers.values());return e.length>0&&e.every((function(t){return t.error&&-1!==t.error.message.indexOf("Client network socket disconnected before secure TLS connection was established")}))}},function(t,e,r){"use strict";
/*!
* Module dependencies.
*/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)}function i(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function o(t,e){return(o=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function s(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=u(t);if(e){var i=u(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return a(this,r)}}function a(t,e){if(e&&("object"===n(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function u(t){return(u=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var h=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&o(t,e)}(u,t);var e,r,n,a=s(u);
/*!
* DivergentArrayError constructor.
* @param {Array<String>} paths
*/function u(t){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,u);var e="For your own good, using `document.save()` to update an array which was selected using an $elemMatch projection OR populated using skip, limit, query conditions, or exclusion of the _id field when the operation results in a $pop or $set of the entire array is not supported. The following path(s) would have been modified unsafely:\n "+t.join("\n ")+"\nUse Model.update() to update these arrays instead.";return a.call(this,e)}return e=u,r&&i(e.prototype,r),n&&i(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}(r(8));Object.defineProperty(h.prototype,"name",{value:"DivergentArrayError"}),
/*!
* exports
*/
t.exports=h},function(t,e,r){"use strict";var n=r(44);
/*!
* ignore
*/t.exports=function(t){var e,r;t.$immutable?(t.$immutableSetter=(e=t.path,r=t.options.immutable,function(t){if(null==this||null==this.$__)return t;if(this.isNew)return t;if(!("function"==typeof r?r.call(this,this):r))return t;var i=null!=this.$__.priorDoc?this.$__.priorDoc.$__getValue(e):this.$__getValue(e);if("throw"===this.$__.strictMode&&t!==i)throw new n(e,"Path `"+e+"` is immutable and strict mode is set to throw.",!0);return i}),t.set(t.$immutableSetter)):t.$immutableSetter&&(t.setters=t.setters.filter((function(e){return e!==t.$immutableSetter})),delete t.$immutableSetter)}},function(t,e,r){"use strict";var n=r(9).inspect;t.exports=function(t){if("function"==typeof t)return n(t).startsWith("[AsyncFunction:")}},function(t,e,r){"use strict";
/*!
* Module dependencies.
*/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)}function i(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function o(t,e){return(o=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function s(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=u(t);if(e){var i=u(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return a(this,r)}}function a(t,e){if(e&&("object"===n(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function u(t){return(u=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var h=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&o(t,e)}(u,t);var e,r,n,a=s(u);function u(t,e,r){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,u),a.call(this,'Parameter "'+e+'" to '+r+"() must be an object, got "+t.toString())}return e=u,r&&i(e.prototype,r),n&&i(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}(r(8));Object.defineProperty(h.prototype,"name",{value:"ObjectParameterError"}),t.exports=h},function(t,e,r){"use strict";
/*!
* Module dependencies.
*/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)}function i(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function o(t,e){return(o=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function s(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=u(t);if(e){var i=u(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return a(this,r)}}function a(t,e){if(e&&("object"===n(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function u(t){return(u=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var h=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&o(t,e)}(u,t);var e,r,n,a=s(u);function u(t){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,u);return a.call(this,"Can't validate() the same doc multiple times in parallel. Document: "+t._id)}return e=u,r&&i(e.prototype,r),n&&i(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}(r(19));Object.defineProperty(h.prototype,"name",{value:"ParallelValidateError"}),
/*!
* exports
*/
t.exports=h},function(t,e,r){"use strict";(function(e){function r(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 n(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 n(t,e)}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var i=0,o=function(){};return{s:o,n:function(){return i>=t.length?{done:!0}:{done:!1,value:t[i++]}},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 n(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 i(t){return(i="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 o(){this._pres=new Map,this._posts=new Map}function s(t,e,r,n,i,o,s){if(o.useErrorHandlers){var a={error:e};return t.execPost(r,n,i,a,(function(t){return"function"==typeof s&&s(t)}))}return"function"==typeof s?s(e):void 0}function a(t,e,r){return t.has(e)?t.get(e):r}function u(t,e,r,n){var i;try{i=t.apply(e,r)}catch(t){return n(t)}h(i)&&i.then((function(){return n()}),(function(t){return n(t)}))}function h(t){return null!=t&&"function"==typeof t.then}function f(t){var r=!1,n=this;return function(){var i=arguments;if(!r)return r=!0,e.nextTick((function(){return t.apply(n,i)}))}}o.prototype.execPre=function(t,r,n,i){3===arguments.length&&(i=n,n=[]);var o=a(this._pres,t,[]),s=o.length,c=o.numAsync||0,l=0,d=c,p=!1,y=n;if(!s)return e.nextTick((function(){i(null)}));var m=function t(){if(!(l>=s)){var n=o[l];if(n.isAsync){var a=[f(b),f((function(t){if(t){if(p)return;return p=!0,i(t)}if(0==--d&&l>=s)return i(null)}))];u(n.fn,r,a,a[0])}else if(n.fn.length>0){a=[f(b)];for(var c=arguments.length>=2?arguments:[null].concat(y),m=1;m<c.length;++m)a.push(c[m]);u(n.fn,r,a,a[0])}else{var v=null;try{v=n.fn.call(r)}catch(t){if(null!=t)return i(t)}if(h(v))v.then((function(){return b()}),(function(t){return b(t)}));else{if(++l>=s)return d>0?void 0:e.nextTick((function(){i(null)}));t()}}}};function b(t){if(t){if(p)return;return p=!0,i(t)}if(++l>=s)return d>0?void 0:i(null);m.apply(r,arguments)}m.apply(null,[null].concat(n))},o.prototype.execPreSync=function(t,e,r){for(var n=a(this._pres,t,[]),i=n.length,o=0;o<i;++o)n[o].fn.apply(e,r||[])},o.prototype.execPost=function(t,r,n,i,o){arguments.length<5&&(o=i,i=null);var s=a(this._posts,t,[]),c=s.length,l=0,d=null;if(i&&i.error&&(d=i.error),!c)return e.nextTick((function(){o.apply(null,[d].concat(n))}));var p=function t(){for(var e=s[l].fn,i=0,a=n.length,p=[],y=0;y<a;++y)i+=n[y]&&n[y]._kareemIgnore?0:1,n[y]&&n[y]._kareemIgnore||p.push(n[y]);if(d)if(e.length===i+2){var m=f((function(e){if(e&&(d=e),++l>=c)return o.call(null,d);t()}));u(e,r,[d].concat(p).concat([m]),m)}else{if(++l>=c)return o.call(null,d);t()}else{var b=f((function(e){return e?(d=e,t()):++l>=c?o.apply(null,[null].concat(n)):void t()}));if(e.length===i+2)return++l>=c?o.apply(null,[null].concat(n)):t();if(e.length===i+1)u(e,r,p.concat([b]),b);else{var v,g;try{g=e.apply(r,p)}catch(t){v=t,d=t}if(h(g))return g.then((function(){return b()}),(function(t){return b(t)}));if(++l>=c)return o.apply(null,[v].concat(n));t()}}};p()},o.prototype.execPostSync=function(t,e,r){for(var n=a(this._posts,t,[]),i=n.length,o=0;o<i;++o)n[o].fn.apply(e,r||[])},o.prototype.createWrapperSync=function(t,e){var r=this;return function(){r.execPreSync(t,this,arguments);var n=e.apply(this,arguments);return r.execPostSync(t,this,[n]),n}},o.prototype.wrap=fu
/*!
* Gather all indexes defined in the schema, including single nested,
* document arrays, and embedded discriminators.
*/
t.exports=function(t){var e=[],r=new WeakMap,o=t.constructor.indexTypes,s=new Map;return function t(a,u,h){if(r.has(a))return;r.set(a,!0),u=u||"";for(var f=Object.keys(a.paths),c=0,l=f;c<l.length;c++){var d=l[c],p=a.paths[d];if(null==h||!h.paths[d]){if(p.$isMongooseDocumentArray||p.$isSingleNested){if(!0!==n(p,"options.excludeIndexes")&&!0!==n(p,"schemaOptions.excludeIndexes")&&!0!==n(p,"schema.options.excludeIndexes")&&t(p.schema,u+d+"."),null!=p.schema.discriminators)for(var y=p.schema.discriminators,m=Object.keys(y),b=0,v=m;b<v.length;b++){var g=v[b];t(y[g],u+d+".",p.schema)}if(p.$isMongooseDocumentArray)continue}var w=p._index||p.caster&&p.caster._index;if(!1!==w&&null!=w){var _={},M=i(w),S=M?w:{},O="string"==typeof w?w:!!M&&w.type;if(O&&-1!==o.indexOf(O))_[u+d]=O;else if(S.text)_[u+d]="text",delete S.text;else{var A=-1===Number(w);_[u+d]=A?-1:1}delete S.type,"background"in S||(S.background=!0),null!=a.options.autoIndex&&(S._autoIndex=a.options.autoIndex);var E=S&&S.name;"string"==typeof E&&s.has(E)?Object.assign(s.get(E),_):(e.push([_,S]),s.set(E,_))}}}r.delete(a),u?
/*!
* Checks for indexes added to subdocs using Schema.index().
* These indexes need their paths prefixed properly.
*
* schema._indexes = [ [indexObj, options], [indexObj, options] ..]
*/
function(t,r){for(var n=t._indexes,i=n.length,o=0;o<i;++o){for(var s=n[o][0],a=n[o][1],u=Object.keys(s),h=u.length,f={},c=0;c<h;++c){var l=u[c];f[r+l]=s[l]}var d=Object.assign({},a);if(null!=a&&null!=a.partialFilterExpression){d.partialFilterExpression={};for(var p=a.partialFilterExpression,y=0,m=Object.keys(p);y<m.length;y++){var b=m[y];d.partialFilterExpression[r+b]=p[b]}}e.push([f,d])}}(a,u):(a._indexes.forEach((function(t){"background"in t[1]||(t[1].background=!0)})),e=e.concat(a._indexes))}(t),e}},function(t,e,r){"use strict";
/*!
* ignore
*/
/*!
* Returns this documents _id cast to a string.
*/
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(311),o=r(313),s=r(6),a=r(156),u=r(55);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();if(!n&&this.isNew&&f&&!this.$__getValue(f)&&this.$__isSelected(f)&&this.$set(f,i),!r&&c&&(this.isNew||this.$isModified())){var o=i;this.isNew&&null!=f&&(o=this.$__getValue(f)),this.$set(c,o)}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},y[u.builtInMiddleware]=!0;var p={query:!0,model:!1};t.pre("findOneAndReplace",p,y),t.pre("findOneAndUpdate",p,y),t.pre("replaceOne",p,y),t.pre("update",p,y),t.pre("updateOne",p,y),t.pre("updateMany",p,y)}function y(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(312),s=r(156);
/*!
* ignore
*/
function a(t,e,r){if(null!=e){if(Object.keys(e).some((function(t){return t.startsWith("$")}))){if(e.$push&&y(e.$push),e.$addToSet&&y(e.$addToSet),null!=e.$set)for(var i=0,o=Object.keys(e.$set);i<o.length;i++){var a=o[i];u(r,a,e.$set,t)}if(null!=e.$setOnInsert)for(var h=0,f=Object.keys(e.$setOnInsert);h<f.length;h++){var c=f[h];u(r,c,e.$setOnInsert,t)}}var l,d=n(Object.keys(e).filter((function(t){return!t.startsWith("$")})));try{for(d.s();!(l=d.n()).done;){var p=l.value;u(r,p,e,t)}}catch(t){d.e(t)}finally{d.f()}}function y(e){for(var n=0,i=Object.keys(e);n<i.length;n++){var o=i[n],a=r.path(o.replace(/\.\$\./i,".").replace(/.\$$/,""));e[o]&&a&&a.$isMongooseDocumentArray&&a.schema.options.timestamps&&function(){var r=a.schema.options.timestamps,n=s(r,"createdAt"),i=s(r,"updatedAt");e[o].$each?e[o].$each.forEach((function(e){null!=i&&(e[i]=t),null!=n&&(e[n]=t)})):(null!=i&&(e[o][i]=t),null!=n&&(e[o][n]=t))}()}}}function u(t,e,r,i){var u=o(e),h=t.path(u);if(h){for(var f=[],c=u.split("."),l=c.length-1;l>0;--l){var d=t.path(c.slice(0,l).join("."));null!=d&&(d.$isMongooseDocumentArray||d.$isSingleNested)&&f.push({parentPath:e.split(".").slice(0,l).join("."),parentSchemaType:d})}if(Array.isArray(r[e])&&h.$isMongooseDocumentArray)!function(t,e,r){var n=e.schema.options.timestamps;if(n)for(var i=t.length,o=s(n,"createdAt"),u=s(n,"updatedAt"),h=0;h<i;++h)null!=u&&(t[h][u]=r),null!=o&&(t[h][o]=r),a(r,t[h],e.schema)}(r[e],h,i);else if(r[e]&&h.$isSingleNested)!function(t,e,r){var n=e.schema.options.timestamps;if(n){var i=s(n,"createdAt"),o=s(n,"updatedAt");null!=o&&(t[o]=r),null!=i&&(t[i]=r),a(r,t,e.schema)}}(r[e],h,i);else if(f.length>0){var p,y=n(f);try{for(y.s();!(p=y.n()).done;){var m=p.value,b=m.parentPath,v=m.parentSchemaType,g=v.schema.options.timestamps,w=s(g,"updatedAt");if(g&&null!=w)if(v.$isSingleNested)r[b+"."+w]=i;else if(v.$isMongooseDocumentArray){var _=e.substring(b.length+1);if(/^\d+$/.test(_)){r[b+"."+_][w]=i;continue}var M=_.indexOf(".");r[b+"."+(_=-1!==M?_.substring(0,M):_)+"."+w]=i}}}catch(t){y.e(t)}finally{y.f()}}else if(null!=h.schema&&h.schema!=t&&r[e]){var S=h.schema.options.timestamps,O=s(S,"createdAt"),A=s(S,"updatedAt");if(!S)return;null!=A&&(r[e][A]=i),null!=O&&(r[e][O]=i)}}}t.exports=a},function(t,e,r){"use strict";t.exports=function(t){return t.replace(/\.\$(\[[^\]]*\])?(?=\.)/g,".0").replace(/\.\$(\[[^\]]*\])?$/g,".0")}},function(t,e,r){"use strict";
/*!
* ignore
*/var n=r(6);t.exports=
/*!
* ignore
*/
function(t,e,r,i,o){var s=i,a=s,u=n(o,"overwrite",!1),h=n(o,"timestamps",!0);if(!h||null==s)return i;var f=null!=h&&!1===h.createdAt,c=null!=h&&!1===h.updatedAt;if(u)return i&&i.$set&&(i=i.$set,s.$set={},a=s.$set),c||!r||i[r]||(a[r]=t),f||!e||i[e]||(a[e]=t),s;if(i=i||{},Array.isArray(s))return s.push({$set:(l={},d=r,p=t,d in l?Object.defineProperty(l,d,{value:p,enumerable:!0,configurable:!0,writable:!0}):l[d]=p,l)}),s;var l,d,p;if(s.$set=s.$set||{},!c&&r&&(!i.$currentDate||!i.$currentDate[r])){var y=!1;if(-1!==r.indexOf("."))for(var m=r.split("."),b=1;b<m.length;++b){var v=m.slice(-b).join("."),g=m.slice(0,-b).join(".");if(null!=i[g]){i[g][v]=t,y=!0;break}if(i.$set&&i.$set[g]){i.$set[g][v]=t,y=!0;break}}y||(s.$set[r]=t),s.hasOwnProperty(r)&&delete s[r]}if(!f&&e){i[e]&&delete i[e],i.$set&&i.$set[e]&&delete i.$set[e];var w=!1;if(-1!==e.indexOf("."))for(var _=e.split("."),M=1;M<_.length;++M){var S=_.slice(-M).join("."),O=_.slice(0,-M).join(".");if(null!=i[O]){i[O][S]=t,w=!0;break}if(i.$set&&i.$set[O]){i.$set[O][S]=t,w=!0;break}}w||(s.$setOnInsert=s.$setOnInsert||{},s.$setOnInsert[e]=t)}0===Object.keys(s.$set).length&&delete s.$set;return s}},function(t,e,r){"use strict";var n=r(19),i=r(9);t.exports=function(t,e){if("string"==typeof t)return;if("function"==typeof t)return;throw new n('Invalid ref at path "'+e+'". Got '+i.inspect(t,{depth:0}))}},function(t,e,r){"use strict";
/*!
* ignore
*/t.exports=i;var n=r(316);
/*!
* ignore
*/
/*!
* Apply query middleware
*
* @param {Query} query constructor
* @param {Model} model
*/
function i(t,e){var r={useErrorHandlers:!0,numCallbackParams:1,nullResultByDefault:!0},n=e.hooks.filter((function(t){var e=function(t){var e={};t.hasOwnProperty("query")&&(e.query=t.query);t.hasOwnProperty("document")&&(e.document=t.document);return e}(t);return"updateOne"===t.name?null==e.query||!!e.query:"deleteOne"===t.name?!!e.query||0===Object.keys(e).length:"validate"===t.name||"remove"===t.name?!!e.query:null==t.query&&null==t.document||!!t.query}));t.prototype._execUpdate=n.createWrapper("update",t.prototype._execUpdate,null,r),t.prototype.__distinct=n.createWrapper("distinct",t.prototype.__distinct,null,r),t.prototype.validate=n.createWrapper("validate",t.prototype.validate,null,r),i.middlewareFunctions.filter((function(t){return"update"!==t&&"distinct"!==t&&"validate"!==t})).forEach((function(e){t.prototype["_".concat(e)]=n.createWrapper(e,t.prototype["_".concat(e)],null,r)}))}i.middlewareFunctions=n.concat(["validate"])},function(t,e,r){"use strict";t.exports=Object.freeze(["count","countDocuments","distinct","estimatedDocumentCount","find","findOne","findOneAndReplace","findOneAndUpdate","replaceOne","update","updateMany","updateOne","deleteMany","deleteOne","findOneAndDelete","findOneAndRemove","remove"])},function(t,e,r){"use strict";
/*!
* Module dependencies.
*/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(10),s=r(8),a=r(318),u=r(158),h=r(4),f=o.CastError;function c(t,e){this.enumValues=[],this.regExp=null,o.call(this,t,e,"String")}
/*!
* ignore
*/
function l(t){return this.castForQuery(t)}c.schemaName="String",c.defaultOptions={},
/*!
* Inherits from SchemaType.
*/
c.prototype=Object.create(o.prototype),c.prototype.constructor=c,Object.defineProperty(c.prototype,"OptionsConstructor",{configurable:!1,enumerable:!1,writable:!1,value:a}),
/*!
* ignore
*/
c._cast=u,c.cast=function(t){return 0===arguments.length||(!1===t&&(t=this._defaultCaster),this._cast=t),this._cast},
/*!
* ignore
*/
c._defaultCaster=function(t){if(null!=t&&"string"!=typeof t)throw new Error;return t},c.get=o.get,c.set=o.set,
/*!
* ignore
*/
c._checkRequired=function(t){return(t instanceof String||"string"==typeof t)&&t.length},c.checkRequired=o.checkRequired,c.prototype.enum=function(){if(this.enumValidator&&(this.validators=this.validators.filter((function(t){return t.validator!==this.enumValidator}),this),this.enumValidator=!1),void 0===arguments[0]||!1===arguments[0])return this;var t,e;h.isObject(arguments[0])?Array.isArray(arguments[0].values)?(t=arguments[0].values,e=arguments[0].message):(t=h.object.vals(arguments[0]),e=s.messages.String.enum):(t=arguments,e=s.messages.String.enum);var r,i=n(t);try{for(i.s();!(r=i.n()).done;){var o=r.value;void 0!==o&&this.enumValues.push(this.cast(o))}}catch(t){i.e(t)}finally{i.f()}var a=this.enumValues;return this.enumValidator=function(t){return void 0===t||~a.indexOf(t)},this.validators.push({validator:this.enumValidator,message:e,type:"enum",enumValues:a}),this},c.prototype.lowercase=function(t){var e=this;return arguments.length>0&&!t?this:this.set((function(t){return"string"!=typeof t&&(t=e.cast(t)),t?t.toLowerCase():t}))},c.prototype.uppercase=function(t){var e=this;return arguments.length>0&&!t?this:this.set((function(t){return"string"!=typeof t&&(t=e.cast(t)),t?t.toUpperCase():t}))},c.prototype.trim=function(t){var e=this;return arguments.length>0&&!t?this:this.set((function(t){return"string"!=typeof t&&(t=e.cast(t)),t?t.trim():t}))},c.prototype.minlength=function(t,e){if(this.minlengthValidator&&(this.validators=this.validators.filter((function(t){return t.validator!==this.minlengthValidator}),this)),null!=t){var r=e||s.messages.String.minlength;r=r.replace(/{MINLENGTH}/,t),this.validators.push({validator:this.minlengthValidator=function(e){return null===e||e.length>=t},message:r,type:"minlength",minlength:t})}return this},c.prototype.minLength=c.prototype.minlength,c.prototype.maxlength=function(t,e){if(this.maxlengthValidator&&(this.validators=this.validators.filter((function(t){return t.validator!==this.maxlengthValidator}),this)),null!=t){var r=e||s.messages.String.maxlength;r=r.replace(/{MAXLENGTH}/,t),this.validators.push({validator:this.maxlengthValidator=function(e){return null===e||e.length<=t},message:r,type:"maxlength",maxlength:t})}return this},c.prototype.maxLength=c.prototype.maxlength,c.prototype.match=function(t,e){var r=e||s.messages.String.match;return this.validators.push({validator:function(e){return!!t&&(t.lastIndex=0,null==e||""===e||t.test(e))},message:r,type:"regexp",regexp:t}),this},c.prototype.checkRequired=function(t,e){return o._isRef(this,t,e,!0)?!!t:("function"==typeof this.constructor.checkRequired?this.constructor.checkRequired():c.checkRequired())(t)},c.prototype.cast=function(t,e,r){if(o._isRef(this,t,e,r))return"string"==typeof t?t:this._castRef(t,e,r);var n;n="function"==typeof this._castFunction?this._castFunction:"function"==typeof this.constructor.cast?this.constructor.cast():c.cast();try{return n(t)}catch(e){throw new f("string",t,this.path,null,this)}};var d=h.options(o.prototype.$conditionalHandlers,{$all:function(t){var e=this;return Array.isArray(t)?t.map((function(t){return e.castForQuery(t)})):[this.castForQuery(t)]},$gt:l,$gte:l,$lt:l,$lte:l,$options:String,$regex:l,$not:l});Object.defineProperty(c.prototype,"$conditionalHandlers",{configurable:!1,enumerable:!1,writable:!1,value:Object.freeze(d)}),c.prototype.castForQuery=function(t,e){var r;if(2===arguments.length){if(!(r=this.$conditionalHandlers[t]))throw new Error("Can't use "+t+" with String.");return r.call(this,e)}return e=t,"[object RegExp]"===Object.prototype.toString.call(e)?e:this._castForQuery(e)},
/*!
* Module exports.
*/
t.exports=c},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)}function i(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function s(t,e){return(s=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function a(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=h(t);if(e){var i=h(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return u(this,r)}}function u(t,e){if(e&&("object"===n(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function h(t){return(h=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var f=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&s(t,e)}(h,t);var e,r,n,u=a(h);function h(){return o(this,h),u.apply(this,arguments)}return e=h,r&&i(e.prototype,r),n&&i(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}(r(15)),c=r(16);Object.defineProperty(f.prototype,"enum",c),Object.defineProperty(f.prototype,"match",c),Object.defineProperty(f.prototype,"lowercase",c),Object.defineProperty(f.prototype,"trim",c),Object.defineProperty(f.prototype,"uppercase",c),Object.defineProperty(f.prototype,"minLength",c),Object.defineProperty(f.prototype,"minlength",c),Object.defineProperty(f.prototype,"maxLength",c),Object.defineProperty(f.prototype,"maxlength",c),Object.defineProperty(f.prototype,"populate",c),
/*!
* ignore
*/
t.exports=f},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)}function i(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function s(t,e){return(s=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function a(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=h(t);if(e){var i=h(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return u(this,r)}}function u(t,e){if(e&&("object"===n(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function h(t){return(h=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var f=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&s(t,e)}(h,t);var e,r,n,u=a(h);function h(){return o(this,h),u.apply(this,arguments)}return e=h,r&&i(e.prototype,r),n&&i(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}(r(15)),c=r(16);Object.defineProperty(f.prototype,"min",c),Object.defineProperty(f.prototype,"max",c),Object.defineProperty(f.prototype,"enum",c),Object.defineProperty(f.prototype,"populate",c),
/*!
* ignore
*/
t.exports=f},function(t,e,r){"use strict";
/*!
* Module dependencies.
*/var n=r(20),i=r(10),o=r(84),s=r(4);function a(t,e){i.call(this,t,e,"Boolean")}a.schemaName="Boolean",a.defaultOptions={},
/*!
* Inherits from SchemaType.
*/
a.prototype=Object.create(i.prototype),a.prototype.constructor=a,
/*!
* ignore
*/
a._cast=o,a.set=i.set,a.cast=function(t){return 0===arguments.length||(!1===t&&(t=this._defaultCaster),this._cast=t),this._cast},
/*!
* ignore
*/
a._defaultCaster=function(t){if(null!=t&&"boolean"!=typeof t)throw new Error;return t},
/*!
* ignore
*/
a._checkRequired=function(t){return!0===t||!1===t},a.checkRequired=i.checkRequired,a.prototype.checkRequired=function(t){return this.constructor._checkRequired(t)},Object.defineProperty(a,"convertToTrue",{get:function(){return o.convertToTrue},set:function(t){o.convertToTrue=t}}),Object.defineProperty(a,"convertToFalse",{get:function(){return o.convertToFalse},set:function(t){o.convertToFalse=t}}),a.prototype.cast=function(t){var e;e="function"==typeof this._castFunction?this._castFunction:"function"==typeof this.constructor.cast?this.constructor.cast():a.cast();try{return e(t)}catch(e){throw new n("Boolean",t,this.path,e,this)}},a.$conditionalHandlers=s.options(i.prototype.$conditionalHandlers,{}),a.prototype.castForQuery=function(t,e){var r;return 2===arguments.length?(r=a.$conditionalHandlers[t])?r.call(this,e):this._castForQuery(e):this._castForQuery(t)},a.prototype._castNullish=function(t){if(void 0===t)return t;var e="function"==typeof this.constructor.cast?this.constructor.cast():a.cast();return null==e?t:!(e.convertToFalse instanceof Set&&e.convertToFalse.has(t))&&(!!(e.convertToTrue instanceof Set&&e.convertToTrue.has(t))||t)},
/*!
* Module exports.
*/
t.exports=a},function(t,e,r){"use strict";
/*!
* Module dependencies.
*/var n,i,o=r(88),s=r(20),a=r(13).EventEmitter,u=r(328),h=r(10),f=r(172),c=r(6),l=r(173),d=r(9),p=r(4),y=r(174),m=r(1).arrayAtomicsSymbol,b=r(1).arrayPathSymbol,v=r(1).documentArrayParent;function g(t,e,r,n){null!=n&&null!=n._id?e=l(e,n):null!=r&&null!=r._id&&(e=l(e,r));var i=w(e,r);i.prototype.$basePath=t,o.call(this,t,i,r),this.schema=e,this.schemaOptions=n||{},this.$isMongooseDocumentArray=!0,this.Constructor=i,i.base=e.base;var s=this.defaultValue;"defaultValue"in this&&void 0===s||this.default((function(){var t=s.call(this);return null==t||Array.isArray(t)||(t=[t]),t}));var a=this;this.$embeddedSchemaType=new h(t+".$",{required:c(this,"schemaOptions.required",!1)}),this.$embeddedSchemaType.cast=function(t,e,r){return a.cast(t,e,r)[0]},this.$embeddedSchemaType.$isMongooseDocumentArrayElement=!0,this.$embeddedSchemaType.caster=this.Constructor,this.$embeddedSchemaType.schema=this.schema}
/*!
* Ignore
*/
function w(t,e,n){function o(){i.apply(this,arguments),this.$session(this.ownerDocument().$session())}i||(i=r(46)),t._preCompile();var s=null!=n?n.prototype:i.prototype;for(var u in o.prototype=Object.create(s),o.prototype.$__setSchema(t),o.schema=t,o.prototype.constructor=o,o.$isArraySubdocument=!0,o.events=new a,t.methods)o.prototype[u]=t.methods[u];for(var h in t.statics)o[h]=t.statics[h];for(var f in a.prototype)o[f]=a.prototype[f];return o.options=e,o}
/*!
* Scopes paths selected in a query to this array.
* Necessary for proper default application of subdocument values.
*
* @param {DocumentArrayPath} array - the array to scope `fields` paths
* @param {Object|undefined} fields - the root fields selected in the query
* @param {Boolean|undefined} init - if we are being created part of a query result
*/
function _(t,e,r){if(r&&e){for(var n,i,o,s=t.path+".",a=Object.keys(e),u=a.length,h={};u--;)if((i=a[u]).startsWith(s)){if("$"===(o=i.substring(s.length)))continue;o.startsWith("$.")&&(o=o.substring(2)),n||(n=!0),h[o]=e[i]}return n&&h||void 0}}g.schemaName="DocumentArray",g.options={castNonArrays:!0},
/*!
* Inherits from ArrayType.
*/
g.prototype=Object.create(o.prototype),g.prototype.constructor=g,g.prototype.OptionsConstructor=u,g.prototype.discriminator=function(t,e,r){"function"==typeof t&&(t=p.getFunctionName(t)),r=r||{};var n=p.isPOJO(r)?r.value:r,i=c(r,"clone",!0);e.instanceOfSchema&&i&&(e=e.clone());var o=w(e=f(this.casterConstructor,t,e,n),null,this.casterConstructor);o.baseCasterConstructor=this.casterConstructor;try{Object.defineProperty(o,"name",{value:t})}catch(t){}return this.casterConstructor.discriminators[t]=o,this.casterConstructor.discriminators[t]},g.prototype.doValidate=function(t,e,o,s){n||(n=r(27));var a=this;try{h.prototype.doValidate.call(this,t,(function(r){if(r)return e(r);var u,h=t&&t.length;if(!h)return e();if(s&&s.updateValidator)return e();p.isMongooseDocumentArray(t)||(t=new n(t,a.path,o));function f(t){null!=t&&(u=t),--h||e(u)}for(var c=0,l=h;c<l;++c){var d=t[c];if(null!=d){if(!(d instanceof i)){var m=y(a.casterConstructor,t[c]);d=t[c]=new m(d,t,void 0,void 0,c)}null==s||!s.validateModifiedOnly||d.$isModified()?d.$__validate(f):--h||e(u)}else--h||e(u)}}),o)}catch(t){return e(t)}},g.prototype.doValidateSync=function(t,e,r){var n=h.prototype.doValidateSync.call(this,t,e);if(null!=n)return n;var o=t&&t.length,s=null;if(o){for(var a=0,u=o;a<u;++a){var f=t[a];if(f){if(!(f instanceof i)){var c=y(this.casterConstructor,t[a]);f=t[a]=new c(f,t,void 0,void 0,a)}if(null==r||!r.validateModifiedOnly||f.$isModified()){var l=f.validateSync();l&&null==s&&(s=l)}}}return s}},
/*!
* ignore
*/
g.prototype.getDefault=function(t){var e="function"==typeof this.defaultValue?this.defaultValue.call(t):this.defaultValue;if(null==e)return e;n||(n=r(27)),Array.isArray(e)||(e=[e]),e=new n(e,this.path,t);for(var i=0;i<e.length;++i){var o=new(y(this.casterConstructor,e[i]))({},e,void 0,void 0,i);o.$init(e[i]),o.isNew=!0,Object.assign(o.$__.activePaths.default,o.$__.activePaths.init),o.$__.activePaths.init={},e[i]=o}return e},g.prototype.cast=function(t,e,o,a,u){if(n||(n=r(27)),null!=t&&null!=t[b]&&t===a)return t;var h,f,c={transform:!1,virtuals:!1};if(u=u||{},!Array.isArray(t)){if(!o&&!g.options.castNonArrays)throw new s("DocumentArray",d.inspect(t),this.path,null,this);return e&&o&&e.markModified(this.path),this.cast([t],e,o,a,u)}u.skipDocumentArrayCast&&!p.isMongooseDocumentArray(t)||(t=new n(t,this.path,e)),null!=a&&(t[m]=a[m]||{}),null!=u.arrayPathIndex&&(t[b]=this.path+"."+u.arrayPathIndex);for(var l=p.isMongooseDocumentArray(t)?t.__array:t,w=l.length,M={skipId:!0,willInit:!0},S=0;S<w;++S)if(l[S]){var O=y(this.casterConstructor,l[S]);if(!l[S].$__||l[S]instanceof O||(l[S]=l[S].toObject({transform:!1,virtuals:l[S].schema===O.schema})),l[S]instanceof i){if(l[S][v]!==e)if(o){var A=new O(null,t,M,h,S);l[S]=A.$init(l[S])}else{var E=new O(l[S],t,void 0,void 0,S);l[S]=E}null==l[S].__index&&l[S].$setIndex(S)}else if(null!=l[S])if(o)e?h||(h=_(this,e.$__.selected,o)):h=!0,f=new O(null,t,M,h,S),l[S]=f.$init(l[S]);else if(a&&"function"==typeof a.id&&(f=a.id(l[S]._id)),a&&f&&p.deepEqual(f.toObject(c),l[S]))f.set(l[S]),l[S]=f;else try{f=new O(l[S],t,void 0,void 0,S),l[S]=f}catch(e){var x=d.inspect(l[S]);throw new s("embedded",x,t[b],e,this)}}return t},
/*!
* ignore
*/
g.prototype.clone=function(){var t=Object.assign({},this.options),e=new this.constructor(this.path,this.schema,t,this.schemaOptions);return e.validators=this.validators.slice(),void 0!==this.requiredValidator&&(e.requiredValidator=this.requiredValidator),e.Constructor.discriminators=Object.assign({},this.Constructor.discriminators),e},
/*!
* ignore
*/
g.prototype.applyGetters=function(t,e){return h.prototype.applyGetters.call(this,t,e)},g.defaultOptions={},g.set=h.set,
/*!
* Module exports.
*/
t.exports=g},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)}function i(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function s(t,e){return(s=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function a(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=h(t);if(e){var i=h(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return u(this,r)}}function u(t,e){if(e&&("object"===n(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function h(t){return(h=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var f=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&s(t,e)}(h,t);var e,r,n,u=a(h);function h(){return o(this,h),u.apply(this,arguments)}return e=h,r&&i(e.prototype,r),n&&i(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}(r(15)),c=r(16);Object.defineProperty(f.prototype,"enum",c),Object.defineProperty(f.prototype,"of",c),
/*!
* ignore
*/
t.exports=f},function(t,e,r){"use strict";t.exports=function t(e){if(!Array.isArray(e))return{min:0,max:0,containsNonArrayItem:!0};if(0===e.length)return{min:1,max:1,containsNonArrayItem:!1};if(1===e.length&&!Array.isArray(e[0]))return{min:1,max:1,containsNonArrayItem:!1};for(var r=t(e[0]),n=1;n<e.length;++n){var i=t(e[n]);i.min<r.min&&(r.min=i.min),i.max>r.max&&(r.max=i.max),r.containsNonArrayItem=r.containsNonArrayItem||i.containsNonArrayItem}return r.min=r.min+1,r.max=r.max+1,r}},function(t,e,r){"use strict";
/*!
* Module dependencies.
*/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}function o(t){return(o="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 s=r(20),a=r(44),u=r(87),h=r(325),f=r(326),c=r(6),l=r(22),d=r(162),p=r(164),y=r(9),m=r(33),b=r(52),v=["Polygon","MultiPolygon"];function g(t,e,r){if(Array.isArray(t))t.forEach((function(n,i){if(Array.isArray(n)||m(n))return g(n,e,r);t[i]=e.castForQueryWrapper({val:n,context:r})}));else for(var n=Object.keys(t),i=n.length;i--;){var o=n[i],s=t[o];Array.isArray(s)||m(s)?(g(s,e,r),t[o]=s):t[o]=e.castForQuery({val:s,context:r})}}t.exports=function t(e,r,i,w){if(Array.isArray(r))throw new Error("Query filter must be an object, got an array ",y.inspect(r));if(null==r)return r;null!=e&&null!=e.discriminators&&null!=r[e.options.discriminatorKey]&&(e=d(e,r[e.options.discriminatorKey])||e);var _,M,S,O,A,E,x=Object.keys(r),k=x.length;for(i=i||{};k--;)if(E=r[O=x[k]],"$or"===O||"$nor"===O||"$and"===O){if(!Array.isArray(E))throw new s("Array",E,O);for(var j=0;j<E.length;++j){if(null==E[j]||"object"!==o(E[j]))throw new s("Object",E[j],O+"."+j);E[j]=t(e,E[j],i,w)}}else{if("$where"===O){if("string"!==(A=o(E))&&"function"!==A)throw new Error("Must have a string or function for $where");"function"===A&&(r[O]=E.toString());continue}if("$expr"===O){E=h(E,e);continue}if("$elemMatch"===O)E=t(e,E,i,w);else if("$text"===O)E=f(E,O);else{if(!e)continue;if(!(M=e.path(O)))for(var $=O.split("."),P=$.length;P--;){var R=$.slice(0,P).join("."),B=$.slice(P).join("."),T=e.path(R),I=c(T,"schema.options.discriminatorKey");if(null!=T&&null!=c(T,"schema.discriminators")&&null!=I&&B!==I){var N=c(r,R+"."+I);null!=N&&(M=T.schema.discriminators[N].path(B))}}if(M){if(null==E)continue;if("Object"===l(E))if(Object.keys(E).some(p))for(var D=Object.keys(E),C=void 0,L=D.length;L--;)if(S=E[C=D[L]],"$not"===C){if(S&&M){if((_=Object.keys(S)).length&&p(_[0]))for(var q in S)S[q]=M.castForQueryWrapper({$conditional:q,val:S[q],context:w});else E[C]=M.castForQueryWrapper({$conditional:C,val:S,context:w});continue}}else E[C]=M.castForQueryWrapper({$conditional:C,val:S,context:w});else r[O]=M.castForQueryWrapper({val:E,context:w});else if(Array.isArray(E)&&-1===["Buffer","Array"].indexOf(M.instance)){var U,F=[],z=n(E);try{for(z.s();!(U=z.n()).done;){var V=U.value;F.push(M.castForQueryWrapper({val:V,context:w}))}}catch(t){z.e(t)}finally{z.f()}r[O]={$in:F}}else r[O]=M.castForQueryWrapper({val:E,context:w})}else{for(var K=O.split("."),H=K.length,Z=void 0,W=void 0,J=void 0;H--&&(Z=K.slice(0,H).join("."),!(M=e.path(Z))););if(M){if(M.caster&&M.caster.schema){(J={})[W=K.slice(H).join(".")]=E;var Y=t(M.caster.schema,J,i,w)[W];void 0===Y?delete r[O]:r[O]=Y}else r[O]=E;continue}if(m(E)){var Q="";if(E.$near?Q="$near":E.$nearSphere?Q="$nearSphere":E.$within?Q="$within":E.$geoIntersects?Q="$geoIntersects":E.$geoWithin&&(Q="$geoWithin"),Q){var G=new u.Number("__QueryCasting__"),X=E[Q];if(null!=E.$maxDistance&&(E.$maxDistance=G.castForQuer
/*!
* Casts val to an object suitable for `$text`. Throws an error if the object
* can't be casted.
*
* @param {Any} val value to cast
* @param {String} [path] path to associate with any errors that occured
* @return {Object} casted object
* @see https://docs.mongodb.com/manual/reference/operator/query/text/
* @api private
*/
t.exports=function(t,e){if(null==t||"object"!==n(t))throw new i("$text",t,e);return null!=t.$search&&(t.$search=s(t.$search,e+".$search")),null!=t.$language&&(t.$language=s(t.$language,e+".$language")),null!=t.$caseSensitive&&(t.$caseSensitive=o(t.$caseSensitive,e+".$castSensitive")),null!=t.$diacriticSensitive&&(t.$diacriticSensitive=o(t.$diacriticSensitive,e+".$diacriticSensitive")),t}},function(t,e,r){"use strict";(function(e){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(89),s=r(14),a=r(18),u=r(169),h=r(57),f=r(34).internalToObjectOptions,c=r(4),l=r(1).arrayParentSymbol,d=r(1).arrayPathSymbol,p=r(1).arraySchemaSymbol,y=r(1).documentArrayParent,m={
/*!
* ignore
*/
toBSON:function(){return this.toObject(f)},_cast:function(t,r){if(null==this[p])return t;var n=this[p].casterConstructor;if((n.$isMongooseDocumentArray?c.isMongooseDocumentArray(t):t instanceof n)||t&&t.constructor&&t.constructor.baseCasterConstructor===n)return t[y]&&t.__parentArray||(t[y]=this[l],t.__parentArray=this),t.$setIndex(r),t;if(null==t)return null;if((e.isBuffer(t)||t instanceof a||!c.isObject(t))&&(t={_id:t}),t&&n.discriminators&&n.schema&&n.schema.options&&n.schema.options.discriminatorKey)if("string"==typeof t[n.schema.options.discriminatorKey]&&n.discriminators[t[n.schema.options.discriminatorKey]])n=n.discriminators[t[n.schema.options.discriminatorKey]];else{var i=h(n.discriminators,t[n.schema.options.discriminatorKey]);i&&(n=i)}if(n.$isMongooseDocumentArray)return n.cast(t,this,void 0,void 0,r);var o=new n(t,this,void 0,void 0,r);return o.isNew=!0,o},id:function(t){var e,r,i;try{e=u(t).toString()}catch(t){e=null}var o,h=n(this);try{for(h.s();!(o=h.n()).done;){var f=o.value;if(f&&null!=(i=f.get("_id")))if(i instanceof s){if(r||(r=String(t)),r==i._id)return f}else if(t instanceof a||i instanceof a){if(e==i)return f}else if(t==i||c.deepEqual(t,i))return f}}catch(t){h.e(t)}finally{h.f()}return null},toObject:function(t){return[].concat(this.map((function(e){return null==e?null:"function"!=typeof e.toObject?e:e.toObject(t)})))},$toObject:function(){return this.constructor.prototype.toObject.apply(this,arguments)},push:function(){var t=o.push.apply(this,arguments);return b(this),t},pull:function(){var t=o.pull.apply(this,arguments);return b(this),t},
/*!
* Wraps [`Array#shift`](https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array/unshift) with proper change tracking.
*/
shift:function(){var t=o.shift.apply(this,arguments);return b(this),t},
/*!
* Wraps [`Array#splice`](https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array/splice) with proper change tracking and casting.
*/
splice:function(){var t=o.splice.apply(this,arguments);return b(this),t},inspect:function(){return this.toObject()},create:function(t){var e=this[p].casterConstructor;if(t&&e.discriminators&&e.schema&&e.schema.options&&e.schema.options.discriminatorKey)if("string"==typeof t[e.schema.options.discriminatorKey]&&e.discriminators[t[e.schema.options.discriminatorKey]])e=e.discriminators[t[e.schema.options.discriminatorKey]];else{var r=h(e.discriminators,t[e.schema.options.discriminatorKey]);r&&(e=r)}return new e(t,this)},
/*!
* ignore
*/
notify:function(t){var e=this;return function r(n,i){for(var o=(i=i||e).length;o--;)if(null!=i[o]){switch(t){case"save":n=e[o]}c.isMongooseArray(i[o])?r(n,i[o]):i[o]&&i[o].emit(t,n)}}},set:function(t,e,r){var n=this.__array;if(r)return n[t]=e,this;var i=m._cast.call(this,e,t);return n[t]=i,m._markModified.call(this,t),this},_markModified:function(t,e){var r,n=this[l];if(n){if(r=this[d],arguments.length)if(null!=e){var i=t.__index;r=r+"."+i+"."+e}else r=r+"."+t;if(null!=r&&r.endsWith(".$"))return this;n.markModified(r,0!==arguments.length?t:n)}return this}};
/*!
* If this is a document array, each element may contain single
* populated paths, so we need to modify the top-level document's
* populated cache. See gh-8247, gh-8265.
*/
function b(t){var e=t[l];if(e&&null!=e.$__.populated){var r,i=n(Object.keys(e.$__.populated).filter((function(e){return e.startsWith(t[d]+".")})));try{var o=function(){var n=r.value,i=n.slice((t[d]+".").length);if(!Array.isArray(e.$__.populated[n].value))return"continue";e.$__.populated[n].value=t.map((function(t){return t.$populated(i)}))};for(i.s();!(r=i.n()).done;)o()}catch(t){i.e(t)}finally{i.f()}}}t.exports=m}).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)}function i(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function s(t,e){return(s=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function a(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=h(t);if(e){var i=h(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return u(this,r)}}function u(t,e){if(e&&("object"===n(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function h(t){return(h=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var f=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&s(t,e)}(h,t);var e,r,n,u=a(h);function h(){return o(this,h),u.apply(this,arguments)}return e=h,r&&i(e.prototype,r),n&&i(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}(r(15)),c=r(16);Object.defineProperty(f.prototype,"excludeIndexes",c),Object.defineProperty(f.prototype,"_id",c),
/*!
* ignore
*/
t.exports=f},function(t,e,r){"use strict";
/*!
* Module dependencies.
*/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(20),s=r(13).EventEmitter,a=r(154),u=r(330),h=r(10),f=r(83),c=r(56).castToNumber,l=r(172),d=r(165),p=r(6),y=r(174),m=r(173),b=r(34).internalToObjectOptions,v=r(4);function g(t,e,r){t=m(t,r),this.caster=w(t),this.caster.path=e,this.caster.prototype.$basePath=e,this.schema=t,this.$isSingleNested=!0,h.call(this,e,r,"Embedded")}
/*!
* ignore
*/
/*!
* ignore
*/
function w(t,e){i||(i=r(90));var n=function(t,e,r){var n=this;this.$__parent=r,i.apply(this,arguments),this.$session(this.ownerDocument().$session()),r&&(r.$on("save",(function(){n.emit("save",n),n.constructor.emit("save",n)})),r.$on("isNew",(function(t){n.isNew=t,n.emit("isNew",t),n.constructor.emit("isNew",t)})))};t._preCompile();var o=null!=e?e.prototype:i.prototype;for(var a in(n.prototype=Object.create(o)).$__setSchema(t),n.prototype.constructor=n,n.schema=t,n.$isSingleNested=!0,n.events=new s,n.prototype.toBSON=function(){return this.toObject(b)},t.methods)n.prototype[a]=t.methods[a];for(var u in t.statics)n[u]=t.statics[u];for(var h in s.prototype)n[h]=s.prototype[h];return n}
/*!
* Special case for when users use a common location schema to represent
* locations for use with $geoWithin.
* https://docs.mongodb.org/manual/reference/operator/query/geoWithin/
*
* @param {Object} val
* @api private
*/t.exports=g,g.prototype=Object.create(h.prototype),g.prototype.constructor=g,g.prototype.OptionsConstructor=u,g.prototype.$conditionalHandlers.$geoWithin=function(t){return{$geometry:this.castForQuery(t.$geometry)}},
/*!
* ignore
*/
g.prototype.$conditionalHandlers.$near=g.prototype.$conditionalHandlers.$nearSphere=d.cast$near,g.prototype.$conditionalHandlers.$within=g.prototype.$conditionalHandlers.$geoWithin=d.cast$within,g.prototype.$conditionalHandlers.$geoIntersects=d.cast$geoIntersects,g.prototype.$conditionalHandlers.$minDistance=c,g.prototype.$conditionalHandlers.$maxDistance=c,g.prototype.$conditionalHandlers.$exists=f,g.prototype.cast=function(t,e,r,i,o){if(t&&t.$isSingleNested&&t.parent===e)return t;if(null!=t&&("object"!==n(t)||Array.isArray(t)))throw new a(this.path,t);var s,u=y(this.caster,t),h=p(e,"$__.selected",{}),f=this.path,c=Object.keys(h).reduce((function(t,e){return e.startsWith(f+".")&&(t[e.substring(f.length+1)]=h[e]),t}),{});return o=Object.assign({},o,{priorDoc:i}),r?((s=new u(void 0,c,e)).$init(t),s):0===Object.keys(t).length?new u({},c,e,void 0,o):new u(t,c,e,void 0,o)},g.prototype.castForQuery=function(t,e,r){var n;if(2===arguments.length){if(!(n=this.$conditionalHandlers[t]))throw new Error("Can't use "+t);return n.call(this,e)}if(null==(e=t))return e;this.options.runSetters&&(e=this._applySetters(e));var i=y(this.caster,e),s=null!=r&&null!=r.strict?r.strict:void 0;try{e=new i(e,s)}catch(t){if(!(t instanceof o))throw new o("Embedded",e,this.path,t,this);throw t}return e},g.prototype.doValidate=function(t,e,r,n){var i=y(this.caster,t);if(!t||t instanceof i||(t=new i(t,null,r)),n&&n.skipSchemaValidators)return t.validate(e);h.prototype.doValidate.call(this,t,(function(r){return r?e(r):t?void t.validate(e):e(null)}),r,n)},g.prototype.doValidateSync=function(t,e,r){if(!r||!r.skipSchemaValidators){var n=h.prototype.doValidateSync.call(this,t,e);if(n)return n}if(t)return t.validateSync()},g.prototype.discriminator=function(t,e,r){r=r||{};var n=v.isPOJO(r)?r.value:r,i=p(r,"clone",!0);return e.instanceOfSchema&&i&&(e=e.clone()),e=l(this.caster,t,e,n),this.caster.discriminators[t]=w(e,this.caster),this.caster.discriminators[t]},g.defaultOptions={},g.set=h.set,
/*!
* ignore
*/
g.prototype.clone=function(){var t=Object.assign({},this.options),e=new this.constructor(this.schema,this.path,t);return e.validators=this.validators.slice(),void 0!==this.requiredValidator&&(e.requiredValidator=this.requiredValidator),e.caster.discriminators=Object.assign({},this.caster.discriminators),e}},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)}function i(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function s(t,e){return(s=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function a(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=h(t);if(e){var i=h(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return u(this,r)}}function u(t,e){if(e&&("object"===n(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function h(t){return(h=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var f=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&s(t,e)}(h,t);var e,r,n,u=a(h);function h(){return o(this,h),u.apply(this,arguments)}return e=h,r&&i(e.prototype,r),n&&i(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}(r(15)),c=r(16);Object.defineProperty(f.prototype,"_id",c),t.exports=f},function(t,e,r){"use strict";(function(e){
/*!
* Module dependencies.
*/
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(168),o=r(332),s=r(10),a=r(161),u=r(4),h=i.Binary,f=s.CastError;function c(t,e){s.call(this,t,e,"Buffer")}
/*!
* ignore
*/
function l(t){return this.castForQuery(t)}c.schemaName="Buffer",c.defaultOptions={},
/*!
* Inherits from SchemaType.
*/
c.prototype=Object.create(s.prototype),c.prototype.constructor=c,c.prototype.OptionsConstructor=o,
/*!
* ignore
*/
c._checkRequired=function(t){return!(!t||!t.length)},c.set=s.set,c.checkRequired=s.checkRequired,c.prototype.checkRequired=function(t,e){return s._isRef(this,t,e,!0)?!!t:this.constructor._checkRequired(t)},c.prototype.cast=function(t,r,o){var a;if(s._isRef(this,t,r,o)){if(t&&t.isMongooseBuffer)return t;if(e.isBuffer(t))return t&&t.isMongooseBuffer||(t=new i(t,[this.path,r]),null!=this.options.subtype&&(t._subtype=this.options.subtype)),t;if(t instanceof h){if(a=new i(t.value(!0),[this.path,r]),"number"!=typeof t.sub_type)throw new f("Buffer",t,this.path,null,this);return a._subtype=t.sub_type,a}if(null==t||u.isNonBuiltinObject(t))return this._castRef(t,r,o)}if(t&&t._id&&(t=t._id),t&&t.isMongooseBuffer)return t;if(e.isBuffer(t))return t&&t.isMongooseBuffer||(t=new i(t,[this.path,r]),null!=this.options.subtype&&(t._subtype=this.options.subtype)),t;if(t instanceof h){if(a=new i(t.value(!0),[this.path,r]),"number"!=typeof t.sub_type)throw new f("Buffer",t,this.path,null,this);return a._subtype=t.sub_type,a}if(null===t)return t;var c=n(t);if("string"===c||"number"===c||Array.isArray(t)||"object"===c&&"Buffer"===t.type&&Array.isArray(t.data))return"number"===c&&(t=[t]),a=new i(t,[this.path,r]),null!=this.options.subtype&&(a._subtype=this.options.subtype),a;throw new f("Buffer",t,this.path,null,this)},c.prototype.subtype=function(t){return this.options.subtype=t,this},c.prototype.$conditionalHandlers=u.options(s.prototype.$conditionalHandlers,{$bitsAllClear:a,$bitsAnyClear:a,$bitsAllSet:a,$bitsAnySet:a,$gt:l,$gte:l,$lt:l,$lte:l}),c.prototype.castForQuery=function(t,e){var r;if(2===arguments.length){if(!(r=this.$conditionalHandlers[t]))throw new Error("Can't use "+t+" with Buffer.");return r.call(this,e)}e=t;var n=this._castForQuery(e);return n?n.toObject({transform:!1,virtuals:!1}):n},
/*!
* Module exports.
*/
t.exports=c}).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)}function i(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function s(t,e){return(s=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function a(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=h(t);if(e){var i=h(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return u(this,r)}}function u(t,e){if(e&&("object"===n(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function h(t){return(h=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var f=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&s(t,e)}(h,t);var e,r,n,u=a(h);function h(){return o(this,h),u.apply(this,arguments)}return e=h,r&&i(e.prototype,r),n&&i(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}(r(15)),c=r(16);Object.defineProperty(f.prototype,"subtype",c),
/*!
* ignore
*/
t.exports=f},function(t,e,r){"use strict";
/*!
* Module requirements.
*/var n=r(8),i=r(334),o=r(10),s=r(335),a=r(22),u=r(4),h=o.CastError;function f(t,e){o.call(this,t,e,"Date")}
/*!
* Date Query casting.
*
* @api private
*/
function c(t){return this.cast(t)}f.schemaName="Date",f.defaultOptions={},
/*!
* Inherits from SchemaType.
*/
f.prototype=Object.create(o.prototype),f.prototype.constructor=f,f.prototype.OptionsConstructor=i,
/*!
* ignore
*/
f._cast=s,f.set=o.set,f.cast=function(t){return 0===arguments.length||(!1===t&&(t=this._defaultCaster),this._cast=t),this._cast},
/*!
* ignore
*/
f._defaultCaster=function(t){if(null!=t&&!(t instanceof Date))throw new Error;return t},f.prototype.expires=function(t){return"Object"!==a(this._index)&&(this._index={}),this._index.expires=t,u.expires(this._index),this},
/*!
* ignore
*/
f._checkRequired=function(t){return t instanceof Date},f.checkRequired=o.checkRequired,f.prototype.checkRequired=function(t,e){return o._isRef(this,t,e,!0)?!!t:("function"==typeof this.constructor.checkRequired?this.constructor.checkRequired():f.checkRequired())(t)},f.prototype.min=function(t,e){if(this.minValidator&&(this.validators=this.validators.filter((function(t){return t.validator!==this.minValidator}),this)),t){var r=e||n.messages.Date.min;"string"==typeof r&&(r=r.replace(/{MIN}/,t===Date.now?"Date.now()":t.toString()));var i=this;this.validators.push({validator:this.minValidator=function(e){var r=t;"function"==typeof t&&t!==Date.now&&(r=r.call(this));var n=r===Date.now?r():i.cast(r);return null===e||e.valueOf()>=n.valueOf()},message:r,type:"min",min:t})}return this},f.prototype.max=function(t,e){if(this.maxValidator&&(this.validators=this.validators.filter((function(t){return t.validator!==this.maxValidator}),this)),t){var r=e||n.messages.Date.max;"string"==typeof r&&(r=r.replace(/{MAX}/,t===Date.now?"Date.now()":t.toString()));var i=this;this.validators.push({validator:this.maxValidator=function(e){var r=t;"function"==typeof r&&r!==Date.now&&(r=r.call(this));var n=r===Date.now?r():i.cast(r);return null===e||e.valueOf()<=n.valueOf()},message:r,type:"max",max:t})}return this},f.prototype.cast=function(t){var e;e="function"==typeof this._castFunction?this._castFunction:"function"==typeof this.constructor.cast?this.constructor.cast():f.cast();try{return e(t)}catch(e){throw new h("date",t,this.path,e,this)}},f.prototype.$conditionalHandlers=u.options(o.prototype.$conditionalHandlers,{$gt:c,$gte:c,$lt:c,$lte:c}),f.prototype.castForQuery=function(t,e){if(2!==arguments.length)return this._castForQuery(t);var r=this.$conditionalHandlers[t];if(!r)throw new Error("Can't use "+t+" with Date.");return r.call(this,e)},
/*!
* Module exports.
*/
t.exports=f},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)}function i(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function s(t,e){return(s=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function a(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=h(t);if(e){var i=h(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return u(this,r)}}function u(t,e){if(e&&("object"===n(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function h(t){return(h=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var f=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&s(t,e)}(h,t);var e,r,n,u=a(h);function h(){return o(this,h),u.apply(this,arguments)}return e=h,r&&i(e.prototype,r),n&&i(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}(r(15)),c=r(16);Object.defineProperty(f.prototype,"min",c),Object.defineProperty(f.prototype,"max",c),Object.defineProperty(f.prototype,"expires",c),
/*!
* ignore
*/
t.exports=f},function(t,e,r){"use strict";var n=r(43);t.exports=function(t){return null==t||""===t?null:t instanceof Date?(n.ok(!isNaN(t.valueOf())),t):(n.ok("boolean"!=typeof t),e=t instanceof Number||"number"==typeof t?new Date(t):"string"==typeof t&&!isNaN(Number(t))&&(Number(t)>=275761||Number(t)<-271820)?new Date(Number(t)):"function"==typeof t.valueOf?new Date(t.valueOf()):new Date(t),isNaN(e.valueOf())?void n.ok(!1):e);var e}},function(t,e,r){"use strict";
/*!
* Module dependencies.
*/var n,i=r(337),o=r(10),s=r(169),a=r(22),u=r(18),h=r(4),f=o.CastError;function c(t,e){var r="string"==typeof t&&24===t.length&&/^[a-f0-9]+$/i.test(t),n=e&&e.suppressWarning;!r&&void 0!==t||n||h.warn("mongoose: To create a new ObjectId please try `Mongoose.Types.ObjectId` instead of using `Mongoose.Schema.ObjectId`. Set the `suppressWarning` option if you're trying to create a hex char path in your schema."),o.call(this,t,e,"ObjectID")}
/*!
* ignore
*/
function l(t){return this.cast(t)}
/*!
* ignore
*/
function d(){return new u}function p(t){if(n||(n=r(14)),this instanceof n){if(void 0===t){var e=new u;return this.$__._id=e,e}this.$__._id=t}return t}
/*!
* Module exports.
*/c.schemaName="ObjectId",c.defaultOptions={},
/*!
* Inherits from SchemaType.
*/
c.prototype=Object.create(o.prototype),c.prototype.constructor=c,c.prototype.OptionsConstructor=i,c.get=o.get,c.set=o.set,c.prototype.auto=function(t){return t&&(this.default(d),this.set(p)),this},
/*!
* ignore
*/
c._checkRequired=function(t){return t instanceof u},
/*!
* ignore
*/
c._cast=s,c.cast=function(t){return 0===arguments.length||(!1===t&&(t=this._defaultCaster),this._cast=t),this._cast},
/*!
* ignore
*/
c._defaultCaster=function(t){if(!(t instanceof u))throw new Error(t+" is not an instance of ObjectId");return t},c.checkRequired=o.checkRequired,c.prototype.checkRequired=function(t,e){return o._isRef(this,t,e,!0)?!!t:("function"==typeof this.constructor.checkRequired?this.constructor.checkRequired():c.checkRequired())(t)},c.prototype.cast=function(t,e,r){if(o._isRef(this,t,e,r)){if(t instanceof u)return t;if("objectid"===(a(t)||"").toLowerCase())return new u(t.toHexString());if(null==t||h.isNonBuiltinObject(t))return this._castRef(t,e,r)}var n;n="function"==typeof this._castFunction?this._castFunction:"function"==typeof this.constructor.cast?this.constructor.cast():c.cast();try{return n(t)}catch(e){throw new f("ObjectId",t,this.path,e,this)}},c.prototype.$conditionalHandlers=h.options(o.prototype.$conditionalHandlers,{$gt:l,$gte:l,$lt:l,$lte:l}),d.$runBeforeSetters=!0,t.exports=c},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)}function i(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function s(t,e){return(s=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function a(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=h(t);if(e){var i=h(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return u(this,r)}}function u(t,e){if(e&&("object"===n(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function h(t){return(h=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var f=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&s(t,e)}(h,t);var e,r,n,u=a(h);function h(){return o(this,h),u.apply(this,arguments)}return e=h,r&&i(e.prototype,r),n&&i(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}(r(15)),c=r(16);Object.defineProperty(f.prototype,"auto",c),Object.defineProperty(f.prototype,"populate",c),
/*!
* ignore
*/
t.exports=f},function(t,e,r){"use strict";
/*!
* Module dependencies.
*/var n=r(10),i=n.CastError,o=r(32),s=r(339),a=r(4);function u(t,e){n.call(this,t,e,"Decimal128")}
/*!
* ignore
*/
function h(t){return this.cast(t)}u.schemaName="Decimal128",u.defaultOptions={},
/*!
* Inherits from SchemaType.
*/
u.prototype=Object.create(n.prototype),u.prototype.constructor=u,
/*!
* ignore
*/
u._cast=s,u.set=n.set,u.cast=function(t){return 0===arguments.length||(!1===t&&(t=this._defaultCaster),this._cast=t),this._cast},
/*!
* ignore
*/
u._defaultCaster=function(t){if(null!=t&&!(t instanceof o))throw new Error;return t},
/*!
* ignore
*/
u._checkRequired=function(t){return t instanceof o},u.checkRequired=n.checkRequired,u.prototype.checkRequired=function(t,e){return n._isRef(this,t,e,!0)?!!t:("function"==typeof this.constructor.checkRequired?this.constructor.checkRequired():u.checkRequired())(t)},u.prototype.cast=function(t,e,r){if(n._isRef(this,t,e,r))return t instanceof o?t:this._castRef(t,e,r);var s;s="function"==typeof this._castFunction?this._castFunction:"function"==typeof this.constructor.cast?this.constructor.cast():u.cast();try{return s(t)}catch(e){throw new i("Decimal128",t,this.path,e,this)}},u.prototype.$conditionalHandlers=a.options(n.prototype.$conditionalHandlers,{$gt:h,$gte:h,$lt:h,$lte:h}),
/*!
* Module exports.
*/
t.exports=u},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=r(32),o=r(43);t.exports=function(t){return null==t?t:"object"===n(t)&&"string"==typeof t.$numberDecimal?i.fromString(t.$numberDecimal):t instanceof i?t:"string"==typeof t?i.fromString(t):e.isBuffer(t)?new i(t):"number"==typeof t?i.fromString(String(t)):"function"==typeof t.valueOf&&"string"==typeof t.valueOf()?i.fromString(t.valueOf()):void o.ok(!1)}}).call(this,r(3).Buffer)},function(t,e,r){"use strict";(function(e){
/*!
* ignore
*/
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)}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,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function a(){return(a="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,e,r){var n=u(t,e);if(n){var i=Object.getOwnPropertyDescriptor(n,e);return i.get?i.get.call(arguments.length<3?t:r):i.value}}).apply(this,arguments)}function u(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=l(t)););return t}function h(t,e){return(h=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function f(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=l(t);if(e){var i=l(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return c(this,r)}}function c(t,e){if(e&&("object"===n(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function l(t){return(l=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var d=r(170),p=r(341),y=r(10),m=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&h(t,e)}(c,t);var r,n,o,u=f(c);function c(t,e){var r;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,c),(r=u.call(this,t,e,"Map")).$isSchemaMap=!0,r}return r=c,(n=[{key:"set",value:function(t,e){return y.set(t,e)}},{key:"cast",value:function(t,r,n){if(t instanceof d)return t;var o=this.path;if(n){var s=new d({},o,r,this.$__schemaType);if(t instanceof e.Map){var a,u=i(t.keys());try{for(u.s();!(a=u.n()).done;){var h=a.value,f=t.get(h);f=null==f?s.$__schemaType._castNullish(f):s.$__schemaType.cast(f,r,!0,null,{path:o+"."+h}),s.$init(h,f)}}catch(t){u.e(t)}finally{u.f()}}else for(var c=0,l=Object.keys(t);c<l.length;c++){var p=l[c],y=t[p];y=null==y?s.$__schemaType._castNullish(y):s.$__schemaType.cast(y,r,!0,null,{path:o+"."+p}),s.$init(p,y)}return s}return new d(t,o,r,this.$__schemaType)}},{key:"clone",value:function(){var t=a(l(c.prototype),"clone",this).call(this);return null!=this.$__schemaType&&(t.$__schemaType=this.$__schemaType.clone()),t}}])&&s(r.prototype,n),o&&s(r,o),Object.defineProperty(r,"prototyp
/*!
* Module dependencies.
*/
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(25).get().Binary,o=r(32),s=r(18),a=r(52);
/*!
* ignore
*/
function u(e){return e&&"object"===n(e)&&!(e instanceof Date)&&!(e instanceof s)&&(!Array.isArray(e)||0!==e.length)&&!(e instanceof t)&&!(e instanceof o)&&!(e instanceof i)}e.flatten=
/*!
* ignore
*/
function e(r,n,i,o){var s;s=r&&a(r)&&!t.isBuffer(r)?Object.keys(r.toObject({transform:!1,virtuals:!1})||{}):Object.keys(r||{});var h=s.length,f={};n=n?n+".":"";for(var c=0;c<h;++c){var l=s[c],d=r[l];f[n+l]=d;var p=o&&o.path&&o.path(n+l),y=o&&o.nested&&o.nested[n+l];if(!p||"Mixed"!==p.instance){if(u(d)){if(i&&i.skipArrays&&Array.isArray(d))continue;var m=e(d,n+l,i,o);for(var b in m)f[b]=m[b];Array.isArray(d)&&(f[n+l]=d)}if(y)for(var v=Object.keys(o.paths),g=0,w=v;g<w.length;g++){var _=w[g];_.startsWith(n+l+".")&&!f.hasOwnProperty(_)&&(f[_]=void 0)}}}return f}
/*!
* ignore
*/,e.modifiedPaths=function e(r,n,i){var o=Object.keys(r||{}),s=o.length;i=i||{},n=n?n+".":"";for(var h=0;h<s;++h){var f=o[h],c=r[f],l=n+f;if(i[l]=!0,-1!==l.indexOf("."))for(var d=l.split("."),p=d[0],y=1;y<d.length;++y)i[p]=!0,p+="."+d[y];!t.isBuffer(c)&&a(c)&&(c=c.toObject({transform:!1,virtuals:!1})),u(c)&&e(c,n+f,i)}return i}}).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=r(19),o=r(344),s=r(9);t.exports=function t(e){if(null!=e&&"object"===n(e)&&!Array.isArray(e)&&!e.$__)for(var r=0,a=Object.keys(e);r<a.length;r++){var u=a[r],h=e[u];if(-1===u.indexOf("."))t(e[u]);else try{delete e[u],o(e,u,h)}catch(t){if(!(t instanceof TypeError))throw t;throw new i('Conflicting dotted paths when setting document path, key: "'.concat(u,'", value: ').concat(s.inspect(h)))}}}},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}t.exports=function(t,e,r){if(-1!==e.indexOf(".")){var i,o=e.split("."),s=o.pop(),a=t,u=n(o);try{for(u.s();!(i=u.n()).done;){var h=i.value;null==a[h]&&(a[h]={}),a=a[h]}}catch(t){u.e(t)}finally{u.f()}a[s]=r}else t[e]=r}},function(t,e,r){"use strict";var n=r(6),i=r(162);
/*!
* Like `schema.path()`, except with a document, because impossible to
* determine path type without knowing the embedded discriminator key.
*/
t.exports=function t(e,r,o){for(var s=(o=o||{}).typeOnly,a=-1===r.indexOf(".")?[r]:r.split("."),u=null,h="adhocOrUndefined",f=i(e.schema,e.get(e.schema.options.discriminatorKey))||e.schema,c=0;c<a.length;++c){var l=a.slice(0,c+1).join(".");if(null!=(u=f.path(l))){if("Mixed"===u.instance)return s?"real":u;if(h=f.pathType(l),(u.$isSingleNested||u.$isMongooseDocumentArrayElement)&&null!=u.schema.discriminators){var d=u.schema.discriminators,p=e.get(l+"."+n(u,"schema.options.discriminatorKey"));if(null==p||null==d[p])continue;var y=a.slice(c+1).join(".");return t(e.get(l),y,o)}}else h="adhocOrUndefined"}return s?h:u}},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(6);t.exports=function(t,e,r){var i,s=null!=r?Object.keys(o(t.tree,r,{})):Object.keys(t.tree),a=new Set(Object.keys(e));if(a.size>1){i=new Set;var u,h=n(s);try{for(h.s();!(u=h.n()).done;){var f=u.value;a.has(f)&&i.add(f)}}catch(t){h.e(t)}finally{h.f()}var c,l=n(a);try{for(l.s();!(c=l.n()).done;){var d=c.value;i.has(d)||i.add(d)}}catch(t){l.e(t)}finally{l.f()}i=Array.from(i)}else i=Array.from(a);return i}},function(t,e,r){"use strict";var n=r(92);
/*!
* ignore
*/t.exports=function(t){if(null==t)return null;var e=Object.keys(t),r=e.length,i=null;if(1===r&&"_id"===e[0])i=!t._id;else for(;r--;)if("_id"!==e[r]&&n(t[e[r]])){i=!t[e[r]];break}return i}},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(4);
/*!
* If populating a path within a document array, make sure each
* subdoc within the array knows its subpaths are populated.
*
* ####Example:
* const doc = await Article.findOne().populate('comments.author');
* doc.comments[0].populated('author'); // Should be set
*/t.exports=function(t,e){if(null!=t._id&&null!=e&&0!==e.length){var r,i=String(t._id),s=n(e);try{for(s.s();!(r=s.n()).done;){var a=r.value;if(!a.isVirtual)for(var u=a.path.split("."),h=0;h<u.length-1;++h){var f=u.slice(0,h+1).join("."),c=u.slice(h+1).join("."),l=t.get(f);if(null!=l&&o.isMongooseDocumentArray(l)){for(var d=0;d<l.length;++d)l[d].populated(c,null==a._docs[i]?void 0:a._docs[i][d],a);break}}}}catch(t){s.e(t)}finally{s.f()}}}},function(t,e,r){"use strict";
/*!
* Module dependencies
*/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)}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}var s=r(350),a=r(6),u=r(57),h=r(92),f=r(41);
/*!
* Set each path query option to lean
*
* @param {Object} option
*/
function c(t){return function(e){e.options||(e.options={}),null!=t&&Array.isArray(t.virtuals)&&((t=Object.assign({},t)).virtuals=t.virtuals.filter((function(t){return"string"==typeof t&&t.startsWith(e.path+".")})).map((function(t){return t.slice(e.path.length+1)}))),e.options.lean=t}}
/*!
* Handle the `WriteOpResult` from the server
*/
/*!
* Prepare a set of path options for query population.
*
* @param {Query} query
* @param {Object} options
* @return {Array}
*/
e.preparePopulationOptions=function(t,e){var r=t.options.populate,n=Object.keys(r).reduce((function(t,e){return t.concat([r[e]])}),[]);return null!=e.lean&&n.filter((function(t){return null==a(t,"options.lean")})).forEach(c(e.lean)),n.forEach((function(e){e._localModel=t.model})),n},
/*!
* Prepare a set of path options for query population. This is the MongooseQuery
* version
*
* @param {Query} query
* @param {Object} options
* @return {Array}
*/
e.preparePopulationOptionsMQ=function(t,e){var r=t._mongooseOptions.populate,n=Object.keys(r).reduce((function(t,e){return t.concat([r[e]])}),[]);null!=e.lean&&n.filter((function(t){return null==a(t,"options.lean")})).forEach(c(e.lean));var i=a(t,"options.session",null);null!=i&&n.forEach((function(t){null!=t.options?"session"in t.options||(t.options.session=i):t.options={session:i}}));var o=t._fieldsForExec();return n.forEach((function(t){t._queryProjection=o})),n.forEach((function(e){e._localModel=t.model})),n},
/*!
* If the document is a mapped discriminator type, it returns a model instance for that type, otherwise,
* it returns an instance of the given model.
*
* @param {Model} model
* @param {Object} doc
* @param {Object} fields
*
* @return {Document}
*/
e.createModel=function(t,r,n,i,o){t.hooks.execPreSync("createModel",r);var s=t.schema?t.schema.discriminatorMapping:null,a=s&&s.isRoot?s.key:null,h=r[a];if(a&&h&&t.discriminators){var c=t.discriminators[h]||u(t.discriminators,h);if(c){var l=f(i);return e.applyPaths(l,c.schema),new c(void 0,l,!0)}}var d={skipId:!0,isNew:!1,willInit:!0};return null!=o&&"defaults"in o&&(d.defaults=o.defaults),new t(void 0,n,d)},
/*!
* ignore
*/
e.applyPaths=function(t,e){var r,o,u;if(t)for(u=(o=Object.keys(t)).length;u--;)if("+"!==o[u][0]){var f=t[o[u]];if(h(f)){r=!f;break}}var c=[],l=[],d=[];switch(function e(n,i){if(i||(i=""),-1!==d.indexOf(n))return[];d.push(n);var o=[];return n.eachPath((function(n,a){i&&(n=i+"."+n);var u=E(n,a);if(null!=u||Array.isArray(a)||!a.$isMongooseArray||a.$isMongooseDocumentArray||(u=E(n,a.caster)),null!=u&&o.push(u),a.schema){var h=e(a.schema,n);!1===r&&s(t,n,a.schema,c,h)}})),d.pop(),o}(e),r){case!0:var p,y=i(l);try{for(y.s();!(p=y.n()).done;){var m=p.value;t[m]=0}}catch(t){y.e(t)}finally{y.f()}break;case!1:e&&e.paths._id&&e.paths._id.options&&!1===e.paths._id.options.select&&(t._id=0);var b,v=i(c);try{for(v.s();!(b=v.n()).done;){var g=b.value;t[g]=t[g]||1}}catch(t){v.e(t)}finally{v.f()}break;case void 0:if(null==t)break;for(var w=0,_=Object.keys(t||{});w<_.length;w++){var M=_[w];M.startsWith("+")&&delete t[M]}var S,O=i(l);try{for(O.s();!(S=O.n()).done;){var A=S.value;t[A]=0}}catch(t){O.e(t)}finally{O.f()}}function E(e,i){var s="+"+e,u=t&&s in t;if(u&&delete t[s],"boolean"==typeof i.selected){if(u)return delete t[s],void(!1===r&&o.length>1&&!~o.indexOf(e)&&(t[e]=1));for(var h=e.split("."),f="",d=0;d<h.length;++d)if(f+=f.length?"."+h[d]:h[d],-1!==l.indexOf(f))return;if(!r&&a(i,"options.$skipDiscriminatorCheck",!1))for(var p="",y=0;y<h.length;++y){p+=(0===p.length?"":".")+h[y];var m=a(t,p,!1)||a(t,p+".$",!1);if(m&&"object"!==n(m))return}return(i.selected?c:l).push(e),e}}},e.handleDeleteWriteOpResult=function(t){return function(e,r){if(e)return t(e);var n=Object.assign({},r.result);return null!=a(r,"result.n",null)&&(n.deletedCount=r.result.n),null!=r.deletedCount&&(n.deletedCount=r.deletedCount),t(null,n)}}},function(t,e,r){"use strict";t.exports=function(t,e,r,n,i){var o=Object.keys(t).reduce((function(t,r){return t||r.startsWith(e+".")}),!1),s=e+"."+r.options.discriminatorKey;o||1!==i.length||i[0]!==s||n.splice(n.indexOf(s),1)}},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)}t.exports=function(t){return!!t&&("object"===n(t)||"function"==typeof t)&&"function"==typeof t.then}},function(t,e,r){"use strict";var n=/\./g;t.exports=function(t){if(-1===t.indexOf("."))return[t];for(var e=t.split(n),r=e.length,i=new Array(r),o="",s=0;s<r;++s)o+=0!==o.length?"."+e[s]:e[s],i[s]=o;return i}},function(t,e,r){"use strict";
/*!
* Module dependencies.
*/var n=r(14),i=r(13).EventEmitter,o=r(8),s=r(85),a=r(18),u=o.ValidationError,h=r(157),f=r(33);function c(t,e,r,i,u){if(!(this instanceof c))return new c(t,e,r,i,u);if(f(e)&&!e.instanceOfSchema&&(e=new s(e)),e=this.schema||e,!this.schema&&e.options._id&&void 0===(t=t||{})._id&&(t._id=new a),!e)throw new o.MissingSchemaError;for(var l in this.$__setSchema(e),n.call(this,t,r,i,u),h(this,e,{decorateDoc:!0}),e.methods)this[l]=e.methods[l];for(var d in e.statics)this[d]=e.statics[d]}
/*!
* Inherit from the NodeJS document
*/c.prototype=Object.create(n.prototype),c.prototype.constructor=c,
/*!
* ignore
*/
c.events=new i,
/*!
* Browser doc exposes the event emitter API
*/
c.$emitter=new i,["on","once","emit","listeners","removeListener","setMaxListeners","removeAllListeners","addListener"].forEach((function(t){c[t]=function(){return c.$emitter[t].apply(c.$emitter,arguments)}})),
/*!
* Module exports.
*/
c.ValidationError=u,t.exports=c}])}));