dbgate-plugin-mongo 5.0.4-alpha.7 → 5.0.6-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/backend.js +2 -2
- package/package.json +4 -4
package/dist/backend.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
module.exports=function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=228)}([function(e,t,n){"use strict";const r=n(3).MongoError,o=n(29);var i=t.formatSortValue=function(e){switch((""+e).toLowerCase()){case"ascending":case"asc":case"1":return 1;case"descending":case"desc":case"-1":return-1;default:throw new Error("Illegal sort clause, must be of the form [['field1', '(ascending|descending)'], ['field2', '(ascending|descending)']]")}},s=t.formattedOrderClause=function(e){var t={};if(null==e)return null;if(Array.isArray(e)){if(0===e.length)return null;for(var n=0;n<e.length;n++)e[n].constructor===String?t[e[n]]=1:t[e[n][0]]=i(e[n][1])}else if(null!=e&&"object"==typeof e)t=e;else{if("string"!=typeof e)throw new Error("Illegal sort clause, must be of the form [['field1', '(ascending|descending)'], ['field2', '(ascending|descending)']]");t[e]=1}return t},a=t.isObject=function(e){return"[object Object]"===Object.prototype.toString.call(e)};const c=["w","j","wtimeout","fsync","writeConcern"];const u=+process.version.split(".")[0].substring(1),l=process.emitWarning?e=>u<=6?process.emitWarning(e,"DeprecationWarning",m):process.emitWarning(e,{type:"DeprecationWarning",code:m}):e=>console.error(e);function f(e,t){return`${e} option [${t}] is deprecated and will be removed in a later version.`}const p={};try{n(188),p.ASYNC_ITERATOR=!0}catch(e){p.ASYNC_ITERATOR=!1}class d{constructor(e,t){this.db=e,this.collection=t}toString(){return this.collection?`${this.db}.${this.collection}`:this.db}withCollection(e){return new d(this.db,e)}static fromString(e){if(!e)throw new Error(`Cannot parse namespace from "${e}"`);const t=e.indexOf(".");return new d(e.substring(0,t),e.substring(t+1))}}function h(){const e=process.hrtime();return Math.floor(1e3*e[0]+e[1]/1e6)}const m="MONGODB DRIVER";function g(e){return process.emitWarning?u<=6?process.emitWarning(e,void 0,m):process.emitWarning(e,{code:m}):console.error(`[${m}] Warning:`,e)}const y=new Set;e.exports={filterOptions:function(e,t){var n={};for(var r in e)-1!==t.indexOf(r)&&(n[r]=e[r]);return n},mergeOptions:function(e,t){for(var n in t)e[n]=t[n];return e},translateOptions:function(e,t){var n={sslCA:"ca",sslCRL:"crl",sslValidate:"rejectUnauthorized",sslKey:"key",sslCert:"cert",sslPass:"passphrase",socketTimeoutMS:"socketTimeout",connectTimeoutMS:"connectionTimeout",replicaSet:"setName",rs_name:"setName",secondaryAcceptableLatencyMS:"acceptableLatency",connectWithNoPrimary:"secondaryOnlyConnectionAllowed",acceptableLatencyMS:"localThresholdMS"};for(var r in t)n[r]?e[n[r]]=t[r]:e[r]=t[r];return e},shallowClone:function(e){var t={};for(var n in e)t[n]=e[n];return t},getSingleProperty:function(e,t,n){Object.defineProperty(e,t,{enumerable:!0,get:function(){return n}})},checkCollectionName:function(e){if("string"!=typeof e)throw new r("collection name must be a String");if(!e||-1!==e.indexOf(".."))throw new r("collection names cannot be empty");if(-1!==e.indexOf("$")&&null==e.match(/((^\$cmd)|(oplog\.\$main))/))throw new r("collection names must not contain '$'");if(null!=e.match(/^\.|\.$/))throw new r("collection names must not start or end with '.'");if(-1!==e.indexOf("\0"))throw new r("collection names cannot contain a null character")},toError:function(e){if(e instanceof Error)return e;for(var t=e.err||e.errmsg||e.errMessage||e,n=r.create({message:t,driver:!0}),o="object"==typeof e?Object.keys(e):[],i=0;i<o.length;i++)try{n[o[i]]=e[o[i]]}catch(e){}return n},formattedOrderClause:s,parseIndexOptions:function(e){var t,n={},r=[];return"string"==typeof e?(r.push(e+"_1"),n[e]=1):Array.isArray(e)?e.forEach((function(e){"string"==typeof e?(r.push(e+"_1"),n[e]=1):Array.isArray(e)?(r.push(e[0]+"_"+(e[1]||1)),n[e[0]]=e[1]||1):a(e)&&(t=Object.keys(e)).forEach((function(t){r.push(t+"_"+e[t]),n[t]=e[t]}))})):a(e)&&(t=Object.keys(e)).forEach((function(t){r.push(t+"_"+e[t]),n[t]=e[t]})),{name:r.join("_"),keys:t,fieldHash:n}},normalizeHintField:function(e){var t=null;if("string"==typeof e)t=e;else if(Array.isArray(e))t={},e.forEach((function(e){t[e]=1}));else if(null!=e&&"object"==typeof e)for(var n in t={},e)t[n]=e[n];return t},handleCallback:function(e,t,n,r){try{if(null==e)return;if(e)return r?e(t,n,r):e(t,n)}catch(t){return process.nextTick((function(){throw t})),!1}return!0},decorateCommand:function(e,t,n){for(var r in t)-1===n.indexOf(r)&&(e[r]=t[r]);return e},isObject:a,debugOptions:function(e,t){var n={};return e.forEach((function(e){n[e]=t[e]})),n},MAX_JS_INT:Number.MAX_SAFE_INTEGER+1,conditionallyMergeWriteConcern:function(e,t){let n=!1;for(const t of c)if(t in e){n=!0;break}if(!n)for(const n of c)t[n]&&("writeConcern"in e||(e.writeConcern={}),e.writeConcern[n]=t[n]);return e},executeLegacyOperation:(e,t,n,o)=>{if(null==e)throw new TypeError("This method requires a valid topology instance");if(!Array.isArray(n))throw new TypeError("This method requires an array of arguments to apply");o=o||{};const i=e.s.promiseLibrary;let s,a,c,u=n[n.length-1];if(!o.skipSessions&&e.hasSessionSupport())if(a=n[n.length-2],null==a||null==a.session){c=Symbol(),s=e.startSession({owner:c});const t=n.length-2;n[t]=Object.assign({},n[t],{session:s})}else if(a.session&&a.session.hasEnded)throw new r("Use of expired sessions is not permitted");const l=(e,t)=>function(n,r){if(s&&s.owner===c&&!o.returnsCursor)s.endSession(()=>{if(delete a.session,n)return t(n);e(r)});else{if(n)return t(n);e(r)}};if("function"==typeof u){u=n.pop();const e=l(e=>u(null,e),e=>u(e,null));n.push(e);try{return t.apply(null,n)}catch(t){throw e(t),t}}if(null!=n[n.length-1])throw new TypeError("final argument to `executeLegacyOperation` must be a callback");return new i((function(e,r){const o=l(e,r);n[n.length-1]=o;try{return t.apply(null,n)}catch(e){o(e)}}))},applyRetryableWrites:function(e,t){return t&&t.s.options.retryWrites&&(e.retryWrites=!0),e},applyWriteConcern:function(e,t,n){n=n||{};const r=t.db,i=t.collection;if(n.session&&n.session.inTransaction())return e.writeConcern&&delete e.writeConcern,e;const s=o.fromOptions(n);return s?Object.assign(e,{writeConcern:s}):i&&i.writeConcern?Object.assign(e,{writeConcern:Object.assign({},i.writeConcern)}):r&&r.writeConcern?Object.assign(e,{writeConcern:Object.assign({},r.writeConcern)}):e},isPromiseLike:function(e){return e&&"function"==typeof e.then},decorateWithCollation:function(e,t,n){const o=t.s&&t.s.topology||t.topology;if(!o)throw new TypeError('parameter "target" is missing a topology');const i=o.capabilities();if(n.collation&&"object"==typeof n.collation){if(!i||!i.commandsTakeCollation)throw new r("Current topology does not support collation");e.collation=n.collation}},decorateWithReadConcern:function(e,t,n){if(n&&n.session&&n.session.inTransaction())return;let r=Object.assign({},e.readConcern||{});t.s.readConcern&&Object.assign(r,t.s.readConcern),Object.keys(r).length>0&&Object.assign(e,{readConcern:r})},decorateWithExplain:function(e,t){return e.explain?e:{explain:e,verbosity:t.verbosity}},deprecateOptions:function(e,t){if(!0===process.noDeprecation)return t;const n=e.msgHandler?e.msgHandler:f,r=new Set;function o(){const o=arguments[e.optionsIndex];return a(o)&&0!==Object.keys(o).length?(e.deprecatedOptions.forEach(t=>{if(Object.prototype.hasOwnProperty.call(o,t)&&!r.has(t)){r.add(t);const o=n(e.name,t);if(l(o),this&&this.getLogger){const e=this.getLogger();e&&e.warn(o)}}}),t.apply(this,arguments)):t.apply(this,arguments)}return Object.setPrototypeOf(o,t),t.prototype&&(o.prototype=t.prototype),o},SUPPORTS:p,MongoDBNamespace:d,emitDeprecationWarning:l,makeCounter:function*(e){let t=e||0;for(;;){const e=t;t+=1,yield e}},maybePromise:function(e,t,n){const r=e&&e.s&&e.s.promiseLibrary||Promise;let o;return"function"!=typeof t&&(o=new r((e,n)=>{t=(t,r)=>{if(t)return n(t);e(r)}})),n((function(e,n){if(null==e)t(e,n);else try{t(e)}catch(e){return process.nextTick(()=>{throw e})}})),o},now:h,calculateDurationInMs:function(e){if("number"!=typeof e)throw TypeError("numeric value required to calculate duration");const t=h()-e;return t<0?0:t},makeInterruptableAsyncInterval:function(e,t){let n,r,o,i=!1;const s=(t=t||{}).interval||1e3,a=t.minInterval||500,c="boolean"==typeof t.immediate&&t.immediate,u="function"==typeof t.clock?t.clock:h;function l(e){i||(clearTimeout(n),n=setTimeout(f,e||s))}function f(){o=0,r=u(),e(e=>{if(e)throw e;l(s)})}return c?f():(r=u(),l()),{wake:function(){const e=u(),t=e-o,n=s-(e-r);o=e,t<a||(n>a&&l(a),n<0&&f())},stop:function(){i=!0,n&&(clearTimeout(n),n=null),r=0,o=0}}},hasAtomicOperators:function e(t){return Array.isArray(t)?t.reduce((t,n)=>t||e(n),null):Object.keys("function"!=typeof t.toBSON?t:t.toBSON()).map(e=>e[0]).indexOf("$")>=0},MONGODB_WARNING_CODE:m,emitWarning:g,emitWarningOnce:function(e){if(!y.has(e))return y.add(e),g(e)}}},function(e,t,n){"use strict";const r=n(91).Explain,o=n(3).MongoError,i={READ_OPERATION:Symbol("READ_OPERATION"),WRITE_OPERATION:Symbol("WRITE_OPERATION"),RETRYABLE:Symbol("RETRYABLE"),EXECUTE_WITH_SELECTION:Symbol("EXECUTE_WITH_SELECTION"),NO_INHERIT_OPTIONS:Symbol("NO_INHERIT_OPTIONS"),EXPLAINABLE:Symbol("EXPLAINABLE")};e.exports={Aspect:i,defineAspects:function(e,t){return Array.isArray(t)||t instanceof Set||(t=[t]),t=new Set(t),Object.defineProperty(e,"aspects",{value:t,writable:!1}),t},OperationBase:class{constructor(e){if(this.options=Object.assign({},e),this.hasAspect(i.EXPLAINABLE))this.explain=r.fromOptions(e);else if(void 0!==this.options.explain)throw new o("explain is not supported on this command")}hasAspect(e){return null!=this.constructor.aspects&&this.constructor.aspects.has(e)}set session(e){Object.assign(this.options,{session:e})}get session(){return this.options.session}clearSession(){delete this.options.session}get canRetryRead(){return!0}execute(){throw new TypeError("`execute` must be implemented for OperationBase subclasses")}}}},function(e,t,n){"use strict";let r=n(185);const o=n(132)(n(186)),i=n(4).retrieveEJSON();try{const e=o("bson-ext");e&&(r=e)}catch(e){}e.exports={MongoError:n(3).MongoError,MongoNetworkError:n(3).MongoNetworkError,MongoParseError:n(3).MongoParseError,MongoTimeoutError:n(3).MongoTimeoutError,MongoServerSelectionError:n(3).MongoServerSelectionError,MongoWriteConcernError:n(3).MongoWriteConcernError,Connection:n(187),Server:n(134),ReplSet:n(428),Mongos:n(430),Logger:n(16),Cursor:n(17).CoreCursor,ReadPreference:n(10),Sessions:n(34),BSON:r,EJSON:i,Topology:n(431).Topology,Query:n(21).Query,MongoCredentials:n(198).MongoCredentials,defaultAuthProviders:n(193).defaultAuthProviders,MongoCR:n(194),X509:n(195),Plain:n(196),GSSAPI:n(197),ScramSHA1:n(88).ScramSHA1,ScramSHA256:n(88).ScramSHA256,parseConnectionString:n(446)}},function(e,t,n){"use strict";const r=Symbol("errorLabels");class o extends Error{constructor(e){if(e instanceof Error)super(e.message),this.stack=e.stack;else{if("string"==typeof e)super(e);else for(var t in super(e.message||e.errmsg||e.$err||"n/a"),e.errorLabels&&(this[r]=new Set(e.errorLabels)),e)"errorLabels"!==t&&"errmsg"!==t&&(this[t]=e[t]);Error.captureStackTrace(this,this.constructor)}this.name="MongoError"}get errmsg(){return this.message}static create(e){return new o(e)}hasErrorLabel(e){return null!=this[r]&&this[r].has(e)}addErrorLabel(e){null==this[r]&&(this[r]=new Set),this[r].add(e)}get errorLabels(){return this[r]?Array.from(this[r]):[]}}const i=Symbol("beforeHandshake");class s extends o{constructor(e,t){super(e),this.name="MongoNetworkError",t&&!0===t.beforeHandshake&&(this[i]=!0)}}class a extends o{constructor(e){super(e),this.name="MongoParseError"}}class c extends o{constructor(e,t){t&&t.error?super(t.error.message||t.error):super(e),this.name="MongoTimeoutError",t&&(this.reason=t)}}class u extends o{constructor(e,t){super(e),this.name="MongoWriteConcernError",t&&Array.isArray(t.errorLabels)&&(this[r]=new Set(t.errorLabels)),null!=t&&(this.result=function(e){const t=Object.assign({},e);return 0===t.ok&&(t.ok=1,delete t.errmsg,delete t.code,delete t.codeName),t}(t))}}const l=new Set([6,7,89,91,189,9001,10107,11600,11602,13435,13436]),f=new Set([11600,11602,10107,13435,13436,189,91,7,6,89,9001,262]);const p=new Set([91,189,11600,11602,13436]),d=new Set([10107,13435]),h=new Set([11600,91]);function m(e){return!(!e.code||!p.has(e.code))||(e.message.match(/not master or secondary/)||e.message.match(/node is recovering/))}e.exports={MongoError:o,MongoNetworkError:s,MongoNetworkTimeoutError:class extends s{constructor(e,t){super(e,t),this.name="MongoNetworkTimeoutError"}},MongoParseError:a,MongoTimeoutError:c,MongoServerSelectionError:class extends c{constructor(e,t){super(e,t),this.name="MongoServerSelectionError"}},MongoWriteConcernError:u,isRetryableError:function(e){return l.has(e.code)||e instanceof s||e.message.match(/not master/)||e.message.match(/node is recovering/)},isSDAMUnrecoverableError:function(e){return e instanceof a||null==e||!!(m(e)||(t=e,t.code&&d.has(t.code)||!m(t)&&t.message.match(/not master/)));var t},isNodeShuttingDownError:function(e){return e.code&&h.has(e.code)},isRetryableWriteError:function(e){return e instanceof u?f.has(e.code)||f.has(e.result.code):f.has(e.code)},isNetworkErrorBeforeHandshake:function(e){return!0===e[i]}}},function(e,t,n){"use strict";const r=n(410),o=n(20),i=n(132)(n(186));const s=function(){throw new Error("The `mongodb-extjson` module was not found. Please install it and try again.")};function a(e){if(e){if(e.ismaster)return e.ismaster.maxWireVersion;if("function"==typeof e.lastIsMaster){const t=e.lastIsMaster();if(t)return t.maxWireVersion}if(e.description)return e.description.maxWireVersion}return 0}e.exports={uuidV4:()=>{const e=o.randomBytes(16);return e[6]=15&e[6]|64,e[8]=63&e[8]|128,e},relayEvents:function(e,t,n){n.forEach(n=>e.on(n,e=>t.emit(n,e)))},collationNotSupported:function(e,t){return t&&t.collation&&a(e)<5},retrieveEJSON:function(){let e=i("mongodb-extjson");return e||(e={parse:s,deserialize:s,serialize:s,stringify:s,setBSONModule:s,BSON:s}),e},retrieveKerberos:function(){let e;try{e=i("kerberos")}catch(e){if("MODULE_NOT_FOUND"===e.code)throw new Error("The `kerberos` module was not found. Please install it and try again.");throw e}return e},maxWireVersion:a,isPromiseLike:function(e){return e&&"function"==typeof e.then},eachAsync:function(e,t,n){e=e||[];let r=0,o=0;for(r=0;r<e.length;++r)o++,t(e[r],i);function i(t){o--,t?n(t):r===e.length&&o<=0&&n()}0!==o||n()},eachAsyncSeries:function(e,t,n){let r=0,o=(e=e||[]).length;0!==o?t(e[r],(function i(s){r++,o--,s?n(s):r===e.length&&o<=0?n():t(e[r],i)})):n()},isUnifiedTopology:function(e){return null!=e.description},arrayStrictEqual:function(e,t){return!(!Array.isArray(e)||!Array.isArray(t))&&(e.length===t.length&&e.every((e,n)=>e===t[n]))},tagsStrictEqual:function(e,t){const n=Object.keys(e),r=Object.keys(t);return n.length===r.length&&n.every(n=>t[n]===e[n])},errorStrictEqual:function(e,t){return e===t||!(null==e&&null!=t||null!=e&&null==t)&&(e.constructor.name===t.constructor.name&&e.message===t.message)},makeStateMachine:function(e){return function(t,n){const r=e[t.s.state];if(r&&r.indexOf(n)<0)throw new TypeError(`illegal state transition from [${t.s.state}] => [${n}], allowed: [${r}]`);t.emit("stateChanged",t.s.state,n),t.s.state=n}},makeClientMetadata:function(e){e=e||{};const t={driver:{name:"nodejs",version:n(411).version},os:{type:r.type(),name:process.platform,architecture:process.arch,version:r.release()},platform:`'Node.js ${process.version}, ${r.endianness} (${e.useUnifiedTopology?"unified":"legacy"})`};if(e.driverInfo&&(e.driverInfo.name&&(t.driver.name=`${t.driver.name}|${e.driverInfo.name}`),e.driverInfo.version&&(t.version=`${t.driver.version}|${e.driverInfo.version}`),e.driverInfo.platform&&(t.platform=`${t.platform}|${e.driverInfo.platform}`)),e.appname){const n=Buffer.from(e.appname);t.application={name:n.length>128?n.slice(0,128).toString("utf8"):e.appname}}return t},noop:()=>{}}},function(e,t){e.exports=require("util")},function(e,t,n){"use strict";const r=n(10),o=n(3).MongoError,i=n(13).ServerType,s=n(189).TopologyDescription;e.exports={getReadPreference:function(e,t){var n=e.readPreference||new r("primary");if(t.readPreference&&(n=t.readPreference),"string"==typeof n&&(n=new r(n)),!(n instanceof r))throw new o("read preference must be a ReadPreference instance");return n},MESSAGE_HEADER_SIZE:16,COMPRESSION_DETAILS_SIZE:9,opcodes:{OP_REPLY:1,OP_UPDATE:2001,OP_INSERT:2002,OP_QUERY:2004,OP_GETMORE:2005,OP_DELETE:2006,OP_KILL_CURSORS:2007,OP_COMPRESSED:2012,OP_MSG:2013},parseHeader:function(e){return{length:e.readInt32LE(0),requestId:e.readInt32LE(4),responseTo:e.readInt32LE(8),opCode:e.readInt32LE(12)}},applyCommonQueryOptions:function(e,t){return Object.assign(e,{raw:"boolean"==typeof t.raw&&t.raw,promoteLongs:"boolean"!=typeof t.promoteLongs||t.promoteLongs,promoteValues:"boolean"!=typeof t.promoteValues||t.promoteValues,promoteBuffers:"boolean"==typeof t.promoteBuffers&&t.promoteBuffers,monitoring:"boolean"==typeof t.monitoring&&t.monitoring,fullResult:"boolean"==typeof t.fullResult&&t.fullResult}),"number"==typeof t.socketTimeout&&(e.socketTimeout=t.socketTimeout),t.session&&(e.session=t.session),"string"==typeof t.documentsReturnedIn&&(e.documentsReturnedIn=t.documentsReturnedIn),e},isSharded:function(e){if("mongos"===e.type)return!0;if(e.description&&e.description.type===i.Mongos)return!0;if(e.description&&e.description instanceof s){return Array.from(e.description.servers.values()).some(e=>e.type===i.Mongos)}return!1},databaseNamespace:function(e){return e.split(".")[0]},collectionNamespace:function(e){return e.split(".").slice(1).join(".")}}},function(e,t,n){"use strict";const r=n(10),o=n(13).TopologyType,i=n(3).MongoError,s=n(3).isRetryableWriteError,a=n(4).maxWireVersion,c=n(3).MongoNetworkError;function u(e,t,n){e.listeners(t).length>0&&e.emit(t,n)}var l=function(e){return e.s.serverDescription||(e.s.serverDescription={address:e.name,arbiters:[],hosts:[],passives:[],type:"Unknown"}),e.s.serverDescription},f=function(e,t){e.listeners("serverDescriptionChanged").length>0&&(e.emit("serverDescriptionChanged",{topologyId:-1!==e.s.topologyId?e.s.topologyId:e.id,address:e.name,previousDescription:l(e),newDescription:t}),e.s.serverDescription=t)},p=function(e){return e.s.topologyDescription||(e.s.topologyDescription={topologyType:"Unknown",servers:[{address:e.name,arbiters:[],hosts:[],passives:[],type:"Unknown"}]}),e.s.topologyDescription},d=function(e,t){return t||(t=e.ismaster),t?t.ismaster&&"isdbgrid"===t.msg?"Mongos":t.ismaster&&!t.hosts?"Standalone":t.ismaster?"RSPrimary":t.secondary?"RSSecondary":t.arbiterOnly?"RSArbiter":"Unknown":"Unknown"},h=function(e){return function(t){if("destroyed"!==e.s.state){var n=(new Date).getTime();u(e,"serverHeartbeatStarted",{connectionId:e.name}),e.command("admin.$cmd",{ismaster:!0},{monitoring:!0},(function(r,o){if(r)u(e,"serverHeartbeatFailed",{durationMS:i,failure:r,connectionId:e.name});else{e.emit("ismaster",o,e);var i=(new Date).getTime()-n;u(e,"serverHeartbeatSucceeded",{durationMS:i,reply:o.result,connectionId:e.name}),function(e,t,n){var r=d(e,t);return d(e,n)!==r}(e,e.s.ismaster,o.result)&&f(e,{address:e.name,arbiters:[],hosts:[],passives:[],type:e.s.inTopology?d(e):"Standalone"}),e.s.ismaster=o.result,e.s.isMasterLatencyMS=i}if("function"==typeof t)return t(r,o);e.s.inquireServerStateTimeout=setTimeout(h(e),e.s.haInterval)}))}}};const m={endSessions:function(e,t){Array.isArray(e)||(e=[e]),this.command("admin.$cmd",{endSessions:e},{readPreference:r.primaryPreferred},()=>{"function"==typeof t&&t()})}};function g(e){return e.description?e.description.type:"mongos"===e.type?o.Sharded:"replset"===e.type?o.ReplicaSetWithPrimary:o.Single}const y=function(e){return!(e.lastIsMaster().maxWireVersion<6)&&(!!e.logicalSessionTimeoutMinutes&&g(e)!==o.Single)},b="This MongoDB deployment does not support retryable writes. Please add retryWrites=false to your connection string.";e.exports={SessionMixins:m,resolveClusterTime:function(e,t){null==e.clusterTime?e.clusterTime=t:t.clusterTime.greaterThan(e.clusterTime.clusterTime)&&(e.clusterTime=t)},inquireServerState:h,getTopologyType:d,emitServerDescriptionChanged:f,emitTopologyDescriptionChanged:function(e,t){e.listeners("topologyDescriptionChanged").length>0&&(e.emit("topologyDescriptionChanged",{topologyId:-1!==e.s.topologyId?e.s.topologyId:e.id,address:e.name,previousDescription:p(e),newDescription:t}),e.s.serverDescription=t)},cloneOptions:function(e){var t={};for(var n in e)t[n]=e[n];return t},createCompressionInfo:function(e){return e.compression&&e.compression.compressors?(e.compression.compressors.forEach((function(e){if("snappy"!==e&&"zlib"!==e)throw new Error("compressors must be at least one of snappy or zlib")})),e.compression.compressors):[]},clone:function(e){return JSON.parse(JSON.stringify(e))},diff:function(e,t){var n={servers:[]};e||(e={servers:[]});for(var r=0;r<e.servers.length;r++){for(var o=!1,i=0;i<t.servers.length;i++)if(t.servers[i].address.toLowerCase()===e.servers[r].address.toLowerCase()){o=!0;break}o||n.servers.push({address:e.servers[r].address,from:e.servers[r].type,to:"Unknown"})}for(i=0;i<t.servers.length;i++){for(o=!1,r=0;r<e.servers.length;r++)if(e.servers[r].address.toLowerCase()===t.servers[i].address.toLowerCase()){o=!0;break}o||n.servers.push({address:t.servers[i].address,from:"Unknown",to:t.servers[i].type})}for(r=0;r<e.servers.length;r++){var s=e.servers[r];for(i=0;i<t.servers.length;i++){var a=t.servers[i];s.address.toLowerCase()===a.address.toLowerCase()&&s.type!==a.type&&n.servers.push({address:s.address,from:s.type,to:a.type})}}return n},Interval:function(e,t){var n=!1;this.start=function(){return this.isRunning()||(n=setInterval(e,t)),this},this.stop=function(){return clearInterval(n),n=!1,this},this.isRunning=function(){return!1!==n}},Timeout:function(e,t){var n=!1,r=()=>{n&&(clearTimeout(n),n=!1,e())};this.start=function(){return this.isRunning()||(n=setTimeout(r,t)),this},this.stop=function(){return clearTimeout(n),n=!1,this},this.isRunning=function(){return!1!==n}},isRetryableWritesSupported:y,getMMAPError:function(e){return 20===e.code&&e.errmsg.includes("Transaction numbers")?new i({message:b,errmsg:b,originalError:e}):e},topologyType:g,legacyIsRetryableWriteError:function(e,t){return e instanceof i&&(y(t)&&(e instanceof c||a(t)<9&&s(e))&&e.addErrorLabel("RetryableWriteError"),e.hasErrorLabel("RetryableWriteError"))}}},function(e,t){e.exports=require("events")},function(e,t,n){"use strict";const r=n(132)(n(412));function o(){throw new Error("Attempted to use Snappy compression, but Snappy is not installed. Install or disable Snappy compression and try again.")}e.exports={debugOptions:function(e,t){const n={};return e.forEach((function(e){n[e]=t[e]})),n},retrieveBSON:function(){const e=n(185);e.native=!1;const t=r("bson-ext");return t?(t.native=!0,t):e},retrieveSnappy:function(){let e=r("snappy");return e||(e={compress:o,uncompress:o,compressSync:o,uncompressSync:o}),e}}},function(e,t,n){"use strict";const r=n(0).emitWarningOnce,o=function(e,t,n){if(!o.isValid(e))throw new TypeError(`Invalid read preference mode ${e}`);if(t&&!Array.isArray(t)){r("ReadPreference tags must be an array, this will change in the next major version");const e=void 0!==t.maxStalenessSeconds,o=void 0!==t.hedge;e||o?(n=t,t=void 0):t=[t]}if(this.mode=e,this.tags=t,this.hedge=n&&n.hedge,null!=(n=n||{}).maxStalenessSeconds){if(n.maxStalenessSeconds<=0)throw new TypeError("maxStalenessSeconds must be a positive integer");this.maxStalenessSeconds=n.maxStalenessSeconds,this.minWireVersion=5}if(this.mode===o.PRIMARY){if(this.tags&&Array.isArray(this.tags)&&this.tags.length>0)throw new TypeError("Primary read preference cannot be combined with tags");if(this.maxStalenessSeconds)throw new TypeError("Primary read preference cannot be combined with maxStalenessSeconds");if(this.hedge)throw new TypeError("Primary read preference cannot be combined with hedge")}};Object.defineProperty(o.prototype,"preference",{enumerable:!0,get:function(){return this.mode}}),o.PRIMARY="primary",o.PRIMARY_PREFERRED="primaryPreferred",o.SECONDARY="secondary",o.SECONDARY_PREFERRED="secondaryPreferred",o.NEAREST="nearest";const i=[o.PRIMARY,o.PRIMARY_PREFERRED,o.SECONDARY,o.SECONDARY_PREFERRED,o.NEAREST,null];o.fromOptions=function(e){if(!e)return null;const t=e.readPreference;if(!t)return null;const n=e.readPreferenceTags,r=e.maxStalenessSeconds;if("string"==typeof t)return new o(t,n);if(!(t instanceof o)&&"object"==typeof t){const e=t.mode||t.preference;if(e&&"string"==typeof e)return new o(e,t.tags,{maxStalenessSeconds:t.maxStalenessSeconds||r,hedge:t.hedge})}return t},o.resolve=function(e,t){const n=(t=t||{}).session,r=e&&e.readPreference;let i;return i=t.readPreference?o.fromOptions(t):n&&n.inTransaction()&&n.transaction.options.readPreference?n.transaction.options.readPreference:null!=r?r:o.primary,"string"==typeof i?new o(i):i},o.translate=function(e){if(null==e.readPreference)return e;const t=e.readPreference;if("string"==typeof t)e.readPreference=new o(t);else if(!t||t instanceof o||"object"!=typeof t){if(!(t instanceof o))throw new TypeError("Invalid read preference: "+t)}else{const n=t.mode||t.preference;n&&"string"==typeof n&&(e.readPreference=new o(n,t.tags,{maxStalenessSeconds:t.maxStalenessSeconds}))}return e},o.isValid=function(e){return-1!==i.indexOf(e)},o.prototype.isValid=function(e){return o.isValid("string"==typeof e?e:this.mode)};const s=["primaryPreferred","secondary","secondaryPreferred","nearest"];o.prototype.slaveOk=function(){return-1!==s.indexOf(this.mode)},o.prototype.equals=function(e){return e.mode===this.mode},o.prototype.toJSON=function(){const e={mode:this.mode};return Array.isArray(this.tags)&&(e.tags=this.tags),this.maxStalenessSeconds&&(e.maxStalenessSeconds=this.maxStalenessSeconds),this.hedge&&(e.hedge=this.hedge),e},o.primary=new o("primary"),o.primaryPreferred=new o("primaryPreferred"),o.secondary=new o("secondary"),o.secondaryPreferred=new o("secondaryPreferred"),o.nearest=new o("nearest"),e.exports=o},function(e,t,n){"use strict";const r=n(0).applyWriteConcern,o=n(2).BSON.Code,i=n(0).debugOptions,s=n(0).handleCallback,a=n(2).MongoError,c=n(0).parseIndexOptions,u=n(2).ReadPreference,l=n(0).toError,f=n(140),p=n(0).MongoDBNamespace,d=["authSource","w","wtimeout","j","native_parser","forceServerObjectId","serializeFunctions","raw","promoteLongs","promoteValues","promoteBuffers","bufferMaxEntries","numberOfRetries","retryMiliSeconds","readPreference","pkFactory","parentDb","promiseLibrary","noListener"];function h(e,t,n,o,i){let p=Object.assign({},{readPreference:u.PRIMARY},o);if(p=r(p,{db:e},o),p.writeConcern&&"function"!=typeof i)throw a.create({message:"Cannot use a writeConcern without a provided callback",driver:!0});if(e.serverConfig&&e.serverConfig.isDestroyed())return i(new a("topology was destroyed"));!function(e,t,n,o,i){const f=c(n),p="string"==typeof o.name?o.name:f.name,d=[{name:p,key:f.fieldHash}],h=Object.keys(d[0]).concat(["writeConcern","w","wtimeout","j","fsync","readPreference","session"]);for(let e in o)-1===h.indexOf(e)&&(d[0][e]=o[e]);const g=e.s.topology.capabilities();if(d[0].collation&&g&&!g.commandsTakeCollation){const e=new a("server/primary/mongos does not support collation");return e.code=67,i(e)}const y=r({createIndexes:t,indexes:d},{db:e},o);o.readPreference=u.PRIMARY,m(e,y,o,(e,t)=>e?s(i,e,null):0===t.ok?s(i,l(t),null):void s(i,null,p))}(e,t,n,p,(r,c)=>{if(null==r)return s(i,r,c);if(67===r.code||11e3===r.code||85===r.code||86===r.code||11600===r.code||197===r.code)return s(i,r,c);const u=y(e,t,n,o);p.checkKeys=!1,e.s.topology.insert(e.s.namespace.withCollection(f.SYSTEM_INDEX_COLLECTION),u,p,(e,t)=>{if(null!=i)return e?s(i,e):null==t?s(i,null,null):t.result.writeErrors?s(i,a.create(t.result.writeErrors[0]),null):void s(i,null,u.name)})})}function m(e,t,n,r){if(e.serverConfig&&e.serverConfig.isDestroyed())return r(new a("topology was destroyed"));const o=n.dbName||n.authdb||e.databaseName;n.readPreference=u.resolve(e,n),e.s.logger.isDebug()&&e.s.logger.debug(`executing command ${JSON.stringify(t)} against ${o}.$cmd with options [${JSON.stringify(i(d,n))}]`),e.s.topology.command(e.s.namespace.withCollection("$cmd"),t,n,(e,t)=>e?s(r,e):n.full?s(r,null,t):void s(r,null,t.result))}function g(e,t,n,r){const o=null!=n.full&&n.full;if(e.serverConfig&&e.serverConfig.isDestroyed())return r(new a("topology was destroyed"));e.collection(t).listIndexes(n).toArray((e,t)=>e?r(l(e)):Array.isArray(t)?o?s(r,null,t):void s(r,null,function(e){let t={};for(let n=0;n<e.length;n++){const r=e[n];t[r.name]=[];for(let e in r.key)t[r.name].push([e,r.key[e]])}return t}(t)):s(r,null,[]))}function y(e,t,n,r){const o=c(n),i=o.fieldHash,s="string"==typeof r.name?r.name:o.name,a={ns:e.s.namespace.withCollection(t).toString(),key:i,name:s},u=null!=r&&"object"!=typeof r&&r;r=null==r||"boolean"==typeof r?{}:r;const l=Object.keys(a);for(let e in r)-1===l.indexOf(e)&&(a[e]=r[e]);null==a.unique&&(a.unique=u);const f=["w","wtimeout","j","fsync","readPreference","session"];for(let e=0;e<f.length;e++)delete a[f[e]];return a}e.exports={createListener:function(e,t,n){return function(r){if(n.listeners(t).length>0){n.emit(t,r,e);for(let n=0;n<e.s.children.length;n++)e.s.children[n].emit(t,r,e.s.children[n])}}},createIndex:h,ensureIndex:function(e,t,n,o,i){const c=r({},{db:e},o),l=y(e,t,n,o).name;if(e.serverConfig&&e.serverConfig.isDestroyed())return i(new a("topology was destroyed"));c.readPreference=u.PRIMARY,g(e,t,c,(r,a)=>{if(null!=r&&26!==r.code)return s(i,r,null);if(null!=a&&a[l]){if("function"==typeof i)return s(i,null,l)}else h(e,t,n,o,i)})},evaluate:function(e,t,n,r,i){let c=t,l=[];if(e.serverConfig&&e.serverConfig.isDestroyed())return i(new a("topology was destroyed"));c&&"Code"===c._bsontype||(c=new o(c)),null==n||Array.isArray(n)||"function"==typeof n?null!=n&&Array.isArray(n)&&"function"!=typeof n&&(l=n):l=[n];let f={$eval:c,args:l};r.nolock&&(f.nolock=r.nolock),r.readPreference=new u(u.PRIMARY),m(e,f,r,(e,t)=>e?s(i,e,null):t&&1===t.ok?s(i,null,t.retval):t?s(i,a.create({message:`eval failed: ${t.errmsg}`,driver:!0}),null):void s(i,e,t))},executeCommand:m,executeDbAdminCommand:function(e,t,n,r){const o=new p("admin","$cmd");e.s.topology.command(o,t,n,(t,n)=>e.serverConfig&&e.serverConfig.isDestroyed()?r(new a("topology was destroyed")):t?s(r,t):void s(r,null,n.result))},indexInformation:g,profilingInfo:function(e,t,n){try{e.collection("system.profile").find({},t).toArray(n)}catch(e){return n(e,null)}},validateDatabaseName:function(e){if("string"!=typeof e)throw a.create({message:"database name must be a string",driver:!0});if(0===e.length)throw a.create({message:"database name cannot be the empty string",driver:!0});if("$external"===e)return;const t=[" ",".","$","/","\\"];for(let n=0;n<t.length;n++)if(-1!==e.indexOf(t[n]))throw a.create({message:"database names cannot contain the character '"+t[n]+"'",driver:!0})}}},function(e,t){var n=Array.isArray;e.exports=n},function(e,t,n){"use strict";const r={Single:"Single",ReplicaSetNoPrimary:"ReplicaSetNoPrimary",ReplicaSetWithPrimary:"ReplicaSetWithPrimary",Sharded:"Sharded",Unknown:"Unknown"};e.exports={STATE_CLOSING:"closing",STATE_CLOSED:"closed",STATE_CONNECTING:"connecting",STATE_CONNECTED:"connected",TOPOLOGY_DEFAULTS:{useUnifiedTopology:!0,localThresholdMS:15,serverSelectionTimeoutMS:3e4,heartbeatFrequencyMS:1e4,minHeartbeatFrequencyMS:500},TopologyType:r,ServerType:{Standalone:"Standalone",Mongos:"Mongos",PossiblePrimary:"PossiblePrimary",RSPrimary:"RSPrimary",RSSecondary:"RSSecondary",RSArbiter:"RSArbiter",RSOther:"RSOther",RSGhost:"RSGhost",Unknown:"Unknown"},serverType:function(e){let t=e.s.description||e.s.serverDescription;return t.topologyType===r.Single?t.servers[0].type:t.type},drainTimerQueue:function(e){e.forEach(clearTimeout),e.clear()},clearAndRemoveTimerFrom:function(e,t){return clearTimeout(e),t.delete(e)}}},function(e,t,n){"use strict";const r=n(0).applyRetryableWrites,o=n(0).applyWriteConcern,i=n(0).decorateWithCollation,s=n(0).decorateWithReadConcern,a=n(11).executeCommand,c=n(0).formattedOrderClause,u=n(0).handleCallback,l=n(2).MongoError,f=n(2).ReadPreference,p=n(0).toError,d=n(17).CursorState,h=n(4).maxWireVersion;function m(e,t,n){const r="boolean"==typeof n.forceServerObjectId?n.forceServerObjectId:e.s.db.options.forceServerObjectId;return!0===r?t:t.map(t=>(!0!==r&&null==t._id&&(t._id=e.s.pkFactory.createPk()),t))}e.exports={buildCountCommand:function(e,t,n){const r=n.skip,o=n.limit;let a=n.hint;const c=n.maxTimeMS;t=t||{};const u={count:n.collectionName,query:t};return e.s.numberOfRetries?(e.options.hint?a=e.options.hint:e.cmd.hint&&(a=e.cmd.hint),i(u,e,e.cmd)):i(u,e,n),"number"==typeof r&&(u.skip=r),"number"==typeof o&&(u.limit=o),"number"==typeof c&&(u.maxTimeMS=c),a&&(u.hint=a),s(u,e),u},findAndModify:function(e,t,n,s,l,p){const d={findAndModify:e.collectionName,query:t};(n=c(n))&&(d.sort=n),d.new=!!l.new,d.remove=!!l.remove,d.upsert=!!l.upsert;const h=l.projection||l.fields;h&&(d.fields=h),l.arrayFilters&&(d.arrayFilters=l.arrayFilters,delete l.arrayFilters),s&&!l.remove&&(d.update=s),l.maxTimeMS&&(d.maxTimeMS=l.maxTimeMS),l.serializeFunctions=l.serializeFunctions||e.s.serializeFunctions,l.checkKeys=!1;let m=Object.assign({},l);m=r(m,e.s.db),m=o(m,{db:e.s.db,collection:e},l),m.writeConcern&&(d.writeConcern=m.writeConcern),!0===m.bypassDocumentValidation&&(d.bypassDocumentValidation=m.bypassDocumentValidation),m.readPreference=f.primary;try{i(d,e,m)}catch(e){return p(e,null)}a(e.s.db,d,m,(e,t)=>e?u(p,e,null):u(p,null,t))},indexInformation:function(e,t,n,r){const o=null!=n.full&&n.full;if(e.serverConfig&&e.serverConfig.isDestroyed())return r(new l("topology was destroyed"));e.collection(t).listIndexes(n).toArray((e,t)=>e?r(p(e)):Array.isArray(t)?o?u(r,null,t):void u(r,null,function(e){let t={};for(let n=0;n<e.length;n++){const r=e[n];t[r.name]=[];for(let e in r.key)t[r.name].push([e,r.key[e]])}return t}(t)):u(r,null,[]))},nextObject:function(e,t){if(e.s.state===d.CLOSED||e.isDead&&e.isDead())return u(t,l.create({message:"Cursor is closed",driver:!0}));if(e.s.state===d.INIT&&e.cmd&&e.cmd.sort)try{e.cmd.sort=c(e.cmd.sort)}catch(e){return u(t,e)}e._next((n,r)=>{if(e.s.state=d.OPEN,n)return u(t,n);u(t,null,r)})},prepareDocs:m,insertDocuments:function(e,t,n,i){"function"==typeof n&&(i=n,n={}),n=n||{},t=Array.isArray(t)?t:[t];let s=Object.assign({},n);s=r(s,e.s.db),s=o(s,{db:e.s.db,collection:e},n),!0===s.keepGoing&&(s.ordered=!1),s.serializeFunctions=n.serializeFunctions||e.s.serializeFunctions,t=m(e,t,n),e.s.topology.insert(e.s.namespace,t,s,(e,n)=>{if(null!=i){if(e)return u(i,e);if(null==n)return u(i,null,null);if(n.result.code)return u(i,p(n.result));if(n.result.writeErrors)return u(i,p(n.result.writeErrors[0]));n.ops=t,u(i,null,n)}})},removeDocuments:function(e,t,n,s){"function"==typeof n?(s=n,n={}):"function"==typeof t&&(s=t,n={},t={}),n=n||{};let a=Object.assign({},n);a=r(a,e.s.db),a=o(a,{db:e.s.db,collection:e},n),null==t&&(t={});const c={q:t,limit:0};n.single?c.limit=1:a.retryWrites&&(a.retryWrites=!1),n.hint&&(c.hint=n.hint);try{i(a,e,n)}catch(e){return s(e,null)}if(void 0!==n.explain&&h(e.s.topology)<3)return s?s(new l("server does not support explain on remove")):void 0;e.s.topology.remove(e.s.namespace,[c],a,(e,t)=>{if(null!=s)return e?u(s,e,null):null==t?u(s,null,null):t.result.code?u(s,p(t.result)):t.result.writeErrors?u(s,p(t.result.writeErrors[0])):void u(s,null,t)})},updateDocuments:function(e,t,n,s,a){if("function"==typeof s&&(a=s,s=null),null==s&&(s={}),"function"!=typeof a&&(a=null),null==t||"object"!=typeof t)return a(p("selector must be a valid JavaScript object"));if(null==n||"object"!=typeof n)return a(p("document must be a valid JavaScript object"));let c=Object.assign({},s);c=r(c,e.s.db),c=o(c,{db:e.s.db,collection:e},s),c.serializeFunctions=s.serializeFunctions||e.s.serializeFunctions;const f={q:t,u:n};f.upsert=void 0!==s.upsert&&!!s.upsert,f.multi=void 0!==s.multi&&!!s.multi,s.hint&&(f.hint=s.hint),c.arrayFilters&&(f.arrayFilters=c.arrayFilters,delete c.arrayFilters),c.retryWrites&&f.multi&&(c.retryWrites=!1);try{i(c,e,s)}catch(e){return a(e,null)}if(void 0!==s.explain&&h(e.s.topology)<3)return a?a(new l("server does not support explain on update")):void 0;e.s.topology.update(e.s.namespace,[f],c,(e,t)=>{if(null!=a)return e?u(a,e,null):null==t?u(a,null,null):t.result.code?u(a,p(t.result)):t.result.writeErrors?u(a,p(t.result.writeErrors[0])):void u(a,null,t)})}}},function(e,t){e.exports=function(e){return null!=e&&"object"==typeof e}},function(e,t,n){"use strict";var r=n(5).format,o=n(3).MongoError,i={},s={},a=null,c=process.pid,u=null,l=function(e,t){if(!(this instanceof l))return new l(e,t);t=t||{},this.className=e,t.logger?u=t.logger:null==u&&(u=console.log),t.loggerLevel&&(a=t.loggerLevel||"error"),null==s[this.className]&&(i[this.className]=!0)};l.prototype.debug=function(e,t){if(this.isDebug()&&(Object.keys(s).length>0&&s[this.className]||0===Object.keys(s).length&&i[this.className])){var n=(new Date).getTime(),o=r("[%s-%s:%s] %s %s","DEBUG",this.className,c,n,e),a={type:"debug",message:e,className:this.className,pid:c,date:n};t&&(a.meta=t),u(o,a)}},l.prototype.warn=function(e,t){if(this.isWarn()&&(Object.keys(s).length>0&&s[this.className]||0===Object.keys(s).length&&i[this.className])){var n=(new Date).getTime(),o=r("[%s-%s:%s] %s %s","WARN",this.className,c,n,e),a={type:"warn",message:e,className:this.className,pid:c,date:n};t&&(a.meta=t),u(o,a)}},l.prototype.info=function(e,t){if(this.isInfo()&&(Object.keys(s).length>0&&s[this.className]||0===Object.keys(s).length&&i[this.className])){var n=(new Date).getTime(),o=r("[%s-%s:%s] %s %s","INFO",this.className,c,n,e),a={type:"info",message:e,className:this.className,pid:c,date:n};t&&(a.meta=t),u(o,a)}},l.prototype.error=function(e,t){if(this.isError()&&(Object.keys(s).length>0&&s[this.className]||0===Object.keys(s).length&&i[this.className])){var n=(new Date).getTime(),o=r("[%s-%s:%s] %s %s","ERROR",this.className,c,n,e),a={type:"error",message:e,className:this.className,pid:c,date:n};t&&(a.meta=t),u(o,a)}},l.prototype.isInfo=function(){return"info"===a||"debug"===a},l.prototype.isError=function(){return"error"===a||"info"===a||"debug"===a},l.prototype.isWarn=function(){return"error"===a||"warn"===a||"info"===a||"debug"===a},l.prototype.isDebug=function(){return"debug"===a},l.reset=function(){a="error",s={}},l.currentLogger=function(){return u},l.setCurrentLogger=function(e){if("function"!=typeof e)throw new o("current logger must be a function");u=e},l.filter=function(e,t){"class"===e&&Array.isArray(t)&&(s={},t.forEach((function(e){s[e]=!0})))},l.setLevel=function(e){if("info"!==e&&"error"!==e&&"debug"!==e&&"warn"!==e)throw new Error(r("%s is an illegal logging level",e));a=e},e.exports=l},function(e,t,n){"use strict";const r=n(16),o=n(9).retrieveBSON,i=n(3).MongoError,s=n(3).MongoNetworkError,a=n(4).collationNotSupported,c=n(10),u=n(4).isUnifiedTopology,l=n(56),f=n(18).Readable,p=n(0).SUPPORTS,d=n(0).MongoDBNamespace,h=n(0).mergeOptions,m=n(1).OperationBase,g=o().Long,y={INIT:0,OPEN:1,CLOSED:2,GET_MORE:3};function b(e,t,n){try{e(t,n)}catch(t){process.nextTick((function(){throw t}))}}class v extends f{constructor(e,t,n,o){super({objectMode:!0}),o=o||{},t instanceof m&&(this.operation=t,t=this.operation.ns.toString(),o=this.operation.options,n=this.operation.cmd?this.operation.cmd:{}),this.pool=null,this.server=null,this.disconnectHandler=o.disconnectHandler,this.bson=e.s.bson,this.ns=t,this.namespace=d.fromString(t),this.cmd=n,this.options=o,this.topology=e,this.cursorState={cursorId:null,cmd:n,documents:o.documents||[],cursorIndex:0,dead:!1,killed:!1,init:!1,notified:!1,limit:o.limit||n.limit||0,skip:o.skip||n.skip||0,batchSize:o.batchSize||n.batchSize||1e3,currentLimit:0,transforms:o.transforms,raw:o.raw||n&&n.raw},"object"==typeof o.session&&(this.cursorState.session=o.session);const i=e.s.options;"boolean"==typeof i.promoteLongs?this.cursorState.promoteLongs=i.promoteLongs:"boolean"==typeof o.promoteLongs&&(this.cursorState.promoteLongs=o.promoteLongs),"boolean"==typeof i.promoteValues?this.cursorState.promoteValues=i.promoteValues:"boolean"==typeof o.promoteValues&&(this.cursorState.promoteValues=o.promoteValues),"boolean"==typeof i.promoteBuffers?this.cursorState.promoteBuffers=i.promoteBuffers:"boolean"==typeof o.promoteBuffers&&(this.cursorState.promoteBuffers=o.promoteBuffers),i.reconnect&&(this.cursorState.reconnect=i.reconnect),this.logger=r("Cursor",i),"number"==typeof n?(this.cursorState.cursorId=g.fromNumber(n),this.cursorState.lastCursorId=this.cursorState.cursorId):n instanceof g&&(this.cursorState.cursorId=n,this.cursorState.lastCursorId=n),this.operation&&(this.operation.cursorState=this.cursorState)}setCursorBatchSize(e){this.cursorState.batchSize=e}cursorBatchSize(){return this.cursorState.batchSize}setCursorLimit(e){this.cursorState.limit=e}cursorLimit(){return this.cursorState.limit}setCursorSkip(e){this.cursorState.skip=e}cursorSkip(){return this.cursorState.skip}_next(e){!function e(t,n){if(t.cursorState.notified)return n(new Error("cursor is exhausted"));if(function(e,t){if(e.cursorState.killed)return w(e,t),!0;return!1}(t,n))return;if(function(e,t){if(e.cursorState.dead&&!e.cursorState.killed)return e.cursorState.killed=!0,w(e,t),!0;return!1}(t,n))return;if(function(e,t){if(e.cursorState.dead&&e.cursorState.killed)return b(t,new i("cursor is dead")),!0;return!1}(t,n))return;if(!t.cursorState.init){if(!t.topology.isConnected(t.options)){if("server"===t.topology._type&&!t.topology.s.options.reconnect)return n(new i("no connection available"));if(null!=t.disconnectHandler)return t.topology.isDestroyed()?n(new i("Topology was destroyed")):void t.disconnectHandler.addObjectAndMethod("cursor",t,"next",[n],n)}return void t._initializeCursor((r,o)=>{r||null===o?n(r,o):e(t,n)})}if(t.cursorState.limit>0&&t.cursorState.currentLimit>=t.cursorState.limit)t.kill(()=>S(t,n));else if(t.cursorState.cursorIndex!==t.cursorState.documents.length||g.ZERO.equals(t.cursorState.cursorId)){if(t.cursorState.documents.length===t.cursorState.cursorIndex&&t.cmd.tailable&&g.ZERO.equals(t.cursorState.cursorId))return b(n,new i({message:"No more documents in tailed cursor",tailable:t.cmd.tailable,awaitData:t.cmd.awaitData}));if(t.cursorState.documents.length===t.cursorState.cursorIndex&&g.ZERO.equals(t.cursorState.cursorId))S(t,n);else{if(t.cursorState.limit>0&&t.cursorState.currentLimit>=t.cursorState.limit)return void t.kill(()=>S(t,n));t.cursorState.currentLimit+=1;let e=t.cursorState.documents[t.cursorState.cursorIndex++];if(!e||e.$err)return void t.kill(()=>S(t,(function(){b(n,new i(e?e.$err:void 0))})));t.cursorState.transforms&&"function"==typeof t.cursorState.transforms.doc&&(e=t.cursorState.transforms.doc(e)),b(n,null,e)}}else{if(t.cursorState.documents=[],t.cursorState.cursorIndex=0,t.topology.isDestroyed())return n(new s("connection destroyed, not possible to instantiate cursor"));if(function(e,t){if(e.pool&&e.pool.isDestroyed()){e.cursorState.killed=!0;const n=new s(`connection to host ${e.pool.host}:${e.pool.port} was destroyed`);return _(e,()=>t(n)),!0}return!1}(t,n))return;t._getMore((function(r,o,s){return r?b(n,r):(t.connection=s,0===t.cursorState.documents.length&&t.cmd.tailable&&g.ZERO.equals(t.cursorState.cursorId)?b(n,new i({message:"No more documents in tailed cursor",tailable:t.cmd.tailable,awaitData:t.cmd.awaitData})):0===t.cursorState.documents.length&&t.cmd.tailable&&!g.ZERO.equals(t.cursorState.cursorId)?e(t,n):t.cursorState.limit>0&&t.cursorState.currentLimit>=t.cursorState.limit?S(t,n):void e(t,n))}))}}(this,e)}clone(){const e=h({},this.options);return delete e.session,this.topology.cursor(this.ns,this.cmd,e)}isDead(){return!0===this.cursorState.dead}isKilled(){return!0===this.cursorState.killed}isNotified(){return!0===this.cursorState.notified}bufferedCount(){return this.cursorState.documents.length-this.cursorState.cursorIndex}readBufferedDocuments(e){const t=this.cursorState.documents.length-this.cursorState.cursorIndex,n=e<t?e:t;let r=this.cursorState.documents.slice(this.cursorState.cursorIndex,this.cursorState.cursorIndex+n);if(this.cursorState.transforms&&"function"==typeof this.cursorState.transforms.doc)for(let e=0;e<r.length;e++)r[e]=this.cursorState.transforms.doc(r[e]);return this.cursorState.limit>0&&this.cursorState.currentLimit+r.length>this.cursorState.limit&&(r=r.slice(0,this.cursorState.limit-this.cursorState.currentLimit),this.kill()),this.cursorState.currentLimit=this.cursorState.currentLimit+r.length,this.cursorState.cursorIndex=this.cursorState.cursorIndex+r.length,r}kill(e){this.cursorState.dead=!0,this.cursorState.killed=!0,this.cursorState.documents=[],null==this.cursorState.cursorId||this.cursorState.cursorId.isZero()||!1===this.cursorState.init?e&&e(null,null):this.server.killCursors(this.ns,this.cursorState,e)}rewind(){this.cursorState.init&&(this.cursorState.dead||this.kill(),this.cursorState.currentLimit=0,this.cursorState.init=!1,this.cursorState.dead=!1,this.cursorState.killed=!1,this.cursorState.notified=!1,this.cursorState.documents=[],this.cursorState.cursorId=null,this.cursorState.cursorIndex=0)}_read(){if(this.s&&this.s.state===y.CLOSED||this.isDead())return this.push(null);this._next((e,t)=>e?(this.listeners("error")&&this.listeners("error").length>0&&this.emit("error",e),this.isDead()||this.close(),this.emit("end"),this.emit("finish")):this.cursorState.streamOptions&&"function"==typeof this.cursorState.streamOptions.transform&&null!=t?this.push(this.cursorState.streamOptions.transform(t)):(this.push(t),void(null===t&&this.isDead()&&this.once("end",()=>{this.close(),this.emit("finish")}))))}_endSession(e,t){"function"==typeof e&&(t=e,e={}),e=e||{};const n=this.cursorState.session;return n&&(e.force||n.owner===this)?(this.cursorState.session=void 0,this.operation&&this.operation.clearSession(),n.endSession(t),!0):(t&&t(),!1)}_getMore(e){this.logger.isDebug()&&this.logger.debug(`schedule getMore call for query [${JSON.stringify(this.query)}]`);let t=this.cursorState.batchSize;this.cursorState.limit>0&&this.cursorState.currentLimit+t>this.cursorState.limit&&(t=this.cursorState.limit-this.cursorState.currentLimit);const n=this.cursorState;this.server.getMore(this.ns,n,t,this.options,(t,r,o)=>{(t||n.cursorId&&n.cursorId.isZero())&&this._endSession(),e(t,r,o)})}_initializeCursor(e){const t=this;if(u(t.topology)&&t.topology.shouldCheckForSessionSupport())return void t.topology.selectServer(c.primaryPreferred,t=>{t?e(t):this._initializeCursor(e)});function n(n,r){const o=t.cursorState;if((n||o.cursorId&&o.cursorId.isZero())&&t._endSession(),0===o.documents.length&&o.cursorId&&o.cursorId.isZero()&&!t.cmd.tailable&&!t.cmd.awaitData)return w(t,e);e(n,r)}const r=(e,r)=>{if(e)return n(e);const o=r.message;if(Array.isArray(o.documents)&&1===o.documents.length){const e=o.documents[0];if(o.queryFailure)return n(new i(e),null);if(!t.cmd.find||t.cmd.find&&!1===t.cmd.virtual){if(e.$err||e.errmsg)return n(new i(e),null);if(null!=e.cursor&&"string"!=typeof e.cursor){const r=e.cursor.id;return e.cursor.ns&&(t.ns=e.cursor.ns),t.cursorState.cursorId="number"==typeof r?g.fromNumber(r):r,t.cursorState.lastCursorId=t.cursorState.cursorId,t.cursorState.operationTime=e.operationTime,Array.isArray(e.cursor.firstBatch)&&(t.cursorState.documents=e.cursor.firstBatch),n(null,o)}}}const s=o.cursorId||0;t.cursorState.cursorId=s instanceof g?s:g.fromNumber(s),t.cursorState.documents=o.documents,t.cursorState.lastCursorId=o.cursorId,t.cursorState.transforms&&"function"==typeof t.cursorState.transforms.query&&(t.cursorState.documents=t.cursorState.transforms.query(o)),n(null,o)};if(t.operation)return t.logger.isDebug()&&t.logger.debug(`issue initial query [${JSON.stringify(t.cmd)}] with flags [${JSON.stringify(t.query)}]`),void l(t.topology,t.operation,(e,o)=>{if(e)n(e);else{if(t.server=t.operation.server,t.cursorState.init=!0,null!=t.cursorState.cursorId)return n();r(e,o)}});const o={};return t.cursorState.session&&(o.session=t.cursorState.session),t.operation?o.readPreference=t.operation.readPreference:t.options.readPreference&&(o.readPreference=t.options.readPreference),t.topology.selectServer(o,(o,s)=>{if(o){const n=t.disconnectHandler;return null!=n?n.addObjectAndMethod("cursor",t,"next",[e],e):e(o)}if(t.server=s,t.cursorState.init=!0,a(t.server,t.cmd))return e(new i(`server ${t.server.name} does not support collation`));if(null!=t.cursorState.cursorId)return n();if(t.logger.isDebug()&&t.logger.debug(`issue initial query [${JSON.stringify(t.cmd)}] with flags [${JSON.stringify(t.query)}]`),null!=t.cmd.find)return void s.query(t.ns,t.cmd,t.cursorState,t.options,r);const c=Object.assign({session:t.cursorState.session},t.options);s.command(t.ns,t.cmd,c,r)})}}function S(e,t){e.cursorState.dead=!0,w(e,t)}function w(e,t){_(e,()=>b(t,null,null))}function _(e,t){if(e.cursorState.notified=!0,e.cursorState.documents=[],e.cursorState.cursorIndex=0,!e.cursorState.session)return t();e._endSession(t)}p.ASYNC_ITERATOR&&(v.prototype[Symbol.asyncIterator]=n(188).asyncIterator),e.exports={CursorState:y,CoreCursor:v}},function(e,t){e.exports=require("stream")},function(e,t,n){var r=n(149),o="object"==typeof self&&self&&self.Object===Object&&self,i=r||o||Function("return this")();e.exports=i},function(e,t){e.exports=require("crypto")},function(e,t,n){"use strict";var r=(0,n(9).retrieveBSON)().Long;const o=n(22).Buffer;var i=0,s=n(6).opcodes,a=function(e,t,n,r){if(null==t)throw new Error("ns must be specified for query");if(null==n)throw new Error("query must be specified for query");if(-1!==t.indexOf("\0"))throw new Error("namespace cannot contain a null character");this.bson=e,this.ns=t,this.query=n,this.numberToSkip=r.numberToSkip||0,this.numberToReturn=r.numberToReturn||0,this.returnFieldSelector=r.returnFieldSelector||null,this.requestId=a.getRequestId(),this.pre32Limit=r.pre32Limit,this.serializeFunctions="boolean"==typeof r.serializeFunctions&&r.serializeFunctions,this.ignoreUndefined="boolean"==typeof r.ignoreUndefined&&r.ignoreUndefined,this.maxBsonSize=r.maxBsonSize||16777216,this.checkKeys="boolean"!=typeof r.checkKeys||r.checkKeys,this.batchSize=this.numberToReturn,this.tailable=!1,this.slaveOk="boolean"==typeof r.slaveOk&&r.slaveOk,this.oplogReplay=!1,this.noCursorTimeout=!1,this.awaitData=!1,this.exhaust=!1,this.partial=!1};a.prototype.incRequestId=function(){this.requestId=i++},a.nextRequestId=function(){return i+1},a.prototype.toBin=function(){var e=[],t=null,n=0;this.tailable&&(n|=2),this.slaveOk&&(n|=4),this.oplogReplay&&(n|=8),this.noCursorTimeout&&(n|=16),this.awaitData&&(n|=32),this.exhaust&&(n|=64),this.partial&&(n|=128),this.batchSize!==this.numberToReturn&&(this.numberToReturn=this.batchSize);var r=o.alloc(20+o.byteLength(this.ns)+1+4+4);e.push(r);var i=this.bson.serialize(this.query,{checkKeys:this.checkKeys,serializeFunctions:this.serializeFunctions,ignoreUndefined:this.ignoreUndefined});e.push(i),this.returnFieldSelector&&Object.keys(this.returnFieldSelector).length>0&&(t=this.bson.serialize(this.returnFieldSelector,{checkKeys:this.checkKeys,serializeFunctions:this.serializeFunctions,ignoreUndefined:this.ignoreUndefined}),e.push(t));var a=r.length+i.length+(t?t.length:0),c=4;return r[3]=a>>24&255,r[2]=a>>16&255,r[1]=a>>8&255,r[0]=255&a,r[c+3]=this.requestId>>24&255,r[c+2]=this.requestId>>16&255,r[c+1]=this.requestId>>8&255,r[c]=255&this.requestId,r[(c+=4)+3]=0,r[c+2]=0,r[c+1]=0,r[c]=0,r[(c+=4)+3]=s.OP_QUERY>>24&255,r[c+2]=s.OP_QUERY>>16&255,r[c+1]=s.OP_QUERY>>8&255,r[c]=255&s.OP_QUERY,r[(c+=4)+3]=n>>24&255,r[c+2]=n>>16&255,r[c+1]=n>>8&255,r[c]=255&n,c=(c+=4)+r.write(this.ns,c,"utf8")+1,r[c-1]=0,r[c+3]=this.numberToSkip>>24&255,r[c+2]=this.numberToSkip>>16&255,r[c+1]=this.numberToSkip>>8&255,r[c]=255&this.numberToSkip,r[(c+=4)+3]=this.numberToReturn>>24&255,r[c+2]=this.numberToReturn>>16&255,r[c+1]=this.numberToReturn>>8&255,r[c]=255&this.numberToReturn,c+=4,e},a.getRequestId=function(){return++i};var c=function(e,t,n,r){r=r||{},this.numberToReturn=r.numberToReturn||0,this.requestId=i++,this.bson=e,this.ns=t,this.cursorId=n};c.prototype.toBin=function(){var e=4+o.byteLength(this.ns)+1+4+8+16,t=0,n=o.alloc(e);return n[t+3]=e>>24&255,n[t+2]=e>>16&255,n[t+1]=e>>8&255,n[t]=255&e,n[(t+=4)+3]=this.requestId>>24&255,n[t+2]=this.requestId>>16&255,n[t+1]=this.requestId>>8&255,n[t]=255&this.requestId,n[(t+=4)+3]=0,n[t+2]=0,n[t+1]=0,n[t]=0,n[(t+=4)+3]=s.OP_GETMORE>>24&255,n[t+2]=s.OP_GETMORE>>16&255,n[t+1]=s.OP_GETMORE>>8&255,n[t]=255&s.OP_GETMORE,n[(t+=4)+3]=0,n[t+2]=0,n[t+1]=0,n[t]=0,t=(t+=4)+n.write(this.ns,t,"utf8")+1,n[t-1]=0,n[t+3]=this.numberToReturn>>24&255,n[t+2]=this.numberToReturn>>16&255,n[t+1]=this.numberToReturn>>8&255,n[t]=255&this.numberToReturn,n[(t+=4)+3]=this.cursorId.getLowBits()>>24&255,n[t+2]=this.cursorId.getLowBits()>>16&255,n[t+1]=this.cursorId.getLowBits()>>8&255,n[t]=255&this.cursorId.getLowBits(),n[(t+=4)+3]=this.cursorId.getHighBits()>>24&255,n[t+2]=this.cursorId.getHighBits()>>16&255,n[t+1]=this.cursorId.getHighBits()>>8&255,n[t]=255&this.cursorId.getHighBits(),t+=4,n};var u=function(e,t,n){this.ns=t,this.requestId=i++,this.cursorIds=n};u.prototype.toBin=function(){var e=24+8*this.cursorIds.length,t=0,n=o.alloc(e);n[t+3]=e>>24&255,n[t+2]=e>>16&255,n[t+1]=e>>8&255,n[t]=255&e,n[(t+=4)+3]=this.requestId>>24&255,n[t+2]=this.requestId>>16&255,n[t+1]=this.requestId>>8&255,n[t]=255&this.requestId,n[(t+=4)+3]=0,n[t+2]=0,n[t+1]=0,n[t]=0,n[(t+=4)+3]=s.OP_KILL_CURSORS>>24&255,n[t+2]=s.OP_KILL_CURSORS>>16&255,n[t+1]=s.OP_KILL_CURSORS>>8&255,n[t]=255&s.OP_KILL_CURSORS,n[(t+=4)+3]=0,n[t+2]=0,n[t+1]=0,n[t]=0,n[(t+=4)+3]=this.cursorIds.length>>24&255,n[t+2]=this.cursorIds.length>>16&255,n[t+1]=this.cursorIds.length>>8&255,n[t]=255&this.cursorIds.length,t+=4;for(var r=0;r<this.cursorIds.length;r++)n[t+3]=this.cursorIds[r].getLowBits()>>24&255,n[t+2]=this.cursorIds[r].getLowBits()>>16&255,n[t+1]=this.cursorIds[r].getLowBits()>>8&255,n[t]=255&this.cursorIds[r].getLowBits(),n[(t+=4)+3]=this.cursorIds[r].getHighBits()>>24&255,n[t+2]=this.cursorIds[r].getHighBits()>>16&255,n[t+1]=this.cursorIds[r].getHighBits()>>8&255,n[t]=255&this.cursorIds[r].getHighBits(),t+=4;return n};var l=function(e,t,n,o,i){i=i||{promoteLongs:!0,promoteValues:!0,promoteBuffers:!1},this.parsed=!1,this.raw=t,this.data=o,this.bson=e,this.opts=i,this.length=n.length,this.requestId=n.requestId,this.responseTo=n.responseTo,this.opCode=n.opCode,this.fromCompressed=n.fromCompressed,this.responseFlags=o.readInt32LE(0),this.cursorId=new r(o.readInt32LE(4),o.readInt32LE(8)),this.startingFrom=o.readInt32LE(12),this.numberReturned=o.readInt32LE(16),this.documents=new Array(this.numberReturned),this.cursorNotFound=0!=(1&this.responseFlags),this.queryFailure=0!=(2&this.responseFlags),this.shardConfigStale=0!=(4&this.responseFlags),this.awaitCapable=0!=(8&this.responseFlags),this.promoteLongs="boolean"!=typeof i.promoteLongs||i.promoteLongs,this.promoteValues="boolean"!=typeof i.promoteValues||i.promoteValues,this.promoteBuffers="boolean"==typeof i.promoteBuffers&&i.promoteBuffers};l.prototype.isParsed=function(){return this.parsed},l.prototype.parse=function(e){if(!this.parsed){var t,n,r=(e=e||{}).raw||!1,o=e.documentsReturnedIn||null;n={promoteLongs:"boolean"==typeof e.promoteLongs?e.promoteLongs:this.opts.promoteLongs,promoteValues:"boolean"==typeof e.promoteValues?e.promoteValues:this.opts.promoteValues,promoteBuffers:"boolean"==typeof e.promoteBuffers?e.promoteBuffers:this.opts.promoteBuffers},this.index=20;for(var i=0;i<this.numberReturned;i++)t=this.data[this.index]|this.data[this.index+1]<<8|this.data[this.index+2]<<16|this.data[this.index+3]<<24,this.documents[i]=r?this.data.slice(this.index,this.index+t):this.bson.deserialize(this.data.slice(this.index,this.index+t),n),this.index=this.index+t;if(1===this.documents.length&&null!=o&&r){const e={};e[o]=!0,n.fieldsAsRaw=e;const t=this.bson.deserialize(this.documents[0],n);this.documents=[t]}this.parsed=!0}},e.exports={Query:a,GetMore:c,Response:l,KillCursor:u}},function(e,t,n){var r=n(131),o=r.Buffer;function i(e,t){for(var n in e)t[n]=e[n]}function s(e,t,n){return o(e,t,n)}o.from&&o.alloc&&o.allocUnsafe&&o.allocUnsafeSlow?e.exports=r:(i(r,t),t.Buffer=s),s.prototype=Object.create(o.prototype),i(o,s),s.from=function(e,t,n){if("number"==typeof e)throw new TypeError("Argument must not be a number");return o(e,t,n)},s.alloc=function(e,t,n){if("number"!=typeof e)throw new TypeError("Argument must be a number");var r=o(e);return void 0!==t?"string"==typeof n?r.fill(t,n):r.fill(t):r.fill(0),r},s.allocUnsafe=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return o(e)},s.allocUnsafeSlow=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return r.SlowBuffer(e)}},function(e,t,n){"use strict";const r=n(1).Aspect,o=n(1).OperationBase,i=n(0).applyWriteConcern,s=n(0).debugOptions,a=n(0).handleCallback,c=n(2).MongoError,u=n(2).ReadPreference,l=n(0).MongoDBNamespace,f=["authSource","w","wtimeout","j","native_parser","forceServerObjectId","serializeFunctions","raw","promoteLongs","promoteValues","promoteBuffers","bufferMaxEntries","numberOfRetries","retryMiliSeconds","readPreference","pkFactory","parentDb","promiseLibrary","noListener"];e.exports=class extends o{constructor(e,t,n,o){super(t),this.hasAspect(r.WRITE_OPERATION)?(i(this.options,null!=n?{db:e,coll:n}:{db:e},this.options),this.options.readPreference=u.primary):this.options.readPreference=null!=n?u.resolve(n,t):u.resolve(e,t),this.db=e,null!=o&&(this.command=o),null!=n&&(this.collection=n)}_buildCommand(){if(null!=this.command)return this.command}execute(e){const t=this.db,n=Object.assign({},this.options);if(t.serverConfig&&t.serverConfig.isDestroyed())return e(new c("topology was destroyed"));let o;try{o=this._buildCommand()}catch(t){return e(t)}const i=n.dbName||n.authdb||t.databaseName;this.hasAspect(r.WRITE_OPERATION)&&(!n.writeConcern||n.session&&n.session.inTransaction()||(o.writeConcern=n.writeConcern)),t.s.logger.isDebug()&&t.s.logger.debug(`executing command ${JSON.stringify(o)} against ${i}.$cmd with options [${JSON.stringify(s(f,n))}]`);const u=null!=this.namespace?this.namespace:new l(i,"$cmd");t.s.topology.command(u,o,n,(t,r)=>t?a(e,t):n.full?a(e,null,r):void a(e,null,r.result))}}},function(e,t,n){(function(e){var r;
|
|
1
|
+
module.exports=function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=195)}([function(e,t){e.exports=require("buffer")},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isResumableError=t.isNetworkTimeoutError=t.isSDAMUnrecoverableError=t.isNodeShuttingDownError=t.isRetryableReadError=t.isRetryableWriteError=t.needsRetryableWriteLabel=t.MongoWriteConcernError=t.MongoServerSelectionError=t.MongoSystemError=t.MongoMissingDependencyError=t.MongoMissingCredentialsError=t.MongoCompatibilityError=t.MongoInvalidArgumentError=t.MongoParseError=t.MongoNetworkTimeoutError=t.MongoNetworkError=t.isNetworkErrorBeforeHandshake=t.MongoTopologyClosedError=t.MongoCursorExhaustedError=t.MongoServerClosedError=t.MongoCursorInUseError=t.MongoUnexpectedServerResponseError=t.MongoGridFSChunkError=t.MongoGridFSStreamError=t.MongoTailableCursorError=t.MongoChangeStreamError=t.MongoAWSError=t.MongoKerberosError=t.MongoExpiredSessionError=t.MongoTransactionError=t.MongoNotConnectedError=t.MongoDecompressionError=t.MongoBatchReExecutionError=t.MongoRuntimeError=t.MongoAPIError=t.MongoDriverError=t.MongoServerError=t.MongoError=t.MongoErrorLabel=t.GET_MORE_RESUMABLE_CODES=t.MONGODB_ERROR_CODES=t.NODE_IS_RECOVERING_ERROR_MESSAGE=t.LEGACY_NOT_PRIMARY_OR_SECONDARY_ERROR_MESSAGE=t.LEGACY_NOT_WRITABLE_PRIMARY_ERROR_MESSAGE=void 0;const r=Symbol("errorLabels");t.LEGACY_NOT_WRITABLE_PRIMARY_ERROR_MESSAGE=new RegExp("not master","i"),t.LEGACY_NOT_PRIMARY_OR_SECONDARY_ERROR_MESSAGE=new RegExp("not master or secondary","i"),t.NODE_IS_RECOVERING_ERROR_MESSAGE=new RegExp("node is recovering","i"),t.MONGODB_ERROR_CODES=Object.freeze({HostUnreachable:6,HostNotFound:7,NetworkTimeout:89,ShutdownInProgress:91,PrimarySteppedDown:189,ExceededTimeLimit:262,SocketException:9001,NotWritablePrimary:10107,InterruptedAtShutdown:11600,InterruptedDueToReplStateChange:11602,NotPrimaryNoSecondaryOk:13435,NotPrimaryOrSecondary:13436,StaleShardVersion:63,StaleEpoch:150,StaleConfig:13388,RetryChangeStream:234,FailedToSatisfyReadPreference:133,CursorNotFound:43,LegacyNotPrimary:10058,WriteConcernFailed:64,NamespaceNotFound:26,IllegalOperation:20,MaxTimeMSExpired:50,UnknownReplWriteConcern:79,UnsatisfiableWriteConcern:100}),t.GET_MORE_RESUMABLE_CODES=new Set([t.MONGODB_ERROR_CODES.HostUnreachable,t.MONGODB_ERROR_CODES.HostNotFound,t.MONGODB_ERROR_CODES.NetworkTimeout,t.MONGODB_ERROR_CODES.ShutdownInProgress,t.MONGODB_ERROR_CODES.PrimarySteppedDown,t.MONGODB_ERROR_CODES.ExceededTimeLimit,t.MONGODB_ERROR_CODES.SocketException,t.MONGODB_ERROR_CODES.NotWritablePrimary,t.MONGODB_ERROR_CODES.InterruptedAtShutdown,t.MONGODB_ERROR_CODES.InterruptedDueToReplStateChange,t.MONGODB_ERROR_CODES.NotPrimaryNoSecondaryOk,t.MONGODB_ERROR_CODES.NotPrimaryOrSecondary,t.MONGODB_ERROR_CODES.StaleShardVersion,t.MONGODB_ERROR_CODES.StaleEpoch,t.MONGODB_ERROR_CODES.StaleConfig,t.MONGODB_ERROR_CODES.RetryChangeStream,t.MONGODB_ERROR_CODES.FailedToSatisfyReadPreference,t.MONGODB_ERROR_CODES.CursorNotFound]),t.MongoErrorLabel=Object.freeze({RetryableWriteError:"RetryableWriteError",TransientTransactionError:"TransientTransactionError",UnknownTransactionCommitResult:"UnknownTransactionCommitResult",ResumableChangeStreamError:"ResumableChangeStreamError",HandshakeError:"HandshakeError"});class o extends Error{constructor(e){e instanceof Error?super(e.message):super(e),this[r]=new Set}get name(){return"MongoError"}get errmsg(){return this.message}hasErrorLabel(e){return this[r].has(e)}addErrorLabel(e){this[r].add(e)}get errorLabels(){return Array.from(this[r])}}t.MongoError=o;class i extends o{constructor(e){super(e.message||e.errmsg||e.$err||"n/a"),e.errorLabels&&(this[r]=new Set(e.errorLabels));for(const t in e)"errorLabels"!==t&&"errmsg"!==t&&"message"!==t&&(this[t]=e[t])}get name(){return"MongoServerError"}}t.MongoServerError=i;class s extends o{constructor(e){super(e)}get name(){return"MongoDriverError"}}t.MongoDriverError=s;class u extends s{constructor(e){super(e)}get name(){return"MongoAPIError"}}t.MongoAPIError=u;class a extends s{constructor(e){super(e)}get name(){return"MongoRuntimeError"}}t.MongoRuntimeError=a;t.MongoBatchReExecutionError=class extends u{constructor(e="This batch has already been executed, create new batch to execute"){super(e)}get name(){return"MongoBatchReExecutionError"}};t.MongoDecompressionError=class extends a{constructor(e){super(e)}get name(){return"MongoDecompressionError"}};t.MongoNotConnectedError=class extends u{constructor(e){super(e)}get name(){return"MongoNotConnectedError"}};t.MongoTransactionError=class extends u{constructor(e){super(e)}get name(){return"MongoTransactionError"}};t.MongoExpiredSessionError=class extends u{constructor(e="Cannot use a session that has ended"){super(e)}get name(){return"MongoExpiredSessionError"}};t.MongoKerberosError=class extends a{constructor(e){super(e)}get name(){return"MongoKerberosError"}};t.MongoAWSError=class extends a{constructor(e){super(e)}get name(){return"MongoAWSError"}};t.MongoChangeStreamError=class extends a{constructor(e){super(e)}get name(){return"MongoChangeStreamError"}};t.MongoTailableCursorError=class extends u{constructor(e="Tailable cursor does not support this operation"){super(e)}get name(){return"MongoTailableCursorError"}};t.MongoGridFSStreamError=class extends a{constructor(e){super(e)}get name(){return"MongoGridFSStreamError"}};t.MongoGridFSChunkError=class extends a{constructor(e){super(e)}get name(){return"MongoGridFSChunkError"}};t.MongoUnexpectedServerResponseError=class extends a{constructor(e){super(e)}get name(){return"MongoUnexpectedServerResponseError"}};t.MongoCursorInUseError=class extends u{constructor(e="Cursor is already initialized"){super(e)}get name(){return"MongoCursorInUseError"}};t.MongoServerClosedError=class extends u{constructor(e="Server is closed"){super(e)}get name(){return"MongoServerClosedError"}};t.MongoCursorExhaustedError=class extends u{constructor(e){super(e||"Cursor is exhausted")}get name(){return"MongoCursorExhaustedError"}};t.MongoTopologyClosedError=class extends u{constructor(e="Topology is closed"){super(e)}get name(){return"MongoTopologyClosedError"}};const c=Symbol("beforeHandshake");t.isNetworkErrorBeforeHandshake=function(e){return!0===e[c]};class l extends o{constructor(e,t){super(e),t&&"boolean"==typeof t.beforeHandshake&&(this[c]=t.beforeHandshake)}get name(){return"MongoNetworkError"}}t.MongoNetworkError=l;t.MongoNetworkTimeoutError=class extends l{constructor(e,t){super(e,t)}get name(){return"MongoNetworkTimeoutError"}};class d extends s{constructor(e){super(e)}get name(){return"MongoParseError"}}t.MongoParseError=d;t.MongoInvalidArgumentError=class extends u{constructor(e){super(e)}get name(){return"MongoInvalidArgumentError"}};t.MongoCompatibilityError=class extends u{constructor(e){super(e)}get name(){return"MongoCompatibilityError"}};t.MongoMissingCredentialsError=class extends u{constructor(e){super(e)}get name(){return"MongoMissingCredentialsError"}};t.MongoMissingDependencyError=class extends u{constructor(e){super(e)}get name(){return"MongoMissingDependencyError"}};class f extends o{constructor(e,t){var n;t&&t.error?super(t.error.message||t.error):super(e),t&&(this.reason=t),this.code=null===(n=t.error)||void 0===n?void 0:n.code}get name(){return"MongoSystemError"}}t.MongoSystemError=f;t.MongoServerSelectionError=class extends f{constructor(e,t){super(e,t)}get name(){return"MongoServerSelectionError"}};class p extends i{constructor(e,t){t&&Array.isArray(t.errorLabels)&&(e.errorLabels=t.errorLabels),super(e),this.errInfo=e.errInfo,null!=t&&(this.result=function(e){const t=Object.assign({},e);return 0===t.ok&&(t.ok=1,delete t.errmsg,delete t.code,delete t.codeName),t}(t))}get name(){return"MongoWriteConcernError"}}t.MongoWriteConcernError=p;const h=new Set([t.MONGODB_ERROR_CODES.HostUnreachable,t.MONGODB_ERROR_CODES.HostNotFound,t.MONGODB_ERROR_CODES.NetworkTimeout,t.MONGODB_ERROR_CODES.ShutdownInProgress,t.MONGODB_ERROR_CODES.PrimarySteppedDown,t.MONGODB_ERROR_CODES.SocketException,t.MONGODB_ERROR_CODES.NotWritablePrimary,t.MONGODB_ERROR_CODES.InterruptedAtShutdown,t.MONGODB_ERROR_CODES.InterruptedDueToReplStateChange,t.MONGODB_ERROR_CODES.NotPrimaryNoSecondaryOk,t.MONGODB_ERROR_CODES.NotPrimaryOrSecondary]),m=new Set([...h,t.MONGODB_ERROR_CODES.ExceededTimeLimit]);t.needsRetryableWriteLabel=function(e,n){var r,i,s;return e instanceof l||!(e instanceof o&&(n>=9||e.hasErrorLabel(t.MongoErrorLabel.RetryableWriteError))&&!e.hasErrorLabel(t.MongoErrorLabel.HandshakeError))&&(e instanceof p?m.has(null!==(s=null!==(i=null===(r=e.result)||void 0===r?void 0:r.code)&&void 0!==i?i:e.code)&&void 0!==s?s:0):e instanceof o&&"number"==typeof e.code?m.has(e.code):!!t.LEGACY_NOT_WRITABLE_PRIMARY_ERROR_MESSAGE.test(e.message)||!!t.NODE_IS_RECOVERING_ERROR_MESSAGE.test(e.message))},t.isRetryableWriteError=function(e){return e.hasErrorLabel(t.MongoErrorLabel.RetryableWriteError)},t.isRetryableReadError=function(e){return!("number"!=typeof e.code||!h.has(e.code))||(e instanceof l||(!!t.LEGACY_NOT_WRITABLE_PRIMARY_ERROR_MESSAGE.test(e.message)||!!t.NODE_IS_RECOVERING_ERROR_MESSAGE.test(e.message)))};const g=new Set([t.MONGODB_ERROR_CODES.ShutdownInProgress,t.MONGODB_ERROR_CODES.PrimarySteppedDown,t.MONGODB_ERROR_CODES.InterruptedAtShutdown,t.MONGODB_ERROR_CODES.InterruptedDueToReplStateChange,t.MONGODB_ERROR_CODES.NotPrimaryOrSecondary]),E=new Set([t.MONGODB_ERROR_CODES.NotWritablePrimary,t.MONGODB_ERROR_CODES.NotPrimaryNoSecondaryOk,t.MONGODB_ERROR_CODES.LegacyNotPrimary]),y=new Set([t.MONGODB_ERROR_CODES.InterruptedAtShutdown,t.MONGODB_ERROR_CODES.ShutdownInProgress]);function v(e){return"number"==typeof e.code?g.has(e.code):t.LEGACY_NOT_PRIMARY_OR_SECONDARY_ERROR_MESSAGE.test(e.message)||t.NODE_IS_RECOVERING_ERROR_MESSAGE.test(e.message)}t.isNodeShuttingDownError=function(e){return!("number"!=typeof e.code||!y.has(e.code))},t.isSDAMUnrecoverableError=function(e){return e instanceof d||null==e||(v(e)||("number"==typeof(n=e).code?E.has(n.code):!v(n)&&t.LEGACY_NOT_WRITABLE_PRIMARY_ERROR_MESSAGE.test(n.message)));var n},t.isNetworkTimeoutError=function(e){return!!(e instanceof l&&e.message.match(/timed out/))},t.isResumableError=function(e,n){return null!=e&&e instanceof o&&(e instanceof l||(null!=n&&n>=9?e.code===t.MONGODB_ERROR_CODES.CursorNotFound||e.hasErrorLabel(t.MongoErrorLabel.ResumableChangeStreamError):"number"==typeof e.code&&t.GET_MORE_RESUMABLE_CODES.has(e.code)))}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.shuffle=t.parsePackageVersion=t.supportsRetryableWrites=t.enumToString=t.emitWarningOnce=t.emitWarning=t.MONGODB_WARNING_CODE=t.DEFAULT_PK_FACTORY=t.HostAddress=t.BufferPool=t.deepCopy=t.isRecord=t.setDifference=t.isHello=t.isSuperset=t.resolveOptions=t.hasAtomicOperators=t.makeInterruptibleAsyncInterval=t.calculateDurationInMs=t.now=t.makeClientMetadata=t.makeStateMachine=t.errorStrictEqual=t.arrayStrictEqual=t.eachAsyncSeries=t.eachAsync=t.collationNotSupported=t.maxWireVersion=t.uuidV4=t.databaseNamespace=t.maybePromise=t.makeCounter=t.MongoDBNamespace=t.ns=t.deprecateOptions=t.defaultMsgHandler=t.getTopology=t.decorateWithExplain=t.decorateWithReadConcern=t.decorateWithCollation=t.isPromiseLike=t.applyWriteConcern=t.applyRetryableWrites=t.filterOptions=t.mergeOptions=t.isObject=t.parseIndexOptions=t.normalizeHintField=t.checkCollectionName=t.MAX_JS_INT=void 0,t.commandSupportsReadConcern=void 0;const r=n(18),o=n(157),i=n(21),s=n(59),u=n(4),a=n(42),c=n(8),l=n(1),d=n(33),f=n(11),p=n(6),h=n(12),m=n(13);function g(e){return"[object Object]"===Object.prototype.toString.call(e)}function E(e){if("topology"in e&&e.topology)return e.topology;if("s"in e&&"client"in e.s&&e.s.client.topology)return e.s.client.topology;if("s"in e&&"db"in e.s&&e.s.db.s.client.topology)return e.s.db.s.client.topology;throw new l.MongoNotConnectedError("MongoClient must be connected to perform this operation")}function y(e,t){return`${e} option [${t}] is deprecated and will be removed in a later version.`}t.MAX_JS_INT=Number.MAX_SAFE_INTEGER+1,t.checkCollectionName=function(e){if("string"!=typeof e)throw new l.MongoInvalidArgumentError("Collection name must be a String");if(!e||-1!==e.indexOf(".."))throw new l.MongoInvalidArgumentError("Collection names cannot be empty");if(-1!==e.indexOf("$")&&null==e.match(/((^\$cmd)|(oplog\.\$main))/))throw new l.MongoInvalidArgumentError("Collection names must not contain '$'");if(null!=e.match(/^\.|\.$/))throw new l.MongoInvalidArgumentError("Collection names must not start or end with '.'");if(-1!==e.indexOf("\0"))throw new l.MongoInvalidArgumentError("Collection names cannot contain a null character")},t.normalizeHintField=function(e){let t=void 0;if("string"==typeof e)t=e;else if(Array.isArray(e))t={},e.forEach(e=>{t[e]=1});else if(null!=e&&"object"==typeof e){t={};for(const n in e)t[n]=e[n]}return t},t.parseIndexOptions=function(e){const t={},n=[];let r;return"string"==typeof e?(n.push(e+"_1"),t[e]=1):Array.isArray(e)?e.forEach(e=>{"string"==typeof e?(n.push(e+"_1"),t[e]=1):Array.isArray(e)?(n.push(e[0]+"_"+(e[1]||1)),t[e[0]]=e[1]||1):g(e)&&(r=Object.keys(e),r.forEach(r=>{n.push(r+"_"+e[r]),t[r]=e[r]}))}):g(e)&&(r=Object.keys(e),Object.entries(e).forEach(([e,r])=>{n.push(e+"_"+r),t[e]=r})),{name:n.join("_"),keys:r,fieldHash:t}},t.isObject=g,t.mergeOptions=function(e,t){return{...e,...t}},t.filterOptions=function(e,t){const n={};for(const r in e)t.includes(r)&&(n[r]=e[r]);return n},t.applyRetryableWrites=function(e,t){var n;return t&&(null===(n=t.s.options)||void 0===n?void 0:n.retryWrites)&&(e.retryWrites=!0),e},t.applyWriteConcern=function(e,t,n){n=null!=n?n:{};const r=t.db,o=t.collection;if(n.session&&n.session.inTransaction())return e.writeConcern&&delete e.writeConcern,e;const i=m.WriteConcern.fromOptions(n);return i?Object.assign(e,{writeConcern:i}):o&&o.writeConcern?Object.assign(e,{writeConcern:Object.assign({},o.writeConcern)}):r&&r.writeConcern?Object.assign(e,{writeConcern:Object.assign({},r.writeConcern)}):e},t.isPromiseLike=function(e){return!!e&&"function"==typeof e.then},t.decorateWithCollation=function(e,t,n){const r=E(t).capabilities;if(n.collation&&"object"==typeof n.collation){if(!r||!r.commandsTakeCollation)throw new l.MongoCompatibilityError("Current topology does not support collation");e.collation=n.collation}},t.decorateWithReadConcern=function(e,t,n){if(n&&n.session&&n.session.inTransaction())return;const r=Object.assign({},e.readConcern||{});t.s.readConcern&&Object.assign(r,t.s.readConcern),Object.keys(r).length>0&&Object.assign(e,{readConcern:r})},t.decorateWithExplain=function(e,t){return e.explain?e:{explain:e,verbosity:t.verbosity}},t.getTopology=E,t.defaultMsgHandler=y,t.deprecateOptions=function(e,t){if(!0===process.noDeprecation)return t;const n=e.msgHandler?e.msgHandler:y,r=new Set;function o(...o){const i=o[e.optionsIndex];if(!g(i)||0===Object.keys(i).length)return t.bind(this)(...o);for(const t of e.deprecatedOptions)if(t in i&&!r.has(t)){r.add(t);const o=n(e.name,t);if(B(o),this&&"getLogger"in this){const e=this.getLogger();e&&e.warn(o)}}return t.bind(this)(...o)}return Object.setPrototypeOf(o,t),t.prototype&&(o.prototype=t.prototype),o},t.ns=function(e){return v.fromString(e)};class v{constructor(e,t){this.db=e,this.collection=t}toString(){return this.collection?`${this.db}.${this.collection}`:this.db}withCollection(e){return new v(this.db,e)}static fromString(e){if(!e)throw new l.MongoRuntimeError(`Cannot parse namespace from "${e}"`);const[t,...n]=e.split(".");return new v(t,n.join("."))}}function A(e){if(e){if(e.loadBalanced)return a.MAX_SUPPORTED_WIRE_VERSION;if(e.hello)return e.hello.maxWireVersion;if("lastHello"in e&&"function"==typeof e.lastHello){const t=e.lastHello();if(t)return t.maxWireVersion}if(e.description&&"maxWireVersion"in e.description&&null!=e.description.maxWireVersion)return e.description.maxWireVersion}return 0}t.MongoDBNamespace=v,t.makeCounter=function*(e=0){let t=e;for(;;){const e=t;t+=1,yield e}},t.maybePromise=function(e,t){const n=d.PromiseProvider.get();let r;return"function"!=typeof e&&(r=new n((t,n)=>{e=(e,r)=>{if(e)return n(e);t(r)}})),t((t,n)=>{if(null==t)e(t,n);else try{e(t)}catch(e){process.nextTick(()=>{throw e})}}),r},t.databaseNamespace=function(e){return e.split(".")[0]},t.uuidV4=function(){const e=r.randomBytes(16);return e[6]=15&e[6]|64,e[8]=63&e[8]|128,e},t.maxWireVersion=A,t.collationNotSupported=function(e,t){return t&&t.collation&&A(e)<5},t.eachAsync=function(e,t,n){e=e||[];let r=0,o=0;for(r=0;r<e.length;++r)o++,t(e[r],i);function i(t){o--,t?n(t):r===e.length&&o<=0&&n()}0!==o||n()},t.eachAsyncSeries=function(e,t,n){let r=0,o=(e=e||[]).length;0!==o?t(e[r],(function i(s){r++,o--,s?n(s):r===e.length&&o<=0?n():t(e[r],i)})):n()},t.arrayStrictEqual=function(e,t){return!(!Array.isArray(e)||!Array.isArray(t))&&(e.length===t.length&&e.every((e,n)=>e===t[n]))},t.errorStrictEqual=function(e,t){return e===t||(e&&t?!(null==e&&null!=t||null!=e&&null==t)&&(e.constructor.name===t.constructor.name&&e.message===t.message):e===t)},t.makeStateMachine=function(e){return function(t,n){const r=e[t.s.state];if(r&&r.indexOf(n)<0)throw new l.MongoRuntimeError(`illegal state transition from [${t.s.state}] => [${n}], allowed: [${r}]`);t.emit("stateChanged",t.s.state,n),t.s.state=n}};const b=n(371).version;function C(){const e=process.hrtime();return Math.floor(1e3*e[0]+e[1]/1e6)}function S(e,t){e=Array.isArray(e)?new Set(e):e,t=Array.isArray(t)?new Set(t):t;for(const n of t)if(!e.has(n))return!1;return!0}function O(e,t){const n=Object.prototype.toString,r=Object.prototype.hasOwnProperty,o=e=>"[object Object]"===n.call(e);if(!o(e))return!1;const i=e.constructor;if(i&&i.prototype){if(!o(i.prototype))return!1;if(!r.call(i.prototype,"isPrototypeOf"))return!1}if(t){return S(Object.keys(e),t)}return!0}t.makeClientMetadata=function(e){e=null!=e?e:{};const t={driver:{name:"nodejs",version:b},os:{type:o.type(),name:process.platform,architecture:process.arch,version:o.release()},platform:`Node.js ${process.version}, ${o.endianness()} (unified)`};if(e.driverInfo&&(e.driverInfo.name&&(t.driver.name=`${t.driver.name}|${e.driverInfo.name}`),e.driverInfo.version&&(t.version=`${t.driver.version}|${e.driverInfo.version}`),e.driverInfo.platform&&(t.platform=`${t.platform}|${e.driverInfo.platform}`)),e.appName){const n=Buffer.from(e.appName);t.application={name:n.byteLength>128?n.slice(0,128).toString("utf8"):e.appName}}return t},t.now=C,t.calculateDurationInMs=function(e){if("number"!=typeof e)throw new l.MongoInvalidArgumentError("Numeric value required to calculate duration");const t=C()-e;return t<0?0:t},t.makeInterruptibleAsyncInterval=function(e,t){let n,r,o=!1,s=!1;const u=(t=null!=t?t:{}).interval||1e3,a=t.minInterval||500,c="boolean"==typeof t.immediate&&t.immediate,l="function"==typeof t.clock?t.clock:C;function d(e){s||(n&&clearTimeout(n),n=(0,i.setTimeout)(f,e||u))}function f(){o=!1,r=l(),e(e=>{if(e)throw e;d(u)})}return c?f():(r=l(),d(void 0)),{wake:function(){const e=l(),t=r+u-e;t<0?f():o||t>a&&(d(a),o=!0)},stop:function(){s=!0,n&&(clearTimeout(n),n=void 0),r=0,o=!1}}},t.hasAtomicOperators=function e(t){if(Array.isArray(t)){for(const n of t)if(e(n))return!0;return!1}const n=Object.keys(t);return n.length>0&&"$"===n[0][0]},t.resolveOptions=function(e,t){var n,r,o;const i=Object.assign({},t,(0,u.resolveBSONOptions)(t,e)),s=null==t?void 0:t.session;if(!(null==s?void 0:s.inTransaction())){const o=null!==(n=f.ReadConcern.fromOptions(t))&&void 0!==n?n:null==e?void 0:e.readConcern;o&&(i.readConcern=o);const s=null!==(r=m.WriteConcern.fromOptions(t))&&void 0!==r?r:null==e?void 0:e.writeConcern;s&&(i.writeConcern=s)}const a=null!==(o=p.ReadPreference.fromOptions(t))&&void 0!==o?o:null==e?void 0:e.readPreference;return a&&(i.readPreference=a),i},t.isSuperset=S,t.isHello=function(e){return!(!e[c.LEGACY_HELLO_COMMAND]&&!e.hello)},t.setDifference=function(e,t){const n=new Set(e);for(const e of t)n.delete(e);return n},t.isRecord=O,t.deepCopy=function e(t){if(null==t)return t;if(Array.isArray(t))return t.map(t=>e(t));if(O(t)){const n={};for(const r in t)n[r]=e(t[r]);return n}const n=t.constructor;if(n)switch(n.name.toLowerCase()){case"date":return new n(Number(t));case"map":return new Map(t);case"set":return new Set(t);case"buffer":return Buffer.from(t)}return t};const _=Symbol("buffers"),w=Symbol("length");t.BufferPool=class{constructor(){this[_]=[],this[w]=0}get length(){return this[w]}append(e){this[_].push(e),this[w]+=e.length}peek(e){return this.read(e,!1)}read(e,t=!0){if("number"!=typeof e||e<0)throw new l.MongoInvalidArgumentError('Argument "size" must be a non-negative number');if(e>this[w])return Buffer.alloc(0);let n;if(e===this.length)n=Buffer.concat(this[_]),t&&(this[_]=[],this[w]=0);else if(e<=this[_][0].length)n=this[_][0].slice(0,e),t&&(this[_][0]=this[_][0].slice(e),this[w]-=e);else{let r;n=Buffer.allocUnsafe(e);let o=0,i=e;for(r=0;r<this[_].length;++r){let e;if(!(i>this[_][r].length)){e=this[_][r].copy(n,o,0,i),t&&(this[_][r]=this[_][r].slice(e)),o+=e;break}e=this[_][r].copy(n,o,0),o+=e,i-=e}t&&(this[_]=this[_].slice(r),this[w]-=e)}return n}};class D{constructor(e){const t=e.split(" ").join("%20"),{hostname:n,port:r}=new s.URL(`mongodb://${t}`);if(n.endsWith(".sock"))this.socketPath=decodeURIComponent(n);else{if("string"!=typeof n)throw new l.MongoInvalidArgumentError("Either socketPath or host must be defined.");{this.isIPv6=!1;let e=decodeURIComponent(n).toLowerCase();if(e.startsWith("[")&&e.endsWith("]")&&(this.isIPv6=!0,e=e.substring(1,n.length-1)),this.host=e.toLowerCase(),this.port="number"==typeof r?r:"string"==typeof r&&""!==r?Number.parseInt(r,10):27017,0===this.port)throw new l.MongoParseError("Invalid port (zero) with hostname")}}Object.freeze(this)}[Symbol.for("nodejs.util.inspect.custom")](){return this.inspect()}inspect(){return`new HostAddress('${this.toString(!0)}')`}toString(e=!1){return"string"==typeof this.host?this.isIPv6&&e?`[${this.host}]:${this.port}`:`${this.host}:${this.port}`:`${this.socketPath}`}static fromString(e){return new D(e)}static fromHostPort(e,t){return e.includes(":")&&(e=`[${e}]`),D.fromString(`${e}:${t}`)}static fromSrvRecord({name:e,port:t}){return D.fromHostPort(e,t)}}function B(e){return process.emitWarning(e,{code:t.MONGODB_WARNING_CODE})}t.HostAddress=D,t.DEFAULT_PK_FACTORY={createPk:()=>new u.ObjectId},t.MONGODB_WARNING_CODE="MONGODB DRIVER",t.emitWarning=B;const T=new Set;t.emitWarningOnce=function(e){if(!T.has(e))return T.add(e),B(e)},t.enumToString=function(e){return Object.values(e).join(", ")},t.supportsRetryableWrites=function(e){return!!e&&(!!e.loadBalanced||null!=e.description.logicalSessionTimeoutMinutes&&e.description.type!==h.ServerType.Standalone)},t.parsePackageVersion=function({version:e}){const[t,n,r]=e.split(".").map(e=>Number.parseInt(e,10));return{major:t,minor:n,patch:r}},t.shuffle=function(e,t=0){const n=Array.from(e);if(t>n.length)throw new l.MongoRuntimeError("Limit must be less than the number of items");let r=n.length;const o=t%n.length==0?1:n.length-t;for(;r>o;){const e=Math.floor(Math.random()*r);r-=1;const t=n[r];n[r]=n[e],n[e]=t}return t%n.length==0?n:n.slice(o)},t.commandSupportsReadConcern=function(e,t){return!!(e.aggregate||e.count||e.distinct||e.find||e.geoNear)||!(!(e.mapReduce&&t&&t.out)||1!==t.out.inline&&"inline"!==t.out)}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.defineAspects=t.AbstractOperation=t.Aspect=void 0;const r=n(4),o=n(6);t.Aspect={READ_OPERATION:Symbol("READ_OPERATION"),WRITE_OPERATION:Symbol("WRITE_OPERATION"),RETRYABLE:Symbol("RETRYABLE"),EXPLAINABLE:Symbol("EXPLAINABLE"),SKIP_COLLATION:Symbol("SKIP_COLLATION"),CURSOR_CREATING:Symbol("CURSOR_CREATING"),CURSOR_ITERATING:Symbol("CURSOR_ITERATING")};const i=Symbol("session");t.AbstractOperation=class{constructor(e={}){var n;this.readPreference=this.hasAspect(t.Aspect.WRITE_OPERATION)?o.ReadPreference.primary:null!==(n=o.ReadPreference.fromOptions(e))&&void 0!==n?n:o.ReadPreference.primary,this.bsonOptions=(0,r.resolveBSONOptions)(e),this[i]=null!=e.session?e.session:void 0,this.options=e,this.bypassPinningCheck=!!e.bypassPinningCheck,this.trySecondaryWrite=!1}hasAspect(e){const t=this.constructor;return null!=t.aspects&&t.aspects.has(e)}get session(){return this[i]}get canRetryRead(){return!0}get canRetryWrite(){return!0}},t.defineAspects=function(e,t){return Array.isArray(t)||t instanceof Set||(t=[t]),t=new Set(t),Object.defineProperty(e,"aspects",{value:t,writable:!1}),t}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.resolveBSONOptions=t.pluckBSONSerializeOptions=t.Timestamp=t.ObjectId=t.MinKey=t.MaxKey=t.Map=t.Long=t.Int32=t.Double=t.Decimal128=t.DBRef=t.Code=t.BSONSymbol=t.BSONRegExp=t.Binary=t.calculateObjectSize=t.serialize=t.deserialize=void 0;let r=n(158);try{r=n(!function(){var e=new Error("Cannot find module 'bson-ext'");throw e.code="MODULE_NOT_FOUND",e}())}catch{}t.deserialize=r.deserialize,t.serialize=r.serialize,t.calculateObjectSize=r.calculateObjectSize;var o=n(158);Object.defineProperty(t,"Binary",{enumerable:!0,get:function(){return o.Binary}}),Object.defineProperty(t,"BSONRegExp",{enumerable:!0,get:function(){return o.BSONRegExp}}),Object.defineProperty(t,"BSONSymbol",{enumerable:!0,get:function(){return o.BSONSymbol}}),Object.defineProperty(t,"Code",{enumerable:!0,get:function(){return o.Code}}),Object.defineProperty(t,"DBRef",{enumerable:!0,get:function(){return o.DBRef}}),Object.defineProperty(t,"Decimal128",{enumerable:!0,get:function(){return o.Decimal128}}),Object.defineProperty(t,"Double",{enumerable:!0,get:function(){return o.Double}}),Object.defineProperty(t,"Int32",{enumerable:!0,get:function(){return o.Int32}}),Object.defineProperty(t,"Long",{enumerable:!0,get:function(){return o.Long}}),Object.defineProperty(t,"Map",{enumerable:!0,get:function(){return o.Map}}),Object.defineProperty(t,"MaxKey",{enumerable:!0,get:function(){return o.MaxKey}}),Object.defineProperty(t,"MinKey",{enumerable:!0,get:function(){return o.MinKey}}),Object.defineProperty(t,"ObjectId",{enumerable:!0,get:function(){return o.ObjectId}}),Object.defineProperty(t,"Timestamp",{enumerable:!0,get:function(){return o.Timestamp}}),t.pluckBSONSerializeOptions=function(e){const{fieldsAsRaw:t,promoteValues:n,promoteBuffers:r,promoteLongs:o,serializeFunctions:i,ignoreUndefined:s,bsonRegExp:u,raw:a,enableUtf8Validation:c}=e;return{fieldsAsRaw:t,promoteValues:n,promoteBuffers:r,promoteLongs:o,serializeFunctions:i,ignoreUndefined:s,bsonRegExp:u,raw:a,enableUtf8Validation:c}},t.resolveBSONOptions=function(e,t){var n,r,o,i,s,u,a,c,l,d,f,p,h,m,g,E,y,v;const A=null==t?void 0:t.bsonOptions;return{raw:null!==(r=null!==(n=null==e?void 0:e.raw)&&void 0!==n?n:null==A?void 0:A.raw)&&void 0!==r&&r,promoteLongs:null===(i=null!==(o=null==e?void 0:e.promoteLongs)&&void 0!==o?o:null==A?void 0:A.promoteLongs)||void 0===i||i,promoteValues:null===(u=null!==(s=null==e?void 0:e.promoteValues)&&void 0!==s?s:null==A?void 0:A.promoteValues)||void 0===u||u,promoteBuffers:null!==(c=null!==(a=null==e?void 0:e.promoteBuffers)&&void 0!==a?a:null==A?void 0:A.promoteBuffers)&&void 0!==c&&c,ignoreUndefined:null!==(d=null!==(l=null==e?void 0:e.ignoreUndefined)&&void 0!==l?l:null==A?void 0:A.ignoreUndefined)&&void 0!==d&&d,bsonRegExp:null!==(p=null!==(f=null==e?void 0:e.bsonRegExp)&&void 0!==f?f:null==A?void 0:A.bsonRegExp)&&void 0!==p&&p,serializeFunctions:null!==(m=null!==(h=null==e?void 0:e.serializeFunctions)&&void 0!==h?h:null==A?void 0:A.serializeFunctions)&&void 0!==m&&m,fieldsAsRaw:null!==(E=null!==(g=null==e?void 0:e.fieldsAsRaw)&&void 0!==g?g:null==A?void 0:A.fieldsAsRaw)&&void 0!==E?E:{},enableUtf8Validation:null===(v=null!==(y=null==e?void 0:e.enableUtf8Validation)&&void 0!==y?y:null==A?void 0:A.enableUtf8Validation)||void 0===v||v}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CommandOperation=void 0;const r=n(1),o=n(159),i=n(11),s=n(95),u=n(2),a=n(13),c=n(3);class l extends c.AbstractOperation{constructor(e,t){super(t),this.options=null!=t?t:{};const n=(null==t?void 0:t.dbName)||(null==t?void 0:t.authdb);if(this.ns=n?new u.MongoDBNamespace(n,"$cmd"):e?e.s.namespace.withCollection("$cmd"):new u.MongoDBNamespace("admin","$cmd"),this.readConcern=i.ReadConcern.fromOptions(t),this.writeConcern=a.WriteConcern.fromOptions(t),e&&e.logger&&(this.logger=e.logger),this.hasAspect(c.Aspect.EXPLAINABLE))this.explain=o.Explain.fromOptions(t);else if(null!=(null==t?void 0:t.explain))throw new r.MongoInvalidArgumentError('Option "explain" is not supported on this command')}get canRetryWrite(){return!this.hasAspect(c.Aspect.EXPLAINABLE)||null==this.explain}executeCommand(e,t,n,o){this.server=e;const i={...this.options,...this.bsonOptions,readPreference:this.readPreference,session:t},a=(0,u.maxWireVersion)(e),l=this.session&&this.session.inTransaction();this.readConcern&&(0,u.commandSupportsReadConcern)(n)&&!l&&Object.assign(n,{readConcern:this.readConcern}),this.trySecondaryWrite&&a<s.MIN_SECONDARY_WRITE_WIRE_VERSION&&(i.omitReadPreference=!0),i.collation&&a<5?o(new r.MongoCompatibilityError(`Server ${e.name}, which reports wire version ${a}, does not support collation`)):(this.writeConcern&&this.hasAspect(c.Aspect.WRITE_OPERATION)&&!l&&Object.assign(n,{writeConcern:this.writeConcern}),a>=5&&i.collation&&"object"==typeof i.collation&&!this.hasAspect(c.Aspect.SKIP_COLLATION)&&Object.assign(n,{collation:i.collation}),"number"==typeof i.maxTimeMS&&(n.maxTimeMS=i.maxTimeMS),this.hasAspect(c.Aspect.EXPLAINABLE)&&this.explain&&(a<6&&n.aggregate?n.explain=!0:n=(0,u.decorateWithExplain)(n,this.explain)),e.command(this.ns,n,i,o))}}t.CommandOperation=l},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ReadPreference=t.ReadPreferenceMode=void 0;const r=n(1);t.ReadPreferenceMode=Object.freeze({primary:"primary",primaryPreferred:"primaryPreferred",secondary:"secondary",secondaryPreferred:"secondaryPreferred",nearest:"nearest"});class o{constructor(e,t,n){if(!o.isValid(e))throw new r.MongoInvalidArgumentError(`Invalid read preference mode ${JSON.stringify(e)}`);if(null!=n||"object"!=typeof t||Array.isArray(t)){if(t&&!Array.isArray(t))throw new r.MongoInvalidArgumentError("ReadPreference tags must be an array")}else n=t,t=void 0;if(this.mode=e,this.tags=t,this.hedge=null==n?void 0:n.hedge,this.maxStalenessSeconds=void 0,this.minWireVersion=void 0,null!=(n=null!=n?n:{}).maxStalenessSeconds){if(n.maxStalenessSeconds<=0)throw new r.MongoInvalidArgumentError("maxStalenessSeconds must be a positive integer");this.maxStalenessSeconds=n.maxStalenessSeconds,this.minWireVersion=5}if(this.mode===o.PRIMARY){if(this.tags&&Array.isArray(this.tags)&&this.tags.length>0)throw new r.MongoInvalidArgumentError("Primary read preference cannot be combined with tags");if(this.maxStalenessSeconds)throw new r.MongoInvalidArgumentError("Primary read preference cannot be combined with maxStalenessSeconds");if(this.hedge)throw new r.MongoInvalidArgumentError("Primary read preference cannot be combined with hedge")}}get preference(){return this.mode}static fromString(e){return new o(e)}static fromOptions(e){var t,n,r;if(!e)return;const i=null!==(t=e.readPreference)&&void 0!==t?t:null===(n=e.session)||void 0===n?void 0:n.transaction.options.readPreference,s=e.readPreferenceTags;if(null!=i){if("string"==typeof i)return new o(i,s,{maxStalenessSeconds:e.maxStalenessSeconds,hedge:e.hedge});if(!(i instanceof o)&&"object"==typeof i){const t=i.mode||i.preference;if(t&&"string"==typeof t)return new o(t,null!==(r=i.tags)&&void 0!==r?r:s,{maxStalenessSeconds:i.maxStalenessSeconds,hedge:e.hedge})}return s&&(i.tags=s),i}}static translate(e){if(null==e.readPreference)return e;const t=e.readPreference;if("string"==typeof t)e.readPreference=new o(t);else if(!t||t instanceof o||"object"!=typeof t){if(!(t instanceof o))throw new r.MongoInvalidArgumentError(`Invalid read preference: ${t}`)}else{const n=t.mode||t.preference;n&&"string"==typeof n&&(e.readPreference=new o(n,t.tags,{maxStalenessSeconds:t.maxStalenessSeconds}))}return e}static isValid(e){return new Set([o.PRIMARY,o.PRIMARY_PREFERRED,o.SECONDARY,o.SECONDARY_PREFERRED,o.NEAREST,null]).has(e)}isValid(e){return o.isValid("string"==typeof e?e:this.mode)}slaveOk(){return this.secondaryOk()}secondaryOk(){return new Set([o.PRIMARY_PREFERRED,o.SECONDARY,o.SECONDARY_PREFERRED,o.NEAREST]).has(this.mode)}equals(e){return e.mode===this.mode}toJSON(){const e={mode:this.mode};return Array.isArray(this.tags)&&(e.tags=this.tags),this.maxStalenessSeconds&&(e.maxStalenessSeconds=this.maxStalenessSeconds),this.hedge&&(e.hedge=this.hedge),e}}t.ReadPreference=o,o.PRIMARY=t.ReadPreferenceMode.primary,o.PRIMARY_PREFERRED=t.ReadPreferenceMode.primaryPreferred,o.SECONDARY=t.ReadPreferenceMode.secondary,o.SECONDARY_PREFERRED=t.ReadPreferenceMode.secondaryPreferred,o.NEAREST=t.ReadPreferenceMode.nearest,o.primary=new o(t.ReadPreferenceMode.primary),o.primaryPreferred=new o(t.ReadPreferenceMode.primaryPreferred),o.secondary=new o(t.ReadPreferenceMode.secondary),o.secondaryPreferred=new o(t.ReadPreferenceMode.secondaryPreferred),o.nearest=new o(t.ReadPreferenceMode.nearest)},function(e,t){var n=Array.isArray;e.exports=n},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.APM_EVENTS=t.TOPOLOGY_EVENTS=t.CMAP_EVENTS=t.HEARTBEAT_EVENTS=t.RESUME_TOKEN_CHANGED=t.END=t.CHANGE=t.INIT=t.MORE=t.RESPONSE=t.SERVER_HEARTBEAT_FAILED=t.SERVER_HEARTBEAT_SUCCEEDED=t.SERVER_HEARTBEAT_STARTED=t.COMMAND_FAILED=t.COMMAND_SUCCEEDED=t.COMMAND_STARTED=t.CLUSTER_TIME_RECEIVED=t.CONNECTION_CHECKED_IN=t.CONNECTION_CHECKED_OUT=t.CONNECTION_CHECK_OUT_FAILED=t.CONNECTION_CHECK_OUT_STARTED=t.CONNECTION_CLOSED=t.CONNECTION_READY=t.CONNECTION_CREATED=t.CONNECTION_POOL_CLEARED=t.CONNECTION_POOL_CLOSED=t.CONNECTION_POOL_CREATED=t.TOPOLOGY_DESCRIPTION_CHANGED=t.TOPOLOGY_CLOSED=t.TOPOLOGY_OPENING=t.SERVER_DESCRIPTION_CHANGED=t.SERVER_CLOSED=t.SERVER_OPENING=t.DESCRIPTION_RECEIVED=t.UNPINNED=t.PINNED=t.MESSAGE=t.ENDED=t.CLOSED=t.CONNECT=t.OPEN=t.CLOSE=t.TIMEOUT=t.ERROR=t.SYSTEM_JS_COLLECTION=t.SYSTEM_COMMAND_COLLECTION=t.SYSTEM_USER_COLLECTION=t.SYSTEM_PROFILE_COLLECTION=t.SYSTEM_INDEX_COLLECTION=t.SYSTEM_NAMESPACE_COLLECTION=void 0,t.LEGACY_HELLO_COMMAND_CAMEL_CASE=t.LEGACY_HELLO_COMMAND=t.MONGO_CLIENT_EVENTS=t.LOCAL_SERVER_EVENTS=t.SERVER_RELAY_EVENTS=void 0,t.SYSTEM_NAMESPACE_COLLECTION="system.namespaces",t.SYSTEM_INDEX_COLLECTION="system.indexes",t.SYSTEM_PROFILE_COLLECTION="system.profile",t.SYSTEM_USER_COLLECTION="system.users",t.SYSTEM_COMMAND_COLLECTION="$cmd",t.SYSTEM_JS_COLLECTION="system.js",t.ERROR="error",t.TIMEOUT="timeout",t.CLOSE="close",t.OPEN="open",t.CONNECT="connect",t.CLOSED="closed",t.ENDED="ended",t.MESSAGE="message",t.PINNED="pinned",t.UNPINNED="unpinned",t.DESCRIPTION_RECEIVED="descriptionReceived",t.SERVER_OPENING="serverOpening",t.SERVER_CLOSED="serverClosed",t.SERVER_DESCRIPTION_CHANGED="serverDescriptionChanged",t.TOPOLOGY_OPENING="topologyOpening",t.TOPOLOGY_CLOSED="topologyClosed",t.TOPOLOGY_DESCRIPTION_CHANGED="topologyDescriptionChanged",t.CONNECTION_POOL_CREATED="connectionPoolCreated",t.CONNECTION_POOL_CLOSED="connectionPoolClosed",t.CONNECTION_POOL_CLEARED="connectionPoolCleared",t.CONNECTION_CREATED="connectionCreated",t.CONNECTION_READY="connectionReady",t.CONNECTION_CLOSED="connectionClosed",t.CONNECTION_CHECK_OUT_STARTED="connectionCheckOutStarted",t.CONNECTION_CHECK_OUT_FAILED="connectionCheckOutFailed",t.CONNECTION_CHECKED_OUT="connectionCheckedOut",t.CONNECTION_CHECKED_IN="connectionCheckedIn",t.CLUSTER_TIME_RECEIVED="clusterTimeReceived",t.COMMAND_STARTED="commandStarted",t.COMMAND_SUCCEEDED="commandSucceeded",t.COMMAND_FAILED="commandFailed",t.SERVER_HEARTBEAT_STARTED="serverHeartbeatStarted",t.SERVER_HEARTBEAT_SUCCEEDED="serverHeartbeatSucceeded",t.SERVER_HEARTBEAT_FAILED="serverHeartbeatFailed",t.RESPONSE="response",t.MORE="more",t.INIT="init",t.CHANGE="change",t.END="end",t.RESUME_TOKEN_CHANGED="resumeTokenChanged",t.HEARTBEAT_EVENTS=Object.freeze([t.SERVER_HEARTBEAT_STARTED,t.SERVER_HEARTBEAT_SUCCEEDED,t.SERVER_HEARTBEAT_FAILED]),t.CMAP_EVENTS=Object.freeze([t.CONNECTION_POOL_CREATED,t.CONNECTION_POOL_CLOSED,t.CONNECTION_CREATED,t.CONNECTION_READY,t.CONNECTION_CLOSED,t.CONNECTION_CHECK_OUT_STARTED,t.CONNECTION_CHECK_OUT_FAILED,t.CONNECTION_CHECKED_OUT,t.CONNECTION_CHECKED_IN,t.CONNECTION_POOL_CLEARED]),t.TOPOLOGY_EVENTS=Object.freeze([t.SERVER_OPENING,t.SERVER_CLOSED,t.SERVER_DESCRIPTION_CHANGED,t.TOPOLOGY_OPENING,t.TOPOLOGY_CLOSED,t.TOPOLOGY_DESCRIPTION_CHANGED,t.ERROR,t.TIMEOUT,t.CLOSE]),t.APM_EVENTS=Object.freeze([t.COMMAND_STARTED,t.COMMAND_SUCCEEDED,t.COMMAND_FAILED]),t.SERVER_RELAY_EVENTS=Object.freeze([t.SERVER_HEARTBEAT_STARTED,t.SERVER_HEARTBEAT_SUCCEEDED,t.SERVER_HEARTBEAT_FAILED,t.COMMAND_STARTED,t.COMMAND_SUCCEEDED,t.COMMAND_FAILED,...t.CMAP_EVENTS]),t.LOCAL_SERVER_EVENTS=Object.freeze([t.CONNECT,t.DESCRIPTION_RECEIVED,t.CLOSED,t.ENDED]),t.MONGO_CLIENT_EVENTS=Object.freeze([...t.CMAP_EVENTS,...t.APM_EVENTS,...t.TOPOLOGY_EVENTS,...t.HEARTBEAT_EVENTS]),t.LEGACY_HELLO_COMMAND="ismaster",t.LEGACY_HELLO_COMMAND_CAMEL_CASE="isMaster"},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CancellationToken=t.TypedEventEmitter=t.BSONType=void 0;const r=n(98);t.BSONType=Object.freeze({double:1,string:2,object:3,array:4,binData:5,undefined:6,objectId:7,bool:8,date:9,null:10,regex:11,dbPointer:12,javascript:13,symbol:14,javascriptWithScope:15,int:16,timestamp:17,long:18,decimal:19,minKey:-1,maxKey:127});class o extends r.EventEmitter{}t.TypedEventEmitter=o;t.CancellationToken=class extends o{}},function(e,t){e.exports=function(e){return null!=e&&"object"==typeof e}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ReadConcern=t.ReadConcernLevel=void 0,t.ReadConcernLevel=Object.freeze({local:"local",majority:"majority",linearizable:"linearizable",available:"available",snapshot:"snapshot"});class r{constructor(e){var n;this.level=null!==(n=t.ReadConcernLevel[e])&&void 0!==n?n:e}static fromOptions(e){if(null!=e){if(e.readConcern){const{readConcern:t}=e;if(t instanceof r)return t;if("string"==typeof t)return new r(t);if("level"in t&&t.level)return new r(t.level)}return e.level?new r(e.level):void 0}}static get MAJORITY(){return t.ReadConcernLevel.majority}static get AVAILABLE(){return t.ReadConcernLevel.available}static get LINEARIZABLE(){return t.ReadConcernLevel.linearizable}static get SNAPSHOT(){return t.ReadConcernLevel.snapshot}toJSON(){return{level:this.level}}}t.ReadConcern=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t._advanceClusterTime=t.drainTimerQueue=t.ServerType=t.TopologyType=t.STATE_CONNECTED=t.STATE_CONNECTING=t.STATE_CLOSED=t.STATE_CLOSING=void 0,t.STATE_CLOSING="closing",t.STATE_CLOSED="closed",t.STATE_CONNECTING="connecting",t.STATE_CONNECTED="connected",t.TopologyType=Object.freeze({Single:"Single",ReplicaSetNoPrimary:"ReplicaSetNoPrimary",ReplicaSetWithPrimary:"ReplicaSetWithPrimary",Sharded:"Sharded",Unknown:"Unknown",LoadBalanced:"LoadBalanced"}),t.ServerType=Object.freeze({Standalone:"Standalone",Mongos:"Mongos",PossiblePrimary:"PossiblePrimary",RSPrimary:"RSPrimary",RSSecondary:"RSSecondary",RSArbiter:"RSArbiter",RSOther:"RSOther",RSGhost:"RSGhost",Unknown:"Unknown",LoadBalancer:"LoadBalancer"}),t.drainTimerQueue=function(e){e.forEach(clearTimeout),e.clear()},t._advanceClusterTime=function(e,t){null==e.clusterTime?e.clusterTime=t:t.clusterTime.greaterThan(e.clusterTime.clusterTime)&&(e.clusterTime=t)}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.WriteConcern=t.WRITE_CONCERN_KEYS=void 0,t.WRITE_CONCERN_KEYS=["w","wtimeout","j","journal","fsync"];class r{constructor(e,t,n,r){null!=e&&(Number.isNaN(Number(e))?this.w=e:this.w=Number(e)),null!=t&&(this.wtimeout=t),null!=n&&(this.j=n),null!=r&&(this.fsync=r)}static fromOptions(e,t){if(null==e)return;let n;t=null!=t?t:{},n="string"==typeof e||"number"==typeof e?{w:e}:e instanceof r?e:e.writeConcern;const o=t instanceof r?t:t.writeConcern,{w:i,wtimeout:s,j:u,fsync:a,journal:c,wtimeoutMS:l}={...o,...n};return null!=i||null!=s||null!=l||null!=u||null!=c||null!=a?new r(i,null!=s?s:l,null!=u?u:c,a):void 0}}t.WriteConcern=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.executeOperation=void 0;const r=n(1),o=n(6),i=n(95),s=n(2),u=n(3),a=r.MONGODB_ERROR_CODES.IllegalOperation,c="This MongoDB deployment does not support retryable writes. Please add retryWrites=false to your connection string.";t.executeOperation=function e(t,n,l){if(!(n instanceof u.AbstractOperation))throw new r.MongoRuntimeError("This method requires a valid operation instance");return(0,s.maybePromise)(l,l=>{const d=t.topology;if(null==d)return t.s.hasBeenClosed?l(new r.MongoNotConnectedError("Client must be connected before running operations")):(t.s.options[Symbol.for("@@mdb.skipPingOnConnect")]=!0,t.connect(r=>(delete t.s.options[Symbol.for("@@mdb.skipPingOnConnect")],r?l(r):e(t,n,l))));if(d.shouldCheckForSessionSupport())return d.selectServer(o.ReadPreference.primaryPreferred,{},r=>{if(r)return l(r);e(t,n,l)});let f,p=n.session;if(d.hasSessionSupport())if(null==p)f=Symbol(),p=d.startSession({owner:f,explicit:!1});else{if(p.hasEnded)return l(new r.MongoExpiredSessionError("Use of expired sessions is not permitted"));if(p.snapshotEnabled&&!d.capabilities.supportsSnapshotReads)return l(new r.MongoCompatibilityError("Snapshot reads require MongoDB 5.0 or later"))}else if(p)return l(new r.MongoCompatibilityError("Current topology does not support sessions"));try{!function(e,t,n,l){var d,f;const p=null!==(d=n.readPreference)&&void 0!==d?d:o.ReadPreference.primary,h=!!(null==t?void 0:t.inTransaction());if(h&&!p.equals(o.ReadPreference.primary))return l(new r.MongoTransactionError(`Read preference in a transaction must be primary, not: ${p.mode}`));(null==t?void 0:t.isPinned)&&t.transaction.isCommitted&&!n.bypassPinningCheck&&t.unpin();let m;m=n.hasAspect(u.Aspect.CURSOR_ITERATING)?(0,i.sameServerSelector)(null===(f=n.server)||void 0===f?void 0:f.description):n.trySecondaryWrite?(0,i.secondaryWritableServerSelector)(e.commonWireVersion,p):p;const g={session:t};if(p&&!p.equals(o.ReadPreference.primary)&&(null==t?void 0:t.inTransaction()))return void l(new r.MongoTransactionError(`Read preference in a transaction must be primary, not: ${p.mode}`));e.selectServer(m,g,(o,i)=>{if(o||!i)return l(o);if(t&&n.hasAspect(u.Aspect.RETRYABLE)){const o=e.s.options.retryReads&&!h&&n.canRetryRead,d=e.s.options.retryWrites&&!h&&(0,s.supportsRetryableWrites)(i)&&n.canRetryWrite,f=n.hasAspect(u.Aspect.READ_OPERATION),p=n.hasAspect(u.Aspect.WRITE_OPERATION);if(f&&o||p&&d)return p&&d&&(n.options.willRetryWrite=!0,t.incrementTransactionNumber()),n.execute(i,t,(o,i)=>o instanceof r.MongoError?function(o){const i=n.hasAspect(u.Aspect.WRITE_OPERATION),d=n.hasAspect(u.Aspect.READ_OPERATION);return i&&o.code===a?l(new r.MongoServerError({message:c,errmsg:c,originalError:o})):i&&!(0,r.isRetryableWriteError)(o)?l(o):d&&!(0,r.isRetryableReadError)(o)?l(o):(o instanceof r.MongoNetworkError&&(null==t?void 0:t.isPinned)&&!t.inTransaction()&&n.hasAspect(u.Aspect.CURSOR_CREATING)&&t.unpin({force:!0,forceClear:!0}),void e.selectServer(m,g,(e,o)=>e||!i||(0,s.supportsRetryableWrites)(o)?e||!o?l(null!=e?e:new r.MongoUnexpectedServerResponseError("Server selection failed without error")):void n.execute(o,t,l):l(new r.MongoUnexpectedServerResponseError("Selected server does not support retryable writes"))))}(o):o?l(o):void l(void 0,i))}return n.execute(i,t,l)})}(d,p,n,(e,t)=>{if(null!=(null==p?void 0:p.owner)&&p.owner===f)return p.endSession(n=>l(null!=n?n:e,t));l(e,t)})}catch(e){throw null!=(null==p?void 0:p.owner)&&p.owner===f&&p.endSession(),e}})}},function(e,t,n){var r=n(119),o="object"==typeof self&&self&&self.Object===Object&&self,i=r||o||Function("return this")();e.exports=i},function(e,t,n){(function(e){var r;
|
|
2
2
|
/**
|
|
3
3
|
* @license
|
|
4
4
|
* Lodash <https://lodash.com/>
|
|
@@ -6,4 +6,4 @@ module.exports=function(e){var t={};function n(r){if(t[r])return t[r].exports;va
|
|
|
6
6
|
* Released under MIT license <https://lodash.com/license>
|
|
7
7
|
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
|
|
8
8
|
* Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
|
|
9
|
-
*/(function(){var o="Expected a function",i="__lodash_placeholder__",s=[["ary",128],["bind",1],["bindKey",2],["curry",8],["curryRight",16],["flip",512],["partial",32],["partialRight",64],["rearg",256]],a="[object Arguments]",c="[object Array]",u="[object Boolean]",l="[object Date]",f="[object Error]",p="[object Function]",d="[object GeneratorFunction]",h="[object Map]",m="[object Number]",g="[object Object]",y="[object RegExp]",b="[object Set]",v="[object String]",S="[object Symbol]",w="[object WeakMap]",_="[object ArrayBuffer]",O="[object DataView]",T="[object Float32Array]",C="[object Float64Array]",x="[object Int8Array]",E="[object Int16Array]",N="[object Int32Array]",I="[object Uint8Array]",A="[object Uint16Array]",k="[object Uint32Array]",M=/\b__p \+= '';/g,R=/\b(__p \+=) '' \+/g,j=/(__e\(.*?\)|\b__t\)) \+\n'';/g,D=/&(?:amp|lt|gt|quot|#39);/g,P=/[&<>"']/g,B=RegExp(D.source),L=RegExp(P.source),q=/<%-([\s\S]+?)%>/g,U=/<%([\s\S]+?)%>/g,z=/<%=([\s\S]+?)%>/g,$=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,W=/^\w*$/,F=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,V=/[\\^$.*+?()[\]{}|]/g,K=RegExp(V.source),H=/^\s+/,Y=/\s/,G=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,J=/\{\n\/\* \[wrapped with (.+)\] \*/,X=/,? & /,Z=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,Q=/[()=,{}\[\]\/\s]/,ee=/\\(\\)?/g,te=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,ne=/\w*$/,re=/^[-+]0x[0-9a-f]+$/i,oe=/^0b[01]+$/i,ie=/^\[object .+?Constructor\]$/,se=/^0o[0-7]+$/i,ae=/^(?:0|[1-9]\d*)$/,ce=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,ue=/($^)/,le=/['\n\r\u2028\u2029\\]/g,fe="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",pe="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",de="[\\ud800-\\udfff]",he="["+pe+"]",me="["+fe+"]",ge="\\d+",ye="[\\u2700-\\u27bf]",be="[a-z\\xdf-\\xf6\\xf8-\\xff]",ve="[^\\ud800-\\udfff"+pe+ge+"\\u2700-\\u27bfa-z\\xdf-\\xf6\\xf8-\\xffA-Z\\xc0-\\xd6\\xd8-\\xde]",Se="\\ud83c[\\udffb-\\udfff]",we="[^\\ud800-\\udfff]",_e="(?:\\ud83c[\\udde6-\\uddff]){2}",Oe="[\\ud800-\\udbff][\\udc00-\\udfff]",Te="[A-Z\\xc0-\\xd6\\xd8-\\xde]",Ce="(?:"+be+"|"+ve+")",xe="(?:"+Te+"|"+ve+")",Ee="(?:"+me+"|"+Se+")"+"?",Ne="[\\ufe0e\\ufe0f]?"+Ee+("(?:\\u200d(?:"+[we,_e,Oe].join("|")+")[\\ufe0e\\ufe0f]?"+Ee+")*"),Ie="(?:"+[ye,_e,Oe].join("|")+")"+Ne,Ae="(?:"+[we+me+"?",me,_e,Oe,de].join("|")+")",ke=RegExp("['’]","g"),Me=RegExp(me,"g"),Re=RegExp(Se+"(?="+Se+")|"+Ae+Ne,"g"),je=RegExp([Te+"?"+be+"+(?:['’](?:d|ll|m|re|s|t|ve))?(?="+[he,Te,"$"].join("|")+")",xe+"+(?:['’](?:D|LL|M|RE|S|T|VE))?(?="+[he,Te+Ce,"$"].join("|")+")",Te+"?"+Ce+"+(?:['’](?:d|ll|m|re|s|t|ve))?",Te+"+(?:['’](?:D|LL|M|RE|S|T|VE))?","\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",ge,Ie].join("|"),"g"),De=RegExp("[\\u200d\\ud800-\\udfff"+fe+"\\ufe0e\\ufe0f]"),Pe=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,Be=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],Le=-1,qe={};qe[T]=qe[C]=qe[x]=qe[E]=qe[N]=qe[I]=qe["[object Uint8ClampedArray]"]=qe[A]=qe[k]=!0,qe[a]=qe[c]=qe[_]=qe[u]=qe[O]=qe[l]=qe[f]=qe[p]=qe[h]=qe[m]=qe[g]=qe[y]=qe[b]=qe[v]=qe[w]=!1;var Ue={};Ue[a]=Ue[c]=Ue[_]=Ue[O]=Ue[u]=Ue[l]=Ue[T]=Ue[C]=Ue[x]=Ue[E]=Ue[N]=Ue[h]=Ue[m]=Ue[g]=Ue[y]=Ue[b]=Ue[v]=Ue[S]=Ue[I]=Ue["[object Uint8ClampedArray]"]=Ue[A]=Ue[k]=!0,Ue[f]=Ue[p]=Ue[w]=!1;var ze={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},$e=parseFloat,We=parseInt,Fe="object"==typeof global&&global&&global.Object===Object&&global,Ve="object"==typeof self&&self&&self.Object===Object&&self,Ke=Fe||Ve||Function("return this")(),He=t&&!t.nodeType&&t,Ye=He&&"object"==typeof e&&e&&!e.nodeType&&e,Ge=Ye&&Ye.exports===He,Je=Ge&&Fe.process,Xe=function(){try{var e=Ye&&Ye.require&&Ye.require("util").types;return e||Je&&Je.binding&&Je.binding("util")}catch(e){}}(),Ze=Xe&&Xe.isArrayBuffer,Qe=Xe&&Xe.isDate,et=Xe&&Xe.isMap,tt=Xe&&Xe.isRegExp,nt=Xe&&Xe.isSet,rt=Xe&&Xe.isTypedArray;function ot(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}function it(e,t,n,r){for(var o=-1,i=null==e?0:e.length;++o<i;){var s=e[o];t(r,s,n(s),e)}return r}function st(e,t){for(var n=-1,r=null==e?0:e.length;++n<r&&!1!==t(e[n],n,e););return e}function at(e,t){for(var n=null==e?0:e.length;n--&&!1!==t(e[n],n,e););return e}function ct(e,t){for(var n=-1,r=null==e?0:e.length;++n<r;)if(!t(e[n],n,e))return!1;return!0}function ut(e,t){for(var n=-1,r=null==e?0:e.length,o=0,i=[];++n<r;){var s=e[n];t(s,n,e)&&(i[o++]=s)}return i}function lt(e,t){return!!(null==e?0:e.length)&&St(e,t,0)>-1}function ft(e,t,n){for(var r=-1,o=null==e?0:e.length;++r<o;)if(n(t,e[r]))return!0;return!1}function pt(e,t){for(var n=-1,r=null==e?0:e.length,o=Array(r);++n<r;)o[n]=t(e[n],n,e);return o}function dt(e,t){for(var n=-1,r=t.length,o=e.length;++n<r;)e[o+n]=t[n];return e}function ht(e,t,n,r){var o=-1,i=null==e?0:e.length;for(r&&i&&(n=e[++o]);++o<i;)n=t(n,e[o],o,e);return n}function mt(e,t,n,r){var o=null==e?0:e.length;for(r&&o&&(n=e[--o]);o--;)n=t(n,e[o],o,e);return n}function gt(e,t){for(var n=-1,r=null==e?0:e.length;++n<r;)if(t(e[n],n,e))return!0;return!1}var yt=Tt("length");function bt(e,t,n){var r;return n(e,(function(e,n,o){if(t(e,n,o))return r=n,!1})),r}function vt(e,t,n,r){for(var o=e.length,i=n+(r?1:-1);r?i--:++i<o;)if(t(e[i],i,e))return i;return-1}function St(e,t,n){return t==t?function(e,t,n){var r=n-1,o=e.length;for(;++r<o;)if(e[r]===t)return r;return-1}(e,t,n):vt(e,_t,n)}function wt(e,t,n,r){for(var o=n-1,i=e.length;++o<i;)if(r(e[o],t))return o;return-1}function _t(e){return e!=e}function Ot(e,t){var n=null==e?0:e.length;return n?Et(e,t)/n:NaN}function Tt(e){return function(t){return null==t?void 0:t[e]}}function Ct(e){return function(t){return null==e?void 0:e[t]}}function xt(e,t,n,r,o){return o(e,(function(e,o,i){n=r?(r=!1,e):t(n,e,o,i)})),n}function Et(e,t){for(var n,r=-1,o=e.length;++r<o;){var i=t(e[r]);void 0!==i&&(n=void 0===n?i:n+i)}return n}function Nt(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r}function It(e){return e?e.slice(0,Ht(e)+1).replace(H,""):e}function At(e){return function(t){return e(t)}}function kt(e,t){return pt(t,(function(t){return e[t]}))}function Mt(e,t){return e.has(t)}function Rt(e,t){for(var n=-1,r=e.length;++n<r&&St(t,e[n],0)>-1;);return n}function jt(e,t){for(var n=e.length;n--&&St(t,e[n],0)>-1;);return n}function Dt(e,t){for(var n=e.length,r=0;n--;)e[n]===t&&++r;return r}var Pt=Ct({"À":"A","Á":"A","Â":"A","Ã":"A","Ä":"A","Å":"A","à":"a","á":"a","â":"a","ã":"a","ä":"a","å":"a","Ç":"C","ç":"c","Ð":"D","ð":"d","È":"E","É":"E","Ê":"E","Ë":"E","è":"e","é":"e","ê":"e","ë":"e","Ì":"I","Í":"I","Î":"I","Ï":"I","ì":"i","í":"i","î":"i","ï":"i","Ñ":"N","ñ":"n","Ò":"O","Ó":"O","Ô":"O","Õ":"O","Ö":"O","Ø":"O","ò":"o","ó":"o","ô":"o","õ":"o","ö":"o","ø":"o","Ù":"U","Ú":"U","Û":"U","Ü":"U","ù":"u","ú":"u","û":"u","ü":"u","Ý":"Y","ý":"y","ÿ":"y","Æ":"Ae","æ":"ae","Þ":"Th","þ":"th","ß":"ss","Ā":"A","Ă":"A","Ą":"A","ā":"a","ă":"a","ą":"a","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","ć":"c","ĉ":"c","ċ":"c","č":"c","Ď":"D","Đ":"D","ď":"d","đ":"d","Ē":"E","Ĕ":"E","Ė":"E","Ę":"E","Ě":"E","ē":"e","ĕ":"e","ė":"e","ę":"e","ě":"e","Ĝ":"G","Ğ":"G","Ġ":"G","Ģ":"G","ĝ":"g","ğ":"g","ġ":"g","ģ":"g","Ĥ":"H","Ħ":"H","ĥ":"h","ħ":"h","Ĩ":"I","Ī":"I","Ĭ":"I","Į":"I","İ":"I","ĩ":"i","ī":"i","ĭ":"i","į":"i","ı":"i","Ĵ":"J","ĵ":"j","Ķ":"K","ķ":"k","ĸ":"k","Ĺ":"L","Ļ":"L","Ľ":"L","Ŀ":"L","Ł":"L","ĺ":"l","ļ":"l","ľ":"l","ŀ":"l","ł":"l","Ń":"N","Ņ":"N","Ň":"N","Ŋ":"N","ń":"n","ņ":"n","ň":"n","ŋ":"n","Ō":"O","Ŏ":"O","Ő":"O","ō":"o","ŏ":"o","ő":"o","Ŕ":"R","Ŗ":"R","Ř":"R","ŕ":"r","ŗ":"r","ř":"r","Ś":"S","Ŝ":"S","Ş":"S","Š":"S","ś":"s","ŝ":"s","ş":"s","š":"s","Ţ":"T","Ť":"T","Ŧ":"T","ţ":"t","ť":"t","ŧ":"t","Ũ":"U","Ū":"U","Ŭ":"U","Ů":"U","Ű":"U","Ų":"U","ũ":"u","ū":"u","ŭ":"u","ů":"u","ű":"u","ų":"u","Ŵ":"W","ŵ":"w","Ŷ":"Y","ŷ":"y","Ÿ":"Y","Ź":"Z","Ż":"Z","Ž":"Z","ź":"z","ż":"z","ž":"z","IJ":"IJ","ij":"ij","Œ":"Oe","œ":"oe","ʼn":"'n","ſ":"s"}),Bt=Ct({"&":"&","<":"<",">":">",'"':""","'":"'"});function Lt(e){return"\\"+ze[e]}function qt(e){return De.test(e)}function Ut(e){var t=-1,n=Array(e.size);return e.forEach((function(e,r){n[++t]=[r,e]})),n}function zt(e,t){return function(n){return e(t(n))}}function $t(e,t){for(var n=-1,r=e.length,o=0,s=[];++n<r;){var a=e[n];a!==t&&a!==i||(e[n]=i,s[o++]=n)}return s}function Wt(e){var t=-1,n=Array(e.size);return e.forEach((function(e){n[++t]=e})),n}function Ft(e){var t=-1,n=Array(e.size);return e.forEach((function(e){n[++t]=[e,e]})),n}function Vt(e){return qt(e)?function(e){var t=Re.lastIndex=0;for(;Re.test(e);)++t;return t}(e):yt(e)}function Kt(e){return qt(e)?function(e){return e.match(Re)||[]}(e):function(e){return e.split("")}(e)}function Ht(e){for(var t=e.length;t--&&Y.test(e.charAt(t)););return t}var Yt=Ct({"&":"&","<":"<",">":">",""":'"',"'":"'"});var Gt=function e(t){var n,r=(t=null==t?Ke:Gt.defaults(Ke.Object(),t,Gt.pick(Ke,Be))).Array,Y=t.Date,fe=t.Error,pe=t.Function,de=t.Math,he=t.Object,me=t.RegExp,ge=t.String,ye=t.TypeError,be=r.prototype,ve=pe.prototype,Se=he.prototype,we=t["__core-js_shared__"],_e=ve.toString,Oe=Se.hasOwnProperty,Te=0,Ce=(n=/[^.]+$/.exec(we&&we.keys&&we.keys.IE_PROTO||""))?"Symbol(src)_1."+n:"",xe=Se.toString,Ee=_e.call(he),Ne=Ke._,Ie=me("^"+_e.call(Oe).replace(V,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Ae=Ge?t.Buffer:void 0,Re=t.Symbol,De=t.Uint8Array,ze=Ae?Ae.allocUnsafe:void 0,Fe=zt(he.getPrototypeOf,he),Ve=he.create,He=Se.propertyIsEnumerable,Ye=be.splice,Je=Re?Re.isConcatSpreadable:void 0,Xe=Re?Re.iterator:void 0,yt=Re?Re.toStringTag:void 0,Ct=function(){try{var e=ti(he,"defineProperty");return e({},"",{}),e}catch(e){}}(),Jt=t.clearTimeout!==Ke.clearTimeout&&t.clearTimeout,Xt=Y&&Y.now!==Ke.Date.now&&Y.now,Zt=t.setTimeout!==Ke.setTimeout&&t.setTimeout,Qt=de.ceil,en=de.floor,tn=he.getOwnPropertySymbols,nn=Ae?Ae.isBuffer:void 0,rn=t.isFinite,on=be.join,sn=zt(he.keys,he),an=de.max,cn=de.min,un=Y.now,ln=t.parseInt,fn=de.random,pn=be.reverse,dn=ti(t,"DataView"),hn=ti(t,"Map"),mn=ti(t,"Promise"),gn=ti(t,"Set"),yn=ti(t,"WeakMap"),bn=ti(he,"create"),vn=yn&&new yn,Sn={},wn=Ni(dn),_n=Ni(hn),On=Ni(mn),Tn=Ni(gn),Cn=Ni(yn),xn=Re?Re.prototype:void 0,En=xn?xn.valueOf:void 0,Nn=xn?xn.toString:void 0;function In(e){if(Vs(e)&&!js(e)&&!(e instanceof Rn)){if(e instanceof Mn)return e;if(Oe.call(e,"__wrapped__"))return Ii(e)}return new Mn(e)}var An=function(){function e(){}return function(t){if(!Fs(t))return{};if(Ve)return Ve(t);e.prototype=t;var n=new e;return e.prototype=void 0,n}}();function kn(){}function Mn(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=void 0}function Rn(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=4294967295,this.__views__=[]}function jn(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function Dn(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function Pn(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function Bn(e){var t=-1,n=null==e?0:e.length;for(this.__data__=new Pn;++t<n;)this.add(e[t])}function Ln(e){var t=this.__data__=new Dn(e);this.size=t.size}function qn(e,t){var n=js(e),r=!n&&Rs(e),o=!n&&!r&&Ls(e),i=!n&&!r&&!o&&Qs(e),s=n||r||o||i,a=s?Nt(e.length,ge):[],c=a.length;for(var u in e)!t&&!Oe.call(e,u)||s&&("length"==u||o&&("offset"==u||"parent"==u)||i&&("buffer"==u||"byteLength"==u||"byteOffset"==u)||ci(u,c))||a.push(u);return a}function Un(e){var t=e.length;return t?e[Br(0,t-1)]:void 0}function zn(e,t){return Ci(vo(e),Jn(t,0,e.length))}function $n(e){return Ci(vo(e))}function Wn(e,t,n){(void 0===n||As(e[t],n))&&(void 0!==n||t in e)||Yn(e,t,n)}function Fn(e,t,n){var r=e[t];Oe.call(e,t)&&As(r,n)&&(void 0!==n||t in e)||Yn(e,t,n)}function Vn(e,t){for(var n=e.length;n--;)if(As(e[n][0],t))return n;return-1}function Kn(e,t,n,r){return tr(e,(function(e,o,i){t(r,e,n(e),i)})),r}function Hn(e,t){return e&&So(t,wa(t),e)}function Yn(e,t,n){"__proto__"==t&&Ct?Ct(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}function Gn(e,t){for(var n=-1,o=t.length,i=r(o),s=null==e;++n<o;)i[n]=s?void 0:ga(e,t[n]);return i}function Jn(e,t,n){return e==e&&(void 0!==n&&(e=e<=n?e:n),void 0!==t&&(e=e>=t?e:t)),e}function Xn(e,t,n,r,o,i){var s,c=1&t,f=2&t,w=4&t;if(n&&(s=o?n(e,r,o,i):n(e)),void 0!==s)return s;if(!Fs(e))return e;var M=js(e);if(M){if(s=function(e){var t=e.length,n=new e.constructor(t);t&&"string"==typeof e[0]&&Oe.call(e,"index")&&(n.index=e.index,n.input=e.input);return n}(e),!c)return vo(e,s)}else{var R=oi(e),j=R==p||R==d;if(Ls(e))return po(e,c);if(R==g||R==a||j&&!o){if(s=f||j?{}:si(e),!c)return f?function(e,t){return So(e,ri(e),t)}(e,function(e,t){return e&&So(t,_a(t),e)}(s,e)):function(e,t){return So(e,ni(e),t)}(e,Hn(s,e))}else{if(!Ue[R])return o?e:{};s=function(e,t,n){var r=e.constructor;switch(t){case _:return ho(e);case u:case l:return new r(+e);case O:return function(e,t){var n=t?ho(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}(e,n);case T:case C:case x:case E:case N:case I:case"[object Uint8ClampedArray]":case A:case k:return mo(e,n);case h:return new r;case m:case v:return new r(e);case y:return function(e){var t=new e.constructor(e.source,ne.exec(e));return t.lastIndex=e.lastIndex,t}(e);case b:return new r;case S:return o=e,En?he(En.call(o)):{}}var o}(e,R,c)}}i||(i=new Ln);var D=i.get(e);if(D)return D;i.set(e,s),Js(e)?e.forEach((function(r){s.add(Xn(r,t,n,r,e,i))})):Ks(e)&&e.forEach((function(r,o){s.set(o,Xn(r,t,n,o,e,i))}));var P=M?void 0:(w?f?Yo:Ho:f?_a:wa)(e);return st(P||e,(function(r,o){P&&(r=e[o=r]),Fn(s,o,Xn(r,t,n,o,e,i))})),s}function Zn(e,t,n){var r=n.length;if(null==e)return!r;for(e=he(e);r--;){var o=n[r],i=t[o],s=e[o];if(void 0===s&&!(o in e)||!i(s))return!1}return!0}function Qn(e,t,n){if("function"!=typeof e)throw new ye(o);return wi((function(){e.apply(void 0,n)}),t)}function er(e,t,n,r){var o=-1,i=lt,s=!0,a=e.length,c=[],u=t.length;if(!a)return c;n&&(t=pt(t,At(n))),r?(i=ft,s=!1):t.length>=200&&(i=Mt,s=!1,t=new Bn(t));e:for(;++o<a;){var l=e[o],f=null==n?l:n(l);if(l=r||0!==l?l:0,s&&f==f){for(var p=u;p--;)if(t[p]===f)continue e;c.push(l)}else i(t,f,r)||c.push(l)}return c}In.templateSettings={escape:q,evaluate:U,interpolate:z,variable:"",imports:{_:In}},In.prototype=kn.prototype,In.prototype.constructor=In,Mn.prototype=An(kn.prototype),Mn.prototype.constructor=Mn,Rn.prototype=An(kn.prototype),Rn.prototype.constructor=Rn,jn.prototype.clear=function(){this.__data__=bn?bn(null):{},this.size=0},jn.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},jn.prototype.get=function(e){var t=this.__data__;if(bn){var n=t[e];return"__lodash_hash_undefined__"===n?void 0:n}return Oe.call(t,e)?t[e]:void 0},jn.prototype.has=function(e){var t=this.__data__;return bn?void 0!==t[e]:Oe.call(t,e)},jn.prototype.set=function(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=bn&&void 0===t?"__lodash_hash_undefined__":t,this},Dn.prototype.clear=function(){this.__data__=[],this.size=0},Dn.prototype.delete=function(e){var t=this.__data__,n=Vn(t,e);return!(n<0)&&(n==t.length-1?t.pop():Ye.call(t,n,1),--this.size,!0)},Dn.prototype.get=function(e){var t=this.__data__,n=Vn(t,e);return n<0?void 0:t[n][1]},Dn.prototype.has=function(e){return Vn(this.__data__,e)>-1},Dn.prototype.set=function(e,t){var n=this.__data__,r=Vn(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this},Pn.prototype.clear=function(){this.size=0,this.__data__={hash:new jn,map:new(hn||Dn),string:new jn}},Pn.prototype.delete=function(e){var t=Qo(this,e).delete(e);return this.size-=t?1:0,t},Pn.prototype.get=function(e){return Qo(this,e).get(e)},Pn.prototype.has=function(e){return Qo(this,e).has(e)},Pn.prototype.set=function(e,t){var n=Qo(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this},Bn.prototype.add=Bn.prototype.push=function(e){return this.__data__.set(e,"__lodash_hash_undefined__"),this},Bn.prototype.has=function(e){return this.__data__.has(e)},Ln.prototype.clear=function(){this.__data__=new Dn,this.size=0},Ln.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},Ln.prototype.get=function(e){return this.__data__.get(e)},Ln.prototype.has=function(e){return this.__data__.has(e)},Ln.prototype.set=function(e,t){var n=this.__data__;if(n instanceof Dn){var r=n.__data__;if(!hn||r.length<199)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new Pn(r)}return n.set(e,t),this.size=n.size,this};var tr=Oo(ur),nr=Oo(lr,!0);function rr(e,t){var n=!0;return tr(e,(function(e,r,o){return n=!!t(e,r,o)})),n}function or(e,t,n){for(var r=-1,o=e.length;++r<o;){var i=e[r],s=t(i);if(null!=s&&(void 0===a?s==s&&!Zs(s):n(s,a)))var a=s,c=i}return c}function ir(e,t){var n=[];return tr(e,(function(e,r,o){t(e,r,o)&&n.push(e)})),n}function sr(e,t,n,r,o){var i=-1,s=e.length;for(n||(n=ai),o||(o=[]);++i<s;){var a=e[i];t>0&&n(a)?t>1?sr(a,t-1,n,r,o):dt(o,a):r||(o[o.length]=a)}return o}var ar=To(),cr=To(!0);function ur(e,t){return e&&ar(e,t,wa)}function lr(e,t){return e&&cr(e,t,wa)}function fr(e,t){return ut(t,(function(t){return zs(e[t])}))}function pr(e,t){for(var n=0,r=(t=co(t,e)).length;null!=e&&n<r;)e=e[Ei(t[n++])];return n&&n==r?e:void 0}function dr(e,t,n){var r=t(e);return js(e)?r:dt(r,n(e))}function hr(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":yt&&yt in he(e)?function(e){var t=Oe.call(e,yt),n=e[yt];try{e[yt]=void 0;var r=!0}catch(e){}var o=xe.call(e);r&&(t?e[yt]=n:delete e[yt]);return o}(e):function(e){return xe.call(e)}(e)}function mr(e,t){return e>t}function gr(e,t){return null!=e&&Oe.call(e,t)}function yr(e,t){return null!=e&&t in he(e)}function br(e,t,n){for(var o=n?ft:lt,i=e[0].length,s=e.length,a=s,c=r(s),u=1/0,l=[];a--;){var f=e[a];a&&t&&(f=pt(f,At(t))),u=cn(f.length,u),c[a]=!n&&(t||i>=120&&f.length>=120)?new Bn(a&&f):void 0}f=e[0];var p=-1,d=c[0];e:for(;++p<i&&l.length<u;){var h=f[p],m=t?t(h):h;if(h=n||0!==h?h:0,!(d?Mt(d,m):o(l,m,n))){for(a=s;--a;){var g=c[a];if(!(g?Mt(g,m):o(e[a],m,n)))continue e}d&&d.push(m),l.push(h)}}return l}function vr(e,t,n){var r=null==(e=yi(e,t=co(t,e)))?e:e[Ei(Ui(t))];return null==r?void 0:ot(r,e,n)}function Sr(e){return Vs(e)&&hr(e)==a}function wr(e,t,n,r,o){return e===t||(null==e||null==t||!Vs(e)&&!Vs(t)?e!=e&&t!=t:function(e,t,n,r,o,i){var s=js(e),p=js(t),d=s?c:oi(e),w=p?c:oi(t),T=(d=d==a?g:d)==g,C=(w=w==a?g:w)==g,x=d==w;if(x&&Ls(e)){if(!Ls(t))return!1;s=!0,T=!1}if(x&&!T)return i||(i=new Ln),s||Qs(e)?Vo(e,t,n,r,o,i):function(e,t,n,r,o,i,s){switch(n){case O:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case _:return!(e.byteLength!=t.byteLength||!i(new De(e),new De(t)));case u:case l:case m:return As(+e,+t);case f:return e.name==t.name&&e.message==t.message;case y:case v:return e==t+"";case h:var a=Ut;case b:var c=1&r;if(a||(a=Wt),e.size!=t.size&&!c)return!1;var p=s.get(e);if(p)return p==t;r|=2,s.set(e,t);var d=Vo(a(e),a(t),r,o,i,s);return s.delete(e),d;case S:if(En)return En.call(e)==En.call(t)}return!1}(e,t,d,n,r,o,i);if(!(1&n)){var E=T&&Oe.call(e,"__wrapped__"),N=C&&Oe.call(t,"__wrapped__");if(E||N){var I=E?e.value():e,A=N?t.value():t;return i||(i=new Ln),o(I,A,n,r,i)}}if(!x)return!1;return i||(i=new Ln),function(e,t,n,r,o,i){var s=1&n,a=Ho(e),c=a.length,u=Ho(t).length;if(c!=u&&!s)return!1;var l=c;for(;l--;){var f=a[l];if(!(s?f in t:Oe.call(t,f)))return!1}var p=i.get(e),d=i.get(t);if(p&&d)return p==t&&d==e;var h=!0;i.set(e,t),i.set(t,e);var m=s;for(;++l<c;){f=a[l];var g=e[f],y=t[f];if(r)var b=s?r(y,g,f,t,e,i):r(g,y,f,e,t,i);if(!(void 0===b?g===y||o(g,y,n,r,i):b)){h=!1;break}m||(m="constructor"==f)}if(h&&!m){var v=e.constructor,S=t.constructor;v!=S&&"constructor"in e&&"constructor"in t&&!("function"==typeof v&&v instanceof v&&"function"==typeof S&&S instanceof S)&&(h=!1)}return i.delete(e),i.delete(t),h}(e,t,n,r,o,i)}(e,t,n,r,wr,o))}function _r(e,t,n,r){var o=n.length,i=o,s=!r;if(null==e)return!i;for(e=he(e);o--;){var a=n[o];if(s&&a[2]?a[1]!==e[a[0]]:!(a[0]in e))return!1}for(;++o<i;){var c=(a=n[o])[0],u=e[c],l=a[1];if(s&&a[2]){if(void 0===u&&!(c in e))return!1}else{var f=new Ln;if(r)var p=r(u,l,c,e,t,f);if(!(void 0===p?wr(l,u,3,r,f):p))return!1}}return!0}function Or(e){return!(!Fs(e)||function(e){return!!Ce&&Ce in e}(e))&&(zs(e)?Ie:ie).test(Ni(e))}function Tr(e){return"function"==typeof e?e:null==e?Ha:"object"==typeof e?js(e)?Ar(e[0],e[1]):Ir(e):nc(e)}function Cr(e){if(!di(e))return sn(e);var t=[];for(var n in he(e))Oe.call(e,n)&&"constructor"!=n&&t.push(n);return t}function xr(e){if(!Fs(e))return function(e){var t=[];if(null!=e)for(var n in he(e))t.push(n);return t}(e);var t=di(e),n=[];for(var r in e)("constructor"!=r||!t&&Oe.call(e,r))&&n.push(r);return n}function Er(e,t){return e<t}function Nr(e,t){var n=-1,o=Ps(e)?r(e.length):[];return tr(e,(function(e,r,i){o[++n]=t(e,r,i)})),o}function Ir(e){var t=ei(e);return 1==t.length&&t[0][2]?mi(t[0][0],t[0][1]):function(n){return n===e||_r(n,e,t)}}function Ar(e,t){return li(e)&&hi(t)?mi(Ei(e),t):function(n){var r=ga(n,e);return void 0===r&&r===t?ya(n,e):wr(t,r,3)}}function kr(e,t,n,r,o){e!==t&&ar(t,(function(i,s){if(o||(o=new Ln),Fs(i))!function(e,t,n,r,o,i,s){var a=vi(e,n),c=vi(t,n),u=s.get(c);if(u)return void Wn(e,n,u);var l=i?i(a,c,n+"",e,t,s):void 0,f=void 0===l;if(f){var p=js(c),d=!p&&Ls(c),h=!p&&!d&&Qs(c);l=c,p||d||h?js(a)?l=a:Bs(a)?l=vo(a):d?(f=!1,l=po(c,!0)):h?(f=!1,l=mo(c,!0)):l=[]:Ys(c)||Rs(c)?(l=a,Rs(a)?l=aa(a):Fs(a)&&!zs(a)||(l=si(c))):f=!1}f&&(s.set(c,l),o(l,c,r,i,s),s.delete(c));Wn(e,n,l)}(e,t,s,n,kr,r,o);else{var a=r?r(vi(e,s),i,s+"",e,t,o):void 0;void 0===a&&(a=i),Wn(e,s,a)}}),_a)}function Mr(e,t){var n=e.length;if(n)return ci(t+=t<0?n:0,n)?e[t]:void 0}function Rr(e,t,n){t=t.length?pt(t,(function(e){return js(e)?function(t){return pr(t,1===e.length?e[0]:e)}:e})):[Ha];var r=-1;return t=pt(t,At(Zo())),function(e,t){var n=e.length;for(e.sort(t);n--;)e[n]=e[n].value;return e}(Nr(e,(function(e,n,o){return{criteria:pt(t,(function(t){return t(e)})),index:++r,value:e}})),(function(e,t){return function(e,t,n){var r=-1,o=e.criteria,i=t.criteria,s=o.length,a=n.length;for(;++r<s;){var c=go(o[r],i[r]);if(c){if(r>=a)return c;var u=n[r];return c*("desc"==u?-1:1)}}return e.index-t.index}(e,t,n)}))}function jr(e,t,n){for(var r=-1,o=t.length,i={};++r<o;){var s=t[r],a=pr(e,s);n(a,s)&&$r(i,co(s,e),a)}return i}function Dr(e,t,n,r){var o=r?wt:St,i=-1,s=t.length,a=e;for(e===t&&(t=vo(t)),n&&(a=pt(e,At(n)));++i<s;)for(var c=0,u=t[i],l=n?n(u):u;(c=o(a,l,c,r))>-1;)a!==e&&Ye.call(a,c,1),Ye.call(e,c,1);return e}function Pr(e,t){for(var n=e?t.length:0,r=n-1;n--;){var o=t[n];if(n==r||o!==i){var i=o;ci(o)?Ye.call(e,o,1):eo(e,o)}}return e}function Br(e,t){return e+en(fn()*(t-e+1))}function Lr(e,t){var n="";if(!e||t<1||t>9007199254740991)return n;do{t%2&&(n+=e),(t=en(t/2))&&(e+=e)}while(t);return n}function qr(e,t){return _i(gi(e,t,Ha),e+"")}function Ur(e){return Un(Aa(e))}function zr(e,t){var n=Aa(e);return Ci(n,Jn(t,0,n.length))}function $r(e,t,n,r){if(!Fs(e))return e;for(var o=-1,i=(t=co(t,e)).length,s=i-1,a=e;null!=a&&++o<i;){var c=Ei(t[o]),u=n;if("__proto__"===c||"constructor"===c||"prototype"===c)return e;if(o!=s){var l=a[c];void 0===(u=r?r(l,c,a):void 0)&&(u=Fs(l)?l:ci(t[o+1])?[]:{})}Fn(a,c,u),a=a[c]}return e}var Wr=vn?function(e,t){return vn.set(e,t),e}:Ha,Fr=Ct?function(e,t){return Ct(e,"toString",{configurable:!0,enumerable:!1,value:Fa(t),writable:!0})}:Ha;function Vr(e){return Ci(Aa(e))}function Kr(e,t,n){var o=-1,i=e.length;t<0&&(t=-t>i?0:i+t),(n=n>i?i:n)<0&&(n+=i),i=t>n?0:n-t>>>0,t>>>=0;for(var s=r(i);++o<i;)s[o]=e[o+t];return s}function Hr(e,t){var n;return tr(e,(function(e,r,o){return!(n=t(e,r,o))})),!!n}function Yr(e,t,n){var r=0,o=null==e?r:e.length;if("number"==typeof t&&t==t&&o<=2147483647){for(;r<o;){var i=r+o>>>1,s=e[i];null!==s&&!Zs(s)&&(n?s<=t:s<t)?r=i+1:o=i}return o}return Gr(e,t,Ha,n)}function Gr(e,t,n,r){var o=0,i=null==e?0:e.length;if(0===i)return 0;for(var s=(t=n(t))!=t,a=null===t,c=Zs(t),u=void 0===t;o<i;){var l=en((o+i)/2),f=n(e[l]),p=void 0!==f,d=null===f,h=f==f,m=Zs(f);if(s)var g=r||h;else g=u?h&&(r||p):a?h&&p&&(r||!d):c?h&&p&&!d&&(r||!m):!d&&!m&&(r?f<=t:f<t);g?o=l+1:i=l}return cn(i,4294967294)}function Jr(e,t){for(var n=-1,r=e.length,o=0,i=[];++n<r;){var s=e[n],a=t?t(s):s;if(!n||!As(a,c)){var c=a;i[o++]=0===s?0:s}}return i}function Xr(e){return"number"==typeof e?e:Zs(e)?NaN:+e}function Zr(e){if("string"==typeof e)return e;if(js(e))return pt(e,Zr)+"";if(Zs(e))return Nn?Nn.call(e):"";var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}function Qr(e,t,n){var r=-1,o=lt,i=e.length,s=!0,a=[],c=a;if(n)s=!1,o=ft;else if(i>=200){var u=t?null:qo(e);if(u)return Wt(u);s=!1,o=Mt,c=new Bn}else c=t?[]:a;e:for(;++r<i;){var l=e[r],f=t?t(l):l;if(l=n||0!==l?l:0,s&&f==f){for(var p=c.length;p--;)if(c[p]===f)continue e;t&&c.push(f),a.push(l)}else o(c,f,n)||(c!==a&&c.push(f),a.push(l))}return a}function eo(e,t){return null==(e=yi(e,t=co(t,e)))||delete e[Ei(Ui(t))]}function to(e,t,n,r){return $r(e,t,n(pr(e,t)),r)}function no(e,t,n,r){for(var o=e.length,i=r?o:-1;(r?i--:++i<o)&&t(e[i],i,e););return n?Kr(e,r?0:i,r?i+1:o):Kr(e,r?i+1:0,r?o:i)}function ro(e,t){var n=e;return n instanceof Rn&&(n=n.value()),ht(t,(function(e,t){return t.func.apply(t.thisArg,dt([e],t.args))}),n)}function oo(e,t,n){var o=e.length;if(o<2)return o?Qr(e[0]):[];for(var i=-1,s=r(o);++i<o;)for(var a=e[i],c=-1;++c<o;)c!=i&&(s[i]=er(s[i]||a,e[c],t,n));return Qr(sr(s,1),t,n)}function io(e,t,n){for(var r=-1,o=e.length,i=t.length,s={};++r<o;){var a=r<i?t[r]:void 0;n(s,e[r],a)}return s}function so(e){return Bs(e)?e:[]}function ao(e){return"function"==typeof e?e:Ha}function co(e,t){return js(e)?e:li(e,t)?[e]:xi(ca(e))}var uo=qr;function lo(e,t,n){var r=e.length;return n=void 0===n?r:n,!t&&n>=r?e:Kr(e,t,n)}var fo=Jt||function(e){return Ke.clearTimeout(e)};function po(e,t){if(t)return e.slice();var n=e.length,r=ze?ze(n):new e.constructor(n);return e.copy(r),r}function ho(e){var t=new e.constructor(e.byteLength);return new De(t).set(new De(e)),t}function mo(e,t){var n=t?ho(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}function go(e,t){if(e!==t){var n=void 0!==e,r=null===e,o=e==e,i=Zs(e),s=void 0!==t,a=null===t,c=t==t,u=Zs(t);if(!a&&!u&&!i&&e>t||i&&s&&c&&!a&&!u||r&&s&&c||!n&&c||!o)return 1;if(!r&&!i&&!u&&e<t||u&&n&&o&&!r&&!i||a&&n&&o||!s&&o||!c)return-1}return 0}function yo(e,t,n,o){for(var i=-1,s=e.length,a=n.length,c=-1,u=t.length,l=an(s-a,0),f=r(u+l),p=!o;++c<u;)f[c]=t[c];for(;++i<a;)(p||i<s)&&(f[n[i]]=e[i]);for(;l--;)f[c++]=e[i++];return f}function bo(e,t,n,o){for(var i=-1,s=e.length,a=-1,c=n.length,u=-1,l=t.length,f=an(s-c,0),p=r(f+l),d=!o;++i<f;)p[i]=e[i];for(var h=i;++u<l;)p[h+u]=t[u];for(;++a<c;)(d||i<s)&&(p[h+n[a]]=e[i++]);return p}function vo(e,t){var n=-1,o=e.length;for(t||(t=r(o));++n<o;)t[n]=e[n];return t}function So(e,t,n,r){var o=!n;n||(n={});for(var i=-1,s=t.length;++i<s;){var a=t[i],c=r?r(n[a],e[a],a,n,e):void 0;void 0===c&&(c=e[a]),o?Yn(n,a,c):Fn(n,a,c)}return n}function wo(e,t){return function(n,r){var o=js(n)?it:Kn,i=t?t():{};return o(n,e,Zo(r,2),i)}}function _o(e){return qr((function(t,n){var r=-1,o=n.length,i=o>1?n[o-1]:void 0,s=o>2?n[2]:void 0;for(i=e.length>3&&"function"==typeof i?(o--,i):void 0,s&&ui(n[0],n[1],s)&&(i=o<3?void 0:i,o=1),t=he(t);++r<o;){var a=n[r];a&&e(t,a,r,i)}return t}))}function Oo(e,t){return function(n,r){if(null==n)return n;if(!Ps(n))return e(n,r);for(var o=n.length,i=t?o:-1,s=he(n);(t?i--:++i<o)&&!1!==r(s[i],i,s););return n}}function To(e){return function(t,n,r){for(var o=-1,i=he(t),s=r(t),a=s.length;a--;){var c=s[e?a:++o];if(!1===n(i[c],c,i))break}return t}}function Co(e){return function(t){var n=qt(t=ca(t))?Kt(t):void 0,r=n?n[0]:t.charAt(0),o=n?lo(n,1).join(""):t.slice(1);return r[e]()+o}}function xo(e){return function(t){return ht(za(Ra(t).replace(ke,"")),e,"")}}function Eo(e){return function(){var t=arguments;switch(t.length){case 0:return new e;case 1:return new e(t[0]);case 2:return new e(t[0],t[1]);case 3:return new e(t[0],t[1],t[2]);case 4:return new e(t[0],t[1],t[2],t[3]);case 5:return new e(t[0],t[1],t[2],t[3],t[4]);case 6:return new e(t[0],t[1],t[2],t[3],t[4],t[5]);case 7:return new e(t[0],t[1],t[2],t[3],t[4],t[5],t[6])}var n=An(e.prototype),r=e.apply(n,t);return Fs(r)?r:n}}function No(e){return function(t,n,r){var o=he(t);if(!Ps(t)){var i=Zo(n,3);t=wa(t),n=function(e){return i(o[e],e,o)}}var s=e(t,n,r);return s>-1?o[i?t[s]:s]:void 0}}function Io(e){return Ko((function(t){var n=t.length,r=n,i=Mn.prototype.thru;for(e&&t.reverse();r--;){var s=t[r];if("function"!=typeof s)throw new ye(o);if(i&&!a&&"wrapper"==Jo(s))var a=new Mn([],!0)}for(r=a?r:n;++r<n;){var c=Jo(s=t[r]),u="wrapper"==c?Go(s):void 0;a=u&&fi(u[0])&&424==u[1]&&!u[4].length&&1==u[9]?a[Jo(u[0])].apply(a,u[3]):1==s.length&&fi(s)?a[c]():a.thru(s)}return function(){var e=arguments,r=e[0];if(a&&1==e.length&&js(r))return a.plant(r).value();for(var o=0,i=n?t[o].apply(this,e):r;++o<n;)i=t[o].call(this,i);return i}}))}function Ao(e,t,n,o,i,s,a,c,u,l){var f=128&t,p=1&t,d=2&t,h=24&t,m=512&t,g=d?void 0:Eo(e);return function y(){for(var b=arguments.length,v=r(b),S=b;S--;)v[S]=arguments[S];if(h)var w=Xo(y),_=Dt(v,w);if(o&&(v=yo(v,o,i,h)),s&&(v=bo(v,s,a,h)),b-=_,h&&b<l){var O=$t(v,w);return Bo(e,t,Ao,y.placeholder,n,v,O,c,u,l-b)}var T=p?n:this,C=d?T[e]:e;return b=v.length,c?v=bi(v,c):m&&b>1&&v.reverse(),f&&u<b&&(v.length=u),this&&this!==Ke&&this instanceof y&&(C=g||Eo(C)),C.apply(T,v)}}function ko(e,t){return function(n,r){return function(e,t,n,r){return ur(e,(function(e,o,i){t(r,n(e),o,i)})),r}(n,e,t(r),{})}}function Mo(e,t){return function(n,r){var o;if(void 0===n&&void 0===r)return t;if(void 0!==n&&(o=n),void 0!==r){if(void 0===o)return r;"string"==typeof n||"string"==typeof r?(n=Zr(n),r=Zr(r)):(n=Xr(n),r=Xr(r)),o=e(n,r)}return o}}function Ro(e){return Ko((function(t){return t=pt(t,At(Zo())),qr((function(n){var r=this;return e(t,(function(e){return ot(e,r,n)}))}))}))}function jo(e,t){var n=(t=void 0===t?" ":Zr(t)).length;if(n<2)return n?Lr(t,e):t;var r=Lr(t,Qt(e/Vt(t)));return qt(t)?lo(Kt(r),0,e).join(""):r.slice(0,e)}function Do(e){return function(t,n,o){return o&&"number"!=typeof o&&ui(t,n,o)&&(n=o=void 0),t=ra(t),void 0===n?(n=t,t=0):n=ra(n),function(e,t,n,o){for(var i=-1,s=an(Qt((t-e)/(n||1)),0),a=r(s);s--;)a[o?s:++i]=e,e+=n;return a}(t,n,o=void 0===o?t<n?1:-1:ra(o),e)}}function Po(e){return function(t,n){return"string"==typeof t&&"string"==typeof n||(t=sa(t),n=sa(n)),e(t,n)}}function Bo(e,t,n,r,o,i,s,a,c,u){var l=8&t;t|=l?32:64,4&(t&=~(l?64:32))||(t&=-4);var f=[e,t,o,l?i:void 0,l?s:void 0,l?void 0:i,l?void 0:s,a,c,u],p=n.apply(void 0,f);return fi(e)&&Si(p,f),p.placeholder=r,Oi(p,e,t)}function Lo(e){var t=de[e];return function(e,n){if(e=sa(e),(n=null==n?0:cn(oa(n),292))&&rn(e)){var r=(ca(e)+"e").split("e");return+((r=(ca(t(r[0]+"e"+(+r[1]+n)))+"e").split("e"))[0]+"e"+(+r[1]-n))}return t(e)}}var qo=gn&&1/Wt(new gn([,-0]))[1]==1/0?function(e){return new gn(e)}:Za;function Uo(e){return function(t){var n=oi(t);return n==h?Ut(t):n==b?Ft(t):function(e,t){return pt(t,(function(t){return[t,e[t]]}))}(t,e(t))}}function zo(e,t,n,s,a,c,u,l){var f=2&t;if(!f&&"function"!=typeof e)throw new ye(o);var p=s?s.length:0;if(p||(t&=-97,s=a=void 0),u=void 0===u?u:an(oa(u),0),l=void 0===l?l:oa(l),p-=a?a.length:0,64&t){var d=s,h=a;s=a=void 0}var m=f?void 0:Go(e),g=[e,t,n,s,a,d,h,c,u,l];if(m&&function(e,t){var n=e[1],r=t[1],o=n|r,s=o<131,a=128==r&&8==n||128==r&&256==n&&e[7].length<=t[8]||384==r&&t[7].length<=t[8]&&8==n;if(!s&&!a)return e;1&r&&(e[2]=t[2],o|=1&n?0:4);var c=t[3];if(c){var u=e[3];e[3]=u?yo(u,c,t[4]):c,e[4]=u?$t(e[3],i):t[4]}(c=t[5])&&(u=e[5],e[5]=u?bo(u,c,t[6]):c,e[6]=u?$t(e[5],i):t[6]);(c=t[7])&&(e[7]=c);128&r&&(e[8]=null==e[8]?t[8]:cn(e[8],t[8]));null==e[9]&&(e[9]=t[9]);e[0]=t[0],e[1]=o}(g,m),e=g[0],t=g[1],n=g[2],s=g[3],a=g[4],!(l=g[9]=void 0===g[9]?f?0:e.length:an(g[9]-p,0))&&24&t&&(t&=-25),t&&1!=t)y=8==t||16==t?function(e,t,n){var o=Eo(e);return function i(){for(var s=arguments.length,a=r(s),c=s,u=Xo(i);c--;)a[c]=arguments[c];var l=s<3&&a[0]!==u&&a[s-1]!==u?[]:$t(a,u);if((s-=l.length)<n)return Bo(e,t,Ao,i.placeholder,void 0,a,l,void 0,void 0,n-s);var f=this&&this!==Ke&&this instanceof i?o:e;return ot(f,this,a)}}(e,t,l):32!=t&&33!=t||a.length?Ao.apply(void 0,g):function(e,t,n,o){var i=1&t,s=Eo(e);return function t(){for(var a=-1,c=arguments.length,u=-1,l=o.length,f=r(l+c),p=this&&this!==Ke&&this instanceof t?s:e;++u<l;)f[u]=o[u];for(;c--;)f[u++]=arguments[++a];return ot(p,i?n:this,f)}}(e,t,n,s);else var y=function(e,t,n){var r=1&t,o=Eo(e);return function t(){var i=this&&this!==Ke&&this instanceof t?o:e;return i.apply(r?n:this,arguments)}}(e,t,n);return Oi((m?Wr:Si)(y,g),e,t)}function $o(e,t,n,r){return void 0===e||As(e,Se[n])&&!Oe.call(r,n)?t:e}function Wo(e,t,n,r,o,i){return Fs(e)&&Fs(t)&&(i.set(t,e),kr(e,t,void 0,Wo,i),i.delete(t)),e}function Fo(e){return Ys(e)?void 0:e}function Vo(e,t,n,r,o,i){var s=1&n,a=e.length,c=t.length;if(a!=c&&!(s&&c>a))return!1;var u=i.get(e),l=i.get(t);if(u&&l)return u==t&&l==e;var f=-1,p=!0,d=2&n?new Bn:void 0;for(i.set(e,t),i.set(t,e);++f<a;){var h=e[f],m=t[f];if(r)var g=s?r(m,h,f,t,e,i):r(h,m,f,e,t,i);if(void 0!==g){if(g)continue;p=!1;break}if(d){if(!gt(t,(function(e,t){if(!Mt(d,t)&&(h===e||o(h,e,n,r,i)))return d.push(t)}))){p=!1;break}}else if(h!==m&&!o(h,m,n,r,i)){p=!1;break}}return i.delete(e),i.delete(t),p}function Ko(e){return _i(gi(e,void 0,Di),e+"")}function Ho(e){return dr(e,wa,ni)}function Yo(e){return dr(e,_a,ri)}var Go=vn?function(e){return vn.get(e)}:Za;function Jo(e){for(var t=e.name+"",n=Sn[t],r=Oe.call(Sn,t)?n.length:0;r--;){var o=n[r],i=o.func;if(null==i||i==e)return o.name}return t}function Xo(e){return(Oe.call(In,"placeholder")?In:e).placeholder}function Zo(){var e=In.iteratee||Ya;return e=e===Ya?Tr:e,arguments.length?e(arguments[0],arguments[1]):e}function Qo(e,t){var n,r,o=e.__data__;return("string"==(r=typeof(n=t))||"number"==r||"symbol"==r||"boolean"==r?"__proto__"!==n:null===n)?o["string"==typeof t?"string":"hash"]:o.map}function ei(e){for(var t=wa(e),n=t.length;n--;){var r=t[n],o=e[r];t[n]=[r,o,hi(o)]}return t}function ti(e,t){var n=function(e,t){return null==e?void 0:e[t]}(e,t);return Or(n)?n:void 0}var ni=tn?function(e){return null==e?[]:(e=he(e),ut(tn(e),(function(t){return He.call(e,t)})))}:ic,ri=tn?function(e){for(var t=[];e;)dt(t,ni(e)),e=Fe(e);return t}:ic,oi=hr;function ii(e,t,n){for(var r=-1,o=(t=co(t,e)).length,i=!1;++r<o;){var s=Ei(t[r]);if(!(i=null!=e&&n(e,s)))break;e=e[s]}return i||++r!=o?i:!!(o=null==e?0:e.length)&&Ws(o)&&ci(s,o)&&(js(e)||Rs(e))}function si(e){return"function"!=typeof e.constructor||di(e)?{}:An(Fe(e))}function ai(e){return js(e)||Rs(e)||!!(Je&&e&&e[Je])}function ci(e,t){var n=typeof e;return!!(t=null==t?9007199254740991:t)&&("number"==n||"symbol"!=n&&ae.test(e))&&e>-1&&e%1==0&&e<t}function ui(e,t,n){if(!Fs(n))return!1;var r=typeof t;return!!("number"==r?Ps(n)&&ci(t,n.length):"string"==r&&t in n)&&As(n[t],e)}function li(e,t){if(js(e))return!1;var n=typeof e;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=e&&!Zs(e))||(W.test(e)||!$.test(e)||null!=t&&e in he(t))}function fi(e){var t=Jo(e),n=In[t];if("function"!=typeof n||!(t in Rn.prototype))return!1;if(e===n)return!0;var r=Go(n);return!!r&&e===r[0]}(dn&&oi(new dn(new ArrayBuffer(1)))!=O||hn&&oi(new hn)!=h||mn&&"[object Promise]"!=oi(mn.resolve())||gn&&oi(new gn)!=b||yn&&oi(new yn)!=w)&&(oi=function(e){var t=hr(e),n=t==g?e.constructor:void 0,r=n?Ni(n):"";if(r)switch(r){case wn:return O;case _n:return h;case On:return"[object Promise]";case Tn:return b;case Cn:return w}return t});var pi=we?zs:sc;function di(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||Se)}function hi(e){return e==e&&!Fs(e)}function mi(e,t){return function(n){return null!=n&&(n[e]===t&&(void 0!==t||e in he(n)))}}function gi(e,t,n){return t=an(void 0===t?e.length-1:t,0),function(){for(var o=arguments,i=-1,s=an(o.length-t,0),a=r(s);++i<s;)a[i]=o[t+i];i=-1;for(var c=r(t+1);++i<t;)c[i]=o[i];return c[t]=n(a),ot(e,this,c)}}function yi(e,t){return t.length<2?e:pr(e,Kr(t,0,-1))}function bi(e,t){for(var n=e.length,r=cn(t.length,n),o=vo(e);r--;){var i=t[r];e[r]=ci(i,n)?o[i]:void 0}return e}function vi(e,t){if(("constructor"!==t||"function"!=typeof e[t])&&"__proto__"!=t)return e[t]}var Si=Ti(Wr),wi=Zt||function(e,t){return Ke.setTimeout(e,t)},_i=Ti(Fr);function Oi(e,t,n){var r=t+"";return _i(e,function(e,t){var n=t.length;if(!n)return e;var r=n-1;return t[r]=(n>1?"& ":"")+t[r],t=t.join(n>2?", ":" "),e.replace(G,"{\n/* [wrapped with "+t+"] */\n")}(r,function(e,t){return st(s,(function(n){var r="_."+n[0];t&n[1]&&!lt(e,r)&&e.push(r)})),e.sort()}(function(e){var t=e.match(J);return t?t[1].split(X):[]}(r),n)))}function Ti(e){var t=0,n=0;return function(){var r=un(),o=16-(r-n);if(n=r,o>0){if(++t>=800)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}function Ci(e,t){var n=-1,r=e.length,o=r-1;for(t=void 0===t?r:t;++n<t;){var i=Br(n,o),s=e[i];e[i]=e[n],e[n]=s}return e.length=t,e}var xi=function(e){var t=Ts(e,(function(e){return 500===n.size&&n.clear(),e})),n=t.cache;return t}((function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(F,(function(e,n,r,o){t.push(r?o.replace(ee,"$1"):n||e)})),t}));function Ei(e){if("string"==typeof e||Zs(e))return e;var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}function Ni(e){if(null!=e){try{return _e.call(e)}catch(e){}try{return e+""}catch(e){}}return""}function Ii(e){if(e instanceof Rn)return e.clone();var t=new Mn(e.__wrapped__,e.__chain__);return t.__actions__=vo(e.__actions__),t.__index__=e.__index__,t.__values__=e.__values__,t}var Ai=qr((function(e,t){return Bs(e)?er(e,sr(t,1,Bs,!0)):[]})),ki=qr((function(e,t){var n=Ui(t);return Bs(n)&&(n=void 0),Bs(e)?er(e,sr(t,1,Bs,!0),Zo(n,2)):[]})),Mi=qr((function(e,t){var n=Ui(t);return Bs(n)&&(n=void 0),Bs(e)?er(e,sr(t,1,Bs,!0),void 0,n):[]}));function Ri(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var o=null==n?0:oa(n);return o<0&&(o=an(r+o,0)),vt(e,Zo(t,3),o)}function ji(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var o=r-1;return void 0!==n&&(o=oa(n),o=n<0?an(r+o,0):cn(o,r-1)),vt(e,Zo(t,3),o,!0)}function Di(e){return(null==e?0:e.length)?sr(e,1):[]}function Pi(e){return e&&e.length?e[0]:void 0}var Bi=qr((function(e){var t=pt(e,so);return t.length&&t[0]===e[0]?br(t):[]})),Li=qr((function(e){var t=Ui(e),n=pt(e,so);return t===Ui(n)?t=void 0:n.pop(),n.length&&n[0]===e[0]?br(n,Zo(t,2)):[]})),qi=qr((function(e){var t=Ui(e),n=pt(e,so);return(t="function"==typeof t?t:void 0)&&n.pop(),n.length&&n[0]===e[0]?br(n,void 0,t):[]}));function Ui(e){var t=null==e?0:e.length;return t?e[t-1]:void 0}var zi=qr($i);function $i(e,t){return e&&e.length&&t&&t.length?Dr(e,t):e}var Wi=Ko((function(e,t){var n=null==e?0:e.length,r=Gn(e,t);return Pr(e,pt(t,(function(e){return ci(e,n)?+e:e})).sort(go)),r}));function Fi(e){return null==e?e:pn.call(e)}var Vi=qr((function(e){return Qr(sr(e,1,Bs,!0))})),Ki=qr((function(e){var t=Ui(e);return Bs(t)&&(t=void 0),Qr(sr(e,1,Bs,!0),Zo(t,2))})),Hi=qr((function(e){var t=Ui(e);return t="function"==typeof t?t:void 0,Qr(sr(e,1,Bs,!0),void 0,t)}));function Yi(e){if(!e||!e.length)return[];var t=0;return e=ut(e,(function(e){if(Bs(e))return t=an(e.length,t),!0})),Nt(t,(function(t){return pt(e,Tt(t))}))}function Gi(e,t){if(!e||!e.length)return[];var n=Yi(e);return null==t?n:pt(n,(function(e){return ot(t,void 0,e)}))}var Ji=qr((function(e,t){return Bs(e)?er(e,t):[]})),Xi=qr((function(e){return oo(ut(e,Bs))})),Zi=qr((function(e){var t=Ui(e);return Bs(t)&&(t=void 0),oo(ut(e,Bs),Zo(t,2))})),Qi=qr((function(e){var t=Ui(e);return t="function"==typeof t?t:void 0,oo(ut(e,Bs),void 0,t)})),es=qr(Yi);var ts=qr((function(e){var t=e.length,n=t>1?e[t-1]:void 0;return n="function"==typeof n?(e.pop(),n):void 0,Gi(e,n)}));function ns(e){var t=In(e);return t.__chain__=!0,t}function rs(e,t){return t(e)}var os=Ko((function(e){var t=e.length,n=t?e[0]:0,r=this.__wrapped__,o=function(t){return Gn(t,e)};return!(t>1||this.__actions__.length)&&r instanceof Rn&&ci(n)?((r=r.slice(n,+n+(t?1:0))).__actions__.push({func:rs,args:[o],thisArg:void 0}),new Mn(r,this.__chain__).thru((function(e){return t&&!e.length&&e.push(void 0),e}))):this.thru(o)}));var is=wo((function(e,t,n){Oe.call(e,n)?++e[n]:Yn(e,n,1)}));var ss=No(Ri),as=No(ji);function cs(e,t){return(js(e)?st:tr)(e,Zo(t,3))}function us(e,t){return(js(e)?at:nr)(e,Zo(t,3))}var ls=wo((function(e,t,n){Oe.call(e,n)?e[n].push(t):Yn(e,n,[t])}));var fs=qr((function(e,t,n){var o=-1,i="function"==typeof t,s=Ps(e)?r(e.length):[];return tr(e,(function(e){s[++o]=i?ot(t,e,n):vr(e,t,n)})),s})),ps=wo((function(e,t,n){Yn(e,n,t)}));function ds(e,t){return(js(e)?pt:Nr)(e,Zo(t,3))}var hs=wo((function(e,t,n){e[n?0:1].push(t)}),(function(){return[[],[]]}));var ms=qr((function(e,t){if(null==e)return[];var n=t.length;return n>1&&ui(e,t[0],t[1])?t=[]:n>2&&ui(t[0],t[1],t[2])&&(t=[t[0]]),Rr(e,sr(t,1),[])})),gs=Xt||function(){return Ke.Date.now()};function ys(e,t,n){return t=n?void 0:t,zo(e,128,void 0,void 0,void 0,void 0,t=e&&null==t?e.length:t)}function bs(e,t){var n;if("function"!=typeof t)throw new ye(o);return e=oa(e),function(){return--e>0&&(n=t.apply(this,arguments)),e<=1&&(t=void 0),n}}var vs=qr((function(e,t,n){var r=1;if(n.length){var o=$t(n,Xo(vs));r|=32}return zo(e,r,t,n,o)})),Ss=qr((function(e,t,n){var r=3;if(n.length){var o=$t(n,Xo(Ss));r|=32}return zo(t,r,e,n,o)}));function ws(e,t,n){var r,i,s,a,c,u,l=0,f=!1,p=!1,d=!0;if("function"!=typeof e)throw new ye(o);function h(t){var n=r,o=i;return r=i=void 0,l=t,a=e.apply(o,n)}function m(e){return l=e,c=wi(y,t),f?h(e):a}function g(e){var n=e-u;return void 0===u||n>=t||n<0||p&&e-l>=s}function y(){var e=gs();if(g(e))return b(e);c=wi(y,function(e){var n=t-(e-u);return p?cn(n,s-(e-l)):n}(e))}function b(e){return c=void 0,d&&r?h(e):(r=i=void 0,a)}function v(){var e=gs(),n=g(e);if(r=arguments,i=this,u=e,n){if(void 0===c)return m(u);if(p)return fo(c),c=wi(y,t),h(u)}return void 0===c&&(c=wi(y,t)),a}return t=sa(t)||0,Fs(n)&&(f=!!n.leading,s=(p="maxWait"in n)?an(sa(n.maxWait)||0,t):s,d="trailing"in n?!!n.trailing:d),v.cancel=function(){void 0!==c&&fo(c),l=0,r=u=i=c=void 0},v.flush=function(){return void 0===c?a:b(gs())},v}var _s=qr((function(e,t){return Qn(e,1,t)})),Os=qr((function(e,t,n){return Qn(e,sa(t)||0,n)}));function Ts(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new ye(o);var n=function(){var r=arguments,o=t?t.apply(this,r):r[0],i=n.cache;if(i.has(o))return i.get(o);var s=e.apply(this,r);return n.cache=i.set(o,s)||i,s};return n.cache=new(Ts.Cache||Pn),n}function Cs(e){if("function"!=typeof e)throw new ye(o);return function(){var t=arguments;switch(t.length){case 0:return!e.call(this);case 1:return!e.call(this,t[0]);case 2:return!e.call(this,t[0],t[1]);case 3:return!e.call(this,t[0],t[1],t[2])}return!e.apply(this,t)}}Ts.Cache=Pn;var xs=uo((function(e,t){var n=(t=1==t.length&&js(t[0])?pt(t[0],At(Zo())):pt(sr(t,1),At(Zo()))).length;return qr((function(r){for(var o=-1,i=cn(r.length,n);++o<i;)r[o]=t[o].call(this,r[o]);return ot(e,this,r)}))})),Es=qr((function(e,t){return zo(e,32,void 0,t,$t(t,Xo(Es)))})),Ns=qr((function(e,t){return zo(e,64,void 0,t,$t(t,Xo(Ns)))})),Is=Ko((function(e,t){return zo(e,256,void 0,void 0,void 0,t)}));function As(e,t){return e===t||e!=e&&t!=t}var ks=Po(mr),Ms=Po((function(e,t){return e>=t})),Rs=Sr(function(){return arguments}())?Sr:function(e){return Vs(e)&&Oe.call(e,"callee")&&!He.call(e,"callee")},js=r.isArray,Ds=Ze?At(Ze):function(e){return Vs(e)&&hr(e)==_};function Ps(e){return null!=e&&Ws(e.length)&&!zs(e)}function Bs(e){return Vs(e)&&Ps(e)}var Ls=nn||sc,qs=Qe?At(Qe):function(e){return Vs(e)&&hr(e)==l};function Us(e){if(!Vs(e))return!1;var t=hr(e);return t==f||"[object DOMException]"==t||"string"==typeof e.message&&"string"==typeof e.name&&!Ys(e)}function zs(e){if(!Fs(e))return!1;var t=hr(e);return t==p||t==d||"[object AsyncFunction]"==t||"[object Proxy]"==t}function $s(e){return"number"==typeof e&&e==oa(e)}function Ws(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991}function Fs(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function Vs(e){return null!=e&&"object"==typeof e}var Ks=et?At(et):function(e){return Vs(e)&&oi(e)==h};function Hs(e){return"number"==typeof e||Vs(e)&&hr(e)==m}function Ys(e){if(!Vs(e)||hr(e)!=g)return!1;var t=Fe(e);if(null===t)return!0;var n=Oe.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&_e.call(n)==Ee}var Gs=tt?At(tt):function(e){return Vs(e)&&hr(e)==y};var Js=nt?At(nt):function(e){return Vs(e)&&oi(e)==b};function Xs(e){return"string"==typeof e||!js(e)&&Vs(e)&&hr(e)==v}function Zs(e){return"symbol"==typeof e||Vs(e)&&hr(e)==S}var Qs=rt?At(rt):function(e){return Vs(e)&&Ws(e.length)&&!!qe[hr(e)]};var ea=Po(Er),ta=Po((function(e,t){return e<=t}));function na(e){if(!e)return[];if(Ps(e))return Xs(e)?Kt(e):vo(e);if(Xe&&e[Xe])return function(e){for(var t,n=[];!(t=e.next()).done;)n.push(t.value);return n}(e[Xe]());var t=oi(e);return(t==h?Ut:t==b?Wt:Aa)(e)}function ra(e){return e?(e=sa(e))===1/0||e===-1/0?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0}function oa(e){var t=ra(e),n=t%1;return t==t?n?t-n:t:0}function ia(e){return e?Jn(oa(e),0,4294967295):0}function sa(e){if("number"==typeof e)return e;if(Zs(e))return NaN;if(Fs(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=Fs(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=It(e);var n=oe.test(e);return n||se.test(e)?We(e.slice(2),n?2:8):re.test(e)?NaN:+e}function aa(e){return So(e,_a(e))}function ca(e){return null==e?"":Zr(e)}var ua=_o((function(e,t){if(di(t)||Ps(t))So(t,wa(t),e);else for(var n in t)Oe.call(t,n)&&Fn(e,n,t[n])})),la=_o((function(e,t){So(t,_a(t),e)})),fa=_o((function(e,t,n,r){So(t,_a(t),e,r)})),pa=_o((function(e,t,n,r){So(t,wa(t),e,r)})),da=Ko(Gn);var ha=qr((function(e,t){e=he(e);var n=-1,r=t.length,o=r>2?t[2]:void 0;for(o&&ui(t[0],t[1],o)&&(r=1);++n<r;)for(var i=t[n],s=_a(i),a=-1,c=s.length;++a<c;){var u=s[a],l=e[u];(void 0===l||As(l,Se[u])&&!Oe.call(e,u))&&(e[u]=i[u])}return e})),ma=qr((function(e){return e.push(void 0,Wo),ot(Ta,void 0,e)}));function ga(e,t,n){var r=null==e?void 0:pr(e,t);return void 0===r?n:r}function ya(e,t){return null!=e&&ii(e,t,yr)}var ba=ko((function(e,t,n){null!=t&&"function"!=typeof t.toString&&(t=xe.call(t)),e[t]=n}),Fa(Ha)),va=ko((function(e,t,n){null!=t&&"function"!=typeof t.toString&&(t=xe.call(t)),Oe.call(e,t)?e[t].push(n):e[t]=[n]}),Zo),Sa=qr(vr);function wa(e){return Ps(e)?qn(e):Cr(e)}function _a(e){return Ps(e)?qn(e,!0):xr(e)}var Oa=_o((function(e,t,n){kr(e,t,n)})),Ta=_o((function(e,t,n,r){kr(e,t,n,r)})),Ca=Ko((function(e,t){var n={};if(null==e)return n;var r=!1;t=pt(t,(function(t){return t=co(t,e),r||(r=t.length>1),t})),So(e,Yo(e),n),r&&(n=Xn(n,7,Fo));for(var o=t.length;o--;)eo(n,t[o]);return n}));var xa=Ko((function(e,t){return null==e?{}:function(e,t){return jr(e,t,(function(t,n){return ya(e,n)}))}(e,t)}));function Ea(e,t){if(null==e)return{};var n=pt(Yo(e),(function(e){return[e]}));return t=Zo(t),jr(e,n,(function(e,n){return t(e,n[0])}))}var Na=Uo(wa),Ia=Uo(_a);function Aa(e){return null==e?[]:kt(e,wa(e))}var ka=xo((function(e,t,n){return t=t.toLowerCase(),e+(n?Ma(t):t)}));function Ma(e){return Ua(ca(e).toLowerCase())}function Ra(e){return(e=ca(e))&&e.replace(ce,Pt).replace(Me,"")}var ja=xo((function(e,t,n){return e+(n?"-":"")+t.toLowerCase()})),Da=xo((function(e,t,n){return e+(n?" ":"")+t.toLowerCase()})),Pa=Co("toLowerCase");var Ba=xo((function(e,t,n){return e+(n?"_":"")+t.toLowerCase()}));var La=xo((function(e,t,n){return e+(n?" ":"")+Ua(t)}));var qa=xo((function(e,t,n){return e+(n?" ":"")+t.toUpperCase()})),Ua=Co("toUpperCase");function za(e,t,n){return e=ca(e),void 0===(t=n?void 0:t)?function(e){return Pe.test(e)}(e)?function(e){return e.match(je)||[]}(e):function(e){return e.match(Z)||[]}(e):e.match(t)||[]}var $a=qr((function(e,t){try{return ot(e,void 0,t)}catch(e){return Us(e)?e:new fe(e)}})),Wa=Ko((function(e,t){return st(t,(function(t){t=Ei(t),Yn(e,t,vs(e[t],e))})),e}));function Fa(e){return function(){return e}}var Va=Io(),Ka=Io(!0);function Ha(e){return e}function Ya(e){return Tr("function"==typeof e?e:Xn(e,1))}var Ga=qr((function(e,t){return function(n){return vr(n,e,t)}})),Ja=qr((function(e,t){return function(n){return vr(e,n,t)}}));function Xa(e,t,n){var r=wa(t),o=fr(t,r);null!=n||Fs(t)&&(o.length||!r.length)||(n=t,t=e,e=this,o=fr(t,wa(t)));var i=!(Fs(n)&&"chain"in n&&!n.chain),s=zs(e);return st(o,(function(n){var r=t[n];e[n]=r,s&&(e.prototype[n]=function(){var t=this.__chain__;if(i||t){var n=e(this.__wrapped__),o=n.__actions__=vo(this.__actions__);return o.push({func:r,args:arguments,thisArg:e}),n.__chain__=t,n}return r.apply(e,dt([this.value()],arguments))})})),e}function Za(){}var Qa=Ro(pt),ec=Ro(ct),tc=Ro(gt);function nc(e){return li(e)?Tt(Ei(e)):function(e){return function(t){return pr(t,e)}}(e)}var rc=Do(),oc=Do(!0);function ic(){return[]}function sc(){return!1}var ac=Mo((function(e,t){return e+t}),0),cc=Lo("ceil"),uc=Mo((function(e,t){return e/t}),1),lc=Lo("floor");var fc,pc=Mo((function(e,t){return e*t}),1),dc=Lo("round"),hc=Mo((function(e,t){return e-t}),0);return In.after=function(e,t){if("function"!=typeof t)throw new ye(o);return e=oa(e),function(){if(--e<1)return t.apply(this,arguments)}},In.ary=ys,In.assign=ua,In.assignIn=la,In.assignInWith=fa,In.assignWith=pa,In.at=da,In.before=bs,In.bind=vs,In.bindAll=Wa,In.bindKey=Ss,In.castArray=function(){if(!arguments.length)return[];var e=arguments[0];return js(e)?e:[e]},In.chain=ns,In.chunk=function(e,t,n){t=(n?ui(e,t,n):void 0===t)?1:an(oa(t),0);var o=null==e?0:e.length;if(!o||t<1)return[];for(var i=0,s=0,a=r(Qt(o/t));i<o;)a[s++]=Kr(e,i,i+=t);return a},In.compact=function(e){for(var t=-1,n=null==e?0:e.length,r=0,o=[];++t<n;){var i=e[t];i&&(o[r++]=i)}return o},In.concat=function(){var e=arguments.length;if(!e)return[];for(var t=r(e-1),n=arguments[0],o=e;o--;)t[o-1]=arguments[o];return dt(js(n)?vo(n):[n],sr(t,1))},In.cond=function(e){var t=null==e?0:e.length,n=Zo();return e=t?pt(e,(function(e){if("function"!=typeof e[1])throw new ye(o);return[n(e[0]),e[1]]})):[],qr((function(n){for(var r=-1;++r<t;){var o=e[r];if(ot(o[0],this,n))return ot(o[1],this,n)}}))},In.conforms=function(e){return function(e){var t=wa(e);return function(n){return Zn(n,e,t)}}(Xn(e,1))},In.constant=Fa,In.countBy=is,In.create=function(e,t){var n=An(e);return null==t?n:Hn(n,t)},In.curry=function e(t,n,r){var o=zo(t,8,void 0,void 0,void 0,void 0,void 0,n=r?void 0:n);return o.placeholder=e.placeholder,o},In.curryRight=function e(t,n,r){var o=zo(t,16,void 0,void 0,void 0,void 0,void 0,n=r?void 0:n);return o.placeholder=e.placeholder,o},In.debounce=ws,In.defaults=ha,In.defaultsDeep=ma,In.defer=_s,In.delay=Os,In.difference=Ai,In.differenceBy=ki,In.differenceWith=Mi,In.drop=function(e,t,n){var r=null==e?0:e.length;return r?Kr(e,(t=n||void 0===t?1:oa(t))<0?0:t,r):[]},In.dropRight=function(e,t,n){var r=null==e?0:e.length;return r?Kr(e,0,(t=r-(t=n||void 0===t?1:oa(t)))<0?0:t):[]},In.dropRightWhile=function(e,t){return e&&e.length?no(e,Zo(t,3),!0,!0):[]},In.dropWhile=function(e,t){return e&&e.length?no(e,Zo(t,3),!0):[]},In.fill=function(e,t,n,r){var o=null==e?0:e.length;return o?(n&&"number"!=typeof n&&ui(e,t,n)&&(n=0,r=o),function(e,t,n,r){var o=e.length;for((n=oa(n))<0&&(n=-n>o?0:o+n),(r=void 0===r||r>o?o:oa(r))<0&&(r+=o),r=n>r?0:ia(r);n<r;)e[n++]=t;return e}(e,t,n,r)):[]},In.filter=function(e,t){return(js(e)?ut:ir)(e,Zo(t,3))},In.flatMap=function(e,t){return sr(ds(e,t),1)},In.flatMapDeep=function(e,t){return sr(ds(e,t),1/0)},In.flatMapDepth=function(e,t,n){return n=void 0===n?1:oa(n),sr(ds(e,t),n)},In.flatten=Di,In.flattenDeep=function(e){return(null==e?0:e.length)?sr(e,1/0):[]},In.flattenDepth=function(e,t){return(null==e?0:e.length)?sr(e,t=void 0===t?1:oa(t)):[]},In.flip=function(e){return zo(e,512)},In.flow=Va,In.flowRight=Ka,In.fromPairs=function(e){for(var t=-1,n=null==e?0:e.length,r={};++t<n;){var o=e[t];r[o[0]]=o[1]}return r},In.functions=function(e){return null==e?[]:fr(e,wa(e))},In.functionsIn=function(e){return null==e?[]:fr(e,_a(e))},In.groupBy=ls,In.initial=function(e){return(null==e?0:e.length)?Kr(e,0,-1):[]},In.intersection=Bi,In.intersectionBy=Li,In.intersectionWith=qi,In.invert=ba,In.invertBy=va,In.invokeMap=fs,In.iteratee=Ya,In.keyBy=ps,In.keys=wa,In.keysIn=_a,In.map=ds,In.mapKeys=function(e,t){var n={};return t=Zo(t,3),ur(e,(function(e,r,o){Yn(n,t(e,r,o),e)})),n},In.mapValues=function(e,t){var n={};return t=Zo(t,3),ur(e,(function(e,r,o){Yn(n,r,t(e,r,o))})),n},In.matches=function(e){return Ir(Xn(e,1))},In.matchesProperty=function(e,t){return Ar(e,Xn(t,1))},In.memoize=Ts,In.merge=Oa,In.mergeWith=Ta,In.method=Ga,In.methodOf=Ja,In.mixin=Xa,In.negate=Cs,In.nthArg=function(e){return e=oa(e),qr((function(t){return Mr(t,e)}))},In.omit=Ca,In.omitBy=function(e,t){return Ea(e,Cs(Zo(t)))},In.once=function(e){return bs(2,e)},In.orderBy=function(e,t,n,r){return null==e?[]:(js(t)||(t=null==t?[]:[t]),js(n=r?void 0:n)||(n=null==n?[]:[n]),Rr(e,t,n))},In.over=Qa,In.overArgs=xs,In.overEvery=ec,In.overSome=tc,In.partial=Es,In.partialRight=Ns,In.partition=hs,In.pick=xa,In.pickBy=Ea,In.property=nc,In.propertyOf=function(e){return function(t){return null==e?void 0:pr(e,t)}},In.pull=zi,In.pullAll=$i,In.pullAllBy=function(e,t,n){return e&&e.length&&t&&t.length?Dr(e,t,Zo(n,2)):e},In.pullAllWith=function(e,t,n){return e&&e.length&&t&&t.length?Dr(e,t,void 0,n):e},In.pullAt=Wi,In.range=rc,In.rangeRight=oc,In.rearg=Is,In.reject=function(e,t){return(js(e)?ut:ir)(e,Cs(Zo(t,3)))},In.remove=function(e,t){var n=[];if(!e||!e.length)return n;var r=-1,o=[],i=e.length;for(t=Zo(t,3);++r<i;){var s=e[r];t(s,r,e)&&(n.push(s),o.push(r))}return Pr(e,o),n},In.rest=function(e,t){if("function"!=typeof e)throw new ye(o);return qr(e,t=void 0===t?t:oa(t))},In.reverse=Fi,In.sampleSize=function(e,t,n){return t=(n?ui(e,t,n):void 0===t)?1:oa(t),(js(e)?zn:zr)(e,t)},In.set=function(e,t,n){return null==e?e:$r(e,t,n)},In.setWith=function(e,t,n,r){return r="function"==typeof r?r:void 0,null==e?e:$r(e,t,n,r)},In.shuffle=function(e){return(js(e)?$n:Vr)(e)},In.slice=function(e,t,n){var r=null==e?0:e.length;return r?(n&&"number"!=typeof n&&ui(e,t,n)?(t=0,n=r):(t=null==t?0:oa(t),n=void 0===n?r:oa(n)),Kr(e,t,n)):[]},In.sortBy=ms,In.sortedUniq=function(e){return e&&e.length?Jr(e):[]},In.sortedUniqBy=function(e,t){return e&&e.length?Jr(e,Zo(t,2)):[]},In.split=function(e,t,n){return n&&"number"!=typeof n&&ui(e,t,n)&&(t=n=void 0),(n=void 0===n?4294967295:n>>>0)?(e=ca(e))&&("string"==typeof t||null!=t&&!Gs(t))&&!(t=Zr(t))&&qt(e)?lo(Kt(e),0,n):e.split(t,n):[]},In.spread=function(e,t){if("function"!=typeof e)throw new ye(o);return t=null==t?0:an(oa(t),0),qr((function(n){var r=n[t],o=lo(n,0,t);return r&&dt(o,r),ot(e,this,o)}))},In.tail=function(e){var t=null==e?0:e.length;return t?Kr(e,1,t):[]},In.take=function(e,t,n){return e&&e.length?Kr(e,0,(t=n||void 0===t?1:oa(t))<0?0:t):[]},In.takeRight=function(e,t,n){var r=null==e?0:e.length;return r?Kr(e,(t=r-(t=n||void 0===t?1:oa(t)))<0?0:t,r):[]},In.takeRightWhile=function(e,t){return e&&e.length?no(e,Zo(t,3),!1,!0):[]},In.takeWhile=function(e,t){return e&&e.length?no(e,Zo(t,3)):[]},In.tap=function(e,t){return t(e),e},In.throttle=function(e,t,n){var r=!0,i=!0;if("function"!=typeof e)throw new ye(o);return Fs(n)&&(r="leading"in n?!!n.leading:r,i="trailing"in n?!!n.trailing:i),ws(e,t,{leading:r,maxWait:t,trailing:i})},In.thru=rs,In.toArray=na,In.toPairs=Na,In.toPairsIn=Ia,In.toPath=function(e){return js(e)?pt(e,Ei):Zs(e)?[e]:vo(xi(ca(e)))},In.toPlainObject=aa,In.transform=function(e,t,n){var r=js(e),o=r||Ls(e)||Qs(e);if(t=Zo(t,4),null==n){var i=e&&e.constructor;n=o?r?new i:[]:Fs(e)&&zs(i)?An(Fe(e)):{}}return(o?st:ur)(e,(function(e,r,o){return t(n,e,r,o)})),n},In.unary=function(e){return ys(e,1)},In.union=Vi,In.unionBy=Ki,In.unionWith=Hi,In.uniq=function(e){return e&&e.length?Qr(e):[]},In.uniqBy=function(e,t){return e&&e.length?Qr(e,Zo(t,2)):[]},In.uniqWith=function(e,t){return t="function"==typeof t?t:void 0,e&&e.length?Qr(e,void 0,t):[]},In.unset=function(e,t){return null==e||eo(e,t)},In.unzip=Yi,In.unzipWith=Gi,In.update=function(e,t,n){return null==e?e:to(e,t,ao(n))},In.updateWith=function(e,t,n,r){return r="function"==typeof r?r:void 0,null==e?e:to(e,t,ao(n),r)},In.values=Aa,In.valuesIn=function(e){return null==e?[]:kt(e,_a(e))},In.without=Ji,In.words=za,In.wrap=function(e,t){return Es(ao(t),e)},In.xor=Xi,In.xorBy=Zi,In.xorWith=Qi,In.zip=es,In.zipObject=function(e,t){return io(e||[],t||[],Fn)},In.zipObjectDeep=function(e,t){return io(e||[],t||[],$r)},In.zipWith=ts,In.entries=Na,In.entriesIn=Ia,In.extend=la,In.extendWith=fa,Xa(In,In),In.add=ac,In.attempt=$a,In.camelCase=ka,In.capitalize=Ma,In.ceil=cc,In.clamp=function(e,t,n){return void 0===n&&(n=t,t=void 0),void 0!==n&&(n=(n=sa(n))==n?n:0),void 0!==t&&(t=(t=sa(t))==t?t:0),Jn(sa(e),t,n)},In.clone=function(e){return Xn(e,4)},In.cloneDeep=function(e){return Xn(e,5)},In.cloneDeepWith=function(e,t){return Xn(e,5,t="function"==typeof t?t:void 0)},In.cloneWith=function(e,t){return Xn(e,4,t="function"==typeof t?t:void 0)},In.conformsTo=function(e,t){return null==t||Zn(e,t,wa(t))},In.deburr=Ra,In.defaultTo=function(e,t){return null==e||e!=e?t:e},In.divide=uc,In.endsWith=function(e,t,n){e=ca(e),t=Zr(t);var r=e.length,o=n=void 0===n?r:Jn(oa(n),0,r);return(n-=t.length)>=0&&e.slice(n,o)==t},In.eq=As,In.escape=function(e){return(e=ca(e))&&L.test(e)?e.replace(P,Bt):e},In.escapeRegExp=function(e){return(e=ca(e))&&K.test(e)?e.replace(V,"\\$&"):e},In.every=function(e,t,n){var r=js(e)?ct:rr;return n&&ui(e,t,n)&&(t=void 0),r(e,Zo(t,3))},In.find=ss,In.findIndex=Ri,In.findKey=function(e,t){return bt(e,Zo(t,3),ur)},In.findLast=as,In.findLastIndex=ji,In.findLastKey=function(e,t){return bt(e,Zo(t,3),lr)},In.floor=lc,In.forEach=cs,In.forEachRight=us,In.forIn=function(e,t){return null==e?e:ar(e,Zo(t,3),_a)},In.forInRight=function(e,t){return null==e?e:cr(e,Zo(t,3),_a)},In.forOwn=function(e,t){return e&&ur(e,Zo(t,3))},In.forOwnRight=function(e,t){return e&&lr(e,Zo(t,3))},In.get=ga,In.gt=ks,In.gte=Ms,In.has=function(e,t){return null!=e&&ii(e,t,gr)},In.hasIn=ya,In.head=Pi,In.identity=Ha,In.includes=function(e,t,n,r){e=Ps(e)?e:Aa(e),n=n&&!r?oa(n):0;var o=e.length;return n<0&&(n=an(o+n,0)),Xs(e)?n<=o&&e.indexOf(t,n)>-1:!!o&&St(e,t,n)>-1},In.indexOf=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var o=null==n?0:oa(n);return o<0&&(o=an(r+o,0)),St(e,t,o)},In.inRange=function(e,t,n){return t=ra(t),void 0===n?(n=t,t=0):n=ra(n),function(e,t,n){return e>=cn(t,n)&&e<an(t,n)}(e=sa(e),t,n)},In.invoke=Sa,In.isArguments=Rs,In.isArray=js,In.isArrayBuffer=Ds,In.isArrayLike=Ps,In.isArrayLikeObject=Bs,In.isBoolean=function(e){return!0===e||!1===e||Vs(e)&&hr(e)==u},In.isBuffer=Ls,In.isDate=qs,In.isElement=function(e){return Vs(e)&&1===e.nodeType&&!Ys(e)},In.isEmpty=function(e){if(null==e)return!0;if(Ps(e)&&(js(e)||"string"==typeof e||"function"==typeof e.splice||Ls(e)||Qs(e)||Rs(e)))return!e.length;var t=oi(e);if(t==h||t==b)return!e.size;if(di(e))return!Cr(e).length;for(var n in e)if(Oe.call(e,n))return!1;return!0},In.isEqual=function(e,t){return wr(e,t)},In.isEqualWith=function(e,t,n){var r=(n="function"==typeof n?n:void 0)?n(e,t):void 0;return void 0===r?wr(e,t,void 0,n):!!r},In.isError=Us,In.isFinite=function(e){return"number"==typeof e&&rn(e)},In.isFunction=zs,In.isInteger=$s,In.isLength=Ws,In.isMap=Ks,In.isMatch=function(e,t){return e===t||_r(e,t,ei(t))},In.isMatchWith=function(e,t,n){return n="function"==typeof n?n:void 0,_r(e,t,ei(t),n)},In.isNaN=function(e){return Hs(e)&&e!=+e},In.isNative=function(e){if(pi(e))throw new fe("Unsupported core-js use. Try https://npms.io/search?q=ponyfill.");return Or(e)},In.isNil=function(e){return null==e},In.isNull=function(e){return null===e},In.isNumber=Hs,In.isObject=Fs,In.isObjectLike=Vs,In.isPlainObject=Ys,In.isRegExp=Gs,In.isSafeInteger=function(e){return $s(e)&&e>=-9007199254740991&&e<=9007199254740991},In.isSet=Js,In.isString=Xs,In.isSymbol=Zs,In.isTypedArray=Qs,In.isUndefined=function(e){return void 0===e},In.isWeakMap=function(e){return Vs(e)&&oi(e)==w},In.isWeakSet=function(e){return Vs(e)&&"[object WeakSet]"==hr(e)},In.join=function(e,t){return null==e?"":on.call(e,t)},In.kebabCase=ja,In.last=Ui,In.lastIndexOf=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var o=r;return void 0!==n&&(o=(o=oa(n))<0?an(r+o,0):cn(o,r-1)),t==t?function(e,t,n){for(var r=n+1;r--;)if(e[r]===t)return r;return r}(e,t,o):vt(e,_t,o,!0)},In.lowerCase=Da,In.lowerFirst=Pa,In.lt=ea,In.lte=ta,In.max=function(e){return e&&e.length?or(e,Ha,mr):void 0},In.maxBy=function(e,t){return e&&e.length?or(e,Zo(t,2),mr):void 0},In.mean=function(e){return Ot(e,Ha)},In.meanBy=function(e,t){return Ot(e,Zo(t,2))},In.min=function(e){return e&&e.length?or(e,Ha,Er):void 0},In.minBy=function(e,t){return e&&e.length?or(e,Zo(t,2),Er):void 0},In.stubArray=ic,In.stubFalse=sc,In.stubObject=function(){return{}},In.stubString=function(){return""},In.stubTrue=function(){return!0},In.multiply=pc,In.nth=function(e,t){return e&&e.length?Mr(e,oa(t)):void 0},In.noConflict=function(){return Ke._===this&&(Ke._=Ne),this},In.noop=Za,In.now=gs,In.pad=function(e,t,n){e=ca(e);var r=(t=oa(t))?Vt(e):0;if(!t||r>=t)return e;var o=(t-r)/2;return jo(en(o),n)+e+jo(Qt(o),n)},In.padEnd=function(e,t,n){e=ca(e);var r=(t=oa(t))?Vt(e):0;return t&&r<t?e+jo(t-r,n):e},In.padStart=function(e,t,n){e=ca(e);var r=(t=oa(t))?Vt(e):0;return t&&r<t?jo(t-r,n)+e:e},In.parseInt=function(e,t,n){return n||null==t?t=0:t&&(t=+t),ln(ca(e).replace(H,""),t||0)},In.random=function(e,t,n){if(n&&"boolean"!=typeof n&&ui(e,t,n)&&(t=n=void 0),void 0===n&&("boolean"==typeof t?(n=t,t=void 0):"boolean"==typeof e&&(n=e,e=void 0)),void 0===e&&void 0===t?(e=0,t=1):(e=ra(e),void 0===t?(t=e,e=0):t=ra(t)),e>t){var r=e;e=t,t=r}if(n||e%1||t%1){var o=fn();return cn(e+o*(t-e+$e("1e-"+((o+"").length-1))),t)}return Br(e,t)},In.reduce=function(e,t,n){var r=js(e)?ht:xt,o=arguments.length<3;return r(e,Zo(t,4),n,o,tr)},In.reduceRight=function(e,t,n){var r=js(e)?mt:xt,o=arguments.length<3;return r(e,Zo(t,4),n,o,nr)},In.repeat=function(e,t,n){return t=(n?ui(e,t,n):void 0===t)?1:oa(t),Lr(ca(e),t)},In.replace=function(){var e=arguments,t=ca(e[0]);return e.length<3?t:t.replace(e[1],e[2])},In.result=function(e,t,n){var r=-1,o=(t=co(t,e)).length;for(o||(o=1,e=void 0);++r<o;){var i=null==e?void 0:e[Ei(t[r])];void 0===i&&(r=o,i=n),e=zs(i)?i.call(e):i}return e},In.round=dc,In.runInContext=e,In.sample=function(e){return(js(e)?Un:Ur)(e)},In.size=function(e){if(null==e)return 0;if(Ps(e))return Xs(e)?Vt(e):e.length;var t=oi(e);return t==h||t==b?e.size:Cr(e).length},In.snakeCase=Ba,In.some=function(e,t,n){var r=js(e)?gt:Hr;return n&&ui(e,t,n)&&(t=void 0),r(e,Zo(t,3))},In.sortedIndex=function(e,t){return Yr(e,t)},In.sortedIndexBy=function(e,t,n){return Gr(e,t,Zo(n,2))},In.sortedIndexOf=function(e,t){var n=null==e?0:e.length;if(n){var r=Yr(e,t);if(r<n&&As(e[r],t))return r}return-1},In.sortedLastIndex=function(e,t){return Yr(e,t,!0)},In.sortedLastIndexBy=function(e,t,n){return Gr(e,t,Zo(n,2),!0)},In.sortedLastIndexOf=function(e,t){if(null==e?0:e.length){var n=Yr(e,t,!0)-1;if(As(e[n],t))return n}return-1},In.startCase=La,In.startsWith=function(e,t,n){return e=ca(e),n=null==n?0:Jn(oa(n),0,e.length),t=Zr(t),e.slice(n,n+t.length)==t},In.subtract=hc,In.sum=function(e){return e&&e.length?Et(e,Ha):0},In.sumBy=function(e,t){return e&&e.length?Et(e,Zo(t,2)):0},In.template=function(e,t,n){var r=In.templateSettings;n&&ui(e,t,n)&&(t=void 0),e=ca(e),t=fa({},t,r,$o);var o,i,s=fa({},t.imports,r.imports,$o),a=wa(s),c=kt(s,a),u=0,l=t.interpolate||ue,f="__p += '",p=me((t.escape||ue).source+"|"+l.source+"|"+(l===z?te:ue).source+"|"+(t.evaluate||ue).source+"|$","g"),d="//# sourceURL="+(Oe.call(t,"sourceURL")?(t.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++Le+"]")+"\n";e.replace(p,(function(t,n,r,s,a,c){return r||(r=s),f+=e.slice(u,c).replace(le,Lt),n&&(o=!0,f+="' +\n__e("+n+") +\n'"),a&&(i=!0,f+="';\n"+a+";\n__p += '"),r&&(f+="' +\n((__t = ("+r+")) == null ? '' : __t) +\n'"),u=c+t.length,t})),f+="';\n";var h=Oe.call(t,"variable")&&t.variable;if(h){if(Q.test(h))throw new fe("Invalid `variable` option passed into `_.template`")}else f="with (obj) {\n"+f+"\n}\n";f=(i?f.replace(M,""):f).replace(R,"$1").replace(j,"$1;"),f="function("+(h||"obj")+") {\n"+(h?"":"obj || (obj = {});\n")+"var __t, __p = ''"+(o?", __e = _.escape":"")+(i?", __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n":";\n")+f+"return __p\n}";var m=$a((function(){return pe(a,d+"return "+f).apply(void 0,c)}));if(m.source=f,Us(m))throw m;return m},In.times=function(e,t){if((e=oa(e))<1||e>9007199254740991)return[];var n=4294967295,r=cn(e,4294967295);e-=4294967295;for(var o=Nt(r,t=Zo(t));++n<e;)t(n);return o},In.toFinite=ra,In.toInteger=oa,In.toLength=ia,In.toLower=function(e){return ca(e).toLowerCase()},In.toNumber=sa,In.toSafeInteger=function(e){return e?Jn(oa(e),-9007199254740991,9007199254740991):0===e?e:0},In.toString=ca,In.toUpper=function(e){return ca(e).toUpperCase()},In.trim=function(e,t,n){if((e=ca(e))&&(n||void 0===t))return It(e);if(!e||!(t=Zr(t)))return e;var r=Kt(e),o=Kt(t);return lo(r,Rt(r,o),jt(r,o)+1).join("")},In.trimEnd=function(e,t,n){if((e=ca(e))&&(n||void 0===t))return e.slice(0,Ht(e)+1);if(!e||!(t=Zr(t)))return e;var r=Kt(e);return lo(r,0,jt(r,Kt(t))+1).join("")},In.trimStart=function(e,t,n){if((e=ca(e))&&(n||void 0===t))return e.replace(H,"");if(!e||!(t=Zr(t)))return e;var r=Kt(e);return lo(r,Rt(r,Kt(t))).join("")},In.truncate=function(e,t){var n=30,r="...";if(Fs(t)){var o="separator"in t?t.separator:o;n="length"in t?oa(t.length):n,r="omission"in t?Zr(t.omission):r}var i=(e=ca(e)).length;if(qt(e)){var s=Kt(e);i=s.length}if(n>=i)return e;var a=n-Vt(r);if(a<1)return r;var c=s?lo(s,0,a).join(""):e.slice(0,a);if(void 0===o)return c+r;if(s&&(a+=c.length-a),Gs(o)){if(e.slice(a).search(o)){var u,l=c;for(o.global||(o=me(o.source,ca(ne.exec(o))+"g")),o.lastIndex=0;u=o.exec(l);)var f=u.index;c=c.slice(0,void 0===f?a:f)}}else if(e.indexOf(Zr(o),a)!=a){var p=c.lastIndexOf(o);p>-1&&(c=c.slice(0,p))}return c+r},In.unescape=function(e){return(e=ca(e))&&B.test(e)?e.replace(D,Yt):e},In.uniqueId=function(e){var t=++Te;return ca(e)+t},In.upperCase=qa,In.upperFirst=Ua,In.each=cs,In.eachRight=us,In.first=Pi,Xa(In,(fc={},ur(In,(function(e,t){Oe.call(In.prototype,t)||(fc[t]=e)})),fc),{chain:!1}),In.VERSION="4.17.21",st(["bind","bindKey","curry","curryRight","partial","partialRight"],(function(e){In[e].placeholder=In})),st(["drop","take"],(function(e,t){Rn.prototype[e]=function(n){n=void 0===n?1:an(oa(n),0);var r=this.__filtered__&&!t?new Rn(this):this.clone();return r.__filtered__?r.__takeCount__=cn(n,r.__takeCount__):r.__views__.push({size:cn(n,4294967295),type:e+(r.__dir__<0?"Right":"")}),r},Rn.prototype[e+"Right"]=function(t){return this.reverse()[e](t).reverse()}})),st(["filter","map","takeWhile"],(function(e,t){var n=t+1,r=1==n||3==n;Rn.prototype[e]=function(e){var t=this.clone();return t.__iteratees__.push({iteratee:Zo(e,3),type:n}),t.__filtered__=t.__filtered__||r,t}})),st(["head","last"],(function(e,t){var n="take"+(t?"Right":"");Rn.prototype[e]=function(){return this[n](1).value()[0]}})),st(["initial","tail"],(function(e,t){var n="drop"+(t?"":"Right");Rn.prototype[e]=function(){return this.__filtered__?new Rn(this):this[n](1)}})),Rn.prototype.compact=function(){return this.filter(Ha)},Rn.prototype.find=function(e){return this.filter(e).head()},Rn.prototype.findLast=function(e){return this.reverse().find(e)},Rn.prototype.invokeMap=qr((function(e,t){return"function"==typeof e?new Rn(this):this.map((function(n){return vr(n,e,t)}))})),Rn.prototype.reject=function(e){return this.filter(Cs(Zo(e)))},Rn.prototype.slice=function(e,t){e=oa(e);var n=this;return n.__filtered__&&(e>0||t<0)?new Rn(n):(e<0?n=n.takeRight(-e):e&&(n=n.drop(e)),void 0!==t&&(n=(t=oa(t))<0?n.dropRight(-t):n.take(t-e)),n)},Rn.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},Rn.prototype.toArray=function(){return this.take(4294967295)},ur(Rn.prototype,(function(e,t){var n=/^(?:filter|find|map|reject)|While$/.test(t),r=/^(?:head|last)$/.test(t),o=In[r?"take"+("last"==t?"Right":""):t],i=r||/^find/.test(t);o&&(In.prototype[t]=function(){var t=this.__wrapped__,s=r?[1]:arguments,a=t instanceof Rn,c=s[0],u=a||js(t),l=function(e){var t=o.apply(In,dt([e],s));return r&&f?t[0]:t};u&&n&&"function"==typeof c&&1!=c.length&&(a=u=!1);var f=this.__chain__,p=!!this.__actions__.length,d=i&&!f,h=a&&!p;if(!i&&u){t=h?t:new Rn(this);var m=e.apply(t,s);return m.__actions__.push({func:rs,args:[l],thisArg:void 0}),new Mn(m,f)}return d&&h?e.apply(this,s):(m=this.thru(l),d?r?m.value()[0]:m.value():m)})})),st(["pop","push","shift","sort","splice","unshift"],(function(e){var t=be[e],n=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",r=/^(?:pop|shift)$/.test(e);In.prototype[e]=function(){var e=arguments;if(r&&!this.__chain__){var o=this.value();return t.apply(js(o)?o:[],e)}return this[n]((function(n){return t.apply(js(n)?n:[],e)}))}})),ur(Rn.prototype,(function(e,t){var n=In[t];if(n){var r=n.name+"";Oe.call(Sn,r)||(Sn[r]=[]),Sn[r].push({name:t,func:n})}})),Sn[Ao(void 0,2).name]=[{name:"wrapper",func:void 0}],Rn.prototype.clone=function(){var e=new Rn(this.__wrapped__);return e.__actions__=vo(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=vo(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=vo(this.__views__),e},Rn.prototype.reverse=function(){if(this.__filtered__){var e=new Rn(this);e.__dir__=-1,e.__filtered__=!0}else(e=this.clone()).__dir__*=-1;return e},Rn.prototype.value=function(){var e=this.__wrapped__.value(),t=this.__dir__,n=js(e),r=t<0,o=n?e.length:0,i=function(e,t,n){var r=-1,o=n.length;for(;++r<o;){var i=n[r],s=i.size;switch(i.type){case"drop":e+=s;break;case"dropRight":t-=s;break;case"take":t=cn(t,e+s);break;case"takeRight":e=an(e,t-s)}}return{start:e,end:t}}(0,o,this.__views__),s=i.start,a=i.end,c=a-s,u=r?a:s-1,l=this.__iteratees__,f=l.length,p=0,d=cn(c,this.__takeCount__);if(!n||!r&&o==c&&d==c)return ro(e,this.__actions__);var h=[];e:for(;c--&&p<d;){for(var m=-1,g=e[u+=t];++m<f;){var y=l[m],b=y.iteratee,v=y.type,S=b(g);if(2==v)g=S;else if(!S){if(1==v)continue e;break e}}h[p++]=g}return h},In.prototype.at=os,In.prototype.chain=function(){return ns(this)},In.prototype.commit=function(){return new Mn(this.value(),this.__chain__)},In.prototype.next=function(){void 0===this.__values__&&(this.__values__=na(this.value()));var e=this.__index__>=this.__values__.length;return{done:e,value:e?void 0:this.__values__[this.__index__++]}},In.prototype.plant=function(e){for(var t,n=this;n instanceof kn;){var r=Ii(n);r.__index__=0,r.__values__=void 0,t?o.__wrapped__=r:t=r;var o=r;n=n.__wrapped__}return o.__wrapped__=e,t},In.prototype.reverse=function(){var e=this.__wrapped__;if(e instanceof Rn){var t=e;return this.__actions__.length&&(t=new Rn(this)),(t=t.reverse()).__actions__.push({func:rs,args:[Fi],thisArg:void 0}),new Mn(t,this.__chain__)}return this.thru(Fi)},In.prototype.toJSON=In.prototype.valueOf=In.prototype.value=function(){return ro(this.__wrapped__,this.__actions__)},In.prototype.first=In.prototype.head,Xe&&(In.prototype[Xe]=function(){return this}),In}();Ke._=Gt,void 0===(r=function(){return Gt}.call(t,n,t,e))||(e.exports=r)}).call(this)}).call(this,n(62)(e))},function(e,t,n){var r=n(36),o=n(248),i=n(249),s=r?r.toStringTag:void 0;e.exports=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":s&&s in Object(e)?o(e):i(e)}},function(e,t,n){"use strict";const r=n(18).Transform,o=n(18).PassThrough,i=n(5).deprecate,s=n(0).handleCallback,a=n(2).ReadPreference,c=n(2).MongoError,u=n(17).CoreCursor,l=n(17).CursorState,f=n(2).BSON.Map,p=n(0).maybePromise,d=n(56),h=n(0).formattedOrderClause,m=n(91).Explain,g=n(1).Aspect,y=n(448).each,b=n(449),v=["tailable","oplogReplay","noCursorTimeout","awaitData","exhaust","partial"],S=["numberOfRetries","tailableRetryInterval"];class w extends u{constructor(e,t,n,r){super(e,t,n,r),this.operation&&(r=this.operation.options);const o=r.numberOfRetries||5,i=r.tailableRetryInterval||500,s=o,a=r.promiseLibrary||Promise;this.s={numberOfRetries:o,tailableRetryInterval:i,currentNumberOfRetries:s,state:l.INIT,promiseLibrary:a,explicitlyIgnoreSession:!!r.explicitlyIgnoreSession},!r.explicitlyIgnoreSession&&r.session&&(this.cursorState.session=r.session),!0===this.options.noCursorTimeout&&this.addCursorFlag("noCursorTimeout",!0);let c=1e3;this.cmd.cursor&&this.cmd.cursor.batchSize?c=this.cmd.cursor.batchSize:r.cursor&&r.cursor.batchSize?c=r.cursor.batchSize:"number"==typeof r.batchSize&&(c=r.batchSize),this.setCursorBatchSize(c)}get readPreference(){return this.operation?this.operation.readPreference:this.options.readPreference}get sortValue(){return this.cmd.sort}_initializeCursor(e){this.operation&&null!=this.operation.session?this.cursorState.session=this.operation.session:this.s.explicitlyIgnoreSession||this.cursorState.session||!this.topology.hasSessionSupport()||(this.cursorState.session=this.topology.startSession({owner:this}),this.operation&&(this.operation.session=this.cursorState.session)),super._initializeCursor(e)}hasNext(e){if(this.s.state===l.CLOSED||this.isDead&&this.isDead())throw c.create({message:"Cursor is closed",driver:!0});return p(this,e,e=>{const t=this;if(t.isNotified())return e(null,!1);t._next((n,r)=>n?e(n):null==r||t.s.state===w.CLOSED||t.isDead()?e(null,!1):(t.s.state=l.OPEN,t.cursorState.cursorIndex--,t.cursorState.limit>0&&t.cursorState.currentLimit--,void e(null,!0)))})}next(e){return p(this,e,e=>{const t=this;if(t.s.state===l.CLOSED||t.isDead&&t.isDead())e(c.create({message:"Cursor is closed",driver:!0}));else{if(t.s.state===l.INIT&&t.cmd.sort)try{t.cmd.sort=h(t.cmd.sort)}catch(t){return e(t)}t._next((n,r)=>{if(n)return e(n);t.s.state=l.OPEN,e(null,r)})}})}filter(e){if(this.s.state===l.CLOSED||this.s.state===l.OPEN||this.isDead())throw c.create({message:"Cursor is closed",driver:!0});return this.cmd.query=e,this}maxScan(e){if(this.s.state===l.CLOSED||this.s.state===l.OPEN||this.isDead())throw c.create({message:"Cursor is closed",driver:!0});return this.cmd.maxScan=e,this}hint(e){if(this.s.state===l.CLOSED||this.s.state===l.OPEN||this.isDead())throw c.create({message:"Cursor is closed",driver:!0});return this.cmd.hint=e,this}min(e){if(this.s.state===l.CLOSED||this.s.state===l.OPEN||this.isDead())throw c.create({message:"Cursor is closed",driver:!0});return this.cmd.min=e,this}max(e){if(this.s.state===l.CLOSED||this.s.state===l.OPEN||this.isDead())throw c.create({message:"Cursor is closed",driver:!0});return this.cmd.max=e,this}returnKey(e){if(this.s.state===l.CLOSED||this.s.state===l.OPEN||this.isDead())throw c.create({message:"Cursor is closed",driver:!0});return this.cmd.returnKey=e,this}showRecordId(e){if(this.s.state===l.CLOSED||this.s.state===l.OPEN||this.isDead())throw c.create({message:"Cursor is closed",driver:!0});return this.cmd.showDiskLoc=e,this}snapshot(e){if(this.s.state===l.CLOSED||this.s.state===l.OPEN||this.isDead())throw c.create({message:"Cursor is closed",driver:!0});return this.cmd.snapshot=e,this}setCursorOption(e,t){if(this.s.state===l.CLOSED||this.s.state===l.OPEN||this.isDead())throw c.create({message:"Cursor is closed",driver:!0});if(-1===S.indexOf(e))throw c.create({message:`option ${e} is not a supported option ${S}`,driver:!0});return this.s[e]=t,"numberOfRetries"===e&&(this.s.currentNumberOfRetries=t),this}addCursorFlag(e,t){if(this.s.state===l.CLOSED||this.s.state===l.OPEN||this.isDead())throw c.create({message:"Cursor is closed",driver:!0});if(-1===v.indexOf(e))throw c.create({message:`flag ${e} is not a supported flag ${v}`,driver:!0});if("boolean"!=typeof t)throw c.create({message:`flag ${e} must be a boolean value`,driver:!0});return this.cmd[e]=t,this}addQueryModifier(e,t){if(this.s.state===l.CLOSED||this.s.state===l.OPEN||this.isDead())throw c.create({message:"Cursor is closed",driver:!0});if("$"!==e[0])throw c.create({message:`${e} is not a valid query modifier`,driver:!0});const n=e.substr(1);return this.cmd[n]=t,"orderby"===n&&(this.cmd.sort=this.cmd[n]),this}comment(e){if(this.s.state===l.CLOSED||this.s.state===l.OPEN||this.isDead())throw c.create({message:"Cursor is closed",driver:!0});return this.cmd.comment=e,this}maxAwaitTimeMS(e){if("number"!=typeof e)throw c.create({message:"maxAwaitTimeMS must be a number",driver:!0});if(this.s.state===l.CLOSED||this.s.state===l.OPEN||this.isDead())throw c.create({message:"Cursor is closed",driver:!0});return this.cmd.maxAwaitTimeMS=e,this}maxTimeMS(e){if("number"!=typeof e)throw c.create({message:"maxTimeMS must be a number",driver:!0});if(this.s.state===l.CLOSED||this.s.state===l.OPEN||this.isDead())throw c.create({message:"Cursor is closed",driver:!0});return this.cmd.maxTimeMS=e,this}project(e){if(this.s.state===l.CLOSED||this.s.state===l.OPEN||this.isDead())throw c.create({message:"Cursor is closed",driver:!0});return this.cmd.fields=e,this}sort(e,t){if(this.options.tailable)throw c.create({message:"Tailable cursor doesn't support sorting",driver:!0});if(this.s.state===l.CLOSED||this.s.state===l.OPEN||this.isDead())throw c.create({message:"Cursor is closed",driver:!0});let n=e;return Array.isArray(n)&&Array.isArray(n[0])&&(n=new f(n.map(e=>{const t=[e[0],null];if("asc"===e[1])t[1]=1;else if("desc"===e[1])t[1]=-1;else{if(1!==e[1]&&-1!==e[1]&&!e[1].$meta)throw new c("Illegal sort clause, must be of the form [['field1', '(ascending|descending)'], ['field2', '(ascending|descending)']]");t[1]=e[1]}return t}))),null!=t&&(n=[[e,t]]),this.cmd.sort=n,this}batchSize(e){if(this.options.tailable)throw c.create({message:"Tailable cursor doesn't support batchSize",driver:!0});if(this.s.state===l.CLOSED||this.isDead())throw c.create({message:"Cursor is closed",driver:!0});if("number"!=typeof e)throw c.create({message:"batchSize requires an integer",driver:!0});return this.cmd.batchSize=e,this.setCursorBatchSize(e),this}collation(e){return this.cmd.collation=e,this}limit(e){if(this.options.tailable)throw c.create({message:"Tailable cursor doesn't support limit",driver:!0});if(this.s.state===l.OPEN||this.s.state===l.CLOSED||this.isDead())throw c.create({message:"Cursor is closed",driver:!0});if("number"!=typeof e)throw c.create({message:"limit requires an integer",driver:!0});return this.cmd.limit=e,this.setCursorLimit(e),this}skip(e){if(this.options.tailable)throw c.create({message:"Tailable cursor doesn't support skip",driver:!0});if(this.s.state===l.OPEN||this.s.state===l.CLOSED||this.isDead())throw c.create({message:"Cursor is closed",driver:!0});if("number"!=typeof e)throw c.create({message:"skip requires an integer",driver:!0});return this.cmd.skip=e,this.setCursorSkip(e),this}each(e){this.rewind(),this.s.state=l.INIT,y(this,e)}forEach(e,t){if(this.rewind(),this.s.state=l.INIT,"function"!=typeof t)return new this.s.promiseLibrary((t,n)=>{y(this,(r,o)=>r?(n(r),!1):null==o?(t(null),!1):(e(o),!0))});y(this,(n,r)=>{if(n)return t(n),!1;if(null!=r)return e(r),!0;if(null==r&&t){const e=t;return t=null,e(null),!1}})}setReadPreference(e){if(this.s.state!==l.INIT)throw c.create({message:"cannot change cursor readPreference after cursor has been accessed",driver:!0});if(e instanceof a)this.options.readPreference=e;else{if("string"!=typeof e)throw new TypeError("Invalid read preference: "+e);this.options.readPreference=new a(e)}return this}toArray(e){if(this.options.tailable)throw c.create({message:"Tailable cursor cannot be converted to array",driver:!0});return p(this,e,e=>{const t=this,n=[];t.rewind(),t.s.state=l.INIT;const r=()=>{t._next((o,i)=>{if(o)return s(e,o);if(null==i)return t.close({skipKillCursors:!0},()=>s(e,null,n));if(n.push(i),t.bufferedCount()>0){let e=t.readBufferedDocuments(t.bufferedCount());Array.prototype.push.apply(n,e)}r()})};r()})}count(e,t,n){if(null==this.cmd.query)throw c.create({message:"count can only be used with find command",driver:!0});"function"==typeof t&&(n=t,t={}),t=t||{},"function"==typeof e&&(n=e,e=!0),this.cursorState.session&&(t=Object.assign({},t,{session:this.cursorState.session}));const r=new b(this,e,t);return d(this.topology,r,n)}close(e,t){return"function"==typeof e&&(t=e,e={}),e=Object.assign({},{skipKillCursors:!1},e),p(this,t,t=>{this.s.state=l.CLOSED,e.skipKillCursors||this.kill(),this._endSession(()=>{this.emit("close"),t(null,this)})})}map(e){if(this.cursorState.transforms&&this.cursorState.transforms.doc){const t=this.cursorState.transforms.doc;this.cursorState.transforms.doc=n=>e(t(n))}else this.cursorState.transforms={doc:e};return this}isClosed(){return this.isDead()}destroy(e){e&&this.emit("error",e),this.pause(),this.close()}stream(e){return this.cursorState.streamOptions=e||{},this}transformStream(e){const t=e||{};if("function"==typeof t.transform){const e=new r({objectMode:!0,transform:function(e,n,r){this.push(t.transform(e)),r()}});return this.pipe(e)}return this.pipe(new o({objectMode:!0}))}explain(e,t){if("function"==typeof e&&(t=e,e=!0),void 0===e&&(e=!0),!this.operation||!this.operation.hasAspect(g.EXPLAINABLE))throw new c("This command cannot be explained");return this.operation.explain=new m(e),p(this,t,e=>{u.prototype._next.apply(this,[e])})}getLogger(){return this.logger}}w.prototype.maxTimeMs=w.prototype.maxTimeMS,i(w.prototype.each,"Cursor.each is deprecated. Use Cursor.forEach instead."),i(w.prototype.maxScan,"Cursor.maxScan is deprecated, and will be removed in a later version"),i(w.prototype.snapshot,"Cursor Snapshot is deprecated, and will be removed in a later version"),e.exports=w},function(e,t,n){"use strict";const r=n(1).Aspect,o=n(1).OperationBase,i=n(2).ReadPreference,s=n(46),a=n(29),c=n(4).maxWireVersion,u=n(0).decorateWithExplain,l=n(34).commandSupportsReadConcern,f=n(3).MongoError;e.exports=class extends o{constructor(e,t,n){super(t),this.ns=e.s.namespace.withCollection("$cmd");const o=this.hasAspect(r.NO_INHERIT_OPTIONS)?void 0:e;this.readPreference=this.hasAspect(r.WRITE_OPERATION)?i.primary:i.resolve(o,this.options),this.readConcern=function(e,t){return s.fromOptions(t)||e&&e.readConcern}(o,this.options),this.writeConcern=function(e,t){return a.fromOptions(t)||e&&e.writeConcern}(o,this.options),n&&"boolean"==typeof n.fullResponse&&(this.fullResponse=!0),this.options.readPreference=this.readPreference,e.s.logger?this.logger=e.s.logger:e.s.db&&e.s.db.logger&&(this.logger=e.s.db.logger)}executeCommand(e,t,n){this.server=e;const o=this.options,i=c(e),s=this.session&&this.session.inTransaction();this.readConcern&&l(t)&&!s&&Object.assign(t,{readConcern:this.readConcern}),o.collation&&i<5?n(new f(`Server ${e.name}, which reports wire version ${i}, does not support collation`)):(i>=5&&(this.writeConcern&&this.hasAspect(r.WRITE_OPERATION)&&Object.assign(t,{writeConcern:this.writeConcern}),o.collation&&"object"==typeof o.collation&&Object.assign(t,{collation:o.collation})),"number"==typeof o.maxTimeMS&&(t.maxTimeMS=o.maxTimeMS),"string"==typeof o.comment&&(t.comment=o.comment),this.hasAspect(r.EXPLAINABLE)&&this.explain&&(i<6&&t.aggregate?t.explain=!0:t=u(t,this.explain)),this.logger&&this.logger.isDebug()&&this.logger.debug(`executing command ${JSON.stringify(t)} against ${this.ns}`),e.command(this.ns.toString(),t,this.options,(e,t)=>{e?n(e,null):this.fullResponse?n(null,t):n(null,t.result)}))}}},function(e,t){e.exports=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}},function(e,t,n){"use strict";const r=new Set(["w","wtimeout","j","journal","fsync"]);let o;class i{constructor(e,t,n,r){null!=e&&(this.w=e),null!=t&&(this.wtimeout=t),null!=n&&(this.j=n),null!=r&&(this.fsync=r)}static fromOptions(e){if(null!=e&&(null!=e.writeConcern||null!=e.w||null!=e.wtimeout||null!=e.j||null!=e.journal||null!=e.fsync)){if(e.writeConcern){if("string"==typeof e.writeConcern)return new i(e.writeConcern);if(!Object.keys(e.writeConcern).some(e=>r.has(e)))return;return new i(e.writeConcern.w,e.writeConcern.wtimeout,e.writeConcern.j||e.writeConcern.journal,e.writeConcern.fsync)}return o||(o=n(0)),o.emitWarningOnce("Top-level use of w, wtimeout, j, and fsync is deprecated. Use writeConcern instead."),new i(e.w,e.wtimeout,e.j||e.journal,e.fsync)}}}e.exports=i},function(e,t,n){"use strict";const r=n(9).retrieveSnappy(),o=n(413),i={snappy:1,zlib:2},s=new Set(["ismaster","saslStart","saslContinue","getnonce","authenticate","createUser","updateUser","copydbSaslStart","copydbgetnonce","copydb"]);e.exports={compressorIDs:i,uncompressibleCommands:s,compress:function(e,t,n){switch(e.options.agreedCompressor){case"snappy":r.compress(t,n);break;case"zlib":var i={};e.options.zlibCompressionLevel&&(i.level=e.options.zlibCompressionLevel),o.deflate(t,i,n);break;default:throw new Error('Attempt to compress message using unknown compressor "'+e.options.agreedCompressor+'".')}},decompress:function(e,t,n){if(e<0||e>i.length)throw new Error("Server sent message compressed using an unsupported compressor. (Received compressor ID "+e+")");switch(e){case i.snappy:r.uncompress(t,n);break;case i.zlib:o.inflate(t,n);break;default:n(null,t)}}}},function(e,t,n){var r=n(247),o=n(252);e.exports=function(e,t){var n=o(e,t);return r(n)?n:void 0}},function(e,t,n){"use strict";function r(e,t){return new Buffer(e,t)}e.exports={normalizedFunctionString:function(e){return e.toString().replace(/function *\(/,"function (")},allocBuffer:"function"==typeof Buffer.alloc?function(){return Buffer.alloc.apply(Buffer,arguments)}:r,toBuffer:"function"==typeof Buffer.from?function(){return Buffer.from.apply(Buffer,arguments)}:r}},function(e,t,n){"use strict";e.exports={AuthContext:class{constructor(e,t,n){this.connection=e,this.credentials=t,this.options=n}},AuthProvider:class{constructor(e){this.bson=e}prepare(e,t,n){n(void 0,e)}auth(e,t){t(new TypeError("`auth` method must be overridden by subclass"))}}}},function(e,t,n){"use strict";const r=n(9).retrieveBSON,o=n(8),i=r(),s=i.Binary,a=n(4).uuidV4,c=n(3).MongoError,u=n(3).isRetryableError,l=n(3).MongoNetworkError,f=n(3).MongoWriteConcernError,p=n(54).Transaction,d=n(54).TxnState,h=n(4).isPromiseLike,m=n(10),g=n(0).maybePromise,y=n(54).isTransactionCommand,b=n(7).resolveClusterTime,v=n(6).isSharded,S=n(4).maxWireVersion,w=n(0).now,_=n(0).calculateDurationInMs;function O(e,t){if(null==e.serverSession){const e=new c("Cannot use a session that has ended");if("function"==typeof t)return t(e,null),!1;throw e}return!0}const T=Symbol("serverSession");class C extends o{constructor(e,t,n,r){if(super(),null==e)throw new Error("ClientSession requires a topology");if(null==t||!(t instanceof R))throw new Error("ClientSession requires a ServerSessionPool");n=n||{},r=r||{},this.topology=e,this.sessionPool=t,this.hasEnded=!1,this.clientOptions=r,this[T]=void 0,this.supports={causalConsistency:void 0===n.causalConsistency||n.causalConsistency},this.clusterTime=n.initialClusterTime,this.operationTime=null,this.explicit=!!n.explicit,this.owner=n.owner,this.defaultTransactionOptions=Object.assign({},n.defaultTransactionOptions),this.transaction=new p}get id(){return this.serverSession.id}get serverSession(){return null==this[T]&&(this[T]=this.sessionPool.acquire()),this[T]}endSession(e,t){"function"==typeof e&&(t=e,e={}),e=e||{};const n=this;return g(this,t,e=>{if(n.hasEnded)return e();function t(){n.sessionPool.release(n.serverSession),n[T]=void 0,n.hasEnded=!0,n.emit("ended",n),e()}n.serverSession&&n.inTransaction()?n.abortTransaction(n=>{if(n)return e(n);t()}):t()})}advanceOperationTime(e){null!=this.operationTime?e.greaterThan(this.operationTime)&&(this.operationTime=e):this.operationTime=e}equals(e){return e instanceof C&&this.id.id.buffer.equals(e.id.id.buffer)}incrementTransactionNumber(){this.serverSession.txnNumber++}inTransaction(){return this.transaction.isActive}startTransaction(e){if(O(this),this.inTransaction())throw new c("Transaction already in progress");const t=S(this.topology);if(v(this.topology)&&null!=t&&t<8)throw new c("Transactions are not supported on sharded clusters in MongoDB < 4.2.");this.incrementTransactionNumber(),this.transaction=new p(Object.assign({},this.clientOptions,e||this.defaultTransactionOptions)),this.transaction.transition(d.STARTING_TRANSACTION)}commitTransaction(e){return g(this,e,e=>k(this,"commitTransaction",e))}abortTransaction(e){return g(this,e,e=>k(this,"abortTransaction",e))}toBSON(){throw new Error("ClientSession cannot be serialized to BSON.")}withTransaction(e,t){return A(this,w(),e,t)}}const x=new Set(["CannotSatisfyWriteConcern","UnknownReplWriteConcern","UnsatisfiableWriteConcern"]);function E(e,t){return _(e)<t}function N(e){return null!=e&&(50===e.code||e.writeConcernError&&50===e.writeConcernError.code)}const I=new Set([d.NO_TRANSACTION,d.TRANSACTION_COMMITTED,d.TRANSACTION_ABORTED]);function A(e,t,n,r){let o;e.startTransaction(r);try{o=n(e)}catch(e){o=Promise.reject(e)}if(!h(o))throw e.abortTransaction(),new TypeError("Function provided to `withTransaction` must return a Promise");return o.then(()=>{if(!function(e){return I.has(e.transaction.state)}(e))return function e(t,n,r,o){return t.commitTransaction().catch(i=>{if(i instanceof c&&E(n,12e4)&&!N(i)){if(i.hasErrorLabel("UnknownTransactionCommitResult"))return e(t,n,r,o);if(i.hasErrorLabel("TransientTransactionError"))return A(t,n,r,o)}throw i})}(e,t,n,r)}).catch(o=>{function i(o){if(o instanceof c&&o.hasErrorLabel("TransientTransactionError")&&E(t,12e4))return A(e,t,n,r);throw N(o)&&o.addErrorLabel("UnknownTransactionCommitResult"),o}return e.transaction.isActive?e.abortTransaction().then(()=>i(o)):i(o)})}function k(e,t,n){if(!O(e,n))return;let r=e.transaction.state;if(r===d.NO_TRANSACTION)return void n(new c("No transaction started"));if("commitTransaction"===t){if(r===d.STARTING_TRANSACTION||r===d.TRANSACTION_COMMITTED_EMPTY)return e.transaction.transition(d.TRANSACTION_COMMITTED_EMPTY),void n(null,null);if(r===d.TRANSACTION_ABORTED)return void n(new c("Cannot call commitTransaction after calling abortTransaction"))}else{if(r===d.STARTING_TRANSACTION)return e.transaction.transition(d.TRANSACTION_ABORTED),void n(null,null);if(r===d.TRANSACTION_ABORTED)return void n(new c("Cannot call abortTransaction twice"));if(r===d.TRANSACTION_COMMITTED||r===d.TRANSACTION_COMMITTED_EMPTY)return void n(new c("Cannot call abortTransaction after calling commitTransaction"))}const o={[t]:1};let i;function s(r,o){var i;"commitTransaction"===t?(e.transaction.transition(d.TRANSACTION_COMMITTED),r&&(r instanceof l||r instanceof f||u(r)||N(r))&&(N(i=r)||!x.has(i.codeName)&&100!==i.code&&79!==i.code)&&(r.addErrorLabel("UnknownTransactionCommitResult"),e.transaction.unpinServer())):e.transaction.transition(d.TRANSACTION_ABORTED),n(r,o)}function a(e){return"commitTransaction"===t?e:null}e.transaction.options.writeConcern?i=Object.assign({},e.transaction.options.writeConcern):e.clientOptions&&e.clientOptions.w&&(i={w:e.clientOptions.w}),r===d.TRANSACTION_COMMITTED&&(i=Object.assign({wtimeout:1e4},i,{w:"majority"})),i&&Object.assign(o,{writeConcern:i}),"commitTransaction"===t&&e.transaction.options.maxTimeMS&&Object.assign(o,{maxTimeMS:e.transaction.options.maxTimeMS}),e.transaction.recoveryToken&&function(e){return!!e.topology.s.options.useRecoveryToken}(e)&&(o.recoveryToken=e.transaction.recoveryToken),e.topology.command("admin.$cmd",o,{session:e},(t,n)=>{if(t&&u(t))return o.commitTransaction&&(e.transaction.unpinServer(),o.writeConcern=Object.assign({wtimeout:1e4},o.writeConcern,{w:"majority"})),e.topology.command("admin.$cmd",o,{session:e},(e,t)=>s(a(e),t));s(a(t),n)})}class M{constructor(){this.id={id:new s(a(),s.SUBTYPE_UUID)},this.lastUse=w(),this.txnNumber=0,this.isDirty=!1}hasTimedOut(e){return Math.round(_(this.lastUse)%864e5%36e5/6e4)>e-1}}class R{constructor(e){if(null==e)throw new Error("ServerSessionPool requires a topology");this.topology=e,this.sessions=[]}endAllPooledSessions(e){this.sessions.length?this.topology.endSessions(this.sessions.map(e=>e.id),()=>{this.sessions=[],"function"==typeof e&&e()}):"function"==typeof e&&e()}acquire(){const e=this.topology.logicalSessionTimeoutMinutes;for(;this.sessions.length;){const t=this.sessions.shift();if(!t.hasTimedOut(e))return t}return new M}release(e){const t=this.topology.logicalSessionTimeoutMinutes;for(;this.sessions.length;){if(!this.sessions[this.sessions.length-1].hasTimedOut(t))break;this.sessions.pop()}if(!e.hasTimedOut(t)){if(e.isDirty)return;this.sessions.unshift(e)}}}function j(e,t){return!!(e.aggregate||e.count||e.distinct||e.find||e.parallelCollectionScan||e.geoNear||e.geoSearch)||!(!(e.mapReduce&&t&&t.out)||1!==t.out.inline&&"inline"!==t.out)}e.exports={ClientSession:C,ServerSession:M,ServerSessionPool:R,TxnState:d,applySession:function(e,t,n){if(e.hasEnded)return new c("Cannot use a session that has ended");if(n&&n.writeConcern&&0===n.writeConcern.w)return;const r=e.serverSession;r.lastUse=w(),t.lsid=r.id;const o=e.inTransaction()||y(t),s=n.willRetryWrite,a=j(t,n);if(r.txnNumber&&(s||o)&&(t.txnNumber=i.Long.fromNumber(r.txnNumber)),!o)return e.transaction.state!==d.NO_TRANSACTION&&e.transaction.transition(d.NO_TRANSACTION),void(e.supports.causalConsistency&&e.operationTime&&a&&(t.readConcern=t.readConcern||{},Object.assign(t.readConcern,{afterClusterTime:e.operationTime})));if(n.readPreference&&!n.readPreference.equals(m.primary))return new c(`Read preference in a transaction must be primary, not: ${n.readPreference.mode}`);if(t.autocommit=!1,e.transaction.state===d.STARTING_TRANSACTION){e.transaction.transition(d.TRANSACTION_IN_PROGRESS),t.startTransaction=!0;const n=e.transaction.options.readConcern||e.clientOptions.readConcern;n&&(t.readConcern=n),e.supports.causalConsistency&&e.operationTime&&(t.readConcern=t.readConcern||{},Object.assign(t.readConcern,{afterClusterTime:e.operationTime}))}},updateSessionFromResponse:function(e,t){t.$clusterTime&&b(e,t.$clusterTime),t.operationTime&&e&&e.supports.causalConsistency&&e.advanceOperationTime(t.operationTime),t.recoveryToken&&e&&e.inTransaction()&&(e.transaction._recoveryToken=t.recoveryToken)},commandSupportsReadConcern:j}},function(e,t,n){"use strict";const r=n(8),o=n(2).MongoError,i=n(5).format,s=n(2).ReadPreference,a=n(2).Sessions.ClientSession;var c=function(e,t){var n=this;t=t||{force:!1,bufferMaxEntries:-1},this.s={storedOps:[],storeOptions:t,topology:e},Object.defineProperty(this,"length",{enumerable:!0,get:function(){return n.s.storedOps.length}})};c.prototype.add=function(e,t,n,r,s){if(this.s.storeOptions.force)return s(o.create({message:"db closed by application",driver:!0}));if(0===this.s.storeOptions.bufferMaxEntries)return s(o.create({message:i("no connection available for operation and number of stored operation > %s",this.s.storeOptions.bufferMaxEntries),driver:!0}));if(this.s.storeOptions.bufferMaxEntries>0&&this.s.storedOps.length>this.s.storeOptions.bufferMaxEntries)for(;this.s.storedOps.length>0;){this.s.storedOps.shift().c(o.create({message:i("no connection available for operation and number of stored operation > %s",this.s.storeOptions.bufferMaxEntries),driver:!0}))}else this.s.storedOps.push({t:e,n:t,o:n,op:r,c:s})},c.prototype.addObjectAndMethod=function(e,t,n,r,s){if(this.s.storeOptions.force)return s(o.create({message:"db closed by application",driver:!0}));if(0===this.s.storeOptions.bufferMaxEntries)return s(o.create({message:i("no connection available for operation and number of stored operation > %s",this.s.storeOptions.bufferMaxEntries),driver:!0}));if(this.s.storeOptions.bufferMaxEntries>0&&this.s.storedOps.length>this.s.storeOptions.bufferMaxEntries)for(;this.s.storedOps.length>0;){this.s.storedOps.shift().c(o.create({message:i("no connection available for operation and number of stored operation > %s",this.s.storeOptions.bufferMaxEntries),driver:!0}))}else this.s.storedOps.push({t:e,m:n,o:t,p:r,c:s})},c.prototype.flush=function(e){for(;this.s.storedOps.length>0;)this.s.storedOps.shift().c(e||o.create({message:i("no connection available for operation"),driver:!0}))};var u=["primary","primaryPreferred","nearest","secondaryPreferred"],l=["secondary","secondaryPreferred"];c.prototype.execute=function(e){e=e||{};var t=this.s.storedOps;this.s.storedOps=[];for(var n="boolean"!=typeof e.executePrimary||e.executePrimary,r="boolean"!=typeof e.executeSecondary||e.executeSecondary;t.length>0;){var o=t.shift();"cursor"===o.t?n&&r?o.o[o.m].apply(o.o,o.p):n&&o.o.options&&o.o.options.readPreference&&-1!==u.indexOf(o.o.options.readPreference.mode)?o.o[o.m].apply(o.o,o.p):!n&&r&&o.o.options&&o.o.options.readPreference&&-1!==l.indexOf(o.o.options.readPreference.mode)&&o.o[o.m].apply(o.o,o.p):"auth"===o.t?this.s.topology[o.t].apply(this.s.topology,o.o):n&&r?this.s.topology[o.t](o.n,o.o,o.op,o.c):n&&o.op&&o.op.readPreference&&-1!==u.indexOf(o.op.readPreference.mode)?this.s.topology[o.t](o.n,o.o,o.op,o.c):!n&&r&&o.op&&o.op.readPreference&&-1!==l.indexOf(o.op.readPreference.mode)&&this.s.topology[o.t](o.n,o.o,o.op,o.c)}},c.prototype.all=function(){return this.s.storedOps};var f=function(e){var t=function(e,t,n){Object.defineProperty(e,t,{enumerable:!0,get:function(){return n}})},n=!1,r=!1,o=!1,i=!1,s=!1,a=!1,c=e.maxWriteBatchSize||1e3,u=!1,l=!1;e.minWireVersion>=0&&(o=!0),e.maxWireVersion>=1&&(n=!0,i=!0),e.maxWireVersion>=2&&(r=!0),e.maxWireVersion>=3&&(s=!0,a=!0),e.maxWireVersion>=5&&(u=!0,l=!0),null==e.minWireVersion&&(e.minWireVersion=0),null==e.maxWireVersion&&(e.maxWireVersion=0),t(this,"hasAggregationCursor",n),t(this,"hasWriteCommands",r),t(this,"hasTextSearch",o),t(this,"hasAuthCommands",i),t(this,"hasListCollectionsCommand",s),t(this,"hasListIndexesCommand",a),t(this,"minWireVersion",e.minWireVersion),t(this,"maxWireVersion",e.maxWireVersion),t(this,"maxNumberOfDocsInBatch",c),t(this,"commandsTakeWriteConcern",u),t(this,"commandsTakeCollation",l)};class p extends r{constructor(){super(),this.setMaxListeners(1/0)}hasSessionSupport(){return null!=this.logicalSessionTimeoutMinutes}startSession(e,t){const n=new a(this,this.s.sessionPool,e,t);return n.once("ended",()=>{this.s.sessions.delete(n)}),this.s.sessions.add(n),n}endSessions(e,t){return this.s.coreTopology.endSessions(e,t)}get clientMetadata(){return this.s.coreTopology.s.options.metadata}capabilities(){return this.s.sCapabilities?this.s.sCapabilities:null==this.s.coreTopology.lastIsMaster()?null:(this.s.sCapabilities=new f(this.s.coreTopology.lastIsMaster()),this.s.sCapabilities)}command(e,t,n,r){this.s.coreTopology.command(e.toString(),t,s.translate(n),r)}insert(e,t,n,r){this.s.coreTopology.insert(e.toString(),t,n,r)}update(e,t,n,r){this.s.coreTopology.update(e.toString(),t,n,r)}remove(e,t,n,r){this.s.coreTopology.remove(e.toString(),t,n,r)}isConnected(e){return e=e||{},e=s.translate(e),this.s.coreTopology.isConnected(e)}isDestroyed(){return this.s.coreTopology.isDestroyed()}cursor(e,t,n){return n=n||{},(n=s.translate(n)).disconnectHandler=this.s.store,n.topology=this,this.s.coreTopology.cursor(e,t,n)}lastIsMaster(){return this.s.coreTopology.lastIsMaster()}selectServer(e,t,n){return this.s.coreTopology.selectServer(e,t,n)}unref(){return this.s.coreTopology.unref()}connections(){return this.s.coreTopology.connections()}close(e,t){this.s.sessions.forEach(e=>e.endSession()),this.s.sessionPool&&this.s.sessionPool.endAllPooledSessions(),!0===e&&(this.s.storeOptions.force=e,this.s.store.flush()),this.s.coreTopology.destroy({force:"boolean"==typeof e&&e},t)}}Object.defineProperty(p.prototype,"bson",{enumerable:!0,get:function(){return this.s.coreTopology.s.bson}}),Object.defineProperty(p.prototype,"parserType",{enumerable:!0,get:function(){return this.s.coreTopology.parserType}}),Object.defineProperty(p.prototype,"logicalSessionTimeoutMinutes",{enumerable:!0,get:function(){return this.s.coreTopology.logicalSessionTimeoutMinutes}}),Object.defineProperty(p.prototype,"type",{enumerable:!0,get:function(){return this.s.coreTopology.type}}),t.Store=c,t.ServerCapabilities=f,t.TopologyBase=p},function(e,t,n){var r=n(19).Symbol;e.exports=r},function(e,t){e.exports=function(e){return function(t){return e(t)}}},function(e,t,n){var r=n(148),o=n(110);e.exports=function(e){return null!=e&&o(e.length)&&!r(e)}},function(e,t,n){var r=n(12),o=n(117),i=n(297),s=n(40);e.exports=function(e,t){return r(e)?e:o(e,t)?[e]:i(s(e))}},function(e,t,n){var r=n(300);e.exports=function(e){return null==e?"":r(e)}},function(e,t,n){var r=n(71);e.exports=function(e){if("string"==typeof e||r(e))return e;var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}},function(e,t,n){"use strict";const r=n(2),o=n(447),i=n(59).connect;i.MongoError=r.MongoError,i.MongoNetworkError=r.MongoNetworkError,i.MongoTimeoutError=r.MongoTimeoutError,i.MongoServerSelectionError=r.MongoServerSelectionError,i.MongoParseError=r.MongoParseError,i.MongoWriteConcernError=r.MongoWriteConcernError,i.MongoBulkWriteError=n(141).BulkWriteError,i.BulkWriteError=i.MongoBulkWriteError,i.Admin=n(218),i.MongoClient=n(59),i.Db=n(98),i.Collection=n(61),i.Server=n(99),i.ReplSet=n(222),i.Mongos=n(221),i.ReadPreference=r.ReadPreference,i.GridStore=n(491),i.Chunk=n(227),i.Logger=r.Logger,i.AggregationCursor=n(142),i.CommandCursor=n(143),i.Cursor=n(26),i.GridFSBucket=n(492),i.CoreServer=r.Server,i.CoreConnection=r.Connection,i.Binary=r.BSON.Binary,i.Code=r.BSON.Code,i.Map=r.BSON.Map,i.DBRef=r.BSON.DBRef,i.Double=r.BSON.Double,i.Int32=r.BSON.Int32,i.Long=r.BSON.Long,i.MinKey=r.BSON.MinKey,i.MaxKey=r.BSON.MaxKey,i.ObjectID=r.BSON.ObjectID,i.ObjectId=r.BSON.ObjectID,i.Symbol=r.BSON.Symbol,i.Timestamp=r.BSON.Timestamp,i.BSONRegExp=r.BSON.BSONRegExp,i.Decimal128=r.BSON.Decimal128,i.connect=i,i.instrument=function(e,t){"function"==typeof e&&(t=e,e={});const n=new o;return n.instrument(i.MongoClient,t),n},e.exports=i},function(e,t){function n(e,t){if(!(this instanceof n))return new n(e,t);this._bsontype="Long",this.low_=0|e,this.high_=0|t}n.prototype.toInt=function(){return this.low_},n.prototype.toNumber=function(){return this.high_*n.TWO_PWR_32_DBL_+this.getLowBitsUnsigned()},n.prototype.toBigInt=function(){return BigInt(this.toString())},n.prototype.toJSON=function(){return this.toString()},n.prototype.toString=function(e){var t=e||10;if(t<2||36<t)throw Error("radix out of range: "+t);if(this.isZero())return"0";if(this.isNegative()){if(this.equals(n.MIN_VALUE)){var r=n.fromNumber(t),o=this.div(r),i=o.multiply(r).subtract(this);return o.toString(t)+i.toInt().toString(t)}return"-"+this.negate().toString(t)}var s=n.fromNumber(Math.pow(t,6));i=this;for(var a="";!i.isZero();){var c=i.div(s),u=i.subtract(c.multiply(s)).toInt().toString(t);if((i=c).isZero())return u+a;for(;u.length<6;)u="0"+u;a=""+u+a}},n.prototype.getHighBits=function(){return this.high_},n.prototype.getLowBits=function(){return this.low_},n.prototype.getLowBitsUnsigned=function(){return this.low_>=0?this.low_:n.TWO_PWR_32_DBL_+this.low_},n.prototype.getNumBitsAbs=function(){if(this.isNegative())return this.equals(n.MIN_VALUE)?64:this.negate().getNumBitsAbs();for(var e=0!==this.high_?this.high_:this.low_,t=31;t>0&&0==(e&1<<t);t--);return 0!==this.high_?t+33:t+1},n.prototype.isZero=function(){return 0===this.high_&&0===this.low_},n.prototype.isNegative=function(){return this.high_<0},n.prototype.isOdd=function(){return 1==(1&this.low_)},n.prototype.equals=function(e){return this.high_===e.high_&&this.low_===e.low_},n.prototype.notEquals=function(e){return this.high_!==e.high_||this.low_!==e.low_},n.prototype.lessThan=function(e){return this.compare(e)<0},n.prototype.lessThanOrEqual=function(e){return this.compare(e)<=0},n.prototype.greaterThan=function(e){return this.compare(e)>0},n.prototype.greaterThanOrEqual=function(e){return this.compare(e)>=0},n.prototype.compare=function(e){if(this.equals(e))return 0;var t=this.isNegative(),n=e.isNegative();return t&&!n?-1:!t&&n?1:this.subtract(e).isNegative()?-1:1},n.prototype.negate=function(){return this.equals(n.MIN_VALUE)?n.MIN_VALUE:this.not().add(n.ONE)},n.prototype.add=function(e){var t=this.high_>>>16,r=65535&this.high_,o=this.low_>>>16,i=65535&this.low_,s=e.high_>>>16,a=65535&e.high_,c=e.low_>>>16,u=0,l=0,f=0,p=0;return f+=(p+=i+(65535&e.low_))>>>16,p&=65535,l+=(f+=o+c)>>>16,f&=65535,u+=(l+=r+a)>>>16,l&=65535,u+=t+s,u&=65535,n.fromBits(f<<16|p,u<<16|l)},n.prototype.subtract=function(e){return this.add(e.negate())},n.prototype.multiply=function(e){if(this.isZero())return n.ZERO;if(e.isZero())return n.ZERO;if(this.equals(n.MIN_VALUE))return e.isOdd()?n.MIN_VALUE:n.ZERO;if(e.equals(n.MIN_VALUE))return this.isOdd()?n.MIN_VALUE:n.ZERO;if(this.isNegative())return e.isNegative()?this.negate().multiply(e.negate()):this.negate().multiply(e).negate();if(e.isNegative())return this.multiply(e.negate()).negate();if(this.lessThan(n.TWO_PWR_24_)&&e.lessThan(n.TWO_PWR_24_))return n.fromNumber(this.toNumber()*e.toNumber());var t=this.high_>>>16,r=65535&this.high_,o=this.low_>>>16,i=65535&this.low_,s=e.high_>>>16,a=65535&e.high_,c=e.low_>>>16,u=65535&e.low_,l=0,f=0,p=0,d=0;return p+=(d+=i*u)>>>16,d&=65535,f+=(p+=o*u)>>>16,p&=65535,f+=(p+=i*c)>>>16,p&=65535,l+=(f+=r*u)>>>16,f&=65535,l+=(f+=o*c)>>>16,f&=65535,l+=(f+=i*a)>>>16,f&=65535,l+=t*u+r*c+o*a+i*s,l&=65535,n.fromBits(p<<16|d,l<<16|f)},n.prototype.div=function(e){if(e.isZero())throw Error("division by zero");if(this.isZero())return n.ZERO;if(this.equals(n.MIN_VALUE)){if(e.equals(n.ONE)||e.equals(n.NEG_ONE))return n.MIN_VALUE;if(e.equals(n.MIN_VALUE))return n.ONE;var t=this.shiftRight(1).div(e).shiftLeft(1);if(t.equals(n.ZERO))return e.isNegative()?n.ONE:n.NEG_ONE;var r=this.subtract(e.multiply(t));return t.add(r.div(e))}if(e.equals(n.MIN_VALUE))return n.ZERO;if(this.isNegative())return e.isNegative()?this.negate().div(e.negate()):this.negate().div(e).negate();if(e.isNegative())return this.div(e.negate()).negate();var o=n.ZERO;for(r=this;r.greaterThanOrEqual(e);){t=Math.max(1,Math.floor(r.toNumber()/e.toNumber()));for(var i=Math.ceil(Math.log(t)/Math.LN2),s=i<=48?1:Math.pow(2,i-48),a=n.fromNumber(t),c=a.multiply(e);c.isNegative()||c.greaterThan(r);)t-=s,c=(a=n.fromNumber(t)).multiply(e);a.isZero()&&(a=n.ONE),o=o.add(a),r=r.subtract(c)}return o},n.prototype.modulo=function(e){return this.subtract(this.div(e).multiply(e))},n.prototype.not=function(){return n.fromBits(~this.low_,~this.high_)},n.prototype.and=function(e){return n.fromBits(this.low_&e.low_,this.high_&e.high_)},n.prototype.or=function(e){return n.fromBits(this.low_|e.low_,this.high_|e.high_)},n.prototype.xor=function(e){return n.fromBits(this.low_^e.low_,this.high_^e.high_)},n.prototype.shiftLeft=function(e){if(0===(e&=63))return this;var t=this.low_;if(e<32){var r=this.high_;return n.fromBits(t<<e,r<<e|t>>>32-e)}return n.fromBits(0,t<<e-32)},n.prototype.shiftRight=function(e){if(0===(e&=63))return this;var t=this.high_;if(e<32){var r=this.low_;return n.fromBits(r>>>e|t<<32-e,t>>e)}return n.fromBits(t>>e-32,t>=0?0:-1)},n.prototype.shiftRightUnsigned=function(e){if(0===(e&=63))return this;var t=this.high_;if(e<32){var r=this.low_;return n.fromBits(r>>>e|t<<32-e,t>>>e)}return 32===e?n.fromBits(t,0):n.fromBits(t>>>e-32,0)},n.fromInt=function(e){if(-128<=e&&e<128){var t=n.INT_CACHE_[e];if(t)return t}var r=new n(0|e,e<0?-1:0);return-128<=e&&e<128&&(n.INT_CACHE_[e]=r),r},n.fromNumber=function(e){return isNaN(e)||!isFinite(e)?n.ZERO:e<=-n.TWO_PWR_63_DBL_?n.MIN_VALUE:e+1>=n.TWO_PWR_63_DBL_?n.MAX_VALUE:e<0?n.fromNumber(-e).negate():new n(e%n.TWO_PWR_32_DBL_|0,e/n.TWO_PWR_32_DBL_|0)},n.fromBigInt=function(e){return n.fromString(e.toString(10),10)},n.fromBits=function(e,t){return new n(e,t)},n.fromString=function(e,t){if(0===e.length)throw Error("number format error: empty string");var r=t||10;if(r<2||36<r)throw Error("radix out of range: "+r);if("-"===e.charAt(0))return n.fromString(e.substring(1),r).negate();if(e.indexOf("-")>=0)throw Error('number format error: interior "-" character: '+e);for(var o=n.fromNumber(Math.pow(r,8)),i=n.ZERO,s=0;s<e.length;s+=8){var a=Math.min(8,e.length-s),c=parseInt(e.substring(s,s+a),r);if(a<8){var u=n.fromNumber(Math.pow(r,a));i=i.multiply(u).add(n.fromNumber(c))}else i=(i=i.multiply(o)).add(n.fromNumber(c))}return i},n.INT_CACHE_={},n.TWO_PWR_16_DBL_=65536,n.TWO_PWR_24_DBL_=1<<24,n.TWO_PWR_32_DBL_=n.TWO_PWR_16_DBL_*n.TWO_PWR_16_DBL_,n.TWO_PWR_31_DBL_=n.TWO_PWR_32_DBL_/2,n.TWO_PWR_48_DBL_=n.TWO_PWR_32_DBL_*n.TWO_PWR_16_DBL_,n.TWO_PWR_64_DBL_=n.TWO_PWR_32_DBL_*n.TWO_PWR_32_DBL_,n.TWO_PWR_63_DBL_=n.TWO_PWR_64_DBL_/2,n.ZERO=n.fromInt(0),n.ONE=n.fromInt(1),n.NEG_ONE=n.fromInt(-1),n.MAX_VALUE=n.fromBits(-1,2147483647),n.MIN_VALUE=n.fromBits(0,-2147483648),n.TWO_PWR_24_=n.fromInt(1<<24),e.exports=n,e.exports.Long=n},function(e,t,n){"use strict";const r=n(4).arrayStrictEqual,o=n(4).tagsStrictEqual,i=n(4).errorStrictEqual,s=n(13).ServerType,a=n(0).now,c=new Set([s.RSPrimary,s.Standalone,s.Mongos]),u=new Set([s.RSPrimary,s.RSSecondary,s.Mongos,s.Standalone]),l=["minWireVersion","maxWireVersion","maxBsonObjectSize","maxMessageSizeBytes","maxWriteBatchSize","compression","me","hosts","passives","arbiters","tags","setName","setVersion","electionId","primary","logicalSessionTimeoutMinutes","saslSupportedMechs","__nodejs_mock_server__","$clusterTime"];function f(e){return e&&e.ok?e.isreplicaset?s.RSGhost:e.msg&&"isdbgrid"===e.msg?s.Mongos:e.setName?e.hidden?s.RSOther:e.ismaster?s.RSPrimary:e.secondary?s.RSSecondary:e.arbiterOnly?s.RSArbiter:s.RSOther:s.Standalone:s.Unknown}function p(e,t){return null==e||null==t?-1:e.processId.equals(t.processId)?e.counter===t.counter?0:e.counter<t.counter?-1:1:-1}e.exports={ServerDescription:class{constructor(e,t,n){n=n||{},t=Object.assign({minWireVersion:0,maxWireVersion:0,hosts:[],passives:[],arbiters:[],tags:[]},t),this.address=e,this.error=n.error,this.roundTripTime=n.roundTripTime||-1,this.lastUpdateTime=a(),this.lastWriteDate=t.lastWrite?t.lastWrite.lastWriteDate:null,this.opTime=t.lastWrite?t.lastWrite.opTime:null,this.type=f(t),this.topologyVersion=n.topologyVersion||t.topologyVersion,l.forEach(e=>{void 0!==t[e]&&(this[e]=t[e])}),this.me&&(this.me=this.me.toLowerCase()),this.hosts=this.hosts.map(e=>e.toLowerCase()),this.passives=this.passives.map(e=>e.toLowerCase()),this.arbiters=this.arbiters.map(e=>e.toLowerCase())}get allHosts(){return this.hosts.concat(this.arbiters).concat(this.passives)}get isReadable(){return this.type===s.RSSecondary||this.isWritable}get isDataBearing(){return u.has(this.type)}get isWritable(){return c.has(this.type)}get host(){const e=`:${this.port}`.length;return this.address.slice(0,-e)}get port(){const e=this.address.split(":").pop();return e?Number.parseInt(e,10):e}equals(e){const t=this.topologyVersion===e.topologyVersion||0===p(this.topologyVersion,e.topologyVersion);return null!=e&&i(this.error,e.error)&&this.type===e.type&&this.minWireVersion===e.minWireVersion&&this.me===e.me&&r(this.hosts,e.hosts)&&o(this.tags,e.tags)&&this.setName===e.setName&&this.setVersion===e.setVersion&&(this.electionId?e.electionId&&this.electionId.equals(e.electionId):this.electionId===e.electionId)&&this.primary===e.primary&&this.logicalSessionTimeoutMinutes===e.logicalSessionTimeoutMinutes&&t}},parseServerType:f,compareTopologyVersion:p}},function(e,t,n){"use strict";const r=n(22).Buffer,o=n(6).opcodes,i=n(6).databaseNamespace,s=n(10),a=n(3).MongoError;let c=0;class u{constructor(e,t,n,r){if(null==n)throw new Error("query must be specified for query");this.bson=e,this.ns=t,this.command=n,this.command.$db=i(t),r.readPreference&&r.readPreference.mode!==s.PRIMARY&&(this.command.$readPreference=r.readPreference.toJSON()),this.options=r||{},this.requestId=r.requestId?r.requestId:u.getRequestId(),this.serializeFunctions="boolean"==typeof r.serializeFunctions&&r.serializeFunctions,this.ignoreUndefined="boolean"==typeof r.ignoreUndefined&&r.ignoreUndefined,this.checkKeys="boolean"==typeof r.checkKeys&&r.checkKeys,this.maxBsonSize=r.maxBsonSize||16777216,this.checksumPresent=!1,this.moreToCome=r.moreToCome||!1,this.exhaustAllowed="boolean"==typeof r.exhaustAllowed&&r.exhaustAllowed}toBin(){const e=[];let t=0;this.checksumPresent&&(t|=1),this.moreToCome&&(t|=2),this.exhaustAllowed&&(t|=65536);const n=r.alloc(20);e.push(n);let i=n.length;const s=this.command;return i+=this.makeDocumentSegment(e,s),n.writeInt32LE(i,0),n.writeInt32LE(this.requestId,4),n.writeInt32LE(0,8),n.writeInt32LE(o.OP_MSG,12),n.writeUInt32LE(t,16),e}makeDocumentSegment(e,t){const n=r.alloc(1);n[0]=0;const o=this.serializeBson(t);return e.push(n),e.push(o),n.length+o.length}serializeBson(e){return this.bson.serialize(e,{checkKeys:this.checkKeys,serializeFunctions:this.serializeFunctions,ignoreUndefined:this.ignoreUndefined})}}u.getRequestId=function(){return c=c+1&2147483647,c};e.exports={Msg:u,BinMsg:class{constructor(e,t,n,r,o){o=o||{promoteLongs:!0,promoteValues:!0,promoteBuffers:!1},this.parsed=!1,this.raw=t,this.data=r,this.bson=e,this.opts=o,this.length=n.length,this.requestId=n.requestId,this.responseTo=n.responseTo,this.opCode=n.opCode,this.fromCompressed=n.fromCompressed,this.responseFlags=r.readInt32LE(0),this.checksumPresent=0!=(1&this.responseFlags),this.moreToCome=0!=(2&this.responseFlags),this.exhaustAllowed=0!=(65536&this.responseFlags),this.promoteLongs="boolean"!=typeof o.promoteLongs||o.promoteLongs,this.promoteValues="boolean"!=typeof o.promoteValues||o.promoteValues,this.promoteBuffers="boolean"==typeof o.promoteBuffers&&o.promoteBuffers,this.documents=[]}isParsed(){return this.parsed}parse(e){if(this.parsed)return;e=e||{},this.index=4;const t=e.raw||!1,n=e.documentsReturnedIn||null,r={promoteLongs:"boolean"==typeof e.promoteLongs?e.promoteLongs:this.opts.promoteLongs,promoteValues:"boolean"==typeof e.promoteValues?e.promoteValues:this.opts.promoteValues,promoteBuffers:"boolean"==typeof e.promoteBuffers?e.promoteBuffers:this.opts.promoteBuffers};for(;this.index<this.data.length;){const e=this.data.readUInt8(this.index++);if(1===e)throw new a("OP_MSG Payload Type 1 detected unsupported protocol");if(0===e){const e=this.data.readUInt32LE(this.index),n=this.data.slice(this.index,this.index+e);this.documents.push(t?n:this.bson.deserialize(n,r)),this.index+=e}}if(1===this.documents.length&&null!=n&&t){const e={};e[n]=!0,r.fieldsAsRaw=e;const t=this.bson.deserialize(this.documents[0],r);this.documents=[t]}this.parsed=!0}}}},function(e,t,n){"use strict";class r{constructor(e){null!=e&&(this.level=e)}static fromOptions(e){if(null!=e)return e.readConcern?e.readConcern instanceof r?e.readConcern:new r(e.readConcern.level):e.level?new r(e.level):void 0}static get MAJORITY(){return"majority"}static get AVAILABLE(){return"available"}static get LINEARIZABLE(){return"linearizable"}static get SNAPSHOT(){return"snapshot"}}e.exports=r},function(e,t,n){"use strict";var r=n(92),o=Object.keys||function(e){var t=[];for(var n in e)t.push(n);return t};e.exports=f;var i=Object.create(n(57));i.inherits=n(58);var s=n(203),a=n(206);i.inherits(f,s);for(var c=o(a.prototype),u=0;u<c.length;u++){var l=c[u];f.prototype[l]||(f.prototype[l]=a.prototype[l])}function f(e){if(!(this instanceof f))return new f(e);s.call(this,e),a.call(this,e),e&&!1===e.readable&&(this.readable=!1),e&&!1===e.writable&&(this.writable=!1),this.allowHalfOpen=!0,e&&!1===e.allowHalfOpen&&(this.allowHalfOpen=!1),this.once("end",p)}function p(){this.allowHalfOpen||this._writableState.ended||r.nextTick(d,this)}function d(e){e.end()}Object.defineProperty(f.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(f.prototype,"destroyed",{get:function(){return void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed&&this._writableState.destroyed)},set:function(e){void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed=e,this._writableState.destroyed=e)}}),f.prototype._destroy=function(e,t){this.push(null),this.end(),r.nextTick(t,e)}},function(e,t,n){var r=n(106),o=n(107);e.exports=function(e,t,n,i){var s=!n;n||(n={});for(var a=-1,c=t.length;++a<c;){var u=t[a],l=i?i(n[u],e[u],u,n,e):void 0;void 0===l&&(l=e[u]),s?o(n,u,l):r(n,u,l)}return n}},function(e,t,n){var r=n(152),o=n(271),i=n(38);e.exports=function(e){return i(e)?r(e):o(e)}},function(e,t,n){var r=n(39),o=n(41);e.exports=function(e,t){for(var n=0,i=(t=r(t,e)).length;null!=e&&n<i;)e=e[o(t[n++])];return n&&n==i?e:void 0}},function(e,t){e.exports=function(e,t){for(var n=-1,r=null==e?0:e.length,o=Array(r);++n<r;)o[n]=t(e[n],n,e);return o}},function(e,t){e.exports=function(e){for(var t=-1,n=null==e?0:e.length,r=0,o=[];++t<n;){var i=e[t];i&&(o[r++]=i)}return o}},function(e,t,n){if("undefined"!=typeof global)var r=n(131).Buffer;var o=n(32);function i(e,t){if(!(this instanceof i))return new i(e,t);if(!(null==e||"string"==typeof e||r.isBuffer(e)||e instanceof Uint8Array||Array.isArray(e)))throw new Error("only String, Buffer, Uint8Array or Array accepted");if(this._bsontype="Binary",e instanceof Number?(this.sub_type=e,this.position=0):(this.sub_type=null==t?s:t,this.position=0),null==e||e instanceof Number)void 0!==r?this.buffer=o.allocBuffer(i.BUFFER_SIZE):"undefined"!=typeof Uint8Array?this.buffer=new Uint8Array(new ArrayBuffer(i.BUFFER_SIZE)):this.buffer=new Array(i.BUFFER_SIZE),this.position=0;else{if("string"==typeof e)if(void 0!==r)this.buffer=o.toBuffer(e);else{if("undefined"==typeof Uint8Array&&"[object Array]"!==Object.prototype.toString.call(e))throw new Error("only String, Buffer, Uint8Array or Array accepted");this.buffer=a(e)}else this.buffer=e;this.position=e.length}}i.prototype.put=function(e){if(null!=e.length&&"number"!=typeof e&&1!==e.length)throw new Error("only accepts single character String, Uint8Array or Array");if("number"!=typeof e&&e<0||e>255)throw new Error("only accepts number in a valid unsigned byte range 0-255");var t=null;if(t="string"==typeof e?e.charCodeAt(0):null!=e.length?e[0]:e,this.buffer.length>this.position)this.buffer[this.position++]=t;else if(void 0!==r&&r.isBuffer(this.buffer)){var n=o.allocBuffer(i.BUFFER_SIZE+this.buffer.length);this.buffer.copy(n,0,0,this.buffer.length),this.buffer=n,this.buffer[this.position++]=t}else{n=null,n="[object Uint8Array]"===Object.prototype.toString.call(this.buffer)?new Uint8Array(new ArrayBuffer(i.BUFFER_SIZE+this.buffer.length)):new Array(i.BUFFER_SIZE+this.buffer.length);for(var s=0;s<this.buffer.length;s++)n[s]=this.buffer[s];this.buffer=n,this.buffer[this.position++]=t}},i.prototype.write=function(e,t){if(t="number"==typeof t?t:this.position,this.buffer.length<t+e.length){var n=null;if(void 0!==r&&r.isBuffer(this.buffer))n=o.allocBuffer(this.buffer.length+e.length),this.buffer.copy(n,0,0,this.buffer.length);else if("[object Uint8Array]"===Object.prototype.toString.call(this.buffer)){n=new Uint8Array(new ArrayBuffer(this.buffer.length+e.length));for(var i=0;i<this.position;i++)n[i]=this.buffer[i]}this.buffer=n}if(void 0!==r&&r.isBuffer(e)&&r.isBuffer(this.buffer))e.copy(this.buffer,t,0,e.length),this.position=t+e.length>this.position?t+e.length:this.position;else if(void 0!==r&&"string"==typeof e&&r.isBuffer(this.buffer))this.buffer.write(e,t,"binary"),this.position=t+e.length>this.position?t+e.length:this.position;else if("[object Uint8Array]"===Object.prototype.toString.call(e)||"[object Array]"===Object.prototype.toString.call(e)&&"string"!=typeof e){for(i=0;i<e.length;i++)this.buffer[t++]=e[i];this.position=t>this.position?t:this.position}else if("string"==typeof e){for(i=0;i<e.length;i++)this.buffer[t++]=e.charCodeAt(i);this.position=t>this.position?t:this.position}},i.prototype.read=function(e,t){if(t=t&&t>0?t:this.position,this.buffer.slice)return this.buffer.slice(e,e+t);for(var n="undefined"!=typeof Uint8Array?new Uint8Array(new ArrayBuffer(t)):new Array(t),r=0;r<t;r++)n[r]=this.buffer[e++];return n},i.prototype.value=function(e){if((e=null!=e&&e)&&void 0!==r&&r.isBuffer(this.buffer)&&this.buffer.length===this.position)return this.buffer;if(void 0!==r&&r.isBuffer(this.buffer))return e?this.buffer.slice(0,this.position):this.buffer.toString("binary",0,this.position);if(e){if(null!=this.buffer.slice)return this.buffer.slice(0,this.position);for(var t="[object Uint8Array]"===Object.prototype.toString.call(this.buffer)?new Uint8Array(new ArrayBuffer(this.position)):new Array(this.position),n=0;n<this.position;n++)t[n]=this.buffer[n];return t}return c(this.buffer,0,this.position)},i.prototype.length=function(){return this.position},i.prototype.toJSON=function(){return null!=this.buffer?this.buffer.toString("base64"):""},i.prototype.toString=function(e){return null!=this.buffer?this.buffer.slice(0,this.position).toString(e):""};var s=0,a=function(e){for(var t="undefined"!=typeof Uint8Array?new Uint8Array(new ArrayBuffer(e.length)):new Array(e.length),n=0;n<e.length;n++)t[n]=e.charCodeAt(n);return t},c=function(e,t,n){for(var r="",o=t;o<n;o++)r+=String.fromCharCode(e[o]);return r};i.BUFFER_SIZE=256,i.SUBTYPE_DEFAULT=0,i.SUBTYPE_FUNCTION=1,i.SUBTYPE_BYTE_ARRAY=2,i.SUBTYPE_UUID_OLD=3,i.SUBTYPE_UUID=4,i.SUBTYPE_MD5=5,i.SUBTYPE_USER_DEFINED=128,e.exports=i,e.exports.Binary=i},function(e,t,n){"use strict";const r=n(3).MongoError,o=n(10),i=n(46),s=n(29);let a,c;a={NO_TRANSACTION:"NO_TRANSACTION",STARTING_TRANSACTION:"STARTING_TRANSACTION",TRANSACTION_IN_PROGRESS:"TRANSACTION_IN_PROGRESS",TRANSACTION_COMMITTED:"TRANSACTION_COMMITTED",TRANSACTION_COMMITTED_EMPTY:"TRANSACTION_COMMITTED_EMPTY",TRANSACTION_ABORTED:"TRANSACTION_ABORTED"},c={NO_TRANSACTION:["NO_TRANSACTION","STARTING_TRANSACTION"],STARTING_TRANSACTION:["TRANSACTION_IN_PROGRESS","TRANSACTION_COMMITTED","TRANSACTION_COMMITTED_EMPTY","TRANSACTION_ABORTED"],TRANSACTION_IN_PROGRESS:["TRANSACTION_IN_PROGRESS","TRANSACTION_COMMITTED","TRANSACTION_ABORTED"],TRANSACTION_COMMITTED:["TRANSACTION_COMMITTED","TRANSACTION_COMMITTED_EMPTY","STARTING_TRANSACTION","NO_TRANSACTION"],TRANSACTION_ABORTED:["STARTING_TRANSACTION","NO_TRANSACTION"],TRANSACTION_COMMITTED_EMPTY:["TRANSACTION_COMMITTED_EMPTY","NO_TRANSACTION"]};e.exports={TxnState:a,Transaction:class{constructor(e){e=e||{},this.state=a.NO_TRANSACTION,this.options={};const t=s.fromOptions(e);if(t){if(t.w<=0)throw new r("Transactions do not support unacknowledged write concern");this.options.writeConcern=t}e.readConcern&&(this.options.readConcern=i.fromOptions(e)),e.readPreference&&(this.options.readPreference=o.fromOptions(e)),e.maxCommitTimeMS&&(this.options.maxTimeMS=e.maxCommitTimeMS),this._pinnedServer=void 0,this._recoveryToken=void 0}get server(){return this._pinnedServer}get recoveryToken(){return this._recoveryToken}get isPinned(){return!!this.server}get isActive(){return-1!==[a.STARTING_TRANSACTION,a.TRANSACTION_IN_PROGRESS].indexOf(this.state)}transition(e){const t=c[this.state];if(t&&-1!==t.indexOf(e))return this.state=e,void(this.state!==a.NO_TRANSACTION&&this.state!==a.STARTING_TRANSACTION||this.unpinServer());throw new r(`Attempted illegal state transition from [${this.state}] to [${e}]`)}pinServer(e){this.isActive&&(this._pinnedServer=e)}unpinServer(){this._pinnedServer=void 0}},isTransactionCommand:function(e){return!(!e.commitTransaction&&!e.abortTransaction)}}},function(e,t,n){"use strict";const r=n(21).Query,o=n(45).Msg,i=n(3).MongoError,s=n(6).getReadPreference,a=n(6).isSharded,c=n(6).databaseNamespace,u=n(54).isTransactionCommand,l=n(34).applySession,f=n(3).MongoNetworkError,p=n(4).maxWireVersion;function d(e,t,n,p,d){const h=e.s.bson,m=e.s.pool,g=s(n,p),y=function(e){const t=e.ismaster?e.ismaster:e.description;if(null==t)return!1;return t.maxWireVersion>=6&&null==t.__nodejs_mock_server__}(e),b=p.session;let v=e.clusterTime,S=Object.assign({},n);if(function(e){if(null==e)return!1;if(e.description)return e.description.maxWireVersion>=6;return null!=e.ismaster&&e.ismaster.maxWireVersion>=6}(e)&&b){b.clusterTime&&b.clusterTime.clusterTime.greaterThan(v.clusterTime)&&(v=b.clusterTime);const e=l(b,S,p);if(e)return d(e)}v&&(S.$clusterTime=v),a(e)&&!y&&g&&"primary"!==g.mode&&(S={$query:S,$readPreference:g.toJSON()});const w=Object.assign({command:!0,numberToSkip:0,numberToReturn:-1,checkKeys:!1},p);w.slaveOk=g.slaveOk();const _=`${c(t)}.$cmd`,O=y?new o(h,_,S,w):new r(h,_,S,w),T=b&&(b.inTransaction()||u(S))?function(e){return e&&e instanceof f&&!e.hasErrorLabel("TransientTransactionError")&&e.addErrorLabel("TransientTransactionError"),!n.commitTransaction&&e&&e instanceof i&&e.hasErrorLabel("TransientTransactionError")&&b.transaction.unpinServer(),d.apply(null,arguments)}:d;try{m.write(O,w,T)}catch(e){T(e)}}e.exports=function(e,t,n,r,o){if("function"==typeof r&&(o=r,r={}),r=r||{},null==n)return o(new i(`command ${JSON.stringify(n)} does not return a cursor`));if(!function(e){return p(e)&&e.autoEncrypter}(e))return void d(e,t,n,r,o);const s=p(e);"number"!=typeof s||s<8?o(new i("Auto-encryption requires a minimum MongoDB version of 4.2")):function(e,t,n,r,o){const i=e.autoEncrypter;function s(e,t){e||null==t?o(e,t):i.decrypt(t.result,r,(e,n)=>{e?o(e,null):(t.result=n,t.message.documents=[n],o(null,t))})}i.encrypt(t,n,r,(n,i)=>{n?o(n,null):d(e,t,i,r,s)})}(e,t,n,r,o)}},function(e,t,n){"use strict";const r=n(0).maybePromise,o=n(3).MongoError,i=n(1).Aspect,s=n(1).OperationBase,a=n(10),c=n(3).isRetryableError,u=n(4).maxWireVersion,l=n(4).isUnifiedTopology;function f(e,t,n){if(null==e)throw new TypeError("This method requires a valid topology instance");if(!(t instanceof s))throw new TypeError("This method requires a valid operation instance");return r(e,n,n=>{if(l(e)&&e.shouldCheckForSessionSupport())return function(e,t,n){e.selectServer(a.primaryPreferred,r=>{if(r)return n(r);f(e,t,n)})}(e,t,n);let r,s;if(e.hasSessionSupport()){if(null==t.session)s=Symbol(),r=e.startSession({owner:s}),t.session=r;else if(t.session.hasEnded)return n(new o("Use of expired sessions is not permitted"))}else if(t.session)return n(new o("Current topology does not support sessions"));function u(e,o){r&&r.owner===s&&(r.endSession(),t.session===r&&t.clearSession()),n(e,o)}try{t.hasAspect(i.EXECUTE_WITH_SELECTION)?function(e,t,n){const r=t.readPreference||a.primary,s=t.session&&t.session.inTransaction();if(s&&!r.equals(a.primary))return void n(new o(`Read preference in a transaction must be primary, not: ${r.mode}`));const u={readPreference:r,session:t.session};function l(r,o){return null==r?n(null,o):c(r)?void e.selectServer(u,(e,r)=>{!e&&p(r)?t.execute(r,n):n(e,null)}):n(r)}e.selectServer(u,(r,o)=>{if(r)return void n(r,null);const a=!1!==e.s.options.retryReads&&t.session&&!s&&p(o)&&t.canRetryRead;t.hasAspect(i.RETRYABLE)&&a?t.execute(o,l):t.execute(o,n)})}(e,t,u):t.execute(u)}catch(e){r&&r.owner===s&&(r.endSession(),t.session===r&&t.clearSession()),n(e)}})}function p(e){return u(e)>=6}e.exports=f},function(e,t){function n(e){return Object.prototype.toString.call(e)}t.isArray=function(e){return Array.isArray?Array.isArray(e):"[object Array]"===n(e)},t.isBoolean=function(e){return"boolean"==typeof e},t.isNull=function(e){return null===e},t.isNullOrUndefined=function(e){return null==e},t.isNumber=function(e){return"number"==typeof e},t.isString=function(e){return"string"==typeof e},t.isSymbol=function(e){return"symbol"==typeof e},t.isUndefined=function(e){return void 0===e},t.isRegExp=function(e){return"[object RegExp]"===n(e)},t.isObject=function(e){return"object"==typeof e&&null!==e},t.isDate=function(e){return"[object Date]"===n(e)},t.isError=function(e){return"[object Error]"===n(e)||e instanceof Error},t.isFunction=function(e){return"function"==typeof e},t.isPrimitive=function(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||void 0===e},t.isBuffer=Buffer.isBuffer},function(e,t,n){try{var r=n(5);if("function"!=typeof r.inherits)throw"";e.exports=r.inherits}catch(t){e.exports=n(437)}},function(e,t,n){"use strict";const r=n(139),o=n(98),i=n(8).EventEmitter,s=n(5).inherits,a=n(2).MongoError,c=n(5).deprecate,u=n(29),l=n(0).MongoDBNamespace,f=n(10),p=n(0).maybePromise,d=n(219),h=n(220).connect,m=n(220).validOptions;function g(e,t){if(!(this instanceof g))return new g(e,t);i.call(this),t&&t.autoEncryption&&n(223),this.s={url:e,options:t||{},promiseLibrary:t&&t.promiseLibrary||Promise,dbCache:new Map,sessions:new Set,writeConcern:u.fromOptions(t),readPreference:f.fromOptions(t)||f.primary,namespace:new l("admin")}}s(g,i),Object.defineProperty(g.prototype,"writeConcern",{enumerable:!0,get:function(){return this.s.writeConcern}}),Object.defineProperty(g.prototype,"readPreference",{enumerable:!0,get:function(){return this.s.readPreference}}),g.prototype.connect=function(e){if("string"==typeof e)throw new TypeError("`connect` only accepts a callback");const t=this;return p(this,e,e=>{const n=m(t.s.options);if(n)return e(n);h(t,t.s.url,t.s.options,n=>{if(n)return e(n);e(null,t)})})},g.prototype.logout=c((function(e,t){"function"==typeof e&&(t=e,e={}),"function"==typeof t&&t(null,!0)}),"Multiple authentication is prohibited on a connected client, please only authenticate once per MongoClient"),g.prototype.close=function(e,t){"function"==typeof e&&(t=e,e=!1);const n=this;return p(this,t,t=>{const r=e=>{if(n.emit("close",n),!(n.topology instanceof d))for(const e of n.s.dbCache)e[1].emit("close",n);n.removeAllListeners("close"),t(e)};null!=n.topology?n.topology.close(e,t=>{const o=n.topology.s.options.encrypter;if(o)return o.close(n,e,e=>{r(t||e)});r(t)}):r()})},g.prototype.db=function(e,t){t=t||{},e||(e=this.s.options.dbName);const n=Object.assign({},this.s.options,t);if(this.s.dbCache.has(e)&&!0!==n.returnNonCachedInstance)return this.s.dbCache.get(e);if(n.promiseLibrary=this.s.promiseLibrary,!this.topology)throw new a("MongoClient must be connected before calling MongoClient.prototype.db");const r=new o(e,this.topology,n);return this.s.dbCache.set(e,r),r},g.prototype.isConnected=function(e){return e=e||{},!!this.topology&&this.topology.isConnected(e)},g.connect=function(e,t,n){const r=Array.prototype.slice.call(arguments,1);n="function"==typeof r[r.length-1]?r.pop():void 0;const o=new g(e,t=(t=r.length?r.shift():null)||{});return o.connect(n)},g.prototype.startSession=function(e){if(e=Object.assign({explicit:!0},e),!this.topology)throw new a("Must connect to a server before calling this method");return this.topology.startSession(e,this.s.options)},g.prototype.withSession=function(e,t){"function"==typeof e&&(t=e,e=void 0);const n=this.startSession(e);let r=(e,t,o)=>{if(r=()=>{throw new ReferenceError("cleanupHandler was called too many times")},o=Object.assign({throw:!0},o),n.endSession(),e){if(o.throw)throw e;return Promise.reject(e)}};try{const e=t(n);return Promise.resolve(e).then(e=>r(null,e)).catch(e=>r(e,null,{throw:!0}))}catch(e){return r(e,null,{throw:!1})}},g.prototype.watch=function(e,t){return e=e||[],t=t||{},Array.isArray(e)||(t=e,e=[]),new r(this,e,t)},g.prototype.getLogger=function(){return this.s.options.logger},e.exports=g},function(e,t,n){"use strict";const r=n(0).applyWriteConcern,o=n(2).BSON.Code,i=n(11).createIndex,s=n(0).decorateWithCollation,a=n(0).decorateWithReadConcern,c=n(11).ensureIndex,u=n(11).evaluate,l=n(11).executeCommand,f=n(0).handleCallback,p=n(11).indexInformation,d=n(2).BSON.Long,h=n(2).MongoError,m=n(2).ReadPreference,g=n(14).insertDocuments,y=n(14).updateDocuments;function b(e,t,n){p(e.s.db,e.collectionName,t,n)}e.exports={createIndex:function(e,t,n,r){i(e.s.db,e.collectionName,t,n,r)},createIndexes:function(e,t,n,r){const o=e.s.topology.capabilities();for(let e=0;e<t.length;e++)if(null==t[e].name){const n=[];if(t[e].collation&&o&&!o.commandsTakeCollation)return r(new h("server/primary/mongos does not support collation"));for(let r in t[e].key)n.push(`${r}_${t[e].key[r]}`);t[e].name=n.join("_")}n=Object.assign({},n,{readPreference:m.PRIMARY}),l(e.s.db,{createIndexes:e.collectionName,indexes:t},n,r)},ensureIndex:function(e,t,n,r){c(e.s.db,e.collectionName,t,n,r)},group:function(e,t,n,r,i,c,p,d,h){if(p){const u=i&&"Code"===i._bsontype?i:new o(i),p={group:{ns:e.collectionName,$reduce:u,cond:n,initial:r,out:"inline"}};if(null!=c&&(p.group.finalize=c),"function"==typeof t||t&&"Code"===t._bsontype)p.group.$keyf=t&&"Code"===t._bsontype?t:new o(t);else{const e={};t.forEach(t=>{e[t]=1}),p.group.key=e}(d=Object.assign({},d)).readPreference=m.resolve(e,d),a(p,e,d);try{s(p,e,d)}catch(e){return h(e,null)}l(e.s.db,p,d,(e,t)=>{if(e)return f(h,e,null);f(h,null,t.retval)})}else{const s=null!=i&&"Code"===i._bsontype?i.scope:{};s.ns=e.collectionName,s.keys=t,s.condition=n,s.initial=r;const a='function () {\nvar c = db[ns].find(condition);\nvar map = new Map();\nvar reduce_function = reduce;\n\nwhile (c.hasNext()) {\nvar obj = c.next();\nvar key = {};\n\nfor (var i = 0, len = keys.length; i < len; ++i) {\nvar k = keys[i];\nkey[k] = obj[k];\n}\n\nvar aggObj = map.get(key);\n\nif (aggObj == null) {\nvar newObj = Object.extend({}, key);\naggObj = Object.extend(newObj, initial);\nmap.put(key, aggObj);\n}\n\nreduce_function(obj, aggObj);\n}\n\nreturn { "result": map.values() };\n}'.replace(/ reduce;/,i.toString()+";");u(e.s.db,new o(a,s),null,d,(e,t)=>{if(e)return f(h,e,null);f(h,null,t.result||t)})}},indexes:function(e,t,n){t=Object.assign({},{full:!0},t),p(e.s.db,e.collectionName,t,n)},indexExists:function(e,t,n,r){b(e,n,(e,n)=>{if(null!=e)return f(r,e,null);if(!Array.isArray(t))return f(r,null,null!=n[t]);for(let e=0;e<t.length;e++)if(null==n[t[e]])return f(r,null,!1);return f(r,null,!0)})},indexInformation:b,parallelCollectionScan:function(e,t,n){const r={parallelCollectionScan:e.collectionName,numCursors:t.numCursors};a(r,e,t);const o=t.raw;delete t.raw,l(e.s.db,r,t,(r,i)=>{if(r)return f(n,r,null);if(null==i)return f(n,new Error("no result returned for parallelCollectionScan"),null);t=Object.assign({explicitlyIgnoreSession:!0},t);const s=[];o&&(t.raw=o);for(let n=0;n<i.cursors.length;n++){const r=i.cursors[n].cursor.id,o="number"==typeof r?d.fromNumber(r):r;s.push(e.s.topology.cursor(e.namespace,o,t))}f(n,null,s)})},save:function(e,t,n,o){const i=r(Object.assign({},n),{db:e.s.db,collection:e},n);if(null!=t._id)return i.upsert=!0,y(e,{_id:t._id},t,i,o);g(e,[t],i,(e,n)=>{if(null!=o)return null==t?f(o,null,null):e?f(o,e,null):void f(o,null,n)})}}},function(e,t,n){"use strict";const r=n(5).deprecate,o=n(0).deprecateOptions,i=n(0).emitWarningOnce,s=n(0).checkCollectionName,a=n(2).BSON.ObjectID,c=n(2).MongoError,u=n(0).normalizeHintField,l=n(0).decorateCommand,f=n(0).decorateWithCollation,p=n(0).decorateWithReadConcern,d=n(0).formattedOrderClause,h=n(2).ReadPreference,m=n(450),g=n(451),y=n(139),b=n(0).executeLegacyOperation,v=n(29),S=n(46),w=n(0).MongoDBNamespace,_=n(142),O=n(143),T=n(60).ensureIndex,C=n(60).group,x=n(60).parallelCollectionScan,E=n(14).removeDocuments,N=n(60).save,I=n(14).updateDocuments,A=n(96),k=n(209),M=n(452),R=n(210),j=n(453),D=n(454),P=n(455),B=n(144).DropCollectionOperation,L=n(211),q=n(456),U=n(457),z=n(458),$=n(459),W=n(97),F=n(460),V=n(461),K=n(462),H=n(463),Y=n(464),G=n(465),J=n(212),X=n(466),Z=n(467),Q=n(468),ee=n(469),te=n(470),ne=n(213),re=n(217),oe=n(479),ie=n(480),se=n(481),ae=n(482),ce=n(483),ue=n(56),le=["ignoreUndefined"];function fe(e,t,n,r,o,i){s(r);const c=null==i||null==i.slaveOk?e.slaveOk:i.slaveOk,u=null==i||null==i.serializeFunctions?e.s.options.serializeFunctions:i.serializeFunctions,l=null==i||null==i.raw?e.s.options.raw:i.raw,f=null==i||null==i.promoteLongs?e.s.options.promoteLongs:i.promoteLongs,p=null==i||null==i.promoteValues?e.s.options.promoteValues:i.promoteValues,d=null==i||null==i.promoteBuffers?e.s.options.promoteBuffers:i.promoteBuffers,m=new w(n,r),g=i.promiseLibrary||Promise;o=null==o?a:o,this.s={pkFactory:o,db:e,topology:t,options:i,namespace:m,readPreference:h.fromOptions(i),slaveOk:c,serializeFunctions:u,raw:l,promoteLongs:f,promoteValues:p,promoteBuffers:d,internalHint:null,collectionHint:null,promiseLibrary:g,readConcern:S.fromOptions(i),writeConcern:v.fromOptions(i)}}Object.defineProperty(fe.prototype,"dbName",{enumerable:!0,get:function(){return this.s.namespace.db}}),Object.defineProperty(fe.prototype,"collectionName",{enumerable:!0,get:function(){return this.s.namespace.collection}}),Object.defineProperty(fe.prototype,"namespace",{enumerable:!0,get:function(){return this.s.namespace.toString()}}),Object.defineProperty(fe.prototype,"readConcern",{enumerable:!0,get:function(){return null==this.s.readConcern?this.s.db.readConcern:this.s.readConcern}}),Object.defineProperty(fe.prototype,"readPreference",{enumerable:!0,get:function(){return null==this.s.readPreference?this.s.db.readPreference:this.s.readPreference}}),Object.defineProperty(fe.prototype,"writeConcern",{enumerable:!0,get:function(){return null==this.s.writeConcern?this.s.db.writeConcern:this.s.writeConcern}}),Object.defineProperty(fe.prototype,"hint",{enumerable:!0,get:function(){return this.s.collectionHint},set:function(e){this.s.collectionHint=u(e)}});const pe=["maxScan","fields","snapshot","oplogReplay"];function de(e,t,n,r,o){const i=Array.prototype.slice.call(arguments,1);return o="function"==typeof i[i.length-1]?i.pop():void 0,t=i.length&&i.shift()||[],n=i.length?i.shift():null,r=i.length&&i.shift()||{},(r=Object.assign({},r)).readPreference=h.PRIMARY,ue(this.s.topology,new W(this,e,t,n,r),o)}fe.prototype.find=o({name:"collection.find",deprecatedOptions:pe,optionsIndex:1},(function(e,t,n){"object"==typeof n&&i("Third parameter to `find()` must be a callback or undefined");let r=e;"function"!=typeof n&&("function"==typeof t?(n=t,t=void 0):null==t&&(n="function"==typeof r?r:void 0,r="object"==typeof r?r:void 0)),r=null==r?{}:r;const o=r;if(Buffer.isBuffer(o)){const e=o[0]|o[1]<<8|o[2]<<16|o[3]<<24;if(e!==o.length){const t=new Error("query selector raw message size does not match message header size ["+o.length+"] != ["+e+"]");throw t.name="MongoError",t}}null!=r&&"ObjectID"===r._bsontype&&(r={_id:r}),t||(t={});let s=t.projection||t.fields;s&&!Buffer.isBuffer(s)&&Array.isArray(s)&&(s=s.length?s.reduce((e,t)=>(e[t]=1,e),{}):{_id:1});let a=Object.assign({},t);for(let e in this.s.options)-1!==le.indexOf(e)&&(a[e]=this.s.options[e]);if(a.skip=t.skip?t.skip:0,a.limit=t.limit?t.limit:0,a.raw="boolean"==typeof t.raw?t.raw:this.s.raw,a.hint=null!=t.hint?u(t.hint):this.s.collectionHint,a.timeout=void 0===t.timeout?void 0:t.timeout,a.slaveOk=null!=t.slaveOk?t.slaveOk:this.s.db.slaveOk,a.readPreference=h.resolve(this,a),null==a.readPreference||"primary"===a.readPreference&&"primary"===a.readPreference.mode||(a.slaveOk=!0),null!=r&&"object"!=typeof r)throw c.create({message:"query selector must be an object",driver:!0});const m={find:this.s.namespace.toString(),limit:a.limit,skip:a.skip,query:r};"boolean"==typeof t.allowDiskUse&&(m.allowDiskUse=t.allowDiskUse),"boolean"==typeof a.awaitdata&&(a.awaitData=a.awaitdata),"boolean"==typeof a.timeout&&(a.noCursorTimeout=!a.timeout),l(m,a,["session","collation"]),s&&(m.fields=s),a.db=this.s.db,a.promiseLibrary=this.s.promiseLibrary,null==a.raw&&"boolean"==typeof this.s.raw&&(a.raw=this.s.raw),null==a.promoteLongs&&"boolean"==typeof this.s.promoteLongs&&(a.promoteLongs=this.s.promoteLongs),null==a.promoteValues&&"boolean"==typeof this.s.promoteValues&&(a.promoteValues=this.s.promoteValues),null==a.promoteBuffers&&"boolean"==typeof this.s.promoteBuffers&&(a.promoteBuffers=this.s.promoteBuffers),m.sort&&(m.sort=d(m.sort)),p(m,this,t);try{f(m,this,t)}catch(e){if("function"==typeof n)return n(e,null);throw e}const g=this.s.topology.cursor(new z(this,this.s.namespace,m,a),a);if("function"!=typeof n)return g;n(null,g)})),fe.prototype.insertOne=function(e,t,n){"function"==typeof t&&(n=t,t={}),t=t||{},this.s.options.ignoreUndefined&&((t=Object.assign({},t)).ignoreUndefined=this.s.options.ignoreUndefined);const r=new Z(this,e,t);return ue(this.s.topology,r,n)},fe.prototype.insertMany=function(e,t,n){"function"==typeof t&&(n=t,t={}),t=t?Object.assign({},t):{ordered:!0};const r=new X(this,e,t);return ue(this.s.topology,r,n)},fe.prototype.bulkWrite=function(e,t,n){if("function"==typeof t&&(n=t,t={}),t=t||{ordered:!0},!Array.isArray(e))throw c.create({message:"operations must be an array of documents",driver:!0});const r=new k(this,e,t);return ue(this.s.topology,r,n)},fe.prototype.insert=r((function(e,t,n){return"function"==typeof t&&(n=t,t={}),t=t||{ordered:!1},e=Array.isArray(e)?e:[e],!0===t.keepGoing&&(t.ordered=!1),this.insertMany(e,t,n)}),"collection.insert is deprecated. Use insertOne, insertMany or bulkWrite instead."),fe.prototype.updateOne=function(e,t,n,r){return"function"==typeof n&&(r=n,n={}),n=Object.assign({},n),this.s.options.ignoreUndefined&&((n=Object.assign({},n)).ignoreUndefined=this.s.options.ignoreUndefined),ue(this.s.topology,new ce(this,e,t,n),r)},fe.prototype.replaceOne=function(e,t,n,r){return"function"==typeof n&&(r=n,n={}),n=Object.assign({},n),this.s.options.ignoreUndefined&&((n=Object.assign({},n)).ignoreUndefined=this.s.options.ignoreUndefined),ue(this.s.topology,new ie(this,e,t,n),r)},fe.prototype.updateMany=function(e,t,n,r){return"function"==typeof n&&(r=n,n={}),n=Object.assign({},n),this.s.options.ignoreUndefined&&((n=Object.assign({},n)).ignoreUndefined=this.s.options.ignoreUndefined),ue(this.s.topology,new ae(this,e,t,n),r)},fe.prototype.update=r((function(e,t,n,r){return"function"==typeof n&&(r=n,n={}),n=n||{},this.s.options.ignoreUndefined&&((n=Object.assign({},n)).ignoreUndefined=this.s.options.ignoreUndefined),b(this.s.topology,I,[this,e,t,n,r])}),"collection.update is deprecated. Use updateOne, updateMany, or bulkWrite instead."),fe.prototype.deleteOne=function(e,t,n){"function"==typeof t&&(n=t,t={}),t=Object.assign({},t),this.s.options.ignoreUndefined&&((t=Object.assign({},t)).ignoreUndefined=this.s.options.ignoreUndefined);const r=new D(this,e,t);return ue(this.s.topology,r,n)},fe.prototype.removeOne=fe.prototype.deleteOne,fe.prototype.deleteMany=function(e,t,n){"function"==typeof t&&(n=t,t={}),t=Object.assign({},t),this.s.options.ignoreUndefined&&((t=Object.assign({},t)).ignoreUndefined=this.s.options.ignoreUndefined);const r=new j(this,e,t);return ue(this.s.topology,r,n)},fe.prototype.removeMany=fe.prototype.deleteMany,fe.prototype.remove=r((function(e,t,n){return"function"==typeof t&&(n=t,t={}),t=t||{},this.s.options.ignoreUndefined&&((t=Object.assign({},t)).ignoreUndefined=this.s.options.ignoreUndefined),b(this.s.topology,E,[this,e,t,n])}),"collection.remove is deprecated. Use deleteOne, deleteMany, or bulkWrite instead."),fe.prototype.save=r((function(e,t,n){return"function"==typeof t&&(n=t,t={}),t=t||{},this.s.options.ignoreUndefined&&((t=Object.assign({},t)).ignoreUndefined=this.s.options.ignoreUndefined),b(this.s.topology,N,[this,e,t,n])}),"collection.save is deprecated. Use insertOne, insertMany, updateOne, or updateMany instead."),fe.prototype.findOne=o({name:"collection.find",deprecatedOptions:pe,optionsIndex:1},(function(e,t,n){"object"==typeof n&&i("Third parameter to `findOne()` must be a callback or undefined"),"function"==typeof e&&(n=e,e={},t={}),"function"==typeof t&&(n=t,t={});const r=new $(this,e=e||{},t=t||{});return ue(this.s.topology,r,n)})),fe.prototype.rename=function(e,t,n){"function"==typeof t&&(n=t,t={}),t=Object.assign({},t,{readPreference:h.PRIMARY});const r=new re(this,e,t);return ue(this.s.topology,r,n)},fe.prototype.drop=function(e,t){"function"==typeof e&&(t=e,e={}),e=e||{};const n=new B(this.s.db,this.collectionName,e);return ue(this.s.topology,n,t)},fe.prototype.options=function(e,t){"function"==typeof e&&(t=e,e={});const n=new ne(this,e=e||{});return ue(this.s.topology,n,t)},fe.prototype.isCapped=function(e,t){"function"==typeof e&&(t=e,e={});const n=new Q(this,e=e||{});return ue(this.s.topology,n,t)},fe.prototype.createIndex=function(e,t,n){"function"==typeof t&&(n=t,t={}),t=t||{};const r=new R(this,this.collectionName,e,t);return ue(this.s.topology,r,n)},fe.prototype.createIndexes=function(e,t,n){"function"==typeof t&&(n=t,t={}),"number"!=typeof(t=t?Object.assign({},t):{}).maxTimeMS&&delete t.maxTimeMS;const r=new R(this,this.collectionName,e,t);return ue(this.s.topology,r,n)},fe.prototype.dropIndex=function(e,t,n){const r=Array.prototype.slice.call(arguments,1);n="function"==typeof r[r.length-1]?r.pop():void 0,(t=r.length&&r.shift()||{}).readPreference=h.PRIMARY;const o=new L(this,e,t);return ue(this.s.topology,o,n)},fe.prototype.dropIndexes=function(e,t){"function"==typeof e&&(t=e,e={}),"number"!=typeof(e=e?Object.assign({},e):{}).maxTimeMS&&delete e.maxTimeMS;const n=new q(this,e);return ue(this.s.topology,n,t)},fe.prototype.dropAllIndexes=r(fe.prototype.dropIndexes,"collection.dropAllIndexes is deprecated. Use dropIndexes instead."),fe.prototype.reIndex=r((function(e,t){"function"==typeof e&&(t=e,e={});const n=new oe(this,e=e||{});return ue(this.s.topology,n,t)}),"collection.reIndex is deprecated. Use db.command instead."),fe.prototype.listIndexes=function(e){return new O(this.s.topology,new ee(this,e),e)},fe.prototype.ensureIndex=r((function(e,t,n){return"function"==typeof t&&(n=t,t={}),t=t||{},b(this.s.topology,T,[this,e,t,n])}),"collection.ensureIndex is deprecated. Use createIndexes instead."),fe.prototype.indexExists=function(e,t,n){"function"==typeof t&&(n=t,t={});const r=new G(this,e,t=t||{});return ue(this.s.topology,r,n)},fe.prototype.indexInformation=function(e,t){const n=Array.prototype.slice.call(arguments,0);t="function"==typeof n[n.length-1]?n.pop():void 0,e=n.length&&n.shift()||{};const r=new J(this.s.db,this.collectionName,e);return ue(this.s.topology,r,t)},fe.prototype.count=r((function(e,t,n){const r=Array.prototype.slice.call(arguments,0);return n="function"==typeof r[r.length-1]?r.pop():void 0,e=r.length&&r.shift()||{},"function"==typeof(t=r.length&&r.shift()||{})&&(n=t,t={}),t=t||{},ue(this.s.topology,new U(this,e,t),n)}),"collection.count is deprecated, and will be removed in a future version. Use Collection.countDocuments or Collection.estimatedDocumentCount instead"),fe.prototype.estimatedDocumentCount=function(e,t){"function"==typeof e&&(t=e,e={});const n=new U(this,e=e||{});return ue(this.s.topology,n,t)},fe.prototype.countDocuments=function(e,t,n){const r=Array.prototype.slice.call(arguments,0);n="function"==typeof r[r.length-1]?r.pop():void 0,e=r.length&&r.shift()||{},t=r.length&&r.shift()||{};const o=new M(this,e,t);return ue(this.s.topology,o,n)},fe.prototype.distinct=function(e,t,n,r){const o=Array.prototype.slice.call(arguments,1);r="function"==typeof o[o.length-1]?o.pop():void 0;const i=o.length&&o.shift()||{},s=o.length&&o.shift()||{},a=new P(this,e,i,s);return ue(this.s.topology,a,r)},fe.prototype.indexes=function(e,t){"function"==typeof e&&(t=e,e={});const n=new Y(this,e=e||{});return ue(this.s.topology,n,t)},fe.prototype.stats=function(e,t){const n=Array.prototype.slice.call(arguments,0);t="function"==typeof n[n.length-1]?n.pop():void 0,e=n.length&&n.shift()||{};const r=new se(this,e);return ue(this.s.topology,r,t)},fe.prototype.findOneAndDelete=function(e,t,n){return"function"==typeof t&&(n=t,t={}),t=t||{},this.s.options.ignoreUndefined&&((t=Object.assign({},t)).ignoreUndefined=this.s.options.ignoreUndefined),ue(this.s.topology,new F(this,e,t),n)},fe.prototype.findOneAndReplace=function(e,t,n,r){return"function"==typeof n&&(r=n,n={}),n=n||{},this.s.options.ignoreUndefined&&((n=Object.assign({},n)).ignoreUndefined=this.s.options.ignoreUndefined),ue(this.s.topology,new V(this,e,t,n),r)},fe.prototype.findOneAndUpdate=function(e,t,n,r){return"function"==typeof n&&(r=n,n={}),n=n||{},this.s.options.ignoreUndefined&&((n=Object.assign({},n)).ignoreUndefined=this.s.options.ignoreUndefined),ue(this.s.topology,new K(this,e,t,n),r)},fe.prototype.findAndModify=r(de,"collection.findAndModify is deprecated. Use findOneAndUpdate, findOneAndReplace or findOneAndDelete instead."),fe.prototype._findAndModify=de,fe.prototype.findAndRemove=r((function(e,t,n,r){const o=Array.prototype.slice.call(arguments,1);return r="function"==typeof o[o.length-1]?o.pop():void 0,t=o.length&&o.shift()||[],(n=o.length&&o.shift()||{}).remove=!0,ue(this.s.topology,new W(this,e,t,null,n),r)}),"collection.findAndRemove is deprecated. Use findOneAndDelete instead."),fe.prototype.aggregate=function(e,t,n){if(Array.isArray(e))"function"==typeof t&&(n=t,t={}),null==t&&null==n&&(t={});else{const r=Array.prototype.slice.call(arguments,0);n=r.pop();const o=r[r.length-1];t=o&&(o.readPreference||o.explain||o.cursor||o.out||o.maxTimeMS||o.hint||o.allowDiskUse)?r.pop():{},e=r}const r=new _(this.s.topology,new A(this,e,t),t);if("function"!=typeof n)return r;n(null,r)},fe.prototype.watch=function(e,t){return e=e||[],t=t||{},Array.isArray(e)||(t=e,e=[]),new y(this,e,t)},fe.prototype.parallelCollectionScan=r((function(e,t){return"function"==typeof e&&(t=e,e={numCursors:1}),e.numCursors=e.numCursors||1,e.batchSize=e.batchSize||1e3,(e=Object.assign({},e)).readPreference=h.resolve(this,e),e.promiseLibrary=this.s.promiseLibrary,e.session&&(e.session=void 0),b(this.s.topology,x,[this,e,t],{skipSessions:!0})}),"parallelCollectionScan is deprecated in MongoDB v4.1"),fe.prototype.geoHaystackSearch=r((function(e,t,n,r){const o=Array.prototype.slice.call(arguments,2);r="function"==typeof o[o.length-1]?o.pop():void 0,n=o.length&&o.shift()||{};const i=new H(this,e,t,n);return ue(this.s.topology,i,r)}),"geoHaystackSearch is deprecated, and will be removed in a future version."),fe.prototype.group=r((function(e,t,n,r,o,i,s,a){const c=Array.prototype.slice.call(arguments,3);return a="function"==typeof c[c.length-1]?c.pop():void 0,r=c.length?c.shift():null,o=c.length?c.shift():null,i=c.length?c.shift():null,s=c.length&&c.shift()||{},"function"!=typeof o&&(i=o,o=null),!Array.isArray(e)&&e instanceof Object&&"function"!=typeof e&&"Code"!==e._bsontype&&(e=Object.keys(e)),"function"==typeof r&&(r=r.toString()),"function"==typeof o&&(o=o.toString()),i=null==i||i,b(this.s.topology,C,[this,e,t,n,r,o,i,s,a])}),"MongoDB 3.6 or higher no longer supports the group command. We recommend rewriting using the aggregation framework."),fe.prototype.mapReduce=function(e,t,n,r){if("function"==typeof n&&(r=n,n={}),null==n.out)throw new Error("the out option parameter must be defined, see mongodb docs for possible values");"function"==typeof e&&(e=e.toString()),"function"==typeof t&&(t=t.toString()),"function"==typeof n.finalize&&(n.finalize=n.finalize.toString());const o=new te(this,e,t,n);return ue(this.s.topology,o,r)},fe.prototype.initializeUnorderedBulkOp=function(e){return null==(e=e||{}).ignoreUndefined&&(e.ignoreUndefined=this.s.options.ignoreUndefined),e.promiseLibrary=this.s.promiseLibrary,m(this.s.topology,this,e)},fe.prototype.initializeOrderedBulkOp=function(e){return null==(e=e||{}).ignoreUndefined&&(e.ignoreUndefined=this.s.options.ignoreUndefined),e.promiseLibrary=this.s.promiseLibrary,g(this.s.topology,this,e)},fe.prototype.getLogger=function(){return this.s.db.s.logger},e.exports=fe},function(e,t){e.exports=function(e){return e.webpackPolyfill||(e.deprecate=function(){},e.paths=[],e.children||(e.children=[]),Object.defineProperty(e,"loaded",{enumerable:!0,get:function(){return e.l}}),Object.defineProperty(e,"id",{enumerable:!0,get:function(){return e.i}}),e.webpackPolyfill=1),e}},function(e,t,n){var r=n(237),o=n(238),i=n(239),s=n(240),a=n(241);function c(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}c.prototype.clear=r,c.prototype.delete=o,c.prototype.get=i,c.prototype.has=s,c.prototype.set=a,e.exports=c},function(e,t,n){var r=n(65);e.exports=function(e,t){for(var n=e.length;n--;)if(r(e[n][0],t))return n;return-1}},function(e,t){e.exports=function(e,t){return e===t||e!=e&&t!=t}},function(e,t,n){var r=n(31)(Object,"create");e.exports=r},function(e,t,n){var r=n(261);e.exports=function(e,t){var n=e.__data__;return r(t)?n["string"==typeof t?"string":"hash"]:n.map}},function(e,t){var n=/^(?:0|[1-9]\d*)$/;e.exports=function(e,t){var r=typeof e;return!!(t=null==t?9007199254740991:t)&&("number"==r||"symbol"!=r&&n.test(e))&&e>-1&&e%1==0&&e<t}},function(e,t,n){(function(e){var r=n(149),o=t&&!t.nodeType&&t,i=o&&"object"==typeof e&&e&&!e.nodeType&&e,s=i&&i.exports===o&&r.process,a=function(){try{var e=i&&i.require&&i.require("util").types;return e||s&&s.binding&&s.binding("util")}catch(e){}}();e.exports=a}).call(this,n(62)(e))},function(e,t,n){var r=n(281),o=n(104),i=n(282),s=n(160),a=n(283),c=n(25),u=n(150),l=u(r),f=u(o),p=u(i),d=u(s),h=u(a),m=c;(r&&"[object DataView]"!=m(new r(new ArrayBuffer(1)))||o&&"[object Map]"!=m(new o)||i&&"[object Promise]"!=m(i.resolve())||s&&"[object Set]"!=m(new s)||a&&"[object WeakMap]"!=m(new a))&&(m=function(e){var t=c(e),n="[object Object]"==t?e.constructor:void 0,r=n?u(n):"";if(r)switch(r){case l:return"[object DataView]";case f:return"[object Map]";case p:return"[object Promise]";case d:return"[object Set]";case h:return"[object WeakMap]"}return t}),e.exports=m},function(e,t,n){var r=n(25),o=n(15);e.exports=function(e){return"symbol"==typeof e||o(e)&&"[object Symbol]"==r(e)}},function(e,t,n){var r=n(25),o=n(12),i=n(15);e.exports=function(e){return"string"==typeof e||!o(e)&&i(e)&&"[object String]"==r(e)}},function(e,t,n){var r=n(25),o=n(115),i=n(15),s=Function.prototype,a=Object.prototype,c=s.toString,u=a.hasOwnProperty,l=c.call(Object);e.exports=function(e){if(!i(e)||"[object Object]"!=r(e))return!1;var t=o(e);if(null===t)return!0;var n=u.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&c.call(n)==l}},function(e,t){e.exports=function(e){return e}},function(e,t,n){var r=n(171);e.exports=function(e){return(null==e?0:e.length)?r(e,1):[]}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.dumpSqlCommand=t.dumpSqlInsert=t.dumpSqlDelete=t.dumpSqlUpdate=t.dumpSqlSelect=void 0;const r=n(180),o=n(126),i=n(127);function s(e,t){e.put("^select "),t.distinct&&e.put("^distinct "),t.topRecords&&(e.dialect.rangeSelect&&!e.dialect.offsetFetchRangeSyntax||e.put("^top %s ",t.topRecords)),t.selectAll&&e.put("* "),t.columns&&(t.selectAll&&e.put("&n,"),e.put("&>&n"),e.putCollection(",&n",t.columns,t=>{(0,r.dumpSqlExpression)(e,t),t.alias&&e.put(" ^as %i",t.alias)}),e.put("&n&<")),e.put("^from "),(0,o.dumpSqlFromDefinition)(e,t.from),t.where&&(e.put("&n^where "),(0,i.dumpSqlCondition)(e,t.where),e.put("&n")),t.groupBy&&(e.put("&n^group ^by "),e.putCollection(", ",t.groupBy,t=>(0,r.dumpSqlExpression)(e,t)),e.put("&n")),t.having&&(e.put("&n^having "),(0,i.dumpSqlCondition)(e,t.having),e.put("&n")),t.orderBy&&(e.put("&n^order ^by "),e.putCollection(", ",t.orderBy,t=>{(0,r.dumpSqlExpression)(e,t),e.put(" %k",t.direction)}),e.put("&n")),t.range&&(e.dialect.offsetFetchRangeSyntax?e.put("^offset %s ^rows ^fetch ^next %s ^rows ^only",t.range.offset,t.range.limit):e.put("^limit %s ^offset %s ",t.range.limit,t.range.offset)),t.topRecords&&e.dialect.rangeSelect&&!e.dialect.offsetFetchRangeSyntax&&e.put("^limit %s ",t.topRecords)}function a(e,t){e.put("^update "),(0,o.dumpSqlSourceRef)(e,t.from),e.put("&n^set "),e.put("&>"),e.putCollection(", ",t.fields,t=>{e.put("%i=",t.targetColumn),(0,r.dumpSqlExpression)(e,t)}),e.put("&<"),t.where&&(e.put("&n^where "),(0,i.dumpSqlCondition)(e,t.where),e.put("&n"))}function c(e,t){e.put("^delete ^from "),(0,o.dumpSqlSourceRef)(e,t.from),t.where&&(e.put("&n^where "),(0,i.dumpSqlCondition)(e,t.where),e.put("&n"))}function u(e,t){e.put("^insert ^into %f (%,i) ^values (",t.targetTable,t.fields.map(e=>e.targetColumn)),e.putCollection(",",t.fields,t=>(0,r.dumpSqlExpression)(e,t)),e.put(")")}t.dumpSqlSelect=s,t.dumpSqlUpdate=a,t.dumpSqlDelete=c,t.dumpSqlInsert=u,t.dumpSqlCommand=function(e,t){switch(t.commandType){case"select":s(e,t);break;case"update":a(e,t);break;case"delete":c(e,t);break;case"insert":u(e,t);break;case"allowIdentityInsert":e.allowIdentityInsert(t.targetTable,t.allow)}}},function(e,t){function n(e){if(!(this instanceof n))return new n(e);this._bsontype="Double",this.value=e}n.prototype.valueOf=function(){return this.value},n.prototype.toJSON=function(){return this.value},e.exports=n,e.exports.Double=n},function(e,t){function n(e,t){if(!(this instanceof n))return new n(e,t);this._bsontype="Timestamp",this.low_=0|e,this.high_=0|t}n.prototype.toInt=function(){return this.low_},n.prototype.toNumber=function(){return this.high_*n.TWO_PWR_32_DBL_+this.getLowBitsUnsigned()},n.prototype.toJSON=function(){return this.toString()},n.prototype.toString=function(e){var t=e||10;if(t<2||36<t)throw Error("radix out of range: "+t);if(this.isZero())return"0";if(this.isNegative()){if(this.equals(n.MIN_VALUE)){var r=n.fromNumber(t),o=this.div(r),i=o.multiply(r).subtract(this);return o.toString(t)+i.toInt().toString(t)}return"-"+this.negate().toString(t)}var s=n.fromNumber(Math.pow(t,6));i=this;for(var a="";!i.isZero();){var c=i.div(s),u=i.subtract(c.multiply(s)).toInt().toString(t);if((i=c).isZero())return u+a;for(;u.length<6;)u="0"+u;a=""+u+a}},n.prototype.getHighBits=function(){return this.high_},n.prototype.getLowBits=function(){return this.low_},n.prototype.getLowBitsUnsigned=function(){return this.low_>=0?this.low_:n.TWO_PWR_32_DBL_+this.low_},n.prototype.getNumBitsAbs=function(){if(this.isNegative())return this.equals(n.MIN_VALUE)?64:this.negate().getNumBitsAbs();for(var e=0!==this.high_?this.high_:this.low_,t=31;t>0&&0==(e&1<<t);t--);return 0!==this.high_?t+33:t+1},n.prototype.isZero=function(){return 0===this.high_&&0===this.low_},n.prototype.isNegative=function(){return this.high_<0},n.prototype.isOdd=function(){return 1==(1&this.low_)},n.prototype.equals=function(e){return this.high_===e.high_&&this.low_===e.low_},n.prototype.notEquals=function(e){return this.high_!==e.high_||this.low_!==e.low_},n.prototype.lessThan=function(e){return this.compare(e)<0},n.prototype.lessThanOrEqual=function(e){return this.compare(e)<=0},n.prototype.greaterThan=function(e){return this.compare(e)>0},n.prototype.greaterThanOrEqual=function(e){return this.compare(e)>=0},n.prototype.compare=function(e){if(this.equals(e))return 0;var t=this.isNegative(),n=e.isNegative();return t&&!n?-1:!t&&n?1:this.subtract(e).isNegative()?-1:1},n.prototype.negate=function(){return this.equals(n.MIN_VALUE)?n.MIN_VALUE:this.not().add(n.ONE)},n.prototype.add=function(e){var t=this.high_>>>16,r=65535&this.high_,o=this.low_>>>16,i=65535&this.low_,s=e.high_>>>16,a=65535&e.high_,c=e.low_>>>16,u=0,l=0,f=0,p=0;return f+=(p+=i+(65535&e.low_))>>>16,p&=65535,l+=(f+=o+c)>>>16,f&=65535,u+=(l+=r+a)>>>16,l&=65535,u+=t+s,u&=65535,n.fromBits(f<<16|p,u<<16|l)},n.prototype.subtract=function(e){return this.add(e.negate())},n.prototype.multiply=function(e){if(this.isZero())return n.ZERO;if(e.isZero())return n.ZERO;if(this.equals(n.MIN_VALUE))return e.isOdd()?n.MIN_VALUE:n.ZERO;if(e.equals(n.MIN_VALUE))return this.isOdd()?n.MIN_VALUE:n.ZERO;if(this.isNegative())return e.isNegative()?this.negate().multiply(e.negate()):this.negate().multiply(e).negate();if(e.isNegative())return this.multiply(e.negate()).negate();if(this.lessThan(n.TWO_PWR_24_)&&e.lessThan(n.TWO_PWR_24_))return n.fromNumber(this.toNumber()*e.toNumber());var t=this.high_>>>16,r=65535&this.high_,o=this.low_>>>16,i=65535&this.low_,s=e.high_>>>16,a=65535&e.high_,c=e.low_>>>16,u=65535&e.low_,l=0,f=0,p=0,d=0;return p+=(d+=i*u)>>>16,d&=65535,f+=(p+=o*u)>>>16,p&=65535,f+=(p+=i*c)>>>16,p&=65535,l+=(f+=r*u)>>>16,f&=65535,l+=(f+=o*c)>>>16,f&=65535,l+=(f+=i*a)>>>16,f&=65535,l+=t*u+r*c+o*a+i*s,l&=65535,n.fromBits(p<<16|d,l<<16|f)},n.prototype.div=function(e){if(e.isZero())throw Error("division by zero");if(this.isZero())return n.ZERO;if(this.equals(n.MIN_VALUE)){if(e.equals(n.ONE)||e.equals(n.NEG_ONE))return n.MIN_VALUE;if(e.equals(n.MIN_VALUE))return n.ONE;var t=this.shiftRight(1).div(e).shiftLeft(1);if(t.equals(n.ZERO))return e.isNegative()?n.ONE:n.NEG_ONE;var r=this.subtract(e.multiply(t));return t.add(r.div(e))}if(e.equals(n.MIN_VALUE))return n.ZERO;if(this.isNegative())return e.isNegative()?this.negate().div(e.negate()):this.negate().div(e).negate();if(e.isNegative())return this.div(e.negate()).negate();var o=n.ZERO;for(r=this;r.greaterThanOrEqual(e);){t=Math.max(1,Math.floor(r.toNumber()/e.toNumber()));for(var i=Math.ceil(Math.log(t)/Math.LN2),s=i<=48?1:Math.pow(2,i-48),a=n.fromNumber(t),c=a.multiply(e);c.isNegative()||c.greaterThan(r);)t-=s,c=(a=n.fromNumber(t)).multiply(e);a.isZero()&&(a=n.ONE),o=o.add(a),r=r.subtract(c)}return o},n.prototype.modulo=function(e){return this.subtract(this.div(e).multiply(e))},n.prototype.not=function(){return n.fromBits(~this.low_,~this.high_)},n.prototype.and=function(e){return n.fromBits(this.low_&e.low_,this.high_&e.high_)},n.prototype.or=function(e){return n.fromBits(this.low_|e.low_,this.high_|e.high_)},n.prototype.xor=function(e){return n.fromBits(this.low_^e.low_,this.high_^e.high_)},n.prototype.shiftLeft=function(e){if(0===(e&=63))return this;var t=this.low_;if(e<32){var r=this.high_;return n.fromBits(t<<e,r<<e|t>>>32-e)}return n.fromBits(0,t<<e-32)},n.prototype.shiftRight=function(e){if(0===(e&=63))return this;var t=this.high_;if(e<32){var r=this.low_;return n.fromBits(r>>>e|t<<32-e,t>>e)}return n.fromBits(t>>e-32,t>=0?0:-1)},n.prototype.shiftRightUnsigned=function(e){if(0===(e&=63))return this;var t=this.high_;if(e<32){var r=this.low_;return n.fromBits(r>>>e|t<<32-e,t>>>e)}return 32===e?n.fromBits(t,0):n.fromBits(t>>>e-32,0)},n.fromInt=function(e){if(-128<=e&&e<128){var t=n.INT_CACHE_[e];if(t)return t}var r=new n(0|e,e<0?-1:0);return-128<=e&&e<128&&(n.INT_CACHE_[e]=r),r},n.fromNumber=function(e){return isNaN(e)||!isFinite(e)?n.ZERO:e<=-n.TWO_PWR_63_DBL_?n.MIN_VALUE:e+1>=n.TWO_PWR_63_DBL_?n.MAX_VALUE:e<0?n.fromNumber(-e).negate():new n(e%n.TWO_PWR_32_DBL_|0,e/n.TWO_PWR_32_DBL_|0)},n.fromBits=function(e,t){return new n(e,t)},n.fromString=function(e,t){if(0===e.length)throw Error("number format error: empty string");var r=t||10;if(r<2||36<r)throw Error("radix out of range: "+r);if("-"===e.charAt(0))return n.fromString(e.substring(1),r).negate();if(e.indexOf("-")>=0)throw Error('number format error: interior "-" character: '+e);for(var o=n.fromNumber(Math.pow(r,8)),i=n.ZERO,s=0;s<e.length;s+=8){var a=Math.min(8,e.length-s),c=parseInt(e.substring(s,s+a),r);if(a<8){var u=n.fromNumber(Math.pow(r,a));i=i.multiply(u).add(n.fromNumber(c))}else i=(i=i.multiply(o)).add(n.fromNumber(c))}return i},n.INT_CACHE_={},n.TWO_PWR_16_DBL_=65536,n.TWO_PWR_24_DBL_=1<<24,n.TWO_PWR_32_DBL_=n.TWO_PWR_16_DBL_*n.TWO_PWR_16_DBL_,n.TWO_PWR_31_DBL_=n.TWO_PWR_32_DBL_/2,n.TWO_PWR_48_DBL_=n.TWO_PWR_32_DBL_*n.TWO_PWR_16_DBL_,n.TWO_PWR_64_DBL_=n.TWO_PWR_32_DBL_*n.TWO_PWR_32_DBL_,n.TWO_PWR_63_DBL_=n.TWO_PWR_64_DBL_/2,n.ZERO=n.fromInt(0),n.ONE=n.fromInt(1),n.NEG_ONE=n.fromInt(-1),n.MAX_VALUE=n.fromBits(-1,2147483647),n.MIN_VALUE=n.fromBits(0,-2147483648),n.TWO_PWR_24_=n.fromInt(1<<24),e.exports=n,e.exports.Timestamp=n},function(e,t,n){var r="inspect",o=n(32),i=parseInt(16777215*Math.random(),10),s=new RegExp("^[0-9a-fA-F]{24}$");try{if(Buffer&&Buffer.from){var a=!0;r=n(5).inspect.custom||"inspect"}}catch(e){a=!1}for(var c=function e(t){if(t instanceof e)return t;if(!(this instanceof e))return new e(t);if(this._bsontype="ObjectID",null==t||"number"==typeof t)return this.id=this.generate(t),void(e.cacheHexString&&(this.__id=this.toString("hex")));var n=e.isValid(t);if(!n&&null!=t)throw new Error("Argument passed in must be a single String of 12 bytes or a string of 24 hex characters");if(n&&"string"==typeof t&&24===t.length&&a)return new e(o.toBuffer(t,"hex"));if(n&&"string"==typeof t&&24===t.length)return e.createFromHexString(t);if(null==t||12!==t.length){if(null!=t&&"function"==typeof t.toHexString)return t;throw new Error("Argument passed in must be a single String of 12 bytes or a string of 24 hex characters")}this.id=t,e.cacheHexString&&(this.__id=this.toString("hex"))},u=[],l=0;l<256;l++)u[l]=(l<=15?"0":"")+l.toString(16);c.prototype.toHexString=function(){if(c.cacheHexString&&this.__id)return this.__id;var e="";if(!this.id||!this.id.length)throw new Error("invalid ObjectId, ObjectId.id must be either a string or a Buffer, but is ["+JSON.stringify(this.id)+"]");if(this.id instanceof p)return e=d(this.id),c.cacheHexString&&(this.__id=e),e;for(var t=0;t<this.id.length;t++)e+=u[this.id.charCodeAt(t)];return c.cacheHexString&&(this.__id=e),e},c.prototype.get_inc=function(){return c.index=(c.index+1)%16777215},c.prototype.getInc=function(){return this.get_inc()},c.prototype.generate=function(e){"number"!=typeof e&&(e=~~(Date.now()/1e3));var t=("undefined"==typeof process||1===process.pid?Math.floor(1e5*Math.random()):process.pid)%65535,n=this.get_inc(),r=o.allocBuffer(12);return r[3]=255&e,r[2]=e>>8&255,r[1]=e>>16&255,r[0]=e>>24&255,r[6]=255&i,r[5]=i>>8&255,r[4]=i>>16&255,r[8]=255&t,r[7]=t>>8&255,r[11]=255&n,r[10]=n>>8&255,r[9]=n>>16&255,r},c.prototype.toString=function(e){return this.id&&this.id.copy?this.id.toString("string"==typeof e?e:"hex"):this.toHexString()},c.prototype[r]=c.prototype.toString,c.prototype.toJSON=function(){return this.toHexString()},c.prototype.equals=function(e){return e instanceof c?this.toString()===e.toString():"string"==typeof e&&c.isValid(e)&&12===e.length&&this.id instanceof p?e===this.id.toString("binary"):"string"==typeof e&&c.isValid(e)&&24===e.length?e.toLowerCase()===this.toHexString():"string"==typeof e&&c.isValid(e)&&12===e.length?e===this.id:!(null==e||!(e instanceof c||e.toHexString))&&e.toHexString()===this.toHexString()},c.prototype.getTimestamp=function(){var e=new Date,t=this.id[3]|this.id[2]<<8|this.id[1]<<16|this.id[0]<<24;return e.setTime(1e3*Math.floor(t)),e},c.index=~~(16777215*Math.random()),c.createPk=function(){return new c},c.createFromTime=function(e){var t=o.toBuffer([0,0,0,0,0,0,0,0,0,0,0,0]);return t[3]=255&e,t[2]=e>>8&255,t[1]=e>>16&255,t[0]=e>>24&255,new c(t)};var f=[];for(l=0;l<10;)f[48+l]=l++;for(;l<16;)f[55+l]=f[87+l]=l++;var p=Buffer,d=function(e){return e.toString("hex")};c.createFromHexString=function(e){if(void 0===e||null!=e&&24!==e.length)throw new Error("Argument passed in must be a single String of 12 bytes or a string of 24 hex characters");if(a)return new c(o.toBuffer(e,"hex"));for(var t=new p(12),n=0,r=0;r<24;)t[n++]=f[e.charCodeAt(r++)]<<4|f[e.charCodeAt(r++)];return new c(t)},c.isValid=function(e){return null!=e&&("number"==typeof e||("string"==typeof e?12===e.length||24===e.length&&s.test(e):e instanceof c||(e instanceof p||"function"==typeof e.toHexString&&(e.id instanceof p||"string"==typeof e.id)&&(12===e.id.length||24===e.id.length&&s.test(e.id)))))},Object.defineProperty(c.prototype,"generationTime",{enumerable:!0,get:function(){return this.id[3]|this.id[2]<<8|this.id[1]<<16|this.id[0]<<24},set:function(e){this.id[3]=255&e,this.id[2]=e>>8&255,this.id[1]=e>>16&255,this.id[0]=e>>24&255}}),e.exports=c,e.exports.ObjectID=c,e.exports.ObjectId=c},function(e,t){function n(e,t){if(!(this instanceof n))return new n;this._bsontype="BSONRegExp",this.pattern=e||"",this.options=t||"";for(var r=0;r<this.options.length;r++)if("i"!==this.options[r]&&"m"!==this.options[r]&&"x"!==this.options[r]&&"l"!==this.options[r]&&"s"!==this.options[r]&&"u"!==this.options[r])throw new Error("the regular expression options ["+this.options[r]+"] is not supported")}e.exports=n,e.exports.BSONRegExp=n},function(e,t,n){var r=Buffer&&n(5).inspect.custom||"inspect";function o(e){if(!(this instanceof o))return new o(e);this._bsontype="Symbol",this.value=e}o.prototype.valueOf=function(){return this.value},o.prototype.toString=function(){return this.value},o.prototype[r]=function(){return this.value},o.prototype.toJSON=function(){return this.value},e.exports=o,e.exports.Symbol=o},function(e,t){var n=function e(t,n){if(!(this instanceof e))return new e(t,n);this._bsontype="Code",this.code=t,this.scope=n};n.prototype.toJSON=function(){return{scope:this.scope,code:this.code}},e.exports=n,e.exports.Code=n},function(e,t,n){"use strict";var r=n(43),o=/^(\+|-)?(\d+|(\d*\.\d*))?(E|e)?([-+])?(\d+)?$/,i=/^(\+|-)?(Infinity|inf)$/i,s=/^(\+|-)?NaN$/i,a=6176,c=[124,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0].reverse(),u=[248,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0].reverse(),l=[120,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0].reverse(),f=/^([-+])?(\d+)?$/,p=n(32),d=function(e){return!isNaN(parseInt(e,10))},h=function(e){var t=r.fromNumber(1e9),n=r.fromNumber(0),o=0;if(!(e.parts[0]||e.parts[1]||e.parts[2]||e.parts[3]))return{quotient:e,rem:n};for(o=0;o<=3;o++)n=(n=n.shiftLeft(32)).add(new r(e.parts[o],0)),e.parts[o]=n.div(t).low_,n=n.modulo(t);return{quotient:e,rem:n}},m=function(e){this._bsontype="Decimal128",this.bytes=e};m.fromString=function(e){var t,n=!1,h=!1,g=!1,y=0,b=0,v=0,S=0,w=0,_=[0],O=0,T=0,C=0,x=0,E=0,N=0,I=[0,0],A=[0,0],k=0;if((e=e.trim()).length>=7e3)throw new Error(e+" not a valid Decimal128 string");var M=e.match(o),R=e.match(i),j=e.match(s);if(!M&&!R&&!j||0===e.length)throw new Error(e+" not a valid Decimal128 string");if(M&&M[4]&&void 0===M[2])throw new Error(e+" not a valid Decimal128 string");if("+"!==e[k]&&"-"!==e[k]||(n="-"===e[k++]),!d(e[k])&&"."!==e[k]){if("i"===e[k]||"I"===e[k])return new m(p.toBuffer(n?u:l));if("N"===e[k])return new m(p.toBuffer(c))}for(;d(e[k])||"."===e[k];)if("."!==e[k])O<34&&("0"!==e[k]||g)&&(g||(w=b),g=!0,_[T++]=parseInt(e[k],10),O+=1),g&&(v+=1),h&&(S+=1),b+=1,k+=1;else{if(h)return new m(p.toBuffer(c));h=!0,k+=1}if(h&&!b)throw new Error(e+" not a valid Decimal128 string");if("e"===e[k]||"E"===e[k]){var D=e.substr(++k).match(f);if(!D||!D[2])return new m(p.toBuffer(c));E=parseInt(D[0],10),k+=D[0].length}if(e[k])return new m(p.toBuffer(c));if(C=0,O){if(x=O-1,y=v,0!==E&&1!==y)for(;"0"===e[w+y-1];)y-=1}else C=0,x=0,_[0]=0,v=1,O=1,y=0;for(E<=S&&S-E>16384?E=-6176:E-=S;E>6111;){if((x+=1)-C>34){var P=_.join("");if(P.match(/^0+$/)){E=6111;break}return new m(p.toBuffer(n?u:l))}E-=1}for(;E<-6176||O<v;){if(0===x){E=-6176,y=0;break}if(O<v?v-=1:x-=1,!(E<6111)){if((P=_.join("")).match(/^0+$/)){E=6111;break}return new m(p.toBuffer(n?u:l))}E+=1}if(x-C+1<y&&"0"!==e[y]){var B=b;h&&-6176===E&&(w+=1,B+=1);var L=parseInt(e[w+x+1],10),q=0;if(L>=5&&(q=1,5===L))for(q=_[x]%2==1,N=w+x+2;N<B;N++)if(parseInt(e[N],10)){q=1;break}if(q)for(var U=x;U>=0&&++_[U]>9;U--)if(_[U]=0,0===U){if(!(E<6111))return new m(p.toBuffer(n?u:l));E+=1,_[U]=1}}if(I=r.fromNumber(0),A=r.fromNumber(0),0===y)I=r.fromNumber(0),A=r.fromNumber(0);else if(x-C<17)for(U=C,A=r.fromNumber(_[U++]),I=new r(0,0);U<=x;U++)A=(A=A.multiply(r.fromNumber(10))).add(r.fromNumber(_[U]));else{for(U=C,I=r.fromNumber(_[U++]);U<=x-17;U++)I=(I=I.multiply(r.fromNumber(10))).add(r.fromNumber(_[U]));for(A=r.fromNumber(_[U++]);U<=x;U++)A=(A=A.multiply(r.fromNumber(10))).add(r.fromNumber(_[U]))}var z,$,W,F,V=function(e,t){if(!e&&!t)return{high:r.fromNumber(0),low:r.fromNumber(0)};var n=e.shiftRightUnsigned(32),o=new r(e.getLowBits(),0),i=t.shiftRightUnsigned(32),s=new r(t.getLowBits(),0),a=n.multiply(i),c=n.multiply(s),u=o.multiply(i),l=o.multiply(s);return a=a.add(c.shiftRightUnsigned(32)),c=new r(c.getLowBits(),0).add(u).add(l.shiftRightUnsigned(32)),{high:a=a.add(c.shiftRightUnsigned(32)),low:l=c.shiftLeft(32).add(new r(l.getLowBits(),0))}}(I,r.fromString("100000000000000000"));V.low=V.low.add(A),z=V.low,$=A,W=z.high_>>>0,F=$.high_>>>0,(W<F||W===F&&z.low_>>>0<$.low_>>>0)&&(V.high=V.high.add(r.fromNumber(1))),t=E+a;var K={low:r.fromNumber(0),high:r.fromNumber(0)};V.high.shiftRightUnsigned(49).and(r.fromNumber(1)).equals(r.fromNumber)?(K.high=K.high.or(r.fromNumber(3).shiftLeft(61)),K.high=K.high.or(r.fromNumber(t).and(r.fromNumber(16383).shiftLeft(47))),K.high=K.high.or(V.high.and(r.fromNumber(0x7fffffffffff)))):(K.high=K.high.or(r.fromNumber(16383&t).shiftLeft(49)),K.high=K.high.or(V.high.and(r.fromNumber(562949953421311)))),K.low=V.low,n&&(K.high=K.high.or(r.fromString("9223372036854775808")));var H=p.allocBuffer(16);return k=0,H[k++]=255&K.low.low_,H[k++]=K.low.low_>>8&255,H[k++]=K.low.low_>>16&255,H[k++]=K.low.low_>>24&255,H[k++]=255&K.low.high_,H[k++]=K.low.high_>>8&255,H[k++]=K.low.high_>>16&255,H[k++]=K.low.high_>>24&255,H[k++]=255&K.high.low_,H[k++]=K.high.low_>>8&255,H[k++]=K.high.low_>>16&255,H[k++]=K.high.low_>>24&255,H[k++]=255&K.high.high_,H[k++]=K.high.high_>>8&255,H[k++]=K.high.high_>>16&255,H[k++]=K.high.high_>>24&255,new m(H)};a=6176,m.prototype.toString=function(){for(var e,t,n,o,i,s,c=0,u=new Array(36),l=0;l<u.length;l++)u[l]=0;var f,p,d,m,g,y=0,b=!1,v={parts:new Array(4)},S=[];y=0;var w=this.bytes;if(o=w[y++]|w[y++]<<8|w[y++]<<16|w[y++]<<24,n=w[y++]|w[y++]<<8|w[y++]<<16|w[y++]<<24,t=w[y++]|w[y++]<<8|w[y++]<<16|w[y++]<<24,e=w[y++]|w[y++]<<8|w[y++]<<16|w[y++]<<24,y=0,{low:new r(o,n),high:new r(t,e)}.high.lessThan(r.ZERO)&&S.push("-"),(i=e>>26&31)>>3==3){if(30===i)return S.join("")+"Infinity";if(31===i)return"NaN";s=e>>15&16383,d=8+(e>>14&1)}else d=e>>14&7,s=e>>17&16383;if(f=s-a,v.parts[0]=(16383&e)+((15&d)<<14),v.parts[1]=t,v.parts[2]=n,v.parts[3]=o,0===v.parts[0]&&0===v.parts[1]&&0===v.parts[2]&&0===v.parts[3])b=!0;else for(g=3;g>=0;g--){var _=0,O=h(v);if(v=O.quotient,_=O.rem.low_)for(m=8;m>=0;m--)u[9*g+m]=_%10,_=Math.floor(_/10)}if(b)c=1,u[y]=0;else for(c=36,l=0;!u[y];)l++,c-=1,y+=1;if((p=c-1+f)>=34||p<=-7||f>0){for(S.push(u[y++]),(c-=1)&&S.push("."),l=0;l<c;l++)S.push(u[y++]);S.push("E"),p>0?S.push("+"+p):S.push(p)}else if(f>=0)for(l=0;l<c;l++)S.push(u[y++]);else{var T=c+f;if(T>0)for(l=0;l<T;l++)S.push(u[y++]);else S.push("0");for(S.push(".");T++<0;)S.push("0");for(l=0;l<c-Math.max(T-1,0);l++)S.push(u[y++])}return S.join("")},m.prototype.toJSON=function(){return{$numberDecimal:this.toString()}},e.exports=m,e.exports.Decimal128=m},function(e,t){function n(){if(!(this instanceof n))return new n;this._bsontype="MinKey"}e.exports=n,e.exports.MinKey=n},function(e,t){function n(){if(!(this instanceof n))return new n;this._bsontype="MaxKey"}e.exports=n,e.exports.MaxKey=n},function(e,t){function n(e,t,r){if(!(this instanceof n))return new n(e,t,r);this._bsontype="DBRef",this.namespace=e,this.oid=t,this.db=r}n.prototype.toJSON=function(){return{$ref:this.namespace,$id:this.oid,$db:null==this.db?"":this.db}},e.exports=n,e.exports.DBRef=n},function(e,t){e.exports=require("dns")},function(e,t,n){"use strict";const r=n(20),o=n(22).Buffer,i=n(9).retrieveBSON,s=n(3).MongoError,a=n(33).AuthProvider,c=n(0).emitWarning,u=i().Binary;let l;try{l=n(416)}catch(e){}class f extends a{constructor(e,t){super(e),this.cryptoMethod=t||"sha1"}prepare(e,t,n){const o=this.cryptoMethod;"sha256"===o&&null==l&&c("Warning: no saslprep library specified. Passwords will not be sanitized"),r.randomBytes(24,(r,i)=>{if(r)return n(r);Object.assign(t,{nonce:i});const s=t.credentials,a=Object.assign({},e,{speculativeAuthenticate:Object.assign(h(o,s,i),{db:s.source})});n(void 0,a)})}auth(e,t){const n=e.response;n&&n.speculativeAuthenticate?m(this.cryptoMethod,n.speculativeAuthenticate,e,t):function(e,t,n){const r=t.connection,o=t.credentials,i=t.nonce,s=o.source,a=h(e,o,i);r.command(`${s}.$cmd`,a,(r,o)=>{const i=w(r,o);if(i)return n(i);m(e,o.result,t,n)})}(this.cryptoMethod,e,t)}}function p(e){return e.replace("=","=3D").replace(",","=2C")}function d(e,t){return o.concat([o.from("n=","utf8"),o.from(e,"utf8"),o.from(",r=","utf8"),o.from(t.toString("base64"),"utf8")])}function h(e,t,n){const r=p(t.username);return{saslStart:1,mechanism:"sha1"===e?"SCRAM-SHA-1":"SCRAM-SHA-256",payload:new u(o.concat([o.from("n,,","utf8"),d(r,n)])),autoAuthorize:1,options:{skipEmptyExchange:!0}}}function m(e,t,n,i){const a=n.connection,c=n.credentials,f=n.nonce,h=c.source,m=p(c.username),_=c.password;let O;if("sha256"===e)O=l?l(_):_;else try{O=function(e,t){if("string"!=typeof e)throw new s("username must be a string");if("string"!=typeof t)throw new s("password must be a string");if(0===t.length)throw new s("password cannot be empty");const n=r.createHash("md5");return n.update(`${e}:mongo:${t}`,"utf8"),n.digest("hex")}(m,_)}catch(e){return i(e)}const T=o.isBuffer(t.payload)?new u(t.payload):t.payload,C=g(T.value()),x=parseInt(C.i,10);if(x&&x<4096)return void i(new s(`Server returned an invalid iteration count ${x}`),!1);const E=C.s,N=C.r;if(N.startsWith("nonce"))return void i(new s(`Server returned an invalid nonce: ${N}`),!1);const I=`c=biws,r=${N}`,A=function(e,t,n,o){const i=[e,t.toString("base64"),n].join("_");if(void 0!==b[i])return b[i];const s=r.pbkdf2Sync(e,t,n,S[o],o);v>=200&&(b={},v=0);return b[i]=s,v+=1,s}(O,o.from(E,"base64"),x,e),k=y(e,A,"Client Key"),M=y(e,A,"Server Key"),R=(j=e,D=k,r.createHash(j).update(D).digest());var j,D;const P=[d(m,f),T.value().toString("base64"),I].join(","),B=[I,`p=${function(e,t){o.isBuffer(e)||(e=o.from(e));o.isBuffer(t)||(t=o.from(t));const n=Math.max(e.length,t.length),r=[];for(let o=0;o<n;o+=1)r.push(e[o]^t[o]);return o.from(r).toString("base64")}(k,y(e,R,P))}`].join(","),L=y(e,M,P),q={saslContinue:1,conversationId:t.conversationId,payload:new u(o.from(B))};a.command(`${h}.$cmd`,q,(e,t)=>{const n=w(e,t);if(n)return i(n);const c=t.result,u=g(c.payload.value());if(!function(e,t){if(e.length!==t.length)return!1;if("function"==typeof r.timingSafeEqual)return r.timingSafeEqual(e,t);let n=0;for(let r=0;r<e.length;r++)n|=e[r]^t[r];return 0===n}(o.from(u.v,"base64"),L))return void i(new s("Server returned an invalid signature"));if(!c||!1!==c.done)return i(n,c);const l={saslContinue:1,conversationId:c.conversationId,payload:o.alloc(0)};a.command(`${h}.$cmd`,l,i)})}function g(e){const t={},n=e.split(",");for(let e=0;e<n.length;e++){const r=n[e].split("=");t[r[0]]=r[1]}return t}function y(e,t,n){return r.createHmac(e,t).update(n).digest()}let b={},v=0;const S={sha256:32,sha1:20};function w(e,t){if(e)return e;const n=t.result;return n.$err||n.errmsg?new s(n):void 0}e.exports={ScramSHA1:class extends f{constructor(e){super(e,"sha1")}},ScramSHA256:class extends f{constructor(e){super(e,"sha256")}}}},function(e,t){e.exports=require("fs")},function(e,t){e.exports=require("url")},function(e,t,n){"use strict";const r=n(3).MongoError,o={queryPlanner:"queryPlanner",queryPlannerExtended:"queryPlannerExtended",executionStats:"executionStats",allPlansExecution:"allPlansExecution"};class i{constructor(e){this.verbosity="boolean"==typeof e?e?"allPlansExecution":"queryPlanner":e}static fromOptions(e){if(null==e||void 0===e.explain)return;const t=e.explain;if("boolean"==typeof t||t in o)return new i(e.explain);throw new r(`explain must be one of ${Object.keys(o)} or a boolean`)}}e.exports={Explain:i}},function(e,t,n){"use strict";"undefined"==typeof process||!process.version||0===process.version.indexOf("v0.")||0===process.version.indexOf("v1.")&&0!==process.version.indexOf("v1.8.")?e.exports={nextTick:function(e,t,n,r){if("function"!=typeof e)throw new TypeError('"callback" argument must be a function');var o,i,s=arguments.length;switch(s){case 0:case 1:return process.nextTick(e);case 2:return process.nextTick((function(){e.call(null,t)}));case 3:return process.nextTick((function(){e.call(null,t,n)}));case 4:return process.nextTick((function(){e.call(null,t,n,r)}));default:for(o=new Array(s-1),i=0;i<o.length;)o[i++]=arguments[i];return process.nextTick((function(){e.apply(null,o)}))}}}:e.exports=process},function(e,t,n){var r=n(131),o=r.Buffer;function i(e,t){for(var n in e)t[n]=e[n]}function s(e,t,n){return o(e,t,n)}o.from&&o.alloc&&o.allocUnsafe&&o.allocUnsafeSlow?e.exports=r:(i(r,t),t.Buffer=s),i(o,s),s.from=function(e,t,n){if("number"==typeof e)throw new TypeError("Argument must not be a number");return o(e,t,n)},s.alloc=function(e,t,n){if("number"!=typeof e)throw new TypeError("Argument must be a number");var r=o(e);return void 0!==t?"string"==typeof n?r.fill(t,n):r.fill(t):r.fill(0),r},s.allocUnsafe=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return o(e)},s.allocUnsafeSlow=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return r.SlowBuffer(e)}},function(e,t,n){"use strict";class r{constructor(e){this.time=new Date,this.address=e.address}}e.exports={CMAP_EVENT_NAMES:["connectionPoolCreated","connectionPoolClosed","connectionCreated","connectionReady","connectionClosed","connectionCheckOutStarted","connectionCheckOutFailed","connectionCheckedOut","connectionCheckedIn","connectionPoolCleared"],ConnectionPoolCreatedEvent:class extends r{constructor(e){super(e),this.options=e.options}},ConnectionPoolClosedEvent:class extends r{constructor(e){super(e)}},ConnectionCreatedEvent:class extends r{constructor(e,t){super(e),this.connectionId=t.id}},ConnectionReadyEvent:class extends r{constructor(e,t){super(e),this.connectionId=t.id}},ConnectionClosedEvent:class extends r{constructor(e,t,n){super(e),this.connectionId=t.id,this.reason=n||"unknown"}},ConnectionCheckOutStartedEvent:class extends r{constructor(e){super(e)}},ConnectionCheckOutFailedEvent:class extends r{constructor(e,t){super(e),this.reason=t}},ConnectionCheckedOutEvent:class extends r{constructor(e,t){super(e),this.connectionId=t.id}},ConnectionCheckedInEvent:class extends r{constructor(e,t){super(e),this.connectionId=t.id}},ConnectionPoolClearedEvent:class extends r{constructor(e){super(e)}}}},function(e,t,n){"use strict";const r=n(2).MongoNetworkError,o=new Set([6,7,89,91,189,262,9001,10107,11600,11602,13435,13436,63,150,13388,234,133,43]);e.exports={GET_MORE_RESUMABLE_CODES:o,isResumableError:function(e,t){return e instanceof r||(t>=9?43===e.code||e.hasErrorLabel("ResumableChangeStreamError"):o.has(e.code))}}},function(e,t,n){"use strict";const r=n(27),o=n(2).MongoError,i=n(4).maxWireVersion,s=n(2).ReadPreference,a=n(1).Aspect,c=n(1).defineAspects;class u extends r{constructor(e,t,n){if(super(e,n,{fullResponse:!0}),this.target=e.s.namespace&&e.s.namespace.collection?e.s.namespace.collection:1,this.pipeline=t,this.hasWriteStage=!1,"string"==typeof n.out)this.pipeline=this.pipeline.concat({$out:n.out}),this.hasWriteStage=!0;else if(t.length>0){const e=t[t.length-1];(e.$out||e.$merge)&&(this.hasWriteStage=!0)}if(this.hasWriteStage&&(this.readPreference=s.primary),this.explain&&this.writeConcern)throw new o('"explain" cannot be used on an aggregate call with writeConcern');if(null!=n.cursor&&"object"!=typeof n.cursor)throw new o("cursor options must be an object")}get canRetryRead(){return!this.hasWriteStage}addToPipeline(e){this.pipeline.push(e)}execute(e,t){const n=this.options,r=i(e),o={aggregate:this.target,pipeline:this.pipeline};this.hasWriteStage&&r<8&&(this.readConcern=null),r>=5&&this.hasWriteStage&&this.writeConcern&&Object.assign(o,{writeConcern:this.writeConcern}),!0===n.bypassDocumentValidation&&(o.bypassDocumentValidation=n.bypassDocumentValidation),"boolean"==typeof n.allowDiskUse&&(o.allowDiskUse=n.allowDiskUse),n.hint&&(o.hint=n.hint),this.explain&&(n.full=!1),o.cursor=n.cursor||{},n.batchSize&&!this.hasWriteStage&&(o.cursor.batchSize=n.batchSize),super.executeCommand(e,o,t)}}c(u,[a.READ_OPERATION,a.RETRYABLE,a.EXECUTE_WITH_SELECTION,a.EXPLAINABLE]),e.exports=u},function(e,t,n){"use strict";const r=n(1).OperationBase,o=n(0).applyRetryableWrites,i=n(0).applyWriteConcern,s=n(0).decorateWithCollation,a=n(11).executeCommand,c=n(0).formattedOrderClause,u=n(0).handleCallback,l=n(2).ReadPreference,f=n(4).maxWireVersion,p=n(95).MongoError,d=n(1).Aspect,h=n(1).defineAspects,m=n(0).decorateWithExplain;class g extends r{constructor(e,t,n,r,o){super(o),this.collection=e,this.query=t,this.sort=n,this.doc=r}execute(e){const t=this.collection,n=this.query,r=c(this.sort),d=this.doc;let h=this.options,g={findAndModify:t.collectionName,query:n};r&&(g.sort=r),g.new=!!h.new,g.remove=!!h.remove,g.upsert=!!h.upsert;const y=h.projection||h.fields;y&&(g.fields=y),h.arrayFilters&&(g.arrayFilters=h.arrayFilters),d&&!h.remove&&(g.update=d),h.maxTimeMS&&(g.maxTimeMS=h.maxTimeMS),h.serializeFunctions=h.serializeFunctions||t.s.serializeFunctions,h.checkKeys=!1,h=o(h,t.s.db),h=i(h,{db:t.s.db,collection:t},h),h.writeConcern&&(g.writeConcern=h.writeConcern),!0===h.bypassDocumentValidation&&(g.bypassDocumentValidation=h.bypassDocumentValidation),h.readPreference=l.primary;try{s(g,t,h)}catch(t){return e(t,null)}if(h.hint){if(h.writeConcern&&0===h.writeConcern.w||f(t.s.topology)<8)return void e(new p("The current topology does not support a hint on findAndModify commands"));g.hint=h.hint}if(this.explain){if(f(t.s.topology)<4)return void e(new p("server does not support explain on findAndModify"));g=m(g,this.explain)}a(t.s.db,g,h,(t,n)=>t?u(e,t,null):u(e,null,n))}}h(g,[d.EXPLAINABLE]),e.exports=g},function(e,t,n){"use strict";const r=n(8).EventEmitter,o=n(5).inherits,i=n(0).getSingleProperty,s=n(143),a=n(0).handleCallback,c=n(0).filterOptions,u=n(0).toError,l=n(2).ReadPreference,f=n(2).MongoError,p=n(2).ObjectID,d=n(2).Logger,h=n(61),m=n(0).conditionallyMergeWriteConcern,g=n(0).executeLegacyOperation,y=n(139),b=n(5).deprecate,v=n(0).deprecateOptions,S=n(0).MongoDBNamespace,w=n(140),_=n(29),O=n(46),T=n(142),C=n(11).createListener,x=n(11).ensureIndex,E=n(11).evaluate,N=n(11).profilingInfo,I=n(11).validateDatabaseName,A=n(96),k=n(214),M=n(471),R=n(23),j=n(472),D=n(473),P=n(210),B=n(144).DropCollectionOperation,L=n(144).DropDatabaseOperation,q=n(215),U=n(212),z=n(474),$=n(475),W=n(216),F=n(217),V=n(476),K=n(56),H=["w","wtimeout","fsync","j","writeConcern","readPreference","readPreferenceTags","native_parser","forceServerObjectId","pkFactory","serializeFunctions","raw","bufferMaxEntries","authSource","ignoreUndefined","promoteLongs","promiseLibrary","readConcern","retryMiliSeconds","numberOfRetries","parentDb","noListener","loggerLevel","logger","promoteBuffers","promoteLongs","promoteValues","compression","retryWrites"];function Y(e,t,n){if(n=n||{},!(this instanceof Y))return new Y(e,t,n);r.call(this);const o=n.promiseLibrary||Promise;(n=c(n,H)).promiseLibrary=o,this.s={dbCache:{},children:[],topology:t,options:n,logger:d("Db",n),bson:t?t.bson:null,readPreference:l.fromOptions(n),bufferMaxEntries:"number"==typeof n.bufferMaxEntries?n.bufferMaxEntries:-1,parentDb:n.parentDb||null,pkFactory:n.pkFactory||p,nativeParser:n.nativeParser||n.native_parser,promiseLibrary:o,noListener:"boolean"==typeof n.noListener&&n.noListener,readConcern:O.fromOptions(n),writeConcern:_.fromOptions(n),namespace:new S(e)},I(e),i(this,"serverConfig",this.s.topology),i(this,"bufferMaxEntries",this.s.bufferMaxEntries),i(this,"databaseName",this.s.namespace.db),n.parentDb||this.s.noListener||(t.on("error",C(this,"error",this)),t.on("timeout",C(this,"timeout",this)),t.on("close",C(this,"close",this)),t.on("parseError",C(this,"parseError",this)),t.once("open",C(this,"open",this)),t.once("fullsetup",C(this,"fullsetup",this)),t.once("all",C(this,"all",this)),t.on("reconnect",C(this,"reconnect",this)))}o(Y,r),Y.prototype.on=b((function(){return Y.super_.prototype.on.apply(this,arguments)}),"Listening to events on the Db class has been deprecated and will be removed in the next major version."),Y.prototype.once=b((function(){return Y.super_.prototype.once.apply(this,arguments)}),"Listening to events on the Db class has been deprecated and will be removed in the next major version."),Object.defineProperty(Y.prototype,"topology",{enumerable:!0,get:function(){return this.s.topology}}),Object.defineProperty(Y.prototype,"options",{enumerable:!0,get:function(){return this.s.options}}),Object.defineProperty(Y.prototype,"slaveOk",{enumerable:!0,get:function(){return null!=this.s.options.readPreference&&("primary"!==this.s.options.readPreference||"primary"!==this.s.options.readPreference.mode)}}),Object.defineProperty(Y.prototype,"readConcern",{enumerable:!0,get:function(){return this.s.readConcern}}),Object.defineProperty(Y.prototype,"readPreference",{enumerable:!0,get:function(){return null==this.s.readPreference?l.primary:this.s.readPreference}}),Object.defineProperty(Y.prototype,"writeConcern",{enumerable:!0,get:function(){return this.s.writeConcern}}),Object.defineProperty(Y.prototype,"namespace",{enumerable:!0,get:function(){return this.s.namespace.toString()}}),Y.prototype.command=function(e,t,n){"function"==typeof t&&(n=t,t={}),t=Object.assign({},t);const r=new j(this,e,t);return K(this.s.topology,r,n)},Y.prototype.aggregate=function(e,t,n){"function"==typeof t&&(n=t,t={}),null==t&&null==n&&(t={});const r=new T(this.s.topology,new A(this,e,t),t);if("function"!=typeof n)return r;n(null,r)},Y.prototype.admin=function(){return new(n(218))(this,this.s.topology,this.s.promiseLibrary)};const G=["pkFactory","readPreference","serializeFunctions","strict","readConcern","ignoreUndefined","promoteValues","promoteBuffers","promoteLongs"];Y.prototype.collection=function(e,t,n){"function"==typeof t&&(n=t,t={}),t=t||{},(t=Object.assign({},t)).promiseLibrary=this.s.promiseLibrary,t.readConcern=t.readConcern?new O(t.readConcern.level):this.readConcern,this.s.options.ignoreUndefined&&(t.ignoreUndefined=this.s.options.ignoreUndefined);for(const e of G)e in t||void 0===this.s.options[e]||(t[e]=this.s.options[e]);if(null==(t=m(t,this.s.options))||!t.strict)try{const r=new h(this,this.s.topology,this.databaseName,e,this.s.pkFactory,t);return n&&n(null,r),r}catch(e){if(e instanceof f&&n)return n(e);throw e}if("function"!=typeof n)throw u(`A callback is required in strict mode. While getting collection ${e}`);if(this.serverConfig&&this.serverConfig.isDestroyed())return n(new f("topology was destroyed"));const r=Object.assign({},t,{nameOnly:!0});this.listCollections({name:e},r).toArray((r,o)=>{if(null!=r)return a(n,r,null);if(0===o.length)return a(n,u(`Collection ${e} does not exist. Currently in strict mode.`),null);try{return a(n,null,new h(this,this.s.topology,this.databaseName,e,this.s.pkFactory,t))}catch(r){return a(n,r,null)}})},Y.prototype.createCollection=v({name:"Db.createCollection",deprecatedOptions:["autoIndexId","strict","w","wtimeout","j"],optionsIndex:1},(function(e,t,n){"function"==typeof t&&(n=t,t={}),(t=t||{}).promiseLibrary=t.promiseLibrary||this.s.promiseLibrary,t.readConcern=t.readConcern?new O(t.readConcern.level):this.readConcern;const r=new D(this,e,t);return K(this.s.topology,r,n)})),Y.prototype.stats=function(e,t){"function"==typeof e&&(t=e,e={});const n={dbStats:!0};null!=(e=e||{}).scale&&(n.scale=e.scale),null==e.readPreference&&this.s.readPreference&&(e.readPreference=this.s.readPreference);const r=new R(this,e,null,n);return K(this.s.topology,r,t)},Y.prototype.listCollections=function(e,t){return e=e||{},t=t||{},new s(this.s.topology,new z(this,e,t),t)},Y.prototype.eval=b((function(e,t,n,r){const o=Array.prototype.slice.call(arguments,1);return r="function"==typeof o[o.length-1]?o.pop():void 0,t=o.length?o.shift():t,n=o.length&&o.shift()||{},g(this.s.topology,E,[this,e,t,n,r])}),"Db.eval is deprecated as of MongoDB version 3.2"),Y.prototype.renameCollection=function(e,t,n,r){"function"==typeof n&&(r=n,n={}),(n=Object.assign({},n,{readPreference:l.PRIMARY})).new_collection=!0;const o=new F(this.collection(e),t,n);return K(this.s.topology,o,r)},Y.prototype.dropCollection=function(e,t,n){"function"==typeof t&&(n=t,t={});const r=new B(this,e,t=t||{});return K(this.s.topology,r,n)},Y.prototype.dropDatabase=function(e,t){"function"==typeof e&&(t=e,e={});const n=new L(this,e=e||{});return K(this.s.topology,n,t)},Y.prototype.collections=function(e,t){"function"==typeof e&&(t=e,e={});const n=new M(this,e=e||{});return K(this.s.topology,n,t)},Y.prototype.executeDbAdminCommand=function(e,t,n){"function"==typeof t&&(n=t,t={}),(t=t||{}).readPreference=l.resolve(this,t);const r=new q(this,e,t);return K(this.s.topology,r,n)},Y.prototype.createIndex=function(e,t,n,r){"function"==typeof n&&(r=n,n={}),n=n?Object.assign({},n):{};const o=new P(this,e,t,n);return K(this.s.topology,o,r)},Y.prototype.ensureIndex=b((function(e,t,n,r){return"function"==typeof n&&(r=n,n={}),n=n||{},g(this.s.topology,x,[this,e,t,n,r])}),"Db.ensureIndex is deprecated as of MongoDB version 3.0 / driver version 2.0"),Y.prototype.addChild=function(e){if(this.s.parentDb)return this.s.parentDb.addChild(e);this.s.children.push(e)},Y.prototype.addUser=function(e,t,n,r){"function"==typeof n&&(r=n,n={}),n=n||{},"string"==typeof e&&null!=t&&"object"==typeof t&&(n=t,t=null);const o=new k(this,e,t,n);return K(this.s.topology,o,r)},Y.prototype.removeUser=function(e,t,n){"function"==typeof t&&(n=t,t={});const r=new W(this,e,t=t||{});return K(this.s.topology,r,n)},Y.prototype.setProfilingLevel=function(e,t,n){"function"==typeof t&&(n=t,t={});const r=new V(this,e,t=t||{});return K(this.s.topology,r,n)},Y.prototype.profilingInfo=b((function(e,t){return"function"==typeof e&&(t=e,e={}),e=e||{},g(this.s.topology,N,[this,e,t])}),"Db.profilingInfo is deprecated. Query the system.profile collection directly."),Y.prototype.profilingLevel=function(e,t){"function"==typeof e&&(t=e,e={});const n=new $(this,e=e||{});return K(this.s.topology,n,t)},Y.prototype.indexInformation=function(e,t,n){"function"==typeof t&&(n=t,t={});const r=new U(this,e,t=t||{});return K(this.s.topology,r,n)},Y.prototype.unref=function(){this.s.topology.unref()},Y.prototype.watch=function(e,t){return e=e||[],t=t||{},Array.isArray(e)||(t=e,e=[]),new y(this,e,t)},Y.prototype.getLogger=function(){return this.s.logger},Y.SYSTEM_NAMESPACE_COLLECTION=w.SYSTEM_NAMESPACE_COLLECTION,Y.SYSTEM_INDEX_COLLECTION=w.SYSTEM_INDEX_COLLECTION,Y.SYSTEM_PROFILE_COLLECTION=w.SYSTEM_PROFILE_COLLECTION,Y.SYSTEM_USER_COLLECTION=w.SYSTEM_USER_COLLECTION,Y.SYSTEM_COMMAND_COLLECTION=w.SYSTEM_COMMAND_COLLECTION,Y.SYSTEM_JS_COLLECTION=w.SYSTEM_JS_COLLECTION,e.exports=Y},function(e,t,n){"use strict";const r=n(2).Server,o=n(26),i=n(35).TopologyBase,s=n(35).Store,a=n(2).MongoError,c=n(0).MAX_JS_INT,u=n(0).translateOptions,l=n(0).filterOptions,f=n(0).mergeOptions;var p=["ha","haInterval","acceptableLatencyMS","poolSize","ssl","checkServerIdentity","sslValidate","sslCA","sslCRL","sslCert","ciphers","ecdhCurve","sslKey","sslPass","socketOptions","bufferMaxEntries","store","auto_reconnect","autoReconnect","emitError","keepAlive","keepAliveInitialDelay","noDelay","connectTimeoutMS","socketTimeoutMS","family","loggerLevel","logger","reconnectTries","reconnectInterval","monitoring","appname","domainsEnabled","servername","promoteLongs","promoteValues","promoteBuffers","compression","promiseLibrary","monitorCommands"];class d extends i{constructor(e,t,n){super();const i=(n=l(n,p)).promiseLibrary;var d={force:!1,bufferMaxEntries:"number"==typeof n.bufferMaxEntries?n.bufferMaxEntries:c},h=n.store||new s(this,d);if(-1!==e.indexOf("/"))null!=t&&"object"==typeof t&&(n=t,t=null);else if(null==t)throw a.create({message:"port must be specified",driver:!0});var m="boolean"!=typeof n.auto_reconnect||n.auto_reconnect;m="boolean"==typeof n.autoReconnect?n.autoReconnect:m;var g=f({},{host:e,port:t,disconnectHandler:h,cursorFactory:o,reconnect:m,emitError:"boolean"!=typeof n.emitError||n.emitError,size:"number"==typeof n.poolSize?n.poolSize:5,monitorCommands:"boolean"==typeof n.monitorCommands&&n.monitorCommands});g=u(g,n);var y=n.socketOptions&&Object.keys(n.socketOptions).length>0?n.socketOptions:n;g=u(g,y),this.s={coreTopology:new r(g),sCapabilities:null,clonedOptions:g,reconnect:g.reconnect,emitError:g.emitError,poolSize:g.size,storeOptions:d,store:h,host:e,port:t,options:n,sessionPool:null,sessions:new Set,promiseLibrary:i||Promise}}connect(e,t){var n=this;"function"==typeof e&&(t=e,e={}),null==e&&(e=this.s.clonedOptions),"function"!=typeof t&&(t=null),e=Object.assign({},this.s.clonedOptions,e),n.s.options=e,n.s.storeOptions.bufferMaxEntries="number"==typeof e.bufferMaxEntries?e.bufferMaxEntries:-1;var r=function(){return function(e){["timeout","error","close"].forEach((function(e){n.s.coreTopology.removeListener(e,a[e])})),n.s.coreTopology.removeListener("connect",r);try{t(e)}catch(e){process.nextTick((function(){throw e}))}}},o=function(e){return function(t){"error"!==e&&n.emit(e,t)}},i=function(){n.s.store.flush()},s=function(e){return function(t,r){n.emit(e,t,r)}},a={timeout:r("timeout"),error:r("error"),close:r("close")};["timeout","error","close","serverOpening","serverDescriptionChanged","serverHeartbeatStarted","serverHeartbeatSucceeded","serverHeartbeatFailed","serverClosed","topologyOpening","topologyClosed","topologyDescriptionChanged","commandStarted","commandSucceeded","commandFailed"].forEach((function(e){n.s.coreTopology.removeAllListeners(e)})),n.s.coreTopology.once("timeout",a.timeout),n.s.coreTopology.once("error",a.error),n.s.coreTopology.once("close",a.close),n.s.coreTopology.once("connect",(function(){["timeout","error","close","destroy"].forEach((function(e){n.s.coreTopology.removeAllListeners(e)})),n.s.coreTopology.on("timeout",o("timeout")),n.s.coreTopology.once("error",o("error")),n.s.coreTopology.on("close",o("close")),n.s.coreTopology.on("destroy",i),n.emit("open",null,n);try{t(null,n)}catch(e){process.nextTick((function(){throw e}))}})),n.s.coreTopology.on("reconnect",(function(){n.emit("reconnect",n),n.s.store.execute()})),n.s.coreTopology.on("reconnectFailed",(function(e){n.emit("reconnectFailed",e),n.s.store.flush(e)})),n.s.coreTopology.on("serverDescriptionChanged",s("serverDescriptionChanged")),n.s.coreTopology.on("serverHeartbeatStarted",s("serverHeartbeatStarted")),n.s.coreTopology.on("serverHeartbeatSucceeded",s("serverHeartbeatSucceeded")),n.s.coreTopology.on("serverHeartbeatFailed",s("serverHeartbeatFailed")),n.s.coreTopology.on("serverOpening",s("serverOpening")),n.s.coreTopology.on("serverClosed",s("serverClosed")),n.s.coreTopology.on("topologyOpening",s("topologyOpening")),n.s.coreTopology.on("topologyClosed",s("topologyClosed")),n.s.coreTopology.on("topologyDescriptionChanged",s("topologyDescriptionChanged")),n.s.coreTopology.on("commandStarted",s("commandStarted")),n.s.coreTopology.on("commandSucceeded",s("commandSucceeded")),n.s.coreTopology.on("commandFailed",s("commandFailed")),n.s.coreTopology.on("attemptReconnect",s("attemptReconnect")),n.s.coreTopology.on("monitoring",s("monitoring")),n.s.coreTopology.connect(e)}}Object.defineProperty(d.prototype,"poolSize",{enumerable:!0,get:function(){return this.s.coreTopology.connections().length}}),Object.defineProperty(d.prototype,"autoReconnect",{enumerable:!0,get:function(){return this.s.reconnect}}),Object.defineProperty(d.prototype,"host",{enumerable:!0,get:function(){return this.s.host}}),Object.defineProperty(d.prototype,"port",{enumerable:!0,get:function(){return this.s.port}}),e.exports=d},function(e,t,n){"use strict";class r extends Error{constructor(e){super(e),this.name="MongoCryptError",Error.captureStackTrace(this,this.constructor)}}e.exports={debug:function(e){process.env.MONGODB_CRYPT_DEBUG&&console.log(e)},databaseNamespace:function(e){return e.split(".")[0]},collectionNamespace:function(e){return e.split(".").slice(1).join(".")},MongoCryptError:r,promiseOrCallback:function(e,t){if("function"!=typeof e)return new Promise((e,n)=>{t((function(t,r){return null!=t?n(t):arguments.length>2?e(Array.prototype.slice.call(arguments,1)):void e(r)}))});t((function(t){if(null==t)e.apply(this,arguments);else try{e(t)}catch(e){return process.nextTick(()=>{throw e})}}))}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.redisSplitterOptions=t.noSplitSplitterOptions=t.mongoSplitterOptions=t.sqliteSplitterOptions=t.postgreSplitterOptions=t.mssqlSplitterOptions=t.mysqlSplitterOptions=t.defaultSplitterOptions=void 0,t.defaultSplitterOptions={stringsBegins:["'"],stringsEnds:{"'":"'"},stringEscapes:{"'":"'"},allowSemicolon:!0,allowCustomDelimiter:!1,allowGoDelimiter:!1,allowDollarDollarString:!1,noSplit:!1,doubleDashComments:!0,multilineComments:!0,javaScriptComments:!1,returnRichInfo:!1,splitByLines:!1},t.mysqlSplitterOptions=Object.assign(Object.assign({},t.defaultSplitterOptions),{allowCustomDelimiter:!0,stringsBegins:["'","`"],stringsEnds:{"'":"'","`":"`"},stringEscapes:{"'":"\\","`":"`"}}),t.mssqlSplitterOptions=Object.assign(Object.assign({},t.defaultSplitterOptions),{allowSemicolon:!1,allowGoDelimiter:!0,stringsBegins:["'","["],stringsEnds:{"'":"'","[":"]"},stringEscapes:{"'":"'"}}),t.postgreSplitterOptions=Object.assign(Object.assign({},t.defaultSplitterOptions),{allowDollarDollarString:!0,stringsBegins:["'",'"'],stringsEnds:{"'":"'",'"':'"'},stringEscapes:{"'":"'",'"':'"'}}),t.sqliteSplitterOptions=Object.assign(Object.assign({},t.defaultSplitterOptions),{stringsBegins:["'",'"'],stringsEnds:{"'":"'",'"':'"'},stringEscapes:{"'":"'",'"':'"'}}),t.mongoSplitterOptions=Object.assign(Object.assign({},t.defaultSplitterOptions),{stringsBegins:["'",'"'],stringsEnds:{"'":"'",'"':'"'},stringEscapes:{"'":"\\",'"':"\\"}}),t.noSplitSplitterOptions=Object.assign(Object.assign({},t.defaultSplitterOptions),{noSplit:!0}),t.redisSplitterOptions=Object.assign(Object.assign({},t.defaultSplitterOptions),{splitByLines:!0})},function(e,t,n){var r=n(147);e.exports=function(e){return r(e,5)}},function(e,t,n){var r=n(63),o=n(242),i=n(243),s=n(244),a=n(245),c=n(246);function u(e){var t=this.__data__=new r(e);this.size=t.size}u.prototype.clear=o,u.prototype.delete=i,u.prototype.get=s,u.prototype.has=a,u.prototype.set=c,e.exports=u},function(e,t,n){var r=n(31)(n(19),"Map");e.exports=r},function(e,t,n){var r=n(253),o=n(260),i=n(262),s=n(263),a=n(264);function c(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}c.prototype.clear=r,c.prototype.delete=o,c.prototype.get=i,c.prototype.has=s,c.prototype.set=a,e.exports=c},function(e,t,n){var r=n(107),o=n(65),i=Object.prototype.hasOwnProperty;e.exports=function(e,t,n){var s=e[t];i.call(e,t)&&o(s,n)&&(void 0!==n||t in e)||r(e,t,n)}},function(e,t,n){var r=n(151);e.exports=function(e,t,n){"__proto__"==t&&r?r(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}},function(e,t,n){var r=n(268),o=n(15),i=Object.prototype,s=i.hasOwnProperty,a=i.propertyIsEnumerable,c=r(function(){return arguments}())?r:function(e){return o(e)&&s.call(e,"callee")&&!a.call(e,"callee")};e.exports=c},function(e,t,n){(function(e){var r=n(19),o=n(269),i=t&&!t.nodeType&&t,s=i&&"object"==typeof e&&e&&!e.nodeType&&e,a=s&&s.exports===i?r.Buffer:void 0,c=(a?a.isBuffer:void 0)||o;e.exports=c}).call(this,n(62)(e))},function(e,t){e.exports=function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991}},function(e,t){var n=Object.prototype;e.exports=function(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||n)}},function(e,t,n){var r=n(152),o=n(274),i=n(38);e.exports=function(e){return i(e)?r(e,!0):o(e)}},function(e,t,n){var r=n(279),o=n(155),i=Object.prototype.propertyIsEnumerable,s=Object.getOwnPropertySymbols,a=s?function(e){return null==e?[]:(e=Object(e),r(s(e),(function(t){return i.call(e,t)})))}:o;e.exports=a},function(e,t){e.exports=function(e,t){for(var n=-1,r=t.length,o=e.length;++n<r;)e[o+n]=t[n];return e}},function(e,t,n){var r=n(154)(Object.getPrototypeOf,Object);e.exports=r},function(e,t,n){var r=n(161);e.exports=function(e){var t=new e.constructor(e.byteLength);return new r(t).set(new r(e)),t}},function(e,t,n){var r=n(12),o=n(71),i=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,s=/^\w*$/;e.exports=function(e,t){if(r(e))return!1;var n=typeof e;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=e&&!o(e))||(s.test(e)||!i.test(e)||null!=t&&e in Object(t))}},function(e,t,n){var r=n(105),o=n(321),i=n(322);function s(e){var t=-1,n=null==e?0:e.length;for(this.__data__=new r;++t<n;)this.add(e[t])}s.prototype.add=s.prototype.push=o,s.prototype.has=i,e.exports=s},function(e,t){e.exports=function(e,t){return e.has(t)}},function(e,t,n){"use strict";var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))},o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.DatabaseAnalyser=void 0;const i=o(n(333)),s=o(n(359)),a=o(n(177)),c=o(n(52)),u=["tables","collections","views","matviews","functions","procedures","triggers"],l=e=>t=>(0,a.default)(t,e);class f{constructor(e,t,n){this.pool=e,this.driver=t,this.singleObjectId=null,this.dialect=(null==t?void 0:t.dialectByVersion)&&(null==t?void 0:t.dialectByVersion(n))||(null==t?void 0:t.dialect)}_runAnalysis(){return r(this,void 0,void 0,(function*(){return f.createEmptyStructure()}))}_getFastSnapshot(){return r(this,void 0,void 0,(function*(){return null}))}_computeSingleObjectId(){return r(this,void 0,void 0,(function*(){}))}addEngineField(e){var t;if(null===(t=this.driver)||void 0===t?void 0:t.engine){for(const t of u)if(e[t])for(const n of e[t])n.engine=this.driver.engine;return e.engine=this.driver.engine,e}}fullAnalysis(){return r(this,void 0,void 0,(function*(){return this.addEngineField(yield this._runAnalysis())}))}singleObjectAnalysis(e,t){var n,o;return r(this,void 0,void 0,(function*(){this.singleObjectFilter=Object.assign(Object.assign({},e),{typeField:t}),yield this._computeSingleObjectId();const r=this.addEngineField(yield this._runAnalysis());return 1==(null===(n=r[t])||void 0===n?void 0:n.length)?r[t][0]:null===(o=r[t])||void 0===o?void 0:o.find(t=>t.pureName==e.pureName&&t.schemaName==e.schemaName)}))}incrementalAnalysis(e){return r(this,void 0,void 0,(function*(){this.structure=e;const t=yield this.getModifications();if(null==t)return this.structure=null,this.addEngineField(yield this._runAnalysis());const n=t.filter(e=>"setTableRowCounts"!=e.action),r=t.find(e=>"setTableRowCounts"==e.action);let o=null;if(r){const t=(i=e,s=r.rowCounts,Object.assign(Object.assign({},i),{tables:(i.tables||[]).map(e=>{var t,n;return Object.assign(Object.assign({},e),{tableRowCount:null!==(n=null===(t=s.find(t=>t.objectId==e.objectId))||void 0===t?void 0:t.tableRowCount)&&void 0!==n?n:e.tableRowCount})})}));(function(e,t){for(const n of e.tables||[]){const e=(t.tables||[]).find(e=>e.objectId==n.objectId);if((null==n?void 0:n.tableRowCount)!==(null==e?void 0:e.tableRowCount))return!0}return!1})(e,t)&&(o=t)}var i,s;return 0==n.length?o?this.addEngineField(o):null:(this.modifications=n,o&&(this.structure=o),console.log("DB modifications detected:",this.modifications),this.addEngineField(this.mergeAnalyseResult(yield this._runAnalysis())))}))}mergeAnalyseResult(e){if(null==this.structure)return Object.assign(Object.assign({},f.createEmptyStructure()),e);const t={};for(const n of u){const r=this.modifications.filter(e=>"remove"==e.action&&e.objectTypeField==n).map(e=>e.objectId),o=e[n]||[],s=[...r,...o.map(e=>e.objectId)];t[n]=(0,i.default)([...(this.structure[n]||[]).filter(e=>!s.includes(e.objectId)),...o],e=>e.pureName);for(const e of t[n]){const t=(this.structure[n]||[]).find(t=>t.objectId==e.objectId);if(t)for(const n in t)e[n]||(e[n]=t[n])}}return t}getRequestedObjectPureNames(e,t){if(this.singleObjectFilter){const{typeField:t,pureName:n}=this.singleObjectFilter;if(t==e)return[n]}return this.modifications?this.modifications.filter(t=>t.objectTypeField==e).filter(e=>e.newName).map(e=>e.newName.pureName):t}containsObjectIdCondition(e){return" is not null"!=this.createQueryCore("=OBJECT_ID_CONDITION",e)}createQuery(e,t){return this.createQueryCore(e,t)}createQueryCore(e,t){if(this.singleObjectFilter){const{typeField:n}=this.singleObjectFilter;return this.singleObjectId&&(t&&t.includes(n))?e.replace(/=OBJECT_ID_CONDITION/g,` = '${this.singleObjectId}'`):null}if(!this.modifications||!t||0==this.modifications.length)return e.replace(/=OBJECT_ID_CONDITION/g," is not null");if(this.modifications.some(e=>t.includes(e.objectTypeField)&&"all"==e.action))return e.replace(/=OBJECT_ID_CONDITION/g," is not null");const n=this.modifications.filter(e=>t.includes(e.objectTypeField)&&("add"==e.action||"change"==e.action)).map(e=>e.objectId);return 0==n.length?e.replace(/=OBJECT_ID_CONDITION/g," = '0'"):e.replace(/=OBJECT_ID_CONDITION/g,` in (${n.map(e=>`'${e}'`).join(",")})`)}getDeletedObjectsForField(e,t){const n=e[t];return n&&this.structure[t]?this.structure[t].filter(e=>!n.find(t=>e.objectId==t.objectId)).map(e=>({oldName:(0,a.default)(e,["schemaName","pureName"]),objectId:e.objectId,action:"remove",objectTypeField:t})):[]}getDeletedObjects(e){return[...this.getDeletedObjectsForField(e,"tables"),...this.getDeletedObjectsForField(e,"collections"),...this.getDeletedObjectsForField(e,"views"),...this.getDeletedObjectsForField(e,"matviews"),...this.getDeletedObjectsForField(e,"procedures"),...this.getDeletedObjectsForField(e,"functions"),...this.getDeletedObjectsForField(e,"triggers")]}feedback(e){this.pool.feedback&&this.pool.feedback(e)}getModifications(){return r(this,void 0,void 0,(function*(){const e=yield this._getFastSnapshot();if(!e)return null;const t=[];for(const n in e){const r=e[n];if(null!==r){if(void 0!==r)for(const e of r){const{objectId:r,schemaName:o,pureName:i,contentHash:s}=e,c=this.structure[n].find(e=>e.objectId==r);if(c&&s&&c.contentHash==s)continue;const u=c?{newName:{schemaName:o,pureName:i},oldName:(0,a.default)(c,["schemaName","pureName"]),action:"change",objectTypeField:n,objectId:r}:{newName:{schemaName:o,pureName:i},action:"add",objectTypeField:n,objectId:r};t.push(u)}}else t.push({objectTypeField:n,action:"all"})}const n=(e.tables||[]).filter(e=>null!=e.tableRowCount).map(e=>({objectId:e.objectId,tableRowCount:e.tableRowCount}));return n.length>0&&t.push({action:"setTableRowCounts",rowCounts:n}),[...(0,c.default)(t),...this.getDeletedObjects(e)]}))}safeQuery(e){return r(this,void 0,void 0,(function*(){try{return yield this.driver.query(this.pool,e)}catch(e){return console.log("Error running analyser query",e.message),{rows:[]}}}))}static createEmptyStructure(){return{tables:[],collections:[],views:[],matviews:[],functions:[],procedures:[],triggers:[],schemas:[]}}static byTableFilter(e){return t=>t.pureName==e.pureName&&t.schemaName==t.schemaName}static extractPrimaryKeys(e,t){const n=t.filter(f.byTableFilter(e));if(0!=n.length)return Object.assign(Object.assign({},(0,a.default)(n[0],["constraintName","schemaName","pureName"])),{constraintType:"primaryKey",columns:n.map(l("columnName"))})}static extractForeignKeys(e,t){const n=(0,s.default)(t.filter(f.byTableFilter(e)),"constraintName");return Object.keys(n).map(e=>Object.assign(Object.assign({constraintName:e,constraintType:"foreignKey"},(0,a.default)(n[e][0],["constraintName","schemaName","pureName","refSchemaName","refTableName","updateAction","deleteAction"])),{columns:n[e].map(l(["columnName","refColumnName"]))}))}}t.DatabaseAnalyser=f},function(e,t,n){var r=n(336),o=n(344),i=n(74),s=n(12),a=n(347);e.exports=function(e){return"function"==typeof e?e:null==e?i:"object"==typeof e?s(e)?o(e[0],e[1]):r(e):a(e)}},function(e,t,n){var r=n(338),o=n(15);e.exports=function e(t,n,i,s,a){return t===n||(null==t||null==n||!o(t)&&!o(n)?t!=t&&n!=n:r(t,n,i,s,e,a))}},function(e,t){e.exports=function(e){var t=-1,n=Array(e.size);return e.forEach((function(e){n[++t]=e})),n}},function(e,t,n){var r=n(25),o=n(15);e.exports=function(e){return"number"==typeof e||o(e)&&"[object Number]"==r(e)}},function(e,t,n){var r,o,i=n(369),s=n(370),a=0,c=0;e.exports=function(e,t,n){var u=t&&n||0,l=t||[],f=(e=e||{}).node||r,p=void 0!==e.clockseq?e.clockseq:o;if(null==f||null==p){var d=i();null==f&&(f=r=[1|d[0],d[1],d[2],d[3],d[4],d[5]]),null==p&&(p=o=16383&(d[6]<<8|d[7]))}var h=void 0!==e.msecs?e.msecs:(new Date).getTime(),m=void 0!==e.nsecs?e.nsecs:c+1,g=h-a+(m-c)/1e4;if(g<0&&void 0===e.clockseq&&(p=p+1&16383),(g<0||h>a)&&void 0===e.nsecs&&(m=0),m>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");a=h,c=m,o=p;var y=(1e4*(268435455&(h+=122192928e5))+m)%4294967296;l[u++]=y>>>24&255,l[u++]=y>>>16&255,l[u++]=y>>>8&255,l[u++]=255&y;var b=h/4294967296*1e4&268435455;l[u++]=b>>>8&255,l[u++]=255&b,l[u++]=b>>>24&15|16,l[u++]=b>>>16&255,l[u++]=p>>>8|128,l[u++]=255&p;for(var v=0;v<6;++v)l[u+v]=f[v];return t||s(l)}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.dumpSqlFromDefinition=t.dumpSqlRelation=t.dumpSqlSourceRef=t.dumpSqlSourceDef=void 0;const r=n(76),o=n(127);function i(e,t){let n=0;if(null!=t.name&&n++,null!=t.subQuery&&n++,null!=t.subQueryString&&n++,1!=n)throw new Error("sqltree.Source should have exactly one source");null!=t.name&&e.put("%f",t.name),t.subQuery&&(e.put("("),(0,r.dumpSqlSelect)(e,t.subQuery),e.put(")")),t.subQueryString&&(e.put("("),e.putRaw(t.subQueryString),e.put(")")),t.alias&&e.put(" %i",t.alias)}function s(e,t){e.put("&n %k ",t.joinType),i(e,t),t.conditions&&t.conditions.length>0&&(e.put(" ^on "),e.putCollection(" ^and ",t.conditions,t=>(0,o.dumpSqlCondition)(e,t)))}t.dumpSqlSourceDef=i,t.dumpSqlSourceRef=function(e,t){return t.alias?(e.put("%i",t.alias),!0):!!t.name&&(e.put("%f",t.name),!0)},t.dumpSqlRelation=s,t.dumpSqlFromDefinition=function(e,t){i(e,t),e.put(" "),t.relations&&t.relations.forEach(t=>s(e,t))}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.dumpSqlCondition=void 0;const r=n(180),o=n(76);t.dumpSqlCondition=function e(t,n){switch(n.conditionType){case"binary":(0,r.dumpSqlExpression)(t,n.left),t.put(" %s ",n.operator),(0,r.dumpSqlExpression)(t,n.right);break;case"isNull":(0,r.dumpSqlExpression)(t,n.expr),t.put(" ^is ^null");break;case"isNotNull":(0,r.dumpSqlExpression)(t,n.expr),t.put(" ^is ^not ^null");break;case"isEmpty":t.put("^trim("),(0,r.dumpSqlExpression)(t,n.expr),t.put(") = ''");break;case"isNotEmpty":t.put("^trim("),(0,r.dumpSqlExpression)(t,n.expr),t.put(") <> ''");break;case"and":case"or":t.putCollection(` ^${n.conditionType} `,n.conditions,n=>{t.putRaw("("),e(t,n),t.putRaw(")")});break;case"like":(0,r.dumpSqlExpression)(t,n.left),t.put(t.dialect.ilike?" ^ilike ":" ^like "),(0,r.dumpSqlExpression)(t,n.right);break;case"notLike":(0,r.dumpSqlExpression)(t,n.left),t.put(" ^not ^like "),(0,r.dumpSqlExpression)(t,n.right);break;case"not":t.put("^not ("),e(t,n.condition),t.put(")");break;case"exists":t.put("^exists ("),(0,o.dumpSqlSelect)(t,n.subQuery),t.put(")");break;case"notExists":t.put("^not ^exists ("),(0,o.dumpSqlSelect)(t,n.subQuery),t.put(")");break;case"between":(0,r.dumpSqlExpression)(t,n.expr),t.put(" ^between "),(0,r.dumpSqlExpression)(t,n.left),t.put(" ^and "),(0,r.dumpSqlExpression)(t,n.right)}}},function(e,t,n){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.modelCompareDbDiffOptions=t.matchPairedObjects=t.getAlterDatabaseScript=t.getAlterTableScript=t.createAlterDatabasePlan=t.createAlterTablePlan=t.testEqualSqlObjects=t.testEqualTables=t.testEqualTypes=t.testEqualColumns=t.generateDbPairingId=t.generateTablePairingId=void 0;const o=r(n(125)),i=n(386),s=r(n(388)),a=r(n(184)),c=r(n(102)),u=r(n(396)),l=r(n(177));function f(e){var t,n,r,i,s;return e?e.pairingId?e:Object.assign(Object.assign({},e),{columns:null===(t=e.columns)||void 0===t?void 0:t.map(e=>Object.assign(Object.assign({},e),{pairingId:e.pairingId||(0,o.default)()})),foreignKeys:null===(n=e.foreignKeys)||void 0===n?void 0:n.map(e=>Object.assign(Object.assign({},e),{pairingId:e.pairingId||(0,o.default)()})),checks:null===(r=e.checks)||void 0===r?void 0:r.map(e=>Object.assign(Object.assign({},e),{pairingId:e.pairingId||(0,o.default)()})),indexes:null===(i=e.indexes)||void 0===i?void 0:i.map(e=>Object.assign(Object.assign({},e),{pairingId:e.pairingId||(0,o.default)()})),uniques:null===(s=e.uniques)||void 0===s?void 0:s.map(e=>Object.assign(Object.assign({},e),{pairingId:e.pairingId||(0,o.default)()})),pairingId:e.pairingId||(0,o.default)()}):e}function p(e){return e.objectTypeField?Object.assign(Object.assign({},e),{pairingId:e.pairingId||(0,o.default)()}):e}function d(e,t,n){return n.ignoreCase?(e||"").toLowerCase()==(t||"").toLowerCase():e==t}function h(e,t,n){return null==e||null==t?e==t:function(e,t,n){return"ignore"==n.schemaMode&&(e=null),"ignoreImplicit"==n.schemaMode&&e==n.leftImplicitSchema&&(e=null),"ignore"==n.schemaMode&&(t=null),"ignoreImplicit"==n.schemaMode&&t==n.rightImplicitSchema&&(t=null),d(e,t,n)}(e.schemaName,t.schemaName,n)&&d(e.pureName,t.pureName,n)}function m(e,t,n,r,o={}){if(n&&!d(e.columnName,t.columnName,o))return!1;if(e.computedExpression!=t.computedExpression)return console.debug(`Column ${e.pureName}.${e.columnName}, ${t.pureName}.${t.columnName}: different computed expression: ${e.computedExpression}, ${t.computedExpression}`),!1;if(null!=e.computedExpression)return!0;if(r){if(null==e.defaultValue){if(e.defaultValue!=t.defaultValue)return console.debug(`Column ${e.pureName}.${e.columnName}, ${t.pureName}.${t.columnName}: different default value: ${e.defaultValue}, ${t.defaultValue}`),!1}else if(e.defaultValue!=t.defaultValue)return console.debug(`Column ${e.pureName}.${e.columnName}, ${t.pureName}.${t.columnName}: different default value: ${e.defaultValue}, ${t.defaultValue}`),!1;if(e.defaultConstraint!=t.defaultConstraint)return console.debug(`Column ${e.pureName}.${e.columnName}, ${t.pureName}.${t.columnName}: different default constraint: ${e.defaultConstraint}, ${t.defaultConstraint}`),!1}return(e.notNull||!1)!=(t.notNull||!1)?(console.debug(`Column ${e.pureName}.${e.columnName}, ${t.pureName}.${t.columnName}: different nullability: ${e.notNull}, ${t.notNull}`),!1):(e.autoIncrement||!1)!=(t.autoIncrement||!1)?(console.debug(`Column ${e.pureName}.${e.columnName}, ${t.pureName}.${t.columnName}: different autoincrement: ${e.autoIncrement}, ${t.autoIncrement}`),!1):(e.isSparse||!1)!=(t.isSparse||!1)?(console.debug(`Column ${e.pureName}.${e.columnName}, ${t.pureName}.${t.columnName}: different is_sparse: ${e.isSparse}, ${t.isSparse}`),!1):(e.isUnsigned||!1)!=(t.isUnsigned||!1)?(console.debug(`Column ${e.pureName}.${e.columnName}, ${t.pureName}.${t.columnName}: different unsigned: ${e.isUnsigned}, ${t.isUnsigned}`),!1):(e.isZerofill||!1)!=(t.isZerofill||!1)?(console.debug(`Column ${e.pureName}.${e.columnName}, ${t.pureName}.${t.columnName}: different zerofill: ${e.isZerofill}, ${t.isZerofill}`),!1):(e.columnComment||"")!=(t.columnComment||"")?(console.debug(`Column ${e.pureName}.${e.columnName}, ${t.pureName}.${t.columnName}: different comment: ${e.columnComment}, ${t.columnComment}`),!1):!!g(e,t,o)}function g(e,t,n={}){return!!n.ignoreDataTypes||((e.dataType||"").toLowerCase()==(t.dataType||"").toLowerCase()||(console.debug(`Column ${e.pureName}.${e.columnName}, ${t.pureName}.${t.columnName}: different data type: ${e.dataType}, ${t.dataType}`),!1))}function y(e){const t=[];return e.primaryKey&&t.push(e.primaryKey),e.foreignKeys&&t.push(...e.foreignKeys),e.indexes&&t.push(...e.indexes),e.uniques&&t.push(...e.uniques),e.checks&&t.push(...e.checks),t}function b(e,t,n=null){const r=[];for(const o of e){const e=t.find(e=>e.pairingId==o.pairingId||n&&n(o,e));e?r.push([o,e]):r.push([o,null])}for(const e of t)r.find(t=>t[1]==e)||r.push([null,e]);return r}function v(e,t,n){var r,o,i;const s=n.preloadedRowsKey||(null===(o=null===(r=n.primaryKey)||void 0===r?void 0:r.columns)||void 0===o?void 0:o.map(e=>e.columnName));(null===(i=n.preloadedRows)||void 0===i?void 0:i.length)>0&&(null==s?void 0:s.length)>0&&e.fillPreloadedRows(n,null==t?void 0:t.preloadedRows,n.preloadedRows,s,n.preloadedRowsInsertOnly)}function S(e,t,n,r){const o=b(t.columns,n.columns),i=b(y(t),y(n),(e,t)=>"primaryKey"==e.constraintType&&"primaryKey"==t.constraintType);r.noDropConstraint||i.filter(e=>null==e[1]).forEach(t=>e.dropConstraint(t[0])),r.noDropColumn||o.filter(e=>null==e[1]).forEach(t=>e.dropColumn(t[0])),h(t,n,r)||r.noRenameTable||e.renameTable(t,n.pureName),o.filter(e=>null==e[0]).forEach(t=>e.createColumn(t[1])),o.filter(e=>e[0]&&e[1]).forEach(t=>{m(t[0],t[1],!0,!0,r)||(m(t[0],t[1],!1,!0,r)&&!r.noRenameColumn?e.renameColumn(t[0],t[1].columnName):e.changeColumn(t[0],t[1]))}),i.filter(e=>e[0]&&e[1]).forEach(t=>{(function(e,t,n={}){const r=[];return n.ignoreForeignKeyActions&&(r.push("updateAction"),r.push("deleteAction")),n.ignoreConstraintNames&&r.push("constraintName"),"ignore"==n.schemaMode&&(r.push("schemaName"),r.push("refSchemaName")),(0,s.default)((0,a.default)(e,r))==(0,s.default)((0,a.default)(t,r))})(t[0],t[1],r)||e.changeConstraint(t[0],t[1])}),i.filter(e=>null==e[0]).forEach(t=>e.createConstraint(t[1])),v(e,t,n)}function w(e,t,n){return e.createSql==t.createSql}function _(e,t,n,r,o,s){const a=new i.AlterPlan(r,o,s.dialect,n);return null==e?(a.createTable(t),v(a,null,t)):null==t?a.dropTable(e):S(a,e,t,n),a.transformPlan(),a}function O(e,t,n,r,o,s){const a=new i.AlterPlan(r,o,s.dialect,n);for(const r of["tables","views","procedures","matviews","functions"]){for(const o of e[r]||[]){const e=(t[r]||[]).find(e=>e.pairingId==o.pairingId);"tables"==r?null==e?n.noDropTable||a.dropTable(o):S(a,o,e,n):null==e?n.noDropSqlObject||a.dropSqlObject(o):w(o.createSql,e.createSql)||(a.recreates.sqlObjects+=1,n.noDropSqlObject||a.dropSqlObject(o),a.createSqlObject(e))}for(const n of t[r]||[]){const t=(e[r]||[]).find(e=>e.pairingId==n.pairingId);"tables"==r?null==t&&(a.createTable(n),v(a,null,n)):null==t&&a.createSqlObject(n)}}return a.transformPlan(),a}t.generateTablePairingId=f,t.generateDbPairingId=function(e){var t,n,r,o,i,s;return e?Object.assign(Object.assign({},e),{tables:null===(t=e.tables)||void 0===t?void 0:t.map(f),views:null===(n=e.views)||void 0===n?void 0:n.map(p),procedures:null===(r=e.procedures)||void 0===r?void 0:r.map(p),functions:null===(o=e.functions)||void 0===o?void 0:o.map(p),triggers:null===(i=e.triggers)||void 0===i?void 0:i.map(p),matviews:null===(s=e.matviews)||void 0===s?void 0:s.map(p)}):e},t.testEqualColumns=m,t.testEqualTypes=g,t.testEqualTables=function(e,t,n,r,o,s){const a=new i.AlterPlan(r,o,s.dialect,n);return S(a,e,t,n),0==a.operations.length},t.testEqualSqlObjects=w,t.createAlterTablePlan=_,t.createAlterDatabasePlan=O,t.getAlterTableScript=function(e,t,n,r,o,i){if(!e&&!t||!i)return{sql:"",recreates:[]};const s=_(e,t,n,r,o,i),a=i.createDumper({useHardSeparator:!0});return i.dialect.disableExplicitTransaction||a.beginTransaction(),s.run(a),i.dialect.disableExplicitTransaction||a.commitTransaction(),{sql:a.s,recreates:s.recreates}},t.getAlterDatabaseScript=function(e,t,n,r,o,i){const s=O(e,t,n,r,o,i),a=i.createDumper({useHardSeparator:!0});return i.dialect.disableExplicitTransaction||a.beginTransaction(),s.run(a),i.dialect.disableExplicitTransaction||a.commitTransaction(),{sql:a.s,recreates:s.recreates,isEmpty:0==s.operations.length}},t.matchPairedObjects=function(e,t,n){if(!e||!t)return null;const r=(0,c.default)(t);for(const t of["tables","views","procedures","matviews","functions"])for(const o of r[t]||[]){const r=e[t].find(e=>h(e,o,n));if(r&&(o.pairingId=r.pairingId,"tables"==t)){for(const e of o.columns){const t=r.columns.find(t=>d(t.columnName,e.columnName,n));t&&(e.pairingId=t.pairingId)}for(const e of o.foreignKeys){const t=r.foreignKeys.find(t=>d(t.refTableName,e.refTableName,n)&&(0,u.default)(t.columns.map(e=>(0,l.default)(e,["columnName","refColumnName"])),e.columns.map(e=>(0,l.default)(e,["columnName","refColumnName"]))));t&&(e.pairingId=t.pairingId)}for(const e of o.uniques){const t=r.uniques.find(t=>(0,u.default)(t.columns.map(e=>(0,l.default)(e,["columnName"])),e.columns.map(e=>(0,l.default)(e,["columnName"]))));t&&(e.pairingId=t.pairingId)}for(const e of o.indexes){const t=r.indexes.find(t=>d(t.constraintName,e.constraintName,n));t&&(e.pairingId=t.pairingId)}}}return r},t.modelCompareDbDiffOptions={ignoreCase:!0,schemaMode:"ignore",ignoreConstraintNames:!0,ignoreForeignKeyActions:!0,ignoreDataTypes:!0}},function(e,t,n){"use strict";if(void 0!==global.Map)e.exports=global.Map,e.exports.Map=global.Map;else{var r=function(e){this._keys=[],this._values={};for(var t=0;t<e.length;t++)if(null!=e[t]){var n=e[t],r=n[0],o=n[1];this._keys.push(r),this._values[r]={v:o,i:this._keys.length-1}}};r.prototype.clear=function(){this._keys=[],this._values={}},r.prototype.delete=function(e){var t=this._values[e];return null!=t&&(delete this._values[e],this._keys.splice(t.i,1),!0)},r.prototype.entries=function(){var e=this,t=0;return{next:function(){var n=e._keys[t++];return{value:void 0!==n?[n,e._values[n].v]:void 0,done:void 0===n}}}},r.prototype.forEach=function(e,t){t=t||this;for(var n=0;n<this._keys.length;n++){var r=this._keys[n];e.call(t,this._values[r].v,r,t)}},r.prototype.get=function(e){return this._values[e]?this._values[e].v:void 0},r.prototype.has=function(e){return null!=this._values[e]},r.prototype.keys=function(){var e=this,t=0;return{next:function(){var n=e._keys[t++];return{value:void 0!==n?n:void 0,done:void 0===n}}}},r.prototype.set=function(e,t){return this._values[e]?(this._values[e].v=t,this):(this._keys.push(e),this._values[e]={v:t,i:this._keys.length-1},this)},r.prototype.values=function(){var e=this,t=0;return{next:function(){var n=e._keys[t++];return{value:void 0!==n?e._values[n].v:void 0,done:void 0===n}}}},Object.defineProperty(r.prototype,"size",{enumerable:!0,get:function(){return this._keys.length}}),e.exports=r,e.exports.Map=r}},function(e,t){var n=function(e){if(!(this instanceof n))return new n(e);this._bsontype="Int32",this.value=e};n.prototype.valueOf=function(){return this.value},n.prototype.toJSON=function(){return this.value},e.exports=n,e.exports.Int32=n},function(e,t){e.exports=require("buffer")},function(e,t,n){"use strict";const r=n(409);function o(e,t,n,o){let i;"object"==typeof o?(i=o,r(!(i.hasOwnProperty("notFound")&&i.hasOwnProperty("default")),"optionalRequire: options set with both `notFound` and `default`")):i={message:o};try{return t?e.resolve(n):e(n)}catch(e){if("MODULE_NOT_FOUND"!==e.code||!function(e,t){const n=e.message.split("\n")[0];return n&&(n.includes(`'${t}'`)||n.includes(` ${t} `)||n.includes(` ${t}. `)||n.includes(` ${t}, `))}(e,n)){if("function"==typeof i.fail)return i.fail(e);throw e}if(i.message){const e="string"==typeof i.message?`${i.message} - `:"",r=t?"resolved":"found";a.log(`${e}optional module not ${r}`,n)}return"function"==typeof i.notFound?i.notFound(e):i.default}}const i=(e,t,n)=>o(e,!1,t,n),s=(e,t,n)=>o(e,!0,t,n);function a(e){const t=(t,n)=>i(e,t,n);return t.resolve=(t,n)=>s(e,t,n),t}a.try=i,a.tryResolve=s,a.resolve=s,a.log=(e,t)=>console.log(`Just FYI: ${e}; Path "${t}"`),e.exports=a},function(e,t,n){"use strict";var r=function(e,t,n){this.result=e,this.connection=t,this.message=n};r.prototype.toJSON=function(){let e=Object.assign({},this,this.result);return delete e.message,e},r.prototype.toString=function(){return JSON.stringify(this.toJSON())},e.exports=r},function(e,t,n){"use strict";var r=n(5).inherits,o=n(5).format,i=n(8).EventEmitter,s=n(10),a=n(16),c=n(9).debugOptions,u=n(9).retrieveBSON,l=n(414),f=n(3).MongoError,p=n(3).MongoNetworkError,d=n(199),h=n(17).CoreCursor,m=n(7),g=n(7).createCompressionInfo,y=n(7).resolveClusterTime,b=n(7).SessionMixins,v=n(4).relayEvents;const S=n(4).collationNotSupported,w=n(4).makeClientMetadata;var _=["reconnect","reconnectTries","reconnectInterval","emitError","cursorFactory","host","port","size","keepAlive","keepAliveInitialDelay","noDelay","connectionTimeout","checkServerIdentity","socketTimeout","ssl","ca","crl","cert","key","rejectUnauthorized","promoteLongs","promoteValues","promoteBuffers","servername"],O=0,T=!1,C={},x=u();function E(e){return null==e.s.parent?e.id:e.s.parent.id}var N=function(e){e=e||{},i.call(this),this.id=O++,this.s={options:Object.assign({metadata:w(e)},e),logger:a("Server",e),Cursor:e.cursorFactory||h,bson:e.bson||new x([x.Binary,x.Code,x.DBRef,x.Decimal128,x.Double,x.Int32,x.Long,x.Map,x.MaxKey,x.MinKey,x.ObjectId,x.BSONRegExp,x.Symbol,x.Timestamp]),pool:null,disconnectHandler:e.disconnectHandler,monitoring:"boolean"!=typeof e.monitoring||e.monitoring,inTopology:!!e.parent,monitoringInterval:"number"==typeof e.monitoringInterval?e.monitoringInterval:5e3,compression:{compressors:g(e)},parent:e.parent},this.s.parent||(this.s.clusterTime=null),this.ismaster=null,this.lastIsMasterMS=-1,this.monitoringProcessId=null,this.initialConnect=!0,this._type="server",this.lastUpdateTime=0,this.lastWriteDate=0,this.staleness=0};function I(e,t,n,r,i,s){return e.s.pool.isConnected()||!e.s.options.reconnect||null==e.s.disconnectHandler||i.monitoring?e.s.pool.isConnected()?void 0:(s(new f(o("no connection available to server %s",e.name))),!0):(e.s.disconnectHandler.add(t,n,r,i,s),!0)}r(N,i),Object.assign(N.prototype,b),Object.defineProperty(N.prototype,"type",{enumerable:!0,get:function(){return this._type}}),Object.defineProperty(N.prototype,"parserType",{enumerable:!0,get:function(){return x.native?"c++":"js"}}),Object.defineProperty(N.prototype,"logicalSessionTimeoutMinutes",{enumerable:!0,get:function(){return this.ismaster&&this.ismaster.logicalSessionTimeoutMinutes||null}}),Object.defineProperty(N.prototype,"clientMetadata",{enumerable:!0,get:function(){return this.s.options.metadata}}),Object.defineProperty(N.prototype,"clusterTime",{enumerable:!0,set:function(e){const t=this.s.parent?this.s.parent:this.s;y(t,e)},get:function(){return(this.s.parent?this.s.parent:this.s).clusterTime||null}}),N.enableServerAccounting=function(){T=!0,C={}},N.disableServerAccounting=function(){T=!1},N.servers=function(){return C},Object.defineProperty(N.prototype,"name",{enumerable:!0,get:function(){return this.s.options.host+":"+this.s.options.port}});var A=function(e,t){return function(n,r){if(e.s.logger.isInfo()){var i=n instanceof f?JSON.stringify(n):{};e.s.logger.info(o("server %s fired event %s out with message %s",e.name,t,i))}if("connect"===t){if(e.initialConnect=!1,e.ismaster=r.ismaster,e.lastIsMasterMS=r.lastIsMasterMS,r.agreedCompressor&&(e.s.pool.options.agreedCompressor=r.agreedCompressor),r.zlibCompressionLevel&&(e.s.pool.options.zlibCompressionLevel=r.zlibCompressionLevel),r.ismaster.$clusterTime){const t=r.ismaster.$clusterTime;e.clusterTime=t}"isdbgrid"===e.ismaster.msg&&(e._type="mongos"),e.s.monitoring&&(e.monitoringProcessId=setTimeout(function e(t){return function(){if(!t.s.pool.isDestroyed()){t.emit("monitoring",t);var n=(new Date).getTime();t.command("admin.$cmd",{ismaster:!0},{socketTimeout:"number"!=typeof t.s.options.connectionTimeout?2e3:t.s.options.connectionTimeout,monitoring:!0},(r,o)=>{t.lastIsMasterMS=(new Date).getTime()-n,t.s.pool.isDestroyed()||(o&&(t.ismaster=o.result),t.monitoringProcessId=setTimeout(e(t),t.s.monitoringInterval))})}}}(e),e.s.monitoringInterval)),m.emitServerDescriptionChanged(e,{address:e.name,arbiters:[],hosts:[],passives:[],type:m.getTopologyType(e)}),e.s.inTopology||m.emitTopologyDescriptionChanged(e,{topologyType:"Single",servers:[{address:e.name,arbiters:[],hosts:[],passives:[],type:m.getTopologyType(e)}]}),e.s.logger.isInfo()&&e.s.logger.info(o("server %s connected with ismaster [%s]",e.name,JSON.stringify(e.ismaster))),e.emit("connect",e)}else if("error"===t||"parseError"===t||"close"===t||"timeout"===t||"reconnect"===t||"attemptReconnect"===t||"reconnectFailed"===t){if(T&&-1!==["close","timeout","error","parseError","reconnectFailed"].indexOf(t)&&(e.s.inTopology||e.emit("topologyOpening",{topologyId:e.id}),delete C[e.id]),"close"===t&&m.emitServerDescriptionChanged(e,{address:e.name,arbiters:[],hosts:[],passives:[],type:"Unknown"}),"reconnectFailed"===t)return e.emit("reconnectFailed",n),void(e.listeners("error").length>0&&e.emit("error",n));if(-1!==["disconnected","connecting"].indexOf(e.s.pool.state)&&e.initialConnect&&-1!==["close","timeout","error","parseError"].indexOf(t))return e.initialConnect=!1,e.emit("error",new p(o("failed to connect to server [%s] on first connect [%s]",e.name,n)));if("reconnect"===t)return m.emitServerDescriptionChanged(e,{address:e.name,arbiters:[],hosts:[],passives:[],type:m.getTopologyType(e)}),e.emit(t,e);e.emit(t,n)}}};function k(e){return e.s.pool?e.s.pool.isDestroyed()?new f("server instance pool was destroyed"):void 0:new f("server instance is not connected")}N.prototype.connect=function(e){if(e=e||{},T&&(C[this.id]=this),this.s.pool&&!this.s.pool.isDisconnected()&&!this.s.pool.isDestroyed())throw new f(o("server instance in invalid state %s",this.s.pool.state));this.s.pool=new l(this,Object.assign(this.s.options,e,{bson:this.s.bson})),this.s.pool.on("close",A(this,"close")),this.s.pool.on("error",A(this,"error")),this.s.pool.on("timeout",A(this,"timeout")),this.s.pool.on("parseError",A(this,"parseError")),this.s.pool.on("connect",A(this,"connect")),this.s.pool.on("reconnect",A(this,"reconnect")),this.s.pool.on("reconnectFailed",A(this,"reconnectFailed")),v(this.s.pool,this,["commandStarted","commandSucceeded","commandFailed"]),this.s.inTopology||this.emit("topologyOpening",{topologyId:E(this)}),this.emit("serverOpening",{topologyId:E(this),address:this.name}),this.s.pool.connect()},N.prototype.auth=function(e,t){"function"==typeof t&&t(null,null)},N.prototype.getDescription=function(){var e=this.ismaster||{},t={type:m.getTopologyType(this),address:this.name};return e.hosts&&(t.hosts=e.hosts),e.arbiters&&(t.arbiters=e.arbiters),e.passives&&(t.passives=e.passives),e.setName&&(t.setName=e.setName),t},N.prototype.lastIsMaster=function(){return this.ismaster},N.prototype.unref=function(){this.s.pool.unref()},N.prototype.isConnected=function(){return!!this.s.pool&&this.s.pool.isConnected()},N.prototype.isDestroyed=function(){return!!this.s.pool&&this.s.pool.isDestroyed()},N.prototype.command=function(e,t,n,r){"function"==typeof n&&(r=n,n=(n={})||{});var i=function(e,t){if(k(e),t.readPreference&&!(t.readPreference instanceof s))throw new Error("readPreference must be an instance of ReadPreference")}(this,n);return i?r(i):(n=Object.assign({},n,{wireProtocolCommand:!1}),this.s.logger.isDebug()&&this.s.logger.debug(o("executing command [%s] against %s",JSON.stringify({ns:e,cmd:t,options:c(_,n)}),this.name)),I(this,"command",e,t,n,r)?void 0:S(this,t)?r(new f(`server ${this.name} does not support collation`)):void d.command(this,e,t,n,r))},N.prototype.query=function(e,t,n,r,o){d.query(this,e,t,n,r,o)},N.prototype.getMore=function(e,t,n,r,o){d.getMore(this,e,t,n,r,o)},N.prototype.killCursors=function(e,t,n){d.killCursors(this,e,t,n)},N.prototype.insert=function(e,t,n,r){"function"==typeof n&&(r=n,n=(n={})||{});var o=k(this);return o?r(o):I(this,"insert",e,t,n,r)?void 0:(t=Array.isArray(t)?t:[t],d.insert(this,e,t,n,r))},N.prototype.update=function(e,t,n,r){"function"==typeof n&&(r=n,n=(n={})||{});var o=k(this);return o?r(o):I(this,"update",e,t,n,r)?void 0:S(this,n)?r(new f(`server ${this.name} does not support collation`)):(t=Array.isArray(t)?t:[t],d.update(this,e,t,n,r))},N.prototype.remove=function(e,t,n,r){"function"==typeof n&&(r=n,n=(n={})||{});var o=k(this);return o?r(o):I(this,"remove",e,t,n,r)?void 0:S(this,n)?r(new f(`server ${this.name} does not support collation`)):(t=Array.isArray(t)?t:[t],d.remove(this,e,t,n,r))},N.prototype.cursor=function(e,t,n){const r=(n=n||{}).topology||this;return new(n.cursorFactory||this.s.Cursor)(r,e,t,n)},N.prototype.equals=function(e){return"string"==typeof e?this.name.toLowerCase()===e.toLowerCase():!!e.name&&this.name.toLowerCase()===e.name.toLowerCase()},N.prototype.connections=function(){return this.s.pool.allConnections()},N.prototype.selectServer=function(e,t,n){"function"==typeof e&&void 0===n&&(n=e,e=void 0,t={}),"function"==typeof t&&(n=t,t=e,e=void 0),n(null,this)};var M=["close","error","timeout","parseError","connect"];N.prototype.destroy=function(e,t){if(this._destroyed)"function"==typeof t&&t(null,null);else{"function"==typeof e&&(t=e,e={}),e=e||{};var n=this;if(T&&delete C[this.id],this.monitoringProcessId&&clearTimeout(this.monitoringProcessId),!n.s.pool||this._destroyed)return this._destroyed=!0,void("function"==typeof t&&t(null,null));this._destroyed=!0,e.emitClose&&n.emit("close",n),e.emitDestroy&&n.emit("destroy",n),M.forEach((function(e){n.s.pool.removeAllListeners(e)})),n.listeners("serverClosed").length>0&&n.emit("serverClosed",{topologyId:E(n),address:n.name}),n.listeners("topologyClosed").length>0&&!n.s.inTopology&&n.emit("topologyClosed",{topologyId:E(n)}),n.s.logger.isDebug()&&n.s.logger.debug(o("destroy called on server %s",n.name)),this.s.pool.destroy(e.force,t)}},e.exports=N},function(e,t,n){"use strict";const r=n(415),o=n(192),i=n(187),s=n(3).MongoError,a=n(3).MongoNetworkError,c=n(3).MongoNetworkTimeoutError,u=n(193).defaultAuthProviders,l=n(33).AuthContext,f=n(190),p=n(4).makeClientMetadata,d=f.MAX_SUPPORTED_WIRE_VERSION,h=f.MAX_SUPPORTED_SERVER_VERSION,m=f.MIN_SUPPORTED_WIRE_VERSION,g=f.MIN_SUPPORTED_SERVER_VERSION;let y;const b=["pfx","key","passphrase","cert","ca","ciphers","NPNProtocols","ALPNProtocols","servername","ecdhCurve","secureProtocol","secureContext","session","minDHSize","crl","rejectUnauthorized"];function v(e,t){const n="string"==typeof t.host?t.host:"localhost";return-1!==n.indexOf("/")?{path:n}:{family:e,host:n,port:"number"==typeof t.port?t.port:27017,rejectUnauthorized:!1}}const S=new Set(["error","close","timeout","parseError"]);e.exports=function(e,t,n){"function"==typeof t&&(n=t,t=void 0);const f=e&&e.connectionType?e.connectionType:i;null==y&&(y=u(e.bson)),function(e,t,n,i){const s="boolean"==typeof t.ssl&&t.ssl,u="boolean"!=typeof t.keepAlive||t.keepAlive;let l="number"==typeof t.keepAliveInitialDelay?t.keepAliveInitialDelay:12e4;const f="boolean"!=typeof t.noDelay||t.noDelay,p="number"==typeof t.connectionTimeout?t.connectionTimeout:"number"==typeof t.connectTimeoutMS?t.connectTimeoutMS:3e4,d="number"==typeof t.socketTimeout?t.socketTimeout:0,h="boolean"!=typeof t.rejectUnauthorized||t.rejectUnauthorized;l>d&&(l=Math.round(d/2));let m;const g=function(e,t){e&&m&&m.destroy(),i(e,t)};try{s?(m=o.connect(function(e,t){const n=v(e,t);for(const e in t)null!=t[e]&&-1!==b.indexOf(e)&&(n[e]=t[e]);!1===t.checkServerIdentity?n.checkServerIdentity=function(){}:"function"==typeof t.checkServerIdentity&&(n.checkServerIdentity=t.checkServerIdentity);null!=n.servername||r.isIP(n.host)||(n.servername=n.host);return n}(e,t)),"function"==typeof m.disableRenegotiation&&m.disableRenegotiation()):m=r.createConnection(v(e,t))}catch(e){return g(e)}m.setKeepAlive(u,l),m.setTimeout(p),m.setNoDelay(f);const y=s?"secureConnect":"connect";let w;function _(e){return t=>{S.forEach(e=>m.removeAllListeners(e)),w&&n.removeListener("cancel",w),m.removeListener(y,O),g(function(e,t){switch(e){case"error":return new a(t);case"timeout":return new c("connection timed out");case"close":return new a("connection closed");case"cancel":return new a("connection establishment was cancelled");default:return new a("unknown network error")}}(e,t))}}function O(){if(S.forEach(e=>m.removeAllListeners(e)),w&&n.removeListener("cancel",w),m.authorizationError&&h)return g(m.authorizationError);m.setTimeout(d),g(null,m)}S.forEach(e=>m.once(e,_(e))),n&&(w=_("cancel"),n.once("cancel",w));m.once(y,O)}(void 0!==e.family?e.family:0,e,t,(t,r)=>{t?n(t,r):function(e,t,n){const r=function(t,r){t&&e&&e.destroy(),n(t,r)},o=t.credentials;if(o&&!o.mechanism.match(/DEFAULT/i)&&!y[o.mechanism])return void r(new s(`authMechanism '${o.mechanism}' not supported`));const a=new l(e,o,t);!function(e,t){const n=e.options,r=n.compression&&n.compression.compressors?n.compression.compressors:[],o={ismaster:!0,client:n.metadata||p(n),compression:r},i=e.credentials;if(i){if(i.mechanism.match(/DEFAULT/i)&&i.username)return Object.assign(o,{saslSupportedMechs:`${i.source}.${i.username}`}),void y["scram-sha-256"].prepare(o,e,t);return void y[i.mechanism].prepare(o,e,t)}t(void 0,o)}(a,(n,c)=>{if(n)return r(n);const u=Object.assign({},t);(t.connectTimeoutMS||t.connectionTimeout)&&(u.socketTimeout=t.connectTimeoutMS||t.connectionTimeout);const l=(new Date).getTime();e.command("admin.$cmd",c,u,(n,u)=>{if(n)return void r(n);const f=u.result;if(0===f.ok)return void r(new s(f));const p=function(e,t){const n=e&&"number"==typeof e.maxWireVersion&&e.maxWireVersion>=m,r=e&&"number"==typeof e.minWireVersion&&e.minWireVersion<=d;if(n){if(r)return null;const n=`Server at ${t.host}:${t.port} reports minimum wire version ${e.minWireVersion}, but this version of the Node.js Driver requires at most ${d} (MongoDB ${h})`;return new s(n)}const o=`Server at ${t.host}:${t.port} reports maximum wire version ${e.maxWireVersion||0}, but this version of the Node.js Driver requires at least ${m} (MongoDB ${g})`;return new s(o)}(f,t);if(p)r(p);else{if(!function(e){return!(e instanceof i)}(e)&&f.compression){const n=c.compression.filter(e=>-1!==f.compression.indexOf(e));n.length&&(e.agreedCompressor=n[0]),t.compression&&t.compression.zlibCompressionLevel&&(e.zlibCompressionLevel=t.compression.zlibCompressionLevel)}if(e.ismaster=f,e.lastIsMasterMS=(new Date).getTime()-l,f.arbiterOnly||!o)r(void 0,e);else{Object.assign(a,{response:f});const t=o.resolveAuthMechanism(f);y[t.mechanism].auth(a,t=>{if(t)return r(t);r(void 0,e)})}}})})}(new f(r,e),e,n)})}},function(e,t){e.exports=require("path")},function(e,t){e.exports=require("querystring")},function(e,t,n){"use strict";function r(e,t){t=t||{};this._head=0,this._tail=0,this._capacity=t.capacity,this._capacityMask=3,this._list=new Array(4),Array.isArray(e)&&this._fromArray(e)}r.prototype.peekAt=function(e){var t=e;if(t===(0|t)){var n=this.size();if(!(t>=n||t<-n))return t<0&&(t+=n),t=this._head+t&this._capacityMask,this._list[t]}},r.prototype.get=function(e){return this.peekAt(e)},r.prototype.peek=function(){if(this._head!==this._tail)return this._list[this._head]},r.prototype.peekFront=function(){return this.peek()},r.prototype.peekBack=function(){return this.peekAt(-1)},Object.defineProperty(r.prototype,"length",{get:function(){return this.size()}}),r.prototype.size=function(){return this._head===this._tail?0:this._head<this._tail?this._tail-this._head:this._capacityMask+1-(this._head-this._tail)},r.prototype.unshift=function(e){if(void 0===e)return this.size();var t=this._list.length;return this._head=this._head-1+t&this._capacityMask,this._list[this._head]=e,this._tail===this._head&&this._growArray(),this._capacity&&this.size()>this._capacity&&this.pop(),this._head<this._tail?this._tail-this._head:this._capacityMask+1-(this._head-this._tail)},r.prototype.shift=function(){var e=this._head;if(e!==this._tail){var t=this._list[e];return this._list[e]=void 0,this._head=e+1&this._capacityMask,e<2&&this._tail>1e4&&this._tail<=this._list.length>>>2&&this._shrinkArray(),t}},r.prototype.push=function(e){if(void 0===e)return this.size();var t=this._tail;return this._list[t]=e,this._tail=t+1&this._capacityMask,this._tail===this._head&&this._growArray(),this._capacity&&this.size()>this._capacity&&this.shift(),this._head<this._tail?this._tail-this._head:this._capacityMask+1-(this._head-this._tail)},r.prototype.pop=function(){var e=this._tail;if(e!==this._head){var t=this._list.length;this._tail=e-1+t&this._capacityMask;var n=this._list[this._tail];return this._list[this._tail]=void 0,this._head<2&&e>1e4&&e<=t>>>2&&this._shrinkArray(),n}},r.prototype.removeOne=function(e){var t=e;if(t===(0|t)&&this._head!==this._tail){var n=this.size(),r=this._list.length;if(!(t>=n||t<-n)){t<0&&(t+=n),t=this._head+t&this._capacityMask;var o,i=this._list[t];if(e<n/2){for(o=e;o>0;o--)this._list[t]=this._list[t=t-1+r&this._capacityMask];this._list[t]=void 0,this._head=this._head+1+r&this._capacityMask}else{for(o=n-1-e;o>0;o--)this._list[t]=this._list[t=t+1+r&this._capacityMask];this._list[t]=void 0,this._tail=this._tail-1+r&this._capacityMask}return i}}},r.prototype.remove=function(e,t){var n,r=e,o=t;if(r===(0|r)&&this._head!==this._tail){var i=this.size(),s=this._list.length;if(!(r>=i||r<-i||t<1)){if(r<0&&(r+=i),1===t||!t)return(n=new Array(1))[0]=this.removeOne(r),n;if(0===r&&r+t>=i)return n=this.toArray(),this.clear(),n;var a;for(r+t>i&&(t=i-r),n=new Array(t),a=0;a<t;a++)n[a]=this._list[this._head+r+a&this._capacityMask];if(r=this._head+r&this._capacityMask,e+t===i){for(this._tail=this._tail-t+s&this._capacityMask,a=t;a>0;a--)this._list[r=r+1+s&this._capacityMask]=void 0;return n}if(0===e){for(this._head=this._head+t+s&this._capacityMask,a=t-1;a>0;a--)this._list[r=r+1+s&this._capacityMask]=void 0;return n}if(r<i/2){for(this._head=this._head+e+t+s&this._capacityMask,a=e;a>0;a--)this.unshift(this._list[r=r-1+s&this._capacityMask]);for(r=this._head-1+s&this._capacityMask;o>0;)this._list[r=r-1+s&this._capacityMask]=void 0,o--;e<0&&(this._tail=r)}else{for(this._tail=r,r=r+t+s&this._capacityMask,a=i-(t+e);a>0;a--)this.push(this._list[r++]);for(r=this._tail;o>0;)this._list[r=r+1+s&this._capacityMask]=void 0,o--}return this._head<2&&this._tail>1e4&&this._tail<=s>>>2&&this._shrinkArray(),n}}},r.prototype.splice=function(e,t){var n=e;if(n===(0|n)){var r=this.size();if(n<0&&(n+=r),!(n>r)){if(arguments.length>2){var o,i,s,a=arguments.length,c=this._list.length,u=2;if(!r||n<r/2){for(i=new Array(n),o=0;o<n;o++)i[o]=this._list[this._head+o&this._capacityMask];for(0===t?(s=[],n>0&&(this._head=this._head+n+c&this._capacityMask)):(s=this.remove(n,t),this._head=this._head+n+c&this._capacityMask);a>u;)this.unshift(arguments[--a]);for(o=n;o>0;o--)this.unshift(i[o-1])}else{var l=(i=new Array(r-(n+t))).length;for(o=0;o<l;o++)i[o]=this._list[this._head+n+t+o&this._capacityMask];for(0===t?(s=[],n!=r&&(this._tail=this._head+n+c&this._capacityMask)):(s=this.remove(n,t),this._tail=this._tail-l+c&this._capacityMask);u<a;)this.push(arguments[u++]);for(o=0;o<l;o++)this.push(i[o])}return s}return this.remove(n,t)}}},r.prototype.clear=function(){this._head=0,this._tail=0},r.prototype.isEmpty=function(){return this._head===this._tail},r.prototype.toArray=function(){return this._copyArray(!1)},r.prototype._fromArray=function(e){for(var t=0;t<e.length;t++)this.push(e[t])},r.prototype._copyArray=function(e){var t,n=[],r=this._list,o=r.length;if(e||this._head>this._tail){for(t=this._head;t<o;t++)n.push(r[t]);for(t=0;t<this._tail;t++)n.push(r[t])}else for(t=this._head;t<this._tail;t++)n.push(r[t]);return n},r.prototype._growArray=function(){this._head&&(this._list=this._copyArray(!0),this._head=0),this._tail=this._list.length,this._list.length*=2,this._capacityMask=this._capacityMask<<1|1},r.prototype._shrinkArray=function(){this._list.length>>>=1,this._capacityMask>>>=1},e.exports=r},function(e,t,n){"use strict";const r=n(138),o=n(8),i=n(95).isResumableError,s=n(2).MongoError,a=n(26),c=n(4).relayEvents,u=n(4).maxWireVersion,l=n(0).maybePromise,f=n(0).now,p=n(0).calculateDurationInMs,d=n(96),h=Symbol("resumeQueue"),m=["resumeAfter","startAfter","startAtOperationTime","fullDocument"],g=["batchSize","maxAwaitTimeMS","collation","readPreference"].concat(m),y={COLLECTION:Symbol("Collection"),DATABASE:Symbol("Database"),CLUSTER:Symbol("Cluster")};class b extends a{constructor(e,t,n){super(e,t,n),n=n||{},this._resumeToken=null,this.startAtOperationTime=n.startAtOperationTime,n.startAfter?this.resumeToken=n.startAfter:n.resumeAfter&&(this.resumeToken=n.resumeAfter)}set resumeToken(e){this._resumeToken=e,this.emit("resumeTokenChanged",e)}get resumeToken(){return this._resumeToken}get resumeOptions(){const e={};for(const t of g)this.options[t]&&(e[t]=this.options[t]);if(this.resumeToken||this.startAtOperationTime)if(["resumeAfter","startAfter","startAtOperationTime"].forEach(t=>delete e[t]),this.resumeToken){const t=this.options.startAfter&&!this.hasReceived?"startAfter":"resumeAfter";e[t]=this.resumeToken}else this.startAtOperationTime&&u(this.server)>=7&&(e.startAtOperationTime=this.startAtOperationTime);return e}cacheResumeToken(e){0===this.bufferedCount()&&this.cursorState.postBatchResumeToken?this.resumeToken=this.cursorState.postBatchResumeToken:this.resumeToken=e,this.hasReceived=!0}_processBatch(e,t){const n=t.cursor;n.postBatchResumeToken&&(this.cursorState.postBatchResumeToken=n.postBatchResumeToken,0===n[e].length&&(this.resumeToken=n.postBatchResumeToken))}_initializeCursor(e){super._initializeCursor((t,n)=>{if(t||null==n)return void e(t,n);const r=n.documents[0];null==this.startAtOperationTime&&null==this.resumeAfter&&null==this.startAfter&&u(this.server)>=7&&(this.startAtOperationTime=r.operationTime),this._processBatch("firstBatch",r),this.emit("init",n),this.emit("response"),e(t,n)})}_getMore(e){super._getMore((t,n)=>{t?e(t):(this._processBatch("nextBatch",n),this.emit("more",n),this.emit("response"),e(t,n))})}}function v(e,t){const n={fullDocument:t.fullDocument||"default"};S(n,t,m),e.type===y.CLUSTER&&(n.allChangesForCluster=!0);const r=[{$changeStream:n}].concat(e.pipeline),o=S({},t,g),i=new b(e.topology,new d(e.parent,r,t),o);if(c(i,e,["resumeTokenChanged","end","close"]),e.listenerCount("change")>0&&i.on("data",(function(t){w(e,t)})),i.on("error",(function(t){_(e,t)})),e.pipeDestinations){const t=i.stream(e.streamOptions);for(let n of e.pipeDestinations)t.pipe(n)}return i}function S(e,t,n){return n.forEach(n=>{t[n]&&(e[n]=t[n])}),e}function w(e,t,n){const r=e.cursor;if(null==t&&(e.closed=!0),!e.closed){if(t&&!t._id){const t=new Error("A change stream document has been received that lacks a resume token (_id).");return n?n(t):e.emit("error",t)}return r.cacheResumeToken(t._id),e.options.startAtOperationTime=void 0,n?n(void 0,t):e.emit("change",t)}n&&n(new s("ChangeStream is closed"))}function _(e,t,n){const r=e.topology,o=e.cursor;if(!e.closed)return o&&i(t,u(o.server))?(e.cursor=void 0,["data","close","end","error"].forEach(e=>o.removeAllListeners(e)),o.close(),void function e(t,n,r){setTimeout(()=>{n&&null==n.start&&(n.start=f());const o=n.start||f(),i=n.timeout||3e4,a=n.readPreference;return t.isConnected({readPreference:a})?r():p(o)>i?r(new s("Timed out waiting for connection")):void e(t,n,r)},500)}(r,{readPreference:o.options.readPreference},t=>{if(t)return c(t);const r=v(e,o.resumeOptions);if(!n)return a(r);r.hasNext(e=>{if(e)return c(e);a(r)})})):n?n(t):e.emit("error",t);function a(t){e.cursor=t,T(e)}function c(t){n||(e.emit("error",t),e.emit("close")),T(e,t),e.closed=!0}n&&n(new s("ChangeStream is closed"))}function O(e,t){e.isClosed()?t(new s("ChangeStream is closed.")):e.cursor?t(void 0,e.cursor):e[h].push(t)}function T(e,t){for(;e[h].length;){const n=e[h].pop();if(e.isClosed()&&!t)return void n(new s("Change Stream is not open."));n(t,e.cursor)}}e.exports=class extends o{constructor(e,t,o){super();const i=n(61),s=n(98),a=n(59);if(this.pipeline=t||[],this.options=o||{},this.parent=e,this.namespace=e.s.namespace,e instanceof i)this.type=y.COLLECTION,this.topology=e.s.db.serverConfig;else if(e instanceof s)this.type=y.DATABASE,this.topology=e.serverConfig;else{if(!(e instanceof a))throw new TypeError("parent provided to ChangeStream constructor is not an instance of Collection, Db, or MongoClient");this.type=y.CLUSTER,this.topology=e.topology}this.promiseLibrary=e.s.promiseLibrary,!this.options.readPreference&&e.s.readPreference&&(this.options.readPreference=e.s.readPreference),this[h]=new r,this.cursor=v(this,o),this.closed=!1,this.on("newListener",e=>{"change"===e&&this.cursor&&0===this.listenerCount("change")&&this.cursor.on("data",e=>w(this,e))}),this.on("removeListener",e=>{"change"===e&&0===this.listenerCount("change")&&this.cursor&&this.cursor.removeAllListeners("data")})}get resumeToken(){return this.cursor.resumeToken}hasNext(e){return l(this.parent,e,e=>{O(this,(t,n)=>{if(t)return e(t);n.hasNext(e)})})}next(e){return l(this.parent,e,e=>{O(this,(t,n)=>{if(t)return e(t);n.next((t,n)=>{if(t)return this[h].push(()=>this.next(e)),void _(this,t,e);w(this,n,e)})})})}isClosed(){return this.closed||this.cursor&&this.cursor.isClosed()}close(e){return l(this.parent,e,e=>{if(this.closed)return e();if(this.closed=!0,!this.cursor)return e();const t=this.cursor;return t.close(n=>(["data","close","end","error"].forEach(e=>t.removeAllListeners(e)),this.cursor=void 0,e(n)))})}pipe(e,t){return this.pipeDestinations||(this.pipeDestinations=[]),this.pipeDestinations.push(e),this.cursor.pipe(e,t)}unpipe(e){return this.pipeDestinations&&this.pipeDestinations.indexOf(e)>-1&&this.pipeDestinations.splice(this.pipeDestinations.indexOf(e),1),this.cursor.unpipe(e)}stream(e){return this.streamOptions=e,this.cursor.stream(e)}pause(){return this.cursor.pause()}resume(){return this.cursor.resume()}}},function(e,t,n){"use strict";e.exports={SYSTEM_NAMESPACE_COLLECTION:"system.namespaces",SYSTEM_INDEX_COLLECTION:"system.indexes",SYSTEM_PROFILE_COLLECTION:"system.profile",SYSTEM_USER_COLLECTION:"system.users",SYSTEM_COMMAND_COLLECTION:"$cmd",SYSTEM_JS_COLLECTION:"system.js"}},function(e,t,n){"use strict";const r=n(2).BSON.Long,o=n(2).MongoError,i=n(2).BSON.ObjectID,s=n(2).BSON,a=n(2).MongoWriteConcernError,c=n(0).toError,u=n(0).handleCallback,l=n(0).applyRetryableWrites,f=n(0).applyWriteConcern,p=n(0).executeLegacyOperation,d=n(0).isPromiseLike,h=n(0).hasAtomicOperators,m=n(4).maxWireVersion,g=new s([s.Binary,s.Code,s.DBRef,s.Decimal128,s.Double,s.Int32,s.Long,s.Map,s.MaxKey,s.MinKey,s.ObjectId,s.BSONRegExp,s.Symbol,s.Timestamp]);class y{constructor(e){this.result=e}get ok(){return this.result.ok}get nInserted(){return this.result.nInserted}get nUpserted(){return this.result.nUpserted}get nMatched(){return this.result.nMatched}get nModified(){return this.result.nModified}get nRemoved(){return this.result.nRemoved}getInsertedIds(){return this.result.insertedIds}getUpsertedIds(){return this.result.upserted}getUpsertedIdAt(e){return this.result.upserted[e]}getRawResponse(){return this.result}hasWriteErrors(){return this.result.writeErrors.length>0}getWriteErrorCount(){return this.result.writeErrors.length}getWriteErrorAt(e){return e<this.result.writeErrors.length?this.result.writeErrors[e]:null}getWriteErrors(){return this.result.writeErrors}getLastOp(){return this.result.lastOp}getWriteConcernError(){if(0===this.result.writeConcernErrors.length)return null;if(1===this.result.writeConcernErrors.length)return this.result.writeConcernErrors[0];{let e="";for(let t=0;t<this.result.writeConcernErrors.length;t++){e+=this.result.writeConcernErrors[t].errmsg,0===t&&(e+=" and ")}return new b({errmsg:e,code:64})}}toJSON(){return this.result}toString(){return`BulkWriteResult(${this.toJSON(this.result)})`}isOk(){return 1===this.result.ok}}class b{constructor(e){this.err=e}get code(){return this.err.code}get errmsg(){return this.err.errmsg}toJSON(){return{code:this.err.code,errmsg:this.err.errmsg}}toString(){return`WriteConcernError(${this.err.errmsg})`}}class v{constructor(e){this.err=e}get code(){return this.err.code}get index(){return this.err.index}get errmsg(){return this.err.errmsg}getOperation(){return this.err.op}toJSON(){return{code:this.err.code,index:this.err.index,errmsg:this.err.errmsg,op:this.err.op}}toString(){return`WriteError(${JSON.stringify(this.toJSON())})`}}function S(e,t,n,o){if(n)o=n;else if(o&&o.result)o=o.result;else if(null==o)return;if(0===o.ok&&1===t.ok){t.ok=0;const n={index:0,code:o.code||0,errmsg:o.message,op:e.operations[0]};return void t.writeErrors.push(new v(n))}if(0===o.ok&&0===t.ok)return;if(o.opTime||o.lastOp){const e=o.lastOp||o.opTime;let n=null,i=null;if(e&&"Timestamp"===e._bsontype)null==t.lastOp?t.lastOp=e:e.greaterThan(t.lastOp)&&(t.lastOp=e);else{t.lastOp&&(n="number"==typeof t.lastOp.ts?r.fromNumber(t.lastOp.ts):t.lastOp.ts,i="number"==typeof t.lastOp.t?r.fromNumber(t.lastOp.t):t.lastOp.t);const o="number"==typeof e.ts?r.fromNumber(e.ts):e.ts,s="number"==typeof e.t?r.fromNumber(e.t):e.t;null==t.lastOp?t.lastOp=e:o.greaterThan(n)?t.lastOp=e:o.equals(n)&&s.greaterThan(i)&&(t.lastOp=e)}}1===e.batchType&&o.n&&(t.nInserted=t.nInserted+o.n),3===e.batchType&&o.n&&(t.nRemoved=t.nRemoved+o.n);let i=0;if(Array.isArray(o.upserted)){i=o.upserted.length;for(let n=0;n<o.upserted.length;n++)t.upserted.push({index:o.upserted[n].index+e.originalZeroIndex,_id:o.upserted[n]._id})}else o.upserted&&(i=1,t.upserted.push({index:e.originalZeroIndex,_id:o.upserted}));if(2===e.batchType&&o.n){const e=o.nModified;t.nUpserted=t.nUpserted+i,t.nMatched=t.nMatched+(o.n-i),t.nModified="number"==typeof e?t.nModified+e:null}if(Array.isArray(o.writeErrors))for(let n=0;n<o.writeErrors.length;n++){const r={index:e.originalIndexes[o.writeErrors[n].index],code:o.writeErrors[n].code,errmsg:o.writeErrors[n].errmsg,op:e.operations[o.writeErrors[n].index]};t.writeErrors.push(new v(r))}o.writeConcernError&&t.writeConcernErrors.push(new b(o.writeConcernError))}function w(e,t,n){if(0===e.s.batches.length)return u(n,null,new y(e.s.bulkResult));const r=e.s.batches.shift();e.finalOptionsHandler({options:t,batch:r,resultHandler:function(o,i){if((o&&o.driver||o&&o.message)&&!(o instanceof a))return u(n,o);if(o&&(o.ok=0),o instanceof a)return function(e,t,n,r){S(e,t,null,n.result);const o=new b({errmsg:n.result.writeConcernError.errmsg,code:n.result.writeConcernError.result});return u(r,new _(c(o),new y(t)),null)}(r,e.s.bulkResult,o,n);const s=new y(e.s.bulkResult);if(null!=S(r,e.s.bulkResult,o,i))return u(n,null,s);e.handleWriteError(n,s)||w(e,t,n)}},n)}class _ extends o{constructor(e,t){super(e.err||e.errmsg||e.errMessage||e),Object.assign(this,e),this.name="BulkWriteError",this.result=t}}class O{constructor(e){this.s=e.s}update(e){const t="boolean"==typeof this.s.currentOp.upsert&&this.s.currentOp.upsert,n={q:this.s.currentOp.selector,u:e,multi:!0,upsert:t};return e.hint&&(n.hint=e.hint),this.s.currentOp=null,this.s.options.addToOperationsList(this,2,n)}updateOne(e){const t="boolean"==typeof this.s.currentOp.upsert&&this.s.currentOp.upsert,n={q:this.s.currentOp.selector,u:e,multi:!1,upsert:t};if(e.hint&&(n.hint=e.hint),!h(e))throw new TypeError("Update document requires atomic operators");return this.s.currentOp=null,this.s.options.addToOperationsList(this,2,n)}replaceOne(e){const t="boolean"==typeof this.s.currentOp.upsert&&this.s.currentOp.upsert,n={q:this.s.currentOp.selector,u:e,multi:!1,upsert:t};if(e.hint&&(n.hint=e.hint),h(e))throw new TypeError("Replacement document must not use atomic operators");return this.s.currentOp=null,this.s.options.addToOperationsList(this,2,n)}upsert(){return this.s.currentOp.upsert=!0,this}deleteOne(){const e={q:this.s.currentOp.selector,limit:1};return this.s.currentOp=null,this.s.options.addToOperationsList(this,3,e)}delete(){const e={q:this.s.currentOp.selector,limit:0};return this.s.currentOp=null,this.s.options.addToOperationsList(this,3,e)}removeOne(){return this.deleteOne()}remove(){return this.delete()}}class T{constructor(e,t,n,r){this.isOrdered=r,n=null==n?{}:n;const o=t.s.namespace,i=e.bson,s=e.lastIsMaster(),a=!(!e.s.options||!e.s.options.autoEncrypter),c=s&&s.maxBsonObjectSize?s.maxBsonObjectSize:16777216,u=a?2097152:c,p=s&&s.maxWriteBatchSize?s.maxWriteBatchSize:1e3,d=(p-1).toString(10).length+2;let h=Object.assign({},n);h=l(h,t.s.db),h=f(h,{collection:t},n);const m=h.writeConcern,g=n.promiseLibrary||Promise;this.s={bulkResult:{ok:1,writeErrors:[],writeConcernErrors:[],insertedIds:[],nInserted:0,nUpserted:0,nMatched:0,nModified:0,nRemoved:0,upserted:[]},currentBatch:null,currentIndex:0,currentBatchSize:0,currentBatchSizeBytes:0,currentInsertBatch:null,currentUpdateBatch:null,currentRemoveBatch:null,batches:[],writeConcern:m,maxBsonObjectSize:c,maxBatchSizeBytes:u,maxWriteBatchSize:p,maxKeySize:d,namespace:o,bson:i,topology:e,options:h,currentOp:null,executed:!1,collection:t,promiseLibrary:g,err:null,checkKeys:"boolean"!=typeof n.checkKeys||n.checkKeys},!0===n.bypassDocumentValidation&&(this.s.bypassDocumentValidation=!0)}insert(e){return!0!==this.s.collection.s.db.options.forceServerObjectId&&null==e._id&&(e._id=new i),this.s.options.addToOperationsList(this,1,e)}find(e){if(!e)throw c("Bulk find operation must specify a selector");return this.s.currentOp={selector:e},new O(this)}raw(e){const t=Object.keys(e)[0],n="boolean"==typeof this.s.options.forceServerObjectId?this.s.options.forceServerObjectId:this.s.collection.s.db.options.forceServerObjectId;if(e.updateOne&&e.updateOne.q||e.updateMany&&e.updateMany.q||e.replaceOne&&e.replaceOne.q)return e[t].multi=!e.updateOne&&!e.replaceOne,this.s.options.addToOperationsList(this,2,e[t]);if(e.updateOne||e.updateMany||e.replaceOne){if(e.replaceOne&&h(e[t].replacement))throw new TypeError("Replacement document must not use atomic operators");if((e.updateOne||e.updateMany)&&!h(e[t].update))throw new TypeError("Update document requires atomic operators");const n=!e.updateOne&&!e.replaceOne,r={q:e[t].filter,u:e[t].update||e[t].replacement,multi:n};if(e[t].hint&&(r.hint=e[t].hint),this.isOrdered?(r.upsert=!!e[t].upsert,e.collation&&(r.collation=e.collation)):e[t].upsert&&(r.upsert=!0),e[t].arrayFilters){if(m(this.s.topology)<6)throw new TypeError("arrayFilters are only supported on MongoDB 3.6+");r.arrayFilters=e[t].arrayFilters}return this.s.options.addToOperationsList(this,2,r)}if(e.removeOne||e.removeMany||e.deleteOne&&e.deleteOne.q||e.deleteMany&&e.deleteMany.q)return e[t].limit=e.removeOne?1:0,this.s.options.addToOperationsList(this,3,e[t]);if(e.deleteOne||e.deleteMany){const n=e.deleteOne?1:0,r={q:e[t].filter,limit:n};return e[t].hint&&(r.hint=e[t].hint),this.isOrdered&&e.collation&&(r.collation=e.collation),this.s.options.addToOperationsList(this,3,r)}if(e.insertOne&&null==e.insertOne.document)return!0!==n&&null==e.insertOne._id&&(e.insertOne._id=new i),this.s.options.addToOperationsList(this,1,e.insertOne);if(e.insertOne&&e.insertOne.document)return!0!==n&&null==e.insertOne.document._id&&(e.insertOne.document._id=new i),this.s.options.addToOperationsList(this,1,e.insertOne.document);if(!e.insertMany)throw c("bulkWrite only supports insertOne, insertMany, updateOne, updateMany, removeOne, removeMany, deleteOne, deleteMany");for(let t=0;t<e.insertMany.length;t++)!0!==n&&null==e.insertMany[t]._id&&(e.insertMany[t]._id=new i),this.s.options.addToOperationsList(this,1,e.insertMany[t])}_handleEarlyError(e,t){if("function"!=typeof t)return this.s.promiseLibrary.reject(e);t(e,null)}bulkExecute(e,t,n){if("function"==typeof t&&(n=t,t={}),t=t||{},"function"==typeof e?n=e:e&&"object"==typeof e&&(this.s.writeConcern=e),this.s.executed){const e=c("batch cannot be re-executed");return this._handleEarlyError(e,n)}if(this.isOrdered?this.s.currentBatch&&this.s.batches.push(this.s.currentBatch):(this.s.currentInsertBatch&&this.s.batches.push(this.s.currentInsertBatch),this.s.currentUpdateBatch&&this.s.batches.push(this.s.currentUpdateBatch),this.s.currentRemoveBatch&&this.s.batches.push(this.s.currentRemoveBatch)),0===this.s.batches.length){const e=c("Invalid Operation, no operations specified");return this._handleEarlyError(e,n)}return{options:t,callback:n}}execute(e,t,n){const r=this.bulkExecute(e,t,n);return!r||d(r)?r:(t=r.options,n=r.callback,p(this.s.topology,w,[this,t,n]))}finalOptionsHandler(e,t){const n=Object.assign({ordered:this.isOrdered},e.options);null!=this.s.writeConcern&&(n.writeConcern=this.s.writeConcern),!0!==n.bypassDocumentValidation&&delete n.bypassDocumentValidation,this.operationId&&(e.resultHandler.operationId=this.operationId),this.s.options.serializeFunctions&&(n.serializeFunctions=!0),this.s.options.ignoreUndefined&&(n.ignoreUndefined=!0),!0===this.s.bypassDocumentValidation&&(n.bypassDocumentValidation=!0),!1===this.s.checkKeys&&(n.checkKeys=!1),n.retryWrites&&(2===e.batch.batchType&&(n.retryWrites=n.retryWrites&&!e.batch.operations.some(e=>e.multi)),3===e.batch.batchType&&(n.retryWrites=n.retryWrites&&!e.batch.operations.some(e=>0===e.limit)));try{1===e.batch.batchType?this.s.topology.insert(this.s.namespace,e.batch.operations,n,e.resultHandler):2===e.batch.batchType?this.s.topology.update(this.s.namespace,e.batch.operations,n,e.resultHandler):3===e.batch.batchType&&this.s.topology.remove(this.s.namespace,e.batch.operations,n,e.resultHandler)}catch(n){n.ok=0,u(t,null,S(e.batch,this.s.bulkResult,n,null))}}handleWriteError(e,t){if(this.s.bulkResult.writeErrors.length>0){const n=this.s.bulkResult.writeErrors[0].errmsg?this.s.bulkResult.writeErrors[0].errmsg:"write operation failed";return u(e,new _(c({message:n,code:this.s.bulkResult.writeErrors[0].code,writeErrors:this.s.bulkResult.writeErrors}),t),null),!0}if(t.getWriteConcernError())return u(e,new _(c(t.getWriteConcernError()),t),null),!0}}Object.defineProperty(T.prototype,"length",{enumerable:!0,get:function(){return this.s.currentIndex}}),e.exports={Batch:class{constructor(e,t){this.originalZeroIndex=t,this.currentIndex=0,this.originalIndexes=[],this.batchType=e,this.operations=[],this.size=0,this.sizeBytes=0}},BulkOperationBase:T,bson:g,INSERT:1,UPDATE:2,REMOVE:3,BulkWriteError:_}},function(e,t,n){"use strict";const r=n(2).MongoError,o=n(26),i=n(17).CursorState;class s extends o{constructor(e,t,n){super(e,t,n)}batchSize(e){if(this.s.state===i.CLOSED||this.isDead())throw r.create({message:"Cursor is closed",driver:!0});if("number"!=typeof e)throw r.create({message:"batchSize requires an integer",driver:!0});return this.operation.options.batchSize=e,this.setCursorBatchSize(e),this}geoNear(e){return this.operation.addToPipeline({$geoNear:e}),this}group(e){return this.operation.addToPipeline({$group:e}),this}limit(e){return this.operation.addToPipeline({$limit:e}),this}match(e){return this.operation.addToPipeline({$match:e}),this}maxTimeMS(e){return this.operation.options.maxTimeMS=e,this}out(e){return this.operation.addToPipeline({$out:e}),this}project(e){return this.operation.addToPipeline({$project:e}),this}lookup(e){return this.operation.addToPipeline({$lookup:e}),this}redact(e){return this.operation.addToPipeline({$redact:e}),this}skip(e){return this.operation.addToPipeline({$skip:e}),this}sort(e){return this.operation.addToPipeline({$sort:e}),this}unwind(e){return this.operation.addToPipeline({$unwind:e}),this}getLogger(){return this.logger}}s.prototype.get=s.prototype.toArray,e.exports=s},function(e,t,n){"use strict";const r=n(2).ReadPreference,o=n(2).MongoError,i=n(26),s=n(17).CursorState;class a extends i{constructor(e,t,n,r){super(e,t,n,r)}setReadPreference(e){if(this.s.state===s.CLOSED||this.isDead())throw o.create({message:"Cursor is closed",driver:!0});if(this.s.state!==s.INIT)throw o.create({message:"cannot change cursor readPreference after cursor has been accessed",driver:!0});if(e instanceof r)this.options.readPreference=e;else{if("string"!=typeof e)throw new TypeError("Invalid read preference: "+e);this.options.readPreference=new r(e)}return this}batchSize(e){if(this.s.state===s.CLOSED||this.isDead())throw o.create({message:"Cursor is closed",driver:!0});if("number"!=typeof e)throw o.create({message:"batchSize requires an integer",driver:!0});return this.cmd.cursor&&(this.cmd.cursor.batchSize=e),this.setCursorBatchSize(e),this}maxTimeMS(e){return this.topology.lastIsMaster().minWireVersion>2&&(this.cmd.maxTimeMS=e),this}getLogger(){return this.logger}}a.prototype.get=a.prototype.toArray,e.exports=a},function(e,t,n){"use strict";const r=n(1).Aspect,o=n(23),i=n(1).defineAspects,s=n(0).handleCallback;class a extends o{constructor(e,t){const n=Object.assign({},t,e.s.options);t.session&&(n.session=t.session),super(e,n)}execute(e){super.execute((t,n)=>t?s(e,t):n.ok?s(e,null,!0):void s(e,null,!1))}}i(a,r.WRITE_OPERATION);e.exports={DropOperation:a,DropCollectionOperation:class extends a{constructor(e,t,n){super(e,n),this.name=t,this.namespace=`${e.namespace}.${t}`}_buildCommand(){return{drop:this.name}}},DropDatabaseOperation:class extends a{_buildCommand(){return{dropDatabase:1}}}}},function(e,t,n){"use strict";let r,o,i;e.exports={loadCollection:function(){return r||(r=n(61)),r},loadCursor:function(){return o||(o=n(26)),o},loadDb:function(){return i||(i=n(98)),i}}},function(e,t,n){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.transformRowUsingColumnMap=t.prepareTableForImport=void 0;const o=r(n(102)),i=r(n(296)),s=r(n(162));t.prepareTableForImport=function(e){const t=(0,o.default)(e);return t.foreignKeys=[],t.indexes=[],t.uniques=[],t.checks=[],t.primaryKey&&(t.primaryKey.constraintName=null),t},t.transformRowUsingColumnMap=function(e,t){return(0,i.default)(t.map(t=>[t.dst,(0,s.default)(e,t.src)]))}},function(e,t,n){var r=n(103),o=n(265),i=n(106),s=n(266),a=n(273),c=n(276),u=n(277),l=n(278),f=n(280),p=n(157),d=n(159),h=n(70),m=n(284),g=n(285),y=n(290),b=n(12),v=n(109),S=n(292),w=n(28),_=n(294),O=n(49),T=n(112),C={};C["[object Arguments]"]=C["[object Array]"]=C["[object ArrayBuffer]"]=C["[object DataView]"]=C["[object Boolean]"]=C["[object Date]"]=C["[object Float32Array]"]=C["[object Float64Array]"]=C["[object Int8Array]"]=C["[object Int16Array]"]=C["[object Int32Array]"]=C["[object Map]"]=C["[object Number]"]=C["[object Object]"]=C["[object RegExp]"]=C["[object Set]"]=C["[object String]"]=C["[object Symbol]"]=C["[object Uint8Array]"]=C["[object Uint8ClampedArray]"]=C["[object Uint16Array]"]=C["[object Uint32Array]"]=!0,C["[object Error]"]=C["[object Function]"]=C["[object WeakMap]"]=!1,e.exports=function e(t,n,x,E,N,I){var A,k=1&n,M=2&n,R=4&n;if(x&&(A=N?x(t,E,N,I):x(t)),void 0!==A)return A;if(!w(t))return t;var j=b(t);if(j){if(A=m(t),!k)return u(t,A)}else{var D=h(t),P="[object Function]"==D||"[object GeneratorFunction]"==D;if(v(t))return c(t,k);if("[object Object]"==D||"[object Arguments]"==D||P&&!N){if(A=M||P?{}:y(t),!k)return M?f(t,a(A,t)):l(t,s(A,t))}else{if(!C[D])return N?t:{};A=g(t,D,k)}}I||(I=new r);var B=I.get(t);if(B)return B;I.set(t,A),_(t)?t.forEach((function(r){A.add(e(r,n,x,r,t,I))})):S(t)&&t.forEach((function(r,o){A.set(o,e(r,n,x,o,t,I))}));var L=j?void 0:(R?M?d:p:M?T:O)(t);return o(L||t,(function(r,o){L&&(r=t[o=r]),i(A,o,e(r,n,x,o,t,I))})),A}},function(e,t,n){var r=n(25),o=n(28);e.exports=function(e){if(!o(e))return!1;var t=r(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t}},function(e,t){var n="object"==typeof global&&global&&global.Object===Object&&global;e.exports=n},function(e,t){var n=Function.prototype.toString;e.exports=function(e){if(null!=e){try{return n.call(e)}catch(e){}try{return e+""}catch(e){}}return""}},function(e,t,n){var r=n(31),o=function(){try{var e=r(Object,"defineProperty");return e({},"",{}),e}catch(e){}}();e.exports=o},function(e,t,n){var r=n(267),o=n(108),i=n(12),s=n(109),a=n(68),c=n(153),u=Object.prototype.hasOwnProperty;e.exports=function(e,t){var n=i(e),l=!n&&o(e),f=!n&&!l&&s(e),p=!n&&!l&&!f&&c(e),d=n||l||f||p,h=d?r(e.length,String):[],m=h.length;for(var g in e)!t&&!u.call(e,g)||d&&("length"==g||f&&("offset"==g||"parent"==g)||p&&("buffer"==g||"byteLength"==g||"byteOffset"==g)||a(g,m))||h.push(g);return h}},function(e,t,n){var r=n(270),o=n(37),i=n(69),s=i&&i.isTypedArray,a=s?o(s):r;e.exports=a},function(e,t){e.exports=function(e,t){return function(n){return e(t(n))}}},function(e,t){e.exports=function(){return[]}},function(e,t,n){var r=n(114),o=n(115),i=n(113),s=n(155),a=Object.getOwnPropertySymbols?function(e){for(var t=[];e;)r(t,i(e)),e=o(e);return t}:s;e.exports=a},function(e,t,n){var r=n(158),o=n(113),i=n(49);e.exports=function(e){return r(e,i,o)}},function(e,t,n){var r=n(114),o=n(12);e.exports=function(e,t,n){var i=t(e);return o(e)?i:r(i,n(e))}},function(e,t,n){var r=n(158),o=n(156),i=n(112);e.exports=function(e){return r(e,i,o)}},function(e,t,n){var r=n(31)(n(19),"Set");e.exports=r},function(e,t,n){var r=n(19).Uint8Array;e.exports=r},function(e,t,n){var r=n(50);e.exports=function(e,t,n){var o=null==e?void 0:r(e,t);return void 0===o?n:o}},function(e,t,n){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.findEngineDriver=t.extractShellApiFunctionName=t.extractPackageName=t.extractShellApiPlugins=void 0;const o=r(n(301)),i=r(n(72)),s=r(n(73));t.extractShellApiPlugins=function(e,t){const n=[],r=e.match(/^([^@]+)@([^@]+)/);if(r&&n.push(r[2]),t&&t.connection&&t.connection.engine){const e=t.connection.engine.match(/^([^@]+)@([^@]+)/);e&&n.push(e[2])}return n},t.extractPackageName=function(e){if(!e)return null;const t=e.match(/^([^@]+)@([^@]+)/);return t?t[2]:null},t.extractShellApiFunctionName=function(e){const t=e.match(/^([^@]+)@([^@]+)/);return t?`${(0,o.default)(t[2])}.shellApi.${t[1]}`:`dbgateApi.${e}`},t.findEngineDriver=function(e,t){if((0,i.default)(e))return t.drivers.find(t=>t.engine==e);if((0,s.default)(e)){const{engine:n}=e;if(n)return t.drivers.find(e=>e.engine==n)}return null}},function(e,t){e.exports=function(e,t,n){var r=-1,o=e.length;t<0&&(t=-t>o?0:o+t),(n=n>o?o:n)<0&&(n+=o),o=t>n?0:n-t>>>0,t>>>=0;for(var i=Array(o);++r<o;)i[r]=e[r+t];return i}},function(e,t){var n=RegExp("[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\ufe0e\\ufe0f]");e.exports=function(e){return n.test(e)}},function(e,t,n){var r=n(323);e.exports=function(e,t){return!!(null==e?0:e.length)&&r(e,t,0)>-1}},function(e,t){e.exports=function(e,t,n){for(var r=-1,o=null==e?0:e.length;++r<o;)if(n(t,e[r]))return!0;return!1}},function(e,t,n){var r=n(74),o=n(169),i=n(170);e.exports=function(e,t){return i(o(e,t,r),e+"")}},function(e,t,n){var r=n(327),o=Math.max;e.exports=function(e,t,n){return t=o(void 0===t?e.length-1:t,0),function(){for(var i=arguments,s=-1,a=o(i.length-t,0),c=Array(a);++s<a;)c[s]=i[t+s];s=-1;for(var u=Array(t+1);++s<t;)u[s]=i[s];return u[t]=n(c),r(e,this,u)}}},function(e,t,n){var r=n(328),o=n(330)(r);e.exports=o},function(e,t,n){var r=n(114),o=n(334);e.exports=function e(t,n,i,s,a){var c=-1,u=t.length;for(i||(i=o),a||(a=[]);++c<u;){var l=t[c];n>0&&i(l)?n>1?e(l,n-1,i,s,a):r(a,l):s||(a[a.length]=l)}return a}},function(e,t,n){var r=n(118),o=n(339),i=n(119);e.exports=function(e,t,n,s,a,c){var u=1&n,l=e.length,f=t.length;if(l!=f&&!(u&&f>l))return!1;var p=c.get(e),d=c.get(t);if(p&&d)return p==t&&d==e;var h=-1,m=!0,g=2&n?new r:void 0;for(c.set(e,t),c.set(t,e);++h<l;){var y=e[h],b=t[h];if(s)var v=u?s(b,y,h,t,e,c):s(y,b,h,e,t,c);if(void 0!==v){if(v)continue;m=!1;break}if(g){if(!o(t,(function(e,t){if(!i(g,t)&&(y===e||a(y,e,n,s,c)))return g.push(t)}))){m=!1;break}}else if(y!==b&&!a(y,b,n,s,c)){m=!1;break}}return c.delete(e),c.delete(t),m}},function(e,t,n){var r=n(28);e.exports=function(e){return e==e&&!r(e)}},function(e,t){e.exports=function(e,t){return function(n){return null!=n&&(n[e]===t&&(void 0!==t||e in Object(n)))}}},function(e,t,n){var r=n(345),o=n(346);e.exports=function(e,t){return null!=e&&o(e,t,r)}},function(e,t,n){var r=n(351),o=n(354)(r);e.exports=o},function(e,t,n){var r=n(363),o=n(178)((function(e,t){return null==e?{}:r(e,t)}));e.exports=o},function(e,t,n){var r=n(75),o=n(169),i=n(170);e.exports=function(e){return i(o(e,void 0,r),e+"")}},function(e,t,n){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.SqlDumper=void 0;const o=r(n(24)),i=r(n(72)),s=r(n(124)),a=r(n(367)),c=r(n(12)),u=r(n(73)),l=r(n(125));t.SqlDumper=class{constructor(e){this.s="",this.indentLevel=0,this.driver=e,this.dialect=e.dialect}endCommand(){this.putRaw(";\n")}putRaw(e){this.s+=e}escapeString(e){const t=this.dialect.stringEscapeChar;let n="";for(let r=0;r<e.length;r++){const o=e[r];o!=t&&"'"!=o||(n+=t),n+=o}return n}putStringValue(e){this.putRaw("'"),this.putRaw(this.escapeString(e)),this.putRaw("'")}putByteArrayValue(e){this.putRaw("NULL")}putValue(e){null===e?this.putRaw("NULL"):!0===e?this.putRaw("1"):!1===e?this.putRaw("0"):(0,i.default)(e)?this.putStringValue(e):(0,s.default)(e)?this.putRaw(e.toString()):(0,a.default)(e)?this.putStringValue(new Date(e).toISOString()):"Buffer"==(null==e?void 0:e.type)&&(0,c.default)(null==e?void 0:e.data)?this.putByteArrayValue(null==e?void 0:e.data):(0,u.default)(e)||(0,c.default)(e)?this.putStringValue(JSON.stringify(e)):this.putRaw("NULL")}putCmd(e,...t){this.put(e,...t),this.endCommand()}putFormattedValue(e,t){switch(e){case"s":null!=t&&this.putRaw(t.toString());break;case"i":this.putRaw(this.dialect.quoteIdentifier(t));break;case"k":t&&this.putRaw(t.toUpperCase());break;case"f":{const{schemaName:e,pureName:n}=t;e&&(this.putRaw(this.dialect.quoteIdentifier(e)),this.putRaw(".")),this.putRaw(this.dialect.quoteIdentifier(n))}break;case"v":this.putValue(t);break;case"c":t(this)}}putFormattedList(e,t){t&&this.putCollection(", ",t,t=>this.putFormattedValue(e,t))}put(e,...t){let n=0,r=0;const o=e.length;for(;n<o;){let i=e[n];switch(n++,i){case"^":for(;n<o&&e[n].match(/[a-z0-9_]/i);)this.putRaw(e[n].toUpperCase()),n++;break;case"%":switch(i=e[n],n++,i){case"%":this.putRaw("%");break;case",":i=e[n],n++,this.putFormattedList(i,t[r]);break;default:this.putFormattedValue(i,t[r])}r++;break;case"&":switch(i=e[n],n++,i){case"&":this.putRaw("&");break;case">":this.indentLevel++;break;case"<":this.indentLevel--;break;case"n":this.putRaw("\n"),this.putRaw(" ".repeat(2*this.indentLevel))}break;default:this.putRaw(i)}}}autoIncrement(){this.put(" ^auto_increment")}specialColumnOptions(e){}columnDefinition(e,{includeDefault:t=!0,includeNullable:n=!0,includeCollate:r=!0}={}){var o;if(e.computedExpression)return this.put("^as %s",e.computedExpression),void(e.isPersisted&&this.put(" ^persisted"));this.put("%k",e.dataType||this.dialect.fallbackDataType),e.autoIncrement&&this.autoIncrement(),this.putRaw(" "),this.specialColumnOptions(e),n&&this.put(e.notNull?"^not ^null":"^null"),t&&(null===(o=e.defaultValue)||void 0===o?void 0:o.trim())&&this.columnDefault(e)}columnDefault(e){null!=e.defaultConstraint?this.put(" ^constraint %i ^default %s ",e.defaultConstraint,e.defaultValue):this.put(" ^default %s ",e.defaultValue)}putCollection(e,t,n){if(!t)return;let r=!0;for(const o of t)r||this.put(e),r=!1,n(o)}createTable(e){this.put("^create ^table %f ( &>&n",e),this.putCollection(",&n",e.columns,e=>{this.put("%i ",e.columnName),this.columnDefinition(e)}),e.primaryKey&&(this.put(",&n"),e.primaryKey.constraintName&&this.put("^constraint %i",e.primaryKey.constraintName),this.put(" ^primary ^key (%,i)",e.primaryKey.columns.map(e=>e.columnName))),(e.foreignKeys||[]).forEach(e=>{this.put(",&n"),this.createForeignKeyFore(e)}),(e.uniques||[]).forEach(e=>{this.put(",&n"),this.createUniqueCore(e)}),(e.checks||[]).forEach(e=>{this.put(",&n"),this.createCheckCore(e)}),this.put("&<&n)"),this.endCommand(),(e.indexes||[]).forEach(e=>{this.createIndex(e)})}createForeignKeyFore(e){null!=e.constraintName&&this.put("^constraint %i ",e.constraintName),this.put("^foreign ^key (%,i) ^references %f (%,i)",e.columns.map(e=>e.columnName),{schemaName:e.refSchemaName,pureName:e.refTableName},e.columns.map(e=>e.refColumnName)),e.deleteAction&&this.put(" ^on ^delete %k",e.deleteAction),e.updateAction&&this.put(" ^on ^update %k",e.updateAction)}transform(e,t){t()}allowIdentityInsert(e,t){}enableConstraints(e,t){}comment(e){if(e)for(const t of e.split("\n"))this.put(" -- %s",t.trimRight())}createView(e){this.putRaw(e.createSql),this.endCommand()}dropView(e,{testIfExists:t=!1}){this.putCmd("^drop ^view %f",e)}alterView(e){this.putRaw(e.createSql.replace(/create\s+view/i,"ALTER VIEW")),this.endCommand()}changeViewSchema(e,t){}renameView(e,t){}createMatview(e){this.putRaw(e.createSql),this.endCommand()}dropMatview(e,{testIfExists:t=!1}){this.putCmd("^drop ^materialized ^view %f",e)}alterMatview(e){this.putRaw(e.createSql.replace(/create\s+view/i,"ALTER VIEW")),this.endCommand()}changeMatviewSchema(e,t){}renameMatview(e,t){}createProcedure(e){this.putRaw(e.createSql),this.endCommand()}dropProcedure(e,{testIfExists:t=!1}){this.putCmd("^drop ^procedure %f",e)}alterProcedure(e){this.putRaw(e.createSql.replace(/create\s+procedure/i,"ALTER PROCEDURE")),this.endCommand()}changeProcedureSchema(e,t){}renameProcedure(e,t){}createFunction(e){this.putRaw(e.createSql),this.endCommand()}dropFunction(e,{testIfExists:t=!1}){this.putCmd("^drop ^function %f",e)}alterFunction(e){this.putRaw(e.createSql.replace(/create\s+function/i,"ALTER FUNCTION")),this.endCommand()}changeFunctionSchema(e,t){}renameFunction(e,t){}createTrigger(e){this.putRaw(e.createSql),this.endCommand()}dropTrigger(e,{testIfExists:t=!1}){this.putCmd("^drop ^trigger %f",e)}alterTrigger(e){this.putRaw(e.createSql.replace(/create\s+trigger/i,"ALTER TRIGGER")),this.endCommand()}changeTriggerSchema(e,t){}renameTrigger(e,t){}dropConstraintCore(e){this.putCmd("^alter ^table %f ^drop ^constraint %i",e,e.constraintName)}dropConstraint(e){switch(e.constraintType){case"primaryKey":this.dropPrimaryKey(e);break;case"foreignKey":this.dropForeignKey(e);break;case"unique":this.dropUnique(e);break;case"check":this.dropCheck(e);break;case"index":this.dropIndex(e)}}createConstraint(e){switch(e.constraintType){case"primaryKey":this.createPrimaryKey(e);break;case"foreignKey":this.createForeignKey(e);break;case"unique":this.createUnique(e);break;case"check":this.createCheck(e);break;case"index":this.createIndex(e)}}changeConstraint(e,t){}dropForeignKey(e){this.dialect.explicitDropConstraint?this.putCmd("^alter ^table %f ^drop ^foreign ^key %i",e,e.constraintName):this.dropConstraintCore(e)}createForeignKey(e){this.put("^alter ^table %f ^add ",e),this.createForeignKeyFore(e),this.endCommand()}dropPrimaryKey(e){this.dialect.explicitDropConstraint?this.putCmd("^alter ^table %f ^drop ^primary ^key",e):this.dropConstraintCore(e)}createPrimaryKey(e){this.putCmd("^alter ^table %f ^add ^constraint %i ^primary ^key (%,i)",e,e.constraintName,e.columns.map(e=>e.columnName))}dropIndex(e){this.put("^drop ^index %i",e.constraintName),this.dialect.dropIndexContainsTableSpec&&this.put(" ^on %f",e),this.endCommand()}createIndex(e){this.put("^create"),e.isUnique&&this.put(" ^unique"),this.put(" ^index %i &n^on %f (&>&n",e.constraintName,e),this.putCollection(",&n",e.columns,e=>{this.put("%i %k",e.columnName,1==e.isDescending?"DESC":"ASC")}),this.put("&<&n)"),this.endCommand()}dropUnique(e){this.dropConstraintCore(e)}createUniqueCore(e){this.put("^constraint %i ^unique (%,i)",e.constraintName,e.columns.map(e=>e.columnName))}createUnique(e){this.put("^alter ^table %f ^add ",e),this.createUniqueCore(e),this.endCommand()}dropCheck(e){this.dropConstraintCore(e)}createCheckCore(e){this.put("^constraint %i ^check (%s)",e.constraintName,e.definition)}createCheck(e){this.put("^alter ^table %f ^add ",e),this.createCheckCore(e),this.endCommand()}renameConstraint(e,t){}createColumn(e,t){this.put("^alter ^table %f ^add %i ",e,e.columnName),this.columnDefinition(e),this.inlineConstraints(t),this.endCommand()}inlineConstraints(e){if(null!=e)for(const t of e)"primaryKey"==t.constraintType&&(null==t.constraintName||this.dialect.anonymousPrimaryKey||this.put(" ^constraint %i",t.constraintName),this.put(" ^primary ^key "))}dropColumn(e){this.putCmd("^alter ^table %f ^drop ^column %i",e,e.columnName)}renameColumn(e,t){}changeColumn(e,t,n){}dropTable(e,{testIfExists:t=!1}={}){this.putCmd("^drop ^table %f",e)}changeTableSchema(e,t){}renameTable(e,t){}beginTransaction(){this.putCmd("^begin ^transaction")}commitTransaction(){this.putCmd("^commit")}alterProlog(){}alterEpilog(){}selectTableIntoNewTable(e,t){this.putCmd("^select * ^into %f ^from %f",t,e)}truncateTable(e){this.putCmd("^delete ^from %f",e)}dropConstraints(e,t=!1){t&&this.dialect.dropForeignKey&&e.dependencies.forEach(e=>this.dropConstraint(e)),this.dialect.dropIndex&&e.indexes.forEach(e=>this.dropIndex(e)),this.dialect.dropForeignKey&&e.foreignKeys.forEach(e=>this.dropForeignKey(e)),this.dialect.dropPrimaryKey&&e.primaryKey&&this.dropPrimaryKey(e.primaryKey)}recreateTable(e,t){if(!e.pairingId||!t.pairingId||e.pairingId!=t.pairingId)throw new Error("Recreate is not possible: oldTable.paringId != newTable.paringId");const n=`temp_${(0,l.default)()}`,r=e.columns.map(e=>({oldcol:e,newcol:t.columns.find(t=>t.pairingId==e.pairingId)})).filter(e=>e.newcol);this.dropConstraints(e,!0),this.renameTable(e,n),this.createTable(t);const o=t.columns.find(e=>e.autoIncrement);o&&this.allowIdentityInsert(t,!0),this.putCmd("^insert ^into %f (%,i) select %,s ^from %f",t,r.map(e=>e.newcol.columnName),r.map(e=>e.oldcol.columnName),Object.assign(Object.assign({},e),{pureName:n})),o&&this.allowIdentityInsert(t,!1),this.dialect.dropForeignKey&&t.dependencies.forEach(e=>this.createConstraint(e)),this.dropTable(Object.assign(Object.assign({},e),{pureName:n}))}createSqlObject(e){this.putCmd(e.createSql)}getSqlObjectSqlName(e){switch(e){case"procedures":return"PROCEDURE";case"views":return"VIEW";case"functions":return"FUNCTION";case"triggers":return"TRIGGER";case"matviews":return"MATERIALIZED VIEW"}}dropSqlObject(e){this.putCmd("^drop %s %f",this.getSqlObjectSqlName(e.objectTypeField),e)}fillPreloadedRows(e,t,n,r,i){let s=!1;for(const a of n){const n=null==t?void 0:t.find(e=>r.every(t=>e[t]==a[t])),c=o.default.keys(a);if(n){const t=[];for(const e of c)a[e]==n[e]||(null==i?void 0:i.includes(e))||t.push(e);t.length>0&&(s&&this.put(";\n"),s=!0,this.put("^update %f ^set ",e),this.putCollection(", ",t,e=>this.put("%i=%v",e,a[e])),this.put(" ^where "),this.putCollection(" ^and ",r,e=>this.put("%i=%v",e,a[e])))}else s&&this.put(";\n"),s=!0,this.put("^insert ^into %f (%,i) ^values (%,v)",e,c,c.map(e=>a[e]))}s&&this.endCommand()}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.dumpSqlExpression=void 0;const r=n(126);t.dumpSqlExpression=function e(t,n){switch(n.exprType){case"column":n.source&&(0,r.dumpSqlSourceRef)(t,n.source)&&t.put("."),t.put("%i",n.columnName);break;case"placeholder":t.putRaw("{PLACEHOLDER}");break;case"value":t.put("%v",n.value);break;case"raw":t.put("%s",n.sql);break;case"call":t.put("%s(",n.func),n.argsPrefix&&t.put("%s ",n.argsPrefix),t.putCollection(",",n.args,n=>e(t,n)),t.put(")");break;case"methodCall":e(t,n.thisObject),t.put(".%s(",n.method),t.putCollection(",",n.args,n=>e(t,n)),t.put(")");break;case"transform":t.transform(n.transform,()=>e(t,n.expr));break;case"rowNumber":t.put(" ^row_number() ^over (^order ^by "),t.putCollection(", ",n.orderBy,n=>{e(t,n),t.put(" %k",n.direction)}),t.put(")")}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.evaluateExpression=void 0,t.evaluateExpression=function(e,t){switch(e.exprType){case"column":return t[e.columnName];case"placeholder":return t.__placeholder;case"value":return e.value;case"raw":return e.sql;case"call":case"methodCall":case"transform":return null}}},function(e,t,n){var r=n(118),o=n(166),i=n(167),s=n(119),a=n(381),c=n(123);e.exports=function(e,t,n){var u=-1,l=o,f=e.length,p=!0,d=[],h=d;if(n)p=!1,l=i;else if(f>=200){var m=t?null:a(e);if(m)return c(m);p=!1,l=s,h=new r}else h=t?[]:d;e:for(;++u<f;){var g=e[u],y=t?t(g):g;if(g=n||0!==g?g:0,p&&y==y){for(var b=h.length;b--;)if(h[b]===y)continue e;t&&h.push(y),d.push(g)}else l(h,y,n)||(h!==d&&h.push(y),d.push(g))}return d}},function(e,t,n){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.isTableColumnUnique=t.extendDatabaseInfoFromApps=t.extendDatabaseInfo=t.extendTableInfo=t.addTableDependencies=void 0;const o=r(n(75));function i(e){const t=(0,o.default)(e.tables.map(e=>e.foreignKeys||[]));return Object.assign(Object.assign({},e),{tables:e.tables.map(e=>Object.assign(Object.assign({},e),{dependencies:t.filter(t=>t.refSchemaName==e.schemaName&&t.refTableName==e.pureName)}))})}function s(e){return Object.assign(Object.assign({},e),{objectTypeField:"tables",columns:(e.columns||[]).map(t=>Object.assign({pureName:e.pureName,schemaName:e.schemaName},t)),primaryKey:e.primaryKey?Object.assign(Object.assign({},e.primaryKey),{pureName:e.pureName,schemaName:e.schemaName,constraintType:"primaryKey"}):void 0,foreignKeys:(e.foreignKeys||[]).map(t=>Object.assign(Object.assign({},t),{pureName:e.pureName,schemaName:e.schemaName,constraintType:"foreignKey"})),indexes:(e.indexes||[]).map(t=>Object.assign(Object.assign({},t),{pureName:e.pureName,schemaName:e.schemaName,constraintType:"index"})),checks:(e.checks||[]).map(t=>Object.assign(Object.assign({},t),{pureName:e.pureName,schemaName:e.schemaName,constraintType:"check"})),uniques:(e.uniques||[]).map(t=>Object.assign(Object.assign({},t),{pureName:e.pureName,schemaName:e.schemaName,constraintType:"unique"}))})}t.addTableDependencies=i,t.extendTableInfo=s,t.extendDatabaseInfo=function(e){return function(e){return Object.assign(Object.assign({},e),{tables:(e.tables||[]).map(s),collections:(e.collections||[]).map(e=>Object.assign(Object.assign({},e),{objectTypeField:"collections"})),views:(e.views||[]).map(e=>Object.assign(Object.assign({},e),{objectTypeField:"views"})),matviews:(e.matviews||[]).map(e=>Object.assign(Object.assign({},e),{objectTypeField:"matviews"})),procedures:(e.procedures||[]).map(e=>Object.assign(Object.assign({},e),{objectTypeField:"procedures"})),functions:(e.functions||[]).map(e=>Object.assign(Object.assign({},e),{objectTypeField:"functions"})),triggers:(e.triggers||[]).map(e=>Object.assign(Object.assign({},e),{objectTypeField:"triggers"}))})}(i(e))},t.extendDatabaseInfoFromApps=function(e,t){return e&&t?i(Object.assign(Object.assign({},e),{tables:e.tables.map(e=>Object.assign(Object.assign({},e),{foreignKeys:[...e.foreignKeys||[],...(0,o.default)(t.map(e=>e.virtualReferences||[])).filter(t=>t.pureName==e.pureName&&t.schemaName==e.schemaName).map(e=>Object.assign(Object.assign({},e),{constraintType:"foreignKey",isVirtual:!0}))]}))})):e},t.isTableColumnUnique=function(e,t){return!(!e.primaryKey||1!=e.primaryKey.columns.length||e.primaryKey.columns[0].columnName!=t)||!![...e.uniques||[],...(e.indexes||[]).filter(e=>e.isUnique)].find(e=>1==e.columns.length&&e.columns[0].columnName==t)}},function(e,t,n){var r=n(51),o=n(147),i=n(392),s=n(39),a=n(48),c=n(395),u=n(178),l=n(159),f=u((function(e,t){var n={};if(null==e)return n;var u=!1;t=r(t,(function(t){return t=s(t,e),u||(u=t.length>1),t})),a(e,l(e),n),u&&(n=o(n,7,c));for(var f=t.length;f--;)i(n,t[f]);return n}));e.exports=f},function(e,t,n){var r=n(404),o=n(53),i=n(82),s=n(86),a=n(83),c=n(77),u=n(130),l=n(43),f=n(129),p=n(85),d=n(84),h=n(79),m=n(80),g=n(81),y=n(78);r.BSON_INT32_MAX=2147483647,r.BSON_INT32_MIN=-2147483648,r.BSON_INT64_MAX=Math.pow(2,63)-1,r.BSON_INT64_MIN=-Math.pow(2,63),r.JS_INT_MAX=9007199254740992,r.JS_INT_MIN=-9007199254740992,r.Binary=o,r.Code=i,r.DBRef=s,r.Decimal128=a,r.Double=c,r.Int32=u,r.Long=l,r.Map=f,r.MaxKey=p,r.MinKey=d,r.ObjectId=h,r.ObjectID=h,r.BSONRegExp=m,r.Symbol=g,r.Timestamp=y,e.exports=r},function(e,t){function n(e){var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}n.keys=function(){return[]},n.resolve=n,e.exports=n,n.id=186},function(e,t,n){"use strict";const r=n(8).EventEmitter,o=n(20),i=n(9).debugOptions,s=n(6).parseHeader,a=n(30).decompress,c=n(21).Response,u=n(45).BinMsg,l=n(3).MongoNetworkError,f=n(3).MongoNetworkTimeoutError,p=n(3).MongoError,d=n(16),h=n(6).opcodes.OP_COMPRESSED,m=n(6).opcodes.OP_MSG,g=n(6).MESSAGE_HEADER_SIZE,y=n(22).Buffer,b=n(21).Query,v=n(133);let S=0;const w=["host","port","size","keepAlive","keepAliveInitialDelay","noDelay","connectionTimeout","socketTimeout","ssl","ca","crl","cert","rejectUnauthorized","promoteLongs","promoteValues","promoteBuffers","checkServerIdentity"];let _=void 0,O=!1,T={};const C=["error","close","timeout","parseError"];function x(e){delete T[e],_&&_.deleteConnection(e)}function E(e,t){const n=s(t);if(n.opCode!==h){const r=n.opCode===m?u:c;return void e.emit("message",new r(e.bson,t,n,t.slice(g),e.responseOptions),e)}n.fromCompressed=!0;let r=g;n.opCode=t.readInt32LE(r),r+=4,n.length=t.readInt32LE(r),r+=4;const o=t[r];r++,a(o,t.slice(r),(r,o)=>{if(r)return void e.emit("error",r);if(o.length!==n.length)return void e.emit("error",new p("Decompressing a compressed message from the server failed. The message is corrupt."));const i=n.opCode===m?u:c;e.emit("message",new i(e.bson,t,n,o,e.responseOptions),e)})}e.exports=class extends r{constructor(e,t){if(super(),!(t=t||{}).bson)throw new TypeError("must pass in valid bson parser");this.id=S++,this.options=t,this.logger=d("Connection",t),this.bson=t.bson,this.tag=t.tag,this.maxBsonMessageSize=t.maxBsonMessageSize||67108864,this.port=t.port||27017,this.host=t.host||"localhost",this.socketTimeout="number"==typeof t.socketTimeout?t.socketTimeout:0,this.keepAlive="boolean"!=typeof t.keepAlive||t.keepAlive,this.keepAliveInitialDelay="number"==typeof t.keepAliveInitialDelay?t.keepAliveInitialDelay:12e4,this.connectionTimeout="number"==typeof t.connectionTimeout?t.connectionTimeout:3e4,this.keepAliveInitialDelay>this.socketTimeout&&(this.keepAliveInitialDelay=Math.round(this.socketTimeout/2)),this.logger.isDebug()&&this.logger.debug(`creating connection ${this.id} with options [${JSON.stringify(i(w,t))}]`),this.responseOptions={promoteLongs:"boolean"!=typeof t.promoteLongs||t.promoteLongs,promoteValues:"boolean"!=typeof t.promoteValues||t.promoteValues,promoteBuffers:"boolean"==typeof t.promoteBuffers&&t.promoteBuffers},this.flushing=!1,this.queue=[],this.writeStream=null,this.destroyed=!1,this.timedOut=!1;const n=o.createHash("sha1");var r,s,a;n.update(this.address),this.hashedName=n.digest("hex"),this.workItems=[],this.socket=e,this.socket.once("error",(r=this,function(e){O&&x(r.id),r.logger.isDebug()&&r.logger.debug(`connection ${r.id} for [${r.address}] errored out with [${JSON.stringify(e)}]`),r.emit("error",new l(e),r)})),this.socket.once("timeout",function(e){return function(){O&&x(e.id),e.logger.isDebug()&&e.logger.debug(`connection ${e.id} for [${e.address}] timed out`),e.timedOut=!0,e.emit("timeout",new f(`connection ${e.id} to ${e.address} timed out`,{beforeHandshake:null==e.ismaster}),e)}}(this)),this.socket.once("close",function(e){return function(t){O&&x(e.id),e.logger.isDebug()&&e.logger.debug(`connection ${e.id} with for [${e.address}] closed`),t||e.emit("close",new l(`connection ${e.id} to ${e.address} closed`),e)}}(this)),this.socket.on("data",function(e){return function(t){for(;t.length>0;)if(e.bytesRead>0&&e.sizeOfMessage>0){const n=e.sizeOfMessage-e.bytesRead;if(n>t.length)t.copy(e.buffer,e.bytesRead),e.bytesRead=e.bytesRead+t.length,t=y.alloc(0);else{t.copy(e.buffer,e.bytesRead,0,n),t=t.slice(n);const r=e.buffer;e.buffer=null,e.sizeOfMessage=0,e.bytesRead=0,e.stubBuffer=null,E(e,r)}}else if(null!=e.stubBuffer&&e.stubBuffer.length>0)if(e.stubBuffer.length+t.length>4){const n=y.alloc(e.stubBuffer.length+t.length);e.stubBuffer.copy(n,0),t.copy(n,e.stubBuffer.length),t=n,e.buffer=null,e.sizeOfMessage=0,e.bytesRead=0,e.stubBuffer=null}else{const n=y.alloc(e.stubBuffer.length+t.length);e.stubBuffer.copy(n,0),t.copy(n,e.stubBuffer.length),t=y.alloc(0)}else if(t.length>4){const n=t[0]|t[1]<<8|t[2]<<16|t[3]<<24;if(n<0||n>e.maxBsonMessageSize){const t={err:"socketHandler",trace:"",bin:e.buffer,parseState:{sizeOfMessage:n,bytesRead:e.bytesRead,stubBuffer:e.stubBuffer}};return void e.emit("parseError",t,e)}if(n>4&&n<e.maxBsonMessageSize&&n>t.length)e.buffer=y.alloc(n),t.copy(e.buffer,0),e.bytesRead=t.length,e.sizeOfMessage=n,e.stubBuffer=null,t=y.alloc(0);else if(n>4&&n<e.maxBsonMessageSize&&n===t.length){const n=t;e.buffer=null,e.sizeOfMessage=0,e.bytesRead=0,e.stubBuffer=null,t=y.alloc(0),E(e,n)}else if(n<=4||n>e.maxBsonMessageSize){const r={err:"socketHandler",trace:null,bin:t,parseState:{sizeOfMessage:n,bytesRead:0,buffer:null,stubBuffer:null}};e.emit("parseError",r,e),e.buffer=null,e.sizeOfMessage=0,e.bytesRead=0,e.stubBuffer=null,t=y.alloc(0)}else{const r=t.slice(0,n);e.buffer=null,e.sizeOfMessage=0,e.bytesRead=0,e.stubBuffer=null,t=t.slice(n),E(e,r)}}else e.stubBuffer=y.alloc(t.length),t.copy(e.stubBuffer,0),t=y.alloc(0)}}(this)),O&&(s=this.id,a=this,T[s]=a,_&&_.addConnection(s,a))}setSocketTimeout(e){this.socket&&this.socket.setTimeout(e)}resetSocketTimeout(){this.socket&&this.socket.setTimeout(this.socketTimeout)}static enableConnectionAccounting(e){e&&(_=e),O=!0,T={}}static disableConnectionAccounting(){O=!1,_=void 0}static connections(){return T}get address(){return`${this.host}:${this.port}`}unref(){null!=this.socket?this.socket.unref():this.once("connect",()=>this.socket.unref())}flush(e){for(;this.workItems.length>0;){const t=this.workItems.shift();t.cb&&t.cb(e)}}destroy(e,t){if("function"==typeof e&&(t=e,e={}),e=Object.assign({force:!1},e),O&&x(this.id),null!=this.socket)return e.force||this.timedOut?(this.socket.destroy(),this.destroyed=!0,void("function"==typeof t&&t(null,null))):void this.socket.end(e=>{this.destroyed=!0,"function"==typeof t&&t(e,null)});this.destroyed=!0}write(e){if(this.logger.isDebug())if(Array.isArray(e))for(let t=0;t<e.length;t++)this.logger.debug(`writing buffer [${e[t].toString("hex")}] to ${this.address}`);else this.logger.debug(`writing buffer [${e.toString("hex")}] to ${this.address}`);if(!1===this.socket.destroyed){if(!Array.isArray(e))return this.socket.write(e,"binary"),!0;for(let t=0;t<e.length;t++)this.socket.write(e[t],"binary");return!0}return!1}toString(){return""+this.id}toJSON(){return{id:this.id,host:this.host,port:this.port}}isConnected(){return!this.destroyed&&(!this.socket.destroyed&&this.socket.writable)}command(e,t,n,r){"function"==typeof n&&(r=n,n={});const o=this,i="number"==typeof n.socketTimeout?n.socketTimeout:0,s=o.options.bson,a=new b(s,e,t,{numberToSkip:0,numberToReturn:1}),c=()=>{};function u(e,t){r(e,t),r=c}function l(e){o.resetSocketTimeout(),C.forEach(e=>o.removeListener(e,l)),o.removeListener("message",f),null==e&&(e=new p(`runCommand failed for connection to '${o.address}'`)),o.on("error",c),u(e)}function f(e){if(e.responseTo!==a.requestId)return;o.resetSocketTimeout(),C.forEach(e=>o.removeListener(e,l)),o.removeListener("message",f),e.parse({promoteValues:!0});const t=e.documents[0];0===t.ok||t.$err||t.errmsg||t.code?u(new p(t)):u(void 0,new v(t,this,e))}o.setSocketTimeout(i),C.forEach(e=>o.once(e,l)),o.on("message",f),o.write(a.toBin())}}},function(e,t,n){"use strict";t.asyncIterator=function(){const e=this;return{next:function(){return Promise.resolve().then(()=>e.next()).then(t=>t?{value:t,done:!1}:e.close().then(()=>({value:t,done:!0})))}}}},function(e,t,n){"use strict";const r=n(13).ServerType,o=n(44).ServerDescription,i=n(190),s=n(13).TopologyType,a=i.MIN_SUPPORTED_SERVER_VERSION,c=i.MAX_SUPPORTED_SERVER_VERSION,u=i.MIN_SUPPORTED_WIRE_VERSION,l=i.MAX_SUPPORTED_WIRE_VERSION;class f{constructor(e,t,n,o,i,f,p){p=p||{},this.type=e||s.Unknown,this.setName=n||null,this.maxSetVersion=o||null,this.maxElectionId=i||null,this.servers=t||new Map,this.stale=!1,this.compatible=!0,this.compatibilityError=null,this.logicalSessionTimeoutMinutes=null,this.heartbeatFrequencyMS=p.heartbeatFrequencyMS||0,this.localThresholdMS=p.localThresholdMS||0,this.commonWireVersion=f||null,Object.defineProperty(this,"options",{value:p,enumberable:!1});for(const e of this.servers.values())if(e.type!==r.Unknown&&(e.minWireVersion>l&&(this.compatible=!1,this.compatibilityError=`Server at ${e.address} requires wire version ${e.minWireVersion}, but this version of the driver only supports up to ${l} (MongoDB ${c})`),e.maxWireVersion<u)){this.compatible=!1,this.compatibilityError=`Server at ${e.address} reports wire version ${e.maxWireVersion}, but this version of the driver requires at least ${u} (MongoDB ${a}).`;break}this.logicalSessionTimeoutMinutes=null;for(const e of this.servers){const t=e[1];if(t.isReadable){if(null==t.logicalSessionTimeoutMinutes){this.logicalSessionTimeoutMinutes=null;break}if(null==this.logicalSessionTimeoutMinutes){this.logicalSessionTimeoutMinutes=t.logicalSessionTimeoutMinutes;continue}this.logicalSessionTimeoutMinutes=Math.min(this.logicalSessionTimeoutMinutes,t.logicalSessionTimeoutMinutes)}}}updateFromSrvPollingEvent(e){const t=e.addresses(),n=new Map(this.servers);for(const e of this.servers)t.has(e[0])?t.delete(e[0]):n.delete(e[0]);if(n.size===this.servers.size&&0===t.size)return this;for(const e of t)n.set(e,new o(e));return new f(this.type,n,this.setName,this.maxSetVersion,this.maxElectionId,this.commonWireVersion,this.options,null)}update(e){const t=e.address;let n=this.type,i=this.setName,a=this.maxSetVersion,c=this.maxElectionId,u=this.commonWireVersion;e.setName&&i&&e.setName!==i&&(e=new o(t,null));const l=e.type;let h=new Map(this.servers);if(0!==e.maxWireVersion&&(u=null==u?e.maxWireVersion:Math.min(u,e.maxWireVersion)),h.set(t,e),n===s.Single)return new f(s.Single,h,i,a,c,u,this.options);if(n===s.Unknown&&(l===r.Standalone&&1!==this.servers.size?h.delete(t):n=function(e){if(e===r.Standalone)return s.Single;if(e===r.Mongos)return s.Sharded;if(e===r.RSPrimary)return s.ReplicaSetWithPrimary;if(e===r.RSGhost||e===r.Unknown)return s.Unknown;return s.ReplicaSetNoPrimary}(l)),n===s.Sharded&&-1===[r.Mongos,r.Unknown].indexOf(l)&&h.delete(t),n===s.ReplicaSetNoPrimary)if([r.Standalone,r.Mongos].indexOf(l)>=0&&h.delete(t),l===r.RSPrimary){const t=p(h,i,e,a,c);n=t[0],i=t[1],a=t[2],c=t[3]}else if([r.RSSecondary,r.RSArbiter,r.RSOther].indexOf(l)>=0){const t=function(e,t,n){let r=s.ReplicaSetNoPrimary;if((t=t||n.setName)!==n.setName)return e.delete(n.address),[r,t];n.allHosts.forEach(t=>{e.has(t)||e.set(t,new o(t))}),n.me&&n.address!==n.me&&e.delete(n.address);return[r,t]}(h,i,e);n=t[0],i=t[1]}if(n===s.ReplicaSetWithPrimary)if([r.Standalone,r.Mongos].indexOf(l)>=0)h.delete(t),n=d(h);else if(l===r.RSPrimary){const t=p(h,i,e,a,c);n=t[0],i=t[1],a=t[2],c=t[3]}else n=[r.RSSecondary,r.RSArbiter,r.RSOther].indexOf(l)>=0?function(e,t,n){if(null==t)throw new TypeError("setName is required");(t!==n.setName||n.me&&n.address!==n.me)&&e.delete(n.address);return d(e)}(h,i,e):d(h);return new f(n,h,i,a,c,u,this.options)}get error(){const e=Array.from(this.servers.values()).filter(e=>e.error);if(e.length>0)return e[0].error}get hasKnownServers(){return Array.from(this.servers.values()).some(e=>e.type!==r.Unknown)}get hasDataBearingServers(){return Array.from(this.servers.values()).some(e=>e.isDataBearing)}hasServer(e){return this.servers.has(e)}}function p(e,t,n,i,s){if((t=t||n.setName)!==n.setName)return e.delete(n.address),[d(e),t,i,s];const a=n.electionId?n.electionId:null;if(n.setVersion&&a){if(i&&s&&(i>n.setVersion||function(e,t){if(null==e)return-1;if(null==t)return 1;if(e.id instanceof Buffer&&t.id instanceof Buffer){const n=e.id,r=t.id;return n.compare(r)}const n=e.toString(),r=t.toString();return n.localeCompare(r)}(s,a)>0))return e.set(n.address,new o(n.address)),[d(e),t,i,s];s=n.electionId}null!=n.setVersion&&(null==i||n.setVersion>i)&&(i=n.setVersion);for(const t of e.keys()){const i=e.get(t);if(i.type===r.RSPrimary&&i.address!==n.address){e.set(t,new o(i.address));break}}n.allHosts.forEach(t=>{e.has(t)||e.set(t,new o(t))});const c=Array.from(e.keys()),u=n.allHosts;return c.filter(e=>-1===u.indexOf(e)).forEach(t=>{e.delete(t)}),[d(e),t,i,s]}function d(e){for(const t of e.keys())if(e.get(t).type===r.RSPrimary)return s.ReplicaSetWithPrimary;return s.ReplicaSetNoPrimary}e.exports={TopologyDescription:f}},function(e,t,n){"use strict";e.exports={MIN_SUPPORTED_SERVER_VERSION:"2.6",MAX_SUPPORTED_SERVER_VERSION:"4.4",MIN_SUPPORTED_WIRE_VERSION:2,MAX_SUPPORTED_WIRE_VERSION:9}},function(e,t,n){"use strict";const r=n(45).Msg,o=n(21).KillCursor,i=n(21).GetMore,s=n(0).calculateDurationInMs,a=new Set(["authenticate","saslStart","saslContinue","getnonce","createUser","updateUser","copydbgetnonce","copydbsaslstart","copydb"]),c=e=>Object.keys(e)[0],u=e=>e.ns,l=e=>e.ns.split(".")[0],f=e=>e.ns.split(".")[1],p=e=>e.options?`${e.options.host}:${e.options.port}`:e.address,d=(e,t)=>a.has(e)?{}:t,h={$query:"filter",$orderby:"sort",$hint:"hint",$comment:"comment",$maxScan:"maxScan",$max:"max",$min:"min",$returnKey:"returnKey",$showDiskLoc:"showRecordId",$maxTimeMS:"maxTimeMS",$snapshot:"snapshot"},m={numberToSkip:"skip",numberToReturn:"batchSize",returnFieldsSelector:"projection"},g=["tailable","oplogReplay","noCursorTimeout","awaitData","partial","exhaust"],y=e=>{if(e instanceof i)return{getMore:e.cursorId,collection:f(e),batchSize:e.numberToReturn};if(e instanceof o)return{killCursors:f(e),cursors:e.cursorIds};if(e instanceof r)return e.command;if(e.query&&e.query.$query){let t;return"admin.$cmd"===e.ns?t=Object.assign({},e.query.$query):(t={find:f(e)},Object.keys(h).forEach(n=>{void 0!==e.query[n]&&(t[h[n]]=e.query[n])})),Object.keys(m).forEach(n=>{void 0!==e[n]&&(t[m[n]]=e[n])}),g.forEach(n=>{e[n]&&(t[n]=e[n])}),void 0!==e.pre32Limit&&(t.limit=e.pre32Limit),e.query.$explain?{explain:t}:t}return e.query?e.query:e},b=(e,t)=>e instanceof i?{ok:1,cursor:{id:t.message.cursorId,ns:u(e),nextBatch:t.message.documents}}:e instanceof o?{ok:1,cursorsUnknown:e.cursorIds}:e.query&&void 0!==e.query.$query?{ok:1,cursor:{id:t.message.cursorId,ns:u(e),firstBatch:t.message.documents}}:t&&t.result?t.result:t,v=e=>{if((e=>e.s&&e.queue)(e))return{connectionId:p(e)};const t=e;return{address:t.address,connectionId:t.id}};e.exports={CommandStartedEvent:class{constructor(e,t){const n=y(t),r=c(n),o=v(e);a.has(r)&&(this.commandObj={},this.commandObj[r]=!0),Object.assign(this,o,{requestId:t.requestId,databaseName:l(t),commandName:r,command:n})}},CommandSucceededEvent:class{constructor(e,t,n,r){const o=y(t),i=c(o),a=v(e);Object.assign(this,a,{requestId:t.requestId,commandName:i,duration:s(r),reply:d(i,b(t,n))})}},CommandFailedEvent:class{constructor(e,t,n,r){const o=y(t),i=c(o),a=v(e);Object.assign(this,a,{requestId:t.requestId,commandName:i,duration:s(r),failure:d(i,n)})}}}},function(e,t){e.exports=require("tls")},function(e,t,n){"use strict";const r=n(194),o=n(195),i=n(196),s=n(197),a=n(88).ScramSHA1,c=n(88).ScramSHA256,u=n(420);e.exports={defaultAuthProviders:function(e){return{"mongodb-aws":new u(e),mongocr:new r(e),x509:new o(e),plain:new i(e),gssapi:new s(e),"scram-sha-1":new a(e),"scram-sha-256":new c(e)}}}},function(e,t,n){"use strict";const r=n(20),o=n(33).AuthProvider;e.exports=class extends o{auth(e,t){const n=e.connection,o=e.credentials,i=o.username,s=o.password,a=o.source;n.command(`${a}.$cmd`,{getnonce:1},(e,o)=>{let c=null,u=null;if(null==e){c=o.result.nonce;let e=r.createHash("md5");e.update(i+":mongo:"+s,"utf8");const t=e.digest("hex");e=r.createHash("md5"),e.update(c+i+t,"utf8"),u=e.digest("hex")}const l={authenticate:1,user:i,nonce:c,key:u};n.command(`${a}.$cmd`,l,t)})}}},function(e,t,n){"use strict";const r=n(33).AuthProvider;function o(e){const t={authenticate:1,mechanism:"MONGODB-X509"};return e.username&&Object.assign(t,{user:e.username}),t}e.exports=class extends r{prepare(e,t,n){const r=t.credentials;Object.assign(e,{speculativeAuthenticate:o(r)}),n(void 0,e)}auth(e,t){const n=e.connection,r=e.credentials;if(e.response.speculativeAuthenticate)return t();n.command("$external.$cmd",o(r),t)}}},function(e,t,n){"use strict";const r=n(9).retrieveBSON,o=n(33).AuthProvider,i=r().Binary;e.exports=class extends o{auth(e,t){const n=e.connection,r=e.credentials,o=r.username,s=r.password,a={saslStart:1,mechanism:"PLAIN",payload:new i(`\0${o}\0${s}`),autoAuthorize:1};n.command("$external.$cmd",a,t)}}},function(e,t,n){"use strict";const r=n(87),o=n(33).AuthProvider,i=n(4).retrieveKerberos,s=n(3).MongoError;let a;e.exports=class extends o{auth(e,t){const n=e.connection,o=e.credentials;if(null==o)return t(new s("credentials required"));const c=o.username;function u(e,t){return n.command("$external.$cmd",e,t)}!function(e,t){const n=e.options.host,o=e.options.port,c=e.credentials;if(!n||!o||!c)return t(new s(`Connection must specify: ${n?"host":""}, ${o?"port":""}, ${c?"host":"credentials"}.`));if(null==a)try{a=i()}catch(e){return t(e)}const u=c.username,l=c.password,f=c.mechanismProperties,p=f.gssapiservicename||f.gssapiServiceName||"mongodb";!function(e,t,n){if("boolean"!=typeof t.gssapiCanonicalizeHostName||!t.gssapiCanonicalizeHostName)return n(void 0,e);r.resolveCname(e,(t,r)=>t?n(t):Array.isArray(r)&&r.length>0?n(void 0,r[0]):void n(void 0,e))}(n,f,(e,n)=>{if(e)return t(e);const r={};null!=l&&Object.assign(r,{user:u,password:l}),a.initializeClient(`${p}${"win32"===process.platform?"/":"@"}${n}`,r,(e,n)=>{if(e)return t(new s(e));t(null,n)})})}(e,(e,n)=>e?t(e):null==n?t(new s("gssapi client missing")):void n.step("",(e,r)=>{if(e)return t(e);u(function(e){return{saslStart:1,mechanism:"GSSAPI",payload:e,autoAuthorize:1}}(r),(e,r)=>{if(e)return t(e);const o=r.result;!function e(t,n,r,o){t.step(r,(i,s)=>i&&0===n?o(i):i?e(t,n-1,r,o):void o(void 0,s||""))}(n,10,o.payload,(e,r)=>{if(e)return t(e);u(function(e,t){return{saslContinue:1,conversationId:t,payload:e}}(r,o.conversationId),(e,r)=>{if(e)return t(e);const o=r.result;!function(e,t,n,r){e.unwrap(n,(n,o)=>{if(n)return r(n);e.wrap(o||"",{user:t},(e,t)=>{if(e)return r(e);r(void 0,t)})})}(n,c,o.payload,(e,n)=>{if(e)return t(e);u({saslContinue:1,conversationId:o.conversationId,payload:n},(e,n)=>{if(e)return t(e);t(void 0,n)})})})})})}))}}},function(e,t,n){"use strict";function r(e){if(e){if(Array.isArray(e.saslSupportedMechs))return e.saslSupportedMechs.indexOf("SCRAM-SHA-256")>=0?"scram-sha-256":"scram-sha-1";if(e.maxWireVersion>=3)return"scram-sha-1"}return"mongocr"}class o{constructor(e){e=e||{},this.username=e.username,this.password=e.password,this.source=e.source||e.db,this.mechanism=e.mechanism||"default",this.mechanismProperties=e.mechanismProperties||{},this.mechanism.match(/MONGODB-AWS/i)&&(null==this.username&&process.env.AWS_ACCESS_KEY_ID&&(this.username=process.env.AWS_ACCESS_KEY_ID),null==this.password&&process.env.AWS_SECRET_ACCESS_KEY&&(this.password=process.env.AWS_SECRET_ACCESS_KEY),null==this.mechanismProperties.AWS_SESSION_TOKEN&&process.env.AWS_SESSION_TOKEN&&(this.mechanismProperties.AWS_SESSION_TOKEN=process.env.AWS_SESSION_TOKEN)),Object.freeze(this.mechanismProperties),Object.freeze(this)}equals(e){return this.mechanism===e.mechanism&&this.username===e.username&&this.password===e.password&&this.source===e.source}resolveAuthMechanism(e){return this.mechanism.match(/DEFAULT/i)?new o({username:this.username,password:this.password,source:this.source,mechanism:r(e),mechanismProperties:this.mechanismProperties}):this}}e.exports={MongoCredentials:o}},function(e,t,n){"use strict";const r=n(424);e.exports={insert:function(e,t,n,o,i){r(e,"insert","documents",t,n,o,i)},update:function(e,t,n,o,i){r(e,"update","updates",t,n,o,i)},remove:function(e,t,n,o,i){r(e,"delete","deletes",t,n,o,i)},killCursors:n(425),getMore:n(426),query:n(427),command:n(55)}},function(e,t,n){"use strict";e.exports={ServerDescriptionChangedEvent:class{constructor(e,t,n,r){Object.assign(this,{topologyId:e,address:t,previousDescription:n,newDescription:r})}},ServerOpeningEvent:class{constructor(e,t){Object.assign(this,{topologyId:e,address:t})}},ServerClosedEvent:class{constructor(e,t){Object.assign(this,{topologyId:e,address:t})}},TopologyDescriptionChangedEvent:class{constructor(e,t,n){Object.assign(this,{topologyId:e,previousDescription:t,newDescription:n})}},TopologyOpeningEvent:class{constructor(e){Object.assign(this,{topologyId:e})}},TopologyClosedEvent:class{constructor(e){Object.assign(this,{topologyId:e})}},ServerHeartbeatStartedEvent:class{constructor(e){Object.assign(this,{connectionId:e})}},ServerHeartbeatSucceededEvent:class{constructor(e,t,n){Object.assign(this,{connectionId:n,duration:e,reply:t})}},ServerHeartbeatFailedEvent:class{constructor(e,t,n){Object.assign(this,{connectionId:n,duration:e,failure:t})}}}},function(e,t,n){"use strict";const r=n(8),o=n(434),i=n(3).MongoError,s=n(3).MongoNetworkError,a=n(3).MongoNetworkTimeoutError,c=n(3).MongoWriteConcernError,u=n(133),l=n(441).StreamDescription,f=n(199),p=n(191),d=n(34).updateSessionFromResponse,h=n(4).uuidV4,m=n(0).now,g=n(0).calculateDurationInMs,y=Symbol("stream"),b=Symbol("queue"),v=Symbol("messageStream"),S=Symbol("generation"),w=Symbol("lastUseTime"),_=Symbol("clusterTime"),O=Symbol("description"),T=Symbol("ismaster"),C=Symbol("autoEncrypter");function x(e){const t={description:e.description,clusterTime:e[_],s:{bson:e.bson,pool:{write:E.bind(e),isConnected:()=>!0}}};return e[C]&&(t.autoEncrypter=e[C]),t}function E(e,t,n){"function"==typeof t&&(n=t),t=t||{};const r={requestId:e.requestId,cb:n,session:t.session,fullResult:"boolean"==typeof t.fullResult&&t.fullResult,noResponse:"boolean"==typeof t.noResponse&&t.noResponse,documentsReturnedIn:t.documentsReturnedIn,command:!!t.command,promoteLongs:"boolean"!=typeof t.promoteLongs||t.promoteLongs,promoteValues:"boolean"!=typeof t.promoteValues||t.promoteValues,promoteBuffers:"boolean"==typeof t.promoteBuffers&&t.promoteBuffers,raw:"boolean"==typeof t.raw&&t.raw};this[O]&&this[O].compressor&&(r.agreedCompressor=this[O].compressor,this[O].zlibCompressionLevel&&(r.zlibCompressionLevel=this[O].zlibCompressionLevel)),"number"==typeof t.socketTimeout&&(r.socketTimeoutOverride=!0,this[y].setTimeout(t.socketTimeout)),this.monitorCommands&&(this.emit("commandStarted",new p.CommandStartedEvent(this,e)),r.started=m(),r.cb=(t,o)=>{t?this.emit("commandFailed",new p.CommandFailedEvent(this,e,t,r.started)):o&&o.result&&(0===o.result.ok||o.result.$err)?this.emit("commandFailed",new p.CommandFailedEvent(this,e,o.result,r.started)):this.emit("commandSucceeded",new p.CommandSucceededEvent(this,e,o,r.started)),"function"==typeof n&&n(t,o)}),r.noResponse||this[b].set(r.requestId,r);try{this[v].writeCommand(e,r)}catch(e){if(!r.noResponse)return this[b].delete(r.requestId),void r.cb(e)}r.noResponse&&r.cb()}e.exports={Connection:class extends r{constructor(e,t){var n;super(t),this.id=t.id,this.address=function(e){if("function"==typeof e.address)return`${e.remoteAddress}:${e.remotePort}`;return h().toString("hex")}(e),this.bson=t.bson,this.socketTimeout="number"==typeof t.socketTimeout?t.socketTimeout:0,this.host=t.host||"localhost",this.port=t.port||27017,this.monitorCommands="boolean"==typeof t.monitorCommands&&t.monitorCommands,this.closed=!1,this.destroyed=!1,this[O]=new l(this.address,t),this[S]=t.generation,this[w]=m(),t.autoEncrypter&&(this[C]=t.autoEncrypter),this[b]=new Map,this[v]=new o(t),this[v].on("message",(n=this,function(e){if(n.emit("message",e),!n[b].has(e.responseTo))return;const t=n[b].get(e.responseTo),r=t.cb;n[b].delete(e.responseTo),e.moreToCome?n[b].set(e.requestId,t):t.socketTimeoutOverride&&n[y].setTimeout(n.socketTimeout);try{e.parse(t)}catch(e){return void r(new i(e))}if(e.documents[0]){const o=e.documents[0],s=t.session;if(s&&d(s,o),o.$clusterTime&&(n[_]=o.$clusterTime,n.emit("clusterTimeReceived",o.$clusterTime)),t.command){if(o.writeConcernError)return void r(new c(o.writeConcernError,o));if(0===o.ok||o.$err||o.errmsg||o.code)return void r(new i(o))}}r(void 0,new u(t.fullResult?e:e.documents[0],n,e))})),this[y]=e,e.on("error",()=>{}),e.on("close",()=>{this.closed||(this.closed=!0,this[b].forEach(e=>e.cb(new s(`connection ${this.id} to ${this.address} closed`))),this[b].clear(),this.emit("close"))}),e.on("timeout",()=>{this.closed||(e.destroy(),this.closed=!0,this[b].forEach(e=>e.cb(new a(`connection ${this.id} to ${this.address} timed out`,{beforeHandshake:null==this[T]}))),this[b].clear(),this.emit("close"))}),e.pipe(this[v]),this[v].pipe(e)}get description(){return this[O]}get ismaster(){return this[T]}set ismaster(e){this[O].receiveResponse(e),this[T]=e}get generation(){return this[S]||0}get idleTime(){return g(this[w])}get clusterTime(){return this[_]}get stream(){return this[y]}markAvailable(){this[w]=m()}destroy(e,t){return"function"==typeof e&&(t=e,e={}),e=Object.assign({force:!1},e),null==this[y]||this.destroyed?(this.destroyed=!0,void("function"==typeof t&&t())):e.force?(this[y].destroy(),this.destroyed=!0,void("function"==typeof t&&t())):void this[y].end(e=>{this.destroyed=!0,"function"==typeof t&&t(e)})}command(e,t,n,r){f.command(x(this),e,t,n,r)}query(e,t,n,r,o){f.query(x(this),e,t,n,r,o)}getMore(e,t,n,r,o){f.getMore(x(this),e,t,n,r,o)}killCursors(e,t,n){f.killCursors(x(this),e,t,n)}insert(e,t,n,r){f.insert(x(this),e,t,n,r)}update(e,t,n,r){f.update(x(this),e,t,n,r)}remove(e,t,n,r){f.remove(x(this),e,t,n,r)}}}},function(e,t,n){"use strict";var r=n(435).Duplex,o=n(5),i=n(22).Buffer;function s(e){if(!(this instanceof s))return new s(e);if(this._bufs=[],this.length=0,"function"==typeof e){this._callback=e;var t=function(e){this._callback&&(this._callback(e),this._callback=null)}.bind(this);this.on("pipe",(function(e){e.on("error",t)})),this.on("unpipe",(function(e){e.removeListener("error",t)}))}else this.append(e);r.call(this)}o.inherits(s,r),s.prototype._offset=function(e){var t,n=0,r=0;if(0===e)return[0,0];for(;r<this._bufs.length;r++){if(e<(t=n+this._bufs[r].length)||r==this._bufs.length-1)return[r,e-n];n=t}},s.prototype._reverseOffset=function(e){for(var t=e[0],n=e[1],r=0;r<t;r++)n+=this._bufs[r].length;return n},s.prototype.append=function(e){var t=0;if(i.isBuffer(e))this._appendBuffer(e);else if(Array.isArray(e))for(;t<e.length;t++)this.append(e[t]);else if(e instanceof s)for(;t<e._bufs.length;t++)this.append(e._bufs[t]);else null!=e&&("number"==typeof e&&(e=e.toString()),this._appendBuffer(i.from(e)));return this},s.prototype._appendBuffer=function(e){this._bufs.push(e),this.length+=e.length},s.prototype._write=function(e,t,n){this._appendBuffer(e),"function"==typeof n&&n()},s.prototype._read=function(e){if(!this.length)return this.push(null);e=Math.min(e,this.length),this.push(this.slice(0,e)),this.consume(e)},s.prototype.end=function(e){r.prototype.end.call(this,e),this._callback&&(this._callback(null,this.slice()),this._callback=null)},s.prototype.get=function(e){if(!(e>this.length||e<0)){var t=this._offset(e);return this._bufs[t[0]][t[1]]}},s.prototype.slice=function(e,t){return"number"==typeof e&&e<0&&(e+=this.length),"number"==typeof t&&t<0&&(t+=this.length),this.copy(null,0,e,t)},s.prototype.copy=function(e,t,n,r){if(("number"!=typeof n||n<0)&&(n=0),("number"!=typeof r||r>this.length)&&(r=this.length),n>=this.length)return e||i.alloc(0);if(r<=0)return e||i.alloc(0);var o,s,a=!!e,c=this._offset(n),u=r-n,l=u,f=a&&t||0,p=c[1];if(0===n&&r==this.length){if(!a)return 1===this._bufs.length?this._bufs[0]:i.concat(this._bufs,this.length);for(s=0;s<this._bufs.length;s++)this._bufs[s].copy(e,f),f+=this._bufs[s].length;return e}if(l<=this._bufs[c[0]].length-p)return a?this._bufs[c[0]].copy(e,t,p,p+l):this._bufs[c[0]].slice(p,p+l);for(a||(e=i.allocUnsafe(u)),s=c[0];s<this._bufs.length;s++){if(!(l>(o=this._bufs[s].length-p))){this._bufs[s].copy(e,f,p,p+l),f+=o;break}this._bufs[s].copy(e,f,p),f+=o,l-=o,p&&(p=0)}return e.length>f?e.slice(0,f):e},s.prototype.shallowSlice=function(e,t){if(e=e||0,t="number"!=typeof t?this.length:t,e<0&&(e+=this.length),t<0&&(t+=this.length),e===t)return new s;var n=this._offset(e),r=this._offset(t),o=this._bufs.slice(n[0],r[0]+1);return 0==r[1]?o.pop():o[o.length-1]=o[o.length-1].slice(0,r[1]),0!=n[1]&&(o[0]=o[0].slice(n[1])),new s(o)},s.prototype.toString=function(e,t,n){return this.slice(t,n).toString(e)},s.prototype.consume=function(e){if(e=Math.trunc(e),Number.isNaN(e)||e<=0)return this;for(;this._bufs.length;){if(!(e>=this._bufs[0].length)){this._bufs[0]=this._bufs[0].slice(e),this.length-=e;break}e-=this._bufs[0].length,this.length-=this._bufs[0].length,this._bufs.shift()}return this},s.prototype.duplicate=function(){for(var e=0,t=new s;e<this._bufs.length;e++)t.append(this._bufs[e]);return t},s.prototype.destroy=function(){this._bufs.length=0,this.length=0,this.push(null)},s.prototype.indexOf=function(e,t,n){if(void 0===n&&"string"==typeof t&&(n=t,t=void 0),"function"==typeof e||Array.isArray(e))throw new TypeError('The "value" argument must be one of type string, Buffer, BufferList, or Uint8Array.');if("number"==typeof e?e=i.from([e]):"string"==typeof e?e=i.from(e,n):e instanceof s?e=e.slice():i.isBuffer(e)||(e=i.from(e)),t=Number(t||0),isNaN(t)&&(t=0),t<0&&(t=this.length+t),t<0&&(t=0),0===e.length)return t>this.length?this.length:t;for(var r=this._offset(t),o=r[0],a=r[1];o<this._bufs.length;o++){for(var c=this._bufs[o];a<c.length;){if(c.length-a>=e.length){var u=c.indexOf(e,a);if(-1!==u)return this._reverseOffset([o,u]);a=c.length-e.length+1}else{var l=this._reverseOffset([o,a]);if(this._match(l,e))return l;a++}}a=0}return-1},s.prototype._match=function(e,t){if(this.length-e<t.length)return!1;for(var n=0;n<t.length;n++)if(this.get(e+n)!==t[n])return!1;return!0},function(){var e={readDoubleBE:8,readDoubleLE:8,readFloatBE:4,readFloatLE:4,readInt32BE:4,readInt32LE:4,readUInt32BE:4,readUInt32LE:4,readInt16BE:2,readInt16LE:2,readUInt16BE:2,readUInt16LE:2,readInt8:1,readUInt8:1,readIntBE:null,readIntLE:null,readUIntBE:null,readUIntLE:null};for(var t in e)!function(t){s.prototype[t]=null===e[t]?function(e,n){return this.slice(e,e+n)[t](0,n)}:function(n){return this.slice(n,n+e[t])[t](0)}}(t)}(),e.exports=s},function(e,t,n){"use strict";var r=n(92);e.exports=b;var o,i=n(436);b.ReadableState=y;n(8).EventEmitter;var s=function(e,t){return e.listeners(t).length},a=n(204),c=n(93).Buffer,u=global.Uint8Array||function(){};var l=Object.create(n(57));l.inherits=n(58);var f=n(5),p=void 0;p=f&&f.debuglog?f.debuglog("stream"):function(){};var d,h=n(438),m=n(205);l.inherits(b,a);var g=["error","close","destroy","pause","resume"];function y(e,t){e=e||{};var r=t instanceof(o=o||n(47));this.objectMode=!!e.objectMode,r&&(this.objectMode=this.objectMode||!!e.readableObjectMode);var i=e.highWaterMark,s=e.readableHighWaterMark,a=this.objectMode?16:16384;this.highWaterMark=i||0===i?i:r&&(s||0===s)?s:a,this.highWaterMark=Math.floor(this.highWaterMark),this.buffer=new h,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.destroyed=!1,this.defaultEncoding=e.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,e.encoding&&(d||(d=n(207).StringDecoder),this.decoder=new d(e.encoding),this.encoding=e.encoding)}function b(e){if(o=o||n(47),!(this instanceof b))return new b(e);this._readableState=new y(e,this),this.readable=!0,e&&("function"==typeof e.read&&(this._read=e.read),"function"==typeof e.destroy&&(this._destroy=e.destroy)),a.call(this)}function v(e,t,n,r,o){var i,s=e._readableState;null===t?(s.reading=!1,function(e,t){if(t.ended)return;if(t.decoder){var n=t.decoder.end();n&&n.length&&(t.buffer.push(n),t.length+=t.objectMode?1:n.length)}t.ended=!0,_(e)}(e,s)):(o||(i=function(e,t){var n;r=t,c.isBuffer(r)||r instanceof u||"string"==typeof t||void 0===t||e.objectMode||(n=new TypeError("Invalid non-string/buffer chunk"));var r;return n}(s,t)),i?e.emit("error",i):s.objectMode||t&&t.length>0?("string"==typeof t||s.objectMode||Object.getPrototypeOf(t)===c.prototype||(t=function(e){return c.from(e)}(t)),r?s.endEmitted?e.emit("error",new Error("stream.unshift() after end event")):S(e,s,t,!0):s.ended?e.emit("error",new Error("stream.push() after EOF")):(s.reading=!1,s.decoder&&!n?(t=s.decoder.write(t),s.objectMode||0!==t.length?S(e,s,t,!1):T(e,s)):S(e,s,t,!1))):r||(s.reading=!1));return function(e){return!e.ended&&(e.needReadable||e.length<e.highWaterMark||0===e.length)}(s)}function S(e,t,n,r){t.flowing&&0===t.length&&!t.sync?(e.emit("data",n),e.read(0)):(t.length+=t.objectMode?1:n.length,r?t.buffer.unshift(n):t.buffer.push(n),t.needReadable&&_(e)),T(e,t)}Object.defineProperty(b.prototype,"destroyed",{get:function(){return void 0!==this._readableState&&this._readableState.destroyed},set:function(e){this._readableState&&(this._readableState.destroyed=e)}}),b.prototype.destroy=m.destroy,b.prototype._undestroy=m.undestroy,b.prototype._destroy=function(e,t){this.push(null),t(e)},b.prototype.push=function(e,t){var n,r=this._readableState;return r.objectMode?n=!0:"string"==typeof e&&((t=t||r.defaultEncoding)!==r.encoding&&(e=c.from(e,t),t=""),n=!0),v(this,e,t,!1,n)},b.prototype.unshift=function(e){return v(this,e,null,!0,!1)},b.prototype.isPaused=function(){return!1===this._readableState.flowing},b.prototype.setEncoding=function(e){return d||(d=n(207).StringDecoder),this._readableState.decoder=new d(e),this._readableState.encoding=e,this};function w(e,t){return e<=0||0===t.length&&t.ended?0:t.objectMode?1:e!=e?t.flowing&&t.length?t.buffer.head.data.length:t.length:(e>t.highWaterMark&&(t.highWaterMark=function(e){return e>=8388608?e=8388608:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function _(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(p("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?r.nextTick(O,e):O(e))}function O(e){p("emit readable"),e.emit("readable"),N(e)}function T(e,t){t.readingMore||(t.readingMore=!0,r.nextTick(C,e,t))}function C(e,t){for(var n=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length<t.highWaterMark&&(p("maybeReadMore read 0"),e.read(0),n!==t.length);)n=t.length;t.readingMore=!1}function x(e){p("readable nexttick read 0"),e.read(0)}function E(e,t){t.reading||(p("resume read 0"),e.read(0)),t.resumeScheduled=!1,t.awaitDrain=0,e.emit("resume"),N(e),t.flowing&&!t.reading&&e.read(0)}function N(e){var t=e._readableState;for(p("flow",t.flowing);t.flowing&&null!==e.read(););}function I(e,t){return 0===t.length?null:(t.objectMode?n=t.buffer.shift():!e||e>=t.length?(n=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.head.data:t.buffer.concat(t.length),t.buffer.clear()):n=function(e,t,n){var r;e<t.head.data.length?(r=t.head.data.slice(0,e),t.head.data=t.head.data.slice(e)):r=e===t.head.data.length?t.shift():n?function(e,t){var n=t.head,r=1,o=n.data;e-=o.length;for(;n=n.next;){var i=n.data,s=e>i.length?i.length:e;if(s===i.length?o+=i:o+=i.slice(0,e),0===(e-=s)){s===i.length?(++r,n.next?t.head=n.next:t.head=t.tail=null):(t.head=n,n.data=i.slice(s));break}++r}return t.length-=r,o}(e,t):function(e,t){var n=c.allocUnsafe(e),r=t.head,o=1;r.data.copy(n),e-=r.data.length;for(;r=r.next;){var i=r.data,s=e>i.length?i.length:e;if(i.copy(n,n.length-e,0,s),0===(e-=s)){s===i.length?(++o,r.next?t.head=r.next:t.head=t.tail=null):(t.head=r,r.data=i.slice(s));break}++o}return t.length-=o,n}(e,t);return r}(e,t.buffer,t.decoder),n);var n}function A(e){var t=e._readableState;if(t.length>0)throw new Error('"endReadable()" called on non-empty stream');t.endEmitted||(t.ended=!0,r.nextTick(k,t,e))}function k(e,t){e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function M(e,t){for(var n=0,r=e.length;n<r;n++)if(e[n]===t)return n;return-1}b.prototype.read=function(e){p("read",e),e=parseInt(e,10);var t=this._readableState,n=e;if(0!==e&&(t.emittedReadable=!1),0===e&&t.needReadable&&(t.length>=t.highWaterMark||t.ended))return p("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?A(this):_(this),null;if(0===(e=w(e,t))&&t.ended)return 0===t.length&&A(this),null;var r,o=t.needReadable;return p("need readable",o),(0===t.length||t.length-e<t.highWaterMark)&&p("length less than watermark",o=!0),t.ended||t.reading?p("reading or ended",o=!1):o&&(p("do read"),t.reading=!0,t.sync=!0,0===t.length&&(t.needReadable=!0),this._read(t.highWaterMark),t.sync=!1,t.reading||(e=w(n,t))),null===(r=e>0?I(e,t):null)?(t.needReadable=!0,e=0):t.length-=e,0===t.length&&(t.ended||(t.needReadable=!0),n!==e&&t.ended&&A(this)),null!==r&&this.emit("data",r),r},b.prototype._read=function(e){this.emit("error",new Error("_read() is not implemented"))},b.prototype.pipe=function(e,t){var n=this,o=this._readableState;switch(o.pipesCount){case 0:o.pipes=e;break;case 1:o.pipes=[o.pipes,e];break;default:o.pipes.push(e)}o.pipesCount+=1,p("pipe count=%d opts=%j",o.pipesCount,t);var a=(!t||!1!==t.end)&&e!==process.stdout&&e!==process.stderr?u:b;function c(t,r){p("onunpipe"),t===n&&r&&!1===r.hasUnpiped&&(r.hasUnpiped=!0,p("cleanup"),e.removeListener("close",g),e.removeListener("finish",y),e.removeListener("drain",l),e.removeListener("error",m),e.removeListener("unpipe",c),n.removeListener("end",u),n.removeListener("end",b),n.removeListener("data",h),f=!0,!o.awaitDrain||e._writableState&&!e._writableState.needDrain||l())}function u(){p("onend"),e.end()}o.endEmitted?r.nextTick(a):n.once("end",a),e.on("unpipe",c);var l=function(e){return function(){var t=e._readableState;p("pipeOnDrain",t.awaitDrain),t.awaitDrain&&t.awaitDrain--,0===t.awaitDrain&&s(e,"data")&&(t.flowing=!0,N(e))}}(n);e.on("drain",l);var f=!1;var d=!1;function h(t){p("ondata"),d=!1,!1!==e.write(t)||d||((1===o.pipesCount&&o.pipes===e||o.pipesCount>1&&-1!==M(o.pipes,e))&&!f&&(p("false write response, pause",n._readableState.awaitDrain),n._readableState.awaitDrain++,d=!0),n.pause())}function m(t){p("onerror",t),b(),e.removeListener("error",m),0===s(e,"error")&&e.emit("error",t)}function g(){e.removeListener("finish",y),b()}function y(){p("onfinish"),e.removeListener("close",g),b()}function b(){p("unpipe"),n.unpipe(e)}return n.on("data",h),function(e,t,n){if("function"==typeof e.prependListener)return e.prependListener(t,n);e._events&&e._events[t]?i(e._events[t])?e._events[t].unshift(n):e._events[t]=[n,e._events[t]]:e.on(t,n)}(e,"error",m),e.once("close",g),e.once("finish",y),e.emit("pipe",n),o.flowing||(p("pipe resume"),n.resume()),e},b.prototype.unpipe=function(e){var t=this._readableState,n={hasUnpiped:!1};if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes?this:(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this,n),this);if(!e){var r=t.pipes,o=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var i=0;i<o;i++)r[i].emit("unpipe",this,n);return this}var s=M(t.pipes,e);return-1===s?this:(t.pipes.splice(s,1),t.pipesCount-=1,1===t.pipesCount&&(t.pipes=t.pipes[0]),e.emit("unpipe",this,n),this)},b.prototype.on=function(e,t){var n=a.prototype.on.call(this,e,t);if("data"===e)!1!==this._readableState.flowing&&this.resume();else if("readable"===e){var o=this._readableState;o.endEmitted||o.readableListening||(o.readableListening=o.needReadable=!0,o.emittedReadable=!1,o.reading?o.length&&_(this):r.nextTick(x,this))}return n},b.prototype.addListener=b.prototype.on,b.prototype.resume=function(){var e=this._readableState;return e.flowing||(p("resume"),e.flowing=!0,function(e,t){t.resumeScheduled||(t.resumeScheduled=!0,r.nextTick(E,e,t))}(this,e)),this},b.prototype.pause=function(){return p("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(p("pause"),this._readableState.flowing=!1,this.emit("pause")),this},b.prototype.wrap=function(e){var t=this,n=this._readableState,r=!1;for(var o in e.on("end",(function(){if(p("wrapped end"),n.decoder&&!n.ended){var e=n.decoder.end();e&&e.length&&t.push(e)}t.push(null)})),e.on("data",(function(o){(p("wrapped data"),n.decoder&&(o=n.decoder.write(o)),n.objectMode&&null==o)||(n.objectMode||o&&o.length)&&(t.push(o)||(r=!0,e.pause()))})),e)void 0===this[o]&&"function"==typeof e[o]&&(this[o]=function(t){return function(){return e[t].apply(e,arguments)}}(o));for(var i=0;i<g.length;i++)e.on(g[i],this.emit.bind(this,g[i]));return this._read=function(t){p("wrapped _read",t),r&&(r=!1,e.resume())},this},Object.defineProperty(b.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),b._fromList=I},function(e,t,n){e.exports=n(18)},function(e,t,n){"use strict";var r=n(92);function o(e,t){e.emit("error",t)}e.exports={destroy:function(e,t){var n=this,i=this._readableState&&this._readableState.destroyed,s=this._writableState&&this._writableState.destroyed;return i||s?(t?t(e):!e||this._writableState&&this._writableState.errorEmitted||r.nextTick(o,this,e),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(e||null,(function(e){!t&&e?(r.nextTick(o,n,e),n._writableState&&(n._writableState.errorEmitted=!0)):t&&t(e)})),this)},undestroy:function(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}}},function(e,t,n){"use strict";var r=n(92);function o(e){var t=this;this.next=null,this.entry=null,this.finish=function(){!function(e,t,n){var r=e.entry;e.entry=null;for(;r;){var o=r.callback;t.pendingcb--,o(n),r=r.next}t.corkedRequestsFree?t.corkedRequestsFree.next=e:t.corkedRequestsFree=e}(t,e)}}e.exports=g;var i,s=!process.browser&&["v0.10","v0.9."].indexOf(process.version.slice(0,5))>-1?setImmediate:r.nextTick;g.WritableState=m;var a=Object.create(n(57));a.inherits=n(58);var c={deprecate:n(439)},u=n(204),l=n(93).Buffer,f=global.Uint8Array||function(){};var p,d=n(205);function h(){}function m(e,t){i=i||n(47),e=e||{};var a=t instanceof i;this.objectMode=!!e.objectMode,a&&(this.objectMode=this.objectMode||!!e.writableObjectMode);var c=e.highWaterMark,u=e.writableHighWaterMark,l=this.objectMode?16:16384;this.highWaterMark=c||0===c?c:a&&(u||0===u)?u:l,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var f=!1===e.decodeStrings;this.decodeStrings=!f,this.defaultEncoding=e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){!function(e,t){var n=e._writableState,o=n.sync,i=n.writecb;if(function(e){e.writing=!1,e.writecb=null,e.length-=e.writelen,e.writelen=0}(n),t)!function(e,t,n,o,i){--t.pendingcb,n?(r.nextTick(i,o),r.nextTick(_,e,t),e._writableState.errorEmitted=!0,e.emit("error",o)):(i(o),e._writableState.errorEmitted=!0,e.emit("error",o),_(e,t))}(e,n,o,t,i);else{var a=S(n);a||n.corked||n.bufferProcessing||!n.bufferedRequest||v(e,n),o?s(b,e,n,a,i):b(e,n,a,i)}}(t,e)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new o(this)}function g(e){if(i=i||n(47),!(p.call(g,this)||this instanceof i))return new g(e);this._writableState=new m(e,this),this.writable=!0,e&&("function"==typeof e.write&&(this._write=e.write),"function"==typeof e.writev&&(this._writev=e.writev),"function"==typeof e.destroy&&(this._destroy=e.destroy),"function"==typeof e.final&&(this._final=e.final)),u.call(this)}function y(e,t,n,r,o,i,s){t.writelen=r,t.writecb=s,t.writing=!0,t.sync=!0,n?e._writev(o,t.onwrite):e._write(o,i,t.onwrite),t.sync=!1}function b(e,t,n,r){n||function(e,t){0===t.length&&t.needDrain&&(t.needDrain=!1,e.emit("drain"))}(e,t),t.pendingcb--,r(),_(e,t)}function v(e,t){t.bufferProcessing=!0;var n=t.bufferedRequest;if(e._writev&&n&&n.next){var r=t.bufferedRequestCount,i=new Array(r),s=t.corkedRequestsFree;s.entry=n;for(var a=0,c=!0;n;)i[a]=n,n.isBuf||(c=!1),n=n.next,a+=1;i.allBuffers=c,y(e,t,!0,t.length,i,"",s.finish),t.pendingcb++,t.lastBufferedRequest=null,s.next?(t.corkedRequestsFree=s.next,s.next=null):t.corkedRequestsFree=new o(t),t.bufferedRequestCount=0}else{for(;n;){var u=n.chunk,l=n.encoding,f=n.callback;if(y(e,t,!1,t.objectMode?1:u.length,u,l,f),n=n.next,t.bufferedRequestCount--,t.writing)break}null===n&&(t.lastBufferedRequest=null)}t.bufferedRequest=n,t.bufferProcessing=!1}function S(e){return e.ending&&0===e.length&&null===e.bufferedRequest&&!e.finished&&!e.writing}function w(e,t){e._final((function(n){t.pendingcb--,n&&e.emit("error",n),t.prefinished=!0,e.emit("prefinish"),_(e,t)}))}function _(e,t){var n=S(t);return n&&(!function(e,t){t.prefinished||t.finalCalled||("function"==typeof e._final?(t.pendingcb++,t.finalCalled=!0,r.nextTick(w,e,t)):(t.prefinished=!0,e.emit("prefinish")))}(e,t),0===t.pendingcb&&(t.finished=!0,e.emit("finish"))),n}a.inherits(g,u),m.prototype.getBuffer=function(){for(var e=this.bufferedRequest,t=[];e;)t.push(e),e=e.next;return t},function(){try{Object.defineProperty(m.prototype,"buffer",{get:c.deprecate((function(){return this.getBuffer()}),"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(e){}}(),"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(p=Function.prototype[Symbol.hasInstance],Object.defineProperty(g,Symbol.hasInstance,{value:function(e){return!!p.call(this,e)||this===g&&(e&&e._writableState instanceof m)}})):p=function(e){return e instanceof this},g.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))},g.prototype.write=function(e,t,n){var o,i=this._writableState,s=!1,a=!i.objectMode&&(o=e,l.isBuffer(o)||o instanceof f);return a&&!l.isBuffer(e)&&(e=function(e){return l.from(e)}(e)),"function"==typeof t&&(n=t,t=null),a?t="buffer":t||(t=i.defaultEncoding),"function"!=typeof n&&(n=h),i.ended?function(e,t){var n=new Error("write after end");e.emit("error",n),r.nextTick(t,n)}(this,n):(a||function(e,t,n,o){var i=!0,s=!1;return null===n?s=new TypeError("May not write null values to stream"):"string"==typeof n||void 0===n||t.objectMode||(s=new TypeError("Invalid non-string/buffer chunk")),s&&(e.emit("error",s),r.nextTick(o,s),i=!1),i}(this,i,e,n))&&(i.pendingcb++,s=function(e,t,n,r,o,i){if(!n){var s=function(e,t,n){e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=l.from(t,n));return t}(t,r,o);r!==s&&(n=!0,o="buffer",r=s)}var a=t.objectMode?1:r.length;t.length+=a;var c=t.length<t.highWaterMark;c||(t.needDrain=!0);if(t.writing||t.corked){var u=t.lastBufferedRequest;t.lastBufferedRequest={chunk:r,encoding:o,isBuf:n,callback:i,next:null},u?u.next=t.lastBufferedRequest:t.bufferedRequest=t.lastBufferedRequest,t.bufferedRequestCount+=1}else y(e,t,!1,a,r,o,i);return c}(this,i,a,e,t,n)),s},g.prototype.cork=function(){this._writableState.corked++},g.prototype.uncork=function(){var e=this._writableState;e.corked&&(e.corked--,e.writing||e.corked||e.finished||e.bufferProcessing||!e.bufferedRequest||v(this,e))},g.prototype.setDefaultEncoding=function(e){if("string"==typeof e&&(e=e.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((e+"").toLowerCase())>-1))throw new TypeError("Unknown encoding: "+e);return this._writableState.defaultEncoding=e,this},Object.defineProperty(g.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),g.prototype._write=function(e,t,n){n(new Error("_write() is not implemented"))},g.prototype._writev=null,g.prototype.end=function(e,t,n){var o=this._writableState;"function"==typeof e?(n=e,e=null,t=null):"function"==typeof t&&(n=t,t=null),null!=e&&this.write(e,t),o.corked&&(o.corked=1,this.uncork()),o.ending||o.finished||function(e,t,n){t.ending=!0,_(e,t),n&&(t.finished?r.nextTick(n):e.once("finish",n));t.ended=!0,e.writable=!1}(this,o,n)},Object.defineProperty(g.prototype,"destroyed",{get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),g.prototype.destroy=d.destroy,g.prototype._undestroy=d.undestroy,g.prototype._destroy=function(e,t){this.end(),t(e)}},function(e,t,n){"use strict";var r=n(93).Buffer,o=r.isEncoding||function(e){switch((e=""+e)&&e.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 i(e){var t;switch(this.encoding=function(e){var t=function(e){if(!e)return"utf8";for(var t;;)switch(e){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 e;default:if(t)return;e=(""+e).toLowerCase(),t=!0}}(e);if("string"!=typeof t&&(r.isEncoding===o||!o(e)))throw new Error("Unknown encoding: "+e);return t||e}(e),this.encoding){case"utf16le":this.text=c,this.end=u,t=4;break;case"utf8":this.fillLast=a,t=4;break;case"base64":this.text=l,this.end=f,t=3;break;default:return this.write=p,void(this.end=d)}this.lastNeed=0,this.lastTotal=0,this.lastChar=r.allocUnsafe(t)}function s(e){return e<=127?0:e>>5==6?2:e>>4==14?3:e>>3==30?4:e>>6==2?-1:-2}function a(e){var t=this.lastTotal-this.lastNeed,n=function(e,t,n){if(128!=(192&t[0]))return e.lastNeed=0,"�";if(e.lastNeed>1&&t.length>1){if(128!=(192&t[1]))return e.lastNeed=1,"�";if(e.lastNeed>2&&t.length>2&&128!=(192&t[2]))return e.lastNeed=2,"�"}}(this,e);return void 0!==n?n:this.lastNeed<=e.length?(e.copy(this.lastChar,t,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(e.copy(this.lastChar,t,0,e.length),void(this.lastNeed-=e.length))}function c(e,t){if((e.length-t)%2==0){var n=e.toString("utf16le",t);if(n){var r=n.charCodeAt(n.length-1);if(r>=55296&&r<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1],n.slice(0,-1)}return n}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=e[e.length-1],e.toString("utf16le",t,e.length-1)}function u(e){var t=e&&e.length?this.write(e):"";if(this.lastNeed){var n=this.lastTotal-this.lastNeed;return t+this.lastChar.toString("utf16le",0,n)}return t}function l(e,t){var n=(e.length-t)%3;return 0===n?e.toString("base64",t):(this.lastNeed=3-n,this.lastTotal=3,1===n?this.lastChar[0]=e[e.length-1]:(this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1]),e.toString("base64",t,e.length-n))}function f(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+this.lastChar.toString("base64",0,3-this.lastNeed):t}function p(e){return e.toString(this.encoding)}function d(e){return e&&e.length?this.write(e):""}t.StringDecoder=i,i.prototype.write=function(e){if(0===e.length)return"";var t,n;if(this.lastNeed){if(void 0===(t=this.fillLast(e)))return"";n=this.lastNeed,this.lastNeed=0}else n=0;return n<e.length?t?t+this.text(e,n):this.text(e,n):t||""},i.prototype.end=function(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+"�":t},i.prototype.text=function(e,t){var n=function(e,t,n){var r=t.length-1;if(r<n)return 0;var o=s(t[r]);if(o>=0)return o>0&&(e.lastNeed=o-1),o;if(--r<n||-2===o)return 0;if((o=s(t[r]))>=0)return o>0&&(e.lastNeed=o-2),o;if(--r<n||-2===o)return 0;if((o=s(t[r]))>=0)return o>0&&(2===o?o=0:e.lastNeed=o-3),o;return 0}(this,e,t);if(!this.lastNeed)return e.toString("utf8",t);this.lastTotal=n;var r=e.length-(n-this.lastNeed);return e.copy(this.lastChar,0,r),e.toString("utf8",t,r)},i.prototype.fillLast=function(e){if(this.lastNeed<=e.length)return e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,e.length),this.lastNeed-=e.length}},function(e,t,n){"use strict";e.exports=s;var r=n(47),o=Object.create(n(57));function i(e,t){var n=this._transformState;n.transforming=!1;var r=n.writecb;if(!r)return this.emit("error",new Error("write callback called multiple times"));n.writechunk=null,n.writecb=null,null!=t&&this.push(t),r(e);var o=this._readableState;o.reading=!1,(o.needReadable||o.length<o.highWaterMark)&&this._read(o.highWaterMark)}function s(e){if(!(this instanceof s))return new s(e);r.call(this,e),this._transformState={afterTransform:i.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,e&&("function"==typeof e.transform&&(this._transform=e.transform),"function"==typeof e.flush&&(this._flush=e.flush)),this.on("prefinish",a)}function a(){var e=this;"function"==typeof this._flush?this._flush((function(t,n){c(e,t,n)})):c(this,null,null)}function c(e,t,n){if(t)return e.emit("error",t);if(null!=n&&e.push(n),e._writableState.length)throw new Error("Calling transform done when ws.length != 0");if(e._transformState.transforming)throw new Error("Calling transform done when still transforming");return e.push(null)}o.inherits=n(58),o.inherits(s,r),s.prototype.push=function(e,t){return this._transformState.needTransform=!1,r.prototype.push.call(this,e,t)},s.prototype._transform=function(e,t,n){throw new Error("_transform() is not implemented")},s.prototype._write=function(e,t,n){var r=this._transformState;if(r.writecb=n,r.writechunk=e,r.writeencoding=t,!r.transforming){var o=this._readableState;(r.needTransform||o.needReadable||o.length<o.highWaterMark)&&this._read(o.highWaterMark)}},s.prototype._read=function(e){var t=this._transformState;null!==t.writechunk&&t.writecb&&!t.transforming?(t.transforming=!0,this._transform(t.writechunk,t.writeencoding,t.afterTransform)):t.needTransform=!0},s.prototype._destroy=function(e,t){var n=this;r.prototype._destroy.call(this,e,(function(e){t(e),n.emit("close")}))}},function(e,t,n){"use strict";const r=n(0).applyRetryableWrites,o=n(0).applyWriteConcern,i=n(2).MongoError,s=n(1).OperationBase;e.exports=class extends s{constructor(e,t,n){super(n),this.collection=e,this.operations=t}execute(e){const t=this.collection,n=this.operations;let s=this.options;t.s.options.ignoreUndefined&&(s=Object.assign({},s),s.ignoreUndefined=t.s.options.ignoreUndefined);const a=!0===s.ordered||null==s.ordered?t.initializeOrderedBulkOp(s):t.initializeUnorderedBulkOp(s);let c=!1;try{for(let e=0;e<n.length;e++){const t=Object.keys(n[e])[0];n[e][t].collation&&(c=!0),a.raw(n[e])}}catch(t){return e(t,null)}let u=Object.assign({},s);u=r(u,t.s.db),u=o(u,{db:t.s.db,collection:t},s);const l=u.writeConcern?u.writeConcern:{},f=t.s.topology.capabilities();if(c&&f&&!f.commandsTakeCollation)return e(new i("server/primary/mongos does not support collation"));a.execute(l,u,(t,n)=>{if(!n&&t)return e(t,null);n.insertedCount=n.nInserted,n.matchedCount=n.nMatched,n.modifiedCount=n.nModified||0,n.deletedCount=n.nRemoved,n.upsertedCount=n.getUpsertedIds().length,n.upsertedIds={},n.insertedIds={},n.n=n.insertedCount;const r=n.getInsertedIds();for(let e=0;e<r.length;e++)n.insertedIds[r[e].index]=r[e]._id;const o=n.getUpsertedIds();for(let e=0;e<o.length;e++)n.upsertedIds[o[e].index]=o[e]._id;e(null,n)})}}},function(e,t,n){"use strict";const r=n(1).Aspect,o=n(1).defineAspects,i=n(27),s=n(2).MongoError,a=n(0).parseIndexOptions,c=n(4).maxWireVersion,u=new Set(["background","unique","name","partialFilterExpression","sparse","expireAfterSeconds","storageEngine","collation","weights","default_language","language_override","textIndexVersion","2dsphereIndexVersion","bits","min","max","bucketSize","wildcardProjection"]);class l extends i{constructor(e,t,n,r){if(super(e,r),this.collection=t,Array.isArray(n)&&!Array.isArray(n[0]))this.indexes=n;else{this.onlyReturnNameOfCreatedIndex=!0;const e=a(n),t={name:"string"==typeof r.name?r.name:e.name,key:e.fieldHash};for(let e in r)u.has(e)&&(t[e]=r[e]);this.indexes=[t]}}execute(e,t){const n=this.options,r=this.indexes,o=c(e);for(let n=0;n<r.length;n++){if(r[n].collation&&o<5)return void t(new s(`Server ${e.name}, which reports wire version ${o}, does not support collation`));if(null==r[n].name){const e=[];for(let t in r[n].key)e.push(`${t}_${r[n].key[t]}`);r[n].name=e.join("_")}}const i={createIndexes:this.collection,indexes:r};if(null!=n.commitQuorum){if(o<9)return void t(new s("`commitQuorum` option for `createIndexes` not supported on servers < 4.4"));i.commitQuorum=n.commitQuorum}this.options.collation=void 0,super.executeCommand(e,i,(e,n)=>{e?t(e):t(null,this.onlyReturnNameOfCreatedIndex?r[0].name:n)})}}o(l,[r.WRITE_OPERATION,r.EXECUTE_WITH_SELECTION]),e.exports=l},function(e,t,n){"use strict";const r=n(1).Aspect,o=n(1).defineAspects,i=n(23),s=n(0).applyWriteConcern,a=n(0).handleCallback;class c extends i{constructor(e,t,n){super(e.s.db,n,e),this.collection=e,this.indexName=t}_buildCommand(){const e=this.collection,t=this.indexName,n=this.options;let r={dropIndexes:e.collectionName,index:t};return r=s(r,{db:e.s.db,collection:e},n),r}execute(e){super.execute((t,n)=>{if("function"==typeof e)return t?a(e,t,null):void a(e,null,n)})}}o(c,r.WRITE_OPERATION),e.exports=c},function(e,t,n){"use strict";const r=n(1).OperationBase,o=n(14).indexInformation;e.exports=class extends r{constructor(e,t,n){super(n),this.db=e,this.name=t}execute(e){const t=this.db,n=this.name,r=this.options;o(t,n,r,e)}}},function(e,t,n){"use strict";const r=n(1).OperationBase,o=n(0).handleCallback,i=n(2).MongoError;e.exports=class extends r{constructor(e,t){super(t),this.collection=e}execute(e){const t=this.collection,n=this.options;t.s.db.listCollections({name:t.collectionName},n).toArray((n,r)=>n?o(e,n):0===r.length?o(e,i.create({message:`collection ${t.namespace} not found`,driver:!0})):void o(e,n,r[0].options||null))}}},function(e,t,n){"use strict";const r=n(1).Aspect,o=n(23),i=n(1).defineAspects,s=n(20),a=n(0).handleCallback,c=n(0).toError,u=n(0).emitWarning;class l extends o{constructor(e,t,n,r){super(e,r),this.username=t,this.password=n}_buildCommand(){const e=this.db,t=this.username,n=this.password,r=this.options;let o=[];Array.isArray(r.roles)&&(o=r.roles),"string"==typeof r.roles&&(o=[r.roles]),0===o.length&&u("Creating a user without roles is deprecated in MongoDB >= 2.6"),"admin"!==e.databaseName.toLowerCase()&&"admin"!==r.dbName||Array.isArray(r.roles)?Array.isArray(r.roles)||(o=["dbOwner"]):o=["root"];const i=e.s.topology.lastIsMaster().maxWireVersion>=7;let a=n;if(!i){const e=s.createHash("md5");e.update(t+":mongo:"+n),a=e.digest("hex")}const c={createUser:t,customData:r.customData||{},roles:o,digestPassword:i};return"string"==typeof n&&(c.pwd=a),c}execute(e){if(null!=this.options.digestPassword)return e(c("The digestPassword option is not supported via add_user. Please use db.command('createUser', ...) instead for this option."));super.execute((t,n)=>a(e,t,t?null:n))}}i(l,r.WRITE_OPERATION),e.exports=l},function(e,t,n){"use strict";const r=n(1).OperationBase,o=n(0).handleCallback,i=n(2).MongoError,s=n(0).MongoDBNamespace;e.exports=class extends r{constructor(e,t,n){super(n),this.db=e,this.selector=t}execute(e){const t=this.db,n=this.selector,r=this.options,a=new s("admin","$cmd");t.s.topology.command(a,n,r,(n,r)=>t.serverConfig&&t.serverConfig.isDestroyed()?e(new i("topology was destroyed")):n?o(e,n):void o(e,null,r.result))}}},function(e,t,n){"use strict";const r=n(1).Aspect,o=n(23),i=n(1).defineAspects,s=n(0).handleCallback,a=n(29);class c extends o{constructor(e,t,n){const r={},o=a.fromOptions(n);null!=o&&(r.writeConcern=o),n.dbName&&(r.dbName=n.dbName),"number"==typeof n.maxTimeMS&&(r.maxTimeMS=n.maxTimeMS),super(e,r),this.username=t}_buildCommand(){return{dropUser:this.username}}execute(e){super.execute((t,n)=>{if(t)return s(e,t,null);s(e,t,!!n.ok)})}}i(c,r.WRITE_OPERATION),e.exports=c},function(e,t,n){"use strict";const r=n(1).OperationBase,o=n(0).applyWriteConcern,i=n(0).checkCollectionName,s=n(11).executeDbAdminCommand,a=n(0).handleCallback,c=n(145).loadCollection,u=n(0).toError;e.exports=class extends r{constructor(e,t,n){super(n),this.collection=e,this.newName=t}execute(e){const t=this.collection,n=this.newName,r=this.options;let l=c();i(n);const f={renameCollection:t.namespace,to:t.s.namespace.withCollection(n).toString(),dropTarget:"boolean"==typeof r.dropTarget&&r.dropTarget};o(f,{db:t.s.db,collection:t},r),s(t.s.db.admin().s.db,f,r,(r,o)=>{if(r)return a(e,r,null);if(o.errmsg)return a(e,u(o),null);try{return a(e,null,new l(t.s.db,t.s.topology,t.s.namespace.db,n,t.s.pkFactory,t.s.options))}catch(r){return a(e,u(r),null)}})}}},function(e,t,n){"use strict";const r=n(0).applyWriteConcern,o=n(214),i=n(215),s=n(216),a=n(477),c=n(478),u=n(56);function l(e,t,n){if(!(this instanceof l))return new l(e,t);this.s={db:e,topology:t,promiseLibrary:n}}l.prototype.command=function(e,t,n){const r=Array.prototype.slice.call(arguments,1);n="function"==typeof r[r.length-1]?r.pop():void 0,t=r.length?r.shift():{};const o=new i(this.s.db,e,t);return u(this.s.db.s.topology,o,n)},l.prototype.buildInfo=function(e,t){"function"==typeof e&&(t=e,e={}),e=e||{};const n=new i(this.s.db,{buildinfo:1},e);return u(this.s.db.s.topology,n,t)},l.prototype.serverInfo=function(e,t){"function"==typeof e&&(t=e,e={}),e=e||{};const n=new i(this.s.db,{buildinfo:1},e);return u(this.s.db.s.topology,n,t)},l.prototype.serverStatus=function(e,t){"function"==typeof e&&(t=e,e={}),e=e||{};const n=new i(this.s.db,{serverStatus:1},e);return u(this.s.db.s.topology,n,t)},l.prototype.ping=function(e,t){"function"==typeof e&&(t=e,e={}),e=e||{};const n=new i(this.s.db,{ping:1},e);return u(this.s.db.s.topology,n,t)},l.prototype.addUser=function(e,t,n,i){const s=Array.prototype.slice.call(arguments,2);i="function"==typeof s[s.length-1]?s.pop():void 0,"string"==typeof e&&null!=t&&"object"==typeof t&&(n=t,t=null),n=s.length?s.shift():{},n=Object.assign({},n),(n=r(n,{db:this.s.db})).dbName="admin";const a=new o(this.s.db,e,t,n);return u(this.s.db.s.topology,a,i)},l.prototype.removeUser=function(e,t,n){const o=Array.prototype.slice.call(arguments,1);n="function"==typeof o[o.length-1]?o.pop():void 0,t=o.length?o.shift():{},t=Object.assign({},t),(t=r(t,{db:this.s.db})).dbName="admin";const i=new s(this.s.db,e,t);return u(this.s.db.s.topology,i,n)},l.prototype.validateCollection=function(e,t,n){"function"==typeof t&&(n=t,t={});const r=new a(this,e,t=t||{});return u(this.s.db.s.topology,r,n)},l.prototype.listDatabases=function(e,t){return"function"==typeof e&&(t=e,e={}),e=e||{},u(this.s.db.s.topology,new c(this.s.db,e),t)},l.prototype.replSetGetStatus=function(e,t){"function"==typeof e&&(t=e,e={}),e=e||{};const n=new i(this.s.db,{replSetGetStatus:1},e);return u(this.s.db.s.topology,n,t)},e.exports=l},function(e,t,n){"use strict";const r=n(2).Topology,o=n(35).ServerCapabilities,i=n(26),s=n(0).translateOptions;e.exports=class extends r{constructor(e,t){t=t||{};let n=Object.assign({},{cursorFactory:i,reconnect:!1,emitError:"boolean"!=typeof t.emitError||t.emitError,maxPoolSize:"number"==typeof t.maxPoolSize?t.maxPoolSize:"number"==typeof t.poolSize?t.poolSize:10,minPoolSize:"number"==typeof t.minPoolSize?t.minPoolSize:"number"==typeof t.minSize?t.minSize:0,monitorCommands:"boolean"==typeof t.monitorCommands&&t.monitorCommands});n=s(n,t);var r=t.socketOptions&&Object.keys(t.socketOptions).length>0?t.socketOptions:t;n=s(n,r),super(e,n)}capabilities(){return this.s.sCapabilities?this.s.sCapabilities:null==this.lastIsMaster()?null:(this.s.sCapabilities=new o(this.lastIsMaster()),this.s.sCapabilities)}command(e,t,n,r){super.command(e.toString(),t,n,r)}insert(e,t,n,r){super.insert(e.toString(),t,n,r)}update(e,t,n,r){super.update(e.toString(),t,n,r)}remove(e,t,n,r){super.remove(e.toString(),t,n,r)}}},function(e,t,n){"use strict";const r=n(5).deprecate,o=n(2).Logger,i=n(2).MongoCredentials,s=n(2).MongoError,a=n(221),c=n(219),u=n(2).parseConnectionString,l=n(46),f=n(2).ReadPreference,p=n(222),d=n(99),h=n(2).Sessions.ServerSessionPool,m=n(0).emitDeprecationWarning,g=n(0).emitWarningOnce,y=n(89),b=n(29),v=n(94).CMAP_EVENT_NAMES;let S;const w=r(n(484),"current URL string parser is deprecated, and will be removed in a future version. To use the new parser, pass option { useNewUrlParser: true } to MongoClient.connect."),_={DEFAULT:"default",PLAIN:"plain",GSSAPI:"gssapi","MONGODB-CR":"mongocr","MONGODB-X509":"x509","MONGODB-AWS":"mongodb-aws","SCRAM-SHA-1":"scram-sha-1","SCRAM-SHA-256":"scram-sha-256"},O=["timeout","close","serverOpening","serverDescriptionChanged","serverHeartbeatStarted","serverHeartbeatSucceeded","serverHeartbeatFailed","serverClosed","topologyOpening","topologyClosed","topologyDescriptionChanged","commandStarted","commandSucceeded","commandFailed","joined","left","ping","ha","all","fullsetup","open"],T=new Set(["DEFAULT","PLAIN","GSSAPI","MONGODB-CR","MONGODB-X509","MONGODB-AWS","SCRAM-SHA-1","SCRAM-SHA-256"]),C=["poolSize","ssl","sslValidate","sslCA","sslCert","sslKey","sslPass","sslCRL","autoReconnect","noDelay","keepAlive","keepAliveInitialDelay","connectTimeoutMS","family","socketTimeoutMS","reconnectTries","reconnectInterval","ha","haInterval","replicaSet","secondaryAcceptableLatencyMS","acceptableLatencyMS","connectWithNoPrimary","authSource","w","wtimeout","j","writeConcern","forceServerObjectId","serializeFunctions","ignoreUndefined","raw","bufferMaxEntries","readPreference","pkFactory","promiseLibrary","readConcern","maxStalenessSeconds","loggerLevel","logger","promoteValues","promoteBuffers","promoteLongs","domainsEnabled","checkServerIdentity","validateOptions","appname","auth","user","password","authMechanism","compression","fsync","readPreferenceTags","numberOfRetries","auto_reconnect","minSize","monitorCommands","retryWrites","retryReads","useNewUrlParser","useUnifiedTopology","serverSelectionTimeoutMS","useRecoveryToken","autoEncryption","driverInfo","tls","tlsInsecure","tlsinsecure","tlsAllowInvalidCertificates","tlsAllowInvalidHostnames","tlsCAFile","tlsCertificateFile","tlsCertificateKeyFile","tlsCertificateKeyFilePassword","minHeartbeatFrequencyMS","heartbeatFrequencyMS","directConnection","appName","maxPoolSize","minPoolSize","maxIdleTimeMS","waitQueueTimeoutMS"],x=["native_parser"],E=["server","replset","replSet","mongos","db"];const N=C.reduce((e,t)=>(e[t.toLowerCase()]=t,e),{});function I(e,t){t.on("authenticated",M(e,"authenticated")),t.on("error",M(e,"error")),t.on("timeout",M(e,"timeout")),t.on("close",M(e,"close")),t.on("parseError",M(e,"parseError")),t.once("open",M(e,"open")),t.once("fullsetup",M(e,"fullsetup")),t.once("all",M(e,"all")),t.on("reconnect",M(e,"reconnect"))}function A(e,t){e.topology=t,t instanceof c||(t.s.sessionPool=new h(t.s.coreTopology))}function k(e,t){let r=(S||(S=n(59)),S);const o=[];return e instanceof r&&O.forEach(n=>{t.on(n,(t,r)=>{"open"===n?o.push({event:n,object1:e}):o.push({event:n,object1:t,object2:r})})}),o}function M(e,t){const n=new Set(["all","fullsetup","open","reconnect"]);return(r,o)=>{if(n.has(t))return e.emit(t,e);e.emit(t,r,o)}}const R=new Set(["reconnect","reconnectFailed","attemptReconnect","joined","left","ping","ha","all","fullsetup","open"]);function j(e,t,r,o){r.promiseLibrary=e.s.promiseLibrary;const i={};"unified"===t&&(i.createServers=!1);const s=z(r,i);if(null!=r.autoEncryption){const t=n(223).Encrypter;r.encrypter=new t(e,r),r.autoEncrypter=r.encrypter.autoEncrypter}let u;"mongos"===t?u=new a(s,r):"replicaset"===t?u=new p(s,r):"unified"===t&&(u=new c(r.servers,r),function(e){e.on("newListener",e=>{R.has(e)&&m(`The \`${e}\` event is no longer supported by the unified topology, please read more by visiting http://bit.ly/2D8WfT6`,"DeprecationWarning")})}(e)),I(e,u),q(e,u),A(e,u),r.autoEncrypter?r.autoEncrypter.init(e=>{e?o(e):u.connect(r,e=>{if(e)return u.close(!0),void o(e);r.encrypter.connectInternalClient(e=>{if(e)return o(e);o(void 0,u)})})}):u.connect(r,e=>{if(e)return u.close(!0),o(e);o(void 0,u)})}function D(e,t){const n=["mongos","server","db","replset","db_options","server_options","rs_options","mongos_options"],r=["readconcern","compression","autoencryption"],o=["w","wtimeout","j","journal","fsync","writeConcern"];for(const i in t)-1===o.indexOf(i.toLowerCase())&&(-1!==r.indexOf(i.toLowerCase())?e[i]=t[i]:-1!==n.indexOf(i.toLowerCase())?e=L(e,t[i],!1):!t[i]||"object"!=typeof t[i]||Buffer.isBuffer(t[i])||Array.isArray(t[i])?e[i]=t[i]:e=L(e,t[i],!0));const i=b.fromOptions(t);return i&&(e.writeConcern=Object.assign({},e.writeConcern,i)),e}function P(e,t,n,r){const o=(r=Object.assign({},r)).authSource||r.authdb||r.dbName,a=r.authMechanism||"DEFAULT",c=a.toUpperCase(),u=r.authMechanismProperties;if(!T.has(c))throw s.create({message:`authentication mechanism ${a} not supported', options.authMechanism`,driver:!0});return new i({mechanism:_[c],mechanismProperties:u,source:o,username:t,password:n})}function B(e){return L(D({},e),e,!1)}function L(e,t,n){for(const r in t)t[r]&&"object"==typeof t[r]&&n?e=L(e,t[r],n):e[r]=t[r];return e}function q(e,t){["commandStarted","commandSucceeded","commandFailed","serverOpening","serverClosed","serverDescriptionChanged","serverHeartbeatStarted","serverHeartbeatSucceeded","serverHeartbeatFailed","topologyOpening","topologyClosed","topologyDescriptionChanged","joined","left","ping","ha"].concat(v).forEach(n=>{t.on(n,(t,r)=>{e.emit(n,t,r)})})}function U(e){let t=Object.assign({servers:e.hosts},e.options);for(let e in t){const n=N[e];n&&(t[n]=t[e])}const n=e.auth&&e.auth.username,r=e.options&&e.options.authMechanism;(n||r)&&(t.auth=Object.assign({},e.auth),t.auth.db&&(t.authSource=t.authSource||t.auth.db),t.auth.username&&(t.auth.user=t.auth.username)),e.defaultDatabase&&(t.dbName=e.defaultDatabase),t.maxPoolSize&&(t.poolSize=t.maxPoolSize),t.readConcernLevel&&(t.readConcern=new l(t.readConcernLevel)),t.wTimeoutMS&&(t.wtimeout=t.wTimeoutMS,t.wTimeoutMS=void 0),e.srvHost&&(t.srvHost=e.srvHost);const o=["w","wtimeout","j","journal","fsync"];for(const e of o)void 0!==t[e]&&(void 0===t.writeConcern&&(t.writeConcern={}),t.writeConcern[e]=t[e],t[e]=void 0);return t}function z(e,t){if(t=Object.assign({},{createServers:!0},t),"string"!=typeof e.readPreference&&"string"!=typeof e.read_preference||(e.readPreference=new f(e.readPreference||e.read_preference)),e.readPreference&&(e.readPreferenceTags||e.read_preference_tags)&&(e.readPreference.tags=e.readPreferenceTags||e.read_preference_tags),e.maxStalenessSeconds&&(e.readPreference.maxStalenessSeconds=e.maxStalenessSeconds),null==e.socketTimeoutMS&&(e.socketTimeoutMS=0),null==e.connectTimeoutMS&&(e.connectTimeoutMS=1e4),t.createServers)return e.servers.map(t=>t.domain_socket?new d(t.domain_socket,27017,e):new d(t.host,t.port,e))}e.exports={validOptions:function(e){const t=C.concat(E);for(const n in e)if(-1===x.indexOf(n)){if(-1===t.indexOf(n)){if(e.validateOptions)return new s(`option ${n} is not supported`);g(`the options [${n}] is not supported`)}-1!==E.indexOf(n)&&g("the server/replset/mongos/db options are deprecated, "+`all their options are supported at the top level of the options object [${C}]`)}},connect:function(e,t,n,r){if(n=Object.assign({},n),null==r)throw new Error("no callback function provided");let i=!1;const c=o("MongoClient",n);if(t instanceof d||t instanceof p||t instanceof a)return function(e,t,n,r){A(e,t),I(e,t),q(e,t);let o=Object.assign({},n);"string"!=typeof n.readPreference&&"string"!=typeof n.read_preference||(o.readPreference=new f(n.readPreference||n.read_preference));if((o.user||o.password||o.authMechanism)&&!o.credentials)try{o.credentials=P(e,o.user,o.password,o)}catch(e){return r(e,t)}return t.connect(o,r)}(e,t,n,m);const l=!1!==n.useNewUrlParser,h=l?U:B;function m(t,n){const o="seed list contains no mongos proxies, replicaset connections requires the parameter replicaSet to be supplied in the URI or options object, mongodb://server:port/db?replicaSet=name";if(t&&"no mongos proxies found in seed list"===t.message)return c.isWarn()&&c.warn(o),r(new s(o));i&&e.emit("authenticated",null,!0),r(t,n)}(l?u:w)(t,n,(t,o)=>{if(t)return r(t);const s=h(o),a=D(s,n);if(null==a.socketTimeoutMS&&(a.socketTimeoutMS=0),null==a.connectTimeoutMS&&(a.connectTimeoutMS=1e4),null==a.retryWrites&&(a.retryWrites=!0),null==a.useRecoveryToken&&(a.useRecoveryToken=!0),null==a.readPreference&&(a.readPreference="primary"),a.db_options&&a.db_options.auth&&delete a.db_options.auth,function(e){null!=e.tls&&["sslCA","sslKey","sslCert"].forEach(t=>{e[t]&&(e[t]=y.readFileSync(e[t]))})}(a),e.s.options=a,e.s.readPreference=f.fromOptions(a),e.s.writeConcern=b.fromOptions(a),0===s.servers.length)return r(new Error("connection string must contain at least one seed host"));if(a.auth&&!a.credentials)try{i=!0,a.credentials=P(e,a.auth.user,a.auth.password,a)}catch(t){return r(t)}return a.useUnifiedTopology?j(e,"unified",a,m):(g("Current Server Discovery and Monitoring engine is deprecated, and will be removed in a future version. To use the new Server Discover and Monitoring engine, pass option { useUnifiedTopology: true } to the MongoClient constructor."),a.replicaSet||a.rs_name?j(e,"replicaset",a,m):s.servers.length>1?j(e,"mongos",a,m):function(e,t,n){t.promiseLibrary=e.s.promiseLibrary;const r=z(t)[0],o=k(e,r);r.connect(t,(i,s)=>{if(i)return r.close(!0),n(i);!function(e){O.forEach(t=>e.removeAllListeners(t))}(r),q(e,r),I(e,r);const a=s.lastIsMaster();if(A(e,s),a&&"isdbgrid"===a.msg)return s.close(),j(e,"mongos",t,n);!function(e,t){for(let n=0;n<t.length;n++)e.emit(t[n].event,t[n].object1,t[n].object2)}(e,o),n(i,s)})}(e,a,m))})}}},function(e,t,n){"use strict";const r=n(35).TopologyBase,o=n(2).MongoError,i=n(2).Mongos,s=n(26),a=n(99),c=n(35).Store,u=n(0).MAX_JS_INT,l=n(0).translateOptions,f=n(0).filterOptions,p=n(0).mergeOptions;var d=["ha","haInterval","acceptableLatencyMS","poolSize","ssl","checkServerIdentity","sslValidate","sslCA","sslCRL","sslCert","ciphers","ecdhCurve","sslKey","sslPass","socketOptions","bufferMaxEntries","store","auto_reconnect","autoReconnect","emitError","keepAlive","keepAliveInitialDelay","noDelay","connectTimeoutMS","socketTimeoutMS","loggerLevel","logger","reconnectTries","appname","domainsEnabled","servername","promoteLongs","promoteValues","promoteBuffers","promiseLibrary","monitorCommands"];class h extends r{constructor(e,t){super();t=f(t=t||{},d);for(var n=0;n<e.length;n++)if(!(e[n]instanceof a))throw o.create({message:"all seed list instances must be of the Server type",driver:!0});var r={force:!1,bufferMaxEntries:"number"==typeof t.bufferMaxEntries?t.bufferMaxEntries:u},h=t.store||new c(this,r),m=e.map((function(e){return{host:e.host,port:e.port}})),g="boolean"!=typeof t.auto_reconnect||t.auto_reconnect;g="boolean"==typeof t.autoReconnect?t.autoReconnect:g;var y=p({},{disconnectHandler:h,cursorFactory:s,reconnect:g,emitError:"boolean"!=typeof t.emitError||t.emitError,size:"number"==typeof t.poolSize?t.poolSize:5,monitorCommands:"boolean"==typeof t.monitorCommands&&t.monitorCommands});y=l(y,t);var b=t.socketOptions&&Object.keys(t.socketOptions).length>0?t.socketOptions:t;y=l(y,b),this.s={coreTopology:new i(m,y),sCapabilities:null,debug:y.debug,storeOptions:r,clonedOptions:y,store:h,options:t,sessionPool:null,sessions:new Set,promiseLibrary:t.promiseLibrary||Promise}}connect(e,t){var n=this;"function"==typeof e&&(t=e,e={}),null==e&&(e={}),"function"!=typeof t&&(t=null),e=Object.assign({},this.s.clonedOptions,e),n.s.options=e,n.s.storeOptions.bufferMaxEntries="number"==typeof e.bufferMaxEntries?e.bufferMaxEntries:-1;var r=function(){return function(e){["timeout","error","close"].forEach((function(e){n.removeListener(e,r)})),n.s.coreTopology.removeListener("connect",r),n.close(!0);try{t(e)}catch(e){process.nextTick((function(){throw e}))}}},o=function(e){return function(t){"error"!==e&&n.emit(e,t)}},i=function(e){return function(t,r){n.emit(e,t,r)}};["timeout","error","close","serverOpening","serverDescriptionChanged","serverHeartbeatStarted","serverHeartbeatSucceeded","serverHeartbeatFailed","serverClosed","topologyOpening","topologyClosed","topologyDescriptionChanged","commandStarted","commandSucceeded","commandFailed"].forEach((function(e){n.s.coreTopology.removeAllListeners(e)})),n.s.coreTopology.on("serverDescriptionChanged",i("serverDescriptionChanged")),n.s.coreTopology.on("serverHeartbeatStarted",i("serverHeartbeatStarted")),n.s.coreTopology.on("serverHeartbeatSucceeded",i("serverHeartbeatSucceeded")),n.s.coreTopology.on("serverHeartbeatFailed",i("serverHeartbeatFailed")),n.s.coreTopology.on("serverOpening",i("serverOpening")),n.s.coreTopology.on("serverClosed",i("serverClosed")),n.s.coreTopology.on("topologyOpening",i("topologyOpening")),n.s.coreTopology.on("topologyClosed",i("topologyClosed")),n.s.coreTopology.on("topologyDescriptionChanged",i("topologyDescriptionChanged")),n.s.coreTopology.on("commandStarted",i("commandStarted")),n.s.coreTopology.on("commandSucceeded",i("commandSucceeded")),n.s.coreTopology.on("commandFailed",i("commandFailed")),n.s.coreTopology.once("timeout",r("timeout")),n.s.coreTopology.once("error",r("error")),n.s.coreTopology.once("close",r("close")),n.s.coreTopology.once("connect",(function(){["timeout","error","close","fullsetup"].forEach((function(e){n.s.coreTopology.removeAllListeners(e)})),n.s.coreTopology.on("timeout",o("timeout")),n.s.coreTopology.on("error",o("error")),n.s.coreTopology.on("close",o("close")),n.s.coreTopology.on("fullsetup",(function(){n.emit("fullsetup",n)})),n.emit("open",null,n);try{t(null,n)}catch(e){process.nextTick((function(){throw e}))}})),n.s.coreTopology.on("joined",i("joined")),n.s.coreTopology.on("left",i("left")),n.s.coreTopology.on("reconnect",(function(){n.emit("reconnect"),n.s.store.execute()})),n.s.coreTopology.connect(e)}}Object.defineProperty(h.prototype,"haInterval",{enumerable:!0,get:function(){return this.s.coreTopology.s.haInterval}}),e.exports=h},function(e,t,n){"use strict";const r=n(99),o=n(26),i=n(2).MongoError,s=n(35).TopologyBase,a=n(35).Store,c=n(2).ReplSet,u=n(0).MAX_JS_INT,l=n(0).translateOptions,f=n(0).filterOptions,p=n(0).mergeOptions;var d=["ha","haInterval","replicaSet","rs_name","secondaryAcceptableLatencyMS","connectWithNoPrimary","poolSize","ssl","checkServerIdentity","sslValidate","sslCA","sslCert","ciphers","ecdhCurve","sslCRL","sslKey","sslPass","socketOptions","bufferMaxEntries","store","auto_reconnect","autoReconnect","emitError","keepAlive","keepAliveInitialDelay","noDelay","connectTimeoutMS","socketTimeoutMS","strategy","debug","family","loggerLevel","logger","reconnectTries","appname","domainsEnabled","servername","promoteLongs","promoteValues","promoteBuffers","maxStalenessSeconds","promiseLibrary","minSize","monitorCommands"];class h extends s{constructor(e,t){super();var n=this;t=f(t=t||{},d);for(var s=0;s<e.length;s++)if(!(e[s]instanceof r))throw i.create({message:"all seed list instances must be of the Server type",driver:!0});var h={force:!1,bufferMaxEntries:"number"==typeof t.bufferMaxEntries?t.bufferMaxEntries:u},m=t.store||new a(n,h),g=e.map((function(e){return{host:e.host,port:e.port}})),y=p({},{disconnectHandler:m,cursorFactory:o,reconnect:!1,emitError:"boolean"!=typeof t.emitError||t.emitError,size:"number"==typeof t.poolSize?t.poolSize:5,monitorCommands:"boolean"==typeof t.monitorCommands&&t.monitorCommands});y=l(y,t);var b=t.socketOptions&&Object.keys(t.socketOptions).length>0?t.socketOptions:t;y=l(y,b);var v=new c(g,y);v.on("reconnect",(function(){n.emit("reconnect"),m.execute()})),this.s={coreTopology:v,sCapabilities:null,tag:t.tag,storeOptions:h,clonedOptions:y,store:m,options:t,sessionPool:null,sessions:new Set,promiseLibrary:t.promiseLibrary||Promise},y.debug&&Object.defineProperty(this,"replset",{enumerable:!0,get:function(){return v}})}connect(e,t){var n=this;"function"==typeof e&&(t=e,e={}),null==e&&(e={}),"function"!=typeof t&&(t=null),e=Object.assign({},this.s.clonedOptions,e),n.s.options=e,n.s.storeOptions.bufferMaxEntries="number"==typeof e.bufferMaxEntries?e.bufferMaxEntries:-1;var r=function(e){return function(t){"error"!==e&&n.emit(e,t)}};["timeout","error","close","serverOpening","serverDescriptionChanged","serverHeartbeatStarted","serverHeartbeatSucceeded","serverHeartbeatFailed","serverClosed","topologyOpening","topologyClosed","topologyDescriptionChanged","commandStarted","commandSucceeded","commandFailed","joined","left","ping","ha"].forEach((function(e){n.s.coreTopology.removeAllListeners(e)}));var o,i=function(e){return function(t,r){n.emit(e,t,r)}};n.s.coreTopology.on("joined",(o="joined",function(e,t){n.emit(o,e,t.lastIsMaster(),t)})),n.s.coreTopology.on("left",i("left")),n.s.coreTopology.on("ping",i("ping")),n.s.coreTopology.on("ha",(function(e,t){n.emit("ha",e,t),"start"===e?n.emit("ha_connect",e,t):"end"===e&&n.emit("ha_ismaster",e,t)})),n.s.coreTopology.on("serverDescriptionChanged",i("serverDescriptionChanged")),n.s.coreTopology.on("serverHeartbeatStarted",i("serverHeartbeatStarted")),n.s.coreTopology.on("serverHeartbeatSucceeded",i("serverHeartbeatSucceeded")),n.s.coreTopology.on("serverHeartbeatFailed",i("serverHeartbeatFailed")),n.s.coreTopology.on("serverOpening",i("serverOpening")),n.s.coreTopology.on("serverClosed",i("serverClosed")),n.s.coreTopology.on("topologyOpening",i("topologyOpening")),n.s.coreTopology.on("topologyClosed",i("topologyClosed")),n.s.coreTopology.on("topologyDescriptionChanged",i("topologyDescriptionChanged")),n.s.coreTopology.on("commandStarted",i("commandStarted")),n.s.coreTopology.on("commandSucceeded",i("commandSucceeded")),n.s.coreTopology.on("commandFailed",i("commandFailed")),n.s.coreTopology.on("fullsetup",(function(){n.emit("fullsetup",n,n)})),n.s.coreTopology.on("all",(function(){n.emit("all",null,n)}));var s=function(){return function(e){["timeout","error","close"].forEach((function(e){n.s.coreTopology.removeListener(e,s)})),n.s.coreTopology.removeListener("connect",s),n.s.coreTopology.destroy();try{t(e)}catch(e){n.s.coreTopology.isConnected()||process.nextTick((function(){throw e}))}}};n.s.coreTopology.once("timeout",s("timeout")),n.s.coreTopology.once("error",s("error")),n.s.coreTopology.once("close",s("close")),n.s.coreTopology.once("connect",(function(){n.s.coreTopology.once("timeout",r("timeout")),n.s.coreTopology.once("error",r("error")),n.s.coreTopology.once("close",r("close")),n.emit("open",null,n);try{t(null,n)}catch(e){process.nextTick((function(){throw e}))}})),n.s.coreTopology.connect(e)}close(e,t){["timeout","error","close","joined","left"].forEach(e=>this.removeAllListeners(e)),super.close(e,t)}}Object.defineProperty(h.prototype,"haInterval",{enumerable:!0,get:function(){return this.s.coreTopology.s.haInterval}}),e.exports=h},function(e,t,n){"use strict";const r=n(59),o=n(9).retrieveBSON(),i=n(3).MongoError,s=n(224);if("function"!=typeof s.extension)throw new i("loaded version of `mongodb-client-encryption` does not have property `extension`. Please make sure you are loading the correct version of `mongodb-client-encryption`");const a=s.extension(n(42)).AutoEncrypter,c=Symbol("internalClient");class u{constructor(e,t){this.bypassAutoEncryption=!!t.autoEncryption.bypassAutoEncryption,this.needsConnecting=!1,0===t.maxPoolSize&&null==t.autoEncryption.keyVaultClient?t.autoEncryption.keyVaultClient=e:null==t.autoEncryption.keyVaultClient&&(t.autoEncryption.keyVaultClient=this.getInternalClient(e)),this.bypassAutoEncryption?t.autoEncryption.metadataClient=void 0:0===t.maxPoolSize?t.autoEncryption.metadataClient=e:t.autoEncryption.metadataClient=this.getInternalClient(e),t.autoEncryption.bson=u.makeBSON(t),this.autoEncrypter=new a(e,t.autoEncryption)}getInternalClient(e){if(!this[c]){const t={};for(const n of Object.keys(e.s.options))-1===["autoEncryption","minPoolSize","servers","caseTranslate","dbName"].indexOf(n)&&(t[n]=e.s.options[n]);t.minPoolSize=0;const n=["commandStarted","commandSucceeded","commandFailed","serverOpening","serverClosed","serverDescriptionChanged","serverHeartbeatStarted","serverHeartbeatSucceeded","serverHeartbeatFailed","topologyOpening","topologyClosed","topologyDescriptionChanged","joined","left","ping","ha","connectionPoolCreated","connectionPoolClosed","connectionCreated","connectionReady","connectionClosed","connectionCheckOutStarted","connectionCheckOutFailed","connectionCheckedOut","connectionCheckedIn","connectionPoolCleared"];this[c]=new r(e.s.url,t);for(const t of n)for(const n of e.listeners(t))this[c].on(t,n);e.on("newListener",(e,t)=>{this[c].on(e,t)}),this.needsConnecting=!0}return this[c]}connectInternalClient(e){return this.needsConnecting?(this.needsConnecting=!1,this[c].connect(e)):e()}close(e,t,n){this.autoEncrypter.teardown(r=>{if(this[c]&&e!==this[c])return this[c].close(t,n);n(r)})}static makeBSON(e){return(e||{}).bson||new o([o.Binary,o.Code,o.DBRef,o.Decimal128,o.Double,o.Int32,o.Long,o.Map,o.MaxKey,o.MinKey,o.ObjectId,o.BSONRegExp,o.Symbol,o.Timestamp])}}e.exports={Encrypter:u}},function(e,t,n){"use strict";let r;function o(){return r||(r=s(n(42))),r}const i=n(100).MongoCryptError;function s(e){const t={mongodb:e};return t.stateMachine=n(485)(t),t.autoEncrypter=n(486)(t),t.clientEncryption=n(490)(t),{AutoEncrypter:t.autoEncrypter.AutoEncrypter,ClientEncryption:t.clientEncryption.ClientEncryption,MongoCryptError:i}}e.exports={extension:s,MongoCryptError:i,get AutoEncrypter(){const t=o();return delete e.exports.AutoEncrypter,e.exports.AutoEncrypter=t.AutoEncrypter,t.AutoEncrypter},get ClientEncryption(){const t=o();return delete e.exports.ClientEncryption,e.exports.ClientEncryption=t.ClientEncryption,t.ClientEncryption}}},function(e,t,n){(function(r){var o=n(89),i=n(136),s=n(487),a=i.join,c=i.dirname,u=o.accessSync&&function(e){try{o.accessSync(e)}catch(e){return!1}return!0}||o.existsSync||i.existsSync,l={arrow:process.env.NODE_BINDINGS_ARROW||" → ",compiled:process.env.NODE_BINDINGS_COMPILED_DIR||"compiled",platform:process.platform,arch:process.arch,nodePreGyp:"node-v"+process.versions.modules+"-"+process.platform+"-"+process.arch,version:process.versions.node,bindings:"bindings.node",try:[["module_root","build","bindings"],["module_root","build","Debug","bindings"],["module_root","build","Release","bindings"],["module_root","out","Debug","bindings"],["module_root","Debug","bindings"],["module_root","out","Release","bindings"],["module_root","Release","bindings"],["module_root","build","default","bindings"],["module_root","compiled","version","platform","arch","bindings"],["module_root","addon-build","release","install-root","bindings"],["module_root","addon-build","debug","install-root","bindings"],["module_root","addon-build","default","install-root","bindings"],["module_root","lib","binding","nodePreGyp","bindings"]]};e.exports=t=function(e){"string"==typeof e?e={bindings:e}:e||(e={}),Object.keys(l).map((function(t){t in e||(e[t]=l[t])})),e.module_root||(e.module_root=t.getRoot(t.getFileName())),".node"!=i.extname(e.bindings)&&(e.bindings+=".node");for(var n,r,o,s=require,c=[],u=0,f=e.try.length;u<f;u++){n=a.apply(null,e.try[u].map((function(t){return e[t]||t}))),c.push(n);try{return r=e.path?s.resolve(n):s(n),e.path||(r.path=n),r}catch(e){if("MODULE_NOT_FOUND"!==e.code&&"QUALIFIED_PATH_RESOLUTION_FAILED"!==e.code&&!/not find/i.test(e.message))throw e}}throw(o=new Error("Could not locate the bindings file. Tried:\n"+c.map((function(t){return e.arrow+t})).join("\n"))).tries=c,o},t.getFileName=function(e){var t,n=Error.prepareStackTrace,o=Error.stackTraceLimit,i={};Error.stackTraceLimit=10,Error.prepareStackTrace=function(n,o){for(var i=0,s=o.length;i<s;i++)if((t=o[i].getFileName())!==r){if(!e)return;if(t!==e)return}},Error.captureStackTrace(i),Error.prepareStackTrace=n,Error.stackTraceLimit=o;return 0===t.indexOf("file://")&&(t=s(t)),t},t.getRoot=function(e){for(var t,n=c(e);;){if("."===n&&(n=process.cwd()),u(a(n,"package.json"))||u(a(n,"node_modules")))return n;if(t===n)throw new Error('Could not find module root given file: "'+e+'". Do you have a `package.json` file? ');t=n,n=a(n,"..")}}}).call(this,"/index.js")},function(e,t,n){"use strict";const r=n(20);function o(e){return(t,n,o)=>{let i;try{i=r.createHmac(e,t).update(n).digest()}catch(e){return e}return i.copy(o),i.length}}e.exports={aes256CbcEncryptHook:function(e,t,n,o){let i;try{let o=r.createCipheriv("aes-256-cbc",e,t);o.setAutoPadding(!1),i=o.update(n)}catch(e){return e}return i.copy(o),i.length},aes256CbcDecryptHook:function(e,t,n,o){let i;try{let o=r.createDecipheriv("aes-256-cbc",e,t);o.setAutoPadding(!1),i=o.update(n)}catch(e){return e}return i.copy(o),i.length},randomHook:"function"==typeof r.randomFillSync?function(e,t){try{r.randomFillSync(e,0,t)}catch(e){return e}return t}:function(e,t){let n;try{n=r.randomBytes(t)}catch(e){return e}return n.copy(e),t},hmacSha512Hook:o("sha512"),hmacSha256Hook:o("sha256"),sha256Hook:function(e,t){let n;try{n=r.createHash("sha256").update(e).digest()}catch(e){return e}return n.copy(t),n.length},signRsaSha256Hook:function(e,t,n){let o;try{const n=r.createSign("sha256WithRSAEncryption"),i=Buffer.from(`-----BEGIN PRIVATE KEY-----\n${e.toString("base64")}\n-----END PRIVATE KEY-----\n`);o=n.update(t).end().sign(i)}catch(e){return e}return o.copy(n),o.length}}},function(e,t,n){"use strict";var r=n(2).BSON.Binary,o=n(2).BSON.ObjectID,i=n(22).Buffer,s=function(e,t,n){if(!(this instanceof s))return new s(e,t);this.file=e;var a=null==t?{}:t;if(this.writeConcern=n||{w:1},this.objectId=null==a._id?new o:a._id,this.chunkNumber=null==a.n?0:a.n,this.data=new r,"string"==typeof a.data){var c=i.alloc(a.data.length);c.write(a.data,0,a.data.length,"binary"),this.data=new r(c)}else if(Array.isArray(a.data)){c=i.alloc(a.data.length);var u=a.data.join("");c.write(u,0,u.length,"binary"),this.data=new r(c)}else if(a.data&&"Binary"===a.data._bsontype)this.data=a.data;else if(!i.isBuffer(a.data)&&null!=a.data)throw Error("Illegal chunk format");this.internalPosition=0};s.prototype.write=function(e,t){return this.data.write(e,this.internalPosition,e.length,"binary"),this.internalPosition=this.data.length(),null!=t?t(null,this):this},s.prototype.read=function(e){if(e=null==e||0===e?this.length():e,this.length()-this.internalPosition+1>=e){var t=this.data.read(this.internalPosition,e);return this.internalPosition=this.internalPosition+e,t}return""},s.prototype.readSlice=function(e){if(this.length()-this.internalPosition>=e){var t=null;return null!=this.data.buffer?t=this.data.buffer.slice(this.internalPosition,this.internalPosition+e):(t=i.alloc(e),e=this.data.readInto(t,this.internalPosition)),this.internalPosition=this.internalPosition+e,t}return null},s.prototype.eof=function(){return this.internalPosition===this.length()},s.prototype.getc=function(){return this.read(1)},s.prototype.rewind=function(){this.internalPosition=0,this.data=new r},s.prototype.save=function(e,t){var n=this;"function"==typeof e&&(t=e,e={}),n.file.chunkCollection((function(r,o){if(r)return t(r);var i={upsert:!0};for(var s in e)i[s]=e[s];for(s in n.writeConcern)i[s]=n.writeConcern[s];n.data.length()>0?n.buildMongoObject((function(e){var r={forceServerObjectId:!0};for(var s in n.writeConcern)r[s]=n.writeConcern[s];o.replaceOne({_id:n.objectId},e,i,(function(e){t(e,n)}))})):t(null,n)}))},s.prototype.buildMongoObject=function(e){var t={files_id:this.file.fileId,n:this.chunkNumber,data:this.data};null!=this.objectId&&(t._id=this.objectId),e(t)},s.prototype.length=function(){return this.data.length()},Object.defineProperty(s.prototype,"position",{enumerable:!0,get:function(){return this.internalPosition},set:function(e){this.internalPosition=e}}),s.DEFAULT_CHUNK_SIZE=261120,e.exports=s},function(e,t,n){const r=n(229);e.exports={packageName:"dbgate-plugin-mongo",drivers:[r]}},function(module,exports,__webpack_require__){const _=__webpack_require__(24),stream=__webpack_require__(18),isPromise=__webpack_require__(230),driverBase=__webpack_require__(231),Analyser=__webpack_require__(233),MongoClient=__webpack_require__(42).MongoClient,ObjectId=__webpack_require__(42).ObjectId,Cursor=__webpack_require__(42).Cursor,createBulkInsertStream=__webpack_require__(495);function transformMongoData(e){return _.mapValues(e,e=>e&&e.constructor==ObjectId?{$oid:e.toString()}:e)}function readCursor(e,t){return new Promise(n=>{t.recordset({__isDynamicStructure:!0}),e.on("data",e=>t.row(transformMongoData(e))),e.on("end",()=>n())})}function convertObjectId(e){return _.cloneDeepWith(e,e=>{if(e&&e.$oid)return ObjectId(e.$oid)})}function findArrayResult(e){if(!_.isPlainObject(e))return null;const t=_.values(e).filter(e=>_.isArray(e));return 1==t.length?t[0]:null}async function getScriptableDb(e){const t=e.__getDatabase(),n=await t.listCollections().toArray();for(const e of n)t[e.name]=t.collection(e.name);return t}const driver={...driverBase,analyserClass:Analyser,async connect({server:e,port:t,user:n,password:r,database:o,useDatabaseUrl:i,databaseUrl:s,ssl:a}){const c=i?s:n?`mongodb://${n}:${r}@${e}:${t}`:`mongodb://${e}:${t}`,u={useUnifiedTopology:!0};a&&(u.tls=!0,u.tlsCAFile=a.ca,u.tlsCertificateKeyFile=a.cert||a.key,u.tlsCertificateKeyFilePassword=a.password,u.tlsAllowInvalidCertificates=!a.rejectUnauthorized);const l=new MongoClient(c,u);return await l.connect(),l.__getDatabase=o?()=>l.db(o):()=>l.db(),l.__databaseName=o,l},query:async(e,t)=>({rows:[],columns:[]}),async script(pool,sql){let func;func=eval(`(db,ObjectId) => { ${sql} }`);const db=await getScriptableDb(pool);func(db,ObjectId)},async stream(pool,sql,options){let func;try{func=eval(`(db,ObjectId) => ${sql}`)}catch(e){return options.info({message:"Error compiling expression: "+e.message,time:new Date,severity:"error"}),void options.done()}const db=await getScriptableDb(pool);let exprValue;try{exprValue=func(db,ObjectId)}catch(e){return options.info({message:"Error evaluating expression: "+e.message,time:new Date,severity:"error"}),void options.done()}if(exprValue instanceof Cursor)await readCursor(exprValue,options);else if(isPromise(exprValue))try{const e=await exprValue;options.info({message:"Command succesfully executed",time:new Date,severity:"info"});try{options.info({message:`Result: ${JSON.stringify(e)}`,time:new Date,severity:"info"})}catch(t){options.info({message:`Result: ${e}`,time:new Date,severity:"info"})}const t=findArrayResult(e);if(t){options.recordset({__isDynamicStructure:!0});for(const e of t)options.row(e)}}catch(e){options.info({message:"Error when running command: "+e.message,time:new Date,severity:"error"})}options.done()},async readQuery(pool,sql,structure){try{const e=JSON.parse(sql);e&&e.pureName&&(sql=`db.${e.pureName}.find()`)}catch(e){}func=eval(`(db,ObjectId) => ${sql}`);const db=await getScriptableDb(pool);return exprValue=func(db,ObjectId),exprValue},async writeTable(e,t,n){return createBulkInsertStream(this,stream,e,t,n)},async getVersion(e){const t=await e.__getDatabase().admin().serverInfo();return{...t,versionText:`MongoDB ${t.version}`}},listDatabases:async e=>(await e.__getDatabase().admin().listDatabases()).databases,async readCollection(e,t){try{const n=e.__getDatabase().collection(t.pureName);if(t.countDocuments){return{count:await n.countDocuments(convertObjectId(t.condition)||{})}}{let e=await n.find(convertObjectId(t.condition)||{});return t.sort&&(e=e.sort(t.sort)),t.skip&&(e=e.skip(t.skip)),t.limit&&(e=e.limit(t.limit)),{rows:(await e.toArray()).map(transformMongoData)}}}catch(e){return{errorMessage:e.message}}},async updateCollection(e,t){const n={inserted:[],updated:[],deleted:[],replaced:[]};try{const r=e.__getDatabase();for(const e of t.inserts){const t=r.collection(e.pureName),o={...e.document,...e.fields},i=await t.insert(convertObjectId(o));n.inserted.push(i._id)}for(const e of t.updates){const t=r.collection(e.pureName);if(e.document){const r={...e.document,...e.fields},o=await t.findOne(convertObjectId(e.condition));if(o){const i=await t.replaceOne(convertObjectId(e.condition),{...convertObjectId(r),_id:o._id});n.replaced.push(i._id)}}else{const r=await t.updateOne(convertObjectId(e.condition),{$set:convertObjectId(e.fields)});n.updated.push(r._id)}}for(const e of t.deletes){const t=r.collection(e.pureName),o=await t.deleteOne(convertObjectId(e.condition));n.deleted.push(o._id)}return n}catch(e){return{errorMessage:e.message}}},async createDatabase(e,t){const n=e.db(t);await n.createCollection("collection1")},async loadFieldValues(e,t,n,r){try{const o=e.__getDatabase().collection(t.pureName),i=[];if(r){const e=_.compact(r.split(" ").map(e=>e.trim()));e.length>0&&i.push({$match:{$and:e.map(e=>({[n]:{$regex:`.*${e}.*`,$options:"i"}}))}})}let s=await o.aggregate([...i,{$group:{_id:"$"+n}},{$sort:{_id:1}},{$limit:100}]);const a=await s.toArray();return _.uniqBy(a.map(transformMongoData).map(({_id:e})=>_.isArray(e)||_.isPlainObject(e)?{value:null}:{value:e}),e=>e.value)}catch(e){return{errorMessage:e.message}}},readJsonQuery(e,t,n){const{collection:r,condition:o,sort:i}=t;return e.__getDatabase().collection(r).find(o||{}).sort(i||{})}};module.exports=driver},function(e,t){function n(e){return!!e&&("object"==typeof e||"function"==typeof e)&&"function"==typeof e.then}e.exports=n,e.exports.default=n},function(e,t,n){const{driverBase:r}=global.DBGATE_TOOLS,o=n(232),{mongoSplitterOptions:i}=n(101);function s(e){return JSON.stringify(e,void 0,2).replace(/\{\s*\"\$oid\"\s*\:\s*\"([0-9a-f]+)\"\s*\}/g,(e,t)=>`ObjectId("${t}")`)}const a={...r,dumperClass:o,databaseEngineTypes:["document"],dialect:{limitSelect:!0,rangeSelect:!0,offsetFetchRangeSyntax:!0,stringEscapeChar:"'",fallbackDataType:"nvarchar(max)",quoteIdentifier:e=>`[${e}]`},engine:"mongo@dbgate-plugin-mongo",title:"MongoDB",editorMode:"javascript",defaultPort:27017,supportsDatabaseUrl:!0,databaseUrlPlaceholder:"e.g. mongodb://username:password@mongodb.mydomain.net/dbname",getQuerySplitterOptions:()=>i,showConnectionField:(e,t)=>"useDatabaseUrl"==e||(t.useDatabaseUrl?["databaseUrl","defaultDatabase","singleDatabase","isReadOnly"].includes(e):["server","port","user","password","defaultDatabase","singleDatabase","isReadOnly"].includes(e)),importExportArgs:[{type:"checkbox",name:"createStringId",label:"Create string _id attribute",apiName:"createStringId",direction:"target"}],getCollectionUpdateScript(e){let t="";for(const n of e.inserts)t+=`db.${n.pureName}.insert(${s({...n.document,...n.fields})});\n`;for(const n of e.updates)n.document?t+=`db.${n.pureName}.replaceOne(${s(n.condition)}, ${s({...n.document,...n.fields})});\n`:t+=`db.${n.pureName}.updateOne(${s(n.condition)}, ${s({$set:n.fields})});\n`;for(const n of e.deletes)t+=`db.${n.pureName}.deleteOne(${s(n.condition)});\n`;return t}};e.exports=a},function(e,t){const{SqlDumper:n}=global.DBGATE_TOOLS;e.exports=class extends n{}},function(e,t,n){const{DatabaseAnalyser:r}=n(234);e.exports=class extends r{constructor(e,t,n){super(e,t,n)}async _runAnalysis(){const e=await this.pool.__getDatabase().listCollections().toArray();return this.mergeAnalyseResult({collections:e.map(e=>({pureName:e.name}))})}}},function(e,t,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),o=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||r(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),o(n(235),t),o(n(236),t),o(n(146),t),o(n(163),t),o(n(318),t),o(n(120),t),o(n(366),t),o(n(179),t),o(n(377),t),o(n(379),t),o(n(183),t),o(n(383),t),o(n(385),t),o(n(128),t),o(n(397),t),o(n(398),t),o(n(399),t),o(n(400),t),o(n(401),t),o(n(402),t)},function(e,t,n){"use strict";function r(e){return e&&/int/i.test(e)}function o(e){return e&&/numeric|decimal/i.test(e)}function i(e){return e&&/float|single|double/i.test(e)}Object.defineProperty(t,"__esModule",{value:!0}),t.isTypeDateTime=t.isTypeLogical=t.isTypeString=t.isTypeNumber=t.isTypeFloat=t.isTypeNumeric=t.isTypeInteger=void 0,t.isTypeInteger=r,t.isTypeNumeric=o,t.isTypeFloat=i,t.isTypeNumber=function(e){return r(e)||i(e)||o(e)},t.isTypeString=function(e){return e&&/char|binary/i.test(e)},t.isTypeLogical=function(e){return e&&/bit|boolean/i.test(e)},t.isTypeDateTime=function(e){return e&&/date|time|timestamp/i.test(e)}},function(e,t,n){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.fillConstraintNames=t.makeUniqueColumnNames=t.findForeignKeyForColumn=t.findObjectLike=t.equalStringLike=t.quoteFullName=t.fullNameToLabel=t.fullNameToString=t.fullNameFromString=void 0;const o=r(n(24));function i(e,t){return(e||"").toLowerCase().trim()==(t||"").toLowerCase().trim()}function s(e,t,n){return`${e}_${t.pureName}_${n.map(e=>e.columnName.replace(" ","_")).join("_")}`}t.fullNameFromString=function(e){const t=e.match(/\[([^\]]+)\]\.\[([^\]]+)\]/);return t?{schemaName:t[1],pureName:t[2]}:{schemaName:null,pureName:e}},t.fullNameToString=function({schemaName:e,pureName:t}){return e?`[${e}].[${t}]`:t},t.fullNameToLabel=function({schemaName:e,pureName:t}){return e?`${e}.${t}`:t},t.quoteFullName=function(e,{schemaName:t,pureName:n}){return t?`${e.quoteIdentifier(t)}.${e.quoteIdentifier(n)}`:`${e.quoteIdentifier(n)}`},t.equalStringLike=i,t.findObjectLike=function({pureName:e,schemaName:t},n,r){var o,s;return n?t?null===(o=n[r])||void 0===o?void 0:o.find(n=>i(n.pureName,e)&&i(n.schemaName,t)):null===(s=n[r])||void 0===s?void 0:s.find(t=>i(t.pureName,e)):null},t.findForeignKeyForColumn=function(e,t){return(e.foreignKeys||[]).find(e=>e.columns.find(e=>e.columnName==t.columnName))},t.makeUniqueColumnNames=function(e){const t=new Set;for(let n=0;n<e.length;n++){if(t.has(e[n].columnName)){let r=2;for(;t.has(`${e[n].columnName}${r}`);)r++;e[n].columnName=`${e[n].columnName}${r}`}t.add(e[n].columnName)}},t.fillConstraintNames=function(e,t){if(!e)return e;const n=o.default.cloneDeep(e);!n.primaryKey||n.primaryKey.constraintName||t.anonymousPrimaryKey||(n.primaryKey.constraintName=`PK_${n.pureName}`);for(const e of n.foreignKeys||[])e.constraintName||(e.constraintName=s("FK",n,e.columns));for(const e of n.indexes||[])e.constraintName||(e.constraintName=s("IX",n,e.columns));for(const e of n.uniques||[])e.constraintName||(e.constraintName=s("UQ",n,e.columns));return n}},function(e,t){e.exports=function(){this.__data__=[],this.size=0}},function(e,t,n){var r=n(64),o=Array.prototype.splice;e.exports=function(e){var t=this.__data__,n=r(t,e);return!(n<0)&&(n==t.length-1?t.pop():o.call(t,n,1),--this.size,!0)}},function(e,t,n){var r=n(64);e.exports=function(e){var t=this.__data__,n=r(t,e);return n<0?void 0:t[n][1]}},function(e,t,n){var r=n(64);e.exports=function(e){return r(this.__data__,e)>-1}},function(e,t,n){var r=n(64);e.exports=function(e,t){var n=this.__data__,o=r(n,e);return o<0?(++this.size,n.push([e,t])):n[o][1]=t,this}},function(e,t,n){var r=n(63);e.exports=function(){this.__data__=new r,this.size=0}},function(e,t){e.exports=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n}},function(e,t){e.exports=function(e){return this.__data__.get(e)}},function(e,t){e.exports=function(e){return this.__data__.has(e)}},function(e,t,n){var r=n(63),o=n(104),i=n(105);e.exports=function(e,t){var n=this.__data__;if(n instanceof r){var s=n.__data__;if(!o||s.length<199)return s.push([e,t]),this.size=++n.size,this;n=this.__data__=new i(s)}return n.set(e,t),this.size=n.size,this}},function(e,t,n){var r=n(148),o=n(250),i=n(28),s=n(150),a=/^\[object .+?Constructor\]$/,c=Function.prototype,u=Object.prototype,l=c.toString,f=u.hasOwnProperty,p=RegExp("^"+l.call(f).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");e.exports=function(e){return!(!i(e)||o(e))&&(r(e)?p:a).test(s(e))}},function(e,t,n){var r=n(36),o=Object.prototype,i=o.hasOwnProperty,s=o.toString,a=r?r.toStringTag:void 0;e.exports=function(e){var t=i.call(e,a),n=e[a];try{e[a]=void 0;var r=!0}catch(e){}var o=s.call(e);return r&&(t?e[a]=n:delete e[a]),o}},function(e,t){var n=Object.prototype.toString;e.exports=function(e){return n.call(e)}},function(e,t,n){var r,o=n(251),i=(r=/[^.]+$/.exec(o&&o.keys&&o.keys.IE_PROTO||""))?"Symbol(src)_1."+r:"";e.exports=function(e){return!!i&&i in e}},function(e,t,n){var r=n(19)["__core-js_shared__"];e.exports=r},function(e,t){e.exports=function(e,t){return null==e?void 0:e[t]}},function(e,t,n){var r=n(254),o=n(63),i=n(104);e.exports=function(){this.size=0,this.__data__={hash:new r,map:new(i||o),string:new r}}},function(e,t,n){var r=n(255),o=n(256),i=n(257),s=n(258),a=n(259);function c(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}c.prototype.clear=r,c.prototype.delete=o,c.prototype.get=i,c.prototype.has=s,c.prototype.set=a,e.exports=c},function(e,t,n){var r=n(66);e.exports=function(){this.__data__=r?r(null):{},this.size=0}},function(e,t){e.exports=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}},function(e,t,n){var r=n(66),o=Object.prototype.hasOwnProperty;e.exports=function(e){var t=this.__data__;if(r){var n=t[e];return"__lodash_hash_undefined__"===n?void 0:n}return o.call(t,e)?t[e]:void 0}},function(e,t,n){var r=n(66),o=Object.prototype.hasOwnProperty;e.exports=function(e){var t=this.__data__;return r?void 0!==t[e]:o.call(t,e)}},function(e,t,n){var r=n(66);e.exports=function(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=r&&void 0===t?"__lodash_hash_undefined__":t,this}},function(e,t,n){var r=n(67);e.exports=function(e){var t=r(this,e).delete(e);return this.size-=t?1:0,t}},function(e,t){e.exports=function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e}},function(e,t,n){var r=n(67);e.exports=function(e){return r(this,e).get(e)}},function(e,t,n){var r=n(67);e.exports=function(e){return r(this,e).has(e)}},function(e,t,n){var r=n(67);e.exports=function(e,t){var n=r(this,e),o=n.size;return n.set(e,t),this.size+=n.size==o?0:1,this}},function(e,t){e.exports=function(e,t){for(var n=-1,r=null==e?0:e.length;++n<r&&!1!==t(e[n],n,e););return e}},function(e,t,n){var r=n(48),o=n(49);e.exports=function(e,t){return e&&r(t,o(t),e)}},function(e,t){e.exports=function(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r}},function(e,t,n){var r=n(25),o=n(15);e.exports=function(e){return o(e)&&"[object Arguments]"==r(e)}},function(e,t){e.exports=function(){return!1}},function(e,t,n){var r=n(25),o=n(110),i=n(15),s={};s["[object Float32Array]"]=s["[object Float64Array]"]=s["[object Int8Array]"]=s["[object Int16Array]"]=s["[object Int32Array]"]=s["[object Uint8Array]"]=s["[object Uint8ClampedArray]"]=s["[object Uint16Array]"]=s["[object Uint32Array]"]=!0,s["[object Arguments]"]=s["[object Array]"]=s["[object ArrayBuffer]"]=s["[object Boolean]"]=s["[object DataView]"]=s["[object Date]"]=s["[object Error]"]=s["[object Function]"]=s["[object Map]"]=s["[object Number]"]=s["[object Object]"]=s["[object RegExp]"]=s["[object Set]"]=s["[object String]"]=s["[object WeakMap]"]=!1,e.exports=function(e){return i(e)&&o(e.length)&&!!s[r(e)]}},function(e,t,n){var r=n(111),o=n(272),i=Object.prototype.hasOwnProperty;e.exports=function(e){if(!r(e))return o(e);var t=[];for(var n in Object(e))i.call(e,n)&&"constructor"!=n&&t.push(n);return t}},function(e,t,n){var r=n(154)(Object.keys,Object);e.exports=r},function(e,t,n){var r=n(48),o=n(112);e.exports=function(e,t){return e&&r(t,o(t),e)}},function(e,t,n){var r=n(28),o=n(111),i=n(275),s=Object.prototype.hasOwnProperty;e.exports=function(e){if(!r(e))return i(e);var t=o(e),n=[];for(var a in e)("constructor"!=a||!t&&s.call(e,a))&&n.push(a);return n}},function(e,t){e.exports=function(e){var t=[];if(null!=e)for(var n in Object(e))t.push(n);return t}},function(e,t,n){(function(e){var r=n(19),o=t&&!t.nodeType&&t,i=o&&"object"==typeof e&&e&&!e.nodeType&&e,s=i&&i.exports===o?r.Buffer:void 0,a=s?s.allocUnsafe:void 0;e.exports=function(e,t){if(t)return e.slice();var n=e.length,r=a?a(n):new e.constructor(n);return e.copy(r),r}}).call(this,n(62)(e))},function(e,t){e.exports=function(e,t){var n=-1,r=e.length;for(t||(t=Array(r));++n<r;)t[n]=e[n];return t}},function(e,t,n){var r=n(48),o=n(113);e.exports=function(e,t){return r(e,o(e),t)}},function(e,t){e.exports=function(e,t){for(var n=-1,r=null==e?0:e.length,o=0,i=[];++n<r;){var s=e[n];t(s,n,e)&&(i[o++]=s)}return i}},function(e,t,n){var r=n(48),o=n(156);e.exports=function(e,t){return r(e,o(e),t)}},function(e,t,n){var r=n(31)(n(19),"DataView");e.exports=r},function(e,t,n){var r=n(31)(n(19),"Promise");e.exports=r},function(e,t,n){var r=n(31)(n(19),"WeakMap");e.exports=r},function(e,t){var n=Object.prototype.hasOwnProperty;e.exports=function(e){var t=e.length,r=new e.constructor(t);return t&&"string"==typeof e[0]&&n.call(e,"index")&&(r.index=e.index,r.input=e.input),r}},function(e,t,n){var r=n(116),o=n(286),i=n(287),s=n(288),a=n(289);e.exports=function(e,t,n){var c=e.constructor;switch(t){case"[object ArrayBuffer]":return r(e);case"[object Boolean]":case"[object Date]":return new c(+e);case"[object DataView]":return o(e,n);case"[object Float32Array]":case"[object Float64Array]":case"[object Int8Array]":case"[object Int16Array]":case"[object Int32Array]":case"[object Uint8Array]":case"[object Uint8ClampedArray]":case"[object Uint16Array]":case"[object Uint32Array]":return a(e,n);case"[object Map]":return new c;case"[object Number]":case"[object String]":return new c(e);case"[object RegExp]":return i(e);case"[object Set]":return new c;case"[object Symbol]":return s(e)}}},function(e,t,n){var r=n(116);e.exports=function(e,t){var n=t?r(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}},function(e,t){var n=/\w*$/;e.exports=function(e){var t=new e.constructor(e.source,n.exec(e));return t.lastIndex=e.lastIndex,t}},function(e,t,n){var r=n(36),o=r?r.prototype:void 0,i=o?o.valueOf:void 0;e.exports=function(e){return i?Object(i.call(e)):{}}},function(e,t,n){var r=n(116);e.exports=function(e,t){var n=t?r(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}},function(e,t,n){var r=n(291),o=n(115),i=n(111);e.exports=function(e){return"function"!=typeof e.constructor||i(e)?{}:r(o(e))}},function(e,t,n){var r=n(28),o=Object.create,i=function(){function e(){}return function(t){if(!r(t))return{};if(o)return o(t);e.prototype=t;var n=new e;return e.prototype=void 0,n}}();e.exports=i},function(e,t,n){var r=n(293),o=n(37),i=n(69),s=i&&i.isMap,a=s?o(s):r;e.exports=a},function(e,t,n){var r=n(70),o=n(15);e.exports=function(e){return o(e)&&"[object Map]"==r(e)}},function(e,t,n){var r=n(295),o=n(37),i=n(69),s=i&&i.isSet,a=s?o(s):r;e.exports=a},function(e,t,n){var r=n(70),o=n(15);e.exports=function(e){return o(e)&&"[object Set]"==r(e)}},function(e,t){e.exports=function(e){for(var t=-1,n=null==e?0:e.length,r={};++t<n;){var o=e[t];r[o[0]]=o[1]}return r}},function(e,t,n){var r=n(298),o=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,i=/\\(\\)?/g,s=r((function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(o,(function(e,n,r,o){t.push(r?o.replace(i,"$1"):n||e)})),t}));e.exports=s},function(e,t,n){var r=n(299);e.exports=function(e){var t=r(e,(function(e){return 500===n.size&&n.clear(),e})),n=t.cache;return t}},function(e,t,n){var r=n(105);function o(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new TypeError("Expected a function");var n=function(){var r=arguments,o=t?t.apply(this,r):r[0],i=n.cache;if(i.has(o))return i.get(o);var s=e.apply(this,r);return n.cache=i.set(o,s)||i,s};return n.cache=new(o.Cache||r),n}o.Cache=r,e.exports=o},function(e,t,n){var r=n(36),o=n(51),i=n(12),s=n(71),a=r?r.prototype:void 0,c=a?a.toString:void 0;e.exports=function e(t){if("string"==typeof t)return t;if(i(t))return o(t,e)+"";if(s(t))return c?c.call(t):"";var n=t+"";return"0"==n&&1/t==-1/0?"-0":n}},function(e,t,n){var r=n(302),o=n(309)((function(e,t,n){return t=t.toLowerCase(),e+(n?r(t):t)}));e.exports=o},function(e,t,n){var r=n(40),o=n(303);e.exports=function(e){return o(r(e).toLowerCase())}},function(e,t,n){var r=n(304)("toUpperCase");e.exports=r},function(e,t,n){var r=n(305),o=n(165),i=n(306),s=n(40);e.exports=function(e){return function(t){t=s(t);var n=o(t)?i(t):void 0,a=n?n[0]:t.charAt(0),c=n?r(n,1).join(""):t.slice(1);return a[e]()+c}}},function(e,t,n){var r=n(164);e.exports=function(e,t,n){var o=e.length;return n=void 0===n?o:n,!t&&n>=o?e:r(e,t,n)}},function(e,t,n){var r=n(307),o=n(165),i=n(308);e.exports=function(e){return o(e)?i(e):r(e)}},function(e,t){e.exports=function(e){return e.split("")}},function(e,t){var n="[\\ud800-\\udfff]",r="[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]",o="\\ud83c[\\udffb-\\udfff]",i="[^\\ud800-\\udfff]",s="(?:\\ud83c[\\udde6-\\uddff]){2}",a="[\\ud800-\\udbff][\\udc00-\\udfff]",c="(?:"+r+"|"+o+")"+"?",u="[\\ufe0e\\ufe0f]?"+c+("(?:\\u200d(?:"+[i,s,a].join("|")+")[\\ufe0e\\ufe0f]?"+c+")*"),l="(?:"+[i+r+"?",r,s,a,n].join("|")+")",f=RegExp(o+"(?="+o+")|"+l+u,"g");e.exports=function(e){return e.match(f)||[]}},function(e,t,n){var r=n(310),o=n(311),i=n(314),s=RegExp("['’]","g");e.exports=function(e){return function(t){return r(i(o(t).replace(s,"")),e,"")}}},function(e,t){e.exports=function(e,t,n,r){var o=-1,i=null==e?0:e.length;for(r&&i&&(n=e[++o]);++o<i;)n=t(n,e[o],o,e);return n}},function(e,t,n){var r=n(312),o=n(40),i=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,s=RegExp("[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]","g");e.exports=function(e){return(e=o(e))&&e.replace(i,r).replace(s,"")}},function(e,t,n){var r=n(313)({"À":"A","Á":"A","Â":"A","Ã":"A","Ä":"A","Å":"A","à":"a","á":"a","â":"a","ã":"a","ä":"a","å":"a","Ç":"C","ç":"c","Ð":"D","ð":"d","È":"E","É":"E","Ê":"E","Ë":"E","è":"e","é":"e","ê":"e","ë":"e","Ì":"I","Í":"I","Î":"I","Ï":"I","ì":"i","í":"i","î":"i","ï":"i","Ñ":"N","ñ":"n","Ò":"O","Ó":"O","Ô":"O","Õ":"O","Ö":"O","Ø":"O","ò":"o","ó":"o","ô":"o","õ":"o","ö":"o","ø":"o","Ù":"U","Ú":"U","Û":"U","Ü":"U","ù":"u","ú":"u","û":"u","ü":"u","Ý":"Y","ý":"y","ÿ":"y","Æ":"Ae","æ":"ae","Þ":"Th","þ":"th","ß":"ss","Ā":"A","Ă":"A","Ą":"A","ā":"a","ă":"a","ą":"a","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","ć":"c","ĉ":"c","ċ":"c","č":"c","Ď":"D","Đ":"D","ď":"d","đ":"d","Ē":"E","Ĕ":"E","Ė":"E","Ę":"E","Ě":"E","ē":"e","ĕ":"e","ė":"e","ę":"e","ě":"e","Ĝ":"G","Ğ":"G","Ġ":"G","Ģ":"G","ĝ":"g","ğ":"g","ġ":"g","ģ":"g","Ĥ":"H","Ħ":"H","ĥ":"h","ħ":"h","Ĩ":"I","Ī":"I","Ĭ":"I","Į":"I","İ":"I","ĩ":"i","ī":"i","ĭ":"i","į":"i","ı":"i","Ĵ":"J","ĵ":"j","Ķ":"K","ķ":"k","ĸ":"k","Ĺ":"L","Ļ":"L","Ľ":"L","Ŀ":"L","Ł":"L","ĺ":"l","ļ":"l","ľ":"l","ŀ":"l","ł":"l","Ń":"N","Ņ":"N","Ň":"N","Ŋ":"N","ń":"n","ņ":"n","ň":"n","ŋ":"n","Ō":"O","Ŏ":"O","Ő":"O","ō":"o","ŏ":"o","ő":"o","Ŕ":"R","Ŗ":"R","Ř":"R","ŕ":"r","ŗ":"r","ř":"r","Ś":"S","Ŝ":"S","Ş":"S","Š":"S","ś":"s","ŝ":"s","ş":"s","š":"s","Ţ":"T","Ť":"T","Ŧ":"T","ţ":"t","ť":"t","ŧ":"t","Ũ":"U","Ū":"U","Ŭ":"U","Ů":"U","Ű":"U","Ų":"U","ũ":"u","ū":"u","ŭ":"u","ů":"u","ű":"u","ų":"u","Ŵ":"W","ŵ":"w","Ŷ":"Y","ŷ":"y","Ÿ":"Y","Ź":"Z","Ż":"Z","Ž":"Z","ź":"z","ż":"z","ž":"z","IJ":"IJ","ij":"ij","Œ":"Oe","œ":"oe","ʼn":"'n","ſ":"s"});e.exports=r},function(e,t){e.exports=function(e){return function(t){return null==e?void 0:e[t]}}},function(e,t,n){var r=n(315),o=n(316),i=n(40),s=n(317);e.exports=function(e,t,n){return e=i(e),void 0===(t=n?void 0:t)?o(e)?s(e):r(e):e.match(t)||[]}},function(e,t){var n=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;e.exports=function(e){return e.match(n)||[]}},function(e,t){var n=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;e.exports=function(e){return n.test(e)}},function(e,t){var n="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",r="["+n+"]",o="\\d+",i="[\\u2700-\\u27bf]",s="[a-z\\xdf-\\xf6\\xf8-\\xff]",a="[^\\ud800-\\udfff"+n+o+"\\u2700-\\u27bfa-z\\xdf-\\xf6\\xf8-\\xffA-Z\\xc0-\\xd6\\xd8-\\xde]",c="(?:\\ud83c[\\udde6-\\uddff]){2}",u="[\\ud800-\\udbff][\\udc00-\\udfff]",l="[A-Z\\xc0-\\xd6\\xd8-\\xde]",f="(?:"+s+"|"+a+")",p="(?:"+l+"|"+a+")",d="(?:[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]|\\ud83c[\\udffb-\\udfff])?",h="[\\ufe0e\\ufe0f]?"+d+("(?:\\u200d(?:"+["[^\\ud800-\\udfff]",c,u].join("|")+")[\\ufe0e\\ufe0f]?"+d+")*"),m="(?:"+[i,c,u].join("|")+")"+h,g=RegExp([l+"?"+s+"+(?:['’](?:d|ll|m|re|s|t|ve))?(?="+[r,l,"$"].join("|")+")",p+"+(?:['’](?:D|LL|M|RE|S|T|VE))?(?="+[r,l+f,"$"].join("|")+")",l+"?"+f+"+(?:['’](?:d|ll|m|re|s|t|ve))?",l+"+(?:['’](?:D|LL|M|RE|S|T|VE))?","\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",o,m].join("|"),"g");e.exports=function(e){return e.match(g)||[]}},function(e,t,n){"use strict";var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))},o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.createBulkInsertStreamBase=void 0;const i=o(n(319)),s=n(146);t.createBulkInsertStreamBase=function(e,t,n,o,a){const c=o.schemaName?`${e.dialect.quoteIdentifier(o.schemaName)}.${e.dialect.quoteIdentifier(o.pureName)}`:e.dialect.quoteIdentifier(o.pureName),u=new t.Writable({objectMode:!0});return u.buffer=[],u.structure=null,u.columnNames=null,u.requireFixedStructure=e.databaseEngineTypes.includes("sql"),u.addRow=e=>r(this,void 0,void 0,(function*(){u.structure?u.buffer.push(e):(u.structure=e,yield u.checkStructure())})),u.checkStructure=()=>r(this,void 0,void 0,(function*(){let t=yield e.analyseSingleTable(n,o);if(t&&a.dropIfExists&&(console.log(`Dropping table ${c}`),yield e.script(n,`DROP TABLE ${c}`)),a.createIfNotExists&&(!t||a.dropIfExists)){console.log(`Creating table ${c}`);const r=e.createDumper();r.createTable((0,s.prepareTableForImport)(Object.assign(Object.assign({},u.structure),o))),console.log(r.s),yield e.script(n,r.s),t=yield e.analyseSingleTable(n,o)}a.truncate&&(yield e.script(n,`TRUNCATE TABLE ${c}`)),u.columnNames=(0,i.default)(t.columns.map(e=>e.columnName),u.structure.columns.map(e=>e.columnName))})),u.send=()=>r(this,void 0,void 0,(function*(){const t=u.buffer;u.buffer=[];const r=e.createDumper();r.putRaw(`INSERT INTO ${c} (`),r.putCollection(",",u.columnNames,t=>r.putRaw(e.dialect.quoteIdentifier(t))),r.putRaw(")\n VALUES\n");let o=!1;for(const e of t)o&&r.putRaw(",\n"),r.putRaw("("),r.putCollection(",",u.columnNames,t=>r.putValue(e[t])),r.putRaw(")"),o=!0;r.putRaw(";"),yield e.query(n,r.s)})),u.sendIfFull=()=>r(this,void 0,void 0,(function*(){u.buffer.length>100&&(yield u.send())})),u._write=(e,t,n)=>r(this,void 0,void 0,(function*(){yield u.addRow(e),yield u.sendIfFull(),n()})),u._final=e=>r(this,void 0,void 0,(function*(){yield u.send(),e()})),u}},function(e,t,n){var r=n(51),o=n(320),i=n(168),s=n(331),a=i((function(e){var t=r(e,s);return t.length&&t[0]===e[0]?o(t):[]}));e.exports=a},function(e,t,n){var r=n(118),o=n(166),i=n(167),s=n(51),a=n(37),c=n(119),u=Math.min;e.exports=function(e,t,n){for(var l=n?i:o,f=e[0].length,p=e.length,d=p,h=Array(p),m=1/0,g=[];d--;){var y=e[d];d&&t&&(y=s(y,a(t))),m=u(y.length,m),h[d]=!n&&(t||f>=120&&y.length>=120)?new r(d&&y):void 0}y=e[0];var b=-1,v=h[0];e:for(;++b<f&&g.length<m;){var S=y[b],w=t?t(S):S;if(S=n||0!==S?S:0,!(v?c(v,w):l(g,w,n))){for(d=p;--d;){var _=h[d];if(!(_?c(_,w):l(e[d],w,n)))continue e}v&&v.push(w),g.push(S)}}return g}},function(e,t){e.exports=function(e){return this.__data__.set(e,"__lodash_hash_undefined__"),this}},function(e,t){e.exports=function(e){return this.__data__.has(e)}},function(e,t,n){var r=n(324),o=n(325),i=n(326);e.exports=function(e,t,n){return t==t?i(e,t,n):r(e,o,n)}},function(e,t){e.exports=function(e,t,n,r){for(var o=e.length,i=n+(r?1:-1);r?i--:++i<o;)if(t(e[i],i,e))return i;return-1}},function(e,t){e.exports=function(e){return e!=e}},function(e,t){e.exports=function(e,t,n){for(var r=n-1,o=e.length;++r<o;)if(e[r]===t)return r;return-1}},function(e,t){e.exports=function(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}},function(e,t,n){var r=n(329),o=n(151),i=n(74),s=o?function(e,t){return o(e,"toString",{configurable:!0,enumerable:!1,value:r(t),writable:!0})}:i;e.exports=s},function(e,t){e.exports=function(e){return function(){return e}}},function(e,t){var n=Date.now;e.exports=function(e){var t=0,r=0;return function(){var o=n(),i=16-(o-r);if(r=o,i>0){if(++t>=800)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}},function(e,t,n){var r=n(332);e.exports=function(e){return r(e)?e:[]}},function(e,t,n){var r=n(38),o=n(15);e.exports=function(e){return o(e)&&r(e)}},function(e,t,n){var r=n(171),o=n(335),i=n(168),s=n(358),a=i((function(e,t){if(null==e)return[];var n=t.length;return n>1&&s(e,t[0],t[1])?t=[]:n>2&&s(t[0],t[1],t[2])&&(t=[t[0]]),o(e,r(t,1),[])}));e.exports=a},function(e,t,n){var r=n(36),o=n(108),i=n(12),s=r?r.isConcatSpreadable:void 0;e.exports=function(e){return i(e)||o(e)||!!(s&&e&&e[s])}},function(e,t,n){var r=n(51),o=n(50),i=n(121),s=n(350),a=n(355),c=n(37),u=n(356),l=n(74),f=n(12);e.exports=function(e,t,n){t=t.length?r(t,(function(e){return f(e)?function(t){return o(t,1===e.length?e[0]:e)}:e})):[l];var p=-1;t=r(t,c(i));var d=s(e,(function(e,n,o){return{criteria:r(t,(function(t){return t(e)})),index:++p,value:e}}));return a(d,(function(e,t){return u(e,t,n)}))}},function(e,t,n){var r=n(337),o=n(343),i=n(174);e.exports=function(e){var t=o(e);return 1==t.length&&t[0][2]?i(t[0][0],t[0][1]):function(n){return n===e||r(n,e,t)}}},function(e,t,n){var r=n(103),o=n(122);e.exports=function(e,t,n,i){var s=n.length,a=s,c=!i;if(null==e)return!a;for(e=Object(e);s--;){var u=n[s];if(c&&u[2]?u[1]!==e[u[0]]:!(u[0]in e))return!1}for(;++s<a;){var l=(u=n[s])[0],f=e[l],p=u[1];if(c&&u[2]){if(void 0===f&&!(l in e))return!1}else{var d=new r;if(i)var h=i(f,p,l,e,t,d);if(!(void 0===h?o(p,f,3,i,d):h))return!1}}return!0}},function(e,t,n){var r=n(103),o=n(172),i=n(340),s=n(342),a=n(70),c=n(12),u=n(109),l=n(153),f="[object Object]",p=Object.prototype.hasOwnProperty;e.exports=function(e,t,n,d,h,m){var g=c(e),y=c(t),b=g?"[object Array]":a(e),v=y?"[object Array]":a(t),S=(b="[object Arguments]"==b?f:b)==f,w=(v="[object Arguments]"==v?f:v)==f,_=b==v;if(_&&u(e)){if(!u(t))return!1;g=!0,S=!1}if(_&&!S)return m||(m=new r),g||l(e)?o(e,t,n,d,h,m):i(e,t,b,n,d,h,m);if(!(1&n)){var O=S&&p.call(e,"__wrapped__"),T=w&&p.call(t,"__wrapped__");if(O||T){var C=O?e.value():e,x=T?t.value():t;return m||(m=new r),h(C,x,n,d,m)}}return!!_&&(m||(m=new r),s(e,t,n,d,h,m))}},function(e,t){e.exports=function(e,t){for(var n=-1,r=null==e?0:e.length;++n<r;)if(t(e[n],n,e))return!0;return!1}},function(e,t,n){var r=n(36),o=n(161),i=n(65),s=n(172),a=n(341),c=n(123),u=r?r.prototype:void 0,l=u?u.valueOf:void 0;e.exports=function(e,t,n,r,u,f,p){switch(n){case"[object DataView]":if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case"[object ArrayBuffer]":return!(e.byteLength!=t.byteLength||!f(new o(e),new o(t)));case"[object Boolean]":case"[object Date]":case"[object Number]":return i(+e,+t);case"[object Error]":return e.name==t.name&&e.message==t.message;case"[object RegExp]":case"[object String]":return e==t+"";case"[object Map]":var d=a;case"[object Set]":var h=1&r;if(d||(d=c),e.size!=t.size&&!h)return!1;var m=p.get(e);if(m)return m==t;r|=2,p.set(e,t);var g=s(d(e),d(t),r,u,f,p);return p.delete(e),g;case"[object Symbol]":if(l)return l.call(e)==l.call(t)}return!1}},function(e,t){e.exports=function(e){var t=-1,n=Array(e.size);return e.forEach((function(e,r){n[++t]=[r,e]})),n}},function(e,t,n){var r=n(157),o=Object.prototype.hasOwnProperty;e.exports=function(e,t,n,i,s,a){var c=1&n,u=r(e),l=u.length;if(l!=r(t).length&&!c)return!1;for(var f=l;f--;){var p=u[f];if(!(c?p in t:o.call(t,p)))return!1}var d=a.get(e),h=a.get(t);if(d&&h)return d==t&&h==e;var m=!0;a.set(e,t),a.set(t,e);for(var g=c;++f<l;){var y=e[p=u[f]],b=t[p];if(i)var v=c?i(b,y,p,t,e,a):i(y,b,p,e,t,a);if(!(void 0===v?y===b||s(y,b,n,i,a):v)){m=!1;break}g||(g="constructor"==p)}if(m&&!g){var S=e.constructor,w=t.constructor;S!=w&&"constructor"in e&&"constructor"in t&&!("function"==typeof S&&S instanceof S&&"function"==typeof w&&w instanceof w)&&(m=!1)}return a.delete(e),a.delete(t),m}},function(e,t,n){var r=n(173),o=n(49);e.exports=function(e){for(var t=o(e),n=t.length;n--;){var i=t[n],s=e[i];t[n]=[i,s,r(s)]}return t}},function(e,t,n){var r=n(122),o=n(162),i=n(175),s=n(117),a=n(173),c=n(174),u=n(41);e.exports=function(e,t){return s(e)&&a(t)?c(u(e),t):function(n){var s=o(n,e);return void 0===s&&s===t?i(n,e):r(t,s,3)}}},function(e,t){e.exports=function(e,t){return null!=e&&t in Object(e)}},function(e,t,n){var r=n(39),o=n(108),i=n(12),s=n(68),a=n(110),c=n(41);e.exports=function(e,t,n){for(var u=-1,l=(t=r(t,e)).length,f=!1;++u<l;){var p=c(t[u]);if(!(f=null!=e&&n(e,p)))break;e=e[p]}return f||++u!=l?f:!!(l=null==e?0:e.length)&&a(l)&&s(p,l)&&(i(e)||o(e))}},function(e,t,n){var r=n(348),o=n(349),i=n(117),s=n(41);e.exports=function(e){return i(e)?r(s(e)):o(e)}},function(e,t){e.exports=function(e){return function(t){return null==t?void 0:t[e]}}},function(e,t,n){var r=n(50);e.exports=function(e){return function(t){return r(t,e)}}},function(e,t,n){var r=n(176),o=n(38);e.exports=function(e,t){var n=-1,i=o(e)?Array(e.length):[];return r(e,(function(e,r,o){i[++n]=t(e,r,o)})),i}},function(e,t,n){var r=n(352),o=n(49);e.exports=function(e,t){return e&&r(e,t,o)}},function(e,t,n){var r=n(353)();e.exports=r},function(e,t){e.exports=function(e){return function(t,n,r){for(var o=-1,i=Object(t),s=r(t),a=s.length;a--;){var c=s[e?a:++o];if(!1===n(i[c],c,i))break}return t}}},function(e,t,n){var r=n(38);e.exports=function(e,t){return function(n,o){if(null==n)return n;if(!r(n))return e(n,o);for(var i=n.length,s=t?i:-1,a=Object(n);(t?s--:++s<i)&&!1!==o(a[s],s,a););return n}}},function(e,t){e.exports=function(e,t){var n=e.length;for(e.sort(t);n--;)e[n]=e[n].value;return e}},function(e,t,n){var r=n(357);e.exports=function(e,t,n){for(var o=-1,i=e.criteria,s=t.criteria,a=i.length,c=n.length;++o<a;){var u=r(i[o],s[o]);if(u)return o>=c?u:u*("desc"==n[o]?-1:1)}return e.index-t.index}},function(e,t,n){var r=n(71);e.exports=function(e,t){if(e!==t){var n=void 0!==e,o=null===e,i=e==e,s=r(e),a=void 0!==t,c=null===t,u=t==t,l=r(t);if(!c&&!l&&!s&&e>t||s&&a&&u&&!c&&!l||o&&a&&u||!n&&u||!i)return 1;if(!o&&!s&&!l&&e<t||l&&n&&i&&!o&&!s||c&&n&&i||!a&&i||!u)return-1}return 0}},function(e,t,n){var r=n(65),o=n(38),i=n(68),s=n(28);e.exports=function(e,t,n){if(!s(n))return!1;var a=typeof t;return!!("number"==a?o(n)&&i(t,n.length):"string"==a&&t in n)&&r(n[t],e)}},function(e,t,n){var r=n(107),o=n(360),i=Object.prototype.hasOwnProperty,s=o((function(e,t,n){i.call(e,n)?e[n].push(t):r(e,n,[t])}));e.exports=s},function(e,t,n){var r=n(361),o=n(362),i=n(121),s=n(12);e.exports=function(e,t){return function(n,a){var c=s(n)?r:o,u=t?t():{};return c(n,e,i(a,2),u)}}},function(e,t){e.exports=function(e,t,n,r){for(var o=-1,i=null==e?0:e.length;++o<i;){var s=e[o];t(r,s,n(s),e)}return r}},function(e,t,n){var r=n(176);e.exports=function(e,t,n,o){return r(e,(function(e,r,i){t(o,e,n(e),i)})),o}},function(e,t,n){var r=n(364),o=n(175);e.exports=function(e,t){return r(e,t,(function(t,n){return o(e,n)}))}},function(e,t,n){var r=n(50),o=n(365),i=n(39);e.exports=function(e,t,n){for(var s=-1,a=t.length,c={};++s<a;){var u=t[s],l=r(e,u);n(l,u)&&o(c,i(u,e),l)}return c}},function(e,t,n){var r=n(106),o=n(39),i=n(68),s=n(28),a=n(41);e.exports=function(e,t,n,c){if(!s(e))return e;for(var u=-1,l=(t=o(t,e)).length,f=l-1,p=e;null!=p&&++u<l;){var d=a(t[u]),h=n;if("__proto__"===d||"constructor"===d||"prototype"===d)return e;if(u!=f){var m=p[d];void 0===(h=c?c(m,d,p):void 0)&&(h=s(m)?m:i(t[u+1])?[]:{})}r(p,d,h),p=p[d]}return e}},function(e,t,n){"use strict";var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))},o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.driverBase=void 0;const i=o(n(52)),s=n(179),a=n(371),c=n(373),u={limitSelect:!0,rangeSelect:!0,offsetFetchRangeSyntax:!0,stringEscapeChar:"'",fallbackDataType:"nvarchar(max)",quoteIdentifier:e=>e,columnProperties:{isSparse:!1,isPersisted:!1}};t.driverBase={analyserClass:null,dumperClass:s.SqlDumper,dialect:u,databaseEngineTypes:["sql"],supportedCreateDatabase:!0,analyseFull(e,t){return r(this,void 0,void 0,(function*(){return new this.analyserClass(e,this,t).fullAnalysis()}))},analyseSingleObject(e,t,n="tables"){return r(this,void 0,void 0,(function*(){return new this.analyserClass(e,this).singleObjectAnalysis(t,n)}))},analyseSingleTable(e,t){return this.analyseSingleObject(e,t,"tables")},analyseIncremental(e,t,n){return r(this,void 0,void 0,(function*(){return new this.analyserClass(e,this,n).incrementalAnalysis(t)}))},createDumper(e=null){return new this.dumperClass(this,e)},script(e,t){return r(this,void 0,void 0,(function*(){for(const n of(0,a.splitQuery)(t,this.getQuerySplitterOptions("script")))yield this.query(e,n,{discardResult:!0})}))},getNewObjectTemplates(){return this.databaseEngineTypes.includes("sql")?[{label:"New view",sql:"CREATE VIEW myview\nAS\nSELECT * FROM table1"}]:[]},loadFieldValues(e,t,n,o){return r(this,void 0,void 0,(function*(){const r=this.createDumper(),s={commandType:"select",distinct:!0,topRecords:100,from:{name:t},columns:[{exprType:"column",columnName:n,alias:"value"}],orderBy:[{exprType:"column",columnName:n}]};if(o){const e=(0,i.default)(o.split(" ").map(e=>e.trim()));e.length>0&&(s.where={conditionType:"and",conditions:e.map(e=>({conditionType:"like",left:{exprType:"column",columnName:n},right:{exprType:"value",value:`%${e}%`}}))})}return(0,c.dumpSqlSelect)(r,s),(yield this.query(e,r.s)).rows}))},readJsonQuery(e,t,n){const r=this.createDumper();return(0,c.dumpSqlSelect)(r,t),this.readQuery(e,r.s,n)},showConnectionField:(e,t)=>!1,showConnectionTab:e=>!0}},function(e,t,n){var r=n(368),o=n(37),i=n(69),s=i&&i.isDate,a=s?o(s):r;e.exports=a},function(e,t,n){var r=n(25),o=n(15);e.exports=function(e){return o(e)&&"[object Date]"==r(e)}},function(e,t,n){var r=n(20);e.exports=function(){return r.randomBytes(16)}},function(e,t){for(var n=[],r=0;r<256;++r)n[r]=(r+256).toString(16).substr(1);e.exports=function(e,t){var r=t||0,o=n;return[o[e[r++]],o[e[r++]],o[e[r++]],o[e[r++]],"-",o[e[r++]],o[e[r++]],"-",o[e[r++]],o[e[r++]],"-",o[e[r++]],o[e[r++]],"-",o[e[r++]],o[e[r++]],o[e[r++]],o[e[r++]],o[e[r++]],o[e[r++]]].join("")}},function(e,t,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var o=Object.getOwnPropertyDescriptor(t,n);o&&("get"in o?t.__esModule:!o.writable&&!o.configurable)||(o={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,o)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),o=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||r(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),t.splitQuery=void 0;var i=n(372);Object.defineProperty(t,"splitQuery",{enumerable:!0,get:function(){return i.splitQuery}}),o(n(101),t)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.splitQuery=t.finishSplitStream=t.getInitialDelimiter=t.splitQueryLine=void 0;const r=n(101);function o(e,t){if(e.options.returnRichInfo){let{source:n,position:r,line:o,column:i,streamPosition:s}=e;for(;t>0;)"\n"==n[r]?(o+=1,i=0):i+=1,r+=1,s+=1,t-=1;e.position=r,e.streamPosition=s,e.line=o,e.column=i}else e.position+=t}function i(e,t,n,r){return r?n==r?e[t]==n&&e[t+1]!=n:e[t]==n&&e[t-1]!=r:e[t]==n}const s={type:"whitespace",length:1},a={type:"eoln",length:1},c={type:"data",length:1};function u(e){let t=e.position;const n=e.source,r=n[t];if(e.options.stringsBegins.includes(r)){t++;const o=e.options.stringsEnds[r],s=e.options.stringEscapes[r];for(;t<e.end&&!i(n,t,o,s);)o==s&&n[t]==o&&n[t+1]==o?t+=2:t++;return{type:"string",length:t-e.position+1}}if(e.currentDelimiter&&n.slice(t).startsWith(e.currentDelimiter))return{type:"delimiter",length:e.currentDelimiter.length};if(" "==r||"\t"==r||"\r"==r)return s;if("\n"==r)return a;if(e.options.doubleDashComments&&"-"==r&&"-"==n[t+1]){for(;t<e.end&&"\n"!=n[t];)t++;return{type:"comment",length:t-e.position}}if(e.options.multilineComments&&"/"==r&&"*"==n[t+1]){for(t+=2;t<e.end&&("*"!=n[t]||"/"!=n[t+1]);)t++;return{type:"comment",length:t-e.position+2}}if(e.options.allowCustomDelimiter&&!e.wasDataOnLine){const e=n.slice(t).match(/^DELIMITER[ \t]+([^\n]+)/i);if(e)return{type:"set_delimiter",value:e[1].trim(),length:e[0].length}}if(e.options.allowGoDelimiter&&!e.wasDataOnLine){const e=n.slice(t).match(/^GO[\t\r ]*(\n|$)/i);if(e)return{type:"go_delimiter",length:e[0].length-1}}const o=function(e){if(!e.options.allowDollarDollarString)return null;let t=e.position;const n=e.source,r=/^(\$[a-zA-Z0-9_]*\$)/.exec(n.slice(t));if(!r)return null;const o=r[1];for(t+=o.length;t<e.end;){if(n.slice(t).startsWith(o))return{type:"string",length:t+o.length-e.position};t++}return null}(e);return o||c}function l(e){const t=(e.commandPart||"")+e.source.slice(e.currentCommandStart,e.position),n=t.trim();n&&(e.options.returnRichInfo?e.pushOutput(f(t,{text:n,start:{position:e.commandStartPosition,line:e.commandStartLine,column:e.commandStartColumn},end:{position:e.streamPosition,line:e.line,column:e.column}})):e.pushOutput(n))}function f(e,t){const n=e.indexOf(t.text),r=Object.assign({},t.start);for(let t=0;t<n;t+=1)"\n"==e[t]?(r.position+=1,r.line+=1,r.column=0):(r.position+=1,r.column+=1);return Object.assign(Object.assign({},t),{trimStart:r,trimEnd:t.end})}function p(e){e.options.returnRichInfo&&(e.commandStartPosition=e.streamPosition,e.commandStartLine=e.line,e.commandStartColumn=e.column)}function d(e){if(e.options.splitByLines)!function(e){for(;e.position<e.end;)"\n"==e.source[e.position]?(l(e),e.commandPart="",o(e,1),e.currentCommandStart=e.position,p(e)):o(e,1);e.end>e.currentCommandStart&&(e.commandPart+=e.source.slice(e.currentCommandStart,e.position))}(e);else{for(;e.position<e.end;){const t=u(e);if(t)switch(t.type){case"string":case"comment":o(e,t.length),e.wasDataOnLine=!0;break;case"eoln":o(e,t.length),e.wasDataOnLine=!1;break;case"data":o(e,t.length),e.wasDataOnLine=!0;break;case"whitespace":o(e,t.length);break;case"set_delimiter":l(e),e.commandPart="",e.currentDelimiter=t.value,o(e,t.length),e.currentCommandStart=e.position,p(e);break;case"go_delimiter":case"delimiter":l(e),e.commandPart="",o(e,t.length),e.currentCommandStart=e.position,p(e)}else o(e,1)}e.end>e.currentCommandStart&&(e.commandPart+=e.source.slice(e.currentCommandStart,e.position))}}function h(e){return!1===(null==e?void 0:e.allowSemicolon)?null:";"}function m(e){const t=e.commandPart.trim();t&&(e.options.returnRichInfo?e.pushOutput(f(e.commandPart,{text:t,start:{position:e.commandStartPosition,line:e.commandStartLine,column:e.commandStartColumn},end:{position:e.streamPosition,line:e.line,column:e.column}})):e.pushOutput(t))}t.splitQueryLine=d,t.getInitialDelimiter=h,t.finishSplitStream=m,t.splitQuery=function(e,t=null){var n;const o=Object.assign(Object.assign({},r.defaultSplitterOptions),t);if(o.noSplit){if(o.returnRichInfo){const t=e.split("\n");return[{text:e,start:{position:0,line:0,column:0},end:{position:e.length,line:t.length,column:(null===(n=t[t.length-1])||void 0===n?void 0:n.length)||0}}]}return[e]}const i=[],s={source:e,end:e.length,currentDelimiter:h(t),position:0,column:0,line:0,currentCommandStart:0,commandStartLine:0,commandStartColumn:0,commandStartPosition:0,streamPosition:0,pushOutput:e=>i.push(e),wasDataOnLine:!1,options:o,commandPart:""};return d(s),m(s),i}},function(e,t,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),o=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||r(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),o(n(374),t),o(n(76),t),o(n(375),t),o(n(126),t),o(n(127),t),o(n(376),t),o(n(181),t)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.mergeConditions=t.scriptToSql=t.treeToSql=void 0;const r=n(76);t.treeToSql=function(e,t,n){const r=e.createDumper();return n(r,t),r.s},t.scriptToSql=function(e,t){const n=e.createDumper();for(const e of t)(0,r.dumpSqlCommand)(n,e),n.endCommand();return n.s},t.mergeConditions=function(e,t){return e?t?"and"==e.conditionType&&"and"==t.conditionType?{conditionType:"and",conditions:[...e.conditions,...t.conditions]}:"and"==e.conditionType?{conditionType:"and",conditions:[...e.conditions,t]}:"and"==t.conditionType?{conditionType:"and",conditions:[e,...t.conditions]}:{conditionType:"and",conditions:[e,t]}:e:t}},function(e,t,n){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.evaluateCondition=void 0;const o=r(n(24)),i=n(181);function s(e){return null==e||""==e.toString().trim()}function a(e,t){if(!e)return!1;if(!t)return!1;const n=new RegExp(`^${o.default.escapeRegExp(t).replace(/%/g,".*")}$`,"i");return!!e.toString().match(n)}t.evaluateCondition=function e(t,n){switch(t.conditionType){case"binary":const r=(0,i.evaluateExpression)(t.left,n),o=(0,i.evaluateExpression)(t.right,n);switch(t.operator){case"=":return r==o;case"!=":case"<>":return r!=o;case"<=":return r<=o;case">=":return r>=o;case"<":return r<o;case">":return r>o}break;case"isNull":return null==(0,i.evaluateExpression)(t.expr,n);case"isNotNull":return null!=(0,i.evaluateExpression)(t.expr,n);case"isEmpty":return s((0,i.evaluateExpression)(t.expr,n));case"isNotEmpty":return!s((0,i.evaluateExpression)(t.expr,n));case"and":return t.conditions.every(t=>e(t,n));case"or":return t.conditions.some(t=>e(t,n));case"like":return a((0,i.evaluateExpression)(t.left,n),(0,i.evaluateExpression)(t.right,n));case"notLike":return!a((0,i.evaluateExpression)(t.left,n),(0,i.evaluateExpression)(t.right,n));case"not":return!e(t.condition,n)}}},function(e,t,n){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.testPermission=t.compilePermissions=void 0;const o=r(n(378)),i=r(n(72)),s=r(n(52)),a=r(n(75));function c(e){return 0==e.length?null:new RegExp(e.map(e=>"^"+(0,o.default)(e).replace(/\\\*/g,".*")+"$").join("|"))}t.compilePermissions=function(e){if(!e)return null;e=(0,i.default)(e)?e.split(/,|;|\||\s/):(0,a.default)(e.map(e=>e.split(/,|;|\||\s/))),e=(0,s.default)(e.map(e=>e.trim()));let t=null,n=[];const r={levels:[]};for(const o of e){const e=o.startsWith("~")?"deny":"allow",i=o.startsWith("~")?o.substring(1):o;null!=t&&e!=t&&(r.levels.push({re:c(n),type:t}),n=[]),n.push(i),t=e}return n.length>0&&r.levels.push({re:c(n),type:t}),r},t.testPermission=function(e,t){let n=!0;if(!t)return!0;for(const r of t.levels)e.match(r.re)&&("allow"==r.type&&(n=!0),"deny"==r.type&&(n=!1));return n}},function(e,t,n){var r=n(40),o=/[\\^$.*+?()[\]{}|]/g,i=RegExp(o.source);e.exports=function(e){return(e=r(e))&&i.test(e)?e.replace(o,"\\$&"):e}},function(e,t,n){"use strict";var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))},o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.SqlGenerator=void 0;const i=o(n(75)),s=o(n(380)),a=n(183);t.SqlGenerator=class{constructor(e,t,n,r,o,i){this.options=t,this.objects=n,this.dmp=r,this.driver=o,this.pool=i,this.isTruncated=!1,this.isUnhandledException=!1,this.handleException=e=>{console.log("Unhandled error",e),this.isUnhandledException=!0},this.dbinfo=(0,a.extendDatabaseInfo)(e),this.tables=this.extract("tables"),this.views=this.extract("views"),this.matviews=this.extract("matviews"),this.procedures=this.extract("procedures"),this.functions=this.extract("functions"),this.triggers=this.extract("triggers")}dump(){return r(this,void 0,void 0,(function*(){try{if(process.on("uncaughtException",this.handleException),this.dropObjects(this.procedures,"Procedure"),this.checkDumper())return;if(this.dropObjects(this.functions,"Function"),this.checkDumper())return;if(this.dropObjects(this.views,"View"),this.checkDumper())return;if(this.dropObjects(this.matviews,"Matview"),this.checkDumper())return;if(this.dropObjects(this.triggers,"Trigger"),this.checkDumper())return;if(this.dropTables(),this.checkDumper())return;if(this.createTables(),this.checkDumper())return;if(this.truncateTables(),this.checkDumper())return;if(yield this.insertData(),this.checkDumper())return;if(this.createForeignKeys(),this.checkDumper())return;if(this.createObjects(this.procedures,"Procedure"),this.checkDumper())return;if(this.createObjects(this.functions,"Function"),this.checkDumper())return;if(this.createObjects(this.views,"View"),this.checkDumper())return;if(this.createObjects(this.matviews,"Matview"),this.checkDumper())return;if(this.createObjects(this.triggers,"Trigger"),this.checkDumper())return}finally{process.off("uncaughtException",this.handleException)}}))}createForeignKeys(){const e=[];this.options.createForeignKeys&&e.push(...(0,i.default)(this.tables.map(e=>e.foreignKeys||[]))),this.options.createReferences&&e.push(...(0,i.default)(this.tables.map(e=>e.dependencies||[])));for(const t of(0,s.default)(e,"constraintName"))if(this.dmp.createForeignKey(t),this.checkDumper())return}truncateTables(){if(this.options.truncate)for(const e of this.tables)if(this.dmp.truncateTable(e),this.checkDumper())return}createTables(){if(this.options.createTables)for(const e of this.tables)if(this.dmp.createTable(Object.assign(Object.assign({},e),{foreignKeys:[],dependencies:[],indexes:[]})),this.checkDumper())return;if(this.options.createIndexes)for(const e of(0,i.default)(this.tables.map(e=>e.indexes||[])))this.dmp.createIndex(e)}insertData(){return r(this,void 0,void 0,(function*(){if(this.options.insert){this.enableConstraints(!1);for(const e of this.tables)if(yield this.insertTableData(e),this.checkDumper())return;this.enableConstraints(!0)}}))}checkDumper(){return this.dmp.s.length>4e6&&(this.isTruncated||(this.dmp.putRaw("\n"),this.dmp.comment(" *************** SQL is truncated ******************"),this.dmp.putRaw("\n")),this.isTruncated=!0,!0)}dropObjects(e,t){if(this.options[`drop${t}s`])for(const n of e)if(this.dmp[`drop${t}`](n,{testIfExists:this.options[`checkIf${t}Exists`]}),this.checkDumper())return}createObjects(e,t){if(this.options[`create${t}s`])for(const n of e)if(this.dmp[`create${t}`](n),this.checkDumper())return}dropTables(){if(this.options.dropReferences)for(const e of(0,i.default)(this.tables.map(e=>e.dependencies||[])))this.dmp.dropForeignKey(e);if(this.options.dropTables)for(const e of this.tables)this.dmp.dropTable(e,{testIfExists:this.options.checkIfTableExists})}insertTableData(e){return r(this,void 0,void 0,(function*(){const t=this.driver.createDumper();t.put("^select * ^from %f",e);const n=e.columns.find(e=>e.autoIncrement);n&&!this.options.skipAutoincrementColumn&&this.dmp.allowIdentityInsert(e,!0);const r=yield this.driver.readQuery(this.pool,t.s,e);yield this.processReadable(e,r),n&&!this.options.skipAutoincrementColumn&&this.dmp.allowIdentityInsert(e,!1)}))}processReadable(e,t){const n=(this.options.skipAutoincrementColumn?e.columns.filter(e=>!e.autoIncrement):e.columns).map(e=>e.columnName);let r=!1,o=!1;return new Promise(i=>{t.on("data",s=>{if(r)return;if(!o)return void(o=!0);if(this.checkDumper())return r=!0,i(void 0),void t.destroy();const a=this.options.omitNulls?n.filter(e=>null!=s[e]):n;this.dmp.put("^insert ^into %f (%,i) ^values (%,v);&n",e,a,a.map(e=>s[e]))}),t.on("end",()=>{i(void 0)})})}extract(e){return this.dbinfo[e].filter(t=>this.objects.find(n=>t.pureName==n.pureName&&t.schemaName==n.schemaName&&n.objectTypeField==e))}enableConstraints(e){if(this.options.disableConstraints)if(this.driver.dialect.enableConstraintsPerTable)for(const t of this.tables)this.dmp.enableConstraints(t,e);else this.dmp.enableConstraints(null,e)}}},function(e,t,n){var r=n(121),o=n(182);e.exports=function(e,t){return e&&e.length?o(e,r(t,2)):[]}},function(e,t,n){var r=n(160),o=n(382),i=n(123),s=r&&1/i(new r([,-0]))[1]==1/0?function(e){return new r(e)}:o;e.exports=s},function(e,t){e.exports=function(){}},function(e,t,n){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.extractBoolSettingsValue=t.extractIntSettingsValue=void 0;const o=r(n(384)),i=r(n(124));t.extractIntSettingsValue=function(e,t,n,r=null,s=null){const a=parseInt(e[t]);return(0,o.default)(a)?n:(0,i.default)(a)?null!=r&&a<r?r:null!=s&&a>s?s:a:n},t.extractBoolSettingsValue=function(e,t,n){const r=e[t];return null==r?n:!!r}},function(e,t,n){var r=n(124);e.exports=function(e){return r(e)&&e!=+e}},function(e,t,n){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.filterName=void 0;const o=r(n(52));function i(e,t){var n=t.length,r=e.length;if(r>n)return!1;if(r===n)return e===t;e:for(var o=0,i=0;o<r;o++){for(var s=e.charCodeAt(o);i<n;)if(t.charCodeAt(i++)===s)continue e;return!1}return!0}t.filterName=function(e,...t){if(!e)return!0;const n=e.split(" ").map(e=>e.trim()),r=(0,o.default)(t);for(const e of n){const t=e.toUpperCase();if(!r.find(e=>i(t,e.toUpperCase())))return!1}return!0}},function(e,t,n){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.runAlterOperation=t.AlterPlan=void 0;const o=r(n(24)),i=n(128),s=n(387),a=n(120);function c(e,t){switch(e.operationType){case"createTable":t.createTable(e.newObject);break;case"changeColumn":t.changeColumn(e.oldObject,e.newObject);break;case"createColumn":t.createColumn(e.newObject,[]);break;case"dropColumn":t.dropColumn(e.oldObject);break;case"dropTable":t.dropTable(e.oldObject);break;case"changeConstraint":t.changeConstraint(e.oldObject,e.newObject);break;case"createConstraint":t.createConstraint(e.newObject);break;case"dropConstraint":t.dropConstraint(e.oldObject);break;case"renameColumn":t.renameColumn(e.object,e.newName);break;case"renameTable":t.renameTable(e.object,e.newName);break;case"renameConstraint":t.renameConstraint(e.object,e.newName);break;case"createSqlObject":t.createSqlObject(e.newObject);break;case"dropSqlObject":t.dropSqlObject(e.oldObject);break;case"fillPreloadedRows":t.fillPreloadedRows(e.table,e.oldRows,e.newRows,e.key,e.insertOnly);break;case"recreateTable":{const n=(0,i.generateTablePairingId)(e.table),r=o.default.cloneDeep(n),u=a.DatabaseAnalyser.createEmptyStructure();u.tables.push(r),e.operations.forEach(e=>c(e,new s.DatabaseInfoAlterProcessor(u))),t.recreateTable(n,r)}}}t.AlterPlan=class{constructor(e,t,n,r){this.wholeOldDb=e,this.wholeNewDb=t,this.dialect=n,this.opts=r,this.recreates={tables:0,constraints:0,sqlObjects:0},this.operations=[]}createTable(e){this.operations.push({operationType:"createTable",newObject:e})}dropTable(e){this.operations.push({operationType:"dropTable",oldObject:e})}createSqlObject(e){this.operations.push({operationType:"createSqlObject",newObject:e})}dropSqlObject(e){this.operations.push({operationType:"dropSqlObject",oldObject:e})}createColumn(e){this.operations.push({operationType:"createColumn",newObject:e})}changeColumn(e,t){this.operations.push({operationType:"changeColumn",oldObject:e,newObject:t})}dropColumn(e){this.operations.push({operationType:"dropColumn",oldObject:e})}createConstraint(e){this.operations.push({operationType:"createConstraint",newObject:e})}changeConstraint(e,t){this.operations.push({operationType:"changeConstraint",oldObject:e,newObject:t})}dropConstraint(e){this.operations.push({operationType:"dropConstraint",oldObject:e})}renameTable(e,t){this.operations.push({operationType:"renameTable",object:e,newName:t})}renameColumn(e,t){this.operations.push({operationType:"renameColumn",object:e,newName:t})}renameConstraint(e,t){this.operations.push({operationType:"renameConstraint",object:e,newName:t})}recreateTable(e,t){this.operations.push({operationType:"recreateTable",table:e,operations:t}),this.recreates.tables+=1}fillPreloadedRows(e,t,n,r,o){this.operations.push({operationType:"fillPreloadedRows",table:e,oldRows:t,newRows:n,key:r,insertOnly:o})}run(e){for(const t of this.operations)c(t,e)}_getDependendColumnConstraints(e,t){const n=this.wholeOldDb.tables.find(t=>t.pureName==e.pureName&&t.schemaName==e.schemaName);return n?[...(null==t?void 0:t.includes("dependencies"))?n.dependencies.filter(t=>t.columns.find(t=>t.refColumnName==e.columnName)):[],...o.default.compact([(null==t?void 0:t.includes("primaryKey"))?n.primaryKey:null,...(null==t?void 0:t.includes("foreignKeys"))?n.foreignKeys:[],...(null==t?void 0:t.includes("indexes"))?n.indexes:[],...(null==t?void 0:t.includes("uniques"))?n.uniques:[]]).filter(t=>t.columns.find(t=>t.columnName==e.columnName))]:[]}_addLogicalDependencies(){const e=this.operations.map(e=>{if("dropColumn"==e.operationType){const t=this._getDependendColumnConstraints(e.oldObject,this.dialect.dropColumnDependencies);return t.length>0&&this.opts.noDropConstraint?[]:[...t.map(e=>({operationType:"dropConstraint",oldObject:e})),e]}if("changeColumn"==e.operationType){const t=this._getDependendColumnConstraints(e.oldObject,this.dialect.changeColumnDependencies);if(t.length>0&&this.opts.noDropConstraint)return[];const n=[...t.map(e=>({operationType:"dropConstraint",oldObject:e})),e,...o.default.reverse([...t]).map(e=>({operationType:"createConstraint",newObject:e}))];return t.length>0&&(this.recreates.constraints+=1),n}if("dropTable"==e.operationType)return[...this.dialect.dropReferencesWhenDropTable?(e.oldObject.dependencies||[]).map(e=>({operationType:"dropConstraint",oldObject:e})):[],e];if("changeConstraint"==e.operationType){if(this.opts.noDropConstraint)return[];return this.recreates.constraints+=1,[{operationType:"dropConstraint",oldObject:e.oldObject},{operationType:"createConstraint",newObject:e.newObject}]}return[e]});return o.default.flatten(e)}_transformToImplementedOps(){const e=this.operations.map(e=>this._testTableRecreate(e,"createColumn",this.dialect.createColumn,"newObject")||this._testTableRecreate(e,"dropColumn",this.dialect.dropColumn,"oldObject")||this._testTableRecreate(e,"createConstraint",e=>this._canCreateConstraint(e),"newObject")||this._testTableRecreate(e,"dropConstraint",e=>this._canDropConstraint(e),"oldObject")||this._testTableRecreate(e,"changeColumn",this.dialect.changeColumn,"newObject")||[e]);return o.default.flatten(e)}_canCreateConstraint(e){return"primaryKey"==e.constraintType?this.dialect.createPrimaryKey:"foreignKey"==e.constraintType?this.dialect.createForeignKey:"index"==e.constraintType?this.dialect.createIndex:"unique"==e.constraintType?this.dialect.createUnique:"check"==e.constraintType?this.dialect.createCheck:null}_canDropConstraint(e){return"primaryKey"==e.constraintType?this.dialect.dropPrimaryKey:"foreignKey"==e.constraintType?this.dialect.dropForeignKey:"index"==e.constraintType?this.dialect.dropIndex:"unique"==e.constraintType?this.dialect.dropUnique:"check"==e.constraintType?this.dialect.dropCheck:null}_testTableRecreate(e,t,n,r){if(e.operationType==t){if(o.default.isFunction(n)){if(n(e[r]))return null}else if(n)return null;if(this.opts.noDropTable)return[];const t=this.wholeNewDb.tables.find(t=>t.pureName==e[r].pureName&&t.schemaName==e[r].schemaName);return this.recreates.tables+=1,[{operationType:"recreateTable",table:t,operations:[e]}]}return null}_groupTableRecreations(){const e=[],t={};for(const n of this.operations)if("recreateTable"==n.operationType&&n.table){const r=t[`${n.table.schemaName}||${n.table.pureName}`];if(r)r.operations.push(...n.operations);else{const r=Object.assign(Object.assign({},n),{operations:[...n.operations]});e.push(r),t[`${n.table.schemaName}||${n.table.pureName}`]=r}}else{const r=n.oldObject;if(r){const e=t[`${r.schemaName}||${r.pureName}`];if(e){e.operations.push(n);continue}}e.push(n)}return e}_moveForeignKeysToLast(){if(!this.dialect.createForeignKey)return this.operations;const e=[];return[...this.operations.map(t=>"createTable"==t.operationType?(e.push(...t.newObject.foreignKeys||[]),Object.assign(Object.assign({},t),{newObject:Object.assign(Object.assign({},t.newObject),{foreignKeys:[]})})):t),...e.map(e=>({operationType:"createConstraint",newObject:e}))]}_filterAllowedOperations(){return this.operations.filter(e=>(!this.opts.noDropColumn||"dropColumn"!=e.operationType)&&((!this.opts.noDropTable||"dropTable"!=e.operationType)&&((!this.opts.noDropTable||"recreateTable"!=e.operationType)&&((!this.opts.noDropConstraint||"dropConstraint"!=e.operationType)&&(!this.opts.noDropSqlObject||"dropSqlObject"!=e.operationType)))))}transformPlan(){this.operations=this._addLogicalDependencies(),this.operations=this._transformToImplementedOps(),this.operations=this._groupTableRecreations(),this.operations=this._moveForeignKeysToLast(),this.operations=this._filterAllowedOperations()}},t.runAlterOperation=c},function(e,t,n){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.DatabaseInfoAlterProcessor=void 0;const o=r(n(24));t.DatabaseInfoAlterProcessor=class{constructor(e){this.db=e}createTable(e){this.db.tables.push(e)}dropTable(e){o.default.remove(this.db.tables,t=>t.pureName==e.pureName&&t.schemaName==e.schemaName)}createSqlObject(e){this.db[e.objectTypeField].push(e)}dropSqlObject(e){o.default.remove(this.db[e.objectTypeField],t=>t.pureName==e.pureName&&t.schemaName==e.schemaName)}createColumn(e){const t=this.db.tables.find(t=>t.pureName==e.pureName&&t.schemaName==e.schemaName);if(!t)throw new Error(`createColumn error, cannot find table: ${e.schemaName}.${e.pureName}`);t.columns.push(e)}changeColumn(e,t){const n=this.db.tables.find(t=>t.pureName==e.pureName&&t.schemaName==e.schemaName);if(!n)throw new Error(`changeColumn error, cannot find table: ${e.schemaName}.${e.pureName}`);n.columns=n.columns.map(n=>n.columnName==e.columnName?t:n)}dropColumn(e){const t=this.db.tables.find(t=>t.pureName==e.pureName&&t.schemaName==e.schemaName);if(!t)throw new Error(`dropColumn error, cannot find table: ${e.schemaName}.${e.pureName}`);o.default.remove(t.columns,t=>t.columnName==e.columnName)}createConstraint(e){const t=this.db.tables.find(t=>t.pureName==e.pureName&&t.schemaName==e.schemaName);switch(e.constraintType){case"primaryKey":t.primaryKey=e;break;case"foreignKey":t.foreignKeys.push(e);break;case"index":t.indexes.push(e);break;case"unique":t.uniques.push(e);break;case"check":t.checks.push(e)}}changeConstraint(e,t){this.db.tables.find(t=>t.pureName==e.pureName&&t.schemaName==e.schemaName)}dropConstraint(e){const t=this.db.tables.find(t=>t.pureName==e.pureName&&t.schemaName==e.schemaName);switch(e.constraintType){case"primaryKey":t.primaryKey=null;break;case"foreignKey":t.foreignKeys=t.foreignKeys.filter(t=>t.constraintName!=e.constraintName);break;case"index":t.indexes=t.indexes.filter(t=>t.constraintName!=e.constraintName);break;case"unique":t.uniques=t.uniques.filter(t=>t.constraintName!=e.constraintName);break;case"check":t.checks=t.checks.filter(t=>t.constraintName!=e.constraintName)}}renameTable(e,t){this.db.tables.find(t=>t.pureName==e.pureName&&t.schemaName==e.schemaName).pureName=t}renameColumn(e,t){this.db.tables.find(t=>t.pureName==e.pureName&&t.schemaName==e.schemaName).columns.find(t=>t.columnName==e.columnName).columnName=t}renameConstraint(e,t){}recreateTable(e,t){throw new Error("recreateTable not implemented for DatabaseInfoAlterProcessor")}fillPreloadedRows(e,t,n,r,o){const i=this.db.tables.find(t=>t.pureName==e.pureName&&t.schemaName==e.schemaName);i.preloadedRows=n,i.preloadedRowsKey=r,i.preloadedRowsInsertOnly=o}}},function(e,t,n){var r="undefined"!=typeof JSON?JSON:n(389);e.exports=function(e,t){t||(t={}),"function"==typeof t&&(t={cmp:t});var n=t.space||"";"number"==typeof n&&(n=Array(n+1).join(" "));var s,a="boolean"==typeof t.cycles&&t.cycles,c=t.replacer||function(e,t){return t},u=t.cmp&&(s=t.cmp,function(e){return function(t,n){var r={key:t,value:e[t]},o={key:n,value:e[n]};return s(r,o)}}),l=[];return function e(t,s,f,p){var d=n?"\n"+new Array(p+1).join(n):"",h=n?": ":":";if(f&&f.toJSON&&"function"==typeof f.toJSON&&(f=f.toJSON()),void 0!==(f=c.call(t,s,f))){if("object"!=typeof f||null===f)return r.stringify(f);if(o(f)){for(var m=[],g=0;g<f.length;g++){var y=e(f,g,f[g],p+1)||r.stringify(null);m.push(d+n+y)}return"["+m.join(",")+d+"]"}if(-1!==l.indexOf(f)){if(a)return r.stringify("__cycle__");throw new TypeError("Converting circular structure to JSON")}l.push(f);var b=i(f).sort(u&&u(f));for(m=[],g=0;g<b.length;g++){var v=e(f,s=b[g],f[s],p+1);if(v){var S=r.stringify(s)+h+v;m.push(d+n+S)}}return l.splice(l.indexOf(f),1),"{"+m.join(",")+d+"}"}}({"":e},"",e,0)};var o=Array.isArray||function(e){return"[object Array]"==={}.toString.call(e)},i=Object.keys||function(e){var t=Object.prototype.hasOwnProperty||function(){return!0},n=[];for(var r in e)t.call(e,r)&&n.push(r);return n}},function(e,t,n){t.parse=n(390),t.stringify=n(391)},function(e,t){var n,r,o,i,s={'"':'"',"\\":"\\","/":"/",b:"\b",f:"\f",n:"\n",r:"\r",t:"\t"},a=function(e){throw{name:"SyntaxError",message:e,at:n,text:o}},c=function(e){return e&&e!==r&&a("Expected '"+e+"' instead of '"+r+"'"),r=o.charAt(n),n+=1,r},u=function(){var e,t="";for("-"===r&&(t="-",c("-"));r>="0"&&r<="9";)t+=r,c();if("."===r)for(t+=".";c()&&r>="0"&&r<="9";)t+=r;if("e"===r||"E"===r)for(t+=r,c(),"-"!==r&&"+"!==r||(t+=r,c());r>="0"&&r<="9";)t+=r,c();if(e=+t,isFinite(e))return e;a("Bad number")},l=function(){var e,t,n,o="";if('"'===r)for(;c();){if('"'===r)return c(),o;if("\\"===r)if(c(),"u"===r){for(n=0,t=0;t<4&&(e=parseInt(c(),16),isFinite(e));t+=1)n=16*n+e;o+=String.fromCharCode(n)}else{if("string"!=typeof s[r])break;o+=s[r]}else o+=r}a("Bad string")},f=function(){for(;r&&r<=" ";)c()};i=function(){switch(f(),r){case"{":return function(){var e,t={};if("{"===r){if(c("{"),f(),"}"===r)return c("}"),t;for(;r;){if(e=l(),f(),c(":"),Object.hasOwnProperty.call(t,e)&&a('Duplicate key "'+e+'"'),t[e]=i(),f(),"}"===r)return c("}"),t;c(","),f()}}a("Bad object")}();case"[":return function(){var e=[];if("["===r){if(c("["),f(),"]"===r)return c("]"),e;for(;r;){if(e.push(i()),f(),"]"===r)return c("]"),e;c(","),f()}}a("Bad array")}();case'"':return l();case"-":return u();default:return r>="0"&&r<="9"?u():function(){switch(r){case"t":return c("t"),c("r"),c("u"),c("e"),!0;case"f":return c("f"),c("a"),c("l"),c("s"),c("e"),!1;case"n":return c("n"),c("u"),c("l"),c("l"),null}a("Unexpected '"+r+"'")}()}},e.exports=function(e,t){var s;return o=e,n=0,r=" ",s=i(),f(),r&&a("Syntax error"),"function"==typeof t?function e(n,r){var o,i,s=n[r];if(s&&"object"==typeof s)for(o in s)Object.prototype.hasOwnProperty.call(s,o)&&(void 0!==(i=e(s,o))?s[o]=i:delete s[o]);return t.call(n,r,s)}({"":s},""):s}},function(e,t){var n,r,o,i=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,s={"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"};function a(e){return i.lastIndex=0,i.test(e)?'"'+e.replace(i,(function(e){var t=s[e];return"string"==typeof t?t:"\\u"+("0000"+e.charCodeAt(0).toString(16)).slice(-4)}))+'"':'"'+e+'"'}e.exports=function(e,t,i){var s;if(n="",r="","number"==typeof i)for(s=0;s<i;s+=1)r+=" ";else"string"==typeof i&&(r=i);if(o=t,t&&"function"!=typeof t&&("object"!=typeof t||"number"!=typeof t.length))throw new Error("JSON.stringify");return function e(t,i){var s,c,u,l,f,p=n,d=i[t];switch(d&&"object"==typeof d&&"function"==typeof d.toJSON&&(d=d.toJSON(t)),"function"==typeof o&&(d=o.call(i,t,d)),typeof d){case"string":return a(d);case"number":return isFinite(d)?String(d):"null";case"boolean":case"null":return String(d);case"object":if(!d)return"null";if(n+=r,f=[],"[object Array]"===Object.prototype.toString.apply(d)){for(l=d.length,s=0;s<l;s+=1)f[s]=e(s,d)||"null";return u=0===f.length?"[]":n?"[\n"+n+f.join(",\n"+n)+"\n"+p+"]":"["+f.join(",")+"]",n=p,u}if(o&&"object"==typeof o)for(l=o.length,s=0;s<l;s+=1)"string"==typeof(c=o[s])&&(u=e(c,d))&&f.push(a(c)+(n?": ":":")+u);else for(c in d)Object.prototype.hasOwnProperty.call(d,c)&&(u=e(c,d))&&f.push(a(c)+(n?": ":":")+u);return u=0===f.length?"{}":n?"{\n"+n+f.join(",\n"+n)+"\n"+p+"}":"{"+f.join(",")+"}",n=p,u}}("",{"":e})}},function(e,t,n){var r=n(39),o=n(393),i=n(394),s=n(41);e.exports=function(e,t){return t=r(t,e),null==(e=i(e,t))||delete e[s(o(t))]}},function(e,t){e.exports=function(e){var t=null==e?0:e.length;return t?e[t-1]:void 0}},function(e,t,n){var r=n(50),o=n(164);e.exports=function(e,t){return t.length<2?e:r(e,o(t,0,-1))}},function(e,t,n){var r=n(73);e.exports=function(e){return r(e)?void 0:e}},function(e,t,n){var r=n(122);e.exports=function(e,t){return r(e,t)}},function(e,t,n){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.editorDeleteConstraint=t.editorModifyConstraint=t.editorAddConstraint=t.editorDeleteColumn=t.editorModifyColumn=t.editorAddColumn=t.fillEditorColumnInfo=void 0;const o=r(n(125)),i=r(n(184)),s=r(n(24));function a(e,t){var n,r;return Object.assign({isPrimaryKey:!!(null===(r=null===(n=null==t?void 0:t.primaryKey)||void 0===n?void 0:n.columns)||void 0===r?void 0:r.find(t=>t.columnName==e.columnName)),dataType:s.default.isEmpty(e)?"int":void 0},e)}function c(e,t,n){if(!(null==t?void 0:t.isPrimaryKey)&&(null==n?void 0:n.isPrimaryKey)){let t=null==e?void 0:e.primaryKey;return t||(t={constraintType:"primaryKey",pureName:e.pureName,schemaName:e.schemaName,columns:[]}),Object.assign(Object.assign({},e),{primaryKey:Object.assign(Object.assign({},t),{columns:[...t.columns,{columnName:n.columnName}]})})}if((null==t?void 0:t.isPrimaryKey)&&!(null==n?void 0:n.isPrimaryKey)){let n=null==e?void 0:e.primaryKey;if(n)return n=Object.assign(Object.assign({},n),{columns:e.primaryKey.columns.filter(e=>e.columnName!=t.columnName)}),0==n.columns.length?Object.assign(Object.assign({},e),{primaryKey:null}):Object.assign(Object.assign({},e),{primaryKey:n})}return e}t.fillEditorColumnInfo=a,t.editorAddColumn=function(e,t){let n=Object.assign(Object.assign({},e),{columns:[...(null==e?void 0:e.columns)||[],Object.assign(Object.assign({},t),{pairingId:(0,o.default)()})]});return n=c(n,null,t),n},t.editorModifyColumn=function(e,t){var n;const r=null===(n=null==e?void 0:e.columns)||void 0===n?void 0:n.find(e=>e.pairingId==t.pairingId);let o=Object.assign(Object.assign({},e),{columns:e.columns.map(e=>e.pairingId==t.pairingId?(0,i.default)(t,["isPrimaryKey"]):e)});return o=c(o,a(r,e),t),o},t.editorDeleteColumn=function(e,t){let n=Object.assign(Object.assign({},e),{columns:e.columns.filter(e=>e.pairingId!=t.pairingId)});return n=c(n,t,null),n},t.editorAddConstraint=function(e,t){const n=Object.assign({},e);return"primaryKey"==t.constraintType&&(n.primaryKey=Object.assign({pairingId:(0,o.default)()},t)),"foreignKey"==t.constraintType&&(n.foreignKeys=[...n.foreignKeys||[],Object.assign({pairingId:(0,o.default)()},t)]),"index"==t.constraintType&&(n.indexes=[...n.indexes||[],Object.assign({pairingId:(0,o.default)()},t)]),"unique"==t.constraintType&&(n.uniques=[...n.uniques||[],Object.assign({pairingId:(0,o.default)()},t)]),n},t.editorModifyConstraint=function(e,t){const n=Object.assign({},e);return"primaryKey"==t.constraintType&&(n.primaryKey=Object.assign(Object.assign({},n.primaryKey),t)),"foreignKey"==t.constraintType&&(n.foreignKeys=e.foreignKeys.map(e=>e.pairingId==t.pairingId?Object.assign(Object.assign({},e),t):e)),"index"==t.constraintType&&(n.indexes=e.indexes.map(e=>e.pairingId==t.pairingId?Object.assign(Object.assign({},e),t):e)),"unique"==t.constraintType&&(n.uniques=e.uniques.map(e=>e.pairingId==t.pairingId?Object.assign(Object.assign({},e),t):e)),n},t.editorDeleteConstraint=function(e,t){const n=Object.assign({},e);return"primaryKey"==t.constraintType&&(n.primaryKey=null),"foreignKey"==t.constraintType&&(n.foreignKeys=e.foreignKeys.filter(e=>e.pairingId!=t.pairingId)),"index"==t.constraintType&&(n.indexes=e.indexes.filter(e=>e.pairingId!=t.pairingId)),"unique"==t.constraintType&&(n.uniques=e.uniques.filter(e=>e.pairingId!=t.pairingId)),n}},function(e,t,n){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.databaseInfoFromYamlModel=t.tableInfoFromYaml=t.tableInfoToYaml=void 0;const o=r(n(102)),i=r(n(52)),s=n(120);function a(e,t){const n={pureName:e.name,columns:e.columns.map(t=>function(e,t){return{pureName:t.name,columnName:e.name,dataType:e.length?`${e.type}(${e.length})`:e.type,autoIncrement:e.autoIncrement,notNull:e.notNull||t.primaryKey&&t.primaryKey.includes(e.name),defaultValue:e.default}}(t,e)),foreignKeys:(0,i.default)(e.columns.filter(e=>e.references).map(n=>function(e,t,n){const r=n.find(t=>t.name==e.references);return r&&r.primaryKey?{constraintType:"foreignKey",pureName:t.name,refTableName:e.references,columns:[{columnName:e.name,refColumnName:r.primaryKey[0]}]}:null}(n,e,t)))};return e.primaryKey&&(n.primaryKey={pureName:e.name,constraintType:"primaryKey",columns:e.primaryKey.map(e=>({columnName:e}))}),n.preloadedRows=e.data,n.preloadedRowsKey=e.insertKey,n.preloadedRowsInsertOnly=e.insertOnly,n}t.tableInfoToYaml=function(e){const t=(0,o.default)(e),n={name:t.pureName,columns:t.columns.map(e=>function(e,t){const n={name:e.columnName,type:e.dataType,default:e.defaultValue};e.autoIncrement&&(n.autoIncrement=!0),e.notNull&&(n.notNull=!0);const r=t.foreignKeys&&t.foreignKeys.find(t=>1==t.columns.length&&t.columns[0].columnName==e.columnName);return!r||r.deleteAction&&"NO ACTION"!=r.deleteAction||r.updateAction&&"NO ACTION"!=r.updateAction||(n.references=r.refTableName,r._dumped=!0),n}(e,t))};return t.primaryKey&&!t.primaryKey._dumped&&(n.primaryKey=t.primaryKey.columns.map(e=>e.columnName)),n},t.tableInfoFromYaml=a,t.databaseInfoFromYamlModel=function(e){const t=s.DatabaseAnalyser.createEmptyStructure(),n=[];for(const r of e)(r.name.endsWith(".table.yaml")||r.name.endsWith(".sql"))&&(r.name.endsWith(".table.yaml")&&n.push(r.json),r.name.endsWith(".view.sql")&&t.views.push({pureName:r.name.slice(0,-".view.sql".length),createSql:r.text,columns:[]}),r.name.endsWith(".matview.sql")&&t.matviews.push({pureName:r.name.slice(0,-".matview.sql".length),createSql:r.text,columns:[]}),r.name.endsWith(".proc.sql")&&t.procedures.push({pureName:r.name.slice(0,-".proc.sql".length),createSql:r.text}),r.name.endsWith(".func.sql")&&t.functions.push({pureName:r.name.slice(0,-".func.sql".length),createSql:r.text}),r.name.endsWith(".trigger.sql")&&t.triggers.push({pureName:r.name.slice(0,-".trigger.sql".length),createSql:r.text}));return t.tables=n.map(e=>a(e,n)),t}},function(e,t,n){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.isWktGeometry=t.getIconForRedisType=t.isJsonLikeLongString=t.safeJsonParse=t.stringifyCellValue=t.parseCellValue=t.hexStringToArray=t.arrayToHexString=void 0;const o=r(n(72)),i=r(n(12)),s=r(n(73));function a(e){return e.reduce((e,t)=>e+("0"+t.toString(16)).slice(-2),"").toUpperCase()}function c(e){for(var t=e.toString(),n=[],r=0;r<t.length;r+=2)n.push(parseInt(t.substr(r,2),16));return n}t.arrayToHexString=a,t.hexStringToArray=c,t.parseCellValue=function(e){if(!(0,o.default)(e))return e;if("(NULL)"==e)return null;if(e.match(/^0x([0-9a-fA-F][0-9a-fA-F])+$/))return{type:"Buffer",data:c(e.substring(2))};const t=e.match(/^ObjectId\("([0-9a-f]{24})"\)$/);return t?{$oid:t[1]}:e},t.stringifyCellValue=function(e){return null===e?"(NULL)":void 0===e?"(NoField)":"Buffer"==(null==e?void 0:e.type)&&(0,i.default)(e.data)?"0x"+a(e.data):(null==e?void 0:e.$oid)?`ObjectId("${null==e?void 0:e.$oid}")`:(0,s.default)(e)||(0,i.default)(e)?JSON.stringify(e):e},t.safeJsonParse=function(e,t,n=!1){try{return JSON.parse(e)}catch(r){return n&&console.error(`Error parsing JSON value "${e}"`,r),t}},t.isJsonLikeLongString=function(e){return(0,o.default)(e)&&e.length>100&&e.match(/^\s*\{.*\}\s*$|^\s*\[.*\]\s*$/)},t.getIconForRedisType=function(e){switch(e){case"dir":return"img folder";case"string":return"img type-string";case"hash":return"img type-hash";case"set":return"img type-set";case"list":return"img type-list";case"zset":return"img type-zset";case"stream":return"img type-stream";case"binary":return"img type-binary";case"ReJSON-RL":return"img type-rejson";default:return null}},t.isWktGeometry=function(e){return!!(0,o.default)(e)&&!!e.match(/^POINT\s*\(|^LINESTRING\s*\(|^POLYGON\s*\(|^MULTIPOINT\s*\(|^MULTILINESTRING\s*\(|^MULTIPOLYGON\s*\(|^GEOMCOLLECTION\s*\(|^GEOMETRYCOLLECTION\s*\(/)}},function(e,t,n){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.getCreateObjectScript=t.computeTableDiffColumns=t.computeDbDiffRows=t.DbDiffCompareDefs=t.computeDiffRowsCore=void 0;const o=n(128),i=r(n(24));function s(e,t,n){const r=[];for(const o of e){const e=t.find(e=>e.pairingId==o.pairingId);if(e){const t=n(o,e);r.push({source:o,target:e,state:t?"equal":"changed",__isChanged:!t})}else r.push({source:o,state:"added",__isAdded:!0})}for(const n of t){e.find(e=>e.pairingId==n.pairingId)||r.push({target:n,state:"removed",__isDeleted:!0})}return r}t.computeDiffRowsCore=s,t.DbDiffCompareDefs={tables:{test:o.testEqualTables,name:"Table",plural:"Tables",icon:"img table"},views:{test:o.testEqualSqlObjects,name:"View",plural:"Views",icon:"img view"},matviews:{test:o.testEqualSqlObjects,name:"Materialized view",plural:"Materialized views",icon:"img view"},procedures:{test:o.testEqualSqlObjects,name:"Procedure",plural:"Procedures",icon:"img procedure"},functions:{test:o.testEqualSqlObjects,name:"Function",plural:"Functions",icon:"img function"}},t.computeDbDiffRows=function(e,n,r,o){if(!e||!n||!o)return[];const a=[];for(const c of["tables","views","procedures","matviews","functions"]){const u=t.DbDiffCompareDefs[c];a.push(...i.default.sortBy(s(e[c],n[c],(t,i)=>u.test(t,i,r,e,n,o)).map(e=>{var t,n,r,o,i,s,a,l;return Object.assign(Object.assign({},e),{sourceSchemaName:null===(t=null==e?void 0:e.source)||void 0===t?void 0:t.schemaName,sourcePureName:null===(n=null==e?void 0:e.source)||void 0===n?void 0:n.pureName,targetSchemaName:null===(r=null==e?void 0:e.target)||void 0===r?void 0:r.schemaName,targetPureName:null===(o=null==e?void 0:e.target)||void 0===o?void 0:o.pureName,typeName:u.name,typeIcon:u.icon,identifier:`${(null===(i=null==e?void 0:e.source)||void 0===i?void 0:i.schemaName)||(null===(s=null==e?void 0:e.target)||void 0===s?void 0:s.schemaName)}.${(null===(a=null==e?void 0:e.source)||void 0===a?void 0:a.pureName)||(null===(l=null==e?void 0:e.target)||void 0===l?void 0:l.pureName)}`,objectTypeField:c})}),"identifier"))}return a},t.computeTableDiffColumns=function(e,t,n,r){return r?s((null==e?void 0:e.columns)||[],(null==t?void 0:t.columns)||[],(e,t)=>(0,o.testEqualColumns)(e,t,!0,!0,n)).map(e=>{var t,n,r,o,i,s;return Object.assign(Object.assign({},e),{sourceColumnName:null===(t=null==e?void 0:e.source)||void 0===t?void 0:t.columnName,targetColumnName:null===(n=null==e?void 0:e.target)||void 0===n?void 0:n.columnName,sourceDataType:null===(r=null==e?void 0:e.source)||void 0===r?void 0:r.dataType,targetDataType:null===(o=null==e?void 0:e.target)||void 0===o?void 0:o.dataType,sourceNotNull:null===(i=null==e?void 0:e.source)||void 0===i?void 0:i.notNull,targetNotNull:null===(s=null==e?void 0:e.target)||void 0===s?void 0:s.notNull})}):[]},t.getCreateObjectScript=function(e,t){if(!e||!t)return"";if("tables"==e.objectTypeField){const n=t.createDumper();return n.createTable(e),n.s}return e.createSql||""}},function(e,t,n){"use strict";var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))},o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.enrichWithPreloadedRows=void 0;const i=o(n(24));t.enrichWithPreloadedRows=function(e,t,n,o){var s,a,c;return r(this,void 0,void 0,(function*(){const r={};for(const i of t.tables){const t=e.tables.find(e=>e.pairingId==i.pairingId);if(0==((null===(s=null==t?void 0:t.preloadedRows)||void 0===s?void 0:s.length)||0))continue;const u=t.preloadedRowsKey||(null===(c=null===(a=t.primaryKey)||void 0===a?void 0:a.columns)||void 0===c?void 0:c.map(e=>e.columnName));if(0==((null==u?void 0:u.length)||0))continue;const l=o.createDumper();1==u.length?l.putCmd("^select * ^from %f ^where %i ^in (%,v)",i,u[0],t.preloadedRows.map(e=>e[u[0]])):(l.put("^select * ^from %f ^where",i),l.putCollection(" ^or ",t.preloadedRows,e=>{l.put("("),l.putCollection(" ^and ",u,t=>l.put("%i=%v",t,e[t])),l.put(")")}),l.endCommand());const f=yield o.query(n,l.s);r[i.pairingId]=Object.assign(Object.assign({},i),{preloadedRows:f.rows,preloadedRowsKey:u})}return i.default.isEmpty(r)?t:Object.assign(Object.assign({},t),{tables:t.tables.map(e=>r[e.pairingId]||e)})}))}},function(e,t,n){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.jsonScriptToJavascript=t.ScriptWriterJson=t.ScriptWriter=void 0;const o=r(n(403)),i=n(163);class s{constructor(e="0"){this.s="",this.packageNames=[],this.varCount=0,this.varCount=parseInt(e)||0}allocVariable(e="var"){return this.varCount+=1,`${e}${this.varCount}`}_put(e=""){this.s+=e,this.s+="\n"}endLine(){this._put()}assignCore(e,t,n){this._put(`const ${e} = await ${t}(${JSON.stringify(n)});`)}assign(e,t,n){this.assignCore(e,(0,i.extractShellApiFunctionName)(t),n),this.packageNames.push(...(0,i.extractShellApiPlugins)(t,n))}assignValue(e,t){this._put(`const ${e} = ${JSON.stringify(t)};`)}requirePackage(e){this.packageNames.push(e)}copyStream(e,t,n=null){n?this._put(`await dbgateApi.copyStream(${e}, ${t}, {columns: ${n}});`):this._put(`await dbgateApi.copyStream(${e}, ${t});`)}dumpDatabase(e){this._put(`await dbgateApi.dumpDatabase(${JSON.stringify(e)});`)}importDatabase(e){this._put(`await dbgateApi.importDatabase(${JSON.stringify(e)});`)}comment(e){this._put(`// ${e}`)}getScript(e=null){const t=this.packageNames;let n=(0,o.default)(t).map(e=>`// @require ${e}\n`).join("");return e&&(n+=`// @schedule ${e}`),n&&(n+="\n"),n+this.s}}t.ScriptWriter=s;t.ScriptWriterJson=class{constructor(e="0"){this.s="",this.packageNames=[],this.varCount=0,this.commands=[],this.varCount=parseInt(e)||0}allocVariable(e="var"){return this.varCount+=1,`${e}${this.varCount}`}endLine(){this.commands.push({type:"endline"})}assign(e,t,n){this.commands.push({type:"assign",variableName:e,functionName:(0,i.extractShellApiFunctionName)(t),props:n}),this.packageNames.push(...(0,i.extractShellApiPlugins)(t,n))}assignValue(e,t){this.commands.push({type:"assignValue",variableName:e,jsonValue:t})}copyStream(e,t,n=null){this.commands.push({type:"copyStream",sourceVar:e,targetVar:t,colmapVar:n})}comment(e){this.commands.push({type:"comment",text:e})}dumpDatabase(e){this.commands.push({type:"dumpDatabase",options:e})}importDatabase(e){this.commands.push({type:"importDatabase",options:e})}getScript(e=null){return{type:"json",schedule:e,commands:this.commands,packageNames:this.packageNames}}},t.jsonScriptToJavascript=function(e){const{schedule:t,commands:n,packageNames:r}=e,o=new s;for(const e of r){if(!/^dbgate-plugin-.*$/.test(e))throw new Error("Unallowed package name:"+e);o.packageNames.push(e)}for(const e of n)switch(e.type){case"assign":o.assignCore(e.variableName,e.functionName,e.props);break;case"assignValue":o.assignValue(e.variableName,e.jsonValue);break;case"copyStream":o.copyStream(e.sourceVar,e.targetVar,e.colmapVar);break;case"endLine":o.endLine();break;case"comment":o.comment(e.text);break;case"dumpDatabase":o.dumpDatabase(e.options);break;case"importDatabase":o.importDatabase(e.options)}return o.getScript(t)}},function(e,t,n){var r=n(182);e.exports=function(e){return e&&e.length?r(e):[]}},function(e,t,n){"use strict";var r=n(129),o=n(43),i=n(77),s=n(78),a=n(79),c=n(80),u=n(81),l=n(130),f=n(82),p=n(83),d=n(84),h=n(85),m=n(86),g=n(53),y=n(405),b=n(406),v=n(408),S=n(32),w=S.allocBuffer(17825792),_=function(){};_.prototype.serialize=function(e,t){var n="boolean"==typeof(t=t||{}).checkKeys&&t.checkKeys,r="boolean"==typeof t.serializeFunctions&&t.serializeFunctions,o="boolean"!=typeof t.ignoreUndefined||t.ignoreUndefined,i="number"==typeof t.minInternalBufferSize?t.minInternalBufferSize:17825792;w.length<i&&(w=S.allocBuffer(i));var s=b(w,e,n,0,0,r,o,[]),a=S.allocBuffer(s);return w.copy(a,0,0,a.length),a},_.prototype.serializeWithBufferAndIndex=function(e,t,n){var r="boolean"==typeof(n=n||{}).checkKeys&&n.checkKeys,o="boolean"==typeof n.serializeFunctions&&n.serializeFunctions,i="boolean"!=typeof n.ignoreUndefined||n.ignoreUndefined,s="number"==typeof n.index?n.index:0;return b(t,e,r,s||0,0,o,i)-1},_.prototype.deserialize=function(e,t){return y(e,t)},_.prototype.calculateObjectSize=function(e,t){var n="boolean"==typeof(t=t||{}).serializeFunctions&&t.serializeFunctions,r="boolean"!=typeof t.ignoreUndefined||t.ignoreUndefined;return v(e,n,r)},_.prototype.deserializeStream=function(e,t,n,r,o,i){i=null!=i?i:{};for(var s=t,a=0;a<n;a++){var c=e[s]|e[s+1]<<8|e[s+2]<<16|e[s+3]<<24;i.index=s,r[o+a]=this.deserialize(e,i),s+=c}return s},_.BSON_INT32_MAX=2147483647,_.BSON_INT32_MIN=-2147483648,_.BSON_INT64_MAX=Math.pow(2,63)-1,_.BSON_INT64_MIN=-Math.pow(2,63),_.JS_INT_MAX=9007199254740992,_.JS_INT_MIN=-9007199254740992,_.BSON_DATA_NUMBER=1,_.BSON_DATA_STRING=2,_.BSON_DATA_OBJECT=3,_.BSON_DATA_ARRAY=4,_.BSON_DATA_BINARY=5,_.BSON_DATA_OID=7,_.BSON_DATA_BOOLEAN=8,_.BSON_DATA_DATE=9,_.BSON_DATA_NULL=10,_.BSON_DATA_REGEXP=11,_.BSON_DATA_CODE=13,_.BSON_DATA_SYMBOL=14,_.BSON_DATA_CODE_W_SCOPE=15,_.BSON_DATA_INT=16,_.BSON_DATA_TIMESTAMP=17,_.BSON_DATA_LONG=18,_.BSON_DATA_MIN_KEY=255,_.BSON_DATA_MAX_KEY=127,_.BSON_BINARY_SUBTYPE_DEFAULT=0,_.BSON_BINARY_SUBTYPE_FUNCTION=1,_.BSON_BINARY_SUBTYPE_BYTE_ARRAY=2,_.BSON_BINARY_SUBTYPE_UUID=3,_.BSON_BINARY_SUBTYPE_MD5=4,_.BSON_BINARY_SUBTYPE_USER_DEFINED=128,e.exports=_,e.exports.Code=f,e.exports.Map=r,e.exports.Symbol=u,e.exports.BSON=_,e.exports.DBRef=m,e.exports.Binary=g,e.exports.ObjectID=a,e.exports.Long=o,e.exports.Timestamp=s,e.exports.Double=i,e.exports.Int32=l,e.exports.MinKey=d,e.exports.MaxKey=h,e.exports.BSONRegExp=c,e.exports.Decimal128=p},function(module,exports,__webpack_require__){"use strict";var Long=__webpack_require__(43).Long,Double=__webpack_require__(77).Double,Timestamp=__webpack_require__(78).Timestamp,ObjectID=__webpack_require__(79).ObjectID,Symbol=__webpack_require__(81).Symbol,Code=__webpack_require__(82).Code,MinKey=__webpack_require__(84).MinKey,MaxKey=__webpack_require__(85).MaxKey,Decimal128=__webpack_require__(83),Int32=__webpack_require__(130),DBRef=__webpack_require__(86).DBRef,BSONRegExp=__webpack_require__(80).BSONRegExp,Binary=__webpack_require__(53).Binary,utils=__webpack_require__(32),deserialize=function(e,t,n){var r=(t=null==t?{}:t)&&t.index?t.index:0,o=e[r]|e[r+1]<<8|e[r+2]<<16|e[r+3]<<24;if(o<5||e.length<o||o+r>e.length)throw new Error("corrupt bson message");if(0!==e[r+o-1])throw new Error("One object, sized correctly, with a spot for an EOO, but the EOO isn't 0x00");return deserializeObject(e,r,t,n)},deserializeObject=function(e,t,n,r){var o=null!=n.evalFunctions&&n.evalFunctions,i=null!=n.cacheFunctions&&n.cacheFunctions,s=null!=n.cacheFunctionsCrc32&&n.cacheFunctionsCrc32;if(!s)var a=null;var c=null==n.fieldsAsRaw?null:n.fieldsAsRaw,u=null!=n.raw&&n.raw,l="boolean"==typeof n.bsonRegExp&&n.bsonRegExp,f=null!=n.promoteBuffers&&n.promoteBuffers,p=null==n.promoteLongs||n.promoteLongs,d=null==n.promoteValues||n.promoteValues,h=t;if(e.length<5)throw new Error("corrupt bson message < 5 bytes long");var m=e[t++]|e[t++]<<8|e[t++]<<16|e[t++]<<24;if(m<5||m>e.length)throw new Error("corrupt bson message");for(var g=r?[]:{},y=0;;){var b=e[t++];if(0===b)break;for(var v=t;0!==e[v]&&v<e.length;)v++;if(v>=e.length)throw new Error("Bad BSON Document: illegal CString");var S=r?y++:e.toString("utf8",t,v);if(t=v+1,b===BSON.BSON_DATA_STRING){var w=e[t++]|e[t++]<<8|e[t++]<<16|e[t++]<<24;if(w<=0||w>e.length-t||0!==e[t+w-1])throw new Error("bad string length in bson");g[S]=e.toString("utf8",t,t+w-1),t+=w}else if(b===BSON.BSON_DATA_OID){var _=utils.allocBuffer(12);e.copy(_,0,t,t+12),g[S]=new ObjectID(_),t+=12}else if(b===BSON.BSON_DATA_INT&&!1===d)g[S]=new Int32(e[t++]|e[t++]<<8|e[t++]<<16|e[t++]<<24);else if(b===BSON.BSON_DATA_INT)g[S]=e[t++]|e[t++]<<8|e[t++]<<16|e[t++]<<24;else if(b===BSON.BSON_DATA_NUMBER&&!1===d)g[S]=new Double(e.readDoubleLE(t)),t+=8;else if(b===BSON.BSON_DATA_NUMBER)g[S]=e.readDoubleLE(t),t+=8;else if(b===BSON.BSON_DATA_DATE){var O=e[t++]|e[t++]<<8|e[t++]<<16|e[t++]<<24,T=e[t++]|e[t++]<<8|e[t++]<<16|e[t++]<<24;g[S]=new Date(new Long(O,T).toNumber())}else if(b===BSON.BSON_DATA_BOOLEAN){if(0!==e[t]&&1!==e[t])throw new Error("illegal boolean type value");g[S]=1===e[t++]}else if(b===BSON.BSON_DATA_OBJECT){var C=t,x=e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24;if(x<=0||x>e.length-t)throw new Error("bad embedded document length in bson");g[S]=u?e.slice(t,t+x):deserializeObject(e,C,n,!1),t+=x}else if(b===BSON.BSON_DATA_ARRAY){C=t;var E=n,N=t+(x=e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24);if(c&&c[S]){for(var I in E={},n)E[I]=n[I];E.raw=!0}if(g[S]=deserializeObject(e,C,E,!0),0!==e[(t+=x)-1])throw new Error("invalid array terminator byte");if(t!==N)throw new Error("corrupted array bson")}else if(b===BSON.BSON_DATA_UNDEFINED)g[S]=void 0;else if(b===BSON.BSON_DATA_NULL)g[S]=null;else if(b===BSON.BSON_DATA_LONG){O=e[t++]|e[t++]<<8|e[t++]<<16|e[t++]<<24,T=e[t++]|e[t++]<<8|e[t++]<<16|e[t++]<<24;var A=new Long(O,T);g[S]=p&&!0===d&&A.lessThanOrEqual(JS_INT_MAX_LONG)&&A.greaterThanOrEqual(JS_INT_MIN_LONG)?A.toNumber():A}else if(b===BSON.BSON_DATA_DECIMAL128){var k=utils.allocBuffer(16);e.copy(k,0,t,t+16),t+=16;var M=new Decimal128(k);g[S]=M.toObject?M.toObject():M}else if(b===BSON.BSON_DATA_BINARY){var R=e[t++]|e[t++]<<8|e[t++]<<16|e[t++]<<24,j=R,D=e[t++];if(R<0)throw new Error("Negative binary type element size found");if(R>e.length)throw new Error("Binary type size larger than document size");if(null!=e.slice){if(D===Binary.SUBTYPE_BYTE_ARRAY){if((R=e[t++]|e[t++]<<8|e[t++]<<16|e[t++]<<24)<0)throw new Error("Negative binary type element size found for subtype 0x02");if(R>j-4)throw new Error("Binary type with subtype 0x02 contains to long binary size");if(R<j-4)throw new Error("Binary type with subtype 0x02 contains to short binary size")}g[S]=f&&d?e.slice(t,t+R):new Binary(e.slice(t,t+R),D)}else{var P="undefined"!=typeof Uint8Array?new Uint8Array(new ArrayBuffer(R)):new Array(R);if(D===Binary.SUBTYPE_BYTE_ARRAY){if((R=e[t++]|e[t++]<<8|e[t++]<<16|e[t++]<<24)<0)throw new Error("Negative binary type element size found for subtype 0x02");if(R>j-4)throw new Error("Binary type with subtype 0x02 contains to long binary size");if(R<j-4)throw new Error("Binary type with subtype 0x02 contains to short binary size")}for(v=0;v<R;v++)P[v]=e[t+v];g[S]=f&&d?P:new Binary(P,D)}t+=R}else if(b===BSON.BSON_DATA_REGEXP&&!1===l){for(v=t;0!==e[v]&&v<e.length;)v++;if(v>=e.length)throw new Error("Bad BSON Document: illegal CString");var B=e.toString("utf8",t,v);for(v=t=v+1;0!==e[v]&&v<e.length;)v++;if(v>=e.length)throw new Error("Bad BSON Document: illegal CString");var L=e.toString("utf8",t,v);t=v+1;var q=new Array(L.length);for(v=0;v<L.length;v++)switch(L[v]){case"m":q[v]="m";break;case"s":q[v]="g";break;case"i":q[v]="i"}g[S]=new RegExp(B,q.join(""))}else if(b===BSON.BSON_DATA_REGEXP&&!0===l){for(v=t;0!==e[v]&&v<e.length;)v++;if(v>=e.length)throw new Error("Bad BSON Document: illegal CString");for(B=e.toString("utf8",t,v),v=t=v+1;0!==e[v]&&v<e.length;)v++;if(v>=e.length)throw new Error("Bad BSON Document: illegal CString");L=e.toString("utf8",t,v),t=v+1,g[S]=new BSONRegExp(B,L)}else if(b===BSON.BSON_DATA_SYMBOL){if((w=e[t++]|e[t++]<<8|e[t++]<<16|e[t++]<<24)<=0||w>e.length-t||0!==e[t+w-1])throw new Error("bad string length in bson");g[S]=new Symbol(e.toString("utf8",t,t+w-1)),t+=w}else if(b===BSON.BSON_DATA_TIMESTAMP)O=e[t++]|e[t++]<<8|e[t++]<<16|e[t++]<<24,T=e[t++]|e[t++]<<8|e[t++]<<16|e[t++]<<24,g[S]=new Timestamp(O,T);else if(b===BSON.BSON_DATA_MIN_KEY)g[S]=new MinKey;else if(b===BSON.BSON_DATA_MAX_KEY)g[S]=new MaxKey;else if(b===BSON.BSON_DATA_CODE){if((w=e[t++]|e[t++]<<8|e[t++]<<16|e[t++]<<24)<=0||w>e.length-t||0!==e[t+w-1])throw new Error("bad string length in bson");var U=e.toString("utf8",t,t+w-1);if(o)if(i){var z=s?a(U):U;g[S]=isolateEvalWithHash(functionCache,z,U,g)}else g[S]=isolateEval(U);else g[S]=new Code(U);t+=w}else if(b===BSON.BSON_DATA_CODE_W_SCOPE){var $=e[t++]|e[t++]<<8|e[t++]<<16|e[t++]<<24;if($<13)throw new Error("code_w_scope total size shorter minimum expected length");if((w=e[t++]|e[t++]<<8|e[t++]<<16|e[t++]<<24)<=0||w>e.length-t||0!==e[t+w-1])throw new Error("bad string length in bson");U=e.toString("utf8",t,t+w-1),C=t+=w,x=e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24;var W=deserializeObject(e,C,n,!1);if(t+=x,$<8+x+w)throw new Error("code_w_scope total size is to short, truncating scope");if($>8+x+w)throw new Error("code_w_scope total size is to long, clips outer document");o?(i?(z=s?a(U):U,g[S]=isolateEvalWithHash(functionCache,z,U,g)):g[S]=isolateEval(U),g[S].scope=W):g[S]=new Code(U,W)}else{if(b!==BSON.BSON_DATA_DBPOINTER)throw new Error("Detected unknown BSON type "+b.toString(16)+' for fieldname "'+S+'", are you using the latest BSON parser');if((w=e[t++]|e[t++]<<8|e[t++]<<16|e[t++]<<24)<=0||w>e.length-t||0!==e[t+w-1])throw new Error("bad string length in bson");var F=e.toString("utf8",t,t+w-1);t+=w;var V=utils.allocBuffer(12);e.copy(V,0,t,t+12),_=new ObjectID(V),t+=12;var K=F.split("."),H=K.shift(),Y=K.join(".");g[S]=new DBRef(Y,_,H)}}if(m!==t-h){if(r)throw new Error("corrupt array bson");throw new Error("corrupt object bson")}return null!=g.$id&&(g=new DBRef(g.$ref,g.$id,g.$db)),g},isolateEvalWithHash=function(functionCache,hash,functionString,object){var value=null;return null==functionCache[hash]&&(eval("value = "+functionString),functionCache[hash]=value),functionCache[hash].bind(object)},isolateEval=function(functionString){var value=null;return eval("value = "+functionString),value},BSON={},functionCache=BSON.functionCache={};BSON.BSON_DATA_NUMBER=1,BSON.BSON_DATA_STRING=2,BSON.BSON_DATA_OBJECT=3,BSON.BSON_DATA_ARRAY=4,BSON.BSON_DATA_BINARY=5,BSON.BSON_DATA_UNDEFINED=6,BSON.BSON_DATA_OID=7,BSON.BSON_DATA_BOOLEAN=8,BSON.BSON_DATA_DATE=9,BSON.BSON_DATA_NULL=10,BSON.BSON_DATA_REGEXP=11,BSON.BSON_DATA_DBPOINTER=12,BSON.BSON_DATA_CODE=13,BSON.BSON_DATA_SYMBOL=14,BSON.BSON_DATA_CODE_W_SCOPE=15,BSON.BSON_DATA_INT=16,BSON.BSON_DATA_TIMESTAMP=17,BSON.BSON_DATA_LONG=18,BSON.BSON_DATA_DECIMAL128=19,BSON.BSON_DATA_MIN_KEY=255,BSON.BSON_DATA_MAX_KEY=127,BSON.BSON_BINARY_SUBTYPE_DEFAULT=0,BSON.BSON_BINARY_SUBTYPE_FUNCTION=1,BSON.BSON_BINARY_SUBTYPE_BYTE_ARRAY=2,BSON.BSON_BINARY_SUBTYPE_UUID=3,BSON.BSON_BINARY_SUBTYPE_MD5=4,BSON.BSON_BINARY_SUBTYPE_USER_DEFINED=128,BSON.BSON_INT32_MAX=2147483647,BSON.BSON_INT32_MIN=-2147483648,BSON.BSON_INT64_MAX=Math.pow(2,63)-1,BSON.BSON_INT64_MIN=-Math.pow(2,63),BSON.JS_INT_MAX=9007199254740992,BSON.JS_INT_MIN=-9007199254740992;var JS_INT_MAX_LONG=Long.fromNumber(9007199254740992),JS_INT_MIN_LONG=Long.fromNumber(-9007199254740992);module.exports=deserialize},function(e,t,n){"use strict";var r=n(407).writeIEEE754,o=n(43).Long,i=n(129),s=n(53).Binary,a=n(32).normalizedFunctionString,c=/\x00/,u=["$db","$ref","$id","$clusterTime"],l=function(e){return"object"==typeof e&&"[object Date]"===Object.prototype.toString.call(e)},f=function(e){return"[object RegExp]"===Object.prototype.toString.call(e)},p=function(e,t,n,r,o){e[r++]=R.BSON_DATA_STRING;var i=o?e.write(t,r,"ascii"):e.write(t,r,"utf8");e[(r=r+i+1)-1]=0;var s=e.write(n,r+4,"utf8");return e[r+3]=s+1>>24&255,e[r+2]=s+1>>16&255,e[r+1]=s+1>>8&255,e[r]=s+1&255,r=r+4+s,e[r++]=0,r},d=function(e,t,n,i,s){if(Math.floor(n)===n&&n>=R.JS_INT_MIN&&n<=R.JS_INT_MAX)if(n>=R.BSON_INT32_MIN&&n<=R.BSON_INT32_MAX){e[i++]=R.BSON_DATA_INT;var a=s?e.write(t,i,"ascii"):e.write(t,i,"utf8");i+=a,e[i++]=0,e[i++]=255&n,e[i++]=n>>8&255,e[i++]=n>>16&255,e[i++]=n>>24&255}else if(n>=R.JS_INT_MIN&&n<=R.JS_INT_MAX)e[i++]=R.BSON_DATA_NUMBER,i+=a=s?e.write(t,i,"ascii"):e.write(t,i,"utf8"),e[i++]=0,r(e,n,i,"little",52,8),i+=8;else{e[i++]=R.BSON_DATA_LONG,i+=a=s?e.write(t,i,"ascii"):e.write(t,i,"utf8"),e[i++]=0;var c=o.fromNumber(n),u=c.getLowBits(),l=c.getHighBits();e[i++]=255&u,e[i++]=u>>8&255,e[i++]=u>>16&255,e[i++]=u>>24&255,e[i++]=255&l,e[i++]=l>>8&255,e[i++]=l>>16&255,e[i++]=l>>24&255}else e[i++]=R.BSON_DATA_NUMBER,i+=a=s?e.write(t,i,"ascii"):e.write(t,i,"utf8"),e[i++]=0,r(e,n,i,"little",52,8),i+=8;return i},h=function(e,t,n,r,o){return e[r++]=R.BSON_DATA_NULL,r+=o?e.write(t,r,"ascii"):e.write(t,r,"utf8"),e[r++]=0,r},m=function(e,t,n,r,o){return e[r++]=R.BSON_DATA_BOOLEAN,r+=o?e.write(t,r,"ascii"):e.write(t,r,"utf8"),e[r++]=0,e[r++]=n?1:0,r},g=function(e,t,n,r,i){e[r++]=R.BSON_DATA_DATE,r+=i?e.write(t,r,"ascii"):e.write(t,r,"utf8"),e[r++]=0;var s=o.fromNumber(n.getTime()),a=s.getLowBits(),c=s.getHighBits();return e[r++]=255&a,e[r++]=a>>8&255,e[r++]=a>>16&255,e[r++]=a>>24&255,e[r++]=255&c,e[r++]=c>>8&255,e[r++]=c>>16&255,e[r++]=c>>24&255,r},y=function(e,t,n,r,o){if(e[r++]=R.BSON_DATA_REGEXP,r+=o?e.write(t,r,"ascii"):e.write(t,r,"utf8"),e[r++]=0,n.source&&null!=n.source.match(c))throw Error("value "+n.source+" must not contain null bytes");return r+=e.write(n.source,r,"utf8"),e[r++]=0,n.global&&(e[r++]=115),n.ignoreCase&&(e[r++]=105),n.multiline&&(e[r++]=109),e[r++]=0,r},b=function(e,t,n,r,o){if(e[r++]=R.BSON_DATA_REGEXP,r+=o?e.write(t,r,"ascii"):e.write(t,r,"utf8"),e[r++]=0,null!=n.pattern.match(c))throw Error("pattern "+n.pattern+" must not contain null bytes");return r+=e.write(n.pattern,r,"utf8"),e[r++]=0,r+=e.write(n.options.split("").sort().join(""),r,"utf8"),e[r++]=0,r},v=function(e,t,n,r,o){return null===n?e[r++]=R.BSON_DATA_NULL:"MinKey"===n._bsontype?e[r++]=R.BSON_DATA_MIN_KEY:e[r++]=R.BSON_DATA_MAX_KEY,r+=o?e.write(t,r,"ascii"):e.write(t,r,"utf8"),e[r++]=0,r},S=function(e,t,n,r,o){if(e[r++]=R.BSON_DATA_OID,r+=o?e.write(t,r,"ascii"):e.write(t,r,"utf8"),e[r++]=0,"string"==typeof n.id)e.write(n.id,r,"binary");else{if(!n.id||!n.id.copy)throw new Error("object ["+JSON.stringify(n)+"] is not a valid ObjectId");n.id.copy(e,r,0,12)}return r+12},w=function(e,t,n,r,o){e[r++]=R.BSON_DATA_BINARY,r+=o?e.write(t,r,"ascii"):e.write(t,r,"utf8"),e[r++]=0;var i=n.length;return e[r++]=255&i,e[r++]=i>>8&255,e[r++]=i>>16&255,e[r++]=i>>24&255,e[r++]=R.BSON_BINARY_SUBTYPE_DEFAULT,n.copy(e,r,0,i),r+=i},_=function(e,t,n,r,o,i,s,a,c,u){for(var l=0;l<u.length;l++)if(u[l]===n)throw new Error("cyclic dependency detected");u.push(n),e[r++]=Array.isArray(n)?R.BSON_DATA_ARRAY:R.BSON_DATA_OBJECT,r+=c?e.write(t,r,"ascii"):e.write(t,r,"utf8"),e[r++]=0;var f=M(e,n,o,r,i+1,s,a,u);return u.pop(),f},O=function(e,t,n,r,o){return e[r++]=R.BSON_DATA_DECIMAL128,r+=o?e.write(t,r,"ascii"):e.write(t,r,"utf8"),e[r++]=0,n.bytes.copy(e,r,0,16),r+16},T=function(e,t,n,r,o){e[r++]="Long"===n._bsontype?R.BSON_DATA_LONG:R.BSON_DATA_TIMESTAMP,r+=o?e.write(t,r,"ascii"):e.write(t,r,"utf8"),e[r++]=0;var i=n.getLowBits(),s=n.getHighBits();return e[r++]=255&i,e[r++]=i>>8&255,e[r++]=i>>16&255,e[r++]=i>>24&255,e[r++]=255&s,e[r++]=s>>8&255,e[r++]=s>>16&255,e[r++]=s>>24&255,r},C=function(e,t,n,r,o){return e[r++]=R.BSON_DATA_INT,r+=o?e.write(t,r,"ascii"):e.write(t,r,"utf8"),e[r++]=0,e[r++]=255&n,e[r++]=n>>8&255,e[r++]=n>>16&255,e[r++]=n>>24&255,r},x=function(e,t,n,o,i){return e[o++]=R.BSON_DATA_NUMBER,o+=i?e.write(t,o,"ascii"):e.write(t,o,"utf8"),e[o++]=0,r(e,n,o,"little",52,8),o+=8},E=function(e,t,n,r,o,i,s){e[r++]=R.BSON_DATA_CODE,r+=s?e.write(t,r,"ascii"):e.write(t,r,"utf8"),e[r++]=0;var c=a(n),u=e.write(c,r+4,"utf8")+1;return e[r]=255&u,e[r+1]=u>>8&255,e[r+2]=u>>16&255,e[r+3]=u>>24&255,r=r+4+u-1,e[r++]=0,r},N=function(e,t,n,r,o,i,s,a,c){if(n.scope&&"object"==typeof n.scope){e[r++]=R.BSON_DATA_CODE_W_SCOPE;var u=c?e.write(t,r,"ascii"):e.write(t,r,"utf8");r+=u,e[r++]=0;var l=r,f="string"==typeof n.code?n.code:n.code.toString();r+=4;var p=e.write(f,r+4,"utf8")+1;e[r]=255&p,e[r+1]=p>>8&255,e[r+2]=p>>16&255,e[r+3]=p>>24&255,e[r+4+p-1]=0,r=r+p+4;var d=M(e,n.scope,o,r,i+1,s,a);r=d-1;var h=d-l;e[l++]=255&h,e[l++]=h>>8&255,e[l++]=h>>16&255,e[l++]=h>>24&255,e[r++]=0}else{e[r++]=R.BSON_DATA_CODE,r+=u=c?e.write(t,r,"ascii"):e.write(t,r,"utf8"),e[r++]=0,f=n.code.toString();var m=e.write(f,r+4,"utf8")+1;e[r]=255&m,e[r+1]=m>>8&255,e[r+2]=m>>16&255,e[r+3]=m>>24&255,r=r+4+m-1,e[r++]=0}return r},I=function(e,t,n,r,o){e[r++]=R.BSON_DATA_BINARY,r+=o?e.write(t,r,"ascii"):e.write(t,r,"utf8"),e[r++]=0;var i=n.value(!0),a=n.position;return n.sub_type===s.SUBTYPE_BYTE_ARRAY&&(a+=4),e[r++]=255&a,e[r++]=a>>8&255,e[r++]=a>>16&255,e[r++]=a>>24&255,e[r++]=n.sub_type,n.sub_type===s.SUBTYPE_BYTE_ARRAY&&(a-=4,e[r++]=255&a,e[r++]=a>>8&255,e[r++]=a>>16&255,e[r++]=a>>24&255),i.copy(e,r,0,n.position),r+=n.position},A=function(e,t,n,r,o){e[r++]=R.BSON_DATA_SYMBOL,r+=o?e.write(t,r,"ascii"):e.write(t,r,"utf8"),e[r++]=0;var i=e.write(n.value,r+4,"utf8")+1;return e[r]=255&i,e[r+1]=i>>8&255,e[r+2]=i>>16&255,e[r+3]=i>>24&255,r=r+4+i-1,e[r++]=0,r},k=function(e,t,n,r,o,i,s){e[r++]=R.BSON_DATA_OBJECT,r+=s?e.write(t,r,"ascii"):e.write(t,r,"utf8"),e[r++]=0;var a,c=r,u=(a=null!=n.db?M(e,{$ref:n.namespace,$id:n.oid,$db:n.db},!1,r,o+1,i):M(e,{$ref:n.namespace,$id:n.oid},!1,r,o+1,i))-c;return e[c++]=255&u,e[c++]=u>>8&255,e[c++]=u>>16&255,e[c++]=u>>24&255,a},M=function(e,t,n,r,o,s,a,M){r=r||0,(M=M||[]).push(t);var R=r+4;if(Array.isArray(t))for(var j=0;j<t.length;j++){var D=""+j,P=t[j];if(P&&P.toBSON){if("function"!=typeof P.toBSON)throw new Error("toBSON is not a function");P=P.toBSON()}var B=typeof P;if("string"===B)R=p(e,D,P,R,!0);else if("number"===B)R=d(e,D,P,R,!0);else{if("bigint"===B)throw new TypeError("Unsupported type BigInt, please use Decimal128");if("boolean"===B)R=m(e,D,P,R,!0);else if(P instanceof Date||l(P))R=g(e,D,P,R,!0);else if(void 0===P)R=h(e,D,0,R,!0);else if(null===P)R=h(e,D,0,R,!0);else if("ObjectID"===P._bsontype||"ObjectId"===P._bsontype)R=S(e,D,P,R,!0);else if(Buffer.isBuffer(P))R=w(e,D,P,R,!0);else if(P instanceof RegExp||f(P))R=y(e,D,P,R,!0);else if("object"===B&&null==P._bsontype)R=_(e,D,P,R,n,o,s,a,!0,M);else if("object"===B&&"Decimal128"===P._bsontype)R=O(e,D,P,R,!0);else if("Long"===P._bsontype||"Timestamp"===P._bsontype)R=T(e,D,P,R,!0);else if("Double"===P._bsontype)R=x(e,D,P,R,!0);else if("function"==typeof P&&s)R=E(e,D,P,R,0,0,s);else if("Code"===P._bsontype)R=N(e,D,P,R,n,o,s,a,!0);else if("Binary"===P._bsontype)R=I(e,D,P,R,!0);else if("Symbol"===P._bsontype)R=A(e,D,P,R,!0);else if("DBRef"===P._bsontype)R=k(e,D,P,R,o,s,!0);else if("BSONRegExp"===P._bsontype)R=b(e,D,P,R,!0);else if("Int32"===P._bsontype)R=C(e,D,P,R,!0);else if("MinKey"===P._bsontype||"MaxKey"===P._bsontype)R=v(e,D,P,R,!0);else if(void 0!==P._bsontype)throw new TypeError("Unrecognized or invalid _bsontype: "+P._bsontype)}}else if(t instanceof i)for(var L=t.entries(),q=!1;!q;){var U=L.next();if(!(q=U.done)){if(D=U.value[0],B=typeof(P=U.value[1]),"string"==typeof D&&-1===u.indexOf(D)){if(null!=D.match(c))throw Error("key "+D+" must not contain null bytes");if(n){if("$"===D[0])throw Error("key "+D+" must not start with '$'");if(~D.indexOf("."))throw Error("key "+D+" must not contain '.'")}}if("string"===B)R=p(e,D,P,R);else if("number"===B)R=d(e,D,P,R);else{if("bigint"===B)throw new TypeError("Unsupported type BigInt, please use Decimal128");if("boolean"===B)R=m(e,D,P,R);else if(P instanceof Date||l(P))R=g(e,D,P,R);else if(null===P||void 0===P&&!1===a)R=h(e,D,0,R);else if("ObjectID"===P._bsontype||"ObjectId"===P._bsontype)R=S(e,D,P,R);else if(Buffer.isBuffer(P))R=w(e,D,P,R);else if(P instanceof RegExp||f(P))R=y(e,D,P,R);else if("object"===B&&null==P._bsontype)R=_(e,D,P,R,n,o,s,a,!1,M);else if("object"===B&&"Decimal128"===P._bsontype)R=O(e,D,P,R);else if("Long"===P._bsontype||"Timestamp"===P._bsontype)R=T(e,D,P,R);else if("Double"===P._bsontype)R=x(e,D,P,R);else if("Code"===P._bsontype)R=N(e,D,P,R,n,o,s,a);else if("function"==typeof P&&s)R=E(e,D,P,R,0,0,s);else if("Binary"===P._bsontype)R=I(e,D,P,R);else if("Symbol"===P._bsontype)R=A(e,D,P,R);else if("DBRef"===P._bsontype)R=k(e,D,P,R,o,s);else if("BSONRegExp"===P._bsontype)R=b(e,D,P,R);else if("Int32"===P._bsontype)R=C(e,D,P,R);else if("MinKey"===P._bsontype||"MaxKey"===P._bsontype)R=v(e,D,P,R);else if(void 0!==P._bsontype)throw new TypeError("Unrecognized or invalid _bsontype: "+P._bsontype)}}}else{if(t.toBSON){if("function"!=typeof t.toBSON)throw new Error("toBSON is not a function");if(null!=(t=t.toBSON())&&"object"!=typeof t)throw new Error("toBSON function did not return an object")}for(D in t){if((P=t[D])&&P.toBSON){if("function"!=typeof P.toBSON)throw new Error("toBSON is not a function");P=P.toBSON()}if(B=typeof P,"string"==typeof D&&-1===u.indexOf(D)){if(null!=D.match(c))throw Error("key "+D+" must not contain null bytes");if(n){if("$"===D[0])throw Error("key "+D+" must not start with '$'");if(~D.indexOf("."))throw Error("key "+D+" must not contain '.'")}}if("string"===B)R=p(e,D,P,R);else if("number"===B)R=d(e,D,P,R);else{if("bigint"===B)throw new TypeError("Unsupported type BigInt, please use Decimal128");if("boolean"===B)R=m(e,D,P,R);else if(P instanceof Date||l(P))R=g(e,D,P,R);else if(void 0===P)!1===a&&(R=h(e,D,0,R));else if(null===P)R=h(e,D,0,R);else if("ObjectID"===P._bsontype||"ObjectId"===P._bsontype)R=S(e,D,P,R);else if(Buffer.isBuffer(P))R=w(e,D,P,R);else if(P instanceof RegExp||f(P))R=y(e,D,P,R);else if("object"===B&&null==P._bsontype)R=_(e,D,P,R,n,o,s,a,!1,M);else if("object"===B&&"Decimal128"===P._bsontype)R=O(e,D,P,R);else if("Long"===P._bsontype||"Timestamp"===P._bsontype)R=T(e,D,P,R);else if("Double"===P._bsontype)R=x(e,D,P,R);else if("Code"===P._bsontype)R=N(e,D,P,R,n,o,s,a);else if("function"==typeof P&&s)R=E(e,D,P,R,0,0,s);else if("Binary"===P._bsontype)R=I(e,D,P,R);else if("Symbol"===P._bsontype)R=A(e,D,P,R);else if("DBRef"===P._bsontype)R=k(e,D,P,R,o,s);else if("BSONRegExp"===P._bsontype)R=b(e,D,P,R);else if("Int32"===P._bsontype)R=C(e,D,P,R);else if("MinKey"===P._bsontype||"MaxKey"===P._bsontype)R=v(e,D,P,R);else if(void 0!==P._bsontype)throw new TypeError("Unrecognized or invalid _bsontype: "+P._bsontype)}}}M.pop(),e[R++]=0;var z=R-r;return e[r++]=255&z,e[r++]=z>>8&255,e[r++]=z>>16&255,e[r++]=z>>24&255,R},R={BSON_DATA_NUMBER:1,BSON_DATA_STRING:2,BSON_DATA_OBJECT:3,BSON_DATA_ARRAY:4,BSON_DATA_BINARY:5,BSON_DATA_UNDEFINED:6,BSON_DATA_OID:7,BSON_DATA_BOOLEAN:8,BSON_DATA_DATE:9,BSON_DATA_NULL:10,BSON_DATA_REGEXP:11,BSON_DATA_CODE:13,BSON_DATA_SYMBOL:14,BSON_DATA_CODE_W_SCOPE:15,BSON_DATA_INT:16,BSON_DATA_TIMESTAMP:17,BSON_DATA_LONG:18,BSON_DATA_DECIMAL128:19,BSON_DATA_MIN_KEY:255,BSON_DATA_MAX_KEY:127,BSON_BINARY_SUBTYPE_DEFAULT:0,BSON_BINARY_SUBTYPE_FUNCTION:1,BSON_BINARY_SUBTYPE_BYTE_ARRAY:2,BSON_BINARY_SUBTYPE_UUID:3,BSON_BINARY_SUBTYPE_MD5:4,BSON_BINARY_SUBTYPE_USER_DEFINED:128,BSON_INT32_MAX:2147483647,BSON_INT32_MIN:-2147483648};R.BSON_INT64_MAX=Math.pow(2,63)-1,R.BSON_INT64_MIN=-Math.pow(2,63),R.JS_INT_MAX=9007199254740992,R.JS_INT_MIN=-9007199254740992,e.exports=M},function(e,t){t.readIEEE754=function(e,t,n,r,o){var i,s,a="big"===n,c=8*o-r-1,u=(1<<c)-1,l=u>>1,f=-7,p=a?0:o-1,d=a?1:-1,h=e[t+p];for(p+=d,i=h&(1<<-f)-1,h>>=-f,f+=c;f>0;i=256*i+e[t+p],p+=d,f-=8);for(s=i&(1<<-f)-1,i>>=-f,f+=r;f>0;s=256*s+e[t+p],p+=d,f-=8);if(0===i)i=1-l;else{if(i===u)return s?NaN:1/0*(h?-1:1);s+=Math.pow(2,r),i-=l}return(h?-1:1)*s*Math.pow(2,i-r)},t.writeIEEE754=function(e,t,n,r,o,i){var s,a,c,u="big"===r,l=8*i-o-1,f=(1<<l)-1,p=f>>1,d=23===o?Math.pow(2,-24)-Math.pow(2,-77):0,h=u?i-1:0,m=u?-1:1,g=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,s=f):(s=Math.floor(Math.log(t)/Math.LN2),t*(c=Math.pow(2,-s))<1&&(s--,c*=2),(t+=s+p>=1?d/c:d*Math.pow(2,1-p))*c>=2&&(s++,c/=2),s+p>=f?(a=0,s=f):s+p>=1?(a=(t*c-1)*Math.pow(2,o),s+=p):(a=t*Math.pow(2,p-1)*Math.pow(2,o),s=0));o>=8;e[n+h]=255&a,h+=m,a/=256,o-=8);for(s=s<<o|a,l+=o;l>0;e[n+h]=255&s,h+=m,s/=256,l-=8);e[n+h-m]|=128*g}},function(e,t,n){"use strict";var r=n(43).Long,o=n(77).Double,i=n(78).Timestamp,s=n(79).ObjectID,a=n(81).Symbol,c=n(80).BSONRegExp,u=n(82).Code,l=n(83),f=n(84).MinKey,p=n(85).MaxKey,d=n(86).DBRef,h=n(53).Binary,m=n(32).normalizedFunctionString,g=function(e,t,n){var r=5;if(Array.isArray(e))for(var o=0;o<e.length;o++)r+=y(o.toString(),e[o],t,!0,n);else for(var i in e.toBSON&&(e=e.toBSON()),e)r+=y(i,e[i],t,!1,n);return r};function y(e,t,n,y,v){switch(t&&t.toBSON&&(t=t.toBSON()),typeof t){case"string":return 1+Buffer.byteLength(e,"utf8")+1+4+Buffer.byteLength(t,"utf8")+1;case"number":return Math.floor(t)===t&&t>=b.JS_INT_MIN&&t<=b.JS_INT_MAX&&t>=b.BSON_INT32_MIN&&t<=b.BSON_INT32_MAX?(null!=e?Buffer.byteLength(e,"utf8")+1:0)+5:(null!=e?Buffer.byteLength(e,"utf8")+1:0)+9;case"undefined":return y||!v?(null!=e?Buffer.byteLength(e,"utf8")+1:0)+1:0;case"boolean":return(null!=e?Buffer.byteLength(e,"utf8")+1:0)+2;case"object":if(null==t||t instanceof f||t instanceof p||"MinKey"===t._bsontype||"MaxKey"===t._bsontype)return(null!=e?Buffer.byteLength(e,"utf8")+1:0)+1;if(t instanceof s||"ObjectID"===t._bsontype||"ObjectId"===t._bsontype)return(null!=e?Buffer.byteLength(e,"utf8")+1:0)+13;if(t instanceof Date||"object"==typeof(w=t)&&"[object Date]"===Object.prototype.toString.call(w))return(null!=e?Buffer.byteLength(e,"utf8")+1:0)+9;if("undefined"!=typeof Buffer&&Buffer.isBuffer(t))return(null!=e?Buffer.byteLength(e,"utf8")+1:0)+6+t.length;if(t instanceof r||t instanceof o||t instanceof i||"Long"===t._bsontype||"Double"===t._bsontype||"Timestamp"===t._bsontype)return(null!=e?Buffer.byteLength(e,"utf8")+1:0)+9;if(t instanceof l||"Decimal128"===t._bsontype)return(null!=e?Buffer.byteLength(e,"utf8")+1:0)+17;if(t instanceof u||"Code"===t._bsontype)return null!=t.scope&&Object.keys(t.scope).length>0?(null!=e?Buffer.byteLength(e,"utf8")+1:0)+1+4+4+Buffer.byteLength(t.code.toString(),"utf8")+1+g(t.scope,n,v):(null!=e?Buffer.byteLength(e,"utf8")+1:0)+1+4+Buffer.byteLength(t.code.toString(),"utf8")+1;if(t instanceof h||"Binary"===t._bsontype)return t.sub_type===h.SUBTYPE_BYTE_ARRAY?(null!=e?Buffer.byteLength(e,"utf8")+1:0)+(t.position+1+4+1+4):(null!=e?Buffer.byteLength(e,"utf8")+1:0)+(t.position+1+4+1);if(t instanceof a||"Symbol"===t._bsontype)return(null!=e?Buffer.byteLength(e,"utf8")+1:0)+Buffer.byteLength(t.value,"utf8")+4+1+1;if(t instanceof d||"DBRef"===t._bsontype){var S={$ref:t.namespace,$id:t.oid};return null!=t.db&&(S.$db=t.db),(null!=e?Buffer.byteLength(e,"utf8")+1:0)+1+g(S,n,v)}return t instanceof RegExp||"[object RegExp]"===Object.prototype.toString.call(t)?(null!=e?Buffer.byteLength(e,"utf8")+1:0)+1+Buffer.byteLength(t.source,"utf8")+1+(t.global?1:0)+(t.ignoreCase?1:0)+(t.multiline?1:0)+1:t instanceof c||"BSONRegExp"===t._bsontype?(null!=e?Buffer.byteLength(e,"utf8")+1:0)+1+Buffer.byteLength(t.pattern,"utf8")+1+Buffer.byteLength(t.options,"utf8")+1:(null!=e?Buffer.byteLength(e,"utf8")+1:0)+g(t,n,v)+1;case"function":if(t instanceof RegExp||"[object RegExp]"===Object.prototype.toString.call(t)||"[object RegExp]"===String.call(t))return(null!=e?Buffer.byteLength(e,"utf8")+1:0)+1+Buffer.byteLength(t.source,"utf8")+1+(t.global?1:0)+(t.ignoreCase?1:0)+(t.multiline?1:0)+1;if(n&&null!=t.scope&&Object.keys(t.scope).length>0)return(null!=e?Buffer.byteLength(e,"utf8")+1:0)+1+4+4+Buffer.byteLength(m(t),"utf8")+1+g(t.scope,n,v);if(n)return(null!=e?Buffer.byteLength(e,"utf8")+1:0)+1+4+Buffer.byteLength(m(t),"utf8")+1}var w;return 0}var b={BSON_INT32_MAX:2147483647,BSON_INT32_MIN:-2147483648,JS_INT_MAX:9007199254740992,JS_INT_MIN:-9007199254740992};e.exports=g},function(e,t){e.exports=require("assert")},function(e,t){e.exports=require("os")},function(e){e.exports=JSON.parse('{"name":"mongodb","version":"3.6.6","description":"The official MongoDB driver for Node.js","main":"index.js","files":["index.js","lib"],"repository":{"type":"git","url":"git@github.com:mongodb/node-mongodb-native.git"},"keywords":["mongodb","driver","official"],"peerDependenciesMeta":{"kerberos":{"optional":true},"mongodb-client-encryption":{"optional":true},"mongodb-extjson":{"optional":true},"snappy":{"optional":true},"bson-ext":{"optional":true},"aws4":{"optional":true}},"dependencies":{"bl":"^2.2.1","bson":"^1.1.4","denque":"^1.4.1","optional-require":"^1.0.2","safe-buffer":"^5.1.2"},"devDependencies":{"chai":"^4.1.1","chai-subset":"^1.6.0","chalk":"^2.4.2","co":"4.6.0","coveralls":"^2.11.6","eslint":"^7.10.0","eslint-config-prettier":"^6.11.0","eslint-plugin-es":"^3.0.1","eslint-plugin-prettier":"^3.1.3","istanbul":"^0.4.5","jsdoc":"3.5.5","lodash.camelcase":"^4.3.0","mocha":"5.2.0","mocha-sinon":"^2.1.0","mongodb-extjson":"^2.1.1","mongodb-mock-server":"^1.0.1","prettier":"^1.19.1","semver":"^5.5.0","sinon":"^4.3.0","sinon-chai":"^3.2.0","snappy":"^6.3.4","spec-xunit-file":"0.0.1-3","standard-version":"^8.0.2","util.promisify":"^1.0.1","worker-farm":"^1.5.0","wtfnode":"^0.8.0","yargs":"^14.2.0"},"license":"Apache-2.0","engines":{"node":">=4"},"bugs":{"url":"https://github.com/mongodb/node-mongodb-native/issues"},"scripts":{"atlas":"mocha --opts \'{}\' ./test/manual/atlas_connectivity.test.js","check:kerberos":"mocha --opts \'{}\' -t 60000 test/manual/kerberos.test.js","check:ldap":"mocha --opts \'{}\' test/manual/ldap.test.js","check:tls":"mocha --opts \'{}\' test/manual/tls_support.test.js","test":"npm run lint && mocha --recursive test/functional test/unit","test-nolint":"mocha --recursive test/functional test/unit","coverage":"istanbul cover mongodb-test-runner -- -t 60000 test/unit test/functional","lint":"eslint -v && eslint lib test","format":"npm run lint -- --fix","bench":"node test/benchmarks/driverBench/","generate-evergreen":"node .evergreen/generate_evergreen_tasks.js","release":"standard-version -i HISTORY.md"},"homepage":"https://github.com/mongodb/node-mongodb-native","optionalDependencies":{"saslprep":"^1.0.0"}}')},function(e,t){function n(e){var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}n.keys=function(){return[]},n.resolve=n,e.exports=n,n.id=412},function(e,t){e.exports=require("zlib")},function(e,t,n){"use strict";const r=n(5).inherits,o=n(8).EventEmitter,i=n(3).MongoError,s=n(3).MongoTimeoutError,a=n(3).MongoWriteConcernError,c=n(16),u=n(5).format,l=n(45).Msg,f=n(133),p=n(6).MESSAGE_HEADER_SIZE,d=n(6).COMPRESSION_DETAILS_SIZE,h=n(6).opcodes,m=n(30).compress,g=n(30).compressorIDs,y=n(30).uncompressibleCommands,b=n(191),v=n(22).Buffer,S=n(135),w=n(34).updateSessionFromResponse,_=n(4).eachAsync,O=n(4).makeStateMachine,T=n(0).now,C="destroying",x="destroyed",E=O({disconnected:["connecting","draining","disconnected"],connecting:["connecting","connected","draining","disconnected"],connected:["connected","disconnected","draining"],draining:["draining",C,x],[C]:[C,x],[x]:[x]}),N=new Set(["error","close","timeout","parseError","connect","message"]);var I=0,A=function(e,t){if(o.call(this),this.topology=e,this.s={state:"disconnected",cancellationToken:new o},this.s.cancellationToken.setMaxListeners(1/0),this.options=Object.assign({host:"localhost",port:27017,size:5,minSize:0,connectionTimeout:3e4,socketTimeout:0,keepAlive:!0,keepAliveInitialDelay:12e4,noDelay:!0,ssl:!1,checkServerIdentity:!0,ca:null,crl:null,cert:null,key:null,passphrase:null,rejectUnauthorized:!1,promoteLongs:!0,promoteValues:!0,promoteBuffers:!1,reconnect:!0,reconnectInterval:1e3,reconnectTries:30,domainsEnabled:!1,legacyCompatMode:!0},t),this.id=I++,this.retriesLeft=this.options.reconnectTries,this.reconnectId=null,this.reconnectError=null,!t.bson||t.bson&&("function"!=typeof t.bson.serialize||"function"!=typeof t.bson.deserialize))throw new Error("must pass in valid bson parser");this.logger=c("Pool",t),this.availableConnections=[],this.inUseConnections=[],this.connectingConnections=0,this.executing=!1,this.queue=[],this.numberOfConsecutiveTimeouts=0,this.connectionIndex=0;const n=this;this._messageHandler=function(e){return function(t,n){for(var r=null,o=0;o<n.workItems.length;o++)n.workItems[o].requestId===t.responseTo&&(r=n.workItems[o],n.workItems.splice(o,1));function s(e,t,n,r){if(!e.options.domainsEnabled)return process.nextTick((function(){return t(n,r)}));t(n,r)}if(r&&r.monitoring&&j(n,e.inUseConnections,e.availableConnections),e.numberOfConsecutiveTimeouts=0,r&&r.socketTimeout&&n.resetSocketTimeout(),e.logger.isDebug()&&e.logger.debug(u("message [%s] received from %s:%s",t.raw.toString("hex"),e.options.host,e.options.port)),e.executing||process.nextTick((function(){$(e)()})),r&&!r.immediateRelease){try{t.parse(r)}catch(t){return s(e,r.cb,new i(t))}if(t.documents[0]){const n=t.documents[0],o=r.session;o&&w(o,n),e.topology&&n.$clusterTime&&(e.topology.clusterTime=n.$clusterTime)}if(r.command&&t.documents[0]){const n=t.documents[0];if(n.writeConcernError){const t=new a(n.writeConcernError,n);return s(e,r.cb,t)}if(0===n.ok||n.$err||n.errmsg||n.code)return s(e,r.cb,new i(n))}t.hashedName=n.hashedName,s(e,r.cb,null,new f(r.fullResult?t:t.documents[0],n,t))}}}(this),this._connectionCloseHandler=function(e){M(n,"close",e,this)},this._connectionErrorHandler=function(e){M(n,"error",e,this)},this._connectionTimeoutHandler=function(e){M(n,"timeout",e,this)},this._connectionParseErrorHandler=function(e){M(n,"parseError",e,this)}};function k(e){e.inUseConnections=[],e.availableConnections=[],e.connectingConnections=0,e.executing=!1,e.numberOfConsecutiveTimeouts=0,e.connectionIndex=0,e.retriesLeft=e.options.reconnectTries,e.reconnectId=null}function M(e,t,n,r){if(r){if(r._connectionFailHandled)return;r._connectionFailHandled=!0,r.destroy(),q(e,r),r.flush(n)}if("timeout"===t&&(e.numberOfConsecutiveTimeouts=e.numberOfConsecutiveTimeouts+1,e.numberOfConsecutiveTimeouts>e.options.reconnectTries))return e.numberOfConsecutiveTimeouts=0,e.destroy(!0),e.emit("close",e);0===e.socketCount()&&(e.state!==x&&e.state!==C&&"draining"!==e.state&&e.options.reconnect&&E(e,"disconnected"),t="error"===t?"close":t,e.emit(t,n)),!e.reconnectId&&e.options.reconnect&&(e.reconnectError=n,e.reconnectId=setTimeout(R(e),e.options.reconnectInterval)),D(e)<e.minSize&&U(e)}function R(e,t){return function(){if(e.emit("attemptReconnect",e),e.state!==x&&e.state!==C){if(e.retriesLeft=e.retriesLeft-1,e.retriesLeft<=0){e.destroy();const n=new s(`failed to reconnect after ${e.options.reconnectTries} attempts with interval ${e.options.reconnectInterval} ms`,e.reconnectError);return e.emit("reconnectFailed",n),void("function"==typeof t&&t(n))}e.reconnectId=null,U(e,(n,r)=>{null==n&&(e.reconnectId=null,e.retriesLeft=e.options.reconnectTries,e.emit("reconnect",e)),"function"==typeof t&&t(n,r)})}else"function"==typeof t&&t(new i("Cannot create connection when pool is destroyed"))}}function j(e,t,n){var r=t.indexOf(e);-1!==r&&(t.splice(r,1),n.push(e))}function D(e){return e.availableConnections.length+e.inUseConnections.length+e.connectingConnections}function P(e,t,n,r){E(e,C),e.s.cancellationToken.emit("cancel"),_(t,(e,t)=>{for(const t of N)e.removeAllListeners(t);e.on("error",()=>{}),e.destroy(n,t)},t=>{t?"function"==typeof r&&r(t,null):(k(e),e.queue=[],E(e,x),"function"==typeof r&&r(null,null))})}function B(e,t,n){const r=t.toBin();if(!!!e.options.agreedCompressor||!function(e){const t=e instanceof l?e.command:e.query,n=Object.keys(t)[0];return!y.has(n)}(t))return n(null,r);const o=v.concat(r),i=o.slice(p),s=o.readInt32LE(12);m(e,i,(function(r,o){if(r)return n(r,null);const a=v.alloc(p);a.writeInt32LE(p+d+o.length,0),a.writeInt32LE(t.requestId,4),a.writeInt32LE(0,8),a.writeInt32LE(h.OP_COMPRESSED,12);const c=v.alloc(d);return c.writeInt32LE(s,0),c.writeInt32LE(i.length,4),c.writeUInt8(g[e.options.agreedCompressor],8),n(null,[a,c,o])}))}function L(e,t){for(var n=0;n<t.length;n++)if(t[n]===e)return t.splice(n,1),!0}function q(e,t){L(t,e.availableConnections)||L(t,e.inUseConnections)}function U(e,t){e.state!==x&&e.state!==C?(e.connectingConnections++,S(e.options,e.s.cancellationToken,(n,r)=>(e.connectingConnections--,n?(e.logger.isDebug()&&e.logger.debug(`connection attempt failed with error [${JSON.stringify(n)}]`),!e.reconnectId&&e.options.reconnect?"connecting"===e.state&&e.options.legacyCompatMode?void t(n):(e.reconnectError=n,void(e.reconnectId=setTimeout(R(e,t),e.options.reconnectInterval))):void("function"==typeof t&&t(n))):e.state===x||e.state===C?("function"==typeof t&&t(new i("Pool was destroyed after connection creation")),void r.destroy()):(r.on("error",e._connectionErrorHandler),r.on("close",e._connectionCloseHandler),r.on("timeout",e._connectionTimeoutHandler),r.on("parseError",e._connectionParseErrorHandler),r.on("message",e._messageHandler),e.availableConnections.push(r),"function"==typeof t&&t(null,r),void $(e)())))):"function"==typeof t&&t(new i("Cannot create connection when pool is destroyed"))}function z(e){for(var t=0;t<e.length;t++)if(e[t].monitoring){var n=e[t];e.splice(t,1),n.cb(new i({message:"no connection available for monitoring",driver:!0}))}}function $(e){return function(){if(e.state!==x&&!e.executing)if(e.executing=!0,e.connectingConnections>0)e.executing=!1;else{for(;;){const s=D(e);if(0===e.availableConnections.length){z(e.queue),s<e.options.size&&e.queue.length>0&&U(e);break}if(0===e.queue.length)break;var t=null;const a=e.availableConnections.filter(e=>0===e.workItems.length);if(!(t=0===a.length?e.availableConnections[e.connectionIndex++%e.availableConnections.length]:a[e.connectionIndex++%a.length]).isConnected()){q(e,t),z(e.queue);break}var n=e.queue.shift();if(n.monitoring){var r=!1;for(let n=0;n<e.availableConnections.length;n++)if(e.availableConnections[n].isConnected()&&0===e.availableConnections[n].workItems.length){r=!0,t=e.availableConnections[n];break}if(!r){e.queue.unshift(n),s<e.options.size&&e.queue.length>0&&U(e),setTimeout(()=>$(e)(),10);break}}if(s<e.options.size&&t.workItems.length>0){e.queue.unshift(n),U(e);break}var o=n.buffer;n.monitoring&&j(t,e.availableConnections,e.inUseConnections),n.noResponse||t.workItems.push(n),n.immediateRelease||"number"!=typeof n.socketTimeout||t.setSocketTimeout(n.socketTimeout);var i=!0;if(Array.isArray(o))for(let e=0;e<o.length;e++)i=t.write(o[e]);else i=t.write(o);if(n.noResponse&&"function"==typeof n.cb&&n.cb(null,null),!1===i){e.queue.unshift(n),q(e,t),z(e.queue);break}}e.executing=!1}}}r(A,o),Object.defineProperty(A.prototype,"size",{enumerable:!0,get:function(){return this.options.size}}),Object.defineProperty(A.prototype,"minSize",{enumerable:!0,get:function(){return this.options.minSize}}),Object.defineProperty(A.prototype,"connectionTimeout",{enumerable:!0,get:function(){return this.options.connectionTimeout}}),Object.defineProperty(A.prototype,"socketTimeout",{enumerable:!0,get:function(){return this.options.socketTimeout}}),Object.defineProperty(A.prototype,"state",{enumerable:!0,get:function(){return this.s.state}}),A.prototype.socketCount=function(){return this.availableConnections.length+this.inUseConnections.length},A.prototype.allConnections=function(){return this.availableConnections.concat(this.inUseConnections)},A.prototype.get=function(){return this.allConnections()[0]},A.prototype.isConnected=function(){if(this.state===x||this.state===C)return!1;for(var e=this.availableConnections.concat(this.inUseConnections),t=0;t<e.length;t++)if(e[t].isConnected())return!0;return!1},A.prototype.isDestroyed=function(){return this.state===x||this.state===C},A.prototype.isDisconnected=function(){return"disconnected"===this.state},A.prototype.connect=function(e){if("disconnected"!==this.state)throw new i("connection in unlawful state "+this.state);E(this,"connecting"),U(this,(t,n)=>{if(t)return"function"==typeof e?(this.destroy(),void e(t)):("connecting"===this.state&&this.emit("error",t),void this.destroy());if(E(this,"connected"),this.minSize)for(let e=0;e<this.minSize;e++)U(this);"function"==typeof e?e(null,n):this.emit("connect",this,n)})},A.prototype.auth=function(e,t){"function"==typeof t&&t(null,null)},A.prototype.logout=function(e,t){"function"==typeof t&&t(null,null)},A.prototype.unref=function(){this.availableConnections.concat(this.inUseConnections).forEach((function(e){e.unref()}))},A.prototype.destroy=function(e,t){var n=this;if("function"==typeof e&&(t=e,e=!1),this.state!==x&&n.state!==C){if(E(this,"draining"),e){for(var r=n.availableConnections.concat(n.inUseConnections);n.queue.length>0;){var o=n.queue.shift();"function"==typeof o.cb&&o.cb(new i("Pool was force destroyed"))}return P(n,r,{force:!0},t)}this.reconnectId&&clearTimeout(this.reconnectId),function e(){if(n.state!==x&&n.state!==C)if(z(n.queue),0===n.queue.length){for(var r=n.availableConnections.concat(n.inUseConnections),o=0;o<r.length;o++)if(r[o].workItems.length>0)return setTimeout(e,1);P(n,r,{force:!1},t)}else $(n)(),setTimeout(e,1);else"function"==typeof t&&t()}()}else"function"==typeof t&&t(null,null)},A.prototype.reset=function(e){if("connected"!==this.s.state)return void("function"==typeof e&&e(new i("pool is not connected, reset aborted")));this.s.cancellationToken.emit("cancel");const t=this.availableConnections.concat(this.inUseConnections);_(t,(e,t)=>{for(const t of N)e.removeAllListeners(t);e.destroy({force:!0},t)},t=>{t&&"function"==typeof e?e(t,null):(k(this),U(this,()=>{"function"==typeof e&&e(null,null)}))})},A.prototype.write=function(e,t,n){var r=this;if("function"==typeof t&&(n=t),t=t||{},"function"!=typeof n&&!t.noResponse)throw new i("write method must provide a callback");if(this.state!==x&&this.state!==C)if("draining"!==this.state){if(this.options.domainsEnabled&&process.domain&&"function"==typeof n){var o=n;n=process.domain.bind((function(){for(var e=new Array(arguments.length),t=0;t<arguments.length;t++)e[t]=arguments[t];process.nextTick((function(){o.apply(null,e)}))}))}var s={cb:n,raw:!1,promoteLongs:!0,promoteValues:!0,promoteBuffers:!1,fullResult:!1};s.promoteLongs="boolean"!=typeof t.promoteLongs||t.promoteLongs,s.promoteValues="boolean"!=typeof t.promoteValues||t.promoteValues,s.promoteBuffers="boolean"==typeof t.promoteBuffers&&t.promoteBuffers,s.raw="boolean"==typeof t.raw&&t.raw,s.immediateRelease="boolean"==typeof t.immediateRelease&&t.immediateRelease,s.documentsReturnedIn=t.documentsReturnedIn,s.command="boolean"==typeof t.command&&t.command,s.fullResult="boolean"==typeof t.fullResult&&t.fullResult,s.noResponse="boolean"==typeof t.noResponse&&t.noResponse,s.session=t.session||null,s.socketTimeout=t.socketTimeout,s.monitoring=t.monitoring,s.requestId=e.requestId,r.options.monitorCommands&&(this.emit("commandStarted",new b.CommandStartedEvent(this,e)),s.started=T(),s.cb=(t,o)=>{t?r.emit("commandFailed",new b.CommandFailedEvent(this,e,t,s.started)):o&&o.result&&(0===o.result.ok||o.result.$err)?r.emit("commandFailed",new b.CommandFailedEvent(this,e,o.result,s.started)):r.emit("commandSucceeded",new b.CommandSucceededEvent(this,e,o,s.started)),"function"==typeof n&&n(t,o)}),B(r,e,(e,n)=>{if(e)throw e;s.buffer=n,t.monitoring?r.queue.unshift(s):r.queue.push(s),r.executing||process.nextTick((function(){$(r)()}))})}else n(new i("pool is draining, new operations prohibited"));else n(new i("pool destroyed"))},A._execute=$,e.exports=A},function(e,t){e.exports=require("net")},function(e,t,n){"use strict";const{unassigned_code_points:r,commonly_mapped_to_nothing:o,non_ASCII_space_characters:i,prohibited_characters:s,bidirectional_r_al:a,bidirectional_l:c}=n(417);e.exports=function(e,t={}){if("string"!=typeof e)throw new TypeError("Expected string.");if(0===e.length)return"";const n=p(e).map(e=>u.get(e)?32:e).filter(e=>!l.get(e)),o=String.fromCodePoint.apply(null,n).normalize("NFKC"),i=p(o);if(i.some(e=>s.get(e)))throw new Error("Prohibited character, see https://tools.ietf.org/html/rfc4013#section-2.3");if(!0!==t.allowUnassigned){if(i.some(e=>r.get(e)))throw new Error("Unassigned code point, see https://tools.ietf.org/html/rfc4013#section-2.5")}const d=i.some(e=>a.get(e)),h=i.some(e=>c.get(e));if(d&&h)throw new Error("String must not contain RandALCat and LCat at the same time, see https://tools.ietf.org/html/rfc3454#section-6");const m=a.get(f((y=o,y[0]))),g=a.get(f((e=>e[e.length-1])(o)));var y;if(d&&(!m||!g))throw new Error("Bidirectional RandALCat character must be the first and the last character of the string, see https://tools.ietf.org/html/rfc3454#section-6");return o};const u=i,l=o,f=e=>e.codePointAt(0);function p(e){const t=[],n=e.length;for(let r=0;r<n;r+=1){const o=e.charCodeAt(r);if(o>=55296&&o<=56319&&n>r+1){const n=e.charCodeAt(r+1);if(n>=56320&&n<=57343){t.push(1024*(o-55296)+n-56320+65536),r+=1;continue}}t.push(o)}return t}},function(e,t,n){"use strict";(function(t){const r=n(89),o=n(136),i=n(418),s=r.readFileSync(o.resolve(t,"../code-points.mem"));let a=0;function c(){const e=s.readUInt32BE(a);a+=4;const t=s.slice(a,a+e);return a+=e,i({buffer:t})}const u=c(),l=c(),f=c(),p=c(),d=c(),h=c();e.exports={unassigned_code_points:u,commonly_mapped_to_nothing:l,non_ASCII_space_characters:f,prohibited_characters:p,bidirectional_r_al:d,bidirectional_l:h}}).call(this,"/")},function(e,t,n){var r=n(419);function o(e){if(!(this instanceof o))return new o(e);if(e||(e={}),Buffer.isBuffer(e)&&(e={buffer:e}),this.pageOffset=e.pageOffset||0,this.pageSize=e.pageSize||1024,this.pages=e.pages||r(this.pageSize),this.byteLength=this.pages.length*this.pageSize,this.length=8*this.byteLength,(t=this.pageSize)&t-1)throw new Error("The page size should be a power of two");var t;if(this._trackUpdates=!!e.trackUpdates,this._pageMask=this.pageSize-1,e.buffer){for(var n=0;n<e.buffer.length;n+=this.pageSize)this.pages.set(n/this.pageSize,e.buffer.slice(n,n+this.pageSize));this.byteLength=e.buffer.length,this.length=8*this.byteLength}}e.exports=o,o.prototype.get=function(e){var t=7&e,n=(e-t)/8;return!!(this.getByte(n)&128>>t)},o.prototype.getByte=function(e){var t=e&this._pageMask,n=(e-t)/this.pageSize,r=this.pages.get(n,!0);return r?r.buffer[t+this.pageOffset]:0},o.prototype.set=function(e,t){var n=7&e,r=(e-n)/8,o=this.getByte(r);return this.setByte(r,t?o|128>>n:o&(255^128>>n))},o.prototype.toBuffer=function(){for(var e=function(e){if(Buffer.alloc)return Buffer.alloc(e);var t=new Buffer(e);return t.fill(0),t}(this.pages.length*this.pageSize),t=0;t<this.pages.length;t++){var n=this.pages.get(t,!0),r=t*this.pageSize;n&&n.buffer.copy(e,r,this.pageOffset,this.pageOffset+this.pageSize)}return e},o.prototype.setByte=function(e,t){var n=e&this._pageMask,r=(e-n)/this.pageSize,o=this.pages.get(r,!1);return n+=this.pageOffset,o.buffer[n]!==t&&(o.buffer[n]=t,e>=this.byteLength&&(this.byteLength=e+1,this.length=8*this.byteLength),this._trackUpdates&&this.pages.updated(o),!0)}},function(e,t){function n(e,t){if(!(this instanceof n))return new n(e,t);this.length=0,this.updates=[],this.path=new Uint16Array(4),this.pages=new Array(32768),this.maxPages=this.pages.length,this.level=0,this.pageSize=e||1024,this.deduplicate=t?t.deduplicate:null,this.zeros=this.deduplicate?r(this.deduplicate.length):null}function r(e){if(Buffer.alloc)return Buffer.alloc(e);var t=new Buffer(e);return t.fill(0),t}function o(e,t){this.offset=e*t.length,this.buffer=t,this.updated=!1,this.deduplicate=0}e.exports=n,n.prototype.updated=function(e){for(;this.deduplicate&&e.buffer[e.deduplicate]===this.deduplicate[e.deduplicate];)if(e.deduplicate++,e.deduplicate===this.deduplicate.length){e.deduplicate=0,e.buffer.equals&&e.buffer.equals(this.deduplicate)&&(e.buffer=this.deduplicate);break}!e.updated&&this.updates&&(e.updated=!0,this.updates.push(e))},n.prototype.lastUpdate=function(){if(!this.updates||!this.updates.length)return null;var e=this.updates.pop();return e.updated=!1,e},n.prototype._array=function(e,t){if(e>=this.maxPages){if(t)return;!function(e,t){for(;e.maxPages<t;){var n=e.pages;e.pages=new Array(32768),e.pages[0]=n,e.level++,e.maxPages*=32768}}(this,e)}var n,r;n=e,r=this.path,n=((n=(n-(r[0]=32767&n))/32768)-(r[1]=32767&n))/32768,r[3]=(n-(r[2]=32767&n))/32768&32767;for(var o=this.pages,i=this.level;i>0;i--){var s=this.path[i],a=o[s];if(!a){if(t)return;a=o[s]=new Array(32768)}o=a}return o},n.prototype.get=function(e,t){var n,i,s=this._array(e,t),a=this.path[0],c=s&&s[a];return c||t||(c=s[a]=new o(e,r(this.pageSize)),e>=this.length&&(this.length=e+1)),c&&c.buffer===this.deduplicate&&this.deduplicate&&!t&&(c.buffer=(n=c.buffer,i=Buffer.allocUnsafe?Buffer.allocUnsafe(n.length):new Buffer(n.length),n.copy(i),i),c.deduplicate=0),c},n.prototype.set=function(e,t){var n=this._array(e,!1),i=this.path[0];if(e>=this.length&&(this.length=e+1),!t||this.zeros&&t.equals&&t.equals(this.zeros))n[i]=void 0;else{this.deduplicate&&t.equals&&t.equals(this.deduplicate)&&(t=this.deduplicate);var s=n[i],a=function(e,t){if(e.length===t)return e;if(e.length>t)return e.slice(0,t);var n=r(t);return e.copy(n),n}(t,this.pageSize);s?s.buffer=a:n[i]=new o(e,a)}},n.prototype.toBuffer=function(){for(var e=new Array(this.length),t=r(this.pageSize),n=0;n<e.length;)for(var o=this._array(n,!0),i=0;i<32768&&n<e.length;i++)e[n++]=o&&o[i]?o[i].buffer:t;return Buffer.concat(e)}},function(e,t,n){"use strict";const r=n(33).AuthProvider,o=n(198).MongoCredentials,i=n(3).MongoError,s=n(20),a=n(421),c=n(4).maxWireVersion,u=n(90);let l;try{l=n(422)}catch(e){}const f="http://169.254.169.254",p="/latest/meta-data/iam/security-credentials";function d(e){const t=e.split(".");return 1===t.length||"amazonaws"===t[1]?"us-east-1":t[1]}function h(e,t,n){"function"==typeof t&&(n=t,t={}),t=Object.assign({method:"GET",timeout:1e4,json:!0},u.parse(e),t);const r=a.request(t,e=>{e.setEncoding("utf8");let r="";e.on("data",e=>r+=e),e.on("end",()=>{if(!1!==t.json)try{const e=JSON.parse(r);n(void 0,e)}catch(e){n(new i(`Invalid JSON response: "${r}"`))}else n(void 0,r)})});r.on("error",e=>n(e)),r.end()}e.exports=class extends r{auth(e,t){const n=e.connection,r=e.credentials;if(c(n)<9)return void t(new i("MONGODB-AWS authentication requires MongoDB version 4.4 or later"));if(null==l)return void t(new i("MONGODB-AWS authentication requires the `aws4` module, please install it as a dependency of your project"));if(null==r.username)return void function(e,t){function n(n){null!=n.AccessKeyId&&null!=n.SecretAccessKey&&null!=n.Token?t(void 0,new o({username:n.AccessKeyId,password:n.SecretAccessKey,source:e.source,mechanism:"MONGODB-AWS",mechanismProperties:{AWS_SESSION_TOKEN:n.Token}})):t(new i("Could not obtain temporary MONGODB-AWS credentials"))}if(process.env.AWS_CONTAINER_CREDENTIALS_RELATIVE_URI)return void h(`http://169.254.170.2${process.env.AWS_CONTAINER_CREDENTIALS_RELATIVE_URI}`,(e,r)=>{if(e)return t(e);n(r)});h(`${f}/latest/api/token`,{method:"PUT",json:!1,headers:{"X-aws-ec2-metadata-token-ttl-seconds":30}},(e,r)=>{if(e)return t(e);h(`${f}/${p}`,{json:!1,headers:{"X-aws-ec2-metadata-token":r}},(e,o)=>{if(e)return t(e);h(`${f}/${p}/${o}`,{headers:{"X-aws-ec2-metadata-token":r}},(e,r)=>{if(e)return t(e);n(r)})})})}(r,(n,r)=>{if(n)return t(n);e.credentials=r,this.auth(e,t)});const a=r.username,u=r.password,m=r.source,g=r.mechanismProperties.AWS_SESSION_TOKEN,y=this.bson;s.randomBytes(32,(e,r)=>{if(e)return void t(e);const o={saslStart:1,mechanism:"MONGODB-AWS",payload:y.serialize({r:r,p:110})};n.command(`${m}.$cmd`,o,(e,o)=>{if(e)return t(e);const s=o.result,c=y.deserialize(s.payload.buffer),f=c.h,p=c.s.buffer;if(64!==p.length)return void t(new i(`Invalid server nonce length ${p.length}, expected 64`));if(0!==p.compare(r,0,r.length,0,r.length))return void t(new i("Server nonce does not begin with client nonce"));if(f.length<1||f.length>255||-1!==f.indexOf(".."))return void t(new i(`Server returned an invalid host: "${f}"`));const h="Action=GetCallerIdentity&Version=2011-06-15",b=l.sign({method:"POST",host:f,region:d(c.h),service:"sts",headers:{"Content-Type":"application/x-www-form-urlencoded","Content-Length":h.length,"X-MongoDB-Server-Nonce":p.toString("base64"),"X-MongoDB-GS2-CB-Flag":"n"},path:"/",body:h},{accessKeyId:a,secretAccessKey:u,token:g}),v={a:b.headers.Authorization,d:b.headers["X-Amz-Date"]};g&&(v.t=g);const S={saslContinue:1,conversationId:1,payload:y.serialize(v)};n.command(`${m}.$cmd`,S,e=>{if(e)return t(e);t()})})})}}},function(e,t){e.exports=require("http")},function(e,t,n){var r=t,o=n(90),i=n(137),s=n(20),a=n(423)(1e3);function c(e,t,n){return s.createHmac("sha256",e).update(t,"utf8").digest(n)}function u(e,t){return s.createHash("sha256").update(e,"utf8").digest(t)}function l(e){return e.replace(/[!'()*]/g,(function(e){return"%"+e.charCodeAt(0).toString(16).toUpperCase()}))}function f(e){return l(encodeURIComponent(e))}function p(e,t){"string"==typeof e&&(e=o.parse(e));var n=e.headers=e.headers||{},r=this.matchHost(e.hostname||e.host||n.Host||n.host);this.request=e,this.credentials=t||this.defaultCredentials(),this.service=e.service||r[0]||"",this.region=e.region||r[1]||"us-east-1","email"===this.service&&(this.service="ses"),!e.method&&e.body&&(e.method="POST"),n.Host||n.host||(n.Host=e.hostname||e.host||this.createHost(),e.port&&(n.Host+=":"+e.port)),e.hostname||e.host||(e.hostname=n.Host||n.host),this.isCodeCommitGit="codecommit"===this.service&&"GIT"===e.method}p.prototype.matchHost=function(e){var t=((e||"").match(/([^\.]+)\.(?:([^\.]*)\.)?amazonaws\.com(\.cn)?$/)||[]).slice(1,3);return"es"===t[1]&&(t=t.reverse()),t},p.prototype.isSingleRegion=function(){return["s3","sdb"].indexOf(this.service)>=0&&"us-east-1"===this.region||["cloudfront","ls","route53","iam","importexport","sts"].indexOf(this.service)>=0},p.prototype.createHost=function(){var e=this.isSingleRegion()?"":("s3"===this.service&&"us-east-1"!==this.region?"-":".")+this.region;return("ses"===this.service?"email":this.service)+e+".amazonaws.com"},p.prototype.prepareRequest=function(){this.parsePath();var e,t=this.request,n=t.headers;t.signQuery?(this.parsedPath.query=e=this.parsedPath.query||{},this.credentials.sessionToken&&(e["X-Amz-Security-Token"]=this.credentials.sessionToken),"s3"!==this.service||e["X-Amz-Expires"]||(e["X-Amz-Expires"]=86400),e["X-Amz-Date"]?this.datetime=e["X-Amz-Date"]:e["X-Amz-Date"]=this.getDateTime(),e["X-Amz-Algorithm"]="AWS4-HMAC-SHA256",e["X-Amz-Credential"]=this.credentials.accessKeyId+"/"+this.credentialString(),e["X-Amz-SignedHeaders"]=this.signedHeaders()):(t.doNotModifyHeaders||this.isCodeCommitGit||(!t.body||n["Content-Type"]||n["content-type"]||(n["Content-Type"]="application/x-www-form-urlencoded; charset=utf-8"),!t.body||n["Content-Length"]||n["content-length"]||(n["Content-Length"]=Buffer.byteLength(t.body)),!this.credentials.sessionToken||n["X-Amz-Security-Token"]||n["x-amz-security-token"]||(n["X-Amz-Security-Token"]=this.credentials.sessionToken),"s3"!==this.service||n["X-Amz-Content-Sha256"]||n["x-amz-content-sha256"]||(n["X-Amz-Content-Sha256"]=u(this.request.body||"","hex")),n["X-Amz-Date"]||n["x-amz-date"]?this.datetime=n["X-Amz-Date"]||n["x-amz-date"]:n["X-Amz-Date"]=this.getDateTime()),delete n.Authorization,delete n.authorization)},p.prototype.sign=function(){return this.parsedPath||this.prepareRequest(),this.request.signQuery?this.parsedPath.query["X-Amz-Signature"]=this.signature():this.request.headers.Authorization=this.authHeader(),this.request.path=this.formatPath(),this.request},p.prototype.getDateTime=function(){if(!this.datetime){var e=this.request.headers,t=new Date(e.Date||e.date||new Date);this.datetime=t.toISOString().replace(/[:\-]|\.\d{3}/g,""),this.isCodeCommitGit&&(this.datetime=this.datetime.slice(0,-1))}return this.datetime},p.prototype.getDate=function(){return this.getDateTime().substr(0,8)},p.prototype.authHeader=function(){return["AWS4-HMAC-SHA256 Credential="+this.credentials.accessKeyId+"/"+this.credentialString(),"SignedHeaders="+this.signedHeaders(),"Signature="+this.signature()].join(", ")},p.prototype.signature=function(){var e,t,n,r=this.getDate(),o=[this.credentials.secretAccessKey,r,this.region,this.service].join(),i=a.get(o);return i||(e=c("AWS4"+this.credentials.secretAccessKey,r),t=c(e,this.region),n=c(t,this.service),i=c(n,"aws4_request"),a.set(o,i)),c(i,this.stringToSign(),"hex")},p.prototype.stringToSign=function(){return["AWS4-HMAC-SHA256",this.getDateTime(),this.credentialString(),u(this.canonicalString(),"hex")].join("\n")},p.prototype.canonicalString=function(){this.parsedPath||this.prepareRequest();var e,t=this.parsedPath.path,n=this.parsedPath.query,r=this.request.headers,o="",i="s3"!==this.service,s="s3"===this.service||this.request.doNotEncodePath,a="s3"===this.service,c="s3"===this.service;if(e="s3"===this.service&&this.request.signQuery?"UNSIGNED-PAYLOAD":this.isCodeCommitGit?"":r["X-Amz-Content-Sha256"]||r["x-amz-content-sha256"]||u(this.request.body||"","hex"),n){var l=Object.keys(n).reduce((function(e,t){return t?(e[f(t)]=Array.isArray(n[t])&&c?n[t][0]:n[t],e):e}),{}),p=[];Object.keys(l).sort().forEach((function(e){Array.isArray(l[e])?l[e].map(f).sort().forEach((function(t){p.push(e+"="+t)})):p.push(e+"="+f(l[e]))})),o=p.join("&")}return"/"!==t&&(i&&(t=t.replace(/\/{2,}/g,"/")),"/"!==(t=t.split("/").reduce((function(e,t){return i&&".."===t?e.pop():i&&"."===t||(s&&(t=decodeURIComponent(t).replace(/\+/g," ")),e.push(f(t))),e}),[]).join("/"))[0]&&(t="/"+t),a&&(t=t.replace(/%2F/g,"/"))),[this.request.method||"GET",t,o,this.canonicalHeaders()+"\n",this.signedHeaders(),e].join("\n")},p.prototype.canonicalHeaders=function(){var e=this.request.headers;return Object.keys(e).sort((function(e,t){return e.toLowerCase()<t.toLowerCase()?-1:1})).map((function(t){return t.toLowerCase()+":"+e[t].toString().trim().replace(/\s+/g," ")})).join("\n")},p.prototype.signedHeaders=function(){return Object.keys(this.request.headers).map((function(e){return e.toLowerCase()})).sort().join(";")},p.prototype.credentialString=function(){return[this.getDate(),this.region,this.service,"aws4_request"].join("/")},p.prototype.defaultCredentials=function(){var e=process.env;return{accessKeyId:e.AWS_ACCESS_KEY_ID||e.AWS_ACCESS_KEY,secretAccessKey:e.AWS_SECRET_ACCESS_KEY||e.AWS_SECRET_KEY,sessionToken:e.AWS_SESSION_TOKEN}},p.prototype.parsePath=function(){var e=this.request.path||"/";/[^0-9A-Za-z;,/?:@&=+$\-_.!~*'()#%]/.test(e)&&(e=encodeURI(decodeURI(e)));var t=e.indexOf("?"),n=null;t>=0&&(n=i.parse(e.slice(t+1)),e=e.slice(0,t)),this.parsedPath={path:e,query:n}},p.prototype.formatPath=function(){var e=this.parsedPath.path,t=this.parsedPath.query;return t?(null!=t[""]&&delete t[""],e+"?"+l(i.stringify(t))):e},r.RequestSigner=p,r.sign=function(e,t){return new p(e,t).sign()}},function(e,t){function n(e){this.capacity=0|e,this.map=Object.create(null),this.list=new r}function r(){this.firstNode=null,this.lastNode=null}function o(e,t){this.key=e,this.val=t,this.prev=null,this.next=null}e.exports=function(e){return new n(e)},n.prototype.get=function(e){var t=this.map[e];if(null!=t)return this.used(t),t.val},n.prototype.set=function(e,t){var n=this.map[e];if(null!=n)n.val=t;else{if(this.capacity||this.prune(),!this.capacity)return!1;n=new o(e,t),this.map[e]=n,this.capacity--}return this.used(n),!0},n.prototype.used=function(e){this.list.moveToFront(e)},n.prototype.prune=function(){var e=this.list.pop();null!=e&&(delete this.map[e.key],this.capacity++)},r.prototype.moveToFront=function(e){this.firstNode!=e&&(this.remove(e),null==this.firstNode?(this.firstNode=e,this.lastNode=e,e.prev=null,e.next=null):(e.prev=null,e.next=this.firstNode,e.next.prev=e,this.firstNode=e))},r.prototype.pop=function(){var e=this.lastNode;return null!=e&&this.remove(e),e},r.prototype.remove=function(e){this.firstNode==e?this.firstNode=e.next:null!=e.prev&&(e.prev.next=e.next),this.lastNode==e?this.lastNode=e.prev:null!=e.next&&(e.next.prev=e.prev)}},function(e,t,n){"use strict";const r=n(3).MongoError,o=n(6).collectionNamespace,i=n(55),s=n(0).decorateWithExplain,a=n(91).Explain;e.exports=function(e,t,n,c,u,l,f){if(0===u.length)throw new r(`${t} must contain at least one document`);"function"==typeof l&&(f=l,l={});const p="boolean"!=typeof(l=l||{}).ordered||l.ordered,d=l.writeConcern;let h={};if(h[t]=o(c),h[n]=u,h.ordered=p,d&&Object.keys(d).length>0&&(h.writeConcern=d),l.collation)for(let e=0;e<h[n].length;e++)h[n][e].collation||(h[n][e].collation=l.collation);!0===l.bypassDocumentValidation&&(h.bypassDocumentValidation=l.bypassDocumentValidation);const m=a.fromOptions(l);m&&(h=s(h,m));const g=Object.assign({checkKeys:"insert"===t,numberToReturn:1},l);i(e,c,h,g,f)}},function(e,t,n){"use strict";const r=n(21).KillCursor,o=n(3).MongoError,i=n(3).MongoNetworkError,s=n(6).collectionNamespace,a=n(4).maxWireVersion,c=n(4).emitWarning,u=n(55);e.exports=function(e,t,n,l){l="function"==typeof l?l:()=>{};const f=n.cursorId;if(a(e)<4){const o=e.s.bson,i=e.s.pool,s=new r(o,t,[f]),a={immediateRelease:!0,noResponse:!0};if("object"==typeof n.session&&(a.session=n.session),i&&i.isConnected())try{i.write(s,a,l)}catch(e){"function"==typeof l?l(e,null):c(e)}return}const p={killCursors:s(t),cursors:[f]},d={};"object"==typeof n.session&&(d.session=n.session),u(e,t,p,d,(e,t)=>{if(e)return l(e);const n=t.message;return n.cursorNotFound?l(new i("cursor killed or timed out"),null):Array.isArray(n.documents)&&0!==n.documents.length?void l(null,n.documents[0]):l(new o(`invalid killCursors result returned for cursor id ${f}`))})}},function(e,t,n){"use strict";const r=n(21).GetMore,o=n(9).retrieveBSON,i=n(3).MongoError,s=n(3).MongoNetworkError,a=o().Long,c=n(6).collectionNamespace,u=n(4).maxWireVersion,l=n(6).applyCommonQueryOptions,f=n(55);e.exports=function(e,t,n,o,p,d){p=p||{};const h=u(e);function m(e,t){if(e)return d(e);const r=t.message;if(r.cursorNotFound)return d(new s("cursor killed or timed out"),null);if(h<4){const e="number"==typeof r.cursorId?a.fromNumber(r.cursorId):r.cursorId;return n.documents=r.documents,n.cursorId=e,void d(null,null,r.connection)}if(0===r.documents[0].ok)return d(new i(r.documents[0]));const o="number"==typeof r.documents[0].cursor.id?a.fromNumber(r.documents[0].cursor.id):r.documents[0].cursor.id;n.documents=r.documents[0].cursor.nextBatch,n.cursorId=o,d(null,r.documents[0],r.connection)}if(h<4){const i=e.s.bson,s=new r(i,t,n.cursorId,{numberToReturn:o}),a=l({},n);return void e.s.pool.write(s,a,m)}const g={getMore:n.cursorId instanceof a?n.cursorId:a.fromNumber(n.cursorId),collection:c(t),batchSize:Math.abs(o)};n.cmd.tailable&&"number"==typeof n.cmd.maxAwaitTimeMS&&(g.maxTimeMS=n.cmd.maxAwaitTimeMS);const y=Object.assign({returnFieldSelector:null,documentsReturnedIn:"nextBatch"},p);n.session&&(y.session=n.session),f(e,t,g,y,m)}},function(e,t,n){"use strict";const r=n(21).Query,o=n(3).MongoError,i=n(6).getReadPreference,s=n(6).collectionNamespace,a=n(6).isSharded,c=n(4).maxWireVersion,u=n(6).applyCommonQueryOptions,l=n(55),f=n(0).decorateWithExplain,p=n(91).Explain;e.exports=function(e,t,n,d,h,m){if(h=h||{},null!=d.cursorId)return m();if(null==n)return m(new o(`command ${JSON.stringify(n)} does not return a cursor`));if(c(e)<4){const s=function(e,t,n,s,c){c=c||{};const u=e.s.bson,l=i(n,c);s.batchSize=n.batchSize||s.batchSize;let f=0;f=s.limit<0||0!==s.limit&&s.limit<s.batchSize||s.limit>0&&0===s.batchSize?s.limit:s.batchSize;const p=s.skip||0,d={};a(e)&&l&&(d.$readPreference=l.toJSON());n.sort&&(d.$orderby=n.sort);n.hint&&(d.$hint=n.hint);n.snapshot&&(d.$snapshot=n.snapshot);void 0!==n.returnKey&&(d.$returnKey=n.returnKey);n.maxScan&&(d.$maxScan=n.maxScan);n.min&&(d.$min=n.min);n.max&&(d.$max=n.max);void 0!==n.showDiskLoc&&(d.$showDiskLoc=n.showDiskLoc);n.comment&&(d.$comment=n.comment);n.maxTimeMS&&(d.$maxTimeMS=n.maxTimeMS);void 0!==c.explain&&(f=-Math.abs(n.limit||0),d.$explain=!0);if(d.$query=n.query,n.readConcern&&"local"!==n.readConcern.level)throw new o(`server find command does not support a readConcern level of ${n.readConcern.level}`);n.readConcern&&delete(n=Object.assign({},n)).readConcern;const h="boolean"==typeof c.serializeFunctions&&c.serializeFunctions,m="boolean"==typeof c.ignoreUndefined&&c.ignoreUndefined,g=new r(u,t,d,{numberToSkip:p,numberToReturn:f,pre32Limit:void 0!==n.limit?n.limit:void 0,checkKeys:!1,returnFieldSelector:n.fields,serializeFunctions:h,ignoreUndefined:m});"boolean"==typeof n.tailable&&(g.tailable=n.tailable);"boolean"==typeof n.oplogReplay&&(g.oplogReplay=n.oplogReplay);"boolean"==typeof n.noCursorTimeout&&(g.noCursorTimeout=n.noCursorTimeout);"boolean"==typeof n.awaitData&&(g.awaitData=n.awaitData);"boolean"==typeof n.partial&&(g.partial=n.partial);return g.slaveOk=l.slaveOk(),g}(e,t,n,d,h),c=u({},d);return"string"==typeof s.documentsReturnedIn&&(c.documentsReturnedIn=s.documentsReturnedIn),void e.s.pool.write(s,c,m)}const g=i(n,h);let y=function(e,t,n,r){r.batchSize=n.batchSize||r.batchSize;const o={find:s(t)};n.query&&(n.query.$query?o.filter=n.query.$query:o.filter=n.query);let i=n.sort;if(Array.isArray(i)){const e={};if(i.length>0&&!Array.isArray(i[0])){let t=i[1];"asc"===t?t=1:"desc"===t&&(t=-1),e[i[0]]=t}else for(let t=0;t<i.length;t++){let n=i[t][1];"asc"===n?n=1:"desc"===n&&(n=-1),e[i[t][0]]=n}i=e}"boolean"==typeof n.allowDiskUse&&(o.allowDiskUse=n.allowDiskUse);n.sort&&(o.sort=i);n.fields&&(o.projection=n.fields);n.hint&&(o.hint=n.hint);n.skip&&(o.skip=n.skip);n.limit&&(o.limit=n.limit);n.limit<0&&(o.limit=Math.abs(n.limit),o.singleBatch=!0);"number"==typeof n.batchSize&&(n.batchSize<0&&(0!==n.limit&&Math.abs(n.batchSize)<Math.abs(n.limit)&&(o.limit=Math.abs(n.batchSize)),o.singleBatch=!0),o.batchSize=Math.abs(n.batchSize));n.comment&&(o.comment=n.comment);n.maxScan&&(o.maxScan=n.maxScan);n.maxTimeMS&&(o.maxTimeMS=n.maxTimeMS);n.min&&(o.min=n.min);n.max&&(o.max=n.max);o.returnKey=!!n.returnKey&&n.returnKey,o.showRecordId=!!n.showDiskLoc&&n.showDiskLoc,n.snapshot&&(o.snapshot=n.snapshot);n.tailable&&(o.tailable=n.tailable);n.oplogReplay&&(o.oplogReplay=n.oplogReplay);n.noCursorTimeout&&(o.noCursorTimeout=n.noCursorTimeout);n.awaitData&&(o.awaitData=n.awaitData);n.awaitdata&&(o.awaitData=n.awaitdata);n.partial&&(o.partial=n.partial);n.collation&&(o.collation=n.collation);n.readConcern&&(o.readConcern=n.readConcern);return o}(0,t,n,d);const b=p.fromOptions(h);b&&(y=f(y,b)),n.virtual=!1;const v=Object.assign({documentsReturnedIn:"firstBatch",numberToReturn:1,slaveOk:g.slaveOk()},h);n.readPreference&&(v.readPreference=g),d.session&&(v.session=d.session),l(e,t,y,v,m)}},function(e,t,n){"use strict";const r=n(5).inherits,o=n(5).format,i=n(8).EventEmitter,s=n(10),a=n(17).CoreCursor,c=n(9).retrieveBSON,u=n(16),l=n(3).MongoError,f=n(134),p=n(429),d=n(7).Timeout,h=n(7).Interval,m=n(7).SessionMixins,g=n(7).isRetryableWritesSupported,y=n(4).relayEvents,b=c(),v=n(7).getMMAPError,S=n(4).makeClientMetadata,w=n(7).legacyIsRetryableWriteError,_=n(0).now,O=n(0).calculateDurationInMs;var T="destroyed";function C(e,t){var n={disconnected:["connecting",T,"disconnected"],connecting:["connecting",T,"connected","disconnected"],connected:["connected","disconnected",T,"unreferenced"],unreferenced:["unreferenced",T],destroyed:[T]}[e.state];n&&-1!==n.indexOf(t)?e.state=t:e.s.logger.error(o("Pool with id [%s] failed attempted illegal state transition from [%s] to [%s] only following state allowed [%s]",e.id,e.state,t,n))}var x=1,E=["connect","close","error","timeout","parseError"],N=function(e,t){var n=this;if(t=t||{},!Array.isArray(e))throw new l("seedlist must be an array");if(0===e.length)throw new l("seedlist must contain at least one entry");e.forEach((function(e){if("string"!=typeof e.host||"number"!=typeof e.port)throw new l("seedlist entry must contain a host and port")})),i.call(this),this.id=x++;var r=t.localThresholdMS||15;t.acceptableLatency&&(r=t.acceptableLatency);var s=u("ReplSet",t);this.s={options:Object.assign({metadata:S(t)},t),bson:t.bson||new b([b.Binary,b.Code,b.DBRef,b.Decimal128,b.Double,b.Int32,b.Long,b.Map,b.MaxKey,b.MinKey,b.ObjectId,b.BSONRegExp,b.Symbol,b.Timestamp]),Cursor:t.cursorFactory||a,logger:s,seedlist:e,replicaSetState:new p({id:this.id,setName:t.setName,acceptableLatency:r,heartbeatFrequencyMS:t.haInterval?t.haInterval:1e4,logger:s}),connectingServers:[],haInterval:t.haInterval?t.haInterval:1e4,minHeartbeatFrequencyMS:500,disconnectHandler:t.disconnectHandler,index:0,connectOptions:{},debug:"boolean"==typeof t.debug&&t.debug},this.s.replicaSetState.on("topologyDescriptionChanged",(function(e){n.emit("topologyDescriptionChanged",e)})),this.s.logger.isWarn()&&0!==this.s.options.socketTimeout&&this.s.options.socketTimeout<this.s.haInterval&&this.s.logger.warn(o("warning socketTimeout %s is less than haInterval %s. This might cause unnecessary server reconnections due to socket timeouts",this.s.options.socketTimeout,this.s.haInterval));["joined","left"].forEach((function(e){n.s.replicaSetState.on(e,(function(t,r){n.emit(e,t,r)}))})),this.initialConnectState={connect:!1,fullsetup:!1,all:!1},this.state="disconnected",this.haTimeoutId=null,this.ismaster=null,this.intervalIds=[],this.clusterTime=null};function I(e){e.s.replicaSetState.hasPrimaryAndSecondary()&&e.s.disconnectHandler?e.s.disconnectHandler.execute():e.s.replicaSetState.hasPrimary()&&e.s.disconnectHandler?e.s.disconnectHandler.execute({executePrimary:!0}):e.s.replicaSetState.hasSecondary()&&e.s.disconnectHandler&&e.s.disconnectHandler.execute({executeSecondary:!0})}function A(e,t,n){if(0===t.length)return n();var r=t.length,o=null;function i(){0===(r-=1)&&n(o)}var s=function(e,t){return function(n){if(e.state===T||"unreferenced"===e.state)return this.destroy({force:!0}),i();if("connect"===t)if(e.s.replicaSetState.update(this)){this.lastIsMaster()&&this.lastIsMaster().ismaster&&(e.ismaster=this.lastIsMaster());for(let e=0;e<E.length;e++)this.removeAllListeners(E[e]);this.on("error",j(e,"error")),this.on("close",j(e,"close")),this.on("timeout",j(e,"timeout")),this.on("parseError",j(e,"parseError")),k(this.lastIsMaster().me,e,{}),I(e)}else this.destroy({force:!0});else"error"===t&&(o=n);I(e),i()}};function a(t,n){setTimeout((function(){if(e.state===T||"unreferenced"===e.state)return;const n=e.s.connectingServers.findIndex(e=>e.name===t);if(n>=0){return e.s.connectingServers[n].destroy({force:!0}),e.s.connectingServers.splice(n,1),i()}var r=new f(Object.assign({},e.s.options,{host:t.split(":")[0],port:parseInt(t.split(":")[1],10),reconnect:!1,monitoring:!1,parent:e}));r.once("connect",s(e,"connect")),r.once("close",s(e,"close")),r.once("timeout",s(e,"timeout")),r.once("error",s(e,"error")),r.once("parseError",s(e,"parseError")),r.on("serverOpening",t=>e.emit("serverOpening",t)),r.on("serverDescriptionChanged",t=>e.emit("serverDescriptionChanged",t)),r.on("serverClosed",t=>e.emit("serverClosed",t)),y(r,e,["commandStarted","commandSucceeded","commandFailed"]),e.s.connectingServers.push(r),r.connect(e.s.connectOptions)}),n)}for(var c=0;c<t.length;c++)a(t[c],c)}r(N,i),Object.assign(N.prototype,m),Object.defineProperty(N.prototype,"type",{enumerable:!0,get:function(){return"replset"}}),Object.defineProperty(N.prototype,"parserType",{enumerable:!0,get:function(){return b.native?"c++":"js"}}),Object.defineProperty(N.prototype,"logicalSessionTimeoutMinutes",{enumerable:!0,get:function(){return this.s.replicaSetState.logicalSessionTimeoutMinutes||null}});var k=function(e,t,n){if(!n.haInterval)for(var r=0;r<t.intervalIds.length;r++)if(t.intervalIds[r].__host===e)return;var o=n.haInterval?d:h,i=n.haInterval?n.haInterval:t.s.haInterval,s=new o((function(){if(t.state!==T&&"unreferenced"!==t.state){var n=t.s.replicaSetState.get(e);return n?function(e,t,n){var r=(new Date).getTime();P(e,"serverHeartbeatStarted",{connectionId:t.name}),t.command("admin.$cmd",{ismaster:!0},{monitoring:!0,socketTimeout:e.s.options.connectionTimeout||2e3},(function(o,i){if(e.state===T||"unreferenced"===e.state)return t.destroy({force:!0}),n(o,i);var s=(new Date).getTime()-r;t.lastUpdateTime=_(),o?(P(e,"serverHeartbeatFailed",{durationMS:s,failure:o,connectionId:t.name}),e.s.replicaSetState.remove(t)):(t.ismaster=i.result,t.ismaster.lastWrite&&t.ismaster.lastWrite.lastWriteDate&&(t.lastWriteDate=t.ismaster.lastWrite.lastWriteDate.getTime()),-1===t.lastIsMasterMS?t.lastIsMasterMS=s:t.lastIsMasterMS&&(t.lastIsMasterMS=.2*s+.8*t.lastIsMasterMS),e.s.replicaSetState.update(t)&&t.lastIsMaster()&&t.lastIsMaster().ismaster&&(e.ismaster=t.lastIsMaster()),P(e,"serverHeartbeatSucceeded",{durationMS:s,reply:i.result,connectionId:t.name})),e.s.replicaSetState.updateServerMaxStaleness(t,e.s.haInterval),n(o,i)}))}(t,n,(function(e){e||(t.state!==T&&"unreferenced"!==t.state?(t.intervalIds=t.intervalIds.filter((function(e){return e.isRunning()})),o===d?"connecting"===t.state&&(t.s.replicaSetState.hasSecondary()&&t.s.options.secondaryOnlyConnectionAllowed||t.s.replicaSetState.hasPrimary())&&(C(t,"connected"),process.nextTick((function(){t.emit("connect",t)})),M(t,{})):"disconnected"===t.state&&(t.s.replicaSetState.hasSecondary()&&t.s.options.secondaryOnlyConnectionAllowed||t.s.replicaSetState.hasPrimary())&&(C(t,"connected"),I(t),process.nextTick((function(){t.emit("reconnect",t)}))),t.initialConnectState.connect&&!t.initialConnectState.fullsetup&&t.s.replicaSetState.hasPrimaryAndSecondary()&&(t.initialConnectState.fullsetup=!0,t.initialConnectState.all=!0,process.nextTick((function(){t.emit("fullsetup",t),t.emit("all",t)})))):s.stop())})):void 0}s.stop()}),i);s.start(),s.__host=e,t.intervalIds.push(s)};function M(e,t){if(e.state!==T&&"unreferenced"!==e.state){t=t||{};var n=Object.keys(e.s.replicaSetState.set),r=t.haInterval?d:h,o=t.haInterval?t.haInterval:e.s.haInterval;if(r===d)return A(e,e.s.replicaSetState.unknownServers,(function(r){if(e.state!==T&&"unreferenced"!==e.state){if(!e.s.replicaSetState.hasPrimary()&&!e.s.options.secondaryOnlyConnectionAllowed)return r?e.emit("error",r):(e.emit("error",new l("no primary found in replicaset or invalid replica set name")),e.destroy({force:!0}));if(!e.s.replicaSetState.hasSecondary()&&e.s.options.secondaryOnlyConnectionAllowed)return r?e.emit("error",r):(e.emit("error",new l("no secondary found in replicaset or invalid replica set name")),e.destroy({force:!0}));for(var o=0;o<n.length;o++)k(n[o],e,t)}}));for(var i=0;i<n.length;i++)k(n[i],e,t);var s=e.s.replicaSetState.hasPrimary()?o:e.s.minHeartbeatFrequencyMS;e.intervalIds.push(new d(function e(t){return function(){t.state!==T&&"unreferenced"!==t.state&&A(t,t.s.replicaSetState.unknownServers,(function(){var n=t.s.replicaSetState.hasPrimary()?o:t.s.minHeartbeatFrequencyMS;t.intervalIds.push(new d(e(t),n).start())}))}}(e),s).start())}}function R(e,t){for(var n=0;n<e.length;n++)if(e[n].name.toLowerCase()===t.name.toLowerCase())return!0;e.push(t)}function j(e,t){return function(){e.state!==T&&"unreferenced"!==e.state&&(e.s.logger.isDebug()&&e.s.logger.debug(o("handleEvent %s from server %s in replset with id %s",t,this.name,e.id)),e.s.replicaSetState.remove(this),e.state!==T&&"unreferenced"!==e.state&&((e.s.replicaSetState.hasPrimary()||e.s.replicaSetState.hasSecondary()||!e.s.options.secondaryOnlyConnectionAllowed)&&e.s.replicaSetState.hasPrimary()||C(e,"disconnected"),R(e.s.connectingServers,this)))}}function D(e,t){return function(){if(e.s.logger.isDebug()&&e.s.logger.debug(o("handleInitialConnectEvent %s from server %s in replset with id %s",t,this.name,e.id)),e.state===T||"unreferenced"===e.state)return this.destroy({force:!0});if("connect"===t){var n=e.s.replicaSetState.update(this);if(!0===n){this.lastIsMaster()&&this.lastIsMaster().ismaster&&(e.ismaster=this.lastIsMaster()),e.s.logger.isDebug()&&e.s.logger.debug(o("handleInitialConnectEvent %s from server %s in replset with id %s has state [%s]",t,this.name,e.id,JSON.stringify(e.s.replicaSetState.set)));for(let e=0;e<E.length;e++)this.removeAllListeners(E[e]);this.on("error",j(e,"error")),this.on("close",j(e,"close")),this.on("timeout",j(e,"timeout")),this.on("parseError",j(e,"parseError")),function(e){const t="connecting"===e.state,n=e.s.replicaSetState.hasPrimary(),r=e.s.replicaSetState.hasSecondary(),o=e.s.options.secondaryOnlyConnectionAllowed,i=e.s.connectOptions.readPreference&&e.s.connectOptions.readPreference.equals(s.secondary);return t&&(i&&r||!i&&n)||r&&o}(e)&&(C(e,"connected"),e.initialConnectState.connect=!0,process.nextTick((function(){e.emit("connect",e)})),M(e,{}))}else{if(n instanceof l)return this.destroy({force:!0}),e.destroy({force:!0}),e.emit("error",n);this.destroy({force:!0})}}else e.emit("failed",this),R(e.s.connectingServers,this),e.s.replicaSetState.remove(this);e.initialConnectState.connect&&!e.initialConnectState.fullsetup&&e.s.replicaSetState.hasPrimaryAndSecondary()&&(e.initialConnectState.fullsetup=!0,e.initialConnectState.all=!0,process.nextTick((function(){e.emit("fullsetup",e),e.emit("all",e)})));for(var r=0;r<e.s.connectingServers.length;r++)e.s.connectingServers[r].equals(this)&&e.s.connectingServers.splice(r,1);0===e.s.connectingServers.length&&"connecting"===e.state&&M(e,{haInterval:1})}}function P(e,t,n){e.listeners(t).length>0&&e.emit(t,n)}N.prototype.connect=function(e){var t=this;this.s.connectOptions=e||{},C(this,"connecting");var n=this.s.seedlist.map((function(n){return new f(Object.assign({},t.s.options,n,e,{reconnect:!1,monitoring:!1,parent:t}))}));if(this.s.options.socketTimeout>0&&this.s.options.socketTimeout<=this.s.options.haInterval)return t.emit("error",new l(o("haInterval [%s] MS must be set to less than socketTimeout [%s] MS",this.s.options.haInterval,this.s.options.socketTimeout)));P(this,"topologyOpening",{topologyId:this.id}),function(e,t){e.s.connectingServers=e.s.connectingServers.concat(t);var n=0;function r(t,n){setTimeout((function(){e.s.replicaSetState.update(t)&&t.lastIsMaster()&&t.lastIsMaster().ismaster&&(e.ismaster=t.lastIsMaster()),t.once("close",D(e,"close")),t.once("timeout",D(e,"timeout")),t.once("parseError",D(e,"parseError")),t.once("error",D(e,"error")),t.once("connect",D(e,"connect")),t.on("serverOpening",t=>e.emit("serverOpening",t)),t.on("serverDescriptionChanged",t=>e.emit("serverDescriptionChanged",t)),t.on("serverClosed",t=>e.emit("serverClosed",t)),y(t,e,["commandStarted","commandSucceeded","commandFailed"]),t.connect(e.s.connectOptions)}),n)}for(;t.length>0;)r(t.shift(),n++)}(t,n)},N.prototype.auth=function(e,t){"function"==typeof t&&t(null,null)},N.prototype.destroy=function(e,t){"function"==typeof e&&(t=e,e={}),e=e||{};let n=this.s.connectingServers.length+1;const r=()=>{n--,n>0||(P(this,"topologyClosed",{topologyId:this.id}),"function"==typeof t&&t(null,null))};if(this.state!==T){C(this,T),this.haTimeoutId&&clearTimeout(this.haTimeoutId);for(var o=0;o<this.intervalIds.length;o++)this.intervalIds[o].stop();this.intervalIds=[],0!==n?(this.s.replicaSetState.destroy(e,r),this.s.connectingServers.forEach((function(t){t.destroy(e,r)}))):r()}else"function"==typeof t&&t(null,null)},N.prototype.unref=function(){C(this,"unreferenced"),this.s.replicaSetState.allServers().forEach((function(e){e.unref()})),clearTimeout(this.haTimeoutId)},N.prototype.lastIsMaster=function(){return this.s.options.secondaryOnlyConnectionAllowed&&!this.s.replicaSetState.hasPrimary()&&this.s.replicaSetState.hasSecondary()?this.s.replicaSetState.secondaries[0].lastIsMaster():this.s.replicaSetState.primary?this.s.replicaSetState.primary.lastIsMaster():this.ismaster},N.prototype.connections=function(){for(var e=this.s.replicaSetState.allServers(),t=[],n=0;n<e.length;n++)t=t.concat(e[n].connections());return t},N.prototype.isConnected=function(e){return(e=e||{}).readPreference&&e.readPreference.equals(s.secondary)?this.s.replicaSetState.hasSecondary():e.readPreference&&e.readPreference.equals(s.primary)?this.s.replicaSetState.hasPrimary():e.readPreference&&e.readPreference.equals(s.primaryPreferred)?this.s.replicaSetState.hasSecondary()||this.s.replicaSetState.hasPrimary():e.readPreference&&e.readPreference.equals(s.secondaryPreferred)?this.s.replicaSetState.hasSecondary()||this.s.replicaSetState.hasPrimary():!(!this.s.options.secondaryOnlyConnectionAllowed||!this.s.replicaSetState.hasSecondary())||this.s.replicaSetState.hasPrimary()},N.prototype.isDestroyed=function(){return this.state===T};function B(e,t,n){"function"==typeof t&&(n=t,t={}),t=t||{};const r=e.self,i=e.op,s=e.ns,a=e.ops;if(r.state===T)return n(new l(o("topology was destroyed")));const c=!e.retrying&&!!t.retryWrites&&t.session&&g(r)&&!t.session.inTransaction()&&void 0===t.explain;if(!r.s.replicaSetState.hasPrimary()){if(r.s.disconnectHandler)return r.s.disconnectHandler.add(i,s,a,t,n);if(!c)return n(new l("no primary server found"))}const u=(o,i)=>{if(!o)return n(null,i);if(!w(o,r))return o=v(o),n(o);if(c){return B(Object.assign({},e,{retrying:!0}),t,n)}return r.s.replicaSetState.primary&&(r.s.replicaSetState.primary.destroy(),r.s.replicaSetState.remove(r.s.replicaSetState.primary,{force:!0})),n(o)};n.operationId&&(u.operationId=n.operationId),c&&(t.session.incrementTransactionNumber(),t.willRetryWrite=c),r.s.replicaSetState.primary[i](s,a,t,u)}N.prototype.selectServer=function(e,t,n){let r,o;"function"==typeof e&&void 0===n&&(n=e,e=void 0,t={}),"function"==typeof t&&(n=t,t=e),t=t||{},r=e instanceof s?e:t.readPreference||s.primary;const i=_(),a=()=>{if(O(i)>=1e4)return void(null!=o?n(o,null):n(new l("Server selection timed out")));const e=this.s.replicaSetState.pickServer(r);if(null!=e){if(!(e instanceof f))return o=e,void setTimeout(a,1e3);this.s.debug&&this.emit("pickedServer",t.readPreference,e),n(null,e)}else setTimeout(a,1e3)};a()},N.prototype.getServers=function(){return this.s.replicaSetState.allServers()},N.prototype.insert=function(e,t,n,r){B({self:this,op:"insert",ns:e,ops:t},n,r)},N.prototype.update=function(e,t,n,r){B({self:this,op:"update",ns:e,ops:t},n,r)},N.prototype.remove=function(e,t,n,r){B({self:this,op:"remove",ns:e,ops:t},n,r)};const L=["findAndModify","insert","update","delete"];N.prototype.command=function(e,t,n,r){if("function"==typeof n&&(r=n,n=(n={})||{}),this.state===T)return r(new l(o("topology was destroyed")));var i=this,a=n.readPreference?n.readPreference:s.primary;if("primary"===a.preference&&!this.s.replicaSetState.hasPrimary()&&null!=this.s.disconnectHandler)return this.s.disconnectHandler.add("command",e,t,n,r);if("secondary"===a.preference&&!this.s.replicaSetState.hasSecondary()&&null!=this.s.disconnectHandler)return this.s.disconnectHandler.add("command",e,t,n,r);if("primary"!==a.preference&&!this.s.replicaSetState.hasSecondary()&&!this.s.replicaSetState.hasPrimary()&&null!=this.s.disconnectHandler)return this.s.disconnectHandler.add("command",e,t,n,r);var c=this.s.replicaSetState.pickServer(a);if(!(c instanceof f))return r(c);if(i.s.debug&&i.emit("pickedServer",s.primary,c),null==c)return r(new l(o("no server found that matches the provided readPreference %s",a)));const u=!n.retrying&&!!n.retryWrites&&n.session&&g(i)&&!n.session.inTransaction()&&(p=t,L.some(e=>p[e]));var p;u&&(n.session.incrementTransactionNumber(),n.willRetryWrite=u),c.command(e,t,n,(o,s)=>{if(!o)return r(null,s);if(!w(o,i))return r(o);if(u){const o=Object.assign({},n,{retrying:!0});return this.command(e,t,o,r)}return this.s.replicaSetState.primary&&(this.s.replicaSetState.primary.destroy(),this.s.replicaSetState.remove(this.s.replicaSetState.primary,{force:!0})),r(o)})},N.prototype.cursor=function(e,t,n){const r=(n=n||{}).topology||this;return new(n.cursorFactory||this.s.Cursor)(r,e,t,n)},e.exports=N},function(e,t,n){"use strict";var r=n(5).inherits,o=n(5).format,i=n(7).diff,s=n(8).EventEmitter,a=n(16),c=n(10),u=n(3).MongoError,l=n(22).Buffer,f="ReplicaSetNoPrimary",p="ReplicaSetWithPrimary",d="Unknown",h="PossiblePrimary",m="RSPrimary",g="RSSecondary",y="RSArbiter",b="RSOther",v="RSGhost",S="Unknown",w=function(e){e=e||{},s.call(this),this.topologyType=f,this.setName=e.setName,this.set={},this.id=e.id,this.setName=e.setName,this.logger=e.logger||a("ReplSet",e),this.index=0,this.acceptableLatency=e.acceptableLatency||15,this.heartbeatFrequencyMS=e.heartbeatFrequencyMS||1e4,this.primary=null,this.secondaries=[],this.arbiters=[],this.passives=[],this.ghosts=[],this.unknownServers=[],this.set={},this.maxElectionId=null,this.maxSetVersion=0,this.replicasetDescription={topologyType:"Unknown",servers:[]},this.logicalSessionTimeoutMinutes=void 0};r(w,s),w.prototype.hasPrimaryAndSecondary=function(){return null!=this.primary&&this.secondaries.length>0},w.prototype.hasPrimaryOrSecondary=function(){return this.hasPrimary()||this.hasSecondary()},w.prototype.hasPrimary=function(){return null!=this.primary},w.prototype.hasSecondary=function(){return this.secondaries.length>0},w.prototype.get=function(e){for(var t=this.allServers(),n=0;n<t.length;n++)if(t[n].name.toLowerCase()===e.toLowerCase())return t[n];return null},w.prototype.allServers=function(e){e=e||{};var t=this.primary?[this.primary]:[];return t=t.concat(this.secondaries),e.ignoreArbiters||(t=t.concat(this.arbiters)),t=t.concat(this.passives)},w.prototype.destroy=function(e,t){const n=this.secondaries.concat(this.arbiters).concat(this.passives).concat(this.ghosts);this.primary&&n.push(this.primary);let r=n.length;const o=()=>{r--,r>0||(this.secondaries=[],this.arbiters=[],this.passives=[],this.ghosts=[],this.unknownServers=[],this.set={},this.primary=null,A(this),"function"==typeof t&&t(null,null))};0!==r?n.forEach(t=>t.destroy(e,o)):o()},w.prototype.remove=function(e,t){t=t||{};var n=e.name.toLowerCase(),r=this.primary?[this.primary]:[];r=(r=(r=r.concat(this.secondaries)).concat(this.arbiters)).concat(this.passives);for(var o=0;o<r.length;o++)if(!t.force&&r[o].equals(e)&&r[o].isConnected&&r[o].isConnected())return;this.set[n]&&(this.set[n].type=S,this.set[n].electionId=null,this.set[n].setName=null,this.set[n].setVersion=null);var i=null;this.primary&&this.primary.equals(e)&&(this.primary=null,this.topologyType=f,i="primary"),i=I(e,this.secondaries)?"secondary":i,i=I(e,this.arbiters)?"arbiter":i,i=I(e,this.passives)?"secondary":i,I(e,this.ghosts),I(e,this.unknownServers),this.unknownServers.push(n),i&&this.emit("left",i,e)};const _=e=>e.arbiterOnly&&e.setName;w.prototype.update=function(e){var t=e.lastIsMaster(),n=e.name.toLowerCase();if(t){var r=Array.isArray(t.hosts)?t.hosts:[];r=(r=(r=r.concat(Array.isArray(t.arbiters)?t.arbiters:[])).concat(Array.isArray(t.passives)?t.passives:[])).map((function(e){return e.toLowerCase()}));for(var i=0;i<r.length;i++)-1!==this.unknownServers.indexOf(r[i])||this.set[r[i]]&&this.set[r[i]].type!==S||this.unknownServers.push(r[i].toLowerCase()),this.set[r[i]]||(this.set[r[i]]={type:S,electionId:null,setName:null,setVersion:null})}if(!t&&!x(t,e,this.unknownServers))return this.set[n]={type:S,setVersion:null,electionId:null,setName:null},this.set[n].type=S,this.set[n].electionId=t?t.electionId:t,this.set[n].setName=t?t.setName:t,this.set[n].setVersion=t?t.setVersion:t,-1===this.unknownServers.indexOf(e.name)&&this.unknownServers.push(n),!1;if(void 0===t.logicalSessionTimeoutMinutes||_(t)||(void 0===this.logicalSessionTimeoutMinutes||null===t.logicalSessionTimeoutMinutes?this.logicalSessionTimeoutMinutes=t.logicalSessionTimeoutMinutes:this.logicalSessionTimeoutMinutes=Math.min(this.logicalSessionTimeoutMinutes,t.logicalSessionTimeoutMinutes)),t&&"isdbgrid"===t.msg)return this.primary&&this.primary.name===n&&(this.primary=null,this.topologyType=f),!1;if(t.isreplicaset)return this.set[n]={type:v,setVersion:null,electionId:null,setName:t.setName},this.primary&&this.primary.name===n&&(this.primary=null),this.topologyType=this.primary?p:f,t.setName&&(this.setName=t.setName),!1;if(t.setName&&t.hidden||t.setName&&!t.ismaster&&!t.secondary&&!t.arbiterOnly&&!t.passive)return this.set[n]={type:b,setVersion:null,electionId:null,setName:t.setName},this.topologyType=this.primary?p:f,t.setName&&(this.setName=t.setName),!1;if(t&&t.ismaster&&!t.setName)return this.topologyType=this.primary?p:d,this.remove(e,{force:!0}),!1;if(t&&!t.ismaster&&!t.secondary&&!t.arbiterOnly)return this.remove(e,{force:!0}),!1;if(t.me&&t.me.toLowerCase()!==n)return this.logger.isWarn()&&this.logger.warn(o("the seedlist server was removed due to its address %s not matching its ismaster.me address %s",e.name,t.me)),delete this.set[n],I(e,this.unknownServers),e.destroy({force:!0}),this.primary&&!this.primary.equals(e)?this.topologyType=p:this.topologyType=f,!this.primary&&t.primary&&(this.set[t.primary.toLowerCase()]={type:h,setName:null,electionId:null,setVersion:null}),!1;if(!this.primary&&t.ismaster&&t.setName){var s=e.lastIsMaster().electionId;if(this.setName&&this.setName!==t.setName)return this.topologyType=f,new u(o("setName from ismaster does not match provided connection setName [%s] != [%s]",t.setName,this.setName));if(!this.maxElectionId&&s)this.maxElectionId=s;else if(this.maxElectionId&&s){var a=N(this.maxElectionId,s),c=e.lastIsMaster().setVersion;if(1===a)return this.topologyType=f,!1;if(0===a&&c&&c<this.maxSetVersion)return this.topologyType=f,!1;this.maxSetVersion=c,this.maxElectionId=s}return-1!==t.hosts.map((function(e){return e.toLowerCase()})).indexOf(n)?(this.primary=e,this.set[n]={type:m,setVersion:t.setVersion,electionId:t.electionId,setName:t.setName},this.topologyType=p,t.setName&&(this.setName=t.setName),I(e,this.unknownServers),I(e,this.secondaries),I(e,this.passives),this.emit("joined","primary",e)):this.topologyType=f,A(this),!0}if(t.ismaster&&t.setName){var l=this.set[this.primary.name.toLowerCase()].electionId,w=this.set[this.primary.name.toLowerCase()].setVersion,O=this.set[this.primary.name.toLowerCase()].setName;s=e.lastIsMaster().electionId,c=e.lastIsMaster().setVersion;var T=e.lastIsMaster().setName;if(this.primary.equals(e)&&O===T)return!1;if(O&&O!==T)return this.primary.equals(e)?this.topologyType=f:this.topologyType=p,!1;if(l&&s){if(1===(a=N(l,s)))return!1;if(0===a&&w>c)return!1}else if(!l&&s&&c&&c<this.maxSetVersion)return!1;if(!this.maxElectionId&&s)this.maxElectionId=s;else if(this.maxElectionId&&s){if(1===(a=N(this.maxElectionId,s)))return!1;if(0===a&&w&&c){if(c<this.maxSetVersion)return!1}else if(c<this.maxSetVersion)return!1;this.maxElectionId=s,this.maxSetVersion=c}else this.maxSetVersion=c;return this.set[this.primary.name.toLowerCase()]={type:S,setVersion:null,electionId:null,setName:null},this.emit("left","primary",this.primary),this.primary.destroy({force:!0}),this.primary=e,this.set[n]={type:m,setVersion:t.setVersion,electionId:t.electionId,setName:t.setName},this.topologyType=p,t.setName&&(this.setName=t.setName),I(e,this.unknownServers),I(e,this.secondaries),I(e,this.passives),this.emit("joined","primary",e),A(this),!0}return!this.primary&&t.primary&&(this.set[t.primary.toLowerCase()]={type:h,setVersion:null,electionId:null,setName:null}),t.secondary&&t.setName&&!x(t,e,this.secondaries)&&this.setName&&this.setName===t.setName?(E(this,g,t,e,this.secondaries),this.topologyType=this.primary?p:f,t.setName&&(this.setName=t.setName),I(e,this.unknownServers),this.primary&&this.primary.name.toLowerCase()===n&&(e.destroy({force:!0}),this.primary=null,this.emit("left","primary",e)),this.emit("joined","secondary",e),A(this),!0):_(t)&&!x(t,e,this.arbiters)&&this.setName&&this.setName===t.setName?(E(this,y,t,e,this.arbiters),this.topologyType=this.primary?p:f,t.setName&&(this.setName=t.setName),I(e,this.unknownServers),this.emit("joined","arbiter",e),A(this),!0):t.passive&&t.setName&&!x(t,e,this.passives)&&this.setName&&this.setName===t.setName?(E(this,g,t,e,this.passives),this.topologyType=this.primary?p:f,t.setName&&(this.setName=t.setName),I(e,this.unknownServers),this.primary&&this.primary.name.toLowerCase()===n&&(e.destroy({force:!0}),this.primary=null,this.emit("left","primary",e)),this.emit("joined","secondary",e),A(this),!0):this.set[n]&&this.set[n].type===m?(this.emit("left","primary",this.primary),this.primary.destroy({force:!0}),this.primary=null,this.topologyType=f,!1):(this.topologyType=this.primary?p:f,!1)},w.prototype.updateServerMaxStaleness=function(e,t){for(var n=0,r=0;r<this.secondaries.length;r++)n=Math.max(n,this.secondaries[r].lastWriteDate);e.ismaster.maxWireVersion>=5&&e.ismaster.secondary&&this.hasPrimary()?e.staleness=e.lastUpdateTime-e.lastWriteDate-(this.primary.lastUpdateTime-this.primary.lastWriteDate)+t:e.ismaster.maxWireVersion>=5&&e.ismaster.secondary&&(e.staleness=n-e.lastWriteDate+t)},w.prototype.updateSecondariesMaxStaleness=function(e){for(var t=0;t<this.secondaries.length;t++)this.updateServerMaxStaleness(this.secondaries[t],e)},w.prototype.pickServer=function(e){if("primary"===(e=e||c.primary).preference&&null!=e.maxStalenessSeconds)return new u("primary readPreference incompatible with maxStalenessSeconds");var t=this.primary?[this.primary]:[];if(t=t.concat(this.secondaries),null!=e.maxStalenessSeconds)for(var n=0;n<t.length;n++)if(t[n].ismaster.maxWireVersion<5)return new u("maxStalenessSeconds not supported by at least one of the replicaset members");if("nearest"===e.preference&&null==e.maxStalenessSeconds)return C(this,e);if("nearest"===e.preference&&null!=e.maxStalenessSeconds)return T(this,e);var r=this.secondaries;if(e.equals(c.secondary)&&0===r.length)return new u("no secondary server available");if(e.equals(c.secondaryPreferred)&&0===r.length&&null==this.primary)return new u("no secondary or primary server available");if(e.equals(c.primary)&&null==this.primary)return new u("no primary server available");if(e.equals(c.secondaryPreferred)||e.equals(c.secondary)){if(r.length>0&&null==e.maxStalenessSeconds){var o=C(this,e);if(o)return o}else if(r.length>0&&null!=e.maxStalenessSeconds&&(o=T(this,e)))return o;return e.equals(c.secondaryPreferred)?this.primary:null}if(e.equals(c.primaryPreferred)){if(o=null,this.primary)return this.primary;if(r.length>0&&null==e.maxStalenessSeconds?o=C(this,e):r.length>0&&null!=e.maxStalenessSeconds&&(o=T(this,e)),o)return o}return this.primary};var O=function(e,t){if(null==e.tags)return t;for(var n=[],r=Array.isArray(e.tags)?e.tags:[e.tags],o=0;o<r.length;o++)for(var i=r[o],s=0;s<t.length;s++){var a=t[s].lastIsMaster().tags||{},c=!0;for(var u in i)a[u]!==i[u]&&(c=!1);c&&n.push(t[s])}return n};function T(e,t){var n=[],r=1e3*t.maxStalenessSeconds;if(r<9e4)return new u("maxStalenessSeconds must be set to at least 90 seconds");e.primary&&"secondary"!==t.preference&&"secondaryPreferred"!==t.preference&&n.push(e.primary);for(var o=0;o<e.secondaries.length;o++)n.push(e.secondaries[o]);if(e.primary&&0===n.length&&"secondaryPreferred"!==t.preference&&n.push(e.primary),(n=(n=O(t,n)).filter((function(e){return e.staleness<=r}))).sort((function(e,t){return e.lastIsMasterMS-t.lastIsMasterMS})),0===n.length)return null;e.index=e.index%n.length;var i=n[e.index];return e.index=e.index+1,i}function C(e,t){var n=[];e.primary&&"secondary"!==t.preference&&"secondaryPreferred"!==t.preference&&n.push(e.primary);for(var r=0;r<e.secondaries.length;r++)n.push(e.secondaries[r]);0===n.length&&e.primary&&"secondaryPreferred"!==t.preference&&n.push(e.primary),(n=O(t,n)).sort((function(e,t){return e.lastIsMasterMS-t.lastIsMasterMS}));var o=n.length>0?n[0].lastIsMasterMS:0;if(0===(n=n.filter((function(t){return t.lastIsMasterMS<=o+e.acceptableLatency}))).length)return null;e.index=e.index%n.length;var i=n[e.index];return e.index=e.index+1,i}function x(e,t,n){for(var r=0;r<n.length;r++)if(n[r]&&n[r].name&&n[r].name.toLowerCase()===t.name.toLowerCase())return!0;return!1}function E(e,t,n,r,o){var i=r.name.toLowerCase();e.set[i].type=t,e.set[i].electionId=n?n.electionId:n,e.set[i].setName=n?n.setName:n,e.set[i].setVersion=n?n.setVersion:n,o.push(r)}function N(e,t){var n=l.from(e.toHexString(),"hex"),r=l.from(t.toHexString(),"hex");if(n===r)return 0;if("function"==typeof l.compare)return l.compare(n,r);for(var o=n.length,i=r.length,s=Math.min(o,i),a=0;a<s&&n[a]===r[a];a++);return a!==s&&(o=n[a],i=r[a]),o<i?-1:i<o?1:0}function I(e,t){for(var n=0;n<t.length;n++){if(t[n].equals&&t[n].equals(e))return t.splice(n,1),!0;if("string"==typeof t[n]&&t[n].toLowerCase()===e.name.toLowerCase())return t.splice(n,1),!0}return!1}function A(e){if(e.listeners("topologyDescriptionChanged").length>0){var t="Unknown",n=e.setName;e.hasPrimaryAndSecondary()?t="ReplicaSetWithPrimary":!e.hasPrimary()&&e.hasSecondary()&&(t="ReplicaSetNoPrimary");var r={topologyType:t,setName:n,servers:[]};if(e.hasPrimary()){var o=e.primary.getDescription();o.type="RSPrimary",r.servers.push(o)}r.servers=r.servers.concat(e.secondaries.map((function(e){var t=e.getDescription();return t.type="RSSecondary",t}))),r.servers=r.servers.concat(e.arbiters.map((function(e){var t=e.getDescription();return t.type="RSArbiter",t}))),r.servers=r.servers.concat(e.passives.map((function(e){var t=e.getDescription();return t.type="RSSecondary",t})));var s=i(e.replicasetDescription,r),a={topologyId:e.id,previousDescription:e.replicasetDescription,newDescription:r,diff:s};e.emit("topologyDescriptionChanged",a),e.replicasetDescription=r}}e.exports=w},function(e,t,n){"use strict";const r=n(5).inherits,o=n(5).format,i=n(8).EventEmitter,s=n(17).CoreCursor,a=n(16),c=n(9).retrieveBSON,u=n(3).MongoError,l=n(134),f=n(7).diff,p=n(7).cloneOptions,d=n(7).SessionMixins,h=n(7).isRetryableWritesSupported,m=n(4).relayEvents,g=c(),y=n(7).getMMAPError,b=n(4).makeClientMetadata,v=n(7).legacyIsRetryableWriteError;var S="destroying",w="destroyed";function _(e,t){var n={disconnected:["connecting",S,w,"disconnected"],connecting:["connecting",S,w,"connected","disconnected"],connected:["connected","disconnected",S,w,"unreferenced"],unreferenced:["unreferenced",S,w],destroyed:[w]}[e.state];n&&-1!==n.indexOf(t)?e.state=t:e.s.logger.error(o("Mongos with id [%s] failed attempted illegal state transition from [%s] to [%s] only following state allowed [%s]",e.id,e.state,t,n))}var O=1,T=["connect","close","error","timeout","parseError"],C=function(e,t){t=t||{},this.id=O++,Array.isArray(e)&&(e=e.reduce((e,t)=>e.find(e=>e.host===t.host&&e.port===t.port)?e:(e.push(t),e),[])),this.s={options:Object.assign({metadata:b(t)},t),bson:t.bson||new g([g.Binary,g.Code,g.DBRef,g.Decimal128,g.Double,g.Int32,g.Long,g.Map,g.MaxKey,g.MinKey,g.ObjectId,g.BSONRegExp,g.Symbol,g.Timestamp]),Cursor:t.cursorFactory||s,logger:a("Mongos",t),seedlist:e,haInterval:t.haInterval?t.haInterval:1e4,disconnectHandler:t.disconnectHandler,index:0,connectOptions:{},debug:"boolean"==typeof t.debug&&t.debug,localThresholdMS:t.localThresholdMS||15},this.s.logger.isWarn()&&0!==this.s.options.socketTimeout&&this.s.options.socketTimeout<this.s.haInterval&&this.s.logger.warn(o("warning socketTimeout %s is less than haInterval %s. This might cause unnecessary server reconnections due to socket timeouts",this.s.options.socketTimeout,this.s.haInterval)),this.state="disconnected",this.connectingProxies=[],this.connectedProxies=[],this.disconnectedProxies=[],this.index=0,this.haTimeoutId=null,this.ismaster=null,this.topologyDescription={topologyType:"Unknown",servers:[]},this.clusterTime=null,i.call(this)};function x(e,t,n){e.listeners(t).length>0&&e.emit(t,n)}r(C,i),Object.assign(C.prototype,d),Object.defineProperty(C.prototype,"type",{enumerable:!0,get:function(){return"mongos"}}),Object.defineProperty(C.prototype,"parserType",{enumerable:!0,get:function(){return g.native?"c++":"js"}}),Object.defineProperty(C.prototype,"logicalSessionTimeoutMinutes",{enumerable:!0,get:function(){return this.ismaster&&this.ismaster.logicalSessionTimeoutMinutes||null}});const E=["serverDescriptionChanged","error","close","timeout","parseError"];function N(e,t,n){t=t||{},E.forEach(t=>e.removeAllListeners(t)),e.destroy(t,n)}function I(e){return function(){e.state!==w&&e.state!==S&&(M(e.connectedProxies,e.disconnectedProxies,this),B(e),e.emit("left","mongos",this),e.emit("serverClosed",{topologyId:e.id,address:this.name}))}}function A(e,t){return function(){if(e.state===w)return B(e),M(e.connectingProxies,e.disconnectedProxies,this),this.destroy();if("connect"===t)if(e.ismaster=this.lastIsMaster(),"isdbgrid"===e.ismaster.msg){for(let t=0;t<e.connectedProxies.length;t++)if(e.connectedProxies[t].name===this.name)return M(e.connectingProxies,e.disconnectedProxies,this),B(e),this.destroy(),e.emit("failed",this);for(let e=0;e<T.length;e++)this.removeAllListeners(T[e]);this.on("error",I(e)),this.on("close",I(e)),this.on("timeout",I(e)),this.on("parseError",I(e)),M(e.connectingProxies,e.connectedProxies,this),e.emit("joined","mongos",this)}else{if(e.s.logger.isWarn()){var n="expected mongos proxy, but found replicaset member mongod for server %s";e.ismaster.hosts||(n="expected mongos proxy, but found standalone mongod for server %s"),e.s.logger.warn(o(n,this.name))}this.destroy(!0),R(e.connectingProxies,this),e.emit("left","server",this),e.emit("failed",this)}else M(e.connectingProxies,e.disconnectedProxies,this),e.emit("left","mongos",this),e.emit("failed",this);if(B(e),0===e.connectingProxies.length){if(e.connectedProxies.length>0&&"connecting"===e.state)_(e,"connected"),e.emit("connect",e),e.emit("fullsetup",e),e.emit("all",e);else if(0===e.disconnectedProxies.length)return e.s.logger.isWarn()&&e.s.logger.warn(o("no mongos proxies found in seed list, did you mean to connect to a replicaset")),e.emit("error",new u("no mongos proxies found in seed list"));!function e(t,n){if(n=n||{},t.state===w||t.state===S||"unreferenced"===t.state)return;t.haTimeoutId=setTimeout((function(){if(t.state!==w&&t.state!==S&&"unreferenced"!==t.state){t.isConnected()&&t.s.disconnectHandler&&t.s.disconnectHandler.execute();var r=t.connectedProxies.slice(0),o=r.length;if(0===r.length)return t.listeners("close").length>0&&"connecting"===t.state?t.emit("error",new u("no mongos proxy available")):t.emit("close",t),j(t,t.disconnectedProxies,(function(){t.state!==w&&t.state!==S&&"unreferenced"!==t.state&&("connecting"===t.state&&n.firstConnect?(t.emit("connect",t),t.emit("fullsetup",t),t.emit("all",t)):t.isConnected()?t.emit("reconnect",t):!t.isConnected()&&t.listeners("close").length>0&&t.emit("close",t),e(t))}));for(var i=0;i<r.length;i++)s(0,r[i],(function(){if(0===(o-=1)){if(t.state===w||t.state===S||"unreferenced"===t.state)return;j(t,t.disconnectedProxies,(function(){t.state!==w&&t.state!==S&&"unreferenced"!==t.state&&e(t)}))}}))}function s(e,n,r){var o=(new Date).getTime();x(t,"serverHeartbeatStarted",{connectionId:n.name}),n.command("admin.$cmd",{ismaster:!0},{monitoring:!0,socketTimeout:t.s.options.connectionTimeout||2e3},(function(e,i){if(t.state===w||t.state===S||"unreferenced"===t.state)return M(t.connectedProxies,t.disconnectedProxies,n),n.destroy(),r(e,i);var s=(new Date).getTime()-o;e?(x(t,"serverHeartbeatFailed",{durationMS:s,failure:e,connectionId:n.name}),M(t.connectedProxies,t.disconnectedProxies,n)):(n.ismaster=i.result,n.lastIsMasterMS=s,x(t,"serverHeartbeatSucceeded",{durationMS:s,reply:i.result,connectionId:n.name})),r(e,i)}))}}),t.s.haInterval)}(e,{firstConnect:!0})}}}function k(e,t){const n=t&&t.transaction;if(n&&n.server){if(n.server.isConnected())return n.server;n.unpinServer()}for(var r=e.connectedProxies.slice(0),o=Number.MAX_VALUE,i=0;i<r.length;i++)r[i].lastIsMasterMS<o&&(o=r[i].lastIsMasterMS);let s;return 0===(r=r.filter((function(t){if(t.lastIsMasterMS<=o+e.s.localThresholdMS&&t.isConnected())return!0}))).length?s=e.connectedProxies[0]:(s=r[e.index%r.length],e.index=(e.index+1)%r.length),n&&n.isActive&&s&&s.isConnected()&&n.pinServer(s),s}function M(e,t,n){for(var r=0;r<e.length;r++)e[r].name===n.name&&e.splice(r,1);for(r=0;r<t.length;r++)t[r].name===n.name&&t.splice(r,1);t.push(n)}function R(e,t){for(var n=0;n<e.length;n++)e[n].name===t.name&&e.splice(n,1)}function j(e,t,n){var r=t.length,o=function(e,t){return function(){if(r-=1,e.state===w||e.state===S||"unreferenced"===e.state)return M(e.connectingProxies,e.disconnectedProxies,this),this.destroy();if("connect"===t){if(e.state===w||e.state===S||"unreferenced"===e.state)return M(e.connectingProxies,e.disconnectedProxies,this),this.destroy();for(var o=0;o<T.length;o++)this.removeAllListeners(T[o]);this.on("error",I(e)),this.on("close",I(e)),this.on("timeout",I(e)),this.on("parseError",I(e)),M(e.connectingProxies,e.connectedProxies,this),B(e),e.emit("joined","mongos",this)}else M(e.connectingProxies,e.disconnectedProxies,this),this.destroy();0===r&&n()}};if(0===r)return n();function i(t,n){setTimeout((function(){if(e.state!==w&&e.state!==S&&"unreferenced"!==e.state){var n=new l(Object.assign({},e.s.options,{host:t.name.split(":")[0],port:parseInt(t.name.split(":")[1],10),reconnect:!1,monitoring:!1,parent:e}));N(t,{force:!0}),R(e.disconnectedProxies,t),m(n,e,["serverDescriptionChanged"]),e.emit("serverOpening",{topologyId:-1!==n.s.topologyId?n.s.topologyId:e.id,address:n.name}),n.once("connect",o(e,"connect")),n.once("close",o(e,"close")),n.once("timeout",o(e,"timeout")),n.once("error",o(e,"error")),n.once("parseError",o(e,"parseError")),m(n,e,["commandStarted","commandSucceeded","commandFailed"]),e.connectingProxies.push(n),n.connect(e.s.connectOptions)}}),n)}for(var s=0;s<t.length;s++)i(t[s],s)}function D(e,t,n){"function"==typeof t&&(n=t,t={}),t=t||{};const r=e.self,o=e.op,i=e.ns,s=e.ops;let a=k(r,t.session);if(!a)return n(new u("no mongos proxy available"));const c=!e.retrying&&!!t.retryWrites&&t.session&&h(r)&&!t.session.inTransaction()&&void 0===t.explain,l=(o,i)=>{if(!o)return n(null,i);if(!v(o,r)||!c)return o=y(o),n(o);if(a=k(r,t.session),!a)return n(o);return D(Object.assign({},e,{retrying:!0}),t,n)};n.operationId&&(l.operationId=n.operationId),c&&(t.session.incrementTransactionNumber(),t.willRetryWrite=c),a[o](i,s,t,l)}C.prototype.connect=function(e){var t=this;this.s.connectOptions=e||{},_(this,"connecting");var n=this.s.seedlist.map((function(n){const r=new l(Object.assign({},t.s.options,n,e,{reconnect:!1,monitoring:!1,parent:t}));return m(r,t,["serverDescriptionChanged"]),r}));x(this,"topologyOpening",{topologyId:this.id}),function(e,t){e.connectingProxies=e.connectingProxies.concat(t);var n=0;t.forEach(t=>function(t,n){setTimeout((function(){e.emit("serverOpening",{topologyId:e.id,address:t.name}),B(e),t.once("close",A(e,"close")),t.once("timeout",A(e,"timeout")),t.once("parseError",A(e,"parseError")),t.once("error",A(e,"error")),t.once("connect",A(e,"connect")),m(t,e,["commandStarted","commandSucceeded","commandFailed"]),t.connect(e.s.connectOptions)}),n)}(t,n++))}(t,n)},C.prototype.auth=function(e,t){"function"==typeof t&&t(null,null)},C.prototype.lastIsMaster=function(){return this.ismaster},C.prototype.unref=function(){_(this,"unreferenced"),this.connectedProxies.concat(this.connectingProxies).forEach((function(e){e.unref()})),clearTimeout(this.haTimeoutId)},C.prototype.destroy=function(e,t){"function"==typeof e&&(t=e,e={}),e=e||{},_(this,S),this.haTimeoutId&&clearTimeout(this.haTimeoutId);const n=this.connectedProxies.concat(this.connectingProxies);let r=n.length;const o=()=>{r--,r>0||(B(this),x(this,"topologyClosed",{topologyId:this.id}),_(this,w),"function"==typeof t&&t(null,null))};0!==r?n.forEach(t=>{this.emit("serverClosed",{topologyId:this.id,address:t.name}),N(t,e,o),M(this.connectedProxies,this.disconnectedProxies,t)}):o()},C.prototype.isConnected=function(){return this.connectedProxies.length>0},C.prototype.isDestroyed=function(){return this.state===w},C.prototype.insert=function(e,t,n,r){return"function"==typeof n&&(r=n,n=(n={})||{}),this.state===w?r(new u(o("topology was destroyed"))):this.isConnected()||null==this.s.disconnectHandler?this.isConnected()?void D({self:this,op:"insert",ns:e,ops:t},n,r):r(new u("no mongos proxy available")):this.s.disconnectHandler.add("insert",e,t,n,r)},C.prototype.update=function(e,t,n,r){return"function"==typeof n&&(r=n,n=(n={})||{}),this.state===w?r(new u(o("topology was destroyed"))):this.isConnected()||null==this.s.disconnectHandler?this.isConnected()?void D({self:this,op:"update",ns:e,ops:t},n,r):r(new u("no mongos proxy available")):this.s.disconnectHandler.add("update",e,t,n,r)},C.prototype.remove=function(e,t,n,r){return"function"==typeof n&&(r=n,n=(n={})||{}),this.state===w?r(new u(o("topology was destroyed"))):this.isConnected()||null==this.s.disconnectHandler?this.isConnected()?void D({self:this,op:"remove",ns:e,ops:t},n,r):r(new u("no mongos proxy available")):this.s.disconnectHandler.add("remove",e,t,n,r)};const P=["findAndModify","insert","update","delete"];function B(e){if(e.listeners("topologyDescriptionChanged").length>0){var t="Unknown";e.connectedProxies.length>0&&(t="Sharded");var n={topologyType:t,servers:[]},r=e.disconnectedProxies.concat(e.connectingProxies);n.servers=n.servers.concat(r.map((function(e){var t=e.getDescription();return t.type="Unknown",t}))),n.servers=n.servers.concat(e.connectedProxies.map((function(e){var t=e.getDescription();return t.type="Mongos",t})));var o=f(e.topologyDescription,n),i={topologyId:e.id,previousDescription:e.topologyDescription,newDescription:n,diff:o};o.servers.length>0&&e.emit("topologyDescriptionChanged",i),e.topologyDescription=n}}C.prototype.command=function(e,t,n,r){if("function"==typeof n&&(r=n,n=(n={})||{}),this.state===w)return r(new u(o("topology was destroyed")));var i=this,s=k(i,n.session);if((null==s||!s.isConnected())&&null!=this.s.disconnectHandler)return this.s.disconnectHandler.add("command",e,t,n,r);if(null==s)return r(new u("no mongos proxy available"));var a=p(n);a.topology=i;const c=!n.retrying&&n.retryWrites&&n.session&&h(i)&&!n.session.inTransaction()&&(l=t,P.some(e=>l[e]));var l;c&&(a.session.incrementTransactionNumber(),a.willRetryWrite=c),s.command(e,t,a,(n,o)=>{if(!n)return r(null,o);if(!v(n,i))return r(n);if(c){const n=Object.assign({},a,{retrying:!0});return this.command(e,t,n,r)}return r(n)})},C.prototype.cursor=function(e,t,n){const r=(n=n||{}).topology||this;return new(n.cursorFactory||this.s.Cursor)(r,e,t,n)},C.prototype.selectServer=function(e,t,n){"function"==typeof e&&void 0===n&&(n=e,e=void 0,t={}),"function"==typeof t&&(n=t,t=e,e=void 0);const r=k(this,(t=t||{}).session);null!=r?(this.s.debug&&this.emit("pickedServer",null,r),n(null,r)):n(new u("server selection failed"))},C.prototype.connections=function(){for(var e=[],t=0;t<this.connectedProxies.length;t++)e=e.concat(this.connectedProxies[t].connections());return e},e.exports=C},function(e,t,n){"use strict";const r=n(138),o=n(8),i=n(44).ServerDescription,s=n(13).ServerType,a=n(189).TopologyDescription,c=n(13).TopologyType,u=n(200),l=n(432).Server,f=n(4).relayEvents,p=n(10),d=n(7).isRetryableWritesSupported,h=n(17).CoreCursor,m=n(5).deprecate,g=n(9).retrieveBSON(),y=n(7).createCompressionInfo,b=n(34).ClientSession,v=n(3).MongoError,S=n(3).MongoServerSelectionError,w=n(7).resolveClusterTime,_=n(444).SrvPoller,O=n(7).getMMAPError,T=n(4).makeStateMachine,C=n(4).eachAsync,x=n(0).emitDeprecationWarning,E=n(34).ServerSessionPool,N=n(4).makeClientMetadata,I=n(94).CMAP_EVENT_NAMES,A=n(44).compareTopologyVersion,k=n(0).emitWarning,M=n(13),R=M.drainTimerQueue,j=M.clearAndRemoveTimerFrom,D=n(445),P=D.readPreferenceServerSelector,B=D.writableServerSelector;let L=0;const q=["serverHeartbeatStarted","serverHeartbeatSucceeded","serverHeartbeatFailed","commandStarted","commandSucceeded","commandFailed","monitoring"].concat(I),U=["connect","descriptionReceived","close","ended"],z=M.STATE_CLOSING,$=M.STATE_CLOSED,W=M.STATE_CONNECTING,F=M.STATE_CONNECTED,V=T({[$]:[$,W],[W]:[W,z,F,$],[F]:[F,z,$],[z]:[z,$]}),K=new Set(["autoReconnect","reconnectTries","reconnectInterval","bufferMaxEntries"]),H=Symbol("cancelled"),Y=Symbol("waitQueue");class G extends o{constructor(e,t){super(),void 0===t&&"string"!=typeof e&&(t=e,e=[],t.host&&e.push({host:t.host,port:t.port})),"string"==typeof(e=e||[])&&(e=function(e){return e.split(",").map(e=>({host:e.split(":")[0],port:e.split(":")[1]||27017}))}(e)),t=Object.assign({},M.TOPOLOGY_DEFAULTS,t),t=Object.freeze(Object.assign(t,{metadata:N(t),compression:{compressors:y(t)}})),K.forEach(e=>{t[e]&&x(`The option \`${e}\` is incompatible with the unified topology, please read more by visiting http://bit.ly/2D8WfT6`,"DeprecationWarning")});const n=function(e,t){if(t.directConnection)return c.Single;if(null==(t.replicaSet||t.setName||t.rs_name))return c.Unknown;return c.ReplicaSetNoPrimary}(0,t),o=L++,s=e.reduce((e,t)=>{t.domain_socket&&(t.host=t.domain_socket);const n=t.port?`${t.host}:${t.port}`:`${t.host}:27017`;return e.set(n,new i(n)),e},new Map);this[Y]=new r,this.s={id:o,options:t,seedlist:e,state:$,description:new a(n,s,t.replicaSet,null,null,null,t),serverSelectionTimeoutMS:t.serverSelectionTimeoutMS,heartbeatFrequencyMS:t.heartbeatFrequencyMS,minHeartbeatFrequencyMS:t.minHeartbeatFrequencyMS,Cursor:t.cursorFactory||h,bson:t.bson||new g([g.Binary,g.Code,g.DBRef,g.Decimal128,g.Double,g.Int32,g.Long,g.Map,g.MaxKey,g.MinKey,g.ObjectId,g.BSONRegExp,g.Symbol,g.Timestamp]),servers:new Map,sessionPool:new E(this),sessions:new Set,promiseLibrary:t.promiseLibrary||Promise,credentials:t.credentials,clusterTime:null,connectionTimers:new Set},t.srvHost&&(this.s.srvPoller=t.srvPoller||new _({heartbeatFrequencyMS:this.s.heartbeatFrequencyMS,srvHost:t.srvHost,logger:t.logger,loggerLevel:t.loggerLevel}),this.s.detectTopologyDescriptionChange=e=>{const t=e.previousDescription.type,n=e.newDescription.type;var r;t!==c.Sharded&&n===c.Sharded&&(this.s.handleSrvPolling=(r=this,function(e){const t=r.s.description;r.s.description=r.s.description.updateFromSrvPollingEvent(e),r.s.description!==t&&(Q(r),r.emit("topologyDescriptionChanged",new u.TopologyDescriptionChangedEvent(r.s.id,t,r.s.description)))}),this.s.srvPoller.on("srvRecordDiscovery",this.s.handleSrvPolling),this.s.srvPoller.start())},this.on("topologyDescriptionChanged",this.s.detectTopologyDescriptionChange)),this.setMaxListeners(1/0)}get description(){return this.s.description}get parserType(){return g.native?"c++":"js"}connect(e,t){if("function"==typeof e&&(t=e,e={}),e=e||{},this.s.state===F)return void("function"==typeof t&&t());var n,r;V(this,W),this.emit("topologyOpening",new u.TopologyOpeningEvent(this.s.id)),this.emit("topologyDescriptionChanged",new u.TopologyDescriptionChangedEvent(this.s.id,new a(c.Unknown),this.s.description)),n=this,r=Array.from(this.s.description.servers.values()),n.s.servers=r.reduce((e,t)=>{const r=Z(n,t);return e.set(t.address,r),e},new Map),p.translate(e);const o=e.readPreference||p.primary,i=e=>{if(e)return this.close(),void("function"==typeof t?t(e):this.emit("error",e));V(this,F),this.emit("open",e,this),this.emit("connect",this),"function"==typeof t&&t(e,this)};this.s.credentials?this.command("admin.$cmd",{ping:1},{readPreference:o},i):this.selectServer(P(o),e,i)}close(e,t){"function"==typeof e&&(t=e,e={}),"boolean"==typeof e&&(e={force:e}),e=e||{},this.s.state!==$&&this.s.state!==z?(V(this,z),ne(this[Y],new v("Topology closed")),R(this.s.connectionTimers),this.s.srvPoller&&(this.s.srvPoller.stop(),this.s.handleSrvPolling&&(this.s.srvPoller.removeListener("srvRecordDiscovery",this.s.handleSrvPolling),delete this.s.handleSrvPolling)),this.s.detectTopologyDescriptionChange&&(this.removeListener("topologyDescriptionChanged",this.s.detectTopologyDescriptionChange),delete this.s.detectTopologyDescriptionChange),this.s.sessions.forEach(e=>e.endSession()),this.s.sessionPool.endAllPooledSessions(()=>{C(Array.from(this.s.servers.values()),(t,n)=>X(t,this,e,n),e=>{this.s.servers.clear(),this.emit("topologyClosed",new u.TopologyClosedEvent(this.s.id)),V(this,$),this.emit("close"),"function"==typeof t&&t(e)})})):"function"==typeof t&&t()}selectServer(e,t,n){if("function"==typeof t)if(n=t,"function"!=typeof e){let n;t=e,e instanceof p?n=e:"string"==typeof e?n=new p(e):(p.translate(t),n=t.readPreference||p.primary),e=P(n)}else t={};t=Object.assign({},{serverSelectionTimeoutMS:this.s.serverSelectionTimeoutMS},t);const r=this.description.type===c.Sharded,o=t.session,i=o&&o.transaction;if(r&&i&&i.server)return void n(void 0,i.server);let s=e;if("object"==typeof e){const t=e.readPreference?e.readPreference:p.primary;s=P(t)}const a={serverSelector:s,transaction:i,callback:n},u=t.serverSelectionTimeoutMS;u&&(a.timer=setTimeout(()=>{a[H]=!0,a.timer=void 0;const e=new S(`Server selection timed out after ${u} ms`,this.description);a.callback(e)},u)),this[Y].push(a),re(this)}shouldCheckForSessionSupport(){return this.description.type===c.Single?!this.description.hasKnownServers:!this.description.hasDataBearingServers}hasSessionSupport(){return null!=this.description.logicalSessionTimeoutMinutes}startSession(e,t){const n=new b(this,this.s.sessionPool,e,t);return n.once("ended",()=>{this.s.sessions.delete(n)}),this.s.sessions.add(n),n}endSessions(e,t){Array.isArray(e)||(e=[e]),this.command("admin.$cmd",{endSessions:e},{readPreference:p.primaryPreferred,noResponse:!0},()=>{"function"==typeof t&&t()})}serverUpdateHandler(e){if(!this.s.description.hasServer(e.address))return;if(function(e,t){const n=e.servers.get(t.address).topologyVersion;return A(n,t.topologyVersion)>0}(this.s.description,e))return;const t=this.s.description,n=this.s.description.servers.get(e.address),r=e.$clusterTime;r&&w(this,r);const o=n&&n.equals(e);this.s.description=this.s.description.update(e),this.s.description.compatibilityError?this.emit("error",new v(this.s.description.compatibilityError)):(o||this.emit("serverDescriptionChanged",new u.ServerDescriptionChangedEvent(this.s.id,e.address,n,this.s.description.servers.get(e.address))),Q(this,e),this[Y].length>0&&re(this),o||this.emit("topologyDescriptionChanged",new u.TopologyDescriptionChangedEvent(this.s.id,t,this.s.description)))}auth(e,t){"function"==typeof e&&(t=e,e=null),"function"==typeof t&&t(null,!0)}logout(e){"function"==typeof e&&e(null,!0)}insert(e,t,n,r){ee({topology:this,op:"insert",ns:e,ops:t},n,r)}update(e,t,n,r){ee({topology:this,op:"update",ns:e,ops:t},n,r)}remove(e,t,n,r){ee({topology:this,op:"remove",ns:e,ops:t},n,r)}command(e,t,n,r){"function"==typeof n&&(r=n,n=(n={})||{}),p.translate(n);const o=n.readPreference||p.primary;this.selectServer(P(o),n,(o,i)=>{if(o)return void r(o);const s=!n.retrying&&!!n.retryWrites&&n.session&&d(this)&&!n.session.inTransaction()&&(a=t,J.some(e=>a[e]));var a;s&&(n.session.incrementTransactionNumber(),n.willRetryWrite=s),i.command(e,t,n,(o,i)=>{if(!o)return r(null,i);if(!te(o))return r(o);if(s){const o=Object.assign({},n,{retrying:!0});return this.command(e,t,o,r)}return r(o)})})}cursor(e,t,n){const r=(n=n||{}).topology||this,o=n.cursorFactory||this.s.Cursor;return p.translate(n),new o(r,e,t,n)}get clientMetadata(){return this.s.options.metadata}isConnected(){return this.s.state===F}isDestroyed(){return this.s.state===$}unref(){k("not implemented: `unref`")}lastIsMaster(){const e=Array.from(this.description.servers.values());return 0===e.length?{}:e.filter(e=>e.type!==s.Unknown)[0]||{maxWireVersion:this.description.commonWireVersion}}get logicalSessionTimeoutMinutes(){return this.description.logicalSessionTimeoutMinutes}get bson(){return this.s.bson}}Object.defineProperty(G.prototype,"clusterTime",{enumerable:!0,get:function(){return this.s.clusterTime},set:function(e){this.s.clusterTime=e}}),G.prototype.destroy=m(G.prototype.close,"destroy() is deprecated, please use close() instead");const J=["findAndModify","insert","update","delete"];function X(e,t,n,r){n=n||{},U.forEach(t=>e.removeAllListeners(t)),e.destroy(n,()=>{t.emit("serverClosed",new u.ServerClosedEvent(t.s.id,e.description.address)),q.forEach(t=>e.removeAllListeners(t)),"function"==typeof r&&r()})}function Z(e,t,n){e.emit("serverOpening",new u.ServerOpeningEvent(e.s.id,t.address));const r=new l(t,e.s.options,e);if(f(r,e,q),r.on("descriptionReceived",e.serverUpdateHandler.bind(e)),n){const t=setTimeout(()=>{j(t,e.s.connectionTimers),r.connect()},n);return e.s.connectionTimers.add(t),r}return r.connect(),r}function Q(e,t){if(t&&e.s.servers.has(t.address)){e.s.servers.get(t.address).s.description=t}for(const t of e.description.servers.values())if(!e.s.servers.has(t.address)){const n=Z(e,t);e.s.servers.set(t.address,n)}for(const t of e.s.servers){const n=t[0];if(e.description.hasServer(n))continue;const r=e.s.servers.get(n);e.s.servers.delete(n),X(r,e)}}function ee(e,t,n){"function"==typeof t&&(n=t,t={}),t=t||{};const r=e.topology,o=e.op,i=e.ns,s=e.ops,a=!e.retrying&&!!t.retryWrites&&t.session&&d(r)&&!t.session.inTransaction()&&void 0===t.explain;r.selectServer(B(),t,(r,c)=>{if(r)return void n(r,null);const u=(r,o)=>{if(!r)return n(null,o);if(!te(r))return r=O(r),n(r);if(a){return ee(Object.assign({},e,{retrying:!0}),t,n)}return n(r)};n.operationId&&(u.operationId=n.operationId),a&&(t.session.incrementTransactionNumber(),t.willRetryWrite=a),c[o](i,s,t,u)})}function te(e){return e instanceof v&&e.hasErrorLabel("RetryableWriteError")}function ne(e,t){for(;e.length;){const n=e.shift();clearTimeout(n.timer),n[H]||n.callback(t)}}function re(e){if(e.s.state===$)return void ne(e[Y],new v("Topology is closed, please connect"));const t=Array.from(e.description.servers.values()),n=e[Y].length;for(let o=0;o<n&&e[Y].length;++o){const n=e[Y].shift();if(n[H])continue;let o;try{const r=n.serverSelector;o=r?r(e.description,t):t}catch(e){clearTimeout(n.timer),n.callback(e);continue}if(0===o.length){e[Y].push(n);continue}const i=(r=o)[Math.floor(Math.random()*r.length)],s=e.s.servers.get(i.address),a=n.transaction;e.description.type===c.Sharded&&a&&a.isActive&&a.pinServer(s),clearTimeout(n.timer),n.callback(void 0,s)}var r;e[Y].length>0&&e.s.servers.forEach(e=>process.nextTick(()=>e.requestCheck()))}e.exports={Topology:G}},function(e,t,n){"use strict";const r=n(8),o=n(433).ConnectionPool,i=n(94).CMAP_EVENT_NAMES,s=n(3).MongoError,a=n(4).relayEvents,c=n(9).retrieveBSON(),u=n(16),l=n(44).ServerDescription,f=n(44).compareTopologyVersion,p=n(10),d=n(443).Monitor,h=n(3).MongoNetworkError,m=n(3).MongoNetworkTimeoutError,g=n(4).collationNotSupported,y=n(9).debugOptions,b=n(3).isSDAMUnrecoverableError,v=n(3).isRetryableWriteError,S=n(3).isNodeShuttingDownError,w=n(3).isNetworkErrorBeforeHandshake,_=n(4).maxWireVersion,O=n(4).makeStateMachine,T=n(13),C=T.ServerType,x=n(54).isTransactionCommand,E=["reconnect","reconnectTries","reconnectInterval","emitError","cursorFactory","host","port","size","keepAlive","keepAliveInitialDelay","noDelay","connectionTimeout","checkServerIdentity","socketTimeout","ssl","ca","crl","cert","key","rejectUnauthorized","promoteLongs","promoteValues","promoteBuffers","servername"],N=T.STATE_CLOSING,I=T.STATE_CLOSED,A=T.STATE_CONNECTING,k=T.STATE_CONNECTED,M=O({[I]:[I,A],[A]:[A,N,k,I],[k]:[k,N,I],[N]:[N,I]}),R=Symbol("monitor");class j extends r{constructor(e,t,n){super(),this.s={description:e,options:t,logger:u("Server",t),bson:t.bson||new c([c.Binary,c.Code,c.DBRef,c.Decimal128,c.Double,c.Int32,c.Long,c.Map,c.MaxKey,c.MinKey,c.ObjectId,c.BSONRegExp,c.Symbol,c.Timestamp]),state:I,credentials:t.credentials,topology:n};const r=Object.assign({host:this.description.host,port:this.description.port,bson:this.s.bson},t);this.s.pool=new o(r),a(this.s.pool,this,["commandStarted","commandSucceeded","commandFailed"].concat(i)),this.s.pool.on("clusterTimeReceived",e=>{this.clusterTime=e}),this[R]=new d(this,this.s.options),a(this[R],this,["serverHeartbeatStarted","serverHeartbeatSucceeded","serverHeartbeatFailed","monitoring"]),this[R].on("resetConnectionPool",()=>{this.s.pool.clear()}),this[R].on("resetServer",e=>B(this,e)),this[R].on("serverHeartbeatSucceeded",e=>{this.emit("descriptionReceived",new l(this.description.address,e.reply,{roundTripTime:D(this.description.roundTripTime,e.duration)})),this.s.state===A&&(M(this,k),this.emit("connect",this))})}get description(){return this.s.description}get name(){return this.s.description.address}get autoEncrypter(){return this.s.options&&this.s.options.autoEncrypter?this.s.options.autoEncrypter:null}connect(){this.s.state===I&&(M(this,A),this[R].connect())}destroy(e,t){"function"==typeof e&&(t=e,e={}),e=Object.assign({},{force:!1},e),this.s.state!==I?(M(this,N),this[R].close(),this.s.pool.close(e,e=>{M(this,I),this.emit("closed"),"function"==typeof t&&t(e)})):"function"==typeof t&&t()}requestCheck(){this[R].requestCheck()}command(e,t,n,r){if("function"==typeof n&&(r=n,n=(n={})||{}),this.s.state===N||this.s.state===I)return void r(new s("server is closed"));const o=function(e,t){if(t.readPreference&&!(t.readPreference instanceof p))return new s("readPreference must be an instance of ReadPreference")}(0,n);if(o)return r(o);n=Object.assign({},n,{wireProtocolCommand:!1}),this.s.logger.isDebug()&&this.s.logger.debug(`executing command [${JSON.stringify({ns:e,cmd:t,options:y(E,n)})}] against ${this.name}`),g(this,t)?r(new s(`server ${this.name} does not support collation`)):this.s.pool.withConnection((r,o,i)=>{if(r)return B(this,r),i(r);o.command(e,t,n,q(this,o,t,n,i))},r)}query(e,t,n,r,o){this.s.state!==N&&this.s.state!==I?this.s.pool.withConnection((o,i,s)=>{if(o)return B(this,o),s(o);i.query(e,t,n,r,q(this,i,t,r,s))},o):o(new s("server is closed"))}getMore(e,t,n,r,o){this.s.state!==N&&this.s.state!==I?this.s.pool.withConnection((o,i,s)=>{if(o)return B(this,o),s(o);i.getMore(e,t,n,r,q(this,i,null,r,s))},o):o(new s("server is closed"))}killCursors(e,t,n){this.s.state!==N&&this.s.state!==I?this.s.pool.withConnection((n,r,o)=>{if(n)return B(this,n),o(n);r.killCursors(e,t,q(this,r,null,void 0,o))},n):"function"==typeof n&&n(new s("server is closed"))}insert(e,t,n,r){P({server:this,op:"insert",ns:e,ops:t},n,r)}update(e,t,n,r){P({server:this,op:"update",ns:e,ops:t},n,r)}remove(e,t,n,r){P({server:this,op:"remove",ns:e,ops:t},n,r)}}function D(e,t){if(-1===e)return t;return.2*t+.8*e}function P(e,t,n){"function"==typeof t&&(n=t,t={}),t=t||{};const r=e.server,o=e.op,i=e.ns,a=Array.isArray(e.ops)?e.ops:[e.ops];r.s.state!==N&&r.s.state!==I?g(r,t)?n(new s(`server ${r.name} does not support collation`)):!(t.writeConcern&&0===t.writeConcern.w||_(r)<5)||"update"!==o&&"remove"!==o||!a.find(e=>e.hint)?r.s.pool.withConnection((e,n,s)=>{if(e)return B(r,e),s(e);n[o](i,a,t,q(r,n,a,t,s))},n):n(new s(`servers < 3.4 do not support hint on ${o}`)):n(new s("server is closed"))}function B(e,t){t instanceof h&&!(t instanceof m)&&e[R].reset(),e.emit("descriptionReceived",new l(e.description.address,null,{error:t,topologyVersion:t&&t.topologyVersion?t.topologyVersion:e.description.topologyVersion}))}function L(e,t){return e&&e.inTransaction()&&!x(t)}function q(e,t,n,r,o){const i=r&&r.session;return function(r,s){r&&!function(e,t){return t.generation!==e.generation}(e.s.pool,t)&&(r instanceof h?(i&&!i.hasEnded&&(i.serverSession.isDirty=!0),function(e){return e.description.maxWireVersion>=6&&e.description.logicalSessionTimeoutMinutes&&e.description.type!==C.Standalone}(e)&&!L(i,n)&&r.addErrorLabel("RetryableWriteError"),r instanceof m&&!w(r)||(B(e,r),e.s.pool.clear())):(_(e)<9&&v(r)&&!L(i,n)&&r.addErrorLabel("RetryableWriteError"),b(r)&&function(e,t){const n=t.topologyVersion,r=e.description.topologyVersion;return f(r,n)<0}(e,r)&&((_(e)<=7||S(r))&&e.s.pool.clear(),B(e,r),process.nextTick(()=>e.requestCheck())))),o(r,s)}}Object.defineProperty(j.prototype,"clusterTime",{get:function(){return this.s.topology.clusterTime},set:function(e){this.s.topology.clusterTime=e}}),e.exports={Server:j}},function(e,t,n){"use strict";const r=n(138),o=n(8).EventEmitter,i=n(16),s=n(0).makeCounter,a=n(3).MongoError,c=n(201).Connection,u=n(4).eachAsync,l=n(135),f=n(4).relayEvents,p=n(442),d=p.PoolClosedError,h=p.WaitQueueTimeoutError,m=n(94),g=m.ConnectionPoolCreatedEvent,y=m.ConnectionPoolClosedEvent,b=m.ConnectionCreatedEvent,v=m.ConnectionReadyEvent,S=m.ConnectionClosedEvent,w=m.ConnectionCheckOutStartedEvent,_=m.ConnectionCheckOutFailedEvent,O=m.ConnectionCheckedOutEvent,T=m.ConnectionCheckedInEvent,C=m.ConnectionPoolClearedEvent,x=Symbol("logger"),E=Symbol("connections"),N=Symbol("permits"),I=Symbol("minPoolSizeTimer"),A=Symbol("generation"),k=Symbol("connectionCounter"),M=Symbol("cancellationToken"),R=Symbol("waitQueue"),j=Symbol("cancelled"),D=new Set(["ssl","bson","connectionType","monitorCommands","socketTimeout","credentials","compression","host","port","localAddress","localPort","family","hints","lookup","path","ca","cert","sigalgs","ciphers","clientCertEngine","crl","dhparam","ecdhCurve","honorCipherOrder","key","privateKeyEngine","privateKeyIdentifier","maxVersion","minVersion","passphrase","pfx","secureOptions","secureProtocol","sessionIdContext","allowHalfOpen","rejectUnauthorized","pskCallback","ALPNProtocols","servername","checkServerIdentity","session","minDHSize","secureContext","maxPoolSize","minPoolSize","maxIdleTimeMS","waitQueueTimeoutMS"]);function P(e,t){return t.generation!==e[A]}function B(e,t){return!!(e.options.maxIdleTimeMS&&t.idleTime>e.options.maxIdleTimeMS)}function L(e,t){const n=Object.assign({id:e[k].next().value,generation:e[A]},e.options);e[N]--,l(n,e[M],(n,r)=>{if(n)return e[N]++,e[x].debug(`connection attempt failed with error [${JSON.stringify(n)}]`),void("function"==typeof t&&t(n));e.closed?r.destroy({force:!0}):(f(r,e,["commandStarted","commandFailed","commandSucceeded","clusterTimeReceived"]),e.emit("connectionCreated",new b(e,r)),r.markAvailable(),e.emit("connectionReady",new v(e,r)),"function"!=typeof t?(e[E].push(r),process.nextTick(()=>U(e))):t(void 0,r))})}function q(e,t,n){e.emit("connectionClosed",new S(e,t,n)),e[N]++,process.nextTick(()=>t.destroy())}function U(e){if(e.closed)return;for(;e.waitQueueSize;){const t=e[R].peekFront();if(t[j]){e[R].shift();continue}if(!e.availableConnectionCount)break;const n=e[E].shift(),r=P(e,n),o=B(e,n);if(!r&&!o&&!n.closed)return e.emit("connectionCheckedOut",new O(e,n)),clearTimeout(t.timer),e[R].shift(),void t.callback(void 0,n);const i=n.closed?"error":r?"stale":"idle";q(e,n,i)}const t=e.options.maxPoolSize;e.waitQueueSize&&(t<=0||e.totalConnectionCount<t)&&L(e,(t,n)=>{const r=e[R].shift();null==r||r[j]?null==t&&e[E].push(n):(t?e.emit("connectionCheckOutFailed",new _(e,t)):e.emit("connectionCheckedOut",new O(e,n)),clearTimeout(r.timer),r.callback(t,n))})}e.exports={ConnectionPool:class extends o{constructor(e){if(super(),e=e||{},this.closed=!1,this.options=function(e,t){const n=Array.from(D).reduce((t,n)=>(Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]),t),{});return Object.freeze(Object.assign({},t,n))}(e,{connectionType:c,maxPoolSize:"number"==typeof e.maxPoolSize?e.maxPoolSize:100,minPoolSize:"number"==typeof e.minPoolSize?e.minPoolSize:0,maxIdleTimeMS:"number"==typeof e.maxIdleTimeMS?e.maxIdleTimeMS:0,waitQueueTimeoutMS:"number"==typeof e.waitQueueTimeoutMS?e.waitQueueTimeoutMS:0,autoEncrypter:e.autoEncrypter,metadata:e.metadata}),e.minSize>e.maxSize)throw new TypeError("Connection pool minimum size must not be greater than maxiumum pool size");this[x]=i("ConnectionPool",e),this[E]=new r,this[N]=this.options.maxPoolSize,this[I]=void 0,this[A]=0,this[k]=s(1),this[M]=new o,this[M].setMaxListeners(1/0),this[R]=new r,process.nextTick(()=>{this.emit("connectionPoolCreated",new g(this)),function e(t){if(t.closed||0===t.options.minPoolSize)return;const n=t.options.minPoolSize;for(let e=t.totalConnectionCount;e<n;++e)L(t);t[I]=setTimeout(()=>e(t),10)}(this)})}get address(){return`${this.options.host}:${this.options.port}`}get generation(){return this[A]}get totalConnectionCount(){return this[E].length+(this.options.maxPoolSize-this[N])}get availableConnectionCount(){return this[E].length}get waitQueueSize(){return this[R].length}checkOut(e){if(this.emit("connectionCheckOutStarted",new w(this)),this.closed)return this.emit("connectionCheckOutFailed",new _(this,"poolClosed")),void e(new d(this));const t={callback:e},n=this,r=this.options.waitQueueTimeoutMS;r&&(t.timer=setTimeout(()=>{t[j]=!0,t.timer=void 0,n.emit("connectionCheckOutFailed",new _(n,"timeout")),t.callback(new h(n))},r)),this[R].push(t),process.nextTick(()=>U(this))}checkIn(e){const t=this.closed,n=P(this,e),r=!!(t||n||e.closed);if(r||(e.markAvailable(),this[E].push(e)),this.emit("connectionCheckedIn",new T(this,e)),r){q(this,e,e.closed?"error":t?"poolClosed":"stale")}process.nextTick(()=>U(this))}clear(){this[A]+=1,this.emit("connectionPoolCleared",new C(this))}close(e,t){if("function"==typeof e&&(t=e),e=Object.assign({force:!1},e),this.closed)return t();for(this[M].emit("cancel");this.waitQueueSize;){const e=this[R].pop();clearTimeout(e.timer),e[j]||e.callback(new a("connection pool closed"))}this[I]&&clearTimeout(this[I]),"function"==typeof this[k].return&&this[k].return(),this.closed=!0,u(this[E].toArray(),(t,n)=>{this.emit("connectionClosed",new S(this,t,"poolClosed")),t.destroy(e,n)},e=>{this[E].clear(),this.emit("connectionPoolClosed",new y(this)),t(e)})}withConnection(e,t){this.checkOut((n,r)=>{e(n,r,(e,n)=>{"function"==typeof t&&(e?t(e):t(void 0,n)),r&&this.checkIn(r)})})}}}},function(e,t,n){"use strict";const r=n(18).Duplex,o=n(202),i=n(3).MongoParseError,s=n(30).decompress,a=n(21).Response,c=n(45).BinMsg,u=n(3).MongoError,l=n(6).opcodes.OP_COMPRESSED,f=n(6).opcodes.OP_MSG,p=n(6).MESSAGE_HEADER_SIZE,d=n(6).COMPRESSION_DETAILS_SIZE,h=n(6).opcodes,m=n(30).compress,g=n(30).compressorIDs,y=n(30).uncompressibleCommands,b=n(45).Msg,v=Symbol("buffer");e.exports=class extends r{constructor(e){super(e=e||{}),this.bson=e.bson,this.maxBsonMessageSize=e.maxBsonMessageSize||67108864,this[v]=new o}_write(e,t,n){this[v].append(e),function e(t,n){const r=t[v];if(r.length<4)return void n();const o=r.readInt32LE(0);if(o<0)return void n(new i(`Invalid message size: ${o}`));if(o>t.maxBsonMessageSize)return void n(new i(`Invalid message size: ${o}, max allowed: ${t.maxBsonMessageSize}`));if(o>r.length)return void n();const d=r.slice(0,o);r.consume(o);const h={length:d.readInt32LE(0),requestId:d.readInt32LE(4),responseTo:d.readInt32LE(8),opCode:d.readInt32LE(12)};let m=h.opCode===f?c:a;const g=t.responseOptions;if(h.opCode!==l){const o=d.slice(p);return t.emit("message",new m(t.bson,d,h,o,g)),void(r.length>=4?e(t,n):n())}h.fromCompressed=!0,h.opCode=d.readInt32LE(p),h.length=d.readInt32LE(p+4);const y=d[p+8],b=d.slice(p+9);m=h.opCode===f?c:a,s(y,b,(o,i)=>{o?n(o):i.length===h.length?(t.emit("message",new m(t.bson,d,h,i,g)),r.length>=4?e(t,n):n()):n(new u("Decompressing a compressed message from the server failed. The message is corrupt."))})}(this,n)}_read(){}writeCommand(e,t){if(!(t&&!!t.agreedCompressor)||!function(e){const t=e instanceof b?e.command:e.query,n=Object.keys(t)[0];return!y.has(n)}(e)){const t=e.toBin();return void this.push(Array.isArray(t)?Buffer.concat(t):t)}const n=Buffer.concat(e.toBin()),r=n.slice(p),o=n.readInt32LE(12);m({options:t},r,(n,i)=>{if(n)return void t.cb(n,null);const s=Buffer.alloc(p);s.writeInt32LE(p+d+i.length,0),s.writeInt32LE(e.requestId,4),s.writeInt32LE(0,8),s.writeInt32LE(h.OP_COMPRESSED,12);const a=Buffer.alloc(d);a.writeInt32LE(o,0),a.writeInt32LE(r.length,4),a.writeUInt8(g[t.agreedCompressor],8),this.push(Buffer.concat([s,a,i]))})}}},function(e,t,n){var r=n(18);"disable"===process.env.READABLE_STREAM&&r?(e.exports=r,(t=e.exports=r.Readable).Readable=r.Readable,t.Writable=r.Writable,t.Duplex=r.Duplex,t.Transform=r.Transform,t.PassThrough=r.PassThrough,t.Stream=r):((t=e.exports=n(203)).Stream=r||t,t.Readable=t,t.Writable=n(206),t.Duplex=n(47),t.Transform=n(208),t.PassThrough=n(440))},function(e,t){var n={}.toString;e.exports=Array.isArray||function(e){return"[object Array]"==n.call(e)}},function(e,t){"function"==typeof Object.create?e.exports=function(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:e.exports=function(e,t){if(t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}}},function(e,t,n){"use strict";var r=n(93).Buffer,o=n(5);e.exports=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.head=null,this.tail=null,this.length=0}return e.prototype.push=function(e){var t={data:e,next:null};this.length>0?this.tail.next=t:this.head=t,this.tail=t,++this.length},e.prototype.unshift=function(e){var t={data:e,next:this.head};0===this.length&&(this.tail=t),this.head=t,++this.length},e.prototype.shift=function(){if(0!==this.length){var e=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,e}},e.prototype.clear=function(){this.head=this.tail=null,this.length=0},e.prototype.join=function(e){if(0===this.length)return"";for(var t=this.head,n=""+t.data;t=t.next;)n+=e+t.data;return n},e.prototype.concat=function(e){if(0===this.length)return r.alloc(0);if(1===this.length)return this.head.data;for(var t,n,o,i=r.allocUnsafe(e>>>0),s=this.head,a=0;s;)t=s.data,n=i,o=a,t.copy(n,o),a+=s.data.length,s=s.next;return i},e}(),o&&o.inspect&&o.inspect.custom&&(e.exports.prototype[o.inspect.custom]=function(){var e=o.inspect({length:this.length});return this.constructor.name+" "+e})},function(e,t,n){e.exports=n(5).deprecate},function(e,t,n){"use strict";e.exports=i;var r=n(208),o=Object.create(n(57));function i(e){if(!(this instanceof i))return new i(e);r.call(this,e)}o.inherits=n(58),o.inherits(i,r),i.prototype._transform=function(e,t,n){n(null,e)}},function(e,t,n){"use strict";const r=n(44).parseServerType,o=["minWireVersion","maxWireVersion","maxBsonObjectSize","maxMessageSizeBytes","maxWriteBatchSize","__nodejs_mock_server__"];e.exports={StreamDescription:class{constructor(e,t){this.address=e,this.type=r(null),this.minWireVersion=void 0,this.maxWireVersion=void 0,this.maxBsonObjectSize=16777216,this.maxMessageSizeBytes=48e6,this.maxWriteBatchSize=1e5,this.compressors=t&&t.compression&&Array.isArray(t.compression.compressors)?t.compression.compressors:[]}receiveResponse(e){this.type=r(e),o.forEach(t=>{void 0!==e[t]&&(this[t]=e[t])}),e.compression&&(this.compressor=this.compressors.filter(t=>-1!==e.compression.indexOf(t))[0])}}}},function(e,t,n){"use strict";const r=n(3).MongoError;e.exports={PoolClosedError:class extends r{constructor(e){super("Attempted to check out a connection from closed connection pool"),this.name="MongoPoolClosedError",this.address=e.address}},WaitQueueTimeoutError:class extends r{constructor(e){super("Timed out while checking out a connection from connection pool"),this.name="MongoWaitQueueTimeoutError",this.address=e.address}}}},function(e,t,n){"use strict";const r=n(13).ServerType,o=n(8),i=n(135),s=n(201).Connection,a=n(13),c=n(4).makeStateMachine,u=n(3).MongoNetworkError,l=n(9).retrieveBSON(),f=n(0).makeInterruptableAsyncInterval,p=n(0).calculateDurationInMs,d=n(0).now,h=n(200),m=h.ServerHeartbeatStartedEvent,g=h.ServerHeartbeatSucceededEvent,y=h.ServerHeartbeatFailedEvent,b=Symbol("server"),v=Symbol("monitorId"),S=Symbol("connection"),w=Symbol("cancellationToken"),_=Symbol("rttPinger"),O=Symbol("roundTripTime"),T=a.STATE_CLOSED,C=a.STATE_CLOSING,x=c({[C]:[C,"idle",T],[T]:[T,"monitoring"],idle:["idle","monitoring",C],monitoring:["monitoring","idle",C]}),E=new Set([C,T,"monitoring"]);function N(e){return e.s.state===T||e.s.state===C}function I(e){e[v]&&(e[v].stop(),e[v]=null),e[_]&&(e[_].close(),e[_]=void 0),e[w].emit("cancel"),e[v]&&(clearTimeout(e[v]),e[v]=void 0),e[S]&&e[S].destroy({force:!0})}function A(e,t){let n=d();function r(r){e[S]&&(e[S].destroy({force:!0}),e[S]=void 0),e.emit("serverHeartbeatFailed",new y(p(n),r,e.address)),e.emit("resetServer",r),e.emit("resetConnectionPool"),t(r)}if(e.emit("serverHeartbeatStarted",new m(e.address)),null!=e[S]&&!e[S].closed){const i=e.options.connectTimeoutMS,s=e.options.heartbeatFrequencyMS,a=e[b].description.topologyVersion,c=null!=a,u={ismaster:!0},f={socketTimeout:i};return c&&(u.maxAwaitTimeMS=s,u.topologyVersion={processId:(o=a).processId,counter:l.Long.fromNumber(o.counter)},i&&(f.socketTimeout=i+s),f.exhaustAllowed=!0,null==e[_]&&(e[_]=new M(e[w],e.connectOptions))),void e[S].command("admin.$cmd",u,f,(o,i)=>{if(o)return void r(o);const s=i.result,a=e[_],u=c&&a?a.roundTripTime:p(n);e.emit("serverHeartbeatSucceeded",new g(u,s,e.address)),c&&s.topologyVersion?(e.emit("serverHeartbeatStarted",new m(e.address)),n=d()):(e[_]&&(e[_].close(),e[_]=void 0),t(void 0,s))})}var o;i(e.connectOptions,e[w],(o,i)=>{if(i&&N(e))i.destroy({force:!0});else{if(o)return e[S]=void 0,o instanceof u||e.emit("resetConnectionPool"),void r(o);e[S]=i,e.emit("serverHeartbeatSucceeded",new g(p(n),i.ismaster,e.address)),t(void 0,i.ismaster)}})}function k(e){return t=>{function n(){N(e)||x(e,"idle"),t()}x(e,"monitoring"),process.nextTick(()=>e.emit("monitoring",e[b])),A(e,(t,o)=>{if(t&&e[b].description.type===r.Unknown)return e.emit("resetServer",t),n();o&&o.topologyVersion&&setTimeout(()=>{N(e)||e[v].wake()}),n()})}}class M{constructor(e,t){this[S]=null,this[w]=e,this[O]=0,this.closed=!1;const n=t.heartbeatFrequencyMS;this[v]=setTimeout(()=>function e(t,n){const r=d(),o=t[w],s=n.heartbeatFrequencyMS;if(t.closed)return;function a(o){t.closed?o.destroy({force:!0}):(null==t[S]&&(t[S]=o),t[O]=p(r),t[v]=setTimeout(()=>e(t,n),s))}if(null==t[S])return void i(n,o,(e,n)=>{if(e)return t[S]=void 0,void(t[O]=0);a(n)});t[S].command("admin.$cmd",{ismaster:1},e=>{if(e)return t[S]=void 0,void(t[O]=0);a()})}(this,t),n)}get roundTripTime(){return this[O]}close(){this.closed=!0,clearTimeout(this[v]),this[v]=void 0,this[S]&&this[S].destroy({force:!0})}}e.exports={Monitor:class extends o{constructor(e,t){super(t),this[b]=e,this[S]=void 0,this[w]=new o,this[w].setMaxListeners(1/0),this[v]=null,this.s={state:T},this.address=e.description.address,this.options=Object.freeze({connectTimeoutMS:"number"==typeof t.connectionTimeout?t.connectionTimeout:"number"==typeof t.connectTimeoutMS?t.connectTimeoutMS:1e4,heartbeatFrequencyMS:"number"==typeof t.heartbeatFrequencyMS?t.heartbeatFrequencyMS:1e4,minHeartbeatFrequencyMS:"number"==typeof t.minHeartbeatFrequencyMS?t.minHeartbeatFrequencyMS:500});const n=Object.assign({id:"<monitor>",host:e.description.host,port:e.description.port,bson:e.s.bson,connectionType:s},e.s.options,this.options,{raw:!1,promoteLongs:!0,promoteValues:!0,promoteBuffers:!0});delete n.credentials,delete n.autoEncrypter,this.connectOptions=Object.freeze(n)}connect(){if(this.s.state!==T)return;const e=this.options.heartbeatFrequencyMS,t=this.options.minHeartbeatFrequencyMS;this[v]=f(k(this),{interval:e,minInterval:t,immediate:!0})}requestCheck(){E.has(this.s.state)||this[v].wake()}reset(){const e=this[b].description.topologyVersion;if(N(this)||null==e)return;x(this,C),I(this),x(this,"idle");const t=this.options.heartbeatFrequencyMS,n=this.options.minHeartbeatFrequencyMS;this[v]=f(k(this),{interval:t,minInterval:n})}close(){N(this)||(x(this,C),I(this),this.emit("close"),x(this,T))}}}},function(e,t,n){"use strict";const r=n(16),o=n(8).EventEmitter,i=n(87);class s{constructor(e){this.srvRecords=e}addresses(){return new Set(this.srvRecords.map(e=>`${e.name}:${e.port}`))}}e.exports.SrvPollingEvent=s,e.exports.SrvPoller=class extends o{constructor(e){if(super(),!e||!e.srvHost)throw new TypeError("options for SrvPoller must exist and include srvHost");this.srvHost=e.srvHost,this.rescanSrvIntervalMS=6e4,this.heartbeatFrequencyMS=e.heartbeatFrequencyMS||1e4,this.logger=r("srvPoller",e),this.haMode=!1,this.generation=0,this._timeout=null}get srvAddress(){return`_mongodb._tcp.${this.srvHost}`}get intervalMS(){return this.haMode?this.heartbeatFrequencyMS:this.rescanSrvIntervalMS}start(){this._timeout||this.schedule()}stop(){this._timeout&&(clearTimeout(this._timeout),this.generation+=1,this._timeout=null)}schedule(){clearTimeout(this._timeout),this._timeout=setTimeout(()=>this._poll(),this.intervalMS)}success(e){this.haMode=!1,this.schedule(),this.emit("srvRecordDiscovery",new s(e))}failure(e,t){this.logger.warn(e,t),this.haMode=!0,this.schedule()}parentDomainMismatch(e){this.logger.warn(`parent domain mismatch on SRV record (${e.name}:${e.port})`,e)}_poll(){const e=this.generation;i.resolveSrv(this.srvAddress,(t,n)=>{if(e!==this.generation)return;if(t)return void this.failure("DNS error",t);const r=[];n.forEach(e=>{!function(e,t){const n=/^.*?\./,r=`.${e.replace(n,"")}`,o=`.${t.replace(n,"")}`;return r.endsWith(o)}(e.name,this.srvHost)?this.parentDomainMismatch(e):r.push(e)}),r.length?this.success(r):this.failure("No valid addresses found at host")})}}},function(e,t,n){"use strict";const r=n(13).ServerType,o=n(13).TopologyType,i=n(10),s=n(3).MongoError;function a(e,t){const n=Object.keys(e),r=Object.keys(t);for(let o=0;o<n.length;++o){const i=n[o];if(-1===r.indexOf(i)||t[i]!==e[i])return!1}return!0}function c(e,t){const n=t.reduce((e,t)=>-1===e?t.roundTripTime:Math.min(t.roundTripTime,e),-1),r=n+e.localThresholdMS;return t.reduce((e,t)=>(t.roundTripTime<=r&&t.roundTripTime>=n&&e.push(t),e),[])}function u(e){return e.type===r.RSPrimary}function l(e){return e.type===r.RSSecondary}function f(e){return e.type===r.RSSecondary||e.type===r.RSPrimary}function p(e){return e.type!==r.Unknown}e.exports={writableServerSelector:function(){return function(e,t){return c(e,t.filter(e=>e.isWritable))}},readPreferenceServerSelector:function(e){if(!e.isValid())throw new TypeError("Invalid read preference specified");return function(t,n){const r=t.commonWireVersion;if(r&&e.minWireVersion&&e.minWireVersion>r)throw new s(`Minimum wire version '${e.minWireVersion}' required, but found '${r}'`);if(t.type===o.Unknown)return[];if(t.type===o.Single||t.type===o.Sharded)return c(t,n.filter(p));const d=e.mode;if(d===i.PRIMARY)return n.filter(u);if(d===i.PRIMARY_PREFERRED){const e=n.filter(u);if(e.length)return e}const h=d===i.NEAREST?f:l,m=c(t,function(e,t){if(null==e.tags||Array.isArray(e.tags)&&0===e.tags.length)return t;for(let n=0;n<e.tags.length;++n){const r=e.tags[n],o=t.reduce((e,t)=>(a(r,t.tags)&&e.push(t),e),[]);if(o.length)return o}return[]}(e,function(e,t,n){if(null==e.maxStalenessSeconds||e.maxStalenessSeconds<0)return n;const r=e.maxStalenessSeconds,i=(t.heartbeatFrequencyMS+1e4)/1e3;if(r<i)throw new s(`maxStalenessSeconds must be at least ${i} seconds`);if(r<90)throw new s("maxStalenessSeconds must be at least 90 seconds");if(t.type===o.ReplicaSetWithPrimary){const r=Array.from(t.servers.values()).filter(u)[0];return n.reduce((n,o)=>((o.lastUpdateTime-o.lastWriteDate-(r.lastUpdateTime-r.lastWriteDate)+t.heartbeatFrequencyMS)/1e3<=e.maxStalenessSeconds&&n.push(o),n),[])}if(t.type===o.ReplicaSetNoPrimary){if(0===n.length)return n;const r=n.reduce((e,t)=>t.lastWriteDate>e.lastWriteDate?t:e);return n.reduce((n,o)=>((r.lastWriteDate-o.lastWriteDate+t.heartbeatFrequencyMS)/1e3<=e.maxStalenessSeconds&&n.push(o),n),[])}return n}(e,t,n.filter(h))));return d===i.SECONDARY_PREFERRED&&0===m.length?n.filter(u):m}}}},function(e,t,n){"use strict";const r=n(90),o=n(137),i=n(87),s=n(3).MongoParseError,a=n(10),c=n(0).emitWarningOnce,u=/(mongodb(?:\+srv|)):\/\/(?: (?:[^:]*) (?: : ([^@]*) )? @ )?([^/?]*)(?:\/|)(.*)/,l=new Set(["sslCA","sslCert","sslKey","tlsCAFile","tlsCertificateKeyFile"].map(e=>e.toLowerCase()));function f(e,t){const n=/^.*?\./,r=`.${e.replace(n,"")}`,o=`.${t.replace(n,"")}`;return r.endsWith(o)}function p(e,t){if(Array.isArray(t))1===(t=t.filter((e,n)=>t.indexOf(e)===n)).length&&(t=t[0]);else if(t.indexOf(":")>0)t=t.split(",").reduce((t,n)=>{const r=n.split(":");return t[r[0]]=p(e,r[1]),t},{});else if(t.indexOf(",")>0)t=t.split(",").map(t=>p(e,t));else if("true"===t.toLowerCase()||"false"===t.toLowerCase())t="true"===t.toLowerCase();else if(!Number.isNaN(t)&&!h.has(e)){const e=parseFloat(t);Number.isNaN(e)||(t=parseFloat(t))}return t}const d=new Set(["slaveok","slave_ok","sslvalidate","fsync","safe","retrywrites","j"]),h=new Set(["authsource","replicaset"]),m=new Set(["GSSAPI","MONGODB-AWS","MONGODB-X509","MONGODB-CR","DEFAULT","SCRAM-SHA-1","SCRAM-SHA-256","PLAIN"]),g={replicaset:"replicaSet",connecttimeoutms:"connectTimeoutMS",sockettimeoutms:"socketTimeoutMS",maxpoolsize:"maxPoolSize",minpoolsize:"minPoolSize",maxidletimems:"maxIdleTimeMS",waitqueuemultiple:"waitQueueMultiple",waitqueuetimeoutms:"waitQueueTimeoutMS",wtimeoutms:"wtimeoutMS",readconcern:"readConcern",readconcernlevel:"readConcernLevel",readpreference:"readPreference",maxstalenessseconds:"maxStalenessSeconds",readpreferencetags:"readPreferenceTags",authsource:"authSource",authmechanism:"authMechanism",authmechanismproperties:"authMechanismProperties",gssapiservicename:"gssapiServiceName",localthresholdms:"localThresholdMS",serverselectiontimeoutms:"serverSelectionTimeoutMS",serverselectiontryonce:"serverSelectionTryOnce",heartbeatfrequencyms:"heartbeatFrequencyMS",retrywrites:"retryWrites",uuidrepresentation:"uuidRepresentation",zlibcompressionlevel:"zlibCompressionLevel",tlsallowinvalidcertificates:"tlsAllowInvalidCertificates",tlsallowinvalidhostnames:"tlsAllowInvalidHostnames",tlsinsecure:"tlsInsecure",tlscafile:"tlsCAFile",tlscertificatekeyfile:"tlsCertificateKeyFile",tlscertificatekeyfilepassword:"tlsCertificateKeyFilePassword",wtimeout:"wTimeoutMS",j:"journal",directconnection:"directConnection"};function y(e,t,n,r){if("journal"===t?t="j":"wtimeoutms"===t&&(t="wtimeout"),d.has(t)?n="true"===n||!0===n:"appname"===t?n=decodeURIComponent(n):"readconcernlevel"===t&&(e.readConcernLevel=n,t="readconcern",n={level:n}),"compressors"===t&&!(n=Array.isArray(n)?n:[n]).every(e=>"snappy"===e||"zlib"===e))throw new s("Value for `compressors` must be at least one of: `snappy`, `zlib`");if("authmechanism"===t&&!m.has(n))throw new s(`Value for authMechanism must be one of: ${Array.from(m).join(", ")}, found: ${n}`);if("readpreference"===t&&!a.isValid(n))throw new s("Value for `readPreference` must be one of: `primary`, `primaryPreferred`, `secondary`, `secondaryPreferred`, `nearest`");if("zlibcompressionlevel"===t&&(n<-1||n>9))throw new s("zlibCompressionLevel must be an integer between -1 and 9");"compressors"!==t&&"zlibcompressionlevel"!==t||(e.compression=e.compression||{},e=e.compression),"authmechanismproperties"===t&&("string"==typeof n.SERVICE_NAME&&(e.gssapiServiceName=n.SERVICE_NAME),"string"==typeof n.SERVICE_REALM&&(e.gssapiServiceRealm=n.SERVICE_REALM),void 0!==n.CANONICALIZE_HOST_NAME&&(e.gssapiCanonicalizeHostName=n.CANONICALIZE_HOST_NAME)),"readpreferencetags"===t&&(n=Array.isArray(n)?function(e){const t=[];for(let n=0;n<e.length;n++)t[n]={},e[n].split(",").forEach(e=>{const r=e.split(":");t[n][r[0]]=r[1]});return t}(n):[n]),r.caseTranslate&&g[t]?e[g[t]]=n:e[t]=n}const b=new Set(["GSSAPI","MONGODB-CR","PLAIN","SCRAM-SHA-1","SCRAM-SHA-256"]);function v(e,t){const n={};let r=o.parse(e);!function(e){const t=Object.keys(e);if(-1!==t.indexOf("tlsInsecure")&&(-1!==t.indexOf("tlsAllowInvalidCertificates")||-1!==t.indexOf("tlsAllowInvalidHostnames")))throw new s("The `tlsInsecure` option cannot be used with `tlsAllowInvalidCertificates` or `tlsAllowInvalidHostnames`.");const n=S("tls",e,t),r=S("ssl",e,t);if(null!=n&&null!=r&&n!==r)throw new s("All values of `tls` and `ssl` must be the same.")}(r);for(const e in r){const o=r[e];if(""===o||null==o)throw new s("Incomplete key value pair for option");const i=e.toLowerCase();y(n,i,l.has(i)?o:p(i,o),t)}return n.wtimeout&&n.wtimeoutms&&(delete n.wtimeout,c("Unsupported option `wtimeout` specified")),Object.keys(n).length?n:null}function S(e,t,n){const r=-1!==n.indexOf(e);let o;if(o=Array.isArray(t[e])?t[e][0]:t[e],r&&Array.isArray(t[e])){const n=t[e][0];t[e].forEach(t=>{if(t!==n)throw new s(`All values of ${e} must be the same.`)})}return o}const w="mongodb+srv",_=["mongodb",w];function O(e,t,n){"function"==typeof t&&(n=t,t={}),t=Object.assign({},{caseTranslate:!0},t);try{r.parse(e)}catch(e){return n(new s("URI malformed, cannot be parsed"))}const a=e.match(u);if(!a)return n(new s("Invalid connection string"));const c=a[1];if(-1===_.indexOf(c))return n(new s("Invalid protocol provided"));const l=a[4].split("?"),p=l.length>0?l[0]:null,d=l.length>1?l[1]:null;let h;try{h=v(d,t)}catch(e){return n(e)}if(h=Object.assign({},h,t),c===w)return function(e,t,n){const a=r.parse(e,!0);if(t.directConnection||t.directconnection)return n(new s("directConnection not supported with SRV URI"));if(a.hostname.split(".").length<3)return n(new s("URI does not have hostname, domain name and tld"));if(a.domainLength=a.hostname.split(".").length,a.pathname&&a.pathname.match(","))return n(new s("Invalid URI, cannot contain multiple hostnames"));if(a.port)return n(new s(`Ports not accepted with '${w}' URIs`));const c=a.host;i.resolveSrv(`_mongodb._tcp.${c}`,(e,u)=>{if(e)return n(e);if(0===u.length)return n(new s("No addresses found at host"));for(let e=0;e<u.length;e++)if(!f(u[e].name,a.hostname,a.domainLength))return n(new s("Server record does not share hostname with parent URI"));a.protocol="mongodb",a.host=u.map(e=>`${e.name}:${e.port}`).join(","),"ssl"in t||a.search&&"ssl"in a.query&&null!==a.query.ssl||(a.query.ssl=!0),i.resolveTxt(c,(e,i)=>{if(e){if("ENODATA"!==e.code&&"ENOTFOUND"!==e.code)return n(e);i=null}if(i){if(i.length>1)return n(new s("Multiple text records not allowed"));if(i=o.parse(i[0].join("")),Object.keys(i).some(e=>"authSource"!==e&&"replicaSet"!==e))return n(new s("Text record must only set `authSource` or `replicaSet`"));a.query=Object.assign({},i,a.query)}a.search=o.stringify(a.query),O(r.format(a),t,(e,t)=>{e?n(e):n(null,Object.assign({},t,{srvHost:c}))})})})}(e,h,n);const m={username:null,password:null,db:p&&""!==p?o.unescape(p):null};if(h.auth?(h.auth.username&&(m.username=h.auth.username),h.auth.user&&(m.username=h.auth.user),h.auth.password&&(m.password=h.auth.password)):(h.username&&(m.username=h.username),h.user&&(m.username=h.user),h.password&&(m.password=h.password)),-1!==a[4].split("?")[0].indexOf("@"))return n(new s("Unescaped slash in userinfo section"));const g=a[3].split("@");if(g.length>2)return n(new s("Unescaped at-sign in authority section"));if(null==g[0]||""===g[0])return n(new s("No username provided in authority section"));if(g.length>1){const e=g.shift().split(":");if(e.length>2)return n(new s("Unescaped colon in authority section"));if(""===e[0])return n(new s("Invalid empty username provided"));m.username||(m.username=o.unescape(e[0])),m.password||(m.password=e[1]?o.unescape(e[1]):null)}let y=null;const S=g.shift().split(",").map(e=>{let t=r.parse(`mongodb://${e}`);if("/:"===t.path)return y=new s("Double colon in host identifier"),null;if(e.match(/\.sock/)&&(t.hostname=o.unescape(e),t.port=null),Number.isNaN(t.port))return void(y=new s("Invalid port (non-numeric string)"));const n={host:t.hostname,port:t.port?parseInt(t.port):27017};if(0!==n.port)if(n.port>65535)y=new s("Invalid port (larger than 65535) with hostname");else{if(!(n.port<0))return n;y=new s("Invalid port (negative number)")}else y=new s("Invalid port (zero) with hostname")}).filter(e=>!!e);if(y)return n(y);if(0===S.length||""===S[0].host||null===S[0].host)return n(new s("No hostname or hostnames provided in connection string"));if(!!h.directConnection&&1!==S.length)return n(new s("directConnection option requires exactly one host"));null==h.directConnection&&1===S.length&&null==h.replicaSet&&(h.directConnection=!0);const T={hosts:S,auth:m.db||m.username?m:null,options:Object.keys(h).length?h:null};var C;T.auth&&T.auth.db?T.defaultDatabase=T.auth.db:T.defaultDatabase="test",T.options=((C=T.options).tls&&(C.ssl=C.tls),C.tlsInsecure?(C.checkServerIdentity=!1,C.sslValidate=!1):Object.assign(C,{checkServerIdentity:!C.tlsAllowInvalidHostnames,sslValidate:!C.tlsAllowInvalidCertificates}),C.tlsCAFile&&(C.ssl=!0,C.sslCA=C.tlsCAFile),C.tlsCertificateKeyFile&&(C.ssl=!0,C.tlsCertificateFile?(C.sslCert=C.tlsCertificateFile,C.sslKey=C.tlsCertificateKeyFile):(C.sslKey=C.tlsCertificateKeyFile,C.sslCert=C.tlsCertificateKeyFile)),C.tlsCertificateKeyFilePassword&&(C.ssl=!0,C.sslPass=C.tlsCertificateKeyFilePassword),C);try{!function(e){if(null==e.options)return;const t=e.options,n=t.authsource||t.authSource;null!=n&&(e.auth=Object.assign({},e.auth,{db:n}));const r=t.authmechanism||t.authMechanism;if(null!=r){if(b.has(r)&&(!e.auth||null==e.auth.username))throw new s(`Username required for mechanism \`${r}\``);if("GSSAPI"===r){if(null!=n&&"$external"!==n)throw new s(`Invalid source \`${n}\` for mechanism \`${r}\` specified.`);e.auth=Object.assign({},e.auth,{db:"$external"})}if("MONGODB-AWS"===r){if(null!=n&&"$external"!==n)throw new s(`Invalid source \`${n}\` for mechanism \`${r}\` specified.`);e.auth=Object.assign({},e.auth,{db:"$external"})}if("MONGODB-X509"===r){if(e.auth&&null!=e.auth.password)throw new s(`Password not allowed for mechanism \`${r}\``);if(null!=n&&"$external"!==n)throw new s(`Invalid source \`${n}\` for mechanism \`${r}\` specified.`);e.auth=Object.assign({},e.auth,{db:"$external"})}"PLAIN"===r&&e.auth&&null==e.auth.db&&(e.auth=Object.assign({},e.auth,{db:"$external"}))}e.auth&&null==e.auth.db&&(e.auth=Object.assign({},e.auth,{db:"admin"}))}(T)}catch(e){return n(e)}n(null,T)}e.exports=O},function(e,t,n){"use strict";const r=n(8).EventEmitter;e.exports=class extends r{constructor(){super()}instrument(e,t){this.$MongoClient=e;const n=this.$prototypeConnect=e.prototype.connect,r=this;e.prototype.connect=function(e){return this.s.options.monitorCommands=!0,this.on("commandStarted",e=>r.emit("started",e)),this.on("commandSucceeded",e=>r.emit("succeeded",e)),this.on("commandFailed",e=>r.emit("failed",e)),n.call(this,e)},"function"==typeof t&&t(null,this)}uninstrument(){this.$MongoClient.prototype.connect=this.$prototypeConnect}}},function(e,t,n){"use strict";const r=n(60).buildCountCommand,o=n(0).handleCallback,i=n(2).MongoError,s=Array.prototype.push,a=n(17).CursorState;function c(e,t){if(0!==e.bufferedCount())return e._next(t),c}e.exports={count:function(e,t,n,o){t&&("number"==typeof e.cursorSkip()&&(n.skip=e.cursorSkip()),"number"==typeof e.cursorLimit()&&(n.limit=e.cursorLimit())),n.readPreference&&e.setReadPreference(n.readPreference),"number"!=typeof n.maxTimeMS&&e.cmd&&"number"==typeof e.cmd.maxTimeMS&&(n.maxTimeMS=e.cmd.maxTimeMS);let i,s={};s.skip=n.skip,s.limit=n.limit,s.hint=n.hint,s.maxTimeMS=n.maxTimeMS,s.collectionName=e.namespace.collection;try{i=r(e,e.cmd.query,s)}catch(e){return o(e)}e.server=e.topology.s.coreTopology,e.topology.command(e.namespace.withCollection("$cmd"),i,e.options,(e,t)=>{o(e,t?t.result.n:null)})},each:function e(t,n){if(!n)throw i.create({message:"callback is mandatory",driver:!0});if(t.isNotified())return;if(t.s.state===a.CLOSED||t.isDead())return o(n,i.create({message:"Cursor is closed",driver:!0}));t.s.state===a.INIT&&(t.s.state=a.OPEN);let r=null;if(t.bufferedCount()>0){for(;r=c(t,n);)r(t,n);e(t,n)}else t.next((r,i)=>r?o(n,r):null==i?t.close({skipKillCursors:!0},()=>o(n,null,null)):void(!1!==o(n,null,i)&&e(t,n)))},toArray:function(e,t){const n=[];e.rewind(),e.s.state=a.INIT;const r=()=>{e._next((i,a)=>{if(i)return o(t,i);if(null==a)return e.close({skipKillCursors:!0},()=>o(t,null,n));if(n.push(a),e.bufferedCount()>0){let t=e.readBufferedDocuments(e.bufferedCount());e.s.transforms&&"function"==typeof e.s.transforms.doc&&(t=t.map(e.s.transforms.doc)),s.apply(n,t)}r()})};r()}}},function(e,t,n){"use strict";const r=n(14).buildCountCommand,o=n(1).OperationBase;e.exports=class extends o{constructor(e,t,n){super(n),this.cursor=e,this.applySkipLimit=t}execute(e){const t=this.cursor,n=this.applySkipLimit,o=this.options;n&&("number"==typeof t.cursorSkip()&&(o.skip=t.cursorSkip()),"number"==typeof t.cursorLimit()&&(o.limit=t.cursorLimit())),o.readPreference&&t.setReadPreference(o.readPreference),"number"!=typeof o.maxTimeMS&&t.cmd&&"number"==typeof t.cmd.maxTimeMS&&(o.maxTimeMS=t.cmd.maxTimeMS);let i,s={};s.skip=o.skip,s.limit=o.limit,s.hint=o.hint,s.maxTimeMS=o.maxTimeMS,s.collectionName=t.namespace.collection;try{i=r(t,t.cmd.query,s)}catch(t){return e(t)}t.server=t.topology.s.coreTopology,t.topology.command(t.namespace.withCollection("$cmd"),i,t.options,(t,n)=>{e(t,n?n.result.n:null)})}}},function(e,t,n){"use strict";const r=n(141),o=r.BulkOperationBase,i=r.Batch,s=r.bson,a=n(0).toError;function c(e,t,n){const o=s.calculateObjectSize(n,{checkKeys:!1,ignoreUndefined:!1});if(o>=e.s.maxBsonObjectSize)throw a("document is larger than the maximum size "+e.s.maxBsonObjectSize);e.s.currentBatch=null,t===r.INSERT?e.s.currentBatch=e.s.currentInsertBatch:t===r.UPDATE?e.s.currentBatch=e.s.currentUpdateBatch:t===r.REMOVE&&(e.s.currentBatch=e.s.currentRemoveBatch);const c=e.s.maxKeySize;if(null==e.s.currentBatch&&(e.s.currentBatch=new i(t,e.s.currentIndex)),(e.s.currentBatch.size+1>=e.s.maxWriteBatchSize||e.s.currentBatch.size>0&&e.s.currentBatch.sizeBytes+c+o>=e.s.maxBatchSizeBytes||e.s.currentBatch.batchType!==t)&&(e.s.batches.push(e.s.currentBatch),e.s.currentBatch=new i(t,e.s.currentIndex)),Array.isArray(n))throw a("operation passed in cannot be an Array");return e.s.currentBatch.operations.push(n),e.s.currentBatch.originalIndexes.push(e.s.currentIndex),e.s.currentIndex=e.s.currentIndex+1,t===r.INSERT?(e.s.currentInsertBatch=e.s.currentBatch,e.s.bulkResult.insertedIds.push({index:e.s.bulkResult.insertedIds.length,_id:n._id})):t===r.UPDATE?e.s.currentUpdateBatch=e.s.currentBatch:t===r.REMOVE&&(e.s.currentRemoveBatch=e.s.currentBatch),e.s.currentBatch.size+=1,e.s.currentBatch.sizeBytes+=c+o,e}class u extends o{constructor(e,t,n){n=n||{},super(e,t,n=Object.assign(n,{addToOperationsList:c}),!1)}handleWriteError(e,t){return!this.s.batches.length&&super.handleWriteError(e,t)}}function l(e,t,n){return new u(e,t,n)}l.UnorderedBulkOperation=u,e.exports=l,e.exports.Bulk=u},function(e,t,n){"use strict";const r=n(141),o=r.BulkOperationBase,i=r.Batch,s=r.bson,a=n(0).toError;function c(e,t,n){const o=s.calculateObjectSize(n,{checkKeys:!1,ignoreUndefined:!1});if(o>=e.s.maxBsonObjectSize)throw a("document is larger than the maximum size "+e.s.maxBsonObjectSize);null==e.s.currentBatch&&(e.s.currentBatch=new i(t,e.s.currentIndex));const c=e.s.maxKeySize;if((e.s.currentBatchSize+1>=e.s.maxWriteBatchSize||e.s.currentBatchSize>0&&e.s.currentBatchSizeBytes+c+o>=e.s.maxBatchSizeBytes||e.s.currentBatch.batchType!==t)&&(e.s.batches.push(e.s.currentBatch),e.s.currentBatch=new i(t,e.s.currentIndex),e.s.currentBatchSize=0,e.s.currentBatchSizeBytes=0),t===r.INSERT&&e.s.bulkResult.insertedIds.push({index:e.s.currentIndex,_id:n._id}),Array.isArray(n))throw a("operation passed in cannot be an Array");return e.s.currentBatch.originalIndexes.push(e.s.currentIndex),e.s.currentBatch.operations.push(n),e.s.currentBatchSize+=1,e.s.currentBatchSizeBytes+=c+o,e.s.currentIndex+=1,e}class u extends o{constructor(e,t,n){n=n||{},super(e,t,n=Object.assign(n,{addToOperationsList:c}),!0)}}function l(e,t,n){return new u(e,t,n)}l.OrderedBulkOperation=u,e.exports=l,e.exports.Bulk=u},function(e,t,n){"use strict";const r=n(96);e.exports=class extends r{constructor(e,t,n){const r=[{$match:t}];"number"==typeof n.skip&&r.push({$skip:n.skip}),"number"==typeof n.limit&&r.push({$limit:n.limit}),r.push({$group:{_id:1,n:{$sum:1}}}),super(e,r,n)}execute(e,t){super.execute(e,(e,n)=>{if(e)return void t(e,null);const r=n.result;if(null==r.cursor||null==r.cursor.firstBatch)return void t(null,0);const o=r.cursor.firstBatch;t(null,o.length?o[0].n:0)})}}},function(e,t,n){"use strict";const r=n(1).OperationBase,o=n(14).removeDocuments,i=n(1).Aspect;class s extends r{constructor(e,t,n){super(n),this.collection=e,this.filter=t}execute(e){const t=this.collection,n=this.filter,r=this.options;r.single=!1,o(t,n,r,(t,n)=>{if(null!=e){if(t&&e)return e(t);if(null==n)return e(null,{result:{ok:1}});if(this.explain)return e(void 0,n.result);n.deletedCount=n.result.n,e(null,n)}})}}(0,n(1).defineAspects)(s,[i.EXPLAINABLE]),e.exports=s},function(e,t,n){"use strict";const r=n(1).OperationBase,o=n(14).removeDocuments,i=n(1).Aspect;class s extends r{constructor(e,t,n){super(n),this.collection=e,this.filter=t}execute(e){const t=this.collection,n=this.filter,r=this.options;r.single=!0,o(t,n,r,(t,n)=>{if(null!=e){if(t&&e)return e(t);if(null==n)return e(null,{result:{ok:1}});if(this.explain)return e(void 0,n.result);n.deletedCount=n.result.n,e(null,n)}})}}(0,n(1).defineAspects)(s,[i.EXPLAINABLE]),e.exports=s},function(e,t,n){"use strict";const r=n(1).Aspect,o=n(1).defineAspects,i=n(27),s=n(0).decorateWithCollation,a=n(0).decorateWithReadConcern,c=n(4).maxWireVersion,u=n(95).MongoError;class l extends i{constructor(e,t,n,r){super(e,r),this.collection=e,this.key=t,this.query=n}execute(e,t){const n=this.collection,r=this.key,o=this.query,i=this.options,l={distinct:n.collectionName,key:r,query:o};"number"==typeof i.maxTimeMS&&(l.maxTimeMS=i.maxTimeMS),a(l,n,i);try{s(l,n,i)}catch(e){return t(e,null)}this.explain&&c(e)<4?t(new u("server does not support explain on distinct")):super.executeCommand(e,l,(e,n)=>{e?t(e):t(null,this.options.full||this.explain?n:n.values)})}}o(l,[r.READ_OPERATION,r.RETRYABLE,r.EXECUTE_WITH_SELECTION,r.EXPLAINABLE]),e.exports=l},function(e,t,n){"use strict";const r=n(1).Aspect,o=n(1).defineAspects,i=n(211),s=n(0).handleCallback;class a extends i{constructor(e,t){super(e,"*",t)}execute(e){super.execute(t=>{if(t)return s(e,t,!1);s(e,null,!0)})}}o(a,r.WRITE_OPERATION),e.exports=a},function(e,t,n){"use strict";const r=n(1).Aspect,o=n(1).defineAspects,i=n(27);class s extends i{constructor(e,t,n){void 0===n&&(n=t,t=void 0),super(e,n),this.collectionName=e.s.namespace.collection,t&&(this.query=t)}execute(e,t){const n=this.options,r={count:this.collectionName};this.query&&(r.query=this.query),"number"==typeof n.skip&&(r.skip=n.skip),"number"==typeof n.limit&&(r.limit=n.limit),n.hint&&(r.hint=n.hint),super.executeCommand(e,r,(e,n)=>{e?t(e):t(null,n.n)})}}o(s,[r.READ_OPERATION,r.RETRYABLE,r.EXECUTE_WITH_SELECTION]),e.exports=s},function(e,t,n){"use strict";const r=n(1).OperationBase,o=n(1).Aspect,i=n(1).defineAspects,s=n(2).ReadPreference,a=n(4).maxWireVersion,c=n(3).MongoError;class u extends r{constructor(e,t,n,r){super(r),this.ns=t,this.cmd=n,this.readPreference=s.resolve(e,this.options)}execute(e,t){if(this.server=e,this.readPreference=s.resolve(this,this.options),void 0!==this.cmd.allowDiskUse&&a(e)<4)return void t(new c("The `allowDiskUse` option is not supported on MongoDB < 3.2"));this.explain&&(this.options.explain=this.explain.verbosity);const n=this.cursorState||{};e.query(this.ns.toString(),this.cmd,n,this.options,t)}}i(u,[o.READ_OPERATION,o.RETRYABLE,o.EXECUTE_WITH_SELECTION,o.EXPLAINABLE]),e.exports=u},function(e,t,n){"use strict";const r=n(0).handleCallback,o=n(1).OperationBase,i=n(0).toError,s=n(1).Aspect;class a extends o{constructor(e,t,n){super(n),this.collection=e,this.query=t}execute(e){const t=this.collection,n=this.query,o=this.options;try{t.find(n,o).limit(-1).batchSize(1).next((t,n)=>{if(null!=t)return r(e,i(t),null);r(e,null,n)})}catch(t){e(t)}}}(0,n(1).defineAspects)(a,[s.EXPLAINABLE]),e.exports=a},function(e,t,n){"use strict";const r=n(97);e.exports=class extends r{constructor(e,t,n){const r=Object.assign({},n);if(r.fields=n.projection,r.remove=!0,null==t||"object"!=typeof t)throw new TypeError("Filter parameter must be an object");super(e,t,r.sort,null,r)}}},function(e,t,n){"use strict";const r=n(97),o=n(0).hasAtomicOperators;e.exports=class extends r{constructor(e,t,n,r){const i=Object.assign({},r);if(i.fields=r.projection,i.update=!0,i.new=void 0!==r.returnOriginal&&!r.returnOriginal,i.upsert=void 0!==r.upsert&&!!r.upsert,null==t||"object"!=typeof t)throw new TypeError("Filter parameter must be an object");if(null==n||"object"!=typeof n)throw new TypeError("Replacement parameter must be an object");if(o(n))throw new TypeError("Replacement document must not contain atomic operators");super(e,t,i.sort,n,i)}}},function(e,t,n){"use strict";const r=n(97),o=n(0).hasAtomicOperators;e.exports=class extends r{constructor(e,t,n,r){const i=Object.assign({},r);if(i.fields=r.projection,i.update=!0,i.new="boolean"==typeof r.returnOriginal&&!r.returnOriginal,i.upsert="boolean"==typeof r.upsert&&r.upsert,null==t||"object"!=typeof t)throw new TypeError("Filter parameter must be an object");if(null==n||"object"!=typeof n)throw new TypeError("Update parameter must be an object");if(!o(n))throw new TypeError("Update document requires atomic operators");super(e,t,i.sort,n,i)}}},function(e,t,n){"use strict";const r=n(1).Aspect,o=n(1).defineAspects,i=n(1).OperationBase,s=n(0).decorateCommand,a=n(0).decorateWithReadConcern,c=n(11).executeCommand,u=n(0).handleCallback,l=n(2).ReadPreference,f=n(0).toError;class p extends i{constructor(e,t,n,r){super(r),this.collection=e,this.x=t,this.y=n}execute(e){const t=this.collection,n=this.x,r=this.y;let o=this.options,i={geoSearch:t.collectionName,near:[n,r]};i=s(i,o,["readPreference","session"]),o=Object.assign({},o),o.readPreference=l.resolve(t,o),a(i,t,o),c(t.s.db,i,o,(t,n)=>{if(t)return u(e,t);(n.err||n.errmsg)&&u(e,f(n)),u(e,null,n)})}}o(p,r.READ_OPERATION),e.exports=p},function(e,t,n){"use strict";const r=n(1).OperationBase,o=n(14).indexInformation;e.exports=class extends r{constructor(e,t){super(t),this.collection=e}execute(e){const t=this.collection;let n=this.options;n=Object.assign({},{full:!0},n),o(t.s.db,t.collectionName,n,e)}}},function(e,t,n){"use strict";const r=n(1).OperationBase,o=n(0).handleCallback,i=n(11).indexInformation;e.exports=class extends r{constructor(e,t,n){super(n),this.collection=e,this.indexes=t}execute(e){const t=this.collection,n=this.indexes,r=this.options;i(t.s.db,t.collectionName,r,(t,r)=>{if(null!=t)return o(e,t,null);if(!Array.isArray(n))return o(e,null,null!=r[n]);for(let t=0;t<n.length;t++)if(null==r[n[t]])return o(e,null,!1);return o(e,null,!0)})}}},function(e,t,n){"use strict";const r=n(1).OperationBase,o=n(209),i=n(2).MongoError,s=n(14).prepareDocs;e.exports=class extends r{constructor(e,t,n){super(n),this.collection=e,this.docs=t}execute(e){const t=this.collection;let n=this.docs;const r=this.options;if(!Array.isArray(n))return e(i.create({message:"docs parameter must be an array of documents",driver:!0}));r.serializeFunctions=r.serializeFunctions||t.s.serializeFunctions,n=s(t,n,r),new o(t,[{insertMany:n}],r).execute((t,r)=>{if(t)return e(t,null);e(null,function(e,t){const n={result:{ok:1,n:t.insertedCount},ops:e,insertedCount:t.insertedCount,insertedIds:t.insertedIds};t.getLastOp()&&(n.result.opTime=t.getLastOp());return n}(n,r))})}}},function(e,t,n){"use strict";const r=n(2).MongoError,o=n(1).OperationBase,i=n(14).insertDocuments;e.exports=class extends o{constructor(e,t,n){super(n),this.collection=e,this.doc=t}execute(e){const t=this.collection,n=this.doc,o=this.options;if(Array.isArray(n))return e(r.create({message:"doc parameter must be an object",driver:!0}));i(t,[n],o,(t,r)=>{if(null!=e){if(t&&e)return e(t);if(null==r)return e(null,{result:{ok:1}});r.insertedCount=r.result.n,r.insertedId=n._id,e&&e(null,r)}})}}},function(e,t,n){"use strict";const r=n(213),o=n(0).handleCallback;e.exports=class extends r{constructor(e,t){super(e,t)}execute(e){super.execute((t,n)=>{if(t)return o(e,t);o(e,null,!(!n||!n.capped))})}}},function(e,t,n){"use strict";const r=n(27),o=n(1).Aspect,i=n(1).defineAspects,s=n(4).maxWireVersion;class a extends r{constructor(e,t){super(e,t,{fullResponse:!0}),this.collectionNamespace=e.s.namespace}execute(e,t){if(s(e)<3){const n=this.collectionNamespace.withCollection("system.indexes").toString(),r=this.collectionNamespace.toString();return void e.query(n,{query:{ns:r}},{},this.options,t)}const n=this.options.batchSize?{batchSize:this.options.batchSize}:{};super.executeCommand(e,{listIndexes:this.collectionNamespace.collection,cursor:n},t)}}i(a,[o.READ_OPERATION,o.RETRYABLE,o.EXECUTE_WITH_SELECTION]),e.exports=a},function(e,t,n){"use strict";const r=n(0).applyWriteConcern,o=n(2).BSON.Code,i=n(0).decorateWithCollation,s=n(0).decorateWithReadConcern,a=n(11).executeCommand,c=n(0).handleCallback,u=n(0).isObject,l=n(145).loadDb,f=n(1).OperationBase,p=n(2).ReadPreference,d=n(0).toError,h=n(1).Aspect,m=n(1).defineAspects,g=n(0).decorateWithExplain,y=n(4).maxWireVersion,b=n(95).MongoError,v=["explain","readPreference","session","bypassDocumentValidation","w","wtimeout","j","writeConcern"];class S extends f{constructor(e,t,n,r){super(r),this.collection=e,this.map=t,this.reduce=n}execute(e){const t=this.collection,n=this.map,o=this.reduce;let u=this.options,f={mapReduce:t.collectionName,map:n,reduce:o};for(let e in u)"scope"===e?f[e]=w(u[e]):-1===v.indexOf(e)&&(f[e]=u[e]);u=Object.assign({},u),u.readPreference=p.resolve(t,u),!1!==u.readPreference&&"primary"!==u.readPreference&&u.out&&1!==u.out.inline&&"inline"!==u.out?(u.readPreference="primary",r(f,{db:t.s.db,collection:t},u)):s(f,t,u),!0===u.bypassDocumentValidation&&(f.bypassDocumentValidation=u.bypassDocumentValidation);try{i(f,t,u)}catch(t){return e(t,null)}if(this.explain){if(y(t.s.topology)<9)return void e(new b("server does not support explain on mapReduce"));f=g(f,this.explain)}a(t.s.db,f,u,(n,r)=>{if(n)return c(e,n);if(1!==r.ok||r.err||r.errmsg)return c(e,d(r));if(this.explain)return e(void 0,r);const o={};if(r.timeMillis&&(o.processtime=r.timeMillis),r.counts&&(o.counts=r.counts),r.timing&&(o.timing=r.timing),r.results)return null!=u.verbose&&u.verbose?c(e,null,{results:r.results,stats:o}):c(e,null,r.results);let i=null;if(null!=r.result&&"object"==typeof r.result){const e=r.result;i=new(l())(e.db,t.s.db.s.topology,t.s.db.s.options).collection(e.collection)}else i=t.s.db.collection(r.result);if(null==u.verbose||!u.verbose)return c(e,n,i);c(e,n,{collection:i,stats:o})})}}function w(e){if(!u(e)||"ObjectID"===e._bsontype)return e;const t=Object.keys(e);let n;const r={};for(let i=t.length-1;i>=0;i--)n=t[i],"function"==typeof e[n]?r[n]=new o(String(e[n])):r[n]=w(e[n]);return r}m(S,[h.EXPLAINABLE]),e.exports=S},function(e,t,n){"use strict";const r=n(1).OperationBase,o=n(0).handleCallback;let i;e.exports=class extends r{constructor(e,t){super(t),this.db=e}execute(e){const t=this.db;let r=this.options,s=(i||(i=n(61)),i);r=Object.assign({},r,{nameOnly:!0}),t.listCollections({},r).toArray((n,r)=>{if(null!=n)return o(e,n,null);r=r.filter(e=>-1===e.name.indexOf("$")),o(e,null,r.map(e=>new s(t,t.s.topology,t.databaseName,e.name,t.s.pkFactory,t.s.options)))})}}},function(e,t,n){"use strict";const r=n(27),o=n(1).defineAspects,i=n(1).Aspect;class s extends r{constructor(e,t,n){super(e,n),this.command=t}execute(e,t){const n=this.command;this.executeCommand(e,n,t)}}o(s,[i.EXECUTE_WITH_SELECTION,i.NO_INHERIT_OPTIONS]),e.exports=s},function(e,t,n){"use strict";const r=n(1).Aspect,o=n(1).defineAspects,i=n(23),s=n(0).applyWriteConcern,a=n(145).loadCollection,c=n(2).MongoError,u=n(2).ReadPreference,l=new Set(["w","wtimeout","j","fsync","autoIndexId","strict","serializeFunctions","pkFactory","raw","readPreference","session","readConcern","writeConcern"]);class f extends i{constructor(e,t,n){super(e,n),this.name=t}_buildCommand(){const e=this.name,t=this.options,n={create:e};for(let e in t)null==t[e]||"function"==typeof t[e]||l.has(e)||(n[e]=t[e]);return n}execute(e){const t=this.db,n=this.name,r=this.options,o=a();let i=Object.assign({nameOnly:!0,strict:!1},r);function l(i){if(i)return e(i);try{e(null,new o(t,t.s.topology,t.databaseName,n,t.s.pkFactory,r))}catch(i){e(i)}}i=s(i,{db:t},i),i.strict?t.listCollections({name:n},i).setReadPreference(u.PRIMARY).toArray((t,r)=>t?e(t):r.length>0?e(new c(`Collection ${n} already exists. Currently in strict mode.`)):void super.execute(l)):super.execute(l)}}o(f,r.WRITE_OPERATION),e.exports=f},function(e,t,n){"use strict";const r=n(27),o=n(1).Aspect,i=n(1).defineAspects,s=n(4).maxWireVersion,a=n(140);class c extends r{constructor(e,t,n){super(e,n,{fullResponse:!0}),this.db=e,this.filter=t,this.nameOnly=!!this.options.nameOnly,"number"==typeof this.options.batchSize&&(this.batchSize=this.options.batchSize)}execute(e,t){if(s(e)<3){let n=this.filter;const r=this.db.s.namespace.db;"string"!=typeof n.name||new RegExp("^"+r+"\\.").test(n.name)||(n=Object.assign({},n),n.name=this.db.s.namespace.withCollection(n.name).toString()),null==n&&(n.name=`/${r}/`),n=n.name?{$and:[{name:n.name},{name:/^((?!\$).)*$/}]}:{name:/^((?!\$).)*$/};const o=function(e){const t=`${e}.`;return{doc:e=>{const n=e.name.indexOf(t);return e.name&&0===n&&(e.name=e.name.substr(n+t.length)),e}}}(r);return void e.query(`${r}.${a.SYSTEM_NAMESPACE_COLLECTION}`,{query:n},{batchSize:this.batchSize||1e3},{},(e,n)=>{n&&n.message&&n.message.documents&&Array.isArray(n.message.documents)&&(n.message.documents=n.message.documents.map(o.doc)),t(e,n)})}const n={listCollections:1,filter:this.filter,cursor:this.batchSize?{batchSize:this.batchSize}:{},nameOnly:this.nameOnly};return super.executeCommand(e,n,t)}}i(c,[o.READ_OPERATION,o.RETRYABLE,o.EXECUTE_WITH_SELECTION]),e.exports=c},function(e,t,n){"use strict";const r=n(23);e.exports=class extends r{constructor(e,t,n){super(e,n)}_buildCommand(){return{profile:-1}}execute(e){super.execute((t,n)=>{if(null==t&&1===n.ok){const t=n.was;return 0===t?e(null,"off"):1===t?e(null,"slow_only"):2===t?e(null,"all"):e(new Error("Error: illegal profiling level value "+t),null)}e(null!=t?t:new Error("Error with profile command"),null)})}}},function(e,t,n){"use strict";const r=n(23),o=new Set(["off","slow_only","all"]);e.exports=class extends r{constructor(e,t,n){let r=0;"off"===t?r=0:"slow_only"===t?r=1:"all"===t&&(r=2),super(e,n),this.level=t,this.profile=r}_buildCommand(){return{profile:this.profile}}execute(e){const t=this.level;if(!o.has(t))return e(new Error("Error: illegal profiling level value "+t));super.execute((n,r)=>null==n&&1===r.ok?e(null,t):e(null!=n?n:new Error("Error with profile command"),null))}}},function(e,t,n){"use strict";const r=n(23);e.exports=class extends r{constructor(e,t,n){let r={validate:t};const o=Object.keys(n);for(let e=0;e<o.length;e++)Object.prototype.hasOwnProperty.call(n,o[e])&&"session"!==o[e]&&(r[o[e]]=n[o[e]]);super(e.s.db,n,null,r),this.collectionName=t}execute(e){const t=this.collectionName;super.execute((n,r)=>null!=n?e(n,null):0===r.ok?e(new Error("Error with validate command"),null):null!=r.result&&r.result.constructor!==String?e(new Error("Error with validation data"),null):null!=r.result&&null!=r.result.match(/exception|corrupt/)?e(new Error("Error: invalid collection "+t),null):null==r.valid||r.valid?e(null,r):e(new Error("Error: invalid collection "+t),null))}}},function(e,t,n){"use strict";const r=n(27),o=n(1).Aspect,i=n(1).defineAspects,s=n(0).MongoDBNamespace;class a extends r{constructor(e,t){super(e,t),this.ns=new s("admin","$cmd")}execute(e,t){const n={listDatabases:1};this.options.nameOnly&&(n.nameOnly=Number(n.nameOnly)),this.options.filter&&(n.filter=this.options.filter),"boolean"==typeof this.options.authorizedDatabases&&(n.authorizedDatabases=this.options.authorizedDatabases),super.executeCommand(e,n,t)}}i(a,[o.READ_OPERATION,o.RETRYABLE,o.EXECUTE_WITH_SELECTION]),e.exports=a},function(e,t,n){"use strict";const r=n(1).Aspect,o=n(1).defineAspects,i=n(27),s=n(13).serverType,a=n(13).ServerType,c=n(2).MongoError;class u extends i{constructor(e,t){super(e,t),this.collectionName=e.collectionName}execute(e,t){s(e)===a.Standalone?super.executeCommand(e,{reIndex:this.collectionName},(e,n)=>{e?t(e):t(null,!!n.ok)}):t(new c("reIndex can only be executed on standalone servers."))}}o(u,[r.EXECUTE_WITH_SELECTION]),e.exports=u},function(e,t,n){"use strict";const r=n(1).OperationBase,o=n(14).updateDocuments,i=n(0).hasAtomicOperators;e.exports=class extends r{constructor(e,t,n,r){if(super(r),i(n))throw new TypeError("Replacement document must not contain atomic operators");this.collection=e,this.filter=t,this.replacement=n}execute(e){const t=this.collection,n=this.filter,r=this.replacement,i=this.options;i.multi=!1,o(t,n,r,i,(t,n)=>function(e,t,n,r){if(null==r)return;if(e&&r)return r(e);if(null==t)return r(null,{result:{ok:1}});t.modifiedCount=null!=t.result.nModified?t.result.nModified:t.result.n,t.upsertedId=Array.isArray(t.result.upserted)&&t.result.upserted.length>0?t.result.upserted[0]:null,t.upsertedCount=Array.isArray(t.result.upserted)&&t.result.upserted.length?t.result.upserted.length:0,t.matchedCount=Array.isArray(t.result.upserted)&&t.result.upserted.length>0?0:t.result.n,t.ops=[n],r&&r(null,t)}(t,n,r,e))}}},function(e,t,n){"use strict";const r=n(1).Aspect,o=n(23);class i extends o{constructor(e,t){super(e.s.db,t,e)}_buildCommand(){const e=this.collection,t=this.options,n={collStats:e.collectionName};return null!=t.scale&&(n.scale=t.scale),n}}(0,n(1).defineAspects)(i,r.READ_OPERATION),e.exports=i},function(e,t,n){"use strict";const r=n(1).OperationBase,o=n(14).updateDocuments,i=n(0).hasAtomicOperators,s=n(1).Aspect;class a extends r{constructor(e,t,n,r){if(super(r),!i(n))throw new TypeError("Update document requires atomic operators");this.collection=e,this.filter=t,this.update=n}execute(e){const t=this.collection,n=this.filter,r=this.update,i=this.options;i.multi=!0,o(t,n,r,i,(t,n)=>{if(null!=e){if(t)return e(t);if(null==n)return e(null,{result:{ok:1}});if(this.explain)return e(void 0,n.result);n.modifiedCount=null!=n.result.nModified?n.result.nModified:n.result.n,n.upsertedId=Array.isArray(n.result.upserted)&&n.result.upserted.length>0?n.result.upserted[0]:null,n.upsertedCount=Array.isArray(n.result.upserted)&&n.result.upserted.length?n.result.upserted.length:0,n.matchedCount=Array.isArray(n.result.upserted)&&n.result.upserted.length>0?0:n.result.n,e(null,n)}})}}(0,n(1).defineAspects)(a,[s.EXPLAINABLE]),e.exports=a},function(e,t,n){"use strict";const r=n(1).OperationBase,o=n(14).updateDocuments,i=n(0).hasAtomicOperators,s=n(1).Aspect;class a extends r{constructor(e,t,n,r){if(super(r),!i(n))throw new TypeError("Update document requires atomic operators");this.collection=e,this.filter=t,this.update=n}execute(e){const t=this.collection,n=this.filter,r=this.update,i=this.options;i.multi=!1,o(t,n,r,i,(t,n)=>{if(null!=e){if(t)return e(t);if(null==n)return e(null,{result:{ok:1}});if(this.explain)return e(void 0,n.result);n.modifiedCount=null!=n.result.nModified?n.result.nModified:n.result.n,n.upsertedId=Array.isArray(n.result.upserted)&&n.result.upserted.length>0?n.result.upserted[0]:null,n.upsertedCount=Array.isArray(n.result.upserted)&&n.result.upserted.length?n.result.upserted.length:0,n.matchedCount=Array.isArray(n.result.upserted)&&n.result.upserted.length>0?0:n.result.n,e(null,n)}})}}(0,n(1).defineAspects)(a,[s.EXPLAINABLE]),e.exports=a},function(e,t,n){"use strict";const r=n(2).ReadPreference,o=n(90),i=n(5).format,s=n(2).Logger,a=n(87),c=n(46),u=n(137),l=n(3).MongoParseError;function f(e,t){let n=/^.*?\./,r=`.${e.replace(n,"")}`,o=`.${t.replace(n,"")}`;return!!r.endsWith(o)}function p(e,t,n){let a,u;try{a=function(e,t){let n="",a="",u="",l="admin",f=o.parse(e,!0);if((null==f.hostname||""===f.hostname)&&-1===e.indexOf(".sock"))throw new Error("No hostname or hostnames provided in connection string");if("0"===f.port)throw new Error("Invalid port (zero) with hostname");if(!isNaN(parseInt(f.port,10))&&parseInt(f.port,10)>65535)throw new Error("Invalid port (larger than 65535) with hostname");if(f.path&&f.path.length>0&&"/"!==f.path[0]&&-1===e.indexOf(".sock"))throw new Error("Missing delimiting slash between hosts and options");if(f.query)for(let e in f.query){if(-1!==e.indexOf("::"))throw new Error("Double colon in host identifier");if(""===f.query[e])throw new Error("Query parameter "+e+" is an incomplete value pair")}if(f.auth){let t=f.auth.split(":");if(-1!==e.indexOf(f.auth)&&t.length>2)throw new Error("Username with password containing an unescaped colon");if(-1!==e.indexOf(f.auth)&&-1!==f.auth.indexOf("@"))throw new Error("Username containing an unescaped at-sign")}let p=e.split("?").shift().split(","),d=[];for(let e=0;e<p.length;e++){let t=p[e];-1!==t.indexOf("mongodb")?-1!==t.indexOf("@")?d.push(t.split("@").pop()):d.push(t.substr("mongodb://".length)):-1!==t.indexOf("/")?d.push(t.split("/").shift()):-1===t.indexOf("/")&&d.push(t.trim())}for(let e=0;e<d.length;e++){let t=o.parse(i("mongodb://%s",d[e].trim()));if((!t.path||-1===t.path.indexOf(".sock"))&&(t.path&&-1!==t.path.indexOf(":")))throw t.path.split("/").length>1&&-1===t.path.indexOf("::")?new Error("Slash in host identifier"):new Error("Double colon in host identifier")}-1!==e.indexOf("?")?(u=e.substr(e.indexOf("?")+1),n=e.substring("mongodb://".length,e.indexOf("?"))):n=e.substring("mongodb://".length);-1!==n.indexOf("@")&&(a=n.split("@")[0],n=n.split("@")[1]);if(n.split("/").length>2)throw new Error("Unsupported host '"+n.split("?")[0]+"', hosts must be URL encoded and contain at most one unencoded slash");if(-1!==n.indexOf(".sock")){if(-1!==n.indexOf(".sock/")){if(l=n.split(".sock/")[1],-1!==l.indexOf("/")){if(2===l.split("/").length&&0===l.split("/")[1].length)throw new Error("Illegal trailing backslash after database name");throw new Error("More than 1 database name in URL")}n=n.split("/",n.indexOf(".sock")+".sock".length)}}else if(-1!==n.indexOf("/")){if(n.split("/").length>2){if(0===n.split("/")[2].length)throw new Error("Illegal trailing backslash after database name");throw new Error("More than 1 database name in URL")}l=n.split("/")[1],n=n.split("/")[0]}n=decodeURIComponent(n);let h,m,g,y,b={},v=a||"",S=v.split(":",2),w=decodeURIComponent(S[0]);if(S[0]!==encodeURIComponent(w))throw new Error("Username contains an illegal unescaped character");if(S[0]=w,S[1]){let e=decodeURIComponent(S[1]);if(S[1]!==encodeURIComponent(e))throw new Error("Password contains an illegal unescaped character");S[1]=e}2===S.length&&(b.auth={user:S[0],password:S[1]});t&&null!=t.auth&&(b.auth=t.auth);let _={socketOptions:{}},O={read_preference_tags:[]},T={socketOptions:{}},C={socketOptions:{}};if(b.server_options=_,b.db_options=O,b.rs_options=T,b.mongos_options=C,e.match(/\.sock/)){let t=e.substring(e.indexOf("mongodb://")+"mongodb://".length,e.lastIndexOf(".sock")+".sock".length);-1!==t.indexOf("@")&&(t=t.split("@")[1]),t=decodeURIComponent(t),g=[{domain_socket:t}]}else{h=n;let e={};g=h.split(",").map((function(t){let n,r,o;if(o=/\[([^\]]+)\](?::(.+))?/.exec(t))n=o[1],r=parseInt(o[2],10)||27017;else{let e=t.split(":",2);n=e[0]||"localhost",r=null!=e[1]?parseInt(e[1],10):27017,-1!==n.indexOf("?")&&(n=n.split(/\?/)[0])}return e[n+"_"+r]?null:(e[n+"_"+r]=1,{host:n,port:r})})).filter((function(e){return null!=e}))}b.dbName=l||"admin",m=(u||"").split(/[&;]/),m.forEach((function(e){if(e){var t=e.split("="),n=t[0],o=t[1];switch(n){case"slaveOk":case"slave_ok":_.slave_ok="true"===o,O.slaveOk="true"===o;break;case"maxPoolSize":case"poolSize":_.poolSize=parseInt(o,10),T.poolSize=parseInt(o,10);break;case"appname":b.appname=decodeURIComponent(o);break;case"autoReconnect":case"auto_reconnect":_.auto_reconnect="true"===o;break;case"ssl":if("prefer"===o){_.ssl=o,T.ssl=o,C.ssl=o;break}_.ssl="true"===o,T.ssl="true"===o,C.ssl="true"===o;break;case"sslValidate":_.sslValidate="true"===o,T.sslValidate="true"===o,C.sslValidate="true"===o;break;case"replicaSet":case"rs_name":T.rs_name=o;break;case"reconnectWait":T.reconnectWait=parseInt(o,10);break;case"retries":T.retries=parseInt(o,10);break;case"readSecondary":case"read_secondary":T.read_secondary="true"===o;break;case"fsync":O.fsync="true"===o;break;case"journal":O.j="true"===o;break;case"safe":O.safe="true"===o;break;case"nativeParser":case"native_parser":O.native_parser="true"===o;break;case"readConcernLevel":O.readConcern=new c(o);break;case"connectTimeoutMS":_.socketOptions.connectTimeoutMS=parseInt(o,10),T.socketOptions.connectTimeoutMS=parseInt(o,10),C.socketOptions.connectTimeoutMS=parseInt(o,10);break;case"socketTimeoutMS":_.socketOptions.socketTimeoutMS=parseInt(o,10),T.socketOptions.socketTimeoutMS=parseInt(o,10),C.socketOptions.socketTimeoutMS=parseInt(o,10);break;case"w":O.w=parseInt(o,10),isNaN(O.w)&&(O.w=o);break;case"authSource":O.authSource=o;break;case"gssapiServiceName":O.gssapiServiceName=o;break;case"authMechanism":if("GSSAPI"===o)if(null==b.auth){let e=decodeURIComponent(v);if(-1===e.indexOf("@"))throw new Error("GSSAPI requires a provided principal");b.auth={user:e,password:null}}else b.auth.user=decodeURIComponent(b.auth.user);else"MONGODB-X509"===o&&(b.auth={user:decodeURIComponent(v)});if("GSSAPI"!==o&&"MONGODB-X509"!==o&&"MONGODB-CR"!==o&&"DEFAULT"!==o&&"SCRAM-SHA-1"!==o&&"SCRAM-SHA-256"!==o&&"PLAIN"!==o)throw new Error("Only DEFAULT, GSSAPI, PLAIN, MONGODB-X509, or SCRAM-SHA-1 is supported by authMechanism");O.authMechanism=o;break;case"authMechanismProperties":{let e=o.split(","),t={};e.forEach((function(e){let n=e.split(":");t[n[0]]=n[1]})),O.authMechanismProperties=t,"string"==typeof t.SERVICE_NAME&&(O.gssapiServiceName=t.SERVICE_NAME),"string"==typeof t.SERVICE_REALM&&(O.gssapiServiceRealm=t.SERVICE_REALM),"string"==typeof t.CANONICALIZE_HOST_NAME&&(O.gssapiCanonicalizeHostName="true"===t.CANONICALIZE_HOST_NAME)}break;case"wtimeoutMS":O.wtimeout=parseInt(o,10);break;case"readPreference":if(!r.isValid(o))throw new Error("readPreference must be either primary/primaryPreferred/secondary/secondaryPreferred/nearest");O.readPreference=o;break;case"maxStalenessSeconds":O.maxStalenessSeconds=parseInt(o,10);break;case"readPreferenceTags":{let e={};if(null==(o=decodeURIComponent(o))||""===o){O.read_preference_tags.push(e);break}let t=o.split(/,/);for(let n=0;n<t.length;n++){let r=t[n].trim().split(/:/);e[r[0]]=r[1]}O.read_preference_tags.push(e)}break;case"compressors":{y=_.compression||{};let e=o.split(",");if(!e.every((function(e){return"snappy"===e||"zlib"===e})))throw new Error("Compressors must be at least one of snappy or zlib");y.compressors=e,_.compression=y}break;case"zlibCompressionLevel":{y=_.compression||{};let e=parseInt(o,10);if(e<-1||e>9)throw new Error("zlibCompressionLevel must be an integer between -1 and 9");y.zlibCompressionLevel=e,_.compression=y}break;case"retryWrites":O.retryWrites="true"===o;break;case"minSize":O.minSize=parseInt(o,10);break;default:s("URL Parser").warn(`${n} is not supported as a connection string option`)}}})),0===O.read_preference_tags.length&&(O.read_preference_tags=null);if(!(-1!==O.w&&0!==O.w||!0!==O.journal&&!0!==O.fsync&&!0!==O.safe))throw new Error("w set to -1 or 0 cannot be combined with safe/w/journal/fsync");O.readPreference||(O.readPreference="primary");return O=Object.assign(O,t),b.servers=g,b}(e,t)}catch(e){u=e}return u?n(u,null):n(null,a)}e.exports=function(e,t,n){let r;"function"==typeof t&&(n=t,t={}),t=t||{};try{r=o.parse(e,!0)}catch(e){return n(new Error("URL malformed, cannot be parsed"))}if("mongodb:"!==r.protocol&&"mongodb+srv:"!==r.protocol)return n(new Error("Invalid schema, expected `mongodb` or `mongodb+srv`"));if("mongodb:"===r.protocol)return p(e,t,n);if(r.hostname.split(".").length<3)return n(new Error("URI does not have hostname, domain name and tld"));if(r.domainLength=r.hostname.split(".").length,r.pathname&&r.pathname.match(","))return n(new Error("Invalid URI, cannot contain multiple hostnames"));if(r.port)return n(new Error("Ports not accepted with `mongodb+srv` URIs"));let i=`_mongodb._tcp.${r.host}`;a.resolveSrv(i,(function(e,o){if(e)return n(e);if(0===o.length)return n(new Error("No addresses found at host"));for(let e=0;e<o.length;e++)if(!f(o[e].name,r.hostname,r.domainLength))return n(new Error("Server record does not share hostname with parent URI"));let i=r.auth?`mongodb://${r.auth}@`:"mongodb://",s=o.map((function(e,t){return 0===t?`${i}${e.name}:${e.port}`:`${e.name}:${e.port}`})).join(",")+"/",c=[];if(r.path){let e=r.path.slice(1);-1!==e.indexOf("?")&&(e=e.slice(0,e.indexOf("?"))),s+=e}(t.ssl||r.search)&&(t.ssl||!r.search||r.search.match("ssl"))||c.push("ssl=true"),r.search&&c.push(r.search.replace("?","")),a.resolveTxt(r.host,(function(e,r){if(e&&"ENODATA"!==e.code&&"ENOTFOUND"!==e.code)return n(e);if(e&&"ENODATA"===e.code&&(r=null),r){if(r.length>1)return n(new l("Multiple text records not allowed"));r=r[0].join("");const e=u.parse(r),t=Object.keys(e);if(t.some(e=>"authSource"!==e&&"replicaSet"!==e))return n(new l("Text record must only set `authSource` or `replicaSet`"));t.length>0&&c.push(r)}c.length&&(s+=`?${c.join("&")}`),p(s,t,n)}))}))}},function(e,t,n){"use strict";e.exports=function(e){const t=n(192),r=e.mongodb.MongoTimeoutError,o=n(100),i=o.debug,s=o.databaseNamespace,a=o.collectionNamespace,c=o.MongoCryptError,u=n(202),l=new Map([[0,"MONGOCRYPT_CTX_ERROR"],[1,"MONGOCRYPT_CTX_NEED_MONGO_COLLINFO"],[2,"MONGOCRYPT_CTX_NEED_MONGO_MARKINGS"],[3,"MONGOCRYPT_CTX_NEED_MONGO_KEYS"],[4,"MONGOCRYPT_CTX_NEED_KMS"],[5,"MONGOCRYPT_CTX_READY"],[6,"MONGOCRYPT_CTX_DONE"]]);return{StateMachine:class{constructor(e){this.options=e||{},this.bson=e.bson}execute(e,t,n){const o=this.bson,s=e._keyVaultNamespace,a=e._keyVaultClient,u=e._metaDataClient,f=e._mongocryptdClient,p=e._mongocryptdManager;switch(i(`[context#${t.id}] ${l.get(t.state)||t.state}`),t.state){case 1:{const r=o.deserialize(t.nextMongoOperation());return void this.fetchCollectionInfo(u,t.ns,r,(r,o)=>{if(r)return n(r,null);o&&t.addMongoOperationResponse(o),t.finishMongoOperation(),this.execute(e,t,n)})}case 2:{const o=t.nextMongoOperation();return void this.markCommand(f,t.ns,o,(i,s)=>{if(i)return i instanceof r&&p&&!p.bypassSpawn?void p.spawn(()=>{this.markCommand(f,t.ns,o,(r,o)=>{if(r)return n(r,null);t.addMongoOperationResponse(o),t.finishMongoOperation(),this.execute(e,t,n)})}):n(i,null);t.addMongoOperationResponse(s),t.finishMongoOperation(),this.execute(e,t,n)})}case 3:{const r=t.nextMongoOperation();return void this.fetchKeys(a,s,r,(r,i)=>{if(r)return n(r,null);i.forEach(e=>{t.addMongoOperationResponse(o.serialize(e))}),t.finishMongoOperation(),this.execute(e,t,n)})}case 4:{const r=[];let o;for(;o=t.nextKMSRequest();)r.push(this.kmsRequest(o));return void Promise.all(r).then(()=>{t.finishKMSRequests(),this.execute(e,t,n)}).catch(e=>{n(e,null)})}case 5:{const e=t.finalize();if(0===t.state){const e=t.status.message||"Finalization error";return void n(new c(e))}return void n(null,o.deserialize(e,this.options))}case 0:{const e=t.status.message;return void n(new c(e))}case 6:return;default:return void n(new c(`Unknown state: ${t.state}`))}}kmsRequest(e){const n=e.endpoint.split(":"),r=null!=n[1]?Number.parseInt(n[1],10):443,o={host:n[0],servername:n[0],port:r},i=e.message;return new Promise((n,r)=>{const s=new u,a=t.connect(o,()=>{a.write(i)});a.once("timeout",()=>{a.removeAllListeners(),a.destroy(),r(new c("KMS request timed out"))}),a.once("error",e=>{a.removeAllListeners(),a.destroy();const t=new c("KMS request failed");t.originalError=e,r(t)}),a.on("data",t=>{for(s.append(t);e.bytesNeeded>0&&s.length;){const t=Math.min(e.bytesNeeded,s.length);e.addResponse(s.slice(0,t)),s.consume(t)}e.bytesNeeded<=0&&a.end(n)})})}fetchCollectionInfo(e,t,n,r){const o=this.bson,i=s(t);e.db(i).listCollections(n).toArray((e,t)=>{if(e)return void r(e,null);const n=t.length>0?o.serialize(t[0]):null;r(null,n)})}markCommand(e,t,n,r){const o=this.bson,i=s(t),a=o.deserialize(n,{promoteLongs:!1,promoteValues:!1});e.db(i).command(a,(e,t)=>{r(e,e?null:o.serialize(t,this.options))})}fetchKeys(e,t,n,r){const o=this.bson,i=s(t),c=a(t);n=o.deserialize(n),e.db(i).collection(c,{readConcern:{level:"majority"}}).find(n).toArray((e,t)=>{e?r(e,null):r(null,t)})}}}}},function(e,t,n){"use strict";e.exports=function(e){const t=n(225)("mongocrypt"),r=n(100).databaseNamespace,o=e.stateMachine.StateMachine,i=n(488).MongocryptdManager,s=e.mongodb.MongoClient,a=e.mongodb.MongoError,c=n(226);return{AutoEncrypter:class{constructor(e,n){this._client=e,this._bson=n.bson||e.topology.bson,this._mongocryptdManager=new i(n.extraOptions),this._mongocryptdClient=new s(this._mongocryptdManager.uri,{useNewUrlParser:!0,useUnifiedTopology:!0,serverSelectionTimeoutMS:1e3}),this._keyVaultNamespace=n.keyVaultNamespace||"admin.datakeys",this._keyVaultClient=n.keyVaultClient||e,this._metaDataClient=n.metadataClient||e,this._bypassEncryption="boolean"==typeof n.bypassAutoEncryption&&n.bypassAutoEncryption;const r={};n.schemaMap&&(r.schemaMap=Buffer.isBuffer(n.schemaMap)?n.schemaMap:this._bson.serialize(n.schemaMap)),n.kmsProviders&&(r.kmsProviders=Buffer.isBuffer(n.kmsProviders)?n.kmsProviders:this._bson.serialize(n.kmsProviders)),n.logger&&(r.logger=n.logger),Object.assign(r,{cryptoCallbacks:c}),this._mongocrypt=new t.MongoCrypt(r),this._contextCounter=0}init(e){const t=(t,n)=>{t&&t.message&&(t.message.match(/timed out after/)||t.message.match(/ENOTFOUND/))?e(new a("Unable to connect to `mongocryptd`, please make sure it is running or in your PATH for auto-spawn")):e(t,n)};if(this._mongocryptdManager.bypassSpawn)return this._mongocryptdClient.connect(t);this._mongocryptdManager.spawn(()=>this._mongocryptdClient.connect(t))}teardown(e,t){this._mongocryptdClient.close(e,t)}encrypt(e,t,n,i){if("string"!=typeof e)throw new TypeError("Parameter `ns` must be a string");if("object"!=typeof t)throw new TypeError("Parameter `cmd` must be an object");if("function"==typeof n&&null==i&&(i=n,n={}),this._bypassEncryption)return void i(void 0,t);const s=this._bson,a=Buffer.isBuffer(t)?t:s.serialize(t,n);let c;try{c=this._mongocrypt.makeEncryptionContext(r(e),a)}catch(e){return void i(e,null)}c.id=this._contextCounter++,c.ns=e,c.document=t,new o(Object.assign({bson:s},n)).execute(this,c,i)}decrypt(e,t,n){"function"==typeof t&&null==n&&(n=t,t={});const r=this._bson,i=Buffer.isBuffer(e)?e:r.serialize(e,t);let s;try{s=this._mongocrypt.makeDecryptionContext(i)}catch(e){return void n(e,null)}s.id=this._contextCounter++,new o(Object.assign({bson:r},t)).execute(this,s,n)}}}}},function(e,t,n){var r=n(136).sep||"/";e.exports=function(e){if("string"!=typeof e||e.length<=7||"file://"!=e.substring(0,7))throw new TypeError("must pass in a file:// URI to convert to a file path");var t=decodeURI(e.substring(7)),n=t.indexOf("/"),o=t.substring(0,n),i=t.substring(n+1);"localhost"==o&&(o="");o&&(o=r+r+o);i=i.replace(/^(.+)\|/,"$1:"),"\\"==r&&(i=i.replace(/\//g,"\\"));/^.+\:/.test(i)||(i=r+i);return o+i}},function(e,t,n){"use strict";const r=n(489).spawn;e.exports={MongocryptdManager:class{constructor(e){(e=e||{}).mongocryptdURI?this.uri=e.mongocryptdURI:this.uri="mongodb://localhost:27020/?serverSelectionTimeoutMS=1000",this.bypassSpawn=!!e.mongocryptdBypassSpawn,this.spawnPath=e.mongocryptdSpawnPath||"",this.spawnArgs=[],Array.isArray(e.mongocryptdSpawnArgs)&&(this.spawnArgs=this.spawnArgs.concat(e.mongocryptdSpawnArgs)),this.spawnArgs.filter(e=>"string"==typeof e).every(e=>e.indexOf("--idleShutdownTimeoutSecs")<0)&&this.spawnArgs.push("--idleShutdownTimeoutSecs",60)}spawn(e){const t=this.spawnPath||"mongocryptd";this._child=r(t,this.spawnArgs,{stdio:"ignore",detached:!0}),this._child.on("error",()=>{}),this._child.unref(),process.nextTick(e)}}}},function(e,t){e.exports=require("child_process")},function(e,t,n){"use strict";e.exports=function(e){const t=n(225)("mongocrypt"),r=n(100),o=r.databaseNamespace,i=r.collectionNamespace,s=r.promiseOrCallback,a=e.stateMachine.StateMachine,c=n(226);return{ClientEncryption:class{constructor(e,n){if(this._client=e,this._bson=n.bson||e.topology.bson,null==n.keyVaultNamespace)throw new TypeError("Missing required option `keyVaultNamespace`");Object.assign(n,{cryptoCallbacks:c}),n.kmsProviders&&!Buffer.isBuffer(n.kmsProviders)&&(n.kmsProviders=this._bson.serialize(n.kmsProviders)),this._keyVaultNamespace=n.keyVaultNamespace,this._keyVaultClient=n.keyVaultClient||e,this._mongoCrypt=new t.MongoCrypt(n)}createDataKey(e,t,n){"function"==typeof t&&(n=t,t={});const r=this._bson;t=function(e,t){if((t=Object.assign({},t)).keyAltNames){if(!Array.isArray(t.keyAltNames))throw new TypeError(`Option "keyAltNames" must be an array of string, but was of type ${typeof t.keyAltNames}.`);const n=[];for(let r=0;r<t.keyAltNames.length;r+=1){const o=t.keyAltNames[r],i=typeof o;if("string"!==i)throw new TypeError(`Option "keyAltNames" must be an array of string, but item at index ${r} was of type ${i} `);n.push(e.serialize({keyAltName:o}))}t.keyAltNames=n}else null==t.keyAltNames&&delete t.keyAltNames;return t}(r,t);const c=r.serialize(Object.assign({provider:e},t.masterKey)),u=this._mongoCrypt.makeDataKeyContext(c),l=new a({bson:r});return s(n,e=>{l.execute(this,u,(t,n)=>{if(t)return void e(t,null);const r=o(this._keyVaultNamespace),s=i(this._keyVaultNamespace);this._keyVaultClient.db(r).collection(s).insertOne(n,{w:"majority"},(t,n)=>{t?e(t,null):e(null,n.insertedId)})})})}encrypt(e,t,n){const r=this._bson,o=r.serialize({v:e}),i=Object.assign({},t);if(t.keyId&&(i.keyId=t.keyId.buffer),t.keyAltName){const e=t.keyAltName;if(t.keyId)throw new TypeError('"options" cannot contain both "keyId" and "keyAltName"');const n=typeof e;if("string"!==n)throw new TypeError(`"options.keyAltName" must be of type string, but was of type ${n}`);i.keyAltName=r.serialize({keyAltName:e})}const c=new a({bson:r}),u=this._mongoCrypt.makeExplicitEncryptionContext(o,i);return s(n,e=>{c.execute(this,u,(t,n)=>{t?e(t,null):e(null,n.v)})})}decrypt(e,t){const n=this._bson,r=n.serialize({v:e}),o=this._mongoCrypt.makeExplicitDecryptionContext(r),i=new a({bson:n});return s(t,e=>{i.execute(this,o,(t,n)=>{t?e(t,null):e(null,n.v)})})}}}}},function(e,t,n){"use strict";const r=n(227),o=n(2).BSON.ObjectID,i=n(2).ReadPreference,s=n(22).Buffer,a=n(89),c=n(5).format,u=n(5),l=n(2).MongoError,f=u.inherits,p=n(18).Duplex,d=n(0).shallowClone,h=n(0).executeLegacyOperation,m=n(5).deprecate;const g=m(()=>{},"GridStore is deprecated, and will be removed in a future version. Please use GridFSBucket instead");var y=function e(t,n,s,a,c){if(g(),!(this instanceof e))return new e(t,n,s,a,c);this.db=t,void 0===c&&(c={}),void 0===a?(a=s,s=void 0):"object"==typeof a&&(c=a,a=s,s=void 0),n&&"ObjectID"===n._bsontype?(this.referenceBy=1,this.fileId=n,this.filename=s):void 0===s?(this.referenceBy=0,this.filename=n,null!=a.indexOf("w")&&(this.fileId=new o)):(this.referenceBy=1,this.fileId=n,this.filename=s),this.mode=null==a?"r":a,this.options=c||{},this.isOpen=!1,this.root=null==this.options.root?e.DEFAULT_ROOT_COLLECTION:this.options.root,this.position=0,this.readPreference=this.options.readPreference||t.options.readPreference||i.primary,this.writeConcern=U(t,this.options),this.internalChunkSize=null==this.options.chunkSize?r.DEFAULT_CHUNK_SIZE:this.options.chunkSize;var u=this.options.promiseLibrary||Promise;this.promiseLibrary=u,Object.defineProperty(this,"chunkSize",{enumerable:!0,get:function(){return this.internalChunkSize},set:function(e){"w"!==this.mode[0]||0!==this.position||null!=this.uploadDate?this.internalChunkSize=this.internalChunkSize:this.internalChunkSize=e}}),Object.defineProperty(this,"md5",{enumerable:!0,get:function(){return this.internalMd5}}),Object.defineProperty(this,"chunkNumber",{enumerable:!0,get:function(){return this.currentChunk&&this.currentChunk.chunkNumber?this.currentChunk.chunkNumber:null}})};y.prototype.open=function(e,t){if("function"==typeof e&&(t=e,e={}),e=e||{},"w"!==this.mode&&"w+"!==this.mode&&"r"!==this.mode)throw l.create({message:"Illegal mode "+this.mode,driver:!0});return h(this.db.s.topology,b,[this,e,t],{skipSessions:!0})};var b=function(e,t,n){var r=U(e.db,e.options);"w"===e.mode||"w+"===e.mode?e.collection().ensureIndex([["filename",1]],r,(function(){var t=e.chunkCollection(),o=d(r);o.unique=!0,t.ensureIndex([["files_id",1],["n",1]],o,(function(){E(e,r,(function(t,r){if(t)return n(t);e.isOpen=!0,n(t,r)}))}))})):E(e,r,(function(t,r){if(t)return n(t);e.isOpen=!0,n(t,r)}))};y.prototype.eof=function(){return this.position===this.length},y.prototype.getc=function(e,t){return"function"==typeof e&&(t=e,e={}),e=e||{},h(this.db.s.topology,v,[this,e,t],{skipSessions:!0})};var v=function(e,t,n){e.eof()?n(null,null):e.currentChunk.eof()?A(e,e.currentChunk.chunkNumber+1,(function(t,r){e.currentChunk=r,e.position=e.position+1,n(t,e.currentChunk.getc())})):(e.position=e.position+1,n(null,e.currentChunk.getc()))};y.prototype.puts=function(e,t,n){"function"==typeof t&&(n=t,t={}),t=t||{};var r=null==e.match(/\n$/)?e+"\n":e;return h(this.db.s.topology,this.write.bind(this),[r,t,n],{skipSessions:!0})},y.prototype.stream=function(){return new z(this)},y.prototype.write=function(e,t,n,r){return"function"==typeof n&&(r=n,n={}),n=n||{},h(this.db.s.topology,L,[this,e,t,n,r],{skipSessions:!0})},y.prototype.destroy=function(){this.writable&&(this.readable=!1,this.writable&&(this.writable=!1,this._q.length=0,this.emit("close")))},y.prototype.writeFile=function(e,t,n){return"function"==typeof t&&(n=t,t={}),t=t||{},h(this.db.s.topology,S,[this,e,t,n],{skipSessions:!0})};var S=function(e,t,n,o){"string"!=typeof t?e.open((function(e,n){if(e)return o(e,n);a.fstat(t,(function(e,i){if(e)return o(e,n);var c=0,u=0,l=function(){var e=s.alloc(n.chunkSize);a.read(t,e,0,e.length,c,(function(e,s,f){if(e)return o(e,n);c+=s,new r(n,{n:u++},n.writeConcern).write(f.slice(0,s),(function(e,r){if(e)return o(e,n);r.save({},(function(e){return e?o(e,n):(n.position=n.position+s,n.currentChunk=r,c>=i.size?void a.close(t,(function(e){if(e)return o(e);n.close((function(e){return o(e||null,n)}))})):process.nextTick(l))}))}))}))};process.nextTick(l)}))})):a.open(t,"r",(function(t,n){if(t)return o(t);e.writeFile(n,o)}))};y.prototype.close=function(e,t){return"function"==typeof e&&(t=e,e={}),e=e||{},h(this.db.s.topology,w,[this,e,t],{skipSessions:!0})};var w=function(e,t,n){"w"===e.mode[0]?(t=Object.assign({},e.writeConcern,t),null!=e.currentChunk&&e.currentChunk.position>0?e.currentChunk.save({},(function(r){if(r&&"function"==typeof n)return n(r);e.collection((function(r,o){if(r&&"function"==typeof n)return n(r);null!=e.uploadDate?I(e,(function(e,r){if(e){if("function"==typeof n)return n(e);throw e}o.save(r,t,(function(e){"function"==typeof n&&n(e,r)}))})):(e.uploadDate=new Date,I(e,(function(e,r){if(e){if("function"==typeof n)return n(e);throw e}o.save(r,t,(function(e){"function"==typeof n&&n(e,r)}))})))}))})):e.collection((function(r,o){if(r&&"function"==typeof n)return n(r);e.uploadDate=new Date,I(e,(function(e,r){if(e){if("function"==typeof n)return n(e);throw e}o.save(r,t,(function(e){"function"==typeof n&&n(e,r)}))}))}))):"r"===e.mode[0]?"function"==typeof n&&n(null,null):"function"==typeof n&&n(l.create({message:c("Illegal mode %s",e.mode),driver:!0}))};y.prototype.chunkCollection=function(e){return"function"==typeof e?this.db.collection(this.root+".chunks",e):this.db.collection(this.root+".chunks")},y.prototype.unlink=function(e,t){return"function"==typeof e&&(t=e,e={}),e=e||{},h(this.db.s.topology,_,[this,e,t],{skipSessions:!0})};var _=function(e,t,n){M(e,(function(t){if(null!==t)return t.message="at deleteChunks: "+t.message,n(t);e.collection((function(t,r){if(null!==t)return t.message="at collection: "+t.message,n(t);r.remove({_id:e.fileId},e.writeConcern,(function(t){n(t,e)}))}))}))};y.prototype.collection=function(e){return"function"==typeof e&&this.db.collection(this.root+".files",e),this.db.collection(this.root+".files")},y.prototype.readlines=function(e,t,n){var r=Array.prototype.slice.call(arguments,0);return n="function"==typeof r[r.length-1]?r.pop():void 0,e=(e=r.length?r.shift():"\n")||"\n",t=r.length?r.shift():{},h(this.db.s.topology,O,[this,e,t,n],{skipSessions:!0})};var O=function(e,t,n,r){e.read((function(e,n){if(e)return r(e);var o=n.toString().split(t);o=o.length>0?o.splice(0,o.length-1):[];for(var i=0;i<o.length;i++)o[i]=o[i]+t;r(null,o)}))};y.prototype.rewind=function(e,t){return"function"==typeof e&&(t=e,e={}),e=e||{},h(this.db.s.topology,T,[this,e,t],{skipSessions:!0})};var T=function(e,t,n){0!==e.currentChunk.chunkNumber?"w"===e.mode[0]?M(e,(function(t){if(t)return n(t);e.currentChunk=new r(e,{n:0},e.writeConcern),e.position=0,n(null,e)})):e.currentChunk(0,(function(t,r){if(t)return n(t);e.currentChunk=r,e.currentChunk.rewind(),e.position=0,n(null,e)})):(e.currentChunk.rewind(),e.position=0,n(null,e))};y.prototype.read=function(e,t,n,r){var o=Array.prototype.slice.call(arguments,0);return r="function"==typeof o[o.length-1]?o.pop():void 0,e=o.length?o.shift():null,t=o.length?o.shift():null,n=o.length?o.shift():{},h(this.db.s.topology,C,[this,e,t,n,r],{skipSessions:!0})};var C=function(e,t,n,r,o){var i=null==t?e.length-e.position:t,a=null==n?s.alloc(i):n;if(a._index=null!=n&&null!=n._index?n._index:0,e.currentChunk.length()-e.currentChunk.position+a._index>=i){var c=e.currentChunk.readSlice(i-a._index);return c.copy(a,a._index),e.position=e.position+a.length,0===i&&0===a.length?o(l.create({message:"File does not exist",driver:!0}),null):o(null,a)}(c=e.currentChunk.readSlice(e.currentChunk.length()-e.currentChunk.position)).copy(a,a._index),a._index+=c.length,A(e,e.currentChunk.chunkNumber+1,(function(n,r){if(n)return o(n);r.length()>0?(e.currentChunk=r,e.read(t,a,o)):a._index>0?o(null,a):o(l.create({message:"no chunks found for file, possibly corrupt",driver:!0}),null)}))};y.prototype.tell=function(e){var t=this;return"function"==typeof e?e(null,this.position):new t.promiseLibrary((function(e){e(t.position)}))},y.prototype.seek=function(e,t,n,r){var o=Array.prototype.slice.call(arguments,1);return r="function"==typeof o[o.length-1]?o.pop():void 0,t=o.length?o.shift():null,n=o.length?o.shift():{},h(this.db.s.topology,x,[this,e,t,n,r],{skipSessions:!0})};var x=function(e,t,n,r,o){if("r"!==e.mode)return o(l.create({message:"seek is only supported for mode r",driver:!0}));var i=null==n?y.IO_SEEK_SET:n,s=t,a=0;a=i===y.IO_SEEK_CUR?e.position+s:i===y.IO_SEEK_END?e.length+s:s;var c=Math.floor(a/e.chunkSize);A(e,c,(function(t,n){return t?o(t,null):null==n?o(new Error("no chunk found")):(e.currentChunk=n,e.position=a,e.currentChunk.position=e.position%e.chunkSize,void o(t,e))}))},E=function(e,t,n){var i=e.collection(),s=1===e.referenceBy?{_id:e.fileId}:{filename:e.filename};function a(e){a.err||n(a.err=e)}s=null==e.fileId&&null==e.filename?null:s,t.readPreference=e.readPreference,null!=s?i.findOne(s,t,(function(i,s){if(i)return a(i);if(null!=s)e.fileId=s._id,e.filename="r"===e.mode||void 0===e.filename?s.filename:e.filename,e.contentType=s.contentType,e.internalChunkSize=s.chunkSize,e.uploadDate=s.uploadDate,e.aliases=s.aliases,e.length=s.length,e.metadata=s.metadata,e.internalMd5=s.md5;else{if("r"===e.mode){e.length=0;var u="ObjectID"===e.fileId._bsontype?e.fileId.toHexString():e.fileId;return a(l.create({message:c("file with id %s not opened for writing",1===e.referenceBy?u:e.filename),driver:!0}))}e.fileId=null==e.fileId?new o:e.fileId,e.contentType=y.DEFAULT_CONTENT_TYPE,e.internalChunkSize=null==e.internalChunkSize?r.DEFAULT_CHUNK_SIZE:e.internalChunkSize,e.length=0}"r"===e.mode?A(e,0,t,(function(t,r){if(t)return a(t);e.currentChunk=r,e.position=0,n(null,e)})):"w"===e.mode&&s?M(e,t,(function(t){if(t)return a(t);e.currentChunk=new r(e,{n:0},e.writeConcern),e.contentType=null==e.options.content_type?e.contentType:e.options.content_type,e.internalChunkSize=null==e.options.chunk_size?e.internalChunkSize:e.options.chunk_size,e.metadata=null==e.options.metadata?e.metadata:e.options.metadata,e.aliases=null==e.options.aliases?e.aliases:e.options.aliases,e.position=0,n(null,e)})):"w"===e.mode?(e.currentChunk=new r(e,{n:0},e.writeConcern),e.contentType=null==e.options.content_type?e.contentType:e.options.content_type,e.internalChunkSize=null==e.options.chunk_size?e.internalChunkSize:e.options.chunk_size,e.metadata=null==e.options.metadata?e.metadata:e.options.metadata,e.aliases=null==e.options.aliases?e.aliases:e.options.aliases,e.position=0,n(null,e)):"w+"===e.mode&&A(e,k(e),t,(function(t,o){if(t)return a(t);e.currentChunk=null==o?new r(e,{n:0},e.writeConcern):o,e.currentChunk.position=e.currentChunk.data.length(),e.metadata=null==e.options.metadata?e.metadata:e.options.metadata,e.aliases=null==e.options.aliases?e.aliases:e.options.aliases,e.position=e.length,n(null,e)}))})):(e.fileId=null==e.fileId?new o:e.fileId,e.contentType=y.DEFAULT_CONTENT_TYPE,e.internalChunkSize=null==e.internalChunkSize?r.DEFAULT_CHUNK_SIZE:e.internalChunkSize,e.length=0,"w"===e.mode?M(e,t,(function(t){if(t)return a(t);e.currentChunk=new r(e,{n:0},e.writeConcern),e.contentType=null==e.options.content_type?e.contentType:e.options.content_type,e.internalChunkSize=null==e.options.chunk_size?e.internalChunkSize:e.options.chunk_size,e.metadata=null==e.options.metadata?e.metadata:e.options.metadata,e.aliases=null==e.options.aliases?e.aliases:e.options.aliases,e.position=0,n(null,e)})):"w+"===e.mode&&A(e,k(e),t,(function(t,o){if(t)return a(t);e.currentChunk=null==o?new r(e,{n:0},e.writeConcern):o,e.currentChunk.position=e.currentChunk.data.length(),e.metadata=null==e.options.metadata?e.metadata:e.options.metadata,e.aliases=null==e.options.aliases?e.aliases:e.options.aliases,e.position=e.length,n(null,e)})))},N=function(e,t,n,o){"function"==typeof n&&(o=n,n=null);var i="boolean"==typeof n&&n;if("w"!==e.mode)o(l.create({message:c("file with id %s not opened for writing",1===e.referenceBy?e.referenceBy:e.filename),driver:!0}),null);else{if(!(e.currentChunk.position+t.length>=e.chunkSize))return e.position=e.position+t.length,e.currentChunk.write(t),i?e.close((function(t){o(t,e)})):o(null,e);for(var s=e.currentChunk.chunkNumber,a=e.chunkSize-e.currentChunk.position,u=t.slice(0,a),f=t.slice(a),p=[e.currentChunk.write(u)];f.length>=e.chunkSize;){var d=new r(e,{n:s+1},e.writeConcern);u=f.slice(0,e.chunkSize),f=f.slice(e.chunkSize),s+=1,d.write(u),p.push(d)}e.currentChunk=new r(e,{n:s+1},e.writeConcern),f.length>0&&e.currentChunk.write(f),e.position=e.position+t.length;for(var h=p.length,m=0;m<p.length;m++)p[m].save({},(function(t){return t?o(t):(h-=1)<=0?i?e.close((function(t){o(t,e)})):o(null,e):void 0}))}},I=function(e,t){var n={_id:e.fileId,filename:e.filename,contentType:e.contentType,length:e.position?e.position:0,chunkSize:e.chunkSize,uploadDate:e.uploadDate,aliases:e.aliases,metadata:e.metadata},r={filemd5:e.fileId,root:e.root};e.db.command(r,(function(e,r){if(e)return t(e);n.md5=r.md5,t(null,n)}))},A=function(e,t,n,o){"function"==typeof n&&(o=n,n={}),(n=n||e.writeConcern).readPreference=e.readPreference,e.chunkCollection().findOne({files_id:e.fileId,n:t},n,(function(t,n){if(t)return o(t);o(null,new r(e,null==n?{}:n,e.writeConcern))}))},k=function(e){return Math.floor((e.length?e.length-1:0)/e.chunkSize)},M=function(e,t,n){"function"==typeof t&&(n=t,t={}),t=t||e.writeConcern,null!=e.fileId?e.chunkCollection().remove({files_id:e.fileId},t,(function(e){if(e)return n(e,!1);n(null,!0)})):n(null,!0)};y.DEFAULT_ROOT_COLLECTION="fs",y.DEFAULT_CONTENT_TYPE="binary/octet-stream",y.IO_SEEK_SET=0,y.IO_SEEK_CUR=1,y.IO_SEEK_END=2,y.exist=function(e,t,n,r,o){var i=Array.prototype.slice.call(arguments,2);return o="function"==typeof i[i.length-1]?i.pop():void 0,n=i.length?i.shift():null,r=(r=i.length?i.shift():{})||{},h(e.s.topology,R,[e,t,n,r,o],{skipSessions:!0})};var R=function(e,t,n,r,o){var s=r.readPreference||i.PRIMARY,a=null!=n?n:y.DEFAULT_ROOT_COLLECTION;e.collection(a+".files",(function(e,n){if(e)return o(e);var r="string"==typeof t||"[object RegExp]"===Object.prototype.toString.call(t)?{filename:t}:{_id:t};null!=t&&"object"==typeof t&&"[object RegExp]"!==Object.prototype.toString.call(t)&&(r=t),n.findOne(r,{readPreference:s},(function(e,t){if(e)return o(e);o(null,null!=t)}))}))};y.list=function(e,t,n,r){var o=Array.prototype.slice.call(arguments,1);return r="function"==typeof o[o.length-1]?o.pop():void 0,t=o.length?o.shift():null,n=(n=o.length?o.shift():{})||{},h(e.s.topology,j,[e,t,n,r],{skipSessions:!0})};var j=function(e,t,n,r){null!=t&&"object"==typeof t&&(n=t,t=null);var o=n.readPreference||i.primary,s=null!=n.id&&n.id,a=null!=t?t:y.DEFAULT_ROOT_COLLECTION,c=[];e.collection(a+".files",(function(e,t){if(e)return r(e);t.find({},{readPreference:o},(function(e,t){if(e)return r(e);t.each((function(e,t){null!=t?c.push(s?t._id:t.filename):r(e,c)}))}))}))};y.read=function(e,t,n,r,o,i){var s=Array.prototype.slice.call(arguments,2);return i="function"==typeof s[s.length-1]?s.pop():void 0,n=s.length?s.shift():null,r=s.length?s.shift():null,o=(o=s.length?s.shift():null)||{},h(e.s.topology,D,[e,t,n,r,o,i],{skipSessions:!0})};var D=function(e,t,n,r,o,i){new y(e,t,"r",o).open((function(e,t){return e?i(e):r&&r>=t.length?i("offset larger than size of file",null):n&&n>t.length?i("length is larger than the size of the file",null):r&&n&&r+n>t.length?i("offset and length is larger than the size of the file",null):void(null!=r?t.seek(r,(function(e,t){if(e)return i(e);t.read(n,i)})):t.read(n,i))}))};y.readlines=function(e,t,n,r,o){var i=Array.prototype.slice.call(arguments,2);return o="function"==typeof i[i.length-1]?i.pop():void 0,n=i.length?i.shift():null,r=(r=i.length?i.shift():null)||{},h(e.s.topology,P,[e,t,n,r,o],{skipSessions:!0})};var P=function(e,t,n,r,o){var i=null==n?"\n":n;new y(e,t,"r",r).open((function(e,t){if(e)return o(e);t.readlines(i,o)}))};y.unlink=function(e,t,n,r){var o=Array.prototype.slice.call(arguments,2);return r="function"==typeof o[o.length-1]?o.pop():void 0,n=(n=o.length?o.shift():{})||{},h(e.s.topology,B,[this,e,t,n,r],{skipSessions:!0})};var B=function(e,t,n,r,o){var i=U(t,r);if(n.constructor===Array)for(var s=0,a=0;a<n.length;a++)++s,y.unlink(t,n[a],r,(function(){0==--s&&o(null,e)}));else new y(t,n,"w",r).open((function(t,n){if(t)return o(t);M(n,(function(t){if(t)return o(t);n.collection((function(t,r){if(t)return o(t);r.remove({_id:n.fileId},i,(function(t){o(t,e)}))}))}))}))},L=function(e,t,n,r,o){return s.isBuffer(t)?N(e,t,n,o):N(e,s.from(t,"binary"),n,o)},q=function(e){const t=Object.assign(e,e.writeConcern);var n={};return null!=t.w&&(n.w=t.w),!0===t.journal&&(n.j=t.journal),!0===t.j&&(n.j=t.j),!0===t.fsync&&(n.fsync=t.fsync),null!=t.wtimeout&&(n.wtimeout=t.wtimeout),n},U=function(e,t){var n={w:1};if(null!=(t=t||{}).writeConcern||null!=t.w||"boolean"==typeof t.j||"boolean"==typeof t.journal||"boolean"==typeof t.fsync?n=q(t):null!=t.safe&&"object"==typeof t.safe?n=q(t.safe):"boolean"==typeof t.safe?n={w:t.safe?1:0}:null!=e.options.writeConcern||null!=e.options.w||"boolean"==typeof e.options.j||"boolean"==typeof e.options.journal||"boolean"==typeof e.options.fsync?n=q(e.options):!e.safe||null==e.safe.w&&"boolean"!=typeof e.safe.j&&"boolean"!=typeof e.safe.journal&&"boolean"!=typeof e.safe.fsync?"boolean"==typeof e.safe&&(n={w:e.safe?1:0}):n=q(e.safe),n.w<1&&(!0===n.journal||!0===n.j||!0===n.fsync))throw l.create({message:"No acknowledgement using w < 1 cannot be combined with journal:true or fsync:true",driver:!0});return n},z=function(e){p.call(this),this.gs=e,this.endCalled=!1,this.totalBytesToRead=this.gs.length-this.gs.position,this.seekPosition=this.gs.position};f(z,p),z.prototype._pipe=z.prototype.pipe,z.prototype.pipe=function(e){var t=this;return t.gs.isOpen?(t.totalBytesToRead=t.gs.length-t.gs.position,t._pipe.apply(t,[e])):t.gs.open((function(n){if(n)return t.emit("error",n);t.totalBytesToRead=t.gs.length-t.gs.position,t._pipe.apply(t,[e])})),e},z.prototype._read=function(){var e=this,t=function(){e.gs.read(n,(function(t,n){return t&&!e.endCalled?e.emit("error",t):e.endCalled||null==n?e.push(null):(n.length<=e.totalBytesToRead?(e.totalBytesToRead=e.totalBytesToRead-n.length,e.push(n)):n.length>e.totalBytesToRead&&(e.totalBytesToRead=e.totalBytesToRead-n._index,e.push(n.slice(0,n._index))),void(e.totalBytesToRead<=0&&(e.endCalled=!0)))}))},n=e.gs.length<e.gs.chunkSize?e.gs.length-e.seekPosition:e.gs.chunkSize;e.gs.isOpen?t():e.gs.open((function(n){if(e.totalBytesToRead=e.gs.length-e.gs.position,n)return e.emit("error",n);t()}))},z.prototype.destroy=function(){this.pause(),this.endCalled=!0,this.gs.close(),this.emit("end")},z.prototype.write=function(e){var t=this;return t.endCalled?t.emit("error",l.create({message:"attempting to write to stream after end called",driver:!0})):t.gs.isOpen?(t.gs.write(e,(function(){t.emit("drain")})),!0):(t.gs.open((function(){t.gs.isOpen=!0,t.gs.write(e,(function(){process.nextTick((function(){t.emit("drain")}))}))})),!1)},z.prototype.end=function(e,t,n){var r=this,o=Array.prototype.slice.call(arguments,0);n="function"==typeof o[o.length-1]?o.pop():void 0,e=o.length?o.shift():null,t=o.length?o.shift():null,r.endCalled=!0,e&&r.gs.write(e,(function(){r.gs.close((function(){"function"==typeof n&&n(),r.emit("end")}))})),r.gs.close((function(){"function"==typeof n&&n(),r.emit("end")}))},e.exports=y},function(e,t,n){"use strict";var r=n(8).EventEmitter,o=n(493),i=n(494),s=n(0).shallowClone,a=n(0).toError,c=n(5),u=n(0).executeLegacyOperation,l={bucketName:"fs",chunkSizeBytes:261120};function f(e,t){if(r.apply(this),this.setMaxListeners(0),t&&"object"==typeof t){t=s(t);for(var n=Object.keys(l),o=0;o<n.length;++o)t[n[o]]||(t[n[o]]=l[n[o]])}else t=l;this.s={db:e,options:t,_chunksCollection:e.collection(t.bucketName+".chunks"),_filesCollection:e.collection(t.bucketName+".files"),checkedIndexes:!1,calledOpenUploadStream:!1,promiseLibrary:e.s.promiseLibrary||Promise}}function p(e,t,n){e.s._filesCollection.deleteOne({_id:t},(function(r,o){if(r)return n(r);e.s._chunksCollection.deleteMany({files_id:t},(function(e){return e?n(e):o.result.n?void n():n(new Error("FileNotFound: no file with id "+t+" found"))}))}))}function d(e,t,n,r){var o={_id:t},i={$set:{filename:n}};e.s._filesCollection.updateOne(o,i,(function(e,n){return e?r(e):n.result.n?void r():r(a("File with id "+t+" not found"))}))}function h(e,t){e.s._filesCollection.drop((function(n){if(n)return t(n);e.s._chunksCollection.drop((function(e){return e?t(e):t()}))}))}e.exports=f,c.inherits(f,r),f.prototype.openUploadStream=function(e,t){return(t=t?s(t):{}).chunkSizeBytes||(t.chunkSizeBytes=this.s.options.chunkSizeBytes),new i(this,e,t)},f.prototype.openUploadStreamWithId=function(e,t,n){return(n=n?s(n):{}).chunkSizeBytes||(n.chunkSizeBytes=this.s.options.chunkSizeBytes),n.id=e,new i(this,t,n)},f.prototype.openDownloadStream=function(e,t){var n={_id:e};return t={start:t&&t.start,end:t&&t.end},new o(this.s._chunksCollection,this.s._filesCollection,this.s.options.readPreference,n,t)},f.prototype.delete=function(e,t){return u(this.s.db.s.topology,p,[this,e,t],{skipSessions:!0})},f.prototype.find=function(e,t){e=e||{},t=t||{};var n=this.s._filesCollection.find(e);return null!=t.batchSize&&n.batchSize(t.batchSize),null!=t.limit&&n.limit(t.limit),null!=t.maxTimeMS&&n.maxTimeMS(t.maxTimeMS),null!=t.noCursorTimeout&&n.addCursorFlag("noCursorTimeout",t.noCursorTimeout),null!=t.skip&&n.skip(t.skip),null!=t.sort&&n.sort(t.sort),n},f.prototype.openDownloadStreamByName=function(e,t){var n={uploadDate:-1},r=null;t&&null!=t.revision&&(t.revision>=0?(n={uploadDate:1},r=t.revision):r=-t.revision-1);var i={filename:e};return t={sort:n,skip:r,start:t&&t.start,end:t&&t.end},new o(this.s._chunksCollection,this.s._filesCollection,this.s.options.readPreference,i,t)},f.prototype.rename=function(e,t,n){return u(this.s.db.s.topology,d,[this,e,t,n],{skipSessions:!0})},f.prototype.drop=function(e){return u(this.s.db.s.topology,h,[this,e],{skipSessions:!0})},f.prototype.getLogger=function(){return this.s.db.s.logger}},function(e,t,n){"use strict";var r=n(18),o=n(5);function i(e,t,n,o,i){this.s={bytesRead:0,chunks:e,cursor:null,expected:0,files:t,filter:o,init:!1,expectedEnd:0,file:null,options:i,readPreference:n},r.Readable.call(this)}function s(e){if(e.s.init)throw new Error("You cannot change options after the stream has enteredflowing mode!")}function a(e,t){e.emit("error",t)}e.exports=i,o.inherits(i,r.Readable),i.prototype._read=function(){var e=this;this.destroyed||function(e,t){if(e.s.file)return t();e.s.init||(!function(e){var t={};e.s.readPreference&&(t.readPreference=e.s.readPreference);e.s.options&&e.s.options.sort&&(t.sort=e.s.options.sort);e.s.options&&e.s.options.skip&&(t.skip=e.s.options.skip);e.s.files.findOne(e.s.filter,t,(function(t,n){if(t)return a(e,t);if(!n){var r=e.s.filter._id?e.s.filter._id.toString():e.s.filter.filename,o=new Error("FileNotFound: file "+r+" was not found");return o.code="ENOENT",a(e,o)}if(n.length<=0)e.push(null);else if(e.destroyed)e.emit("close");else{try{e.s.bytesToSkip=function(e,t,n){if(n&&null!=n.start){if(n.start>t.length)throw new Error("Stream start ("+n.start+") must not be more than the length of the file ("+t.length+")");if(n.start<0)throw new Error("Stream start ("+n.start+") must not be negative");if(null!=n.end&&n.end<n.start)throw new Error("Stream start ("+n.start+") must not be greater than stream end ("+n.end+")");return e.s.bytesRead=Math.floor(n.start/t.chunkSize)*t.chunkSize,e.s.expected=Math.floor(n.start/t.chunkSize),n.start-e.s.bytesRead}}(e,n,e.s.options)}catch(t){return a(e,t)}var i={files_id:n._id};if(e.s.options&&null!=e.s.options.start){var s=Math.floor(e.s.options.start/n.chunkSize);s>0&&(i.n={$gte:s})}e.s.cursor=e.s.chunks.find(i).sort({n:1}),e.s.readPreference&&e.s.cursor.setReadPreference(e.s.readPreference),e.s.expectedEnd=Math.ceil(n.length/n.chunkSize),e.s.file=n;try{e.s.bytesToTrim=function(e,t,n,r){if(r&&null!=r.end){if(r.end>t.length)throw new Error("Stream end ("+r.end+") must not be more than the length of the file ("+t.length+")");if(r.start<0)throw new Error("Stream end ("+r.end+") must not be negative");var o=null!=r.start?Math.floor(r.start/t.chunkSize):0;return n.limit(Math.ceil(r.end/t.chunkSize)-o),e.s.expectedEnd=Math.ceil(r.end/t.chunkSize),Math.ceil(r.end/t.chunkSize)*t.chunkSize-r.end}}(e,n,e.s.cursor,e.s.options)}catch(t){return a(e,t)}e.emit("file",n)}}))}(e),e.s.init=!0);e.once("file",(function(){t()}))}(e,(function(){!function(e){if(e.destroyed)return;e.s.cursor.next((function(t,n){if(e.destroyed)return;if(t)return a(e,t);if(!n)return e.push(null),void process.nextTick(()=>{e.s.cursor.close((function(t){t?a(e,t):e.emit("close")}))});var r=e.s.file.length-e.s.bytesRead,o=e.s.expected++,i=Math.min(e.s.file.chunkSize,r);if(n.n>o){var s="ChunkIsMissing: Got unexpected n: "+n.n+", expected: "+o;return a(e,new Error(s))}if(n.n<o)return s="ExtraChunk: Got unexpected n: "+n.n+", expected: "+o,a(e,new Error(s));var c=Buffer.isBuffer(n.data)?n.data:n.data.buffer;if(c.length!==i)return r<=0?(s="ExtraChunk: Got unexpected n: "+n.n,a(e,new Error(s))):(s="ChunkIsWrongSize: Got unexpected length: "+c.length+", expected: "+i,a(e,new Error(s)));if(e.s.bytesRead+=c.length,0===c.length)return e.push(null);var u=null,l=null;null!=e.s.bytesToSkip&&(u=e.s.bytesToSkip,e.s.bytesToSkip=0);const f=o===e.s.expectedEnd-1,p=e.s.options.end-e.s.bytesToSkip;f&&null!=e.s.bytesToTrim?l=e.s.file.chunkSize-e.s.bytesToTrim:e.s.options.end&&p<n.data.length()&&(l=p),null==u&&null==l||(c=c.slice(u||0,l||c.length)),e.push(c)}))}(e)}))},i.prototype.start=function(e){return s(this),this.s.options.start=e,this},i.prototype.end=function(e){return s(this),this.s.options.end=e,this},i.prototype.abort=function(e){var t=this;this.push(null),this.destroyed=!0,this.s.cursor?this.s.cursor.close((function(n){t.emit("close"),e&&e(n)})):(this.s.init||t.emit("close"),e&&e())}},function(e,t,n){"use strict";var r=n(2),o=n(20),i=n(18),s=n(5),a=n(22).Buffer;function c(e,t,n){if(n=n||{},i.Writable.call(this,n),this.bucket=e,this.chunks=e.s._chunksCollection,this.filename=t,this.files=e.s._filesCollection,this.options=n,this.done=!1,this.id=n.id?n.id:r.BSON.ObjectId(),this.chunkSizeBytes=this.options.chunkSizeBytes,this.bufToStore=a.alloc(this.chunkSizeBytes),this.length=0,this.md5=!n.disableMD5&&o.createHash("md5"),this.n=0,this.pos=0,this.state={streamEnd:!1,outstandingRequests:0,errored:!1,aborted:!1,promiseLibrary:this.bucket.s.promiseLibrary},!this.bucket.s.calledOpenUploadStream){this.bucket.s.calledOpenUploadStream=!0;var s=this;!function(e,t){e.files.findOne({},{_id:1},(function(n,r){return n?t(n):r?t():void e.files.listIndexes().toArray((function(n,r){if(n){if(26===n.code){var o={filename:1,uploadDate:1};return void e.files.createIndex(o,{background:!1},(function(n){if(n)return t(n);f(e,t)}))}return t(n)}var i=!1;if(r.forEach((function(e){2===Object.keys(e.key).length&&1===e.key.filename&&1===e.key.uploadDate&&(i=!0)})),i)f(e,t);else{o={filename:1,uploadDate:1};var s=d(e);s.background=!1,e.files.createIndex(o,s,(function(n){if(n)return t(n);f(e,t)}))}}))}))}(this,(function(){s.bucket.s.checkedIndexes=!0,s.bucket.emit("index")}))}}function u(e,t,n){if(!e.state.errored){if(e.state.errored=!0,n)return n(t);e.emit("error",t)}}function l(e,t,n){return{_id:r.BSON.ObjectId(),files_id:e,n:t,data:n}}function f(e,t){e.chunks.listIndexes().toArray((function(n,r){if(n){if(26===n.code){var o={files_id:1,n:1};return void e.chunks.createIndex(o,{background:!1,unique:!0},(function(e){if(e)return t(e);t()}))}return t(n)}var i=!1;if(r.forEach((function(e){e.key&&(2===Object.keys(e.key).length&&1===e.key.files_id&&1===e.key.n&&(i=!0))})),i)t();else{o={files_id:1,n:1};var s=d(e);s.background=!1,s.unique=!0,e.chunks.createIndex(o,s,(function(e){if(e)return t(e);t()}))}}))}function p(e,t){if(e.done)return!0;if(e.state.streamEnd&&0===e.state.outstandingRequests&&!e.state.errored){e.done=!0;var n=function(e,t,n,r,o,i,s,a){var c={_id:e,length:t,chunkSize:n,uploadDate:new Date,filename:o};r&&(c.md5=r);i&&(c.contentType=i);s&&(c.aliases=s);a&&(c.metadata=a);return c}(e.id,e.length,e.chunkSizeBytes,e.md5&&e.md5.digest("hex"),e.filename,e.options.contentType,e.options.aliases,e.options.metadata);return!g(e,t)&&(e.files.insertOne(n,d(e),(function(r){if(r)return u(e,r,t);e.emit("finish",n),e.emit("close")})),!0)}return!1}function d(e){var t={};return e.options.writeConcern&&(t.w=e.options.writeConcern.w,t.wtimeout=e.options.writeConcern.wtimeout,t.j=e.options.writeConcern.j),t}function h(e,t){return e.bucket.s.checkedIndexes?t(!1):(e.bucket.once("index",(function(){t(!0)})),!0)}function m(e,t){if(0===e.pos)return p(e,t);++e.state.outstandingRequests;var n=a.alloc(e.pos);e.bufToStore.copy(n,0,0,e.pos),e.md5&&e.md5.update(n);var r=l(e.id,e.n,n);if(g(e,t))return!1;e.chunks.insertOne(r,d(e),(function(t){if(t)return u(e,t);--e.state.outstandingRequests,p(e)}))}function g(e,t){return!!e.state.aborted&&("function"==typeof t&&t(new Error("this stream has been aborted")),!0)}e.exports=c,s.inherits(c,i.Writable),c.prototype.write=function(e,t,n){var r=this;return h(this,(function(){return function(e,t,n,r){if(g(e,r))return!1;var o=a.isBuffer(t)?t:a.from(t,n);if(e.length+=o.length,e.pos+o.length<e.chunkSizeBytes)return o.copy(e.bufToStore,e.pos),e.pos+=o.length,r&&r(),!0;var i=o.length,s=e.chunkSizeBytes-e.pos,c=Math.min(s,o.length),f=0;for(;i>0;){var h=o.length-i;if(o.copy(e.bufToStore,e.pos,h,h+c),e.pos+=c,0===(s-=c)){e.md5&&e.md5.update(e.bufToStore);var m=l(e.id,e.n,a.from(e.bufToStore));if(++e.state.outstandingRequests,++f,g(e,r))return!1;e.chunks.insertOne(m,d(e),(function(t){if(t)return u(e,t);--e.state.outstandingRequests,--f||(e.emit("drain",m),r&&r(),p(e))})),s=e.chunkSizeBytes,e.pos=0,++e.n}i-=c,c=Math.min(s,i)}return!1}(r,e,t,n)}))},c.prototype.abort=function(e){if(this.state.streamEnd){var t=new Error("Cannot abort a stream that has already completed");return"function"==typeof e?e(t):this.state.promiseLibrary.reject(t)}if(this.state.aborted)return t=new Error("Cannot call abort() on a stream twice"),"function"==typeof e?e(t):this.state.promiseLibrary.reject(t);this.state.aborted=!0,this.chunks.deleteMany({files_id:this.id},(function(t){"function"==typeof e&&e(t)}))},c.prototype.end=function(e,t,n){var r=this;"function"==typeof e?(n=e,e=null,t=null):"function"==typeof t&&(n=t,t=null),g(this,n)||(this.state.streamEnd=!0,n&&this.once("finish",(function(e){n(null,e)})),e?this.write(e,t,(function(){m(r)})):h(this,(function(){m(r)})))}},function(e,t,n){const r=n(42).ObjectId;e.exports=function(e,t,n,o,i){const s=o.pureName,a=n.__getDatabase(),c=new t.Writable({objectMode:!0});return c.buffer=[],c.wasHeader=!1,c.addRow=e=>{!c.wasHeader&&(c.wasHeader=!0,e.__isStreamHeader)||(i.createStringId&&(e={_id:(new r).toString(),...e}),c.buffer.push(e))},c.checkStructure=async()=>{i.dropIfExists&&(console.log(`Dropping collection ${s}`),await a.collection(s).drop()),i.truncate&&(console.log(`Truncating collection ${s}`),await a.collection(s).deleteMany({}))},c.send=async()=>{const e=c.buffer;c.buffer=[],await a.collection(s).insertMany(e)},c.sendIfFull=async()=>{c.buffer.length>100&&await c.send()},c._write=async(e,t,n)=>{c.addRow(e),await c.sendIfFull(),n()},c._final=async e=>{await c.send(),e()},c}}]);
|
|
9
|
+
*/(function(){var o="Expected a function",i="__lodash_placeholder__",s=[["ary",128],["bind",1],["bindKey",2],["curry",8],["curryRight",16],["flip",512],["partial",32],["partialRight",64],["rearg",256]],u="[object Arguments]",a="[object Array]",c="[object Boolean]",l="[object Date]",d="[object Error]",f="[object Function]",p="[object GeneratorFunction]",h="[object Map]",m="[object Number]",g="[object Object]",E="[object RegExp]",y="[object Set]",v="[object String]",A="[object Symbol]",b="[object WeakMap]",C="[object ArrayBuffer]",S="[object DataView]",O="[object Float32Array]",_="[object Float64Array]",w="[object Int8Array]",D="[object Int16Array]",B="[object Int32Array]",T="[object Uint8Array]",F="[object Uint16Array]",N="[object Uint32Array]",R=/\b__p \+= '';/g,I=/\b(__p \+=) '' \+/g,x=/(__e\(.*?\)|\b__t\)) \+\n'';/g,M=/&(?:amp|lt|gt|quot|#39);/g,P=/[&<>"']/g,k=RegExp(M.source),j=RegExp(P.source),L=/<%-([\s\S]+?)%>/g,U=/<%([\s\S]+?)%>/g,$=/<%=([\s\S]+?)%>/g,V=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,z=/^\w*$/,q=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,W=/[\\^$.*+?()[\]{}|]/g,H=RegExp(W.source),G=/^\s+/,K=/\s/,Y=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,J=/\{\n\/\* \[wrapped with (.+)\] \*/,Z=/,? & /,X=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,Q=/[()=,{}\[\]\/\s]/,ee=/\\(\\)?/g,te=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,ne=/\w*$/,re=/^[-+]0x[0-9a-f]+$/i,oe=/^0b[01]+$/i,ie=/^\[object .+?Constructor\]$/,se=/^0o[0-7]+$/i,ue=/^(?:0|[1-9]\d*)$/,ae=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,ce=/($^)/,le=/['\n\r\u2028\u2029\\]/g,de="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",fe="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",pe="[\\ud800-\\udfff]",he="["+fe+"]",me="["+de+"]",ge="\\d+",Ee="[\\u2700-\\u27bf]",ye="[a-z\\xdf-\\xf6\\xf8-\\xff]",ve="[^\\ud800-\\udfff"+fe+ge+"\\u2700-\\u27bfa-z\\xdf-\\xf6\\xf8-\\xffA-Z\\xc0-\\xd6\\xd8-\\xde]",Ae="\\ud83c[\\udffb-\\udfff]",be="[^\\ud800-\\udfff]",Ce="(?:\\ud83c[\\udde6-\\uddff]){2}",Se="[\\ud800-\\udbff][\\udc00-\\udfff]",Oe="[A-Z\\xc0-\\xd6\\xd8-\\xde]",_e="(?:"+ye+"|"+ve+")",we="(?:"+Oe+"|"+ve+")",De="(?:"+me+"|"+Ae+")"+"?",Be="[\\ufe0e\\ufe0f]?"+De+("(?:\\u200d(?:"+[be,Ce,Se].join("|")+")[\\ufe0e\\ufe0f]?"+De+")*"),Te="(?:"+[Ee,Ce,Se].join("|")+")"+Be,Fe="(?:"+[be+me+"?",me,Ce,Se,pe].join("|")+")",Ne=RegExp("['’]","g"),Re=RegExp(me,"g"),Ie=RegExp(Ae+"(?="+Ae+")|"+Fe+Be,"g"),xe=RegExp([Oe+"?"+ye+"+(?:['’](?:d|ll|m|re|s|t|ve))?(?="+[he,Oe,"$"].join("|")+")",we+"+(?:['’](?:D|LL|M|RE|S|T|VE))?(?="+[he,Oe+_e,"$"].join("|")+")",Oe+"?"+_e+"+(?:['’](?:d|ll|m|re|s|t|ve))?",Oe+"+(?:['’](?:D|LL|M|RE|S|T|VE))?","\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",ge,Te].join("|"),"g"),Me=RegExp("[\\u200d\\ud800-\\udfff"+de+"\\ufe0e\\ufe0f]"),Pe=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,ke=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],je=-1,Le={};Le[O]=Le[_]=Le[w]=Le[D]=Le[B]=Le[T]=Le["[object Uint8ClampedArray]"]=Le[F]=Le[N]=!0,Le[u]=Le[a]=Le[C]=Le[c]=Le[S]=Le[l]=Le[d]=Le[f]=Le[h]=Le[m]=Le[g]=Le[E]=Le[y]=Le[v]=Le[b]=!1;var Ue={};Ue[u]=Ue[a]=Ue[C]=Ue[S]=Ue[c]=Ue[l]=Ue[O]=Ue[_]=Ue[w]=Ue[D]=Ue[B]=Ue[h]=Ue[m]=Ue[g]=Ue[E]=Ue[y]=Ue[v]=Ue[A]=Ue[T]=Ue["[object Uint8ClampedArray]"]=Ue[F]=Ue[N]=!0,Ue[d]=Ue[f]=Ue[b]=!1;var $e={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},Ve=parseFloat,ze=parseInt,qe="object"==typeof global&&global&&global.Object===Object&&global,We="object"==typeof self&&self&&self.Object===Object&&self,He=qe||We||Function("return this")(),Ge=t&&!t.nodeType&&t,Ke=Ge&&"object"==typeof e&&e&&!e.nodeType&&e,Ye=Ke&&Ke.exports===Ge,Je=Ye&&qe.process,Ze=function(){try{var e=Ke&&Ke.require&&Ke.require("util").types;return e||Je&&Je.binding&&Je.binding("util")}catch(e){}}(),Xe=Ze&&Ze.isArrayBuffer,Qe=Ze&&Ze.isDate,et=Ze&&Ze.isMap,tt=Ze&&Ze.isRegExp,nt=Ze&&Ze.isSet,rt=Ze&&Ze.isTypedArray;function ot(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}function it(e,t,n,r){for(var o=-1,i=null==e?0:e.length;++o<i;){var s=e[o];t(r,s,n(s),e)}return r}function st(e,t){for(var n=-1,r=null==e?0:e.length;++n<r&&!1!==t(e[n],n,e););return e}function ut(e,t){for(var n=null==e?0:e.length;n--&&!1!==t(e[n],n,e););return e}function at(e,t){for(var n=-1,r=null==e?0:e.length;++n<r;)if(!t(e[n],n,e))return!1;return!0}function ct(e,t){for(var n=-1,r=null==e?0:e.length,o=0,i=[];++n<r;){var s=e[n];t(s,n,e)&&(i[o++]=s)}return i}function lt(e,t){return!!(null==e?0:e.length)&&At(e,t,0)>-1}function dt(e,t,n){for(var r=-1,o=null==e?0:e.length;++r<o;)if(n(t,e[r]))return!0;return!1}function ft(e,t){for(var n=-1,r=null==e?0:e.length,o=Array(r);++n<r;)o[n]=t(e[n],n,e);return o}function pt(e,t){for(var n=-1,r=t.length,o=e.length;++n<r;)e[o+n]=t[n];return e}function ht(e,t,n,r){var o=-1,i=null==e?0:e.length;for(r&&i&&(n=e[++o]);++o<i;)n=t(n,e[o],o,e);return n}function mt(e,t,n,r){var o=null==e?0:e.length;for(r&&o&&(n=e[--o]);o--;)n=t(n,e[o],o,e);return n}function gt(e,t){for(var n=-1,r=null==e?0:e.length;++n<r;)if(t(e[n],n,e))return!0;return!1}var Et=Ot("length");function yt(e,t,n){var r;return n(e,(function(e,n,o){if(t(e,n,o))return r=n,!1})),r}function vt(e,t,n,r){for(var o=e.length,i=n+(r?1:-1);r?i--:++i<o;)if(t(e[i],i,e))return i;return-1}function At(e,t,n){return t==t?function(e,t,n){var r=n-1,o=e.length;for(;++r<o;)if(e[r]===t)return r;return-1}(e,t,n):vt(e,Ct,n)}function bt(e,t,n,r){for(var o=n-1,i=e.length;++o<i;)if(r(e[o],t))return o;return-1}function Ct(e){return e!=e}function St(e,t){var n=null==e?0:e.length;return n?Dt(e,t)/n:NaN}function Ot(e){return function(t){return null==t?void 0:t[e]}}function _t(e){return function(t){return null==e?void 0:e[t]}}function wt(e,t,n,r,o){return o(e,(function(e,o,i){n=r?(r=!1,e):t(n,e,o,i)})),n}function Dt(e,t){for(var n,r=-1,o=e.length;++r<o;){var i=t(e[r]);void 0!==i&&(n=void 0===n?i:n+i)}return n}function Bt(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r}function Tt(e){return e?e.slice(0,Gt(e)+1).replace(G,""):e}function Ft(e){return function(t){return e(t)}}function Nt(e,t){return ft(t,(function(t){return e[t]}))}function Rt(e,t){return e.has(t)}function It(e,t){for(var n=-1,r=e.length;++n<r&&At(t,e[n],0)>-1;);return n}function xt(e,t){for(var n=e.length;n--&&At(t,e[n],0)>-1;);return n}function Mt(e,t){for(var n=e.length,r=0;n--;)e[n]===t&&++r;return r}var Pt=_t({"À":"A","Á":"A","Â":"A","Ã":"A","Ä":"A","Å":"A","à":"a","á":"a","â":"a","ã":"a","ä":"a","å":"a","Ç":"C","ç":"c","Ð":"D","ð":"d","È":"E","É":"E","Ê":"E","Ë":"E","è":"e","é":"e","ê":"e","ë":"e","Ì":"I","Í":"I","Î":"I","Ï":"I","ì":"i","í":"i","î":"i","ï":"i","Ñ":"N","ñ":"n","Ò":"O","Ó":"O","Ô":"O","Õ":"O","Ö":"O","Ø":"O","ò":"o","ó":"o","ô":"o","õ":"o","ö":"o","ø":"o","Ù":"U","Ú":"U","Û":"U","Ü":"U","ù":"u","ú":"u","û":"u","ü":"u","Ý":"Y","ý":"y","ÿ":"y","Æ":"Ae","æ":"ae","Þ":"Th","þ":"th","ß":"ss","Ā":"A","Ă":"A","Ą":"A","ā":"a","ă":"a","ą":"a","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","ć":"c","ĉ":"c","ċ":"c","č":"c","Ď":"D","Đ":"D","ď":"d","đ":"d","Ē":"E","Ĕ":"E","Ė":"E","Ę":"E","Ě":"E","ē":"e","ĕ":"e","ė":"e","ę":"e","ě":"e","Ĝ":"G","Ğ":"G","Ġ":"G","Ģ":"G","ĝ":"g","ğ":"g","ġ":"g","ģ":"g","Ĥ":"H","Ħ":"H","ĥ":"h","ħ":"h","Ĩ":"I","Ī":"I","Ĭ":"I","Į":"I","İ":"I","ĩ":"i","ī":"i","ĭ":"i","į":"i","ı":"i","Ĵ":"J","ĵ":"j","Ķ":"K","ķ":"k","ĸ":"k","Ĺ":"L","Ļ":"L","Ľ":"L","Ŀ":"L","Ł":"L","ĺ":"l","ļ":"l","ľ":"l","ŀ":"l","ł":"l","Ń":"N","Ņ":"N","Ň":"N","Ŋ":"N","ń":"n","ņ":"n","ň":"n","ŋ":"n","Ō":"O","Ŏ":"O","Ő":"O","ō":"o","ŏ":"o","ő":"o","Ŕ":"R","Ŗ":"R","Ř":"R","ŕ":"r","ŗ":"r","ř":"r","Ś":"S","Ŝ":"S","Ş":"S","Š":"S","ś":"s","ŝ":"s","ş":"s","š":"s","Ţ":"T","Ť":"T","Ŧ":"T","ţ":"t","ť":"t","ŧ":"t","Ũ":"U","Ū":"U","Ŭ":"U","Ů":"U","Ű":"U","Ų":"U","ũ":"u","ū":"u","ŭ":"u","ů":"u","ű":"u","ų":"u","Ŵ":"W","ŵ":"w","Ŷ":"Y","ŷ":"y","Ÿ":"Y","Ź":"Z","Ż":"Z","Ž":"Z","ź":"z","ż":"z","ž":"z","IJ":"IJ","ij":"ij","Œ":"Oe","œ":"oe","ʼn":"'n","ſ":"s"}),kt=_t({"&":"&","<":"<",">":">",'"':""","'":"'"});function jt(e){return"\\"+$e[e]}function Lt(e){return Me.test(e)}function Ut(e){var t=-1,n=Array(e.size);return e.forEach((function(e,r){n[++t]=[r,e]})),n}function $t(e,t){return function(n){return e(t(n))}}function Vt(e,t){for(var n=-1,r=e.length,o=0,s=[];++n<r;){var u=e[n];u!==t&&u!==i||(e[n]=i,s[o++]=n)}return s}function zt(e){var t=-1,n=Array(e.size);return e.forEach((function(e){n[++t]=e})),n}function qt(e){var t=-1,n=Array(e.size);return e.forEach((function(e){n[++t]=[e,e]})),n}function Wt(e){return Lt(e)?function(e){var t=Ie.lastIndex=0;for(;Ie.test(e);)++t;return t}(e):Et(e)}function Ht(e){return Lt(e)?function(e){return e.match(Ie)||[]}(e):function(e){return e.split("")}(e)}function Gt(e){for(var t=e.length;t--&&K.test(e.charAt(t)););return t}var Kt=_t({"&":"&","<":"<",">":">",""":'"',"'":"'"});var Yt=function e(t){var n,r=(t=null==t?He:Yt.defaults(He.Object(),t,Yt.pick(He,ke))).Array,K=t.Date,de=t.Error,fe=t.Function,pe=t.Math,he=t.Object,me=t.RegExp,ge=t.String,Ee=t.TypeError,ye=r.prototype,ve=fe.prototype,Ae=he.prototype,be=t["__core-js_shared__"],Ce=ve.toString,Se=Ae.hasOwnProperty,Oe=0,_e=(n=/[^.]+$/.exec(be&&be.keys&&be.keys.IE_PROTO||""))?"Symbol(src)_1."+n:"",we=Ae.toString,De=Ce.call(he),Be=He._,Te=me("^"+Ce.call(Se).replace(W,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Fe=Ye?t.Buffer:void 0,Ie=t.Symbol,Me=t.Uint8Array,$e=Fe?Fe.allocUnsafe:void 0,qe=$t(he.getPrototypeOf,he),We=he.create,Ge=Ae.propertyIsEnumerable,Ke=ye.splice,Je=Ie?Ie.isConcatSpreadable:void 0,Ze=Ie?Ie.iterator:void 0,Et=Ie?Ie.toStringTag:void 0,_t=function(){try{var e=ti(he,"defineProperty");return e({},"",{}),e}catch(e){}}(),Jt=t.clearTimeout!==He.clearTimeout&&t.clearTimeout,Zt=K&&K.now!==He.Date.now&&K.now,Xt=t.setTimeout!==He.setTimeout&&t.setTimeout,Qt=pe.ceil,en=pe.floor,tn=he.getOwnPropertySymbols,nn=Fe?Fe.isBuffer:void 0,rn=t.isFinite,on=ye.join,sn=$t(he.keys,he),un=pe.max,an=pe.min,cn=K.now,ln=t.parseInt,dn=pe.random,fn=ye.reverse,pn=ti(t,"DataView"),hn=ti(t,"Map"),mn=ti(t,"Promise"),gn=ti(t,"Set"),En=ti(t,"WeakMap"),yn=ti(he,"create"),vn=En&&new En,An={},bn=Bi(pn),Cn=Bi(hn),Sn=Bi(mn),On=Bi(gn),_n=Bi(En),wn=Ie?Ie.prototype:void 0,Dn=wn?wn.valueOf:void 0,Bn=wn?wn.toString:void 0;function Tn(e){if(Ws(e)&&!xs(e)&&!(e instanceof In)){if(e instanceof Rn)return e;if(Se.call(e,"__wrapped__"))return Ti(e)}return new Rn(e)}var Fn=function(){function e(){}return function(t){if(!qs(t))return{};if(We)return We(t);e.prototype=t;var n=new e;return e.prototype=void 0,n}}();function Nn(){}function Rn(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=void 0}function In(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=4294967295,this.__views__=[]}function xn(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function Mn(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function Pn(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function kn(e){var t=-1,n=null==e?0:e.length;for(this.__data__=new Pn;++t<n;)this.add(e[t])}function jn(e){var t=this.__data__=new Mn(e);this.size=t.size}function Ln(e,t){var n=xs(e),r=!n&&Is(e),o=!n&&!r&&js(e),i=!n&&!r&&!o&&Qs(e),s=n||r||o||i,u=s?Bt(e.length,ge):[],a=u.length;for(var c in e)!t&&!Se.call(e,c)||s&&("length"==c||o&&("offset"==c||"parent"==c)||i&&("buffer"==c||"byteLength"==c||"byteOffset"==c)||ai(c,a))||u.push(c);return u}function Un(e){var t=e.length;return t?e[kr(0,t-1)]:void 0}function $n(e,t){return _i(vo(e),Jn(t,0,e.length))}function Vn(e){return _i(vo(e))}function zn(e,t,n){(void 0===n||Fs(e[t],n))&&(void 0!==n||t in e)||Kn(e,t,n)}function qn(e,t,n){var r=e[t];Se.call(e,t)&&Fs(r,n)&&(void 0!==n||t in e)||Kn(e,t,n)}function Wn(e,t){for(var n=e.length;n--;)if(Fs(e[n][0],t))return n;return-1}function Hn(e,t,n,r){return tr(e,(function(e,o,i){t(r,e,n(e),i)})),r}function Gn(e,t){return e&&Ao(t,bu(t),e)}function Kn(e,t,n){"__proto__"==t&&_t?_t(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}function Yn(e,t){for(var n=-1,o=t.length,i=r(o),s=null==e;++n<o;)i[n]=s?void 0:gu(e,t[n]);return i}function Jn(e,t,n){return e==e&&(void 0!==n&&(e=e<=n?e:n),void 0!==t&&(e=e>=t?e:t)),e}function Zn(e,t,n,r,o,i){var s,a=1&t,d=2&t,b=4&t;if(n&&(s=o?n(e,r,o,i):n(e)),void 0!==s)return s;if(!qs(e))return e;var R=xs(e);if(R){if(s=function(e){var t=e.length,n=new e.constructor(t);t&&"string"==typeof e[0]&&Se.call(e,"index")&&(n.index=e.index,n.input=e.input);return n}(e),!a)return vo(e,s)}else{var I=oi(e),x=I==f||I==p;if(js(e))return po(e,a);if(I==g||I==u||x&&!o){if(s=d||x?{}:si(e),!a)return d?function(e,t){return Ao(e,ri(e),t)}(e,function(e,t){return e&&Ao(t,Cu(t),e)}(s,e)):function(e,t){return Ao(e,ni(e),t)}(e,Gn(s,e))}else{if(!Ue[I])return o?e:{};s=function(e,t,n){var r=e.constructor;switch(t){case C:return ho(e);case c:case l:return new r(+e);case S:return function(e,t){var n=t?ho(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}(e,n);case O:case _:case w:case D:case B:case T:case"[object Uint8ClampedArray]":case F:case N:return mo(e,n);case h:return new r;case m:case v:return new r(e);case E:return function(e){var t=new e.constructor(e.source,ne.exec(e));return t.lastIndex=e.lastIndex,t}(e);case y:return new r;case A:return o=e,Dn?he(Dn.call(o)):{}}var o}(e,I,a)}}i||(i=new jn);var M=i.get(e);if(M)return M;i.set(e,s),Js(e)?e.forEach((function(r){s.add(Zn(r,t,n,r,e,i))})):Hs(e)&&e.forEach((function(r,o){s.set(o,Zn(r,t,n,o,e,i))}));var P=R?void 0:(b?d?Ko:Go:d?Cu:bu)(e);return st(P||e,(function(r,o){P&&(r=e[o=r]),qn(s,o,Zn(r,t,n,o,e,i))})),s}function Xn(e,t,n){var r=n.length;if(null==e)return!r;for(e=he(e);r--;){var o=n[r],i=t[o],s=e[o];if(void 0===s&&!(o in e)||!i(s))return!1}return!0}function Qn(e,t,n){if("function"!=typeof e)throw new Ee(o);return bi((function(){e.apply(void 0,n)}),t)}function er(e,t,n,r){var o=-1,i=lt,s=!0,u=e.length,a=[],c=t.length;if(!u)return a;n&&(t=ft(t,Ft(n))),r?(i=dt,s=!1):t.length>=200&&(i=Rt,s=!1,t=new kn(t));e:for(;++o<u;){var l=e[o],d=null==n?l:n(l);if(l=r||0!==l?l:0,s&&d==d){for(var f=c;f--;)if(t[f]===d)continue e;a.push(l)}else i(t,d,r)||a.push(l)}return a}Tn.templateSettings={escape:L,evaluate:U,interpolate:$,variable:"",imports:{_:Tn}},Tn.prototype=Nn.prototype,Tn.prototype.constructor=Tn,Rn.prototype=Fn(Nn.prototype),Rn.prototype.constructor=Rn,In.prototype=Fn(Nn.prototype),In.prototype.constructor=In,xn.prototype.clear=function(){this.__data__=yn?yn(null):{},this.size=0},xn.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},xn.prototype.get=function(e){var t=this.__data__;if(yn){var n=t[e];return"__lodash_hash_undefined__"===n?void 0:n}return Se.call(t,e)?t[e]:void 0},xn.prototype.has=function(e){var t=this.__data__;return yn?void 0!==t[e]:Se.call(t,e)},xn.prototype.set=function(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=yn&&void 0===t?"__lodash_hash_undefined__":t,this},Mn.prototype.clear=function(){this.__data__=[],this.size=0},Mn.prototype.delete=function(e){var t=this.__data__,n=Wn(t,e);return!(n<0)&&(n==t.length-1?t.pop():Ke.call(t,n,1),--this.size,!0)},Mn.prototype.get=function(e){var t=this.__data__,n=Wn(t,e);return n<0?void 0:t[n][1]},Mn.prototype.has=function(e){return Wn(this.__data__,e)>-1},Mn.prototype.set=function(e,t){var n=this.__data__,r=Wn(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this},Pn.prototype.clear=function(){this.size=0,this.__data__={hash:new xn,map:new(hn||Mn),string:new xn}},Pn.prototype.delete=function(e){var t=Qo(this,e).delete(e);return this.size-=t?1:0,t},Pn.prototype.get=function(e){return Qo(this,e).get(e)},Pn.prototype.has=function(e){return Qo(this,e).has(e)},Pn.prototype.set=function(e,t){var n=Qo(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this},kn.prototype.add=kn.prototype.push=function(e){return this.__data__.set(e,"__lodash_hash_undefined__"),this},kn.prototype.has=function(e){return this.__data__.has(e)},jn.prototype.clear=function(){this.__data__=new Mn,this.size=0},jn.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},jn.prototype.get=function(e){return this.__data__.get(e)},jn.prototype.has=function(e){return this.__data__.has(e)},jn.prototype.set=function(e,t){var n=this.__data__;if(n instanceof Mn){var r=n.__data__;if(!hn||r.length<199)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new Pn(r)}return n.set(e,t),this.size=n.size,this};var tr=So(cr),nr=So(lr,!0);function rr(e,t){var n=!0;return tr(e,(function(e,r,o){return n=!!t(e,r,o)})),n}function or(e,t,n){for(var r=-1,o=e.length;++r<o;){var i=e[r],s=t(i);if(null!=s&&(void 0===u?s==s&&!Xs(s):n(s,u)))var u=s,a=i}return a}function ir(e,t){var n=[];return tr(e,(function(e,r,o){t(e,r,o)&&n.push(e)})),n}function sr(e,t,n,r,o){var i=-1,s=e.length;for(n||(n=ui),o||(o=[]);++i<s;){var u=e[i];t>0&&n(u)?t>1?sr(u,t-1,n,r,o):pt(o,u):r||(o[o.length]=u)}return o}var ur=Oo(),ar=Oo(!0);function cr(e,t){return e&&ur(e,t,bu)}function lr(e,t){return e&&ar(e,t,bu)}function dr(e,t){return ct(t,(function(t){return $s(e[t])}))}function fr(e,t){for(var n=0,r=(t=ao(t,e)).length;null!=e&&n<r;)e=e[Di(t[n++])];return n&&n==r?e:void 0}function pr(e,t,n){var r=t(e);return xs(e)?r:pt(r,n(e))}function hr(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":Et&&Et in he(e)?function(e){var t=Se.call(e,Et),n=e[Et];try{e[Et]=void 0;var r=!0}catch(e){}var o=we.call(e);r&&(t?e[Et]=n:delete e[Et]);return o}(e):function(e){return we.call(e)}(e)}function mr(e,t){return e>t}function gr(e,t){return null!=e&&Se.call(e,t)}function Er(e,t){return null!=e&&t in he(e)}function yr(e,t,n){for(var o=n?dt:lt,i=e[0].length,s=e.length,u=s,a=r(s),c=1/0,l=[];u--;){var d=e[u];u&&t&&(d=ft(d,Ft(t))),c=an(d.length,c),a[u]=!n&&(t||i>=120&&d.length>=120)?new kn(u&&d):void 0}d=e[0];var f=-1,p=a[0];e:for(;++f<i&&l.length<c;){var h=d[f],m=t?t(h):h;if(h=n||0!==h?h:0,!(p?Rt(p,m):o(l,m,n))){for(u=s;--u;){var g=a[u];if(!(g?Rt(g,m):o(e[u],m,n)))continue e}p&&p.push(m),l.push(h)}}return l}function vr(e,t,n){var r=null==(e=Ei(e,t=ao(t,e)))?e:e[Di(Ui(t))];return null==r?void 0:ot(r,e,n)}function Ar(e){return Ws(e)&&hr(e)==u}function br(e,t,n,r,o){return e===t||(null==e||null==t||!Ws(e)&&!Ws(t)?e!=e&&t!=t:function(e,t,n,r,o,i){var s=xs(e),f=xs(t),p=s?a:oi(e),b=f?a:oi(t),O=(p=p==u?g:p)==g,_=(b=b==u?g:b)==g,w=p==b;if(w&&js(e)){if(!js(t))return!1;s=!0,O=!1}if(w&&!O)return i||(i=new jn),s||Qs(e)?Wo(e,t,n,r,o,i):function(e,t,n,r,o,i,s){switch(n){case S:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case C:return!(e.byteLength!=t.byteLength||!i(new Me(e),new Me(t)));case c:case l:case m:return Fs(+e,+t);case d:return e.name==t.name&&e.message==t.message;case E:case v:return e==t+"";case h:var u=Ut;case y:var a=1&r;if(u||(u=zt),e.size!=t.size&&!a)return!1;var f=s.get(e);if(f)return f==t;r|=2,s.set(e,t);var p=Wo(u(e),u(t),r,o,i,s);return s.delete(e),p;case A:if(Dn)return Dn.call(e)==Dn.call(t)}return!1}(e,t,p,n,r,o,i);if(!(1&n)){var D=O&&Se.call(e,"__wrapped__"),B=_&&Se.call(t,"__wrapped__");if(D||B){var T=D?e.value():e,F=B?t.value():t;return i||(i=new jn),o(T,F,n,r,i)}}if(!w)return!1;return i||(i=new jn),function(e,t,n,r,o,i){var s=1&n,u=Go(e),a=u.length,c=Go(t).length;if(a!=c&&!s)return!1;var l=a;for(;l--;){var d=u[l];if(!(s?d in t:Se.call(t,d)))return!1}var f=i.get(e),p=i.get(t);if(f&&p)return f==t&&p==e;var h=!0;i.set(e,t),i.set(t,e);var m=s;for(;++l<a;){d=u[l];var g=e[d],E=t[d];if(r)var y=s?r(E,g,d,t,e,i):r(g,E,d,e,t,i);if(!(void 0===y?g===E||o(g,E,n,r,i):y)){h=!1;break}m||(m="constructor"==d)}if(h&&!m){var v=e.constructor,A=t.constructor;v!=A&&"constructor"in e&&"constructor"in t&&!("function"==typeof v&&v instanceof v&&"function"==typeof A&&A instanceof A)&&(h=!1)}return i.delete(e),i.delete(t),h}(e,t,n,r,o,i)}(e,t,n,r,br,o))}function Cr(e,t,n,r){var o=n.length,i=o,s=!r;if(null==e)return!i;for(e=he(e);o--;){var u=n[o];if(s&&u[2]?u[1]!==e[u[0]]:!(u[0]in e))return!1}for(;++o<i;){var a=(u=n[o])[0],c=e[a],l=u[1];if(s&&u[2]){if(void 0===c&&!(a in e))return!1}else{var d=new jn;if(r)var f=r(c,l,a,e,t,d);if(!(void 0===f?br(l,c,3,r,d):f))return!1}}return!0}function Sr(e){return!(!qs(e)||function(e){return!!_e&&_e in e}(e))&&($s(e)?Te:ie).test(Bi(e))}function Or(e){return"function"==typeof e?e:null==e?Gu:"object"==typeof e?xs(e)?Fr(e[0],e[1]):Tr(e):na(e)}function _r(e){if(!pi(e))return sn(e);var t=[];for(var n in he(e))Se.call(e,n)&&"constructor"!=n&&t.push(n);return t}function wr(e){if(!qs(e))return function(e){var t=[];if(null!=e)for(var n in he(e))t.push(n);return t}(e);var t=pi(e),n=[];for(var r in e)("constructor"!=r||!t&&Se.call(e,r))&&n.push(r);return n}function Dr(e,t){return e<t}function Br(e,t){var n=-1,o=Ps(e)?r(e.length):[];return tr(e,(function(e,r,i){o[++n]=t(e,r,i)})),o}function Tr(e){var t=ei(e);return 1==t.length&&t[0][2]?mi(t[0][0],t[0][1]):function(n){return n===e||Cr(n,e,t)}}function Fr(e,t){return li(e)&&hi(t)?mi(Di(e),t):function(n){var r=gu(n,e);return void 0===r&&r===t?Eu(n,e):br(t,r,3)}}function Nr(e,t,n,r,o){e!==t&&ur(t,(function(i,s){if(o||(o=new jn),qs(i))!function(e,t,n,r,o,i,s){var u=vi(e,n),a=vi(t,n),c=s.get(a);if(c)return void zn(e,n,c);var l=i?i(u,a,n+"",e,t,s):void 0,d=void 0===l;if(d){var f=xs(a),p=!f&&js(a),h=!f&&!p&&Qs(a);l=a,f||p||h?xs(u)?l=u:ks(u)?l=vo(u):p?(d=!1,l=po(a,!0)):h?(d=!1,l=mo(a,!0)):l=[]:Ks(a)||Is(a)?(l=u,Is(u)?l=uu(u):qs(u)&&!$s(u)||(l=si(a))):d=!1}d&&(s.set(a,l),o(l,a,r,i,s),s.delete(a));zn(e,n,l)}(e,t,s,n,Nr,r,o);else{var u=r?r(vi(e,s),i,s+"",e,t,o):void 0;void 0===u&&(u=i),zn(e,s,u)}}),Cu)}function Rr(e,t){var n=e.length;if(n)return ai(t+=t<0?n:0,n)?e[t]:void 0}function Ir(e,t,n){t=t.length?ft(t,(function(e){return xs(e)?function(t){return fr(t,1===e.length?e[0]:e)}:e})):[Gu];var r=-1;return t=ft(t,Ft(Xo())),function(e,t){var n=e.length;for(e.sort(t);n--;)e[n]=e[n].value;return e}(Br(e,(function(e,n,o){return{criteria:ft(t,(function(t){return t(e)})),index:++r,value:e}})),(function(e,t){return function(e,t,n){var r=-1,o=e.criteria,i=t.criteria,s=o.length,u=n.length;for(;++r<s;){var a=go(o[r],i[r]);if(a){if(r>=u)return a;var c=n[r];return a*("desc"==c?-1:1)}}return e.index-t.index}(e,t,n)}))}function xr(e,t,n){for(var r=-1,o=t.length,i={};++r<o;){var s=t[r],u=fr(e,s);n(u,s)&&Vr(i,ao(s,e),u)}return i}function Mr(e,t,n,r){var o=r?bt:At,i=-1,s=t.length,u=e;for(e===t&&(t=vo(t)),n&&(u=ft(e,Ft(n)));++i<s;)for(var a=0,c=t[i],l=n?n(c):c;(a=o(u,l,a,r))>-1;)u!==e&&Ke.call(u,a,1),Ke.call(e,a,1);return e}function Pr(e,t){for(var n=e?t.length:0,r=n-1;n--;){var o=t[n];if(n==r||o!==i){var i=o;ai(o)?Ke.call(e,o,1):eo(e,o)}}return e}function kr(e,t){return e+en(dn()*(t-e+1))}function jr(e,t){var n="";if(!e||t<1||t>9007199254740991)return n;do{t%2&&(n+=e),(t=en(t/2))&&(e+=e)}while(t);return n}function Lr(e,t){return Ci(gi(e,t,Gu),e+"")}function Ur(e){return Un(Fu(e))}function $r(e,t){var n=Fu(e);return _i(n,Jn(t,0,n.length))}function Vr(e,t,n,r){if(!qs(e))return e;for(var o=-1,i=(t=ao(t,e)).length,s=i-1,u=e;null!=u&&++o<i;){var a=Di(t[o]),c=n;if("__proto__"===a||"constructor"===a||"prototype"===a)return e;if(o!=s){var l=u[a];void 0===(c=r?r(l,a,u):void 0)&&(c=qs(l)?l:ai(t[o+1])?[]:{})}qn(u,a,c),u=u[a]}return e}var zr=vn?function(e,t){return vn.set(e,t),e}:Gu,qr=_t?function(e,t){return _t(e,"toString",{configurable:!0,enumerable:!1,value:qu(t),writable:!0})}:Gu;function Wr(e){return _i(Fu(e))}function Hr(e,t,n){var o=-1,i=e.length;t<0&&(t=-t>i?0:i+t),(n=n>i?i:n)<0&&(n+=i),i=t>n?0:n-t>>>0,t>>>=0;for(var s=r(i);++o<i;)s[o]=e[o+t];return s}function Gr(e,t){var n;return tr(e,(function(e,r,o){return!(n=t(e,r,o))})),!!n}function Kr(e,t,n){var r=0,o=null==e?r:e.length;if("number"==typeof t&&t==t&&o<=2147483647){for(;r<o;){var i=r+o>>>1,s=e[i];null!==s&&!Xs(s)&&(n?s<=t:s<t)?r=i+1:o=i}return o}return Yr(e,t,Gu,n)}function Yr(e,t,n,r){var o=0,i=null==e?0:e.length;if(0===i)return 0;for(var s=(t=n(t))!=t,u=null===t,a=Xs(t),c=void 0===t;o<i;){var l=en((o+i)/2),d=n(e[l]),f=void 0!==d,p=null===d,h=d==d,m=Xs(d);if(s)var g=r||h;else g=c?h&&(r||f):u?h&&f&&(r||!p):a?h&&f&&!p&&(r||!m):!p&&!m&&(r?d<=t:d<t);g?o=l+1:i=l}return an(i,4294967294)}function Jr(e,t){for(var n=-1,r=e.length,o=0,i=[];++n<r;){var s=e[n],u=t?t(s):s;if(!n||!Fs(u,a)){var a=u;i[o++]=0===s?0:s}}return i}function Zr(e){return"number"==typeof e?e:Xs(e)?NaN:+e}function Xr(e){if("string"==typeof e)return e;if(xs(e))return ft(e,Xr)+"";if(Xs(e))return Bn?Bn.call(e):"";var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}function Qr(e,t,n){var r=-1,o=lt,i=e.length,s=!0,u=[],a=u;if(n)s=!1,o=dt;else if(i>=200){var c=t?null:Lo(e);if(c)return zt(c);s=!1,o=Rt,a=new kn}else a=t?[]:u;e:for(;++r<i;){var l=e[r],d=t?t(l):l;if(l=n||0!==l?l:0,s&&d==d){for(var f=a.length;f--;)if(a[f]===d)continue e;t&&a.push(d),u.push(l)}else o(a,d,n)||(a!==u&&a.push(d),u.push(l))}return u}function eo(e,t){return null==(e=Ei(e,t=ao(t,e)))||delete e[Di(Ui(t))]}function to(e,t,n,r){return Vr(e,t,n(fr(e,t)),r)}function no(e,t,n,r){for(var o=e.length,i=r?o:-1;(r?i--:++i<o)&&t(e[i],i,e););return n?Hr(e,r?0:i,r?i+1:o):Hr(e,r?i+1:0,r?o:i)}function ro(e,t){var n=e;return n instanceof In&&(n=n.value()),ht(t,(function(e,t){return t.func.apply(t.thisArg,pt([e],t.args))}),n)}function oo(e,t,n){var o=e.length;if(o<2)return o?Qr(e[0]):[];for(var i=-1,s=r(o);++i<o;)for(var u=e[i],a=-1;++a<o;)a!=i&&(s[i]=er(s[i]||u,e[a],t,n));return Qr(sr(s,1),t,n)}function io(e,t,n){for(var r=-1,o=e.length,i=t.length,s={};++r<o;){var u=r<i?t[r]:void 0;n(s,e[r],u)}return s}function so(e){return ks(e)?e:[]}function uo(e){return"function"==typeof e?e:Gu}function ao(e,t){return xs(e)?e:li(e,t)?[e]:wi(au(e))}var co=Lr;function lo(e,t,n){var r=e.length;return n=void 0===n?r:n,!t&&n>=r?e:Hr(e,t,n)}var fo=Jt||function(e){return He.clearTimeout(e)};function po(e,t){if(t)return e.slice();var n=e.length,r=$e?$e(n):new e.constructor(n);return e.copy(r),r}function ho(e){var t=new e.constructor(e.byteLength);return new Me(t).set(new Me(e)),t}function mo(e,t){var n=t?ho(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}function go(e,t){if(e!==t){var n=void 0!==e,r=null===e,o=e==e,i=Xs(e),s=void 0!==t,u=null===t,a=t==t,c=Xs(t);if(!u&&!c&&!i&&e>t||i&&s&&a&&!u&&!c||r&&s&&a||!n&&a||!o)return 1;if(!r&&!i&&!c&&e<t||c&&n&&o&&!r&&!i||u&&n&&o||!s&&o||!a)return-1}return 0}function Eo(e,t,n,o){for(var i=-1,s=e.length,u=n.length,a=-1,c=t.length,l=un(s-u,0),d=r(c+l),f=!o;++a<c;)d[a]=t[a];for(;++i<u;)(f||i<s)&&(d[n[i]]=e[i]);for(;l--;)d[a++]=e[i++];return d}function yo(e,t,n,o){for(var i=-1,s=e.length,u=-1,a=n.length,c=-1,l=t.length,d=un(s-a,0),f=r(d+l),p=!o;++i<d;)f[i]=e[i];for(var h=i;++c<l;)f[h+c]=t[c];for(;++u<a;)(p||i<s)&&(f[h+n[u]]=e[i++]);return f}function vo(e,t){var n=-1,o=e.length;for(t||(t=r(o));++n<o;)t[n]=e[n];return t}function Ao(e,t,n,r){var o=!n;n||(n={});for(var i=-1,s=t.length;++i<s;){var u=t[i],a=r?r(n[u],e[u],u,n,e):void 0;void 0===a&&(a=e[u]),o?Kn(n,u,a):qn(n,u,a)}return n}function bo(e,t){return function(n,r){var o=xs(n)?it:Hn,i=t?t():{};return o(n,e,Xo(r,2),i)}}function Co(e){return Lr((function(t,n){var r=-1,o=n.length,i=o>1?n[o-1]:void 0,s=o>2?n[2]:void 0;for(i=e.length>3&&"function"==typeof i?(o--,i):void 0,s&&ci(n[0],n[1],s)&&(i=o<3?void 0:i,o=1),t=he(t);++r<o;){var u=n[r];u&&e(t,u,r,i)}return t}))}function So(e,t){return function(n,r){if(null==n)return n;if(!Ps(n))return e(n,r);for(var o=n.length,i=t?o:-1,s=he(n);(t?i--:++i<o)&&!1!==r(s[i],i,s););return n}}function Oo(e){return function(t,n,r){for(var o=-1,i=he(t),s=r(t),u=s.length;u--;){var a=s[e?u:++o];if(!1===n(i[a],a,i))break}return t}}function _o(e){return function(t){var n=Lt(t=au(t))?Ht(t):void 0,r=n?n[0]:t.charAt(0),o=n?lo(n,1).join(""):t.slice(1);return r[e]()+o}}function wo(e){return function(t){return ht($u(Iu(t).replace(Ne,"")),e,"")}}function Do(e){return function(){var t=arguments;switch(t.length){case 0:return new e;case 1:return new e(t[0]);case 2:return new e(t[0],t[1]);case 3:return new e(t[0],t[1],t[2]);case 4:return new e(t[0],t[1],t[2],t[3]);case 5:return new e(t[0],t[1],t[2],t[3],t[4]);case 6:return new e(t[0],t[1],t[2],t[3],t[4],t[5]);case 7:return new e(t[0],t[1],t[2],t[3],t[4],t[5],t[6])}var n=Fn(e.prototype),r=e.apply(n,t);return qs(r)?r:n}}function Bo(e){return function(t,n,r){var o=he(t);if(!Ps(t)){var i=Xo(n,3);t=bu(t),n=function(e){return i(o[e],e,o)}}var s=e(t,n,r);return s>-1?o[i?t[s]:s]:void 0}}function To(e){return Ho((function(t){var n=t.length,r=n,i=Rn.prototype.thru;for(e&&t.reverse();r--;){var s=t[r];if("function"!=typeof s)throw new Ee(o);if(i&&!u&&"wrapper"==Jo(s))var u=new Rn([],!0)}for(r=u?r:n;++r<n;){var a=Jo(s=t[r]),c="wrapper"==a?Yo(s):void 0;u=c&&di(c[0])&&424==c[1]&&!c[4].length&&1==c[9]?u[Jo(c[0])].apply(u,c[3]):1==s.length&&di(s)?u[a]():u.thru(s)}return function(){var e=arguments,r=e[0];if(u&&1==e.length&&xs(r))return u.plant(r).value();for(var o=0,i=n?t[o].apply(this,e):r;++o<n;)i=t[o].call(this,i);return i}}))}function Fo(e,t,n,o,i,s,u,a,c,l){var d=128&t,f=1&t,p=2&t,h=24&t,m=512&t,g=p?void 0:Do(e);return function E(){for(var y=arguments.length,v=r(y),A=y;A--;)v[A]=arguments[A];if(h)var b=Zo(E),C=Mt(v,b);if(o&&(v=Eo(v,o,i,h)),s&&(v=yo(v,s,u,h)),y-=C,h&&y<l){var S=Vt(v,b);return ko(e,t,Fo,E.placeholder,n,v,S,a,c,l-y)}var O=f?n:this,_=p?O[e]:e;return y=v.length,a?v=yi(v,a):m&&y>1&&v.reverse(),d&&c<y&&(v.length=c),this&&this!==He&&this instanceof E&&(_=g||Do(_)),_.apply(O,v)}}function No(e,t){return function(n,r){return function(e,t,n,r){return cr(e,(function(e,o,i){t(r,n(e),o,i)})),r}(n,e,t(r),{})}}function Ro(e,t){return function(n,r){var o;if(void 0===n&&void 0===r)return t;if(void 0!==n&&(o=n),void 0!==r){if(void 0===o)return r;"string"==typeof n||"string"==typeof r?(n=Xr(n),r=Xr(r)):(n=Zr(n),r=Zr(r)),o=e(n,r)}return o}}function Io(e){return Ho((function(t){return t=ft(t,Ft(Xo())),Lr((function(n){var r=this;return e(t,(function(e){return ot(e,r,n)}))}))}))}function xo(e,t){var n=(t=void 0===t?" ":Xr(t)).length;if(n<2)return n?jr(t,e):t;var r=jr(t,Qt(e/Wt(t)));return Lt(t)?lo(Ht(r),0,e).join(""):r.slice(0,e)}function Mo(e){return function(t,n,o){return o&&"number"!=typeof o&&ci(t,n,o)&&(n=o=void 0),t=ru(t),void 0===n?(n=t,t=0):n=ru(n),function(e,t,n,o){for(var i=-1,s=un(Qt((t-e)/(n||1)),0),u=r(s);s--;)u[o?s:++i]=e,e+=n;return u}(t,n,o=void 0===o?t<n?1:-1:ru(o),e)}}function Po(e){return function(t,n){return"string"==typeof t&&"string"==typeof n||(t=su(t),n=su(n)),e(t,n)}}function ko(e,t,n,r,o,i,s,u,a,c){var l=8&t;t|=l?32:64,4&(t&=~(l?64:32))||(t&=-4);var d=[e,t,o,l?i:void 0,l?s:void 0,l?void 0:i,l?void 0:s,u,a,c],f=n.apply(void 0,d);return di(e)&&Ai(f,d),f.placeholder=r,Si(f,e,t)}function jo(e){var t=pe[e];return function(e,n){if(e=su(e),(n=null==n?0:an(ou(n),292))&&rn(e)){var r=(au(e)+"e").split("e");return+((r=(au(t(r[0]+"e"+(+r[1]+n)))+"e").split("e"))[0]+"e"+(+r[1]-n))}return t(e)}}var Lo=gn&&1/zt(new gn([,-0]))[1]==1/0?function(e){return new gn(e)}:Xu;function Uo(e){return function(t){var n=oi(t);return n==h?Ut(t):n==y?qt(t):function(e,t){return ft(t,(function(t){return[t,e[t]]}))}(t,e(t))}}function $o(e,t,n,s,u,a,c,l){var d=2&t;if(!d&&"function"!=typeof e)throw new Ee(o);var f=s?s.length:0;if(f||(t&=-97,s=u=void 0),c=void 0===c?c:un(ou(c),0),l=void 0===l?l:ou(l),f-=u?u.length:0,64&t){var p=s,h=u;s=u=void 0}var m=d?void 0:Yo(e),g=[e,t,n,s,u,p,h,a,c,l];if(m&&function(e,t){var n=e[1],r=t[1],o=n|r,s=o<131,u=128==r&&8==n||128==r&&256==n&&e[7].length<=t[8]||384==r&&t[7].length<=t[8]&&8==n;if(!s&&!u)return e;1&r&&(e[2]=t[2],o|=1&n?0:4);var a=t[3];if(a){var c=e[3];e[3]=c?Eo(c,a,t[4]):a,e[4]=c?Vt(e[3],i):t[4]}(a=t[5])&&(c=e[5],e[5]=c?yo(c,a,t[6]):a,e[6]=c?Vt(e[5],i):t[6]);(a=t[7])&&(e[7]=a);128&r&&(e[8]=null==e[8]?t[8]:an(e[8],t[8]));null==e[9]&&(e[9]=t[9]);e[0]=t[0],e[1]=o}(g,m),e=g[0],t=g[1],n=g[2],s=g[3],u=g[4],!(l=g[9]=void 0===g[9]?d?0:e.length:un(g[9]-f,0))&&24&t&&(t&=-25),t&&1!=t)E=8==t||16==t?function(e,t,n){var o=Do(e);return function i(){for(var s=arguments.length,u=r(s),a=s,c=Zo(i);a--;)u[a]=arguments[a];var l=s<3&&u[0]!==c&&u[s-1]!==c?[]:Vt(u,c);if((s-=l.length)<n)return ko(e,t,Fo,i.placeholder,void 0,u,l,void 0,void 0,n-s);var d=this&&this!==He&&this instanceof i?o:e;return ot(d,this,u)}}(e,t,l):32!=t&&33!=t||u.length?Fo.apply(void 0,g):function(e,t,n,o){var i=1&t,s=Do(e);return function t(){for(var u=-1,a=arguments.length,c=-1,l=o.length,d=r(l+a),f=this&&this!==He&&this instanceof t?s:e;++c<l;)d[c]=o[c];for(;a--;)d[c++]=arguments[++u];return ot(f,i?n:this,d)}}(e,t,n,s);else var E=function(e,t,n){var r=1&t,o=Do(e);return function t(){var i=this&&this!==He&&this instanceof t?o:e;return i.apply(r?n:this,arguments)}}(e,t,n);return Si((m?zr:Ai)(E,g),e,t)}function Vo(e,t,n,r){return void 0===e||Fs(e,Ae[n])&&!Se.call(r,n)?t:e}function zo(e,t,n,r,o,i){return qs(e)&&qs(t)&&(i.set(t,e),Nr(e,t,void 0,zo,i),i.delete(t)),e}function qo(e){return Ks(e)?void 0:e}function Wo(e,t,n,r,o,i){var s=1&n,u=e.length,a=t.length;if(u!=a&&!(s&&a>u))return!1;var c=i.get(e),l=i.get(t);if(c&&l)return c==t&&l==e;var d=-1,f=!0,p=2&n?new kn:void 0;for(i.set(e,t),i.set(t,e);++d<u;){var h=e[d],m=t[d];if(r)var g=s?r(m,h,d,t,e,i):r(h,m,d,e,t,i);if(void 0!==g){if(g)continue;f=!1;break}if(p){if(!gt(t,(function(e,t){if(!Rt(p,t)&&(h===e||o(h,e,n,r,i)))return p.push(t)}))){f=!1;break}}else if(h!==m&&!o(h,m,n,r,i)){f=!1;break}}return i.delete(e),i.delete(t),f}function Ho(e){return Ci(gi(e,void 0,Mi),e+"")}function Go(e){return pr(e,bu,ni)}function Ko(e){return pr(e,Cu,ri)}var Yo=vn?function(e){return vn.get(e)}:Xu;function Jo(e){for(var t=e.name+"",n=An[t],r=Se.call(An,t)?n.length:0;r--;){var o=n[r],i=o.func;if(null==i||i==e)return o.name}return t}function Zo(e){return(Se.call(Tn,"placeholder")?Tn:e).placeholder}function Xo(){var e=Tn.iteratee||Ku;return e=e===Ku?Or:e,arguments.length?e(arguments[0],arguments[1]):e}function Qo(e,t){var n,r,o=e.__data__;return("string"==(r=typeof(n=t))||"number"==r||"symbol"==r||"boolean"==r?"__proto__"!==n:null===n)?o["string"==typeof t?"string":"hash"]:o.map}function ei(e){for(var t=bu(e),n=t.length;n--;){var r=t[n],o=e[r];t[n]=[r,o,hi(o)]}return t}function ti(e,t){var n=function(e,t){return null==e?void 0:e[t]}(e,t);return Sr(n)?n:void 0}var ni=tn?function(e){return null==e?[]:(e=he(e),ct(tn(e),(function(t){return Ge.call(e,t)})))}:ia,ri=tn?function(e){for(var t=[];e;)pt(t,ni(e)),e=qe(e);return t}:ia,oi=hr;function ii(e,t,n){for(var r=-1,o=(t=ao(t,e)).length,i=!1;++r<o;){var s=Di(t[r]);if(!(i=null!=e&&n(e,s)))break;e=e[s]}return i||++r!=o?i:!!(o=null==e?0:e.length)&&zs(o)&&ai(s,o)&&(xs(e)||Is(e))}function si(e){return"function"!=typeof e.constructor||pi(e)?{}:Fn(qe(e))}function ui(e){return xs(e)||Is(e)||!!(Je&&e&&e[Je])}function ai(e,t){var n=typeof e;return!!(t=null==t?9007199254740991:t)&&("number"==n||"symbol"!=n&&ue.test(e))&&e>-1&&e%1==0&&e<t}function ci(e,t,n){if(!qs(n))return!1;var r=typeof t;return!!("number"==r?Ps(n)&&ai(t,n.length):"string"==r&&t in n)&&Fs(n[t],e)}function li(e,t){if(xs(e))return!1;var n=typeof e;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=e&&!Xs(e))||(z.test(e)||!V.test(e)||null!=t&&e in he(t))}function di(e){var t=Jo(e),n=Tn[t];if("function"!=typeof n||!(t in In.prototype))return!1;if(e===n)return!0;var r=Yo(n);return!!r&&e===r[0]}(pn&&oi(new pn(new ArrayBuffer(1)))!=S||hn&&oi(new hn)!=h||mn&&"[object Promise]"!=oi(mn.resolve())||gn&&oi(new gn)!=y||En&&oi(new En)!=b)&&(oi=function(e){var t=hr(e),n=t==g?e.constructor:void 0,r=n?Bi(n):"";if(r)switch(r){case bn:return S;case Cn:return h;case Sn:return"[object Promise]";case On:return y;case _n:return b}return t});var fi=be?$s:sa;function pi(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||Ae)}function hi(e){return e==e&&!qs(e)}function mi(e,t){return function(n){return null!=n&&(n[e]===t&&(void 0!==t||e in he(n)))}}function gi(e,t,n){return t=un(void 0===t?e.length-1:t,0),function(){for(var o=arguments,i=-1,s=un(o.length-t,0),u=r(s);++i<s;)u[i]=o[t+i];i=-1;for(var a=r(t+1);++i<t;)a[i]=o[i];return a[t]=n(u),ot(e,this,a)}}function Ei(e,t){return t.length<2?e:fr(e,Hr(t,0,-1))}function yi(e,t){for(var n=e.length,r=an(t.length,n),o=vo(e);r--;){var i=t[r];e[r]=ai(i,n)?o[i]:void 0}return e}function vi(e,t){if(("constructor"!==t||"function"!=typeof e[t])&&"__proto__"!=t)return e[t]}var Ai=Oi(zr),bi=Xt||function(e,t){return He.setTimeout(e,t)},Ci=Oi(qr);function Si(e,t,n){var r=t+"";return Ci(e,function(e,t){var n=t.length;if(!n)return e;var r=n-1;return t[r]=(n>1?"& ":"")+t[r],t=t.join(n>2?", ":" "),e.replace(Y,"{\n/* [wrapped with "+t+"] */\n")}(r,function(e,t){return st(s,(function(n){var r="_."+n[0];t&n[1]&&!lt(e,r)&&e.push(r)})),e.sort()}(function(e){var t=e.match(J);return t?t[1].split(Z):[]}(r),n)))}function Oi(e){var t=0,n=0;return function(){var r=cn(),o=16-(r-n);if(n=r,o>0){if(++t>=800)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}function _i(e,t){var n=-1,r=e.length,o=r-1;for(t=void 0===t?r:t;++n<t;){var i=kr(n,o),s=e[i];e[i]=e[n],e[n]=s}return e.length=t,e}var wi=function(e){var t=Os(e,(function(e){return 500===n.size&&n.clear(),e})),n=t.cache;return t}((function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(q,(function(e,n,r,o){t.push(r?o.replace(ee,"$1"):n||e)})),t}));function Di(e){if("string"==typeof e||Xs(e))return e;var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}function Bi(e){if(null!=e){try{return Ce.call(e)}catch(e){}try{return e+""}catch(e){}}return""}function Ti(e){if(e instanceof In)return e.clone();var t=new Rn(e.__wrapped__,e.__chain__);return t.__actions__=vo(e.__actions__),t.__index__=e.__index__,t.__values__=e.__values__,t}var Fi=Lr((function(e,t){return ks(e)?er(e,sr(t,1,ks,!0)):[]})),Ni=Lr((function(e,t){var n=Ui(t);return ks(n)&&(n=void 0),ks(e)?er(e,sr(t,1,ks,!0),Xo(n,2)):[]})),Ri=Lr((function(e,t){var n=Ui(t);return ks(n)&&(n=void 0),ks(e)?er(e,sr(t,1,ks,!0),void 0,n):[]}));function Ii(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var o=null==n?0:ou(n);return o<0&&(o=un(r+o,0)),vt(e,Xo(t,3),o)}function xi(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var o=r-1;return void 0!==n&&(o=ou(n),o=n<0?un(r+o,0):an(o,r-1)),vt(e,Xo(t,3),o,!0)}function Mi(e){return(null==e?0:e.length)?sr(e,1):[]}function Pi(e){return e&&e.length?e[0]:void 0}var ki=Lr((function(e){var t=ft(e,so);return t.length&&t[0]===e[0]?yr(t):[]})),ji=Lr((function(e){var t=Ui(e),n=ft(e,so);return t===Ui(n)?t=void 0:n.pop(),n.length&&n[0]===e[0]?yr(n,Xo(t,2)):[]})),Li=Lr((function(e){var t=Ui(e),n=ft(e,so);return(t="function"==typeof t?t:void 0)&&n.pop(),n.length&&n[0]===e[0]?yr(n,void 0,t):[]}));function Ui(e){var t=null==e?0:e.length;return t?e[t-1]:void 0}var $i=Lr(Vi);function Vi(e,t){return e&&e.length&&t&&t.length?Mr(e,t):e}var zi=Ho((function(e,t){var n=null==e?0:e.length,r=Yn(e,t);return Pr(e,ft(t,(function(e){return ai(e,n)?+e:e})).sort(go)),r}));function qi(e){return null==e?e:fn.call(e)}var Wi=Lr((function(e){return Qr(sr(e,1,ks,!0))})),Hi=Lr((function(e){var t=Ui(e);return ks(t)&&(t=void 0),Qr(sr(e,1,ks,!0),Xo(t,2))})),Gi=Lr((function(e){var t=Ui(e);return t="function"==typeof t?t:void 0,Qr(sr(e,1,ks,!0),void 0,t)}));function Ki(e){if(!e||!e.length)return[];var t=0;return e=ct(e,(function(e){if(ks(e))return t=un(e.length,t),!0})),Bt(t,(function(t){return ft(e,Ot(t))}))}function Yi(e,t){if(!e||!e.length)return[];var n=Ki(e);return null==t?n:ft(n,(function(e){return ot(t,void 0,e)}))}var Ji=Lr((function(e,t){return ks(e)?er(e,t):[]})),Zi=Lr((function(e){return oo(ct(e,ks))})),Xi=Lr((function(e){var t=Ui(e);return ks(t)&&(t=void 0),oo(ct(e,ks),Xo(t,2))})),Qi=Lr((function(e){var t=Ui(e);return t="function"==typeof t?t:void 0,oo(ct(e,ks),void 0,t)})),es=Lr(Ki);var ts=Lr((function(e){var t=e.length,n=t>1?e[t-1]:void 0;return n="function"==typeof n?(e.pop(),n):void 0,Yi(e,n)}));function ns(e){var t=Tn(e);return t.__chain__=!0,t}function rs(e,t){return t(e)}var os=Ho((function(e){var t=e.length,n=t?e[0]:0,r=this.__wrapped__,o=function(t){return Yn(t,e)};return!(t>1||this.__actions__.length)&&r instanceof In&&ai(n)?((r=r.slice(n,+n+(t?1:0))).__actions__.push({func:rs,args:[o],thisArg:void 0}),new Rn(r,this.__chain__).thru((function(e){return t&&!e.length&&e.push(void 0),e}))):this.thru(o)}));var is=bo((function(e,t,n){Se.call(e,n)?++e[n]:Kn(e,n,1)}));var ss=Bo(Ii),us=Bo(xi);function as(e,t){return(xs(e)?st:tr)(e,Xo(t,3))}function cs(e,t){return(xs(e)?ut:nr)(e,Xo(t,3))}var ls=bo((function(e,t,n){Se.call(e,n)?e[n].push(t):Kn(e,n,[t])}));var ds=Lr((function(e,t,n){var o=-1,i="function"==typeof t,s=Ps(e)?r(e.length):[];return tr(e,(function(e){s[++o]=i?ot(t,e,n):vr(e,t,n)})),s})),fs=bo((function(e,t,n){Kn(e,n,t)}));function ps(e,t){return(xs(e)?ft:Br)(e,Xo(t,3))}var hs=bo((function(e,t,n){e[n?0:1].push(t)}),(function(){return[[],[]]}));var ms=Lr((function(e,t){if(null==e)return[];var n=t.length;return n>1&&ci(e,t[0],t[1])?t=[]:n>2&&ci(t[0],t[1],t[2])&&(t=[t[0]]),Ir(e,sr(t,1),[])})),gs=Zt||function(){return He.Date.now()};function Es(e,t,n){return t=n?void 0:t,$o(e,128,void 0,void 0,void 0,void 0,t=e&&null==t?e.length:t)}function ys(e,t){var n;if("function"!=typeof t)throw new Ee(o);return e=ou(e),function(){return--e>0&&(n=t.apply(this,arguments)),e<=1&&(t=void 0),n}}var vs=Lr((function(e,t,n){var r=1;if(n.length){var o=Vt(n,Zo(vs));r|=32}return $o(e,r,t,n,o)})),As=Lr((function(e,t,n){var r=3;if(n.length){var o=Vt(n,Zo(As));r|=32}return $o(t,r,e,n,o)}));function bs(e,t,n){var r,i,s,u,a,c,l=0,d=!1,f=!1,p=!0;if("function"!=typeof e)throw new Ee(o);function h(t){var n=r,o=i;return r=i=void 0,l=t,u=e.apply(o,n)}function m(e){return l=e,a=bi(E,t),d?h(e):u}function g(e){var n=e-c;return void 0===c||n>=t||n<0||f&&e-l>=s}function E(){var e=gs();if(g(e))return y(e);a=bi(E,function(e){var n=t-(e-c);return f?an(n,s-(e-l)):n}(e))}function y(e){return a=void 0,p&&r?h(e):(r=i=void 0,u)}function v(){var e=gs(),n=g(e);if(r=arguments,i=this,c=e,n){if(void 0===a)return m(c);if(f)return fo(a),a=bi(E,t),h(c)}return void 0===a&&(a=bi(E,t)),u}return t=su(t)||0,qs(n)&&(d=!!n.leading,s=(f="maxWait"in n)?un(su(n.maxWait)||0,t):s,p="trailing"in n?!!n.trailing:p),v.cancel=function(){void 0!==a&&fo(a),l=0,r=c=i=a=void 0},v.flush=function(){return void 0===a?u:y(gs())},v}var Cs=Lr((function(e,t){return Qn(e,1,t)})),Ss=Lr((function(e,t,n){return Qn(e,su(t)||0,n)}));function Os(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new Ee(o);var n=function(){var r=arguments,o=t?t.apply(this,r):r[0],i=n.cache;if(i.has(o))return i.get(o);var s=e.apply(this,r);return n.cache=i.set(o,s)||i,s};return n.cache=new(Os.Cache||Pn),n}function _s(e){if("function"!=typeof e)throw new Ee(o);return function(){var t=arguments;switch(t.length){case 0:return!e.call(this);case 1:return!e.call(this,t[0]);case 2:return!e.call(this,t[0],t[1]);case 3:return!e.call(this,t[0],t[1],t[2])}return!e.apply(this,t)}}Os.Cache=Pn;var ws=co((function(e,t){var n=(t=1==t.length&&xs(t[0])?ft(t[0],Ft(Xo())):ft(sr(t,1),Ft(Xo()))).length;return Lr((function(r){for(var o=-1,i=an(r.length,n);++o<i;)r[o]=t[o].call(this,r[o]);return ot(e,this,r)}))})),Ds=Lr((function(e,t){return $o(e,32,void 0,t,Vt(t,Zo(Ds)))})),Bs=Lr((function(e,t){return $o(e,64,void 0,t,Vt(t,Zo(Bs)))})),Ts=Ho((function(e,t){return $o(e,256,void 0,void 0,void 0,t)}));function Fs(e,t){return e===t||e!=e&&t!=t}var Ns=Po(mr),Rs=Po((function(e,t){return e>=t})),Is=Ar(function(){return arguments}())?Ar:function(e){return Ws(e)&&Se.call(e,"callee")&&!Ge.call(e,"callee")},xs=r.isArray,Ms=Xe?Ft(Xe):function(e){return Ws(e)&&hr(e)==C};function Ps(e){return null!=e&&zs(e.length)&&!$s(e)}function ks(e){return Ws(e)&&Ps(e)}var js=nn||sa,Ls=Qe?Ft(Qe):function(e){return Ws(e)&&hr(e)==l};function Us(e){if(!Ws(e))return!1;var t=hr(e);return t==d||"[object DOMException]"==t||"string"==typeof e.message&&"string"==typeof e.name&&!Ks(e)}function $s(e){if(!qs(e))return!1;var t=hr(e);return t==f||t==p||"[object AsyncFunction]"==t||"[object Proxy]"==t}function Vs(e){return"number"==typeof e&&e==ou(e)}function zs(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991}function qs(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function Ws(e){return null!=e&&"object"==typeof e}var Hs=et?Ft(et):function(e){return Ws(e)&&oi(e)==h};function Gs(e){return"number"==typeof e||Ws(e)&&hr(e)==m}function Ks(e){if(!Ws(e)||hr(e)!=g)return!1;var t=qe(e);if(null===t)return!0;var n=Se.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&Ce.call(n)==De}var Ys=tt?Ft(tt):function(e){return Ws(e)&&hr(e)==E};var Js=nt?Ft(nt):function(e){return Ws(e)&&oi(e)==y};function Zs(e){return"string"==typeof e||!xs(e)&&Ws(e)&&hr(e)==v}function Xs(e){return"symbol"==typeof e||Ws(e)&&hr(e)==A}var Qs=rt?Ft(rt):function(e){return Ws(e)&&zs(e.length)&&!!Le[hr(e)]};var eu=Po(Dr),tu=Po((function(e,t){return e<=t}));function nu(e){if(!e)return[];if(Ps(e))return Zs(e)?Ht(e):vo(e);if(Ze&&e[Ze])return function(e){for(var t,n=[];!(t=e.next()).done;)n.push(t.value);return n}(e[Ze]());var t=oi(e);return(t==h?Ut:t==y?zt:Fu)(e)}function ru(e){return e?(e=su(e))===1/0||e===-1/0?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0}function ou(e){var t=ru(e),n=t%1;return t==t?n?t-n:t:0}function iu(e){return e?Jn(ou(e),0,4294967295):0}function su(e){if("number"==typeof e)return e;if(Xs(e))return NaN;if(qs(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=qs(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=Tt(e);var n=oe.test(e);return n||se.test(e)?ze(e.slice(2),n?2:8):re.test(e)?NaN:+e}function uu(e){return Ao(e,Cu(e))}function au(e){return null==e?"":Xr(e)}var cu=Co((function(e,t){if(pi(t)||Ps(t))Ao(t,bu(t),e);else for(var n in t)Se.call(t,n)&&qn(e,n,t[n])})),lu=Co((function(e,t){Ao(t,Cu(t),e)})),du=Co((function(e,t,n,r){Ao(t,Cu(t),e,r)})),fu=Co((function(e,t,n,r){Ao(t,bu(t),e,r)})),pu=Ho(Yn);var hu=Lr((function(e,t){e=he(e);var n=-1,r=t.length,o=r>2?t[2]:void 0;for(o&&ci(t[0],t[1],o)&&(r=1);++n<r;)for(var i=t[n],s=Cu(i),u=-1,a=s.length;++u<a;){var c=s[u],l=e[c];(void 0===l||Fs(l,Ae[c])&&!Se.call(e,c))&&(e[c]=i[c])}return e})),mu=Lr((function(e){return e.push(void 0,zo),ot(Ou,void 0,e)}));function gu(e,t,n){var r=null==e?void 0:fr(e,t);return void 0===r?n:r}function Eu(e,t){return null!=e&&ii(e,t,Er)}var yu=No((function(e,t,n){null!=t&&"function"!=typeof t.toString&&(t=we.call(t)),e[t]=n}),qu(Gu)),vu=No((function(e,t,n){null!=t&&"function"!=typeof t.toString&&(t=we.call(t)),Se.call(e,t)?e[t].push(n):e[t]=[n]}),Xo),Au=Lr(vr);function bu(e){return Ps(e)?Ln(e):_r(e)}function Cu(e){return Ps(e)?Ln(e,!0):wr(e)}var Su=Co((function(e,t,n){Nr(e,t,n)})),Ou=Co((function(e,t,n,r){Nr(e,t,n,r)})),_u=Ho((function(e,t){var n={};if(null==e)return n;var r=!1;t=ft(t,(function(t){return t=ao(t,e),r||(r=t.length>1),t})),Ao(e,Ko(e),n),r&&(n=Zn(n,7,qo));for(var o=t.length;o--;)eo(n,t[o]);return n}));var wu=Ho((function(e,t){return null==e?{}:function(e,t){return xr(e,t,(function(t,n){return Eu(e,n)}))}(e,t)}));function Du(e,t){if(null==e)return{};var n=ft(Ko(e),(function(e){return[e]}));return t=Xo(t),xr(e,n,(function(e,n){return t(e,n[0])}))}var Bu=Uo(bu),Tu=Uo(Cu);function Fu(e){return null==e?[]:Nt(e,bu(e))}var Nu=wo((function(e,t,n){return t=t.toLowerCase(),e+(n?Ru(t):t)}));function Ru(e){return Uu(au(e).toLowerCase())}function Iu(e){return(e=au(e))&&e.replace(ae,Pt).replace(Re,"")}var xu=wo((function(e,t,n){return e+(n?"-":"")+t.toLowerCase()})),Mu=wo((function(e,t,n){return e+(n?" ":"")+t.toLowerCase()})),Pu=_o("toLowerCase");var ku=wo((function(e,t,n){return e+(n?"_":"")+t.toLowerCase()}));var ju=wo((function(e,t,n){return e+(n?" ":"")+Uu(t)}));var Lu=wo((function(e,t,n){return e+(n?" ":"")+t.toUpperCase()})),Uu=_o("toUpperCase");function $u(e,t,n){return e=au(e),void 0===(t=n?void 0:t)?function(e){return Pe.test(e)}(e)?function(e){return e.match(xe)||[]}(e):function(e){return e.match(X)||[]}(e):e.match(t)||[]}var Vu=Lr((function(e,t){try{return ot(e,void 0,t)}catch(e){return Us(e)?e:new de(e)}})),zu=Ho((function(e,t){return st(t,(function(t){t=Di(t),Kn(e,t,vs(e[t],e))})),e}));function qu(e){return function(){return e}}var Wu=To(),Hu=To(!0);function Gu(e){return e}function Ku(e){return Or("function"==typeof e?e:Zn(e,1))}var Yu=Lr((function(e,t){return function(n){return vr(n,e,t)}})),Ju=Lr((function(e,t){return function(n){return vr(e,n,t)}}));function Zu(e,t,n){var r=bu(t),o=dr(t,r);null!=n||qs(t)&&(o.length||!r.length)||(n=t,t=e,e=this,o=dr(t,bu(t)));var i=!(qs(n)&&"chain"in n&&!n.chain),s=$s(e);return st(o,(function(n){var r=t[n];e[n]=r,s&&(e.prototype[n]=function(){var t=this.__chain__;if(i||t){var n=e(this.__wrapped__),o=n.__actions__=vo(this.__actions__);return o.push({func:r,args:arguments,thisArg:e}),n.__chain__=t,n}return r.apply(e,pt([this.value()],arguments))})})),e}function Xu(){}var Qu=Io(ft),ea=Io(at),ta=Io(gt);function na(e){return li(e)?Ot(Di(e)):function(e){return function(t){return fr(t,e)}}(e)}var ra=Mo(),oa=Mo(!0);function ia(){return[]}function sa(){return!1}var ua=Ro((function(e,t){return e+t}),0),aa=jo("ceil"),ca=Ro((function(e,t){return e/t}),1),la=jo("floor");var da,fa=Ro((function(e,t){return e*t}),1),pa=jo("round"),ha=Ro((function(e,t){return e-t}),0);return Tn.after=function(e,t){if("function"!=typeof t)throw new Ee(o);return e=ou(e),function(){if(--e<1)return t.apply(this,arguments)}},Tn.ary=Es,Tn.assign=cu,Tn.assignIn=lu,Tn.assignInWith=du,Tn.assignWith=fu,Tn.at=pu,Tn.before=ys,Tn.bind=vs,Tn.bindAll=zu,Tn.bindKey=As,Tn.castArray=function(){if(!arguments.length)return[];var e=arguments[0];return xs(e)?e:[e]},Tn.chain=ns,Tn.chunk=function(e,t,n){t=(n?ci(e,t,n):void 0===t)?1:un(ou(t),0);var o=null==e?0:e.length;if(!o||t<1)return[];for(var i=0,s=0,u=r(Qt(o/t));i<o;)u[s++]=Hr(e,i,i+=t);return u},Tn.compact=function(e){for(var t=-1,n=null==e?0:e.length,r=0,o=[];++t<n;){var i=e[t];i&&(o[r++]=i)}return o},Tn.concat=function(){var e=arguments.length;if(!e)return[];for(var t=r(e-1),n=arguments[0],o=e;o--;)t[o-1]=arguments[o];return pt(xs(n)?vo(n):[n],sr(t,1))},Tn.cond=function(e){var t=null==e?0:e.length,n=Xo();return e=t?ft(e,(function(e){if("function"!=typeof e[1])throw new Ee(o);return[n(e[0]),e[1]]})):[],Lr((function(n){for(var r=-1;++r<t;){var o=e[r];if(ot(o[0],this,n))return ot(o[1],this,n)}}))},Tn.conforms=function(e){return function(e){var t=bu(e);return function(n){return Xn(n,e,t)}}(Zn(e,1))},Tn.constant=qu,Tn.countBy=is,Tn.create=function(e,t){var n=Fn(e);return null==t?n:Gn(n,t)},Tn.curry=function e(t,n,r){var o=$o(t,8,void 0,void 0,void 0,void 0,void 0,n=r?void 0:n);return o.placeholder=e.placeholder,o},Tn.curryRight=function e(t,n,r){var o=$o(t,16,void 0,void 0,void 0,void 0,void 0,n=r?void 0:n);return o.placeholder=e.placeholder,o},Tn.debounce=bs,Tn.defaults=hu,Tn.defaultsDeep=mu,Tn.defer=Cs,Tn.delay=Ss,Tn.difference=Fi,Tn.differenceBy=Ni,Tn.differenceWith=Ri,Tn.drop=function(e,t,n){var r=null==e?0:e.length;return r?Hr(e,(t=n||void 0===t?1:ou(t))<0?0:t,r):[]},Tn.dropRight=function(e,t,n){var r=null==e?0:e.length;return r?Hr(e,0,(t=r-(t=n||void 0===t?1:ou(t)))<0?0:t):[]},Tn.dropRightWhile=function(e,t){return e&&e.length?no(e,Xo(t,3),!0,!0):[]},Tn.dropWhile=function(e,t){return e&&e.length?no(e,Xo(t,3),!0):[]},Tn.fill=function(e,t,n,r){var o=null==e?0:e.length;return o?(n&&"number"!=typeof n&&ci(e,t,n)&&(n=0,r=o),function(e,t,n,r){var o=e.length;for((n=ou(n))<0&&(n=-n>o?0:o+n),(r=void 0===r||r>o?o:ou(r))<0&&(r+=o),r=n>r?0:iu(r);n<r;)e[n++]=t;return e}(e,t,n,r)):[]},Tn.filter=function(e,t){return(xs(e)?ct:ir)(e,Xo(t,3))},Tn.flatMap=function(e,t){return sr(ps(e,t),1)},Tn.flatMapDeep=function(e,t){return sr(ps(e,t),1/0)},Tn.flatMapDepth=function(e,t,n){return n=void 0===n?1:ou(n),sr(ps(e,t),n)},Tn.flatten=Mi,Tn.flattenDeep=function(e){return(null==e?0:e.length)?sr(e,1/0):[]},Tn.flattenDepth=function(e,t){return(null==e?0:e.length)?sr(e,t=void 0===t?1:ou(t)):[]},Tn.flip=function(e){return $o(e,512)},Tn.flow=Wu,Tn.flowRight=Hu,Tn.fromPairs=function(e){for(var t=-1,n=null==e?0:e.length,r={};++t<n;){var o=e[t];r[o[0]]=o[1]}return r},Tn.functions=function(e){return null==e?[]:dr(e,bu(e))},Tn.functionsIn=function(e){return null==e?[]:dr(e,Cu(e))},Tn.groupBy=ls,Tn.initial=function(e){return(null==e?0:e.length)?Hr(e,0,-1):[]},Tn.intersection=ki,Tn.intersectionBy=ji,Tn.intersectionWith=Li,Tn.invert=yu,Tn.invertBy=vu,Tn.invokeMap=ds,Tn.iteratee=Ku,Tn.keyBy=fs,Tn.keys=bu,Tn.keysIn=Cu,Tn.map=ps,Tn.mapKeys=function(e,t){var n={};return t=Xo(t,3),cr(e,(function(e,r,o){Kn(n,t(e,r,o),e)})),n},Tn.mapValues=function(e,t){var n={};return t=Xo(t,3),cr(e,(function(e,r,o){Kn(n,r,t(e,r,o))})),n},Tn.matches=function(e){return Tr(Zn(e,1))},Tn.matchesProperty=function(e,t){return Fr(e,Zn(t,1))},Tn.memoize=Os,Tn.merge=Su,Tn.mergeWith=Ou,Tn.method=Yu,Tn.methodOf=Ju,Tn.mixin=Zu,Tn.negate=_s,Tn.nthArg=function(e){return e=ou(e),Lr((function(t){return Rr(t,e)}))},Tn.omit=_u,Tn.omitBy=function(e,t){return Du(e,_s(Xo(t)))},Tn.once=function(e){return ys(2,e)},Tn.orderBy=function(e,t,n,r){return null==e?[]:(xs(t)||(t=null==t?[]:[t]),xs(n=r?void 0:n)||(n=null==n?[]:[n]),Ir(e,t,n))},Tn.over=Qu,Tn.overArgs=ws,Tn.overEvery=ea,Tn.overSome=ta,Tn.partial=Ds,Tn.partialRight=Bs,Tn.partition=hs,Tn.pick=wu,Tn.pickBy=Du,Tn.property=na,Tn.propertyOf=function(e){return function(t){return null==e?void 0:fr(e,t)}},Tn.pull=$i,Tn.pullAll=Vi,Tn.pullAllBy=function(e,t,n){return e&&e.length&&t&&t.length?Mr(e,t,Xo(n,2)):e},Tn.pullAllWith=function(e,t,n){return e&&e.length&&t&&t.length?Mr(e,t,void 0,n):e},Tn.pullAt=zi,Tn.range=ra,Tn.rangeRight=oa,Tn.rearg=Ts,Tn.reject=function(e,t){return(xs(e)?ct:ir)(e,_s(Xo(t,3)))},Tn.remove=function(e,t){var n=[];if(!e||!e.length)return n;var r=-1,o=[],i=e.length;for(t=Xo(t,3);++r<i;){var s=e[r];t(s,r,e)&&(n.push(s),o.push(r))}return Pr(e,o),n},Tn.rest=function(e,t){if("function"!=typeof e)throw new Ee(o);return Lr(e,t=void 0===t?t:ou(t))},Tn.reverse=qi,Tn.sampleSize=function(e,t,n){return t=(n?ci(e,t,n):void 0===t)?1:ou(t),(xs(e)?$n:$r)(e,t)},Tn.set=function(e,t,n){return null==e?e:Vr(e,t,n)},Tn.setWith=function(e,t,n,r){return r="function"==typeof r?r:void 0,null==e?e:Vr(e,t,n,r)},Tn.shuffle=function(e){return(xs(e)?Vn:Wr)(e)},Tn.slice=function(e,t,n){var r=null==e?0:e.length;return r?(n&&"number"!=typeof n&&ci(e,t,n)?(t=0,n=r):(t=null==t?0:ou(t),n=void 0===n?r:ou(n)),Hr(e,t,n)):[]},Tn.sortBy=ms,Tn.sortedUniq=function(e){return e&&e.length?Jr(e):[]},Tn.sortedUniqBy=function(e,t){return e&&e.length?Jr(e,Xo(t,2)):[]},Tn.split=function(e,t,n){return n&&"number"!=typeof n&&ci(e,t,n)&&(t=n=void 0),(n=void 0===n?4294967295:n>>>0)?(e=au(e))&&("string"==typeof t||null!=t&&!Ys(t))&&!(t=Xr(t))&&Lt(e)?lo(Ht(e),0,n):e.split(t,n):[]},Tn.spread=function(e,t){if("function"!=typeof e)throw new Ee(o);return t=null==t?0:un(ou(t),0),Lr((function(n){var r=n[t],o=lo(n,0,t);return r&&pt(o,r),ot(e,this,o)}))},Tn.tail=function(e){var t=null==e?0:e.length;return t?Hr(e,1,t):[]},Tn.take=function(e,t,n){return e&&e.length?Hr(e,0,(t=n||void 0===t?1:ou(t))<0?0:t):[]},Tn.takeRight=function(e,t,n){var r=null==e?0:e.length;return r?Hr(e,(t=r-(t=n||void 0===t?1:ou(t)))<0?0:t,r):[]},Tn.takeRightWhile=function(e,t){return e&&e.length?no(e,Xo(t,3),!1,!0):[]},Tn.takeWhile=function(e,t){return e&&e.length?no(e,Xo(t,3)):[]},Tn.tap=function(e,t){return t(e),e},Tn.throttle=function(e,t,n){var r=!0,i=!0;if("function"!=typeof e)throw new Ee(o);return qs(n)&&(r="leading"in n?!!n.leading:r,i="trailing"in n?!!n.trailing:i),bs(e,t,{leading:r,maxWait:t,trailing:i})},Tn.thru=rs,Tn.toArray=nu,Tn.toPairs=Bu,Tn.toPairsIn=Tu,Tn.toPath=function(e){return xs(e)?ft(e,Di):Xs(e)?[e]:vo(wi(au(e)))},Tn.toPlainObject=uu,Tn.transform=function(e,t,n){var r=xs(e),o=r||js(e)||Qs(e);if(t=Xo(t,4),null==n){var i=e&&e.constructor;n=o?r?new i:[]:qs(e)&&$s(i)?Fn(qe(e)):{}}return(o?st:cr)(e,(function(e,r,o){return t(n,e,r,o)})),n},Tn.unary=function(e){return Es(e,1)},Tn.union=Wi,Tn.unionBy=Hi,Tn.unionWith=Gi,Tn.uniq=function(e){return e&&e.length?Qr(e):[]},Tn.uniqBy=function(e,t){return e&&e.length?Qr(e,Xo(t,2)):[]},Tn.uniqWith=function(e,t){return t="function"==typeof t?t:void 0,e&&e.length?Qr(e,void 0,t):[]},Tn.unset=function(e,t){return null==e||eo(e,t)},Tn.unzip=Ki,Tn.unzipWith=Yi,Tn.update=function(e,t,n){return null==e?e:to(e,t,uo(n))},Tn.updateWith=function(e,t,n,r){return r="function"==typeof r?r:void 0,null==e?e:to(e,t,uo(n),r)},Tn.values=Fu,Tn.valuesIn=function(e){return null==e?[]:Nt(e,Cu(e))},Tn.without=Ji,Tn.words=$u,Tn.wrap=function(e,t){return Ds(uo(t),e)},Tn.xor=Zi,Tn.xorBy=Xi,Tn.xorWith=Qi,Tn.zip=es,Tn.zipObject=function(e,t){return io(e||[],t||[],qn)},Tn.zipObjectDeep=function(e,t){return io(e||[],t||[],Vr)},Tn.zipWith=ts,Tn.entries=Bu,Tn.entriesIn=Tu,Tn.extend=lu,Tn.extendWith=du,Zu(Tn,Tn),Tn.add=ua,Tn.attempt=Vu,Tn.camelCase=Nu,Tn.capitalize=Ru,Tn.ceil=aa,Tn.clamp=function(e,t,n){return void 0===n&&(n=t,t=void 0),void 0!==n&&(n=(n=su(n))==n?n:0),void 0!==t&&(t=(t=su(t))==t?t:0),Jn(su(e),t,n)},Tn.clone=function(e){return Zn(e,4)},Tn.cloneDeep=function(e){return Zn(e,5)},Tn.cloneDeepWith=function(e,t){return Zn(e,5,t="function"==typeof t?t:void 0)},Tn.cloneWith=function(e,t){return Zn(e,4,t="function"==typeof t?t:void 0)},Tn.conformsTo=function(e,t){return null==t||Xn(e,t,bu(t))},Tn.deburr=Iu,Tn.defaultTo=function(e,t){return null==e||e!=e?t:e},Tn.divide=ca,Tn.endsWith=function(e,t,n){e=au(e),t=Xr(t);var r=e.length,o=n=void 0===n?r:Jn(ou(n),0,r);return(n-=t.length)>=0&&e.slice(n,o)==t},Tn.eq=Fs,Tn.escape=function(e){return(e=au(e))&&j.test(e)?e.replace(P,kt):e},Tn.escapeRegExp=function(e){return(e=au(e))&&H.test(e)?e.replace(W,"\\$&"):e},Tn.every=function(e,t,n){var r=xs(e)?at:rr;return n&&ci(e,t,n)&&(t=void 0),r(e,Xo(t,3))},Tn.find=ss,Tn.findIndex=Ii,Tn.findKey=function(e,t){return yt(e,Xo(t,3),cr)},Tn.findLast=us,Tn.findLastIndex=xi,Tn.findLastKey=function(e,t){return yt(e,Xo(t,3),lr)},Tn.floor=la,Tn.forEach=as,Tn.forEachRight=cs,Tn.forIn=function(e,t){return null==e?e:ur(e,Xo(t,3),Cu)},Tn.forInRight=function(e,t){return null==e?e:ar(e,Xo(t,3),Cu)},Tn.forOwn=function(e,t){return e&&cr(e,Xo(t,3))},Tn.forOwnRight=function(e,t){return e&&lr(e,Xo(t,3))},Tn.get=gu,Tn.gt=Ns,Tn.gte=Rs,Tn.has=function(e,t){return null!=e&&ii(e,t,gr)},Tn.hasIn=Eu,Tn.head=Pi,Tn.identity=Gu,Tn.includes=function(e,t,n,r){e=Ps(e)?e:Fu(e),n=n&&!r?ou(n):0;var o=e.length;return n<0&&(n=un(o+n,0)),Zs(e)?n<=o&&e.indexOf(t,n)>-1:!!o&&At(e,t,n)>-1},Tn.indexOf=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var o=null==n?0:ou(n);return o<0&&(o=un(r+o,0)),At(e,t,o)},Tn.inRange=function(e,t,n){return t=ru(t),void 0===n?(n=t,t=0):n=ru(n),function(e,t,n){return e>=an(t,n)&&e<un(t,n)}(e=su(e),t,n)},Tn.invoke=Au,Tn.isArguments=Is,Tn.isArray=xs,Tn.isArrayBuffer=Ms,Tn.isArrayLike=Ps,Tn.isArrayLikeObject=ks,Tn.isBoolean=function(e){return!0===e||!1===e||Ws(e)&&hr(e)==c},Tn.isBuffer=js,Tn.isDate=Ls,Tn.isElement=function(e){return Ws(e)&&1===e.nodeType&&!Ks(e)},Tn.isEmpty=function(e){if(null==e)return!0;if(Ps(e)&&(xs(e)||"string"==typeof e||"function"==typeof e.splice||js(e)||Qs(e)||Is(e)))return!e.length;var t=oi(e);if(t==h||t==y)return!e.size;if(pi(e))return!_r(e).length;for(var n in e)if(Se.call(e,n))return!1;return!0},Tn.isEqual=function(e,t){return br(e,t)},Tn.isEqualWith=function(e,t,n){var r=(n="function"==typeof n?n:void 0)?n(e,t):void 0;return void 0===r?br(e,t,void 0,n):!!r},Tn.isError=Us,Tn.isFinite=function(e){return"number"==typeof e&&rn(e)},Tn.isFunction=$s,Tn.isInteger=Vs,Tn.isLength=zs,Tn.isMap=Hs,Tn.isMatch=function(e,t){return e===t||Cr(e,t,ei(t))},Tn.isMatchWith=function(e,t,n){return n="function"==typeof n?n:void 0,Cr(e,t,ei(t),n)},Tn.isNaN=function(e){return Gs(e)&&e!=+e},Tn.isNative=function(e){if(fi(e))throw new de("Unsupported core-js use. Try https://npms.io/search?q=ponyfill.");return Sr(e)},Tn.isNil=function(e){return null==e},Tn.isNull=function(e){return null===e},Tn.isNumber=Gs,Tn.isObject=qs,Tn.isObjectLike=Ws,Tn.isPlainObject=Ks,Tn.isRegExp=Ys,Tn.isSafeInteger=function(e){return Vs(e)&&e>=-9007199254740991&&e<=9007199254740991},Tn.isSet=Js,Tn.isString=Zs,Tn.isSymbol=Xs,Tn.isTypedArray=Qs,Tn.isUndefined=function(e){return void 0===e},Tn.isWeakMap=function(e){return Ws(e)&&oi(e)==b},Tn.isWeakSet=function(e){return Ws(e)&&"[object WeakSet]"==hr(e)},Tn.join=function(e,t){return null==e?"":on.call(e,t)},Tn.kebabCase=xu,Tn.last=Ui,Tn.lastIndexOf=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var o=r;return void 0!==n&&(o=(o=ou(n))<0?un(r+o,0):an(o,r-1)),t==t?function(e,t,n){for(var r=n+1;r--;)if(e[r]===t)return r;return r}(e,t,o):vt(e,Ct,o,!0)},Tn.lowerCase=Mu,Tn.lowerFirst=Pu,Tn.lt=eu,Tn.lte=tu,Tn.max=function(e){return e&&e.length?or(e,Gu,mr):void 0},Tn.maxBy=function(e,t){return e&&e.length?or(e,Xo(t,2),mr):void 0},Tn.mean=function(e){return St(e,Gu)},Tn.meanBy=function(e,t){return St(e,Xo(t,2))},Tn.min=function(e){return e&&e.length?or(e,Gu,Dr):void 0},Tn.minBy=function(e,t){return e&&e.length?or(e,Xo(t,2),Dr):void 0},Tn.stubArray=ia,Tn.stubFalse=sa,Tn.stubObject=function(){return{}},Tn.stubString=function(){return""},Tn.stubTrue=function(){return!0},Tn.multiply=fa,Tn.nth=function(e,t){return e&&e.length?Rr(e,ou(t)):void 0},Tn.noConflict=function(){return He._===this&&(He._=Be),this},Tn.noop=Xu,Tn.now=gs,Tn.pad=function(e,t,n){e=au(e);var r=(t=ou(t))?Wt(e):0;if(!t||r>=t)return e;var o=(t-r)/2;return xo(en(o),n)+e+xo(Qt(o),n)},Tn.padEnd=function(e,t,n){e=au(e);var r=(t=ou(t))?Wt(e):0;return t&&r<t?e+xo(t-r,n):e},Tn.padStart=function(e,t,n){e=au(e);var r=(t=ou(t))?Wt(e):0;return t&&r<t?xo(t-r,n)+e:e},Tn.parseInt=function(e,t,n){return n||null==t?t=0:t&&(t=+t),ln(au(e).replace(G,""),t||0)},Tn.random=function(e,t,n){if(n&&"boolean"!=typeof n&&ci(e,t,n)&&(t=n=void 0),void 0===n&&("boolean"==typeof t?(n=t,t=void 0):"boolean"==typeof e&&(n=e,e=void 0)),void 0===e&&void 0===t?(e=0,t=1):(e=ru(e),void 0===t?(t=e,e=0):t=ru(t)),e>t){var r=e;e=t,t=r}if(n||e%1||t%1){var o=dn();return an(e+o*(t-e+Ve("1e-"+((o+"").length-1))),t)}return kr(e,t)},Tn.reduce=function(e,t,n){var r=xs(e)?ht:wt,o=arguments.length<3;return r(e,Xo(t,4),n,o,tr)},Tn.reduceRight=function(e,t,n){var r=xs(e)?mt:wt,o=arguments.length<3;return r(e,Xo(t,4),n,o,nr)},Tn.repeat=function(e,t,n){return t=(n?ci(e,t,n):void 0===t)?1:ou(t),jr(au(e),t)},Tn.replace=function(){var e=arguments,t=au(e[0]);return e.length<3?t:t.replace(e[1],e[2])},Tn.result=function(e,t,n){var r=-1,o=(t=ao(t,e)).length;for(o||(o=1,e=void 0);++r<o;){var i=null==e?void 0:e[Di(t[r])];void 0===i&&(r=o,i=n),e=$s(i)?i.call(e):i}return e},Tn.round=pa,Tn.runInContext=e,Tn.sample=function(e){return(xs(e)?Un:Ur)(e)},Tn.size=function(e){if(null==e)return 0;if(Ps(e))return Zs(e)?Wt(e):e.length;var t=oi(e);return t==h||t==y?e.size:_r(e).length},Tn.snakeCase=ku,Tn.some=function(e,t,n){var r=xs(e)?gt:Gr;return n&&ci(e,t,n)&&(t=void 0),r(e,Xo(t,3))},Tn.sortedIndex=function(e,t){return Kr(e,t)},Tn.sortedIndexBy=function(e,t,n){return Yr(e,t,Xo(n,2))},Tn.sortedIndexOf=function(e,t){var n=null==e?0:e.length;if(n){var r=Kr(e,t);if(r<n&&Fs(e[r],t))return r}return-1},Tn.sortedLastIndex=function(e,t){return Kr(e,t,!0)},Tn.sortedLastIndexBy=function(e,t,n){return Yr(e,t,Xo(n,2),!0)},Tn.sortedLastIndexOf=function(e,t){if(null==e?0:e.length){var n=Kr(e,t,!0)-1;if(Fs(e[n],t))return n}return-1},Tn.startCase=ju,Tn.startsWith=function(e,t,n){return e=au(e),n=null==n?0:Jn(ou(n),0,e.length),t=Xr(t),e.slice(n,n+t.length)==t},Tn.subtract=ha,Tn.sum=function(e){return e&&e.length?Dt(e,Gu):0},Tn.sumBy=function(e,t){return e&&e.length?Dt(e,Xo(t,2)):0},Tn.template=function(e,t,n){var r=Tn.templateSettings;n&&ci(e,t,n)&&(t=void 0),e=au(e),t=du({},t,r,Vo);var o,i,s=du({},t.imports,r.imports,Vo),u=bu(s),a=Nt(s,u),c=0,l=t.interpolate||ce,d="__p += '",f=me((t.escape||ce).source+"|"+l.source+"|"+(l===$?te:ce).source+"|"+(t.evaluate||ce).source+"|$","g"),p="//# sourceURL="+(Se.call(t,"sourceURL")?(t.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++je+"]")+"\n";e.replace(f,(function(t,n,r,s,u,a){return r||(r=s),d+=e.slice(c,a).replace(le,jt),n&&(o=!0,d+="' +\n__e("+n+") +\n'"),u&&(i=!0,d+="';\n"+u+";\n__p += '"),r&&(d+="' +\n((__t = ("+r+")) == null ? '' : __t) +\n'"),c=a+t.length,t})),d+="';\n";var h=Se.call(t,"variable")&&t.variable;if(h){if(Q.test(h))throw new de("Invalid `variable` option passed into `_.template`")}else d="with (obj) {\n"+d+"\n}\n";d=(i?d.replace(R,""):d).replace(I,"$1").replace(x,"$1;"),d="function("+(h||"obj")+") {\n"+(h?"":"obj || (obj = {});\n")+"var __t, __p = ''"+(o?", __e = _.escape":"")+(i?", __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n":";\n")+d+"return __p\n}";var m=Vu((function(){return fe(u,p+"return "+d).apply(void 0,a)}));if(m.source=d,Us(m))throw m;return m},Tn.times=function(e,t){if((e=ou(e))<1||e>9007199254740991)return[];var n=4294967295,r=an(e,4294967295);e-=4294967295;for(var o=Bt(r,t=Xo(t));++n<e;)t(n);return o},Tn.toFinite=ru,Tn.toInteger=ou,Tn.toLength=iu,Tn.toLower=function(e){return au(e).toLowerCase()},Tn.toNumber=su,Tn.toSafeInteger=function(e){return e?Jn(ou(e),-9007199254740991,9007199254740991):0===e?e:0},Tn.toString=au,Tn.toUpper=function(e){return au(e).toUpperCase()},Tn.trim=function(e,t,n){if((e=au(e))&&(n||void 0===t))return Tt(e);if(!e||!(t=Xr(t)))return e;var r=Ht(e),o=Ht(t);return lo(r,It(r,o),xt(r,o)+1).join("")},Tn.trimEnd=function(e,t,n){if((e=au(e))&&(n||void 0===t))return e.slice(0,Gt(e)+1);if(!e||!(t=Xr(t)))return e;var r=Ht(e);return lo(r,0,xt(r,Ht(t))+1).join("")},Tn.trimStart=function(e,t,n){if((e=au(e))&&(n||void 0===t))return e.replace(G,"");if(!e||!(t=Xr(t)))return e;var r=Ht(e);return lo(r,It(r,Ht(t))).join("")},Tn.truncate=function(e,t){var n=30,r="...";if(qs(t)){var o="separator"in t?t.separator:o;n="length"in t?ou(t.length):n,r="omission"in t?Xr(t.omission):r}var i=(e=au(e)).length;if(Lt(e)){var s=Ht(e);i=s.length}if(n>=i)return e;var u=n-Wt(r);if(u<1)return r;var a=s?lo(s,0,u).join(""):e.slice(0,u);if(void 0===o)return a+r;if(s&&(u+=a.length-u),Ys(o)){if(e.slice(u).search(o)){var c,l=a;for(o.global||(o=me(o.source,au(ne.exec(o))+"g")),o.lastIndex=0;c=o.exec(l);)var d=c.index;a=a.slice(0,void 0===d?u:d)}}else if(e.indexOf(Xr(o),u)!=u){var f=a.lastIndexOf(o);f>-1&&(a=a.slice(0,f))}return a+r},Tn.unescape=function(e){return(e=au(e))&&k.test(e)?e.replace(M,Kt):e},Tn.uniqueId=function(e){var t=++Oe;return au(e)+t},Tn.upperCase=Lu,Tn.upperFirst=Uu,Tn.each=as,Tn.eachRight=cs,Tn.first=Pi,Zu(Tn,(da={},cr(Tn,(function(e,t){Se.call(Tn.prototype,t)||(da[t]=e)})),da),{chain:!1}),Tn.VERSION="4.17.21",st(["bind","bindKey","curry","curryRight","partial","partialRight"],(function(e){Tn[e].placeholder=Tn})),st(["drop","take"],(function(e,t){In.prototype[e]=function(n){n=void 0===n?1:un(ou(n),0);var r=this.__filtered__&&!t?new In(this):this.clone();return r.__filtered__?r.__takeCount__=an(n,r.__takeCount__):r.__views__.push({size:an(n,4294967295),type:e+(r.__dir__<0?"Right":"")}),r},In.prototype[e+"Right"]=function(t){return this.reverse()[e](t).reverse()}})),st(["filter","map","takeWhile"],(function(e,t){var n=t+1,r=1==n||3==n;In.prototype[e]=function(e){var t=this.clone();return t.__iteratees__.push({iteratee:Xo(e,3),type:n}),t.__filtered__=t.__filtered__||r,t}})),st(["head","last"],(function(e,t){var n="take"+(t?"Right":"");In.prototype[e]=function(){return this[n](1).value()[0]}})),st(["initial","tail"],(function(e,t){var n="drop"+(t?"":"Right");In.prototype[e]=function(){return this.__filtered__?new In(this):this[n](1)}})),In.prototype.compact=function(){return this.filter(Gu)},In.prototype.find=function(e){return this.filter(e).head()},In.prototype.findLast=function(e){return this.reverse().find(e)},In.prototype.invokeMap=Lr((function(e,t){return"function"==typeof e?new In(this):this.map((function(n){return vr(n,e,t)}))})),In.prototype.reject=function(e){return this.filter(_s(Xo(e)))},In.prototype.slice=function(e,t){e=ou(e);var n=this;return n.__filtered__&&(e>0||t<0)?new In(n):(e<0?n=n.takeRight(-e):e&&(n=n.drop(e)),void 0!==t&&(n=(t=ou(t))<0?n.dropRight(-t):n.take(t-e)),n)},In.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},In.prototype.toArray=function(){return this.take(4294967295)},cr(In.prototype,(function(e,t){var n=/^(?:filter|find|map|reject)|While$/.test(t),r=/^(?:head|last)$/.test(t),o=Tn[r?"take"+("last"==t?"Right":""):t],i=r||/^find/.test(t);o&&(Tn.prototype[t]=function(){var t=this.__wrapped__,s=r?[1]:arguments,u=t instanceof In,a=s[0],c=u||xs(t),l=function(e){var t=o.apply(Tn,pt([e],s));return r&&d?t[0]:t};c&&n&&"function"==typeof a&&1!=a.length&&(u=c=!1);var d=this.__chain__,f=!!this.__actions__.length,p=i&&!d,h=u&&!f;if(!i&&c){t=h?t:new In(this);var m=e.apply(t,s);return m.__actions__.push({func:rs,args:[l],thisArg:void 0}),new Rn(m,d)}return p&&h?e.apply(this,s):(m=this.thru(l),p?r?m.value()[0]:m.value():m)})})),st(["pop","push","shift","sort","splice","unshift"],(function(e){var t=ye[e],n=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",r=/^(?:pop|shift)$/.test(e);Tn.prototype[e]=function(){var e=arguments;if(r&&!this.__chain__){var o=this.value();return t.apply(xs(o)?o:[],e)}return this[n]((function(n){return t.apply(xs(n)?n:[],e)}))}})),cr(In.prototype,(function(e,t){var n=Tn[t];if(n){var r=n.name+"";Se.call(An,r)||(An[r]=[]),An[r].push({name:t,func:n})}})),An[Fo(void 0,2).name]=[{name:"wrapper",func:void 0}],In.prototype.clone=function(){var e=new In(this.__wrapped__);return e.__actions__=vo(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=vo(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=vo(this.__views__),e},In.prototype.reverse=function(){if(this.__filtered__){var e=new In(this);e.__dir__=-1,e.__filtered__=!0}else(e=this.clone()).__dir__*=-1;return e},In.prototype.value=function(){var e=this.__wrapped__.value(),t=this.__dir__,n=xs(e),r=t<0,o=n?e.length:0,i=function(e,t,n){var r=-1,o=n.length;for(;++r<o;){var i=n[r],s=i.size;switch(i.type){case"drop":e+=s;break;case"dropRight":t-=s;break;case"take":t=an(t,e+s);break;case"takeRight":e=un(e,t-s)}}return{start:e,end:t}}(0,o,this.__views__),s=i.start,u=i.end,a=u-s,c=r?u:s-1,l=this.__iteratees__,d=l.length,f=0,p=an(a,this.__takeCount__);if(!n||!r&&o==a&&p==a)return ro(e,this.__actions__);var h=[];e:for(;a--&&f<p;){for(var m=-1,g=e[c+=t];++m<d;){var E=l[m],y=E.iteratee,v=E.type,A=y(g);if(2==v)g=A;else if(!A){if(1==v)continue e;break e}}h[f++]=g}return h},Tn.prototype.at=os,Tn.prototype.chain=function(){return ns(this)},Tn.prototype.commit=function(){return new Rn(this.value(),this.__chain__)},Tn.prototype.next=function(){void 0===this.__values__&&(this.__values__=nu(this.value()));var e=this.__index__>=this.__values__.length;return{done:e,value:e?void 0:this.__values__[this.__index__++]}},Tn.prototype.plant=function(e){for(var t,n=this;n instanceof Nn;){var r=Ti(n);r.__index__=0,r.__values__=void 0,t?o.__wrapped__=r:t=r;var o=r;n=n.__wrapped__}return o.__wrapped__=e,t},Tn.prototype.reverse=function(){var e=this.__wrapped__;if(e instanceof In){var t=e;return this.__actions__.length&&(t=new In(this)),(t=t.reverse()).__actions__.push({func:rs,args:[qi],thisArg:void 0}),new Rn(t,this.__chain__)}return this.thru(qi)},Tn.prototype.toJSON=Tn.prototype.valueOf=Tn.prototype.value=function(){return ro(this.__wrapped__,this.__actions__)},Tn.prototype.first=Tn.prototype.head,Ze&&(Tn.prototype[Ze]=function(){return this}),Tn}();He._=Yt,void 0===(r=function(){return Yt}.call(t,n,t,e))||(e.exports=r)}).call(this)}).call(this,n(45)(e))},function(e,t,n){var r=n(26),o=n(215),i=n(216),s=r?r.toStringTag:void 0;e.exports=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":s&&s in Object(e)?o(e):i(e)}},function(e,t){e.exports=require("crypto")},function(e,t){e.exports=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}},function(e,t,n){var r=n(214),o=n(219);e.exports=function(e,t){var n=o(e,t);return r(n)?n:void 0}},function(e,t){e.exports=require("timers")},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.assertUninitialized=t.AbstractCursor=t.CURSOR_FLAGS=void 0;const r=n(25),o=n(4),i=n(1),s=n(9),u=n(14),a=n(376),c=n(11),l=n(6),d=n(99),f=n(2),p=Symbol("id"),h=Symbol("documents"),m=Symbol("server"),g=Symbol("namespace"),E=Symbol("client"),y=Symbol("session"),v=Symbol("options"),A=Symbol("transform"),b=Symbol("initialized"),C=Symbol("closed"),S=Symbol("killed"),O=Symbol("kInit");t.CURSOR_FLAGS=["tailable","oplogReplay","noCursorTimeout","awaitData","exhaust","partial"];class _ extends s.TypedEventEmitter{constructor(e,t,n={}){if(super(),!e.s.isMongoClient)throw new i.MongoRuntimeError("Cursor must be constructed with MongoClient");this[E]=e,this[g]=t,this[h]=[],this[b]=!1,this[C]=!1,this[S]=!1,this[v]={readPreference:n.readPreference&&n.readPreference instanceof l.ReadPreference?n.readPreference:l.ReadPreference.primary,...(0,o.pluckBSONSerializeOptions)(n)};const r=c.ReadConcern.fromOptions(n);r&&(this[v].readConcern=r),"number"==typeof n.batchSize&&(this[v].batchSize=n.batchSize),void 0!==n.comment&&(this[v].comment=n.comment),"number"==typeof n.maxTimeMS&&(this[v].maxTimeMS=n.maxTimeMS),n.session instanceof d.ClientSession&&(this[y]=n.session)}get id(){return this[p]}get client(){return this[E]}get server(){return this[m]}get namespace(){return this[g]}get readPreference(){return this[v].readPreference}get readConcern(){return this[v].readConcern}get session(){return this[y]}set session(e){this[y]=e}get cursorOptions(){return this[v]}get closed(){return this[C]}get killed(){return this[S]}get loadBalanced(){var e;return!!(null===(e=this[E].topology)||void 0===e?void 0:e.loadBalanced)}bufferedCount(){return this[h].length}readBufferedDocuments(e){return this[h].splice(0,null!=e?e:this[h].length)}[Symbol.asyncIterator](){return{next:()=>this.next().then(e=>null!=e?{value:e,done:!1}:{value:void 0,done:!0})}}stream(e){if(null==e?void 0:e.transform){const t=e.transform;return N(this).pipe(new r.Transform({objectMode:!0,highWaterMark:1,transform(e,n,r){try{r(void 0,t(e))}catch(e){r(e)}}}))}return N(this)}hasNext(e){return(0,f.maybePromise)(e,e=>this[p]===o.Long.ZERO?e(void 0,!1):this[h].length?e(void 0,!0):void D(this,!0,(t,n)=>t?e(t):n?(this[h].unshift(n),void e(void 0,!0)):void e(void 0,!1)))}next(e){return(0,f.maybePromise)(e,e=>{if(this[p]===o.Long.ZERO)return e(new i.MongoCursorExhaustedError);D(this,!0,e)})}tryNext(e){return(0,f.maybePromise)(e,e=>{if(this[p]===o.Long.ZERO)return e(new i.MongoCursorExhaustedError);D(this,!1,e)})}forEach(e,t){if("function"!=typeof e)throw new i.MongoInvalidArgumentError('Argument "iterator" must be a function');return(0,f.maybePromise)(t,t=>{const n=this[A],r=()=>{D(this,!0,(o,i)=>{if(o||null==i)return t(o);let s;try{s=e(i)}catch(e){return t(e)}if(!1===s)return t();const u=this[h].splice(0,this[h].length);for(let r=0;r<u.length;++r){try{s=e(n?n(u[r]):u[r])}catch(e){return t(e)}if(!1===s)return t()}r()})};r()})}close(e,t){"function"==typeof e&&(t=e,e={}),e=null!=e?e:{};const n=!this[C];return this[C]=!0,(0,f.maybePromise)(t,e=>T(this,{needsToEmitClosed:n},e))}toArray(e){return(0,f.maybePromise)(e,e=>{const t=[],n=this[A],r=()=>{D(this,!0,(o,i)=>{if(o)return e(o);if(null==i)return e(void 0,t);t.push(i);const s=n?this[h].splice(0,this[h].length).map(n):this[h].splice(0,this[h].length);s&&t.push(...s),r()})};r()})}addCursorFlag(e,n){if(F(this),!t.CURSOR_FLAGS.includes(e))throw new i.MongoInvalidArgumentError(`Flag ${e} is not one of ${t.CURSOR_FLAGS}`);if("boolean"!=typeof n)throw new i.MongoInvalidArgumentError(`Flag ${e} must be a boolean value`);return this[v][e]=n,this}map(e){F(this);const t=this[A];return this[A]=t?n=>e(t(n)):e,this}withReadPreference(e){if(F(this),e instanceof l.ReadPreference)this[v].readPreference=e;else{if("string"!=typeof e)throw new i.MongoInvalidArgumentError(`Invalid read preference: ${e}`);this[v].readPreference=l.ReadPreference.fromString(e)}return this}withReadConcern(e){F(this);const t=c.ReadConcern.fromOptions({readConcern:e});return t&&(this[v].readConcern=t),this}maxTimeMS(e){if(F(this),"number"!=typeof e)throw new i.MongoInvalidArgumentError("Argument for maxTimeMS must be a number");return this[v].maxTimeMS=e,this}batchSize(e){if(F(this),this[v].tailable)throw new i.MongoTailableCursorError("Tailable cursor does not support batchSize");if("number"!=typeof e)throw new i.MongoInvalidArgumentError('Operation "batchSize" requires an integer');return this[v].batchSize=e,this}rewind(){if(!this[b])return;this[p]=void 0,this[h]=[],this[C]=!1,this[S]=!1,this[b]=!1;const e=this[y];e&&(!1!==e.explicit||e.hasEnded||e.endSession(),this[y]=void 0)}_getMore(e,t){const n=this[p],r=this[g],o=this[m];if(null==n)return void t(new i.MongoRuntimeError("Unable to iterate cursor with no id"));if(null==o)return void t(new i.MongoRuntimeError("Unable to iterate cursor without selected server"));const s=new a.GetMoreOperation(r,n,o,{...this[v],session:this[y],batchSize:e});(0,u.executeOperation)(this[E],s,t)}[O](e){var t,n,r,i;if(null==this[y]){if(null===(t=this[E].topology)||void 0===t?void 0:t.shouldCheckForSessionSupport())return null===(n=this[E].topology)||void 0===n?void 0:n.selectServer(l.ReadPreference.primaryPreferred,{},t=>t?e(t):this[O](e));(null===(r=this[E].topology)||void 0===r?void 0:r.hasSessionSupport())&&(this[y]=null===(i=this[E].topology)||void 0===i?void 0:i.startSession({owner:this,explicit:!1}))}this._initialize(this[y],(t,n)=>{if(n){const e=n.response;this[m]=n.server,this[y]=n.session,e.cursor&&(this[p]="number"==typeof e.cursor.id?o.Long.fromNumber(e.cursor.id):e.cursor.id,e.cursor.ns&&(this[g]=(0,f.ns)(e.cursor.ns)),this[h]=e.cursor.firstBatch),null==this[p]&&(this[p]=o.Long.ZERO,this[h]=[n.response])}if(this[b]=!0,t||B(this))return T(this,{error:t},()=>e(t,w(this)));e()})}}function w(e){if(null==e[h]||!e[h].length)return null;const t=e[h].shift();if(t){const n=e[A];return n?n(t):t}return null}function D(e,t,n){const r=e[p];if(e.closed)return n(void 0,null);if(e[h]&&e[h].length)return void n(void 0,w(e));if(null==r)return void e[O]((r,o)=>r?n(r):o?n(void 0,o):D(e,t,n));if(B(e))return T(e,void 0,()=>n(void 0,null));const i=e[v].batchSize||1e3;e._getMore(i,(r,i)=>{if(i){const t="number"==typeof i.cursor.id?o.Long.fromNumber(i.cursor.id):i.cursor.id;e[h]=i.cursor.nextBatch,e[p]=t}return r||B(e)?T(e,{error:r},()=>n(r,w(e))):0===e[h].length&&!1===t?n(void 0,null):void D(e,t,n)})}function B(e){const t=e[p];return!!t&&t.isZero()}function T(e,t,n){var r;const s=e[p],u=e[g],a=e[m],c=e[y],l=null==t?void 0:t.error,f=null!==(r=null==t?void 0:t.needsToEmitClosed)&&void 0!==r?r:0===e[h].length;if(l&&e.loadBalanced&&l instanceof i.MongoNetworkError)return E();if(null==s||null==a||s.isZero()||null==u){if(f&&(e[C]=!0,e[p]=o.Long.ZERO,e.emit(_.CLOSE)),c){if(c.owner===e)return c.endSession({error:l},n);c.inTransaction()||(0,d.maybeClearPinnedConnection)(c,{error:l})}return n()}function E(){if(c){if(c.owner===e)return c.endSession({error:l},()=>{e.emit(_.CLOSE),n()});c.inTransaction()||(0,d.maybeClearPinnedConnection)(c,{error:l})}return e.emit(_.CLOSE),n()}e[S]=!0,a.killCursors(u,[s],{...(0,o.pluckBSONSerializeOptions)(e[v]),session:c},()=>E())}function F(e){if(e[b])throw new i.MongoCursorInUseError}function N(e){const t=new r.Readable({objectMode:!0,autoDestroy:!1,highWaterMark:1});let n=!1,o=!1,i=!0;return t._read=function(){!1===n&&(i=!1,n=!0),o||(o=!0,function n(){i=!1,D(e,!0,(r,s)=>{if(i=r?!e.closed:null!=s,r)return r.message.match(/server is closed/)?(e.close(),t.push(null)):r.message.match(/interrupted/)?t.push(null):t.destroy(r);if(null==s)t.push(null);else if(t.destroyed)e.close();else{if(t.push(s))return n();o=!1}})}())},t._destroy=function(t,n){i?e.close(e=>process.nextTick(n,e||t)):n(t)},t}t.AbstractCursor=_,_.CLOSE="close",t.assertUninitialized=F},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Logger=t.LoggerLevel=void 0;const r=n(377),o=n(1),i=n(2),s={};let u,a={};const c=process.pid;let l=console.warn;t.LoggerLevel=Object.freeze({ERROR:"error",WARN:"warn",INFO:"info",DEBUG:"debug",error:"error",warn:"warn",info:"info",debug:"debug"});class d{constructor(e,n){n=null!=n?n:{},this.className=e,n.logger instanceof d||"function"!=typeof n.logger||(l=n.logger),n.loggerLevel&&(u=n.loggerLevel||t.LoggerLevel.ERROR),null==a[this.className]&&(s[this.className]=!0)}debug(e,n){if(this.isDebug()&&(Object.keys(a).length>0&&a[this.className]||0===Object.keys(a).length&&s[this.className])){const o=(new Date).getTime(),i=(0,r.format)("[%s-%s:%s] %s %s","DEBUG",this.className,c,o,e),s={type:t.LoggerLevel.DEBUG,message:e,className:this.className,pid:c,date:o};n&&(s.meta=n),l(i,s)}}warn(e,n){if(this.isWarn()&&(Object.keys(a).length>0&&a[this.className]||0===Object.keys(a).length&&s[this.className])){const o=(new Date).getTime(),i=(0,r.format)("[%s-%s:%s] %s %s","WARN",this.className,c,o,e),s={type:t.LoggerLevel.WARN,message:e,className:this.className,pid:c,date:o};n&&(s.meta=n),l(i,s)}}info(e,n){if(this.isInfo()&&(Object.keys(a).length>0&&a[this.className]||0===Object.keys(a).length&&s[this.className])){const o=(new Date).getTime(),i=(0,r.format)("[%s-%s:%s] %s %s","INFO",this.className,c,o,e),s={type:t.LoggerLevel.INFO,message:e,className:this.className,pid:c,date:o};n&&(s.meta=n),l(i,s)}}error(e,n){if(this.isError()&&(Object.keys(a).length>0&&a[this.className]||0===Object.keys(a).length&&s[this.className])){const o=(new Date).getTime(),i=(0,r.format)("[%s-%s:%s] %s %s","ERROR",this.className,c,o,e),s={type:t.LoggerLevel.ERROR,message:e,className:this.className,pid:c,date:o};n&&(s.meta=n),l(i,s)}}isInfo(){return u===t.LoggerLevel.INFO||u===t.LoggerLevel.DEBUG}isError(){return u===t.LoggerLevel.ERROR||u===t.LoggerLevel.INFO||u===t.LoggerLevel.DEBUG}isWarn(){return u===t.LoggerLevel.ERROR||u===t.LoggerLevel.WARN||u===t.LoggerLevel.INFO||u===t.LoggerLevel.DEBUG}isDebug(){return u===t.LoggerLevel.DEBUG}static reset(){u=t.LoggerLevel.ERROR,a={}}static currentLogger(){return l}static setCurrentLogger(e){if("function"!=typeof e)throw new o.MongoInvalidArgumentError("Current logger must be a function");l=e}static filter(e,t){"class"===e&&Array.isArray(t)&&(a={},t.forEach(e=>a[e]=!0))}static setLevel(e){if(e!==t.LoggerLevel.INFO&&e!==t.LoggerLevel.ERROR&&e!==t.LoggerLevel.DEBUG&&e!==t.LoggerLevel.WARN)throw new o.MongoInvalidArgumentError(`Argument "newLevel" should be one of ${(0,i.enumToString)(t.LoggerLevel)}`);u=e}}t.Logger=d},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AuthProvider=t.AuthContext=void 0;const r=n(1);t.AuthContext=class{constructor(e,t,n){this.connection=e,this.credentials=t,this.options=n}};t.AuthProvider=class{prepare(e,t,n){n(void 0,e)}auth(e,t){t(new r.MongoRuntimeError("`auth` method must be overridden by subclass"))}}},function(e,t){e.exports=require("stream")},function(e,t,n){var r=n(15).Symbol;e.exports=r},function(e,t){e.exports=function(e){return function(t){return e(t)}}},function(e,t,n){var r=n(118),o=n(76);e.exports=function(e){return null!=e&&o(e.length)&&!r(e)}},function(e,t,n){var r=n(7),o=n(83),i=n(264),s=n(30);e.exports=function(e,t){return r(e)?e:o(e,t)?[e]:i(s(e))}},function(e,t,n){var r=n(267);e.exports=function(e){return null==e?"":r(e)}},function(e,t,n){var r=n(54);e.exports=function(e){if("string"==typeof e||r(e))return e;var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AggregationCursor=t.Admin=t.AbstractCursor=t.MongoWriteConcernError=t.MongoUnexpectedServerResponseError=t.MongoTransactionError=t.MongoTopologyClosedError=t.MongoTailableCursorError=t.MongoSystemError=t.MongoServerSelectionError=t.MongoServerError=t.MongoServerClosedError=t.MongoRuntimeError=t.MongoParseError=t.MongoNotConnectedError=t.MongoNetworkTimeoutError=t.MongoNetworkError=t.MongoMissingDependencyError=t.MongoMissingCredentialsError=t.MongoKerberosError=t.MongoInvalidArgumentError=t.MongoGridFSStreamError=t.MongoGridFSChunkError=t.MongoExpiredSessionError=t.MongoError=t.MongoDriverError=t.MongoDecompressionError=t.MongoCursorInUseError=t.MongoCursorExhaustedError=t.MongoCompatibilityError=t.MongoChangeStreamError=t.MongoBatchReExecutionError=t.MongoAWSError=t.MongoAPIError=t.MongoBulkWriteError=t.ObjectID=t.Timestamp=t.ObjectId=t.MinKey=t.MaxKey=t.Map=t.Long=t.Int32=t.Double=t.Decimal128=t.DBRef=t.Code=t.BSONSymbol=t.BSONRegExp=t.Binary=void 0,t.ServerOpeningEvent=t.ServerHeartbeatSucceededEvent=t.ServerHeartbeatStartedEvent=t.ServerHeartbeatFailedEvent=t.ServerDescriptionChangedEvent=t.ServerClosedEvent=t.ConnectionReadyEvent=t.ConnectionPoolMonitoringEvent=t.ConnectionPoolCreatedEvent=t.ConnectionPoolClosedEvent=t.ConnectionPoolClearedEvent=t.ConnectionCreatedEvent=t.ConnectionClosedEvent=t.ConnectionCheckOutStartedEvent=t.ConnectionCheckOutFailedEvent=t.ConnectionCheckedOutEvent=t.ConnectionCheckedInEvent=t.CommandSucceededEvent=t.CommandStartedEvent=t.CommandFailedEvent=t.WriteConcern=t.ReadPreference=t.ReadConcern=t.TopologyType=t.ServerType=t.ReadPreferenceMode=t.ReadConcernLevel=t.ProfilingLevel=t.ReturnDocument=t.BSONType=t.ServerApiVersion=t.LoggerLevel=t.ExplainVerbosity=t.MongoErrorLabel=t.AutoEncryptionLoggerLevel=t.CURSOR_FLAGS=t.Compressor=t.AuthMechanism=t.GSSAPICanonicalizationValue=t.BatchType=t.Promise=t.MongoClient=t.Logger=t.ListIndexesCursor=t.ListCollectionsCursor=t.GridFSBucket=t.FindCursor=t.Db=t.Collection=t.CancellationToken=void 0,t.SrvPollingEvent=t.TopologyOpeningEvent=t.TopologyDescriptionChangedEvent=t.TopologyClosedEvent=void 0;const r=n(155);Object.defineProperty(t,"Admin",{enumerable:!0,get:function(){return r.Admin}});const o=n(4),i=n(34);Object.defineProperty(t,"Collection",{enumerable:!0,get:function(){return i.Collection}});const s=n(22);Object.defineProperty(t,"AbstractCursor",{enumerable:!0,get:function(){return s.AbstractCursor}});const u=n(101);Object.defineProperty(t,"AggregationCursor",{enumerable:!0,get:function(){return u.AggregationCursor}});const a=n(192);Object.defineProperty(t,"FindCursor",{enumerable:!0,get:function(){return a.FindCursor}});const c=n(100);Object.defineProperty(t,"Db",{enumerable:!0,get:function(){return c.Db}});const l=n(437);Object.defineProperty(t,"GridFSBucket",{enumerable:!0,get:function(){return l.GridFSBucket}});const d=n(23);Object.defineProperty(t,"Logger",{enumerable:!0,get:function(){return d.Logger}});const f=n(43);Object.defineProperty(t,"MongoClient",{enumerable:!0,get:function(){return f.MongoClient}});const p=n(9);Object.defineProperty(t,"CancellationToken",{enumerable:!0,get:function(){return p.CancellationToken}});const h=n(63);Object.defineProperty(t,"ListIndexesCursor",{enumerable:!0,get:function(){return h.ListIndexesCursor}});const m=n(171);Object.defineProperty(t,"ListCollectionsCursor",{enumerable:!0,get:function(){return m.ListCollectionsCursor}});const g=n(33);Object.defineProperty(t,"Promise",{enumerable:!0,get:function(){return g.PromiseProvider}});var E=n(4);Object.defineProperty(t,"Binary",{enumerable:!0,get:function(){return E.Binary}}),Object.defineProperty(t,"BSONRegExp",{enumerable:!0,get:function(){return E.BSONRegExp}}),Object.defineProperty(t,"BSONSymbol",{enumerable:!0,get:function(){return E.BSONSymbol}}),Object.defineProperty(t,"Code",{enumerable:!0,get:function(){return E.Code}}),Object.defineProperty(t,"DBRef",{enumerable:!0,get:function(){return E.DBRef}}),Object.defineProperty(t,"Decimal128",{enumerable:!0,get:function(){return E.Decimal128}}),Object.defineProperty(t,"Double",{enumerable:!0,get:function(){return E.Double}}),Object.defineProperty(t,"Int32",{enumerable:!0,get:function(){return E.Int32}}),Object.defineProperty(t,"Long",{enumerable:!0,get:function(){return E.Long}}),Object.defineProperty(t,"Map",{enumerable:!0,get:function(){return E.Map}}),Object.defineProperty(t,"MaxKey",{enumerable:!0,get:function(){return E.MaxKey}}),Object.defineProperty(t,"MinKey",{enumerable:!0,get:function(){return E.MinKey}}),Object.defineProperty(t,"ObjectId",{enumerable:!0,get:function(){return E.ObjectId}}),Object.defineProperty(t,"Timestamp",{enumerable:!0,get:function(){return E.Timestamp}}),t.ObjectID=o.ObjectId;var y=n(61);Object.defineProperty(t,"MongoBulkWriteError",{enumerable:!0,get:function(){return y.MongoBulkWriteError}});var v=n(1);Object.defineProperty(t,"MongoAPIError",{enumerable:!0,get:function(){return v.MongoAPIError}}),Object.defineProperty(t,"MongoAWSError",{enumerable:!0,get:function(){return v.MongoAWSError}}),Object.defineProperty(t,"MongoBatchReExecutionError",{enumerable:!0,get:function(){return v.MongoBatchReExecutionError}}),Object.defineProperty(t,"MongoChangeStreamError",{enumerable:!0,get:function(){return v.MongoChangeStreamError}}),Object.defineProperty(t,"MongoCompatibilityError",{enumerable:!0,get:function(){return v.MongoCompatibilityError}}),Object.defineProperty(t,"MongoCursorExhaustedError",{enumerable:!0,get:function(){return v.MongoCursorExhaustedError}}),Object.defineProperty(t,"MongoCursorInUseError",{enumerable:!0,get:function(){return v.MongoCursorInUseError}}),Object.defineProperty(t,"MongoDecompressionError",{enumerable:!0,get:function(){return v.MongoDecompressionError}}),Object.defineProperty(t,"MongoDriverError",{enumerable:!0,get:function(){return v.MongoDriverError}}),Object.defineProperty(t,"MongoError",{enumerable:!0,get:function(){return v.MongoError}}),Object.defineProperty(t,"MongoExpiredSessionError",{enumerable:!0,get:function(){return v.MongoExpiredSessionError}}),Object.defineProperty(t,"MongoGridFSChunkError",{enumerable:!0,get:function(){return v.MongoGridFSChunkError}}),Object.defineProperty(t,"MongoGridFSStreamError",{enumerable:!0,get:function(){return v.MongoGridFSStreamError}}),Object.defineProperty(t,"MongoInvalidArgumentError",{enumerable:!0,get:function(){return v.MongoInvalidArgumentError}}),Object.defineProperty(t,"MongoKerberosError",{enumerable:!0,get:function(){return v.MongoKerberosError}}),Object.defineProperty(t,"MongoMissingCredentialsError",{enumerable:!0,get:function(){return v.MongoMissingCredentialsError}}),Object.defineProperty(t,"MongoMissingDependencyError",{enumerable:!0,get:function(){return v.MongoMissingDependencyError}}),Object.defineProperty(t,"MongoNetworkError",{enumerable:!0,get:function(){return v.MongoNetworkError}}),Object.defineProperty(t,"MongoNetworkTimeoutError",{enumerable:!0,get:function(){return v.MongoNetworkTimeoutError}}),Object.defineProperty(t,"MongoNotConnectedError",{enumerable:!0,get:function(){return v.MongoNotConnectedError}}),Object.defineProperty(t,"MongoParseError",{enumerable:!0,get:function(){return v.MongoParseError}}),Object.defineProperty(t,"MongoRuntimeError",{enumerable:!0,get:function(){return v.MongoRuntimeError}}),Object.defineProperty(t,"MongoServerClosedError",{enumerable:!0,get:function(){return v.MongoServerClosedError}}),Object.defineProperty(t,"MongoServerError",{enumerable:!0,get:function(){return v.MongoServerError}}),Object.defineProperty(t,"MongoServerSelectionError",{enumerable:!0,get:function(){return v.MongoServerSelectionError}}),Object.defineProperty(t,"MongoSystemError",{enumerable:!0,get:function(){return v.MongoSystemError}}),Object.defineProperty(t,"MongoTailableCursorError",{enumerable:!0,get:function(){return v.MongoTailableCursorError}}),Object.defineProperty(t,"MongoTopologyClosedError",{enumerable:!0,get:function(){return v.MongoTopologyClosedError}}),Object.defineProperty(t,"MongoTransactionError",{enumerable:!0,get:function(){return v.MongoTransactionError}}),Object.defineProperty(t,"MongoUnexpectedServerResponseError",{enumerable:!0,get:function(){return v.MongoUnexpectedServerResponseError}}),Object.defineProperty(t,"MongoWriteConcernError",{enumerable:!0,get:function(){return v.MongoWriteConcernError}});var A=n(61);Object.defineProperty(t,"BatchType",{enumerable:!0,get:function(){return A.BatchType}});var b=n(109);Object.defineProperty(t,"GSSAPICanonicalizationValue",{enumerable:!0,get:function(){return b.GSSAPICanonicalizationValue}});var C=n(35);Object.defineProperty(t,"AuthMechanism",{enumerable:!0,get:function(){return C.AuthMechanism}});var S=n(111);Object.defineProperty(t,"Compressor",{enumerable:!0,get:function(){return S.Compressor}});var O=n(22);Object.defineProperty(t,"CURSOR_FLAGS",{enumerable:!0,get:function(){return O.CURSOR_FLAGS}});var _=n(44);Object.defineProperty(t,"AutoEncryptionLoggerLevel",{enumerable:!0,get:function(){return _.AutoEncryptionLoggerLevel}});var w=n(1);Object.defineProperty(t,"MongoErrorLabel",{enumerable:!0,get:function(){return w.MongoErrorLabel}});var D=n(159);Object.defineProperty(t,"ExplainVerbosity",{enumerable:!0,get:function(){return D.ExplainVerbosity}});var B=n(23);Object.defineProperty(t,"LoggerLevel",{enumerable:!0,get:function(){return B.LoggerLevel}});var T=n(43);Object.defineProperty(t,"ServerApiVersion",{enumerable:!0,get:function(){return T.ServerApiVersion}});var F=n(9);Object.defineProperty(t,"BSONType",{enumerable:!0,get:function(){return F.BSONType}});var N=n(194);Object.defineProperty(t,"ReturnDocument",{enumerable:!0,get:function(){return N.ReturnDocument}});var R=n(173);Object.defineProperty(t,"ProfilingLevel",{enumerable:!0,get:function(){return R.ProfilingLevel}});var I=n(11);Object.defineProperty(t,"ReadConcernLevel",{enumerable:!0,get:function(){return I.ReadConcernLevel}});var x=n(6);Object.defineProperty(t,"ReadPreferenceMode",{enumerable:!0,get:function(){return x.ReadPreferenceMode}});var M=n(12);Object.defineProperty(t,"ServerType",{enumerable:!0,get:function(){return M.ServerType}}),Object.defineProperty(t,"TopologyType",{enumerable:!0,get:function(){return M.TopologyType}});var P=n(11);Object.defineProperty(t,"ReadConcern",{enumerable:!0,get:function(){return P.ReadConcern}});var k=n(6);Object.defineProperty(t,"ReadPreference",{enumerable:!0,get:function(){return k.ReadPreference}});var j=n(13);Object.defineProperty(t,"WriteConcern",{enumerable:!0,get:function(){return j.WriteConcern}});var L=n(188);Object.defineProperty(t,"CommandFailedEvent",{enumerable:!0,get:function(){return L.CommandFailedEvent}}),Object.defineProperty(t,"CommandStartedEvent",{enumerable:!0,get:function(){return L.CommandStartedEvent}}),Object.defineProperty(t,"CommandSucceededEvent",{enumerable:!0,get:function(){return L.CommandSucceededEvent}});var U=n(190);Object.defineProperty(t,"ConnectionCheckedInEvent",{enumerable:!0,get:function(){return U.ConnectionCheckedInEvent}}),Object.defineProperty(t,"ConnectionCheckedOutEvent",{enumerable:!0,get:function(){return U.ConnectionCheckedOutEvent}}),Object.defineProperty(t,"ConnectionCheckOutFailedEvent",{enumerable:!0,get:function(){return U.ConnectionCheckOutFailedEvent}}),Object.defineProperty(t,"ConnectionCheckOutStartedEvent",{enumerable:!0,get:function(){return U.ConnectionCheckOutStartedEvent}}),Object.defineProperty(t,"ConnectionClosedEvent",{enumerable:!0,get:function(){return U.ConnectionClosedEvent}}),Object.defineProperty(t,"ConnectionCreatedEvent",{enumerable:!0,get:function(){return U.ConnectionCreatedEvent}}),Object.defineProperty(t,"ConnectionPoolClearedEvent",{enumerable:!0,get:function(){return U.ConnectionPoolClearedEvent}}),Object.defineProperty(t,"ConnectionPoolClosedEvent",{enumerable:!0,get:function(){return U.ConnectionPoolClosedEvent}}),Object.defineProperty(t,"ConnectionPoolCreatedEvent",{enumerable:!0,get:function(){return U.ConnectionPoolCreatedEvent}}),Object.defineProperty(t,"ConnectionPoolMonitoringEvent",{enumerable:!0,get:function(){return U.ConnectionPoolMonitoringEvent}}),Object.defineProperty(t,"ConnectionReadyEvent",{enumerable:!0,get:function(){return U.ConnectionReadyEvent}});var $=n(113);Object.defineProperty(t,"ServerClosedEvent",{enumerable:!0,get:function(){return $.ServerClosedEvent}}),Object.defineProperty(t,"ServerDescriptionChangedEvent",{enumerable:!0,get:function(){return $.ServerDescriptionChangedEvent}}),Object.defineProperty(t,"ServerHeartbeatFailedEvent",{enumerable:!0,get:function(){return $.ServerHeartbeatFailedEvent}}),Object.defineProperty(t,"ServerHeartbeatStartedEvent",{enumerable:!0,get:function(){return $.ServerHeartbeatStartedEvent}}),Object.defineProperty(t,"ServerHeartbeatSucceededEvent",{enumerable:!0,get:function(){return $.ServerHeartbeatSucceededEvent}}),Object.defineProperty(t,"ServerOpeningEvent",{enumerable:!0,get:function(){return $.ServerOpeningEvent}}),Object.defineProperty(t,"TopologyClosedEvent",{enumerable:!0,get:function(){return $.TopologyClosedEvent}}),Object.defineProperty(t,"TopologyDescriptionChangedEvent",{enumerable:!0,get:function(){return $.TopologyDescriptionChangedEvent}}),Object.defineProperty(t,"TopologyOpeningEvent",{enumerable:!0,get:function(){return $.TopologyOpeningEvent}});var V=n(191);Object.defineProperty(t,"SrvPollingEvent",{enumerable:!0,get:function(){return V.SrvPollingEvent}})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.PromiseProvider=void 0;const r=n(1),o=Symbol("promise"),i={[o]:void 0};class s{static validate(e){if("function"!=typeof e)throw new r.MongoInvalidArgumentError(`Promise must be a function, got ${e}`);return!!e}static set(e){s.validate(e)&&(i[o]=e)}static get(){return i[o]}}t.PromiseProvider=s,s.set(global.Promise)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Collection=void 0;const r=n(4),o=n(374),i=n(375),s=n(96),u=n(101),a=n(192),c=n(1),l=n(163),d=n(193),f=n(431),p=n(161),h=n(432),m=n(170),g=n(433),E=n(14),y=n(194),v=n(63),A=n(162),b=n(434),C=n(435),S=n(436),O=n(172),_=n(174),w=n(165),D=n(11),B=n(6),T=n(2),F=n(13);t.Collection=class{constructor(e,t,n){var o,i;(0,T.checkCollectionName)(t),this.s={db:e,options:n,namespace:new T.MongoDBNamespace(e.databaseName,t),pkFactory:null!==(i=null===(o=e.options)||void 0===o?void 0:o.pkFactory)&&void 0!==i?i:T.DEFAULT_PK_FACTORY,readPreference:B.ReadPreference.fromOptions(n),bsonOptions:(0,r.resolveBSONOptions)(n,e),readConcern:D.ReadConcern.fromOptions(n),writeConcern:F.WriteConcern.fromOptions(n)}}get dbName(){return this.s.namespace.db}get collectionName(){return this.s.namespace.collection}get namespace(){return this.s.namespace.toString()}get readConcern(){return null==this.s.readConcern?this.s.db.readConcern:this.s.readConcern}get readPreference(){return null==this.s.readPreference?this.s.db.readPreference:this.s.readPreference}get bsonOptions(){return this.s.bsonOptions}get writeConcern(){return null==this.s.writeConcern?this.s.db.writeConcern:this.s.writeConcern}get hint(){return this.s.collectionHint}set hint(e){this.s.collectionHint=(0,T.normalizeHintField)(e)}insertOne(e,t,n){return"function"==typeof t&&(n=t,t={}),t&&Reflect.get(t,"w")&&(t.writeConcern=F.WriteConcern.fromOptions(Reflect.get(t,"w"))),(0,E.executeOperation)(this.s.db.s.client,new A.InsertOneOperation(this,e,(0,T.resolveOptions)(this,t)),n)}insertMany(e,t,n){return"function"==typeof t&&(n=t,t={}),t=t?Object.assign({},t):{ordered:!0},(0,E.executeOperation)(this.s.db.s.client,new A.InsertManyOperation(this,e,(0,T.resolveOptions)(this,t)),n)}bulkWrite(e,t,n){if("function"==typeof t&&(n=t,t={}),t=t||{ordered:!0},!Array.isArray(e))throw new c.MongoInvalidArgumentError('Argument "operations" must be an array of documents');return(0,E.executeOperation)(this.s.db.s.client,new l.BulkWriteOperation(this,e,(0,T.resolveOptions)(this,t)),n)}updateOne(e,t,n,r){return"function"==typeof n&&(r=n,n={}),(0,E.executeOperation)(this.s.db.s.client,new w.UpdateOneOperation(this,e,t,(0,T.resolveOptions)(this,n)),r)}replaceOne(e,t,n,r){return"function"==typeof n&&(r=n,n={}),(0,E.executeOperation)(this.s.db.s.client,new w.ReplaceOneOperation(this,e,t,(0,T.resolveOptions)(this,n)),r)}updateMany(e,t,n,r){return"function"==typeof n&&(r=n,n={}),(0,E.executeOperation)(this.s.db.s.client,new w.UpdateManyOperation(this,e,t,(0,T.resolveOptions)(this,n)),r)}deleteOne(e,t,n){return"function"==typeof t&&(n=t,t={}),(0,E.executeOperation)(this.s.db.s.client,new p.DeleteOneOperation(this,e,(0,T.resolveOptions)(this,t)),n)}deleteMany(e,t,n){return null==e?(e={},t={},n=void 0):"function"==typeof e?(n=e,e={},t={}):"function"==typeof t&&(n=t,t={}),(0,E.executeOperation)(this.s.db.s.client,new p.DeleteManyOperation(this,e,(0,T.resolveOptions)(this,t)),n)}rename(e,t,n){return"function"==typeof t&&(n=t,t={}),(0,E.executeOperation)(this.s.db.s.client,new O.RenameOperation(this,e,{...t,readPreference:B.ReadPreference.PRIMARY}),n)}drop(e,t){return"function"==typeof e&&(t=e,e={}),e=null!=e?e:{},(0,E.executeOperation)(this.s.db.s.client,new m.DropCollectionOperation(this.s.db,this.collectionName,e),t)}findOne(e,t,n){if(null!=n&&"function"!=typeof n)throw new c.MongoInvalidArgumentError("Third parameter to `findOne()` must be a callback or undefined");"function"==typeof e&&(n=e,e={},t={}),"function"==typeof t&&(n=t,t={});const r=null!=e?e:{},o=null!=t?t:{};return this.find(r,o).limit(-1).batchSize(1).next(n)}find(e,t){if(arguments.length>2)throw new c.MongoInvalidArgumentError('Method "collection.find()" accepts at most two arguments');if("function"==typeof t)throw new c.MongoInvalidArgumentError('Argument "options" must not be function');return new a.FindCursor(this.s.db.s.client,this.s.namespace,e,(0,T.resolveOptions)(this,t))}options(e,t){return"function"==typeof e&&(t=e,e={}),(0,E.executeOperation)(this.s.db.s.client,new S.OptionsOperation(this,(0,T.resolveOptions)(this,e)),t)}isCapped(e,t){return"function"==typeof e&&(t=e,e={}),(0,E.executeOperation)(this.s.db.s.client,new b.IsCappedOperation(this,(0,T.resolveOptions)(this,e)),t)}createIndex(e,t,n){return"function"==typeof t&&(n=t,t={}),(0,E.executeOperation)(this.s.db.s.client,new v.CreateIndexOperation(this,this.collectionName,e,(0,T.resolveOptions)(this,t)),n)}createIndexes(e,t,n){return"function"==typeof t&&(n=t,t={}),"number"!=typeof(t=t?Object.assign({},t):{}).maxTimeMS&&delete t.maxTimeMS,(0,E.executeOperation)(this.s.db.s.client,new v.CreateIndexesOperation(this,this.collectionName,e,(0,T.resolveOptions)(this,t)),n)}dropIndex(e,t,n){return"function"==typeof t&&(n=t,t={}),(t=(0,T.resolveOptions)(this,t)).readPreference=B.ReadPreference.primary,(0,E.executeOperation)(this.s.db.s.client,new v.DropIndexOperation(this,e,t),n)}dropIndexes(e,t){return"function"==typeof e&&(t=e,e={}),(0,E.executeOperation)(this.s.db.s.client,new v.DropIndexesOperation(this,(0,T.resolveOptions)(this,e)),t)}listIndexes(e){return new v.ListIndexesCursor(this,(0,T.resolveOptions)(this,e))}indexExists(e,t,n){return"function"==typeof t&&(n=t,t={}),(0,E.executeOperation)(this.s.db.s.client,new v.IndexExistsOperation(this,e,(0,T.resolveOptions)(this,t)),n)}indexInformation(e,t){return"function"==typeof e&&(t=e,e={}),(0,E.executeOperation)(this.s.db.s.client,new v.IndexInformationOperation(this.s.db,this.collectionName,(0,T.resolveOptions)(this,e)),t)}estimatedDocumentCount(e,t){return"function"==typeof e&&(t=e,e={}),(0,E.executeOperation)(this.s.db.s.client,new g.EstimatedDocumentCountOperation(this,(0,T.resolveOptions)(this,e)),t)}countDocuments(e,t,n){return null==e?(e={},t={},n=void 0):"function"==typeof e?(n=e,e={},t={}):2===arguments.length&&"function"==typeof t&&(n=t,t={}),null!=e||(e={}),(0,E.executeOperation)(this.s.db.s.client,new f.CountDocumentsOperation(this,e,(0,T.resolveOptions)(this,t)),n)}distinct(e,t,n,r){return"function"==typeof t?(r=t,t={},n={}):3===arguments.length&&"function"==typeof n&&(r=n,n={}),null!=t||(t={}),(0,E.executeOperation)(this.s.db.s.client,new h.DistinctOperation(this,e,t,(0,T.resolveOptions)(this,n)),r)}indexes(e,t){return"function"==typeof e&&(t=e,e={}),(0,E.executeOperation)(this.s.db.s.client,new v.IndexesOperation(this,(0,T.resolveOptions)(this,e)),t)}stats(e,t){return"function"==typeof e&&(t=e,e={}),e=null!=e?e:{},(0,E.executeOperation)(this.s.db.s.client,new _.CollStatsOperation(this,e),t)}findOneAndDelete(e,t,n){return"function"==typeof t&&(n=t,t={}),(0,E.executeOperation)(this.s.db.s.client,new y.FindOneAndDeleteOperation(this,e,(0,T.resolveOptions)(this,t)),n)}findOneAndReplace(e,t,n,r){return"function"==typeof n&&(r=n,n={}),(0,E.executeOperation)(this.s.db.s.client,new y.FindOneAndReplaceOperation(this,e,t,(0,T.resolveOptions)(this,n)),r)}findOneAndUpdate(e,t,n,r){return"function"==typeof n&&(r=n,n={}),(0,E.executeOperation)(this.s.db.s.client,new y.FindOneAndUpdateOperation(this,e,t,(0,T.resolveOptions)(this,n)),r)}aggregate(e=[],t){if(arguments.length>2)throw new c.MongoInvalidArgumentError('Method "collection.aggregate()" accepts at most two arguments');if(!Array.isArray(e))throw new c.MongoInvalidArgumentError('Argument "pipeline" must be an array of aggregation stages');if("function"==typeof t)throw new c.MongoInvalidArgumentError('Argument "options" must not be function');return new u.AggregationCursor(this.s.db.s.client,this.s.namespace,e,(0,T.resolveOptions)(this,t))}watch(e=[],t={}){return Array.isArray(e)||(t=e,e=[]),new s.ChangeStream(this,e,(0,T.resolveOptions)(this,t))}mapReduce(e,t,n,r){if((0,T.emitWarningOnce)("collection.mapReduce is deprecated. Use the aggregation pipeline instead. Visit https://docs.mongodb.com/manual/reference/map-reduce-to-aggregation-pipeline for more information on how to translate map-reduce operations to the aggregation pipeline."),"function"==typeof n&&(r=n,n={}),null==(null==n?void 0:n.out))throw new c.MongoInvalidArgumentError('Option "out" must be defined, see mongodb docs for possible values');return"function"==typeof e&&(e=e.toString()),"function"==typeof t&&(t=t.toString()),"function"==typeof n.finalize&&(n.finalize=n.finalize.toString()),(0,E.executeOperation)(this.s.db.s.client,new C.MapReduceOperation(this,e,t,(0,T.resolveOptions)(this,n)),r)}initializeUnorderedBulkOp(e){return new i.UnorderedBulkOperation(this,(0,T.resolveOptions)(this,e))}initializeOrderedBulkOp(e){return new o.OrderedBulkOperation(this,(0,T.resolveOptions)(this,e))}getLogger(){return this.s.db.s.logger}get logger(){return this.s.db.s.logger}insert(e,t,n){return(0,T.emitWarningOnce)("collection.insert is deprecated. Use insertOne, insertMany or bulkWrite instead."),"function"==typeof t&&(n=t,t={}),t=t||{ordered:!1},e=Array.isArray(e)?e:[e],!0===t.keepGoing&&(t.ordered=!1),this.insertMany(e,t,n)}update(e,t,n,r){return(0,T.emitWarningOnce)("collection.update is deprecated. Use updateOne, updateMany, or bulkWrite instead."),"function"==typeof n&&(r=n,n={}),n=null!=n?n:{},this.updateMany(e,t,n,r)}remove(e,t,n){return(0,T.emitWarningOnce)("collection.remove is deprecated. Use deleteOne, deleteMany, or bulkWrite instead."),"function"==typeof t&&(n=t,t={}),t=null!=t?t:{},this.deleteMany(e,t,n)}count(e,t,n){return"function"==typeof e?(n=e,e={},t={}):"function"==typeof t&&(n=t,t={}),null!=e||(e={}),(0,E.executeOperation)(this.s.db.s.client,new d.CountOperation(T.MongoDBNamespace.fromString(this.namespace),e,(0,T.resolveOptions)(this,t)),n)}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AUTH_MECHS_AUTH_SRC_EXTERNAL=t.AuthMechanism=void 0,t.AuthMechanism=Object.freeze({MONGODB_AWS:"MONGODB-AWS",MONGODB_CR:"MONGODB-CR",MONGODB_DEFAULT:"DEFAULT",MONGODB_GSSAPI:"GSSAPI",MONGODB_PLAIN:"PLAIN",MONGODB_SCRAM_SHA1:"SCRAM-SHA-1",MONGODB_SCRAM_SHA256:"SCRAM-SHA-256",MONGODB_X509:"MONGODB-X509"}),t.AUTH_MECHS_AUTH_SRC_EXTERNAL=new Set([t.AuthMechanism.MONGODB_GSSAPI,t.AuthMechanism.MONGODB_AWS,t.AuthMechanism.MONGODB_X509])},function(e,t,n){var r=n(72),o=n(73);e.exports=function(e,t,n,i){var s=!n;n||(n={});for(var u=-1,a=t.length;++u<a;){var c=t[u],l=i?i(n[c],e[c],c,n,e):void 0;void 0===l&&(l=e[c]),s?o(n,c,l):r(n,c,l)}return n}},function(e,t,n){var r=n(122),o=n(238),i=n(28);e.exports=function(e){return i(e)?r(e):o(e)}},function(e,t,n){var r=n(29),o=n(31);e.exports=function(e,t){for(var n=0,i=(t=r(t,e)).length;null!=e&&n<i;)e=e[o(t[n++])];return n&&n==i?e:void 0}},function(e,t){e.exports=function(e,t){for(var n=-1,r=null==e?0:e.length,o=Array(r);++n<r;)o[n]=t(e[n],n,e);return o}},function(e,t,n){var r=n(17),o=n(7),i=n(10);e.exports=function(e){return"string"==typeof e||!o(e)&&i(e)&&"[object String]"==r(e)}},function(e,t){e.exports=function(e){for(var t=-1,n=null==e?0:e.length,r=0,o=[];++t<n;){var i=e[t];i&&(o[r++]=i)}return o}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.OP_MSG=t.OP_COMPRESSED=t.OP_KILL_CURSORS=t.OP_DELETE=t.OP_GETMORE=t.OP_QUERY=t.OP_INSERT=t.OP_UPDATE=t.OP_REPLY=t.MAX_SUPPORTED_WIRE_VERSION=t.MIN_SUPPORTED_WIRE_VERSION=t.MAX_SUPPORTED_SERVER_VERSION=t.MIN_SUPPORTED_SERVER_VERSION=void 0,t.MIN_SUPPORTED_SERVER_VERSION="3.6",t.MAX_SUPPORTED_SERVER_VERSION="6.0",t.MIN_SUPPORTED_WIRE_VERSION=6,t.MAX_SUPPORTED_WIRE_VERSION=17,t.OP_REPLY=1,t.OP_UPDATE=2001,t.OP_INSERT=2002,t.OP_QUERY=2004,t.OP_GETMORE=2005,t.OP_DELETE=2006,t.OP_KILL_CURSORS=2007,t.OP_COMPRESSED=2012,t.OP_MSG=2013},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MongoClient=t.ServerApiVersion=void 0;const r=n(4),o=n(96),i=n(103),s=n(100),u=n(1),a=n(9),c=n(417),l=n(33),d=n(2);t.ServerApiVersion=Object.freeze({v1:"1"});const f=Symbol("options");class p extends a.TypedEventEmitter{constructor(e,t){super(),this[f]=(0,i.parseOptions)(e,this,t);const n=this;this.s={url:e,sessions:new Set,bsonOptions:(0,r.resolveBSONOptions)(this[f]),namespace:(0,d.ns)("admin"),hasBeenClosed:!1,get options(){return n[f]},get readConcern(){return n[f].readConcern},get writeConcern(){return n[f].writeConcern},get readPreference(){return n[f].readPreference},get logger(){return n[f].logger},get isMongoClient(){return!0}}}get options(){return Object.freeze({...this[f]})}get serverApi(){return this[f].serverApi&&Object.freeze({...this[f].serverApi})}get monitorCommands(){return this[f].monitorCommands}set monitorCommands(e){this[f].monitorCommands=e}get autoEncrypter(){return this[f].autoEncrypter}get readConcern(){return this.s.readConcern}get writeConcern(){return this.s.writeConcern}get readPreference(){return this.s.readPreference}get bsonOptions(){return this.s.bsonOptions}get logger(){return this.s.logger}connect(e){if(e&&"function"!=typeof e)throw new u.MongoInvalidArgumentError("Method `connect` only accepts a callback");return(0,d.maybePromise)(e,e=>{(0,c.connect)(this,this[f],t=>{if(t)return e(t);e(void 0,this)})})}close(e,t){Object.defineProperty(this.s,"hasBeenClosed",{value:!0,enumerable:!0,configurable:!1,writable:!1}),"function"==typeof e&&(t=e);const n="boolean"==typeof e&&e;return(0,d.maybePromise)(t,e=>{if(null==this.topology)return e();const t=this.topology;this.topology=void 0,t.close({force:n},t=>{if(t)return e(t);const{encrypter:r}=this[f];if(r)return r.close(this,n,t=>{e(t)});e()})})}db(e,t){t=null!=t?t:{},e||(e=this.options.dbName);const n=Object.assign({},this[f],t);return new s.Db(this,e,n)}static connect(e,t,n){"function"==typeof t&&(n=t,t={}),t=null!=t?t:{};try{const r=new p(e,t);return n?r.connect(n):r.connect()}catch(e){return n?n(e):l.PromiseProvider.get().reject(e)}}startSession(e){if(e=Object.assign({explicit:!0},e),!this.topology)throw new u.MongoNotConnectedError("MongoClient must be connected to start a session");return this.topology.startSession(e,this.s.options)}withSession(e,t){const n={owner:Symbol(),..."object"==typeof e?e:{}},r="function"==typeof e?e:t;if(null==r)throw new u.MongoInvalidArgumentError("Missing required callback parameter");const o=this.startSession(n);return l.PromiseProvider.get().resolve().then(()=>r(o)).then(()=>{}).finally(()=>o.endSession())}watch(e=[],t={}){return Array.isArray(e)||(t=e,e=[]),new o.ChangeStream(this,e,(0,d.resolveOptions)(this,t))}getLogger(){return this.s.logger}}t.MongoClient=p},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AutoEncryptionLoggerLevel=t.aws4=t.saslprep=t.Snappy=t.ZStandard=t.Kerberos=t.PKG_VERSION=void 0;const r=n(1),o=n(2);function i(e){return new Proxy(e?{kModuleError:e}:{},{get:(t,n)=>{if("kModuleError"===n)return e;throw e},set:()=>{throw e}})}t.PKG_VERSION=Symbol("kPkgVersion"),t.Kerberos=i(new r.MongoMissingDependencyError("Optional module `kerberos` not found. Please install it to enable kerberos authentication"));try{t.Kerberos=n(!function(){var e=new Error("Cannot find module 'kerberos'");throw e.code="MODULE_NOT_FOUND",e}())}catch{}t.ZStandard=i(new r.MongoMissingDependencyError("Optional module `@mongodb-js/zstd` not found. Please install it to enable zstd compression"));try{t.ZStandard=n(!function(){var e=new Error("Cannot find module '@mongodb-js/zstd'");throw e.code="MODULE_NOT_FOUND",e}())}catch{}t.Snappy=i(new r.MongoMissingDependencyError("Optional module `snappy` not found. Please install it to enable snappy compression"));try{t.Snappy=n(!function(){var e=new Error("Cannot find module 'snappy'");throw e.code="MODULE_NOT_FOUND",e}());try{t.Snappy[t.PKG_VERSION]=(0,o.parsePackageVersion)(n(!function(){var e=new Error("Cannot find module 'snappy/package.json'");throw e.code="MODULE_NOT_FOUND",e}()))}catch{}}catch{}t.saslprep=i(new r.MongoMissingDependencyError("Optional module `saslprep` not found. Please install it to enable Stringprep Profile for User Names and Passwords"));try{t.saslprep=n(393)}catch{}t.aws4=i(new r.MongoMissingDependencyError("Optional module `aws4` not found. Please install it to enable AWS authentication"));try{t.aws4=n(397)}catch{}t.AutoEncryptionLoggerLevel=Object.freeze({FatalError:0,Error:1,Warning:2,Info:3,Trace:4})},function(e,t){e.exports=function(e){return e.webpackPolyfill||(e.deprecate=function(){},e.paths=[],e.children||(e.children=[]),Object.defineProperty(e,"loaded",{enumerable:!0,get:function(){return e.l}}),Object.defineProperty(e,"id",{enumerable:!0,get:function(){return e.i}}),e.webpackPolyfill=1),e}},function(e,t,n){var r=n(204),o=n(205),i=n(206),s=n(207),u=n(208);function a(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}a.prototype.clear=r,a.prototype.delete=o,a.prototype.get=i,a.prototype.has=s,a.prototype.set=u,e.exports=a},function(e,t,n){var r=n(48);e.exports=function(e,t){for(var n=e.length;n--;)if(r(e[n][0],t))return n;return-1}},function(e,t){e.exports=function(e,t){return e===t||e!=e&&t!=t}},function(e,t,n){var r=n(20)(Object,"create");e.exports=r},function(e,t,n){var r=n(228);e.exports=function(e,t){var n=e.__data__;return r(t)?n["string"==typeof t?"string":"hash"]:n.map}},function(e,t){var n=/^(?:0|[1-9]\d*)$/;e.exports=function(e,t){var r=typeof e;return!!(t=null==t?9007199254740991:t)&&("number"==r||"symbol"!=r&&n.test(e))&&e>-1&&e%1==0&&e<t}},function(e,t,n){(function(e){var r=n(119),o=t&&!t.nodeType&&t,i=o&&"object"==typeof e&&e&&!e.nodeType&&e,s=i&&i.exports===o&&r.process,u=function(){try{var e=i&&i.require&&i.require("util").types;return e||s&&s.binding&&s.binding("util")}catch(e){}}();e.exports=u}).call(this,n(45)(e))},function(e,t,n){var r=n(248),o=n(70),i=n(249),s=n(130),u=n(250),a=n(17),c=n(120),l=c(r),d=c(o),f=c(i),p=c(s),h=c(u),m=a;(r&&"[object DataView]"!=m(new r(new ArrayBuffer(1)))||o&&"[object Map]"!=m(new o)||i&&"[object Promise]"!=m(i.resolve())||s&&"[object Set]"!=m(new s)||u&&"[object WeakMap]"!=m(new u))&&(m=function(e){var t=a(e),n="[object Object]"==t?e.constructor:void 0,r=n?c(n):"";if(r)switch(r){case l:return"[object DataView]";case d:return"[object Map]";case f:return"[object Promise]";case p:return"[object Set]";case h:return"[object WeakMap]"}return t}),e.exports=m},function(e,t,n){var r=n(17),o=n(10);e.exports=function(e){return"symbol"==typeof e||o(e)&&"[object Symbol]"==r(e)}},function(e,t,n){var r=n(17),o=n(81),i=n(10),s=Function.prototype,u=Object.prototype,a=s.toString,c=u.hasOwnProperty,l=a.call(Object);e.exports=function(e){if(!i(e)||"[object Object]"!=r(e))return!1;var t=o(e);if(null===t)return!0;var n=c.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&a.call(n)==l}},function(e,t){e.exports=function(e){return e}},function(e,t,n){var r=n(141);e.exports=function(e){return(null==e?0:e.length)?r(e,1):[]}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.dumpSqlCommand=t.dumpSqlInsert=t.dumpSqlDelete=t.dumpSqlUpdate=t.dumpSqlSelect=void 0;const r=n(150),o=n(92),i=n(93);function s(e,t){e.put("^select "),t.distinct&&e.put("^distinct "),t.topRecords&&(e.dialect.rangeSelect&&!e.dialect.offsetFetchRangeSyntax||e.put("^top %s ",t.topRecords)),t.selectAll&&e.put("* "),t.columns&&(t.selectAll&&e.put("&n,"),e.put("&>&n"),e.putCollection(",&n",t.columns,t=>{(0,r.dumpSqlExpression)(e,t),t.alias&&e.put(" ^as %i",t.alias)}),e.put("&n&<")),e.put("^from "),(0,o.dumpSqlFromDefinition)(e,t.from),t.where&&(e.put("&n^where "),(0,i.dumpSqlCondition)(e,t.where),e.put("&n")),t.groupBy&&(e.put("&n^group ^by "),e.putCollection(", ",t.groupBy,t=>(0,r.dumpSqlExpression)(e,t)),e.put("&n")),t.having&&(e.put("&n^having "),(0,i.dumpSqlCondition)(e,t.having),e.put("&n")),t.orderBy&&(e.put("&n^order ^by "),e.putCollection(", ",t.orderBy,t=>{(0,r.dumpSqlExpression)(e,t),e.put(" %k",t.direction)}),e.put("&n")),t.range&&(e.dialect.offsetFetchRangeSyntax?e.put("^offset %s ^rows ^fetch ^next %s ^rows ^only",t.range.offset,t.range.limit):e.put("^limit %s ^offset %s ",t.range.limit,t.range.offset)),t.topRecords&&e.dialect.rangeSelect&&!e.dialect.offsetFetchRangeSyntax&&e.put("^limit %s ",t.topRecords)}function u(e,t){e.put("^update "),(0,o.dumpSqlSourceRef)(e,t.from),e.put("&n^set "),e.put("&>"),e.putCollection(", ",t.fields,t=>{e.put("%i=",t.targetColumn),(0,r.dumpSqlExpression)(e,t)}),e.put("&<"),t.where&&(e.put("&n^where "),(0,i.dumpSqlCondition)(e,t.where),e.put("&n"))}function a(e,t){e.put("^delete ^from "),(0,o.dumpSqlSourceRef)(e,t.from),t.where&&(e.put("&n^where "),(0,i.dumpSqlCondition)(e,t.where),e.put("&n"))}function c(e,t){e.put("^insert ^into %f (%,i) ^values (",t.targetTable,t.fields.map(e=>e.targetColumn)),e.putCollection(",",t.fields,t=>(0,r.dumpSqlExpression)(e,t)),e.put(")")}t.dumpSqlSelect=s,t.dumpSqlUpdate=u,t.dumpSqlDelete=a,t.dumpSqlInsert=c,t.dumpSqlCommand=function(e,t){switch(t.commandType){case"select":s(e,t);break;case"update":u(e,t);break;case"delete":a(e,t);break;case"insert":c(e,t);break;case"allowIdentityInsert":e.allowIdentityInsert(t.targetTable,t.allow)}}},function(e,t){e.exports=require("url")},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.RunAdminCommandOperation=t.RunCommandOperation=void 0;const r=n(2),o=n(5);class i extends o.CommandOperation{constructor(e,t,n){super(e,n),this.options=null!=n?n:{},this.command=t}execute(e,t,n){const r=this.command;this.executeCommand(e,t,r,n)}}t.RunCommandOperation=i;t.RunAdminCommandOperation=class extends i{constructor(e,t,n){super(e,t,n),this.ns=new r.MongoDBNamespace("admin")}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.BulkOperationBase=t.FindOperators=t.MongoBulkWriteError=t.mergeBatchResults=t.WriteError=t.WriteConcernError=t.BulkWriteResult=t.Batch=t.BatchType=void 0;const r=n(4),o=n(1),i=n(161),s=n(14),u=n(162),a=n(3),c=n(165),l=n(33),d=n(2),f=n(13),p=Symbol("serverError");t.BatchType=Object.freeze({INSERT:1,UPDATE:2,DELETE:3});t.Batch=class{constructor(e,t){this.originalZeroIndex=t,this.currentIndex=0,this.originalIndexes=[],this.batchType=e,this.operations=[],this.size=0,this.sizeBytes=0}};class h{constructor(e){this.result=e}get insertedCount(){var e;return null!==(e=this.result.nInserted)&&void 0!==e?e:0}get matchedCount(){var e;return null!==(e=this.result.nMatched)&&void 0!==e?e:0}get modifiedCount(){var e;return null!==(e=this.result.nModified)&&void 0!==e?e:0}get deletedCount(){var e;return null!==(e=this.result.nRemoved)&&void 0!==e?e:0}get upsertedCount(){var e;return null!==(e=this.result.upserted.length)&&void 0!==e?e:0}get upsertedIds(){var e;const t={};for(const n of null!==(e=this.result.upserted)&&void 0!==e?e:[])t[n.index]=n._id;return t}get insertedIds(){var e;const t={};for(const n of null!==(e=this.result.insertedIds)&&void 0!==e?e:[])t[n.index]=n._id;return t}get ok(){return this.result.ok}get nInserted(){return this.result.nInserted}get nUpserted(){return this.result.nUpserted}get nMatched(){return this.result.nMatched}get nModified(){return this.result.nModified}get nRemoved(){return this.result.nRemoved}getInsertedIds(){return this.result.insertedIds}getUpsertedIds(){return this.result.upserted}getUpsertedIdAt(e){return this.result.upserted[e]}getRawResponse(){return this.result}hasWriteErrors(){return this.result.writeErrors.length>0}getWriteErrorCount(){return this.result.writeErrors.length}getWriteErrorAt(e){return e<this.result.writeErrors.length?this.result.writeErrors[e]:void 0}getWriteErrors(){return this.result.writeErrors}getLastOp(){return this.result.opTime}getWriteConcernError(){if(0!==this.result.writeConcernErrors.length){if(1===this.result.writeConcernErrors.length)return this.result.writeConcernErrors[0];{let e="";for(let t=0;t<this.result.writeConcernErrors.length;t++){e+=this.result.writeConcernErrors[t].errmsg,0===t&&(e+=" and ")}return new m({errmsg:e,code:o.MONGODB_ERROR_CODES.WriteConcernFailed})}}}toJSON(){return this.result}toString(){return`BulkWriteResult(${this.toJSON()})`}isOk(){return 1===this.result.ok}}t.BulkWriteResult=h;class m{constructor(e){this[p]=e}get code(){return this[p].code}get errmsg(){return this[p].errmsg}get errInfo(){return this[p].errInfo}get err(){return this[p]}toJSON(){return this[p]}toString(){return`WriteConcernError(${this.errmsg})`}}t.WriteConcernError=m;class g{constructor(e){this.err=e}get code(){return this.err.code}get index(){return this.err.index}get errmsg(){return this.err.errmsg}get errInfo(){return this.err.errInfo}getOperation(){return this.err.op}toJSON(){return{code:this.err.code,index:this.err.index,errmsg:this.err.errmsg,op:this.err.op}}toString(){return`WriteError(${JSON.stringify(this.toJSON())})`}}function E(e){return"number"==typeof e?r.Long.fromNumber(e):e}function y(e,t,n,o){if(n?o=n:o&&o.result&&(o=o.result),null==o)return;if(0===o.ok&&1===t.ok){t.ok=0;const n={index:0,code:o.code||0,errmsg:o.message,errInfo:o.errInfo,op:e.operations[0]};return void t.writeErrors.push(new g(n))}if(0===o.ok&&0===t.ok)return;if(o.opTime||o.lastOp){let e=o.lastOp||o.opTime;if("Timestamp"===e._bsontype&&(e={ts:e,t:r.Long.ZERO}),t.opTime){const n=E(t.opTime.ts),r=E(e.ts);if(r.greaterThan(n))t.opTime=e;else if(r.equals(n)){const n=E(t.opTime.t);E(e.t).greaterThan(n)&&(t.opTime=e)}}else t.opTime=e}w(e)&&o.n&&(t.nInserted=t.nInserted+o.n),B(e)&&o.n&&(t.nRemoved=t.nRemoved+o.n);let i=0;if(Array.isArray(o.upserted)){i=o.upserted.length;for(let n=0;n<o.upserted.length;n++)t.upserted.push({index:o.upserted[n].index+e.originalZeroIndex,_id:o.upserted[n]._id})}else o.upserted&&(i=1,t.upserted.push({index:e.originalZeroIndex,_id:o.upserted}));if(D(e)&&o.n){const e=o.nModified;t.nUpserted=t.nUpserted+i,t.nMatched=t.nMatched+(o.n-i),t.nModified="number"==typeof e?t.nModified+e:0}if(Array.isArray(o.writeErrors))for(let n=0;n<o.writeErrors.length;n++){const r={index:e.originalIndexes[o.writeErrors[n].index],code:o.writeErrors[n].code,errmsg:o.writeErrors[n].errmsg,errInfo:o.writeErrors[n].errInfo,op:e.operations[o.writeErrors[n].index]};t.writeErrors.push(new g(r))}o.writeConcernError&&t.writeConcernErrors.push(new m(o.writeConcernError))}function v(e,t,n){if(0===e.s.batches.length)return n(void 0,new h(e.s.bulkResult));const r=e.s.batches.shift();function a(i,s){if(i&&"message"in i&&!(i instanceof o.MongoWriteConcernError))return n(new A(i,new h(e.s.bulkResult)));if(i instanceof o.MongoWriteConcernError)return function(e,t,n,r){var o,i;y(e,t,void 0,n.result),r(new A({message:null===(o=n.result)||void 0===o?void 0:o.writeConcernError.errmsg,code:null===(i=n.result)||void 0===i?void 0:i.writeConcernError.result},new h(t)))}(r,e.s.bulkResult,i,n);const u=new h(e.s.bulkResult);if(null!=y(r,e.s.bulkResult,i,s))return n(void 0,u);e.handleWriteError(n,u)||v(e,t,n)}const l=(0,d.resolveOptions)(e,{...t,ordered:e.isOrdered});!0!==l.bypassDocumentValidation&&delete l.bypassDocumentValidation,e.operationId&&(a.operationId=e.operationId),!0===e.s.bypassDocumentValidation&&(l.bypassDocumentValidation=!0),!1===e.s.checkKeys&&(l.checkKeys=!1),l.retryWrites&&(D(r)&&(l.retryWrites=l.retryWrites&&!r.operations.some(e=>e.multi)),B(r)&&(l.retryWrites=l.retryWrites&&!r.operations.some(e=>0===e.limit)));try{w(r)?(0,s.executeOperation)(e.s.collection.s.db.s.client,new u.InsertOperation(e.s.namespace,r.operations,l),a):D(r)?(0,s.executeOperation)(e.s.collection.s.db.s.client,new c.UpdateOperation(e.s.namespace,r.operations,l),a):B(r)&&(0,s.executeOperation)(e.s.collection.s.db.s.client,new i.DeleteOperation(e.s.namespace,r.operations,l),a)}catch(t){t.ok=0,y(r,e.s.bulkResult,t,void 0),n()}}t.WriteError=g,t.mergeBatchResults=y;class A extends o.MongoServerError{constructor(e,t){var n;super(e),this.writeErrors=[],e instanceof m?this.err=e:e instanceof Error||(this.message=e.message,this.code=e.code,this.writeErrors=null!==(n=e.writeErrors)&&void 0!==n?n:[]),this.result=t,Object.assign(this,e)}get name(){return"MongoBulkWriteError"}get insertedCount(){return this.result.insertedCount}get matchedCount(){return this.result.matchedCount}get modifiedCount(){return this.result.modifiedCount}get deletedCount(){return this.result.deletedCount}get upsertedCount(){return this.result.upsertedCount}get insertedIds(){return this.result.insertedIds}get upsertedIds(){return this.result.upsertedIds}}t.MongoBulkWriteError=A;class b{constructor(e){this.bulkOperation=e}update(e){const n=T(this.bulkOperation);return this.bulkOperation.addToOperationsList(t.BatchType.UPDATE,(0,c.makeUpdateStatement)(n.selector,e,{...n,multi:!0}))}updateOne(e){if(!(0,d.hasAtomicOperators)(e))throw new o.MongoInvalidArgumentError("Update document requires atomic operators");const n=T(this.bulkOperation);return this.bulkOperation.addToOperationsList(t.BatchType.UPDATE,(0,c.makeUpdateStatement)(n.selector,e,{...n,multi:!1}))}replaceOne(e){if((0,d.hasAtomicOperators)(e))throw new o.MongoInvalidArgumentError("Replacement document must not use atomic operators");const n=T(this.bulkOperation);return this.bulkOperation.addToOperationsList(t.BatchType.UPDATE,(0,c.makeUpdateStatement)(n.selector,e,{...n,multi:!1}))}deleteOne(){const e=T(this.bulkOperation);return this.bulkOperation.addToOperationsList(t.BatchType.DELETE,(0,i.makeDeleteStatement)(e.selector,{...e,limit:1}))}delete(){const e=T(this.bulkOperation);return this.bulkOperation.addToOperationsList(t.BatchType.DELETE,(0,i.makeDeleteStatement)(e.selector,{...e,limit:0}))}upsert(){return this.bulkOperation.s.currentOp||(this.bulkOperation.s.currentOp={}),this.bulkOperation.s.currentOp.upsert=!0,this}collation(e){return this.bulkOperation.s.currentOp||(this.bulkOperation.s.currentOp={}),this.bulkOperation.s.currentOp.collation=e,this}arrayFilters(e){return this.bulkOperation.s.currentOp||(this.bulkOperation.s.currentOp={}),this.bulkOperation.s.currentOp.arrayFilters=e,this}}t.FindOperators=b;class C extends a.AbstractOperation{constructor(e,t){super(t),this.bulkOperation=e}execute(e,t,n){return null==this.options.session&&(this.options.session=t),v(this.bulkOperation,this.options,n)}}class S{constructor(e,t,n){this.isOrdered=n;const o=(0,d.getTopology)(e);t=null==t?{}:t;const i=e.s.namespace,s=o.lastHello(),u=!(!o.s.options||!o.s.options.autoEncrypter),a=s&&s.maxBsonObjectSize?s.maxBsonObjectSize:16777216,c=u?2097152:a,l=s&&s.maxWriteBatchSize?s.maxWriteBatchSize:1e3,p=(l-1).toString(10).length+2;let h=Object.assign({},t);h=(0,d.applyRetryableWrites)(h,e.s.db);this.s={bulkResult:{ok:1,writeErrors:[],writeConcernErrors:[],insertedIds:[],nInserted:0,nUpserted:0,nMatched:0,nModified:0,nRemoved:0,upserted:[]},currentBatch:void 0,currentIndex:0,currentBatchSize:0,currentBatchSizeBytes:0,currentInsertBatch:void 0,currentUpdateBatch:void 0,currentRemoveBatch:void 0,batches:[],writeConcern:f.WriteConcern.fromOptions(t),maxBsonObjectSize:a,maxBatchSizeBytes:c,maxWriteBatchSize:l,maxKeySize:p,namespace:i,topology:o,options:h,bsonOptions:(0,r.resolveBSONOptions)(t),currentOp:void 0,executed:!1,collection:e,err:void 0,checkKeys:"boolean"==typeof t.checkKeys&&t.checkKeys},!0===t.bypassDocumentValidation&&(this.s.bypassDocumentValidation=!0)}insert(e){return null!=e._id||_(this)||(e._id=new r.ObjectId),this.addToOperationsList(t.BatchType.INSERT,e)}find(e){if(!e)throw new o.MongoInvalidArgumentError("Bulk find operation must specify a selector");return this.s.currentOp={selector:e},new b(this)}raw(e){if(null==e||"object"!=typeof e)throw new o.MongoInvalidArgumentError("Operation must be an object with an operation key");if("insertOne"in e){const n=_(this);return e.insertOne&&null==e.insertOne.document?(!0!==n&&null==e.insertOne._id&&(e.insertOne._id=new r.ObjectId),this.addToOperationsList(t.BatchType.INSERT,e.insertOne)):(!0!==n&&null==e.insertOne.document._id&&(e.insertOne.document._id=new r.ObjectId),this.addToOperationsList(t.BatchType.INSERT,e.insertOne.document))}if("replaceOne"in e||"updateOne"in e||"updateMany"in e){if("replaceOne"in e){if("q"in e.replaceOne)throw new o.MongoInvalidArgumentError("Raw operations are not allowed");const n=(0,c.makeUpdateStatement)(e.replaceOne.filter,e.replaceOne.replacement,{...e.replaceOne,multi:!1});if((0,d.hasAtomicOperators)(n.u))throw new o.MongoInvalidArgumentError("Replacement document must not use atomic operators");return this.addToOperationsList(t.BatchType.UPDATE,n)}if("updateOne"in e){if("q"in e.updateOne)throw new o.MongoInvalidArgumentError("Raw operations are not allowed");const n=(0,c.makeUpdateStatement)(e.updateOne.filter,e.updateOne.update,{...e.updateOne,multi:!1});if(!(0,d.hasAtomicOperators)(n.u))throw new o.MongoInvalidArgumentError("Update document requires atomic operators");return this.addToOperationsList(t.BatchType.UPDATE,n)}if("updateMany"in e){if("q"in e.updateMany)throw new o.MongoInvalidArgumentError("Raw operations are not allowed");const n=(0,c.makeUpdateStatement)(e.updateMany.filter,e.updateMany.update,{...e.updateMany,multi:!0});if(!(0,d.hasAtomicOperators)(n.u))throw new o.MongoInvalidArgumentError("Update document requires atomic operators");return this.addToOperationsList(t.BatchType.UPDATE,n)}}if("deleteOne"in e){if("q"in e.deleteOne)throw new o.MongoInvalidArgumentError("Raw operations are not allowed");return this.addToOperationsList(t.BatchType.DELETE,(0,i.makeDeleteStatement)(e.deleteOne.filter,{...e.deleteOne,limit:1}))}if("deleteMany"in e){if("q"in e.deleteMany)throw new o.MongoInvalidArgumentError("Raw operations are not allowed");return this.addToOperationsList(t.BatchType.DELETE,(0,i.makeDeleteStatement)(e.deleteMany.filter,{...e.deleteMany,limit:0}))}throw new o.MongoInvalidArgumentError("bulkWrite only supports insertOne, updateOne, updateMany, deleteOne, deleteMany")}get bsonOptions(){return this.s.bsonOptions}get writeConcern(){return this.s.writeConcern}get batches(){const e=[...this.s.batches];return this.isOrdered?this.s.currentBatch&&e.push(this.s.currentBatch):(this.s.currentInsertBatch&&e.push(this.s.currentInsertBatch),this.s.currentUpdateBatch&&e.push(this.s.currentUpdateBatch),this.s.currentRemoveBatch&&e.push(this.s.currentRemoveBatch)),e}execute(e,t){if("function"==typeof e&&(t=e,e={}),e=null!=e?e:{},this.s.executed)return O(new o.MongoBatchReExecutionError,t);const n=f.WriteConcern.fromOptions(e);if(n&&(this.s.writeConcern=n),this.isOrdered?this.s.currentBatch&&this.s.batches.push(this.s.currentBatch):(this.s.currentInsertBatch&&this.s.batches.push(this.s.currentInsertBatch),this.s.currentUpdateBatch&&this.s.batches.push(this.s.currentUpdateBatch),this.s.currentRemoveBatch&&this.s.batches.push(this.s.currentRemoveBatch)),0===this.s.batches.length){return O(new o.MongoInvalidArgumentError("Invalid BulkOperation, Batch cannot be empty"),t)}this.s.executed=!0;const r={...this.s.options,...e},i=new C(this,r);return(0,s.executeOperation)(this.s.collection.s.db.s.client,i,t)}handleWriteError(e,t){if(this.s.bulkResult.writeErrors.length>0){const n=this.s.bulkResult.writeErrors[0].errmsg?this.s.bulkResult.writeErrors[0].errmsg:"write operation failed";return e(new A({message:n,code:this.s.bulkResult.writeErrors[0].code,writeErrors:this.s.bulkResult.writeErrors},t)),!0}const n=t.getWriteConcernError();return!!n&&(e(new A(n,t)),!0)}}function O(e,t){const n=l.PromiseProvider.get();if("function"!=typeof t)return n.reject(e);t(e)}function _(e){var t,n;return"boolean"==typeof e.s.options.forceServerObjectId?e.s.options.forceServerObjectId:"boolean"==typeof(null===(t=e.s.collection.s.db.options)||void 0===t?void 0:t.forceServerObjectId)&&(null===(n=e.s.collection.s.db.options)||void 0===n?void 0:n.forceServerObjectId)}function w(e){return e.batchType===t.BatchType.INSERT}function D(e){return e.batchType===t.BatchType.UPDATE}function B(e){return e.batchType===t.BatchType.DELETE}function T(e){let{currentOp:t}=e.s;return e.s.currentOp=void 0,t||(t={}),t}t.BulkOperationBase=S,Object.defineProperty(S.prototype,"length",{enumerable:!0,get(){return this.s.currentIndex}})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.compareTopologyVersion=t.parseServerType=t.ServerDescription=void 0;const r=n(4),o=n(2),i=n(12),s=new Set([i.ServerType.RSPrimary,i.ServerType.Standalone,i.ServerType.Mongos,i.ServerType.LoadBalancer]),u=new Set([i.ServerType.RSPrimary,i.ServerType.RSSecondary,i.ServerType.Mongos,i.ServerType.Standalone,i.ServerType.LoadBalancer]);function a(e,t){return(null==t?void 0:t.loadBalanced)?i.ServerType.LoadBalancer:e&&e.ok?e.isreplicaset?i.ServerType.RSGhost:e.msg&&"isdbgrid"===e.msg?i.ServerType.Mongos:e.setName?e.hidden?i.ServerType.RSOther:e.isWritablePrimary?i.ServerType.RSPrimary:e.secondary?i.ServerType.RSSecondary:e.arbiterOnly?i.ServerType.RSArbiter:i.ServerType.RSOther:i.ServerType.Standalone:i.ServerType.Unknown}function c(e,t){if(null==e||null==t)return-1;if(e.processId.equals(t.processId)){const n=r.Long.isLong(e.counter)?e.counter:r.Long.fromNumber(e.counter),o=r.Long.isLong(t.counter)?e.counter:r.Long.fromNumber(t.counter);return n.compare(o)}return-1}t.ServerDescription=class{constructor(e,t,n){var r,i,s,u,c,l,d,f,p,h,m,g;"string"==typeof e?(this._hostAddress=new o.HostAddress(e),this.address=this._hostAddress.toString()):(this._hostAddress=e,this.address=this._hostAddress.toString()),this.type=a(t,n),this.hosts=null!==(i=null===(r=null==t?void 0:t.hosts)||void 0===r?void 0:r.map(e=>e.toLowerCase()))&&void 0!==i?i:[],this.passives=null!==(u=null===(s=null==t?void 0:t.passives)||void 0===s?void 0:s.map(e=>e.toLowerCase()))&&void 0!==u?u:[],this.arbiters=null!==(l=null===(c=null==t?void 0:t.arbiters)||void 0===c?void 0:c.map(e=>e.toLowerCase()))&&void 0!==l?l:[],this.tags=null!==(d=null==t?void 0:t.tags)&&void 0!==d?d:{},this.minWireVersion=null!==(f=null==t?void 0:t.minWireVersion)&&void 0!==f?f:0,this.maxWireVersion=null!==(p=null==t?void 0:t.maxWireVersion)&&void 0!==p?p:0,this.roundTripTime=null!==(h=null==n?void 0:n.roundTripTime)&&void 0!==h?h:-1,this.lastUpdateTime=(0,o.now)(),this.lastWriteDate=null!==(g=null===(m=null==t?void 0:t.lastWrite)||void 0===m?void 0:m.lastWriteDate)&&void 0!==g?g:0,(null==n?void 0:n.topologyVersion)?this.topologyVersion=n.topologyVersion:(null==t?void 0:t.topologyVersion)&&(this.topologyVersion=t.topologyVersion),(null==n?void 0:n.error)&&(this.error=n.error),(null==t?void 0:t.primary)&&(this.primary=t.primary),(null==t?void 0:t.me)&&(this.me=t.me.toLowerCase()),(null==t?void 0:t.setName)&&(this.setName=t.setName),(null==t?void 0:t.setVersion)&&(this.setVersion=t.setVersion),(null==t?void 0:t.electionId)&&(this.electionId=t.electionId),(null==t?void 0:t.logicalSessionTimeoutMinutes)&&(this.logicalSessionTimeoutMinutes=t.logicalSessionTimeoutMinutes),(null==t?void 0:t.$clusterTime)&&(this.$clusterTime=t.$clusterTime)}get hostAddress(){return this._hostAddress?this._hostAddress:new o.HostAddress(this.address)}get allHosts(){return this.hosts.concat(this.arbiters).concat(this.passives)}get isReadable(){return this.type===i.ServerType.RSSecondary||this.isWritable}get isDataBearing(){return u.has(this.type)}get isWritable(){return s.has(this.type)}get host(){const e=`:${this.port}`.length;return this.address.slice(0,-e)}get port(){const e=this.address.split(":").pop();return e?Number.parseInt(e,10):27017}equals(e){const t=this.topologyVersion===e.topologyVersion||0===c(this.topologyVersion,e.topologyVersion),n=this.electionId&&e.electionId?e.electionId&&this.electionId.equals(e.electionId):this.electionId===e.electionId;return null!=e&&(0,o.errorStrictEqual)(this.error,e.error)&&this.type===e.type&&this.minWireVersion===e.minWireVersion&&(0,o.arrayStrictEqual)(this.hosts,e.hosts)&&function(e,t){const n=Object.keys(e),r=Object.keys(t);return n.length===r.length&&n.every(n=>t[n]===e[n])}(this.tags,e.tags)&&this.setName===e.setName&&this.setVersion===e.setVersion&&n&&this.primary===e.primary&&this.logicalSessionTimeoutMinutes===e.logicalSessionTimeoutMinutes&&t}},t.parseServerType=a,t.compareTopologyVersion=c},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.IndexInformationOperation=t.IndexExistsOperation=t.ListIndexesCursor=t.ListIndexesOperation=t.DropIndexesOperation=t.DropIndexOperation=t.EnsureIndexOperation=t.CreateIndexOperation=t.CreateIndexesOperation=t.IndexesOperation=void 0;const r=n(22),o=n(1),i=n(6),s=n(2),u=n(5),a=n(164),c=n(14),l=n(3),d=new Set(["background","unique","name","partialFilterExpression","sparse","hidden","expireAfterSeconds","storageEngine","collation","version","weights","default_language","language_override","textIndexVersion","2dsphereIndexVersion","bits","min","max","bucketSize","wildcardProjection"]);function f(e,t){const n=(0,s.parseIndexOptions)(e),r={name:"string"==typeof t.name?t.name:n.name,key:n.fieldHash};for(const e in t)d.has(e)&&(r[e]=t[e]);return r}class p extends l.AbstractOperation{constructor(e,t){super(t),this.options=t,this.collection=e}execute(e,t,n){const r=this.collection,o=this.options;(0,a.indexInformation)(r.s.db,r.collectionName,{full:!0,...o,readPreference:this.readPreference,session:t},n)}}t.IndexesOperation=p;class h extends u.CommandOperation{constructor(e,t,n,r){super(e,r),this.options=null!=r?r:{},this.collectionName=t,this.indexes=n}execute(e,t,n){const r=this.options,i=this.indexes,u=(0,s.maxWireVersion)(e);for(let t=0;t<i.length;t++){if(i[t].collation&&u<5)return void n(new o.MongoCompatibilityError(`Server ${e.name}, which reports wire version ${u}, `+"does not support collation"));if(null==i[t].name){const e=[];for(const n in i[t].key)e.push(`${n}_${i[t].key[n]}`);i[t].name=e.join("_")}}const a={createIndexes:this.collectionName,indexes:i};if(null!=r.commitQuorum){if(u<9)return void n(new o.MongoCompatibilityError("Option `commitQuorum` for `createIndexes` not supported on servers < 4.4"));a.commitQuorum=r.commitQuorum}this.options.collation=void 0,super.executeCommand(e,t,a,e=>{if(e)return void n(e);const t=i.map(e=>e.name||"");n(void 0,t)})}}t.CreateIndexesOperation=h;class m extends h{constructor(e,t,n,r){super(e,t,[f(n,r)],r)}execute(e,t,n){super.execute(e,t,(e,t)=>e||!t?n(e):n(void 0,t[0]))}}t.CreateIndexOperation=m;class g extends m{constructor(e,t,n,r){super(e,t,n,r),this.readPreference=i.ReadPreference.primary,this.db=e,this.collectionName=t}execute(e,t,n){const r=this.indexes[0].name;this.db.collection(this.collectionName).listIndexes({session:t}).toArray((i,s)=>{if(i&&i.code!==o.MONGODB_ERROR_CODES.NamespaceNotFound)return n(i);s&&(s=Array.isArray(s)?s:[s]).some(e=>e.name===r)?n(void 0,r):super.execute(e,t,n)})}}t.EnsureIndexOperation=g;class E extends u.CommandOperation{constructor(e,t,n){super(e,n),this.options=null!=n?n:{},this.collection=e,this.indexName=t}execute(e,t,n){const r={dropIndexes:this.collection.collectionName,index:this.indexName};super.executeCommand(e,t,r,n)}}t.DropIndexOperation=E;class y extends E{constructor(e,t){super(e,"*",t)}execute(e,t,n){super.execute(e,t,e=>{if(e)return n(e,!1);n(void 0,!0)})}}t.DropIndexesOperation=y;class v extends u.CommandOperation{constructor(e,t){super(e,t),this.options=null!=t?t:{},this.collectionNamespace=e.s.namespace}execute(e,t,n){const r=(0,s.maxWireVersion)(e),o=this.options.batchSize?{batchSize:this.options.batchSize}:{},i={listIndexes:this.collectionNamespace.collection,cursor:o};r>=9&&void 0!==this.options.comment&&(i.comment=this.options.comment),super.executeCommand(e,t,i,n)}}t.ListIndexesOperation=v;class A extends r.AbstractCursor{constructor(e,t){super(e.s.db.s.client,e.s.namespace,t),this.parent=e,this.options=t}clone(){return new A(this.parent,{...this.options,...this.cursorOptions})}_initialize(e,t){const n=new v(this.parent,{...this.cursorOptions,...this.options,session:e});(0,c.executeOperation)(this.parent.s.db.s.client,n,(r,o)=>{if(r||null==o)return t(r);t(void 0,{server:n.server,session:e,response:o})})}}t.ListIndexesCursor=A;class b extends l.AbstractOperation{constructor(e,t,n){super(n),this.options=n,this.collection=e,this.indexes=t}execute(e,t,n){const r=this.collection,o=this.indexes;(0,a.indexInformation)(r.s.db,r.collectionName,{...this.options,readPreference:this.readPreference,session:t},(e,t)=>{if(null!=e)return n(e);if(!Array.isArray(o))return n(void 0,null!=t[o]);for(let e=0;e<o.length;e++)if(null==t[o[e]])return n(void 0,!1);return n(void 0,!0)})}}t.IndexExistsOperation=b;class C extends l.AbstractOperation{constructor(e,t,n){super(n),this.options=null!=n?n:{},this.db=e,this.name=t}execute(e,t,n){const r=this.db,o=this.name;(0,a.indexInformation)(r,o,{...this.options,readPreference:this.readPreference,session:t},n)}}t.IndexInformationOperation=C,(0,l.defineAspects)(v,[l.Aspect.READ_OPERATION,l.Aspect.RETRYABLE,l.Aspect.CURSOR_CREATING]),(0,l.defineAspects)(h,[l.Aspect.WRITE_OPERATION]),(0,l.defineAspects)(m,[l.Aspect.WRITE_OPERATION]),(0,l.defineAspects)(g,[l.Aspect.WRITE_OPERATION]),(0,l.defineAspects)(E,[l.Aspect.WRITE_OPERATION]),(0,l.defineAspects)(y,[l.Aspect.WRITE_OPERATION])},function(e,t){e.exports=require("fs")},function(e,t,n){"use strict";class r extends Error{constructor(e){super(e),this.name="MongoCryptError",Error.captureStackTrace(this,this.constructor)}}e.exports={debug:function(e){process.env.MONGODB_CRYPT_DEBUG&&console.error(e)},databaseNamespace:function(e){return e.split(".")[0]},collectionNamespace:function(e){return e.split(".").slice(1).join(".")},MongoCryptError:r,promiseOrCallback:function(e,t){if("function"!=typeof e)return new Promise((e,n)=>{t((function(t,r){return null!=t?n(t):arguments.length>2?e(Array.prototype.slice.call(arguments,1)):void e(r)}))});t((function(t){if(null==t)e.apply(this,arguments);else try{e(t)}catch(e){return process.nextTick(()=>{throw e})}}))}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.hasSessionSupport=t.CryptoConnection=t.Connection=void 0;const r=n(21),o=n(4),i=n(8),s=n(1),u=n(9),a=n(99),c=n(2),l=n(188),d=n(114),f=n(419),p=n(420),h=n(167),m=Symbol("stream"),g=Symbol("queue"),E=Symbol("messageStream"),y=Symbol("generation"),v=Symbol("lastUseTime"),A=Symbol("clusterTime"),b=Symbol("description"),C=Symbol("hello"),S=Symbol("autoEncrypter"),O=Symbol("fullResult"),_=Symbol("delayedTimeoutId");class w extends u.TypedEventEmitter{constructor(e,t){var n,r;super(),this.id=t.id,this.address=function(e,t){if(t.proxyHost)return t.hostAddress.toString();if("function"==typeof e.address)return`${e.remoteAddress}:${e.remotePort}`;return(0,c.uuidV4)().toString("hex")}(e,t),this.socketTimeoutMS=null!==(n=t.socketTimeoutMS)&&void 0!==n?n:0,this.monitorCommands=t.monitorCommands,this.serverApi=t.serverApi,this.closed=!1,this.destroyed=!1,this[C]=null,this[A]=null,this[b]=new p.StreamDescription(this.address,t),this[y]=t.generation,this[v]=(0,c.now)(),this[g]=new Map,this[E]=new f.MessageStream({...t,maxBsonMessageSize:null===(r=this.hello)||void 0===r?void 0:r.maxBsonMessageSize}),this[m]=e,this[_]=null,this[E].on("message",e=>this.onMessage(e)),this[E].on("error",e=>this.onError(e)),this[m].on("close",()=>this.onClose()),this[m].on("timeout",()=>this.onTimeout()),this[m].on("error",()=>{}),this[m].pipe(this[E]),this[E].pipe(this[m])}get description(){return this[b]}get hello(){return this[C]}set hello(e){this[b].receiveResponse(e),this[b]=Object.freeze(this[b]),this[C]=e}set isMonitoringConnection(e){this[E].isMonitoringConnection=e}get isMonitoringConnection(){return this[E].isMonitoringConnection}get serviceId(){var e;return null===(e=this.hello)||void 0===e?void 0:e.serviceId}get loadBalanced(){return this.description.loadBalanced}get generation(){return this[y]||0}set generation(e){this[y]=e}get idleTime(){return(0,c.calculateDurationInMs)(this[v])}get clusterTime(){return this[A]}get stream(){return this[m]}markAvailable(){this[v]=(0,c.now)()}onError(e){if(!this.closed){this[m].destroy(e),this.closed=!0;for(const t of this[g].values())t.cb(e);this[g].clear(),this.emit(w.CLOSE)}}onClose(){if(this.closed)return;this.closed=!0;const e=`connection ${this.id} to ${this.address} closed`;for(const t of this[g].values())t.cb(new s.MongoNetworkError(e));this[g].clear(),this.emit(w.CLOSE)}onTimeout(){this.closed||(this[_]=(0,r.setTimeout)(()=>{this[m].destroy(),this.closed=!0;const e=`connection ${this.id} to ${this.address} timed out`,t=null==this.hello;for(const n of this[g].values())n.cb(new s.MongoNetworkTimeoutError(e,{beforeHandshake:t}));this[g].clear(),this.emit(w.CLOSE)},1).unref())}onMessage(e){const t=this[_];null!=t&&(clearTimeout(t),this[_]=null),this.emit("message",e);const n=this[g].get(e.responseTo);if(!n)return;const r=n.cb;this[g].delete(e.responseTo),"moreToCome"in e&&e.moreToCome?this[g].set(e.requestId,n):n.socketTimeoutOverride&&this[m].setTimeout(this.socketTimeoutMS);try{e.parse(n)}catch(e){return void r(e)}if(e.documents[0]){const t=e.documents[0],o=n.session;if(o&&(0,a.updateSessionFromResponse)(o,t),t.$clusterTime&&(this[A]=t.$clusterTime,this.emit(w.CLUSTER_TIME_RECEIVED,t.$clusterTime)),n.command){if(t.writeConcernError)return void r(new s.MongoWriteConcernError(t.writeConcernError,t));if(0===t.ok||t.$err||t.errmsg||t.code)return void r(new s.MongoServerError(t))}else if(0===t.ok||t.$err||t.errmsg)return void r(new s.MongoServerError(t))}r(void 0,n.fullResult?e:e.documents[0])}destroy(e,t){return"function"==typeof e&&(t=e,e={force:!1}),this.removeAllListeners(w.PINNED),this.removeAllListeners(w.UNPINNED),e=Object.assign({force:!1},e),null==this[m]||this.destroyed?(this.destroyed=!0,void("function"==typeof t&&t())):e.force?(this[m].destroy(),this.destroyed=!0,void("function"==typeof t&&t())):void this[m].end(()=>{this.destroyed=!0,"function"==typeof t&&t()})}command(e,t,n,r){if(!(e instanceof c.MongoDBNamespace))throw new s.MongoRuntimeError("Must provide a MongoDBNamespace instance");const o=(0,h.getReadPreference)(t,n),i=function(e){const t=e.description;if(null==t)return!1;return(0,c.maxWireVersion)(e)>=6&&!t.__nodejs_mock_server__}(this),u=null==n?void 0:n.session;let l=this.clusterTime,f=Object.assign({},t);if(this.serverApi){const{version:e,strict:t,deprecationErrors:n}=this.serverApi;f.apiVersion=e,null!=t&&(f.apiStrict=t),null!=n&&(f.apiDeprecationErrors=n)}if(D(this)&&u){u.clusterTime&&l&&u.clusterTime.clusterTime.greaterThan(l.clusterTime)&&(l=u.clusterTime);const e=(0,a.applySession)(u,f,n);if(e)return r(e)}l&&(f.$clusterTime=l),(0,h.isSharded)(this)&&!i&&o&&"primary"!==o.mode&&(f={$query:f,$readPreference:o.toJSON()});const p=Object.assign({command:!0,numberToSkip:0,numberToReturn:-1,checkKeys:!1,secondaryOk:o.secondaryOk()},n),m=`${e.db}.$cmd`,g=i?new d.Msg(m,f,p):new d.Query(m,f,p);try{B(this,g,p,r)}catch(e){r(e)}}getMore(e,t,n,r){const i=!!n[O],u=(0,c.maxWireVersion)(this);if(!t)return void r(new s.MongoRuntimeError("Invalid internal cursor state, no known cursor id"));if(u<4){const s=new d.GetMore(e.toString(),t,{numberToReturn:n.batchSize}),u=(0,h.applyCommonQueryOptions)({},Object.assign(n,{...(0,o.pluckBSONSerializeOptions)(n)}));return u[O]=!0,u.command=!0,void B(this,s,u,(e,t)=>i?r(e,t):e?r(e):void r(void 0,{cursor:{id:t.cursorId,nextBatch:t.documents}}))}const a={getMore:t,collection:e.collection};"number"==typeof n.batchSize&&(a.batchSize=Math.abs(n.batchSize)),"number"==typeof n.maxAwaitTimeMS&&(a.maxTimeMS=n.maxAwaitTimeMS),void 0!==n.comment&&(a.comment=n.comment);const l=Object.assign({returnFieldSelector:null,documentsReturnedIn:"nextBatch"},n);this.command(e,a,l,r)}killCursors(e,t,n,r){if(!t||!Array.isArray(t))throw new s.MongoRuntimeError(`Invalid list of cursor ids provided: ${t}`);if((0,c.maxWireVersion)(this)<4)try{B(this,new d.KillCursor(e.toString(),t),{noResponse:!0,...n},r)}catch(e){r(e)}else this.command(e,{killCursors:e.collection,cursors:t},{[O]:!0,...n},(e,n)=>e||!n?r(e):n.cursorNotFound?r(new s.MongoNetworkError("cursor killed or timed out"),null):Array.isArray(n.documents)&&0!==n.documents.length?void r(void 0,n.documents[0]):r(new s.MongoRuntimeError(`invalid killCursors result returned for cursor id ${t[0]}`)))}}t.Connection=w,w.COMMAND_STARTED=i.COMMAND_STARTED,w.COMMAND_SUCCEEDED=i.COMMAND_SUCCEEDED,w.COMMAND_FAILED=i.COMMAND_FAILED,w.CLUSTER_TIME_RECEIVED=i.CLUSTER_TIME_RECEIVED,w.CLOSE=i.CLOSE,w.MESSAGE=i.MESSAGE,w.PINNED=i.PINNED,w.UNPINNED=i.UNPINNED;function D(e){const t=e.description;return null!=t.logicalSessionTimeoutMinutes||!!t.loadBalanced}function B(e,t,n,r){"function"==typeof n&&(r=n),n=null!=n?n:{};const o={requestId:t.requestId,cb:r,session:n.session,fullResult:!!n[O],noResponse:"boolean"==typeof n.noResponse&&n.noResponse,documentsReturnedIn:n.documentsReturnedIn,command:!!n.command,promoteLongs:"boolean"!=typeof n.promoteLongs||n.promoteLongs,promoteValues:"boolean"!=typeof n.promoteValues||n.promoteValues,promoteBuffers:"boolean"==typeof n.promoteBuffers&&n.promoteBuffers,bsonRegExp:"boolean"==typeof n.bsonRegExp&&n.bsonRegExp,enableUtf8Validation:"boolean"!=typeof n.enableUtf8Validation||n.enableUtf8Validation,raw:"boolean"==typeof n.raw&&n.raw,started:0};e[b]&&e[b].compressor&&(o.agreedCompressor=e[b].compressor,e[b].zlibCompressionLevel&&(o.zlibCompressionLevel=e[b].zlibCompressionLevel)),"number"==typeof n.socketTimeoutMS&&(o.socketTimeoutOverride=!0,e[m].setTimeout(n.socketTimeoutMS)),e.monitorCommands&&(e.emit(w.COMMAND_STARTED,new l.CommandStartedEvent(e,t)),o.started=(0,c.now)(),o.cb=(n,i)=>{n?e.emit(w.COMMAND_FAILED,new l.CommandFailedEvent(e,t,n,o.started)):i&&(0===i.ok||i.$err)?e.emit(w.COMMAND_FAILED,new l.CommandFailedEvent(e,t,i,o.started)):e.emit(w.COMMAND_SUCCEEDED,new l.CommandSucceededEvent(e,t,i,o.started)),"function"==typeof r&&r(n,i)}),o.noResponse||e[g].set(o.requestId,o);try{e[E].writeCommand(t,o)}catch(t){if(!o.noResponse)return e[g].delete(o.requestId),void o.cb(t)}o.noResponse&&o.cb()}t.CryptoConnection=class extends w{constructor(e,t){super(e,t),this[S]=t.autoEncrypter}command(e,t,n,r){const o=this[S];if(!o)return r(new s.MongoMissingDependencyError("No AutoEncrypter available for encryption"));const i=(0,c.maxWireVersion)(this);if(0===i)return super.command(e,t,n,r);i<8?r(new s.MongoCompatibilityError("Auto-encryption requires a minimum MongoDB version of 4.2")):o.encrypt(e.toString(),t,n,(t,i)=>{t||null==i?r(t,null):super.command(e,i,n,(e,t)=>{e||null==t?r(e,t):o.decrypt(t,n,r)})})}},t.hasSessionSupport=D},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.redisSplitterOptions=t.noSplitSplitterOptions=t.mongoSplitterOptions=t.sqliteSplitterOptions=t.postgreSplitterOptions=t.mssqlSplitterOptions=t.mysqlSplitterOptions=t.defaultSplitterOptions=void 0,t.defaultSplitterOptions={stringsBegins:["'"],stringsEnds:{"'":"'"},stringEscapes:{"'":"'"},allowSemicolon:!0,allowCustomDelimiter:!1,allowGoDelimiter:!1,allowDollarDollarString:!1,noSplit:!1,doubleDashComments:!0,multilineComments:!0,javaScriptComments:!1,returnRichInfo:!1,splitByLines:!1},t.mysqlSplitterOptions=Object.assign(Object.assign({},t.defaultSplitterOptions),{allowCustomDelimiter:!0,stringsBegins:["'","`"],stringsEnds:{"'":"'","`":"`"},stringEscapes:{"'":"\\","`":"`"}}),t.mssqlSplitterOptions=Object.assign(Object.assign({},t.defaultSplitterOptions),{allowSemicolon:!1,allowGoDelimiter:!0,stringsBegins:["'","["],stringsEnds:{"'":"'","[":"]"},stringEscapes:{"'":"'"}}),t.postgreSplitterOptions=Object.assign(Object.assign({},t.defaultSplitterOptions),{allowDollarDollarString:!0,stringsBegins:["'",'"'],stringsEnds:{"'":"'",'"':'"'},stringEscapes:{"'":"'",'"':'"'}}),t.sqliteSplitterOptions=Object.assign(Object.assign({},t.defaultSplitterOptions),{stringsBegins:["'",'"'],stringsEnds:{"'":"'",'"':'"'},stringEscapes:{"'":"'",'"':'"'}}),t.mongoSplitterOptions=Object.assign(Object.assign({},t.defaultSplitterOptions),{stringsBegins:["'",'"'],stringsEnds:{"'":"'",'"':'"'},stringEscapes:{"'":"\\",'"':"\\"}}),t.noSplitSplitterOptions=Object.assign(Object.assign({},t.defaultSplitterOptions),{noSplit:!0}),t.redisSplitterOptions=Object.assign(Object.assign({},t.defaultSplitterOptions),{splitByLines:!0})},function(e,t,n){var r=n(117);e.exports=function(e){return r(e,5)}},function(e,t,n){var r=n(46),o=n(209),i=n(210),s=n(211),u=n(212),a=n(213);function c(e){var t=this.__data__=new r(e);this.size=t.size}c.prototype.clear=o,c.prototype.delete=i,c.prototype.get=s,c.prototype.has=u,c.prototype.set=a,e.exports=c},function(e,t,n){var r=n(20)(n(15),"Map");e.exports=r},function(e,t,n){var r=n(220),o=n(227),i=n(229),s=n(230),u=n(231);function a(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}a.prototype.clear=r,a.prototype.delete=o,a.prototype.get=i,a.prototype.has=s,a.prototype.set=u,e.exports=a},function(e,t,n){var r=n(73),o=n(48),i=Object.prototype.hasOwnProperty;e.exports=function(e,t,n){var s=e[t];i.call(e,t)&&o(s,n)&&(void 0!==n||t in e)||r(e,t,n)}},function(e,t,n){var r=n(121);e.exports=function(e,t,n){"__proto__"==t&&r?r(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}},function(e,t,n){var r=n(235),o=n(10),i=Object.prototype,s=i.hasOwnProperty,u=i.propertyIsEnumerable,a=r(function(){return arguments}())?r:function(e){return o(e)&&s.call(e,"callee")&&!u.call(e,"callee")};e.exports=a},function(e,t,n){(function(e){var r=n(15),o=n(236),i=t&&!t.nodeType&&t,s=i&&"object"==typeof e&&e&&!e.nodeType&&e,u=s&&s.exports===i?r.Buffer:void 0,a=(u?u.isBuffer:void 0)||o;e.exports=a}).call(this,n(45)(e))},function(e,t){e.exports=function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991}},function(e,t){var n=Object.prototype;e.exports=function(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||n)}},function(e,t,n){var r=n(122),o=n(241),i=n(28);e.exports=function(e){return i(e)?r(e,!0):o(e)}},function(e,t,n){var r=n(246),o=n(125),i=Object.prototype.propertyIsEnumerable,s=Object.getOwnPropertySymbols,u=s?function(e){return null==e?[]:(e=Object(e),r(s(e),(function(t){return i.call(e,t)})))}:o;e.exports=u},function(e,t){e.exports=function(e,t){for(var n=-1,r=t.length,o=e.length;++n<r;)e[o+n]=t[n];return e}},function(e,t,n){var r=n(124)(Object.getPrototypeOf,Object);e.exports=r},function(e,t,n){var r=n(131);e.exports=function(e){var t=new e.constructor(e.byteLength);return new r(t).set(new r(e)),t}},function(e,t,n){var r=n(7),o=n(54),i=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,s=/^\w*$/;e.exports=function(e,t){if(r(e))return!1;var n=typeof e;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=e&&!o(e))||(s.test(e)||!i.test(e)||null!=t&&e in Object(t))}},function(e,t,n){var r=n(71),o=n(288),i=n(289);function s(e){var t=-1,n=null==e?0:e.length;for(this.__data__=new r;++t<n;)this.add(e[t])}s.prototype.add=s.prototype.push=o,s.prototype.has=i,e.exports=s},function(e,t){e.exports=function(e,t){return e.has(t)}},function(e,t,n){"use strict";var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{a(r.next(e))}catch(e){i(e)}}function u(e){try{a(r.throw(e))}catch(e){i(e)}}function a(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,u)}a((r=r.apply(e,t||[])).next())}))},o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.DatabaseAnalyser=void 0;const i=o(n(300)),s=o(n(326)),u=o(n(147)),a=o(n(41)),c=["tables","collections","views","matviews","functions","procedures","triggers"],l=e=>t=>(0,u.default)(t,e);class d{constructor(e,t,n){this.pool=e,this.driver=t,this.singleObjectId=null,this.dialect=(null==t?void 0:t.dialectByVersion)&&(null==t?void 0:t.dialectByVersion(n))||(null==t?void 0:t.dialect)}_runAnalysis(){return r(this,void 0,void 0,(function*(){return d.createEmptyStructure()}))}_getFastSnapshot(){return r(this,void 0,void 0,(function*(){return null}))}_computeSingleObjectId(){return r(this,void 0,void 0,(function*(){}))}addEngineField(e){var t;if(null===(t=this.driver)||void 0===t?void 0:t.engine){for(const t of c)if(e[t])for(const n of e[t])n.engine=this.driver.engine;return e.engine=this.driver.engine,e}}fullAnalysis(){return r(this,void 0,void 0,(function*(){return this.addEngineField(yield this._runAnalysis())}))}singleObjectAnalysis(e,t){var n,o;return r(this,void 0,void 0,(function*(){this.singleObjectFilter=Object.assign(Object.assign({},e),{typeField:t}),yield this._computeSingleObjectId();const r=this.addEngineField(yield this._runAnalysis());return 1==(null===(n=r[t])||void 0===n?void 0:n.length)?r[t][0]:null===(o=r[t])||void 0===o?void 0:o.find(t=>t.pureName==e.pureName&&t.schemaName==e.schemaName)}))}incrementalAnalysis(e){return r(this,void 0,void 0,(function*(){this.structure=e;const t=yield this.getModifications();if(null==t)return this.structure=null,this.addEngineField(yield this._runAnalysis());const n=t.filter(e=>"setTableRowCounts"!=e.action),r=t.find(e=>"setTableRowCounts"==e.action);let o=null;if(r){const t=(i=e,s=r.rowCounts,Object.assign(Object.assign({},i),{tables:(i.tables||[]).map(e=>{var t,n;return Object.assign(Object.assign({},e),{tableRowCount:null!==(n=null===(t=s.find(t=>t.objectId==e.objectId))||void 0===t?void 0:t.tableRowCount)&&void 0!==n?n:e.tableRowCount})})}));(function(e,t){for(const n of e.tables||[]){const e=(t.tables||[]).find(e=>e.objectId==n.objectId);if((null==n?void 0:n.tableRowCount)!==(null==e?void 0:e.tableRowCount))return!0}return!1})(e,t)&&(o=t)}var i,s;return 0==n.length?o?this.addEngineField(o):null:(this.modifications=n,o&&(this.structure=o),console.log("DB modifications detected:",this.modifications),this.addEngineField(this.mergeAnalyseResult(yield this._runAnalysis())))}))}mergeAnalyseResult(e){if(null==this.structure)return Object.assign(Object.assign({},d.createEmptyStructure()),e);const t={};for(const n of c){const r=this.modifications.filter(e=>"remove"==e.action&&e.objectTypeField==n).map(e=>e.objectId),o=e[n]||[],s=[...r,...o.map(e=>e.objectId)];t[n]=(0,i.default)([...(this.structure[n]||[]).filter(e=>!s.includes(e.objectId)),...o],e=>e.pureName);for(const e of t[n]){const t=(this.structure[n]||[]).find(t=>t.objectId==e.objectId);if(t)for(const n in t)e[n]||(e[n]=t[n])}}return t}getRequestedObjectPureNames(e,t){if(this.singleObjectFilter){const{typeField:t,pureName:n}=this.singleObjectFilter;if(t==e)return[n]}return this.modifications?this.modifications.filter(t=>t.objectTypeField==e).filter(e=>e.newName).map(e=>e.newName.pureName):t}containsObjectIdCondition(e){return" is not null"!=this.createQueryCore("=OBJECT_ID_CONDITION",e)}createQuery(e,t){return this.createQueryCore(e,t)}createQueryCore(e,t){if(this.singleObjectFilter){const{typeField:n}=this.singleObjectFilter;return this.singleObjectId&&(t&&t.includes(n))?e.replace(/=OBJECT_ID_CONDITION/g,` = '${this.singleObjectId}'`):null}if(!this.modifications||!t||0==this.modifications.length)return e.replace(/=OBJECT_ID_CONDITION/g," is not null");if(this.modifications.some(e=>t.includes(e.objectTypeField)&&"all"==e.action))return e.replace(/=OBJECT_ID_CONDITION/g," is not null");const n=this.modifications.filter(e=>t.includes(e.objectTypeField)&&("add"==e.action||"change"==e.action)).map(e=>e.objectId);return 0==n.length?e.replace(/=OBJECT_ID_CONDITION/g," = '0'"):e.replace(/=OBJECT_ID_CONDITION/g,` in (${n.map(e=>`'${e}'`).join(",")})`)}getDeletedObjectsForField(e,t){const n=e[t];return n&&this.structure[t]?this.structure[t].filter(e=>!n.find(t=>e.objectId==t.objectId)).map(e=>({oldName:(0,u.default)(e,["schemaName","pureName"]),objectId:e.objectId,action:"remove",objectTypeField:t})):[]}getDeletedObjects(e){return[...this.getDeletedObjectsForField(e,"tables"),...this.getDeletedObjectsForField(e,"collections"),...this.getDeletedObjectsForField(e,"views"),...this.getDeletedObjectsForField(e,"matviews"),...this.getDeletedObjectsForField(e,"procedures"),...this.getDeletedObjectsForField(e,"functions"),...this.getDeletedObjectsForField(e,"triggers")]}feedback(e){this.pool.feedback&&this.pool.feedback(e)}getModifications(){return r(this,void 0,void 0,(function*(){const e=yield this._getFastSnapshot();if(!e)return null;const t=[];for(const n in e){const r=e[n];if(null!==r){if(void 0!==r)for(const e of r){const{objectId:r,schemaName:o,pureName:i,contentHash:s}=e,a=this.structure[n].find(e=>e.objectId==r);if(a&&s&&a.contentHash==s)continue;const c=a?{newName:{schemaName:o,pureName:i},oldName:(0,u.default)(a,["schemaName","pureName"]),action:"change",objectTypeField:n,objectId:r}:{newName:{schemaName:o,pureName:i},action:"add",objectTypeField:n,objectId:r};t.push(c)}}else t.push({objectTypeField:n,action:"all"})}const n=(e.tables||[]).filter(e=>null!=e.tableRowCount).map(e=>({objectId:e.objectId,tableRowCount:e.tableRowCount}));return n.length>0&&t.push({action:"setTableRowCounts",rowCounts:n}),[...(0,a.default)(t),...this.getDeletedObjects(e)]}))}safeQuery(e){return r(this,void 0,void 0,(function*(){try{return yield this.driver.query(this.pool,e)}catch(e){return console.log("Error running analyser query",e.message),{rows:[]}}}))}static createEmptyStructure(){return{tables:[],collections:[],views:[],matviews:[],functions:[],procedures:[],triggers:[],schemas:[]}}static byTableFilter(e){return t=>t.pureName==e.pureName&&t.schemaName==t.schemaName}static extractPrimaryKeys(e,t){const n=t.filter(d.byTableFilter(e));if(0!=n.length)return Object.assign(Object.assign({},(0,u.default)(n[0],["constraintName","schemaName","pureName"])),{constraintType:"primaryKey",columns:n.map(l("columnName"))})}static extractForeignKeys(e,t){const n=(0,s.default)(t.filter(d.byTableFilter(e)),"constraintName");return Object.keys(n).map(e=>Object.assign(Object.assign({constraintName:e,constraintType:"foreignKey"},(0,u.default)(n[e][0],["constraintName","schemaName","pureName","refSchemaName","refTableName","updateAction","deleteAction"])),{columns:n[e].map(l(["columnName","refColumnName"]))}))}}t.DatabaseAnalyser=d},function(e,t,n){var r=n(303),o=n(311),i=n(56),s=n(7),u=n(314);e.exports=function(e){return"function"==typeof e?e:null==e?i:"object"==typeof e?s(e)?o(e[0],e[1]):r(e):u(e)}},function(e,t,n){var r=n(305),o=n(10);e.exports=function e(t,n,i,s,u){return t===n||(null==t||null==n||!o(t)&&!o(n)?t!=t&&n!=n:r(t,n,i,s,e,u))}},function(e,t){e.exports=function(e){var t=-1,n=Array(e.size);return e.forEach((function(e){n[++t]=e})),n}},function(e,t,n){var r=n(17),o=n(10);e.exports=function(e){return"number"==typeof e||o(e)&&"[object Number]"==r(e)}},function(e,t,n){var r,o,i=n(336),s=n(337),u=0,a=0;e.exports=function(e,t,n){var c=t&&n||0,l=t||[],d=(e=e||{}).node||r,f=void 0!==e.clockseq?e.clockseq:o;if(null==d||null==f){var p=i();null==d&&(d=r=[1|p[0],p[1],p[2],p[3],p[4],p[5]]),null==f&&(f=o=16383&(p[6]<<8|p[7]))}var h=void 0!==e.msecs?e.msecs:(new Date).getTime(),m=void 0!==e.nsecs?e.nsecs:a+1,g=h-u+(m-a)/1e4;if(g<0&&void 0===e.clockseq&&(f=f+1&16383),(g<0||h>u)&&void 0===e.nsecs&&(m=0),m>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");u=h,a=m,o=f;var E=(1e4*(268435455&(h+=122192928e5))+m)%4294967296;l[c++]=E>>>24&255,l[c++]=E>>>16&255,l[c++]=E>>>8&255,l[c++]=255&E;var y=h/4294967296*1e4&268435455;l[c++]=y>>>8&255,l[c++]=255&y,l[c++]=y>>>24&15|16,l[c++]=y>>>16&255,l[c++]=f>>>8|128,l[c++]=255&f;for(var v=0;v<6;++v)l[c+v]=d[v];return t||s(l)}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.dumpSqlFromDefinition=t.dumpSqlRelation=t.dumpSqlSourceRef=t.dumpSqlSourceDef=void 0;const r=n(58),o=n(93);function i(e,t){let n=0;if(null!=t.name&&n++,null!=t.subQuery&&n++,null!=t.subQueryString&&n++,1!=n)throw new Error("sqltree.Source should have exactly one source");null!=t.name&&e.put("%f",t.name),t.subQuery&&(e.put("("),(0,r.dumpSqlSelect)(e,t.subQuery),e.put(")")),t.subQueryString&&(e.put("("),e.putRaw(t.subQueryString),e.put(")")),t.alias&&e.put(" %i",t.alias)}function s(e,t){e.put("&n %k ",t.joinType),i(e,t),t.conditions&&t.conditions.length>0&&(e.put(" ^on "),e.putCollection(" ^and ",t.conditions,t=>(0,o.dumpSqlCondition)(e,t)))}t.dumpSqlSourceDef=i,t.dumpSqlSourceRef=function(e,t){return t.alias?(e.put("%i",t.alias),!0):!!t.name&&(e.put("%f",t.name),!0)},t.dumpSqlRelation=s,t.dumpSqlFromDefinition=function(e,t){i(e,t),e.put(" "),t.relations&&t.relations.forEach(t=>s(e,t))}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.dumpSqlCondition=void 0;const r=n(150),o=n(58);t.dumpSqlCondition=function e(t,n){switch(n.conditionType){case"binary":(0,r.dumpSqlExpression)(t,n.left),t.put(" %s ",n.operator),(0,r.dumpSqlExpression)(t,n.right);break;case"isNull":(0,r.dumpSqlExpression)(t,n.expr),t.put(" ^is ^null");break;case"isNotNull":(0,r.dumpSqlExpression)(t,n.expr),t.put(" ^is ^not ^null");break;case"isEmpty":t.put("^trim("),(0,r.dumpSqlExpression)(t,n.expr),t.put(") = ''");break;case"isNotEmpty":t.put("^trim("),(0,r.dumpSqlExpression)(t,n.expr),t.put(") <> ''");break;case"and":case"or":t.putCollection(` ^${n.conditionType} `,n.conditions,n=>{t.putRaw("("),e(t,n),t.putRaw(")")});break;case"like":(0,r.dumpSqlExpression)(t,n.left),t.put(t.dialect.ilike?" ^ilike ":" ^like "),(0,r.dumpSqlExpression)(t,n.right);break;case"notLike":(0,r.dumpSqlExpression)(t,n.left),t.put(" ^not ^like "),(0,r.dumpSqlExpression)(t,n.right);break;case"not":t.put("^not ("),e(t,n.condition),t.put(")");break;case"exists":t.put("^exists ("),(0,o.dumpSqlSelect)(t,n.subQuery),t.put(")");break;case"notExists":t.put("^not ^exists ("),(0,o.dumpSqlSelect)(t,n.subQuery),t.put(")");break;case"between":(0,r.dumpSqlExpression)(t,n.expr),t.put(" ^between "),(0,r.dumpSqlExpression)(t,n.left),t.put(" ^and "),(0,r.dumpSqlExpression)(t,n.right)}}},function(e,t,n){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.modelCompareDbDiffOptions=t.matchPairedObjects=t.getAlterDatabaseScript=t.getAlterTableScript=t.createAlterDatabasePlan=t.createAlterTablePlan=t.testEqualSqlObjects=t.testEqualTables=t.testEqualTypes=t.testEqualColumns=t.generateDbPairingId=t.generateTablePairingId=void 0;const o=r(n(91)),i=n(353),s=r(n(355)),u=r(n(154)),a=r(n(68)),c=r(n(363)),l=r(n(147));function d(e){var t,n,r,i,s;return e?e.pairingId?e:Object.assign(Object.assign({},e),{columns:null===(t=e.columns)||void 0===t?void 0:t.map(e=>Object.assign(Object.assign({},e),{pairingId:e.pairingId||(0,o.default)()})),foreignKeys:null===(n=e.foreignKeys)||void 0===n?void 0:n.map(e=>Object.assign(Object.assign({},e),{pairingId:e.pairingId||(0,o.default)()})),checks:null===(r=e.checks)||void 0===r?void 0:r.map(e=>Object.assign(Object.assign({},e),{pairingId:e.pairingId||(0,o.default)()})),indexes:null===(i=e.indexes)||void 0===i?void 0:i.map(e=>Object.assign(Object.assign({},e),{pairingId:e.pairingId||(0,o.default)()})),uniques:null===(s=e.uniques)||void 0===s?void 0:s.map(e=>Object.assign(Object.assign({},e),{pairingId:e.pairingId||(0,o.default)()})),pairingId:e.pairingId||(0,o.default)()}):e}function f(e){return e.objectTypeField?Object.assign(Object.assign({},e),{pairingId:e.pairingId||(0,o.default)()}):e}function p(e,t,n){return n.ignoreCase?(e||"").toLowerCase()==(t||"").toLowerCase():e==t}function h(e,t,n){return null==e||null==t?e==t:function(e,t,n){return"ignore"==n.schemaMode&&(e=null),"ignoreImplicit"==n.schemaMode&&e==n.leftImplicitSchema&&(e=null),"ignore"==n.schemaMode&&(t=null),"ignoreImplicit"==n.schemaMode&&t==n.rightImplicitSchema&&(t=null),p(e,t,n)}(e.schemaName,t.schemaName,n)&&p(e.pureName,t.pureName,n)}function m(e,t,n,r,o={}){if(n&&!p(e.columnName,t.columnName,o))return!1;if(e.computedExpression!=t.computedExpression)return console.debug(`Column ${e.pureName}.${e.columnName}, ${t.pureName}.${t.columnName}: different computed expression: ${e.computedExpression}, ${t.computedExpression}`),!1;if(null!=e.computedExpression)return!0;if(r){if(null==e.defaultValue){if(e.defaultValue!=t.defaultValue)return console.debug(`Column ${e.pureName}.${e.columnName}, ${t.pureName}.${t.columnName}: different default value: ${e.defaultValue}, ${t.defaultValue}`),!1}else if(e.defaultValue!=t.defaultValue)return console.debug(`Column ${e.pureName}.${e.columnName}, ${t.pureName}.${t.columnName}: different default value: ${e.defaultValue}, ${t.defaultValue}`),!1;if(e.defaultConstraint!=t.defaultConstraint)return console.debug(`Column ${e.pureName}.${e.columnName}, ${t.pureName}.${t.columnName}: different default constraint: ${e.defaultConstraint}, ${t.defaultConstraint}`),!1}return(e.notNull||!1)!=(t.notNull||!1)?(console.debug(`Column ${e.pureName}.${e.columnName}, ${t.pureName}.${t.columnName}: different nullability: ${e.notNull}, ${t.notNull}`),!1):(e.autoIncrement||!1)!=(t.autoIncrement||!1)?(console.debug(`Column ${e.pureName}.${e.columnName}, ${t.pureName}.${t.columnName}: different autoincrement: ${e.autoIncrement}, ${t.autoIncrement}`),!1):(e.isSparse||!1)!=(t.isSparse||!1)?(console.debug(`Column ${e.pureName}.${e.columnName}, ${t.pureName}.${t.columnName}: different is_sparse: ${e.isSparse}, ${t.isSparse}`),!1):(e.isUnsigned||!1)!=(t.isUnsigned||!1)?(console.debug(`Column ${e.pureName}.${e.columnName}, ${t.pureName}.${t.columnName}: different unsigned: ${e.isUnsigned}, ${t.isUnsigned}`),!1):(e.isZerofill||!1)!=(t.isZerofill||!1)?(console.debug(`Column ${e.pureName}.${e.columnName}, ${t.pureName}.${t.columnName}: different zerofill: ${e.isZerofill}, ${t.isZerofill}`),!1):(e.columnComment||"")!=(t.columnComment||"")?(console.debug(`Column ${e.pureName}.${e.columnName}, ${t.pureName}.${t.columnName}: different comment: ${e.columnComment}, ${t.columnComment}`),!1):!!g(e,t,o)}function g(e,t,n={}){return!!n.ignoreDataTypes||((e.dataType||"").toLowerCase()==(t.dataType||"").toLowerCase()||(console.debug(`Column ${e.pureName}.${e.columnName}, ${t.pureName}.${t.columnName}: different data type: ${e.dataType}, ${t.dataType}`),!1))}function E(e){const t=[];return e.primaryKey&&t.push(e.primaryKey),e.foreignKeys&&t.push(...e.foreignKeys),e.indexes&&t.push(...e.indexes),e.uniques&&t.push(...e.uniques),e.checks&&t.push(...e.checks),t}function y(e,t,n=null){const r=[];for(const o of e){const e=t.find(e=>e.pairingId==o.pairingId||n&&n(o,e));e?r.push([o,e]):r.push([o,null])}for(const e of t)r.find(t=>t[1]==e)||r.push([null,e]);return r}function v(e,t,n){var r,o,i;const s=n.preloadedRowsKey||(null===(o=null===(r=n.primaryKey)||void 0===r?void 0:r.columns)||void 0===o?void 0:o.map(e=>e.columnName));(null===(i=n.preloadedRows)||void 0===i?void 0:i.length)>0&&(null==s?void 0:s.length)>0&&e.fillPreloadedRows(n,null==t?void 0:t.preloadedRows,n.preloadedRows,s,n.preloadedRowsInsertOnly)}function A(e,t,n,r){const o=y(t.columns,n.columns),i=y(E(t),E(n),(e,t)=>"primaryKey"==e.constraintType&&"primaryKey"==t.constraintType);r.noDropConstraint||i.filter(e=>null==e[1]).forEach(t=>e.dropConstraint(t[0])),r.noDropColumn||o.filter(e=>null==e[1]).forEach(t=>e.dropColumn(t[0])),h(t,n,r)||r.noRenameTable||e.renameTable(t,n.pureName),o.filter(e=>null==e[0]).forEach(t=>e.createColumn(t[1])),o.filter(e=>e[0]&&e[1]).forEach(t=>{m(t[0],t[1],!0,!0,r)||(m(t[0],t[1],!1,!0,r)&&!r.noRenameColumn?e.renameColumn(t[0],t[1].columnName):e.changeColumn(t[0],t[1]))}),i.filter(e=>e[0]&&e[1]).forEach(t=>{(function(e,t,n={}){const r=[];return n.ignoreForeignKeyActions&&(r.push("updateAction"),r.push("deleteAction")),n.ignoreConstraintNames&&r.push("constraintName"),"ignore"==n.schemaMode&&(r.push("schemaName"),r.push("refSchemaName")),(0,s.default)((0,u.default)(e,r))==(0,s.default)((0,u.default)(t,r))})(t[0],t[1],r)||e.changeConstraint(t[0],t[1])}),i.filter(e=>null==e[0]).forEach(t=>e.createConstraint(t[1])),v(e,t,n)}function b(e,t,n){return e.createSql==t.createSql}function C(e,t,n,r,o,s){const u=new i.AlterPlan(r,o,s.dialect,n);return null==e?(u.createTable(t),v(u,null,t)):null==t?u.dropTable(e):A(u,e,t,n),u.transformPlan(),u}function S(e,t,n,r,o,s){const u=new i.AlterPlan(r,o,s.dialect,n);for(const r of["tables","views","procedures","matviews","functions"]){for(const o of e[r]||[]){const e=(t[r]||[]).find(e=>e.pairingId==o.pairingId);"tables"==r?null==e?n.noDropTable||u.dropTable(o):A(u,o,e,n):null==e?n.noDropSqlObject||u.dropSqlObject(o):b(o.createSql,e.createSql)||(u.recreates.sqlObjects+=1,n.noDropSqlObject||u.dropSqlObject(o),u.createSqlObject(e))}for(const n of t[r]||[]){const t=(e[r]||[]).find(e=>e.pairingId==n.pairingId);"tables"==r?null==t&&(u.createTable(n),v(u,null,n)):null==t&&u.createSqlObject(n)}}return u.transformPlan(),u}t.generateTablePairingId=d,t.generateDbPairingId=function(e){var t,n,r,o,i,s;return e?Object.assign(Object.assign({},e),{tables:null===(t=e.tables)||void 0===t?void 0:t.map(d),views:null===(n=e.views)||void 0===n?void 0:n.map(f),procedures:null===(r=e.procedures)||void 0===r?void 0:r.map(f),functions:null===(o=e.functions)||void 0===o?void 0:o.map(f),triggers:null===(i=e.triggers)||void 0===i?void 0:i.map(f),matviews:null===(s=e.matviews)||void 0===s?void 0:s.map(f)}):e},t.testEqualColumns=m,t.testEqualTypes=g,t.testEqualTables=function(e,t,n,r,o,s){const u=new i.AlterPlan(r,o,s.dialect,n);return A(u,e,t,n),0==u.operations.length},t.testEqualSqlObjects=b,t.createAlterTablePlan=C,t.createAlterDatabasePlan=S,t.getAlterTableScript=function(e,t,n,r,o,i){if(!e&&!t||!i)return{sql:"",recreates:[]};const s=C(e,t,n,r,o,i),u=i.createDumper({useHardSeparator:!0});return i.dialect.disableExplicitTransaction||u.beginTransaction(),s.run(u),i.dialect.disableExplicitTransaction||u.commitTransaction(),{sql:u.s,recreates:s.recreates}},t.getAlterDatabaseScript=function(e,t,n,r,o,i){const s=S(e,t,n,r,o,i),u=i.createDumper({useHardSeparator:!0});return i.dialect.disableExplicitTransaction||u.beginTransaction(),s.run(u),i.dialect.disableExplicitTransaction||u.commitTransaction(),{sql:u.s,recreates:s.recreates,isEmpty:0==s.operations.length}},t.matchPairedObjects=function(e,t,n){if(!e||!t)return null;const r=(0,a.default)(t);for(const t of["tables","views","procedures","matviews","functions"])for(const o of r[t]||[]){const r=e[t].find(e=>h(e,o,n));if(r&&(o.pairingId=r.pairingId,"tables"==t)){for(const e of o.columns){const t=r.columns.find(t=>p(t.columnName,e.columnName,n));t&&(e.pairingId=t.pairingId)}for(const e of o.foreignKeys){const t=r.foreignKeys.find(t=>p(t.refTableName,e.refTableName,n)&&(0,c.default)(t.columns.map(e=>(0,l.default)(e,["columnName","refColumnName"])),e.columns.map(e=>(0,l.default)(e,["columnName","refColumnName"]))));t&&(e.pairingId=t.pairingId)}for(const e of o.uniques){const t=r.uniques.find(t=>(0,c.default)(t.columns.map(e=>(0,l.default)(e,["columnName"])),e.columns.map(e=>(0,l.default)(e,["columnName"]))));t&&(e.pairingId=t.pairingId)}for(const e of o.indexes){const t=r.indexes.find(t=>p(t.constraintName,e.constraintName,n));t&&(e.pairingId=t.pairingId)}}}return r},t.modelCompareDbDiffOptions={ignoreCase:!0,schemaMode:"ignore",ignoreConstraintNames:!0,ignoreForeignKeyActions:!0,ignoreDataTypes:!0}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.readPreferenceServerSelector=t.secondaryWritableServerSelector=t.sameServerSelector=t.writableServerSelector=t.MIN_SECONDARY_WRITE_WIRE_VERSION=void 0;const r=n(1),o=n(6),i=n(12);function s(e,t){const n=Object.keys(e),r=Object.keys(t);for(let o=0;o<n.length;++o){const i=n[o];if(-1===r.indexOf(i)||t[i]!==e[i])return!1}return!0}function u(e,t){const n=t.reduce((e,t)=>-1===e?t.roundTripTime:Math.min(t.roundTripTime,e),-1),r=n+e.localThresholdMS;return t.reduce((e,t)=>(t.roundTripTime<=r&&t.roundTripTime>=n&&e.push(t),e),[])}function a(e){return e.type===i.ServerType.RSPrimary}function c(e){return e.type===i.ServerType.RSSecondary}function l(e){return e.type===i.ServerType.RSSecondary||e.type===i.ServerType.RSPrimary}function d(e){return e.type!==i.ServerType.Unknown}function f(e){return e.type===i.ServerType.LoadBalancer}function p(e){if(!e.isValid())throw new r.MongoInvalidArgumentError("Invalid read preference specified");return(t,n)=>{const p=t.commonWireVersion;if(p&&e.minWireVersion&&e.minWireVersion>p)throw new r.MongoCompatibilityError(`Minimum wire version '${e.minWireVersion}' required, but found '${p}'`);if(t.type===i.TopologyType.LoadBalanced)return n.filter(f);if(t.type===i.TopologyType.Unknown)return[];if(t.type===i.TopologyType.Single||t.type===i.TopologyType.Sharded)return u(t,n.filter(d));const h=e.mode;if(h===o.ReadPreference.PRIMARY)return n.filter(a);if(h===o.ReadPreference.PRIMARY_PREFERRED){const e=n.filter(a);if(e.length)return e}const m=h===o.ReadPreference.NEAREST?l:c,g=u(t,function(e,t){if(null==e.tags||Array.isArray(e.tags)&&0===e.tags.length)return t;for(let n=0;n<e.tags.length;++n){const r=e.tags[n],o=t.reduce((e,t)=>(s(r,t.tags)&&e.push(t),e),[]);if(o.length)return o}return[]}(e,function(e,t,n){if(null==e.maxStalenessSeconds||e.maxStalenessSeconds<0)return n;const o=e.maxStalenessSeconds,s=(t.heartbeatFrequencyMS+1e4)/1e3;if(o<s)throw new r.MongoInvalidArgumentError(`Option "maxStalenessSeconds" must be at least ${s} seconds`);if(o<90)throw new r.MongoInvalidArgumentError('Option "maxStalenessSeconds" must be at least 90 seconds');if(t.type===i.TopologyType.ReplicaSetWithPrimary){const r=Array.from(t.servers.values()).filter(a)[0];return n.reduce((n,o)=>{var i;return(o.lastUpdateTime-o.lastWriteDate-(r.lastUpdateTime-r.lastWriteDate)+t.heartbeatFrequencyMS)/1e3<=(null!==(i=e.maxStalenessSeconds)&&void 0!==i?i:0)&&n.push(o),n},[])}if(t.type===i.TopologyType.ReplicaSetNoPrimary){if(0===n.length)return n;const r=n.reduce((e,t)=>t.lastWriteDate>e.lastWriteDate?t:e);return n.reduce((n,o)=>{var i;return(r.lastWriteDate-o.lastWriteDate+t.heartbeatFrequencyMS)/1e3<=(null!==(i=e.maxStalenessSeconds)&&void 0!==i?i:0)&&n.push(o),n},[])}return n}(e,t,n.filter(m))));return h===o.ReadPreference.SECONDARY_PREFERRED&&0===g.length?n.filter(a):g}}t.MIN_SECONDARY_WRITE_WIRE_VERSION=13,t.writableServerSelector=function(){return(e,t)=>u(e,t.filter(e=>e.isWritable))},t.sameServerSelector=function(e){return(t,n)=>e?n.filter(t=>t.address===e.address&&t.type!==i.ServerType.Unknown):[]},t.secondaryWritableServerSelector=function(e,n){return!n||!e||e&&e<t.MIN_SECONDARY_WRITE_WIRE_VERSION?p(o.ReadPreference.primary):p(n)},t.readPreferenceServerSelector=p},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ChangeStreamCursor=t.ChangeStream=void 0;const r=n(97),o=n(21),i=n(34),s=n(8),u=n(22),a=n(100),c=n(1),l=n(43),d=n(9),f=n(102),p=n(14),h=n(2),m=Symbol("resumeQueue"),g=Symbol("cursorStream"),E=Symbol("closed"),y=Symbol("mode"),v=["resumeAfter","startAfter","startAtOperationTime","fullDocument","fullDocumentBeforeChange","showExpandedEvents"],A={COLLECTION:Symbol("Collection"),DATABASE:Symbol("Database"),CLUSTER:Symbol("Cluster")},b=[s.RESUME_TOKEN_CHANGED,s.END,s.CLOSE];class C extends d.TypedEventEmitter{constructor(e,t=[],n={}){if(super(),this.pipeline=t,this.options=n,e instanceof i.Collection)this.type=A.COLLECTION;else if(e instanceof a.Db)this.type=A.DATABASE;else{if(!(e instanceof l.MongoClient))throw new c.MongoChangeStreamError("Parent provided to ChangeStream constructor must be an instance of Collection, Db, or MongoClient");this.type=A.CLUSTER}this.parent=e,this.namespace=e.s.namespace,!this.options.readPreference&&e.readPreference&&(this.options.readPreference=e.readPreference),this[m]=new r,this.cursor=this._createChangeStreamCursor(n),this[E]=!1,this[y]=!1,this.on("newListener",e=>{"change"===e&&this.cursor&&0===this.listenerCount("change")&&this._streamEvents(this.cursor)}),this.on("removeListener",e=>{var t;"change"===e&&0===this.listenerCount("change")&&this.cursor&&(null===(t=this[g])||void 0===t||t.removeAllListeners("data"))})}get cursorStream(){return this[g]}get resumeToken(){var e;return null===(e=this.cursor)||void 0===e?void 0:e.resumeToken}hasNext(e){return this._setIsIterator(),(0,h.maybePromise)(e,e=>{this._getCursor((t,n)=>{if(t||!n)return e(t);n.hasNext(e)})})}next(e){return this._setIsIterator(),(0,h.maybePromise)(e,e=>{this._getCursor((t,n)=>{if(t||!n)return e(t);n.next((t,n)=>{if(t)return this[m].push(()=>this.next(e)),void this._processError(t,e);this._processNewChange(null!=n?n:null,e)})})})}get closed(){var e,t;return this[E]||null!==(t=null===(e=this.cursor)||void 0===e?void 0:e.closed)&&void 0!==t&&t}close(e){return this[E]=!0,(0,h.maybePromise)(e,e=>{if(!this.cursor)return e();return this.cursor.close(t=>(this._endStream(),this.cursor=void 0,e(t)))})}stream(e){if(this.streamOptions=e,!this.cursor)throw new c.MongoChangeStreamError("ChangeStream has no cursor");return this.cursor.stream(e)}tryNext(e){return this._setIsIterator(),(0,h.maybePromise)(e,e=>{this._getCursor((t,n)=>t||!n?e(t):n.tryNext(e))})}_setIsEmitter(){if("iterator"===this[y])throw new c.MongoAPIError("ChangeStream cannot be used as an EventEmitter after being used as an iterator");this[y]="emitter"}_setIsIterator(){if("emitter"===this[y])throw new c.MongoAPIError("ChangeStream cannot be used as an iterator after being used as an EventEmitter");this[y]="iterator"}_createChangeStreamCursor(e){const t=(0,h.filterOptions)(e,v);this.type===A.CLUSTER&&(t.allChangesForCluster=!0);const n=[{$changeStream:t},...this.pipeline],r=this.type===A.CLUSTER?this.parent:this.type===A.DATABASE?this.parent.s.client:this.type===A.COLLECTION?this.parent.s.db.s.client:null;if(null==r)throw new c.MongoRuntimeError(`Changestream type should only be one of cluster, database, collection. Found ${this.type.toString()}`);const o=new S(r,this.namespace,n,e);for(const e of b)o.on(e,t=>this.emit(e,t));return this.listenerCount(C.CHANGE)>0&&this._streamEvents(o),o}_waitForTopologyConnected(e,t,n){(0,o.setTimeout)(()=>{t&&null==t.start&&(t.start=(0,h.now)());const r=t.start||(0,h.now)(),o=t.timeout||3e4;return e.isConnected()?n():(0,h.calculateDurationInMs)(r)>o?n(new c.MongoRuntimeError("Timed out waiting for connection")):void this._waitForTopologyConnected(e,t,n)},500)}_closeWithError(e,t){t||this.emit(C.ERROR,e),this.close(()=>t&&t(e))}_streamEvents(e){var t;this._setIsEmitter();const n=null!==(t=this[g])&&void 0!==t?t:e.stream();this[g]=n,n.on("data",e=>this._processNewChange(e)),n.on("error",e=>this._processError(e))}_endStream(){const e=this[g];e&&(["data","close","end","error"].forEach(t=>e.removeAllListeners(t)),e.destroy()),this[g]=void 0}_processNewChange(e,t){var n;if(!this[E])return null==e?this._closeWithError(new c.MongoRuntimeError("ChangeStream is closed"),t):e&&!e._id?this._closeWithError(new c.MongoChangeStreamError("A change stream document has been received that lacks a resume token (_id)."),t):(null===(n=this.cursor)||void 0===n||n.cacheResumeToken(e._id),this.options.startAtOperationTime=void 0,t?t(void 0,e):this.emit(C.CHANGE,e));t&&t(new c.MongoAPIError("ChangeStream is closed"))}_processError(e,t){const n=this.cursor;if(this[E])return void(t&&t(new c.MongoAPIError("ChangeStream is closed")));const r=e=>{this.cursor=e,this._processResumeQueue()},o=e=>{t||this.emit(C.ERROR,e),this.close(()=>this._processResumeQueue(e))};if(!n||!(0,c.isResumableError)(e,(0,h.maxWireVersion)(n.server)))return this._closeWithError(e,t);{this.cursor=void 0,this._endStream(),n.close();const e=(0,h.getTopology)(this.parent);this._waitForTopologyConnected(e,{readPreference:n.readPreference},e=>{if(e)return o(e);const i=this._createChangeStreamCursor(n.resumeOptions);if(!t)return r(i);i.hasNext(e=>{if(e)return o(e);r(i)})})}}_getCursor(e){this[E]?e(new c.MongoAPIError("ChangeStream is closed")):this.cursor?e(void 0,this.cursor):this[m].push(e)}_processResumeQueue(e){for(var t;this[m].length;){const n=this[m].pop();if(!n)break;if(!e){if(this[E])return void n(new c.MongoAPIError("ChangeStream is closed"));if(!this.cursor)return void n(new c.MongoChangeStreamError("ChangeStream has no cursor"))}n(e,null!==(t=this.cursor)&&void 0!==t?t:void 0)}}}t.ChangeStream=C,C.RESPONSE=s.RESPONSE,C.MORE=s.MORE,C.INIT=s.INIT,C.CLOSE=s.CLOSE,C.CHANGE=s.CHANGE,C.END=s.END,C.ERROR=s.ERROR,C.RESUME_TOKEN_CHANGED=s.RESUME_TOKEN_CHANGED;class S extends u.AbstractCursor{constructor(e,t,n=[],r={}){super(e,t,r),this.pipeline=n,this.options=r,this._resumeToken=null,this.startAtOperationTime=r.startAtOperationTime,r.startAfter?this.resumeToken=r.startAfter:r.resumeAfter&&(this.resumeToken=r.resumeAfter)}set resumeToken(e){this._resumeToken=e,this.emit(C.RESUME_TOKEN_CHANGED,e)}get resumeToken(){return this._resumeToken}get resumeOptions(){const e={...this.options};for(const t of["resumeAfter","startAfter","startAtOperationTime"])delete e[t];return null!=this.resumeToken?this.options.startAfter&&!this.hasReceived?e.startAfter=this.resumeToken:e.resumeAfter=this.resumeToken:null!=this.startAtOperationTime&&(0,h.maxWireVersion)(this.server)>=7&&(e.startAtOperationTime=this.startAtOperationTime),e}cacheResumeToken(e){0===this.bufferedCount()&&this.postBatchResumeToken?this.resumeToken=this.postBatchResumeToken:this.resumeToken=e,this.hasReceived=!0}_processBatch(e){const t=e.cursor;if(t.postBatchResumeToken){this.postBatchResumeToken=e.cursor.postBatchResumeToken,0===("firstBatch"in e.cursor?e.cursor.firstBatch:e.cursor.nextBatch).length&&(this.resumeToken=t.postBatchResumeToken)}}clone(){return new S(this.client,this.namespace,this.pipeline,{...this.cursorOptions})}_initialize(e,t){const n=new f.AggregateOperation(this.namespace,this.pipeline,{...this.cursorOptions,...this.options,session:e});(0,p.executeOperation)(e.client,n,(r,o)=>{if(r||null==o)return t(r);const i=n.server;null==this.startAtOperationTime&&null==this.resumeAfter&&null==this.startAfter&&(0,h.maxWireVersion)(i)>=7&&(this.startAtOperationTime=o.operationTime),this._processBatch(o),this.emit(C.INIT,o),this.emit(C.RESPONSE),t(void 0,{server:i,session:e,response:o})})}_getMore(e,t){super._getMore(e,(e,n)=>{if(e)return t(e);this._processBatch(n),this.emit(C.MORE,n),this.emit(C.RESPONSE),t(e,n)})}}t.ChangeStreamCursor=S},function(e,t,n){"use strict";function r(e,t){t=t||{};this._head=0,this._tail=0,this._capacity=t.capacity,this._capacityMask=3,this._list=new Array(4),Array.isArray(e)&&this._fromArray(e)}r.prototype.peekAt=function(e){var t=e;if(t===(0|t)){var n=this.size();if(!(t>=n||t<-n))return t<0&&(t+=n),t=this._head+t&this._capacityMask,this._list[t]}},r.prototype.get=function(e){return this.peekAt(e)},r.prototype.peek=function(){if(this._head!==this._tail)return this._list[this._head]},r.prototype.peekFront=function(){return this.peek()},r.prototype.peekBack=function(){return this.peekAt(-1)},Object.defineProperty(r.prototype,"length",{get:function(){return this.size()}}),r.prototype.size=function(){return this._head===this._tail?0:this._head<this._tail?this._tail-this._head:this._capacityMask+1-(this._head-this._tail)},r.prototype.unshift=function(e){if(0===arguments.length)return this.size();var t=this._list.length;return this._head=this._head-1+t&this._capacityMask,this._list[this._head]=e,this._tail===this._head&&this._growArray(),this._capacity&&this.size()>this._capacity&&this.pop(),this._head<this._tail?this._tail-this._head:this._capacityMask+1-(this._head-this._tail)},r.prototype.shift=function(){var e=this._head;if(e!==this._tail){var t=this._list[e];return this._list[e]=void 0,this._head=e+1&this._capacityMask,e<2&&this._tail>1e4&&this._tail<=this._list.length>>>2&&this._shrinkArray(),t}},r.prototype.push=function(e){if(0===arguments.length)return this.size();var t=this._tail;return this._list[t]=e,this._tail=t+1&this._capacityMask,this._tail===this._head&&this._growArray(),this._capacity&&this.size()>this._capacity&&this.shift(),this._head<this._tail?this._tail-this._head:this._capacityMask+1-(this._head-this._tail)},r.prototype.pop=function(){var e=this._tail;if(e!==this._head){var t=this._list.length;this._tail=e-1+t&this._capacityMask;var n=this._list[this._tail];return this._list[this._tail]=void 0,this._head<2&&e>1e4&&e<=t>>>2&&this._shrinkArray(),n}},r.prototype.removeOne=function(e){var t=e;if(t===(0|t)&&this._head!==this._tail){var n=this.size(),r=this._list.length;if(!(t>=n||t<-n)){t<0&&(t+=n),t=this._head+t&this._capacityMask;var o,i=this._list[t];if(e<n/2){for(o=e;o>0;o--)this._list[t]=this._list[t=t-1+r&this._capacityMask];this._list[t]=void 0,this._head=this._head+1+r&this._capacityMask}else{for(o=n-1-e;o>0;o--)this._list[t]=this._list[t=t+1+r&this._capacityMask];this._list[t]=void 0,this._tail=this._tail-1+r&this._capacityMask}return i}}},r.prototype.remove=function(e,t){var n,r=e,o=t;if(r===(0|r)&&this._head!==this._tail){var i=this.size(),s=this._list.length;if(!(r>=i||r<-i||t<1)){if(r<0&&(r+=i),1===t||!t)return(n=new Array(1))[0]=this.removeOne(r),n;if(0===r&&r+t>=i)return n=this.toArray(),this.clear(),n;var u;for(r+t>i&&(t=i-r),n=new Array(t),u=0;u<t;u++)n[u]=this._list[this._head+r+u&this._capacityMask];if(r=this._head+r&this._capacityMask,e+t===i){for(this._tail=this._tail-t+s&this._capacityMask,u=t;u>0;u--)this._list[r=r+1+s&this._capacityMask]=void 0;return n}if(0===e){for(this._head=this._head+t+s&this._capacityMask,u=t-1;u>0;u--)this._list[r=r+1+s&this._capacityMask]=void 0;return n}if(r<i/2){for(this._head=this._head+e+t+s&this._capacityMask,u=e;u>0;u--)this.unshift(this._list[r=r-1+s&this._capacityMask]);for(r=this._head-1+s&this._capacityMask;o>0;)this._list[r=r-1+s&this._capacityMask]=void 0,o--;e<0&&(this._tail=r)}else{for(this._tail=r,r=r+t+s&this._capacityMask,u=i-(t+e);u>0;u--)this.push(this._list[r++]);for(r=this._tail;o>0;)this._list[r=r+1+s&this._capacityMask]=void 0,o--}return this._head<2&&this._tail>1e4&&this._tail<=s>>>2&&this._shrinkArray(),n}}},r.prototype.splice=function(e,t){var n=e;if(n===(0|n)){var r=this.size();if(n<0&&(n+=r),!(n>r)){if(arguments.length>2){var o,i,s,u=arguments.length,a=this._list.length,c=2;if(!r||n<r/2){for(i=new Array(n),o=0;o<n;o++)i[o]=this._list[this._head+o&this._capacityMask];for(0===t?(s=[],n>0&&(this._head=this._head+n+a&this._capacityMask)):(s=this.remove(n,t),this._head=this._head+n+a&this._capacityMask);u>c;)this.unshift(arguments[--u]);for(o=n;o>0;o--)this.unshift(i[o-1])}else{var l=(i=new Array(r-(n+t))).length;for(o=0;o<l;o++)i[o]=this._list[this._head+n+t+o&this._capacityMask];for(0===t?(s=[],n!=r&&(this._tail=this._head+n+a&this._capacityMask)):(s=this.remove(n,t),this._tail=this._tail-l+a&this._capacityMask);c<u;)this.push(arguments[c++]);for(o=0;o<l;o++)this.push(i[o])}return s}return this.remove(n,t)}}},r.prototype.clear=function(){this._head=0,this._tail=0},r.prototype.isEmpty=function(){return this._head===this._tail},r.prototype.toArray=function(){return this._copyArray(!1)},r.prototype._fromArray=function(e){for(var t=0;t<e.length;t++)this.push(e[t])},r.prototype._copyArray=function(e){var t,n=[],r=this._list,o=r.length;if(e||this._head>this._tail){for(t=this._head;t<o;t++)n.push(r[t]);for(t=0;t<this._tail;t++)n.push(r[t])}else for(t=this._head;t<this._tail;t++)n.push(r[t]);return n},r.prototype._growArray=function(){this._head&&(this._list=this._copyArray(!0),this._head=0),this._tail=this._list.length,this._list.length<<=1,this._capacityMask=this._capacityMask<<1|1},r.prototype._shrinkArray=function(){this._list.length>>>=1,this._capacityMask>>>=1},e.exports=r},function(e,t){e.exports=require("events")},function(e,t,n){"use strict";var r;Object.defineProperty(t,"__esModule",{value:!0}),t.updateSessionFromResponse=t.applySession=t.ServerSessionPool=t.ServerSession=t.maybeClearPinnedConnection=t.ClientSession=void 0;const o=n(4),i=n(166),s=n(167),u=n(8),a=n(1),c=n(9),l=n(14),d=n(60),f=n(33),p=n(11),h=n(6),m=n(12),g=n(169),E=n(2),y=Symbol("serverSession"),v=Symbol("snapshotTime"),A=Symbol("snapshotEnabled"),b=Symbol("pinnedConnection"),C=Symbol("txnNumberIncrement");class S extends c.TypedEventEmitter{constructor(e,t,n,o){if(super(),this[r]=!1,null==e)throw new a.MongoRuntimeError("ClientSession requires a MongoClient");if(null==t||!(t instanceof R))throw new a.MongoRuntimeError("ClientSession requires a ServerSessionPool");if(!0===(n=null!=n?n:{}).snapshot&&(this[A]=!0,!0===n.causalConsistency))throw new a.MongoInvalidArgumentError('Properties "causalConsistency" and "snapshot" are mutually exclusive');this.client=e,this.sessionPool=t,this.hasEnded=!1,this.clientOptions=o,this.explicit=!!n.explicit,this[y]=this.explicit?this.sessionPool.acquire():null,this[C]=0,this.supports={causalConsistency:!0!==n.snapshot&&!1!==n.causalConsistency},this.clusterTime=n.initialClusterTime,this.operationTime=void 0,this.owner=n.owner,this.defaultTransactionOptions=Object.assign({},n.defaultTransactionOptions),this.transaction=new g.Transaction}get id(){var e;return null===(e=this[y])||void 0===e?void 0:e.id}get serverSession(){let e=this[y];if(null==e){if(this.explicit)throw new a.MongoRuntimeError("Unexpected null serverSession for an explicit session");if(this.hasEnded)throw new a.MongoRuntimeError("Unexpected null serverSession for an ended implicit session");e=this.sessionPool.acquire(),this[y]=e}return e}get snapshotEnabled(){return this[A]}get loadBalanced(){var e;return(null===(e=this.client.topology)||void 0===e?void 0:e.description.type)===m.TopologyType.LoadBalanced}get pinnedConnection(){return this[b]}pin(e){if(this[b])throw TypeError("Cannot pin multiple connections to the same session");this[b]=e,e.emit(u.PINNED,this.inTransaction()?i.ConnectionPoolMetrics.TXN:i.ConnectionPoolMetrics.CURSOR)}unpin(e){if(this.loadBalanced)return w(this,e);this.transaction.unpinServer()}get isPinned(){return this.loadBalanced?!!this[b]:this.transaction.isPinned}endSession(e,t){"function"==typeof e&&(t=e,e={});const n={force:!0,...e};return(0,E.maybePromise)(t,e=>{if(this.hasEnded)return w(this,n),e();const t=()=>{w(this,n);const t=this[y];null!=t&&(this.sessionPool.release(t),Object.defineProperty(this,y,{value:N.clone(t)})),this.hasEnded=!0,this.emit("ended",this),e()};this.inTransaction()?this.abortTransaction(n=>{if(n)return e(n);t()}):t()})}advanceOperationTime(e){null!=this.operationTime?e.greaterThan(this.operationTime)&&(this.operationTime=e):this.operationTime=e}advanceClusterTime(e){var t,n;if(!e||"object"!=typeof e)throw new a.MongoInvalidArgumentError("input cluster time must be an object");if(!e.clusterTime||"Timestamp"!==e.clusterTime._bsontype)throw new a.MongoInvalidArgumentError('input cluster time "clusterTime" property must be a valid BSON Timestamp');if(!e.signature||"Binary"!==(null===(t=e.signature.hash)||void 0===t?void 0:t._bsontype)||"number"!=typeof e.signature.keyId&&"Long"!==(null===(n=e.signature.keyId)||void 0===n?void 0:n._bsontype))throw new a.MongoInvalidArgumentError('input cluster time must have a valid "signature" property with BSON Binary hash and BSON Long keyId');(0,m._advanceClusterTime)(this,e)}equals(e){return e instanceof S&&(null!=this.id&&null!=e.id&&this.id.id.buffer.equals(e.id.id.buffer))}incrementTransactionNumber(){this[C]+=1}inTransaction(){return this.transaction.isActive}startTransaction(e){var t,n,r,o,i,u,c,l,d,f;if(this[A])throw new a.MongoCompatibilityError("Transactions are not allowed with snapshot sessions");if(this.inTransaction())throw new a.MongoTransactionError("Transaction already in progress");this.isPinned&&this.transaction.isCommitted&&this.unpin();const p=(0,E.maxWireVersion)(this.client.topology);if((0,s.isSharded)(this.client.topology)&&null!=p&&p<8)throw new a.MongoCompatibilityError("Transactions are not supported on sharded clusters in MongoDB < 4.2.");this.incrementTransactionNumber(),this.transaction=new g.Transaction({readConcern:null!==(n=null!==(t=null==e?void 0:e.readConcern)&&void 0!==t?t:this.defaultTransactionOptions.readConcern)&&void 0!==n?n:null===(r=this.clientOptions)||void 0===r?void 0:r.readConcern,writeConcern:null!==(i=null!==(o=null==e?void 0:e.writeConcern)&&void 0!==o?o:this.defaultTransactionOptions.writeConcern)&&void 0!==i?i:null===(u=this.clientOptions)||void 0===u?void 0:u.writeConcern,readPreference:null!==(l=null!==(c=null==e?void 0:e.readPreference)&&void 0!==c?c:this.defaultTransactionOptions.readPreference)&&void 0!==l?l:null===(d=this.clientOptions)||void 0===d?void 0:d.readPreference,maxCommitTimeMS:null!==(f=null==e?void 0:e.maxCommitTimeMS)&&void 0!==f?f:this.defaultTransactionOptions.maxCommitTimeMS}),this.transaction.transition(g.TxnState.STARTING_TRANSACTION)}commitTransaction(e){return(0,E.maybePromise)(e,e=>F(this,"commitTransaction",e))}abortTransaction(e){return(0,E.maybePromise)(e,e=>F(this,"abortTransaction",e))}toBSON(){throw new a.MongoRuntimeError("ClientSession cannot be serialized to BSON.")}withTransaction(e,t){return T(this,(0,E.now)(),e,t)}}t.ClientSession=S,r=A;const O=new Set(["CannotSatisfyWriteConcern","UnknownReplWriteConcern","UnsatisfiableWriteConcern"]);function _(e,t){return(0,E.calculateDurationInMs)(e)<t}function w(e,t){const n=e[b],r=null==t?void 0:t.error;if(e.inTransaction()&&r&&r instanceof a.MongoError&&r.hasErrorLabel(a.MongoErrorLabel.TransientTransactionError))return;const o=e.client.topology;if(n&&null!=o){const r=Array.from(o.s.servers.values())[0];(null==(null==t?void 0:t.error)||(null==t?void 0:t.force))&&(r.s.pool.checkIn(n),n.emit(u.UNPINNED,e.transaction.state!==g.TxnState.NO_TRANSACTION?i.ConnectionPoolMetrics.TXN:i.ConnectionPoolMetrics.CURSOR),(null==t?void 0:t.forceClear)&&r.s.pool.clear(n.serviceId)),e[b]=void 0}}function D(e){return null!=e&&e instanceof a.MongoServerError&&(e.code===a.MONGODB_ERROR_CODES.MaxTimeMSExpired||e.writeConcernError&&e.writeConcernError.code===a.MONGODB_ERROR_CODES.MaxTimeMSExpired)}t.maybeClearPinnedConnection=w;const B=new Set([g.TxnState.NO_TRANSACTION,g.TxnState.TRANSACTION_COMMITTED,g.TxnState.TRANSACTION_ABORTED]);function T(e,t,n,r){const o=f.PromiseProvider.get();let i;e.startTransaction(r);try{i=n(e)}catch(e){i=o.reject(e)}if(!(0,E.isPromiseLike)(i))throw e.abortTransaction(),new a.MongoInvalidArgumentError("Function provided to `withTransaction` must return a Promise");return i.then(()=>{if(!function(e){return B.has(e.transaction.state)}(e))return function e(t,n,r,o){return t.commitTransaction().catch(i=>{if(i instanceof a.MongoError&&_(n,12e4)&&!D(i)){if(i.hasErrorLabel(a.MongoErrorLabel.UnknownTransactionCommitResult))return e(t,n,r,o);if(i.hasErrorLabel(a.MongoErrorLabel.TransientTransactionError))return T(t,n,r,o)}throw i})}(e,t,n,r)},o=>{function i(o){if(o instanceof a.MongoError&&o.hasErrorLabel(a.MongoErrorLabel.TransientTransactionError)&&_(t,12e4))return T(e,t,n,r);throw D(o)&&o.addErrorLabel(a.MongoErrorLabel.UnknownTransactionCommitResult),o}return e.inTransaction()?e.abortTransaction().then(()=>i(o)):i(o)})}function F(e,t,n){const r=e.transaction.state;if(r===g.TxnState.NO_TRANSACTION)return void n(new a.MongoTransactionError("No transaction started"));if("commitTransaction"===t){if(r===g.TxnState.STARTING_TRANSACTION||r===g.TxnState.TRANSACTION_COMMITTED_EMPTY)return e.transaction.transition(g.TxnState.TRANSACTION_COMMITTED_EMPTY),void n();if(r===g.TxnState.TRANSACTION_ABORTED)return void n(new a.MongoTransactionError("Cannot call commitTransaction after calling abortTransaction"))}else{if(r===g.TxnState.STARTING_TRANSACTION)return e.transaction.transition(g.TxnState.TRANSACTION_ABORTED),void n();if(r===g.TxnState.TRANSACTION_ABORTED)return void n(new a.MongoTransactionError("Cannot call abortTransaction twice"));if(r===g.TxnState.TRANSACTION_COMMITTED||r===g.TxnState.TRANSACTION_COMMITTED_EMPTY)return void n(new a.MongoTransactionError("Cannot call abortTransaction after calling commitTransaction"))}const o={[t]:1};let i;function s(r,o){if("commitTransaction"!==t)return e.transaction.transition(g.TxnState.TRANSACTION_ABORTED),e.loadBalanced&&w(e,{force:!1}),n();e.transaction.transition(g.TxnState.TRANSACTION_COMMITTED),r instanceof a.MongoError&&(r.hasErrorLabel(a.MongoErrorLabel.RetryableWriteError)||r instanceof a.MongoWriteConcernError||D(r)?function(e){const t=e instanceof a.MongoServerError&&e.codeName&&O.has(e.codeName);return D(e)||!t&&e.code!==a.MONGODB_ERROR_CODES.UnsatisfiableWriteConcern&&e.code!==a.MONGODB_ERROR_CODES.UnknownReplWriteConcern}(r)&&(r.addErrorLabel(a.MongoErrorLabel.UnknownTransactionCommitResult),e.unpin({error:r})):r.hasErrorLabel(a.MongoErrorLabel.TransientTransactionError)&&e.unpin({error:r})),n(r,o)}e.transaction.options.writeConcern?i=Object.assign({},e.transaction.options.writeConcern):e.clientOptions&&e.clientOptions.writeConcern&&(i={w:e.clientOptions.writeConcern.w}),r===g.TxnState.TRANSACTION_COMMITTED&&(i=Object.assign({wtimeout:1e4},i,{w:"majority"})),i&&Object.assign(o,{writeConcern:i}),"commitTransaction"===t&&e.transaction.options.maxTimeMS&&Object.assign(o,{maxTimeMS:e.transaction.options.maxTimeMS}),e.transaction.recoveryToken&&(o.recoveryToken=e.transaction.recoveryToken),(0,l.executeOperation)(e.client,new d.RunAdminCommandOperation(void 0,o,{session:e,readPreference:h.ReadPreference.primary,bypassPinningCheck:!0}),(t,n)=>{if(o.abortTransaction&&e.unpin(),t instanceof a.MongoError&&t.hasErrorLabel(a.MongoErrorLabel.RetryableWriteError))return o.commitTransaction&&(e.unpin({force:!0}),o.writeConcern=Object.assign({wtimeout:1e4},o.writeConcern,{w:"majority"})),(0,l.executeOperation)(e.client,new d.RunAdminCommandOperation(void 0,o,{session:e,readPreference:h.ReadPreference.primary,bypassPinningCheck:!0}),s);s(t,n)})}class N{constructor(){this.id={id:new o.Binary((0,E.uuidV4)(),o.Binary.SUBTYPE_UUID)},this.lastUse=(0,E.now)(),this.txnNumber=0,this.isDirty=!1}hasTimedOut(e){return Math.round((0,E.calculateDurationInMs)(this.lastUse)%864e5%36e5/6e4)>e-1}static clone(e){const t=new ArrayBuffer(16),n=Buffer.from(t);n.set(e.id.id.buffer);const r=new o.Binary(n,e.id.id.sub_type);return Object.setPrototypeOf({id:{id:r},lastUse:e.lastUse,txnNumber:e.txnNumber,isDirty:e.isDirty},N.prototype)}}t.ServerSession=N;class R{constructor(e){if(null==e)throw new a.MongoRuntimeError("ServerSessionPool requires a topology");this.topology=e,this.sessions=[]}endAllPooledSessions(e){this.sessions.length?this.topology.endSessions(this.sessions.map(e=>e.id),()=>{this.sessions=[],"function"==typeof e&&e()}):"function"==typeof e&&e()}acquire(){const e=this.topology.logicalSessionTimeoutMinutes||10;for(;this.sessions.length;){const t=this.sessions.shift();if(t&&(this.topology.loadBalanced||!t.hasTimedOut(e)))return t}return new N}release(e){const t=this.topology.logicalSessionTimeoutMinutes;if(this.topology.loadBalanced&&!t&&this.sessions.unshift(e),t){for(;this.sessions.length;){if(!this.sessions[this.sessions.length-1].hasTimedOut(t))break;this.sessions.pop()}if(!e.hasTimedOut(t)){if(e.isDirty)return;this.sessions.unshift(e)}}}}t.ServerSessionPool=R,t.applySession=function(e,t,n){var r,i;if(e.hasEnded)return new a.MongoExpiredSessionError;const s=e.serverSession;if(null==s)return new a.MongoRuntimeError("Unable to acquire server session");if(0===(null===(r=n.writeConcern)||void 0===r?void 0:r.w))return e&&e.explicit?new a.MongoAPIError("Cannot have explicit session with unacknowledged writes"):void 0;s.lastUse=(0,E.now)(),t.lsid=s.id;const u=e.inTransaction()||(0,g.isTransactionCommand)(t);if((!!n.willRetryWrite||u)&&(s.txnNumber+=e[C],e[C]=0,t.txnNumber=o.Long.fromNumber(s.txnNumber)),!u)return e.transaction.state!==g.TxnState.NO_TRANSACTION&&e.transaction.transition(g.TxnState.NO_TRANSACTION),void(e.supports.causalConsistency&&e.operationTime&&(0,E.commandSupportsReadConcern)(t,n)?(t.readConcern=t.readConcern||{},Object.assign(t.readConcern,{afterClusterTime:e.operationTime})):e[A]&&(t.readConcern=t.readConcern||{level:p.ReadConcernLevel.snapshot},null!=e[v]&&Object.assign(t.readConcern,{atClusterTime:e[v]})));if(t.autocommit=!1,e.transaction.state===g.TxnState.STARTING_TRANSACTION){e.transaction.transition(g.TxnState.TRANSACTION_IN_PROGRESS),t.startTransaction=!0;const n=e.transaction.options.readConcern||(null===(i=null==e?void 0:e.clientOptions)||void 0===i?void 0:i.readConcern);n&&(t.readConcern=n),e.supports.causalConsistency&&e.operationTime&&(t.readConcern=t.readConcern||{},Object.assign(t.readConcern,{afterClusterTime:e.operationTime}))}},t.updateSessionFromResponse=function(e,t){var n;if(t.$clusterTime&&(0,m._advanceClusterTime)(e,t.$clusterTime),t.operationTime&&e&&e.supports.causalConsistency&&e.advanceOperationTime(t.operationTime),t.recoveryToken&&e&&e.inTransaction()&&(e.transaction._recoveryToken=t.recoveryToken),(null==e?void 0:e[A])&&null==e[v]){const r=(null===(n=t.cursor)||void 0===n?void 0:n.atClusterTime)||t.atClusterTime;r&&(e[v]=r)}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Db=void 0;const r=n(155),o=n(4),i=n(96),s=n(34),u=n(8),a=n(101),c=n(1),l=n(23),d=n(156),f=n(378),p=n(379),h=n(170),m=n(14),g=n(63),E=n(171),y=n(380),v=n(160),A=n(172),b=n(60),C=n(173),S=n(174),O=n(11),_=n(6),w=n(2),D=n(13),B=["writeConcern","readPreference","readPreferenceTags","native_parser","forceServerObjectId","pkFactory","serializeFunctions","raw","authSource","ignoreUndefined","readConcern","retryMiliSeconds","numberOfRetries","loggerLevel","logger","promoteBuffers","promoteLongs","bsonRegExp","enableUtf8Validation","promoteValues","compression","retryWrites"];class T{constructor(e,t,n){var r;n=null!=n?n:{},n=(0,w.filterOptions)(n,B),function(e){if("string"!=typeof e)throw new c.MongoInvalidArgumentError("Database name must be a string");if(0===e.length)throw new c.MongoInvalidArgumentError("Database name cannot be the empty string");if("$external"===e)return;const t=[" ",".","$","/","\\"];for(let n=0;n<t.length;n++)if(-1!==e.indexOf(t[n]))throw new c.MongoAPIError(`database names cannot contain the character '${t[n]}'`)}(t),this.s={client:e,options:n,logger:new l.Logger("Db",n),readPreference:_.ReadPreference.fromOptions(n),bsonOptions:(0,o.resolveBSONOptions)(n,e),pkFactory:null!==(r=null==n?void 0:n.pkFactory)&&void 0!==r?r:w.DEFAULT_PK_FACTORY,readConcern:O.ReadConcern.fromOptions(n),writeConcern:D.WriteConcern.fromOptions(n),namespace:new w.MongoDBNamespace(t)}}get databaseName(){return this.s.namespace.db}get options(){return this.s.options}get slaveOk(){return this.secondaryOk}get secondaryOk(){var e;return"primary"!==(null===(e=this.s.readPreference)||void 0===e?void 0:e.preference)||!1}get readConcern(){return this.s.readConcern}get readPreference(){return null==this.s.readPreference?this.s.client.readPreference:this.s.readPreference}get bsonOptions(){return this.s.bsonOptions}get writeConcern(){return this.s.writeConcern}get namespace(){return this.s.namespace.toString()}createCollection(e,t,n){return"function"==typeof t&&(n=t,t={}),(0,m.executeOperation)(this.s.client,new p.CreateCollectionOperation(this,e,(0,w.resolveOptions)(this,t)),n)}command(e,t,n){return"function"==typeof t&&(n=t,t={}),(0,m.executeOperation)(this.s.client,new b.RunCommandOperation(this,e,null!=t?t:{}),n)}aggregate(e=[],t){if(arguments.length>2)throw new c.MongoInvalidArgumentError('Method "db.aggregate()" accepts at most two arguments');if("function"==typeof e)throw new c.MongoInvalidArgumentError('Argument "pipeline" must not be function');if("function"==typeof t)throw new c.MongoInvalidArgumentError('Argument "options" must not be function');return new a.AggregationCursor(this.s.client,this.s.namespace,e,(0,w.resolveOptions)(this,t))}admin(){return new r.Admin(this)}collection(e,t={}){if("function"==typeof t)throw new c.MongoInvalidArgumentError("The callback form of this helper has been removed.");const n=(0,w.resolveOptions)(this,t);return new s.Collection(this,e,n)}stats(e,t){return"function"==typeof e&&(t=e,e={}),(0,m.executeOperation)(this.s.client,new S.DbStatsOperation(this,(0,w.resolveOptions)(this,e)),t)}listCollections(e={},t={}){return new E.ListCollectionsCursor(this,e,(0,w.resolveOptions)(this,t))}renameCollection(e,t,n,r){return"function"==typeof n&&(r=n,n={}),(n={...n,readPreference:_.ReadPreference.PRIMARY}).new_collection=!0,(0,m.executeOperation)(this.s.client,new A.RenameOperation(this.collection(e),t,n),r)}dropCollection(e,t,n){return"function"==typeof t&&(n=t,t={}),(0,m.executeOperation)(this.s.client,new h.DropCollectionOperation(this,e,(0,w.resolveOptions)(this,t)),n)}dropDatabase(e,t){return"function"==typeof e&&(t=e,e={}),(0,m.executeOperation)(this.s.client,new h.DropDatabaseOperation(this,(0,w.resolveOptions)(this,e)),t)}collections(e,t){return"function"==typeof e&&(t=e,e={}),(0,m.executeOperation)(this.s.client,new f.CollectionsOperation(this,(0,w.resolveOptions)(this,e)),t)}createIndex(e,t,n,r){return"function"==typeof n&&(r=n,n={}),(0,m.executeOperation)(this.s.client,new g.CreateIndexOperation(this,e,t,(0,w.resolveOptions)(this,n)),r)}addUser(e,t,n,r){return"function"==typeof t?(r=t,t=void 0,n={}):"string"!=typeof t?"function"==typeof n?(r=n,n=t,t=void 0):(n=t,r=void 0,t=void 0):"function"==typeof n&&(r=n,n={}),(0,m.executeOperation)(this.s.client,new d.AddUserOperation(this,e,t,(0,w.resolveOptions)(this,n)),r)}removeUser(e,t,n){return"function"==typeof t&&(n=t,t={}),(0,m.executeOperation)(this.s.client,new v.RemoveUserOperation(this,e,(0,w.resolveOptions)(this,t)),n)}setProfilingLevel(e,t,n){return"function"==typeof t&&(n=t,t={}),(0,m.executeOperation)(this.s.client,new C.SetProfilingLevelOperation(this,e,(0,w.resolveOptions)(this,t)),n)}profilingLevel(e,t){return"function"==typeof e&&(t=e,e={}),(0,m.executeOperation)(this.s.client,new y.ProfilingLevelOperation(this,(0,w.resolveOptions)(this,e)),t)}indexInformation(e,t,n){return"function"==typeof t&&(n=t,t={}),(0,m.executeOperation)(this.s.client,new g.IndexInformationOperation(this,e,(0,w.resolveOptions)(this,t)),n)}unref(){(0,w.getTopology)(this).unref()}watch(e=[],t={}){return Array.isArray(e)||(t=e,e=[]),new i.ChangeStream(this,e,(0,w.resolveOptions)(this,t))}getLogger(){return this.s.logger}get logger(){return this.s.logger}}t.Db=T,T.SYSTEM_NAMESPACE_COLLECTION=u.SYSTEM_NAMESPACE_COLLECTION,T.SYSTEM_INDEX_COLLECTION=u.SYSTEM_INDEX_COLLECTION,T.SYSTEM_PROFILE_COLLECTION=u.SYSTEM_PROFILE_COLLECTION,T.SYSTEM_USER_COLLECTION=u.SYSTEM_USER_COLLECTION,T.SYSTEM_COMMAND_COLLECTION=u.SYSTEM_COMMAND_COLLECTION,T.SYSTEM_JS_COLLECTION=u.SYSTEM_JS_COLLECTION},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AggregationCursor=void 0;const r=n(102),o=n(14),i=n(2),s=n(22),u=Symbol("pipeline"),a=Symbol("options");class c extends s.AbstractCursor{constructor(e,t,n=[],r={}){super(e,t,r),this[u]=n,this[a]=r}get pipeline(){return this[u]}clone(){const e=(0,i.mergeOptions)({},this[a]);return delete e.session,new c(this.client,this.namespace,this[u],{...e})}map(e){return super.map(e)}_initialize(e,t){const n=new r.AggregateOperation(this.namespace,this[u],{...this[a],...this.cursorOptions,session:e});(0,o.executeOperation)(this.client,n,(r,o)=>{if(r||null==o)return t(r);t(void 0,{server:n.server,session:e,response:o})})}explain(e,t){return"function"==typeof e&&(t=e,e=!0),null==e&&(e=!0),(0,o.executeOperation)(this.client,new r.AggregateOperation(this.namespace,this[u],{...this[a],...this.cursorOptions,explain:e}),t)}group(e){return(0,s.assertUninitialized)(this),this[u].push({$group:e}),this}limit(e){return(0,s.assertUninitialized)(this),this[u].push({$limit:e}),this}match(e){return(0,s.assertUninitialized)(this),this[u].push({$match:e}),this}out(e){return(0,s.assertUninitialized)(this),this[u].push({$out:e}),this}project(e){return(0,s.assertUninitialized)(this),this[u].push({$project:e}),this}lookup(e){return(0,s.assertUninitialized)(this),this[u].push({$lookup:e}),this}redact(e){return(0,s.assertUninitialized)(this),this[u].push({$redact:e}),this}skip(e){return(0,s.assertUninitialized)(this),this[u].push({$skip:e}),this}sort(e){return(0,s.assertUninitialized)(this),this[u].push({$sort:e}),this}unwind(e){return(0,s.assertUninitialized)(this),this[u].push({$unwind:e}),this}geoNear(e){return(0,s.assertUninitialized)(this),this[u].push({$geoNear:e}),this}}t.AggregationCursor=c},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AggregateOperation=t.DB_AGGREGATE_COLLECTION=void 0;const r=n(1),o=n(2),i=n(5),s=n(3);t.DB_AGGREGATE_COLLECTION=1;class u extends i.CommandOperation{constructor(e,n,o){if(super(void 0,{...o,dbName:e.db}),this.options=null!=o?o:{},this.target=e.collection||t.DB_AGGREGATE_COLLECTION,this.pipeline=n,this.hasWriteStage=!1,"string"==typeof(null==o?void 0:o.out))this.pipeline=this.pipeline.concat({$out:o.out}),this.hasWriteStage=!0;else if(n.length>0){const e=n[n.length-1];(e.$out||e.$merge)&&(this.hasWriteStage=!0)}if(this.hasWriteStage&&(this.trySecondaryWrite=!0),this.explain&&this.writeConcern)throw new r.MongoInvalidArgumentError('Option "explain" cannot be used on an aggregate call with writeConcern');if(null!=(null==o?void 0:o.cursor)&&"object"!=typeof o.cursor)throw new r.MongoInvalidArgumentError("Cursor options must be an object")}get canRetryRead(){return!this.hasWriteStage}addToPipeline(e){this.pipeline.push(e)}execute(e,t,n){const r=this.options,i=(0,o.maxWireVersion)(e),s={aggregate:this.target,pipeline:this.pipeline};this.hasWriteStage&&i<8&&(this.readConcern=void 0),i>=5&&this.hasWriteStage&&this.writeConcern&&Object.assign(s,{writeConcern:this.writeConcern}),!0===r.bypassDocumentValidation&&(s.bypassDocumentValidation=r.bypassDocumentValidation),"boolean"==typeof r.allowDiskUse&&(s.allowDiskUse=r.allowDiskUse),r.hint&&(s.hint=r.hint),r.let&&(s.let=r.let),void 0!==r.comment&&(s.comment=r.comment),s.cursor=r.cursor||{},r.batchSize&&!this.hasWriteStage&&(s.cursor.batchSize=r.batchSize),super.executeCommand(e,t,s,n)}}t.AggregateOperation=u,(0,s.defineAspects)(u,[s.Aspect.READ_OPERATION,s.Aspect.RETRYABLE,s.Aspect.EXPLAINABLE,s.Aspect.CURSOR_CREATING])},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.FEATURE_FLAGS=t.DEFAULT_OPTIONS=t.OPTIONS=t.parseOptions=t.checkTLSOptions=t.resolveSRVRecord=void 0;const r=n(104),o=n(64),i=n(175),s=n(59),u=n(180),a=n(35),c=n(111),l=n(401),d=n(1),f=n(23),p=n(43),h=n(33),m=n(11),g=n(6),E=n(2),y=n(13),v=["authSource","replicaSet","loadBalanced"];function A(e,t){const n=/^.*?\./,r=`.${e.replace(n,"")}`,o=`.${t.replace(n,"")}`;return r.endsWith(o)}function b(e){if(!e)return;const t=(t,n)=>{if(Reflect.has(e,t)&&Reflect.has(e,n))throw new d.MongoParseError(`The '${t}' option cannot be used with '${n}'`)};t("tlsInsecure","tlsAllowInvalidCertificates"),t("tlsInsecure","tlsAllowInvalidHostnames"),t("tlsInsecure","tlsDisableCertificateRevocationCheck"),t("tlsInsecure","tlsDisableOCSPEndpointCheck"),t("tlsAllowInvalidCertificates","tlsDisableCertificateRevocationCheck"),t("tlsAllowInvalidCertificates","tlsDisableOCSPEndpointCheck"),t("tlsDisableCertificateRevocationCheck","tlsDisableOCSPEndpointCheck")}t.resolveSRVRecord=function(e,t){if("string"!=typeof e.srvHost)return t(new d.MongoAPIError('Option "srvHost" must not be empty'));if(e.srvHost.split(".").length<3)return t(new d.MongoAPIError("URI must include hostname, domain name, and tld"));const n=e.srvHost;r.resolveSrv(`_${e.srvServiceName}._tcp.${n}`,(o,i)=>{if(o)return t(o);if(0===i.length)return t(new d.MongoAPIError("No addresses found at host"));for(const{name:e}of i)if(!A(e,n))return t(new d.MongoAPIError("Server record does not share hostname with parent URI"));const c=i.map(e=>{var t;return E.HostAddress.fromString(`${e.name}:${null!==(t=e.port)&&void 0!==t?t:27017}`)}),l=T(c,e,!0);if(l)return t(l);r.resolveTxt(n,(n,r)=>{var o,i,l;if(n){if("ENODATA"!==n.code&&"ENOTFOUND"!==n.code)return t(n)}else{if(r.length>1)return t(new d.MongoParseError("Multiple text records not allowed"));const n=new s.URLSearchParams(r[0].join(""));if([...n.keys()].some(e=>!v.includes(e)))return t(new d.MongoParseError(`Text record may only set any of: ${v.join(", ")}`));if(v.some(e=>""===n.get(e)))return t(new d.MongoParseError("Cannot have empty URI params in DNS TXT Record"));const f=null!==(o=n.get("authSource"))&&void 0!==o?o:void 0,p=null!==(i=n.get("replicaSet"))&&void 0!==i?i:void 0,h=null!==(l=n.get("loadBalanced"))&&void 0!==l?l:void 0;if(!e.userSpecifiedAuthSource&&f&&e.credentials&&!a.AUTH_MECHS_AUTH_SRC_EXTERNAL.has(e.credentials.mechanism)&&(e.credentials=u.MongoCredentials.merge(e.credentials,{source:f})),!e.userSpecifiedReplicaSet&&p&&(e.replicaSet=p),"true"===h&&(e.loadBalanced=!0),e.replicaSet&&e.srvMaxHosts>0)return t(new d.MongoParseError("Cannot combine replicaSet option with srvMaxHosts"));const m=T(c,e,!0);if(m)return t(m)}t(void 0,c)})})},t.checkTLSOptions=b;const C=new Set(["true","t","1","y","yes"]),S=new Set(["false","f","0","n","no","-1"]);function O(e,t){if("boolean"==typeof t)return t;const n=String(t).toLowerCase();if(C.has(n))return"true"!==n&&(0,E.emitWarningOnce)(`deprecated value for ${e} : ${n} - please update to ${e} : true instead`),!0;if(S.has(n))return"false"!==n&&(0,E.emitWarningOnce)(`deprecated value for ${e} : ${n} - please update to ${e} : false instead`),!1;throw new d.MongoParseError(`Expected ${e} to be stringified boolean value, got: ${t}`)}function _(e,t){if("number"==typeof t)return Math.trunc(t);const n=Number.parseInt(String(t),10);if(!Number.isNaN(n))return n;throw new d.MongoParseError(`Expected ${e} to be stringified int value, got: ${t}`)}function w(e,t){const n=_(e,t);if(n<0)throw new d.MongoParseError(`${e} can only be a positive int value, got: ${t}`);return n}function*D(e){const t=e.split(",");for(const e of t){const[t,n]=e.split(":");if(null==n)throw new d.MongoParseError("Cannot have undefined values in key value pairs");yield[t,n]}}class B extends Map{constructor(e=[]){super(e.map(([e,t])=>[e.toLowerCase(),t]))}has(e){return super.has(e.toLowerCase())}get(e){return super.get(e.toLowerCase())}set(e,t){return super.set(e.toLowerCase(),t)}delete(e){return super.delete(e.toLowerCase())}}function T(e,t,n){if(t.loadBalanced){if(e.length>1)return new d.MongoParseError("loadBalanced option only supported with a single host in the URI");if(t.replicaSet)return new d.MongoParseError("loadBalanced option not supported with a replicaSet option");if(t.directConnection)return new d.MongoParseError("loadBalanced option not supported when directConnection is provided");if(n&&t.srvMaxHosts>0)return new d.MongoParseError("Cannot limit srv hosts with loadBalanced enabled")}}function F(e,t,n,r){const{target:o,type:i,transform:s,deprecated:u}=n,a=null!=o?o:t;if(u){const e="string"==typeof u?`: ${u}`:"";(0,E.emitWarning)(`${t} is a deprecated option${e}`)}switch(i){case"boolean":e[a]=O(a,r[0]);break;case"int":e[a]=_(a,r[0]);break;case"uint":e[a]=w(a,r[0]);break;case"string":if(null==r[0])break;e[a]=String(r[0]);break;case"record":if(!(0,E.isRecord)(r[0]))throw new d.MongoParseError(`${a} must be an object`);e[a]=r[0];break;case"any":e[a]=r[0];break;default:{if(!s)throw new d.MongoParseError("Descriptors missing a type must define a transform");const t=s({name:a,options:e,values:r});e[a]=t;break}}}t.parseOptions=function(e,n,r={}){null==n||n instanceof p.MongoClient||(r=n,n=void 0);const o=new i.default(e),{hosts:s,isSRV:c}=o,f=Object.create(null);for(const e of Object.getOwnPropertySymbols(r))t.FEATURE_FLAGS.has(e)&&(f[e]=r[e]);f.hosts=c?[]:s.map(E.HostAddress.fromString);const m=new B;if("/"!==o.pathname&&""!==o.pathname){const e=decodeURIComponent("/"===o.pathname[0]?o.pathname.slice(1):o.pathname);e&&m.set("dbName",[e])}if(""!==o.username){const e={username:decodeURIComponent(o.username)};"string"==typeof o.password&&(e.password=decodeURIComponent(o.password)),m.set("auth",[e])}for(const e of o.searchParams.keys()){const t=[...o.searchParams.getAll(e)];if(t.includes(""))throw new d.MongoAPIError("URI cannot contain options with no value");m.has(e)||m.set(e,t)}const g=new B(Object.entries(r).filter(([,e])=>null!=e));if(m.has("serverApi"))throw new d.MongoParseError("URI cannot contain `serverApi`, it can only be passed to the client");if(g.has("loadBalanced"))throw new d.MongoParseError("loadBalanced is only a valid option in the URI");const y=new B,v=new Set([...m.keys(),...g.keys(),...t.DEFAULT_OPTIONS.keys()]);for(const e of v){const n=[],r=g.get(e);null!=r&&n.push(r);const o=m.get(e);null!=o&&n.push(...o);const i=t.DEFAULT_OPTIONS.get(e);null!=i&&n.push(i),y.set(e,n)}if(y.has("tlsCertificateKeyFile")&&!y.has("tlsCertificateFile")&&y.set("tlsCertificateFile",y.get("tlsCertificateKeyFile")),y.has("tls")||y.has("ssl")){const e=(y.get("tls")||[]).concat(y.get("ssl")||[]).map(O.bind(null,"tls/ssl"));if(1!==new Set(e).size)throw new d.MongoParseError("All values of tls/ssl must be the same.")}const A=(0,E.setDifference)(v,Array.from(Object.keys(t.OPTIONS)).map(e=>e.toLowerCase()));if(0!==A.size){const e=A.size>1?"options":"option",t=A.size>1?"are":"is";throw new d.MongoParseError(`${e} ${Array.from(A).join(", ")} ${t} not supported`)}for(const[e,n]of Object.entries(t.OPTIONS)){const t=y.get(e);t&&0!==t.length&&F(f,e,n,t)}if(f.credentials){const e=f.credentials.mechanism===a.AuthMechanism.MONGODB_GSSAPI,t=f.credentials.mechanism===a.AuthMechanism.MONGODB_X509,n=f.credentials.mechanism===a.AuthMechanism.MONGODB_AWS;if((e||t)&&y.has("authSource")&&"$external"!==f.credentials.source)throw new d.MongoParseError(`${f.credentials} can only have authSource set to '$external'`);e||t||n||!f.dbName||y.has("authSource")||(f.credentials=u.MongoCredentials.merge(f.credentials,{source:f.dbName})),f.credentials.validate(),""===f.credentials.password&&""===f.credentials.username&&f.credentials.mechanism===a.AuthMechanism.MONGODB_DEFAULT&&0===Object.keys(f.credentials.mechanismProperties).length&&delete f.credentials}f.dbName||(f.dbName="test"),b(f),r.promiseLibrary&&h.PromiseProvider.set(r.promiseLibrary);const C=T(s,f,c);if(C)throw C;if(n&&f.autoEncryption&&(l.Encrypter.checkForMongoCrypt(),f.encrypter=new l.Encrypter(n,e,r),f.autoEncrypter=f.encrypter.autoEncrypter),f.userSpecifiedAuthSource=g.has("authSource")||m.has("authSource"),f.userSpecifiedReplicaSet=g.has("replicaSet")||m.has("replicaSet"),c){if(f.srvHost=s[0],f.directConnection)throw new d.MongoAPIError("SRV URI does not support directConnection");if(f.srvMaxHosts>0&&"string"==typeof f.replicaSet)throw new d.MongoParseError("Cannot use srvMaxHosts option with replicaSet");const e=!g.has("tls")&&!m.has("tls"),t=!g.has("ssl")&&!m.has("ssl");e&&t&&(f.tls=!0)}else{if(m.has("srvMaxHosts")||g.has("srvMaxHosts")||m.has("srvServiceName")||g.has("srvServiceName"))throw new d.MongoParseError("Cannot use srvMaxHosts or srvServiceName with a non-srv connection string")}if(f.directConnection&&1!==f.hosts.length)throw new d.MongoParseError("directConnection option requires exactly one host");if(!f.proxyHost&&(f.proxyPort||f.proxyUsername||f.proxyPassword))throw new d.MongoParseError("Must specify proxyHost if other proxy options are passed");if(f.proxyUsername&&!f.proxyPassword||!f.proxyUsername&&f.proxyPassword)throw new d.MongoParseError("Can only specify both of proxy username/password or neither");if(["proxyHost","proxyPort","proxyUsername","proxyPassword"].map(e=>{var t;return null!==(t=m.get(e))&&void 0!==t?t:[]}).some(e=>e.length>1))throw new d.MongoParseError("Proxy options cannot be specified multiple times in the connection string");return f},t.OPTIONS={appName:{target:"metadata",transform:({options:e,values:[t]})=>(0,E.makeClientMetadata)({...e.driverInfo,appName:String(t)})},auth:{target:"credentials",transform({name:e,options:t,values:[n]}){if(!(0,E.isRecord)(n,["username","password"]))throw new d.MongoParseError(`${e} must be an object with 'username' and 'password' properties`);return u.MongoCredentials.merge(t.credentials,{username:n.username,password:n.password})}},authMechanism:{target:"credentials",transform({options:e,values:[t]}){var n,r;const o=Object.values(a.AuthMechanism),[i]=o.filter(e=>e.match(RegExp(String.raw`\b${t}\b`,"i")));if(!i)throw new d.MongoParseError(`authMechanism one of ${o}, got ${t}`);let s=null===(n=e.credentials)||void 0===n?void 0:n.source;(i===a.AuthMechanism.MONGODB_PLAIN||a.AUTH_MECHS_AUTH_SRC_EXTERNAL.has(i))&&(s="$external");let c=null===(r=e.credentials)||void 0===r?void 0:r.password;return i===a.AuthMechanism.MONGODB_X509&&""===c&&(c=void 0),u.MongoCredentials.merge(e.credentials,{mechanism:i,source:s,password:c})}},authMechanismProperties:{target:"credentials",transform({options:e,values:[t]}){if("string"==typeof t){const n=Object.create(null);for(const[e,r]of D(t))try{n[e]=O(e,r)}catch{n[e]=r}return u.MongoCredentials.merge(e.credentials,{mechanismProperties:n})}if(!(0,E.isRecord)(t))throw new d.MongoParseError("AuthMechanismProperties must be an object");return u.MongoCredentials.merge(e.credentials,{mechanismProperties:t})}},authSource:{target:"credentials",transform({options:e,values:[t]}){const n=String(t);return u.MongoCredentials.merge(e.credentials,{source:n})}},autoEncryption:{type:"record"},bsonRegExp:{type:"boolean"},serverApi:{target:"serverApi",transform({values:[e]}){const t="string"==typeof e?{version:e}:e,n=t&&t.version;if(!n)throw new d.MongoParseError(`Invalid \`serverApi\` property; must specify a version from the following enum: ["${Object.values(p.ServerApiVersion).join('", "')}"]`);if(!Object.values(p.ServerApiVersion).some(e=>e===n))throw new d.MongoParseError(`Invalid server API version=${n}; must be in the following enum: ["${Object.values(p.ServerApiVersion).join('", "')}"]`);return t}},checkKeys:{type:"boolean"},compressors:{default:"none",target:"compressors",transform({values:e}){const t=new Set;for(const n of e){const e="string"==typeof n?n.split(","):n;if(!Array.isArray(e))throw new d.MongoInvalidArgumentError("compressors must be an array or a comma-delimited list of strings");for(const n of e){if(!Object.keys(c.Compressor).includes(String(n)))throw new d.MongoInvalidArgumentError(`${n} is not a valid compression mechanism. Must be one of: ${Object.keys(c.Compressor)}.`);t.add(String(n))}}return[...t]}},connectTimeoutMS:{default:3e4,type:"uint"},dbName:{type:"string"},directConnection:{default:!1,type:"boolean"},driverInfo:{target:"metadata",default:(0,E.makeClientMetadata)(),transform({options:e,values:[t]}){var n,r;if(!(0,E.isRecord)(t))throw new d.MongoParseError("DriverInfo must be an object");return(0,E.makeClientMetadata)({driverInfo:t,appName:null===(r=null===(n=e.metadata)||void 0===n?void 0:n.application)||void 0===r?void 0:r.name})}},enableUtf8Validation:{type:"boolean",default:!0},family:{transform({name:e,values:[t]}){const n=_(e,t);if(4===n||6===n)return n;throw new d.MongoParseError(`Option 'family' must be 4 or 6 got ${n}.`)}},fieldsAsRaw:{type:"record"},forceServerObjectId:{default:!1,type:"boolean"},fsync:{deprecated:"Please use journal instead",target:"writeConcern",transform({name:e,options:t,values:[n]}){const r=y.WriteConcern.fromOptions({writeConcern:{...t.writeConcern,fsync:O(e,n)}});if(!r)throw new d.MongoParseError(`Unable to make a writeConcern from fsync=${n}`);return r}},heartbeatFrequencyMS:{default:1e4,type:"uint"},ignoreUndefined:{type:"boolean"},j:{deprecated:"Please use journal instead",target:"writeConcern",transform({name:e,options:t,values:[n]}){const r=y.WriteConcern.fromOptions({writeConcern:{...t.writeConcern,journal:O(e,n)}});if(!r)throw new d.MongoParseError(`Unable to make a writeConcern from journal=${n}`);return r}},journal:{target:"writeConcern",transform({name:e,options:t,values:[n]}){const r=y.WriteConcern.fromOptions({writeConcern:{...t.writeConcern,journal:O(e,n)}});if(!r)throw new d.MongoParseError(`Unable to make a writeConcern from journal=${n}`);return r}},keepAlive:{default:!0,type:"boolean"},keepAliveInitialDelay:{default:12e4,type:"uint"},loadBalanced:{default:!1,type:"boolean"},localThresholdMS:{default:15,type:"uint"},logger:{default:new f.Logger("MongoClient"),transform({values:[e]}){if(e instanceof f.Logger)return e;(0,E.emitWarning)("Alternative loggers might not be supported")}},loggerLevel:{target:"logger",transform:({values:[e]})=>new f.Logger("MongoClient",{loggerLevel:e})},maxConnecting:{default:2,transform({name:e,values:[t]}){const n=w(e,t);if(0===n)throw new d.MongoInvalidArgumentError("maxConnecting must be > 0 if specified");return n}},maxIdleTimeMS:{default:0,type:"uint"},maxPoolSize:{default:100,type:"uint"},maxStalenessSeconds:{target:"readPreference",transform({name:e,options:t,values:[n]}){const r=w(e,n);return t.readPreference?g.ReadPreference.fromOptions({readPreference:{...t.readPreference,maxStalenessSeconds:r}}):new g.ReadPreference("secondary",void 0,{maxStalenessSeconds:r})}},minInternalBufferSize:{type:"uint"},minPoolSize:{default:0,type:"uint"},minHeartbeatFrequencyMS:{default:500,type:"uint"},monitorCommands:{default:!1,type:"boolean"},name:{target:"driverInfo",transform:({values:[e],options:t})=>({...t.driverInfo,name:String(e)})},noDelay:{default:!0,type:"boolean"},pkFactory:{default:E.DEFAULT_PK_FACTORY,transform({values:[e]}){if((0,E.isRecord)(e,["createPk"])&&"function"==typeof e.createPk)return e;throw new d.MongoParseError(`Option pkFactory must be an object with a createPk function, got ${e}`)}},promiseLibrary:{deprecated:!0,type:"any"},promoteBuffers:{type:"boolean"},promoteLongs:{type:"boolean"},promoteValues:{type:"boolean"},proxyHost:{type:"string"},proxyPassword:{type:"string"},proxyPort:{type:"uint"},proxyUsername:{type:"string"},raw:{default:!1,type:"boolean"},readConcern:{transform({values:[e],options:t}){if(e instanceof m.ReadConcern||(0,E.isRecord)(e,["level"]))return m.ReadConcern.fromOptions({...t.readConcern,...e});throw new d.MongoParseError(`ReadConcern must be an object, got ${JSON.stringify(e)}`)}},readConcernLevel:{target:"readConcern",transform:({values:[e],options:t})=>m.ReadConcern.fromOptions({...t.readConcern,level:e})},readPreference:{default:g.ReadPreference.primary,transform({values:[e],options:t}){var n,r,o;if(e instanceof g.ReadPreference)return g.ReadPreference.fromOptions({readPreference:{...t.readPreference,...e},...e});if((0,E.isRecord)(e,["mode"])){const n=g.ReadPreference.fromOptions({readPreference:{...t.readPreference,...e},...e});if(n)return n;throw new d.MongoParseError(`Cannot make read preference from ${JSON.stringify(e)}`)}if("string"==typeof e){const i={hedge:null===(n=t.readPreference)||void 0===n?void 0:n.hedge,maxStalenessSeconds:null===(r=t.readPreference)||void 0===r?void 0:r.maxStalenessSeconds};return new g.ReadPreference(e,null===(o=t.readPreference)||void 0===o?void 0:o.tags,i)}throw new d.MongoParseError(`Unknown ReadPreference value: ${e}`)}},readPreferenceTags:{target:"readPreference",transform({values:e,options:t}){const n=Array.isArray(e[0])?e[0]:e,r=[];for(const e of n){const t=Object.create(null);if("string"==typeof e)for(const[n,r]of D(e))t[n]=r;if((0,E.isRecord)(e))for(const[n,r]of Object.entries(e))t[n]=r;r.push(t)}return g.ReadPreference.fromOptions({readPreference:t.readPreference,readPreferenceTags:r})}},replicaSet:{type:"string"},retryReads:{default:!0,type:"boolean"},retryWrites:{default:!0,type:"boolean"},serializeFunctions:{type:"boolean"},serverSelectionTimeoutMS:{default:3e4,type:"uint"},servername:{type:"string"},socketTimeoutMS:{default:0,type:"uint"},srvMaxHosts:{type:"uint",default:0},srvServiceName:{type:"string",default:"mongodb"},ssl:{target:"tls",type:"boolean"},sslCA:{target:"ca",transform:({values:[e]})=>o.readFileSync(String(e),{encoding:"ascii"})},sslCRL:{target:"crl",transform:({values:[e]})=>o.readFileSync(String(e),{encoding:"ascii"})},sslCert:{target:"cert",transform:({values:[e]})=>o.readFileSync(String(e),{encoding:"ascii"})},sslKey:{target:"key",transform:({values:[e]})=>o.readFileSync(String(e),{encoding:"ascii"})},sslPass:{deprecated:!0,target:"passphrase",type:"string"},sslValidate:{target:"rejectUnauthorized",type:"boolean"},tls:{type:"boolean"},tlsAllowInvalidCertificates:{target:"rejectUnauthorized",transform:({name:e,values:[t]})=>!O(e,t)},tlsAllowInvalidHostnames:{target:"checkServerIdentity",transform:({name:e,values:[t]})=>O(e,t)?()=>{}:void 0},tlsCAFile:{target:"ca",transform:({values:[e]})=>o.readFileSync(String(e),{encoding:"ascii"})},tlsCertificateFile:{target:"cert",transform:({values:[e]})=>o.readFileSync(String(e),{encoding:"ascii"})},tlsCertificateKeyFile:{target:"key",transform:({values:[e]})=>o.readFileSync(String(e),{encoding:"ascii"})},tlsCertificateKeyFilePassword:{target:"passphrase",type:"any"},tlsInsecure:{transform({name:e,options:t,values:[n]}){const r=O(e,n);return r?(t.checkServerIdentity=()=>{},t.rejectUnauthorized=!1):(t.checkServerIdentity=t.tlsAllowInvalidHostnames?()=>{}:void 0,t.rejectUnauthorized=!t.tlsAllowInvalidCertificates),r}},w:{target:"writeConcern",transform:({values:[e],options:t})=>y.WriteConcern.fromOptions({writeConcern:{...t.writeConcern,w:e}})},waitQueueTimeoutMS:{default:0,type:"uint"},writeConcern:{target:"writeConcern",transform({values:[e],options:t}){if((0,E.isRecord)(e)||e instanceof y.WriteConcern)return y.WriteConcern.fromOptions({writeConcern:{...t.writeConcern,...e}});if("majority"===e||"number"==typeof e)return y.WriteConcern.fromOptions({writeConcern:{...t.writeConcern,w:e}});throw new d.MongoParseError(`Invalid WriteConcern cannot parse: ${JSON.stringify(e)}`)}},wtimeout:{deprecated:"Please use wtimeoutMS instead",target:"writeConcern",transform({values:[e],options:t}){const n=y.WriteConcern.fromOptions({writeConcern:{...t.writeConcern,wtimeout:w("wtimeout",e)}});if(n)return n;throw new d.MongoParseError("Cannot make WriteConcern from wtimeout")}},wtimeoutMS:{target:"writeConcern",transform({values:[e],options:t}){const n=y.WriteConcern.fromOptions({writeConcern:{...t.writeConcern,wtimeoutMS:w("wtimeoutMS",e)}});if(n)return n;throw new d.MongoParseError("Cannot make WriteConcern from wtimeout")}},zlibCompressionLevel:{default:0,type:"int"},connectionType:{type:"any"},srvPoller:{type:"any"},minDHSize:{type:"any"},pskCallback:{type:"any"},secureContext:{type:"any"},enableTrace:{type:"any"},requestCert:{type:"any"},rejectUnauthorized:{type:"any"},checkServerIdentity:{type:"any"},ALPNProtocols:{type:"any"},SNICallback:{type:"any"},session:{type:"any"},requestOCSP:{type:"any"},localAddress:{type:"any"},localPort:{type:"any"},hints:{type:"any"},lookup:{type:"any"},ca:{type:"any"},cert:{type:"any"},ciphers:{type:"any"},crl:{type:"any"},ecdhCurve:{type:"any"},key:{type:"any"},passphrase:{type:"any"},pfx:{type:"any"},secureProtocol:{type:"any"},index:{type:"any"},useNewUrlParser:{type:"boolean"},useUnifiedTopology:{type:"boolean"}},t.DEFAULT_OPTIONS=new B(Object.entries(t.OPTIONS).filter(([,e])=>null!=e.default).map(([e,t])=>[e,t.default])),t.FEATURE_FLAGS=new Set([Symbol.for("@@mdb.skipPingOnConnect")])},function(e,t){e.exports=require("dns")},function(e,t,n){"use strict";function r(e,t,n){return n.globals&&(e=n.globals[e.name]),new e(`${n.context?n.context:"Value"} ${t}.`)}function o(e,t){if("bigint"==typeof e)throw r(TypeError,"is a BigInt which cannot be converted to a number",t);return t.globals?t.globals.Number(e):Number(e)}function i(e){return a(e>0&&e%1==.5&&0==(1&e)||e<0&&e%1==-.5&&1==(1&e)?Math.floor(e):Math.round(e))}function s(e){return a(Math.trunc(e))}function u(e){return e<0?-1:1}function a(e){return 0===e?0:e}function c(e,{unsigned:t}){let n,c;t?(n=0,c=2**e-1):(n=-(2**(e-1)),c=2**(e-1)-1);const l=2**e,d=2**(e-1);return(e,f={})=>{let p=o(e,f);if(p=a(p),f.enforceRange){if(!Number.isFinite(p))throw r(TypeError,"is not a finite number",f);if(p=s(p),p<n||p>c)throw r(TypeError,`is outside the accepted range of ${n} to ${c}, inclusive`,f);return p}return!Number.isNaN(p)&&f.clamp?(p=Math.min(Math.max(p,n),c),p=i(p),p):Number.isFinite(p)&&0!==p?(p=s(p),p>=n&&p<=c?p:(p=function(e,t){const n=e%t;return u(t)!==u(n)?n+t:n}(p,l),!t&&p>=d?p-l:p)):0}}function l(e,{unsigned:t}){const n=Number.MAX_SAFE_INTEGER,u=t?0:Number.MIN_SAFE_INTEGER,c=t?BigInt.asUintN:BigInt.asIntN;return(t,l={})=>{let d=o(t,l);if(d=a(d),l.enforceRange){if(!Number.isFinite(d))throw r(TypeError,"is not a finite number",l);if(d=s(d),d<u||d>n)throw r(TypeError,`is outside the accepted range of ${u} to ${n}, inclusive`,l);return d}if(!Number.isNaN(d)&&l.clamp)return d=Math.min(Math.max(d,u),n),d=i(d),d;if(!Number.isFinite(d)||0===d)return 0;let f=BigInt(s(d));return f=c(e,f),Number(f)}}t.any=e=>e,t.undefined=()=>{},t.boolean=e=>Boolean(e),t.byte=c(8,{unsigned:!1}),t.octet=c(8,{unsigned:!0}),t.short=c(16,{unsigned:!1}),t["unsigned short"]=c(16,{unsigned:!0}),t.long=c(32,{unsigned:!1}),t["unsigned long"]=c(32,{unsigned:!0}),t["long long"]=l(64,{unsigned:!1}),t["unsigned long long"]=l(64,{unsigned:!0}),t.double=(e,t={})=>{const n=o(e,t);if(!Number.isFinite(n))throw r(TypeError,"is not a finite floating-point value",t);return n},t["unrestricted double"]=(e,t={})=>o(e,t),t.float=(e,t={})=>{const n=o(e,t);if(!Number.isFinite(n))throw r(TypeError,"is not a finite floating-point value",t);if(Object.is(n,-0))return n;const i=Math.fround(n);if(!Number.isFinite(i))throw r(TypeError,"is outside the range of a single-precision floating-point value",t);return i},t["unrestricted float"]=(e,t={})=>{const n=o(e,t);return isNaN(n)?n:Object.is(n,-0)?n:Math.fround(n)},t.DOMString=(e,t={})=>{if(t.treatNullAsEmptyString&&null===e)return"";if("symbol"==typeof e)throw r(TypeError,"is a symbol, which cannot be converted to a string",t);return(t.globals?t.globals.String:String)(e)},t.ByteString=(e,n={})=>{const o=t.DOMString(e,n);let i;for(let e=0;void 0!==(i=o.codePointAt(e));++e)if(i>255)throw r(TypeError,"is not a valid ByteString",n);return o},t.USVString=(e,n={})=>{const r=t.DOMString(e,n),o=r.length,i=[];for(let e=0;e<o;++e){const t=r.charCodeAt(e);if(t<55296||t>57343)i.push(String.fromCodePoint(t));else if(56320<=t&&t<=57343)i.push(String.fromCodePoint(65533));else if(e===o-1)i.push(String.fromCodePoint(65533));else{const n=r.charCodeAt(e+1);if(56320<=n&&n<=57343){const r=1023&t,o=1023&n;i.push(String.fromCodePoint(65536+1024*r+o)),++e}else i.push(String.fromCodePoint(65533))}}return i.join("")},t.object=(e,t={})=>{if(null===e||"object"!=typeof e&&"function"!=typeof e)throw r(TypeError,"is not an object",t);return e};const d=Object.getOwnPropertyDescriptor(ArrayBuffer.prototype,"byteLength").get,f="function"==typeof SharedArrayBuffer?Object.getOwnPropertyDescriptor(SharedArrayBuffer.prototype,"byteLength").get:null;function p(e){try{return d.call(e),!0}catch{return!1}}function h(e){try{return f.call(e),!0}catch{return!1}}function m(e){try{return new Uint8Array(e),!1}catch{return!0}}t.ArrayBuffer=(e,t={})=>{if(!p(e)){if(t.allowShared&&!h(e))throw r(TypeError,"is not an ArrayBuffer or SharedArrayBuffer",t);throw r(TypeError,"is not an ArrayBuffer",t)}if(m(e))throw r(TypeError,"is a detached ArrayBuffer",t);return e};const g=Object.getOwnPropertyDescriptor(DataView.prototype,"byteLength").get;t.DataView=(e,t={})=>{try{g.call(e)}catch(e){throw r(TypeError,"is not a DataView",t)}if(!t.allowShared&&h(e.buffer))throw r(TypeError,"is backed by a SharedArrayBuffer, which is not allowed",t);if(m(e.buffer))throw r(TypeError,"is backed by a detached ArrayBuffer",t);return e};const E=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(Uint8Array).prototype,Symbol.toStringTag).get;[Int8Array,Int16Array,Int32Array,Uint8Array,Uint16Array,Uint32Array,Uint8ClampedArray,Float32Array,Float64Array].forEach(e=>{const{name:n}=e,o=/^[AEIOU]/u.test(n)?"an":"a";t[n]=(e,t={})=>{if(!ArrayBuffer.isView(e)||E.call(e)!==n)throw r(TypeError,`is not ${o} ${n} object`,t);if(!t.allowShared&&h(e.buffer))throw r(TypeError,"is a view on a SharedArrayBuffer, which is not allowed",t);if(m(e.buffer))throw r(TypeError,"is a view on a detached ArrayBuffer",t);return e}}),t.ArrayBufferView=(e,t={})=>{if(!ArrayBuffer.isView(e))throw r(TypeError,"is not a view on an ArrayBuffer or SharedArrayBuffer",t);if(!t.allowShared&&h(e.buffer))throw r(TypeError,"is a view on a SharedArrayBuffer, which is not allowed",t);if(m(e.buffer))throw r(TypeError,"is a view on a detached ArrayBuffer",t);return e},t.BufferSource=(e,t={})=>{if(ArrayBuffer.isView(e)){if(!t.allowShared&&h(e.buffer))throw r(TypeError,"is a view on a SharedArrayBuffer, which is not allowed",t);if(m(e.buffer))throw r(TypeError,"is a view on a detached ArrayBuffer",t);return e}if(!t.allowShared&&!p(e))throw r(TypeError,"is not an ArrayBuffer or a view on one",t);if(t.allowShared&&!h(e)&&!p(e))throw r(TypeError,"is not an ArrayBuffer, SharedArrayBuffer, or a view on one",t);if(m(e))throw r(TypeError,"is a detached ArrayBuffer",t);return e},t.DOMTimeStamp=t["unsigned long long"]},function(e,t,n){"use strict";const r=Function.prototype.call.bind(Object.prototype.hasOwnProperty);const o=Symbol("wrapper"),i=Symbol("impl"),s=Symbol("SameObject caches"),u=Symbol.for("[webidl2js] constructor registry"),a=Object.getPrototypeOf(Object.getPrototypeOf((async function*(){})).prototype);function c(e){if(r(e,u))return e[u];const t=Object.create(null);t["%Object.prototype%"]=e.Object.prototype,t["%IteratorPrototype%"]=Object.getPrototypeOf(Object.getPrototypeOf((new e.Array)[Symbol.iterator]()));try{t["%AsyncIteratorPrototype%"]=Object.getPrototypeOf(Object.getPrototypeOf(e.eval("(async function* () {})").prototype))}catch{t["%AsyncIteratorPrototype%"]=a}return e[u]=t,t}function l(e){return e?e[o]:null}function d(e){return e?e[i]:null}const f=Symbol("internal");const p=Object.getOwnPropertyDescriptor(ArrayBuffer.prototype,"byteLength").get;const h=Symbol("supports property index"),m=Symbol("supported property indices"),g=Symbol("supports property name"),E=Symbol("supported property names"),y=Symbol("indexed property get"),v=Symbol("indexed property set new"),A=Symbol("indexed property set existing"),b=Symbol("named property get"),C=Symbol("named property set new"),S=Symbol("named property set existing"),O=Symbol("named property delete"),_=Symbol("async iterator get the next iteration result"),w=Symbol("async iterator return steps"),D=Symbol("async iterator initialization steps"),B=Symbol("async iterator end of iteration");e.exports={isObject:function(e){return"object"==typeof e&&null!==e||"function"==typeof e},hasOwn:r,define:function(e,t){for(const n of Reflect.ownKeys(t)){const r=Reflect.getOwnPropertyDescriptor(t,n);if(r&&!Reflect.defineProperty(e,n,r))throw new TypeError(`Cannot redefine property: ${String(n)}`)}},newObjectInRealm:function(e,t){const n=c(e);return Object.defineProperties(Object.create(n["%Object.prototype%"]),Object.getOwnPropertyDescriptors(t))},wrapperSymbol:o,implSymbol:i,getSameObject:function(e,t,n){return e[s]||(e[s]=Object.create(null)),t in e[s]?e[s][t]:(e[s][t]=n(),e[s][t])},ctorRegistrySymbol:u,initCtorRegistry:c,wrapperForImpl:l,implForWrapper:d,tryWrapperForImpl:function(e){const t=l(e);return t||e},tryImplForWrapper:function(e){const t=d(e);return t||e},iterInternalSymbol:f,isArrayBuffer:function(e){try{return p.call(e),!0}catch(e){return!1}},isArrayIndexPropName:function(e){if("string"!=typeof e)return!1;const t=e>>>0;return t!==2**32-1&&e===`${t}`},supportsPropertyIndex:h,supportedPropertyIndices:m,supportsPropertyName:g,supportedPropertyNames:E,indexedGet:y,indexedSetNew:v,indexedSetExisting:A,namedGet:b,namedSetNew:C,namedSetExisting:S,namedDelete:O,asyncIteratorNext:_,asyncIteratorReturn:w,asyncIteratorInit:D,asyncIteratorEOI:B,iteratorResult:function([e,t],n){let r;switch(n){case"key":r=e;break;case"value":r=t;break;case"key+value":r=[e,t]}return{value:r,done:!1}}}},function(e,t,n){"use strict";const r=new TextEncoder,o=new TextDecoder("utf-8",{ignoreBOM:!0});e.exports={utf8Encode:function(e){return r.encode(e)},utf8DecodeWithoutBOM:function(e){return o.decode(e)}}},function(e,t,n){"use strict";const{isASCIIHex:r}=n(177),{utf8Encode:o}=n(107);function i(e){return e.codePointAt(0)}function s(e){let t=e.toString(16).toUpperCase();return 1===t.length&&(t=`0${t}`),`%${t}`}function u(e){const t=new Uint8Array(e.byteLength);let n=0;for(let o=0;o<e.byteLength;++o){const i=e[o];if(37!==i)t[n++]=i;else if(37!==i||r(e[o+1])&&r(e[o+2])){const r=parseInt(String.fromCodePoint(e[o+1],e[o+2]),16);t[n++]=r,o+=2}else t[n++]=i}return t.slice(0,n)}function a(e){return e<=31||e>126}const c=new Set([i(" "),i('"'),i("<"),i(">"),i("`")]);const l=new Set([i(" "),i('"'),i("#"),i("<"),i(">")]);function d(e){return a(e)||l.has(e)}const f=new Set([i("?"),i("`"),i("{"),i("}")]);function p(e){return d(e)||f.has(e)}const h=new Set([i("/"),i(":"),i(";"),i("="),i("@"),i("["),i("\\"),i("]"),i("^"),i("|")]);function m(e){return p(e)||h.has(e)}const g=new Set([i("$"),i("%"),i("&"),i("+"),i(",")]);const E=new Set([i("!"),i("'"),i("("),i(")"),i("~")]);function y(e,t){const n=o(e);let r="";for(const e of n)t(e)?r+=s(e):r+=String.fromCharCode(e);return r}e.exports={isC0ControlPercentEncode:a,isFragmentPercentEncode:function(e){return a(e)||c.has(e)},isQueryPercentEncode:d,isSpecialQueryPercentEncode:function(e){return d(e)||e===i("'")},isPathPercentEncode:p,isUserinfoPercentEncode:m,isURLEncodedPercentEncode:function(e){return function(e){return m(e)||g.has(e)}(e)||E.has(e)},percentDecodeString:function(e){return u(o(e))},percentDecodeBytes:u,utf8PercentEncodeString:function(e,t,n=!1){let r="";for(const o of e)r+=n&&" "===o?"+":y(o,t);return r},utf8PercentEncodeCodePoint:function(e,t){return y(String.fromCodePoint(e),t)}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.resolveCname=t.performGSSAPICanonicalizeHostName=t.GSSAPI=t.GSSAPICanonicalizationValue=void 0;const r=n(104),o=n(44),i=n(1),s=n(2),u=n(24);t.GSSAPICanonicalizationValue=Object.freeze({on:!0,off:!1,none:"none",forward:"forward",forwardAndReverse:"forwardAndReverse"});class a extends u.AuthProvider{auth(e,t){const{connection:n,credentials:r}=e;if(null==r)return t(new i.MongoMissingCredentialsError("Credentials required for GSSAPI authentication"));const{username:u}=r;function a(e,t){return n.command((0,s.ns)("$external.$cmd"),e,void 0,t)}!function(e,t){var n;const{hostAddress:r}=e.options,{credentials:s}=e;if(!r||"string"!=typeof r.host||!s)return t(new i.MongoInvalidArgumentError("Connection must have host and port and credentials defined."));if("kModuleError"in o.Kerberos)return t(o.Kerberos.kModuleError);const{initializeClient:u}=o.Kerberos,{username:a,password:l}=s,d=s.mechanismProperties,f=null!==(n=d.SERVICE_NAME)&&void 0!==n?n:"mongodb";c(r.host,d,(e,n)=>{var r;if(e)return t(e);const o={};null!=l&&Object.assign(o,{user:a,password:l});const s=null!==(r=d.SERVICE_HOST)&&void 0!==r?r:n;let c=`${f}${"win32"===process.platform?"/":"@"}${s}`;"SERVICE_REALM"in d&&(c=`${c}@${d.SERVICE_REALM}`),u(c,o,(e,n)=>{if(e)return t(new i.MongoRuntimeError(e));t(void 0,n)})})}(e,(e,n)=>e?t(e):null==n?t(new i.MongoMissingDependencyError("GSSAPI client missing")):void n.step("",(e,r)=>{if(e)return t(e);a(function(e){return{saslStart:1,mechanism:"GSSAPI",payload:e,autoAuthorize:1}}(r),(e,r)=>e?t(e):null==r?t():void function e(t,n,r,o){t.step(r,(i,s)=>i&&0===n?o(i):i?e(t,n-1,r,o):void o(void 0,s||""))}(n,10,r.payload,(e,o)=>{if(e)return t(e);a(function(e,t){return{saslContinue:1,conversationId:t,payload:e}}(o,r.conversationId),(e,r)=>e?t(e):null==r?t():void function(e,t,n,r){e.unwrap(n,(n,o)=>{if(n)return r(n);e.wrap(o||"",{user:t},(e,t)=>{if(e)return r(e);r(void 0,t)})})}(n,u,r.payload,(e,n)=>{if(e)return t(e);a({saslContinue:1,conversationId:r.conversationId,payload:n},(e,n)=>{if(e)return t(e);t(void 0,n)})}))}))}))}}function c(e,n,o){const i=n.CANONICALIZE_HOST_NAME;if(!i||i===t.GSSAPICanonicalizationValue.none)return o(void 0,e);i===t.GSSAPICanonicalizationValue.on||i===t.GSSAPICanonicalizationValue.forwardAndReverse?r.lookup(e,(t,n)=>{if(t)return o(t);r.resolvePtr(n,(t,n)=>{if(t)return l(e,o);o(void 0,n.length>0?n[0]:e)})}):l(e,o)}function l(e,t){r.resolveCname(e,(n,r)=>n?t(void 0,e):r.length>0?t(void 0,r[0]):void t(void 0,e))}t.GSSAPI=a,t.performGSSAPICanonicalizeHostName=c,t.resolveCname=l},function(e,t){e.exports=require("path")},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.decompress=t.compress=t.uncompressibleCommands=t.Compressor=void 0;const r=n(400),o=n(8),i=n(44),s=n(1);t.Compressor=Object.freeze({none:0,snappy:1,zlib:2,zstd:3}),t.uncompressibleCommands=new Set([o.LEGACY_HELLO_COMMAND,"saslStart","saslContinue","getnonce","authenticate","createUser","updateUser","copydbSaslStart","copydbgetnonce","copydb"]);t.compress=function(e,t,n){const o={};switch(e.options.agreedCompressor){case"snappy":if("kModuleError"in i.Snappy)return n(i.Snappy.kModuleError);i.Snappy[i.PKG_VERSION].major<=6?i.Snappy.compress(t,n):i.Snappy.compress(t).then(e=>n(void 0,e)).catch(e=>n(e));break;case"zlib":e.options.zlibCompressionLevel&&(o.level=e.options.zlibCompressionLevel),r.deflate(t,o,n);break;case"zstd":if("kModuleError"in i.ZStandard)return n(i.ZStandard.kModuleError);i.ZStandard.compress(t,3).then(e=>n(void 0,e),e=>n(e));break;default:throw new s.MongoInvalidArgumentError(`Unknown compressor ${e.options.agreedCompressor} failed to compress`)}},t.decompress=function(e,n,o){if(e<0||e>3)throw new s.MongoDecompressionError(`Server sent message compressed using an unsupported compressor. (Received compressor ID ${e})`);switch(e){case t.Compressor.snappy:if("kModuleError"in i.Snappy)return o(i.Snappy.kModuleError);i.Snappy[i.PKG_VERSION].major<=6?i.Snappy.uncompress(n,{asBuffer:!0},o):i.Snappy.uncompress(n,{asBuffer:!0}).then(e=>o(void 0,e)).catch(e=>o(e));break;case t.Compressor.zstd:if("kModuleError"in i.ZStandard)return o(i.ZStandard.kModuleError);i.ZStandard.decompress(n).then(e=>o(void 0,e),e=>o(e));break;case t.Compressor.zlib:r.inflate(n,o);break;default:o(void 0,n)}}},function(e,t){e.exports=require("net")},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ServerHeartbeatFailedEvent=t.ServerHeartbeatSucceededEvent=t.ServerHeartbeatStartedEvent=t.TopologyClosedEvent=t.TopologyOpeningEvent=t.TopologyDescriptionChangedEvent=t.ServerClosedEvent=t.ServerOpeningEvent=t.ServerDescriptionChangedEvent=void 0;t.ServerDescriptionChangedEvent=class{constructor(e,t,n,r){this.topologyId=e,this.address=t,this.previousDescription=n,this.newDescription=r}};t.ServerOpeningEvent=class{constructor(e,t){this.topologyId=e,this.address=t}};t.ServerClosedEvent=class{constructor(e,t){this.topologyId=e,this.address=t}};t.TopologyDescriptionChangedEvent=class{constructor(e,t,n){this.topologyId=e,this.previousDescription=t,this.newDescription=n}};t.TopologyOpeningEvent=class{constructor(e){this.topologyId=e}};t.TopologyClosedEvent=class{constructor(e){this.topologyId=e}};t.ServerHeartbeatStartedEvent=class{constructor(e){this.connectionId=e}};t.ServerHeartbeatSucceededEvent=class{constructor(e,t,n){this.connectionId=e,this.duration=t,this.reply=null!=n?n:{}}};t.ServerHeartbeatFailedEvent=class{constructor(e,t,n){this.connectionId=e,this.duration=t,this.failure=n}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.BinMsg=t.Msg=t.Response=t.KillCursor=t.GetMore=t.Query=void 0;const r=n(4),o=n(1),i=n(6),s=n(2),u=n(42);let a=0;class c{constructor(e,t,n){if(null==e)throw new o.MongoRuntimeError("Namespace must be specified for query");if(null==t)throw new o.MongoRuntimeError("A query document must be specified for query");if(-1!==e.indexOf("\0"))throw new o.MongoRuntimeError("Namespace cannot contain a null character");this.ns=e,this.query=t,this.numberToSkip=n.numberToSkip||0,this.numberToReturn=n.numberToReturn||0,this.returnFieldSelector=n.returnFieldSelector||void 0,this.requestId=c.getRequestId(),this.pre32Limit=n.pre32Limit,this.serializeFunctions="boolean"==typeof n.serializeFunctions&&n.serializeFunctions,this.ignoreUndefined="boolean"==typeof n.ignoreUndefined&&n.ignoreUndefined,this.maxBsonSize=n.maxBsonSize||16777216,this.checkKeys="boolean"==typeof n.checkKeys&&n.checkKeys,this.batchSize=this.numberToReturn,this.tailable=!1,this.secondaryOk="boolean"==typeof n.secondaryOk&&n.secondaryOk,this.oplogReplay=!1,this.noCursorTimeout=!1,this.awaitData=!1,this.exhaust=!1,this.partial=!1}incRequestId(){this.requestId=a++}nextRequestId(){return a+1}static getRequestId(){return++a}toBin(){const e=[];let t=null,n=0;this.tailable&&(n|=2),this.secondaryOk&&(n|=4),this.oplogReplay&&(n|=8),this.noCursorTimeout&&(n|=16),this.awaitData&&(n|=32),this.exhaust&&(n|=64),this.partial&&(n|=128),this.batchSize!==this.numberToReturn&&(this.numberToReturn=this.batchSize);const o=Buffer.alloc(20+Buffer.byteLength(this.ns)+1+4+4);e.push(o);const i=r.serialize(this.query,{checkKeys:this.checkKeys,serializeFunctions:this.serializeFunctions,ignoreUndefined:this.ignoreUndefined});e.push(i),this.returnFieldSelector&&Object.keys(this.returnFieldSelector).length>0&&(t=r.serialize(this.returnFieldSelector,{checkKeys:this.checkKeys,serializeFunctions:this.serializeFunctions,ignoreUndefined:this.ignoreUndefined}),e.push(t));const s=o.length+i.length+(t?t.length:0);let a=4;return o[3]=s>>24&255,o[2]=s>>16&255,o[1]=s>>8&255,o[0]=255&s,o[a+3]=this.requestId>>24&255,o[a+2]=this.requestId>>16&255,o[a+1]=this.requestId>>8&255,o[a]=255&this.requestId,a+=4,o[a+3]=0,o[a+2]=0,o[a+1]=0,o[a]=0,a+=4,o[a+3]=u.OP_QUERY>>24&255,o[a+2]=u.OP_QUERY>>16&255,o[a+1]=u.OP_QUERY>>8&255,o[a]=255&u.OP_QUERY,a+=4,o[a+3]=n>>24&255,o[a+2]=n>>16&255,o[a+1]=n>>8&255,o[a]=255&n,a+=4,a=a+o.write(this.ns,a,"utf8")+1,o[a-1]=0,o[a+3]=this.numberToSkip>>24&255,o[a+2]=this.numberToSkip>>16&255,o[a+1]=this.numberToSkip>>8&255,o[a]=255&this.numberToSkip,a+=4,o[a+3]=this.numberToReturn>>24&255,o[a+2]=this.numberToReturn>>16&255,o[a+1]=this.numberToReturn>>8&255,o[a]=255&this.numberToReturn,a+=4,e}}t.Query=c;t.GetMore=class{constructor(e,t,n={}){this.numberToReturn=n.numberToReturn||0,this.requestId=a++,this.ns=e,this.cursorId=t}toBin(){const e=4+Buffer.byteLength(this.ns)+1+4+8+16;let t=0;const n=Buffer.alloc(e);return n[t+3]=e>>24&255,n[t+2]=e>>16&255,n[t+1]=e>>8&255,n[t]=255&e,t+=4,n[t+3]=this.requestId>>24&255,n[t+2]=this.requestId>>16&255,n[t+1]=this.requestId>>8&255,n[t]=255&this.requestId,t+=4,n[t+3]=0,n[t+2]=0,n[t+1]=0,n[t]=0,t+=4,n[t+3]=u.OP_GETMORE>>24&255,n[t+2]=u.OP_GETMORE>>16&255,n[t+1]=u.OP_GETMORE>>8&255,n[t]=255&u.OP_GETMORE,t+=4,n[t+3]=0,n[t+2]=0,n[t+1]=0,n[t]=0,t+=4,t=t+n.write(this.ns,t,"utf8")+1,n[t-1]=0,n[t+3]=this.numberToReturn>>24&255,n[t+2]=this.numberToReturn>>16&255,n[t+1]=this.numberToReturn>>8&255,n[t]=255&this.numberToReturn,t+=4,n[t+3]=this.cursorId.getLowBits()>>24&255,n[t+2]=this.cursorId.getLowBits()>>16&255,n[t+1]=this.cursorId.getLowBits()>>8&255,n[t]=255&this.cursorId.getLowBits(),t+=4,n[t+3]=this.cursorId.getHighBits()>>24&255,n[t+2]=this.cursorId.getHighBits()>>16&255,n[t+1]=this.cursorId.getHighBits()>>8&255,n[t]=255&this.cursorId.getHighBits(),t+=4,[n]}};t.KillCursor=class{constructor(e,t){this.ns=e,this.requestId=a++,this.cursorIds=t}toBin(){const e=24+8*this.cursorIds.length;let t=0;const n=Buffer.alloc(e);n[t+3]=e>>24&255,n[t+2]=e>>16&255,n[t+1]=e>>8&255,n[t]=255&e,t+=4,n[t+3]=this.requestId>>24&255,n[t+2]=this.requestId>>16&255,n[t+1]=this.requestId>>8&255,n[t]=255&this.requestId,t+=4,n[t+3]=0,n[t+2]=0,n[t+1]=0,n[t]=0,t+=4,n[t+3]=u.OP_KILL_CURSORS>>24&255,n[t+2]=u.OP_KILL_CURSORS>>16&255,n[t+1]=u.OP_KILL_CURSORS>>8&255,n[t]=255&u.OP_KILL_CURSORS,t+=4,n[t+3]=0,n[t+2]=0,n[t+1]=0,n[t]=0,t+=4,n[t+3]=this.cursorIds.length>>24&255,n[t+2]=this.cursorIds.length>>16&255,n[t+1]=this.cursorIds.length>>8&255,n[t]=255&this.cursorIds.length,t+=4;for(let e=0;e<this.cursorIds.length;e++)n[t+3]=this.cursorIds[e].getLowBits()>>24&255,n[t+2]=this.cursorIds[e].getLowBits()>>16&255,n[t+1]=this.cursorIds[e].getLowBits()>>8&255,n[t]=255&this.cursorIds[e].getLowBits(),t+=4,n[t+3]=this.cursorIds[e].getHighBits()>>24&255,n[t+2]=this.cursorIds[e].getHighBits()>>16&255,n[t+1]=this.cursorIds[e].getHighBits()>>8&255,n[t]=255&this.cursorIds[e].getHighBits(),t+=4;return[n]}};t.Response=class{constructor(e,t,n,r){this.documents=new Array(0),this.parsed=!1,this.raw=e,this.data=n,this.opts=null!=r?r:{promoteLongs:!0,promoteValues:!0,promoteBuffers:!1,bsonRegExp:!1},this.length=t.length,this.requestId=t.requestId,this.responseTo=t.responseTo,this.opCode=t.opCode,this.fromCompressed=t.fromCompressed,this.promoteLongs="boolean"!=typeof this.opts.promoteLongs||this.opts.promoteLongs,this.promoteValues="boolean"!=typeof this.opts.promoteValues||this.opts.promoteValues,this.promoteBuffers="boolean"==typeof this.opts.promoteBuffers&&this.opts.promoteBuffers,this.bsonRegExp="boolean"==typeof this.opts.bsonRegExp&&this.opts.bsonRegExp}isParsed(){return this.parsed}parse(e){var t,n,o,i;if(this.parsed)return;const s=(e=null!=e?e:{}).raw||!1,u=e.documentsReturnedIn||null;let a;const c={promoteLongs:null!==(t=e.promoteLongs)&&void 0!==t?t:this.opts.promoteLongs,promoteValues:null!==(n=e.promoteValues)&&void 0!==n?n:this.opts.promoteValues,promoteBuffers:null!==(o=e.promoteBuffers)&&void 0!==o?o:this.opts.promoteBuffers,bsonRegExp:null!==(i=e.bsonRegExp)&&void 0!==i?i:this.opts.bsonRegExp};this.index=20,this.responseFlags=this.data.readInt32LE(0),this.cursorId=new r.Long(this.data.readInt32LE(4),this.data.readInt32LE(8)),this.startingFrom=this.data.readInt32LE(12),this.numberReturned=this.data.readInt32LE(16),this.documents=new Array(this.numberReturned),this.cursorNotFound=0!=(1&this.responseFlags),this.queryFailure=0!=(2&this.responseFlags),this.shardConfigStale=0!=(4&this.responseFlags),this.awaitCapable=0!=(8&this.responseFlags);for(let e=0;e<this.numberReturned;e++)a=this.data[this.index]|this.data[this.index+1]<<8|this.data[this.index+2]<<16|this.data[this.index+3]<<24,this.documents[e]=s?this.data.slice(this.index,this.index+a):r.deserialize(this.data.slice(this.index,this.index+a),c),this.index=this.index+a;if(1===this.documents.length&&null!=u&&s){const e={};e[u]=!0,c.fieldsAsRaw=e;const t=r.deserialize(this.documents[0],c);this.documents=[t]}this.parsed=!0}};class l{constructor(e,t,n){if(null==t)throw new o.MongoInvalidArgumentError("Query document must be specified for query");this.ns=e,this.command=t,this.command.$db=(0,s.databaseNamespace)(e),n.readPreference&&n.readPreference.mode!==i.ReadPreference.PRIMARY&&(this.command.$readPreference=n.readPreference.toJSON()),this.options=null!=n?n:{},this.requestId=n.requestId?n.requestId:l.getRequestId(),this.serializeFunctions="boolean"==typeof n.serializeFunctions&&n.serializeFunctions,this.ignoreUndefined="boolean"==typeof n.ignoreUndefined&&n.ignoreUndefined,this.checkKeys="boolean"==typeof n.checkKeys&&n.checkKeys,this.maxBsonSize=n.maxBsonSize||16777216,this.checksumPresent=!1,this.moreToCome=n.moreToCome||!1,this.exhaustAllowed="boolean"==typeof n.exhaustAllowed&&n.exhaustAllowed}toBin(){const e=[];let t=0;this.checksumPresent&&(t|=1),this.moreToCome&&(t|=2),this.exhaustAllowed&&(t|=65536);const n=Buffer.alloc(20);e.push(n);let r=n.length;const o=this.command;return r+=this.makeDocumentSegment(e,o),n.writeInt32LE(r,0),n.writeInt32LE(this.requestId,4),n.writeInt32LE(0,8),n.writeInt32LE(u.OP_MSG,12),n.writeUInt32LE(t,16),e}makeDocumentSegment(e,t){const n=Buffer.alloc(1);n[0]=0;const r=this.serializeBson(t);return e.push(n),e.push(r),n.length+r.length}serializeBson(e){return r.serialize(e,{checkKeys:this.checkKeys,serializeFunctions:this.serializeFunctions,ignoreUndefined:this.ignoreUndefined})}static getRequestId(){return a=a+1&2147483647,a}}t.Msg=l;t.BinMsg=class{constructor(e,t,n,r){this.parsed=!1,this.raw=e,this.data=n,this.opts=null!=r?r:{promoteLongs:!0,promoteValues:!0,promoteBuffers:!1,bsonRegExp:!1},this.length=t.length,this.requestId=t.requestId,this.responseTo=t.responseTo,this.opCode=t.opCode,this.fromCompressed=t.fromCompressed,this.responseFlags=n.readInt32LE(0),this.checksumPresent=0!=(1&this.responseFlags),this.moreToCome=0!=(2&this.responseFlags),this.exhaustAllowed=0!=(65536&this.responseFlags),this.promoteLongs="boolean"!=typeof this.opts.promoteLongs||this.opts.promoteLongs,this.promoteValues="boolean"!=typeof this.opts.promoteValues||this.opts.promoteValues,this.promoteBuffers="boolean"==typeof this.opts.promoteBuffers&&this.opts.promoteBuffers,this.bsonRegExp="boolean"==typeof this.opts.bsonRegExp&&this.opts.bsonRegExp,this.documents=[]}isParsed(){return this.parsed}parse(e){var t,n,i,s;if(this.parsed)return;e=null!=e?e:{},this.index=4;const u=e.raw||!1,a=e.documentsReturnedIn||null,c={promoteLongs:null!==(t=e.promoteLongs)&&void 0!==t?t:this.opts.promoteLongs,promoteValues:null!==(n=e.promoteValues)&&void 0!==n?n:this.opts.promoteValues,promoteBuffers:null!==(i=e.promoteBuffers)&&void 0!==i?i:this.opts.promoteBuffers,bsonRegExp:null!==(s=e.bsonRegExp)&&void 0!==s?s:this.opts.bsonRegExp,validation:this.parseBsonSerializationOptions(e)};for(;this.index<this.data.length;){const e=this.data.readUInt8(this.index++);if(0===e){const e=this.data.readUInt32LE(this.index),t=this.data.slice(this.index,this.index+e);this.documents.push(u?t:r.deserialize(t,c)),this.index+=e}else if(1===e)throw new o.MongoRuntimeError("OP_MSG Payload Type 1 detected unsupported protocol")}if(1===this.documents.length&&null!=a&&u){const e={};e[a]=!0,c.fieldsAsRaw=e;const t=r.deserialize(this.documents[0],c);this.documents=[t]}this.parsed=!0}parseBsonSerializationOptions({enableUtf8Validation:e}){return!1===e?{utf8:!1}:{utf8:{writeErrors:!1}}}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.formatSort=void 0;const r=n(1);function o(e=1){const t=`${e}`.toLowerCase();if("object"==typeof(n=e)&&null!=n&&"$meta"in n&&"string"==typeof n.$meta)return e;var n;switch(t){case"ascending":case"asc":case"1":return 1;case"descending":case"desc":case"-1":return-1;default:throw new r.MongoInvalidArgumentError(`Invalid sort direction: ${JSON.stringify(e)}`)}}t.formatSort=function(e,t){if(null!=e){if("string"==typeof e)return new Map([[e,o(t)]]);if("object"!=typeof e)throw new r.MongoInvalidArgumentError(`Invalid sort format: ${JSON.stringify(e)} Sort must be a valid object`);if(!Array.isArray(e))return(n=e)instanceof Map&&n.size>0?function(e){const t=Array.from(e).map(([e,t])=>[`${e}`,o(t)]);return new Map(t)}(e):Object.keys(e).length?function(e){const t=Object.entries(e).map(([e,t])=>[`${e}`,o(t)]);return new Map(t)}(e):void 0;var n,i;if(e.length)return function(e){return Array.isArray(e)&&Array.isArray(e[0])}(e)?function(e){const t=e.map(([e,t])=>[`${e}`,o(t)]);return new Map(t)}(e):function(e){if(Array.isArray(e)&&2===e.length)try{return o(e[1]),!0}catch(e){return!1}return!1}(e)?(i=e,new Map([[`${i[0]}`,o([i[1]])]])):function(e){const t=e.map(e=>[`${e}`,1]);return new Map(t)}(e)}}},function(e,t,n){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.transformRowUsingColumnMap=t.prepareTableForImport=void 0;const o=r(n(68)),i=r(n(263)),s=r(n(132));t.prepareTableForImport=function(e){const t=(0,o.default)(e);return t.foreignKeys=[],t.indexes=[],t.uniques=[],t.checks=[],t.primaryKey&&(t.primaryKey.constraintName=null),t},t.transformRowUsingColumnMap=function(e,t){return(0,i.default)(t.map(t=>[t.dst,(0,s.default)(e,t.src)]))}},function(e,t,n){var r=n(69),o=n(232),i=n(72),s=n(233),u=n(240),a=n(243),c=n(244),l=n(245),d=n(247),f=n(127),p=n(129),h=n(53),m=n(251),g=n(252),E=n(257),y=n(7),v=n(75),A=n(259),b=n(19),C=n(261),S=n(37),O=n(78),_={};_["[object Arguments]"]=_["[object Array]"]=_["[object ArrayBuffer]"]=_["[object DataView]"]=_["[object Boolean]"]=_["[object Date]"]=_["[object Float32Array]"]=_["[object Float64Array]"]=_["[object Int8Array]"]=_["[object Int16Array]"]=_["[object Int32Array]"]=_["[object Map]"]=_["[object Number]"]=_["[object Object]"]=_["[object RegExp]"]=_["[object Set]"]=_["[object String]"]=_["[object Symbol]"]=_["[object Uint8Array]"]=_["[object Uint8ClampedArray]"]=_["[object Uint16Array]"]=_["[object Uint32Array]"]=!0,_["[object Error]"]=_["[object Function]"]=_["[object WeakMap]"]=!1,e.exports=function e(t,n,w,D,B,T){var F,N=1&n,R=2&n,I=4&n;if(w&&(F=B?w(t,D,B,T):w(t)),void 0!==F)return F;if(!b(t))return t;var x=y(t);if(x){if(F=m(t),!N)return c(t,F)}else{var M=h(t),P="[object Function]"==M||"[object GeneratorFunction]"==M;if(v(t))return a(t,N);if("[object Object]"==M||"[object Arguments]"==M||P&&!B){if(F=R||P?{}:E(t),!N)return R?d(t,u(F,t)):l(t,s(F,t))}else{if(!_[M])return B?t:{};F=g(t,M,N)}}T||(T=new r);var k=T.get(t);if(k)return k;T.set(t,F),C(t)?t.forEach((function(r){F.add(e(r,n,w,r,t,T))})):A(t)&&t.forEach((function(r,o){F.set(o,e(r,n,w,o,t,T))}));var j=x?void 0:(I?R?p:f:R?O:S)(t);return o(j||t,(function(r,o){j&&(r=t[o=r]),i(F,o,e(r,n,w,o,t,T))})),F}},function(e,t,n){var r=n(17),o=n(19);e.exports=function(e){if(!o(e))return!1;var t=r(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t}},function(e,t){var n="object"==typeof global&&global&&global.Object===Object&&global;e.exports=n},function(e,t){var n=Function.prototype.toString;e.exports=function(e){if(null!=e){try{return n.call(e)}catch(e){}try{return e+""}catch(e){}}return""}},function(e,t,n){var r=n(20),o=function(){try{var e=r(Object,"defineProperty");return e({},"",{}),e}catch(e){}}();e.exports=o},function(e,t,n){var r=n(234),o=n(74),i=n(7),s=n(75),u=n(51),a=n(123),c=Object.prototype.hasOwnProperty;e.exports=function(e,t){var n=i(e),l=!n&&o(e),d=!n&&!l&&s(e),f=!n&&!l&&!d&&a(e),p=n||l||d||f,h=p?r(e.length,String):[],m=h.length;for(var g in e)!t&&!c.call(e,g)||p&&("length"==g||d&&("offset"==g||"parent"==g)||f&&("buffer"==g||"byteLength"==g||"byteOffset"==g)||u(g,m))||h.push(g);return h}},function(e,t,n){var r=n(237),o=n(27),i=n(52),s=i&&i.isTypedArray,u=s?o(s):r;e.exports=u},function(e,t){e.exports=function(e,t){return function(n){return e(t(n))}}},function(e,t){e.exports=function(){return[]}},function(e,t,n){var r=n(80),o=n(81),i=n(79),s=n(125),u=Object.getOwnPropertySymbols?function(e){for(var t=[];e;)r(t,i(e)),e=o(e);return t}:s;e.exports=u},function(e,t,n){var r=n(128),o=n(79),i=n(37);e.exports=function(e){return r(e,i,o)}},function(e,t,n){var r=n(80),o=n(7);e.exports=function(e,t,n){var i=t(e);return o(e)?i:r(i,n(e))}},function(e,t,n){var r=n(128),o=n(126),i=n(78);e.exports=function(e){return r(e,i,o)}},function(e,t,n){var r=n(20)(n(15),"Set");e.exports=r},function(e,t,n){var r=n(15).Uint8Array;e.exports=r},function(e,t,n){var r=n(38);e.exports=function(e,t,n){var o=null==e?void 0:r(e,t);return void 0===o?n:o}},function(e,t,n){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.findEngineDriver=t.extractShellApiFunctionName=t.extractPackageName=t.extractShellApiPlugins=void 0;const o=r(n(268)),i=r(n(40)),s=r(n(55));t.extractShellApiPlugins=function(e,t){const n=[],r=e.match(/^([^@]+)@([^@]+)/);if(r&&n.push(r[2]),t&&t.connection&&t.connection.engine){const e=t.connection.engine.match(/^([^@]+)@([^@]+)/);e&&n.push(e[2])}return n},t.extractPackageName=function(e){if(!e)return null;const t=e.match(/^([^@]+)@([^@]+)/);return t?t[2]:null},t.extractShellApiFunctionName=function(e){const t=e.match(/^([^@]+)@([^@]+)/);return t?`${(0,o.default)(t[2])}.shellApi.${t[1]}`:`dbgateApi.${e}`},t.findEngineDriver=function(e,t){if((0,i.default)(e))return t.drivers.find(t=>t.engine==e);if((0,s.default)(e)){const{engine:n}=e;if(n)return t.drivers.find(e=>e.engine==n)}return null}},function(e,t){e.exports=function(e,t,n){var r=-1,o=e.length;t<0&&(t=-t>o?0:o+t),(n=n>o?o:n)<0&&(n+=o),o=t>n?0:n-t>>>0,t>>>=0;for(var i=Array(o);++r<o;)i[r]=e[r+t];return i}},function(e,t){var n=RegExp("[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\ufe0e\\ufe0f]");e.exports=function(e){return n.test(e)}},function(e,t,n){var r=n(290);e.exports=function(e,t){return!!(null==e?0:e.length)&&r(e,t,0)>-1}},function(e,t){e.exports=function(e,t,n){for(var r=-1,o=null==e?0:e.length;++r<o;)if(n(t,e[r]))return!0;return!1}},function(e,t,n){var r=n(56),o=n(139),i=n(140);e.exports=function(e,t){return i(o(e,t,r),e+"")}},function(e,t,n){var r=n(294),o=Math.max;e.exports=function(e,t,n){return t=o(void 0===t?e.length-1:t,0),function(){for(var i=arguments,s=-1,u=o(i.length-t,0),a=Array(u);++s<u;)a[s]=i[t+s];s=-1;for(var c=Array(t+1);++s<t;)c[s]=i[s];return c[t]=n(a),r(e,this,c)}}},function(e,t,n){var r=n(295),o=n(297)(r);e.exports=o},function(e,t,n){var r=n(80),o=n(301);e.exports=function e(t,n,i,s,u){var a=-1,c=t.length;for(i||(i=o),u||(u=[]);++a<c;){var l=t[a];n>0&&i(l)?n>1?e(l,n-1,i,s,u):r(u,l):s||(u[u.length]=l)}return u}},function(e,t,n){var r=n(84),o=n(306),i=n(85);e.exports=function(e,t,n,s,u,a){var c=1&n,l=e.length,d=t.length;if(l!=d&&!(c&&d>l))return!1;var f=a.get(e),p=a.get(t);if(f&&p)return f==t&&p==e;var h=-1,m=!0,g=2&n?new r:void 0;for(a.set(e,t),a.set(t,e);++h<l;){var E=e[h],y=t[h];if(s)var v=c?s(y,E,h,t,e,a):s(E,y,h,e,t,a);if(void 0!==v){if(v)continue;m=!1;break}if(g){if(!o(t,(function(e,t){if(!i(g,t)&&(E===e||u(E,e,n,s,a)))return g.push(t)}))){m=!1;break}}else if(E!==y&&!u(E,y,n,s,a)){m=!1;break}}return a.delete(e),a.delete(t),m}},function(e,t,n){var r=n(19);e.exports=function(e){return e==e&&!r(e)}},function(e,t){e.exports=function(e,t){return function(n){return null!=n&&(n[e]===t&&(void 0!==t||e in Object(n)))}}},function(e,t,n){var r=n(312),o=n(313);e.exports=function(e,t){return null!=e&&o(e,t,r)}},function(e,t,n){var r=n(318),o=n(321)(r);e.exports=o},function(e,t,n){var r=n(330),o=n(148)((function(e,t){return null==e?{}:r(e,t)}));e.exports=o},function(e,t,n){var r=n(57),o=n(139),i=n(140);e.exports=function(e){return i(o(e,void 0,r),e+"")}},function(e,t,n){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.SqlDumper=void 0;const o=r(n(16)),i=r(n(40)),s=r(n(90)),u=r(n(334)),a=r(n(7)),c=r(n(55)),l=r(n(91));t.SqlDumper=class{constructor(e){this.s="",this.indentLevel=0,this.driver=e,this.dialect=e.dialect}endCommand(){this.putRaw(";\n")}putRaw(e){this.s+=e}escapeString(e){const t=this.dialect.stringEscapeChar;let n="";for(let r=0;r<e.length;r++){const o=e[r];o!=t&&"'"!=o||(n+=t),n+=o}return n}putStringValue(e){this.putRaw("'"),this.putRaw(this.escapeString(e)),this.putRaw("'")}putByteArrayValue(e){this.putRaw("NULL")}putValue(e){null===e?this.putRaw("NULL"):!0===e?this.putRaw("1"):!1===e?this.putRaw("0"):(0,i.default)(e)?this.putStringValue(e):(0,s.default)(e)?this.putRaw(e.toString()):(0,u.default)(e)?this.putStringValue(new Date(e).toISOString()):"Buffer"==(null==e?void 0:e.type)&&(0,a.default)(null==e?void 0:e.data)?this.putByteArrayValue(null==e?void 0:e.data):(0,c.default)(e)||(0,a.default)(e)?this.putStringValue(JSON.stringify(e)):this.putRaw("NULL")}putCmd(e,...t){this.put(e,...t),this.endCommand()}putFormattedValue(e,t){switch(e){case"s":null!=t&&this.putRaw(t.toString());break;case"i":this.putRaw(this.dialect.quoteIdentifier(t));break;case"k":t&&this.putRaw(t.toUpperCase());break;case"f":{const{schemaName:e,pureName:n}=t;e&&(this.putRaw(this.dialect.quoteIdentifier(e)),this.putRaw(".")),this.putRaw(this.dialect.quoteIdentifier(n))}break;case"v":this.putValue(t);break;case"c":t(this)}}putFormattedList(e,t){t&&this.putCollection(", ",t,t=>this.putFormattedValue(e,t))}put(e,...t){let n=0,r=0;const o=e.length;for(;n<o;){let i=e[n];switch(n++,i){case"^":for(;n<o&&e[n].match(/[a-z0-9_]/i);)this.putRaw(e[n].toUpperCase()),n++;break;case"%":switch(i=e[n],n++,i){case"%":this.putRaw("%");break;case",":i=e[n],n++,this.putFormattedList(i,t[r]);break;default:this.putFormattedValue(i,t[r])}r++;break;case"&":switch(i=e[n],n++,i){case"&":this.putRaw("&");break;case">":this.indentLevel++;break;case"<":this.indentLevel--;break;case"n":this.putRaw("\n"),this.putRaw(" ".repeat(2*this.indentLevel))}break;default:this.putRaw(i)}}}autoIncrement(){this.put(" ^auto_increment")}specialColumnOptions(e){}columnDefinition(e,{includeDefault:t=!0,includeNullable:n=!0,includeCollate:r=!0}={}){var o;if(e.computedExpression)return this.put("^as %s",e.computedExpression),void(e.isPersisted&&this.put(" ^persisted"));this.put("%k",e.dataType||this.dialect.fallbackDataType),e.autoIncrement&&this.autoIncrement(),this.putRaw(" "),this.specialColumnOptions(e),n&&this.put(e.notNull?"^not ^null":"^null"),t&&(null===(o=e.defaultValue)||void 0===o?void 0:o.trim())&&this.columnDefault(e)}columnDefault(e){null!=e.defaultConstraint?this.put(" ^constraint %i ^default %s ",e.defaultConstraint,e.defaultValue):this.put(" ^default %s ",e.defaultValue)}putCollection(e,t,n){if(!t)return;let r=!0;for(const o of t)r||this.put(e),r=!1,n(o)}createTable(e){this.put("^create ^table %f ( &>&n",e),this.putCollection(",&n",e.columns,e=>{this.put("%i ",e.columnName),this.columnDefinition(e)}),e.primaryKey&&(this.put(",&n"),e.primaryKey.constraintName&&this.put("^constraint %i",e.primaryKey.constraintName),this.put(" ^primary ^key (%,i)",e.primaryKey.columns.map(e=>e.columnName))),(e.foreignKeys||[]).forEach(e=>{this.put(",&n"),this.createForeignKeyFore(e)}),(e.uniques||[]).forEach(e=>{this.put(",&n"),this.createUniqueCore(e)}),(e.checks||[]).forEach(e=>{this.put(",&n"),this.createCheckCore(e)}),this.put("&<&n)"),this.endCommand(),(e.indexes||[]).forEach(e=>{this.createIndex(e)})}createForeignKeyFore(e){null!=e.constraintName&&this.put("^constraint %i ",e.constraintName),this.put("^foreign ^key (%,i) ^references %f (%,i)",e.columns.map(e=>e.columnName),{schemaName:e.refSchemaName,pureName:e.refTableName},e.columns.map(e=>e.refColumnName)),e.deleteAction&&this.put(" ^on ^delete %k",e.deleteAction),e.updateAction&&this.put(" ^on ^update %k",e.updateAction)}transform(e,t){t()}allowIdentityInsert(e,t){}enableConstraints(e,t){}comment(e){if(e)for(const t of e.split("\n"))this.put(" -- %s",t.trimRight())}createView(e){this.putRaw(e.createSql),this.endCommand()}dropView(e,{testIfExists:t=!1}){this.putCmd("^drop ^view %f",e)}alterView(e){this.putRaw(e.createSql.replace(/create\s+view/i,"ALTER VIEW")),this.endCommand()}changeViewSchema(e,t){}renameView(e,t){}createMatview(e){this.putRaw(e.createSql),this.endCommand()}dropMatview(e,{testIfExists:t=!1}){this.putCmd("^drop ^materialized ^view %f",e)}alterMatview(e){this.putRaw(e.createSql.replace(/create\s+view/i,"ALTER VIEW")),this.endCommand()}changeMatviewSchema(e,t){}renameMatview(e,t){}createProcedure(e){this.putRaw(e.createSql),this.endCommand()}dropProcedure(e,{testIfExists:t=!1}){this.putCmd("^drop ^procedure %f",e)}alterProcedure(e){this.putRaw(e.createSql.replace(/create\s+procedure/i,"ALTER PROCEDURE")),this.endCommand()}changeProcedureSchema(e,t){}renameProcedure(e,t){}createFunction(e){this.putRaw(e.createSql),this.endCommand()}dropFunction(e,{testIfExists:t=!1}){this.putCmd("^drop ^function %f",e)}alterFunction(e){this.putRaw(e.createSql.replace(/create\s+function/i,"ALTER FUNCTION")),this.endCommand()}changeFunctionSchema(e,t){}renameFunction(e,t){}createTrigger(e){this.putRaw(e.createSql),this.endCommand()}dropTrigger(e,{testIfExists:t=!1}){this.putCmd("^drop ^trigger %f",e)}alterTrigger(e){this.putRaw(e.createSql.replace(/create\s+trigger/i,"ALTER TRIGGER")),this.endCommand()}changeTriggerSchema(e,t){}renameTrigger(e,t){}dropConstraintCore(e){this.putCmd("^alter ^table %f ^drop ^constraint %i",e,e.constraintName)}dropConstraint(e){switch(e.constraintType){case"primaryKey":this.dropPrimaryKey(e);break;case"foreignKey":this.dropForeignKey(e);break;case"unique":this.dropUnique(e);break;case"check":this.dropCheck(e);break;case"index":this.dropIndex(e)}}createConstraint(e){switch(e.constraintType){case"primaryKey":this.createPrimaryKey(e);break;case"foreignKey":this.createForeignKey(e);break;case"unique":this.createUnique(e);break;case"check":this.createCheck(e);break;case"index":this.createIndex(e)}}changeConstraint(e,t){}dropForeignKey(e){this.dialect.explicitDropConstraint?this.putCmd("^alter ^table %f ^drop ^foreign ^key %i",e,e.constraintName):this.dropConstraintCore(e)}createForeignKey(e){this.put("^alter ^table %f ^add ",e),this.createForeignKeyFore(e),this.endCommand()}dropPrimaryKey(e){this.dialect.explicitDropConstraint?this.putCmd("^alter ^table %f ^drop ^primary ^key",e):this.dropConstraintCore(e)}createPrimaryKey(e){this.putCmd("^alter ^table %f ^add ^constraint %i ^primary ^key (%,i)",e,e.constraintName,e.columns.map(e=>e.columnName))}dropIndex(e){this.put("^drop ^index %i",e.constraintName),this.dialect.dropIndexContainsTableSpec&&this.put(" ^on %f",e),this.endCommand()}createIndex(e){this.put("^create"),e.isUnique&&this.put(" ^unique"),this.put(" ^index %i &n^on %f (&>&n",e.constraintName,e),this.putCollection(",&n",e.columns,e=>{this.put("%i %k",e.columnName,1==e.isDescending?"DESC":"ASC")}),this.put("&<&n)"),this.endCommand()}dropUnique(e){this.dropConstraintCore(e)}createUniqueCore(e){this.put("^constraint %i ^unique (%,i)",e.constraintName,e.columns.map(e=>e.columnName))}createUnique(e){this.put("^alter ^table %f ^add ",e),this.createUniqueCore(e),this.endCommand()}dropCheck(e){this.dropConstraintCore(e)}createCheckCore(e){this.put("^constraint %i ^check (%s)",e.constraintName,e.definition)}createCheck(e){this.put("^alter ^table %f ^add ",e),this.createCheckCore(e),this.endCommand()}renameConstraint(e,t){}createColumn(e,t){this.put("^alter ^table %f ^add %i ",e,e.columnName),this.columnDefinition(e),this.inlineConstraints(t),this.endCommand()}inlineConstraints(e){if(null!=e)for(const t of e)"primaryKey"==t.constraintType&&(null==t.constraintName||this.dialect.anonymousPrimaryKey||this.put(" ^constraint %i",t.constraintName),this.put(" ^primary ^key "))}dropColumn(e){this.putCmd("^alter ^table %f ^drop ^column %i",e,e.columnName)}renameColumn(e,t){}changeColumn(e,t,n){}dropTable(e,{testIfExists:t=!1}={}){this.putCmd("^drop ^table %f",e)}changeTableSchema(e,t){}renameTable(e,t){}beginTransaction(){this.putCmd("^begin ^transaction")}commitTransaction(){this.putCmd("^commit")}alterProlog(){}alterEpilog(){}selectTableIntoNewTable(e,t){this.putCmd("^select * ^into %f ^from %f",t,e)}truncateTable(e){this.putCmd("^delete ^from %f",e)}dropConstraints(e,t=!1){t&&this.dialect.dropForeignKey&&e.dependencies.forEach(e=>this.dropConstraint(e)),this.dialect.dropIndex&&e.indexes.forEach(e=>this.dropIndex(e)),this.dialect.dropForeignKey&&e.foreignKeys.forEach(e=>this.dropForeignKey(e)),this.dialect.dropPrimaryKey&&e.primaryKey&&this.dropPrimaryKey(e.primaryKey)}recreateTable(e,t){if(!e.pairingId||!t.pairingId||e.pairingId!=t.pairingId)throw new Error("Recreate is not possible: oldTable.paringId != newTable.paringId");const n=`temp_${(0,l.default)()}`,r=e.columns.map(e=>({oldcol:e,newcol:t.columns.find(t=>t.pairingId==e.pairingId)})).filter(e=>e.newcol);this.dropConstraints(e,!0),this.renameTable(e,n),this.createTable(t);const o=t.columns.find(e=>e.autoIncrement);o&&this.allowIdentityInsert(t,!0),this.putCmd("^insert ^into %f (%,i) select %,s ^from %f",t,r.map(e=>e.newcol.columnName),r.map(e=>e.oldcol.columnName),Object.assign(Object.assign({},e),{pureName:n})),o&&this.allowIdentityInsert(t,!1),this.dialect.dropForeignKey&&t.dependencies.forEach(e=>this.createConstraint(e)),this.dropTable(Object.assign(Object.assign({},e),{pureName:n}))}createSqlObject(e){this.putCmd(e.createSql)}getSqlObjectSqlName(e){switch(e){case"procedures":return"PROCEDURE";case"views":return"VIEW";case"functions":return"FUNCTION";case"triggers":return"TRIGGER";case"matviews":return"MATERIALIZED VIEW"}}dropSqlObject(e){this.putCmd("^drop %s %f",this.getSqlObjectSqlName(e.objectTypeField),e)}fillPreloadedRows(e,t,n,r,i){let s=!1;for(const u of n){const n=null==t?void 0:t.find(e=>r.every(t=>e[t]==u[t])),a=o.default.keys(u);if(n){const t=[];for(const e of a)u[e]==n[e]||(null==i?void 0:i.includes(e))||t.push(e);t.length>0&&(s&&this.put(";\n"),s=!0,this.put("^update %f ^set ",e),this.putCollection(", ",t,e=>this.put("%i=%v",e,u[e])),this.put(" ^where "),this.putCollection(" ^and ",r,e=>this.put("%i=%v",e,u[e])))}else s&&this.put(";\n"),s=!0,this.put("^insert ^into %f (%,i) ^values (%,v)",e,a,a.map(e=>u[e]))}s&&this.endCommand()}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.dumpSqlExpression=void 0;const r=n(92);t.dumpSqlExpression=function e(t,n){switch(n.exprType){case"column":n.source&&(0,r.dumpSqlSourceRef)(t,n.source)&&t.put("."),t.put("%i",n.columnName);break;case"placeholder":t.putRaw("{PLACEHOLDER}");break;case"value":t.put("%v",n.value);break;case"raw":t.put("%s",n.sql);break;case"call":t.put("%s(",n.func),n.argsPrefix&&t.put("%s ",n.argsPrefix),t.putCollection(",",n.args,n=>e(t,n)),t.put(")");break;case"methodCall":e(t,n.thisObject),t.put(".%s(",n.method),t.putCollection(",",n.args,n=>e(t,n)),t.put(")");break;case"transform":t.transform(n.transform,()=>e(t,n.expr));break;case"rowNumber":t.put(" ^row_number() ^over (^order ^by "),t.putCollection(", ",n.orderBy,n=>{e(t,n),t.put(" %k",n.direction)}),t.put(")")}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.evaluateExpression=void 0,t.evaluateExpression=function(e,t){switch(e.exprType){case"column":return t[e.columnName];case"placeholder":return t.__placeholder;case"value":return e.value;case"raw":return e.sql;case"call":case"methodCall":case"transform":return null}}},function(e,t,n){var r=n(84),o=n(136),i=n(137),s=n(85),u=n(348),a=n(89);e.exports=function(e,t,n){var c=-1,l=o,d=e.length,f=!0,p=[],h=p;if(n)f=!1,l=i;else if(d>=200){var m=t?null:u(e);if(m)return a(m);f=!1,l=s,h=new r}else h=t?[]:p;e:for(;++c<d;){var g=e[c],E=t?t(g):g;if(g=n||0!==g?g:0,f&&E==E){for(var y=h.length;y--;)if(h[y]===E)continue e;t&&h.push(E),p.push(g)}else l(h,E,n)||(h!==p&&h.push(E),p.push(g))}return p}},function(e,t,n){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.isTableColumnUnique=t.extendDatabaseInfoFromApps=t.extendDatabaseInfo=t.extendTableInfo=t.addTableDependencies=void 0;const o=r(n(57));function i(e){const t=(0,o.default)(e.tables.map(e=>e.foreignKeys||[]));return Object.assign(Object.assign({},e),{tables:e.tables.map(e=>Object.assign(Object.assign({},e),{dependencies:t.filter(t=>t.refSchemaName==e.schemaName&&t.refTableName==e.pureName)}))})}function s(e){return Object.assign(Object.assign({},e),{objectTypeField:"tables",columns:(e.columns||[]).map(t=>Object.assign({pureName:e.pureName,schemaName:e.schemaName},t)),primaryKey:e.primaryKey?Object.assign(Object.assign({},e.primaryKey),{pureName:e.pureName,schemaName:e.schemaName,constraintType:"primaryKey"}):void 0,foreignKeys:(e.foreignKeys||[]).map(t=>Object.assign(Object.assign({},t),{pureName:e.pureName,schemaName:e.schemaName,constraintType:"foreignKey"})),indexes:(e.indexes||[]).map(t=>Object.assign(Object.assign({},t),{pureName:e.pureName,schemaName:e.schemaName,constraintType:"index"})),checks:(e.checks||[]).map(t=>Object.assign(Object.assign({},t),{pureName:e.pureName,schemaName:e.schemaName,constraintType:"check"})),uniques:(e.uniques||[]).map(t=>Object.assign(Object.assign({},t),{pureName:e.pureName,schemaName:e.schemaName,constraintType:"unique"}))})}t.addTableDependencies=i,t.extendTableInfo=s,t.extendDatabaseInfo=function(e){return function(e){return Object.assign(Object.assign({},e),{tables:(e.tables||[]).map(s),collections:(e.collections||[]).map(e=>Object.assign(Object.assign({},e),{objectTypeField:"collections"})),views:(e.views||[]).map(e=>Object.assign(Object.assign({},e),{objectTypeField:"views"})),matviews:(e.matviews||[]).map(e=>Object.assign(Object.assign({},e),{objectTypeField:"matviews"})),procedures:(e.procedures||[]).map(e=>Object.assign(Object.assign({},e),{objectTypeField:"procedures"})),functions:(e.functions||[]).map(e=>Object.assign(Object.assign({},e),{objectTypeField:"functions"})),triggers:(e.triggers||[]).map(e=>Object.assign(Object.assign({},e),{objectTypeField:"triggers"}))})}(i(e))},t.extendDatabaseInfoFromApps=function(e,t){return e&&t?i(Object.assign(Object.assign({},e),{tables:e.tables.map(e=>Object.assign(Object.assign({},e),{foreignKeys:[...e.foreignKeys||[],...(0,o.default)(t.map(e=>e.virtualReferences||[])).filter(t=>t.pureName==e.pureName&&t.schemaName==e.schemaName).map(e=>Object.assign(Object.assign({},e),{constraintType:"foreignKey",isVirtual:!0}))]}))})):e},t.isTableColumnUnique=function(e,t){return!(!e.primaryKey||1!=e.primaryKey.columns.length||e.primaryKey.columns[0].columnName!=t)||!![...e.uniques||[],...(e.indexes||[]).filter(e=>e.isUnique)].find(e=>1==e.columns.length&&e.columns[0].columnName==t)}},function(e,t,n){var r=n(39),o=n(117),i=n(359),s=n(29),u=n(36),a=n(362),c=n(148),l=n(129),d=c((function(e,t){var n={};if(null==e)return n;var c=!1;t=r(t,(function(t){return t=s(t,e),c||(c=t.length>1),t})),u(e,l(e),n),c&&(n=o(n,7,a));for(var d=t.length;d--;)i(n,t[d]);return n}));e.exports=d},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Admin=void 0;const r=n(156),o=n(14),i=n(372),s=n(160),u=n(60),a=n(373);t.Admin=class{constructor(e){this.s={db:e}}command(e,t,n){return"function"==typeof t&&(n=t,t={}),t=Object.assign({dbName:"admin"},t),(0,o.executeOperation)(this.s.db.s.client,new u.RunCommandOperation(this.s.db,e,t),n)}buildInfo(e,t){return"function"==typeof e&&(t=e,e={}),e=null!=e?e:{},this.command({buildinfo:1},e,t)}serverInfo(e,t){return"function"==typeof e&&(t=e,e={}),e=null!=e?e:{},this.command({buildinfo:1},e,t)}serverStatus(e,t){return"function"==typeof e&&(t=e,e={}),e=null!=e?e:{},this.command({serverStatus:1},e,t)}ping(e,t){return"function"==typeof e&&(t=e,e={}),e=null!=e?e:{},this.command({ping:1},e,t)}addUser(e,t,n,i){return"function"==typeof t?(i=t,t=void 0,n={}):"string"!=typeof t?"function"==typeof n?(i=n,n=t,t=void 0):(n=t,i=void 0,t=void 0):"function"==typeof n&&(i=n,n={}),n=Object.assign({dbName:"admin"},n),(0,o.executeOperation)(this.s.db.s.client,new r.AddUserOperation(this.s.db,e,t,n),i)}removeUser(e,t,n){return"function"==typeof t&&(n=t,t={}),t=Object.assign({dbName:"admin"},t),(0,o.executeOperation)(this.s.db.s.client,new s.RemoveUserOperation(this.s.db,e,t),n)}validateCollection(e,t,n){return"function"==typeof t&&(n=t,t={}),t=null!=t?t:{},(0,o.executeOperation)(this.s.db.s.client,new a.ValidateCollectionOperation(this,e,t),n)}listDatabases(e,t){return"function"==typeof e&&(t=e,e={}),e=null!=e?e:{},(0,o.executeOperation)(this.s.db.s.client,new i.ListDatabasesOperation(this.s.db,e),t)}replSetGetStatus(e,t){return"function"==typeof e&&(t=e,e={}),e=null!=e?e:{},this.command({replSetGetStatus:1},e,t)}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AddUserOperation=void 0;const r=n(18),o=n(1),i=n(2),s=n(5),u=n(3);class a extends s.CommandOperation{constructor(e,t,n,r){super(e,r),this.db=e,this.username=t,this.password=n,this.options=null!=r?r:{}}execute(e,t,n){const s=this.db,u=this.username,a=this.password,c=this.options;if(null!=c.digestPassword)return n(new o.MongoInvalidArgumentError('Option "digestPassword" not supported via addUser, use db.command(...) instead'));let l,d;!c.roles||Array.isArray(c.roles)&&0===c.roles.length?((0,i.emitWarningOnce)('Creating a user without roles is deprecated. Defaults to "root" if db is "admin" or "dbOwner" otherwise'),l="admin"===s.databaseName.toLowerCase()?["root"]:["dbOwner"]):l=Array.isArray(c.roles)?c.roles:[c.roles];try{d=(0,i.getTopology)(s)}catch(e){return n(e)}const f=d.lastHello().maxWireVersion>=7;let p=a;if(!f){const e=r.createHash("md5");e.update(`${u}:mongo:${a}`),p=e.digest("hex")}const h={createUser:u,customData:c.customData||{},roles:l,digestPassword:f};"string"==typeof a&&(h.pwd=p),super.executeCommand(e,t,h,n)}}t.AddUserOperation=a,(0,u.defineAspects)(a,[u.Aspect.WRITE_OPERATION])},function(e,t){e.exports=require("os")},function(e,t,n){"use strict";n.r(t),n.d(t,"BSONError",(function(){return u})),n.d(t,"BSONRegExp",(function(){return ne})),n.d(t,"BSONSymbol",(function(){return re})),n.d(t,"BSONTypeError",(function(){return a})),n.d(t,"BSON_BINARY_SUBTYPE_BYTE_ARRAY",(function(){return ze})),n.d(t,"BSON_BINARY_SUBTYPE_COLUMN",(function(){return Ke})),n.d(t,"BSON_BINARY_SUBTYPE_DEFAULT",(function(){return $e})),n.d(t,"BSON_BINARY_SUBTYPE_ENCRYPTED",(function(){return Ge})),n.d(t,"BSON_BINARY_SUBTYPE_FUNCTION",(function(){return Ve})),n.d(t,"BSON_BINARY_SUBTYPE_MD5",(function(){return He})),n.d(t,"BSON_BINARY_SUBTYPE_USER_DEFINED",(function(){return Ye})),n.d(t,"BSON_BINARY_SUBTYPE_UUID",(function(){return qe})),n.d(t,"BSON_BINARY_SUBTYPE_UUID_NEW",(function(){return We})),n.d(t,"BSON_DATA_ARRAY",(function(){return Se})),n.d(t,"BSON_DATA_BINARY",(function(){return Oe})),n.d(t,"BSON_DATA_BOOLEAN",(function(){return De})),n.d(t,"BSON_DATA_CODE",(function(){return Re})),n.d(t,"BSON_DATA_CODE_W_SCOPE",(function(){return xe})),n.d(t,"BSON_DATA_DATE",(function(){return Be})),n.d(t,"BSON_DATA_DBPOINTER",(function(){return Ne})),n.d(t,"BSON_DATA_DECIMAL128",(function(){return je})),n.d(t,"BSON_DATA_INT",(function(){return Me})),n.d(t,"BSON_DATA_LONG",(function(){return ke})),n.d(t,"BSON_DATA_MAX_KEY",(function(){return Ue})),n.d(t,"BSON_DATA_MIN_KEY",(function(){return Le})),n.d(t,"BSON_DATA_NULL",(function(){return Te})),n.d(t,"BSON_DATA_NUMBER",(function(){return Ae})),n.d(t,"BSON_DATA_OBJECT",(function(){return Ce})),n.d(t,"BSON_DATA_OID",(function(){return we})),n.d(t,"BSON_DATA_REGEXP",(function(){return Fe})),n.d(t,"BSON_DATA_STRING",(function(){return be})),n.d(t,"BSON_DATA_SYMBOL",(function(){return Ie})),n.d(t,"BSON_DATA_TIMESTAMP",(function(){return Pe})),n.d(t,"BSON_DATA_UNDEFINED",(function(){return _e})),n.d(t,"BSON_INT32_MAX",(function(){return he})),n.d(t,"BSON_INT32_MIN",(function(){return me})),n.d(t,"BSON_INT64_MAX",(function(){return ge})),n.d(t,"BSON_INT64_MIN",(function(){return Ee})),n.d(t,"Binary",(function(){return T})),n.d(t,"Code",(function(){return F})),n.d(t,"DBRef",(function(){return R})),n.d(t,"Decimal128",(function(){return G})),n.d(t,"Double",(function(){return K})),n.d(t,"EJSON",(function(){return le})),n.d(t,"Int32",(function(){return Y})),n.d(t,"Long",(function(){return P})),n.d(t,"LongWithoutOverridesClass",(function(){return oe})),n.d(t,"Map",(function(){return de})),n.d(t,"MaxKey",(function(){return J})),n.d(t,"MinKey",(function(){return Z})),n.d(t,"ObjectID",(function(){return te})),n.d(t,"ObjectId",(function(){return te})),n.d(t,"Timestamp",(function(){return ie})),n.d(t,"UUID",(function(){return B})),n.d(t,"calculateObjectSize",(function(){return Mt})),n.d(t,"deserialize",(function(){return xt})),n.d(t,"deserializeStream",(function(){return Pt})),n.d(t,"serialize",(function(){return Rt})),n.d(t,"serializeWithBufferAndIndex",(function(){return It})),n.d(t,"setInternalBufferSize",(function(){return Nt}));var r=n(0),o=function(e,t){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)};function i(e,t){function n(){this.constructor=e}o(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var s=function(){return(s=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)},u=function(e){function t(n){var r=e.call(this,n)||this;return Object.setPrototypeOf(r,t.prototype),r}return i(t,e),Object.defineProperty(t.prototype,"name",{get:function(){return"BSONError"},enumerable:!1,configurable:!0}),t}(Error),a=function(e){function t(n){var r=e.call(this,n)||this;return Object.setPrototypeOf(r,t.prototype),r}return i(t,e),Object.defineProperty(t.prototype,"name",{get:function(){return"BSONTypeError"},enumerable:!1,configurable:!0}),t}(TypeError);function c(e){return e&&e.Math==Math&&e}function l(){return c("object"==typeof globalThis&&globalThis)||c("object"==typeof window&&window)||c("object"==typeof self&&self)||c("object"==typeof global&&global)||Function("return this")()}function d(e){return e.toString().replace("function(","function (")}var f=function(e){var t,n="object"==typeof(t=l()).navigator&&"ReactNative"===t.navigator.product?"BSON: For React Native please polyfill crypto.getRandomValues, e.g. using: https://www.npmjs.com/package/react-native-get-random-values.":"BSON: No cryptographic implementation for random bytes present, falling back to a less secure implementation.";console.warn(n);for(var o=r.Buffer.alloc(e),i=0;i<e;++i)o[i]=Math.floor(256*Math.random());return o},p=function(){if("undefined"!=typeof window){var e=window.crypto||window.msCrypto;if(e&&e.getRandomValues)return function(t){return e.getRandomValues(r.Buffer.alloc(t))}}if("undefined"!=typeof global&&global.crypto&&global.crypto.getRandomValues)return function(e){return global.crypto.getRandomValues(r.Buffer.alloc(e))};var t;try{t=n(18).randomBytes}catch(e){}return t||f}();function h(e){return["[object ArrayBuffer]","[object SharedArrayBuffer]"].includes(Object.prototype.toString.call(e))}function m(e){return"[object Uint8Array]"===Object.prototype.toString.call(e)}function g(e){return"[object BigInt64Array]"===Object.prototype.toString.call(e)}function E(e){return"[object BigUint64Array]"===Object.prototype.toString.call(e)}function y(e){return"[object RegExp]"===Object.prototype.toString.call(e)}function v(e){return A(e)&&"[object Date]"===Object.prototype.toString.call(e)}function A(e){return"object"==typeof e&&null!==e}function b(e,t){var n=!1;return function(){for(var r=[],o=0;o<arguments.length;o++)r[o]=arguments[o];return n||(console.warn(t),n=!0),e.apply(this,r)}}function C(e){if(ArrayBuffer.isView(e))return r.Buffer.from(e.buffer,e.byteOffset,e.byteLength);if(h(e))return r.Buffer.from(e);throw new a("Must use either Buffer or TypedArray")}var S=/^(?:[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,O=function(e){return"string"==typeof e&&S.test(e)},_=function(e){if(!O(e))throw new a('UUID string representations must be a 32 or 36 character hex string (dashes excluded/included). Format: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" or "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx".');var t=e.replace(/-/g,"");return r.Buffer.from(t,"hex")},w=function(e,t){return void 0===t&&(t=!0),t?e.toString("hex",0,4)+"-"+e.toString("hex",4,6)+"-"+e.toString("hex",6,8)+"-"+e.toString("hex",8,10)+"-"+e.toString("hex",10,16):e.toString("hex")},D=Symbol("id"),B=function(){function e(t){if(void 0===t)this.id=e.generate();else if(t instanceof e)this[D]=r.Buffer.from(t.id),this.__id=t.__id;else if(ArrayBuffer.isView(t)&&16===t.byteLength)this.id=C(t);else{if("string"!=typeof t)throw new a("Argument passed in UUID constructor must be a UUID, a 16 byte Buffer or a 32/36 character hex string (dashes excluded/included, format: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx).");this.id=_(t)}}return Object.defineProperty(e.prototype,"id",{get:function(){return this[D]},set:function(t){this[D]=t,e.cacheHexString&&(this.__id=w(t))},enumerable:!1,configurable:!0}),e.prototype.toHexString=function(t){if(void 0===t&&(t=!0),e.cacheHexString&&this.__id)return this.__id;var n=w(this.id,t);return e.cacheHexString&&(this.__id=n),n},e.prototype.toString=function(e){return e?this.id.toString(e):this.toHexString()},e.prototype.toJSON=function(){return this.toHexString()},e.prototype.equals=function(t){if(!t)return!1;if(t instanceof e)return t.id.equals(this.id);try{return new e(t).id.equals(this.id)}catch(e){return!1}},e.prototype.toBinary=function(){return new T(this.id,T.SUBTYPE_UUID)},e.generate=function(){var e=p(16);return e[6]=15&e[6]|64,e[8]=63&e[8]|128,r.Buffer.from(e)},e.isValid=function(t){if(!t)return!1;if(t instanceof e)return!0;if("string"==typeof t)return O(t);if(m(t)){if(16!==t.length)return!1;try{return parseInt(t[6].toString(16)[0],10)===T.SUBTYPE_UUID}catch(e){return!1}}return!1},e.createFromHexString=function(t){return new e(_(t))},e.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},e.prototype.inspect=function(){return'new UUID("'+this.toHexString()+'")'},e}();Object.defineProperty(B.prototype,"_bsontype",{value:"UUID"});var T=function(){function e(t,n){if(!(this instanceof e))return new e(t,n);if(!(null==t||"string"==typeof t||ArrayBuffer.isView(t)||t instanceof ArrayBuffer||Array.isArray(t)))throw new a("Binary can only be constructed from string, Buffer, TypedArray, or Array<number>");this.sub_type=null!=n?n:e.BSON_BINARY_SUBTYPE_DEFAULT,null==t?(this.buffer=r.Buffer.alloc(e.BUFFER_SIZE),this.position=0):("string"==typeof t?this.buffer=r.Buffer.from(t,"binary"):Array.isArray(t)?this.buffer=r.Buffer.from(t):this.buffer=C(t),this.position=this.buffer.byteLength)}return e.prototype.put=function(t){if("string"==typeof t&&1!==t.length)throw new a("only accepts single character String");if("number"!=typeof t&&1!==t.length)throw new a("only accepts single character Uint8Array or Array");var n;if((n="string"==typeof t?t.charCodeAt(0):"number"==typeof t?t:t[0])<0||n>255)throw new a("only accepts number in a valid unsigned byte range 0-255");if(this.buffer.length>this.position)this.buffer[this.position++]=n;else{var o=r.Buffer.alloc(e.BUFFER_SIZE+this.buffer.length);this.buffer.copy(o,0,0,this.buffer.length),this.buffer=o,this.buffer[this.position++]=n}},e.prototype.write=function(e,t){if(t="number"==typeof t?t:this.position,this.buffer.length<t+e.length){var n=r.Buffer.alloc(this.buffer.length+e.length);this.buffer.copy(n,0,0,this.buffer.length),this.buffer=n}ArrayBuffer.isView(e)?(this.buffer.set(C(e),t),this.position=t+e.byteLength>this.position?t+e.length:this.position):"string"==typeof e&&(this.buffer.write(e,t,e.length,"binary"),this.position=t+e.length>this.position?t+e.length:this.position)},e.prototype.read=function(e,t){return t=t&&t>0?t:this.position,this.buffer.slice(e,e+t)},e.prototype.value=function(e){return(e=!!e)&&this.buffer.length===this.position?this.buffer:e?this.buffer.slice(0,this.position):this.buffer.toString("binary",0,this.position)},e.prototype.length=function(){return this.position},e.prototype.toJSON=function(){return this.buffer.toString("base64")},e.prototype.toString=function(e){return this.buffer.toString(e)},e.prototype.toExtendedJSON=function(e){e=e||{};var t=this.buffer.toString("base64"),n=Number(this.sub_type).toString(16);return e.legacy?{$binary:t,$type:1===n.length?"0"+n:n}:{$binary:{base64:t,subType:1===n.length?"0"+n:n}}},e.prototype.toUUID=function(){if(this.sub_type===e.SUBTYPE_UUID)return new B(this.buffer.slice(0,this.position));throw new u('Binary sub_type "'+this.sub_type+'" is not supported for converting to UUID. Only "'+e.SUBTYPE_UUID+'" is currently supported.')},e.fromExtendedJSON=function(t,n){var o,i;if(n=n||{},"$binary"in t?n.legacy&&"string"==typeof t.$binary&&"$type"in t?(i=t.$type?parseInt(t.$type,16):0,o=r.Buffer.from(t.$binary,"base64")):"string"!=typeof t.$binary&&(i=t.$binary.subType?parseInt(t.$binary.subType,16):0,o=r.Buffer.from(t.$binary.base64,"base64")):"$uuid"in t&&(i=4,o=_(t.$uuid)),!o)throw new a("Unexpected Binary Extended JSON format "+JSON.stringify(t));return new e(o,i)},e.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},e.prototype.inspect=function(){return'new Binary(Buffer.from("'+this.value(!0).toString("hex")+'", "hex"), '+this.sub_type+")"},e.BSON_BINARY_SUBTYPE_DEFAULT=0,e.BUFFER_SIZE=256,e.SUBTYPE_DEFAULT=0,e.SUBTYPE_FUNCTION=1,e.SUBTYPE_BYTE_ARRAY=2,e.SUBTYPE_UUID_OLD=3,e.SUBTYPE_UUID=4,e.SUBTYPE_MD5=5,e.SUBTYPE_ENCRYPTED=6,e.SUBTYPE_COLUMN=7,e.SUBTYPE_USER_DEFINED=128,e}();Object.defineProperty(T.prototype,"_bsontype",{value:"Binary"});var F=function(){function e(t,n){if(!(this instanceof e))return new e(t,n);this.code=t,this.scope=n}return e.prototype.toJSON=function(){return{code:this.code,scope:this.scope}},e.prototype.toExtendedJSON=function(){return this.scope?{$code:this.code,$scope:this.scope}:{$code:this.code}},e.fromExtendedJSON=function(t){return new e(t.$code,t.$scope)},e.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},e.prototype.inspect=function(){var e=this.toJSON();return'new Code("'+e.code+'"'+(e.scope?", "+JSON.stringify(e.scope):"")+")"},e}();function N(e){return A(e)&&null!=e.$id&&"string"==typeof e.$ref&&(null==e.$db||"string"==typeof e.$db)}Object.defineProperty(F.prototype,"_bsontype",{value:"Code"});var R=function(){function e(t,n,r,o){if(!(this instanceof e))return new e(t,n,r,o);var i=t.split(".");2===i.length&&(r=i.shift(),t=i.shift()),this.collection=t,this.oid=n,this.db=r,this.fields=o||{}}return Object.defineProperty(e.prototype,"namespace",{get:function(){return this.collection},set:function(e){this.collection=e},enumerable:!1,configurable:!0}),e.prototype.toJSON=function(){var e=Object.assign({$ref:this.collection,$id:this.oid},this.fields);return null!=this.db&&(e.$db=this.db),e},e.prototype.toExtendedJSON=function(e){e=e||{};var t={$ref:this.collection,$id:this.oid};return e.legacy?t:(this.db&&(t.$db=this.db),t=Object.assign(t,this.fields))},e.fromExtendedJSON=function(t){var n=Object.assign({},t);return delete n.$ref,delete n.$id,delete n.$db,new e(t.$ref,t.$id,t.$db,n)},e.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},e.prototype.inspect=function(){var e=void 0===this.oid||void 0===this.oid.toString?this.oid:this.oid.toString();return'new DBRef("'+this.namespace+'", new ObjectId("'+e+'")'+(this.db?', "'+this.db+'"':"")+")"},e}();Object.defineProperty(R.prototype,"_bsontype",{value:"DBRef"});var I=void 0;try{I=new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array([0,97,115,109,1,0,0,0,1,13,2,96,0,1,127,96,4,127,127,127,127,1,127,3,7,6,0,1,1,1,1,1,6,6,1,127,1,65,0,11,7,50,6,3,109,117,108,0,1,5,100,105,118,95,115,0,2,5,100,105,118,95,117,0,3,5,114,101,109,95,115,0,4,5,114,101,109,95,117,0,5,8,103,101,116,95,104,105,103,104,0,0,10,191,1,6,4,0,35,0,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,126,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,127,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,128,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,129,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,130,34,4,66,32,135,167,36,0,32,4,167,11])),{}).exports}catch(e){}var x={},M={},P=function(){function e(t,n,r){if(void 0===t&&(t=0),!(this instanceof e))return new e(t,n,r);"bigint"==typeof t?Object.assign(this,e.fromBigInt(t,!!n)):"string"==typeof t?Object.assign(this,e.fromString(t,!!n)):(this.low=0|t,this.high=0|n,this.unsigned=!!r),Object.defineProperty(this,"__isLong__",{value:!0,configurable:!1,writable:!1,enumerable:!1})}return e.fromBits=function(t,n,r){return new e(t,n,r)},e.fromInt=function(t,n){var r,o,i;return n?(i=0<=(t>>>=0)&&t<256)&&(o=M[t])?o:(r=e.fromBits(t,(0|t)<0?-1:0,!0),i&&(M[t]=r),r):(i=-128<=(t|=0)&&t<128)&&(o=x[t])?o:(r=e.fromBits(t,t<0?-1:0,!1),i&&(x[t]=r),r)},e.fromNumber=function(t,n){if(isNaN(t))return n?e.UZERO:e.ZERO;if(n){if(t<0)return e.UZERO;if(t>=0x10000000000000000)return e.MAX_UNSIGNED_VALUE}else{if(t<=-0x8000000000000000)return e.MIN_VALUE;if(t+1>=0x8000000000000000)return e.MAX_VALUE}return t<0?e.fromNumber(-t,n).neg():e.fromBits(t%4294967296|0,t/4294967296|0,n)},e.fromBigInt=function(t,n){return e.fromString(t.toString(),n)},e.fromString=function(t,n,r){if(0===t.length)throw Error("empty string");if("NaN"===t||"Infinity"===t||"+Infinity"===t||"-Infinity"===t)return e.ZERO;if("number"==typeof n?(r=n,n=!1):n=!!n,(r=r||10)<2||36<r)throw RangeError("radix");var o;if((o=t.indexOf("-"))>0)throw Error("interior hyphen");if(0===o)return e.fromString(t.substring(1),n,r).neg();for(var i=e.fromNumber(Math.pow(r,8)),s=e.ZERO,u=0;u<t.length;u+=8){var a=Math.min(8,t.length-u),c=parseInt(t.substring(u,u+a),r);if(a<8){var l=e.fromNumber(Math.pow(r,a));s=s.mul(l).add(e.fromNumber(c))}else s=(s=s.mul(i)).add(e.fromNumber(c))}return s.unsigned=n,s},e.fromBytes=function(t,n,r){return r?e.fromBytesLE(t,n):e.fromBytesBE(t,n)},e.fromBytesLE=function(t,n){return new e(t[0]|t[1]<<8|t[2]<<16|t[3]<<24,t[4]|t[5]<<8|t[6]<<16|t[7]<<24,n)},e.fromBytesBE=function(t,n){return new e(t[4]<<24|t[5]<<16|t[6]<<8|t[7],t[0]<<24|t[1]<<16|t[2]<<8|t[3],n)},e.isLong=function(e){return A(e)&&!0===e.__isLong__},e.fromValue=function(t,n){return"number"==typeof t?e.fromNumber(t,n):"string"==typeof t?e.fromString(t,n):e.fromBits(t.low,t.high,"boolean"==typeof n?n:t.unsigned)},e.prototype.add=function(t){e.isLong(t)||(t=e.fromValue(t));var n=this.high>>>16,r=65535&this.high,o=this.low>>>16,i=65535&this.low,s=t.high>>>16,u=65535&t.high,a=t.low>>>16,c=0,l=0,d=0,f=0;return d+=(f+=i+(65535&t.low))>>>16,f&=65535,l+=(d+=o+a)>>>16,d&=65535,c+=(l+=r+u)>>>16,l&=65535,c+=n+s,c&=65535,e.fromBits(d<<16|f,c<<16|l,this.unsigned)},e.prototype.and=function(t){return e.isLong(t)||(t=e.fromValue(t)),e.fromBits(this.low&t.low,this.high&t.high,this.unsigned)},e.prototype.compare=function(t){if(e.isLong(t)||(t=e.fromValue(t)),this.eq(t))return 0;var n=this.isNegative(),r=t.isNegative();return n&&!r?-1:!n&&r?1:this.unsigned?t.high>>>0>this.high>>>0||t.high===this.high&&t.low>>>0>this.low>>>0?-1:1:this.sub(t).isNegative()?-1:1},e.prototype.comp=function(e){return this.compare(e)},e.prototype.divide=function(t){if(e.isLong(t)||(t=e.fromValue(t)),t.isZero())throw Error("division by zero");if(I){if(!this.unsigned&&-2147483648===this.high&&-1===t.low&&-1===t.high)return this;var n=(this.unsigned?I.div_u:I.div_s)(this.low,this.high,t.low,t.high);return e.fromBits(n,I.get_high(),this.unsigned)}if(this.isZero())return this.unsigned?e.UZERO:e.ZERO;var r,o,i;if(this.unsigned){if(t.unsigned||(t=t.toUnsigned()),t.gt(this))return e.UZERO;if(t.gt(this.shru(1)))return e.UONE;i=e.UZERO}else{if(this.eq(e.MIN_VALUE))return t.eq(e.ONE)||t.eq(e.NEG_ONE)?e.MIN_VALUE:t.eq(e.MIN_VALUE)?e.ONE:(r=this.shr(1).div(t).shl(1)).eq(e.ZERO)?t.isNegative()?e.ONE:e.NEG_ONE:(o=this.sub(t.mul(r)),i=r.add(o.div(t)));if(t.eq(e.MIN_VALUE))return this.unsigned?e.UZERO:e.ZERO;if(this.isNegative())return t.isNegative()?this.neg().div(t.neg()):this.neg().div(t).neg();if(t.isNegative())return this.div(t.neg()).neg();i=e.ZERO}for(o=this;o.gte(t);){r=Math.max(1,Math.floor(o.toNumber()/t.toNumber()));for(var s=Math.ceil(Math.log(r)/Math.LN2),u=s<=48?1:Math.pow(2,s-48),a=e.fromNumber(r),c=a.mul(t);c.isNegative()||c.gt(o);)r-=u,c=(a=e.fromNumber(r,this.unsigned)).mul(t);a.isZero()&&(a=e.ONE),i=i.add(a),o=o.sub(c)}return i},e.prototype.div=function(e){return this.divide(e)},e.prototype.equals=function(t){return e.isLong(t)||(t=e.fromValue(t)),(this.unsigned===t.unsigned||this.high>>>31!=1||t.high>>>31!=1)&&(this.high===t.high&&this.low===t.low)},e.prototype.eq=function(e){return this.equals(e)},e.prototype.getHighBits=function(){return this.high},e.prototype.getHighBitsUnsigned=function(){return this.high>>>0},e.prototype.getLowBits=function(){return this.low},e.prototype.getLowBitsUnsigned=function(){return this.low>>>0},e.prototype.getNumBitsAbs=function(){if(this.isNegative())return this.eq(e.MIN_VALUE)?64:this.neg().getNumBitsAbs();var t,n=0!==this.high?this.high:this.low;for(t=31;t>0&&0==(n&1<<t);t--);return 0!==this.high?t+33:t+1},e.prototype.greaterThan=function(e){return this.comp(e)>0},e.prototype.gt=function(e){return this.greaterThan(e)},e.prototype.greaterThanOrEqual=function(e){return this.comp(e)>=0},e.prototype.gte=function(e){return this.greaterThanOrEqual(e)},e.prototype.ge=function(e){return this.greaterThanOrEqual(e)},e.prototype.isEven=function(){return 0==(1&this.low)},e.prototype.isNegative=function(){return!this.unsigned&&this.high<0},e.prototype.isOdd=function(){return 1==(1&this.low)},e.prototype.isPositive=function(){return this.unsigned||this.high>=0},e.prototype.isZero=function(){return 0===this.high&&0===this.low},e.prototype.lessThan=function(e){return this.comp(e)<0},e.prototype.lt=function(e){return this.lessThan(e)},e.prototype.lessThanOrEqual=function(e){return this.comp(e)<=0},e.prototype.lte=function(e){return this.lessThanOrEqual(e)},e.prototype.modulo=function(t){if(e.isLong(t)||(t=e.fromValue(t)),I){var n=(this.unsigned?I.rem_u:I.rem_s)(this.low,this.high,t.low,t.high);return e.fromBits(n,I.get_high(),this.unsigned)}return this.sub(this.div(t).mul(t))},e.prototype.mod=function(e){return this.modulo(e)},e.prototype.rem=function(e){return this.modulo(e)},e.prototype.multiply=function(t){if(this.isZero())return e.ZERO;if(e.isLong(t)||(t=e.fromValue(t)),I){var n=I.mul(this.low,this.high,t.low,t.high);return e.fromBits(n,I.get_high(),this.unsigned)}if(t.isZero())return e.ZERO;if(this.eq(e.MIN_VALUE))return t.isOdd()?e.MIN_VALUE:e.ZERO;if(t.eq(e.MIN_VALUE))return this.isOdd()?e.MIN_VALUE:e.ZERO;if(this.isNegative())return t.isNegative()?this.neg().mul(t.neg()):this.neg().mul(t).neg();if(t.isNegative())return this.mul(t.neg()).neg();if(this.lt(e.TWO_PWR_24)&&t.lt(e.TWO_PWR_24))return e.fromNumber(this.toNumber()*t.toNumber(),this.unsigned);var r=this.high>>>16,o=65535&this.high,i=this.low>>>16,s=65535&this.low,u=t.high>>>16,a=65535&t.high,c=t.low>>>16,l=65535&t.low,d=0,f=0,p=0,h=0;return p+=(h+=s*l)>>>16,h&=65535,f+=(p+=i*l)>>>16,p&=65535,f+=(p+=s*c)>>>16,p&=65535,d+=(f+=o*l)>>>16,f&=65535,d+=(f+=i*c)>>>16,f&=65535,d+=(f+=s*a)>>>16,f&=65535,d+=r*l+o*c+i*a+s*u,d&=65535,e.fromBits(p<<16|h,d<<16|f,this.unsigned)},e.prototype.mul=function(e){return this.multiply(e)},e.prototype.negate=function(){return!this.unsigned&&this.eq(e.MIN_VALUE)?e.MIN_VALUE:this.not().add(e.ONE)},e.prototype.neg=function(){return this.negate()},e.prototype.not=function(){return e.fromBits(~this.low,~this.high,this.unsigned)},e.prototype.notEquals=function(e){return!this.equals(e)},e.prototype.neq=function(e){return this.notEquals(e)},e.prototype.ne=function(e){return this.notEquals(e)},e.prototype.or=function(t){return e.isLong(t)||(t=e.fromValue(t)),e.fromBits(this.low|t.low,this.high|t.high,this.unsigned)},e.prototype.shiftLeft=function(t){return e.isLong(t)&&(t=t.toInt()),0==(t&=63)?this:t<32?e.fromBits(this.low<<t,this.high<<t|this.low>>>32-t,this.unsigned):e.fromBits(0,this.low<<t-32,this.unsigned)},e.prototype.shl=function(e){return this.shiftLeft(e)},e.prototype.shiftRight=function(t){return e.isLong(t)&&(t=t.toInt()),0==(t&=63)?this:t<32?e.fromBits(this.low>>>t|this.high<<32-t,this.high>>t,this.unsigned):e.fromBits(this.high>>t-32,this.high>=0?0:-1,this.unsigned)},e.prototype.shr=function(e){return this.shiftRight(e)},e.prototype.shiftRightUnsigned=function(t){if(e.isLong(t)&&(t=t.toInt()),0===(t&=63))return this;var n=this.high;if(t<32){var r=this.low;return e.fromBits(r>>>t|n<<32-t,n>>>t,this.unsigned)}return 32===t?e.fromBits(n,0,this.unsigned):e.fromBits(n>>>t-32,0,this.unsigned)},e.prototype.shr_u=function(e){return this.shiftRightUnsigned(e)},e.prototype.shru=function(e){return this.shiftRightUnsigned(e)},e.prototype.subtract=function(t){return e.isLong(t)||(t=e.fromValue(t)),this.add(t.neg())},e.prototype.sub=function(e){return this.subtract(e)},e.prototype.toInt=function(){return this.unsigned?this.low>>>0:this.low},e.prototype.toNumber=function(){return this.unsigned?4294967296*(this.high>>>0)+(this.low>>>0):4294967296*this.high+(this.low>>>0)},e.prototype.toBigInt=function(){return BigInt(this.toString())},e.prototype.toBytes=function(e){return e?this.toBytesLE():this.toBytesBE()},e.prototype.toBytesLE=function(){var e=this.high,t=this.low;return[255&t,t>>>8&255,t>>>16&255,t>>>24,255&e,e>>>8&255,e>>>16&255,e>>>24]},e.prototype.toBytesBE=function(){var e=this.high,t=this.low;return[e>>>24,e>>>16&255,e>>>8&255,255&e,t>>>24,t>>>16&255,t>>>8&255,255&t]},e.prototype.toSigned=function(){return this.unsigned?e.fromBits(this.low,this.high,!1):this},e.prototype.toString=function(t){if((t=t||10)<2||36<t)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative()){if(this.eq(e.MIN_VALUE)){var n=e.fromNumber(t),r=this.div(n),o=r.mul(n).sub(this);return r.toString(t)+o.toInt().toString(t)}return"-"+this.neg().toString(t)}for(var i=e.fromNumber(Math.pow(t,6),this.unsigned),s=this,u="";;){var a=s.div(i),c=(s.sub(a.mul(i)).toInt()>>>0).toString(t);if((s=a).isZero())return c+u;for(;c.length<6;)c="0"+c;u=""+c+u}},e.prototype.toUnsigned=function(){return this.unsigned?this:e.fromBits(this.low,this.high,!0)},e.prototype.xor=function(t){return e.isLong(t)||(t=e.fromValue(t)),e.fromBits(this.low^t.low,this.high^t.high,this.unsigned)},e.prototype.eqz=function(){return this.isZero()},e.prototype.le=function(e){return this.lessThanOrEqual(e)},e.prototype.toExtendedJSON=function(e){return e&&e.relaxed?this.toNumber():{$numberLong:this.toString()}},e.fromExtendedJSON=function(t,n){var r=e.fromString(t.$numberLong);return n&&n.relaxed?r.toNumber():r},e.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},e.prototype.inspect=function(){return'new Long("'+this.toString()+'"'+(this.unsigned?", true":"")+")"},e.TWO_PWR_24=e.fromInt(1<<24),e.MAX_UNSIGNED_VALUE=e.fromBits(-1,-1,!0),e.ZERO=e.fromInt(0),e.UZERO=e.fromInt(0,!0),e.ONE=e.fromInt(1),e.UONE=e.fromInt(1,!0),e.NEG_ONE=e.fromInt(-1),e.MAX_VALUE=e.fromBits(-1,2147483647,!1),e.MIN_VALUE=e.fromBits(0,-2147483648,!1),e}();Object.defineProperty(P.prototype,"__isLong__",{value:!0}),Object.defineProperty(P.prototype,"_bsontype",{value:"Long"});var k=/^(\+|-)?(\d+|(\d*\.\d*))?(E|e)?([-+])?(\d+)?$/,j=/^(\+|-)?(Infinity|inf)$/i,L=/^(\+|-)?NaN$/i,U=[124,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0].reverse(),$=[248,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0].reverse(),V=[120,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0].reverse(),z=/^([-+])?(\d+)?$/;function q(e){return!isNaN(parseInt(e,10))}function W(e){var t=P.fromNumber(1e9),n=P.fromNumber(0);if(!(e.parts[0]||e.parts[1]||e.parts[2]||e.parts[3]))return{quotient:e,rem:n};for(var r=0;r<=3;r++)n=(n=n.shiftLeft(32)).add(new P(e.parts[r],0)),e.parts[r]=n.div(t).low,n=n.modulo(t);return{quotient:e,rem:n}}function H(e,t){throw new a('"'+e+'" is not a valid Decimal128 string - '+t)}var G=function(){function e(t){if(!(this instanceof e))return new e(t);if("string"==typeof t)this.bytes=e.fromString(t).bytes;else{if(!m(t))throw new a("Decimal128 must take a Buffer or string");if(16!==t.byteLength)throw new a("Decimal128 must take a Buffer of 16 bytes");this.bytes=t}}return e.fromString=function(t){var n,o=!1,i=!1,s=!1,u=0,c=0,l=0,d=0,f=0,p=[0],h=0,m=0,g=0,E=0,y=0,v=0,A=new P(0,0),b=new P(0,0),C=0;if(t.length>=7e3)throw new a(t+" not a valid Decimal128 string");var S=t.match(k),O=t.match(j),_=t.match(L);if(!S&&!O&&!_||0===t.length)throw new a(t+" not a valid Decimal128 string");if(S){var w=S[2],D=S[4],B=S[5],T=S[6];D&&void 0===T&&H(t,"missing exponent power"),D&&void 0===w&&H(t,"missing exponent base"),void 0===D&&(B||T)&&H(t,"missing e before exponent")}if("+"!==t[C]&&"-"!==t[C]||(o="-"===t[C++]),!q(t[C])&&"."!==t[C]){if("i"===t[C]||"I"===t[C])return new e(r.Buffer.from(o?$:V));if("N"===t[C])return new e(r.Buffer.from(U))}for(;q(t[C])||"."===t[C];)"."!==t[C]?(h<34&&("0"!==t[C]||s)&&(s||(f=c),s=!0,p[m++]=parseInt(t[C],10),h+=1),s&&(l+=1),i&&(d+=1),c+=1,C+=1):(i&&H(t,"contains multiple periods"),i=!0,C+=1);if(i&&!c)throw new a(t+" not a valid Decimal128 string");if("e"===t[C]||"E"===t[C]){var F=t.substr(++C).match(z);if(!F||!F[2])return new e(r.Buffer.from(U));y=parseInt(F[0],10),C+=F[0].length}if(t[C])return new e(r.Buffer.from(U));if(g=0,h){if(E=h-1,1!==(u=l))for(;0===p[f+u-1];)u-=1}else g=0,E=0,p[0]=0,l=1,h=1,u=0;for(y<=d&&d-y>16384?y=-6176:y-=d;y>6111;){if((E+=1)-g>34){if(p.join("").match(/^0+$/)){y=6111;break}H(t,"overflow")}y-=1}for(;y<-6176||h<l;){if(0===E&&u<h){y=-6176,u=0;break}if(h<l?l-=1:E-=1,y<6111)y+=1;else{if(p.join("").match(/^0+$/)){y=6111;break}H(t,"overflow")}}if(E-g+1<u){var N=c;i&&(f+=1,N+=1),o&&(f+=1,N+=1);var R=parseInt(t[f+E+1],10),I=0;if(R>=5&&(I=1,5===R))for(I=p[E]%2==1?1:0,v=f+E+2;v<N;v++)if(parseInt(t[v],10)){I=1;break}if(I)for(var x=E;x>=0;x--)if(++p[x]>9&&(p[x]=0,0===x)){if(!(y<6111))return new e(r.Buffer.from(o?$:V));y+=1,p[x]=1}}if(A=P.fromNumber(0),b=P.fromNumber(0),0===u)A=P.fromNumber(0),b=P.fromNumber(0);else if(E-g<17){x=g;for(b=P.fromNumber(p[x++]),A=new P(0,0);x<=E;x++)b=(b=b.multiply(P.fromNumber(10))).add(P.fromNumber(p[x]))}else{x=g;for(A=P.fromNumber(p[x++]);x<=E-17;x++)A=(A=A.multiply(P.fromNumber(10))).add(P.fromNumber(p[x]));for(b=P.fromNumber(p[x++]);x<=E;x++)b=(b=b.multiply(P.fromNumber(10))).add(P.fromNumber(p[x]))}var M,W,G,K,Y=function(e,t){if(!e&&!t)return{high:P.fromNumber(0),low:P.fromNumber(0)};var n=e.shiftRightUnsigned(32),r=new P(e.getLowBits(),0),o=t.shiftRightUnsigned(32),i=new P(t.getLowBits(),0),s=n.multiply(o),u=n.multiply(i),a=r.multiply(o),c=r.multiply(i);return s=s.add(u.shiftRightUnsigned(32)),u=new P(u.getLowBits(),0).add(a).add(c.shiftRightUnsigned(32)),{high:s=s.add(u.shiftRightUnsigned(32)),low:c=u.shiftLeft(32).add(new P(c.getLowBits(),0))}}(A,P.fromString("100000000000000000"));Y.low=Y.low.add(b),M=Y.low,W=b,G=M.high>>>0,K=W.high>>>0,(G<K||G===K&&M.low>>>0<W.low>>>0)&&(Y.high=Y.high.add(P.fromNumber(1))),n=y+6176;var J={low:P.fromNumber(0),high:P.fromNumber(0)};Y.high.shiftRightUnsigned(49).and(P.fromNumber(1)).equals(P.fromNumber(1))?(J.high=J.high.or(P.fromNumber(3).shiftLeft(61)),J.high=J.high.or(P.fromNumber(n).and(P.fromNumber(16383).shiftLeft(47))),J.high=J.high.or(Y.high.and(P.fromNumber(0x7fffffffffff)))):(J.high=J.high.or(P.fromNumber(16383&n).shiftLeft(49)),J.high=J.high.or(Y.high.and(P.fromNumber(562949953421311)))),J.low=Y.low,o&&(J.high=J.high.or(P.fromString("9223372036854775808")));var Z=r.Buffer.alloc(16);return C=0,Z[C++]=255&J.low.low,Z[C++]=J.low.low>>8&255,Z[C++]=J.low.low>>16&255,Z[C++]=J.low.low>>24&255,Z[C++]=255&J.low.high,Z[C++]=J.low.high>>8&255,Z[C++]=J.low.high>>16&255,Z[C++]=J.low.high>>24&255,Z[C++]=255&J.high.low,Z[C++]=J.high.low>>8&255,Z[C++]=J.high.low>>16&255,Z[C++]=J.high.low>>24&255,Z[C++]=255&J.high.high,Z[C++]=J.high.high>>8&255,Z[C++]=J.high.high>>16&255,Z[C++]=J.high.high>>24&255,new e(Z)},e.prototype.toString=function(){for(var e,t=0,n=new Array(36),r=0;r<n.length;r++)n[r]=0;var o,i,s,u=0,a=!1,c={parts:[0,0,0,0]},l=[];u=0;var d=this.bytes,f=d[u++]|d[u++]<<8|d[u++]<<16|d[u++]<<24,p=d[u++]|d[u++]<<8|d[u++]<<16|d[u++]<<24,h=d[u++]|d[u++]<<8|d[u++]<<16|d[u++]<<24,m=d[u++]|d[u++]<<8|d[u++]<<16|d[u++]<<24;u=0,{low:new P(f,p),high:new P(h,m)}.high.lessThan(P.ZERO)&&l.push("-");var g=m>>26&31;if(g>>3==3){if(30===g)return l.join("")+"Infinity";if(31===g)return"NaN";e=m>>15&16383,o=8+(m>>14&1)}else o=m>>14&7,e=m>>17&16383;var E=e-6176;if(c.parts[0]=(16383&m)+((15&o)<<14),c.parts[1]=h,c.parts[2]=p,c.parts[3]=f,0===c.parts[0]&&0===c.parts[1]&&0===c.parts[2]&&0===c.parts[3])a=!0;else for(s=3;s>=0;s--){var y=0,v=W(c);if(c=v.quotient,y=v.rem.low)for(i=8;i>=0;i--)n[9*s+i]=y%10,y=Math.floor(y/10)}if(a)t=1,n[u]=0;else for(t=36;!n[u];)t-=1,u+=1;var A=t-1+E;if(A>=34||A<=-7||E>0){if(t>34)return l.push("0"),E>0?l.push("E+"+E):E<0&&l.push("E"+E),l.join("");l.push(""+n[u++]),(t-=1)&&l.push(".");for(r=0;r<t;r++)l.push(""+n[u++]);l.push("E"),A>0?l.push("+"+A):l.push(""+A)}else if(E>=0)for(r=0;r<t;r++)l.push(""+n[u++]);else{var b=t+E;if(b>0)for(r=0;r<b;r++)l.push(""+n[u++]);else l.push("0");for(l.push(".");b++<0;)l.push("0");for(r=0;r<t-Math.max(b-1,0);r++)l.push(""+n[u++])}return l.join("")},e.prototype.toJSON=function(){return{$numberDecimal:this.toString()}},e.prototype.toExtendedJSON=function(){return{$numberDecimal:this.toString()}},e.fromExtendedJSON=function(t){return e.fromString(t.$numberDecimal)},e.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},e.prototype.inspect=function(){return'new Decimal128("'+this.toString()+'")'},e}();Object.defineProperty(G.prototype,"_bsontype",{value:"Decimal128"});var K=function(){function e(t){if(!(this instanceof e))return new e(t);t instanceof Number&&(t=t.valueOf()),this.value=+t}return e.prototype.valueOf=function(){return this.value},e.prototype.toJSON=function(){return this.value},e.prototype.toString=function(e){return this.value.toString(e)},e.prototype.toExtendedJSON=function(e){return e&&(e.legacy||e.relaxed&&isFinite(this.value))?this.value:Object.is(Math.sign(this.value),-0)?{$numberDouble:"-"+this.value.toFixed(1)}:(Number.isInteger(this.value)?(t=this.value.toFixed(1)).length>=13&&(t=this.value.toExponential(13).toUpperCase()):t=this.value.toString(),{$numberDouble:t});var t},e.fromExtendedJSON=function(t,n){var r=parseFloat(t.$numberDouble);return n&&n.relaxed?r:new e(r)},e.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},e.prototype.inspect=function(){return"new Double("+this.toExtendedJSON().$numberDouble+")"},e}();Object.defineProperty(K.prototype,"_bsontype",{value:"Double"});var Y=function(){function e(t){if(!(this instanceof e))return new e(t);t instanceof Number&&(t=t.valueOf()),this.value=0|+t}return e.prototype.valueOf=function(){return this.value},e.prototype.toString=function(e){return this.value.toString(e)},e.prototype.toJSON=function(){return this.value},e.prototype.toExtendedJSON=function(e){return e&&(e.relaxed||e.legacy)?this.value:{$numberInt:this.value.toString()}},e.fromExtendedJSON=function(t,n){return n&&n.relaxed?parseInt(t.$numberInt,10):new e(t.$numberInt)},e.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},e.prototype.inspect=function(){return"new Int32("+this.valueOf()+")"},e}();Object.defineProperty(Y.prototype,"_bsontype",{value:"Int32"});var J=function(){function e(){if(!(this instanceof e))return new e}return e.prototype.toExtendedJSON=function(){return{$maxKey:1}},e.fromExtendedJSON=function(){return new e},e.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},e.prototype.inspect=function(){return"new MaxKey()"},e}();Object.defineProperty(J.prototype,"_bsontype",{value:"MaxKey"});var Z=function(){function e(){if(!(this instanceof e))return new e}return e.prototype.toExtendedJSON=function(){return{$minKey:1}},e.fromExtendedJSON=function(){return new e},e.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},e.prototype.inspect=function(){return"new MinKey()"},e}();Object.defineProperty(Z.prototype,"_bsontype",{value:"MinKey"});var X=new RegExp("^[0-9a-fA-F]{24}$"),Q=null,ee=Symbol("id"),te=function(){function e(t){if(!(this instanceof e))return new e(t);var n;if("object"==typeof t&&t&&"id"in t){if("string"!=typeof t.id&&!ArrayBuffer.isView(t.id))throw new a("Argument passed in must have an id that is of type string or Buffer");n="toHexString"in t&&"function"==typeof t.toHexString?r.Buffer.from(t.toHexString(),"hex"):t.id}else n=t;if(null==n||"number"==typeof n)this[ee]=e.generate("number"==typeof n?n:void 0);else if(ArrayBuffer.isView(n)&&12===n.byteLength)this[ee]=n instanceof r.Buffer?n:C(n);else{if("string"!=typeof n)throw new a("Argument passed in does not match the accepted types");if(12===n.length){var o=r.Buffer.from(n);if(12!==o.byteLength)throw new a("Argument passed in must be a string of 12 bytes");this[ee]=o}else{if(24!==n.length||!X.test(n))throw new a("Argument passed in must be a string of 12 bytes or a string of 24 hex characters or an integer");this[ee]=r.Buffer.from(n,"hex")}}e.cacheHexString&&(this.__id=this.id.toString("hex"))}return Object.defineProperty(e.prototype,"id",{get:function(){return this[ee]},set:function(t){this[ee]=t,e.cacheHexString&&(this.__id=t.toString("hex"))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"generationTime",{get:function(){return this.id.readInt32BE(0)},set:function(e){this.id.writeUInt32BE(e,0)},enumerable:!1,configurable:!0}),e.prototype.toHexString=function(){if(e.cacheHexString&&this.__id)return this.__id;var t=this.id.toString("hex");return e.cacheHexString&&!this.__id&&(this.__id=t),t},e.getInc=function(){return e.index=(e.index+1)%16777215},e.generate=function(t){"number"!=typeof t&&(t=Math.floor(Date.now()/1e3));var n=e.getInc(),o=r.Buffer.alloc(12);return o.writeUInt32BE(t,0),null===Q&&(Q=p(5)),o[4]=Q[0],o[5]=Q[1],o[6]=Q[2],o[7]=Q[3],o[8]=Q[4],o[11]=255&n,o[10]=n>>8&255,o[9]=n>>16&255,o},e.prototype.toString=function(e){return e?this.id.toString(e):this.toHexString()},e.prototype.toJSON=function(){return this.toHexString()},e.prototype.equals=function(t){if(null==t)return!1;if(t instanceof e)return this[ee][11]===t[ee][11]&&this[ee].equals(t[ee]);if("string"==typeof t&&e.isValid(t)&&12===t.length&&m(this.id))return t===r.Buffer.prototype.toString.call(this.id,"latin1");if("string"==typeof t&&e.isValid(t)&&24===t.length)return t.toLowerCase()===this.toHexString();if("string"==typeof t&&e.isValid(t)&&12===t.length)return r.Buffer.from(t).equals(this.id);if("object"==typeof t&&"toHexString"in t&&"function"==typeof t.toHexString){var n=t.toHexString(),o=this.toHexString().toLowerCase();return"string"==typeof n&&n.toLowerCase()===o}return!1},e.prototype.getTimestamp=function(){var e=new Date,t=this.id.readUInt32BE(0);return e.setTime(1e3*Math.floor(t)),e},e.createPk=function(){return new e},e.createFromTime=function(t){var n=r.Buffer.from([0,0,0,0,0,0,0,0,0,0,0,0]);return n.writeUInt32BE(t,0),new e(n)},e.createFromHexString=function(t){if(void 0===t||null!=t&&24!==t.length)throw new a("Argument passed in must be a single String of 12 bytes or a string of 24 hex characters");return new e(r.Buffer.from(t,"hex"))},e.isValid=function(t){if(null==t)return!1;try{return new e(t),!0}catch(e){return!1}},e.prototype.toExtendedJSON=function(){return this.toHexString?{$oid:this.toHexString()}:{$oid:this.toString("hex")}},e.fromExtendedJSON=function(t){return new e(t.$oid)},e.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},e.prototype.inspect=function(){return'new ObjectId("'+this.toHexString()+'")'},e.index=Math.floor(16777215*Math.random()),e}();Object.defineProperty(te.prototype,"generate",{value:b((function(e){return te.generate(e)}),"Please use the static `ObjectId.generate(time)` instead")}),Object.defineProperty(te.prototype,"getInc",{value:b((function(){return te.getInc()}),"Please use the static `ObjectId.getInc()` instead")}),Object.defineProperty(te.prototype,"get_inc",{value:b((function(){return te.getInc()}),"Please use the static `ObjectId.getInc()` instead")}),Object.defineProperty(te,"get_inc",{value:b((function(){return te.getInc()}),"Please use the static `ObjectId.getInc()` instead")}),Object.defineProperty(te.prototype,"_bsontype",{value:"ObjectID"});var ne=function(){function e(t,n){if(!(this instanceof e))return new e(t,n);if(this.pattern=t,this.options=(null!=n?n:"").split("").sort().join(""),-1!==this.pattern.indexOf("\0"))throw new u("BSON Regex patterns cannot contain null bytes, found: "+JSON.stringify(this.pattern));if(-1!==this.options.indexOf("\0"))throw new u("BSON Regex options cannot contain null bytes, found: "+JSON.stringify(this.options));for(var r=0;r<this.options.length;r++)if("i"!==this.options[r]&&"m"!==this.options[r]&&"x"!==this.options[r]&&"l"!==this.options[r]&&"s"!==this.options[r]&&"u"!==this.options[r])throw new u("The regular expression option ["+this.options[r]+"] is not supported")}return e.parseOptions=function(e){return e?e.split("").sort().join(""):""},e.prototype.toExtendedJSON=function(e){return(e=e||{}).legacy?{$regex:this.pattern,$options:this.options}:{$regularExpression:{pattern:this.pattern,options:this.options}}},e.fromExtendedJSON=function(t){if("$regex"in t){if("string"==typeof t.$regex)return new e(t.$regex,e.parseOptions(t.$options));if("BSONRegExp"===t.$regex._bsontype)return t}if("$regularExpression"in t)return new e(t.$regularExpression.pattern,e.parseOptions(t.$regularExpression.options));throw new a("Unexpected BSONRegExp EJSON object form: "+JSON.stringify(t))},e}();Object.defineProperty(ne.prototype,"_bsontype",{value:"BSONRegExp"});var re=function(){function e(t){if(!(this instanceof e))return new e(t);this.value=t}return e.prototype.valueOf=function(){return this.value},e.prototype.toString=function(){return this.value},e.prototype.inspect=function(){return'new BSONSymbol("'+this.value+'")'},e.prototype.toJSON=function(){return this.value},e.prototype.toExtendedJSON=function(){return{$symbol:this.value}},e.fromExtendedJSON=function(t){return new e(t.$symbol)},e.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},e}();Object.defineProperty(re.prototype,"_bsontype",{value:"Symbol"});var oe=P,ie=function(e){function t(n,r){var o=this;return o instanceof t?(o=P.isLong(n)?e.call(this,n.low,n.high,!0)||this:A(n)&&void 0!==n.t&&void 0!==n.i?e.call(this,n.i,n.t,!0)||this:e.call(this,n,r,!0)||this,Object.defineProperty(o,"_bsontype",{value:"Timestamp",writable:!1,configurable:!1,enumerable:!1}),o):new t(n,r)}return i(t,e),t.prototype.toJSON=function(){return{$timestamp:this.toString()}},t.fromInt=function(e){return new t(P.fromInt(e,!0))},t.fromNumber=function(e){return new t(P.fromNumber(e,!0))},t.fromBits=function(e,n){return new t(e,n)},t.fromString=function(e,n){return new t(P.fromString(e,!0,n))},t.prototype.toExtendedJSON=function(){return{$timestamp:{t:this.high>>>0,i:this.low>>>0}}},t.fromExtendedJSON=function(e){return new t(e.$timestamp)},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){return"new Timestamp({ t: "+this.getHighBits()+", i: "+this.getLowBits()+" })"},t.MAX_VALUE=P.MAX_UNSIGNED_VALUE,t}(oe);function se(e){return A(e)&&Reflect.has(e,"_bsontype")&&"string"==typeof e._bsontype}var ue={$oid:te,$binary:T,$uuid:T,$symbol:re,$numberInt:Y,$numberDecimal:G,$numberDouble:K,$numberLong:P,$minKey:Z,$maxKey:J,$regex:ne,$regularExpression:ne,$timestamp:ie};function ae(e){var t=e.toISOString();return 0!==e.getUTCMilliseconds()?t:t.slice(0,-5)+"Z"}function ce(e,t){if(("object"==typeof e||"function"==typeof e)&&null!==e){var n=t.seenObjects.findIndex((function(t){return t.obj===e}));if(-1!==n){var r=t.seenObjects.map((function(e){return e.propertyName})),o=r.slice(0,n).map((function(e){return e+" -> "})).join(""),i=r[n],s=" -> "+r.slice(n+1,r.length-1).map((function(e){return e+" -> "})).join(""),c=r[r.length-1],l=" ".repeat(o.length+i.length/2),d="-".repeat(s.length+(i.length+c.length)/2-1);throw new a("Converting circular structure to EJSON:\n "+o+i+s+c+"\n "+l+"\\"+d+"/")}t.seenObjects[t.seenObjects.length-1].obj=e}if(Array.isArray(e))return function(e,t){return e.map((function(e,n){t.seenObjects.push({propertyName:"index "+n,obj:null});try{return ce(e,t)}finally{t.seenObjects.pop()}}))}(e,t);if(void 0===e)return null;if(e instanceof Date||v(e)){var f=e.getTime(),p=f>-1&&f<2534023188e5;return t.legacy?t.relaxed&&p?{$date:e.getTime()}:{$date:ae(e)}:t.relaxed&&p?{$date:ae(e)}:{$date:{$numberLong:e.getTime().toString()}}}if(!("number"!=typeof e||t.relaxed&&isFinite(e))){if(Math.floor(e)===e){var h=e>=-0x8000000000000000&&e<=0x8000000000000000;if(e>=-2147483648&&e<=2147483647)return{$numberInt:e.toString()};if(h)return{$numberLong:e.toString()}}return{$numberDouble:e.toString()}}if(e instanceof RegExp||y(e)){var m=e.flags;if(void 0===m){var g=e.toString().match(/[gimuy]*$/);g&&(m=g[0])}return new ne(e.source,m).toExtendedJSON(t)}return null!=e&&"object"==typeof e?function(e,t){if(null==e||"object"!=typeof e)throw new u("not an object instance");var n=e._bsontype;if(void 0===n){var r={};for(var o in e){t.seenObjects.push({propertyName:o,obj:null});try{r[o]=ce(e[o],t)}finally{t.seenObjects.pop()}}return r}if(se(e)){var i=e;if("function"!=typeof i.toExtendedJSON){var s=fe[e._bsontype];if(!s)throw new a("Unrecognized or invalid _bsontype: "+e._bsontype);i=s(i)}return"Code"===n&&i.scope?i=new F(i.code,ce(i.scope,t)):"DBRef"===n&&i.oid&&(i=new R(ce(i.collection,t),ce(i.oid,t),ce(i.db,t),ce(i.fields,t))),i.toExtendedJSON(t)}throw new u("_bsontype must be a string, but was: "+typeof n)}(e,t):e}var le,de,fe={Binary:function(e){return new T(e.value(),e.sub_type)},Code:function(e){return new F(e.code,e.scope)},DBRef:function(e){return new R(e.collection||e.namespace,e.oid,e.db,e.fields)},Decimal128:function(e){return new G(e.bytes)},Double:function(e){return new K(e.value)},Int32:function(e){return new Y(e.value)},Long:function(e){return P.fromBits(null!=e.low?e.low:e.low_,null!=e.low?e.high:e.high_,null!=e.low?e.unsigned:e.unsigned_)},MaxKey:function(){return new J},MinKey:function(){return new Z},ObjectID:function(e){return new te(e)},ObjectId:function(e){return new te(e)},BSONRegExp:function(e){return new ne(e.pattern,e.options)},Symbol:function(e){return new re(e.value)},Timestamp:function(e){return ie.fromBits(e.low,e.high)}};!function(e){function t(e,t){var n=Object.assign({},{relaxed:!0,legacy:!1},t);return"boolean"==typeof n.relaxed&&(n.strict=!n.relaxed),"boolean"==typeof n.strict&&(n.relaxed=!n.strict),JSON.parse(e,(function(e,t){if(-1!==e.indexOf("\0"))throw new u("BSON Document field names cannot contain null bytes, found: "+JSON.stringify(e));return function e(t,n){if(void 0===n&&(n={}),"number"==typeof t){if(n.relaxed||n.legacy)return t;if(Math.floor(t)===t){if(t>=-2147483648&&t<=2147483647)return new Y(t);if(t>=-0x8000000000000000&&t<=0x8000000000000000)return P.fromNumber(t)}return new K(t)}if(null==t||"object"!=typeof t)return t;if(t.$undefined)return null;for(var r=Object.keys(t).filter((function(e){return e.startsWith("$")&&null!=t[e]})),o=0;o<r.length;o++){var i=ue[r[o]];if(i)return i.fromExtendedJSON(t,n)}if(null!=t.$date){var s=t.$date,u=new Date;return n.legacy?"number"==typeof s?u.setTime(s):"string"==typeof s&&u.setTime(Date.parse(s)):"string"==typeof s?u.setTime(Date.parse(s)):P.isLong(s)?u.setTime(s.toNumber()):"number"==typeof s&&n.relaxed&&u.setTime(s),u}if(null!=t.$code){var a=Object.assign({},t);return t.$scope&&(a.$scope=e(t.$scope)),F.fromExtendedJSON(t)}if(N(t)||t.$dbPointer){var c=t.$ref?t:t.$dbPointer;if(c instanceof R)return c;var l=Object.keys(c).filter((function(e){return e.startsWith("$")})),d=!0;if(l.forEach((function(e){-1===["$ref","$id","$db"].indexOf(e)&&(d=!1)})),d)return R.fromExtendedJSON(c)}return t}(t,n)}))}function n(e,t,n,r){null!=n&&"object"==typeof n&&(r=n,n=0),null==t||"object"!=typeof t||Array.isArray(t)||(r=t,t=void 0,n=0);var o=ce(e,Object.assign({relaxed:!0,legacy:!1},r,{seenObjects:[{propertyName:"(root)",obj:null}]}));return JSON.stringify(o,t,n)}e.parse=t,e.stringify=n,e.serialize=function(e,t){return t=t||{},JSON.parse(n(e,t))},e.deserialize=function(e,n){return n=n||{},t(JSON.stringify(e),n)}}(le||(le={}));var pe=l();de=pe.Map?pe.Map:function(){function e(e){void 0===e&&(e=[]),this._keys=[],this._values={};for(var t=0;t<e.length;t++)if(null!=e[t]){var n=e[t],r=n[0],o=n[1];this._keys.push(r),this._values[r]={v:o,i:this._keys.length-1}}}return e.prototype.clear=function(){this._keys=[],this._values={}},e.prototype.delete=function(e){var t=this._values[e];return null!=t&&(delete this._values[e],this._keys.splice(t.i,1),!0)},e.prototype.entries=function(){var e=this,t=0;return{next:function(){var n=e._keys[t++];return{value:void 0!==n?[n,e._values[n].v]:void 0,done:void 0===n}}}},e.prototype.forEach=function(e,t){t=t||this;for(var n=0;n<this._keys.length;n++){var r=this._keys[n];e.call(t,this._values[r].v,r,t)}},e.prototype.get=function(e){return this._values[e]?this._values[e].v:void 0},e.prototype.has=function(e){return null!=this._values[e]},e.prototype.keys=function(){var e=this,t=0;return{next:function(){var n=e._keys[t++];return{value:void 0!==n?n:void 0,done:void 0===n}}}},e.prototype.set=function(e,t){return this._values[e]?(this._values[e].v=t,this):(this._keys.push(e),this._values[e]={v:t,i:this._keys.length-1},this)},e.prototype.values=function(){var e=this,t=0;return{next:function(){var n=e._keys[t++];return{value:void 0!==n?e._values[n].v:void 0,done:void 0===n}}}},Object.defineProperty(e.prototype,"size",{get:function(){return this._keys.length},enumerable:!1,configurable:!0}),e}();var he=2147483647,me=-2147483648,ge=Math.pow(2,63)-1,Ee=-Math.pow(2,63),ye=Math.pow(2,53),ve=-Math.pow(2,53),Ae=1,be=2,Ce=3,Se=4,Oe=5,_e=6,we=7,De=8,Be=9,Te=10,Fe=11,Ne=12,Re=13,Ie=14,xe=15,Me=16,Pe=17,ke=18,je=19,Le=255,Ue=127,$e=0,Ve=1,ze=2,qe=3,We=4,He=5,Ge=6,Ke=7,Ye=128;function Je(e,t,n){var r=5;if(Array.isArray(e))for(var o=0;o<e.length;o++)r+=Ze(o.toString(),e[o],t,!0,n);else for(var i in"function"==typeof(null==e?void 0:e.toBSON)&&(e=e.toBSON()),e)r+=Ze(i,e[i],t,!1,n);return r}function Ze(e,t,n,o,i){switch(void 0===n&&(n=!1),void 0===o&&(o=!1),void 0===i&&(i=!1),"function"==typeof(null==t?void 0:t.toBSON)&&(t=t.toBSON()),typeof t){case"string":return 1+r.Buffer.byteLength(e,"utf8")+1+4+r.Buffer.byteLength(t,"utf8")+1;case"number":return Math.floor(t)===t&&t>=ve&&t<=ye&&t>=me&&t<=he?(null!=e?r.Buffer.byteLength(e,"utf8")+1:0)+5:(null!=e?r.Buffer.byteLength(e,"utf8")+1:0)+9;case"undefined":return o||!i?(null!=e?r.Buffer.byteLength(e,"utf8")+1:0)+1:0;case"boolean":return(null!=e?r.Buffer.byteLength(e,"utf8")+1:0)+2;case"object":if(null==t||"MinKey"===t._bsontype||"MaxKey"===t._bsontype)return(null!=e?r.Buffer.byteLength(e,"utf8")+1:0)+1;if("ObjectId"===t._bsontype||"ObjectID"===t._bsontype)return(null!=e?r.Buffer.byteLength(e,"utf8")+1:0)+13;if(t instanceof Date||v(t))return(null!=e?r.Buffer.byteLength(e,"utf8")+1:0)+9;if(ArrayBuffer.isView(t)||t instanceof ArrayBuffer||h(t))return(null!=e?r.Buffer.byteLength(e,"utf8")+1:0)+6+t.byteLength;if("Long"===t._bsontype||"Double"===t._bsontype||"Timestamp"===t._bsontype)return(null!=e?r.Buffer.byteLength(e,"utf8")+1:0)+9;if("Decimal128"===t._bsontype)return(null!=e?r.Buffer.byteLength(e,"utf8")+1:0)+17;if("Code"===t._bsontype)return null!=t.scope&&Object.keys(t.scope).length>0?(null!=e?r.Buffer.byteLength(e,"utf8")+1:0)+1+4+4+r.Buffer.byteLength(t.code.toString(),"utf8")+1+Je(t.scope,n,i):(null!=e?r.Buffer.byteLength(e,"utf8")+1:0)+1+4+r.Buffer.byteLength(t.code.toString(),"utf8")+1;if("Binary"===t._bsontype)return t.sub_type===T.SUBTYPE_BYTE_ARRAY?(null!=e?r.Buffer.byteLength(e,"utf8")+1:0)+(t.position+1+4+1+4):(null!=e?r.Buffer.byteLength(e,"utf8")+1:0)+(t.position+1+4+1);if("Symbol"===t._bsontype)return(null!=e?r.Buffer.byteLength(e,"utf8")+1:0)+r.Buffer.byteLength(t.value,"utf8")+4+1+1;if("DBRef"===t._bsontype){var s=Object.assign({$ref:t.collection,$id:t.oid},t.fields);return null!=t.db&&(s.$db=t.db),(null!=e?r.Buffer.byteLength(e,"utf8")+1:0)+1+Je(s,n,i)}return t instanceof RegExp||y(t)?(null!=e?r.Buffer.byteLength(e,"utf8")+1:0)+1+r.Buffer.byteLength(t.source,"utf8")+1+(t.global?1:0)+(t.ignoreCase?1:0)+(t.multiline?1:0)+1:"BSONRegExp"===t._bsontype?(null!=e?r.Buffer.byteLength(e,"utf8")+1:0)+1+r.Buffer.byteLength(t.pattern,"utf8")+1+r.Buffer.byteLength(t.options,"utf8")+1:(null!=e?r.Buffer.byteLength(e,"utf8")+1:0)+Je(t,n,i)+1;case"function":if(t instanceof RegExp||y(t)||"[object RegExp]"===String.call(t))return(null!=e?r.Buffer.byteLength(e,"utf8")+1:0)+1+r.Buffer.byteLength(t.source,"utf8")+1+(t.global?1:0)+(t.ignoreCase?1:0)+(t.multiline?1:0)+1;if(n&&null!=t.scope&&Object.keys(t.scope).length>0)return(null!=e?r.Buffer.byteLength(e,"utf8")+1:0)+1+4+4+r.Buffer.byteLength(d(t),"utf8")+1+Je(t.scope,n,i);if(n)return(null!=e?r.Buffer.byteLength(e,"utf8")+1:0)+1+4+r.Buffer.byteLength(d(t),"utf8")+1}return 0}function Xe(e,t,n){for(var r=0,o=t;o<n;o+=1){var i=e[o];if(r){if(128!=(192&i))return!1;r-=1}else if(128&i)if(192==(224&i))r=1;else if(224==(240&i))r=2;else{if(240!=(248&i))return!1;r=3}}return!r}var Qe=P.fromNumber(ye),et=P.fromNumber(ve),tt={};function nt(e,t,n){var o=(t=null==t?{}:t)&&t.index?t.index:0,i=e[o]|e[o+1]<<8|e[o+2]<<16|e[o+3]<<24;if(i<5)throw new u("bson size must be >= 5, is "+i);if(t.allowObjectSmallerThanBufferSize&&e.length<i)throw new u("buffer length "+e.length+" must be >= bson size "+i);if(!t.allowObjectSmallerThanBufferSize&&e.length!==i)throw new u("buffer length "+e.length+" must === bson size "+i);if(i+o>e.byteLength)throw new u("(bson size "+i+" + options.index "+o+" must be <= buffer length "+e.byteLength+")");if(0!==e[o+i-1])throw new u("One object, sized correctly, with a spot for an EOO, but the EOO isn't 0x00");return function e(t,n,o,i){void 0===i&&(i=!1);var a,c=null!=o.evalFunctions&&o.evalFunctions,l=null!=o.cacheFunctions&&o.cacheFunctions,d=null==o.fieldsAsRaw?null:o.fieldsAsRaw,f=null!=o.raw&&o.raw,p="boolean"==typeof o.bsonRegExp&&o.bsonRegExp,h=null!=o.promoteBuffers&&o.promoteBuffers,m=null==o.promoteLongs||o.promoteLongs,g=null==o.promoteValues||o.promoteValues,E=null==o.validation?{utf8:!0}:o.validation,y=!0,v=new Set,A=E.utf8;if("boolean"==typeof A)a=A;else{y=!1;var b=Object.keys(A).map((function(e){return A[e]}));if(0===b.length)throw new u("UTF-8 validation setting cannot be empty");if("boolean"!=typeof b[0])throw new u("Invalid UTF-8 validation option, must specify boolean values");if(a=b[0],!b.every((function(e){return e===a})))throw new u("Invalid UTF-8 validation option - keys must be all true or all false")}if(!y)for(var C=0,S=Object.keys(A);C<S.length;C++){var O=S[C];v.add(O)}var _=n;if(t.length<5)throw new u("corrupt bson message < 5 bytes long");var w=t[n++]|t[n++]<<8|t[n++]<<16|t[n++]<<24;if(w<5||w>t.length)throw new u("corrupt bson message");var D=i?[]:{},B=0,I=!i&&null;for(;;){var x=t[n++];if(0===x)break;for(var M=n;0!==t[M]&&M<t.length;)M++;if(M>=t.byteLength)throw new u("Bad BSON Document: illegal CString");var k=i?B++:t.toString("utf8",n,M),j=!0;j=y||v.has(k)?a:!a,!1!==I&&"$"===k[0]&&(I=rt.test(k));var L=void 0;if(n=M+1,x===be){if((ye=t[n++]|t[n++]<<8|t[n++]<<16|t[n++]<<24)<=0||ye>t.length-n||0!==t[n+ye-1])throw new u("bad string length in bson");L=it(t,n,n+ye-1,j),n+=ye}else if(x===we){var U=r.Buffer.alloc(12);t.copy(U,0,n,n+12),L=new te(U),n+=12}else if(x===Me&&!1===g)L=new Y(t[n++]|t[n++]<<8|t[n++]<<16|t[n++]<<24);else if(x===Me)L=t[n++]|t[n++]<<8|t[n++]<<16|t[n++]<<24;else if(x===Ae&&!1===g)L=new K(t.readDoubleLE(n)),n+=8;else if(x===Ae)L=t.readDoubleLE(n),n+=8;else if(x===Be){var $=t[n++]|t[n++]<<8|t[n++]<<16|t[n++]<<24,V=t[n++]|t[n++]<<8|t[n++]<<16|t[n++]<<24;L=new Date(new P($,V).toNumber())}else if(x===De){if(0!==t[n]&&1!==t[n])throw new u("illegal boolean type value");L=1===t[n++]}else if(x===Ce){var z=n;if((W=t[n]|t[n+1]<<8|t[n+2]<<16|t[n+3]<<24)<=0||W>t.length-n)throw new u("bad embedded document length in bson");if(f)L=t.slice(n,n+W);else{var q=o;y||(q=s(s({},o),{validation:{utf8:j}})),L=e(t,z,q,!1)}n+=W}else if(x===Se){z=n;var W=t[n]|t[n+1]<<8|t[n+2]<<16|t[n+3]<<24,H=o,X=n+W;if(d&&d[k]){for(var Q in H={},o)H[Q]=o[Q];H.raw=!0}if(y||(H=s(s({},H),{validation:{utf8:j}})),L=e(t,z,H,!0),0!==t[(n+=W)-1])throw new u("invalid array terminator byte");if(n!==X)throw new u("corrupted array bson")}else if(x===_e)L=void 0;else if(x===Te)L=null;else if(x===ke){$=t[n++]|t[n++]<<8|t[n++]<<16|t[n++]<<24,V=t[n++]|t[n++]<<8|t[n++]<<16|t[n++]<<24;var ee=new P($,V);L=m&&!0===g&&ee.lessThanOrEqual(Qe)&&ee.greaterThanOrEqual(et)?ee.toNumber():ee}else if(x===je){var oe=r.Buffer.alloc(16);t.copy(oe,0,n,n+16),n+=16;var se=new G(oe);L="toObject"in se&&"function"==typeof se.toObject?se.toObject():se}else if(x===Oe){var ue=t[n++]|t[n++]<<8|t[n++]<<16|t[n++]<<24,ae=ue,ce=t[n++];if(ue<0)throw new u("Negative binary type element size found");if(ue>t.byteLength)throw new u("Binary type size larger than document size");if(null!=t.slice){if(ce===T.SUBTYPE_BYTE_ARRAY){if((ue=t[n++]|t[n++]<<8|t[n++]<<16|t[n++]<<24)<0)throw new u("Negative binary type element size found for subtype 0x02");if(ue>ae-4)throw new u("Binary type with subtype 0x02 contains too long binary size");if(ue<ae-4)throw new u("Binary type with subtype 0x02 contains too short binary size")}L=h&&g?t.slice(n,n+ue):new T(t.slice(n,n+ue),ce)}else{var le=r.Buffer.alloc(ue);if(ce===T.SUBTYPE_BYTE_ARRAY){if((ue=t[n++]|t[n++]<<8|t[n++]<<16|t[n++]<<24)<0)throw new u("Negative binary type element size found for subtype 0x02");if(ue>ae-4)throw new u("Binary type with subtype 0x02 contains too long binary size");if(ue<ae-4)throw new u("Binary type with subtype 0x02 contains too short binary size")}for(M=0;M<ue;M++)le[M]=t[n+M];L=h&&g?le:new T(le,ce)}n+=ue}else if(x===Fe&&!1===p){for(M=n;0!==t[M]&&M<t.length;)M++;if(M>=t.length)throw new u("Bad BSON Document: illegal CString");var de=t.toString("utf8",n,M);for(M=n=M+1;0!==t[M]&&M<t.length;)M++;if(M>=t.length)throw new u("Bad BSON Document: illegal CString");var fe=t.toString("utf8",n,M);n=M+1;var pe=new Array(fe.length);for(M=0;M<fe.length;M++)switch(fe[M]){case"m":pe[M]="m";break;case"s":pe[M]="g";break;case"i":pe[M]="i"}L=new RegExp(de,pe.join(""))}else if(x===Fe&&!0===p){for(M=n;0!==t[M]&&M<t.length;)M++;if(M>=t.length)throw new u("Bad BSON Document: illegal CString");de=t.toString("utf8",n,M);for(M=n=M+1;0!==t[M]&&M<t.length;)M++;if(M>=t.length)throw new u("Bad BSON Document: illegal CString");fe=t.toString("utf8",n,M);n=M+1,L=new ne(de,fe)}else if(x===Ie){if((ye=t[n++]|t[n++]<<8|t[n++]<<16|t[n++]<<24)<=0||ye>t.length-n||0!==t[n+ye-1])throw new u("bad string length in bson");var he=it(t,n,n+ye-1,j);L=g?he:new re(he),n+=ye}else if(x===Pe){$=t[n++]|t[n++]<<8|t[n++]<<16|t[n++]<<24,V=t[n++]|t[n++]<<8|t[n++]<<16|t[n++]<<24;L=new ie($,V)}else if(x===Le)L=new Z;else if(x===Ue)L=new J;else if(x===Re){if((ye=t[n++]|t[n++]<<8|t[n++]<<16|t[n++]<<24)<=0||ye>t.length-n||0!==t[n+ye-1])throw new u("bad string length in bson");var me=it(t,n,n+ye-1,j);L=c?l?ot(me,tt,D):ot(me):new F(me),n+=ye}else if(x===xe){var ge=t[n++]|t[n++]<<8|t[n++]<<16|t[n++]<<24;if(ge<13)throw new u("code_w_scope total size shorter minimum expected length");if((ye=t[n++]|t[n++]<<8|t[n++]<<16|t[n++]<<24)<=0||ye>t.length-n||0!==t[n+ye-1])throw new u("bad string length in bson");me=it(t,n,n+ye-1,j),z=n+=ye,W=t[n]|t[n+1]<<8|t[n+2]<<16|t[n+3]<<24;var Ee=e(t,z,o,!1);if(n+=W,ge<8+W+ye)throw new u("code_w_scope total size is too short, truncating scope");if(ge>8+W+ye)throw new u("code_w_scope total size is too long, clips outer document");c?(L=l?ot(me,tt,D):ot(me)).scope=Ee:L=new F(me,Ee)}else{if(x!==Ne)throw new u("Detected unknown BSON type "+x.toString(16)+' for fieldname "'+k+'"');var ye;if((ye=t[n++]|t[n++]<<8|t[n++]<<16|t[n++]<<24)<=0||ye>t.length-n||0!==t[n+ye-1])throw new u("bad string length in bson");if(null!=E&&E.utf8&&!Xe(t,n,n+ye-1))throw new u("Invalid UTF-8 string in BSON document");var ve=t.toString("utf8",n,n+ye-1);n+=ye;var $e=r.Buffer.alloc(12);t.copy($e,0,n,n+12);U=new te($e);n+=12,L=new R(ve,U)}"__proto__"===k?Object.defineProperty(D,k,{value:L,writable:!0,enumerable:!0,configurable:!0}):D[k]=L}if(w!==n-_){if(i)throw new u("corrupt array bson");throw new u("corrupt object bson")}if(!I)return D;if(N(D)){var Ve=Object.assign({},D);return delete Ve.$ref,delete Ve.$id,delete Ve.$db,new R(D.$ref,D.$id,D.$db,Ve)}return D}(e,o,t,n)}var rt=/^\$ref$|^\$id$|^\$db$/;function ot(e,t,n){return t?(null==t[e]&&(t[e]=new Function(e)),t[e].bind(n)):new Function(e)}function it(e,t,n,r){var o=e.toString("utf8",t,n);if(r)for(var i=0;i<o.length;i++)if(65533===o.charCodeAt(i)){if(!Xe(e,t,n))throw new u("Invalid UTF-8 string in BSON document");break}return o}function st(e,t,n,r,o,i){var s,u,a,c="big"===r,l=8*i-o-1,d=(1<<l)-1,f=d>>1,p=23===o?Math.pow(2,-24)-Math.pow(2,-77):0,h=c?i-1:0,m=c?-1:1,g=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(u=isNaN(t)?1:0,s=d):(s=Math.floor(Math.log(t)/Math.LN2),t*(a=Math.pow(2,-s))<1&&(s--,a*=2),(t+=s+f>=1?p/a:p*Math.pow(2,1-f))*a>=2&&(s++,a/=2),s+f>=d?(u=0,s=d):s+f>=1?(u=(t*a-1)*Math.pow(2,o),s+=f):(u=t*Math.pow(2,f-1)*Math.pow(2,o),s=0)),isNaN(t)&&(u=0);o>=8;)e[n+h]=255&u,h+=m,u/=256,o-=8;for(s=s<<o|u,isNaN(t)&&(s+=8),l+=o;l>0;)e[n+h]=255&s,h+=m,s/=256,l-=8;e[n+h-m]|=128*g}var ut=/\x00/,at=new Set(["$db","$ref","$id","$clusterTime"]);function ct(e,t,n,r,o){e[r++]=be;var i=o?e.write(t,r,void 0,"ascii"):e.write(t,r,void 0,"utf8");e[(r=r+i+1)-1]=0;var s=e.write(n,r+4,void 0,"utf8");return e[r+3]=s+1>>24&255,e[r+2]=s+1>>16&255,e[r+1]=s+1>>8&255,e[r]=s+1&255,r=r+4+s,e[r++]=0,r}function lt(e,t,n,r,o){Number.isInteger(n)&&n>=me&&n<=he?(e[r++]=Me,r+=o?e.write(t,r,void 0,"ascii"):e.write(t,r,void 0,"utf8"),e[r++]=0,e[r++]=255&n,e[r++]=n>>8&255,e[r++]=n>>16&255,e[r++]=n>>24&255):(e[r++]=Ae,r+=o?e.write(t,r,void 0,"ascii"):e.write(t,r,void 0,"utf8"),e[r++]=0,st(e,n,r,"little",52,8),r+=8);return r}function dt(e,t,n,r,o){return e[r++]=Te,r+=o?e.write(t,r,void 0,"ascii"):e.write(t,r,void 0,"utf8"),e[r++]=0,r}function ft(e,t,n,r,o){return e[r++]=De,r+=o?e.write(t,r,void 0,"ascii"):e.write(t,r,void 0,"utf8"),e[r++]=0,e[r++]=n?1:0,r}function pt(e,t,n,r,o){e[r++]=Be,r+=o?e.write(t,r,void 0,"ascii"):e.write(t,r,void 0,"utf8"),e[r++]=0;var i=P.fromNumber(n.getTime()),s=i.getLowBits(),u=i.getHighBits();return e[r++]=255&s,e[r++]=s>>8&255,e[r++]=s>>16&255,e[r++]=s>>24&255,e[r++]=255&u,e[r++]=u>>8&255,e[r++]=u>>16&255,e[r++]=u>>24&255,r}function ht(e,t,n,r,o){if(e[r++]=Fe,r+=o?e.write(t,r,void 0,"ascii"):e.write(t,r,void 0,"utf8"),e[r++]=0,n.source&&null!=n.source.match(ut))throw Error("value "+n.source+" must not contain null bytes");return r+=e.write(n.source,r,void 0,"utf8"),e[r++]=0,n.ignoreCase&&(e[r++]=105),n.global&&(e[r++]=115),n.multiline&&(e[r++]=109),e[r++]=0,r}function mt(e,t,n,r,o){if(e[r++]=Fe,r+=o?e.write(t,r,void 0,"ascii"):e.write(t,r,void 0,"utf8"),e[r++]=0,null!=n.pattern.match(ut))throw Error("pattern "+n.pattern+" must not contain null bytes");return r+=e.write(n.pattern,r,void 0,"utf8"),e[r++]=0,r+=e.write(n.options.split("").sort().join(""),r,void 0,"utf8"),e[r++]=0,r}function gt(e,t,n,r,o){return null===n?e[r++]=Te:"MinKey"===n._bsontype?e[r++]=Le:e[r++]=Ue,r+=o?e.write(t,r,void 0,"ascii"):e.write(t,r,void 0,"utf8"),e[r++]=0,r}function Et(e,t,n,r,o){if(e[r++]=we,r+=o?e.write(t,r,void 0,"ascii"):e.write(t,r,void 0,"utf8"),e[r++]=0,"string"==typeof n.id)e.write(n.id,r,void 0,"binary");else{if(!m(n.id))throw new a("object ["+JSON.stringify(n)+"] is not a valid ObjectId");e.set(n.id.subarray(0,12),r)}return r+12}function yt(e,t,n,r,o){e[r++]=Oe,r+=o?e.write(t,r,void 0,"ascii"):e.write(t,r,void 0,"utf8"),e[r++]=0;var i=n.length;return e[r++]=255&i,e[r++]=i>>8&255,e[r++]=i>>16&255,e[r++]=i>>24&255,e[r++]=$e,e.set(C(n),r),r+=i}function vt(e,t,n,r,o,i,s,a,c,l){void 0===o&&(o=!1),void 0===i&&(i=0),void 0===s&&(s=!1),void 0===a&&(a=!0),void 0===c&&(c=!1),void 0===l&&(l=[]);for(var d=0;d<l.length;d++)if(l[d]===n)throw new u("cyclic dependency detected");l.push(n),e[r++]=Array.isArray(n)?Se:Ce,r+=c?e.write(t,r,void 0,"ascii"):e.write(t,r,void 0,"utf8"),e[r++]=0;var f=Tt(e,n,o,r,i+1,s,a,l);return l.pop(),f}function At(e,t,n,r,o){return e[r++]=je,r+=o?e.write(t,r,void 0,"ascii"):e.write(t,r,void 0,"utf8"),e[r++]=0,e.set(n.bytes.subarray(0,16),r),r+16}function bt(e,t,n,r,o){e[r++]="Long"===n._bsontype?ke:Pe,r+=o?e.write(t,r,void 0,"ascii"):e.write(t,r,void 0,"utf8"),e[r++]=0;var i=n.getLowBits(),s=n.getHighBits();return e[r++]=255&i,e[r++]=i>>8&255,e[r++]=i>>16&255,e[r++]=i>>24&255,e[r++]=255&s,e[r++]=s>>8&255,e[r++]=s>>16&255,e[r++]=s>>24&255,r}function Ct(e,t,n,r,o){return n=n.valueOf(),e[r++]=Me,r+=o?e.write(t,r,void 0,"ascii"):e.write(t,r,void 0,"utf8"),e[r++]=0,e[r++]=255&n,e[r++]=n>>8&255,e[r++]=n>>16&255,e[r++]=n>>24&255,r}function St(e,t,n,r,o){return e[r++]=Ae,r+=o?e.write(t,r,void 0,"ascii"):e.write(t,r,void 0,"utf8"),e[r++]=0,st(e,n.value,r,"little",52,8),r+=8}function Ot(e,t,n,r,o,i,s){e[r++]=Re,r+=s?e.write(t,r,void 0,"ascii"):e.write(t,r,void 0,"utf8"),e[r++]=0;var u=d(n),a=e.write(u,r+4,void 0,"utf8")+1;return e[r]=255&a,e[r+1]=a>>8&255,e[r+2]=a>>16&255,e[r+3]=a>>24&255,r=r+4+a-1,e[r++]=0,r}function _t(e,t,n,r,o,i,s,u,a){if(void 0===o&&(o=!1),void 0===i&&(i=0),void 0===s&&(s=!1),void 0===u&&(u=!0),void 0===a&&(a=!1),n.scope&&"object"==typeof n.scope){e[r++]=xe,r+=a?e.write(t,r,void 0,"ascii"):e.write(t,r,void 0,"utf8"),e[r++]=0;var c=r,l="string"==typeof n.code?n.code:n.code.toString();r+=4;var d=e.write(l,r+4,void 0,"utf8")+1;e[r]=255&d,e[r+1]=d>>8&255,e[r+2]=d>>16&255,e[r+3]=d>>24&255,e[r+4+d-1]=0,r=r+d+4;var f=Tt(e,n.scope,o,r,i+1,s,u);r=f-1;var p=f-c;e[c++]=255&p,e[c++]=p>>8&255,e[c++]=p>>16&255,e[c++]=p>>24&255,e[r++]=0}else{e[r++]=Re,r+=a?e.write(t,r,void 0,"ascii"):e.write(t,r,void 0,"utf8"),e[r++]=0;l=n.code.toString();var h=e.write(l,r+4,void 0,"utf8")+1;e[r]=255&h,e[r+1]=h>>8&255,e[r+2]=h>>16&255,e[r+3]=h>>24&255,r=r+4+h-1,e[r++]=0}return r}function wt(e,t,n,r,o){e[r++]=Oe,r+=o?e.write(t,r,void 0,"ascii"):e.write(t,r,void 0,"utf8"),e[r++]=0;var i=n.value(!0),s=n.position;return n.sub_type===T.SUBTYPE_BYTE_ARRAY&&(s+=4),e[r++]=255&s,e[r++]=s>>8&255,e[r++]=s>>16&255,e[r++]=s>>24&255,e[r++]=n.sub_type,n.sub_type===T.SUBTYPE_BYTE_ARRAY&&(s-=4,e[r++]=255&s,e[r++]=s>>8&255,e[r++]=s>>16&255,e[r++]=s>>24&255),e.set(i,r),r+=n.position}function Dt(e,t,n,r,o){e[r++]=Ie,r+=o?e.write(t,r,void 0,"ascii"):e.write(t,r,void 0,"utf8"),e[r++]=0;var i=e.write(n.value,r+4,void 0,"utf8")+1;return e[r]=255&i,e[r+1]=i>>8&255,e[r+2]=i>>16&255,e[r+3]=i>>24&255,r=r+4+i-1,e[r++]=0,r}function Bt(e,t,n,r,o,i,s){e[r++]=Ce,r+=s?e.write(t,r,void 0,"ascii"):e.write(t,r,void 0,"utf8"),e[r++]=0;var u=r,a={$ref:n.collection||n.namespace,$id:n.oid};null!=n.db&&(a.$db=n.db);var c=Tt(e,a=Object.assign(a,n.fields),!1,r,o+1,i),l=c-u;return e[u++]=255&l,e[u++]=l>>8&255,e[u++]=l>>16&255,e[u++]=l>>24&255,c}function Tt(e,t,n,r,o,i,s,u){void 0===n&&(n=!1),void 0===r&&(r=0),void 0===o&&(o=0),void 0===i&&(i=!1),void 0===s&&(s=!0),void 0===u&&(u=[]),r=r||0,(u=u||[]).push(t);var c,l=r+4;if(Array.isArray(t))for(var d=0;d<t.length;d++){var f=""+d;if("function"==typeof(null==(C=t[d])?void 0:C.toBSON)&&(C=C.toBSON()),"string"==typeof C)l=ct(e,f,C,l,!0);else if("number"==typeof C)l=lt(e,f,C,l,!0);else{if("bigint"==typeof C)throw new a("Unsupported type BigInt, please use Decimal128");if("boolean"==typeof C)l=ft(e,f,C,l,!0);else if(C instanceof Date||v(C))l=pt(e,f,C,l,!0);else if(void 0===C)l=dt(e,f,0,l,!0);else if(null===C)l=dt(e,f,0,l,!0);else if("ObjectId"===C._bsontype||"ObjectID"===C._bsontype)l=Et(e,f,C,l,!0);else if(m(C))l=yt(e,f,C,l,!0);else if(C instanceof RegExp||y(C))l=ht(e,f,C,l,!0);else if("object"==typeof C&&null==C._bsontype)l=vt(e,f,C,l,n,o,i,s,!0,u);else if("object"==typeof C&&se(C)&&"Decimal128"===C._bsontype)l=At(e,f,C,l,!0);else if("Long"===C._bsontype||"Timestamp"===C._bsontype)l=bt(e,f,C,l,!0);else if("Double"===C._bsontype)l=St(e,f,C,l,!0);else if("function"==typeof C&&i)l=Ot(e,f,C,l,0,0,!0);else if("Code"===C._bsontype)l=_t(e,f,C,l,n,o,i,s,!0);else if("Binary"===C._bsontype)l=wt(e,f,C,l,!0);else if("Symbol"===C._bsontype)l=Dt(e,f,C,l,!0);else if("DBRef"===C._bsontype)l=Bt(e,f,C,l,o,i,!0);else if("BSONRegExp"===C._bsontype)l=mt(e,f,C,l,!0);else if("Int32"===C._bsontype)l=Ct(e,f,C,l,!0);else if("MinKey"===C._bsontype||"MaxKey"===C._bsontype)l=gt(e,f,C,l,!0);else if(void 0!==C._bsontype)throw new a("Unrecognized or invalid _bsontype: "+C._bsontype)}}else if(t instanceof de||(c=t,"[object Map]"===Object.prototype.toString.call(c)))for(var p=t.entries(),h=!1;!h;){var A=p.next();if(!(h=!!A.done)){f=A.value[0];var b=typeof(C=A.value[1]);if("string"==typeof f&&!at.has(f)){if(null!=f.match(ut))throw Error("key "+f+" must not contain null bytes");if(n){if("$"===f[0])throw Error("key "+f+" must not start with '$'");if(~f.indexOf("."))throw Error("key "+f+" must not contain '.'")}}if("string"===b)l=ct(e,f,C,l);else if("number"===b)l=lt(e,f,C,l);else{if("bigint"===b||g(C)||E(C))throw new a("Unsupported type BigInt, please use Decimal128");if("boolean"===b)l=ft(e,f,C,l);else if(C instanceof Date||v(C))l=pt(e,f,C,l);else if(null===C||void 0===C&&!1===s)l=dt(e,f,0,l);else if("ObjectId"===C._bsontype||"ObjectID"===C._bsontype)l=Et(e,f,C,l);else if(m(C))l=yt(e,f,C,l);else if(C instanceof RegExp||y(C))l=ht(e,f,C,l);else if("object"===b&&null==C._bsontype)l=vt(e,f,C,l,n,o,i,s,!1,u);else if("object"===b&&"Decimal128"===C._bsontype)l=At(e,f,C,l);else if("Long"===C._bsontype||"Timestamp"===C._bsontype)l=bt(e,f,C,l);else if("Double"===C._bsontype)l=St(e,f,C,l);else if("Code"===C._bsontype)l=_t(e,f,C,l,n,o,i,s);else if("function"==typeof C&&i)l=Ot(e,f,C,l,0,0,i);else if("Binary"===C._bsontype)l=wt(e,f,C,l);else if("Symbol"===C._bsontype)l=Dt(e,f,C,l);else if("DBRef"===C._bsontype)l=Bt(e,f,C,l,o,i);else if("BSONRegExp"===C._bsontype)l=mt(e,f,C,l);else if("Int32"===C._bsontype)l=Ct(e,f,C,l);else if("MinKey"===C._bsontype||"MaxKey"===C._bsontype)l=gt(e,f,C,l);else if(void 0!==C._bsontype)throw new a("Unrecognized or invalid _bsontype: "+C._bsontype)}}}else{if("function"==typeof(null==t?void 0:t.toBSON)&&null!=(t=t.toBSON())&&"object"!=typeof t)throw new a("toBSON function did not return an object");for(var f in t){var C;"function"==typeof(null==(C=t[f])?void 0:C.toBSON)&&(C=C.toBSON());b=typeof C;if("string"==typeof f&&!at.has(f)){if(null!=f.match(ut))throw Error("key "+f+" must not contain null bytes");if(n){if("$"===f[0])throw Error("key "+f+" must not start with '$'");if(~f.indexOf("."))throw Error("key "+f+" must not contain '.'")}}if("string"===b)l=ct(e,f,C,l);else if("number"===b)l=lt(e,f,C,l);else{if("bigint"===b)throw new a("Unsupported type BigInt, please use Decimal128");if("boolean"===b)l=ft(e,f,C,l);else if(C instanceof Date||v(C))l=pt(e,f,C,l);else if(void 0===C)!1===s&&(l=dt(e,f,0,l));else if(null===C)l=dt(e,f,0,l);else if("ObjectId"===C._bsontype||"ObjectID"===C._bsontype)l=Et(e,f,C,l);else if(m(C))l=yt(e,f,C,l);else if(C instanceof RegExp||y(C))l=ht(e,f,C,l);else if("object"===b&&null==C._bsontype)l=vt(e,f,C,l,n,o,i,s,!1,u);else if("object"===b&&"Decimal128"===C._bsontype)l=At(e,f,C,l);else if("Long"===C._bsontype||"Timestamp"===C._bsontype)l=bt(e,f,C,l);else if("Double"===C._bsontype)l=St(e,f,C,l);else if("Code"===C._bsontype)l=_t(e,f,C,l,n,o,i,s);else if("function"==typeof C&&i)l=Ot(e,f,C,l,0,0,i);else if("Binary"===C._bsontype)l=wt(e,f,C,l);else if("Symbol"===C._bsontype)l=Dt(e,f,C,l);else if("DBRef"===C._bsontype)l=Bt(e,f,C,l,o,i);else if("BSONRegExp"===C._bsontype)l=mt(e,f,C,l);else if("Int32"===C._bsontype)l=Ct(e,f,C,l);else if("MinKey"===C._bsontype||"MaxKey"===C._bsontype)l=gt(e,f,C,l);else if(void 0!==C._bsontype)throw new a("Unrecognized or invalid _bsontype: "+C._bsontype)}}}u.pop(),e[l++]=0;var S=l-r;return e[r++]=255&S,e[r++]=S>>8&255,e[r++]=S>>16&255,e[r++]=S>>24&255,l}var Ft=r.Buffer.alloc(17825792);function Nt(e){Ft.length<e&&(Ft=r.Buffer.alloc(e))}function Rt(e,t){void 0===t&&(t={});var n="boolean"==typeof t.checkKeys&&t.checkKeys,o="boolean"==typeof t.serializeFunctions&&t.serializeFunctions,i="boolean"!=typeof t.ignoreUndefined||t.ignoreUndefined,s="number"==typeof t.minInternalBufferSize?t.minInternalBufferSize:17825792;Ft.length<s&&(Ft=r.Buffer.alloc(s));var u=Tt(Ft,e,n,0,0,o,i,[]),a=r.Buffer.alloc(u);return Ft.copy(a,0,0,a.length),a}function It(e,t,n){void 0===n&&(n={});var r="boolean"==typeof n.checkKeys&&n.checkKeys,o="boolean"==typeof n.serializeFunctions&&n.serializeFunctions,i="boolean"!=typeof n.ignoreUndefined||n.ignoreUndefined,s="number"==typeof n.index?n.index:0,u=Tt(Ft,e,r,0,0,o,i);return Ft.copy(t,s,0,u),s+u-1}function xt(e,t){return void 0===t&&(t={}),nt(e instanceof r.Buffer?e:C(e),t)}function Mt(e,t){return void 0===t&&(t={}),Je(e,"boolean"==typeof(t=t||{}).serializeFunctions&&t.serializeFunctions,"boolean"!=typeof t.ignoreUndefined||t.ignoreUndefined)}function Pt(e,t,n,r,o,i){for(var s=Object.assign({allowObjectSmallerThanBufferSize:!0,index:0},i),u=C(e),a=t,c=0;c<n;c++){var l=u[a]|u[a+1]<<8|u[a+2]<<16|u[a+3]<<24;s.index=a,r[o+c]=nt(u,s),a+=l}return a}var kt={Binary:T,Code:F,DBRef:R,Decimal128:G,Double:K,Int32:Y,Long:P,UUID:B,Map:de,MaxKey:J,MinKey:Z,ObjectId:te,ObjectID:te,BSONRegExp:ne,BSONSymbol:re,Timestamp:ie,EJSON:le,setInternalBufferSize:Nt,serialize:Rt,serializeWithBufferAndIndex:It,deserialize:xt,calculateObjectSize:Mt,deserializeStream:Pt,BSONError:u,BSONTypeError:a};t.default=kt},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Explain=t.ExplainVerbosity=void 0;const r=n(1);t.ExplainVerbosity=Object.freeze({queryPlanner:"queryPlanner",queryPlannerExtended:"queryPlannerExtended",executionStats:"executionStats",allPlansExecution:"allPlansExecution"});class o{constructor(e){this.verbosity="boolean"==typeof e?e?t.ExplainVerbosity.allPlansExecution:t.ExplainVerbosity.queryPlanner:e}static fromOptions(e){if(null==(null==e?void 0:e.explain))return;const t=e.explain;if("boolean"==typeof t||"string"==typeof t)return new o(t);throw new r.MongoInvalidArgumentError('Field "explain" must be a string or a boolean')}}t.Explain=o},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.RemoveUserOperation=void 0;const r=n(5),o=n(3);class i extends r.CommandOperation{constructor(e,t,n){super(e,n),this.options=n,this.username=t}execute(e,t,n){super.executeCommand(e,t,{dropUser:this.username},e=>{n(e,!e)})}}t.RemoveUserOperation=i,(0,o.defineAspects)(i,[o.Aspect.WRITE_OPERATION])},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.makeDeleteStatement=t.DeleteManyOperation=t.DeleteOneOperation=t.DeleteOperation=void 0;const r=n(1),o=n(2),i=n(5),s=n(3);class u extends i.CommandOperation{constructor(e,t,n){super(void 0,n),this.options=n,this.ns=e,this.statements=t}get canRetryWrite(){return!1!==super.canRetryWrite&&this.statements.every(e=>null==e.limit||e.limit>0)}execute(e,t,n){var i;const s=null!==(i=this.options)&&void 0!==i?i:{},u="boolean"!=typeof s.ordered||s.ordered,a={delete:this.ns.collection,deletes:this.statements,ordered:u};if(s.let&&(a.let=s.let),void 0!==s.comment&&(a.comment=s.comment),null!=s.explain&&(0,o.maxWireVersion)(e)<3)return n?n(new r.MongoCompatibilityError(`Server ${e.name} does not support explain on delete`)):void 0;if((this.writeConcern&&0===this.writeConcern.w||(0,o.maxWireVersion)(e)<5)&&this.statements.find(e=>e.hint))return void n(new r.MongoCompatibilityError("Servers < 3.4 do not support hint on delete"));const c=this.statements.find(e=>!!e.collation);c&&(0,o.collationNotSupported)(e,c)?n(new r.MongoCompatibilityError(`Server ${e.name} does not support collation`)):super.executeCommand(e,t,a,n)}}t.DeleteOperation=u;class a extends u{constructor(e,t,n){super(e.s.namespace,[l(t,{...n,limit:1})],n)}execute(e,t,n){super.execute(e,t,(e,t)=>{var o,i;return e||null==t?n(e):t.code?n(new r.MongoServerError(t)):t.writeErrors?n(new r.MongoServerError(t.writeErrors[0])):this.explain?n(void 0,t):void n(void 0,{acknowledged:null===(i=0!==(null===(o=this.writeConcern)||void 0===o?void 0:o.w))||void 0===i||i,deletedCount:t.n})})}}t.DeleteOneOperation=a;class c extends u{constructor(e,t,n){super(e.s.namespace,[l(t,n)],n)}execute(e,t,n){super.execute(e,t,(e,t)=>{var o,i;return e||null==t?n(e):t.code?n(new r.MongoServerError(t)):t.writeErrors?n(new r.MongoServerError(t.writeErrors[0])):this.explain?n(void 0,t):void n(void 0,{acknowledged:null===(i=0!==(null===(o=this.writeConcern)||void 0===o?void 0:o.w))||void 0===i||i,deletedCount:t.n})})}}function l(e,t){const n={q:e,limit:"number"==typeof t.limit?t.limit:0};return!0===t.single&&(n.limit=1),t.collation&&(n.collation=t.collation),t.hint&&(n.hint=t.hint),n}t.DeleteManyOperation=c,t.makeDeleteStatement=l,(0,s.defineAspects)(u,[s.Aspect.RETRYABLE,s.Aspect.WRITE_OPERATION]),(0,s.defineAspects)(a,[s.Aspect.RETRYABLE,s.Aspect.WRITE_OPERATION,s.Aspect.EXPLAINABLE,s.Aspect.SKIP_COLLATION]),(0,s.defineAspects)(c,[s.Aspect.WRITE_OPERATION,s.Aspect.EXPLAINABLE,s.Aspect.SKIP_COLLATION])},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.InsertManyOperation=t.InsertOneOperation=t.InsertOperation=void 0;const r=n(1),o=n(13),i=n(163),s=n(5),u=n(164),a=n(3);class c extends s.CommandOperation{constructor(e,t,n){var r;super(void 0,n),this.options={...n,checkKeys:null!==(r=n.checkKeys)&&void 0!==r&&r},this.ns=e,this.documents=t}execute(e,t,n){var r;const o=null!==(r=this.options)&&void 0!==r?r:{},i="boolean"!=typeof o.ordered||o.ordered,s={insert:this.ns.collection,documents:this.documents,ordered:i};"boolean"==typeof o.bypassDocumentValidation&&(s.bypassDocumentValidation=o.bypassDocumentValidation),void 0!==o.comment&&(s.comment=o.comment),super.executeCommand(e,t,s,n)}}t.InsertOperation=c;class l extends c{constructor(e,t,n){super(e.s.namespace,(0,u.prepareDocs)(e,[t],n),n)}execute(e,t,n){super.execute(e,t,(e,t)=>{var o,i;return e||null==t?n(e):t.code?n(new r.MongoServerError(t)):t.writeErrors?n(new r.MongoServerError(t.writeErrors[0])):void n(void 0,{acknowledged:null===(i=0!==(null===(o=this.writeConcern)||void 0===o?void 0:o.w))||void 0===i||i,insertedId:this.documents[0]._id})})}}t.InsertOneOperation=l;class d extends a.AbstractOperation{constructor(e,t,n){if(super(n),!Array.isArray(t))throw new r.MongoInvalidArgumentError('Argument "docs" must be an array of documents');this.options=n,this.collection=e,this.docs=t}execute(e,t,n){const s=this.collection,a={...this.options,...this.bsonOptions,readPreference:this.readPreference},c=o.WriteConcern.fromOptions(a);new i.BulkWriteOperation(s,(0,u.prepareDocs)(s,this.docs,a).map(e=>({insertOne:{document:e}})),a).execute(e,t,(e,t)=>{var o;if(e||null==t)return e&&"Operation must be an object with an operation key"===e.message&&(e=new r.MongoInvalidArgumentError("Collection.insertMany() cannot be called with an array that has null/undefined values")),n(e);n(void 0,{acknowledged:null===(o=0!==(null==c?void 0:c.w))||void 0===o||o,insertedCount:t.insertedCount,insertedIds:t.insertedIds})})}}t.InsertManyOperation=d,(0,a.defineAspects)(c,[a.Aspect.RETRYABLE,a.Aspect.WRITE_OPERATION]),(0,a.defineAspects)(l,[a.Aspect.RETRYABLE,a.Aspect.WRITE_OPERATION]),(0,a.defineAspects)(d,[a.Aspect.WRITE_OPERATION])},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.BulkWriteOperation=void 0;const r=n(3);class o extends r.AbstractOperation{constructor(e,t,n){super(n),this.options=n,this.collection=e,this.operations=t}execute(e,t,n){const r=this.collection,o=this.operations,i={...this.options,...this.bsonOptions,readPreference:this.readPreference},s=!1===i.ordered?r.initializeUnorderedBulkOp(i):r.initializeOrderedBulkOp(i);try{for(let e=0;e<o.length;e++)s.raw(o[e])}catch(e){return n(e)}s.execute({...i,session:t},(e,t)=>{if(!t&&e)return n(e);n(void 0,t)})}}t.BulkWriteOperation=o,(0,r.defineAspects)(o,[r.Aspect.WRITE_OPERATION])},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.prepareDocs=t.indexInformation=void 0;const r=n(1),o=n(2);t.indexInformation=function(e,t,n,i){let s=n,u=i;"function"==typeof n&&(u=n,s={});const a=null!=s.full&&s.full;let c;try{c=(0,o.getTopology)(e)}catch(e){return u(e)}if(c.isDestroyed())return u(new r.MongoTopologyClosedError);e.collection(t).listIndexes(s).toArray((e,t)=>e?u(e):Array.isArray(t)?a?u(void 0,t):void u(void 0,function(e){const t={};for(let n=0;n<e.length;n++){const r=e[n];t[r.name]=[];for(const e in r.key)t[r.name].push([e,r.key[e]])}return t}(t)):u(void 0,[]))},t.prepareDocs=function(e,t,n){var r;return!0===("boolean"==typeof n.forceServerObjectId?n.forceServerObjectId:null===(r=e.s.db.options)||void 0===r?void 0:r.forceServerObjectId)?t:t.map(t=>(null==t._id&&(t._id=e.s.pkFactory.createPk()),t))}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.makeUpdateStatement=t.ReplaceOneOperation=t.UpdateManyOperation=t.UpdateOneOperation=t.UpdateOperation=void 0;const r=n(1),o=n(2),i=n(5),s=n(3);class u extends i.CommandOperation{constructor(e,t,n){super(void 0,n),this.options=n,this.ns=e,this.statements=t}get canRetryWrite(){return!1!==super.canRetryWrite&&this.statements.every(e=>null==e.multi||!1===e.multi)}execute(e,t,n){var i;const s=null!==(i=this.options)&&void 0!==i?i:{},u="boolean"!=typeof s.ordered||s.ordered,a={update:this.ns.collection,updates:this.statements,ordered:u};"boolean"==typeof s.bypassDocumentValidation&&(a.bypassDocumentValidation=s.bypassDocumentValidation),s.let&&(a.let=s.let),void 0!==s.comment&&(a.comment=s.comment);const c=this.statements.find(e=>!!e.collation);(0,o.collationNotSupported)(e,s)||c&&(0,o.collationNotSupported)(e,c)?n(new r.MongoCompatibilityError(`Server ${e.name} does not support collation`)):(this.writeConcern&&0===this.writeConcern.w||(0,o.maxWireVersion)(e)<5)&&this.statements.find(e=>e.hint)?n(new r.MongoCompatibilityError("Servers < 3.4 do not support hint on update")):this.explain&&(0,o.maxWireVersion)(e)<3?n(new r.MongoCompatibilityError(`Server ${e.name} does not support explain on update`)):this.statements.some(e=>!!e.arrayFilters)&&(0,o.maxWireVersion)(e)<6?n(new r.MongoCompatibilityError('Option "arrayFilters" is only supported on MongoDB 3.6+')):super.executeCommand(e,t,a,n)}}t.UpdateOperation=u;class a extends u{constructor(e,t,n,i){if(super(e.s.namespace,[d(t,n,{...i,multi:!1})],i),!(0,o.hasAtomicOperators)(n))throw new r.MongoInvalidArgumentError("Update document requires atomic operators")}execute(e,t,n){super.execute(e,t,(e,t)=>{var o,i;return e||!t?n(e):null!=this.explain?n(void 0,t):t.code?n(new r.MongoServerError(t)):t.writeErrors?n(new r.MongoServerError(t.writeErrors[0])):void n(void 0,{acknowledged:null===(i=0!==(null===(o=this.writeConcern)||void 0===o?void 0:o.w))||void 0===i||i,modifiedCount:null!=t.nModified?t.nModified:t.n,upsertedId:Array.isArray(t.upserted)&&t.upserted.length>0?t.upserted[0]._id:null,upsertedCount:Array.isArray(t.upserted)&&t.upserted.length?t.upserted.length:0,matchedCount:Array.isArray(t.upserted)&&t.upserted.length>0?0:t.n})})}}t.UpdateOneOperation=a;class c extends u{constructor(e,t,n,i){if(super(e.s.namespace,[d(t,n,{...i,multi:!0})],i),!(0,o.hasAtomicOperators)(n))throw new r.MongoInvalidArgumentError("Update document requires atomic operators")}execute(e,t,n){super.execute(e,t,(e,t)=>{var o,i;return e||!t?n(e):null!=this.explain?n(void 0,t):t.code?n(new r.MongoServerError(t)):t.writeErrors?n(new r.MongoServerError(t.writeErrors[0])):void n(void 0,{acknowledged:null===(i=0!==(null===(o=this.writeConcern)||void 0===o?void 0:o.w))||void 0===i||i,modifiedCount:null!=t.nModified?t.nModified:t.n,upsertedId:Array.isArray(t.upserted)&&t.upserted.length>0?t.upserted[0]._id:null,upsertedCount:Array.isArray(t.upserted)&&t.upserted.length?t.upserted.length:0,matchedCount:Array.isArray(t.upserted)&&t.upserted.length>0?0:t.n})})}}t.UpdateManyOperation=c;class l extends u{constructor(e,t,n,i){if(super(e.s.namespace,[d(t,n,{...i,multi:!1})],i),(0,o.hasAtomicOperators)(n))throw new r.MongoInvalidArgumentError("Replacement document must not contain atomic operators")}execute(e,t,n){super.execute(e,t,(e,t)=>{var o,i;return e||!t?n(e):null!=this.explain?n(void 0,t):t.code?n(new r.MongoServerError(t)):t.writeErrors?n(new r.MongoServerError(t.writeErrors[0])):void n(void 0,{acknowledged:null===(i=0!==(null===(o=this.writeConcern)||void 0===o?void 0:o.w))||void 0===i||i,modifiedCount:null!=t.nModified?t.nModified:t.n,upsertedId:Array.isArray(t.upserted)&&t.upserted.length>0?t.upserted[0]._id:null,upsertedCount:Array.isArray(t.upserted)&&t.upserted.length?t.upserted.length:0,matchedCount:Array.isArray(t.upserted)&&t.upserted.length>0?0:t.n})})}}function d(e,t,n){if(null==e||"object"!=typeof e)throw new r.MongoInvalidArgumentError("Selector must be a valid JavaScript object");if(null==t||"object"!=typeof t)throw new r.MongoInvalidArgumentError("Document must be a valid JavaScript object");const o={q:e,u:t};return"boolean"==typeof n.upsert&&(o.upsert=n.upsert),n.multi&&(o.multi=n.multi),n.hint&&(o.hint=n.hint),n.arrayFilters&&(o.arrayFilters=n.arrayFilters),n.collation&&(o.collation=n.collation),o}t.ReplaceOneOperation=l,t.makeUpdateStatement=d,(0,s.defineAspects)(u,[s.Aspect.RETRYABLE,s.Aspect.WRITE_OPERATION,s.Aspect.SKIP_COLLATION]),(0,s.defineAspects)(a,[s.Aspect.RETRYABLE,s.Aspect.WRITE_OPERATION,s.Aspect.EXPLAINABLE,s.Aspect.SKIP_COLLATION]),(0,s.defineAspects)(c,[s.Aspect.WRITE_OPERATION,s.Aspect.EXPLAINABLE,s.Aspect.SKIP_COLLATION]),(0,s.defineAspects)(l,[s.Aspect.RETRYABLE,s.Aspect.WRITE_OPERATION,s.Aspect.SKIP_COLLATION])},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ConnectionPoolMetrics=void 0;class r{constructor(){this.txnConnections=0,this.cursorConnections=0,this.otherConnections=0}markPinned(e){e===r.TXN?this.txnConnections+=1:e===r.CURSOR?this.cursorConnections+=1:this.otherConnections+=1}markUnpinned(e){e===r.TXN?this.txnConnections-=1:e===r.CURSOR?this.cursorConnections-=1:this.otherConnections-=1}info(e){return"Timed out while checking out a connection from connection pool: "+`maxPoolSize: ${e}, `+`connections in use by cursors: ${this.cursorConnections}, `+`connections in use by transactions: ${this.txnConnections}, `+`connections in use by other operations: ${this.otherConnections}`}reset(){this.txnConnections=0,this.cursorConnections=0,this.otherConnections=0}}t.ConnectionPoolMetrics=r,r.TXN="txn",r.CURSOR="cursor",r.OTHER="other"},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isSharded=t.applyCommonQueryOptions=t.getReadPreference=void 0;const r=n(1),o=n(6),i=n(12),s=n(168);t.getReadPreference=function(e,t){let n=e.readPreference||o.ReadPreference.primary;if((null==t?void 0:t.readPreference)&&(n=t.readPreference),"string"==typeof n&&(n=o.ReadPreference.fromString(n)),!(n instanceof o.ReadPreference))throw new r.MongoInvalidArgumentError('Option "readPreference" must be a ReadPreference instance');return n},t.applyCommonQueryOptions=function(e,t){return Object.assign(e,{raw:"boolean"==typeof t.raw&&t.raw,promoteLongs:"boolean"!=typeof t.promoteLongs||t.promoteLongs,promoteValues:"boolean"!=typeof t.promoteValues||t.promoteValues,promoteBuffers:"boolean"==typeof t.promoteBuffers&&t.promoteBuffers,bsonRegExp:"boolean"==typeof t.bsonRegExp&&t.bsonRegExp,enableUtf8Validation:"boolean"!=typeof t.enableUtf8Validation||t.enableUtf8Validation}),t.session&&(e.session=t.session),e},t.isSharded=function(e){if(null==e)return!1;if(e.description&&e.description.type===i.ServerType.Mongos)return!0;if(e.description&&e.description instanceof s.TopologyDescription){return Array.from(e.description.servers.values()).some(e=>e.type===i.ServerType.Mongos)}return!1}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TopologyDescription=void 0;const r=n(42),o=n(1),i=n(2),s=n(12),u=n(62),a=r.MIN_SUPPORTED_SERVER_VERSION,c=r.MAX_SUPPORTED_SERVER_VERSION,l=r.MIN_SUPPORTED_WIRE_VERSION,d=r.MAX_SUPPORTED_WIRE_VERSION,f=new Set([s.ServerType.Mongos,s.ServerType.Unknown]),p=new Set([s.ServerType.Mongos,s.ServerType.Standalone]),h=new Set([s.ServerType.RSSecondary,s.ServerType.RSArbiter,s.ServerType.RSOther]);class m{constructor(e,t,n,r,o,i,u){var f,p;u=null!=u?u:{},this.type=null!=e?e:s.TopologyType.Unknown,this.servers=null!=t?t:new Map,this.stale=!1,this.compatible=!0,this.heartbeatFrequencyMS=null!==(f=u.heartbeatFrequencyMS)&&void 0!==f?f:0,this.localThresholdMS=null!==(p=u.localThresholdMS)&&void 0!==p?p:15,n&&(this.setName=n),r&&(this.maxSetVersion=r),o&&(this.maxElectionId=o),i&&(this.commonWireVersion=i);for(const e of this.servers.values())if(e.type!==s.ServerType.Unknown&&e.type!==s.ServerType.LoadBalancer&&(e.minWireVersion>d&&(this.compatible=!1,this.compatibilityError=`Server at ${e.address} requires wire version ${e.minWireVersion}, but this version of the driver only supports up to ${d} (MongoDB ${c})`),e.maxWireVersion<l)){this.compatible=!1,this.compatibilityError=`Server at ${e.address} reports wire version ${e.maxWireVersion}, but this version of the driver requires at least ${l} (MongoDB ${a}).`;break}this.logicalSessionTimeoutMinutes=void 0;for(const[,e]of this.servers)if(e.isReadable){if(null==e.logicalSessionTimeoutMinutes){this.logicalSessionTimeoutMinutes=void 0;break}if(null==this.logicalSessionTimeoutMinutes){this.logicalSessionTimeoutMinutes=e.logicalSessionTimeoutMinutes;continue}this.logicalSessionTimeoutMinutes=Math.min(this.logicalSessionTimeoutMinutes,e.logicalSessionTimeoutMinutes)}}updateFromSrvPollingEvent(e,t=0){const n=e.hostnames(),r=new Set(this.servers.keys()),o=new Set(n),s=new Set;for(const e of r)o.delete(e),n.has(e)||s.add(e);if(0===o.size&&0===s.size)return this;const a=new Map(this.servers);for(const e of s)a.delete(e);if(o.size>0)if(0===t)for(const e of o)a.set(e,new u.ServerDescription(e));else if(a.size<t){const e=(0,i.shuffle)(o,t-a.size);for(const t of e)a.set(t,new u.ServerDescription(t))}return new m(this.type,a,this.setName,this.maxSetVersion,this.maxElectionId,this.commonWireVersion,{heartbeatFrequencyMS:this.heartbeatFrequencyMS,localThresholdMS:this.localThresholdMS})}update(e){const t=e.address;let{type:n,setName:r,maxSetVersion:i,maxElectionId:a,commonWireVersion:c}=this;e.setName&&r&&e.setName!==r&&(e=new u.ServerDescription(t,void 0));const l=e.type,d=new Map(this.servers);if(0!==e.maxWireVersion&&(c=null==c?e.maxWireVersion:Math.min(c,e.maxWireVersion)),d.set(t,e),n===s.TopologyType.Single)return new m(s.TopologyType.Single,d,r,i,a,c,{heartbeatFrequencyMS:this.heartbeatFrequencyMS,localThresholdMS:this.localThresholdMS});if(n===s.TopologyType.Unknown&&(l===s.ServerType.Standalone&&1!==this.servers.size?d.delete(t):n=function(e){switch(e){case s.ServerType.Standalone:return s.TopologyType.Single;case s.ServerType.Mongos:return s.TopologyType.Sharded;case s.ServerType.RSPrimary:return s.TopologyType.ReplicaSetWithPrimary;case s.ServerType.RSOther:case s.ServerType.RSSecondary:return s.TopologyType.ReplicaSetNoPrimary;default:return s.TopologyType.Unknown}}(l)),n===s.TopologyType.Sharded&&(f.has(l)||d.delete(t)),n===s.TopologyType.ReplicaSetNoPrimary)if(p.has(l)&&d.delete(t),l===s.ServerType.RSPrimary){const t=g(d,e,r,i,a);n=t[0],r=t[1],i=t[2],a=t[3]}else if(h.has(l)){const t=function(e,t,n){const r=s.TopologyType.ReplicaSetNoPrimary;if((n=n||t.setName)!==t.setName)return e.delete(t.address),[r,n];t.allHosts.forEach(t=>{e.has(t)||e.set(t,new u.ServerDescription(t))}),t.me&&t.address!==t.me&&e.delete(t.address);return[r,n]}(d,e,r);n=t[0],r=t[1]}if(n===s.TopologyType.ReplicaSetWithPrimary)if(p.has(l))d.delete(t),n=E(d);else if(l===s.ServerType.RSPrimary){const t=g(d,e,r,i,a);n=t[0],r=t[1],i=t[2],a=t[3]}else n=h.has(l)?function(e,t,n){if(null==n)throw new o.MongoRuntimeError('Argument "setName" is required if connected to a replica set');(n!==t.setName||t.me&&t.address!==t.me)&&e.delete(t.address);return E(e)}(d,e,r):E(d);return new m(n,d,r,i,a,c,{heartbeatFrequencyMS:this.heartbeatFrequencyMS,localThresholdMS:this.localThresholdMS})}get error(){const e=Array.from(this.servers.values()).filter(e=>e.error);if(e.length>0)return e[0].error}get hasKnownServers(){return Array.from(this.servers.values()).some(e=>e.type!==s.ServerType.Unknown)}get hasDataBearingServers(){return Array.from(this.servers.values()).some(e=>e.isDataBearing)}hasServer(e){return this.servers.has(e)}}function g(e,t,n,r,o){if((n=n||t.setName)!==t.setName)return e.delete(t.address),[E(e),n,r,o];const i=t.electionId?t.electionId:null;if(t.setVersion&&i){if(r&&o&&(r>t.setVersion||function(e,t){if(null==e)return-1;if(null==t)return 1;if(e.id instanceof Buffer&&t.id instanceof Buffer){const n=e.id,r=t.id;return n.compare(r)}const n=e.toString(),r=t.toString();return n.localeCompare(r)}(o,i)>0))return e.set(t.address,new u.ServerDescription(t.address)),[E(e),n,r,o];o=t.electionId}null!=t.setVersion&&(null==r||t.setVersion>r)&&(r=t.setVersion);for(const[n,r]of e)if(r.type===s.ServerType.RSPrimary&&r.address!==t.address){e.set(n,new u.ServerDescription(r.address));break}t.allHosts.forEach(t=>{e.has(t)||e.set(t,new u.ServerDescription(t))});const a=Array.from(e.keys()),c=t.allHosts;return a.filter(e=>-1===c.indexOf(e)).forEach(t=>{e.delete(t)}),[E(e),n,r,o]}function E(e){for(const t of e.values())if(t.type===s.ServerType.RSPrimary)return s.TopologyType.ReplicaSetWithPrimary;return s.TopologyType.ReplicaSetNoPrimary}t.TopologyDescription=m},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isTransactionCommand=t.Transaction=t.TxnState=void 0;const r=n(1),o=n(11),i=n(6),s=n(13);t.TxnState=Object.freeze({NO_TRANSACTION:"NO_TRANSACTION",STARTING_TRANSACTION:"STARTING_TRANSACTION",TRANSACTION_IN_PROGRESS:"TRANSACTION_IN_PROGRESS",TRANSACTION_COMMITTED:"TRANSACTION_COMMITTED",TRANSACTION_COMMITTED_EMPTY:"TRANSACTION_COMMITTED_EMPTY",TRANSACTION_ABORTED:"TRANSACTION_ABORTED"});const u={[t.TxnState.NO_TRANSACTION]:[t.TxnState.NO_TRANSACTION,t.TxnState.STARTING_TRANSACTION],[t.TxnState.STARTING_TRANSACTION]:[t.TxnState.TRANSACTION_IN_PROGRESS,t.TxnState.TRANSACTION_COMMITTED,t.TxnState.TRANSACTION_COMMITTED_EMPTY,t.TxnState.TRANSACTION_ABORTED],[t.TxnState.TRANSACTION_IN_PROGRESS]:[t.TxnState.TRANSACTION_IN_PROGRESS,t.TxnState.TRANSACTION_COMMITTED,t.TxnState.TRANSACTION_ABORTED],[t.TxnState.TRANSACTION_COMMITTED]:[t.TxnState.TRANSACTION_COMMITTED,t.TxnState.TRANSACTION_COMMITTED_EMPTY,t.TxnState.STARTING_TRANSACTION,t.TxnState.NO_TRANSACTION],[t.TxnState.TRANSACTION_ABORTED]:[t.TxnState.STARTING_TRANSACTION,t.TxnState.NO_TRANSACTION],[t.TxnState.TRANSACTION_COMMITTED_EMPTY]:[t.TxnState.TRANSACTION_COMMITTED_EMPTY,t.TxnState.NO_TRANSACTION]},a=new Set([t.TxnState.STARTING_TRANSACTION,t.TxnState.TRANSACTION_IN_PROGRESS]),c=new Set([t.TxnState.TRANSACTION_COMMITTED,t.TxnState.TRANSACTION_COMMITTED_EMPTY,t.TxnState.TRANSACTION_ABORTED]);t.Transaction=class{constructor(e){e=null!=e?e:{},this.state=t.TxnState.NO_TRANSACTION,this.options={};const n=s.WriteConcern.fromOptions(e);if(n){if(0===n.w)throw new r.MongoTransactionError("Transactions do not support unacknowledged write concern");this.options.writeConcern=n}e.readConcern&&(this.options.readConcern=o.ReadConcern.fromOptions(e)),e.readPreference&&(this.options.readPreference=i.ReadPreference.fromOptions(e)),e.maxCommitTimeMS&&(this.options.maxTimeMS=e.maxCommitTimeMS),this._pinnedServer=void 0,this._recoveryToken=void 0}get server(){return this._pinnedServer}get recoveryToken(){return this._recoveryToken}get isPinned(){return!!this.server}get isStarting(){return this.state===t.TxnState.STARTING_TRANSACTION}get isActive(){return a.has(this.state)}get isCommitted(){return c.has(this.state)}transition(e){const n=u[this.state];if(n&&n.includes(e))return this.state=e,void(this.state!==t.TxnState.NO_TRANSACTION&&this.state!==t.TxnState.STARTING_TRANSACTION&&this.state!==t.TxnState.TRANSACTION_ABORTED||this.unpinServer());throw new r.MongoRuntimeError(`Attempted illegal state transition from [${this.state}] to [${e}]`)}pinServer(e){this.isActive&&(this._pinnedServer=e)}unpinServer(){this._pinnedServer=void 0}},t.isTransactionCommand=function(e){return!(!e.commitTransaction&&!e.abortTransaction)}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DropDatabaseOperation=t.DropCollectionOperation=void 0;const r=n(1),o=n(5),i=n(3);class s extends o.CommandOperation{constructor(e,t,n={}){super(e,n),this.db=e,this.options=n,this.name=t}execute(e,t,n){(async()=>{var n,o,i,u;const a=this.db,c=this.options,l=this.name,d=null===(n=a.s.client.options.autoEncryption)||void 0===n?void 0:n.encryptedFieldsMap;let f=null!==(o=c.encryptedFields)&&void 0!==o?o:null==d?void 0:d[`${a.databaseName}.${l}`];if(!f&&d){const e=await a.listCollections({name:l},{nameOnly:!1}).toArray();f=null===(u=null===(i=null==e?void 0:e[0])||void 0===i?void 0:i.options)||void 0===u?void 0:u.encryptedFields}if(f){const n=f.escCollection||`enxcol_.${l}.esc`,o=f.eccCollection||`enxcol_.${l}.ecc`,i=f.ecocCollection||`enxcol_.${l}.ecoc`;for(const u of[n,o,i]){const n=new s(a,u);try{await n.executeWithoutEncryptedFieldsCheck(e,t)}catch(e){if(!(e instanceof r.MongoServerError)||e.code!==r.MONGODB_ERROR_CODES.NamespaceNotFound)throw e}}}return await this.executeWithoutEncryptedFieldsCheck(e,t)})().then(e=>n(void 0,e),e=>n(e))}executeWithoutEncryptedFieldsCheck(e,t){return new Promise((n,r)=>{super.executeCommand(e,t,{drop:this.name},(e,t)=>{if(e)return r(e);n(!!t.ok)})})}}t.DropCollectionOperation=s;class u extends o.CommandOperation{constructor(e,t){super(e,t),this.options=t}execute(e,t,n){super.executeCommand(e,t,{dropDatabase:1},(e,t)=>e?n(e):t.ok?n(void 0,!0):void n(void 0,!1))}}t.DropDatabaseOperation=u,(0,i.defineAspects)(s,[i.Aspect.WRITE_OPERATION]),(0,i.defineAspects)(u,[i.Aspect.WRITE_OPERATION])},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ListCollectionsCursor=t.ListCollectionsOperation=void 0;const r=n(22),o=n(2),i=n(5),s=n(14),u=n(3);class a extends i.CommandOperation{constructor(e,t,n){super(e,n),this.options=null!=n?n:{},this.db=e,this.filter=t,this.nameOnly=!!this.options.nameOnly,this.authorizedCollections=!!this.options.authorizedCollections,"number"==typeof this.options.batchSize&&(this.batchSize=this.options.batchSize)}execute(e,t,n){return super.executeCommand(e,t,this.generateCommand((0,o.maxWireVersion)(e)),n)}generateCommand(e){const t={listCollections:1,filter:this.filter,cursor:this.batchSize?{batchSize:this.batchSize}:{},nameOnly:this.nameOnly,authorizedCollections:this.authorizedCollections};return e>=9&&void 0!==this.options.comment&&(t.comment=this.options.comment),t}}t.ListCollectionsOperation=a;class c extends r.AbstractCursor{constructor(e,t,n){super(e.s.client,e.s.namespace,n),this.parent=e,this.filter=t,this.options=n}clone(){return new c(this.parent,this.filter,{...this.options,...this.cursorOptions})}_initialize(e,t){const n=new a(this.parent,this.filter,{...this.cursorOptions,...this.options,session:e});(0,s.executeOperation)(this.parent.s.client,n,(r,o)=>{if(r||null==o)return t(r);t(void 0,{server:n.server,session:e,response:o})})}}t.ListCollectionsCursor=c,(0,u.defineAspects)(a,[u.Aspect.READ_OPERATION,u.Aspect.RETRYABLE,u.Aspect.CURSOR_CREATING])},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.RenameOperation=void 0;const r=n(34),o=n(1),i=n(2),s=n(3),u=n(60);class a extends u.RunAdminCommandOperation{constructor(e,t,n){(0,i.checkCollectionName)(t);const r=e.namespace,o=e.s.namespace.withCollection(t).toString();super(e,{renameCollection:r,to:o,dropTarget:"boolean"==typeof n.dropTarget&&n.dropTarget},n),this.options=n,this.collection=e,this.newName=t}execute(e,t,n){const i=this.collection;super.execute(e,t,(e,t)=>{if(e)return n(e);if(null==t?void 0:t.errmsg)return n(new o.MongoServerError(t));let s;try{s=new r.Collection(i.s.db,this.newName,i.s.options)}catch(e){return n(e)}return n(void 0,s)})}}t.RenameOperation=a,(0,s.defineAspects)(a,[s.Aspect.WRITE_OPERATION])},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SetProfilingLevelOperation=t.ProfilingLevel=void 0;const r=n(1),o=n(2),i=n(5),s=new Set(["off","slow_only","all"]);t.ProfilingLevel=Object.freeze({off:"off",slowOnly:"slow_only",all:"all"});class u extends i.CommandOperation{constructor(e,n,r){switch(super(e,r),this.options=r,n){case t.ProfilingLevel.off:this.profile=0;break;case t.ProfilingLevel.slowOnly:this.profile=1;break;case t.ProfilingLevel.all:this.profile=2;break;default:this.profile=0}this.level=n}execute(e,n,i){const u=this.level;if(!s.has(u))return i(new r.MongoInvalidArgumentError(`Profiling level must be one of "${(0,o.enumToString)(t.ProfilingLevel)}"`));super.executeCommand(e,n,{profile:this.profile},(e,t)=>null==e&&1===t.ok?i(void 0,u):i(null!=e?e:new r.MongoRuntimeError("Error with profile command")))}}t.SetProfilingLevelOperation=u},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DbStatsOperation=t.CollStatsOperation=void 0;const r=n(5),o=n(3);class i extends r.CommandOperation{constructor(e,t){super(e,t),this.options=null!=t?t:{},this.collectionName=e.collectionName}execute(e,t,n){const r={collStats:this.collectionName};null!=this.options.scale&&(r.scale=this.options.scale),super.executeCommand(e,t,r,n)}}t.CollStatsOperation=i;class s extends r.CommandOperation{constructor(e,t){super(e,t),this.options=t}execute(e,t,n){const r={dbStats:!0};null!=this.options.scale&&(r.scale=this.options.scale),super.executeCommand(e,t,r,n)}}t.DbStatsOperation=s,(0,o.defineAspects)(i,[o.Aspect.READ_OPERATION]),(0,o.defineAspects)(s,[o.Aspect.READ_OPERATION])},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CommaAndColonSeparatedRecord=t.ConnectionString=t.redactConnectionString=void 0;const r=n(381),o=n(392);Object.defineProperty(t,"redactConnectionString",{enumerable:!0,get:function(){return o.redactConnectionString}});const i="__this_is_a_placeholder__";const s=/^(?<protocol>[^/]+):\/\/(?:(?<username>[^:]*)(?::(?<password>[^@]*))?@)?(?<hosts>(?!:)[^/?@]*)(?<rest>.*)/;class u extends Map{delete(e){return super.delete(this._normalizeKey(e))}get(e){return super.get(this._normalizeKey(e))}has(e){return super.has(this._normalizeKey(e))}set(e,t){return super.set(this._normalizeKey(e),t)}_normalizeKey(e){e=`${e}`;for(const t of this.keys())if(t.toLowerCase()===e.toLowerCase()){e=t;break}return e}}class a extends r.URL{}class c extends Error{get name(){return"MongoParseError"}}class l extends a{constructor(e,t={}){var n;const{looseValidation:r}=t;if(!r&&(!(o=e).startsWith("mongodb://")&&!o.startsWith("mongodb+srv://")))throw new c('Invalid scheme, expected connection string to start with "mongodb://" or "mongodb+srv://"');var o;const a=e.match(s);if(!a)throw new c(`Invalid connection string "${e}"`);const{protocol:d,username:f,password:p,hosts:h,rest:m}=null!==(n=a.groups)&&void 0!==n?n:{};if(!r){if(!d||!h)throw new c(`Protocol and host list are required in "${e}"`);try{decodeURIComponent(null!=f?f:""),decodeURIComponent(null!=p?p:"")}catch(e){throw new c(e.message)}const t=/[:/?#[\]@]/gi;if(null==f?void 0:f.match(t))throw new c(`Username contains unescaped characters ${f}`);if(!f||!p){const t=e.replace(`${d}://`,"");if(t.startsWith("@")||t.startsWith(":"))throw new c("URI contained empty userinfo section")}if(null==p?void 0:p.match(t))throw new c("Password contains unescaped characters")}let g="";"string"==typeof f&&(g+=f),"string"==typeof p&&(g+=`:${p}`),g&&(g+="@");try{super(`${d.toLowerCase()}://${g}${i}${m}`)}catch(n){throw r&&new l(e,{...t,looseValidation:!1}),"string"==typeof n.message&&(n.message=n.message.replace(i,h)),n}if(this._hosts=h.split(","),!r){if(this.isSRV&&1!==this.hosts.length)throw new c("mongodb+srv URI cannot have multiple service names");if(this.isSRV&&this.hosts.some(e=>e.includes(":")))throw new c("mongodb+srv URI cannot have port number")}var E;this.pathname||(this.pathname="/"),Object.setPrototypeOf(this.searchParams,(E=this.searchParams.constructor,class extends E{append(e,t){return super.append(this._normalizeKey(e),t)}delete(e){return super.delete(this._normalizeKey(e))}get(e){return super.get(this._normalizeKey(e))}getAll(e){return super.getAll(this._normalizeKey(e))}has(e){return super.has(this._normalizeKey(e))}set(e,t){return super.set(this._normalizeKey(e),t)}keys(){return super.keys()}values(){return super.values()}entries(){return super.entries()}[Symbol.iterator](){return super[Symbol.iterator]()}_normalizeKey(e){return u.prototype._normalizeKey.call(this,e)}}).prototype)}get host(){return i}set host(e){throw new Error("No single host for connection string")}get hostname(){return i}set hostname(e){throw new Error("No single host for connection string")}get port(){return""}set port(e){throw new Error("No single host for connection string")}get href(){return this.toString()}set href(e){throw new Error("Cannot set href for connection strings")}get isSRV(){return this.protocol.includes("srv")}get hosts(){return this._hosts}set hosts(e){this._hosts=e}toString(){return super.toString().replace(i,this.hosts.join(","))}clone(){return new l(this.toString(),{looseValidation:!0})}redact(e){return(0,o.redactValidConnectionString)(this,e)}typedSearchParams(){return this.searchParams}[Symbol.for("nodejs.util.inspect.custom")](){const{href:e,origin:t,protocol:n,username:r,password:o,hosts:i,pathname:s,search:u,searchParams:a,hash:c}=this;return{href:e,origin:t,protocol:n,username:r,password:o,hosts:i,pathname:s,search:u,searchParams:a,hash:c}}}t.ConnectionString=l;t.CommaAndColonSeparatedRecord=class extends u{constructor(e){super();for(const t of(null!=e?e:"").split(",")){if(!t)continue;const e=t.indexOf(":");-1===e?this.set(t,""):this.set(t.slice(0,e),t.slice(e+1))}}toString(){return[...this].map(e=>e.join(":")).join(",")}},t.default=l},function(e,t,n){"use strict";const r=n(385),o=n(177),{utf8DecodeWithoutBOM:i}=n(107),{percentDecodeString:s,utf8PercentEncodeCodePoint:u,utf8PercentEncodeString:a,isC0ControlPercentEncode:c,isFragmentPercentEncode:l,isQueryPercentEncode:d,isSpecialQueryPercentEncode:f,isPathPercentEncode:p,isUserinfoPercentEncode:h}=n(108);function m(e){return e.codePointAt(0)}const g={ftp:21,file:null,http:80,https:443,ws:80,wss:443},E=Symbol("failure");function y(e){return[...e].length}function v(e,t){const n=e[t];return isNaN(n)?void 0:String.fromCodePoint(n)}function A(e){return"."===e||"%2e"===e.toLowerCase()}function b(e){return 2===e.length&&o.isASCIIAlpha(e.codePointAt(0))&&(":"===e[1]||"|"===e[1])}function C(e){return void 0!==g[e]}function S(e){return C(e.scheme)}function O(e){return!C(e.scheme)}function _(e){return g[e]}function w(e){if(""===e)return E;let t=10;if(e.length>=2&&"0"===e.charAt(0)&&"x"===e.charAt(1).toLowerCase()?(e=e.substring(2),t=16):e.length>=2&&"0"===e.charAt(0)&&(e=e.substring(1),t=8),""===e)return 0;let n=/[^0-7]/u;return 10===t&&(n=/[^0-9]/u),16===t&&(n=/[^0-9A-Fa-f]/u),n.test(e)?E:parseInt(e,t)}function D(e,t=!1){if("["===e[0])return"]"!==e[e.length-1]?E:function(e){const t=[0,0,0,0,0,0,0,0];let n=0,r=null,i=0;if((e=Array.from(e,e=>e.codePointAt(0)))[i]===m(":")){if(e[i+1]!==m(":"))return E;i+=2,++n,r=n}for(;i<e.length;){if(8===n)return E;if(e[i]===m(":")){if(null!==r)return E;++i,++n,r=n;continue}let s=0,u=0;for(;u<4&&o.isASCIIHex(e[i]);)s=16*s+parseInt(v(e,i),16),++i,++u;if(e[i]===m(".")){if(0===u)return E;if(i-=u,n>6)return E;let r=0;for(;void 0!==e[i];){let s=null;if(r>0){if(!(e[i]===m(".")&&r<4))return E;++i}if(!o.isASCIIDigit(e[i]))return E;for(;o.isASCIIDigit(e[i]);){const t=parseInt(v(e,i));if(null===s)s=t;else{if(0===s)return E;s=10*s+t}if(s>255)return E;++i}t[n]=256*t[n]+s,++r,2!==r&&4!==r||++n}if(4!==r)return E;break}if(e[i]===m(":")){if(++i,void 0===e[i])return E}else if(void 0!==e[i])return E;t[n]=s,++n}if(null!==r){let e=n-r;for(n=7;0!==n&&e>0;){const o=t[r+e-1];t[r+e-1]=t[n],t[n]=o,--n,--e}}else if(null===r&&8!==n)return E;return t}(e.substring(1,e.length-1));if(t)return function(e){if(t=e,-1!==t.search(/\u0000|\u0009|\u000A|\u000D|\u0020|#|\/|:|<|>|\?|@|\[|\\|\]|\^|\|/u))return E;var t;return a(e,c)}(e);const n=function(e,t=!1){const n=r.toASCII(e,{checkBidi:!0,checkHyphens:!1,checkJoiners:!0,useSTD3ASCIIRules:t,verifyDNSLength:t});if(null===n||""===n)return E;return n}(i(s(e)));return n===E?E:-1!==n.search(/\u0000|\u0009|\u000A|\u000D|\u0020|#|%|\/|:|<|>|\?|@|\[|\\|\]|\^|\|/u)?E:function(e){const t=e.split(".");if(""===t[t.length-1]){if(1===t.length)return!1;t.pop()}const n=t[t.length-1];if(w(n)!==E)return!0;if(/^[0-9]+$/u.test(n))return!0;return!1}(n)?function(e){const t=e.split(".");if(""===t[t.length-1]&&t.length>1&&t.pop(),t.length>4)return E;const n=[];for(const e of t){const t=w(e);if(t===E)return E;n.push(t)}for(let e=0;e<n.length-1;++e)if(n[e]>255)return E;if(n[n.length-1]>=256**(5-n.length))return E;let r=n.pop(),o=0;for(const e of n)r+=e*256**(3-o),++o;return r}(n):n}function B(e){return"number"==typeof e?function(e){let t="",n=e;for(let e=1;e<=4;++e)t=String(n%256)+t,4!==e&&(t=`.${t}`),n=Math.floor(n/256);return t}(e):e instanceof Array?`[${function(e){let t="";const n=function(e){let t=null,n=1,r=null,o=0;for(let i=0;i<e.length;++i)0!==e[i]?(o>n&&(t=r,n=o),r=null,o=0):(null===r&&(r=i),++o);if(o>n)return r;return t}(e);let r=!1;for(let o=0;o<=7;++o)if(!r||0!==e[o])if(r&&(r=!1),n!==o)t+=e[o].toString(16),7!==o&&(t+=":");else{t+=0===o?"::":":",r=!0}return t}(e)}]`:e}function T(e){const{path:t}=e;var n;0!==t.length&&("file"===e.scheme&&1===t.length&&(n=t[0],/^[A-Za-z]:$/u.test(n))||t.pop())}function F(e){return""!==e.username||""!==e.password}function N(e){return"string"==typeof e.path}function R(e,t,n,r,o){if(this.pointer=0,this.input=e,this.base=t||null,this.encodingOverride=n||"utf-8",this.stateOverride=o,this.url=r,this.failure=!1,this.parseError=!1,!this.url){this.url={scheme:"",username:"",password:"",host:null,port:null,path:[],query:null,fragment:null};const e=function(e){return e.replace(/^[\u0000-\u001F\u0020]+|[\u0000-\u001F\u0020]+$/gu,"")}(this.input);e!==this.input&&(this.parseError=!0),this.input=e}const i=function(e){return e.replace(/\u0009|\u000A|\u000D/gu,"")}(this.input);for(i!==this.input&&(this.parseError=!0),this.input=i,this.state=o||"scheme start",this.buffer="",this.atFlag=!1,this.arrFlag=!1,this.passwordTokenSeenFlag=!1,this.input=Array.from(this.input,e=>e.codePointAt(0));this.pointer<=this.input.length;++this.pointer){const e=this.input[this.pointer],t=isNaN(e)?void 0:String.fromCodePoint(e),n=this[`parse ${this.state}`](e,t);if(!n)break;if(n===E){this.failure=!0;break}}}R.prototype["parse scheme start"]=function(e,t){if(o.isASCIIAlpha(e))this.buffer+=t.toLowerCase(),this.state="scheme";else{if(this.stateOverride)return this.parseError=!0,E;this.state="no scheme",--this.pointer}return!0},R.prototype["parse scheme"]=function(e,t){if(o.isASCIIAlphanumeric(e)||e===m("+")||e===m("-")||e===m("."))this.buffer+=t.toLowerCase();else if(e===m(":")){if(this.stateOverride){if(S(this.url)&&!C(this.buffer))return!1;if(!S(this.url)&&C(this.buffer))return!1;if((F(this.url)||null!==this.url.port)&&"file"===this.buffer)return!1;if("file"===this.url.scheme&&""===this.url.host)return!1}if(this.url.scheme=this.buffer,this.stateOverride)return this.url.port===_(this.url.scheme)&&(this.url.port=null),!1;this.buffer="","file"===this.url.scheme?(this.input[this.pointer+1]===m("/")&&this.input[this.pointer+2]===m("/")||(this.parseError=!0),this.state="file"):S(this.url)&&null!==this.base&&this.base.scheme===this.url.scheme?this.state="special relative or authority":S(this.url)?this.state="special authority slashes":this.input[this.pointer+1]===m("/")?(this.state="path or authority",++this.pointer):(this.url.path="",this.state="opaque path")}else{if(this.stateOverride)return this.parseError=!0,E;this.buffer="",this.state="no scheme",this.pointer=-1}return!0},R.prototype["parse no scheme"]=function(e){return null===this.base||N(this.base)&&e!==m("#")?E:(N(this.base)&&e===m("#")?(this.url.scheme=this.base.scheme,this.url.path=this.base.path,this.url.query=this.base.query,this.url.fragment="",this.state="fragment"):"file"===this.base.scheme?(this.state="file",--this.pointer):(this.state="relative",--this.pointer),!0)},R.prototype["parse special relative or authority"]=function(e){return e===m("/")&&this.input[this.pointer+1]===m("/")?(this.state="special authority ignore slashes",++this.pointer):(this.parseError=!0,this.state="relative",--this.pointer),!0},R.prototype["parse path or authority"]=function(e){return e===m("/")?this.state="authority":(this.state="path",--this.pointer),!0},R.prototype["parse relative"]=function(e){return this.url.scheme=this.base.scheme,e===m("/")?this.state="relative slash":S(this.url)&&e===m("\\")?(this.parseError=!0,this.state="relative slash"):(this.url.username=this.base.username,this.url.password=this.base.password,this.url.host=this.base.host,this.url.port=this.base.port,this.url.path=this.base.path.slice(),this.url.query=this.base.query,e===m("?")?(this.url.query="",this.state="query"):e===m("#")?(this.url.fragment="",this.state="fragment"):isNaN(e)||(this.url.query=null,this.url.path.pop(),this.state="path",--this.pointer)),!0},R.prototype["parse relative slash"]=function(e){return!S(this.url)||e!==m("/")&&e!==m("\\")?e===m("/")?this.state="authority":(this.url.username=this.base.username,this.url.password=this.base.password,this.url.host=this.base.host,this.url.port=this.base.port,this.state="path",--this.pointer):(e===m("\\")&&(this.parseError=!0),this.state="special authority ignore slashes"),!0},R.prototype["parse special authority slashes"]=function(e){return e===m("/")&&this.input[this.pointer+1]===m("/")?(this.state="special authority ignore slashes",++this.pointer):(this.parseError=!0,this.state="special authority ignore slashes",--this.pointer),!0},R.prototype["parse special authority ignore slashes"]=function(e){return e!==m("/")&&e!==m("\\")?(this.state="authority",--this.pointer):this.parseError=!0,!0},R.prototype["parse authority"]=function(e,t){if(e===m("@")){this.parseError=!0,this.atFlag&&(this.buffer=`%40${this.buffer}`),this.atFlag=!0;const e=y(this.buffer);for(let t=0;t<e;++t){const e=this.buffer.codePointAt(t);if(e===m(":")&&!this.passwordTokenSeenFlag){this.passwordTokenSeenFlag=!0;continue}const n=u(e,h);this.passwordTokenSeenFlag?this.url.password+=n:this.url.username+=n}this.buffer=""}else if(isNaN(e)||e===m("/")||e===m("?")||e===m("#")||S(this.url)&&e===m("\\")){if(this.atFlag&&""===this.buffer)return this.parseError=!0,E;this.pointer-=y(this.buffer)+1,this.buffer="",this.state="host"}else this.buffer+=t;return!0},R.prototype["parse hostname"]=R.prototype["parse host"]=function(e,t){if(this.stateOverride&&"file"===this.url.scheme)--this.pointer,this.state="file host";else if(e!==m(":")||this.arrFlag)if(isNaN(e)||e===m("/")||e===m("?")||e===m("#")||S(this.url)&&e===m("\\")){if(--this.pointer,S(this.url)&&""===this.buffer)return this.parseError=!0,E;if(this.stateOverride&&""===this.buffer&&(F(this.url)||null!==this.url.port))return this.parseError=!0,!1;const e=D(this.buffer,O(this.url));if(e===E)return E;if(this.url.host=e,this.buffer="",this.state="path start",this.stateOverride)return!1}else e===m("[")?this.arrFlag=!0:e===m("]")&&(this.arrFlag=!1),this.buffer+=t;else{if(""===this.buffer)return this.parseError=!0,E;if("hostname"===this.stateOverride)return!1;const e=D(this.buffer,O(this.url));if(e===E)return E;this.url.host=e,this.buffer="",this.state="port"}return!0},R.prototype["parse port"]=function(e,t){if(o.isASCIIDigit(e))this.buffer+=t;else{if(!(isNaN(e)||e===m("/")||e===m("?")||e===m("#")||S(this.url)&&e===m("\\")||this.stateOverride))return this.parseError=!0,E;if(""!==this.buffer){const e=parseInt(this.buffer);if(e>65535)return this.parseError=!0,E;this.url.port=e===_(this.url.scheme)?null:e,this.buffer=""}if(this.stateOverride)return!1;this.state="path start",--this.pointer}return!0};const I=new Set([m("/"),m("\\"),m("?"),m("#")]);function x(e,t){const n=e.length-t;return n>=2&&(r=e[t],i=e[t+1],o.isASCIIAlpha(r)&&(i===m(":")||i===m("|")))&&(2===n||I.has(e[t+2]));var r,i}function M(e){if(N(e))return e.path;let t="";for(const n of e.path)t+=`/${n}`;return t}R.prototype["parse file"]=function(e){return this.url.scheme="file",this.url.host="",e===m("/")||e===m("\\")?(e===m("\\")&&(this.parseError=!0),this.state="file slash"):null!==this.base&&"file"===this.base.scheme?(this.url.host=this.base.host,this.url.path=this.base.path.slice(),this.url.query=this.base.query,e===m("?")?(this.url.query="",this.state="query"):e===m("#")?(this.url.fragment="",this.state="fragment"):isNaN(e)||(this.url.query=null,x(this.input,this.pointer)?(this.parseError=!0,this.url.path=[]):T(this.url),this.state="path",--this.pointer)):(this.state="path",--this.pointer),!0},R.prototype["parse file slash"]=function(e){var t;return e===m("/")||e===m("\\")?(e===m("\\")&&(this.parseError=!0),this.state="file host"):(null!==this.base&&"file"===this.base.scheme&&(!x(this.input,this.pointer)&&(2===(t=this.base.path[0]).length&&o.isASCIIAlpha(t.codePointAt(0))&&":"===t[1])&&this.url.path.push(this.base.path[0]),this.url.host=this.base.host),this.state="path",--this.pointer),!0},R.prototype["parse file host"]=function(e,t){if(isNaN(e)||e===m("/")||e===m("\\")||e===m("?")||e===m("#"))if(--this.pointer,!this.stateOverride&&b(this.buffer))this.parseError=!0,this.state="path";else if(""===this.buffer){if(this.url.host="",this.stateOverride)return!1;this.state="path start"}else{let e=D(this.buffer,O(this.url));if(e===E)return E;if("localhost"===e&&(e=""),this.url.host=e,this.stateOverride)return!1;this.buffer="",this.state="path start"}else this.buffer+=t;return!0},R.prototype["parse path start"]=function(e){return S(this.url)?(e===m("\\")&&(this.parseError=!0),this.state="path",e!==m("/")&&e!==m("\\")&&--this.pointer):this.stateOverride||e!==m("?")?this.stateOverride||e!==m("#")?void 0!==e?(this.state="path",e!==m("/")&&--this.pointer):this.stateOverride&&null===this.url.host&&this.url.path.push(""):(this.url.fragment="",this.state="fragment"):(this.url.query="",this.state="query"),!0},R.prototype["parse path"]=function(e){var t;return isNaN(e)||e===m("/")||S(this.url)&&e===m("\\")||!this.stateOverride&&(e===m("?")||e===m("#"))?(S(this.url)&&e===m("\\")&&(this.parseError=!0),".."===(t=(t=this.buffer).toLowerCase())||"%2e."===t||".%2e"===t||"%2e%2e"===t?(T(this.url),e===m("/")||S(this.url)&&e===m("\\")||this.url.path.push("")):!A(this.buffer)||e===m("/")||S(this.url)&&e===m("\\")?A(this.buffer)||("file"===this.url.scheme&&0===this.url.path.length&&b(this.buffer)&&(this.buffer=`${this.buffer[0]}:`),this.url.path.push(this.buffer)):this.url.path.push(""),this.buffer="",e===m("?")&&(this.url.query="",this.state="query"),e===m("#")&&(this.url.fragment="",this.state="fragment")):(e!==m("%")||o.isASCIIHex(this.input[this.pointer+1])&&o.isASCIIHex(this.input[this.pointer+2])||(this.parseError=!0),this.buffer+=u(e,p)),!0},R.prototype["parse opaque path"]=function(e){return e===m("?")?(this.url.query="",this.state="query"):e===m("#")?(this.url.fragment="",this.state="fragment"):(isNaN(e)||e===m("%")||(this.parseError=!0),e!==m("%")||o.isASCIIHex(this.input[this.pointer+1])&&o.isASCIIHex(this.input[this.pointer+2])||(this.parseError=!0),isNaN(e)||(this.url.path+=u(e,c))),!0},R.prototype["parse query"]=function(e,t){if(S(this.url)&&"ws"!==this.url.scheme&&"wss"!==this.url.scheme||(this.encodingOverride="utf-8"),!this.stateOverride&&e===m("#")||isNaN(e)){const t=S(this.url)?f:d;this.url.query+=a(this.buffer,t),this.buffer="",e===m("#")&&(this.url.fragment="",this.state="fragment")}else isNaN(e)||(e!==m("%")||o.isASCIIHex(this.input[this.pointer+1])&&o.isASCIIHex(this.input[this.pointer+2])||(this.parseError=!0),this.buffer+=t);return!0},R.prototype["parse fragment"]=function(e){return isNaN(e)||(e!==m("%")||o.isASCIIHex(this.input[this.pointer+1])&&o.isASCIIHex(this.input[this.pointer+2])||(this.parseError=!0),this.url.fragment+=u(e,l)),!0},e.exports.serializeURL=function(e,t){let n=`${e.scheme}:`;return null!==e.host&&(n+="//",""===e.username&&""===e.password||(n+=e.username,""!==e.password&&(n+=`:${e.password}`),n+="@"),n+=B(e.host),null!==e.port&&(n+=`:${e.port}`)),null===e.host&&!N(e)&&e.path.length>1&&""===e.path[0]&&(n+="/."),n+=M(e),null!==e.query&&(n+=`?${e.query}`),t||null===e.fragment||(n+=`#${e.fragment}`),n},e.exports.serializePath=M,e.exports.serializeURLOrigin=function(t){switch(t.scheme){case"blob":try{return e.exports.serializeURLOrigin(e.exports.parseURL(M(t)))}catch(e){return"null"}case"ftp":case"http":case"https":case"ws":case"wss":return function(e){let t=`${e.scheme}://`;return t+=B(e.host),null!==e.port&&(t+=`:${e.port}`),t}({scheme:t.scheme,host:t.host,port:t.port});case"file":default:return"null"}},e.exports.basicURLParse=function(e,t){void 0===t&&(t={});const n=new R(e,t.baseURL,t.encodingOverride,t.url,t.stateOverride);return n.failure?null:n.url},e.exports.setTheUsername=function(e,t){e.username=a(t,h)},e.exports.setThePassword=function(e,t){e.password=a(t,h)},e.exports.serializeHost=B,e.exports.cannotHaveAUsernamePasswordPort=function(e){return null===e.host||""===e.host||N(e)||"file"===e.scheme},e.exports.hasAnOpaquePath=N,e.exports.serializeInteger=function(e){return String(e)},e.exports.parseURL=function(t,n){return void 0===n&&(n={}),e.exports.basicURLParse(t,{baseURL:n.baseURL,encodingOverride:n.encodingOverride})}},function(e,t,n){"use strict";function r(e){return e>=48&&e<=57}function o(e){return e>=65&&e<=90||e>=97&&e<=122}e.exports={isASCIIDigit:r,isASCIIAlpha:o,isASCIIAlphanumeric:function(e){return o(e)||r(e)},isASCIIHex:function(e){return r(e)||e>=65&&e<=70||e>=97&&e<=102}}},function(e,t,n){"use strict";const{utf8Encode:r,utf8DecodeWithoutBOM:o}=n(107),{percentDecodeBytes:i,utf8PercentEncodeString:s,isURLEncodedPercentEncode:u}=n(108);function a(e){return e.codePointAt(0)}function c(e,t,n){let r=e.indexOf(t);for(;r>=0;)e[r]=n,r=e.indexOf(t,r+1);return e}e.exports={parseUrlencodedString:function(e){return function(e){const t=function(e,t){const n=[];let r=0,o=e.indexOf(t);for(;o>=0;)n.push(e.slice(r,o)),r=o+1,o=e.indexOf(t,r);r!==e.length&&n.push(e.slice(r));return n}(e,a("&")),n=[];for(const e of t){if(0===e.length)continue;let t,r;const s=e.indexOf(a("="));s>=0?(t=e.slice(0,s),r=e.slice(s+1)):(t=e,r=new Uint8Array(0)),t=c(t,43,32),r=c(r,43,32);const u=o(i(t)),l=o(i(r));n.push([u,l])}return n}(r(e))},serializeUrlencoded:function(e,t){let n="utf-8";void 0!==t&&(n=t);let r="";for(const[t,o]of e.entries()){const e=s(o[0],u,!0);let i=o[1];o.length>2&&void 0!==o[2]&&("hidden"===o[2]&&"_charset_"===e?i=n:"file"===o[2]&&(i=i.name)),i=s(i,u,!0),0!==t&&(r+="&"),r+=`${e}=${i}`}return r}}},function(e,t,n){"use strict";const r=n(105),o=n(106),i=n(390),s=o.newObjectInRealm,u=o.implSymbol,a=o.ctorRegistrySymbol;function c(e,t){let n;return void 0!==t&&(n=t.prototype),o.isObject(n)||(n=e[a].URLSearchParams.prototype),Object.create(n)}t.is=e=>o.isObject(e)&&o.hasOwn(e,u)&&e[u]instanceof d.implementation,t.isImpl=e=>o.isObject(e)&&e instanceof d.implementation,t.convert=(e,n,{context:r="The provided value"}={})=>{if(t.is(n))return o.implForWrapper(n);throw new e.TypeError(`${r} is not of type 'URLSearchParams'.`)},t.createDefaultIterator=(e,t,n)=>{const r=e[a]["URLSearchParams Iterator"],i=Object.create(r);return Object.defineProperty(i,o.iterInternalSymbol,{value:{target:t,kind:n,index:0},configurable:!0}),i},t.create=(e,n,r)=>{const o=c(e);return t.setup(o,e,n,r)},t.createImpl=(e,n,r)=>{const i=t.create(e,n,r);return o.implForWrapper(i)},t._internalSetup=(e,t)=>{},t.setup=(e,n,r=[],i={})=>(i.wrapper=e,t._internalSetup(e,n),Object.defineProperty(e,u,{value:new d.implementation(n,r,i),configurable:!0}),e[u][o.wrapperSymbol]=e,d.init&&d.init(e[u]),e),t.new=(e,n)=>{const r=c(e,n);return t._internalSetup(r,e),Object.defineProperty(r,u,{value:Object.create(d.implementation.prototype),configurable:!0}),r[u][o.wrapperSymbol]=r,d.init&&d.init(r[u]),r[u]};const l=new Set(["Window","Worker"]);t.install=(e,n)=>{if(!n.some(e=>l.has(e)))return;const a=o.initCtorRegistry(e);class c{constructor(){const n=[];{let t=arguments[0];if(void 0!==t)if(o.isObject(t))if(void 0!==t[Symbol.iterator]){if(!o.isObject(t))throw new e.TypeError("Failed to construct 'URLSearchParams': parameter 1 sequence is not an iterable object.");{const n=[],i=t;for(let t of i){if(!o.isObject(t))throw new e.TypeError("Failed to construct 'URLSearchParams': parameter 1 sequence's element is not an iterable object.");{const n=[],o=t;for(let t of o)t=r.USVString(t,{context:"Failed to construct 'URLSearchParams': parameter 1 sequence's element's element",globals:e}),n.push(t);t=n}n.push(t)}t=n}}else{if(!o.isObject(t))throw new e.TypeError("Failed to construct 'URLSearchParams': parameter 1 record is not an object.");{const n=Object.create(null);for(const o of Reflect.ownKeys(t)){const i=Object.getOwnPropertyDescriptor(t,o);if(i&&i.enumerable){let i=o;i=r.USVString(i,{context:"Failed to construct 'URLSearchParams': parameter 1 record's key",globals:e});let s=t[o];s=r.USVString(s,{context:"Failed to construct 'URLSearchParams': parameter 1 record's value",globals:e}),n[i]=s}}t=n}}else t=r.USVString(t,{context:"Failed to construct 'URLSearchParams': parameter 1",globals:e});else t="";n.push(t)}return t.setup(Object.create(new.target.prototype),e,n)}append(n,i){const s=null!=this?this:e;if(!t.is(s))throw new e.TypeError("'append' called on an object that is not a valid instance of URLSearchParams.");if(arguments.length<2)throw new e.TypeError(`Failed to execute 'append' on 'URLSearchParams': 2 arguments required, but only ${arguments.length} present.`);const a=[];{let t=arguments[0];t=r.USVString(t,{context:"Failed to execute 'append' on 'URLSearchParams': parameter 1",globals:e}),a.push(t)}{let t=arguments[1];t=r.USVString(t,{context:"Failed to execute 'append' on 'URLSearchParams': parameter 2",globals:e}),a.push(t)}return o.tryWrapperForImpl(s[u].append(...a))}delete(n){const i=null!=this?this:e;if(!t.is(i))throw new e.TypeError("'delete' called on an object that is not a valid instance of URLSearchParams.");if(arguments.length<1)throw new e.TypeError(`Failed to execute 'delete' on 'URLSearchParams': 1 argument required, but only ${arguments.length} present.`);const s=[];{let t=arguments[0];t=r.USVString(t,{context:"Failed to execute 'delete' on 'URLSearchParams': parameter 1",globals:e}),s.push(t)}return o.tryWrapperForImpl(i[u].delete(...s))}get(n){const o=null!=this?this:e;if(!t.is(o))throw new e.TypeError("'get' called on an object that is not a valid instance of URLSearchParams.");if(arguments.length<1)throw new e.TypeError(`Failed to execute 'get' on 'URLSearchParams': 1 argument required, but only ${arguments.length} present.`);const i=[];{let t=arguments[0];t=r.USVString(t,{context:"Failed to execute 'get' on 'URLSearchParams': parameter 1",globals:e}),i.push(t)}return o[u].get(...i)}getAll(n){const i=null!=this?this:e;if(!t.is(i))throw new e.TypeError("'getAll' called on an object that is not a valid instance of URLSearchParams.");if(arguments.length<1)throw new e.TypeError(`Failed to execute 'getAll' on 'URLSearchParams': 1 argument required, but only ${arguments.length} present.`);const s=[];{let t=arguments[0];t=r.USVString(t,{context:"Failed to execute 'getAll' on 'URLSearchParams': parameter 1",globals:e}),s.push(t)}return o.tryWrapperForImpl(i[u].getAll(...s))}has(n){const o=null!=this?this:e;if(!t.is(o))throw new e.TypeError("'has' called on an object that is not a valid instance of URLSearchParams.");if(arguments.length<1)throw new e.TypeError(`Failed to execute 'has' on 'URLSearchParams': 1 argument required, but only ${arguments.length} present.`);const i=[];{let t=arguments[0];t=r.USVString(t,{context:"Failed to execute 'has' on 'URLSearchParams': parameter 1",globals:e}),i.push(t)}return o[u].has(...i)}set(n,i){const s=null!=this?this:e;if(!t.is(s))throw new e.TypeError("'set' called on an object that is not a valid instance of URLSearchParams.");if(arguments.length<2)throw new e.TypeError(`Failed to execute 'set' on 'URLSearchParams': 2 arguments required, but only ${arguments.length} present.`);const a=[];{let t=arguments[0];t=r.USVString(t,{context:"Failed to execute 'set' on 'URLSearchParams': parameter 1",globals:e}),a.push(t)}{let t=arguments[1];t=r.USVString(t,{context:"Failed to execute 'set' on 'URLSearchParams': parameter 2",globals:e}),a.push(t)}return o.tryWrapperForImpl(s[u].set(...a))}sort(){const n=null!=this?this:e;if(!t.is(n))throw new e.TypeError("'sort' called on an object that is not a valid instance of URLSearchParams.");return o.tryWrapperForImpl(n[u].sort())}toString(){const n=null!=this?this:e;if(!t.is(n))throw new e.TypeError("'toString' called on an object that is not a valid instance of URLSearchParams.");return n[u].toString()}keys(){if(!t.is(this))throw new e.TypeError("'keys' called on an object that is not a valid instance of URLSearchParams.");return t.createDefaultIterator(e,this,"key")}values(){if(!t.is(this))throw new e.TypeError("'values' called on an object that is not a valid instance of URLSearchParams.");return t.createDefaultIterator(e,this,"value")}entries(){if(!t.is(this))throw new e.TypeError("'entries' called on an object that is not a valid instance of URLSearchParams.");return t.createDefaultIterator(e,this,"key+value")}forEach(n){if(!t.is(this))throw new e.TypeError("'forEach' called on an object that is not a valid instance of URLSearchParams.");if(arguments.length<1)throw new e.TypeError("Failed to execute 'forEach' on 'iterable': 1 argument required, but only 0 present.");n=i.convert(e,n,{context:"Failed to execute 'forEach' on 'iterable': The callback provided as parameter 1"});const r=arguments[1];let s=Array.from(this[u]),a=0;for(;a<s.length;){const[e,t]=s[a].map(o.tryWrapperForImpl);n.call(r,t,e,this),s=Array.from(this[u]),a++}}}Object.defineProperties(c.prototype,{append:{enumerable:!0},delete:{enumerable:!0},get:{enumerable:!0},getAll:{enumerable:!0},has:{enumerable:!0},set:{enumerable:!0},sort:{enumerable:!0},toString:{enumerable:!0},keys:{enumerable:!0},values:{enumerable:!0},entries:{enumerable:!0},forEach:{enumerable:!0},[Symbol.toStringTag]:{value:"URLSearchParams",configurable:!0},[Symbol.iterator]:{value:c.prototype.entries,configurable:!0,writable:!0}}),a.URLSearchParams=c,a["URLSearchParams Iterator"]=Object.create(a["%IteratorPrototype%"],{[Symbol.toStringTag]:{configurable:!0,value:"URLSearchParams Iterator"}}),o.define(a["URLSearchParams Iterator"],{next(){const t=this&&this[o.iterInternalSymbol];if(!t)throw new e.TypeError("next() called on a value that is not a URLSearchParams iterator object");const{target:n,kind:r,index:i}=t,a=Array.from(n[u]);if(i>=a.length)return s(e,{value:void 0,done:!0});const c=a[i];return t.index=i+1,s(e,o.iteratorResult(c.map(o.tryWrapperForImpl),r))}}),Object.defineProperty(e,"URLSearchParams",{configurable:!0,writable:!0,value:c})};const d=n(391)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MongoCredentials=void 0;const r=n(1),o=n(2),i=n(109),s=n(35);function u(e){if(e){if(Array.isArray(e.saslSupportedMechs))return e.saslSupportedMechs.includes(s.AuthMechanism.MONGODB_SCRAM_SHA256)?s.AuthMechanism.MONGODB_SCRAM_SHA256:s.AuthMechanism.MONGODB_SCRAM_SHA1;if(e.maxWireVersion>=3)return s.AuthMechanism.MONGODB_SCRAM_SHA1}return s.AuthMechanism.MONGODB_CR}class a{constructor(e){this.username=e.username,this.password=e.password,this.source=e.source,!this.source&&e.db&&(this.source=e.db),this.mechanism=e.mechanism||s.AuthMechanism.MONGODB_DEFAULT,this.mechanismProperties=e.mechanismProperties||{},this.mechanism.match(/MONGODB-AWS/i)&&(!this.username&&process.env.AWS_ACCESS_KEY_ID&&(this.username=process.env.AWS_ACCESS_KEY_ID),!this.password&&process.env.AWS_SECRET_ACCESS_KEY&&(this.password=process.env.AWS_SECRET_ACCESS_KEY),null==this.mechanismProperties.AWS_SESSION_TOKEN&&null!=process.env.AWS_SESSION_TOKEN&&(this.mechanismProperties={...this.mechanismProperties,AWS_SESSION_TOKEN:process.env.AWS_SESSION_TOKEN})),"gssapiCanonicalizeHostName"in this.mechanismProperties&&((0,o.emitWarningOnce)("gssapiCanonicalizeHostName is deprecated. Please use CANONICALIZE_HOST_NAME instead."),this.mechanismProperties.CANONICALIZE_HOST_NAME=this.mechanismProperties.gssapiCanonicalizeHostName),Object.freeze(this.mechanismProperties),Object.freeze(this)}equals(e){return this.mechanism===e.mechanism&&this.username===e.username&&this.password===e.password&&this.source===e.source}resolveAuthMechanism(e){return this.mechanism.match(/DEFAULT/i)?new a({username:this.username,password:this.password,source:this.source,mechanism:u(e),mechanismProperties:this.mechanismProperties}):this}validate(){var e;if((this.mechanism===s.AuthMechanism.MONGODB_GSSAPI||this.mechanism===s.AuthMechanism.MONGODB_CR||this.mechanism===s.AuthMechanism.MONGODB_PLAIN||this.mechanism===s.AuthMechanism.MONGODB_SCRAM_SHA1||this.mechanism===s.AuthMechanism.MONGODB_SCRAM_SHA256)&&!this.username)throw new r.MongoMissingCredentialsError(`Username required for mechanism '${this.mechanism}'`);if(s.AUTH_MECHS_AUTH_SRC_EXTERNAL.has(this.mechanism)&&null!=this.source&&"$external"!==this.source)throw new r.MongoAPIError(`Invalid source '${this.source}' for mechanism '${this.mechanism}' specified.`);if(this.mechanism===s.AuthMechanism.MONGODB_PLAIN&&null==this.source)throw new r.MongoAPIError("PLAIN Authentication Mechanism needs an auth source");if(this.mechanism===s.AuthMechanism.MONGODB_X509&&null!=this.password){if(""===this.password)return void Reflect.set(this,"password",void 0);throw new r.MongoAPIError("Password not allowed for mechanism MONGODB-X509")}const t=null!==(e=this.mechanismProperties.CANONICALIZE_HOST_NAME)&&void 0!==e&&e;if(!Object.values(i.GSSAPICanonicalizationValue).includes(t))throw new r.MongoAPIError(`Invalid CANONICALIZE_HOST_NAME value: ${t}`)}static merge(e,t){var n,r,o,i,u,c,l,d,f,p,h;return new a({username:null!==(r=null!==(n=t.username)&&void 0!==n?n:null==e?void 0:e.username)&&void 0!==r?r:"",password:null!==(i=null!==(o=t.password)&&void 0!==o?o:null==e?void 0:e.password)&&void 0!==i?i:"",mechanism:null!==(c=null!==(u=t.mechanism)&&void 0!==u?u:null==e?void 0:e.mechanism)&&void 0!==c?c:s.AuthMechanism.MONGODB_DEFAULT,mechanismProperties:null!==(d=null!==(l=t.mechanismProperties)&&void 0!==l?l:null==e?void 0:e.mechanismProperties)&&void 0!==d?d:{},source:null!==(h=null!==(p=null!==(f=t.source)&&void 0!==f?f:t.db)&&void 0!==p?p:null==e?void 0:e.source)&&void 0!==h?h:"admin"})}}t.MongoCredentials=a},function(e,t){e.exports=require("tls")},function(e,t,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),o=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||r(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),o(n(405),t)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SOCKS5_NO_ACCEPTABLE_AUTH=t.SOCKS5_CUSTOM_AUTH_END=t.SOCKS5_CUSTOM_AUTH_START=t.SOCKS_INCOMING_PACKET_SIZES=t.SocksClientState=t.Socks5Response=t.Socks5HostType=t.Socks5Auth=t.Socks4Response=t.SocksCommand=t.ERRORS=t.DEFAULT_TIMEOUT=void 0;t.DEFAULT_TIMEOUT=3e4;t.ERRORS={InvalidSocksCommand:"An invalid SOCKS command was provided. Valid options are connect, bind, and associate.",InvalidSocksCommandForOperation:"An invalid SOCKS command was provided. Only a subset of commands are supported for this operation.",InvalidSocksCommandChain:"An invalid SOCKS command was provided. Chaining currently only supports the connect command.",InvalidSocksClientOptionsDestination:"An invalid destination host was provided.",InvalidSocksClientOptionsExistingSocket:"An invalid existing socket was provided. This should be an instance of stream.Duplex.",InvalidSocksClientOptionsProxy:"Invalid SOCKS proxy details were provided.",InvalidSocksClientOptionsTimeout:"An invalid timeout value was provided. Please enter a value above 0 (in ms).",InvalidSocksClientOptionsProxiesLength:"At least two socks proxies must be provided for chaining.",InvalidSocksClientOptionsCustomAuthRange:"Custom auth must be a value between 0x80 and 0xFE.",InvalidSocksClientOptionsCustomAuthOptions:"When a custom_auth_method is provided, custom_auth_request_handler, custom_auth_response_size, and custom_auth_response_handler must also be provided and valid.",NegotiationError:"Negotiation error",SocketClosed:"Socket closed",ProxyConnectionTimedOut:"Proxy connection timed out",InternalError:"SocksClient internal error (this should not happen)",InvalidSocks4HandshakeResponse:"Received invalid Socks4 handshake response",Socks4ProxyRejectedConnection:"Socks4 Proxy rejected connection",InvalidSocks4IncomingConnectionResponse:"Socks4 invalid incoming connection response",Socks4ProxyRejectedIncomingBoundConnection:"Socks4 Proxy rejected incoming bound connection",InvalidSocks5InitialHandshakeResponse:"Received invalid Socks5 initial handshake response",InvalidSocks5IntiailHandshakeSocksVersion:"Received invalid Socks5 initial handshake (invalid socks version)",InvalidSocks5InitialHandshakeNoAcceptedAuthType:"Received invalid Socks5 initial handshake (no accepted authentication type)",InvalidSocks5InitialHandshakeUnknownAuthType:"Received invalid Socks5 initial handshake (unknown authentication type)",Socks5AuthenticationFailed:"Socks5 Authentication failed",InvalidSocks5FinalHandshake:"Received invalid Socks5 final handshake response",InvalidSocks5FinalHandshakeRejected:"Socks5 proxy rejected connection",InvalidSocks5IncomingConnectionResponse:"Received invalid Socks5 incoming connection response",Socks5ProxyRejectedIncomingBoundConnection:"Socks5 Proxy rejected incoming bound connection"};var r,o,i;t.SOCKS_INCOMING_PACKET_SIZES={Socks5InitialHandshakeResponse:2,Socks5UserPassAuthenticationResponse:2,Socks5ResponseHeader:5,Socks5ResponseIPv4:10,Socks5ResponseIPv6:22,Socks5ResponseHostname:e=>e+7,Socks4Response:8},function(e){e[e.connect=1]="connect",e[e.bind=2]="bind",e[e.associate=3]="associate"}(r||(r={})),t.SocksCommand=r,function(e){e[e.Granted=90]="Granted",e[e.Failed=91]="Failed",e[e.Rejected=92]="Rejected",e[e.RejectedIdent=93]="RejectedIdent"}(o||(o={})),t.Socks4Response=o,function(e){e[e.NoAuth=0]="NoAuth",e[e.GSSApi=1]="GSSApi",e[e.UserPass=2]="UserPass"}(i||(i={})),t.Socks5Auth=i;t.SOCKS5_CUSTOM_AUTH_START=128;t.SOCKS5_CUSTOM_AUTH_END=254;var s,u,a;t.SOCKS5_NO_ACCEPTABLE_AUTH=255,function(e){e[e.Granted=0]="Granted",e[e.Failure=1]="Failure",e[e.NotAllowed=2]="NotAllowed",e[e.NetworkUnreachable=3]="NetworkUnreachable",e[e.HostUnreachable=4]="HostUnreachable",e[e.ConnectionRefused=5]="ConnectionRefused",e[e.TTLExpired=6]="TTLExpired",e[e.CommandNotSupported=7]="CommandNotSupported",e[e.AddressNotSupported=8]="AddressNotSupported"}(s||(s={})),t.Socks5Response=s,function(e){e[e.IPv4=1]="IPv4",e[e.Hostname=3]="Hostname",e[e.IPv6=4]="IPv6"}(u||(u={})),t.Socks5HostType=u,function(e){e[e.Created=0]="Created",e[e.Connecting=1]="Connecting",e[e.Connected=2]="Connected",e[e.SentInitialHandshake=3]="SentInitialHandshake",e[e.ReceivedInitialHandshakeResponse=4]="ReceivedInitialHandshakeResponse",e[e.SentAuthentication=5]="SentAuthentication",e[e.ReceivedAuthenticationResponse=6]="ReceivedAuthenticationResponse",e[e.SentFinalHandshake=7]="SentFinalHandshake",e[e.ReceivedFinalResponse=8]="ReceivedFinalResponse",e[e.BoundWaitingForConnection=9]="BoundWaitingForConnection",e[e.Established=10]="Established",e[e.Disconnected=11]="Disconnected",e[e.Error=99]="Error"}(a||(a={})),t.SocksClientState=a},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.shuffleArray=t.SocksClientError=void 0;class r extends Error{constructor(e,t){super(e),this.options=t}}t.SocksClientError=r,t.shuffleArray=function(e){for(let t=e.length-1;t>0;t--){const n=Math.floor(Math.random()*(t+1));[e[t],e[n]]=[e[n],e[t]]}}},function(e,t,n){(function(r){var o=n(64),i=n(110),s=n(413),u=i.join,a=i.dirname,c=o.accessSync&&function(e){try{o.accessSync(e)}catch(e){return!1}return!0}||o.existsSync||i.existsSync,l={arrow:process.env.NODE_BINDINGS_ARROW||" → ",compiled:process.env.NODE_BINDINGS_COMPILED_DIR||"compiled",platform:process.platform,arch:process.arch,nodePreGyp:"node-v"+process.versions.modules+"-"+process.platform+"-"+process.arch,version:process.versions.node,bindings:"bindings.node",try:[["module_root","build","bindings"],["module_root","build","Debug","bindings"],["module_root","build","Release","bindings"],["module_root","out","Debug","bindings"],["module_root","Debug","bindings"],["module_root","out","Release","bindings"],["module_root","Release","bindings"],["module_root","build","default","bindings"],["module_root","compiled","version","platform","arch","bindings"],["module_root","addon-build","release","install-root","bindings"],["module_root","addon-build","debug","install-root","bindings"],["module_root","addon-build","default","install-root","bindings"],["module_root","lib","binding","nodePreGyp","bindings"]]};e.exports=t=function(e){"string"==typeof e?e={bindings:e}:e||(e={}),Object.keys(l).map((function(t){t in e||(e[t]=l[t])})),e.module_root||(e.module_root=t.getRoot(t.getFileName())),".node"!=i.extname(e.bindings)&&(e.bindings+=".node");for(var n,r,o,s=require,a=[],c=0,d=e.try.length;c<d;c++){n=u.apply(null,e.try[c].map((function(t){return e[t]||t}))),a.push(n);try{return r=e.path?s.resolve(n):s(n),e.path||(r.path=n),r}catch(e){if("MODULE_NOT_FOUND"!==e.code&&"QUALIFIED_PATH_RESOLUTION_FAILED"!==e.code&&!/not find/i.test(e.message))throw e}}throw(o=new Error("Could not locate the bindings file. Tried:\n"+a.map((function(t){return e.arrow+t})).join("\n"))).tries=a,o},t.getFileName=function(e){var t,n=Error.prepareStackTrace,o=Error.stackTraceLimit,i={};Error.stackTraceLimit=10,Error.prepareStackTrace=function(n,o){for(var i=0,s=o.length;i<s;i++)if((t=o[i].getFileName())!==r){if(!e)return;if(t!==e)return}},Error.captureStackTrace(i),Error.prepareStackTrace=n,Error.stackTraceLimit=o;return 0===t.indexOf("file://")&&(t=s(t)),t},t.getRoot=function(e){for(var t,n=a(e);;){if("."===n&&(n=process.cwd()),c(u(n,"package.json"))||c(u(n,"node_modules")))return n;if(t===n)throw new Error('Could not find module root given file: "'+e+'". Do you have a `package.json` file? ');t=n,n=u(n,"..")}}}).call(this,"/index.js")},function(e,t,n){"use strict";const r=n(18);function o(e){return(t,n,o)=>{let i;try{i=r.createHmac(e,t).update(n).digest()}catch(e){return e}return i.copy(o),i.length}}e.exports={aes256CbcEncryptHook:function(e,t,n,o){let i;try{let o=r.createCipheriv("aes-256-cbc",e,t);o.setAutoPadding(!1),i=o.update(n)}catch(e){return e}return i.copy(o),i.length},aes256CbcDecryptHook:function(e,t,n,o){let i;try{let o=r.createDecipheriv("aes-256-cbc",e,t);o.setAutoPadding(!1),i=o.update(n)}catch(e){return e}return i.copy(o),i.length},randomHook:function(e,t){try{r.randomFillSync(e,0,t)}catch(e){return e}return t},hmacSha512Hook:o("sha512"),hmacSha256Hook:o("sha256"),sha256Hook:function(e,t){let n;try{n=r.createHash("sha256").update(e).digest()}catch(e){return e}return n.copy(t),n.length},signRsaSha256Hook:function(e,t,n){let o;try{const n=r.createSign("sha256WithRSAEncryption"),i=Buffer.from(`-----BEGIN PRIVATE KEY-----\n${e.toString("base64")}\n-----END PRIVATE KEY-----\n`);o=n.update(t).end().sign(i)}catch(e){return e}return o.copy(n),o.length}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Server=void 0;const r=n(66),o=n(421),i=n(8),s=n(1),u=n(23),a=n(9),c=n(169),l=n(2),d=n(12),f=n(429),p=n(62),h=(0,l.makeStateMachine)({[d.STATE_CLOSED]:[d.STATE_CLOSED,d.STATE_CONNECTING],[d.STATE_CONNECTING]:[d.STATE_CONNECTING,d.STATE_CLOSING,d.STATE_CONNECTED,d.STATE_CLOSED],[d.STATE_CONNECTED]:[d.STATE_CONNECTED,d.STATE_CLOSING,d.STATE_CLOSED],[d.STATE_CLOSING]:[d.STATE_CLOSING,d.STATE_CLOSED]}),m=Symbol("monitor");class g extends a.TypedEventEmitter{constructor(e,t,n){super(),this.serverApi=n.serverApi;const s={hostAddress:t.hostAddress,...n};this.s={description:t,options:n,logger:new u.Logger("Server"),state:d.STATE_CLOSED,topology:e,pool:new o.ConnectionPool(s),operationCount:0};for(const e of[...i.CMAP_EVENTS,...i.APM_EVENTS])this.s.pool.on(e,t=>this.emit(e,t));if(this.s.pool.on(r.Connection.CLUSTER_TIME_RECEIVED,e=>{this.clusterTime=e}),this.loadBalanced)return void(this[m]=null);const a=new f.Monitor(this,this.s.options);this[m]=a;for(const e of i.HEARTBEAT_EVENTS)a.on(e,t=>this.emit(e,t));a.on("resetConnectionPool",()=>{this.s.pool.clear()}),a.on("resetServer",e=>y(this,e)),a.on(g.SERVER_HEARTBEAT_SUCCEEDED,e=>{this.emit(g.DESCRIPTION_RECEIVED,new p.ServerDescription(this.description.hostAddress,e.reply,{roundTripTime:E(this.description.roundTripTime,e.duration)})),this.s.state===d.STATE_CONNECTING&&(h(this,d.STATE_CONNECTED),this.emit(g.CONNECT,this))})}get clusterTime(){return this.s.topology.clusterTime}set clusterTime(e){this.s.topology.clusterTime=e}get description(){return this.s.description}get name(){return this.s.description.address}get autoEncrypter(){if(this.s.options&&this.s.options.autoEncrypter)return this.s.options.autoEncrypter}get loadBalanced(){return this.s.topology.description.type===d.TopologyType.LoadBalanced}connect(){var e;this.s.state===d.STATE_CLOSED&&(h(this,d.STATE_CONNECTING),this.loadBalanced?(h(this,d.STATE_CONNECTED),this.emit(g.CONNECT,this)):null===(e=this[m])||void 0===e||e.connect())}destroy(e,t){var n;"function"==typeof e&&(t=e,e={}),e=Object.assign({},{force:!1},e),this.s.state!==d.STATE_CLOSED?(h(this,d.STATE_CLOSING),this.loadBalanced||null===(n=this[m])||void 0===n||n.close(),this.s.pool.close(e,e=>{h(this,d.STATE_CLOSED),this.emit("closed"),"function"==typeof t&&t(e)})):"function"==typeof t&&t()}requestCheck(){var e;this.loadBalanced||null===(e=this[m])||void 0===e||e.requestCheck()}command(e,t,n,r){if(null==r)throw new s.MongoInvalidArgumentError("Callback must be provided");if(null==e.db||"string"==typeof e)throw new s.MongoInvalidArgumentError("Namespace must not be a string");if(this.s.state===d.STATE_CLOSING||this.s.state===d.STATE_CLOSED)return void r(new s.MongoServerClosedError);const o=Object.assign({},n,{wireProtocolCommand:!1});if(o.omitReadPreference&&delete o.readPreference,(0,l.collationNotSupported)(this,t))return void r(new s.MongoCompatibilityError(`Server ${this.name} does not support collation`));const i=o.session,u=null==i?void 0:i.pinnedConnection;this.loadBalanced&&i&&null==u&&function(e,t){if(t)return t.inTransaction()||"aggregate"in e||"find"in e||"getMore"in e||"listCollections"in e||"listIndexes"in e;return!1}(t,i)?this.s.pool.checkOut((n,s)=>{if(n||null==s)return r?r(n):void 0;i.pin(s),this.command(e,t,o,r)}):(this.s.operationCount+=1,this.s.pool.withConnection(u,(n,r,i)=>{if(n||!r)return this.s.operationCount-=1,y(this,n),i(n);r.command(e,t,o,b(this,r,t,o,(e,t)=>{this.s.operationCount-=1,i(e,t)}))},r))}getMore(e,t,n,r){var o;this.s.state!==d.STATE_CLOSING&&this.s.state!==d.STATE_CLOSED?(this.s.operationCount+=1,this.s.pool.withConnection(null===(o=n.session)||void 0===o?void 0:o.pinnedConnection,(r,o,i)=>{if(r||!o)return this.s.operationCount-=1,y(this,r),i(r);o.getMore(e,t,n,b(this,o,{},n,(e,t)=>{this.s.operationCount-=1,i(e,t)}))},r)):r(new s.MongoServerClosedError)}killCursors(e,t,n,r){var o;this.s.state!==d.STATE_CLOSING&&this.s.state!==d.STATE_CLOSED?(this.s.operationCount+=1,this.s.pool.withConnection(null===(o=n.session)||void 0===o?void 0:o.pinnedConnection,(r,o,i)=>{if(r||!o)return this.s.operationCount-=1,y(this,r),i(r);o.killCursors(e,t,n,b(this,o,{},void 0,(e,t)=>{this.s.operationCount-=1,i(e,t)}))},r)):"function"==typeof r&&r(new s.MongoServerClosedError)}}function E(e,t){if(-1===e)return t;return.2*t+.8*e}function y(e,t){var n;e.loadBalanced||(t instanceof s.MongoNetworkError&&!(t instanceof s.MongoNetworkTimeoutError)&&(null===(n=e[m])||void 0===n||n.reset()),e.emit(g.DESCRIPTION_RECEIVED,new p.ServerDescription(e.description.hostAddress,void 0,{error:t,topologyVersion:t&&t.topologyVersion?t.topologyVersion:e.description.topologyVersion})))}function v(e,t){return e&&e.inTransaction()&&!(0,c.isTransactionCommand)(t)}function A(e){return!1!==e.s.options.retryWrites}function b(e,t,n,r,o){const i=null==r?void 0:r.session;return function(r,u){return null!=u?o(void 0,u):r?r instanceof s.MongoError?function(e,t){return t.serviceId?t.generation!==e.serviceGenerations.get(t.serviceId.toHexString()):t.generation!==e.generation}(e.s.pool,t)?o(r):(r instanceof s.MongoNetworkError?(i&&!i.hasEnded&&i.serverSession&&(i.serverSession.isDirty=!0),v(i,n)&&!r.hasErrorLabel(s.MongoErrorLabel.TransientTransactionError)&&r.addErrorLabel(s.MongoErrorLabel.TransientTransactionError),(A(e.s.topology)||(0,c.isTransactionCommand)(n))&&(0,l.supportsRetryableWrites)(e)&&!v(i,n)&&r.addErrorLabel(s.MongoErrorLabel.RetryableWriteError),r instanceof s.MongoNetworkTimeoutError&&!(0,s.isNetworkErrorBeforeHandshake)(r)||(e.s.pool.clear(t.serviceId),e.loadBalanced||y(e,r))):((A(e.s.topology)||(0,c.isTransactionCommand)(n))&&(0,s.needsRetryableWriteLabel)(r,(0,l.maxWireVersion)(e))&&!v(i,n)&&r.addErrorLabel(s.MongoErrorLabel.RetryableWriteError),(0,s.isSDAMUnrecoverableError)(r)&&function(e,t){const n=t.topologyVersion,r=e.description.topologyVersion;return(0,p.compareTopologyVersion)(r,n)<0}(e,r)&&(((0,l.maxWireVersion)(e)<=7||(0,s.isNodeShuttingDownError)(r))&&e.s.pool.clear(t.serviceId),e.loadBalanced||(y(e,r),process.nextTick(()=>e.requestCheck())))),i&&i.isPinned&&r.hasErrorLabel(s.MongoErrorLabel.TransientTransactionError)&&i.unpin({force:!0}),o(r)):o(r):o(new s.MongoUnexpectedServerResponseError("Empty response with no error"))}}t.Server=g,g.SERVER_HEARTBEAT_STARTED=i.SERVER_HEARTBEAT_STARTED,g.SERVER_HEARTBEAT_SUCCEEDED=i.SERVER_HEARTBEAT_SUCCEEDED,g.SERVER_HEARTBEAT_FAILED=i.SERVER_HEARTBEAT_FAILED,g.CONNECT=i.CONNECT,g.DESCRIPTION_RECEIVED=i.DESCRIPTION_RECEIVED,g.CLOSED=i.CLOSED,g.ENDED=i.ENDED},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CommandFailedEvent=t.CommandSucceededEvent=t.CommandStartedEvent=void 0;const r=n(8),o=n(2),i=n(114);t.CommandStartedEvent=class{constructor(e,t){const n=g(t),r=a(n),{address:o,connectionId:i,serviceId:u}=E(e);s.has(r)&&(this.commandObj={},this.commandObj[r]=!0),this.address=o,this.connectionId=i,this.serviceId=u,this.requestId=t.requestId,this.databaseName=l(t),this.commandName=r,this.command=f(r,n,n)}get hasServiceId(){return!!this.serviceId}};t.CommandSucceededEvent=class{constructor(e,t,n,r){const s=g(t),u=a(s),{address:l,connectionId:d,serviceId:p}=E(e);this.address=l,this.connectionId=d,this.serviceId=p,this.requestId=t.requestId,this.commandName=u,this.duration=(0,o.calculateDurationInMs)(r),this.reply=f(u,s,function(e,t){if(e instanceof i.KillCursor)return{ok:1,cursorsUnknown:e.cursorIds};if(!t)return t;if(e instanceof i.GetMore)return{ok:1,cursor:{id:(0,o.deepCopy)(t.cursorId),ns:c(e),nextBatch:(0,o.deepCopy)(t.documents)}};if(e instanceof i.Msg)return(0,o.deepCopy)(t.result?t.result:t);if(e.query&&null!=e.query.$query)return{ok:1,cursor:{id:(0,o.deepCopy)(t.cursorId),ns:c(e),firstBatch:(0,o.deepCopy)(t.documents)}};return(0,o.deepCopy)(t.result?t.result:t)}(t,n))}get hasServiceId(){return!!this.serviceId}};t.CommandFailedEvent=class{constructor(e,t,n,r){const i=g(t),s=a(i),{address:u,connectionId:c,serviceId:l}=E(e);this.address=u,this.connectionId=c,this.serviceId=l,this.requestId=t.requestId,this.commandName=s,this.duration=(0,o.calculateDurationInMs)(r),this.failure=f(s,i,n)}get hasServiceId(){return!!this.serviceId}};const s=new Set(["authenticate","saslStart","saslContinue","getnonce","createUser","updateUser","copydbgetnonce","copydbsaslstart","copydb"]),u=new Set(["hello",r.LEGACY_HELLO_COMMAND,r.LEGACY_HELLO_COMMAND_CAMEL_CASE]),a=e=>Object.keys(e)[0],c=e=>e.ns,l=e=>e.ns.split(".")[0],d=e=>e.ns.split(".")[1],f=(e,t,n)=>s.has(e)||u.has(e)&&t.speculativeAuthenticate?{}:n,p={$query:"filter",$orderby:"sort",$hint:"hint",$comment:"comment",$maxScan:"maxScan",$max:"max",$min:"min",$returnKey:"returnKey",$showDiskLoc:"showRecordId",$maxTimeMS:"maxTimeMS",$snapshot:"snapshot"},h={numberToSkip:"skip",numberToReturn:"batchSize",returnFieldSelector:"projection"},m=["tailable","oplogReplay","noCursorTimeout","awaitData","partial","exhaust"];function g(e){var t;if(e instanceof i.GetMore)return{getMore:(0,o.deepCopy)(e.cursorId),collection:d(e),batchSize:e.numberToReturn};if(e instanceof i.KillCursor)return{killCursors:d(e),cursors:(0,o.deepCopy)(e.cursorIds)};if(e instanceof i.Msg)return(0,o.deepCopy)(e.command);if(null===(t=e.query)||void 0===t?void 0:t.$query){let t;return"admin.$cmd"===e.ns?t=Object.assign({},e.query.$query):(t={find:d(e)},Object.keys(p).forEach(n=>{null!=e.query[n]&&(t[p[n]]=(0,o.deepCopy)(e.query[n]))})),Object.keys(h).forEach(n=>{const r=n;null!=e[r]&&(t[h[r]]=(0,o.deepCopy)(e[r]))}),m.forEach(n=>{const r=n;e[r]&&(t[r]=e[r])}),null!=e.pre32Limit&&(t.limit=e.pre32Limit),e.query.$explain?{explain:t}:t}const n={},r={};if(e.query){for(const t in e.query)n[t]=(0,o.deepCopy)(e.query[t]);r.query=n}for(const t in e)"query"!==t&&(r[t]=(0,o.deepCopy)(e[t]));return e.query?n:r}function E(e){let t;return"id"in e&&(t=e.id),{address:e.address,serviceId:e.serviceId,connectionId:t}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.LEGAL_TCP_SOCKET_OPTIONS=t.LEGAL_TLS_SOCKET_OPTIONS=t.connect=void 0;const r=n(112),o=n(182),i=n(181),s=n(4),u=n(8),a=n(1),c=n(2),l=n(24),d=n(109),f=n(422),p=n(423),h=n(425),m=n(35),g=n(426),E=n(427),y=n(66),v=n(42),A=new Map([[m.AuthMechanism.MONGODB_AWS,new p.MongoDBAWS],[m.AuthMechanism.MONGODB_CR,new f.MongoCR],[m.AuthMechanism.MONGODB_GSSAPI,new d.GSSAPI],[m.AuthMechanism.MONGODB_PLAIN,new h.Plain],[m.AuthMechanism.MONGODB_SCRAM_SHA1,new g.ScramSHA1],[m.AuthMechanism.MONGODB_SCRAM_SHA256,new g.ScramSHA256],[m.AuthMechanism.MONGODB_X509,new E.X509]]);function b(e){const n=e.hostAddress;if(!n)throw new a.MongoInvalidArgumentError('Option "hostAddress" is required');const r={};for(const n of t.LEGAL_TCP_SOCKET_OPTIONS)null!=e[n]&&(r[n]=e[n]);if("string"==typeof n.socketPath)return r.path=n.socketPath,r;if("string"==typeof n.host)return r.host=n.host,r.port=n.port,r;throw new a.MongoRuntimeError(`Unexpected HostAddress ${JSON.stringify(n)}`)}t.connect=function(e,t){S({...e,existingSocket:void 0},(n,r)=>{var o;if(n||!r)return t(n);let i=null!==(o=e.connectionType)&&void 0!==o?o:y.Connection;e.autoEncrypter&&(i=y.CryptoConnection),function(e,t,n){const r=function(t,r){t&&e&&e.destroy(),n(t,r)},o=t.credentials;if(o&&o.mechanism!==m.AuthMechanism.MONGODB_DEFAULT&&!A.get(o.mechanism))return void r(new a.MongoInvalidArgumentError(`AuthMechanism '${o.mechanism}' not supported`));const i=new l.AuthContext(e,o,t);!function(e,t){const n=e.options,r=n.compressors?n.compressors:[],{serverApi:o}=e.connection,i={[(null==o?void 0:o.version)?"hello":u.LEGACY_HELLO_COMMAND]:!0,helloOk:!0,client:n.metadata||(0,c.makeClientMetadata)(n),compression:r,loadBalanced:n.loadBalanced},s=e.credentials;if(s){if(s.mechanism===m.AuthMechanism.MONGODB_DEFAULT&&s.username){i.saslSupportedMechs=`${s.source}.${s.username}`;const n=A.get(m.AuthMechanism.MONGODB_SCRAM_SHA256);return n?n.prepare(i,e,t):t(new a.MongoInvalidArgumentError(`No AuthProvider for ${m.AuthMechanism.MONGODB_SCRAM_SHA256} defined.`))}const n=A.get(s.mechanism);return n?n.prepare(i,e,t):t(new a.MongoInvalidArgumentError(`No AuthProvider for ${s.mechanism} defined.`))}t(void 0,i)}(i,(n,l)=>{if(n||!l)return r(n);const d=Object.assign({},t);"number"==typeof t.connectTimeoutMS&&(d.socketTimeoutMS=t.connectTimeoutMS);const f=(new Date).getTime();e.command((0,c.ns)("admin.$cmd"),l,d,(n,c)=>{if(n)return void r(n);if(0===(null==c?void 0:c.ok))return void r(new a.MongoServerError(c));"isWritablePrimary"in c||(c.isWritablePrimary=c[u.LEGACY_HELLO_COMMAND]),c.helloOk&&(e.helloOk=!0);const l=function(e,t){var n;const r=e&&("number"==typeof e.maxWireVersion||e.maxWireVersion instanceof s.Int32)&&e.maxWireVersion>=v.MIN_SUPPORTED_WIRE_VERSION,o=e&&("number"==typeof e.minWireVersion||e.minWireVersion instanceof s.Int32)&&e.minWireVersion<=v.MAX_SUPPORTED_WIRE_VERSION;if(r){if(o)return null;const n=`Server at ${t.hostAddress} reports minimum wire version ${JSON.stringify(e.minWireVersion)}, but this version of the Node.js Driver requires at most ${v.MAX_SUPPORTED_WIRE_VERSION} (MongoDB ${v.MAX_SUPPORTED_SERVER_VERSION})`;return new a.MongoCompatibilityError(n)}const i=`Server at ${t.hostAddress} reports maximum wire version ${null!==(n=JSON.stringify(e.maxWireVersion))&&void 0!==n?n:0}, but this version of the Node.js Driver requires at least ${v.MIN_SUPPORTED_WIRE_VERSION} (MongoDB ${v.MIN_SUPPORTED_SERVER_VERSION})`;return new a.MongoCompatibilityError(i)}(c,t);if(l)r(l);else{if(t.loadBalanced&&!c.serviceId)return r(new a.MongoCompatibilityError("Driver attempted to initialize in load balancing mode, but the server does not support this mode."));if(e.hello=c,e.lastHelloMS=(new Date).getTime()-f,!c.arbiterOnly&&o){i.response=c;const t=o.resolveAuthMechanism(c),n=A.get(t.mechanism);return n?void n.auth(i,t=>{if(t)return t instanceof a.MongoError&&(t.addErrorLabel(a.MongoErrorLabel.HandshakeError),(0,a.needsRetryableWriteLabel)(t,c.maxWireVersion)&&t.addErrorLabel(a.MongoErrorLabel.RetryableWriteError)),r(t);r(void 0,e)}):r(new a.MongoInvalidArgumentError(`No AuthProvider for ${t.mechanism} defined.`))}r(void 0,e)}})})}(new i(r,e),e,t)})},t.LEGAL_TLS_SOCKET_OPTIONS=["ALPNProtocols","ca","cert","checkServerIdentity","ciphers","crl","ecdhCurve","key","minDHSize","passphrase","pfx","rejectUnauthorized","secureContext","secureProtocol","servername","session"],t.LEGAL_TCP_SOCKET_OPTIONS=["family","hints","localAddress","localPort","lookup"];const C=new Set(["error","close","timeout","parseError"]);function S(e,n){var s,u,l,d,f,p,h,m,g;const E=null!==(s=e.tls)&&void 0!==s&&s,y=null===(u=e.keepAlive)||void 0===u||u,v=null!==(d=null!==(l=e.socketTimeoutMS)&&void 0!==l?l:Reflect.get(e,"socketTimeout"))&&void 0!==d?d:0,A=null===(f=e.noDelay)||void 0===f||f,_=null!==(p=e.connectTimeoutMS)&&void 0!==p?p:3e4,w=null===(h=e.rejectUnauthorized)||void 0===h||h,D=null!==(g=(null!==(m=e.keepAliveInitialDelay)&&void 0!==m?m:12e4)>v?Math.round(v/2):e.keepAliveInitialDelay)&&void 0!==g?g:12e4,B=e.existingSocket;let T;const F=function(e,t){e&&T&&T.destroy(),n(e,t)};if(null!=e.proxyHost)return function(e,t){var n,r;const i=c.HostAddress.fromHostPort(null!==(n=e.proxyHost)&&void 0!==n?n:"",null!==(r=e.proxyPort)&&void 0!==r?r:1080);S({...e,hostAddress:i,tls:!1,proxyHost:void 0},(n,r)=>{if(n)return t(n);const i=b(e);if("string"!=typeof i.host||"number"!=typeof i.port)return t(new a.MongoInvalidArgumentError("Can only make Socks5 connections to TCP hosts"));o.SocksClient.createConnection({existing_socket:r,timeout:e.connectTimeoutMS,command:"connect",destination:{host:i.host,port:i.port},proxy:{host:"iLoveJavaScript",port:0,type:5,userId:e.proxyUsername||void 0,password:e.proxyPassword||void 0}},(n,r)=>{if(n)return t(O("error",n));S({...e,existingSocket:r.socket,proxyHost:void 0},t)})})}({...e,connectTimeoutMS:_},F);if(E){const n=i.connect(function(e){const n=b(e);for(const r of t.LEGAL_TLS_SOCKET_OPTIONS)null!=e[r]&&(n[r]=e[r]);return e.existingSocket&&(n.socket=e.existingSocket),null==n.servername&&n.host&&!r.isIP(n.host)&&(n.servername=n.host),n}(e));"function"==typeof n.disableRenegotiation&&n.disableRenegotiation(),T=n}else T=B||r.createConnection(b(e));T.setKeepAlive(y,D),T.setTimeout(_),T.setNoDelay(A);const N=E?"secureConnect":"connect";let R;function I(t){return n=>{C.forEach(e=>T.removeAllListeners(e)),R&&e.cancellationToken&&e.cancellationToken.removeListener("cancel",R),T.removeListener(N,x),F(O(t,n))}}function x(){if(C.forEach(e=>T.removeAllListeners(e)),R&&e.cancellationToken&&e.cancellationToken.removeListener("cancel",R),"authorizationError"in T&&T.authorizationError&&w)return F(T.authorizationError);T.setTimeout(v),F(void 0,T)}C.forEach(e=>T.once(e,I(e))),e.cancellationToken&&(R=I("cancel"),e.cancellationToken.once("cancel",R)),B?process.nextTick(x):T.once(N,x)}function O(e,t){switch(e){case"error":return new a.MongoNetworkError(t);case"timeout":return new a.MongoNetworkTimeoutError("connection timed out");case"close":return new a.MongoNetworkError("connection closed");case"cancel":return new a.MongoNetworkError("connection establishment was cancelled");default:return new a.MongoNetworkError("unknown network error")}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ConnectionPoolClearedEvent=t.ConnectionCheckedInEvent=t.ConnectionCheckedOutEvent=t.ConnectionCheckOutFailedEvent=t.ConnectionCheckOutStartedEvent=t.ConnectionClosedEvent=t.ConnectionReadyEvent=t.ConnectionCreatedEvent=t.ConnectionPoolClosedEvent=t.ConnectionPoolCreatedEvent=t.ConnectionPoolMonitoringEvent=void 0;class r{constructor(e){this.time=new Date,this.address=e.address}}t.ConnectionPoolMonitoringEvent=r;t.ConnectionPoolCreatedEvent=class extends r{constructor(e){super(e),this.options=e.options}};t.ConnectionPoolClosedEvent=class extends r{constructor(e){super(e)}};t.ConnectionCreatedEvent=class extends r{constructor(e,t){super(e),this.connectionId=t.id}};t.ConnectionReadyEvent=class extends r{constructor(e,t){super(e),this.connectionId=t.id}};t.ConnectionClosedEvent=class extends r{constructor(e,t,n){super(e),this.connectionId=t.id,this.reason=n||"unknown",this.serviceId=t.serviceId}};t.ConnectionCheckOutStartedEvent=class extends r{constructor(e){super(e)}};t.ConnectionCheckOutFailedEvent=class extends r{constructor(e,t){super(e),this.reason=t}};t.ConnectionCheckedOutEvent=class extends r{constructor(e,t){super(e),this.connectionId=t.id}};t.ConnectionCheckedInEvent=class extends r{constructor(e,t){super(e),this.connectionId=t.id}};t.ConnectionPoolClearedEvent=class extends r{constructor(e,t){super(e),this.serviceId=t}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SrvPoller=t.SrvPollingEvent=void 0;const r=n(104),o=n(21),i=n(1),s=n(23),u=n(9),a=n(2);function c(e,t){const n=/^.*?\./,r=`.${e.replace(n,"")}`,o=`.${t.replace(n,"")}`;return r.endsWith(o)}class l{constructor(e){this.srvRecords=e}hostnames(){return new Set(this.srvRecords.map(e=>a.HostAddress.fromSrvRecord(e).toString()))}}t.SrvPollingEvent=l;class d extends u.TypedEventEmitter{constructor(e){var t,n,r;if(super(),!e||!e.srvHost)throw new i.MongoRuntimeError("Options for SrvPoller must exist and include srvHost");this.srvHost=e.srvHost,this.srvMaxHosts=null!==(t=e.srvMaxHosts)&&void 0!==t?t:0,this.srvServiceName=null!==(n=e.srvServiceName)&&void 0!==n?n:"mongodb",this.rescanSrvIntervalMS=6e4,this.heartbeatFrequencyMS=null!==(r=e.heartbeatFrequencyMS)&&void 0!==r?r:1e4,this.logger=new s.Logger("srvPoller",e),this.haMode=!1,this.generation=0,this._timeout=void 0}get srvAddress(){return`_${this.srvServiceName}._tcp.${this.srvHost}`}get intervalMS(){return this.haMode?this.heartbeatFrequencyMS:this.rescanSrvIntervalMS}start(){this._timeout||this.schedule()}stop(){this._timeout&&(clearTimeout(this._timeout),this.generation+=1,this._timeout=void 0)}schedule(){this._timeout&&clearTimeout(this._timeout),this._timeout=(0,o.setTimeout)(()=>this._poll(),this.intervalMS)}success(e){this.haMode=!1,this.schedule(),this.emit(d.SRV_RECORD_DISCOVERY,new l(e))}failure(e,t){this.logger.warn(e,t),this.haMode=!0,this.schedule()}parentDomainMismatch(e){this.logger.warn(`parent domain mismatch on SRV record (${e.name}:${e.port})`,e)}_poll(){const e=this.generation;r.resolveSrv(this.srvAddress,(t,n)=>{if(e!==this.generation)return;if(t)return void this.failure("DNS error",t);const r=[];for(const e of n)c(e.name,this.srvHost)?r.push(e):this.parentDomainMismatch(e);r.length?this.success(r):this.failure("No valid addresses found at host")})}}t.SrvPoller=d,d.SRV_RECORD_DISCOVERY="srvRecordDiscovery"},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.FindCursor=t.FLAGS=void 0;const r=n(1),o=n(193),i=n(14),s=n(430),u=n(115),a=n(2),c=n(22),l=Symbol("filter"),d=Symbol("numReturned"),f=Symbol("builtOptions");t.FLAGS=["tailable","oplogReplay","noCursorTimeout","awaitData","exhaust","partial"];class p extends c.AbstractCursor{constructor(e,t,n,r={}){super(e,t,r),this[l]=n||{},this[f]=r,null!=r.sort&&(this[f].sort=(0,u.formatSort)(r.sort))}clone(){const e=(0,a.mergeOptions)({},this[f]);return delete e.session,new p(this.client,this.namespace,this[l],{...e})}map(e){return super.map(e)}_initialize(e,t){const n=new s.FindOperation(void 0,this.namespace,this[l],{...this[f],...this.cursorOptions,session:e});(0,i.executeOperation)(this.client,n,(r,o)=>{if(r||null==o)return t(r);o.cursor?this[d]=o.cursor.firstBatch.length:this[d]=o.documents?o.documents.length:0,t(void 0,{server:n.server,session:e,response:o})})}_getMore(e,t){const n=this[d];if(n){const r=this[f].limit;if((e=r&&r>0&&n+e>r?r-n:e)<=0)return this.close(t)}super._getMore(e,(e,n)=>{if(e)return t(e);n&&(this[d]=this[d]+n.cursor.nextBatch.length),t(void 0,n)})}count(e,t){if((0,a.emitWarningOnce)("cursor.count is deprecated and will be removed in the next major version, please use `collection.estimatedDocumentCount` or `collection.countDocuments` instead "),"boolean"==typeof e)throw new r.MongoInvalidArgumentError("Invalid first parameter to count");return"function"==typeof e&&(t=e,e={}),e=null!=e?e:{},(0,i.executeOperation)(this.client,new o.CountOperation(this.namespace,this[l],{...this[f],...this.cursorOptions,...e}),t)}explain(e,t){return"function"==typeof e&&(t=e,e=!0),null==e&&(e=!0),(0,i.executeOperation)(this.client,new s.FindOperation(void 0,this.namespace,this[l],{...this[f],...this.cursorOptions,explain:e}),t)}filter(e){return(0,c.assertUninitialized)(this),this[l]=e,this}hint(e){return(0,c.assertUninitialized)(this),this[f].hint=e,this}min(e){return(0,c.assertUninitialized)(this),this[f].min=e,this}max(e){return(0,c.assertUninitialized)(this),this[f].max=e,this}returnKey(e){return(0,c.assertUninitialized)(this),this[f].returnKey=e,this}showRecordId(e){return(0,c.assertUninitialized)(this),this[f].showRecordId=e,this}addQueryModifier(e,t){if((0,c.assertUninitialized)(this),"$"!==e[0])throw new r.MongoInvalidArgumentError(`${e} is not a valid query modifier`);switch(e.substr(1)){case"comment":this[f].comment=t;break;case"explain":this[f].explain=t;break;case"hint":this[f].hint=t;break;case"max":this[f].max=t;break;case"maxTimeMS":this[f].maxTimeMS=t;break;case"min":this[f].min=t;break;case"orderby":this[f].sort=(0,u.formatSort)(t);break;case"query":this[l]=t;break;case"returnKey":this[f].returnKey=t;break;case"showDiskLoc":this[f].showRecordId=t;break;default:throw new r.MongoInvalidArgumentError(`Invalid query modifier: ${e}`)}return this}comment(e){return(0,c.assertUninitialized)(this),this[f].comment=e,this}maxAwaitTimeMS(e){if((0,c.assertUninitialized)(this),"number"!=typeof e)throw new r.MongoInvalidArgumentError("Argument for maxAwaitTimeMS must be a number");return this[f].maxAwaitTimeMS=e,this}maxTimeMS(e){if((0,c.assertUninitialized)(this),"number"!=typeof e)throw new r.MongoInvalidArgumentError("Argument for maxTimeMS must be a number");return this[f].maxTimeMS=e,this}project(e){return(0,c.assertUninitialized)(this),this[f].projection=e,this}sort(e,t){if((0,c.assertUninitialized)(this),this[f].tailable)throw new r.MongoTailableCursorError("Tailable cursor does not support sorting");return this[f].sort=(0,u.formatSort)(e,t),this}allowDiskUse(e=!0){if((0,c.assertUninitialized)(this),!this[f].sort)throw new r.MongoInvalidArgumentError('Option "allowDiskUse" requires a sort specification');return e?(this[f].allowDiskUse=!0,this):(this[f].allowDiskUse=!1,this)}collation(e){return(0,c.assertUninitialized)(this),this[f].collation=e,this}limit(e){if((0,c.assertUninitialized)(this),this[f].tailable)throw new r.MongoTailableCursorError("Tailable cursor does not support limit");if("number"!=typeof e)throw new r.MongoInvalidArgumentError('Operation "limit" requires an integer');return this[f].limit=e,this}skip(e){if((0,c.assertUninitialized)(this),this[f].tailable)throw new r.MongoTailableCursorError("Tailable cursor does not support skip");if("number"!=typeof e)throw new r.MongoInvalidArgumentError('Operation "skip" requires an integer');return this[f].skip=e,this}}t.FindCursor=p},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CountOperation=void 0;const r=n(5),o=n(3);class i extends r.CommandOperation{constructor(e,t,n){super({s:{namespace:e}},n),this.options=n,this.collectionName=e.collection,this.query=t}execute(e,t,n){const r=this.options,o={count:this.collectionName,query:this.query};"number"==typeof r.limit&&(o.limit=r.limit),"number"==typeof r.skip&&(o.skip=r.skip),null!=r.hint&&(o.hint=r.hint),"number"==typeof r.maxTimeMS&&(o.maxTimeMS=r.maxTimeMS),super.executeCommand(e,t,o,(e,t)=>{n(e,t?t.n:0)})}}t.CountOperation=i,(0,o.defineAspects)(i,[o.Aspect.READ_OPERATION,o.Aspect.RETRYABLE])},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.FindOneAndUpdateOperation=t.FindOneAndReplaceOperation=t.FindOneAndDeleteOperation=t.ReturnDocument=void 0;const r=n(1),o=n(6),i=n(115),s=n(2),u=n(5),a=n(3);function c(e,n){return e.new=n.returnDocument===t.ReturnDocument.AFTER,e.upsert=!0===n.upsert,!0===n.bypassDocumentValidation&&(e.bypassDocumentValidation=n.bypassDocumentValidation),e}t.ReturnDocument=Object.freeze({BEFORE:"before",AFTER:"after"});class l extends u.CommandOperation{constructor(e,t,n){super(e,n),this.options=null!=n?n:{},this.cmdBase={remove:!1,new:!1,upsert:!1};const r=(0,i.formatSort)(n.sort);r&&(this.cmdBase.sort=r),n.projection&&(this.cmdBase.fields=n.projection),n.maxTimeMS&&(this.cmdBase.maxTimeMS=n.maxTimeMS),n.writeConcern&&(this.cmdBase.writeConcern=n.writeConcern),n.let&&(this.cmdBase.let=n.let),void 0!==n.comment&&(this.cmdBase.comment=n.comment),this.readPreference=o.ReadPreference.primary,this.collection=e,this.query=t}execute(e,t,n){var o;const i=this.collection,u=this.query,a={...this.options,...this.bsonOptions},c={findAndModify:i.collectionName,query:u,...this.cmdBase};try{(0,s.decorateWithCollation)(c,i,a)}catch(e){return n(e)}if(a.hint){if(0===(null===(o=this.writeConcern)||void 0===o?void 0:o.w)||(0,s.maxWireVersion)(e)<8)return void n(new r.MongoCompatibilityError("The current topology does not support a hint on findAndModify commands"));c.hint=a.hint}this.explain&&(0,s.maxWireVersion)(e)<4?n(new r.MongoCompatibilityError(`Server ${e.name} does not support explain on findAndModify`)):super.executeCommand(e,t,c,(e,t)=>e?n(e):n(void 0,t))}}t.FindOneAndDeleteOperation=class extends l{constructor(e,t,n){if(null==t||"object"!=typeof t)throw new r.MongoInvalidArgumentError('Argument "filter" must be an object');super(e,t,n),this.cmdBase.remove=!0}};t.FindOneAndReplaceOperation=class extends l{constructor(e,t,n,o){if(null==t||"object"!=typeof t)throw new r.MongoInvalidArgumentError('Argument "filter" must be an object');if(null==n||"object"!=typeof n)throw new r.MongoInvalidArgumentError('Argument "replacement" must be an object');if((0,s.hasAtomicOperators)(n))throw new r.MongoInvalidArgumentError("Replacement document must not contain atomic operators");super(e,t,o),this.cmdBase.update=n,c(this.cmdBase,o)}};t.FindOneAndUpdateOperation=class extends l{constructor(e,t,n,o){if(null==t||"object"!=typeof t)throw new r.MongoInvalidArgumentError('Argument "filter" must be an object');if(null==n||"object"!=typeof n)throw new r.MongoInvalidArgumentError('Argument "update" must be an object');if(!(0,s.hasAtomicOperators)(n))throw new r.MongoInvalidArgumentError("Update document requires atomic operators");super(e,t,o),this.cmdBase.update=n,c(this.cmdBase,o),o.arrayFilters&&(this.cmdBase.arrayFilters=o.arrayFilters)}},(0,a.defineAspects)(l,[a.Aspect.WRITE_OPERATION,a.Aspect.RETRYABLE,a.Aspect.EXPLAINABLE])},function(e,t,n){const r=n(196);e.exports={packageName:"dbgate-plugin-mongo",drivers:[r]}},function(module,exports,__webpack_require__){const _=__webpack_require__(16),stream=__webpack_require__(25),isPromise=__webpack_require__(197),driverBase=__webpack_require__(198),Analyser=__webpack_require__(200),MongoClient=__webpack_require__(32).MongoClient,ObjectId=__webpack_require__(32).ObjectId,Cursor=__webpack_require__(32).Cursor,createBulkInsertStream=__webpack_require__(440);function transformMongoData(e){return _.mapValues(e,e=>e&&e.constructor==ObjectId?{$oid:e.toString()}:e)}function readCursor(e,t){return new Promise(n=>{t.recordset({__isDynamicStructure:!0}),e.on("data",e=>t.row(transformMongoData(e))),e.on("end",()=>n())})}function convertObjectId(e){return _.cloneDeepWith(e,e=>{if(e&&e.$oid)return ObjectId(e.$oid)})}function findArrayResult(e){if(!_.isPlainObject(e))return null;const t=_.values(e).filter(e=>_.isArray(e));return 1==t.length?t[0]:null}async function getScriptableDb(e){const t=e.__getDatabase(),n=await t.listCollections().toArray();for(const e of n)t[e.name]=t.collection(e.name);return t}const driver={...driverBase,analyserClass:Analyser,async connect({server:e,port:t,user:n,password:r,database:o,useDatabaseUrl:i,databaseUrl:s,ssl:u}){const a=i?s:n?`mongodb://${n}:${r}@${e}:${t}`:`mongodb://${e}:${t}`,c={useUnifiedTopology:!0};u&&(c.tls=!0,c.tlsCAFile=u.ca,c.tlsCertificateKeyFile=u.cert||u.key,c.tlsCertificateKeyFilePassword=u.password,c.tlsAllowInvalidCertificates=!u.rejectUnauthorized);const l=new MongoClient(a,c);return await l.connect(),l.__getDatabase=o?()=>l.db(o):()=>l.db(),l.__databaseName=o,l},query:async(e,t)=>({rows:[],columns:[]}),async script(pool,sql){let func;func=eval(`(db,ObjectId) => { ${sql} }`);const db=await getScriptableDb(pool);func(db,ObjectId)},async stream(pool,sql,options){let func;try{func=eval(`(db,ObjectId) => ${sql}`)}catch(e){return options.info({message:"Error compiling expression: "+e.message,time:new Date,severity:"error"}),void options.done()}const db=await getScriptableDb(pool);let exprValue;try{exprValue=func(db,ObjectId)}catch(e){return options.info({message:"Error evaluating expression: "+e.message,time:new Date,severity:"error"}),void options.done()}if(exprValue instanceof Cursor)await readCursor(exprValue,options);else if(isPromise(exprValue))try{const e=await exprValue;options.info({message:"Command succesfully executed",time:new Date,severity:"info"});try{options.info({message:`Result: ${JSON.stringify(e)}`,time:new Date,severity:"info"})}catch(t){options.info({message:`Result: ${e}`,time:new Date,severity:"info"})}const t=findArrayResult(e);if(t){options.recordset({__isDynamicStructure:!0});for(const e of t)options.row(e)}}catch(e){options.info({message:"Error when running command: "+e.message,time:new Date,severity:"error"})}options.done()},async readQuery(pool,sql,structure){try{const e=JSON.parse(sql);e&&e.pureName&&(sql=`db.${e.pureName}.find()`)}catch(e){}func=eval(`(db,ObjectId) => ${sql}`);const db=await getScriptableDb(pool);return exprValue=func(db,ObjectId),exprValue},async writeTable(e,t,n){return createBulkInsertStream(this,stream,e,t,n)},async getVersion(e){const t=await e.__getDatabase().admin().serverInfo();return{...t,versionText:`MongoDB ${t.version}`}},listDatabases:async e=>(await e.__getDatabase().admin().listDatabases()).databases,async readCollection(e,t){try{const n=e.__getDatabase().collection(t.pureName);if(t.countDocuments){return{count:await n.countDocuments(convertObjectId(t.condition)||{})}}{let e=await n.find(convertObjectId(t.condition)||{});return t.sort&&(e=e.sort(t.sort)),t.skip&&(e=e.skip(t.skip)),t.limit&&(e=e.limit(t.limit)),{rows:(await e.toArray()).map(transformMongoData)}}}catch(e){return{errorMessage:e.message}}},async updateCollection(e,t){const n={inserted:[],updated:[],deleted:[],replaced:[]};try{const r=e.__getDatabase();for(const e of t.inserts){const t=r.collection(e.pureName),o={...e.document,...e.fields},i=await t.insert(convertObjectId(o));n.inserted.push(i._id)}for(const e of t.updates){const t=r.collection(e.pureName);if(e.document){const r={...e.document,...e.fields},o=await t.findOne(convertObjectId(e.condition));if(o){const i=await t.replaceOne(convertObjectId(e.condition),{...convertObjectId(r),_id:o._id});n.replaced.push(i._id)}}else{const r=await t.updateOne(convertObjectId(e.condition),{$set:convertObjectId(e.fields)});n.updated.push(r._id)}}for(const e of t.deletes){const t=r.collection(e.pureName),o=await t.deleteOne(convertObjectId(e.condition));n.deleted.push(o._id)}return n}catch(e){return{errorMessage:e.message}}},async createDatabase(e,t){const n=e.db(t);await n.createCollection("collection1")},async loadFieldValues(e,t,n,r){try{const o=e.__getDatabase().collection(t.pureName),i=[];if(r){const e=_.compact(r.split(" ").map(e=>e.trim()));e.length>0&&i.push({$match:{$and:e.map(e=>({[n]:{$regex:`.*${e}.*`,$options:"i"}}))}})}let s=await o.aggregate([...i,{$group:{_id:"$"+n}},{$sort:{_id:1}},{$limit:100}]);const u=await s.toArray();return _.uniqBy(u.map(transformMongoData).map(({_id:e})=>_.isArray(e)||_.isPlainObject(e)?{value:null}:{value:e}),e=>e.value)}catch(e){return{errorMessage:e.message}}},readJsonQuery(e,t,n){const{collection:r,condition:o,sort:i}=t;return e.__getDatabase().collection(r).find(o||{}).sort(i||{})}};module.exports=driver},function(e,t){function n(e){return!!e&&("object"==typeof e||"function"==typeof e)&&"function"==typeof e.then}e.exports=n,e.exports.default=n},function(e,t,n){const{driverBase:r}=global.DBGATE_TOOLS,o=n(199),{mongoSplitterOptions:i}=n(67);function s(e){return JSON.stringify(e,void 0,2).replace(/\{\s*\"\$oid\"\s*\:\s*\"([0-9a-f]+)\"\s*\}/g,(e,t)=>`ObjectId("${t}")`)}const u={...r,dumperClass:o,databaseEngineTypes:["document"],dialect:{limitSelect:!0,rangeSelect:!0,offsetFetchRangeSyntax:!0,stringEscapeChar:"'",fallbackDataType:"nvarchar(max)",quoteIdentifier:e=>`[${e}]`},engine:"mongo@dbgate-plugin-mongo",title:"MongoDB",editorMode:"javascript",defaultPort:27017,supportsDatabaseUrl:!0,databaseUrlPlaceholder:"e.g. mongodb://username:password@mongodb.mydomain.net/dbname",getQuerySplitterOptions:()=>i,showConnectionField:(e,t)=>"useDatabaseUrl"==e||(t.useDatabaseUrl?["databaseUrl","defaultDatabase","singleDatabase","isReadOnly"].includes(e):["server","port","user","password","defaultDatabase","singleDatabase","isReadOnly"].includes(e)),importExportArgs:[{type:"checkbox",name:"createStringId",label:"Create string _id attribute",apiName:"createStringId",direction:"target"}],getCollectionUpdateScript(e){let t="";for(const n of e.inserts)t+=`db.${n.pureName}.insert(${s({...n.document,...n.fields})});\n`;for(const n of e.updates)n.document?t+=`db.${n.pureName}.replaceOne(${s(n.condition)}, ${s({...n.document,...n.fields})});\n`:t+=`db.${n.pureName}.updateOne(${s(n.condition)}, ${s({$set:n.fields})});\n`;for(const n of e.deletes)t+=`db.${n.pureName}.deleteOne(${s(n.condition)});\n`;return t}};e.exports=u},function(e,t){const{SqlDumper:n}=global.DBGATE_TOOLS;e.exports=class extends n{}},function(e,t,n){const{DatabaseAnalyser:r}=n(201);e.exports=class extends r{constructor(e,t,n){super(e,t,n)}async _runAnalysis(){const e=await this.pool.__getDatabase().listCollections().toArray();return this.mergeAnalyseResult({collections:e.map(e=>({pureName:e.name}))})}}},function(e,t,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),o=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||r(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),o(n(202),t),o(n(203),t),o(n(116),t),o(n(133),t),o(n(285),t),o(n(86),t),o(n(333),t),o(n(149),t),o(n(344),t),o(n(346),t),o(n(153),t),o(n(350),t),o(n(352),t),o(n(94),t),o(n(364),t),o(n(365),t),o(n(366),t),o(n(367),t),o(n(368),t),o(n(369),t)},function(e,t,n){"use strict";function r(e){return e&&/int/i.test(e)}function o(e){return e&&/numeric|decimal/i.test(e)}function i(e){return e&&/float|single|double/i.test(e)}Object.defineProperty(t,"__esModule",{value:!0}),t.isTypeDateTime=t.isTypeLogical=t.isTypeString=t.isTypeNumber=t.isTypeFloat=t.isTypeNumeric=t.isTypeInteger=void 0,t.isTypeInteger=r,t.isTypeNumeric=o,t.isTypeFloat=i,t.isTypeNumber=function(e){return r(e)||i(e)||o(e)},t.isTypeString=function(e){return e&&/char|binary/i.test(e)},t.isTypeLogical=function(e){return e&&/bit|boolean/i.test(e)},t.isTypeDateTime=function(e){return e&&/date|time|timestamp/i.test(e)}},function(e,t,n){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.fillConstraintNames=t.makeUniqueColumnNames=t.findForeignKeyForColumn=t.findObjectLike=t.equalStringLike=t.quoteFullName=t.fullNameToLabel=t.fullNameToString=t.fullNameFromString=void 0;const o=r(n(16));function i(e,t){return(e||"").toLowerCase().trim()==(t||"").toLowerCase().trim()}function s(e,t,n){return`${e}_${t.pureName}_${n.map(e=>e.columnName.replace(" ","_")).join("_")}`}t.fullNameFromString=function(e){const t=e.match(/\[([^\]]+)\]\.\[([^\]]+)\]/);return t?{schemaName:t[1],pureName:t[2]}:{schemaName:null,pureName:e}},t.fullNameToString=function({schemaName:e,pureName:t}){return e?`[${e}].[${t}]`:t},t.fullNameToLabel=function({schemaName:e,pureName:t}){return e?`${e}.${t}`:t},t.quoteFullName=function(e,{schemaName:t,pureName:n}){return t?`${e.quoteIdentifier(t)}.${e.quoteIdentifier(n)}`:`${e.quoteIdentifier(n)}`},t.equalStringLike=i,t.findObjectLike=function({pureName:e,schemaName:t},n,r){var o,s;return n?t?null===(o=n[r])||void 0===o?void 0:o.find(n=>i(n.pureName,e)&&i(n.schemaName,t)):null===(s=n[r])||void 0===s?void 0:s.find(t=>i(t.pureName,e)):null},t.findForeignKeyForColumn=function(e,t){return(e.foreignKeys||[]).find(e=>e.columns.find(e=>e.columnName==t.columnName))},t.makeUniqueColumnNames=function(e){const t=new Set;for(let n=0;n<e.length;n++){if(t.has(e[n].columnName)){let r=2;for(;t.has(`${e[n].columnName}${r}`);)r++;e[n].columnName=`${e[n].columnName}${r}`}t.add(e[n].columnName)}},t.fillConstraintNames=function(e,t){if(!e)return e;const n=o.default.cloneDeep(e);!n.primaryKey||n.primaryKey.constraintName||t.anonymousPrimaryKey||(n.primaryKey.constraintName=`PK_${n.pureName}`);for(const e of n.foreignKeys||[])e.constraintName||(e.constraintName=s("FK",n,e.columns));for(const e of n.indexes||[])e.constraintName||(e.constraintName=s("IX",n,e.columns));for(const e of n.uniques||[])e.constraintName||(e.constraintName=s("UQ",n,e.columns));return n}},function(e,t){e.exports=function(){this.__data__=[],this.size=0}},function(e,t,n){var r=n(47),o=Array.prototype.splice;e.exports=function(e){var t=this.__data__,n=r(t,e);return!(n<0)&&(n==t.length-1?t.pop():o.call(t,n,1),--this.size,!0)}},function(e,t,n){var r=n(47);e.exports=function(e){var t=this.__data__,n=r(t,e);return n<0?void 0:t[n][1]}},function(e,t,n){var r=n(47);e.exports=function(e){return r(this.__data__,e)>-1}},function(e,t,n){var r=n(47);e.exports=function(e,t){var n=this.__data__,o=r(n,e);return o<0?(++this.size,n.push([e,t])):n[o][1]=t,this}},function(e,t,n){var r=n(46);e.exports=function(){this.__data__=new r,this.size=0}},function(e,t){e.exports=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n}},function(e,t){e.exports=function(e){return this.__data__.get(e)}},function(e,t){e.exports=function(e){return this.__data__.has(e)}},function(e,t,n){var r=n(46),o=n(70),i=n(71);e.exports=function(e,t){var n=this.__data__;if(n instanceof r){var s=n.__data__;if(!o||s.length<199)return s.push([e,t]),this.size=++n.size,this;n=this.__data__=new i(s)}return n.set(e,t),this.size=n.size,this}},function(e,t,n){var r=n(118),o=n(217),i=n(19),s=n(120),u=/^\[object .+?Constructor\]$/,a=Function.prototype,c=Object.prototype,l=a.toString,d=c.hasOwnProperty,f=RegExp("^"+l.call(d).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");e.exports=function(e){return!(!i(e)||o(e))&&(r(e)?f:u).test(s(e))}},function(e,t,n){var r=n(26),o=Object.prototype,i=o.hasOwnProperty,s=o.toString,u=r?r.toStringTag:void 0;e.exports=function(e){var t=i.call(e,u),n=e[u];try{e[u]=void 0;var r=!0}catch(e){}var o=s.call(e);return r&&(t?e[u]=n:delete e[u]),o}},function(e,t){var n=Object.prototype.toString;e.exports=function(e){return n.call(e)}},function(e,t,n){var r,o=n(218),i=(r=/[^.]+$/.exec(o&&o.keys&&o.keys.IE_PROTO||""))?"Symbol(src)_1."+r:"";e.exports=function(e){return!!i&&i in e}},function(e,t,n){var r=n(15)["__core-js_shared__"];e.exports=r},function(e,t){e.exports=function(e,t){return null==e?void 0:e[t]}},function(e,t,n){var r=n(221),o=n(46),i=n(70);e.exports=function(){this.size=0,this.__data__={hash:new r,map:new(i||o),string:new r}}},function(e,t,n){var r=n(222),o=n(223),i=n(224),s=n(225),u=n(226);function a(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}a.prototype.clear=r,a.prototype.delete=o,a.prototype.get=i,a.prototype.has=s,a.prototype.set=u,e.exports=a},function(e,t,n){var r=n(49);e.exports=function(){this.__data__=r?r(null):{},this.size=0}},function(e,t){e.exports=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}},function(e,t,n){var r=n(49),o=Object.prototype.hasOwnProperty;e.exports=function(e){var t=this.__data__;if(r){var n=t[e];return"__lodash_hash_undefined__"===n?void 0:n}return o.call(t,e)?t[e]:void 0}},function(e,t,n){var r=n(49),o=Object.prototype.hasOwnProperty;e.exports=function(e){var t=this.__data__;return r?void 0!==t[e]:o.call(t,e)}},function(e,t,n){var r=n(49);e.exports=function(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=r&&void 0===t?"__lodash_hash_undefined__":t,this}},function(e,t,n){var r=n(50);e.exports=function(e){var t=r(this,e).delete(e);return this.size-=t?1:0,t}},function(e,t){e.exports=function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e}},function(e,t,n){var r=n(50);e.exports=function(e){return r(this,e).get(e)}},function(e,t,n){var r=n(50);e.exports=function(e){return r(this,e).has(e)}},function(e,t,n){var r=n(50);e.exports=function(e,t){var n=r(this,e),o=n.size;return n.set(e,t),this.size+=n.size==o?0:1,this}},function(e,t){e.exports=function(e,t){for(var n=-1,r=null==e?0:e.length;++n<r&&!1!==t(e[n],n,e););return e}},function(e,t,n){var r=n(36),o=n(37);e.exports=function(e,t){return e&&r(t,o(t),e)}},function(e,t){e.exports=function(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r}},function(e,t,n){var r=n(17),o=n(10);e.exports=function(e){return o(e)&&"[object Arguments]"==r(e)}},function(e,t){e.exports=function(){return!1}},function(e,t,n){var r=n(17),o=n(76),i=n(10),s={};s["[object Float32Array]"]=s["[object Float64Array]"]=s["[object Int8Array]"]=s["[object Int16Array]"]=s["[object Int32Array]"]=s["[object Uint8Array]"]=s["[object Uint8ClampedArray]"]=s["[object Uint16Array]"]=s["[object Uint32Array]"]=!0,s["[object Arguments]"]=s["[object Array]"]=s["[object ArrayBuffer]"]=s["[object Boolean]"]=s["[object DataView]"]=s["[object Date]"]=s["[object Error]"]=s["[object Function]"]=s["[object Map]"]=s["[object Number]"]=s["[object Object]"]=s["[object RegExp]"]=s["[object Set]"]=s["[object String]"]=s["[object WeakMap]"]=!1,e.exports=function(e){return i(e)&&o(e.length)&&!!s[r(e)]}},function(e,t,n){var r=n(77),o=n(239),i=Object.prototype.hasOwnProperty;e.exports=function(e){if(!r(e))return o(e);var t=[];for(var n in Object(e))i.call(e,n)&&"constructor"!=n&&t.push(n);return t}},function(e,t,n){var r=n(124)(Object.keys,Object);e.exports=r},function(e,t,n){var r=n(36),o=n(78);e.exports=function(e,t){return e&&r(t,o(t),e)}},function(e,t,n){var r=n(19),o=n(77),i=n(242),s=Object.prototype.hasOwnProperty;e.exports=function(e){if(!r(e))return i(e);var t=o(e),n=[];for(var u in e)("constructor"!=u||!t&&s.call(e,u))&&n.push(u);return n}},function(e,t){e.exports=function(e){var t=[];if(null!=e)for(var n in Object(e))t.push(n);return t}},function(e,t,n){(function(e){var r=n(15),o=t&&!t.nodeType&&t,i=o&&"object"==typeof e&&e&&!e.nodeType&&e,s=i&&i.exports===o?r.Buffer:void 0,u=s?s.allocUnsafe:void 0;e.exports=function(e,t){if(t)return e.slice();var n=e.length,r=u?u(n):new e.constructor(n);return e.copy(r),r}}).call(this,n(45)(e))},function(e,t){e.exports=function(e,t){var n=-1,r=e.length;for(t||(t=Array(r));++n<r;)t[n]=e[n];return t}},function(e,t,n){var r=n(36),o=n(79);e.exports=function(e,t){return r(e,o(e),t)}},function(e,t){e.exports=function(e,t){for(var n=-1,r=null==e?0:e.length,o=0,i=[];++n<r;){var s=e[n];t(s,n,e)&&(i[o++]=s)}return i}},function(e,t,n){var r=n(36),o=n(126);e.exports=function(e,t){return r(e,o(e),t)}},function(e,t,n){var r=n(20)(n(15),"DataView");e.exports=r},function(e,t,n){var r=n(20)(n(15),"Promise");e.exports=r},function(e,t,n){var r=n(20)(n(15),"WeakMap");e.exports=r},function(e,t){var n=Object.prototype.hasOwnProperty;e.exports=function(e){var t=e.length,r=new e.constructor(t);return t&&"string"==typeof e[0]&&n.call(e,"index")&&(r.index=e.index,r.input=e.input),r}},function(e,t,n){var r=n(82),o=n(253),i=n(254),s=n(255),u=n(256);e.exports=function(e,t,n){var a=e.constructor;switch(t){case"[object ArrayBuffer]":return r(e);case"[object Boolean]":case"[object Date]":return new a(+e);case"[object DataView]":return o(e,n);case"[object Float32Array]":case"[object Float64Array]":case"[object Int8Array]":case"[object Int16Array]":case"[object Int32Array]":case"[object Uint8Array]":case"[object Uint8ClampedArray]":case"[object Uint16Array]":case"[object Uint32Array]":return u(e,n);case"[object Map]":return new a;case"[object Number]":case"[object String]":return new a(e);case"[object RegExp]":return i(e);case"[object Set]":return new a;case"[object Symbol]":return s(e)}}},function(e,t,n){var r=n(82);e.exports=function(e,t){var n=t?r(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}},function(e,t){var n=/\w*$/;e.exports=function(e){var t=new e.constructor(e.source,n.exec(e));return t.lastIndex=e.lastIndex,t}},function(e,t,n){var r=n(26),o=r?r.prototype:void 0,i=o?o.valueOf:void 0;e.exports=function(e){return i?Object(i.call(e)):{}}},function(e,t,n){var r=n(82);e.exports=function(e,t){var n=t?r(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}},function(e,t,n){var r=n(258),o=n(81),i=n(77);e.exports=function(e){return"function"!=typeof e.constructor||i(e)?{}:r(o(e))}},function(e,t,n){var r=n(19),o=Object.create,i=function(){function e(){}return function(t){if(!r(t))return{};if(o)return o(t);e.prototype=t;var n=new e;return e.prototype=void 0,n}}();e.exports=i},function(e,t,n){var r=n(260),o=n(27),i=n(52),s=i&&i.isMap,u=s?o(s):r;e.exports=u},function(e,t,n){var r=n(53),o=n(10);e.exports=function(e){return o(e)&&"[object Map]"==r(e)}},function(e,t,n){var r=n(262),o=n(27),i=n(52),s=i&&i.isSet,u=s?o(s):r;e.exports=u},function(e,t,n){var r=n(53),o=n(10);e.exports=function(e){return o(e)&&"[object Set]"==r(e)}},function(e,t){e.exports=function(e){for(var t=-1,n=null==e?0:e.length,r={};++t<n;){var o=e[t];r[o[0]]=o[1]}return r}},function(e,t,n){var r=n(265),o=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,i=/\\(\\)?/g,s=r((function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(o,(function(e,n,r,o){t.push(r?o.replace(i,"$1"):n||e)})),t}));e.exports=s},function(e,t,n){var r=n(266);e.exports=function(e){var t=r(e,(function(e){return 500===n.size&&n.clear(),e})),n=t.cache;return t}},function(e,t,n){var r=n(71);function o(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new TypeError("Expected a function");var n=function(){var r=arguments,o=t?t.apply(this,r):r[0],i=n.cache;if(i.has(o))return i.get(o);var s=e.apply(this,r);return n.cache=i.set(o,s)||i,s};return n.cache=new(o.Cache||r),n}o.Cache=r,e.exports=o},function(e,t,n){var r=n(26),o=n(39),i=n(7),s=n(54),u=r?r.prototype:void 0,a=u?u.toString:void 0;e.exports=function e(t){if("string"==typeof t)return t;if(i(t))return o(t,e)+"";if(s(t))return a?a.call(t):"";var n=t+"";return"0"==n&&1/t==-1/0?"-0":n}},function(e,t,n){var r=n(269),o=n(276)((function(e,t,n){return t=t.toLowerCase(),e+(n?r(t):t)}));e.exports=o},function(e,t,n){var r=n(30),o=n(270);e.exports=function(e){return o(r(e).toLowerCase())}},function(e,t,n){var r=n(271)("toUpperCase");e.exports=r},function(e,t,n){var r=n(272),o=n(135),i=n(273),s=n(30);e.exports=function(e){return function(t){t=s(t);var n=o(t)?i(t):void 0,u=n?n[0]:t.charAt(0),a=n?r(n,1).join(""):t.slice(1);return u[e]()+a}}},function(e,t,n){var r=n(134);e.exports=function(e,t,n){var o=e.length;return n=void 0===n?o:n,!t&&n>=o?e:r(e,t,n)}},function(e,t,n){var r=n(274),o=n(135),i=n(275);e.exports=function(e){return o(e)?i(e):r(e)}},function(e,t){e.exports=function(e){return e.split("")}},function(e,t){var n="[\\ud800-\\udfff]",r="[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]",o="\\ud83c[\\udffb-\\udfff]",i="[^\\ud800-\\udfff]",s="(?:\\ud83c[\\udde6-\\uddff]){2}",u="[\\ud800-\\udbff][\\udc00-\\udfff]",a="(?:"+r+"|"+o+")"+"?",c="[\\ufe0e\\ufe0f]?"+a+("(?:\\u200d(?:"+[i,s,u].join("|")+")[\\ufe0e\\ufe0f]?"+a+")*"),l="(?:"+[i+r+"?",r,s,u,n].join("|")+")",d=RegExp(o+"(?="+o+")|"+l+c,"g");e.exports=function(e){return e.match(d)||[]}},function(e,t,n){var r=n(277),o=n(278),i=n(281),s=RegExp("['’]","g");e.exports=function(e){return function(t){return r(i(o(t).replace(s,"")),e,"")}}},function(e,t){e.exports=function(e,t,n,r){var o=-1,i=null==e?0:e.length;for(r&&i&&(n=e[++o]);++o<i;)n=t(n,e[o],o,e);return n}},function(e,t,n){var r=n(279),o=n(30),i=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,s=RegExp("[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]","g");e.exports=function(e){return(e=o(e))&&e.replace(i,r).replace(s,"")}},function(e,t,n){var r=n(280)({"À":"A","Á":"A","Â":"A","Ã":"A","Ä":"A","Å":"A","à":"a","á":"a","â":"a","ã":"a","ä":"a","å":"a","Ç":"C","ç":"c","Ð":"D","ð":"d","È":"E","É":"E","Ê":"E","Ë":"E","è":"e","é":"e","ê":"e","ë":"e","Ì":"I","Í":"I","Î":"I","Ï":"I","ì":"i","í":"i","î":"i","ï":"i","Ñ":"N","ñ":"n","Ò":"O","Ó":"O","Ô":"O","Õ":"O","Ö":"O","Ø":"O","ò":"o","ó":"o","ô":"o","õ":"o","ö":"o","ø":"o","Ù":"U","Ú":"U","Û":"U","Ü":"U","ù":"u","ú":"u","û":"u","ü":"u","Ý":"Y","ý":"y","ÿ":"y","Æ":"Ae","æ":"ae","Þ":"Th","þ":"th","ß":"ss","Ā":"A","Ă":"A","Ą":"A","ā":"a","ă":"a","ą":"a","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","ć":"c","ĉ":"c","ċ":"c","č":"c","Ď":"D","Đ":"D","ď":"d","đ":"d","Ē":"E","Ĕ":"E","Ė":"E","Ę":"E","Ě":"E","ē":"e","ĕ":"e","ė":"e","ę":"e","ě":"e","Ĝ":"G","Ğ":"G","Ġ":"G","Ģ":"G","ĝ":"g","ğ":"g","ġ":"g","ģ":"g","Ĥ":"H","Ħ":"H","ĥ":"h","ħ":"h","Ĩ":"I","Ī":"I","Ĭ":"I","Į":"I","İ":"I","ĩ":"i","ī":"i","ĭ":"i","į":"i","ı":"i","Ĵ":"J","ĵ":"j","Ķ":"K","ķ":"k","ĸ":"k","Ĺ":"L","Ļ":"L","Ľ":"L","Ŀ":"L","Ł":"L","ĺ":"l","ļ":"l","ľ":"l","ŀ":"l","ł":"l","Ń":"N","Ņ":"N","Ň":"N","Ŋ":"N","ń":"n","ņ":"n","ň":"n","ŋ":"n","Ō":"O","Ŏ":"O","Ő":"O","ō":"o","ŏ":"o","ő":"o","Ŕ":"R","Ŗ":"R","Ř":"R","ŕ":"r","ŗ":"r","ř":"r","Ś":"S","Ŝ":"S","Ş":"S","Š":"S","ś":"s","ŝ":"s","ş":"s","š":"s","Ţ":"T","Ť":"T","Ŧ":"T","ţ":"t","ť":"t","ŧ":"t","Ũ":"U","Ū":"U","Ŭ":"U","Ů":"U","Ű":"U","Ų":"U","ũ":"u","ū":"u","ŭ":"u","ů":"u","ű":"u","ų":"u","Ŵ":"W","ŵ":"w","Ŷ":"Y","ŷ":"y","Ÿ":"Y","Ź":"Z","Ż":"Z","Ž":"Z","ź":"z","ż":"z","ž":"z","IJ":"IJ","ij":"ij","Œ":"Oe","œ":"oe","ʼn":"'n","ſ":"s"});e.exports=r},function(e,t){e.exports=function(e){return function(t){return null==e?void 0:e[t]}}},function(e,t,n){var r=n(282),o=n(283),i=n(30),s=n(284);e.exports=function(e,t,n){return e=i(e),void 0===(t=n?void 0:t)?o(e)?s(e):r(e):e.match(t)||[]}},function(e,t){var n=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;e.exports=function(e){return e.match(n)||[]}},function(e,t){var n=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;e.exports=function(e){return n.test(e)}},function(e,t){var n="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",r="["+n+"]",o="\\d+",i="[\\u2700-\\u27bf]",s="[a-z\\xdf-\\xf6\\xf8-\\xff]",u="[^\\ud800-\\udfff"+n+o+"\\u2700-\\u27bfa-z\\xdf-\\xf6\\xf8-\\xffA-Z\\xc0-\\xd6\\xd8-\\xde]",a="(?:\\ud83c[\\udde6-\\uddff]){2}",c="[\\ud800-\\udbff][\\udc00-\\udfff]",l="[A-Z\\xc0-\\xd6\\xd8-\\xde]",d="(?:"+s+"|"+u+")",f="(?:"+l+"|"+u+")",p="(?:[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]|\\ud83c[\\udffb-\\udfff])?",h="[\\ufe0e\\ufe0f]?"+p+("(?:\\u200d(?:"+["[^\\ud800-\\udfff]",a,c].join("|")+")[\\ufe0e\\ufe0f]?"+p+")*"),m="(?:"+[i,a,c].join("|")+")"+h,g=RegExp([l+"?"+s+"+(?:['’](?:d|ll|m|re|s|t|ve))?(?="+[r,l,"$"].join("|")+")",f+"+(?:['’](?:D|LL|M|RE|S|T|VE))?(?="+[r,l+d,"$"].join("|")+")",l+"?"+d+"+(?:['’](?:d|ll|m|re|s|t|ve))?",l+"+(?:['’](?:D|LL|M|RE|S|T|VE))?","\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",o,m].join("|"),"g");e.exports=function(e){return e.match(g)||[]}},function(e,t,n){"use strict";var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{a(r.next(e))}catch(e){i(e)}}function u(e){try{a(r.throw(e))}catch(e){i(e)}}function a(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,u)}a((r=r.apply(e,t||[])).next())}))},o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.createBulkInsertStreamBase=void 0;const i=o(n(286)),s=n(116);t.createBulkInsertStreamBase=function(e,t,n,o,u){const a=o.schemaName?`${e.dialect.quoteIdentifier(o.schemaName)}.${e.dialect.quoteIdentifier(o.pureName)}`:e.dialect.quoteIdentifier(o.pureName),c=new t.Writable({objectMode:!0});return c.buffer=[],c.structure=null,c.columnNames=null,c.requireFixedStructure=e.databaseEngineTypes.includes("sql"),c.addRow=e=>r(this,void 0,void 0,(function*(){c.structure?c.buffer.push(e):(c.structure=e,yield c.checkStructure())})),c.checkStructure=()=>r(this,void 0,void 0,(function*(){let t=yield e.analyseSingleTable(n,o);if(t&&u.dropIfExists&&(console.log(`Dropping table ${a}`),yield e.script(n,`DROP TABLE ${a}`)),u.createIfNotExists&&(!t||u.dropIfExists)){console.log(`Creating table ${a}`);const r=e.createDumper();r.createTable((0,s.prepareTableForImport)(Object.assign(Object.assign({},c.structure),o))),console.log(r.s),yield e.script(n,r.s),t=yield e.analyseSingleTable(n,o)}u.truncate&&(yield e.script(n,`TRUNCATE TABLE ${a}`)),c.columnNames=(0,i.default)(t.columns.map(e=>e.columnName),c.structure.columns.map(e=>e.columnName))})),c.send=()=>r(this,void 0,void 0,(function*(){const t=c.buffer;c.buffer=[];const r=e.createDumper();r.putRaw(`INSERT INTO ${a} (`),r.putCollection(",",c.columnNames,t=>r.putRaw(e.dialect.quoteIdentifier(t))),r.putRaw(")\n VALUES\n");let o=!1;for(const e of t)o&&r.putRaw(",\n"),r.putRaw("("),r.putCollection(",",c.columnNames,t=>r.putValue(e[t])),r.putRaw(")"),o=!0;r.putRaw(";"),yield e.query(n,r.s)})),c.sendIfFull=()=>r(this,void 0,void 0,(function*(){c.buffer.length>100&&(yield c.send())})),c._write=(e,t,n)=>r(this,void 0,void 0,(function*(){yield c.addRow(e),yield c.sendIfFull(),n()})),c._final=e=>r(this,void 0,void 0,(function*(){yield c.send(),e()})),c}},function(e,t,n){var r=n(39),o=n(287),i=n(138),s=n(298),u=i((function(e){var t=r(e,s);return t.length&&t[0]===e[0]?o(t):[]}));e.exports=u},function(e,t,n){var r=n(84),o=n(136),i=n(137),s=n(39),u=n(27),a=n(85),c=Math.min;e.exports=function(e,t,n){for(var l=n?i:o,d=e[0].length,f=e.length,p=f,h=Array(f),m=1/0,g=[];p--;){var E=e[p];p&&t&&(E=s(E,u(t))),m=c(E.length,m),h[p]=!n&&(t||d>=120&&E.length>=120)?new r(p&&E):void 0}E=e[0];var y=-1,v=h[0];e:for(;++y<d&&g.length<m;){var A=E[y],b=t?t(A):A;if(A=n||0!==A?A:0,!(v?a(v,b):l(g,b,n))){for(p=f;--p;){var C=h[p];if(!(C?a(C,b):l(e[p],b,n)))continue e}v&&v.push(b),g.push(A)}}return g}},function(e,t){e.exports=function(e){return this.__data__.set(e,"__lodash_hash_undefined__"),this}},function(e,t){e.exports=function(e){return this.__data__.has(e)}},function(e,t,n){var r=n(291),o=n(292),i=n(293);e.exports=function(e,t,n){return t==t?i(e,t,n):r(e,o,n)}},function(e,t){e.exports=function(e,t,n,r){for(var o=e.length,i=n+(r?1:-1);r?i--:++i<o;)if(t(e[i],i,e))return i;return-1}},function(e,t){e.exports=function(e){return e!=e}},function(e,t){e.exports=function(e,t,n){for(var r=n-1,o=e.length;++r<o;)if(e[r]===t)return r;return-1}},function(e,t){e.exports=function(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}},function(e,t,n){var r=n(296),o=n(121),i=n(56),s=o?function(e,t){return o(e,"toString",{configurable:!0,enumerable:!1,value:r(t),writable:!0})}:i;e.exports=s},function(e,t){e.exports=function(e){return function(){return e}}},function(e,t){var n=Date.now;e.exports=function(e){var t=0,r=0;return function(){var o=n(),i=16-(o-r);if(r=o,i>0){if(++t>=800)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}},function(e,t,n){var r=n(299);e.exports=function(e){return r(e)?e:[]}},function(e,t,n){var r=n(28),o=n(10);e.exports=function(e){return o(e)&&r(e)}},function(e,t,n){var r=n(141),o=n(302),i=n(138),s=n(325),u=i((function(e,t){if(null==e)return[];var n=t.length;return n>1&&s(e,t[0],t[1])?t=[]:n>2&&s(t[0],t[1],t[2])&&(t=[t[0]]),o(e,r(t,1),[])}));e.exports=u},function(e,t,n){var r=n(26),o=n(74),i=n(7),s=r?r.isConcatSpreadable:void 0;e.exports=function(e){return i(e)||o(e)||!!(s&&e&&e[s])}},function(e,t,n){var r=n(39),o=n(38),i=n(87),s=n(317),u=n(322),a=n(27),c=n(323),l=n(56),d=n(7);e.exports=function(e,t,n){t=t.length?r(t,(function(e){return d(e)?function(t){return o(t,1===e.length?e[0]:e)}:e})):[l];var f=-1;t=r(t,a(i));var p=s(e,(function(e,n,o){return{criteria:r(t,(function(t){return t(e)})),index:++f,value:e}}));return u(p,(function(e,t){return c(e,t,n)}))}},function(e,t,n){var r=n(304),o=n(310),i=n(144);e.exports=function(e){var t=o(e);return 1==t.length&&t[0][2]?i(t[0][0],t[0][1]):function(n){return n===e||r(n,e,t)}}},function(e,t,n){var r=n(69),o=n(88);e.exports=function(e,t,n,i){var s=n.length,u=s,a=!i;if(null==e)return!u;for(e=Object(e);s--;){var c=n[s];if(a&&c[2]?c[1]!==e[c[0]]:!(c[0]in e))return!1}for(;++s<u;){var l=(c=n[s])[0],d=e[l],f=c[1];if(a&&c[2]){if(void 0===d&&!(l in e))return!1}else{var p=new r;if(i)var h=i(d,f,l,e,t,p);if(!(void 0===h?o(f,d,3,i,p):h))return!1}}return!0}},function(e,t,n){var r=n(69),o=n(142),i=n(307),s=n(309),u=n(53),a=n(7),c=n(75),l=n(123),d="[object Object]",f=Object.prototype.hasOwnProperty;e.exports=function(e,t,n,p,h,m){var g=a(e),E=a(t),y=g?"[object Array]":u(e),v=E?"[object Array]":u(t),A=(y="[object Arguments]"==y?d:y)==d,b=(v="[object Arguments]"==v?d:v)==d,C=y==v;if(C&&c(e)){if(!c(t))return!1;g=!0,A=!1}if(C&&!A)return m||(m=new r),g||l(e)?o(e,t,n,p,h,m):i(e,t,y,n,p,h,m);if(!(1&n)){var S=A&&f.call(e,"__wrapped__"),O=b&&f.call(t,"__wrapped__");if(S||O){var _=S?e.value():e,w=O?t.value():t;return m||(m=new r),h(_,w,n,p,m)}}return!!C&&(m||(m=new r),s(e,t,n,p,h,m))}},function(e,t){e.exports=function(e,t){for(var n=-1,r=null==e?0:e.length;++n<r;)if(t(e[n],n,e))return!0;return!1}},function(e,t,n){var r=n(26),o=n(131),i=n(48),s=n(142),u=n(308),a=n(89),c=r?r.prototype:void 0,l=c?c.valueOf:void 0;e.exports=function(e,t,n,r,c,d,f){switch(n){case"[object DataView]":if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case"[object ArrayBuffer]":return!(e.byteLength!=t.byteLength||!d(new o(e),new o(t)));case"[object Boolean]":case"[object Date]":case"[object Number]":return i(+e,+t);case"[object Error]":return e.name==t.name&&e.message==t.message;case"[object RegExp]":case"[object String]":return e==t+"";case"[object Map]":var p=u;case"[object Set]":var h=1&r;if(p||(p=a),e.size!=t.size&&!h)return!1;var m=f.get(e);if(m)return m==t;r|=2,f.set(e,t);var g=s(p(e),p(t),r,c,d,f);return f.delete(e),g;case"[object Symbol]":if(l)return l.call(e)==l.call(t)}return!1}},function(e,t){e.exports=function(e){var t=-1,n=Array(e.size);return e.forEach((function(e,r){n[++t]=[r,e]})),n}},function(e,t,n){var r=n(127),o=Object.prototype.hasOwnProperty;e.exports=function(e,t,n,i,s,u){var a=1&n,c=r(e),l=c.length;if(l!=r(t).length&&!a)return!1;for(var d=l;d--;){var f=c[d];if(!(a?f in t:o.call(t,f)))return!1}var p=u.get(e),h=u.get(t);if(p&&h)return p==t&&h==e;var m=!0;u.set(e,t),u.set(t,e);for(var g=a;++d<l;){var E=e[f=c[d]],y=t[f];if(i)var v=a?i(y,E,f,t,e,u):i(E,y,f,e,t,u);if(!(void 0===v?E===y||s(E,y,n,i,u):v)){m=!1;break}g||(g="constructor"==f)}if(m&&!g){var A=e.constructor,b=t.constructor;A!=b&&"constructor"in e&&"constructor"in t&&!("function"==typeof A&&A instanceof A&&"function"==typeof b&&b instanceof b)&&(m=!1)}return u.delete(e),u.delete(t),m}},function(e,t,n){var r=n(143),o=n(37);e.exports=function(e){for(var t=o(e),n=t.length;n--;){var i=t[n],s=e[i];t[n]=[i,s,r(s)]}return t}},function(e,t,n){var r=n(88),o=n(132),i=n(145),s=n(83),u=n(143),a=n(144),c=n(31);e.exports=function(e,t){return s(e)&&u(t)?a(c(e),t):function(n){var s=o(n,e);return void 0===s&&s===t?i(n,e):r(t,s,3)}}},function(e,t){e.exports=function(e,t){return null!=e&&t in Object(e)}},function(e,t,n){var r=n(29),o=n(74),i=n(7),s=n(51),u=n(76),a=n(31);e.exports=function(e,t,n){for(var c=-1,l=(t=r(t,e)).length,d=!1;++c<l;){var f=a(t[c]);if(!(d=null!=e&&n(e,f)))break;e=e[f]}return d||++c!=l?d:!!(l=null==e?0:e.length)&&u(l)&&s(f,l)&&(i(e)||o(e))}},function(e,t,n){var r=n(315),o=n(316),i=n(83),s=n(31);e.exports=function(e){return i(e)?r(s(e)):o(e)}},function(e,t){e.exports=function(e){return function(t){return null==t?void 0:t[e]}}},function(e,t,n){var r=n(38);e.exports=function(e){return function(t){return r(t,e)}}},function(e,t,n){var r=n(146),o=n(28);e.exports=function(e,t){var n=-1,i=o(e)?Array(e.length):[];return r(e,(function(e,r,o){i[++n]=t(e,r,o)})),i}},function(e,t,n){var r=n(319),o=n(37);e.exports=function(e,t){return e&&r(e,t,o)}},function(e,t,n){var r=n(320)();e.exports=r},function(e,t){e.exports=function(e){return function(t,n,r){for(var o=-1,i=Object(t),s=r(t),u=s.length;u--;){var a=s[e?u:++o];if(!1===n(i[a],a,i))break}return t}}},function(e,t,n){var r=n(28);e.exports=function(e,t){return function(n,o){if(null==n)return n;if(!r(n))return e(n,o);for(var i=n.length,s=t?i:-1,u=Object(n);(t?s--:++s<i)&&!1!==o(u[s],s,u););return n}}},function(e,t){e.exports=function(e,t){var n=e.length;for(e.sort(t);n--;)e[n]=e[n].value;return e}},function(e,t,n){var r=n(324);e.exports=function(e,t,n){for(var o=-1,i=e.criteria,s=t.criteria,u=i.length,a=n.length;++o<u;){var c=r(i[o],s[o]);if(c)return o>=a?c:c*("desc"==n[o]?-1:1)}return e.index-t.index}},function(e,t,n){var r=n(54);e.exports=function(e,t){if(e!==t){var n=void 0!==e,o=null===e,i=e==e,s=r(e),u=void 0!==t,a=null===t,c=t==t,l=r(t);if(!a&&!l&&!s&&e>t||s&&u&&c&&!a&&!l||o&&u&&c||!n&&c||!i)return 1;if(!o&&!s&&!l&&e<t||l&&n&&i&&!o&&!s||a&&n&&i||!u&&i||!c)return-1}return 0}},function(e,t,n){var r=n(48),o=n(28),i=n(51),s=n(19);e.exports=function(e,t,n){if(!s(n))return!1;var u=typeof t;return!!("number"==u?o(n)&&i(t,n.length):"string"==u&&t in n)&&r(n[t],e)}},function(e,t,n){var r=n(73),o=n(327),i=Object.prototype.hasOwnProperty,s=o((function(e,t,n){i.call(e,n)?e[n].push(t):r(e,n,[t])}));e.exports=s},function(e,t,n){var r=n(328),o=n(329),i=n(87),s=n(7);e.exports=function(e,t){return function(n,u){var a=s(n)?r:o,c=t?t():{};return a(n,e,i(u,2),c)}}},function(e,t){e.exports=function(e,t,n,r){for(var o=-1,i=null==e?0:e.length;++o<i;){var s=e[o];t(r,s,n(s),e)}return r}},function(e,t,n){var r=n(146);e.exports=function(e,t,n,o){return r(e,(function(e,r,i){t(o,e,n(e),i)})),o}},function(e,t,n){var r=n(331),o=n(145);e.exports=function(e,t){return r(e,t,(function(t,n){return o(e,n)}))}},function(e,t,n){var r=n(38),o=n(332),i=n(29);e.exports=function(e,t,n){for(var s=-1,u=t.length,a={};++s<u;){var c=t[s],l=r(e,c);n(l,c)&&o(a,i(c,e),l)}return a}},function(e,t,n){var r=n(72),o=n(29),i=n(51),s=n(19),u=n(31);e.exports=function(e,t,n,a){if(!s(e))return e;for(var c=-1,l=(t=o(t,e)).length,d=l-1,f=e;null!=f&&++c<l;){var p=u(t[c]),h=n;if("__proto__"===p||"constructor"===p||"prototype"===p)return e;if(c!=d){var m=f[p];void 0===(h=a?a(m,p,f):void 0)&&(h=s(m)?m:i(t[c+1])?[]:{})}r(f,p,h),f=f[p]}return e}},function(e,t,n){"use strict";var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{a(r.next(e))}catch(e){i(e)}}function u(e){try{a(r.throw(e))}catch(e){i(e)}}function a(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,u)}a((r=r.apply(e,t||[])).next())}))},o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.driverBase=void 0;const i=o(n(41)),s=n(149),u=n(338),a=n(340),c={limitSelect:!0,rangeSelect:!0,offsetFetchRangeSyntax:!0,stringEscapeChar:"'",fallbackDataType:"nvarchar(max)",quoteIdentifier:e=>e,columnProperties:{isSparse:!1,isPersisted:!1}};t.driverBase={analyserClass:null,dumperClass:s.SqlDumper,dialect:c,databaseEngineTypes:["sql"],supportedCreateDatabase:!0,analyseFull(e,t){return r(this,void 0,void 0,(function*(){return new this.analyserClass(e,this,t).fullAnalysis()}))},analyseSingleObject(e,t,n="tables"){return r(this,void 0,void 0,(function*(){return new this.analyserClass(e,this).singleObjectAnalysis(t,n)}))},analyseSingleTable(e,t){return this.analyseSingleObject(e,t,"tables")},analyseIncremental(e,t,n){return r(this,void 0,void 0,(function*(){return new this.analyserClass(e,this,n).incrementalAnalysis(t)}))},createDumper(e=null){return new this.dumperClass(this,e)},script(e,t){return r(this,void 0,void 0,(function*(){for(const n of(0,u.splitQuery)(t,this.getQuerySplitterOptions("script")))yield this.query(e,n,{discardResult:!0})}))},getNewObjectTemplates(){return this.databaseEngineTypes.includes("sql")?[{label:"New view",sql:"CREATE VIEW myview\nAS\nSELECT * FROM table1"}]:[]},loadFieldValues(e,t,n,o){return r(this,void 0,void 0,(function*(){const r=this.createDumper(),s={commandType:"select",distinct:!0,topRecords:100,from:{name:t},columns:[{exprType:"column",columnName:n,alias:"value"}],orderBy:[{exprType:"column",columnName:n}]};if(o){const e=(0,i.default)(o.split(" ").map(e=>e.trim()));e.length>0&&(s.where={conditionType:"and",conditions:e.map(e=>({conditionType:"like",left:{exprType:"column",columnName:n},right:{exprType:"value",value:`%${e}%`}}))})}return(0,a.dumpSqlSelect)(r,s),(yield this.query(e,r.s)).rows}))},readJsonQuery(e,t,n){const r=this.createDumper();return(0,a.dumpSqlSelect)(r,t),this.readQuery(e,r.s,n)},showConnectionField:(e,t)=>!1,showConnectionTab:e=>!0}},function(e,t,n){var r=n(335),o=n(27),i=n(52),s=i&&i.isDate,u=s?o(s):r;e.exports=u},function(e,t,n){var r=n(17),o=n(10);e.exports=function(e){return o(e)&&"[object Date]"==r(e)}},function(e,t,n){var r=n(18);e.exports=function(){return r.randomBytes(16)}},function(e,t){for(var n=[],r=0;r<256;++r)n[r]=(r+256).toString(16).substr(1);e.exports=function(e,t){var r=t||0,o=n;return[o[e[r++]],o[e[r++]],o[e[r++]],o[e[r++]],"-",o[e[r++]],o[e[r++]],"-",o[e[r++]],o[e[r++]],"-",o[e[r++]],o[e[r++]],"-",o[e[r++]],o[e[r++]],o[e[r++]],o[e[r++]],o[e[r++]],o[e[r++]]].join("")}},function(e,t,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var o=Object.getOwnPropertyDescriptor(t,n);o&&("get"in o?t.__esModule:!o.writable&&!o.configurable)||(o={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,o)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),o=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||r(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),t.splitQuery=void 0;var i=n(339);Object.defineProperty(t,"splitQuery",{enumerable:!0,get:function(){return i.splitQuery}}),o(n(67),t)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.splitQuery=t.finishSplitStream=t.getInitialDelimiter=t.splitQueryLine=void 0;const r=n(67);function o(e,t){if(e.options.returnRichInfo){let{source:n,position:r,line:o,column:i,streamPosition:s}=e;for(;t>0;)"\n"==n[r]?(o+=1,i=0):i+=1,r+=1,s+=1,t-=1;e.position=r,e.streamPosition=s,e.line=o,e.column=i}else e.position+=t}function i(e,t,n,r){return r?n==r?e[t]==n&&e[t+1]!=n:e[t]==n&&e[t-1]!=r:e[t]==n}const s={type:"whitespace",length:1},u={type:"eoln",length:1},a={type:"data",length:1};function c(e){let t=e.position;const n=e.source,r=n[t];if(e.options.stringsBegins.includes(r)){t++;const o=e.options.stringsEnds[r],s=e.options.stringEscapes[r];for(;t<e.end&&!i(n,t,o,s);)o==s&&n[t]==o&&n[t+1]==o?t+=2:t++;return{type:"string",length:t-e.position+1}}if(e.currentDelimiter&&n.slice(t).startsWith(e.currentDelimiter))return{type:"delimiter",length:e.currentDelimiter.length};if(" "==r||"\t"==r||"\r"==r)return s;if("\n"==r)return u;if(e.options.doubleDashComments&&"-"==r&&"-"==n[t+1]){for(;t<e.end&&"\n"!=n[t];)t++;return{type:"comment",length:t-e.position}}if(e.options.multilineComments&&"/"==r&&"*"==n[t+1]){for(t+=2;t<e.end&&("*"!=n[t]||"/"!=n[t+1]);)t++;return{type:"comment",length:t-e.position+2}}if(e.options.allowCustomDelimiter&&!e.wasDataOnLine){const e=n.slice(t).match(/^DELIMITER[ \t]+([^\n]+)/i);if(e)return{type:"set_delimiter",value:e[1].trim(),length:e[0].length}}if(e.options.allowGoDelimiter&&!e.wasDataOnLine){const e=n.slice(t).match(/^GO[\t\r ]*(\n|$)/i);if(e)return{type:"go_delimiter",length:e[0].length-1}}const o=function(e){if(!e.options.allowDollarDollarString)return null;let t=e.position;const n=e.source,r=/^(\$[a-zA-Z0-9_]*\$)/.exec(n.slice(t));if(!r)return null;const o=r[1];for(t+=o.length;t<e.end;){if(n.slice(t).startsWith(o))return{type:"string",length:t+o.length-e.position};t++}return null}(e);return o||a}function l(e){const t=(e.commandPart||"")+e.source.slice(e.currentCommandStart,e.position),n=t.trim();n&&(e.options.returnRichInfo?e.pushOutput(d(t,{text:n,start:{position:e.commandStartPosition,line:e.commandStartLine,column:e.commandStartColumn},end:{position:e.streamPosition,line:e.line,column:e.column}})):e.pushOutput(n))}function d(e,t){const n=e.indexOf(t.text),r=Object.assign({},t.start);for(let t=0;t<n;t+=1)"\n"==e[t]?(r.position+=1,r.line+=1,r.column=0):(r.position+=1,r.column+=1);return Object.assign(Object.assign({},t),{trimStart:r,trimEnd:t.end})}function f(e){e.options.returnRichInfo&&(e.commandStartPosition=e.streamPosition,e.commandStartLine=e.line,e.commandStartColumn=e.column)}function p(e){if(e.options.splitByLines)!function(e){for(;e.position<e.end;)"\n"==e.source[e.position]?(l(e),e.commandPart="",o(e,1),e.currentCommandStart=e.position,f(e)):o(e,1);e.end>e.currentCommandStart&&(e.commandPart+=e.source.slice(e.currentCommandStart,e.position))}(e);else{for(;e.position<e.end;){const t=c(e);if(t)switch(t.type){case"string":case"comment":o(e,t.length),e.wasDataOnLine=!0;break;case"eoln":o(e,t.length),e.wasDataOnLine=!1;break;case"data":o(e,t.length),e.wasDataOnLine=!0;break;case"whitespace":o(e,t.length);break;case"set_delimiter":l(e),e.commandPart="",e.currentDelimiter=t.value,o(e,t.length),e.currentCommandStart=e.position,f(e);break;case"go_delimiter":case"delimiter":l(e),e.commandPart="",o(e,t.length),e.currentCommandStart=e.position,f(e)}else o(e,1)}e.end>e.currentCommandStart&&(e.commandPart+=e.source.slice(e.currentCommandStart,e.position))}}function h(e){return!1===(null==e?void 0:e.allowSemicolon)?null:";"}function m(e){const t=e.commandPart.trim();t&&(e.options.returnRichInfo?e.pushOutput(d(e.commandPart,{text:t,start:{position:e.commandStartPosition,line:e.commandStartLine,column:e.commandStartColumn},end:{position:e.streamPosition,line:e.line,column:e.column}})):e.pushOutput(t))}t.splitQueryLine=p,t.getInitialDelimiter=h,t.finishSplitStream=m,t.splitQuery=function(e,t=null){var n;const o=Object.assign(Object.assign({},r.defaultSplitterOptions),t);if(o.noSplit){if(o.returnRichInfo){const t=e.split("\n");return[{text:e,start:{position:0,line:0,column:0},end:{position:e.length,line:t.length,column:(null===(n=t[t.length-1])||void 0===n?void 0:n.length)||0}}]}return[e]}const i=[],s={source:e,end:e.length,currentDelimiter:h(t),position:0,column:0,line:0,currentCommandStart:0,commandStartLine:0,commandStartColumn:0,commandStartPosition:0,streamPosition:0,pushOutput:e=>i.push(e),wasDataOnLine:!1,options:o,commandPart:""};return p(s),m(s),i}},function(e,t,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),o=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||r(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),o(n(341),t),o(n(58),t),o(n(342),t),o(n(92),t),o(n(93),t),o(n(343),t),o(n(151),t)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.mergeConditions=t.scriptToSql=t.treeToSql=void 0;const r=n(58);t.treeToSql=function(e,t,n){const r=e.createDumper();return n(r,t),r.s},t.scriptToSql=function(e,t){const n=e.createDumper();for(const e of t)(0,r.dumpSqlCommand)(n,e),n.endCommand();return n.s},t.mergeConditions=function(e,t){return e?t?"and"==e.conditionType&&"and"==t.conditionType?{conditionType:"and",conditions:[...e.conditions,...t.conditions]}:"and"==e.conditionType?{conditionType:"and",conditions:[...e.conditions,t]}:"and"==t.conditionType?{conditionType:"and",conditions:[e,...t.conditions]}:{conditionType:"and",conditions:[e,t]}:e:t}},function(e,t,n){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.evaluateCondition=void 0;const o=r(n(16)),i=n(151);function s(e){return null==e||""==e.toString().trim()}function u(e,t){if(!e)return!1;if(!t)return!1;const n=new RegExp(`^${o.default.escapeRegExp(t).replace(/%/g,".*")}$`,"i");return!!e.toString().match(n)}t.evaluateCondition=function e(t,n){switch(t.conditionType){case"binary":const r=(0,i.evaluateExpression)(t.left,n),o=(0,i.evaluateExpression)(t.right,n);switch(t.operator){case"=":return r==o;case"!=":case"<>":return r!=o;case"<=":return r<=o;case">=":return r>=o;case"<":return r<o;case">":return r>o}break;case"isNull":return null==(0,i.evaluateExpression)(t.expr,n);case"isNotNull":return null!=(0,i.evaluateExpression)(t.expr,n);case"isEmpty":return s((0,i.evaluateExpression)(t.expr,n));case"isNotEmpty":return!s((0,i.evaluateExpression)(t.expr,n));case"and":return t.conditions.every(t=>e(t,n));case"or":return t.conditions.some(t=>e(t,n));case"like":return u((0,i.evaluateExpression)(t.left,n),(0,i.evaluateExpression)(t.right,n));case"notLike":return!u((0,i.evaluateExpression)(t.left,n),(0,i.evaluateExpression)(t.right,n));case"not":return!e(t.condition,n)}}},function(e,t,n){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.testPermission=t.compilePermissions=void 0;const o=r(n(345)),i=r(n(40)),s=r(n(41)),u=r(n(57));function a(e){return 0==e.length?null:new RegExp(e.map(e=>"^"+(0,o.default)(e).replace(/\\\*/g,".*")+"$").join("|"))}t.compilePermissions=function(e){if(!e)return null;e=(0,i.default)(e)?e.split(/,|;|\||\s/):(0,u.default)(e.map(e=>e.split(/,|;|\||\s/))),e=(0,s.default)(e.map(e=>e.trim()));let t=null,n=[];const r={levels:[]};for(const o of e){const e=o.startsWith("~")?"deny":"allow",i=o.startsWith("~")?o.substring(1):o;null!=t&&e!=t&&(r.levels.push({re:a(n),type:t}),n=[]),n.push(i),t=e}return n.length>0&&r.levels.push({re:a(n),type:t}),r},t.testPermission=function(e,t){let n=!0;if(!t)return!0;for(const r of t.levels)e.match(r.re)&&("allow"==r.type&&(n=!0),"deny"==r.type&&(n=!1));return n}},function(e,t,n){var r=n(30),o=/[\\^$.*+?()[\]{}|]/g,i=RegExp(o.source);e.exports=function(e){return(e=r(e))&&i.test(e)?e.replace(o,"\\$&"):e}},function(e,t,n){"use strict";var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{a(r.next(e))}catch(e){i(e)}}function u(e){try{a(r.throw(e))}catch(e){i(e)}}function a(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,u)}a((r=r.apply(e,t||[])).next())}))},o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.SqlGenerator=void 0;const i=o(n(57)),s=o(n(347)),u=n(153);t.SqlGenerator=class{constructor(e,t,n,r,o,i){this.options=t,this.objects=n,this.dmp=r,this.driver=o,this.pool=i,this.isTruncated=!1,this.isUnhandledException=!1,this.handleException=e=>{console.log("Unhandled error",e),this.isUnhandledException=!0},this.dbinfo=(0,u.extendDatabaseInfo)(e),this.tables=this.extract("tables"),this.views=this.extract("views"),this.matviews=this.extract("matviews"),this.procedures=this.extract("procedures"),this.functions=this.extract("functions"),this.triggers=this.extract("triggers")}dump(){return r(this,void 0,void 0,(function*(){try{if(process.on("uncaughtException",this.handleException),this.dropObjects(this.procedures,"Procedure"),this.checkDumper())return;if(this.dropObjects(this.functions,"Function"),this.checkDumper())return;if(this.dropObjects(this.views,"View"),this.checkDumper())return;if(this.dropObjects(this.matviews,"Matview"),this.checkDumper())return;if(this.dropObjects(this.triggers,"Trigger"),this.checkDumper())return;if(this.dropTables(),this.checkDumper())return;if(this.createTables(),this.checkDumper())return;if(this.truncateTables(),this.checkDumper())return;if(yield this.insertData(),this.checkDumper())return;if(this.createForeignKeys(),this.checkDumper())return;if(this.createObjects(this.procedures,"Procedure"),this.checkDumper())return;if(this.createObjects(this.functions,"Function"),this.checkDumper())return;if(this.createObjects(this.views,"View"),this.checkDumper())return;if(this.createObjects(this.matviews,"Matview"),this.checkDumper())return;if(this.createObjects(this.triggers,"Trigger"),this.checkDumper())return}finally{process.off("uncaughtException",this.handleException)}}))}createForeignKeys(){const e=[];this.options.createForeignKeys&&e.push(...(0,i.default)(this.tables.map(e=>e.foreignKeys||[]))),this.options.createReferences&&e.push(...(0,i.default)(this.tables.map(e=>e.dependencies||[])));for(const t of(0,s.default)(e,"constraintName"))if(this.dmp.createForeignKey(t),this.checkDumper())return}truncateTables(){if(this.options.truncate)for(const e of this.tables)if(this.dmp.truncateTable(e),this.checkDumper())return}createTables(){if(this.options.createTables)for(const e of this.tables)if(this.dmp.createTable(Object.assign(Object.assign({},e),{foreignKeys:[],dependencies:[],indexes:[]})),this.checkDumper())return;if(this.options.createIndexes)for(const e of(0,i.default)(this.tables.map(e=>e.indexes||[])))this.dmp.createIndex(e)}insertData(){return r(this,void 0,void 0,(function*(){if(this.options.insert){this.enableConstraints(!1);for(const e of this.tables)if(yield this.insertTableData(e),this.checkDumper())return;this.enableConstraints(!0)}}))}checkDumper(){return this.dmp.s.length>4e6&&(this.isTruncated||(this.dmp.putRaw("\n"),this.dmp.comment(" *************** SQL is truncated ******************"),this.dmp.putRaw("\n")),this.isTruncated=!0,!0)}dropObjects(e,t){if(this.options[`drop${t}s`])for(const n of e)if(this.dmp[`drop${t}`](n,{testIfExists:this.options[`checkIf${t}Exists`]}),this.checkDumper())return}createObjects(e,t){if(this.options[`create${t}s`])for(const n of e)if(this.dmp[`create${t}`](n),this.checkDumper())return}dropTables(){if(this.options.dropReferences)for(const e of(0,i.default)(this.tables.map(e=>e.dependencies||[])))this.dmp.dropForeignKey(e);if(this.options.dropTables)for(const e of this.tables)this.dmp.dropTable(e,{testIfExists:this.options.checkIfTableExists})}insertTableData(e){return r(this,void 0,void 0,(function*(){const t=this.driver.createDumper();t.put("^select * ^from %f",e);const n=e.columns.find(e=>e.autoIncrement);n&&!this.options.skipAutoincrementColumn&&this.dmp.allowIdentityInsert(e,!0);const r=yield this.driver.readQuery(this.pool,t.s,e);yield this.processReadable(e,r),n&&!this.options.skipAutoincrementColumn&&this.dmp.allowIdentityInsert(e,!1)}))}processReadable(e,t){const n=(this.options.skipAutoincrementColumn?e.columns.filter(e=>!e.autoIncrement):e.columns).map(e=>e.columnName);let r=!1,o=!1;return new Promise(i=>{t.on("data",s=>{if(r)return;if(!o)return void(o=!0);if(this.checkDumper())return r=!0,i(void 0),void t.destroy();const u=this.options.omitNulls?n.filter(e=>null!=s[e]):n;this.dmp.put("^insert ^into %f (%,i) ^values (%,v);&n",e,u,u.map(e=>s[e]))}),t.on("end",()=>{i(void 0)})})}extract(e){return this.dbinfo[e].filter(t=>this.objects.find(n=>t.pureName==n.pureName&&t.schemaName==n.schemaName&&n.objectTypeField==e))}enableConstraints(e){if(this.options.disableConstraints)if(this.driver.dialect.enableConstraintsPerTable)for(const t of this.tables)this.dmp.enableConstraints(t,e);else this.dmp.enableConstraints(null,e)}}},function(e,t,n){var r=n(87),o=n(152);e.exports=function(e,t){return e&&e.length?o(e,r(t,2)):[]}},function(e,t,n){var r=n(130),o=n(349),i=n(89),s=r&&1/i(new r([,-0]))[1]==1/0?function(e){return new r(e)}:o;e.exports=s},function(e,t){e.exports=function(){}},function(e,t,n){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.extractBoolSettingsValue=t.extractIntSettingsValue=void 0;const o=r(n(351)),i=r(n(90));t.extractIntSettingsValue=function(e,t,n,r=null,s=null){const u=parseInt(e[t]);return(0,o.default)(u)?n:(0,i.default)(u)?null!=r&&u<r?r:null!=s&&u>s?s:u:n},t.extractBoolSettingsValue=function(e,t,n){const r=e[t];return null==r?n:!!r}},function(e,t,n){var r=n(90);e.exports=function(e){return r(e)&&e!=+e}},function(e,t,n){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.filterName=void 0;const o=r(n(41)),i=r(n(40));function s(e,t){var n=t.length,r=e.length;if(r>n)return!1;if(r===n)return e===t;e:for(var o=0,i=0;o<r;o++){for(var s=e.charCodeAt(o);i<n;)if(t.charCodeAt(i++)===s)continue e;return!1}return!0}t.filterName=function(e,...t){if(!e)return!0;const n=e.split(" ").map(e=>e.trim()),r=(0,o.default)(t),u=r.filter(e=>(0,i.default)(e)),a=r.filter(e=>e.childName).map(e=>e.childName);for(const e of n){const t=e.toUpperCase();if(t.startsWith("#")){const e=t.substring(1);if(!a.find(t=>s(e,t.toUpperCase())))return!1}else{if(!u.find(e=>s(t,e.toUpperCase())))return!1}}return!0}},function(e,t,n){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.runAlterOperation=t.AlterPlan=void 0;const o=r(n(16)),i=n(94),s=n(354),u=n(86);function a(e,t){switch(e.operationType){case"createTable":t.createTable(e.newObject);break;case"changeColumn":t.changeColumn(e.oldObject,e.newObject);break;case"createColumn":t.createColumn(e.newObject,[]);break;case"dropColumn":t.dropColumn(e.oldObject);break;case"dropTable":t.dropTable(e.oldObject);break;case"changeConstraint":t.changeConstraint(e.oldObject,e.newObject);break;case"createConstraint":t.createConstraint(e.newObject);break;case"dropConstraint":t.dropConstraint(e.oldObject);break;case"renameColumn":t.renameColumn(e.object,e.newName);break;case"renameTable":t.renameTable(e.object,e.newName);break;case"renameConstraint":t.renameConstraint(e.object,e.newName);break;case"createSqlObject":t.createSqlObject(e.newObject);break;case"dropSqlObject":t.dropSqlObject(e.oldObject);break;case"fillPreloadedRows":t.fillPreloadedRows(e.table,e.oldRows,e.newRows,e.key,e.insertOnly);break;case"recreateTable":{const n=(0,i.generateTablePairingId)(e.table),r=o.default.cloneDeep(n),c=u.DatabaseAnalyser.createEmptyStructure();c.tables.push(r),e.operations.forEach(e=>a(e,new s.DatabaseInfoAlterProcessor(c))),t.recreateTable(n,r)}}}t.AlterPlan=class{constructor(e,t,n,r){this.wholeOldDb=e,this.wholeNewDb=t,this.dialect=n,this.opts=r,this.recreates={tables:0,constraints:0,sqlObjects:0},this.operations=[]}createTable(e){this.operations.push({operationType:"createTable",newObject:e})}dropTable(e){this.operations.push({operationType:"dropTable",oldObject:e})}createSqlObject(e){this.operations.push({operationType:"createSqlObject",newObject:e})}dropSqlObject(e){this.operations.push({operationType:"dropSqlObject",oldObject:e})}createColumn(e){this.operations.push({operationType:"createColumn",newObject:e})}changeColumn(e,t){this.operations.push({operationType:"changeColumn",oldObject:e,newObject:t})}dropColumn(e){this.operations.push({operationType:"dropColumn",oldObject:e})}createConstraint(e){this.operations.push({operationType:"createConstraint",newObject:e})}changeConstraint(e,t){this.operations.push({operationType:"changeConstraint",oldObject:e,newObject:t})}dropConstraint(e){this.operations.push({operationType:"dropConstraint",oldObject:e})}renameTable(e,t){this.operations.push({operationType:"renameTable",object:e,newName:t})}renameColumn(e,t){this.operations.push({operationType:"renameColumn",object:e,newName:t})}renameConstraint(e,t){this.operations.push({operationType:"renameConstraint",object:e,newName:t})}recreateTable(e,t){this.operations.push({operationType:"recreateTable",table:e,operations:t}),this.recreates.tables+=1}fillPreloadedRows(e,t,n,r,o){this.operations.push({operationType:"fillPreloadedRows",table:e,oldRows:t,newRows:n,key:r,insertOnly:o})}run(e){for(const t of this.operations)a(t,e)}_getDependendColumnConstraints(e,t){const n=this.wholeOldDb.tables.find(t=>t.pureName==e.pureName&&t.schemaName==e.schemaName);return n?[...(null==t?void 0:t.includes("dependencies"))?n.dependencies.filter(t=>t.columns.find(t=>t.refColumnName==e.columnName)):[],...o.default.compact([(null==t?void 0:t.includes("primaryKey"))?n.primaryKey:null,...(null==t?void 0:t.includes("foreignKeys"))?n.foreignKeys:[],...(null==t?void 0:t.includes("indexes"))?n.indexes:[],...(null==t?void 0:t.includes("uniques"))?n.uniques:[]]).filter(t=>t.columns.find(t=>t.columnName==e.columnName))]:[]}_addLogicalDependencies(){const e=this.operations.map(e=>{if("dropColumn"==e.operationType){const t=this._getDependendColumnConstraints(e.oldObject,this.dialect.dropColumnDependencies);return t.length>0&&this.opts.noDropConstraint?[]:[...t.map(e=>({operationType:"dropConstraint",oldObject:e})),e]}if("changeColumn"==e.operationType){const t=this._getDependendColumnConstraints(e.oldObject,this.dialect.changeColumnDependencies);if(t.length>0&&this.opts.noDropConstraint)return[];const n=[...t.map(e=>({operationType:"dropConstraint",oldObject:e})),e,...o.default.reverse([...t]).map(e=>({operationType:"createConstraint",newObject:e}))];return t.length>0&&(this.recreates.constraints+=1),n}if("dropTable"==e.operationType)return[...this.dialect.dropReferencesWhenDropTable?(e.oldObject.dependencies||[]).map(e=>({operationType:"dropConstraint",oldObject:e})):[],e];if("changeConstraint"==e.operationType){if(this.opts.noDropConstraint)return[];return this.recreates.constraints+=1,[{operationType:"dropConstraint",oldObject:e.oldObject},{operationType:"createConstraint",newObject:e.newObject}]}return[e]});return o.default.flatten(e)}_transformToImplementedOps(){const e=this.operations.map(e=>this._testTableRecreate(e,"createColumn",this.dialect.createColumn,"newObject")||this._testTableRecreate(e,"dropColumn",this.dialect.dropColumn,"oldObject")||this._testTableRecreate(e,"createConstraint",e=>this._canCreateConstraint(e),"newObject")||this._testTableRecreate(e,"dropConstraint",e=>this._canDropConstraint(e),"oldObject")||this._testTableRecreate(e,"changeColumn",this.dialect.changeColumn,"newObject")||[e]);return o.default.flatten(e)}_canCreateConstraint(e){return"primaryKey"==e.constraintType?this.dialect.createPrimaryKey:"foreignKey"==e.constraintType?this.dialect.createForeignKey:"index"==e.constraintType?this.dialect.createIndex:"unique"==e.constraintType?this.dialect.createUnique:"check"==e.constraintType?this.dialect.createCheck:null}_canDropConstraint(e){return"primaryKey"==e.constraintType?this.dialect.dropPrimaryKey:"foreignKey"==e.constraintType?this.dialect.dropForeignKey:"index"==e.constraintType?this.dialect.dropIndex:"unique"==e.constraintType?this.dialect.dropUnique:"check"==e.constraintType?this.dialect.dropCheck:null}_testTableRecreate(e,t,n,r){if(e.operationType==t){if(o.default.isFunction(n)){if(n(e[r]))return null}else if(n)return null;if(this.opts.noDropTable)return[];const t=this.wholeNewDb.tables.find(t=>t.pureName==e[r].pureName&&t.schemaName==e[r].schemaName);return this.recreates.tables+=1,[{operationType:"recreateTable",table:t,operations:[e]}]}return null}_groupTableRecreations(){const e=[],t={};for(const n of this.operations)if("recreateTable"==n.operationType&&n.table){const r=t[`${n.table.schemaName}||${n.table.pureName}`];if(r)r.operations.push(...n.operations);else{const r=Object.assign(Object.assign({},n),{operations:[...n.operations]});e.push(r),t[`${n.table.schemaName}||${n.table.pureName}`]=r}}else{const r=n.oldObject;if(r){const e=t[`${r.schemaName}||${r.pureName}`];if(e){e.operations.push(n);continue}}e.push(n)}return e}_moveForeignKeysToLast(){if(!this.dialect.createForeignKey)return this.operations;const e=[];return[...this.operations.map(t=>"createTable"==t.operationType?(e.push(...t.newObject.foreignKeys||[]),Object.assign(Object.assign({},t),{newObject:Object.assign(Object.assign({},t.newObject),{foreignKeys:[]})})):t),...e.map(e=>({operationType:"createConstraint",newObject:e}))]}_filterAllowedOperations(){return this.operations.filter(e=>(!this.opts.noDropColumn||"dropColumn"!=e.operationType)&&((!this.opts.noDropTable||"dropTable"!=e.operationType)&&((!this.opts.noDropTable||"recreateTable"!=e.operationType)&&((!this.opts.noDropConstraint||"dropConstraint"!=e.operationType)&&(!this.opts.noDropSqlObject||"dropSqlObject"!=e.operationType)))))}transformPlan(){this.operations=this._addLogicalDependencies(),this.operations=this._transformToImplementedOps(),this.operations=this._groupTableRecreations(),this.operations=this._moveForeignKeysToLast(),this.operations=this._filterAllowedOperations()}},t.runAlterOperation=a},function(e,t,n){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.DatabaseInfoAlterProcessor=void 0;const o=r(n(16));t.DatabaseInfoAlterProcessor=class{constructor(e){this.db=e}createTable(e){this.db.tables.push(e)}dropTable(e){o.default.remove(this.db.tables,t=>t.pureName==e.pureName&&t.schemaName==e.schemaName)}createSqlObject(e){this.db[e.objectTypeField].push(e)}dropSqlObject(e){o.default.remove(this.db[e.objectTypeField],t=>t.pureName==e.pureName&&t.schemaName==e.schemaName)}createColumn(e){const t=this.db.tables.find(t=>t.pureName==e.pureName&&t.schemaName==e.schemaName);if(!t)throw new Error(`createColumn error, cannot find table: ${e.schemaName}.${e.pureName}`);t.columns.push(e)}changeColumn(e,t){const n=this.db.tables.find(t=>t.pureName==e.pureName&&t.schemaName==e.schemaName);if(!n)throw new Error(`changeColumn error, cannot find table: ${e.schemaName}.${e.pureName}`);n.columns=n.columns.map(n=>n.columnName==e.columnName?t:n)}dropColumn(e){const t=this.db.tables.find(t=>t.pureName==e.pureName&&t.schemaName==e.schemaName);if(!t)throw new Error(`dropColumn error, cannot find table: ${e.schemaName}.${e.pureName}`);o.default.remove(t.columns,t=>t.columnName==e.columnName)}createConstraint(e){const t=this.db.tables.find(t=>t.pureName==e.pureName&&t.schemaName==e.schemaName);switch(e.constraintType){case"primaryKey":t.primaryKey=e;break;case"foreignKey":t.foreignKeys.push(e);break;case"index":t.indexes.push(e);break;case"unique":t.uniques.push(e);break;case"check":t.checks.push(e)}}changeConstraint(e,t){this.db.tables.find(t=>t.pureName==e.pureName&&t.schemaName==e.schemaName)}dropConstraint(e){const t=this.db.tables.find(t=>t.pureName==e.pureName&&t.schemaName==e.schemaName);switch(e.constraintType){case"primaryKey":t.primaryKey=null;break;case"foreignKey":t.foreignKeys=t.foreignKeys.filter(t=>t.constraintName!=e.constraintName);break;case"index":t.indexes=t.indexes.filter(t=>t.constraintName!=e.constraintName);break;case"unique":t.uniques=t.uniques.filter(t=>t.constraintName!=e.constraintName);break;case"check":t.checks=t.checks.filter(t=>t.constraintName!=e.constraintName)}}renameTable(e,t){this.db.tables.find(t=>t.pureName==e.pureName&&t.schemaName==e.schemaName).pureName=t}renameColumn(e,t){this.db.tables.find(t=>t.pureName==e.pureName&&t.schemaName==e.schemaName).columns.find(t=>t.columnName==e.columnName).columnName=t}renameConstraint(e,t){}recreateTable(e,t){throw new Error("recreateTable not implemented for DatabaseInfoAlterProcessor")}fillPreloadedRows(e,t,n,r,o){const i=this.db.tables.find(t=>t.pureName==e.pureName&&t.schemaName==e.schemaName);i.preloadedRows=n,i.preloadedRowsKey=r,i.preloadedRowsInsertOnly=o}}},function(e,t,n){var r="undefined"!=typeof JSON?JSON:n(356);e.exports=function(e,t){t||(t={}),"function"==typeof t&&(t={cmp:t});var n=t.space||"";"number"==typeof n&&(n=Array(n+1).join(" "));var s,u="boolean"==typeof t.cycles&&t.cycles,a=t.replacer||function(e,t){return t},c=t.cmp&&(s=t.cmp,function(e){return function(t,n){var r={key:t,value:e[t]},o={key:n,value:e[n]};return s(r,o)}}),l=[];return function e(t,s,d,f){var p=n?"\n"+new Array(f+1).join(n):"",h=n?": ":":";if(d&&d.toJSON&&"function"==typeof d.toJSON&&(d=d.toJSON()),void 0!==(d=a.call(t,s,d))){if("object"!=typeof d||null===d)return r.stringify(d);if(o(d)){for(var m=[],g=0;g<d.length;g++){var E=e(d,g,d[g],f+1)||r.stringify(null);m.push(p+n+E)}return"["+m.join(",")+p+"]"}if(-1!==l.indexOf(d)){if(u)return r.stringify("__cycle__");throw new TypeError("Converting circular structure to JSON")}l.push(d);var y=i(d).sort(c&&c(d));for(m=[],g=0;g<y.length;g++){var v=e(d,s=y[g],d[s],f+1);if(v){var A=r.stringify(s)+h+v;m.push(p+n+A)}}return l.splice(l.indexOf(d),1),"{"+m.join(",")+p+"}"}}({"":e},"",e,0)};var o=Array.isArray||function(e){return"[object Array]"==={}.toString.call(e)},i=Object.keys||function(e){var t=Object.prototype.hasOwnProperty||function(){return!0},n=[];for(var r in e)t.call(e,r)&&n.push(r);return n}},function(e,t,n){t.parse=n(357),t.stringify=n(358)},function(e,t){var n,r,o,i,s={'"':'"',"\\":"\\","/":"/",b:"\b",f:"\f",n:"\n",r:"\r",t:"\t"},u=function(e){throw{name:"SyntaxError",message:e,at:n,text:o}},a=function(e){return e&&e!==r&&u("Expected '"+e+"' instead of '"+r+"'"),r=o.charAt(n),n+=1,r},c=function(){var e,t="";for("-"===r&&(t="-",a("-"));r>="0"&&r<="9";)t+=r,a();if("."===r)for(t+=".";a()&&r>="0"&&r<="9";)t+=r;if("e"===r||"E"===r)for(t+=r,a(),"-"!==r&&"+"!==r||(t+=r,a());r>="0"&&r<="9";)t+=r,a();if(e=+t,isFinite(e))return e;u("Bad number")},l=function(){var e,t,n,o="";if('"'===r)for(;a();){if('"'===r)return a(),o;if("\\"===r)if(a(),"u"===r){for(n=0,t=0;t<4&&(e=parseInt(a(),16),isFinite(e));t+=1)n=16*n+e;o+=String.fromCharCode(n)}else{if("string"!=typeof s[r])break;o+=s[r]}else o+=r}u("Bad string")},d=function(){for(;r&&r<=" ";)a()};i=function(){switch(d(),r){case"{":return function(){var e,t={};if("{"===r){if(a("{"),d(),"}"===r)return a("}"),t;for(;r;){if(e=l(),d(),a(":"),Object.hasOwnProperty.call(t,e)&&u('Duplicate key "'+e+'"'),t[e]=i(),d(),"}"===r)return a("}"),t;a(","),d()}}u("Bad object")}();case"[":return function(){var e=[];if("["===r){if(a("["),d(),"]"===r)return a("]"),e;for(;r;){if(e.push(i()),d(),"]"===r)return a("]"),e;a(","),d()}}u("Bad array")}();case'"':return l();case"-":return c();default:return r>="0"&&r<="9"?c():function(){switch(r){case"t":return a("t"),a("r"),a("u"),a("e"),!0;case"f":return a("f"),a("a"),a("l"),a("s"),a("e"),!1;case"n":return a("n"),a("u"),a("l"),a("l"),null}u("Unexpected '"+r+"'")}()}},e.exports=function(e,t){var s;return o=e,n=0,r=" ",s=i(),d(),r&&u("Syntax error"),"function"==typeof t?function e(n,r){var o,i,s=n[r];if(s&&"object"==typeof s)for(o in s)Object.prototype.hasOwnProperty.call(s,o)&&(void 0!==(i=e(s,o))?s[o]=i:delete s[o]);return t.call(n,r,s)}({"":s},""):s}},function(e,t){var n,r,o,i=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,s={"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"};function u(e){return i.lastIndex=0,i.test(e)?'"'+e.replace(i,(function(e){var t=s[e];return"string"==typeof t?t:"\\u"+("0000"+e.charCodeAt(0).toString(16)).slice(-4)}))+'"':'"'+e+'"'}e.exports=function(e,t,i){var s;if(n="",r="","number"==typeof i)for(s=0;s<i;s+=1)r+=" ";else"string"==typeof i&&(r=i);if(o=t,t&&"function"!=typeof t&&("object"!=typeof t||"number"!=typeof t.length))throw new Error("JSON.stringify");return function e(t,i){var s,a,c,l,d,f=n,p=i[t];switch(p&&"object"==typeof p&&"function"==typeof p.toJSON&&(p=p.toJSON(t)),"function"==typeof o&&(p=o.call(i,t,p)),typeof p){case"string":return u(p);case"number":return isFinite(p)?String(p):"null";case"boolean":case"null":return String(p);case"object":if(!p)return"null";if(n+=r,d=[],"[object Array]"===Object.prototype.toString.apply(p)){for(l=p.length,s=0;s<l;s+=1)d[s]=e(s,p)||"null";return c=0===d.length?"[]":n?"[\n"+n+d.join(",\n"+n)+"\n"+f+"]":"["+d.join(",")+"]",n=f,c}if(o&&"object"==typeof o)for(l=o.length,s=0;s<l;s+=1)"string"==typeof(a=o[s])&&(c=e(a,p))&&d.push(u(a)+(n?": ":":")+c);else for(a in p)Object.prototype.hasOwnProperty.call(p,a)&&(c=e(a,p))&&d.push(u(a)+(n?": ":":")+c);return c=0===d.length?"{}":n?"{\n"+n+d.join(",\n"+n)+"\n"+f+"}":"{"+d.join(",")+"}",n=f,c}}("",{"":e})}},function(e,t,n){var r=n(29),o=n(360),i=n(361),s=n(31);e.exports=function(e,t){return t=r(t,e),null==(e=i(e,t))||delete e[s(o(t))]}},function(e,t){e.exports=function(e){var t=null==e?0:e.length;return t?e[t-1]:void 0}},function(e,t,n){var r=n(38),o=n(134);e.exports=function(e,t){return t.length<2?e:r(e,o(t,0,-1))}},function(e,t,n){var r=n(55);e.exports=function(e){return r(e)?void 0:e}},function(e,t,n){var r=n(88);e.exports=function(e,t){return r(e,t)}},function(e,t,n){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.editorDeleteConstraint=t.editorModifyConstraint=t.editorAddConstraint=t.editorDeleteColumn=t.editorModifyColumn=t.editorAddColumn=t.fillEditorColumnInfo=void 0;const o=r(n(91)),i=r(n(154)),s=r(n(16));function u(e,t){var n,r;return Object.assign({isPrimaryKey:!!(null===(r=null===(n=null==t?void 0:t.primaryKey)||void 0===n?void 0:n.columns)||void 0===r?void 0:r.find(t=>t.columnName==e.columnName)),dataType:s.default.isEmpty(e)?"int":void 0},e)}function a(e,t,n){if(!(null==t?void 0:t.isPrimaryKey)&&(null==n?void 0:n.isPrimaryKey)){let t=null==e?void 0:e.primaryKey;return t||(t={constraintType:"primaryKey",pureName:e.pureName,schemaName:e.schemaName,columns:[]}),Object.assign(Object.assign({},e),{primaryKey:Object.assign(Object.assign({},t),{columns:[...t.columns,{columnName:n.columnName}]})})}if((null==t?void 0:t.isPrimaryKey)&&!(null==n?void 0:n.isPrimaryKey)){let n=null==e?void 0:e.primaryKey;if(n)return n=Object.assign(Object.assign({},n),{columns:e.primaryKey.columns.filter(e=>e.columnName!=t.columnName)}),0==n.columns.length?Object.assign(Object.assign({},e),{primaryKey:null}):Object.assign(Object.assign({},e),{primaryKey:n})}return e}t.fillEditorColumnInfo=u,t.editorAddColumn=function(e,t){let n=Object.assign(Object.assign({},e),{columns:[...(null==e?void 0:e.columns)||[],Object.assign(Object.assign({},t),{pairingId:(0,o.default)()})]});return n=a(n,null,t),n},t.editorModifyColumn=function(e,t){var n;const r=null===(n=null==e?void 0:e.columns)||void 0===n?void 0:n.find(e=>e.pairingId==t.pairingId);let o=Object.assign(Object.assign({},e),{columns:e.columns.map(e=>e.pairingId==t.pairingId?(0,i.default)(t,["isPrimaryKey"]):e)});return o=a(o,u(r,e),t),o},t.editorDeleteColumn=function(e,t){let n=Object.assign(Object.assign({},e),{columns:e.columns.filter(e=>e.pairingId!=t.pairingId)});return n=a(n,t,null),n},t.editorAddConstraint=function(e,t){const n=Object.assign({},e);return"primaryKey"==t.constraintType&&(n.primaryKey=Object.assign({pairingId:(0,o.default)()},t)),"foreignKey"==t.constraintType&&(n.foreignKeys=[...n.foreignKeys||[],Object.assign({pairingId:(0,o.default)()},t)]),"index"==t.constraintType&&(n.indexes=[...n.indexes||[],Object.assign({pairingId:(0,o.default)()},t)]),"unique"==t.constraintType&&(n.uniques=[...n.uniques||[],Object.assign({pairingId:(0,o.default)()},t)]),n},t.editorModifyConstraint=function(e,t){const n=Object.assign({},e);return"primaryKey"==t.constraintType&&(n.primaryKey=Object.assign(Object.assign({},n.primaryKey),t)),"foreignKey"==t.constraintType&&(n.foreignKeys=e.foreignKeys.map(e=>e.pairingId==t.pairingId?Object.assign(Object.assign({},e),t):e)),"index"==t.constraintType&&(n.indexes=e.indexes.map(e=>e.pairingId==t.pairingId?Object.assign(Object.assign({},e),t):e)),"unique"==t.constraintType&&(n.uniques=e.uniques.map(e=>e.pairingId==t.pairingId?Object.assign(Object.assign({},e),t):e)),n},t.editorDeleteConstraint=function(e,t){const n=Object.assign({},e);return"primaryKey"==t.constraintType&&(n.primaryKey=null),"foreignKey"==t.constraintType&&(n.foreignKeys=e.foreignKeys.filter(e=>e.pairingId!=t.pairingId)),"index"==t.constraintType&&(n.indexes=e.indexes.filter(e=>e.pairingId!=t.pairingId)),"unique"==t.constraintType&&(n.uniques=e.uniques.filter(e=>e.pairingId!=t.pairingId)),n}},function(e,t,n){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.databaseInfoFromYamlModel=t.tableInfoFromYaml=t.tableInfoToYaml=void 0;const o=r(n(68)),i=r(n(41)),s=n(86);function u(e,t){const n={pureName:e.name,columns:e.columns.map(t=>function(e,t){return{pureName:t.name,columnName:e.name,dataType:e.length?`${e.type}(${e.length})`:e.type,autoIncrement:e.autoIncrement,notNull:e.notNull||t.primaryKey&&t.primaryKey.includes(e.name),defaultValue:e.default}}(t,e)),foreignKeys:(0,i.default)(e.columns.filter(e=>e.references).map(n=>function(e,t,n){const r=n.find(t=>t.name==e.references);return r&&r.primaryKey?{constraintType:"foreignKey",pureName:t.name,refTableName:e.references,columns:[{columnName:e.name,refColumnName:r.primaryKey[0]}]}:null}(n,e,t)))};return e.primaryKey&&(n.primaryKey={pureName:e.name,constraintType:"primaryKey",columns:e.primaryKey.map(e=>({columnName:e}))}),n.preloadedRows=e.data,n.preloadedRowsKey=e.insertKey,n.preloadedRowsInsertOnly=e.insertOnly,n}t.tableInfoToYaml=function(e){const t=(0,o.default)(e),n={name:t.pureName,columns:t.columns.map(e=>function(e,t){const n={name:e.columnName,type:e.dataType,default:e.defaultValue};e.autoIncrement&&(n.autoIncrement=!0),e.notNull&&(n.notNull=!0);const r=t.foreignKeys&&t.foreignKeys.find(t=>1==t.columns.length&&t.columns[0].columnName==e.columnName);return!r||r.deleteAction&&"NO ACTION"!=r.deleteAction||r.updateAction&&"NO ACTION"!=r.updateAction||(n.references=r.refTableName,r._dumped=!0),n}(e,t))};return t.primaryKey&&!t.primaryKey._dumped&&(n.primaryKey=t.primaryKey.columns.map(e=>e.columnName)),n},t.tableInfoFromYaml=u,t.databaseInfoFromYamlModel=function(e){const t=s.DatabaseAnalyser.createEmptyStructure(),n=[];for(const r of e)(r.name.endsWith(".table.yaml")||r.name.endsWith(".sql"))&&(r.name.endsWith(".table.yaml")&&n.push(r.json),r.name.endsWith(".view.sql")&&t.views.push({pureName:r.name.slice(0,-".view.sql".length),createSql:r.text,columns:[]}),r.name.endsWith(".matview.sql")&&t.matviews.push({pureName:r.name.slice(0,-".matview.sql".length),createSql:r.text,columns:[]}),r.name.endsWith(".proc.sql")&&t.procedures.push({pureName:r.name.slice(0,-".proc.sql".length),createSql:r.text}),r.name.endsWith(".func.sql")&&t.functions.push({pureName:r.name.slice(0,-".func.sql".length),createSql:r.text}),r.name.endsWith(".trigger.sql")&&t.triggers.push({pureName:r.name.slice(0,-".trigger.sql".length),createSql:r.text}));return t.tables=n.map(e=>u(e,n)),t}},function(e,t,n){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.isWktGeometry=t.getIconForRedisType=t.isJsonLikeLongString=t.safeJsonParse=t.stringifyCellValue=t.parseCellValue=t.hexStringToArray=t.arrayToHexString=void 0;const o=r(n(40)),i=r(n(7)),s=r(n(55));function u(e){return e.reduce((e,t)=>e+("0"+t.toString(16)).slice(-2),"").toUpperCase()}function a(e){for(var t=e.toString(),n=[],r=0;r<t.length;r+=2)n.push(parseInt(t.substr(r,2),16));return n}t.arrayToHexString=u,t.hexStringToArray=a,t.parseCellValue=function(e){if(!(0,o.default)(e))return e;if("(NULL)"==e)return null;if(e.match(/^0x([0-9a-fA-F][0-9a-fA-F])+$/))return{type:"Buffer",data:a(e.substring(2))};const t=e.match(/^ObjectId\("([0-9a-f]{24})"\)$/);return t?{$oid:t[1]}:e},t.stringifyCellValue=function(e){return null===e?"(NULL)":void 0===e?"(NoField)":"Buffer"==(null==e?void 0:e.type)&&(0,i.default)(e.data)?"0x"+u(e.data):(null==e?void 0:e.$oid)?`ObjectId("${null==e?void 0:e.$oid}")`:(0,s.default)(e)||(0,i.default)(e)?JSON.stringify(e):e},t.safeJsonParse=function(e,t,n=!1){try{return JSON.parse(e)}catch(r){return n&&console.error(`Error parsing JSON value "${e}"`,r),t}},t.isJsonLikeLongString=function(e){return(0,o.default)(e)&&e.length>100&&e.match(/^\s*\{.*\}\s*$|^\s*\[.*\]\s*$/)},t.getIconForRedisType=function(e){switch(e){case"dir":return"img folder";case"string":return"img type-string";case"hash":return"img type-hash";case"set":return"img type-set";case"list":return"img type-list";case"zset":return"img type-zset";case"stream":return"img type-stream";case"binary":return"img type-binary";case"ReJSON-RL":return"img type-rejson";default:return null}},t.isWktGeometry=function(e){return!!(0,o.default)(e)&&!!e.match(/^POINT\s*\(|^LINESTRING\s*\(|^POLYGON\s*\(|^MULTIPOINT\s*\(|^MULTILINESTRING\s*\(|^MULTIPOLYGON\s*\(|^GEOMCOLLECTION\s*\(|^GEOMETRYCOLLECTION\s*\(/)}},function(e,t,n){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.getCreateObjectScript=t.computeTableDiffColumns=t.computeDbDiffRows=t.DbDiffCompareDefs=t.computeDiffRowsCore=void 0;const o=n(94),i=r(n(16));function s(e,t,n){const r=[];for(const o of e){const e=t.find(e=>e.pairingId==o.pairingId);if(e){const t=n(o,e);r.push({source:o,target:e,state:t?"equal":"changed",__isChanged:!t})}else r.push({source:o,state:"added",__isAdded:!0})}for(const n of t){e.find(e=>e.pairingId==n.pairingId)||r.push({target:n,state:"removed",__isDeleted:!0})}return r}t.computeDiffRowsCore=s,t.DbDiffCompareDefs={tables:{test:o.testEqualTables,name:"Table",plural:"Tables",icon:"img table"},views:{test:o.testEqualSqlObjects,name:"View",plural:"Views",icon:"img view"},matviews:{test:o.testEqualSqlObjects,name:"Materialized view",plural:"Materialized views",icon:"img view"},procedures:{test:o.testEqualSqlObjects,name:"Procedure",plural:"Procedures",icon:"img procedure"},functions:{test:o.testEqualSqlObjects,name:"Function",plural:"Functions",icon:"img function"}},t.computeDbDiffRows=function(e,n,r,o){if(!e||!n||!o)return[];const u=[];for(const a of["tables","views","procedures","matviews","functions"]){const c=t.DbDiffCompareDefs[a];u.push(...i.default.sortBy(s(e[a],n[a],(t,i)=>c.test(t,i,r,e,n,o)).map(e=>{var t,n,r,o,i,s,u,l;return Object.assign(Object.assign({},e),{sourceSchemaName:null===(t=null==e?void 0:e.source)||void 0===t?void 0:t.schemaName,sourcePureName:null===(n=null==e?void 0:e.source)||void 0===n?void 0:n.pureName,targetSchemaName:null===(r=null==e?void 0:e.target)||void 0===r?void 0:r.schemaName,targetPureName:null===(o=null==e?void 0:e.target)||void 0===o?void 0:o.pureName,typeName:c.name,typeIcon:c.icon,identifier:`${(null===(i=null==e?void 0:e.source)||void 0===i?void 0:i.schemaName)||(null===(s=null==e?void 0:e.target)||void 0===s?void 0:s.schemaName)}.${(null===(u=null==e?void 0:e.source)||void 0===u?void 0:u.pureName)||(null===(l=null==e?void 0:e.target)||void 0===l?void 0:l.pureName)}`,objectTypeField:a})}),"identifier"))}return u},t.computeTableDiffColumns=function(e,t,n,r){return r?s((null==e?void 0:e.columns)||[],(null==t?void 0:t.columns)||[],(e,t)=>(0,o.testEqualColumns)(e,t,!0,!0,n)).map(e=>{var t,n,r,o,i,s;return Object.assign(Object.assign({},e),{sourceColumnName:null===(t=null==e?void 0:e.source)||void 0===t?void 0:t.columnName,targetColumnName:null===(n=null==e?void 0:e.target)||void 0===n?void 0:n.columnName,sourceDataType:null===(r=null==e?void 0:e.source)||void 0===r?void 0:r.dataType,targetDataType:null===(o=null==e?void 0:e.target)||void 0===o?void 0:o.dataType,sourceNotNull:null===(i=null==e?void 0:e.source)||void 0===i?void 0:i.notNull,targetNotNull:null===(s=null==e?void 0:e.target)||void 0===s?void 0:s.notNull})}):[]},t.getCreateObjectScript=function(e,t){if(!e||!t)return"";if("tables"==e.objectTypeField){const n=t.createDumper();return n.createTable(e),n.s}return e.createSql||""}},function(e,t,n){"use strict";var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{a(r.next(e))}catch(e){i(e)}}function u(e){try{a(r.throw(e))}catch(e){i(e)}}function a(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,u)}a((r=r.apply(e,t||[])).next())}))},o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.enrichWithPreloadedRows=void 0;const i=o(n(16));t.enrichWithPreloadedRows=function(e,t,n,o){var s,u,a;return r(this,void 0,void 0,(function*(){const r={};for(const i of t.tables){const t=e.tables.find(e=>e.pairingId==i.pairingId);if(0==((null===(s=null==t?void 0:t.preloadedRows)||void 0===s?void 0:s.length)||0))continue;const c=t.preloadedRowsKey||(null===(a=null===(u=t.primaryKey)||void 0===u?void 0:u.columns)||void 0===a?void 0:a.map(e=>e.columnName));if(0==((null==c?void 0:c.length)||0))continue;const l=o.createDumper();1==c.length?l.putCmd("^select * ^from %f ^where %i ^in (%,v)",i,c[0],t.preloadedRows.map(e=>e[c[0]])):(l.put("^select * ^from %f ^where",i),l.putCollection(" ^or ",t.preloadedRows,e=>{l.put("("),l.putCollection(" ^and ",c,t=>l.put("%i=%v",t,e[t])),l.put(")")}),l.endCommand());const d=yield o.query(n,l.s);r[i.pairingId]=Object.assign(Object.assign({},i),{preloadedRows:d.rows,preloadedRowsKey:c})}return i.default.isEmpty(r)?t:Object.assign(Object.assign({},t),{tables:t.tables.map(e=>r[e.pairingId]||e)})}))}},function(e,t,n){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.jsonScriptToJavascript=t.ScriptWriterJson=t.ScriptWriter=void 0;const o=r(n(370)),i=n(133);class s{constructor(e="0"){this.s="",this.packageNames=[],this.varCount=0,this.varCount=parseInt(e)||0}allocVariable(e="var"){return this.varCount+=1,`${e}${this.varCount}`}_put(e=""){this.s+=e,this.s+="\n"}endLine(){this._put()}assignCore(e,t,n){this._put(`const ${e} = await ${t}(${JSON.stringify(n)});`)}assign(e,t,n){this.assignCore(e,(0,i.extractShellApiFunctionName)(t),n),this.packageNames.push(...(0,i.extractShellApiPlugins)(t,n))}assignValue(e,t){this._put(`const ${e} = ${JSON.stringify(t)};`)}requirePackage(e){this.packageNames.push(e)}copyStream(e,t,n=null){n?this._put(`await dbgateApi.copyStream(${e}, ${t}, {columns: ${n}});`):this._put(`await dbgateApi.copyStream(${e}, ${t});`)}dumpDatabase(e){this._put(`await dbgateApi.dumpDatabase(${JSON.stringify(e)});`)}importDatabase(e){this._put(`await dbgateApi.importDatabase(${JSON.stringify(e)});`)}comment(e){this._put(`// ${e}`)}getScript(e=null){const t=this.packageNames;let n=(0,o.default)(t).map(e=>`// @require ${e}\n`).join("");return e&&(n+=`// @schedule ${e}`),n&&(n+="\n"),n+this.s}}t.ScriptWriter=s;t.ScriptWriterJson=class{constructor(e="0"){this.s="",this.packageNames=[],this.varCount=0,this.commands=[],this.varCount=parseInt(e)||0}allocVariable(e="var"){return this.varCount+=1,`${e}${this.varCount}`}endLine(){this.commands.push({type:"endline"})}assign(e,t,n){this.commands.push({type:"assign",variableName:e,functionName:(0,i.extractShellApiFunctionName)(t),props:n}),this.packageNames.push(...(0,i.extractShellApiPlugins)(t,n))}assignValue(e,t){this.commands.push({type:"assignValue",variableName:e,jsonValue:t})}copyStream(e,t,n=null){this.commands.push({type:"copyStream",sourceVar:e,targetVar:t,colmapVar:n})}comment(e){this.commands.push({type:"comment",text:e})}dumpDatabase(e){this.commands.push({type:"dumpDatabase",options:e})}importDatabase(e){this.commands.push({type:"importDatabase",options:e})}getScript(e=null){return{type:"json",schedule:e,commands:this.commands,packageNames:this.packageNames}}},t.jsonScriptToJavascript=function(e){const{schedule:t,commands:n,packageNames:r}=e,o=new s;for(const e of r){if(!/^dbgate-plugin-.*$/.test(e))throw new Error("Unallowed package name:"+e);o.packageNames.push(e)}for(const e of n)switch(e.type){case"assign":o.assignCore(e.variableName,e.functionName,e.props);break;case"assignValue":o.assignValue(e.variableName,e.jsonValue);break;case"copyStream":o.copyStream(e.sourceVar,e.targetVar,e.colmapVar);break;case"endLine":o.endLine();break;case"comment":o.comment(e.text);break;case"dumpDatabase":o.dumpDatabase(e.options);break;case"importDatabase":o.importDatabase(e.options)}return o.getScript(t)}},function(e,t,n){var r=n(152);e.exports=function(e){return e&&e.length?r(e):[]}},function(e){e.exports=JSON.parse('{"name":"mongodb","version":"4.7.0","description":"The official MongoDB driver for Node.js","main":"lib/index.js","files":["lib","src","etc/prepare.js","mongodb.d.ts","tsconfig.json"],"types":"mongodb.d.ts","repository":{"type":"git","url":"git@github.com:mongodb/node-mongodb-native.git"},"keywords":["mongodb","driver","official"],"author":{"name":"The MongoDB NodeJS Team","email":"dbx-node@mongodb.com"},"dependencies":{"bson":"^4.6.3","denque":"^2.0.1","mongodb-connection-string-url":"^2.5.2","socks":"^2.6.2"},"devDependencies":{"@iarna/toml":"^2.2.5","@istanbuljs/nyc-config-typescript":"^1.0.2","@microsoft/api-extractor":"^7.24.1","@microsoft/tsdoc-config":"^0.16.1","@mongodb-js/zstd":"^1.0.0","@types/chai":"^4.3.0","@types/chai-subset":"^1.3.3","@types/express":"^4.17.13","@types/kerberos":"^1.1.1","@types/mocha":"^9.1.0","@types/node":"^17.0.23","@types/saslprep":"^1.0.1","@types/semver":"^7.3.9","@types/sinon":"^10.0.11","@types/sinon-chai":"^3.2.8","@types/whatwg-url":"^8.2.1","@typescript-eslint/eslint-plugin":"^5.26.0","@typescript-eslint/parser":"^5.26.0","bluebird":"^3.7.2","chai":"^4.3.6","chai-subset":"^1.6.0","chalk":"^4.1.2","eslint":"^8.12.0","eslint-config-prettier":"^8.5.0","eslint-plugin-import":"^2.25.4","eslint-plugin-prettier":"^4.0.0","eslint-plugin-simple-import-sort":"^7.0.0","eslint-plugin-tsdoc":"^0.2.16","express":"^4.17.3","js-yaml":"^4.1.0","mocha":"^9.2.2","mocha-sinon":"^2.1.2","nyc":"^15.1.0","prettier":"^2.6.1","rimraf":"^3.0.2","semver":"^7.3.5","sinon":"^13.0.1","sinon-chai":"^3.7.0","source-map-support":"^0.5.21","standard-version":"^9.3.2","ts-node":"^10.8.0","tsd":"^0.20.0","typescript":"^4.7.2","typescript-cached-transpile":"^0.0.6","xml2js":"^0.4.23","yargs":"^17.4.0"},"license":"Apache-2.0","engines":{"node":">=12.9.0"},"bugs":{"url":"https://jira.mongodb.org/projects/NODE/issues/"},"homepage":"https://github.com/mongodb/node-mongodb-native","optionalDependencies":{"saslprep":"^1.0.3"},"scripts":{"build:evergreen":"node .evergreen/generate_evergreen_tasks.js","build:ts":"node ./node_modules/typescript/bin/tsc","build:dts":"npm run build:ts && api-extractor run && rimraf \'lib/**/*.d.ts*\'","build:docs":"./etc/docs/build.ts","build:typedoc":"typedoc","check:bench":"node test/benchmarks/driverBench","check:coverage":"nyc npm run test:all","check:integration-coverage":"nyc npm run check:test","check:lint":"npm run build:dts && npm run check:dts && npm run check:eslint && npm run check:tsd","check:eslint":"eslint -v && eslint --max-warnings=0 --ext \'.js,.ts\' src test","check:tsd":"tsd --version && tsd","check:dts":"node ./node_modules/typescript/bin/tsc --noEmit mongodb.d.ts && tsd","check:test":"mocha --config test/mocha_mongodb.json test/integration","check:unit":"mocha test/unit","check:ts":"node ./node_modules/typescript/bin/tsc -v && node ./node_modules/typescript/bin/tsc --noEmit","check:atlas":"mocha --config test/manual/mocharc.json test/manual/atlas_connectivity.test.js","check:adl":"mocha --config test/mocha_mongodb.json test/manual/atlas-data-lake-testing","check:aws":"mocha --config test/mocha_mongodb.json test/integration/auth/mongodb_aws.test.js","check:ocsp":"mocha --config test/manual/mocharc.json test/manual/ocsp_support.test.js","check:kerberos":"mocha --config test/manual/mocharc.json test/manual/kerberos.test.js","check:tls":"mocha --config test/manual/mocharc.json test/manual/tls_support.test.js","check:ldap":"mocha --config test/manual/mocharc.json test/manual/ldap.test.js","check:socks5":"mocha --config test/manual/mocharc.json test/manual/socks5.test.ts","check:csfle":"mocha --config test/mocha_mongodb.json test/integration/client-side-encryption","check:snappy":"mocha test/unit/assorted/snappy.test.js","fix:eslint":"npm run check:eslint -- --fix","prepare":"node etc/prepare.js","preview:docs":"ts-node etc/docs/preview.ts","release":"standard-version -a -i HISTORY.md","test":"npm run check:lint && npm run test:all","test:all":"npm run check:unit && npm run check:test","update:docs":"npm run build:docs -- --yes"},"tsd":{"directory":"test/types","compilerOptions":{"strict":true,"target":"esnext","module":"commonjs","moduleResolution":"node"}}}')},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ListDatabasesOperation=void 0;const r=n(2),o=n(5),i=n(3);class s extends o.CommandOperation{constructor(e,t){super(e,t),this.options=null!=t?t:{},this.ns=new r.MongoDBNamespace("admin","$cmd")}execute(e,t,n){const o={listDatabases:1};this.options.nameOnly&&(o.nameOnly=Number(o.nameOnly)),this.options.filter&&(o.filter=this.options.filter),"boolean"==typeof this.options.authorizedDatabases&&(o.authorizedDatabases=this.options.authorizedDatabases),(0,r.maxWireVersion)(e)>=9&&void 0!==this.options.comment&&(o.comment=this.options.comment),super.executeCommand(e,t,o,n)}}t.ListDatabasesOperation=s,(0,i.defineAspects)(s,[i.Aspect.READ_OPERATION,i.Aspect.RETRYABLE])},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ValidateCollectionOperation=void 0;const r=n(1),o=n(5);class i extends o.CommandOperation{constructor(e,t,n){const r={validate:t},o=Object.keys(n);for(let e=0;e<o.length;e++)Object.prototype.hasOwnProperty.call(n,o[e])&&"session"!==o[e]&&(r[o[e]]=n[o[e]]);super(e.s.db,n),this.options=n,this.command=r,this.collectionName=t}execute(e,t,n){const o=this.collectionName;super.executeCommand(e,t,this.command,(e,t)=>null!=e?n(e):0===t.ok?n(new r.MongoRuntimeError("Error with validate command")):null!=t.result&&"string"!=typeof t.result?n(new r.MongoRuntimeError("Error with validation data")):null!=t.result&&null!=t.result.match(/exception|corrupt/)?n(new r.MongoRuntimeError(`Invalid collection ${o}`)):null==t.valid||t.valid?n(void 0,t):n(new r.MongoRuntimeError(`Invalid collection ${o}`)))}}t.ValidateCollectionOperation=i},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.OrderedBulkOperation=void 0;const r=n(4),o=n(1),i=n(61);class s extends i.BulkOperationBase{constructor(e,t){super(e,t,!0)}addToOperationsList(e,t){const n=r.calculateObjectSize(t,{checkKeys:!1,ignoreUndefined:!1});if(n>=this.s.maxBsonObjectSize)throw new o.MongoInvalidArgumentError(`Document is larger than the maximum size ${this.s.maxBsonObjectSize}`);null==this.s.currentBatch&&(this.s.currentBatch=new i.Batch(e,this.s.currentIndex));const s=this.s.maxKeySize;if((this.s.currentBatchSize+1>=this.s.maxWriteBatchSize||this.s.currentBatchSize>0&&this.s.currentBatchSizeBytes+s+n>=this.s.maxBatchSizeBytes||this.s.currentBatch.batchType!==e)&&(this.s.batches.push(this.s.currentBatch),this.s.currentBatch=new i.Batch(e,this.s.currentIndex),this.s.currentBatchSize=0,this.s.currentBatchSizeBytes=0),e===i.BatchType.INSERT&&this.s.bulkResult.insertedIds.push({index:this.s.currentIndex,_id:t._id}),Array.isArray(t))throw new o.MongoInvalidArgumentError("Operation passed in cannot be an Array");return this.s.currentBatch.originalIndexes.push(this.s.currentIndex),this.s.currentBatch.operations.push(t),this.s.currentBatchSize+=1,this.s.currentBatchSizeBytes+=s+n,this.s.currentIndex+=1,this}}t.OrderedBulkOperation=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.UnorderedBulkOperation=void 0;const r=n(4),o=n(1),i=n(61);class s extends i.BulkOperationBase{constructor(e,t){super(e,t,!1)}handleWriteError(e,t){return!this.s.batches.length&&super.handleWriteError(e,t)}addToOperationsList(e,t){const n=r.calculateObjectSize(t,{checkKeys:!1,ignoreUndefined:!1});if(n>=this.s.maxBsonObjectSize)throw new o.MongoInvalidArgumentError(`Document is larger than the maximum size ${this.s.maxBsonObjectSize}`);this.s.currentBatch=void 0,e===i.BatchType.INSERT?this.s.currentBatch=this.s.currentInsertBatch:e===i.BatchType.UPDATE?this.s.currentBatch=this.s.currentUpdateBatch:e===i.BatchType.DELETE&&(this.s.currentBatch=this.s.currentRemoveBatch);const s=this.s.maxKeySize;if(null==this.s.currentBatch&&(this.s.currentBatch=new i.Batch(e,this.s.currentIndex)),(this.s.currentBatch.size+1>=this.s.maxWriteBatchSize||this.s.currentBatch.size>0&&this.s.currentBatch.sizeBytes+s+n>=this.s.maxBatchSizeBytes||this.s.currentBatch.batchType!==e)&&(this.s.batches.push(this.s.currentBatch),this.s.currentBatch=new i.Batch(e,this.s.currentIndex)),Array.isArray(t))throw new o.MongoInvalidArgumentError("Operation passed in cannot be an Array");return this.s.currentBatch.operations.push(t),this.s.currentBatch.originalIndexes.push(this.s.currentIndex),this.s.currentIndex=this.s.currentIndex+1,e===i.BatchType.INSERT?(this.s.currentInsertBatch=this.s.currentBatch,this.s.bulkResult.insertedIds.push({index:this.s.bulkResult.insertedIds.length,_id:t._id})):e===i.BatchType.UPDATE?this.s.currentUpdateBatch=this.s.currentBatch:e===i.BatchType.DELETE&&(this.s.currentRemoveBatch=this.s.currentBatch),this.s.currentBatch.size+=1,this.s.currentBatch.sizeBytes+=s+n,this}}t.UnorderedBulkOperation=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.GetMoreOperation=void 0;const r=n(1),o=n(2),i=n(3);class s extends i.AbstractOperation{constructor(e,t,n,r={}){super(r),this.options=r,(0,o.maxWireVersion)(n)<9&&delete this.options.comment,this.ns=e,this.cursorId=t,this.server=n}execute(e,t,n){if(e!==this.server)return n(new r.MongoRuntimeError("Getmore must run on the same server operation began on"));e.getMore(this.ns,this.cursorId,this.options,n)}}t.GetMoreOperation=s,(0,i.defineAspects)(s,[i.Aspect.READ_OPERATION,i.Aspect.CURSOR_ITERATING])},function(e,t){e.exports=require("util")},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CollectionsOperation=void 0;const r=n(34),o=n(3);class i extends o.AbstractOperation{constructor(e,t){super(t),this.options=t,this.db=e}execute(e,t,n){const o=this.db;o.listCollections({},{...this.options,nameOnly:!0,readPreference:this.readPreference,session:t}).toArray((e,t)=>{if(e||!t)return n(e);t=t.filter(e=>-1===e.name.indexOf("$")),n(void 0,t.map(e=>new r.Collection(o,e.name,o.s.options)))})}}t.CollectionsOperation=i},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CreateCollectionOperation=void 0;const r=n(34),o=n(5),i=n(63),s=n(3),u=new Set(["w","wtimeout","j","fsync","autoIndexId","pkFactory","raw","readPreference","session","readConcern","writeConcern","raw","fieldsAsRaw","promoteLongs","promoteValues","promoteBuffers","bsonRegExp","serializeFunctions","ignoreUndefined","enableUtf8Validation"]);class a extends o.CommandOperation{constructor(e,t,n={}){super(e,n),this.options=n,this.db=e,this.name=t}execute(e,t,n){(async()=>{var n,r,o,s,u,c;const l=this.db,d=this.name,f=this.options,p=null!==(n=f.encryptedFields)&&void 0!==n?n:null===(o=null===(r=l.s.client.options.autoEncryption)||void 0===r?void 0:r.encryptedFieldsMap)||void 0===o?void 0:o[`${l.databaseName}.${d}`];if(p){const n=null!==(s=p.escCollection)&&void 0!==s?s:`enxcol_.${d}.esc`,r=null!==(u=p.eccCollection)&&void 0!==u?u:`enxcol_.${d}.ecc`,o=null!==(c=p.ecocCollection)&&void 0!==c?c:`enxcol_.${d}.ecoc`;for(const i of[n,r,o]){const n=new a(l,i,{clusteredIndex:{key:{_id:1},unique:!0}});await n.executeWithoutEncryptedFieldsCheck(e,t)}f.encryptedFields||(this.options={...this.options,encryptedFields:p})}const h=await this.executeWithoutEncryptedFieldsCheck(e,t);if(p){const n=new i.CreateIndexOperation(l,d,{__safeContent__:1},{});await new Promise((r,o)=>{n.execute(e,t,e=>e?o(e):r())})}return h})().then(e=>n(void 0,e),e=>n(e))}executeWithoutEncryptedFieldsCheck(e,t){return new Promise((n,o)=>{const i=this.db,s=this.name,a=this.options,c={create:s};for(const e in a)null==a[e]||"function"==typeof a[e]||u.has(e)||(c[e]=a[e]);super.executeCommand(e,t,c,e=>{if(e)return o(e);n(new r.Collection(i,s,a))})})}}t.CreateCollectionOperation=a,(0,s.defineAspects)(a,[s.Aspect.WRITE_OPERATION])},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ProfilingLevelOperation=void 0;const r=n(1),o=n(5);class i extends o.CommandOperation{constructor(e,t){super(e,t),this.options=t}execute(e,t,n){super.executeCommand(e,t,{profile:-1},(e,t)=>{if(null==e&&1===t.ok){const e=t.was;return 0===e?n(void 0,"off"):1===e?n(void 0,"slow_only"):2===e?n(void 0,"all"):n(new r.MongoRuntimeError(`Illegal profiling level value ${e}`))}n(null!=e?e:new r.MongoRuntimeError("Error with profile command"))})}}t.ProfilingLevelOperation=i},function(e,t,n){"use strict";const{URL:r,URLSearchParams:o}=n(382),i=n(176),s=n(108),u={Array:Array,Object:Object,Promise:Promise,String:String,TypeError:TypeError};r.install(u,["Window"]),o.install(u,["Window"]),t.URL=u.URL,t.URLSearchParams=u.URLSearchParams,t.parseURL=i.parseURL,t.basicURLParse=i.basicURLParse,t.serializeURL=i.serializeURL,t.serializePath=i.serializePath,t.serializeHost=i.serializeHost,t.serializeInteger=i.serializeInteger,t.serializeURLOrigin=i.serializeURLOrigin,t.setTheUsername=i.setTheUsername,t.setThePassword=i.setThePassword,t.cannotHaveAUsernamePasswordPort=i.cannotHaveAUsernamePasswordPort,t.hasAnOpaquePath=i.hasAnOpaquePath,t.percentDecodeString=s.percentDecodeString,t.percentDecodeBytes=s.percentDecodeBytes},function(e,t,n){"use strict";const r=n(383),o=n(179);t.URL=r,t.URLSearchParams=o},function(e,t,n){"use strict";const r=n(105),o=n(106),i=o.implSymbol,s=o.ctorRegistrySymbol;function u(e,t){let n;return void 0!==t&&(n=t.prototype),o.isObject(n)||(n=e[s].URL.prototype),Object.create(n)}t.is=e=>o.isObject(e)&&o.hasOwn(e,i)&&e[i]instanceof c.implementation,t.isImpl=e=>o.isObject(e)&&e instanceof c.implementation,t.convert=(e,n,{context:r="The provided value"}={})=>{if(t.is(n))return o.implForWrapper(n);throw new e.TypeError(`${r} is not of type 'URL'.`)},t.create=(e,n,r)=>{const o=u(e);return t.setup(o,e,n,r)},t.createImpl=(e,n,r)=>{const i=t.create(e,n,r);return o.implForWrapper(i)},t._internalSetup=(e,t)=>{},t.setup=(e,n,r=[],s={})=>(s.wrapper=e,t._internalSetup(e,n),Object.defineProperty(e,i,{value:new c.implementation(n,r,s),configurable:!0}),e[i][o.wrapperSymbol]=e,c.init&&c.init(e[i]),e),t.new=(e,n)=>{const r=u(e,n);return t._internalSetup(r,e),Object.defineProperty(r,i,{value:Object.create(c.implementation.prototype),configurable:!0}),r[i][o.wrapperSymbol]=r,c.init&&c.init(r[i]),r[i]};const a=new Set(["Window","Worker"]);t.install=(e,n)=>{if(!n.some(e=>a.has(e)))return;const s=o.initCtorRegistry(e);class u{constructor(n){if(arguments.length<1)throw new e.TypeError(`Failed to construct 'URL': 1 argument required, but only ${arguments.length} present.`);const o=[];{let t=arguments[0];t=r.USVString(t,{context:"Failed to construct 'URL': parameter 1",globals:e}),o.push(t)}{let t=arguments[1];void 0!==t&&(t=r.USVString(t,{context:"Failed to construct 'URL': parameter 2",globals:e})),o.push(t)}return t.setup(Object.create(new.target.prototype),e,o)}toJSON(){const n=null!=this?this:e;if(!t.is(n))throw new e.TypeError("'toJSON' called on an object that is not a valid instance of URL.");return n[i].toJSON()}get href(){const n=null!=this?this:e;if(!t.is(n))throw new e.TypeError("'get href' called on an object that is not a valid instance of URL.");return n[i].href}set href(n){const o=null!=this?this:e;if(!t.is(o))throw new e.TypeError("'set href' called on an object that is not a valid instance of URL.");n=r.USVString(n,{context:"Failed to set the 'href' property on 'URL': The provided value",globals:e}),o[i].href=n}toString(){if(!t.is(this))throw new e.TypeError("'toString' called on an object that is not a valid instance of URL.");return this[i].href}get origin(){const n=null!=this?this:e;if(!t.is(n))throw new e.TypeError("'get origin' called on an object that is not a valid instance of URL.");return n[i].origin}get protocol(){const n=null!=this?this:e;if(!t.is(n))throw new e.TypeError("'get protocol' called on an object that is not a valid instance of URL.");return n[i].protocol}set protocol(n){const o=null!=this?this:e;if(!t.is(o))throw new e.TypeError("'set protocol' called on an object that is not a valid instance of URL.");n=r.USVString(n,{context:"Failed to set the 'protocol' property on 'URL': The provided value",globals:e}),o[i].protocol=n}get username(){const n=null!=this?this:e;if(!t.is(n))throw new e.TypeError("'get username' called on an object that is not a valid instance of URL.");return n[i].username}set username(n){const o=null!=this?this:e;if(!t.is(o))throw new e.TypeError("'set username' called on an object that is not a valid instance of URL.");n=r.USVString(n,{context:"Failed to set the 'username' property on 'URL': The provided value",globals:e}),o[i].username=n}get password(){const n=null!=this?this:e;if(!t.is(n))throw new e.TypeError("'get password' called on an object that is not a valid instance of URL.");return n[i].password}set password(n){const o=null!=this?this:e;if(!t.is(o))throw new e.TypeError("'set password' called on an object that is not a valid instance of URL.");n=r.USVString(n,{context:"Failed to set the 'password' property on 'URL': The provided value",globals:e}),o[i].password=n}get host(){const n=null!=this?this:e;if(!t.is(n))throw new e.TypeError("'get host' called on an object that is not a valid instance of URL.");return n[i].host}set host(n){const o=null!=this?this:e;if(!t.is(o))throw new e.TypeError("'set host' called on an object that is not a valid instance of URL.");n=r.USVString(n,{context:"Failed to set the 'host' property on 'URL': The provided value",globals:e}),o[i].host=n}get hostname(){const n=null!=this?this:e;if(!t.is(n))throw new e.TypeError("'get hostname' called on an object that is not a valid instance of URL.");return n[i].hostname}set hostname(n){const o=null!=this?this:e;if(!t.is(o))throw new e.TypeError("'set hostname' called on an object that is not a valid instance of URL.");n=r.USVString(n,{context:"Failed to set the 'hostname' property on 'URL': The provided value",globals:e}),o[i].hostname=n}get port(){const n=null!=this?this:e;if(!t.is(n))throw new e.TypeError("'get port' called on an object that is not a valid instance of URL.");return n[i].port}set port(n){const o=null!=this?this:e;if(!t.is(o))throw new e.TypeError("'set port' called on an object that is not a valid instance of URL.");n=r.USVString(n,{context:"Failed to set the 'port' property on 'URL': The provided value",globals:e}),o[i].port=n}get pathname(){const n=null!=this?this:e;if(!t.is(n))throw new e.TypeError("'get pathname' called on an object that is not a valid instance of URL.");return n[i].pathname}set pathname(n){const o=null!=this?this:e;if(!t.is(o))throw new e.TypeError("'set pathname' called on an object that is not a valid instance of URL.");n=r.USVString(n,{context:"Failed to set the 'pathname' property on 'URL': The provided value",globals:e}),o[i].pathname=n}get search(){const n=null!=this?this:e;if(!t.is(n))throw new e.TypeError("'get search' called on an object that is not a valid instance of URL.");return n[i].search}set search(n){const o=null!=this?this:e;if(!t.is(o))throw new e.TypeError("'set search' called on an object that is not a valid instance of URL.");n=r.USVString(n,{context:"Failed to set the 'search' property on 'URL': The provided value",globals:e}),o[i].search=n}get searchParams(){const n=null!=this?this:e;if(!t.is(n))throw new e.TypeError("'get searchParams' called on an object that is not a valid instance of URL.");return o.getSameObject(this,"searchParams",()=>o.tryWrapperForImpl(n[i].searchParams))}get hash(){const n=null!=this?this:e;if(!t.is(n))throw new e.TypeError("'get hash' called on an object that is not a valid instance of URL.");return n[i].hash}set hash(n){const o=null!=this?this:e;if(!t.is(o))throw new e.TypeError("'set hash' called on an object that is not a valid instance of URL.");n=r.USVString(n,{context:"Failed to set the 'hash' property on 'URL': The provided value",globals:e}),o[i].hash=n}}Object.defineProperties(u.prototype,{toJSON:{enumerable:!0},href:{enumerable:!0},toString:{enumerable:!0},origin:{enumerable:!0},protocol:{enumerable:!0},username:{enumerable:!0},password:{enumerable:!0},host:{enumerable:!0},hostname:{enumerable:!0},port:{enumerable:!0},pathname:{enumerable:!0},search:{enumerable:!0},searchParams:{enumerable:!0},hash:{enumerable:!0},[Symbol.toStringTag]:{value:"URL",configurable:!0}}),s.URL=u,Object.defineProperty(e,"URL",{configurable:!0,writable:!0,value:u}),n.includes("Window")&&Object.defineProperty(e,"webkitURL",{configurable:!0,writable:!0,value:u})};const c=n(384)},function(e,t,n){"use strict";const r=n(176),o=n(178),i=n(179);t.implementation=class{constructor(e,t){const n=t[0],o=t[1];let s=null;if(void 0!==o&&(s=r.basicURLParse(o),null===s))throw new TypeError(`Invalid base URL: ${o}`);const u=r.basicURLParse(n,{baseURL:s});if(null===u)throw new TypeError(`Invalid URL: ${n}`);const a=null!==u.query?u.query:"";this._url=u,this._query=i.createImpl(e,[a],{doNotStripQMark:!0}),this._query._url=this}get href(){return r.serializeURL(this._url)}set href(e){const t=r.basicURLParse(e);if(null===t)throw new TypeError(`Invalid URL: ${e}`);this._url=t,this._query._list.splice(0);const{query:n}=t;null!==n&&(this._query._list=o.parseUrlencodedString(n))}get origin(){return r.serializeURLOrigin(this._url)}get protocol(){return`${this._url.scheme}:`}set protocol(e){r.basicURLParse(`${e}:`,{url:this._url,stateOverride:"scheme start"})}get username(){return this._url.username}set username(e){r.cannotHaveAUsernamePasswordPort(this._url)||r.setTheUsername(this._url,e)}get password(){return this._url.password}set password(e){r.cannotHaveAUsernamePasswordPort(this._url)||r.setThePassword(this._url,e)}get host(){const e=this._url;return null===e.host?"":null===e.port?r.serializeHost(e.host):`${r.serializeHost(e.host)}:${r.serializeInteger(e.port)}`}set host(e){r.hasAnOpaquePath(this._url)||r.basicURLParse(e,{url:this._url,stateOverride:"host"})}get hostname(){return null===this._url.host?"":r.serializeHost(this._url.host)}set hostname(e){r.hasAnOpaquePath(this._url)||r.basicURLParse(e,{url:this._url,stateOverride:"hostname"})}get port(){return null===this._url.port?"":r.serializeInteger(this._url.port)}set port(e){r.cannotHaveAUsernamePasswordPort(this._url)||(""===e?this._url.port=null:r.basicURLParse(e,{url:this._url,stateOverride:"port"}))}get pathname(){return r.serializePath(this._url)}set pathname(e){r.hasAnOpaquePath(this._url)||(this._url.path=[],r.basicURLParse(e,{url:this._url,stateOverride:"path start"}))}get search(){return null===this._url.query||""===this._url.query?"":`?${this._url.query}`}set search(e){const t=this._url;if(""===e)return t.query=null,void(this._query._list=[]);const n="?"===e[0]?e.substring(1):e;t.query="",r.basicURLParse(n,{url:t,stateOverride:"query"}),this._query._list=o.parseUrlencodedString(n)}get searchParams(){return this._query}get hash(){return null===this._url.fragment||""===this._url.fragment?"":`#${this._url.fragment}`}set hash(e){if(""===e)return void(this._url.fragment=null);const t="#"===e[0]?e.substring(1):e;this._url.fragment="",r.basicURLParse(t,{url:this._url,stateOverride:"fragment"})}toJSON(){return this.href}}},function(e,t,n){"use strict";const r=n(386),o=n(387),i=n(388),{STATUS_MAPPING:s}=n(389);function u(e,{useSTD3ASCIIRules:t}){let n=0,r=i.length-1;for(;n<=r;){const o=Math.floor((n+r)/2),u=i[o],a=Array.isArray(u[0])?u[0][0]:u[0],c=Array.isArray(u[0])?u[0][1]:u[0];if(a<=e&&c>=e)return!t||u[1]!==s.disallowed_STD3_valid&&u[1]!==s.disallowed_STD3_mapped?u[1]===s.disallowed_STD3_valid?[s.valid,...u.slice(2)]:u[1]===s.disallowed_STD3_mapped?[s.mapped,...u.slice(2)]:u.slice(1):[s.disallowed,...u.slice(2)];a>e?r=o-1:n=o+1}return null}function a(e,{checkHyphens:t,checkBidi:n,checkJoiners:r,processingOption:i,useSTD3ASCIIRules:a}){if(e.normalize("NFC")!==e)return!1;const c=Array.from(e);if(t&&("-"===c[2]&&"-"===c[3]||e.startsWith("-")||e.endsWith("-")))return!1;if(e.includes(".")||c.length>0&&o.combiningMarks.test(c[0]))return!1;for(const e of c){const[t]=u(e.codePointAt(0),{useSTD3ASCIIRules:a});if("transitional"===i&&t!==s.valid||"nontransitional"===i&&t!==s.valid&&t!==s.deviation)return!1}if(r){let e=0;for(const[t,n]of c.entries())if(""===n||""===n){if(t>0){if(o.combiningClassVirama.test(c[t-1]))continue;if(""===n){const n=c.indexOf("",t+1),r=n<0?c.slice(e):c.slice(e,n);if(o.validZWNJ.test(r.join(""))){e=t+1;continue}}}return!1}}if(n){let t;if(o.bidiS1LTR.test(c[0]))t=!1;else{if(!o.bidiS1RTL.test(c[0]))return!1;t=!0}if(t){if(!o.bidiS2.test(e)||!o.bidiS3.test(e)||o.bidiS4EN.test(e)&&o.bidiS4AN.test(e))return!1}else if(!o.bidiS5.test(e)||!o.bidiS6.test(e))return!1}return!0}function c(e,t){const{processingOption:n}=t;let{string:i,error:c}=function(e,{useSTD3ASCIIRules:t,processingOption:n}){let r=!1,o="";for(const i of e){const[e,a]=u(i.codePointAt(0),{useSTD3ASCIIRules:t});switch(e){case s.disallowed:r=!0,o+=i;break;case s.ignored:break;case s.mapped:o+=a;break;case s.deviation:o+="transitional"===n?a:i;break;case s.valid:o+=i}}return{string:o,error:r}}(e,t);i=i.normalize("NFC");const l=i.split("."),d=function(e){const t=e.map(e=>{if(e.startsWith("xn--"))try{return r.decode(e.substring(4))}catch(e){return""}return e}).join(".");return o.bidiDomain.test(t)}(l);for(const[e,o]of l.entries()){let i=o,s=n;if(i.startsWith("xn--")){try{i=r.decode(i.substring(4)),l[e]=i}catch(e){c=!0;continue}s="nontransitional"}if(c)continue;a(i,{...t,processingOption:s,checkBidi:t.checkBidi&&d})||(c=!0)}return{string:l.join("."),error:c}}e.exports={toASCII:function(e,{checkHyphens:t=!1,checkBidi:n=!1,checkJoiners:o=!1,useSTD3ASCIIRules:i=!1,processingOption:s="nontransitional",verifyDNSLength:u=!1}={}){if("transitional"!==s&&"nontransitional"!==s)throw new RangeError("processingOption must be either transitional or nontransitional");const a=c(e,{processingOption:s,checkHyphens:t,checkBidi:n,checkJoiners:o,useSTD3ASCIIRules:i});let l=a.string.split(".");if(l=l.map(e=>{if(/[^\x00-\x7F]/u.test(e))try{return`xn--${r.encode(e)}`}catch(e){a.error=!0}return e}),u){const e=l.join(".").length;(e>253||0===e)&&(a.error=!0);for(let e=0;e<l.length;++e)if(l[e].length>63||0===l[e].length){a.error=!0;break}}return a.error?null:l.join(".")},toUnicode:function(e,{checkHyphens:t=!1,checkBidi:n=!1,checkJoiners:r=!1,useSTD3ASCIIRules:o=!1,processingOption:i="nontransitional"}={}){const s=c(e,{processingOption:i,checkHyphens:t,checkBidi:n,checkJoiners:r,useSTD3ASCIIRules:o});return{domain:s.string,error:s.error}}}},function(e,t){e.exports=require("punycode")},function(e,t,n){"use strict";e.exports={combiningMarks:/[\u0300-\u036F\u0483-\u0489\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u0711\u0730-\u074A\u07A6-\u07B0\u07EB-\u07F3\u07FD\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u0898-\u089F\u08CA-\u08E1\u08E3-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962\u0963\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7\u09C8\u09CB-\u09CD\u09D7\u09E2\u09E3\u09FE\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A70\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2\u0AE3\u0AFA-\u0AFF\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B55-\u0B57\u0B62\u0B63\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0C00-\u0C04\u0C3C\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C81-\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0D00-\u0D03\u0D3B\u0D3C\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62\u0D63\u0D81-\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DF2\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0EB1\u0EB4-\u0EBC\u0EC8-\u0ECD\u0F18\u0F19\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F71-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102B-\u103E\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F\u109A-\u109D\u135D-\u135F\u1712-\u1715\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4-\u17D3\u17DD\u180B-\u180D\u180F\u1885\u1886\u18A9\u1920-\u192B\u1930-\u193B\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F\u1AB0-\u1ACE\u1B00-\u1B04\u1B34-\u1B44\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BE6-\u1BF3\u1C24-\u1C37\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF4\u1CF7-\u1CF9\u1DC0-\u1DFF\u20D0-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\uA66F-\uA672\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA82C\uA880\uA881\uA8B4-\uA8C5\uA8E0-\uA8F1\uA8FF\uA926-\uA92D\uA947-\uA953\uA980-\uA983\uA9B3-\uA9C0\uA9E5\uAA29-\uAA36\uAA43\uAA4C\uAA4D\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5\uAAF6\uABE3-\uABEA\uABEC\uABED\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F\u{101FD}\u{102E0}\u{10376}-\u{1037A}\u{10A01}-\u{10A03}\u{10A05}\u{10A06}\u{10A0C}-\u{10A0F}\u{10A38}-\u{10A3A}\u{10A3F}\u{10AE5}\u{10AE6}\u{10D24}-\u{10D27}\u{10EAB}\u{10EAC}\u{10F46}-\u{10F50}\u{10F82}-\u{10F85}\u{11000}-\u{11002}\u{11038}-\u{11046}\u{11070}\u{11073}\u{11074}\u{1107F}-\u{11082}\u{110B0}-\u{110BA}\u{110C2}\u{11100}-\u{11102}\u{11127}-\u{11134}\u{11145}\u{11146}\u{11173}\u{11180}-\u{11182}\u{111B3}-\u{111C0}\u{111C9}-\u{111CC}\u{111CE}\u{111CF}\u{1122C}-\u{11237}\u{1123E}\u{112DF}-\u{112EA}\u{11300}-\u{11303}\u{1133B}\u{1133C}\u{1133E}-\u{11344}\u{11347}\u{11348}\u{1134B}-\u{1134D}\u{11357}\u{11362}\u{11363}\u{11366}-\u{1136C}\u{11370}-\u{11374}\u{11435}-\u{11446}\u{1145E}\u{114B0}-\u{114C3}\u{115AF}-\u{115B5}\u{115B8}-\u{115C0}\u{115DC}\u{115DD}\u{11630}-\u{11640}\u{116AB}-\u{116B7}\u{1171D}-\u{1172B}\u{1182C}-\u{1183A}\u{11930}-\u{11935}\u{11937}\u{11938}\u{1193B}-\u{1193E}\u{11940}\u{11942}\u{11943}\u{119D1}-\u{119D7}\u{119DA}-\u{119E0}\u{119E4}\u{11A01}-\u{11A0A}\u{11A33}-\u{11A39}\u{11A3B}-\u{11A3E}\u{11A47}\u{11A51}-\u{11A5B}\u{11A8A}-\u{11A99}\u{11C2F}-\u{11C36}\u{11C38}-\u{11C3F}\u{11C92}-\u{11CA7}\u{11CA9}-\u{11CB6}\u{11D31}-\u{11D36}\u{11D3A}\u{11D3C}\u{11D3D}\u{11D3F}-\u{11D45}\u{11D47}\u{11D8A}-\u{11D8E}\u{11D90}\u{11D91}\u{11D93}-\u{11D97}\u{11EF3}-\u{11EF6}\u{16AF0}-\u{16AF4}\u{16B30}-\u{16B36}\u{16F4F}\u{16F51}-\u{16F87}\u{16F8F}-\u{16F92}\u{16FE4}\u{16FF0}\u{16FF1}\u{1BC9D}\u{1BC9E}\u{1CF00}-\u{1CF2D}\u{1CF30}-\u{1CF46}\u{1D165}-\u{1D169}\u{1D16D}-\u{1D172}\u{1D17B}-\u{1D182}\u{1D185}-\u{1D18B}\u{1D1AA}-\u{1D1AD}\u{1D242}-\u{1D244}\u{1DA00}-\u{1DA36}\u{1DA3B}-\u{1DA6C}\u{1DA75}\u{1DA84}\u{1DA9B}-\u{1DA9F}\u{1DAA1}-\u{1DAAF}\u{1E000}-\u{1E006}\u{1E008}-\u{1E018}\u{1E01B}-\u{1E021}\u{1E023}\u{1E024}\u{1E026}-\u{1E02A}\u{1E130}-\u{1E136}\u{1E2AE}\u{1E2EC}-\u{1E2EF}\u{1E8D0}-\u{1E8D6}\u{1E944}-\u{1E94A}\u{E0100}-\u{E01EF}]/u,combiningClassVirama:/[\u094D\u09CD\u0A4D\u0ACD\u0B4D\u0BCD\u0C4D\u0CCD\u0D3B\u0D3C\u0D4D\u0DCA\u0E3A\u0EBA\u0F84\u1039\u103A\u1714\u1734\u17D2\u1A60\u1B44\u1BAA\u1BAB\u1BF2\u1BF3\u2D7F\uA806\uA8C4\uA953\uA9C0\uAAF6\uABED\u{10A3F}\u{11046}\u{1107F}\u{110B9}\u{11133}\u{11134}\u{111C0}\u{11235}\u{112EA}\u{1134D}\u{11442}\u{114C2}\u{115BF}\u{1163F}\u{116B6}\u{1172B}\u{11839}\u{119E0}\u{11A34}\u{11A47}\u{11A99}\u{11C3F}\u{11D44}\u{11D45}\u{11D97}]/u,validZWNJ:/[\u0620\u0626\u0628\u062A-\u062E\u0633-\u063F\u0641-\u0647\u0649\u064A\u066E\u066F\u0678-\u0687\u069A-\u06BF\u06C1\u06C2\u06CC\u06CE\u06D0\u06D1\u06FA-\u06FC\u06FF\u0712-\u0714\u071A-\u071D\u071F-\u0727\u0729\u072B\u072D\u072E\u074E-\u0758\u075C-\u076A\u076D-\u0770\u0772\u0775-\u0777\u077A-\u077F\u07CA-\u07EA\u0841-\u0845\u0848\u084A-\u0853\u0855\u0860\u0862-\u0865\u0868\u08A0-\u08A9\u08AF\u08B0\u08B3\u08B4\u08B6-\u08B8\u08BA-\u08BD\u1807\u1820-\u1878\u1887-\u18A8\u18AA\uA840-\uA872\u{10AC0}-\u{10AC4}\u{10ACD}\u{10AD3}-\u{10ADC}\u{10ADE}-\u{10AE0}\u{10AEB}-\u{10AEE}\u{10B80}\u{10B82}\u{10B86}-\u{10B88}\u{10B8A}\u{10B8B}\u{10B8D}\u{10B90}\u{10BAD}\u{10BAE}\u{10D00}-\u{10D21}\u{10D23}\u{10F30}-\u{10F32}\u{10F34}-\u{10F44}\u{10F51}-\u{10F53}\u{1E900}-\u{1E943}][\xAD\u0300-\u036F\u0483-\u0489\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u061C\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u070F\u0711\u0730-\u074A\u07A6-\u07B0\u07EB-\u07F3\u07FD\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u08D3-\u08E1\u08E3-\u0902\u093A\u093C\u0941-\u0948\u094D\u0951-\u0957\u0962\u0963\u0981\u09BC\u09C1-\u09C4\u09CD\u09E2\u09E3\u09FE\u0A01\u0A02\u0A3C\u0A41\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A70\u0A71\u0A75\u0A81\u0A82\u0ABC\u0AC1-\u0AC5\u0AC7\u0AC8\u0ACD\u0AE2\u0AE3\u0AFA-\u0AFF\u0B01\u0B3C\u0B3F\u0B41-\u0B44\u0B4D\u0B56\u0B62\u0B63\u0B82\u0BC0\u0BCD\u0C00\u0C04\u0C3E-\u0C40\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C81\u0CBC\u0CBF\u0CC6\u0CCC\u0CCD\u0CE2\u0CE3\u0D00\u0D01\u0D3B\u0D3C\u0D41-\u0D44\u0D4D\u0D62\u0D63\u0DCA\u0DD2-\u0DD4\u0DD6\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0EB1\u0EB4-\u0EBC\u0EC8-\u0ECD\u0F18\u0F19\u0F35\u0F37\u0F39\u0F71-\u0F7E\u0F80-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102D-\u1030\u1032-\u1037\u1039\u103A\u103D\u103E\u1058\u1059\u105E-\u1060\u1071-\u1074\u1082\u1085\u1086\u108D\u109D\u135D-\u135F\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4\u17B5\u17B7-\u17BD\u17C6\u17C9-\u17D3\u17DD\u180B-\u180D\u1885\u1886\u18A9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193B\u1A17\u1A18\u1A1B\u1A56\u1A58-\u1A5E\u1A60\u1A62\u1A65-\u1A6C\u1A73-\u1A7C\u1A7F\u1AB0-\u1ABE\u1B00-\u1B03\u1B34\u1B36-\u1B3A\u1B3C\u1B42\u1B6B-\u1B73\u1B80\u1B81\u1BA2-\u1BA5\u1BA8\u1BA9\u1BAB-\u1BAD\u1BE6\u1BE8\u1BE9\u1BED\u1BEF-\u1BF1\u1C2C-\u1C33\u1C36\u1C37\u1CD0-\u1CD2\u1CD4-\u1CE0\u1CE2-\u1CE8\u1CED\u1CF4\u1CF8\u1CF9\u1DC0-\u1DF9\u1DFB-\u1DFF\u200B\u200E\u200F\u202A-\u202E\u2060-\u2064\u206A-\u206F\u20D0-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302D\u3099\u309A\uA66F-\uA672\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA825\uA826\uA8C4\uA8C5\uA8E0-\uA8F1\uA8FF\uA926-\uA92D\uA947-\uA951\uA980-\uA982\uA9B3\uA9B6-\uA9B9\uA9BC\uA9BD\uA9E5\uAA29-\uAA2E\uAA31\uAA32\uAA35\uAA36\uAA43\uAA4C\uAA7C\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEC\uAAED\uAAF6\uABE5\uABE8\uABED\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F\uFEFF\uFFF9-\uFFFB\u{101FD}\u{102E0}\u{10376}-\u{1037A}\u{10A01}-\u{10A03}\u{10A05}\u{10A06}\u{10A0C}-\u{10A0F}\u{10A38}-\u{10A3A}\u{10A3F}\u{10AE5}\u{10AE6}\u{10D24}-\u{10D27}\u{10F46}-\u{10F50}\u{11001}\u{11038}-\u{11046}\u{1107F}-\u{11081}\u{110B3}-\u{110B6}\u{110B9}\u{110BA}\u{11100}-\u{11102}\u{11127}-\u{1112B}\u{1112D}-\u{11134}\u{11173}\u{11180}\u{11181}\u{111B6}-\u{111BE}\u{111C9}-\u{111CC}\u{1122F}-\u{11231}\u{11234}\u{11236}\u{11237}\u{1123E}\u{112DF}\u{112E3}-\u{112EA}\u{11300}\u{11301}\u{1133B}\u{1133C}\u{11340}\u{11366}-\u{1136C}\u{11370}-\u{11374}\u{11438}-\u{1143F}\u{11442}-\u{11444}\u{11446}\u{1145E}\u{114B3}-\u{114B8}\u{114BA}\u{114BF}\u{114C0}\u{114C2}\u{114C3}\u{115B2}-\u{115B5}\u{115BC}\u{115BD}\u{115BF}\u{115C0}\u{115DC}\u{115DD}\u{11633}-\u{1163A}\u{1163D}\u{1163F}\u{11640}\u{116AB}\u{116AD}\u{116B0}-\u{116B5}\u{116B7}\u{1171D}-\u{1171F}\u{11722}-\u{11725}\u{11727}-\u{1172B}\u{1182F}-\u{11837}\u{11839}\u{1183A}\u{119D4}-\u{119D7}\u{119DA}\u{119DB}\u{119E0}\u{11A01}-\u{11A0A}\u{11A33}-\u{11A38}\u{11A3B}-\u{11A3E}\u{11A47}\u{11A51}-\u{11A56}\u{11A59}-\u{11A5B}\u{11A8A}-\u{11A96}\u{11A98}\u{11A99}\u{11C30}-\u{11C36}\u{11C38}-\u{11C3D}\u{11C3F}\u{11C92}-\u{11CA7}\u{11CAA}-\u{11CB0}\u{11CB2}\u{11CB3}\u{11CB5}\u{11CB6}\u{11D31}-\u{11D36}\u{11D3A}\u{11D3C}\u{11D3D}\u{11D3F}-\u{11D45}\u{11D47}\u{11D90}\u{11D91}\u{11D95}\u{11D97}\u{11EF3}\u{11EF4}\u{13430}-\u{13438}\u{16AF0}-\u{16AF4}\u{16B30}-\u{16B36}\u{16F4F}\u{16F8F}-\u{16F92}\u{1BC9D}\u{1BC9E}\u{1BCA0}-\u{1BCA3}\u{1D167}-\u{1D169}\u{1D173}-\u{1D182}\u{1D185}-\u{1D18B}\u{1D1AA}-\u{1D1AD}\u{1D242}-\u{1D244}\u{1DA00}-\u{1DA36}\u{1DA3B}-\u{1DA6C}\u{1DA75}\u{1DA84}\u{1DA9B}-\u{1DA9F}\u{1DAA1}-\u{1DAAF}\u{1E000}-\u{1E006}\u{1E008}-\u{1E018}\u{1E01B}-\u{1E021}\u{1E023}\u{1E024}\u{1E026}-\u{1E02A}\u{1E130}-\u{1E136}\u{1E2EC}-\u{1E2EF}\u{1E8D0}-\u{1E8D6}\u{1E944}-\u{1E94B}\u{E0001}\u{E0020}-\u{E007F}\u{E0100}-\u{E01EF}]*\u200C[\xAD\u0300-\u036F\u0483-\u0489\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u061C\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u070F\u0711\u0730-\u074A\u07A6-\u07B0\u07EB-\u07F3\u07FD\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u08D3-\u08E1\u08E3-\u0902\u093A\u093C\u0941-\u0948\u094D\u0951-\u0957\u0962\u0963\u0981\u09BC\u09C1-\u09C4\u09CD\u09E2\u09E3\u09FE\u0A01\u0A02\u0A3C\u0A41\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A70\u0A71\u0A75\u0A81\u0A82\u0ABC\u0AC1-\u0AC5\u0AC7\u0AC8\u0ACD\u0AE2\u0AE3\u0AFA-\u0AFF\u0B01\u0B3C\u0B3F\u0B41-\u0B44\u0B4D\u0B56\u0B62\u0B63\u0B82\u0BC0\u0BCD\u0C00\u0C04\u0C3E-\u0C40\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C81\u0CBC\u0CBF\u0CC6\u0CCC\u0CCD\u0CE2\u0CE3\u0D00\u0D01\u0D3B\u0D3C\u0D41-\u0D44\u0D4D\u0D62\u0D63\u0DCA\u0DD2-\u0DD4\u0DD6\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0EB1\u0EB4-\u0EBC\u0EC8-\u0ECD\u0F18\u0F19\u0F35\u0F37\u0F39\u0F71-\u0F7E\u0F80-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102D-\u1030\u1032-\u1037\u1039\u103A\u103D\u103E\u1058\u1059\u105E-\u1060\u1071-\u1074\u1082\u1085\u1086\u108D\u109D\u135D-\u135F\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4\u17B5\u17B7-\u17BD\u17C6\u17C9-\u17D3\u17DD\u180B-\u180D\u1885\u1886\u18A9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193B\u1A17\u1A18\u1A1B\u1A56\u1A58-\u1A5E\u1A60\u1A62\u1A65-\u1A6C\u1A73-\u1A7C\u1A7F\u1AB0-\u1ABE\u1B00-\u1B03\u1B34\u1B36-\u1B3A\u1B3C\u1B42\u1B6B-\u1B73\u1B80\u1B81\u1BA2-\u1BA5\u1BA8\u1BA9\u1BAB-\u1BAD\u1BE6\u1BE8\u1BE9\u1BED\u1BEF-\u1BF1\u1C2C-\u1C33\u1C36\u1C37\u1CD0-\u1CD2\u1CD4-\u1CE0\u1CE2-\u1CE8\u1CED\u1CF4\u1CF8\u1CF9\u1DC0-\u1DF9\u1DFB-\u1DFF\u200B\u200E\u200F\u202A-\u202E\u2060-\u2064\u206A-\u206F\u20D0-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302D\u3099\u309A\uA66F-\uA672\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA825\uA826\uA8C4\uA8C5\uA8E0-\uA8F1\uA8FF\uA926-\uA92D\uA947-\uA951\uA980-\uA982\uA9B3\uA9B6-\uA9B9\uA9BC\uA9BD\uA9E5\uAA29-\uAA2E\uAA31\uAA32\uAA35\uAA36\uAA43\uAA4C\uAA7C\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEC\uAAED\uAAF6\uABE5\uABE8\uABED\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F\uFEFF\uFFF9-\uFFFB\u{101FD}\u{102E0}\u{10376}-\u{1037A}\u{10A01}-\u{10A03}\u{10A05}\u{10A06}\u{10A0C}-\u{10A0F}\u{10A38}-\u{10A3A}\u{10A3F}\u{10AE5}\u{10AE6}\u{10D24}-\u{10D27}\u{10F46}-\u{10F50}\u{11001}\u{11038}-\u{11046}\u{1107F}-\u{11081}\u{110B3}-\u{110B6}\u{110B9}\u{110BA}\u{11100}-\u{11102}\u{11127}-\u{1112B}\u{1112D}-\u{11134}\u{11173}\u{11180}\u{11181}\u{111B6}-\u{111BE}\u{111C9}-\u{111CC}\u{1122F}-\u{11231}\u{11234}\u{11236}\u{11237}\u{1123E}\u{112DF}\u{112E3}-\u{112EA}\u{11300}\u{11301}\u{1133B}\u{1133C}\u{11340}\u{11366}-\u{1136C}\u{11370}-\u{11374}\u{11438}-\u{1143F}\u{11442}-\u{11444}\u{11446}\u{1145E}\u{114B3}-\u{114B8}\u{114BA}\u{114BF}\u{114C0}\u{114C2}\u{114C3}\u{115B2}-\u{115B5}\u{115BC}\u{115BD}\u{115BF}\u{115C0}\u{115DC}\u{115DD}\u{11633}-\u{1163A}\u{1163D}\u{1163F}\u{11640}\u{116AB}\u{116AD}\u{116B0}-\u{116B5}\u{116B7}\u{1171D}-\u{1171F}\u{11722}-\u{11725}\u{11727}-\u{1172B}\u{1182F}-\u{11837}\u{11839}\u{1183A}\u{119D4}-\u{119D7}\u{119DA}\u{119DB}\u{119E0}\u{11A01}-\u{11A0A}\u{11A33}-\u{11A38}\u{11A3B}-\u{11A3E}\u{11A47}\u{11A51}-\u{11A56}\u{11A59}-\u{11A5B}\u{11A8A}-\u{11A96}\u{11A98}\u{11A99}\u{11C30}-\u{11C36}\u{11C38}-\u{11C3D}\u{11C3F}\u{11C92}-\u{11CA7}\u{11CAA}-\u{11CB0}\u{11CB2}\u{11CB3}\u{11CB5}\u{11CB6}\u{11D31}-\u{11D36}\u{11D3A}\u{11D3C}\u{11D3D}\u{11D3F}-\u{11D45}\u{11D47}\u{11D90}\u{11D91}\u{11D95}\u{11D97}\u{11EF3}\u{11EF4}\u{13430}-\u{13438}\u{16AF0}-\u{16AF4}\u{16B30}-\u{16B36}\u{16F4F}\u{16F8F}-\u{16F92}\u{1BC9D}\u{1BC9E}\u{1BCA0}-\u{1BCA3}\u{1D167}-\u{1D169}\u{1D173}-\u{1D182}\u{1D185}-\u{1D18B}\u{1D1AA}-\u{1D1AD}\u{1D242}-\u{1D244}\u{1DA00}-\u{1DA36}\u{1DA3B}-\u{1DA6C}\u{1DA75}\u{1DA84}\u{1DA9B}-\u{1DA9F}\u{1DAA1}-\u{1DAAF}\u{1E000}-\u{1E006}\u{1E008}-\u{1E018}\u{1E01B}-\u{1E021}\u{1E023}\u{1E024}\u{1E026}-\u{1E02A}\u{1E130}-\u{1E136}\u{1E2EC}-\u{1E2EF}\u{1E8D0}-\u{1E8D6}\u{1E944}-\u{1E94B}\u{E0001}\u{E0020}-\u{E007F}\u{E0100}-\u{E01EF}]*[\u0620\u0622-\u063F\u0641-\u064A\u066E\u066F\u0671-\u0673\u0675-\u06D3\u06D5\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u077F\u07CA-\u07EA\u0840-\u0855\u0860\u0862-\u0865\u0867-\u086A\u08A0-\u08AC\u08AE-\u08B4\u08B6-\u08BD\u1807\u1820-\u1878\u1887-\u18A8\u18AA\uA840-\uA871\u{10AC0}-\u{10AC5}\u{10AC7}\u{10AC9}\u{10ACA}\u{10ACE}-\u{10AD6}\u{10AD8}-\u{10AE1}\u{10AE4}\u{10AEB}-\u{10AEF}\u{10B80}-\u{10B91}\u{10BA9}-\u{10BAE}\u{10D01}-\u{10D23}\u{10F30}-\u{10F44}\u{10F51}-\u{10F54}\u{1E900}-\u{1E943}]/u,bidiDomain:/[\u05BE\u05C0\u05C3\u05C6\u05D0-\u05EA\u05EF-\u05F4\u0600-\u0605\u0608\u060B\u060D\u061B-\u064A\u0660-\u0669\u066B-\u066F\u0671-\u06D5\u06DD\u06E5\u06E6\u06EE\u06EF\u06FA-\u070D\u070F\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07C0-\u07EA\u07F4\u07F5\u07FA\u07FE-\u0815\u081A\u0824\u0828\u0830-\u083E\u0840-\u0858\u085E\u0860-\u086A\u0870-\u088E\u0890\u0891\u08A0-\u08C9\u08E2\u200F\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBC2\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFC\uFE70-\uFE74\uFE76-\uFEFC\u{10800}-\u{10805}\u{10808}\u{1080A}-\u{10835}\u{10837}\u{10838}\u{1083C}\u{1083F}-\u{10855}\u{10857}-\u{1089E}\u{108A7}-\u{108AF}\u{108E0}-\u{108F2}\u{108F4}\u{108F5}\u{108FB}-\u{1091B}\u{10920}-\u{10939}\u{1093F}\u{10980}-\u{109B7}\u{109BC}-\u{109CF}\u{109D2}-\u{10A00}\u{10A10}-\u{10A13}\u{10A15}-\u{10A17}\u{10A19}-\u{10A35}\u{10A40}-\u{10A48}\u{10A50}-\u{10A58}\u{10A60}-\u{10A9F}\u{10AC0}-\u{10AE4}\u{10AEB}-\u{10AF6}\u{10B00}-\u{10B35}\u{10B40}-\u{10B55}\u{10B58}-\u{10B72}\u{10B78}-\u{10B91}\u{10B99}-\u{10B9C}\u{10BA9}-\u{10BAF}\u{10C00}-\u{10C48}\u{10C80}-\u{10CB2}\u{10CC0}-\u{10CF2}\u{10CFA}-\u{10D23}\u{10D30}-\u{10D39}\u{10E60}-\u{10E7E}\u{10E80}-\u{10EA9}\u{10EAD}\u{10EB0}\u{10EB1}\u{10F00}-\u{10F27}\u{10F30}-\u{10F45}\u{10F51}-\u{10F59}\u{10F70}-\u{10F81}\u{10F86}-\u{10F89}\u{10FB0}-\u{10FCB}\u{10FE0}-\u{10FF6}\u{1E800}-\u{1E8C4}\u{1E8C7}-\u{1E8CF}\u{1E900}-\u{1E943}\u{1E94B}\u{1E950}-\u{1E959}\u{1E95E}\u{1E95F}\u{1EC71}-\u{1ECB4}\u{1ED01}-\u{1ED3D}\u{1EE00}-\u{1EE03}\u{1EE05}-\u{1EE1F}\u{1EE21}\u{1EE22}\u{1EE24}\u{1EE27}\u{1EE29}-\u{1EE32}\u{1EE34}-\u{1EE37}\u{1EE39}\u{1EE3B}\u{1EE42}\u{1EE47}\u{1EE49}\u{1EE4B}\u{1EE4D}-\u{1EE4F}\u{1EE51}\u{1EE52}\u{1EE54}\u{1EE57}\u{1EE59}\u{1EE5B}\u{1EE5D}\u{1EE5F}\u{1EE61}\u{1EE62}\u{1EE64}\u{1EE67}-\u{1EE6A}\u{1EE6C}-\u{1EE72}\u{1EE74}-\u{1EE77}\u{1EE79}-\u{1EE7C}\u{1EE7E}\u{1EE80}-\u{1EE89}\u{1EE8B}-\u{1EE9B}\u{1EEA1}-\u{1EEA3}\u{1EEA5}-\u{1EEA9}\u{1EEAB}-\u{1EEBB}]/u,bidiS1LTR:/[A-Za-z\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02B8\u02BB-\u02C1\u02D0\u02D1\u02E0-\u02E4\u02EE\u0370-\u0373\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0482\u048A-\u052F\u0531-\u0556\u0559-\u0589\u0903-\u0939\u093B\u093D-\u0940\u0949-\u094C\u094E-\u0950\u0958-\u0961\u0964-\u0980\u0982\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD-\u09C0\u09C7\u09C8\u09CB\u09CC\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E1\u09E6-\u09F1\u09F4-\u09FA\u09FC\u09FD\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3E-\u0A40\u0A59-\u0A5C\u0A5E\u0A66-\u0A6F\u0A72-\u0A74\u0A76\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD-\u0AC0\u0AC9\u0ACB\u0ACC\u0AD0\u0AE0\u0AE1\u0AE6-\u0AF0\u0AF9\u0B02\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B3E\u0B40\u0B47\u0B48\u0B4B\u0B4C\u0B57\u0B5C\u0B5D\u0B5F-\u0B61\u0B66-\u0B77\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE\u0BBF\u0BC1\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCC\u0BD0\u0BD7\u0BE6-\u0BF2\u0C01-\u0C03\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C41-\u0C44\u0C58-\u0C5A\u0C5D\u0C60\u0C61\u0C66-\u0C6F\u0C77\u0C7F\u0C80\u0C82-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD-\u0CC4\u0CC6-\u0CC8\u0CCA\u0CCB\u0CD5\u0CD6\u0CDD\u0CDE\u0CE0\u0CE1\u0CE6-\u0CEF\u0CF1\u0CF2\u0D02-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D-\u0D40\u0D46-\u0D48\u0D4A-\u0D4C\u0D4E\u0D4F\u0D54-\u0D61\u0D66-\u0D7F\u0D82\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCF-\u0DD1\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2-\u0DF4\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E4F-\u0E5B\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00-\u0F17\u0F1A-\u0F34\u0F36\u0F38\u0F3E-\u0F47\u0F49-\u0F6C\u0F7F\u0F85\u0F88-\u0F8C\u0FBE-\u0FC5\u0FC7-\u0FCC\u0FCE-\u0FDA\u1000-\u102C\u1031\u1038\u103B\u103C\u103F-\u1057\u105A-\u105D\u1061-\u1070\u1075-\u1081\u1083\u1084\u1087-\u108C\u108E-\u109C\u109E-\u10C5\u10C7\u10CD\u10D0-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1360-\u137C\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u167F\u1681-\u169A\u16A0-\u16F8\u1700-\u1711\u1715\u171F-\u1731\u1734-\u1736\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17B6\u17BE-\u17C5\u17C7\u17C8\u17D4-\u17DA\u17DC\u17E0-\u17E9\u1810-\u1819\u1820-\u1878\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1923-\u1926\u1929-\u192B\u1930\u1931\u1933-\u1938\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19DA\u1A00-\u1A16\u1A19\u1A1A\u1A1E-\u1A55\u1A57\u1A61\u1A63\u1A64\u1A6D-\u1A72\u1A80-\u1A89\u1A90-\u1A99\u1AA0-\u1AAD\u1B04-\u1B33\u1B35\u1B3B\u1B3D-\u1B41\u1B43-\u1B4C\u1B50-\u1B6A\u1B74-\u1B7E\u1B82-\u1BA1\u1BA6\u1BA7\u1BAA\u1BAE-\u1BE5\u1BE7\u1BEA-\u1BEC\u1BEE\u1BF2\u1BF3\u1BFC-\u1C2B\u1C34\u1C35\u1C3B-\u1C49\u1C4D-\u1C88\u1C90-\u1CBA\u1CBD-\u1CC7\u1CD3\u1CE1\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5-\u1CF7\u1CFA\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u200E\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u214F\u2160-\u2188\u2336-\u237A\u2395\u249C-\u24E9\u26AC\u2800-\u28FF\u2C00-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D70\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u3005-\u3007\u3021-\u3029\u302E\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u3190-\u31BF\u31F0-\u321C\u3220-\u324F\u3260-\u327B\u327F-\u32B0\u32C0-\u32CB\u32D0-\u3376\u337B-\u33DD\u33E0-\u33FE\u3400-\u4DBF\u4E00-\uA48C\uA4D0-\uA60C\uA610-\uA62B\uA640-\uA66E\uA680-\uA69D\uA6A0-\uA6EF\uA6F2-\uA6F7\uA722-\uA787\uA789-\uA7CA\uA7D0\uA7D1\uA7D3\uA7D5-\uA7D9\uA7F2-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA824\uA827\uA830-\uA837\uA840-\uA873\uA880-\uA8C3\uA8CE-\uA8D9\uA8F2-\uA8FE\uA900-\uA925\uA92E-\uA946\uA952\uA953\uA95F-\uA97C\uA983-\uA9B2\uA9B4\uA9B5\uA9BA\uA9BB\uA9BE-\uA9CD\uA9CF-\uA9D9\uA9DE-\uA9E4\uA9E6-\uA9FE\uAA00-\uAA28\uAA2F\uAA30\uAA33\uAA34\uAA40-\uAA42\uAA44-\uAA4B\uAA4D\uAA50-\uAA59\uAA5C-\uAA7B\uAA7D-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAAEB\uAAEE-\uAAF5\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB69\uAB70-\uABE4\uABE6\uABE7\uABE9-\uABEC\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uD800-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC\u{10000}-\u{1000B}\u{1000D}-\u{10026}\u{10028}-\u{1003A}\u{1003C}\u{1003D}\u{1003F}-\u{1004D}\u{10050}-\u{1005D}\u{10080}-\u{100FA}\u{10100}\u{10102}\u{10107}-\u{10133}\u{10137}-\u{1013F}\u{1018D}\u{1018E}\u{101D0}-\u{101FC}\u{10280}-\u{1029C}\u{102A0}-\u{102D0}\u{10300}-\u{10323}\u{1032D}-\u{1034A}\u{10350}-\u{10375}\u{10380}-\u{1039D}\u{1039F}-\u{103C3}\u{103C8}-\u{103D5}\u{10400}-\u{1049D}\u{104A0}-\u{104A9}\u{104B0}-\u{104D3}\u{104D8}-\u{104FB}\u{10500}-\u{10527}\u{10530}-\u{10563}\u{1056F}-\u{1057A}\u{1057C}-\u{1058A}\u{1058C}-\u{10592}\u{10594}\u{10595}\u{10597}-\u{105A1}\u{105A3}-\u{105B1}\u{105B3}-\u{105B9}\u{105BB}\u{105BC}\u{10600}-\u{10736}\u{10740}-\u{10755}\u{10760}-\u{10767}\u{10780}-\u{10785}\u{10787}-\u{107B0}\u{107B2}-\u{107BA}\u{11000}\u{11002}-\u{11037}\u{11047}-\u{1104D}\u{11066}-\u{1106F}\u{11071}\u{11072}\u{11075}\u{11082}-\u{110B2}\u{110B7}\u{110B8}\u{110BB}-\u{110C1}\u{110CD}\u{110D0}-\u{110E8}\u{110F0}-\u{110F9}\u{11103}-\u{11126}\u{1112C}\u{11136}-\u{11147}\u{11150}-\u{11172}\u{11174}-\u{11176}\u{11182}-\u{111B5}\u{111BF}-\u{111C8}\u{111CD}\u{111CE}\u{111D0}-\u{111DF}\u{111E1}-\u{111F4}\u{11200}-\u{11211}\u{11213}-\u{1122E}\u{11232}\u{11233}\u{11235}\u{11238}-\u{1123D}\u{11280}-\u{11286}\u{11288}\u{1128A}-\u{1128D}\u{1128F}-\u{1129D}\u{1129F}-\u{112A9}\u{112B0}-\u{112DE}\u{112E0}-\u{112E2}\u{112F0}-\u{112F9}\u{11302}\u{11303}\u{11305}-\u{1130C}\u{1130F}\u{11310}\u{11313}-\u{11328}\u{1132A}-\u{11330}\u{11332}\u{11333}\u{11335}-\u{11339}\u{1133D}-\u{1133F}\u{11341}-\u{11344}\u{11347}\u{11348}\u{1134B}-\u{1134D}\u{11350}\u{11357}\u{1135D}-\u{11363}\u{11400}-\u{11437}\u{11440}\u{11441}\u{11445}\u{11447}-\u{1145B}\u{1145D}\u{1145F}-\u{11461}\u{11480}-\u{114B2}\u{114B9}\u{114BB}-\u{114BE}\u{114C1}\u{114C4}-\u{114C7}\u{114D0}-\u{114D9}\u{11580}-\u{115B1}\u{115B8}-\u{115BB}\u{115BE}\u{115C1}-\u{115DB}\u{11600}-\u{11632}\u{1163B}\u{1163C}\u{1163E}\u{11641}-\u{11644}\u{11650}-\u{11659}\u{11680}-\u{116AA}\u{116AC}\u{116AE}\u{116AF}\u{116B6}\u{116B8}\u{116B9}\u{116C0}-\u{116C9}\u{11700}-\u{1171A}\u{11720}\u{11721}\u{11726}\u{11730}-\u{11746}\u{11800}-\u{1182E}\u{11838}\u{1183B}\u{118A0}-\u{118F2}\u{118FF}-\u{11906}\u{11909}\u{1190C}-\u{11913}\u{11915}\u{11916}\u{11918}-\u{11935}\u{11937}\u{11938}\u{1193D}\u{1193F}-\u{11942}\u{11944}-\u{11946}\u{11950}-\u{11959}\u{119A0}-\u{119A7}\u{119AA}-\u{119D3}\u{119DC}-\u{119DF}\u{119E1}-\u{119E4}\u{11A00}\u{11A07}\u{11A08}\u{11A0B}-\u{11A32}\u{11A39}\u{11A3A}\u{11A3F}-\u{11A46}\u{11A50}\u{11A57}\u{11A58}\u{11A5C}-\u{11A89}\u{11A97}\u{11A9A}-\u{11AA2}\u{11AB0}-\u{11AF8}\u{11C00}-\u{11C08}\u{11C0A}-\u{11C2F}\u{11C3E}-\u{11C45}\u{11C50}-\u{11C6C}\u{11C70}-\u{11C8F}\u{11CA9}\u{11CB1}\u{11CB4}\u{11D00}-\u{11D06}\u{11D08}\u{11D09}\u{11D0B}-\u{11D30}\u{11D46}\u{11D50}-\u{11D59}\u{11D60}-\u{11D65}\u{11D67}\u{11D68}\u{11D6A}-\u{11D8E}\u{11D93}\u{11D94}\u{11D96}\u{11D98}\u{11DA0}-\u{11DA9}\u{11EE0}-\u{11EF2}\u{11EF5}-\u{11EF8}\u{11FB0}\u{11FC0}-\u{11FD4}\u{11FFF}-\u{12399}\u{12400}-\u{1246E}\u{12470}-\u{12474}\u{12480}-\u{12543}\u{12F90}-\u{12FF2}\u{13000}-\u{1342E}\u{13430}-\u{13438}\u{14400}-\u{14646}\u{16800}-\u{16A38}\u{16A40}-\u{16A5E}\u{16A60}-\u{16A69}\u{16A6E}-\u{16ABE}\u{16AC0}-\u{16AC9}\u{16AD0}-\u{16AED}\u{16AF5}\u{16B00}-\u{16B2F}\u{16B37}-\u{16B45}\u{16B50}-\u{16B59}\u{16B5B}-\u{16B61}\u{16B63}-\u{16B77}\u{16B7D}-\u{16B8F}\u{16E40}-\u{16E9A}\u{16F00}-\u{16F4A}\u{16F50}-\u{16F87}\u{16F93}-\u{16F9F}\u{16FE0}\u{16FE1}\u{16FE3}\u{16FF0}\u{16FF1}\u{17000}-\u{187F7}\u{18800}-\u{18CD5}\u{18D00}-\u{18D08}\u{1AFF0}-\u{1AFF3}\u{1AFF5}-\u{1AFFB}\u{1AFFD}\u{1AFFE}\u{1B000}-\u{1B122}\u{1B150}-\u{1B152}\u{1B164}-\u{1B167}\u{1B170}-\u{1B2FB}\u{1BC00}-\u{1BC6A}\u{1BC70}-\u{1BC7C}\u{1BC80}-\u{1BC88}\u{1BC90}-\u{1BC99}\u{1BC9C}\u{1BC9F}\u{1CF50}-\u{1CFC3}\u{1D000}-\u{1D0F5}\u{1D100}-\u{1D126}\u{1D129}-\u{1D166}\u{1D16A}-\u{1D172}\u{1D183}\u{1D184}\u{1D18C}-\u{1D1A9}\u{1D1AE}-\u{1D1E8}\u{1D2E0}-\u{1D2F3}\u{1D360}-\u{1D378}\u{1D400}-\u{1D454}\u{1D456}-\u{1D49C}\u{1D49E}\u{1D49F}\u{1D4A2}\u{1D4A5}\u{1D4A6}\u{1D4A9}-\u{1D4AC}\u{1D4AE}-\u{1D4B9}\u{1D4BB}\u{1D4BD}-\u{1D4C3}\u{1D4C5}-\u{1D505}\u{1D507}-\u{1D50A}\u{1D50D}-\u{1D514}\u{1D516}-\u{1D51C}\u{1D51E}-\u{1D539}\u{1D53B}-\u{1D53E}\u{1D540}-\u{1D544}\u{1D546}\u{1D54A}-\u{1D550}\u{1D552}-\u{1D6A5}\u{1D6A8}-\u{1D6DA}\u{1D6DC}-\u{1D714}\u{1D716}-\u{1D74E}\u{1D750}-\u{1D788}\u{1D78A}-\u{1D7C2}\u{1D7C4}-\u{1D7CB}\u{1D800}-\u{1D9FF}\u{1DA37}-\u{1DA3A}\u{1DA6D}-\u{1DA74}\u{1DA76}-\u{1DA83}\u{1DA85}-\u{1DA8B}\u{1DF00}-\u{1DF1E}\u{1E100}-\u{1E12C}\u{1E137}-\u{1E13D}\u{1E140}-\u{1E149}\u{1E14E}\u{1E14F}\u{1E290}-\u{1E2AD}\u{1E2C0}-\u{1E2EB}\u{1E2F0}-\u{1E2F9}\u{1E7E0}-\u{1E7E6}\u{1E7E8}-\u{1E7EB}\u{1E7ED}\u{1E7EE}\u{1E7F0}-\u{1E7FE}\u{1F110}-\u{1F12E}\u{1F130}-\u{1F169}\u{1F170}-\u{1F1AC}\u{1F1E6}-\u{1F202}\u{1F210}-\u{1F23B}\u{1F240}-\u{1F248}\u{1F250}\u{1F251}\u{20000}-\u{2A6DF}\u{2A700}-\u{2B738}\u{2B740}-\u{2B81D}\u{2B820}-\u{2CEA1}\u{2CEB0}-\u{2EBE0}\u{2F800}-\u{2FA1D}\u{30000}-\u{3134A}\u{F0000}-\u{FFFFD}\u{100000}-\u{10FFFD}]/u,bidiS1RTL:/[\u05BE\u05C0\u05C3\u05C6\u05D0-\u05EA\u05EF-\u05F4\u0608\u060B\u060D\u061B-\u064A\u066D-\u066F\u0671-\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u070D\u070F\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07C0-\u07EA\u07F4\u07F5\u07FA\u07FE-\u0815\u081A\u0824\u0828\u0830-\u083E\u0840-\u0858\u085E\u0860-\u086A\u0870-\u088E\u08A0-\u08C9\u200F\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBC2\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFC\uFE70-\uFE74\uFE76-\uFEFC\u{10800}-\u{10805}\u{10808}\u{1080A}-\u{10835}\u{10837}\u{10838}\u{1083C}\u{1083F}-\u{10855}\u{10857}-\u{1089E}\u{108A7}-\u{108AF}\u{108E0}-\u{108F2}\u{108F4}\u{108F5}\u{108FB}-\u{1091B}\u{10920}-\u{10939}\u{1093F}\u{10980}-\u{109B7}\u{109BC}-\u{109CF}\u{109D2}-\u{10A00}\u{10A10}-\u{10A13}\u{10A15}-\u{10A17}\u{10A19}-\u{10A35}\u{10A40}-\u{10A48}\u{10A50}-\u{10A58}\u{10A60}-\u{10A9F}\u{10AC0}-\u{10AE4}\u{10AEB}-\u{10AF6}\u{10B00}-\u{10B35}\u{10B40}-\u{10B55}\u{10B58}-\u{10B72}\u{10B78}-\u{10B91}\u{10B99}-\u{10B9C}\u{10BA9}-\u{10BAF}\u{10C00}-\u{10C48}\u{10C80}-\u{10CB2}\u{10CC0}-\u{10CF2}\u{10CFA}-\u{10D23}\u{10E80}-\u{10EA9}\u{10EAD}\u{10EB0}\u{10EB1}\u{10F00}-\u{10F27}\u{10F30}-\u{10F45}\u{10F51}-\u{10F59}\u{10F70}-\u{10F81}\u{10F86}-\u{10F89}\u{10FB0}-\u{10FCB}\u{10FE0}-\u{10FF6}\u{1E800}-\u{1E8C4}\u{1E8C7}-\u{1E8CF}\u{1E900}-\u{1E943}\u{1E94B}\u{1E950}-\u{1E959}\u{1E95E}\u{1E95F}\u{1EC71}-\u{1ECB4}\u{1ED01}-\u{1ED3D}\u{1EE00}-\u{1EE03}\u{1EE05}-\u{1EE1F}\u{1EE21}\u{1EE22}\u{1EE24}\u{1EE27}\u{1EE29}-\u{1EE32}\u{1EE34}-\u{1EE37}\u{1EE39}\u{1EE3B}\u{1EE42}\u{1EE47}\u{1EE49}\u{1EE4B}\u{1EE4D}-\u{1EE4F}\u{1EE51}\u{1EE52}\u{1EE54}\u{1EE57}\u{1EE59}\u{1EE5B}\u{1EE5D}\u{1EE5F}\u{1EE61}\u{1EE62}\u{1EE64}\u{1EE67}-\u{1EE6A}\u{1EE6C}-\u{1EE72}\u{1EE74}-\u{1EE77}\u{1EE79}-\u{1EE7C}\u{1EE7E}\u{1EE80}-\u{1EE89}\u{1EE8B}-\u{1EE9B}\u{1EEA1}-\u{1EEA3}\u{1EEA5}-\u{1EEA9}\u{1EEAB}-\u{1EEBB}]/u,bidiS2:/^[\0-\x08\x0E-\x1B!-@\[-`\{-\x84\x86-\xA9\xAB-\xB4\xB6-\xB9\xBB-\xBF\xD7\xF7\u02B9\u02BA\u02C2-\u02CF\u02D2-\u02DF\u02E5-\u02ED\u02EF-\u036F\u0374\u0375\u037E\u0384\u0385\u0387\u03F6\u0483-\u0489\u058A\u058D-\u058F\u0591-\u05C7\u05D0-\u05EA\u05EF-\u05F4\u0600-\u070D\u070F-\u074A\u074D-\u07B1\u07C0-\u07FA\u07FD-\u082D\u0830-\u083E\u0840-\u085B\u085E\u0860-\u086A\u0870-\u088E\u0890\u0891\u0898-\u0902\u093A\u093C\u0941-\u0948\u094D\u0951-\u0957\u0962\u0963\u0981\u09BC\u09C1-\u09C4\u09CD\u09E2\u09E3\u09F2\u09F3\u09FB\u09FE\u0A01\u0A02\u0A3C\u0A41\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A70\u0A71\u0A75\u0A81\u0A82\u0ABC\u0AC1-\u0AC5\u0AC7\u0AC8\u0ACD\u0AE2\u0AE3\u0AF1\u0AFA-\u0AFF\u0B01\u0B3C\u0B3F\u0B41-\u0B44\u0B4D\u0B55\u0B56\u0B62\u0B63\u0B82\u0BC0\u0BCD\u0BF3-\u0BFA\u0C00\u0C04\u0C3C\u0C3E-\u0C40\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C78-\u0C7E\u0C81\u0CBC\u0CCC\u0CCD\u0CE2\u0CE3\u0D00\u0D01\u0D3B\u0D3C\u0D41-\u0D44\u0D4D\u0D62\u0D63\u0D81\u0DCA\u0DD2-\u0DD4\u0DD6\u0E31\u0E34-\u0E3A\u0E3F\u0E47-\u0E4E\u0EB1\u0EB4-\u0EBC\u0EC8-\u0ECD\u0F18\u0F19\u0F35\u0F37\u0F39-\u0F3D\u0F71-\u0F7E\u0F80-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102D-\u1030\u1032-\u1037\u1039\u103A\u103D\u103E\u1058\u1059\u105E-\u1060\u1071-\u1074\u1082\u1085\u1086\u108D\u109D\u135D-\u135F\u1390-\u1399\u1400\u169B\u169C\u1712-\u1714\u1732\u1733\u1752\u1753\u1772\u1773\u17B4\u17B5\u17B7-\u17BD\u17C6\u17C9-\u17D3\u17DB\u17DD\u17F0-\u17F9\u1800-\u180F\u1885\u1886\u18A9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193B\u1940\u1944\u1945\u19DE-\u19FF\u1A17\u1A18\u1A1B\u1A56\u1A58-\u1A5E\u1A60\u1A62\u1A65-\u1A6C\u1A73-\u1A7C\u1A7F\u1AB0-\u1ACE\u1B00-\u1B03\u1B34\u1B36-\u1B3A\u1B3C\u1B42\u1B6B-\u1B73\u1B80\u1B81\u1BA2-\u1BA5\u1BA8\u1BA9\u1BAB-\u1BAD\u1BE6\u1BE8\u1BE9\u1BED\u1BEF-\u1BF1\u1C2C-\u1C33\u1C36\u1C37\u1CD0-\u1CD2\u1CD4-\u1CE0\u1CE2-\u1CE8\u1CED\u1CF4\u1CF8\u1CF9\u1DC0-\u1DFF\u1FBD\u1FBF-\u1FC1\u1FCD-\u1FCF\u1FDD-\u1FDF\u1FED-\u1FEF\u1FFD\u1FFE\u200B-\u200D\u200F-\u2027\u202F-\u205E\u2060-\u2064\u206A-\u2070\u2074-\u207E\u2080-\u208E\u20A0-\u20C0\u20D0-\u20F0\u2100\u2101\u2103-\u2106\u2108\u2109\u2114\u2116-\u2118\u211E-\u2123\u2125\u2127\u2129\u212E\u213A\u213B\u2140-\u2144\u214A-\u214D\u2150-\u215F\u2189-\u218B\u2190-\u2335\u237B-\u2394\u2396-\u2426\u2440-\u244A\u2460-\u249B\u24EA-\u26AB\u26AD-\u27FF\u2900-\u2B73\u2B76-\u2B95\u2B97-\u2BFF\u2CE5-\u2CEA\u2CEF-\u2CF1\u2CF9-\u2CFF\u2D7F\u2DE0-\u2E5D\u2E80-\u2E99\u2E9B-\u2EF3\u2F00-\u2FD5\u2FF0-\u2FFB\u3001-\u3004\u3008-\u3020\u302A-\u302D\u3030\u3036\u3037\u303D-\u303F\u3099-\u309C\u30A0\u30FB\u31C0-\u31E3\u321D\u321E\u3250-\u325F\u327C-\u327E\u32B1-\u32BF\u32CC-\u32CF\u3377-\u337A\u33DE\u33DF\u33FF\u4DC0-\u4DFF\uA490-\uA4C6\uA60D-\uA60F\uA66F-\uA67F\uA69E\uA69F\uA6F0\uA6F1\uA700-\uA721\uA788\uA802\uA806\uA80B\uA825\uA826\uA828-\uA82C\uA838\uA839\uA874-\uA877\uA8C4\uA8C5\uA8E0-\uA8F1\uA8FF\uA926-\uA92D\uA947-\uA951\uA980-\uA982\uA9B3\uA9B6-\uA9B9\uA9BC\uA9BD\uA9E5\uAA29-\uAA2E\uAA31\uAA32\uAA35\uAA36\uAA43\uAA4C\uAA7C\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEC\uAAED\uAAF6\uAB6A\uAB6B\uABE5\uABE8\uABED\uFB1D-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBC2\uFBD3-\uFD8F\uFD92-\uFDC7\uFDCF\uFDF0-\uFE19\uFE20-\uFE52\uFE54-\uFE66\uFE68-\uFE6B\uFE70-\uFE74\uFE76-\uFEFC\uFEFF\uFF01-\uFF20\uFF3B-\uFF40\uFF5B-\uFF65\uFFE0-\uFFE6\uFFE8-\uFFEE\uFFF9-\uFFFD\u{10101}\u{10140}-\u{1018C}\u{10190}-\u{1019C}\u{101A0}\u{101FD}\u{102E0}-\u{102FB}\u{10376}-\u{1037A}\u{10800}-\u{10805}\u{10808}\u{1080A}-\u{10835}\u{10837}\u{10838}\u{1083C}\u{1083F}-\u{10855}\u{10857}-\u{1089E}\u{108A7}-\u{108AF}\u{108E0}-\u{108F2}\u{108F4}\u{108F5}\u{108FB}-\u{1091B}\u{1091F}-\u{10939}\u{1093F}\u{10980}-\u{109B7}\u{109BC}-\u{109CF}\u{109D2}-\u{10A03}\u{10A05}\u{10A06}\u{10A0C}-\u{10A13}\u{10A15}-\u{10A17}\u{10A19}-\u{10A35}\u{10A38}-\u{10A3A}\u{10A3F}-\u{10A48}\u{10A50}-\u{10A58}\u{10A60}-\u{10A9F}\u{10AC0}-\u{10AE6}\u{10AEB}-\u{10AF6}\u{10B00}-\u{10B35}\u{10B39}-\u{10B55}\u{10B58}-\u{10B72}\u{10B78}-\u{10B91}\u{10B99}-\u{10B9C}\u{10BA9}-\u{10BAF}\u{10C00}-\u{10C48}\u{10C80}-\u{10CB2}\u{10CC0}-\u{10CF2}\u{10CFA}-\u{10D27}\u{10D30}-\u{10D39}\u{10E60}-\u{10E7E}\u{10E80}-\u{10EA9}\u{10EAB}-\u{10EAD}\u{10EB0}\u{10EB1}\u{10F00}-\u{10F27}\u{10F30}-\u{10F59}\u{10F70}-\u{10F89}\u{10FB0}-\u{10FCB}\u{10FE0}-\u{10FF6}\u{11001}\u{11038}-\u{11046}\u{11052}-\u{11065}\u{11070}\u{11073}\u{11074}\u{1107F}-\u{11081}\u{110B3}-\u{110B6}\u{110B9}\u{110BA}\u{110C2}\u{11100}-\u{11102}\u{11127}-\u{1112B}\u{1112D}-\u{11134}\u{11173}\u{11180}\u{11181}\u{111B6}-\u{111BE}\u{111C9}-\u{111CC}\u{111CF}\u{1122F}-\u{11231}\u{11234}\u{11236}\u{11237}\u{1123E}\u{112DF}\u{112E3}-\u{112EA}\u{11300}\u{11301}\u{1133B}\u{1133C}\u{11340}\u{11366}-\u{1136C}\u{11370}-\u{11374}\u{11438}-\u{1143F}\u{11442}-\u{11444}\u{11446}\u{1145E}\u{114B3}-\u{114B8}\u{114BA}\u{114BF}\u{114C0}\u{114C2}\u{114C3}\u{115B2}-\u{115B5}\u{115BC}\u{115BD}\u{115BF}\u{115C0}\u{115DC}\u{115DD}\u{11633}-\u{1163A}\u{1163D}\u{1163F}\u{11640}\u{11660}-\u{1166C}\u{116AB}\u{116AD}\u{116B0}-\u{116B5}\u{116B7}\u{1171D}-\u{1171F}\u{11722}-\u{11725}\u{11727}-\u{1172B}\u{1182F}-\u{11837}\u{11839}\u{1183A}\u{1193B}\u{1193C}\u{1193E}\u{11943}\u{119D4}-\u{119D7}\u{119DA}\u{119DB}\u{119E0}\u{11A01}-\u{11A06}\u{11A09}\u{11A0A}\u{11A33}-\u{11A38}\u{11A3B}-\u{11A3E}\u{11A47}\u{11A51}-\u{11A56}\u{11A59}-\u{11A5B}\u{11A8A}-\u{11A96}\u{11A98}\u{11A99}\u{11C30}-\u{11C36}\u{11C38}-\u{11C3D}\u{11C92}-\u{11CA7}\u{11CAA}-\u{11CB0}\u{11CB2}\u{11CB3}\u{11CB5}\u{11CB6}\u{11D31}-\u{11D36}\u{11D3A}\u{11D3C}\u{11D3D}\u{11D3F}-\u{11D45}\u{11D47}\u{11D90}\u{11D91}\u{11D95}\u{11D97}\u{11EF3}\u{11EF4}\u{11FD5}-\u{11FF1}\u{16AF0}-\u{16AF4}\u{16B30}-\u{16B36}\u{16F4F}\u{16F8F}-\u{16F92}\u{16FE2}\u{16FE4}\u{1BC9D}\u{1BC9E}\u{1BCA0}-\u{1BCA3}\u{1CF00}-\u{1CF2D}\u{1CF30}-\u{1CF46}\u{1D167}-\u{1D169}\u{1D173}-\u{1D182}\u{1D185}-\u{1D18B}\u{1D1AA}-\u{1D1AD}\u{1D1E9}\u{1D1EA}\u{1D200}-\u{1D245}\u{1D300}-\u{1D356}\u{1D6DB}\u{1D715}\u{1D74F}\u{1D789}\u{1D7C3}\u{1D7CE}-\u{1D7FF}\u{1DA00}-\u{1DA36}\u{1DA3B}-\u{1DA6C}\u{1DA75}\u{1DA84}\u{1DA9B}-\u{1DA9F}\u{1DAA1}-\u{1DAAF}\u{1E000}-\u{1E006}\u{1E008}-\u{1E018}\u{1E01B}-\u{1E021}\u{1E023}\u{1E024}\u{1E026}-\u{1E02A}\u{1E130}-\u{1E136}\u{1E2AE}\u{1E2EC}-\u{1E2EF}\u{1E2FF}\u{1E800}-\u{1E8C4}\u{1E8C7}-\u{1E8D6}\u{1E900}-\u{1E94B}\u{1E950}-\u{1E959}\u{1E95E}\u{1E95F}\u{1EC71}-\u{1ECB4}\u{1ED01}-\u{1ED3D}\u{1EE00}-\u{1EE03}\u{1EE05}-\u{1EE1F}\u{1EE21}\u{1EE22}\u{1EE24}\u{1EE27}\u{1EE29}-\u{1EE32}\u{1EE34}-\u{1EE37}\u{1EE39}\u{1EE3B}\u{1EE42}\u{1EE47}\u{1EE49}\u{1EE4B}\u{1EE4D}-\u{1EE4F}\u{1EE51}\u{1EE52}\u{1EE54}\u{1EE57}\u{1EE59}\u{1EE5B}\u{1EE5D}\u{1EE5F}\u{1EE61}\u{1EE62}\u{1EE64}\u{1EE67}-\u{1EE6A}\u{1EE6C}-\u{1EE72}\u{1EE74}-\u{1EE77}\u{1EE79}-\u{1EE7C}\u{1EE7E}\u{1EE80}-\u{1EE89}\u{1EE8B}-\u{1EE9B}\u{1EEA1}-\u{1EEA3}\u{1EEA5}-\u{1EEA9}\u{1EEAB}-\u{1EEBB}\u{1EEF0}\u{1EEF1}\u{1F000}-\u{1F02B}\u{1F030}-\u{1F093}\u{1F0A0}-\u{1F0AE}\u{1F0B1}-\u{1F0BF}\u{1F0C1}-\u{1F0CF}\u{1F0D1}-\u{1F0F5}\u{1F100}-\u{1F10F}\u{1F12F}\u{1F16A}-\u{1F16F}\u{1F1AD}\u{1F260}-\u{1F265}\u{1F300}-\u{1F6D7}\u{1F6DD}-\u{1F6EC}\u{1F6F0}-\u{1F6FC}\u{1F700}-\u{1F773}\u{1F780}-\u{1F7D8}\u{1F7E0}-\u{1F7EB}\u{1F7F0}\u{1F800}-\u{1F80B}\u{1F810}-\u{1F847}\u{1F850}-\u{1F859}\u{1F860}-\u{1F887}\u{1F890}-\u{1F8AD}\u{1F8B0}\u{1F8B1}\u{1F900}-\u{1FA53}\u{1FA60}-\u{1FA6D}\u{1FA70}-\u{1FA74}\u{1FA78}-\u{1FA7C}\u{1FA80}-\u{1FA86}\u{1FA90}-\u{1FAAC}\u{1FAB0}-\u{1FABA}\u{1FAC0}-\u{1FAC5}\u{1FAD0}-\u{1FAD9}\u{1FAE0}-\u{1FAE7}\u{1FAF0}-\u{1FAF6}\u{1FB00}-\u{1FB92}\u{1FB94}-\u{1FBCA}\u{1FBF0}-\u{1FBF9}\u{E0001}\u{E0020}-\u{E007F}\u{E0100}-\u{E01EF}]*$/u,bidiS3:/[0-9\xB2\xB3\xB9\u05BE\u05C0\u05C3\u05C6\u05D0-\u05EA\u05EF-\u05F4\u0600-\u0605\u0608\u060B\u060D\u061B-\u064A\u0660-\u0669\u066B-\u066F\u0671-\u06D5\u06DD\u06E5\u06E6\u06EE-\u070D\u070F\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07C0-\u07EA\u07F4\u07F5\u07FA\u07FE-\u0815\u081A\u0824\u0828\u0830-\u083E\u0840-\u0858\u085E\u0860-\u086A\u0870-\u088E\u0890\u0891\u08A0-\u08C9\u08E2\u200F\u2070\u2074-\u2079\u2080-\u2089\u2488-\u249B\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBC2\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFC\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\u{102E1}-\u{102FB}\u{10800}-\u{10805}\u{10808}\u{1080A}-\u{10835}\u{10837}\u{10838}\u{1083C}\u{1083F}-\u{10855}\u{10857}-\u{1089E}\u{108A7}-\u{108AF}\u{108E0}-\u{108F2}\u{108F4}\u{108F5}\u{108FB}-\u{1091B}\u{10920}-\u{10939}\u{1093F}\u{10980}-\u{109B7}\u{109BC}-\u{109CF}\u{109D2}-\u{10A00}\u{10A10}-\u{10A13}\u{10A15}-\u{10A17}\u{10A19}-\u{10A35}\u{10A40}-\u{10A48}\u{10A50}-\u{10A58}\u{10A60}-\u{10A9F}\u{10AC0}-\u{10AE4}\u{10AEB}-\u{10AF6}\u{10B00}-\u{10B35}\u{10B40}-\u{10B55}\u{10B58}-\u{10B72}\u{10B78}-\u{10B91}\u{10B99}-\u{10B9C}\u{10BA9}-\u{10BAF}\u{10C00}-\u{10C48}\u{10C80}-\u{10CB2}\u{10CC0}-\u{10CF2}\u{10CFA}-\u{10D23}\u{10D30}-\u{10D39}\u{10E60}-\u{10E7E}\u{10E80}-\u{10EA9}\u{10EAD}\u{10EB0}\u{10EB1}\u{10F00}-\u{10F27}\u{10F30}-\u{10F45}\u{10F51}-\u{10F59}\u{10F70}-\u{10F81}\u{10F86}-\u{10F89}\u{10FB0}-\u{10FCB}\u{10FE0}-\u{10FF6}\u{1D7CE}-\u{1D7FF}\u{1E800}-\u{1E8C4}\u{1E8C7}-\u{1E8CF}\u{1E900}-\u{1E943}\u{1E94B}\u{1E950}-\u{1E959}\u{1E95E}\u{1E95F}\u{1EC71}-\u{1ECB4}\u{1ED01}-\u{1ED3D}\u{1EE00}-\u{1EE03}\u{1EE05}-\u{1EE1F}\u{1EE21}\u{1EE22}\u{1EE24}\u{1EE27}\u{1EE29}-\u{1EE32}\u{1EE34}-\u{1EE37}\u{1EE39}\u{1EE3B}\u{1EE42}\u{1EE47}\u{1EE49}\u{1EE4B}\u{1EE4D}-\u{1EE4F}\u{1EE51}\u{1EE52}\u{1EE54}\u{1EE57}\u{1EE59}\u{1EE5B}\u{1EE5D}\u{1EE5F}\u{1EE61}\u{1EE62}\u{1EE64}\u{1EE67}-\u{1EE6A}\u{1EE6C}-\u{1EE72}\u{1EE74}-\u{1EE77}\u{1EE79}-\u{1EE7C}\u{1EE7E}\u{1EE80}-\u{1EE89}\u{1EE8B}-\u{1EE9B}\u{1EEA1}-\u{1EEA3}\u{1EEA5}-\u{1EEA9}\u{1EEAB}-\u{1EEBB}\u{1F100}-\u{1F10A}\u{1FBF0}-\u{1FBF9}][\u0300-\u036F\u0483-\u0489\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u0711\u0730-\u074A\u07A6-\u07B0\u07EB-\u07F3\u07FD\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u0898-\u089F\u08CA-\u08E1\u08E3-\u0902\u093A\u093C\u0941-\u0948\u094D\u0951-\u0957\u0962\u0963\u0981\u09BC\u09C1-\u09C4\u09CD\u09E2\u09E3\u09FE\u0A01\u0A02\u0A3C\u0A41\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A70\u0A71\u0A75\u0A81\u0A82\u0ABC\u0AC1-\u0AC5\u0AC7\u0AC8\u0ACD\u0AE2\u0AE3\u0AFA-\u0AFF\u0B01\u0B3C\u0B3F\u0B41-\u0B44\u0B4D\u0B55\u0B56\u0B62\u0B63\u0B82\u0BC0\u0BCD\u0C00\u0C04\u0C3C\u0C3E-\u0C40\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C81\u0CBC\u0CCC\u0CCD\u0CE2\u0CE3\u0D00\u0D01\u0D3B\u0D3C\u0D41-\u0D44\u0D4D\u0D62\u0D63\u0D81\u0DCA\u0DD2-\u0DD4\u0DD6\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0EB1\u0EB4-\u0EBC\u0EC8-\u0ECD\u0F18\u0F19\u0F35\u0F37\u0F39\u0F71-\u0F7E\u0F80-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102D-\u1030\u1032-\u1037\u1039\u103A\u103D\u103E\u1058\u1059\u105E-\u1060\u1071-\u1074\u1082\u1085\u1086\u108D\u109D\u135D-\u135F\u1712-\u1714\u1732\u1733\u1752\u1753\u1772\u1773\u17B4\u17B5\u17B7-\u17BD\u17C6\u17C9-\u17D3\u17DD\u180B-\u180D\u180F\u1885\u1886\u18A9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193B\u1A17\u1A18\u1A1B\u1A56\u1A58-\u1A5E\u1A60\u1A62\u1A65-\u1A6C\u1A73-\u1A7C\u1A7F\u1AB0-\u1ACE\u1B00-\u1B03\u1B34\u1B36-\u1B3A\u1B3C\u1B42\u1B6B-\u1B73\u1B80\u1B81\u1BA2-\u1BA5\u1BA8\u1BA9\u1BAB-\u1BAD\u1BE6\u1BE8\u1BE9\u1BED\u1BEF-\u1BF1\u1C2C-\u1C33\u1C36\u1C37\u1CD0-\u1CD2\u1CD4-\u1CE0\u1CE2-\u1CE8\u1CED\u1CF4\u1CF8\u1CF9\u1DC0-\u1DFF\u20D0-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302D\u3099\u309A\uA66F-\uA672\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA825\uA826\uA82C\uA8C4\uA8C5\uA8E0-\uA8F1\uA8FF\uA926-\uA92D\uA947-\uA951\uA980-\uA982\uA9B3\uA9B6-\uA9B9\uA9BC\uA9BD\uA9E5\uAA29-\uAA2E\uAA31\uAA32\uAA35\uAA36\uAA43\uAA4C\uAA7C\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEC\uAAED\uAAF6\uABE5\uABE8\uABED\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F\u{101FD}\u{102E0}\u{10376}-\u{1037A}\u{10A01}-\u{10A03}\u{10A05}\u{10A06}\u{10A0C}-\u{10A0F}\u{10A38}-\u{10A3A}\u{10A3F}\u{10AE5}\u{10AE6}\u{10D24}-\u{10D27}\u{10EAB}\u{10EAC}\u{10F46}-\u{10F50}\u{10F82}-\u{10F85}\u{11001}\u{11038}-\u{11046}\u{11070}\u{11073}\u{11074}\u{1107F}-\u{11081}\u{110B3}-\u{110B6}\u{110B9}\u{110BA}\u{110C2}\u{11100}-\u{11102}\u{11127}-\u{1112B}\u{1112D}-\u{11134}\u{11173}\u{11180}\u{11181}\u{111B6}-\u{111BE}\u{111C9}-\u{111CC}\u{111CF}\u{1122F}-\u{11231}\u{11234}\u{11236}\u{11237}\u{1123E}\u{112DF}\u{112E3}-\u{112EA}\u{11300}\u{11301}\u{1133B}\u{1133C}\u{11340}\u{11366}-\u{1136C}\u{11370}-\u{11374}\u{11438}-\u{1143F}\u{11442}-\u{11444}\u{11446}\u{1145E}\u{114B3}-\u{114B8}\u{114BA}\u{114BF}\u{114C0}\u{114C2}\u{114C3}\u{115B2}-\u{115B5}\u{115BC}\u{115BD}\u{115BF}\u{115C0}\u{115DC}\u{115DD}\u{11633}-\u{1163A}\u{1163D}\u{1163F}\u{11640}\u{116AB}\u{116AD}\u{116B0}-\u{116B5}\u{116B7}\u{1171D}-\u{1171F}\u{11722}-\u{11725}\u{11727}-\u{1172B}\u{1182F}-\u{11837}\u{11839}\u{1183A}\u{1193B}\u{1193C}\u{1193E}\u{11943}\u{119D4}-\u{119D7}\u{119DA}\u{119DB}\u{119E0}\u{11A01}-\u{11A06}\u{11A09}\u{11A0A}\u{11A33}-\u{11A38}\u{11A3B}-\u{11A3E}\u{11A47}\u{11A51}-\u{11A56}\u{11A59}-\u{11A5B}\u{11A8A}-\u{11A96}\u{11A98}\u{11A99}\u{11C30}-\u{11C36}\u{11C38}-\u{11C3D}\u{11C92}-\u{11CA7}\u{11CAA}-\u{11CB0}\u{11CB2}\u{11CB3}\u{11CB5}\u{11CB6}\u{11D31}-\u{11D36}\u{11D3A}\u{11D3C}\u{11D3D}\u{11D3F}-\u{11D45}\u{11D47}\u{11D90}\u{11D91}\u{11D95}\u{11D97}\u{11EF3}\u{11EF4}\u{16AF0}-\u{16AF4}\u{16B30}-\u{16B36}\u{16F4F}\u{16F8F}-\u{16F92}\u{16FE4}\u{1BC9D}\u{1BC9E}\u{1CF00}-\u{1CF2D}\u{1CF30}-\u{1CF46}\u{1D167}-\u{1D169}\u{1D17B}-\u{1D182}\u{1D185}-\u{1D18B}\u{1D1AA}-\u{1D1AD}\u{1D242}-\u{1D244}\u{1DA00}-\u{1DA36}\u{1DA3B}-\u{1DA6C}\u{1DA75}\u{1DA84}\u{1DA9B}-\u{1DA9F}\u{1DAA1}-\u{1DAAF}\u{1E000}-\u{1E006}\u{1E008}-\u{1E018}\u{1E01B}-\u{1E021}\u{1E023}\u{1E024}\u{1E026}-\u{1E02A}\u{1E130}-\u{1E136}\u{1E2AE}\u{1E2EC}-\u{1E2EF}\u{1E8D0}-\u{1E8D6}\u{1E944}-\u{1E94A}\u{E0100}-\u{E01EF}]*$/u,bidiS4EN:/[0-9\xB2\xB3\xB9\u06F0-\u06F9\u2070\u2074-\u2079\u2080-\u2089\u2488-\u249B\uFF10-\uFF19\u{102E1}-\u{102FB}\u{1D7CE}-\u{1D7FF}\u{1F100}-\u{1F10A}\u{1FBF0}-\u{1FBF9}]/u,bidiS4AN:/[\u0600-\u0605\u0660-\u0669\u066B\u066C\u06DD\u0890\u0891\u08E2\u{10D30}-\u{10D39}\u{10E60}-\u{10E7E}]/u,bidiS5:/^[\0-\x08\x0E-\x1B!-\x84\x86-\u0377\u037A-\u037F\u0384-\u038A\u038C\u038E-\u03A1\u03A3-\u052F\u0531-\u0556\u0559-\u058A\u058D-\u058F\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0606\u0607\u0609\u060A\u060C\u060E-\u061A\u064B-\u065F\u066A\u0670\u06D6-\u06DC\u06DE-\u06E4\u06E7-\u06ED\u06F0-\u06F9\u0711\u0730-\u074A\u07A6-\u07B0\u07EB-\u07F3\u07F6-\u07F9\u07FD\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u0898-\u089F\u08CA-\u08E1\u08E3-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09FE\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A76\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AF1\u0AF9-\u0AFF\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B55-\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B77\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-\u0BFA\u0C00-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3C-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58-\u0C5A\u0C5D\u0C60-\u0C63\u0C66-\u0C6F\u0C77-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDD\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1\u0CF2\u0D00-\u0D0C\u0D0E-\u0D10\u0D12-\u0D44\u0D46-\u0D48\u0D4A-\u0D4F\u0D54-\u0D63\u0D66-\u0D7F\u0D81-\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2-\u0DF4\u0E01-\u0E3A\u0E3F-\u0E5B\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00-\u0F47\u0F49-\u0F6C\u0F71-\u0F97\u0F99-\u0FBC\u0FBE-\u0FCC\u0FCE-\u0FDA\u1000-\u10C5\u10C7\u10CD\u10D0-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u137C\u1380-\u1399\u13A0-\u13F5\u13F8-\u13FD\u1400-\u167F\u1681-\u169C\u16A0-\u16F8\u1700-\u1715\u171F-\u1736\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17DD\u17E0-\u17E9\u17F0-\u17F9\u1800-\u1819\u1820-\u1878\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1940\u1944-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19DA\u19DE-\u1A1B\u1A1E-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA0-\u1AAD\u1AB0-\u1ACE\u1B00-\u1B4C\u1B50-\u1B7E\u1B80-\u1BF3\u1BFC-\u1C37\u1C3B-\u1C49\u1C4D-\u1C88\u1C90-\u1CBA\u1CBD-\u1CC7\u1CD0-\u1CFA\u1D00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FC4\u1FC6-\u1FD3\u1FD6-\u1FDB\u1FDD-\u1FEF\u1FF2-\u1FF4\u1FF6-\u1FFE\u200B-\u200E\u2010-\u2027\u202F-\u205E\u2060-\u2064\u206A-\u2071\u2074-\u208E\u2090-\u209C\u20A0-\u20C0\u20D0-\u20F0\u2100-\u218B\u2190-\u2426\u2440-\u244A\u2460-\u2B73\u2B76-\u2B95\u2B97-\u2CF3\u2CF9-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D70\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2E5D\u2E80-\u2E99\u2E9B-\u2EF3\u2F00-\u2FD5\u2FF0-\u2FFB\u3001-\u303F\u3041-\u3096\u3099-\u30FF\u3105-\u312F\u3131-\u318E\u3190-\u31E3\u31F0-\u321E\u3220-\uA48C\uA490-\uA4C6\uA4D0-\uA62B\uA640-\uA6F7\uA700-\uA7CA\uA7D0\uA7D1\uA7D3\uA7D5-\uA7D9\uA7F2-\uA82C\uA830-\uA839\uA840-\uA877\uA880-\uA8C5\uA8CE-\uA8D9\uA8E0-\uA953\uA95F-\uA97C\uA980-\uA9CD\uA9CF-\uA9D9\uA9DE-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA5C-\uAAC2\uAADB-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB6B\uAB70-\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uD800-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1E\uFB29\uFD3E-\uFD4F\uFDCF\uFDFD-\uFE19\uFE20-\uFE52\uFE54-\uFE66\uFE68-\uFE6B\uFEFF\uFF01-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC\uFFE0-\uFFE6\uFFE8-\uFFEE\uFFF9-\uFFFD\u{10000}-\u{1000B}\u{1000D}-\u{10026}\u{10028}-\u{1003A}\u{1003C}\u{1003D}\u{1003F}-\u{1004D}\u{10050}-\u{1005D}\u{10080}-\u{100FA}\u{10100}-\u{10102}\u{10107}-\u{10133}\u{10137}-\u{1018E}\u{10190}-\u{1019C}\u{101A0}\u{101D0}-\u{101FD}\u{10280}-\u{1029C}\u{102A0}-\u{102D0}\u{102E0}-\u{102FB}\u{10300}-\u{10323}\u{1032D}-\u{1034A}\u{10350}-\u{1037A}\u{10380}-\u{1039D}\u{1039F}-\u{103C3}\u{103C8}-\u{103D5}\u{10400}-\u{1049D}\u{104A0}-\u{104A9}\u{104B0}-\u{104D3}\u{104D8}-\u{104FB}\u{10500}-\u{10527}\u{10530}-\u{10563}\u{1056F}-\u{1057A}\u{1057C}-\u{1058A}\u{1058C}-\u{10592}\u{10594}\u{10595}\u{10597}-\u{105A1}\u{105A3}-\u{105B1}\u{105B3}-\u{105B9}\u{105BB}\u{105BC}\u{10600}-\u{10736}\u{10740}-\u{10755}\u{10760}-\u{10767}\u{10780}-\u{10785}\u{10787}-\u{107B0}\u{107B2}-\u{107BA}\u{1091F}\u{10A01}-\u{10A03}\u{10A05}\u{10A06}\u{10A0C}-\u{10A0F}\u{10A38}-\u{10A3A}\u{10A3F}\u{10AE5}\u{10AE6}\u{10B39}-\u{10B3F}\u{10D24}-\u{10D27}\u{10EAB}\u{10EAC}\u{10F46}-\u{10F50}\u{10F82}-\u{10F85}\u{11000}-\u{1104D}\u{11052}-\u{11075}\u{1107F}-\u{110C2}\u{110CD}\u{110D0}-\u{110E8}\u{110F0}-\u{110F9}\u{11100}-\u{11134}\u{11136}-\u{11147}\u{11150}-\u{11176}\u{11180}-\u{111DF}\u{111E1}-\u{111F4}\u{11200}-\u{11211}\u{11213}-\u{1123E}\u{11280}-\u{11286}\u{11288}\u{1128A}-\u{1128D}\u{1128F}-\u{1129D}\u{1129F}-\u{112A9}\u{112B0}-\u{112EA}\u{112F0}-\u{112F9}\u{11300}-\u{11303}\u{11305}-\u{1130C}\u{1130F}\u{11310}\u{11313}-\u{11328}\u{1132A}-\u{11330}\u{11332}\u{11333}\u{11335}-\u{11339}\u{1133B}-\u{11344}\u{11347}\u{11348}\u{1134B}-\u{1134D}\u{11350}\u{11357}\u{1135D}-\u{11363}\u{11366}-\u{1136C}\u{11370}-\u{11374}\u{11400}-\u{1145B}\u{1145D}-\u{11461}\u{11480}-\u{114C7}\u{114D0}-\u{114D9}\u{11580}-\u{115B5}\u{115B8}-\u{115DD}\u{11600}-\u{11644}\u{11650}-\u{11659}\u{11660}-\u{1166C}\u{11680}-\u{116B9}\u{116C0}-\u{116C9}\u{11700}-\u{1171A}\u{1171D}-\u{1172B}\u{11730}-\u{11746}\u{11800}-\u{1183B}\u{118A0}-\u{118F2}\u{118FF}-\u{11906}\u{11909}\u{1190C}-\u{11913}\u{11915}\u{11916}\u{11918}-\u{11935}\u{11937}\u{11938}\u{1193B}-\u{11946}\u{11950}-\u{11959}\u{119A0}-\u{119A7}\u{119AA}-\u{119D7}\u{119DA}-\u{119E4}\u{11A00}-\u{11A47}\u{11A50}-\u{11AA2}\u{11AB0}-\u{11AF8}\u{11C00}-\u{11C08}\u{11C0A}-\u{11C36}\u{11C38}-\u{11C45}\u{11C50}-\u{11C6C}\u{11C70}-\u{11C8F}\u{11C92}-\u{11CA7}\u{11CA9}-\u{11CB6}\u{11D00}-\u{11D06}\u{11D08}\u{11D09}\u{11D0B}-\u{11D36}\u{11D3A}\u{11D3C}\u{11D3D}\u{11D3F}-\u{11D47}\u{11D50}-\u{11D59}\u{11D60}-\u{11D65}\u{11D67}\u{11D68}\u{11D6A}-\u{11D8E}\u{11D90}\u{11D91}\u{11D93}-\u{11D98}\u{11DA0}-\u{11DA9}\u{11EE0}-\u{11EF8}\u{11FB0}\u{11FC0}-\u{11FF1}\u{11FFF}-\u{12399}\u{12400}-\u{1246E}\u{12470}-\u{12474}\u{12480}-\u{12543}\u{12F90}-\u{12FF2}\u{13000}-\u{1342E}\u{13430}-\u{13438}\u{14400}-\u{14646}\u{16800}-\u{16A38}\u{16A40}-\u{16A5E}\u{16A60}-\u{16A69}\u{16A6E}-\u{16ABE}\u{16AC0}-\u{16AC9}\u{16AD0}-\u{16AED}\u{16AF0}-\u{16AF5}\u{16B00}-\u{16B45}\u{16B50}-\u{16B59}\u{16B5B}-\u{16B61}\u{16B63}-\u{16B77}\u{16B7D}-\u{16B8F}\u{16E40}-\u{16E9A}\u{16F00}-\u{16F4A}\u{16F4F}-\u{16F87}\u{16F8F}-\u{16F9F}\u{16FE0}-\u{16FE4}\u{16FF0}\u{16FF1}\u{17000}-\u{187F7}\u{18800}-\u{18CD5}\u{18D00}-\u{18D08}\u{1AFF0}-\u{1AFF3}\u{1AFF5}-\u{1AFFB}\u{1AFFD}\u{1AFFE}\u{1B000}-\u{1B122}\u{1B150}-\u{1B152}\u{1B164}-\u{1B167}\u{1B170}-\u{1B2FB}\u{1BC00}-\u{1BC6A}\u{1BC70}-\u{1BC7C}\u{1BC80}-\u{1BC88}\u{1BC90}-\u{1BC99}\u{1BC9C}-\u{1BCA3}\u{1CF00}-\u{1CF2D}\u{1CF30}-\u{1CF46}\u{1CF50}-\u{1CFC3}\u{1D000}-\u{1D0F5}\u{1D100}-\u{1D126}\u{1D129}-\u{1D1EA}\u{1D200}-\u{1D245}\u{1D2E0}-\u{1D2F3}\u{1D300}-\u{1D356}\u{1D360}-\u{1D378}\u{1D400}-\u{1D454}\u{1D456}-\u{1D49C}\u{1D49E}\u{1D49F}\u{1D4A2}\u{1D4A5}\u{1D4A6}\u{1D4A9}-\u{1D4AC}\u{1D4AE}-\u{1D4B9}\u{1D4BB}\u{1D4BD}-\u{1D4C3}\u{1D4C5}-\u{1D505}\u{1D507}-\u{1D50A}\u{1D50D}-\u{1D514}\u{1D516}-\u{1D51C}\u{1D51E}-\u{1D539}\u{1D53B}-\u{1D53E}\u{1D540}-\u{1D544}\u{1D546}\u{1D54A}-\u{1D550}\u{1D552}-\u{1D6A5}\u{1D6A8}-\u{1D7CB}\u{1D7CE}-\u{1DA8B}\u{1DA9B}-\u{1DA9F}\u{1DAA1}-\u{1DAAF}\u{1DF00}-\u{1DF1E}\u{1E000}-\u{1E006}\u{1E008}-\u{1E018}\u{1E01B}-\u{1E021}\u{1E023}\u{1E024}\u{1E026}-\u{1E02A}\u{1E100}-\u{1E12C}\u{1E130}-\u{1E13D}\u{1E140}-\u{1E149}\u{1E14E}\u{1E14F}\u{1E290}-\u{1E2AE}\u{1E2C0}-\u{1E2F9}\u{1E2FF}\u{1E7E0}-\u{1E7E6}\u{1E7E8}-\u{1E7EB}\u{1E7ED}\u{1E7EE}\u{1E7F0}-\u{1E7FE}\u{1E8D0}-\u{1E8D6}\u{1E944}-\u{1E94A}\u{1EEF0}\u{1EEF1}\u{1F000}-\u{1F02B}\u{1F030}-\u{1F093}\u{1F0A0}-\u{1F0AE}\u{1F0B1}-\u{1F0BF}\u{1F0C1}-\u{1F0CF}\u{1F0D1}-\u{1F0F5}\u{1F100}-\u{1F1AD}\u{1F1E6}-\u{1F202}\u{1F210}-\u{1F23B}\u{1F240}-\u{1F248}\u{1F250}\u{1F251}\u{1F260}-\u{1F265}\u{1F300}-\u{1F6D7}\u{1F6DD}-\u{1F6EC}\u{1F6F0}-\u{1F6FC}\u{1F700}-\u{1F773}\u{1F780}-\u{1F7D8}\u{1F7E0}-\u{1F7EB}\u{1F7F0}\u{1F800}-\u{1F80B}\u{1F810}-\u{1F847}\u{1F850}-\u{1F859}\u{1F860}-\u{1F887}\u{1F890}-\u{1F8AD}\u{1F8B0}\u{1F8B1}\u{1F900}-\u{1FA53}\u{1FA60}-\u{1FA6D}\u{1FA70}-\u{1FA74}\u{1FA78}-\u{1FA7C}\u{1FA80}-\u{1FA86}\u{1FA90}-\u{1FAAC}\u{1FAB0}-\u{1FABA}\u{1FAC0}-\u{1FAC5}\u{1FAD0}-\u{1FAD9}\u{1FAE0}-\u{1FAE7}\u{1FAF0}-\u{1FAF6}\u{1FB00}-\u{1FB92}\u{1FB94}-\u{1FBCA}\u{1FBF0}-\u{1FBF9}\u{20000}-\u{2A6DF}\u{2A700}-\u{2B738}\u{2B740}-\u{2B81D}\u{2B820}-\u{2CEA1}\u{2CEB0}-\u{2EBE0}\u{2F800}-\u{2FA1D}\u{30000}-\u{3134A}\u{E0001}\u{E0020}-\u{E007F}\u{E0100}-\u{E01EF}\u{F0000}-\u{FFFFD}\u{100000}-\u{10FFFD}]*$/u,bidiS6:/[0-9A-Za-z\xAA\xB2\xB3\xB5\xB9\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02B8\u02BB-\u02C1\u02D0\u02D1\u02E0-\u02E4\u02EE\u0370-\u0373\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0482\u048A-\u052F\u0531-\u0556\u0559-\u0589\u06F0-\u06F9\u0903-\u0939\u093B\u093D-\u0940\u0949-\u094C\u094E-\u0950\u0958-\u0961\u0964-\u0980\u0982\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD-\u09C0\u09C7\u09C8\u09CB\u09CC\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E1\u09E6-\u09F1\u09F4-\u09FA\u09FC\u09FD\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3E-\u0A40\u0A59-\u0A5C\u0A5E\u0A66-\u0A6F\u0A72-\u0A74\u0A76\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD-\u0AC0\u0AC9\u0ACB\u0ACC\u0AD0\u0AE0\u0AE1\u0AE6-\u0AF0\u0AF9\u0B02\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B3E\u0B40\u0B47\u0B48\u0B4B\u0B4C\u0B57\u0B5C\u0B5D\u0B5F-\u0B61\u0B66-\u0B77\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE\u0BBF\u0BC1\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCC\u0BD0\u0BD7\u0BE6-\u0BF2\u0C01-\u0C03\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C41-\u0C44\u0C58-\u0C5A\u0C5D\u0C60\u0C61\u0C66-\u0C6F\u0C77\u0C7F\u0C80\u0C82-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD-\u0CC4\u0CC6-\u0CC8\u0CCA\u0CCB\u0CD5\u0CD6\u0CDD\u0CDE\u0CE0\u0CE1\u0CE6-\u0CEF\u0CF1\u0CF2\u0D02-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D-\u0D40\u0D46-\u0D48\u0D4A-\u0D4C\u0D4E\u0D4F\u0D54-\u0D61\u0D66-\u0D7F\u0D82\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCF-\u0DD1\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2-\u0DF4\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E4F-\u0E5B\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00-\u0F17\u0F1A-\u0F34\u0F36\u0F38\u0F3E-\u0F47\u0F49-\u0F6C\u0F7F\u0F85\u0F88-\u0F8C\u0FBE-\u0FC5\u0FC7-\u0FCC\u0FCE-\u0FDA\u1000-\u102C\u1031\u1038\u103B\u103C\u103F-\u1057\u105A-\u105D\u1061-\u1070\u1075-\u1081\u1083\u1084\u1087-\u108C\u108E-\u109C\u109E-\u10C5\u10C7\u10CD\u10D0-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1360-\u137C\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u167F\u1681-\u169A\u16A0-\u16F8\u1700-\u1711\u1715\u171F-\u1731\u1734-\u1736\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17B6\u17BE-\u17C5\u17C7\u17C8\u17D4-\u17DA\u17DC\u17E0-\u17E9\u1810-\u1819\u1820-\u1878\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1923-\u1926\u1929-\u192B\u1930\u1931\u1933-\u1938\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19DA\u1A00-\u1A16\u1A19\u1A1A\u1A1E-\u1A55\u1A57\u1A61\u1A63\u1A64\u1A6D-\u1A72\u1A80-\u1A89\u1A90-\u1A99\u1AA0-\u1AAD\u1B04-\u1B33\u1B35\u1B3B\u1B3D-\u1B41\u1B43-\u1B4C\u1B50-\u1B6A\u1B74-\u1B7E\u1B82-\u1BA1\u1BA6\u1BA7\u1BAA\u1BAE-\u1BE5\u1BE7\u1BEA-\u1BEC\u1BEE\u1BF2\u1BF3\u1BFC-\u1C2B\u1C34\u1C35\u1C3B-\u1C49\u1C4D-\u1C88\u1C90-\u1CBA\u1CBD-\u1CC7\u1CD3\u1CE1\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5-\u1CF7\u1CFA\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u200E\u2070\u2071\u2074-\u2079\u207F-\u2089\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u214F\u2160-\u2188\u2336-\u237A\u2395\u2488-\u24E9\u26AC\u2800-\u28FF\u2C00-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D70\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u3005-\u3007\u3021-\u3029\u302E\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u3190-\u31BF\u31F0-\u321C\u3220-\u324F\u3260-\u327B\u327F-\u32B0\u32C0-\u32CB\u32D0-\u3376\u337B-\u33DD\u33E0-\u33FE\u3400-\u4DBF\u4E00-\uA48C\uA4D0-\uA60C\uA610-\uA62B\uA640-\uA66E\uA680-\uA69D\uA6A0-\uA6EF\uA6F2-\uA6F7\uA722-\uA787\uA789-\uA7CA\uA7D0\uA7D1\uA7D3\uA7D5-\uA7D9\uA7F2-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA824\uA827\uA830-\uA837\uA840-\uA873\uA880-\uA8C3\uA8CE-\uA8D9\uA8F2-\uA8FE\uA900-\uA925\uA92E-\uA946\uA952\uA953\uA95F-\uA97C\uA983-\uA9B2\uA9B4\uA9B5\uA9BA\uA9BB\uA9BE-\uA9CD\uA9CF-\uA9D9\uA9DE-\uA9E4\uA9E6-\uA9FE\uAA00-\uAA28\uAA2F\uAA30\uAA33\uAA34\uAA40-\uAA42\uAA44-\uAA4B\uAA4D\uAA50-\uAA59\uAA5C-\uAA7B\uAA7D-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAAEB\uAAEE-\uAAF5\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB69\uAB70-\uABE4\uABE6\uABE7\uABE9-\uABEC\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uD800-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFF10-\uFF19\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC\u{10000}-\u{1000B}\u{1000D}-\u{10026}\u{10028}-\u{1003A}\u{1003C}\u{1003D}\u{1003F}-\u{1004D}\u{10050}-\u{1005D}\u{10080}-\u{100FA}\u{10100}\u{10102}\u{10107}-\u{10133}\u{10137}-\u{1013F}\u{1018D}\u{1018E}\u{101D0}-\u{101FC}\u{10280}-\u{1029C}\u{102A0}-\u{102D0}\u{102E1}-\u{102FB}\u{10300}-\u{10323}\u{1032D}-\u{1034A}\u{10350}-\u{10375}\u{10380}-\u{1039D}\u{1039F}-\u{103C3}\u{103C8}-\u{103D5}\u{10400}-\u{1049D}\u{104A0}-\u{104A9}\u{104B0}-\u{104D3}\u{104D8}-\u{104FB}\u{10500}-\u{10527}\u{10530}-\u{10563}\u{1056F}-\u{1057A}\u{1057C}-\u{1058A}\u{1058C}-\u{10592}\u{10594}\u{10595}\u{10597}-\u{105A1}\u{105A3}-\u{105B1}\u{105B3}-\u{105B9}\u{105BB}\u{105BC}\u{10600}-\u{10736}\u{10740}-\u{10755}\u{10760}-\u{10767}\u{10780}-\u{10785}\u{10787}-\u{107B0}\u{107B2}-\u{107BA}\u{11000}\u{11002}-\u{11037}\u{11047}-\u{1104D}\u{11066}-\u{1106F}\u{11071}\u{11072}\u{11075}\u{11082}-\u{110B2}\u{110B7}\u{110B8}\u{110BB}-\u{110C1}\u{110CD}\u{110D0}-\u{110E8}\u{110F0}-\u{110F9}\u{11103}-\u{11126}\u{1112C}\u{11136}-\u{11147}\u{11150}-\u{11172}\u{11174}-\u{11176}\u{11182}-\u{111B5}\u{111BF}-\u{111C8}\u{111CD}\u{111CE}\u{111D0}-\u{111DF}\u{111E1}-\u{111F4}\u{11200}-\u{11211}\u{11213}-\u{1122E}\u{11232}\u{11233}\u{11235}\u{11238}-\u{1123D}\u{11280}-\u{11286}\u{11288}\u{1128A}-\u{1128D}\u{1128F}-\u{1129D}\u{1129F}-\u{112A9}\u{112B0}-\u{112DE}\u{112E0}-\u{112E2}\u{112F0}-\u{112F9}\u{11302}\u{11303}\u{11305}-\u{1130C}\u{1130F}\u{11310}\u{11313}-\u{11328}\u{1132A}-\u{11330}\u{11332}\u{11333}\u{11335}-\u{11339}\u{1133D}-\u{1133F}\u{11341}-\u{11344}\u{11347}\u{11348}\u{1134B}-\u{1134D}\u{11350}\u{11357}\u{1135D}-\u{11363}\u{11400}-\u{11437}\u{11440}\u{11441}\u{11445}\u{11447}-\u{1145B}\u{1145D}\u{1145F}-\u{11461}\u{11480}-\u{114B2}\u{114B9}\u{114BB}-\u{114BE}\u{114C1}\u{114C4}-\u{114C7}\u{114D0}-\u{114D9}\u{11580}-\u{115B1}\u{115B8}-\u{115BB}\u{115BE}\u{115C1}-\u{115DB}\u{11600}-\u{11632}\u{1163B}\u{1163C}\u{1163E}\u{11641}-\u{11644}\u{11650}-\u{11659}\u{11680}-\u{116AA}\u{116AC}\u{116AE}\u{116AF}\u{116B6}\u{116B8}\u{116B9}\u{116C0}-\u{116C9}\u{11700}-\u{1171A}\u{11720}\u{11721}\u{11726}\u{11730}-\u{11746}\u{11800}-\u{1182E}\u{11838}\u{1183B}\u{118A0}-\u{118F2}\u{118FF}-\u{11906}\u{11909}\u{1190C}-\u{11913}\u{11915}\u{11916}\u{11918}-\u{11935}\u{11937}\u{11938}\u{1193D}\u{1193F}-\u{11942}\u{11944}-\u{11946}\u{11950}-\u{11959}\u{119A0}-\u{119A7}\u{119AA}-\u{119D3}\u{119DC}-\u{119DF}\u{119E1}-\u{119E4}\u{11A00}\u{11A07}\u{11A08}\u{11A0B}-\u{11A32}\u{11A39}\u{11A3A}\u{11A3F}-\u{11A46}\u{11A50}\u{11A57}\u{11A58}\u{11A5C}-\u{11A89}\u{11A97}\u{11A9A}-\u{11AA2}\u{11AB0}-\u{11AF8}\u{11C00}-\u{11C08}\u{11C0A}-\u{11C2F}\u{11C3E}-\u{11C45}\u{11C50}-\u{11C6C}\u{11C70}-\u{11C8F}\u{11CA9}\u{11CB1}\u{11CB4}\u{11D00}-\u{11D06}\u{11D08}\u{11D09}\u{11D0B}-\u{11D30}\u{11D46}\u{11D50}-\u{11D59}\u{11D60}-\u{11D65}\u{11D67}\u{11D68}\u{11D6A}-\u{11D8E}\u{11D93}\u{11D94}\u{11D96}\u{11D98}\u{11DA0}-\u{11DA9}\u{11EE0}-\u{11EF2}\u{11EF5}-\u{11EF8}\u{11FB0}\u{11FC0}-\u{11FD4}\u{11FFF}-\u{12399}\u{12400}-\u{1246E}\u{12470}-\u{12474}\u{12480}-\u{12543}\u{12F90}-\u{12FF2}\u{13000}-\u{1342E}\u{13430}-\u{13438}\u{14400}-\u{14646}\u{16800}-\u{16A38}\u{16A40}-\u{16A5E}\u{16A60}-\u{16A69}\u{16A6E}-\u{16ABE}\u{16AC0}-\u{16AC9}\u{16AD0}-\u{16AED}\u{16AF5}\u{16B00}-\u{16B2F}\u{16B37}-\u{16B45}\u{16B50}-\u{16B59}\u{16B5B}-\u{16B61}\u{16B63}-\u{16B77}\u{16B7D}-\u{16B8F}\u{16E40}-\u{16E9A}\u{16F00}-\u{16F4A}\u{16F50}-\u{16F87}\u{16F93}-\u{16F9F}\u{16FE0}\u{16FE1}\u{16FE3}\u{16FF0}\u{16FF1}\u{17000}-\u{187F7}\u{18800}-\u{18CD5}\u{18D00}-\u{18D08}\u{1AFF0}-\u{1AFF3}\u{1AFF5}-\u{1AFFB}\u{1AFFD}\u{1AFFE}\u{1B000}-\u{1B122}\u{1B150}-\u{1B152}\u{1B164}-\u{1B167}\u{1B170}-\u{1B2FB}\u{1BC00}-\u{1BC6A}\u{1BC70}-\u{1BC7C}\u{1BC80}-\u{1BC88}\u{1BC90}-\u{1BC99}\u{1BC9C}\u{1BC9F}\u{1CF50}-\u{1CFC3}\u{1D000}-\u{1D0F5}\u{1D100}-\u{1D126}\u{1D129}-\u{1D166}\u{1D16A}-\u{1D172}\u{1D183}\u{1D184}\u{1D18C}-\u{1D1A9}\u{1D1AE}-\u{1D1E8}\u{1D2E0}-\u{1D2F3}\u{1D360}-\u{1D378}\u{1D400}-\u{1D454}\u{1D456}-\u{1D49C}\u{1D49E}\u{1D49F}\u{1D4A2}\u{1D4A5}\u{1D4A6}\u{1D4A9}-\u{1D4AC}\u{1D4AE}-\u{1D4B9}\u{1D4BB}\u{1D4BD}-\u{1D4C3}\u{1D4C5}-\u{1D505}\u{1D507}-\u{1D50A}\u{1D50D}-\u{1D514}\u{1D516}-\u{1D51C}\u{1D51E}-\u{1D539}\u{1D53B}-\u{1D53E}\u{1D540}-\u{1D544}\u{1D546}\u{1D54A}-\u{1D550}\u{1D552}-\u{1D6A5}\u{1D6A8}-\u{1D6DA}\u{1D6DC}-\u{1D714}\u{1D716}-\u{1D74E}\u{1D750}-\u{1D788}\u{1D78A}-\u{1D7C2}\u{1D7C4}-\u{1D7CB}\u{1D7CE}-\u{1D9FF}\u{1DA37}-\u{1DA3A}\u{1DA6D}-\u{1DA74}\u{1DA76}-\u{1DA83}\u{1DA85}-\u{1DA8B}\u{1DF00}-\u{1DF1E}\u{1E100}-\u{1E12C}\u{1E137}-\u{1E13D}\u{1E140}-\u{1E149}\u{1E14E}\u{1E14F}\u{1E290}-\u{1E2AD}\u{1E2C0}-\u{1E2EB}\u{1E2F0}-\u{1E2F9}\u{1E7E0}-\u{1E7E6}\u{1E7E8}-\u{1E7EB}\u{1E7ED}\u{1E7EE}\u{1E7F0}-\u{1E7FE}\u{1F100}-\u{1F10A}\u{1F110}-\u{1F12E}\u{1F130}-\u{1F169}\u{1F170}-\u{1F1AC}\u{1F1E6}-\u{1F202}\u{1F210}-\u{1F23B}\u{1F240}-\u{1F248}\u{1F250}\u{1F251}\u{1FBF0}-\u{1FBF9}\u{20000}-\u{2A6DF}\u{2A700}-\u{2B738}\u{2B740}-\u{2B81D}\u{2B820}-\u{2CEA1}\u{2CEB0}-\u{2EBE0}\u{2F800}-\u{2FA1D}\u{30000}-\u{3134A}\u{F0000}-\u{FFFFD}\u{100000}-\u{10FFFD}][\u0300-\u036F\u0483-\u0489\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u0711\u0730-\u074A\u07A6-\u07B0\u07EB-\u07F3\u07FD\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u0898-\u089F\u08CA-\u08E1\u08E3-\u0902\u093A\u093C\u0941-\u0948\u094D\u0951-\u0957\u0962\u0963\u0981\u09BC\u09C1-\u09C4\u09CD\u09E2\u09E3\u09FE\u0A01\u0A02\u0A3C\u0A41\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A70\u0A71\u0A75\u0A81\u0A82\u0ABC\u0AC1-\u0AC5\u0AC7\u0AC8\u0ACD\u0AE2\u0AE3\u0AFA-\u0AFF\u0B01\u0B3C\u0B3F\u0B41-\u0B44\u0B4D\u0B55\u0B56\u0B62\u0B63\u0B82\u0BC0\u0BCD\u0C00\u0C04\u0C3C\u0C3E-\u0C40\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C81\u0CBC\u0CCC\u0CCD\u0CE2\u0CE3\u0D00\u0D01\u0D3B\u0D3C\u0D41-\u0D44\u0D4D\u0D62\u0D63\u0D81\u0DCA\u0DD2-\u0DD4\u0DD6\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0EB1\u0EB4-\u0EBC\u0EC8-\u0ECD\u0F18\u0F19\u0F35\u0F37\u0F39\u0F71-\u0F7E\u0F80-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102D-\u1030\u1032-\u1037\u1039\u103A\u103D\u103E\u1058\u1059\u105E-\u1060\u1071-\u1074\u1082\u1085\u1086\u108D\u109D\u135D-\u135F\u1712-\u1714\u1732\u1733\u1752\u1753\u1772\u1773\u17B4\u17B5\u17B7-\u17BD\u17C6\u17C9-\u17D3\u17DD\u180B-\u180D\u180F\u1885\u1886\u18A9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193B\u1A17\u1A18\u1A1B\u1A56\u1A58-\u1A5E\u1A60\u1A62\u1A65-\u1A6C\u1A73-\u1A7C\u1A7F\u1AB0-\u1ACE\u1B00-\u1B03\u1B34\u1B36-\u1B3A\u1B3C\u1B42\u1B6B-\u1B73\u1B80\u1B81\u1BA2-\u1BA5\u1BA8\u1BA9\u1BAB-\u1BAD\u1BE6\u1BE8\u1BE9\u1BED\u1BEF-\u1BF1\u1C2C-\u1C33\u1C36\u1C37\u1CD0-\u1CD2\u1CD4-\u1CE0\u1CE2-\u1CE8\u1CED\u1CF4\u1CF8\u1CF9\u1DC0-\u1DFF\u20D0-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302D\u3099\u309A\uA66F-\uA672\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA825\uA826\uA82C\uA8C4\uA8C5\uA8E0-\uA8F1\uA8FF\uA926-\uA92D\uA947-\uA951\uA980-\uA982\uA9B3\uA9B6-\uA9B9\uA9BC\uA9BD\uA9E5\uAA29-\uAA2E\uAA31\uAA32\uAA35\uAA36\uAA43\uAA4C\uAA7C\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEC\uAAED\uAAF6\uABE5\uABE8\uABED\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F\u{101FD}\u{102E0}\u{10376}-\u{1037A}\u{10A01}-\u{10A03}\u{10A05}\u{10A06}\u{10A0C}-\u{10A0F}\u{10A38}-\u{10A3A}\u{10A3F}\u{10AE5}\u{10AE6}\u{10D24}-\u{10D27}\u{10EAB}\u{10EAC}\u{10F46}-\u{10F50}\u{10F82}-\u{10F85}\u{11001}\u{11038}-\u{11046}\u{11070}\u{11073}\u{11074}\u{1107F}-\u{11081}\u{110B3}-\u{110B6}\u{110B9}\u{110BA}\u{110C2}\u{11100}-\u{11102}\u{11127}-\u{1112B}\u{1112D}-\u{11134}\u{11173}\u{11180}\u{11181}\u{111B6}-\u{111BE}\u{111C9}-\u{111CC}\u{111CF}\u{1122F}-\u{11231}\u{11234}\u{11236}\u{11237}\u{1123E}\u{112DF}\u{112E3}-\u{112EA}\u{11300}\u{11301}\u{1133B}\u{1133C}\u{11340}\u{11366}-\u{1136C}\u{11370}-\u{11374}\u{11438}-\u{1143F}\u{11442}-\u{11444}\u{11446}\u{1145E}\u{114B3}-\u{114B8}\u{114BA}\u{114BF}\u{114C0}\u{114C2}\u{114C3}\u{115B2}-\u{115B5}\u{115BC}\u{115BD}\u{115BF}\u{115C0}\u{115DC}\u{115DD}\u{11633}-\u{1163A}\u{1163D}\u{1163F}\u{11640}\u{116AB}\u{116AD}\u{116B0}-\u{116B5}\u{116B7}\u{1171D}-\u{1171F}\u{11722}-\u{11725}\u{11727}-\u{1172B}\u{1182F}-\u{11837}\u{11839}\u{1183A}\u{1193B}\u{1193C}\u{1193E}\u{11943}\u{119D4}-\u{119D7}\u{119DA}\u{119DB}\u{119E0}\u{11A01}-\u{11A06}\u{11A09}\u{11A0A}\u{11A33}-\u{11A38}\u{11A3B}-\u{11A3E}\u{11A47}\u{11A51}-\u{11A56}\u{11A59}-\u{11A5B}\u{11A8A}-\u{11A96}\u{11A98}\u{11A99}\u{11C30}-\u{11C36}\u{11C38}-\u{11C3D}\u{11C92}-\u{11CA7}\u{11CAA}-\u{11CB0}\u{11CB2}\u{11CB3}\u{11CB5}\u{11CB6}\u{11D31}-\u{11D36}\u{11D3A}\u{11D3C}\u{11D3D}\u{11D3F}-\u{11D45}\u{11D47}\u{11D90}\u{11D91}\u{11D95}\u{11D97}\u{11EF3}\u{11EF4}\u{16AF0}-\u{16AF4}\u{16B30}-\u{16B36}\u{16F4F}\u{16F8F}-\u{16F92}\u{16FE4}\u{1BC9D}\u{1BC9E}\u{1CF00}-\u{1CF2D}\u{1CF30}-\u{1CF46}\u{1D167}-\u{1D169}\u{1D17B}-\u{1D182}\u{1D185}-\u{1D18B}\u{1D1AA}-\u{1D1AD}\u{1D242}-\u{1D244}\u{1DA00}-\u{1DA36}\u{1DA3B}-\u{1DA6C}\u{1DA75}\u{1DA84}\u{1DA9B}-\u{1DA9F}\u{1DAA1}-\u{1DAAF}\u{1E000}-\u{1E006}\u{1E008}-\u{1E018}\u{1E01B}-\u{1E021}\u{1E023}\u{1E024}\u{1E026}-\u{1E02A}\u{1E130}-\u{1E136}\u{1E2AE}\u{1E2EC}-\u{1E2EF}\u{1E8D0}-\u{1E8D6}\u{1E944}-\u{1E94A}\u{E0100}-\u{E01EF}]*$/u}},function(e){e.exports=JSON.parse('[[[0,44],4],[[45,46],2],[47,4],[[48,57],2],[[58,64],4],[65,1,"a"],[66,1,"b"],[67,1,"c"],[68,1,"d"],[69,1,"e"],[70,1,"f"],[71,1,"g"],[72,1,"h"],[73,1,"i"],[74,1,"j"],[75,1,"k"],[76,1,"l"],[77,1,"m"],[78,1,"n"],[79,1,"o"],[80,1,"p"],[81,1,"q"],[82,1,"r"],[83,1,"s"],[84,1,"t"],[85,1,"u"],[86,1,"v"],[87,1,"w"],[88,1,"x"],[89,1,"y"],[90,1,"z"],[[91,96],4],[[97,122],2],[[123,127],4],[[128,159],3],[160,5," "],[[161,167],2],[168,5," ̈"],[169,2],[170,1,"a"],[[171,172],2],[173,7],[174,2],[175,5," ̄"],[[176,177],2],[178,1,"2"],[179,1,"3"],[180,5," ́"],[181,1,"μ"],[182,2],[183,2],[184,5," ̧"],[185,1,"1"],[186,1,"o"],[187,2],[188,1,"1⁄4"],[189,1,"1⁄2"],[190,1,"3⁄4"],[191,2],[192,1,"à"],[193,1,"á"],[194,1,"â"],[195,1,"ã"],[196,1,"ä"],[197,1,"å"],[198,1,"æ"],[199,1,"ç"],[200,1,"è"],[201,1,"é"],[202,1,"ê"],[203,1,"ë"],[204,1,"ì"],[205,1,"í"],[206,1,"î"],[207,1,"ï"],[208,1,"ð"],[209,1,"ñ"],[210,1,"ò"],[211,1,"ó"],[212,1,"ô"],[213,1,"õ"],[214,1,"ö"],[215,2],[216,1,"ø"],[217,1,"ù"],[218,1,"ú"],[219,1,"û"],[220,1,"ü"],[221,1,"ý"],[222,1,"þ"],[223,6,"ss"],[[224,246],2],[247,2],[[248,255],2],[256,1,"ā"],[257,2],[258,1,"ă"],[259,2],[260,1,"ą"],[261,2],[262,1,"ć"],[263,2],[264,1,"ĉ"],[265,2],[266,1,"ċ"],[267,2],[268,1,"č"],[269,2],[270,1,"ď"],[271,2],[272,1,"đ"],[273,2],[274,1,"ē"],[275,2],[276,1,"ĕ"],[277,2],[278,1,"ė"],[279,2],[280,1,"ę"],[281,2],[282,1,"ě"],[283,2],[284,1,"ĝ"],[285,2],[286,1,"ğ"],[287,2],[288,1,"ġ"],[289,2],[290,1,"ģ"],[291,2],[292,1,"ĥ"],[293,2],[294,1,"ħ"],[295,2],[296,1,"ĩ"],[297,2],[298,1,"ī"],[299,2],[300,1,"ĭ"],[301,2],[302,1,"į"],[303,2],[304,1,"i̇"],[305,2],[[306,307],1,"ij"],[308,1,"ĵ"],[309,2],[310,1,"ķ"],[[311,312],2],[313,1,"ĺ"],[314,2],[315,1,"ļ"],[316,2],[317,1,"ľ"],[318,2],[[319,320],1,"l·"],[321,1,"ł"],[322,2],[323,1,"ń"],[324,2],[325,1,"ņ"],[326,2],[327,1,"ň"],[328,2],[329,1,"ʼn"],[330,1,"ŋ"],[331,2],[332,1,"ō"],[333,2],[334,1,"ŏ"],[335,2],[336,1,"ő"],[337,2],[338,1,"œ"],[339,2],[340,1,"ŕ"],[341,2],[342,1,"ŗ"],[343,2],[344,1,"ř"],[345,2],[346,1,"ś"],[347,2],[348,1,"ŝ"],[349,2],[350,1,"ş"],[351,2],[352,1,"š"],[353,2],[354,1,"ţ"],[355,2],[356,1,"ť"],[357,2],[358,1,"ŧ"],[359,2],[360,1,"ũ"],[361,2],[362,1,"ū"],[363,2],[364,1,"ŭ"],[365,2],[366,1,"ů"],[367,2],[368,1,"ű"],[369,2],[370,1,"ų"],[371,2],[372,1,"ŵ"],[373,2],[374,1,"ŷ"],[375,2],[376,1,"ÿ"],[377,1,"ź"],[378,2],[379,1,"ż"],[380,2],[381,1,"ž"],[382,2],[383,1,"s"],[384,2],[385,1,"ɓ"],[386,1,"ƃ"],[387,2],[388,1,"ƅ"],[389,2],[390,1,"ɔ"],[391,1,"ƈ"],[392,2],[393,1,"ɖ"],[394,1,"ɗ"],[395,1,"ƌ"],[[396,397],2],[398,1,"ǝ"],[399,1,"ə"],[400,1,"ɛ"],[401,1,"ƒ"],[402,2],[403,1,"ɠ"],[404,1,"ɣ"],[405,2],[406,1,"ɩ"],[407,1,"ɨ"],[408,1,"ƙ"],[[409,411],2],[412,1,"ɯ"],[413,1,"ɲ"],[414,2],[415,1,"ɵ"],[416,1,"ơ"],[417,2],[418,1,"ƣ"],[419,2],[420,1,"ƥ"],[421,2],[422,1,"ʀ"],[423,1,"ƨ"],[424,2],[425,1,"ʃ"],[[426,427],2],[428,1,"ƭ"],[429,2],[430,1,"ʈ"],[431,1,"ư"],[432,2],[433,1,"ʊ"],[434,1,"ʋ"],[435,1,"ƴ"],[436,2],[437,1,"ƶ"],[438,2],[439,1,"ʒ"],[440,1,"ƹ"],[[441,443],2],[444,1,"ƽ"],[[445,451],2],[[452,454],1,"dž"],[[455,457],1,"lj"],[[458,460],1,"nj"],[461,1,"ǎ"],[462,2],[463,1,"ǐ"],[464,2],[465,1,"ǒ"],[466,2],[467,1,"ǔ"],[468,2],[469,1,"ǖ"],[470,2],[471,1,"ǘ"],[472,2],[473,1,"ǚ"],[474,2],[475,1,"ǜ"],[[476,477],2],[478,1,"ǟ"],[479,2],[480,1,"ǡ"],[481,2],[482,1,"ǣ"],[483,2],[484,1,"ǥ"],[485,2],[486,1,"ǧ"],[487,2],[488,1,"ǩ"],[489,2],[490,1,"ǫ"],[491,2],[492,1,"ǭ"],[493,2],[494,1,"ǯ"],[[495,496],2],[[497,499],1,"dz"],[500,1,"ǵ"],[501,2],[502,1,"ƕ"],[503,1,"ƿ"],[504,1,"ǹ"],[505,2],[506,1,"ǻ"],[507,2],[508,1,"ǽ"],[509,2],[510,1,"ǿ"],[511,2],[512,1,"ȁ"],[513,2],[514,1,"ȃ"],[515,2],[516,1,"ȅ"],[517,2],[518,1,"ȇ"],[519,2],[520,1,"ȉ"],[521,2],[522,1,"ȋ"],[523,2],[524,1,"ȍ"],[525,2],[526,1,"ȏ"],[527,2],[528,1,"ȑ"],[529,2],[530,1,"ȓ"],[531,2],[532,1,"ȕ"],[533,2],[534,1,"ȗ"],[535,2],[536,1,"ș"],[537,2],[538,1,"ț"],[539,2],[540,1,"ȝ"],[541,2],[542,1,"ȟ"],[543,2],[544,1,"ƞ"],[545,2],[546,1,"ȣ"],[547,2],[548,1,"ȥ"],[549,2],[550,1,"ȧ"],[551,2],[552,1,"ȩ"],[553,2],[554,1,"ȫ"],[555,2],[556,1,"ȭ"],[557,2],[558,1,"ȯ"],[559,2],[560,1,"ȱ"],[561,2],[562,1,"ȳ"],[563,2],[[564,566],2],[[567,569],2],[570,1,"ⱥ"],[571,1,"ȼ"],[572,2],[573,1,"ƚ"],[574,1,"ⱦ"],[[575,576],2],[577,1,"ɂ"],[578,2],[579,1,"ƀ"],[580,1,"ʉ"],[581,1,"ʌ"],[582,1,"ɇ"],[583,2],[584,1,"ɉ"],[585,2],[586,1,"ɋ"],[587,2],[588,1,"ɍ"],[589,2],[590,1,"ɏ"],[591,2],[[592,680],2],[[681,685],2],[[686,687],2],[688,1,"h"],[689,1,"ɦ"],[690,1,"j"],[691,1,"r"],[692,1,"ɹ"],[693,1,"ɻ"],[694,1,"ʁ"],[695,1,"w"],[696,1,"y"],[[697,705],2],[[706,709],2],[[710,721],2],[[722,727],2],[728,5," ̆"],[729,5," ̇"],[730,5," ̊"],[731,5," ̨"],[732,5," ̃"],[733,5," ̋"],[734,2],[735,2],[736,1,"ɣ"],[737,1,"l"],[738,1,"s"],[739,1,"x"],[740,1,"ʕ"],[[741,745],2],[[746,747],2],[748,2],[749,2],[750,2],[[751,767],2],[[768,831],2],[832,1,"̀"],[833,1,"́"],[834,2],[835,1,"̓"],[836,1,"̈́"],[837,1,"ι"],[[838,846],2],[847,7],[[848,855],2],[[856,860],2],[[861,863],2],[[864,865],2],[866,2],[[867,879],2],[880,1,"ͱ"],[881,2],[882,1,"ͳ"],[883,2],[884,1,"ʹ"],[885,2],[886,1,"ͷ"],[887,2],[[888,889],3],[890,5," ι"],[[891,893],2],[894,5,";"],[895,1,"ϳ"],[[896,899],3],[900,5," ́"],[901,5," ̈́"],[902,1,"ά"],[903,1,"·"],[904,1,"έ"],[905,1,"ή"],[906,1,"ί"],[907,3],[908,1,"ό"],[909,3],[910,1,"ύ"],[911,1,"ώ"],[912,2],[913,1,"α"],[914,1,"β"],[915,1,"γ"],[916,1,"δ"],[917,1,"ε"],[918,1,"ζ"],[919,1,"η"],[920,1,"θ"],[921,1,"ι"],[922,1,"κ"],[923,1,"λ"],[924,1,"μ"],[925,1,"ν"],[926,1,"ξ"],[927,1,"ο"],[928,1,"π"],[929,1,"ρ"],[930,3],[931,1,"σ"],[932,1,"τ"],[933,1,"υ"],[934,1,"φ"],[935,1,"χ"],[936,1,"ψ"],[937,1,"ω"],[938,1,"ϊ"],[939,1,"ϋ"],[[940,961],2],[962,6,"σ"],[[963,974],2],[975,1,"ϗ"],[976,1,"β"],[977,1,"θ"],[978,1,"υ"],[979,1,"ύ"],[980,1,"ϋ"],[981,1,"φ"],[982,1,"π"],[983,2],[984,1,"ϙ"],[985,2],[986,1,"ϛ"],[987,2],[988,1,"ϝ"],[989,2],[990,1,"ϟ"],[991,2],[992,1,"ϡ"],[993,2],[994,1,"ϣ"],[995,2],[996,1,"ϥ"],[997,2],[998,1,"ϧ"],[999,2],[1000,1,"ϩ"],[1001,2],[1002,1,"ϫ"],[1003,2],[1004,1,"ϭ"],[1005,2],[1006,1,"ϯ"],[1007,2],[1008,1,"κ"],[1009,1,"ρ"],[1010,1,"σ"],[1011,2],[1012,1,"θ"],[1013,1,"ε"],[1014,2],[1015,1,"ϸ"],[1016,2],[1017,1,"σ"],[1018,1,"ϻ"],[1019,2],[1020,2],[1021,1,"ͻ"],[1022,1,"ͼ"],[1023,1,"ͽ"],[1024,1,"ѐ"],[1025,1,"ё"],[1026,1,"ђ"],[1027,1,"ѓ"],[1028,1,"є"],[1029,1,"ѕ"],[1030,1,"і"],[1031,1,"ї"],[1032,1,"ј"],[1033,1,"љ"],[1034,1,"њ"],[1035,1,"ћ"],[1036,1,"ќ"],[1037,1,"ѝ"],[1038,1,"ў"],[1039,1,"џ"],[1040,1,"а"],[1041,1,"б"],[1042,1,"в"],[1043,1,"г"],[1044,1,"д"],[1045,1,"е"],[1046,1,"ж"],[1047,1,"з"],[1048,1,"и"],[1049,1,"й"],[1050,1,"к"],[1051,1,"л"],[1052,1,"м"],[1053,1,"н"],[1054,1,"о"],[1055,1,"п"],[1056,1,"р"],[1057,1,"с"],[1058,1,"т"],[1059,1,"у"],[1060,1,"ф"],[1061,1,"х"],[1062,1,"ц"],[1063,1,"ч"],[1064,1,"ш"],[1065,1,"щ"],[1066,1,"ъ"],[1067,1,"ы"],[1068,1,"ь"],[1069,1,"э"],[1070,1,"ю"],[1071,1,"я"],[[1072,1103],2],[1104,2],[[1105,1116],2],[1117,2],[[1118,1119],2],[1120,1,"ѡ"],[1121,2],[1122,1,"ѣ"],[1123,2],[1124,1,"ѥ"],[1125,2],[1126,1,"ѧ"],[1127,2],[1128,1,"ѩ"],[1129,2],[1130,1,"ѫ"],[1131,2],[1132,1,"ѭ"],[1133,2],[1134,1,"ѯ"],[1135,2],[1136,1,"ѱ"],[1137,2],[1138,1,"ѳ"],[1139,2],[1140,1,"ѵ"],[1141,2],[1142,1,"ѷ"],[1143,2],[1144,1,"ѹ"],[1145,2],[1146,1,"ѻ"],[1147,2],[1148,1,"ѽ"],[1149,2],[1150,1,"ѿ"],[1151,2],[1152,1,"ҁ"],[1153,2],[1154,2],[[1155,1158],2],[1159,2],[[1160,1161],2],[1162,1,"ҋ"],[1163,2],[1164,1,"ҍ"],[1165,2],[1166,1,"ҏ"],[1167,2],[1168,1,"ґ"],[1169,2],[1170,1,"ғ"],[1171,2],[1172,1,"ҕ"],[1173,2],[1174,1,"җ"],[1175,2],[1176,1,"ҙ"],[1177,2],[1178,1,"қ"],[1179,2],[1180,1,"ҝ"],[1181,2],[1182,1,"ҟ"],[1183,2],[1184,1,"ҡ"],[1185,2],[1186,1,"ң"],[1187,2],[1188,1,"ҥ"],[1189,2],[1190,1,"ҧ"],[1191,2],[1192,1,"ҩ"],[1193,2],[1194,1,"ҫ"],[1195,2],[1196,1,"ҭ"],[1197,2],[1198,1,"ү"],[1199,2],[1200,1,"ұ"],[1201,2],[1202,1,"ҳ"],[1203,2],[1204,1,"ҵ"],[1205,2],[1206,1,"ҷ"],[1207,2],[1208,1,"ҹ"],[1209,2],[1210,1,"һ"],[1211,2],[1212,1,"ҽ"],[1213,2],[1214,1,"ҿ"],[1215,2],[1216,3],[1217,1,"ӂ"],[1218,2],[1219,1,"ӄ"],[1220,2],[1221,1,"ӆ"],[1222,2],[1223,1,"ӈ"],[1224,2],[1225,1,"ӊ"],[1226,2],[1227,1,"ӌ"],[1228,2],[1229,1,"ӎ"],[1230,2],[1231,2],[1232,1,"ӑ"],[1233,2],[1234,1,"ӓ"],[1235,2],[1236,1,"ӕ"],[1237,2],[1238,1,"ӗ"],[1239,2],[1240,1,"ә"],[1241,2],[1242,1,"ӛ"],[1243,2],[1244,1,"ӝ"],[1245,2],[1246,1,"ӟ"],[1247,2],[1248,1,"ӡ"],[1249,2],[1250,1,"ӣ"],[1251,2],[1252,1,"ӥ"],[1253,2],[1254,1,"ӧ"],[1255,2],[1256,1,"ө"],[1257,2],[1258,1,"ӫ"],[1259,2],[1260,1,"ӭ"],[1261,2],[1262,1,"ӯ"],[1263,2],[1264,1,"ӱ"],[1265,2],[1266,1,"ӳ"],[1267,2],[1268,1,"ӵ"],[1269,2],[1270,1,"ӷ"],[1271,2],[1272,1,"ӹ"],[1273,2],[1274,1,"ӻ"],[1275,2],[1276,1,"ӽ"],[1277,2],[1278,1,"ӿ"],[1279,2],[1280,1,"ԁ"],[1281,2],[1282,1,"ԃ"],[1283,2],[1284,1,"ԅ"],[1285,2],[1286,1,"ԇ"],[1287,2],[1288,1,"ԉ"],[1289,2],[1290,1,"ԋ"],[1291,2],[1292,1,"ԍ"],[1293,2],[1294,1,"ԏ"],[1295,2],[1296,1,"ԑ"],[1297,2],[1298,1,"ԓ"],[1299,2],[1300,1,"ԕ"],[1301,2],[1302,1,"ԗ"],[1303,2],[1304,1,"ԙ"],[1305,2],[1306,1,"ԛ"],[1307,2],[1308,1,"ԝ"],[1309,2],[1310,1,"ԟ"],[1311,2],[1312,1,"ԡ"],[1313,2],[1314,1,"ԣ"],[1315,2],[1316,1,"ԥ"],[1317,2],[1318,1,"ԧ"],[1319,2],[1320,1,"ԩ"],[1321,2],[1322,1,"ԫ"],[1323,2],[1324,1,"ԭ"],[1325,2],[1326,1,"ԯ"],[1327,2],[1328,3],[1329,1,"ա"],[1330,1,"բ"],[1331,1,"գ"],[1332,1,"դ"],[1333,1,"ե"],[1334,1,"զ"],[1335,1,"է"],[1336,1,"ը"],[1337,1,"թ"],[1338,1,"ժ"],[1339,1,"ի"],[1340,1,"լ"],[1341,1,"խ"],[1342,1,"ծ"],[1343,1,"կ"],[1344,1,"հ"],[1345,1,"ձ"],[1346,1,"ղ"],[1347,1,"ճ"],[1348,1,"մ"],[1349,1,"յ"],[1350,1,"ն"],[1351,1,"շ"],[1352,1,"ո"],[1353,1,"չ"],[1354,1,"պ"],[1355,1,"ջ"],[1356,1,"ռ"],[1357,1,"ս"],[1358,1,"վ"],[1359,1,"տ"],[1360,1,"ր"],[1361,1,"ց"],[1362,1,"ւ"],[1363,1,"փ"],[1364,1,"ք"],[1365,1,"օ"],[1366,1,"ֆ"],[[1367,1368],3],[1369,2],[[1370,1375],2],[1376,2],[[1377,1414],2],[1415,1,"եւ"],[1416,2],[1417,2],[1418,2],[[1419,1420],3],[[1421,1422],2],[1423,2],[1424,3],[[1425,1441],2],[1442,2],[[1443,1455],2],[[1456,1465],2],[1466,2],[[1467,1469],2],[1470,2],[1471,2],[1472,2],[[1473,1474],2],[1475,2],[1476,2],[1477,2],[1478,2],[1479,2],[[1480,1487],3],[[1488,1514],2],[[1515,1518],3],[1519,2],[[1520,1524],2],[[1525,1535],3],[[1536,1539],3],[1540,3],[1541,3],[[1542,1546],2],[1547,2],[1548,2],[[1549,1551],2],[[1552,1557],2],[[1558,1562],2],[1563,2],[1564,3],[1565,2],[1566,2],[1567,2],[1568,2],[[1569,1594],2],[[1595,1599],2],[1600,2],[[1601,1618],2],[[1619,1621],2],[[1622,1624],2],[[1625,1630],2],[1631,2],[[1632,1641],2],[[1642,1645],2],[[1646,1647],2],[[1648,1652],2],[1653,1,"اٴ"],[1654,1,"وٴ"],[1655,1,"ۇٴ"],[1656,1,"يٴ"],[[1657,1719],2],[[1720,1721],2],[[1722,1726],2],[1727,2],[[1728,1742],2],[1743,2],[[1744,1747],2],[1748,2],[[1749,1756],2],[1757,3],[1758,2],[[1759,1768],2],[1769,2],[[1770,1773],2],[[1774,1775],2],[[1776,1785],2],[[1786,1790],2],[1791,2],[[1792,1805],2],[1806,3],[1807,3],[[1808,1836],2],[[1837,1839],2],[[1840,1866],2],[[1867,1868],3],[[1869,1871],2],[[1872,1901],2],[[1902,1919],2],[[1920,1968],2],[1969,2],[[1970,1983],3],[[1984,2037],2],[[2038,2042],2],[[2043,2044],3],[2045,2],[[2046,2047],2],[[2048,2093],2],[[2094,2095],3],[[2096,2110],2],[2111,3],[[2112,2139],2],[[2140,2141],3],[2142,2],[2143,3],[[2144,2154],2],[[2155,2159],3],[[2160,2183],2],[2184,2],[[2185,2190],2],[2191,3],[[2192,2193],3],[[2194,2199],3],[[2200,2207],2],[2208,2],[2209,2],[[2210,2220],2],[[2221,2226],2],[[2227,2228],2],[2229,2],[[2230,2237],2],[[2238,2247],2],[[2248,2258],2],[2259,2],[[2260,2273],2],[2274,3],[2275,2],[[2276,2302],2],[2303,2],[2304,2],[[2305,2307],2],[2308,2],[[2309,2361],2],[[2362,2363],2],[[2364,2381],2],[2382,2],[2383,2],[[2384,2388],2],[2389,2],[[2390,2391],2],[2392,1,"क़"],[2393,1,"ख़"],[2394,1,"ग़"],[2395,1,"ज़"],[2396,1,"ड़"],[2397,1,"ढ़"],[2398,1,"फ़"],[2399,1,"य़"],[[2400,2403],2],[[2404,2405],2],[[2406,2415],2],[2416,2],[[2417,2418],2],[[2419,2423],2],[2424,2],[[2425,2426],2],[[2427,2428],2],[2429,2],[[2430,2431],2],[2432,2],[[2433,2435],2],[2436,3],[[2437,2444],2],[[2445,2446],3],[[2447,2448],2],[[2449,2450],3],[[2451,2472],2],[2473,3],[[2474,2480],2],[2481,3],[2482,2],[[2483,2485],3],[[2486,2489],2],[[2490,2491],3],[2492,2],[2493,2],[[2494,2500],2],[[2501,2502],3],[[2503,2504],2],[[2505,2506],3],[[2507,2509],2],[2510,2],[[2511,2518],3],[2519,2],[[2520,2523],3],[2524,1,"ড়"],[2525,1,"ঢ়"],[2526,3],[2527,1,"য়"],[[2528,2531],2],[[2532,2533],3],[[2534,2545],2],[[2546,2554],2],[2555,2],[2556,2],[2557,2],[2558,2],[[2559,2560],3],[2561,2],[2562,2],[2563,2],[2564,3],[[2565,2570],2],[[2571,2574],3],[[2575,2576],2],[[2577,2578],3],[[2579,2600],2],[2601,3],[[2602,2608],2],[2609,3],[2610,2],[2611,1,"ਲ਼"],[2612,3],[2613,2],[2614,1,"ਸ਼"],[2615,3],[[2616,2617],2],[[2618,2619],3],[2620,2],[2621,3],[[2622,2626],2],[[2627,2630],3],[[2631,2632],2],[[2633,2634],3],[[2635,2637],2],[[2638,2640],3],[2641,2],[[2642,2648],3],[2649,1,"ਖ਼"],[2650,1,"ਗ਼"],[2651,1,"ਜ਼"],[2652,2],[2653,3],[2654,1,"ਫ਼"],[[2655,2661],3],[[2662,2676],2],[2677,2],[2678,2],[[2679,2688],3],[[2689,2691],2],[2692,3],[[2693,2699],2],[2700,2],[2701,2],[2702,3],[[2703,2705],2],[2706,3],[[2707,2728],2],[2729,3],[[2730,2736],2],[2737,3],[[2738,2739],2],[2740,3],[[2741,2745],2],[[2746,2747],3],[[2748,2757],2],[2758,3],[[2759,2761],2],[2762,3],[[2763,2765],2],[[2766,2767],3],[2768,2],[[2769,2783],3],[2784,2],[[2785,2787],2],[[2788,2789],3],[[2790,2799],2],[2800,2],[2801,2],[[2802,2808],3],[2809,2],[[2810,2815],2],[2816,3],[[2817,2819],2],[2820,3],[[2821,2828],2],[[2829,2830],3],[[2831,2832],2],[[2833,2834],3],[[2835,2856],2],[2857,3],[[2858,2864],2],[2865,3],[[2866,2867],2],[2868,3],[2869,2],[[2870,2873],2],[[2874,2875],3],[[2876,2883],2],[2884,2],[[2885,2886],3],[[2887,2888],2],[[2889,2890],3],[[2891,2893],2],[[2894,2900],3],[2901,2],[[2902,2903],2],[[2904,2907],3],[2908,1,"ଡ଼"],[2909,1,"ଢ଼"],[2910,3],[[2911,2913],2],[[2914,2915],2],[[2916,2917],3],[[2918,2927],2],[2928,2],[2929,2],[[2930,2935],2],[[2936,2945],3],[[2946,2947],2],[2948,3],[[2949,2954],2],[[2955,2957],3],[[2958,2960],2],[2961,3],[[2962,2965],2],[[2966,2968],3],[[2969,2970],2],[2971,3],[2972,2],[2973,3],[[2974,2975],2],[[2976,2978],3],[[2979,2980],2],[[2981,2983],3],[[2984,2986],2],[[2987,2989],3],[[2990,2997],2],[2998,2],[[2999,3001],2],[[3002,3005],3],[[3006,3010],2],[[3011,3013],3],[[3014,3016],2],[3017,3],[[3018,3021],2],[[3022,3023],3],[3024,2],[[3025,3030],3],[3031,2],[[3032,3045],3],[3046,2],[[3047,3055],2],[[3056,3058],2],[[3059,3066],2],[[3067,3071],3],[3072,2],[[3073,3075],2],[3076,2],[[3077,3084],2],[3085,3],[[3086,3088],2],[3089,3],[[3090,3112],2],[3113,3],[[3114,3123],2],[3124,2],[[3125,3129],2],[[3130,3131],3],[3132,2],[3133,2],[[3134,3140],2],[3141,3],[[3142,3144],2],[3145,3],[[3146,3149],2],[[3150,3156],3],[[3157,3158],2],[3159,3],[[3160,3161],2],[3162,2],[[3163,3164],3],[3165,2],[[3166,3167],3],[[3168,3169],2],[[3170,3171],2],[[3172,3173],3],[[3174,3183],2],[[3184,3190],3],[3191,2],[[3192,3199],2],[3200,2],[3201,2],[[3202,3203],2],[3204,2],[[3205,3212],2],[3213,3],[[3214,3216],2],[3217,3],[[3218,3240],2],[3241,3],[[3242,3251],2],[3252,3],[[3253,3257],2],[[3258,3259],3],[[3260,3261],2],[[3262,3268],2],[3269,3],[[3270,3272],2],[3273,3],[[3274,3277],2],[[3278,3284],3],[[3285,3286],2],[[3287,3292],3],[3293,2],[3294,2],[3295,3],[[3296,3297],2],[[3298,3299],2],[[3300,3301],3],[[3302,3311],2],[3312,3],[[3313,3314],2],[[3315,3327],3],[3328,2],[3329,2],[[3330,3331],2],[3332,2],[[3333,3340],2],[3341,3],[[3342,3344],2],[3345,3],[[3346,3368],2],[3369,2],[[3370,3385],2],[3386,2],[[3387,3388],2],[3389,2],[[3390,3395],2],[3396,2],[3397,3],[[3398,3400],2],[3401,3],[[3402,3405],2],[3406,2],[3407,2],[[3408,3411],3],[[3412,3414],2],[3415,2],[[3416,3422],2],[3423,2],[[3424,3425],2],[[3426,3427],2],[[3428,3429],3],[[3430,3439],2],[[3440,3445],2],[[3446,3448],2],[3449,2],[[3450,3455],2],[3456,3],[3457,2],[[3458,3459],2],[3460,3],[[3461,3478],2],[[3479,3481],3],[[3482,3505],2],[3506,3],[[3507,3515],2],[3516,3],[3517,2],[[3518,3519],3],[[3520,3526],2],[[3527,3529],3],[3530,2],[[3531,3534],3],[[3535,3540],2],[3541,3],[3542,2],[3543,3],[[3544,3551],2],[[3552,3557],3],[[3558,3567],2],[[3568,3569],3],[[3570,3571],2],[3572,2],[[3573,3584],3],[[3585,3634],2],[3635,1,"ํา"],[[3636,3642],2],[[3643,3646],3],[3647,2],[[3648,3662],2],[3663,2],[[3664,3673],2],[[3674,3675],2],[[3676,3712],3],[[3713,3714],2],[3715,3],[3716,2],[3717,3],[3718,2],[[3719,3720],2],[3721,2],[3722,2],[3723,3],[3724,2],[3725,2],[[3726,3731],2],[[3732,3735],2],[3736,2],[[3737,3743],2],[3744,2],[[3745,3747],2],[3748,3],[3749,2],[3750,3],[3751,2],[[3752,3753],2],[[3754,3755],2],[3756,2],[[3757,3762],2],[3763,1,"ໍາ"],[[3764,3769],2],[3770,2],[[3771,3773],2],[[3774,3775],3],[[3776,3780],2],[3781,3],[3782,2],[3783,3],[[3784,3789],2],[[3790,3791],3],[[3792,3801],2],[[3802,3803],3],[3804,1,"ຫນ"],[3805,1,"ຫມ"],[[3806,3807],2],[[3808,3839],3],[3840,2],[[3841,3850],2],[3851,2],[3852,1,"་"],[[3853,3863],2],[[3864,3865],2],[[3866,3871],2],[[3872,3881],2],[[3882,3892],2],[3893,2],[3894,2],[3895,2],[3896,2],[3897,2],[[3898,3901],2],[[3902,3906],2],[3907,1,"གྷ"],[[3908,3911],2],[3912,3],[[3913,3916],2],[3917,1,"ཌྷ"],[[3918,3921],2],[3922,1,"དྷ"],[[3923,3926],2],[3927,1,"བྷ"],[[3928,3931],2],[3932,1,"ཛྷ"],[[3933,3944],2],[3945,1,"ཀྵ"],[3946,2],[[3947,3948],2],[[3949,3952],3],[[3953,3954],2],[3955,1,"ཱི"],[3956,2],[3957,1,"ཱུ"],[3958,1,"ྲྀ"],[3959,1,"ྲཱྀ"],[3960,1,"ླྀ"],[3961,1,"ླཱྀ"],[[3962,3968],2],[3969,1,"ཱྀ"],[[3970,3972],2],[3973,2],[[3974,3979],2],[[3980,3983],2],[[3984,3986],2],[3987,1,"ྒྷ"],[[3988,3989],2],[3990,2],[3991,2],[3992,3],[[3993,3996],2],[3997,1,"ྜྷ"],[[3998,4001],2],[4002,1,"ྡྷ"],[[4003,4006],2],[4007,1,"ྦྷ"],[[4008,4011],2],[4012,1,"ྫྷ"],[4013,2],[[4014,4016],2],[[4017,4023],2],[4024,2],[4025,1,"ྐྵ"],[[4026,4028],2],[4029,3],[[4030,4037],2],[4038,2],[[4039,4044],2],[4045,3],[4046,2],[4047,2],[[4048,4049],2],[[4050,4052],2],[[4053,4056],2],[[4057,4058],2],[[4059,4095],3],[[4096,4129],2],[4130,2],[[4131,4135],2],[4136,2],[[4137,4138],2],[4139,2],[[4140,4146],2],[[4147,4149],2],[[4150,4153],2],[[4154,4159],2],[[4160,4169],2],[[4170,4175],2],[[4176,4185],2],[[4186,4249],2],[[4250,4253],2],[[4254,4255],2],[[4256,4293],3],[4294,3],[4295,1,"ⴧ"],[[4296,4300],3],[4301,1,"ⴭ"],[[4302,4303],3],[[4304,4342],2],[[4343,4344],2],[[4345,4346],2],[4347,2],[4348,1,"ნ"],[[4349,4351],2],[[4352,4441],2],[[4442,4446],2],[[4447,4448],3],[[4449,4514],2],[[4515,4519],2],[[4520,4601],2],[[4602,4607],2],[[4608,4614],2],[4615,2],[[4616,4678],2],[4679,2],[4680,2],[4681,3],[[4682,4685],2],[[4686,4687],3],[[4688,4694],2],[4695,3],[4696,2],[4697,3],[[4698,4701],2],[[4702,4703],3],[[4704,4742],2],[4743,2],[4744,2],[4745,3],[[4746,4749],2],[[4750,4751],3],[[4752,4782],2],[4783,2],[4784,2],[4785,3],[[4786,4789],2],[[4790,4791],3],[[4792,4798],2],[4799,3],[4800,2],[4801,3],[[4802,4805],2],[[4806,4807],3],[[4808,4814],2],[4815,2],[[4816,4822],2],[4823,3],[[4824,4846],2],[4847,2],[[4848,4878],2],[4879,2],[4880,2],[4881,3],[[4882,4885],2],[[4886,4887],3],[[4888,4894],2],[4895,2],[[4896,4934],2],[4935,2],[[4936,4954],2],[[4955,4956],3],[[4957,4958],2],[4959,2],[4960,2],[[4961,4988],2],[[4989,4991],3],[[4992,5007],2],[[5008,5017],2],[[5018,5023],3],[[5024,5108],2],[5109,2],[[5110,5111],3],[5112,1,"Ᏸ"],[5113,1,"Ᏹ"],[5114,1,"Ᏺ"],[5115,1,"Ᏻ"],[5116,1,"Ᏼ"],[5117,1,"Ᏽ"],[[5118,5119],3],[5120,2],[[5121,5740],2],[[5741,5742],2],[[5743,5750],2],[[5751,5759],2],[5760,3],[[5761,5786],2],[[5787,5788],2],[[5789,5791],3],[[5792,5866],2],[[5867,5872],2],[[5873,5880],2],[[5881,5887],3],[[5888,5900],2],[5901,2],[[5902,5908],2],[5909,2],[[5910,5918],3],[5919,2],[[5920,5940],2],[[5941,5942],2],[[5943,5951],3],[[5952,5971],2],[[5972,5983],3],[[5984,5996],2],[5997,3],[[5998,6000],2],[6001,3],[[6002,6003],2],[[6004,6015],3],[[6016,6067],2],[[6068,6069],3],[[6070,6099],2],[[6100,6102],2],[6103,2],[[6104,6107],2],[6108,2],[6109,2],[[6110,6111],3],[[6112,6121],2],[[6122,6127],3],[[6128,6137],2],[[6138,6143],3],[[6144,6149],2],[6150,3],[[6151,6154],2],[[6155,6157],7],[6158,3],[6159,7],[[6160,6169],2],[[6170,6175],3],[[6176,6263],2],[6264,2],[[6265,6271],3],[[6272,6313],2],[6314,2],[[6315,6319],3],[[6320,6389],2],[[6390,6399],3],[[6400,6428],2],[[6429,6430],2],[6431,3],[[6432,6443],2],[[6444,6447],3],[[6448,6459],2],[[6460,6463],3],[6464,2],[[6465,6467],3],[[6468,6469],2],[[6470,6509],2],[[6510,6511],3],[[6512,6516],2],[[6517,6527],3],[[6528,6569],2],[[6570,6571],2],[[6572,6575],3],[[6576,6601],2],[[6602,6607],3],[[6608,6617],2],[6618,2],[[6619,6621],3],[[6622,6623],2],[[6624,6655],2],[[6656,6683],2],[[6684,6685],3],[[6686,6687],2],[[6688,6750],2],[6751,3],[[6752,6780],2],[[6781,6782],3],[[6783,6793],2],[[6794,6799],3],[[6800,6809],2],[[6810,6815],3],[[6816,6822],2],[6823,2],[[6824,6829],2],[[6830,6831],3],[[6832,6845],2],[6846,2],[[6847,6848],2],[[6849,6862],2],[[6863,6911],3],[[6912,6987],2],[6988,2],[[6989,6991],3],[[6992,7001],2],[[7002,7018],2],[[7019,7027],2],[[7028,7036],2],[[7037,7038],2],[7039,3],[[7040,7082],2],[[7083,7085],2],[[7086,7097],2],[[7098,7103],2],[[7104,7155],2],[[7156,7163],3],[[7164,7167],2],[[7168,7223],2],[[7224,7226],3],[[7227,7231],2],[[7232,7241],2],[[7242,7244],3],[[7245,7293],2],[[7294,7295],2],[7296,1,"в"],[7297,1,"д"],[7298,1,"о"],[7299,1,"с"],[[7300,7301],1,"т"],[7302,1,"ъ"],[7303,1,"ѣ"],[7304,1,"ꙋ"],[[7305,7311],3],[7312,1,"ა"],[7313,1,"ბ"],[7314,1,"გ"],[7315,1,"დ"],[7316,1,"ე"],[7317,1,"ვ"],[7318,1,"ზ"],[7319,1,"თ"],[7320,1,"ი"],[7321,1,"კ"],[7322,1,"ლ"],[7323,1,"მ"],[7324,1,"ნ"],[7325,1,"ო"],[7326,1,"პ"],[7327,1,"ჟ"],[7328,1,"რ"],[7329,1,"ს"],[7330,1,"ტ"],[7331,1,"უ"],[7332,1,"ფ"],[7333,1,"ქ"],[7334,1,"ღ"],[7335,1,"ყ"],[7336,1,"შ"],[7337,1,"ჩ"],[7338,1,"ც"],[7339,1,"ძ"],[7340,1,"წ"],[7341,1,"ჭ"],[7342,1,"ხ"],[7343,1,"ჯ"],[7344,1,"ჰ"],[7345,1,"ჱ"],[7346,1,"ჲ"],[7347,1,"ჳ"],[7348,1,"ჴ"],[7349,1,"ჵ"],[7350,1,"ჶ"],[7351,1,"ჷ"],[7352,1,"ჸ"],[7353,1,"ჹ"],[7354,1,"ჺ"],[[7355,7356],3],[7357,1,"ჽ"],[7358,1,"ჾ"],[7359,1,"ჿ"],[[7360,7367],2],[[7368,7375],3],[[7376,7378],2],[7379,2],[[7380,7410],2],[[7411,7414],2],[7415,2],[[7416,7417],2],[7418,2],[[7419,7423],3],[[7424,7467],2],[7468,1,"a"],[7469,1,"æ"],[7470,1,"b"],[7471,2],[7472,1,"d"],[7473,1,"e"],[7474,1,"ǝ"],[7475,1,"g"],[7476,1,"h"],[7477,1,"i"],[7478,1,"j"],[7479,1,"k"],[7480,1,"l"],[7481,1,"m"],[7482,1,"n"],[7483,2],[7484,1,"o"],[7485,1,"ȣ"],[7486,1,"p"],[7487,1,"r"],[7488,1,"t"],[7489,1,"u"],[7490,1,"w"],[7491,1,"a"],[7492,1,"ɐ"],[7493,1,"ɑ"],[7494,1,"ᴂ"],[7495,1,"b"],[7496,1,"d"],[7497,1,"e"],[7498,1,"ə"],[7499,1,"ɛ"],[7500,1,"ɜ"],[7501,1,"g"],[7502,2],[7503,1,"k"],[7504,1,"m"],[7505,1,"ŋ"],[7506,1,"o"],[7507,1,"ɔ"],[7508,1,"ᴖ"],[7509,1,"ᴗ"],[7510,1,"p"],[7511,1,"t"],[7512,1,"u"],[7513,1,"ᴝ"],[7514,1,"ɯ"],[7515,1,"v"],[7516,1,"ᴥ"],[7517,1,"β"],[7518,1,"γ"],[7519,1,"δ"],[7520,1,"φ"],[7521,1,"χ"],[7522,1,"i"],[7523,1,"r"],[7524,1,"u"],[7525,1,"v"],[7526,1,"β"],[7527,1,"γ"],[7528,1,"ρ"],[7529,1,"φ"],[7530,1,"χ"],[7531,2],[[7532,7543],2],[7544,1,"н"],[[7545,7578],2],[7579,1,"ɒ"],[7580,1,"c"],[7581,1,"ɕ"],[7582,1,"ð"],[7583,1,"ɜ"],[7584,1,"f"],[7585,1,"ɟ"],[7586,1,"ɡ"],[7587,1,"ɥ"],[7588,1,"ɨ"],[7589,1,"ɩ"],[7590,1,"ɪ"],[7591,1,"ᵻ"],[7592,1,"ʝ"],[7593,1,"ɭ"],[7594,1,"ᶅ"],[7595,1,"ʟ"],[7596,1,"ɱ"],[7597,1,"ɰ"],[7598,1,"ɲ"],[7599,1,"ɳ"],[7600,1,"ɴ"],[7601,1,"ɵ"],[7602,1,"ɸ"],[7603,1,"ʂ"],[7604,1,"ʃ"],[7605,1,"ƫ"],[7606,1,"ʉ"],[7607,1,"ʊ"],[7608,1,"ᴜ"],[7609,1,"ʋ"],[7610,1,"ʌ"],[7611,1,"z"],[7612,1,"ʐ"],[7613,1,"ʑ"],[7614,1,"ʒ"],[7615,1,"θ"],[[7616,7619],2],[[7620,7626],2],[[7627,7654],2],[[7655,7669],2],[[7670,7673],2],[7674,2],[7675,2],[7676,2],[7677,2],[[7678,7679],2],[7680,1,"ḁ"],[7681,2],[7682,1,"ḃ"],[7683,2],[7684,1,"ḅ"],[7685,2],[7686,1,"ḇ"],[7687,2],[7688,1,"ḉ"],[7689,2],[7690,1,"ḋ"],[7691,2],[7692,1,"ḍ"],[7693,2],[7694,1,"ḏ"],[7695,2],[7696,1,"ḑ"],[7697,2],[7698,1,"ḓ"],[7699,2],[7700,1,"ḕ"],[7701,2],[7702,1,"ḗ"],[7703,2],[7704,1,"ḙ"],[7705,2],[7706,1,"ḛ"],[7707,2],[7708,1,"ḝ"],[7709,2],[7710,1,"ḟ"],[7711,2],[7712,1,"ḡ"],[7713,2],[7714,1,"ḣ"],[7715,2],[7716,1,"ḥ"],[7717,2],[7718,1,"ḧ"],[7719,2],[7720,1,"ḩ"],[7721,2],[7722,1,"ḫ"],[7723,2],[7724,1,"ḭ"],[7725,2],[7726,1,"ḯ"],[7727,2],[7728,1,"ḱ"],[7729,2],[7730,1,"ḳ"],[7731,2],[7732,1,"ḵ"],[7733,2],[7734,1,"ḷ"],[7735,2],[7736,1,"ḹ"],[7737,2],[7738,1,"ḻ"],[7739,2],[7740,1,"ḽ"],[7741,2],[7742,1,"ḿ"],[7743,2],[7744,1,"ṁ"],[7745,2],[7746,1,"ṃ"],[7747,2],[7748,1,"ṅ"],[7749,2],[7750,1,"ṇ"],[7751,2],[7752,1,"ṉ"],[7753,2],[7754,1,"ṋ"],[7755,2],[7756,1,"ṍ"],[7757,2],[7758,1,"ṏ"],[7759,2],[7760,1,"ṑ"],[7761,2],[7762,1,"ṓ"],[7763,2],[7764,1,"ṕ"],[7765,2],[7766,1,"ṗ"],[7767,2],[7768,1,"ṙ"],[7769,2],[7770,1,"ṛ"],[7771,2],[7772,1,"ṝ"],[7773,2],[7774,1,"ṟ"],[7775,2],[7776,1,"ṡ"],[7777,2],[7778,1,"ṣ"],[7779,2],[7780,1,"ṥ"],[7781,2],[7782,1,"ṧ"],[7783,2],[7784,1,"ṩ"],[7785,2],[7786,1,"ṫ"],[7787,2],[7788,1,"ṭ"],[7789,2],[7790,1,"ṯ"],[7791,2],[7792,1,"ṱ"],[7793,2],[7794,1,"ṳ"],[7795,2],[7796,1,"ṵ"],[7797,2],[7798,1,"ṷ"],[7799,2],[7800,1,"ṹ"],[7801,2],[7802,1,"ṻ"],[7803,2],[7804,1,"ṽ"],[7805,2],[7806,1,"ṿ"],[7807,2],[7808,1,"ẁ"],[7809,2],[7810,1,"ẃ"],[7811,2],[7812,1,"ẅ"],[7813,2],[7814,1,"ẇ"],[7815,2],[7816,1,"ẉ"],[7817,2],[7818,1,"ẋ"],[7819,2],[7820,1,"ẍ"],[7821,2],[7822,1,"ẏ"],[7823,2],[7824,1,"ẑ"],[7825,2],[7826,1,"ẓ"],[7827,2],[7828,1,"ẕ"],[[7829,7833],2],[7834,1,"aʾ"],[7835,1,"ṡ"],[[7836,7837],2],[7838,1,"ss"],[7839,2],[7840,1,"ạ"],[7841,2],[7842,1,"ả"],[7843,2],[7844,1,"ấ"],[7845,2],[7846,1,"ầ"],[7847,2],[7848,1,"ẩ"],[7849,2],[7850,1,"ẫ"],[7851,2],[7852,1,"ậ"],[7853,2],[7854,1,"ắ"],[7855,2],[7856,1,"ằ"],[7857,2],[7858,1,"ẳ"],[7859,2],[7860,1,"ẵ"],[7861,2],[7862,1,"ặ"],[7863,2],[7864,1,"ẹ"],[7865,2],[7866,1,"ẻ"],[7867,2],[7868,1,"ẽ"],[7869,2],[7870,1,"ế"],[7871,2],[7872,1,"ề"],[7873,2],[7874,1,"ể"],[7875,2],[7876,1,"ễ"],[7877,2],[7878,1,"ệ"],[7879,2],[7880,1,"ỉ"],[7881,2],[7882,1,"ị"],[7883,2],[7884,1,"ọ"],[7885,2],[7886,1,"ỏ"],[7887,2],[7888,1,"ố"],[7889,2],[7890,1,"ồ"],[7891,2],[7892,1,"ổ"],[7893,2],[7894,1,"ỗ"],[7895,2],[7896,1,"ộ"],[7897,2],[7898,1,"ớ"],[7899,2],[7900,1,"ờ"],[7901,2],[7902,1,"ở"],[7903,2],[7904,1,"ỡ"],[7905,2],[7906,1,"ợ"],[7907,2],[7908,1,"ụ"],[7909,2],[7910,1,"ủ"],[7911,2],[7912,1,"ứ"],[7913,2],[7914,1,"ừ"],[7915,2],[7916,1,"ử"],[7917,2],[7918,1,"ữ"],[7919,2],[7920,1,"ự"],[7921,2],[7922,1,"ỳ"],[7923,2],[7924,1,"ỵ"],[7925,2],[7926,1,"ỷ"],[7927,2],[7928,1,"ỹ"],[7929,2],[7930,1,"ỻ"],[7931,2],[7932,1,"ỽ"],[7933,2],[7934,1,"ỿ"],[7935,2],[[7936,7943],2],[7944,1,"ἀ"],[7945,1,"ἁ"],[7946,1,"ἂ"],[7947,1,"ἃ"],[7948,1,"ἄ"],[7949,1,"ἅ"],[7950,1,"ἆ"],[7951,1,"ἇ"],[[7952,7957],2],[[7958,7959],3],[7960,1,"ἐ"],[7961,1,"ἑ"],[7962,1,"ἒ"],[7963,1,"ἓ"],[7964,1,"ἔ"],[7965,1,"ἕ"],[[7966,7967],3],[[7968,7975],2],[7976,1,"ἠ"],[7977,1,"ἡ"],[7978,1,"ἢ"],[7979,1,"ἣ"],[7980,1,"ἤ"],[7981,1,"ἥ"],[7982,1,"ἦ"],[7983,1,"ἧ"],[[7984,7991],2],[7992,1,"ἰ"],[7993,1,"ἱ"],[7994,1,"ἲ"],[7995,1,"ἳ"],[7996,1,"ἴ"],[7997,1,"ἵ"],[7998,1,"ἶ"],[7999,1,"ἷ"],[[8000,8005],2],[[8006,8007],3],[8008,1,"ὀ"],[8009,1,"ὁ"],[8010,1,"ὂ"],[8011,1,"ὃ"],[8012,1,"ὄ"],[8013,1,"ὅ"],[[8014,8015],3],[[8016,8023],2],[8024,3],[8025,1,"ὑ"],[8026,3],[8027,1,"ὓ"],[8028,3],[8029,1,"ὕ"],[8030,3],[8031,1,"ὗ"],[[8032,8039],2],[8040,1,"ὠ"],[8041,1,"ὡ"],[8042,1,"ὢ"],[8043,1,"ὣ"],[8044,1,"ὤ"],[8045,1,"ὥ"],[8046,1,"ὦ"],[8047,1,"ὧ"],[8048,2],[8049,1,"ά"],[8050,2],[8051,1,"έ"],[8052,2],[8053,1,"ή"],[8054,2],[8055,1,"ί"],[8056,2],[8057,1,"ό"],[8058,2],[8059,1,"ύ"],[8060,2],[8061,1,"ώ"],[[8062,8063],3],[8064,1,"ἀι"],[8065,1,"ἁι"],[8066,1,"ἂι"],[8067,1,"ἃι"],[8068,1,"ἄι"],[8069,1,"ἅι"],[8070,1,"ἆι"],[8071,1,"ἇι"],[8072,1,"ἀι"],[8073,1,"ἁι"],[8074,1,"ἂι"],[8075,1,"ἃι"],[8076,1,"ἄι"],[8077,1,"ἅι"],[8078,1,"ἆι"],[8079,1,"ἇι"],[8080,1,"ἠι"],[8081,1,"ἡι"],[8082,1,"ἢι"],[8083,1,"ἣι"],[8084,1,"ἤι"],[8085,1,"ἥι"],[8086,1,"ἦι"],[8087,1,"ἧι"],[8088,1,"ἠι"],[8089,1,"ἡι"],[8090,1,"ἢι"],[8091,1,"ἣι"],[8092,1,"ἤι"],[8093,1,"ἥι"],[8094,1,"ἦι"],[8095,1,"ἧι"],[8096,1,"ὠι"],[8097,1,"ὡι"],[8098,1,"ὢι"],[8099,1,"ὣι"],[8100,1,"ὤι"],[8101,1,"ὥι"],[8102,1,"ὦι"],[8103,1,"ὧι"],[8104,1,"ὠι"],[8105,1,"ὡι"],[8106,1,"ὢι"],[8107,1,"ὣι"],[8108,1,"ὤι"],[8109,1,"ὥι"],[8110,1,"ὦι"],[8111,1,"ὧι"],[[8112,8113],2],[8114,1,"ὰι"],[8115,1,"αι"],[8116,1,"άι"],[8117,3],[8118,2],[8119,1,"ᾶι"],[8120,1,"ᾰ"],[8121,1,"ᾱ"],[8122,1,"ὰ"],[8123,1,"ά"],[8124,1,"αι"],[8125,5," ̓"],[8126,1,"ι"],[8127,5," ̓"],[8128,5," ͂"],[8129,5," ̈͂"],[8130,1,"ὴι"],[8131,1,"ηι"],[8132,1,"ήι"],[8133,3],[8134,2],[8135,1,"ῆι"],[8136,1,"ὲ"],[8137,1,"έ"],[8138,1,"ὴ"],[8139,1,"ή"],[8140,1,"ηι"],[8141,5," ̓̀"],[8142,5," ̓́"],[8143,5," ̓͂"],[[8144,8146],2],[8147,1,"ΐ"],[[8148,8149],3],[[8150,8151],2],[8152,1,"ῐ"],[8153,1,"ῑ"],[8154,1,"ὶ"],[8155,1,"ί"],[8156,3],[8157,5," ̔̀"],[8158,5," ̔́"],[8159,5," ̔͂"],[[8160,8162],2],[8163,1,"ΰ"],[[8164,8167],2],[8168,1,"ῠ"],[8169,1,"ῡ"],[8170,1,"ὺ"],[8171,1,"ύ"],[8172,1,"ῥ"],[8173,5," ̈̀"],[8174,5," ̈́"],[8175,5,"`"],[[8176,8177],3],[8178,1,"ὼι"],[8179,1,"ωι"],[8180,1,"ώι"],[8181,3],[8182,2],[8183,1,"ῶι"],[8184,1,"ὸ"],[8185,1,"ό"],[8186,1,"ὼ"],[8187,1,"ώ"],[8188,1,"ωι"],[8189,5," ́"],[8190,5," ̔"],[8191,3],[[8192,8202],5," "],[8203,7],[[8204,8205],6,""],[[8206,8207],3],[8208,2],[8209,1,"‐"],[[8210,8214],2],[8215,5," ̳"],[[8216,8227],2],[[8228,8230],3],[8231,2],[[8232,8238],3],[8239,5," "],[[8240,8242],2],[8243,1,"′′"],[8244,1,"′′′"],[8245,2],[8246,1,"‵‵"],[8247,1,"‵‵‵"],[[8248,8251],2],[8252,5,"!!"],[8253,2],[8254,5," ̅"],[[8255,8262],2],[8263,5,"??"],[8264,5,"?!"],[8265,5,"!?"],[[8266,8269],2],[[8270,8274],2],[[8275,8276],2],[[8277,8278],2],[8279,1,"′′′′"],[[8280,8286],2],[8287,5," "],[8288,7],[[8289,8291],3],[8292,7],[8293,3],[[8294,8297],3],[[8298,8303],3],[8304,1,"0"],[8305,1,"i"],[[8306,8307],3],[8308,1,"4"],[8309,1,"5"],[8310,1,"6"],[8311,1,"7"],[8312,1,"8"],[8313,1,"9"],[8314,5,"+"],[8315,1,"−"],[8316,5,"="],[8317,5,"("],[8318,5,")"],[8319,1,"n"],[8320,1,"0"],[8321,1,"1"],[8322,1,"2"],[8323,1,"3"],[8324,1,"4"],[8325,1,"5"],[8326,1,"6"],[8327,1,"7"],[8328,1,"8"],[8329,1,"9"],[8330,5,"+"],[8331,1,"−"],[8332,5,"="],[8333,5,"("],[8334,5,")"],[8335,3],[8336,1,"a"],[8337,1,"e"],[8338,1,"o"],[8339,1,"x"],[8340,1,"ə"],[8341,1,"h"],[8342,1,"k"],[8343,1,"l"],[8344,1,"m"],[8345,1,"n"],[8346,1,"p"],[8347,1,"s"],[8348,1,"t"],[[8349,8351],3],[[8352,8359],2],[8360,1,"rs"],[[8361,8362],2],[8363,2],[8364,2],[[8365,8367],2],[[8368,8369],2],[[8370,8373],2],[[8374,8376],2],[8377,2],[8378,2],[[8379,8381],2],[8382,2],[8383,2],[8384,2],[[8385,8399],3],[[8400,8417],2],[[8418,8419],2],[[8420,8426],2],[8427,2],[[8428,8431],2],[8432,2],[[8433,8447],3],[8448,5,"a/c"],[8449,5,"a/s"],[8450,1,"c"],[8451,1,"°c"],[8452,2],[8453,5,"c/o"],[8454,5,"c/u"],[8455,1,"ɛ"],[8456,2],[8457,1,"°f"],[8458,1,"g"],[[8459,8462],1,"h"],[8463,1,"ħ"],[[8464,8465],1,"i"],[[8466,8467],1,"l"],[8468,2],[8469,1,"n"],[8470,1,"no"],[[8471,8472],2],[8473,1,"p"],[8474,1,"q"],[[8475,8477],1,"r"],[[8478,8479],2],[8480,1,"sm"],[8481,1,"tel"],[8482,1,"tm"],[8483,2],[8484,1,"z"],[8485,2],[8486,1,"ω"],[8487,2],[8488,1,"z"],[8489,2],[8490,1,"k"],[8491,1,"å"],[8492,1,"b"],[8493,1,"c"],[8494,2],[[8495,8496],1,"e"],[8497,1,"f"],[8498,3],[8499,1,"m"],[8500,1,"o"],[8501,1,"א"],[8502,1,"ב"],[8503,1,"ג"],[8504,1,"ד"],[8505,1,"i"],[8506,2],[8507,1,"fax"],[8508,1,"π"],[[8509,8510],1,"γ"],[8511,1,"π"],[8512,1,"∑"],[[8513,8516],2],[[8517,8518],1,"d"],[8519,1,"e"],[8520,1,"i"],[8521,1,"j"],[[8522,8523],2],[8524,2],[8525,2],[8526,2],[8527,2],[8528,1,"1⁄7"],[8529,1,"1⁄9"],[8530,1,"1⁄10"],[8531,1,"1⁄3"],[8532,1,"2⁄3"],[8533,1,"1⁄5"],[8534,1,"2⁄5"],[8535,1,"3⁄5"],[8536,1,"4⁄5"],[8537,1,"1⁄6"],[8538,1,"5⁄6"],[8539,1,"1⁄8"],[8540,1,"3⁄8"],[8541,1,"5⁄8"],[8542,1,"7⁄8"],[8543,1,"1⁄"],[8544,1,"i"],[8545,1,"ii"],[8546,1,"iii"],[8547,1,"iv"],[8548,1,"v"],[8549,1,"vi"],[8550,1,"vii"],[8551,1,"viii"],[8552,1,"ix"],[8553,1,"x"],[8554,1,"xi"],[8555,1,"xii"],[8556,1,"l"],[8557,1,"c"],[8558,1,"d"],[8559,1,"m"],[8560,1,"i"],[8561,1,"ii"],[8562,1,"iii"],[8563,1,"iv"],[8564,1,"v"],[8565,1,"vi"],[8566,1,"vii"],[8567,1,"viii"],[8568,1,"ix"],[8569,1,"x"],[8570,1,"xi"],[8571,1,"xii"],[8572,1,"l"],[8573,1,"c"],[8574,1,"d"],[8575,1,"m"],[[8576,8578],2],[8579,3],[8580,2],[[8581,8584],2],[8585,1,"0⁄3"],[[8586,8587],2],[[8588,8591],3],[[8592,8682],2],[[8683,8691],2],[[8692,8703],2],[[8704,8747],2],[8748,1,"∫∫"],[8749,1,"∫∫∫"],[8750,2],[8751,1,"∮∮"],[8752,1,"∮∮∮"],[[8753,8799],2],[8800,4],[[8801,8813],2],[[8814,8815],4],[[8816,8945],2],[[8946,8959],2],[8960,2],[8961,2],[[8962,9000],2],[9001,1,"〈"],[9002,1,"〉"],[[9003,9082],2],[9083,2],[9084,2],[[9085,9114],2],[[9115,9166],2],[[9167,9168],2],[[9169,9179],2],[[9180,9191],2],[9192,2],[[9193,9203],2],[[9204,9210],2],[[9211,9214],2],[9215,2],[[9216,9252],2],[[9253,9254],2],[[9255,9279],3],[[9280,9290],2],[[9291,9311],3],[9312,1,"1"],[9313,1,"2"],[9314,1,"3"],[9315,1,"4"],[9316,1,"5"],[9317,1,"6"],[9318,1,"7"],[9319,1,"8"],[9320,1,"9"],[9321,1,"10"],[9322,1,"11"],[9323,1,"12"],[9324,1,"13"],[9325,1,"14"],[9326,1,"15"],[9327,1,"16"],[9328,1,"17"],[9329,1,"18"],[9330,1,"19"],[9331,1,"20"],[9332,5,"(1)"],[9333,5,"(2)"],[9334,5,"(3)"],[9335,5,"(4)"],[9336,5,"(5)"],[9337,5,"(6)"],[9338,5,"(7)"],[9339,5,"(8)"],[9340,5,"(9)"],[9341,5,"(10)"],[9342,5,"(11)"],[9343,5,"(12)"],[9344,5,"(13)"],[9345,5,"(14)"],[9346,5,"(15)"],[9347,5,"(16)"],[9348,5,"(17)"],[9349,5,"(18)"],[9350,5,"(19)"],[9351,5,"(20)"],[[9352,9371],3],[9372,5,"(a)"],[9373,5,"(b)"],[9374,5,"(c)"],[9375,5,"(d)"],[9376,5,"(e)"],[9377,5,"(f)"],[9378,5,"(g)"],[9379,5,"(h)"],[9380,5,"(i)"],[9381,5,"(j)"],[9382,5,"(k)"],[9383,5,"(l)"],[9384,5,"(m)"],[9385,5,"(n)"],[9386,5,"(o)"],[9387,5,"(p)"],[9388,5,"(q)"],[9389,5,"(r)"],[9390,5,"(s)"],[9391,5,"(t)"],[9392,5,"(u)"],[9393,5,"(v)"],[9394,5,"(w)"],[9395,5,"(x)"],[9396,5,"(y)"],[9397,5,"(z)"],[9398,1,"a"],[9399,1,"b"],[9400,1,"c"],[9401,1,"d"],[9402,1,"e"],[9403,1,"f"],[9404,1,"g"],[9405,1,"h"],[9406,1,"i"],[9407,1,"j"],[9408,1,"k"],[9409,1,"l"],[9410,1,"m"],[9411,1,"n"],[9412,1,"o"],[9413,1,"p"],[9414,1,"q"],[9415,1,"r"],[9416,1,"s"],[9417,1,"t"],[9418,1,"u"],[9419,1,"v"],[9420,1,"w"],[9421,1,"x"],[9422,1,"y"],[9423,1,"z"],[9424,1,"a"],[9425,1,"b"],[9426,1,"c"],[9427,1,"d"],[9428,1,"e"],[9429,1,"f"],[9430,1,"g"],[9431,1,"h"],[9432,1,"i"],[9433,1,"j"],[9434,1,"k"],[9435,1,"l"],[9436,1,"m"],[9437,1,"n"],[9438,1,"o"],[9439,1,"p"],[9440,1,"q"],[9441,1,"r"],[9442,1,"s"],[9443,1,"t"],[9444,1,"u"],[9445,1,"v"],[9446,1,"w"],[9447,1,"x"],[9448,1,"y"],[9449,1,"z"],[9450,1,"0"],[[9451,9470],2],[9471,2],[[9472,9621],2],[[9622,9631],2],[[9632,9711],2],[[9712,9719],2],[[9720,9727],2],[[9728,9747],2],[[9748,9749],2],[[9750,9751],2],[9752,2],[9753,2],[[9754,9839],2],[[9840,9841],2],[[9842,9853],2],[[9854,9855],2],[[9856,9865],2],[[9866,9873],2],[[9874,9884],2],[9885,2],[[9886,9887],2],[[9888,9889],2],[[9890,9905],2],[9906,2],[[9907,9916],2],[[9917,9919],2],[[9920,9923],2],[[9924,9933],2],[9934,2],[[9935,9953],2],[9954,2],[9955,2],[[9956,9959],2],[[9960,9983],2],[9984,2],[[9985,9988],2],[9989,2],[[9990,9993],2],[[9994,9995],2],[[9996,10023],2],[10024,2],[[10025,10059],2],[10060,2],[10061,2],[10062,2],[[10063,10066],2],[[10067,10069],2],[10070,2],[10071,2],[[10072,10078],2],[[10079,10080],2],[[10081,10087],2],[[10088,10101],2],[[10102,10132],2],[[10133,10135],2],[[10136,10159],2],[10160,2],[[10161,10174],2],[10175,2],[[10176,10182],2],[[10183,10186],2],[10187,2],[10188,2],[10189,2],[[10190,10191],2],[[10192,10219],2],[[10220,10223],2],[[10224,10239],2],[[10240,10495],2],[[10496,10763],2],[10764,1,"∫∫∫∫"],[[10765,10867],2],[10868,5,"::="],[10869,5,"=="],[10870,5,"==="],[[10871,10971],2],[10972,1,"⫝̸"],[[10973,11007],2],[[11008,11021],2],[[11022,11027],2],[[11028,11034],2],[[11035,11039],2],[[11040,11043],2],[[11044,11084],2],[[11085,11087],2],[[11088,11092],2],[[11093,11097],2],[[11098,11123],2],[[11124,11125],3],[[11126,11157],2],[11158,3],[11159,2],[[11160,11193],2],[[11194,11196],2],[[11197,11208],2],[11209,2],[[11210,11217],2],[11218,2],[[11219,11243],2],[[11244,11247],2],[[11248,11262],2],[11263,2],[11264,1,"ⰰ"],[11265,1,"ⰱ"],[11266,1,"ⰲ"],[11267,1,"ⰳ"],[11268,1,"ⰴ"],[11269,1,"ⰵ"],[11270,1,"ⰶ"],[11271,1,"ⰷ"],[11272,1,"ⰸ"],[11273,1,"ⰹ"],[11274,1,"ⰺ"],[11275,1,"ⰻ"],[11276,1,"ⰼ"],[11277,1,"ⰽ"],[11278,1,"ⰾ"],[11279,1,"ⰿ"],[11280,1,"ⱀ"],[11281,1,"ⱁ"],[11282,1,"ⱂ"],[11283,1,"ⱃ"],[11284,1,"ⱄ"],[11285,1,"ⱅ"],[11286,1,"ⱆ"],[11287,1,"ⱇ"],[11288,1,"ⱈ"],[11289,1,"ⱉ"],[11290,1,"ⱊ"],[11291,1,"ⱋ"],[11292,1,"ⱌ"],[11293,1,"ⱍ"],[11294,1,"ⱎ"],[11295,1,"ⱏ"],[11296,1,"ⱐ"],[11297,1,"ⱑ"],[11298,1,"ⱒ"],[11299,1,"ⱓ"],[11300,1,"ⱔ"],[11301,1,"ⱕ"],[11302,1,"ⱖ"],[11303,1,"ⱗ"],[11304,1,"ⱘ"],[11305,1,"ⱙ"],[11306,1,"ⱚ"],[11307,1,"ⱛ"],[11308,1,"ⱜ"],[11309,1,"ⱝ"],[11310,1,"ⱞ"],[11311,1,"ⱟ"],[[11312,11358],2],[11359,2],[11360,1,"ⱡ"],[11361,2],[11362,1,"ɫ"],[11363,1,"ᵽ"],[11364,1,"ɽ"],[[11365,11366],2],[11367,1,"ⱨ"],[11368,2],[11369,1,"ⱪ"],[11370,2],[11371,1,"ⱬ"],[11372,2],[11373,1,"ɑ"],[11374,1,"ɱ"],[11375,1,"ɐ"],[11376,1,"ɒ"],[11377,2],[11378,1,"ⱳ"],[11379,2],[11380,2],[11381,1,"ⱶ"],[[11382,11383],2],[[11384,11387],2],[11388,1,"j"],[11389,1,"v"],[11390,1,"ȿ"],[11391,1,"ɀ"],[11392,1,"ⲁ"],[11393,2],[11394,1,"ⲃ"],[11395,2],[11396,1,"ⲅ"],[11397,2],[11398,1,"ⲇ"],[11399,2],[11400,1,"ⲉ"],[11401,2],[11402,1,"ⲋ"],[11403,2],[11404,1,"ⲍ"],[11405,2],[11406,1,"ⲏ"],[11407,2],[11408,1,"ⲑ"],[11409,2],[11410,1,"ⲓ"],[11411,2],[11412,1,"ⲕ"],[11413,2],[11414,1,"ⲗ"],[11415,2],[11416,1,"ⲙ"],[11417,2],[11418,1,"ⲛ"],[11419,2],[11420,1,"ⲝ"],[11421,2],[11422,1,"ⲟ"],[11423,2],[11424,1,"ⲡ"],[11425,2],[11426,1,"ⲣ"],[11427,2],[11428,1,"ⲥ"],[11429,2],[11430,1,"ⲧ"],[11431,2],[11432,1,"ⲩ"],[11433,2],[11434,1,"ⲫ"],[11435,2],[11436,1,"ⲭ"],[11437,2],[11438,1,"ⲯ"],[11439,2],[11440,1,"ⲱ"],[11441,2],[11442,1,"ⲳ"],[11443,2],[11444,1,"ⲵ"],[11445,2],[11446,1,"ⲷ"],[11447,2],[11448,1,"ⲹ"],[11449,2],[11450,1,"ⲻ"],[11451,2],[11452,1,"ⲽ"],[11453,2],[11454,1,"ⲿ"],[11455,2],[11456,1,"ⳁ"],[11457,2],[11458,1,"ⳃ"],[11459,2],[11460,1,"ⳅ"],[11461,2],[11462,1,"ⳇ"],[11463,2],[11464,1,"ⳉ"],[11465,2],[11466,1,"ⳋ"],[11467,2],[11468,1,"ⳍ"],[11469,2],[11470,1,"ⳏ"],[11471,2],[11472,1,"ⳑ"],[11473,2],[11474,1,"ⳓ"],[11475,2],[11476,1,"ⳕ"],[11477,2],[11478,1,"ⳗ"],[11479,2],[11480,1,"ⳙ"],[11481,2],[11482,1,"ⳛ"],[11483,2],[11484,1,"ⳝ"],[11485,2],[11486,1,"ⳟ"],[11487,2],[11488,1,"ⳡ"],[11489,2],[11490,1,"ⳣ"],[[11491,11492],2],[[11493,11498],2],[11499,1,"ⳬ"],[11500,2],[11501,1,"ⳮ"],[[11502,11505],2],[11506,1,"ⳳ"],[11507,2],[[11508,11512],3],[[11513,11519],2],[[11520,11557],2],[11558,3],[11559,2],[[11560,11564],3],[11565,2],[[11566,11567],3],[[11568,11621],2],[[11622,11623],2],[[11624,11630],3],[11631,1,"ⵡ"],[11632,2],[[11633,11646],3],[11647,2],[[11648,11670],2],[[11671,11679],3],[[11680,11686],2],[11687,3],[[11688,11694],2],[11695,3],[[11696,11702],2],[11703,3],[[11704,11710],2],[11711,3],[[11712,11718],2],[11719,3],[[11720,11726],2],[11727,3],[[11728,11734],2],[11735,3],[[11736,11742],2],[11743,3],[[11744,11775],2],[[11776,11799],2],[[11800,11803],2],[[11804,11805],2],[[11806,11822],2],[11823,2],[11824,2],[11825,2],[[11826,11835],2],[[11836,11842],2],[[11843,11844],2],[[11845,11849],2],[[11850,11854],2],[11855,2],[[11856,11858],2],[[11859,11869],2],[[11870,11903],3],[[11904,11929],2],[11930,3],[[11931,11934],2],[11935,1,"母"],[[11936,12018],2],[12019,1,"龟"],[[12020,12031],3],[12032,1,"一"],[12033,1,"丨"],[12034,1,"丶"],[12035,1,"丿"],[12036,1,"乙"],[12037,1,"亅"],[12038,1,"二"],[12039,1,"亠"],[12040,1,"人"],[12041,1,"儿"],[12042,1,"入"],[12043,1,"八"],[12044,1,"冂"],[12045,1,"冖"],[12046,1,"冫"],[12047,1,"几"],[12048,1,"凵"],[12049,1,"刀"],[12050,1,"力"],[12051,1,"勹"],[12052,1,"匕"],[12053,1,"匚"],[12054,1,"匸"],[12055,1,"十"],[12056,1,"卜"],[12057,1,"卩"],[12058,1,"厂"],[12059,1,"厶"],[12060,1,"又"],[12061,1,"口"],[12062,1,"囗"],[12063,1,"土"],[12064,1,"士"],[12065,1,"夂"],[12066,1,"夊"],[12067,1,"夕"],[12068,1,"大"],[12069,1,"女"],[12070,1,"子"],[12071,1,"宀"],[12072,1,"寸"],[12073,1,"小"],[12074,1,"尢"],[12075,1,"尸"],[12076,1,"屮"],[12077,1,"山"],[12078,1,"巛"],[12079,1,"工"],[12080,1,"己"],[12081,1,"巾"],[12082,1,"干"],[12083,1,"幺"],[12084,1,"广"],[12085,1,"廴"],[12086,1,"廾"],[12087,1,"弋"],[12088,1,"弓"],[12089,1,"彐"],[12090,1,"彡"],[12091,1,"彳"],[12092,1,"心"],[12093,1,"戈"],[12094,1,"戶"],[12095,1,"手"],[12096,1,"支"],[12097,1,"攴"],[12098,1,"文"],[12099,1,"斗"],[12100,1,"斤"],[12101,1,"方"],[12102,1,"无"],[12103,1,"日"],[12104,1,"曰"],[12105,1,"月"],[12106,1,"木"],[12107,1,"欠"],[12108,1,"止"],[12109,1,"歹"],[12110,1,"殳"],[12111,1,"毋"],[12112,1,"比"],[12113,1,"毛"],[12114,1,"氏"],[12115,1,"气"],[12116,1,"水"],[12117,1,"火"],[12118,1,"爪"],[12119,1,"父"],[12120,1,"爻"],[12121,1,"爿"],[12122,1,"片"],[12123,1,"牙"],[12124,1,"牛"],[12125,1,"犬"],[12126,1,"玄"],[12127,1,"玉"],[12128,1,"瓜"],[12129,1,"瓦"],[12130,1,"甘"],[12131,1,"生"],[12132,1,"用"],[12133,1,"田"],[12134,1,"疋"],[12135,1,"疒"],[12136,1,"癶"],[12137,1,"白"],[12138,1,"皮"],[12139,1,"皿"],[12140,1,"目"],[12141,1,"矛"],[12142,1,"矢"],[12143,1,"石"],[12144,1,"示"],[12145,1,"禸"],[12146,1,"禾"],[12147,1,"穴"],[12148,1,"立"],[12149,1,"竹"],[12150,1,"米"],[12151,1,"糸"],[12152,1,"缶"],[12153,1,"网"],[12154,1,"羊"],[12155,1,"羽"],[12156,1,"老"],[12157,1,"而"],[12158,1,"耒"],[12159,1,"耳"],[12160,1,"聿"],[12161,1,"肉"],[12162,1,"臣"],[12163,1,"自"],[12164,1,"至"],[12165,1,"臼"],[12166,1,"舌"],[12167,1,"舛"],[12168,1,"舟"],[12169,1,"艮"],[12170,1,"色"],[12171,1,"艸"],[12172,1,"虍"],[12173,1,"虫"],[12174,1,"血"],[12175,1,"行"],[12176,1,"衣"],[12177,1,"襾"],[12178,1,"見"],[12179,1,"角"],[12180,1,"言"],[12181,1,"谷"],[12182,1,"豆"],[12183,1,"豕"],[12184,1,"豸"],[12185,1,"貝"],[12186,1,"赤"],[12187,1,"走"],[12188,1,"足"],[12189,1,"身"],[12190,1,"車"],[12191,1,"辛"],[12192,1,"辰"],[12193,1,"辵"],[12194,1,"邑"],[12195,1,"酉"],[12196,1,"釆"],[12197,1,"里"],[12198,1,"金"],[12199,1,"長"],[12200,1,"門"],[12201,1,"阜"],[12202,1,"隶"],[12203,1,"隹"],[12204,1,"雨"],[12205,1,"靑"],[12206,1,"非"],[12207,1,"面"],[12208,1,"革"],[12209,1,"韋"],[12210,1,"韭"],[12211,1,"音"],[12212,1,"頁"],[12213,1,"風"],[12214,1,"飛"],[12215,1,"食"],[12216,1,"首"],[12217,1,"香"],[12218,1,"馬"],[12219,1,"骨"],[12220,1,"高"],[12221,1,"髟"],[12222,1,"鬥"],[12223,1,"鬯"],[12224,1,"鬲"],[12225,1,"鬼"],[12226,1,"魚"],[12227,1,"鳥"],[12228,1,"鹵"],[12229,1,"鹿"],[12230,1,"麥"],[12231,1,"麻"],[12232,1,"黃"],[12233,1,"黍"],[12234,1,"黑"],[12235,1,"黹"],[12236,1,"黽"],[12237,1,"鼎"],[12238,1,"鼓"],[12239,1,"鼠"],[12240,1,"鼻"],[12241,1,"齊"],[12242,1,"齒"],[12243,1,"龍"],[12244,1,"龜"],[12245,1,"龠"],[[12246,12271],3],[[12272,12283],3],[[12284,12287],3],[12288,5," "],[12289,2],[12290,1,"."],[[12291,12292],2],[[12293,12295],2],[[12296,12329],2],[[12330,12333],2],[[12334,12341],2],[12342,1,"〒"],[12343,2],[12344,1,"十"],[12345,1,"卄"],[12346,1,"卅"],[12347,2],[12348,2],[12349,2],[12350,2],[12351,2],[12352,3],[[12353,12436],2],[[12437,12438],2],[[12439,12440],3],[[12441,12442],2],[12443,5," ゙"],[12444,5," ゚"],[[12445,12446],2],[12447,1,"より"],[12448,2],[[12449,12542],2],[12543,1,"コト"],[[12544,12548],3],[[12549,12588],2],[12589,2],[12590,2],[12591,2],[12592,3],[12593,1,"ᄀ"],[12594,1,"ᄁ"],[12595,1,"ᆪ"],[12596,1,"ᄂ"],[12597,1,"ᆬ"],[12598,1,"ᆭ"],[12599,1,"ᄃ"],[12600,1,"ᄄ"],[12601,1,"ᄅ"],[12602,1,"ᆰ"],[12603,1,"ᆱ"],[12604,1,"ᆲ"],[12605,1,"ᆳ"],[12606,1,"ᆴ"],[12607,1,"ᆵ"],[12608,1,"ᄚ"],[12609,1,"ᄆ"],[12610,1,"ᄇ"],[12611,1,"ᄈ"],[12612,1,"ᄡ"],[12613,1,"ᄉ"],[12614,1,"ᄊ"],[12615,1,"ᄋ"],[12616,1,"ᄌ"],[12617,1,"ᄍ"],[12618,1,"ᄎ"],[12619,1,"ᄏ"],[12620,1,"ᄐ"],[12621,1,"ᄑ"],[12622,1,"ᄒ"],[12623,1,"ᅡ"],[12624,1,"ᅢ"],[12625,1,"ᅣ"],[12626,1,"ᅤ"],[12627,1,"ᅥ"],[12628,1,"ᅦ"],[12629,1,"ᅧ"],[12630,1,"ᅨ"],[12631,1,"ᅩ"],[12632,1,"ᅪ"],[12633,1,"ᅫ"],[12634,1,"ᅬ"],[12635,1,"ᅭ"],[12636,1,"ᅮ"],[12637,1,"ᅯ"],[12638,1,"ᅰ"],[12639,1,"ᅱ"],[12640,1,"ᅲ"],[12641,1,"ᅳ"],[12642,1,"ᅴ"],[12643,1,"ᅵ"],[12644,3],[12645,1,"ᄔ"],[12646,1,"ᄕ"],[12647,1,"ᇇ"],[12648,1,"ᇈ"],[12649,1,"ᇌ"],[12650,1,"ᇎ"],[12651,1,"ᇓ"],[12652,1,"ᇗ"],[12653,1,"ᇙ"],[12654,1,"ᄜ"],[12655,1,"ᇝ"],[12656,1,"ᇟ"],[12657,1,"ᄝ"],[12658,1,"ᄞ"],[12659,1,"ᄠ"],[12660,1,"ᄢ"],[12661,1,"ᄣ"],[12662,1,"ᄧ"],[12663,1,"ᄩ"],[12664,1,"ᄫ"],[12665,1,"ᄬ"],[12666,1,"ᄭ"],[12667,1,"ᄮ"],[12668,1,"ᄯ"],[12669,1,"ᄲ"],[12670,1,"ᄶ"],[12671,1,"ᅀ"],[12672,1,"ᅇ"],[12673,1,"ᅌ"],[12674,1,"ᇱ"],[12675,1,"ᇲ"],[12676,1,"ᅗ"],[12677,1,"ᅘ"],[12678,1,"ᅙ"],[12679,1,"ᆄ"],[12680,1,"ᆅ"],[12681,1,"ᆈ"],[12682,1,"ᆑ"],[12683,1,"ᆒ"],[12684,1,"ᆔ"],[12685,1,"ᆞ"],[12686,1,"ᆡ"],[12687,3],[[12688,12689],2],[12690,1,"一"],[12691,1,"二"],[12692,1,"三"],[12693,1,"四"],[12694,1,"上"],[12695,1,"中"],[12696,1,"下"],[12697,1,"甲"],[12698,1,"乙"],[12699,1,"丙"],[12700,1,"丁"],[12701,1,"天"],[12702,1,"地"],[12703,1,"人"],[[12704,12727],2],[[12728,12730],2],[[12731,12735],2],[[12736,12751],2],[[12752,12771],2],[[12772,12783],3],[[12784,12799],2],[12800,5,"(ᄀ)"],[12801,5,"(ᄂ)"],[12802,5,"(ᄃ)"],[12803,5,"(ᄅ)"],[12804,5,"(ᄆ)"],[12805,5,"(ᄇ)"],[12806,5,"(ᄉ)"],[12807,5,"(ᄋ)"],[12808,5,"(ᄌ)"],[12809,5,"(ᄎ)"],[12810,5,"(ᄏ)"],[12811,5,"(ᄐ)"],[12812,5,"(ᄑ)"],[12813,5,"(ᄒ)"],[12814,5,"(가)"],[12815,5,"(나)"],[12816,5,"(다)"],[12817,5,"(라)"],[12818,5,"(마)"],[12819,5,"(바)"],[12820,5,"(사)"],[12821,5,"(아)"],[12822,5,"(자)"],[12823,5,"(차)"],[12824,5,"(카)"],[12825,5,"(타)"],[12826,5,"(파)"],[12827,5,"(하)"],[12828,5,"(주)"],[12829,5,"(오전)"],[12830,5,"(오후)"],[12831,3],[12832,5,"(一)"],[12833,5,"(二)"],[12834,5,"(三)"],[12835,5,"(四)"],[12836,5,"(五)"],[12837,5,"(六)"],[12838,5,"(七)"],[12839,5,"(八)"],[12840,5,"(九)"],[12841,5,"(十)"],[12842,5,"(月)"],[12843,5,"(火)"],[12844,5,"(水)"],[12845,5,"(木)"],[12846,5,"(金)"],[12847,5,"(土)"],[12848,5,"(日)"],[12849,5,"(株)"],[12850,5,"(有)"],[12851,5,"(社)"],[12852,5,"(名)"],[12853,5,"(特)"],[12854,5,"(財)"],[12855,5,"(祝)"],[12856,5,"(労)"],[12857,5,"(代)"],[12858,5,"(呼)"],[12859,5,"(学)"],[12860,5,"(監)"],[12861,5,"(企)"],[12862,5,"(資)"],[12863,5,"(協)"],[12864,5,"(祭)"],[12865,5,"(休)"],[12866,5,"(自)"],[12867,5,"(至)"],[12868,1,"問"],[12869,1,"幼"],[12870,1,"文"],[12871,1,"箏"],[[12872,12879],2],[12880,1,"pte"],[12881,1,"21"],[12882,1,"22"],[12883,1,"23"],[12884,1,"24"],[12885,1,"25"],[12886,1,"26"],[12887,1,"27"],[12888,1,"28"],[12889,1,"29"],[12890,1,"30"],[12891,1,"31"],[12892,1,"32"],[12893,1,"33"],[12894,1,"34"],[12895,1,"35"],[12896,1,"ᄀ"],[12897,1,"ᄂ"],[12898,1,"ᄃ"],[12899,1,"ᄅ"],[12900,1,"ᄆ"],[12901,1,"ᄇ"],[12902,1,"ᄉ"],[12903,1,"ᄋ"],[12904,1,"ᄌ"],[12905,1,"ᄎ"],[12906,1,"ᄏ"],[12907,1,"ᄐ"],[12908,1,"ᄑ"],[12909,1,"ᄒ"],[12910,1,"가"],[12911,1,"나"],[12912,1,"다"],[12913,1,"라"],[12914,1,"마"],[12915,1,"바"],[12916,1,"사"],[12917,1,"아"],[12918,1,"자"],[12919,1,"차"],[12920,1,"카"],[12921,1,"타"],[12922,1,"파"],[12923,1,"하"],[12924,1,"참고"],[12925,1,"주의"],[12926,1,"우"],[12927,2],[12928,1,"一"],[12929,1,"二"],[12930,1,"三"],[12931,1,"四"],[12932,1,"五"],[12933,1,"六"],[12934,1,"七"],[12935,1,"八"],[12936,1,"九"],[12937,1,"十"],[12938,1,"月"],[12939,1,"火"],[12940,1,"水"],[12941,1,"木"],[12942,1,"金"],[12943,1,"土"],[12944,1,"日"],[12945,1,"株"],[12946,1,"有"],[12947,1,"社"],[12948,1,"名"],[12949,1,"特"],[12950,1,"財"],[12951,1,"祝"],[12952,1,"労"],[12953,1,"秘"],[12954,1,"男"],[12955,1,"女"],[12956,1,"適"],[12957,1,"優"],[12958,1,"印"],[12959,1,"注"],[12960,1,"項"],[12961,1,"休"],[12962,1,"写"],[12963,1,"正"],[12964,1,"上"],[12965,1,"中"],[12966,1,"下"],[12967,1,"左"],[12968,1,"右"],[12969,1,"医"],[12970,1,"宗"],[12971,1,"学"],[12972,1,"監"],[12973,1,"企"],[12974,1,"資"],[12975,1,"協"],[12976,1,"夜"],[12977,1,"36"],[12978,1,"37"],[12979,1,"38"],[12980,1,"39"],[12981,1,"40"],[12982,1,"41"],[12983,1,"42"],[12984,1,"43"],[12985,1,"44"],[12986,1,"45"],[12987,1,"46"],[12988,1,"47"],[12989,1,"48"],[12990,1,"49"],[12991,1,"50"],[12992,1,"1月"],[12993,1,"2月"],[12994,1,"3月"],[12995,1,"4月"],[12996,1,"5月"],[12997,1,"6月"],[12998,1,"7月"],[12999,1,"8月"],[13000,1,"9月"],[13001,1,"10月"],[13002,1,"11月"],[13003,1,"12月"],[13004,1,"hg"],[13005,1,"erg"],[13006,1,"ev"],[13007,1,"ltd"],[13008,1,"ア"],[13009,1,"イ"],[13010,1,"ウ"],[13011,1,"エ"],[13012,1,"オ"],[13013,1,"カ"],[13014,1,"キ"],[13015,1,"ク"],[13016,1,"ケ"],[13017,1,"コ"],[13018,1,"サ"],[13019,1,"シ"],[13020,1,"ス"],[13021,1,"セ"],[13022,1,"ソ"],[13023,1,"タ"],[13024,1,"チ"],[13025,1,"ツ"],[13026,1,"テ"],[13027,1,"ト"],[13028,1,"ナ"],[13029,1,"ニ"],[13030,1,"ヌ"],[13031,1,"ネ"],[13032,1,"ノ"],[13033,1,"ハ"],[13034,1,"ヒ"],[13035,1,"フ"],[13036,1,"ヘ"],[13037,1,"ホ"],[13038,1,"マ"],[13039,1,"ミ"],[13040,1,"ム"],[13041,1,"メ"],[13042,1,"モ"],[13043,1,"ヤ"],[13044,1,"ユ"],[13045,1,"ヨ"],[13046,1,"ラ"],[13047,1,"リ"],[13048,1,"ル"],[13049,1,"レ"],[13050,1,"ロ"],[13051,1,"ワ"],[13052,1,"ヰ"],[13053,1,"ヱ"],[13054,1,"ヲ"],[13055,1,"令和"],[13056,1,"アパート"],[13057,1,"アルファ"],[13058,1,"アンペア"],[13059,1,"アール"],[13060,1,"イニング"],[13061,1,"インチ"],[13062,1,"ウォン"],[13063,1,"エスクード"],[13064,1,"エーカー"],[13065,1,"オンス"],[13066,1,"オーム"],[13067,1,"カイリ"],[13068,1,"カラット"],[13069,1,"カロリー"],[13070,1,"ガロン"],[13071,1,"ガンマ"],[13072,1,"ギガ"],[13073,1,"ギニー"],[13074,1,"キュリー"],[13075,1,"ギルダー"],[13076,1,"キロ"],[13077,1,"キログラム"],[13078,1,"キロメートル"],[13079,1,"キロワット"],[13080,1,"グラム"],[13081,1,"グラムトン"],[13082,1,"クルゼイロ"],[13083,1,"クローネ"],[13084,1,"ケース"],[13085,1,"コルナ"],[13086,1,"コーポ"],[13087,1,"サイクル"],[13088,1,"サンチーム"],[13089,1,"シリング"],[13090,1,"センチ"],[13091,1,"セント"],[13092,1,"ダース"],[13093,1,"デシ"],[13094,1,"ドル"],[13095,1,"トン"],[13096,1,"ナノ"],[13097,1,"ノット"],[13098,1,"ハイツ"],[13099,1,"パーセント"],[13100,1,"パーツ"],[13101,1,"バーレル"],[13102,1,"ピアストル"],[13103,1,"ピクル"],[13104,1,"ピコ"],[13105,1,"ビル"],[13106,1,"ファラッド"],[13107,1,"フィート"],[13108,1,"ブッシェル"],[13109,1,"フラン"],[13110,1,"ヘクタール"],[13111,1,"ペソ"],[13112,1,"ペニヒ"],[13113,1,"ヘルツ"],[13114,1,"ペンス"],[13115,1,"ページ"],[13116,1,"ベータ"],[13117,1,"ポイント"],[13118,1,"ボルト"],[13119,1,"ホン"],[13120,1,"ポンド"],[13121,1,"ホール"],[13122,1,"ホーン"],[13123,1,"マイクロ"],[13124,1,"マイル"],[13125,1,"マッハ"],[13126,1,"マルク"],[13127,1,"マンション"],[13128,1,"ミクロン"],[13129,1,"ミリ"],[13130,1,"ミリバール"],[13131,1,"メガ"],[13132,1,"メガトン"],[13133,1,"メートル"],[13134,1,"ヤード"],[13135,1,"ヤール"],[13136,1,"ユアン"],[13137,1,"リットル"],[13138,1,"リラ"],[13139,1,"ルピー"],[13140,1,"ルーブル"],[13141,1,"レム"],[13142,1,"レントゲン"],[13143,1,"ワット"],[13144,1,"0点"],[13145,1,"1点"],[13146,1,"2点"],[13147,1,"3点"],[13148,1,"4点"],[13149,1,"5点"],[13150,1,"6点"],[13151,1,"7点"],[13152,1,"8点"],[13153,1,"9点"],[13154,1,"10点"],[13155,1,"11点"],[13156,1,"12点"],[13157,1,"13点"],[13158,1,"14点"],[13159,1,"15点"],[13160,1,"16点"],[13161,1,"17点"],[13162,1,"18点"],[13163,1,"19点"],[13164,1,"20点"],[13165,1,"21点"],[13166,1,"22点"],[13167,1,"23点"],[13168,1,"24点"],[13169,1,"hpa"],[13170,1,"da"],[13171,1,"au"],[13172,1,"bar"],[13173,1,"ov"],[13174,1,"pc"],[13175,1,"dm"],[13176,1,"dm2"],[13177,1,"dm3"],[13178,1,"iu"],[13179,1,"平成"],[13180,1,"昭和"],[13181,1,"大正"],[13182,1,"明治"],[13183,1,"株式会社"],[13184,1,"pa"],[13185,1,"na"],[13186,1,"μa"],[13187,1,"ma"],[13188,1,"ka"],[13189,1,"kb"],[13190,1,"mb"],[13191,1,"gb"],[13192,1,"cal"],[13193,1,"kcal"],[13194,1,"pf"],[13195,1,"nf"],[13196,1,"μf"],[13197,1,"μg"],[13198,1,"mg"],[13199,1,"kg"],[13200,1,"hz"],[13201,1,"khz"],[13202,1,"mhz"],[13203,1,"ghz"],[13204,1,"thz"],[13205,1,"μl"],[13206,1,"ml"],[13207,1,"dl"],[13208,1,"kl"],[13209,1,"fm"],[13210,1,"nm"],[13211,1,"μm"],[13212,1,"mm"],[13213,1,"cm"],[13214,1,"km"],[13215,1,"mm2"],[13216,1,"cm2"],[13217,1,"m2"],[13218,1,"km2"],[13219,1,"mm3"],[13220,1,"cm3"],[13221,1,"m3"],[13222,1,"km3"],[13223,1,"m∕s"],[13224,1,"m∕s2"],[13225,1,"pa"],[13226,1,"kpa"],[13227,1,"mpa"],[13228,1,"gpa"],[13229,1,"rad"],[13230,1,"rad∕s"],[13231,1,"rad∕s2"],[13232,1,"ps"],[13233,1,"ns"],[13234,1,"μs"],[13235,1,"ms"],[13236,1,"pv"],[13237,1,"nv"],[13238,1,"μv"],[13239,1,"mv"],[13240,1,"kv"],[13241,1,"mv"],[13242,1,"pw"],[13243,1,"nw"],[13244,1,"μw"],[13245,1,"mw"],[13246,1,"kw"],[13247,1,"mw"],[13248,1,"kω"],[13249,1,"mω"],[13250,3],[13251,1,"bq"],[13252,1,"cc"],[13253,1,"cd"],[13254,1,"c∕kg"],[13255,3],[13256,1,"db"],[13257,1,"gy"],[13258,1,"ha"],[13259,1,"hp"],[13260,1,"in"],[13261,1,"kk"],[13262,1,"km"],[13263,1,"kt"],[13264,1,"lm"],[13265,1,"ln"],[13266,1,"log"],[13267,1,"lx"],[13268,1,"mb"],[13269,1,"mil"],[13270,1,"mol"],[13271,1,"ph"],[13272,3],[13273,1,"ppm"],[13274,1,"pr"],[13275,1,"sr"],[13276,1,"sv"],[13277,1,"wb"],[13278,1,"v∕m"],[13279,1,"a∕m"],[13280,1,"1日"],[13281,1,"2日"],[13282,1,"3日"],[13283,1,"4日"],[13284,1,"5日"],[13285,1,"6日"],[13286,1,"7日"],[13287,1,"8日"],[13288,1,"9日"],[13289,1,"10日"],[13290,1,"11日"],[13291,1,"12日"],[13292,1,"13日"],[13293,1,"14日"],[13294,1,"15日"],[13295,1,"16日"],[13296,1,"17日"],[13297,1,"18日"],[13298,1,"19日"],[13299,1,"20日"],[13300,1,"21日"],[13301,1,"22日"],[13302,1,"23日"],[13303,1,"24日"],[13304,1,"25日"],[13305,1,"26日"],[13306,1,"27日"],[13307,1,"28日"],[13308,1,"29日"],[13309,1,"30日"],[13310,1,"31日"],[13311,1,"gal"],[[13312,19893],2],[[19894,19903],2],[[19904,19967],2],[[19968,40869],2],[[40870,40891],2],[[40892,40899],2],[[40900,40907],2],[40908,2],[[40909,40917],2],[[40918,40938],2],[[40939,40943],2],[[40944,40956],2],[[40957,40959],2],[[40960,42124],2],[[42125,42127],3],[[42128,42145],2],[[42146,42147],2],[[42148,42163],2],[42164,2],[[42165,42176],2],[42177,2],[[42178,42180],2],[42181,2],[42182,2],[[42183,42191],3],[[42192,42237],2],[[42238,42239],2],[[42240,42508],2],[[42509,42511],2],[[42512,42539],2],[[42540,42559],3],[42560,1,"ꙁ"],[42561,2],[42562,1,"ꙃ"],[42563,2],[42564,1,"ꙅ"],[42565,2],[42566,1,"ꙇ"],[42567,2],[42568,1,"ꙉ"],[42569,2],[42570,1,"ꙋ"],[42571,2],[42572,1,"ꙍ"],[42573,2],[42574,1,"ꙏ"],[42575,2],[42576,1,"ꙑ"],[42577,2],[42578,1,"ꙓ"],[42579,2],[42580,1,"ꙕ"],[42581,2],[42582,1,"ꙗ"],[42583,2],[42584,1,"ꙙ"],[42585,2],[42586,1,"ꙛ"],[42587,2],[42588,1,"ꙝ"],[42589,2],[42590,1,"ꙟ"],[42591,2],[42592,1,"ꙡ"],[42593,2],[42594,1,"ꙣ"],[42595,2],[42596,1,"ꙥ"],[42597,2],[42598,1,"ꙧ"],[42599,2],[42600,1,"ꙩ"],[42601,2],[42602,1,"ꙫ"],[42603,2],[42604,1,"ꙭ"],[[42605,42607],2],[[42608,42611],2],[[42612,42619],2],[[42620,42621],2],[42622,2],[42623,2],[42624,1,"ꚁ"],[42625,2],[42626,1,"ꚃ"],[42627,2],[42628,1,"ꚅ"],[42629,2],[42630,1,"ꚇ"],[42631,2],[42632,1,"ꚉ"],[42633,2],[42634,1,"ꚋ"],[42635,2],[42636,1,"ꚍ"],[42637,2],[42638,1,"ꚏ"],[42639,2],[42640,1,"ꚑ"],[42641,2],[42642,1,"ꚓ"],[42643,2],[42644,1,"ꚕ"],[42645,2],[42646,1,"ꚗ"],[42647,2],[42648,1,"ꚙ"],[42649,2],[42650,1,"ꚛ"],[42651,2],[42652,1,"ъ"],[42653,1,"ь"],[42654,2],[42655,2],[[42656,42725],2],[[42726,42735],2],[[42736,42737],2],[[42738,42743],2],[[42744,42751],3],[[42752,42774],2],[[42775,42778],2],[[42779,42783],2],[[42784,42785],2],[42786,1,"ꜣ"],[42787,2],[42788,1,"ꜥ"],[42789,2],[42790,1,"ꜧ"],[42791,2],[42792,1,"ꜩ"],[42793,2],[42794,1,"ꜫ"],[42795,2],[42796,1,"ꜭ"],[42797,2],[42798,1,"ꜯ"],[[42799,42801],2],[42802,1,"ꜳ"],[42803,2],[42804,1,"ꜵ"],[42805,2],[42806,1,"ꜷ"],[42807,2],[42808,1,"ꜹ"],[42809,2],[42810,1,"ꜻ"],[42811,2],[42812,1,"ꜽ"],[42813,2],[42814,1,"ꜿ"],[42815,2],[42816,1,"ꝁ"],[42817,2],[42818,1,"ꝃ"],[42819,2],[42820,1,"ꝅ"],[42821,2],[42822,1,"ꝇ"],[42823,2],[42824,1,"ꝉ"],[42825,2],[42826,1,"ꝋ"],[42827,2],[42828,1,"ꝍ"],[42829,2],[42830,1,"ꝏ"],[42831,2],[42832,1,"ꝑ"],[42833,2],[42834,1,"ꝓ"],[42835,2],[42836,1,"ꝕ"],[42837,2],[42838,1,"ꝗ"],[42839,2],[42840,1,"ꝙ"],[42841,2],[42842,1,"ꝛ"],[42843,2],[42844,1,"ꝝ"],[42845,2],[42846,1,"ꝟ"],[42847,2],[42848,1,"ꝡ"],[42849,2],[42850,1,"ꝣ"],[42851,2],[42852,1,"ꝥ"],[42853,2],[42854,1,"ꝧ"],[42855,2],[42856,1,"ꝩ"],[42857,2],[42858,1,"ꝫ"],[42859,2],[42860,1,"ꝭ"],[42861,2],[42862,1,"ꝯ"],[42863,2],[42864,1,"ꝯ"],[[42865,42872],2],[42873,1,"ꝺ"],[42874,2],[42875,1,"ꝼ"],[42876,2],[42877,1,"ᵹ"],[42878,1,"ꝿ"],[42879,2],[42880,1,"ꞁ"],[42881,2],[42882,1,"ꞃ"],[42883,2],[42884,1,"ꞅ"],[42885,2],[42886,1,"ꞇ"],[[42887,42888],2],[[42889,42890],2],[42891,1,"ꞌ"],[42892,2],[42893,1,"ɥ"],[42894,2],[42895,2],[42896,1,"ꞑ"],[42897,2],[42898,1,"ꞓ"],[42899,2],[[42900,42901],2],[42902,1,"ꞗ"],[42903,2],[42904,1,"ꞙ"],[42905,2],[42906,1,"ꞛ"],[42907,2],[42908,1,"ꞝ"],[42909,2],[42910,1,"ꞟ"],[42911,2],[42912,1,"ꞡ"],[42913,2],[42914,1,"ꞣ"],[42915,2],[42916,1,"ꞥ"],[42917,2],[42918,1,"ꞧ"],[42919,2],[42920,1,"ꞩ"],[42921,2],[42922,1,"ɦ"],[42923,1,"ɜ"],[42924,1,"ɡ"],[42925,1,"ɬ"],[42926,1,"ɪ"],[42927,2],[42928,1,"ʞ"],[42929,1,"ʇ"],[42930,1,"ʝ"],[42931,1,"ꭓ"],[42932,1,"ꞵ"],[42933,2],[42934,1,"ꞷ"],[42935,2],[42936,1,"ꞹ"],[42937,2],[42938,1,"ꞻ"],[42939,2],[42940,1,"ꞽ"],[42941,2],[42942,1,"ꞿ"],[42943,2],[42944,1,"ꟁ"],[42945,2],[42946,1,"ꟃ"],[42947,2],[42948,1,"ꞔ"],[42949,1,"ʂ"],[42950,1,"ᶎ"],[42951,1,"ꟈ"],[42952,2],[42953,1,"ꟊ"],[42954,2],[[42955,42959],3],[42960,1,"ꟑ"],[42961,2],[42962,3],[42963,2],[42964,3],[42965,2],[42966,1,"ꟗ"],[42967,2],[42968,1,"ꟙ"],[42969,2],[[42970,42993],3],[42994,1,"c"],[42995,1,"f"],[42996,1,"q"],[42997,1,"ꟶ"],[42998,2],[42999,2],[43000,1,"ħ"],[43001,1,"œ"],[43002,2],[[43003,43007],2],[[43008,43047],2],[[43048,43051],2],[43052,2],[[43053,43055],3],[[43056,43065],2],[[43066,43071],3],[[43072,43123],2],[[43124,43127],2],[[43128,43135],3],[[43136,43204],2],[43205,2],[[43206,43213],3],[[43214,43215],2],[[43216,43225],2],[[43226,43231],3],[[43232,43255],2],[[43256,43258],2],[43259,2],[43260,2],[43261,2],[[43262,43263],2],[[43264,43309],2],[[43310,43311],2],[[43312,43347],2],[[43348,43358],3],[43359,2],[[43360,43388],2],[[43389,43391],3],[[43392,43456],2],[[43457,43469],2],[43470,3],[[43471,43481],2],[[43482,43485],3],[[43486,43487],2],[[43488,43518],2],[43519,3],[[43520,43574],2],[[43575,43583],3],[[43584,43597],2],[[43598,43599],3],[[43600,43609],2],[[43610,43611],3],[[43612,43615],2],[[43616,43638],2],[[43639,43641],2],[[43642,43643],2],[[43644,43647],2],[[43648,43714],2],[[43715,43738],3],[[43739,43741],2],[[43742,43743],2],[[43744,43759],2],[[43760,43761],2],[[43762,43766],2],[[43767,43776],3],[[43777,43782],2],[[43783,43784],3],[[43785,43790],2],[[43791,43792],3],[[43793,43798],2],[[43799,43807],3],[[43808,43814],2],[43815,3],[[43816,43822],2],[43823,3],[[43824,43866],2],[43867,2],[43868,1,"ꜧ"],[43869,1,"ꬷ"],[43870,1,"ɫ"],[43871,1,"ꭒ"],[[43872,43875],2],[[43876,43877],2],[[43878,43879],2],[43880,2],[43881,1,"ʍ"],[[43882,43883],2],[[43884,43887],3],[43888,1,"Ꭰ"],[43889,1,"Ꭱ"],[43890,1,"Ꭲ"],[43891,1,"Ꭳ"],[43892,1,"Ꭴ"],[43893,1,"Ꭵ"],[43894,1,"Ꭶ"],[43895,1,"Ꭷ"],[43896,1,"Ꭸ"],[43897,1,"Ꭹ"],[43898,1,"Ꭺ"],[43899,1,"Ꭻ"],[43900,1,"Ꭼ"],[43901,1,"Ꭽ"],[43902,1,"Ꭾ"],[43903,1,"Ꭿ"],[43904,1,"Ꮀ"],[43905,1,"Ꮁ"],[43906,1,"Ꮂ"],[43907,1,"Ꮃ"],[43908,1,"Ꮄ"],[43909,1,"Ꮅ"],[43910,1,"Ꮆ"],[43911,1,"Ꮇ"],[43912,1,"Ꮈ"],[43913,1,"Ꮉ"],[43914,1,"Ꮊ"],[43915,1,"Ꮋ"],[43916,1,"Ꮌ"],[43917,1,"Ꮍ"],[43918,1,"Ꮎ"],[43919,1,"Ꮏ"],[43920,1,"Ꮐ"],[43921,1,"Ꮑ"],[43922,1,"Ꮒ"],[43923,1,"Ꮓ"],[43924,1,"Ꮔ"],[43925,1,"Ꮕ"],[43926,1,"Ꮖ"],[43927,1,"Ꮗ"],[43928,1,"Ꮘ"],[43929,1,"Ꮙ"],[43930,1,"Ꮚ"],[43931,1,"Ꮛ"],[43932,1,"Ꮜ"],[43933,1,"Ꮝ"],[43934,1,"Ꮞ"],[43935,1,"Ꮟ"],[43936,1,"Ꮠ"],[43937,1,"Ꮡ"],[43938,1,"Ꮢ"],[43939,1,"Ꮣ"],[43940,1,"Ꮤ"],[43941,1,"Ꮥ"],[43942,1,"Ꮦ"],[43943,1,"Ꮧ"],[43944,1,"Ꮨ"],[43945,1,"Ꮩ"],[43946,1,"Ꮪ"],[43947,1,"Ꮫ"],[43948,1,"Ꮬ"],[43949,1,"Ꮭ"],[43950,1,"Ꮮ"],[43951,1,"Ꮯ"],[43952,1,"Ꮰ"],[43953,1,"Ꮱ"],[43954,1,"Ꮲ"],[43955,1,"Ꮳ"],[43956,1,"Ꮴ"],[43957,1,"Ꮵ"],[43958,1,"Ꮶ"],[43959,1,"Ꮷ"],[43960,1,"Ꮸ"],[43961,1,"Ꮹ"],[43962,1,"Ꮺ"],[43963,1,"Ꮻ"],[43964,1,"Ꮼ"],[43965,1,"Ꮽ"],[43966,1,"Ꮾ"],[43967,1,"Ꮿ"],[[43968,44010],2],[44011,2],[[44012,44013],2],[[44014,44015],3],[[44016,44025],2],[[44026,44031],3],[[44032,55203],2],[[55204,55215],3],[[55216,55238],2],[[55239,55242],3],[[55243,55291],2],[[55292,55295],3],[[55296,57343],3],[[57344,63743],3],[63744,1,"豈"],[63745,1,"更"],[63746,1,"車"],[63747,1,"賈"],[63748,1,"滑"],[63749,1,"串"],[63750,1,"句"],[[63751,63752],1,"龜"],[63753,1,"契"],[63754,1,"金"],[63755,1,"喇"],[63756,1,"奈"],[63757,1,"懶"],[63758,1,"癩"],[63759,1,"羅"],[63760,1,"蘿"],[63761,1,"螺"],[63762,1,"裸"],[63763,1,"邏"],[63764,1,"樂"],[63765,1,"洛"],[63766,1,"烙"],[63767,1,"珞"],[63768,1,"落"],[63769,1,"酪"],[63770,1,"駱"],[63771,1,"亂"],[63772,1,"卵"],[63773,1,"欄"],[63774,1,"爛"],[63775,1,"蘭"],[63776,1,"鸞"],[63777,1,"嵐"],[63778,1,"濫"],[63779,1,"藍"],[63780,1,"襤"],[63781,1,"拉"],[63782,1,"臘"],[63783,1,"蠟"],[63784,1,"廊"],[63785,1,"朗"],[63786,1,"浪"],[63787,1,"狼"],[63788,1,"郎"],[63789,1,"來"],[63790,1,"冷"],[63791,1,"勞"],[63792,1,"擄"],[63793,1,"櫓"],[63794,1,"爐"],[63795,1,"盧"],[63796,1,"老"],[63797,1,"蘆"],[63798,1,"虜"],[63799,1,"路"],[63800,1,"露"],[63801,1,"魯"],[63802,1,"鷺"],[63803,1,"碌"],[63804,1,"祿"],[63805,1,"綠"],[63806,1,"菉"],[63807,1,"錄"],[63808,1,"鹿"],[63809,1,"論"],[63810,1,"壟"],[63811,1,"弄"],[63812,1,"籠"],[63813,1,"聾"],[63814,1,"牢"],[63815,1,"磊"],[63816,1,"賂"],[63817,1,"雷"],[63818,1,"壘"],[63819,1,"屢"],[63820,1,"樓"],[63821,1,"淚"],[63822,1,"漏"],[63823,1,"累"],[63824,1,"縷"],[63825,1,"陋"],[63826,1,"勒"],[63827,1,"肋"],[63828,1,"凜"],[63829,1,"凌"],[63830,1,"稜"],[63831,1,"綾"],[63832,1,"菱"],[63833,1,"陵"],[63834,1,"讀"],[63835,1,"拏"],[63836,1,"樂"],[63837,1,"諾"],[63838,1,"丹"],[63839,1,"寧"],[63840,1,"怒"],[63841,1,"率"],[63842,1,"異"],[63843,1,"北"],[63844,1,"磻"],[63845,1,"便"],[63846,1,"復"],[63847,1,"不"],[63848,1,"泌"],[63849,1,"數"],[63850,1,"索"],[63851,1,"參"],[63852,1,"塞"],[63853,1,"省"],[63854,1,"葉"],[63855,1,"說"],[63856,1,"殺"],[63857,1,"辰"],[63858,1,"沈"],[63859,1,"拾"],[63860,1,"若"],[63861,1,"掠"],[63862,1,"略"],[63863,1,"亮"],[63864,1,"兩"],[63865,1,"凉"],[63866,1,"梁"],[63867,1,"糧"],[63868,1,"良"],[63869,1,"諒"],[63870,1,"量"],[63871,1,"勵"],[63872,1,"呂"],[63873,1,"女"],[63874,1,"廬"],[63875,1,"旅"],[63876,1,"濾"],[63877,1,"礪"],[63878,1,"閭"],[63879,1,"驪"],[63880,1,"麗"],[63881,1,"黎"],[63882,1,"力"],[63883,1,"曆"],[63884,1,"歷"],[63885,1,"轢"],[63886,1,"年"],[63887,1,"憐"],[63888,1,"戀"],[63889,1,"撚"],[63890,1,"漣"],[63891,1,"煉"],[63892,1,"璉"],[63893,1,"秊"],[63894,1,"練"],[63895,1,"聯"],[63896,1,"輦"],[63897,1,"蓮"],[63898,1,"連"],[63899,1,"鍊"],[63900,1,"列"],[63901,1,"劣"],[63902,1,"咽"],[63903,1,"烈"],[63904,1,"裂"],[63905,1,"說"],[63906,1,"廉"],[63907,1,"念"],[63908,1,"捻"],[63909,1,"殮"],[63910,1,"簾"],[63911,1,"獵"],[63912,1,"令"],[63913,1,"囹"],[63914,1,"寧"],[63915,1,"嶺"],[63916,1,"怜"],[63917,1,"玲"],[63918,1,"瑩"],[63919,1,"羚"],[63920,1,"聆"],[63921,1,"鈴"],[63922,1,"零"],[63923,1,"靈"],[63924,1,"領"],[63925,1,"例"],[63926,1,"禮"],[63927,1,"醴"],[63928,1,"隸"],[63929,1,"惡"],[63930,1,"了"],[63931,1,"僚"],[63932,1,"寮"],[63933,1,"尿"],[63934,1,"料"],[63935,1,"樂"],[63936,1,"燎"],[63937,1,"療"],[63938,1,"蓼"],[63939,1,"遼"],[63940,1,"龍"],[63941,1,"暈"],[63942,1,"阮"],[63943,1,"劉"],[63944,1,"杻"],[63945,1,"柳"],[63946,1,"流"],[63947,1,"溜"],[63948,1,"琉"],[63949,1,"留"],[63950,1,"硫"],[63951,1,"紐"],[63952,1,"類"],[63953,1,"六"],[63954,1,"戮"],[63955,1,"陸"],[63956,1,"倫"],[63957,1,"崙"],[63958,1,"淪"],[63959,1,"輪"],[63960,1,"律"],[63961,1,"慄"],[63962,1,"栗"],[63963,1,"率"],[63964,1,"隆"],[63965,1,"利"],[63966,1,"吏"],[63967,1,"履"],[63968,1,"易"],[63969,1,"李"],[63970,1,"梨"],[63971,1,"泥"],[63972,1,"理"],[63973,1,"痢"],[63974,1,"罹"],[63975,1,"裏"],[63976,1,"裡"],[63977,1,"里"],[63978,1,"離"],[63979,1,"匿"],[63980,1,"溺"],[63981,1,"吝"],[63982,1,"燐"],[63983,1,"璘"],[63984,1,"藺"],[63985,1,"隣"],[63986,1,"鱗"],[63987,1,"麟"],[63988,1,"林"],[63989,1,"淋"],[63990,1,"臨"],[63991,1,"立"],[63992,1,"笠"],[63993,1,"粒"],[63994,1,"狀"],[63995,1,"炙"],[63996,1,"識"],[63997,1,"什"],[63998,1,"茶"],[63999,1,"刺"],[64000,1,"切"],[64001,1,"度"],[64002,1,"拓"],[64003,1,"糖"],[64004,1,"宅"],[64005,1,"洞"],[64006,1,"暴"],[64007,1,"輻"],[64008,1,"行"],[64009,1,"降"],[64010,1,"見"],[64011,1,"廓"],[64012,1,"兀"],[64013,1,"嗀"],[[64014,64015],2],[64016,1,"塚"],[64017,2],[64018,1,"晴"],[[64019,64020],2],[64021,1,"凞"],[64022,1,"猪"],[64023,1,"益"],[64024,1,"礼"],[64025,1,"神"],[64026,1,"祥"],[64027,1,"福"],[64028,1,"靖"],[64029,1,"精"],[64030,1,"羽"],[64031,2],[64032,1,"蘒"],[64033,2],[64034,1,"諸"],[[64035,64036],2],[64037,1,"逸"],[64038,1,"都"],[[64039,64041],2],[64042,1,"飯"],[64043,1,"飼"],[64044,1,"館"],[64045,1,"鶴"],[64046,1,"郞"],[64047,1,"隷"],[64048,1,"侮"],[64049,1,"僧"],[64050,1,"免"],[64051,1,"勉"],[64052,1,"勤"],[64053,1,"卑"],[64054,1,"喝"],[64055,1,"嘆"],[64056,1,"器"],[64057,1,"塀"],[64058,1,"墨"],[64059,1,"層"],[64060,1,"屮"],[64061,1,"悔"],[64062,1,"慨"],[64063,1,"憎"],[64064,1,"懲"],[64065,1,"敏"],[64066,1,"既"],[64067,1,"暑"],[64068,1,"梅"],[64069,1,"海"],[64070,1,"渚"],[64071,1,"漢"],[64072,1,"煮"],[64073,1,"爫"],[64074,1,"琢"],[64075,1,"碑"],[64076,1,"社"],[64077,1,"祉"],[64078,1,"祈"],[64079,1,"祐"],[64080,1,"祖"],[64081,1,"祝"],[64082,1,"禍"],[64083,1,"禎"],[64084,1,"穀"],[64085,1,"突"],[64086,1,"節"],[64087,1,"練"],[64088,1,"縉"],[64089,1,"繁"],[64090,1,"署"],[64091,1,"者"],[64092,1,"臭"],[[64093,64094],1,"艹"],[64095,1,"著"],[64096,1,"褐"],[64097,1,"視"],[64098,1,"謁"],[64099,1,"謹"],[64100,1,"賓"],[64101,1,"贈"],[64102,1,"辶"],[64103,1,"逸"],[64104,1,"難"],[64105,1,"響"],[64106,1,"頻"],[64107,1,"恵"],[64108,1,"𤋮"],[64109,1,"舘"],[[64110,64111],3],[64112,1,"並"],[64113,1,"况"],[64114,1,"全"],[64115,1,"侀"],[64116,1,"充"],[64117,1,"冀"],[64118,1,"勇"],[64119,1,"勺"],[64120,1,"喝"],[64121,1,"啕"],[64122,1,"喙"],[64123,1,"嗢"],[64124,1,"塚"],[64125,1,"墳"],[64126,1,"奄"],[64127,1,"奔"],[64128,1,"婢"],[64129,1,"嬨"],[64130,1,"廒"],[64131,1,"廙"],[64132,1,"彩"],[64133,1,"徭"],[64134,1,"惘"],[64135,1,"慎"],[64136,1,"愈"],[64137,1,"憎"],[64138,1,"慠"],[64139,1,"懲"],[64140,1,"戴"],[64141,1,"揄"],[64142,1,"搜"],[64143,1,"摒"],[64144,1,"敖"],[64145,1,"晴"],[64146,1,"朗"],[64147,1,"望"],[64148,1,"杖"],[64149,1,"歹"],[64150,1,"殺"],[64151,1,"流"],[64152,1,"滛"],[64153,1,"滋"],[64154,1,"漢"],[64155,1,"瀞"],[64156,1,"煮"],[64157,1,"瞧"],[64158,1,"爵"],[64159,1,"犯"],[64160,1,"猪"],[64161,1,"瑱"],[64162,1,"甆"],[64163,1,"画"],[64164,1,"瘝"],[64165,1,"瘟"],[64166,1,"益"],[64167,1,"盛"],[64168,1,"直"],[64169,1,"睊"],[64170,1,"着"],[64171,1,"磌"],[64172,1,"窱"],[64173,1,"節"],[64174,1,"类"],[64175,1,"絛"],[64176,1,"練"],[64177,1,"缾"],[64178,1,"者"],[64179,1,"荒"],[64180,1,"華"],[64181,1,"蝹"],[64182,1,"襁"],[64183,1,"覆"],[64184,1,"視"],[64185,1,"調"],[64186,1,"諸"],[64187,1,"請"],[64188,1,"謁"],[64189,1,"諾"],[64190,1,"諭"],[64191,1,"謹"],[64192,1,"變"],[64193,1,"贈"],[64194,1,"輸"],[64195,1,"遲"],[64196,1,"醙"],[64197,1,"鉶"],[64198,1,"陼"],[64199,1,"難"],[64200,1,"靖"],[64201,1,"韛"],[64202,1,"響"],[64203,1,"頋"],[64204,1,"頻"],[64205,1,"鬒"],[64206,1,"龜"],[64207,1,"𢡊"],[64208,1,"𢡄"],[64209,1,"𣏕"],[64210,1,"㮝"],[64211,1,"䀘"],[64212,1,"䀹"],[64213,1,"𥉉"],[64214,1,"𥳐"],[64215,1,"𧻓"],[64216,1,"齃"],[64217,1,"龎"],[[64218,64255],3],[64256,1,"ff"],[64257,1,"fi"],[64258,1,"fl"],[64259,1,"ffi"],[64260,1,"ffl"],[[64261,64262],1,"st"],[[64263,64274],3],[64275,1,"մն"],[64276,1,"մե"],[64277,1,"մի"],[64278,1,"վն"],[64279,1,"մխ"],[[64280,64284],3],[64285,1,"יִ"],[64286,2],[64287,1,"ײַ"],[64288,1,"ע"],[64289,1,"א"],[64290,1,"ד"],[64291,1,"ה"],[64292,1,"כ"],[64293,1,"ל"],[64294,1,"ם"],[64295,1,"ר"],[64296,1,"ת"],[64297,5,"+"],[64298,1,"שׁ"],[64299,1,"שׂ"],[64300,1,"שּׁ"],[64301,1,"שּׂ"],[64302,1,"אַ"],[64303,1,"אָ"],[64304,1,"אּ"],[64305,1,"בּ"],[64306,1,"גּ"],[64307,1,"דּ"],[64308,1,"הּ"],[64309,1,"וּ"],[64310,1,"זּ"],[64311,3],[64312,1,"טּ"],[64313,1,"יּ"],[64314,1,"ךּ"],[64315,1,"כּ"],[64316,1,"לּ"],[64317,3],[64318,1,"מּ"],[64319,3],[64320,1,"נּ"],[64321,1,"סּ"],[64322,3],[64323,1,"ףּ"],[64324,1,"פּ"],[64325,3],[64326,1,"צּ"],[64327,1,"קּ"],[64328,1,"רּ"],[64329,1,"שּ"],[64330,1,"תּ"],[64331,1,"וֹ"],[64332,1,"בֿ"],[64333,1,"כֿ"],[64334,1,"פֿ"],[64335,1,"אל"],[[64336,64337],1,"ٱ"],[[64338,64341],1,"ٻ"],[[64342,64345],1,"پ"],[[64346,64349],1,"ڀ"],[[64350,64353],1,"ٺ"],[[64354,64357],1,"ٿ"],[[64358,64361],1,"ٹ"],[[64362,64365],1,"ڤ"],[[64366,64369],1,"ڦ"],[[64370,64373],1,"ڄ"],[[64374,64377],1,"ڃ"],[[64378,64381],1,"چ"],[[64382,64385],1,"ڇ"],[[64386,64387],1,"ڍ"],[[64388,64389],1,"ڌ"],[[64390,64391],1,"ڎ"],[[64392,64393],1,"ڈ"],[[64394,64395],1,"ژ"],[[64396,64397],1,"ڑ"],[[64398,64401],1,"ک"],[[64402,64405],1,"گ"],[[64406,64409],1,"ڳ"],[[64410,64413],1,"ڱ"],[[64414,64415],1,"ں"],[[64416,64419],1,"ڻ"],[[64420,64421],1,"ۀ"],[[64422,64425],1,"ہ"],[[64426,64429],1,"ھ"],[[64430,64431],1,"ے"],[[64432,64433],1,"ۓ"],[[64434,64449],2],[64450,2],[[64451,64466],3],[[64467,64470],1,"ڭ"],[[64471,64472],1,"ۇ"],[[64473,64474],1,"ۆ"],[[64475,64476],1,"ۈ"],[64477,1,"ۇٴ"],[[64478,64479],1,"ۋ"],[[64480,64481],1,"ۅ"],[[64482,64483],1,"ۉ"],[[64484,64487],1,"ې"],[[64488,64489],1,"ى"],[[64490,64491],1,"ئا"],[[64492,64493],1,"ئە"],[[64494,64495],1,"ئو"],[[64496,64497],1,"ئۇ"],[[64498,64499],1,"ئۆ"],[[64500,64501],1,"ئۈ"],[[64502,64504],1,"ئې"],[[64505,64507],1,"ئى"],[[64508,64511],1,"ی"],[64512,1,"ئج"],[64513,1,"ئح"],[64514,1,"ئم"],[64515,1,"ئى"],[64516,1,"ئي"],[64517,1,"بج"],[64518,1,"بح"],[64519,1,"بخ"],[64520,1,"بم"],[64521,1,"بى"],[64522,1,"بي"],[64523,1,"تج"],[64524,1,"تح"],[64525,1,"تخ"],[64526,1,"تم"],[64527,1,"تى"],[64528,1,"تي"],[64529,1,"ثج"],[64530,1,"ثم"],[64531,1,"ثى"],[64532,1,"ثي"],[64533,1,"جح"],[64534,1,"جم"],[64535,1,"حج"],[64536,1,"حم"],[64537,1,"خج"],[64538,1,"خح"],[64539,1,"خم"],[64540,1,"سج"],[64541,1,"سح"],[64542,1,"سخ"],[64543,1,"سم"],[64544,1,"صح"],[64545,1,"صم"],[64546,1,"ضج"],[64547,1,"ضح"],[64548,1,"ضخ"],[64549,1,"ضم"],[64550,1,"طح"],[64551,1,"طم"],[64552,1,"ظم"],[64553,1,"عج"],[64554,1,"عم"],[64555,1,"غج"],[64556,1,"غم"],[64557,1,"فج"],[64558,1,"فح"],[64559,1,"فخ"],[64560,1,"فم"],[64561,1,"فى"],[64562,1,"في"],[64563,1,"قح"],[64564,1,"قم"],[64565,1,"قى"],[64566,1,"قي"],[64567,1,"كا"],[64568,1,"كج"],[64569,1,"كح"],[64570,1,"كخ"],[64571,1,"كل"],[64572,1,"كم"],[64573,1,"كى"],[64574,1,"كي"],[64575,1,"لج"],[64576,1,"لح"],[64577,1,"لخ"],[64578,1,"لم"],[64579,1,"لى"],[64580,1,"لي"],[64581,1,"مج"],[64582,1,"مح"],[64583,1,"مخ"],[64584,1,"مم"],[64585,1,"مى"],[64586,1,"مي"],[64587,1,"نج"],[64588,1,"نح"],[64589,1,"نخ"],[64590,1,"نم"],[64591,1,"نى"],[64592,1,"ني"],[64593,1,"هج"],[64594,1,"هم"],[64595,1,"هى"],[64596,1,"هي"],[64597,1,"يج"],[64598,1,"يح"],[64599,1,"يخ"],[64600,1,"يم"],[64601,1,"يى"],[64602,1,"يي"],[64603,1,"ذٰ"],[64604,1,"رٰ"],[64605,1,"ىٰ"],[64606,5," ٌّ"],[64607,5," ٍّ"],[64608,5," َّ"],[64609,5," ُّ"],[64610,5," ِّ"],[64611,5," ّٰ"],[64612,1,"ئر"],[64613,1,"ئز"],[64614,1,"ئم"],[64615,1,"ئن"],[64616,1,"ئى"],[64617,1,"ئي"],[64618,1,"بر"],[64619,1,"بز"],[64620,1,"بم"],[64621,1,"بن"],[64622,1,"بى"],[64623,1,"بي"],[64624,1,"تر"],[64625,1,"تز"],[64626,1,"تم"],[64627,1,"تن"],[64628,1,"تى"],[64629,1,"تي"],[64630,1,"ثر"],[64631,1,"ثز"],[64632,1,"ثم"],[64633,1,"ثن"],[64634,1,"ثى"],[64635,1,"ثي"],[64636,1,"فى"],[64637,1,"في"],[64638,1,"قى"],[64639,1,"قي"],[64640,1,"كا"],[64641,1,"كل"],[64642,1,"كم"],[64643,1,"كى"],[64644,1,"كي"],[64645,1,"لم"],[64646,1,"لى"],[64647,1,"لي"],[64648,1,"ما"],[64649,1,"مم"],[64650,1,"نر"],[64651,1,"نز"],[64652,1,"نم"],[64653,1,"نن"],[64654,1,"نى"],[64655,1,"ني"],[64656,1,"ىٰ"],[64657,1,"ير"],[64658,1,"يز"],[64659,1,"يم"],[64660,1,"ين"],[64661,1,"يى"],[64662,1,"يي"],[64663,1,"ئج"],[64664,1,"ئح"],[64665,1,"ئخ"],[64666,1,"ئم"],[64667,1,"ئه"],[64668,1,"بج"],[64669,1,"بح"],[64670,1,"بخ"],[64671,1,"بم"],[64672,1,"به"],[64673,1,"تج"],[64674,1,"تح"],[64675,1,"تخ"],[64676,1,"تم"],[64677,1,"ته"],[64678,1,"ثم"],[64679,1,"جح"],[64680,1,"جم"],[64681,1,"حج"],[64682,1,"حم"],[64683,1,"خج"],[64684,1,"خم"],[64685,1,"سج"],[64686,1,"سح"],[64687,1,"سخ"],[64688,1,"سم"],[64689,1,"صح"],[64690,1,"صخ"],[64691,1,"صم"],[64692,1,"ضج"],[64693,1,"ضح"],[64694,1,"ضخ"],[64695,1,"ضم"],[64696,1,"طح"],[64697,1,"ظم"],[64698,1,"عج"],[64699,1,"عم"],[64700,1,"غج"],[64701,1,"غم"],[64702,1,"فج"],[64703,1,"فح"],[64704,1,"فخ"],[64705,1,"فم"],[64706,1,"قح"],[64707,1,"قم"],[64708,1,"كج"],[64709,1,"كح"],[64710,1,"كخ"],[64711,1,"كل"],[64712,1,"كم"],[64713,1,"لج"],[64714,1,"لح"],[64715,1,"لخ"],[64716,1,"لم"],[64717,1,"له"],[64718,1,"مج"],[64719,1,"مح"],[64720,1,"مخ"],[64721,1,"مم"],[64722,1,"نج"],[64723,1,"نح"],[64724,1,"نخ"],[64725,1,"نم"],[64726,1,"نه"],[64727,1,"هج"],[64728,1,"هم"],[64729,1,"هٰ"],[64730,1,"يج"],[64731,1,"يح"],[64732,1,"يخ"],[64733,1,"يم"],[64734,1,"يه"],[64735,1,"ئم"],[64736,1,"ئه"],[64737,1,"بم"],[64738,1,"به"],[64739,1,"تم"],[64740,1,"ته"],[64741,1,"ثم"],[64742,1,"ثه"],[64743,1,"سم"],[64744,1,"سه"],[64745,1,"شم"],[64746,1,"شه"],[64747,1,"كل"],[64748,1,"كم"],[64749,1,"لم"],[64750,1,"نم"],[64751,1,"نه"],[64752,1,"يم"],[64753,1,"يه"],[64754,1,"ـَّ"],[64755,1,"ـُّ"],[64756,1,"ـِّ"],[64757,1,"طى"],[64758,1,"طي"],[64759,1,"عى"],[64760,1,"عي"],[64761,1,"غى"],[64762,1,"غي"],[64763,1,"سى"],[64764,1,"سي"],[64765,1,"شى"],[64766,1,"شي"],[64767,1,"حى"],[64768,1,"حي"],[64769,1,"جى"],[64770,1,"جي"],[64771,1,"خى"],[64772,1,"خي"],[64773,1,"صى"],[64774,1,"صي"],[64775,1,"ضى"],[64776,1,"ضي"],[64777,1,"شج"],[64778,1,"شح"],[64779,1,"شخ"],[64780,1,"شم"],[64781,1,"شر"],[64782,1,"سر"],[64783,1,"صر"],[64784,1,"ضر"],[64785,1,"طى"],[64786,1,"طي"],[64787,1,"عى"],[64788,1,"عي"],[64789,1,"غى"],[64790,1,"غي"],[64791,1,"سى"],[64792,1,"سي"],[64793,1,"شى"],[64794,1,"شي"],[64795,1,"حى"],[64796,1,"حي"],[64797,1,"جى"],[64798,1,"جي"],[64799,1,"خى"],[64800,1,"خي"],[64801,1,"صى"],[64802,1,"صي"],[64803,1,"ضى"],[64804,1,"ضي"],[64805,1,"شج"],[64806,1,"شح"],[64807,1,"شخ"],[64808,1,"شم"],[64809,1,"شر"],[64810,1,"سر"],[64811,1,"صر"],[64812,1,"ضر"],[64813,1,"شج"],[64814,1,"شح"],[64815,1,"شخ"],[64816,1,"شم"],[64817,1,"سه"],[64818,1,"شه"],[64819,1,"طم"],[64820,1,"سج"],[64821,1,"سح"],[64822,1,"سخ"],[64823,1,"شج"],[64824,1,"شح"],[64825,1,"شخ"],[64826,1,"طم"],[64827,1,"ظم"],[[64828,64829],1,"اً"],[[64830,64831],2],[[64832,64847],2],[64848,1,"تجم"],[[64849,64850],1,"تحج"],[64851,1,"تحم"],[64852,1,"تخم"],[64853,1,"تمج"],[64854,1,"تمح"],[64855,1,"تمخ"],[[64856,64857],1,"جمح"],[64858,1,"حمي"],[64859,1,"حمى"],[64860,1,"سحج"],[64861,1,"سجح"],[64862,1,"سجى"],[[64863,64864],1,"سمح"],[64865,1,"سمج"],[[64866,64867],1,"سمم"],[[64868,64869],1,"صحح"],[64870,1,"صمم"],[[64871,64872],1,"شحم"],[64873,1,"شجي"],[[64874,64875],1,"شمخ"],[[64876,64877],1,"شمم"],[64878,1,"ضحى"],[[64879,64880],1,"ضخم"],[[64881,64882],1,"طمح"],[64883,1,"طمم"],[64884,1,"طمي"],[64885,1,"عجم"],[[64886,64887],1,"عمم"],[64888,1,"عمى"],[64889,1,"غمم"],[64890,1,"غمي"],[64891,1,"غمى"],[[64892,64893],1,"فخم"],[64894,1,"قمح"],[64895,1,"قمم"],[64896,1,"لحم"],[64897,1,"لحي"],[64898,1,"لحى"],[[64899,64900],1,"لجج"],[[64901,64902],1,"لخم"],[[64903,64904],1,"لمح"],[64905,1,"محج"],[64906,1,"محم"],[64907,1,"محي"],[64908,1,"مجح"],[64909,1,"مجم"],[64910,1,"مخج"],[64911,1,"مخم"],[[64912,64913],3],[64914,1,"مجخ"],[64915,1,"همج"],[64916,1,"همم"],[64917,1,"نحم"],[64918,1,"نحى"],[[64919,64920],1,"نجم"],[64921,1,"نجى"],[64922,1,"نمي"],[64923,1,"نمى"],[[64924,64925],1,"يمم"],[64926,1,"بخي"],[64927,1,"تجي"],[64928,1,"تجى"],[64929,1,"تخي"],[64930,1,"تخى"],[64931,1,"تمي"],[64932,1,"تمى"],[64933,1,"جمي"],[64934,1,"جحى"],[64935,1,"جمى"],[64936,1,"سخى"],[64937,1,"صحي"],[64938,1,"شحي"],[64939,1,"ضحي"],[64940,1,"لجي"],[64941,1,"لمي"],[64942,1,"يحي"],[64943,1,"يجي"],[64944,1,"يمي"],[64945,1,"ممي"],[64946,1,"قمي"],[64947,1,"نحي"],[64948,1,"قمح"],[64949,1,"لحم"],[64950,1,"عمي"],[64951,1,"كمي"],[64952,1,"نجح"],[64953,1,"مخي"],[64954,1,"لجم"],[64955,1,"كمم"],[64956,1,"لجم"],[64957,1,"نجح"],[64958,1,"جحي"],[64959,1,"حجي"],[64960,1,"مجي"],[64961,1,"فمي"],[64962,1,"بحي"],[64963,1,"كمم"],[64964,1,"عجم"],[64965,1,"صمم"],[64966,1,"سخي"],[64967,1,"نجي"],[[64968,64974],3],[64975,2],[[64976,65007],3],[65008,1,"صلے"],[65009,1,"قلے"],[65010,1,"الله"],[65011,1,"اكبر"],[65012,1,"محمد"],[65013,1,"صلعم"],[65014,1,"رسول"],[65015,1,"عليه"],[65016,1,"وسلم"],[65017,1,"صلى"],[65018,5,"صلى الله عليه وسلم"],[65019,5,"جل جلاله"],[65020,1,"ریال"],[65021,2],[[65022,65023],2],[[65024,65039],7],[65040,5,","],[65041,1,"、"],[65042,3],[65043,5,":"],[65044,5,";"],[65045,5,"!"],[65046,5,"?"],[65047,1,"〖"],[65048,1,"〗"],[65049,3],[[65050,65055],3],[[65056,65059],2],[[65060,65062],2],[[65063,65069],2],[[65070,65071],2],[65072,3],[65073,1,"—"],[65074,1,"–"],[[65075,65076],5,"_"],[65077,5,"("],[65078,5,")"],[65079,5,"{"],[65080,5,"}"],[65081,1,"〔"],[65082,1,"〕"],[65083,1,"【"],[65084,1,"】"],[65085,1,"《"],[65086,1,"》"],[65087,1,"〈"],[65088,1,"〉"],[65089,1,"「"],[65090,1,"」"],[65091,1,"『"],[65092,1,"』"],[[65093,65094],2],[65095,5,"["],[65096,5,"]"],[[65097,65100],5," ̅"],[[65101,65103],5,"_"],[65104,5,","],[65105,1,"、"],[65106,3],[65107,3],[65108,5,";"],[65109,5,":"],[65110,5,"?"],[65111,5,"!"],[65112,1,"—"],[65113,5,"("],[65114,5,")"],[65115,5,"{"],[65116,5,"}"],[65117,1,"〔"],[65118,1,"〕"],[65119,5,"#"],[65120,5,"&"],[65121,5,"*"],[65122,5,"+"],[65123,1,"-"],[65124,5,"<"],[65125,5,">"],[65126,5,"="],[65127,3],[65128,5,"\\\\"],[65129,5,"$"],[65130,5,"%"],[65131,5,"@"],[[65132,65135],3],[65136,5," ً"],[65137,1,"ـً"],[65138,5," ٌ"],[65139,2],[65140,5," ٍ"],[65141,3],[65142,5," َ"],[65143,1,"ـَ"],[65144,5," ُ"],[65145,1,"ـُ"],[65146,5," ِ"],[65147,1,"ـِ"],[65148,5," ّ"],[65149,1,"ـّ"],[65150,5," ْ"],[65151,1,"ـْ"],[65152,1,"ء"],[[65153,65154],1,"آ"],[[65155,65156],1,"أ"],[[65157,65158],1,"ؤ"],[[65159,65160],1,"إ"],[[65161,65164],1,"ئ"],[[65165,65166],1,"ا"],[[65167,65170],1,"ب"],[[65171,65172],1,"ة"],[[65173,65176],1,"ت"],[[65177,65180],1,"ث"],[[65181,65184],1,"ج"],[[65185,65188],1,"ح"],[[65189,65192],1,"خ"],[[65193,65194],1,"د"],[[65195,65196],1,"ذ"],[[65197,65198],1,"ر"],[[65199,65200],1,"ز"],[[65201,65204],1,"س"],[[65205,65208],1,"ش"],[[65209,65212],1,"ص"],[[65213,65216],1,"ض"],[[65217,65220],1,"ط"],[[65221,65224],1,"ظ"],[[65225,65228],1,"ع"],[[65229,65232],1,"غ"],[[65233,65236],1,"ف"],[[65237,65240],1,"ق"],[[65241,65244],1,"ك"],[[65245,65248],1,"ل"],[[65249,65252],1,"م"],[[65253,65256],1,"ن"],[[65257,65260],1,"ه"],[[65261,65262],1,"و"],[[65263,65264],1,"ى"],[[65265,65268],1,"ي"],[[65269,65270],1,"لآ"],[[65271,65272],1,"لأ"],[[65273,65274],1,"لإ"],[[65275,65276],1,"لا"],[[65277,65278],3],[65279,7],[65280,3],[65281,5,"!"],[65282,5,"\\""],[65283,5,"#"],[65284,5,"$"],[65285,5,"%"],[65286,5,"&"],[65287,5,"\'"],[65288,5,"("],[65289,5,")"],[65290,5,"*"],[65291,5,"+"],[65292,5,","],[65293,1,"-"],[65294,1,"."],[65295,5,"/"],[65296,1,"0"],[65297,1,"1"],[65298,1,"2"],[65299,1,"3"],[65300,1,"4"],[65301,1,"5"],[65302,1,"6"],[65303,1,"7"],[65304,1,"8"],[65305,1,"9"],[65306,5,":"],[65307,5,";"],[65308,5,"<"],[65309,5,"="],[65310,5,">"],[65311,5,"?"],[65312,5,"@"],[65313,1,"a"],[65314,1,"b"],[65315,1,"c"],[65316,1,"d"],[65317,1,"e"],[65318,1,"f"],[65319,1,"g"],[65320,1,"h"],[65321,1,"i"],[65322,1,"j"],[65323,1,"k"],[65324,1,"l"],[65325,1,"m"],[65326,1,"n"],[65327,1,"o"],[65328,1,"p"],[65329,1,"q"],[65330,1,"r"],[65331,1,"s"],[65332,1,"t"],[65333,1,"u"],[65334,1,"v"],[65335,1,"w"],[65336,1,"x"],[65337,1,"y"],[65338,1,"z"],[65339,5,"["],[65340,5,"\\\\"],[65341,5,"]"],[65342,5,"^"],[65343,5,"_"],[65344,5,"`"],[65345,1,"a"],[65346,1,"b"],[65347,1,"c"],[65348,1,"d"],[65349,1,"e"],[65350,1,"f"],[65351,1,"g"],[65352,1,"h"],[65353,1,"i"],[65354,1,"j"],[65355,1,"k"],[65356,1,"l"],[65357,1,"m"],[65358,1,"n"],[65359,1,"o"],[65360,1,"p"],[65361,1,"q"],[65362,1,"r"],[65363,1,"s"],[65364,1,"t"],[65365,1,"u"],[65366,1,"v"],[65367,1,"w"],[65368,1,"x"],[65369,1,"y"],[65370,1,"z"],[65371,5,"{"],[65372,5,"|"],[65373,5,"}"],[65374,5,"~"],[65375,1,"⦅"],[65376,1,"⦆"],[65377,1,"."],[65378,1,"「"],[65379,1,"」"],[65380,1,"、"],[65381,1,"・"],[65382,1,"ヲ"],[65383,1,"ァ"],[65384,1,"ィ"],[65385,1,"ゥ"],[65386,1,"ェ"],[65387,1,"ォ"],[65388,1,"ャ"],[65389,1,"ュ"],[65390,1,"ョ"],[65391,1,"ッ"],[65392,1,"ー"],[65393,1,"ア"],[65394,1,"イ"],[65395,1,"ウ"],[65396,1,"エ"],[65397,1,"オ"],[65398,1,"カ"],[65399,1,"キ"],[65400,1,"ク"],[65401,1,"ケ"],[65402,1,"コ"],[65403,1,"サ"],[65404,1,"シ"],[65405,1,"ス"],[65406,1,"セ"],[65407,1,"ソ"],[65408,1,"タ"],[65409,1,"チ"],[65410,1,"ツ"],[65411,1,"テ"],[65412,1,"ト"],[65413,1,"ナ"],[65414,1,"ニ"],[65415,1,"ヌ"],[65416,1,"ネ"],[65417,1,"ノ"],[65418,1,"ハ"],[65419,1,"ヒ"],[65420,1,"フ"],[65421,1,"ヘ"],[65422,1,"ホ"],[65423,1,"マ"],[65424,1,"ミ"],[65425,1,"ム"],[65426,1,"メ"],[65427,1,"モ"],[65428,1,"ヤ"],[65429,1,"ユ"],[65430,1,"ヨ"],[65431,1,"ラ"],[65432,1,"リ"],[65433,1,"ル"],[65434,1,"レ"],[65435,1,"ロ"],[65436,1,"ワ"],[65437,1,"ン"],[65438,1,"゙"],[65439,1,"゚"],[65440,3],[65441,1,"ᄀ"],[65442,1,"ᄁ"],[65443,1,"ᆪ"],[65444,1,"ᄂ"],[65445,1,"ᆬ"],[65446,1,"ᆭ"],[65447,1,"ᄃ"],[65448,1,"ᄄ"],[65449,1,"ᄅ"],[65450,1,"ᆰ"],[65451,1,"ᆱ"],[65452,1,"ᆲ"],[65453,1,"ᆳ"],[65454,1,"ᆴ"],[65455,1,"ᆵ"],[65456,1,"ᄚ"],[65457,1,"ᄆ"],[65458,1,"ᄇ"],[65459,1,"ᄈ"],[65460,1,"ᄡ"],[65461,1,"ᄉ"],[65462,1,"ᄊ"],[65463,1,"ᄋ"],[65464,1,"ᄌ"],[65465,1,"ᄍ"],[65466,1,"ᄎ"],[65467,1,"ᄏ"],[65468,1,"ᄐ"],[65469,1,"ᄑ"],[65470,1,"ᄒ"],[[65471,65473],3],[65474,1,"ᅡ"],[65475,1,"ᅢ"],[65476,1,"ᅣ"],[65477,1,"ᅤ"],[65478,1,"ᅥ"],[65479,1,"ᅦ"],[[65480,65481],3],[65482,1,"ᅧ"],[65483,1,"ᅨ"],[65484,1,"ᅩ"],[65485,1,"ᅪ"],[65486,1,"ᅫ"],[65487,1,"ᅬ"],[[65488,65489],3],[65490,1,"ᅭ"],[65491,1,"ᅮ"],[65492,1,"ᅯ"],[65493,1,"ᅰ"],[65494,1,"ᅱ"],[65495,1,"ᅲ"],[[65496,65497],3],[65498,1,"ᅳ"],[65499,1,"ᅴ"],[65500,1,"ᅵ"],[[65501,65503],3],[65504,1,"¢"],[65505,1,"£"],[65506,1,"¬"],[65507,5," ̄"],[65508,1,"¦"],[65509,1,"¥"],[65510,1,"₩"],[65511,3],[65512,1,"│"],[65513,1,"←"],[65514,1,"↑"],[65515,1,"→"],[65516,1,"↓"],[65517,1,"■"],[65518,1,"○"],[[65519,65528],3],[[65529,65531],3],[65532,3],[65533,3],[[65534,65535],3],[[65536,65547],2],[65548,3],[[65549,65574],2],[65575,3],[[65576,65594],2],[65595,3],[[65596,65597],2],[65598,3],[[65599,65613],2],[[65614,65615],3],[[65616,65629],2],[[65630,65663],3],[[65664,65786],2],[[65787,65791],3],[[65792,65794],2],[[65795,65798],3],[[65799,65843],2],[[65844,65846],3],[[65847,65855],2],[[65856,65930],2],[[65931,65932],2],[[65933,65934],2],[65935,3],[[65936,65947],2],[65948,2],[[65949,65951],3],[65952,2],[[65953,65999],3],[[66000,66044],2],[66045,2],[[66046,66175],3],[[66176,66204],2],[[66205,66207],3],[[66208,66256],2],[[66257,66271],3],[66272,2],[[66273,66299],2],[[66300,66303],3],[[66304,66334],2],[66335,2],[[66336,66339],2],[[66340,66348],3],[[66349,66351],2],[[66352,66368],2],[66369,2],[[66370,66377],2],[66378,2],[[66379,66383],3],[[66384,66426],2],[[66427,66431],3],[[66432,66461],2],[66462,3],[66463,2],[[66464,66499],2],[[66500,66503],3],[[66504,66511],2],[[66512,66517],2],[[66518,66559],3],[66560,1,"𐐨"],[66561,1,"𐐩"],[66562,1,"𐐪"],[66563,1,"𐐫"],[66564,1,"𐐬"],[66565,1,"𐐭"],[66566,1,"𐐮"],[66567,1,"𐐯"],[66568,1,"𐐰"],[66569,1,"𐐱"],[66570,1,"𐐲"],[66571,1,"𐐳"],[66572,1,"𐐴"],[66573,1,"𐐵"],[66574,1,"𐐶"],[66575,1,"𐐷"],[66576,1,"𐐸"],[66577,1,"𐐹"],[66578,1,"𐐺"],[66579,1,"𐐻"],[66580,1,"𐐼"],[66581,1,"𐐽"],[66582,1,"𐐾"],[66583,1,"𐐿"],[66584,1,"𐑀"],[66585,1,"𐑁"],[66586,1,"𐑂"],[66587,1,"𐑃"],[66588,1,"𐑄"],[66589,1,"𐑅"],[66590,1,"𐑆"],[66591,1,"𐑇"],[66592,1,"𐑈"],[66593,1,"𐑉"],[66594,1,"𐑊"],[66595,1,"𐑋"],[66596,1,"𐑌"],[66597,1,"𐑍"],[66598,1,"𐑎"],[66599,1,"𐑏"],[[66600,66637],2],[[66638,66717],2],[[66718,66719],3],[[66720,66729],2],[[66730,66735],3],[66736,1,"𐓘"],[66737,1,"𐓙"],[66738,1,"𐓚"],[66739,1,"𐓛"],[66740,1,"𐓜"],[66741,1,"𐓝"],[66742,1,"𐓞"],[66743,1,"𐓟"],[66744,1,"𐓠"],[66745,1,"𐓡"],[66746,1,"𐓢"],[66747,1,"𐓣"],[66748,1,"𐓤"],[66749,1,"𐓥"],[66750,1,"𐓦"],[66751,1,"𐓧"],[66752,1,"𐓨"],[66753,1,"𐓩"],[66754,1,"𐓪"],[66755,1,"𐓫"],[66756,1,"𐓬"],[66757,1,"𐓭"],[66758,1,"𐓮"],[66759,1,"𐓯"],[66760,1,"𐓰"],[66761,1,"𐓱"],[66762,1,"𐓲"],[66763,1,"𐓳"],[66764,1,"𐓴"],[66765,1,"𐓵"],[66766,1,"𐓶"],[66767,1,"𐓷"],[66768,1,"𐓸"],[66769,1,"𐓹"],[66770,1,"𐓺"],[66771,1,"𐓻"],[[66772,66775],3],[[66776,66811],2],[[66812,66815],3],[[66816,66855],2],[[66856,66863],3],[[66864,66915],2],[[66916,66926],3],[66927,2],[66928,1,"𐖗"],[66929,1,"𐖘"],[66930,1,"𐖙"],[66931,1,"𐖚"],[66932,1,"𐖛"],[66933,1,"𐖜"],[66934,1,"𐖝"],[66935,1,"𐖞"],[66936,1,"𐖟"],[66937,1,"𐖠"],[66938,1,"𐖡"],[66939,3],[66940,1,"𐖣"],[66941,1,"𐖤"],[66942,1,"𐖥"],[66943,1,"𐖦"],[66944,1,"𐖧"],[66945,1,"𐖨"],[66946,1,"𐖩"],[66947,1,"𐖪"],[66948,1,"𐖫"],[66949,1,"𐖬"],[66950,1,"𐖭"],[66951,1,"𐖮"],[66952,1,"𐖯"],[66953,1,"𐖰"],[66954,1,"𐖱"],[66955,3],[66956,1,"𐖳"],[66957,1,"𐖴"],[66958,1,"𐖵"],[66959,1,"𐖶"],[66960,1,"𐖷"],[66961,1,"𐖸"],[66962,1,"𐖹"],[66963,3],[66964,1,"𐖻"],[66965,1,"𐖼"],[66966,3],[[66967,66977],2],[66978,3],[[66979,66993],2],[66994,3],[[66995,67001],2],[67002,3],[[67003,67004],2],[[67005,67071],3],[[67072,67382],2],[[67383,67391],3],[[67392,67413],2],[[67414,67423],3],[[67424,67431],2],[[67432,67455],3],[67456,2],[67457,1,"ː"],[67458,1,"ˑ"],[67459,1,"æ"],[67460,1,"ʙ"],[67461,1,"ɓ"],[67462,3],[67463,1,"ʣ"],[67464,1,"ꭦ"],[67465,1,"ʥ"],[67466,1,"ʤ"],[67467,1,"ɖ"],[67468,1,"ɗ"],[67469,1,"ᶑ"],[67470,1,"ɘ"],[67471,1,"ɞ"],[67472,1,"ʩ"],[67473,1,"ɤ"],[67474,1,"ɢ"],[67475,1,"ɠ"],[67476,1,"ʛ"],[67477,1,"ħ"],[67478,1,"ʜ"],[67479,1,"ɧ"],[67480,1,"ʄ"],[67481,1,"ʪ"],[67482,1,"ʫ"],[67483,1,"ɬ"],[67484,1,"𝼄"],[67485,1,"ꞎ"],[67486,1,"ɮ"],[67487,1,"𝼅"],[67488,1,"ʎ"],[67489,1,"𝼆"],[67490,1,"ø"],[67491,1,"ɶ"],[67492,1,"ɷ"],[67493,1,"q"],[67494,1,"ɺ"],[67495,1,"𝼈"],[67496,1,"ɽ"],[67497,1,"ɾ"],[67498,1,"ʀ"],[67499,1,"ʨ"],[67500,1,"ʦ"],[67501,1,"ꭧ"],[67502,1,"ʧ"],[67503,1,"ʈ"],[67504,1,"ⱱ"],[67505,3],[67506,1,"ʏ"],[67507,1,"ʡ"],[67508,1,"ʢ"],[67509,1,"ʘ"],[67510,1,"ǀ"],[67511,1,"ǁ"],[67512,1,"ǂ"],[67513,1,"𝼊"],[67514,1,"𝼞"],[[67515,67583],3],[[67584,67589],2],[[67590,67591],3],[67592,2],[67593,3],[[67594,67637],2],[67638,3],[[67639,67640],2],[[67641,67643],3],[67644,2],[[67645,67646],3],[67647,2],[[67648,67669],2],[67670,3],[[67671,67679],2],[[67680,67702],2],[[67703,67711],2],[[67712,67742],2],[[67743,67750],3],[[67751,67759],2],[[67760,67807],3],[[67808,67826],2],[67827,3],[[67828,67829],2],[[67830,67834],3],[[67835,67839],2],[[67840,67861],2],[[67862,67865],2],[[67866,67867],2],[[67868,67870],3],[67871,2],[[67872,67897],2],[[67898,67902],3],[67903,2],[[67904,67967],3],[[67968,68023],2],[[68024,68027],3],[[68028,68029],2],[[68030,68031],2],[[68032,68047],2],[[68048,68049],3],[[68050,68095],2],[[68096,68099],2],[68100,3],[[68101,68102],2],[[68103,68107],3],[[68108,68115],2],[68116,3],[[68117,68119],2],[68120,3],[[68121,68147],2],[[68148,68149],2],[[68150,68151],3],[[68152,68154],2],[[68155,68158],3],[68159,2],[[68160,68167],2],[68168,2],[[68169,68175],3],[[68176,68184],2],[[68185,68191],3],[[68192,68220],2],[[68221,68223],2],[[68224,68252],2],[[68253,68255],2],[[68256,68287],3],[[68288,68295],2],[68296,2],[[68297,68326],2],[[68327,68330],3],[[68331,68342],2],[[68343,68351],3],[[68352,68405],2],[[68406,68408],3],[[68409,68415],2],[[68416,68437],2],[[68438,68439],3],[[68440,68447],2],[[68448,68466],2],[[68467,68471],3],[[68472,68479],2],[[68480,68497],2],[[68498,68504],3],[[68505,68508],2],[[68509,68520],3],[[68521,68527],2],[[68528,68607],3],[[68608,68680],2],[[68681,68735],3],[68736,1,"𐳀"],[68737,1,"𐳁"],[68738,1,"𐳂"],[68739,1,"𐳃"],[68740,1,"𐳄"],[68741,1,"𐳅"],[68742,1,"𐳆"],[68743,1,"𐳇"],[68744,1,"𐳈"],[68745,1,"𐳉"],[68746,1,"𐳊"],[68747,1,"𐳋"],[68748,1,"𐳌"],[68749,1,"𐳍"],[68750,1,"𐳎"],[68751,1,"𐳏"],[68752,1,"𐳐"],[68753,1,"𐳑"],[68754,1,"𐳒"],[68755,1,"𐳓"],[68756,1,"𐳔"],[68757,1,"𐳕"],[68758,1,"𐳖"],[68759,1,"𐳗"],[68760,1,"𐳘"],[68761,1,"𐳙"],[68762,1,"𐳚"],[68763,1,"𐳛"],[68764,1,"𐳜"],[68765,1,"𐳝"],[68766,1,"𐳞"],[68767,1,"𐳟"],[68768,1,"𐳠"],[68769,1,"𐳡"],[68770,1,"𐳢"],[68771,1,"𐳣"],[68772,1,"𐳤"],[68773,1,"𐳥"],[68774,1,"𐳦"],[68775,1,"𐳧"],[68776,1,"𐳨"],[68777,1,"𐳩"],[68778,1,"𐳪"],[68779,1,"𐳫"],[68780,1,"𐳬"],[68781,1,"𐳭"],[68782,1,"𐳮"],[68783,1,"𐳯"],[68784,1,"𐳰"],[68785,1,"𐳱"],[68786,1,"𐳲"],[[68787,68799],3],[[68800,68850],2],[[68851,68857],3],[[68858,68863],2],[[68864,68903],2],[[68904,68911],3],[[68912,68921],2],[[68922,69215],3],[[69216,69246],2],[69247,3],[[69248,69289],2],[69290,3],[[69291,69292],2],[69293,2],[[69294,69295],3],[[69296,69297],2],[[69298,69375],3],[[69376,69404],2],[[69405,69414],2],[69415,2],[[69416,69423],3],[[69424,69456],2],[[69457,69465],2],[[69466,69487],3],[[69488,69509],2],[[69510,69513],2],[[69514,69551],3],[[69552,69572],2],[[69573,69579],2],[[69580,69599],3],[[69600,69622],2],[[69623,69631],3],[[69632,69702],2],[[69703,69709],2],[[69710,69713],3],[[69714,69733],2],[[69734,69743],2],[[69744,69749],2],[[69750,69758],3],[69759,2],[[69760,69818],2],[[69819,69820],2],[69821,3],[[69822,69825],2],[69826,2],[[69827,69836],3],[69837,3],[[69838,69839],3],[[69840,69864],2],[[69865,69871],3],[[69872,69881],2],[[69882,69887],3],[[69888,69940],2],[69941,3],[[69942,69951],2],[[69952,69955],2],[[69956,69958],2],[69959,2],[[69960,69967],3],[[69968,70003],2],[[70004,70005],2],[70006,2],[[70007,70015],3],[[70016,70084],2],[[70085,70088],2],[[70089,70092],2],[70093,2],[[70094,70095],2],[[70096,70105],2],[70106,2],[70107,2],[70108,2],[[70109,70111],2],[70112,3],[[70113,70132],2],[[70133,70143],3],[[70144,70161],2],[70162,3],[[70163,70199],2],[[70200,70205],2],[70206,2],[[70207,70271],3],[[70272,70278],2],[70279,3],[70280,2],[70281,3],[[70282,70285],2],[70286,3],[[70287,70301],2],[70302,3],[[70303,70312],2],[70313,2],[[70314,70319],3],[[70320,70378],2],[[70379,70383],3],[[70384,70393],2],[[70394,70399],3],[70400,2],[[70401,70403],2],[70404,3],[[70405,70412],2],[[70413,70414],3],[[70415,70416],2],[[70417,70418],3],[[70419,70440],2],[70441,3],[[70442,70448],2],[70449,3],[[70450,70451],2],[70452,3],[[70453,70457],2],[70458,3],[70459,2],[[70460,70468],2],[[70469,70470],3],[[70471,70472],2],[[70473,70474],3],[[70475,70477],2],[[70478,70479],3],[70480,2],[[70481,70486],3],[70487,2],[[70488,70492],3],[[70493,70499],2],[[70500,70501],3],[[70502,70508],2],[[70509,70511],3],[[70512,70516],2],[[70517,70655],3],[[70656,70730],2],[[70731,70735],2],[[70736,70745],2],[70746,2],[70747,2],[70748,3],[70749,2],[70750,2],[70751,2],[[70752,70753],2],[[70754,70783],3],[[70784,70853],2],[70854,2],[70855,2],[[70856,70863],3],[[70864,70873],2],[[70874,71039],3],[[71040,71093],2],[[71094,71095],3],[[71096,71104],2],[[71105,71113],2],[[71114,71127],2],[[71128,71133],2],[[71134,71167],3],[[71168,71232],2],[[71233,71235],2],[71236,2],[[71237,71247],3],[[71248,71257],2],[[71258,71263],3],[[71264,71276],2],[[71277,71295],3],[[71296,71351],2],[71352,2],[71353,2],[[71354,71359],3],[[71360,71369],2],[[71370,71423],3],[[71424,71449],2],[71450,2],[[71451,71452],3],[[71453,71467],2],[[71468,71471],3],[[71472,71481],2],[[71482,71487],2],[[71488,71494],2],[[71495,71679],3],[[71680,71738],2],[71739,2],[[71740,71839],3],[71840,1,"𑣀"],[71841,1,"𑣁"],[71842,1,"𑣂"],[71843,1,"𑣃"],[71844,1,"𑣄"],[71845,1,"𑣅"],[71846,1,"𑣆"],[71847,1,"𑣇"],[71848,1,"𑣈"],[71849,1,"𑣉"],[71850,1,"𑣊"],[71851,1,"𑣋"],[71852,1,"𑣌"],[71853,1,"𑣍"],[71854,1,"𑣎"],[71855,1,"𑣏"],[71856,1,"𑣐"],[71857,1,"𑣑"],[71858,1,"𑣒"],[71859,1,"𑣓"],[71860,1,"𑣔"],[71861,1,"𑣕"],[71862,1,"𑣖"],[71863,1,"𑣗"],[71864,1,"𑣘"],[71865,1,"𑣙"],[71866,1,"𑣚"],[71867,1,"𑣛"],[71868,1,"𑣜"],[71869,1,"𑣝"],[71870,1,"𑣞"],[71871,1,"𑣟"],[[71872,71913],2],[[71914,71922],2],[[71923,71934],3],[71935,2],[[71936,71942],2],[[71943,71944],3],[71945,2],[[71946,71947],3],[[71948,71955],2],[71956,3],[[71957,71958],2],[71959,3],[[71960,71989],2],[71990,3],[[71991,71992],2],[[71993,71994],3],[[71995,72003],2],[[72004,72006],2],[[72007,72015],3],[[72016,72025],2],[[72026,72095],3],[[72096,72103],2],[[72104,72105],3],[[72106,72151],2],[[72152,72153],3],[[72154,72161],2],[72162,2],[[72163,72164],2],[[72165,72191],3],[[72192,72254],2],[[72255,72262],2],[72263,2],[[72264,72271],3],[[72272,72323],2],[[72324,72325],2],[[72326,72345],2],[[72346,72348],2],[72349,2],[[72350,72354],2],[[72355,72367],3],[[72368,72383],2],[[72384,72440],2],[[72441,72703],3],[[72704,72712],2],[72713,3],[[72714,72758],2],[72759,3],[[72760,72768],2],[[72769,72773],2],[[72774,72783],3],[[72784,72793],2],[[72794,72812],2],[[72813,72815],3],[[72816,72817],2],[[72818,72847],2],[[72848,72849],3],[[72850,72871],2],[72872,3],[[72873,72886],2],[[72887,72959],3],[[72960,72966],2],[72967,3],[[72968,72969],2],[72970,3],[[72971,73014],2],[[73015,73017],3],[73018,2],[73019,3],[[73020,73021],2],[73022,3],[[73023,73031],2],[[73032,73039],3],[[73040,73049],2],[[73050,73055],3],[[73056,73061],2],[73062,3],[[73063,73064],2],[73065,3],[[73066,73102],2],[73103,3],[[73104,73105],2],[73106,3],[[73107,73112],2],[[73113,73119],3],[[73120,73129],2],[[73130,73439],3],[[73440,73462],2],[[73463,73464],2],[[73465,73647],3],[73648,2],[[73649,73663],3],[[73664,73713],2],[[73714,73726],3],[73727,2],[[73728,74606],2],[[74607,74648],2],[74649,2],[[74650,74751],3],[[74752,74850],2],[[74851,74862],2],[74863,3],[[74864,74867],2],[74868,2],[[74869,74879],3],[[74880,75075],2],[[75076,77711],3],[[77712,77808],2],[[77809,77810],2],[[77811,77823],3],[[77824,78894],2],[78895,3],[[78896,78904],3],[[78905,82943],3],[[82944,83526],2],[[83527,92159],3],[[92160,92728],2],[[92729,92735],3],[[92736,92766],2],[92767,3],[[92768,92777],2],[[92778,92781],3],[[92782,92783],2],[[92784,92862],2],[92863,3],[[92864,92873],2],[[92874,92879],3],[[92880,92909],2],[[92910,92911],3],[[92912,92916],2],[92917,2],[[92918,92927],3],[[92928,92982],2],[[92983,92991],2],[[92992,92995],2],[[92996,92997],2],[[92998,93007],3],[[93008,93017],2],[93018,3],[[93019,93025],2],[93026,3],[[93027,93047],2],[[93048,93052],3],[[93053,93071],2],[[93072,93759],3],[93760,1,"𖹠"],[93761,1,"𖹡"],[93762,1,"𖹢"],[93763,1,"𖹣"],[93764,1,"𖹤"],[93765,1,"𖹥"],[93766,1,"𖹦"],[93767,1,"𖹧"],[93768,1,"𖹨"],[93769,1,"𖹩"],[93770,1,"𖹪"],[93771,1,"𖹫"],[93772,1,"𖹬"],[93773,1,"𖹭"],[93774,1,"𖹮"],[93775,1,"𖹯"],[93776,1,"𖹰"],[93777,1,"𖹱"],[93778,1,"𖹲"],[93779,1,"𖹳"],[93780,1,"𖹴"],[93781,1,"𖹵"],[93782,1,"𖹶"],[93783,1,"𖹷"],[93784,1,"𖹸"],[93785,1,"𖹹"],[93786,1,"𖹺"],[93787,1,"𖹻"],[93788,1,"𖹼"],[93789,1,"𖹽"],[93790,1,"𖹾"],[93791,1,"𖹿"],[[93792,93823],2],[[93824,93850],2],[[93851,93951],3],[[93952,94020],2],[[94021,94026],2],[[94027,94030],3],[94031,2],[[94032,94078],2],[[94079,94087],2],[[94088,94094],3],[[94095,94111],2],[[94112,94175],3],[94176,2],[94177,2],[94178,2],[94179,2],[94180,2],[[94181,94191],3],[[94192,94193],2],[[94194,94207],3],[[94208,100332],2],[[100333,100337],2],[[100338,100343],2],[[100344,100351],3],[[100352,101106],2],[[101107,101589],2],[[101590,101631],3],[[101632,101640],2],[[101641,110575],3],[[110576,110579],2],[110580,3],[[110581,110587],2],[110588,3],[[110589,110590],2],[110591,3],[[110592,110593],2],[[110594,110878],2],[[110879,110882],2],[[110883,110927],3],[[110928,110930],2],[[110931,110947],3],[[110948,110951],2],[[110952,110959],3],[[110960,111355],2],[[111356,113663],3],[[113664,113770],2],[[113771,113775],3],[[113776,113788],2],[[113789,113791],3],[[113792,113800],2],[[113801,113807],3],[[113808,113817],2],[[113818,113819],3],[113820,2],[[113821,113822],2],[113823,2],[[113824,113827],7],[[113828,118527],3],[[118528,118573],2],[[118574,118575],3],[[118576,118598],2],[[118599,118607],3],[[118608,118723],2],[[118724,118783],3],[[118784,119029],2],[[119030,119039],3],[[119040,119078],2],[[119079,119080],3],[119081,2],[[119082,119133],2],[119134,1,"𝅗𝅥"],[119135,1,"𝅘𝅥"],[119136,1,"𝅘𝅥𝅮"],[119137,1,"𝅘𝅥𝅯"],[119138,1,"𝅘𝅥𝅰"],[119139,1,"𝅘𝅥𝅱"],[119140,1,"𝅘𝅥𝅲"],[[119141,119154],2],[[119155,119162],3],[[119163,119226],2],[119227,1,"𝆹𝅥"],[119228,1,"𝆺𝅥"],[119229,1,"𝆹𝅥𝅮"],[119230,1,"𝆺𝅥𝅮"],[119231,1,"𝆹𝅥𝅯"],[119232,1,"𝆺𝅥𝅯"],[[119233,119261],2],[[119262,119272],2],[[119273,119274],2],[[119275,119295],3],[[119296,119365],2],[[119366,119519],3],[[119520,119539],2],[[119540,119551],3],[[119552,119638],2],[[119639,119647],3],[[119648,119665],2],[[119666,119672],2],[[119673,119807],3],[119808,1,"a"],[119809,1,"b"],[119810,1,"c"],[119811,1,"d"],[119812,1,"e"],[119813,1,"f"],[119814,1,"g"],[119815,1,"h"],[119816,1,"i"],[119817,1,"j"],[119818,1,"k"],[119819,1,"l"],[119820,1,"m"],[119821,1,"n"],[119822,1,"o"],[119823,1,"p"],[119824,1,"q"],[119825,1,"r"],[119826,1,"s"],[119827,1,"t"],[119828,1,"u"],[119829,1,"v"],[119830,1,"w"],[119831,1,"x"],[119832,1,"y"],[119833,1,"z"],[119834,1,"a"],[119835,1,"b"],[119836,1,"c"],[119837,1,"d"],[119838,1,"e"],[119839,1,"f"],[119840,1,"g"],[119841,1,"h"],[119842,1,"i"],[119843,1,"j"],[119844,1,"k"],[119845,1,"l"],[119846,1,"m"],[119847,1,"n"],[119848,1,"o"],[119849,1,"p"],[119850,1,"q"],[119851,1,"r"],[119852,1,"s"],[119853,1,"t"],[119854,1,"u"],[119855,1,"v"],[119856,1,"w"],[119857,1,"x"],[119858,1,"y"],[119859,1,"z"],[119860,1,"a"],[119861,1,"b"],[119862,1,"c"],[119863,1,"d"],[119864,1,"e"],[119865,1,"f"],[119866,1,"g"],[119867,1,"h"],[119868,1,"i"],[119869,1,"j"],[119870,1,"k"],[119871,1,"l"],[119872,1,"m"],[119873,1,"n"],[119874,1,"o"],[119875,1,"p"],[119876,1,"q"],[119877,1,"r"],[119878,1,"s"],[119879,1,"t"],[119880,1,"u"],[119881,1,"v"],[119882,1,"w"],[119883,1,"x"],[119884,1,"y"],[119885,1,"z"],[119886,1,"a"],[119887,1,"b"],[119888,1,"c"],[119889,1,"d"],[119890,1,"e"],[119891,1,"f"],[119892,1,"g"],[119893,3],[119894,1,"i"],[119895,1,"j"],[119896,1,"k"],[119897,1,"l"],[119898,1,"m"],[119899,1,"n"],[119900,1,"o"],[119901,1,"p"],[119902,1,"q"],[119903,1,"r"],[119904,1,"s"],[119905,1,"t"],[119906,1,"u"],[119907,1,"v"],[119908,1,"w"],[119909,1,"x"],[119910,1,"y"],[119911,1,"z"],[119912,1,"a"],[119913,1,"b"],[119914,1,"c"],[119915,1,"d"],[119916,1,"e"],[119917,1,"f"],[119918,1,"g"],[119919,1,"h"],[119920,1,"i"],[119921,1,"j"],[119922,1,"k"],[119923,1,"l"],[119924,1,"m"],[119925,1,"n"],[119926,1,"o"],[119927,1,"p"],[119928,1,"q"],[119929,1,"r"],[119930,1,"s"],[119931,1,"t"],[119932,1,"u"],[119933,1,"v"],[119934,1,"w"],[119935,1,"x"],[119936,1,"y"],[119937,1,"z"],[119938,1,"a"],[119939,1,"b"],[119940,1,"c"],[119941,1,"d"],[119942,1,"e"],[119943,1,"f"],[119944,1,"g"],[119945,1,"h"],[119946,1,"i"],[119947,1,"j"],[119948,1,"k"],[119949,1,"l"],[119950,1,"m"],[119951,1,"n"],[119952,1,"o"],[119953,1,"p"],[119954,1,"q"],[119955,1,"r"],[119956,1,"s"],[119957,1,"t"],[119958,1,"u"],[119959,1,"v"],[119960,1,"w"],[119961,1,"x"],[119962,1,"y"],[119963,1,"z"],[119964,1,"a"],[119965,3],[119966,1,"c"],[119967,1,"d"],[[119968,119969],3],[119970,1,"g"],[[119971,119972],3],[119973,1,"j"],[119974,1,"k"],[[119975,119976],3],[119977,1,"n"],[119978,1,"o"],[119979,1,"p"],[119980,1,"q"],[119981,3],[119982,1,"s"],[119983,1,"t"],[119984,1,"u"],[119985,1,"v"],[119986,1,"w"],[119987,1,"x"],[119988,1,"y"],[119989,1,"z"],[119990,1,"a"],[119991,1,"b"],[119992,1,"c"],[119993,1,"d"],[119994,3],[119995,1,"f"],[119996,3],[119997,1,"h"],[119998,1,"i"],[119999,1,"j"],[120000,1,"k"],[120001,1,"l"],[120002,1,"m"],[120003,1,"n"],[120004,3],[120005,1,"p"],[120006,1,"q"],[120007,1,"r"],[120008,1,"s"],[120009,1,"t"],[120010,1,"u"],[120011,1,"v"],[120012,1,"w"],[120013,1,"x"],[120014,1,"y"],[120015,1,"z"],[120016,1,"a"],[120017,1,"b"],[120018,1,"c"],[120019,1,"d"],[120020,1,"e"],[120021,1,"f"],[120022,1,"g"],[120023,1,"h"],[120024,1,"i"],[120025,1,"j"],[120026,1,"k"],[120027,1,"l"],[120028,1,"m"],[120029,1,"n"],[120030,1,"o"],[120031,1,"p"],[120032,1,"q"],[120033,1,"r"],[120034,1,"s"],[120035,1,"t"],[120036,1,"u"],[120037,1,"v"],[120038,1,"w"],[120039,1,"x"],[120040,1,"y"],[120041,1,"z"],[120042,1,"a"],[120043,1,"b"],[120044,1,"c"],[120045,1,"d"],[120046,1,"e"],[120047,1,"f"],[120048,1,"g"],[120049,1,"h"],[120050,1,"i"],[120051,1,"j"],[120052,1,"k"],[120053,1,"l"],[120054,1,"m"],[120055,1,"n"],[120056,1,"o"],[120057,1,"p"],[120058,1,"q"],[120059,1,"r"],[120060,1,"s"],[120061,1,"t"],[120062,1,"u"],[120063,1,"v"],[120064,1,"w"],[120065,1,"x"],[120066,1,"y"],[120067,1,"z"],[120068,1,"a"],[120069,1,"b"],[120070,3],[120071,1,"d"],[120072,1,"e"],[120073,1,"f"],[120074,1,"g"],[[120075,120076],3],[120077,1,"j"],[120078,1,"k"],[120079,1,"l"],[120080,1,"m"],[120081,1,"n"],[120082,1,"o"],[120083,1,"p"],[120084,1,"q"],[120085,3],[120086,1,"s"],[120087,1,"t"],[120088,1,"u"],[120089,1,"v"],[120090,1,"w"],[120091,1,"x"],[120092,1,"y"],[120093,3],[120094,1,"a"],[120095,1,"b"],[120096,1,"c"],[120097,1,"d"],[120098,1,"e"],[120099,1,"f"],[120100,1,"g"],[120101,1,"h"],[120102,1,"i"],[120103,1,"j"],[120104,1,"k"],[120105,1,"l"],[120106,1,"m"],[120107,1,"n"],[120108,1,"o"],[120109,1,"p"],[120110,1,"q"],[120111,1,"r"],[120112,1,"s"],[120113,1,"t"],[120114,1,"u"],[120115,1,"v"],[120116,1,"w"],[120117,1,"x"],[120118,1,"y"],[120119,1,"z"],[120120,1,"a"],[120121,1,"b"],[120122,3],[120123,1,"d"],[120124,1,"e"],[120125,1,"f"],[120126,1,"g"],[120127,3],[120128,1,"i"],[120129,1,"j"],[120130,1,"k"],[120131,1,"l"],[120132,1,"m"],[120133,3],[120134,1,"o"],[[120135,120137],3],[120138,1,"s"],[120139,1,"t"],[120140,1,"u"],[120141,1,"v"],[120142,1,"w"],[120143,1,"x"],[120144,1,"y"],[120145,3],[120146,1,"a"],[120147,1,"b"],[120148,1,"c"],[120149,1,"d"],[120150,1,"e"],[120151,1,"f"],[120152,1,"g"],[120153,1,"h"],[120154,1,"i"],[120155,1,"j"],[120156,1,"k"],[120157,1,"l"],[120158,1,"m"],[120159,1,"n"],[120160,1,"o"],[120161,1,"p"],[120162,1,"q"],[120163,1,"r"],[120164,1,"s"],[120165,1,"t"],[120166,1,"u"],[120167,1,"v"],[120168,1,"w"],[120169,1,"x"],[120170,1,"y"],[120171,1,"z"],[120172,1,"a"],[120173,1,"b"],[120174,1,"c"],[120175,1,"d"],[120176,1,"e"],[120177,1,"f"],[120178,1,"g"],[120179,1,"h"],[120180,1,"i"],[120181,1,"j"],[120182,1,"k"],[120183,1,"l"],[120184,1,"m"],[120185,1,"n"],[120186,1,"o"],[120187,1,"p"],[120188,1,"q"],[120189,1,"r"],[120190,1,"s"],[120191,1,"t"],[120192,1,"u"],[120193,1,"v"],[120194,1,"w"],[120195,1,"x"],[120196,1,"y"],[120197,1,"z"],[120198,1,"a"],[120199,1,"b"],[120200,1,"c"],[120201,1,"d"],[120202,1,"e"],[120203,1,"f"],[120204,1,"g"],[120205,1,"h"],[120206,1,"i"],[120207,1,"j"],[120208,1,"k"],[120209,1,"l"],[120210,1,"m"],[120211,1,"n"],[120212,1,"o"],[120213,1,"p"],[120214,1,"q"],[120215,1,"r"],[120216,1,"s"],[120217,1,"t"],[120218,1,"u"],[120219,1,"v"],[120220,1,"w"],[120221,1,"x"],[120222,1,"y"],[120223,1,"z"],[120224,1,"a"],[120225,1,"b"],[120226,1,"c"],[120227,1,"d"],[120228,1,"e"],[120229,1,"f"],[120230,1,"g"],[120231,1,"h"],[120232,1,"i"],[120233,1,"j"],[120234,1,"k"],[120235,1,"l"],[120236,1,"m"],[120237,1,"n"],[120238,1,"o"],[120239,1,"p"],[120240,1,"q"],[120241,1,"r"],[120242,1,"s"],[120243,1,"t"],[120244,1,"u"],[120245,1,"v"],[120246,1,"w"],[120247,1,"x"],[120248,1,"y"],[120249,1,"z"],[120250,1,"a"],[120251,1,"b"],[120252,1,"c"],[120253,1,"d"],[120254,1,"e"],[120255,1,"f"],[120256,1,"g"],[120257,1,"h"],[120258,1,"i"],[120259,1,"j"],[120260,1,"k"],[120261,1,"l"],[120262,1,"m"],[120263,1,"n"],[120264,1,"o"],[120265,1,"p"],[120266,1,"q"],[120267,1,"r"],[120268,1,"s"],[120269,1,"t"],[120270,1,"u"],[120271,1,"v"],[120272,1,"w"],[120273,1,"x"],[120274,1,"y"],[120275,1,"z"],[120276,1,"a"],[120277,1,"b"],[120278,1,"c"],[120279,1,"d"],[120280,1,"e"],[120281,1,"f"],[120282,1,"g"],[120283,1,"h"],[120284,1,"i"],[120285,1,"j"],[120286,1,"k"],[120287,1,"l"],[120288,1,"m"],[120289,1,"n"],[120290,1,"o"],[120291,1,"p"],[120292,1,"q"],[120293,1,"r"],[120294,1,"s"],[120295,1,"t"],[120296,1,"u"],[120297,1,"v"],[120298,1,"w"],[120299,1,"x"],[120300,1,"y"],[120301,1,"z"],[120302,1,"a"],[120303,1,"b"],[120304,1,"c"],[120305,1,"d"],[120306,1,"e"],[120307,1,"f"],[120308,1,"g"],[120309,1,"h"],[120310,1,"i"],[120311,1,"j"],[120312,1,"k"],[120313,1,"l"],[120314,1,"m"],[120315,1,"n"],[120316,1,"o"],[120317,1,"p"],[120318,1,"q"],[120319,1,"r"],[120320,1,"s"],[120321,1,"t"],[120322,1,"u"],[120323,1,"v"],[120324,1,"w"],[120325,1,"x"],[120326,1,"y"],[120327,1,"z"],[120328,1,"a"],[120329,1,"b"],[120330,1,"c"],[120331,1,"d"],[120332,1,"e"],[120333,1,"f"],[120334,1,"g"],[120335,1,"h"],[120336,1,"i"],[120337,1,"j"],[120338,1,"k"],[120339,1,"l"],[120340,1,"m"],[120341,1,"n"],[120342,1,"o"],[120343,1,"p"],[120344,1,"q"],[120345,1,"r"],[120346,1,"s"],[120347,1,"t"],[120348,1,"u"],[120349,1,"v"],[120350,1,"w"],[120351,1,"x"],[120352,1,"y"],[120353,1,"z"],[120354,1,"a"],[120355,1,"b"],[120356,1,"c"],[120357,1,"d"],[120358,1,"e"],[120359,1,"f"],[120360,1,"g"],[120361,1,"h"],[120362,1,"i"],[120363,1,"j"],[120364,1,"k"],[120365,1,"l"],[120366,1,"m"],[120367,1,"n"],[120368,1,"o"],[120369,1,"p"],[120370,1,"q"],[120371,1,"r"],[120372,1,"s"],[120373,1,"t"],[120374,1,"u"],[120375,1,"v"],[120376,1,"w"],[120377,1,"x"],[120378,1,"y"],[120379,1,"z"],[120380,1,"a"],[120381,1,"b"],[120382,1,"c"],[120383,1,"d"],[120384,1,"e"],[120385,1,"f"],[120386,1,"g"],[120387,1,"h"],[120388,1,"i"],[120389,1,"j"],[120390,1,"k"],[120391,1,"l"],[120392,1,"m"],[120393,1,"n"],[120394,1,"o"],[120395,1,"p"],[120396,1,"q"],[120397,1,"r"],[120398,1,"s"],[120399,1,"t"],[120400,1,"u"],[120401,1,"v"],[120402,1,"w"],[120403,1,"x"],[120404,1,"y"],[120405,1,"z"],[120406,1,"a"],[120407,1,"b"],[120408,1,"c"],[120409,1,"d"],[120410,1,"e"],[120411,1,"f"],[120412,1,"g"],[120413,1,"h"],[120414,1,"i"],[120415,1,"j"],[120416,1,"k"],[120417,1,"l"],[120418,1,"m"],[120419,1,"n"],[120420,1,"o"],[120421,1,"p"],[120422,1,"q"],[120423,1,"r"],[120424,1,"s"],[120425,1,"t"],[120426,1,"u"],[120427,1,"v"],[120428,1,"w"],[120429,1,"x"],[120430,1,"y"],[120431,1,"z"],[120432,1,"a"],[120433,1,"b"],[120434,1,"c"],[120435,1,"d"],[120436,1,"e"],[120437,1,"f"],[120438,1,"g"],[120439,1,"h"],[120440,1,"i"],[120441,1,"j"],[120442,1,"k"],[120443,1,"l"],[120444,1,"m"],[120445,1,"n"],[120446,1,"o"],[120447,1,"p"],[120448,1,"q"],[120449,1,"r"],[120450,1,"s"],[120451,1,"t"],[120452,1,"u"],[120453,1,"v"],[120454,1,"w"],[120455,1,"x"],[120456,1,"y"],[120457,1,"z"],[120458,1,"a"],[120459,1,"b"],[120460,1,"c"],[120461,1,"d"],[120462,1,"e"],[120463,1,"f"],[120464,1,"g"],[120465,1,"h"],[120466,1,"i"],[120467,1,"j"],[120468,1,"k"],[120469,1,"l"],[120470,1,"m"],[120471,1,"n"],[120472,1,"o"],[120473,1,"p"],[120474,1,"q"],[120475,1,"r"],[120476,1,"s"],[120477,1,"t"],[120478,1,"u"],[120479,1,"v"],[120480,1,"w"],[120481,1,"x"],[120482,1,"y"],[120483,1,"z"],[120484,1,"ı"],[120485,1,"ȷ"],[[120486,120487],3],[120488,1,"α"],[120489,1,"β"],[120490,1,"γ"],[120491,1,"δ"],[120492,1,"ε"],[120493,1,"ζ"],[120494,1,"η"],[120495,1,"θ"],[120496,1,"ι"],[120497,1,"κ"],[120498,1,"λ"],[120499,1,"μ"],[120500,1,"ν"],[120501,1,"ξ"],[120502,1,"ο"],[120503,1,"π"],[120504,1,"ρ"],[120505,1,"θ"],[120506,1,"σ"],[120507,1,"τ"],[120508,1,"υ"],[120509,1,"φ"],[120510,1,"χ"],[120511,1,"ψ"],[120512,1,"ω"],[120513,1,"∇"],[120514,1,"α"],[120515,1,"β"],[120516,1,"γ"],[120517,1,"δ"],[120518,1,"ε"],[120519,1,"ζ"],[120520,1,"η"],[120521,1,"θ"],[120522,1,"ι"],[120523,1,"κ"],[120524,1,"λ"],[120525,1,"μ"],[120526,1,"ν"],[120527,1,"ξ"],[120528,1,"ο"],[120529,1,"π"],[120530,1,"ρ"],[[120531,120532],1,"σ"],[120533,1,"τ"],[120534,1,"υ"],[120535,1,"φ"],[120536,1,"χ"],[120537,1,"ψ"],[120538,1,"ω"],[120539,1,"∂"],[120540,1,"ε"],[120541,1,"θ"],[120542,1,"κ"],[120543,1,"φ"],[120544,1,"ρ"],[120545,1,"π"],[120546,1,"α"],[120547,1,"β"],[120548,1,"γ"],[120549,1,"δ"],[120550,1,"ε"],[120551,1,"ζ"],[120552,1,"η"],[120553,1,"θ"],[120554,1,"ι"],[120555,1,"κ"],[120556,1,"λ"],[120557,1,"μ"],[120558,1,"ν"],[120559,1,"ξ"],[120560,1,"ο"],[120561,1,"π"],[120562,1,"ρ"],[120563,1,"θ"],[120564,1,"σ"],[120565,1,"τ"],[120566,1,"υ"],[120567,1,"φ"],[120568,1,"χ"],[120569,1,"ψ"],[120570,1,"ω"],[120571,1,"∇"],[120572,1,"α"],[120573,1,"β"],[120574,1,"γ"],[120575,1,"δ"],[120576,1,"ε"],[120577,1,"ζ"],[120578,1,"η"],[120579,1,"θ"],[120580,1,"ι"],[120581,1,"κ"],[120582,1,"λ"],[120583,1,"μ"],[120584,1,"ν"],[120585,1,"ξ"],[120586,1,"ο"],[120587,1,"π"],[120588,1,"ρ"],[[120589,120590],1,"σ"],[120591,1,"τ"],[120592,1,"υ"],[120593,1,"φ"],[120594,1,"χ"],[120595,1,"ψ"],[120596,1,"ω"],[120597,1,"∂"],[120598,1,"ε"],[120599,1,"θ"],[120600,1,"κ"],[120601,1,"φ"],[120602,1,"ρ"],[120603,1,"π"],[120604,1,"α"],[120605,1,"β"],[120606,1,"γ"],[120607,1,"δ"],[120608,1,"ε"],[120609,1,"ζ"],[120610,1,"η"],[120611,1,"θ"],[120612,1,"ι"],[120613,1,"κ"],[120614,1,"λ"],[120615,1,"μ"],[120616,1,"ν"],[120617,1,"ξ"],[120618,1,"ο"],[120619,1,"π"],[120620,1,"ρ"],[120621,1,"θ"],[120622,1,"σ"],[120623,1,"τ"],[120624,1,"υ"],[120625,1,"φ"],[120626,1,"χ"],[120627,1,"ψ"],[120628,1,"ω"],[120629,1,"∇"],[120630,1,"α"],[120631,1,"β"],[120632,1,"γ"],[120633,1,"δ"],[120634,1,"ε"],[120635,1,"ζ"],[120636,1,"η"],[120637,1,"θ"],[120638,1,"ι"],[120639,1,"κ"],[120640,1,"λ"],[120641,1,"μ"],[120642,1,"ν"],[120643,1,"ξ"],[120644,1,"ο"],[120645,1,"π"],[120646,1,"ρ"],[[120647,120648],1,"σ"],[120649,1,"τ"],[120650,1,"υ"],[120651,1,"φ"],[120652,1,"χ"],[120653,1,"ψ"],[120654,1,"ω"],[120655,1,"∂"],[120656,1,"ε"],[120657,1,"θ"],[120658,1,"κ"],[120659,1,"φ"],[120660,1,"ρ"],[120661,1,"π"],[120662,1,"α"],[120663,1,"β"],[120664,1,"γ"],[120665,1,"δ"],[120666,1,"ε"],[120667,1,"ζ"],[120668,1,"η"],[120669,1,"θ"],[120670,1,"ι"],[120671,1,"κ"],[120672,1,"λ"],[120673,1,"μ"],[120674,1,"ν"],[120675,1,"ξ"],[120676,1,"ο"],[120677,1,"π"],[120678,1,"ρ"],[120679,1,"θ"],[120680,1,"σ"],[120681,1,"τ"],[120682,1,"υ"],[120683,1,"φ"],[120684,1,"χ"],[120685,1,"ψ"],[120686,1,"ω"],[120687,1,"∇"],[120688,1,"α"],[120689,1,"β"],[120690,1,"γ"],[120691,1,"δ"],[120692,1,"ε"],[120693,1,"ζ"],[120694,1,"η"],[120695,1,"θ"],[120696,1,"ι"],[120697,1,"κ"],[120698,1,"λ"],[120699,1,"μ"],[120700,1,"ν"],[120701,1,"ξ"],[120702,1,"ο"],[120703,1,"π"],[120704,1,"ρ"],[[120705,120706],1,"σ"],[120707,1,"τ"],[120708,1,"υ"],[120709,1,"φ"],[120710,1,"χ"],[120711,1,"ψ"],[120712,1,"ω"],[120713,1,"∂"],[120714,1,"ε"],[120715,1,"θ"],[120716,1,"κ"],[120717,1,"φ"],[120718,1,"ρ"],[120719,1,"π"],[120720,1,"α"],[120721,1,"β"],[120722,1,"γ"],[120723,1,"δ"],[120724,1,"ε"],[120725,1,"ζ"],[120726,1,"η"],[120727,1,"θ"],[120728,1,"ι"],[120729,1,"κ"],[120730,1,"λ"],[120731,1,"μ"],[120732,1,"ν"],[120733,1,"ξ"],[120734,1,"ο"],[120735,1,"π"],[120736,1,"ρ"],[120737,1,"θ"],[120738,1,"σ"],[120739,1,"τ"],[120740,1,"υ"],[120741,1,"φ"],[120742,1,"χ"],[120743,1,"ψ"],[120744,1,"ω"],[120745,1,"∇"],[120746,1,"α"],[120747,1,"β"],[120748,1,"γ"],[120749,1,"δ"],[120750,1,"ε"],[120751,1,"ζ"],[120752,1,"η"],[120753,1,"θ"],[120754,1,"ι"],[120755,1,"κ"],[120756,1,"λ"],[120757,1,"μ"],[120758,1,"ν"],[120759,1,"ξ"],[120760,1,"ο"],[120761,1,"π"],[120762,1,"ρ"],[[120763,120764],1,"σ"],[120765,1,"τ"],[120766,1,"υ"],[120767,1,"φ"],[120768,1,"χ"],[120769,1,"ψ"],[120770,1,"ω"],[120771,1,"∂"],[120772,1,"ε"],[120773,1,"θ"],[120774,1,"κ"],[120775,1,"φ"],[120776,1,"ρ"],[120777,1,"π"],[[120778,120779],1,"ϝ"],[[120780,120781],3],[120782,1,"0"],[120783,1,"1"],[120784,1,"2"],[120785,1,"3"],[120786,1,"4"],[120787,1,"5"],[120788,1,"6"],[120789,1,"7"],[120790,1,"8"],[120791,1,"9"],[120792,1,"0"],[120793,1,"1"],[120794,1,"2"],[120795,1,"3"],[120796,1,"4"],[120797,1,"5"],[120798,1,"6"],[120799,1,"7"],[120800,1,"8"],[120801,1,"9"],[120802,1,"0"],[120803,1,"1"],[120804,1,"2"],[120805,1,"3"],[120806,1,"4"],[120807,1,"5"],[120808,1,"6"],[120809,1,"7"],[120810,1,"8"],[120811,1,"9"],[120812,1,"0"],[120813,1,"1"],[120814,1,"2"],[120815,1,"3"],[120816,1,"4"],[120817,1,"5"],[120818,1,"6"],[120819,1,"7"],[120820,1,"8"],[120821,1,"9"],[120822,1,"0"],[120823,1,"1"],[120824,1,"2"],[120825,1,"3"],[120826,1,"4"],[120827,1,"5"],[120828,1,"6"],[120829,1,"7"],[120830,1,"8"],[120831,1,"9"],[[120832,121343],2],[[121344,121398],2],[[121399,121402],2],[[121403,121452],2],[[121453,121460],2],[121461,2],[[121462,121475],2],[121476,2],[[121477,121483],2],[[121484,121498],3],[[121499,121503],2],[121504,3],[[121505,121519],2],[[121520,122623],3],[[122624,122654],2],[[122655,122879],3],[[122880,122886],2],[122887,3],[[122888,122904],2],[[122905,122906],3],[[122907,122913],2],[122914,3],[[122915,122916],2],[122917,3],[[122918,122922],2],[[122923,123135],3],[[123136,123180],2],[[123181,123183],3],[[123184,123197],2],[[123198,123199],3],[[123200,123209],2],[[123210,123213],3],[123214,2],[123215,2],[[123216,123535],3],[[123536,123566],2],[[123567,123583],3],[[123584,123641],2],[[123642,123646],3],[123647,2],[[123648,124895],3],[[124896,124902],2],[124903,3],[[124904,124907],2],[124908,3],[[124909,124910],2],[124911,3],[[124912,124926],2],[124927,3],[[124928,125124],2],[[125125,125126],3],[[125127,125135],2],[[125136,125142],2],[[125143,125183],3],[125184,1,"𞤢"],[125185,1,"𞤣"],[125186,1,"𞤤"],[125187,1,"𞤥"],[125188,1,"𞤦"],[125189,1,"𞤧"],[125190,1,"𞤨"],[125191,1,"𞤩"],[125192,1,"𞤪"],[125193,1,"𞤫"],[125194,1,"𞤬"],[125195,1,"𞤭"],[125196,1,"𞤮"],[125197,1,"𞤯"],[125198,1,"𞤰"],[125199,1,"𞤱"],[125200,1,"𞤲"],[125201,1,"𞤳"],[125202,1,"𞤴"],[125203,1,"𞤵"],[125204,1,"𞤶"],[125205,1,"𞤷"],[125206,1,"𞤸"],[125207,1,"𞤹"],[125208,1,"𞤺"],[125209,1,"𞤻"],[125210,1,"𞤼"],[125211,1,"𞤽"],[125212,1,"𞤾"],[125213,1,"𞤿"],[125214,1,"𞥀"],[125215,1,"𞥁"],[125216,1,"𞥂"],[125217,1,"𞥃"],[[125218,125258],2],[125259,2],[[125260,125263],3],[[125264,125273],2],[[125274,125277],3],[[125278,125279],2],[[125280,126064],3],[[126065,126132],2],[[126133,126208],3],[[126209,126269],2],[[126270,126463],3],[126464,1,"ا"],[126465,1,"ب"],[126466,1,"ج"],[126467,1,"د"],[126468,3],[126469,1,"و"],[126470,1,"ز"],[126471,1,"ح"],[126472,1,"ط"],[126473,1,"ي"],[126474,1,"ك"],[126475,1,"ل"],[126476,1,"م"],[126477,1,"ن"],[126478,1,"س"],[126479,1,"ع"],[126480,1,"ف"],[126481,1,"ص"],[126482,1,"ق"],[126483,1,"ر"],[126484,1,"ش"],[126485,1,"ت"],[126486,1,"ث"],[126487,1,"خ"],[126488,1,"ذ"],[126489,1,"ض"],[126490,1,"ظ"],[126491,1,"غ"],[126492,1,"ٮ"],[126493,1,"ں"],[126494,1,"ڡ"],[126495,1,"ٯ"],[126496,3],[126497,1,"ب"],[126498,1,"ج"],[126499,3],[126500,1,"ه"],[[126501,126502],3],[126503,1,"ح"],[126504,3],[126505,1,"ي"],[126506,1,"ك"],[126507,1,"ل"],[126508,1,"م"],[126509,1,"ن"],[126510,1,"س"],[126511,1,"ع"],[126512,1,"ف"],[126513,1,"ص"],[126514,1,"ق"],[126515,3],[126516,1,"ش"],[126517,1,"ت"],[126518,1,"ث"],[126519,1,"خ"],[126520,3],[126521,1,"ض"],[126522,3],[126523,1,"غ"],[[126524,126529],3],[126530,1,"ج"],[[126531,126534],3],[126535,1,"ح"],[126536,3],[126537,1,"ي"],[126538,3],[126539,1,"ل"],[126540,3],[126541,1,"ن"],[126542,1,"س"],[126543,1,"ع"],[126544,3],[126545,1,"ص"],[126546,1,"ق"],[126547,3],[126548,1,"ش"],[[126549,126550],3],[126551,1,"خ"],[126552,3],[126553,1,"ض"],[126554,3],[126555,1,"غ"],[126556,3],[126557,1,"ں"],[126558,3],[126559,1,"ٯ"],[126560,3],[126561,1,"ب"],[126562,1,"ج"],[126563,3],[126564,1,"ه"],[[126565,126566],3],[126567,1,"ح"],[126568,1,"ط"],[126569,1,"ي"],[126570,1,"ك"],[126571,3],[126572,1,"م"],[126573,1,"ن"],[126574,1,"س"],[126575,1,"ع"],[126576,1,"ف"],[126577,1,"ص"],[126578,1,"ق"],[126579,3],[126580,1,"ش"],[126581,1,"ت"],[126582,1,"ث"],[126583,1,"خ"],[126584,3],[126585,1,"ض"],[126586,1,"ظ"],[126587,1,"غ"],[126588,1,"ٮ"],[126589,3],[126590,1,"ڡ"],[126591,3],[126592,1,"ا"],[126593,1,"ب"],[126594,1,"ج"],[126595,1,"د"],[126596,1,"ه"],[126597,1,"و"],[126598,1,"ز"],[126599,1,"ح"],[126600,1,"ط"],[126601,1,"ي"],[126602,3],[126603,1,"ل"],[126604,1,"م"],[126605,1,"ن"],[126606,1,"س"],[126607,1,"ع"],[126608,1,"ف"],[126609,1,"ص"],[126610,1,"ق"],[126611,1,"ر"],[126612,1,"ش"],[126613,1,"ت"],[126614,1,"ث"],[126615,1,"خ"],[126616,1,"ذ"],[126617,1,"ض"],[126618,1,"ظ"],[126619,1,"غ"],[[126620,126624],3],[126625,1,"ب"],[126626,1,"ج"],[126627,1,"د"],[126628,3],[126629,1,"و"],[126630,1,"ز"],[126631,1,"ح"],[126632,1,"ط"],[126633,1,"ي"],[126634,3],[126635,1,"ل"],[126636,1,"م"],[126637,1,"ن"],[126638,1,"س"],[126639,1,"ع"],[126640,1,"ف"],[126641,1,"ص"],[126642,1,"ق"],[126643,1,"ر"],[126644,1,"ش"],[126645,1,"ت"],[126646,1,"ث"],[126647,1,"خ"],[126648,1,"ذ"],[126649,1,"ض"],[126650,1,"ظ"],[126651,1,"غ"],[[126652,126703],3],[[126704,126705],2],[[126706,126975],3],[[126976,127019],2],[[127020,127023],3],[[127024,127123],2],[[127124,127135],3],[[127136,127150],2],[[127151,127152],3],[[127153,127166],2],[127167,2],[127168,3],[[127169,127183],2],[127184,3],[[127185,127199],2],[[127200,127221],2],[[127222,127231],3],[127232,3],[127233,5,"0,"],[127234,5,"1,"],[127235,5,"2,"],[127236,5,"3,"],[127237,5,"4,"],[127238,5,"5,"],[127239,5,"6,"],[127240,5,"7,"],[127241,5,"8,"],[127242,5,"9,"],[[127243,127244],2],[[127245,127247],2],[127248,5,"(a)"],[127249,5,"(b)"],[127250,5,"(c)"],[127251,5,"(d)"],[127252,5,"(e)"],[127253,5,"(f)"],[127254,5,"(g)"],[127255,5,"(h)"],[127256,5,"(i)"],[127257,5,"(j)"],[127258,5,"(k)"],[127259,5,"(l)"],[127260,5,"(m)"],[127261,5,"(n)"],[127262,5,"(o)"],[127263,5,"(p)"],[127264,5,"(q)"],[127265,5,"(r)"],[127266,5,"(s)"],[127267,5,"(t)"],[127268,5,"(u)"],[127269,5,"(v)"],[127270,5,"(w)"],[127271,5,"(x)"],[127272,5,"(y)"],[127273,5,"(z)"],[127274,1,"〔s〕"],[127275,1,"c"],[127276,1,"r"],[127277,1,"cd"],[127278,1,"wz"],[127279,2],[127280,1,"a"],[127281,1,"b"],[127282,1,"c"],[127283,1,"d"],[127284,1,"e"],[127285,1,"f"],[127286,1,"g"],[127287,1,"h"],[127288,1,"i"],[127289,1,"j"],[127290,1,"k"],[127291,1,"l"],[127292,1,"m"],[127293,1,"n"],[127294,1,"o"],[127295,1,"p"],[127296,1,"q"],[127297,1,"r"],[127298,1,"s"],[127299,1,"t"],[127300,1,"u"],[127301,1,"v"],[127302,1,"w"],[127303,1,"x"],[127304,1,"y"],[127305,1,"z"],[127306,1,"hv"],[127307,1,"mv"],[127308,1,"sd"],[127309,1,"ss"],[127310,1,"ppv"],[127311,1,"wc"],[[127312,127318],2],[127319,2],[[127320,127326],2],[127327,2],[[127328,127337],2],[127338,1,"mc"],[127339,1,"md"],[127340,1,"mr"],[[127341,127343],2],[[127344,127352],2],[127353,2],[127354,2],[[127355,127356],2],[[127357,127358],2],[127359,2],[[127360,127369],2],[[127370,127373],2],[[127374,127375],2],[127376,1,"dj"],[[127377,127386],2],[[127387,127404],2],[127405,2],[[127406,127461],3],[[127462,127487],2],[127488,1,"ほか"],[127489,1,"ココ"],[127490,1,"サ"],[[127491,127503],3],[127504,1,"手"],[127505,1,"字"],[127506,1,"双"],[127507,1,"デ"],[127508,1,"二"],[127509,1,"多"],[127510,1,"解"],[127511,1,"天"],[127512,1,"交"],[127513,1,"映"],[127514,1,"無"],[127515,1,"料"],[127516,1,"前"],[127517,1,"後"],[127518,1,"再"],[127519,1,"新"],[127520,1,"初"],[127521,1,"終"],[127522,1,"生"],[127523,1,"販"],[127524,1,"声"],[127525,1,"吹"],[127526,1,"演"],[127527,1,"投"],[127528,1,"捕"],[127529,1,"一"],[127530,1,"三"],[127531,1,"遊"],[127532,1,"左"],[127533,1,"中"],[127534,1,"右"],[127535,1,"指"],[127536,1,"走"],[127537,1,"打"],[127538,1,"禁"],[127539,1,"空"],[127540,1,"合"],[127541,1,"満"],[127542,1,"有"],[127543,1,"月"],[127544,1,"申"],[127545,1,"割"],[127546,1,"営"],[127547,1,"配"],[[127548,127551],3],[127552,1,"〔本〕"],[127553,1,"〔三〕"],[127554,1,"〔二〕"],[127555,1,"〔安〕"],[127556,1,"〔点〕"],[127557,1,"〔打〕"],[127558,1,"〔盗〕"],[127559,1,"〔勝〕"],[127560,1,"〔敗〕"],[[127561,127567],3],[127568,1,"得"],[127569,1,"可"],[[127570,127583],3],[[127584,127589],2],[[127590,127743],3],[[127744,127776],2],[[127777,127788],2],[[127789,127791],2],[[127792,127797],2],[127798,2],[[127799,127868],2],[127869,2],[[127870,127871],2],[[127872,127891],2],[[127892,127903],2],[[127904,127940],2],[127941,2],[[127942,127946],2],[[127947,127950],2],[[127951,127955],2],[[127956,127967],2],[[127968,127984],2],[[127985,127991],2],[[127992,127999],2],[[128000,128062],2],[128063,2],[128064,2],[128065,2],[[128066,128247],2],[128248,2],[[128249,128252],2],[[128253,128254],2],[128255,2],[[128256,128317],2],[[128318,128319],2],[[128320,128323],2],[[128324,128330],2],[[128331,128335],2],[[128336,128359],2],[[128360,128377],2],[128378,2],[[128379,128419],2],[128420,2],[[128421,128506],2],[[128507,128511],2],[128512,2],[[128513,128528],2],[128529,2],[[128530,128532],2],[128533,2],[128534,2],[128535,2],[128536,2],[128537,2],[128538,2],[128539,2],[[128540,128542],2],[128543,2],[[128544,128549],2],[[128550,128551],2],[[128552,128555],2],[128556,2],[128557,2],[[128558,128559],2],[[128560,128563],2],[128564,2],[[128565,128576],2],[[128577,128578],2],[[128579,128580],2],[[128581,128591],2],[[128592,128639],2],[[128640,128709],2],[[128710,128719],2],[128720,2],[[128721,128722],2],[[128723,128724],2],[128725,2],[[128726,128727],2],[[128728,128732],3],[[128733,128735],2],[[128736,128748],2],[[128749,128751],3],[[128752,128755],2],[[128756,128758],2],[[128759,128760],2],[128761,2],[128762,2],[[128763,128764],2],[[128765,128767],3],[[128768,128883],2],[[128884,128895],3],[[128896,128980],2],[[128981,128984],2],[[128985,128991],3],[[128992,129003],2],[[129004,129007],3],[129008,2],[[129009,129023],3],[[129024,129035],2],[[129036,129039],3],[[129040,129095],2],[[129096,129103],3],[[129104,129113],2],[[129114,129119],3],[[129120,129159],2],[[129160,129167],3],[[129168,129197],2],[[129198,129199],3],[[129200,129201],2],[[129202,129279],3],[[129280,129291],2],[129292,2],[[129293,129295],2],[[129296,129304],2],[[129305,129310],2],[129311,2],[[129312,129319],2],[[129320,129327],2],[129328,2],[[129329,129330],2],[[129331,129342],2],[129343,2],[[129344,129355],2],[129356,2],[[129357,129359],2],[[129360,129374],2],[[129375,129387],2],[[129388,129392],2],[129393,2],[129394,2],[[129395,129398],2],[[129399,129400],2],[129401,2],[129402,2],[129403,2],[[129404,129407],2],[[129408,129412],2],[[129413,129425],2],[[129426,129431],2],[[129432,129442],2],[[129443,129444],2],[[129445,129450],2],[[129451,129453],2],[[129454,129455],2],[[129456,129465],2],[[129466,129471],2],[129472,2],[[129473,129474],2],[[129475,129482],2],[129483,2],[129484,2],[[129485,129487],2],[[129488,129510],2],[[129511,129535],2],[[129536,129619],2],[[129620,129631],3],[[129632,129645],2],[[129646,129647],3],[[129648,129651],2],[129652,2],[[129653,129655],3],[[129656,129658],2],[[129659,129660],2],[[129661,129663],3],[[129664,129666],2],[[129667,129670],2],[[129671,129679],3],[[129680,129685],2],[[129686,129704],2],[[129705,129708],2],[[129709,129711],3],[[129712,129718],2],[[129719,129722],2],[[129723,129727],3],[[129728,129730],2],[[129731,129733],2],[[129734,129743],3],[[129744,129750],2],[[129751,129753],2],[[129754,129759],3],[[129760,129767],2],[[129768,129775],3],[[129776,129782],2],[[129783,129791],3],[[129792,129938],2],[129939,3],[[129940,129994],2],[[129995,130031],3],[130032,1,"0"],[130033,1,"1"],[130034,1,"2"],[130035,1,"3"],[130036,1,"4"],[130037,1,"5"],[130038,1,"6"],[130039,1,"7"],[130040,1,"8"],[130041,1,"9"],[[130042,131069],3],[[131070,131071],3],[[131072,173782],2],[[173783,173789],2],[[173790,173791],2],[[173792,173823],3],[[173824,177972],2],[[177973,177976],2],[[177977,177983],3],[[177984,178205],2],[[178206,178207],3],[[178208,183969],2],[[183970,183983],3],[[183984,191456],2],[[191457,194559],3],[194560,1,"丽"],[194561,1,"丸"],[194562,1,"乁"],[194563,1,"𠄢"],[194564,1,"你"],[194565,1,"侮"],[194566,1,"侻"],[194567,1,"倂"],[194568,1,"偺"],[194569,1,"備"],[194570,1,"僧"],[194571,1,"像"],[194572,1,"㒞"],[194573,1,"𠘺"],[194574,1,"免"],[194575,1,"兔"],[194576,1,"兤"],[194577,1,"具"],[194578,1,"𠔜"],[194579,1,"㒹"],[194580,1,"內"],[194581,1,"再"],[194582,1,"𠕋"],[194583,1,"冗"],[194584,1,"冤"],[194585,1,"仌"],[194586,1,"冬"],[194587,1,"况"],[194588,1,"𩇟"],[194589,1,"凵"],[194590,1,"刃"],[194591,1,"㓟"],[194592,1,"刻"],[194593,1,"剆"],[194594,1,"割"],[194595,1,"剷"],[194596,1,"㔕"],[194597,1,"勇"],[194598,1,"勉"],[194599,1,"勤"],[194600,1,"勺"],[194601,1,"包"],[194602,1,"匆"],[194603,1,"北"],[194604,1,"卉"],[194605,1,"卑"],[194606,1,"博"],[194607,1,"即"],[194608,1,"卽"],[[194609,194611],1,"卿"],[194612,1,"𠨬"],[194613,1,"灰"],[194614,1,"及"],[194615,1,"叟"],[194616,1,"𠭣"],[194617,1,"叫"],[194618,1,"叱"],[194619,1,"吆"],[194620,1,"咞"],[194621,1,"吸"],[194622,1,"呈"],[194623,1,"周"],[194624,1,"咢"],[194625,1,"哶"],[194626,1,"唐"],[194627,1,"啓"],[194628,1,"啣"],[[194629,194630],1,"善"],[194631,1,"喙"],[194632,1,"喫"],[194633,1,"喳"],[194634,1,"嗂"],[194635,1,"圖"],[194636,1,"嘆"],[194637,1,"圗"],[194638,1,"噑"],[194639,1,"噴"],[194640,1,"切"],[194641,1,"壮"],[194642,1,"城"],[194643,1,"埴"],[194644,1,"堍"],[194645,1,"型"],[194646,1,"堲"],[194647,1,"報"],[194648,1,"墬"],[194649,1,"𡓤"],[194650,1,"売"],[194651,1,"壷"],[194652,1,"夆"],[194653,1,"多"],[194654,1,"夢"],[194655,1,"奢"],[194656,1,"𡚨"],[194657,1,"𡛪"],[194658,1,"姬"],[194659,1,"娛"],[194660,1,"娧"],[194661,1,"姘"],[194662,1,"婦"],[194663,1,"㛮"],[194664,3],[194665,1,"嬈"],[[194666,194667],1,"嬾"],[194668,1,"𡧈"],[194669,1,"寃"],[194670,1,"寘"],[194671,1,"寧"],[194672,1,"寳"],[194673,1,"𡬘"],[194674,1,"寿"],[194675,1,"将"],[194676,3],[194677,1,"尢"],[194678,1,"㞁"],[194679,1,"屠"],[194680,1,"屮"],[194681,1,"峀"],[194682,1,"岍"],[194683,1,"𡷤"],[194684,1,"嵃"],[194685,1,"𡷦"],[194686,1,"嵮"],[194687,1,"嵫"],[194688,1,"嵼"],[194689,1,"巡"],[194690,1,"巢"],[194691,1,"㠯"],[194692,1,"巽"],[194693,1,"帨"],[194694,1,"帽"],[194695,1,"幩"],[194696,1,"㡢"],[194697,1,"𢆃"],[194698,1,"㡼"],[194699,1,"庰"],[194700,1,"庳"],[194701,1,"庶"],[194702,1,"廊"],[194703,1,"𪎒"],[194704,1,"廾"],[[194705,194706],1,"𢌱"],[194707,1,"舁"],[[194708,194709],1,"弢"],[194710,1,"㣇"],[194711,1,"𣊸"],[194712,1,"𦇚"],[194713,1,"形"],[194714,1,"彫"],[194715,1,"㣣"],[194716,1,"徚"],[194717,1,"忍"],[194718,1,"志"],[194719,1,"忹"],[194720,1,"悁"],[194721,1,"㤺"],[194722,1,"㤜"],[194723,1,"悔"],[194724,1,"𢛔"],[194725,1,"惇"],[194726,1,"慈"],[194727,1,"慌"],[194728,1,"慎"],[194729,1,"慌"],[194730,1,"慺"],[194731,1,"憎"],[194732,1,"憲"],[194733,1,"憤"],[194734,1,"憯"],[194735,1,"懞"],[194736,1,"懲"],[194737,1,"懶"],[194738,1,"成"],[194739,1,"戛"],[194740,1,"扝"],[194741,1,"抱"],[194742,1,"拔"],[194743,1,"捐"],[194744,1,"𢬌"],[194745,1,"挽"],[194746,1,"拼"],[194747,1,"捨"],[194748,1,"掃"],[194749,1,"揤"],[194750,1,"𢯱"],[194751,1,"搢"],[194752,1,"揅"],[194753,1,"掩"],[194754,1,"㨮"],[194755,1,"摩"],[194756,1,"摾"],[194757,1,"撝"],[194758,1,"摷"],[194759,1,"㩬"],[194760,1,"敏"],[194761,1,"敬"],[194762,1,"𣀊"],[194763,1,"旣"],[194764,1,"書"],[194765,1,"晉"],[194766,1,"㬙"],[194767,1,"暑"],[194768,1,"㬈"],[194769,1,"㫤"],[194770,1,"冒"],[194771,1,"冕"],[194772,1,"最"],[194773,1,"暜"],[194774,1,"肭"],[194775,1,"䏙"],[194776,1,"朗"],[194777,1,"望"],[194778,1,"朡"],[194779,1,"杞"],[194780,1,"杓"],[194781,1,"𣏃"],[194782,1,"㭉"],[194783,1,"柺"],[194784,1,"枅"],[194785,1,"桒"],[194786,1,"梅"],[194787,1,"𣑭"],[194788,1,"梎"],[194789,1,"栟"],[194790,1,"椔"],[194791,1,"㮝"],[194792,1,"楂"],[194793,1,"榣"],[194794,1,"槪"],[194795,1,"檨"],[194796,1,"𣚣"],[194797,1,"櫛"],[194798,1,"㰘"],[194799,1,"次"],[194800,1,"𣢧"],[194801,1,"歔"],[194802,1,"㱎"],[194803,1,"歲"],[194804,1,"殟"],[194805,1,"殺"],[194806,1,"殻"],[194807,1,"𣪍"],[194808,1,"𡴋"],[194809,1,"𣫺"],[194810,1,"汎"],[194811,1,"𣲼"],[194812,1,"沿"],[194813,1,"泍"],[194814,1,"汧"],[194815,1,"洖"],[194816,1,"派"],[194817,1,"海"],[194818,1,"流"],[194819,1,"浩"],[194820,1,"浸"],[194821,1,"涅"],[194822,1,"𣴞"],[194823,1,"洴"],[194824,1,"港"],[194825,1,"湮"],[194826,1,"㴳"],[194827,1,"滋"],[194828,1,"滇"],[194829,1,"𣻑"],[194830,1,"淹"],[194831,1,"潮"],[194832,1,"𣽞"],[194833,1,"𣾎"],[194834,1,"濆"],[194835,1,"瀹"],[194836,1,"瀞"],[194837,1,"瀛"],[194838,1,"㶖"],[194839,1,"灊"],[194840,1,"災"],[194841,1,"灷"],[194842,1,"炭"],[194843,1,"𠔥"],[194844,1,"煅"],[194845,1,"𤉣"],[194846,1,"熜"],[194847,3],[194848,1,"爨"],[194849,1,"爵"],[194850,1,"牐"],[194851,1,"𤘈"],[194852,1,"犀"],[194853,1,"犕"],[194854,1,"𤜵"],[194855,1,"𤠔"],[194856,1,"獺"],[194857,1,"王"],[194858,1,"㺬"],[194859,1,"玥"],[[194860,194861],1,"㺸"],[194862,1,"瑇"],[194863,1,"瑜"],[194864,1,"瑱"],[194865,1,"璅"],[194866,1,"瓊"],[194867,1,"㼛"],[194868,1,"甤"],[194869,1,"𤰶"],[194870,1,"甾"],[194871,1,"𤲒"],[194872,1,"異"],[194873,1,"𢆟"],[194874,1,"瘐"],[194875,1,"𤾡"],[194876,1,"𤾸"],[194877,1,"𥁄"],[194878,1,"㿼"],[194879,1,"䀈"],[194880,1,"直"],[194881,1,"𥃳"],[194882,1,"𥃲"],[194883,1,"𥄙"],[194884,1,"𥄳"],[194885,1,"眞"],[[194886,194887],1,"真"],[194888,1,"睊"],[194889,1,"䀹"],[194890,1,"瞋"],[194891,1,"䁆"],[194892,1,"䂖"],[194893,1,"𥐝"],[194894,1,"硎"],[194895,1,"碌"],[194896,1,"磌"],[194897,1,"䃣"],[194898,1,"𥘦"],[194899,1,"祖"],[194900,1,"𥚚"],[194901,1,"𥛅"],[194902,1,"福"],[194903,1,"秫"],[194904,1,"䄯"],[194905,1,"穀"],[194906,1,"穊"],[194907,1,"穏"],[194908,1,"𥥼"],[[194909,194910],1,"𥪧"],[194911,3],[194912,1,"䈂"],[194913,1,"𥮫"],[194914,1,"篆"],[194915,1,"築"],[194916,1,"䈧"],[194917,1,"𥲀"],[194918,1,"糒"],[194919,1,"䊠"],[194920,1,"糨"],[194921,1,"糣"],[194922,1,"紀"],[194923,1,"𥾆"],[194924,1,"絣"],[194925,1,"䌁"],[194926,1,"緇"],[194927,1,"縂"],[194928,1,"繅"],[194929,1,"䌴"],[194930,1,"𦈨"],[194931,1,"𦉇"],[194932,1,"䍙"],[194933,1,"𦋙"],[194934,1,"罺"],[194935,1,"𦌾"],[194936,1,"羕"],[194937,1,"翺"],[194938,1,"者"],[194939,1,"𦓚"],[194940,1,"𦔣"],[194941,1,"聠"],[194942,1,"𦖨"],[194943,1,"聰"],[194944,1,"𣍟"],[194945,1,"䏕"],[194946,1,"育"],[194947,1,"脃"],[194948,1,"䐋"],[194949,1,"脾"],[194950,1,"媵"],[194951,1,"𦞧"],[194952,1,"𦞵"],[194953,1,"𣎓"],[194954,1,"𣎜"],[194955,1,"舁"],[194956,1,"舄"],[194957,1,"辞"],[194958,1,"䑫"],[194959,1,"芑"],[194960,1,"芋"],[194961,1,"芝"],[194962,1,"劳"],[194963,1,"花"],[194964,1,"芳"],[194965,1,"芽"],[194966,1,"苦"],[194967,1,"𦬼"],[194968,1,"若"],[194969,1,"茝"],[194970,1,"荣"],[194971,1,"莭"],[194972,1,"茣"],[194973,1,"莽"],[194974,1,"菧"],[194975,1,"著"],[194976,1,"荓"],[194977,1,"菊"],[194978,1,"菌"],[194979,1,"菜"],[194980,1,"𦰶"],[194981,1,"𦵫"],[194982,1,"𦳕"],[194983,1,"䔫"],[194984,1,"蓱"],[194985,1,"蓳"],[194986,1,"蔖"],[194987,1,"𧏊"],[194988,1,"蕤"],[194989,1,"𦼬"],[194990,1,"䕝"],[194991,1,"䕡"],[194992,1,"𦾱"],[194993,1,"𧃒"],[194994,1,"䕫"],[194995,1,"虐"],[194996,1,"虜"],[194997,1,"虧"],[194998,1,"虩"],[194999,1,"蚩"],[195000,1,"蚈"],[195001,1,"蜎"],[195002,1,"蛢"],[195003,1,"蝹"],[195004,1,"蜨"],[195005,1,"蝫"],[195006,1,"螆"],[195007,3],[195008,1,"蟡"],[195009,1,"蠁"],[195010,1,"䗹"],[195011,1,"衠"],[195012,1,"衣"],[195013,1,"𧙧"],[195014,1,"裗"],[195015,1,"裞"],[195016,1,"䘵"],[195017,1,"裺"],[195018,1,"㒻"],[195019,1,"𧢮"],[195020,1,"𧥦"],[195021,1,"䚾"],[195022,1,"䛇"],[195023,1,"誠"],[195024,1,"諭"],[195025,1,"變"],[195026,1,"豕"],[195027,1,"𧲨"],[195028,1,"貫"],[195029,1,"賁"],[195030,1,"贛"],[195031,1,"起"],[195032,1,"𧼯"],[195033,1,"𠠄"],[195034,1,"跋"],[195035,1,"趼"],[195036,1,"跰"],[195037,1,"𠣞"],[195038,1,"軔"],[195039,1,"輸"],[195040,1,"𨗒"],[195041,1,"𨗭"],[195042,1,"邔"],[195043,1,"郱"],[195044,1,"鄑"],[195045,1,"𨜮"],[195046,1,"鄛"],[195047,1,"鈸"],[195048,1,"鋗"],[195049,1,"鋘"],[195050,1,"鉼"],[195051,1,"鏹"],[195052,1,"鐕"],[195053,1,"𨯺"],[195054,1,"開"],[195055,1,"䦕"],[195056,1,"閷"],[195057,1,"𨵷"],[195058,1,"䧦"],[195059,1,"雃"],[195060,1,"嶲"],[195061,1,"霣"],[195062,1,"𩅅"],[195063,1,"𩈚"],[195064,1,"䩮"],[195065,1,"䩶"],[195066,1,"韠"],[195067,1,"𩐊"],[195068,1,"䪲"],[195069,1,"𩒖"],[[195070,195071],1,"頋"],[195072,1,"頩"],[195073,1,"𩖶"],[195074,1,"飢"],[195075,1,"䬳"],[195076,1,"餩"],[195077,1,"馧"],[195078,1,"駂"],[195079,1,"駾"],[195080,1,"䯎"],[195081,1,"𩬰"],[195082,1,"鬒"],[195083,1,"鱀"],[195084,1,"鳽"],[195085,1,"䳎"],[195086,1,"䳭"],[195087,1,"鵧"],[195088,1,"𪃎"],[195089,1,"䳸"],[195090,1,"𪄅"],[195091,1,"𪈎"],[195092,1,"𪊑"],[195093,1,"麻"],[195094,1,"䵖"],[195095,1,"黹"],[195096,1,"黾"],[195097,1,"鼅"],[195098,1,"鼏"],[195099,1,"鼖"],[195100,1,"鼻"],[195101,1,"𪘀"],[[195102,196605],3],[[196606,196607],3],[[196608,201546],2],[[201547,262141],3],[[262142,262143],3],[[262144,327677],3],[[327678,327679],3],[[327680,393213],3],[[393214,393215],3],[[393216,458749],3],[[458750,458751],3],[[458752,524285],3],[[524286,524287],3],[[524288,589821],3],[[589822,589823],3],[[589824,655357],3],[[655358,655359],3],[[655360,720893],3],[[720894,720895],3],[[720896,786429],3],[[786430,786431],3],[[786432,851965],3],[[851966,851967],3],[[851968,917501],3],[[917502,917503],3],[917504,3],[917505,3],[[917506,917535],3],[[917536,917631],3],[[917632,917759],3],[[917760,917999],7],[[918000,983037],3],[[983038,983039],3],[[983040,1048573],3],[[1048574,1048575],3],[[1048576,1114109],3],[[1114110,1114111],3]]')},function(e,t,n){"use strict";e.exports.STATUS_MAPPING={mapped:1,valid:2,disallowed:3,disallowed_STD3_valid:4,disallowed_STD3_mapped:5,deviation:6,ignored:7}},function(e,t,n){"use strict";const r=n(105),o=n(106);t.convert=(e,t,{context:n="The provided value"}={})=>{if("function"!=typeof t)throw new e.TypeError(n+" is not a function");function i(...i){const s=o.tryWrapperForImpl(this);let u;for(let e=0;e<i.length;e++)i[e]=o.tryWrapperForImpl(i[e]);return u=Reflect.apply(t,s,i),u=r.any(u,{context:n,globals:e}),u}return i.construct=(...i)=>{for(let e=0;e<i.length;e++)i[e]=o.tryWrapperForImpl(i[e]);let s=Reflect.construct(t,i);return s=r.any(s,{context:n,globals:e}),s},i[o.wrapperSymbol]=t,i.objectReference=t,i}},function(e,t,n){"use strict";const r=n(178);t.implementation=class{constructor(e,t,{doNotStripQMark:n=!1}){let o=t[0];if(this._list=[],this._url=null,n||"string"!=typeof o||"?"!==o[0]||(o=o.slice(1)),Array.isArray(o))for(const e of o){if(2!==e.length)throw new TypeError("Failed to construct 'URLSearchParams': parameter 1 sequence's element does not contain exactly two elements.");this._list.push([e[0],e[1]])}else if("object"==typeof o&&null===Object.getPrototypeOf(o))for(const e of Object.keys(o)){const t=o[e];this._list.push([e,t])}else this._list=r.parseUrlencodedString(o)}_updateSteps(){if(null!==this._url){let e=r.serializeUrlencoded(this._list);""===e&&(e=null),this._url._url.query=e}}append(e,t){this._list.push([e,t]),this._updateSteps()}delete(e){let t=0;for(;t<this._list.length;)this._list[t][0]===e?this._list.splice(t,1):t++;this._updateSteps()}get(e){for(const t of this._list)if(t[0]===e)return t[1];return null}getAll(e){const t=[];for(const n of this._list)n[0]===e&&t.push(n[1]);return t}has(e){for(const t of this._list)if(t[0]===e)return!0;return!1}set(e,t){let n=!1,r=0;for(;r<this._list.length;)this._list[r][0]===e?n?this._list.splice(r,1):(n=!0,this._list[r][1]=t,r++):r++;n||this._list.push([e,t]),this._updateSteps()}sort(){this._list.sort((e,t)=>e[0]<t[0]?-1:e[0]>t[0]?1:0),this._updateSteps()}[Symbol.iterator](){return this._list[Symbol.iterator]()}toString(){return r.serializeUrlencoded(this._list)}}},function(e,t,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),i=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&r(t,e,n);return o(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.redactConnectionString=t.redactValidConnectionString=void 0;const s=i(n(175));t.redactValidConnectionString=function(e,t){var n,r;const o=e.clone(),i=null!==(n=null==t?void 0:t.replacementString)&&void 0!==n?n:"_credentials_",u=null===(r=null==t?void 0:t.redactUsernames)||void 0===r||r;if((o.username||o.password)&&u?(o.username=i,o.password=""):o.password&&(o.password=i),o.searchParams.has("authMechanismProperties")){const e=new s.CommaAndColonSeparatedRecord(o.searchParams.get("authMechanismProperties"));e.get("AWS_SESSION_TOKEN")&&(e.set("AWS_SESSION_TOKEN",i),o.searchParams.set("authMechanismProperties",e.toString()))}return o.searchParams.has("tlsCertificateKeyFilePassword")&&o.searchParams.set("tlsCertificateKeyFilePassword",i),o.searchParams.has("proxyUsername")&&u&&o.searchParams.set("proxyUsername",i),o.searchParams.has("proxyPassword")&&o.searchParams.set("proxyPassword",i),o},t.redactConnectionString=function(e,t){var n,r;const o=null!==(n=null==t?void 0:t.replacementString)&&void 0!==n?n:"<credentials>",i=null===(r=null==t?void 0:t.redactUsernames)||void 0===r||r;let u;try{u=new s.default(e)}catch(e){}if(u)return t={...t,replacementString:"___credentials___"},u.redact(t).toString().replace(/___credentials___/g,o);const a=[i?/(?<=\/\/)(.*)(?=@)/g:/(?<=\/\/[^@]+:)(.*)(?=@)/g,/(?<=AWS_SESSION_TOKEN(:|%3A))([^,&]+)/gi,/(?<=tlsCertificateKeyFilePassword=)([^&]+)/gi,i?/(?<=proxyUsername=)([^&]+)/gi:null,/(?<=proxyPassword=)([^&]+)/gi];for(const t of a)null!==t&&(e=e.replace(t,o));return e}},function(e,t,n){"use strict";const{unassigned_code_points:r,commonly_mapped_to_nothing:o,non_ASCII_space_characters:i,prohibited_characters:s,bidirectional_r_al:u,bidirectional_l:a}=n(394);e.exports=function(e,t={}){if("string"!=typeof e)throw new TypeError("Expected string.");if(0===e.length)return"";const n=f(e).map(e=>c.get(e)?32:e).filter(e=>!l.get(e)),o=String.fromCodePoint.apply(null,n).normalize("NFKC"),i=f(o);if(i.some(e=>s.get(e)))throw new Error("Prohibited character, see https://tools.ietf.org/html/rfc4013#section-2.3");if(!0!==t.allowUnassigned){if(i.some(e=>r.get(e)))throw new Error("Unassigned code point, see https://tools.ietf.org/html/rfc4013#section-2.5")}const p=i.some(e=>u.get(e)),h=i.some(e=>a.get(e));if(p&&h)throw new Error("String must not contain RandALCat and LCat at the same time, see https://tools.ietf.org/html/rfc3454#section-6");const m=u.get(d((E=o,E[0]))),g=u.get(d((e=>e[e.length-1])(o)));var E;if(p&&(!m||!g))throw new Error("Bidirectional RandALCat character must be the first and the last character of the string, see https://tools.ietf.org/html/rfc3454#section-6");return o};const c=i,l=o,d=e=>e.codePointAt(0);function f(e){const t=[],n=e.length;for(let r=0;r<n;r+=1){const o=e.charCodeAt(r);if(o>=55296&&o<=56319&&n>r+1){const n=e.charCodeAt(r+1);if(n>=56320&&n<=57343){t.push(1024*(o-55296)+n-56320+65536),r+=1;continue}}t.push(o)}return t}},function(e,t,n){"use strict";(function(t){const r=n(64),o=n(110),i=n(395),s=r.readFileSync(o.resolve(t,"../code-points.mem"));let u=0;function a(){const e=s.readUInt32BE(u);u+=4;const t=s.slice(u,u+e);return u+=e,i({buffer:t})}const c=a(),l=a(),d=a(),f=a(),p=a(),h=a();e.exports={unassigned_code_points:c,commonly_mapped_to_nothing:l,non_ASCII_space_characters:d,prohibited_characters:f,bidirectional_r_al:p,bidirectional_l:h}}).call(this,"/")},function(e,t,n){var r=n(396);function o(e){if(!(this instanceof o))return new o(e);if(e||(e={}),Buffer.isBuffer(e)&&(e={buffer:e}),this.pageOffset=e.pageOffset||0,this.pageSize=e.pageSize||1024,this.pages=e.pages||r(this.pageSize),this.byteLength=this.pages.length*this.pageSize,this.length=8*this.byteLength,(t=this.pageSize)&t-1)throw new Error("The page size should be a power of two");var t;if(this._trackUpdates=!!e.trackUpdates,this._pageMask=this.pageSize-1,e.buffer){for(var n=0;n<e.buffer.length;n+=this.pageSize)this.pages.set(n/this.pageSize,e.buffer.slice(n,n+this.pageSize));this.byteLength=e.buffer.length,this.length=8*this.byteLength}}e.exports=o,o.prototype.get=function(e){var t=7&e,n=(e-t)/8;return!!(this.getByte(n)&128>>t)},o.prototype.getByte=function(e){var t=e&this._pageMask,n=(e-t)/this.pageSize,r=this.pages.get(n,!0);return r?r.buffer[t+this.pageOffset]:0},o.prototype.set=function(e,t){var n=7&e,r=(e-n)/8,o=this.getByte(r);return this.setByte(r,t?o|128>>n:o&(255^128>>n))},o.prototype.toBuffer=function(){for(var e=function(e){if(Buffer.alloc)return Buffer.alloc(e);var t=new Buffer(e);return t.fill(0),t}(this.pages.length*this.pageSize),t=0;t<this.pages.length;t++){var n=this.pages.get(t,!0),r=t*this.pageSize;n&&n.buffer.copy(e,r,this.pageOffset,this.pageOffset+this.pageSize)}return e},o.prototype.setByte=function(e,t){var n=e&this._pageMask,r=(e-n)/this.pageSize,o=this.pages.get(r,!1);return n+=this.pageOffset,o.buffer[n]!==t&&(o.buffer[n]=t,e>=this.byteLength&&(this.byteLength=e+1,this.length=8*this.byteLength),this._trackUpdates&&this.pages.updated(o),!0)}},function(e,t){function n(e,t){if(!(this instanceof n))return new n(e,t);this.length=0,this.updates=[],this.path=new Uint16Array(4),this.pages=new Array(32768),this.maxPages=this.pages.length,this.level=0,this.pageSize=e||1024,this.deduplicate=t?t.deduplicate:null,this.zeros=this.deduplicate?r(this.deduplicate.length):null}function r(e){if(Buffer.alloc)return Buffer.alloc(e);var t=new Buffer(e);return t.fill(0),t}function o(e,t){this.offset=e*t.length,this.buffer=t,this.updated=!1,this.deduplicate=0}e.exports=n,n.prototype.updated=function(e){for(;this.deduplicate&&e.buffer[e.deduplicate]===this.deduplicate[e.deduplicate];)if(e.deduplicate++,e.deduplicate===this.deduplicate.length){e.deduplicate=0,e.buffer.equals&&e.buffer.equals(this.deduplicate)&&(e.buffer=this.deduplicate);break}!e.updated&&this.updates&&(e.updated=!0,this.updates.push(e))},n.prototype.lastUpdate=function(){if(!this.updates||!this.updates.length)return null;var e=this.updates.pop();return e.updated=!1,e},n.prototype._array=function(e,t){if(e>=this.maxPages){if(t)return;!function(e,t){for(;e.maxPages<t;){var n=e.pages;e.pages=new Array(32768),e.pages[0]=n,e.level++,e.maxPages*=32768}}(this,e)}var n,r;n=e,r=this.path,n=((n=(n-(r[0]=32767&n))/32768)-(r[1]=32767&n))/32768,r[3]=(n-(r[2]=32767&n))/32768&32767;for(var o=this.pages,i=this.level;i>0;i--){var s=this.path[i],u=o[s];if(!u){if(t)return;u=o[s]=new Array(32768)}o=u}return o},n.prototype.get=function(e,t){var n,i,s=this._array(e,t),u=this.path[0],a=s&&s[u];return a||t||(a=s[u]=new o(e,r(this.pageSize)),e>=this.length&&(this.length=e+1)),a&&a.buffer===this.deduplicate&&this.deduplicate&&!t&&(a.buffer=(n=a.buffer,i=Buffer.allocUnsafe?Buffer.allocUnsafe(n.length):new Buffer(n.length),n.copy(i),i),a.deduplicate=0),a},n.prototype.set=function(e,t){var n=this._array(e,!1),i=this.path[0];if(e>=this.length&&(this.length=e+1),!t||this.zeros&&t.equals&&t.equals(this.zeros))n[i]=void 0;else{this.deduplicate&&t.equals&&t.equals(this.deduplicate)&&(t=this.deduplicate);var s=n[i],u=function(e,t){if(e.length===t)return e;if(e.length>t)return e.slice(0,t);var n=r(t);return e.copy(n),n}(t,this.pageSize);s?s.buffer=u:n[i]=new o(e,u)}},n.prototype.toBuffer=function(){for(var e=new Array(this.length),t=r(this.pageSize),n=0;n<e.length;)for(var o=this._array(n,!0),i=0;i<32768&&n<e.length;i++)e[n++]=o&&o[i]?o[i].buffer:t;return Buffer.concat(e)}},function(e,t,n){var r=t,o=n(59),i=n(398),s=n(18),u=n(399)(1e3);function a(e,t,n){return s.createHmac("sha256",e).update(t,"utf8").digest(n)}function c(e,t){return s.createHash("sha256").update(e,"utf8").digest(t)}function l(e){return e.replace(/[!'()*]/g,(function(e){return"%"+e.charCodeAt(0).toString(16).toUpperCase()}))}function d(e){return l(encodeURIComponent(e))}function f(e,t){"string"==typeof e&&(e=o.parse(e));var n=e.headers=e.headers||{},r=this.matchHost(e.hostname||e.host||n.Host||n.host);this.request=e,this.credentials=t||this.defaultCredentials(),this.service=e.service||r[0]||"",this.region=e.region||r[1]||"us-east-1","email"===this.service&&(this.service="ses"),!e.method&&e.body&&(e.method="POST"),n.Host||n.host||(n.Host=e.hostname||e.host||this.createHost(),e.port&&(n.Host+=":"+e.port)),e.hostname||e.host||(e.hostname=n.Host||n.host),this.isCodeCommitGit="codecommit"===this.service&&"GIT"===e.method}f.prototype.matchHost=function(e){var t=((e||"").match(/([^\.]+)\.(?:([^\.]*)\.)?amazonaws\.com(\.cn)?$/)||[]).slice(1,3);return"es"===t[1]&&(t=t.reverse()),t},f.prototype.isSingleRegion=function(){return["s3","sdb"].indexOf(this.service)>=0&&"us-east-1"===this.region||["cloudfront","ls","route53","iam","importexport","sts"].indexOf(this.service)>=0},f.prototype.createHost=function(){var e=this.isSingleRegion()?"":("s3"===this.service&&"us-east-1"!==this.region?"-":".")+this.region;return("ses"===this.service?"email":this.service)+e+".amazonaws.com"},f.prototype.prepareRequest=function(){this.parsePath();var e,t=this.request,n=t.headers;t.signQuery?(this.parsedPath.query=e=this.parsedPath.query||{},this.credentials.sessionToken&&(e["X-Amz-Security-Token"]=this.credentials.sessionToken),"s3"!==this.service||e["X-Amz-Expires"]||(e["X-Amz-Expires"]=86400),e["X-Amz-Date"]?this.datetime=e["X-Amz-Date"]:e["X-Amz-Date"]=this.getDateTime(),e["X-Amz-Algorithm"]="AWS4-HMAC-SHA256",e["X-Amz-Credential"]=this.credentials.accessKeyId+"/"+this.credentialString(),e["X-Amz-SignedHeaders"]=this.signedHeaders()):(t.doNotModifyHeaders||this.isCodeCommitGit||(!t.body||n["Content-Type"]||n["content-type"]||(n["Content-Type"]="application/x-www-form-urlencoded; charset=utf-8"),!t.body||n["Content-Length"]||n["content-length"]||(n["Content-Length"]=Buffer.byteLength(t.body)),!this.credentials.sessionToken||n["X-Amz-Security-Token"]||n["x-amz-security-token"]||(n["X-Amz-Security-Token"]=this.credentials.sessionToken),"s3"!==this.service||n["X-Amz-Content-Sha256"]||n["x-amz-content-sha256"]||(n["X-Amz-Content-Sha256"]=c(this.request.body||"","hex")),n["X-Amz-Date"]||n["x-amz-date"]?this.datetime=n["X-Amz-Date"]||n["x-amz-date"]:n["X-Amz-Date"]=this.getDateTime()),delete n.Authorization,delete n.authorization)},f.prototype.sign=function(){return this.parsedPath||this.prepareRequest(),this.request.signQuery?this.parsedPath.query["X-Amz-Signature"]=this.signature():this.request.headers.Authorization=this.authHeader(),this.request.path=this.formatPath(),this.request},f.prototype.getDateTime=function(){if(!this.datetime){var e=this.request.headers,t=new Date(e.Date||e.date||new Date);this.datetime=t.toISOString().replace(/[:\-]|\.\d{3}/g,""),this.isCodeCommitGit&&(this.datetime=this.datetime.slice(0,-1))}return this.datetime},f.prototype.getDate=function(){return this.getDateTime().substr(0,8)},f.prototype.authHeader=function(){return["AWS4-HMAC-SHA256 Credential="+this.credentials.accessKeyId+"/"+this.credentialString(),"SignedHeaders="+this.signedHeaders(),"Signature="+this.signature()].join(", ")},f.prototype.signature=function(){var e,t,n,r=this.getDate(),o=[this.credentials.secretAccessKey,r,this.region,this.service].join(),i=u.get(o);return i||(e=a("AWS4"+this.credentials.secretAccessKey,r),t=a(e,this.region),n=a(t,this.service),i=a(n,"aws4_request"),u.set(o,i)),a(i,this.stringToSign(),"hex")},f.prototype.stringToSign=function(){return["AWS4-HMAC-SHA256",this.getDateTime(),this.credentialString(),c(this.canonicalString(),"hex")].join("\n")},f.prototype.canonicalString=function(){this.parsedPath||this.prepareRequest();var e,t=this.parsedPath.path,n=this.parsedPath.query,r=this.request.headers,o="",i="s3"!==this.service,s="s3"===this.service||this.request.doNotEncodePath,u="s3"===this.service,a="s3"===this.service;if(e="s3"===this.service&&this.request.signQuery?"UNSIGNED-PAYLOAD":this.isCodeCommitGit?"":r["X-Amz-Content-Sha256"]||r["x-amz-content-sha256"]||c(this.request.body||"","hex"),n){var l=Object.keys(n).reduce((function(e,t){return t?(e[d(t)]=Array.isArray(n[t])&&a?n[t][0]:n[t],e):e}),{}),f=[];Object.keys(l).sort().forEach((function(e){Array.isArray(l[e])?l[e].map(d).sort().forEach((function(t){f.push(e+"="+t)})):f.push(e+"="+d(l[e]))})),o=f.join("&")}return"/"!==t&&(i&&(t=t.replace(/\/{2,}/g,"/")),"/"!==(t=t.split("/").reduce((function(e,t){return i&&".."===t?e.pop():i&&"."===t||(s&&(t=decodeURIComponent(t).replace(/\+/g," ")),e.push(d(t))),e}),[]).join("/"))[0]&&(t="/"+t),u&&(t=t.replace(/%2F/g,"/"))),[this.request.method||"GET",t,o,this.canonicalHeaders()+"\n",this.signedHeaders(),e].join("\n")},f.prototype.canonicalHeaders=function(){var e=this.request.headers;return Object.keys(e).sort((function(e,t){return e.toLowerCase()<t.toLowerCase()?-1:1})).map((function(t){return t.toLowerCase()+":"+e[t].toString().trim().replace(/\s+/g," ")})).join("\n")},f.prototype.signedHeaders=function(){return Object.keys(this.request.headers).map((function(e){return e.toLowerCase()})).sort().join(";")},f.prototype.credentialString=function(){return[this.getDate(),this.region,this.service,"aws4_request"].join("/")},f.prototype.defaultCredentials=function(){var e=process.env;return{accessKeyId:e.AWS_ACCESS_KEY_ID||e.AWS_ACCESS_KEY,secretAccessKey:e.AWS_SECRET_ACCESS_KEY||e.AWS_SECRET_KEY,sessionToken:e.AWS_SESSION_TOKEN}},f.prototype.parsePath=function(){var e=this.request.path||"/";/[^0-9A-Za-z;,/?:@&=+$\-_.!~*'()#%]/.test(e)&&(e=encodeURI(decodeURI(e)));var t=e.indexOf("?"),n=null;t>=0&&(n=i.parse(e.slice(t+1)),e=e.slice(0,t)),this.parsedPath={path:e,query:n}},f.prototype.formatPath=function(){var e=this.parsedPath.path,t=this.parsedPath.query;return t?(null!=t[""]&&delete t[""],e+"?"+l(i.stringify(t))):e},r.RequestSigner=f,r.sign=function(e,t){return new f(e,t).sign()}},function(e,t){e.exports=require("querystring")},function(e,t){function n(e){this.capacity=0|e,this.map=Object.create(null),this.list=new r}function r(){this.firstNode=null,this.lastNode=null}function o(e,t){this.key=e,this.val=t,this.prev=null,this.next=null}e.exports=function(e){return new n(e)},n.prototype.get=function(e){var t=this.map[e];if(null!=t)return this.used(t),t.val},n.prototype.set=function(e,t){var n=this.map[e];if(null!=n)n.val=t;else{if(this.capacity||this.prune(),!this.capacity)return!1;n=new o(e,t),this.map[e]=n,this.capacity--}return this.used(n),!0},n.prototype.used=function(e){this.list.moveToFront(e)},n.prototype.prune=function(){var e=this.list.pop();null!=e&&(delete this.map[e.key],this.capacity++)},r.prototype.moveToFront=function(e){this.firstNode!=e&&(this.remove(e),null==this.firstNode?(this.firstNode=e,this.lastNode=e,e.prev=null,e.next=null):(e.prev=null,e.next=this.firstNode,e.next.prev=e,this.firstNode=e))},r.prototype.pop=function(){var e=this.lastNode;return null!=e&&this.remove(e),e},r.prototype.remove=function(e){this.firstNode==e?this.firstNode=e.next:null!=e.prev&&(e.prev.next=e.next),this.lastNode==e?this.lastNode=e.prev:null!=e.next&&(e.next.prev=e.prev)}},function(e,t){e.exports=require("zlib")},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Encrypter=void 0;const r=n(4),o=n(8),i=n(1),s=n(43);let u;const a=Symbol("internalClient");t.Encrypter=class{constructor(e,t,n){if("object"!=typeof n.autoEncryption)throw new i.MongoInvalidArgumentError('Option "autoEncryption" must be specified');this[a]=null,this.bypassAutoEncryption=!!n.autoEncryption.bypassAutoEncryption,this.needsConnecting=!1,0===n.maxPoolSize&&null==n.autoEncryption.keyVaultClient?n.autoEncryption.keyVaultClient=e:null==n.autoEncryption.keyVaultClient&&(n.autoEncryption.keyVaultClient=this.getInternalClient(e,t,n)),this.bypassAutoEncryption?n.autoEncryption.metadataClient=void 0:0===n.maxPoolSize?n.autoEncryption.metadataClient=e:n.autoEncryption.metadataClient=this.getInternalClient(e,t,n),n.proxyHost&&(n.autoEncryption.proxyOptions={proxyHost:n.proxyHost,proxyPort:n.proxyPort,proxyUsername:n.proxyUsername,proxyPassword:n.proxyPassword}),n.autoEncryption.bson=Object.create(null),n.autoEncryption.bson.serialize=r.serialize,n.autoEncryption.bson.deserialize=r.deserialize,this.autoEncrypter=new u(e,n.autoEncryption)}getInternalClient(e,t,n){let r=this[a];if(null==r){const i={};for(const e of[...Object.getOwnPropertyNames(n),...Object.getOwnPropertySymbols(n)])["autoEncryption","minPoolSize","servers","caseTranslate","dbName"].includes(e)||Reflect.set(i,e,Reflect.get(n,e));i.minPoolSize=0,r=new s.MongoClient(t,i),this[a]=r;for(const t of o.MONGO_CLIENT_EVENTS)for(const n of e.listeners(t))r.on(t,n);e.on("newListener",(e,t)=>{null==r||r.on(e,t)}),this.needsConnecting=!0}return r}connectInternalClient(e){const t=this[a];return this.needsConnecting&&null!=t?(this.needsConnecting=!1,t.connect(e)):e()}close(e,t,n){this.autoEncrypter.teardown(!!t,r=>{const o=this[a];if(null!=o&&e!==o)return o.close(t,n);n(r)})}static checkForMongoCrypt(){let e=void 0;try{e=process.env.MONGODB_CLIENT_ENCRYPTION_OVERRIDE?n(402)(process.env.MONGODB_CLIENT_ENCRYPTION_OVERRIDE):n(403)}catch(e){throw new i.MongoMissingDependencyError("Auto-encryption requested, but the module is not installed. Please add `mongodb-client-encryption` as a dependency of your project")}u=e.extension(n(32)).AutoEncrypter}}},function(e,t){function n(e){var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}n.keys=function(){return[]},n.resolve=n,e.exports=n,n.id=402},function(e,t,n){"use strict";let r;function o(){return r||(r=s(n(32))),r}const i=n(65).MongoCryptError;function s(e){const t={mongodb:e};return t.stateMachine=n(404)(t),t.autoEncrypter=n(412)(t),t.clientEncryption=n(416)(t),{AutoEncrypter:t.autoEncrypter.AutoEncrypter,ClientEncryption:t.clientEncryption.ClientEncryption,MongoCryptError:i}}e.exports={extension:s,MongoCryptError:i,get AutoEncrypter(){const t=o();return delete e.exports.AutoEncrypter,e.exports.AutoEncrypter=t.AutoEncrypter,t.AutoEncrypter},get ClientEncryption(){const t=o();return delete e.exports.ClientEncryption,e.exports.ClientEncryption=t.ClientEncryption,t.ClientEncryption}}},function(e,t,n){"use strict";e.exports=function(e){const t=n(181),r=n(112),o=n(64),{once:i}=n(98),{SocksClient:s}=n(182),u=e.mongodb.MongoNetworkTimeoutError||e.mongodb.MongoTimeoutError,a=n(65),c=a.debug,l=a.databaseNamespace,d=a.collectionNamespace,f=a.MongoCryptError,{BufferPool:p}=n(411),h=new Map([[0,"MONGOCRYPT_CTX_ERROR"],[1,"MONGOCRYPT_CTX_NEED_MONGO_COLLINFO"],[2,"MONGOCRYPT_CTX_NEED_MONGO_MARKINGS"],[3,"MONGOCRYPT_CTX_NEED_MONGO_KEYS"],[7,"MONGOCRYPT_CTX_NEED_KMS_CREDENTIALS"],[4,"MONGOCRYPT_CTX_NEED_KMS"],[5,"MONGOCRYPT_CTX_READY"],[6,"MONGOCRYPT_CTX_DONE"]]),m=["tlsInsecure","tlsAllowInvalidCertificates","tlsAllowInvalidHostnames","tlsDisableOCSPEndpointCheck","tlsDisableCertificateRevocationCheck"];return{StateMachine:class{constructor(e){this.options=e||{},this.bson=e.bson}execute(e,t,n){const r=this.bson,o=e._keyVaultNamespace,i=e._keyVaultClient,s=e._metaDataClient,a=e._mongocryptdClient,l=e._mongocryptdManager;switch(c(`[context#${t.id}] ${h.get(t.state)||t.state}`),t.state){case 1:{const o=r.deserialize(t.nextMongoOperation());return void this.fetchCollectionInfo(s,t.ns,o,(r,o)=>{if(r)return n(r,null);o&&t.addMongoOperationResponse(o),t.finishMongoOperation(),this.execute(e,t,n)})}case 2:{const r=t.nextMongoOperation();return void this.markCommand(a,t.ns,r,(o,i)=>{if(o)return o instanceof u&&l&&!l.bypassSpawn?void l.spawn(()=>{this.markCommand(a,t.ns,r,(r,o)=>{if(r)return n(r,null);t.addMongoOperationResponse(o),t.finishMongoOperation(),this.execute(e,t,n)})}):n(o,null);t.addMongoOperationResponse(i),t.finishMongoOperation(),this.execute(e,t,n)})}case 3:{const s=t.nextMongoOperation();return void this.fetchKeys(i,o,s,(o,i)=>{if(o)return n(o,null);i.forEach(e=>{t.addMongoOperationResponse(r.serialize(e))}),t.finishMongoOperation(),this.execute(e,t,n)})}case 7:return void e.askForKMSCredentials().then(o=>{t.provideKMSProviders(Buffer.isBuffer(o)?o:r.serialize(o)),this.execute(e,t,n)}).catch(e=>{n(e,null)});case 4:{const r=[];let o;for(;o=t.nextKMSRequest();)r.push(this.kmsRequest(o));return void Promise.all(r).then(()=>{t.finishKMSRequests(),this.execute(e,t,n)}).catch(e=>{n(e,null)})}case 5:{const e=t.finalize();if(0===t.state){const e=t.status.message||"Finalization error";return void n(new f(e))}return void n(null,r.deserialize(e,this.options))}case 0:{const e=t.status.message;return void n(new f(e))}case 6:return;default:return void n(new f(`Unknown state: ${t.state}`))}}kmsRequest(e){const n=e.endpoint.split(":"),o=null!=n[1]?Number.parseInt(n[1],10):443,u={host:n[0],servername:n[0],port:o},a=e.message;return new Promise(async(n,o)=>{const c=new p;let l,d;function h(){for(const e of[l,d])e&&(e.removeAllListeners(),e.destroy())}function m(){h(),o(new f("KMS request timed out"))}function g(e){h();const t=new f("KMS request failed");t.originalError=e,o(t)}if(this.options.proxyOptions&&this.options.proxyOptions.proxyHost){d=r.connect({host:this.options.proxyOptions.proxyHost,port:this.options.proxyOptions.proxyPort||1080}),d.on("timeout",m),d.on("error",g);try{await i(d,"connect"),u.socket=(await s.createConnection({existing_socket:d,command:"connect",destination:{host:u.host,port:u.port},proxy:{host:"iLoveJavaScript",port:0,type:5,userId:this.options.proxyOptions.proxyUsername,password:this.options.proxyOptions.proxyPassword}})).socket}catch(e){return g(e)}}const E=this.options.tlsOptions;if(E){const t=e.kmsProvider,n=E[t];if(n){const e=this.validateTlsOptions(t,n);e&&o(e),this.setTlsOptions(n,u)}}l=t.connect(u,()=>{l.write(a)}),l.once("timeout",m),l.once("error",g),l.on("data",t=>{for(c.append(t);e.bytesNeeded>0&&c.length;){const t=Math.min(e.bytesNeeded,c.length);e.addResponse(c.read(t))}e.bytesNeeded<=0&&(h(),n())})})}validateTlsOptions(e,t){const n=Object.keys(t);for(const t of m)if(n.includes(t))return new f(`Insecure TLS options prohibited for ${e}: ${t}`)}setTlsOptions(e,t){if(e.tlsCertificateKeyFile){const n=o.readFileSync(e.tlsCertificateKeyFile);t.cert=t.key=n}e.tlsCAFile&&(t.ca=o.readFileSync(e.tlsCAFile)),e.tlsCertificateKeyFilePassword&&(t.passphrase=e.tlsCertificateKeyFilePassword)}fetchCollectionInfo(e,t,n,r){const o=this.bson,i=l(t);e.db(i).listCollections(n).toArray((e,t)=>{if(e)return void r(e,null);const n=t.length>0?o.serialize(t[0]):null;r(null,n)})}markCommand(e,t,n,r){const o=this.bson,i=l(t),s=o.deserialize(n,{promoteLongs:!1,promoteValues:!1});e.db(i).command(s,(e,t)=>{r(e,e?null:o.serialize(t,this.options))})}fetchKeys(e,t,n,r){const o=this.bson,i=l(t),s=d(t);n=o.deserialize(n),e.db(i).collection(s,{readConcern:{level:"majority"}}).find(n).toArray((e,t)=>{e?r(e,null):r(null,t)})}}}}},function(e,t,n){"use strict";var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{a(r.next(e))}catch(e){i(e)}}function u(e){try{a(r.throw(e))}catch(e){i(e)}}function a(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,u)}a((r=r.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.SocksClientError=t.SocksClient=void 0;const o=n(98),i=n(112),s=n(406),u=n(407),a=n(183),c=n(409),l=n(410),d=n(184);Object.defineProperty(t,"SocksClientError",{enumerable:!0,get:function(){return d.SocksClientError}});class f extends o.EventEmitter{constructor(e){super(),this.options=Object.assign({},e),(0,c.validateSocksClientOptions)(e),this.setState(a.SocksClientState.Created)}static createConnection(e,t){return new Promise((n,r)=>{try{(0,c.validateSocksClientOptions)(e,["connect"])}catch(e){return"function"==typeof t?(t(e),n(e)):r(e)}const o=new f(e);o.connect(e.existing_socket),o.once("established",e=>{o.removeAllListeners(),"function"==typeof t?(t(null,e),n(e)):n(e)}),o.once("error",e=>{o.removeAllListeners(),"function"==typeof t?(t(e),n(e)):r(e)})})}static createConnectionChain(e,t){return new Promise((n,o)=>r(this,void 0,void 0,(function*(){try{(0,c.validateSocksClientChainOptions)(e)}catch(e){return"function"==typeof t?(t(e),n(e)):o(e)}let r;e.randomizeChain&&(0,d.shuffleArray)(e.proxies);try{for(let t=0;t<e.proxies.length;t++){const n=e.proxies[t],o=t===e.proxies.length-1?e.destination:{host:e.proxies[t+1].host||e.proxies[t+1].ipaddress,port:e.proxies[t+1].port},i=yield f.createConnection({command:"connect",proxy:n,destination:o});r||(r=i.socket)}"function"==typeof t?(t(null,{socket:r}),n({socket:r})):n({socket:r})}catch(e){"function"==typeof t?(t(e),n(e)):o(e)}})))}static createUDPFrame(e){const t=new u.SmartBuffer;return t.writeUInt16BE(0),t.writeUInt8(e.frameNumber||0),i.isIPv4(e.remoteHost.host)?(t.writeUInt8(a.Socks5HostType.IPv4),t.writeUInt32BE(s.toLong(e.remoteHost.host))):i.isIPv6(e.remoteHost.host)?(t.writeUInt8(a.Socks5HostType.IPv6),t.writeBuffer(s.toBuffer(e.remoteHost.host))):(t.writeUInt8(a.Socks5HostType.Hostname),t.writeUInt8(Buffer.byteLength(e.remoteHost.host)),t.writeString(e.remoteHost.host)),t.writeUInt16BE(e.remoteHost.port),t.writeBuffer(e.data),t.toBuffer()}static parseUDPFrame(e){const t=u.SmartBuffer.fromBuffer(e);t.readOffset=2;const n=t.readUInt8(),r=t.readUInt8();let o;return o=r===a.Socks5HostType.IPv4?s.fromLong(t.readUInt32BE()):r===a.Socks5HostType.IPv6?s.toString(t.readBuffer(16)):t.readString(t.readUInt8()),{frameNumber:n,remoteHost:{host:o,port:t.readUInt16BE()},data:t.readBuffer()}}setState(e){this.state!==a.SocksClientState.Error&&(this.state=e)}connect(e){this.onDataReceived=e=>this.onDataReceivedHandler(e),this.onClose=()=>this.onCloseHandler(),this.onError=e=>this.onErrorHandler(e),this.onConnect=()=>this.onConnectHandler();const t=setTimeout(()=>this.onEstablishedTimeout(),this.options.timeout||a.DEFAULT_TIMEOUT);t.unref&&"function"==typeof t.unref&&t.unref(),this.socket=e||new i.Socket,this.socket.once("close",this.onClose),this.socket.once("error",this.onError),this.socket.once("connect",this.onConnect),this.socket.on("data",this.onDataReceived),this.setState(a.SocksClientState.Connecting),this.receiveBuffer=new l.ReceiveBuffer,e?this.socket.emit("connect"):(this.socket.connect(this.getSocketOptions()),void 0!==this.options.set_tcp_nodelay&&null!==this.options.set_tcp_nodelay&&this.socket.setNoDelay(!!this.options.set_tcp_nodelay)),this.prependOnceListener("established",e=>{setImmediate(()=>{if(this.receiveBuffer.length>0){const t=this.receiveBuffer.get(this.receiveBuffer.length);e.socket.emit("data",t)}e.socket.resume()})})}getSocketOptions(){return Object.assign(Object.assign({},this.options.socket_options),{host:this.options.proxy.host||this.options.proxy.ipaddress,port:this.options.proxy.port})}onEstablishedTimeout(){this.state!==a.SocksClientState.Established&&this.state!==a.SocksClientState.BoundWaitingForConnection&&this.closeSocket(a.ERRORS.ProxyConnectionTimedOut)}onConnectHandler(){this.setState(a.SocksClientState.Connected),4===this.options.proxy.type?this.sendSocks4InitialHandshake():this.sendSocks5InitialHandshake(),this.setState(a.SocksClientState.SentInitialHandshake)}onDataReceivedHandler(e){this.receiveBuffer.append(e),this.processData()}processData(){for(;this.state!==a.SocksClientState.Established&&this.state!==a.SocksClientState.Error&&this.receiveBuffer.length>=this.nextRequiredPacketBufferSize;)if(this.state===a.SocksClientState.SentInitialHandshake)4===this.options.proxy.type?this.handleSocks4FinalHandshakeResponse():this.handleInitialSocks5HandshakeResponse();else if(this.state===a.SocksClientState.SentAuthentication)this.handleInitialSocks5AuthenticationHandshakeResponse();else if(this.state===a.SocksClientState.SentFinalHandshake)this.handleSocks5FinalHandshakeResponse();else{if(this.state!==a.SocksClientState.BoundWaitingForConnection){this.closeSocket(a.ERRORS.InternalError);break}4===this.options.proxy.type?this.handleSocks4IncomingConnectionResponse():this.handleSocks5IncomingConnectionResponse()}}onCloseHandler(){this.closeSocket(a.ERRORS.SocketClosed)}onErrorHandler(e){this.closeSocket(e.message)}removeInternalSocketHandlers(){this.socket.pause(),this.socket.removeListener("data",this.onDataReceived),this.socket.removeListener("close",this.onClose),this.socket.removeListener("error",this.onError),this.socket.removeListener("connect",this.onConnect)}closeSocket(e){this.state!==a.SocksClientState.Error&&(this.setState(a.SocksClientState.Error),this.socket.destroy(),this.removeInternalSocketHandlers(),this.emit("error",new d.SocksClientError(e,this.options)))}sendSocks4InitialHandshake(){const e=this.options.proxy.userId||"",t=new u.SmartBuffer;t.writeUInt8(4),t.writeUInt8(a.SocksCommand[this.options.command]),t.writeUInt16BE(this.options.destination.port),i.isIPv4(this.options.destination.host)?(t.writeBuffer(s.toBuffer(this.options.destination.host)),t.writeStringNT(e)):(t.writeUInt8(0),t.writeUInt8(0),t.writeUInt8(0),t.writeUInt8(1),t.writeStringNT(e),t.writeStringNT(this.options.destination.host)),this.nextRequiredPacketBufferSize=a.SOCKS_INCOMING_PACKET_SIZES.Socks4Response,this.socket.write(t.toBuffer())}handleSocks4FinalHandshakeResponse(){const e=this.receiveBuffer.get(8);if(e[1]!==a.Socks4Response.Granted)this.closeSocket(`${a.ERRORS.Socks4ProxyRejectedConnection} - (${a.Socks4Response[e[1]]})`);else if(a.SocksCommand[this.options.command]===a.SocksCommand.bind){const t=u.SmartBuffer.fromBuffer(e);t.readOffset=2;const n={port:t.readUInt16BE(),host:s.fromLong(t.readUInt32BE())};"0.0.0.0"===n.host&&(n.host=this.options.proxy.ipaddress),this.setState(a.SocksClientState.BoundWaitingForConnection),this.emit("bound",{remoteHost:n,socket:this.socket})}else this.setState(a.SocksClientState.Established),this.removeInternalSocketHandlers(),this.emit("established",{socket:this.socket})}handleSocks4IncomingConnectionResponse(){const e=this.receiveBuffer.get(8);if(e[1]!==a.Socks4Response.Granted)this.closeSocket(`${a.ERRORS.Socks4ProxyRejectedIncomingBoundConnection} - (${a.Socks4Response[e[1]]})`);else{const t=u.SmartBuffer.fromBuffer(e);t.readOffset=2;const n={port:t.readUInt16BE(),host:s.fromLong(t.readUInt32BE())};this.setState(a.SocksClientState.Established),this.removeInternalSocketHandlers(),this.emit("established",{remoteHost:n,socket:this.socket})}}sendSocks5InitialHandshake(){const e=new u.SmartBuffer,t=[a.Socks5Auth.NoAuth];(this.options.proxy.userId||this.options.proxy.password)&&t.push(a.Socks5Auth.UserPass),void 0!==this.options.proxy.custom_auth_method&&t.push(this.options.proxy.custom_auth_method),e.writeUInt8(5),e.writeUInt8(t.length);for(const n of t)e.writeUInt8(n);this.nextRequiredPacketBufferSize=a.SOCKS_INCOMING_PACKET_SIZES.Socks5InitialHandshakeResponse,this.socket.write(e.toBuffer()),this.setState(a.SocksClientState.SentInitialHandshake)}handleInitialSocks5HandshakeResponse(){const e=this.receiveBuffer.get(2);5!==e[0]?this.closeSocket(a.ERRORS.InvalidSocks5IntiailHandshakeSocksVersion):e[1]===a.SOCKS5_NO_ACCEPTABLE_AUTH?this.closeSocket(a.ERRORS.InvalidSocks5InitialHandshakeNoAcceptedAuthType):e[1]===a.Socks5Auth.NoAuth?(this.socks5ChosenAuthType=a.Socks5Auth.NoAuth,this.sendSocks5CommandRequest()):e[1]===a.Socks5Auth.UserPass?(this.socks5ChosenAuthType=a.Socks5Auth.UserPass,this.sendSocks5UserPassAuthentication()):e[1]===this.options.proxy.custom_auth_method?(this.socks5ChosenAuthType=this.options.proxy.custom_auth_method,this.sendSocks5CustomAuthentication()):this.closeSocket(a.ERRORS.InvalidSocks5InitialHandshakeUnknownAuthType)}sendSocks5UserPassAuthentication(){const e=this.options.proxy.userId||"",t=this.options.proxy.password||"",n=new u.SmartBuffer;n.writeUInt8(1),n.writeUInt8(Buffer.byteLength(e)),n.writeString(e),n.writeUInt8(Buffer.byteLength(t)),n.writeString(t),this.nextRequiredPacketBufferSize=a.SOCKS_INCOMING_PACKET_SIZES.Socks5UserPassAuthenticationResponse,this.socket.write(n.toBuffer()),this.setState(a.SocksClientState.SentAuthentication)}sendSocks5CustomAuthentication(){return r(this,void 0,void 0,(function*(){this.nextRequiredPacketBufferSize=this.options.proxy.custom_auth_response_size,this.socket.write(yield this.options.proxy.custom_auth_request_handler()),this.setState(a.SocksClientState.SentAuthentication)}))}handleSocks5CustomAuthHandshakeResponse(e){return r(this,void 0,void 0,(function*(){return yield this.options.proxy.custom_auth_response_handler(e)}))}handleSocks5AuthenticationNoAuthHandshakeResponse(e){return r(this,void 0,void 0,(function*(){return 0===e[1]}))}handleSocks5AuthenticationUserPassHandshakeResponse(e){return r(this,void 0,void 0,(function*(){return 0===e[1]}))}handleInitialSocks5AuthenticationHandshakeResponse(){return r(this,void 0,void 0,(function*(){this.setState(a.SocksClientState.ReceivedAuthenticationResponse);let e=!1;this.socks5ChosenAuthType===a.Socks5Auth.NoAuth?e=yield this.handleSocks5AuthenticationNoAuthHandshakeResponse(this.receiveBuffer.get(2)):this.socks5ChosenAuthType===a.Socks5Auth.UserPass?e=yield this.handleSocks5AuthenticationUserPassHandshakeResponse(this.receiveBuffer.get(2)):this.socks5ChosenAuthType===this.options.proxy.custom_auth_method&&(e=yield this.handleSocks5CustomAuthHandshakeResponse(this.receiveBuffer.get(this.options.proxy.custom_auth_response_size))),e?this.sendSocks5CommandRequest():this.closeSocket(a.ERRORS.Socks5AuthenticationFailed)}))}sendSocks5CommandRequest(){const e=new u.SmartBuffer;e.writeUInt8(5),e.writeUInt8(a.SocksCommand[this.options.command]),e.writeUInt8(0),i.isIPv4(this.options.destination.host)?(e.writeUInt8(a.Socks5HostType.IPv4),e.writeBuffer(s.toBuffer(this.options.destination.host))):i.isIPv6(this.options.destination.host)?(e.writeUInt8(a.Socks5HostType.IPv6),e.writeBuffer(s.toBuffer(this.options.destination.host))):(e.writeUInt8(a.Socks5HostType.Hostname),e.writeUInt8(this.options.destination.host.length),e.writeString(this.options.destination.host)),e.writeUInt16BE(this.options.destination.port),this.nextRequiredPacketBufferSize=a.SOCKS_INCOMING_PACKET_SIZES.Socks5ResponseHeader,this.socket.write(e.toBuffer()),this.setState(a.SocksClientState.SentFinalHandshake)}handleSocks5FinalHandshakeResponse(){const e=this.receiveBuffer.peek(5);if(5!==e[0]||e[1]!==a.Socks5Response.Granted)this.closeSocket(`${a.ERRORS.InvalidSocks5FinalHandshakeRejected} - ${a.Socks5Response[e[1]]}`);else{const t=e[3];let n,r;if(t===a.Socks5HostType.IPv4){const e=a.SOCKS_INCOMING_PACKET_SIZES.Socks5ResponseIPv4;if(this.receiveBuffer.length<e)return void(this.nextRequiredPacketBufferSize=e);r=u.SmartBuffer.fromBuffer(this.receiveBuffer.get(e).slice(4)),n={host:s.fromLong(r.readUInt32BE()),port:r.readUInt16BE()},"0.0.0.0"===n.host&&(n.host=this.options.proxy.ipaddress)}else if(t===a.Socks5HostType.Hostname){const t=e[4],o=a.SOCKS_INCOMING_PACKET_SIZES.Socks5ResponseHostname(t);if(this.receiveBuffer.length<o)return void(this.nextRequiredPacketBufferSize=o);r=u.SmartBuffer.fromBuffer(this.receiveBuffer.get(o).slice(5)),n={host:r.readString(t),port:r.readUInt16BE()}}else if(t===a.Socks5HostType.IPv6){const e=a.SOCKS_INCOMING_PACKET_SIZES.Socks5ResponseIPv6;if(this.receiveBuffer.length<e)return void(this.nextRequiredPacketBufferSize=e);r=u.SmartBuffer.fromBuffer(this.receiveBuffer.get(e).slice(4)),n={host:s.toString(r.readBuffer(16)),port:r.readUInt16BE()}}this.setState(a.SocksClientState.ReceivedFinalResponse),a.SocksCommand[this.options.command]===a.SocksCommand.connect?(this.setState(a.SocksClientState.Established),this.removeInternalSocketHandlers(),this.emit("established",{remoteHost:n,socket:this.socket})):a.SocksCommand[this.options.command]===a.SocksCommand.bind?(this.setState(a.SocksClientState.BoundWaitingForConnection),this.nextRequiredPacketBufferSize=a.SOCKS_INCOMING_PACKET_SIZES.Socks5ResponseHeader,this.emit("bound",{remoteHost:n,socket:this.socket})):a.SocksCommand[this.options.command]===a.SocksCommand.associate&&(this.setState(a.SocksClientState.Established),this.removeInternalSocketHandlers(),this.emit("established",{remoteHost:n,socket:this.socket}))}}handleSocks5IncomingConnectionResponse(){const e=this.receiveBuffer.peek(5);if(5!==e[0]||e[1]!==a.Socks5Response.Granted)this.closeSocket(`${a.ERRORS.Socks5ProxyRejectedIncomingBoundConnection} - ${a.Socks5Response[e[1]]}`);else{const t=e[3];let n,r;if(t===a.Socks5HostType.IPv4){const e=a.SOCKS_INCOMING_PACKET_SIZES.Socks5ResponseIPv4;if(this.receiveBuffer.length<e)return void(this.nextRequiredPacketBufferSize=e);r=u.SmartBuffer.fromBuffer(this.receiveBuffer.get(e).slice(4)),n={host:s.fromLong(r.readUInt32BE()),port:r.readUInt16BE()},"0.0.0.0"===n.host&&(n.host=this.options.proxy.ipaddress)}else if(t===a.Socks5HostType.Hostname){const t=e[4],o=a.SOCKS_INCOMING_PACKET_SIZES.Socks5ResponseHostname(t);if(this.receiveBuffer.length<o)return void(this.nextRequiredPacketBufferSize=o);r=u.SmartBuffer.fromBuffer(this.receiveBuffer.get(o).slice(5)),n={host:r.readString(t),port:r.readUInt16BE()}}else if(t===a.Socks5HostType.IPv6){const e=a.SOCKS_INCOMING_PACKET_SIZES.Socks5ResponseIPv6;if(this.receiveBuffer.length<e)return void(this.nextRequiredPacketBufferSize=e);r=u.SmartBuffer.fromBuffer(this.receiveBuffer.get(e).slice(4)),n={host:s.toString(r.readBuffer(16)),port:r.readUInt16BE()}}this.setState(a.SocksClientState.Established),this.removeInternalSocketHandlers(),this.emit("established",{remoteHost:n,socket:this.socket})}}get socksClientOptions(){return Object.assign({},this.options)}}t.SocksClient=f},function(e,t,n){"use strict";var r=t,o=n(0).Buffer,i=n(157);r.toBuffer=function(e,t,n){var r;if(n=~~n,this.isV4Format(e))r=t||new o(n+4),e.split(/\./g).map((function(e){r[n++]=255&parseInt(e,10)}));else if(this.isV6Format(e)){var i,s=e.split(":",8);for(i=0;i<s.length;i++){var u;this.isV4Format(s[i])&&(u=this.toBuffer(s[i]),s[i]=u.slice(0,2).toString("hex")),u&&++i<8&&s.splice(i,0,u.slice(2,4).toString("hex"))}if(""===s[0])for(;s.length<8;)s.unshift("0");else if(""===s[s.length-1])for(;s.length<8;)s.push("0");else if(s.length<8){for(i=0;i<s.length&&""!==s[i];i++);var a=[i,1];for(i=9-s.length;i>0;i--)a.push("0");s.splice.apply(s,a)}for(r=t||new o(n+16),i=0;i<s.length;i++){var c=parseInt(s[i],16);r[n++]=c>>8&255,r[n++]=255&c}}if(!r)throw Error("Invalid ip address: "+e);return r},r.toString=function(e,t,n){t=~~t;var r=[];if(4===(n=n||e.length-t)){for(var o=0;o<n;o++)r.push(e[t+o]);r=r.join(".")}else if(16===n){for(o=0;o<n;o+=2)r.push(e.readUInt16BE(t+o).toString(16));r=(r=(r=r.join(":")).replace(/(^|:)0(:0)*:0(:|$)/,"$1::$3")).replace(/:{3,4}/,"::")}return r};var s=/^(\d{1,3}\.){3,3}\d{1,3}$/,u=/^(::)?(((\d{1,3}\.){3}(\d{1,3}){1})?([0-9a-f]){0,4}:{0,2}){1,8}(::)?$/i;function a(e){return e?e.toLowerCase():"ipv4"}r.isV4Format=function(e){return s.test(e)},r.isV6Format=function(e){return u.test(e)},r.fromPrefixLen=function(e,t){var n=4;"ipv6"===(t=e>32?"ipv6":a(t))&&(n=16);for(var i=new o(n),s=0,u=i.length;s<u;++s){var c=8;e<8&&(c=e),e-=c,i[s]=255&~(255>>c)}return r.toString(i)},r.mask=function(e,t){e=r.toBuffer(e),t=r.toBuffer(t);var n=new o(Math.max(e.length,t.length)),i=0;if(e.length===t.length)for(i=0;i<e.length;i++)n[i]=e[i]&t[i];else if(4===t.length)for(i=0;i<t.length;i++)n[i]=e[e.length-4+i]&t[i];else{for(i=0;i<n.length-6;i++)n[i]=0;for(n[10]=255,n[11]=255,i=0;i<e.length;i++)n[i+12]=e[i]&t[i+12];i+=12}for(;i<n.length;i++)n[i]=0;return r.toString(n)},r.cidr=function(e){var t=e.split("/"),n=t[0];if(2!==t.length)throw new Error("invalid CIDR subnet: "+n);var o=r.fromPrefixLen(parseInt(t[1],10));return r.mask(n,o)},r.subnet=function(e,t){for(var n=r.toLong(r.mask(e,t)),o=r.toBuffer(t),i=0,s=0;s<o.length;s++)if(255===o[s])i+=8;else for(var u=255&o[s];u;)u=u<<1&255,i++;var a=Math.pow(2,32-i);return{networkAddress:r.fromLong(n),firstAddress:a<=2?r.fromLong(n):r.fromLong(n+1),lastAddress:a<=2?r.fromLong(n+a-1):r.fromLong(n+a-2),broadcastAddress:r.fromLong(n+a-1),subnetMask:t,subnetMaskLength:i,numHosts:a<=2?a:a-2,length:a,contains:function(e){return n===r.toLong(r.mask(e,t))}}},r.cidrSubnet=function(e){var t=e.split("/"),n=t[0];if(2!==t.length)throw new Error("invalid CIDR subnet: "+n);var o=r.fromPrefixLen(parseInt(t[1],10));return r.subnet(n,o)},r.not=function(e){for(var t=r.toBuffer(e),n=0;n<t.length;n++)t[n]=255^t[n];return r.toString(t)},r.or=function(e,t){if(e=r.toBuffer(e),t=r.toBuffer(t),e.length===t.length){for(var n=0;n<e.length;++n)e[n]|=t[n];return r.toString(e)}var o=e,i=t;t.length>e.length&&(o=t,i=e);var s=o.length-i.length;for(n=s;n<o.length;++n)o[n]|=i[n-s];return r.toString(o)},r.isEqual=function(e,t){if(e=r.toBuffer(e),t=r.toBuffer(t),e.length===t.length){for(var n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}if(4===t.length){var o=t;t=e,e=o}for(n=0;n<10;n++)if(0!==t[n])return!1;var i=t.readUInt16BE(10);if(0!==i&&65535!==i)return!1;for(n=0;n<4;n++)if(e[n]!==t[n+12])return!1;return!0},r.isPrivate=function(e){return/^(::f{4}:)?10\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})$/i.test(e)||/^(::f{4}:)?192\.168\.([0-9]{1,3})\.([0-9]{1,3})$/i.test(e)||/^(::f{4}:)?172\.(1[6-9]|2\d|30|31)\.([0-9]{1,3})\.([0-9]{1,3})$/i.test(e)||/^(::f{4}:)?127\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})$/i.test(e)||/^(::f{4}:)?169\.254\.([0-9]{1,3})\.([0-9]{1,3})$/i.test(e)||/^f[cd][0-9a-f]{2}:/i.test(e)||/^fe80:/i.test(e)||/^::1$/.test(e)||/^::$/.test(e)},r.isPublic=function(e){return!r.isPrivate(e)},r.isLoopback=function(e){return/^(::f{4}:)?127\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})/.test(e)||/^fe80::1$/.test(e)||/^::1$/.test(e)||/^::$/.test(e)},r.loopback=function(e){if("ipv4"!==(e=a(e))&&"ipv6"!==e)throw new Error("family must be ipv4 or ipv6");return"ipv4"===e?"127.0.0.1":"fe80::1"},r.address=function(e,t){var n,o=i.networkInterfaces();if(t=a(t),e&&"private"!==e&&"public"!==e){var s=o[e].filter((function(e){return e.family.toLowerCase()===t}));if(0===s.length)return;return s[0].address}return(n=Object.keys(o).map((function(n){var i=o[n].filter((function(n){return n.family=n.family.toLowerCase(),n.family===t&&!r.isLoopback(n.address)&&(!e||("public"===e?r.isPrivate(n.address):r.isPublic(n.address)))}));return i.length?i[0].address:void 0})).filter(Boolean)).length?n[0]:r.loopback(t)},r.toLong=function(e){var t=0;return e.split(".").forEach((function(e){t<<=8,t+=parseInt(e)})),t>>>0},r.fromLong=function(e){return(e>>>24)+"."+(e>>16&255)+"."+(e>>8&255)+"."+(255&e)}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(408);class o{constructor(e){if(this.length=0,this._encoding="utf8",this._writeOffset=0,this._readOffset=0,o.isSmartBufferOptions(e))if(e.encoding&&(r.checkEncoding(e.encoding),this._encoding=e.encoding),e.size){if(!(r.isFiniteInteger(e.size)&&e.size>0))throw new Error(r.ERRORS.INVALID_SMARTBUFFER_SIZE);this._buff=Buffer.allocUnsafe(e.size)}else if(e.buff){if(!Buffer.isBuffer(e.buff))throw new Error(r.ERRORS.INVALID_SMARTBUFFER_BUFFER);this._buff=e.buff,this.length=e.buff.length}else this._buff=Buffer.allocUnsafe(4096);else{if(void 0!==e)throw new Error(r.ERRORS.INVALID_SMARTBUFFER_OBJECT);this._buff=Buffer.allocUnsafe(4096)}}static fromSize(e,t){return new this({size:e,encoding:t})}static fromBuffer(e,t){return new this({buff:e,encoding:t})}static fromOptions(e){return new this(e)}static isSmartBufferOptions(e){const t=e;return t&&(void 0!==t.encoding||void 0!==t.size||void 0!==t.buff)}readInt8(e){return this._readNumberValue(Buffer.prototype.readInt8,1,e)}readInt16BE(e){return this._readNumberValue(Buffer.prototype.readInt16BE,2,e)}readInt16LE(e){return this._readNumberValue(Buffer.prototype.readInt16LE,2,e)}readInt32BE(e){return this._readNumberValue(Buffer.prototype.readInt32BE,4,e)}readInt32LE(e){return this._readNumberValue(Buffer.prototype.readInt32LE,4,e)}readBigInt64BE(e){return r.bigIntAndBufferInt64Check("readBigInt64BE"),this._readNumberValue(Buffer.prototype.readBigInt64BE,8,e)}readBigInt64LE(e){return r.bigIntAndBufferInt64Check("readBigInt64LE"),this._readNumberValue(Buffer.prototype.readBigInt64LE,8,e)}writeInt8(e,t){return this._writeNumberValue(Buffer.prototype.writeInt8,1,e,t),this}insertInt8(e,t){return this._insertNumberValue(Buffer.prototype.writeInt8,1,e,t)}writeInt16BE(e,t){return this._writeNumberValue(Buffer.prototype.writeInt16BE,2,e,t)}insertInt16BE(e,t){return this._insertNumberValue(Buffer.prototype.writeInt16BE,2,e,t)}writeInt16LE(e,t){return this._writeNumberValue(Buffer.prototype.writeInt16LE,2,e,t)}insertInt16LE(e,t){return this._insertNumberValue(Buffer.prototype.writeInt16LE,2,e,t)}writeInt32BE(e,t){return this._writeNumberValue(Buffer.prototype.writeInt32BE,4,e,t)}insertInt32BE(e,t){return this._insertNumberValue(Buffer.prototype.writeInt32BE,4,e,t)}writeInt32LE(e,t){return this._writeNumberValue(Buffer.prototype.writeInt32LE,4,e,t)}insertInt32LE(e,t){return this._insertNumberValue(Buffer.prototype.writeInt32LE,4,e,t)}writeBigInt64BE(e,t){return r.bigIntAndBufferInt64Check("writeBigInt64BE"),this._writeNumberValue(Buffer.prototype.writeBigInt64BE,8,e,t)}insertBigInt64BE(e,t){return r.bigIntAndBufferInt64Check("writeBigInt64BE"),this._insertNumberValue(Buffer.prototype.writeBigInt64BE,8,e,t)}writeBigInt64LE(e,t){return r.bigIntAndBufferInt64Check("writeBigInt64LE"),this._writeNumberValue(Buffer.prototype.writeBigInt64LE,8,e,t)}insertBigInt64LE(e,t){return r.bigIntAndBufferInt64Check("writeBigInt64LE"),this._insertNumberValue(Buffer.prototype.writeBigInt64LE,8,e,t)}readUInt8(e){return this._readNumberValue(Buffer.prototype.readUInt8,1,e)}readUInt16BE(e){return this._readNumberValue(Buffer.prototype.readUInt16BE,2,e)}readUInt16LE(e){return this._readNumberValue(Buffer.prototype.readUInt16LE,2,e)}readUInt32BE(e){return this._readNumberValue(Buffer.prototype.readUInt32BE,4,e)}readUInt32LE(e){return this._readNumberValue(Buffer.prototype.readUInt32LE,4,e)}readBigUInt64BE(e){return r.bigIntAndBufferInt64Check("readBigUInt64BE"),this._readNumberValue(Buffer.prototype.readBigUInt64BE,8,e)}readBigUInt64LE(e){return r.bigIntAndBufferInt64Check("readBigUInt64LE"),this._readNumberValue(Buffer.prototype.readBigUInt64LE,8,e)}writeUInt8(e,t){return this._writeNumberValue(Buffer.prototype.writeUInt8,1,e,t)}insertUInt8(e,t){return this._insertNumberValue(Buffer.prototype.writeUInt8,1,e,t)}writeUInt16BE(e,t){return this._writeNumberValue(Buffer.prototype.writeUInt16BE,2,e,t)}insertUInt16BE(e,t){return this._insertNumberValue(Buffer.prototype.writeUInt16BE,2,e,t)}writeUInt16LE(e,t){return this._writeNumberValue(Buffer.prototype.writeUInt16LE,2,e,t)}insertUInt16LE(e,t){return this._insertNumberValue(Buffer.prototype.writeUInt16LE,2,e,t)}writeUInt32BE(e,t){return this._writeNumberValue(Buffer.prototype.writeUInt32BE,4,e,t)}insertUInt32BE(e,t){return this._insertNumberValue(Buffer.prototype.writeUInt32BE,4,e,t)}writeUInt32LE(e,t){return this._writeNumberValue(Buffer.prototype.writeUInt32LE,4,e,t)}insertUInt32LE(e,t){return this._insertNumberValue(Buffer.prototype.writeUInt32LE,4,e,t)}writeBigUInt64BE(e,t){return r.bigIntAndBufferInt64Check("writeBigUInt64BE"),this._writeNumberValue(Buffer.prototype.writeBigUInt64BE,8,e,t)}insertBigUInt64BE(e,t){return r.bigIntAndBufferInt64Check("writeBigUInt64BE"),this._insertNumberValue(Buffer.prototype.writeBigUInt64BE,8,e,t)}writeBigUInt64LE(e,t){return r.bigIntAndBufferInt64Check("writeBigUInt64LE"),this._writeNumberValue(Buffer.prototype.writeBigUInt64LE,8,e,t)}insertBigUInt64LE(e,t){return r.bigIntAndBufferInt64Check("writeBigUInt64LE"),this._insertNumberValue(Buffer.prototype.writeBigUInt64LE,8,e,t)}readFloatBE(e){return this._readNumberValue(Buffer.prototype.readFloatBE,4,e)}readFloatLE(e){return this._readNumberValue(Buffer.prototype.readFloatLE,4,e)}writeFloatBE(e,t){return this._writeNumberValue(Buffer.prototype.writeFloatBE,4,e,t)}insertFloatBE(e,t){return this._insertNumberValue(Buffer.prototype.writeFloatBE,4,e,t)}writeFloatLE(e,t){return this._writeNumberValue(Buffer.prototype.writeFloatLE,4,e,t)}insertFloatLE(e,t){return this._insertNumberValue(Buffer.prototype.writeFloatLE,4,e,t)}readDoubleBE(e){return this._readNumberValue(Buffer.prototype.readDoubleBE,8,e)}readDoubleLE(e){return this._readNumberValue(Buffer.prototype.readDoubleLE,8,e)}writeDoubleBE(e,t){return this._writeNumberValue(Buffer.prototype.writeDoubleBE,8,e,t)}insertDoubleBE(e,t){return this._insertNumberValue(Buffer.prototype.writeDoubleBE,8,e,t)}writeDoubleLE(e,t){return this._writeNumberValue(Buffer.prototype.writeDoubleLE,8,e,t)}insertDoubleLE(e,t){return this._insertNumberValue(Buffer.prototype.writeDoubleLE,8,e,t)}readString(e,t){let n;"number"==typeof e?(r.checkLengthValue(e),n=Math.min(e,this.length-this._readOffset)):(t=e,n=this.length-this._readOffset),void 0!==t&&r.checkEncoding(t);const o=this._buff.slice(this._readOffset,this._readOffset+n).toString(t||this._encoding);return this._readOffset+=n,o}insertString(e,t,n){return r.checkOffsetValue(t),this._handleString(e,!0,t,n)}writeString(e,t,n){return this._handleString(e,!1,t,n)}readStringNT(e){void 0!==e&&r.checkEncoding(e);let t=this.length;for(let e=this._readOffset;e<this.length;e++)if(0===this._buff[e]){t=e;break}const n=this._buff.slice(this._readOffset,t);return this._readOffset=t+1,n.toString(e||this._encoding)}insertStringNT(e,t,n){return r.checkOffsetValue(t),this.insertString(e,t,n),this.insertUInt8(0,t+e.length),this}writeStringNT(e,t,n){return this.writeString(e,t,n),this.writeUInt8(0,"number"==typeof t?t+e.length:this.writeOffset),this}readBuffer(e){void 0!==e&&r.checkLengthValue(e);const t="number"==typeof e?e:this.length,n=Math.min(this.length,this._readOffset+t),o=this._buff.slice(this._readOffset,n);return this._readOffset=n,o}insertBuffer(e,t){return r.checkOffsetValue(t),this._handleBuffer(e,!0,t)}writeBuffer(e,t){return this._handleBuffer(e,!1,t)}readBufferNT(){let e=this.length;for(let t=this._readOffset;t<this.length;t++)if(0===this._buff[t]){e=t;break}const t=this._buff.slice(this._readOffset,e);return this._readOffset=e+1,t}insertBufferNT(e,t){return r.checkOffsetValue(t),this.insertBuffer(e,t),this.insertUInt8(0,t+e.length),this}writeBufferNT(e,t){return void 0!==t&&r.checkOffsetValue(t),this.writeBuffer(e,t),this.writeUInt8(0,"number"==typeof t?t+e.length:this._writeOffset),this}clear(){return this._writeOffset=0,this._readOffset=0,this.length=0,this}remaining(){return this.length-this._readOffset}get readOffset(){return this._readOffset}set readOffset(e){r.checkOffsetValue(e),r.checkTargetOffset(e,this),this._readOffset=e}get writeOffset(){return this._writeOffset}set writeOffset(e){r.checkOffsetValue(e),r.checkTargetOffset(e,this),this._writeOffset=e}get encoding(){return this._encoding}set encoding(e){r.checkEncoding(e),this._encoding=e}get internalBuffer(){return this._buff}toBuffer(){return this._buff.slice(0,this.length)}toString(e){const t="string"==typeof e?e:this._encoding;return r.checkEncoding(t),this._buff.toString(t,0,this.length)}destroy(){return this.clear(),this}_handleString(e,t,n,o){let i=this._writeOffset,s=this._encoding;"number"==typeof n?i=n:"string"==typeof n&&(r.checkEncoding(n),s=n),"string"==typeof o&&(r.checkEncoding(o),s=o);const u=Buffer.byteLength(e,s);return t?this.ensureInsertable(u,i):this._ensureWriteable(u,i),this._buff.write(e,i,u,s),t?this._writeOffset+=u:"number"==typeof n?this._writeOffset=Math.max(this._writeOffset,i+u):this._writeOffset+=u,this}_handleBuffer(e,t,n){const r="number"==typeof n?n:this._writeOffset;return t?this.ensureInsertable(e.length,r):this._ensureWriteable(e.length,r),e.copy(this._buff,r),t?this._writeOffset+=e.length:"number"==typeof n?this._writeOffset=Math.max(this._writeOffset,r+e.length):this._writeOffset+=e.length,this}ensureReadable(e,t){let n=this._readOffset;if(void 0!==t&&(r.checkOffsetValue(t),n=t),n<0||n+e>this.length)throw new Error(r.ERRORS.INVALID_READ_BEYOND_BOUNDS)}ensureInsertable(e,t){r.checkOffsetValue(t),this._ensureCapacity(this.length+e),t<this.length&&this._buff.copy(this._buff,t+e,t,this._buff.length),t+e>this.length?this.length=t+e:this.length+=e}_ensureWriteable(e,t){const n="number"==typeof t?t:this._writeOffset;this._ensureCapacity(n+e),n+e>this.length&&(this.length=n+e)}_ensureCapacity(e){const t=this._buff.length;if(e>t){let n=this._buff,r=3*t/2+1;r<e&&(r=e),this._buff=Buffer.allocUnsafe(r),n.copy(this._buff,0,0,t)}}_readNumberValue(e,t,n){this.ensureReadable(t,n);const r=e.call(this._buff,"number"==typeof n?n:this._readOffset);return void 0===n&&(this._readOffset+=t),r}_insertNumberValue(e,t,n,o){return r.checkOffsetValue(o),this.ensureInsertable(t,o),e.call(this._buff,n,o),this._writeOffset+=t,this}_writeNumberValue(e,t,n,o){if("number"==typeof o){if(o<0)throw new Error(r.ERRORS.INVALID_WRITE_BEYOND_BOUNDS);r.checkOffsetValue(o)}const i="number"==typeof o?o:this._writeOffset;return this._ensureWriteable(t,i),e.call(this._buff,n,i),"number"==typeof o?this._writeOffset=Math.max(this._writeOffset,i+t):this._writeOffset+=t,this}}t.SmartBuffer=o},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(0),o={INVALID_ENCODING:"Invalid encoding provided. Please specify a valid encoding the internal Node.js Buffer supports.",INVALID_SMARTBUFFER_SIZE:"Invalid size provided. Size must be a valid integer greater than zero.",INVALID_SMARTBUFFER_BUFFER:"Invalid Buffer provided in SmartBufferOptions.",INVALID_SMARTBUFFER_OBJECT:"Invalid SmartBufferOptions object supplied to SmartBuffer constructor or factory methods.",INVALID_OFFSET:"An invalid offset value was provided.",INVALID_OFFSET_NON_NUMBER:"An invalid offset value was provided. A numeric value is required.",INVALID_LENGTH:"An invalid length value was provided.",INVALID_LENGTH_NON_NUMBER:"An invalid length value was provived. A numeric value is required.",INVALID_TARGET_OFFSET:"Target offset is beyond the bounds of the internal SmartBuffer data.",INVALID_TARGET_LENGTH:"Specified length value moves cursor beyong the bounds of the internal SmartBuffer data.",INVALID_READ_BEYOND_BOUNDS:"Attempted to read beyond the bounds of the managed data.",INVALID_WRITE_BEYOND_BOUNDS:"Attempted to write beyond the bounds of the managed data."};function i(e){return"number"==typeof e&&isFinite(e)&&function(e){return"number"==typeof e&&isFinite(e)&&Math.floor(e)===e}(e)}function s(e,t){if("number"!=typeof e)throw new Error(t?o.INVALID_OFFSET_NON_NUMBER:o.INVALID_LENGTH_NON_NUMBER);if(!i(e)||e<0)throw new Error(t?o.INVALID_OFFSET:o.INVALID_LENGTH)}t.ERRORS=o,t.checkEncoding=function(e){if(!r.Buffer.isEncoding(e))throw new Error(o.INVALID_ENCODING)},t.isFiniteInteger=i,t.checkLengthValue=function(e){s(e,!1)},t.checkOffsetValue=function(e){s(e,!0)},t.checkTargetOffset=function(e,t){if(e<0||e>t.length)throw new Error(o.INVALID_TARGET_OFFSET)},t.bigIntAndBufferInt64Check=function(e){if("undefined"==typeof BigInt)throw new Error("Platform does not support JS BigInt type.");if(void 0===r.Buffer.prototype[e])throw new Error(`Platform does not support Buffer.prototype.${e}.`)}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.validateSocksClientChainOptions=t.validateSocksClientOptions=void 0;const r=n(184),o=n(183),i=n(25);function s(e,t){if(void 0!==e.custom_auth_method){if(e.custom_auth_method<o.SOCKS5_CUSTOM_AUTH_START||e.custom_auth_method>o.SOCKS5_CUSTOM_AUTH_END)throw new r.SocksClientError(o.ERRORS.InvalidSocksClientOptionsCustomAuthRange,t);if(void 0===e.custom_auth_request_handler||"function"!=typeof e.custom_auth_request_handler)throw new r.SocksClientError(o.ERRORS.InvalidSocksClientOptionsCustomAuthOptions,t);if(void 0===e.custom_auth_response_size)throw new r.SocksClientError(o.ERRORS.InvalidSocksClientOptionsCustomAuthOptions,t);if(void 0===e.custom_auth_response_handler||"function"!=typeof e.custom_auth_response_handler)throw new r.SocksClientError(o.ERRORS.InvalidSocksClientOptionsCustomAuthOptions,t)}}function u(e){return e&&"string"==typeof e.host&&"number"==typeof e.port&&e.port>=0&&e.port<=65535}function a(e){return e&&("string"==typeof e.host||"string"==typeof e.ipaddress)&&"number"==typeof e.port&&e.port>=0&&e.port<=65535&&(4===e.type||5===e.type)}function c(e){return"number"==typeof e&&e>0}t.validateSocksClientOptions=function(e,t=["connect","bind","associate"]){if(!o.SocksCommand[e.command])throw new r.SocksClientError(o.ERRORS.InvalidSocksCommand,e);if(-1===t.indexOf(e.command))throw new r.SocksClientError(o.ERRORS.InvalidSocksCommandForOperation,e);if(!u(e.destination))throw new r.SocksClientError(o.ERRORS.InvalidSocksClientOptionsDestination,e);if(!a(e.proxy))throw new r.SocksClientError(o.ERRORS.InvalidSocksClientOptionsProxy,e);if(s(e.proxy,e),e.timeout&&!c(e.timeout))throw new r.SocksClientError(o.ERRORS.InvalidSocksClientOptionsTimeout,e);if(e.existing_socket&&!(e.existing_socket instanceof i.Duplex))throw new r.SocksClientError(o.ERRORS.InvalidSocksClientOptionsExistingSocket,e)},t.validateSocksClientChainOptions=function(e){if("connect"!==e.command)throw new r.SocksClientError(o.ERRORS.InvalidSocksCommandChain,e);if(!u(e.destination))throw new r.SocksClientError(o.ERRORS.InvalidSocksClientOptionsDestination,e);if(!(e.proxies&&Array.isArray(e.proxies)&&e.proxies.length>=2))throw new r.SocksClientError(o.ERRORS.InvalidSocksClientOptionsProxiesLength,e);if(e.proxies.forEach(t=>{if(!a(t))throw new r.SocksClientError(o.ERRORS.InvalidSocksClientOptionsProxy,e);s(t,e)}),e.timeout&&!c(e.timeout))throw new r.SocksClientError(o.ERRORS.InvalidSocksClientOptionsTimeout,e)}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ReceiveBuffer=void 0;t.ReceiveBuffer=class{constructor(e=4096){this.buffer=Buffer.allocUnsafe(e),this.offset=0,this.originalSize=e}get length(){return this.offset}append(e){if(!Buffer.isBuffer(e))throw new Error("Attempted to append a non-buffer instance to ReceiveBuffer.");if(this.offset+e.length>=this.buffer.length){const t=this.buffer;this.buffer=Buffer.allocUnsafe(Math.max(this.buffer.length+this.originalSize,this.buffer.length+e.length)),t.copy(this.buffer)}return e.copy(this.buffer,this.offset),this.offset+=e.length}peek(e){if(e>this.offset)throw new Error("Attempted to read beyond the bounds of the managed internal data.");return this.buffer.slice(0,e)}get(e){if(e>this.offset)throw new Error("Attempted to read beyond the bounds of the managed internal data.");const t=Buffer.allocUnsafe(e);return this.buffer.slice(0,e).copy(t),this.buffer.copyWithin(0,e,e+this.offset-e),this.offset-=e,t}}},function(e,t,n){"use strict";const r=Symbol("buffers"),o=Symbol("length");e.exports={BufferPool:class{constructor(){this[r]=[],this[o]=0}get length(){return this[o]}append(e){this[r].push(e),this[o]+=e.length}peek(e){return this.read(e,!1)}read(e,t=!0){if("number"!=typeof e||e<0)throw new Error('Argument "size" must be a non-negative number');if(e>this[o])return Buffer.alloc(0);let n;if(e===this.length)n=Buffer.concat(this[r]),t&&(this[r]=[],this[o]=0);else if(e<=this[r][0].length)n=this[r][0].slice(0,e),t&&(this[r][0]=this[r][0].slice(e),this[o]-=e);else{let i;n=Buffer.allocUnsafe(e);let s=0,u=e;for(i=0;i<this[r].length;++i){let e;if(!(u>this[r][i].length)){e=this[r][i].copy(n,s,0,u),t&&(this[r][i]=this[r][i].slice(e)),s+=e;break}e=this[r][i].copy(n,s,0),s+=e,u-=e}t&&(this[r]=this[r].slice(i),this[o]-=e)}return n}}}},function(e,t,n){"use strict";e.exports=function(e){const t=n(185)("mongocrypt"),r=n(65).databaseNamespace,o=e.stateMachine.StateMachine,i=n(414).MongocryptdManager,s=e.mongodb.MongoClient,u=e.mongodb.MongoError,a=n(186);return{AutoEncrypter:class{constructor(e,n){this._client=e,this._bson=n.bson||e.topology.bson,this._bypassEncryption=!0===n.bypassAutoEncryption,this._keyVaultNamespace=n.keyVaultNamespace||"admin.datakeys",this._keyVaultClient=n.keyVaultClient||e,this._metaDataClient=n.metadataClient||e,this._proxyOptions=n.proxyOptions||{},this._tlsOptions=n.tlsOptions||{},this._onKmsProviderRefresh=n.onKmsProviderRefresh;const r={};if(n.schemaMap&&(r.schemaMap=Buffer.isBuffer(n.schemaMap)?n.schemaMap:this._bson.serialize(n.schemaMap)),n.encryptedFieldsMap&&(r.encryptedFieldsMap=Buffer.isBuffer(n.encryptedFieldsMap)?n.encryptedFieldsMap:this._bson.serialize(n.encryptedFieldsMap)),n.kmsProviders)r.kmsProviders=Buffer.isBuffer(n.kmsProviders)?n.kmsProviders:this._bson.serialize(n.kmsProviders);else if(!n.onKmsProviderRefresh)throw new TypeError("Need to specify either kmsProviders ahead of time or when requested");if(n.logger&&(r.logger=n.logger),n.extraOptions&&n.extraOptions.csflePath&&(r.csflePath=n.extraOptions.csflePath),n.extraOptions&&n.extraOptions.csfleSearchPaths?r.csfleSearchPaths=n.extraOptions.csfleSearchPaths:this._bypassEncryption||(r.csfleSearchPaths=["$SYSTEM"]),n.bypassQueryAnalysis&&(r.bypassQueryAnalysis=n.bypassQueryAnalysis),Object.assign(r,{cryptoCallbacks:a}),this._mongocrypt=new t.MongoCrypt(r),this._contextCounter=0,n.extraOptions&&n.extraOptions.csfleRequired&&!this.csfleVersionInfo)throw new u("`csfleRequired` set but no csfle shared library loaded");this._bypassEncryption||this.csfleVersionInfo||(this._mongocryptdManager=new i(n.extraOptions),this._mongocryptdClient=new s(this._mongocryptdManager.uri,{useNewUrlParser:!0,useUnifiedTopology:!0,serverSelectionTimeoutMS:1e4}))}init(e){if(this._bypassEncryption||this.csfleVersionInfo)return e();const t=(t,n)=>{t&&t.message&&(t.message.match(/timed out after/)||t.message.match(/ENOTFOUND/))?e(new u("Unable to connect to `mongocryptd`, please make sure it is running or in your PATH for auto-spawn")):e(t,n)};if(this._mongocryptdManager.bypassSpawn)return this._mongocryptdClient.connect(t);this._mongocryptdManager.spawn(()=>this._mongocryptdClient.connect(t))}teardown(e,t){this._mongocryptdClient?this._mongocryptdClient.close(e,t):t()}encrypt(e,t,n,i){if("string"!=typeof e)throw new TypeError("Parameter `ns` must be a string");if("object"!=typeof t)throw new TypeError("Parameter `cmd` must be an object");if("function"==typeof n&&null==i&&(i=n,n={}),this._bypassEncryption)return void i(void 0,t);const s=this._bson,u=Buffer.isBuffer(t)?t:s.serialize(t,n);let a;try{a=this._mongocrypt.makeEncryptionContext(r(e),u)}catch(e){return void i(e,null)}a.id=this._contextCounter++,a.ns=e,a.document=t,new o({bson:s,...n,proxyOptions:this._proxyOptions,tlsOptions:this._tlsOptions}).execute(this,a,i)}decrypt(e,t,n){"function"==typeof t&&null==n&&(n=t,t={});const r=this._bson,i=Buffer.isBuffer(e)?e:r.serialize(e,t);let s;try{s=this._mongocrypt.makeDecryptionContext(i)}catch(e){return void n(e,null)}s.id=this._contextCounter++;const u=new o({bson:r,...t,proxyOptions:this._proxyOptions,tlsOptions:this._tlsOptions}),a=this[Symbol.for("@@mdb.decorateDecryptionResult")];u.execute(this,s,(function(t,o){if(!t&&o&&a&&(t=function e(t,n,r,o=!0){const i=Symbol.for("@@mdb.decryptedKeys");if(o&&(Buffer.isBuffer(n)&&(n=r.deserialize(n)),Buffer.isBuffer(t)))return new Error("Expected result of decryption to be deserialized BSON object");if(!t||"object"!=typeof t)return;for(const o of Object.keys(t)){const s=n[o];s&&"Binary"===s._bsontype&&6===s.sub_type&&(t[i]||Object.defineProperty(t,i,{value:[],configurable:!0,enumerable:!1,writable:!1}),t[i].push(o)),e(t[o],s,r,!1)}}(o,e,r)))return n(t);n(t,o)}))}async askForKMSCredentials(){return this._onKmsProviderRefresh?this._onKmsProviderRefresh():{}}get csfleVersionInfo(){return this._mongocrypt.csfleVersionInfo}}}}},function(e,t,n){var r=n(110).sep||"/";e.exports=function(e){if("string"!=typeof e||e.length<=7||"file://"!=e.substring(0,7))throw new TypeError("must pass in a file:// URI to convert to a file path");var t=decodeURI(e.substring(7)),n=t.indexOf("/"),o=t.substring(0,n),i=t.substring(n+1);"localhost"==o&&(o="");o&&(o=r+r+o);i=i.replace(/^(.+)\|/,"$1:"),"\\"==r&&(i=i.replace(/\//g,"\\"));/^.+\:/.test(i)||(i=r+i);return o+i}},function(e,t,n){"use strict";const r=n(415).spawn;e.exports={MongocryptdManager:class{constructor(e){(e=e||{}).mongocryptdURI?this.uri=e.mongocryptdURI:this.uri="mongodb://localhost:27020/?serverSelectionTimeoutMS=1000",this.bypassSpawn=!!e.mongocryptdBypassSpawn,this.spawnPath=e.mongocryptdSpawnPath||"",this.spawnArgs=[],Array.isArray(e.mongocryptdSpawnArgs)&&(this.spawnArgs=this.spawnArgs.concat(e.mongocryptdSpawnArgs)),this.spawnArgs.filter(e=>"string"==typeof e).every(e=>e.indexOf("--idleShutdownTimeoutSecs")<0)&&this.spawnArgs.push("--idleShutdownTimeoutSecs",60)}spawn(e){const t=this.spawnPath||"mongocryptd";this._child=r(t,this.spawnArgs,{stdio:"ignore",detached:!0}),this._child.on("error",()=>{}),this._child.unref(),process.nextTick(e)}}}},function(e,t){e.exports=require("child_process")},function(e,t,n){"use strict";e.exports=function(e){const t=n(185)("mongocrypt"),r=n(65),o=r.databaseNamespace,i=r.collectionNamespace,s=r.promiseOrCallback,u=e.stateMachine.StateMachine,a=n(186);return{ClientEncryption:class{constructor(e,n){if(this._client=e,this._bson=n.bson||e.topology.bson,this._proxyOptions=n.proxyOptions,this._tlsOptions=n.tlsOptions,null==n.keyVaultNamespace)throw new TypeError("Missing required option `keyVaultNamespace`");if(Object.assign(n,{cryptoCallbacks:a}),n.kmsProviders&&!Buffer.isBuffer(n.kmsProviders))n.kmsProviders=this._bson.serialize(n.kmsProviders);else if(!n.onKmsProviderRefresh)throw new TypeError("Need to specify either kmsProviders ahead of time or when requested");this._onKmsProviderRefresh=n.onKmsProviderRefresh,this._keyVaultNamespace=n.keyVaultNamespace,this._keyVaultClient=n.keyVaultClient||e,this._mongoCrypt=new t.MongoCrypt(n)}createDataKey(e,t,n){"function"==typeof t&&(n=t,t={}),null==t&&(t={});const r=this._bson,a=Object.assign({provider:e},t.masterKey);if(t.keyAltNames&&!Array.isArray(t.keyAltNames))throw new TypeError(`Option "keyAltNames" must be an array of strings, but was of type ${typeof t.keyAltNames}.`);let c=void 0;t.keyAltNames&&t.keyAltNames.length>0&&(c=t.keyAltNames.map((e,t)=>{if("string"!=typeof e)throw new TypeError(`Option "keyAltNames" must be an array of strings, but item at index ${t} was of type ${typeof e}`);return r.serialize({keyAltName:e})}));const l=r.serialize(a),d=this._mongoCrypt.makeDataKeyContext(l,{keyAltNames:c}),f=new u({bson:r,proxyOptions:this._proxyOptions,tlsOptions:this._tlsOptions});return s(n,e=>{f.execute(this,d,(t,n)=>{if(t)return void e(t,null);const r=o(this._keyVaultNamespace),s=i(this._keyVaultNamespace);this._keyVaultClient.db(r).collection(s).insertOne(n,{writeConcern:{w:"majority"}},(t,n)=>{t?e(t,null):e(null,n.insertedId)})})})}encrypt(e,t,n){const r=this._bson,o=r.serialize({v:e}),i=Object.assign({},t);if(t.keyId&&(i.keyId=t.keyId.buffer),t.keyAltName){const e=t.keyAltName;if(t.keyId)throw new TypeError('"options" cannot contain both "keyId" and "keyAltName"');const n=typeof e;if("string"!==n)throw new TypeError(`"options.keyAltName" must be of type string, but was of type ${n}`);i.keyAltName=r.serialize({keyAltName:e})}const a=new u({bson:r,proxyOptions:this._proxyOptions,tlsOptions:this._tlsOptions}),c=this._mongoCrypt.makeExplicitEncryptionContext(o,i);return s(n,e=>{a.execute(this,c,(t,n)=>{t?e(t,null):e(null,n.v)})})}decrypt(e,t){const n=this._bson,r=n.serialize({v:e}),o=this._mongoCrypt.makeExplicitDecryptionContext(r),i=new u({bson:n,proxyOptions:this._proxyOptions,tlsOptions:this._tlsOptions});return s(t,e=>{i.execute(this,o,(t,n)=>{t?e(t,null):e(null,n.v)})})}async askForKMSCredentials(){return this._onKmsProviderRefresh?this._onKmsProviderRefresh():{}}}}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.connect=void 0;const r=n(103),o=n(8),i=n(1),s=n(418);function u(e,t,n){const r=new s.Topology(t.hosts,t);e.topology=r,r.client=e,r.once(s.Topology.OPEN,()=>e.emit("open",e));for(const t of o.MONGO_CLIENT_EVENTS)r.on(t,(...n)=>e.emit(t,...n));e.autoEncrypter?e.autoEncrypter.init(e=>{if(e)return n(e);r.connect(t,e=>{if(e)return r.close({force:!0}),n(e);t.encrypter.connectInternalClient(e=>{if(e)return n(e);n(void 0,r)})})}):r.connect(t,e=>{if(e)return r.close({force:!0}),n(e);n(void 0,r)})}t.connect=function(e,t,n){if(!n)throw new i.MongoInvalidArgumentError("Callback function must be provided");if(e.topology&&e.topology.isConnected())return n(void 0,e);const o=e.logger,s=t=>{const r="seed list contains no mongos proxies, replicaset connections requires the parameter replicaSet to be supplied in the URI or options object, mongodb://server:port/db?replicaSet=name";if(t&&"no mongos proxies found in seed list"===t.message)return o.isWarn()&&o.warn(r),n(new i.MongoRuntimeError(r));n(t,e)};return"string"==typeof t.srvHost?(0,r.resolveSRVRecord)(t,(r,o)=>{if(r||!o)return n(r);for(const[e,n]of o.entries())t.hosts[e]=n;return u(e,t,s)}):u(e,t,s)}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ServerCapabilities=t.Topology=void 0;const r=n(97),o=n(21),i=n(4),s=n(103),u=n(8),a=n(1),c=n(9),l=n(6),d=n(99),f=n(2),p=n(12),h=n(113),m=n(187),g=n(62),E=n(95),y=n(191),v=n(168);let A=0;const b=(0,f.makeStateMachine)({[p.STATE_CLOSED]:[p.STATE_CLOSED,p.STATE_CONNECTING],[p.STATE_CONNECTING]:[p.STATE_CONNECTING,p.STATE_CLOSING,p.STATE_CONNECTED,p.STATE_CLOSED],[p.STATE_CONNECTED]:[p.STATE_CONNECTED,p.STATE_CLOSING,p.STATE_CLOSED],[p.STATE_CLOSING]:[p.STATE_CLOSING,p.STATE_CLOSED]}),C=Symbol("cancelled"),S=Symbol("waitQueue");class O extends c.TypedEventEmitter{constructor(e,t){var n;super(),this.bson=Object.create(null),this.bson.serialize=i.serialize,this.bson.deserialize=i.deserialize,t=null!=t?t:{hosts:[f.HostAddress.fromString("localhost:27017")],...Object.fromEntries(s.DEFAULT_OPTIONS.entries()),...Object.fromEntries(s.FEATURE_FLAGS.entries())},"string"==typeof e?e=[f.HostAddress.fromString(e)]:Array.isArray(e)||(e=[e]);const o=[];for(const t of e)if("string"==typeof t)o.push(f.HostAddress.fromString(t));else{if(!(t instanceof f.HostAddress))throw new a.MongoRuntimeError(`Topology cannot be constructed from ${JSON.stringify(t)}`);o.push(t)}const u=function(e){if(null==e?void 0:e.directConnection)return p.TopologyType.Single;if(null==e?void 0:e.replicaSet)return p.TopologyType.ReplicaSetNoPrimary;if(null==e?void 0:e.loadBalanced)return p.TopologyType.LoadBalanced;return p.TopologyType.Unknown}(t),c=A++,l=null==t.srvMaxHosts||0===t.srvMaxHosts||t.srvMaxHosts>=o.length?o:(0,f.shuffle)(o,t.srvMaxHosts),h=new Map;for(const e of l)h.set(e.toString(),new g.ServerDescription(e));this[S]=new r,this.s={id:c,options:t,seedlist:o,state:p.STATE_CLOSED,description:new v.TopologyDescription(u,h,t.replicaSet,void 0,void 0,void 0,t),serverSelectionTimeoutMS:t.serverSelectionTimeoutMS,heartbeatFrequencyMS:t.heartbeatFrequencyMS,minHeartbeatFrequencyMS:t.minHeartbeatFrequencyMS,servers:new Map,sessionPool:new d.ServerSessionPool(this),sessions:new Set,credentials:null==t?void 0:t.credentials,clusterTime:void 0,connectionTimers:new Set,detectShardedTopology:e=>this.detectShardedTopology(e),detectSrvRecords:e=>this.detectSrvRecords(e)},t.srvHost&&!t.loadBalanced&&(this.s.srvPoller=null!==(n=t.srvPoller)&&void 0!==n?n:new y.SrvPoller({heartbeatFrequencyMS:this.s.heartbeatFrequencyMS,srvHost:t.srvHost,srvMaxHosts:t.srvMaxHosts,srvServiceName:t.srvServiceName}),this.on(O.TOPOLOGY_DESCRIPTION_CHANGED,this.s.detectShardedTopology))}detectShardedTopology(e){var t,n,r;const o=e.previousDescription.type,i=e.newDescription.type,s=o!==p.TopologyType.Sharded&&i===p.TopologyType.Sharded,u=null===(t=this.s.srvPoller)||void 0===t?void 0:t.listeners(y.SrvPoller.SRV_RECORD_DISCOVERY),a=!!(null==u?void 0:u.includes(this.s.detectSrvRecords));s&&!a&&(null===(n=this.s.srvPoller)||void 0===n||n.on(y.SrvPoller.SRV_RECORD_DISCOVERY,this.s.detectSrvRecords),null===(r=this.s.srvPoller)||void 0===r||r.start())}detectSrvRecords(e){const t=this.s.description;this.s.description=this.s.description.updateFromSrvPollingEvent(e,this.s.options.srvMaxHosts),this.s.description!==t&&(D(this),this.emit(O.TOPOLOGY_DESCRIPTION_CHANGED,new h.TopologyDescriptionChangedEvent(this.s.id,t,this.s.description)))}get description(){return this.s.description}get loadBalanced(){return this.s.options.loadBalanced}get capabilities(){return new F(this.lastHello())}connect(e,t){var n;if("function"==typeof e&&(t=e,e={}),e=null!=e?e:{},this.s.state===p.STATE_CONNECTED)return void("function"==typeof t&&t());b(this,p.STATE_CONNECTING),this.emit(O.TOPOLOGY_OPENING,new h.TopologyOpeningEvent(this.s.id)),this.emit(O.TOPOLOGY_DESCRIPTION_CHANGED,new h.TopologyDescriptionChangedEvent(this.s.id,new v.TopologyDescription(p.TopologyType.Unknown),this.s.description));const r=Array.from(this.s.description.servers.values());if(this.s.servers=new Map(r.map(e=>[e.address,w(this,e)])),this.s.options.loadBalanced)for(const e of r){const t=new g.ServerDescription(e.hostAddress,void 0,{loadBalanced:this.s.options.loadBalanced});this.serverUpdateHandler(t)}const o=null!==(n=e.readPreference)&&void 0!==n?n:l.ReadPreference.primary;this.selectServer((0,E.readPreferenceServerSelector)(o),e,(e,n)=>{if(e)return this.close(),void("function"==typeof t?t(e):this.emit(O.ERROR,e));!0!==this.s.options[Symbol.for("@@mdb.skipPingOnConnect")]&&n&&this.s.credentials?n.command((0,f.ns)("admin.$cmd"),{ping:1},{},e=>{e?"function"==typeof t?t(e):this.emit(O.ERROR,e):(b(this,p.STATE_CONNECTED),this.emit(O.OPEN,this),this.emit(O.CONNECT,this),"function"==typeof t&&t(void 0,this))}):(b(this,p.STATE_CONNECTED),this.emit(O.OPEN,this),this.emit(O.CONNECT,this),"function"==typeof t&&t(void 0,this))})}close(e,t){"function"==typeof e&&(t=e,e={}),"boolean"==typeof e&&(e={force:e}),e=null!=e?e:{},this.s.state!==p.STATE_CLOSED&&this.s.state!==p.STATE_CLOSING?(b(this,p.STATE_CLOSING),B(this[S],new a.MongoTopologyClosedError),(0,p.drainTimerQueue)(this.s.connectionTimers),this.s.srvPoller&&(this.s.srvPoller.stop(),this.s.srvPoller.removeListener(y.SrvPoller.SRV_RECORD_DISCOVERY,this.s.detectSrvRecords)),this.removeListener(O.TOPOLOGY_DESCRIPTION_CHANGED,this.s.detectShardedTopology),(0,f.eachAsync)(Array.from(this.s.sessions.values()),(e,t)=>e.endSession(t),()=>{this.s.sessionPool.endAllPooledSessions(()=>{(0,f.eachAsync)(Array.from(this.s.servers.values()),(t,n)=>_(t,this,e,n),e=>{this.s.servers.clear(),this.emit(O.TOPOLOGY_CLOSED,new h.TopologyClosedEvent(this.s.id)),b(this,p.STATE_CLOSED),"function"==typeof t&&t(e)})})})):"function"==typeof t&&t()}selectServer(e,t,n){let r;if("function"!=typeof e)if("string"==typeof e)r=(0,E.readPreferenceServerSelector)(l.ReadPreference.fromString(e));else{let n;e instanceof l.ReadPreference?n=e:(l.ReadPreference.translate(t),n=t.readPreference||l.ReadPreference.primary),r=(0,E.readPreferenceServerSelector)(n)}else r=e;t=Object.assign({},{serverSelectionTimeoutMS:this.s.serverSelectionTimeoutMS},t);const i=this.description.type===p.TopologyType.Sharded,s=t.session,u=s&&s.transaction;if(i&&u&&u.server)return void n(void 0,u.server);const c={serverSelector:r,transaction:u,callback:n},d=t.serverSelectionTimeoutMS;d&&(c.timer=(0,o.setTimeout)(()=>{c[C]=!0,c.timer=void 0;const e=new a.MongoServerSelectionError(`Server selection timed out after ${d} ms`,this.description);c.callback(e)},d)),this[S].push(c),T(this)}shouldCheckForSessionSupport(){return this.description.type===p.TopologyType.Single?!this.description.hasKnownServers:!this.description.hasDataBearingServers}hasSessionSupport(){return this.loadBalanced||null!=this.description.logicalSessionTimeoutMinutes}startSession(e,t){const n=new d.ClientSession(this.client,this.s.sessionPool,e,t);return n.once("ended",()=>{this.s.sessions.delete(n)}),this.s.sessions.add(n),n}endSessions(e,t){Array.isArray(e)||(e=[e]),this.selectServer((0,E.readPreferenceServerSelector)(l.ReadPreference.primaryPreferred),{},(n,r)=>{!n&&r?r.command((0,f.ns)("admin.$cmd"),{endSessions:e},{noResponse:!0},(e,n)=>{"function"==typeof t&&t(e,n)}):"function"==typeof t&&t(n)})}serverUpdateHandler(e){if(!this.s.description.hasServer(e.address))return;if(function(e,t){const n=e.servers.get(t.address),r=null==n?void 0:n.topologyVersion;return(0,g.compareTopologyVersion)(r,t.topologyVersion)>0}(this.s.description,e))return;const t=this.s.description,n=this.s.description.servers.get(e.address);if(!n)return;const r=e.$clusterTime;r&&(0,p._advanceClusterTime)(this,r);const o=n&&n.equals(e);if(this.s.description=this.s.description.update(e),this.s.description.compatibilityError)this.emit(O.ERROR,new a.MongoCompatibilityError(this.s.description.compatibilityError));else{if(!o){const t=this.s.description.servers.get(e.address);t&&this.emit(O.SERVER_DESCRIPTION_CHANGED,new h.ServerDescriptionChangedEvent(this.s.id,e.address,n,t))}D(this,e),this[S].length>0&&T(this),o||this.emit(O.TOPOLOGY_DESCRIPTION_CHANGED,new h.TopologyDescriptionChangedEvent(this.s.id,t,this.s.description))}}auth(e,t){"function"==typeof e&&(t=e,e=void 0),"function"==typeof t&&t(void 0,!0)}get clientMetadata(){return this.s.options.metadata}isConnected(){return this.s.state===p.STATE_CONNECTED}isDestroyed(){return this.s.state===p.STATE_CLOSED}unref(){(0,f.emitWarning)("`unref` is a noop and will be removed in the next major version")}lastHello(){const e=Array.from(this.description.servers.values());return 0===e.length?{}:e.filter(e=>e.type!==p.ServerType.Unknown)[0]||{maxWireVersion:this.description.commonWireVersion}}get commonWireVersion(){return this.description.commonWireVersion}get logicalSessionTimeoutMinutes(){return this.description.logicalSessionTimeoutMinutes}get clusterTime(){return this.s.clusterTime}set clusterTime(e){this.s.clusterTime=e}}function _(e,t,n,r){n=null!=n?n:{};for(const t of u.LOCAL_SERVER_EVENTS)e.removeAllListeners(t);e.destroy(n,()=>{t.emit(O.SERVER_CLOSED,new h.ServerClosedEvent(t.s.id,e.description.address));for(const t of u.SERVER_RELAY_EVENTS)e.removeAllListeners(t);"function"==typeof r&&r()})}function w(e,t){e.emit(O.SERVER_OPENING,new h.ServerOpeningEvent(e.s.id,t.address));const n=new m.Server(e,t,e.s.options);for(const t of u.SERVER_RELAY_EVENTS)n.on(t,n=>e.emit(t,n));return n.on(m.Server.DESCRIPTION_RECEIVED,t=>e.serverUpdateHandler(t)),n.connect(),n}function D(e,t){if(t&&e.s.servers.has(t.address)){const n=e.s.servers.get(t.address);n&&(n.s.description=t)}for(const t of e.description.servers.values())if(!e.s.servers.has(t.address)){const n=w(e,t);e.s.servers.set(t.address,n)}for(const t of e.s.servers){const n=t[0];if(e.description.hasServer(n))continue;if(!e.s.servers.has(n))continue;const r=e.s.servers.get(n);e.s.servers.delete(n),r&&_(r,e)}}function B(e,t){for(;e.length;){const n=e.shift();n&&(n.timer&&clearTimeout(n.timer),n[C]||n.callback(t))}}function T(e){if(e.s.state===p.STATE_CLOSED)return void B(e[S],new a.MongoTopologyClosedError);const t=e.description.type===p.TopologyType.Sharded,n=Array.from(e.description.servers.values()),r=e[S].length;for(let o=0;o<r;++o){const r=e[S].shift();if(!r)continue;if(r[C])continue;let o,i;try{const t=r.serverSelector;o=t?t(e.description,n):n}catch(e){r.timer&&clearTimeout(r.timer),r.callback(e);continue}if(0===o.length){e[S].push(r);continue}if(1===o.length)i=e.s.servers.get(o[0].address);else{const t=2===o.length?o:(0,f.shuffle)(o,2),n=e.s.servers.get(t[0].address),r=e.s.servers.get(t[1].address);i=n&&r&&n.s.operationCount<r.s.operationCount?n:r}if(!i)return void r.callback(new a.MongoServerSelectionError("server selection returned a server description but the server was not found in the topology",e.description));const s=r.transaction;t&&s&&s.isActive&&i&&s.pinServer(i),r.timer&&clearTimeout(r.timer),r.callback(void 0,i)}if(e[S].length>0)for(const[,t]of e.s.servers)process.nextTick((function(){return t.requestCheck()}))}t.Topology=O,O.SERVER_OPENING=u.SERVER_OPENING,O.SERVER_CLOSED=u.SERVER_CLOSED,O.SERVER_DESCRIPTION_CHANGED=u.SERVER_DESCRIPTION_CHANGED,O.TOPOLOGY_OPENING=u.TOPOLOGY_OPENING,O.TOPOLOGY_CLOSED=u.TOPOLOGY_CLOSED,O.TOPOLOGY_DESCRIPTION_CHANGED=u.TOPOLOGY_DESCRIPTION_CHANGED,O.ERROR=u.ERROR,O.OPEN=u.OPEN,O.CONNECT=u.CONNECT,O.CLOSE=u.CLOSE,O.TIMEOUT=u.TIMEOUT;class F{constructor(e){this.minWireVersion=e.minWireVersion||0,this.maxWireVersion=e.maxWireVersion||0}get hasAggregationCursor(){return this.maxWireVersion>=1}get hasWriteCommands(){return this.maxWireVersion>=2}get hasTextSearch(){return this.minWireVersion>=0}get hasAuthCommands(){return this.maxWireVersion>=1}get hasListCollectionsCommand(){return this.maxWireVersion>=3}get hasListIndexesCommand(){return this.maxWireVersion>=3}get supportsSnapshotReads(){return this.maxWireVersion>=13}get commandsTakeWriteConcern(){return this.maxWireVersion>=5}get commandsTakeCollation(){return this.maxWireVersion>=5}}t.ServerCapabilities=F},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MessageStream=void 0;const r=n(25),o=n(1),i=n(2),s=n(114),u=n(111),a=n(42),c=Symbol("buffer");class l extends r.Duplex{constructor(e={}){super(e),this.isMonitoringConnection=!1,this.maxBsonMessageSize=e.maxBsonMessageSize||67108864,this[c]=new i.BufferPool}get buffer(){return this[c]}_write(e,t,n){this[c].append(e),function e(t,n){const r=t[c];if(r.length<4)return void n();const i=r.peek(4).readInt32LE();if(i<0)return void n(new o.MongoParseError(`Invalid message size: ${i}`));if(i>t.maxBsonMessageSize)return void n(new o.MongoParseError(`Invalid message size: ${i}, max allowed: ${t.maxBsonMessageSize}`));if(i>r.length)return void n();const l=r.read(i),d={length:l.readInt32LE(0),requestId:l.readInt32LE(4),responseTo:l.readInt32LE(8),opCode:l.readInt32LE(12)},f=()=>{if(t.isMonitoringConnection&&r.length>=4){if(r.peek(4).readInt32LE()<=r.length)return!0}return!1};let p=d.opCode===a.OP_MSG?s.BinMsg:s.Response;if(d.opCode!==a.OP_COMPRESSED){const o=l.slice(16);return void(f()?e(t,n):(t.emit("message",new p(l,d,o)),r.length>=4?e(t,n):n()))}d.fromCompressed=!0,d.opCode=l.readInt32LE(16),d.length=l.readInt32LE(20);const h=l[24],m=l.slice(25);p=d.opCode===a.OP_MSG?s.BinMsg:s.Response,(0,u.decompress)(h,m,(i,s)=>{!i&&s?s.length===d.length?f()?e(t,n):(t.emit("message",new p(l,d,s)),r.length>=4?e(t,n):n()):n(new o.MongoDecompressionError("Message body and message header must be the same length")):n(i)})}(this,n)}_read(){}writeCommand(e,t){const n=t&&t.agreedCompressor?t.agreedCompressor:"none";if("none"===n||!function(e){const t=e instanceof s.Msg?e.command:e.query,n=Object.keys(t)[0];return!u.uncompressibleCommands.has(n)}(e)){const t=e.toBin();return void this.push(Array.isArray(t)?Buffer.concat(t):t)}const r=Buffer.concat(e.toBin()),o=r.slice(16),i=r.readInt32LE(12);(0,u.compress)({options:t},o,(r,s)=>{if(r||!s)return void t.cb(r);const c=Buffer.alloc(16);c.writeInt32LE(25+s.length,0),c.writeInt32LE(e.requestId,4),c.writeInt32LE(0,8),c.writeInt32LE(a.OP_COMPRESSED,12);const l=Buffer.alloc(9);l.writeInt32LE(i,0),l.writeInt32LE(o.length,4),l.writeUInt8(u.Compressor[n],8),this.push(Buffer.concat([c,l,s]))})}}t.MessageStream=l},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.StreamDescription=void 0;const r=n(12),o=n(62),i=["minWireVersion","maxWireVersion","maxBsonObjectSize","maxMessageSizeBytes","maxWriteBatchSize","logicalSessionTimeoutMinutes"];t.StreamDescription=class{constructor(e,t){this.address=e,this.type=r.ServerType.Unknown,this.minWireVersion=void 0,this.maxWireVersion=void 0,this.maxBsonObjectSize=16777216,this.maxMessageSizeBytes=48e6,this.maxWriteBatchSize=1e5,this.logicalSessionTimeoutMinutes=null==t?void 0:t.logicalSessionTimeoutMinutes,this.loadBalanced=!!(null==t?void 0:t.loadBalanced),this.compressors=t&&t.compressors&&Array.isArray(t.compressors)?t.compressors:[]}receiveResponse(e){if(null!=e){this.type=(0,o.parseServerType)(e);for(const t of i)null!=e[t]&&(this[t]=e[t]),"__nodejs_mock_server__"in e&&(this.__nodejs_mock_server__=e.__nodejs_mock_server__);e.compression&&(this.compressor=this.compressors.filter(t=>{var n;return null===(n=e.compression)||void 0===n?void 0:n.includes(t)})[0])}}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ConnectionPool=void 0;const r=n(97),o=n(21),i=n(8),s=n(1),u=n(23),a=n(9),c=n(2),l=n(189),d=n(66),f=n(190),p=n(428),h=n(166),m=Symbol("logger"),g=Symbol("connections"),E=Symbol("pending"),y=Symbol("checkedOut"),v=Symbol("minPoolSizeTimer"),A=Symbol("generation"),b=Symbol("serviceGenerations"),C=Symbol("connectionCounter"),S=Symbol("cancellationToken"),O=Symbol("waitQueue"),_=Symbol("cancelled"),w=Symbol("metrics"),D=Symbol("processingWaitQueue");class B extends a.TypedEventEmitter{constructor(e){var t,n,i,l,p;if(super(),this.closed=!1,this.options=Object.freeze({...e,connectionType:d.Connection,maxPoolSize:null!==(t=e.maxPoolSize)&&void 0!==t?t:100,minPoolSize:null!==(n=e.minPoolSize)&&void 0!==n?n:0,maxConnecting:null!==(i=e.maxConnecting)&&void 0!==i?i:2,maxIdleTimeMS:null!==(l=e.maxIdleTimeMS)&&void 0!==l?l:0,waitQueueTimeoutMS:null!==(p=e.waitQueueTimeoutMS)&&void 0!==p?p:0,autoEncrypter:e.autoEncrypter,metadata:e.metadata}),this.options.minPoolSize>this.options.maxPoolSize)throw new s.MongoInvalidArgumentError("Connection pool minimum size must not be greater than maximum pool size");this[m]=new u.Logger("ConnectionPool"),this[g]=new r,this[E]=0,this[y]=0,this[v]=void 0,this[A]=0,this[b]=new Map,this[C]=(0,c.makeCounter)(1),this[S]=new a.CancellationToken,this[S].setMaxListeners(1/0),this[O]=new r,this[w]=new h.ConnectionPoolMetrics,this[D]=!1,process.nextTick(()=>{this.emit(B.CONNECTION_POOL_CREATED,new f.ConnectionPoolCreatedEvent(this)),function e(t){const n=t.options.minPoolSize;if(t.closed||0===n)return;t.totalConnectionCount<n&&t.pendingConnectionCount<t.options.maxConnecting?N(t,(n,r)=>{t[E]--,!n&&r&&(t[g].push(r),process.nextTick(I,t)),t[v]=(0,o.setTimeout)(()=>e(t),10)}):t[v]=(0,o.setTimeout)(()=>e(t),100)}(this)})}get address(){return this.options.hostAddress.toString()}get generation(){return this[A]}get totalConnectionCount(){return this.availableConnectionCount+this.pendingConnectionCount+this.currentCheckedOutCount}get availableConnectionCount(){return this[g].length}get pendingConnectionCount(){return this[E]}get currentCheckedOutCount(){return this[y]}get waitQueueSize(){return this[O].length}get loadBalanced(){return this.options.loadBalanced}get serviceGenerations(){return this[b]}waitQueueErrorMetrics(){return this[w].info(this.options.maxPoolSize)}checkOut(e){if(this.emit(B.CONNECTION_CHECK_OUT_STARTED,new f.ConnectionCheckOutStartedEvent(this)),this.closed)return this.emit(B.CONNECTION_CHECK_OUT_FAILED,new f.ConnectionCheckOutFailedEvent(this,"poolClosed")),void e(new p.PoolClosedError(this));const t={callback:e},n=this.options.waitQueueTimeoutMS;n&&(t.timer=(0,o.setTimeout)(()=>{t[_]=!0,t.timer=void 0,this.emit(B.CONNECTION_CHECK_OUT_FAILED,new f.ConnectionCheckOutFailedEvent(this,"timeout")),t.callback(new p.WaitQueueTimeoutError(this.loadBalanced?this.waitQueueErrorMetrics():"Timed out while checking out a connection from connection pool",this.address))},n)),this[O].push(t),process.nextTick(I,this)}checkIn(e){const t=this.closed,n=T(this,e),r=!!(t||n||e.closed);if(r||(e.markAvailable(),this[g].unshift(e)),this[y]--,this.emit(B.CONNECTION_CHECKED_IN,new f.ConnectionCheckedInEvent(this,e)),r){R(this,e,e.closed?"error":t?"poolClosed":"stale")}process.nextTick(I,this)}clear(e){if(this.loadBalanced&&e){const t=e.toHexString(),n=this.serviceGenerations.get(t);if(null==n)throw new s.MongoRuntimeError("Service generations are required in load balancer mode.");this.serviceGenerations.set(t,n+1)}else this[A]+=1;this.emit("connectionPoolCleared",new f.ConnectionPoolClearedEvent(this,e))}close(e,t){let n=e;const r=null!=t?t:e;if("function"==typeof n&&(n={}),n=Object.assign({force:!1},n),this.closed)return r();for(this[S].emit("cancel");this.waitQueueSize;){const e=this[O].pop();e&&(e.timer&&clearTimeout(e.timer),e[_]||e.callback(new s.MongoRuntimeError("Connection pool closed")))}const o=this[v];o&&clearTimeout(o),"function"==typeof this[C].return&&this[C].return(void 0),this.closed=!0,(0,c.eachAsync)(this[g].toArray(),(e,t)=>{this.emit(B.CONNECTION_CLOSED,new f.ConnectionClosedEvent(this,e,"poolClosed")),e.destroy(n,t)},e=>{this[g].clear(),this.emit(B.CONNECTION_POOL_CLOSED,new f.ConnectionPoolClosedEvent(this)),r(e)})}withConnection(e,t,n){e?t(void 0,e,(e,t)=>{"function"==typeof n&&(e?n(e):n(void 0,t))}):this.checkOut((e,r)=>{t(e,r,(e,t)=>{"function"==typeof n&&(e?n(e):n(void 0,t)),r&&this.checkIn(r)})})}}function T(e,t){const n=t.serviceId;if(e.loadBalanced&&n){const r=n.toHexString(),o=e.serviceGenerations.get(r);return t.generation!==o}return t.generation!==e[A]}function F(e,t){return!!(e.options.maxIdleTimeMS&&t.idleTime>e.options.maxIdleTimeMS)}function N(e,t){const n={...e.options,id:e[C].next().value,generation:e[A],cancellationToken:e[S]};e[E]++,e.emit(B.CONNECTION_CREATED,new f.ConnectionCreatedEvent(e,{id:n.id})),(0,l.connect)(n,(n,r)=>{if(n||!r)return e[m].debug(`connection attempt failed with error [${JSON.stringify(n)}]`),void t(n);if(e.closed)return e[E]--,void r.destroy({force:!0});for(const t of[...i.APM_EVENTS,d.Connection.CLUSTER_TIME_RECEIVED])r.on(t,n=>e.emit(t,n));if(e.loadBalanced){r.on(d.Connection.PINNED,t=>e[w].markPinned(t)),r.on(d.Connection.UNPINNED,t=>e[w].markUnpinned(t));const t=r.serviceId;if(t){let n;const o=t.toHexString();(n=e.serviceGenerations.get(o))?r.generation=n:(e.serviceGenerations.set(o,0),r.generation=0)}}r.markAvailable(),e.emit(B.CONNECTION_READY,new f.ConnectionReadyEvent(e,r)),t(void 0,r)})}function R(e,t,n){e.emit(B.CONNECTION_CLOSED,new f.ConnectionClosedEvent(e,t,n)),process.nextTick(()=>t.destroy())}function I(e){if(e.closed||e[D])return;for(e[D]=!0;e.waitQueueSize;){const t=e[O].peekFront();if(!t){e[O].shift();continue}if(t[_]){e[O].shift();continue}if(!e.availableConnectionCount)break;const n=e[g].shift();if(!n)break;const r=T(e,n),o=F(e,n);if(r||o||n.closed){const t=n.closed?"error":r?"stale":"idle";R(e,n,t)}else e[y]++,e.emit(B.CONNECTION_CHECKED_OUT,new f.ConnectionCheckedOutEvent(e,n)),t.timer&&clearTimeout(t.timer),e[O].shift(),t.callback(void 0,n)}const{maxPoolSize:t,maxConnecting:n}=e.options;for(;e.waitQueueSize>0&&e.pendingConnectionCount<n&&(0===t||e.totalConnectionCount<t);){const t=e[O].shift();t&&!t[_]&&N(e,(n,r)=>{e[E]--,t[_]?!n&&r&&e[g].push(r):(n?e.emit(B.CONNECTION_CHECK_OUT_FAILED,new f.ConnectionCheckOutFailedEvent(e,n)):r&&(e[y]++,e.emit(B.CONNECTION_CHECKED_OUT,new f.ConnectionCheckedOutEvent(e,r))),t.timer&&clearTimeout(t.timer),t.callback(n,r)),process.nextTick(I,e)})}e[D]=!1}t.ConnectionPool=B,B.CONNECTION_POOL_CREATED=i.CONNECTION_POOL_CREATED,B.CONNECTION_POOL_CLOSED=i.CONNECTION_POOL_CLOSED,B.CONNECTION_POOL_CLEARED=i.CONNECTION_POOL_CLEARED,B.CONNECTION_CREATED=i.CONNECTION_CREATED,B.CONNECTION_READY=i.CONNECTION_READY,B.CONNECTION_CLOSED=i.CONNECTION_CLOSED,B.CONNECTION_CHECK_OUT_STARTED=i.CONNECTION_CHECK_OUT_STARTED,B.CONNECTION_CHECK_OUT_FAILED=i.CONNECTION_CHECK_OUT_FAILED,B.CONNECTION_CHECKED_OUT=i.CONNECTION_CHECKED_OUT,B.CONNECTION_CHECKED_IN=i.CONNECTION_CHECKED_IN},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MongoCR=void 0;const r=n(18),o=n(1),i=n(2),s=n(24);class u extends s.AuthProvider{auth(e,t){const{connection:n,credentials:s}=e;if(!s)return t(new o.MongoMissingCredentialsError("AuthContext must provide credentials."));const u=s.username,a=s.password,c=s.source;n.command((0,i.ns)(`${c}.$cmd`),{getnonce:1},void 0,(e,o)=>{let s=null,l=null;if(null==e){s=o.nonce;let e=r.createHash("md5");e.update(`${u}:mongo:${a}`,"utf8");const t=e.digest("hex");e=r.createHash("md5"),e.update(s+u+t,"utf8"),l=e.digest("hex")}const d={authenticate:1,user:u,nonce:s,key:l};n.command((0,i.ns)(`${c}.$cmd`),d,void 0,t)})}}t.MongoCR=u},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MongoDBAWS=void 0;const r=n(18),o=n(424),i=n(59),s=n(4),u=n(44),a=n(1),c=n(2),l=n(24),d=n(180),f=n(35),p="http://169.254.169.254",h="/latest/meta-data/iam/security-credentials",m={promoteLongs:!0,promoteValues:!0,promoteBuffers:!1,bsonRegExp:!1};class g extends l.AuthProvider{auth(e,t){const{connection:n,credentials:o}=e;if(!o)return t(new a.MongoMissingCredentialsError("AuthContext must provide credentials."));if("kModuleError"in u.aws4)return t(u.aws4.kModuleError);const{sign:i}=u.aws4;if((0,c.maxWireVersion)(n)<9)return void t(new a.MongoCompatibilityError("MONGODB-AWS authentication requires MongoDB version 4.4 or later"));if(!o.username)return void function(e,t){function n(n){n.AccessKeyId&&n.SecretAccessKey&&n.Token?t(void 0,new d.MongoCredentials({username:n.AccessKeyId,password:n.SecretAccessKey,source:e.source,mechanism:f.AuthMechanism.MONGODB_AWS,mechanismProperties:{AWS_SESSION_TOKEN:n.Token}})):t(new a.MongoMissingCredentialsError("Could not obtain temporary MONGODB-AWS credentials"))}if(process.env.AWS_CONTAINER_CREDENTIALS_RELATIVE_URI)return void y(`http://169.254.170.2${process.env.AWS_CONTAINER_CREDENTIALS_RELATIVE_URI}`,void 0,(e,r)=>{if(e)return t(e);n(r)});y(`${p}/latest/api/token`,{method:"PUT",json:!1,headers:{"X-aws-ec2-metadata-token-ttl-seconds":30}},(e,r)=>{if(e)return t(e);y(`${p}/${h}`,{json:!1,headers:{"X-aws-ec2-metadata-token":r}},(e,o)=>{if(e)return t(e);y(`${p}/${h}/${o}`,{headers:{"X-aws-ec2-metadata-token":r}},(e,r)=>{if(e)return t(e);n(r)})})})}(o,(n,r)=>{if(n||!r)return t(n);e.credentials=r,this.auth(e,t)});const l=o.username,g=o.password,v=o.mechanismProperties.AWS_SESSION_TOKEN,A=l&&g&&v?{accessKeyId:l,secretAccessKey:g,sessionToken:v}:l&&g?{accessKeyId:l,secretAccessKey:g}:void 0,b=o.source;r.randomBytes(32,(e,r)=>{if(e)return void t(e);const o={saslStart:1,mechanism:"MONGODB-AWS",payload:s.serialize({r:r,p:110},m)};n.command((0,c.ns)(`${b}.$cmd`),o,void 0,(e,o)=>{if(e)return t(e);const u=s.deserialize(o.payload.buffer,m),l=u.h,d=u.s.buffer;if(64!==d.length)return void t(new a.MongoRuntimeError(`Invalid server nonce length ${d.length}, expected 64`));if(0!==d.compare(r,0,r.length,0,r.length))return void t(new a.MongoRuntimeError("Server nonce does not begin with client nonce"));if(l.length<1||l.length>255||-1!==l.indexOf(".."))return void t(new a.MongoRuntimeError(`Server returned an invalid host: "${l}"`));const f="Action=GetCallerIdentity&Version=2011-06-15",p=i({method:"POST",host:l,region:E(u.h),service:"sts",headers:{"Content-Type":"application/x-www-form-urlencoded","Content-Length":f.length,"X-MongoDB-Server-Nonce":d.toString("base64"),"X-MongoDB-GS2-CB-Flag":"n"},path:"/",body:f},A),h={a:p.headers.Authorization,d:p.headers["X-Amz-Date"]};v&&(h.t=v);const g={saslContinue:1,conversationId:1,payload:s.serialize(h,m)};n.command((0,c.ns)(`${b}.$cmd`),g,void 0,t)})})}}function E(e){const t=e.split(".");return 1===t.length||"amazonaws"===t[1]?"us-east-1":t[1]}function y(e,t,n){const r=Object.assign({method:"GET",timeout:1e4,json:!0},i.parse(e),t),s=o.request(r,e=>{e.setEncoding("utf8");let t="";e.on("data",e=>t+=e),e.on("end",()=>{if(!1!==r.json)try{const e=JSON.parse(t);n(void 0,e)}catch(e){n(new a.MongoRuntimeError(`Invalid JSON response: "${t}"`))}else n(void 0,t)})});s.on("timeout",()=>{s.destroy(new a.MongoAWSError(`AWS request to ${e} timed out after ${r.timeout} ms`))}),s.on("error",e=>n(e)),s.end()}t.MongoDBAWS=g},function(e,t){e.exports=require("http")},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Plain=void 0;const r=n(4),o=n(1),i=n(2),s=n(24);class u extends s.AuthProvider{auth(e,t){const{connection:n,credentials:s}=e;if(!s)return t(new o.MongoMissingCredentialsError("AuthContext must provide credentials."));const u=s.username,a=s.password,c={saslStart:1,mechanism:"PLAIN",payload:new r.Binary(Buffer.from(`\0${u}\0${a}`)),autoAuthorize:1};n.command((0,i.ns)("$external.$cmd"),c,void 0,t)}}t.Plain=u},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ScramSHA256=t.ScramSHA1=void 0;const r=n(18),o=n(4),i=n(44),s=n(1),u=n(2),a=n(24),c=n(35);class l extends a.AuthProvider{constructor(e){super(),this.cryptoMethod=e||"sha1"}prepare(e,t,n){const o=this.cryptoMethod,a=t.credentials;if(!a)return n(new s.MongoMissingCredentialsError("AuthContext must provide credentials."));"sha256"===o&&null==i.saslprep&&(0,u.emitWarning)("Warning: no saslprep library specified. Passwords will not be sanitized"),r.randomBytes(24,(r,i)=>{if(r)return n(r);Object.assign(t,{nonce:i});const s=Object.assign({},e,{speculativeAuthenticate:Object.assign(p(o,a,i),{db:a.source})});n(void 0,s)})}auth(e,t){const n=e.response;n&&n.speculativeAuthenticate?h(this.cryptoMethod,n.speculativeAuthenticate,e,t):function(e,t,n){const{connection:r,credentials:o}=t;if(!o)return n(new s.MongoMissingCredentialsError("AuthContext must provide credentials."));if(!t.nonce)return n(new s.MongoInvalidArgumentError("AuthContext must contain a valid nonce property"));const i=t.nonce,a=o.source,c=p(e,o,i);r.command((0,u.ns)(`${a}.$cmd`),c,void 0,(r,o)=>{const i=A(r,o);if(i)return n(i);h(e,o,t,n)})}(this.cryptoMethod,e,t)}}function d(e){return e.replace("=","=3D").replace(",","=2C")}function f(e,t){return Buffer.concat([Buffer.from("n=","utf8"),Buffer.from(e,"utf8"),Buffer.from(",r=","utf8"),Buffer.from(t.toString("base64"),"utf8")])}function p(e,t,n){const r=d(t.username);return{saslStart:1,mechanism:"sha1"===e?c.AuthMechanism.MONGODB_SCRAM_SHA1:c.AuthMechanism.MONGODB_SCRAM_SHA256,payload:new o.Binary(Buffer.concat([Buffer.from("n,,","utf8"),f(r,n)])),autoAuthorize:1,options:{skipEmptyExchange:!0}}}function h(e,t,n,a){const c=n.connection,l=n.credentials;if(!l)return a(new s.MongoMissingCredentialsError("AuthContext must provide credentials."));if(!n.nonce)return a(new s.MongoInvalidArgumentError("Unable to continue SCRAM without valid nonce"));const p=n.nonce,h=l.source,b=d(l.username),C=l.password;let S;if("sha256"===e)S="kModuleError"in i.saslprep?C:(0,i.saslprep)(C);else try{S=function(e,t){if("string"!=typeof e)throw new s.MongoInvalidArgumentError("Username must be a string");if("string"!=typeof t)throw new s.MongoInvalidArgumentError("Password must be a string");if(0===t.length)throw new s.MongoInvalidArgumentError("Password cannot be empty");let n;try{n=r.createHash("md5")}catch(e){if(r.getFips())throw new Error("Auth mechanism SCRAM-SHA-1 is not supported in FIPS mode");throw e}return n.update(`${e}:mongo:${t}`,"utf8"),n.digest("hex")}(b,C)}catch(e){return a(e)}const O=Buffer.isBuffer(t.payload)?new o.Binary(t.payload):t.payload,_=m(O.value()),w=parseInt(_.i,10);if(w&&w<4096)return void a(new s.MongoRuntimeError(`Server returned an invalid iteration count ${w}`),!1);const D=_.s,B=_.r;if(B.startsWith("nonce"))return void a(new s.MongoRuntimeError(`Server returned an invalid nonce: ${B}`),!1);const T=`c=biws,r=${B}`,F=function(e,t,n,o){const i=[e,t.toString("base64"),n].join("_");if(null!=E[i])return E[i];const s=r.pbkdf2Sync(e,t,n,v[o],o);y>=200&&(E={},y=0);return E[i]=s,y+=1,s}(S,Buffer.from(D,"base64"),w,e),N=g(e,F,"Client Key"),R=g(e,F,"Server Key"),I=(x=e,M=N,r.createHash(x).update(M).digest());var x,M;const P=[f(b,p),O.value(),T].join(","),k=[T,`p=${function(e,t){Buffer.isBuffer(e)||(e=Buffer.from(e));Buffer.isBuffer(t)||(t=Buffer.from(t));const n=Math.max(e.length,t.length),r=[];for(let o=0;o<n;o+=1)r.push(e[o]^t[o]);return Buffer.from(r).toString("base64")}(N,g(e,I,P))}`].join(","),j=g(e,R,P),L={saslContinue:1,conversationId:t.conversationId,payload:new o.Binary(Buffer.from(k))};c.command((0,u.ns)(`${h}.$cmd`),L,void 0,(e,t)=>{const n=A(e,t);if(n)return a(n);const o=m(t.payload.value());if(!function(e,t){if(e.length!==t.length)return!1;if("function"==typeof r.timingSafeEqual)return r.timingSafeEqual(e,t);let n=0;for(let r=0;r<e.length;r++)n|=e[r]^t[r];return 0===n}(Buffer.from(o.v,"base64"),j))return void a(new s.MongoRuntimeError("Server returned an invalid signature"));if(!t||!1!==t.done)return a(n,t);const i={saslContinue:1,conversationId:t.conversationId,payload:Buffer.alloc(0)};c.command((0,u.ns)(`${h}.$cmd`),i,void 0,a)})}function m(e){const t={},n=e.split(",");for(let e=0;e<n.length;e++){const r=n[e].split("=");t[r[0]]=r[1]}return t}function g(e,t,n){return r.createHmac(e,t).update(n).digest()}let E={},y=0;const v={sha256:32,sha1:20};function A(e,t){return e||(t&&(t.$err||t.errmsg)?new s.MongoServerError(t):void 0)}t.ScramSHA1=class extends l{constructor(){super("sha1")}};t.ScramSHA256=class extends l{constructor(){super("sha256")}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.X509=void 0;const r=n(1),o=n(2),i=n(24);class s extends i.AuthProvider{prepare(e,t,n){const{credentials:o}=t;if(!o)return n(new r.MongoMissingCredentialsError("AuthContext must provide credentials."));Object.assign(e,{speculativeAuthenticate:u(o)}),n(void 0,e)}auth(e,t){const n=e.connection,i=e.credentials;if(!i)return t(new r.MongoMissingCredentialsError("AuthContext must provide credentials."));const s=e.response;if(s&&s.speculativeAuthenticate)return t();n.command((0,o.ns)("$external.$cmd"),u(i),void 0,t)}}function u(e){const t={authenticate:1,mechanism:"MONGODB-X509"};return e.username&&(t.user=e.username),t}t.X509=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.WaitQueueTimeoutError=t.PoolClosedError=void 0;const r=n(1);class o extends r.MongoDriverError{constructor(e){super("Attempted to check out a connection from closed connection pool"),this.address=e.address}get name(){return"MongoPoolClosedError"}}t.PoolClosedError=o;class i extends r.MongoDriverError{constructor(e,t){super(e),this.address=t}get name(){return"MongoWaitQueueTimeoutError"}}t.WaitQueueTimeoutError=i},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.RTTPinger=t.Monitor=void 0;const r=n(21),o=n(4),i=n(189),s=n(66),u=n(8),a=n(1),c=n(9),l=n(2),d=n(12),f=n(113),p=n(187),h=Symbol("server"),m=Symbol("monitorId"),g=Symbol("connection"),E=Symbol("cancellationToken"),y=Symbol("rttPinger"),v=Symbol("roundTripTime"),A=(0,l.makeStateMachine)({[d.STATE_CLOSING]:[d.STATE_CLOSING,"idle",d.STATE_CLOSED],[d.STATE_CLOSED]:[d.STATE_CLOSED,"monitoring"],idle:["idle","monitoring",d.STATE_CLOSING],monitoring:["monitoring","idle",d.STATE_CLOSING]}),b=new Set([d.STATE_CLOSING,d.STATE_CLOSED,"monitoring"]);function C(e){return e.s.state===d.STATE_CLOSED||e.s.state===d.STATE_CLOSING}class S extends c.TypedEventEmitter{constructor(e,t){var n,r,o;super(),this[h]=e,this[g]=void 0,this[E]=new c.CancellationToken,this[E].setMaxListeners(1/0),this[m]=void 0,this.s={state:d.STATE_CLOSED},this.address=e.description.address,this.options=Object.freeze({connectTimeoutMS:null!==(n=t.connectTimeoutMS)&&void 0!==n?n:1e4,heartbeatFrequencyMS:null!==(r=t.heartbeatFrequencyMS)&&void 0!==r?r:1e4,minHeartbeatFrequencyMS:null!==(o=t.minHeartbeatFrequencyMS)&&void 0!==o?o:500});const i=this[E],u=Object.assign({id:"<monitor>",generation:e.s.pool.generation,connectionType:s.Connection,cancellationToken:i,hostAddress:e.description.hostAddress},t,{raw:!1,promoteLongs:!0,promoteValues:!0,promoteBuffers:!0});delete u.credentials,u.autoEncrypter&&delete u.autoEncrypter,this.connectOptions=Object.freeze(u)}get connection(){return this[g]}connect(){if(this.s.state!==d.STATE_CLOSED)return;const e=this.options.heartbeatFrequencyMS,t=this.options.minHeartbeatFrequencyMS;this[m]=(0,l.makeInterruptibleAsyncInterval)(_(this),{interval:e,minInterval:t,immediate:!0})}requestCheck(){var e;b.has(this.s.state)||null===(e=this[m])||void 0===e||e.wake()}reset(){const e=this[h].description.topologyVersion;if(C(this)||null==e)return;A(this,d.STATE_CLOSING),O(this),A(this,"idle");const t=this.options.heartbeatFrequencyMS,n=this.options.minHeartbeatFrequencyMS;this[m]=(0,l.makeInterruptibleAsyncInterval)(_(this),{interval:t,minInterval:n})}close(){C(this)||(A(this,d.STATE_CLOSING),O(this),this.emit("close"),A(this,d.STATE_CLOSED))}}function O(e){var t,n,r;null===(t=e[m])||void 0===t||t.stop(),e[m]=void 0,null===(n=e[y])||void 0===n||n.close(),e[y]=void 0,e[E].emit("cancel"),null===(r=e[g])||void 0===r||r.destroy({force:!0}),e[g]=void 0}function _(e){return t=>{function n(){C(e)||A(e,"idle"),t()}A(e,"monitoring"),function(e,t){let n=(0,l.now)();function r(r){var o;null===(o=e[g])||void 0===o||o.destroy({force:!0}),e[g]=void 0,e.emit(p.Server.SERVER_HEARTBEAT_FAILED,new f.ServerHeartbeatFailedEvent(e.address,(0,l.calculateDurationInMs)(n),r)),e.emit("resetServer",r),e.emit("resetConnectionPool"),t(r)}e.emit(p.Server.SERVER_HEARTBEAT_STARTED,new f.ServerHeartbeatStartedEvent(e.address));const s=e[g];if(s&&!s.closed){const{serverApi:i,helloOk:a}=s,d=e.options.connectTimeoutMS,m=e.options.heartbeatFrequencyMS,g=e[h].description.topologyVersion,v=null!=g,A={[(null==i?void 0:i.version)||a?"hello":u.LEGACY_HELLO_COMMAND]:!0,...v&&g?{maxAwaitTimeMS:m,topologyVersion:(c=g,{processId:c.processId,counter:o.Long.isLong(c.counter)?c.counter:o.Long.fromNumber(c.counter)})}:{}},b=v?{socketTimeoutMS:d?d+m:0,exhaustAllowed:!0}:{socketTimeoutMS:d};return v&&null==e[y]&&(e[y]=new w(e[E],Object.assign({heartbeatFrequencyMS:e.options.heartbeatFrequencyMS},e.connectOptions))),void s.command((0,l.ns)("admin.$cmd"),A,b,(o,i)=>{var s;if(o)return r(o);"isWritablePrimary"in i||(i.isWritablePrimary=i[u.LEGACY_HELLO_COMMAND]);const a=e[y],c=v&&a?a.roundTripTime:(0,l.calculateDurationInMs)(n);e.emit(p.Server.SERVER_HEARTBEAT_SUCCEEDED,new f.ServerHeartbeatSucceededEvent(e.address,c,i)),v&&i.topologyVersion?(e.emit(p.Server.SERVER_HEARTBEAT_STARTED,new f.ServerHeartbeatStartedEvent(e.address)),n=(0,l.now)()):(null===(s=e[y])||void 0===s||s.close(),e[y]=void 0,t(void 0,i))})}var c;(0,i.connect)(e.connectOptions,(o,i)=>{if(o)return e[g]=void 0,o instanceof a.MongoNetworkError||e.emit("resetConnectionPool"),void r(o);if(i){if(i.isMonitoringConnection=!0,C(e))return void i.destroy({force:!0});e[g]=i,e.emit(p.Server.SERVER_HEARTBEAT_SUCCEEDED,new f.ServerHeartbeatSucceededEvent(e.address,(0,l.calculateDurationInMs)(n),i.hello)),t(void 0,i.hello)}})}(e,(t,o)=>{if(t&&e[h].description.type===d.ServerType.Unknown)return e.emit("resetServer",t),n();o&&o.topologyVersion&&(0,r.setTimeout)(()=>{var t;C(e)||null===(t=e[m])||void 0===t||t.wake()},0),n()})}}t.Monitor=S;class w{constructor(e,t){this[g]=void 0,this[E]=e,this[v]=0,this.closed=!1;const n=t.heartbeatFrequencyMS;this[m]=(0,r.setTimeout)(()=>function e(t,n){const o=(0,l.now)();n.cancellationToken=t[E];const s=n.heartbeatFrequencyMS;if(t.closed)return;function a(i){t.closed?null==i||i.destroy({force:!0}):(null==t[g]&&(t[g]=i),t[v]=(0,l.calculateDurationInMs)(o),t[m]=(0,r.setTimeout)(()=>e(t,n),s))}const c=t[g];if(null==c)return void(0,i.connect)(n,(e,n)=>{if(e)return t[g]=void 0,void(t[v]=0);a(n)});c.command((0,l.ns)("admin.$cmd"),{[u.LEGACY_HELLO_COMMAND]:1},void 0,e=>{if(e)return t[g]=void 0,void(t[v]=0);a()})}(this,t),n)}get roundTripTime(){return this[v]}close(){var e;this.closed=!0,clearTimeout(this[m]),null===(e=this[g])||void 0===e||e.destroy({force:!0}),this[g]=void 0}}t.RTTPinger=w},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.FindOperation=void 0;const r=n(1),o=n(11),i=n(115),s=n(2),u=n(5),a=n(3);class c extends u.CommandOperation{constructor(e,t,n={},o={}){if(super(e,o),this.options=o,this.ns=t,"object"!=typeof n||Array.isArray(n))throw new r.MongoInvalidArgumentError("Query filter must be a plain object or ObjectId");if(Buffer.isBuffer(n)){const e=n[0]|n[1]<<8|n[2]<<16|n[3]<<24;if(e!==n.length)throw new r.MongoInvalidArgumentError(`Query filter raw message size does not match message header size [${n.length}] != [${e}]`)}this.filter=null!=n&&"ObjectID"===n._bsontype?{_id:n}:n}execute(e,t,n){this.server=e;const u=(0,s.maxWireVersion)(e),a=this.options;if(null!=a.allowDiskUse&&u<4)return void n(new r.MongoCompatibilityError('Option "allowDiskUse" is not supported on MongoDB < 3.2'));if(a.collation&&u<5)return void n(new r.MongoCompatibilityError(`Server ${e.name}, which reports wire version ${u}, does not support collation`));let c=function(e,t,n){const r={find:e.collection,filter:t};n.sort&&(r.sort=(0,i.formatSort)(n.sort));if(n.projection){let e=n.projection;e&&Array.isArray(e)&&(e=e.length?e.reduce((e,t)=>(e[t]=1,e),{}):{_id:1}),r.projection=e}n.hint&&(r.hint=(0,s.normalizeHintField)(n.hint));"number"==typeof n.skip&&(r.skip=n.skip);"number"==typeof n.limit&&(n.limit<0?(r.limit=-n.limit,r.singleBatch=!0):r.limit=n.limit);"number"==typeof n.batchSize&&(n.batchSize<0?(n.limit&&0!==n.limit&&Math.abs(n.batchSize)<Math.abs(n.limit)&&(r.limit=-n.batchSize),r.singleBatch=!0):r.batchSize=n.batchSize);"boolean"==typeof n.singleBatch&&(r.singleBatch=n.singleBatch);void 0!==n.comment&&(r.comment=n.comment);"number"==typeof n.maxTimeMS&&(r.maxTimeMS=n.maxTimeMS);const u=o.ReadConcern.fromOptions(n);u&&(r.readConcern=u.toJSON());n.max&&(r.max=n.max);n.min&&(r.min=n.min);"boolean"==typeof n.returnKey&&(r.returnKey=n.returnKey);"boolean"==typeof n.showRecordId&&(r.showRecordId=n.showRecordId);"boolean"==typeof n.tailable&&(r.tailable=n.tailable);"boolean"==typeof n.timeout?r.noCursorTimeout=!n.timeout:"boolean"==typeof n.noCursorTimeout&&(r.noCursorTimeout=n.noCursorTimeout);"boolean"==typeof n.awaitData&&(r.awaitData=n.awaitData);"boolean"==typeof n.allowPartialResults&&(r.allowPartialResults=n.allowPartialResults);n.collation&&(r.collation=n.collation);"boolean"==typeof n.allowDiskUse&&(r.allowDiskUse=n.allowDiskUse);n.let&&(r.let=n.let);return r}(this.ns,this.filter,a);this.explain&&(c=(0,s.decorateWithExplain)(c,this.explain)),e.command(this.ns,c,{...this.options,...this.bsonOptions,documentsReturnedIn:"firstBatch",session:t},n)}}t.FindOperation=c,(0,a.defineAspects)(c,[a.Aspect.READ_OPERATION,a.Aspect.RETRYABLE,a.Aspect.EXPLAINABLE,a.Aspect.CURSOR_CREATING])},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CountDocumentsOperation=void 0;const r=n(102);class o extends r.AggregateOperation{constructor(e,t,n){const r=[];r.push({$match:t}),"number"==typeof n.skip&&r.push({$skip:n.skip}),"number"==typeof n.limit&&r.push({$limit:n.limit}),r.push({$group:{_id:1,n:{$sum:1}}}),super(e.s.namespace,r,n)}execute(e,t,n){super.execute(e,t,(e,t)=>{if(e||!t)return void n(e);const r=t;if(null==r.cursor||null==r.cursor.firstBatch)return void n(void 0,0);const o=r.cursor.firstBatch;n(void 0,o.length?o[0].n:0)})}}t.CountDocumentsOperation=o},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DistinctOperation=void 0;const r=n(1),o=n(2),i=n(5),s=n(3);class u extends i.CommandOperation{constructor(e,t,n,r){super(e,r),this.options=null!=r?r:{},this.collection=e,this.key=t,this.query=n}execute(e,t,n){const i=this.collection,s=this.key,u=this.query,a=this.options,c={distinct:i.collectionName,key:s,query:u};"number"==typeof a.maxTimeMS&&(c.maxTimeMS=a.maxTimeMS),(0,o.decorateWithReadConcern)(c,i,a);try{(0,o.decorateWithCollation)(c,i,a)}catch(e){return n(e)}this.explain&&(0,o.maxWireVersion)(e)<4?n(new r.MongoCompatibilityError(`Server ${e.name} does not support explain on distinct`)):super.executeCommand(e,t,c,(e,t)=>{e?n(e):n(void 0,this.explain?t:t.values)})}}t.DistinctOperation=u,(0,s.defineAspects)(u,[s.Aspect.READ_OPERATION,s.Aspect.RETRYABLE,s.Aspect.EXPLAINABLE])},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.EstimatedDocumentCountOperation=void 0;const r=n(5),o=n(3);class i extends r.CommandOperation{constructor(e,t={}){super(e,t),this.options=t,this.collectionName=e.collectionName}execute(e,t,n){const r={count:this.collectionName};"number"==typeof this.options.maxTimeMS&&(r.maxTimeMS=this.options.maxTimeMS),super.executeCommand(e,t,r,(e,t)=>{e?n(e):n(void 0,(null==t?void 0:t.n)||0)})}}t.EstimatedDocumentCountOperation=i,(0,o.defineAspects)(i,[o.Aspect.READ_OPERATION,o.Aspect.RETRYABLE,o.Aspect.CURSOR_CREATING])},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.IsCappedOperation=void 0;const r=n(1),o=n(3);class i extends o.AbstractOperation{constructor(e,t){super(t),this.options=t,this.collection=e}execute(e,t,n){const o=this.collection;o.s.db.listCollections({name:o.collectionName},{...this.options,nameOnly:!1,readPreference:this.readPreference,session:t}).toArray((e,t)=>{if(e||!t)return n(e);if(0===t.length)return n(new r.MongoAPIError(`collection ${o.namespace} not found`));const i=t[0].options;n(void 0,!(!i||!i.capped))})}}t.IsCappedOperation=i},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MapReduceOperation=void 0;const r=n(4),o=n(1),i=n(6),s=n(2),u=n(5),a=n(3),c=["explain","readPreference","readConcern","session","bypassDocumentValidation","writeConcern","raw","fieldsAsRaw","promoteLongs","promoteValues","promoteBuffers","bsonRegExp","serializeFunctions","ignoreUndefined","enableUtf8Validation","scope"];class l extends u.CommandOperation{constructor(e,t,n,r){super(e,r),this.options=null!=r?r:{},this.collection=e,this.map=t,this.reduce=n}execute(e,t,n){const u=this.collection,a=this.map,l=this.reduce;let d=this.options;const f={mapReduce:u.collectionName,map:a,reduce:l};d.scope&&(f.scope=function e(t){if(!(0,s.isObject)(t)||"ObjectID"===t._bsontype)return t;const n={};for(const o of Object.keys(t))"function"==typeof t[o]?n[o]=new r.Code(String(t[o])):"Code"===t[o]._bsontype?n[o]=t[o]:n[o]=e(t[o]);return n}(d.scope));for(const e in d)-1===c.indexOf(e)&&(f[e]=d[e]);d=Object.assign({},d),this.readPreference.mode===i.ReadPreferenceMode.primary&&d.out&&1!==d.out.inline&&"inline"!==d.out?(d.readPreference=i.ReadPreference.primary,(0,s.applyWriteConcern)(f,{db:u.s.db,collection:u},d)):(0,s.decorateWithReadConcern)(f,u,d),!0===d.bypassDocumentValidation&&(f.bypassDocumentValidation=d.bypassDocumentValidation);try{(0,s.decorateWithCollation)(f,u,d)}catch(e){return n(e)}this.explain&&(0,s.maxWireVersion)(e)<9?n(new o.MongoCompatibilityError(`Server ${e.name} does not support explain on mapReduce`)):super.executeCommand(e,t,f,(e,t)=>{if(e)return n(e);if(1!==t.ok||t.err||t.errmsg)return n(new o.MongoServerError(t));if(this.explain)return n(void 0,t);const r={};if(t.timeMillis&&(r.processtime=t.timeMillis),t.counts&&(r.counts=t.counts),t.timing&&(r.timing=t.timing),t.results)return null!=d.verbose&&d.verbose?n(void 0,{results:t.results,stats:r}):n(void 0,t.results);let i=null;if(null!=t.result&&"object"==typeof t.result){const e=t.result;i=u.s.db.s.client.db(e.db,u.s.db.s.options).collection(e.collection)}else i=u.s.db.collection(t.result);if(null==d.verbose||!d.verbose)return n(e,i);n(e,{collection:i,stats:r})})}}t.MapReduceOperation=l,(0,a.defineAspects)(l,[a.Aspect.EXPLAINABLE])},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.OptionsOperation=void 0;const r=n(1),o=n(3);class i extends o.AbstractOperation{constructor(e,t){super(t),this.options=t,this.collection=e}execute(e,t,n){const o=this.collection;o.s.db.listCollections({name:o.collectionName},{...this.options,nameOnly:!1,readPreference:this.readPreference,session:t}).toArray((e,t)=>e||!t?n(e):0===t.length?n(new r.MongoAPIError(`collection ${o.namespace} not found`)):void n(e,t[0].options))}}t.OptionsOperation=i},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.GridFSBucket=void 0;const r=n(1),o=n(9),i=n(2),s=n(13),u=n(438),a=n(439),c={bucketName:"fs",chunkSizeBytes:261120};class l extends o.TypedEventEmitter{constructor(e,t){super(),this.setMaxListeners(0);const n={...c,...t,writeConcern:s.WriteConcern.fromOptions(t)};this.s={db:e,options:n,_chunksCollection:e.collection(n.bucketName+".chunks"),_filesCollection:e.collection(n.bucketName+".files"),checkedIndexes:!1,calledOpenUploadStream:!1}}openUploadStream(e,t){return new a.GridFSBucketWriteStream(this,e,t)}openUploadStreamWithId(e,t,n){return new a.GridFSBucketWriteStream(this,t,{...n,id:e})}openDownloadStream(e,t){return new u.GridFSBucketReadStream(this.s._chunksCollection,this.s._filesCollection,this.s.options.readPreference,{_id:e},t)}delete(e,t){return(0,i.maybePromise)(t,t=>this.s._filesCollection.deleteOne({_id:e},(n,o)=>n?t(n):this.s._chunksCollection.deleteMany({files_id:e},n=>n?t(n):(null==o?void 0:o.deletedCount)?t():t(new r.MongoRuntimeError(`File not found for id ${e}`)))))}find(e,t){return null!=e||(e={}),t=null!=t?t:{},this.s._filesCollection.find(e,t)}openDownloadStreamByName(e,t){let n={uploadDate:-1},r=void 0;return t&&null!=t.revision&&(t.revision>=0?(n={uploadDate:1},r=t.revision):r=-t.revision-1),new u.GridFSBucketReadStream(this.s._chunksCollection,this.s._filesCollection,this.s.options.readPreference,{filename:e},{...t,sort:n,skip:r})}rename(e,t,n){return(0,i.maybePromise)(n,n=>{const o={_id:e},i={$set:{filename:t}};return this.s._filesCollection.updateOne(o,i,(t,o)=>t?n(t):(null==o?void 0:o.matchedCount)?n():n(new r.MongoRuntimeError(`File with id ${e} not found`)))})}drop(e){return(0,i.maybePromise)(e,e=>this.s._filesCollection.drop(t=>t?e(t):this.s._chunksCollection.drop(t=>t?e(t):e())))}getLogger(){return this.s.db.s.logger}}t.GridFSBucket=l,l.INDEX="index"},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.GridFSBucketReadStream=void 0;const r=n(25),o=n(1);class i extends r.Readable{constructor(e,t,n,r,o){super(),this.s={bytesToTrim:0,bytesToSkip:0,bytesRead:0,chunks:e,expected:0,files:t,filter:r,init:!1,expectedEnd:0,options:{start:0,end:0,...o},readPreference:n}}_read(){this.destroyed||function(e,t){if(e.s.file)return t();e.s.init||(!function(e){const t={};e.s.readPreference&&(t.readPreference=e.s.readPreference);e.s.options&&e.s.options.sort&&(t.sort=e.s.options.sort);e.s.options&&e.s.options.skip&&(t.skip=e.s.options.skip);e.s.files.findOne(e.s.filter,t,(t,n)=>{if(t)return e.emit(i.ERROR,t);if(!n){const t=`FileNotFound: file ${e.s.filter._id?e.s.filter._id.toString():e.s.filter.filename} was not found`,n=new o.MongoRuntimeError(t);return n.code="ENOENT",e.emit(i.ERROR,n)}if(n.length<=0)return void e.push(null);if(e.destroyed)return void e.emit(i.CLOSE);try{e.s.bytesToSkip=function(e,t,n){if(n&&null!=n.start){if(n.start>t.length)throw new o.MongoInvalidArgumentError(`Stream start (${n.start}) must not be more than the length of the file (${t.length})`);if(n.start<0)throw new o.MongoInvalidArgumentError(`Stream start (${n.start}) must not be negative`);if(null!=n.end&&n.end<n.start)throw new o.MongoInvalidArgumentError(`Stream start (${n.start}) must not be greater than stream end (${n.end})`);return e.s.bytesRead=Math.floor(n.start/t.chunkSize)*t.chunkSize,e.s.expected=Math.floor(n.start/t.chunkSize),n.start-e.s.bytesRead}throw new o.MongoInvalidArgumentError("Start option must be defined")}(e,n,e.s.options)}catch(t){return e.emit(i.ERROR,t)}const r={files_id:n._id};if(e.s.options&&null!=e.s.options.start){const t=Math.floor(e.s.options.start/n.chunkSize);t>0&&(r.n={$gte:t})}e.s.cursor=e.s.chunks.find(r).sort({n:1}),e.s.readPreference&&e.s.cursor.withReadPreference(e.s.readPreference),e.s.expectedEnd=Math.ceil(n.length/n.chunkSize),e.s.file=n;try{e.s.bytesToTrim=function(e,t,n,r){if(r&&null!=r.end){if(r.end>t.length)throw new o.MongoInvalidArgumentError(`Stream end (${r.end}) must not be more than the length of the file (${t.length})`);if(null==r.start||r.start<0)throw new o.MongoInvalidArgumentError(`Stream end (${r.end}) must not be negative`);const i=null!=r.start?Math.floor(r.start/t.chunkSize):0;return n.limit(Math.ceil(r.end/t.chunkSize)-i),e.s.expectedEnd=Math.ceil(r.end/t.chunkSize),Math.ceil(r.end/t.chunkSize)*t.chunkSize-r.end}throw new o.MongoInvalidArgumentError("End option must be defined")}(e,n,e.s.cursor,e.s.options)}catch(t){return e.emit(i.ERROR,t)}e.emit(i.FILE,n)})}(e),e.s.init=!0);e.once("file",()=>{t()})}(this,()=>function(e){if(e.destroyed)return;if(!e.s.cursor)return;if(!e.s.file)return;e.s.cursor.next((t,n)=>{if(e.destroyed)return;if(t)return void e.emit(i.ERROR,t);if(!n)return e.push(null),void process.nextTick(()=>{e.s.cursor&&e.s.cursor.close(t=>{t?e.emit(i.ERROR,t):e.emit(i.CLOSE)})});if(!e.s.file)return;const r=e.s.file.length-e.s.bytesRead,s=e.s.expected++,u=Math.min(e.s.file.chunkSize,r);if(n.n>s)return e.emit(i.ERROR,new o.MongoGridFSChunkError(`ChunkIsMissing: Got unexpected n: ${n.n}, expected: ${s}`));if(n.n<s)return e.emit(i.ERROR,new o.MongoGridFSChunkError(`ExtraChunk: Got unexpected n: ${n.n}, expected: ${s}`));let a=Buffer.isBuffer(n.data)?n.data:n.data.buffer;if(a.byteLength!==u)return r<=0?e.emit(i.ERROR,new o.MongoGridFSChunkError(`ExtraChunk: Got unexpected n: ${n.n}, expected file length ${e.s.file.length} bytes but already read ${e.s.bytesRead} bytes`)):e.emit(i.ERROR,new o.MongoGridFSChunkError(`ChunkIsWrongSize: Got unexpected length: ${a.byteLength}, expected: ${u}`));if(e.s.bytesRead+=a.byteLength,0===a.byteLength)return e.push(null);let c=null,l=null;null!=e.s.bytesToSkip&&(c=e.s.bytesToSkip,e.s.bytesToSkip=0);const d=s===e.s.expectedEnd-1,f=e.s.options.end-e.s.bytesToSkip;d&&null!=e.s.bytesToTrim?l=e.s.file.chunkSize-e.s.bytesToTrim:e.s.options.end&&f<n.data.byteLength&&(l=f),null==c&&null==l||(a=a.slice(c||0,l||a.byteLength)),e.push(a)})}(this))}start(e=0){return s(this),this.s.options.start=e,this}end(e=0){return s(this),this.s.options.end=e,this}abort(e){this.push(null),this.destroyed=!0,this.s.cursor?this.s.cursor.close(t=>{this.emit(i.CLOSE),e&&e(t)}):(this.s.init||this.emit(i.CLOSE),e&&e())}}function s(e){if(e.s.init)throw new o.MongoGridFSStreamError("Options cannot be changed after the stream is initialized")}t.GridFSBucketReadStream=i,i.ERROR="error",i.FILE="file",i.DATA="data",i.END="end",i.CLOSE="close"},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.GridFSBucketWriteStream=void 0;const r=n(25),o=n(4),i=n(1),s=n(2),u=n(13);class a extends r.Writable{constructor(e,t,n){var r,s;super(),n=null!=n?n:{},this.bucket=e,this.chunks=e.s._chunksCollection,this.filename=t,this.files=e.s._filesCollection,this.options=n,this.writeConcern=u.WriteConcern.fromOptions(n)||e.s.options.writeConcern,this.done=!1,this.id=n.id?n.id:new o.ObjectId,this.chunkSizeBytes=n.chunkSizeBytes||this.bucket.s.options.chunkSizeBytes,this.bufToStore=Buffer.alloc(this.chunkSizeBytes),this.length=0,this.n=0,this.pos=0,this.state={streamEnd:!1,outstandingRequests:0,errored:!1,aborted:!1},this.bucket.s.calledOpenUploadStream||(this.bucket.s.calledOpenUploadStream=!0,s=()=>{this.bucket.s.checkedIndexes=!0,this.bucket.emit("index")},(r=this).files.findOne({},{projection:{_id:1}},(e,t)=>e?s(e):t?s():void r.files.listIndexes().toArray((e,t)=>{let n;if(e)return e instanceof i.MongoError&&e.code===i.MONGODB_ERROR_CODES.NamespaceNotFound?(n={filename:1,uploadDate:1},void r.files.createIndex(n,{background:!1},e=>{if(e)return s(e);d(r,s)})):s(e);let o=!1;if(t&&t.forEach(e=>{2===Object.keys(e.key).length&&1===e.key.filename&&1===e.key.uploadDate&&(o=!0)}),o)d(r,s);else{n={filename:1,uploadDate:1};const e=p(r);r.files.createIndex(n,{...e,background:!1},e=>{if(e)return s(e);d(r,s)})}})))}write(e,t,n){const r="function"==typeof t?void 0:t;return n="function"==typeof t?t:n,h(this,()=>function(e,t,n,r){if(g(e,r))return!1;const o=Buffer.isBuffer(t)?t:Buffer.from(t,n);if(e.length+=o.length,e.pos+o.length<e.chunkSizeBytes)return o.copy(e.bufToStore,e.pos),e.pos+=o.length,r&&r(),!0;let i=o.length,s=e.chunkSizeBytes-e.pos,u=Math.min(s,o.length),a=0;for(;i>0;){const t=o.length-i;let n;if(o.copy(e.bufToStore,e.pos,t,t+u),e.pos+=u,s-=u,0===s){if(n=l(e.id,e.n,Buffer.from(e.bufToStore)),++e.state.outstandingRequests,++a,g(e,r))return!1;e.chunks.insertOne(n,p(e),t=>{if(t)return c(e,t);--e.state.outstandingRequests,--a,a||(e.emit("drain",n),r&&r(),f(e))}),s=e.chunkSizeBytes,e.pos=0,++e.n}i-=u,u=Math.min(s,i)}return!1}(this,e,r,n))}abort(e){return(0,s.maybePromise)(e,e=>this.state.streamEnd?e(new i.MongoAPIError("Cannot abort a stream that has already completed")):this.state.aborted?e(new i.MongoAPIError("Cannot call abort() on a stream twice")):(this.state.aborted=!0,void this.chunks.deleteMany({files_id:this.id},t=>e(t))))}end(e,t,n){const r="function"==typeof e?void 0:e,o="function"==typeof t?void 0:t;return n="function"==typeof e?e:"function"==typeof t?t:n,this.state.streamEnd||g(this,n)?this:(this.state.streamEnd=!0,n&&this.once(a.FINISH,e=>{n&&n(void 0,e)}),r?(this.write(r,o,()=>{m(this)}),this):(h(this,()=>!!m(this)),this))}}function c(e,t,n){if(!e.state.errored){if(e.state.errored=!0,n)return n(t);e.emit(a.ERROR,t)}}function l(e,t,n){return{_id:new o.ObjectId,files_id:e,n:t,data:n}}function d(e,t){e.chunks.listIndexes().toArray((n,r)=>{let o;if(n)return n instanceof i.MongoError&&n.code===i.MONGODB_ERROR_CODES.NamespaceNotFound?(o={files_id:1,n:1},void e.chunks.createIndex(o,{background:!1,unique:!0},e=>{if(e)return t(e);t()})):t(n);let s=!1;if(r&&r.forEach(e=>{if(e.key){2===Object.keys(e.key).length&&1===e.key.files_id&&1===e.key.n&&(s=!0)}}),s)t();else{o={files_id:1,n:1};const n=p(e);e.chunks.createIndex(o,{...n,background:!0,unique:!0},t)}})}function f(e,t){if(e.done)return!0;if(e.state.streamEnd&&0===e.state.outstandingRequests&&!e.state.errored){e.done=!0;const n=function(e,t,n,r,o,i,s){const u={_id:e,length:t,chunkSize:n,uploadDate:new Date,filename:r};o&&(u.contentType=o);i&&(u.aliases=i);s&&(u.metadata=s);return u}(e.id,e.length,e.chunkSizeBytes,e.filename,e.options.contentType,e.options.aliases,e.options.metadata);return!g(e,t)&&(e.files.insertOne(n,p(e),r=>{if(r)return c(e,r,t);e.emit(a.FINISH,n),e.emit(a.CLOSE)}),!0)}return!1}function p(e){const t={};return e.writeConcern&&(t.writeConcern={w:e.writeConcern.w,wtimeout:e.writeConcern.wtimeout,j:e.writeConcern.j}),t}function h(e,t){return e.bucket.s.checkedIndexes?t(!1):(e.bucket.once("index",()=>{t(!0)}),!0)}function m(e,t){if(0===e.pos)return f(e,t);++e.state.outstandingRequests;const n=Buffer.alloc(e.pos);e.bufToStore.copy(n,0,0,e.pos);const r=l(e.id,e.n,n);return!g(e,t)&&(e.chunks.insertOne(r,p(e),t=>{if(t)return c(e,t);--e.state.outstandingRequests,f(e)}),!0)}function g(e,t){return!!e.state.aborted&&("function"==typeof t&&t(new i.MongoAPIError("Stream has been aborted")),!0)}t.GridFSBucketWriteStream=a,a.CLOSE="close",a.ERROR="error",a.FINISH="finish"},function(e,t,n){const r=n(32).ObjectId;e.exports=function(e,t,n,o,i){const s=o.pureName,u=n.__getDatabase(),a=new t.Writable({objectMode:!0});return a.buffer=[],a.wasHeader=!1,a.addRow=e=>{!a.wasHeader&&(a.wasHeader=!0,e.__isStreamHeader)||(i.createStringId&&(e={_id:(new r).toString(),...e}),a.buffer.push(e))},a.checkStructure=async()=>{i.dropIfExists&&(console.log(`Dropping collection ${s}`),await u.collection(s).drop()),i.truncate&&(console.log(`Truncating collection ${s}`),await u.collection(s).deleteMany({}))},a.send=async()=>{const e=a.buffer;a.buffer=[],await u.collection(s).insertMany(e)},a.sendIfFull=async()=>{a.buffer.length>100&&await a.send()},a._write=async(e,t,n)=>{a.addRow(e),await a.sendIfFull(),n()},a._final=async e=>{await a.send(),e()},a}}]);
|