diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index b731da2..388f1f9 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -10,7 +10,7 @@ jobs: - uses: actions/checkout@v2 - uses: actions/setup-node@v2 with: - node-version: 14 + node-version: 16 - name: Get yarn cache id: yarn-cache run: echo "::set-output name=dir::$(yarn cache dir)" diff --git a/.gitignore b/.gitignore index 508d652..e6f4709 100644 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,7 @@ coverage node_modules # Editors +.idea .vscode # OS metadata diff --git a/build/index.js b/build/index.js index f9ab3b7..8cd2472 100644 --- a/build/index.js +++ b/build/index.js @@ -1,24 +1,130 @@ -(()=>{var __webpack_modules__={924:function(e,t,r){"use strict";var n=this&&this.__awaiter||function(e,t,r,n){function adopt(e){return e instanceof r?e:new r((function(t){t(e)}))}return new(r||(r=Promise))((function(r,o){function fulfilled(e){try{step(n.next(e))}catch(e){o(e)}}function rejected(e){try{step(n["throw"](e))}catch(e){o(e)}}function step(e){e.done?r(e.value):adopt(e.value).then(fulfilled,rejected)}step((n=n.apply(e,t||[])).next())}))};var o=this&&this.__generator||function(e,t){var r={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},n,o,i,s;return s={next:verb(0),throw:verb(1),return:verb(2)},typeof Symbol==="function"&&(s[Symbol.iterator]=function(){return this}),s;function verb(e){return function(t){return step([e,t])}}function step(s){if(n)throw new TypeError("Generator is already executing.");while(r)try{if(n=1,o&&(i=s[0]&2?o["return"]:s[0]?o["throw"]||((i=o["return"])&&i.call(o),0):o.next)&&!(i=i.call(o,s[1])).done)return i;if(o=0,i)s=[s[0]&2,i.value];switch(s[0]){case 0:case 1:i=s;break;case 4:r.label++;return{value:s[1],done:false};case 5:r.label++;o=s[1];s=[0];continue;case 7:s=r.ops.pop();r.trys.pop();continue;default:if(!(i=r.trys,i=i.length>0&&i[i.length-1])&&(s[0]===6||s[0]===2)){r=0;continue}if(s[0]===3&&(!i||s[1]>i[0]&&s[1]0&&i[i.length-1])&&(s[0]===6||s[0]===2)){r=0;continue}if(s[0]===3&&(!i||s[1]>i[0]&&s[1]0){e+=" ";let t=true;for(const r in this.properties){if(this.properties.hasOwnProperty(r)){const n=this.properties[r];if(n){if(t){t=false}else{e+=","}e+=`${r}=${escapeProperty(n)}`}}}}e+=`${c}${escapeData(this.message)}`;return e}}function escapeData(e){return a.toCommandValue(e).replace(/%/g,"%25").replace(/\r/g,"%0D").replace(/\n/g,"%0A")}function escapeProperty(e){return a.toCommandValue(e).replace(/%/g,"%25").replace(/\r/g,"%0D").replace(/\n/g,"%0A").replace(/:/g,"%3A").replace(/,/g,"%2C")}},2186:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){if(n===undefined)n=r;Object.defineProperty(e,n,{enumerable:true,get:function(){return t[r]}})}:function(e,t,r,n){if(n===undefined)n=r;e[n]=t[r]});var o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:true,value:t})}:function(e,t){e["default"]=t});var i=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)if(r!=="default"&&Object.hasOwnProperty.call(e,r))n(t,e,r);o(t,e);return t};var s=this&&this.__awaiter||function(e,t,r,n){function adopt(e){return e instanceof r?e:new r((function(t){t(e)}))}return new(r||(r=Promise))((function(r,o){function fulfilled(e){try{step(n.next(e))}catch(e){o(e)}}function rejected(e){try{step(n["throw"](e))}catch(e){o(e)}}function step(e){e.done?r(e.value):adopt(e.value).then(fulfilled,rejected)}step((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:true});t.getState=t.saveState=t.group=t.endGroup=t.startGroup=t.info=t.warning=t.error=t.debug=t.isDebug=t.setFailed=t.setCommandEcho=t.setOutput=t.getBooleanInput=t.getMultilineInput=t.getInput=t.addPath=t.setSecret=t.exportVariable=t.ExitCode=void 0;const a=r(7351);const c=r(717);const l=r(6321);const u=i(r(2087));const d=i(r(5622));var p;(function(e){e[e["Success"]=0]="Success";e[e["Failure"]=1]="Failure"})(p=t.ExitCode||(t.ExitCode={}));function exportVariable(e,t){const r=l.toCommandValue(t);process.env[e]=r;const n=process.env["GITHUB_ENV"]||"";if(n){const t="_GitHubActionsFileCommandDelimeter_";const n=`${e}<<${t}${u.EOL}${r}${u.EOL}${t}`;c.issueCommand("ENV",n)}else{a.issueCommand("set-env",{name:e},r)}}t.exportVariable=exportVariable;function setSecret(e){a.issueCommand("add-mask",{},e)}t.setSecret=setSecret;function addPath(e){const t=process.env["GITHUB_PATH"]||"";if(t){c.issueCommand("PATH",e)}else{a.issueCommand("add-path",{},e)}process.env["PATH"]=`${e}${d.delimiter}${process.env["PATH"]}`}t.addPath=addPath;function getInput(e,t){const r=process.env[`INPUT_${e.replace(/ /g,"_").toUpperCase()}`]||"";if(t&&t.required&&!r){throw new Error(`Input required and not supplied: ${e}`)}if(t&&t.trimWhitespace===false){return r}return r.trim()}t.getInput=getInput;function getMultilineInput(e,t){const r=getInput(e,t).split("\n").filter((e=>e!==""));return r}t.getMultilineInput=getMultilineInput;function getBooleanInput(e,t){const r=["true","True","TRUE"];const n=["false","False","FALSE"];const o=getInput(e,t);if(r.includes(o))return true;if(n.includes(o))return false;throw new TypeError(`Input does not meet YAML 1.2 "Core Schema" specification: ${e}\n`+`Support boolean input list: \`true | True | TRUE | false | False | FALSE\``)}t.getBooleanInput=getBooleanInput;function setOutput(e,t){process.stdout.write(u.EOL);a.issueCommand("set-output",{name:e},t)}t.setOutput=setOutput;function setCommandEcho(e){a.issue("echo",e?"on":"off")}t.setCommandEcho=setCommandEcho;function setFailed(e){process.exitCode=p.Failure;error(e)}t.setFailed=setFailed;function isDebug(){return process.env["RUNNER_DEBUG"]==="1"}t.isDebug=isDebug;function debug(e){a.issueCommand("debug",{},e)}t.debug=debug;function error(e){a.issue("error",e instanceof Error?e.toString():e)}t.error=error;function warning(e){a.issue("warning",e instanceof Error?e.toString():e)}t.warning=warning;function info(e){process.stdout.write(e+u.EOL)}t.info=info;function startGroup(e){a.issue("group",e)}t.startGroup=startGroup;function endGroup(){a.issue("endgroup")}t.endGroup=endGroup;function group(e,t){return s(this,void 0,void 0,(function*(){startGroup(e);let r;try{r=yield t()}finally{endGroup()}return r}))}t.group=group;function saveState(e,t){a.issueCommand("save-state",{name:e},t)}t.saveState=saveState;function getState(e){return process.env[`STATE_${e}`]||""}t.getState=getState},717:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){if(n===undefined)n=r;Object.defineProperty(e,n,{enumerable:true,get:function(){return t[r]}})}:function(e,t,r,n){if(n===undefined)n=r;e[n]=t[r]});var o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:true,value:t})}:function(e,t){e["default"]=t});var i=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)if(r!=="default"&&Object.hasOwnProperty.call(e,r))n(t,e,r);o(t,e);return t};Object.defineProperty(t,"__esModule",{value:true});t.issueCommand=void 0;const s=i(r(5747));const a=i(r(2087));const c=r(6321);function issueCommand(e,t){const r=process.env[`GITHUB_${e}`];if(!r){throw new Error(`Unable to find environment variable for file command ${e}`)}if(!s.existsSync(r)){throw new Error(`Missing file at path: ${r}`)}s.appendFileSync(r,`${c.toCommandValue(t)}${a.EOL}`,{encoding:"utf8"})}t.issueCommand=issueCommand},6321:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.toCommandValue=void 0;function toCommandValue(e){if(e===null||e===undefined){return""}else if(typeof e==="string"||e instanceof String){return e}return JSON.stringify(e)}t.toCommandValue=toCommandValue},9690:function(e,t,r){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};const o=r(8614);const i=n(r(8237));const s=n(r(6570));const a=i.default("agent-base");function isAgent(e){return Boolean(e)&&typeof e.addRequest==="function"}function isSecureEndpoint(){const{stack:e}=new Error;if(typeof e!=="string")return false;return e.split("\n").some((e=>e.indexOf("(https.js:")!==-1||e.indexOf("node:https:")!==-1))}function createAgent(e,t){return new createAgent.Agent(e,t)}(function(e){class Agent extends o.EventEmitter{constructor(e,t){super();let r=t;if(typeof e==="function"){this.callback=e}else if(e){r=e}this.timeout=null;if(r&&typeof r.timeout==="number"){this.timeout=r.timeout}this.maxFreeSockets=1;this.maxSockets=1;this.maxTotalSockets=Infinity;this.sockets={};this.freeSockets={};this.requests={};this.options={}}get defaultPort(){if(typeof this.explicitDefaultPort==="number"){return this.explicitDefaultPort}return isSecureEndpoint()?443:80}set defaultPort(e){this.explicitDefaultPort=e}get protocol(){if(typeof this.explicitProtocol==="string"){return this.explicitProtocol}return isSecureEndpoint()?"https:":"http:"}set protocol(e){this.explicitProtocol=e}callback(e,t,r){throw new Error('"agent-base" has no default implementation, you must subclass and override `callback()`')}addRequest(e,t){const r=Object.assign({},t);if(typeof r.secureEndpoint!=="boolean"){r.secureEndpoint=isSecureEndpoint()}if(r.host==null){r.host="localhost"}if(r.port==null){r.port=r.secureEndpoint?443:80}if(r.protocol==null){r.protocol=r.secureEndpoint?"https:":"http:"}if(r.host&&r.path){delete r.path}delete r.agent;delete r.hostname;delete r._defaultAgent;delete r.defaultPort;delete r.createConnection;e._last=true;e.shouldKeepAlive=false;let n=false;let o=null;const i=r.timeout||this.timeout;const onerror=t=>{if(e._hadError)return;e.emit("error",t);e._hadError=true};const ontimeout=()=>{o=null;n=true;const e=new Error(`A "socket" was not created for HTTP request before ${i}ms`);e.code="ETIMEOUT";onerror(e)};const callbackError=e=>{if(n)return;if(o!==null){clearTimeout(o);o=null}onerror(e)};const onsocket=t=>{if(n)return;if(o!=null){clearTimeout(o);o=null}if(isAgent(t)){a("Callback returned another Agent instance %o",t.constructor.name);t.addRequest(e,r);return}if(t){t.once("free",(()=>{this.freeSocket(t,r)}));e.onSocket(t);return}const i=new Error(`no Duplex stream was returned to agent-base for \`${e.method} ${e.path}\``);onerror(i)};if(typeof this.callback!=="function"){onerror(new Error("`callback` is not defined"));return}if(!this.promisifiedCallback){if(this.callback.length>=3){a("Converting legacy callback function to promise");this.promisifiedCallback=s.default(this.callback)}else{this.promisifiedCallback=this.callback}}if(typeof i==="number"&&i>0){o=setTimeout(ontimeout,i)}if("port"in r&&typeof r.port!=="number"){r.port=Number(r.port)}try{a("Resolving socket for %o request: %o",r.protocol,`${e.method} ${e.path}`);Promise.resolve(this.promisifiedCallback(e,r)).then(onsocket,callbackError)}catch(e){Promise.reject(e).catch(callbackError)}}freeSocket(e,t){a("Freeing socket %o %o",e.constructor.name,t);e.destroy()}destroy(){a("Destroying agent %o",this.constructor.name)}}e.Agent=Agent;e.prototype=e.Agent.prototype})(createAgent||(createAgent={}));e.exports=createAgent},6570:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});function promisify(e){return function(t,r){return new Promise(((n,o)=>{e.call(this,t,r,((e,t)=>{if(e){o(e)}else{n(t)}}))}))}}t.default=promisify},4855:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});var n=r(4351);var o=r(6006);var i=function(){function Mutex(e){this._semaphore=new o.default(1,e)}Mutex.prototype.acquire=function(){return(0,n.__awaiter)(this,void 0,void 0,(function(){var e,t;return(0,n.__generator)(this,(function(r){switch(r.label){case 0:return[4,this._semaphore.acquire()];case 1:e=r.sent(),t=e[1];return[2,t]}}))}))};Mutex.prototype.runExclusive=function(e){return this._semaphore.runExclusive((function(){return e()}))};Mutex.prototype.isLocked=function(){return this._semaphore.isLocked()};Mutex.prototype.waitForUnlock=function(){return this._semaphore.waitForUnlock()};Mutex.prototype.release=function(){this._semaphore.release()};Mutex.prototype.cancel=function(){return this._semaphore.cancel()};return Mutex}();t.default=i},6006:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});var n=r(4351);var o=r(6984);var i=function(){function Semaphore(e,t){if(t===void 0){t=o.E_CANCELED}this._maxConcurrency=e;this._cancelError=t;this._queue=[];this._waiters=[];if(e<=0){throw new Error("semaphore must be initialized to a positive value")}this._value=e}Semaphore.prototype.acquire=function(){var e=this;var t=this.isLocked();var r=new Promise((function(t,r){return e._queue.push({resolve:t,reject:r})}));if(!t)this._dispatch();return r};Semaphore.prototype.runExclusive=function(e){return(0,n.__awaiter)(this,void 0,void 0,(function(){var t,r,o;return(0,n.__generator)(this,(function(n){switch(n.label){case 0:return[4,this.acquire()];case 1:t=n.sent(),r=t[0],o=t[1];n.label=2;case 2:n.trys.push([2,,4,5]);return[4,e(r)];case 3:return[2,n.sent()];case 4:o();return[7];case 5:return[2]}}))}))};Semaphore.prototype.waitForUnlock=function(){return(0,n.__awaiter)(this,void 0,void 0,(function(){var e;var t=this;return(0,n.__generator)(this,(function(r){if(!this.isLocked()){return[2,Promise.resolve()]}e=new Promise((function(e){return t._waiters.push({resolve:e})}));return[2,e]}))}))};Semaphore.prototype.isLocked=function(){return this._value<=0};Semaphore.prototype.release=function(){if(this._maxConcurrency>1){throw new Error("this method is unavailable on semaphores with concurrency > 1; use the scoped release returned by acquire instead")}if(this._currentReleaser){var e=this._currentReleaser;this._currentReleaser=undefined;e()}};Semaphore.prototype.cancel=function(){var e=this;this._queue.forEach((function(t){return t.reject(e._cancelError)}));this._queue=[]};Semaphore.prototype._dispatch=function(){var e=this;var t=this._queue.shift();if(!t)return;var r=false;this._currentReleaser=function(){if(r)return;r=true;e._value++;e._resolveWaiters();e._dispatch()};t.resolve([this._value--,this._currentReleaser])};Semaphore.prototype._resolveWaiters=function(){this._waiters.forEach((function(e){return e.resolve()}));this._waiters=[]};return Semaphore}();t.default=i},6984:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.E_CANCELED=t.E_ALREADY_LOCKED=t.E_TIMEOUT=void 0;t.E_TIMEOUT=new Error("timeout while waiting for mutex to become available");t.E_ALREADY_LOCKED=new Error("mutex already locked");t.E_CANCELED=new Error("request for lock canceled")},4038:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.tryAcquire=t.withTimeout=t.Semaphore=t.Mutex=void 0;var n=r(4351);var o=r(4855);Object.defineProperty(t,"Mutex",{enumerable:true,get:function(){return o.default}});var i=r(6006);Object.defineProperty(t,"Semaphore",{enumerable:true,get:function(){return i.default}});var s=r(5124);Object.defineProperty(t,"withTimeout",{enumerable:true,get:function(){return s.withTimeout}});var a=r(2621);Object.defineProperty(t,"tryAcquire",{enumerable:true,get:function(){return a.tryAcquire}});(0,n.__exportStar)(r(6984),t)},2621:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.tryAcquire=void 0;var n=r(6984);var o=r(5124);function tryAcquire(e,t){if(t===void 0){t=n.E_ALREADY_LOCKED}return(0,o.withTimeout)(e,0,t)}t.tryAcquire=tryAcquire},5124:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.withTimeout=void 0;var n=r(4351);var o=r(6984);function withTimeout(e,t,r){var i=this;if(r===void 0){r=o.E_TIMEOUT}return{acquire:function(){return new Promise((function(o,s){return(0,n.__awaiter)(i,void 0,void 0,(function(){var i,a,c,l,u;return(0,n.__generator)(this,(function(n){switch(n.label){case 0:i=false;a=setTimeout((function(){i=true;s(r)}),t);n.label=1;case 1:n.trys.push([1,3,,4]);return[4,e.acquire()];case 2:c=n.sent();if(i){l=Array.isArray(c)?c[1]:c;l()}else{clearTimeout(a);o(c)}return[3,4];case 3:u=n.sent();if(!i){clearTimeout(a);s(u)}return[3,4];case 4:return[2]}}))}))}))},runExclusive:function(e){return(0,n.__awaiter)(this,void 0,void 0,(function(){var t,r;return(0,n.__generator)(this,(function(n){switch(n.label){case 0:t=function(){return undefined};n.label=1;case 1:n.trys.push([1,,7,8]);return[4,this.acquire()];case 2:r=n.sent();if(!Array.isArray(r))return[3,4];t=r[1];return[4,e(r[0])];case 3:return[2,n.sent()];case 4:t=r;return[4,e()];case 5:return[2,n.sent()];case 6:return[3,8];case 7:t();return[7];case 8:return[2]}}))}))},release:function(){e.release()},cancel:function(){return e.cancel()},waitForUnlock:function(){return e.waitForUnlock()},isLocked:function(){return e.isLocked()}}}t.withTimeout=withTimeout},9417:e=>{"use strict";e.exports=balanced;function balanced(e,t,r){if(e instanceof RegExp)e=maybeMatch(e,r);if(t instanceof RegExp)t=maybeMatch(t,r);var n=range(e,t,r);return n&&{start:n[0],end:n[1],pre:r.slice(0,n[0]),body:r.slice(n[0]+e.length,n[1]),post:r.slice(n[1]+t.length)}}function maybeMatch(e,t){var r=t.match(e);return r?r[0]:null}balanced.range=range;function range(e,t,r){var n,o,i,s,a;var c=r.indexOf(e);var l=r.indexOf(t,c+1);var u=c;if(c>=0&&l>0){if(e===t){return[c,l]}n=[];i=r.length;while(u>=0&&!a){if(u==c){n.push(u);c=r.indexOf(e,u+1)}else if(n.length==1){a=[n.pop(),l]}else{o=n.pop();if(o=0?c:l}if(n.length){a=[i,s]}}return a}},336:(e,t,r)=>{"use strict";var n=r(1642).Duplex,o=r(1669),i=r(1867).Buffer;function BufferList(e){if(!(this instanceof BufferList))return new BufferList(e);this._bufs=[];this.length=0;if(typeof e=="function"){this._callback=e;var t=function piper(e){if(this._callback){this._callback(e);this._callback=null}}.bind(this);this.on("pipe",(function onPipe(e){e.on("error",t)}));this.on("unpipe",(function onUnpipe(e){e.removeListener("error",t)}))}else{this.append(e)}n.call(this)}o.inherits(BufferList,n);BufferList.prototype._offset=function _offset(e){var t=0,r=0,n;if(e===0)return[0,0];for(;rthis.length||e<0){return undefined}var t=this._offset(e);return this._bufs[t[0]][t[1]]};BufferList.prototype.slice=function slice(e,t){if(typeof e=="number"&&e<0)e+=this.length;if(typeof t=="number"&&t<0)t+=this.length;return this.copy(null,0,e,t)};BufferList.prototype.copy=function copy(e,t,r,n){if(typeof r!="number"||r<0)r=0;if(typeof n!="number"||n>this.length)n=this.length;if(r>=this.length)return e||i.alloc(0);if(n<=0)return e||i.alloc(0);var copy=!!e,o=this._offset(r),s=n-r,a=s,c=copy&&t||0,l=o[1],u,d;if(r===0&&n==this.length){if(!copy){return this._bufs.length===1?this._bufs[0]:i.concat(this._bufs,this.length)}for(d=0;du){this._bufs[d].copy(e,c,l);c+=u}else{this._bufs[d].copy(e,c,l,l+a);c+=u;break}a-=u;if(l)l=0}if(e.length>c)return e.slice(0,c);return e};BufferList.prototype.shallowSlice=function shallowSlice(e,t){e=e||0;t=typeof t!=="number"?this.length:t;if(e<0)e+=this.length;if(t<0)t+=this.length;if(e===t){return new BufferList}var r=this._offset(e),n=this._offset(t),o=this._bufs.slice(r[0],n[0]+1);if(n[1]==0)o.pop();else o[o.length-1]=o[o.length-1].slice(0,n[1]);if(r[1]!=0)o[0]=o[0].slice(r[1]);return new BufferList(o)};BufferList.prototype.toString=function toString(e,t,r){return this.slice(t,r).toString(e)};BufferList.prototype.consume=function consume(e){e=Math.trunc(e);if(Number.isNaN(e)||e<=0)return this;while(this._bufs.length){if(e>=this._bufs[0].length){e-=this._bufs[0].length;this.length-=this._bufs[0].length;this._bufs.shift()}else{this._bufs[0]=this._bufs[0].slice(e);this.length-=e;break}}return this};BufferList.prototype.duplicate=function duplicate(){var e=0,t=new BufferList;for(;ethis.length?this.length:t}var n=this._offset(t);var o=n[0];var s=n[1];for(o;o=e.length){var l=a.indexOf(e,s);if(l!==-1){return this._reverseOffset([o,l])}s=a.length-e.length+1}else{var u=this._reverseOffset([o,s]);if(this._match(u,e)){return u}s++}}s=0}return-1};BufferList.prototype._match=function(e,t){if(this.length-e{var n=r(6891);var o=r(9417);e.exports=expandTop;var i="\0SLASH"+Math.random()+"\0";var s="\0OPEN"+Math.random()+"\0";var a="\0CLOSE"+Math.random()+"\0";var c="\0COMMA"+Math.random()+"\0";var l="\0PERIOD"+Math.random()+"\0";function numeric(e){return parseInt(e,10)==e?parseInt(e,10):e.charCodeAt(0)}function escapeBraces(e){return e.split("\\\\").join(i).split("\\{").join(s).split("\\}").join(a).split("\\,").join(c).split("\\.").join(l)}function unescapeBraces(e){return e.split(i).join("\\").split(s).join("{").split(a).join("}").split(c).join(",").split(l).join(".")}function parseCommaParts(e){if(!e)return[""];var t=[];var r=o("{","}",e);if(!r)return e.split(",");var n=r.pre;var i=r.body;var s=r.post;var a=n.split(",");a[a.length-1]+="{"+i+"}";var c=parseCommaParts(s);if(s.length){a[a.length-1]+=c.shift();a.push.apply(a,c)}t.push.apply(t,a);return t}function expandTop(e){if(!e)return[];if(e.substr(0,2)==="{}"){e="\\{\\}"+e.substr(2)}return expand(escapeBraces(e),true).map(unescapeBraces)}function identity(e){return e}function embrace(e){return"{"+e+"}"}function isPadded(e){return/^-?0\d/.test(e)}function lte(e,t){return e<=t}function gte(e,t){return e>=t}function expand(e,t){var r=[];var i=o("{","}",e);if(!i||/\$$/.test(i.pre))return[e];var s=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(i.body);var c=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(i.body);var l=s||c;var u=i.body.indexOf(",")>=0;if(!l&&!u){if(i.post.match(/,.*\}/)){e=i.pre+"{"+i.body+a+i.post;return expand(e)}return[e]}var d;if(l){d=i.body.split(/\.\./)}else{d=parseCommaParts(i.body);if(d.length===1){d=expand(d[0],false).map(embrace);if(d.length===1){var p=i.post.length?expand(i.post,false):[""];return p.map((function(e){return i.pre+d[0]+e}))}}}var h=i.pre;var p=i.post.length?expand(i.post,false):[""];var m;if(l){var g=numeric(d[0]);var y=numeric(d[1]);var v=Math.max(d[0].length,d[1].length);var b=d.length==3?Math.abs(numeric(d[2])):1;var S=lte;var w=y0){var T=new Array(C+1).join("0");if(_<0)O="-"+T+O.slice(1);else O=T+O}}}m.push(O)}}else{m=n(d,(function(e){return expand(e,false)}))}for(var I=0;I{var n=r(6800),o=r(5497),i=r(7113),s=r(3797),a=r(414),c=r(972),l=r(6142),u=r(8522),d=r(3639),p=r(5846),h=r(5325),m=r(9502),g=r(4636),y=r(2259),v=r(1031);n.BSON_INT32_MAX=2147483647;n.BSON_INT32_MIN=-2147483648;n.BSON_INT64_MAX=Math.pow(2,63)-1;n.BSON_INT64_MIN=-Math.pow(2,63);n.JS_INT_MAX=9007199254740992;n.JS_INT_MIN=-9007199254740992;n.Binary=o;n.Code=i;n.DBRef=s;n.Decimal128=a;n.Double=c;n.Int32=l;n.Long=u;n.Map=d;n.MaxKey=p;n.MinKey=h;n.ObjectId=m;n.ObjectID=m;n.BSONRegExp=g;n.Symbol=y;n.Timestamp=v;e.exports=n},5497:(e,t,r)=>{if(typeof global!=="undefined"){var n=r(4293).Buffer}var o=r(2863);function Binary(e,t){if(!(this instanceof Binary))return new Binary(e,t);if(e!=null&&!(typeof e==="string")&&!n.isBuffer(e)&&!(e instanceof Uint8Array)&&!Array.isArray(e)){throw new Error("only String, Buffer, Uint8Array or Array accepted")}this._bsontype="Binary";if(e instanceof Number){this.sub_type=e;this.position=0}else{this.sub_type=t==null?i:t;this.position=0}if(e!=null&&!(e instanceof Number)){if(typeof e==="string"){if(typeof n!=="undefined"){this.buffer=o.toBuffer(e)}else if(typeof Uint8Array!=="undefined"||Object.prototype.toString.call(e)==="[object Array]"){this.buffer=writeStringToArray(e)}else{throw new Error("only String, Buffer, Uint8Array or Array accepted")}}else{this.buffer=e}this.position=e.length}else{if(typeof n!=="undefined"){this.buffer=o.allocBuffer(Binary.BUFFER_SIZE)}else if(typeof Uint8Array!=="undefined"){this.buffer=new Uint8Array(new ArrayBuffer(Binary.BUFFER_SIZE))}else{this.buffer=new Array(Binary.BUFFER_SIZE)}this.position=0}}Binary.prototype.put=function put(e){if(e["length"]!=null&&typeof e!=="number"&&e.length!==1)throw new Error("only accepts single character String, Uint8Array or Array");if(typeof e!=="number"&&e<0||e>255)throw new Error("only accepts number in a valid unsigned byte range 0-255");var t=null;if(typeof e==="string"){t=e.charCodeAt(0)}else if(e["length"]!=null){t=e[0]}else{t=e}if(this.buffer.length>this.position){this.buffer[this.position++]=t}else{if(typeof n!=="undefined"&&n.isBuffer(this.buffer)){var r=o.allocBuffer(Binary.BUFFER_SIZE+this.buffer.length);this.buffer.copy(r,0,0,this.buffer.length);this.buffer=r;this.buffer[this.position++]=t}else{r=null;if(Object.prototype.toString.call(this.buffer)==="[object Uint8Array]"){r=new Uint8Array(new ArrayBuffer(Binary.BUFFER_SIZE+this.buffer.length))}else{r=new Array(Binary.BUFFER_SIZE+this.buffer.length)}for(var i=0;ithis.position?t+e.length:this.position}else if(typeof n!=="undefined"&&typeof e==="string"&&n.isBuffer(this.buffer)){this.buffer.write(e,t,"binary");this.position=t+e.length>this.position?t+e.length:this.position}else if(Object.prototype.toString.call(e)==="[object Uint8Array]"||Object.prototype.toString.call(e)==="[object Array]"&&typeof e!=="string"){for(i=0;ithis.position?t:this.position}else if(typeof e==="string"){for(i=0;ithis.position?t:this.position}};Binary.prototype.read=function read(e,t){t=t&&t>0?t:this.position;if(this.buffer["slice"]){return this.buffer.slice(e,e+t)}else{var r=typeof Uint8Array!=="undefined"?new Uint8Array(new ArrayBuffer(t)):new Array(t);for(var n=0;n{"use strict";var n=r(3639),o=r(8522),i=r(972),s=r(1031),a=r(9502),c=r(4636),l=r(2259),u=r(6142),d=r(7113),p=r(414),h=r(5325),m=r(5846),g=r(3797),y=r(5497);var v=r(2139),b=r(9290),S=r(1273),w=r(2863);var E=1024*1024*17;var _=w.allocBuffer(E);var BSON=function(){};BSON.prototype.serialize=function serialize(e,t){t=t||{};var r=typeof t.checkKeys==="boolean"?t.checkKeys:false;var n=typeof t.serializeFunctions==="boolean"?t.serializeFunctions:false;var o=typeof t.ignoreUndefined==="boolean"?t.ignoreUndefined:true;var i=typeof t.minInternalBufferSize==="number"?t.minInternalBufferSize:E;if(_.length{var t=function Code(e,t){if(!(this instanceof Code))return new Code(e,t);this._bsontype="Code";this.code=e;this.scope=t};t.prototype.toJSON=function(){return{scope:this.scope,code:this.code}};e.exports=t;e.exports.Code=t},3797:e=>{function DBRef(e,t,r){if(!(this instanceof DBRef))return new DBRef(e,t,r);this._bsontype="DBRef";this.namespace=e;this.oid=t;this.db=r}DBRef.prototype.toJSON=function(){return{$ref:this.namespace,$id:this.oid,$db:this.db==null?"":this.db}};e.exports=DBRef;e.exports.DBRef=DBRef},414:(e,t,r)=>{"use strict";var n=r(8522);var o=/^(\+|-)?(\d+|(\d*\.\d*))?(E|e)?([-+])?(\d+)?$/;var i=/^(\+|-)?(Infinity|inf)$/i;var s=/^(\+|-)?NaN$/i;var a=6111;var c=-6176;var l=6176;var u=34;var d=[124,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0].reverse();var p=[248,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0].reverse();var h=[120,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0].reverse();var m=/^([-+])?(\d+)?$/;var g=r(2863);var isDigit=function(e){return!isNaN(parseInt(e,10))};var divideu128=function(e){var t=n.fromNumber(1e3*1e3*1e3);var r=n.fromNumber(0);var o=0;if(!e.parts[0]&&!e.parts[1]&&!e.parts[2]&&!e.parts[3]){return{quotient:e,rem:r}}for(o=0;o<=3;o++){r=r.shiftLeft(32);r=r.add(new n(e.parts[o],0));e.parts[o]=r.div(t).low_;r=r.modulo(t)}return{quotient:e,rem:r}};var multiply64x2=function(e,t){if(!e&&!t){return{high:n.fromNumber(0),low:n.fromNumber(0)}}var r=e.shiftRightUnsigned(32);var o=new n(e.getLowBits(),0);var i=t.shiftRightUnsigned(32);var s=new n(t.getLowBits(),0);var a=r.multiply(i);var c=r.multiply(s);var l=o.multiply(i);var u=o.multiply(s);a=a.add(c.shiftRightUnsigned(32));c=new n(c.getLowBits(),0).add(l).add(u.shiftRightUnsigned(32));a=a.add(c.shiftRightUnsigned(32));u=c.shiftLeft(32).add(new n(u.getLowBits(),0));return{high:a,low:u}};var lessThan=function(e,t){var r=e.high_>>>0;var n=t.high_>>>0;if(r>>0;var i=t.low_>>>0;if(o=7e3){throw new Error(""+e+" not a valid Decimal128 string")}var P=e.match(o);var L=e.match(i);var B=e.match(s);if(!P&&!L&&!B||e.length===0){throw new Error(""+e+" not a valid Decimal128 string")}if(P&&P[4]&&P[2]===undefined){throw new Error(""+e+" not a valid Decimal128 string")}if(e[D]==="+"||e[D]==="-"){t=e[D++]==="-"}if(!isDigit(e[D])&&e[D]!=="."){if(e[D]==="i"||e[D]==="I"){return new Decimal128(g.toBuffer(t?p:h))}else if(e[D]==="N"){return new Decimal128(g.toBuffer(d))}}while(isDigit(e[D])||e[D]==="."){if(e[D]==="."){if(r){return new Decimal128(g.toBuffer(d))}r=true;D=D+1;continue}if(O<34){if(e[D]!=="0"||y){if(!y){E=b}y=true;_[C++]=parseInt(e[D],10);O=O+1}}if(y){S=S+1}if(r){w=w+1}b=b+1;D=D+1}if(r&&!b){throw new Error(""+e+" not a valid Decimal128 string")}if(e[D]==="e"||e[D]==="E"){var j=e.substr(++D).match(m);if(!j||!j[2]){return new Decimal128(g.toBuffer(d))}k=parseInt(j[0],10);D=D+j[0].length}if(e[D]){return new Decimal128(g.toBuffer(d))}T=0;if(!O){T=0;I=0;_[0]=0;S=1;O=1;v=0}else{I=O-1;v=S;if(k!==0&&v!==1){while(e[E+v-1]==="0"){v=v-1}}}if(k<=w&&w-k>1<<14){k=c}else{k=k-w}while(k>a){I=I+1;if(I-T>u){var U=_.join("");if(U.match(/^0+$/)){k=a;break}else{return new Decimal128(g.toBuffer(t?p:h))}}k=k-1}while(k=5){$=1;if(W===5){$=_[I]%2===1;for(A=E+I+2;A=0;z--){if(++_[z]>9){_[z]=0;if(z===0){if(k>8&255;G[D++]=V.low.low_>>16&255;G[D++]=V.low.low_>>24&255;G[D++]=V.low.high_&255;G[D++]=V.low.high_>>8&255;G[D++]=V.low.high_>>16&255;G[D++]=V.low.high_>>24&255;G[D++]=V.high.low_&255;G[D++]=V.high.low_>>8&255;G[D++]=V.high.low_>>16&255;G[D++]=V.high.low_>>24&255;G[D++]=V.high.high_&255;G[D++]=V.high.high_>>8&255;G[D++]=V.high.high_>>16&255;G[D++]=V.high.high_>>24&255;return new Decimal128(G)};var y=31;var v=16383;var b=30;var S=31;l=6176;Decimal128.prototype.toString=function(){var e;var t;var r;var o;var i;var s;var a=0;var c=new Array(36);for(var u=0;u>26&y;if(i>>3===3){if(i===b){return O.join("")+"Infinity"}else if(i===S){return"NaN"}else{s=e>>15&v;g=8+(e>>14&1)}}else{g=e>>14&7;s=e>>17&v}p=s-l;w.parts[0]=(e&16383)+((g&15)<<14);w.parts[1]=t;w.parts[2]=r;w.parts[3]=o;if(w.parts[0]===0&&w.parts[1]===0&&w.parts[2]===0&&w.parts[3]===0){m=true}else{for(_=3;_>=0;_--){var I=0;var k=divideu128(w);w=k.quotient;I=k.rem.low_;if(!I)continue;for(E=8;E>=0;E--){c[_*9+E]=I%10;I=Math.floor(I/10)}}}if(m){a=1;c[d]=0}else{a=36;u=0;while(!c[d]){u++;a=a-1;d=d+1}}h=a-1+p;if(h>=34||h<=-7||p>0){O.push(c[d++]);a=a-1;if(a){O.push(".")}for(u=0;u0){O.push("+"+h)}else{O.push(h)}}else{if(p>=0){for(u=0;u0){for(u=0;u{function Double(e){if(!(this instanceof Double))return new Double(e);this._bsontype="Double";this.value=e}Double.prototype.valueOf=function(){return this.value};Double.prototype.toJSON=function(){return this.value};e.exports=Double;e.exports.Double=Double},7998:(e,t)=>{var r;var readIEEE754=function(e,t,r,n,o){var i,s,a=r==="big",c=o*8-n-1,l=(1<>1,d=-7,p=a?0:o-1,h=a?1:-1,m=e[t+p];p+=h;i=m&(1<<-d)-1;m>>=-d;d+=c;for(;d>0;i=i*256+e[t+p],p+=h,d-=8);s=i&(1<<-d)-1;i>>=-d;d+=n;for(;d>0;s=s*256+e[t+p],p+=h,d-=8);if(i===0){i=1-u}else if(i===l){return s?NaN:(m?-1:1)*Infinity}else{s=s+Math.pow(2,n);i=i-u}return(m?-1:1)*s*Math.pow(2,i-n)};var writeIEEE754=function(e,t,r,n,o,i){var s,a,c,l=n==="big",u=i*8-o-1,d=(1<>1,h=o===23?Math.pow(2,-24)-Math.pow(2,-77):0,m=l?i-1:0,g=l?-1:1,y=t<0||t===0&&1/t<0?1:0;t=Math.abs(t);if(isNaN(t)||t===Infinity){a=isNaN(t)?1:0;s=d}else{s=Math.floor(Math.log(t)/Math.LN2);if(t*(c=Math.pow(2,-s))<1){s--;c*=2}if(s+p>=1){t+=h/c}else{t+=h*Math.pow(2,1-p)}if(t*c>=2){s++;c/=2}if(s+p>=d){a=0;s=d}else if(s+p>=1){a=(t*c-1)*Math.pow(2,o);s=s+p}else{a=t*Math.pow(2,p-1)*Math.pow(2,o);s=0}}for(;o>=8;e[r+m]=a&255,m+=g,a/=256,o-=8);s=s<0;e[r+m]=s&255,m+=g,s/=256,u-=8);e[r+m-g]|=y*128};r=readIEEE754;t.P=writeIEEE754},6142:e=>{var Int32=function(e){if(!(this instanceof Int32))return new Int32(e);this._bsontype="Int32";this.value=e};Int32.prototype.valueOf=function(){return this.value};Int32.prototype.toJSON=function(){return this.value};e.exports=Int32;e.exports.Int32=Int32},8522:e=>{function Long(e,t){if(!(this instanceof Long))return new Long(e,t);this._bsontype="Long";this.low_=e|0;this.high_=t|0}Long.prototype.toInt=function(){return this.low_};Long.prototype.toNumber=function(){return this.high_*Long.TWO_PWR_32_DBL_+this.getLowBitsUnsigned()};Long.prototype.toBigInt=function(){return BigInt(this.toString())};Long.prototype.toJSON=function(){return this.toString()};Long.prototype.toString=function(e){var t=e||10;if(t<2||36=0?this.low_:Long.TWO_PWR_32_DBL_+this.low_};Long.prototype.getNumBitsAbs=function(){if(this.isNegative()){if(this.equals(Long.MIN_VALUE)){return 64}else{return this.negate().getNumBitsAbs()}}else{var e=this.high_!==0?this.high_:this.low_;for(var t=31;t>0;t--){if((e&1<0};Long.prototype.greaterThanOrEqual=function(e){return this.compare(e)>=0};Long.prototype.compare=function(e){if(this.equals(e)){return 0}var t=this.isNegative();var r=e.isNegative();if(t&&!r){return-1}if(!t&&r){return 1}if(this.subtract(e).isNegative()){return-1}else{return 1}};Long.prototype.negate=function(){if(this.equals(Long.MIN_VALUE)){return Long.MIN_VALUE}else{return this.not().add(Long.ONE)}};Long.prototype.add=function(e){var t=this.high_>>>16;var r=this.high_&65535;var n=this.low_>>>16;var o=this.low_&65535;var i=e.high_>>>16;var s=e.high_&65535;var a=e.low_>>>16;var c=e.low_&65535;var l=0,u=0,d=0,p=0;p+=o+c;d+=p>>>16;p&=65535;d+=n+a;u+=d>>>16;d&=65535;u+=r+s;l+=u>>>16;u&=65535;l+=t+i;l&=65535;return Long.fromBits(d<<16|p,l<<16|u)};Long.prototype.subtract=function(e){return this.add(e.negate())};Long.prototype.multiply=function(e){if(this.isZero()){return Long.ZERO}else if(e.isZero()){return Long.ZERO}if(this.equals(Long.MIN_VALUE)){return e.isOdd()?Long.MIN_VALUE:Long.ZERO}else if(e.equals(Long.MIN_VALUE)){return this.isOdd()?Long.MIN_VALUE:Long.ZERO}if(this.isNegative()){if(e.isNegative()){return this.negate().multiply(e.negate())}else{return this.negate().multiply(e).negate()}}else if(e.isNegative()){return this.multiply(e.negate()).negate()}if(this.lessThan(Long.TWO_PWR_24_)&&e.lessThan(Long.TWO_PWR_24_)){return Long.fromNumber(this.toNumber()*e.toNumber())}var t=this.high_>>>16;var r=this.high_&65535;var n=this.low_>>>16;var o=this.low_&65535;var i=e.high_>>>16;var s=e.high_&65535;var a=e.low_>>>16;var c=e.low_&65535;var l=0,u=0,d=0,p=0;p+=o*c;d+=p>>>16;p&=65535;d+=n*c;u+=d>>>16;d&=65535;d+=o*a;u+=d>>>16;d&=65535;u+=r*c;l+=u>>>16;u&=65535;u+=n*a;l+=u>>>16;u&=65535;u+=o*s;l+=u>>>16;u&=65535;l+=t*c+r*a+n*s+o*i;l&=65535;return Long.fromBits(d<<16|p,l<<16|u)};Long.prototype.div=function(e){if(e.isZero()){throw Error("division by zero")}else if(this.isZero()){return Long.ZERO}if(this.equals(Long.MIN_VALUE)){if(e.equals(Long.ONE)||e.equals(Long.NEG_ONE)){return Long.MIN_VALUE}else if(e.equals(Long.MIN_VALUE)){return Long.ONE}else{var t=this.shiftRight(1);var r=t.div(e).shiftLeft(1);if(r.equals(Long.ZERO)){return e.isNegative()?Long.ONE:Long.NEG_ONE}else{var n=this.subtract(e.multiply(r));var o=r.add(n.div(e));return o}}}else if(e.equals(Long.MIN_VALUE)){return Long.ZERO}if(this.isNegative()){if(e.isNegative()){return this.negate().div(e.negate())}else{return this.negate().div(e).negate()}}else if(e.isNegative()){return this.div(e.negate()).negate()}var i=Long.ZERO;n=this;while(n.greaterThanOrEqual(e)){r=Math.max(1,Math.floor(n.toNumber()/e.toNumber()));var s=Math.ceil(Math.log(r)/Math.LN2);var a=s<=48?1:Math.pow(2,s-48);var c=Long.fromNumber(r);var l=c.multiply(e);while(l.isNegative()||l.greaterThan(n)){r-=a;c=Long.fromNumber(r);l=c.multiply(e)}if(c.isZero()){c=Long.ONE}i=i.add(c);n=n.subtract(l)}return i};Long.prototype.modulo=function(e){return this.subtract(this.div(e).multiply(e))};Long.prototype.not=function(){return Long.fromBits(~this.low_,~this.high_)};Long.prototype.and=function(e){return Long.fromBits(this.low_&e.low_,this.high_&e.high_)};Long.prototype.or=function(e){return Long.fromBits(this.low_|e.low_,this.high_|e.high_)};Long.prototype.xor=function(e){return Long.fromBits(this.low_^e.low_,this.high_^e.high_)};Long.prototype.shiftLeft=function(e){e&=63;if(e===0){return this}else{var t=this.low_;if(e<32){var r=this.high_;return Long.fromBits(t<>>32-e)}else{return Long.fromBits(0,t<>>e|t<<32-e,t>>e)}else{return Long.fromBits(t>>e-32,t>=0?0:-1)}}};Long.prototype.shiftRightUnsigned=function(e){e&=63;if(e===0){return this}else{var t=this.high_;if(e<32){var r=this.low_;return Long.fromBits(r>>>e|t<<32-e,t>>>e)}else if(e===32){return Long.fromBits(t,0)}else{return Long.fromBits(t>>>e-32,0)}}};Long.fromInt=function(e){if(-128<=e&&e<128){var t=Long.INT_CACHE_[e];if(t){return t}}var r=new Long(e|0,e<0?-1:0);if(-128<=e&&e<128){Long.INT_CACHE_[e]=r}return r};Long.fromNumber=function(e){if(isNaN(e)||!isFinite(e)){return Long.ZERO}else if(e<=-Long.TWO_PWR_63_DBL_){return Long.MIN_VALUE}else if(e+1>=Long.TWO_PWR_63_DBL_){return Long.MAX_VALUE}else if(e<0){return Long.fromNumber(-e).negate()}else{return new Long(e%Long.TWO_PWR_32_DBL_|0,e/Long.TWO_PWR_32_DBL_|0)}};Long.fromBigInt=function(e){return Long.fromString(e.toString(10),10)};Long.fromBits=function(e,t){return new Long(e,t)};Long.fromString=function(e,t){if(e.length===0){throw Error("number format error: empty string")}var r=t||10;if(r<2||36=0){throw Error('number format error: interior "-" character: '+e)}var n=Long.fromNumber(Math.pow(r,8));var o=Long.ZERO;for(var i=0;i{"use strict";if(typeof global.Map!=="undefined"){e.exports=global.Map;e.exports.Map=global.Map}else{var Map=function(e){this._keys=[];this._values={};for(var t=0;t{function MaxKey(){if(!(this instanceof MaxKey))return new MaxKey;this._bsontype="MaxKey"}e.exports=MaxKey;e.exports.MaxKey=MaxKey},5325:e=>{function MinKey(){if(!(this instanceof MinKey))return new MinKey;this._bsontype="MinKey"}e.exports=MinKey;e.exports.MinKey=MinKey},9502:(e,t,r)=>{var n="inspect";var o=r(2863);var i=parseInt(Math.random()*16777215,10);var s=new RegExp("^[0-9a-fA-F]{24}$");try{if(Buffer&&Buffer.from){var a=true;n=r(1669).inspect.custom||"inspect"}}catch(e){a=false}var c=function ObjectID(e){if(e instanceof ObjectID)return e;if(!(this instanceof ObjectID))return new ObjectID(e);this._bsontype="ObjectID";if(e==null||typeof e==="number"){this.id=this.generate(e);if(ObjectID.cacheHexString)this.__id=this.toString("hex");return}var t=ObjectID.isValid(e);if(!t&&e!=null){throw new Error("Argument passed in must be a single String of 12 bytes or a string of 24 hex characters")}else if(t&&typeof e==="string"&&e.length===24&&a){return new ObjectID(o.toBuffer(e,"hex"))}else if(t&&typeof e==="string"&&e.length===24){return ObjectID.createFromHexString(e)}else if(e!=null&&e.length===12){this.id=e}else if(e!=null&&typeof e.toHexString==="function"){return e}else{throw new Error("Argument passed in must be a single String of 12 bytes or a string of 24 hex characters")}if(ObjectID.cacheHexString)this.__id=this.toString("hex")};var l=[];for(var u=0;u<256;u++){l[u]=(u<=15?"0":"")+u.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){e=convertToHex(this.id);if(c.cacheHexString)this.__id=e;return e}for(var t=0;t>8&255;n[1]=e>>16&255;n[0]=e>>24&255;n[6]=i&255;n[5]=i>>8&255;n[4]=i>>16&255;n[8]=t&255;n[7]=t>>8&255;n[11]=r&255;n[10]=r>>8&255;n[9]=r>>16&255;return n};c.prototype.toString=function(e){if(this.id&&this.id.copy){return this.id.toString(typeof e==="string"?e:"hex")}return this.toHexString()};c.prototype[n]=c.prototype.toString;c.prototype.toJSON=function(){return this.toHexString()};c.prototype.equals=function equals(e){if(e instanceof c){return this.toString()===e.toString()}else if(typeof e==="string"&&c.isValid(e)&&e.length===12&&this.id instanceof p){return e===this.id.toString("binary")}else if(typeof e==="string"&&c.isValid(e)&&e.length===24){return e.toLowerCase()===this.toHexString()}else if(typeof e==="string"&&c.isValid(e)&&e.length===12){return e===this.id}else if(e!=null&&(e instanceof c||e.toHexString)){return e.toHexString()===this.toHexString()}else{return false}};c.prototype.getTimestamp=function(){var e=new Date;var t=this.id[3]|this.id[2]<<8|this.id[1]<<16|this.id[0]<<24;e.setTime(Math.floor(t)*1e3);return e};c.index=~~(Math.random()*16777215);c.createPk=function createPk(){return new c};c.createFromTime=function createFromTime(e){var t=o.toBuffer([0,0,0,0,0,0,0,0,0,0,0,0]);t[3]=e&255;t[2]=e>>8&255;t[1]=e>>16&255;t[0]=e>>24&255;return new c(t)};var d=[];u=0;while(u<10)d[48+u]=u++;while(u<16)d[65-10+u]=d[97-10+u]=u++;var p=Buffer;var convertToHex=function(e){return e.toString("hex")};c.createFromHexString=function createFromHexString(e){if(typeof e==="undefined"||e!=null&&e.length!==24){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"));var t=new p(12);var r=0;var n=0;while(n<24){t[r++]=d[e.charCodeAt(n++)]<<4|d[e.charCodeAt(n++)]}return new c(t)};c.isValid=function isValid(e){if(e==null)return false;if(typeof e==="number"){return true}if(typeof e==="string"){return e.length===12||e.length===24&&s.test(e)}if(e instanceof c){return true}if(e instanceof p){return true}if(typeof e.toHexString==="function"&&(e.id instanceof p||typeof e.id==="string")){return e.id.length===12||e.id.length===24&&s.test(e.id)}return false};Object.defineProperty(c.prototype,"generationTime",{enumerable:true,get:function(){return this.id[3]|this.id[2]<<8|this.id[1]<<16|this.id[0]<<24},set:function(e){this.id[3]=e&255;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},1273:(e,t,r)=>{"use strict";var n=r(8522).Long,o=r(972).Double,i=r(1031).Timestamp,s=r(9502).ObjectID,a=r(2259).Symbol,c=r(4636).BSONRegExp,l=r(7113).Code,u=r(414),d=r(5325).MinKey,p=r(5846).MaxKey,h=r(3797).DBRef,m=r(5497).Binary;var g=r(2863).normalizedFunctionString;var y=function isDate(e){return typeof e==="object"&&Object.prototype.toString.call(e)==="[object Date]"};var v=function calculateObjectSize(e,t,r){var n=4+1;if(Array.isArray(e)){for(var o=0;o=b.JS_INT_MIN&&t<=b.JS_INT_MAX){if(t>=b.BSON_INT32_MIN&&t<=b.BSON_INT32_MAX){return(e!=null?Buffer.byteLength(e,"utf8")+1:0)+(4+1)}else{return(e!=null?Buffer.byteLength(e,"utf8")+1:0)+(8+1)}}else{return(e!=null?Buffer.byteLength(e,"utf8")+1:0)+(8+1)}case"undefined":if(S||!w)return(e!=null?Buffer.byteLength(e,"utf8")+1:0)+1;return 0;case"boolean":return(e!=null?Buffer.byteLength(e,"utf8")+1:0)+(1+1);case"object":if(t==null||t instanceof d||t instanceof p||t["_bsontype"]==="MinKey"||t["_bsontype"]==="MaxKey"){return(e!=null?Buffer.byteLength(e,"utf8")+1:0)+1}else if(t instanceof s||t["_bsontype"]==="ObjectID"||t["_bsontype"]==="ObjectId"){return(e!=null?Buffer.byteLength(e,"utf8")+1:0)+(12+1)}else if(t instanceof Date||y(t)){return(e!=null?Buffer.byteLength(e,"utf8")+1:0)+(8+1)}else if(typeof Buffer!=="undefined"&&Buffer.isBuffer(t)){return(e!=null?Buffer.byteLength(e,"utf8")+1:0)+(1+4+1)+t.length}else if(t instanceof n||t instanceof o||t instanceof i||t["_bsontype"]==="Long"||t["_bsontype"]==="Double"||t["_bsontype"]==="Timestamp"){return(e!=null?Buffer.byteLength(e,"utf8")+1:0)+(8+1)}else if(t instanceof u||t["_bsontype"]==="Decimal128"){return(e!=null?Buffer.byteLength(e,"utf8")+1:0)+(16+1)}else if(t instanceof l||t["_bsontype"]==="Code"){if(t.scope!=null&&Object.keys(t.scope).length>0){return(e!=null?Buffer.byteLength(e,"utf8")+1:0)+1+4+4+Buffer.byteLength(t.code.toString(),"utf8")+1+v(t.scope,r,w)}else{return(e!=null?Buffer.byteLength(e,"utf8")+1:0)+1+4+Buffer.byteLength(t.code.toString(),"utf8")+1}}else if(t instanceof m||t["_bsontype"]==="Binary"){if(t.sub_type===m.SUBTYPE_BYTE_ARRAY){return(e!=null?Buffer.byteLength(e,"utf8")+1:0)+(t.position+1+4+1+4)}else{return(e!=null?Buffer.byteLength(e,"utf8")+1:0)+(t.position+1+4+1)}}else if(t instanceof a||t["_bsontype"]==="Symbol"){return(e!=null?Buffer.byteLength(e,"utf8")+1:0)+Buffer.byteLength(t.value,"utf8")+4+1+1}else if(t instanceof h||t["_bsontype"]==="DBRef"){var E={$ref:t.namespace,$id:t.oid};if(null!=t.db){E["$db"]=t.db}return(e!=null?Buffer.byteLength(e,"utf8")+1:0)+1+v(E,r,w)}else if(t instanceof RegExp||Object.prototype.toString.call(t)==="[object RegExp]"){return(e!=null?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}else if(t instanceof c||t["_bsontype"]==="BSONRegExp"){return(e!=null?Buffer.byteLength(e,"utf8")+1:0)+1+Buffer.byteLength(t.pattern,"utf8")+1+Buffer.byteLength(t.options,"utf8")+1}else{return(e!=null?Buffer.byteLength(e,"utf8")+1:0)+v(t,r,w)+1}case"function":if(t instanceof RegExp||Object.prototype.toString.call(t)==="[object RegExp]"||String.call(t)==="[object RegExp]"){return(e!=null?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}else{if(r&&t.scope!=null&&Object.keys(t.scope).length>0){return(e!=null?Buffer.byteLength(e,"utf8")+1:0)+1+4+4+Buffer.byteLength(g(t),"utf8")+1+v(t.scope,r,w)}else if(r){return(e!=null?Buffer.byteLength(e,"utf8")+1:0)+1+4+Buffer.byteLength(g(t),"utf8")+1}}}return 0}var b={};b.BSON_INT32_MAX=2147483647;b.BSON_INT32_MIN=-2147483648;b.JS_INT_MAX=9007199254740992;b.JS_INT_MIN=-9007199254740992;e.exports=v},2139:(module,__unused_webpack_exports,__nccwpck_require__)=>{"use strict";var Long=__nccwpck_require__(8522).Long,Double=__nccwpck_require__(972).Double,Timestamp=__nccwpck_require__(1031).Timestamp,ObjectID=__nccwpck_require__(9502).ObjectID,Symbol=__nccwpck_require__(2259).Symbol,Code=__nccwpck_require__(7113).Code,MinKey=__nccwpck_require__(5325).MinKey,MaxKey=__nccwpck_require__(5846).MaxKey,Decimal128=__nccwpck_require__(414),Int32=__nccwpck_require__(6142),DBRef=__nccwpck_require__(3797).DBRef,BSONRegExp=__nccwpck_require__(4636).BSONRegExp,Binary=__nccwpck_require__(5497).Binary;var utils=__nccwpck_require__(2863);var deserialize=function(e,t,r){t=t==null?{}:t;var n=t&&t.index?t.index:0;var o=e[n]|e[n+1]<<8|e[n+2]<<16|e[n+3]<<24;if(o<5||e.lengthe.length){throw new Error("corrupt bson message")}if(e[n+o-1]!==0){throw new Error("One object, sized correctly, with a spot for an EOO, but the EOO isn't 0x00")}return deserializeObject(e,n,t,r)};var deserializeObject=function(e,t,r,n){var o=r["evalFunctions"]==null?false:r["evalFunctions"];var i=r["cacheFunctions"]==null?false:r["cacheFunctions"];var s=r["cacheFunctionsCrc32"]==null?false:r["cacheFunctionsCrc32"];if(!s)var a=null;var c=r["fieldsAsRaw"]==null?null:r["fieldsAsRaw"];var l=r["raw"]==null?false:r["raw"];var u=typeof r["bsonRegExp"]==="boolean"?r["bsonRegExp"]:false;var d=r["promoteBuffers"]==null?false:r["promoteBuffers"];var p=r["promoteLongs"]==null?true:r["promoteLongs"];var h=r["promoteValues"]==null?true:r["promoteValues"];var m=t;if(e.length<5)throw new Error("corrupt bson message < 5 bytes long");var g=e[t++]|e[t++]<<8|e[t++]<<16|e[t++]<<24;if(g<5||g>e.length)throw new Error("corrupt bson message");var y=n?[]:{};var v=0;var b=false;while(!b){var S=e[t++];if(S===0)break;var w=t;while(e[w]!==0&&w=e.length)throw new Error("Bad BSON Document: illegal CString");var E=n?v++:e.toString("utf8",t,w);t=w+1;if(S===BSON.BSON_DATA_STRING){var _=e[t++]|e[t++]<<8|e[t++]<<16|e[t++]<<24;if(_<=0||_>e.length-t||e[t+_-1]!==0)throw new Error("bad string length in bson");y[E]=e.toString("utf8",t,t+_-1);t=t+_}else if(S===BSON.BSON_DATA_OID){var O=utils.allocBuffer(12);e.copy(O,0,t,t+12);y[E]=new ObjectID(O);t=t+12}else if(S===BSON.BSON_DATA_INT&&h===false){y[E]=new Int32(e[t++]|e[t++]<<8|e[t++]<<16|e[t++]<<24)}else if(S===BSON.BSON_DATA_INT){y[E]=e[t++]|e[t++]<<8|e[t++]<<16|e[t++]<<24}else if(S===BSON.BSON_DATA_NUMBER&&h===false){y[E]=new Double(e.readDoubleLE(t));t=t+8}else if(S===BSON.BSON_DATA_NUMBER){y[E]=e.readDoubleLE(t);t=t+8}else if(S===BSON.BSON_DATA_DATE){var C=e[t++]|e[t++]<<8|e[t++]<<16|e[t++]<<24;var T=e[t++]|e[t++]<<8|e[t++]<<16|e[t++]<<24;y[E]=new Date(new Long(C,T).toNumber())}else if(S===BSON.BSON_DATA_BOOLEAN){if(e[t]!==0&&e[t]!==1)throw new Error("illegal boolean type value");y[E]=e[t++]===1}else if(S===BSON.BSON_DATA_OBJECT){var I=t;var k=e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24;if(k<=0||k>e.length-t)throw new Error("bad embedded document length in bson");if(l){y[E]=e.slice(t,t+k)}else{y[E]=deserializeObject(e,I,r,false)}t=t+k}else if(S===BSON.BSON_DATA_ARRAY){I=t;k=e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24;var A=r;var R=t+k;if(c&&c[E]){A={};for(var N in r)A[N]=r[N];A["raw"]=true}y[E]=deserializeObject(e,I,A,true);t=t+k;if(e[t-1]!==0)throw new Error("invalid array terminator byte");if(t!==R)throw new Error("corrupted array bson")}else if(S===BSON.BSON_DATA_UNDEFINED){y[E]=undefined}else if(S===BSON.BSON_DATA_NULL){y[E]=null}else if(S===BSON.BSON_DATA_LONG){C=e[t++]|e[t++]<<8|e[t++]<<16|e[t++]<<24;T=e[t++]|e[t++]<<8|e[t++]<<16|e[t++]<<24;var M=new Long(C,T);if(p&&h===true){y[E]=M.lessThanOrEqual(JS_INT_MAX_LONG)&&M.greaterThanOrEqual(JS_INT_MIN_LONG)?M.toNumber():M}else{y[E]=M}}else if(S===BSON.BSON_DATA_DECIMAL128){var D=utils.allocBuffer(16);e.copy(D,0,t,t+16);t=t+16;var P=new Decimal128(D);y[E]=P.toObject?P.toObject():P}else if(S===BSON.BSON_DATA_BINARY){var L=e[t++]|e[t++]<<8|e[t++]<<16|e[t++]<<24;var B=L;var j=e[t++];if(L<0)throw new Error("Negative binary type element size found");if(L>e.length)throw new Error("Binary type size larger than document size");if(e["slice"]!=null){if(j===Binary.SUBTYPE_BYTE_ARRAY){L=e[t++]|e[t++]<<8|e[t++]<<16|e[t++]<<24;if(L<0)throw new Error("Negative binary type element size found for subtype 0x02");if(L>B-4)throw new Error("Binary type with subtype 0x02 contains to long binary size");if(LB-4)throw new Error("Binary type with subtype 0x02 contains to long binary size");if(L=e.length)throw new Error("Bad BSON Document: illegal CString");var F=e.toString("utf8",t,w);t=w+1;w=t;while(e[w]!==0&&w=e.length)throw new Error("Bad BSON Document: illegal CString");var W=e.toString("utf8",t,w);t=w+1;var $=new Array(W.length);for(w=0;w=e.length)throw new Error("Bad BSON Document: illegal CString");F=e.toString("utf8",t,w);t=w+1;w=t;while(e[w]!==0&&w=e.length)throw new Error("Bad BSON Document: illegal CString");W=e.toString("utf8",t,w);t=w+1;y[E]=new BSONRegExp(F,W)}else if(S===BSON.BSON_DATA_SYMBOL){_=e[t++]|e[t++]<<8|e[t++]<<16|e[t++]<<24;if(_<=0||_>e.length-t||e[t+_-1]!==0)throw new Error("bad string length in bson");y[E]=new Symbol(e.toString("utf8",t,t+_-1));t=t+_}else if(S===BSON.BSON_DATA_TIMESTAMP){C=e[t++]|e[t++]<<8|e[t++]<<16|e[t++]<<24;T=e[t++]|e[t++]<<8|e[t++]<<16|e[t++]<<24;y[E]=new Timestamp(C,T)}else if(S===BSON.BSON_DATA_MIN_KEY){y[E]=new MinKey}else if(S===BSON.BSON_DATA_MAX_KEY){y[E]=new MaxKey}else if(S===BSON.BSON_DATA_CODE){_=e[t++]|e[t++]<<8|e[t++]<<16|e[t++]<<24;if(_<=0||_>e.length-t||e[t+_-1]!==0)throw new Error("bad string length in bson");var z=e.toString("utf8",t,t+_-1);if(o){if(i){var q=s?a(z):z;y[E]=isolateEvalWithHash(functionCache,q,z,y)}else{y[E]=isolateEval(z)}}else{y[E]=new Code(z)}t=t+_}else if(S===BSON.BSON_DATA_CODE_W_SCOPE){var V=e[t++]|e[t++]<<8|e[t++]<<16|e[t++]<<24;if(V<4+4+4+1){throw new Error("code_w_scope total size shorter minimum expected length")}_=e[t++]|e[t++]<<8|e[t++]<<16|e[t++]<<24;if(_<=0||_>e.length-t||e[t+_-1]!==0)throw new Error("bad string length in bson");z=e.toString("utf8",t,t+_-1);t=t+_;I=t;k=e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24;var G=deserializeObject(e,I,r,false);t=t+k;if(V<4+4+k+_){throw new Error("code_w_scope total size is to short, truncating scope")}if(V>4+4+k+_){throw new Error("code_w_scope total size is to long, clips outer document")}if(o){if(i){q=s?a(z):z;y[E]=isolateEvalWithHash(functionCache,q,z,y)}else{y[E]=isolateEval(z)}y[E].scope=G}else{y[E]=new Code(z,G)}}else if(S===BSON.BSON_DATA_DBPOINTER){_=e[t++]|e[t++]<<8|e[t++]<<16|e[t++]<<24;if(_<=0||_>e.length-t||e[t+_-1]!==0)throw new Error("bad string length in bson");var K=e.toString("utf8",t,t+_-1);t=t+_;var Y=utils.allocBuffer(12);e.copy(Y,0,t,t+12);O=new ObjectID(Y);t=t+12;var X=K.split(".");var J=X.shift();var Z=X.join(".");y[E]=new DBRef(Z,O,J)}else{throw new Error("Detected unknown BSON type "+S.toString(16)+' for fieldname "'+E+'", are you using the latest BSON parser')}}if(g!==t-m){if(n)throw new Error("corrupt array bson");throw new Error("corrupt object bson")}if(y["$id"]!=null)y=new DBRef(y["$ref"],y["$id"],y["$db"]);return y};var isolateEvalWithHash=function(functionCache,hash,functionString,object){var value=null;if(functionCache[hash]==null){eval("value = "+functionString);functionCache[hash]=value}return functionCache[hash].bind(object)};var isolateEval=function(functionString){var value=null;eval("value = "+functionString);return value};var BSON={};var 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);var JS_INT_MIN_LONG=Long.fromNumber(-9007199254740992);module.exports=deserialize},9290:(e,t,r)=>{"use strict";var n=r(7998).P,o=r(8522).Long,i=r(3639),s=r(5497).Binary;var a=r(2863).normalizedFunctionString;var c=/\x00/;var l=["$db","$ref","$id","$clusterTime"];var u=function isDate(e){return typeof e==="object"&&Object.prototype.toString.call(e)==="[object Date]"};var d=function isRegExp(e){return Object.prototype.toString.call(e)==="[object RegExp]"};var serializeString=function(e,t,r,n,o){e[n++]=h.BSON_DATA_STRING;var i=!o?e.write(t,n,"utf8"):e.write(t,n,"ascii");n=n+i+1;e[n-1]=0;var s=e.write(r,n+4,"utf8");e[n+3]=s+1>>24&255;e[n+2]=s+1>>16&255;e[n+1]=s+1>>8&255;e[n]=s+1&255;n=n+4+s;e[n++]=0;return n};var serializeNumber=function(e,t,r,i,s){if(Math.floor(r)===r&&r>=h.JS_INT_MIN&&r<=h.JS_INT_MAX){if(r>=h.BSON_INT32_MIN&&r<=h.BSON_INT32_MAX){e[i++]=h.BSON_DATA_INT;var a=!s?e.write(t,i,"utf8"):e.write(t,i,"ascii");i=i+a;e[i++]=0;e[i++]=r&255;e[i++]=r>>8&255;e[i++]=r>>16&255;e[i++]=r>>24&255}else if(r>=h.JS_INT_MIN&&r<=h.JS_INT_MAX){e[i++]=h.BSON_DATA_NUMBER;a=!s?e.write(t,i,"utf8"):e.write(t,i,"ascii");i=i+a;e[i++]=0;n(e,r,i,"little",52,8);i=i+8}else{e[i++]=h.BSON_DATA_LONG;a=!s?e.write(t,i,"utf8"):e.write(t,i,"ascii");i=i+a;e[i++]=0;var c=o.fromNumber(r);var l=c.getLowBits();var u=c.getHighBits();e[i++]=l&255;e[i++]=l>>8&255;e[i++]=l>>16&255;e[i++]=l>>24&255;e[i++]=u&255;e[i++]=u>>8&255;e[i++]=u>>16&255;e[i++]=u>>24&255}}else{e[i++]=h.BSON_DATA_NUMBER;a=!s?e.write(t,i,"utf8"):e.write(t,i,"ascii");i=i+a;e[i++]=0;n(e,r,i,"little",52,8);i=i+8}return i};var serializeNull=function(e,t,r,n,o){e[n++]=h.BSON_DATA_NULL;var i=!o?e.write(t,n,"utf8"):e.write(t,n,"ascii");n=n+i;e[n++]=0;return n};var serializeBoolean=function(e,t,r,n,o){e[n++]=h.BSON_DATA_BOOLEAN;var i=!o?e.write(t,n,"utf8"):e.write(t,n,"ascii");n=n+i;e[n++]=0;e[n++]=r?1:0;return n};var serializeDate=function(e,t,r,n,i){e[n++]=h.BSON_DATA_DATE;var s=!i?e.write(t,n,"utf8"):e.write(t,n,"ascii");n=n+s;e[n++]=0;var a=o.fromNumber(r.getTime());var c=a.getLowBits();var l=a.getHighBits();e[n++]=c&255;e[n++]=c>>8&255;e[n++]=c>>16&255;e[n++]=c>>24&255;e[n++]=l&255;e[n++]=l>>8&255;e[n++]=l>>16&255;e[n++]=l>>24&255;return n};var serializeRegExp=function(e,t,r,n,o){e[n++]=h.BSON_DATA_REGEXP;var i=!o?e.write(t,n,"utf8"):e.write(t,n,"ascii");n=n+i;e[n++]=0;if(r.source&&r.source.match(c)!=null){throw Error("value "+r.source+" must not contain null bytes")}n=n+e.write(r.source,n,"utf8");e[n++]=0;if(r.global)e[n++]=115;if(r.ignoreCase)e[n++]=105;if(r.multiline)e[n++]=109;e[n++]=0;return n};var serializeBSONRegExp=function(e,t,r,n,o){e[n++]=h.BSON_DATA_REGEXP;var i=!o?e.write(t,n,"utf8"):e.write(t,n,"ascii");n=n+i;e[n++]=0;if(r.pattern.match(c)!=null){throw Error("pattern "+r.pattern+" must not contain null bytes")}n=n+e.write(r.pattern,n,"utf8");e[n++]=0;n=n+e.write(r.options.split("").sort().join(""),n,"utf8");e[n++]=0;return n};var serializeMinMax=function(e,t,r,n,o){if(r===null){e[n++]=h.BSON_DATA_NULL}else if(r._bsontype==="MinKey"){e[n++]=h.BSON_DATA_MIN_KEY}else{e[n++]=h.BSON_DATA_MAX_KEY}var i=!o?e.write(t,n,"utf8"):e.write(t,n,"ascii");n=n+i;e[n++]=0;return n};var serializeObjectId=function(e,t,r,n,o){e[n++]=h.BSON_DATA_OID;var i=!o?e.write(t,n,"utf8"):e.write(t,n,"ascii");n=n+i;e[n++]=0;if(typeof r.id==="string"){e.write(r.id,n,"binary")}else if(r.id&&r.id.copy){r.id.copy(e,n,0,12)}else{throw new Error("object ["+JSON.stringify(r)+"] is not a valid ObjectId")}return n+12};var serializeBuffer=function(e,t,r,n,o){e[n++]=h.BSON_DATA_BINARY;var i=!o?e.write(t,n,"utf8"):e.write(t,n,"ascii");n=n+i;e[n++]=0;var s=r.length;e[n++]=s&255;e[n++]=s>>8&255;e[n++]=s>>16&255;e[n++]=s>>24&255;e[n++]=h.BSON_BINARY_SUBTYPE_DEFAULT;r.copy(e,n,0,s);n=n+s;return n};var serializeObject=function(e,t,r,n,o,i,s,a,c,l){for(var u=0;u>8&255;e[n++]=s>>16&255;e[n++]=s>>24&255;e[n++]=a&255;e[n++]=a>>8&255;e[n++]=a>>16&255;e[n++]=a>>24&255;return n};var serializeInt32=function(e,t,r,n,o){e[n++]=h.BSON_DATA_INT;var i=!o?e.write(t,n,"utf8"):e.write(t,n,"ascii");n=n+i;e[n++]=0;e[n++]=r&255;e[n++]=r>>8&255;e[n++]=r>>16&255;e[n++]=r>>24&255;return n};var serializeDouble=function(e,t,r,o,i){e[o++]=h.BSON_DATA_NUMBER;var s=!i?e.write(t,o,"utf8"):e.write(t,o,"ascii");o=o+s;e[o++]=0;n(e,r,o,"little",52,8);o=o+8;return o};var serializeFunction=function(e,t,r,n,o,i,s){e[n++]=h.BSON_DATA_CODE;var c=!s?e.write(t,n,"utf8"):e.write(t,n,"ascii");n=n+c;e[n++]=0;var l=a(r);var u=e.write(l,n+4,"utf8")+1;e[n]=u&255;e[n+1]=u>>8&255;e[n+2]=u>>16&255;e[n+3]=u>>24&255;n=n+4+u-1;e[n++]=0;return n};var serializeCode=function(e,t,r,n,o,i,s,a,c){if(r.scope&&typeof r.scope==="object"){e[n++]=h.BSON_DATA_CODE_W_SCOPE;var l=!c?e.write(t,n,"utf8"):e.write(t,n,"ascii");n=n+l;e[n++]=0;var u=n;var d=typeof r.code==="string"?r.code:r.code.toString();n=n+4;var m=e.write(d,n+4,"utf8")+1;e[n]=m&255;e[n+1]=m>>8&255;e[n+2]=m>>16&255;e[n+3]=m>>24&255;e[n+4+m-1]=0;n=n+m+4;var g=p(e,r.scope,o,n,i+1,s,a);n=g-1;var y=g-u;e[u++]=y&255;e[u++]=y>>8&255;e[u++]=y>>16&255;e[u++]=y>>24&255;e[n++]=0}else{e[n++]=h.BSON_DATA_CODE;l=!c?e.write(t,n,"utf8"):e.write(t,n,"ascii");n=n+l;e[n++]=0;d=r.code.toString();var v=e.write(d,n+4,"utf8")+1;e[n]=v&255;e[n+1]=v>>8&255;e[n+2]=v>>16&255;e[n+3]=v>>24&255;n=n+4+v-1;e[n++]=0}return n};var serializeBinary=function(e,t,r,n,o){e[n++]=h.BSON_DATA_BINARY;var i=!o?e.write(t,n,"utf8"):e.write(t,n,"ascii");n=n+i;e[n++]=0;var a=r.value(true);var c=r.position;if(r.sub_type===s.SUBTYPE_BYTE_ARRAY)c=c+4;e[n++]=c&255;e[n++]=c>>8&255;e[n++]=c>>16&255;e[n++]=c>>24&255;e[n++]=r.sub_type;if(r.sub_type===s.SUBTYPE_BYTE_ARRAY){c=c-4;e[n++]=c&255;e[n++]=c>>8&255;e[n++]=c>>16&255;e[n++]=c>>24&255}a.copy(e,n,0,r.position);n=n+r.position;return n};var serializeSymbol=function(e,t,r,n,o){e[n++]=h.BSON_DATA_SYMBOL;var i=!o?e.write(t,n,"utf8"):e.write(t,n,"ascii");n=n+i;e[n++]=0;var s=e.write(r.value,n+4,"utf8")+1;e[n]=s&255;e[n+1]=s>>8&255;e[n+2]=s>>16&255;e[n+3]=s>>24&255;n=n+4+s-1;e[n++]=0;return n};var serializeDBRef=function(e,t,r,n,o,i,s){e[n++]=h.BSON_DATA_OBJECT;var a=!s?e.write(t,n,"utf8"):e.write(t,n,"ascii");n=n+a;e[n++]=0;var c=n;var l;if(null!=r.db){l=p(e,{$ref:r.namespace,$id:r.oid,$db:r.db},false,n,o+1,i)}else{l=p(e,{$ref:r.namespace,$id:r.oid},false,n,o+1,i)}var u=l-c;e[c++]=u&255;e[c++]=u>>8&255;e[c++]=u>>16&255;e[c++]=u>>24&255;return l};var p=function serializeInto(e,t,r,n,o,s,a,p){n=n||0;p=p||[];p.push(t);var h=n+4;if(Array.isArray(t)){for(var m=0;m>8&255;e[n++]=E>>16&255;e[n++]=E>>24&255;return h};var h={};h.BSON_DATA_NUMBER=1;h.BSON_DATA_STRING=2;h.BSON_DATA_OBJECT=3;h.BSON_DATA_ARRAY=4;h.BSON_DATA_BINARY=5;h.BSON_DATA_UNDEFINED=6;h.BSON_DATA_OID=7;h.BSON_DATA_BOOLEAN=8;h.BSON_DATA_DATE=9;h.BSON_DATA_NULL=10;h.BSON_DATA_REGEXP=11;h.BSON_DATA_CODE=13;h.BSON_DATA_SYMBOL=14;h.BSON_DATA_CODE_W_SCOPE=15;h.BSON_DATA_INT=16;h.BSON_DATA_TIMESTAMP=17;h.BSON_DATA_LONG=18;h.BSON_DATA_DECIMAL128=19;h.BSON_DATA_MIN_KEY=255;h.BSON_DATA_MAX_KEY=127;h.BSON_BINARY_SUBTYPE_DEFAULT=0;h.BSON_BINARY_SUBTYPE_FUNCTION=1;h.BSON_BINARY_SUBTYPE_BYTE_ARRAY=2;h.BSON_BINARY_SUBTYPE_UUID=3;h.BSON_BINARY_SUBTYPE_MD5=4;h.BSON_BINARY_SUBTYPE_USER_DEFINED=128;h.BSON_INT32_MAX=2147483647;h.BSON_INT32_MIN=-2147483648;h.BSON_INT64_MAX=Math.pow(2,63)-1;h.BSON_INT64_MIN=-Math.pow(2,63);h.JS_INT_MAX=9007199254740992;h.JS_INT_MIN=-9007199254740992;e.exports=p},2863:e=>{"use strict";function normalizedFunctionString(e){return e.toString().replace(/function *\(/,"function (")}function newBuffer(e,t){return new Buffer(e,t)}function allocBuffer(){return Buffer.alloc.apply(Buffer,arguments)}function toBuffer(){return Buffer.from.apply(Buffer,arguments)}e.exports={normalizedFunctionString:normalizedFunctionString,allocBuffer:typeof Buffer.alloc==="function"?allocBuffer:newBuffer,toBuffer:typeof Buffer.from==="function"?toBuffer:newBuffer}},4636:e=>{function BSONRegExp(e,t){if(!(this instanceof BSONRegExp))return new BSONRegExp;this._bsontype="BSONRegExp";this.pattern=e||"";this.options=t||"";for(var r=0;r{var n=Buffer?r(1669).inspect.custom||"inspect":"inspect";function Symbol(e){if(!(this instanceof Symbol))return new Symbol(e);this._bsontype="Symbol";this.value=e}Symbol.prototype.valueOf=function(){return this.value};Symbol.prototype.toString=function(){return this.value};Symbol.prototype[n]=function(){return this.value};Symbol.prototype.toJSON=function(){return this.value};e.exports=Symbol;e.exports.Symbol=Symbol},1031:e=>{function Timestamp(e,t){if(!(this instanceof Timestamp))return new Timestamp(e,t);this._bsontype="Timestamp";this.low_=e|0;this.high_=t|0}Timestamp.prototype.toInt=function(){return this.low_};Timestamp.prototype.toNumber=function(){return this.high_*Timestamp.TWO_PWR_32_DBL_+this.getLowBitsUnsigned()};Timestamp.prototype.toJSON=function(){return this.toString()};Timestamp.prototype.toString=function(e){var t=e||10;if(t<2||36=0?this.low_:Timestamp.TWO_PWR_32_DBL_+this.low_};Timestamp.prototype.getNumBitsAbs=function(){if(this.isNegative()){if(this.equals(Timestamp.MIN_VALUE)){return 64}else{return this.negate().getNumBitsAbs()}}else{var e=this.high_!==0?this.high_:this.low_;for(var t=31;t>0;t--){if((e&1<0};Timestamp.prototype.greaterThanOrEqual=function(e){return this.compare(e)>=0};Timestamp.prototype.compare=function(e){if(this.equals(e)){return 0}var t=this.isNegative();var r=e.isNegative();if(t&&!r){return-1}if(!t&&r){return 1}if(this.subtract(e).isNegative()){return-1}else{return 1}};Timestamp.prototype.negate=function(){if(this.equals(Timestamp.MIN_VALUE)){return Timestamp.MIN_VALUE}else{return this.not().add(Timestamp.ONE)}};Timestamp.prototype.add=function(e){var t=this.high_>>>16;var r=this.high_&65535;var n=this.low_>>>16;var o=this.low_&65535;var i=e.high_>>>16;var s=e.high_&65535;var a=e.low_>>>16;var c=e.low_&65535;var l=0,u=0,d=0,p=0;p+=o+c;d+=p>>>16;p&=65535;d+=n+a;u+=d>>>16;d&=65535;u+=r+s;l+=u>>>16;u&=65535;l+=t+i;l&=65535;return Timestamp.fromBits(d<<16|p,l<<16|u)};Timestamp.prototype.subtract=function(e){return this.add(e.negate())};Timestamp.prototype.multiply=function(e){if(this.isZero()){return Timestamp.ZERO}else if(e.isZero()){return Timestamp.ZERO}if(this.equals(Timestamp.MIN_VALUE)){return e.isOdd()?Timestamp.MIN_VALUE:Timestamp.ZERO}else if(e.equals(Timestamp.MIN_VALUE)){return this.isOdd()?Timestamp.MIN_VALUE:Timestamp.ZERO}if(this.isNegative()){if(e.isNegative()){return this.negate().multiply(e.negate())}else{return this.negate().multiply(e).negate()}}else if(e.isNegative()){return this.multiply(e.negate()).negate()}if(this.lessThan(Timestamp.TWO_PWR_24_)&&e.lessThan(Timestamp.TWO_PWR_24_)){return Timestamp.fromNumber(this.toNumber()*e.toNumber())}var t=this.high_>>>16;var r=this.high_&65535;var n=this.low_>>>16;var o=this.low_&65535;var i=e.high_>>>16;var s=e.high_&65535;var a=e.low_>>>16;var c=e.low_&65535;var l=0,u=0,d=0,p=0;p+=o*c;d+=p>>>16;p&=65535;d+=n*c;u+=d>>>16;d&=65535;d+=o*a;u+=d>>>16;d&=65535;u+=r*c;l+=u>>>16;u&=65535;u+=n*a;l+=u>>>16;u&=65535;u+=o*s;l+=u>>>16;u&=65535;l+=t*c+r*a+n*s+o*i;l&=65535;return Timestamp.fromBits(d<<16|p,l<<16|u)};Timestamp.prototype.div=function(e){if(e.isZero()){throw Error("division by zero")}else if(this.isZero()){return Timestamp.ZERO}if(this.equals(Timestamp.MIN_VALUE)){if(e.equals(Timestamp.ONE)||e.equals(Timestamp.NEG_ONE)){return Timestamp.MIN_VALUE}else if(e.equals(Timestamp.MIN_VALUE)){return Timestamp.ONE}else{var t=this.shiftRight(1);var r=t.div(e).shiftLeft(1);if(r.equals(Timestamp.ZERO)){return e.isNegative()?Timestamp.ONE:Timestamp.NEG_ONE}else{var n=this.subtract(e.multiply(r));var o=r.add(n.div(e));return o}}}else if(e.equals(Timestamp.MIN_VALUE)){return Timestamp.ZERO}if(this.isNegative()){if(e.isNegative()){return this.negate().div(e.negate())}else{return this.negate().div(e).negate()}}else if(e.isNegative()){return this.div(e.negate()).negate()}var i=Timestamp.ZERO;n=this;while(n.greaterThanOrEqual(e)){r=Math.max(1,Math.floor(n.toNumber()/e.toNumber()));var s=Math.ceil(Math.log(r)/Math.LN2);var a=s<=48?1:Math.pow(2,s-48);var c=Timestamp.fromNumber(r);var l=c.multiply(e);while(l.isNegative()||l.greaterThan(n)){r-=a;c=Timestamp.fromNumber(r);l=c.multiply(e)}if(c.isZero()){c=Timestamp.ONE}i=i.add(c);n=n.subtract(l)}return i};Timestamp.prototype.modulo=function(e){return this.subtract(this.div(e).multiply(e))};Timestamp.prototype.not=function(){return Timestamp.fromBits(~this.low_,~this.high_)};Timestamp.prototype.and=function(e){return Timestamp.fromBits(this.low_&e.low_,this.high_&e.high_)};Timestamp.prototype.or=function(e){return Timestamp.fromBits(this.low_|e.low_,this.high_|e.high_)};Timestamp.prototype.xor=function(e){return Timestamp.fromBits(this.low_^e.low_,this.high_^e.high_)};Timestamp.prototype.shiftLeft=function(e){e&=63;if(e===0){return this}else{var t=this.low_;if(e<32){var r=this.high_;return Timestamp.fromBits(t<>>32-e)}else{return Timestamp.fromBits(0,t<>>e|t<<32-e,t>>e)}else{return Timestamp.fromBits(t>>e-32,t>=0?0:-1)}}};Timestamp.prototype.shiftRightUnsigned=function(e){e&=63;if(e===0){return this}else{var t=this.high_;if(e<32){var r=this.low_;return Timestamp.fromBits(r>>>e|t<<32-e,t>>>e)}else if(e===32){return Timestamp.fromBits(t,0)}else{return Timestamp.fromBits(t>>>e-32,0)}}};Timestamp.fromInt=function(e){if(-128<=e&&e<128){var t=Timestamp.INT_CACHE_[e];if(t){return t}}var r=new Timestamp(e|0,e<0?-1:0);if(-128<=e&&e<128){Timestamp.INT_CACHE_[e]=r}return r};Timestamp.fromNumber=function(e){if(isNaN(e)||!isFinite(e)){return Timestamp.ZERO}else if(e<=-Timestamp.TWO_PWR_63_DBL_){return Timestamp.MIN_VALUE}else if(e+1>=Timestamp.TWO_PWR_63_DBL_){return Timestamp.MAX_VALUE}else if(e<0){return Timestamp.fromNumber(-e).negate()}else{return new Timestamp(e%Timestamp.TWO_PWR_32_DBL_|0,e/Timestamp.TWO_PWR_32_DBL_|0)}};Timestamp.fromBits=function(e,t){return new Timestamp(e,t)};Timestamp.fromString=function(e,t){if(e.length===0){throw Error("number format error: empty string")}var r=t||10;if(r<2||36=0){throw Error('number format error: interior "-" character: '+e)}var n=Timestamp.fromNumber(Math.pow(r,8));var o=Timestamp.ZERO;for(var i=0;i{var n=r(4293).Buffer;var o=[0,1996959894,3993919788,2567524794,124634137,1886057615,3915621685,2657392035,249268274,2044508324,3772115230,2547177864,162941995,2125561021,3887607047,2428444049,498536548,1789927666,4089016648,2227061214,450548861,1843258603,4107580753,2211677639,325883990,1684777152,4251122042,2321926636,335633487,1661365465,4195302755,2366115317,997073096,1281953886,3579855332,2724688242,1006888145,1258607687,3524101629,2768942443,901097722,1119000684,3686517206,2898065728,853044451,1172266101,3705015759,2882616665,651767980,1373503546,3369554304,3218104598,565507253,1454621731,3485111705,3099436303,671266974,1594198024,3322730930,2970347812,795835527,1483230225,3244367275,3060149565,1994146192,31158534,2563907772,4023717930,1907459465,112637215,2680153253,3904427059,2013776290,251722036,2517215374,3775830040,2137656763,141376813,2439277719,3865271297,1802195444,476864866,2238001368,4066508878,1812370925,453092731,2181625025,4111451223,1706088902,314042704,2344532202,4240017532,1658658271,366619977,2362670323,4224994405,1303535960,984961486,2747007092,3569037538,1256170817,1037604311,2765210733,3554079995,1131014506,879679996,2909243462,3663771856,1141124467,855842277,2852801631,3708648649,1342533948,654459306,3188396048,3373015174,1466479909,544179635,3110523913,3462522015,1591671054,702138776,2966460450,3352799412,1504918807,783551873,3082640443,3233442989,3988292384,2596254646,62317068,1957810842,3939845945,2647816111,81470997,1943803523,3814918930,2489596804,225274430,2053790376,3826175755,2466906013,167816743,2097651377,4027552580,2265490386,503444072,1762050814,4150417245,2154129355,426522225,1852507879,4275313526,2312317920,282753626,1742555852,4189708143,2394877945,397917763,1622183637,3604390888,2714866558,953729732,1340076626,3518719985,2797360999,1068828381,1219638859,3624741850,2936675148,906185462,1090812512,3747672003,2825379669,829329135,1181335161,3412177804,3160834842,628085408,1382605366,3423369109,3138078467,570562233,1426400815,3317316542,2998733608,733239954,1555261956,3268935591,3050360625,752459403,1541320221,2607071920,3965973030,1969922972,40735498,2617837225,3943577151,1913087877,83908371,2512341634,3803740692,2075208622,213261112,2463272603,3855990285,2094854071,198958881,2262029012,4057260610,1759359992,534414190,2176718541,4139329115,1873836001,414664567,2282248934,4279200368,1711684554,285281116,2405801727,4167216745,1634467795,376229701,2685067896,3608007406,1308918612,956543938,2808555105,3495958263,1231636301,1047427035,2932959818,3654703836,1088359270,936918e3,2847714899,3736837829,1202900863,817233897,3183342108,3401237130,1404277552,615818150,3134207493,3453421203,1423857449,601450431,3009837614,3294710456,1567103746,711928724,3020668471,3272380065,1510334235,755167117];if(typeof Int32Array!=="undefined"){o=new Int32Array(o)}function ensureBuffer(e){if(n.isBuffer(e)){return e}var t=typeof n.alloc==="function"&&typeof n.from==="function";if(typeof e==="number"){return t?n.alloc(e):new n(e)}else if(typeof e==="string"){return t?n.from(e):new n(e)}else{throw new Error("input must be buffer, number, or string, received "+typeof e)}}function bufferizeInt(e){var t=ensureBuffer(4);t.writeInt32BE(e,0);return t}function _crc32(e,t){e=ensureBuffer(e);if(n.isBuffer(t)){t=t.readUInt32BE(0)}var r=~~t^-1;for(var i=0;i>>8}return r^-1}function crc32(){return bufferizeInt(_crc32.apply(null,arguments))}crc32.signed=function(){return _crc32.apply(null,arguments)};crc32.unsigned=function(){return _crc32.apply(null,arguments)>>>0};e.exports=crc32},1362:e=>{"use strict";const t=/[\p{Lu}]/u;const r=/[\p{Ll}]/u;const n=/^[\p{Lu}](?![\p{Lu}])/gu;const o=/([\p{Alpha}\p{N}_]|$)/u;const i=/[_.\- ]+/;const s=new RegExp("^"+i.source);const a=new RegExp(i.source+o.source,"gu");const c=new RegExp("\\d+"+o.source,"gu");const preserveCamelCase=(e,n,o)=>{let i=false;let s=false;let a=false;for(let c=0;c{n.lastIndex=0;return e.replace(n,(e=>t(e)))};const postProcess=(e,t)=>{a.lastIndex=0;c.lastIndex=0;return e.replace(a,((e,r)=>t(r))).replace(c,(e=>t(e)))};const camelCase=(e,t)=>{if(!(typeof e==="string"||Array.isArray(e))){throw new TypeError("Expected the input to be `string | string[]`")}t={pascalCase:false,preserveConsecutiveUppercase:false,...t};if(Array.isArray(e)){e=e.map((e=>e.trim())).filter((e=>e.length)).join("-")}else{e=e.trim()}if(e.length===0){return""}const r=t.locale===false?e=>e.toLowerCase():e=>e.toLocaleLowerCase(t.locale);const n=t.locale===false?e=>e.toUpperCase():e=>e.toLocaleUpperCase(t.locale);if(e.length===1){return t.pascalCase?n(e):r(e)}const o=e!==r(e);if(o){e=preserveCamelCase(e,r,n)}e=e.replace(s,"");if(t.preserveConsecutiveUppercase){e=preserveConsecutiveUppercase(e,r)}else{e=r(e)}if(t.pascalCase){e=n(e.charAt(0))+e.slice(1)}return postProcess(e,n)};e.exports=camelCase;e.exports.default=camelCase},9930:(e,t,r)=>{var n=r(5622);e.exports=function(e,t){if(t){var r=t.map((function(t){return n.resolve(e,t)}))}else{var r=e}var o=r.slice(1).reduce((function(e,t){if(!t.match(/^([A-Za-z]:)?\/|\\/)){throw new Error("relative path without a basedir")}var r=t.split(/\/+|\\+/);for(var n=0;e[n]===r[n]&&n1?o.join("/"):"/"}},6891:e=>{e.exports=function(e,r){var n=[];for(var o=0;o{t.formatArgs=formatArgs;t.save=save;t.load=load;t.useColors=useColors;t.storage=localstorage();t.destroy=(()=>{let e=false;return()=>{if(!e){e=true;console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}}})();t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function useColors(){if(typeof window!=="undefined"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs)){return true}if(typeof navigator!=="undefined"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)){return false}return typeof document!=="undefined"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window!=="undefined"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator!=="undefined"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||typeof navigator!=="undefined"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function formatArgs(t){t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+e.exports.humanize(this.diff);if(!this.useColors){return}const r="color: "+this.color;t.splice(1,0,r,"color: inherit");let n=0;let o=0;t[0].replace(/%[a-zA-Z%]/g,(e=>{if(e==="%%"){return}n++;if(e==="%c"){o=n}}));t.splice(o,0,r)}t.log=console.debug||console.log||(()=>{});function save(e){try{if(e){t.storage.setItem("debug",e)}else{t.storage.removeItem("debug")}}catch(e){}}function load(){let e;try{e=t.storage.getItem("debug")}catch(e){}if(!e&&typeof process!=="undefined"&&"env"in process){e=process.env.DEBUG}return e}function localstorage(){try{return localStorage}catch(e){}}e.exports=r(6243)(t);const{formatters:n}=e.exports;n.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}},6243:(e,t,r)=>{function setup(e){createDebug.debug=createDebug;createDebug.default=createDebug;createDebug.coerce=coerce;createDebug.disable=disable;createDebug.enable=enable;createDebug.enabled=enabled;createDebug.humanize=r(900);createDebug.destroy=destroy;Object.keys(e).forEach((t=>{createDebug[t]=e[t]}));createDebug.names=[];createDebug.skips=[];createDebug.formatters={};function selectColor(e){let t=0;for(let r=0;r{if(t==="%%"){return"%"}i++;const o=createDebug.formatters[n];if(typeof o==="function"){const n=e[i];t=o.call(r,n);e.splice(i,1);i--}return t}));createDebug.formatArgs.call(r,e);const s=r.log||createDebug.log;s.apply(r,e)}debug.namespace=e;debug.useColors=createDebug.useColors();debug.color=createDebug.selectColor(e);debug.extend=extend;debug.destroy=createDebug.destroy;Object.defineProperty(debug,"enabled",{enumerable:true,configurable:false,get:()=>r===null?createDebug.enabled(e):r,set:e=>{r=e}});if(typeof createDebug.init==="function"){createDebug.init(debug)}return debug}function extend(e,t){const r=createDebug(this.namespace+(typeof t==="undefined"?":":t)+e);r.log=this.log;return r}function enable(e){createDebug.save(e);createDebug.names=[];createDebug.skips=[];let t;const r=(typeof e==="string"?e:"").split(/[\s,]+/);const n=r.length;for(t=0;t"-"+e))].join(",");createDebug.enable("");return e}function enabled(e){if(e[e.length-1]==="*"){return true}let t;let r;for(t=0,r=createDebug.skips.length;t{if(typeof process==="undefined"||process.type==="renderer"||process.browser===true||process.__nwjs){e.exports=r(8222)}else{e.exports=r(5332)}},5332:(e,t,r)=>{const n=r(3867);const o=r(1669);t.init=init;t.log=log;t.formatArgs=formatArgs;t.save=save;t.load=load;t.useColors=useColors;t.destroy=o.deprecate((()=>{}),"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");t.colors=[6,2,3,4,5,1];try{const e=r(9318);if(e&&(e.stderr||e).level>=2){t.colors=[20,21,26,27,32,33,38,39,40,41,42,43,44,45,56,57,62,63,68,69,74,75,76,77,78,79,80,81,92,93,98,99,112,113,128,129,134,135,148,149,160,161,162,163,164,165,166,167,168,169,170,171,172,173,178,179,184,185,196,197,198,199,200,201,202,203,204,205,206,207,208,209,214,215,220,221]}}catch(e){}t.inspectOpts=Object.keys(process.env).filter((e=>/^debug_/i.test(e))).reduce(((e,t)=>{const r=t.substring(6).toLowerCase().replace(/_([a-z])/g,((e,t)=>t.toUpperCase()));let n=process.env[t];if(/^(yes|on|true|enabled)$/i.test(n)){n=true}else if(/^(no|off|false|disabled)$/i.test(n)){n=false}else if(n==="null"){n=null}else{n=Number(n)}e[r]=n;return e}),{});function useColors(){return"colors"in t.inspectOpts?Boolean(t.inspectOpts.colors):n.isatty(process.stderr.fd)}function formatArgs(t){const{namespace:r,useColors:n}=this;if(n){const n=this.color;const o="[3"+(n<8?n:"8;5;"+n);const i=` ${o};1m${r} `;t[0]=i+t[0].split("\n").join("\n"+i);t.push(o+"m+"+e.exports.humanize(this.diff)+"")}else{t[0]=getDate()+r+" "+t[0]}}function getDate(){if(t.inspectOpts.hideDate){return""}return(new Date).toISOString()+" "}function log(...e){return process.stderr.write(o.format(...e)+"\n")}function save(e){if(e){process.env.DEBUG=e}else{delete process.env.DEBUG}}function load(){return process.env.DEBUG}function init(e){e.inspectOpts={};const r=Object.keys(t.inspectOpts);for(let n=0;ne.trim())).join(" ")};i.O=function(e){this.inspectOpts.colors=this.useColors;return o.inspect(e,this.inspectOpts)}},2342:e=>{"use strict";function Denque(e,t){var t=t||{};this._head=0;this._tail=0;this._capacity=t.capacity;this._capacityMask=3;this._list=new Array(4);if(Array.isArray(e)){this._fromArray(e)}}Denque.prototype.peekAt=function peekAt(e){var t=e;if(t!==(t|0)){return void 0}var r=this.size();if(t>=r||t<-r)return undefined;if(t<0)t+=r;t=this._head+t&this._capacityMask;return this._list[t]};Denque.prototype.get=function get(e){return this.peekAt(e)};Denque.prototype.peek=function peek(){if(this._head===this._tail)return undefined;return this._list[this._head]};Denque.prototype.peekFront=function peekFront(){return this.peek()};Denque.prototype.peekBack=function peekBack(){return this.peekAt(-1)};Object.defineProperty(Denque.prototype,"length",{get:function length(){return this.size()}});Denque.prototype.size=function size(){if(this._head===this._tail)return 0;if(this._headthis._capacity)this.pop();if(this._head1e4&&this._tail<=this._list.length>>>2)this._shrinkArray();return t};Denque.prototype.push=function push(e){if(e===undefined)return this.size();var t=this._tail;this._list[t]=e;this._tail=t+1&this._capacityMask;if(this._tail===this._head){this._growArray()}if(this._capacity&&this.size()>this._capacity){this.shift()}if(this._head1e4&&e<=t>>>2)this._shrinkArray();return r};Denque.prototype.removeOne=function removeOne(e){var t=e;if(t!==(t|0)){return void 0}if(this._head===this._tail)return void 0;var r=this.size();var n=this._list.length;if(t>=r||t<-r)return void 0;if(t<0)t+=r;t=this._head+t&this._capacityMask;var o=this._list[t];var i;if(e0;i--){this._list[t]=this._list[t=t-1+n&this._capacityMask]}this._list[t]=void 0;this._head=this._head+1+n&this._capacityMask}else{for(i=r-1-e;i>0;i--){this._list[t]=this._list[t=t+1+n&this._capacityMask]}this._list[t]=void 0;this._tail=this._tail-1+n&this._capacityMask}return o};Denque.prototype.remove=function remove(e,t){var r=e;var n;var o=t;if(r!==(r|0)){return void 0}if(this._head===this._tail)return void 0;var i=this.size();var s=this._list.length;if(r>=i||r<-i||t<1)return void 0;if(r<0)r+=i;if(t===1||!t){n=new Array(1);n[0]=this.removeOne(r);return n}if(r===0&&r+t>=i){n=this.toArray();this.clear();return n}if(r+t>i)t=i-r;var a;n=new Array(t);for(a=0;a0;a--){this._list[r=r+1+s&this._capacityMask]=void 0}return n}if(e===0){this._head=this._head+t+s&this._capacityMask;for(a=t-1;a>0;a--){this._list[r=r+1+s&this._capacityMask]=void 0}return n}if(r0;a--){this.unshift(this._list[r=r-1+s&this._capacityMask])}r=this._head-1+s&this._capacityMask;while(o>0){this._list[r=r-1+s&this._capacityMask]=void 0;o--}if(e<0)this._tail=r}else{this._tail=r;r=r+t+s&this._capacityMask;for(a=i-(t+e);a>0;a--){this.push(this._list[r++])}r=this._tail;while(o>0){this._list[r=r+1+s&this._capacityMask]=void 0;o--}}if(this._head<2&&this._tail>1e4&&this._tail<=s>>>2)this._shrinkArray();return n};Denque.prototype.splice=function splice(e,t){var r=e;if(r!==(r|0)){return void 0}var n=this.size();if(r<0)r+=n;if(r>n)return void 0;if(arguments.length>2){var o;var i;var s;var a=arguments.length;var c=this._list.length;var l=2;if(!n||r0){this._head=this._head+r+c&this._capacityMask}}else{s=this.remove(r,t);this._head=this._head+r+c&this._capacityMask}while(a>l){this.unshift(arguments[--a])}for(o=r;o>0;o--){this.unshift(i[o-1])}}else{i=new Array(n-(r+t));var u=i.length;for(o=0;othis._tail){for(o=this._head;o>>=1;this._capacityMask>>>=1};e.exports=Denque},1205:(e,t,r)=>{var n=r(1223);var noop=function(){};var isRequest=function(e){return e.setHeader&&typeof e.abort==="function"};var isChildProcess=function(e){return e.stdio&&Array.isArray(e.stdio)&&e.stdio.length===3};var eos=function(e,t,r){if(typeof t==="function")return eos(e,null,t);if(!t)t={};r=n(r||noop);var o=e._writableState;var i=e._readableState;var s=t.readable||t.readable!==false&&e.readable;var a=t.writable||t.writable!==false&&e.writable;var c=false;var onlegacyfinish=function(){if(!e.writable)onfinish()};var onfinish=function(){a=false;if(!s)r.call(e)};var onend=function(){s=false;if(!a)r.call(e)};var onexit=function(t){r.call(e,t?new Error("exited with error code: "+t):null)};var onerror=function(t){r.call(e,t)};var onclose=function(){process.nextTick(onclosenexttick)};var onclosenexttick=function(){if(c)return;if(s&&!(i&&(i.ended&&!i.destroyed)))return r.call(e,new Error("premature close"));if(a&&!(o&&(o.ended&&!o.destroyed)))return r.call(e,new Error("premature close"))};var onrequest=function(){e.req.on("finish",onfinish)};if(isRequest(e)){e.on("complete",onfinish);e.on("abort",onclose);if(e.req)onrequest();else e.on("request",onrequest)}else if(a&&!o){e.on("end",onlegacyfinish);e.on("close",onlegacyfinish)}if(isChildProcess(e))e.on("exit",onexit);e.on("end",onend);e.on("finish",onfinish);if(t.error!==false)e.on("error",onerror);e.on("close",onclose);return function(){c=true;e.removeListener("complete",onfinish);e.removeListener("abort",onclose);e.removeListener("request",onrequest);if(e.req)e.req.removeListener("finish",onfinish);e.removeListener("end",onlegacyfinish);e.removeListener("close",onlegacyfinish);e.removeListener("finish",onfinish);e.removeListener("exit",onexit);e.removeListener("end",onend);e.removeListener("error",onerror);e.removeListener("close",onclose)}};e.exports=eos},5010:(e,t,r)=>{var n=r(5747);var o=r(1669);var i=r(2413);var s=i.Readable;var a=i.Writable;var c=i.PassThrough;var l=r(4833);var u=r(8614).EventEmitter;t.createFromBuffer=createFromBuffer;t.createFromFd=createFromFd;t.BufferSlicer=BufferSlicer;t.FdSlicer=FdSlicer;o.inherits(FdSlicer,u);function FdSlicer(e,t){t=t||{};u.call(this);this.fd=e;this.pend=new l;this.pend.max=1;this.refCount=0;this.autoClose=!!t.autoClose}FdSlicer.prototype.read=function(e,t,r,o,i){var s=this;s.pend.go((function(a){n.read(s.fd,e,t,r,o,(function(e,t,r){a();i(e,t,r)}))}))};FdSlicer.prototype.write=function(e,t,r,o,i){var s=this;s.pend.go((function(a){n.write(s.fd,e,t,r,o,(function(e,t,r){a();i(e,t,r)}))}))};FdSlicer.prototype.createReadStream=function(e){return new ReadStream(this,e)};FdSlicer.prototype.createWriteStream=function(e){return new WriteStream(this,e)};FdSlicer.prototype.ref=function(){this.refCount+=1};FdSlicer.prototype.unref=function(){var e=this;e.refCount-=1;if(e.refCount>0)return;if(e.refCount<0)throw new Error("invalid unref");if(e.autoClose){n.close(e.fd,onCloseDone)}function onCloseDone(t){if(t){e.emit("error",t)}else{e.emit("close")}}};o.inherits(ReadStream,s);function ReadStream(e,t){t=t||{};s.call(this,t);this.context=e;this.context.ref();this.start=t.start||0;this.endOffset=t.end;this.pos=this.start;this.destroyed=false}ReadStream.prototype._read=function(e){var t=this;if(t.destroyed)return;var r=Math.min(t._readableState.highWaterMark,e);if(t.endOffset!=null){r=Math.min(r,t.endOffset-t.pos)}if(r<=0){t.destroyed=true;t.push(null);t.context.unref();return}t.context.pend.go((function(e){if(t.destroyed)return e();var o=new Buffer(r);n.read(t.context.fd,o,0,r,t.pos,(function(r,n){if(r){t.destroy(r)}else if(n===0){t.destroyed=true;t.push(null);t.context.unref()}else{t.pos+=n;t.push(o.slice(0,n))}e()}))}))};ReadStream.prototype.destroy=function(e){if(this.destroyed)return;e=e||new Error("stream destroyed");this.destroyed=true;this.emit("error",e);this.context.unref()};o.inherits(WriteStream,a);function WriteStream(e,t){t=t||{};a.call(this,t);this.context=e;this.context.ref();this.start=t.start||0;this.endOffset=t.end==null?Infinity:+t.end;this.bytesWritten=0;this.pos=this.start;this.destroyed=false;this.on("finish",this.destroy.bind(this))}WriteStream.prototype._write=function(e,t,r){var o=this;if(o.destroyed)return;if(o.pos+e.length>o.endOffset){var i=new Error("maximum file length exceeded");i.code="ETOOBIG";o.destroy();r(i);return}o.context.pend.go((function(t){if(o.destroyed)return t();n.write(o.context.fd,e,0,e.length,o.pos,(function(e,n){if(e){o.destroy();t();r(e)}else{o.bytesWritten+=n;o.pos+=n;o.emit("progress");t();r()}}))}))};WriteStream.prototype.destroy=function(){if(this.destroyed)return;this.destroyed=true;this.context.unref()};o.inherits(BufferSlicer,u);function BufferSlicer(e,t){u.call(this);t=t||{};this.refCount=0;this.buffer=e;this.maxChunkSize=t.maxChunkSize||Number.MAX_SAFE_INTEGER}BufferSlicer.prototype.read=function(e,t,r,n,o){var i=n+r;var s=i-this.buffer.length;var a=s>0?s:r;this.buffer.copy(e,t,n,i);setImmediate((function(){o(null,a)}))};BufferSlicer.prototype.write=function(e,t,r,n,o){e.copy(this.buffer,n,t,t+r);setImmediate((function(){o(null,r,e)}))};BufferSlicer.prototype.createReadStream=function(e){e=e||{};var t=new c(e);t.destroyed=false;t.start=e.start||0;t.endOffset=e.end;t.pos=t.endOffset||this.buffer.length;var r=this.buffer.slice(t.start,t.pos);var n=0;while(true){var o=n+this.maxChunkSize;if(o>=r.length){if(nr.endOffset){var s=new Error("maximum file length exceeded");s.code="ETOOBIG";r.destroyed=true;o(s);return}e.copy(t.buffer,r.pos,0,e.length);r.bytesWritten+=e.length;r.pos=i;r.emit("progress");o()};r.destroy=function(){r.destroyed=true};return r};BufferSlicer.prototype.ref=function(){this.refCount+=1};BufferSlicer.prototype.unref=function(){this.refCount-=1;if(this.refCount<0){throw new Error("invalid unref")}};function createFromBuffer(e,t){return new BufferSlicer(e,t)}function createFromFd(e,t){return new FdSlicer(e,t)}},7281:(e,t,r)=>{"use strict";const n=r(5622);const o=r(5747);const i=r(9930);const s=r(8098);const a=r(9126);const{env:c,cwd:l}=process;const isWritable=e=>{try{o.accessSync(e,o.constants.W_OK);return true}catch(e){return false}};function useDirectory(e,t){if(t.create){a.sync(e)}if(t.thunk){return(...t)=>n.join(e,...t)}return e}function getNodeModuleDirectory(e){const t=n.join(e,"node_modules");if(!isWritable(t)&&(o.existsSync(t)||!isWritable(n.join(e)))){return}return t}e.exports=(e={})=>{if(c.CACHE_DIR&&!["true","false","1","0"].includes(c.CACHE_DIR)){return useDirectory(n.join(c.CACHE_DIR,e.name),e)}let{cwd:t=l()}=e;if(e.files){t=i(t,e.files)}t=s.sync(t);if(!t){return}const r=getNodeModuleDirectory(t);if(!r){return undefined}return useDirectory(n.join(t,"node_modules",".cache",e.name),e)}},3186:(e,t,r)=>{e.exports=r(5747).constants||r(7619)},6863:(e,t,r)=>{e.exports=realpath;realpath.realpath=realpath;realpath.sync=realpathSync;realpath.realpathSync=realpathSync;realpath.monkeypatch=monkeypatch;realpath.unmonkeypatch=unmonkeypatch;var n=r(5747);var o=n.realpath;var i=n.realpathSync;var s=process.version;var a=/^v[0-5]\./.test(s);var c=r(1734);function newError(e){return e&&e.syscall==="realpath"&&(e.code==="ELOOP"||e.code==="ENOMEM"||e.code==="ENAMETOOLONG")}function realpath(e,t,r){if(a){return o(e,t,r)}if(typeof t==="function"){r=t;t=null}o(e,t,(function(n,o){if(newError(n)){c.realpath(e,t,r)}else{r(n,o)}}))}function realpathSync(e,t){if(a){return i(e,t)}try{return i(e,t)}catch(r){if(newError(r)){return c.realpathSync(e,t)}else{throw r}}}function monkeypatch(){n.realpath=realpath;n.realpathSync=realpathSync}function unmonkeypatch(){n.realpath=o;n.realpathSync=i}},1734:(e,t,r)=>{var n=r(5622);var o=process.platform==="win32";var i=r(5747);var s=process.env.NODE_DEBUG&&/fs/.test(process.env.NODE_DEBUG);function rethrow(){var e;if(s){var t=new Error;e=debugCallback}else e=missingCallback;return e;function debugCallback(e){if(e){t.message=e.message;e=t;missingCallback(e)}}function missingCallback(e){if(e){if(process.throwDeprecation)throw e;else if(!process.noDeprecation){var t="fs: missing callback "+(e.stack||e.message);if(process.traceDeprecation)console.trace(t);else console.error(t)}}}}function maybeCallback(e){return typeof e==="function"?e:rethrow()}var a=n.normalize;if(o){var c=/(.*?)(?:[\/\\]+|$)/g}else{var c=/(.*?)(?:[\/]+|$)/g}if(o){var l=/^(?:[a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/][^\\\/]+)?[\\\/]*/}else{var l=/^[\/]*/}t.realpathSync=function realpathSync(e,t){e=n.resolve(e);if(t&&Object.prototype.hasOwnProperty.call(t,e)){return t[e]}var r=e,s={},a={};var u;var d;var p;var h;start();function start(){var t=l.exec(e);u=t[0].length;d=t[0];p=t[0];h="";if(o&&!a[p]){i.lstatSync(p);a[p]=true}}while(u=e.length){if(t)t[s]=e;return r(null,e)}c.lastIndex=d;var n=c.exec(e);m=p;p+=n[0];h=m+n[1];d=c.lastIndex;if(u[h]||t&&t[h]===h){return process.nextTick(LOOP)}if(t&&Object.prototype.hasOwnProperty.call(t,h)){return gotResolvedLink(t[h])}return i.lstat(h,gotStat)}function gotStat(e,n){if(e)return r(e);if(!n.isSymbolicLink()){u[h]=true;if(t)t[h]=h;return process.nextTick(LOOP)}if(!o){var s=n.dev.toString(32)+":"+n.ino.toString(32);if(a.hasOwnProperty(s)){return gotTarget(null,a[s],h)}}i.stat(h,(function(e){if(e)return r(e);i.readlink(h,(function(e,t){if(!o)a[s]=t;gotTarget(e,t)}))}))}function gotTarget(e,o,i){if(e)return r(e);var s=n.resolve(m,o);if(t)t[i]=s;gotResolvedLink(s)}function gotResolvedLink(t){e=n.resolve(t,e.slice(d));start()}}},3002:(e,t,r)=>{"use strict";const n=r(1631);class Locked extends Error{constructor(e){super(`${e} is locked`)}}const o={old:new Set,young:new Set};const i=1e3*15;let s;const getAvailablePort=e=>new Promise(((t,r)=>{const o=n.createServer();o.unref();o.on("error",r);o.listen(e,(()=>{const{port:e}=o.address();o.close((()=>{t(e)}))}))}));const portCheckSequence=function*(e){if(e){yield*e}yield 0};e.exports=async e=>{let t;if(e){t=typeof e.port==="number"?[e.port]:e.port}if(s===undefined){s=setInterval((()=>{o.old=o.young;o.young=new Set}),i);if(s.unref){s.unref()}}for(const r of portCheckSequence(t)){try{let t=await getAvailablePort({...e,port:r});while(o.old.has(t)||o.young.has(t)){if(r!==0){throw new Locked(r)}t=await getAvailablePort({...e,port:r})}o.young.add(t);return t}catch(e){if(!["EADDRINUSE","EACCES"].includes(e.code)&&!(e instanceof Locked)){throw e}}}throw new Error("No available ports found")};e.exports.makeRange=(e,t)=>{if(!Number.isInteger(e)||!Number.isInteger(t)){throw new TypeError("`from` and `to` must be integer numbers")}if(e<1024||e>65535){throw new RangeError("`from` must be between 1024 and 65535")}if(t<1024||t>65536){throw new RangeError("`to` must be between 1024 and 65536")}if(t{t.setopts=setopts;t.ownProp=ownProp;t.makeAbs=makeAbs;t.finish=finish;t.mark=mark;t.isIgnored=isIgnored;t.childrenIgnored=childrenIgnored;function ownProp(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var n=r(5622);var o=r(3973);var i=r(8714);var s=o.Minimatch;function alphasort(e,t){return e.localeCompare(t,"en")}function setupIgnores(e,t){e.ignore=t.ignore||[];if(!Array.isArray(e.ignore))e.ignore=[e.ignore];if(e.ignore.length){e.ignore=e.ignore.map(ignoreMap)}}function ignoreMap(e){var t=null;if(e.slice(-3)==="/**"){var r=e.replace(/(\/\*\*)+$/,"");t=new s(r,{dot:true})}return{matcher:new s(e,{dot:true}),gmatcher:t}}function setopts(e,t,r){if(!r)r={};if(r.matchBase&&-1===t.indexOf("/")){if(r.noglobstar){throw new Error("base matching requires globstar")}t="**/"+t}e.silent=!!r.silent;e.pattern=t;e.strict=r.strict!==false;e.realpath=!!r.realpath;e.realpathCache=r.realpathCache||Object.create(null);e.follow=!!r.follow;e.dot=!!r.dot;e.mark=!!r.mark;e.nodir=!!r.nodir;if(e.nodir)e.mark=true;e.sync=!!r.sync;e.nounique=!!r.nounique;e.nonull=!!r.nonull;e.nosort=!!r.nosort;e.nocase=!!r.nocase;e.stat=!!r.stat;e.noprocess=!!r.noprocess;e.absolute=!!r.absolute;e.maxLength=r.maxLength||Infinity;e.cache=r.cache||Object.create(null);e.statCache=r.statCache||Object.create(null);e.symlinks=r.symlinks||Object.create(null);setupIgnores(e,r);e.changedCwd=false;var o=process.cwd();if(!ownProp(r,"cwd"))e.cwd=o;else{e.cwd=n.resolve(r.cwd);e.changedCwd=e.cwd!==o}e.root=r.root||n.resolve(e.cwd,"/");e.root=n.resolve(e.root);if(process.platform==="win32")e.root=e.root.replace(/\\/g,"/");e.cwdAbs=i(e.cwd)?e.cwd:makeAbs(e,e.cwd);if(process.platform==="win32")e.cwdAbs=e.cwdAbs.replace(/\\/g,"/");e.nomount=!!r.nomount;r.nonegate=true;r.nocomment=true;e.minimatch=new s(t,r);e.options=e.minimatch.options}function finish(e){var t=e.nounique;var r=t?[]:Object.create(null);for(var n=0,o=e.matches.length;n{e.exports=glob;var n=r(5747);var o=r(6863);var i=r(3973);var s=i.Minimatch;var a=r(4124);var c=r(8614).EventEmitter;var l=r(5622);var u=r(2357);var d=r(8714);var p=r(9010);var h=r(7625);var m=h.setopts;var g=h.ownProp;var y=r(2492);var v=r(1669);var b=h.childrenIgnored;var S=h.isIgnored;var w=r(1223);function glob(e,t,r){if(typeof t==="function")r=t,t={};if(!t)t={};if(t.sync){if(r)throw new TypeError("callback provided to sync glob");return p(e,t)}return new Glob(e,t,r)}glob.sync=p;var E=glob.GlobSync=p.GlobSync;glob.glob=glob;function extend(e,t){if(t===null||typeof t!=="object"){return e}var r=Object.keys(t);var n=r.length;while(n--){e[r[n]]=t[r[n]]}return e}glob.hasMagic=function(e,t){var r=extend({},t);r.noprocess=true;var n=new Glob(e,r);var o=n.minimatch.set;if(!e)return false;if(o.length>1)return true;for(var i=0;ithis.maxLength)return t();if(!this.stat&&g(this.cache,r)){var i=this.cache[r];if(Array.isArray(i))i="DIR";if(!o||i==="DIR")return t(null,i);if(o&&i==="FILE")return t()}var s;var a=this.statCache[r];if(a!==undefined){if(a===false)return t(null,a);else{var c=a.isDirectory()?"DIR":"FILE";if(o&&c==="FILE")return t();else return t(null,c,a)}}var l=this;var u=y("stat\0"+r,lstatcb_);if(u)n.lstat(r,u);function lstatcb_(o,i){if(i&&i.isSymbolicLink()){return n.stat(r,(function(n,o){if(n)l._stat2(e,r,null,i,t);else l._stat2(e,r,n,o,t)}))}else{l._stat2(e,r,o,i,t)}}};Glob.prototype._stat2=function(e,t,r,n,o){if(r&&(r.code==="ENOENT"||r.code==="ENOTDIR")){this.statCache[t]=false;return o()}var i=e.slice(-1)==="/";this.statCache[t]=n;if(t.slice(-1)==="/"&&n&&!n.isDirectory())return o(null,false,n);var s=true;if(n)s=n.isDirectory()?"DIR":"FILE";this.cache[t]=this.cache[t]||s;if(i&&s==="FILE")return o();return o(null,s,n)}},9010:(e,t,r)=>{e.exports=globSync;globSync.GlobSync=GlobSync;var n=r(5747);var o=r(6863);var i=r(3973);var s=i.Minimatch;var a=r(1957).Glob;var c=r(1669);var l=r(5622);var u=r(2357);var d=r(8714);var p=r(7625);var h=p.setopts;var m=p.ownProp;var g=p.childrenIgnored;var y=p.isIgnored;function globSync(e,t){if(typeof t==="function"||arguments.length===3)throw new TypeError("callback provided to sync glob\n"+"See: https://github.com/isaacs/node-glob/issues/167");return new GlobSync(e,t).found}function GlobSync(e,t){if(!e)throw new Error("must provide pattern");if(typeof t==="function"||arguments.length===3)throw new TypeError("callback provided to sync glob\n"+"See: https://github.com/isaacs/node-glob/issues/167");if(!(this instanceof GlobSync))return new GlobSync(e,t);h(this,e,t);if(this.noprocess)return this;var r=this.minimatch.set.length;this.matches=new Array(r);for(var n=0;nthis.maxLength)return false;if(!this.stat&&m(this.cache,t)){var o=this.cache[t];if(Array.isArray(o))o="DIR";if(!r||o==="DIR")return o;if(r&&o==="FILE")return false}var i;var s=this.statCache[t];if(!s){var a;try{a=n.lstatSync(t)}catch(e){if(e&&(e.code==="ENOENT"||e.code==="ENOTDIR")){this.statCache[t]=false;return false}}if(a&&a.isSymbolicLink()){try{s=n.statSync(t)}catch(e){s=a}}else{s=a}}this.statCache[t]=s;var o=true;if(s)o=s.isDirectory()?"DIR":"FILE";this.cache[t]=this.cache[t]||o;if(r&&o==="FILE")return false;return o};GlobSync.prototype._mark=function(e){return p.mark(this,e)};GlobSync.prototype._makeAbs=function(e){return p.makeAbs(this,e)}},1621:e=>{"use strict";e.exports=(e,t=process.argv)=>{const r=e.startsWith("-")?"":e.length===1?"-":"--";const n=t.indexOf(r+e);const o=t.indexOf("--");return n!==-1&&(o===-1||n{p("replaying proxy buffer for failed request");c.default(e.listenerCount("data")>0);e.push(b);e.push(null)}));return S}))}}t.default=HttpsProxyAgent;function resume(e){e.resume()}function isDefaultPort(e,t){return Boolean(!t&&e===80||t&&e===443)}function isHTTPS(e){return typeof e==="string"?/^https:?$/i.test(e):false}function omit(e,...t){const r={};let n;for(n in e){if(!t.includes(n)){r[n]=e[n]}}return r}},7219:function(e,t,r){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};const o=n(r(5098));function createHttpsProxyAgent(e){return new o.default(e)}(function(e){e.HttpsProxyAgent=o.default;e.prototype=o.default.prototype})(createHttpsProxyAgent||(createHttpsProxyAgent={}));e.exports=createHttpsProxyAgent},595:function(e,t,r){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:true});const o=n(r(8237));const i=o.default("https-proxy-agent:parse-proxy-response");function parseProxyResponse(e){return new Promise(((t,r)=>{let n=0;const o=[];function read(){const t=e.read();if(t)ondata(t);else e.once("readable",read)}function cleanup(){e.removeListener("end",onend);e.removeListener("error",onerror);e.removeListener("close",onclose);e.removeListener("readable",read)}function onclose(e){i("onclose had error %o",e)}function onend(){i("onend")}function onerror(e){cleanup();i("onerror %o",e);r(e)}function ondata(e){o.push(e);n+=e.length;const r=Buffer.concat(o,n);const s=r.indexOf("\r\n\r\n");if(s===-1){i("have not received end of HTTP headers yet...");read();return}const a=r.toString("ascii",0,r.indexOf("\r\n"));const c=+a.split(" ")[1];i("got proxy server response: %o",a);t({statusCode:c,buffered:r})}e.on("error",onerror);e.on("close",onclose);e.on("end",onend);read()}))}t.default=parseProxyResponse},2492:(e,t,r)=>{var n=r(2940);var o=Object.create(null);var i=r(1223);e.exports=n(inflight);function inflight(e,t){if(o[e]){o[e].push(t);return null}else{o[e]=[t];return makeres(e)}}function makeres(e){return i((function RES(){var t=o[e];var r=t.length;var n=slice(arguments);try{for(var i=0;ir){t.splice(0,r);process.nextTick((function(){RES.apply(null,n)}))}else{delete o[e]}}}))}function slice(e){var t=e.length;var r=[];for(var n=0;n{try{var n=r(1669);if(typeof n.inherits!=="function")throw"";e.exports=n.inherits}catch(t){e.exports=r(8544)}},8544:e=>{if(typeof Object.create==="function"){e.exports=function inherits(e,t){if(t){e.super_=t;e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:false,writable:true,configurable:true}})}}}else{e.exports=function inherits(e,t){if(t){e.super_=t;var TempCtor=function(){};TempCtor.prototype=t.prototype;e.prototype=new TempCtor;e.prototype.constructor=e}}}},9126:(e,t,r)=>{"use strict";const n=r(5747);const o=r(5622);const{promisify:i}=r(1669);const s=r(5911);const a=s.satisfies(process.version,">=10.12.0");const checkPath=e=>{if(process.platform==="win32"){const t=/[<>:"|?*]/.test(e.replace(o.parse(e).root,""));if(t){const t=new Error(`Path contains invalid characters: ${e}`);t.code="EINVAL";throw t}}};const processOptions=e=>{const t={mode:511,fs:n};return{...t,...e}};const permissionError=e=>{const t=new Error(`operation not permitted, mkdir '${e}'`);t.code="EPERM";t.errno=-4048;t.path=e;t.syscall="mkdir";return t};const makeDir=async(e,t)=>{checkPath(e);t=processOptions(t);const r=i(t.fs.mkdir);const s=i(t.fs.stat);if(a&&t.fs.mkdir===n.mkdir){const n=o.resolve(e);await r(n,{mode:t.mode,recursive:true});return n}const make=async e=>{try{await r(e,t.mode);return e}catch(t){if(t.code==="EPERM"){throw t}if(t.code==="ENOENT"){if(o.dirname(e)===e){throw permissionError(e)}if(t.message.includes("null bytes")){throw t}await make(o.dirname(e));return make(e)}try{const t=await s(e);if(!t.isDirectory()){throw new Error("The path is not a directory")}}catch(e){throw t}return e}};return make(o.resolve(e))};e.exports=makeDir;e.exports.sync=(e,t)=>{checkPath(e);t=processOptions(t);if(a&&t.fs.mkdirSync===n.mkdirSync){const r=o.resolve(e);n.mkdirSync(r,{mode:t.mode,recursive:true});return r}const make=e=>{try{t.fs.mkdirSync(e,t.mode)}catch(r){if(r.code==="EPERM"){throw r}if(r.code==="ENOENT"){if(o.dirname(e)===e){throw permissionError(e)}if(r.message.includes("null bytes")){throw r}make(o.dirname(e));return make(e)}try{if(!t.fs.statSync(e).isDirectory()){throw new Error("The path is not a directory")}}catch(e){throw r}}return e};return make(o.resolve(e))}},1446:(e,t,r)=>{const n=r(6417);const o=r(5747);const i=8192;function md5FileSync(e){const t=o.openSync(e,"r");const r=n.createHash("md5");const s=Buffer.alloc(i);try{let e;do{e=o.readSync(t,s,0,i);r.update(s.slice(0,e))}while(e===i)}finally{o.closeSync(t)}return r.digest("hex")}function md5File(e){return new Promise(((t,r)=>{const i=n.createHash("md5");const s=o.createReadStream(e);s.on("error",(e=>{r(e)}));i.once("readable",(()=>{t(i.read().toString("hex"))}));s.pipe(i)}))}e.exports=md5File;e.exports.sync=md5FileSync},7147:e=>{e.exports=Pager;function Pager(e,t){if(!(this instanceof Pager))return new Pager(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?alloc(this.deduplicate.length):null}Pager.prototype.updated=function(e){while(this.deduplicate&&e.buffer[e.deduplicate]===this.deduplicate[e.deduplicate]){e.deduplicate++;if(e.deduplicate===this.deduplicate.length){e.deduplicate=0;if(e.buffer.equals&&e.buffer.equals(this.deduplicate))e.buffer=this.deduplicate;break}}if(e.updated||!this.updates)return;e.updated=true;this.updates.push(e)};Pager.prototype.lastUpdate=function(){if(!this.updates||!this.updates.length)return null;var e=this.updates.pop();e.updated=false;return e};Pager.prototype._array=function(e,t){if(e>=this.maxPages){if(t)return;grow(this,e)}factor(e,this.path);var r=this.pages;for(var n=this.level;n>0;n--){var o=this.path[n];var i=r[o];if(!i){if(t)return;i=r[o]=new Array(32768)}r=i}return r};Pager.prototype.get=function(e,t){var r=this._array(e,t);var n=this.path[0];var o=r&&r[n];if(!o&&!t){o=r[n]=new Page(e,alloc(this.pageSize));if(e>=this.length)this.length=e+1}if(o&&o.buffer===this.deduplicate&&this.deduplicate&&!t){o.buffer=copy(o.buffer);o.deduplicate=0}return o};Pager.prototype.set=function(e,t){var r=this._array(e,false);var n=this.path[0];if(e>=this.length)this.length=e+1;if(!t||this.zeros&&t.equals&&t.equals(this.zeros)){r[n]=undefined;return}if(this.deduplicate&&t.equals&&t.equals(this.deduplicate)){t=this.deduplicate}var o=r[n];var i=truncate(t,this.pageSize);if(o)o.buffer=i;else r[n]=new Page(e,i)};Pager.prototype.toBuffer=function(){var e=new Array(this.length);var t=alloc(this.pageSize);var r=0;while(rt)return e.slice(0,t);var r=alloc(t);e.copy(r);return r}function alloc(e){if(Buffer.alloc)return Buffer.alloc(e);var t=new Buffer(e);t.fill(0);return t}function copy(e){var t=Buffer.allocUnsafe?Buffer.allocUnsafe(e.length):new Buffer(e.length);e.copy(t);return t}function Page(e,t){this.offset=e*t.length;this.buffer=t;this.updated=false;this.deduplicate=0}function factor(e,t){e=(e-(t[0]=e&32767))/32768;e=(e-(t[1]=e&32767))/32768;t[3]=(e-(t[2]=e&32767))/32768&32767}},3973:(e,t,r)=>{e.exports=minimatch;minimatch.Minimatch=Minimatch;var n={sep:"/"};try{n=r(5622)}catch(e){}var o=minimatch.GLOBSTAR=Minimatch.GLOBSTAR={};var i=r(3717);var s={"!":{open:"(?:(?!(?:",close:"))[^/]*?)"},"?":{open:"(?:",close:")?"},"+":{open:"(?:",close:")+"},"*":{open:"(?:",close:")*"},"@":{open:"(?:",close:")"}};var a="[^/]";var c=a+"*?";var l="(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?";var u="(?:(?!(?:\\/|^)\\.).)*?";var d=charSet("().*{}+?[]^$\\!");function charSet(e){return e.split("").reduce((function(e,t){e[t]=true;return e}),{})}var p=/\/+/;minimatch.filter=filter;function filter(e,t){t=t||{};return function(r,n,o){return minimatch(r,e,t)}}function ext(e,t){e=e||{};t=t||{};var r={};Object.keys(t).forEach((function(e){r[e]=t[e]}));Object.keys(e).forEach((function(t){r[t]=e[t]}));return r}minimatch.defaults=function(e){if(!e||!Object.keys(e).length)return minimatch;var t=minimatch;var r=function minimatch(r,n,o){return t.minimatch(r,n,ext(e,o))};r.Minimatch=function Minimatch(r,n){return new t.Minimatch(r,ext(e,n))};return r};Minimatch.defaults=function(e){if(!e||!Object.keys(e).length)return Minimatch;return minimatch.defaults(e).Minimatch};function minimatch(e,t,r){if(typeof t!=="string"){throw new TypeError("glob pattern string required")}if(!r)r={};if(!r.nocomment&&t.charAt(0)==="#"){return false}if(t.trim()==="")return e==="";return new Minimatch(t,r).match(e)}function Minimatch(e,t){if(!(this instanceof Minimatch)){return new Minimatch(e,t)}if(typeof e!=="string"){throw new TypeError("glob pattern string required")}if(!t)t={};e=e.trim();if(n.sep!=="/"){e=e.split(n.sep).join("/")}this.options=t;this.set=[];this.pattern=e;this.regexp=null;this.negate=false;this.comment=false;this.empty=false;this.make()}Minimatch.prototype.debug=function(){};Minimatch.prototype.make=make;function make(){if(this._made)return;var e=this.pattern;var t=this.options;if(!t.nocomment&&e.charAt(0)==="#"){this.comment=true;return}if(!e){this.empty=true;return}this.parseNegate();var r=this.globSet=this.braceExpand();if(t.debug)this.debug=console.error;this.debug(this.pattern,r);r=this.globParts=r.map((function(e){return e.split(p)}));this.debug(this.pattern,r);r=r.map((function(e,t,r){return e.map(this.parse,this)}),this);this.debug(this.pattern,r);r=r.filter((function(e){return e.indexOf(false)===-1}));this.debug(this.pattern,r);this.set=r}Minimatch.prototype.parseNegate=parseNegate;function parseNegate(){var e=this.pattern;var t=false;var r=this.options;var n=0;if(r.nonegate)return;for(var o=0,i=e.length;o1024*64){throw new TypeError("pattern is too long")}var r=this.options;if(!r.noglobstar&&e==="**")return o;if(e==="")return"";var n="";var i=!!r.nocase;var l=false;var u=[];var p=[];var m;var g=false;var y=-1;var v=-1;var b=e.charAt(0)==="."?"":r.dot?"(?!(?:^|\\/)\\.{1,2}(?:$|\\/))":"(?!\\.)";var S=this;function clearStateChar(){if(m){switch(m){case"*":n+=c;i=true;break;case"?":n+=a;i=true;break;default:n+="\\"+m;break}S.debug("clearStateChar %j %j",m,n);m=false}}for(var w=0,E=e.length,_;w-1;R--){var N=p[R];var M=n.slice(0,N.reStart);var D=n.slice(N.reStart,N.reEnd-8);var P=n.slice(N.reEnd-8,N.reEnd);var L=n.slice(N.reEnd);P+=L;var B=M.split("(").length-1;var j=L;for(w=0;w=0;s--){i=e[s];if(i)break}for(s=0;s>> no match, partial?",e,d,t,p);if(d===a)return true}return false}var m;if(typeof l==="string"){if(n.nocase){m=u.toLowerCase()===l.toLowerCase()}else{m=u===l}this.debug("string match",l,u,m)}else{m=u.match(l);this.debug("pattern match",l,u,m)}if(!m)return false}if(i===a&&s===c){return true}else if(i===a){return r}else if(s===c){var g=i===a-1&&e[i]==="";return g}throw new Error("wtf?")};function globUnescape(e){return e.replace(/\\(.)/g,"$1")}function regExpEscape(e){return e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&")}},1257:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.MongoMemoryServer=t.MongoMemoryServerStates=t.MongoMemoryServerEvents=void 0;const n=r(4351);const o=(0,n.__importStar)(r(8517));const i=(0,n.__importDefault)(r(3002));const s=r(1978);const a=r(843);const c=(0,n.__importDefault)(r(8237));const l=r(8614);const u=r(5747);const d=r(5517);const p=r(5911);const h=r(3386);const m=(0,c.default)("MongoMS:MongoMemoryServer");o.setGracefulCleanup();var g;(function(e){e["stateChange"]="stateChange"})(g=t.MongoMemoryServerEvents||(t.MongoMemoryServerEvents={}));var y;(function(e){e["new"]="new";e["starting"]="starting";e["running"]="running";e["stopped"]="stopped"})(y=t.MongoMemoryServerStates||(t.MongoMemoryServerStates={}));class MongoMemoryServer extends l.EventEmitter{constructor(e){super();this._state=y.new;this.opts=Object.assign({},e);if(!(0,s.isNullOrUndefined)(this.opts.auth)){this.auth=(0,s.authDefault)(this.opts.auth)}}static create(e){return(0,n.__awaiter)(this,void 0,void 0,(function*(){m("create: Called .create() method");const t=new MongoMemoryServer(Object.assign({},e));yield t.start();return t}))}start(e=false){var t;return(0,n.__awaiter)(this,void 0,void 0,(function*(){this.debug("start: Called .start() method");switch(this._state){case y.new:case y.stopped:break;case y.running:case y.starting:default:throw new h.StateError([y.new,y.stopped],this.state)}(0,s.assertion)((0,s.isNullOrUndefined)((t=this._instanceInfo)===null||t===void 0?void 0:t.instance.mongodProcess),new Error('Cannot start because "instance.mongodProcess" is already defined!'));this.stateChange(y.starting);yield this._startUpInstance(e).catch((e=>(0,n.__awaiter)(this,void 0,void 0,(function*(){if(!c.default.enabled("MongoMS:MongoMemoryServer")){console.warn("Starting the MongoMemoryServer Instance failed, enable debug log for more information. Error:\n",e)}this.debug("_startUpInstance threw a Error: ",e);yield this.stop({doCleanup:false,force:false});this.stateChange(y.stopped);throw e}))));this.stateChange(y.running);this.debug("start: Instance fully Started")}))}stateChange(e){this._state=e;this.emit(g.stateChange,e)}debug(e,...t){var r,n;const o=(n=(r=this._instanceInfo)===null||r===void 0?void 0:r.port)!==null&&n!==void 0?n:"unknown";m(`Mongo[${o}]: ${e}`,...t)}getNewPort(e){return(0,n.__awaiter)(this,void 0,void 0,(function*(){const t=yield(0,i.default)({port:e});if(e!=t&&typeof e==="number"){this.debug(`getNewPort: starting with port "${t}", since "${e}" was locked`)}return t}))}getStartOptions(e=false){var t,r,i;return(0,n.__awaiter)(this,void 0,void 0,(function*(){this.debug(`getStartOptions: forceSamePort: ${e}`);const n=(t=this.opts.instance)!==null&&t!==void 0?t:{};let a=true;let c=typeof n.port==="number"?n.port:undefined;if(!e||(0,s.isNullOrUndefined)(c)){c=yield this.getNewPort(c)}const l={port:c,dbName:(0,s.generateDbName)(n.dbName),ip:(r=n.ip)!==null&&r!==void 0?r:"127.0.0.1",storageEngine:(i=n.storageEngine)!==null&&i!==void 0?i:"ephemeralForTest",replSet:n.replSet,dbPath:n.dbPath,tmpDir:undefined};if((0,s.isNullOrUndefined)(this._instanceInfo)){if(!l.dbPath){l.tmpDir=o.dirSync({mode:493,prefix:"mongo-mem-",unsafeCleanup:true});l.dbPath=l.tmpDir.name;a=true}else{this.debug(`getStartOptions: Checking if "${l.dbPath}}" (no new tmpDir) already has data`);const e=yield u.promises.readdir(l.dbPath);a=e.length===0}}else{a=false}const d=(typeof n.auth==="boolean"?n.auth:true)&&!(0,s.isNullOrUndefined)(this.auth)&&!this.auth.disable&&(this.auth.force||a)&&!n.replSet;return{data:l,createAuth:d,mongodOptions:{instance:Object.assign(Object.assign({},l),{args:n.args,auth:d?false:n.auth}),binary:this.opts.binary,spawn:this.opts.spawn}}}))}_startUpInstance(e=false){var t;return(0,n.__awaiter)(this,void 0,void 0,(function*(){this.debug("_startUpInstance: Called MongoMemoryServer._startUpInstance() method");if(!(0,s.isNullOrUndefined)(this._instanceInfo)){this.debug('_startUpInstance: "instanceInfo" already defined, reusing instance');if(!e){const e=yield this.getNewPort(this._instanceInfo.port);this._instanceInfo.instance.instanceOpts.port=e;this._instanceInfo.port=e}yield this._instanceInfo.instance.start();return}const{mongodOptions:r,createAuth:n,data:o}=yield this.getStartOptions(e);this.debug(`_startUpInstance: Creating new MongoDB instance with options:`,r);const i=yield a.MongoInstance.create(r);this.debug(`_startUpInstance: Instance Started, createAuth: "${n}"`);if(!(0,s.isNullOrUndefined)(this.auth)&&n){this.debug(`_startUpInstance: Running "createAuth" (force: "${this.auth.force}")`);yield this.createAuth(o);if(o.storageEngine!=="ephemeralForTest"){this.debug("_startUpInstance: Killing No-Auth instance");yield i.stop();this.debug("_startUpInstance: Starting Auth Instance");i.instanceOpts.auth=true;yield i.start()}else{console.warn("Not Restarting MongoInstance for Auth\n"+'Storage engine is "ephemeralForTest", which does not write data on shutdown, and mongodb does not allow changing "auth" runtime')}}else{if((t=this.opts.auth)===null||t===void 0?void 0:t.disable){this.debug('_startUpInstance: AutomaticAuth.disable is set to "true" skipping "createAuth"')}}this._instanceInfo=Object.assign(Object.assign({},o),{dbPath:o.dbPath,instance:i})}))}stop(e){var t,r;return(0,n.__awaiter)(this,void 0,void 0,(function*(){this.debug("stop: Called .stop() method");let n={doCleanup:true,force:false};if(typeof e==="boolean"){n.doCleanup=e}if(typeof e==="object"){n=e}if((0,s.isNullOrUndefined)(this._instanceInfo)){this.debug('stop: "instanceInfo" is not defined (never ran?)');return false}if(this._state===y.stopped){this.debug('stop: state is "stopped", trying to stop / kill anyway')}this.debug(`stop: Stopping MongoDB server on port ${this._instanceInfo.port} with pid ${(r=(t=this._instanceInfo.instance)===null||t===void 0?void 0:t.mongodProcess)===null||r===void 0?void 0:r.pid}`);yield this._instanceInfo.instance.stop();this.stateChange(y.stopped);if(n.doCleanup){yield this.cleanup(n)}return true}))}cleanup(e){return(0,n.__awaiter)(this,void 0,void 0,(function*(){assertionIsMMSState(y.stopped,this.state);let t={doCleanup:true,force:false};if(typeof e==="boolean"){t.force=e}if(typeof e==="object"){t=e}this.debug(`cleanup:`,t);if(!t.doCleanup){this.debug('cleanup: "doCleanup" is set to false');return}if((0,s.isNullOrUndefined)(this._instanceInfo)){this.debug('cleanup: "instanceInfo" is undefined');return}(0,s.assertion)((0,s.isNullOrUndefined)(this._instanceInfo.instance.mongodProcess),new Error('Cannot cleanup because "instance.mongodProcess" is still defined'));const r=this._instanceInfo.tmpDir;if(!(0,s.isNullOrUndefined)(r)){this.debug(`cleanup: removing tmpDir at ${r.name}`);r.removeCallback()}if(t.force){const e=this._instanceInfo.dbPath;const t=yield(0,s.statPath)(e);if((0,s.isNullOrUndefined)(t)){this.debug(`cleanup: force is true, but path "${e}" dosnt exist anymore`)}else{(0,s.assertion)(t.isDirectory(),new Error("Defined dbPath is not an directory"));if((0,p.lt)(process.version,"14.14.0")){yield u.promises.rmdir(e,{recursive:true,maxRetries:1})}else{yield u.promises.rm(e,{recursive:true,maxRetries:1})}}}this.stateChange(y.new);this._instanceInfo=undefined}))}get instanceInfo(){return this._instanceInfo}get state(){return this._state}ensureInstance(){return(0,n.__awaiter)(this,void 0,void 0,(function*(){this.debug("ensureInstance: Called .ensureInstance() method");switch(this._state){case y.running:if(this._instanceInfo){return this._instanceInfo}throw new h.EnsureInstanceError(true);case y.new:case y.stopped:break;case y.starting:return new Promise(((e,t)=>this.once(g.stateChange,(r=>{if(r!=y.running){t(new Error(`"ensureInstance" waited for "running" but got an different state: "${r}"`));return}(0,s.assertion)(!(0,s.isNullOrUndefined)(this._instanceInfo),new Error("InstanceInfo is undefined!"));e(this._instanceInfo)}))));default:throw new h.StateError([y.running,y.new,y.stopped,y.starting],this.state)}this.debug('ensureInstance: no running instance, calling "start()" command');yield this.start();this.debug('ensureInstance: "start()" command was succesfully resolved');if(!this._instanceInfo){throw new h.EnsureInstanceError(false)}return this._instanceInfo}))}getUri(e,t){this.debug("getUri:",this.state,e,t);switch(this.state){case y.running:case y.starting:break;case y.stopped:default:throw new h.StateError([y.running,y.starting],this.state)}assertionInstanceInfo(this._instanceInfo);return(0,s.uriTemplate)(t||"127.0.0.1",this._instanceInfo.port,(0,s.generateDbName)(e))}createAuth(e){var t,r,o;return(0,n.__awaiter)(this,void 0,void 0,(function*(){(0,s.assertion)(!(0,s.isNullOrUndefined)(this.auth),new Error('"createAuth" got called, but "this.auth" is undefined!'));this.debug("createAuth: options:",this.auth);const n=yield d.MongoClient.connect((0,s.uriTemplate)(e.ip,e.port,"admin"),{});try{let e=n.db("admin");this.debug(`createAuth: Creating Root user, name: "${this.auth.customRootName}"`);yield e.command({createUser:this.auth.customRootName,pwd:this.auth.customRootPwd,mechanisms:["SCRAM-SHA-256"],customData:{createdBy:"mongodb-memory-server",as:"ROOTUSER"},roles:["root"],writeConcern:{w:"majority"}});if(this.auth.extraUsers.length>0){this.debug(`createAuth: Creating "${this.auth.extraUsers.length}" Custom Users`);this.auth.extraUsers.sort(((e,t)=>{if(e.database==="admin"){return-1}return e.database===t.database?0:1}));for(const i of this.auth.extraUsers){i.database=(0,s.isNullOrUndefined)(i.database)?"admin":i.database;if(i.database!==e.databaseName){e=n.db(i.database)}this.debug("createAuth: Creating User: ",i);yield e.command({createUser:i.createUser,pwd:i.pwd,customData:Object.assign(Object.assign({},i.customData),{createdBy:"mongodb-memory-server",as:"EXTRAUSER"}),roles:i.roles,authenticationRestrictions:(t=i.authenticationRestrictions)!==null&&t!==void 0?t:[],mechanisms:(r=i.mechanisms)!==null&&r!==void 0?r:["SCRAM-SHA-256"],digestPassword:(o=i.digestPassword)!==null&&o!==void 0?o:true})}}}finally{yield n.close()}}))}}t.MongoMemoryServer=MongoMemoryServer;t.default=MongoMemoryServer;function assertionInstanceInfo(e){(0,s.assertion)(!(0,s.isNullOrUndefined)(e),new Error('"instanceInfo" is undefined'))}function assertionIsMMSState(e,t){(0,s.assertion)(t===e,new h.StateError([e],t))}},8919:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.DryMongoBinary=void 0;const n=r(4351);const o=(0,n.__importDefault)(r(8237));const i=r(8730);const s=r(1978);const a=(0,n.__importStar)(r(5622));const c=r(2087);const l=(0,n.__importDefault)(r(7281));const u=r(8278);const d=r(3386);const p=r(1);const h=(0,o.default)("MongoMS:DryMongoBinary");class DryMongoBinary{static locateBinary(e){return(0,n.__awaiter)(this,void 0,void 0,(function*(){h(`locateBinary: Trying to locate Binary for version "${e.version}"`);const t=yield this.generateOptions(e);if(!!t.systemBinary){h(`locateBinary: env "SYSTEM_BINARY" was provided with value: "${t.systemBinary}"`);const e=yield this.getSystemPath(t.systemBinary);if((0,s.isNullOrUndefined)(e)){throw new d.NoSystemBinaryFoundError(t.systemBinary)}return e}if(this.binaryCache.has(e.version)){const t=this.binaryCache.get(e.version);h(`locateBinary: Requested Version found in cache: "[${e.version}, ${t}]"`);return t}h("locateBinary: running generateDownloadPath");const r=yield this.generateDownloadPath(t);if(!r[0]){h("locateBinary: could not find a existing binary");return undefined}h(`locateBinary: found binary at "${r[1]}"`);this.binaryCache.set(e.version,r[1]);return r[1]}))}static generateOptions(e){var t,r;return(0,n.__awaiter)(this,void 0,void 0,(function*(){h("generateOptions");const n=(t=(0,i.resolveConfig)(i.ResolveConfigVariables.VERSION))!==null&&t!==void 0?t:i.DEFAULT_VERSION;const o=(0,s.isNullOrUndefined)(e)?{version:n}:e;const l={version:o.version||n,downloadDir:(0,i.resolveConfig)(i.ResolveConfigVariables.DOWNLOAD_DIR)||o.downloadDir||"",os:(r=o.os)!==null&&r!==void 0?r:yield(0,u.getOS)(),platform:o.platform||(0,c.platform)(),arch:o.arch||(0,c.arch)(),systemBinary:(0,i.resolveConfig)(i.ResolveConfigVariables.SYSTEM_BINARY)||o.systemBinary||""};l.downloadDir=a.dirname((yield this.generateDownloadPath(l))[1]);if((0,i.resolveConfig)(i.ResolveConfigVariables.ARCHIVE_NAME)||(0,i.resolveConfig)(i.ResolveConfigVariables.DOWNLOAD_URL)){const e=(0,i.resolveConfig)(i.ResolveConfigVariables.DOWNLOAD_URL)||(0,i.resolveConfig)(i.ResolveConfigVariables.ARCHIVE_NAME);h(`generateOptions: ARCHIVE_NAME or DOWNLOAD_URL defined, generating options based on that (input: "${e}")`);return this.parseArchiveNameRegex(e,l)}return l}))}static parseArchiveNameRegex(e,t){h(`parseArchiveNameRegex (input: "${e}")`);const r=/mongodb-(?linux|win32|osx|macos)(?:-ssl-|-)(?\w{4,})(?:-(?\w+)|)(?:-ssl-|-)(?:v|)(?[\d.]+(?:-latest|))\./gim.exec(e);(0,s.assertion)(!(0,s.isNullOrUndefined)(r),new d.NoRegexMatchError("input"));(0,s.assertion)(!(0,s.isNullOrUndefined)(r.groups),new d.NoRegexMatchError("input","groups"));const n=r.groups;(0,s.assertion)(typeof n.version==="string"&&n.version.length>1,new d.ParseArchiveRegexError("version"));(0,s.assertion)(typeof n.platform==="string"&&n.platform.length>1,new d.ParseArchiveRegexError("platform"));(0,s.assertion)(typeof n.arch==="string"&&n.arch.length>=4,new d.ParseArchiveRegexError("arch"));t.version=n.version;t.arch=n.arch;if(n.platform==="linux"){const e=!!n.dist?/([a-z]+)(\d*)/gim.exec(n.dist):null;t.os={os:"linux",dist:typeof(e===null||e===void 0?void 0:e[1])==="string"?e[1]:"unknown",release:""}}else{t.os={os:n.platform}}return t}static getBinaryName(e){return(0,n.__awaiter)(this,void 0,void 0,(function*(){h("getBinaryName");let t;if((0,i.envToBool)((0,i.resolveConfig)(i.ResolveConfigVariables.USE_ARCHIVE_NAME_FOR_BINARY_NAME))){const r=yield new p.MongoBinaryDownloadUrl(e).getArchiveName();t=a.parse(r).name}else{const r=e.platform==="win32"?".exe":"";const n=(0,u.isLinuxOS)(e.os)?e.os.dist:e.os.os;t=`mongod-${e.arch}-${n}-${e.version}${r}`}return t}))}static combineBinaryName(e,t){h("combineBinaryName");return a.resolve(e,t)}static getSystemPath(e){return(0,n.__awaiter)(this,void 0,void 0,(function*(){h("getSystempath");try{yield(0,s.checkBinaryPermissions)(e);h(`getSystemPath: found system binary path at "${e}"`);return e}catch(t){h(`getSystemPath: can't find system binary at "${e}".\n${t instanceof Error?t.message:t}`)}return undefined}))}static generatePaths(e){return(0,n.__awaiter)(this,void 0,void 0,(function*(){h("generatePaths",e);const t={legacyHomeCache:"",modulesCache:"",relative:"",resolveConfig:""};const r=yield this.getBinaryName(e);let n=process.env["INIT_CWD"]||process.cwd();while(n.includes(`node_modules${a.sep}mongodb-memory-server`)){n=a.resolve(n,"..","..")}const o=(0,l.default)({name:"mongodb-memory-server",cwd:n});if(!(0,s.isNullOrUndefined)(o)){t.modulesCache=this.combineBinaryName(a.resolve(o),r)}const c=a.resolve(this.homedir(),".cache/mongodb-binaries");t.legacyHomeCache=this.combineBinaryName(c,r);const u=e.downloadDir||(0,i.resolveConfig)(i.ResolveConfigVariables.DOWNLOAD_DIR);if(!(0,s.isNullOrUndefined)(u)&&u.length>0){h(`generatePaths: resolveConfigValue is not empty`);t.resolveConfig=this.combineBinaryName(u,r)}t.relative=this.combineBinaryName(a.resolve(process.cwd(),"mongodb-binaries"),r);return t}))}static generateDownloadPath(e){return(0,n.__awaiter)(this,void 0,void 0,(function*(){const t=(0,i.envToBool)((0,i.resolveConfig)(i.ResolveConfigVariables.PREFER_GLOBAL_PATH));h(`generateDownloadPath: Generating Download Path, preferGlobal: "${t}"`);const r=yield this.generatePaths(e);h("generateDownloadPath: Paths:",r,e.systemBinary);if(!!e.systemBinary&&(yield(0,s.pathExists)(e.systemBinary))){const t=yield this.getSystemPath(e.systemBinary);if(!(0,s.isNullOrUndefined)(t)){return[true,t]}}if(yield(0,s.pathExists)(r.resolveConfig)){h(`generateDownloadPath: Found binary in resolveConfig (DOWNLOAD_DIR): "${r.resolveConfig}"`);return[true,r.resolveConfig]}if(yield(0,s.pathExists)(r.legacyHomeCache)){h(`generateDownloadPath: Found binary in legacyHomeCache: "${r.legacyHomeCache}"`);return[true,r.legacyHomeCache]}if(yield(0,s.pathExists)(r.modulesCache)){h(`generateDownloadPath: Found binary in modulesCache: "${r.modulesCache}"`);return[true,r.modulesCache]}if(yield(0,s.pathExists)(r.relative)){h(`generateDownloadPath: Found binary in relative: "${r.relative}"`);return[true,r.relative]}h(`generateDownloadPath: no existing binary for version "${e.version}" was found`);if(r.resolveConfig.length>0){h(`generateDownloadPath: using resolveConfig (DOWNLOAD_DIR) "${r.resolveConfig}"`);return[false,r.resolveConfig]}if(t&&!!r.legacyHomeCache){h(`generateDownloadPath: using global (preferGlobal) "${r.legacyHomeCache}"`);return[false,r.legacyHomeCache]}if(r.modulesCache.length>0){h(`generateDownloadPath: using modulesCache "${r.modulesCache}"`);return[false,r.modulesCache]}h(`generateDownloadPath: using relative "${r.relative}"`);return[false,r.relative]}))}static homedir(){return(0,c.homedir)()}}t.DryMongoBinary=DryMongoBinary;DryMongoBinary.binaryCache=new Map},9125:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.MongoBinary=void 0;const n=r(4351);const o=(0,n.__importDefault)(r(2087));const i=(0,n.__importDefault)(r(5622));const s=(0,n.__importDefault)(r(229));const a=(0,n.__importStar)(r(8730));const c=(0,n.__importDefault)(r(8237));const l=(0,n.__importStar)(r(5911));const u=r(1978);const d=r(3129);const p=r(4908);const h=r(8919);const m=(0,c.default)("MongoMS:MongoBinary");class MongoBinary{static download(e){return(0,n.__awaiter)(this,void 0,void 0,(function*(){m("download");const{downloadDir:t,version:r}=e;yield(0,u.mkdir)(t);const n=i.default.resolve(t,`${r}.lock`);m(`download: Waiting to acquire Download lock for file "${n}"`);const o=yield p.LockFile.lock(n);m("download: Download lock acquired");try{if(!h.DryMongoBinary.binaryCache.has(r)){m(`download: Adding version ${r} to cache`);const t=new s.default(e);h.DryMongoBinary.binaryCache.set(r,yield t.getMongodPath())}}finally{m("download: Removing Download lock");yield o.unlock();m("download: Download lock removed")}const a=h.DryMongoBinary.binaryCache.get(r);(0,u.assertion)(typeof a==="string",new Error(`No Cache Path for version "${r}" found (and download failed silently?)`));return a}))}static getPath(e={}){return(0,n.__awaiter)(this,void 0,void 0,(function*(){m("getPath");const t=Object.assign(Object.assign({},yield h.DryMongoBinary.generateOptions(e)),{platform:e.platform||(0,a.default)(a.ResolveConfigVariables.PLATFORM)||o.default.platform(),checkMD5:e.checkMD5||(0,a.envToBool)((0,a.default)(a.ResolveConfigVariables.MD5_CHECK))});m(`getPath: MongoBinary options:`,JSON.stringify(t,null,2));let r=yield h.DryMongoBinary.locateBinary(t);if(!!t.systemBinary){if(!(0,u.isNullOrUndefined)(r)){m(`getPath: Spawning binaryPath "${r}" to get version`);const e=(0,d.spawnSync)(r,["--version"]).stdout.toString().match(/^\s*db\s+version\s+v?(\d+\.\d+\.\d+)(-\d*)?(-[a-zA-Z0-9].*)?\s*$/im);(0,u.assertion)(!(0,u.isNullOrUndefined)(e),new Error("Couldnt find an version from system binary output!"));if((0,a.envToBool)((0,a.default)(a.ResolveConfigVariables.SYSTEM_BINARY_VERSION_CHECK))){m("getPath: Checking & Warning about version conflicts");const r=e[1];if(l.neq(t.version,r)){console.warn("getPath: MongoMemoryServer: Possible version conflict\n"+` SystemBinary version: "${r}"\n`+` Requested version: "${t.version}"\n\n`+" Using SystemBinary!")}}}else{throw new Error('Option "SYSTEM_BINARY" was set, but binaryPath was empty! (system binary could not be found?) [This Error should normally not be thrown, please report this]')}}(0,u.assertion)(typeof t.version==="string",new Error('"MongoBinary.options.version" is not an string!'));if(!r){if((0,a.envToBool)((0,a.default)(a.ResolveConfigVariables.RUNTIME_DOWNLOAD))){m('getPath: "RUNTIME_DOWNLOAD" is "true", trying to download');r=yield this.download(t)}else{m('getPath: "RUNTIME_DOWNLOAD" is "false", not downloading')}}if(!r){const e=(0,a.envToBool)((0,a.default)(a.ResolveConfigVariables.RUNTIME_DOWNLOAD));throw new Error(`MongoBinary.getPath: could not find an valid binary path! (Got: "${r}", RUNTIME_DOWNLOAD: "${e}")`)}m(`getPath: Mongod binary path: "${r}"`);return r}))}}t.MongoBinary=MongoBinary;t.default=MongoBinary},229:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.MongoBinaryDownload=void 0;const n=r(4351);const o=(0,n.__importDefault)(r(2087));const i=r(8835);const s=(0,n.__importDefault)(r(5622));const a=r(5747);const c=(0,n.__importDefault)(r(1446));const l=(0,n.__importDefault)(r(7211));const u=r(8761);const d=(0,n.__importDefault)(r(2283));const p=(0,n.__importDefault)(r(8781));const h=(0,n.__importDefault)(r(1));const m=r(7219);const g=(0,n.__importStar)(r(8730));const y=(0,n.__importDefault)(r(8237));const v=r(1978);const b=r(8919);const S=r(1058);const w=r(3386);const E=(0,y.default)("MongoMS:MongoBinaryDownload");class MongoBinaryDownload{constructor(e){var t,r,n,i,s,a;(0,v.assertion)(typeof e.downloadDir==="string",new Error("An DownloadDir must be specified!"));const c=(t=e.version)!==null&&t!==void 0?t:(0,g.default)(g.ResolveConfigVariables.VERSION);(0,v.assertion)(typeof c==="string",new Error("An MongoDB Binary version must be specified!"));this.binaryOpts={platform:(r=e.platform)!==null&&r!==void 0?r:o.default.platform(),arch:(n=e.arch)!==null&&n!==void 0?n:o.default.arch(),version:c,downloadDir:e.downloadDir,checkMD5:(i=e.checkMD5)!==null&&i!==void 0?i:(0,g.envToBool)((0,g.default)(g.ResolveConfigVariables.MD5_CHECK)),systemBinary:(s=e.systemBinary)!==null&&s!==void 0?s:"",os:(a=e.os)!==null&&a!==void 0?a:{os:"unknown"}};this.dlProgress={current:0,length:0,totalMb:0,lastPrintedAt:0}}get checkMD5(){return this.binaryOpts.checkMD5}set checkMD5(e){this.binaryOpts.checkMD5=e}get downloadDir(){return this.binaryOpts.downloadDir}set downloadDir(e){this.binaryOpts.downloadDir=e}get arch(){return this.binaryOpts.arch}set arch(e){this.binaryOpts.arch=e}get version(){return this.binaryOpts.version}set version(e){this.binaryOpts.version=e}get platform(){return this.binaryOpts.platform}set platform(e){this.binaryOpts.platform=e}getPath(){return(0,n.__awaiter)(this,void 0,void 0,(function*(){const e=yield b.DryMongoBinary.generateOptions(this.binaryOpts);return b.DryMongoBinary.combineBinaryName(this.downloadDir,yield b.DryMongoBinary.getBinaryName(e))}))}getMongodPath(){return(0,n.__awaiter)(this,void 0,void 0,(function*(){E("getMongodPath");const e=yield this.getPath();if(yield(0,v.pathExists)(e)){E(`getMongodPath: mongod path "${e}" already exists, using this`);return e}const t=yield this.startDownload();yield this.extract(t);yield a.promises.unlink(t);if(yield(0,v.pathExists)(e)){return e}throw new Error(`Cannot find downloaded mongod binary by path "${e}"`)}))}startDownload(){return(0,n.__awaiter)(this,void 0,void 0,(function*(){E("startDownload");const e=new h.default(this.binaryOpts);yield(0,v.mkdir)(this.downloadDir);try{yield a.promises.access(this.downloadDir,a.constants.X_OK|a.constants.W_OK)}catch(e){console.error(`Download Directory at "${this.downloadDir}" does not have sufficient permissions to be used by this process\n`+"Needed Permissions: Write & Execute (-wx)\n");throw e}const t=yield e.getDownloadUrl();const r=yield this.download(t);yield this.makeMD5check(`${t}.md5`,r);return r}))}makeMD5check(e,t){return(0,n.__awaiter)(this,void 0,void 0,(function*(){E("makeMD5check: Checking MD5 of downloaded binary...");if(!this.checkMD5){E("makeMD5check: checkMD5 is disabled");return undefined}const r=yield this.download(e);const n=(yield a.promises.readFile(r)).toString("utf-8");const o=n.match(/^\s*([\w\d]+)\s*/i);const i=o?o[1]:null;const s=c.default.sync(t);E(`makeMD5check: Local MD5: ${s}, Remote MD5: ${i}`);if(i!==s){throw new w.Md5CheckFailedError(s,i||"unknown")}yield a.promises.unlink(r);return true}))}download(e){return(0,n.__awaiter)(this,void 0,void 0,(function*(){E("download");const t=process.env["yarn_https-proxy"]||process.env.yarn_proxy||process.env["npm_config_https-proxy"]||process.env.npm_config_proxy||process.env.https_proxy||process.env.http_proxy||process.env.HTTPS_PROXY||process.env.HTTP_PROXY;const r=process.env.npm_config_strict_ssl==="true";const n=new i.URL(e);n.port=n.port||"443";const o={method:"GET",rejectUnauthorized:r,protocol:(0,g.envToBool)((0,g.default)(g.ResolveConfigVariables.USE_HTTP))?"http:":"https:",agent:t?new m.HttpsProxyAgent(t):undefined};const a=n.pathname.split("/").pop();if(!a){throw new Error(`MongoBinaryDownload: missing filename for url "${e}"`)}const c=s.default.resolve(this.downloadDir,a);const l=s.default.resolve(this.downloadDir,`${a}.downloading`);E(`download: Downloading${t?` via proxy "${t}"`:""}: "${e}"`);if(yield(0,v.pathExists)(c)){E("download: Already downloaded archive found, skipping download");return c}this.assignDownloadingURL(n);const u=yield this.httpDownload(n,o,c,l);return u}))}extract(e){var t,r;return(0,n.__awaiter)(this,void 0,void 0,(function*(){E("extract");const n=yield this.getPath();E(`extract: archive: "${e}" final: "${n}"`);yield(0,v.mkdir)(s.default.dirname(n));const filter=e=>/(?:bin\/(?:mongod(?:\.exe)?)|(?:.*\.dll))$/i.test(e);if(/(.tar.gz|.tgz)$/.test(e)){yield this.extractTarGz(e,n,filter)}else if(/.zip$/.test(e)){yield this.extractZip(e,n,filter)}else{throw new Error(`MongoBinaryDownload: unsupported archive "${e}" (downloaded from "${(t=this._downloadingUrl)!==null&&t!==void 0?t:"unknown"}"). Broken archive from MongoDB Provider?`)}if(!(yield(0,v.pathExists)(n))){throw new Error(`MongoBinaryDownload: missing mongod binary in "${e}" (downloaded from "${(r=this._downloadingUrl)!==null&&r!==void 0?r:"unknown"}"). Broken archive from MongoDB Provider?`)}return n}))}extractTarGz(e,t,r){return(0,n.__awaiter)(this,void 0,void 0,(function*(){E("extractTarGz");const n=d.default.extract();n.on("entry",((e,n,o)=>{if(r(e.name)){n.pipe((0,a.createWriteStream)(t,{mode:509}))}n.on("end",(()=>o()));n.resume()}));return new Promise(((t,r)=>{(0,a.createReadStream)(e).on("error",(t=>{r("Unable to open tarball "+e+": "+t)})).pipe((0,u.createUnzip)()).on("error",(t=>{r("Error during unzip for "+e+": "+t)})).pipe(n).on("error",(t=>{r("Error during untar for "+e+": "+t)})).on("finish",(e=>{t(e)}))}))}))}extractZip(e,t,r){return(0,n.__awaiter)(this,void 0,void 0,(function*(){E("extractZip");return new Promise(((n,o)=>{p.default.open(e,{lazyEntries:true},((e,i)=>{if(e||!i){return o(e)}i.readEntry();i.on("end",(()=>n()));i.on("entry",(e=>{if(!r(e.fileName)){return i.readEntry()}i.openReadStream(e,((e,r)=>{if(e||!r){return o(e)}r.on("end",(()=>i.readEntry()));r.pipe((0,a.createWriteStream)(t,{mode:509}))}))}))}))}))}))}httpDownload(e,t,r,o){return(0,n.__awaiter)(this,void 0,void 0,(function*(){E("httpDownload");const i=this.assignDownloadingURL(e);return new Promise(((s,c)=>{E(`httpDownload: trying to download "${i}"`);l.default.get(e,t,(e=>{if(e.statusCode!=200){if(e.statusCode===403){c(new Error("Status Code is 403 (MongoDB's 404)\n"+"This means that the requested version-platform combination doesn't exist\n"+` Used Url: "${i}"\n`+"Try to use different version 'new MongoMemoryServer({ binary: { version: 'X.Y.Z' } })'\n"+"List of available versions can be found here:\n"+" https://www.mongodb.org/dl/linux for Linux\n"+" https://www.mongodb.org/dl/osx for OSX\n"+" https://www.mongodb.org/dl/win32 for Windows"));return}c(new Error("Status Code isnt 200!"));return}if(typeof e.headers["content-length"]!="string"){c(new Error('Response header "content-length" is empty!'));return}this.dlProgress.current=0;this.dlProgress.length=parseInt(e.headers["content-length"],10);this.dlProgress.totalMb=Math.round(this.dlProgress.length/1048576*10)/10;const l=(0,a.createWriteStream)(o);e.pipe(l);l.on("finish",(()=>(0,n.__awaiter)(this,void 0,void 0,(function*(){var e;if(this.dlProgress.current{this.printDownloadProgress(e)}))})).on("error",(e=>{console.error(`Couldnt download "${i}"!`,e.message);c(e)}))}))}))}printDownloadProgress(e,t=false){this.dlProgress.current+=e.length;const r=Date.now();if(r-this.dlProgress.lastPrintedAt<2e3&&!t){return}this.dlProgress.lastPrintedAt=r;const n=Math.round(100*this.dlProgress.current/this.dlProgress.length*10)/10;const o=Math.round(this.dlProgress.current/1048576*10)/10;const i=this.platform==="win32"?"":"\r";const s=`Downloading MongoDB "${this.version}": ${n}% (${o}mb / ${this.dlProgress.totalMb}mb)${i}`;if(process.stdout.isTTY){(0,S.clearLine)(process.stdout,0);process.stdout.write(s)}else{console.log(s)}}assignDownloadingURL(e){this._downloadingUrl=e.href;return this._downloadingUrl}}t.MongoBinaryDownload=MongoBinaryDownload;t.default=MongoBinaryDownload},1:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.MongoBinaryDownloadUrl=void 0;const n=r(4351);const o=r(8278);const i=r(8730);const s=(0,n.__importDefault)(r(8237));const a=(0,n.__importStar)(r(5911));const c=r(1978);const l=r(8835);const u=r(3386);const d=r(1669);const p=(0,s.default)("MongoMS:MongoBinaryDownloadUrl");class MongoBinaryDownloadUrl{constructor(e){this.version=e.version;this.platform=this.translatePlatform(e.platform);this.arch=MongoBinaryDownloadUrl.translateArch(e.arch,this.platform);this.os=e.os}getDownloadUrl(){var e;return(0,n.__awaiter)(this,void 0,void 0,(function*(){const t=(0,i.resolveConfig)(i.ResolveConfigVariables.DOWNLOAD_URL);if(t){p(`Using "${t}" as the Download-URL`);const e=new l.URL(t);return e.toString()}const r=yield this.getArchiveName();p(`Using "${r}" as the Archive String`);const n=(e=(0,i.resolveConfig)(i.ResolveConfigVariables.DOWNLOAD_MIRROR))!==null&&e!==void 0?e:"https://fastdl.mongodb.org";p(`Using "${n}" as the mirror`);const o=new l.URL(n);if(!o.pathname.endsWith("/")){o.pathname=o.pathname+"/"}o.pathname=`${o.pathname}${this.platform}/${r}`;return o.toString()}))}getArchiveName(){return(0,n.__awaiter)(this,void 0,void 0,(function*(){const e=(0,i.resolveConfig)(i.ResolveConfigVariables.ARCHIVE_NAME);if(!!e){return e}switch(this.platform){case"osx":return this.getArchiveNameOsx();case"win32":case"windows":return this.getArchiveNameWin();case"linux":return this.getArchiveNameLinux();default:throw new u.UnknownPlatformError(this.platform)}}))}getArchiveNameWin(){let e=`mongodb-${this.platform}-${this.arch}`;if(!(0,c.isNullOrUndefined)(a.coerce(this.version))){if(a.satisfies(this.version,"4.2.x")){e+="-2012plus"}else if(a.lt(this.version,"4.1.0")){e+="-2008plus-ssl"}}e+=`-${this.version}.zip`;return e}getArchiveNameOsx(){let e=`mongodb-osx`;const t=a.coerce(this.version);if(!(0,c.isNullOrUndefined)(t)&&a.gte(t,"3.2.0")){e+="-ssl"}if((0,c.isNullOrUndefined)(t)||a.gte(t,"4.2.0")){e=`mongodb-macos`}if(this.arch==="arm64"){p('getArchiveNameOsx: Arch is "arm64", using x64 binary');this.arch="x86_64"}e+=`-${this.arch}-${this.version}.tgz`;return e}getArchiveNameLinux(){return(0,n.__awaiter)(this,void 0,void 0,(function*(){let e;if(this.arch!=="i686"){if(!this.os){this.os=yield(0,o.getOS)()}e=this.getLinuxOSVersionString(this.os)}let t=`mongodb-linux-${this.arch}`;if(!!e){t+=`-${e}`}t+=`-${this.version}.tgz`;return t}))}getLinuxOSVersionString(e){var t;if(regexHelper(/ubuntu/i,e)){return this.getUbuntuVersionString(e)}else if(regexHelper(/amzn/i,e)){return this.getAmazonVersionString(e)}else if(regexHelper(/suse/i,e)){return this.getSuseVersionString(e)}else if(regexHelper(/(rhel|centos|scientific)/i,e)){return this.getRhelVersionString(e)}else if(regexHelper(/fedora/i,e)){return this.getFedoraVersionString(e)}else if(regexHelper(/debian/i,e)){return this.getDebianVersionString(e)}else if(regexHelper(/alpine/i,e)){console.warn("There is no offical build of MongoDB for Alpine!")}else if(regexHelper(/(arch|manjaro|arco)(?:linux)?$/i,e)){console.warn(`There is no official build of MongoDB for ArchLinux (${e.dist}). Falling back to Ubuntu 20.04 release.`);return this.getUbuntuVersionString({os:"linux",dist:"Ubuntu Linux",release:"20.04"})}else if(regexHelper(/gentoo/i,e)){console.warn(`There is no official build of MongoDB for Gentoo (${e.dist}). Falling back to Debian.`);return this.getDebianVersionString({os:"linux",dist:"Debian",release:"11"})}else if(regexHelper(/unknown/i,e)){console.warn("Couldnt parse dist information, please report this to https://github.com/nodkz/mongodb-memory-server/issues")}console.warn(`Unknown/unsupported linux "${e.dist}(${(t=e.id_like)===null||t===void 0?void 0:t.join(", ")})". Falling back to legacy MongoDB build!`);return this.getLegacyVersionString()}getDebianVersionString(e){let t="debian";const r=parseFloat(e.release);if(r>=11||["unstable","testing"].includes(e.release)){if(a.lt(this.version,"5.0.8")){p("debian11 detected, but version below 5.0.8 requested, using debian10");t+="10"}else{t+="11"}}else if(r>=10){t+="10"}else if(r>=9){t+="92"}else if(r>=8.1){t+="81"}else if(r>=7.1){t+="71"}if(r>=10){if(a.lt(this.version,"4.2.1")){throw new u.KnownVersionIncompatibilityError(`Debian ${r}`,this.version,">=4.2.1","Mongodb does not provide binaries for versions before 4.2.1 for Debian 10+ and also cannot be mapped to a previous Debian release")}}return t}getFedoraVersionString(e){let t="rhel";const r=parseInt(e.release,10);if(r>=34){t+="80"}if(r<34&&r>=19){t+="70"}if(r<19&&r>=12){t+="62"}if(r<12&&r>=6){t+="55"}return t}getRhelVersionString(e){let t="rhel";const{release:r}=e;if(r){if(/^8/.test(r)){t+="80"}else if(/^7/.test(r)){t+="70"}else if(/^6/.test(r)){t+="62"}else if(/^5/.test(r)){t+="55"}}if(t==="rhel"){p('getRhelVersionString: falling back to "70"');t+="70"}return t}getAmazonVersionString(e){let t="amazon";const r=parseInt(e.release,10);if(r>=2&&r<=3){t+="2"}return t}getLegacyVersionString(){return""}getSuseVersionString(e){const t=e.release.match(/(^11|^12|^15)/);return t?`suse${t[0]}`:""}getUbuntuVersionString(e){let t=undefined;{if(/^linux\s?mint\s*$/i.test(e.dist)){const r={17:"14.04",18:"16.04",19:"18.04",20:"20.04"};t={os:"linux",dist:"ubuntu",release:r[parseInt(e.release.split(".")[0])]||r[20]}}if(/^elementary\s?os\s*$/i.test(e.dist)){const r={3:"14.04",4:"16.04",5:"18.04",6:"20.04"};const[n,o]=e.release.split(".").map((e=>parseInt(e)));const i=n||o;t={os:"linux",dist:"ubuntu",release:r[i]||r[6]}}}if((0,c.isNullOrUndefined)(t)){if(!/^ubuntu(?:| linux)\s*$/i.test(e.dist)){console.warn(`Unmapped distro "${e.dist}" with ID_LIKE "ubuntu", defaulting to highest ubuntu version!\n`+'This means that your distro does not have a internal mapping in MMS or does not have a upstream release file (like "/etc/upstream-release/lsb-release"), but has set a ID_LIKE');t={os:"linux",dist:"ubuntu",release:"20.04"}}else{t=e}}const r=parseInt(t.release.split(".")[0],10);if(this.arch==="arm64"){if(a.satisfies(this.version,"<4.1.10")){this.arch="arm64";return"ubuntu1604"}if(a.satisfies(this.version,">=4.1.10")){this.arch="aarch64";if(a.satisfies(this.version,"<4.4.0")){return"ubuntu1804"}return`ubuntu${r||18}04`}}if(t.release==="14.10"){return"ubuntu1410-clang"}if(r>=18&&a.satisfies(this.version,"3.x.x")){p(`getUbuntuVersionString: ubuntuYear is "${r}", which dosnt have an 3.x.x version, defaulting to "1604"`);return"ubuntu1604"}if(r>18&&a.satisfies(this.version,"<=4.3.x")){p(`getUbuntuVersionString: ubuntuYear is "${r}", which dosnt have an "<=4.3.x" version, defaulting to "1804"`);return"ubuntu1804"}if(r>=21){return"ubuntu2004"}return`ubuntu${r||14}04`}translatePlatform(e){switch(e){case"darwin":return"osx";case"win32":const t=a.coerce(this.version);if((0,c.isNullOrUndefined)(t)){return"windows"}return a.gte(t,"4.3.0")?"windows":"win32";case"linux":case"elementary OS":return"linux";case"sunos":return"sunos5";default:throw new u.UnknownPlatformError(e)}}static translateArch(e,t){switch(e){case"ia32":(0,d.deprecate)((()=>{}),"mongodb-memory-server will fully drop support for ia32 in 9.0","MMS001")();if(t==="linux"){return"i686"}else if(t==="win32"){return"i386"}throw new u.UnknownArchitectureError(e,t);case"x86_64":case"x64":return"x86_64";case"arm64":return"arm64";case"aarch64":return"aarch64";default:throw new u.UnknownArchitectureError(e)}}}t.MongoBinaryDownloadUrl=MongoBinaryDownloadUrl;t.default=MongoBinaryDownloadUrl;function regexHelper(e,t){return e.test(t.dist)||(!(0,c.isNullOrUndefined)(t.id_like)?t.id_like.filter((t=>e.test(t))).length>=1:false)}},843:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.MongoInstance=t.MongoInstanceEvents=void 0;const n=r(4351);const o=r(3129);const i=(0,n.__importStar)(r(5622));const s=r(9125);const a=(0,n.__importDefault)(r(8237));const c=r(1978);const l=r(5911);const u=r(8614);const d=r(5517);const p=r(3386);if((0,l.lt)(process.version,"12.22.0")){console.warn("Using NodeJS below 12.22.0")}const h=(0,a.default)("MongoMS:MongoInstance");var m;(function(e){e["instanceReplState"]="instanceReplState";e["instancePrimary"]="instancePrimary";e["instanceReady"]="instanceReady";e["instanceSTDOUT"]="instanceSTDOUT";e["instanceSTDERR"]="instanceSTDERR";e["instanceClosed"]="instanceClosed";e["instanceRawError"]="instanceRawError";e["instanceError"]="instanceError";e["killerLaunched"]="killerLaunched";e["instanceLaunched"]="instanceLaunched";e["instanceStarted"]="instanceStarted"})(m=t.MongoInstanceEvents||(t.MongoInstanceEvents={}));class MongoInstance extends u.EventEmitter{constructor(e){super();this.isInstancePrimary=false;this.isInstanceReady=false;this.isReplSet=false;this.instanceOpts=Object.assign({},e.instance);this.binaryOpts=Object.assign({},e.binary);this.spawnOpts=Object.assign({},e.spawn);this.on(m.instanceReady,(()=>{this.isInstanceReady=true;this.debug("constructor: Instance is ready!")}));this.on(m.instanceError,(e=>(0,n.__awaiter)(this,void 0,void 0,(function*(){this.debug(`constructor: Instance has thrown an Error: ${e.toString()}`);this.isInstanceReady=false;this.isInstancePrimary=false;yield this.stop()}))))}debug(e,...t){var r;const n=(r=this.instanceOpts.port)!==null&&r!==void 0?r:"unknown";h(`Mongo[${n}]: ${e}`,...t)}static create(e){return(0,n.__awaiter)(this,void 0,void 0,(function*(){h("create: Called .create() method");const t=new this(e);yield t.start();return t}))}prepareCommandArgs(){var e;this.debug("prepareCommandArgs");(0,c.assertion)(!(0,c.isNullOrUndefined)(this.instanceOpts.port),new Error('"instanceOpts.port" is required to be set!'));(0,c.assertion)(!(0,c.isNullOrUndefined)(this.instanceOpts.dbPath),new Error('"instanceOpts.dbPath" is required to be set!'));const t=[];t.push("--port",this.instanceOpts.port.toString());t.push("--dbpath",this.instanceOpts.dbPath);if(!!this.instanceOpts.replSet){this.isReplSet=true;t.push("--replSet",this.instanceOpts.replSet)}if(!!this.instanceOpts.storageEngine){t.push("--storageEngine",this.instanceOpts.storageEngine)}if(!!this.instanceOpts.ip){t.push("--bind_ip",this.instanceOpts.ip)}if(this.instanceOpts.auth){t.push("--auth");if(this.isReplSet){(0,c.assertion)(!(0,c.isNullOrUndefined)(this.instanceOpts.keyfileLocation),new p.KeyFileMissingError);t.push("--keyFile",this.instanceOpts.keyfileLocation)}}else{t.push("--noauth")}const r=t.concat((e=this.instanceOpts.args)!==null&&e!==void 0?e:[]);this.debug("prepareCommandArgs: final argument array:"+JSON.stringify(r));return r}start(){return(0,n.__awaiter)(this,void 0,void 0,(function*(){this.debug("start");this.isInstancePrimary=false;this.isInstanceReady=false;this.isReplSet=false;const e=new Promise(((e,t)=>{this.once(m.instanceReady,e);this.once(m.instanceError,t);this.once(m.instanceClosed,(()=>{t(new Error("Instance Exited before being ready and without throwing an error!"))}))}));const t=yield s.MongoBinary.getPath(this.binaryOpts);yield(0,c.checkBinaryPermissions)(t);this.debug("start: Starting Processes");this.mongodProcess=this._launchMongod(t);(0,c.assertion)(!(0,c.isNullOrUndefined)(this.mongodProcess.pid),new Error("MongoD Process failed to spawn"));this.killerProcess=this._launchKiller(process.pid,this.mongodProcess.pid);yield e;this.emit(m.instanceStarted);this.debug("start: Processes Started")}))}stop(){return(0,n.__awaiter)(this,void 0,void 0,(function*(){this.debug("stop");if(!this.mongodProcess&&!this.killerProcess){this.debug("stop: nothing to shutdown, returning");return false}if(!(0,c.isNullOrUndefined)(this.mongodProcess)){if(this.isReplSet){let e;try{this.debug("stop: trying shutdownServer");const t=this.instanceOpts.port;const r=this.instanceOpts.ip;(0,c.assertion)(!(0,c.isNullOrUndefined)(t),new Error('Cannot shutdown replset gracefully, no "port" is provided'));(0,c.assertion)(!(0,c.isNullOrUndefined)(r),new Error('Cannot shutdown replset gracefully, no "ip" is provided'));e=yield d.MongoClient.connect((0,c.uriTemplate)(r,t,"admin"),Object.assign(Object.assign({},this.extraConnectionOptions),{directConnection:true}));const n=e.db("admin");yield n.command({shutdown:1,force:true,timeoutSecs:1});this.debug("stop: after admin shutdown command")}catch(e){if(!(e instanceof d.MongoNetworkError&&/^connection \d+ to [\d.]+:\d+ closed$/i.test(e.message))){console.warn(e)}}finally{if(!(0,c.isNullOrUndefined)(e)){yield e.close()}}}yield(0,c.killProcess)(this.mongodProcess,"mongodProcess",this.instanceOpts.port);this.mongodProcess=undefined}else{this.debug("stop: mongodProcess: nothing to shutdown, skipping")}if(!(0,c.isNullOrUndefined)(this.killerProcess)){yield(0,c.killProcess)(this.killerProcess,"killerProcess",this.instanceOpts.port);this.killerProcess=undefined}else{this.debug("stop: killerProcess: nothing to shutdown, skipping")}this.debug("stop: Instance Finished Shutdown");return true}))}_launchMongod(e){var t,r;this.debug("_launchMongod: Launching Mongod Process");const n=(0,o.spawn)(i.resolve(e),this.prepareCommandArgs(),Object.assign(Object.assign({},this.spawnOpts),{stdio:"pipe"}));(t=n.stderr)===null||t===void 0?void 0:t.on("data",this.stderrHandler.bind(this));(r=n.stdout)===null||r===void 0?void 0:r.on("data",this.stdoutHandler.bind(this));n.on("close",this.closeHandler.bind(this));n.on("error",this.errorHandler.bind(this));if((0,c.isNullOrUndefined)(n.pid)){throw new p.StartBinaryFailedError(i.resolve(e))}this.emit(m.instanceLaunched);return n}_launchKiller(e,t){this.debug(`_launchKiller: Launching Killer Process (parent: ${e}, child: ${t})`);const r=(0,o.fork)(i.resolve(__dirname,"../../scripts/mongo_killer.js"),[e.toString(),t.toString()],{detached:true,stdio:"ignore"});r.unref();this.emit(m.killerLaunched);return r}errorHandler(e){this.emit(m.instanceRawError,e);this.emit(m.instanceError,e)}closeHandler(e,t){if(process.platform==="win32"&&e!=12&&e!=0||e!=0){this.debug("closeHandler: Mongod instance closed with an non-0 (or non 12 on windows) code!")}this.debug(`closeHandler: "${e}" "${t}"`);this.emit(m.instanceClosed,e,t)}stderrHandler(e){const t=e.toString().trim();this.debug(`stderrHandler: ""${t}""`);this.emit(m.instanceSTDERR,t);this.checkErrorInLine(t)}stdoutHandler(e){var t,r;const n=e.toString().trim();this.debug(`stdoutHandler: ""${n}""`);this.emit(m.instanceSTDOUT,n);if(/waiting for connections/i.test(n)){this.emit(m.instanceReady)}this.checkErrorInLine(n);if(/transition to \w+ from \w+/i.test(n)){const e=(r=(t=/transition to (\w+) from \w+/i.exec(n))===null||t===void 0?void 0:t[1])!==null&&r!==void 0?r:"UNKNOWN";this.emit(m.instanceReplState,e);if(e!=="PRIMARY"){this.isInstancePrimary=false}}if(/transition to primary complete; database writes are now permitted/i.test(n)){this.isInstancePrimary=true;this.debug('stdoutHandler: emitting "instancePrimary"');this.emit(m.instancePrimary)}}checkErrorInLine(e){var t,r;if(/address already in use/i.test(e)){this.emit(m.instanceError,new p.StdoutInstanceError(`Port "${this.instanceOpts.port}" already in use`))}if(/exception in initAndListen: \w+[^:]: .+[^,], terminating/i.test(e)){const t=/exception in initAndListen: (\w+[^:]): (.+[^,]), terminating/i.exec(e);const{1:r,2:n}=t||[];this.emit(m.instanceError,new p.StdoutInstanceError(`Instance Failed to start with "${r}". Original Error:\n`+n))}if(/CURL_OPENSSL_3['\s]+not found/i.test(e)){this.emit(m.instanceError,new p.StdoutInstanceError("libcurl3 is not available on your system. Mongod requires it and cannot be started without it.\n"+"You should manually install libcurl3 or try to use an newer version of MongoDB"))}if(/CURL_OPENSSL_4['\s]+not found/i.test(e)){this.emit(m.instanceError,new p.StdoutInstanceError("libcurl4 is not available on your system. Mongod requires it and cannot be started without it.\n"+"You need to manually install libcurl4"))}if(/lib[^:]+(?=: cannot open shared object)/i.test(e)){const n=(r=(t=e.match(/(lib[^:]+)(?=: cannot open shared object)/i))===null||t===void 0?void 0:t[1].toLocaleLowerCase())!==null&&r!==void 0?r:"unknown";this.emit(m.instanceError,new p.StdoutInstanceError(`Instance failed to start because a library is missing or cannot be opened: "${n}"`))}if(/\*\*\*aborting after/i.test(e)){this.emit(m.instanceError,new p.StdoutInstanceError("Mongod internal error"))}}}t.MongoInstance=MongoInstance;t.default=MongoInstance},3386:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.StdoutInstanceError=t.KnownVersionIncompatibilityError=t.NoRegexMatchError=t.ParseArchiveRegexError=t.ReplsetCountLowError=t.AssertionFallbackError=t.BinaryNotFoundError=t.InsufficientPermissionsError=t.AuthNotObjectError=t.KeyFileMissingError=t.InstanceInfoError=t.StartBinaryFailedError=t.Md5CheckFailedError=t.NoSystemBinaryFoundError=t.EnsureInstanceError=t.WaitForPrimaryTimeoutError=t.UnknownArchitectureError=t.UnknownPlatformError=t.UnableToUnlockLockfileError=t.UnknownLockfileStatusError=t.StateError=void 0;const n=r(1978);class StateError extends Error{constructor(e,t){super(`Incorrect State for operation: "${t}", allowed States: "[${e.join(",")}]"\n`+"This may be because of using a v6.x way of calling functions, look at the following guide if anything applies:\n"+"https://nodkz.github.io/mongodb-memory-server/docs/guides/migration/migrate7#no-function-other-than-start-create-ensureinstance-will-be-starting-anything");this.wantedStates=e;this.gotState=t}}t.StateError=StateError;class UnknownLockfileStatusError extends Error{constructor(e){super(`Unknown LockFile Status: "${e}"`);this.status=e}}t.UnknownLockfileStatusError=UnknownLockfileStatusError;class UnableToUnlockLockfileError extends Error{constructor(e,t){super(`Cannot unlock file "${t}", because it is not locked by this ${e?"instance":"process"}`);this.thisInstance=e;this.file=t}}t.UnableToUnlockLockfileError=UnableToUnlockLockfileError;class UnknownPlatformError extends Error{constructor(e){super(`Unknown Platform: "${e}"`);this.platform=e}}t.UnknownPlatformError=UnknownPlatformError;class UnknownArchitectureError extends Error{constructor(e,t){super();this.arch=e;this.platform=t;if(!(0,n.isNullOrUndefined)(t)){this.message=`Unsupported Architecture-Platform combination: arch: "${e}", platform: "${t}"`}else{this.message=`Unsupported Architecture: "${e}"`}}}t.UnknownArchitectureError=UnknownArchitectureError;class WaitForPrimaryTimeoutError extends Error{constructor(e,t){super(`Timed out after ${e}ms while waiting for a Primary (where: "${t}")`);this.timeout=e;this.where=t}}t.WaitForPrimaryTimeoutError=WaitForPrimaryTimeoutError;class EnsureInstanceError extends Error{constructor(e){super();this.isRunning=e;const t='"ensureInstance" failed, because';if(e){this.message=`${t} state was "running" but "instanceInfo" was undefined!`}else{this.message=`${t} "instanceInfo" was undefined after running "start"`}}}t.EnsureInstanceError=EnsureInstanceError;class NoSystemBinaryFoundError extends Error{constructor(e){super(`Config option "SYSTEM_BINARY" was provided with value "${e}", but no binary could be found!`);this.binaryPath=e}}t.NoSystemBinaryFoundError=NoSystemBinaryFoundError;class Md5CheckFailedError extends Error{constructor(e,t){super(`MD5 check failed! Binary MD5 is "${e}", Checkfile MD5 is "${t}"`);this.binarymd5=e;this.checkfilemd5=t}}t.Md5CheckFailedError=Md5CheckFailedError;class StartBinaryFailedError extends Error{constructor(e){super(`Starting the Binary Failed (PID is undefined)! Binary: "${e}"`);this.binary=e}}t.StartBinaryFailedError=StartBinaryFailedError;class InstanceInfoError extends Error{constructor(e){super(`"instanceInfo" was undefined when expected to be defined! (where: "${e}")`);this.where=e}}t.InstanceInfoError=InstanceInfoError;class KeyFileMissingError extends Error{constructor(){super(`"keyfileLocation" was undefined when expected!`)}}t.KeyFileMissingError=KeyFileMissingError;class AuthNotObjectError extends Error{constructor(){super('"auth" was not a object when it was expected!')}}t.AuthNotObjectError=AuthNotObjectError;class InsufficientPermissionsError extends Error{constructor(e){super(`File "${e}" does not have the required Permissions, required Permissions: "--x"`);this.path=e}}t.InsufficientPermissionsError=InsufficientPermissionsError;class BinaryNotFoundError extends Error{constructor(e){super(`No Binary at path "${e}" was found! (ENOENT)`);this.path=e}}t.BinaryNotFoundError=BinaryNotFoundError;class AssertionFallbackError extends Error{constructor(){super("Assert failed - no custom error")}}t.AssertionFallbackError=AssertionFallbackError;class ReplsetCountLowError extends Error{constructor(e){super(`ReplSet Count needs to be 1 or higher! (specified count: "${e}")`);this.count=e}}t.ReplsetCountLowError=ReplsetCountLowError;class ParseArchiveRegexError extends Error{constructor(e){super(`Expected "${e}" to be found in regex groups`);this.key=e}}t.ParseArchiveRegexError=ParseArchiveRegexError;class NoRegexMatchError extends Error{constructor(e,t){super();this.name=e;this.extra=t;const r=!!t?`(${t})`:"";this.message=`Expected "${e}" to have Regex Matches${r}`}}t.NoRegexMatchError=NoRegexMatchError;class KnownVersionIncompatibilityError extends Error{constructor(e,t,r,n){super();this.dist=e;this.requested_version=t;this.available_versions=r;this.extra=n;const o=!!n?`\n${n}`:"";this.message=`Requested Version "${t}" is not available for "${e}"! Available Versions: "${r}"${o}`}}t.KnownVersionIncompatibilityError=KnownVersionIncompatibilityError;class StdoutInstanceError extends Error{constructor(e){super(e)}}t.StdoutInstanceError=StdoutInstanceError},8278:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.parseOS=t.parseLSB=t.getOS=t.isLinuxOS=void 0;const n=r(4351);const o=r(2087);const i=(0,n.__importDefault)(r(8237));const s=r(1978);const a=(0,i.default)("MongoMS:getos");const c={name:/^(?:distributor id:|DISTRIB_ID=)\s*(.*)$/im,codename:/^(?:codename:|DISTRIB_CODENAME=)\s*(.*)$/im,release:/^(?:release:|DISTRIB_RELEASE=)\s*(.*)$/im};const l={name:/^id\s*=\s*"?(\w*)"?$/im,codename:/^version_codename\s*=\s*(.*)$/im,release:/^version_id\s*=\s*"?(\d*(?:\.\d*)?)"?$/im,id_like:/^id_like\s*=\s*"?([\w\s]*)"?$/im};function isLinuxOS(e){return e.os==="linux"}t.isLinuxOS=isLinuxOS;let u;function getOS(){return(0,n.__awaiter)(this,void 0,void 0,(function*(){if(!u){const e=(0,o.platform)();if(e==="linux"){u=yield getLinuxInformation()}else{u={os:e}}}return u}))}t.getOS=getOS;function getLinuxInformation(){return(0,n.__awaiter)(this,void 0,void 0,(function*(){const e=yield(0,s.tryReleaseFile)("/etc/upstream-release/lsb-release",parseLSB);if(!(0,s.isNullOrUndefined)(e)){a("getLinuxInformation: Using UpstreamLSB");return e}const t=yield(0,s.tryReleaseFile)("/etc/os-release",parseOS);if(!(0,s.isNullOrUndefined)(t)){a("getLinuxInformation: Using etcOsRelease");return t}const r=yield(0,s.tryReleaseFile)("/usr/lib/os-release",parseOS);if(!(0,s.isNullOrUndefined)(r)){a("getLinuxInformation: Using usrOsRelease");return r}const n=yield(0,s.tryReleaseFile)("/etc/lsb-release",parseLSB);if(!(0,s.isNullOrUndefined)(n)){a("getLinuxInformation: Using etcLSBRelease");return n}console.warn("Could not find any Release File, using fallback binary");return{os:"linux",dist:"unknown",release:""}}))}function parseLSB(e){var t,r,n,o,i;return{os:"linux",dist:(r=(t=e.match(c.name))===null||t===void 0?void 0:t[1].toLocaleLowerCase())!==null&&r!==void 0?r:"unknown",codename:(n=e.match(c.codename))===null||n===void 0?void 0:n[1].toLocaleLowerCase(),release:(i=(o=e.match(c.release))===null||o===void 0?void 0:o[1].toLocaleLowerCase())!==null&&i!==void 0?i:""}}t.parseLSB=parseLSB;function parseOS(e){var t,r,n,o,i,s;return{os:"linux",dist:(r=(t=e.match(l.name))===null||t===void 0?void 0:t[1].toLocaleLowerCase())!==null&&r!==void 0?r:"unknown",codename:(n=e.match(l.codename))===null||n===void 0?void 0:n[1].toLocaleLowerCase(),release:(i=(o=e.match(l.release))===null||o===void 0?void 0:o[1].toLocaleLowerCase())!==null&&i!==void 0?i:"",id_like:(s=e.match(l.id_like))===null||s===void 0?void 0:s[1].toLocaleLowerCase().split(" ")}}t.parseOS=parseOS},4908:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.LockFile=t.LockFileEvents=t.LockFileStatus=void 0;const n=r(4351);const o=r(8614);const i=(0,n.__importStar)(r(1978));const s=(0,n.__importDefault)(r(8237));const a=(0,n.__importStar)(r(5622));const c=r(5747);const l=r(4038);const u=r(5840);const d=r(3386);const p=(0,s.default)("MongoMS:LockFile");class RepeatError extends Error{constructor(e){super();this.repeat=e}}var h;(function(e){e[e["available"]=0]="available";e[e["availableInstance"]=1]="availableInstance";e[e["lockedSelf"]=2]="lockedSelf";e[e["lockedDifferent"]=3]="lockedDifferent"})(h=t.LockFileStatus||(t.LockFileStatus={}));var m;(function(e){e["lock"]="lock";e["unlock"]="unlock"})(m=t.LockFileEvents||(t.LockFileEvents={}));class LockFileEventsClass extends o.EventEmitter{}class LockFile{constructor(e,t){this.file=e;this.uuid=t}static lock(e){return(0,n.__awaiter)(this,void 0,void 0,(function*(){yield i.ensureAsync();p(`lock: Locking file "${e}"`);const t=a.resolve(e.trim());i.assertion(t.length>0,new Error("Provided Path for lock file is length of 0"));const r=yield this.checkLock(t);switch(r){case h.lockedDifferent:case h.lockedSelf:return this.waitForLock(t);case h.available:return this.createLock(t);default:throw new d.UnknownLockfileStatusError(r)}}))}static checkLock(e,t){return(0,n.__awaiter)(this,void 0,void 0,(function*(){p(`checkLock: for file "${e}" with uuid: "${t}"`);if(!(yield i.pathExists(e))){return h.available}try{const r=(yield c.promises.readFile(e)).toString().trim().split(" ");const n=parseInt(r[0]);if(n===process.pid){p(`checkLock: Lock File Already exists, and is for *this* process, with uuid: "${r[1]}"`);if(!this.files.has(e)){return h.available}if(!i.isNullOrUndefined(t)){return t===r[1]?h.availableInstance:h.lockedSelf}return h.lockedSelf}p(`checkLock: Lock File Aready exists, for a different process: "${n}"`);return i.isAlive(n)?h.lockedDifferent:h.available}catch(e){if(i.errorWithCode(e)&&e.code==="ENOENT"){p("checkLock: reading file failed with ENOENT");return h.available}throw e}}))}static waitForLock(e){return(0,n.__awaiter)(this,void 0,void 0,(function*(){p(`waitForLock: Starting to wait for file "${e}"`);let t=undefined;let r=undefined;yield new Promise((o=>{r=t=>{if(t===e){o()}};t=setInterval((()=>(0,n.__awaiter)(this,void 0,void 0,(function*(){const t=yield this.checkLock(e);p(`waitForLock: Interval for file "${e}" with status "${t}"`);if(t===h.available){o()}}))),1e3*3);this.events.on(m.unlock,r)}));if(t){clearInterval(t)}if(r){this.events.removeListener(m.unlock,r)}p(`waitForLock: File became available "${e}"`);yield i.ensureAsync();const o=yield this.checkLock(e);p(`waitForLock: Lock File Status reassessment for file "${e}": ${o}`);switch(o){case h.lockedDifferent:case h.lockedSelf:return this.waitForLock(e);case h.available:return this.createLock(e);default:throw new d.UnknownLockfileStatusError(o)}}))}static createLock(e){return(0,n.__awaiter)(this,void 0,void 0,(function*(){p(`createLock: trying to create a lock file for "${e}"`);const t=(0,u.v4)();try{yield this.mutex.runExclusive((()=>(0,n.__awaiter)(this,void 0,void 0,(function*(){if(this.files.has(e)){p(`createLock: Map already has file "${e}"`);throw new RepeatError(true)}yield i.mkdir(a.dirname(e));yield c.promises.writeFile(e,`${process.pid.toString()} ${t}`);this.files.add(e);this.events.emit(m.lock,e)}))))}catch(t){if(t instanceof RepeatError&&t.repeat){return this.waitForLock(e)}}p(`createLock: Lock File Created for file "${e}"`);return new this(e,t)}))}unlock(){var e;return(0,n.__awaiter)(this,void 0,void 0,(function*(){yield i.ensureAsync();p(`unlock: Unlocking file "${this.file}"`);if(i.isNullOrUndefined(this.file)||((e=this.file)===null||e===void 0?void 0:e.length)<=0){p("unlock: invalid file, returning");return}switch(yield LockFile.checkLock(this.file,this.uuid)){case h.available:p(`unlock: Lock Status was already "available" for file "${this.file}"`);yield this.unlockCleanup(false);return;case h.availableInstance:p(`unlock: Lock Status was "availableInstance" for file "${this.file}"`);yield this.unlockCleanup(true);return;case h.lockedSelf:throw new d.UnableToUnlockLockfileError(true,this.file);default:throw new d.UnableToUnlockLockfileError(false,this.file)}}))}unlockCleanup(e=true){return(0,n.__awaiter)(this,void 0,void 0,(function*(){return yield LockFile.mutex.runExclusive((()=>(0,n.__awaiter)(this,void 0,void 0,(function*(){p(`unlockCleanup: for file "${this.file}"`);if(i.isNullOrUndefined(this.file)){return}if(e){yield c.promises.unlink(this.file).catch((e=>{p(`unlockCleanup: lock file unlink failed: "${e}"`)}))}LockFile.files.delete(this.file);LockFile.events.emit(m.unlock,this.file);this.file=undefined;this.uuid=undefined}))))}))}}t.LockFile=LockFile;LockFile.files=new Set;LockFile.events=new LockFileEventsClass;LockFile.mutex=new l.Mutex},8730:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.envToBool=t.envName=t.resolveConfig=t.processConfigOption=t.findPackageJson=t.setDefaultValue=t.defaultValues=t.DEFAULT_VERSION=t.ENV_CONFIG_PREFIX=t.ResolveConfigVariables=void 0;const n=r(4351);const o=(0,n.__importDefault)(r(1362));const i=r(1156);const s=(0,n.__importDefault)(r(8237));const a=(0,n.__importStar)(r(5622));const c=r(5747);const l=r(1978);const u=(0,s.default)("MongoMS:ResolveConfig");var d;(function(e){e["DOWNLOAD_DIR"]="DOWNLOAD_DIR";e["PLATFORM"]="PLATFORM";e["ARCH"]="ARCH";e["VERSION"]="VERSION";e["DEBUG"]="DEBUG";e["DOWNLOAD_MIRROR"]="DOWNLOAD_MIRROR";e["DOWNLOAD_URL"]="DOWNLOAD_URL";e["PREFER_GLOBAL_PATH"]="PREFER_GLOBAL_PATH";e["DISABLE_POSTINSTALL"]="DISABLE_POSTINSTALL";e["SYSTEM_BINARY"]="SYSTEM_BINARY";e["MD5_CHECK"]="MD5_CHECK";e["ARCHIVE_NAME"]="ARCHIVE_NAME";e["RUNTIME_DOWNLOAD"]="RUNTIME_DOWNLOAD";e["USE_HTTP"]="USE_HTTP";e["SYSTEM_BINARY_VERSION_CHECK"]="SYSTEM_BINARY_VERSION_CHECK";e["USE_ARCHIVE_NAME_FOR_BINARY_NAME"]="USE_ARCHIVE_NAME_FOR_BINARY_NAME"})(d=t.ResolveConfigVariables||(t.ResolveConfigVariables={}));t.ENV_CONFIG_PREFIX="MONGOMS_";t.DEFAULT_VERSION="5.0.8";t.defaultValues=new Map([[d.VERSION,t.DEFAULT_VERSION],[d.PREFER_GLOBAL_PATH,"true"],[d.RUNTIME_DOWNLOAD,"true"],[d.USE_HTTP,"false"],[d.SYSTEM_BINARY_VERSION_CHECK,"true"],[d.USE_ARCHIVE_NAME_FOR_BINARY_NAME,"false"]]);function setDefaultValue(e,r){t.defaultValues.set(e,r)}t.setDefaultValue=setDefaultValue;let p=undefined;function findPackageJson(e){var t;for(const r of(0,i.findSync)(e||process.cwd())){u(`findPackageJson: Found package.json at "${r}"`);const e=JSON.parse((0,c.readFileSync)(r).toString());const n=(t=e===null||e===void 0?void 0:e.config)===null||t===void 0?void 0:t.mongodbMemoryServer;if(!(0,l.isNullOrUndefined)(n)&&Object.keys(n!==null&&n!==void 0?n:{}).length>0){u(`findPackageJson: Found package with non-empty config field at "${r}"`);const e=a.dirname(r);p={filePath:e,config:processConfigOption(n,e)};break}}return p}t.findPackageJson=findPackageJson;function processConfigOption(e,t){u("processConfigOption",e,t);if(typeof e!=="object"){u("processConfigOptions: input was not a object");return{}}const r=e;const n=(0,o.default)(d.DOWNLOAD_DIR);const i=(0,o.default)(d.SYSTEM_BINARY);if(n in r){r[n]=a.resolve(t,r[n])}if(i in r){r[i]=a.resolve(t,r[i])}return r}t.processConfigOption=processConfigOption;function resolveConfig(e){var r,n,i;return(i=(n=(r=process.env[envName(e)])!==null&&r!==void 0?r:p===null||p===void 0?void 0:p.config[(0,o.default)(e)])!==null&&n!==void 0?n:t.defaultValues.get(e))===null||i===void 0?void 0:i.toString()}t.resolveConfig=resolveConfig;t.default=resolveConfig;function envName(e){return`${t.ENV_CONFIG_PREFIX}${e}`}t.envName=envName;function envToBool(e=""){if(typeof e!=="string"){u("envToBool: input was not a string!");return false}return["1","on","yes","true"].indexOf(e.toLowerCase())!==-1}t.envToBool=envToBool;if(envToBool(resolveConfig(d.DEBUG))){s.default.enable("MongoMS:*");u("Debug Mode Enabled, through Environment Variable")}findPackageJson();if(envToBool(resolveConfig(d.DEBUG))){s.default.enable("MongoMS:*");u("Debug Mode Enabled, through package.json")}},1978:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.mkdir=t.checkBinaryPermissions=t.ManagerAdvanced=t.ManagerBase=t.tryReleaseFile=t.pathExists=t.statPath=t.authDefault=t.ensureAsync=t.isAlive=t.killProcess=t.assertion=t.isNullOrUndefined=t.uriTemplate=t.getHost=t.generateDbName=t.errorWithCode=void 0;const n=r(4351);const o=(0,n.__importDefault)(r(8237));const i=r(5747);const s=r(3386);const a=(0,o.default)("MongoMS:utils");function errorWithCode(e){return e instanceof Error&&"code"in e}t.errorWithCode=errorWithCode;function generateDbName(e){return e||""}t.generateDbName=generateDbName;function getHost(e){return e.replace(/(?:^mongodb:\/{2})|(?:\/.*$)|(?:.*@)/gim,"")}t.getHost=getHost;function uriTemplate(e,t,r,n){const o=!isNullOrUndefined(t)?`${e}:${t}`:e;return`mongodb://${o}/${r}`+(!isNullOrUndefined(n)?`?${n.join("&")}`:"")}t.uriTemplate=uriTemplate;function isNullOrUndefined(e){return e===null||e===undefined}t.isNullOrUndefined=isNullOrUndefined;function assertion(e,t){if(!e){throw t!==null&&t!==void 0?t:new s.AssertionFallbackError}}t.assertion=assertion;function killProcess(e,t,r){return(0,n.__awaiter)(this,void 0,void 0,(function*(){function ilog(e){a(`Mongo[${r||"unknown"}] killProcess: ${e}`)}if(!isAlive(e.pid)){ilog("given childProcess's PID was not alive anymore");return}const n=1e3*10;yield new Promise(((r,i)=>{let s=setTimeout((()=>{ilog("killProcess: timeout triggered, trying SIGKILL");if(!o.default.enabled("MongoMS:utils")){console.warn('An Process didnt exit with signal "SIGINT" within 10 seconds, using "SIGKILL"!\n'+"Enable debug logs for more information")}e.kill("SIGKILL");s=setTimeout((()=>{ilog("killProcess: timeout triggered again, rejecting");i(new Error(`Process "${t}" didnt exit, enable debug for more information.`))}),n)}),n);e.once(`exit`,((e,n)=>{ilog(`killProcess: ${t}: got exit signal, Code: ${e}, Signal: ${n}`);clearTimeout(s);r()}));ilog(`killProcess: ${t}: sending "SIGINT"`);e.kill("SIGINT")}))}))}t.killProcess=killProcess;function isAlive(e){if(isNullOrUndefined(e)){return false}try{process.kill(e,0);return true}catch(e){return false}}t.isAlive=isAlive;function ensureAsync(){return(0,n.__awaiter)(this,void 0,void 0,(function*(){return new Promise((e=>process.nextTick(e)))}))}t.ensureAsync=ensureAsync;function authDefault(e){return Object.assign({force:false,disable:false,customRootName:"mongodb-memory-server-root",customRootPwd:"rootuser",extraUsers:[],keyfileContent:"0123456789"},e)}t.authDefault=authDefault;function statPath(e){return(0,n.__awaiter)(this,void 0,void 0,(function*(){return i.promises.stat(e).catch((e=>{if(["ENOENT","EACCES"].includes(e.code)){return undefined}throw e}))}))}t.statPath=statPath;function pathExists(e){return(0,n.__awaiter)(this,void 0,void 0,(function*(){return!isNullOrUndefined(yield statPath(e))}))}t.pathExists=pathExists;function tryReleaseFile(e,t){return(0,n.__awaiter)(this,void 0,void 0,(function*(){try{const r=yield i.promises.readFile(e);return t(r.toString())}catch(t){if(errorWithCode(t)&&!["ENOENT","EACCES"].includes(t.code)){throw t}a(`tryReleaseFile: "${e}" does not exist`);return undefined}}))}t.tryReleaseFile=tryReleaseFile;class ManagerBase{}t.ManagerBase=ManagerBase;class ManagerAdvanced extends ManagerBase{}t.ManagerAdvanced=ManagerAdvanced;function checkBinaryPermissions(e){return(0,n.__awaiter)(this,void 0,void 0,(function*(){try{yield i.promises.access(e,i.constants.X_OK)}catch(t){if(errorWithCode(t)){if(t.code==="EACCES"){throw new s.InsufficientPermissionsError(e)}if(t.code==="ENOENT"){throw new s.BinaryNotFoundError(e)}}throw t}}))}t.checkBinaryPermissions=checkBinaryPermissions;function mkdir(e){return(0,n.__awaiter)(this,void 0,void 0,(function*(){yield i.promises.mkdir(e,{recursive:true})}))}t.mkdir=mkdir},5517:(e,t,r)=>{"use strict";const n=r(3994);const o=r(2138);const i=r(1545).connect;i.MongoError=n.MongoError;i.MongoNetworkError=n.MongoNetworkError;i.MongoTimeoutError=n.MongoTimeoutError;i.MongoServerSelectionError=n.MongoServerSelectionError;i.MongoParseError=n.MongoParseError;i.MongoWriteConcernError=n.MongoWriteConcernError;i.MongoBulkWriteError=r(4239).BulkWriteError;i.BulkWriteError=i.MongoBulkWriteError;i.Admin=r(3238);i.MongoClient=r(1545);i.Db=r(6662);i.Collection=r(5193);i.Server=r(8421);i.ReplSet=r(382);i.Mongos=r(2048);i.ReadPreference=n.ReadPreference;i.GridStore=r(9406);i.Chunk=r(3890);i.Logger=n.Logger;i.AggregationCursor=r(7429);i.CommandCursor=r(538);i.Cursor=r(7159);i.GridFSBucket=r(2573);i.CoreServer=n.Server;i.CoreConnection=n.Connection;i.Binary=n.BSON.Binary;i.Code=n.BSON.Code;i.Map=n.BSON.Map;i.DBRef=n.BSON.DBRef;i.Double=n.BSON.Double;i.Int32=n.BSON.Int32;i.Long=n.BSON.Long;i.MinKey=n.BSON.MinKey;i.MaxKey=n.BSON.MaxKey;i.ObjectID=n.BSON.ObjectID;i.ObjectId=n.BSON.ObjectID;i.Symbol=n.BSON.Symbol;i.Timestamp=n.BSON.Timestamp;i.BSONRegExp=n.BSON.BSONRegExp;i.Decimal128=n.BSON.Decimal128;i.connect=i;i.instrument=function(e,t){if(typeof e==="function"){t=e;e={}}const r=new o;r.instrument(i.MongoClient,t);return r};e.exports=i},3238:(e,t,r)=>{"use strict";const n=r(1371).applyWriteConcern;const o=r(7057);const i=r(1681);const s=r(1969);const a=r(9263);const c=r(9929);const l=r(2548);function Admin(e,t,r){if(!(this instanceof Admin))return new Admin(e,t);this.s={db:e,topology:t,promiseLibrary:r}}Admin.prototype.command=function(e,t,r){const n=Array.prototype.slice.call(arguments,1);r=typeof n[n.length-1]==="function"?n.pop():undefined;t=n.length?n.shift():{};const o=new i(this.s.db,e,t);return l(this.s.db.s.topology,o,r)};Admin.prototype.buildInfo=function(e,t){if(typeof e==="function")t=e,e={};e=e||{};const r={buildinfo:1};const n=new i(this.s.db,r,e);return l(this.s.db.s.topology,n,t)};Admin.prototype.serverInfo=function(e,t){if(typeof e==="function")t=e,e={};e=e||{};const r={buildinfo:1};const n=new i(this.s.db,r,e);return l(this.s.db.s.topology,n,t)};Admin.prototype.serverStatus=function(e,t){if(typeof e==="function")t=e,e={};e=e||{};const r=new i(this.s.db,{serverStatus:1},e);return l(this.s.db.s.topology,r,t)};Admin.prototype.ping=function(e,t){if(typeof e==="function")t=e,e={};e=e||{};const r={ping:1};const n=new i(this.s.db,r,e);return l(this.s.db.s.topology,n,t)};Admin.prototype.addUser=function(e,t,r,i){const s=Array.prototype.slice.call(arguments,2);i=typeof s[s.length-1]==="function"?s.pop():undefined;if(typeof e==="string"&&t!=null&&typeof t==="object"){r=t;t=null}r=s.length?s.shift():{};r=Object.assign({},r);r=n(r,{db:this.s.db});r.dbName="admin";const a=new o(this.s.db,e,t,r);return l(this.s.db.s.topology,a,i)};Admin.prototype.removeUser=function(e,t,r){const o=Array.prototype.slice.call(arguments,1);r=typeof o[o.length-1]==="function"?o.pop():undefined;t=o.length?o.shift():{};t=Object.assign({},t);t=n(t,{db:this.s.db});t.dbName="admin";const i=new s(this.s.db,e,t);return l(this.s.db.s.topology,i,r)};Admin.prototype.validateCollection=function(e,t,r){if(typeof t==="function")r=t,t={};t=t||{};const n=new a(this,e,t);return l(this.s.db.s.topology,n,r)};Admin.prototype.listDatabases=function(e,t){if(typeof e==="function")t=e,e={};e=e||{};return l(this.s.db.s.topology,new c(this.s.db,e),t)};Admin.prototype.replSetGetStatus=function(e,t){if(typeof e==="function")t=e,e={};e=e||{};const r=new i(this.s.db,{replSetGetStatus:1},e);return l(this.s.db.s.topology,r,t)};e.exports=Admin},7429:(e,t,r)=>{"use strict";const n=r(3994).MongoError;const o=r(7159);const i=r(4847).CursorState;class AggregationCursor extends o{constructor(e,t,r){super(e,t,r)}batchSize(e){if(this.s.state===i.CLOSED||this.isDead()){throw n.create({message:"Cursor is closed",driver:true})}if(typeof e!=="number"){throw n.create({message:"batchSize requires an integer",driver:true})}this.operation.options.batchSize=e;this.setCursorBatchSize(e);return this}geoNear(e){this.operation.addToPipeline({$geoNear:e});return this}group(e){this.operation.addToPipeline({$group:e});return this}limit(e){this.operation.addToPipeline({$limit:e});return this}match(e){this.operation.addToPipeline({$match:e});return this}maxTimeMS(e){this.operation.options.maxTimeMS=e;return this}out(e){this.operation.addToPipeline({$out:e});return this}project(e){this.operation.addToPipeline({$project:e});return this}lookup(e){this.operation.addToPipeline({$lookup:e});return this}redact(e){this.operation.addToPipeline({$redact:e});return this}skip(e){this.operation.addToPipeline({$skip:e});return this}sort(e){this.operation.addToPipeline({$sort:e});return this}unwind(e){this.operation.addToPipeline({$unwind:e});return this}getLogger(){return this.logger}}AggregationCursor.prototype.get=AggregationCursor.prototype.toArray;e.exports=AggregationCursor},2138:(e,t,r)=>{"use strict";const n=r(8614).EventEmitter;class Instrumentation extends n{constructor(){super()}instrument(e,t){this.$MongoClient=e;const r=this.$prototypeConnect=e.prototype.connect;const n=this;e.prototype.connect=function(e){this.s.options.monitorCommands=true;this.on("commandStarted",(e=>n.emit("started",e)));this.on("commandSucceeded",(e=>n.emit("succeeded",e)));this.on("commandFailed",(e=>n.emit("failed",e)));return r.call(this,e)};if(typeof t==="function")t(null,this)}uninstrument(){this.$MongoClient.prototype.connect=this.$prototypeConnect}}e.exports=Instrumentation},1749:(e,t)=>{"use strict";function asyncIterator(){const e=this;return{next:function(){return Promise.resolve().then((()=>e.next())).then((t=>{if(!t){return e.close().then((()=>({value:t,done:true})))}return{value:t,done:false}}))}}}t.asyncIterator=asyncIterator},4239:(e,t,r)=>{"use strict";const n=r(3994).BSON.Long;const o=r(3994).MongoError;const i=r(3994).BSON.ObjectID;const s=r(3994).BSON;const a=r(3994).MongoWriteConcernError;const c=r(1371).emitWarningOnce;const l=r(1371).toError;const u=r(1371).handleCallback;const d=r(1371).applyRetryableWrites;const p=r(1371).applyWriteConcern;const h=r(1371).executeLegacyOperation;const m=r(1371).isPromiseLike;const g=r(1371).hasAtomicOperators;const y=r(1178).maxWireVersion;const v=64;const b=1;const S=2;const w=3;const E=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 Batch{constructor(e,t){this.originalZeroIndex=t;this.currentIndex=0;this.originalIndexes=[];this.batchType=e;this.operations=[];this.size=0;this.sizeBytes=0}}const _=Symbol("upsertedIds");const O=Symbol("insertedIds");class BulkWriteResult{constructor(e){this.result=e;this[_]=undefined;this[O]=undefined}get insertedCount(){return typeof this.result.nInserted!=="number"?0:this.result.nInserted}get matchedCount(){return typeof this.result.nMatched!=="number"?0:this.result.nMatched}get modifiedCount(){return typeof this.result.nModified!=="number"?0:this.result.nModified}get deletedCount(){return typeof this.result.nRemoved!=="number"?0:this.result.nRemoved}get upsertedCount(){return!this.result.upserted?0:this.result.upserted.length}get upsertedIds(){if(this[_]){return this[_]}this[_]={};for(const e of this.result.upserted||[]){this[_][e.index]=e._id}return this[_]}get insertedIds(){if(this[O]){return this[O]}this[O]={};for(const e of this.result.insertedIds||[]){this[O][e.index]=e._id}return this[O]}get n(){return this.result.insertedCount}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){if(ee.multi))}if(e.batch.batchType===w){r.retryWrites=r.retryWrites&&!e.batch.operations.some((e=>e.limit===0))}}try{if(e.batch.batchType===b){this.s.topology.insert(this.s.namespace,e.batch.operations,r,e.resultHandler)}else if(e.batch.batchType===S){this.s.topology.update(this.s.namespace,e.batch.operations,r,e.resultHandler)}else if(e.batch.batchType===w){this.s.topology.remove(this.s.namespace,e.batch.operations,r,e.resultHandler)}}catch(r){r.ok=0;u(t,null,mergeBatchResults(e.batch,this.s.bulkResult,r,null))}}handleWriteError(e,t){if(this.s.bulkResult.writeErrors.length>0){const r=this.s.bulkResult.writeErrors[0].errmsg?this.s.bulkResult.writeErrors[0].errmsg:"write operation failed";u(e,new BulkWriteError(l({message:r,code:this.s.bulkResult.writeErrors[0].code,writeErrors:this.s.bulkResult.writeErrors}),t),null);return true}if(t.getWriteConcernError()){u(e,new BulkWriteError(l(t.getWriteConcernError()),t),null);return true}}}Object.defineProperty(BulkOperationBase.prototype,"length",{enumerable:true,get:function(){return this.s.currentIndex}});e.exports={Batch:Batch,BulkOperationBase:BulkOperationBase,bson:E,INSERT:b,UPDATE:S,REMOVE:w,BulkWriteError:BulkWriteError,BulkWriteResult:BulkWriteResult}},5035:(e,t,r)=>{"use strict";const n=r(4239);const o=n.BulkOperationBase;const i=n.Batch;const s=n.bson;const a=r(1371);const c=a.toError;function addToOperationsList(e,t,r){const o=s.calculateObjectSize(r,{checkKeys:false,ignoreUndefined:false});if(o>=e.s.maxBsonObjectSize)throw c("document is larger than the maximum size "+e.s.maxBsonObjectSize);if(e.s.currentBatch==null)e.s.currentBatch=new i(t,e.s.currentIndex);const a=e.s.maxKeySize;if(e.s.currentBatchSize+1>=e.s.maxWriteBatchSize||e.s.currentBatchSize>0&&e.s.currentBatchSizeBytes+a+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}if(t===n.INSERT){e.s.bulkResult.insertedIds.push({index:e.s.currentIndex,_id:r._id})}if(Array.isArray(r)){throw c("operation passed in cannot be an Array")}e.s.currentBatch.originalIndexes.push(e.s.currentIndex);e.s.currentBatch.operations.push(r);e.s.currentBatchSize+=1;e.s.currentBatchSizeBytes+=a+o;e.s.currentIndex+=1;return e}class OrderedBulkOperation extends o{constructor(e,t,r){r=r||{};r=Object.assign(r,{addToOperationsList:addToOperationsList});super(e,t,r,true)}}function initializeOrderedBulkOp(e,t,r){return new OrderedBulkOperation(e,t,r)}initializeOrderedBulkOp.OrderedBulkOperation=OrderedBulkOperation;e.exports=initializeOrderedBulkOp;e.exports.Bulk=OrderedBulkOperation},325:(e,t,r)=>{"use strict";const n=r(4239);const o=n.BulkOperationBase;const i=n.Batch;const s=n.bson;const a=r(1371);const c=a.toError;function addToOperationsList(e,t,r){const o=s.calculateObjectSize(r,{checkKeys:false,ignoreUndefined:false});if(o>=e.s.maxBsonObjectSize)throw c("document is larger than the maximum size "+e.s.maxBsonObjectSize);e.s.currentBatch=null;if(t===n.INSERT){e.s.currentBatch=e.s.currentInsertBatch}else if(t===n.UPDATE){e.s.currentBatch=e.s.currentUpdateBatch}else if(t===n.REMOVE){e.s.currentBatch=e.s.currentRemoveBatch}const a=e.s.maxKeySize;if(e.s.currentBatch==null)e.s.currentBatch=new i(t,e.s.currentIndex);if(e.s.currentBatch.size+1>=e.s.maxWriteBatchSize||e.s.currentBatch.size>0&&e.s.currentBatch.sizeBytes+a+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)}if(Array.isArray(r)){throw c("operation passed in cannot be an Array")}e.s.currentBatch.operations.push(r);e.s.currentBatch.originalIndexes.push(e.s.currentIndex);e.s.currentIndex=e.s.currentIndex+1;if(t===n.INSERT){e.s.currentInsertBatch=e.s.currentBatch;e.s.bulkResult.insertedIds.push({index:e.s.bulkResult.insertedIds.length,_id:r._id})}else if(t===n.UPDATE){e.s.currentUpdateBatch=e.s.currentBatch}else if(t===n.REMOVE){e.s.currentRemoveBatch=e.s.currentBatch}e.s.currentBatch.size+=1;e.s.currentBatch.sizeBytes+=a+o;return e}class UnorderedBulkOperation extends o{constructor(e,t,r){r=r||{};r=Object.assign(r,{addToOperationsList:addToOperationsList});super(e,t,r,false)}handleWriteError(e,t){if(this.s.batches.length){return false}return super.handleWriteError(e,t)}}function initializeUnorderedBulkOp(e,t,r){return new UnorderedBulkOperation(e,t,r)}initializeUnorderedBulkOp.UnorderedBulkOperation=UnorderedBulkOperation;e.exports=initializeUnorderedBulkOp;e.exports.Bulk=UnorderedBulkOperation},1117:(e,t,r)=>{"use strict";const n=r(2342);const o=r(8614);const i=r(9386).isResumableError;const s=r(3994).MongoError;const a=r(7159);const c=r(1178).relayEvents;const l=r(1178).maxWireVersion;const u=r(1371).maybePromise;const d=r(1371).now;const p=r(1371).calculateDurationInMs;const h=r(1554);const m=Symbol("resumeQueue");const g=["resumeAfter","startAfter","startAtOperationTime","fullDocument"];const y=["batchSize","maxAwaitTimeMS","collation","readPreference"].concat(g);const v={COLLECTION:Symbol("Collection"),DATABASE:Symbol("Database"),CLUSTER:Symbol("Cluster")};class ChangeStream extends o{constructor(e,t,o){super();const i=r(5193);const s=r(6662);const a=r(1545);this.pipeline=t||[];this.options=o||{};this.parent=e;this.namespace=e.s.namespace;if(e instanceof i){this.type=v.COLLECTION;this.topology=e.s.db.serverConfig}else if(e instanceof s){this.type=v.DATABASE;this.topology=e.serverConfig}else if(e instanceof a){this.type=v.CLUSTER;this.topology=e.topology}else{throw new TypeError("parent provided to ChangeStream constructor is not an instance of Collection, Db, or MongoClient")}this.promiseLibrary=e.s.promiseLibrary;if(!this.options.readPreference&&e.s.readPreference){this.options.readPreference=e.s.readPreference}this[m]=new n;this.cursor=createChangeStreamCursor(this,o);this.closed=false;this.on("newListener",(e=>{if(e==="change"&&this.cursor&&this.listenerCount("change")===0){this.cursor.on("data",(e=>processNewChange(this,e)))}}));this.on("removeListener",(e=>{if(e==="change"&&this.listenerCount("change")===0&&this.cursor){this.cursor.removeAllListeners("data")}}))}get resumeToken(){return this.cursor.resumeToken}hasNext(e){return u(this.parent,e,(e=>{getCursor(this,((t,r)=>{if(t)return e(t);r.hasNext(e)}))}))}next(e){return u(this.parent,e,(e=>{getCursor(this,((t,r)=>{if(t)return e(t);r.next(((t,r)=>{if(t){this[m].push((()=>this.next(e)));processError(this,t,e);return}processNewChange(this,r,e)}))}))}))}isClosed(){return this.closed||this.cursor&&this.cursor.isClosed()}close(e){return u(this.parent,e,(e=>{if(this.closed)return e();this.closed=true;if(!this.cursor)return e();const t=this.cursor;return t.close((r=>{["data","close","end","error"].forEach((e=>t.removeAllListeners(e)));this.cursor=undefined;return e(r)}))}))}pipe(e,t){if(!this.pipeDestinations){this.pipeDestinations=[]}this.pipeDestinations.push(e);return this.cursor.pipe(e,t)}unpipe(e){if(this.pipeDestinations&&this.pipeDestinations.indexOf(e)>-1){this.pipeDestinations.splice(this.pipeDestinations.indexOf(e),1)}return this.cursor.unpipe(e)}stream(e){this.streamOptions=e;return this.cursor.stream(e)}pause(){return this.cursor.pause()}resume(){return this.cursor.resume()}}class ChangeStreamCursor extends a{constructor(e,t,r){super(e,t,r);r=r||{};this._resumeToken=null;this.startAtOperationTime=r.startAtOperationTime;if(r.startAfter){this.resumeToken=r.startAfter}else if(r.resumeAfter){this.resumeToken=r.resumeAfter}}set resumeToken(e){this._resumeToken=e;this.emit("resumeTokenChanged",e)}get resumeToken(){return this._resumeToken}get resumeOptions(){const e={};for(const t of y){if(this.options[t])e[t]=this.options[t]}if(this.resumeToken||this.startAtOperationTime){["resumeAfter","startAfter","startAtOperationTime"].forEach((t=>delete e[t]));if(this.resumeToken){const t=this.options.startAfter&&!this.hasReceived?"startAfter":"resumeAfter";e[t]=this.resumeToken}else if(this.startAtOperationTime&&l(this.server)>=7){e.startAtOperationTime=this.startAtOperationTime}}return e}cacheResumeToken(e){if(this.bufferedCount()===0&&this.cursorState.postBatchResumeToken){this.resumeToken=this.cursorState.postBatchResumeToken}else{this.resumeToken=e}this.hasReceived=true}_processBatch(e,t){const r=t.cursor;if(r.postBatchResumeToken){this.cursorState.postBatchResumeToken=r.postBatchResumeToken;if(r[e].length===0){this.resumeToken=r.postBatchResumeToken}}}_initializeCursor(e){super._initializeCursor(((t,r)=>{if(t||r==null){e(t,r);return}const n=r.documents[0];if(this.startAtOperationTime==null&&this.resumeAfter==null&&this.startAfter==null&&l(this.server)>=7){this.startAtOperationTime=n.operationTime}this._processBatch("firstBatch",n);this.emit("init",r);this.emit("response");e(t,r)}))}_getMore(e){super._getMore(((t,r)=>{if(t){e(t);return}this._processBatch("nextBatch",r);this.emit("more",r);this.emit("response");e(t,r)}))}}function createChangeStreamCursor(e,t){const r={fullDocument:t.fullDocument||"default"};applyKnownOptions(r,t,g);if(e.type===v.CLUSTER){r.allChangesForCluster=true}const n=[{$changeStream:r}].concat(e.pipeline);const o=applyKnownOptions({},t,y);const i=new ChangeStreamCursor(e.topology,new h(e.parent,n,t),o);c(i,e,["resumeTokenChanged","end","close"]);if(e.listenerCount("change")>0){i.on("data",(function(t){processNewChange(e,t)}))}i.on("error",(function(t){processError(e,t)}));if(e.pipeDestinations){const t=i.stream(e.streamOptions);for(let r of e.pipeDestinations){t.pipe(r)}}return i}function applyKnownOptions(e,t,r){r.forEach((r=>{if(t[r]){e[r]=t[r]}}));return e}const b=3e4;function waitForTopologyConnected(e,t,r){setTimeout((()=>{if(t&&t.start==null){t.start=d()}const n=t.start||d();const o=t.timeout||b;const i=t.readPreference;if(e.isConnected({readPreference:i})){return r()}if(p(n)>o){return r(new s("Timed out waiting for connection"))}waitForTopologyConnected(e,t,r)}),500)}function processNewChange(e,t,r){const n=e.cursor;if(t==null){e.closed=true}if(e.closed){if(r)r(new s("ChangeStream is closed"));return}if(t&&!t._id){const t=new Error("A change stream document has been received that lacks a resume token (_id).");if(!r)return e.emit("error",t);return r(t)}n.cacheResumeToken(t._id);e.options.startAtOperationTime=undefined;if(!r)return e.emit("change",t);return r(undefined,t)}function processError(e,t,r){const n=e.topology;const o=e.cursor;if(e.closed){if(r)r(new s("ChangeStream is closed"));return}function resumeWithCursor(t){e.cursor=t;processResumeQueue(e)}function unresumableError(t){if(!r){e.emit("error",t);e.emit("close")}processResumeQueue(e,t);e.closed=true}if(o&&i(t,l(o.server))){e.cursor=undefined;["data","close","end","error"].forEach((e=>o.removeAllListeners(e)));o.close();waitForTopologyConnected(n,{readPreference:o.options.readPreference},(t=>{if(t)return unresumableError(t);const n=createChangeStreamCursor(e,o.resumeOptions);if(!r)return resumeWithCursor(n);n.hasNext((e=>{if(e)return unresumableError(e);resumeWithCursor(n)}))}));return}if(!r)return e.emit("error",t);return r(t)}function getCursor(e,t){if(e.isClosed()){t(new s("ChangeStream is closed."));return}if(e.cursor){t(undefined,e.cursor);return}e[m].push(t)}function processResumeQueue(e,t){while(e[m].length){const r=e[m].pop();if(e.isClosed()&&!t){r(new s("Change Stream is not open."));return}r(t,e.cursor)}}e.exports=ChangeStream},9820:(e,t,r)=>{"use strict";const n=r(8614);const o=r(2425);const i=r(3111).MongoError;const s=r(3111).MongoNetworkError;const a=r(3111).MongoNetworkTimeoutError;const c=r(3111).MongoWriteConcernError;const l=r(2337);const u=r(6292).StreamDescription;const d=r(9206);const p=r(9815);const h=r(5474).updateSessionFromResponse;const m=r(1178).uuidV4;const g=r(1371).now;const y=r(1371).calculateDurationInMs;const v=Symbol("stream");const b=Symbol("queue");const S=Symbol("messageStream");const w=Symbol("generation");const E=Symbol("lastUseTime");const _=Symbol("clusterTime");const O=Symbol("description");const C=Symbol("ismaster");const T=Symbol("autoEncrypter");class Connection extends n{constructor(e,t){super(t);this.id=t.id;this.address=streamIdentifier(e);this.bson=t.bson;this.socketTimeout=typeof t.socketTimeout==="number"?t.socketTimeout:0;this.host=t.host||"localhost";this.port=t.port||27017;this.monitorCommands=typeof t.monitorCommands==="boolean"?t.monitorCommands:false;this.closed=false;this.destroyed=false;this[O]=new u(this.address,t);this[w]=t.generation;this[E]=g();if(t.autoEncrypter){this[T]=t.autoEncrypter}this[b]=new Map;this[S]=new o(t);this[S].on("message",messageHandler(this));this[v]=e;e.on("error",(()=>{}));this[S].on("error",(e=>this.handleIssue({destroy:e})));e.on("close",(()=>this.handleIssue({isClose:true})));e.on("timeout",(()=>this.handleIssue({isTimeout:true,destroy:true})));e.pipe(this[S]);this[S].pipe(e)}get description(){return this[O]}get ismaster(){return this[C]}set ismaster(e){this[O].receiveResponse(e);this[C]=e}get generation(){return this[w]||0}get idleTime(){return y(this[E])}get clusterTime(){return this[_]}get stream(){return this[v]}markAvailable(){this[E]=g()}handleIssue(e){if(this.closed){return}if(e.destroy){this[v].destroy(typeof e.destroy==="boolean"?undefined:e.destroy)}this.closed=true;for(const t of this[b]){const r=t[1];if(e.isTimeout){r.cb(new a(`connection ${this.id} to ${this.address} timed out`,{beforeHandshake:this.ismaster==null}))}else if(e.isClose){r.cb(new s(`connection ${this.id} to ${this.address} closed`))}else{r.cb(typeof e.destroy==="boolean"?undefined:e.destroy)}}this[b].clear();this.emit("close")}destroy(e,t){if(typeof e==="function"){t=e;e={}}e=Object.assign({force:false},e);if(this[v]==null||this.destroyed){this.destroyed=true;if(typeof t==="function"){t()}return}if(e.force){this[v].destroy();this.destroyed=true;if(typeof t==="function"){t()}return}this[v].end((e=>{this.destroyed=true;if(typeof t==="function"){t(e)}}))}command(e,t,r,n){d.command(makeServerTrampoline(this),e,t,r,n)}query(e,t,r,n,o){d.query(makeServerTrampoline(this),e,t,r,n,o)}getMore(e,t,r,n,o){d.getMore(makeServerTrampoline(this),e,t,r,n,o)}killCursors(e,t,r){d.killCursors(makeServerTrampoline(this),e,t,r)}insert(e,t,r,n){d.insert(makeServerTrampoline(this),e,t,r,n)}update(e,t,r,n){d.update(makeServerTrampoline(this),e,t,r,n)}remove(e,t,r,n){d.remove(makeServerTrampoline(this),e,t,r,n)}}function makeServerTrampoline(e){const t={description:e.description,clusterTime:e[_],s:{bson:e.bson,pool:{write:write.bind(e),isConnected:()=>true}}};if(e[T]){t.autoEncrypter=e[T]}return t}function messageHandler(e){return function messageHandler(t){e.emit("message",t);if(!e[b].has(t.responseTo)){return}const r=e[b].get(t.responseTo);const n=r.cb;e[b].delete(t.responseTo);if(t.moreToCome){e[b].set(t.requestId,r)}else if(r.socketTimeoutOverride){e[v].setTimeout(e.socketTimeout)}try{t.parse(r)}catch(e){n(new i(e));return}if(t.documents[0]){const o=t.documents[0];const s=r.session;if(s){h(s,o)}if(o.$clusterTime){e[_]=o.$clusterTime;e.emit("clusterTimeReceived",o.$clusterTime)}if(r.command){if(o.writeConcernError){n(new c(o.writeConcernError,o));return}if(o.ok===0||o.$err||o.errmsg||o.code){n(new i(o));return}}}n(undefined,new l(r.fullResult?t:t.documents[0],e,t))}}function streamIdentifier(e){if(typeof e.address==="function"){return`${e.remoteAddress}:${e.remotePort}`}return m().toString("hex")}function write(e,t,r){if(typeof t==="function"){r=t}t=t||{};const n={requestId:e.requestId,cb:r,session:t.session,fullResult:typeof t.fullResult==="boolean"?t.fullResult:false,noResponse:typeof t.noResponse==="boolean"?t.noResponse:false,documentsReturnedIn:t.documentsReturnedIn,command:!!t.command,promoteLongs:typeof t.promoteLongs==="boolean"?t.promoteLongs:true,promoteValues:typeof t.promoteValues==="boolean"?t.promoteValues:true,promoteBuffers:typeof t.promoteBuffers==="boolean"?t.promoteBuffers:false,raw:typeof t.raw==="boolean"?t.raw:false};if(this[O]&&this[O].compressor){n.agreedCompressor=this[O].compressor;if(this[O].zlibCompressionLevel){n.zlibCompressionLevel=this[O].zlibCompressionLevel}}if(typeof t.socketTimeout==="number"){n.socketTimeoutOverride=true;this[v].setTimeout(t.socketTimeout)}if(this.monitorCommands){this.emit("commandStarted",new p.CommandStartedEvent(this,e));n.started=g();n.cb=(t,o)=>{if(t){this.emit("commandFailed",new p.CommandFailedEvent(this,e,t,n.started))}else{if(o&&o.result&&(o.result.ok===0||o.result.$err)){this.emit("commandFailed",new p.CommandFailedEvent(this,e,o.result,n.started))}else{this.emit("commandSucceeded",new p.CommandSucceededEvent(this,e,o,n.started))}}if(typeof r==="function"){r(t,o)}}}if(!n.noResponse){this[b].set(n.requestId,n)}try{this[S].writeCommand(e,n)}catch(e){if(!n.noResponse){this[b].delete(n.requestId);n.cb(e);return}}if(n.noResponse){n.cb()}}e.exports={Connection:Connection}},2529:(e,t,r)=>{"use strict";const n=r(2342);const o=r(8614).EventEmitter;const i=r(104);const s=r(1371).makeCounter;const a=r(3111).MongoError;const c=r(9820).Connection;const l=r(1178).eachAsync;const u=r(6573);const d=r(1178).relayEvents;const p=r(2926);const h=p.PoolClosedError;const m=p.WaitQueueTimeoutError;const g=r(897);const y=g.ConnectionPoolCreatedEvent;const v=g.ConnectionPoolClosedEvent;const b=g.ConnectionCreatedEvent;const S=g.ConnectionReadyEvent;const w=g.ConnectionClosedEvent;const E=g.ConnectionCheckOutStartedEvent;const _=g.ConnectionCheckOutFailedEvent;const O=g.ConnectionCheckedOutEvent;const C=g.ConnectionCheckedInEvent;const T=g.ConnectionPoolClearedEvent;const I=Symbol("logger");const k=Symbol("connections");const A=Symbol("permits");const R=Symbol("minPoolSizeTimer");const N=Symbol("generation");const M=Symbol("connectionCounter");const D=Symbol("cancellationToken");const P=Symbol("waitQueue");const L=Symbol("cancelled");const B=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 resolveOptions(e,t){const r=Array.from(B).reduce(((t,r)=>{if(Object.prototype.hasOwnProperty.call(e,r)){t[r]=e[r]}return t}),{});return Object.freeze(Object.assign({},t,r))}class ConnectionPool extends o{constructor(e){super();e=e||{};this.closed=false;this.options=resolveOptions(e,{connectionType:c,maxPoolSize:typeof e.maxPoolSize==="number"?e.maxPoolSize:100,minPoolSize:typeof e.minPoolSize==="number"?e.minPoolSize:0,maxIdleTimeMS:typeof e.maxIdleTimeMS==="number"?e.maxIdleTimeMS:0,waitQueueTimeoutMS:typeof e.waitQueueTimeoutMS==="number"?e.waitQueueTimeoutMS:0,autoEncrypter:e.autoEncrypter,metadata:e.metadata});if(e.minSize>e.maxSize){throw new TypeError("Connection pool minimum size must not be greater than maxiumum pool size")}this[I]=i("ConnectionPool",e);this[k]=new n;this[A]=this.options.maxPoolSize;this[R]=undefined;this[N]=0;this[M]=s(1);this[D]=new o;this[D].setMaxListeners(Infinity);this[P]=new n;process.nextTick((()=>{this.emit("connectionPoolCreated",new y(this));ensureMinPoolSize(this)}))}get address(){return`${this.options.host}:${this.options.port}`}get generation(){return this[N]}get totalConnectionCount(){return this[k].length+(this.options.maxPoolSize-this[A])}get availableConnectionCount(){return this[k].length}get waitQueueSize(){return this[P].length}checkOut(e){this.emit("connectionCheckOutStarted",new E(this));if(this.closed){this.emit("connectionCheckOutFailed",new _(this,"poolClosed"));e(new h(this));return}const t={callback:e};const r=this;const n=this.options.waitQueueTimeoutMS;if(n){t.timer=setTimeout((()=>{t[L]=true;t.timer=undefined;r.emit("connectionCheckOutFailed",new _(r,"timeout"));t.callback(new m(r))}),n)}this[P].push(t);process.nextTick((()=>processWaitQueue(this)))}checkIn(e){const t=this.closed;const r=connectionIsStale(this,e);const n=!!(t||r||e.closed);if(!n){e.markAvailable();this[k].push(e)}this.emit("connectionCheckedIn",new C(this,e));if(n){const r=e.closed?"error":t?"poolClosed":"stale";destroyConnection(this,e,r)}process.nextTick((()=>processWaitQueue(this)))}clear(){this[N]+=1;this.emit("connectionPoolCleared",new T(this))}close(e,t){if(typeof e==="function"){t=e}e=Object.assign({force:false},e);if(this.closed){return t()}this[D].emit("cancel");while(this.waitQueueSize){const e=this[P].pop();clearTimeout(e.timer);if(!e[L]){e.callback(new a("connection pool closed"))}}if(this[R]){clearTimeout(this[R])}if(typeof this[M].return==="function"){this[M].return()}this.closed=true;l(this[k].toArray(),((t,r)=>{this.emit("connectionClosed",new w(this,t,"poolClosed"));t.destroy(e,r)}),(e=>{this[k].clear();this.emit("connectionPoolClosed",new v(this));t(e)}))}withConnection(e,t){this.checkOut(((r,n)=>{e(r,n,((e,r)=>{if(typeof t==="function"){if(e){t(e)}else{t(undefined,r)}}if(n){this.checkIn(n)}}))}))}}function ensureMinPoolSize(e){if(e.closed||e.options.minPoolSize===0){return}const t=e.options.minPoolSize;for(let r=e.totalConnectionCount;rensureMinPoolSize(e)),10)}function connectionIsStale(e,t){return t.generation!==e[N]}function connectionIsIdle(e,t){return!!(e.options.maxIdleTimeMS&&t.idleTime>e.options.maxIdleTimeMS)}function createConnection(e,t){const r=Object.assign({id:e[M].next().value,generation:e[N]},e.options);e[A]--;u(r,e[D],((r,n)=>{if(r){e[A]++;e[I].debug(`connection attempt failed with error [${JSON.stringify(r)}]`);if(typeof t==="function"){t(r)}return}if(e.closed){n.destroy({force:true});return}d(n,e,["commandStarted","commandFailed","commandSucceeded","clusterTimeReceived"]);e.emit("connectionCreated",new b(e,n));n.markAvailable();e.emit("connectionReady",new S(e,n));if(typeof t==="function"){t(undefined,n);return}e[k].push(n);process.nextTick((()=>processWaitQueue(e)))}))}function destroyConnection(e,t,r){e.emit("connectionClosed",new w(e,t,r));e[A]++;process.nextTick((()=>t.destroy()))}function processWaitQueue(e){if(e.closed){return}while(e.waitQueueSize){const t=e[P].peekFront();if(t[L]){e[P].shift();continue}if(!e.availableConnectionCount){break}const r=e[k].shift();const n=connectionIsStale(e,r);const o=connectionIsIdle(e,r);if(!n&&!o&&!r.closed){e.emit("connectionCheckedOut",new O(e,r));clearTimeout(t.timer);e[P].shift();t.callback(undefined,r);return}const i=r.closed?"error":n?"stale":"idle";destroyConnection(e,r,i)}const t=e.options.maxPoolSize;if(e.waitQueueSize&&(t<=0||e.totalConnectionCount{const n=e[P].shift();if(n==null||n[L]){if(t==null){e[k].push(r)}return}if(t){e.emit("connectionCheckOutFailed",new _(e,t))}else{e.emit("connectionCheckedOut",new O(e,r))}clearTimeout(n.timer);n.callback(t,r)}));return}}e.exports={ConnectionPool:ConnectionPool}},2926:(e,t,r)=>{"use strict";const n=r(3111).MongoError;class PoolClosedError extends n{constructor(e){super("Attempted to check out a connection from closed connection pool");this.name="MongoPoolClosedError";this.address=e.address}}class WaitQueueTimeoutError extends n{constructor(e){super("Timed out while checking out a connection from connection pool");this.name="MongoWaitQueueTimeoutError";this.address=e.address}}e.exports={PoolClosedError:PoolClosedError,WaitQueueTimeoutError:WaitQueueTimeoutError}},897:e=>{"use strict";class ConnectionPoolMonitoringEvent{constructor(e){this.time=new Date;this.address=e.address}}class ConnectionPoolCreatedEvent extends ConnectionPoolMonitoringEvent{constructor(e){super(e);this.options=e.options}}class ConnectionPoolClosedEvent extends ConnectionPoolMonitoringEvent{constructor(e){super(e)}}class ConnectionCreatedEvent extends ConnectionPoolMonitoringEvent{constructor(e,t){super(e);this.connectionId=t.id}}class ConnectionReadyEvent extends ConnectionPoolMonitoringEvent{constructor(e,t){super(e);this.connectionId=t.id}}class ConnectionClosedEvent extends ConnectionPoolMonitoringEvent{constructor(e,t,r){super(e);this.connectionId=t.id;this.reason=r||"unknown"}}class ConnectionCheckOutStartedEvent extends ConnectionPoolMonitoringEvent{constructor(e){super(e)}}class ConnectionCheckOutFailedEvent extends ConnectionPoolMonitoringEvent{constructor(e,t){super(e);this.reason=t}}class ConnectionCheckedOutEvent extends ConnectionPoolMonitoringEvent{constructor(e,t){super(e);this.connectionId=t.id}}class ConnectionCheckedInEvent extends ConnectionPoolMonitoringEvent{constructor(e,t){super(e);this.connectionId=t.id}}class ConnectionPoolClearedEvent extends ConnectionPoolMonitoringEvent{constructor(e){super(e)}}const t=["connectionPoolCreated","connectionPoolClosed","connectionCreated","connectionReady","connectionClosed","connectionCheckOutStarted","connectionCheckOutFailed","connectionCheckedOut","connectionCheckedIn","connectionPoolCleared"];e.exports={CMAP_EVENT_NAMES:t,ConnectionPoolCreatedEvent:ConnectionPoolCreatedEvent,ConnectionPoolClosedEvent:ConnectionPoolClosedEvent,ConnectionCreatedEvent:ConnectionCreatedEvent,ConnectionReadyEvent:ConnectionReadyEvent,ConnectionClosedEvent:ConnectionClosedEvent,ConnectionCheckOutStartedEvent:ConnectionCheckOutStartedEvent,ConnectionCheckOutFailedEvent:ConnectionCheckOutFailedEvent,ConnectionCheckedOutEvent:ConnectionCheckedOutEvent,ConnectionCheckedInEvent:ConnectionCheckedInEvent,ConnectionPoolClearedEvent:ConnectionPoolClearedEvent}},2425:(e,t,r)=>{"use strict";const n=r(2413).Duplex;const o=r(336);const i=r(3111).MongoParseError;const s=r(7793).decompress;const a=r(9814).Response;const c=r(8988).BinMsg;const l=r(3111).MongoError;const u=r(7272).opcodes.OP_COMPRESSED;const d=r(7272).opcodes.OP_MSG;const p=r(7272).MESSAGE_HEADER_SIZE;const h=r(7272).COMPRESSION_DETAILS_SIZE;const m=r(7272).opcodes;const g=r(7793).compress;const y=r(7793).compressorIDs;const v=r(7793).uncompressibleCommands;const b=r(8988).Msg;const S=1024*1024*16*4;const w=Symbol("buffer");class MessageStream extends n{constructor(e){e=e||{};super(e);this.bson=e.bson;this.maxBsonMessageSize=e.maxBsonMessageSize||S;this[w]=new o}_write(e,t,r){const n=this[w];n.append(e);processIncomingData(this,r)}_read(){return}writeCommand(e,t){const r=t&&!!t.agreedCompressor;if(!r||!canCompress(e)){const t=e.toBin();this.push(Array.isArray(t)?Buffer.concat(t):t);return}const n=Buffer.concat(e.toBin());const o=n.slice(p);const i=n.readInt32LE(12);g({options:t},o,((r,n)=>{if(r){t.cb(r,null);return}const s=Buffer.alloc(p);s.writeInt32LE(p+h+n.length,0);s.writeInt32LE(e.requestId,4);s.writeInt32LE(0,8);s.writeInt32LE(m.OP_COMPRESSED,12);const a=Buffer.alloc(h);a.writeInt32LE(i,0);a.writeInt32LE(o.length,4);a.writeUInt8(y[t.agreedCompressor],8);this.push(Buffer.concat([s,a,n]))}))}}function canCompress(e){const t=e instanceof b?e.command:e.query;const r=Object.keys(t)[0];return!v.has(r)}function processIncomingData(e,t){const r=e[w];if(r.length<4){t();return}const n=r.readInt32LE(0);if(n<0){t(new i(`Invalid message size: ${n}`));return}if(n>e.maxBsonMessageSize){t(new i(`Invalid message size: ${n}, max allowed: ${e.maxBsonMessageSize}`));return}if(n>r.length){t();return}const o=r.slice(0,n);r.consume(n);const h={length:o.readInt32LE(0),requestId:o.readInt32LE(4),responseTo:o.readInt32LE(8),opCode:o.readInt32LE(12)};let m=h.opCode===d?c:a;const g=e.responseOptions;if(h.opCode!==u){const n=o.slice(p);e.emit("message",new m(e.bson,o,h,n,g));if(r.length>=4){processIncomingData(e,t)}else{t()}return}h.fromCompressed=true;h.opCode=o.readInt32LE(p);h.length=o.readInt32LE(p+4);const y=o[p+8];const v=o.slice(p+9);m=h.opCode===d?c:a;s(y,v,((n,i)=>{if(n){t(n);return}if(i.length!==h.length){t(new l("Decompressing a compressed message from the server failed. The message is corrupt."));return}e.emit("message",new m(e.bson,o,h,i,g));if(r.length>=4){processIncomingData(e,t)}else{t()}}))}e.exports=MessageStream},6292:(e,t,r)=>{"use strict";const n=r(750).parseServerType;const o=["minWireVersion","maxWireVersion","maxBsonObjectSize","maxMessageSizeBytes","maxWriteBatchSize","__nodejs_mock_server__"];class StreamDescription{constructor(e,t){this.address=e;this.type=n(null);this.minWireVersion=undefined;this.maxWireVersion=undefined;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=n(e);o.forEach((t=>{if(typeof e[t]!=="undefined"){this[t]=e[t]}}));if(e.compression){this.compressor=this.compressors.filter((t=>e.compression.indexOf(t)!==-1))[0]}}}e.exports={StreamDescription:StreamDescription}},5193:(e,t,r)=>{"use strict";const n=r(1669).deprecate;const o=r(1371).deprecateOptions;const i=r(1371).emitWarningOnce;const s=r(1371).checkCollectionName;const a=r(3994).BSON.ObjectID;const c=r(3994).MongoError;const l=r(1371).normalizeHintField;const u=r(1371).decorateCommand;const d=r(1371).decorateWithCollation;const p=r(1371).decorateWithReadConcern;const h=r(1371).formattedOrderClause;const m=r(3994).ReadPreference;const g=r(325);const y=r(5035);const v=r(1117);const b=r(1371).executeLegacyOperation;const S=r(2481);const w=r(7289);const E=r(1371).MongoDBNamespace;const _=r(7429);const O=r(538);const C=r(6716).ensureIndex;const T=r(6716).group;const I=r(6716).parallelCollectionScan;const k=r(2296).removeDocuments;const A=r(6716).save;const R=r(2296).updateDocuments;const N=r(1554);const M=r(6976);const D=r(5131);const P=r(6394);const L=r(323);const B=r(6352);const j=r(6469);const U=r(2360).DropCollectionOperation;const F=r(3560);const W=r(5328);const $=r(4451);const z=r(9961);const q=r(4497);const V=r(711);const G=r(5841);const K=r(4316);const Y=r(1925);const X=r(8169);const J=r(4218);const Z=r(7809);const Q=r(4245);const ee=r(3592);const te=r(9915);const re=r(4956);const ne=r(28);const oe=r(2779);const ie=r(43);const se=r(2808);const ae=r(6331);const ce=r(2508);const le=r(968);const ue=r(9350);const fe=r(9068);const de=r(2548);const pe=["ignoreUndefined"];function Collection(e,t,r,n,o,i){s(n);const c=null;const l=i==null||i.slaveOk==null?e.slaveOk:i.slaveOk;const u=i==null||i.serializeFunctions==null?e.s.options.serializeFunctions:i.serializeFunctions;const d=i==null||i.raw==null?e.s.options.raw:i.raw;const p=i==null||i.promoteLongs==null?e.s.options.promoteLongs:i.promoteLongs;const h=i==null||i.promoteValues==null?e.s.options.promoteValues:i.promoteValues;const g=i==null||i.promoteBuffers==null?e.s.options.promoteBuffers:i.promoteBuffers;const y=null;const v=new E(r,n);const b=i.promiseLibrary||Promise;o=o==null?a:o;this.s={pkFactory:o,db:e,topology:t,options:i,namespace:v,readPreference:m.fromOptions(i),slaveOk:l,serializeFunctions:u,raw:d,promoteLongs:p,promoteValues:h,promoteBuffers:g,internalHint:c,collectionHint:y,promiseLibrary:b,readConcern:w.fromOptions(i),writeConcern:S.fromOptions(i)}}Object.defineProperty(Collection.prototype,"dbName",{enumerable:true,get:function(){return this.s.namespace.db}});Object.defineProperty(Collection.prototype,"collectionName",{enumerable:true,get:function(){return this.s.namespace.collection}});Object.defineProperty(Collection.prototype,"namespace",{enumerable:true,get:function(){return this.s.namespace.toString()}});Object.defineProperty(Collection.prototype,"readConcern",{enumerable:true,get:function(){if(this.s.readConcern==null){return this.s.db.readConcern}return this.s.readConcern}});Object.defineProperty(Collection.prototype,"readPreference",{enumerable:true,get:function(){if(this.s.readPreference==null){return this.s.db.readPreference}return this.s.readPreference}});Object.defineProperty(Collection.prototype,"writeConcern",{enumerable:true,get:function(){if(this.s.writeConcern==null){return this.s.db.writeConcern}return this.s.writeConcern}});Object.defineProperty(Collection.prototype,"hint",{enumerable:true,get:function(){return this.s.collectionHint},set:function(e){this.s.collectionHint=l(e)}});const he=["maxScan","fields","snapshot","oplogReplay"];Collection.prototype.find=o({name:"collection.find",deprecatedOptions:he,optionsIndex:1},(function(e,t,r){if(typeof r==="object"){i("Third parameter to `find()` must be a callback or undefined")}let n=e;if(typeof r!=="function"){if(typeof t==="function"){r=t;t=undefined}else if(t==null){r=typeof n==="function"?n:undefined;n=typeof n==="object"?n:undefined}}n=n==null?{}:n;const o=n;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+"]");t.name="MongoError";throw t}}if(n!=null&&n._bsontype==="ObjectID"){n={_id:n}}if(!t)t={};let s=t.projection||t.fields;if(s&&!Buffer.isBuffer(s)&&Array.isArray(s)){s=s.length?s.reduce(((e,t)=>{e[t]=1;return e}),{}):{_id:1}}let a=Object.assign({},t);for(let e in this.s.options){if(pe.indexOf(e)!==-1){a[e]=this.s.options[e]}}a.skip=t.skip?t.skip:0;a.limit=t.limit?t.limit:0;a.raw=typeof t.raw==="boolean"?t.raw:this.s.raw;a.hint=t.hint!=null?l(t.hint):this.s.collectionHint;a.timeout=typeof t.timeout==="undefined"?undefined:t.timeout;a.slaveOk=t.slaveOk!=null?t.slaveOk:this.s.db.slaveOk;a.readPreference=m.resolve(this,a);if(a.readPreference!=null&&(a.readPreference!=="primary"||a.readPreference.mode!=="primary")){a.slaveOk=true}if(n!=null&&typeof n!=="object"){throw c.create({message:"query selector must be an object",driver:true})}const g={find:this.s.namespace.toString(),limit:a.limit,skip:a.skip,query:n};if(typeof t.allowDiskUse==="boolean"){g.allowDiskUse=t.allowDiskUse}if(typeof a.awaitdata==="boolean"){a.awaitData=a.awaitdata}if(typeof a.timeout==="boolean")a.noCursorTimeout=!a.timeout;u(g,a,["session","collation"]);if(s)g.fields=s;a.db=this.s.db;a.promiseLibrary=this.s.promiseLibrary;if(a.raw==null&&typeof this.s.raw==="boolean")a.raw=this.s.raw;if(a.promoteLongs==null&&typeof this.s.promoteLongs==="boolean")a.promoteLongs=this.s.promoteLongs;if(a.promoteValues==null&&typeof this.s.promoteValues==="boolean")a.promoteValues=this.s.promoteValues;if(a.promoteBuffers==null&&typeof this.s.promoteBuffers==="boolean")a.promoteBuffers=this.s.promoteBuffers;if(g.sort){g.sort=h(g.sort)}p(g,this,t);try{d(g,this,t)}catch(e){if(typeof r==="function")return r(e,null);throw e}const y=this.s.topology.cursor(new z(this,this.s.namespace,g,a),a);if(typeof r==="function"){r(null,y);return}return y}));Collection.prototype.insertOne=function(e,t,r){if(typeof t==="function")r=t,t={};t=t||{};if(this.s.options.ignoreUndefined){t=Object.assign({},t);t.ignoreUndefined=this.s.options.ignoreUndefined}const n=new te(this,e,t);return de(this.s.topology,n,r)};Collection.prototype.insertMany=function(e,t,r){if(typeof t==="function")r=t,t={};t=t?Object.assign({},t):{ordered:true};const n=new ee(this,e,t);return de(this.s.topology,n,r)};Collection.prototype.bulkWrite=function(e,t,r){if(typeof t==="function")r=t,t={};t=t||{ordered:true};if(!Array.isArray(e)){throw c.create({message:"operations must be an array of documents",driver:true})}const n=new M(this,e,t);return de(this.s.topology,n,r)};Collection.prototype.insert=n((function(e,t,r){if(typeof t==="function")r=t,t={};t=t||{ordered:false};e=!Array.isArray(e)?[e]:e;if(t.keepGoing===true){t.ordered=false}return this.insertMany(e,t,r)}),"collection.insert is deprecated. Use insertOne, insertMany or bulkWrite instead.");Collection.prototype.updateOne=function(e,t,r,n){if(typeof r==="function")n=r,r={};r=Object.assign({},r);if(this.s.options.ignoreUndefined){r=Object.assign({},r);r.ignoreUndefined=this.s.options.ignoreUndefined}return de(this.s.topology,new fe(this,e,t,r),n)};Collection.prototype.replaceOne=function(e,t,r,n){if(typeof r==="function")n=r,r={};r=Object.assign({},r);if(this.s.options.ignoreUndefined){r=Object.assign({},r);r.ignoreUndefined=this.s.options.ignoreUndefined}return de(this.s.topology,new ce(this,e,t,r),n)};Collection.prototype.updateMany=function(e,t,r,n){if(typeof r==="function")n=r,r={};r=Object.assign({},r);if(this.s.options.ignoreUndefined){r=Object.assign({},r);r.ignoreUndefined=this.s.options.ignoreUndefined}return de(this.s.topology,new ue(this,e,t,r),n)};Collection.prototype.update=n((function(e,t,r,n){if(typeof r==="function")n=r,r={};r=r||{};if(this.s.options.ignoreUndefined){r=Object.assign({},r);r.ignoreUndefined=this.s.options.ignoreUndefined}return b(this.s.topology,R,[this,e,t,r,n])}),"collection.update is deprecated. Use updateOne, updateMany, or bulkWrite instead.");Collection.prototype.deleteOne=function(e,t,r){if(typeof t==="function")r=t,t={};t=Object.assign({},t);if(this.s.options.ignoreUndefined){t=Object.assign({},t);t.ignoreUndefined=this.s.options.ignoreUndefined}const n=new B(this,e,t);return de(this.s.topology,n,r)};Collection.prototype.removeOne=Collection.prototype.deleteOne;Collection.prototype.deleteMany=function(e,t,r){if(typeof t==="function")r=t,t={};t=Object.assign({},t);if(this.s.options.ignoreUndefined){t=Object.assign({},t);t.ignoreUndefined=this.s.options.ignoreUndefined}const n=new L(this,e,t);return de(this.s.topology,n,r)};Collection.prototype.removeMany=Collection.prototype.deleteMany;Collection.prototype.remove=n((function(e,t,r){if(typeof t==="function")r=t,t={};t=t||{};if(this.s.options.ignoreUndefined){t=Object.assign({},t);t.ignoreUndefined=this.s.options.ignoreUndefined}return b(this.s.topology,k,[this,e,t,r])}),"collection.remove is deprecated. Use deleteOne, deleteMany, or bulkWrite instead.");Collection.prototype.save=n((function(e,t,r){if(typeof t==="function")r=t,t={};t=t||{};if(this.s.options.ignoreUndefined){t=Object.assign({},t);t.ignoreUndefined=this.s.options.ignoreUndefined}return b(this.s.topology,A,[this,e,t,r])}),"collection.save is deprecated. Use insertOne, insertMany, updateOne, or updateMany instead.");Collection.prototype.findOne=o({name:"collection.find",deprecatedOptions:he,optionsIndex:1},(function(e,t,r){if(typeof r==="object"){i("Third parameter to `findOne()` must be a callback or undefined")}if(typeof e==="function")r=e,e={},t={};if(typeof t==="function")r=t,t={};e=e||{};t=t||{};const n=new q(this,e,t);return de(this.s.topology,n,r)}));Collection.prototype.rename=function(e,t,r){if(typeof t==="function")r=t,t={};t=Object.assign({},t,{readPreference:m.PRIMARY});const n=new se(this,e,t);return de(this.s.topology,n,r)};Collection.prototype.drop=function(e,t){if(typeof e==="function")t=e,e={};e=e||{};const r=new U(this.s.db,this.collectionName,e);return de(this.s.topology,r,t)};Collection.prototype.options=function(e,t){if(typeof e==="function")t=e,e={};e=e||{};const r=new ie(this,e);return de(this.s.topology,r,t)};Collection.prototype.isCapped=function(e,t){if(typeof e==="function")t=e,e={};e=e||{};const r=new re(this,e);return de(this.s.topology,r,t)};Collection.prototype.createIndex=function(e,t,r){if(typeof t==="function")r=t,t={};t=t||{};const n=new P(this,this.collectionName,e,t);return de(this.s.topology,n,r)};Collection.prototype.createIndexes=function(e,t,r){if(typeof t==="function")r=t,t={};t=t?Object.assign({},t):{};if(typeof t.maxTimeMS!=="number")delete t.maxTimeMS;const n=new P(this,this.collectionName,e,t);return de(this.s.topology,n,r)};Collection.prototype.dropIndex=function(e,t,r){const n=Array.prototype.slice.call(arguments,1);r=typeof n[n.length-1]==="function"?n.pop():undefined;t=n.length?n.shift()||{}:{};t.readPreference=m.PRIMARY;const o=new F(this,e,t);return de(this.s.topology,o,r)};Collection.prototype.dropIndexes=function(e,t){if(typeof e==="function")t=e,e={};e=e?Object.assign({},e):{};if(typeof e.maxTimeMS!=="number")delete e.maxTimeMS;const r=new W(this,e);return de(this.s.topology,r,t)};Collection.prototype.dropAllIndexes=n(Collection.prototype.dropIndexes,"collection.dropAllIndexes is deprecated. Use dropIndexes instead.");Collection.prototype.reIndex=n((function(e,t){if(typeof e==="function")t=e,e={};e=e||{};const r=new ae(this,e);return de(this.s.topology,r,t)}),"collection.reIndex is deprecated. Use db.command instead.");Collection.prototype.listIndexes=function(e){const t=new O(this.s.topology,new ne(this,e),e);return t};Collection.prototype.ensureIndex=n((function(e,t,r){if(typeof t==="function")r=t,t={};t=t||{};return b(this.s.topology,C,[this,e,t,r])}),"collection.ensureIndex is deprecated. Use createIndexes instead.");Collection.prototype.indexExists=function(e,t,r){if(typeof t==="function")r=t,t={};t=t||{};const n=new Z(this,e,t);return de(this.s.topology,n,r)};Collection.prototype.indexInformation=function(e,t){const r=Array.prototype.slice.call(arguments,0);t=typeof r[r.length-1]==="function"?r.pop():undefined;e=r.length?r.shift()||{}:{};const n=new Q(this.s.db,this.collectionName,e);return de(this.s.topology,n,t)};Collection.prototype.count=n((function(e,t,r){const n=Array.prototype.slice.call(arguments,0);r=typeof n[n.length-1]==="function"?n.pop():undefined;e=n.length?n.shift()||{}:{};t=n.length?n.shift()||{}:{};if(typeof t==="function")r=t,t={};t=t||{};return de(this.s.topology,new $(this,e,t),r)}),"collection.count is deprecated, and will be removed in a future version."+" Use Collection.countDocuments or Collection.estimatedDocumentCount instead");Collection.prototype.estimatedDocumentCount=function(e,t){if(typeof e==="function")t=e,e={};e=e||{};const r=new $(this,e);return de(this.s.topology,r,t)};Collection.prototype.countDocuments=function(e,t,r){const n=Array.prototype.slice.call(arguments,0);r=typeof n[n.length-1]==="function"?n.pop():undefined;e=n.length?n.shift()||{}:{};t=n.length?n.shift()||{}:{};const o=new D(this,e,t);return de(this.s.topology,o,r)};Collection.prototype.distinct=function(e,t,r,n){const o=Array.prototype.slice.call(arguments,1);n=typeof o[o.length-1]==="function"?o.pop():undefined;const i=o.length?o.shift()||{}:{};const s=o.length?o.shift()||{}:{};const a=new j(this,e,i,s);return de(this.s.topology,a,n)};Collection.prototype.indexes=function(e,t){if(typeof e==="function")t=e,e={};e=e||{};const r=new J(this,e);return de(this.s.topology,r,t)};Collection.prototype.stats=function(e,t){const r=Array.prototype.slice.call(arguments,0);t=typeof r[r.length-1]==="function"?r.pop():undefined;e=r.length?r.shift()||{}:{};const n=new le(this,e);return de(this.s.topology,n,t)};Collection.prototype.findOneAndDelete=function(e,t,r){if(typeof t==="function")r=t,t={};t=t||{};if(this.s.options.ignoreUndefined){t=Object.assign({},t);t.ignoreUndefined=this.s.options.ignoreUndefined}return de(this.s.topology,new G(this,e,t),r)};Collection.prototype.findOneAndReplace=o({name:"collection.findOneAndReplace",deprecatedOptions:["returnOriginal"],optionsIndex:2},(function(e,t,r,n){if(typeof r==="function")n=r,r={};r=r||{};if(this.s.options.ignoreUndefined){r=Object.assign({},r);r.ignoreUndefined=this.s.options.ignoreUndefined}return de(this.s.topology,new K(this,e,t,r),n)}));Collection.prototype.findOneAndUpdate=o({name:"collection.findOneAndUpdate",deprecatedOptions:["returnOriginal"],optionsIndex:2},(function(e,t,r,n){if(typeof r==="function")n=r,r={};r=r||{};if(this.s.options.ignoreUndefined){r=Object.assign({},r);r.ignoreUndefined=this.s.options.ignoreUndefined}return de(this.s.topology,new Y(this,e,t,r),n)}));Collection.prototype.findAndModify=n(_findAndModify,"collection.findAndModify is deprecated. Use findOneAndUpdate, findOneAndReplace or findOneAndDelete instead.");Collection.prototype._findAndModify=_findAndModify;function _findAndModify(e,t,r,n,o){const i=Array.prototype.slice.call(arguments,1);o=typeof i[i.length-1]==="function"?i.pop():undefined;t=i.length?i.shift()||[]:[];r=i.length?i.shift():null;n=i.length?i.shift()||{}:{};n=Object.assign({},n);n.readPreference=m.PRIMARY;return de(this.s.topology,new V(this,e,t,r,n),o)}Collection.prototype.findAndRemove=n((function(e,t,r,n){const o=Array.prototype.slice.call(arguments,1);n=typeof o[o.length-1]==="function"?o.pop():undefined;t=o.length?o.shift()||[]:[];r=o.length?o.shift()||{}:{};r.remove=true;return de(this.s.topology,new V(this,e,t,null,r),n)}),"collection.findAndRemove is deprecated. Use findOneAndDelete instead.");Collection.prototype.aggregate=function(e,t,r){if(Array.isArray(e)){if(typeof t==="function"){r=t;t={}}if(t==null&&r==null){t={}}}else{const n=Array.prototype.slice.call(arguments,0);r=n.pop();const o=n[n.length-1];t=o&&(o.readPreference||o.explain||o.cursor||o.out||o.maxTimeMS||o.hint||o.allowDiskUse)?n.pop():{};e=n}const n=new _(this.s.topology,new N(this,e,t),t);if(typeof r==="function"){r(null,n);return}return n};Collection.prototype.watch=function(e,t){e=e||[];t=t||{};if(!Array.isArray(e)){t=e;e=[]}return new v(this,e,t)};Collection.prototype.parallelCollectionScan=n((function(e,t){if(typeof e==="function")t=e,e={numCursors:1};e.numCursors=e.numCursors||1;e.batchSize=e.batchSize||1e3;e=Object.assign({},e);e.readPreference=m.resolve(this,e);e.promiseLibrary=this.s.promiseLibrary;if(e.session){e.session=undefined}return b(this.s.topology,I,[this,e,t],{skipSessions:true})}),"parallelCollectionScan is deprecated in MongoDB v4.1");Collection.prototype.geoHaystackSearch=n((function(e,t,r,n){const o=Array.prototype.slice.call(arguments,2);n=typeof o[o.length-1]==="function"?o.pop():undefined;r=o.length?o.shift()||{}:{};const i=new X(this,e,t,r);return de(this.s.topology,i,n)}),"geoHaystackSearch is deprecated, and will be removed in a future version.");Collection.prototype.group=n((function(e,t,r,n,o,i,s,a){const c=Array.prototype.slice.call(arguments,3);a=typeof c[c.length-1]==="function"?c.pop():undefined;n=c.length?c.shift():null;o=c.length?c.shift():null;i=c.length?c.shift():null;s=c.length?c.shift()||{}:{};if(!(typeof o==="function")){i=o;o=null}if(!Array.isArray(e)&&e instanceof Object&&typeof e!=="function"&&!(e._bsontype==="Code")){e=Object.keys(e)}if(typeof n==="function"){n=n.toString()}if(typeof o==="function"){o=o.toString()}i=i==null?true:i;return b(this.s.topology,T,[this,e,t,r,n,o,i,s,a])}),"MongoDB 3.6 or higher no longer supports the group command. We recommend rewriting using the aggregation framework.");Collection.prototype.mapReduce=function(e,t,r,n){if("function"===typeof r)n=r,r={};if(null==r.out){throw new Error("the out option parameter must be defined, see mongodb docs for possible values")}if("function"===typeof e){e=e.toString()}if("function"===typeof t){t=t.toString()}if("function"===typeof r.finalize){r.finalize=r.finalize.toString()}const o=new oe(this,e,t,r);return de(this.s.topology,o,n)};Collection.prototype.initializeUnorderedBulkOp=function(e){e=e||{};if(e.ignoreUndefined==null){e.ignoreUndefined=this.s.options.ignoreUndefined}e.promiseLibrary=this.s.promiseLibrary;return g(this.s.topology,this,e)};Collection.prototype.initializeOrderedBulkOp=function(e){e=e||{};if(e.ignoreUndefined==null){e.ignoreUndefined=this.s.options.ignoreUndefined}e.promiseLibrary=this.s.promiseLibrary;return y(this.s.topology,this,e)};Collection.prototype.getLogger=function(){return this.s.db.s.logger};e.exports=Collection},538:(e,t,r)=>{"use strict";const n=r(3994).ReadPreference;const o=r(3994).MongoError;const i=r(7159);const s=r(4847).CursorState;class CommandCursor extends i{constructor(e,t,r,n){super(e,t,r,n)}setReadPreference(e){if(this.s.state===s.CLOSED||this.isDead()){throw o.create({message:"Cursor is closed",driver:true})}if(this.s.state!==s.INIT){throw o.create({message:"cannot change cursor readPreference after cursor has been accessed",driver:true})}if(e instanceof n){this.options.readPreference=e}else if(typeof e==="string"){this.options.readPreference=new n(e)}else{throw new TypeError("Invalid read preference: "+e)}return this}batchSize(e){if(this.s.state===s.CLOSED||this.isDead()){throw o.create({message:"Cursor is closed",driver:true})}if(typeof e!=="number"){throw o.create({message:"batchSize requires an integer",driver:true})}if(this.cmd.cursor){this.cmd.cursor.batchSize=e}this.setCursorBatchSize(e);return this}maxTimeMS(e){if(this.topology.lastIsMaster().minWireVersion>2){this.cmd.maxTimeMS=e}return this}getLogger(){return this.logger}}CommandCursor.prototype.get=CommandCursor.prototype.toArray;e.exports=CommandCursor},147:e=>{"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"}},557:e=>{"use strict";class AuthContext{constructor(e,t,r){this.connection=e;this.credentials=t;this.options=r}}class AuthProvider{constructor(e){this.bson=e}prepare(e,t,r){r(undefined,e)}auth(e,t){t(new TypeError("`auth` method must be overridden by subclass"))}}e.exports={AuthContext:AuthContext,AuthProvider:AuthProvider}},2192:(e,t,r)=>{"use strict";const n=r(4228);const o=r(7324);const i=r(8728);const s=r(2640);const a=r(864).ScramSHA1;const c=r(864).ScramSHA256;const l=r(8857);function defaultAuthProviders(e){return{"mongodb-aws":new l(e),mongocr:new n(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)}}e.exports={defaultAuthProviders:defaultAuthProviders}},2640:(e,t,r)=>{"use strict";const n=r(881);const o=r(557).AuthProvider;const i=r(1178).retrieveKerberos;const s=r(3111).MongoError;let a;class GSSAPI extends o{auth(e,t){const r=e.connection;const n=e.credentials;if(n==null)return t(new s("credentials required"));const o=n.username;function externalCommand(e,t){return r.command("$external.$cmd",e,t)}makeKerberosClient(e,((e,r)=>{if(e)return t(e);if(r==null)return t(new s("gssapi client missing"));r.step("",((e,n)=>{if(e)return t(e);externalCommand(saslStart(n),((e,n)=>{if(e)return t(e);const i=n.result;negotiate(r,10,i.payload,((e,n)=>{if(e)return t(e);externalCommand(saslContinue(n,i.conversationId),((e,n)=>{if(e)return t(e);const i=n.result;finalize(r,o,i.payload,((e,r)=>{if(e)return t(e);externalCommand({saslContinue:1,conversationId:i.conversationId,payload:r},((e,r)=>{if(e)return t(e);t(undefined,r)}))}))}))}))}))}))}))}}e.exports=GSSAPI;function makeKerberosClient(e,t){const r=e.options.host;const n=e.options.port;const o=e.credentials;if(!r||!n||!o){return t(new s(`Connection must specify: ${r?"host":""}, ${n?"port":""}, ${o?"host":"credentials"}.`))}if(a==null){try{a=i()}catch(e){return t(e)}}const c=o.username;const l=o.password;const u=o.mechanismProperties;const d=u["gssapiservicename"]||u["gssapiServiceName"]||"mongodb";performGssapiCanonicalizeHostName(r,u,((e,r)=>{if(e)return t(e);const n={};if(l!=null){Object.assign(n,{user:c,password:l})}a.initializeClient(`${d}${process.platform==="win32"?"/":"@"}${r}`,n,((e,r)=>{if(e)return t(new s(e));t(null,r)}))}))}function saslStart(e){return{saslStart:1,mechanism:"GSSAPI",payload:e,autoAuthorize:1}}function saslContinue(e,t){return{saslContinue:1,conversationId:t,payload:e}}function negotiate(e,t,r,n){e.step(r,((o,i)=>{if(o&&t===0)return n(o);if(o)return negotiate(e,t-1,r,n);n(undefined,i||"")}))}function finalize(e,t,r,n){e.unwrap(r,((r,o)=>{if(r)return n(r);e.wrap(o||"",{user:t},((e,t)=>{if(e)return n(e);n(undefined,t)}))}))}function performGssapiCanonicalizeHostName(e,t,r){const o=typeof t.gssapiCanonicalizeHostName==="boolean"?t.gssapiCanonicalizeHostName:false;if(!o)return r(undefined,e);n.resolveCname(e,((t,n)=>{if(t)return r(t);if(Array.isArray(n)&&n.length>0){return r(undefined,n[0])}r(undefined,e)}))}},2222:e=>{"use strict";function getDefaultAuthMechanism(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 MongoCredentials{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||{};if(/MONGODB-AWS/i.test(this.mechanism)){if(!this.username&&process.env.AWS_ACCESS_KEY_ID){this.username=process.env.AWS_ACCESS_KEY_ID}if(!this.password&&process.env.AWS_SECRET_ACCESS_KEY){this.password=process.env.AWS_SECRET_ACCESS_KEY}if(!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){if(/DEFAULT/i.test(this.mechanism)){return new MongoCredentials({username:this.username,password:this.password,source:this.source,mechanism:getDefaultAuthMechanism(e),mechanismProperties:this.mechanismProperties})}return this}}e.exports={MongoCredentials:MongoCredentials}},4228:(e,t,r)=>{"use strict";const n=r(6417);const o=r(557).AuthProvider;class MongoCR extends o{auth(e,t){const r=e.connection;const o=e.credentials;const i=o.username;const s=o.password;const a=o.source;r.command(`${a}.$cmd`,{getnonce:1},((e,o)=>{let c=null;let l=null;if(e==null){const e=o.result;c=e.nonce;let t=n.createHash("md5");t.update(i+":mongo:"+s,"utf8");const r=t.digest("hex");t=n.createHash("md5");t.update(c+i+r,"utf8");l=t.digest("hex")}const u={authenticate:1,user:i,nonce:c,key:l};r.command(`${a}.$cmd`,u,t)}))}}e.exports=MongoCR},8857:(e,t,r)=>{"use strict";const n=r(557).AuthProvider;const o=r(2222).MongoCredentials;const i=r(3111).MongoError;const s=r(6417);const a=r(8605);const c=r(1178).maxWireVersion;const l=r(8835);let u;try{u=r(3847)}catch(e){}const d=110;const p="http://169.254.170.2";const h="http://169.254.169.254";const m="/latest/meta-data/iam/security-credentials";class MongoDBAWS extends n{auth(e,t){const r=e.connection;const n=e.credentials;if(c(r)<9){t(new i("MONGODB-AWS authentication requires MongoDB version 4.4 or later"));return}if(u==null){t(new i("MONGODB-AWS authentication requires the `aws4` module, please install it as a dependency of your project"));return}if(n.username==null){makeTempCredentials(n,((r,n)=>{if(r)return t(r);e.credentials=n;this.auth(e,t)}));return}const o=n.username;const a=n.password;const l=n.source;const p=n.mechanismProperties.AWS_SESSION_TOKEN;const h=this.bson;s.randomBytes(32,((e,n)=>{if(e){t(e);return}const s={saslStart:1,mechanism:"MONGODB-AWS",payload:h.serialize({r:n,p:d})};r.command(`${l}.$cmd`,s,((e,s)=>{if(e)return t(e);const c=s.result;const d=h.deserialize(c.payload.buffer);const m=d.h;const g=d.s.buffer;if(g.length!==64){t(new i(`Invalid server nonce length ${g.length}, expected 64`));return}if(g.compare(n,0,n.length,0,n.length)!==0){t(new i("Server nonce does not begin with client nonce"));return}if(m.length<1||m.length>255||m.indexOf("..")!==-1){t(new i(`Server returned an invalid host: "${m}"`));return}const y="Action=GetCallerIdentity&Version=2011-06-15";const v=u.sign({method:"POST",host:m,region:deriveRegion(d.h),service:"sts",headers:{"Content-Type":"application/x-www-form-urlencoded","Content-Length":y.length,"X-MongoDB-Server-Nonce":g.toString("base64"),"X-MongoDB-GS2-CB-Flag":"n"},path:"/",body:y},{accessKeyId:o,secretAccessKey:a,token:p});const b=v.headers.Authorization;const S=v.headers["X-Amz-Date"];const w={a:b,d:S};if(p){w.t=p}const E={saslContinue:1,conversationId:1,payload:h.serialize(w)};r.command(`${l}.$cmd`,E,(e=>{if(e)return t(e);t()}))}))}))}}function makeTempCredentials(e,t){function done(r){if(r.AccessKeyId==null||r.SecretAccessKey==null||r.Token==null){t(new i("Could not obtain temporary MONGODB-AWS credentials"));return}t(undefined,new o({username:r.AccessKeyId,password:r.SecretAccessKey,source:e.source,mechanism:"MONGODB-AWS",mechanismProperties:{AWS_SESSION_TOKEN:r.Token}}))}if(process.env.AWS_CONTAINER_CREDENTIALS_RELATIVE_URI){request(`${p}${process.env.AWS_CONTAINER_CREDENTIALS_RELATIVE_URI}`,((e,r)=>{if(e)return t(e);done(r)}));return}request(`${h}/latest/api/token`,{method:"PUT",json:false,headers:{"X-aws-ec2-metadata-token-ttl-seconds":30}},((e,r)=>{if(e)return t(e);request(`${h}/${m}`,{json:false,headers:{"X-aws-ec2-metadata-token":r}},((e,n)=>{if(e)return t(e);request(`${h}/${m}/${n}`,{headers:{"X-aws-ec2-metadata-token":r}},((e,r)=>{if(e)return t(e);done(r)}))}))}))}function deriveRegion(e){const t=e.split(".");if(t.length===1||t[1]==="amazonaws"){return"us-east-1"}return t[1]}function request(e,t,r){if(typeof t==="function"){r=t;t={}}t=Object.assign({method:"GET",timeout:1e4,json:true},l.parse(e),t);const n=a.request(t,(e=>{e.setEncoding("utf8");let n="";e.on("data",(e=>n+=e));e.on("end",(()=>{if(t.json===false){r(undefined,n);return}try{const e=JSON.parse(n);r(undefined,e)}catch(e){r(new i(`Invalid JSON response: "${n}"`))}}))}));n.on("error",(e=>r(e)));n.end()}e.exports=MongoDBAWS},8728:(e,t,r)=>{"use strict";const n=r(7746).retrieveBSON;const o=r(557).AuthProvider;const i=n();const s=i.Binary;class Plain extends o{auth(e,t){const r=e.connection;const n=e.credentials;const o=n.username;const i=n.password;const a=new s(`\0${o}\0${i}`);const c={saslStart:1,mechanism:"PLAIN",payload:a,autoAuthorize:1};r.command("$external.$cmd",c,t)}}e.exports=Plain},864:(e,t,r)=>{"use strict";const n=r(6417);const o=r(1867).Buffer;const i=r(7746).retrieveBSON;const s=r(3111).MongoError;const a=r(557).AuthProvider;const c=r(1371).emitWarning;const l=i();const u=l.Binary;let d;try{d=r(9178)}catch(e){}class ScramSHA extends a{constructor(e,t){super(e);this.cryptoMethod=t||"sha1"}prepare(e,t,r){const o=this.cryptoMethod;if(o==="sha256"&&d==null){c("Warning: no saslprep library specified. Passwords will not be sanitized")}n.randomBytes(24,((n,i)=>{if(n){return r(n)}Object.assign(t,{nonce:i});const s=t.credentials;const a=Object.assign({},e,{speculativeAuthenticate:Object.assign(makeFirstMessage(o,s,i),{db:s.source})});r(undefined,a)}))}auth(e,t){const r=e.response;if(r&&r.speculativeAuthenticate){continueScramConversation(this.cryptoMethod,r.speculativeAuthenticate,e,t);return}executeScram(this.cryptoMethod,e,t)}}function cleanUsername(e){return e.replace("=","=3D").replace(",","=2C")}function clientFirstMessageBare(e,t){return o.concat([o.from("n=","utf8"),o.from(e,"utf8"),o.from(",r=","utf8"),o.from(t.toString("base64"),"utf8")])}function makeFirstMessage(e,t,r){const n=cleanUsername(t.username);const i=e==="sha1"?"SCRAM-SHA-1":"SCRAM-SHA-256";return{saslStart:1,mechanism:i,payload:new u(o.concat([o.from("n,,","utf8"),clientFirstMessageBare(n,r)])),autoAuthorize:1,options:{skipEmptyExchange:true}}}function executeScram(e,t,r){const n=t.connection;const o=t.credentials;const i=t.nonce;const s=o.source;const a=makeFirstMessage(e,o,i);n.command(`${s}.$cmd`,a,((n,o)=>{const i=resolveError(n,o);if(i){return r(i)}continueScramConversation(e,o.result,t,r)}))}function continueScramConversation(e,t,r,n){const i=r.connection;const a=r.credentials;const c=r.nonce;const l=a.source;const p=cleanUsername(a.username);const h=a.password;let m;if(e==="sha256"){m=d?d(h):h}else{try{m=passwordDigest(p,h)}catch(e){return n(e)}}const g=o.isBuffer(t.payload)?new u(t.payload):t.payload;const y=parsePayload(g.value());const v=parseInt(y.i,10);if(v&&v<4096){n(new s(`Server returned an invalid iteration count ${v}`),false);return}const b=y.s;const S=y.r;if(S.startsWith("nonce")){n(new s(`Server returned an invalid nonce: ${S}`),false);return}const w=`c=biws,r=${S}`;const E=HI(m,o.from(b,"base64"),v,e);const _=HMAC(e,E,"Client Key");const O=HMAC(e,E,"Server Key");const C=H(e,_);const T=[clientFirstMessageBare(p,c),g.value().toString("base64"),w].join(",");const I=HMAC(e,C,T);const k=`p=${xor(_,I)}`;const A=[w,k].join(",");const R=HMAC(e,O,T);const N={saslContinue:1,conversationId:t.conversationId,payload:new u(o.from(A))};i.command(`${l}.$cmd`,N,((e,t)=>{const r=resolveError(e,t);if(r){return n(r)}const a=t.result;const c=parsePayload(a.payload.value());if(!compareDigest(o.from(c.v,"base64"),R)){n(new s("Server returned an invalid signature"));return}if(!a||a.done!==false){return n(r,a)}const u={saslContinue:1,conversationId:a.conversationId,payload:o.alloc(0)};i.command(`${l}.$cmd`,u,n)}))}function parsePayload(e){const t={};const r=e.split(",");for(let e=0;e=200){_hiCachePurge()}p[i]=s;h+=1;return s}function compareDigest(e,t){if(e.length!==t.length){return false}if(typeof n.timingSafeEqual==="function"){return n.timingSafeEqual(e,t)}let r=0;for(let n=0;n{"use strict";const n=r(557).AuthProvider;class X509 extends n{prepare(e,t,r){const n=t.credentials;Object.assign(e,{speculativeAuthenticate:x509AuthenticateCommand(n)});r(undefined,e)}auth(e,t){const r=e.connection;const n=e.credentials;const o=e.response;if(o.speculativeAuthenticate){return t()}r.command("$external.$cmd",x509AuthenticateCommand(n),t)}}function x509AuthenticateCommand(e){const t={authenticate:1,mechanism:"MONGODB-X509"};if(e.username){Object.assign(t,{user:e.username})}return t}e.exports=X509},9815:(e,t,r)=>{"use strict";const n=r(8988).Msg;const o=r(9814).KillCursor;const i=r(9814).GetMore;const s=r(1371).calculateDurationInMs;const a=new Set(["authenticate","saslStart","saslContinue","getnonce","createUser","updateUser","copydbgetnonce","copydbsaslstart","copydb"]);const extractCommandName=e=>Object.keys(e)[0];const namespace=e=>e.ns;const databaseName=e=>e.ns.split(".")[0];const collectionName=e=>e.ns.split(".")[1];const generateConnectionId=e=>e.options?`${e.options.host}:${e.options.port}`:e.address;const maybeRedact=(e,t)=>a.has(e)?{}:t;const isLegacyPool=e=>e.s&&e.queue;const c={$query:"filter",$orderby:"sort",$hint:"hint",$comment:"comment",$maxScan:"maxScan",$max:"max",$min:"min",$returnKey:"returnKey",$showDiskLoc:"showRecordId",$maxTimeMS:"maxTimeMS",$snapshot:"snapshot"};const l={numberToSkip:"skip",numberToReturn:"batchSize",returnFieldsSelector:"projection"};const u=["tailable","oplogReplay","noCursorTimeout","awaitData","partial","exhaust"];const extractCommand=e=>{if(e instanceof i){return{getMore:e.cursorId,collection:collectionName(e),batchSize:e.numberToReturn}}if(e instanceof o){return{killCursors:collectionName(e),cursors:e.cursorIds}}if(e instanceof n){return e.command}if(e.query&&e.query.$query){let t;if(e.ns==="admin.$cmd"){t=Object.assign({},e.query.$query)}else{t={find:collectionName(e)};Object.keys(c).forEach((r=>{if(typeof e.query[r]!=="undefined")t[c[r]]=e.query[r]}))}Object.keys(l).forEach((r=>{if(typeof e[r]!=="undefined")t[l[r]]=e[r]}));u.forEach((r=>{if(e[r])t[r]=e[r]}));if(typeof e.pre32Limit!=="undefined"){t.limit=e.pre32Limit}if(e.query.$explain){return{explain:t}}return t}return e.query?e.query:e};const extractReply=(e,t)=>{if(e instanceof i){return{ok:1,cursor:{id:t.message.cursorId,ns:namespace(e),nextBatch:t.message.documents}}}if(e instanceof o){return{ok:1,cursorsUnknown:e.cursorIds}}if(e.query&&typeof e.query.$query!=="undefined"){return{ok:1,cursor:{id:t.message.cursorId,ns:namespace(e),firstBatch:t.message.documents}}}return t&&t.result?t.result:t};const extractConnectionDetails=e=>{if(isLegacyPool(e)){return{connectionId:generateConnectionId(e)}}const t=e;return{address:t.address,connectionId:t.id}};class CommandStartedEvent{constructor(e,t){const r=extractCommand(t);const n=extractCommandName(r);const o=extractConnectionDetails(e);if(a.has(n)){this.commandObj={};this.commandObj[n]=true}Object.assign(this,o,{requestId:t.requestId,databaseName:databaseName(t),commandName:n,command:r})}}class CommandSucceededEvent{constructor(e,t,r,n){const o=extractCommand(t);const i=extractCommandName(o);const a=extractConnectionDetails(e);Object.assign(this,a,{requestId:t.requestId,commandName:i,duration:s(n),reply:maybeRedact(i,extractReply(t,r))})}}class CommandFailedEvent{constructor(e,t,r,n){const o=extractCommand(t);const i=extractCommandName(o);const a=extractConnectionDetails(e);Object.assign(this,a,{requestId:t.requestId,commandName:i,duration:s(n),failure:maybeRedact(i,r)})}}e.exports={CommandStartedEvent:CommandStartedEvent,CommandSucceededEvent:CommandSucceededEvent,CommandFailedEvent:CommandFailedEvent}},2337:e=>{"use strict";var CommandResult=function(e,t,r){this.result=e;this.connection=t;this.message=r};CommandResult.prototype.toJSON=function(){let e=Object.assign({},this,this.result);delete e.message;return e};CommandResult.prototype.toString=function(){return JSON.stringify(this.toJSON())};e.exports=CommandResult},9814:(e,t,r)=>{"use strict";var n=r(7746).retrieveBSON;var o=n();var i=o.Long;const s=r(1867).Buffer;var a=0;var c=r(7272).opcodes;var l=2;var u=4;var d=8;var p=16;var h=32;var m=64;var g=128;var y=1;var v=2;var b=4;var S=8;var Query=function(e,t,r,n){var o=this;if(t==null)throw new Error("ns must be specified for query");if(r==null)throw new Error("query must be specified for query");if(t.indexOf("\0")!==-1){throw new Error("namespace cannot contain a null character")}this.bson=e;this.ns=t;this.query=r;this.numberToSkip=n.numberToSkip||0;this.numberToReturn=n.numberToReturn||0;this.returnFieldSelector=n.returnFieldSelector||null;this.requestId=Query.getRequestId();this.pre32Limit=n.pre32Limit;this.serializeFunctions=typeof n.serializeFunctions==="boolean"?n.serializeFunctions:false;this.ignoreUndefined=typeof n.ignoreUndefined==="boolean"?n.ignoreUndefined:false;this.maxBsonSize=n.maxBsonSize||1024*1024*16;this.checkKeys=typeof n.checkKeys==="boolean"?n.checkKeys:true;this.batchSize=o.numberToReturn;this.tailable=false;this.slaveOk=typeof n.slaveOk==="boolean"?n.slaveOk:false;this.oplogReplay=false;this.noCursorTimeout=false;this.awaitData=false;this.exhaust=false;this.partial=false};Query.prototype.incRequestId=function(){this.requestId=a++};Query.nextRequestId=function(){return a+1};Query.prototype.toBin=function(){var e=this;var t=[];var r=null;var n=0;if(this.tailable){n|=l}if(this.slaveOk){n|=u}if(this.oplogReplay){n|=d}if(this.noCursorTimeout){n|=p}if(this.awaitData){n|=h}if(this.exhaust){n|=m}if(this.partial){n|=g}if(e.batchSize!==e.numberToReturn)e.numberToReturn=e.batchSize;var o=s.alloc(4*4+4+s.byteLength(e.ns)+1+4+4);t.push(o);var i=e.bson.serialize(this.query,{checkKeys:this.checkKeys,serializeFunctions:this.serializeFunctions,ignoreUndefined:this.ignoreUndefined});t.push(i);if(e.returnFieldSelector&&Object.keys(e.returnFieldSelector).length>0){r=e.bson.serialize(this.returnFieldSelector,{checkKeys:this.checkKeys,serializeFunctions:this.serializeFunctions,ignoreUndefined:this.ignoreUndefined});t.push(r)}var a=o.length+i.length+(r?r.length:0);var y=4;o[3]=a>>24&255;o[2]=a>>16&255;o[1]=a>>8&255;o[0]=a&255;o[y+3]=this.requestId>>24&255;o[y+2]=this.requestId>>16&255;o[y+1]=this.requestId>>8&255;o[y]=this.requestId&255;y=y+4;o[y+3]=0>>24&255;o[y+2]=0>>16&255;o[y+1]=0>>8&255;o[y]=0&255;y=y+4;o[y+3]=c.OP_QUERY>>24&255;o[y+2]=c.OP_QUERY>>16&255;o[y+1]=c.OP_QUERY>>8&255;o[y]=c.OP_QUERY&255;y=y+4;o[y+3]=n>>24&255;o[y+2]=n>>16&255;o[y+1]=n>>8&255;o[y]=n&255;y=y+4;y=y+o.write(this.ns,y,"utf8")+1;o[y-1]=0;o[y+3]=this.numberToSkip>>24&255;o[y+2]=this.numberToSkip>>16&255;o[y+1]=this.numberToSkip>>8&255;o[y]=this.numberToSkip&255;y=y+4;o[y+3]=this.numberToReturn>>24&255;o[y+2]=this.numberToReturn>>16&255;o[y+1]=this.numberToReturn>>8&255;o[y]=this.numberToReturn&255;y=y+4;return t};Query.getRequestId=function(){return++a};var GetMore=function(e,t,r,n){n=n||{};this.numberToReturn=n.numberToReturn||0;this.requestId=a++;this.bson=e;this.ns=t;this.cursorId=r};GetMore.prototype.toBin=function(){var e=4+s.byteLength(this.ns)+1+4+8+4*4;var t=0;var r=s.alloc(e);r[t+3]=e>>24&255;r[t+2]=e>>16&255;r[t+1]=e>>8&255;r[t]=e&255;t=t+4;r[t+3]=this.requestId>>24&255;r[t+2]=this.requestId>>16&255;r[t+1]=this.requestId>>8&255;r[t]=this.requestId&255;t=t+4;r[t+3]=0>>24&255;r[t+2]=0>>16&255;r[t+1]=0>>8&255;r[t]=0&255;t=t+4;r[t+3]=c.OP_GETMORE>>24&255;r[t+2]=c.OP_GETMORE>>16&255;r[t+1]=c.OP_GETMORE>>8&255;r[t]=c.OP_GETMORE&255;t=t+4;r[t+3]=0>>24&255;r[t+2]=0>>16&255;r[t+1]=0>>8&255;r[t]=0&255;t=t+4;t=t+r.write(this.ns,t,"utf8")+1;r[t-1]=0;r[t+3]=this.numberToReturn>>24&255;r[t+2]=this.numberToReturn>>16&255;r[t+1]=this.numberToReturn>>8&255;r[t]=this.numberToReturn&255;t=t+4;r[t+3]=this.cursorId.getLowBits()>>24&255;r[t+2]=this.cursorId.getLowBits()>>16&255;r[t+1]=this.cursorId.getLowBits()>>8&255;r[t]=this.cursorId.getLowBits()&255;t=t+4;r[t+3]=this.cursorId.getHighBits()>>24&255;r[t+2]=this.cursorId.getHighBits()>>16&255;r[t+1]=this.cursorId.getHighBits()>>8&255;r[t]=this.cursorId.getHighBits()&255;t=t+4;return r};var KillCursor=function(e,t,r){this.ns=t;this.requestId=a++;this.cursorIds=r};KillCursor.prototype.toBin=function(){var e=4+4+4*4+this.cursorIds.length*8;var t=0;var r=s.alloc(e);r[t+3]=e>>24&255;r[t+2]=e>>16&255;r[t+1]=e>>8&255;r[t]=e&255;t=t+4;r[t+3]=this.requestId>>24&255;r[t+2]=this.requestId>>16&255;r[t+1]=this.requestId>>8&255;r[t]=this.requestId&255;t=t+4;r[t+3]=0>>24&255;r[t+2]=0>>16&255;r[t+1]=0>>8&255;r[t]=0&255;t=t+4;r[t+3]=c.OP_KILL_CURSORS>>24&255;r[t+2]=c.OP_KILL_CURSORS>>16&255;r[t+1]=c.OP_KILL_CURSORS>>8&255;r[t]=c.OP_KILL_CURSORS&255;t=t+4;r[t+3]=0>>24&255;r[t+2]=0>>16&255;r[t+1]=0>>8&255;r[t]=0&255;t=t+4;r[t+3]=this.cursorIds.length>>24&255;r[t+2]=this.cursorIds.length>>16&255;r[t+1]=this.cursorIds.length>>8&255;r[t]=this.cursorIds.length&255;t=t+4;for(var n=0;n>24&255;r[t+2]=this.cursorIds[n].getLowBits()>>16&255;r[t+1]=this.cursorIds[n].getLowBits()>>8&255;r[t]=this.cursorIds[n].getLowBits()&255;t=t+4;r[t+3]=this.cursorIds[n].getHighBits()>>24&255;r[t+2]=this.cursorIds[n].getHighBits()>>16&255;r[t+1]=this.cursorIds[n].getHighBits()>>8&255;r[t]=this.cursorIds[n].getHighBits()&255;t=t+4}return r};var Response=function(e,t,r,n,o){o=o||{promoteLongs:true,promoteValues:true,promoteBuffers:false};this.parsed=false;this.raw=t;this.data=n;this.bson=e;this.opts=o;this.length=r.length;this.requestId=r.requestId;this.responseTo=r.responseTo;this.opCode=r.opCode;this.fromCompressed=r.fromCompressed;this.responseFlags=n.readInt32LE(0);this.cursorId=new i(n.readInt32LE(4),n.readInt32LE(8));this.startingFrom=n.readInt32LE(12);this.numberReturned=n.readInt32LE(16);this.documents=new Array(this.numberReturned);this.cursorNotFound=(this.responseFlags&y)!==0;this.queryFailure=(this.responseFlags&v)!==0;this.shardConfigStale=(this.responseFlags&b)!==0;this.awaitCapable=(this.responseFlags&S)!==0;this.promoteLongs=typeof o.promoteLongs==="boolean"?o.promoteLongs:true;this.promoteValues=typeof o.promoteValues==="boolean"?o.promoteValues:true;this.promoteBuffers=typeof o.promoteBuffers==="boolean"?o.promoteBuffers:false};Response.prototype.isParsed=function(){return this.parsed};Response.prototype.parse=function(e){if(this.parsed)return;e=e||{};var t=e.raw||false;var r=e.documentsReturnedIn||null;var n=typeof e.promoteLongs==="boolean"?e.promoteLongs:this.opts.promoteLongs;var o=typeof e.promoteValues==="boolean"?e.promoteValues:this.opts.promoteValues;var i=typeof e.promoteBuffers==="boolean"?e.promoteBuffers:this.opts.promoteBuffers;var s,a;a={promoteLongs:n,promoteValues:o,promoteBuffers:i};this.index=20;for(var c=0;c{"use strict";const n=r(1631);const o=r(4016);const i=r(6096);const s=r(3111).MongoError;const a=r(3111).MongoNetworkError;const c=r(3111).MongoNetworkTimeoutError;const l=r(2192).defaultAuthProviders;const u=r(557).AuthContext;const d=r(7161);const p=r(1178).makeClientMetadata;const h=d.MAX_SUPPORTED_WIRE_VERSION;const m=d.MAX_SUPPORTED_SERVER_VERSION;const g=d.MIN_SUPPORTED_WIRE_VERSION;const y=d.MIN_SUPPORTED_SERVER_VERSION;let v;function connect(e,t,r){if(typeof t==="function"){r=t;t=undefined}const n=e&&e.connectionType?e.connectionType:i;if(v==null){v=l(e.bson)}const o=e.family!==void 0?e.family:0;makeConnection(o,e,t,((t,o)=>{if(t){r(t,o);return}performInitialHandshake(new n(o,e),e,r)}))}function isModernConnectionType(e){return!(e instanceof i)}function checkSupportedServer(e,t){const r=e&&typeof e.maxWireVersion==="number"&&e.maxWireVersion>=g;const n=e&&typeof e.minWireVersion==="number"&&e.minWireVersion<=h;if(r){if(n){return null}const r=`Server at ${t.host}:${t.port} reports minimum wire version ${e.minWireVersion}, but this version of the Node.js Driver requires at most ${h} (MongoDB ${m})`;return new s(r)}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 ${g} (MongoDB ${y})`;return new s(o)}function performInitialHandshake(e,t,r){const callback=function(t,n){if(t&&e){e.destroy()}r(t,n)};const n=t.credentials;if(n){if(!n.mechanism.match(/DEFAULT/i)&&!v[n.mechanism]){callback(new s(`authMechanism '${n.mechanism}' not supported`));return}}const o=new u(e,n,t);prepareHandshakeDocument(o,((r,i)=>{if(r){return callback(r)}const a=Object.assign({},t);if(t.connectTimeoutMS||t.connectionTimeout){a.socketTimeout=t.connectTimeoutMS||t.connectionTimeout}const c=(new Date).getTime();e.command("admin.$cmd",i,a,((r,a)=>{if(r){callback(r);return}const l=a.result;if(l.ok===0){callback(new s(l));return}const u=checkSupportedServer(l,t);if(u){callback(u);return}if(!isModernConnectionType(e)){if(l.compression){const r=i.compression.filter((e=>l.compression.indexOf(e)!==-1));if(r.length){e.agreedCompressor=r[0]}if(t.compression&&t.compression.zlibCompressionLevel){e.zlibCompressionLevel=t.compression.zlibCompressionLevel}}}e.ismaster=l;e.lastIsMasterMS=(new Date).getTime()-c;if(!l.arbiterOnly&&n){Object.assign(o,{response:l});const t=n.resolveAuthMechanism(l);const r=v[t.mechanism];r.auth(o,(t=>{if(t)return callback(t);callback(undefined,e)}));return}callback(undefined,e)}))}))}function prepareHandshakeDocument(e,t){const r=e.options;const n=r.compression&&r.compression.compressors?r.compression.compressors:[];const o={ismaster:true,client:r.metadata||p(r),compression:n};const i=e.credentials;if(i){if(i.mechanism.match(/DEFAULT/i)&&i.username){Object.assign(o,{saslSupportedMechs:`${i.source}.${i.username}`});v["scram-sha-256"].prepare(o,e,t);return}const r=v[i.mechanism];r.prepare(o,e,t);return}t(undefined,o)}const b=["pfx","key","passphrase","cert","ca","ciphers","NPNProtocols","ALPNProtocols","servername","ecdhCurve","secureProtocol","secureContext","session","minDHSize","crl","rejectUnauthorized"];function parseConnectOptions(e,t){const r=typeof t.host==="string"?t.host:"localhost";if(r.indexOf("/")!==-1){return{path:r}}const n={family:e,host:r,port:typeof t.port==="number"?t.port:27017,rejectUnauthorized:false};return n}function parseSslOptions(e,t){const r=parseConnectOptions(e,t);for(const e in t){if(t[e]!=null&&b.indexOf(e)!==-1){r[e]=t[e]}}if(t.checkServerIdentity===false){r.checkServerIdentity=function(){return undefined}}else if(typeof t.checkServerIdentity==="function"){r.checkServerIdentity=t.checkServerIdentity}if(r.servername==null&&!n.isIP(r.host)){r.servername=r.host}return r}const S=new Set(["error","close","timeout","parseError"]);function makeConnection(e,t,r,i){const s=typeof t.ssl==="boolean"?t.ssl:false;const a=typeof t.keepAlive==="boolean"?t.keepAlive:true;let c=typeof t.keepAliveInitialDelay==="number"?t.keepAliveInitialDelay:12e4;const l=typeof t.noDelay==="boolean"?t.noDelay:true;const u=typeof t.connectionTimeout==="number"?t.connectionTimeout:typeof t.connectTimeoutMS==="number"?t.connectTimeoutMS:3e4;const d=typeof t.socketTimeout==="number"?t.socketTimeout:0;const p=typeof t.rejectUnauthorized==="boolean"?t.rejectUnauthorized:true;if(c>d){c=Math.round(d/2)}let h;const callback=function(e,t){if(e&&h){h.destroy()}i(e,t)};try{if(s){h=o.connect(parseSslOptions(e,t));if(typeof h.disableRenegotiation==="function"){h.disableRenegotiation()}}else{h=n.createConnection(parseConnectOptions(e,t))}}catch(e){return callback(e)}h.setKeepAlive(a,c);h.setTimeout(u);h.setNoDelay(l);const m=s?"secureConnect":"connect";let g;function errorHandler(e){return t=>{S.forEach((e=>h.removeAllListeners(e)));if(g){r.removeListener("cancel",g)}h.removeListener(m,connectHandler);callback(connectionFailureError(e,t))}}function connectHandler(){S.forEach((e=>h.removeAllListeners(e)));if(g){r.removeListener("cancel",g)}if(h.authorizationError&&p){return callback(h.authorizationError)}h.setTimeout(d);callback(null,h)}S.forEach((e=>h.once(e,errorHandler(e))));if(r){g=errorHandler("cancel");r.once("cancel",g)}h.once(m,connectHandler)}function connectionFailureError(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.exports=connect},6096:(e,t,r)=>{"use strict";const n=r(8614).EventEmitter;const o=r(6417);const i=r(7746).debugOptions;const s=r(7272).parseHeader;const a=r(7793).decompress;const c=r(9814).Response;const l=r(8988).BinMsg;const u=r(3111).MongoNetworkError;const d=r(3111).MongoNetworkTimeoutError;const p=r(3111).MongoError;const h=r(104);const m=r(7272).opcodes.OP_COMPRESSED;const g=r(7272).opcodes.OP_MSG;const y=r(7272).MESSAGE_HEADER_SIZE;const v=r(1867).Buffer;const b=r(9814).Query;const S=r(2337);let w=0;const E=1024*1024*16*4;const _=["host","port","size","keepAlive","keepAliveInitialDelay","noDelay","connectionTimeout","socketTimeout","ssl","ca","crl","cert","rejectUnauthorized","promoteLongs","promoteValues","promoteBuffers","checkServerIdentity"];let O=undefined;let C=false;let T={};class Connection extends n{constructor(e,t){super();t=t||{};if(!t.bson){throw new TypeError("must pass in valid bson parser")}this.id=w++;this.options=t;this.logger=h("Connection",t);this.bson=t.bson;this.tag=t.tag;this.maxBsonMessageSize=t.maxBsonMessageSize||E;this.port=t.port||27017;this.host=t.host||"localhost";this.socketTimeout=typeof t.socketTimeout==="number"?t.socketTimeout:0;this.keepAlive=typeof t.keepAlive==="boolean"?t.keepAlive:true;this.keepAliveInitialDelay=typeof t.keepAliveInitialDelay==="number"?t.keepAliveInitialDelay:12e4;this.connectionTimeout=typeof t.connectionTimeout==="number"?t.connectionTimeout:3e4;if(this.keepAliveInitialDelay>this.socketTimeout){this.keepAliveInitialDelay=Math.round(this.socketTimeout/2)}if(this.logger.isDebug()){this.logger.debug(`creating connection ${this.id} with options [${JSON.stringify(i(_,t))}]`)}this.responseOptions={promoteLongs:typeof t.promoteLongs==="boolean"?t.promoteLongs:true,promoteValues:typeof t.promoteValues==="boolean"?t.promoteValues:true,promoteBuffers:typeof t.promoteBuffers==="boolean"?t.promoteBuffers:false};this.flushing=false;this.queue=[];this.writeStream=null;this.destroyed=false;this.timedOut=false;const r=o.createHash("sha1");r.update(this.address);this.hashedName=r.digest("hex");this.workItems=[];this.socket=e;this.socket.once("error",errorHandler(this));this.socket.once("timeout",timeoutHandler(this));this.socket.once("close",closeHandler(this));this.socket.on("data",dataHandler(this));if(C){addConnection(this.id,this)}}setSocketTimeout(e){if(this.socket){this.socket.setTimeout(e)}}resetSocketTimeout(){if(this.socket){this.socket.setTimeout(this.socketTimeout)}}static enableConnectionAccounting(e){if(e){O=e}C=true;T={}}static disableConnectionAccounting(){C=false;O=undefined}static connections(){return T}get address(){return`${this.host}:${this.port}`}unref(){if(this.socket==null){this.once("connect",(()=>this.socket.unref()));return}this.socket.unref()}flush(e){while(this.workItems.length>0){const t=this.workItems.shift();if(t.cb){t.cb(e)}}}destroy(e,t){if(typeof e==="function"){t=e;e={}}e=Object.assign({force:false},e);if(C){deleteConnection(this.id)}if(this.socket==null){this.destroyed=true;return}if(e.force||this.timedOut){this.socket.destroy();this.destroyed=true;if(typeof t==="function")t(null,null);return}this.socket.end((e=>{this.destroyed=true;if(typeof t==="function")t(e,null)}))}write(e){if(this.logger.isDebug()){if(!Array.isArray(e)){this.logger.debug(`writing buffer [${e.toString("hex")}] to ${this.address}`)}else{for(let t=0;t{};function _callback(e,t){n(e,t);n=noop}function errorHandler(e){o.resetSocketTimeout();I.forEach((e=>o.removeListener(e,errorHandler)));o.removeListener("message",messageHandler);if(e==null){e=new p(`runCommand failed for connection to '${o.address}'`)}o.on("error",noop);_callback(e)}function messageHandler(e){if(e.responseTo!==a.requestId){return}o.resetSocketTimeout();I.forEach((e=>o.removeListener(e,errorHandler)));o.removeListener("message",messageHandler);e.parse({promoteValues:true});const t=e.documents[0];if(t.ok===0||t.$err||t.errmsg||t.code){_callback(new p(t));return}_callback(undefined,new S(t,this,e))}o.setSocketTimeout(i);I.forEach((e=>o.once(e,errorHandler)));o.on("message",messageHandler);o.write(a.toBin())}}const I=["error","close","timeout","parseError"];function deleteConnection(e){delete T[e];if(O){O.deleteConnection(e)}}function addConnection(e,t){T[e]=t;if(O){O.addConnection(e,t)}}function errorHandler(e){return function(t){if(C)deleteConnection(e.id);if(e.logger.isDebug()){e.logger.debug(`connection ${e.id} for [${e.address}] errored out with [${JSON.stringify(t)}]`)}e.emit("error",new u(t),e)}}function timeoutHandler(e){return function(){if(C)deleteConnection(e.id);if(e.logger.isDebug()){e.logger.debug(`connection ${e.id} for [${e.address}] timed out`)}e.timedOut=true;e.emit("timeout",new d(`connection ${e.id} to ${e.address} timed out`,{beforeHandshake:e.ismaster==null}),e)}}function closeHandler(e){return function(t){if(C)deleteConnection(e.id);if(e.logger.isDebug()){e.logger.debug(`connection ${e.id} with for [${e.address}] closed`)}if(!t){e.emit("close",new u(`connection ${e.id} to ${e.address} closed`),e)}}}function processMessage(e,t){const r=s(t);if(r.opCode!==m){const n=r.opCode===g?l:c;e.emit("message",new n(e.bson,t,r,t.slice(y),e.responseOptions),e);return}r.fromCompressed=true;let n=y;r.opCode=t.readInt32LE(n);n+=4;r.length=t.readInt32LE(n);n+=4;const o=t[n];n++;a(o,t.slice(n),((n,o)=>{if(n){e.emit("error",n);return}if(o.length!==r.length){e.emit("error",new p("Decompressing a compressed message from the server failed. The message is corrupt."));return}const i=r.opCode===g?l:c;e.emit("message",new i(e.bson,t,r,o,e.responseOptions),e)}))}function dataHandler(e){return function(t){while(t.length>0){if(e.bytesRead>0&&e.sizeOfMessage>0){const r=e.sizeOfMessage-e.bytesRead;if(r>t.length){t.copy(e.buffer,e.bytesRead);e.bytesRead=e.bytesRead+t.length;t=v.alloc(0)}else{t.copy(e.buffer,e.bytesRead,0,r);t=t.slice(r);const n=e.buffer;e.buffer=null;e.sizeOfMessage=0;e.bytesRead=0;e.stubBuffer=null;processMessage(e,n)}}else{if(e.stubBuffer!=null&&e.stubBuffer.length>0){if(e.stubBuffer.length+t.length>4){const r=v.alloc(e.stubBuffer.length+t.length);e.stubBuffer.copy(r,0);t.copy(r,e.stubBuffer.length);t=r;e.buffer=null;e.sizeOfMessage=0;e.bytesRead=0;e.stubBuffer=null}else{const r=v.alloc(e.stubBuffer.length+t.length);e.stubBuffer.copy(r,0);t.copy(r,e.stubBuffer.length);t=v.alloc(0)}}else{if(t.length>4){const r=t[0]|t[1]<<8|t[2]<<16|t[3]<<24;if(r<0||r>e.maxBsonMessageSize){const t={err:"socketHandler",trace:"",bin:e.buffer,parseState:{sizeOfMessage:r,bytesRead:e.bytesRead,stubBuffer:e.stubBuffer}};e.emit("parseError",t,e);return}if(r>4&&rt.length){e.buffer=v.alloc(r);t.copy(e.buffer,0);e.bytesRead=t.length;e.sizeOfMessage=r;e.stubBuffer=null;t=v.alloc(0)}else if(r>4&&re.maxBsonMessageSize){const n={err:"socketHandler",trace:null,bin:t,parseState:{sizeOfMessage:r,bytesRead:0,buffer:null,stubBuffer:null}};e.emit("parseError",n,e);e.buffer=null;e.sizeOfMessage=0;e.bytesRead=0;e.stubBuffer=null;t=v.alloc(0)}else{const n=t.slice(0,r);e.buffer=null;e.sizeOfMessage=0;e.bytesRead=0;e.stubBuffer=null;t=t.slice(r);processMessage(e,n)}}else{e.stubBuffer=v.alloc(t.length);t.copy(e.stubBuffer,0);t=v.alloc(0)}}}}}}e.exports=Connection},104:(e,t,r)=>{"use strict";var n=r(1669).format,o=r(3111).MongoError;var i={};var s={};var a=null;var c=process.pid;var l=null;var Logger=function(e,t){if(!(this instanceof Logger))return new Logger(e,t);t=t||{};this.className=e;if(t.logger){l=t.logger}else if(l==null){l=console.log}if(t.loggerLevel){a=t.loggerLevel||"error"}if(s[this.className]==null)i[this.className]=true};Logger.prototype.debug=function(e,t){if(this.isDebug()&&(Object.keys(s).length>0&&s[this.className]||Object.keys(s).length===0&&i[this.className])){var r=(new Date).getTime();var o=n("[%s-%s:%s] %s %s","DEBUG",this.className,c,r,e);var a={type:"debug",message:e,className:this.className,pid:c,date:r};if(t)a.meta=t;l(o,a)}};Logger.prototype.warn=function(e,t){if(this.isWarn()&&(Object.keys(s).length>0&&s[this.className]||Object.keys(s).length===0&&i[this.className])){var r=(new Date).getTime();var o=n("[%s-%s:%s] %s %s","WARN",this.className,c,r,e);var a={type:"warn",message:e,className:this.className,pid:c,date:r};if(t)a.meta=t;l(o,a)}},Logger.prototype.info=function(e,t){if(this.isInfo()&&(Object.keys(s).length>0&&s[this.className]||Object.keys(s).length===0&&i[this.className])){var r=(new Date).getTime();var o=n("[%s-%s:%s] %s %s","INFO",this.className,c,r,e);var a={type:"info",message:e,className:this.className,pid:c,date:r};if(t)a.meta=t;l(o,a)}},Logger.prototype.error=function(e,t){if(this.isError()&&(Object.keys(s).length>0&&s[this.className]||Object.keys(s).length===0&&i[this.className])){var r=(new Date).getTime();var o=n("[%s-%s:%s] %s %s","ERROR",this.className,c,r,e);var a={type:"error",message:e,className:this.className,pid:c,date:r};if(t)a.meta=t;l(o,a)}},Logger.prototype.isInfo=function(){return a==="info"||a==="debug"},Logger.prototype.isError=function(){return a==="error"||a==="info"||a==="debug"},Logger.prototype.isWarn=function(){return a==="error"||a==="warn"||a==="info"||a==="debug"},Logger.prototype.isDebug=function(){return a==="debug"};Logger.reset=function(){a="error";s={}};Logger.currentLogger=function(){return l};Logger.setCurrentLogger=function(e){if(typeof e!=="function")throw new o("current logger must be a function");l=e};Logger.filter=function(e,t){if(e==="class"&&Array.isArray(t)){s={};t.forEach((function(e){s[e]=true}))}};Logger.setLevel=function(e){if(e!=="info"&&e!=="error"&&e!=="debug"&&e!=="warn"){throw new Error(n("%s is an illegal logging level",e))}a=e};e.exports=Logger},8988:(e,t,r)=>{"use strict";const n=r(1867).Buffer;const o=r(7272).opcodes;const i=r(7272).databaseNamespace;const s=r(4485);const a=r(3111).MongoError;let c=0;const l=1;const u=2;const d=1<<16;class Msg{constructor(e,t,r,n){if(r==null)throw new Error("query must be specified for query");this.bson=e;this.ns=t;this.command=r;this.command.$db=i(t);if(n.readPreference&&n.readPreference.mode!==s.PRIMARY){this.command.$readPreference=n.readPreference.toJSON()}this.options=n||{};this.requestId=n.requestId?n.requestId:Msg.getRequestId();this.serializeFunctions=typeof n.serializeFunctions==="boolean"?n.serializeFunctions:false;this.ignoreUndefined=typeof n.ignoreUndefined==="boolean"?n.ignoreUndefined:false;this.checkKeys=typeof n.checkKeys==="boolean"?n.checkKeys:false;this.maxBsonSize=n.maxBsonSize||1024*1024*16;this.checksumPresent=false;this.moreToCome=n.moreToCome||false;this.exhaustAllowed=typeof n.exhaustAllowed==="boolean"?n.exhaustAllowed:false}toBin(){const e=[];let t=0;if(this.checksumPresent){t|=l}if(this.moreToCome){t|=u}if(this.exhaustAllowed){t|=d}const r=n.alloc(4*4+4);e.push(r);let i=r.length;const s=this.command;i+=this.makeDocumentSegment(e,s);r.writeInt32LE(i,0);r.writeInt32LE(this.requestId,4);r.writeInt32LE(0,8);r.writeInt32LE(o.OP_MSG,12);r.writeUInt32LE(t,16);return e}makeDocumentSegment(e,t){const r=n.alloc(1);r[0]=0;const o=this.serializeBson(t);e.push(r);e.push(o);return r.length+o.length}serializeBson(e){return this.bson.serialize(e,{checkKeys:this.checkKeys,serializeFunctions:this.serializeFunctions,ignoreUndefined:this.ignoreUndefined})}}Msg.getRequestId=function(){c=c+1&2147483647;return c};class BinMsg{constructor(e,t,r,n,o){o=o||{promoteLongs:true,promoteValues:true,promoteBuffers:false};this.parsed=false;this.raw=t;this.data=n;this.bson=e;this.opts=o;this.length=r.length;this.requestId=r.requestId;this.responseTo=r.responseTo;this.opCode=r.opCode;this.fromCompressed=r.fromCompressed;this.responseFlags=n.readInt32LE(0);this.checksumPresent=(this.responseFlags&l)!==0;this.moreToCome=(this.responseFlags&u)!==0;this.exhaustAllowed=(this.responseFlags&d)!==0;this.promoteLongs=typeof o.promoteLongs==="boolean"?o.promoteLongs:true;this.promoteValues=typeof o.promoteValues==="boolean"?o.promoteValues:true;this.promoteBuffers=typeof o.promoteBuffers==="boolean"?o.promoteBuffers:false;this.documents=[]}isParsed(){return this.parsed}parse(e){if(this.parsed)return;e=e||{};this.index=4;const t=e.raw||false;const r=e.documentsReturnedIn||null;const n=typeof e.promoteLongs==="boolean"?e.promoteLongs:this.opts.promoteLongs;const o=typeof e.promoteValues==="boolean"?e.promoteValues:this.opts.promoteValues;const i=typeof e.promoteBuffers==="boolean"?e.promoteBuffers:this.opts.promoteBuffers;const s={promoteLongs:n,promoteValues:o,promoteBuffers:i};while(this.index{"use strict";const n=r(1669).inherits;const o=r(8614).EventEmitter;const i=r(3111).MongoError;const s=r(3111).MongoTimeoutError;const a=r(3111).MongoWriteConcernError;const c=r(104);const l=r(1669).format;const u=r(8988).Msg;const d=r(2337);const p=r(7272).MESSAGE_HEADER_SIZE;const h=r(7272).COMPRESSION_DETAILS_SIZE;const m=r(7272).opcodes;const g=r(7793).compress;const y=r(7793).compressorIDs;const v=r(7793).uncompressibleCommands;const b=r(9815);const S=r(1867).Buffer;const w=r(6573);const E=r(5474).updateSessionFromResponse;const _=r(1178).eachAsync;const O=r(1178).makeStateMachine;const C=r(1371).now;const T="disconnected";const I="connecting";const k="connected";const A="draining";const R="destroying";const N="destroyed";const M=O({[T]:[I,A,T],[I]:[I,k,A,T],[k]:[k,T,A],[A]:[A,R,N],[R]:[R,N],[N]:[N]});const D=new Set(["error","close","timeout","parseError","connect","message"]);var P=0;var Pool=function(e,t){o.call(this);this.topology=e;this.s={state:T,cancellationToken:new o};this.s.cancellationToken.setMaxListeners(Infinity);this.options=Object.assign({host:"localhost",port:27017,size:5,minSize:0,connectionTimeout:3e4,socketTimeout:0,keepAlive:true,keepAliveInitialDelay:12e4,noDelay:true,ssl:false,checkServerIdentity:true,ca:null,crl:null,cert:null,key:null,passphrase:null,rejectUnauthorized:false,promoteLongs:true,promoteValues:true,promoteBuffers:false,reconnect:true,reconnectInterval:1e3,reconnectTries:30,domainsEnabled:false,legacyCompatMode:true},t);this.id=P++;this.retriesLeft=this.options.reconnectTries;this.reconnectId=null;this.reconnectError=null;if(!t.bson||t.bson&&(typeof t.bson.serialize!=="function"||typeof t.bson.deserialize!=="function")){throw new Error("must pass in valid bson parser")}this.logger=c("Pool",t);this.availableConnections=[];this.inUseConnections=[];this.connectingConnections=0;this.executing=false;this.queue=[];this.numberOfConsecutiveTimeouts=0;this.connectionIndex=0;const r=this;this._messageHandler=messageHandler(this);this._connectionCloseHandler=function(e){const t=this;connectionFailureHandler(r,"close",e,t)};this._connectionErrorHandler=function(e){const t=this;connectionFailureHandler(r,"error",e,t)};this._connectionTimeoutHandler=function(e){const t=this;connectionFailureHandler(r,"timeout",e,t)};this._connectionParseErrorHandler=function(e){const t=this;connectionFailureHandler(r,"parseError",e,t)}};n(Pool,o);Object.defineProperty(Pool.prototype,"size",{enumerable:true,get:function(){return this.options.size}});Object.defineProperty(Pool.prototype,"minSize",{enumerable:true,get:function(){return this.options.minSize}});Object.defineProperty(Pool.prototype,"connectionTimeout",{enumerable:true,get:function(){return this.options.connectionTimeout}});Object.defineProperty(Pool.prototype,"socketTimeout",{enumerable:true,get:function(){return this.options.socketTimeout}});Object.defineProperty(Pool.prototype,"state",{enumerable:true,get:function(){return this.s.state}});function resetPoolState(e){e.inUseConnections=[];e.availableConnections=[];e.connectingConnections=0;e.executing=false;e.numberOfConsecutiveTimeouts=0;e.connectionIndex=0;e.retriesLeft=e.options.reconnectTries;e.reconnectId=null}function connectionFailureHandler(e,t,r,n){if(n){if(n._connectionFailHandled){return}n._connectionFailHandled=true;n.destroy();removeConnection(e,n);n.flush(r)}if(t==="timeout"){e.numberOfConsecutiveTimeouts=e.numberOfConsecutiveTimeouts+1;if(e.numberOfConsecutiveTimeouts>e.options.reconnectTries){e.numberOfConsecutiveTimeouts=0;e.destroy(true);return e.emit("close",e)}}if(e.socketCount()===0){if(e.state!==N&&e.state!==R&&e.state!==A){if(e.options.reconnect){M(e,T)}}t=t==="error"?"close":t;e.emit(t,r)}if(!e.reconnectId&&e.options.reconnect){e.reconnectError=r;e.reconnectId=setTimeout(attemptReconnect(e),e.options.reconnectInterval)}const o=totalConnectionCount(e);if(o{if(r==null){e.reconnectId=null;e.retriesLeft=e.options.reconnectTries;e.emit("reconnect",e)}if(typeof t==="function"){t(r,n)}}))}}function moveConnectionBetween(e,t,r){var n=t.indexOf(e);if(n!==-1){t.splice(n,1);r.push(e)}}function messageHandler(e){return function(t,r){var n=null;for(var o=0;o{if(t){if(typeof e==="function"){this.destroy();e(t);return}if(this.state===I){this.emit("error",t)}this.destroy();return}M(this,k);if(this.minSize){for(let e=0;e{for(const t of D){e.removeAllListeners(t)}e.on("error",(()=>{}));e.destroy(r,t)}),(t=>{if(t){if(typeof n==="function")n(t,null);return}resetPoolState(e);e.queue=[];M(e,N);if(typeof n==="function")n(null,null)}))}Pool.prototype.destroy=function(e,t){var r=this;if(typeof e==="function"){t=e;e=false}if(this.state===N||r.state===R){if(typeof t==="function")t(null,null);return}M(this,A);if(e){var n=r.availableConnections.concat(r.inUseConnections);while(r.queue.length>0){var o=r.queue.shift();if(typeof o.cb==="function"){o.cb(new i("Pool was force destroyed"))}}return destroy(r,n,{force:true},t)}if(this.reconnectId){clearTimeout(this.reconnectId)}function checkStatus(){if(r.state===N||r.state===R){if(typeof t==="function"){t()}return}flushMonitoringOperations(r.queue);if(r.queue.length===0){var e=r.availableConnections.concat(r.inUseConnections);for(var n=0;n0){return setTimeout(checkStatus,1)}}destroy(r,e,{force:false},t)}else{_execute(r)();setTimeout(checkStatus,1)}}checkStatus()};Pool.prototype.reset=function(e){if(this.s.state!==k){if(typeof e==="function"){e(new i("pool is not connected, reset aborted"))}return}this.s.cancellationToken.emit("cancel");const t=this.availableConnections.concat(this.inUseConnections);_(t,((e,t)=>{for(const t of D){e.removeAllListeners(t)}e.destroy({force:true},t)}),(t=>{if(t){if(typeof e==="function"){e(t,null);return}}resetPoolState(this);createConnection(this,(()=>{if(typeof e==="function"){e(null,null)}}))}))};function serializeCommand(e,t,r){const n=t.toBin();const o=!!e.options.agreedCompressor;if(!o||!canCompress(t)){return r(null,n)}const i=S.concat(n);const s=i.slice(p);const a=i.readInt32LE(12);g(e,s,(function(n,o){if(n)return r(n,null);const i=S.alloc(p);i.writeInt32LE(p+h+o.length,0);i.writeInt32LE(t.requestId,4);i.writeInt32LE(0,8);i.writeInt32LE(m.OP_COMPRESSED,12);const c=S.alloc(h);c.writeInt32LE(a,0);c.writeInt32LE(s.length,4);c.writeUInt8(y[e.options.agreedCompressor],8);return r(null,[i,c,o])}))}Pool.prototype.write=function(e,t,r){var n=this;if(typeof t==="function"){r=t}t=t||{};if(!(typeof r==="function")&&!t.noResponse){throw new i("write method must provide a callback")}if(this.state===N||this.state===R){r(new i("pool destroyed"));return}if(this.state===A){r(new i("pool is draining, new operations prohibited"));return}if(this.options.domainsEnabled&&process.domain&&typeof r==="function"){var o=r;r=process.domain.bind((function(){var e=new Array(arguments.length);for(var t=0;t{if(t){n.emit("commandFailed",new b.CommandFailedEvent(this,e,t,s.started))}else{if(o&&o.result&&(o.result.ok===0||o.result.$err)){n.emit("commandFailed",new b.CommandFailedEvent(this,e,o.result,s.started))}else{n.emit("commandSucceeded",new b.CommandSucceededEvent(this,e,o,s.started))}}if(typeof r==="function")r(t,o)}}serializeCommand(n,e,((e,r)=>{if(e)throw e;s.buffer=r;if(t.monitoring){n.queue.unshift(s)}else{n.queue.push(s)}if(!n.executing){process.nextTick((function(){_execute(n)()}))}}))};function canCompress(e){const t=e instanceof u?e.command:e.query;const r=Object.keys(t)[0];return!v.has(r)}function remove(e,t){for(var r=0;r{e.connectingConnections--;if(r){if(e.logger.isDebug()){e.logger.debug(`connection attempt failed with error [${JSON.stringify(r)}]`)}if(!e.reconnectId&&e.options.reconnect){if(e.state===I&&e.options.legacyCompatMode){t(r);return}e.reconnectError=r;e.reconnectId=setTimeout(attemptReconnect(e,t),e.options.reconnectInterval);return}if(typeof t==="function"){t(r)}return}if(e.state===N||e.state===R){if(typeof t==="function"){t(new i("Pool was destroyed after connection creation"))}n.destroy();return}n.on("error",e._connectionErrorHandler);n.on("close",e._connectionCloseHandler);n.on("timeout",e._connectionTimeoutHandler);n.on("parseError",e._connectionParseErrorHandler);n.on("message",e._messageHandler);e.availableConnections.push(n);if(typeof t==="function"){t(null,n)}_execute(e)()}))}function flushMonitoringOperations(e){for(var t=0;t0){e.executing=false;return}while(true){const s=totalConnectionCount(e);if(e.availableConnections.length===0){flushMonitoringOperations(e.queue);if(s0){createConnection(e)}break}if(e.queue.length===0){break}var t=null;const a=e.availableConnections.filter((e=>e.workItems.length===0));if(a.length===0){t=e.availableConnections[e.connectionIndex++%e.availableConnections.length]}else{t=a[e.connectionIndex++%a.length]}if(!t.isConnected()){removeConnection(e,t);flushMonitoringOperations(e.queue);break}var r=e.queue.shift();if(r.monitoring){var n=false;for(let r=0;r0){createConnection(e)}setTimeout((()=>_execute(e)()),10);break}}if(s0){e.queue.unshift(r);createConnection(e);break}}var o=r.buffer;if(r.monitoring){moveConnectionBetween(t,e.availableConnections,e.inUseConnections)}if(!r.noResponse){t.workItems.push(r)}if(!r.immediateRelease&&typeof r.socketTimeout==="number"){t.setSocketTimeout(r.socketTimeout)}var i=true;if(Array.isArray(o)){for(let e=0;e{"use strict";const n=r(3182)(require);function debugOptions(e,t){const r={};e.forEach((function(e){r[e]=t[e]}));return r}function retrieveBSON(){const e=r(4044);e.native=false;const t=n("bson-ext");if(t){t.native=true;return t}return e}function noSnappyWarning(){throw new Error("Attempted to use Snappy compression, but Snappy is not installed. Install or disable Snappy compression and try again.")}function retrieveSnappy(){let e=n("snappy");if(!e){e={compress:noSnappyWarning,uncompress:noSnappyWarning,compressSync:noSnappyWarning,uncompressSync:noSnappyWarning}}return e}e.exports={debugOptions:debugOptions,retrieveBSON:retrieveBSON,retrieveSnappy:retrieveSnappy}},4847:(e,t,r)=>{"use strict";const n=r(104);const o=r(7746).retrieveBSON;const i=r(3111).MongoError;const s=r(3111).MongoNetworkError;const a=r(1178).collationNotSupported;const c=r(4485);const l=r(1178).isUnifiedTopology;const u=r(2548);const d=r(2413).Readable;const p=r(1371).SUPPORTS;const h=r(1371).MongoDBNamespace;const m=r(1371).mergeOptions;const g=r(1018).OperationBase;const y=o();const v=y.Long;const b={INIT:0,OPEN:1,CLOSED:2,GET_MORE:3};function handleCallback(e,t,r){try{e(t,r)}catch(t){process.nextTick((function(){throw t}))}}class CoreCursor extends d{constructor(e,t,r,o){super({objectMode:true});o=o||{};if(t instanceof g){this.operation=t;t=this.operation.ns.toString();o=this.operation.options;r=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=h.fromString(t);this.cmd=r;this.options=o;this.topology=e;this.cursorState={cursorId:null,cmd:r,documents:o.documents||[],cursorIndex:0,dead:false,killed:false,init:false,notified:false,limit:o.limit||r.limit||0,skip:o.skip||r.skip||0,batchSize:o.batchSize||r.batchSize||1e3,currentLimit:0,transforms:o.transforms,raw:o.raw||r&&r.raw};if(typeof o.session==="object"){this.cursorState.session=o.session}const i=e.s.options;if(typeof i.promoteLongs==="boolean"){this.cursorState.promoteLongs=i.promoteLongs}else if(typeof o.promoteLongs==="boolean"){this.cursorState.promoteLongs=o.promoteLongs}if(typeof i.promoteValues==="boolean"){this.cursorState.promoteValues=i.promoteValues}else if(typeof o.promoteValues==="boolean"){this.cursorState.promoteValues=o.promoteValues}if(typeof i.promoteBuffers==="boolean"){this.cursorState.promoteBuffers=i.promoteBuffers}else if(typeof o.promoteBuffers==="boolean"){this.cursorState.promoteBuffers=o.promoteBuffers}if(i.reconnect){this.cursorState.reconnect=i.reconnect}this.logger=n("Cursor",i);if(typeof r==="number"){this.cursorState.cursorId=v.fromNumber(r);this.cursorState.lastCursorId=this.cursorState.cursorId}else if(r instanceof v){this.cursorState.cursorId=r;this.cursorState.lastCursorId=r}if(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){nextFunction(this,e)}clone(){const e=m({},this.options);delete e.session;return this.topology.cursor(this.ns,this.cmd,e)}isDead(){return this.cursorState.dead===true}isKilled(){return this.cursorState.killed===true}isNotified(){return this.cursorState.notified===true}bufferedCount(){return this.cursorState.documents.length-this.cursorState.cursorIndex}readBufferedDocuments(e){const t=this.cursorState.documents.length-this.cursorState.cursorIndex;const r=e0&&this.cursorState.currentLimit+n.length>this.cursorState.limit){n=n.slice(0,this.cursorState.limit-this.cursorState.currentLimit);this.kill()}this.cursorState.currentLimit=this.cursorState.currentLimit+n.length;this.cursorState.cursorIndex=this.cursorState.cursorIndex+n.length;return n}kill(e){this.cursorState.dead=true;this.cursorState.killed=true;this.cursorState.documents=[];if(this.cursorState.cursorId==null||this.cursorState.cursorId.isZero()||this.cursorState.init===false){if(e)e(null,null);return}this.server.killCursors(this.ns,this.cursorState,e)}rewind(){if(this.cursorState.init){if(!this.cursorState.dead){this.kill()}this.cursorState.currentLimit=0;this.cursorState.init=false;this.cursorState.dead=false;this.cursorState.killed=false;this.cursorState.notified=false;this.cursorState.documents=[];this.cursorState.cursorId=null;this.cursorState.cursorIndex=0}}_read(){if(this.s&&this.s.state===b.CLOSED||this.isDead()){return this.push(null)}this._next(((e,t)=>{if(e){if(this.listeners("error")&&this.listeners("error").length>0){this.emit("error",e)}if(!this.isDead())this.close();this.emit("end");return this.emit("finish")}if(this.cursorState.streamOptions&&typeof this.cursorState.streamOptions.transform==="function"&&t!=null){return this.push(this.cursorState.streamOptions.transform(t))}this.push(t);if(t===null&&this.isDead()){this.once("end",(()=>{this.close();this.emit("finish")}))}}))}_endSession(e,t){if(typeof e==="function"){t=e;e={}}e=e||{};const r=this.cursorState.session;if(r&&(e.force||r.owner===this)){this.cursorState.session=undefined;if(this.operation){this.operation.clearSession()}r.endSession(t);return true}if(t){t()}return false}_getMore(e){if(this.logger.isDebug()){this.logger.debug(`schedule getMore call for query [${JSON.stringify(this.query)}]`)}let t=this.cursorState.batchSize;if(this.cursorState.limit>0&&this.cursorState.currentLimit+t>this.cursorState.limit){t=this.cursorState.limit-this.cursorState.currentLimit}const r=this.cursorState;this.server.getMore(this.ns,r,t,this.options,((t,n,o)=>{if(t||r.cursorId&&r.cursorId.isZero()){this._endSession()}e(t,n,o)}))}_initializeCursor(e){const t=this;if(l(t.topology)&&t.topology.shouldCheckForSessionSupport()){t.topology.selectServer(c.primaryPreferred,(t=>{if(t){e(t);return}this._initializeCursor(e)}));return}function done(r,n){const o=t.cursorState;if(r||o.cursorId&&o.cursorId.isZero()){t._endSession()}if(o.documents.length===0&&o.cursorId&&o.cursorId.isZero()&&!t.cmd.tailable&&!t.cmd.awaitData){return setCursorNotified(t,e)}e(r,n)}const queryCallback=(e,r)=>{if(e){return done(e)}const n=r.message;if(Array.isArray(n.documents)&&n.documents.length===1){const e=n.documents[0];if(n.queryFailure){return done(new i(e),null)}if(!t.cmd.find||t.cmd.find&&t.cmd.virtual===false){if(e.$err||e.errmsg){return done(new i(e),null)}if(e.cursor!=null&&typeof e.cursor!=="string"){const r=e.cursor.id;if(e.cursor.ns){t.ns=e.cursor.ns}t.cursorState.cursorId=typeof r==="number"?v.fromNumber(r):r;t.cursorState.lastCursorId=t.cursorState.cursorId;t.cursorState.operationTime=e.operationTime;if(Array.isArray(e.cursor.firstBatch)){t.cursorState.documents=e.cursor.firstBatch}return done(null,n)}}}const o=n.cursorId||0;t.cursorState.cursorId=o instanceof v?o:v.fromNumber(o);t.cursorState.documents=n.documents;t.cursorState.lastCursorId=n.cursorId;if(t.cursorState.transforms&&typeof t.cursorState.transforms.query==="function"){t.cursorState.documents=t.cursorState.transforms.query(n)}done(null,n)};if(t.operation){if(t.logger.isDebug()){t.logger.debug(`issue initial query [${JSON.stringify(t.cmd)}] with flags [${JSON.stringify(t.query)}]`)}u(t.topology,t.operation,((e,r)=>{if(e){done(e);return}t.server=t.operation.server;t.cursorState.init=true;if(t.cursorState.cursorId!=null){return done()}queryCallback(e,r)}));return}const r={};if(t.cursorState.session){r.session=t.cursorState.session}if(t.operation){r.readPreference=t.operation.readPreference}else if(t.options.readPreference){r.readPreference=t.options.readPreference}return t.topology.selectServer(r,((r,n)=>{if(r){const n=t.disconnectHandler;if(n!=null){return n.addObjectAndMethod("cursor",t,"next",[e],e)}return e(r)}t.server=n;t.cursorState.init=true;if(a(t.server,t.cmd)){return e(new i(`server ${t.server.name} does not support collation`))}if(t.cursorState.cursorId!=null){return done()}if(t.logger.isDebug()){t.logger.debug(`issue initial query [${JSON.stringify(t.cmd)}] with flags [${JSON.stringify(t.query)}]`)}if(t.cmd.find!=null){n.query(t.ns,t.cmd,t.cursorState,t.options,queryCallback);return}const o=Object.assign({session:t.cursorState.session},t.options);n.command(t.ns,t.cmd,o,queryCallback)}))}}if(p.ASYNC_ITERATOR){CoreCursor.prototype[Symbol.asyncIterator]=r(1749).asyncIterator}function isConnectionDead(e,t){if(e.pool&&e.pool.isDestroyed()){e.cursorState.killed=true;const r=new s(`connection to host ${e.pool.host}:${e.pool.port} was destroyed`);_setCursorNotifiedImpl(e,(()=>t(r)));return true}return false}function isCursorDeadButNotkilled(e,t){if(e.cursorState.dead&&!e.cursorState.killed){e.cursorState.killed=true;setCursorNotified(e,t);return true}return false}function isCursorDeadAndKilled(e,t){if(e.cursorState.dead&&e.cursorState.killed){handleCallback(t,new i("cursor is dead"));return true}return false}function isCursorKilled(e,t){if(e.cursorState.killed){setCursorNotified(e,t);return true}return false}function setCursorDeadAndNotified(e,t){e.cursorState.dead=true;setCursorNotified(e,t)}function setCursorNotified(e,t){_setCursorNotifiedImpl(e,(()=>handleCallback(t,null,null)))}function _setCursorNotifiedImpl(e,t){e.cursorState.notified=true;e.cursorState.documents=[];e.cursorState.cursorIndex=0;if(e.cursorState.session){e._endSession(t);return}return t()}function nextFunction(e,t){if(e.cursorState.notified){return t(new Error("cursor is exhausted"))}if(isCursorKilled(e,t))return;if(isCursorDeadButNotkilled(e,t))return;if(isCursorDeadAndKilled(e,t))return;if(!e.cursorState.init){if(!e.topology.isConnected(e.options)){if(e.topology._type==="server"&&!e.topology.s.options.reconnect){return t(new i("no connection available"))}if(e.disconnectHandler!=null){if(e.topology.isDestroyed()){return t(new i("Topology was destroyed"))}e.disconnectHandler.addObjectAndMethod("cursor",e,"next",[t],t);return}}e._initializeCursor(((r,n)=>{if(r||n===null){t(r,n);return}nextFunction(e,t)}));return}if(e.cursorState.limit>0&&e.cursorState.currentLimit>=e.cursorState.limit){e.kill((()=>setCursorDeadAndNotified(e,t)))}else if(e.cursorState.cursorIndex===e.cursorState.documents.length&&!v.ZERO.equals(e.cursorState.cursorId)){e.cursorState.documents=[];e.cursorState.cursorIndex=0;if(e.topology.isDestroyed())return t(new s("connection destroyed, not possible to instantiate cursor"));if(isConnectionDead(e,t))return;e._getMore((function(r,n,o){if(r){return handleCallback(t,r)}e.connection=o;if(e.cursorState.documents.length===0&&e.cmd.tailable&&v.ZERO.equals(e.cursorState.cursorId)){return handleCallback(t,new i({message:"No more documents in tailed cursor",tailable:e.cmd.tailable,awaitData:e.cmd.awaitData}))}else if(e.cursorState.documents.length===0&&e.cmd.tailable&&!v.ZERO.equals(e.cursorState.cursorId)){return nextFunction(e,t)}if(e.cursorState.limit>0&&e.cursorState.currentLimit>=e.cursorState.limit){return setCursorDeadAndNotified(e,t)}nextFunction(e,t)}))}else if(e.cursorState.documents.length===e.cursorState.cursorIndex&&e.cmd.tailable&&v.ZERO.equals(e.cursorState.cursorId)){return handleCallback(t,new i({message:"No more documents in tailed cursor",tailable:e.cmd.tailable,awaitData:e.cmd.awaitData}))}else if(e.cursorState.documents.length===e.cursorState.cursorIndex&&v.ZERO.equals(e.cursorState.cursorId)){setCursorDeadAndNotified(e,t)}else{if(e.cursorState.limit>0&&e.cursorState.currentLimit>=e.cursorState.limit){e.kill((()=>setCursorDeadAndNotified(e,t)));return}e.cursorState.currentLimit+=1;let r=e.cursorState.documents[e.cursorState.cursorIndex++];if(!r||r.$err){e.kill((()=>setCursorDeadAndNotified(e,(function(){handleCallback(t,new i(r?r.$err:undefined))}))));return}if(e.cursorState.transforms&&typeof e.cursorState.transforms.doc==="function"){r=e.cursorState.transforms.doc(r)}handleCallback(t,null,r)}}e.exports={CursorState:b,CoreCursor:CoreCursor}},3111:e=>{"use strict";const t=Symbol("errorLabels");class MongoError extends Error{constructor(e){if(e instanceof Error){super(e.message);this.stack=e.stack}else{if(typeof e==="string"){super(e)}else{super(e.message||e.errmsg||e.$err||"n/a");if(e.errorLabels){this[t]=new Set(e.errorLabels)}for(var r in e){if(r==="errorLabels"||r==="errmsg"){continue}this[r]=e[r]}}Error.captureStackTrace(this,this.constructor)}this.name="MongoError"}get errmsg(){return this.message}static create(e){return new MongoError(e)}hasErrorLabel(e){if(this[t]==null){return false}return this[t].has(e)}addErrorLabel(e){if(this[t]==null){this[t]=new Set}this[t].add(e)}get errorLabels(){return this[t]?Array.from(this[t]):[]}}const r=Symbol("beforeHandshake");function isNetworkErrorBeforeHandshake(e){return e[r]===true}class MongoNetworkError extends MongoError{constructor(e,t){super(e);this.name="MongoNetworkError";if(t&&typeof t.beforeHandshake==="boolean"){this[r]=t.beforeHandshake}}}class MongoNetworkTimeoutError extends MongoNetworkError{constructor(e,t){super(e,t);this.name="MongoNetworkTimeoutError"}}class MongoParseError extends MongoError{constructor(e){super(e);this.name="MongoParseError"}}class MongoTimeoutError extends MongoError{constructor(e,t){if(t&&t.error){super(t.error.message||t.error)}else{super(e)}this.name="MongoTimeoutError";if(t){this.reason=t}}}class MongoServerSelectionError extends MongoTimeoutError{constructor(e,t){super(e,t);this.name="MongoServerSelectionError"}}function makeWriteConcernResultObject(e){const t=Object.assign({},e);if(t.ok===0){t.ok=1;delete t.errmsg;delete t.code;delete t.codeName}return t}class MongoWriteConcernError extends MongoError{constructor(e,r){super(e);this.name="MongoWriteConcernError";if(r&&Array.isArray(r.errorLabels)){this[t]=new Set(r.errorLabels)}if(r!=null){this.result=makeWriteConcernResultObject(r)}}}const n=new Set([6,7,89,91,189,9001,10107,11600,11602,13435,13436]);const o=new Set([11600,11602,10107,13435,13436,189,91,7,6,89,9001,262]);function isRetryableWriteError(e){if(e instanceof MongoWriteConcernError){return o.has(e.code)||o.has(e.result.code)}return o.has(e.code)}function isRetryableError(e){return n.has(e.code)||e instanceof MongoNetworkError||e.message.match(/not master/)||e.message.match(/node is recovering/)}const i=new Set([91,189,11600,11602,13436]);const s=new Set([10107,13435]);const a=new Set([11600,91]);function isRecoveringError(e){if(e.code&&i.has(e.code)){return true}return e.message.match(/not master or secondary/)||e.message.match(/node is recovering/)}function isNotMasterError(e){if(e.code&&s.has(e.code)){return true}if(isRecoveringError(e)){return false}return e.message.match(/not master/)}function isNodeShuttingDownError(e){return e.code&&a.has(e.code)}function isSDAMUnrecoverableError(e){if(e instanceof MongoParseError||e==null){return true}if(isRecoveringError(e)||isNotMasterError(e)){return true}return false}e.exports={MongoError:MongoError,MongoNetworkError:MongoNetworkError,MongoNetworkTimeoutError:MongoNetworkTimeoutError,MongoParseError:MongoParseError,MongoTimeoutError:MongoTimeoutError,MongoServerSelectionError:MongoServerSelectionError,MongoWriteConcernError:MongoWriteConcernError,isRetryableError:isRetryableError,isSDAMUnrecoverableError:isSDAMUnrecoverableError,isNodeShuttingDownError:isNodeShuttingDownError,isRetryableWriteError:isRetryableWriteError,isNetworkErrorBeforeHandshake:isNetworkErrorBeforeHandshake}},3994:(e,t,r)=>{"use strict";let n=r(4044);const o=r(3182)(require);const i=r(1178).retrieveEJSON();try{const e=o("bson-ext");if(e){n=e}}catch(e){}e.exports={MongoError:r(3111).MongoError,MongoNetworkError:r(3111).MongoNetworkError,MongoParseError:r(3111).MongoParseError,MongoTimeoutError:r(3111).MongoTimeoutError,MongoServerSelectionError:r(3111).MongoServerSelectionError,MongoWriteConcernError:r(3111).MongoWriteConcernError,Connection:r(6096),Server:r(6495),ReplSet:r(1134),Mongos:r(8175),Logger:r(104),Cursor:r(4847).CoreCursor,ReadPreference:r(4485),Sessions:r(5474),BSON:n,EJSON:i,Topology:r(4149).Topology,Query:r(9814).Query,MongoCredentials:r(2222).MongoCredentials,defaultAuthProviders:r(2192).defaultAuthProviders,MongoCR:r(4228),X509:r(7324),Plain:r(8728),GSSAPI:r(2640),ScramSHA1:r(864).ScramSHA1,ScramSHA256:r(864).ScramSHA256,parseConnectionString:r(8767)}},2291:e=>{"use strict";const t="closing";const r="closed";const n="connecting";const o="connected";const i={Single:"Single",ReplicaSetNoPrimary:"ReplicaSetNoPrimary",ReplicaSetWithPrimary:"ReplicaSetWithPrimary",Sharded:"Sharded",Unknown:"Unknown"};const s={Standalone:"Standalone",Mongos:"Mongos",PossiblePrimary:"PossiblePrimary",RSPrimary:"RSPrimary",RSSecondary:"RSSecondary",RSArbiter:"RSArbiter",RSOther:"RSOther",RSGhost:"RSGhost",Unknown:"Unknown"};function serverType(e){let t=e.s.description||e.s.serverDescription;if(t.topologyType===i.Single)return t.servers[0].type;return t.type}const a={useUnifiedTopology:true,localThresholdMS:15,serverSelectionTimeoutMS:3e4,heartbeatFrequencyMS:1e4,minHeartbeatFrequencyMS:500};function drainTimerQueue(e){e.forEach(clearTimeout);e.clear()}function clearAndRemoveTimerFrom(e,t){clearTimeout(e);return t.delete(e)}e.exports={STATE_CLOSING:t,STATE_CLOSED:r,STATE_CONNECTING:n,STATE_CONNECTED:o,TOPOLOGY_DEFAULTS:a,TopologyType:i,ServerType:s,serverType:serverType,drainTimerQueue:drainTimerQueue,clearAndRemoveTimerFrom:clearAndRemoveTimerFrom}},2785:e=>{"use strict";class ServerDescriptionChangedEvent{constructor(e,t,r,n){Object.assign(this,{topologyId:e,address:t,previousDescription:r,newDescription:n})}}class ServerOpeningEvent{constructor(e,t){Object.assign(this,{topologyId:e,address:t})}}class ServerClosedEvent{constructor(e,t){Object.assign(this,{topologyId:e,address:t})}}class TopologyDescriptionChangedEvent{constructor(e,t,r){Object.assign(this,{topologyId:e,previousDescription:t,newDescription:r})}}class TopologyOpeningEvent{constructor(e){Object.assign(this,{topologyId:e})}}class TopologyClosedEvent{constructor(e){Object.assign(this,{topologyId:e})}}class ServerHeartbeatStartedEvent{constructor(e){Object.assign(this,{connectionId:e})}}class ServerHeartbeatSucceededEvent{constructor(e,t,r){Object.assign(this,{connectionId:r,duration:e,reply:t})}}class ServerHeartbeatFailedEvent{constructor(e,t,r){Object.assign(this,{connectionId:r,duration:e,failure:t})}}e.exports={ServerDescriptionChangedEvent:ServerDescriptionChangedEvent,ServerOpeningEvent:ServerOpeningEvent,ServerClosedEvent:ServerClosedEvent,TopologyDescriptionChangedEvent:TopologyDescriptionChangedEvent,TopologyOpeningEvent:TopologyOpeningEvent,TopologyClosedEvent:TopologyClosedEvent,ServerHeartbeatStartedEvent:ServerHeartbeatStartedEvent,ServerHeartbeatSucceededEvent:ServerHeartbeatSucceededEvent,ServerHeartbeatFailedEvent:ServerHeartbeatFailedEvent}},1203:(e,t,r)=>{"use strict";const n=r(2291).ServerType;const o=r(8614);const i=r(6573);const s=r(9820).Connection;const a=r(2291);const c=r(1178).makeStateMachine;const l=r(3111).MongoNetworkError;const u=r(7746).retrieveBSON();const d=r(1371).makeInterruptableAsyncInterval;const p=r(1371).calculateDurationInMs;const h=r(1371).now;const m=r(2785);const g=m.ServerHeartbeatStartedEvent;const y=m.ServerHeartbeatSucceededEvent;const v=m.ServerHeartbeatFailedEvent;const b=Symbol("server");const S=Symbol("monitorId");const w=Symbol("connection");const E=Symbol("cancellationToken");const _=Symbol("rttPinger");const O=Symbol("roundTripTime");const C=a.STATE_CLOSED;const T=a.STATE_CLOSING;const I="idle";const k="monitoring";const A=c({[T]:[T,I,C],[C]:[C,k],[I]:[I,k,T],[k]:[k,I,T]});const R=new Set([T,C,k]);function isInCloseState(e){return e.s.state===C||e.s.state===T}class Monitor extends o{constructor(e,t){super(t);this[b]=e;this[w]=undefined;this[E]=new o;this[E].setMaxListeners(Infinity);this[S]=null;this.s={state:C};this.address=e.description.address;this.options=Object.freeze({connectTimeoutMS:typeof t.connectionTimeout==="number"?t.connectionTimeout:typeof t.connectTimeoutMS==="number"?t.connectTimeoutMS:1e4,heartbeatFrequencyMS:typeof t.heartbeatFrequencyMS==="number"?t.heartbeatFrequencyMS:1e4,minHeartbeatFrequencyMS:typeof t.minHeartbeatFrequencyMS==="number"?t.minHeartbeatFrequencyMS:500});const r=Object.assign({id:"",host:e.description.host,port:e.description.port,bson:e.s.bson,connectionType:s},e.s.options,this.options,{raw:false,promoteLongs:true,promoteValues:true,promoteBuffers:true});delete r.credentials;delete r.autoEncrypter;this.connectOptions=Object.freeze(r)}connect(){if(this.s.state!==C){return}const e=this.options.heartbeatFrequencyMS;const t=this.options.minHeartbeatFrequencyMS;this[S]=d(monitorServer(this),{interval:e,minInterval:t,immediate:true})}requestCheck(){if(R.has(this.s.state)){return}this[S].wake()}reset(){const e=this[b].description.topologyVersion;if(isInCloseState(this)||e==null){return}A(this,T);resetMonitorState(this);A(this,I);const t=this.options.heartbeatFrequencyMS;const r=this.options.minHeartbeatFrequencyMS;this[S]=d(monitorServer(this),{interval:t,minInterval:r})}close(){if(isInCloseState(this)){return}A(this,T);resetMonitorState(this);this.emit("close");A(this,C)}}function resetMonitorState(e){if(e[S]){e[S].stop();e[S]=null}if(e[_]){e[_].close();e[_]=undefined}e[E].emit("cancel");if(e[S]){clearTimeout(e[S]);e[S]=undefined}if(e[w]){e[w].destroy({force:true})}}function checkServer(e,t){let r=h();e.emit("serverHeartbeatStarted",new g(e.address));function failureHandler(n){if(e[w]){e[w].destroy({force:true});e[w]=undefined}e.emit("serverHeartbeatFailed",new v(p(r),n,e.address));e.emit("resetServer",n);e.emit("resetConnectionPool");t(n)}if(e[w]!=null&&!e[w].closed){const n=e.options.connectTimeoutMS;const o=e.options.heartbeatFrequencyMS;const i=e[b].description.topologyVersion;const s=i!=null;const a={ismaster:true};const c={socketTimeout:n};if(s){a.maxAwaitTimeMS=o;a.topologyVersion=makeTopologyVersion(i);if(n){c.socketTimeout=n+o}c.exhaustAllowed=true;if(e[_]==null){e[_]=new RTTPinger(e[E],e.connectOptions)}}e[w].command("admin.$cmd",a,c,((n,o)=>{if(n){failureHandler(n);return}const i=o.result;const a=e[_];const c=s&&a?a.roundTripTime:p(r);e.emit("serverHeartbeatSucceeded",new y(c,i,e.address));if(s&&i.topologyVersion){e.emit("serverHeartbeatStarted",new g(e.address));r=h()}else{if(e[_]){e[_].close();e[_]=undefined}t(undefined,i)}}));return}i(e.connectOptions,e[E],((n,o)=>{if(o&&isInCloseState(e)){o.destroy({force:true});return}if(n){e[w]=undefined;if(!(n instanceof l)){e.emit("resetConnectionPool")}failureHandler(n);return}e[w]=o;e.emit("serverHeartbeatSucceeded",new y(p(r),o.ismaster,e.address));t(undefined,o.ismaster)}))}function monitorServer(e){return t=>{A(e,k);function done(){if(!isInCloseState(e)){A(e,I)}t()}process.nextTick((()=>e.emit("monitoring",e[b])));checkServer(e,((t,r)=>{if(t){if(e[b].description.type===n.Unknown){e.emit("resetServer",t);return done()}}if(r&&r.topologyVersion){setTimeout((()=>{if(!isInCloseState(e)){e[S].wake()}}))}done()}))}}function makeTopologyVersion(e){return{processId:e.processId,counter:u.Long.fromNumber(e.counter)}}class RTTPinger{constructor(e,t){this[w]=null;this[E]=e;this[O]=0;this.closed=false;const r=t.heartbeatFrequencyMS;this[S]=setTimeout((()=>measureRoundTripTime(this,t)),r)}get roundTripTime(){return this[O]}close(){this.closed=true;clearTimeout(this[S]);this[S]=undefined;if(this[w]){this[w].destroy({force:true})}}}function measureRoundTripTime(e,t){const r=h();const n=e[E];const o=t.heartbeatFrequencyMS;if(e.closed){return}function measureAndReschedule(n){if(e.closed){n.destroy({force:true});return}if(e[w]==null){e[w]=n}e[O]=p(r);e[S]=setTimeout((()=>measureRoundTripTime(e,t)),o)}if(e[w]==null){i(t,n,((t,r)=>{if(t){e[w]=undefined;e[O]=0;return}measureAndReschedule(r)}));return}e[w].command("admin.$cmd",{ismaster:1},(t=>{if(t){e[w]=undefined;e[O]=0;return}measureAndReschedule()}))}e.exports={Monitor:Monitor}},7062:(e,t,r)=>{"use strict";const n=r(8614);const o=r(2529).ConnectionPool;const i=r(897).CMAP_EVENT_NAMES;const s=r(3111).MongoError;const a=r(1178).relayEvents;const c=r(7746).retrieveBSON();const l=r(104);const u=r(750).ServerDescription;const d=r(750).compareTopologyVersion;const p=r(4485);const h=r(1203).Monitor;const m=r(3111).MongoNetworkError;const g=r(3111).MongoNetworkTimeoutError;const y=r(1178).collationNotSupported;const v=r(7746).debugOptions;const b=r(3111).isSDAMUnrecoverableError;const S=r(3111).isRetryableWriteError;const w=r(3111).isNodeShuttingDownError;const E=r(3111).isNetworkErrorBeforeHandshake;const _=r(1178).maxWireVersion;const O=r(1178).makeStateMachine;const C=r(2291);const T=C.ServerType;const I=r(1707).isTransactionCommand;const k=["reconnect","reconnectTries","reconnectInterval","emitError","cursorFactory","host","port","size","keepAlive","keepAliveInitialDelay","noDelay","connectionTimeout","checkServerIdentity","socketTimeout","ssl","ca","crl","cert","key","rejectUnauthorized","promoteLongs","promoteValues","promoteBuffers","servername"];const A=C.STATE_CLOSING;const R=C.STATE_CLOSED;const N=C.STATE_CONNECTING;const M=C.STATE_CONNECTED;const D=O({[R]:[R,N],[N]:[N,A,M,R],[M]:[M,A,R],[A]:[A,R]});const P=Symbol("monitor");class Server extends n{constructor(e,t,r){super();this.s={description:e,options:t,logger:l("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:R,credentials:t.credentials,topology:r};const n=Object.assign({host:this.description.host,port:this.description.port,bson:this.s.bson},t);this.s.pool=new o(n);a(this.s.pool,this,["commandStarted","commandSucceeded","commandFailed"].concat(i));this.s.pool.on("clusterTimeReceived",(e=>{this.clusterTime=e}));this[P]=new h(this,this.s.options);a(this[P],this,["serverHeartbeatStarted","serverHeartbeatSucceeded","serverHeartbeatFailed","monitoring"]);this[P].on("resetConnectionPool",(()=>{this.s.pool.clear()}));this[P].on("resetServer",(e=>markServerUnknown(this,e)));this[P].on("serverHeartbeatSucceeded",(e=>{this.emit("descriptionReceived",new u(this.description.address,e.reply,{roundTripTime:calculateRoundTripTime(this.description.roundTripTime,e.duration)}));if(this.s.state===N){D(this,M);this.emit("connect",this)}}))}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}return null}connect(){if(this.s.state!==R){return}D(this,N);this[P].connect()}destroy(e,t){if(typeof e==="function")t=e,e={};e=Object.assign({},{force:false},e);if(this.s.state===R){if(typeof t==="function"){t()}return}D(this,A);this[P].close();this.s.pool.close(e,(e=>{D(this,R);this.emit("closed");if(typeof t==="function"){t(e)}}))}requestCheck(){this[P].requestCheck()}command(e,t,r,n){if(typeof r==="function"){n=r,r={},r=r||{}}if(this.s.state===A||this.s.state===R){n(new s("server is closed"));return}const o=basicReadValidations(this,r);if(o){return n(o)}r=Object.assign({},r,{wireProtocolCommand:false});if(this.s.logger.isDebug()){this.s.logger.debug(`executing command [${JSON.stringify({ns:e,cmd:t,options:v(k,r)})}] against ${this.name}`)}if(y(this,t)){n(new s(`server ${this.name} does not support collation`));return}this.s.pool.withConnection(((n,o,i)=>{if(n){markServerUnknown(this,n);return i(n)}o.command(e,t,r,makeOperationHandler(this,o,t,r,i))}),n)}query(e,t,r,n,o){if(this.s.state===A||this.s.state===R){o(new s("server is closed"));return}this.s.pool.withConnection(((o,i,s)=>{if(o){markServerUnknown(this,o);return s(o)}i.query(e,t,r,n,makeOperationHandler(this,i,t,n,s))}),o)}getMore(e,t,r,n,o){if(this.s.state===A||this.s.state===R){o(new s("server is closed"));return}this.s.pool.withConnection(((o,i,s)=>{if(o){markServerUnknown(this,o);return s(o)}i.getMore(e,t,r,n,makeOperationHandler(this,i,null,n,s))}),o)}killCursors(e,t,r){if(this.s.state===A||this.s.state===R){if(typeof r==="function"){r(new s("server is closed"))}return}this.s.pool.withConnection(((r,n,o)=>{if(r){markServerUnknown(this,r);return o(r)}n.killCursors(e,t,makeOperationHandler(this,n,null,undefined,o))}),r)}insert(e,t,r,n){executeWriteOperation({server:this,op:"insert",ns:e,ops:t},r,n)}update(e,t,r,n){executeWriteOperation({server:this,op:"update",ns:e,ops:t},r,n)}remove(e,t,r,n){executeWriteOperation({server:this,op:"remove",ns:e,ops:t},r,n)}}Object.defineProperty(Server.prototype,"clusterTime",{get:function(){return this.s.topology.clusterTime},set:function(e){this.s.topology.clusterTime=e}});function supportsRetryableWrites(e){return e.description.maxWireVersion>=6&&e.description.logicalSessionTimeoutMinutes&&e.description.type!==T.Standalone}function calculateRoundTripTime(e,t){if(e===-1){return t}const r=.2;return r*t+(1-r)*e}function basicReadValidations(e,t){if(t.readPreference&&!(t.readPreference instanceof p)){return new s("readPreference must be an instance of ReadPreference")}}function executeWriteOperation(e,t,r){if(typeof t==="function")r=t,t={};t=t||{};const n=e.server;const o=e.op;const i=e.ns;const a=Array.isArray(e.ops)?e.ops:[e.ops];if(n.s.state===A||n.s.state===R){r(new s("server is closed"));return}if(y(n,t)){r(new s(`server ${n.name} does not support collation`));return}const c=t.writeConcern&&t.writeConcern.w===0;if(c||_(n)<5){if((o==="update"||o==="remove")&&a.find((e=>e.hint))){r(new s(`servers < 3.4 do not support hint on ${o}`));return}}n.s.pool.withConnection(((e,r,s)=>{if(e){markServerUnknown(n,e);return s(e)}r[o](i,a,t,makeOperationHandler(n,r,a,t,s))}),r)}function markServerUnknown(e,t){if(t instanceof m&&!(t instanceof g)){e[P].reset()}e.emit("descriptionReceived",new u(e.description.address,null,{error:t,topologyVersion:t&&t.topologyVersion?t.topologyVersion:e.description.topologyVersion}))}function connectionIsStale(e,t){return t.generation!==e.generation}function shouldHandleStateChangeError(e,t){const r=t.topologyVersion;const n=e.description.topologyVersion;return d(n,r)<0}function inActiveTransaction(e,t){return e&&e.inTransaction()&&!I(t)}function makeOperationHandler(e,t,r,n,o){const i=n&&n.session;return function handleOperationResult(n,s){if(n&&!connectionIsStale(e.s.pool,t)){if(n instanceof m){if(i&&!i.hasEnded){i.serverSession.isDirty=true}if(supportsRetryableWrites(e)&&!inActiveTransaction(i,r)){n.addErrorLabel("RetryableWriteError")}if(!(n instanceof g)||E(n)){markServerUnknown(e,n);e.s.pool.clear()}}else{if(_(e)<9&&S(n)&&!inActiveTransaction(i,r)){n.addErrorLabel("RetryableWriteError")}if(b(n)){if(shouldHandleStateChangeError(e,n)){if(_(e)<=7||w(n)){e.s.pool.clear()}markServerUnknown(e,n);process.nextTick((()=>e.requestCheck()))}}}}o(n,s)}}e.exports={Server:Server}},750:(e,t,r)=>{"use strict";const n=r(1178).arrayStrictEqual;const o=r(1178).tagsStrictEqual;const i=r(1178).errorStrictEqual;const s=r(2291).ServerType;const a=r(1371).now;const c=new Set([s.RSPrimary,s.Standalone,s.Mongos]);const l=new Set([s.RSPrimary,s.RSSecondary,s.Mongos,s.Standalone]);const u=["minWireVersion","maxWireVersion","maxBsonObjectSize","maxMessageSizeBytes","maxWriteBatchSize","compression","me","hosts","passives","arbiters","tags","setName","setVersion","electionId","primary","logicalSessionTimeoutMinutes","saslSupportedMechs","__nodejs_mock_server__","$clusterTime"];class ServerDescription{constructor(e,t,r){r=r||{};t=Object.assign({minWireVersion:0,maxWireVersion:0,hosts:[],passives:[],arbiters:[],tags:[]},t);this.address=e;this.error=r.error;this.roundTripTime=r.roundTripTime||-1;this.lastUpdateTime=a();this.lastWriteDate=t.lastWrite?t.lastWrite.lastWriteDate:null;this.opTime=t.lastWrite?t.lastWrite.opTime:null;this.type=parseServerType(t);this.topologyVersion=r.topologyVersion||t.topologyVersion;u.forEach((e=>{if(typeof t[e]!=="undefined")this[e]=t[e]}));if(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 l.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||compareTopologyVersion(this.topologyVersion,e.topologyVersion)===0;return e!=null&&i(this.error,e.error)&&this.type===e.type&&this.minWireVersion===e.minWireVersion&&this.me===e.me&&n(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}}function parseServerType(e){if(!e||!e.ok){return s.Unknown}if(e.isreplicaset){return s.RSGhost}if(e.msg&&e.msg==="isdbgrid"){return s.Mongos}if(e.setName){if(e.hidden){return s.RSOther}else if(e.ismaster){return s.RSPrimary}else if(e.secondary){return s.RSSecondary}else if(e.arbiterOnly){return s.RSArbiter}else{return s.RSOther}}return s.Standalone}function compareTopologyVersion(e,t){if(e==null||t==null){return-1}if(e.processId.equals(t.processId)){if(e.counter===t.counter){return 0}else if(e.counter{"use strict";const n=r(2291).ServerType;const o=r(2291).TopologyType;const i=r(4485);const s=r(3111).MongoError;const a=1e4;const c=90;function writableServerSelector(){return function(e,t){return latencyWindowReducer(e,t.filter((e=>e.isWritable)))}}function maxStalenessReducer(e,t,r){if(e.maxStalenessSeconds==null||e.maxStalenessSeconds<0){return r}const n=e.maxStalenessSeconds;const i=(t.heartbeatFrequencyMS+a)/1e3;if(n{const i=o.lastUpdateTime-o.lastWriteDate-(n.lastUpdateTime-n.lastWriteDate)+t.heartbeatFrequencyMS;const s=i/1e3;if(s<=e.maxStalenessSeconds)r.push(o);return r}),[])}if(t.type===o.ReplicaSetNoPrimary){if(r.length===0){return r}const n=r.reduce(((e,t)=>t.lastWriteDate>e.lastWriteDate?t:e));return r.reduce(((r,o)=>{const i=n.lastWriteDate-o.lastWriteDate+t.heartbeatFrequencyMS;const s=i/1e3;if(s<=e.maxStalenessSeconds)r.push(o);return r}),[])}return r}function tagSetMatch(e,t){const r=Object.keys(e);const n=Object.keys(t);for(let o=0;o{if(tagSetMatch(n,t.tags))e.push(t);return e}),[]);if(o.length){return o}}return[]}function latencyWindowReducer(e,t){const r=t.reduce(((e,t)=>e===-1?t.roundTripTime:Math.min(t.roundTripTime,e)),-1);const n=r+e.localThresholdMS;return t.reduce(((e,t)=>{if(t.roundTripTime<=n&&t.roundTripTime>=r)e.push(t);return e}),[])}function primaryFilter(e){return e.type===n.RSPrimary}function secondaryFilter(e){return e.type===n.RSSecondary}function nearestFilter(e){return e.type===n.RSSecondary||e.type===n.RSPrimary}function knownFilter(e){return e.type!==n.Unknown}function readPreferenceServerSelector(e){if(!e.isValid()){throw new TypeError("Invalid read preference specified")}return function(t,r){const n=t.commonWireVersion;if(n&&e.minWireVersion&&e.minWireVersion>n){throw new s(`Minimum wire version '${e.minWireVersion}' required, but found '${n}'`)}if(t.type===o.Unknown){return[]}if(t.type===o.Single||t.type===o.Sharded){return latencyWindowReducer(t,r.filter(knownFilter))}const a=e.mode;if(a===i.PRIMARY){return r.filter(primaryFilter)}if(a===i.PRIMARY_PREFERRED){const e=r.filter(primaryFilter);if(e.length){return e}}const c=a===i.NEAREST?nearestFilter:secondaryFilter;const l=latencyWindowReducer(t,tagSetReducer(e,maxStalenessReducer(e,t,r.filter(c))));if(a===i.SECONDARY_PREFERRED&&l.length===0){return r.filter(primaryFilter)}return l}}e.exports={writableServerSelector:writableServerSelector,readPreferenceServerSelector:readPreferenceServerSelector}},9663:(e,t,r)=>{"use strict";var n;const o=r(104);const i=r(8614).EventEmitter;const s=r(881);function matchesParentDomain(e,t){const r=/^.*?\./;const n=`.${e.replace(r,"")}`;const o=`.${t.replace(r,"")}`;return n.endsWith(o)}class SrvPollingEvent{constructor(e){this.srvRecords=e}addresses(){return new Set(this.srvRecords.map((e=>`${e.name}:${e.port}`)))}}class SrvPoller extends i{constructor(e){super();if(!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=o("srvPoller",e);this.haMode=false;this.generation=0;this._timeout=null}get srvAddress(){return`_mongodb._tcp.${this.srvHost}`}get intervalMS(){return this.haMode?this.heartbeatFrequencyMS:this.rescanSrvIntervalMS}start(){if(!this._timeout){this.schedule()}}stop(){if(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=false;this.schedule();this.emit("srvRecordDiscovery",new SrvPollingEvent(e))}failure(e,t){this.logger.warn(e,t);this.haMode=true;this.schedule()}parentDomainMismatch(e){this.logger.warn(`parent domain mismatch on SRV record (${e.name}:${e.port})`,e)}_poll(){const e=this.generation;s.resolveSrv(this.srvAddress,((t,r)=>{if(e!==this.generation){return}if(t){this.failure("DNS error",t);return}const n=[];r.forEach((e=>{if(matchesParentDomain(e.name,this.srvHost)){n.push(e)}else{this.parentDomainMismatch(e)}}));if(!n.length){this.failure("No valid addresses found at host");return}this.success(n)}))}}n=SrvPollingEvent;e.exports.D=SrvPoller},4149:(e,t,r)=>{"use strict";const n=r(2342);const o=r(8614);const i=r(750).ServerDescription;const s=r(2291).ServerType;const a=r(7962).TopologyDescription;const c=r(2291).TopologyType;const l=r(2785);const u=r(7062).Server;const d=r(1178).relayEvents;const p=r(4485);const h=r(2306).isRetryableWritesSupported;const m=r(4847).CoreCursor;const g=r(1669).deprecate;const y=r(7746).retrieveBSON();const v=r(2306).createCompressionInfo;const b=r(5474).ClientSession;const S=r(3111).MongoError;const w=r(3111).MongoServerSelectionError;const E=r(2306).resolveClusterTime;const _=r(9663).D;const O=r(2306).getMMAPError;const C=r(1178).makeStateMachine;const T=r(1178).eachAsync;const I=r(1371).emitDeprecationWarning;const k=r(5474).ServerSessionPool;const A=r(1178).makeClientMetadata;const R=r(897).CMAP_EVENT_NAMES;const N=r(750).compareTopologyVersion;const M=r(1371).emitWarning;const D=r(2291);const P=D.drainTimerQueue;const L=D.clearAndRemoveTimerFrom;const B=r(4547);const j=B.readPreferenceServerSelector;const U=B.writableServerSelector;let F=0;const W=["serverHeartbeatStarted","serverHeartbeatSucceeded","serverHeartbeatFailed","commandStarted","commandSucceeded","commandFailed","monitoring"].concat(R);const $=["connect","descriptionReceived","close","ended"];const z=D.STATE_CLOSING;const q=D.STATE_CLOSED;const V=D.STATE_CONNECTING;const G=D.STATE_CONNECTED;const K=C({[q]:[q,V],[V]:[V,z,G,q],[G]:[G,z,q],[z]:[z,q]});const Y=new Set(["autoReconnect","reconnectTries","reconnectInterval","bufferMaxEntries"]);const X=Symbol("cancelled");const J=Symbol("waitQueue");class Topology extends o{constructor(e,t){super();if(typeof t==="undefined"&&typeof e!=="string"){t=e;e=[];if(t.host){e.push({host:t.host,port:t.port})}}e=e||[];if(typeof e==="string"){e=parseStringSeedlist(e)}t=Object.assign({},D.TOPOLOGY_DEFAULTS,t);t=Object.freeze(Object.assign(t,{metadata:A(t),compression:{compressors:v(t)}}));Y.forEach((e=>{if(t[e]){I(`The option \`${e}\` is incompatible with the unified topology, please read more by visiting http://bit.ly/2D8WfT6`,"DeprecationWarning")}}));const r=topologyTypeFromSeedlist(e,t);const o=F++;const s=e.reduce(((e,t)=>{if(t.domain_socket)t.host=t.domain_socket;const r=t.port?`${t.host}:${t.port}`:`${t.host}:27017`;e.set(r,new i(r));return e}),new Map);this[J]=new n;this.s={id:o,options:t,seedlist:e,state:q,description:new a(r,s,t.replicaSet,null,null,null,t),serverSelectionTimeoutMS:t.serverSelectionTimeoutMS,heartbeatFrequencyMS:t.heartbeatFrequencyMS,minHeartbeatFrequencyMS:t.minHeartbeatFrequencyMS,Cursor:t.cursorFactory||m,bson:t.bson||new y([y.Binary,y.Code,y.DBRef,y.Decimal128,y.Double,y.Int32,y.Long,y.Map,y.MaxKey,y.MinKey,y.ObjectId,y.BSONRegExp,y.Symbol,y.Timestamp]),servers:new Map,sessionPool:new k(this),sessions:new Set,promiseLibrary:t.promiseLibrary||Promise,credentials:t.credentials,clusterTime:null,connectionTimers:new Set};if(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;const r=e.newDescription.type;if(t!==c.Sharded&&r===c.Sharded){this.s.handleSrvPolling=srvPollingHandler(this);this.s.srvPoller.on("srvRecordDiscovery",this.s.handleSrvPolling);this.s.srvPoller.start()}};this.on("topologyDescriptionChanged",this.s.detectTopologyDescriptionChange)}this.setMaxListeners(Infinity)}get description(){return this.s.description}get parserType(){return y.native?"c++":"js"}connect(e,t){if(typeof e==="function")t=e,e={};e=e||{};if(this.s.state===G){if(typeof t==="function"){t()}return}K(this,V);this.emit("topologyOpening",new l.TopologyOpeningEvent(this.s.id));this.emit("topologyDescriptionChanged",new l.TopologyDescriptionChangedEvent(this.s.id,new a(c.Unknown),this.s.description));connectServers(this,Array.from(this.s.description.servers.values()));p.translate(e);const r=e.readPreference||p.primary;const connectHandler=e=>{if(e){this.close();if(typeof t==="function"){t(e)}else{this.emit("error",e)}return}K(this,G);this.emit("open",e,this);this.emit("connect",this);if(typeof t==="function")t(e,this)};if(this.s.credentials){this.command("admin.$cmd",{ping:1},{readPreference:r},connectHandler);return}this.selectServer(j(r),e,connectHandler)}close(e,t){if(typeof e==="function"){t=e;e={}}if(typeof e==="boolean"){e={force:e}}e=e||{};if(this.s.state===q||this.s.state===z){if(typeof t==="function"){t()}return}K(this,z);drainWaitQueue(this[J],new S("Topology closed"));P(this.s.connectionTimers);if(this.s.srvPoller){this.s.srvPoller.stop();if(this.s.handleSrvPolling){this.s.srvPoller.removeListener("srvRecordDiscovery",this.s.handleSrvPolling);delete this.s.handleSrvPolling}}if(this.s.detectTopologyDescriptionChange){this.removeListener("topologyDescriptionChanged",this.s.detectTopologyDescriptionChange);delete this.s.detectTopologyDescriptionChange}this.s.sessions.forEach((e=>e.endSession()));this.s.sessionPool.endAllPooledSessions((()=>{T(Array.from(this.s.servers.values()),((t,r)=>destroyServer(t,this,e,r)),(e=>{this.s.servers.clear();this.emit("topologyClosed",new l.TopologyClosedEvent(this.s.id));K(this,q);if(typeof t==="function"){t(e)}}))}))}selectServer(e,t,r){if(typeof t==="function"){r=t;if(typeof e!=="function"){t=e;let r;if(e instanceof p){r=e}else if(typeof e==="string"){r=new p(e)}else{p.translate(t);r=t.readPreference||p.primary}e=j(r)}else{t={}}}t=Object.assign({},{serverSelectionTimeoutMS:this.s.serverSelectionTimeoutMS},t);const n=this.description.type===c.Sharded;const o=t.session;const i=o&&o.transaction;if(n&&i&&i.server){r(undefined,i.server);return}let s=e;if(typeof e==="object"){const t=e.readPreference?e.readPreference:p.primary;s=j(t)}const a={serverSelector:s,transaction:i,callback:r};const l=t.serverSelectionTimeoutMS;if(l){a.timer=setTimeout((()=>{a[X]=true;a.timer=undefined;const e=new w(`Server selection timed out after ${l} ms`,this.description);a.callback(e)}),l)}this[J].push(a);processWaitQueue(this)}shouldCheckForSessionSupport(){if(this.description.type===c.Single){return!this.description.hasKnownServers}return!this.description.hasDataBearingServers}hasSessionSupport(){return this.description.logicalSessionTimeoutMinutes!=null}startSession(e,t){const r=new b(this,this.s.sessionPool,e,t);r.once("ended",(()=>{this.s.sessions.delete(r)}));this.s.sessions.add(r);return r}endSessions(e,t){if(!Array.isArray(e)){e=[e]}this.command("admin.$cmd",{endSessions:e},{readPreference:p.primaryPreferred,noResponse:true},(()=>{if(typeof t==="function")t()}))}serverUpdateHandler(e){if(!this.s.description.hasServer(e.address)){return}if(isStaleServerDescription(this.s.description,e)){return}const t=this.s.description;const r=this.s.description.servers.get(e.address);const n=e.$clusterTime;if(n){E(this,n)}const o=r&&r.equals(e);this.s.description=this.s.description.update(e);if(this.s.description.compatibilityError){this.emit("error",new S(this.s.description.compatibilityError));return}if(!o){this.emit("serverDescriptionChanged",new l.ServerDescriptionChangedEvent(this.s.id,e.address,r,this.s.description.servers.get(e.address)))}updateServers(this,e);if(this[J].length>0){processWaitQueue(this)}if(!o){this.emit("topologyDescriptionChanged",new l.TopologyDescriptionChangedEvent(this.s.id,t,this.s.description))}}auth(e,t){if(typeof e==="function")t=e,e=null;if(typeof t==="function")t(null,true)}logout(e){if(typeof e==="function")e(null,true)}insert(e,t,r,n){executeWriteOperation({topology:this,op:"insert",ns:e,ops:t},r,n)}update(e,t,r,n){executeWriteOperation({topology:this,op:"update",ns:e,ops:t},r,n)}remove(e,t,r,n){executeWriteOperation({topology:this,op:"remove",ns:e,ops:t},r,n)}command(e,t,r,n){if(typeof r==="function"){n=r,r={},r=r||{}}p.translate(r);const o=r.readPreference||p.primary;this.selectServer(j(o),r,((o,i)=>{if(o){n(o);return}const s=!r.retrying&&!!r.retryWrites&&r.session&&h(this)&&!r.session.inTransaction()&&isWriteCommand(t);const cb=(o,i)=>{if(!o)return n(null,i);if(!shouldRetryOperation(o)){return n(o)}if(s){const o=Object.assign({},r,{retrying:true});return this.command(e,t,o,n)}return n(o)};if(s){r.session.incrementTransactionNumber();r.willRetryWrite=s}i.command(e,t,r,cb)}))}cursor(e,t,r){r=r||{};const n=r.topology||this;const o=r.cursorFactory||this.s.Cursor;p.translate(r);return new o(n,e,t,r)}get clientMetadata(){return this.s.options.metadata}isConnected(){return this.s.state===G}isDestroyed(){return this.s.state===q}unref(){M("not implemented: `unref`")}lastIsMaster(){const e=Array.from(this.description.servers.values());if(e.length===0)return{};const t=e.filter((e=>e.type!==s.Unknown))[0];const r=t||{maxWireVersion:this.description.commonWireVersion};return r}get logicalSessionTimeoutMinutes(){return this.description.logicalSessionTimeoutMinutes}get bson(){return this.s.bson}}Object.defineProperty(Topology.prototype,"clusterTime",{enumerable:true,get:function(){return this.s.clusterTime},set:function(e){this.s.clusterTime=e}});Topology.prototype.destroy=g(Topology.prototype.close,"destroy() is deprecated, please use close() instead");const Z=["findAndModify","insert","update","delete"];function isWriteCommand(e){return Z.some((t=>e[t]))}function isStaleServerDescription(e,t){const r=e.servers.get(t.address);const n=r.topologyVersion;return N(n,t.topologyVersion)>0}function destroyServer(e,t,r,n){r=r||{};$.forEach((t=>e.removeAllListeners(t)));e.destroy(r,(()=>{t.emit("serverClosed",new l.ServerClosedEvent(t.s.id,e.description.address));W.forEach((t=>e.removeAllListeners(t)));if(typeof n==="function"){n()}}))}function parseStringSeedlist(e){return e.split(",").map((e=>({host:e.split(":")[0],port:e.split(":")[1]||27017})))}function topologyTypeFromSeedlist(e,t){if(t.directConnection){return c.Single}const r=t.replicaSet||t.setName||t.rs_name;if(r==null){return c.Unknown}return c.ReplicaSetNoPrimary}function randomSelection(e){return e[Math.floor(Math.random()*e.length)]}function createAndConnectServer(e,t,r){e.emit("serverOpening",new l.ServerOpeningEvent(e.s.id,t.address));const n=new u(t,e.s.options,e);d(n,e,W);n.on("descriptionReceived",e.serverUpdateHandler.bind(e));if(r){const t=setTimeout((()=>{L(t,e.s.connectionTimers);n.connect()}),r);e.s.connectionTimers.add(t);return n}n.connect();return n}function connectServers(e,t){e.s.servers=t.reduce(((t,r)=>{const n=createAndConnectServer(e,r);t.set(r.address,n);return t}),new Map)}function updateServers(e,t){if(t&&e.s.servers.has(t.address)){const r=e.s.servers.get(t.address);r.s.description=t}for(const t of e.description.servers.values()){if(!e.s.servers.has(t.address)){const r=createAndConnectServer(e,t);e.s.servers.set(t.address,r)}}for(const t of e.s.servers){const r=t[0];if(e.description.hasServer(r)){continue}const n=e.s.servers.get(r);e.s.servers.delete(r);destroyServer(n,e)}}function executeWriteOperation(e,t,r){if(typeof t==="function")r=t,t={};t=t||{};const n=e.topology;const o=e.op;const i=e.ns;const s=e.ops;const a=!e.retrying&&!!t.retryWrites&&t.session&&h(n)&&!t.session.inTransaction()&&t.explain===undefined;n.selectServer(U(),t,((n,c)=>{if(n){r(n,null);return}const handler=(n,o)=>{if(!n)return r(null,o);if(!shouldRetryOperation(n)){n=O(n);return r(n)}if(a){const n=Object.assign({},e,{retrying:true});return executeWriteOperation(n,t,r)}return r(n)};if(r.operationId){handler.operationId=r.operationId}if(a){t.session.incrementTransactionNumber();t.willRetryWrite=a}c[o](i,s,t,handler)}))}function shouldRetryOperation(e){return e instanceof S&&e.hasErrorLabel("RetryableWriteError")}function srvPollingHandler(e){return function handleSrvPolling(t){const r=e.s.description;e.s.description=e.s.description.updateFromSrvPollingEvent(t);if(e.s.description===r){return}updateServers(e);e.emit("topologyDescriptionChanged",new l.TopologyDescriptionChangedEvent(e.s.id,r,e.s.description))}}function drainWaitQueue(e,t){while(e.length){const r=e.shift();clearTimeout(r.timer);if(!r[X]){r.callback(t)}}}function processWaitQueue(e){if(e.s.state===q){drainWaitQueue(e[J],new S("Topology is closed, please connect"));return}const t=Array.from(e.description.servers.values());const r=e[J].length;for(let n=0;n0){e.s.servers.forEach((e=>process.nextTick((()=>e.requestCheck()))))}}e.exports={Topology:Topology}},7962:(e,t,r)=>{"use strict";const n=r(2291).ServerType;const o=r(750).ServerDescription;const i=r(7161);const s=r(2291).TopologyType;const a=i.MIN_SUPPORTED_SERVER_VERSION;const c=i.MAX_SUPPORTED_SERVER_VERSION;const l=i.MIN_SUPPORTED_WIRE_VERSION;const u=i.MAX_SUPPORTED_WIRE_VERSION;class TopologyDescription{constructor(e,t,r,o,i,d,p){p=p||{};this.type=e||s.Unknown;this.setName=r||null;this.maxSetVersion=o||null;this.maxElectionId=i||null;this.servers=t||new Map;this.stale=false;this.compatible=true;this.compatibilityError=null;this.logicalSessionTimeoutMinutes=null;this.heartbeatFrequencyMS=p.heartbeatFrequencyMS||0;this.localThresholdMS=p.localThresholdMS||0;this.commonWireVersion=d||null;Object.defineProperty(this,"options",{value:p,enumberable:false});for(const e of this.servers.values()){if(e.type===n.Unknown)continue;if(e.minWireVersion>u){this.compatible=false;this.compatibilityError=`Server at ${e.address} requires wire version ${e.minWireVersion}, but this version of the driver only supports up to ${u} (MongoDB ${c})`}if(e.maxWireVersion=0){d.delete(t)}if(u===n.RSPrimary){const t=updateRsFromPrimary(d,i,e,a,c);r=t[0],i=t[1],a=t[2],c=t[3]}else if([n.RSSecondary,n.RSArbiter,n.RSOther].indexOf(u)>=0){const t=updateRsNoPrimaryFromMember(d,i,e);r=t[0],i=t[1]}}if(r===s.ReplicaSetWithPrimary){if([n.Standalone,n.Mongos].indexOf(u)>=0){d.delete(t);r=checkHasPrimary(d)}else if(u===n.RSPrimary){const t=updateRsFromPrimary(d,i,e,a,c);r=t[0],i=t[1],a=t[2],c=t[3]}else if([n.RSSecondary,n.RSArbiter,n.RSOther].indexOf(u)>=0){r=updateRsWithPrimaryFromMember(d,i,e)}else{r=checkHasPrimary(d)}}return new TopologyDescription(r,d,i,a,c,l,this.options)}get error(){const e=Array.from(this.servers.values()).filter((e=>e.error));if(e.length>0){return e[0].error}return undefined}get hasKnownServers(){return Array.from(this.servers.values()).some((e=>e.type!==n.Unknown))}get hasDataBearingServers(){return Array.from(this.servers.values()).some((e=>e.isDataBearing))}hasServer(e){return this.servers.has(e)}}function topologyTypeForServerType(e){if(e===n.Standalone){return s.Single}if(e===n.Mongos){return s.Sharded}if(e===n.RSPrimary){return s.ReplicaSetWithPrimary}if(e===n.RSGhost||e===n.Unknown){return s.Unknown}return s.ReplicaSetNoPrimary}function compareObjectId(e,t){if(e==null){return-1}if(t==null){return 1}if(e.id instanceof Buffer&&t.id instanceof Buffer){const r=e.id;const n=t.id;return r.compare(n)}const r=e.toString();const n=t.toString();return r.localeCompare(n)}function updateRsFromPrimary(e,t,r,i,s){t=t||r.setName;if(t!==r.setName){e.delete(r.address);return[checkHasPrimary(e),t,i,s]}const a=r.electionId?r.electionId:null;if(r.setVersion&&a){if(i&&s){if(i>r.setVersion||compareObjectId(s,a)>0){e.set(r.address,new o(r.address));return[checkHasPrimary(e),t,i,s]}}s=r.electionId}if(r.setVersion!=null&&(i==null||r.setVersion>i)){i=r.setVersion}for(const t of e.keys()){const i=e.get(t);if(i.type===n.RSPrimary&&i.address!==r.address){e.set(t,new o(i.address));break}}r.allHosts.forEach((t=>{if(!e.has(t)){e.set(t,new o(t))}}));const c=Array.from(e.keys());const l=r.allHosts;c.filter((e=>l.indexOf(e)===-1)).forEach((t=>{e.delete(t)}));return[checkHasPrimary(e),t,i,s]}function updateRsWithPrimaryFromMember(e,t,r){if(t==null){throw new TypeError("setName is required")}if(t!==r.setName||r.me&&r.address!==r.me){e.delete(r.address)}return checkHasPrimary(e)}function updateRsNoPrimaryFromMember(e,t,r){let n=s.ReplicaSetNoPrimary;t=t||r.setName;if(t!==r.setName){e.delete(r.address);return[n,t]}r.allHosts.forEach((t=>{if(!e.has(t)){e.set(t,new o(t))}}));if(r.me&&r.address!==r.me){e.delete(r.address)}return[n,t]}function checkHasPrimary(e){for(const t of e.keys()){if(e.get(t).type===n.RSPrimary){return s.ReplicaSetWithPrimary}}return s.ReplicaSetNoPrimary}e.exports={TopologyDescription:TopologyDescription}},5474:(e,t,r)=>{"use strict";const n=r(7746).retrieveBSON;const o=r(8614);const i=n();const s=i.Binary;const a=r(1178).uuidV4;const c=r(3111).MongoError;const l=r(3111).isRetryableError;const u=r(3111).MongoNetworkError;const d=r(3111).MongoWriteConcernError;const p=r(1707).Transaction;const h=r(1707).TxnState;const m=r(1178).isPromiseLike;const g=r(4485);const y=r(1371).maybePromise;const v=r(1707).isTransactionCommand;const b=r(2306).resolveClusterTime;const S=r(7272).isSharded;const w=r(1178).maxWireVersion;const E=r(1371).now;const _=r(1371).calculateDurationInMs;const O=8;function assertAlive(e,t){if(e.serverSession==null){const e=new c("Cannot use a session that has ended");if(typeof t==="function"){t(e,null);return false}throw e}return true}const C=Symbol("serverSession");class ClientSession extends o{constructor(e,t,r,n){super();if(e==null){throw new Error("ClientSession requires a topology")}if(t==null||!(t instanceof ServerSessionPool)){throw new Error("ClientSession requires a ServerSessionPool")}r=r||{};n=n||{};this.topology=e;this.sessionPool=t;this.hasEnded=false;this.clientOptions=n;this[C]=undefined;this.supports={causalConsistency:typeof r.causalConsistency!=="undefined"?r.causalConsistency:true};this.clusterTime=r.initialClusterTime;this.operationTime=null;this.explicit=!!r.explicit;this.owner=r.owner;this.defaultTransactionOptions=Object.assign({},r.defaultTransactionOptions);this.transaction=new p}get id(){return this.serverSession.id}get serverSession(){if(this[C]==null){this[C]=this.sessionPool.acquire()}return this[C]}endSession(e,t){if(typeof e==="function")t=e,e={};e=e||{};const r=this;return y(this,t,(e=>{if(r.hasEnded){return e()}function completeEndSession(){r.sessionPool.release(r.serverSession);r[C]=undefined;r.hasEnded=true;r.emit("ended",r);e()}if(r.serverSession&&r.inTransaction()){r.abortTransaction((t=>{if(t)return e(t);completeEndSession()}));return}completeEndSession()}))}advanceOperationTime(e){if(this.operationTime==null){this.operationTime=e;return}if(e.greaterThan(this.operationTime)){this.operationTime=e}}equals(e){if(!(e instanceof ClientSession)){return false}return this.id.id.buffer.equals(e.id.id.buffer)}incrementTransactionNumber(){this.serverSession.txnNumber++}inTransaction(){return this.transaction.isActive}startTransaction(e){assertAlive(this);if(this.inTransaction()){throw new c("Transaction already in progress")}const t=w(this.topology);if(S(this.topology)&&t!=null&&tendTransaction(this,"commitTransaction",e)))}abortTransaction(e){return y(this,e,(e=>endTransaction(this,"abortTransaction",e)))}toBSON(){throw new Error("ClientSession cannot be serialized to BSON.")}withTransaction(e,t){const r=E();return attemptTransaction(this,r,e,t)}}const T=12e4;const I=100;const k=79;const A=50;const R=new Set(["CannotSatisfyWriteConcern","UnknownReplWriteConcern","UnsatisfiableWriteConcern"]);function hasNotTimedOut(e,t){return _(e){if(o instanceof c&&hasNotTimedOut(t,T)&&!isMaxTimeMSExpiredError(o)){if(o.hasErrorLabel("UnknownTransactionCommitResult")){return attemptTransactionCommit(e,t,r,n)}if(o.hasErrorLabel("TransientTransactionError")){return attemptTransaction(e,t,r,n)}}throw o}))}const N=new Set([h.NO_TRANSACTION,h.TRANSACTION_COMMITTED,h.TRANSACTION_ABORTED]);function userExplicitlyEndedTransaction(e){return N.has(e.transaction.state)}function attemptTransaction(e,t,r,n){e.startTransaction(n);let o;try{o=r(e)}catch(e){o=Promise.reject(e)}if(!m(o)){e.abortTransaction();throw new TypeError("Function provided to `withTransaction` must return a Promise")}return o.then((()=>{if(userExplicitlyEndedTransaction(e)){return}return attemptTransactionCommit(e,t,r,n)})).catch((o=>{function maybeRetryOrThrow(o){if(o instanceof c&&o.hasErrorLabel("TransientTransactionError")&&hasNotTimedOut(t,T)){return attemptTransaction(e,t,r,n)}if(isMaxTimeMSExpiredError(o)){o.addErrorLabel("UnknownTransactionCommitResult")}throw o}if(e.transaction.isActive){return e.abortTransaction().then((()=>maybeRetryOrThrow(o)))}return maybeRetryOrThrow(o)}))}function endTransaction(e,t,r){if(!assertAlive(e,r)){return}let n=e.transaction.state;if(n===h.NO_TRANSACTION){r(new c("No transaction started"));return}if(t==="commitTransaction"){if(n===h.STARTING_TRANSACTION||n===h.TRANSACTION_COMMITTED_EMPTY){e.transaction.transition(h.TRANSACTION_COMMITTED_EMPTY);r(null,null);return}if(n===h.TRANSACTION_ABORTED){r(new c("Cannot call commitTransaction after calling abortTransaction"));return}}else{if(n===h.STARTING_TRANSACTION){e.transaction.transition(h.TRANSACTION_ABORTED);r(null,null);return}if(n===h.TRANSACTION_ABORTED){r(new c("Cannot call abortTransaction twice"));return}if(n===h.TRANSACTION_COMMITTED||n===h.TRANSACTION_COMMITTED_EMPTY){r(new c("Cannot call abortTransaction after calling commitTransaction"));return}}const o={[t]:1};let i;if(e.transaction.options.writeConcern){i=Object.assign({},e.transaction.options.writeConcern)}else if(e.clientOptions&&e.clientOptions.w){i={w:e.clientOptions.w}}if(n===h.TRANSACTION_COMMITTED){i=Object.assign({wtimeout:1e4},i,{w:"majority"})}if(i){Object.assign(o,{writeConcern:i})}if(t==="commitTransaction"&&e.transaction.options.maxTimeMS){Object.assign(o,{maxTimeMS:e.transaction.options.maxTimeMS})}function commandHandler(n,o){if(t==="commitTransaction"){e.transaction.transition(h.TRANSACTION_COMMITTED);if(n&&(n instanceof u||n instanceof d||l(n)||isMaxTimeMSExpiredError(n))){if(isUnknownTransactionCommitResult(n)){n.addErrorLabel("UnknownTransactionCommitResult");e.transaction.unpinServer()}}}else{e.transaction.transition(h.TRANSACTION_ABORTED)}r(n,o)}function transactionError(e){return t==="commitTransaction"?e:null}if(e.transaction.recoveryToken&&supportsRecoveryToken(e)){o.recoveryToken=e.transaction.recoveryToken}e.topology.command("admin.$cmd",o,{session:e},((t,r)=>{if(t&&l(t)){if(o.commitTransaction){e.transaction.unpinServer();o.writeConcern=Object.assign({wtimeout:1e4},o.writeConcern,{w:"majority"})}return e.topology.command("admin.$cmd",o,{session:e},((e,t)=>commandHandler(transactionError(e),t)))}commandHandler(transactionError(t),r)}))}function supportsRecoveryToken(e){const t=e.topology;return!!t.s.options.useRecoveryToken}class ServerSession{constructor(){this.id={id:new s(a(),s.SUBTYPE_UUID)};this.lastUse=E();this.txnNumber=0;this.isDirty=false}hasTimedOut(e){const t=Math.round(_(this.lastUse)%864e5%36e5/6e4);return t>e-1}}class ServerSessionPool{constructor(e){if(e==null){throw new Error("ServerSessionPool requires a topology")}this.topology=e;this.sessions=[]}endAllPooledSessions(e){if(this.sessions.length){this.topology.endSessions(this.sessions.map((e=>e.id)),(()=>{this.sessions=[];if(typeof e==="function"){e()}}));return}if(typeof e==="function"){e()}}acquire(){const e=this.topology.logicalSessionTimeoutMinutes;while(this.sessions.length){const t=this.sessions.shift();if(!t.hasTimedOut(e)){return t}}return new ServerSession}release(e){const t=this.topology.logicalSessionTimeoutMinutes;while(this.sessions.length){const e=this.sessions[this.sessions.length-1];if(e.hasTimedOut(t)){this.sessions.pop()}else{break}}if(!e.hasTimedOut(t)){if(e.isDirty){return}this.sessions.unshift(e)}}}function commandSupportsReadConcern(e,t){if(e.aggregate||e.count||e.distinct||e.find||e.parallelCollectionScan||e.geoNear||e.geoSearch){return true}if(e.mapReduce&&t&&t.out&&(t.out.inline===1||t.out==="inline")){return true}return false}function applySession(e,t,r){if(e.hasEnded){return new c("Cannot use a session that has ended")}if(r&&r.writeConcern&&r.writeConcern.w===0){return}const n=e.serverSession;n.lastUse=E();t.lsid=n.id;const o=e.inTransaction()||v(t);const s=r.willRetryWrite;const a=commandSupportsReadConcern(t,r);if(n.txnNumber&&(s||o)){t.txnNumber=i.Long.fromNumber(n.txnNumber)}if(!o){if(e.transaction.state!==h.NO_TRANSACTION){e.transaction.transition(h.NO_TRANSACTION)}if(e.supports.causalConsistency&&e.operationTime&&a){t.readConcern=t.readConcern||{};Object.assign(t.readConcern,{afterClusterTime:e.operationTime})}return}if(r.readPreference&&!r.readPreference.equals(g.primary)){return new c(`Read preference in a transaction must be primary, not: ${r.readPreference.mode}`)}t.autocommit=false;if(e.transaction.state===h.STARTING_TRANSACTION){e.transaction.transition(h.TRANSACTION_IN_PROGRESS);t.startTransaction=true;const r=e.transaction.options.readConcern||e.clientOptions.readConcern;if(r){t.readConcern=r}if(e.supports.causalConsistency&&e.operationTime){t.readConcern=t.readConcern||{};Object.assign(t.readConcern,{afterClusterTime:e.operationTime})}}}function updateSessionFromResponse(e,t){if(t.$clusterTime){b(e,t.$clusterTime)}if(t.operationTime&&e&&e.supports.causalConsistency){e.advanceOperationTime(t.operationTime)}if(t.recoveryToken&&e&&e.inTransaction()){e.transaction._recoveryToken=t.recoveryToken}}e.exports={ClientSession:ClientSession,ServerSession:ServerSession,ServerSessionPool:ServerSessionPool,TxnState:h,applySession:applySession,updateSessionFromResponse:updateSessionFromResponse,commandSupportsReadConcern:commandSupportsReadConcern}},8175:(e,t,r)=>{"use strict";const n=r(1669).inherits;const o=r(1669).format;const i=r(8614).EventEmitter;const s=r(4847).CoreCursor;const a=r(104);const c=r(7746).retrieveBSON;const l=r(3111).MongoError;const u=r(6495);const d=r(2306).diff;const p=r(2306).cloneOptions;const h=r(2306).SessionMixins;const m=r(2306).isRetryableWritesSupported;const g=r(1178).relayEvents;const y=c();const v=r(2306).getMMAPError;const b=r(1178).makeClientMetadata;const S=r(2306).legacyIsRetryableWriteError;var w="disconnected";var E="connecting";var _="connected";var O="unreferenced";var C="destroying";var T="destroyed";function stateTransition(e,t){var r={disconnected:[E,C,T,w],connecting:[E,C,T,_,w],connected:[_,w,C,T,O],unreferenced:[O,C,T],destroyed:[T]};var n=r[e.state];if(n&&n.indexOf(t)!==-1){e.state=t}else{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 I=1;var k=["connect","close","error","timeout","parseError"];var Mongos=function(e,t){t=t||{};this.id=I++;if(Array.isArray(e)){e=e.reduce(((e,t)=>{if(e.find((e=>e.host===t.host&&e.port===t.port))){return e}e.push(t);return e}),[])}this.s={options:Object.assign({metadata:b(t)},t),bson:t.bson||new y([y.Binary,y.Code,y.DBRef,y.Decimal128,y.Double,y.Int32,y.Long,y.Map,y.MaxKey,y.MinKey,y.ObjectId,y.BSONRegExp,y.Symbol,y.Timestamp]),Cursor:t.cursorFactory||s,logger:a("Mongos",t),seedlist:e,haInterval:t.haInterval?t.haInterval:1e4,disconnectHandler:t.disconnectHandler,index:0,connectOptions:{},debug:typeof t.debug==="boolean"?t.debug:false,localThresholdMS:t.localThresholdMS||15};if(this.s.logger.isWarn()&&this.s.options.socketTimeout!==0&&this.s.options.socketTimeout0){e.emit(t,r)}}const A=["serverDescriptionChanged","error","close","timeout","parseError"];function destroyServer(e,t,r){t=t||{};A.forEach((t=>e.removeAllListeners(t)));e.destroy(t,r)}Mongos.prototype.connect=function(e){var t=this;this.s.connectOptions=e||{};stateTransition(this,E);var r=this.s.seedlist.map((function(r){const n=new u(Object.assign({},t.s.options,r,e,{reconnect:false,monitoring:false,parent:t}));g(n,t,["serverDescriptionChanged"]);return n}));emitSDAMEvent(this,"topologyOpening",{topologyId:this.id});connectProxies(t,r)};Mongos.prototype.auth=function(e,t){if(typeof t==="function")t(null,null)};function handleEvent(e){return function(){if(e.state===T||e.state===C){return}moveServerFrom(e.connectedProxies,e.disconnectedProxies,this);emitTopologyDescriptionChanged(e);e.emit("left","mongos",this);e.emit("serverClosed",{topologyId:e.id,address:this.name})}}function handleInitialConnectEvent(e,t){return function(){var r=this;if(e.state===T){emitTopologyDescriptionChanged(e);moveServerFrom(e.connectingProxies,e.disconnectedProxies,this);return this.destroy()}if(t==="connect"){e.ismaster=r.lastIsMaster();if(e.ismaster.msg==="isdbgrid"){for(let t=0;t0&&e.state===E){stateTransition(e,_);e.emit("connect",e);e.emit("fullsetup",e);e.emit("all",e)}else if(e.disconnectedProxies.length===0){if(e.s.logger.isWarn()){e.s.logger.warn(o("no mongos proxies found in seed list, did you mean to connect to a replicaset"))}return e.emit("error",new l("no mongos proxies found in seed list"))}topologyMonitor(e,{firstConnect:true})}}}function connectProxies(e,t){e.connectingProxies=e.connectingProxies.concat(t);var r=0;function connect(t,r){setTimeout((function(){e.emit("serverOpening",{topologyId:e.id,address:t.name});emitTopologyDescriptionChanged(e);t.once("close",handleInitialConnectEvent(e,"close"));t.once("timeout",handleInitialConnectEvent(e,"timeout"));t.once("parseError",handleInitialConnectEvent(e,"parseError"));t.once("error",handleInitialConnectEvent(e,"error"));t.once("connect",handleInitialConnectEvent(e,"connect"));g(t,e,["commandStarted","commandSucceeded","commandFailed"]);t.connect(e.s.connectOptions)}),r)}t.forEach((e=>connect(e,r++)))}function pickProxy(e,t){const r=t&&t.transaction;if(r&&r.server){if(r.server.isConnected()){return r.server}else{r.unpinServer()}}var n=e.connectedProxies.slice(0);var o=Number.MAX_VALUE;for(var i=0;i0&&e.state===E){e.emit("error",new l("no mongos proxy available"))}else{e.emit("close",e)}return reconnectProxies(e,e.disconnectedProxies,(function(){if(e.state===T||e.state===C||e.state===O){return}if(e.state===E&&t.firstConnect){e.emit("connect",e);e.emit("fullsetup",e);e.emit("all",e)}else if(e.isConnected()){e.emit("reconnect",e)}else if(!e.isConnected()&&e.listeners("close").length>0){e.emit("close",e)}topologyMonitor(e)}))}for(var o=0;o{n--;if(n>0){return}emitTopologyDescriptionChanged(this);emitSDAMEvent(this,"topologyClosed",{topologyId:this.id});stateTransition(this,T);if(typeof t==="function"){t(null,null)}};if(n===0){serverDestroyed();return}r.forEach((t=>{this.emit("serverClosed",{topologyId:this.id,address:t.name});destroyServer(t,e,serverDestroyed);moveServerFrom(this.connectedProxies,this.disconnectedProxies,t)}))};Mongos.prototype.isConnected=function(){return this.connectedProxies.length>0};Mongos.prototype.isDestroyed=function(){return this.state===T};function executeWriteOperation(e,t,r){if(typeof t==="function")r=t,t={};t=t||{};const n=e.self;const o=e.op;const i=e.ns;const s=e.ops;let a=pickProxy(n,t.session);if(!a)return r(new l("no mongos proxy available"));const c=!e.retrying&&!!t.retryWrites&&t.session&&m(n)&&!t.session.inTransaction()&&t.explain===undefined;const handler=(o,i)=>{if(!o)return r(null,i);if(!S(o,n)||!c){o=v(o);return r(o)}a=pickProxy(n,t.session);if(!a){return r(o)}const s=Object.assign({},e,{retrying:true});return executeWriteOperation(s,t,r)};if(r.operationId){handler.operationId=r.operationId}if(c){t.session.incrementTransactionNumber();t.willRetryWrite=c}a[o](i,s,t,handler)}Mongos.prototype.insert=function(e,t,r,n){if(typeof r==="function"){n=r,r={},r=r||{}}if(this.state===T){return n(new l(o("topology was destroyed")))}if(!this.isConnected()&&this.s.disconnectHandler!=null){return this.s.disconnectHandler.add("insert",e,t,r,n)}if(!this.isConnected()){return n(new l("no mongos proxy available"))}executeWriteOperation({self:this,op:"insert",ns:e,ops:t},r,n)};Mongos.prototype.update=function(e,t,r,n){if(typeof r==="function"){n=r,r={},r=r||{}}if(this.state===T){return n(new l(o("topology was destroyed")))}if(!this.isConnected()&&this.s.disconnectHandler!=null){return this.s.disconnectHandler.add("update",e,t,r,n)}if(!this.isConnected()){return n(new l("no mongos proxy available"))}executeWriteOperation({self:this,op:"update",ns:e,ops:t},r,n)};Mongos.prototype.remove=function(e,t,r,n){if(typeof r==="function"){n=r,r={},r=r||{}}if(this.state===T){return n(new l(o("topology was destroyed")))}if(!this.isConnected()&&this.s.disconnectHandler!=null){return this.s.disconnectHandler.add("remove",e,t,r,n)}if(!this.isConnected()){return n(new l("no mongos proxy available"))}executeWriteOperation({self:this,op:"remove",ns:e,ops:t},r,n)};const R=["findAndModify","insert","update","delete"];function isWriteCommand(e){return R.some((t=>e[t]))}Mongos.prototype.command=function(e,t,r,n){if(typeof r==="function"){n=r,r={},r=r||{}}if(this.state===T){return n(new l(o("topology was destroyed")))}var i=this;var s=pickProxy(i,r.session);if((s==null||!s.isConnected())&&this.s.disconnectHandler!=null){return this.s.disconnectHandler.add("command",e,t,r,n)}if(s==null){return n(new l("no mongos proxy available"))}var a=p(r);a.topology=i;const c=!r.retrying&&r.retryWrites&&r.session&&m(i)&&!r.session.inTransaction()&&isWriteCommand(t);const cb=(r,o)=>{if(!r)return n(null,o);if(!S(r,i)){return n(r)}if(c){const r=Object.assign({},a,{retrying:true});return this.command(e,t,r,n)}return n(r)};if(c){a.session.incrementTransactionNumber();a.willRetryWrite=c}s.command(e,t,a,cb)};Mongos.prototype.cursor=function(e,t,r){r=r||{};const n=r.topology||this;var o=r.cursorFactory||this.s.Cursor;return new o(n,e,t,r)};Mongos.prototype.selectServer=function(e,t,r){if(typeof e==="function"&&typeof r==="undefined")r=e,e=undefined,t={};if(typeof t==="function")r=t,t=e,e=undefined;t=t||{};const n=pickProxy(this,t.session);if(n==null){r(new l("server selection failed"));return}if(this.s.debug)this.emit("pickedServer",null,n);r(null,n)};Mongos.prototype.connections=function(){var e=[];for(var t=0;t0){var t="Unknown";if(e.connectedProxies.length>0){t="Sharded"}var r={topologyType:t,servers:[]};var n=e.disconnectedProxies.concat(e.connectingProxies);r.servers=r.servers.concat(n.map((function(e){var t=e.getDescription();t.type="Unknown";return t})));r.servers=r.servers.concat(e.connectedProxies.map((function(e){var t=e.getDescription();t.type="Mongos";return t})));var o=d(e.topologyDescription,r);var i={topologyId:e.id,previousDescription:e.topologyDescription,newDescription:r,diff:o};if(o.servers.length>0){e.emit("topologyDescriptionChanged",i)}e.topologyDescription=r}}e.exports=Mongos},4485:(e,t,r)=>{"use strict";const n=r(1371).emitWarningOnce;const ReadPreference=function(e,t,r){if(!ReadPreference.isValid(e)){throw new TypeError(`Invalid read preference mode ${e}`)}if(t&&!Array.isArray(t)){n("ReadPreference tags must be an array, this will change in the next major version");const e=typeof t.maxStalenessSeconds!=="undefined";const o=typeof t.hedge!=="undefined";const i=e||o;if(i){r=t;t=undefined}else{t=[t]}}this.mode=e;this.tags=t;this.hedge=r&&r.hedge;r=r||{};if(r.maxStalenessSeconds!=null){if(r.maxStalenessSeconds<=0){throw new TypeError("maxStalenessSeconds must be a positive integer")}this.maxStalenessSeconds=r.maxStalenessSeconds;this.minWireVersion=5}if(this.mode===ReadPreference.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(ReadPreference.prototype,"preference",{enumerable:true,get:function(){return this.mode}});ReadPreference.PRIMARY="primary";ReadPreference.PRIMARY_PREFERRED="primaryPreferred";ReadPreference.SECONDARY="secondary";ReadPreference.SECONDARY_PREFERRED="secondaryPreferred";ReadPreference.NEAREST="nearest";const o=[ReadPreference.PRIMARY,ReadPreference.PRIMARY_PREFERRED,ReadPreference.SECONDARY,ReadPreference.SECONDARY_PREFERRED,ReadPreference.NEAREST,null];ReadPreference.fromOptions=function(e){if(!e)return null;const t=e.readPreference;if(!t)return null;const r=e.readPreferenceTags;const n=e.maxStalenessSeconds;if(typeof t==="string"){return new ReadPreference(t,r)}else if(!(t instanceof ReadPreference)&&typeof t==="object"){const e=t.mode||t.preference;if(e&&typeof e==="string"){return new ReadPreference(e,t.tags,{maxStalenessSeconds:t.maxStalenessSeconds||n,hedge:t.hedge})}}return t};ReadPreference.resolve=function(e,t){t=t||{};const r=t.session;const n=e&&e.readPreference;let o;if(t.readPreference){o=ReadPreference.fromOptions(t)}else if(r&&r.inTransaction()&&r.transaction.options.readPreference){o=r.transaction.options.readPreference}else if(n!=null){o=n}else{o=ReadPreference.primary}return typeof o==="string"?new ReadPreference(o):o};ReadPreference.translate=function(e){if(e.readPreference==null)return e;const t=e.readPreference;if(typeof t==="string"){e.readPreference=new ReadPreference(t)}else if(t&&!(t instanceof ReadPreference)&&typeof t==="object"){const r=t.mode||t.preference;if(r&&typeof r==="string"){e.readPreference=new ReadPreference(r,t.tags,{maxStalenessSeconds:t.maxStalenessSeconds})}}else if(!(t instanceof ReadPreference)){throw new TypeError("Invalid read preference: "+t)}return e};ReadPreference.isValid=function(e){return o.indexOf(e)!==-1};ReadPreference.prototype.isValid=function(e){return ReadPreference.isValid(typeof e==="string"?e:this.mode)};const i=["primaryPreferred","secondary","secondaryPreferred","nearest"];ReadPreference.prototype.slaveOk=function(){return i.indexOf(this.mode)!==-1};ReadPreference.prototype.equals=function(e){return e.mode===this.mode};ReadPreference.prototype.toJSON=function(){const e={mode:this.mode};if(Array.isArray(this.tags))e.tags=this.tags;if(this.maxStalenessSeconds)e.maxStalenessSeconds=this.maxStalenessSeconds;if(this.hedge)e.hedge=this.hedge;return e};ReadPreference.primary=new ReadPreference("primary");ReadPreference.primaryPreferred=new ReadPreference("primaryPreferred");ReadPreference.secondary=new ReadPreference("secondary");ReadPreference.secondaryPreferred=new ReadPreference("secondaryPreferred");ReadPreference.nearest=new ReadPreference("nearest");e.exports=ReadPreference},1134:(e,t,r)=>{"use strict";const n=r(1669).inherits;const o=r(1669).format;const i=r(8614).EventEmitter;const s=r(4485);const a=r(4847).CoreCursor;const c=r(7746).retrieveBSON;const l=r(104);const u=r(3111).MongoError;const d=r(6495);const p=r(8742);const h=r(2306).Timeout;const m=r(2306).Interval;const g=r(2306).SessionMixins;const y=r(2306).isRetryableWritesSupported;const v=r(1178).relayEvents;const b=c();const S=r(2306).getMMAPError;const w=r(1178).makeClientMetadata;const E=r(2306).legacyIsRetryableWriteError;const _=r(1371).now;const O=r(1371).calculateDurationInMs;var C="disconnected";var T="connecting";var I="connected";var k="unreferenced";var A="destroyed";function stateTransition(e,t){var r={disconnected:[T,A,C],connecting:[T,A,I,C],connected:[I,C,A,k],unreferenced:[k,A],destroyed:[A]};var n=r[e.state];if(n&&n.indexOf(t)!==-1){e.state=t}else{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 R=1;var N=["connect","close","error","timeout","parseError"];var ReplSet=function(e,t){var r=this;t=t||{};if(!Array.isArray(e))throw new u("seedlist must be an array");if(e.length===0)throw new u("seedlist must contain at least one entry");e.forEach((function(e){if(typeof e.host!=="string"||typeof e.port!=="number")throw new u("seedlist entry must contain a host and port")}));i.call(this);this.id=R++;var n=t.localThresholdMS||15;if(t.acceptableLatency)n=t.acceptableLatency;var s=l("ReplSet",t);this.s={options:Object.assign({metadata:w(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:n,heartbeatFrequencyMS:t.haInterval?t.haInterval:1e4,logger:s}),connectingServers:[],haInterval:t.haInterval?t.haInterval:1e4,minHeartbeatFrequencyMS:500,disconnectHandler:t.disconnectHandler,index:0,connectOptions:{},debug:typeof t.debug==="boolean"?t.debug:false};this.s.replicaSetState.on("topologyDescriptionChanged",(function(e){r.emit("topologyDescriptionChanged",e)}));if(this.s.logger.isWarn()&&this.s.options.socketTimeout!==0&&this.s.options.socketTimeoute.name===t));if(r>=0){const t=e.s.connectingServers[r];t.destroy({force:true});e.s.connectingServers.splice(r,1);return done()}var n=new d(Object.assign({},e.s.options,{host:t.split(":")[0],port:parseInt(t.split(":")[1],10),reconnect:false,monitoring:false,parent:e}));n.once("connect",_handleEvent(e,"connect"));n.once("close",_handleEvent(e,"close"));n.once("timeout",_handleEvent(e,"timeout"));n.once("error",_handleEvent(e,"error"));n.once("parseError",_handleEvent(e,"parseError"));n.on("serverOpening",(t=>e.emit("serverOpening",t)));n.on("serverDescriptionChanged",(t=>e.emit("serverDescriptionChanged",t)));n.on("serverClosed",(t=>e.emit("serverClosed",t)));v(n,e,["commandStarted","commandSucceeded","commandFailed"]);e.s.connectingServers.push(n);n.connect(e.s.connectOptions)}),r)}for(var i=0;ie.emit("serverOpening",t)));t.on("serverDescriptionChanged",(t=>e.emit("serverDescriptionChanged",t)));t.on("serverClosed",(t=>e.emit("serverClosed",t)));v(t,e,["commandStarted","commandSucceeded","commandFailed"]);t.connect(e.s.connectOptions)}),r)}while(t.length>0){connect(t.shift(),r++)}}function emitSDAMEvent(e,t,r){if(e.listeners(t).length>0){e.emit(t,r)}}ReplSet.prototype.connect=function(e){var t=this;this.s.connectOptions=e||{};stateTransition(this,T);var r=this.s.seedlist.map((function(r){return new d(Object.assign({},t.s.options,r,e,{reconnect:false,monitoring:false,parent:t}))}));if(this.s.options.socketTimeout>0&&this.s.options.socketTimeout<=this.s.options.haInterval){return t.emit("error",new u(o("haInterval [%s] MS must be set to less than socketTimeout [%s] MS",this.s.options.haInterval,this.s.options.socketTimeout)))}emitSDAMEvent(this,"topologyOpening",{topologyId:this.id});connectServers(t,r)};ReplSet.prototype.auth=function(e,t){if(typeof t==="function")t(null,null)};ReplSet.prototype.destroy=function(e,t){if(typeof e==="function"){t=e;e={}}e=e||{};let r=this.s.connectingServers.length+1;const serverDestroyed=()=>{r--;if(r>0){return}emitSDAMEvent(this,"topologyClosed",{topologyId:this.id});if(typeof t==="function"){t(null,null)}};if(this.state===A){if(typeof t==="function")t(null,null);return}stateTransition(this,A);if(this.haTimeoutId)clearTimeout(this.haTimeoutId);for(var n=0;n{if(O(i)>=M){if(o!=null){r(o,null)}else{r(new u("Server selection timed out"))}return}const e=this.s.replicaSetState.pickServer(n);if(e==null){setTimeout(_selectServer,D);return}if(!(e instanceof d)){o=e;setTimeout(_selectServer,D);return}if(this.s.debug)this.emit("pickedServer",t.readPreference,e);r(null,e)};_selectServer()};ReplSet.prototype.getServers=function(){return this.s.replicaSetState.allServers()};function executeWriteOperation(e,t,r){if(typeof t==="function")r=t,t={};t=t||{};const n=e.self;const i=e.op;const s=e.ns;const a=e.ops;if(n.state===A){return r(new u(o("topology was destroyed")))}const c=!e.retrying&&!!t.retryWrites&&t.session&&y(n)&&!t.session.inTransaction()&&t.explain===undefined;if(!n.s.replicaSetState.hasPrimary()){if(n.s.disconnectHandler){return n.s.disconnectHandler.add(i,s,a,t,r)}else if(!c){return r(new u("no primary server found"))}}const handler=(o,i)=>{if(!o)return r(null,i);if(!E(o,n)){o=S(o);return r(o)}if(c){const n=Object.assign({},e,{retrying:true});return executeWriteOperation(n,t,r)}if(n.s.replicaSetState.primary){n.s.replicaSetState.primary.destroy();n.s.replicaSetState.remove(n.s.replicaSetState.primary,{force:true})}return r(o)};if(r.operationId){handler.operationId=r.operationId}if(c){t.session.incrementTransactionNumber();t.willRetryWrite=c}n.s.replicaSetState.primary[i](s,a,t,handler)}ReplSet.prototype.insert=function(e,t,r,n){executeWriteOperation({self:this,op:"insert",ns:e,ops:t},r,n)};ReplSet.prototype.update=function(e,t,r,n){executeWriteOperation({self:this,op:"update",ns:e,ops:t},r,n)};ReplSet.prototype.remove=function(e,t,r,n){executeWriteOperation({self:this,op:"remove",ns:e,ops:t},r,n)};const P=["findAndModify","insert","update","delete"];function isWriteCommand(e){return P.some((t=>e[t]))}ReplSet.prototype.command=function(e,t,r,n){if(typeof r==="function"){n=r,r={},r=r||{}}if(this.state===A)return n(new u(o("topology was destroyed")));var i=this;var a=r.readPreference?r.readPreference:s.primary;if(a.preference==="primary"&&!this.s.replicaSetState.hasPrimary()&&this.s.disconnectHandler!=null){return this.s.disconnectHandler.add("command",e,t,r,n)}else if(a.preference==="secondary"&&!this.s.replicaSetState.hasSecondary()&&this.s.disconnectHandler!=null){return this.s.disconnectHandler.add("command",e,t,r,n)}else if(a.preference!=="primary"&&!this.s.replicaSetState.hasSecondary()&&!this.s.replicaSetState.hasPrimary()&&this.s.disconnectHandler!=null){return this.s.disconnectHandler.add("command",e,t,r,n)}var c=this.s.replicaSetState.pickServer(a);if(!(c instanceof d))return n(c);if(i.s.debug)i.emit("pickedServer",s.primary,c);if(c==null){return n(new u(o("no server found that matches the provided readPreference %s",a)))}const l=!r.retrying&&!!r.retryWrites&&r.session&&y(i)&&!r.session.inTransaction()&&isWriteCommand(t);const cb=(o,s)=>{if(!o)return n(null,s);if(!E(o,i)){return n(o)}if(l){const o=Object.assign({},r,{retrying:true});return this.command(e,t,o,n)}if(this.s.replicaSetState.primary){this.s.replicaSetState.primary.destroy();this.s.replicaSetState.remove(this.s.replicaSetState.primary,{force:true})}return n(o)};if(l){r.session.incrementTransactionNumber();r.willRetryWrite=l}c.command(e,t,r,cb)};ReplSet.prototype.cursor=function(e,t,r){r=r||{};const n=r.topology||this;var o=r.cursorFactory||this.s.Cursor;return new o(n,e,t,r)};e.exports=ReplSet},8742:(e,t,r)=>{"use strict";var n=r(1669).inherits,o=r(1669).format,i=r(2306).diff,s=r(8614).EventEmitter,a=r(104),c=r(4485),l=r(3111).MongoError,u=r(1867).Buffer;var d={Single:"Single",ReplicaSetNoPrimary:"ReplicaSetNoPrimary",ReplicaSetWithPrimary:"ReplicaSetWithPrimary",Sharded:"Sharded",Unknown:"Unknown"};var p={Standalone:"Standalone",Mongos:"Mongos",PossiblePrimary:"PossiblePrimary",RSPrimary:"RSPrimary",RSSecondary:"RSSecondary",RSArbiter:"RSArbiter",RSOther:"RSOther",RSGhost:"RSGhost",Unknown:"Unknown"};var ReplSetState=function(e){e=e||{};s.call(this);this.topologyType=d.ReplicaSetNoPrimary;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=undefined};n(ReplSetState,s);ReplSetState.prototype.hasPrimaryAndSecondary=function(){return this.primary!=null&&this.secondaries.length>0};ReplSetState.prototype.hasPrimaryOrSecondary=function(){return this.hasPrimary()||this.hasSecondary()};ReplSetState.prototype.hasPrimary=function(){return this.primary!=null};ReplSetState.prototype.hasSecondary=function(){return this.secondaries.length>0};ReplSetState.prototype.get=function(e){var t=this.allServers();for(var r=0;r{n--;if(n>0){return}this.secondaries=[];this.arbiters=[];this.passives=[];this.ghosts=[];this.unknownServers=[];this.set={};this.primary=null;emitTopologyDescriptionChanged(this);if(typeof t==="function"){t(null,null)}};if(n===0){serverDestroyed();return}r.forEach((t=>t.destroy(e,serverDestroyed)))};ReplSetState.prototype.remove=function(e,t){t=t||{};var r=e.name.toLowerCase();var n=this.primary?[this.primary]:[];n=n.concat(this.secondaries);n=n.concat(this.arbiters);n=n.concat(this.passives);for(var o=0;oe.arbiterOnly&&e.setName;ReplSetState.prototype.update=function(e){var t=this;var r=e.lastIsMaster();var n=e.name.toLowerCase();if(r){var i=Array.isArray(r.hosts)?r.hosts:[];i=i.concat(Array.isArray(r.arbiters)?r.arbiters:[]);i=i.concat(Array.isArray(r.passives)?r.passives:[]);i=i.map((function(e){return e.toLowerCase()}));for(var s=0;su){return false}}else if(!g&&a&&u){if(u=5&&e.ismaster.secondary&&this.hasPrimary()){e.staleness=e.lastUpdateTime-e.lastWriteDate-(this.primary.lastUpdateTime-this.primary.lastWriteDate)+t}else if(e.ismaster.maxWireVersion>=5&&e.ismaster.secondary){e.staleness=r-e.lastWriteDate+t}};ReplSetState.prototype.updateSecondariesMaxStaleness=function(e){for(var t=0;t0&&e.maxStalenessSeconds==null){var o=pickNearest(this,e);if(o){return o}}else if(n.length>0&&e.maxStalenessSeconds!=null){o=pickNearestMaxStalenessSeconds(this,e);if(o){return o}}if(e.equals(c.secondaryPreferred)){return this.primary}return null}if(e.equals(c.primaryPreferred)){o=null;if(this.primary){return this.primary}if(n.length>0&&e.maxStalenessSeconds==null){o=pickNearest(this,e)}else if(n.length>0&&e.maxStalenessSeconds!=null){o=pickNearestMaxStalenessSeconds(this,e)}if(o)return o}return this.primary};var filterByTags=function(e,t){if(e.tags==null)return t;var r=[];var n=Array.isArray(e.tags)?e.tags:[e.tags];for(var o=0;o0?r[0].lastIsMasterMS:0;r=r.filter((function(t){return t.lastIsMasterMS<=o+e.acceptableLatency}));if(r.length===0){return null}e.index=e.index%r.length;var i=r[e.index];e.index=e.index+1;return i}function inList(e,t,r){for(var n=0;n0){var t="Unknown";var r=e.setName;if(e.hasPrimaryAndSecondary()){t="ReplicaSetWithPrimary"}else if(!e.hasPrimary()&&e.hasSecondary()){t="ReplicaSetNoPrimary"}var n={topologyType:t,setName:r,servers:[]};if(e.hasPrimary()){var o=e.primary.getDescription();o.type="RSPrimary";n.servers.push(o)}n.servers=n.servers.concat(e.secondaries.map((function(e){var t=e.getDescription();t.type="RSSecondary";return t})));n.servers=n.servers.concat(e.arbiters.map((function(e){var t=e.getDescription();t.type="RSArbiter";return t})));n.servers=n.servers.concat(e.passives.map((function(e){var t=e.getDescription();t.type="RSSecondary";return t})));var s=i(e.replicasetDescription,n);var a={topologyId:e.id,previousDescription:e.replicasetDescription,newDescription:n,diff:s};e.emit("topologyDescriptionChanged",a);e.replicasetDescription=n}}e.exports=ReplSetState},6495:(e,t,r)=>{"use strict";var n=r(1669).inherits,o=r(1669).format,i=r(8614).EventEmitter,s=r(4485),a=r(104),c=r(7746).debugOptions,l=r(7746).retrieveBSON,u=r(5500),d=r(3111).MongoError,p=r(3111).MongoNetworkError,h=r(9206),m=r(4847).CoreCursor,g=r(2306),y=r(2306).createCompressionInfo,v=r(2306).resolveClusterTime,b=r(2306).SessionMixins,S=r(1178).relayEvents;const w=r(1178).collationNotSupported;const E=r(1178).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"];var O=0;var C=false;var T={};var I=l();function topologyId(e){return e.s.parent==null?e.id:e.s.parent.id}var Server=function(e){e=e||{};i.call(this);this.id=O++;this.s={options:Object.assign({metadata:E(e)},e),logger:a("Server",e),Cursor:e.cursorFactory||m,bson:e.bson||new I([I.Binary,I.Code,I.DBRef,I.Decimal128,I.Double,I.Int32,I.Long,I.Map,I.MaxKey,I.MinKey,I.ObjectId,I.BSONRegExp,I.Symbol,I.Timestamp]),pool:null,disconnectHandler:e.disconnectHandler,monitoring:typeof e.monitoring==="boolean"?e.monitoring:true,inTopology:!!e.parent,monitoringInterval:typeof e.monitoringInterval==="number"?e.monitoringInterval:5e3,compression:{compressors:y(e)},parent:e.parent};if(!this.s.parent){this.s.clusterTime=null}this.ismaster=null;this.lastIsMasterMS=-1;this.monitoringProcessId=null;this.initialConnect=true;this._type="server";this.lastUpdateTime=0;this.lastWriteDate=0;this.staleness=0};n(Server,i);Object.assign(Server.prototype,b);Object.defineProperty(Server.prototype,"type",{enumerable:true,get:function(){return this._type}});Object.defineProperty(Server.prototype,"parserType",{enumerable:true,get:function(){return I.native?"c++":"js"}});Object.defineProperty(Server.prototype,"logicalSessionTimeoutMinutes",{enumerable:true,get:function(){if(!this.ismaster)return null;return this.ismaster.logicalSessionTimeoutMinutes||null}});Object.defineProperty(Server.prototype,"clientMetadata",{enumerable:true,get:function(){return this.s.options.metadata}});Object.defineProperty(Server.prototype,"clusterTime",{enumerable:true,set:function(e){const t=this.s.parent?this.s.parent:this.s;v(t,e)},get:function(){const e=this.s.parent?this.s.parent:this.s;return e.clusterTime||null}});Server.enableServerAccounting=function(){C=true;T={}};Server.disableServerAccounting=function(){C=false};Server.servers=function(){return T};Object.defineProperty(Server.prototype,"name",{enumerable:true,get:function(){return this.s.options.host+":"+this.s.options.port}});function disconnectHandler(e,t,r,n,i,s){if(!e.s.pool.isConnected()&&e.s.options.reconnect&&e.s.disconnectHandler!=null&&!i.monitoring){e.s.disconnectHandler.add(t,r,n,i,s);return true}if(!e.s.pool.isConnected()){s(new d(o("no connection available to server %s",e.name)));return true}}function monitoringProcess(e){return function(){if(e.s.pool.isDestroyed())return;e.emit("monitoring",e);var t=(new Date).getTime();e.command("admin.$cmd",{ismaster:true},{socketTimeout:typeof e.s.options.connectionTimeout!=="number"?2e3:e.s.options.connectionTimeout,monitoring:true},((r,n)=>{e.lastIsMasterMS=(new Date).getTime()-t;if(e.s.pool.isDestroyed())return;if(n){e.ismaster=n.result}e.monitoringProcessId=setTimeout(monitoringProcess(e),e.s.monitoringInterval)}))}}var eventHandler=function(e,t){return function(r,n){if(e.s.logger.isInfo()){var i=r instanceof d?JSON.stringify(r):{};e.s.logger.info(o("server %s fired event %s out with message %s",e.name,t,i))}if(t==="connect"){e.initialConnect=false;e.ismaster=n.ismaster;e.lastIsMasterMS=n.lastIsMasterMS;if(n.agreedCompressor){e.s.pool.options.agreedCompressor=n.agreedCompressor}if(n.zlibCompressionLevel){e.s.pool.options.zlibCompressionLevel=n.zlibCompressionLevel}if(n.ismaster.$clusterTime){const t=n.ismaster.$clusterTime;e.clusterTime=t}if(e.ismaster.msg==="isdbgrid"){e._type="mongos"}if(e.s.monitoring){e.monitoringProcessId=setTimeout(monitoringProcess(e),e.s.monitoringInterval)}g.emitServerDescriptionChanged(e,{address:e.name,arbiters:[],hosts:[],passives:[],type:g.getTopologyType(e)});if(!e.s.inTopology){g.emitTopologyDescriptionChanged(e,{topologyType:"Single",servers:[{address:e.name,arbiters:[],hosts:[],passives:[],type:g.getTopologyType(e)}]})}if(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(t==="error"||t==="parseError"||t==="close"||t==="timeout"||t==="reconnect"||t==="attemptReconnect"||t==="reconnectFailed"){if(C&&["close","timeout","error","parseError","reconnectFailed"].indexOf(t)!==-1){if(!e.s.inTopology){e.emit("topologyOpening",{topologyId:e.id})}delete T[e.id]}if(t==="close"){g.emitServerDescriptionChanged(e,{address:e.name,arbiters:[],hosts:[],passives:[],type:"Unknown"})}if(t==="reconnectFailed"){e.emit("reconnectFailed",r);if(e.listeners("error").length>0){e.emit("error",r)}return}if(["disconnected","connecting"].indexOf(e.s.pool.state)!==-1&&e.initialConnect&&["close","timeout","error","parseError"].indexOf(t)!==-1){e.initialConnect=false;return e.emit("error",new p(o("failed to connect to server [%s] on first connect [%s]",e.name,r)))}if(t==="reconnect"){g.emitServerDescriptionChanged(e,{address:e.name,arbiters:[],hosts:[],passives:[],type:g.getTopologyType(e)});return e.emit(t,e)}e.emit(t,r)}}};Server.prototype.connect=function(e){var t=this;e=e||{};if(C)T[this.id]=this;if(t.s.pool&&!t.s.pool.isDisconnected()&&!t.s.pool.isDestroyed()){throw new d(o("server instance in invalid state %s",t.s.pool.state))}t.s.pool=new u(this,Object.assign(t.s.options,e,{bson:this.s.bson}));t.s.pool.on("close",eventHandler(t,"close"));t.s.pool.on("error",eventHandler(t,"error"));t.s.pool.on("timeout",eventHandler(t,"timeout"));t.s.pool.on("parseError",eventHandler(t,"parseError"));t.s.pool.on("connect",eventHandler(t,"connect"));t.s.pool.on("reconnect",eventHandler(t,"reconnect"));t.s.pool.on("reconnectFailed",eventHandler(t,"reconnectFailed"));S(t.s.pool,t,["commandStarted","commandSucceeded","commandFailed"]);if(!t.s.inTopology){this.emit("topologyOpening",{topologyId:topologyId(t)})}t.emit("serverOpening",{topologyId:topologyId(t),address:t.name});t.s.pool.connect()};Server.prototype.auth=function(e,t){if(typeof t==="function")t(null,null)};Server.prototype.getDescription=function(){var e=this.ismaster||{};var t={type:g.getTopologyType(this),address:this.name};if(e.hosts)t.hosts=e.hosts;if(e.arbiters)t.arbiters=e.arbiters;if(e.passives)t.passives=e.passives;if(e.setName)t.setName=e.setName;return t};Server.prototype.lastIsMaster=function(){return this.ismaster};Server.prototype.unref=function(){this.s.pool.unref()};Server.prototype.isConnected=function(){if(!this.s.pool)return false;return this.s.pool.isConnected()};Server.prototype.isDestroyed=function(){if(!this.s.pool)return false;return this.s.pool.isDestroyed()};function basicWriteValidations(e){if(!e.s.pool)return new d("server instance is not connected");if(e.s.pool.isDestroyed())return new d("server instance pool was destroyed")}function basicReadValidations(e,t){basicWriteValidations(e,t);if(t.readPreference&&!(t.readPreference instanceof s)){throw new Error("readPreference must be an instance of ReadPreference")}}Server.prototype.command=function(e,t,r,n){var i=this;if(typeof r==="function"){n=r,r={},r=r||{}}var s=basicReadValidations(i,r);if(s)return n(s);r=Object.assign({},r,{wireProtocolCommand:false});if(i.s.logger.isDebug())i.s.logger.debug(o("executing command [%s] against %s",JSON.stringify({ns:e,cmd:t,options:c(_,r)}),i.name));if(disconnectHandler(i,"command",e,t,r,n))return;if(w(this,t)){return n(new d(`server ${this.name} does not support collation`))}h.command(i,e,t,r,n)};Server.prototype.query=function(e,t,r,n,o){h.query(this,e,t,r,n,o)};Server.prototype.getMore=function(e,t,r,n,o){h.getMore(this,e,t,r,n,o)};Server.prototype.killCursors=function(e,t,r){h.killCursors(this,e,t,r)};Server.prototype.insert=function(e,t,r,n){var o=this;if(typeof r==="function"){n=r,r={},r=r||{}}var i=basicWriteValidations(o,r);if(i)return n(i);if(disconnectHandler(o,"insert",e,t,r,n))return;t=Array.isArray(t)?t:[t];return h.insert(o,e,t,r,n)};Server.prototype.update=function(e,t,r,n){var o=this;if(typeof r==="function"){n=r,r={},r=r||{}}var i=basicWriteValidations(o,r);if(i)return n(i);if(disconnectHandler(o,"update",e,t,r,n))return;if(w(this,r)){return n(new d(`server ${this.name} does not support collation`))}t=Array.isArray(t)?t:[t];return h.update(o,e,t,r,n)};Server.prototype.remove=function(e,t,r,n){var o=this;if(typeof r==="function"){n=r,r={},r=r||{}}var i=basicWriteValidations(o,r);if(i)return n(i);if(disconnectHandler(o,"remove",e,t,r,n))return;if(w(this,r)){return n(new d(`server ${this.name} does not support collation`))}t=Array.isArray(t)?t:[t];return h.remove(o,e,t,r,n)};Server.prototype.cursor=function(e,t,r){r=r||{};const n=r.topology||this;var o=r.cursorFactory||this.s.Cursor;return new o(n,e,t,r)};Server.prototype.equals=function(e){if(typeof e==="string")return this.name.toLowerCase()===e.toLowerCase();if(e.name)return this.name.toLowerCase()===e.name.toLowerCase();return false};Server.prototype.connections=function(){return this.s.pool.allConnections()};Server.prototype.selectServer=function(e,t,r){if(typeof e==="function"&&typeof r==="undefined")r=e,e=undefined,t={};if(typeof t==="function")r=t,t=e,e=undefined;r(null,this)};var k=["close","error","timeout","parseError","connect"];Server.prototype.destroy=function(e,t){if(this._destroyed){if(typeof t==="function")t(null,null);return}if(typeof e==="function"){t=e;e={}}e=e||{};var r=this;if(C)delete T[this.id];if(this.monitoringProcessId){clearTimeout(this.monitoringProcessId)}if(!r.s.pool||this._destroyed){this._destroyed=true;if(typeof t==="function")t(null,null);return}this._destroyed=true;if(e.emitClose){r.emit("close",r)}if(e.emitDestroy){r.emit("destroy",r)}k.forEach((function(e){r.s.pool.removeAllListeners(e)}));if(r.listeners("serverClosed").length>0)r.emit("serverClosed",{topologyId:topologyId(r),address:r.name});if(r.listeners("topologyClosed").length>0&&!r.s.inTopology){r.emit("topologyClosed",{topologyId:topologyId(r)})}if(r.s.logger.isDebug()){r.s.logger.debug(o("destroy called on server %s",r.name))}this.s.pool.destroy(e.force,t)};e.exports=Server},2306:(e,t,r)=>{"use strict";const n=r(4485);const o=r(2291).TopologyType;const i=r(3111).MongoError;const s=r(3111).isRetryableWriteError;const a=r(1178).maxWireVersion;const c=r(3111).MongoNetworkError;const l=20;function emitSDAMEvent(e,t,r){if(e.listeners(t).length>0){e.emit(t,r)}}function createCompressionInfo(e){if(!e.compression||!e.compression.compressors){return[]}e.compression.compressors.forEach((function(e){if(e!=="snappy"&&e!=="zlib"){throw new Error("compressors must be at least one of snappy or zlib")}}));return e.compression.compressors}function clone(e){return JSON.parse(JSON.stringify(e))}var getPreviousDescription=function(e){if(!e.s.serverDescription){e.s.serverDescription={address:e.name,arbiters:[],hosts:[],passives:[],type:"Unknown"}}return e.s.serverDescription};var emitServerDescriptionChanged=function(e,t){if(e.listeners("serverDescriptionChanged").length>0){e.emit("serverDescriptionChanged",{topologyId:e.s.topologyId!==-1?e.s.topologyId:e.id,address:e.name,previousDescription:getPreviousDescription(e),newDescription:t});e.s.serverDescription=t}};var getPreviousTopologyDescription=function(e){if(!e.s.topologyDescription){e.s.topologyDescription={topologyType:"Unknown",servers:[{address:e.name,arbiters:[],hosts:[],passives:[],type:"Unknown"}]}}return e.s.topologyDescription};var emitTopologyDescriptionChanged=function(e,t){if(e.listeners("topologyDescriptionChanged").length>0){e.emit("topologyDescriptionChanged",{topologyId:e.s.topologyId!==-1?e.s.topologyId:e.id,address:e.name,previousDescription:getPreviousTopologyDescription(e),newDescription:t});e.s.serverDescription=t}};var changedIsMaster=function(e,t,r){var n=getTopologyType(e,t);var o=getTopologyType(e,r);if(o!==n)return true;return false};var getTopologyType=function(e,t){if(!t){t=e.ismaster}if(!t)return"Unknown";if(t.ismaster&&t.msg==="isdbgrid")return"Mongos";if(t.ismaster&&!t.hosts)return"Standalone";if(t.ismaster)return"RSPrimary";if(t.secondary)return"RSSecondary";if(t.arbiterOnly)return"RSArbiter";return"Unknown"};var inquireServerState=function(e){return function(t){if(e.s.state==="destroyed")return;var r=(new Date).getTime();emitSDAMEvent(e,"serverHeartbeatStarted",{connectionId:e.name});e.command("admin.$cmd",{ismaster:true},{monitoring:true},(function(n,o){if(!n){e.emit("ismaster",o,e);var i=(new Date).getTime()-r;emitSDAMEvent(e,"serverHeartbeatSucceeded",{durationMS:i,reply:o.result,connectionId:e.name});if(changedIsMaster(e,e.s.ismaster,o.result)){emitServerDescriptionChanged(e,{address:e.name,arbiters:[],hosts:[],passives:[],type:!e.s.inTopology?"Standalone":getTopologyType(e)})}e.s.ismaster=o.result;e.s.isMasterLatencyMS=i}else{emitSDAMEvent(e,"serverHeartbeatFailed",{durationMS:i,failure:n,connectionId:e.name})}if(typeof t==="function"){return t(n,o)}e.s.inquireServerStateTimeout=setTimeout(inquireServerState(e),e.s.haInterval)}))}};var cloneOptions=function(e){var t={};for(var r in e){t[r]=e[r]}return t};function Interval(e,t){var r=false;this.start=function(){if(!this.isRunning()){r=setInterval(e,t)}return this};this.stop=function(){clearInterval(r);r=false;return this};this.isRunning=function(){return r!==false}}function Timeout(e,t){var r=false;var func=()=>{if(r){clearTimeout(r);r=false;e()}};this.start=function(){if(!this.isRunning()){r=setTimeout(func,t)}return this};this.stop=function(){clearTimeout(r);r=false;return this};this.isRunning=function(){return r!==false}}function diff(e,t){var r={servers:[]};if(!e){e={servers:[]}}for(var n=0;n{if(typeof t==="function")t()}))}};function topologyType(e){if(e.description){return e.description.type}if(e.type==="mongos"){return o.Sharded}else if(e.type==="replset"){return o.ReplicaSetWithPrimary}return o.Single}const d=6;const isRetryableWritesSupported=function(e){const t=e.lastIsMaster().maxWireVersion;if(t{"use strict";const n=r(3111).MongoError;const o=r(4485);const i=r(7289);const s=r(2481);let a;let c;(()=>{const e="NO_TRANSACTION";const t="STARTING_TRANSACTION";const r="TRANSACTION_IN_PROGRESS";const n="TRANSACTION_COMMITTED";const o="TRANSACTION_COMMITTED_EMPTY";const i="TRANSACTION_ABORTED";a={NO_TRANSACTION:e,STARTING_TRANSACTION:t,TRANSACTION_IN_PROGRESS:r,TRANSACTION_COMMITTED:n,TRANSACTION_COMMITTED_EMPTY:o,TRANSACTION_ABORTED:i};c={[e]:[e,t],[t]:[r,n,o,i],[r]:[r,n,i],[n]:[n,o,t,e],[i]:[t,e],[o]:[o,e]}})();class Transaction{constructor(e){e=e||{};this.state=a.NO_TRANSACTION;this.options={};const t=s.fromOptions(e);if(t){if(t.w<=0){throw new n("Transactions do not support unacknowledged write concern")}this.options.writeConcern=t}if(e.readConcern){this.options.readConcern=i.fromOptions(e)}if(e.readPreference){this.options.readPreference=o.fromOptions(e)}if(e.maxCommitTimeMS){this.options.maxTimeMS=e.maxCommitTimeMS}this._pinnedServer=undefined;this._recoveryToken=undefined}get server(){return this._pinnedServer}get recoveryToken(){return this._recoveryToken}get isPinned(){return!!this.server}get isActive(){return[a.STARTING_TRANSACTION,a.TRANSACTION_IN_PROGRESS].indexOf(this.state)!==-1}transition(e){const t=c[this.state];if(t&&t.indexOf(e)!==-1){this.state=e;if(this.state===a.NO_TRANSACTION||this.state===a.STARTING_TRANSACTION){this.unpinServer()}return}throw new n(`Attempted illegal state transition from [${this.state}] to [${e}]`)}pinServer(e){if(this.isActive){this._pinnedServer=e}}unpinServer(){this._pinnedServer=undefined}}function isTransactionCommand(e){return!!(e.commitTransaction||e.abortTransaction)}e.exports={TxnState:a,Transaction:Transaction,isTransactionCommand:isTransactionCommand}},8767:(e,t,r)=>{"use strict";const n=r(8835);const o=r(1191);const i=r(881);const s=r(3111).MongoParseError;const a=r(4485);const c=r(1371).emitWarningOnce;const l=/(mongodb(?:\+srv|)):\/\/(?: (?:[^:]*) (?: : ([^@]*) )? @ )?([^/?]*)(?:\/|)(.*)/;const u=new Set(["sslCA","sslCert","sslKey","tlsCAFile","tlsCertificateKeyFile"].map((e=>e.toLowerCase())));function matchesParentDomain(e,t){const r=/^.*?\./;const n=`.${e.replace(r,"")}`;const o=`.${t.replace(r,"")}`;return n.endsWith(o)}function parseSrvConnectionString(e,t,r){const a=n.parse(e,true);if(t.directConnection||t.directconnection){return r(new s("directConnection not supported with SRV URI"))}if(a.hostname.split(".").length<3){return r(new s("URI does not have hostname, domain name and tld"))}a.domainLength=a.hostname.split(".").length;const c=e.substring("mongodb+srv://".length).split("/")[0];if(c.match(",")){return r(new s("Invalid URI, cannot contain multiple hostnames"))}if(a.port){return r(new s(`Ports not accepted with '${v}' URIs`))}const l=a.host;i.resolveSrv(`_mongodb._tcp.${l}`,((e,c)=>{if(e)return r(e);if(c.length===0){return r(new s("No addresses found at host"))}for(let e=0;e`${e.name}:${e.port}`)).join(",");if(!("ssl"in t)&&(!a.search||!("ssl"in a.query)||a.query.ssl===null)){a.query.ssl=true}i.resolveTxt(l,((e,i)=>{if(e){if(e.code!=="ENODATA"&&e.code!=="ENOTFOUND"){return r(e)}i=null}if(i){if(i.length>1){return r(new s("Multiple text records not allowed"))}i=o.parse(i[0].join(""));if(Object.keys(i).some((e=>e!=="authSource"&&e!=="replicaSet"))){return r(new s("Text record must only set `authSource` or `replicaSet`"))}a.query=Object.assign({},i,a.query)}a.search=o.stringify(a.query);const c=n.format(a);parseConnectionString(c,t,((e,t)=>{if(e){r(e);return}r(null,Object.assign({},t,{srvHost:l}))}))}))}))}function parseQueryStringItemValue(e,t){if(Array.isArray(t)){t=t.filter(((e,r)=>t.indexOf(e)===r));if(t.length===1)t=t[0]}else if(t.indexOf(":")>0){t=t.split(",").reduce(((t,r)=>{const n=r.split(":");t[n[0]]=parseQueryStringItemValue(e,n[1]);return t}),{})}else if(t.indexOf(",")>0){t=t.split(",").map((t=>parseQueryStringItemValue(e,t)))}else if(t.toLowerCase()==="true"||t.toLowerCase()==="false"){t=t.toLowerCase()==="true"}else if(!Number.isNaN(t)&&!p.has(e)){const e=parseFloat(t);if(!Number.isNaN(e)){t=parseFloat(t)}}return t}const d=new Set(["slaveok","slave_ok","sslvalidate","fsync","safe","retrywrites","j"]);const p=new Set(["authsource","replicaset"]);const h=new Set(["GSSAPI","MONGODB-AWS","MONGODB-X509","MONGODB-CR","DEFAULT","SCRAM-SHA-1","SCRAM-SHA-256","PLAIN"]);const m={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 applyConnectionStringOption(e,t,r,n){if(t==="journal"){t="j"}else if(t==="wtimeoutms"){t="wtimeout"}if(d.has(t)){r=r==="true"||r===true}else if(t==="appname"){r=decodeURIComponent(r)}else if(t==="readconcernlevel"){e["readConcernLevel"]=r;t="readconcern";r={level:r}}if(t==="compressors"){r=Array.isArray(r)?r:[r];if(!r.every((e=>e==="snappy"||e==="zlib"))){throw new s("Value for `compressors` must be at least one of: `snappy`, `zlib`")}}if(t==="authmechanism"&&!h.has(r)){throw new s(`Value for authMechanism must be one of: ${Array.from(h).join(", ")}, found: ${r}`)}if(t==="readpreference"&&!a.isValid(r)){throw new s("Value for `readPreference` must be one of: `primary`, `primaryPreferred`, `secondary`, `secondaryPreferred`, `nearest`")}if(t==="zlibcompressionlevel"&&(r<-1||r>9)){throw new s("zlibCompressionLevel must be an integer between -1 and 9")}if(t==="compressors"||t==="zlibcompressionlevel"){e.compression=e.compression||{};e=e.compression}if(t==="authmechanismproperties"){if(typeof r.SERVICE_NAME==="string")e.gssapiServiceName=r.SERVICE_NAME;if(typeof r.SERVICE_REALM==="string")e.gssapiServiceRealm=r.SERVICE_REALM;if(typeof r.CANONICALIZE_HOST_NAME!=="undefined"){e.gssapiCanonicalizeHostName=r.CANONICALIZE_HOST_NAME}}if(t==="readpreferencetags"){r=Array.isArray(r)?splitArrayOfMultipleReadPreferenceTags(r):[r]}if(n.caseTranslate&&m[t]){e[m[t]]=r;return}e[t]=r}const g=new Set(["GSSAPI","MONGODB-CR","PLAIN","SCRAM-SHA-1","SCRAM-SHA-256"]);function splitArrayOfMultipleReadPreferenceTags(e){const t=[];for(let r=0;r{const n=e.split(":");t[r][n[0]]=n[1]}))}return t}function applyAuthExpectations(e){if(e.options==null){return}const t=e.options;const r=t.authsource||t.authSource;if(r!=null){e.auth=Object.assign({},e.auth,{db:r})}const n=t.authmechanism||t.authMechanism;if(n!=null){if(g.has(n)&&(!e.auth||e.auth.username==null)){throw new s(`Username required for mechanism \`${n}\``)}if(n==="GSSAPI"){if(r!=null&&r!=="$external"){throw new s(`Invalid source \`${r}\` for mechanism \`${n}\` specified.`)}e.auth=Object.assign({},e.auth,{db:"$external"})}if(n==="MONGODB-AWS"){if(r!=null&&r!=="$external"){throw new s(`Invalid source \`${r}\` for mechanism \`${n}\` specified.`)}e.auth=Object.assign({},e.auth,{db:"$external"})}if(n==="MONGODB-X509"){if(e.auth&&e.auth.password!=null){throw new s(`Password not allowed for mechanism \`${n}\``)}if(r!=null&&r!=="$external"){throw new s(`Invalid source \`${r}\` for mechanism \`${n}\` specified.`)}e.auth=Object.assign({},e.auth,{db:"$external"})}if(n==="PLAIN"){if(e.auth&&e.auth.db==null){e.auth=Object.assign({},e.auth,{db:"$external"})}}}if(e.auth&&e.auth.db==null){e.auth=Object.assign({},e.auth,{db:"admin"})}return e}function parseQueryString(e,t){const r={};let n=o.parse(e);checkTLSOptions(n);for(const e in n){const o=n[e];if(o===""||o==null){throw new s("Incomplete key value pair for option")}const i=e.toLowerCase();const a=u.has(i)?o:parseQueryStringItemValue(i,o);applyConnectionStringOption(r,i,a,t)}if(r.wtimeout&&r.wtimeoutms){delete r.wtimeout;c("Unsupported option `wtimeout` specified")}return Object.keys(r).length?r:null}function translateTLSOptions(e){if(e.tls){e.ssl=e.tls}if(e.tlsInsecure){e.checkServerIdentity=false;e.sslValidate=false}else{Object.assign(e,{checkServerIdentity:e.tlsAllowInvalidHostnames?false:true,sslValidate:e.tlsAllowInvalidCertificates?false:true})}if(e.tlsCAFile){e.ssl=true;e.sslCA=e.tlsCAFile}if(e.tlsCertificateKeyFile){e.ssl=true;if(e.tlsCertificateFile){e.sslCert=e.tlsCertificateFile;e.sslKey=e.tlsCertificateKeyFile}else{e.sslKey=e.tlsCertificateKeyFile;e.sslCert=e.tlsCertificateKeyFile}}if(e.tlsCertificateKeyFilePassword){e.ssl=true;e.sslPass=e.tlsCertificateKeyFilePassword}return e}function checkTLSOptions(e){const t=Object.keys(e);if(t.indexOf("tlsInsecure")!==-1&&(t.indexOf("tlsAllowInvalidCertificates")!==-1||t.indexOf("tlsAllowInvalidHostnames")!==-1)){throw new s("The `tlsInsecure` option cannot be used with `tlsAllowInvalidCertificates` or `tlsAllowInvalidHostnames`.")}const r=assertTlsOptionsAreEqual("tls",e,t);const n=assertTlsOptionsAreEqual("ssl",e,t);if(r!=null&&n!=null){if(r!==n){throw new s("All values of `tls` and `ssl` must be the same.")}}}function assertTlsOptionsAreEqual(e,t,r){const n=r.indexOf(e)!==-1;let o;if(Array.isArray(t[e])){o=t[e][0]}else{o=t[e]}if(n){if(Array.isArray(t[e])){const r=t[e][0];t[e].forEach((t=>{if(t!==r){throw new s(`All values of ${e} must be the same.`)}}))}}return o}const y="mongodb";const v="mongodb+srv";const b=[y,v];function parseConnectionString(e,t,r){if(typeof t==="function")r=t,t={};t=Object.assign({},{caseTranslate:true},t);try{n.parse(e)}catch(e){return r(new s("URI malformed, cannot be parsed"))}const i=e.match(l);if(!i){return r(new s("Invalid connection string"))}const a=i[1];if(b.indexOf(a)===-1){return r(new s("Invalid protocol provided"))}const c=i[4].split("?");const u=c.length>0?c[0]:null;const d=c.length>1?c[1]:null;let p;try{p=parseQueryString(d,t)}catch(e){return r(e)}p=Object.assign({},p,t);if(a===v){return parseSrvConnectionString(e,p,r)}const h={username:null,password:null,db:u&&u!==""?o.unescape(u):null};if(p.auth){if(p.auth.username)h.username=p.auth.username;if(p.auth.user)h.username=p.auth.user;if(p.auth.password)h.password=p.auth.password}else{if(p.username)h.username=p.username;if(p.user)h.username=p.user;if(p.password)h.password=p.password}if(i[4].split("?")[0].indexOf("@")!==-1){return r(new s("Unescaped slash in userinfo section"))}const m=i[3].split("@");if(m.length>2){return r(new s("Unescaped at-sign in authority section"))}if(m[0]==null||m[0]===""){return r(new s("No username provided in authority section"))}if(m.length>1){const e=m.shift().split(":");if(e.length>2){return r(new s("Unescaped colon in authority section"))}if(e[0]===""){return r(new s("Invalid empty username provided"))}if(!h.username)h.username=o.unescape(e[0]);if(!h.password)h.password=e[1]?o.unescape(e[1]):null}let g=null;const y=m.shift().split(",").map((e=>{let t=n.parse(`mongodb://${e}`);if(t.path==="/:"){g=new s("Double colon in host identifier");return null}if(e.match(/\.sock/)){t.hostname=o.unescape(e);t.port=null}if(Number.isNaN(t.port)){g=new s("Invalid port (non-numeric string)");return}const r={host:t.hostname,port:t.port?parseInt(t.port):27017};if(r.port===0){g=new s("Invalid port (zero) with hostname");return}if(r.port>65535){g=new s("Invalid port (larger than 65535) with hostname");return}if(r.port<0){g=new s("Invalid port (negative number)");return}return r})).filter((e=>!!e));if(g){return r(g)}if(y.length===0||y[0].host===""||y[0].host===null){return r(new s("No hostname or hostnames provided in connection string"))}const S=!!p.directConnection;if(S&&y.length!==1){return r(new s("directConnection option requires exactly one host"))}if(p.directConnection==null&&y.length===1&&p.replicaSet==null){p.directConnection=true}const w={hosts:y,auth:h.db||h.username?h:null,options:Object.keys(p).length?p:null};if(w.auth&&w.auth.db){w.defaultDatabase=w.auth.db}else{w.defaultDatabase="test"}w.options=translateTLSOptions(w.options);try{applyAuthExpectations(w)}catch(e){return r(e)}r(null,w)}e.exports=parseConnectionString},1178:(e,t,r)=>{"use strict";const n=r(2087);const o=r(6417);const i=r(3182)(require);const uuidV4=()=>{const e=o.randomBytes(16);e[6]=e[6]&15|64;e[8]=e[8]&63|128;return e};function relayEvents(e,t,r){r.forEach((r=>e.on(r,(e=>t.emit(r,e)))))}function retrieveKerberos(){let e;try{e=i("kerberos")}catch(e){if(e.code==="MODULE_NOT_FOUND"){throw new Error("The `kerberos` module was not found. Please install it and try again.")}throw e}return e}const noEJSONError=function(){throw new Error("The `mongodb-extjson` module was not found. Please install it and try again.")};function retrieveEJSON(){let e=i("mongodb-extjson");if(!e){e={parse:noEJSONError,deserialize:noEJSONError,serialize:noEJSONError,stringify:noEJSONError,setBSONModule:noEJSONError,BSON:noEJSONError}}return e}function maxWireVersion(e){if(e){if(e.ismaster){return e.ismaster.maxWireVersion}if(typeof e.lastIsMaster==="function"){const t=e.lastIsMaster();if(t){return t.maxWireVersion}}if(e.description){return e.description.maxWireVersion}}return 0}function collationNotSupported(e,t){return t&&t.collation&&maxWireVersion(e)<5}function isPromiseLike(e){return e&&typeof e.then==="function"}function eachAsync(e,t,r){e=e||[];let n=0;let o=0;for(n=0;ne===t[r]))}function tagsStrictEqual(e,t){const r=Object.keys(e);const n=Object.keys(t);return r.length===n.length&&r.every((r=>t[r]===e[r]))}function errorStrictEqual(e,t){if(e===t){return true}if(e==null&&t!=null||e!=null&&t==null){return false}if(e.constructor.name!==t.constructor.name){return false}if(e.message!==t.message){return false}return true}function makeStateMachine(e){return function stateTransition(t,r){const n=e[t.s.state];if(n&&n.indexOf(r)<0){throw new TypeError(`illegal state transition from [${t.s.state}] => [${r}], allowed: [${n}]`)}t.emit("stateChanged",t.s.state,r);t.s.state=r}}function makeClientMetadata(e){e=e||{};const t={driver:{name:"nodejs",version:r(306).i8},os:{type:n.type(),name:process.platform,architecture:process.arch,version:n.release()},platform:`'Node.js ${process.version}, ${n.endianness} (${e.useUnifiedTopology?"unified":"legacy"})`};if(e.driverInfo){if(e.driverInfo.name){t.driver.name=`${t.driver.name}|${e.driverInfo.name}`}if(e.driverInfo.version){t.version=`${t.driver.version}|${e.driverInfo.version}`}if(e.driverInfo.platform){t.platform=`${t.platform}|${e.driverInfo.platform}`}}if(e.appname){const r=Buffer.from(e.appname);t.application={name:r.length>128?r.slice(0,128).toString("utf8"):e.appname}}return t}const noop=()=>{};e.exports={uuidV4:uuidV4,relayEvents:relayEvents,collationNotSupported:collationNotSupported,retrieveEJSON:retrieveEJSON,retrieveKerberos:retrieveKerberos,maxWireVersion:maxWireVersion,isPromiseLike:isPromiseLike,eachAsync:eachAsync,eachAsyncSeries:eachAsyncSeries,isUnifiedTopology:isUnifiedTopology,arrayStrictEqual:arrayStrictEqual,tagsStrictEqual:tagsStrictEqual,errorStrictEqual:errorStrictEqual,makeStateMachine:makeStateMachine,makeClientMetadata:makeClientMetadata,noop:noop}},7276:(e,t,r)=>{"use strict";const n=r(9814).Query;const o=r(8988).Msg;const i=r(3111).MongoError;const s=r(7272).getReadPreference;const a=r(7272).isSharded;const c=r(7272).databaseNamespace;const l=r(1707).isTransactionCommand;const u=r(5474).applySession;const d=r(3111).MongoNetworkError;const p=r(1178).maxWireVersion;function isClientEncryptionEnabled(e){const t=p(e);return t&&e.autoEncrypter}function command(e,t,r,n,o){if(typeof n==="function")o=n,n={};n=n||{};if(r==null){return o(new i(`command ${JSON.stringify(r)} does not return a cursor`))}if(!isClientEncryptionEnabled(e)){_command(e,t,r,n,o);return}const s=p(e);if(typeof s!=="number"||s<8){o(new i("Auto-encryption requires a minimum MongoDB version of 4.2"));return}_cryptCommand(e,t,r,n,o)}function _command(e,t,r,p,h){const m=e.s.bson;const g=e.s.pool;const y=s(r,p);const v=supportsOpMsg(e);const b=p.session;const S=e.clusterTime;let w=S;let E=Object.assign({},r);if(hasSessionSupport(e)&&b){const e=b.clusterTime;if(S&&S.clusterTime&&e&&e.clusterTime&&e.clusterTime.greaterThan(S.clusterTime)){w=e}const t=u(b,E,p);if(t){return h(t)}}if(w){E.$clusterTime=w}if(a(e)&&!v&&y&&y.mode!=="primary"){E={$query:E,$readPreference:y.toJSON()}}const _=Object.assign({command:true,numberToSkip:0,numberToReturn:-1,checkKeys:false},p);_.slaveOk=y.slaveOk();const O=`${c(t)}.$cmd`;const C=v?new o(m,O,E,_):new n(m,O,E,_);const T=b&&(b.inTransaction()||l(E));const I=T?function(e){if(e&&e instanceof d&&!e.hasErrorLabel("TransientTransactionError")){e.addErrorLabel("TransientTransactionError")}if(!r.commitTransaction&&e&&e instanceof i&&e.hasErrorLabel("TransientTransactionError")){b.transaction.unpinServer()}return h.apply(null,arguments)}:h;try{g.write(C,_,I)}catch(e){I(e)}}function hasSessionSupport(e){if(e==null)return false;if(e.description){return e.description.maxWireVersion>=6}return e.ismaster==null?false:e.ismaster.maxWireVersion>=6}function supportsOpMsg(e){const t=e.ismaster?e.ismaster:e.description;if(t==null){return false}return t.maxWireVersion>=6&&t.__nodejs_mock_server__==null}function _cryptCommand(e,t,r,n,o){const i=e.autoEncrypter;function commandResponseHandler(e,t){if(e||t==null){o(e,t);return}i.decrypt(t.result,n,((e,r)=>{if(e){o(e,null);return}t.result=r;t.message.documents=[r];o(null,t)}))}i.encrypt(t,r,n,((r,i)=>{if(r){o(r,null);return}_command(e,t,i,n,commandResponseHandler)}))}e.exports=command},7793:(e,t,r)=>{"use strict";const n=r(7746).retrieveSnappy();const o=r(8761);const i={snappy:1,zlib:2};const s=new Set(["ismaster","saslStart","saslContinue","getnonce","authenticate","createUser","updateUser","copydbSaslStart","copydbgetnonce","copydb"]);function compress(e,t,r){switch(e.options.agreedCompressor){case"snappy":n.compress(t,r);break;case"zlib":var i={};if(e.options.zlibCompressionLevel){i.level=e.options.zlibCompressionLevel}o.deflate(t,i,r);break;default:throw new Error('Attempt to compress message using unknown compressor "'+e.options.agreedCompressor+'".')}}function decompress(e,t,r){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:n.uncompress(t,r);break;case i.zlib:o.inflate(t,r);break;default:r(null,t)}}e.exports={compressorIDs:i,uncompressibleCommands:s,compress:compress,decompress:decompress}},7161:e=>{"use strict";const t="2.6";const r="4.4";const n=2;const o=9;e.exports={MIN_SUPPORTED_SERVER_VERSION:t,MAX_SUPPORTED_SERVER_VERSION:r,MIN_SUPPORTED_WIRE_VERSION:n,MAX_SUPPORTED_WIRE_VERSION:o}},1971:(e,t,r)=>{"use strict";const n=r(9814).GetMore;const o=r(7746).retrieveBSON;const i=r(3111).MongoError;const s=r(3111).MongoNetworkError;const a=o();const c=a.Long;const l=r(7272).collectionNamespace;const u=r(1178).maxWireVersion;const d=r(7272).applyCommonQueryOptions;const p=r(7276);function getMore(e,t,r,o,a,h){a=a||{};const m=u(e);function queryCallback(e,t){if(e)return h(e);const n=t.message;if(n.cursorNotFound){return h(new s("cursor killed or timed out"),null)}if(m<4){const e=typeof n.cursorId==="number"?c.fromNumber(n.cursorId):n.cursorId;r.documents=n.documents;r.cursorId=e;h(null,null,n.connection);return}if(n.documents[0].ok===0){return h(new i(n.documents[0]))}const o=typeof n.documents[0].cursor.id==="number"?c.fromNumber(n.documents[0].cursor.id):n.documents[0].cursor.id;r.documents=n.documents[0].cursor.nextBatch;r.cursorId=o;h(null,n.documents[0],n.connection)}if(m<4){const i=e.s.bson;const s=new n(i,t,r.cursorId,{numberToReturn:o});const a=d({},r);e.s.pool.write(s,a,queryCallback);return}const g=r.cursorId instanceof c?r.cursorId:c.fromNumber(r.cursorId);const y={getMore:g,collection:l(t),batchSize:Math.abs(o)};if(r.cmd.tailable&&typeof r.cmd.maxAwaitTimeMS==="number"){y.maxTimeMS=r.cmd.maxAwaitTimeMS}const v=Object.assign({returnFieldSelector:null,documentsReturnedIn:"nextBatch"},a);if(r.session){v.session=r.session}p(e,t,y,v,queryCallback)}e.exports=getMore},9206:(e,t,r)=>{"use strict";const n=r(779);e.exports={insert:function insert(e,t,r,o,i){n(e,"insert","documents",t,r,o,i)},update:function update(e,t,r,o,i){n(e,"update","updates",t,r,o,i)},remove:function remove(e,t,r,o,i){n(e,"delete","deletes",t,r,o,i)},killCursors:r(6044),getMore:r(1971),query:r(1820),command:r(7276)}},6044:(e,t,r)=>{"use strict";const n=r(9814).KillCursor;const o=r(3111).MongoError;const i=r(3111).MongoNetworkError;const s=r(7272).collectionNamespace;const a=r(1178).maxWireVersion;const c=r(1178).emitWarning;const l=r(7276);function killCursors(e,t,r,u){u=typeof u==="function"?u:()=>{};const d=r.cursorId;if(a(e)<4){const o=e.s.bson;const i=e.s.pool;const s=new n(o,t,[d]);const a={immediateRelease:true,noResponse:true};if(typeof r.session==="object"){a.session=r.session}if(i&&i.isConnected()){try{i.write(s,a,u)}catch(e){if(typeof u==="function"){u(e,null)}else{c(e)}}}return}const p={killCursors:s(t),cursors:[d]};const h={};if(typeof r.session==="object")h.session=r.session;l(e,t,p,h,((e,t)=>{if(e){return u(e)}const r=t.message;if(r.cursorNotFound){return u(new i("cursor killed or timed out"),null)}if(!Array.isArray(r.documents)||r.documents.length===0){return u(new o(`invalid killCursors result returned for cursor id ${d}`))}u(null,r.documents[0])}))}e.exports=killCursors},1820:(e,t,r)=>{"use strict";const n=r(9814).Query;const o=r(3111).MongoError;const i=r(7272).getReadPreference;const s=r(7272).collectionNamespace;const a=r(7272).isSharded;const c=r(1178).maxWireVersion;const l=r(7272).applyCommonQueryOptions;const u=r(7276);const d=r(1371).decorateWithExplain;const p=r(5293).Explain;function query(e,t,r,n,s,a){s=s||{};if(n.cursorId!=null){return a()}if(r==null){return a(new o(`command ${JSON.stringify(r)} does not return a cursor`))}if(c(e)<4){const o=prepareLegacyFindQuery(e,t,r,n,s);const i=l({},n);if(typeof o.documentsReturnedIn==="string"){i.documentsReturnedIn=o.documentsReturnedIn}e.s.pool.write(o,i,a);return}const h=i(r,s);let m=prepareFindCommand(e,t,r,n,s);const g=p.fromOptions(s);if(g){m=d(m,g)}r.virtual=false;const y=Object.assign({documentsReturnedIn:"firstBatch",numberToReturn:1,slaveOk:h.slaveOk()},s);if(r.readPreference){y.readPreference=h}if(n.session){y.session=n.session}u(e,t,m,y,a)}function prepareFindCommand(e,t,r,n){n.batchSize=r.batchSize||n.batchSize;const o={find:s(t)};if(r.query){if(r.query["$query"]){o.filter=r.query["$query"]}else{o.filter=r.query}}let i=r.sort;if(Array.isArray(i)){const e={};if(i.length>0&&!Array.isArray(i[0])){let t=i[1];if(t==="asc"){t=1}else if(t==="desc"){t=-1}e[i[0]]=t}else{for(let t=0;t0&&s.batchSize===0){d=s.limit}else{d=s.batchSize}const p=s.skip||0;const h={};if(a(e)&&u){h["$readPreference"]=u.toJSON()}if(r.sort)h["$orderby"]=r.sort;if(r.hint)h["$hint"]=r.hint;if(r.snapshot)h["$snapshot"]=r.snapshot;if(typeof r.returnKey!=="undefined")h["$returnKey"]=r.returnKey;if(r.maxScan)h["$maxScan"]=r.maxScan;if(r.min)h["$min"]=r.min;if(r.max)h["$max"]=r.max;if(typeof r.showDiskLoc!=="undefined")h["$showDiskLoc"]=r.showDiskLoc;if(r.comment)h["$comment"]=r.comment;if(r.maxTimeMS)h["$maxTimeMS"]=r.maxTimeMS;if(c.explain!==undefined){d=-Math.abs(r.limit||0);h["$explain"]=true}h["$query"]=r.query;if(r.readConcern&&r.readConcern.level!=="local"){throw new o(`server find command does not support a readConcern level of ${r.readConcern.level}`)}if(r.readConcern){r=Object.assign({},r);delete r["readConcern"]}const m=typeof c.serializeFunctions==="boolean"?c.serializeFunctions:false;const g=typeof c.ignoreUndefined==="boolean"?c.ignoreUndefined:false;const y=new n(l,t,h,{numberToSkip:p,numberToReturn:d,pre32Limit:typeof r.limit!=="undefined"?r.limit:undefined,checkKeys:false,returnFieldSelector:r.fields,serializeFunctions:m,ignoreUndefined:g});if(typeof r.tailable==="boolean")y.tailable=r.tailable;if(typeof r.oplogReplay==="boolean")y.oplogReplay=r.oplogReplay;if(typeof r.noCursorTimeout==="boolean")y.noCursorTimeout=r.noCursorTimeout;if(typeof r.awaitData==="boolean")y.awaitData=r.awaitData;if(typeof r.partial==="boolean")y.partial=r.partial;y.slaveOk=u.slaveOk();return y}e.exports=query},7272:(e,t,r)=>{"use strict";const n=r(4485);const o=r(3111).MongoError;const i=r(2291).ServerType;const s=r(7962).TopologyDescription;const a=16;const c=9;var l={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};var getReadPreference=function(e,t){var r=e.readPreference||new n("primary");if(t.readPreference){r=t.readPreference}if(typeof r==="string"){r=new n(r)}if(!(r instanceof n)){throw new o("read preference must be a ReadPreference instance")}return r};var parseHeader=function(e){return{length:e.readInt32LE(0),requestId:e.readInt32LE(4),responseTo:e.readInt32LE(8),opCode:e.readInt32LE(12)}};function applyCommonQueryOptions(e,t){Object.assign(e,{raw:typeof t.raw==="boolean"?t.raw:false,promoteLongs:typeof t.promoteLongs==="boolean"?t.promoteLongs:true,promoteValues:typeof t.promoteValues==="boolean"?t.promoteValues:true,promoteBuffers:typeof t.promoteBuffers==="boolean"?t.promoteBuffers:false,monitoring:typeof t.monitoring==="boolean"?t.monitoring:false,fullResult:typeof t.fullResult==="boolean"?t.fullResult:false});if(typeof t.socketTimeout==="number"){e.socketTimeout=t.socketTimeout}if(t.session){e.session=t.session}if(typeof t.documentsReturnedIn==="string"){e.documentsReturnedIn=t.documentsReturnedIn}return e}function isSharded(e){if(e.type==="mongos")return true;if(e.description&&e.description.type===i.Mongos){return true}if(e.description&&e.description instanceof s){const t=Array.from(e.description.servers.values());return t.some((e=>e.type===i.Mongos))}return false}function databaseNamespace(e){return e.split(".")[0]}function collectionNamespace(e){return e.split(".").slice(1).join(".")}e.exports={getReadPreference:getReadPreference,MESSAGE_HEADER_SIZE:a,COMPRESSION_DETAILS_SIZE:c,opcodes:l,parseHeader:parseHeader,applyCommonQueryOptions:applyCommonQueryOptions,isSharded:isSharded,databaseNamespace:databaseNamespace,collectionNamespace:collectionNamespace}},779:(e,t,r)=>{"use strict";const n=r(3111).MongoError;const o=r(7272).collectionNamespace;const i=r(7276);const s=r(1371).decorateWithExplain;const a=r(5293).Explain;function writeCommand(e,t,r,c,l,u,d){if(l.length===0)throw new n(`${t} must contain at least one document`);if(typeof u==="function"){d=u;u={}}u=u||{};const p=typeof u.ordered==="boolean"?u.ordered:true;const h=u.writeConcern;let m={};m[t]=o(c);m[r]=l;m.ordered=p;if(h&&Object.keys(h).length>0){m.writeConcern=h}if(u.collation){for(let e=0;e{"use strict";const n=r(2413).Transform;const o=r(2413).PassThrough;const i=r(1669).deprecate;const s=r(1371).handleCallback;const a=r(3994).ReadPreference;const c=r(3994).MongoError;const l=r(4847).CoreCursor;const u=r(4847).CursorState;const d=r(3994).BSON.Map;const p=r(1371).maybePromise;const h=r(2548);const m=r(1371).formattedOrderClause;const g=r(5293).Explain;const y=r(1018).Aspect;const v=r(3554).each;const b=r(7885);const S=["tailable","oplogReplay","noCursorTimeout","awaitData","exhaust","partial"];const w=["numberOfRetries","tailableRetryInterval"];class Cursor extends l{constructor(e,t,r,n){super(e,t,r,n);if(this.operation){n=this.operation.options}const o=n.numberOfRetries||5;const i=n.tailableRetryInterval||500;const s=o;const a=n.promiseLibrary||Promise;this.s={numberOfRetries:o,tailableRetryInterval:i,currentNumberOfRetries:s,state:u.INIT,promiseLibrary:a,explicitlyIgnoreSession:!!n.explicitlyIgnoreSession};if(!n.explicitlyIgnoreSession&&n.session){this.cursorState.session=n.session}if(this.options.noCursorTimeout===true){this.addCursorFlag("noCursorTimeout",true)}let c=1e3;if(this.cmd.cursor&&this.cmd.cursor.batchSize){c=this.cmd.cursor.batchSize}else if(n.cursor&&n.cursor.batchSize){c=n.cursor.batchSize}else if(typeof n.batchSize==="number"){c=n.batchSize}this.setCursorBatchSize(c)}get readPreference(){if(this.operation){return this.operation.readPreference}return this.options.readPreference}get sortValue(){return this.cmd.sort}_initializeCursor(e){if(this.operation&&this.operation.session!=null){this.cursorState.session=this.operation.session}else{if(!this.s.explicitlyIgnoreSession&&!this.cursorState.session&&this.topology.hasSessionSupport()){this.cursorState.session=this.topology.startSession({owner:this});if(this.operation){this.operation.session=this.cursorState.session}}}super._initializeCursor(e)}hasNext(e){if(this.s.state===u.CLOSED||this.isDead&&this.isDead()){throw c.create({message:"Cursor is closed",driver:true})}return p(this,e,(e=>{const t=this;if(t.isNotified()){return e(null,false)}t._next(((r,n)=>{if(r)return e(r);if(n==null||t.s.state===Cursor.CLOSED||t.isDead()){return e(null,false)}t.s.state=u.OPEN;t.cursorState.cursorIndex--;if(t.cursorState.limit>0){t.cursorState.currentLimit--}e(null,true)}))}))}next(e){return p(this,e,(e=>{const t=this;if(t.s.state===u.CLOSED||t.isDead&&t.isDead()){e(c.create({message:"Cursor is closed",driver:true}));return}if(t.s.state===u.INIT&&t.cmd.sort){try{t.cmd.sort=m(t.cmd.sort)}catch(t){return e(t)}}t._next(((r,n)=>{if(r)return e(r);t.s.state=u.OPEN;e(null,n)}))}))}filter(e){if(this.s.state===u.CLOSED||this.s.state===u.OPEN||this.isDead()){throw c.create({message:"Cursor is closed",driver:true})}this.cmd.query=e;return this}maxScan(e){if(this.s.state===u.CLOSED||this.s.state===u.OPEN||this.isDead()){throw c.create({message:"Cursor is closed",driver:true})}this.cmd.maxScan=e;return this}hint(e){if(this.s.state===u.CLOSED||this.s.state===u.OPEN||this.isDead()){throw c.create({message:"Cursor is closed",driver:true})}this.cmd.hint=e;return this}min(e){if(this.s.state===u.CLOSED||this.s.state===u.OPEN||this.isDead()){throw c.create({message:"Cursor is closed",driver:true})}this.cmd.min=e;return this}max(e){if(this.s.state===u.CLOSED||this.s.state===u.OPEN||this.isDead()){throw c.create({message:"Cursor is closed",driver:true})}this.cmd.max=e;return this}returnKey(e){if(this.s.state===u.CLOSED||this.s.state===u.OPEN||this.isDead()){throw c.create({message:"Cursor is closed",driver:true})}this.cmd.returnKey=e;return this}showRecordId(e){if(this.s.state===u.CLOSED||this.s.state===u.OPEN||this.isDead()){throw c.create({message:"Cursor is closed",driver:true})}this.cmd.showDiskLoc=e;return this}snapshot(e){if(this.s.state===u.CLOSED||this.s.state===u.OPEN||this.isDead()){throw c.create({message:"Cursor is closed",driver:true})}this.cmd.snapshot=e;return this}setCursorOption(e,t){if(this.s.state===u.CLOSED||this.s.state===u.OPEN||this.isDead()){throw c.create({message:"Cursor is closed",driver:true})}if(w.indexOf(e)===-1){throw c.create({message:`option ${e} is not a supported option ${w}`,driver:true})}this.s[e]=t;if(e==="numberOfRetries")this.s.currentNumberOfRetries=t;return this}addCursorFlag(e,t){if(this.s.state===u.CLOSED||this.s.state===u.OPEN||this.isDead()){throw c.create({message:"Cursor is closed",driver:true})}if(S.indexOf(e)===-1){throw c.create({message:`flag ${e} is not a supported flag ${S}`,driver:true})}if(typeof t!=="boolean"){throw c.create({message:`flag ${e} must be a boolean value`,driver:true})}this.cmd[e]=t;return this}addQueryModifier(e,t){if(this.s.state===u.CLOSED||this.s.state===u.OPEN||this.isDead()){throw c.create({message:"Cursor is closed",driver:true})}if(e[0]!=="$"){throw c.create({message:`${e} is not a valid query modifier`,driver:true})}const r=e.substr(1);this.cmd[r]=t;if(r==="orderby")this.cmd.sort=this.cmd[r];return this}comment(e){if(this.s.state===u.CLOSED||this.s.state===u.OPEN||this.isDead()){throw c.create({message:"Cursor is closed",driver:true})}this.cmd.comment=e;return this}maxAwaitTimeMS(e){if(typeof e!=="number"){throw c.create({message:"maxAwaitTimeMS must be a number",driver:true})}if(this.s.state===u.CLOSED||this.s.state===u.OPEN||this.isDead()){throw c.create({message:"Cursor is closed",driver:true})}this.cmd.maxAwaitTimeMS=e;return this}maxTimeMS(e){if(typeof e!=="number"){throw c.create({message:"maxTimeMS must be a number",driver:true})}if(this.s.state===u.CLOSED||this.s.state===u.OPEN||this.isDead()){throw c.create({message:"Cursor is closed",driver:true})}this.cmd.maxTimeMS=e;return this}project(e){if(this.s.state===u.CLOSED||this.s.state===u.OPEN||this.isDead()){throw c.create({message:"Cursor is closed",driver:true})}this.cmd.fields=e;return this}sort(e,t){if(this.options.tailable){throw c.create({message:"Tailable cursor doesn't support sorting",driver:true})}if(this.s.state===u.CLOSED||this.s.state===u.OPEN||this.isDead()){throw c.create({message:"Cursor is closed",driver:true})}let r=e;if(Array.isArray(r)&&Array.isArray(r[0])){r=new d(r.map((e=>{const t=[e[0],null];if(e[1]==="asc"){t[1]=1}else if(e[1]==="desc"){t[1]=-1}else if(e[1]===1||e[1]===-1||e[1].$meta){t[1]=e[1]}else{throw new c("Illegal sort clause, must be of the form [['field1', '(ascending|descending)'], ['field2', '(ascending|descending)']]")}return t})))}if(t!=null){r=[[e,t]]}this.cmd.sort=r;return this}batchSize(e){if(this.options.tailable){throw c.create({message:"Tailable cursor doesn't support batchSize",driver:true})}if(this.s.state===u.CLOSED||this.isDead()){throw c.create({message:"Cursor is closed",driver:true})}if(typeof e!=="number"){throw c.create({message:"batchSize requires an integer",driver:true})}this.cmd.batchSize=e;this.setCursorBatchSize(e);return this}collation(e){this.cmd.collation=e;return this}limit(e){if(this.options.tailable){throw c.create({message:"Tailable cursor doesn't support limit",driver:true})}if(this.s.state===u.OPEN||this.s.state===u.CLOSED||this.isDead()){throw c.create({message:"Cursor is closed",driver:true})}if(typeof e!=="number"){throw c.create({message:"limit requires an integer",driver:true})}this.cmd.limit=e;this.setCursorLimit(e);return this}skip(e){if(this.options.tailable){throw c.create({message:"Tailable cursor doesn't support skip",driver:true})}if(this.s.state===u.OPEN||this.s.state===u.CLOSED||this.isDead()){throw c.create({message:"Cursor is closed",driver:true})}if(typeof e!=="number"){throw c.create({message:"skip requires an integer",driver:true})}this.cmd.skip=e;this.setCursorSkip(e);return this}each(e){this.rewind();this.s.state=u.INIT;v(this,e)}forEach(e,t){this.rewind();this.s.state=u.INIT;if(typeof t==="function"){v(this,((r,n)=>{if(r){t(r);return false}if(n!=null){e(n);return true}if(n==null&&t){const e=t;t=null;e(null);return false}}))}else{return new this.s.promiseLibrary(((t,r)=>{v(this,((n,o)=>{if(n){r(n);return false}else if(o==null){t(null);return false}else{e(o);return true}}))}))}}setReadPreference(e){if(this.s.state!==u.INIT){throw c.create({message:"cannot change cursor readPreference after cursor has been accessed",driver:true})}if(e instanceof a){this.options.readPreference=e}else if(typeof e==="string"){this.options.readPreference=new a(e)}else{throw new TypeError("Invalid read preference: "+e)}return this}toArray(e){if(this.options.tailable){throw c.create({message:"Tailable cursor cannot be converted to array",driver:true})}return p(this,e,(e=>{const t=this;const r=[];t.rewind();t.s.state=u.INIT;const fetchDocs=()=>{t._next(((n,o)=>{if(n){return s(e,n)}if(o==null){return t.close({skipKillCursors:true},(()=>s(e,null,r)))}r.push(o);if(t.bufferedCount()>0){let e=t.readBufferedDocuments(t.bufferedCount());Array.prototype.push.apply(r,e)}fetchDocs()}))};fetchDocs()}))}count(e,t,r){if(this.cmd.query==null)throw c.create({message:"count can only be used with find command",driver:true});if(typeof t==="function")r=t,t={};t=t||{};if(typeof e==="function"){r=e;e=true}if(this.cursorState.session){t=Object.assign({},t,{session:this.cursorState.session})}const n=new b(this,e,t);return h(this.topology,n,r)}close(e,t){if(typeof e==="function")t=e,e={};e=Object.assign({},{skipKillCursors:false},e);return p(this,t,(t=>{this.s.state=u.CLOSED;if(!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=r=>e(t(r))}else{this.cursorState.transforms={doc:e}}return this}isClosed(){return this.isDead()}destroy(e){if(e)this.emit("error",e);this.pause();this.close()}stream(e){this.cursorState.streamOptions=e||{};return this}transformStream(e){const t=e||{};if(typeof t.transform==="function"){const e=new n({objectMode:true,transform:function(e,r,n){this.push(t.transform(e));n()}});return this.pipe(e)}return this.pipe(new o({objectMode:true}))}explain(e,t){if(typeof e==="function")t=e,e=true;if(e===undefined)e=true;if(!this.operation||!this.operation.hasAspect(y.EXPLAINABLE)){throw new c("This command cannot be explained")}this.operation.explain=new g(e);return p(this,t,(e=>{l.prototype._next.apply(this,[e])}))}getLogger(){return this.logger}}Cursor.prototype.maxTimeMs=Cursor.prototype.maxTimeMS;i(Cursor.prototype.each,"Cursor.each is deprecated. Use Cursor.forEach instead.");i(Cursor.prototype.maxScan,"Cursor.maxScan is deprecated, and will be removed in a later version");i(Cursor.prototype.snapshot,"Cursor Snapshot is deprecated, and will be removed in a later version");e.exports=Cursor},6662:(e,t,r)=>{"use strict";const n=r(8614).EventEmitter;const o=r(1669).inherits;const i=r(1371).getSingleProperty;const s=r(538);const a=r(1371).handleCallback;const c=r(1371).filterOptions;const l=r(1371).toError;const u=r(3994).ReadPreference;const d=r(3994).MongoError;const p=r(3994).ObjectID;const h=r(3994).Logger;const m=r(5193);const g=r(1371).conditionallyMergeWriteConcern;const y=r(1371).executeLegacyOperation;const v=r(1117);const b=r(1669).deprecate;const S=r(1371).deprecateOptions;const w=r(1371).MongoDBNamespace;const E=r(147);const _=r(2481);const O=r(7289);const C=r(7429);const T=r(2226).createListener;const I=r(2226).ensureIndex;const k=r(2226).evaluate;const A=r(2226).profilingInfo;const R=r(2226).validateDatabaseName;const N=r(1554);const M=r(7057);const D=r(286);const P=r(499);const L=r(1363);const B=r(5561);const j=r(6394);const U=r(2360).DropCollectionOperation;const F=r(2360).DropDatabaseOperation;const W=r(1681);const $=r(4245);const z=r(840);const q=r(3969);const V=r(1969);const G=r(2808);const K=r(6301);const Y=r(2548);const X=["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 Db(e,t,r){r=r||{};if(!(this instanceof Db))return new Db(e,t,r);n.call(this);const o=r.promiseLibrary||Promise;r=c(r,X);r.promiseLibrary=o;this.s={dbCache:{},children:[],topology:t,options:r,logger:h("Db",r),bson:t?t.bson:null,readPreference:u.fromOptions(r),bufferMaxEntries:typeof r.bufferMaxEntries==="number"?r.bufferMaxEntries:-1,parentDb:r.parentDb||null,pkFactory:r.pkFactory||p,nativeParser:r.nativeParser||r.native_parser,promiseLibrary:o,noListener:typeof r.noListener==="boolean"?r.noListener:false,readConcern:O.fromOptions(r),writeConcern:_.fromOptions(r),namespace:new w(e)};R(e);i(this,"serverConfig",this.s.topology);i(this,"bufferMaxEntries",this.s.bufferMaxEntries);i(this,"databaseName",this.s.namespace.db);if(r.parentDb)return;if(this.s.noListener)return;t.on("error",T(this,"error",this));t.on("timeout",T(this,"timeout",this));t.on("close",T(this,"close",this));t.on("parseError",T(this,"parseError",this));t.once("open",T(this,"open",this));t.once("fullsetup",T(this,"fullsetup",this));t.once("all",T(this,"all",this));t.on("reconnect",T(this,"reconnect",this))}o(Db,n);Db.prototype.on=b((function(){return Db.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.");Db.prototype.once=b((function(){return Db.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(Db.prototype,"topology",{enumerable:true,get:function(){return this.s.topology}});Object.defineProperty(Db.prototype,"options",{enumerable:true,get:function(){return this.s.options}});Object.defineProperty(Db.prototype,"slaveOk",{enumerable:true,get:function(){if(this.s.options.readPreference!=null&&(this.s.options.readPreference!=="primary"||this.s.options.readPreference.mode!=="primary")){return true}return false}});Object.defineProperty(Db.prototype,"readConcern",{enumerable:true,get:function(){return this.s.readConcern}});Object.defineProperty(Db.prototype,"readPreference",{enumerable:true,get:function(){if(this.s.readPreference==null){return u.primary}return this.s.readPreference}});Object.defineProperty(Db.prototype,"writeConcern",{enumerable:true,get:function(){return this.s.writeConcern}});Object.defineProperty(Db.prototype,"namespace",{enumerable:true,get:function(){return this.s.namespace.toString()}});Db.prototype.command=function(e,t,r){if(typeof t==="function")r=t,t={};t=Object.assign({},t);const n=new L(this,e,t);return Y(this.s.topology,n,r)};Db.prototype.aggregate=function(e,t,r){if(typeof t==="function"){r=t;t={}}if(t==null&&r==null){t={}}const n=new C(this.s.topology,new N(this,e,t),t);if(typeof r==="function"){r(null,n);return}return n};Db.prototype.admin=function(){const e=r(3238);return new e(this,this.s.topology,this.s.promiseLibrary)};const J=["pkFactory","readPreference","serializeFunctions","strict","readConcern","ignoreUndefined","promoteValues","promoteBuffers","promoteLongs"];Db.prototype.collection=function(e,t,r){if(typeof t==="function")r=t,t={};t=t||{};t=Object.assign({},t);t.promiseLibrary=this.s.promiseLibrary;t.readConcern=t.readConcern?new O(t.readConcern.level):this.readConcern;if(this.s.options.ignoreUndefined){t.ignoreUndefined=this.s.options.ignoreUndefined}for(const e of J){if(!(e in t)&&this.s.options[e]!==undefined){t[e]=this.s.options[e]}}t=g(t,this.s.options);if(t==null||!t.strict){try{const n=new m(this,this.s.topology,this.databaseName,e,this.s.pkFactory,t);if(r)r(null,n);return n}catch(e){if(e instanceof d&&r)return r(e);throw e}}if(typeof r!=="function"){throw l(`A callback is required in strict mode. While getting collection ${e}`)}if(this.serverConfig&&this.serverConfig.isDestroyed()){return r(new d("topology was destroyed"))}const n=Object.assign({},t,{nameOnly:true});this.listCollections({name:e},n).toArray(((n,o)=>{if(n!=null)return a(r,n,null);if(o.length===0)return a(r,l(`Collection ${e} does not exist. Currently in strict mode.`),null);try{return a(r,null,new m(this,this.s.topology,this.databaseName,e,this.s.pkFactory,t))}catch(n){return a(r,n,null)}}))};Db.prototype.createCollection=S({name:"Db.createCollection",deprecatedOptions:["autoIndexId","strict","w","wtimeout","j"],optionsIndex:1},(function(e,t,r){if(typeof t==="function")r=t,t={};t=t||{};t.promiseLibrary=t.promiseLibrary||this.s.promiseLibrary;t.readConcern=t.readConcern?new O(t.readConcern.level):this.readConcern;const n=new B(this,e,t);return Y(this.s.topology,n,r)}));Db.prototype.stats=function(e,t){if(typeof e==="function")t=e,e={};e=e||{};const r={dbStats:true};if(e["scale"]!=null)r["scale"]=e["scale"];if(e.readPreference==null&&this.s.readPreference){e.readPreference=this.s.readPreference}const n=new P(this,e,null,r);return Y(this.s.topology,n,t)};Db.prototype.listCollections=function(e,t){e=e||{};t=t||{};return new s(this.s.topology,new z(this,e,t),t)};Db.prototype.eval=b((function(e,t,r,n){const o=Array.prototype.slice.call(arguments,1);n=typeof o[o.length-1]==="function"?o.pop():undefined;t=o.length?o.shift():t;r=o.length?o.shift()||{}:{};return y(this.s.topology,k,[this,e,t,r,n])}),"Db.eval is deprecated as of MongoDB version 3.2");Db.prototype.renameCollection=function(e,t,r,n){if(typeof r==="function")n=r,r={};r=Object.assign({},r,{readPreference:u.PRIMARY});r.new_collection=true;const o=new G(this.collection(e),t,r);return Y(this.s.topology,o,n)};Db.prototype.dropCollection=function(e,t,r){if(typeof t==="function")r=t,t={};t=t||{};const n=new U(this,e,t);return Y(this.s.topology,n,r)};Db.prototype.dropDatabase=function(e,t){if(typeof e==="function")t=e,e={};e=e||{};const r=new F(this,e);return Y(this.s.topology,r,t)};Db.prototype.collections=function(e,t){if(typeof e==="function")t=e,e={};e=e||{};const r=new D(this,e);return Y(this.s.topology,r,t)};Db.prototype.executeDbAdminCommand=function(e,t,r){if(typeof t==="function")r=t,t={};t=t||{};t.readPreference=u.resolve(this,t);const n=new W(this,e,t);return Y(this.s.topology,n,r)};Db.prototype.createIndex=function(e,t,r,n){if(typeof r==="function")n=r,r={};r=r?Object.assign({},r):{};const o=new j(this,e,t,r);return Y(this.s.topology,o,n)};Db.prototype.ensureIndex=b((function(e,t,r,n){if(typeof r==="function")n=r,r={};r=r||{};return y(this.s.topology,I,[this,e,t,r,n])}),"Db.ensureIndex is deprecated as of MongoDB version 3.0 / driver version 2.0");Db.prototype.addChild=function(e){if(this.s.parentDb)return this.s.parentDb.addChild(e);this.s.children.push(e)};Db.prototype.addUser=function(e,t,r,n){if(typeof r==="function")n=r,r={};r=r||{};if(typeof e==="string"&&t!=null&&typeof t==="object"){r=t;t=null}const o=new M(this,e,t,r);return Y(this.s.topology,o,n)};Db.prototype.removeUser=function(e,t,r){if(typeof t==="function")r=t,t={};t=t||{};const n=new V(this,e,t);return Y(this.s.topology,n,r)};Db.prototype.setProfilingLevel=function(e,t,r){if(typeof t==="function")r=t,t={};t=t||{};const n=new K(this,e,t);return Y(this.s.topology,n,r)};Db.prototype.profilingInfo=b((function(e,t){if(typeof e==="function")t=e,e={};e=e||{};return y(this.s.topology,A,[this,e,t])}),"Db.profilingInfo is deprecated. Query the system.profile collection directly.");Db.prototype.profilingLevel=function(e,t){if(typeof e==="function")t=e,e={};e=e||{};const r=new q(this,e);return Y(this.s.topology,r,t)};Db.prototype.indexInformation=function(e,t,r){if(typeof t==="function")r=t,t={};t=t||{};const n=new $(this,e,t);return Y(this.s.topology,n,r)};Db.prototype.unref=function(){this.s.topology.unref()};Db.prototype.watch=function(e,t){e=e||[];t=t||{};if(!Array.isArray(e)){t=e;e=[]}return new v(this,e,t)};Db.prototype.getLogger=function(){return this.s.logger};Db.SYSTEM_NAMESPACE_COLLECTION=E.SYSTEM_NAMESPACE_COLLECTION;Db.SYSTEM_INDEX_COLLECTION=E.SYSTEM_INDEX_COLLECTION;Db.SYSTEM_PROFILE_COLLECTION=E.SYSTEM_PROFILE_COLLECTION;Db.SYSTEM_USER_COLLECTION=E.SYSTEM_USER_COLLECTION;Db.SYSTEM_COMMAND_COLLECTION=E.SYSTEM_COMMAND_COLLECTION;Db.SYSTEM_JS_COLLECTION=E.SYSTEM_JS_COLLECTION;e.exports=Db},8275:(e,t,r)=>{"use strict";let n;let o;let i;function loadCollection(){if(!n){n=r(5193)}return n}function loadCursor(){if(!o){o=r(7159)}return o}function loadDb(){if(!i){i=r(6662)}return i}e.exports={loadCollection:loadCollection,loadCursor:loadCursor,loadDb:loadDb}},3012:(e,t,r)=>{"use strict";const n=r(1545);const o=r(7746).retrieveBSON();const i=r(3111).MongoError;try{require.resolve("mongodb-client-encryption")}catch(e){throw new i("Auto-encryption requested, but the module is not installed. "+"Please add `mongodb-client-encryption` as a dependency of your project")}const s=r(5764);if(typeof s.extension!=="function"){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(r(5711)).AutoEncrypter;const c=Symbol("internalClient");class Encrypter{constructor(e,t){this.bypassAutoEncryption=!!t.autoEncryption.bypassAutoEncryption;this.needsConnecting=false;if(t.maxPoolSize===0&&t.autoEncryption.keyVaultClient==null){t.autoEncryption.keyVaultClient=e}else if(t.autoEncryption.keyVaultClient==null){t.autoEncryption.keyVaultClient=this.getInternalClient(e)}if(this.bypassAutoEncryption){t.autoEncryption.metadataClient=undefined}else if(t.maxPoolSize===0){t.autoEncryption.metadataClient=e}else{t.autoEncryption.metadataClient=this.getInternalClient(e)}t.autoEncryption.bson=Encrypter.makeBSON(t);this.autoEncrypter=new a(e,t.autoEncryption)}getInternalClient(e){if(!this[c]){const t={};for(const r of Object.keys(e.s.options)){if(["autoEncryption","minPoolSize","servers","caseTranslate","dbName"].indexOf(r)!==-1)continue;t[r]=e.s.options[r]}t.minPoolSize=0;const r=["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 n(e.s.url,t);for(const t of r){for(const r of e.listeners(t)){this[c].on(t,r)}}e.on("newListener",((e,t)=>{this[c].on(e,t)}));this.needsConnecting=true}return this[c]}connectInternalClient(e){if(this.needsConnecting){this.needsConnecting=false;return this[c].connect(e)}return e()}close(e,t,r){this.autoEncrypter.teardown((n=>{if(this[c]&&e!==this[c]){return this[c].close(t,r)}r(n)}))}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:Encrypter}},9386:(e,t,r)=>{"use strict";const n=r(3994).MongoNetworkError;const o=new Set([6,7,89,91,189,262,9001,10107,11600,11602,13435,13436,63,150,13388,234,133,43]);function isResumableError(e,t){if(e instanceof n){return true}if(t>=9){if(e.code===43){return true}return e.hasErrorLabel("ResumableChangeStreamError")}return o.has(e.code)}e.exports={GET_MORE_RESUMABLE_CODES:o,isResumableError:isResumableError}},5293:(e,t,r)=>{"use strict";const n=r(3111).MongoError;const o={queryPlanner:"queryPlanner",queryPlannerExtended:"queryPlannerExtended",executionStats:"executionStats",allPlansExecution:"allPlansExecution"};class Explain{constructor(e){if(typeof e==="boolean"){this.verbosity=e?"allPlansExecution":"queryPlanner"}else{this.verbosity=e}}static fromOptions(e){if(e==null||e.explain===undefined){return}const t=e.explain;if(typeof t==="boolean"||t in o){return new Explain(e.explain)}throw new n(`explain must be one of ${Object.keys(o)} or a boolean`)}}e.exports={Explain:Explain}},4190:(e,t,r)=>{"use strict";var n=r(2413),o=r(1669);e.exports=GridFSBucketReadStream;function GridFSBucketReadStream(e,t,r,o,i){this.s={bytesRead:0,chunks:e,cursor:null,expected:0,files:t,filter:o,init:false,expectedEnd:0,file:null,options:i,readPreference:r};n.Readable.call(this)}o.inherits(GridFSBucketReadStream,n.Readable);GridFSBucketReadStream.prototype._read=function(){var e=this;if(this.destroyed){return}waitForFile(e,(function(){doRead(e)}))};GridFSBucketReadStream.prototype.start=function(e){throwIfInitialized(this);this.s.options.start=e;return this};GridFSBucketReadStream.prototype.end=function(e){throwIfInitialized(this);this.s.options.end=e;return this};GridFSBucketReadStream.prototype.abort=function(e){var t=this;this.push(null);this.destroyed=true;if(this.s.cursor){this.s.cursor.close((function(r){t.emit("close");e&&e(r)}))}else{if(!this.s.init){t.emit("close")}e&&e()}};function throwIfInitialized(e){if(e.s.init){throw new Error("You cannot change options after the stream has entered"+"flowing mode!")}}function doRead(e){if(e.destroyed){return}e.s.cursor.next((function(t,r){if(e.destroyed){return}if(t){return __handleError(e,t)}if(!r){e.push(null);process.nextTick((()=>{e.s.cursor.close((function(t){if(t){__handleError(e,t);return}e.emit("close")}))}));return}var n=e.s.file.length-e.s.bytesRead;var o=e.s.expected++;var i=Math.min(e.s.file.chunkSize,n);if(r.n>o){var s="ChunkIsMissing: Got unexpected n: "+r.n+", expected: "+o;return __handleError(e,new Error(s))}if(r.n0){s["n"]={$gte:a}}}e.s.cursor=e.s.chunks.find(s).sort({n:1});if(e.s.readPreference){e.s.cursor.setReadPreference(e.s.readPreference)}e.s.expectedEnd=Math.ceil(r.length/r.chunkSize);e.s.file=r;try{e.s.bytesToTrim=handleEndOption(e,r,e.s.cursor,e.s.options)}catch(t){return __handleError(e,t)}e.emit("file",r)}))}function waitForFile(e,t){if(e.s.file){return t()}if(!e.s.init){init(e);e.s.init=true}e.once("file",(function(){t()}))}function handleStartOption(e,t,r){if(r&&r.start!=null){if(r.start>t.length){throw new Error("Stream start ("+r.start+") must not be "+"more than the length of the file ("+t.length+")")}if(r.start<0){throw new Error("Stream start ("+r.start+") must not be "+"negative")}if(r.end!=null&&r.endt.length){throw new Error("Stream end ("+n.end+") must not be "+"more than the length of the file ("+t.length+")")}if(n.start<0){throw new Error("Stream end ("+n.end+") must not be "+"negative")}var o=n.start!=null?Math.floor(n.start/t.chunkSize):0;r.limit(Math.ceil(n.end/t.chunkSize)-o);e.s.expectedEnd=Math.ceil(n.end/t.chunkSize);return Math.ceil(n.end/t.chunkSize)*t.chunkSize-n.end}}function __handleError(e,t){e.emit("error",t)}},2573:(e,t,r)=>{"use strict";var n=r(8614).EventEmitter;var o=r(4190);var i=r(1413);var s=r(1371).shallowClone;var a=r(1371).toError;var c=r(1669);var l=r(1371).executeLegacyOperation;var u={bucketName:"fs",chunkSizeBytes:255*1024};e.exports=GridFSBucket;function GridFSBucket(e,t){n.apply(this);this.setMaxListeners(0);if(t&&typeof t==="object"){t=s(t);var r=Object.keys(u);for(var o=0;o=0){r={uploadDate:1};n=t.revision}else{n=-t.revision-1}}var i={filename:e};t={sort:r,skip:n,start:t&&t.start,end:t&&t.end};return new o(this.s._chunksCollection,this.s._filesCollection,this.s.options.readPreference,i,t)};GridFSBucket.prototype.rename=function(e,t,r){return l(this.s.db.s.topology,_rename,[this,e,t,r],{skipSessions:true})};function _rename(e,t,r,n){var o={_id:t};var i={$set:{filename:r}};e.s._filesCollection.updateOne(o,i,(function(e,r){if(e){return n(e)}if(!r.result.n){return n(a("File with id "+t+" not found"))}n()}))}GridFSBucket.prototype.drop=function(e){return l(this.s.db.s.topology,_drop,[this,e],{skipSessions:true})};GridFSBucket.prototype.getLogger=function(){return this.s.db.s.logger};function _drop(e,t){e.s._filesCollection.drop((function(r){if(r){return t(r)}e.s._chunksCollection.drop((function(e){if(e){return t(e)}return t()}))}))}},1413:(e,t,r)=>{"use strict";var n=r(3994);var o=r(6417);var i=r(2413);var s=r(1669);var a=r(1867).Buffer;var c=26;e.exports=GridFSBucketWriteStream;function GridFSBucketWriteStream(e,t,r){r=r||{};i.Writable.call(this,r);this.bucket=e;this.chunks=e.s._chunksCollection;this.filename=t;this.files=e.s._filesCollection;this.options=r;this.done=false;this.id=r.id?r.id:n.BSON.ObjectId();this.chunkSizeBytes=this.options.chunkSizeBytes;this.bufToStore=a.alloc(this.chunkSizeBytes);this.length=0;this.md5=!r.disableMD5&&o.createHash("md5");this.n=0;this.pos=0;this.state={streamEnd:false,outstandingRequests:0,errored:false,aborted:false,promiseLibrary:this.bucket.s.promiseLibrary};if(!this.bucket.s.calledOpenUploadStream){this.bucket.s.calledOpenUploadStream=true;var s=this;checkIndexes(this,(function(){s.bucket.s.checkedIndexes=true;s.bucket.emit("index")}))}}s.inherits(GridFSBucketWriteStream,i.Writable);GridFSBucketWriteStream.prototype.write=function(e,t,r){var n=this;return waitForIndexes(this,(function(){return doWrite(n,e,t,r)}))};GridFSBucketWriteStream.prototype.abort=function(e){if(this.state.streamEnd){var t=new Error("Cannot abort a stream that has already completed");if(typeof e==="function"){return e(t)}return this.state.promiseLibrary.reject(t)}if(this.state.aborted){t=new Error("Cannot call abort() on a stream twice");if(typeof e==="function"){return e(t)}return this.state.promiseLibrary.reject(t)}this.state.aborted=true;this.chunks.deleteMany({files_id:this.id},(function(t){if(typeof e==="function")e(t)}))};GridFSBucketWriteStream.prototype.end=function(e,t,r){var n=this;if(typeof e==="function"){r=e,e=null,t=null}else if(typeof t==="function"){r=t,t=null}if(checkAborted(this,r)){return}this.state.streamEnd=true;if(r){this.once("finish",(function(e){r(null,e)}))}if(!e){waitForIndexes(this,(function(){writeRemnant(n)}));return}this.write(e,t,(function(){writeRemnant(n)}))};function __handleError(e,t,r){if(e.state.errored){return}e.state.errored=true;if(r){return r(t)}e.emit("error",t)}function createChunkDoc(e,t,r){return{_id:n.BSON.ObjectId(),files_id:e,n:t,data:r}}function checkChunksIndex(e,t){e.chunks.listIndexes().toArray((function(r,n){if(r){if(r.code===c){var o={files_id:1,n:1};e.chunks.createIndex(o,{background:false,unique:true},(function(e){if(e){return t(e)}t()}));return}return t(r)}var i=false;n.forEach((function(e){if(e.key){var t=Object.keys(e.key);if(t.length===2&&e.key.files_id===1&&e.key.n===1){i=true}}}));if(i){t()}else{o={files_id:1,n:1};var s=getWriteOptions(e);s.background=false;s.unique=true;e.chunks.createIndex(o,s,(function(e){if(e){return t(e)}t()}))}}))}function checkDone(e,t){if(e.done)return true;if(e.state.streamEnd&&e.state.outstandingRequests===0&&!e.state.errored){e.done=true;var r=createFilesDoc(e.id,e.length,e.chunkSizeBytes,e.md5&&e.md5.digest("hex"),e.filename,e.options.contentType,e.options.aliases,e.options.metadata);if(checkAborted(e,t)){return false}e.files.insertOne(r,getWriteOptions(e),(function(n){if(n){return __handleError(e,n,t)}e.emit("finish",r);e.emit("close")}));return true}return false}function checkIndexes(e,t){e.files.findOne({},{_id:1},(function(r,n){if(r){return t(r)}if(n){return t()}e.files.listIndexes().toArray((function(r,n){if(r){if(r.code===c){var o={filename:1,uploadDate:1};e.files.createIndex(o,{background:false},(function(r){if(r){return t(r)}checkChunksIndex(e,t)}));return}return t(r)}var i=false;n.forEach((function(e){var t=Object.keys(e.key);if(t.length===2&&e.key.filename===1&&e.key.uploadDate===1){i=true}}));if(i){checkChunksIndex(e,t)}else{o={filename:1,uploadDate:1};var s=getWriteOptions(e);s.background=false;e.files.createIndex(o,s,(function(r){if(r){return t(r)}checkChunksIndex(e,t)}))}}))}))}function createFilesDoc(e,t,r,n,o,i,s,a){var c={_id:e,length:t,chunkSize:r,uploadDate:new Date,filename:o};if(n){c.md5=n}if(i){c.contentType=i}if(s){c.aliases=s}if(a){c.metadata=a}return c}function doWrite(e,t,r,n){if(checkAborted(e,n)){return false}var o=a.isBuffer(t)?t:a.from(t,r);e.length+=o.length;if(e.pos+o.length0){var u=o.length-i;o.copy(e.bufToStore,e.pos,u,u+c);e.pos+=c;s-=c;if(s===0){if(e.md5){e.md5.update(e.bufToStore)}var d=createChunkDoc(e.id,e.n,a.from(e.bufToStore));++e.state.outstandingRequests;++l;if(checkAborted(e,n)){return false}e.chunks.insertOne(d,getWriteOptions(e),(function(t){if(t){return __handleError(e,t)}--e.state.outstandingRequests;--l;if(!l){e.emit("drain",d);n&&n();checkDone(e)}}));s=e.chunkSizeBytes;e.pos=0;++e.n}i-=c;c=Math.min(s,i)}return false}function getWriteOptions(e){var t={};if(e.options.writeConcern){t.w=e.options.writeConcern.w;t.wtimeout=e.options.writeConcern.wtimeout;t.j=e.options.writeConcern.j}return t}function waitForIndexes(e,t){if(e.bucket.s.checkedIndexes){return t(false)}e.bucket.once("index",(function(){t(true)}));return true}function writeRemnant(e,t){if(e.pos===0){return checkDone(e,t)}++e.state.outstandingRequests;var r=a.alloc(e.pos);e.bufToStore.copy(r,0,0,e.pos);if(e.md5){e.md5.update(r)}var n=createChunkDoc(e.id,e.n,r);if(checkAborted(e,t)){return false}e.chunks.insertOne(n,getWriteOptions(e),(function(t){if(t){return __handleError(e,t)}--e.state.outstandingRequests;checkDone(e)}))}function checkAborted(e,t){if(e.state.aborted){if(typeof t==="function"){t(new Error("this stream has been aborted"))}return true}return false}},3890:(e,t,r)=>{"use strict";var n=r(3994).BSON.Binary,o=r(3994).BSON.ObjectID;var i=r(1867).Buffer;var Chunk=function(e,t,r){if(!(this instanceof Chunk))return new Chunk(e,t);this.file=e;var s=t==null?{}:t;this.writeConcern=r||{w:1};this.objectId=s._id==null?new o:s._id;this.chunkNumber=s.n==null?0:s.n;this.data=new n;if(typeof s.data==="string"){var a=i.alloc(s.data.length);a.write(s.data,0,s.data.length,"binary");this.data=new n(a)}else if(Array.isArray(s.data)){a=i.alloc(s.data.length);var c=s.data.join("");a.write(c,0,c.length,"binary");this.data=new n(a)}else if(s.data&&s.data._bsontype==="Binary"){this.data=s.data}else if(!i.isBuffer(s.data)&&!(s.data==null)){throw Error("Illegal chunk format")}this.internalPosition=0};Chunk.prototype.write=function(e,t){this.data.write(e,this.internalPosition,e.length,"binary");this.internalPosition=this.data.length();if(t!=null)return t(null,this);return this};Chunk.prototype.read=function(e){e=e==null||e===0?this.length():e;if(this.length()-this.internalPosition+1>=e){var t=this.data.read(this.internalPosition,e);this.internalPosition=this.internalPosition+e;return t}else{return""}};Chunk.prototype.readSlice=function(e){if(this.length()-this.internalPosition>=e){var t=null;if(this.data.buffer!=null){t=this.data.buffer.slice(this.internalPosition,this.internalPosition+e)}else{t=i.alloc(e);e=this.data.readInto(t,this.internalPosition)}this.internalPosition=this.internalPosition+e;return t}else{return null}};Chunk.prototype.eof=function(){return this.internalPosition===this.length()?true:false};Chunk.prototype.getc=function(){return this.read(1)};Chunk.prototype.rewind=function(){this.internalPosition=0;this.data=new n};Chunk.prototype.save=function(e,t){var r=this;if(typeof e==="function"){t=e;e={}}r.file.chunkCollection((function(n,o){if(n)return t(n);var i={upsert:true};for(var s in e)i[s]=e[s];for(s in r.writeConcern)i[s]=r.writeConcern[s];if(r.data.length()>0){r.buildMongoObject((function(e){var n={forceServerObjectId:true};for(var s in r.writeConcern){n[s]=r.writeConcern[s]}o.replaceOne({_id:r.objectId},e,i,(function(e){t(e,r)}))}))}else{t(null,r)}}))};Chunk.prototype.buildMongoObject=function(e){var t={files_id:this.file.fileId,n:this.chunkNumber,data:this.data};if(this.objectId!=null)t._id=this.objectId;e(t)};Chunk.prototype.length=function(){return this.data.length()};Object.defineProperty(Chunk.prototype,"position",{enumerable:true,get:function(){return this.internalPosition},set:function(e){this.internalPosition=e}});Chunk.DEFAULT_CHUNK_SIZE=1024*255;e.exports=Chunk},9406:(e,t,r)=>{"use strict";const n=r(3890);const o=r(3994).BSON.ObjectID;const i=r(3994).ReadPreference;const s=r(1867).Buffer;const a=r(5747);const c=r(1669).format;const l=r(1669);const u=r(3994).MongoError;const d=l.inherits;const p=r(2413).Duplex;const h=r(1371).shallowClone;const m=r(1371).executeLegacyOperation;const g=r(1669).deprecate;var y=0,v=1;const b=g((()=>{}),"GridStore is deprecated, and will be removed in a future version. Please use GridFSBucket instead");var S=function GridStore(e,t,r,s,a){b();if(!(this instanceof GridStore))return new GridStore(e,t,r,s,a);this.db=e;if(typeof a==="undefined")a={};if(typeof s==="undefined"){s=r;r=undefined}else if(typeof s==="object"){a=s;s=r;r=undefined}if(t&&t._bsontype==="ObjectID"){this.referenceBy=v;this.fileId=t;this.filename=r}else if(typeof r==="undefined"){this.referenceBy=y;this.filename=t;if(s.indexOf("w")!=null){this.fileId=new o}}else{this.referenceBy=v;this.fileId=t;this.filename=r}this.mode=s==null?"r":s;this.options=a||{};this.isOpen=false;this.root=this.options["root"]==null?GridStore.DEFAULT_ROOT_COLLECTION:this.options["root"];this.position=0;this.readPreference=this.options.readPreference||e.options.readPreference||i.primary;this.writeConcern=_getWriteConcern(e,this.options);this.internalChunkSize=this.options["chunkSize"]==null?n.DEFAULT_CHUNK_SIZE:this.options["chunkSize"];var c=this.options.promiseLibrary||Promise;this.promiseLibrary=c;Object.defineProperty(this,"chunkSize",{enumerable:true,get:function(){return this.internalChunkSize},set:function(e){if(!(this.mode[0]==="w"&&this.position===0&&this.uploadDate==null)){this.internalChunkSize=this.internalChunkSize}else{this.internalChunkSize=e}}});Object.defineProperty(this,"md5",{enumerable:true,get:function(){return this.internalMd5}});Object.defineProperty(this,"chunkNumber",{enumerable:true,get:function(){return this.currentChunk&&this.currentChunk.chunkNumber?this.currentChunk.chunkNumber:null}})};S.prototype.open=function(e,t){if(typeof e==="function")t=e,e={};e=e||{};if(this.mode!=="w"&&this.mode!=="w+"&&this.mode!=="r"){throw u.create({message:"Illegal mode "+this.mode,driver:true})}return m(this.db.s.topology,open,[this,e,t],{skipSessions:true})};var open=function(e,t,r){var n=_getWriteConcern(e.db,e.options);if(e.mode==="w"||e.mode==="w+"){var o=e.collection();o.ensureIndex([["filename",1]],n,(function(){var t=e.chunkCollection();var o=h(n);o.unique=true;t.ensureIndex([["files_id",1],["n",1]],o,(function(){_open(e,n,(function(t,n){if(t)return r(t);e.isOpen=true;r(t,n)}))}))}))}else{_open(e,n,(function(t,n){if(t)return r(t);e.isOpen=true;r(t,n)}))}};S.prototype.eof=function(){return this.position===this.length?true:false};S.prototype.getc=function(e,t){if(typeof e==="function")t=e,e={};e=e||{};return m(this.db.s.topology,getc,[this,e,t],{skipSessions:true})};var getc=function(e,t,r){if(e.eof()){r(null,null)}else if(e.currentChunk.eof()){nthChunk(e,e.currentChunk.chunkNumber+1,(function(t,n){e.currentChunk=n;e.position=e.position+1;r(t,e.currentChunk.getc())}))}else{e.position=e.position+1;r(null,e.currentChunk.getc())}};S.prototype.puts=function(e,t,r){if(typeof t==="function")r=t,t={};t=t||{};var n=e.match(/\n$/)==null?e+"\n":e;return m(this.db.s.topology,this.write.bind(this),[n,t,r],{skipSessions:true})};S.prototype.stream=function(){return new GridStoreStream(this)};S.prototype.write=function write(e,t,r,n){if(typeof r==="function")n=r,r={};r=r||{};return m(this.db.s.topology,_writeNormal,[this,e,t,r,n],{skipSessions:true})};S.prototype.destroy=function destroy(){if(!this.writable)return;this.readable=false;if(this.writable){this.writable=false;this._q.length=0;this.emit("close")}};S.prototype.writeFile=function(e,t,r){if(typeof t==="function")r=t,t={};t=t||{};return m(this.db.s.topology,writeFile,[this,e,t,r],{skipSessions:true})};var writeFile=function(e,t,r,o){if(typeof t==="string"){a.open(t,"r",(function(t,r){if(t)return o(t);e.writeFile(r,o)}));return}e.open((function(e,r){if(e)return o(e,r);a.fstat(t,(function(e,i){if(e)return o(e,r);var c=0;var l=0;var writeChunk=function(){var e=s.alloc(r.chunkSize);a.read(t,e,0,e.length,c,(function(e,s,u){if(e)return o(e,r);c=c+s;var d=new n(r,{n:l++},r.writeConcern);d.write(u.slice(0,s),(function(e,n){if(e)return o(e,r);n.save({},(function(e){if(e)return o(e,r);r.position=r.position+s;r.currentChunk=n;if(c>=i.size){a.close(t,(function(e){if(e)return o(e);r.close((function(e){if(e)return o(e,r);return o(null,r)}))}))}else{return process.nextTick(writeChunk)}}))}))}))};process.nextTick(writeChunk)}))}))};S.prototype.close=function(e,t){if(typeof e==="function")t=e,e={};e=e||{};return m(this.db.s.topology,close,[this,e,t],{skipSessions:true})};var close=function(e,t,r){if(e.mode[0]==="w"){t=Object.assign({},e.writeConcern,t);if(e.currentChunk!=null&&e.currentChunk.position>0){e.currentChunk.save({},(function(n){if(n&&typeof r==="function")return r(n);e.collection((function(n,o){if(n&&typeof r==="function")return r(n);if(e.uploadDate!=null){buildMongoObject(e,(function(e,n){if(e){if(typeof r==="function")return r(e);else throw e}o.save(n,t,(function(e){if(typeof r==="function")r(e,n)}))}))}else{e.uploadDate=new Date;buildMongoObject(e,(function(e,n){if(e){if(typeof r==="function")return r(e);else throw e}o.save(n,t,(function(e){if(typeof r==="function")r(e,n)}))}))}}))}))}else{e.collection((function(n,o){if(n&&typeof r==="function")return r(n);e.uploadDate=new Date;buildMongoObject(e,(function(e,n){if(e){if(typeof r==="function")return r(e);else throw e}o.save(n,t,(function(e){if(typeof r==="function")r(e,n)}))}))}))}}else if(e.mode[0]==="r"){if(typeof r==="function")r(null,null)}else{if(typeof r==="function")r(u.create({message:c("Illegal mode %s",e.mode),driver:true}))}};S.prototype.chunkCollection=function(e){if(typeof e==="function")return this.db.collection(this.root+".chunks",e);return this.db.collection(this.root+".chunks")};S.prototype.unlink=function(e,t){if(typeof e==="function")t=e,e={};e=e||{};return m(this.db.s.topology,unlink,[this,e,t],{skipSessions:true})};var unlink=function(e,t,r){deleteChunks(e,(function(t){if(t!==null){t.message="at deleteChunks: "+t.message;return r(t)}e.collection((function(t,n){if(t!==null){t.message="at collection: "+t.message;return r(t)}n.remove({_id:e.fileId},e.writeConcern,(function(t){r(t,e)}))}))}))};S.prototype.collection=function(e){if(typeof e==="function")this.db.collection(this.root+".files",e);return this.db.collection(this.root+".files")};S.prototype.readlines=function(e,t,r){var n=Array.prototype.slice.call(arguments,0);r=typeof n[n.length-1]==="function"?n.pop():undefined;e=n.length?n.shift():"\n";e=e||"\n";t=n.length?n.shift():{};return m(this.db.s.topology,readlines,[this,e,t,r],{skipSessions:true})};var readlines=function(e,t,r,n){e.read((function(e,r){if(e)return n(e);var o=r.toString().split(t);o=o.length>0?o.splice(0,o.length-1):[];for(var i=0;i=i){var c=e.currentChunk.readSlice(i-a._index);c.copy(a,a._index);e.position=e.position+a.length;if(i===0&&a.length===0)return o(u.create({message:"File does not exist",driver:true}),null);return o(null,a)}c=e.currentChunk.readSlice(e.currentChunk.length()-e.currentChunk.position);c.copy(a,a._index);a._index+=c.length;nthChunk(e,e.currentChunk.chunkNumber+1,(function(r,n){if(r)return o(r);if(n.length()>0){e.currentChunk=n;e.read(t,a,o)}else{if(a._index>0){o(null,a)}else{o(u.create({message:"no chunks found for file, possibly corrupt",driver:true}),null)}}}))};S.prototype.tell=function(e){var t=this;if(typeof e==="function")return e(null,this.position);return new t.promiseLibrary((function(e){e(t.position)}))};S.prototype.seek=function(e,t,r,n){var o=Array.prototype.slice.call(arguments,1);n=typeof o[o.length-1]==="function"?o.pop():undefined;t=o.length?o.shift():null;r=o.length?o.shift():{};return m(this.db.s.topology,seek,[this,e,t,r,n],{skipSessions:true})};var seek=function(e,t,r,n,o){if(e.mode!=="r"){return o(u.create({message:"seek is only supported for mode r",driver:true}))}var i=r==null?S.IO_SEEK_SET:r;var s=t;var a=0;if(i===S.IO_SEEK_CUR){a=e.position+s}else if(i===S.IO_SEEK_END){a=e.length+s}else{a=s}var c=Math.floor(a/e.chunkSize);var seekChunk=function(){nthChunk(e,c,(function(t,r){if(t)return o(t,null);if(r==null)return o(new Error("no chunk found"));e.currentChunk=r;e.position=a;e.currentChunk.position=e.position%e.chunkSize;o(t,e)}))};seekChunk()};var _open=function(e,t,r){var i=e.collection();var s=e.referenceBy===v?{_id:e.fileId}:{filename:e.filename};s=null==e.fileId&&e.filename==null?null:s;t.readPreference=e.readPreference;if(s!=null){i.findOne(s,t,(function(i,s){if(i){return error(i)}if(s!=null){e.fileId=s._id;e.filename=e.mode==="r"||e.filename===undefined?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(e.mode!=="r"){e.fileId=e.fileId==null?new o:e.fileId;e.contentType=S.DEFAULT_CONTENT_TYPE;e.internalChunkSize=e.internalChunkSize==null?n.DEFAULT_CHUNK_SIZE:e.internalChunkSize;e.length=0}else{e.length=0;var a=e.fileId._bsontype==="ObjectID"?e.fileId.toHexString():e.fileId;return error(u.create({message:c("file with id %s not opened for writing",e.referenceBy===v?a:e.filename),driver:true}),e)}if(e.mode==="r"){nthChunk(e,0,t,(function(t,n){if(t)return error(t);e.currentChunk=n;e.position=0;r(null,e)}))}else if(e.mode==="w"&&s){deleteChunks(e,t,(function(t){if(t)return error(t);e.currentChunk=new n(e,{n:0},e.writeConcern);e.contentType=e.options["content_type"]==null?e.contentType:e.options["content_type"];e.internalChunkSize=e.options["chunk_size"]==null?e.internalChunkSize:e.options["chunk_size"];e.metadata=e.options["metadata"]==null?e.metadata:e.options["metadata"];e.aliases=e.options["aliases"]==null?e.aliases:e.options["aliases"];e.position=0;r(null,e)}))}else if(e.mode==="w"){e.currentChunk=new n(e,{n:0},e.writeConcern);e.contentType=e.options["content_type"]==null?e.contentType:e.options["content_type"];e.internalChunkSize=e.options["chunk_size"]==null?e.internalChunkSize:e.options["chunk_size"];e.metadata=e.options["metadata"]==null?e.metadata:e.options["metadata"];e.aliases=e.options["aliases"]==null?e.aliases:e.options["aliases"];e.position=0;r(null,e)}else if(e.mode==="w+"){nthChunk(e,lastChunkNumber(e),t,(function(t,o){if(t)return error(t);e.currentChunk=o==null?new n(e,{n:0},e.writeConcern):o;e.currentChunk.position=e.currentChunk.data.length();e.metadata=e.options["metadata"]==null?e.metadata:e.options["metadata"];e.aliases=e.options["aliases"]==null?e.aliases:e.options["aliases"];e.position=e.length;r(null,e)}))}}))}else{e.fileId=null==e.fileId?new o:e.fileId;e.contentType=S.DEFAULT_CONTENT_TYPE;e.internalChunkSize=e.internalChunkSize==null?n.DEFAULT_CHUNK_SIZE:e.internalChunkSize;e.length=0;if(e.mode==="w"){deleteChunks(e,t,(function(t){if(t)return error(t);e.currentChunk=new n(e,{n:0},e.writeConcern);e.contentType=e.options["content_type"]==null?e.contentType:e.options["content_type"];e.internalChunkSize=e.options["chunk_size"]==null?e.internalChunkSize:e.options["chunk_size"];e.metadata=e.options["metadata"]==null?e.metadata:e.options["metadata"];e.aliases=e.options["aliases"]==null?e.aliases:e.options["aliases"];e.position=0;r(null,e)}))}else if(e.mode==="w+"){nthChunk(e,lastChunkNumber(e),t,(function(t,o){if(t)return error(t);e.currentChunk=o==null?new n(e,{n:0},e.writeConcern):o;e.currentChunk.position=e.currentChunk.data.length();e.metadata=e.options["metadata"]==null?e.metadata:e.options["metadata"];e.aliases=e.options["aliases"]==null?e.aliases:e.options["aliases"];e.position=e.length;r(null,e)}))}}function error(e){if(error.err)return;r(error.err=e)}};var writeBuffer=function(e,t,r,o){if(typeof r==="function"){o=r;r=null}var i=typeof r==="boolean"?r:false;if(e.mode!=="w"){o(u.create({message:c("file with id %s not opened for writing",e.referenceBy===v?e.referenceBy:e.filename),driver:true}),null)}else{if(e.currentChunk.position+t.length>=e.chunkSize){var s=e.currentChunk.chunkNumber;var a=e.chunkSize-e.currentChunk.position;var l=t.slice(0,a);var d=t.slice(a);var p=[e.currentChunk.write(l)];while(d.length>=e.chunkSize){var h=new n(e,{n:s+1},e.writeConcern);l=d.slice(0,e.chunkSize);d=d.slice(e.chunkSize);s=s+1;h.write(l);p.push(h)}e.currentChunk=new n(e,{n:s+1},e.writeConcern);if(d.length>0)e.currentChunk.write(d);e.position=e.position+t.length;var m=p.length;for(var g=0;g=t.length)return i("offset larger than size of file",null);if(r&&r>t.length)return i("length is larger than the size of the file",null);if(n&&r&&n+r>t.length)return i("offset and length is larger than the size of the file",null);if(n!=null){t.seek(n,(function(e,t){if(e)return i(e);t.read(r,i)}))}else{t.read(r,i)}}))};S.readlines=function(e,t,r,n,o){var i=Array.prototype.slice.call(arguments,2);o=typeof i[i.length-1]==="function"?i.pop():undefined;r=i.length?i.shift():null;n=i.length?i.shift():null;n=n||{};return m(e.s.topology,readlinesStatic,[e,t,r,n,o],{skipSessions:true})};var readlinesStatic=function(e,t,r,n,o){var i=r==null?"\n":r;new S(e,t,"r",n).open((function(e,t){if(e)return o(e);t.readlines(i,o)}))};S.unlink=function(e,t,r,n){var o=Array.prototype.slice.call(arguments,2);n=typeof o[o.length-1]==="function"?o.pop():undefined;r=o.length?o.shift():{};r=r||{};return m(e.s.topology,unlinkStatic,[this,e,t,r,n],{skipSessions:true})};var unlinkStatic=function(e,t,r,n,o){var i=_getWriteConcern(t,n);if(r.constructor===Array){var s=0;for(var a=0;ae.totalBytesToRead){e.totalBytesToRead=e.totalBytesToRead-r._index;e.push(r.slice(0,r._index))}if(e.totalBytesToRead<=0){e.endCalled=true}}))};var t=e.gs.length{"use strict";const n=r(1117);const o=r(6662);const i=r(8614).EventEmitter;const s=r(1669).inherits;const a=r(3994).MongoError;const c=r(1669).deprecate;const l=r(2481);const u=r(1371).MongoDBNamespace;const d=r(4485);const p=r(1371).maybePromise;const h=r(2632);const m=r(5210).connect;const g=r(5210).validOptions;function MongoClient(e,t){if(!(this instanceof MongoClient))return new MongoClient(e,t);i.call(this);if(t&&t.autoEncryption)r(3012);this.s={url:e,options:t||{},promiseLibrary:t&&t.promiseLibrary||Promise,dbCache:new Map,sessions:new Set,writeConcern:l.fromOptions(t),readPreference:d.fromOptions(t)||d.primary,namespace:new u("admin")}}s(MongoClient,i);Object.defineProperty(MongoClient.prototype,"writeConcern",{enumerable:true,get:function(){return this.s.writeConcern}});Object.defineProperty(MongoClient.prototype,"readPreference",{enumerable:true,get:function(){return this.s.readPreference}});MongoClient.prototype.connect=function(e){if(typeof e==="string"){throw new TypeError("`connect` only accepts a callback")}const t=this;return p(this,e,(e=>{const r=g(t.s.options);if(r)return e(r);m(t,t.s.url,t.s.options,(r=>{if(r)return e(r);e(null,t)}))}))};MongoClient.prototype.logout=c((function(e,t){if(typeof e==="function")t=e,e={};if(typeof t==="function")t(null,true)}),"Multiple authentication is prohibited on a connected client, please only authenticate once per MongoClient");MongoClient.prototype.close=function(e,t){if(typeof e==="function"){t=e;e=false}const r=this;return p(this,t,(t=>{const completeClose=e=>{r.emit("close",r);if(!(r.topology instanceof h)){for(const e of r.s.dbCache){e[1].emit("close",r)}}r.removeAllListeners("close");t(e)};if(r.topology==null){completeClose();return}r.topology.close(e,(t=>{const n=r.topology.s.options.encrypter;if(n){return n.close(r,e,(e=>{completeClose(t||e)}))}completeClose(t)}))}))};MongoClient.prototype.db=function(e,t){t=t||{};if(!e){e=this.s.options.dbName}const r=Object.assign({},this.s.options,t);if(this.s.dbCache.has(e)&&r.returnNonCachedInstance!==true){return this.s.dbCache.get(e)}r.promiseLibrary=this.s.promiseLibrary;if(!this.topology){throw new a("MongoClient must be connected before calling MongoClient.prototype.db")}const n=new o(e,this.topology,r);this.s.dbCache.set(e,n);return n};MongoClient.prototype.isConnected=function(e){e=e||{};if(!this.topology)return false;return this.topology.isConnected(e)};MongoClient.connect=function(e,t,r){const n=Array.prototype.slice.call(arguments,1);r=typeof n[n.length-1]==="function"?n.pop():undefined;t=n.length?n.shift():null;t=t||{};const o=new MongoClient(e,t);return o.connect(r)};MongoClient.prototype.startSession=function(e){e=Object.assign({explicit:true},e);if(!this.topology){throw new a("Must connect to a server before calling this method")}return this.topology.startSession(e,this.s.options)};MongoClient.prototype.withSession=function(e,t){if(typeof e==="function")t=e,e=undefined;const r=this.startSession(e);let cleanupHandler=(e,t,n)=>{cleanupHandler=()=>{throw new ReferenceError("cleanupHandler was called too many times")};n=Object.assign({throw:true},n);r.endSession();if(e){if(n.throw)throw e;return Promise.reject(e)}};try{const e=t(r);return Promise.resolve(e).then((e=>cleanupHandler(null,e))).catch((e=>cleanupHandler(e,null,{throw:true})))}catch(e){return cleanupHandler(e,null,{throw:false})}};MongoClient.prototype.watch=function(e,t){e=e||[];t=t||{};if(!Array.isArray(e)){t=e;e=[]}return new n(this,e,t)};MongoClient.prototype.getLogger=function(){return this.s.options.logger};e.exports=MongoClient},7057:(e,t,r)=>{"use strict";const n=r(1018).Aspect;const o=r(499);const i=r(1018).defineAspects;const s=r(6417);const a=r(1371).handleCallback;const c=r(1371).toError;const l=r(1371).emitWarning;class AddUserOperation extends o{constructor(e,t,r,n){super(e,n);this.username=t;this.password=r}_buildCommand(){const e=this.db;const t=this.username;const r=this.password;const n=this.options;let o=[];if(Array.isArray(n.roles))o=n.roles;if(typeof n.roles==="string")o=[n.roles];if(o.length===0){l("Creating a user without roles is deprecated in MongoDB >= 2.6")}if((e.databaseName.toLowerCase()==="admin"||n.dbName==="admin")&&!Array.isArray(n.roles)){o=["root"]}else if(!Array.isArray(n.roles)){o=["dbOwner"]}const i=e.s.topology.lastIsMaster().maxWireVersion>=7;let a=r;if(!i){const e=s.createHash("md5");e.update(t+":mongo:"+r);a=e.digest("hex")}const c={createUser:t,customData:n.customData||{},roles:o,digestPassword:i};if(typeof r==="string"){c.pwd=a}return c}execute(e){const t=this.options;if(t.digestPassword!=null){return e(c("The digestPassword option is not supported via add_user. Please use db.command('createUser', ...) instead for this option."))}super.execute(((t,r)=>{if(!t){return a(e,t,r)}return a(e,t,null)}))}}i(AddUserOperation,n.WRITE_OPERATION);e.exports=AddUserOperation},1554:(e,t,r)=>{"use strict";const n=r(1189);const o=r(3994).MongoError;const i=r(1178).maxWireVersion;const s=r(3994).ReadPreference;const a=r(1018).Aspect;const c=r(1018).defineAspects;const l=1;const u=8;class AggregateOperation extends n{constructor(e,t,r){super(e,r,{fullResponse:true});this.target=e.s.namespace&&e.s.namespace.collection?e.s.namespace.collection:l;this.pipeline=t;this.hasWriteStage=false;if(typeof r.out==="string"){this.pipeline=this.pipeline.concat({$out:r.out});this.hasWriteStage=true}else if(t.length>0){const e=t[t.length-1];if(e.$out||e.$merge){this.hasWriteStage=true}}if(this.hasWriteStage){this.readPreference=s.primary}if(this.explain&&this.writeConcern){throw new o('"explain" cannot be used on an aggregate call with writeConcern')}if(r.cursor!=null&&typeof r.cursor!=="object"){throw new o("cursor options must be an object")}}get canRetryRead(){return!this.hasWriteStage}addToPipeline(e){this.pipeline.push(e)}execute(e,t){const r=this.options;const n=i(e);const o={aggregate:this.target,pipeline:this.pipeline};if(this.hasWriteStage&&n=5){if(this.hasWriteStage&&this.writeConcern){Object.assign(o,{writeConcern:this.writeConcern})}}if(r.bypassDocumentValidation===true){o.bypassDocumentValidation=r.bypassDocumentValidation}if(typeof r.allowDiskUse==="boolean"){o.allowDiskUse=r.allowDiskUse}if(r.hint){o.hint=r.hint}if(this.explain){r.full=false}o.cursor=r.cursor||{};if(r.batchSize&&!this.hasWriteStage){o.cursor.batchSize=r.batchSize}super.executeCommand(e,o,t)}}c(AggregateOperation,[a.READ_OPERATION,a.RETRYABLE,a.EXECUTE_WITH_SELECTION,a.EXPLAINABLE]);e.exports=AggregateOperation},6976:(e,t,r)=>{"use strict";const n=r(1371).applyRetryableWrites;const o=r(1371).applyWriteConcern;const i=r(3994).MongoError;const s=r(1018).OperationBase;class BulkWriteOperation extends s{constructor(e,t,r){super(r);this.collection=e;this.operations=t}execute(e){const t=this.collection;const r=this.operations;let s=this.options;if(t.s.options.ignoreUndefined){s=Object.assign({},s);s.ignoreUndefined=t.s.options.ignoreUndefined}const a=s.ordered===true||s.ordered==null?t.initializeOrderedBulkOp(s):t.initializeUnorderedBulkOp(s);let c=false;try{for(let e=0;e{if(!r&&t){return e(t,null)}e(null,r)}))}}e.exports=BulkWriteOperation},6716:(e,t,r)=>{"use strict";const n=r(1371).applyWriteConcern;const o=r(3994).BSON.Code;const i=r(2226).createIndex;const s=r(1371).decorateWithCollation;const a=r(1371).decorateWithReadConcern;const c=r(2226).ensureIndex;const l=r(2226).evaluate;const u=r(2226).executeCommand;const d=r(1371).handleCallback;const p=r(2226).indexInformation;const h=r(3994).BSON.Long;const m=r(3994).MongoError;const g=r(3994).ReadPreference;const y=r(2296).insertDocuments;const v=r(2296).updateDocuments;const b='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}';function createIndex(e,t,r,n){i(e.s.db,e.collectionName,t,r,n)}function createIndexes(e,t,r,n){const o=e.s.topology.capabilities();for(let e=0;e{e[t]=1}));p.group.key=e}h=Object.assign({},h);h.readPreference=g.resolve(e,h);a(p,e,h);try{s(p,e,h)}catch(e){return m(e,null)}u(e.s.db,p,h,((e,t)=>{if(e)return d(m,e,null);d(m,null,t.retval)}))}else{const s=i!=null&&i._bsontype==="Code"?i.scope:{};s.ns=e.collectionName;s.keys=t;s.condition=r;s.initial=n;const a=b.replace(/ reduce;/,i.toString()+";");l(e.s.db,new o(a,s),null,h,((e,t)=>{if(e)return d(m,e,null);d(m,null,t.result||t)}))}}function indexes(e,t,r){t=Object.assign({},{full:true},t);p(e.s.db,e.collectionName,t,r)}function indexExists(e,t,r,n){indexInformation(e,r,((e,r)=>{if(e!=null)return d(n,e,null);if(!Array.isArray(t))return d(n,null,r[t]!=null);for(let e=0;e{if(n)return d(r,n,null);if(i==null)return d(r,new Error("no result returned for parallelCollectionScan"),null);t=Object.assign({explicitlyIgnoreSession:true},t);const s=[];if(o)t.raw=o;for(let r=0;r{if(o==null)return;if(t==null)return d(o,null,null);if(e)return d(o,e,null);d(o,null,r)}))}e.exports={createIndex:createIndex,createIndexes:createIndexes,ensureIndex:ensureIndex,group:group,indexes:indexes,indexExists:indexExists,indexInformation:indexInformation,parallelCollectionScan:parallelCollectionScan,save:save}},286:(e,t,r)=>{"use strict";const n=r(1018).OperationBase;const o=r(1371).handleCallback;let i;function loadCollection(){if(!i){i=r(5193)}return i}class CollectionsOperation extends n{constructor(e,t){super(t);this.db=e}execute(e){const t=this.db;let r=this.options;let n=loadCollection();r=Object.assign({},r,{nameOnly:true});t.listCollections({},r).toArray(((r,i)=>{if(r!=null)return o(e,r,null);i=i.filter((e=>e.name.indexOf("$")===-1));o(e,null,i.map((e=>new n(t,t.s.topology,t.databaseName,e.name,t.s.pkFactory,t.s.options))))}))}}e.exports=CollectionsOperation},499:(e,t,r)=>{"use strict";const n=r(1018).Aspect;const o=r(1018).OperationBase;const i=r(1371).applyWriteConcern;const s=r(1371).debugOptions;const a=r(1371).handleCallback;const c=r(3994).MongoError;const l=r(3994).ReadPreference;const u=r(1371).MongoDBNamespace;const d=["authSource","w","wtimeout","j","native_parser","forceServerObjectId","serializeFunctions","raw","promoteLongs","promoteValues","promoteBuffers","bufferMaxEntries","numberOfRetries","retryMiliSeconds","readPreference","pkFactory","parentDb","promiseLibrary","noListener"];class CommandOperation extends o{constructor(e,t,r,o){super(t);if(!this.hasAspect(n.WRITE_OPERATION)){if(r!=null){this.options.readPreference=l.resolve(r,t)}else{this.options.readPreference=l.resolve(e,t)}}else{if(r!=null){i(this.options,{db:e,coll:r},this.options)}else{i(this.options,{db:e},this.options)}this.options.readPreference=l.primary}this.db=e;if(o!=null){this.command=o}if(r!=null){this.collection=r}}_buildCommand(){if(this.command!=null){return this.command}}execute(e){const t=this.db;const r=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=r.dbName||r.authdb||t.databaseName;if(this.hasAspect(n.WRITE_OPERATION)){if(r.writeConcern&&(!r.session||!r.session.inTransaction())){o.writeConcern=r.writeConcern}}if(t.s.logger.isDebug()){t.s.logger.debug(`executing command ${JSON.stringify(o)} against ${i}.$cmd with options [${JSON.stringify(s(d,r))}]`)}const l=this.namespace!=null?this.namespace:new u(i,"$cmd");t.s.topology.command(l,o,r,((t,n)=>{if(t)return a(e,t);if(r.full)return a(e,null,n);a(e,null,n.result)}))}}e.exports=CommandOperation},1189:(e,t,r)=>{"use strict";const n=r(1018).Aspect;const o=r(1018).OperationBase;const i=r(3994).ReadPreference;const s=r(7289);const a=r(2481);const c=r(1178).maxWireVersion;const l=r(1371).decorateWithExplain;const u=r(5474).commandSupportsReadConcern;const d=r(3111).MongoError;const p=5;class CommandOperationV2 extends o{constructor(e,t,r){super(t);this.ns=e.s.namespace.withCollection("$cmd");const o=this.hasAspect(n.NO_INHERIT_OPTIONS)?undefined:e;this.readPreference=this.hasAspect(n.WRITE_OPERATION)?i.primary:i.resolve(o,this.options);this.readConcern=resolveReadConcern(o,this.options);this.writeConcern=resolveWriteConcern(o,this.options);if(r&&typeof r.fullResponse==="boolean"){this.fullResponse=true}this.options.readPreference=this.readPreference;if(e.s.logger){this.logger=e.s.logger}else if(e.s.db&&e.s.db.logger){this.logger=e.s.db.logger}}executeCommand(e,t,r){this.server=e;const o=this.options;const i=c(e);const s=this.session&&this.session.inTransaction();if(this.readConcern&&u(t)&&!s){Object.assign(t,{readConcern:this.readConcern})}if(o.collation&&i=p){if(this.writeConcern&&this.hasAspect(n.WRITE_OPERATION)){Object.assign(t,{writeConcern:this.writeConcern})}if(o.collation&&typeof o.collation==="object"){Object.assign(t,{collation:o.collation})}}if(typeof o.maxTimeMS==="number"){t.maxTimeMS=o.maxTimeMS}if(typeof o.comment==="string"){t.comment=o.comment}if(this.hasAspect(n.EXPLAINABLE)&&this.explain){if(i<6&&t.aggregate){t.explain=true}else{t=l(t,this.explain)}}if(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)=>{if(e){r(e,null);return}if(this.fullResponse){r(null,t);return}r(null,t.result)}))}}function resolveWriteConcern(e,t){return a.fromOptions(t)||e&&e.writeConcern}function resolveReadConcern(e,t){return s.fromOptions(t)||e&&e.readConcern}e.exports=CommandOperationV2},2296:(e,t,r)=>{"use strict";const n=r(1371).applyRetryableWrites;const o=r(1371).applyWriteConcern;const i=r(1371).decorateWithCollation;const s=r(1371).decorateWithReadConcern;const a=r(2226).executeCommand;const c=r(1371).formattedOrderClause;const l=r(1371).handleCallback;const u=r(3994).MongoError;const d=r(3994).ReadPreference;const p=r(1371).toError;const h=r(4847).CursorState;const m=r(1178).maxWireVersion;function buildCountCommand(e,t,r){const n=r.skip;const o=r.limit;let a=r.hint;const c=r.maxTimeMS;t=t||{};const l={count:r.collectionName,query:t};if(e.s.numberOfRetries){if(e.options.hint){a=e.options.hint}else if(e.cmd.hint){a=e.cmd.hint}i(l,e,e.cmd)}else{i(l,e,r)}if(typeof n==="number")l.skip=n;if(typeof o==="number")l.limit=o;if(typeof c==="number")l.maxTimeMS=c;if(a)l.hint=a;s(l,e);return l}function findAndModify(e,t,r,s,u,p){const h={findAndModify:e.collectionName,query:t};r=c(r);if(r){h.sort=r}h.new=u.new?true:false;h.remove=u.remove?true:false;h.upsert=u.upsert?true:false;const m=u.projection||u.fields;if(m){h.fields=m}if(u.arrayFilters){h.arrayFilters=u.arrayFilters;delete u.arrayFilters}if(s&&!u.remove){h.update=s}if(u.maxTimeMS)h.maxTimeMS=u.maxTimeMS;u.serializeFunctions=u.serializeFunctions||e.s.serializeFunctions;u.checkKeys=false;let g=Object.assign({},u);g=n(g,e.s.db);g=o(g,{db:e.s.db,collection:e},u);if(g.writeConcern){h.writeConcern=g.writeConcern}if(g.bypassDocumentValidation===true){h.bypassDocumentValidation=g.bypassDocumentValidation}g.readPreference=d.primary;try{i(h,e,g)}catch(e){return p(e,null)}a(e.s.db,h,g,((e,t)=>{if(e)return l(p,e,null);return l(p,null,t)}))}function indexInformation(e,t,r,n){const o=r["full"]==null?false:r["full"];if(e.serverConfig&&e.serverConfig.isDestroyed())return n(new u("topology was destroyed"));function processResults(e){let t={};for(let r=0;r{if(e)return n(p(e));if(!Array.isArray(t))return l(n,null,[]);if(o)return l(n,null,t);l(n,null,processResults(t))}))}function prepareDocs(e,t,r){const n=typeof r.forceServerObjectId==="boolean"?r.forceServerObjectId:e.s.db.options.forceServerObjectId;if(n===true){return t}return t.map((t=>{if(n!==true&&t._id==null){t._id=e.s.pkFactory.createPk()}return t}))}function nextObject(e,t){if(e.s.state===h.CLOSED||e.isDead&&e.isDead()){return l(t,u.create({message:"Cursor is closed",driver:true}))}if(e.s.state===h.INIT&&e.cmd&&e.cmd.sort){try{e.cmd.sort=c(e.cmd.sort)}catch(e){return l(t,e)}}e._next(((r,n)=>{e.s.state=h.OPEN;if(r)return l(t,r);l(t,null,n)}))}function insertDocuments(e,t,r,i){if(typeof r==="function")i=r,r={};r=r||{};t=Array.isArray(t)?t:[t];let s=Object.assign({},r);s=n(s,e.s.db);s=o(s,{db:e.s.db,collection:e},r);if(s.keepGoing===true)s.ordered=false;s.serializeFunctions=r.serializeFunctions||e.s.serializeFunctions;t=prepareDocs(e,t,r);e.s.topology.insert(e.s.namespace,t,s,((e,r)=>{if(i==null)return;if(e)return l(i,e);if(r==null)return l(i,null,null);if(r.result.code)return l(i,p(r.result));if(r.result.writeErrors)return l(i,p(r.result.writeErrors[0]));r.ops=t;l(i,null,r)}))}function removeDocuments(e,t,r,s){if(typeof r==="function"){s=r,r={}}else if(typeof t==="function"){s=t;r={};t={}}r=r||{};let a=Object.assign({},r);a=n(a,e.s.db);a=o(a,{db:e.s.db,collection:e},r);if(t==null)t={};const c={q:t,limit:0};if(r.single){c.limit=1}else if(a.retryWrites){a.retryWrites=false}if(r.hint){c.hint=r.hint}try{i(a,e,r)}catch(e){return s(e,null)}if(r.explain!==undefined&&m(e.s.topology)<3){return s?s(new u(`server does not support explain on remove`)):undefined}e.s.topology.remove(e.s.namespace,[c],a,((e,t)=>{if(s==null)return;if(e)return l(s,e,null);if(t==null)return l(s,null,null);if(t.result.code)return l(s,p(t.result));if(t.result.writeErrors){return l(s,p(t.result.writeErrors[0]))}l(s,null,t)}))}function updateDocuments(e,t,r,s,a){if("function"===typeof s)a=s,s=null;if(s==null)s={};if(!("function"===typeof a))a=null;if(t==null||typeof t!=="object")return a(p("selector must be a valid JavaScript object"));if(r==null||typeof r!=="object")return a(p("document must be a valid JavaScript object"));let c=Object.assign({},s);c=n(c,e.s.db);c=o(c,{db:e.s.db,collection:e},s);c.serializeFunctions=s.serializeFunctions||e.s.serializeFunctions;const d={q:t,u:r};d.upsert=s.upsert!==void 0?!!s.upsert:false;d.multi=s.multi!==void 0?!!s.multi:false;if(s.hint){d.hint=s.hint}if(c.arrayFilters){d.arrayFilters=c.arrayFilters;delete c.arrayFilters}if(c.retryWrites&&d.multi){c.retryWrites=false}try{i(c,e,s)}catch(e){return a(e,null)}if(s.explain!==undefined&&m(e.s.topology)<3){return a?a(new u(`server does not support explain on update`)):undefined}e.s.topology.update(e.s.namespace,[d],c,((e,t)=>{if(a==null)return;if(e)return l(a,e,null);if(t==null)return l(a,null,null);if(t.result.code)return l(a,p(t.result));if(t.result.writeErrors)return l(a,p(t.result.writeErrors[0]));l(a,null,t)}))}e.exports={buildCountCommand:buildCountCommand,findAndModify:findAndModify,indexInformation:indexInformation,nextObject:nextObject,prepareDocs:prepareDocs,insertDocuments:insertDocuments,removeDocuments:removeDocuments,updateDocuments:updateDocuments}},5210:(e,t,r)=>{"use strict";const n=r(1669).deprecate;const o=r(3994).Logger;const i=r(3994).MongoCredentials;const s=r(3994).MongoError;const a=r(2048);const c=r(2632);const l=r(3994).parseConnectionString;const u=r(7289);const d=r(3994).ReadPreference;const p=r(382);const h=r(8421);const m=r(3994).Sessions.ServerSessionPool;const g=r(1371).emitDeprecationWarning;const y=r(1371).emitWarningOnce;const v=r(5747);const b=r(2481);const S=r(897).CMAP_EVENT_NAMES;let w;function loadClient(){if(!w){w=r(1545)}return w}const E=n(r(8729),"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.");const _={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"};const O=["timeout","close","serverOpening","serverDescriptionChanged","serverHeartbeatStarted","serverHeartbeatSucceeded","serverHeartbeatFailed","serverClosed","topologyOpening","topologyClosed","topologyDescriptionChanged","commandStarted","commandSucceeded","commandFailed","joined","left","ping","ha","all","fullsetup","open"];const C=new Set(["DEFAULT","PLAIN","GSSAPI","MONGODB-CR","MONGODB-X509","MONGODB-AWS","SCRAM-SHA-1","SCRAM-SHA-256"]);const T=["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"];const I=["native_parser"];const k=["server","replset","replSet","mongos","db"];function validOptions(e){const t=T.concat(k);for(const r in e){if(I.indexOf(r)!==-1){continue}if(t.indexOf(r)===-1){if(e.validateOptions){return new s(`option ${r} is not supported`)}else{y(`the options [${r}] is not supported`)}}if(k.indexOf(r)!==-1){y(`the server/replset/mongos/db options are deprecated, `+`all their options are supported at the top level of the options object [${T}]`)}}}const A=T.reduce(((e,t)=>{e[t.toLowerCase()]=t;return e}),{});function addListeners(e,t){t.on("authenticated",createListener(e,"authenticated"));t.on("error",createListener(e,"error"));t.on("timeout",createListener(e,"timeout"));t.on("close",createListener(e,"close"));t.on("parseError",createListener(e,"parseError"));t.once("open",createListener(e,"open"));t.once("fullsetup",createListener(e,"fullsetup"));t.once("all",createListener(e,"all"));t.on("reconnect",createListener(e,"reconnect"))}function assignTopology(e,t){e.topology=t;if(!(t instanceof c)){t.s.sessionPool=new m(t.s.coreTopology)}}function clearAllEvents(e){O.forEach((t=>e.removeAllListeners(t)))}function collectEvents(e,t){let r=loadClient();const n=[];if(e instanceof r){O.forEach((r=>{t.on(r,((t,o)=>{if(r==="open"){n.push({event:r,object1:e})}else{n.push({event:r,object1:t,object2:o})}}))}))}return n}function resolveTLSOptions(e){if(e.tls==null){return}["sslCA","sslKey","sslCert"].forEach((t=>{if(e[t]){e[t]=v.readFileSync(e[t])}}))}function connect(e,t,r,n){r=Object.assign({},r);if(n==null){throw new Error("no callback function provided")}let i=false;const c=o("MongoClient",r);if(t instanceof h||t instanceof p||t instanceof a){return connectWithUrl(e,t,r,connectCallback)}const u=r.useNewUrlParser!==false;const m=u?l:E;const g=u?transformUrlOptions:legacyTransformUrlOptions;m(t,r,((t,o)=>{if(t)return n(t);const s=g(o);const a=createUnifiedOptions(s,r);if(a.socketTimeoutMS==null)a.socketTimeoutMS=0;if(a.connectTimeoutMS==null)a.connectTimeoutMS=1e4;if(a.retryWrites==null)a.retryWrites=true;if(a.useRecoveryToken==null)a.useRecoveryToken=true;if(a.readPreference==null)a.readPreference="primary";if(a.db_options&&a.db_options.auth){delete a.db_options.auth}resolveTLSOptions(a);e.s.options=a;e.s.readPreference=d.fromOptions(a);e.s.writeConcern=b.fromOptions(a);if(s.servers.length===0){return n(new Error("connection string must contain at least one seed host"))}if(a.auth&&!a.credentials){try{i=true;a.credentials=generateCredentials(e,a.auth.user,a.auth.password,a)}catch(t){return n(t)}}if(a.useUnifiedTopology){return createTopology(e,"unified",a,connectCallback)}y("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.");if(a.replicaSet||a.rs_name){return createTopology(e,"replicaset",a,connectCallback)}else if(s.servers.length>1){return createTopology(e,"mongos",a,connectCallback)}else{return createServer(e,a,connectCallback)}}));function connectCallback(t,r){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&&t.message==="no mongos proxies found in seed list"){if(c.isWarn()){c.warn(o)}return n(new s(o))}if(i){e.emit("authenticated",null,true)}n(t,r)}}function connectWithUrl(e,t,r,n){assignTopology(e,t);addListeners(e,t);relayEvents(e,t);let o=Object.assign({},r);if(typeof r.readPreference==="string"||typeof r.read_preference==="string"){o.readPreference=new d(r.readPreference||r.read_preference)}const i=o.user||o.password||o.authMechanism;if(i&&!o.credentials){try{o.credentials=generateCredentials(e,o.user,o.password,o)}catch(e){return n(e,t)}}return t.connect(o,n)}function createListener(e,t){const r=new Set(["all","fullsetup","open","reconnect"]);return(n,o)=>{if(r.has(t)){return e.emit(t,e)}e.emit(t,n,o)}}function createServer(e,t,r){t.promiseLibrary=e.s.promiseLibrary;const n=translateOptions(t);const o=n[0];const i=collectEvents(e,o);o.connect(t,((n,s)=>{if(n){o.close(true);return r(n)}clearAllEvents(o);relayEvents(e,o);addListeners(e,o);const a=s.lastIsMaster();assignTopology(e,s);if(a&&a.msg==="isdbgrid"){s.close();return createTopology(e,"mongos",t,r)}replayEvents(e,i);r(n,s)}))}const R=new Set(["reconnect","reconnectFailed","attemptReconnect","joined","left","ping","ha","all","fullsetup","open"]);function registerDeprecatedEventNotifiers(e){e.on("newListener",(e=>{if(R.has(e)){g(`The \`${e}\` event is no longer supported by the unified topology, please read more by visiting http://bit.ly/2D8WfT6`,"DeprecationWarning")}}))}function createTopology(e,t,n,o){n.promiseLibrary=e.s.promiseLibrary;const i={};if(t==="unified")i.createServers=false;const s=translateOptions(n,i);if(n.autoEncryption!=null){const t=r(3012).Encrypter;n.encrypter=new t(e,n);n.autoEncrypter=n.encrypter.autoEncrypter}let l;if(t==="mongos"){l=new a(s,n)}else if(t==="replicaset"){l=new p(s,n)}else if(t==="unified"){l=new c(n.servers,n);registerDeprecatedEventNotifiers(e)}addListeners(e,l);relayEvents(e,l);assignTopology(e,l);if(n.autoEncrypter){n.autoEncrypter.init((e=>{if(e){o(e);return}l.connect(n,(e=>{if(e){l.close(true);o(e);return}n.encrypter.connectInternalClient((e=>{if(e)return o(e);o(undefined,l)}))}))}));return}l.connect(n,(e=>{if(e){l.close(true);return o(e)}o(undefined,l);return}))}function createUnifiedOptions(e,t){const r=["mongos","server","db","replset","db_options","server_options","rs_options","mongos_options"];const n=["readconcern","compression","autoencryption"];const o=["w","wtimeout","j","journal","fsync","writeconcern"];for(const i in t){if(o.indexOf(i.toLowerCase())!==-1){continue}else if(n.indexOf(i.toLowerCase())!==-1){e[i]=t[i]}else if(r.indexOf(i.toLowerCase())!==-1){e=mergeOptions(e,t[i],false)}else{if(t[i]&&typeof t[i]==="object"&&!Buffer.isBuffer(t[i])&&!Array.isArray(t[i])){e=mergeOptions(e,t[i],true)}else{e[i]=t[i]}}}const i=b.fromOptions(t);if(i){e.writeConcern=Object.assign({},e.writeConcern,i)}return e}function generateCredentials(e,t,r,n){n=Object.assign({},n);const o=n.authSource||n.authdb||n.dbName;const a=n.authMechanism||"DEFAULT";const c=a.toUpperCase();const l=n.authMechanismProperties;if(!C.has(c)){throw s.create({message:`authentication mechanism ${a} not supported', options.authMechanism`,driver:true})}return new i({mechanism:_[c],mechanismProperties:l,source:o,username:t,password:r})}function legacyTransformUrlOptions(e){return mergeOptions(createUnifiedOptions({},e),e,false)}function mergeOptions(e,t,r){for(const n in t){if(t[n]&&typeof t[n]==="object"&&r){e=mergeOptions(e,t[n],r)}else{e[n]=t[n]}}return e}function relayEvents(e,t){const r=["commandStarted","commandSucceeded","commandFailed","serverOpening","serverClosed","serverDescriptionChanged","serverHeartbeatStarted","serverHeartbeatSucceeded","serverHeartbeatFailed","topologyOpening","topologyClosed","topologyDescriptionChanged","joined","left","ping","ha"].concat(S);r.forEach((r=>{t.on(r,((t,n)=>{e.emit(r,t,n)}))}))}function replayEvents(e,t){for(let r=0;rt.domain_socket?new h(t.domain_socket,27017,e):new h(t.host,t.port,e)))}e.exports={validOptions:validOptions,connect:connect}},7885:(e,t,r)=>{"use strict";const n=r(2296).buildCountCommand;const o=r(1018).OperationBase;class CountOperation extends o{constructor(e,t,r){super(r);this.cursor=e;this.applySkipLimit=t}execute(e){const t=this.cursor;const r=this.applySkipLimit;const o=this.options;if(r){if(typeof t.cursorSkip()==="number")o.skip=t.cursorSkip();if(typeof t.cursorLimit()==="number")o.limit=t.cursorLimit()}if(o.readPreference){t.setReadPreference(o.readPreference)}if(typeof o.maxTimeMS!=="number"&&t.cmd&&typeof t.cmd.maxTimeMS==="number"){o.maxTimeMS=t.cmd.maxTimeMS}let i={};i.skip=o.skip;i.limit=o.limit;i.hint=o.hint;i.maxTimeMS=o.maxTimeMS;i.collectionName=t.namespace.collection;let s;try{s=n(t,t.cmd.query,i)}catch(t){return e(t)}t.server=t.topology.s.coreTopology;t.topology.command(t.namespace.withCollection("$cmd"),s,t.options,((t,r)=>{e(t,r?r.result.n:null)}))}}e.exports=CountOperation},5131:(e,t,r)=>{"use strict";const n=r(1554);class CountDocumentsOperation extends n{constructor(e,t,r){const n=[{$match:t}];if(typeof r.skip==="number"){n.push({$skip:r.skip})}if(typeof r.limit==="number"){n.push({$limit:r.limit})}n.push({$group:{_id:1,n:{$sum:1}}});super(e,n,r)}execute(e,t){super.execute(e,((e,r)=>{if(e){t(e,null);return}const n=r.result;if(n.cursor==null||n.cursor.firstBatch==null){t(null,0);return}const o=n.cursor.firstBatch;t(null,o.length?o[0].n:0)}))}}e.exports=CountDocumentsOperation},5561:(e,t,r)=>{"use strict";const n=r(1018).Aspect;const o=r(1018).defineAspects;const i=r(499);const s=r(1371).applyWriteConcern;const a=r(8275).loadCollection;const c=r(3994).MongoError;const l=r(3994).ReadPreference;const u=new Set(["w","wtimeout","j","fsync","autoIndexId","strict","serializeFunctions","pkFactory","raw","readPreference","session","readConcern","writeConcern"]);class CreateCollectionOperation extends i{constructor(e,t,r){super(e,r);this.name=t}_buildCommand(){const e=this.name;const t=this.options;const r={create:e};for(let e in t){if(t[e]!=null&&typeof t[e]!=="function"&&!u.has(e)){r[e]=t[e]}}return r}execute(e){const t=this.db;const r=this.name;const n=this.options;const o=a();let i=Object.assign({nameOnly:true,strict:false},n);i=s(i,{db:t},i);function done(i){if(i){return e(i)}try{e(null,new o(t,t.s.topology,t.databaseName,r,t.s.pkFactory,n))}catch(i){e(i)}}const u=i.strict;if(u){t.listCollections({name:r},i).setReadPreference(l.PRIMARY).toArray(((t,n)=>{if(t){return e(t)}if(n.length>0){return e(new c(`Collection ${r} already exists. Currently in strict mode.`))}super.execute(done)}));return}super.execute(done)}}o(CreateCollectionOperation,n.WRITE_OPERATION);e.exports=CreateCollectionOperation},6394:(e,t,r)=>{"use strict";const n=r(1018).Aspect;const o=r(1018).defineAspects;const i=r(1189);const s=r(3994).MongoError;const a=r(1371).parseIndexOptions;const c=r(1178).maxWireVersion;const l=new Set(["background","unique","name","partialFilterExpression","sparse","expireAfterSeconds","storageEngine","collation","weights","default_language","language_override","textIndexVersion","2dsphereIndexVersion","bits","min","max","bucketSize","wildcardProjection"]);class CreateIndexesOperation extends i{constructor(e,t,r,n){super(e,n);this.collection=t;if(!Array.isArray(r)||Array.isArray(r[0])){this.onlyReturnNameOfCreatedIndex=true;const e=a(r);const t=typeof n.name==="string"?n.name:e.name;const o={name:t,key:e.fieldHash};for(let e in n){if(l.has(e)){o[e]=n[e]}}this.indexes=[o];return}this.indexes=r}execute(e,t){const r=this.options;const n=this.indexes;const o=c(e);for(let r=0;r{if(e){t(e);return}t(null,this.onlyReturnNameOfCreatedIndex?n[0].name:r)}))}}o(CreateIndexesOperation,[n.WRITE_OPERATION,n.EXECUTE_WITH_SELECTION]);e.exports=CreateIndexesOperation},3554:(e,t,r)=>{"use strict";const n=r(6716).buildCountCommand;const o=r(1371).handleCallback;const i=r(3994).MongoError;const s=Array.prototype.push;const a=r(4847).CursorState;function count(e,t,r,o){if(t){if(typeof e.cursorSkip()==="number")r.skip=e.cursorSkip();if(typeof e.cursorLimit()==="number")r.limit=e.cursorLimit()}if(r.readPreference){e.setReadPreference(r.readPreference)}if(typeof r.maxTimeMS!=="number"&&e.cmd&&typeof e.cmd.maxTimeMS==="number"){r.maxTimeMS=e.cmd.maxTimeMS}let i={};i.skip=r.skip;i.limit=r.limit;i.hint=r.hint;i.maxTimeMS=r.maxTimeMS;i.collectionName=e.namespace.collection;let s;try{s=n(e,e.cmd.query,i)}catch(e){return o(e)}e.server=e.topology.s.coreTopology;e.topology.command(e.namespace.withCollection("$cmd"),s,e.options,((e,t)=>{o(e,t?t.result.n:null)}))}function each(e,t){if(!t)throw i.create({message:"callback is mandatory",driver:true});if(e.isNotified())return;if(e.s.state===a.CLOSED||e.isDead()){return o(t,i.create({message:"Cursor is closed",driver:true}))}if(e.s.state===a.INIT){e.s.state=a.OPEN}let r=null;if(e.bufferedCount()>0){while(r=loop(e,t))r(e,t);each(e,t)}else{e.next(((r,n)=>{if(r)return o(t,r);if(n==null){return e.close({skipKillCursors:true},(()=>o(t,null,null)))}if(o(t,null,n)===false)return;each(e,t)}))}}function loop(e,t){if(e.bufferedCount()===0)return;e._next(t);return loop}function toArray(e,t){const r=[];e.rewind();e.s.state=a.INIT;const fetchDocs=()=>{e._next(((n,i)=>{if(n){return o(t,n)}if(i==null){return e.close({skipKillCursors:true},(()=>o(t,null,r)))}r.push(i);if(e.bufferedCount()>0){let t=e.readBufferedDocuments(e.bufferedCount());if(e.s.transforms&&typeof e.s.transforms.doc==="function"){t=t.map(e.s.transforms.doc)}s.apply(r,t)}fetchDocs()}))};fetchDocs()}e.exports={count:count,each:each,toArray:toArray}},2226:(e,t,r)=>{"use strict";const n=r(1371).applyWriteConcern;const o=r(3994).BSON.Code;const i=r(1371).debugOptions;const s=r(1371).handleCallback;const a=r(3994).MongoError;const c=r(1371).parseIndexOptions;const l=r(3994).ReadPreference;const u=r(1371).toError;const d=r(147);const p=r(1371).MongoDBNamespace;const h=["authSource","w","wtimeout","j","native_parser","forceServerObjectId","serializeFunctions","raw","promoteLongs","promoteValues","promoteBuffers","bufferMaxEntries","numberOfRetries","retryMiliSeconds","readPreference","pkFactory","parentDb","promiseLibrary","noListener"];function createIndex(e,t,r,o,i){let c=Object.assign({},{readPreference:l.PRIMARY},o);c=n(c,{db:e},o);if(c.writeConcern&&typeof i!=="function"){throw a.create({message:"Cannot use a writeConcern without a provided callback",driver:true})}if(e.serverConfig&&e.serverConfig.isDestroyed())return i(new a("topology was destroyed"));createIndexUsingCreateIndexes(e,t,r,c,((n,l)=>{if(n==null)return s(i,n,l);if(n.code===67||n.code===11e3||n.code===85||n.code===86||n.code===11600||n.code===197){return s(i,n,l)}const u=createCreateIndexCommand(e,t,r,o);c.checkKeys=false;e.s.topology.insert(e.s.namespace.withCollection(d.SYSTEM_INDEX_COLLECTION),u,c,((e,t)=>{if(i==null)return;if(e)return s(i,e);if(t==null)return s(i,null,null);if(t.result.writeErrors)return s(i,a.create(t.result.writeErrors[0]),null);s(i,null,u.name)}))}))}function createListener(e,t,r){function listener(n){if(r.listeners(t).length>0){r.emit(t,n,e);for(let r=0;r{if(n!=null&&n.code!==26)return s(i,n,null);if(a==null||!a[d]){createIndex(e,t,r,o,i)}else{if(typeof i==="function")return s(i,null,d)}}))}function evaluate(e,t,r,n,i){let c=t;let u=[];if(e.serverConfig&&e.serverConfig.isDestroyed())return i(new a("topology was destroyed"));if(!(c&&c._bsontype==="Code"))c=new o(c);if(r!=null&&!Array.isArray(r)&&typeof r!=="function"){u=[r]}else if(r!=null&&Array.isArray(r)&&typeof r!=="function"){u=r}let d={$eval:c,args:u};if(n["nolock"]){d["nolock"]=n["nolock"]}n.readPreference=new l(l.PRIMARY);executeCommand(e,d,n,((e,t)=>{if(e)return s(i,e,null);if(t&&t.ok===1)return s(i,null,t.retval);if(t)return s(i,a.create({message:`eval failed: ${t.errmsg}`,driver:true}),null);s(i,e,t)}))}function executeCommand(e,t,r,n){if(e.serverConfig&&e.serverConfig.isDestroyed())return n(new a("topology was destroyed"));const o=r.dbName||r.authdb||e.databaseName;r.readPreference=l.resolve(e,r);if(e.s.logger.isDebug())e.s.logger.debug(`executing command ${JSON.stringify(t)} against ${o}.$cmd with options [${JSON.stringify(i(h,r))}]`);e.s.topology.command(e.s.namespace.withCollection("$cmd"),t,r,((e,t)=>{if(e)return s(n,e);if(r.full)return s(n,null,t);s(n,null,t.result)}))}function executeDbAdminCommand(e,t,r,n){const o=new p("admin","$cmd");e.s.topology.command(o,t,r,((t,r)=>{if(e.serverConfig&&e.serverConfig.isDestroyed()){return n(new a("topology was destroyed"))}if(t)return s(n,t);s(n,null,r.result)}))}function indexInformation(e,t,r,n){const o=r["full"]==null?false:r["full"];if(e.serverConfig&&e.serverConfig.isDestroyed())return n(new a("topology was destroyed"));function processResults(e){let t={};for(let r=0;r{if(e)return n(u(e));if(!Array.isArray(t))return s(n,null,[]);if(o)return s(n,null,t);s(n,null,processResults(t))}))}function profilingInfo(e,t,r){try{e.collection("system.profile").find({},t).toArray(r)}catch(e){return r(e,null)}}function validateDatabaseName(e){if(typeof e!=="string")throw a.create({message:"database name must be a string",driver:true});if(e.length===0)throw a.create({message:"database name cannot be the empty string",driver:true});if(e==="$external")return;const t=[" ",".","$","/","\\"];for(let r=0;r{if(e)return s(i,e,null);if(t.ok===0)return s(i,u(t),null);s(i,null,p)}))}e.exports={createListener:createListener,createIndex:createIndex,ensureIndex:ensureIndex,evaluate:evaluate,executeCommand:executeCommand,executeDbAdminCommand:executeDbAdminCommand,indexInformation:indexInformation,profilingInfo:profilingInfo,validateDatabaseName:validateDatabaseName}},323:(e,t,r)=>{"use strict";const n=r(1018).OperationBase;const o=r(2296).removeDocuments;const i=r(1018).Aspect;const s=r(1018).defineAspects;class DeleteManyOperation extends n{constructor(e,t,r){super(r);this.collection=e;this.filter=t}execute(e){const t=this.collection;const r=this.filter;const n=this.options;n.single=false;o(t,r,n,((t,r)=>{if(e==null)return;if(t&&e)return e(t);if(r==null)return e(null,{result:{ok:1}});if(this.explain)return e(undefined,r.result);r.deletedCount=r.result.n;e(null,r)}))}}s(DeleteManyOperation,[i.EXPLAINABLE]);e.exports=DeleteManyOperation},6352:(e,t,r)=>{"use strict";const n=r(1018).OperationBase;const o=r(2296).removeDocuments;const i=r(1018).Aspect;const s=r(1018).defineAspects;class DeleteOneOperation extends n{constructor(e,t,r){super(r);this.collection=e;this.filter=t}execute(e){const t=this.collection;const r=this.filter;const n=this.options;n.single=true;o(t,r,n,((t,r)=>{if(e==null)return;if(t&&e)return e(t);if(r==null)return e(null,{result:{ok:1}});if(this.explain)return e(undefined,r.result);r.deletedCount=r.result.n;e(null,r)}))}}s(DeleteOneOperation,[i.EXPLAINABLE]);e.exports=DeleteOneOperation},6469:(e,t,r)=>{"use strict";const n=r(1018).Aspect;const o=r(1018).defineAspects;const i=r(1189);const s=r(1371).decorateWithCollation;const a=r(1371).decorateWithReadConcern;const c=r(1178).maxWireVersion;const l=r(9386).MongoError;class DistinctOperation extends i{constructor(e,t,r,n){super(e,n);this.collection=e;this.key=t;this.query=r}execute(e,t){const r=this.collection;const n=this.key;const o=this.query;const i=this.options;const u={distinct:r.collectionName,key:n,query:o};if(typeof i.maxTimeMS==="number"){u.maxTimeMS=i.maxTimeMS}a(u,r,i);try{s(u,r,i)}catch(e){return t(e,null)}if(this.explain&&c(e)<4){t(new l(`server does not support explain on distinct`));return}super.executeCommand(e,u,((e,r)=>{if(e){t(e);return}t(null,this.options.full||this.explain?r:r.values)}))}}o(DistinctOperation,[n.READ_OPERATION,n.RETRYABLE,n.EXECUTE_WITH_SELECTION,n.EXPLAINABLE]);e.exports=DistinctOperation},2360:(e,t,r)=>{"use strict";const n=r(1018).Aspect;const o=r(499);const i=r(1018).defineAspects;const s=r(1371).handleCallback;class DropOperation extends o{constructor(e,t){const r=Object.assign({},t,e.s.options);if(t.session){r.session=t.session}super(e,r)}execute(e){super.execute(((t,r)=>{if(t)return s(e,t);if(r.ok)return s(e,null,true);s(e,null,false)}))}}i(DropOperation,n.WRITE_OPERATION);class DropCollectionOperation extends DropOperation{constructor(e,t,r){super(e,r);this.name=t;this.namespace=`${e.namespace}.${t}`}_buildCommand(){return{drop:this.name}}}class DropDatabaseOperation extends DropOperation{_buildCommand(){return{dropDatabase:1}}}e.exports={DropOperation:DropOperation,DropCollectionOperation:DropCollectionOperation,DropDatabaseOperation:DropDatabaseOperation}},3560:(e,t,r)=>{"use strict";const n=r(1018).Aspect;const o=r(1018).defineAspects;const i=r(499);const s=r(1371).applyWriteConcern;const a=r(1371).handleCallback;class DropIndexOperation extends i{constructor(e,t,r){super(e.s.db,r,e);this.collection=e;this.indexName=t}_buildCommand(){const e=this.collection;const t=this.indexName;const r=this.options;let n={dropIndexes:e.collectionName,index:t};n=s(n,{db:e.s.db,collection:e},r);return n}execute(e){super.execute(((t,r)=>{if(typeof e!=="function")return;if(t)return a(e,t,null);a(e,null,r)}))}}o(DropIndexOperation,n.WRITE_OPERATION);e.exports=DropIndexOperation},5328:(e,t,r)=>{"use strict";const n=r(1018).Aspect;const o=r(1018).defineAspects;const i=r(3560);const s=r(1371).handleCallback;class DropIndexesOperation extends i{constructor(e,t){super(e,"*",t)}execute(e){super.execute((t=>{if(t)return s(e,t,false);s(e,null,true)}))}}o(DropIndexesOperation,n.WRITE_OPERATION);e.exports=DropIndexesOperation},4451:(e,t,r)=>{"use strict";const n=r(1018).Aspect;const o=r(1018).defineAspects;const i=r(1189);class EstimatedDocumentCountOperation extends i{constructor(e,t,r){if(typeof r==="undefined"){r=t;t=undefined}super(e,r);this.collectionName=e.s.namespace.collection;if(t){this.query=t}}execute(e,t){const r=this.options;const n={count:this.collectionName};if(this.query){n.query=this.query}if(typeof r.skip==="number"){n.skip=r.skip}if(typeof r.limit==="number"){n.limit=r.limit}if(r.hint){n.hint=r.hint}super.executeCommand(e,n,((e,r)=>{if(e){t(e);return}t(null,r.n)}))}}o(EstimatedDocumentCountOperation,[n.READ_OPERATION,n.RETRYABLE,n.EXECUTE_WITH_SELECTION]);e.exports=EstimatedDocumentCountOperation},1681:(e,t,r)=>{"use strict";const n=r(1018).OperationBase;const o=r(1371).handleCallback;const i=r(3994).MongoError;const s=r(1371).MongoDBNamespace;class ExecuteDbAdminCommandOperation extends n{constructor(e,t,r){super(r);this.db=e;this.selector=t}execute(e){const t=this.db;const r=this.selector;const n=this.options;const a=new s("admin","$cmd");t.s.topology.command(a,r,n,((r,n)=>{if(t.serverConfig&&t.serverConfig.isDestroyed()){return e(new i("topology was destroyed"))}if(r)return o(e,r);o(e,null,n.result)}))}}e.exports=ExecuteDbAdminCommandOperation},2548:(e,t,r)=>{"use strict";const n=r(1371).maybePromise;const o=r(3111).MongoError;const i=r(1018).Aspect;const s=r(1018).OperationBase;const a=r(4485);const c=r(3111).isRetryableError;const l=r(1178).maxWireVersion;const u=r(1178).isUnifiedTopology;function executeOperation(e,t,r){if(e==null){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 n(e,r,(r=>{if(u(e)&&e.shouldCheckForSessionSupport()){return selectServerForSessionSupport(e,t,r)}let n,s;if(e.hasSessionSupport()){if(t.session==null){s=Symbol();n=e.startSession({owner:s});t.session=n}else if(t.session.hasEnded){return r(new o("Use of expired sessions is not permitted"))}}else if(t.session){return r(new o("Current topology does not support sessions"))}function executeCallback(e,o){if(n&&n.owner===s){n.endSession();if(t.session===n){t.clearSession()}}r(e,o)}try{if(t.hasAspect(i.EXECUTE_WITH_SELECTION)){executeWithServerSelection(e,t,executeCallback)}else{t.execute(executeCallback)}}catch(e){if(n&&n.owner===s){n.endSession();if(t.session===n){t.clearSession()}}r(e)}}))}function supportsRetryableReads(e){return l(e)>=6}function executeWithServerSelection(e,t,r){const n=t.readPreference||a.primary;const s=t.session&&t.session.inTransaction();if(s&&!n.equals(a.primary)){r(new o(`Read preference in a transaction must be primary, not: ${n.mode}`));return}const l={readPreference:n,session:t.session};function callbackWithRetry(n,o){if(n==null){return r(null,o)}if(!c(n)){return r(n)}e.selectServer(l,((e,n)=>{if(e||!supportsRetryableReads(n)){r(e,null);return}t.execute(n,r)}))}e.selectServer(l,((n,o)=>{if(n){r(n,null);return}const a=e.s.options.retryReads!==false&&t.session&&!s&&supportsRetryableReads(o)&&t.canRetryRead;if(t.hasAspect(i.RETRYABLE)&&a){t.execute(o,callbackWithRetry);return}t.execute(o,r)}))}function selectServerForSessionSupport(e,t,r){e.selectServer(a.primaryPreferred,(n=>{if(n){return r(n)}executeOperation(e,t,r)}))}e.exports=executeOperation},9961:(e,t,r)=>{"use strict";const n=r(1018).OperationBase;const o=r(1018).Aspect;const i=r(1018).defineAspects;const s=r(3994).ReadPreference;const a=r(1178).maxWireVersion;const c=r(3111).MongoError;class FindOperation extends n{constructor(e,t,r,n){super(n);this.ns=t;this.cmd=r;this.readPreference=s.resolve(e,this.options)}execute(e,t){this.server=e;this.readPreference=s.resolve(this,this.options);if(typeof this.cmd.allowDiskUse!=="undefined"&&a(e)<4){t(new c("The `allowDiskUse` option is not supported on MongoDB < 3.2"));return}if(this.explain){this.options.explain=this.explain.verbosity}const r=this.cursorState||{};e.query(this.ns.toString(),this.cmd,r,this.options,t)}}i(FindOperation,[o.READ_OPERATION,o.RETRYABLE,o.EXECUTE_WITH_SELECTION,o.EXPLAINABLE]);e.exports=FindOperation},711:(e,t,r)=>{"use strict";const n=r(1018).OperationBase;const o=r(1371).applyRetryableWrites;const i=r(1371).applyWriteConcern;const s=r(1371).decorateWithCollation;const a=r(2226).executeCommand;const c=r(1371).formattedOrderClause;const l=r(1371).handleCallback;const u=r(3994).ReadPreference;const d=r(1178).maxWireVersion;const p=r(9386).MongoError;const h=r(1018).Aspect;const m=r(1018).defineAspects;const g=r(1371).decorateWithExplain;class FindAndModifyOperation extends n{constructor(e,t,r,n,o){super(o);this.collection=e;this.query=t;this.sort=r;this.doc=n}execute(e){const t=this.collection;const r=this.query;const n=c(this.sort);const h=this.doc;let m=this.options;let y={findAndModify:t.collectionName,query:r};if(n){y.sort=n}y.new=m.new?true:false;y.remove=m.remove?true:false;y.upsert=m.upsert?true:false;const v=m.projection||m.fields;if(v){y.fields=v}if(m.arrayFilters){y.arrayFilters=m.arrayFilters}if(h&&!m.remove){y.update=h}if(m.maxTimeMS)y.maxTimeMS=m.maxTimeMS;m.serializeFunctions=m.serializeFunctions||t.s.serializeFunctions;m.checkKeys=false;m=o(m,t.s.db);m=i(m,{db:t.s.db,collection:t},m);if(m.writeConcern){y.writeConcern=m.writeConcern}if(m.bypassDocumentValidation===true){y.bypassDocumentValidation=m.bypassDocumentValidation}m.readPreference=u.primary;try{s(y,t,m)}catch(t){return e(t,null)}if(m.hint){const r=m.writeConcern&&m.writeConcern.w===0;if(r||d(t.s.topology)<8){e(new p("The current topology does not support a hint on findAndModify commands"));return}y.hint=m.hint}if(this.explain){if(d(t.s.topology)<4){e(new p(`server does not support explain on findAndModify`));return}y=g(y,this.explain)}a(t.s.db,y,m,((t,r)=>{if(t)return l(e,t,null);return l(e,null,r)}))}}m(FindAndModifyOperation,[h.EXPLAINABLE]);e.exports=FindAndModifyOperation},4497:(e,t,r)=>{"use strict";const n=r(1371).handleCallback;const o=r(1018).OperationBase;const i=r(1371).toError;const s=r(1018).Aspect;const a=r(1018).defineAspects;class FindOneOperation extends o{constructor(e,t,r){super(r);this.collection=e;this.query=t}execute(e){const t=this.collection;const r=this.query;const o=this.options;try{const s=t.find(r,o).limit(-1).batchSize(1);s.next(((t,r)=>{if(t!=null)return n(e,i(t),null);n(e,null,r)}))}catch(t){e(t)}}}a(FindOneOperation,[s.EXPLAINABLE]);e.exports=FindOneOperation},5841:(e,t,r)=>{"use strict";const n=r(711);class FindOneAndDeleteOperation extends n{constructor(e,t,r){const n=Object.assign({},r);n.fields=r.projection;n.remove=true;if(t==null||typeof t!=="object"){throw new TypeError("Filter parameter must be an object")}super(e,t,n.sort,null,n)}}e.exports=FindOneAndDeleteOperation},4316:(e,t,r)=>{"use strict";const n=r(3994).MongoError;const o=r(711);const i=r(1371).hasAtomicOperators;class FindOneAndReplaceOperation extends o{constructor(e,t,r,o){if("returnDocument"in o&&"returnOriginal"in o){throw new n("findOneAndReplace option returnOriginal is deprecated in favor of returnDocument and cannot be combined")}const s=Object.assign({},o);s.fields=o.projection;s.update=true;s.new=o.returnDocument==="after"||o.returnOriginal===false;s.upsert=o.upsert===true;if(t==null||typeof t!=="object"){throw new TypeError("Filter parameter must be an object")}if(r==null||typeof r!=="object"){throw new TypeError("Replacement parameter must be an object")}if(i(r)){throw new TypeError("Replacement document must not contain atomic operators")}super(e,t,s.sort,r,s)}}e.exports=FindOneAndReplaceOperation},1925:(e,t,r)=>{"use strict";const n=r(3994).MongoError;const o=r(711);const i=r(1371).hasAtomicOperators;class FindOneAndUpdateOperation extends o{constructor(e,t,r,o){if("returnDocument"in o&&"returnOriginal"in o){throw new n("findOneAndUpdate option returnOriginal is deprecated in favor of returnDocument and cannot be combined")}const s=Object.assign({},o);s.fields=o.projection;s.update=true;s.new=o.returnDocument==="after"||o.returnOriginal===false;s.upsert=o.upsert===true;if(t==null||typeof t!=="object"){throw new TypeError("Filter parameter must be an object")}if(r==null||typeof r!=="object"){throw new TypeError("Update parameter must be an object")}if(!i(r)){throw new TypeError("Update document requires atomic operators")}super(e,t,s.sort,r,s)}}e.exports=FindOneAndUpdateOperation},8169:(e,t,r)=>{"use strict";const n=r(1018).Aspect;const o=r(1018).defineAspects;const i=r(1018).OperationBase;const s=r(1371).decorateCommand;const a=r(1371).decorateWithReadConcern;const c=r(2226).executeCommand;const l=r(1371).handleCallback;const u=r(3994).ReadPreference;const d=r(1371).toError;class GeoHaystackSearchOperation extends i{constructor(e,t,r,n){super(n);this.collection=e;this.x=t;this.y=r}execute(e){const t=this.collection;const r=this.x;const n=this.y;let o=this.options;let i={geoSearch:t.collectionName,near:[r,n]};i=s(i,o,["readPreference","session"]);o=Object.assign({},o);o.readPreference=u.resolve(t,o);a(i,t,o);c(t.s.db,i,o,((t,r)=>{if(t)return l(e,t);if(r.err||r.errmsg)l(e,d(r));l(e,null,r)}))}}o(GeoHaystackSearchOperation,n.READ_OPERATION);e.exports=GeoHaystackSearchOperation},7809:(e,t,r)=>{"use strict";const n=r(1018).OperationBase;const o=r(1371).handleCallback;const i=r(2226).indexInformation;class IndexExistsOperation extends n{constructor(e,t,r){super(r);this.collection=e;this.indexes=t}execute(e){const t=this.collection;const r=this.indexes;const n=this.options;i(t.s.db,t.collectionName,n,((t,n)=>{if(t!=null)return o(e,t,null);if(!Array.isArray(r))return o(e,null,n[r]!=null);for(let t=0;t{"use strict";const n=r(1018).OperationBase;const o=r(2296).indexInformation;class IndexInformationOperation extends n{constructor(e,t,r){super(r);this.db=e;this.name=t}execute(e){const t=this.db;const r=this.name;const n=this.options;o(t,r,n,e)}}e.exports=IndexInformationOperation},4218:(e,t,r)=>{"use strict";const n=r(1018).OperationBase;const o=r(2296).indexInformation;class IndexesOperation extends n{constructor(e,t){super(t);this.collection=e}execute(e){const t=this.collection;let r=this.options;r=Object.assign({},{full:true},r);o(t.s.db,t.collectionName,r,e)}}e.exports=IndexesOperation},3592:(e,t,r)=>{"use strict";const n=r(1018).OperationBase;const o=r(6976);const i=r(3994).MongoError;const s=r(2296).prepareDocs;class InsertManyOperation extends n{constructor(e,t,r){super(r);this.collection=e;this.docs=t}execute(e){const t=this.collection;let r=this.docs;const n=this.options;if(!Array.isArray(r)){return e(i.create({message:"docs parameter must be an array of documents",driver:true}))}n["serializeFunctions"]=n["serializeFunctions"]||t.s.serializeFunctions;r=s(t,r,n);const a=r.map((e=>({insertOne:{document:e}})));const c=new o(t,a,n);c.execute(((t,n)=>{if(t)return e(t,null);e(null,mapInsertManyResults(r,n))}))}}function mapInsertManyResults(e,t){const r={result:{ok:1,n:t.insertedCount},ops:e,insertedCount:t.insertedCount,insertedIds:t.insertedIds};if(t.getLastOp()){r.result.opTime=t.getLastOp()}return r}e.exports=InsertManyOperation},9915:(e,t,r)=>{"use strict";const n=r(3994).MongoError;const o=r(1018).OperationBase;const i=r(2296).insertDocuments;class InsertOneOperation extends o{constructor(e,t,r){super(r);this.collection=e;this.doc=t}execute(e){const t=this.collection;const r=this.doc;const o=this.options;if(Array.isArray(r)){return e(n.create({message:"doc parameter must be an object",driver:true}))}i(t,[r],o,((t,n)=>{if(e==null)return;if(t&&e)return e(t);if(n==null)return e(null,{result:{ok:1}});n.insertedCount=n.result.n;n.insertedId=r._id;if(e)e(null,n)}))}}e.exports=InsertOneOperation},4956:(e,t,r)=>{"use strict";const n=r(43);const o=r(1371).handleCallback;class IsCappedOperation extends n{constructor(e,t){super(e,t)}execute(e){super.execute(((t,r)=>{if(t)return o(e,t);o(e,null,!!(r&&r.capped))}))}}e.exports=IsCappedOperation},840:(e,t,r)=>{"use strict";const n=r(1189);const o=r(1018).Aspect;const i=r(1018).defineAspects;const s=r(1178).maxWireVersion;const a=r(147);const c=3;function listCollectionsTransforms(e){const t=`${e}.`;return{doc:e=>{const r=e.name.indexOf(t);if(e.name&&r===0){e.name=e.name.substr(r+t.length)}return e}}}class ListCollectionsOperation extends n{constructor(e,t,r){super(e,r,{fullResponse:true});this.db=e;this.filter=t;this.nameOnly=!!this.options.nameOnly;if(typeof this.options.batchSize==="number"){this.batchSize=this.options.batchSize}}execute(e,t){if(s(e){if(r&&r.message&&r.message.documents&&Array.isArray(r.message.documents)){r.message.documents=r.message.documents.map(o.doc)}t(e,r)}));return}const r={listCollections:1,filter:this.filter,cursor:this.batchSize?{batchSize:this.batchSize}:{},nameOnly:this.nameOnly};return super.executeCommand(e,r,t)}}i(ListCollectionsOperation,[o.READ_OPERATION,o.RETRYABLE,o.EXECUTE_WITH_SELECTION]);e.exports=ListCollectionsOperation},9929:(e,t,r)=>{"use strict";const n=r(1189);const o=r(1018).Aspect;const i=r(1018).defineAspects;const s=r(1371).MongoDBNamespace;class ListDatabasesOperation extends n{constructor(e,t){super(e,t);this.ns=new s("admin","$cmd")}execute(e,t){const r={listDatabases:1};if(this.options.nameOnly){r.nameOnly=Number(r.nameOnly)}if(this.options.filter){r.filter=this.options.filter}if(typeof this.options.authorizedDatabases==="boolean"){r.authorizedDatabases=this.options.authorizedDatabases}super.executeCommand(e,r,t)}}i(ListDatabasesOperation,[o.READ_OPERATION,o.RETRYABLE,o.EXECUTE_WITH_SELECTION]);e.exports=ListDatabasesOperation},28:(e,t,r)=>{"use strict";const n=r(1189);const o=r(1018).Aspect;const i=r(1018).defineAspects;const s=r(1178).maxWireVersion;const a=3;class ListIndexesOperation extends n{constructor(e,t){super(e,t,{fullResponse:true});this.collectionNamespace=e.s.namespace}execute(e,t){const r=s(e);if(r{"use strict";const n=r(1371).applyWriteConcern;const o=r(3994).BSON.Code;const i=r(1371).decorateWithCollation;const s=r(1371).decorateWithReadConcern;const a=r(2226).executeCommand;const c=r(1371).handleCallback;const l=r(1371).isObject;const u=r(8275).loadDb;const d=r(1018).OperationBase;const p=r(3994).ReadPreference;const h=r(1371).toError;const m=r(1018).Aspect;const g=r(1018).defineAspects;const y=r(1371).decorateWithExplain;const v=r(1178).maxWireVersion;const b=r(9386).MongoError;const S=["explain","readPreference","session","bypassDocumentValidation","w","wtimeout","j","writeConcern"];class MapReduceOperation extends d{constructor(e,t,r,n){super(n);this.collection=e;this.map=t;this.reduce=r}execute(e){const t=this.collection;const r=this.map;const o=this.reduce;let l=this.options;let d={mapReduce:t.collectionName,map:r,reduce:o};for(let e in l){if("scope"===e){d[e]=processScope(l[e])}else{if(S.indexOf(e)===-1){d[e]=l[e]}}}l=Object.assign({},l);l.readPreference=p.resolve(t,l);if(l.readPreference!==false&&l.readPreference!=="primary"&&l["out"]&&l["out"].inline!==1&&l["out"]!=="inline"){l.readPreference="primary";n(d,{db:t.s.db,collection:t},l)}else{s(d,t,l)}if(l.bypassDocumentValidation===true){d.bypassDocumentValidation=l.bypassDocumentValidation}try{i(d,t,l)}catch(t){return e(t,null)}if(this.explain){if(v(t.s.topology)<9){e(new b(`server does not support explain on mapReduce`));return}d=y(d,this.explain)}a(t.s.db,d,l,((r,n)=>{if(r)return c(e,r);if(1!==n.ok||n.err||n.errmsg){return c(e,h(n))}if(this.explain)return e(undefined,n);const o={};if(n.timeMillis)o["processtime"]=n.timeMillis;if(n.counts)o["counts"]=n.counts;if(n.timing)o["timing"]=n.timing;if(n.results){if(l["verbose"]==null||!l["verbose"]){return c(e,null,n.results)}return c(e,null,{results:n.results,stats:o})}let i=null;if(n.result!=null&&typeof n.result==="object"){const e=n.result;let r=u();i=new r(e.db,t.s.db.s.topology,t.s.db.s.options).collection(e.collection)}else{i=t.s.db.collection(n.result)}if(l["verbose"]==null||!l["verbose"]){return c(e,r,i)}c(e,r,{collection:i,stats:o})}))}}function processScope(e){if(!l(e)||e._bsontype==="ObjectID"){return e}const t=Object.keys(e);let r;const n={};for(let i=t.length-1;i>=0;i--){r=t[i];if("function"===typeof e[r]){n[r]=new o(String(e[r]))}else{n[r]=processScope(e[r])}}return n}g(MapReduceOperation,[m.EXPLAINABLE]);e.exports=MapReduceOperation},1018:(e,t,r)=>{"use strict";const n=r(5293).Explain;const o=r(3111).MongoError;const 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")};class OperationBase{constructor(e){this.options=Object.assign({},e);if(this.hasAspect(i.EXPLAINABLE)){this.explain=n.fromOptions(e)}else if(this.options.explain!==undefined){throw new o(`explain is not supported on this command`)}}hasAspect(e){if(this.constructor.aspects==null){return false}return 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 true}execute(){throw new TypeError("`execute` must be implemented for OperationBase subclasses")}}function defineAspects(e,t){if(!Array.isArray(t)&&!(t instanceof Set)){t=[t]}t=new Set(t);Object.defineProperty(e,"aspects",{value:t,writable:false});return t}e.exports={Aspect:i,defineAspects:defineAspects,OperationBase:OperationBase}},43:(e,t,r)=>{"use strict";const n=r(1018).OperationBase;const o=r(1371).handleCallback;const i=r(3994).MongoError;class OptionsOperation extends n{constructor(e,t){super(t);this.collection=e}execute(e){const t=this.collection;const r=this.options;t.s.db.listCollections({name:t.collectionName},r).toArray(((r,n)=>{if(r)return o(e,r);if(n.length===0){return o(e,i.create({message:`collection ${t.namespace} not found`,driver:true}))}o(e,r,n[0].options||null)}))}}e.exports=OptionsOperation},3969:(e,t,r)=>{"use strict";const n=r(499);class ProfilingLevelOperation extends n{constructor(e,t,r){super(e,r)}_buildCommand(){const e={profile:-1};return e}execute(e){super.execute(((t,r)=>{if(t==null&&r.ok===1){const t=r.was;if(t===0)return e(null,"off");if(t===1)return e(null,"slow_only");if(t===2)return e(null,"all");return e(new Error("Error: illegal profiling level value "+t),null)}else{t!=null?e(t,null):e(new Error("Error with profile command"),null)}}))}}e.exports=ProfilingLevelOperation},6331:(e,t,r)=>{"use strict";const n=r(1018).Aspect;const o=r(1018).defineAspects;const i=r(1189);const s=r(2291).serverType;const a=r(2291).ServerType;const c=r(3994).MongoError;class ReIndexOperation extends i{constructor(e,t){super(e,t);this.collectionName=e.collectionName}execute(e,t){if(s(e)!==a.Standalone){t(new c(`reIndex can only be executed on standalone servers.`));return}super.executeCommand(e,{reIndex:this.collectionName},((e,r)=>{if(e){t(e);return}t(null,!!r.ok)}))}}o(ReIndexOperation,[n.EXECUTE_WITH_SELECTION]);e.exports=ReIndexOperation},1969:(e,t,r)=>{"use strict";const n=r(1018).Aspect;const o=r(499);const i=r(1018).defineAspects;const s=r(1371).handleCallback;const a=r(2481);class RemoveUserOperation extends o{constructor(e,t,r){const n={};const o=a.fromOptions(r);if(o!=null){n.writeConcern=o}if(r.dbName){n.dbName=r.dbName}if(typeof r.maxTimeMS==="number"){n.maxTimeMS=r.maxTimeMS}super(e,n);this.username=t}_buildCommand(){const e=this.username;const t={dropUser:e};return t}execute(e){super.execute(((t,r)=>{if(t)return s(e,t,null);s(e,t,r.ok?true:false)}))}}i(RemoveUserOperation,n.WRITE_OPERATION);e.exports=RemoveUserOperation},2808:(e,t,r)=>{"use strict";const n=r(1018).OperationBase;const o=r(1371).applyWriteConcern;const i=r(1371).checkCollectionName;const s=r(2226).executeDbAdminCommand;const a=r(1371).handleCallback;const c=r(8275).loadCollection;const l=r(1371).toError;class RenameOperation extends n{constructor(e,t,r){super(r);this.collection=e;this.newName=t}execute(e){const t=this.collection;const r=this.newName;const n=this.options;let u=c();i(r);const d=t.namespace;const p=t.s.namespace.withCollection(r).toString();const h=typeof n.dropTarget==="boolean"?n.dropTarget:false;const m={renameCollection:d,to:p,dropTarget:h};o(m,{db:t.s.db,collection:t},n);s(t.s.db.admin().s.db,m,n,((n,o)=>{if(n)return a(e,n,null);if(o.errmsg)return a(e,l(o),null);try{return a(e,null,new u(t.s.db,t.s.topology,t.s.namespace.db,r,t.s.pkFactory,t.s.options))}catch(n){return a(e,l(n),null)}}))}}e.exports=RenameOperation},2508:(e,t,r)=>{"use strict";const n=r(1018).OperationBase;const o=r(2296).updateDocuments;const i=r(1371).hasAtomicOperators;class ReplaceOneOperation extends n{constructor(e,t,r,n){super(n);if(i(r)){throw new TypeError("Replacement document must not contain atomic operators")}this.collection=e;this.filter=t;this.replacement=r}execute(e){const t=this.collection;const r=this.filter;const n=this.replacement;const i=this.options;i.multi=false;o(t,r,n,i,((t,r)=>replaceCallback(t,r,n,e)))}}function replaceCallback(e,t,r,n){if(n==null)return;if(e&&n)return n(e);if(t==null)return n(null,{result:{ok:1}});t.modifiedCount=t.result.nModified!=null?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=[r];if(n)n(null,t)}e.exports=ReplaceOneOperation},1363:(e,t,r)=>{"use strict";const n=r(1189);const o=r(1018).defineAspects;const i=r(1018).Aspect;class RunCommandOperation extends n{constructor(e,t,r){super(e,r);this.command=t}execute(e,t){const r=this.command;this.executeCommand(e,r,t)}}o(RunCommandOperation,[i.EXECUTE_WITH_SELECTION,i.NO_INHERIT_OPTIONS]);e.exports=RunCommandOperation},6301:(e,t,r)=>{"use strict";const n=r(499);const o=new Set(["off","slow_only","all"]);class SetProfilingLevelOperation extends n{constructor(e,t,r){let n=0;if(t==="off"){n=0}else if(t==="slow_only"){n=1}else if(t==="all"){n=2}super(e,r);this.level=t;this.profile=n}_buildCommand(){const e=this.profile;const t={profile:e};return t}execute(e){const t=this.level;if(!o.has(t)){return e(new Error("Error: illegal profiling level value "+t))}super.execute(((r,n)=>{if(r==null&&n.ok===1)return e(null,t);return r!=null?e(r,null):e(new Error("Error with profile command"),null)}))}}e.exports=SetProfilingLevelOperation},968:(e,t,r)=>{"use strict";const n=r(1018).Aspect;const o=r(499);const i=r(1018).defineAspects;class StatsOperation extends o{constructor(e,t){super(e.s.db,t,e)}_buildCommand(){const e=this.collection;const t=this.options;const r={collStats:e.collectionName};if(t["scale"]!=null){r["scale"]=t["scale"]}return r}}i(StatsOperation,n.READ_OPERATION);e.exports=StatsOperation},9350:(e,t,r)=>{"use strict";const n=r(1018).OperationBase;const o=r(2296).updateDocuments;const i=r(1371).hasAtomicOperators;const s=r(1018).Aspect;const a=r(1018).defineAspects;class UpdateManyOperation extends n{constructor(e,t,r,n){super(n);if(!i(r)){throw new TypeError("Update document requires atomic operators")}this.collection=e;this.filter=t;this.update=r}execute(e){const t=this.collection;const r=this.filter;const n=this.update;const i=this.options;i.multi=true;o(t,r,n,i,((t,r)=>{if(e==null)return;if(t)return e(t);if(r==null)return e(null,{result:{ok:1}});if(this.explain)return e(undefined,r.result);r.modifiedCount=r.result.nModified!=null?r.result.nModified:r.result.n;r.upsertedId=Array.isArray(r.result.upserted)&&r.result.upserted.length>0?r.result.upserted[0]:null;r.upsertedCount=Array.isArray(r.result.upserted)&&r.result.upserted.length?r.result.upserted.length:0;r.matchedCount=Array.isArray(r.result.upserted)&&r.result.upserted.length>0?0:r.result.n;e(null,r)}))}}a(UpdateManyOperation,[s.EXPLAINABLE]);e.exports=UpdateManyOperation},9068:(e,t,r)=>{"use strict";const n=r(1018).OperationBase;const o=r(2296).updateDocuments;const i=r(1371).hasAtomicOperators;const s=r(1018).Aspect;const a=r(1018).defineAspects;class UpdateOneOperation extends n{constructor(e,t,r,n){super(n);if(!i(r)){throw new TypeError("Update document requires atomic operators")}this.collection=e;this.filter=t;this.update=r}execute(e){const t=this.collection;const r=this.filter;const n=this.update;const i=this.options;i.multi=false;o(t,r,n,i,((t,r)=>{if(e==null)return;if(t)return e(t);if(r==null)return e(null,{result:{ok:1}});if(this.explain)return e(undefined,r.result);r.modifiedCount=r.result.nModified!=null?r.result.nModified:r.result.n;r.upsertedId=Array.isArray(r.result.upserted)&&r.result.upserted.length>0?r.result.upserted[0]:null;r.upsertedCount=Array.isArray(r.result.upserted)&&r.result.upserted.length?r.result.upserted.length:0;r.matchedCount=Array.isArray(r.result.upserted)&&r.result.upserted.length>0?0:r.result.n;e(null,r)}))}}a(UpdateOneOperation,[s.EXPLAINABLE]);e.exports=UpdateOneOperation},9263:(e,t,r)=>{"use strict";const n=r(499);class ValidateCollectionOperation extends n{constructor(e,t,r){let n={validate:t};const o=Object.keys(r);for(let e=0;e{if(r!=null)return e(r,null);if(n.ok===0)return e(new Error("Error with validate command"),null);if(n.result!=null&&n.result.constructor!==String)return e(new Error("Error with validation data"),null);if(n.result!=null&&n.result.match(/exception|corrupt/)!=null)return e(new Error("Error: invalid collection "+t),null);if(n.valid!=null&&!n.valid)return e(new Error("Error: invalid collection "+t),null);return e(null,n)}))}}e.exports=ValidateCollectionOperation},7289:e=>{"use strict";class ReadConcern{constructor(e){if(e!=null){this.level=e}}static fromOptions(e){if(e==null){return}if(e.readConcern){if(e.readConcern instanceof ReadConcern){return e.readConcern}return new ReadConcern(e.readConcern.level)}if(e.level){return new ReadConcern(e.level)}}static get MAJORITY(){return"majority"}static get AVAILABLE(){return"available"}static get LINEARIZABLE(){return"linearizable"}static get SNAPSHOT(){return"snapshot"}}e.exports=ReadConcern},2048:(e,t,r)=>{"use strict";const n=r(8589).oF;const o=r(3994).MongoError;const i=r(3994).Mongos;const s=r(7159);const a=r(8421);const c=r(8589).yh;const l=r(1371).MAX_JS_INT;const u=r(1371).translateOptions;const d=r(1371).filterOptions;const p=r(1371).mergeOptions;var h=["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 Mongos extends n{constructor(e,t){super();t=t||{};var r=this;t=d(t,h);for(var n=0;n0?t.socketOptions:t;b=u(b,S);this.s={coreTopology:new i(y,b),sCapabilities:null,debug:b.debug,storeOptions:m,clonedOptions:b,store:g,options:t,sessionPool:null,sessions:new Set,promiseLibrary:t.promiseLibrary||Promise}}connect(e,t){var r=this;if("function"===typeof e)t=e,e={};if(e==null)e={};if(!("function"===typeof t))t=null;e=Object.assign({},this.s.clonedOptions,e);r.s.options=e;r.s.storeOptions.bufferMaxEntries=typeof e.bufferMaxEntries==="number"?e.bufferMaxEntries:-1;var connectErrorHandler=function(){return function(e){var n=["timeout","error","close"];n.forEach((function(e){r.removeListener(e,connectErrorHandler)}));r.s.coreTopology.removeListener("connect",connectErrorHandler);r.close(true);try{t(e)}catch(e){process.nextTick((function(){throw e}))}}};var errorHandler=function(e){return function(t){if(e!=="error"){r.emit(e,t)}}};var reconnectHandler=function(){r.emit("reconnect");r.s.store.execute()};var relay=function(e){return function(t,n){r.emit(e,t,n)}};var connectHandler=function(){var e=["timeout","error","close","fullsetup"];e.forEach((function(e){r.s.coreTopology.removeAllListeners(e)}));r.s.coreTopology.on("timeout",errorHandler("timeout"));r.s.coreTopology.on("error",errorHandler("error"));r.s.coreTopology.on("close",errorHandler("close"));r.s.coreTopology.on("fullsetup",(function(){r.emit("fullsetup",r)}));r.emit("open",null,r);try{t(null,r)}catch(e){process.nextTick((function(){throw e}))}};var n=["timeout","error","close","serverOpening","serverDescriptionChanged","serverHeartbeatStarted","serverHeartbeatSucceeded","serverHeartbeatFailed","serverClosed","topologyOpening","topologyClosed","topologyDescriptionChanged","commandStarted","commandSucceeded","commandFailed"];n.forEach((function(e){r.s.coreTopology.removeAllListeners(e)}));r.s.coreTopology.on("serverDescriptionChanged",relay("serverDescriptionChanged"));r.s.coreTopology.on("serverHeartbeatStarted",relay("serverHeartbeatStarted"));r.s.coreTopology.on("serverHeartbeatSucceeded",relay("serverHeartbeatSucceeded"));r.s.coreTopology.on("serverHeartbeatFailed",relay("serverHeartbeatFailed"));r.s.coreTopology.on("serverOpening",relay("serverOpening"));r.s.coreTopology.on("serverClosed",relay("serverClosed"));r.s.coreTopology.on("topologyOpening",relay("topologyOpening"));r.s.coreTopology.on("topologyClosed",relay("topologyClosed"));r.s.coreTopology.on("topologyDescriptionChanged",relay("topologyDescriptionChanged"));r.s.coreTopology.on("commandStarted",relay("commandStarted"));r.s.coreTopology.on("commandSucceeded",relay("commandSucceeded"));r.s.coreTopology.on("commandFailed",relay("commandFailed"));r.s.coreTopology.once("timeout",connectErrorHandler("timeout"));r.s.coreTopology.once("error",connectErrorHandler("error"));r.s.coreTopology.once("close",connectErrorHandler("close"));r.s.coreTopology.once("connect",connectHandler);r.s.coreTopology.on("joined",relay("joined"));r.s.coreTopology.on("left",relay("left"));r.s.coreTopology.on("reconnect",reconnectHandler);r.s.coreTopology.connect(e)}}Object.defineProperty(Mongos.prototype,"haInterval",{enumerable:true,get:function(){return this.s.coreTopology.s.haInterval}});e.exports=Mongos},2632:(e,t,r)=>{"use strict";const n=r(3994).Topology;const o=r(8589).ug;const i=r(7159);const s=r(1371).translateOptions;class NativeTopology extends n{constructor(e,t){t=t||{};let r=Object.assign({},{cursorFactory:i,reconnect:false,emitError:typeof t.emitError==="boolean"?t.emitError:true,maxPoolSize:typeof t.maxPoolSize==="number"?t.maxPoolSize:typeof t.poolSize==="number"?t.poolSize:10,minPoolSize:typeof t.minPoolSize==="number"?t.minPoolSize:typeof t.minSize==="number"?t.minSize:0,monitorCommands:typeof t.monitorCommands==="boolean"?t.monitorCommands:false});r=s(r,t);var n=t.socketOptions&&Object.keys(t.socketOptions).length>0?t.socketOptions:t;r=s(r,n);super(e,r)}capabilities(){if(this.s.sCapabilities)return this.s.sCapabilities;if(this.lastIsMaster()==null)return null;this.s.sCapabilities=new o(this.lastIsMaster());return this.s.sCapabilities}command(e,t,r,n){super.command(e.toString(),t,r,n)}insert(e,t,r,n){super.insert(e.toString(),t,r,n)}update(e,t,r,n){super.update(e.toString(),t,r,n)}remove(e,t,r,n){super.remove(e.toString(),t,r,n)}}e.exports=NativeTopology},382:(e,t,r)=>{"use strict";const n=r(8421);const o=r(7159);const i=r(3994).MongoError;const s=r(8589).oF;const a=r(8589).yh;const c=r(3994).ReplSet;const l=r(1371).MAX_JS_INT;const u=r(1371).translateOptions;const d=r(1371).filterOptions;const p=r(1371).mergeOptions;var h=["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 ReplSet extends s{constructor(e,t){super();t=t||{};var r=this;t=d(t,h);for(var s=0;s0?t.socketOptions:t;v=u(v,b);var S=new c(y,v);S.on("reconnect",(function(){r.emit("reconnect");g.execute()}));this.s={coreTopology:S,sCapabilities:null,tag:t.tag,storeOptions:m,clonedOptions:v,store:g,options:t,sessionPool:null,sessions:new Set,promiseLibrary:t.promiseLibrary||Promise};if(v.debug){Object.defineProperty(this,"replset",{enumerable:true,get:function(){return S}})}}connect(e,t){var r=this;if("function"===typeof e)t=e,e={};if(e==null)e={};if(!("function"===typeof t))t=null;e=Object.assign({},this.s.clonedOptions,e);r.s.options=e;r.s.storeOptions.bufferMaxEntries=typeof e.bufferMaxEntries==="number"?e.bufferMaxEntries:-1;var errorHandler=function(e){return function(t){if(e!=="error"){r.emit(e,t)}}};var n=["timeout","error","close","serverOpening","serverDescriptionChanged","serverHeartbeatStarted","serverHeartbeatSucceeded","serverHeartbeatFailed","serverClosed","topologyOpening","topologyClosed","topologyDescriptionChanged","commandStarted","commandSucceeded","commandFailed","joined","left","ping","ha"];n.forEach((function(e){r.s.coreTopology.removeAllListeners(e)}));var relay=function(e){return function(t,n){r.emit(e,t,n)}};var replsetRelay=function(e){return function(t,n){r.emit(e,t,n.lastIsMaster(),n)}};var relayHa=function(e,t){r.emit("ha",e,t);if(e==="start"){r.emit("ha_connect",e,t)}else if(e==="end"){r.emit("ha_ismaster",e,t)}};r.s.coreTopology.on("joined",replsetRelay("joined"));r.s.coreTopology.on("left",relay("left"));r.s.coreTopology.on("ping",relay("ping"));r.s.coreTopology.on("ha",relayHa);r.s.coreTopology.on("serverDescriptionChanged",relay("serverDescriptionChanged"));r.s.coreTopology.on("serverHeartbeatStarted",relay("serverHeartbeatStarted"));r.s.coreTopology.on("serverHeartbeatSucceeded",relay("serverHeartbeatSucceeded"));r.s.coreTopology.on("serverHeartbeatFailed",relay("serverHeartbeatFailed"));r.s.coreTopology.on("serverOpening",relay("serverOpening"));r.s.coreTopology.on("serverClosed",relay("serverClosed"));r.s.coreTopology.on("topologyOpening",relay("topologyOpening"));r.s.coreTopology.on("topologyClosed",relay("topologyClosed"));r.s.coreTopology.on("topologyDescriptionChanged",relay("topologyDescriptionChanged"));r.s.coreTopology.on("commandStarted",relay("commandStarted"));r.s.coreTopology.on("commandSucceeded",relay("commandSucceeded"));r.s.coreTopology.on("commandFailed",relay("commandFailed"));r.s.coreTopology.on("fullsetup",(function(){r.emit("fullsetup",r,r)}));r.s.coreTopology.on("all",(function(){r.emit("all",null,r)}));var connectHandler=function(){r.s.coreTopology.once("timeout",errorHandler("timeout"));r.s.coreTopology.once("error",errorHandler("error"));r.s.coreTopology.once("close",errorHandler("close"));r.emit("open",null,r);try{t(null,r)}catch(e){process.nextTick((function(){throw e}))}};var connectErrorHandler=function(){return function(e){["timeout","error","close"].forEach((function(e){r.s.coreTopology.removeListener(e,connectErrorHandler)}));r.s.coreTopology.removeListener("connect",connectErrorHandler);r.s.coreTopology.destroy();try{t(e)}catch(e){if(!r.s.coreTopology.isConnected())process.nextTick((function(){throw e}))}}};r.s.coreTopology.once("timeout",connectErrorHandler("timeout"));r.s.coreTopology.once("error",connectErrorHandler("error"));r.s.coreTopology.once("close",connectErrorHandler("close"));r.s.coreTopology.once("connect",connectHandler);r.s.coreTopology.connect(e)}close(e,t){["timeout","error","close","joined","left"].forEach((e=>this.removeAllListeners(e)));super.close(e,t)}}Object.defineProperty(ReplSet.prototype,"haInterval",{enumerable:true,get:function(){return this.s.coreTopology.s.haInterval}});e.exports=ReplSet},8421:(e,t,r)=>{"use strict";const n=r(3994).Server;const o=r(7159);const i=r(8589).oF;const s=r(8589).yh;const a=r(3994).MongoError;const c=r(1371).MAX_JS_INT;const l=r(1371).translateOptions;const u=r(1371).filterOptions;const d=r(1371).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 Server extends i{constructor(e,t,r){super();var i=this;r=u(r,p);const h=r.promiseLibrary;var m={force:false,bufferMaxEntries:typeof r.bufferMaxEntries==="number"?r.bufferMaxEntries:c};var g=r.store||new s(i,m);if(e.indexOf("/")!==-1){if(t!=null&&typeof t==="object"){r=t;t=null}}else if(t==null){throw a.create({message:"port must be specified",driver:true})}var y=typeof r.auto_reconnect==="boolean"?r.auto_reconnect:true;y=typeof r.autoReconnect==="boolean"?r.autoReconnect:y;var v=d({},{host:e,port:t,disconnectHandler:g,cursorFactory:o,reconnect:y,emitError:typeof r.emitError==="boolean"?r.emitError:true,size:typeof r.poolSize==="number"?r.poolSize:5,monitorCommands:typeof r.monitorCommands==="boolean"?r.monitorCommands:false});v=l(v,r);var b=r.socketOptions&&Object.keys(r.socketOptions).length>0?r.socketOptions:r;v=l(v,b);this.s={coreTopology:new n(v),sCapabilities:null,clonedOptions:v,reconnect:v.reconnect,emitError:v.emitError,poolSize:v.size,storeOptions:m,store:g,host:e,port:t,options:r,sessionPool:null,sessions:new Set,promiseLibrary:h||Promise}}connect(e,t){var r=this;if("function"===typeof e)t=e,e={};if(e==null)e=this.s.clonedOptions;if(!("function"===typeof t))t=null;e=Object.assign({},this.s.clonedOptions,e);r.s.options=e;r.s.storeOptions.bufferMaxEntries=typeof e.bufferMaxEntries==="number"?e.bufferMaxEntries:-1;var connectErrorHandler=function(){return function(e){var o=["timeout","error","close"];o.forEach((function(e){r.s.coreTopology.removeListener(e,n[e])}));r.s.coreTopology.removeListener("connect",connectErrorHandler);try{t(e)}catch(e){process.nextTick((function(){throw e}))}}};var errorHandler=function(e){return function(t){if(e!=="error"){r.emit(e,t)}}};var reconnectHandler=function(){r.emit("reconnect",r);r.s.store.execute()};var reconnectFailedHandler=function(e){r.emit("reconnectFailed",e);r.s.store.flush(e)};var destroyHandler=function(){r.s.store.flush()};var relay=function(e){return function(t,n){r.emit(e,t,n)}};var connectHandler=function(){["timeout","error","close","destroy"].forEach((function(e){r.s.coreTopology.removeAllListeners(e)}));r.s.coreTopology.on("timeout",errorHandler("timeout"));r.s.coreTopology.once("error",errorHandler("error"));r.s.coreTopology.on("close",errorHandler("close"));r.s.coreTopology.on("destroy",destroyHandler);r.emit("open",null,r);try{t(null,r)}catch(e){process.nextTick((function(){throw e}))}};var n={timeout:connectErrorHandler("timeout"),error:connectErrorHandler("error"),close:connectErrorHandler("close")};["timeout","error","close","serverOpening","serverDescriptionChanged","serverHeartbeatStarted","serverHeartbeatSucceeded","serverHeartbeatFailed","serverClosed","topologyOpening","topologyClosed","topologyDescriptionChanged","commandStarted","commandSucceeded","commandFailed"].forEach((function(e){r.s.coreTopology.removeAllListeners(e)}));r.s.coreTopology.once("timeout",n.timeout);r.s.coreTopology.once("error",n.error);r.s.coreTopology.once("close",n.close);r.s.coreTopology.once("connect",connectHandler);r.s.coreTopology.on("reconnect",reconnectHandler);r.s.coreTopology.on("reconnectFailed",reconnectFailedHandler);r.s.coreTopology.on("serverDescriptionChanged",relay("serverDescriptionChanged"));r.s.coreTopology.on("serverHeartbeatStarted",relay("serverHeartbeatStarted"));r.s.coreTopology.on("serverHeartbeatSucceeded",relay("serverHeartbeatSucceeded"));r.s.coreTopology.on("serverHeartbeatFailed",relay("serverHeartbeatFailed"));r.s.coreTopology.on("serverOpening",relay("serverOpening"));r.s.coreTopology.on("serverClosed",relay("serverClosed"));r.s.coreTopology.on("topologyOpening",relay("topologyOpening"));r.s.coreTopology.on("topologyClosed",relay("topologyClosed"));r.s.coreTopology.on("topologyDescriptionChanged",relay("topologyDescriptionChanged"));r.s.coreTopology.on("commandStarted",relay("commandStarted"));r.s.coreTopology.on("commandSucceeded",relay("commandSucceeded"));r.s.coreTopology.on("commandFailed",relay("commandFailed"));r.s.coreTopology.on("attemptReconnect",relay("attemptReconnect"));r.s.coreTopology.on("monitoring",relay("monitoring"));r.s.coreTopology.connect(e)}}Object.defineProperty(Server.prototype,"poolSize",{enumerable:true,get:function(){return this.s.coreTopology.connections().length}});Object.defineProperty(Server.prototype,"autoReconnect",{enumerable:true,get:function(){return this.s.reconnect}});Object.defineProperty(Server.prototype,"host",{enumerable:true,get:function(){return this.s.host}});Object.defineProperty(Server.prototype,"port",{enumerable:true,get:function(){return this.s.port}});e.exports=Server},8589:(e,t,r)=>{"use strict";const n=r(8614),o=r(3994).MongoError,i=r(1669).format,s=r(3994).ReadPreference,a=r(3994).Sessions.ClientSession;var Store=function(e,t){var r=this;var n=[];t=t||{force:false,bufferMaxEntries:-1};this.s={storedOps:n,storeOptions:t,topology:e};Object.defineProperty(this,"length",{enumerable:true,get:function(){return r.s.storedOps.length}})};Store.prototype.add=function(e,t,r,n,s){if(this.s.storeOptions.force){return s(o.create({message:"db closed by application",driver:true}))}if(this.s.storeOptions.bufferMaxEntries===0){return s(o.create({message:i("no connection available for operation and number of stored operation > %s",this.s.storeOptions.bufferMaxEntries),driver:true}))}if(this.s.storeOptions.bufferMaxEntries>0&&this.s.storedOps.length>this.s.storeOptions.bufferMaxEntries){while(this.s.storedOps.length>0){var a=this.s.storedOps.shift();a.c(o.create({message:i("no connection available for operation and number of stored operation > %s",this.s.storeOptions.bufferMaxEntries),driver:true}))}return}this.s.storedOps.push({t:e,n:t,o:r,op:n,c:s})};Store.prototype.addObjectAndMethod=function(e,t,r,n,s){if(this.s.storeOptions.force){return s(o.create({message:"db closed by application",driver:true}))}if(this.s.storeOptions.bufferMaxEntries===0){return s(o.create({message:i("no connection available for operation and number of stored operation > %s",this.s.storeOptions.bufferMaxEntries),driver:true}))}if(this.s.storeOptions.bufferMaxEntries>0&&this.s.storedOps.length>this.s.storeOptions.bufferMaxEntries){while(this.s.storedOps.length>0){var a=this.s.storedOps.shift();a.c(o.create({message:i("no connection available for operation and number of stored operation > %s",this.s.storeOptions.bufferMaxEntries),driver:true}))}return}this.s.storedOps.push({t:e,m:r,o:t,p:n,c:s})};Store.prototype.flush=function(e){while(this.s.storedOps.length>0){this.s.storedOps.shift().c(e||o.create({message:i("no connection available for operation"),driver:true}))}};var c=["primary","primaryPreferred","nearest","secondaryPreferred"];var l=["secondary","secondaryPreferred"];Store.prototype.execute=function(e){e=e||{};var t=this.s.storedOps;this.s.storedOps=[];var r=typeof e.executePrimary==="boolean"?e.executePrimary:true;var n=typeof e.executeSecondary==="boolean"?e.executeSecondary:true;while(t.length>0){var o=t.shift();if(o.t==="cursor"){if(r&&n){o.o[o.m].apply(o.o,o.p)}else if(r&&o.o.options&&o.o.options.readPreference&&c.indexOf(o.o.options.readPreference.mode)!==-1){o.o[o.m].apply(o.o,o.p)}else if(!r&&n&&o.o.options&&o.o.options.readPreference&&l.indexOf(o.o.options.readPreference.mode)!==-1){o.o[o.m].apply(o.o,o.p)}}else if(o.t==="auth"){this.s.topology[o.t].apply(this.s.topology,o.o)}else{if(r&&n){this.s.topology[o.t](o.n,o.o,o.op,o.c)}else if(r&&o.op&&o.op.readPreference&&c.indexOf(o.op.readPreference.mode)!==-1){this.s.topology[o.t](o.n,o.o,o.op,o.c)}else if(!r&&n&&o.op&&o.op.readPreference&&l.indexOf(o.op.readPreference.mode)!==-1){this.s.topology[o.t](o.n,o.o,o.op,o.c)}}}};Store.prototype.all=function(){return this.s.storedOps};var ServerCapabilities=function(e){var setup_get_property=function(e,t,r){Object.defineProperty(e,t,{enumerable:true,get:function(){return r}})};var t=false;var r=false;var n=false;var o=false;var i=false;var s=false;var a=e.maxWriteBatchSize||1e3;var c=false;var l=false;if(e.minWireVersion>=0){n=true}if(e.maxWireVersion>=1){t=true;o=true}if(e.maxWireVersion>=2){r=true}if(e.maxWireVersion>=3){i=true;s=true}if(e.maxWireVersion>=5){c=true;l=true}if(e.minWireVersion==null){e.minWireVersion=0}if(e.maxWireVersion==null){e.maxWireVersion=0}setup_get_property(this,"hasAggregationCursor",t);setup_get_property(this,"hasWriteCommands",r);setup_get_property(this,"hasTextSearch",n);setup_get_property(this,"hasAuthCommands",o);setup_get_property(this,"hasListCollectionsCommand",i);setup_get_property(this,"hasListIndexesCommand",s);setup_get_property(this,"minWireVersion",e.minWireVersion);setup_get_property(this,"maxWireVersion",e.maxWireVersion);setup_get_property(this,"maxNumberOfDocsInBatch",a);setup_get_property(this,"commandsTakeWriteConcern",c);setup_get_property(this,"commandsTakeCollation",l)};class TopologyBase extends n{constructor(){super();this.setMaxListeners(Infinity)}hasSessionSupport(){return this.logicalSessionTimeoutMinutes!=null}startSession(e,t){const r=new a(this,this.s.sessionPool,e,t);r.once("ended",(()=>{this.s.sessions.delete(r)}));this.s.sessions.add(r);return r}endSessions(e,t){return this.s.coreTopology.endSessions(e,t)}get clientMetadata(){return this.s.coreTopology.s.options.metadata}capabilities(){if(this.s.sCapabilities)return this.s.sCapabilities;if(this.s.coreTopology.lastIsMaster()==null)return null;this.s.sCapabilities=new ServerCapabilities(this.s.coreTopology.lastIsMaster());return this.s.sCapabilities}command(e,t,r,n){this.s.coreTopology.command(e.toString(),t,s.translate(r),n)}insert(e,t,r,n){this.s.coreTopology.insert(e.toString(),t,r,n)}update(e,t,r,n){this.s.coreTopology.update(e.toString(),t,r,n)}remove(e,t,r,n){this.s.coreTopology.remove(e.toString(),t,r,n)}isConnected(e){e=e||{};e=s.translate(e);return this.s.coreTopology.isConnected(e)}isDestroyed(){return this.s.coreTopology.isDestroyed()}cursor(e,t,r){r=r||{};r=s.translate(r);r.disconnectHandler=this.s.store;r.topology=this;return this.s.coreTopology.cursor(e,t,r)}lastIsMaster(){return this.s.coreTopology.lastIsMaster()}selectServer(e,t,r){return this.s.coreTopology.selectServer(e,t,r)}unref(){return this.s.coreTopology.unref()}connections(){return this.s.coreTopology.connections()}close(e,t){this.s.sessions.forEach((e=>e.endSession()));if(this.s.sessionPool){this.s.sessionPool.endAllPooledSessions()}if(e===true){this.s.storeOptions.force=e;this.s.store.flush()}this.s.coreTopology.destroy({force:typeof e==="boolean"?e:false},t)}}Object.defineProperty(TopologyBase.prototype,"bson",{enumerable:true,get:function(){return this.s.coreTopology.s.bson}});Object.defineProperty(TopologyBase.prototype,"parserType",{enumerable:true,get:function(){return this.s.coreTopology.parserType}});Object.defineProperty(TopologyBase.prototype,"logicalSessionTimeoutMinutes",{enumerable:true,get:function(){return this.s.coreTopology.logicalSessionTimeoutMinutes}});Object.defineProperty(TopologyBase.prototype,"type",{enumerable:true,get:function(){return this.s.coreTopology.type}});t.yh=Store;t.ug=ServerCapabilities;t.oF=TopologyBase},8729:(e,t,r)=>{"use strict";const n=r(3994).ReadPreference;const o=r(8835);const i=r(1669).format;const s=r(3994).Logger;const a=r(881);const c=r(7289);const l=r(1191);const u=r(3111).MongoParseError;e.exports=function(e,t,r){if(typeof t==="function")r=t,t={};t=t||{};let n;try{n=o.parse(e,true)}catch(e){return r(new Error("URL malformed, cannot be parsed"))}if(n.protocol!=="mongodb:"&&n.protocol!=="mongodb+srv:"){return r(new Error("Invalid schema, expected `mongodb` or `mongodb+srv`"))}if(n.protocol==="mongodb:"){return parseHandler(e,t,r)}if(n.hostname.split(".").length<3){return r(new Error("URI does not have hostname, domain name and tld"))}n.domainLength=n.hostname.split(".").length;const i=e.substring("mongodb+srv://".length).split("/")[0];if(i.match(",")){return r(new Error("Invalid URI, cannot contain multiple hostnames"))}if(n.port){return r(new Error("Ports not accepted with `mongodb+srv` URIs"))}let s=`_mongodb._tcp.${n.host}`;a.resolveSrv(s,(function(e,o){if(e)return r(e);if(o.length===0){return r(new Error("No addresses found at host"))}for(let e=0;e1){return r(new u("Multiple text records not allowed"))}n=n[0].join("");const e=l.parse(n);const t=Object.keys(e);if(t.some((e=>e!=="authSource"&&e!=="replicaSet"))){return r(new u("Text record must only set `authSource` or `replicaSet`"))}if(t.length>0){d.push(n)}}if(d.length){c+=`?${d.join("&")}`}parseHandler(c,t,r)}))}))};function matchesParentDomain(e,t){let r=/^.*?\./;let n=`.${e.replace(r,"")}`;let o=`.${t.replace(r,"")}`;if(n.endsWith(o))return true;else return false}function parseHandler(e,t,r){let n,o;try{n=parseConnectionString(e,t)}catch(e){o=e}return o?r(o,null):r(null,n)}function parseConnectionString(e,t){let r="";let a="";let l="";let u="admin";let d=o.parse(e,true);if((d.hostname==null||d.hostname==="")&&e.indexOf(".sock")===-1){throw new Error("No hostname or hostnames provided in connection string")}if(d.port==="0"){throw new Error("Invalid port (zero) with hostname")}if(!isNaN(parseInt(d.port,10))&&parseInt(d.port,10)>65535){throw new Error("Invalid port (larger than 65535) with hostname")}if(d.path&&d.path.length>0&&d.path[0]!=="/"&&e.indexOf(".sock")===-1){throw new Error("Missing delimiting slash between hosts and options")}if(d.query){for(let e in d.query){if(e.indexOf("::")!==-1){throw new Error("Double colon in host identifier")}if(d.query[e]===""){throw new Error("Query parameter "+e+" is an incomplete value pair")}}}if(d.auth){let t=d.auth.split(":");if(e.indexOf(d.auth)!==-1&&t.length>2){throw new Error("Username with password containing an unescaped colon")}if(e.indexOf(d.auth)!==-1&&d.auth.indexOf("@")!==-1){throw new Error("Username containing an unescaped at-sign")}}let p=e.split("?").shift();let h=p.split(",");let m=[];for(let e=0;e1&&t.path.indexOf("::")===-1){throw new Error("Slash in host identifier")}else{throw new Error("Double colon in host identifier")}}}if(e.indexOf("?")!==-1){l=e.substr(e.indexOf("?")+1);r=e.substring("mongodb://".length,e.indexOf("?"))}else{r=e.substring("mongodb://".length)}if(r.indexOf("@")!==-1){a=r.split("@")[0];r=r.split("@")[1]}if(r.split("/").length>2){throw new Error("Unsupported host '"+r.split("?")[0]+"', hosts must be URL encoded and contain at most one unencoded slash")}if(r.indexOf(".sock")!==-1){if(r.indexOf(".sock/")!==-1){u=r.split(".sock/")[1];if(u.indexOf("/")!==-1){if(u.split("/").length===2&&u.split("/")[1].length===0){throw new Error("Illegal trailing backslash after database name")}throw new Error("More than 1 database name in URL")}r=r.split("/",r.indexOf(".sock")+".sock".length)}}else if(r.indexOf("/")!==-1){if(r.split("/").length>2){if(r.split("/")[2].length===0){throw new Error("Illegal trailing backslash after database name")}throw new Error("More than 1 database name in URL")}u=r.split("/")[1];r=r.split("/")[0]}r=decodeURIComponent(r);let g={};let y=a||"";let v=y.split(":",2);let b=decodeURIComponent(v[0]);if(v[0]!==encodeURIComponent(b)){throw new Error("Username contains an illegal unescaped character")}v[0]=b;if(v[1]){let e=decodeURIComponent(v[1]);if(v[1]!==encodeURIComponent(e)){throw new Error("Password contains an illegal unescaped character")}v[1]=e}if(v.length===2)g.auth={user:v[0],password:v[1]};if(t&&t.auth!=null)g.auth=t.auth;let S;let w;let E;let _;let O={socketOptions:{}};let C={read_preference_tags:[]};let T={socketOptions:{}};let I={socketOptions:{}};g.server_options=O;g.db_options=C;g.rs_options=T;g.mongos_options=I;if(e.match(/\.sock/)){let t=e.substring(e.indexOf("mongodb://")+"mongodb://".length,e.lastIndexOf(".sock")+".sock".length);if(t.indexOf("@")!==-1)t=t.split("@")[1];t=decodeURIComponent(t);E=[{domain_socket:t}]}else{S=r;let e={};E=S.split(",").map((function(t){let r,n,o;if(o=/\[([^\]]+)\](?::(.+))?/.exec(t)){r=o[1];n=parseInt(o[2],10)||27017}else{let e=t.split(":",2);r=e[0]||"localhost";n=e[1]!=null?parseInt(e[1],10):27017;if(r.indexOf("?")!==-1)r=r.split(/\?/)[0]}if(e[r+"_"+n])return null;e[r+"_"+n]=1;return{host:r,port:n}})).filter((function(e){return e!=null}))}g.dbName=u||"admin";w=(l||"").split(/[&;]/);w.forEach((function(e){if(!e)return;var t=e.split("="),r=t[0],o=t[1];switch(r){case"slaveOk":case"slave_ok":O.slave_ok=o==="true";C.slaveOk=o==="true";break;case"maxPoolSize":case"poolSize":O.poolSize=parseInt(o,10);T.poolSize=parseInt(o,10);break;case"appname":g.appname=decodeURIComponent(o);break;case"autoReconnect":case"auto_reconnect":O.auto_reconnect=o==="true";break;case"ssl":if(o==="prefer"){O.ssl=o;T.ssl=o;I.ssl=o;break}O.ssl=o==="true";T.ssl=o==="true";I.ssl=o==="true";break;case"sslValidate":O.sslValidate=o==="true";T.sslValidate=o==="true";I.sslValidate=o==="true";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=o==="true";break;case"fsync":C.fsync=o==="true";break;case"journal":C.j=o==="true";break;case"safe":C.safe=o==="true";break;case"nativeParser":case"native_parser":C.native_parser=o==="true";break;case"readConcernLevel":C.readConcern=new c(o);break;case"connectTimeoutMS":O.socketOptions.connectTimeoutMS=parseInt(o,10);T.socketOptions.connectTimeoutMS=parseInt(o,10);I.socketOptions.connectTimeoutMS=parseInt(o,10);break;case"socketTimeoutMS":O.socketOptions.socketTimeoutMS=parseInt(o,10);T.socketOptions.socketTimeoutMS=parseInt(o,10);I.socketOptions.socketTimeoutMS=parseInt(o,10);break;case"w":C.w=parseInt(o,10);if(isNaN(C.w))C.w=o;break;case"authSource":C.authSource=o;break;case"gssapiServiceName":C.gssapiServiceName=o;break;case"authMechanism":if(o==="GSSAPI"){if(g.auth==null){let e=decodeURIComponent(y);if(e.indexOf("@")===-1)throw new Error("GSSAPI requires a provided principal");g.auth={user:e,password:null}}else{g.auth.user=decodeURIComponent(g.auth.user)}}else if(o==="MONGODB-X509"){g.auth={user:decodeURIComponent(y)}}if(o!=="GSSAPI"&&o!=="MONGODB-X509"&&o!=="MONGODB-CR"&&o!=="DEFAULT"&&o!=="SCRAM-SHA-1"&&o!=="SCRAM-SHA-256"&&o!=="PLAIN")throw new Error("Only DEFAULT, GSSAPI, PLAIN, MONGODB-X509, or SCRAM-SHA-1 is supported by authMechanism");C.authMechanism=o;break;case"authMechanismProperties":{let e=o.split(",");let t={};e.forEach((function(e){let r=e.split(":");t[r[0]]=r[1]}));C.authMechanismProperties=t;if(typeof t.SERVICE_NAME==="string")C.gssapiServiceName=t.SERVICE_NAME;if(typeof t.SERVICE_REALM==="string")C.gssapiServiceRealm=t.SERVICE_REALM;if(typeof t.CANONICALIZE_HOST_NAME==="string")C.gssapiCanonicalizeHostName=t.CANONICALIZE_HOST_NAME==="true"?true:false}break;case"wtimeoutMS":C.wtimeout=parseInt(o,10);break;case"readPreference":if(!n.isValid(o))throw new Error("readPreference must be either primary/primaryPreferred/secondary/secondaryPreferred/nearest");C.readPreference=o;break;case"maxStalenessSeconds":C.maxStalenessSeconds=parseInt(o,10);break;case"readPreferenceTags":{o=decodeURIComponent(o);let e={};if(o==null||o===""){C.read_preference_tags.push(e);break}let t=o.split(/,/);for(let r=0;r9){throw new Error("zlibCompressionLevel must be an integer between -1 and 9")}_.zlibCompressionLevel=e;O.compression=_}break;case"retryWrites":C.retryWrites=o==="true";break;case"minSize":C.minSize=parseInt(o,10);break;default:{let e=s("URL Parser");e.warn(`${r} is not supported as a connection string option`)}break}}));if(C.read_preference_tags.length===0){C.read_preference_tags=null}if((C.w===-1||C.w===0)&&(C.journal===true||C.fsync===true||C.safe===true))throw new Error("w set to -1 or 0 cannot be combined with safe/w/journal/fsync");if(!C.readPreference){C.readPreference="primary"}C=Object.assign(C,t);g.servers=E;return g}},1371:(e,t,r)=>{"use strict";const n=r(3111).MongoError;const o=r(2481);var shallowClone=function(e){var t={};for(var r in e)t[r]=e[r];return t};var getSingleProperty=function(e,t,r){Object.defineProperty(e,t,{enumerable:true,get:function(){return r}})};var i=t.formatSortValue=function(e){var t=(""+e).toLowerCase();switch(t){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)']]")}};var s=t.formattedOrderClause=function(e){var t=new Map;if(e==null)return null;if(Array.isArray(e)){if(e.length===0){return null}for(var r=0;r{if(e==null){throw new TypeError("This method requires a valid topology instance")}if(!Array.isArray(r)){throw new TypeError("This method requires an array of arguments to apply")}o=o||{};const i=e.s.promiseLibrary;let s=r[r.length-1];let a,c,l;if(!o.skipSessions&&e.hasSessionSupport()){c=r[r.length-2];if(c==null||c.session==null){l=Symbol();a=e.startSession({owner:l});const t=r.length-2;r[t]=Object.assign({},r[t],{session:a})}else if(c.session&&c.session.hasEnded){throw new n("Use of expired sessions is not permitted")}}const makeExecuteCallback=(e,t)=>function executeCallback(r,n){if(a&&a.owner===l&&!o.returnsCursor){a.endSession((()=>{delete c.session;if(r)return t(r);e(n)}))}else{if(r)return t(r);e(n)}};if(typeof s==="function"){s=r.pop();const e=makeExecuteCallback((e=>s(null,e)),(e=>s(e,null)));r.push(e);try{return t.apply(null,r)}catch(t){e(t);throw t}}if(r[r.length-1]!=null){throw new TypeError("final argument to `executeLegacyOperation` must be a callback")}return new i((function(e,n){const o=makeExecuteCallback(e,n);r[r.length-1]=o;try{return t.apply(null,r)}catch(e){o(e)}}))};function applyRetryableWrites(e,t){if(t&&t.s.options.retryWrites){e.retryWrites=true}return e}function applyWriteConcern(e,t,r){r=r||{};const n=t.db;const i=t.collection;if(r.session&&r.session.inTransaction()){if(e.writeConcern){delete e.writeConcern}return e}const s=o.fromOptions(r);if(s){return Object.assign(e,{writeConcern:s})}if(i&&i.writeConcern){return Object.assign(e,{writeConcern:Object.assign({},i.writeConcern)})}if(n&&n.writeConcern){return Object.assign(e,{writeConcern:Object.assign({},n.writeConcern)})}return e}function isPromiseLike(e){return e&&typeof e.then==="function"}function decorateWithCollation(e,t,r){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(r.collation&&typeof r.collation==="object"){if(i&&i.commandsTakeCollation){e.collation=r.collation}else{throw new n(`Current topology does not support collation`)}}}function decorateWithReadConcern(e,t,r){if(r&&r.session&&r.session.inTransaction()){return}let n=Object.assign({},e.readConcern||{});if(t.s.readConcern){Object.assign(n,t.s.readConcern)}if(Object.keys(n).length>0){Object.assign(e,{readConcern:n})}}function decorateWithExplain(e,t){if(e.explain){return e}return{explain:e,verbosity:t.verbosity}}const d=+process.version.split(".")[0].substring(1);const emitProcessWarning=e=>d<=6?process.emitWarning(e,"DeprecationWarning",m):process.emitWarning(e,{type:"DeprecationWarning",code:m});const emitConsoleWarning=e=>console.error(e);const p=process.emitWarning?emitProcessWarning:emitConsoleWarning;function defaultMsgHandler(e,t){return`${e} option [${t}] is deprecated and will be removed in a later version.`}function deprecateOptions(e,t){if(process.noDeprecation===true){return t}const r=e.msgHandler?e.msgHandler:defaultMsgHandler;const n=new Set;function deprecated(){const o=arguments[e.optionsIndex];if(!l(o)||Object.keys(o).length===0){return t.apply(this,arguments)}e.deprecatedOptions.forEach((t=>{if(Object.prototype.hasOwnProperty.call(o,t)&&!n.has(t)){n.add(t);const o=r(e.name,t);p(o);if(this&&this.getLogger){const e=this.getLogger();if(e){e.warn(o)}}}}));return t.apply(this,arguments)}Object.setPrototypeOf(deprecated,t);if(t.prototype){deprecated.prototype=t.prototype}return deprecated}const h={};try{r(1749);h.ASYNC_ITERATOR=true}catch(e){h.ASYNC_ITERATOR=false}class MongoDBNamespace{constructor(e,t){this.db=e;this.collection=t}toString(){return this.collection?`${this.db}.${this.collection}`:this.db}withCollection(e){return new MongoDBNamespace(this.db,e)}static fromString(e){if(!e){throw new Error(`Cannot parse namespace from "${e}"`)}const t=e.indexOf(".");return new MongoDBNamespace(e.substring(0,t),e.substring(t+1))}}function*makeCounter(e){let t=e||0;while(true){const e=t;t+=1;yield e}}function maybePromise(e,t,r){const n=e&&e.s&&e.s.promiseLibrary||Promise;let o;if(typeof t!=="function"){o=new n(((e,r)=>{t=(t,n)=>{if(t)return r(t);e(n)}}))}r((function(e,r){if(e!=null){try{t(e)}catch(e){return process.nextTick((()=>{throw e}))}return}t(e,r)}));return o}function now(){const e=process.hrtime();return Math.floor(e[0]*1e3+e[1]/1e6)}function calculateDurationInMs(e){if(typeof e!=="number"){throw TypeError("numeric value required to calculate duration")}const t=now()-e;return t<0?0:t}function makeInterruptableAsyncInterval(e,t){let r;let n;let o;let i=false;t=t||{};const s=t.interval||1e3;const a=t.minInterval||500;const c=typeof t.immediate==="boolean"?t.immediate:false;const l=typeof t.clock==="function"?t.clock:now;function wake(){const e=l();const t=e-o;const r=e-n;const i=s-r;o=e;if(ta){reschedule(a)}if(i<0){executeAndReschedule()}}function stop(){i=true;if(r){clearTimeout(r);r=null}n=0;o=0}function reschedule(e){if(i)return;clearTimeout(r);r=setTimeout(executeAndReschedule,e||s)}function executeAndReschedule(){o=0;n=l();e((e=>{if(e)throw e;reschedule(s)}))}if(c){executeAndReschedule()}else{n=l();reschedule()}return{wake:wake,stop:stop}}function hasAtomicOperators(e){if(Array.isArray(e)){return e.reduce(((e,t)=>e||hasAtomicOperators(t)),null)}return Object.keys(typeof e.toBSON!=="function"?e:e.toBSON()).map((e=>e[0])).indexOf("$")>=0}const m="MONGODB DRIVER";function emitWarning(e){if(process.emitWarning){return d<=6?process.emitWarning(e,undefined,m):process.emitWarning(e,{code:m})}else{return console.error(`[${m}] Warning:`,e)}}const g=new Set;function emitWarningOnce(e){if(!g.has(e)){g.add(e);return emitWarning(e)}}e.exports={filterOptions:filterOptions,mergeOptions:mergeOptions,translateOptions:translateOptions,shallowClone:shallowClone,getSingleProperty:getSingleProperty,checkCollectionName:a,toError:toError,formattedOrderClause:s,parseIndexOptions:parseIndexOptions,normalizeHintField:c,handleCallback:handleCallback,decorateCommand:decorateCommand,isObject:l,debugOptions:debugOptions,MAX_JS_INT:Number.MAX_SAFE_INTEGER+1,conditionallyMergeWriteConcern:conditionallyMergeWriteConcern,executeLegacyOperation:executeLegacyOperation,applyRetryableWrites:applyRetryableWrites,applyWriteConcern:applyWriteConcern,isPromiseLike:isPromiseLike,decorateWithCollation:decorateWithCollation,decorateWithReadConcern:decorateWithReadConcern,decorateWithExplain:decorateWithExplain,deprecateOptions:deprecateOptions,SUPPORTS:h,MongoDBNamespace:MongoDBNamespace,emitDeprecationWarning:p,makeCounter:makeCounter,maybePromise:maybePromise,now:now,calculateDurationInMs:calculateDurationInMs,makeInterruptableAsyncInterval:makeInterruptableAsyncInterval,hasAtomicOperators:hasAtomicOperators,MONGODB_WARNING_CODE:m,emitWarning:emitWarning,emitWarningOnce:emitWarningOnce}},2481:(e,t,r)=>{"use strict";const n=new Set(["w","wtimeout","j","journal","fsync"]);let o;class WriteConcern{constructor(e,t,r,n){if(e!=null){this.w=e}if(t!=null){this.wtimeout=t}if(r!=null){this.j=r}if(n!=null){this.fsync=n}}static fromOptions(e){if(e==null||e.writeConcern==null&&e.w==null&&e.wtimeout==null&&e.j==null&&e.journal==null&&e.fsync==null){return}if(e.writeConcern){if(typeof e.writeConcern==="string"){return new WriteConcern(e.writeConcern)}if(!Object.keys(e.writeConcern).some((e=>n.has(e)))){return}return new WriteConcern(e.writeConcern.w,e.writeConcern.wtimeout,e.writeConcern.j||e.writeConcern.journal,e.writeConcern.fsync)}if(!o)o=r(1371);o.emitWarningOnce(`Top-level use of w, wtimeout, j, and fsync is deprecated. Use writeConcern instead.`);return new WriteConcern(e.w,e.wtimeout,e.j||e.journal,e.fsync)}}e.exports=WriteConcern},900:e=>{var t=1e3;var r=t*60;var n=r*60;var o=n*24;var i=o*7;var s=o*365.25;e.exports=function(e,t){t=t||{};var r=typeof e;if(r==="string"&&e.length>0){return parse(e)}else if(r==="number"&&isFinite(e)){return t.long?fmtLong(e):fmtShort(e)}throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))};function parse(e){e=String(e);if(e.length>100){return}var a=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(!a){return}var c=parseFloat(a[1]);var l=(a[2]||"ms").toLowerCase();switch(l){case"years":case"year":case"yrs":case"yr":case"y":return c*s;case"weeks":case"week":case"w":return c*i;case"days":case"day":case"d":return c*o;case"hours":case"hour":case"hrs":case"hr":case"h":return c*n;case"minutes":case"minute":case"mins":case"min":case"m":return c*r;case"seconds":case"second":case"secs":case"sec":case"s":return c*t;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return c;default:return undefined}}function fmtShort(e){var i=Math.abs(e);if(i>=o){return Math.round(e/o)+"d"}if(i>=n){return Math.round(e/n)+"h"}if(i>=r){return Math.round(e/r)+"m"}if(i>=t){return Math.round(e/t)+"s"}return e+"ms"}function fmtLong(e){var i=Math.abs(e);if(i>=o){return plural(e,i,o,"day")}if(i>=n){return plural(e,i,n,"hour")}if(i>=r){return plural(e,i,r,"minute")}if(i>=t){return plural(e,i,t,"second")}return e+" ms"}function plural(e,t,r,n){var o=t>=r*1.5;return Math.round(e/r)+" "+n+(o?"s":"")}},1156:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.findSync=t.find=t.findAsync=void 0;const n=r(4351);const o=r(5622);const i=r(5747);const s=r(8237);const a=s("new-find-package-json:main");function findAsync(e,t,r){return n.__asyncGenerator(this,arguments,(function*findAsync_1(){a(`findSync: called with "${e}" and "${t}" and "${r}"`);t=!!t?t:"";const i=!!r?r:"package.json";const s=!!t||o.isAbsolute(t)?t:process.cwd();let c=o.resolve(s,e);let l=false;while(c){if(c===o.parse(c).root){l=true}const e=o.resolve(c,i);a(`findSync: testing path "${e}"`);const t=yield n.__await(statPathAsync(e));if(!!t&&t.isFile()){a(`findSync: path exists and is file "${e}"`);yield yield n.__await(e);a(`findSync: after yield`)}if(l){break}c=o.resolve(c,"..")}}))}t.findAsync=findAsync;t.find=findAsync;function*findSync(e,t,r){a(`findSync: called with "${e}" and "${t}" and "${r}"`);t=!!t?t:"";const n=!!r?r:"package.json";const i=!!t||o.isAbsolute(t)?t:process.cwd();let s=o.resolve(i,e);let c=false;while(s){if(s===o.parse(s).root){c=true}const e=o.resolve(s,n);a(`findSync: testing path "${e}"`);const t=statPathSync(e);if(!!t&&t.isFile()){a(`findSync: path exists and is file "${e}"`);yield e;a(`findSync: after yield`)}if(c){break}s=o.resolve(s,"..")}}t.findSync=findSync;function statPathSync(e){try{return i.statSync(e)}catch(e){if(e.code==="ENOENT"){return undefined}throw e}}function statPathAsync(e){return n.__awaiter(this,void 0,void 0,(function*(){return i.promises.stat(e).catch((e=>{if(e.code==="ENOENT"){return undefined}throw e}))}))}},1223:(e,t,r)=>{var n=r(2940);e.exports=n(once);e.exports.strict=n(onceStrict);once.proto=once((function(){Object.defineProperty(Function.prototype,"once",{value:function(){return once(this)},configurable:true});Object.defineProperty(Function.prototype,"onceStrict",{value:function(){return onceStrict(this)},configurable:true})}));function once(e){var f=function(){if(f.called)return f.value;f.called=true;return f.value=e.apply(this,arguments)};f.called=false;return f}function onceStrict(e){var f=function(){if(f.called)throw new Error(f.onceError);f.called=true;return f.value=e.apply(this,arguments)};var t=e.name||"Function wrapped with `once`";f.onceError=t+" shouldn't be called more than once";f.called=false;return f}},3182:(e,t,r)=>{"use strict";const n=r(2357);function findModuleNotFound(e,t){const r=e.message.split("\n")[0];return r&&(r.includes(`'${t}'`)||r.includes(` ${t} `)||r.includes(` ${t}. `)||r.includes(` ${t}, `))}function _optionalRequire(e,t,r,o){let i;if(typeof o==="object"){i=o;n(!(i.hasOwnProperty("notFound")&&i.hasOwnProperty("default")),"optionalRequire: options set with both `notFound` and `default`")}else{i={message:o}}try{return t?e.resolve(r):e(r)}catch(e){if(e.code!=="MODULE_NOT_FOUND"||!findModuleNotFound(e,r)){if(typeof i.fail==="function"){return i.fail(e)}throw e}if(i.message){const e=typeof i.message==="string"?`${i.message} - `:"";const n=t?"resolved":"found";optionalRequire.log(`${e}optional module not ${n}`,r)}if(typeof i.notFound==="function"){return i.notFound(e)}return i.default}}const tryRequire=(e,t,r)=>_optionalRequire(e,false,t,r);const tryResolve=(e,t,r)=>_optionalRequire(e,true,t,r);function optionalRequire(e){const x=(t,r)=>tryRequire(e,t,r);x.resolve=(t,r)=>tryResolve(e,t,r);return x}optionalRequire.try=tryRequire;optionalRequire.tryResolve=tryResolve;optionalRequire.resolve=tryResolve;optionalRequire.log=(e,t)=>console.log(`Just FYI: ${e}; Path "${t}"`);e.exports=optionalRequire},6978:(e,t,r)=>{"use strict";const n=r(5747);const{promisify:o}=r(1669);const i=o(n.access);e.exports=async e=>{try{await i(e);return true}catch(e){return false}};e.exports.sync=e=>{try{n.accessSync(e);return true}catch(e){return false}}},8714:e=>{"use strict";function posix(e){return e.charAt(0)==="/"}function win32(e){var t=/^([a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/]+[^\\\/]+)?([\\\/])?([\s\S]*?)$/;var r=t.exec(e);var n=r[1]||"";var o=Boolean(n&&n.charAt(1)!==":");return Boolean(r[2]||o)}e.exports=process.platform==="win32"?win32:posix;e.exports.posix=posix;e.exports.win32=win32},4833:e=>{e.exports=Pend;function Pend(){this.pending=0;this.max=Infinity;this.listeners=[];this.waiting=[];this.error=null}Pend.prototype.go=function(e){if(this.pending0&&e.pending{"use strict";const n=r(5622);const o=r(1812);const pkgDir=async e=>{const t=await o("package.json",{cwd:e});return t&&n.dirname(t)};e.exports=pkgDir;e.exports.default=pkgDir;e.exports.sync=e=>{const t=o.sync("package.json",{cwd:e});return t&&n.dirname(t)}},1812:(e,t,r)=>{"use strict";const n=r(5622);const o=r(5937);const i=r(6978);const s=Symbol("findUp.stop");e.exports=async(e,t={})=>{let r=n.resolve(t.cwd||"");const{root:i}=n.parse(r);const a=[].concat(e);const runMatcher=async t=>{if(typeof e!=="function"){return o(a,t)}const r=await e(t.cwd);if(typeof r==="string"){return o([r],t)}return r};while(true){const e=await runMatcher({...t,cwd:r});if(e===s){return}if(e){return n.resolve(r,e)}if(r===i){return}r=n.dirname(r)}};e.exports.sync=(e,t={})=>{let r=n.resolve(t.cwd||"");const{root:i}=n.parse(r);const a=[].concat(e);const runMatcher=t=>{if(typeof e!=="function"){return o.sync(a,t)}const r=e(t.cwd);if(typeof r==="string"){return o.sync([r],t)}return r};while(true){const e=runMatcher({...t,cwd:r});if(e===s){return}if(e){return n.resolve(r,e)}if(r===i){return}r=n.dirname(r)}};e.exports.exists=i;e.exports.sync.exists=i.sync;e.exports.stop=s},5937:(e,t,r)=>{"use strict";const n=r(5622);const o=r(5747);const{promisify:i}=r(1669);const s=r(6249);const a=i(o.stat);const c=i(o.lstat);const l={directory:"isDirectory",file:"isFile"};function checkType({type:e}){if(e in l){return}throw new Error(`Invalid type specified: ${e}`)}const matchType=(e,t)=>e===undefined||t[l[e]]();e.exports=async(e,t)=>{t={cwd:process.cwd(),type:"file",allowSymlinks:true,...t};checkType(t);const r=t.allowSymlinks?a:c;return s(e,(async e=>{try{const o=await r(n.resolve(t.cwd,e));return matchType(t.type,o)}catch(e){return false}}),t)};e.exports.sync=(e,t)=>{t={cwd:process.cwd(),allowSymlinks:true,type:"file",...t};checkType(t);const r=t.allowSymlinks?o.statSync:o.lstatSync;for(const o of e){try{const e=r(n.resolve(t.cwd,o));if(matchType(t.type,e)){return o}}catch(e){}}}},4752:(e,t,r)=>{"use strict";const n=r(7471);const pLimit=e=>{if(!((Number.isInteger(e)||e===Infinity)&&e>0)){return Promise.reject(new TypeError("Expected `concurrency` to be a number from 1 and up"))}const t=[];let r=0;const next=()=>{r--;if(t.length>0){t.shift()()}};const run=(e,t,...o)=>{r++;const i=n(e,...o);t(i);i.then(next,next)};const enqueue=(n,o,...i)=>{if(rnew Promise((r=>enqueue(e,r,...t)));Object.defineProperties(generator,{activeCount:{get:()=>r},pendingCount:{get:()=>t.length},clearQueue:{value:()=>{t.length=0}}});return generator};e.exports=pLimit;e.exports.default=pLimit},6249:(e,t,r)=>{"use strict";const n=r(4752);class EndError extends Error{constructor(e){super();this.value=e}}const testElement=async(e,t)=>t(await e);const finder=async e=>{const t=await Promise.all(e);if(t[1]===true){throw new EndError(t[0])}return false};const pLocate=async(e,t,r)=>{r={concurrency:Infinity,preserveOrder:true,...r};const o=n(r.concurrency);const i=[...e].map((e=>[e,o(testElement,e,t)]));const s=n(r.preserveOrder?1:Infinity);try{await Promise.all(i.map((e=>s(finder,e))))}catch(e){if(e instanceof EndError){return e.value}throw e}};e.exports=pLocate;e.exports.default=pLocate},7471:e=>{"use strict";const pTry=(e,...t)=>new Promise((r=>{r(e(...t))}));e.exports=pTry;e.exports.default=pTry},7214:e=>{"use strict";const t={};function createErrorType(e,r,n){if(!n){n=Error}function getMessage(e,t,n){if(typeof r==="string"){return r}else{return r(e,t,n)}}class NodeError extends n{constructor(e,t,r){super(getMessage(e,t,r))}}NodeError.prototype.name=n.name;NodeError.prototype.code=e;t[e]=NodeError}function oneOf(e,t){if(Array.isArray(e)){const r=e.length;e=e.map((e=>String(e)));if(r>2){return`one of ${t} ${e.slice(0,r-1).join(", ")}, or `+e[r-1]}else if(r===2){return`one of ${t} ${e[0]} or ${e[1]}`}else{return`of ${t} ${e[0]}`}}else{return`of ${t} ${String(e)}`}}function startsWith(e,t,r){return e.substr(!r||r<0?0:+r,t.length)===t}function endsWith(e,t,r){if(r===undefined||r>e.length){r=e.length}return e.substring(r-t.length,r)===t}function includes(e,t,r){if(typeof r!=="number"){r=0}if(r+t.length>e.length){return false}else{return e.indexOf(t,r)!==-1}}createErrorType("ERR_INVALID_OPT_VALUE",(function(e,t){return'The value "'+t+'" is invalid for option "'+e+'"'}),TypeError);createErrorType("ERR_INVALID_ARG_TYPE",(function(e,t,r){let n;if(typeof t==="string"&&startsWith(t,"not ")){n="must not be";t=t.replace(/^not /,"")}else{n="must be"}let o;if(endsWith(e," argument")){o=`The ${e} ${n} ${oneOf(t,"type")}`}else{const r=includes(e,".")?"property":"argument";o=`The "${e}" ${r} ${n} ${oneOf(t,"type")}`}o+=`. Received type ${typeof r}`;return o}),TypeError);createErrorType("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF");createErrorType("ERR_METHOD_NOT_IMPLEMENTED",(function(e){return"The "+e+" method is not implemented"}));createErrorType("ERR_STREAM_PREMATURE_CLOSE","Premature close");createErrorType("ERR_STREAM_DESTROYED",(function(e){return"Cannot call "+e+" after a stream was destroyed"}));createErrorType("ERR_MULTIPLE_CALLBACK","Callback called multiple times");createErrorType("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable");createErrorType("ERR_STREAM_WRITE_AFTER_END","write after end");createErrorType("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError);createErrorType("ERR_UNKNOWN_ENCODING",(function(e){return"Unknown encoding: "+e}),TypeError);createErrorType("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event");e.exports.q=t},1359:(e,t,r)=>{"use strict";var n=Object.keys||function(e){var t=[];for(var r in e){t.push(r)}return t};e.exports=Duplex;var o=r(1433);var i=r(6993);r(4124)(Duplex,o);{var s=n(i.prototype);for(var a=0;a{"use strict";e.exports=PassThrough;var n=r(4415);r(4124)(PassThrough,n);function PassThrough(e){if(!(this instanceof PassThrough))return new PassThrough(e);n.call(this,e)}PassThrough.prototype._transform=function(e,t,r){r(null,e)}},1433:(e,t,r)=>{"use strict";e.exports=Readable;var n;Readable.ReadableState=ReadableState;var o=r(8614).EventEmitter;var i=function EElistenerCount(e,t){return e.listeners(t).length};var s=r(2387);var a=r(4293).Buffer;var c=global.Uint8Array||function(){};function _uint8ArrayToBuffer(e){return a.from(e)}function _isUint8Array(e){return a.isBuffer(e)||e instanceof c}var l=r(1669);var u;if(l&&l.debuglog){u=l.debuglog("stream")}else{u=function debug(){}}var d=r(2746);var p=r(7049);var h=r(9948),m=h.getHighWaterMark;var g=r(7214).q,y=g.ERR_INVALID_ARG_TYPE,v=g.ERR_STREAM_PUSH_AFTER_EOF,b=g.ERR_METHOD_NOT_IMPLEMENTED,S=g.ERR_STREAM_UNSHIFT_AFTER_END_EVENT;var w;var E;var _;r(4124)(Readable,s);var O=p.errorOrDestroy;var C=["error","close","destroy","pause","resume"];function prependListener(e,t,r){if(typeof e.prependListener==="function")return e.prependListener(t,r);if(!e._events||!e._events[t])e.on(t,r);else if(Array.isArray(e._events[t]))e._events[t].unshift(r);else e._events[t]=[r,e._events[t]]}function ReadableState(e,t,o){n=n||r(1359);e=e||{};if(typeof o!=="boolean")o=t instanceof n;this.objectMode=!!e.objectMode;if(o)this.objectMode=this.objectMode||!!e.readableObjectMode;this.highWaterMark=m(this,e,"readableHighWaterMark",o);this.buffer=new d;this.length=0;this.pipes=null;this.pipesCount=0;this.flowing=null;this.ended=false;this.endEmitted=false;this.reading=false;this.sync=true;this.needReadable=false;this.emittedReadable=false;this.readableListening=false;this.resumeScheduled=false;this.paused=true;this.emitClose=e.emitClose!==false;this.autoDestroy=!!e.autoDestroy;this.destroyed=false;this.defaultEncoding=e.defaultEncoding||"utf8";this.awaitDrain=0;this.readingMore=false;this.decoder=null;this.encoding=null;if(e.encoding){if(!w)w=r(4841).s;this.decoder=new w(e.encoding);this.encoding=e.encoding}}function Readable(e){n=n||r(1359);if(!(this instanceof Readable))return new Readable(e);var t=this instanceof n;this._readableState=new ReadableState(e,this,t);this.readable=true;if(e){if(typeof e.read==="function")this._read=e.read;if(typeof e.destroy==="function")this._destroy=e.destroy}s.call(this)}Object.defineProperty(Readable.prototype,"destroyed",{enumerable:false,get:function get(){if(this._readableState===undefined){return false}return this._readableState.destroyed},set:function set(e){if(!this._readableState){return}this._readableState.destroyed=e}});Readable.prototype.destroy=p.destroy;Readable.prototype._undestroy=p.undestroy;Readable.prototype._destroy=function(e,t){t(e)};Readable.prototype.push=function(e,t){var r=this._readableState;var n;if(!r.objectMode){if(typeof e==="string"){t=t||r.defaultEncoding;if(t!==r.encoding){e=a.from(e,t);t=""}n=true}}else{n=true}return readableAddChunk(this,e,t,false,n)};Readable.prototype.unshift=function(e){return readableAddChunk(this,e,null,true,false)};function readableAddChunk(e,t,r,n,o){u("readableAddChunk",t);var i=e._readableState;if(t===null){i.reading=false;onEofChunk(e,i)}else{var s;if(!o)s=chunkInvalid(i,t);if(s){O(e,s)}else if(i.objectMode||t&&t.length>0){if(typeof t!=="string"&&!i.objectMode&&Object.getPrototypeOf(t)!==a.prototype){t=_uint8ArrayToBuffer(t)}if(n){if(i.endEmitted)O(e,new S);else addChunk(e,i,t,true)}else if(i.ended){O(e,new v)}else if(i.destroyed){return false}else{i.reading=false;if(i.decoder&&!r){t=i.decoder.write(t);if(i.objectMode||t.length!==0)addChunk(e,i,t,false);else maybeReadMore(e,i)}else{addChunk(e,i,t,false)}}}else if(!n){i.reading=false;maybeReadMore(e,i)}}return!i.ended&&(i.length=T){e=T}else{e--;e|=e>>>1;e|=e>>>2;e|=e>>>4;e|=e>>>8;e|=e>>>16;e++}return e}function howMuchToRead(e,t){if(e<=0||t.length===0&&t.ended)return 0;if(t.objectMode)return 1;if(e!==e){if(t.flowing&&t.length)return t.buffer.head.data.length;else return t.length}if(e>t.highWaterMark)t.highWaterMark=computeNewHighWaterMark(e);if(e<=t.length)return e;if(!t.ended){t.needReadable=true;return 0}return t.length}Readable.prototype.read=function(e){u("read",e);e=parseInt(e,10);var t=this._readableState;var r=e;if(e!==0)t.emittedReadable=false;if(e===0&&t.needReadable&&((t.highWaterMark!==0?t.length>=t.highWaterMark:t.length>0)||t.ended)){u("read: emitReadable",t.length,t.ended);if(t.length===0&&t.ended)endReadable(this);else emitReadable(this);return null}e=howMuchToRead(e,t);if(e===0&&t.ended){if(t.length===0)endReadable(this);return null}var n=t.needReadable;u("need readable",n);if(t.length===0||t.length-e0)o=fromList(e,t);else o=null;if(o===null){t.needReadable=t.length<=t.highWaterMark;e=0}else{t.length-=e;t.awaitDrain=0}if(t.length===0){if(!t.ended)t.needReadable=true;if(r!==e&&t.ended)endReadable(this)}if(o!==null)this.emit("data",o);return o};function onEofChunk(e,t){u("onEofChunk");if(t.ended)return;if(t.decoder){var r=t.decoder.end();if(r&&r.length){t.buffer.push(r);t.length+=t.objectMode?1:r.length}}t.ended=true;if(t.sync){emitReadable(e)}else{t.needReadable=false;if(!t.emittedReadable){t.emittedReadable=true;emitReadable_(e)}}}function emitReadable(e){var t=e._readableState;u("emitReadable",t.needReadable,t.emittedReadable);t.needReadable=false;if(!t.emittedReadable){u("emitReadable",t.flowing);t.emittedReadable=true;process.nextTick(emitReadable_,e)}}function emitReadable_(e){var t=e._readableState;u("emitReadable_",t.destroyed,t.length,t.ended);if(!t.destroyed&&(t.length||t.ended)){e.emit("readable");t.emittedReadable=false}t.needReadable=!t.flowing&&!t.ended&&t.length<=t.highWaterMark;flow(e)}function maybeReadMore(e,t){if(!t.readingMore){t.readingMore=true;process.nextTick(maybeReadMore_,e,t)}}function maybeReadMore_(e,t){while(!t.reading&&!t.ended&&(t.length1&&indexOf(n.pipes,e)!==-1)&&!c){u("false write response, pause",n.awaitDrain);n.awaitDrain++}r.pause()}}function onerror(t){u("onerror",t);unpipe();e.removeListener("error",onerror);if(i(e,"error")===0)O(e,t)}prependListener(e,"error",onerror);function onclose(){e.removeListener("finish",onfinish);unpipe()}e.once("close",onclose);function onfinish(){u("onfinish");e.removeListener("close",onclose);unpipe()}e.once("finish",onfinish);function unpipe(){u("unpipe");r.unpipe(e)}e.emit("pipe",r);if(!n.flowing){u("pipe resume");r.resume()}return e};function pipeOnDrain(e){return function pipeOnDrainFunctionResult(){var t=e._readableState;u("pipeOnDrain",t.awaitDrain);if(t.awaitDrain)t.awaitDrain--;if(t.awaitDrain===0&&i(e,"data")){t.flowing=true;flow(e)}}}Readable.prototype.unpipe=function(e){var t=this._readableState;var r={hasUnpiped:false};if(t.pipesCount===0)return this;if(t.pipesCount===1){if(e&&e!==t.pipes)return this;if(!e)e=t.pipes;t.pipes=null;t.pipesCount=0;t.flowing=false;if(e)e.emit("unpipe",this,r);return this}if(!e){var n=t.pipes;var o=t.pipesCount;t.pipes=null;t.pipesCount=0;t.flowing=false;for(var i=0;i0;if(n.flowing!==false)this.resume()}else if(e==="readable"){if(!n.endEmitted&&!n.readableListening){n.readableListening=n.needReadable=true;n.flowing=false;n.emittedReadable=false;u("on readable",n.length,n.reading);if(n.length){emitReadable(this)}else if(!n.reading){process.nextTick(nReadingNextTick,this)}}}return r};Readable.prototype.addListener=Readable.prototype.on;Readable.prototype.removeListener=function(e,t){var r=s.prototype.removeListener.call(this,e,t);if(e==="readable"){process.nextTick(updateReadableListening,this)}return r};Readable.prototype.removeAllListeners=function(e){var t=s.prototype.removeAllListeners.apply(this,arguments);if(e==="readable"||e===undefined){process.nextTick(updateReadableListening,this)}return t};function updateReadableListening(e){var t=e._readableState;t.readableListening=e.listenerCount("readable")>0;if(t.resumeScheduled&&!t.paused){t.flowing=true}else if(e.listenerCount("data")>0){e.resume()}}function nReadingNextTick(e){u("readable nexttick read 0");e.read(0)}Readable.prototype.resume=function(){var e=this._readableState;if(!e.flowing){u("resume");e.flowing=!e.readableListening;resume(this,e)}e.paused=false;return this};function resume(e,t){if(!t.resumeScheduled){t.resumeScheduled=true;process.nextTick(resume_,e,t)}}function resume_(e,t){u("resume",t.reading);if(!t.reading){e.read(0)}t.resumeScheduled=false;e.emit("resume");flow(e);if(t.flowing&&!t.reading)e.read(0)}Readable.prototype.pause=function(){u("call pause flowing=%j",this._readableState.flowing);if(this._readableState.flowing!==false){u("pause");this._readableState.flowing=false;this.emit("pause")}this._readableState.paused=true;return this};function flow(e){var t=e._readableState;u("flow",t.flowing);while(t.flowing&&e.read()!==null){}}Readable.prototype.wrap=function(e){var t=this;var r=this._readableState;var n=false;e.on("end",(function(){u("wrapped end");if(r.decoder&&!r.ended){var e=r.decoder.end();if(e&&e.length)t.push(e)}t.push(null)}));e.on("data",(function(o){u("wrapped data");if(r.decoder)o=r.decoder.write(o);if(r.objectMode&&(o===null||o===undefined))return;else if(!r.objectMode&&(!o||!o.length))return;var i=t.push(o);if(!i){n=true;e.pause()}}));for(var o in e){if(this[o]===undefined&&typeof e[o]==="function"){this[o]=function methodWrap(t){return function methodWrapReturnFunction(){return e[t].apply(e,arguments)}}(o)}}for(var i=0;i=t.length){if(t.decoder)r=t.buffer.join("");else if(t.buffer.length===1)r=t.buffer.first();else r=t.buffer.concat(t.length);t.buffer.clear()}else{r=t.buffer.consume(e,t.decoder)}return r}function endReadable(e){var t=e._readableState;u("endReadable",t.endEmitted);if(!t.endEmitted){t.ended=true;process.nextTick(endReadableNT,t,e)}}function endReadableNT(e,t){u("endReadableNT",e.endEmitted,e.length);if(!e.endEmitted&&e.length===0){e.endEmitted=true;t.readable=false;t.emit("end");if(e.autoDestroy){var r=t._writableState;if(!r||r.autoDestroy&&r.finished){t.destroy()}}}}if(typeof Symbol==="function"){Readable.from=function(e,t){if(_===undefined){_=r(9082)}return _(Readable,e,t)}}function indexOf(e,t){for(var r=0,n=e.length;r{"use strict";e.exports=Transform;var n=r(7214).q,o=n.ERR_METHOD_NOT_IMPLEMENTED,i=n.ERR_MULTIPLE_CALLBACK,s=n.ERR_TRANSFORM_ALREADY_TRANSFORMING,a=n.ERR_TRANSFORM_WITH_LENGTH_0;var c=r(1359);r(4124)(Transform,c);function afterTransform(e,t){var r=this._transformState;r.transforming=false;var n=r.writecb;if(n===null){return this.emit("error",new i)}r.writechunk=null;r.writecb=null;if(t!=null)this.push(t);n(e);var o=this._readableState;o.reading=false;if(o.needReadable||o.length{"use strict";e.exports=Writable;function WriteReq(e,t,r){this.chunk=e;this.encoding=t;this.callback=r;this.next=null}function CorkedRequest(e){var t=this;this.next=null;this.entry=null;this.finish=function(){onCorkedFinish(t,e)}}var n;Writable.WritableState=WritableState;var o={deprecate:r(5278)};var i=r(2387);var s=r(4293).Buffer;var a=global.Uint8Array||function(){};function _uint8ArrayToBuffer(e){return s.from(e)}function _isUint8Array(e){return s.isBuffer(e)||e instanceof a}var c=r(7049);var l=r(9948),u=l.getHighWaterMark;var d=r(7214).q,p=d.ERR_INVALID_ARG_TYPE,h=d.ERR_METHOD_NOT_IMPLEMENTED,m=d.ERR_MULTIPLE_CALLBACK,g=d.ERR_STREAM_CANNOT_PIPE,y=d.ERR_STREAM_DESTROYED,v=d.ERR_STREAM_NULL_VALUES,b=d.ERR_STREAM_WRITE_AFTER_END,S=d.ERR_UNKNOWN_ENCODING;var w=c.errorOrDestroy;r(4124)(Writable,i);function nop(){}function WritableState(e,t,o){n=n||r(1359);e=e||{};if(typeof o!=="boolean")o=t instanceof n;this.objectMode=!!e.objectMode;if(o)this.objectMode=this.objectMode||!!e.writableObjectMode;this.highWaterMark=u(this,e,"writableHighWaterMark",o);this.finalCalled=false;this.needDrain=false;this.ending=false;this.ended=false;this.finished=false;this.destroyed=false;var i=e.decodeStrings===false;this.decodeStrings=!i;this.defaultEncoding=e.defaultEncoding||"utf8";this.length=0;this.writing=false;this.corked=0;this.sync=true;this.bufferProcessing=false;this.onwrite=function(e){onwrite(t,e)};this.writecb=null;this.writelen=0;this.bufferedRequest=null;this.lastBufferedRequest=null;this.pendingcb=0;this.prefinished=false;this.errorEmitted=false;this.emitClose=e.emitClose!==false;this.autoDestroy=!!e.autoDestroy;this.bufferedRequestCount=0;this.corkedRequestsFree=new CorkedRequest(this)}WritableState.prototype.getBuffer=function getBuffer(){var e=this.bufferedRequest;var t=[];while(e){t.push(e);e=e.next}return t};(function(){try{Object.defineProperty(WritableState.prototype,"buffer",{get:o.deprecate((function writableStateBufferGetter(){return this.getBuffer()}),"_writableState.buffer is deprecated. Use _writableState.getBuffer "+"instead.","DEP0003")})}catch(e){}})();var E;if(typeof Symbol==="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]==="function"){E=Function.prototype[Symbol.hasInstance];Object.defineProperty(Writable,Symbol.hasInstance,{value:function value(e){if(E.call(this,e))return true;if(this!==Writable)return false;return e&&e._writableState instanceof WritableState}})}else{E=function realHasInstance(e){return e instanceof this}}function Writable(e){n=n||r(1359);var t=this instanceof n;if(!t&&!E.call(Writable,this))return new Writable(e);this._writableState=new WritableState(e,this,t);this.writable=true;if(e){if(typeof e.write==="function")this._write=e.write;if(typeof e.writev==="function")this._writev=e.writev;if(typeof e.destroy==="function")this._destroy=e.destroy;if(typeof e.final==="function")this._final=e.final}i.call(this)}Writable.prototype.pipe=function(){w(this,new g)};function writeAfterEnd(e,t){var r=new b;w(e,r);process.nextTick(t,r)}function validChunk(e,t,r,n){var o;if(r===null){o=new v}else if(typeof r!=="string"&&!t.objectMode){o=new p("chunk",["string","Buffer"],r)}if(o){w(e,o);process.nextTick(n,o);return false}return true}Writable.prototype.write=function(e,t,r){var n=this._writableState;var o=false;var i=!n.objectMode&&_isUint8Array(e);if(i&&!s.isBuffer(e)){e=_uint8ArrayToBuffer(e)}if(typeof t==="function"){r=t;t=null}if(i)t="buffer";else if(!t)t=n.defaultEncoding;if(typeof r!=="function")r=nop;if(n.ending)writeAfterEnd(this,r);else if(i||validChunk(this,n,e,r)){n.pendingcb++;o=writeOrBuffer(this,n,i,e,t,r)}return o};Writable.prototype.cork=function(){this._writableState.corked++};Writable.prototype.uncork=function(){var e=this._writableState;if(e.corked){e.corked--;if(!e.writing&&!e.corked&&!e.bufferProcessing&&e.bufferedRequest)clearBuffer(this,e)}};Writable.prototype.setDefaultEncoding=function setDefaultEncoding(e){if(typeof e==="string")e=e.toLowerCase();if(!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((e+"").toLowerCase())>-1))throw new S(e);this._writableState.defaultEncoding=e;return this};Object.defineProperty(Writable.prototype,"writableBuffer",{enumerable:false,get:function get(){return this._writableState&&this._writableState.getBuffer()}});function decodeChunk(e,t,r){if(!e.objectMode&&e.decodeStrings!==false&&typeof t==="string"){t=s.from(t,r)}return t}Object.defineProperty(Writable.prototype,"writableHighWaterMark",{enumerable:false,get:function get(){return this._writableState.highWaterMark}});function writeOrBuffer(e,t,r,n,o,i){if(!r){var s=decodeChunk(t,n,o);if(n!==s){r=true;o="buffer";n=s}}var a=t.objectMode?1:n.length;t.length+=a;var c=t.length{"use strict";var n;function _defineProperty(e,t,r){if(t in e){Object.defineProperty(e,t,{value:r,enumerable:true,configurable:true,writable:true})}else{e[t]=r}return e}var o=r(6080);var i=Symbol("lastResolve");var s=Symbol("lastReject");var a=Symbol("error");var c=Symbol("ended");var l=Symbol("lastPromise");var u=Symbol("handlePromise");var d=Symbol("stream");function createIterResult(e,t){return{value:e,done:t}}function readAndResolve(e){var t=e[i];if(t!==null){var r=e[d].read();if(r!==null){e[l]=null;e[i]=null;e[s]=null;t(createIterResult(r,false))}}}function onReadable(e){process.nextTick(readAndResolve,e)}function wrapForNext(e,t){return function(r,n){e.then((function(){if(t[c]){r(createIterResult(undefined,true));return}t[u](r,n)}),n)}}var p=Object.getPrototypeOf((function(){}));var h=Object.setPrototypeOf((n={get stream(){return this[d]},next:function next(){var e=this;var t=this[a];if(t!==null){return Promise.reject(t)}if(this[c]){return Promise.resolve(createIterResult(undefined,true))}if(this[d].destroyed){return new Promise((function(t,r){process.nextTick((function(){if(e[a]){r(e[a])}else{t(createIterResult(undefined,true))}}))}))}var r=this[l];var n;if(r){n=new Promise(wrapForNext(r,this))}else{var o=this[d].read();if(o!==null){return Promise.resolve(createIterResult(o,false))}n=new Promise(this[u])}this[l]=n;return n}},_defineProperty(n,Symbol.asyncIterator,(function(){return this})),_defineProperty(n,"return",(function _return(){var e=this;return new Promise((function(t,r){e[d].destroy(null,(function(e){if(e){r(e);return}t(createIterResult(undefined,true))}))}))})),n),p);var m=function createReadableStreamAsyncIterator(e){var t;var r=Object.create(h,(t={},_defineProperty(t,d,{value:e,writable:true}),_defineProperty(t,i,{value:null,writable:true}),_defineProperty(t,s,{value:null,writable:true}),_defineProperty(t,a,{value:null,writable:true}),_defineProperty(t,c,{value:e._readableState.endEmitted,writable:true}),_defineProperty(t,u,{value:function value(e,t){var n=r[d].read();if(n){r[l]=null;r[i]=null;r[s]=null;e(createIterResult(n,false))}else{r[i]=e;r[s]=t}},writable:true}),t));r[l]=null;o(e,(function(e){if(e&&e.code!=="ERR_STREAM_PREMATURE_CLOSE"){var t=r[s];if(t!==null){r[l]=null;r[i]=null;r[s]=null;t(e)}r[a]=e;return}var n=r[i];if(n!==null){r[l]=null;r[i]=null;r[s]=null;n(createIterResult(undefined,true))}r[c]=true}));e.on("readable",onReadable.bind(null,r));return r};e.exports=m},2746:(e,t,r)=>{"use strict";function ownKeys(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);if(t)n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}));r.push.apply(r,n)}return r}function _objectSpread(e){for(var t=1;t0)this.tail.next=t;else this.head=t;this.tail=t;++this.length}},{key:"unshift",value:function unshift(e){var t={data:e,next:this.head};if(this.length===0)this.tail=t;this.head=t;++this.length}},{key:"shift",value:function shift(){if(this.length===0)return;var e=this.head.data;if(this.length===1)this.head=this.tail=null;else this.head=this.head.next;--this.length;return e}},{key:"clear",value:function clear(){this.head=this.tail=null;this.length=0}},{key:"join",value:function join(e){if(this.length===0)return"";var t=this.head;var r=""+t.data;while(t=t.next){r+=e+t.data}return r}},{key:"concat",value:function concat(e){if(this.length===0)return o.alloc(0);var t=o.allocUnsafe(e>>>0);var r=this.head;var n=0;while(r){copyBuffer(r.data,t,n);n+=r.data.length;r=r.next}return t}},{key:"consume",value:function consume(e,t){var r;if(eo.length?o.length:e;if(i===o.length)n+=o;else n+=o.slice(0,e);e-=i;if(e===0){if(i===o.length){++r;if(t.next)this.head=t.next;else this.head=this.tail=null}else{this.head=t;t.data=o.slice(i)}break}++r}this.length-=r;return n}},{key:"_getBuffer",value:function _getBuffer(e){var t=o.allocUnsafe(e);var r=this.head;var n=1;r.data.copy(t);e-=r.data.length;while(r=r.next){var i=r.data;var s=e>i.length?i.length:e;i.copy(t,t.length-e,0,s);e-=s;if(e===0){if(s===i.length){++n;if(r.next)this.head=r.next;else this.head=this.tail=null}else{this.head=r;r.data=i.slice(s)}break}++n}this.length-=n;return t}},{key:a,value:function value(e,t){return s(this,_objectSpread({},t,{depth:0,customInspect:false}))}}]);return BufferList}()},7049:e=>{"use strict";function destroy(e,t){var r=this;var n=this._readableState&&this._readableState.destroyed;var o=this._writableState&&this._writableState.destroyed;if(n||o){if(t){t(e)}else if(e){if(!this._writableState){process.nextTick(emitErrorNT,this,e)}else if(!this._writableState.errorEmitted){this._writableState.errorEmitted=true;process.nextTick(emitErrorNT,this,e)}}return this}if(this._readableState){this._readableState.destroyed=true}if(this._writableState){this._writableState.destroyed=true}this._destroy(e||null,(function(e){if(!t&&e){if(!r._writableState){process.nextTick(emitErrorAndCloseNT,r,e)}else if(!r._writableState.errorEmitted){r._writableState.errorEmitted=true;process.nextTick(emitErrorAndCloseNT,r,e)}else{process.nextTick(emitCloseNT,r)}}else if(t){process.nextTick(emitCloseNT,r);t(e)}else{process.nextTick(emitCloseNT,r)}}));return this}function emitErrorAndCloseNT(e,t){emitErrorNT(e,t);emitCloseNT(e)}function emitCloseNT(e){if(e._writableState&&!e._writableState.emitClose)return;if(e._readableState&&!e._readableState.emitClose)return;e.emit("close")}function undestroy(){if(this._readableState){this._readableState.destroyed=false;this._readableState.reading=false;this._readableState.ended=false;this._readableState.endEmitted=false}if(this._writableState){this._writableState.destroyed=false;this._writableState.ended=false;this._writableState.ending=false;this._writableState.finalCalled=false;this._writableState.prefinished=false;this._writableState.finished=false;this._writableState.errorEmitted=false}}function emitErrorNT(e,t){e.emit("error",t)}function errorOrDestroy(e,t){var r=e._readableState;var n=e._writableState;if(r&&r.autoDestroy||n&&n.autoDestroy)e.destroy(t);else e.emit("error",t)}e.exports={destroy:destroy,undestroy:undestroy,errorOrDestroy:errorOrDestroy}},6080:(e,t,r)=>{"use strict";var n=r(7214).q.ERR_STREAM_PREMATURE_CLOSE;function once(e){var t=false;return function(){if(t)return;t=true;for(var r=arguments.length,n=new Array(r),o=0;o{"use strict";function asyncGeneratorStep(e,t,r,n,o,i,s){try{var a=e[i](s);var c=a.value}catch(e){r(e);return}if(a.done){t(c)}else{Promise.resolve(c).then(n,o)}}function _asyncToGenerator(e){return function(){var t=this,r=arguments;return new Promise((function(n,o){var i=e.apply(t,r);function _next(e){asyncGeneratorStep(i,n,o,_next,_throw,"next",e)}function _throw(e){asyncGeneratorStep(i,n,o,_next,_throw,"throw",e)}_next(undefined)}))}}function ownKeys(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);if(t)n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}));r.push.apply(r,n)}return r}function _objectSpread(e){for(var t=1;t{"use strict";var n;function once(e){var t=false;return function(){if(t)return;t=true;e.apply(void 0,arguments)}}var o=r(7214).q,i=o.ERR_MISSING_ARGS,s=o.ERR_STREAM_DESTROYED;function noop(e){if(e)throw e}function isRequest(e){return e.setHeader&&typeof e.abort==="function"}function destroyer(e,t,o,i){i=once(i);var a=false;e.on("close",(function(){a=true}));if(n===undefined)n=r(6080);n(e,{readable:t,writable:o},(function(e){if(e)return i(e);a=true;i()}));var c=false;return function(t){if(a)return;if(c)return;c=true;if(isRequest(e))return e.abort();if(typeof e.destroy==="function")return e.destroy();i(t||new s("pipe"))}}function call(e){e()}function pipe(e,t){return e.pipe(t)}function popCallback(e){if(!e.length)return noop;if(typeof e[e.length-1]!=="function")return noop;return e.pop()}function pipeline(){for(var e=arguments.length,t=new Array(e),r=0;r0;return destroyer(e,i,a,(function(e){if(!o)o=e;if(e)s.forEach(call);if(i)return;s.forEach(call);n(o)}))}));return t.reduce(pipe)}e.exports=pipeline},9948:(e,t,r)=>{"use strict";var n=r(7214).q.ERR_INVALID_OPT_VALUE;function highWaterMarkFrom(e,t,r){return e.highWaterMark!=null?e.highWaterMark:t?e[r]:null}function getHighWaterMark(e,t,r,o){var i=highWaterMarkFrom(t,o,r);if(i!=null){if(!(isFinite(i)&&Math.floor(i)===i)||i<0){var s=o?r:"highWaterMark";throw new n(s,i)}return Math.floor(i)}return e.objectMode?16:16*1024}e.exports={getHighWaterMark:getHighWaterMark}},2387:(e,t,r)=>{e.exports=r(2413)},1642:(e,t,r)=>{var n=r(2413);if(process.env.READABLE_STREAM==="disable"&&n){e.exports=n.Readable;Object.assign(e.exports,n);e.exports.Stream=n}else{t=e.exports=r(1433);t.Stream=n||t;t.Readable=t;t.Writable=r(6993);t.Duplex=r(1359);t.Transform=r(4415);t.PassThrough=r(1542);t.finished=r(6080);t.pipeline=r(6989)}},4959:(e,t,r)=>{const n=r(2357);const o=r(5622);const i=r(5747);let s=undefined;try{s=r(1957)}catch(e){}const a={nosort:true,silent:true};let c=0;const l=process.platform==="win32";const defaults=e=>{const t=["unlink","chmod","stat","lstat","rmdir","readdir"];t.forEach((t=>{e[t]=e[t]||i[t];t=t+"Sync";e[t]=e[t]||i[t]}));e.maxBusyTries=e.maxBusyTries||3;e.emfileWait=e.emfileWait||1e3;if(e.glob===false){e.disableGlob=true}if(e.disableGlob!==true&&s===undefined){throw Error("glob dependency not found, set `options.disableGlob = true` if intentional")}e.disableGlob=e.disableGlob||false;e.glob=e.glob||a};const rimraf=(e,t,r)=>{if(typeof t==="function"){r=t;t={}}n(e,"rimraf: missing path");n.equal(typeof e,"string","rimraf: path should be a string");n.equal(typeof r,"function","rimraf: callback function required");n(t,"rimraf: invalid options argument provided");n.equal(typeof t,"object","rimraf: options should be object");defaults(t);let o=0;let i=null;let a=0;const next=e=>{i=i||e;if(--a===0)r(i)};const afterGlob=(e,n)=>{if(e)return r(e);a=n.length;if(a===0)return r();n.forEach((e=>{const CB=r=>{if(r){if((r.code==="EBUSY"||r.code==="ENOTEMPTY"||r.code==="EPERM")&&orimraf_(e,t,CB)),o*100)}if(r.code==="EMFILE"&&crimraf_(e,t,CB)),c++)}if(r.code==="ENOENT")r=null}c=0;next(r)};rimraf_(e,t,CB)}))};if(t.disableGlob||!s.hasMagic(e))return afterGlob(null,[e]);t.lstat(e,((r,n)=>{if(!r)return afterGlob(null,[e]);s(e,t.glob,afterGlob)}))};const rimraf_=(e,t,r)=>{n(e);n(t);n(typeof r==="function");t.lstat(e,((n,o)=>{if(n&&n.code==="ENOENT")return r(null);if(n&&n.code==="EPERM"&&l)fixWinEPERM(e,t,n,r);if(o&&o.isDirectory())return rmdir(e,t,n,r);t.unlink(e,(n=>{if(n){if(n.code==="ENOENT")return r(null);if(n.code==="EPERM")return l?fixWinEPERM(e,t,n,r):rmdir(e,t,n,r);if(n.code==="EISDIR")return rmdir(e,t,n,r)}return r(n)}))}))};const fixWinEPERM=(e,t,r,o)=>{n(e);n(t);n(typeof o==="function");t.chmod(e,438,(n=>{if(n)o(n.code==="ENOENT"?null:r);else t.stat(e,((n,i)=>{if(n)o(n.code==="ENOENT"?null:r);else if(i.isDirectory())rmdir(e,t,r,o);else t.unlink(e,o)}))}))};const fixWinEPERMSync=(e,t,r)=>{n(e);n(t);try{t.chmodSync(e,438)}catch(e){if(e.code==="ENOENT")return;else throw r}let o;try{o=t.statSync(e)}catch(e){if(e.code==="ENOENT")return;else throw r}if(o.isDirectory())rmdirSync(e,t,r);else t.unlinkSync(e)};const rmdir=(e,t,r,o)=>{n(e);n(t);n(typeof o==="function");t.rmdir(e,(n=>{if(n&&(n.code==="ENOTEMPTY"||n.code==="EEXIST"||n.code==="EPERM"))rmkids(e,t,o);else if(n&&n.code==="ENOTDIR")o(r);else o(n)}))};const rmkids=(e,t,r)=>{n(e);n(t);n(typeof r==="function");t.readdir(e,((n,i)=>{if(n)return r(n);let s=i.length;if(s===0)return t.rmdir(e,r);let a;i.forEach((n=>{rimraf(o.join(e,n),t,(n=>{if(a)return;if(n)return r(a=n);if(--s===0)t.rmdir(e,r)}))}))}))};const rimrafSync=(e,t)=>{t=t||{};defaults(t);n(e,"rimraf: missing path");n.equal(typeof e,"string","rimraf: path should be a string");n(t,"rimraf: missing options");n.equal(typeof t,"object","rimraf: options should be object");let r;if(t.disableGlob||!s.hasMagic(e)){r=[e]}else{try{t.lstatSync(e);r=[e]}catch(n){r=s.sync(e,t.glob)}}if(!r.length)return;for(let e=0;e{n(e);n(t);try{t.rmdirSync(e)}catch(n){if(n.code==="ENOENT")return;if(n.code==="ENOTDIR")throw r;if(n.code==="ENOTEMPTY"||n.code==="EEXIST"||n.code==="EPERM")rmkidsSync(e,t)}};const rmkidsSync=(e,t)=>{n(e);n(t);t.readdirSync(e).forEach((r=>rimrafSync(o.join(e,r),t)));const r=l?100:1;let i=0;do{let n=true;try{const o=t.rmdirSync(e,t);n=false;return o}finally{if(++i{var n=r(4293);var o=n.Buffer;function copyProps(e,t){for(var r in e){t[r]=e[r]}}if(o.from&&o.alloc&&o.allocUnsafe&&o.allocUnsafeSlow){e.exports=n}else{copyProps(n,t);t.Buffer=SafeBuffer}function SafeBuffer(e,t,r){return o(e,t,r)}copyProps(o,SafeBuffer);SafeBuffer.from=function(e,t,r){if(typeof e==="number"){throw new TypeError("Argument must not be a number")}return o(e,t,r)};SafeBuffer.alloc=function(e,t,r){if(typeof e!=="number"){throw new TypeError("Argument must be a number")}var n=o(e);if(t!==undefined){if(typeof r==="string"){n.fill(t,r)}else{n.fill(t)}}else{n.fill(0)}return n};SafeBuffer.allocUnsafe=function(e){if(typeof e!=="number"){throw new TypeError("Argument must be a number")}return o(e)};SafeBuffer.allocUnsafeSlow=function(e){if(typeof e!=="number"){throw new TypeError("Argument must be a number")}return n.SlowBuffer(e)}},9178:(e,t,r)=>{"use strict";const{unassigned_code_points:n,commonly_mapped_to_nothing:o,non_ASCII_space_characters:i,prohibited_characters:s,bidirectional_r_al:a,bidirectional_l:c}=r(8916);e.exports=saslprep;const l=i;const u=o;const getCodePoint=e=>e.codePointAt(0);const first=e=>e[0];const last=e=>e[e.length-1];function toCodePoints(e){const t=[];const r=e.length;for(let n=0;n=55296&&o<=56319&&r>n+1){const r=e.charCodeAt(n+1);if(r>=56320&&r<=57343){t.push((o-55296)*1024+r-56320+65536);n+=1;continue}}t.push(o)}return t}function saslprep(e,t={}){if(typeof e!=="string"){throw new TypeError("Expected string.")}if(e.length===0){return""}const r=toCodePoints(e).map((e=>l.get(e)?32:e)).filter((e=>!u.get(e)));const o=String.fromCodePoint.apply(null,r).normalize("NFKC");const i=toCodePoints(o);const d=i.some((e=>s.get(e)));if(d){throw new Error("Prohibited character, see https://tools.ietf.org/html/rfc4013#section-2.3")}if(t.allowUnassigned!==true){const e=i.some((e=>n.get(e)));if(e){throw new Error("Unassigned code point, see https://tools.ietf.org/html/rfc4013#section-2.5")}}const p=i.some((e=>a.get(e)));const h=i.some((e=>c.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=a.get(getCodePoint(first(o)));const g=a.get(getCodePoint(last(o)));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}},8916:(e,t,r)=>{"use strict";const n=r(5747);const o=r(5622);const i=r(1453);const s=n.readFileSync(r.ab+"code-points.mem");let a=0;function read(){const e=s.readUInt32BE(a);a+=4;const t=s.slice(a,a+e);a+=e;return i({buffer:t})}const c=read();const l=read();const u=read();const d=read();const p=read();const h=read();e.exports={unassigned_code_points:c,commonly_mapped_to_nothing:l,non_ASCII_space_characters:u,prohibited_characters:d,bidirectional_r_al:p,bidirectional_l:h}},5911:(e,t)=>{t=e.exports=SemVer;var r;if(typeof process==="object"&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)){r=function(){var e=Array.prototype.slice.call(arguments,0);e.unshift("SEMVER");console.log.apply(console,e)}}else{r=function(){}}t.SEMVER_SPEC_VERSION="2.0.0";var n=256;var o=Number.MAX_SAFE_INTEGER||9007199254740991;var i=16;var s=t.re=[];var a=t.src=[];var c=t.tokens={};var l=0;function tok(e){c[e]=l++}tok("NUMERICIDENTIFIER");a[c.NUMERICIDENTIFIER]="0|[1-9]\\d*";tok("NUMERICIDENTIFIERLOOSE");a[c.NUMERICIDENTIFIERLOOSE]="[0-9]+";tok("NONNUMERICIDENTIFIER");a[c.NONNUMERICIDENTIFIER]="\\d*[a-zA-Z-][a-zA-Z0-9-]*";tok("MAINVERSION");a[c.MAINVERSION]="("+a[c.NUMERICIDENTIFIER]+")\\."+"("+a[c.NUMERICIDENTIFIER]+")\\."+"("+a[c.NUMERICIDENTIFIER]+")";tok("MAINVERSIONLOOSE");a[c.MAINVERSIONLOOSE]="("+a[c.NUMERICIDENTIFIERLOOSE]+")\\."+"("+a[c.NUMERICIDENTIFIERLOOSE]+")\\."+"("+a[c.NUMERICIDENTIFIERLOOSE]+")";tok("PRERELEASEIDENTIFIER");a[c.PRERELEASEIDENTIFIER]="(?:"+a[c.NUMERICIDENTIFIER]+"|"+a[c.NONNUMERICIDENTIFIER]+")";tok("PRERELEASEIDENTIFIERLOOSE");a[c.PRERELEASEIDENTIFIERLOOSE]="(?:"+a[c.NUMERICIDENTIFIERLOOSE]+"|"+a[c.NONNUMERICIDENTIFIER]+")";tok("PRERELEASE");a[c.PRERELEASE]="(?:-("+a[c.PRERELEASEIDENTIFIER]+"(?:\\."+a[c.PRERELEASEIDENTIFIER]+")*))";tok("PRERELEASELOOSE");a[c.PRERELEASELOOSE]="(?:-?("+a[c.PRERELEASEIDENTIFIERLOOSE]+"(?:\\."+a[c.PRERELEASEIDENTIFIERLOOSE]+")*))";tok("BUILDIDENTIFIER");a[c.BUILDIDENTIFIER]="[0-9A-Za-z-]+";tok("BUILD");a[c.BUILD]="(?:\\+("+a[c.BUILDIDENTIFIER]+"(?:\\."+a[c.BUILDIDENTIFIER]+")*))";tok("FULL");tok("FULLPLAIN");a[c.FULLPLAIN]="v?"+a[c.MAINVERSION]+a[c.PRERELEASE]+"?"+a[c.BUILD]+"?";a[c.FULL]="^"+a[c.FULLPLAIN]+"$";tok("LOOSEPLAIN");a[c.LOOSEPLAIN]="[v=\\s]*"+a[c.MAINVERSIONLOOSE]+a[c.PRERELEASELOOSE]+"?"+a[c.BUILD]+"?";tok("LOOSE");a[c.LOOSE]="^"+a[c.LOOSEPLAIN]+"$";tok("GTLT");a[c.GTLT]="((?:<|>)?=?)";tok("XRANGEIDENTIFIERLOOSE");a[c.XRANGEIDENTIFIERLOOSE]=a[c.NUMERICIDENTIFIERLOOSE]+"|x|X|\\*";tok("XRANGEIDENTIFIER");a[c.XRANGEIDENTIFIER]=a[c.NUMERICIDENTIFIER]+"|x|X|\\*";tok("XRANGEPLAIN");a[c.XRANGEPLAIN]="[v=\\s]*("+a[c.XRANGEIDENTIFIER]+")"+"(?:\\.("+a[c.XRANGEIDENTIFIER]+")"+"(?:\\.("+a[c.XRANGEIDENTIFIER]+")"+"(?:"+a[c.PRERELEASE]+")?"+a[c.BUILD]+"?"+")?)?";tok("XRANGEPLAINLOOSE");a[c.XRANGEPLAINLOOSE]="[v=\\s]*("+a[c.XRANGEIDENTIFIERLOOSE]+")"+"(?:\\.("+a[c.XRANGEIDENTIFIERLOOSE]+")"+"(?:\\.("+a[c.XRANGEIDENTIFIERLOOSE]+")"+"(?:"+a[c.PRERELEASELOOSE]+")?"+a[c.BUILD]+"?"+")?)?";tok("XRANGE");a[c.XRANGE]="^"+a[c.GTLT]+"\\s*"+a[c.XRANGEPLAIN]+"$";tok("XRANGELOOSE");a[c.XRANGELOOSE]="^"+a[c.GTLT]+"\\s*"+a[c.XRANGEPLAINLOOSE]+"$";tok("COERCE");a[c.COERCE]="(^|[^\\d])"+"(\\d{1,"+i+"})"+"(?:\\.(\\d{1,"+i+"}))?"+"(?:\\.(\\d{1,"+i+"}))?"+"(?:$|[^\\d])";tok("COERCERTL");s[c.COERCERTL]=new RegExp(a[c.COERCE],"g");tok("LONETILDE");a[c.LONETILDE]="(?:~>?)";tok("TILDETRIM");a[c.TILDETRIM]="(\\s*)"+a[c.LONETILDE]+"\\s+";s[c.TILDETRIM]=new RegExp(a[c.TILDETRIM],"g");var u="$1~";tok("TILDE");a[c.TILDE]="^"+a[c.LONETILDE]+a[c.XRANGEPLAIN]+"$";tok("TILDELOOSE");a[c.TILDELOOSE]="^"+a[c.LONETILDE]+a[c.XRANGEPLAINLOOSE]+"$";tok("LONECARET");a[c.LONECARET]="(?:\\^)";tok("CARETTRIM");a[c.CARETTRIM]="(\\s*)"+a[c.LONECARET]+"\\s+";s[c.CARETTRIM]=new RegExp(a[c.CARETTRIM],"g");var d="$1^";tok("CARET");a[c.CARET]="^"+a[c.LONECARET]+a[c.XRANGEPLAIN]+"$";tok("CARETLOOSE");a[c.CARETLOOSE]="^"+a[c.LONECARET]+a[c.XRANGEPLAINLOOSE]+"$";tok("COMPARATORLOOSE");a[c.COMPARATORLOOSE]="^"+a[c.GTLT]+"\\s*("+a[c.LOOSEPLAIN]+")$|^$";tok("COMPARATOR");a[c.COMPARATOR]="^"+a[c.GTLT]+"\\s*("+a[c.FULLPLAIN]+")$|^$";tok("COMPARATORTRIM");a[c.COMPARATORTRIM]="(\\s*)"+a[c.GTLT]+"\\s*("+a[c.LOOSEPLAIN]+"|"+a[c.XRANGEPLAIN]+")";s[c.COMPARATORTRIM]=new RegExp(a[c.COMPARATORTRIM],"g");var p="$1$2$3";tok("HYPHENRANGE");a[c.HYPHENRANGE]="^\\s*("+a[c.XRANGEPLAIN]+")"+"\\s+-\\s+"+"("+a[c.XRANGEPLAIN]+")"+"\\s*$";tok("HYPHENRANGELOOSE");a[c.HYPHENRANGELOOSE]="^\\s*("+a[c.XRANGEPLAINLOOSE]+")"+"\\s+-\\s+"+"("+a[c.XRANGEPLAINLOOSE]+")"+"\\s*$";tok("STAR");a[c.STAR]="(<|>)?=?\\s*\\*";for(var h=0;hn){return null}var r=t.loose?s[c.LOOSE]:s[c.FULL];if(!r.test(e)){return null}try{return new SemVer(e,t)}catch(e){return null}}t.valid=valid;function valid(e,t){var r=parse(e,t);return r?r.version:null}t.clean=clean;function clean(e,t){var r=parse(e.trim().replace(/^[=v]+/,""),t);return r?r.version:null}t.SemVer=SemVer;function SemVer(e,t){if(!t||typeof t!=="object"){t={loose:!!t,includePrerelease:false}}if(e instanceof SemVer){if(e.loose===t.loose){return e}else{e=e.version}}else if(typeof e!=="string"){throw new TypeError("Invalid Version: "+e)}if(e.length>n){throw new TypeError("version is longer than "+n+" characters")}if(!(this instanceof SemVer)){return new SemVer(e,t)}r("SemVer",e,t);this.options=t;this.loose=!!t.loose;var i=e.trim().match(t.loose?s[c.LOOSE]:s[c.FULL]);if(!i){throw new TypeError("Invalid Version: "+e)}this.raw=e;this.major=+i[1];this.minor=+i[2];this.patch=+i[3];if(this.major>o||this.major<0){throw new TypeError("Invalid major version")}if(this.minor>o||this.minor<0){throw new TypeError("Invalid minor version")}if(this.patch>o||this.patch<0){throw new TypeError("Invalid patch version")}if(!i[4]){this.prerelease=[]}else{this.prerelease=i[4].split(".").map((function(e){if(/^[0-9]+$/.test(e)){var t=+e;if(t>=0&&t=0){if(typeof this.prerelease[r]==="number"){this.prerelease[r]++;r=-2}}if(r===-1){this.prerelease.push(0)}}if(t){if(this.prerelease[0]===t){if(isNaN(this.prerelease[1])){this.prerelease=[t,0]}}else{this.prerelease=[t,0]}}break;default:throw new Error("invalid increment argument: "+e)}this.format();this.raw=this.version;return this};t.inc=inc;function inc(e,t,r,n){if(typeof r==="string"){n=r;r=undefined}try{return new SemVer(e,r).inc(t,n).version}catch(e){return null}}t.diff=diff;function diff(e,t){if(eq(e,t)){return null}else{var r=parse(e);var n=parse(t);var o="";if(r.prerelease.length||n.prerelease.length){o="pre";var i="prerelease"}for(var s in r){if(s==="major"||s==="minor"||s==="patch"){if(r[s]!==n[s]){return o+s}}}return i}}t.compareIdentifiers=compareIdentifiers;var m=/^[0-9]+$/;function compareIdentifiers(e,t){var r=m.test(e);var n=m.test(t);if(r&&n){e=+e;t=+t}return e===t?0:r&&!n?-1:n&&!r?1:e0}t.lt=lt;function lt(e,t,r){return compare(e,t,r)<0}t.eq=eq;function eq(e,t,r){return compare(e,t,r)===0}t.neq=neq;function neq(e,t,r){return compare(e,t,r)!==0}t.gte=gte;function gte(e,t,r){return compare(e,t,r)>=0}t.lte=lte;function lte(e,t,r){return compare(e,t,r)<=0}t.cmp=cmp;function cmp(e,t,r,n){switch(t){case"===":if(typeof e==="object")e=e.version;if(typeof r==="object")r=r.version;return e===r;case"!==":if(typeof e==="object")e=e.version;if(typeof r==="object")r=r.version;return e!==r;case"":case"=":case"==":return eq(e,r,n);case"!=":return neq(e,r,n);case">":return gt(e,r,n);case">=":return gte(e,r,n);case"<":return lt(e,r,n);case"<=":return lte(e,r,n);default:throw new TypeError("Invalid operator: "+t)}}t.Comparator=Comparator;function Comparator(e,t){if(!t||typeof t!=="object"){t={loose:!!t,includePrerelease:false}}if(e instanceof Comparator){if(e.loose===!!t.loose){return e}else{e=e.value}}if(!(this instanceof Comparator)){return new Comparator(e,t)}r("comparator",e,t);this.options=t;this.loose=!!t.loose;this.parse(e);if(this.semver===g){this.value=""}else{this.value=this.operator+this.semver.version}r("comp",this)}var g={};Comparator.prototype.parse=function(e){var t=this.options.loose?s[c.COMPARATORLOOSE]:s[c.COMPARATOR];var r=e.match(t);if(!r){throw new TypeError("Invalid comparator: "+e)}this.operator=r[1]!==undefined?r[1]:"";if(this.operator==="="){this.operator=""}if(!r[2]){this.semver=g}else{this.semver=new SemVer(r[2],this.options.loose)}};Comparator.prototype.toString=function(){return this.value};Comparator.prototype.test=function(e){r("Comparator.test",e,this.options.loose);if(this.semver===g||e===g){return true}if(typeof e==="string"){try{e=new SemVer(e,this.options)}catch(e){return false}}return cmp(e,this.operator,this.semver,this.options)};Comparator.prototype.intersects=function(e,t){if(!(e instanceof Comparator)){throw new TypeError("a Comparator is required")}if(!t||typeof t!=="object"){t={loose:!!t,includePrerelease:false}}var r;if(this.operator===""){if(this.value===""){return true}r=new Range(e.value,t);return satisfies(this.value,r,t)}else if(e.operator===""){if(e.value===""){return true}r=new Range(this.value,t);return satisfies(e.semver,r,t)}var n=(this.operator===">="||this.operator===">")&&(e.operator===">="||e.operator===">");var o=(this.operator==="<="||this.operator==="<")&&(e.operator==="<="||e.operator==="<");var i=this.semver.version===e.semver.version;var s=(this.operator===">="||this.operator==="<=")&&(e.operator===">="||e.operator==="<=");var a=cmp(this.semver,"<",e.semver,t)&&((this.operator===">="||this.operator===">")&&(e.operator==="<="||e.operator==="<"));var c=cmp(this.semver,">",e.semver,t)&&((this.operator==="<="||this.operator==="<")&&(e.operator===">="||e.operator===">"));return n||o||i&&s||a||c};t.Range=Range;function Range(e,t){if(!t||typeof t!=="object"){t={loose:!!t,includePrerelease:false}}if(e instanceof Range){if(e.loose===!!t.loose&&e.includePrerelease===!!t.includePrerelease){return e}else{return new Range(e.raw,t)}}if(e instanceof Comparator){return new Range(e.value,t)}if(!(this instanceof Range)){return new Range(e,t)}this.options=t;this.loose=!!t.loose;this.includePrerelease=!!t.includePrerelease;this.raw=e;this.set=e.split(/\s*\|\|\s*/).map((function(e){return this.parseRange(e.trim())}),this).filter((function(e){return e.length}));if(!this.set.length){throw new TypeError("Invalid SemVer Range: "+e)}this.format()}Range.prototype.format=function(){this.range=this.set.map((function(e){return e.join(" ").trim()})).join("||").trim();return this.range};Range.prototype.toString=function(){return this.range};Range.prototype.parseRange=function(e){var t=this.options.loose;e=e.trim();var n=t?s[c.HYPHENRANGELOOSE]:s[c.HYPHENRANGE];e=e.replace(n,hyphenReplace);r("hyphen replace",e);e=e.replace(s[c.COMPARATORTRIM],p);r("comparator trim",e,s[c.COMPARATORTRIM]);e=e.replace(s[c.TILDETRIM],u);e=e.replace(s[c.CARETTRIM],d);e=e.split(/\s+/).join(" ");var o=t?s[c.COMPARATORLOOSE]:s[c.COMPARATOR];var i=e.split(" ").map((function(e){return parseComparator(e,this.options)}),this).join(" ").split(/\s+/);if(this.options.loose){i=i.filter((function(e){return!!e.match(o)}))}i=i.map((function(e){return new Comparator(e,this.options)}),this);return i};Range.prototype.intersects=function(e,t){if(!(e instanceof Range)){throw new TypeError("a Range is required")}return this.set.some((function(r){return isSatisfiable(r,t)&&e.set.some((function(e){return isSatisfiable(e,t)&&r.every((function(r){return e.every((function(e){return r.intersects(e,t)}))}))}))}))};function isSatisfiable(e,t){var r=true;var n=e.slice();var o=n.pop();while(r&&n.length){r=n.every((function(e){return o.intersects(e,t)}));o=n.pop()}return r}t.toComparators=toComparators;function toComparators(e,t){return new Range(e,t).set.map((function(e){return e.map((function(e){return e.value})).join(" ").trim().split(" ")}))}function parseComparator(e,t){r("comp",e,t);e=replaceCarets(e,t);r("caret",e);e=replaceTildes(e,t);r("tildes",e);e=replaceXRanges(e,t);r("xrange",e);e=replaceStars(e,t);r("stars",e);return e}function isX(e){return!e||e.toLowerCase()==="x"||e==="*"}function replaceTildes(e,t){return e.trim().split(/\s+/).map((function(e){return replaceTilde(e,t)})).join(" ")}function replaceTilde(e,t){var n=t.loose?s[c.TILDELOOSE]:s[c.TILDE];return e.replace(n,(function(t,n,o,i,s){r("tilde",e,t,n,o,i,s);var a;if(isX(n)){a=""}else if(isX(o)){a=">="+n+".0.0 <"+(+n+1)+".0.0"}else if(isX(i)){a=">="+n+"."+o+".0 <"+n+"."+(+o+1)+".0"}else if(s){r("replaceTilde pr",s);a=">="+n+"."+o+"."+i+"-"+s+" <"+n+"."+(+o+1)+".0"}else{a=">="+n+"."+o+"."+i+" <"+n+"."+(+o+1)+".0"}r("tilde return",a);return a}))}function replaceCarets(e,t){return e.trim().split(/\s+/).map((function(e){return replaceCaret(e,t)})).join(" ")}function replaceCaret(e,t){r("caret",e,t);var n=t.loose?s[c.CARETLOOSE]:s[c.CARET];return e.replace(n,(function(t,n,o,i,s){r("caret",e,t,n,o,i,s);var a;if(isX(n)){a=""}else if(isX(o)){a=">="+n+".0.0 <"+(+n+1)+".0.0"}else if(isX(i)){if(n==="0"){a=">="+n+"."+o+".0 <"+n+"."+(+o+1)+".0"}else{a=">="+n+"."+o+".0 <"+(+n+1)+".0.0"}}else if(s){r("replaceCaret pr",s);if(n==="0"){if(o==="0"){a=">="+n+"."+o+"."+i+"-"+s+" <"+n+"."+o+"."+(+i+1)}else{a=">="+n+"."+o+"."+i+"-"+s+" <"+n+"."+(+o+1)+".0"}}else{a=">="+n+"."+o+"."+i+"-"+s+" <"+(+n+1)+".0.0"}}else{r("no pr");if(n==="0"){if(o==="0"){a=">="+n+"."+o+"."+i+" <"+n+"."+o+"."+(+i+1)}else{a=">="+n+"."+o+"."+i+" <"+n+"."+(+o+1)+".0"}}else{a=">="+n+"."+o+"."+i+" <"+(+n+1)+".0.0"}}r("caret return",a);return a}))}function replaceXRanges(e,t){r("replaceXRanges",e,t);return e.split(/\s+/).map((function(e){return replaceXRange(e,t)})).join(" ")}function replaceXRange(e,t){e=e.trim();var n=t.loose?s[c.XRANGELOOSE]:s[c.XRANGE];return e.replace(n,(function(n,o,i,s,a,c){r("xRange",e,n,o,i,s,a,c);var l=isX(i);var u=l||isX(s);var d=u||isX(a);var p=d;if(o==="="&&p){o=""}c=t.includePrerelease?"-0":"";if(l){if(o===">"||o==="<"){n="<0.0.0-0"}else{n="*"}}else if(o&&p){if(u){s=0}a=0;if(o===">"){o=">=";if(u){i=+i+1;s=0;a=0}else{s=+s+1;a=0}}else if(o==="<="){o="<";if(u){i=+i+1}else{s=+s+1}}n=o+i+"."+s+"."+a+c}else if(u){n=">="+i+".0.0"+c+" <"+(+i+1)+".0.0"+c}else if(d){n=">="+i+"."+s+".0"+c+" <"+i+"."+(+s+1)+".0"+c}r("xRange return",n);return n}))}function replaceStars(e,t){r("replaceStars",e,t);return e.trim().replace(s[c.STAR],"")}function hyphenReplace(e,t,r,n,o,i,s,a,c,l,u,d,p){if(isX(r)){t=""}else if(isX(n)){t=">="+r+".0.0"}else if(isX(o)){t=">="+r+"."+n+".0"}else{t=">="+t}if(isX(c)){a=""}else if(isX(l)){a="<"+(+c+1)+".0.0"}else if(isX(u)){a="<"+c+"."+(+l+1)+".0"}else if(d){a="<="+c+"."+l+"."+u+"-"+d}else{a="<="+a}return(t+" "+a).trim()}Range.prototype.test=function(e){if(!e){return false}if(typeof e==="string"){try{e=new SemVer(e,this.options)}catch(e){return false}}for(var t=0;t0){var i=e[o].semver;if(i.major===t.major&&i.minor===t.minor&&i.patch===t.patch){return true}}}return false}return true}t.satisfies=satisfies;function satisfies(e,t,r){try{t=new Range(t,r)}catch(e){return false}return t.test(e)}t.maxSatisfying=maxSatisfying;function maxSatisfying(e,t,r){var n=null;var o=null;try{var i=new Range(t,r)}catch(e){return null}e.forEach((function(e){if(i.test(e)){if(!n||o.compare(e)===-1){n=e;o=new SemVer(n,r)}}}));return n}t.minSatisfying=minSatisfying;function minSatisfying(e,t,r){var n=null;var o=null;try{var i=new Range(t,r)}catch(e){return null}e.forEach((function(e){if(i.test(e)){if(!n||o.compare(e)===1){n=e;o=new SemVer(n,r)}}}));return n}t.minVersion=minVersion;function minVersion(e,t){e=new Range(e,t);var r=new SemVer("0.0.0");if(e.test(r)){return r}r=new SemVer("0.0.0-0");if(e.test(r)){return r}r=null;for(var n=0;n":if(t.prerelease.length===0){t.patch++}else{t.prerelease.push(0)}t.raw=t.format();case"":case">=":if(!r||gt(r,t)){r=t}break;case"<":case"<=":break;default:throw new Error("Unexpected operation: "+e.operator)}}))}if(r&&e.test(r)){return r}return null}t.validRange=validRange;function validRange(e,t){try{return new Range(e,t).range||"*"}catch(e){return null}}t.ltr=ltr;function ltr(e,t,r){return outside(e,t,"<",r)}t.gtr=gtr;function gtr(e,t,r){return outside(e,t,">",r)}t.outside=outside;function outside(e,t,r,n){e=new SemVer(e,n);t=new Range(t,n);var o,i,s,a,c;switch(r){case">":o=gt;i=lte;s=lt;a=">";c=">=";break;case"<":o=lt;i=gte;s=gt;a="<";c="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(satisfies(e,t,n)){return false}for(var l=0;l=0.0.0")}d=d||e;p=p||e;if(o(e.semver,d.semver,n)){d=e}else if(s(e.semver,p.semver,n)){p=e}}));if(d.operator===a||d.operator===c){return false}if((!p.operator||p.operator===a)&&i(e,p.semver)){return false}else if(p.operator===c&&s(e,p.semver)){return false}}return true}t.prerelease=prerelease;function prerelease(e,t){var r=parse(e,t);return r&&r.prerelease.length?r.prerelease:null}t.intersects=intersects;function intersects(e,t,r){e=new Range(e,r);t=new Range(t,r);return e.intersects(t)}t.coerce=coerce;function coerce(e,t){if(e instanceof SemVer){return e}if(typeof e==="number"){e=String(e)}if(typeof e!=="string"){return null}t=t||{};var r=null;if(!t.rtl){r=e.match(s[c.COERCE])}else{var n;while((n=s[c.COERCERTL].exec(e))&&(!r||r.index+r[0].length!==e.length)){if(!r||n.index+n[0].length!==r.index+r[0].length){r=n}s[c.COERCERTL].lastIndex=n.index+n[1].length+n[2].length}s[c.COERCERTL].lastIndex=-1}if(r===null){return null}return parse(r[2]+"."+(r[3]||"0")+"."+(r[4]||"0"),t)}},1453:(e,t,r)=>{var n=r(7147);e.exports=Bitfield;function Bitfield(e){if(!(this instanceof Bitfield))return new Bitfield(e);if(!e)e={};if(Buffer.isBuffer(e))e={buffer:e};this.pageOffset=e.pageOffset||0;this.pageSize=e.pageSize||1024;this.pages=e.pages||n(this.pageSize);this.byteLength=this.pages.length*this.pageSize;this.length=8*this.byteLength;if(!powerOfTwo(this.pageSize))throw new Error("The page size should be a power of two");this._trackUpdates=!!e.trackUpdates;this._pageMask=this.pageSize-1;if(e.buffer){for(var t=0;t>t)};Bitfield.prototype.getByte=function(e){var t=e&this._pageMask;var r=(e-t)/this.pageSize;var n=this.pages.get(r,true);return n?n.buffer[t+this.pageOffset]:0};Bitfield.prototype.set=function(e,t){var r=e&7;var n=(e-r)/8;var o=this.getByte(n);return this.setByte(n,t?o|128>>r:o&(255^128>>r))};Bitfield.prototype.toBuffer=function(){var e=alloc(this.pages.length*this.pageSize);for(var t=0;t=this.byteLength){this.byteLength=e+1;this.length=this.byteLength*8}if(this._trackUpdates)this.pages.updated(o);return true};function alloc(e){if(Buffer.alloc)return Buffer.alloc(e);var t=new Buffer(e);t.fill(0);return t}function powerOfTwo(e){return!(e&e-1)}},4841:(e,t,r)=>{"use strict";var n=r(1867).Buffer;var o=n.isEncoding||function(e){e=""+e;switch(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 true;default:return false}};function _normalizeEncoding(e){if(!e)return"utf8";var t;while(true){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=true}}}function normalizeEncoding(e){var t=_normalizeEncoding(e);if(typeof t!=="string"&&(n.isEncoding===o||!o(e)))throw new Error("Unknown encoding: "+e);return t||e}t.s=StringDecoder;function StringDecoder(e){this.encoding=normalizeEncoding(e);var t;switch(this.encoding){case"utf16le":this.text=utf16Text;this.end=utf16End;t=4;break;case"utf8":this.fillLast=utf8FillLast;t=4;break;case"base64":this.text=base64Text;this.end=base64End;t=3;break;default:this.write=simpleWrite;this.end=simpleEnd;return}this.lastNeed=0;this.lastTotal=0;this.lastChar=n.allocUnsafe(t)}StringDecoder.prototype.write=function(e){if(e.length===0)return"";var t;var r;if(this.lastNeed){t=this.fillLast(e);if(t===undefined)return"";r=this.lastNeed;this.lastNeed=0}else{r=0}if(r>5===6)return 2;else if(e>>4===14)return 3;else if(e>>3===30)return 4;return e>>6===2?-1:-2}function utf8CheckIncomplete(e,t,r){var n=t.length-1;if(n=0){if(o>0)e.lastNeed=o-1;return o}if(--n=0){if(o>0)e.lastNeed=o-2;return o}if(--n=0){if(o>0){if(o===2)o=0;else e.lastNeed=o-3}return o}return 0}function utf8CheckExtraBytes(e,t,r){if((t[0]&192)!==128){e.lastNeed=0;return"�"}if(e.lastNeed>1&&t.length>1){if((t[1]&192)!==128){e.lastNeed=1;return"�"}if(e.lastNeed>2&&t.length>2){if((t[2]&192)!==128){e.lastNeed=2;return"�"}}}}function utf8FillLast(e){var t=this.lastTotal-this.lastNeed;var r=utf8CheckExtraBytes(this,e,t);if(r!==undefined)return r;if(this.lastNeed<=e.length){e.copy(this.lastChar,t,0,this.lastNeed);return this.lastChar.toString(this.encoding,0,this.lastTotal)}e.copy(this.lastChar,t,0,e.length);this.lastNeed-=e.length}function utf8Text(e,t){var r=utf8CheckIncomplete(this,e,t);if(!this.lastNeed)return e.toString("utf8",t);this.lastTotal=r;var n=e.length-(r-this.lastNeed);e.copy(this.lastChar,0,n);return e.toString("utf8",t,n)}function utf8End(e){var t=e&&e.length?this.write(e):"";if(this.lastNeed)return t+"�";return t}function utf16Text(e,t){if((e.length-t)%2===0){var r=e.toString("utf16le",t);if(r){var n=r.charCodeAt(r.length-1);if(n>=55296&&n<=56319){this.lastNeed=2;this.lastTotal=4;this.lastChar[0]=e[e.length-2];this.lastChar[1]=e[e.length-1];return r.slice(0,-1)}}return r}this.lastNeed=1;this.lastTotal=2;this.lastChar[0]=e[e.length-1];return e.toString("utf16le",t,e.length-1)}function utf16End(e){var t=e&&e.length?this.write(e):"";if(this.lastNeed){var r=this.lastTotal-this.lastNeed;return t+this.lastChar.toString("utf16le",0,r)}return t}function base64Text(e,t){var r=(e.length-t)%3;if(r===0)return e.toString("base64",t);this.lastNeed=3-r;this.lastTotal=3;if(r===1){this.lastChar[0]=e[e.length-1]}else{this.lastChar[0]=e[e.length-2];this.lastChar[1]=e[e.length-1]}return e.toString("base64",t,e.length-r)}function base64End(e){var t=e&&e.length?this.write(e):"";if(this.lastNeed)return t+this.lastChar.toString("base64",0,3-this.lastNeed);return t}function simpleWrite(e){return e.toString(this.encoding)}function simpleEnd(e){return e&&e.length?this.write(e):""}},9318:(e,t,r)=>{"use strict";const n=r(2087);const o=r(3867);const i=r(1621);const{env:s}=process;let a;if(i("no-color")||i("no-colors")||i("color=false")||i("color=never")){a=0}else if(i("color")||i("colors")||i("color=true")||i("color=always")){a=1}if("FORCE_COLOR"in s){if(s.FORCE_COLOR==="true"){a=1}else if(s.FORCE_COLOR==="false"){a=0}else{a=s.FORCE_COLOR.length===0?1:Math.min(parseInt(s.FORCE_COLOR,10),3)}}function translateLevel(e){if(e===0){return false}return{level:e,hasBasic:true,has256:e>=2,has16m:e>=3}}function supportsColor(e,t){if(a===0){return 0}if(i("color=16m")||i("color=full")||i("color=truecolor")){return 3}if(i("color=256")){return 2}if(e&&!t&&a===undefined){return 0}const r=a||0;if(s.TERM==="dumb"){return r}if(process.platform==="win32"){const e=n.release().split(".");if(Number(e[0])>=10&&Number(e[2])>=10586){return Number(e[2])>=14931?3:2}return 1}if("CI"in s){if(["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","GITHUB_ACTIONS","BUILDKITE"].some((e=>e in s))||s.CI_NAME==="codeship"){return 1}return r}if("TEAMCITY_VERSION"in s){return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(s.TEAMCITY_VERSION)?1:0}if(s.COLORTERM==="truecolor"){return 3}if("TERM_PROGRAM"in s){const e=parseInt((s.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(s.TERM_PROGRAM){case"iTerm.app":return e>=3?3:2;case"Apple_Terminal":return 2}}if(/-256(color)?$/i.test(s.TERM)){return 2}if(/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(s.TERM)){return 1}if("COLORTERM"in s){return 1}return r}function getSupportLevel(e){const t=supportsColor(e,e&&e.isTTY);return translateLevel(t)}e.exports={supportsColor:getSupportLevel,stdout:translateLevel(supportsColor(true,o.isatty(1))),stderr:translateLevel(supportsColor(true,o.isatty(2)))}},7882:(e,t,r)=>{var n=r(1669);var o=r(336);var i=r(8860);var s=r(1642).Writable;var a=r(1642).PassThrough;var noop=function(){};var overflow=function(e){e&=511;return e&&512-e};var emptyStream=function(e,t){var r=new Source(e,t);r.end();return r};var mixinPax=function(e,t){if(t.path)e.name=t.path;if(t.linkpath)e.linkname=t.linkpath;if(t.size)e.size=parseInt(t.size,10);e.pax=t;return e};var Source=function(e,t){this._parent=e;this.offset=t;a.call(this,{autoDestroy:false})};n.inherits(Source,a);Source.prototype.destroy=function(e){this._parent.destroy(e)};var Extract=function(e){if(!(this instanceof Extract))return new Extract(e);s.call(this,e);e=e||{};this._offset=0;this._buffer=o();this._missing=0;this._partial=false;this._onparse=noop;this._header=null;this._stream=null;this._overflow=null;this._cb=null;this._locked=false;this._destroyed=false;this._pax=null;this._paxGlobal=null;this._gnuLongPath=null;this._gnuLongLinkPath=null;var t=this;var r=t._buffer;var oncontinue=function(){t._continue()};var onunlock=function(e){t._locked=false;if(e)return t.destroy(e);if(!t._stream)oncontinue()};var onstreamend=function(){t._stream=null;var e=overflow(t._header.size);if(e)t._parse(e,ondrain);else t._parse(512,onheader);if(!t._locked)oncontinue()};var ondrain=function(){t._buffer.consume(overflow(t._header.size));t._parse(512,onheader);oncontinue()};var onpaxglobalheader=function(){var e=t._header.size;t._paxGlobal=i.decodePax(r.slice(0,e));r.consume(e);onstreamend()};var onpaxheader=function(){var e=t._header.size;t._pax=i.decodePax(r.slice(0,e));if(t._paxGlobal)t._pax=Object.assign({},t._paxGlobal,t._pax);r.consume(e);onstreamend()};var ongnulongpath=function(){var n=t._header.size;this._gnuLongPath=i.decodeLongPath(r.slice(0,n),e.filenameEncoding);r.consume(n);onstreamend()};var ongnulonglinkpath=function(){var n=t._header.size;this._gnuLongLinkPath=i.decodeLongPath(r.slice(0,n),e.filenameEncoding);r.consume(n);onstreamend()};var onheader=function(){var n=t._offset;var o;try{o=t._header=i.decode(r.slice(0,512),e.filenameEncoding,e.allowUnknownFormat)}catch(e){t.emit("error",e)}r.consume(512);if(!o){t._parse(512,onheader);oncontinue();return}if(o.type==="gnu-long-path"){t._parse(o.size,ongnulongpath);oncontinue();return}if(o.type==="gnu-long-link-path"){t._parse(o.size,ongnulonglinkpath);oncontinue();return}if(o.type==="pax-global-header"){t._parse(o.size,onpaxglobalheader);oncontinue();return}if(o.type==="pax-header"){t._parse(o.size,onpaxheader);oncontinue();return}if(t._gnuLongPath){o.name=t._gnuLongPath;t._gnuLongPath=null}if(t._gnuLongLinkPath){o.linkname=t._gnuLongLinkPath;t._gnuLongLinkPath=null}if(t._pax){t._header=o=mixinPax(o,t._pax);t._pax=null}t._locked=true;if(!o.size||o.type==="directory"){t._parse(512,onheader);t.emit("entry",o,emptyStream(t,n),onunlock);return}t._stream=new Source(t,n);t.emit("entry",o,t._stream,onunlock);t._parse(o.size,onstreamend);oncontinue()};this._onheader=onheader;this._parse(512,onheader)};n.inherits(Extract,s);Extract.prototype.destroy=function(e){if(this._destroyed)return;this._destroyed=true;if(e)this.emit("error",e);this.emit("close");if(this._stream)this._stream.emit("close")};Extract.prototype._parse=function(e,t){if(this._destroyed)return;this._offset+=e;this._missing=e;if(t===this._onheader)this._partial=false;this._onparse=t};Extract.prototype._continue=function(){if(this._destroyed)return;var e=this._cb;this._cb=noop;if(this._overflow)this._write(this._overflow,undefined,e);else e()};Extract.prototype._write=function(e,t,r){if(this._destroyed)return;var n=this._stream;var o=this._buffer;var i=this._missing;if(e.length)this._partial=true;if(e.lengthi){s=e.slice(i);e=e.slice(0,i)}if(n)n.end(e);else o.append(e);this._overflow=s;this._onparse()};Extract.prototype._final=function(e){if(this._partial)return this.destroy(new Error("Unexpected end of data"));e()};e.exports=Extract},8860:(e,t)=>{var r=Buffer.alloc;var n="0000000000000000000";var o="7777777777777777777";var i="0".charCodeAt(0);var s=Buffer.from("ustar\0","binary");var a=Buffer.from("00","binary");var c=Buffer.from("ustar ","binary");var l=Buffer.from(" \0","binary");var u=parseInt("7777",8);var d=257;var p=263;var clamp=function(e,t,r){if(typeof e!=="number")return r;e=~~e;if(e>=t)return t;if(e>=0)return e;e+=t;if(e>=0)return e;return 0};var toType=function(e){switch(e){case 0:return"file";case 1:return"link";case 2:return"symlink";case 3:return"character-device";case 4:return"block-device";case 5:return"directory";case 6:return"fifo";case 7:return"contiguous-file";case 72:return"pax-header";case 55:return"pax-global-header";case 27:return"gnu-long-link-path";case 28:case 30:return"gnu-long-path"}return null};var toTypeflag=function(e){switch(e){case"file":return 0;case"link":return 1;case"symlink":return 2;case"character-device":return 3;case"block-device":return 4;case"directory":return 5;case"fifo":return 6;case"contiguous-file":return 7;case"pax-header":return 72}return 0};var indexOf=function(e,t,r,n){for(;rt)return o.slice(0,t)+" ";else return n.slice(0,t-e.length)+e+" "};function parse256(e){var t;if(e[0]===128)t=true;else if(e[0]===255)t=false;else return null;var r=[];for(var n=e.length-1;n>0;n--){var o=e[n];if(t)r.push(o);else r.push(255-o)}var i=0;var s=r.length;for(n=0;n=Math.pow(10,r))r++;return t+r+e};t.decodeLongPath=function(e,t){return decodeStr(e,0,e.length,t)};t.encodePax=function(e){var t="";if(e.name)t+=addLength(" path="+e.name+"\n");if(e.linkname)t+=addLength(" linkpath="+e.linkname+"\n");var r=e.pax;if(r){for(var n in r){t+=addLength(" "+n+"="+r[n]+"\n")}}return Buffer.from(t)};t.decodePax=function(e){var t={};while(e.length){var r=0;while(r100){var c=n.indexOf("/");if(c===-1)return null;o+=o?"/"+n.slice(0,c):n.slice(0,c);n=n.slice(c+1)}if(Buffer.byteLength(n)>100||Buffer.byteLength(o)>155)return null;if(e.linkname&&Buffer.byteLength(e.linkname)>100)return null;t.write(n);t.write(encodeOct(e.mode&u,6),100);t.write(encodeOct(e.uid,6),108);t.write(encodeOct(e.gid,6),116);t.write(encodeOct(e.size,11),124);t.write(encodeOct(e.mtime.getTime()/1e3|0,11),136);t[156]=i+toTypeflag(e.type);if(e.linkname)t.write(e.linkname,157);s.copy(t,d);a.copy(t,p);if(e.uname)t.write(e.uname,265);if(e.gname)t.write(e.gname,297);t.write(encodeOct(e.devmajor||0,6),329);t.write(encodeOct(e.devminor||0,6),337);if(o)t.write(o,345);t.write(encodeOct(cksum(t),6),148);return t};t.decode=function(e,t,r){var n=e[156]===0?0:e[156]-i;var o=decodeStr(e,0,100,t);var a=decodeOct(e,100,8);var u=decodeOct(e,108,8);var h=decodeOct(e,116,8);var m=decodeOct(e,124,12);var g=decodeOct(e,136,12);var y=toType(n);var v=e[157]===0?null:decodeStr(e,157,100,t);var b=decodeStr(e,265,32);var S=decodeStr(e,297,32);var w=decodeOct(e,329,8);var E=decodeOct(e,337,8);var _=cksum(e);if(_===8*32)return null;if(_!==decodeOct(e,148,8))throw new Error("Invalid tar header. Maybe the tar is corrupted or it needs to be gunzipped?");if(s.compare(e,d,d+6)===0){if(e[345])o=decodeStr(e,345,155,t)+"/"+o}else if(c.compare(e,d,d+6)===0&&l.compare(e,p,p+2)===0){}else{if(!r){throw new Error("Invalid tar header: unknown format.")}}if(n===0&&o&&o[o.length-1]==="/")n=5;return{name:o,mode:a,uid:u,gid:h,size:m,mtime:new Date(1e3*g),type:y,linkname:v,uname:b,gname:S,devmajor:w,devminor:E}}},2283:(e,t,r)=>{t.extract=r(7882);t.pack=r(4930)},4930:(e,t,r)=>{var n=r(3186);var o=r(1205);var i=r(4124);var s=Buffer.alloc;var a=r(1642).Readable;var c=r(1642).Writable;var l=r(4304).StringDecoder;var u=r(8860);var d=parseInt("755",8);var p=parseInt("644",8);var h=s(1024);var noop=function(){};var overflow=function(e,t){t&=511;if(t)e.push(h.slice(0,512-t))};function modeToType(e){switch(e&n.S_IFMT){case n.S_IFBLK:return"block-device";case n.S_IFCHR:return"character-device";case n.S_IFDIR:return"directory";case n.S_IFIFO:return"fifo";case n.S_IFLNK:return"symlink"}return"file"}var Sink=function(e){c.call(this);this.written=0;this._to=e;this._destroyed=false};i(Sink,c);Sink.prototype._write=function(e,t,r){this.written+=e.length;if(this._to.push(e))return r();this._to._drain=r};Sink.prototype.destroy=function(){if(this._destroyed)return;this._destroyed=true;this.emit("close")};var LinkSink=function(){c.call(this);this.linkname="";this._decoder=new l("utf-8");this._destroyed=false};i(LinkSink,c);LinkSink.prototype._write=function(e,t,r){this.linkname+=this._decoder.write(e);r()};LinkSink.prototype.destroy=function(){if(this._destroyed)return;this._destroyed=true;this.emit("close")};var Void=function(){c.call(this);this._destroyed=false};i(Void,c);Void.prototype._write=function(e,t,r){r(new Error("No body allowed for this entry"))};Void.prototype.destroy=function(){if(this._destroyed)return;this._destroyed=true;this.emit("close")};var Pack=function(e){if(!(this instanceof Pack))return new Pack(e);a.call(this,e);this._drain=noop;this._finalized=false;this._finalizing=false;this._destroyed=false;this._stream=null};i(Pack,a);Pack.prototype.entry=function(e,t,r){if(this._stream)throw new Error("already piping an entry");if(this._finalized||this._destroyed)return;if(typeof t==="function"){r=t;t=null}if(!r)r=noop;var n=this;if(!e.size||e.type==="symlink")e.size=0;if(!e.type)e.type=modeToType(e.mode);if(!e.mode)e.mode=e.type==="directory"?d:p;if(!e.uid)e.uid=0;if(!e.gid)e.gid=0;if(!e.mtime)e.mtime=new Date;if(typeof t==="string")t=Buffer.from(t);if(Buffer.isBuffer(t)){e.size=t.length;this._encode(e);var i=this.push(t);overflow(n,e.size);if(i)process.nextTick(r);else this._drain=r;return new Void}if(e.type==="symlink"&&!e.linkname){var s=new LinkSink;o(s,(function(t){if(t){n.destroy();return r(t)}e.linkname=s.linkname;n._encode(e);r()}));return s}this._encode(e);if(e.type!=="file"&&e.type!=="contiguous-file"){process.nextTick(r);return new Void}var a=new Sink(this);this._stream=a;o(a,(function(t){n._stream=null;if(t){n.destroy();return r(t)}if(a.written!==e.size){n.destroy();return r(new Error("size mismatch"))}overflow(n,e.size);if(n._finalizing)n.finalize();r()}));return a};Pack.prototype.finalize=function(){if(this._stream){this._finalizing=true;return}if(this._finalized)return;this._finalized=true;this.push(h);this.push(null)};Pack.prototype.destroy=function(e){if(this._destroyed)return;this._destroyed=true;if(e)this.emit("error",e);this.emit("close");if(this._stream&&this._stream.destroy)this._stream.destroy()};Pack.prototype._encode=function(e){if(!e.pax){var t=u.encode(e);if(t){this.push(t);return}}this._encodePax(e)};Pack.prototype._encodePax=function(e){var t=u.encodePax({name:e.name,linkname:e.linkname,pax:e.pax});var r={name:"PaxHeader",mode:e.mode,uid:e.uid,gid:e.gid,size:t.length,mtime:e.mtime,type:"pax-header",linkname:e.linkname&&"PaxHeader",uname:e.uname,gname:e.gname,devmajor:e.devmajor,devminor:e.devminor};this.push(u.encode(r));this.push(t);overflow(this,t.length);r.size=e.size;r.type=e.type;this.push(u.encode(r))};Pack.prototype._read=function(e){var t=this._drain;this._drain=noop;t()};e.exports=Pack},8517:(e,t,r)=>{ -/*! - * Tmp - * - * Copyright (c) 2011-2017 KARASZI Istvan - * - * MIT Licensed - */ -const n=r(5747);const o=r(2087);const i=r(5622);const s=r(6417);const a={fs:n.constants,os:o.constants};const c=r(4959);const l="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",u=/XXXXXX/,d=3,p=(a.O_CREAT||a.fs.O_CREAT)|(a.O_EXCL||a.fs.O_EXCL)|(a.O_RDWR||a.fs.O_RDWR),h=o.platform()==="win32",m=a.EBADF||a.os.errno.EBADF,g=a.ENOENT||a.os.errno.ENOENT,y=448,v=384,b="exit",S=[],w=n.rmdirSync.bind(n),E=c.sync;let _=false;function tmpName(e,t){const r=_parseArguments(e,t),o=r[0],i=r[1];try{_assertAndSanitizeOptions(o)}catch(e){return i(e)}let s=o.tries;(function _getUniqueName(){try{const e=_generateTmpName(o);n.stat(e,(function(t){if(!t){if(s-- >0)return _getUniqueName();return i(new Error("Could not get a unique tmp filename, max tries reached "+e))}i(null,e)}))}catch(e){i(e)}})()}function tmpNameSync(e){const t=_parseArguments(e),r=t[0];_assertAndSanitizeOptions(r);let o=r.tries;do{const e=_generateTmpName(r);try{n.statSync(e)}catch(t){return e}}while(o-- >0);throw new Error("Could not get a unique tmp filename, max tries reached")}function file(e,t){const r=_parseArguments(e,t),o=r[0],i=r[1];tmpName(o,(function _tmpNameCreated(e,t){if(e)return i(e);n.open(t,p,o.mode||v,(function _fileCreated(e,r){if(e)return i(e);if(o.discardDescriptor){return n.close(r,(function _discardCallback(e){return i(e,t,undefined,_prepareTmpFileRemoveCallback(t,-1,o,false))}))}else{const e=o.discardDescriptor||o.detachDescriptor;i(null,t,r,_prepareTmpFileRemoveCallback(t,e?-1:r,o,false))}}))}))}function fileSync(e){const t=_parseArguments(e),r=t[0];const o=r.discardDescriptor||r.detachDescriptor;const i=tmpNameSync(r);var s=n.openSync(i,p,r.mode||v);if(r.discardDescriptor){n.closeSync(s);s=undefined}return{name:i,fd:s,removeCallback:_prepareTmpFileRemoveCallback(i,o?-1:s,r,true)}}function dir(e,t){const r=_parseArguments(e,t),o=r[0],i=r[1];tmpName(o,(function _tmpNameCreated(e,t){if(e)return i(e);n.mkdir(t,o.mode||y,(function _dirCreated(e){if(e)return i(e);i(null,t,_prepareTmpDirRemoveCallback(t,o,false))}))}))}function dirSync(e){const t=_parseArguments(e),r=t[0];const o=tmpNameSync(r);n.mkdirSync(o,r.mode||y);return{name:o,removeCallback:_prepareTmpDirRemoveCallback(o,r,true)}}function _removeFileAsync(e,t){const _handler=function(e){if(e&&!_isENOENT(e)){return t(e)}t()};if(0<=e[0])n.close(e[0],(function(){n.unlink(e[1],_handler)}));else n.unlink(e[1],_handler)}function _removeFileSync(e){let t=null;try{if(0<=e[0])n.closeSync(e[0])}catch(e){if(!_isEBADF(e)&&!_isENOENT(e))throw e}finally{try{n.unlinkSync(e[1])}catch(e){if(!_isENOENT(e))t=e}}if(t!==null){throw t}}function _prepareTmpFileRemoveCallback(e,t,r,n){const o=_prepareRemoveCallback(_removeFileSync,[t,e],n);const i=_prepareRemoveCallback(_removeFileAsync,[t,e],n,o);if(!r.keep)S.unshift(o);return n?o:i}function _prepareTmpDirRemoveCallback(e,t,r){const o=t.unsafeCleanup?c:n.rmdir.bind(n);const i=t.unsafeCleanup?E:w;const s=_prepareRemoveCallback(i,e,r);const a=_prepareRemoveCallback(o,e,r,s);if(!t.keep)S.unshift(s);return r?s:a}function _prepareRemoveCallback(e,t,r,n){let o=false;return function _cleanupCallback(i){if(!o){const s=n||_cleanupCallback;const a=S.indexOf(s);if(a>=0)S.splice(a,1);o=true;if(r||e===w||e===E){return e(t)}else{return e(t,i||function(){})}}}}function _garbageCollector(){if(!_)return;while(S.length){try{S[0]()}catch(e){}}}function _randomChars(e){let t=[],r=null;try{r=s.randomBytes(e)}catch(t){r=s.pseudoRandomBytes(e)}for(var n=0;n{ -/*! ***************************************************************************** -Copyright (c) Microsoft Corporation. - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH -REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY -AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, -INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM -LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR -OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR -PERFORMANCE OF THIS SOFTWARE. -***************************************************************************** */ -var t;var r;var n;var o;var i;var s;var a;var c;var l;var u;var d;var p;var h;var m;var g;var y;var v;var b;var S;var w;var E;var _;var O;var C;(function(t){var r=typeof global==="object"?global:typeof self==="object"?self:typeof this==="object"?this:{};if(typeof define==="function"&&define.amd){define("tslib",["exports"],(function(e){t(createExporter(r,createExporter(e)))}))}else if(true&&typeof e.exports==="object"){t(createExporter(r,createExporter(e.exports)))}else{t(createExporter(r))}function createExporter(e,t){if(e!==r){if(typeof Object.create==="function"){Object.defineProperty(e,"__esModule",{value:true})}else{e.__esModule=true}}return function(r,n){return e[r]=t?t(r,n):n}}})((function(e){var T=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r))e[r]=t[r]};t=function(e,t){if(typeof t!=="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");T(e,t);function __(){this.constructor=e}e.prototype=t===null?Object.create(t):(__.prototype=t.prototype,new __)};r=Object.assign||function(e){for(var t,r=1,n=arguments.length;r=0;a--)if(s=e[a])i=(o<3?s(i):o>3?s(t,r,i):s(t,r))||i;return o>3&&i&&Object.defineProperty(t,r,i),i};i=function(e,t){return function(r,n){t(r,n,e)}};s=function(e,t){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(e,t)};a=function(e,t,r,n){function adopt(e){return e instanceof r?e:new r((function(t){t(e)}))}return new(r||(r=Promise))((function(r,o){function fulfilled(e){try{step(n.next(e))}catch(e){o(e)}}function rejected(e){try{step(n["throw"](e))}catch(e){o(e)}}function step(e){e.done?r(e.value):adopt(e.value).then(fulfilled,rejected)}step((n=n.apply(e,t||[])).next())}))};c=function(e,t){var r={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},n,o,i,s;return s={next:verb(0),throw:verb(1),return:verb(2)},typeof Symbol==="function"&&(s[Symbol.iterator]=function(){return this}),s;function verb(e){return function(t){return step([e,t])}}function step(s){if(n)throw new TypeError("Generator is already executing.");while(r)try{if(n=1,o&&(i=s[0]&2?o["return"]:s[0]?o["throw"]||((i=o["return"])&&i.call(o),0):o.next)&&!(i=i.call(o,s[1])).done)return i;if(o=0,i)s=[s[0]&2,i.value];switch(s[0]){case 0:case 1:i=s;break;case 4:r.label++;return{value:s[1],done:false};case 5:r.label++;o=s[1];s=[0];continue;case 7:s=r.ops.pop();r.trys.pop();continue;default:if(!(i=r.trys,i=i.length>0&&i[i.length-1])&&(s[0]===6||s[0]===2)){r=0;continue}if(s[0]===3&&(!i||s[1]>i[0]&&s[1]=e.length)e=void 0;return{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};d=function(e,t){var r=typeof Symbol==="function"&&e[Symbol.iterator];if(!r)return e;var n=r.call(e),o,i=[],s;try{while((t===void 0||t-- >0)&&!(o=n.next()).done)i.push(o.value)}catch(e){s={error:e}}finally{try{if(o&&!o.done&&(r=n["return"]))r.call(n)}finally{if(s)throw s.error}}return i};p=function(){for(var e=[],t=0;t1||resume(e,t)}))}}function resume(e,t){try{step(n[e](t))}catch(e){settle(i[0][3],e)}}function step(e){e.value instanceof g?Promise.resolve(e.value.v).then(fulfill,reject):settle(i[0][2],e)}function fulfill(e){resume("next",e)}function reject(e){resume("throw",e)}function settle(e,t){if(e(t),i.shift(),i.length)resume(i[0][0],i[0][1])}};v=function(e){var t,r;return t={},verb("next"),verb("throw",(function(e){throw e})),verb("return"),t[Symbol.iterator]=function(){return this},t;function verb(n,o){t[n]=e[n]?function(t){return(r=!r)?{value:g(e[n](t)),done:n==="return"}:o?o(t):t}:o}};b=function(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t=e[Symbol.asyncIterator],r;return t?t.call(e):(e=typeof u==="function"?u(e):e[Symbol.iterator](),r={},verb("next"),verb("throw"),verb("return"),r[Symbol.asyncIterator]=function(){return this},r);function verb(t){r[t]=e[t]&&function(r){return new Promise((function(n,o){r=e[t](r),settle(n,o,r.done,r.value)}))}}function settle(e,t,r,n){Promise.resolve(n).then((function(t){e({value:t,done:r})}),t)}};S=function(e,t){if(Object.defineProperty){Object.defineProperty(e,"raw",{value:t})}else{e.raw=t}return e};var I=Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:true,value:t})}:function(e,t){e["default"]=t};w=function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)if(r!=="default"&&Object.prototype.hasOwnProperty.call(e,r))C(t,e,r);I(t,e);return t};E=function(e){return e&&e.__esModule?e:{default:e}};_=function(e,t,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof t==="function"?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(e):n?n.value:t.get(e)};O=function(e,t,r,n,o){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!o)throw new TypeError("Private accessor was defined without a setter");if(typeof t==="function"?e!==t||!o:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?o.call(e,r):o?o.value=r:t.set(e,r),r};e("__extends",t);e("__assign",r);e("__rest",n);e("__decorate",o);e("__param",i);e("__metadata",s);e("__awaiter",a);e("__generator",c);e("__exportStar",l);e("__createBinding",C);e("__values",u);e("__read",d);e("__spread",p);e("__spreadArrays",h);e("__spreadArray",m);e("__await",g);e("__asyncGenerator",y);e("__asyncDelegator",v);e("__asyncValues",b);e("__makeTemplateObject",S);e("__importStar",w);e("__importDefault",E);e("__classPrivateFieldGet",_);e("__classPrivateFieldSet",O)}))},5278:(e,t,r)=>{e.exports=r(1669).deprecate},5840:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});Object.defineProperty(t,"v1",{enumerable:true,get:function(){return n.default}});Object.defineProperty(t,"v3",{enumerable:true,get:function(){return o.default}});Object.defineProperty(t,"v4",{enumerable:true,get:function(){return i.default}});Object.defineProperty(t,"v5",{enumerable:true,get:function(){return s.default}});Object.defineProperty(t,"NIL",{enumerable:true,get:function(){return a.default}});Object.defineProperty(t,"version",{enumerable:true,get:function(){return c.default}});Object.defineProperty(t,"validate",{enumerable:true,get:function(){return l.default}});Object.defineProperty(t,"stringify",{enumerable:true,get:function(){return u.default}});Object.defineProperty(t,"parse",{enumerable:true,get:function(){return d.default}});var n=_interopRequireDefault(r(8628));var o=_interopRequireDefault(r(6409));var i=_interopRequireDefault(r(5122));var s=_interopRequireDefault(r(9120));var a=_interopRequireDefault(r(5350));var c=_interopRequireDefault(r(1595));var l=_interopRequireDefault(r(6900));var u=_interopRequireDefault(r(8950));var d=_interopRequireDefault(r(4848));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}},4569:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.default=void 0;var n=_interopRequireDefault(r(6417));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function md5(e){if(Array.isArray(e)){e=Buffer.from(e)}else if(typeof e==="string"){e=Buffer.from(e,"utf8")}return n.default.createHash("md5").update(e).digest()}var o=md5;t.default=o},5350:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.default=void 0;var r="00000000-0000-0000-0000-000000000000";t.default=r},4848:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.default=void 0;var n=_interopRequireDefault(r(6900));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function parse(e){if(!(0,n.default)(e)){throw TypeError("Invalid UUID")}let t;const r=new Uint8Array(16);r[0]=(t=parseInt(e.slice(0,8),16))>>>24;r[1]=t>>>16&255;r[2]=t>>>8&255;r[3]=t&255;r[4]=(t=parseInt(e.slice(9,13),16))>>>8;r[5]=t&255;r[6]=(t=parseInt(e.slice(14,18),16))>>>8;r[7]=t&255;r[8]=(t=parseInt(e.slice(19,23),16))>>>8;r[9]=t&255;r[10]=(t=parseInt(e.slice(24,36),16))/1099511627776&255;r[11]=t/4294967296&255;r[12]=t>>>24&255;r[13]=t>>>16&255;r[14]=t>>>8&255;r[15]=t&255;return r}var o=parse;t.default=o},814:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.default=void 0;var r=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;t.default=r},807:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.default=rng;var n=_interopRequireDefault(r(6417));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}const o=new Uint8Array(256);let i=o.length;function rng(){if(i>o.length-16){n.default.randomFillSync(o);i=0}return o.slice(i,i+=16)}},5274:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.default=void 0;var n=_interopRequireDefault(r(6417));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function sha1(e){if(Array.isArray(e)){e=Buffer.from(e)}else if(typeof e==="string"){e=Buffer.from(e,"utf8")}return n.default.createHash("sha1").update(e).digest()}var o=sha1;t.default=o},8950:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.default=void 0;var n=_interopRequireDefault(r(6900));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}const o=[];for(let e=0;e<256;++e){o.push((e+256).toString(16).substr(1))}function stringify(e,t=0){const r=(o[e[t+0]]+o[e[t+1]]+o[e[t+2]]+o[e[t+3]]+"-"+o[e[t+4]]+o[e[t+5]]+"-"+o[e[t+6]]+o[e[t+7]]+"-"+o[e[t+8]]+o[e[t+9]]+"-"+o[e[t+10]]+o[e[t+11]]+o[e[t+12]]+o[e[t+13]]+o[e[t+14]]+o[e[t+15]]).toLowerCase();if(!(0,n.default)(r)){throw TypeError("Stringified UUID is invalid")}return r}var i=stringify;t.default=i},8628:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.default=void 0;var n=_interopRequireDefault(r(807));var o=_interopRequireDefault(r(8950));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}let i;let s;let a=0;let c=0;function v1(e,t,r){let l=t&&r||0;const u=t||new Array(16);e=e||{};let d=e.node||i;let p=e.clockseq!==undefined?e.clockseq:s;if(d==null||p==null){const t=e.random||(e.rng||n.default)();if(d==null){d=i=[t[0]|1,t[1],t[2],t[3],t[4],t[5]]}if(p==null){p=s=(t[6]<<8|t[7])&16383}}let h=e.msecs!==undefined?e.msecs:Date.now();let m=e.nsecs!==undefined?e.nsecs:c+1;const g=h-a+(m-c)/1e4;if(g<0&&e.clockseq===undefined){p=p+1&16383}if((g<0||h>a)&&e.nsecs===undefined){m=0}if(m>=1e4){throw new Error("uuid.v1(): Can't create more than 10M uuids/sec")}a=h;c=m;s=p;h+=122192928e5;const y=((h&268435455)*1e4+m)%4294967296;u[l++]=y>>>24&255;u[l++]=y>>>16&255;u[l++]=y>>>8&255;u[l++]=y&255;const v=h/4294967296*1e4&268435455;u[l++]=v>>>8&255;u[l++]=v&255;u[l++]=v>>>24&15|16;u[l++]=v>>>16&255;u[l++]=p>>>8|128;u[l++]=p&255;for(let e=0;e<6;++e){u[l+e]=d[e]}return t||(0,o.default)(u)}var l=v1;t.default=l},6409:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.default=void 0;var n=_interopRequireDefault(r(5998));var o=_interopRequireDefault(r(4569));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}const i=(0,n.default)("v3",48,o.default);var s=i;t.default=s},5998:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.default=_default;t.URL=t.DNS=void 0;var n=_interopRequireDefault(r(8950));var o=_interopRequireDefault(r(4848));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function stringToBytes(e){e=unescape(encodeURIComponent(e));const t=[];for(let r=0;r{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.default=void 0;var n=_interopRequireDefault(r(807));var o=_interopRequireDefault(r(8950));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function v4(e,t,r){e=e||{};const i=e.random||(e.rng||n.default)();i[6]=i[6]&15|64;i[8]=i[8]&63|128;if(t){r=r||0;for(let e=0;e<16;++e){t[r+e]=i[e]}return t}return(0,o.default)(i)}var i=v4;t.default=i},9120:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.default=void 0;var n=_interopRequireDefault(r(5998));var o=_interopRequireDefault(r(5274));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}const i=(0,n.default)("v5",80,o.default);var s=i;t.default=s},6900:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.default=void 0;var n=_interopRequireDefault(r(814));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function validate(e){return typeof e==="string"&&n.default.test(e)}var o=validate;t.default=o},1595:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.default=void 0;var n=_interopRequireDefault(r(6900));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function version(e){if(!(0,n.default)(e)){throw TypeError("Invalid UUID")}return parseInt(e.substr(14,1),16)}var o=version;t.default=o},2940:e=>{e.exports=wrappy;function wrappy(e,t){if(e&&t)return wrappy(e)(t);if(typeof e!=="function")throw new TypeError("need wrapper function");Object.keys(e).forEach((function(t){wrapper[t]=e[t]}));return wrapper;function wrapper(){var t=new Array(arguments.length);for(var r=0;r{var n=r(5747);var o=r(8761);var i=r(5010);var s=r(4794);var a=r(1669);var c=r(8614).EventEmitter;var l=r(2413).Transform;var u=r(2413).PassThrough;var d=r(2413).Writable;t.open=open;t.fromFd=fromFd;t.fromBuffer=fromBuffer;t.fromRandomAccessReader=fromRandomAccessReader;t.dosDateTimeToDate=dosDateTimeToDate;t.validateFileName=validateFileName;t.ZipFile=ZipFile;t.Entry=Entry;t.RandomAccessReader=RandomAccessReader;function open(e,t,r){if(typeof t==="function"){r=t;t=null}if(t==null)t={};if(t.autoClose==null)t.autoClose=true;if(t.lazyEntries==null)t.lazyEntries=false;if(t.decodeStrings==null)t.decodeStrings=true;if(t.validateEntrySizes==null)t.validateEntrySizes=true;if(t.strictFileNames==null)t.strictFileNames=false;if(r==null)r=defaultCallback;n.open(e,"r",(function(e,o){if(e)return r(e);fromFd(o,t,(function(e,t){if(e)n.close(o,defaultCallback);r(e,t)}))}))}function fromFd(e,t,r){if(typeof t==="function"){r=t;t=null}if(t==null)t={};if(t.autoClose==null)t.autoClose=false;if(t.lazyEntries==null)t.lazyEntries=false;if(t.decodeStrings==null)t.decodeStrings=true;if(t.validateEntrySizes==null)t.validateEntrySizes=true;if(t.strictFileNames==null)t.strictFileNames=false;if(r==null)r=defaultCallback;n.fstat(e,(function(n,o){if(n)return r(n);var s=i.createFromFd(e,{autoClose:true});fromRandomAccessReader(s,o.size,t,r)}))}function fromBuffer(e,t,r){if(typeof t==="function"){r=t;t=null}if(t==null)t={};t.autoClose=false;if(t.lazyEntries==null)t.lazyEntries=false;if(t.decodeStrings==null)t.decodeStrings=true;if(t.validateEntrySizes==null)t.validateEntrySizes=true;if(t.strictFileNames==null)t.strictFileNames=false;var n=i.createFromBuffer(e,{maxChunkSize:65536});fromRandomAccessReader(n,e.length,t,r)}function fromRandomAccessReader(e,t,r,n){if(typeof r==="function"){n=r;r=null}if(r==null)r={};if(r.autoClose==null)r.autoClose=true;if(r.lazyEntries==null)r.lazyEntries=false;if(r.decodeStrings==null)r.decodeStrings=true;var o=!!r.decodeStrings;if(r.validateEntrySizes==null)r.validateEntrySizes=true;if(r.strictFileNames==null)r.strictFileNames=false;if(n==null)n=defaultCallback;if(typeof t!=="number")throw new Error("expected totalSize parameter to be a number");if(t>Number.MAX_SAFE_INTEGER){throw new Error("zip file too large. only file sizes up to 2^52 are supported due to JavaScript's Number type being an IEEE 754 double.")}e.ref();var i=22;var s=65535;var a=Math.min(i+s,t);var c=h(a);var l=t-c.length;readAndAssertNoEof(e,c,0,a,l,(function(s){if(s)return n(s);for(var u=a-i;u>=0;u-=1){if(c.readUInt32LE(u)!==101010256)continue;var d=c.slice(u);var p=d.readUInt16LE(4);if(p!==0){return n(new Error("multi-disk zip files are not supported: found disk number: "+p))}var m=d.readUInt16LE(10);var g=d.readUInt32LE(16);var y=d.readUInt16LE(20);var v=d.length-i;if(y!==v){return n(new Error("invalid comment length. expected: "+v+". found: "+y))}var b=o?decodeBuffer(d,22,d.length,false):d.slice(22);if(!(m===65535||g===4294967295)){return n(null,new ZipFile(e,g,t,m,b,r.autoClose,r.lazyEntries,o,r.validateEntrySizes,r.strictFileNames))}var S=h(20);var w=l+u-S.length;readAndAssertNoEof(e,S,0,S.length,w,(function(i){if(i)return n(i);if(S.readUInt32LE(0)!==117853008){return n(new Error("invalid zip64 end of central directory locator signature"))}var s=readUInt64LE(S,8);var a=h(56);readAndAssertNoEof(e,a,0,a.length,s,(function(i){if(i)return n(i);if(a.readUInt32LE(0)!==101075792){return n(new Error("invalid zip64 end of central directory record signature"))}m=readUInt64LE(a,32);g=readUInt64LE(a,48);return n(null,new ZipFile(e,g,t,m,b,r.autoClose,r.lazyEntries,o,r.validateEntrySizes,r.strictFileNames))}))}));return}n(new Error("end of central directory record signature not found"))}))}a.inherits(ZipFile,c);function ZipFile(e,t,r,n,o,i,s,a,l,u){var d=this;c.call(d);d.reader=e;d.reader.on("error",(function(e){emitError(d,e)}));d.reader.once("close",(function(){d.emit("close")}));d.readEntryCursor=t;d.fileSize=r;d.entryCount=n;d.comment=o;d.entriesRead=0;d.autoClose=!!i;d.lazyEntries=!!s;d.decodeStrings=!!a;d.validateEntrySizes=!!l;d.strictFileNames=!!u;d.isOpen=true;d.emittedError=false;if(!d.lazyEntries)d._readEntry()}ZipFile.prototype.close=function(){if(!this.isOpen)return;this.isOpen=false;this.reader.unref()};function emitErrorAndAutoClose(e,t){if(e.autoClose)e.close();emitError(e,t)}function emitError(e,t){if(e.emittedError)return;e.emittedError=true;e.emit("error",t)}ZipFile.prototype.readEntry=function(){if(!this.lazyEntries)throw new Error("readEntry() called without lazyEntries:true");this._readEntry()};ZipFile.prototype._readEntry=function(){var e=this;if(e.entryCount===e.entriesRead){setImmediate((function(){if(e.autoClose)e.close();if(e.emittedError)return;e.emit("end")}));return}if(e.emittedError)return;var t=h(46);readAndAssertNoEof(e.reader,t,0,t.length,e.readEntryCursor,(function(r){if(r)return emitErrorAndAutoClose(e,r);if(e.emittedError)return;var n=new Entry;var o=t.readUInt32LE(0);if(o!==33639248)return emitErrorAndAutoClose(e,new Error("invalid central directory file header signature: 0x"+o.toString(16)));n.versionMadeBy=t.readUInt16LE(4);n.versionNeededToExtract=t.readUInt16LE(6);n.generalPurposeBitFlag=t.readUInt16LE(8);n.compressionMethod=t.readUInt16LE(10);n.lastModFileTime=t.readUInt16LE(12);n.lastModFileDate=t.readUInt16LE(14);n.crc32=t.readUInt32LE(16);n.compressedSize=t.readUInt32LE(20);n.uncompressedSize=t.readUInt32LE(24);n.fileNameLength=t.readUInt16LE(28);n.extraFieldLength=t.readUInt16LE(30);n.fileCommentLength=t.readUInt16LE(32);n.internalFileAttributes=t.readUInt16LE(36);n.externalFileAttributes=t.readUInt32LE(38);n.relativeOffsetOfLocalHeader=t.readUInt32LE(42);if(n.generalPurposeBitFlag&64)return emitErrorAndAutoClose(e,new Error("strong encryption is not supported"));e.readEntryCursor+=46;t=h(n.fileNameLength+n.extraFieldLength+n.fileCommentLength);readAndAssertNoEof(e.reader,t,0,t.length,e.readEntryCursor,(function(r){if(r)return emitErrorAndAutoClose(e,r);if(e.emittedError)return;var o=(n.generalPurposeBitFlag&2048)!==0;n.fileName=e.decodeStrings?decodeBuffer(t,0,n.fileNameLength,o):t.slice(0,n.fileNameLength);var i=n.fileNameLength+n.extraFieldLength;var a=t.slice(n.fileNameLength,i);n.extraFields=[];var c=0;while(ca.length)return emitErrorAndAutoClose(e,new Error("extra field length exceeds extra field buffer size"));var m=h(u);a.copy(m,0,d,p);n.extraFields.push({id:l,data:m});c=p}n.fileComment=e.decodeStrings?decodeBuffer(t,i,i+n.fileCommentLength,o):t.slice(i,i+n.fileCommentLength);n.comment=n.fileComment;e.readEntryCursor+=t.length;e.entriesRead+=1;if(n.uncompressedSize===4294967295||n.compressedSize===4294967295||n.relativeOffsetOfLocalHeader===4294967295){var g=null;for(var c=0;cg.length){return emitErrorAndAutoClose(e,new Error("zip64 extended information extra field does not include uncompressed size"))}n.uncompressedSize=readUInt64LE(g,v);v+=8}if(n.compressedSize===4294967295){if(v+8>g.length){return emitErrorAndAutoClose(e,new Error("zip64 extended information extra field does not include compressed size"))}n.compressedSize=readUInt64LE(g,v);v+=8}if(n.relativeOffsetOfLocalHeader===4294967295){if(v+8>g.length){return emitErrorAndAutoClose(e,new Error("zip64 extended information extra field does not include relative header offset"))}n.relativeOffsetOfLocalHeader=readUInt64LE(g,v);v+=8}}if(e.decodeStrings){for(var c=0;ce.compressedSize)throw new Error("options.start > entry.compressedSize")}if(t.end!=null){s=t.end;if(s<0)throw new Error("options.end < 0");if(s>e.compressedSize)throw new Error("options.end > entry.compressedSize");if(sn.fileSize){return r(new Error("file data overflows file bounds: "+m+" + "+e.compressedSize+" > "+n.fileSize))}}var y=n.reader.createReadStream({start:m+i,end:m+s});var v=y;if(h){var b=false;var S=o.createInflateRaw();y.on("error",(function(e){setImmediate((function(){if(!b)S.emit("error",e)}))}));y.pipe(S);if(n.validateEntrySizes){v=new AssertByteCountStream(e.uncompressedSize);S.on("error",(function(e){setImmediate((function(){if(!b)v.emit("error",e)}))}));S.pipe(v)}else{v=S}v.destroy=function(){b=true;if(S!==v)S.unpipe(v);y.unpipe(S);y.destroy()}}r(null,v)}finally{n.reader.unref()}}))};function Entry(){}Entry.prototype.getLastModDate=function(){return dosDateTimeToDate(this.lastModFileDate,this.lastModFileTime)};Entry.prototype.isEncrypted=function(){return(this.generalPurposeBitFlag&1)!==0};Entry.prototype.isCompressed=function(){return this.compressionMethod===8};function dosDateTimeToDate(e,t){var r=e&31;var n=(e>>5&15)-1;var o=(e>>9&127)+1980;var i=0;var s=(t&31)*2;var a=t>>5&63;var c=t>>11&31;return new Date(o,n,r,c,a,s,i)}function validateFileName(e){if(e.indexOf("\\")!==-1){return"invalid characters in fileName: "+e}if(/^[a-zA-Z]:/.test(e)||/^\//.test(e)){return"absolute path: "+e}if(e.split("/").indexOf("..")!==-1){return"invalid relative path: "+e}return null}function readAndAssertNoEof(e,t,r,n,o,i){if(n===0){return setImmediate((function(){i(null,h(0))}))}e.read(t,r,n,o,(function(e,t){if(e)return i(e);if(tthis.expectedByteCount){var n="too many bytes in the stream. expected "+this.expectedByteCount+". got at least "+this.actualByteCount;return r(new Error(n))}r(null,e)};AssertByteCountStream.prototype._flush=function(e){if(this.actualByteCount0)return;if(e.refCount<0)throw new Error("invalid unref");e.close(onCloseDone);function onCloseDone(t){if(t)return e.emit("error",t);e.emit("close")}};RandomAccessReader.prototype.createReadStream=function(e){var t=e.start;var r=e.end;if(t===r){var n=new u;setImmediate((function(){n.end()}));return n}var o=this._readStreamForRange(t,r);var i=false;var s=new RefUnrefFilter(this);o.on("error",(function(e){setImmediate((function(){if(!i)s.emit("error",e)}))}));s.destroy=function(){o.unpipe(s);s.unref();o.destroy()};var a=new AssertByteCountStream(r-t);s.on("error",(function(e){setImmediate((function(){if(!i)a.emit("error",e)}))}));a.destroy=function(){i=true;s.unpipe(a);s.destroy()};return o.pipe(s).pipe(a)};RandomAccessReader.prototype._readStreamForRange=function(e,t){throw new Error("not implemented")};RandomAccessReader.prototype.read=function(e,t,r,n,o){var i=this.createReadStream({start:n,end:n+r});var s=new d;var a=0;s._write=function(r,n,o){r.copy(e,t+a,0,r.length);a+=r.length;o()};s.on("finish",o);i.on("error",(function(e){o(e)}));i.pipe(s)};RandomAccessReader.prototype.close=function(e){setImmediate(e)};a.inherits(RefUnrefFilter,u);function RefUnrefFilter(e){u.call(this);this.context=e;this.context.ref();this.unreffedYet=false}RefUnrefFilter.prototype._flush=function(e){this.unref();e()};RefUnrefFilter.prototype.unref=function(e){if(this.unreffedYet)return;this.unreffedYet=true;this.context.unref()};var p="\0☺☻♥♦♣♠•◘○◙♂♀♪♫☼►◄↕‼¶§▬↨↑↓→←∟↔▲▼ !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~⌂ÇüéâäàåçêëèïîìÄÅÉæÆôöòûùÿÖÜ¢£¥₧ƒáíóúñѪº¿⌐¬½¼¡«»░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀αßΓπΣσµτΦΘΩδ∞φε∩≡±≥≤⌠⌡÷≈°∙·√ⁿ²■ ";function decodeBuffer(e,t,r,n){if(n){return e.toString("utf8",t,r)}else{var o="";for(var i=t;i{"use strict";r.r(t);var n=r(3129);var o=r(1257);var i=r(2186);var s=r(5517);var a=undefined&&undefined.__awaiter||function(e,t,r,n){function adopt(e){return e instanceof r?e:new r((function(t){t(e)}))}return new(r||(r=Promise))((function(r,o){function fulfilled(e){try{step(n.next(e))}catch(e){o(e)}}function rejected(e){try{step(n["throw"](e))}catch(e){o(e)}}function step(e){e.done?r(e.value):adopt(e.value).then(fulfilled,rejected)}step((n=n.apply(e,t||[])).next())}))};var c=undefined&&undefined.__generator||function(e,t){var r={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},n,o,i,s;return s={next:verb(0),throw:verb(1),return:verb(2)},typeof Symbol==="function"&&(s[Symbol.iterator]=function(){return this}),s;function verb(e){return function(t){return step([e,t])}}function step(s){if(n)throw new TypeError("Generator is already executing.");while(r)try{if(n=1,o&&(i=s[0]&2?o["return"]:s[0]?o["throw"]||((i=o["return"])&&i.call(o),0):o.next)&&!(i=i.call(o,s[1])).done)return i;if(o=0,i)s=[s[0]&2,i.value];switch(s[0]){case 0:case 1:i=s;break;case 4:r.label++;return{value:s[1],done:false};case 5:r.label++;o=s[1];s=[0];continue;case 7:s=r.ops.pop();r.trys.pop();continue;default:if(!(i=r.trys,i=i.length>0&&i[i.length-1])&&(s[0]===6||s[0]===2)){r=0;continue}if(s[0]===3&&(!i||s[1]>i[0]&&s[1]0&&i[i.length-1])&&(s[0]===6||s[0]===2)){r=0;continue}if(s[0]===3&&(!i||s[1]>i[0]&&s[1]{module.exports=eval("require")("aws4")},5764:module=>{module.exports=eval("require")("mongodb-client-encryption")},306:e=>{"use strict";e.exports={i8:"1.2.1"}},2357:e=>{"use strict";e.exports=require("assert")},4293:e=>{"use strict";e.exports=require("buffer")},3129:e=>{"use strict";e.exports=require("child_process")},7619:e=>{"use strict";e.exports=require("constants")},6417:e=>{"use strict";e.exports=require("crypto")},881:e=>{"use strict";e.exports=require("dns")},8614:e=>{"use strict";e.exports=require("events")},5747:e=>{"use strict";e.exports=require("fs")},8605:e=>{"use strict";e.exports=require("http")},7211:e=>{"use strict";e.exports=require("https")},1631:e=>{"use strict";e.exports=require("net")},2087:e=>{"use strict";e.exports=require("os")},5622:e=>{"use strict";e.exports=require("path")},1191:e=>{"use strict";e.exports=require("querystring")},1058:e=>{"use strict";e.exports=require("readline")},2413:e=>{"use strict";e.exports=require("stream")},4304:e=>{"use strict";e.exports=require("string_decoder")},4016:e=>{"use strict";e.exports=require("tls")},3867:e=>{"use strict";e.exports=require("tty")},8835:e=>{"use strict";e.exports=require("url")},1669:e=>{"use strict";e.exports=require("util")},8761:e=>{"use strict";e.exports=require("zlib")}};var __webpack_module_cache__={};function __nccwpck_require__(e){var t=__webpack_module_cache__[e];if(t!==undefined){return t.exports}var r=__webpack_module_cache__[e]={exports:{}};var n=true;try{__webpack_modules__[e].call(r.exports,r,r.exports,__nccwpck_require__);n=false}finally{if(n)delete __webpack_module_cache__[e]}return r.exports}(()=>{__nccwpck_require__.r=e=>{if(typeof Symbol!=="undefined"&&Symbol.toStringTag){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"})}Object.defineProperty(e,"__esModule",{value:true})}})();if(typeof __nccwpck_require__!=="undefined")__nccwpck_require__.ab=__dirname+"/";var __webpack_exports__=__nccwpck_require__(1667);module.exports=__webpack_exports__})(); \ No newline at end of file +"use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +var __generator = (this && this.__generator) || function (thisArg, body) { + var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; + return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; + function verb(n) { return function (v) { return step([n, v]); }; } + function step(op) { + if (f) throw new TypeError("Generator is already executing."); + while (_) try { + if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; + if (y = 0, t) op = [op[0] & 2, t.value]; + switch (op[0]) { + case 0: case 1: t = op; break; + case 4: _.label++; return { value: op[1], done: false }; + case 5: _.label++; y = op[1]; op = [0]; continue; + case 7: op = _.ops.pop(); _.trys.pop(); continue; + default: + if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } + if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } + if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } + if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } + if (t[2]) _.ops.pop(); + _.trys.pop(); continue; + } + op = body.call(thisArg, _); + } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } + if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; + } +}; +Object.defineProperty(exports, "__esModule", { value: true }); +var child_process_1 = require("child_process"); +var MongoMemoryServer_1 = require("mongodb-memory-server-core/lib/MongoMemoryServer"); +var core = __importStar(require("@actions/core")); +var memory_server_factory_1 = require("./factory/memory-server-factory"); +function runCommand(command, connectionString) { + return __awaiter(this, void 0, void 0, function () { + var connectionStringEnvVar, mongoMsDebug, output; + return __generator(this, function (_a) { + console.info("--- Executing the target script: \"" + command + "\""); + connectionStringEnvVar = core.getInput('db-connection-env-var'); + mongoMsDebug = core.getInput('mongoms-debug'); + process.env[connectionStringEnvVar] = connectionString; + if (mongoMsDebug) { + process.env['MONGOMS_DEBUG'] = '1'; + } + try { + output = child_process_1.execSync(command, { + env: process.env, + cwd: process.env.githubRepository, + stdio: 'inherit', + }); + return [2 /*return*/, output ? output.toString() : '--- Child process executed synchronously and returned null.']; + } + catch (err) { + console.error(err); + throw err; + } + return [2 /*return*/]; + }); + }); +} +function run() { + return __awaiter(this, void 0, void 0, function () { + var mongodb, dbName, port, storageEngine, version, maxPoolInput, maxPoolSize, connectionString, command, stdOut, err_1; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: + _a.trys.push([0, 4, 5, 8]); + dbName = core.getInput('instance-dbName'); + port = Number.parseInt(core.getInput('instance-port')); + storageEngine = core.getInput('instance-storageEngine'); + version = core.getInput('binary-version'); + maxPoolInput = core.getInput('max-pool-size'); + maxPoolSize = maxPoolInput ? Number.parseInt(maxPoolInput) : undefined; + return [4 /*yield*/, memory_server_factory_1.MemoryServerFactory.generateMemoryServer(dbName, port, storageEngine, version)]; + case 1: + mongodb = _a.sent(); + return [4 /*yield*/, memory_server_factory_1.MemoryServerFactory.verifyMemoryServer(mongodb, maxPoolSize)]; + case 2: + connectionString = _a.sent(); + command = core.getInput('run-command'); + return [4 /*yield*/, runCommand(command, connectionString)]; + case 3: + stdOut = _a.sent(); + console.info(stdOut); + return [3 /*break*/, 8]; + case 4: + err_1 = _a.sent(); + core.setFailed(err_1.message); + return [3 /*break*/, 8]; + case 5: + if (!((mongodb === null || mongodb === void 0 ? void 0 : mongodb.state) === MongoMemoryServer_1.MongoMemoryServerStates.running)) return [3 /*break*/, 7]; + return [4 /*yield*/, mongodb.stop()]; + case 6: + _a.sent(); + _a.label = 7; + case 7: return [7 /*endfinally*/]; + case 8: return [2 /*return*/]; + } + }); + }); +} +run(); diff --git a/yarn.lock b/yarn.lock index bfea090..5e52dc0 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3,9 +3,488 @@ "@actions/core@^1.4.0": - version "1.4.0" - resolved "https://registry.yarnpkg.com/@actions/core/-/core-1.4.0.tgz#cf2e6ee317e314b03886adfeb20e448d50d6e524" - integrity sha512-CGx2ilGq5i7zSLgiiGUtBCxhRRxibJYU6Fim0Q1Wg2aQL2LTnF27zbqZOrxfvFQ55eSBW0L8uVStgtKMpa0Qlg== + version "1.10.1" + resolved "https://registry.yarnpkg.com/@actions/core/-/core-1.10.1.tgz#61108e7ac40acae95ee36da074fa5850ca4ced8a" + integrity sha512-3lBR9EDAY+iYIpTnTIXmWcNbX3T2kCkAEQGIQx4NVQ0575nk2k3GRZDTPQG+vVtS2izSLmINlxXf0uLtnrTP+g== + dependencies: + "@actions/http-client" "^2.0.1" + uuid "^8.3.2" + +"@actions/http-client@^2.0.1": + version "2.2.1" + resolved "https://registry.yarnpkg.com/@actions/http-client/-/http-client-2.2.1.tgz#ed3fe7a5a6d317ac1d39886b0bb999ded229bb38" + integrity sha512-KhC/cZsq7f8I4LfZSJKgCvEwfkE8o1538VoBeoGzokVLLnbFDEAdFD3UhoMklxo2un9NJVBdANOresx7vTHlHw== + dependencies: + tunnel "^0.0.6" + undici "^5.25.4" + +"@aws-crypto/sha256-browser@5.2.0": + version "5.2.0" + resolved "https://registry.yarnpkg.com/@aws-crypto/sha256-browser/-/sha256-browser-5.2.0.tgz#153895ef1dba6f9fce38af550e0ef58988eb649e" + integrity sha512-AXfN/lGotSQwu6HNcEsIASo7kWXZ5HYWvfOmSNKDsEqC4OashTp8alTmaz+F7TC2L083SFv5RdB+qU3Vs1kZqw== + dependencies: + "@aws-crypto/sha256-js" "^5.2.0" + "@aws-crypto/supports-web-crypto" "^5.2.0" + "@aws-crypto/util" "^5.2.0" + "@aws-sdk/types" "^3.222.0" + "@aws-sdk/util-locate-window" "^3.0.0" + "@smithy/util-utf8" "^2.0.0" + tslib "^2.6.2" + +"@aws-crypto/sha256-js@5.2.0", "@aws-crypto/sha256-js@^5.2.0": + version "5.2.0" + resolved "https://registry.yarnpkg.com/@aws-crypto/sha256-js/-/sha256-js-5.2.0.tgz#c4fdb773fdbed9a664fc1a95724e206cf3860042" + integrity sha512-FFQQyu7edu4ufvIZ+OadFpHHOt+eSTBaYaki44c+akjg7qZg9oOQeLlk77F6tSYqjDAFClrHJk9tMf0HdVyOvA== + dependencies: + "@aws-crypto/util" "^5.2.0" + "@aws-sdk/types" "^3.222.0" + tslib "^2.6.2" + +"@aws-crypto/supports-web-crypto@^5.2.0": + version "5.2.0" + resolved "https://registry.yarnpkg.com/@aws-crypto/supports-web-crypto/-/supports-web-crypto-5.2.0.tgz#a1e399af29269be08e695109aa15da0a07b5b5fb" + integrity sha512-iAvUotm021kM33eCdNfwIN//F77/IADDSs58i+MDaOqFrVjZo9bAal0NK7HurRuWLLpF1iLX7gbWrjHjeo+YFg== + dependencies: + tslib "^2.6.2" + +"@aws-crypto/util@^5.2.0": + version "5.2.0" + resolved "https://registry.yarnpkg.com/@aws-crypto/util/-/util-5.2.0.tgz#71284c9cffe7927ddadac793c14f14886d3876da" + integrity sha512-4RkU9EsI6ZpBve5fseQlGNUWKMa1RLPQ1dnjnQoe07ldfIzcsGb5hC5W0Dm7u423KWzawlrpbjXBrXCEv9zazQ== + dependencies: + "@aws-sdk/types" "^3.222.0" + "@smithy/util-utf8" "^2.0.0" + tslib "^2.6.2" + +"@aws-sdk/client-cognito-identity@3.609.0": + version "3.609.0" + resolved "https://registry.yarnpkg.com/@aws-sdk/client-cognito-identity/-/client-cognito-identity-3.609.0.tgz#839796c9ada529bf1fdbac4153e4191df55fefcc" + integrity sha512-3kDTpia1iN/accayoH3MbZRbDvX2tzrKrBTU7wNNoazVrh+gOMS8KCOWrOB72F0V299l4FsfQhnl9BDMVrc1iw== + dependencies: + "@aws-crypto/sha256-browser" "5.2.0" + "@aws-crypto/sha256-js" "5.2.0" + "@aws-sdk/client-sso-oidc" "3.609.0" + "@aws-sdk/client-sts" "3.609.0" + "@aws-sdk/core" "3.609.0" + "@aws-sdk/credential-provider-node" "3.609.0" + "@aws-sdk/middleware-host-header" "3.609.0" + "@aws-sdk/middleware-logger" "3.609.0" + "@aws-sdk/middleware-recursion-detection" "3.609.0" + "@aws-sdk/middleware-user-agent" "3.609.0" + "@aws-sdk/region-config-resolver" "3.609.0" + "@aws-sdk/types" "3.609.0" + "@aws-sdk/util-endpoints" "3.609.0" + "@aws-sdk/util-user-agent-browser" "3.609.0" + "@aws-sdk/util-user-agent-node" "3.609.0" + "@smithy/config-resolver" "^3.0.4" + "@smithy/core" "^2.2.4" + "@smithy/fetch-http-handler" "^3.2.0" + "@smithy/hash-node" "^3.0.3" + "@smithy/invalid-dependency" "^3.0.3" + "@smithy/middleware-content-length" "^3.0.3" + "@smithy/middleware-endpoint" "^3.0.4" + "@smithy/middleware-retry" "^3.0.7" + "@smithy/middleware-serde" "^3.0.3" + "@smithy/middleware-stack" "^3.0.3" + "@smithy/node-config-provider" "^3.1.3" + "@smithy/node-http-handler" "^3.1.1" + "@smithy/protocol-http" "^4.0.3" + "@smithy/smithy-client" "^3.1.5" + "@smithy/types" "^3.3.0" + "@smithy/url-parser" "^3.0.3" + "@smithy/util-base64" "^3.0.0" + "@smithy/util-body-length-browser" "^3.0.0" + "@smithy/util-body-length-node" "^3.0.0" + "@smithy/util-defaults-mode-browser" "^3.0.7" + "@smithy/util-defaults-mode-node" "^3.0.7" + "@smithy/util-endpoints" "^2.0.4" + "@smithy/util-middleware" "^3.0.3" + "@smithy/util-retry" "^3.0.3" + "@smithy/util-utf8" "^3.0.0" + tslib "^2.6.2" + +"@aws-sdk/client-sso-oidc@3.609.0": + version "3.609.0" + resolved "https://registry.yarnpkg.com/@aws-sdk/client-sso-oidc/-/client-sso-oidc-3.609.0.tgz#66b3cdf6c1ede12423046ea0d0b5889655565e1a" + integrity sha512-0bNPAyPdkWkS9EGB2A9BZDkBNrnVCBzk5lYRezoT4K3/gi9w1DTYH5tuRdwaTZdxW19U1mq7CV0YJJARKO1L9Q== + dependencies: + "@aws-crypto/sha256-browser" "5.2.0" + "@aws-crypto/sha256-js" "5.2.0" + "@aws-sdk/core" "3.609.0" + "@aws-sdk/credential-provider-node" "3.609.0" + "@aws-sdk/middleware-host-header" "3.609.0" + "@aws-sdk/middleware-logger" "3.609.0" + "@aws-sdk/middleware-recursion-detection" "3.609.0" + "@aws-sdk/middleware-user-agent" "3.609.0" + "@aws-sdk/region-config-resolver" "3.609.0" + "@aws-sdk/types" "3.609.0" + "@aws-sdk/util-endpoints" "3.609.0" + "@aws-sdk/util-user-agent-browser" "3.609.0" + "@aws-sdk/util-user-agent-node" "3.609.0" + "@smithy/config-resolver" "^3.0.4" + "@smithy/core" "^2.2.4" + "@smithy/fetch-http-handler" "^3.2.0" + "@smithy/hash-node" "^3.0.3" + "@smithy/invalid-dependency" "^3.0.3" + "@smithy/middleware-content-length" "^3.0.3" + "@smithy/middleware-endpoint" "^3.0.4" + "@smithy/middleware-retry" "^3.0.7" + "@smithy/middleware-serde" "^3.0.3" + "@smithy/middleware-stack" "^3.0.3" + "@smithy/node-config-provider" "^3.1.3" + "@smithy/node-http-handler" "^3.1.1" + "@smithy/protocol-http" "^4.0.3" + "@smithy/smithy-client" "^3.1.5" + "@smithy/types" "^3.3.0" + "@smithy/url-parser" "^3.0.3" + "@smithy/util-base64" "^3.0.0" + "@smithy/util-body-length-browser" "^3.0.0" + "@smithy/util-body-length-node" "^3.0.0" + "@smithy/util-defaults-mode-browser" "^3.0.7" + "@smithy/util-defaults-mode-node" "^3.0.7" + "@smithy/util-endpoints" "^2.0.4" + "@smithy/util-middleware" "^3.0.3" + "@smithy/util-retry" "^3.0.3" + "@smithy/util-utf8" "^3.0.0" + tslib "^2.6.2" + +"@aws-sdk/client-sso@3.609.0": + version "3.609.0" + resolved "https://registry.yarnpkg.com/@aws-sdk/client-sso/-/client-sso-3.609.0.tgz#2a99166694b64947ba5b7453f057772bd3bba5b8" + integrity sha512-gqXGFDkIpKHCKAbeJK4aIDt3tiwJ26Rf5Tqw9JS6BYXsdMeOB8FTzqD9R+Yc1epHd8s5L94sdqXT5PapgxFZrg== + dependencies: + "@aws-crypto/sha256-browser" "5.2.0" + "@aws-crypto/sha256-js" "5.2.0" + "@aws-sdk/core" "3.609.0" + "@aws-sdk/middleware-host-header" "3.609.0" + "@aws-sdk/middleware-logger" "3.609.0" + "@aws-sdk/middleware-recursion-detection" "3.609.0" + "@aws-sdk/middleware-user-agent" "3.609.0" + "@aws-sdk/region-config-resolver" "3.609.0" + "@aws-sdk/types" "3.609.0" + "@aws-sdk/util-endpoints" "3.609.0" + "@aws-sdk/util-user-agent-browser" "3.609.0" + "@aws-sdk/util-user-agent-node" "3.609.0" + "@smithy/config-resolver" "^3.0.4" + "@smithy/core" "^2.2.4" + "@smithy/fetch-http-handler" "^3.2.0" + "@smithy/hash-node" "^3.0.3" + "@smithy/invalid-dependency" "^3.0.3" + "@smithy/middleware-content-length" "^3.0.3" + "@smithy/middleware-endpoint" "^3.0.4" + "@smithy/middleware-retry" "^3.0.7" + "@smithy/middleware-serde" "^3.0.3" + "@smithy/middleware-stack" "^3.0.3" + "@smithy/node-config-provider" "^3.1.3" + "@smithy/node-http-handler" "^3.1.1" + "@smithy/protocol-http" "^4.0.3" + "@smithy/smithy-client" "^3.1.5" + "@smithy/types" "^3.3.0" + "@smithy/url-parser" "^3.0.3" + "@smithy/util-base64" "^3.0.0" + "@smithy/util-body-length-browser" "^3.0.0" + "@smithy/util-body-length-node" "^3.0.0" + "@smithy/util-defaults-mode-browser" "^3.0.7" + "@smithy/util-defaults-mode-node" "^3.0.7" + "@smithy/util-endpoints" "^2.0.4" + "@smithy/util-middleware" "^3.0.3" + "@smithy/util-retry" "^3.0.3" + "@smithy/util-utf8" "^3.0.0" + tslib "^2.6.2" + +"@aws-sdk/client-sts@3.609.0": + version "3.609.0" + resolved "https://registry.yarnpkg.com/@aws-sdk/client-sts/-/client-sts-3.609.0.tgz#ac373baf1d4c02adcf6162f0a6f099607046a44c" + integrity sha512-A0B3sDKFoFlGo8RYRjDBWHXpbgirer2bZBkCIzhSPHc1vOFHt/m2NcUoE2xnBKXJFrptL1xDkvo1P+XYp/BfcQ== + dependencies: + "@aws-crypto/sha256-browser" "5.2.0" + "@aws-crypto/sha256-js" "5.2.0" + "@aws-sdk/client-sso-oidc" "3.609.0" + "@aws-sdk/core" "3.609.0" + "@aws-sdk/credential-provider-node" "3.609.0" + "@aws-sdk/middleware-host-header" "3.609.0" + "@aws-sdk/middleware-logger" "3.609.0" + "@aws-sdk/middleware-recursion-detection" "3.609.0" + "@aws-sdk/middleware-user-agent" "3.609.0" + "@aws-sdk/region-config-resolver" "3.609.0" + "@aws-sdk/types" "3.609.0" + "@aws-sdk/util-endpoints" "3.609.0" + "@aws-sdk/util-user-agent-browser" "3.609.0" + "@aws-sdk/util-user-agent-node" "3.609.0" + "@smithy/config-resolver" "^3.0.4" + "@smithy/core" "^2.2.4" + "@smithy/fetch-http-handler" "^3.2.0" + "@smithy/hash-node" "^3.0.3" + "@smithy/invalid-dependency" "^3.0.3" + "@smithy/middleware-content-length" "^3.0.3" + "@smithy/middleware-endpoint" "^3.0.4" + "@smithy/middleware-retry" "^3.0.7" + "@smithy/middleware-serde" "^3.0.3" + "@smithy/middleware-stack" "^3.0.3" + "@smithy/node-config-provider" "^3.1.3" + "@smithy/node-http-handler" "^3.1.1" + "@smithy/protocol-http" "^4.0.3" + "@smithy/smithy-client" "^3.1.5" + "@smithy/types" "^3.3.0" + "@smithy/url-parser" "^3.0.3" + "@smithy/util-base64" "^3.0.0" + "@smithy/util-body-length-browser" "^3.0.0" + "@smithy/util-body-length-node" "^3.0.0" + "@smithy/util-defaults-mode-browser" "^3.0.7" + "@smithy/util-defaults-mode-node" "^3.0.7" + "@smithy/util-endpoints" "^2.0.4" + "@smithy/util-middleware" "^3.0.3" + "@smithy/util-retry" "^3.0.3" + "@smithy/util-utf8" "^3.0.0" + tslib "^2.6.2" + +"@aws-sdk/core@3.609.0": + version "3.609.0" + resolved "https://registry.yarnpkg.com/@aws-sdk/core/-/core-3.609.0.tgz#4c3994cd341452d1ef1a8b5e81a16442a7422287" + integrity sha512-ptqw+DTxLr01+pKjDUuo53SEDzI+7nFM3WfQaEo0yhDg8vWw8PER4sWj1Ysx67ksctnZesPUjqxd5SHbtdBxiA== + dependencies: + "@smithy/core" "^2.2.4" + "@smithy/protocol-http" "^4.0.3" + "@smithy/signature-v4" "^3.1.2" + "@smithy/smithy-client" "^3.1.5" + "@smithy/types" "^3.3.0" + fast-xml-parser "4.2.5" + tslib "^2.6.2" + +"@aws-sdk/credential-provider-cognito-identity@3.609.0": + version "3.609.0" + resolved "https://registry.yarnpkg.com/@aws-sdk/credential-provider-cognito-identity/-/credential-provider-cognito-identity-3.609.0.tgz#15cb5af87dd3c98b49112e7315643c871b9cb964" + integrity sha512-BqrpAXRr64dQ/uZsRB2wViGKTkVRlfp8Q+Zd7Bc8Ikk+YXjPtl+IyWXKtdKQ3LBO255KwAcPmra5oFC+2R1GOQ== + dependencies: + "@aws-sdk/client-cognito-identity" "3.609.0" + "@aws-sdk/types" "3.609.0" + "@smithy/property-provider" "^3.1.3" + "@smithy/types" "^3.3.0" + tslib "^2.6.2" + +"@aws-sdk/credential-provider-env@3.609.0": + version "3.609.0" + resolved "https://registry.yarnpkg.com/@aws-sdk/credential-provider-env/-/credential-provider-env-3.609.0.tgz#b3f32e5a8ff8b541e151eadadfb60283aa3d835e" + integrity sha512-v69ZCWcec2iuV9vLVJMa6fAb5xwkzN4jYIT8yjo2c4Ia/j976Q+TPf35Pnz5My48Xr94EFcaBazrWedF+kwfuQ== + dependencies: + "@aws-sdk/types" "3.609.0" + "@smithy/property-provider" "^3.1.3" + "@smithy/types" "^3.3.0" + tslib "^2.6.2" + +"@aws-sdk/credential-provider-http@3.609.0": + version "3.609.0" + resolved "https://registry.yarnpkg.com/@aws-sdk/credential-provider-http/-/credential-provider-http-3.609.0.tgz#836c042a012bf1b9ff9df9ae9e3d876bb492c82e" + integrity sha512-GQQfB9Mk4XUZwaPsk4V3w8MqleS6ApkZKVQn3vTLAKa8Y7B2Imcpe5zWbKYjDd8MPpMWjHcBGFTVlDRFP4zwSQ== + dependencies: + "@aws-sdk/types" "3.609.0" + "@smithy/fetch-http-handler" "^3.2.0" + "@smithy/node-http-handler" "^3.1.1" + "@smithy/property-provider" "^3.1.3" + "@smithy/protocol-http" "^4.0.3" + "@smithy/smithy-client" "^3.1.5" + "@smithy/types" "^3.3.0" + "@smithy/util-stream" "^3.0.5" + tslib "^2.6.2" + +"@aws-sdk/credential-provider-ini@3.609.0": + version "3.609.0" + resolved "https://registry.yarnpkg.com/@aws-sdk/credential-provider-ini/-/credential-provider-ini-3.609.0.tgz#5b569a7fb8cddd0fecb1dd6444ae0599fb27121e" + integrity sha512-hwaBfXuBTv6/eAdEsDfGcteYUW6Km7lvvubbxEdxIuJNF3vswR7RMGIXaEC37hhPkTTgd3H0TONammhwZIfkog== + dependencies: + "@aws-sdk/credential-provider-env" "3.609.0" + "@aws-sdk/credential-provider-http" "3.609.0" + "@aws-sdk/credential-provider-process" "3.609.0" + "@aws-sdk/credential-provider-sso" "3.609.0" + "@aws-sdk/credential-provider-web-identity" "3.609.0" + "@aws-sdk/types" "3.609.0" + "@smithy/credential-provider-imds" "^3.1.3" + "@smithy/property-provider" "^3.1.3" + "@smithy/shared-ini-file-loader" "^3.1.3" + "@smithy/types" "^3.3.0" + tslib "^2.6.2" + +"@aws-sdk/credential-provider-node@3.609.0": + version "3.609.0" + resolved "https://registry.yarnpkg.com/@aws-sdk/credential-provider-node/-/credential-provider-node-3.609.0.tgz#9abcf6c9104310cc4fba70d95f0b9029ba54dea9" + integrity sha512-4J8/JRuqfxJDGD9jTHVCBxCvYt7/Vgj2Stlhj930mrjFPO/yRw8ilAAZxBWe0JHPX3QwepCmh4ErZe53F5ysxQ== + dependencies: + "@aws-sdk/credential-provider-env" "3.609.0" + "@aws-sdk/credential-provider-http" "3.609.0" + "@aws-sdk/credential-provider-ini" "3.609.0" + "@aws-sdk/credential-provider-process" "3.609.0" + "@aws-sdk/credential-provider-sso" "3.609.0" + "@aws-sdk/credential-provider-web-identity" "3.609.0" + "@aws-sdk/types" "3.609.0" + "@smithy/credential-provider-imds" "^3.1.3" + "@smithy/property-provider" "^3.1.3" + "@smithy/shared-ini-file-loader" "^3.1.3" + "@smithy/types" "^3.3.0" + tslib "^2.6.2" + +"@aws-sdk/credential-provider-process@3.609.0": + version "3.609.0" + resolved "https://registry.yarnpkg.com/@aws-sdk/credential-provider-process/-/credential-provider-process-3.609.0.tgz#2bfa160eec4be8532a45061810466ee3462ce240" + integrity sha512-Ux35nGOSJKZWUIM3Ny0ROZ8cqPRUEkh+tR3X2o9ydEbFiLq3eMMyEnHJqx4EeUjLRchidlm4CCid9GxMe5/gdw== + dependencies: + "@aws-sdk/types" "3.609.0" + "@smithy/property-provider" "^3.1.3" + "@smithy/shared-ini-file-loader" "^3.1.3" + "@smithy/types" "^3.3.0" + tslib "^2.6.2" + +"@aws-sdk/credential-provider-sso@3.609.0": + version "3.609.0" + resolved "https://registry.yarnpkg.com/@aws-sdk/credential-provider-sso/-/credential-provider-sso-3.609.0.tgz#94da403a000060700a34ee62fcf119fd4cacf167" + integrity sha512-oQPGDKMMIxjvTcm86g07RPYeC7mCNk+29dPpY15ZAPRpAF7F0tircsC3wT9fHzNaKShEyK5LuI5Kg/uxsdy+Iw== + dependencies: + "@aws-sdk/client-sso" "3.609.0" + "@aws-sdk/token-providers" "3.609.0" + "@aws-sdk/types" "3.609.0" + "@smithy/property-provider" "^3.1.3" + "@smithy/shared-ini-file-loader" "^3.1.3" + "@smithy/types" "^3.3.0" + tslib "^2.6.2" + +"@aws-sdk/credential-provider-web-identity@3.609.0": + version "3.609.0" + resolved "https://registry.yarnpkg.com/@aws-sdk/credential-provider-web-identity/-/credential-provider-web-identity-3.609.0.tgz#d29222d6894347ee89c781ea090d388656df1d2a" + integrity sha512-U+PG8NhlYYF45zbr1km3ROtBMYqyyj/oK8NRp++UHHeuavgrP+4wJ4wQnlEaKvJBjevfo3+dlIBcaeQ7NYejWg== + dependencies: + "@aws-sdk/types" "3.609.0" + "@smithy/property-provider" "^3.1.3" + "@smithy/types" "^3.3.0" + tslib "^2.6.2" + +"@aws-sdk/credential-providers@^3.186.0": + version "3.609.0" + resolved "https://registry.yarnpkg.com/@aws-sdk/credential-providers/-/credential-providers-3.609.0.tgz#e35489f21f99b9908a229ba59925c3386a08f67c" + integrity sha512-bJKMY4QwRVderh8R2s9kukoZhuNZew/xzwPa9DRRFVOIsznsS0faAdmAAFrKb8e06YyQq6DiZP0BfFyVHAXE2A== + dependencies: + "@aws-sdk/client-cognito-identity" "3.609.0" + "@aws-sdk/client-sso" "3.609.0" + "@aws-sdk/client-sts" "3.609.0" + "@aws-sdk/credential-provider-cognito-identity" "3.609.0" + "@aws-sdk/credential-provider-env" "3.609.0" + "@aws-sdk/credential-provider-http" "3.609.0" + "@aws-sdk/credential-provider-ini" "3.609.0" + "@aws-sdk/credential-provider-node" "3.609.0" + "@aws-sdk/credential-provider-process" "3.609.0" + "@aws-sdk/credential-provider-sso" "3.609.0" + "@aws-sdk/credential-provider-web-identity" "3.609.0" + "@aws-sdk/types" "3.609.0" + "@smithy/credential-provider-imds" "^3.1.3" + "@smithy/property-provider" "^3.1.3" + "@smithy/types" "^3.3.0" + tslib "^2.6.2" + +"@aws-sdk/middleware-host-header@3.609.0": + version "3.609.0" + resolved "https://registry.yarnpkg.com/@aws-sdk/middleware-host-header/-/middleware-host-header-3.609.0.tgz#844302cb905e4d09b9a1ea4bfa96729833068913" + integrity sha512-iTKfo158lc4jLDfYeZmYMIBHsn8m6zX+XB6birCSNZ/rrlzAkPbGE43CNdKfvjyWdqgLMRXF+B+OcZRvqhMXPQ== + dependencies: + "@aws-sdk/types" "3.609.0" + "@smithy/protocol-http" "^4.0.3" + "@smithy/types" "^3.3.0" + tslib "^2.6.2" + +"@aws-sdk/middleware-logger@3.609.0": + version "3.609.0" + resolved "https://registry.yarnpkg.com/@aws-sdk/middleware-logger/-/middleware-logger-3.609.0.tgz#ed44d201f091b8bac908cbf14724c7a4d492553f" + integrity sha512-S62U2dy4jMDhDFDK5gZ4VxFdWzCtLzwbYyFZx2uvPYTECkepLUfzLic2BHg2Qvtu4QjX+oGE3P/7fwaGIsGNuQ== + dependencies: + "@aws-sdk/types" "3.609.0" + "@smithy/types" "^3.3.0" + tslib "^2.6.2" + +"@aws-sdk/middleware-recursion-detection@3.609.0": + version "3.609.0" + resolved "https://registry.yarnpkg.com/@aws-sdk/middleware-recursion-detection/-/middleware-recursion-detection-3.609.0.tgz#b7b869aaeac021a43dbea1435eaea81e5d2460b1" + integrity sha512-6sewsYB7/o/nbUfA99Aa/LokM+a/u4Wpm/X2o0RxOsDtSB795ObebLJe2BxY5UssbGaWkn7LswyfvrdZNXNj1w== + dependencies: + "@aws-sdk/types" "3.609.0" + "@smithy/protocol-http" "^4.0.3" + "@smithy/types" "^3.3.0" + tslib "^2.6.2" + +"@aws-sdk/middleware-user-agent@3.609.0": + version "3.609.0" + resolved "https://registry.yarnpkg.com/@aws-sdk/middleware-user-agent/-/middleware-user-agent-3.609.0.tgz#eb3b7c604817be42f7ecd97988dda69a22e6011b" + integrity sha512-nbq7MXRmeXm4IDqh+sJRAxGPAq0OfGmGIwKvJcw66hLoG8CmhhVMZmIAEBDFr57S+YajGwnLLRt+eMI05MMeVA== + dependencies: + "@aws-sdk/types" "3.609.0" + "@aws-sdk/util-endpoints" "3.609.0" + "@smithy/protocol-http" "^4.0.3" + "@smithy/types" "^3.3.0" + tslib "^2.6.2" + +"@aws-sdk/region-config-resolver@3.609.0": + version "3.609.0" + resolved "https://registry.yarnpkg.com/@aws-sdk/region-config-resolver/-/region-config-resolver-3.609.0.tgz#68fe568d1c69f35f7fa3d66f718bd5751b1debda" + integrity sha512-lMHBG8zg9GWYBc9/XVPKyuAUd7iKqfPP7z04zGta2kGNOKbUTeqmAdc1gJGku75p4kglIPlGBorOxti8DhRmKw== + dependencies: + "@aws-sdk/types" "3.609.0" + "@smithy/node-config-provider" "^3.1.3" + "@smithy/types" "^3.3.0" + "@smithy/util-config-provider" "^3.0.0" + "@smithy/util-middleware" "^3.0.3" + tslib "^2.6.2" + +"@aws-sdk/token-providers@3.609.0": + version "3.609.0" + resolved "https://registry.yarnpkg.com/@aws-sdk/token-providers/-/token-providers-3.609.0.tgz#cfa9cdc84fefe71277c7d44b08b09f42c16c1d66" + integrity sha512-WvhW/7XSf+H7YmtiIigQxfDVZVZI7mbKikQ09YpzN7FeN3TmYib1+0tB+EE9TbICkwssjiFc71FEBEh4K9grKQ== + dependencies: + "@aws-sdk/types" "3.609.0" + "@smithy/property-provider" "^3.1.3" + "@smithy/shared-ini-file-loader" "^3.1.3" + "@smithy/types" "^3.3.0" + tslib "^2.6.2" + +"@aws-sdk/types@3.609.0", "@aws-sdk/types@^3.222.0": + version "3.609.0" + resolved "https://registry.yarnpkg.com/@aws-sdk/types/-/types-3.609.0.tgz#06b39d799c9f197a7b43670243e8e78a3bf7d6a5" + integrity sha512-+Tqnh9w0h2LcrUsdXyT1F8mNhXz+tVYBtP19LpeEGntmvHwa2XzvLUCWpoIAIVsHp5+HdB2X9Sn0KAtmbFXc2Q== + dependencies: + "@smithy/types" "^3.3.0" + tslib "^2.6.2" + +"@aws-sdk/util-endpoints@3.609.0": + version "3.609.0" + resolved "https://registry.yarnpkg.com/@aws-sdk/util-endpoints/-/util-endpoints-3.609.0.tgz#e02d3fce2f999d750828dacf9f37289a1a48f6c9" + integrity sha512-Rh+3V8dOvEeE1aQmUy904DYWtLUEJ7Vf5XBPlQ6At3pBhp+zpXbsnpZzVL33c8lW1xfj6YPwtO6gOeEsl1juCQ== + dependencies: + "@aws-sdk/types" "3.609.0" + "@smithy/types" "^3.3.0" + "@smithy/util-endpoints" "^2.0.4" + tslib "^2.6.2" + +"@aws-sdk/util-locate-window@^3.0.0": + version "3.568.0" + resolved "https://registry.yarnpkg.com/@aws-sdk/util-locate-window/-/util-locate-window-3.568.0.tgz#2acc4b2236af0d7494f7e517401ba6b3c4af11ff" + integrity sha512-3nh4TINkXYr+H41QaPelCceEB2FXP3fxp93YZXB/kqJvX0U9j0N0Uk45gvsjmEPzG8XxkPEeLIfT2I1M7A6Lig== + dependencies: + tslib "^2.6.2" + +"@aws-sdk/util-user-agent-browser@3.609.0": + version "3.609.0" + resolved "https://registry.yarnpkg.com/@aws-sdk/util-user-agent-browser/-/util-user-agent-browser-3.609.0.tgz#aa15421b2e32ae8bc589dac2bd6e8969832ce588" + integrity sha512-fojPU+mNahzQ0YHYBsx0ZIhmMA96H+ZIZ665ObU9tl+SGdbLneVZVikGve+NmHTQwHzwkFsZYYnVKAkreJLAtA== + dependencies: + "@aws-sdk/types" "3.609.0" + "@smithy/types" "^3.3.0" + bowser "^2.11.0" + tslib "^2.6.2" + +"@aws-sdk/util-user-agent-node@3.609.0": + version "3.609.0" + resolved "https://registry.yarnpkg.com/@aws-sdk/util-user-agent-node/-/util-user-agent-node-3.609.0.tgz#f8270517b2961cbf627e4e8fb6338ad153db44bb" + integrity sha512-DlZBwQ/HkZyf3pOWc7+wjJRk5R7x9YxHhs2szHwtv1IW30KMabjjjX0GMlGJ9LLkBHkbaaEY/w9Tkj12XRLhRg== + dependencies: + "@aws-sdk/types" "3.609.0" + "@smithy/node-config-provider" "^3.1.3" + "@smithy/types" "^3.3.0" + tslib "^2.6.2" "@babel/code-frame@7.12.11": version "7.12.11" @@ -21,6 +500,14 @@ dependencies: "@babel/highlight" "^7.14.5" +"@babel/code-frame@^7.24.7": + version "7.24.7" + resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.24.7.tgz#882fd9e09e8ee324e496bd040401c6f046ef4465" + integrity sha512-BcYH1CVJBO9tvyIZ2jVeXgSIMvGZ2FDRvDdOIVQyuklNKSsx+eppDEBq/g47Ayw+RqNFE+URvOShmf+f/qwAlA== + dependencies: + "@babel/highlight" "^7.24.7" + picocolors "^1.0.0" + "@babel/compat-data@^7.14.5": version "7.14.7" resolved "https://registry.yarnpkg.com/@babel/compat-data/-/compat-data-7.14.7.tgz#7b047d7a3a89a67d2258dc61f604f098f1bc7e08" @@ -65,6 +552,16 @@ jsesc "^2.5.1" source-map "^0.5.0" +"@babel/generator@^7.24.7": + version "7.24.7" + resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.24.7.tgz#1654d01de20ad66b4b4d99c135471bc654c55e6d" + integrity sha512-oipXieGC3i45Y1A41t4tAqpnEZWgB/lC6Ehh6+rOviR5XWpTtMmLN+fGjz9vOiNRt0p6RtO6DtD0pdU3vpqdSA== + dependencies: + "@babel/types" "^7.24.7" + "@jridgewell/gen-mapping" "^0.3.5" + "@jridgewell/trace-mapping" "^0.3.25" + jsesc "^2.5.1" + "@babel/helper-compilation-targets@^7.14.5": version "7.14.5" resolved "https://registry.yarnpkg.com/@babel/helper-compilation-targets/-/helper-compilation-targets-7.14.5.tgz#7a99c5d0967911e972fe2c3411f7d5b498498ecf" @@ -75,28 +572,27 @@ browserslist "^4.16.6" semver "^6.3.0" -"@babel/helper-function-name@^7.14.5": - version "7.14.5" - resolved "https://registry.yarnpkg.com/@babel/helper-function-name/-/helper-function-name-7.14.5.tgz#89e2c474972f15d8e233b52ee8c480e2cfcd50c4" - integrity sha512-Gjna0AsXWfFvrAuX+VKcN/aNNWonizBj39yGwUzVDVTlMYJMK2Wp6xdpy72mfArFq5uK+NOuexfzZlzI1z9+AQ== +"@babel/helper-environment-visitor@^7.24.7": + version "7.24.7" + resolved "https://registry.yarnpkg.com/@babel/helper-environment-visitor/-/helper-environment-visitor-7.24.7.tgz#4b31ba9551d1f90781ba83491dd59cf9b269f7d9" + integrity sha512-DoiN84+4Gnd0ncbBOM9AZENV4a5ZiL39HYMyZJGZ/AZEykHYdJw0wW3kdcsh9/Kn+BRXHLkkklZ51ecPKmI1CQ== dependencies: - "@babel/helper-get-function-arity" "^7.14.5" - "@babel/template" "^7.14.5" - "@babel/types" "^7.14.5" + "@babel/types" "^7.24.7" -"@babel/helper-get-function-arity@^7.14.5": - version "7.14.5" - resolved "https://registry.yarnpkg.com/@babel/helper-get-function-arity/-/helper-get-function-arity-7.14.5.tgz#25fbfa579b0937eee1f3b805ece4ce398c431815" - integrity sha512-I1Db4Shst5lewOM4V+ZKJzQ0JGGaZ6VY1jYvMghRjqs6DWgxLCIyFt30GlnKkfUeFLpJt2vzbMVEXVSXlIFYUg== +"@babel/helper-function-name@^7.24.7": + version "7.24.7" + resolved "https://registry.yarnpkg.com/@babel/helper-function-name/-/helper-function-name-7.24.7.tgz#75f1e1725742f39ac6584ee0b16d94513da38dd2" + integrity sha512-FyoJTsj/PEUWu1/TYRiXTIHc8lbw+TDYkZuoE43opPS5TrI7MyONBE1oNvfguEXAD9yhQRrVBnXdXzSLQl9XnA== dependencies: - "@babel/types" "^7.14.5" + "@babel/template" "^7.24.7" + "@babel/types" "^7.24.7" -"@babel/helper-hoist-variables@^7.14.5": - version "7.14.5" - resolved "https://registry.yarnpkg.com/@babel/helper-hoist-variables/-/helper-hoist-variables-7.14.5.tgz#e0dd27c33a78e577d7c8884916a3e7ef1f7c7f8d" - integrity sha512-R1PXiz31Uc0Vxy4OEOm07x0oSjKAdPPCh3tPivn/Eo8cvz6gveAeuyUUPB21Hoiif0uoPQSSdhIPS3352nvdyQ== +"@babel/helper-hoist-variables@^7.24.7": + version "7.24.7" + resolved "https://registry.yarnpkg.com/@babel/helper-hoist-variables/-/helper-hoist-variables-7.24.7.tgz#b4ede1cde2fd89436397f30dc9376ee06b0f25ee" + integrity sha512-MJJwhkoGy5c4ehfoRyrJ/owKeMl19U54h27YYftT0o2teQ3FJ3nQUf/I3LlJsX4l3qlw7WRXUmiyajvHXoTubQ== dependencies: - "@babel/types" "^7.14.5" + "@babel/types" "^7.24.7" "@babel/helper-member-expression-to-functions@^7.14.5": version "7.14.7" @@ -162,11 +658,28 @@ dependencies: "@babel/types" "^7.14.5" +"@babel/helper-split-export-declaration@^7.24.7": + version "7.24.7" + resolved "https://registry.yarnpkg.com/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.24.7.tgz#83949436890e07fa3d6873c61a96e3bbf692d856" + integrity sha512-oy5V7pD+UvfkEATUKvIjvIAH/xCzfsFVw7ygW2SI6NClZzquT+mwdTfgfdbUiceh6iQO0CHtCPsyze/MZ2YbAA== + dependencies: + "@babel/types" "^7.24.7" + +"@babel/helper-string-parser@^7.24.7": + version "7.24.7" + resolved "https://registry.yarnpkg.com/@babel/helper-string-parser/-/helper-string-parser-7.24.7.tgz#4d2d0f14820ede3b9807ea5fc36dfc8cd7da07f2" + integrity sha512-7MbVt6xrwFQbunH2DNQsAP5sTGxfqQtErvBIvIMi6EQnbgUOuVYanvREcmFrOPhoXBrTtjhhP+lW+o5UfK+tDg== + "@babel/helper-validator-identifier@^7.14.5": version "7.14.5" resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.14.5.tgz#d0f0e277c512e0c938277faa85a3968c9a44c0e8" integrity sha512-5lsetuxCLilmVGyiLEfoHBRX8UCFD+1m2x3Rj97WrW3V7H3u4RWRXA4evMjImCsin2J2YT0QaVDGf+z8ondbAg== +"@babel/helper-validator-identifier@^7.24.7": + version "7.24.7" + resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.24.7.tgz#75b889cfaf9e35c2aaf42cf0d72c8e91719251db" + integrity sha512-rR+PBcQ1SMQDDyF6X0wxtG8QyLCgUB0eRAGguqRLfkCA87l7yAP7ehq8SNj96OOGTO8OBV70KhuFYcIkHXOg0w== + "@babel/helper-validator-option@^7.14.5": version "7.14.5" resolved "https://registry.yarnpkg.com/@babel/helper-validator-option/-/helper-validator-option-7.14.5.tgz#6e72a1fff18d5dfcb878e1e62f1a021c4b72d5a3" @@ -190,11 +703,26 @@ chalk "^2.0.0" js-tokens "^4.0.0" -"@babel/parser@^7.1.0", "@babel/parser@^7.14.5", "@babel/parser@^7.14.6", "@babel/parser@^7.14.7", "@babel/parser@^7.7.2": +"@babel/highlight@^7.24.7": + version "7.24.7" + resolved "https://registry.yarnpkg.com/@babel/highlight/-/highlight-7.24.7.tgz#a05ab1df134b286558aae0ed41e6c5f731bf409d" + integrity sha512-EStJpq4OuY8xYfhGVXngigBJRWxftKX9ksiGDnmlY3o7B/V7KIAc9X4oiK87uPJSc/vs5L869bem5fhZa8caZw== + dependencies: + "@babel/helper-validator-identifier" "^7.24.7" + chalk "^2.4.2" + js-tokens "^4.0.0" + picocolors "^1.0.0" + +"@babel/parser@^7.1.0", "@babel/parser@^7.14.5", "@babel/parser@^7.14.6", "@babel/parser@^7.7.2": version "7.14.7" resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.14.7.tgz#6099720c8839ca865a2637e6c85852ead0bdb595" integrity sha512-X67Z5y+VBJuHB/RjwECp8kSl5uYi0BvRbNeWqkaJCVh+LiTPl19WBUfG627psSgp9rSf6ojuXghQM3ha6qHHdA== +"@babel/parser@^7.24.7": + version "7.24.7" + resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.24.7.tgz#9a5226f92f0c5c8ead550b750f5608e766c8ce85" + integrity sha512-9uUYRm6OqQrCqQdG1iCBwBPZgN8ciDBro2nIOFaiRz1/BCxaI7CNvQbDHvsArAC7Tw9Hda/B3U+6ui9u4HWXPw== + "@babel/plugin-syntax-async-generators@^7.8.4": version "7.8.4" resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-async-generators/-/plugin-syntax-async-generators-7.8.4.tgz#a983fb1aeb2ec3f6ed042a210f640e90e786fe0d" @@ -295,19 +823,29 @@ "@babel/parser" "^7.14.5" "@babel/types" "^7.14.5" -"@babel/traverse@^7.1.0", "@babel/traverse@^7.14.5", "@babel/traverse@^7.7.2": - version "7.14.7" - resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.14.7.tgz#64007c9774cfdc3abd23b0780bc18a3ce3631753" - integrity sha512-9vDr5NzHu27wgwejuKL7kIOm4bwEtaPQ4Z6cpCmjSuaRqpH/7xc4qcGEscwMqlkwgcXl6MvqoAjZkQ24uSdIZQ== +"@babel/template@^7.24.7": + version "7.24.7" + resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.24.7.tgz#02efcee317d0609d2c07117cb70ef8fb17ab7315" + integrity sha512-jYqfPrU9JTF0PmPy1tLYHW4Mp4KlgxJD9l2nP9fD6yT/ICi554DmrWBAEYpIelzjHf1msDP3PxJIRt/nFNfBig== dependencies: - "@babel/code-frame" "^7.14.5" - "@babel/generator" "^7.14.5" - "@babel/helper-function-name" "^7.14.5" - "@babel/helper-hoist-variables" "^7.14.5" - "@babel/helper-split-export-declaration" "^7.14.5" - "@babel/parser" "^7.14.7" - "@babel/types" "^7.14.5" - debug "^4.1.0" + "@babel/code-frame" "^7.24.7" + "@babel/parser" "^7.24.7" + "@babel/types" "^7.24.7" + +"@babel/traverse@^7.1.0", "@babel/traverse@^7.14.5", "@babel/traverse@^7.7.2": + version "7.24.7" + resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.24.7.tgz#de2b900163fa741721ba382163fe46a936c40cf5" + integrity sha512-yb65Ed5S/QAcewNPh0nZczy9JdYXkkAbIsEo+P7BE7yO3txAY30Y/oPa3QkQ5It3xVG2kpKMg9MsdxZaO31uKA== + dependencies: + "@babel/code-frame" "^7.24.7" + "@babel/generator" "^7.24.7" + "@babel/helper-environment-visitor" "^7.24.7" + "@babel/helper-function-name" "^7.24.7" + "@babel/helper-hoist-variables" "^7.24.7" + "@babel/helper-split-export-declaration" "^7.24.7" + "@babel/parser" "^7.24.7" + "@babel/types" "^7.24.7" + debug "^4.3.1" globals "^11.1.0" "@babel/types@^7.0.0", "@babel/types@^7.14.5", "@babel/types@^7.3.0", "@babel/types@^7.3.3": @@ -318,6 +856,15 @@ "@babel/helper-validator-identifier" "^7.14.5" to-fast-properties "^2.0.0" +"@babel/types@^7.24.7": + version "7.24.7" + resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.24.7.tgz#6027fe12bc1aa724cd32ab113fb7f1988f1f66f2" + integrity sha512-XEFXSlxiG5td2EJRe8vOmRbaXVgfcBlszKujvVmWIK/UpywWljQCfzAv3RQCGujWQ1RD4YYWEAqDXfuJiy8f5Q== + dependencies: + "@babel/helper-string-parser" "^7.24.7" + "@babel/helper-validator-identifier" "^7.24.7" + to-fast-properties "^2.0.0" + "@bcoe/v8-coverage@^0.2.3": version "0.2.3" resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39" @@ -338,6 +885,11 @@ minimatch "^3.0.4" strip-json-comments "^3.1.1" +"@fastify/busboy@^2.0.0": + version "2.1.1" + resolved "https://registry.yarnpkg.com/@fastify/busboy/-/busboy-2.1.1.tgz#b9da6a878a371829a0502c9b6c1c143ef6663f4d" + integrity sha512-vBZP4NlzfOlerQTnba4aqZoMhE/a9HY7HRqoOPaETQcSQuWEIyZMHGfVu6w9wGtGK5fED5qRs2DteVCjOH60sA== + "@istanbuljs/load-nyc-config@^1.0.0": version "1.1.0" resolved "https://registry.yarnpkg.com/@istanbuljs/load-nyc-config/-/load-nyc-config-1.1.0.tgz#fd3db1d59ecf7cf121e80650bb86712f9b55eced" @@ -534,6 +1086,45 @@ "@types/yargs" "^16.0.0" chalk "^4.0.0" +"@jridgewell/gen-mapping@^0.3.5": + version "0.3.5" + resolved "https://registry.yarnpkg.com/@jridgewell/gen-mapping/-/gen-mapping-0.3.5.tgz#dcce6aff74bdf6dad1a95802b69b04a2fcb1fb36" + integrity sha512-IzL8ZoEDIBRWEzlCcRhOaCupYyN5gdIK+Q6fbFdPDg6HqX6jpkItn7DFIpW9LQzXG6Df9sA7+OKnq0qlz/GaQg== + dependencies: + "@jridgewell/set-array" "^1.2.1" + "@jridgewell/sourcemap-codec" "^1.4.10" + "@jridgewell/trace-mapping" "^0.3.24" + +"@jridgewell/resolve-uri@^3.1.0": + version "3.1.2" + resolved "https://registry.yarnpkg.com/@jridgewell/resolve-uri/-/resolve-uri-3.1.2.tgz#7a0ee601f60f99a20c7c7c5ff0c80388c1189bd6" + integrity sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw== + +"@jridgewell/set-array@^1.2.1": + version "1.2.1" + resolved "https://registry.yarnpkg.com/@jridgewell/set-array/-/set-array-1.2.1.tgz#558fb6472ed16a4c850b889530e6b36438c49280" + integrity sha512-R8gLRTZeyp03ymzP/6Lil/28tGeGEzhx1q2k703KGWRAI1VdvPIXdG70VJc2pAMw3NA6JKL5hhFu1sJX0Mnn/A== + +"@jridgewell/sourcemap-codec@^1.4.10", "@jridgewell/sourcemap-codec@^1.4.14": + version "1.4.15" + resolved "https://registry.yarnpkg.com/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.15.tgz#d7c6e6755c78567a951e04ab52ef0fd26de59f32" + integrity sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg== + +"@jridgewell/trace-mapping@^0.3.24", "@jridgewell/trace-mapping@^0.3.25": + version "0.3.25" + resolved "https://registry.yarnpkg.com/@jridgewell/trace-mapping/-/trace-mapping-0.3.25.tgz#15f190e98895f3fc23276ee14bc76b675c2e50f0" + integrity sha512-vNk6aEwybGtawWmy/PzwnGDOjCkLWSD2wqvjGGAgOAwCGWySYXfYoxt00IJkTF+8Lb57DwOb3Aa0o9CApepiYQ== + dependencies: + "@jridgewell/resolve-uri" "^3.1.0" + "@jridgewell/sourcemap-codec" "^1.4.14" + +"@mongodb-js/saslprep@^1.1.0": + version "1.1.7" + resolved "https://registry.yarnpkg.com/@mongodb-js/saslprep/-/saslprep-1.1.7.tgz#d1700facfd6916c50c2c88fd6d48d363a56c702f" + integrity sha512-dCHW/oEX0KJ4NjDULBo3JiOaK5+6axtpBbS+ao2ZInoAL9/YRQLhXzSNAFz7hP4nzLkIqsfYAK/PDE3+XHny0Q== + dependencies: + sparse-bitfield "^3.0.3" + "@nodelib/fs.scandir@2.1.5": version "2.1.5" resolved "https://registry.yarnpkg.com/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz#7619c2eb21b25483f6d167548b4cfd5a7488c3d5" @@ -569,6 +1160,396 @@ dependencies: "@sinonjs/commons" "^1.7.0" +"@smithy/abort-controller@^3.1.1": + version "3.1.1" + resolved "https://registry.yarnpkg.com/@smithy/abort-controller/-/abort-controller-3.1.1.tgz#291210611ff6afecfc198d0ca72d5771d8461d16" + integrity sha512-MBJBiidoe+0cTFhyxT8g+9g7CeVccLM0IOKKUMCNQ1CNMJ/eIfoo0RTfVrXOONEI1UCN1W+zkiHSbzUNE9dZtQ== + dependencies: + "@smithy/types" "^3.3.0" + tslib "^2.6.2" + +"@smithy/config-resolver@^3.0.4": + version "3.0.4" + resolved "https://registry.yarnpkg.com/@smithy/config-resolver/-/config-resolver-3.0.4.tgz#85fffa86cee4562f867b0a70a374057a48525d1b" + integrity sha512-VwiOk7TwXoE7NlNguV/aPq1hFH72tqkHCw8eWXbr2xHspRyyv9DLpLXhq+Ieje+NwoqXrY0xyQjPXdOE6cGcHA== + dependencies: + "@smithy/node-config-provider" "^3.1.3" + "@smithy/types" "^3.3.0" + "@smithy/util-config-provider" "^3.0.0" + "@smithy/util-middleware" "^3.0.3" + tslib "^2.6.2" + +"@smithy/core@^2.2.4": + version "2.2.4" + resolved "https://registry.yarnpkg.com/@smithy/core/-/core-2.2.4.tgz#a83d62fc685ff95ad3133d55d7e365a51526a436" + integrity sha512-qdY3LpMOUyLM/gfjjMQZui+UTNS7kBRDWlvyIhVOql5dn2J3isk9qUTBtQ1CbDH8MTugHis1zu3h4rH+Qmmh4g== + dependencies: + "@smithy/middleware-endpoint" "^3.0.4" + "@smithy/middleware-retry" "^3.0.7" + "@smithy/middleware-serde" "^3.0.3" + "@smithy/protocol-http" "^4.0.3" + "@smithy/smithy-client" "^3.1.5" + "@smithy/types" "^3.3.0" + "@smithy/util-middleware" "^3.0.3" + tslib "^2.6.2" + +"@smithy/credential-provider-imds@^3.1.3": + version "3.1.3" + resolved "https://registry.yarnpkg.com/@smithy/credential-provider-imds/-/credential-provider-imds-3.1.3.tgz#43e6c2d1e3df6bb6bb28bfae6b99c5a4d93bda09" + integrity sha512-U1Yrv6hx/mRK6k8AncuI6jLUx9rn0VVSd9NPEX6pyYFBfkSkChOc/n4zUb8alHUVg83TbI4OdZVo1X0Zfj3ijA== + dependencies: + "@smithy/node-config-provider" "^3.1.3" + "@smithy/property-provider" "^3.1.3" + "@smithy/types" "^3.3.0" + "@smithy/url-parser" "^3.0.3" + tslib "^2.6.2" + +"@smithy/fetch-http-handler@^3.2.0": + version "3.2.0" + resolved "https://registry.yarnpkg.com/@smithy/fetch-http-handler/-/fetch-http-handler-3.2.0.tgz#425ce7686bf20176b38f8013ed7fb28302a88929" + integrity sha512-vFvDxMrc6sO5Atec8PaISckMcAwsCrRhYxwUylg97bRT2KZoumOF7qk5+6EVUtuM1IG9AJV5aqXnHln9ZdXHpg== + dependencies: + "@smithy/protocol-http" "^4.0.3" + "@smithy/querystring-builder" "^3.0.3" + "@smithy/types" "^3.3.0" + "@smithy/util-base64" "^3.0.0" + tslib "^2.6.2" + +"@smithy/hash-node@^3.0.3": + version "3.0.3" + resolved "https://registry.yarnpkg.com/@smithy/hash-node/-/hash-node-3.0.3.tgz#82c5cb7b0f1a29ee7319081853d2d158c07dff24" + integrity sha512-2ctBXpPMG+B3BtWSGNnKELJ7SH9e4TNefJS0cd2eSkOOROeBnnVBnAy9LtJ8tY4vUEoe55N4CNPxzbWvR39iBw== + dependencies: + "@smithy/types" "^3.3.0" + "@smithy/util-buffer-from" "^3.0.0" + "@smithy/util-utf8" "^3.0.0" + tslib "^2.6.2" + +"@smithy/invalid-dependency@^3.0.3": + version "3.0.3" + resolved "https://registry.yarnpkg.com/@smithy/invalid-dependency/-/invalid-dependency-3.0.3.tgz#8d9fd70e3a94b565a4eba4ffbdc95238e1930528" + integrity sha512-ID1eL/zpDULmHJbflb864k72/SNOZCADRc9i7Exq3RUNJw6raWUSlFEQ+3PX3EYs++bTxZB2dE9mEHTQLv61tw== + dependencies: + "@smithy/types" "^3.3.0" + tslib "^2.6.2" + +"@smithy/is-array-buffer@^2.2.0": + version "2.2.0" + resolved "https://registry.yarnpkg.com/@smithy/is-array-buffer/-/is-array-buffer-2.2.0.tgz#f84f0d9f9a36601a9ca9381688bd1b726fd39111" + integrity sha512-GGP3O9QFD24uGeAXYUjwSTXARoqpZykHadOmA8G5vfJPK0/DC67qa//0qvqrJzL1xc8WQWX7/yc7fwudjPHPhA== + dependencies: + tslib "^2.6.2" + +"@smithy/is-array-buffer@^3.0.0": + version "3.0.0" + resolved "https://registry.yarnpkg.com/@smithy/is-array-buffer/-/is-array-buffer-3.0.0.tgz#9a95c2d46b8768946a9eec7f935feaddcffa5e7a" + integrity sha512-+Fsu6Q6C4RSJiy81Y8eApjEB5gVtM+oFKTffg+jSuwtvomJJrhUJBu2zS8wjXSgH/g1MKEWrzyChTBe6clb5FQ== + dependencies: + tslib "^2.6.2" + +"@smithy/middleware-content-length@^3.0.3": + version "3.0.3" + resolved "https://registry.yarnpkg.com/@smithy/middleware-content-length/-/middleware-content-length-3.0.3.tgz#426a7f907cc3c0a5d81deb84e16d38303e5a9ad8" + integrity sha512-Dbz2bzexReYIQDWMr+gZhpwBetNXzbhnEMhYKA6urqmojO14CsXjnsoPYO8UL/xxcawn8ZsuVU61ElkLSltIUQ== + dependencies: + "@smithy/protocol-http" "^4.0.3" + "@smithy/types" "^3.3.0" + tslib "^2.6.2" + +"@smithy/middleware-endpoint@^3.0.4": + version "3.0.4" + resolved "https://registry.yarnpkg.com/@smithy/middleware-endpoint/-/middleware-endpoint-3.0.4.tgz#c18518b21c80887c16fb595b156c7c009b0b64ca" + integrity sha512-whUJMEPwl3ANIbXjBXZVdJNgfV2ZU8ayln7xUM47rXL2txuenI7jQ/VFFwCzy5lCmXScjp6zYtptW5Evud8e9g== + dependencies: + "@smithy/middleware-serde" "^3.0.3" + "@smithy/node-config-provider" "^3.1.3" + "@smithy/shared-ini-file-loader" "^3.1.3" + "@smithy/types" "^3.3.0" + "@smithy/url-parser" "^3.0.3" + "@smithy/util-middleware" "^3.0.3" + tslib "^2.6.2" + +"@smithy/middleware-retry@^3.0.7": + version "3.0.7" + resolved "https://registry.yarnpkg.com/@smithy/middleware-retry/-/middleware-retry-3.0.7.tgz#b42d90b3ecc392fdfeda1eff9dc7a023ba11d34b" + integrity sha512-f5q7Y09G+2h5ivkSx5CHvlAT4qRR3jBFEsfXyQ9nFNiWQlr8c48blnu5cmbTQ+p1xmIO14UXzKoF8d7Tm0Gsjw== + dependencies: + "@smithy/node-config-provider" "^3.1.3" + "@smithy/protocol-http" "^4.0.3" + "@smithy/service-error-classification" "^3.0.3" + "@smithy/smithy-client" "^3.1.5" + "@smithy/types" "^3.3.0" + "@smithy/util-middleware" "^3.0.3" + "@smithy/util-retry" "^3.0.3" + tslib "^2.6.2" + uuid "^9.0.1" + +"@smithy/middleware-serde@^3.0.3": + version "3.0.3" + resolved "https://registry.yarnpkg.com/@smithy/middleware-serde/-/middleware-serde-3.0.3.tgz#74d974460f74d99f38c861e6862984543a880a66" + integrity sha512-puUbyJQBcg9eSErFXjKNiGILJGtiqmuuNKEYNYfUD57fUl4i9+mfmThtQhvFXU0hCVG0iEJhvQUipUf+/SsFdA== + dependencies: + "@smithy/types" "^3.3.0" + tslib "^2.6.2" + +"@smithy/middleware-stack@^3.0.3": + version "3.0.3" + resolved "https://registry.yarnpkg.com/@smithy/middleware-stack/-/middleware-stack-3.0.3.tgz#91845c7e61e6f137fa912b623b6def719a4f6ce7" + integrity sha512-r4klY9nFudB0r9UdSMaGSyjyQK5adUyPnQN/ZM6M75phTxOdnc/AhpvGD1fQUvgmqjQEBGCwpnPbDm8pH5PapA== + dependencies: + "@smithy/types" "^3.3.0" + tslib "^2.6.2" + +"@smithy/node-config-provider@^3.1.3": + version "3.1.3" + resolved "https://registry.yarnpkg.com/@smithy/node-config-provider/-/node-config-provider-3.1.3.tgz#e8e69d0df5be9d6ed3f3a84f51fd2176f09c7ab8" + integrity sha512-rxdpAZczzholz6CYZxtqDu/aKTxATD5DAUDVj7HoEulq+pDSQVWzbg0btZDlxeFfa6bb2b5tUvgdX5+k8jUqcg== + dependencies: + "@smithy/property-provider" "^3.1.3" + "@smithy/shared-ini-file-loader" "^3.1.3" + "@smithy/types" "^3.3.0" + tslib "^2.6.2" + +"@smithy/node-http-handler@^3.1.1": + version "3.1.1" + resolved "https://registry.yarnpkg.com/@smithy/node-http-handler/-/node-http-handler-3.1.1.tgz#9213d9b5139c9f9c5a1928e1574de767a979bf94" + integrity sha512-L71NLyPeP450r2J/mfu1jMc//Z1YnqJt2eSNw7uhiItaONnBLDA68J5jgxq8+MBDsYnFwNAIc7dBG1ImiWBiwg== + dependencies: + "@smithy/abort-controller" "^3.1.1" + "@smithy/protocol-http" "^4.0.3" + "@smithy/querystring-builder" "^3.0.3" + "@smithy/types" "^3.3.0" + tslib "^2.6.2" + +"@smithy/property-provider@^3.1.3": + version "3.1.3" + resolved "https://registry.yarnpkg.com/@smithy/property-provider/-/property-provider-3.1.3.tgz#afd57ea82a3f6c79fbda95e3cb85c0ee0a79f39a" + integrity sha512-zahyOVR9Q4PEoguJ/NrFP4O7SMAfYO1HLhB18M+q+Z4KFd4V2obiMnlVoUFzFLSPeVt1POyNWneHHrZaTMoc/g== + dependencies: + "@smithy/types" "^3.3.0" + tslib "^2.6.2" + +"@smithy/protocol-http@^4.0.3": + version "4.0.3" + resolved "https://registry.yarnpkg.com/@smithy/protocol-http/-/protocol-http-4.0.3.tgz#acf16058504e3cce2dbe8abf94f7b544cd09d3f4" + integrity sha512-x5jmrCWwQlx+Zv4jAtc33ijJ+vqqYN+c/ZkrnpvEe/uDas7AT7A/4Rc2CdfxgWv4WFGmEqODIrrUToPN6DDkGw== + dependencies: + "@smithy/types" "^3.3.0" + tslib "^2.6.2" + +"@smithy/querystring-builder@^3.0.3": + version "3.0.3" + resolved "https://registry.yarnpkg.com/@smithy/querystring-builder/-/querystring-builder-3.0.3.tgz#6b0e566f885bb84938d077c69e8f8555f686af13" + integrity sha512-vyWckeUeesFKzCDaRwWLUA1Xym9McaA6XpFfAK5qI9DKJ4M33ooQGqvM4J+LalH4u/Dq9nFiC8U6Qn1qi0+9zw== + dependencies: + "@smithy/types" "^3.3.0" + "@smithy/util-uri-escape" "^3.0.0" + tslib "^2.6.2" + +"@smithy/querystring-parser@^3.0.3": + version "3.0.3" + resolved "https://registry.yarnpkg.com/@smithy/querystring-parser/-/querystring-parser-3.0.3.tgz#272a6b83f88dfcbbec8283d72a6bde850cc00091" + integrity sha512-zahM1lQv2YjmznnfQsWbYojFe55l0SLG/988brlLv1i8z3dubloLF+75ATRsqPBboUXsW6I9CPGE5rQgLfY0vQ== + dependencies: + "@smithy/types" "^3.3.0" + tslib "^2.6.2" + +"@smithy/service-error-classification@^3.0.3": + version "3.0.3" + resolved "https://registry.yarnpkg.com/@smithy/service-error-classification/-/service-error-classification-3.0.3.tgz#73484255060a094aa9372f6cd972dcaf97e3ce80" + integrity sha512-Jn39sSl8cim/VlkLsUhRFq/dKDnRUFlfRkvhOJaUbLBXUsLRLNf9WaxDv/z9BjuQ3A6k/qE8af1lsqcwm7+DaQ== + dependencies: + "@smithy/types" "^3.3.0" + +"@smithy/shared-ini-file-loader@^3.1.3": + version "3.1.3" + resolved "https://registry.yarnpkg.com/@smithy/shared-ini-file-loader/-/shared-ini-file-loader-3.1.3.tgz#49a5e0e8cd98d219e7e56860586710b146d52ade" + integrity sha512-Z8Y3+08vgoDgl4HENqNnnzSISAaGrF2RoKupoC47u2wiMp+Z8P/8mDh1CL8+8ujfi2U5naNvopSBmP/BUj8b5w== + dependencies: + "@smithy/types" "^3.3.0" + tslib "^2.6.2" + +"@smithy/signature-v4@^3.1.2": + version "3.1.2" + resolved "https://registry.yarnpkg.com/@smithy/signature-v4/-/signature-v4-3.1.2.tgz#63fc0d4f9a955e902138fb0a57fafc96b9d4e8bb" + integrity sha512-3BcPylEsYtD0esM4Hoyml/+s7WP2LFhcM3J2AGdcL2vx9O60TtfpDOL72gjb4lU8NeRPeKAwR77YNyyGvMbuEA== + dependencies: + "@smithy/is-array-buffer" "^3.0.0" + "@smithy/types" "^3.3.0" + "@smithy/util-hex-encoding" "^3.0.0" + "@smithy/util-middleware" "^3.0.3" + "@smithy/util-uri-escape" "^3.0.0" + "@smithy/util-utf8" "^3.0.0" + tslib "^2.6.2" + +"@smithy/smithy-client@^3.1.5": + version "3.1.5" + resolved "https://registry.yarnpkg.com/@smithy/smithy-client/-/smithy-client-3.1.5.tgz#3956f0b511c3a51f859c45eb11bfd70ae00c5fec" + integrity sha512-x9bL9Mx2CT2P1OiUlHM+ZNpbVU6TgT32f9CmTRzqIHA7M4vYrROCWEoC3o4xHNJASoGd4Opos3cXYPgh+/m4Ww== + dependencies: + "@smithy/middleware-endpoint" "^3.0.4" + "@smithy/middleware-stack" "^3.0.3" + "@smithy/protocol-http" "^4.0.3" + "@smithy/types" "^3.3.0" + "@smithy/util-stream" "^3.0.5" + tslib "^2.6.2" + +"@smithy/types@^3.3.0": + version "3.3.0" + resolved "https://registry.yarnpkg.com/@smithy/types/-/types-3.3.0.tgz#fae037c733d09bc758946a01a3de0ef6e210b16b" + integrity sha512-IxvBBCTFDHbVoK7zIxqA1ZOdc4QfM5HM7rGleCuHi7L1wnKv5Pn69xXJQ9hgxH60ZVygH9/JG0jRgtUncE3QUA== + dependencies: + tslib "^2.6.2" + +"@smithy/url-parser@^3.0.3": + version "3.0.3" + resolved "https://registry.yarnpkg.com/@smithy/url-parser/-/url-parser-3.0.3.tgz#e8a060d9810b24b1870385fc2b02485b8a6c5955" + integrity sha512-pw3VtZtX2rg+s6HMs6/+u9+hu6oY6U7IohGhVNnjbgKy86wcIsSZwgHrFR+t67Uyxvp4Xz3p3kGXXIpTNisq8A== + dependencies: + "@smithy/querystring-parser" "^3.0.3" + "@smithy/types" "^3.3.0" + tslib "^2.6.2" + +"@smithy/util-base64@^3.0.0": + version "3.0.0" + resolved "https://registry.yarnpkg.com/@smithy/util-base64/-/util-base64-3.0.0.tgz#f7a9a82adf34e27a72d0719395713edf0e493017" + integrity sha512-Kxvoh5Qtt0CDsfajiZOCpJxgtPHXOKwmM+Zy4waD43UoEMA+qPxxa98aE/7ZhdnBFZFXMOiBR5xbcaMhLtznQQ== + dependencies: + "@smithy/util-buffer-from" "^3.0.0" + "@smithy/util-utf8" "^3.0.0" + tslib "^2.6.2" + +"@smithy/util-body-length-browser@^3.0.0": + version "3.0.0" + resolved "https://registry.yarnpkg.com/@smithy/util-body-length-browser/-/util-body-length-browser-3.0.0.tgz#86ec2f6256310b4845a2f064e2f571c1ca164ded" + integrity sha512-cbjJs2A1mLYmqmyVl80uoLTJhAcfzMOyPgjwAYusWKMdLeNtzmMz9YxNl3/jRLoxSS3wkqkf0jwNdtXWtyEBaQ== + dependencies: + tslib "^2.6.2" + +"@smithy/util-body-length-node@^3.0.0": + version "3.0.0" + resolved "https://registry.yarnpkg.com/@smithy/util-body-length-node/-/util-body-length-node-3.0.0.tgz#99a291bae40d8932166907fe981d6a1f54298a6d" + integrity sha512-Tj7pZ4bUloNUP6PzwhN7K386tmSmEET9QtQg0TgdNOnxhZvCssHji+oZTUIuzxECRfG8rdm2PMw2WCFs6eIYkA== + dependencies: + tslib "^2.6.2" + +"@smithy/util-buffer-from@^2.2.0": + version "2.2.0" + resolved "https://registry.yarnpkg.com/@smithy/util-buffer-from/-/util-buffer-from-2.2.0.tgz#6fc88585165ec73f8681d426d96de5d402021e4b" + integrity sha512-IJdWBbTcMQ6DA0gdNhh/BwrLkDR+ADW5Kr1aZmd4k3DIF6ezMV4R2NIAmT08wQJ3yUK82thHWmC/TnK/wpMMIA== + dependencies: + "@smithy/is-array-buffer" "^2.2.0" + tslib "^2.6.2" + +"@smithy/util-buffer-from@^3.0.0": + version "3.0.0" + resolved "https://registry.yarnpkg.com/@smithy/util-buffer-from/-/util-buffer-from-3.0.0.tgz#559fc1c86138a89b2edaefc1e6677780c24594e3" + integrity sha512-aEOHCgq5RWFbP+UDPvPot26EJHjOC+bRgse5A8V3FSShqd5E5UN4qc7zkwsvJPPAVsf73QwYcHN1/gt/rtLwQA== + dependencies: + "@smithy/is-array-buffer" "^3.0.0" + tslib "^2.6.2" + +"@smithy/util-config-provider@^3.0.0": + version "3.0.0" + resolved "https://registry.yarnpkg.com/@smithy/util-config-provider/-/util-config-provider-3.0.0.tgz#62c6b73b22a430e84888a8f8da4b6029dd5b8efe" + integrity sha512-pbjk4s0fwq3Di/ANL+rCvJMKM5bzAQdE5S/6RL5NXgMExFAi6UgQMPOm5yPaIWPpr+EOXKXRonJ3FoxKf4mCJQ== + dependencies: + tslib "^2.6.2" + +"@smithy/util-defaults-mode-browser@^3.0.7": + version "3.0.7" + resolved "https://registry.yarnpkg.com/@smithy/util-defaults-mode-browser/-/util-defaults-mode-browser-3.0.7.tgz#5868ae56c9ae4a3532c175f9c0ee281a41065215" + integrity sha512-Q2txLyvQyGfmjsaDbVV7Sg8psefpFcrnlGapDzXGFRPFKRBeEg6OvFK8FljqjeHSaCZ6/UuzQExUPqBR/2qlDA== + dependencies: + "@smithy/property-provider" "^3.1.3" + "@smithy/smithy-client" "^3.1.5" + "@smithy/types" "^3.3.0" + bowser "^2.11.0" + tslib "^2.6.2" + +"@smithy/util-defaults-mode-node@^3.0.7": + version "3.0.7" + resolved "https://registry.yarnpkg.com/@smithy/util-defaults-mode-node/-/util-defaults-mode-node-3.0.7.tgz#e802ca57df6b8543dc288524d3894a6c357b51fc" + integrity sha512-F4Qcj1fG6MGi2BSWCslfsMSwllws/WzYONBGtLybyY+halAcXdWhcew+mej8M5SKd5hqPYp4f7b+ABQEaeytgg== + dependencies: + "@smithy/config-resolver" "^3.0.4" + "@smithy/credential-provider-imds" "^3.1.3" + "@smithy/node-config-provider" "^3.1.3" + "@smithy/property-provider" "^3.1.3" + "@smithy/smithy-client" "^3.1.5" + "@smithy/types" "^3.3.0" + tslib "^2.6.2" + +"@smithy/util-endpoints@^2.0.4": + version "2.0.4" + resolved "https://registry.yarnpkg.com/@smithy/util-endpoints/-/util-endpoints-2.0.4.tgz#0cfb01deb42ec5cd819b54e85acb2c32e4ba4385" + integrity sha512-ZAtNf+vXAsgzgRutDDiklU09ZzZiiV/nATyqde4Um4priTmasDH+eLpp3tspL0hS2dEootyFMhu1Y6Y+tzpWBQ== + dependencies: + "@smithy/node-config-provider" "^3.1.3" + "@smithy/types" "^3.3.0" + tslib "^2.6.2" + +"@smithy/util-hex-encoding@^3.0.0": + version "3.0.0" + resolved "https://registry.yarnpkg.com/@smithy/util-hex-encoding/-/util-hex-encoding-3.0.0.tgz#32938b33d5bf2a15796cd3f178a55b4155c535e6" + integrity sha512-eFndh1WEK5YMUYvy3lPlVmYY/fZcQE1D8oSf41Id2vCeIkKJXPcYDCZD+4+xViI6b1XSd7tE+s5AmXzz5ilabQ== + dependencies: + tslib "^2.6.2" + +"@smithy/util-middleware@^3.0.3": + version "3.0.3" + resolved "https://registry.yarnpkg.com/@smithy/util-middleware/-/util-middleware-3.0.3.tgz#07bf9602682f5a6c55bc2f0384303f85fc68c87e" + integrity sha512-l+StyYYK/eO3DlVPbU+4Bi06Jjal+PFLSMmlWM1BEwyLxZ3aKkf1ROnoIakfaA7mC6uw3ny7JBkau4Yc+5zfWw== + dependencies: + "@smithy/types" "^3.3.0" + tslib "^2.6.2" + +"@smithy/util-retry@^3.0.3": + version "3.0.3" + resolved "https://registry.yarnpkg.com/@smithy/util-retry/-/util-retry-3.0.3.tgz#9b2ac0dbb1c81f69812a8affa4d772bebfc0e049" + integrity sha512-AFw+hjpbtVApzpNDhbjNG5NA3kyoMs7vx0gsgmlJF4s+yz1Zlepde7J58zpIRIsdjc+emhpAITxA88qLkPF26w== + dependencies: + "@smithy/service-error-classification" "^3.0.3" + "@smithy/types" "^3.3.0" + tslib "^2.6.2" + +"@smithy/util-stream@^3.0.5": + version "3.0.5" + resolved "https://registry.yarnpkg.com/@smithy/util-stream/-/util-stream-3.0.5.tgz#8ca98441e1deedfc4ec8d3fee9aa4342fdbc484f" + integrity sha512-xC3L5PKMAT/Bh8fmHNXP9sdQ4+4aKVUU3EEJ2CF/lLk7R+wtMJM+v/1B4en7jO++Wa5spGzFDBCl0QxgbUc5Ug== + dependencies: + "@smithy/fetch-http-handler" "^3.2.0" + "@smithy/node-http-handler" "^3.1.1" + "@smithy/types" "^3.3.0" + "@smithy/util-base64" "^3.0.0" + "@smithy/util-buffer-from" "^3.0.0" + "@smithy/util-hex-encoding" "^3.0.0" + "@smithy/util-utf8" "^3.0.0" + tslib "^2.6.2" + +"@smithy/util-uri-escape@^3.0.0": + version "3.0.0" + resolved "https://registry.yarnpkg.com/@smithy/util-uri-escape/-/util-uri-escape-3.0.0.tgz#e43358a78bf45d50bb736770077f0f09195b6f54" + integrity sha512-LqR7qYLgZTD7nWLBecUi4aqolw8Mhza9ArpNEQ881MJJIU2sE5iHCK6TdyqqzcDLy0OPe10IY4T8ctVdtynubg== + dependencies: + tslib "^2.6.2" + +"@smithy/util-utf8@^2.0.0": + version "2.3.0" + resolved "https://registry.yarnpkg.com/@smithy/util-utf8/-/util-utf8-2.3.0.tgz#dd96d7640363259924a214313c3cf16e7dd329c5" + integrity sha512-R8Rdn8Hy72KKcebgLiv8jQcQkXoLMOGGv5uI1/k0l+snqkOzQ1R0ChUBCxWMlBsFMekWjq0wRudIweFs7sKT5A== + dependencies: + "@smithy/util-buffer-from" "^2.2.0" + tslib "^2.6.2" + +"@smithy/util-utf8@^3.0.0": + version "3.0.0" + resolved "https://registry.yarnpkg.com/@smithy/util-utf8/-/util-utf8-3.0.0.tgz#1a6a823d47cbec1fd6933e5fc87df975286d9d6a" + integrity sha512-rUeT12bxFnplYDe815GXbq/oixEGHfRFFtcTF3YdDi/JaENIM6aSYYLJydG83UNzLXeRI5K8abYd/8Sp/QM0kA== + dependencies: + "@smithy/util-buffer-from" "^3.0.0" + tslib "^2.6.2" + "@tootallnate/once@1": version "1.1.2" resolved "https://registry.yarnpkg.com/@tootallnate/once/-/once-1.1.2.tgz#ccb91445360179a04e7fe6aff78c00ffc1eeaf82" @@ -1093,6 +2074,11 @@ bl@^4.0.3: inherits "^2.0.4" readable-stream "^3.4.0" +bowser@^2.11.0: + version "2.11.0" + resolved "https://registry.yarnpkg.com/bowser/-/bowser-2.11.0.tgz#5ca3c35757a7aa5771500c70a73a9f91ef420a8f" + integrity sha512-AlcaJBi/pqqJBIQ8U9Mcpc9i8Aqxn88Skv5d+xBX006BY5u8N3mGLHa5Lgppa7L/HfwgwLgZ6NYs+Ag6uUmJRA== + brace-expansion@^1.1.7: version "1.1.11" resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.11.tgz#3c7fcbf529d87226f3d2f52b966ff5271eb441dd" @@ -1102,11 +2088,11 @@ brace-expansion@^1.1.7: concat-map "0.0.1" braces@^3.0.1: - version "3.0.2" - resolved "https://registry.yarnpkg.com/braces/-/braces-3.0.2.tgz#3454e1a462ee8d599e236df336cd9ea4f8afe107" - integrity sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A== + version "3.0.3" + resolved "https://registry.yarnpkg.com/braces/-/braces-3.0.3.tgz#490332f40919452272d55a8480adc0c441358789" + integrity sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA== dependencies: - fill-range "^7.0.1" + fill-range "^7.1.1" browser-process-hrtime@^1.0.0: version "1.0.0" @@ -1143,10 +2129,10 @@ bson@^1.1.4: resolved "https://registry.yarnpkg.com/bson/-/bson-1.1.6.tgz#fb819be9a60cd677e0853aee4ca712a785d6618a" integrity sha512-EvVNVeGo4tHxwi8L6bPj3y3itEvStdwvvlojVxxbyYfoaxJ6keLgrTuKdyfEAszFK+H3olzBuafE0yoh0D1gdg== -bson@^4.6.3: - version "4.6.4" - resolved "https://registry.yarnpkg.com/bson/-/bson-4.6.4.tgz#e66d4a334f1ab230dfcfb9ec4ea9091476dd372e" - integrity sha512-TdQ3FzguAu5HKPPlr0kYQCyrYUYh8tFM+CMTpxjNzVzxeiJY00Rtuj3LXLHSgiGvmaWlZ8PE+4KyM2thqE38pQ== +bson@^4.7.2: + version "4.7.2" + resolved "https://registry.yarnpkg.com/bson/-/bson-4.7.2.tgz#320f4ad0eaf5312dd9b45dc369cc48945e2a5f2e" + integrity sha512-Ry9wCtIZ5kGqkJoi6aD8KjxFZEx78guTQDnpXWiNthsxzrxAK/i8E6pCHAIZTbaEFWcOCvbecMukfK7XUvyLpQ== dependencies: buffer "^5.6.0" @@ -1201,7 +2187,7 @@ caniuse-lite@^1.0.30001219: resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001241.tgz#cd3fae47eb3d7691692b406568d7a3e5b23c7598" integrity sha512-1uoSZ1Pq1VpH0WerIMqwptXHNNGfdl7d1cJUFs80CwQ/lVzdhTvsFZCeNFslze7AjsQnb4C85tzclPa1VShbeQ== -chalk@^2.0.0: +chalk@^2.0.0, chalk@^2.4.2: version "2.4.2" resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.4.2.tgz#cd42541677a54333cf541a49108c1432b44c9424" integrity sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ== @@ -1458,11 +2444,6 @@ denque@^1.4.1: resolved "https://registry.yarnpkg.com/denque/-/denque-1.5.0.tgz#773de0686ff2d8ec2ff92914316a47b73b1c73de" integrity sha512-CYiCSgIF1p6EUByQPlGkKnP1M9g0ZV3qMIrqMqZqdwazygIA/YP2vrbcyl1h/WppKJTdl1F85cXIle+394iDAQ== -denque@^2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/denque/-/denque-2.0.1.tgz#bcef4c1b80dc32efe97515744f21a4229ab8934a" - integrity sha512-tfiWc6BQLXNLpNiR5iGd0Ocu3P3VpxfzFiqubLgMfhfOw9WyvgJBd46CClNn9k3qfbjvT//0cf7AlYRX/OslMQ== - detect-newline@^3.0.0: version "3.1.0" resolved "https://registry.yarnpkg.com/detect-newline/-/detect-newline-3.1.0.tgz#576f5dfc63ae1a192ff192d8ad3af6308991b651" @@ -1958,6 +2939,13 @@ fast-levenshtein@^2.0.6, fast-levenshtein@~2.0.6: resolved "https://registry.yarnpkg.com/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz#3d8a5c66883a16a30ca8643e851f19baa7797917" integrity sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc= +fast-xml-parser@4.2.5: + version "4.2.5" + resolved "https://registry.yarnpkg.com/fast-xml-parser/-/fast-xml-parser-4.2.5.tgz#a6747a09296a6cb34f2ae634019bf1738f3b421f" + integrity sha512-B9/wizE4WngqQftFPmdaMYlXoJlJOYxGQOanC77fq9k8+Z0v5dDSVh+3glErdIROP//s/jgb7ZuxKfB8nVyo0g== + dependencies: + strnum "^1.0.5" + fastq@^1.6.0: version "1.11.0" resolved "https://registry.yarnpkg.com/fastq/-/fastq-1.11.0.tgz#bb9fb955a07130a918eb63c1f5161cc32a5d0858" @@ -1986,10 +2974,10 @@ file-entry-cache@^6.0.1: dependencies: flat-cache "^3.0.4" -fill-range@^7.0.1: - version "7.0.1" - resolved "https://registry.yarnpkg.com/fill-range/-/fill-range-7.0.1.tgz#1919a6a7c75fe38b2c7c77e5198535da9acdda40" - integrity sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ== +fill-range@^7.1.1: + version "7.1.1" + resolved "https://registry.yarnpkg.com/fill-range/-/fill-range-7.1.1.tgz#44265d3cac07e3ea7dc247516380643754a05292" + integrity sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg== dependencies: to-regex-range "^5.0.1" @@ -2362,10 +3350,13 @@ internal-slot@^1.0.3: has "^1.0.3" side-channel "^1.0.4" -ip@^1.1.5: - version "1.1.8" - resolved "https://registry.yarnpkg.com/ip/-/ip-1.1.8.tgz#ae05948f6b075435ed3307acce04629da8cdbf48" - integrity sha512-PuExPYUiu6qMBQb4l06ecm6T6ujzhmh+MeJcW9wa89PoAz5pvd4zPgN5WJV104mb6S2T1AwNIAaB70JNrLQWhg== +ip-address@^9.0.5: + version "9.0.5" + resolved "https://registry.yarnpkg.com/ip-address/-/ip-address-9.0.5.tgz#117a960819b08780c3bd1f14ef3c1cc1d3f3ea5a" + integrity sha512-zHtQzGojZXTwZTHQqra+ETKd4Sn3vgi7uBmlPoXVWZqYvuKmtI0l/VZTjqGmJY9x88GGOaZ9+G9ES8hC4T4X8g== + dependencies: + jsbn "1.1.0" + sprintf-js "^1.1.3" is-arrayish@^0.2.1: version "0.2.1" @@ -2968,6 +3959,11 @@ js-yaml@^3.13.1: argparse "^1.0.7" esprima "^4.0.0" +jsbn@1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/jsbn/-/jsbn-1.1.0.tgz#b01307cb29b618a1ed26ec79e911f803c4da0040" + integrity sha512-4bYVV3aAMtDTTu4+xsDYa6sy9GyJ69/amsu9sYF2zqjiEoZA5xJi3BrfX3uY+/IekIu7MwdObdbDWpoZdBv3/A== + jsdom@^16.6.0: version "16.6.0" resolved "https://registry.yarnpkg.com/jsdom/-/jsdom-16.6.0.tgz#f79b3786682065492a3da6a60a4695da983805ac" @@ -3039,9 +4035,9 @@ json5@2.x, json5@^2.1.2, json5@^2.2.0: minimist "^1.2.5" json5@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/json5/-/json5-1.0.1.tgz#779fb0018604fa854eacbf6252180d83543e3dbe" - integrity sha512-aKS4WQjPenRxiQsC93MNfjx+nbF4PAdYzmd/1JIj8HYzqfbu86beTuNgXDzPknWk0n0uARlyewZo4s++ES36Ow== + version "1.0.2" + resolved "https://registry.yarnpkg.com/json5/-/json5-1.0.2.tgz#63d98d60f21b313b77c4d6da18bfa69d80e1d593" + integrity sha512-g1MWMLBiz8FKi1e4w0UyVL3w+iJceWAFBAaBnnGKOpNa5f8TLktkbre1+s6oICydWAm+HRUGTmI+//xv2hvXYA== dependencies: minimist "^1.2.0" @@ -3242,26 +4238,26 @@ mimic-fn@^2.1.0: integrity sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg== minimatch@^3.0.0, minimatch@^3.0.4: - version "3.0.4" - resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.4.tgz#5166e286457f03306064be5497e8dbb0c3d32083" - integrity sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA== + version "3.1.2" + resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.1.2.tgz#19cd194bfd3e428f049a70817c038d89ab4be35b" + integrity sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw== dependencies: brace-expansion "^1.1.7" minimist@^1.2.0, minimist@^1.2.5: - version "1.2.5" - resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.5.tgz#67d66014b66a6a8aaa0c083c5fd58df4e4e97602" - integrity sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw== + version "1.2.8" + resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.8.tgz#c1a464e7693302e082a075cee0c057741ac4772c" + integrity sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA== mkdirp@1.x: version "1.0.4" resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-1.0.4.tgz#3eb5ed62622756d79a5f0e2a221dfebad75c2f7e" integrity sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw== -mongodb-connection-string-url@^2.5.2: - version "2.5.2" - resolved "https://registry.yarnpkg.com/mongodb-connection-string-url/-/mongodb-connection-string-url-2.5.2.tgz#f075c8d529e8d3916386018b8a396aed4f16e5ed" - integrity sha512-tWDyIG8cQlI5k3skB6ywaEA5F9f5OntrKKsT/Lteub2zgwSUlhqEN2inGgBTm8bpYJf8QYBdA/5naz65XDpczA== +mongodb-connection-string-url@^2.6.0: + version "2.6.0" + resolved "https://registry.yarnpkg.com/mongodb-connection-string-url/-/mongodb-connection-string-url-2.6.0.tgz#57901bf352372abdde812c81be47b75c6b2ec5cf" + integrity sha512-WvTZlI9ab0QYtTYnuMLgobULWhokRjtC7db9LtcVfJ+Hsnyr5eo6ZtNAt3Ly24XZScGMelOcGtm7lSn0332tPQ== dependencies: "@types/whatwg-url" "^8.2.1" whatwg-url "^11.0.0" @@ -3310,16 +4306,16 @@ mongodb@^3.6.9: saslprep "^1.0.0" mongodb@^4.5.0: - version "4.6.0" - resolved "https://registry.yarnpkg.com/mongodb/-/mongodb-4.6.0.tgz#a69216da61f4cb1498d68cb396c52313fa39cef6" - integrity sha512-1gsxVXmjFTPJ+CkMG9olE4bcVsyY8lBJN9m5B5vj+LZ7wkBqq3PO8RVmNX9GwCBOBz1KV0zM00vPviUearSv7A== + version "4.17.2" + resolved "https://registry.yarnpkg.com/mongodb/-/mongodb-4.17.2.tgz#237c0534e36a3449bd74c6bf6d32f87a1ca7200c" + integrity sha512-mLV7SEiov2LHleRJPMPrK2PMyhXFZt2UQLC4VD4pnth3jMjYKHhtqfwwkkvS/NXuo/Fp3vbhaNcXrIDaLRb9Tg== dependencies: - bson "^4.6.3" - denque "^2.0.1" - mongodb-connection-string-url "^2.5.2" - socks "^2.6.2" + bson "^4.7.2" + mongodb-connection-string-url "^2.6.0" + socks "^2.7.1" optionalDependencies: - saslprep "^1.0.3" + "@aws-sdk/credential-providers" "^3.186.0" + "@mongodb-js/saslprep" "^1.1.0" mri@^1.1.5: version "1.1.6" @@ -3654,6 +4650,11 @@ pend@~1.2.0: resolved "https://registry.yarnpkg.com/pend/-/pend-1.2.0.tgz#7a57eb550a6783f9115331fcf4663d5c8e007a50" integrity sha1-elfrVQpng/kRUzH89GY9XI4AelA= +picocolors@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/picocolors/-/picocolors-1.0.1.tgz#a8ad579b571952f0e5d25892de5445bcfe25aaa1" + integrity sha512-anP1Z8qwhkbmu7MFP5iTt+wQKXgwzf7zTyGlcdzabySa9vd0Xt392U0rVmz9poOaBj0uHJKyyo9/upk0HrEQew== + picomatch@^2.0.4, picomatch@^2.2.3: version "2.3.0" resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-2.3.0.tgz#f1f061de8f6a4bf022892e2d128234fb98302972" @@ -3803,6 +4804,11 @@ punycode@^2.1.0, punycode@^2.1.1: resolved "https://registry.yarnpkg.com/punycode/-/punycode-2.1.1.tgz#b58b010ac40c22c5657616c8d2c2c02c7bf479ec" integrity sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A== +querystringify@^2.1.1: + version "2.2.0" + resolved "https://registry.yarnpkg.com/querystringify/-/querystringify-2.2.0.tgz#3345941b4153cb9d082d8eee4cda2016a9aef7f6" + integrity sha512-FIqgj2EUvTa7R50u0rGsyTftzjYmv/a3hO345bZNrqabNqjtgiDMgmo4mkUjd+nzU5oF3dClKqFIPUKybUyqoQ== + queue-microtask@^1.2.2: version "1.2.3" resolved "https://registry.yarnpkg.com/queue-microtask/-/queue-microtask-1.2.3.tgz#4929228bbc724dfac43e0efb058caf7b6cfb6243" @@ -3904,6 +4910,11 @@ require-from-string@^2.0.2: resolved "https://registry.yarnpkg.com/require-from-string/-/require-from-string-2.0.2.tgz#89a7fdd938261267318eafe14f9c32e598c36909" integrity sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw== +requires-port@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/requires-port/-/requires-port-1.0.0.tgz#925d2601d39ac485e091cf0da5c6e694dc3dcaff" + integrity sha512-KigOCHcocU3XODJxsu8i/j8T9tzT4adHiecwORRQ0ZZFcp7ahwXuRU1m+yuO90C5ZUyGeGfocHDI14M3L3yDAQ== + reserved-words@^0.1.2: version "0.1.2" resolved "https://registry.yarnpkg.com/reserved-words/-/reserved-words-0.1.2.tgz#00a0940f98cd501aeaaac316411d9adc52b31ab1" @@ -3983,7 +4994,7 @@ safe-regex@^2.1.1: resolved "https://registry.yarnpkg.com/safer-buffer/-/safer-buffer-2.1.2.tgz#44fa161b0187b9549dd84bb91802f9bd8385cd6a" integrity sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg== -saslprep@^1.0.0, saslprep@^1.0.3: +saslprep@^1.0.0: version "1.0.3" resolved "https://registry.yarnpkg.com/saslprep/-/saslprep-1.0.3.tgz#4c02f946b56cf54297e347ba1093e7acac4cf226" integrity sha512-/MY/PEMbk2SuY5sScONwhUDsV2p77Znkb/q3nSVstq/yQzYJOH/Azh29p9oJLsl3LnQwSvZDKagDGBsBwSooag== @@ -4003,9 +5014,9 @@ semver-compare@^1.0.0: integrity sha1-De4hahyUGrN+nvsXiPavxf9VN/w= semver-regex@^3.1.2: - version "3.1.3" - resolved "https://registry.yarnpkg.com/semver-regex/-/semver-regex-3.1.3.tgz#b2bcc6f97f63269f286994e297e229b6245d0dc3" - integrity sha512-Aqi54Mk9uYTjVexLnR67rTyBusmwd04cLkHy9hNvk3+G3nT2Oyg7E0l4XVbOaNwIvQ3hHeYxGcyEy+mKreyBFQ== + version "3.1.4" + resolved "https://registry.yarnpkg.com/semver-regex/-/semver-regex-3.1.4.tgz#13053c0d4aa11d070a2f2872b6b1e3ae1e1971b4" + integrity sha512-6IiqeZNgq01qGf0TId0t3NvKzSvUsjcpdEO3AQNeIjR6A2+ckTnQlDpl4qu1bjRv0RzN3FP9hzFmws3lKqRWkA== "semver@2 || 3 || 4 || 5": version "5.7.1" @@ -4020,9 +5031,9 @@ semver@7.x, semver@^7.2.1, semver@^7.3.2, semver@^7.3.5: lru-cache "^6.0.0" semver@^6.0.0, semver@^6.1.0, semver@^6.3.0: - version "6.3.0" - resolved "https://registry.yarnpkg.com/semver/-/semver-6.3.0.tgz#ee0a64c8af5e8ceea67687b133761e1becbd1d3d" - integrity sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw== + version "6.3.1" + resolved "https://registry.yarnpkg.com/semver/-/semver-6.3.1.tgz#556d2ef8689146e46dcea4bfdd095f3434dffcb4" + integrity sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA== semver@^7.3.7: version "7.3.7" @@ -4090,12 +5101,12 @@ smart-buffer@^4.2.0: resolved "https://registry.yarnpkg.com/smart-buffer/-/smart-buffer-4.2.0.tgz#6e1d71fa4f18c05f7d0ff216dd16a481d0e8d9ae" integrity sha512-94hK0Hh8rPqQl2xXc3HsaBoOXKV20MToPkcXvwbISWLEs+64sBq5kFgn2kJDHb1Pry9yrP0dxrCI9RRci7RXKg== -socks@^2.6.2: - version "2.6.2" - resolved "https://registry.yarnpkg.com/socks/-/socks-2.6.2.tgz#ec042d7960073d40d94268ff3bb727dc685f111a" - integrity sha512-zDZhHhZRY9PxRruRMR7kMhnf3I8hDs4S3f9RecfnGxvcBHQcKcIH/oUcEWffsfl1XxdYlA7nnlGbbTvPz9D8gA== +socks@^2.7.1: + version "2.8.3" + resolved "https://registry.yarnpkg.com/socks/-/socks-2.8.3.tgz#1ebd0f09c52ba95a09750afe3f3f9f724a800cb5" + integrity sha512-l5x7VUUWbjVFbafGLxPWkYsHIhEvmF85tbIeFZWc8ZPtoMyybuEhL7Jye/ooC4/d48FgOjSJXgsF/AJPYCW8Zw== dependencies: - ip "^1.1.5" + ip-address "^9.0.5" smart-buffer "^4.2.0" source-map-support@^0.5.17, source-map-support@^0.5.6: @@ -4154,6 +5165,11 @@ spdx-license-ids@^3.0.0: resolved "https://registry.yarnpkg.com/spdx-license-ids/-/spdx-license-ids-3.0.9.tgz#8a595135def9592bda69709474f1cbeea7c2467f" integrity sha512-Ki212dKK4ogX+xDo4CtOZBVIwhsKBEfsEEcwmJfLQzirgc2jIWdzg40Unxz/HzEUqM1WFzVlQSMF9kZZ2HboLQ== +sprintf-js@^1.1.3: + version "1.1.3" + resolved "https://registry.yarnpkg.com/sprintf-js/-/sprintf-js-1.1.3.tgz#4914b903a2f8b685d17fdf78a70e917e872e444a" + integrity sha512-Oo+0REFV59/rz3gfJNKQiBlwfHaSESl1pcGyABQsnnIfWOFt6JNj5gCog2U6MLZ//IGYD+nA8nI+mTShREReaA== + sprintf-js@~1.0.2: version "1.0.3" resolved "https://registry.yarnpkg.com/sprintf-js/-/sprintf-js-1.0.3.tgz#04e6926f662895354f3dd015203633b857297e2c" @@ -4254,6 +5270,11 @@ strip-json-comments@^3.1.0, strip-json-comments@^3.1.1: resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-3.1.1.tgz#31f1281b3832630434831c310c01cccda8cbe006" integrity sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig== +strnum@^1.0.5: + version "1.0.5" + resolved "https://registry.yarnpkg.com/strnum/-/strnum-1.0.5.tgz#5c4e829fe15ad4ff0d20c3db5ac97b73c9b072db" + integrity sha512-J8bbNyKKXl5qYcR36TIO8W3mVGVHrmmxsd5PAItGkmyzwJvybiw2IVq5nqd0i4LSNSkB/sx9VHllbfFdr9k1JA== + supports-color@^5.3.0: version "5.5.0" resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-5.5.0.tgz#e2e69a44ac8772f78a1ec0b35b689df6530efc8f" @@ -4363,13 +5384,14 @@ to-regex-range@^5.0.1: is-number "^7.0.0" tough-cookie@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/tough-cookie/-/tough-cookie-4.0.0.tgz#d822234eeca882f991f0f908824ad2622ddbece4" - integrity sha512-tHdtEpQCMrc1YLrMaqXXcj6AxhYi/xgit6mZu1+EDWUn+qhUf8wMQoFIy9NXuq23zAwtcB0t/MjACGR18pcRbg== + version "4.1.4" + resolved "https://registry.yarnpkg.com/tough-cookie/-/tough-cookie-4.1.4.tgz#945f1461b45b5a8c76821c33ea49c3ac192c1b36" + integrity sha512-Loo5UUvLD9ScZ6jh8beX1T6sO1w2/MpCRpEP7V280GKMVUQ0Jzar2U3UJPsrdbziLEMMhu3Ujnq//rhiFuIeag== dependencies: psl "^1.1.33" punycode "^2.1.1" - universalify "^0.1.2" + universalify "^0.2.0" + url-parse "^1.5.3" tr46@^2.1.0: version "2.1.0" @@ -4442,6 +5464,11 @@ tslib@^2.4.0: resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.4.0.tgz#7cecaa7f073ce680a05847aa77be941098f36dc3" integrity sha512-d6xOpEDfsi2CZVlPQzGeux8XMwLT9hssAsaPYExaQMuYskwb+x1x7J371tWlbBdWHroy99KnVB6qIkUbs5X3UQ== +tslib@^2.6.2: + version "2.6.3" + resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.6.3.tgz#0438f810ad7a9edcde7a241c3d80db693c8cbfe0" + integrity sha512-xNvxJEOUiWPGhUuUdQgAJPKOOJfGnIyKySOc09XkKsgdUV/3E2zvwZYdejjmRgPCgcym1juLH3226yA7sEFJKQ== + tsutils@^3.21.0: version "3.21.0" resolved "https://registry.yarnpkg.com/tsutils/-/tsutils-3.21.0.tgz#b48717d394cea6c1e096983eed58e9d61715b623" @@ -4449,6 +5476,11 @@ tsutils@^3.21.0: dependencies: tslib "^1.8.1" +tunnel@^0.0.6: + version "0.0.6" + resolved "https://registry.yarnpkg.com/tunnel/-/tunnel-0.0.6.tgz#72f1314b34a5b192db012324df2cc587ca47f92c" + integrity sha512-1h/Lnq9yajKY2PEbBadPXj3VxsDDu844OnaAo52UVmIzIvwwtBPIuNvkjuzBlTWpfJyUbG3ez0KSBibQkj4ojg== + type-check@^0.4.0, type-check@~0.4.0: version "0.4.0" resolved "https://registry.yarnpkg.com/type-check/-/type-check-0.4.0.tgz#07b8203bfa7056c0657050e3ccd2c37730bab8f1" @@ -4535,10 +5567,17 @@ unbox-primitive@^1.0.1: has-symbols "^1.0.2" which-boxed-primitive "^1.0.2" -universalify@^0.1.2: - version "0.1.2" - resolved "https://registry.yarnpkg.com/universalify/-/universalify-0.1.2.tgz#b646f69be3942dabcecc9d6639c80dc105efaa66" - integrity sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg== +undici@^5.25.4: + version "5.28.4" + resolved "https://registry.yarnpkg.com/undici/-/undici-5.28.4.tgz#6b280408edb6a1a604a9b20340f45b422e373068" + integrity sha512-72RFADWFqKmUb2hmmvNODKL3p9hcB6Gt2DOQMis1SEBaV6a4MH8soBvzg+95CYhCKPFedut2JY9bMfrDl9D23g== + dependencies: + "@fastify/busboy" "^2.0.0" + +universalify@^0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/universalify/-/universalify-0.2.0.tgz#6451760566fa857534745ab1dde952d1b1761be0" + integrity sha512-CJ1QgKmNg3CwvAv/kOFmtnEN05f0D/cn9QntgNOQlQF9dgvVTHj3t+8JPdjqawCHk7V/KA+fbUqzZ9XWhcqPUg== uri-js@^4.2.2: version "4.4.1" @@ -4547,16 +5586,29 @@ uri-js@^4.2.2: dependencies: punycode "^2.1.0" +url-parse@^1.5.3: + version "1.5.10" + resolved "https://registry.yarnpkg.com/url-parse/-/url-parse-1.5.10.tgz#9d3c2f736c1d75dd3bd2be507dcc111f1e2ea9c1" + integrity sha512-WypcfiRhfeUP9vvF0j6rw0J3hrWrw6iZv3+22h6iRMJ/8z1Tj6XfLP4DsUix5MhMPnXpiHDoKyoZ/bdCkwBCiQ== + dependencies: + querystringify "^2.1.1" + requires-port "^1.0.0" + util-deprecate@^1.0.1, util-deprecate@~1.0.1: version "1.0.2" resolved "https://registry.yarnpkg.com/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf" integrity sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8= -uuid@^8.3.1: +uuid@^8.3.1, uuid@^8.3.2: version "8.3.2" resolved "https://registry.yarnpkg.com/uuid/-/uuid-8.3.2.tgz#80d5b5ced271bb9af6c445f21a1a04c606cefbe2" integrity sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg== +uuid@^9.0.1: + version "9.0.1" + resolved "https://registry.yarnpkg.com/uuid/-/uuid-9.0.1.tgz#e188d4c8853cc722220392c424cd637f32293f30" + integrity sha512-b+1eJOlsR9K8HJpow9Ok3fiWOWSIcIzXodvv0rQjVoOVNpWMpxf1wZNpt4y9h10odCNrqnYp1OBzRktckBe3sA== + v8-compile-cache@^2.0.3: version "2.3.0" resolved "https://registry.yarnpkg.com/v8-compile-cache/-/v8-compile-cache-2.3.0.tgz#2de19618c66dc247dcfb6f99338035d8245a2cee" @@ -4673,9 +5725,9 @@ which@^2.0.1: isexe "^2.0.0" word-wrap@^1.2.3, word-wrap@~1.2.3: - version "1.2.3" - resolved "https://registry.yarnpkg.com/word-wrap/-/word-wrap-1.2.3.tgz#610636f6b1f703891bd34771ccb17fb93b47079c" - integrity sha512-Hz/mrNwitNRh/HUAtM/VT/5VH+ygD6DV7mYKZAtHOrbs8U7lvPS6xf7EJKMF0uW1KJCl0H701g3ZGus+muE5vQ== + version "1.2.5" + resolved "https://registry.yarnpkg.com/word-wrap/-/word-wrap-1.2.5.tgz#d2c45c6dd4fbce621a66f136cbe328afd0410b34" + integrity sha512-BN22B5eaMMI9UMtjrGd5g5eCYPpCPDUy0FJXbYsaT5zYxjFOckS53SQDE3pWkVoWpHXVb3BrYcEN4Twa55B5cA== wordwrap@^1.0.0: version "1.0.0" @@ -4707,9 +5759,9 @@ write-file-atomic@^3.0.0: typedarray-to-buffer "^3.1.5" ws@^7.4.5: - version "7.5.1" - resolved "https://registry.yarnpkg.com/ws/-/ws-7.5.1.tgz#44fc000d87edb1d9c53e51fbc69a0ac1f6871d66" - integrity sha512-2c6faOUH/nhoQN6abwMloF7Iyl0ZS2E9HGtsiLrWn0zOOMWlhtDmdf/uihDt6jnuCxgtwGBNy6Onsoy2s2O2Ow== + version "7.5.10" + resolved "https://registry.yarnpkg.com/ws/-/ws-7.5.10.tgz#58b5c20dc281633f6c19113f39b349bd8bd558d9" + integrity sha512-+dbF1tHwZpXcbOJdVOkzLDxZP1ailvSxM6ZweXTegylPny803bFhA+vqBYw4s31NSAk4S2Qz+AKXK9a4wkdjcQ== xml-name-validator@^3.0.0: version "3.0.0"