@mongodb-js/compass-web 0.30.0 → 0.30.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/376.mjs DELETED
@@ -1,2 +0,0 @@
1
- /*! For license information please see 376.mjs.LICENSE.txt */
2
- export const __webpack_esm_id__=376;export const __webpack_esm_ids__=[376];export const __webpack_esm_modules__={145:(e,t,n)=>{var r=n(67787).Buffer,i=n(65994).e;Object.defineProperty(t,"__esModule",{value:!0}),t.kDispose=t.randomBytes=t.COSMOS_DB_MSG=t.DOCUMENT_DB_MSG=t.COSMOS_DB_CHECK=t.DOCUMENT_DB_CHECK=t.MONGODB_WARNING_CODE=t.DEFAULT_PK_FACTORY=t.HostAddress=t.BufferPool=t.List=t.MongoDBCollectionNamespace=t.MongoDBNamespace=t.ByteUtils=void 0,t.isUint8Array=function(e){return null!=e&&"object"==typeof e&&Symbol.toStringTag in e&&"Uint8Array"===e[Symbol.toStringTag]},t.hostMatchesWildcards=function(e,t){for(const n of t)if(e===n||n.startsWith("*.")&&e?.endsWith(n.substring(2,n.length))||n.startsWith("*/")&&e?.endsWith(n.substring(2,n.length)))return!0;return!1},t.normalizeHintField=function(e){let t;if("string"==typeof e)t=e;else if(Array.isArray(e))t={},e.forEach((e=>{t[e]=1}));else if(null!=e&&"object"==typeof e){t={};for(const n in e)t[n]=e[n]}return t},t.isObject=S,t.mergeOptions=function(e,t){return{...e,...t}},t.filterOptions=function(e,t){const n={};for(const r in e)t.includes(r)&&(n[r]=e[r]);return n},t.applyRetryableWrites=function(e,t){return t&&t.s.options?.retryWrites&&(e.retryWrites=!0),e},t.isPromiseLike=function(e){return null!=e&&"object"==typeof e&&"then"in e&&"function"==typeof e.then},t.decorateWithCollation=function(e,t,n){const r=w(t).capabilities;if(n.collation&&"object"==typeof n.collation){if(!r||!r.commandsTakeCollation)throw new m.MongoCompatibilityError("Current topology does not support collation");e.collation=n.collation}},t.decorateWithReadConcern=function(e,t,n){if(n&&n.session&&n.session.inTransaction())return;const r=Object.assign({},e.readConcern||{});t.s.readConcern&&Object.assign(r,t.s.readConcern),Object.keys(r).length>0&&Object.assign(e,{readConcern:r})},t.getTopology=w,t.ns=function(e){return C.fromString(e)},t.makeCounter=function*(e=0){let t=e;for(;;){const e=t;t+=1,yield e}},t.uuidV4=function(){const e=o.randomBytes(16);return e[6]=15&e[6]|64,e[8]=63&e[8]|128,e},t.maxWireVersion=function(e){if(e){if(e.loadBalanced||e.serverApi?.version)return f.MAX_SUPPORTED_WIRE_VERSION;if(e.hello)return e.hello.maxWireVersion;if("lastHello"in e&&"function"==typeof e.lastHello){const t=e.lastHello();if(t)return t.maxWireVersion}if(e.description&&"maxWireVersion"in e.description&&null!=e.description.maxWireVersion)return e.description.maxWireVersion}return 0},t.arrayStrictEqual=function(e,t){return!(!Array.isArray(e)||!Array.isArray(t))&&(e.length===t.length&&e.every(((e,n)=>e===t[n])))},t.errorStrictEqual=function(e,t){return e===t||(e&&t?!(null==e&&null!=t||null!=e&&null==t)&&(e.constructor.name===t.constructor.name&&e.message===t.message):e===t)},t.makeStateMachine=function(e){return function(t,n){const r=e[t.s.state];if(r&&r.indexOf(n)<0)throw new m.MongoRuntimeError(`illegal state transition from [${t.s.state}] => [${n}], allowed: [${r}]`);t.emit("stateChanged",t.s.state,n),t.s.state=n}},t.now=b,t.calculateDurationInMs=function(e){if("number"!=typeof e)return-1;const t=b()-e;return t<0?0:t},t.hasAtomicOperators=function e(t,n){if(Array.isArray(t)){for(const n of t)if(e(n))return!0;return!1}const r=Object.keys(t);if(n?.ignoreUndefined){let e=!0;for(const n of r)if(void 0!==t[n]){e=!1;break}if(e)throw new m.MongoInvalidArgumentError("Update operations require that all atomic operators have defined values, but none were provided.")}return r.length>0&&"$"===r[0][0]},t.resolveTimeoutOptions=function(e,t){const{socketTimeoutMS:n,serverSelectionTimeoutMS:r,waitQueueTimeoutMS:i,timeoutMS:o}=e.s.options;return{socketTimeoutMS:n,serverSelectionTimeoutMS:r,waitQueueTimeoutMS:i,timeoutMS:o,...t}},t.resolveOptions=function(e,t){const n=Object.assign({},t,(0,d.resolveBSONOptions)(t,e)),r=t?.timeoutMS??e?.timeoutMS,i=t?.session;if(!i?.inTransaction()){const i=g.ReadConcern.fromOptions(t)??e?.readConcern;i&&(n.readConcern=i);let o=v.WriteConcern.fromOptions(t)??e?.writeConcern;o&&(null!=r&&(o=v.WriteConcern.fromOptions({writeConcern:{...o,wtimeout:void 0,wtimeoutMS:void 0}})),n.writeConcern=o)}n.timeoutMS=r;const o=_.ReadPreference.fromOptions(t)??e?.readPreference;if(o&&(n.readPreference=o),i?.explicit&&null!=i?.timeoutContext&&null!=t?.timeoutMS)throw new m.MongoInvalidArgumentError("An operation cannot be given a timeoutMS setting when inside a withTransaction call that has a timeoutMS setting");return n},t.isSuperset=M,t.isHello=function(e){return!(!e[p.LEGACY_HELLO_COMMAND]&&!e.hello)},t.setDifference=function(e,t){const n=new Set(e);for(const e of t)n.delete(e);return n},t.isRecord=function(e,t=void 0){if(!S(e))return!1;const n=e.constructor;if(n&&n.prototype){if(!S(n.prototype))return!1;if(!T(n.prototype,"isPrototypeOf"))return!1}return!t||M(Object.keys(e),t)},t.emitWarning=N,t.emitWarningOnce=function(e){if(!I.has(e))return I.add(e),N(e)},t.enumToString=function(e){return Object.values(e).join(", ")},t.supportsRetryableWrites=function(e){return!!e&&(!!e.loadBalanced||null!=e.description.logicalSessionTimeoutMinutes&&e.description.type!==y.ServerType.Standalone)},t.shuffle=function(e,t=0){const n=Array.from(e);if(t>n.length)throw new m.MongoRuntimeError("Limit must be less than the number of items");let r=n.length;const i=t%n.length==0?1:n.length-t;for(;r>i;){const e=Math.floor(Math.random()*r);r-=1;const t=n[r];n[r]=n[e],n[e]=t}return t%n.length==0?n:n.slice(i)},t.commandSupportsReadConcern=function(e){return!!(e.aggregate||e.count||e.distinct||e.find||e.geoNear)},t.compareObjectId=function(e,n){return null==e&&null==n?0:null==e?-1:null==n?1:t.ByteUtils.compare(e.id,n.id)},t.parseInteger=x,t.parseUnsignedInteger=function(e){const t=x(e);return null!=t&&t>=0?t:null},t.checkParentDomainMatch=function(e,t){const n=e.endsWith(".")?e.slice(0,e.length-1):e,r=t.endsWith(".")?t.slice(0,t.length-1):t,i=/^.*?\./,o=r.split(".").length<3,s=`.${n.replace(i,"")}`;let a=o?r:`.${r.replace(i,"")}`;if(a.startsWith(".")||(a="."+a),o&&n.split(".").length<=r.split(".").length)throw new m.MongoAPIError("Server record does not have at least one more domain level than parent URI");if(!s.endsWith(a))throw new m.MongoAPIError("Server record does not share hostname with parent URI")},t.get=function(e,t={}){return new Promise(((n,r)=>{let i;const o=a.get(e,t,(e=>{e.setEncoding("utf8");let t="";e.on("data",(e=>t+=e)),e.on("end",(()=>{(0,u.clearTimeout)(i),n({status:e.statusCode,body:t})}))})).on("error",(e=>{(0,u.clearTimeout)(i),r(e)})).end();i=(0,u.setTimeout)((()=>{o.destroy(new m.MongoNetworkTimeoutError("request timed out after 10 seconds"))}),1e4)}))},t.request=async function(e,t={}){return await new Promise(((n,r)=>{const i={method:"GET",timeout:1e4,json:!0,...c.parse(e),...t},o=a.request(i,(e=>{e.setEncoding("utf8");let i="";e.on("data",(e=>{i+=e})),e.once("end",(()=>{if(!1!==t.json)try{const e=JSON.parse(i);n(e)}catch{r(new m.MongoRuntimeError(`Invalid JSON response: "${i}"`))}else n(i)}))}));o.once("timeout",(()=>o.destroy(new m.MongoNetworkTimeoutError(`Network request to ${e} timed out after ${t.timeout} ms`)))),o.once("error",(e=>r(e))),o.end()}))},t.isHostMatch=function(e,t){return!(!t||!e.test(t.toLowerCase()))},t.promiseWithResolvers=k,t.squashError=function(e){},t.once=async function(e,n,r){r?.signal?.throwIfAborted();const{promise:i,resolve:o,reject:s}=k(),a=e=>o(e),u=e=>s(e),c=P(r?.signal,(function(){s(this.reason)}));e.once(n,a).once("error",u);try{return await i}finally{e.off(n,a),e.off("error",u),c?.[t.kDispose]()}},t.maybeAddIdToDocuments=function(e,t,n){return(n.forceServerObjectId??e.s.db.options?.forceServerObjectId)||null==t._id&&(t._id=e.s.pkFactory.createPk()),t},t.fileIsAccessible=async function(e,t){try{return await s.promises.access(e,t),!0}catch{return!1}},t.csotMin=function(e,t){return 0===e?t:0===t?e:Math.min(e,t)},t.noop=function(){},t.decorateDecryptionResult=function e(t,n,i=!0){if(i&&(r.isBuffer(n)&&(n=(0,d.deserialize)(n)),r.isBuffer(t)))throw new m.MongoRuntimeError("Expected result of decryption to be deserialized BSON object");if(t&&"object"==typeof t)for(const r of Object.keys(t)){const i=n[r];i&&"Binary"===i._bsontype&&6===i.sub_type?(t[p.kDecoratedKeys]||Object.defineProperty(t,p.kDecoratedKeys,{value:[],configurable:!0,enumerable:!1,writable:!1}),t[p.kDecoratedKeys].push(r)):e(t[r],i,!1)}},t.addAbortListener=P,t.abortable=async function(e,{signal:n}){if(null==n)return await e;const{promise:r,reject:i}=k(),o=n.aborted?i(n.reason):P(n,(function(){i(this.reason)}));try{return await Promise.race([e,r])}finally{o?.[t.kDispose]()}};const o=n(27348),s=n(36374),a=n(7742),u=n(37668),c=n(9606),l=n(9606),h=n(98437),d=n(75080),f=n(96856),p=n(91869),m=n(17562),g=n(28541),_=n(13700),y=n(89167),v=n(40012);t.ByteUtils={toLocalBufferType:e=>r.isBuffer(e)?e:r.from(e.buffer,e.byteOffset,e.byteLength),equals:(e,n)=>t.ByteUtils.toLocalBufferType(e).equals(n),compare:(e,n)=>t.ByteUtils.toLocalBufferType(e).compare(n),toBase64:e=>t.ByteUtils.toLocalBufferType(e).toString("base64")};const E=e=>Object.prototype.toString.call(e);function S(e){return"[object Object]"===E(e)}function w(e){if("topology"in e&&e.topology)return e.topology;if("client"in e&&e.client.topology)return e.client.topology;throw new m.MongoNotConnectedError("MongoClient must be connected to perform this operation")}class C{constructor(e,t){this.db=e,this.collection=""===t?void 0:t}toString(){return this.collection?`${this.db}.${this.collection}`:this.db}withCollection(e){return new O(this.db,e)}static fromString(e){if("string"!=typeof e||""===e)throw new m.MongoRuntimeError(`Cannot parse namespace from "${e}"`);const[t,...n]=e.split("."),r=n.join(".");return new C(t,""===r?void 0:r)}}t.MongoDBNamespace=C;class O extends C{constructor(e,t){super(e,t),this.collection=t}static fromString(e){return super.fromString(e)}}function b(){const e=i.hrtime();return Math.floor(1e3*e[0]+e[1]/1e6)}function M(e,t){e=Array.isArray(e)?new Set(e):e,t=Array.isArray(t)?new Set(t):t;for(const n of t)if(!e.has(n))return!1;return!0}t.MongoDBCollectionNamespace=O;const T=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);class A{get length(){return this.count}get[Symbol.toStringTag](){return"List"}constructor(){this.count=0,this.head={next:null,prev:null,value:null},this.head.next=this.head,this.head.prev=this.head}toArray(){return Array.from(this)}toString(){return`head <=> ${this.toArray().join(" <=> ")} <=> head`}*[Symbol.iterator](){for(const e of this.nodes())yield e.value}*nodes(){let e=this.head.next;for(;e!==this.head;){const{next:t}=e;yield e,e=t}}push(e){this.count+=1;const t={next:this.head,prev:this.head.prev,value:e};this.head.prev.next=t,this.head.prev=t}pushMany(e){for(const t of e)this.push(t)}unshift(e){this.count+=1;const t={next:this.head.next,prev:this.head,value:e};this.head.next.prev=t,this.head.next=t}remove(e){if(e===this.head||0===this.length)return null;this.count-=1;const t=e.prev,n=e.next;return t.next=n,n.prev=t,e.value}shift(){return this.remove(this.head.next)}pop(){return this.remove(this.head.prev)}prune(e){for(const t of this.nodes())e(t.value)&&this.remove(t)}clear(){this.count=0,this.head.next=this.head,this.head.prev=this.head}first(){return this.head.next.value}last(){return this.head.prev.value}}t.List=A,t.BufferPool=class{constructor(){this.buffers=new A,this.totalByteLength=0}get length(){return this.totalByteLength}append(e){this.buffers.push(e),this.totalByteLength+=e.length}getInt32(){if(this.totalByteLength<4)return null;const e=this.buffers.first();if(null!=e&&e.byteLength>=4)return e.readInt32LE(0);const t=this.read(4),n=t.readInt32LE(0);return this.totalByteLength+=4,this.buffers.unshift(t),n}read(e){if("number"!=typeof e||e<0)throw new m.MongoInvalidArgumentError('Argument "size" must be a non-negative number');if(e>this.totalByteLength)return r.alloc(0);const t=r.allocUnsafe(e);for(let n=0;n<e;){const r=this.buffers.shift();if(null==r)break;const i=e-n,o=Math.min(i,r.byteLength),s=r.subarray(0,o);t.set(s,n),n+=o,this.totalByteLength-=o,o<r.byteLength&&this.buffers.unshift(r.subarray(o))}return t}};class R{constructor(e){this.host=void 0,this.port=void 0,this.socketPath=void 0,this.isIPv6=!1;const t=e.split(" ").join("%20");if(t.endsWith(".sock"))return void(this.socketPath=decodeURIComponent(t));const n=`iLoveJS://${t}`;let r;try{r=new l.URL(n)}catch(e){const n=new m.MongoRuntimeError(`Unable to parse ${t} with URL`);throw n.cause=e,n}const i=r.hostname,o=r.port;let s=decodeURIComponent(i).toLowerCase();if(s.startsWith("[")&&s.endsWith("]")&&(this.isIPv6=!0,s=s.substring(1,i.length-1)),this.host=s.toLowerCase(),this.port="number"==typeof o?o:"string"==typeof o&&""!==o?Number.parseInt(o,10):27017,0===this.port)throw new m.MongoParseError("Invalid port (zero) with hostname");Object.freeze(this)}[Symbol.for("nodejs.util.inspect.custom")](){return this.inspect()}inspect(){return`new HostAddress('${this.toString()}')`}toString(){return"string"==typeof this.host?this.isIPv6?`[${this.host}]:${this.port}`:`${this.host}:${this.port}`:`${this.socketPath}`}static fromString(e){return new R(e)}static fromHostPort(e,t){return e.includes(":")&&(e=`[${e}]`),R.fromString(`${e}:${t}`)}static fromSrvRecord({name:e,port:t}){return R.fromHostPort(e,t)}toHostPort(){return this.socketPath?{host:this.socketPath,port:0}:{host:this.host??"",port:this.port??0}}}function N(e){return i.emitWarning(e,{code:t.MONGODB_WARNING_CODE})}t.HostAddress=R,t.DEFAULT_PK_FACTORY={createPk:()=>new d.ObjectId},t.MONGODB_WARNING_CODE="MONGODB DRIVER";const I=new Set;function x(e){if("number"==typeof e)return Math.trunc(e);const t=Number.parseInt(String(e),10);return Number.isNaN(t)?null:t}function k(){let e,t;return{promise:new Promise((function(n,r){e=n,t=r})),resolve:e,reject:t}}function P(e,n){if(null!=e)return e.addEventListener("abort",n,{once:!0}),{[t.kDispose]:()=>e.removeEventListener("abort",n)}}t.DOCUMENT_DB_CHECK=/(\.docdb\.amazonaws\.com$)|(\.docdb-elastic\.amazonaws\.com$)/,t.COSMOS_DB_CHECK=/\.cosmos\.azure\.com$/,t.DOCUMENT_DB_MSG="You appear to be connected to a DocumentDB cluster. For more information regarding feature compatibility and support please visit https://www.mongodb.com/supportability/documentdb",t.COSMOS_DB_MSG="You appear to be connected to a CosmosDB cluster. For more information regarding feature compatibility and support please visit https://www.mongodb.com/supportability/cosmosdb",t.randomBytes=(0,h.promisify)(o.randomBytes),t.kDispose=Symbol.dispose??Symbol("dispose")},287:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ConnectionPoolClearedEvent=t.ConnectionCheckedInEvent=t.ConnectionCheckedOutEvent=t.ConnectionCheckOutFailedEvent=t.ConnectionCheckOutStartedEvent=t.ConnectionClosedEvent=t.ConnectionReadyEvent=t.ConnectionCreatedEvent=t.ConnectionPoolClosedEvent=t.ConnectionPoolReadyEvent=t.ConnectionPoolCreatedEvent=t.ConnectionPoolMonitoringEvent=void 0;const r=n(91869),i=n(145);class o{constructor(e){this.time=new Date,this.address=e.address}}t.ConnectionPoolMonitoringEvent=o,t.ConnectionPoolCreatedEvent=class extends o{constructor(e){super(e),this.name=r.CONNECTION_POOL_CREATED;const{maxConnecting:t,maxPoolSize:n,minPoolSize:i,maxIdleTimeMS:o,waitQueueTimeoutMS:s}=e.options;this.options={maxConnecting:t,maxPoolSize:n,minPoolSize:i,maxIdleTimeMS:o,waitQueueTimeoutMS:s}}},t.ConnectionPoolReadyEvent=class extends o{constructor(e){super(e),this.name=r.CONNECTION_POOL_READY}},t.ConnectionPoolClosedEvent=class extends o{constructor(e){super(e),this.name=r.CONNECTION_POOL_CLOSED}},t.ConnectionCreatedEvent=class extends o{constructor(e,t){super(e),this.name=r.CONNECTION_CREATED,this.connectionId=t.id}},t.ConnectionReadyEvent=class extends o{constructor(e,t,n){super(e),this.name=r.CONNECTION_READY,this.durationMS=(0,i.now)()-n,this.connectionId=t.id}},t.ConnectionClosedEvent=class extends o{constructor(e,t,n,i){super(e),this.name=r.CONNECTION_CLOSED,this.connectionId=t.id,this.reason=n,this.serviceId=t.serviceId,this.error=i??null}},t.ConnectionCheckOutStartedEvent=class extends o{constructor(e){super(e),this.name=r.CONNECTION_CHECK_OUT_STARTED}},t.ConnectionCheckOutFailedEvent=class extends o{constructor(e,t,n,o){super(e),this.name=r.CONNECTION_CHECK_OUT_FAILED,this.durationMS=(0,i.now)()-n,this.reason=t,this.error=o}},t.ConnectionCheckedOutEvent=class extends o{constructor(e,t,n){super(e),this.name=r.CONNECTION_CHECKED_OUT,this.durationMS=(0,i.now)()-n,this.connectionId=t.id}},t.ConnectionCheckedInEvent=class extends o{constructor(e,t){super(e),this.name=r.CONNECTION_CHECKED_IN,this.connectionId=t.id}},t.ConnectionPoolClearedEvent=class extends o{constructor(e,t={}){super(e),this.name=r.CONNECTION_POOL_CLEARED,this.serviceId=t.serviceId,this.interruptInUseConnections=t.interruptInUseConnections}}},815:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.DistinctOperation=void 0;const r=n(75725),i=n(78130),o=n(35394);class s extends i.CommandOperation{constructor(e,t,n,i){super(e,i),this.SERVER_COMMAND_RESPONSE_TYPE=r.MongoDBResponse,this.options=i??{},this.collection=e,this.key=t,this.query=n}get commandName(){return"distinct"}buildCommandDocument(e){const t={distinct:this.collection.collectionName,key:this.key,query:this.query};return void 0!==this.options.comment&&(t.comment=this.options.comment),null!=this.options.hint&&(t.hint=this.options.hint),t}handleOk(e){return this.explain?e.toObject(this.bsonOptions):e.toObject(this.bsonOptions).values}}t.DistinctOperation=s,(0,o.defineAspects)(s,[o.Aspect.READ_OPERATION,o.Aspect.RETRYABLE,o.Aspect.EXPLAINABLE])},1755:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.KillCursorsOperation=void 0;const r=n(75725),i=n(17562),o=n(35394);class s extends o.AbstractOperation{constructor(e,t,n,i){super(i),this.SERVER_COMMAND_RESPONSE_TYPE=r.MongoDBResponse,this.ns=t,this.cursorId=e,this.server=n}get commandName(){return"killCursors"}buildCommand(e,t){const n=this.ns.collection;if(null==n)throw new i.MongoRuntimeError("A collection name must be determined before killCursors");return{killCursors:n,cursors:[this.cursorId]}}buildOptions(e){return{session:this.session,timeoutContext:e}}handleError(e){}}t.KillCursorsOperation=s,(0,o.defineAspects)(s,[o.Aspect.MUST_SELECT_SAME_SERVER])},1759:(e,t,n)=>{var r=n(65994).e;Object.defineProperty(t,"__esModule",{value:!0}),t.ServerCapabilities=t.Topology=void 0;const i=n(6875),o=n(91869),s=n(17562),a=n(93347),u=n(4642),c=n(13700),l=n(7799),h=n(145),d=n(89167),f=n(43135),p=n(5369),m=n(9188),g=n(30588),_=n(3906),y=n(4313),v=n(97194);let E=0;const S=(0,h.makeStateMachine)({[d.STATE_CLOSED]:[d.STATE_CLOSED,d.STATE_CONNECTING],[d.STATE_CONNECTING]:[d.STATE_CONNECTING,d.STATE_CLOSING,d.STATE_CONNECTED,d.STATE_CLOSED],[d.STATE_CONNECTED]:[d.STATE_CONNECTED,d.STATE_CLOSING,d.STATE_CLOSED],[d.STATE_CLOSING]:[d.STATE_CLOSING,d.STATE_CLOSED]});class w extends u.TypedEventEmitter{constructor(e,t,n){super(),this.on("error",h.noop),this.client=e,n=n??{hosts:[h.HostAddress.fromString("localhost:27017")],...Object.fromEntries(i.DEFAULT_OPTIONS.entries())},"string"==typeof t?t=[h.HostAddress.fromString(t)]:Array.isArray(t)||(t=[t]);const r=[];for(const e of t)if("string"==typeof e)r.push(h.HostAddress.fromString(e));else{if(!(e instanceof h.HostAddress))throw new s.MongoRuntimeError(`Topology cannot be constructed from ${JSON.stringify(e)}`);r.push(e)}const o=function(e){return e?.directConnection?d.TopologyType.Single:e?.replicaSet?d.TopologyType.ReplicaSetNoPrimary:e?.loadBalanced?d.TopologyType.LoadBalanced:d.TopologyType.Unknown}(n),a=E++,u=null==n.srvMaxHosts||0===n.srvMaxHosts||n.srvMaxHosts>=r.length?r:(0,h.shuffle)(r,n.srvMaxHosts),c=new Map;for(const e of u)c.set(e.toString(),new m.ServerDescription(e));this.waitQueue=new h.List,this.s={id:a,options:n,seedlist:r,state:d.STATE_CLOSED,description:new v.TopologyDescription(o,c,n.replicaSet,void 0,void 0,void 0,n),serverSelectionTimeoutMS:n.serverSelectionTimeoutMS,heartbeatFrequencyMS:n.heartbeatFrequencyMS,minHeartbeatFrequencyMS:n.minHeartbeatFrequencyMS,servers:new Map,credentials:n?.credentials,clusterTime:void 0,detectShardedTopology:e=>this.detectShardedTopology(e),detectSrvRecords:e=>this.detectSrvRecords(e)},this.mongoLogger=e.mongoLogger,this.component="topology",n.srvHost&&!n.loadBalanced&&(this.s.srvPoller=n.srvPoller??new y.SrvPoller({heartbeatFrequencyMS:this.s.heartbeatFrequencyMS,srvHost:n.srvHost,srvMaxHosts:n.srvMaxHosts,srvServiceName:n.srvServiceName}),this.on(w.TOPOLOGY_DESCRIPTION_CHANGED,this.s.detectShardedTopology)),this.connectionLock=void 0}detectShardedTopology(e){const t=e.previousDescription.type,n=e.newDescription.type,r=t!==d.TopologyType.Sharded&&n===d.TopologyType.Sharded,i=this.s.srvPoller?.listeners(y.SrvPoller.SRV_RECORD_DISCOVERY),o=!!i?.includes(this.s.detectSrvRecords);r&&!o&&(this.s.srvPoller?.on(y.SrvPoller.SRV_RECORD_DISCOVERY,this.s.detectSrvRecords),this.s.srvPoller?.start())}detectSrvRecords(e){const t=this.s.description;this.s.description=this.s.description.updateFromSrvPollingEvent(e,this.s.options.srvMaxHosts),this.s.description!==t&&(b(this),this.emitAndLog(w.TOPOLOGY_DESCRIPTION_CHANGED,new f.TopologyDescriptionChangedEvent(this.s.id,t,this.s.description)))}get description(){return this.s.description}get loadBalanced(){return this.s.options.loadBalanced}get serverApi(){return this.s.options.serverApi}get capabilities(){return new A(this.lastHello())}async connect(e){this.connectionLock??=this._connect(e);try{return await this.connectionLock,this}finally{this.connectionLock=void 0}}async _connect(e){if(e=e??{},this.s.state===d.STATE_CONNECTED)return this;S(this,d.STATE_CONNECTING),this.emitAndLog(w.TOPOLOGY_OPENING,new f.TopologyOpeningEvent(this.s.id)),this.emitAndLog(w.TOPOLOGY_DESCRIPTION_CHANGED,new f.TopologyDescriptionChangedEvent(this.s.id,new v.TopologyDescription(d.TopologyType.Unknown),this.s.description));const t=Array.from(this.s.description.servers.values());if(this.s.servers=new Map(t.map((e=>[e.address,O(this,e)]))),this.s.options.loadBalanced)for(const e of t){const t=new m.ServerDescription(e.hostAddress,void 0,{loadBalanced:this.s.options.loadBalanced});this.serverUpdateHandler(t)}const n=this.client.s.options.serverSelectionTimeoutMS,r=e.readPreference??c.ReadPreference.primary,i=l.TimeoutContext.create({timeoutMS:void 0,serverSelectionTimeoutMS:n,waitQueueTimeoutMS:this.client.s.options.waitQueueTimeoutMS}),o={operationName:"handshake",...e,timeoutContext:i};try{const e=await this.selectServer((0,g.readPreferenceServerSelector)(r),o);if(!0!==this.s.options.__skipPingOnConnect&&this.s.credentials){const t=await e.pool.checkOut({timeoutContext:i});return e.pool.checkIn(t),S(this,d.STATE_CONNECTED),this.emit(w.OPEN,this),this.emit(w.CONNECT,this),this}return S(this,d.STATE_CONNECTED),this.emit(w.OPEN,this),this.emit(w.CONNECT,this),this}catch(e){throw this.close(),e}}closeCheckedOutConnections(){for(const e of this.s.servers.values())return e.closeCheckedOutConnections()}close(){if(this.s.state!==d.STATE_CLOSED&&this.s.state!==d.STATE_CLOSING){for(const e of this.s.servers.values())C(e,this);this.s.servers.clear(),S(this,d.STATE_CLOSING),M(this.waitQueue,new s.MongoTopologyClosedError),this.s.srvPoller&&(this.s.srvPoller.stop(),this.s.srvPoller.removeListener(y.SrvPoller.SRV_RECORD_DISCOVERY,this.s.detectSrvRecords)),this.removeListener(w.TOPOLOGY_DESCRIPTION_CHANGED,this.s.detectShardedTopology),S(this,d.STATE_CLOSED),this.emitAndLog(w.TOPOLOGY_CLOSED,new f.TopologyClosedEvent(this.s.id))}}async selectServer(e,t){let n,r;if("function"!=typeof e)if("string"==typeof e)n=(0,g.readPreferenceServerSelector)(c.ReadPreference.fromString(e));else{let r;e instanceof c.ReadPreference?r=e:(c.ReadPreference.translate(t),r=t.readPreference||c.ReadPreference.primary),n=(0,g.readPreferenceServerSelector)(r)}else n=e;t={serverSelectionTimeoutMS:this.s.serverSelectionTimeoutMS,...t},this.client.mongoLogger?.willLog(a.MongoLoggableComponent.SERVER_SELECTION,a.SeverityLevel.DEBUG)&&this.client.mongoLogger?.debug(a.MongoLoggableComponent.SERVER_SELECTION,new _.ServerSelectionStartedEvent(e,this.description,t.operationName)),r=t.timeoutContext?t.timeoutContext.serverSelectionTimeout:l.Timeout.expires(t.serverSelectionTimeoutMS??0);const i=this.description.type===d.TopologyType.Sharded,o=t.session,u=o&&o.transaction;if(i&&u&&u.server)return this.client.mongoLogger?.willLog(a.MongoLoggableComponent.SERVER_SELECTION,a.SeverityLevel.DEBUG)&&this.client.mongoLogger?.debug(a.MongoLoggableComponent.SERVER_SELECTION,new _.ServerSelectionSucceededEvent(e,this.description,u.server.pool.address,t.operationName)),t.timeoutContext?.clearServerSelectionTimeout&&r?.clear(),u.server;const{promise:f,resolve:p,reject:m}=(0,h.promiseWithResolvers)(),y={serverSelector:n,topologyDescription:this.description,mongoLogger:this.client.mongoLogger,transaction:u,resolve:p,reject:m,cancelled:!1,startTime:(0,h.now)(),operationName:t.operationName,waitingLogged:!1,previousServer:t.previousServer},v=(0,h.addAbortListener)(t.signal,(function(){y.cancelled=!0,m(this.reason)}));this.waitQueue.push(y),T(this);try{r?.throwIfExpired();const e=await(r?Promise.race([f,r]):f);return t.timeoutContext?.csotEnabled()&&0!==e.description.minRoundTripTime&&(t.timeoutContext.minRoundTripTime=e.description.minRoundTripTime),e}catch(n){if(l.TimeoutError.is(n)){y.cancelled=!0;const n=new s.MongoServerSelectionError(`Server selection timed out after ${r?.duration} ms`,this.description);if(this.client.mongoLogger?.willLog(a.MongoLoggableComponent.SERVER_SELECTION,a.SeverityLevel.DEBUG)&&this.client.mongoLogger?.debug(a.MongoLoggableComponent.SERVER_SELECTION,new _.ServerSelectionFailedEvent(e,this.description,n,t.operationName)),t.timeoutContext?.csotEnabled())throw new s.MongoOperationTimeoutError("Timed out during server selection",{cause:n});throw n}throw n}finally{v?.[h.kDispose](),t.timeoutContext?.clearServerSelectionTimeout&&r?.clear()}}serverUpdateHandler(e){if(!this.s.description.hasServer(e.address))return;if(function(e,t){const n=e.servers.get(t.address),r=n?.topologyVersion;return(0,m.compareTopologyVersion)(r,t.topologyVersion)>0}(this.s.description,e))return;const t=this.s.description,n=this.s.description.servers.get(e.address);if(!n)return;const r=e.$clusterTime;r&&(0,d._advanceClusterTime)(this,r);const i=n&&n.equals(e);if(this.s.description=this.s.description.update(e),this.s.description.compatibilityError)this.emit(w.ERROR,new s.MongoCompatibilityError(this.s.description.compatibilityError));else{if(!i){const t=this.s.description.servers.get(e.address);t&&this.emit(w.SERVER_DESCRIPTION_CHANGED,new f.ServerDescriptionChangedEvent(this.s.id,e.address,n,t))}b(this,e),this.waitQueue.length>0&&T(this),i||this.emitAndLog(w.TOPOLOGY_DESCRIPTION_CHANGED,new f.TopologyDescriptionChangedEvent(this.s.id,t,this.s.description))}}auth(e,t){"function"==typeof e&&(t=e,e=void 0),"function"==typeof t&&t(void 0,!0)}get clientMetadata(){return this.s.options.metadata}isConnected(){return this.s.state===d.STATE_CONNECTED}isDestroyed(){return this.s.state===d.STATE_CLOSED}lastHello(){const e=Array.from(this.description.servers.values());return 0===e.length?{}:e.filter((e=>e.type!==d.ServerType.Unknown))[0]||{maxWireVersion:this.description.commonWireVersion}}get commonWireVersion(){return this.description.commonWireVersion}get logicalSessionTimeoutMinutes(){return this.description.logicalSessionTimeoutMinutes}get clusterTime(){return this.s.clusterTime}set clusterTime(e){this.s.clusterTime=e}}function C(e,t){for(const t of o.LOCAL_SERVER_EVENTS)e.removeAllListeners(t);e.close(),t.emitAndLog(w.SERVER_CLOSED,new f.ServerClosedEvent(t.s.id,e.description.address));for(const t of o.SERVER_RELAY_EVENTS)e.removeAllListeners(t)}function O(e,t){e.emitAndLog(w.SERVER_OPENING,new f.ServerOpeningEvent(e.s.id,t.address));const n=new p.Server(e,t,e.s.options);for(const t of o.SERVER_RELAY_EVENTS)n.on(t,(n=>e.emit(t,n)));return n.on(p.Server.DESCRIPTION_RECEIVED,(t=>e.serverUpdateHandler(t))),n.connect(),n}function b(e,t){if(t&&e.s.servers.has(t.address)){const n=e.s.servers.get(t.address);if(n)if(n.s.description=t,t.error instanceof s.MongoError&&t.error.hasErrorLabel(s.MongoErrorLabel.ResetPool)){const e=t.error.hasErrorLabel(s.MongoErrorLabel.InterruptInUseConnections);n.pool.clear({interruptInUseConnections:e})}else if(null==t.error){const r=e.s.description.type;(t.isDataBearing||t.type!==d.ServerType.Unknown&&r===d.TopologyType.Single)&&n.pool.ready()}}for(const t of e.description.servers.values())if(!e.s.servers.has(t.address)){const n=O(e,t);e.s.servers.set(t.address,n)}for(const t of e.s.servers){const n=t[0];if(e.description.hasServer(n))continue;if(!e.s.servers.has(n))continue;const r=e.s.servers.get(n);e.s.servers.delete(n),r&&C(r,e)}}function M(e,t){for(;e.length;){const n=e.shift();n&&(n.cancelled||(n.mongoLogger?.willLog(a.MongoLoggableComponent.SERVER_SELECTION,a.SeverityLevel.DEBUG)&&n.mongoLogger?.debug(a.MongoLoggableComponent.SERVER_SELECTION,new _.ServerSelectionFailedEvent(n.serverSelector,n.topologyDescription,t,n.operationName)),n.reject(t)))}}function T(e){if(e.s.state===d.STATE_CLOSED)return void M(e.waitQueue,new s.MongoTopologyClosedError);const t=e.description.type===d.TopologyType.Sharded,n=Array.from(e.description.servers.values()),i=e.waitQueue.length;for(let r=0;r<i;++r){const r=e.waitQueue.shift();if(!r)continue;if(r.cancelled)continue;let i,o;try{const t=r.serverSelector,o=r.previousServer;i=t?t(e.description,n,o?[o]:[]):n}catch(t){e.client.mongoLogger?.willLog(a.MongoLoggableComponent.SERVER_SELECTION,a.SeverityLevel.DEBUG)&&e.client.mongoLogger?.debug(a.MongoLoggableComponent.SERVER_SELECTION,new _.ServerSelectionFailedEvent(r.serverSelector,e.description,t,r.operationName)),r.reject(t);continue}if(0===i.length){r.waitingLogged||(e.client.mongoLogger?.willLog(a.MongoLoggableComponent.SERVER_SELECTION,a.SeverityLevel.INFORMATIONAL)&&e.client.mongoLogger?.info(a.MongoLoggableComponent.SERVER_SELECTION,new _.WaitingForSuitableServerEvent(r.serverSelector,e.description,0!==e.s.serverSelectionTimeoutMS?e.s.serverSelectionTimeoutMS-((0,h.now)()-r.startTime):-1,r.operationName)),r.waitingLogged=!0),e.waitQueue.push(r);continue}if(1===i.length)o=e.s.servers.get(i[0].address);else{const t=(0,h.shuffle)(i,2),n=e.s.servers.get(t[0].address),r=e.s.servers.get(t[1].address);o=n&&r&&n.s.operationCount<r.s.operationCount?n:r}if(!o){const t=new s.MongoServerSelectionError("server selection returned a server description but the server was not found in the topology",e.description);return e.client.mongoLogger?.willLog(a.MongoLoggableComponent.SERVER_SELECTION,a.SeverityLevel.DEBUG)&&e.client.mongoLogger?.debug(a.MongoLoggableComponent.SERVER_SELECTION,new _.ServerSelectionFailedEvent(r.serverSelector,e.description,t,r.operationName)),void r.reject(t)}const u=r.transaction;t&&u&&u.isActive&&o&&u.pinServer(o),e.client.mongoLogger?.willLog(a.MongoLoggableComponent.SERVER_SELECTION,a.SeverityLevel.DEBUG)&&e.client.mongoLogger?.debug(a.MongoLoggableComponent.SERVER_SELECTION,new _.ServerSelectionSucceededEvent(r.serverSelector,r.topologyDescription,o.pool.address,r.operationName)),r.resolve(o)}if(e.waitQueue.length>0)for(const[,t]of e.s.servers)r.nextTick((function(){return t.requestCheck()}))}t.Topology=w,w.SERVER_OPENING=o.SERVER_OPENING,w.SERVER_CLOSED=o.SERVER_CLOSED,w.SERVER_DESCRIPTION_CHANGED=o.SERVER_DESCRIPTION_CHANGED,w.TOPOLOGY_OPENING=o.TOPOLOGY_OPENING,w.TOPOLOGY_CLOSED=o.TOPOLOGY_CLOSED,w.TOPOLOGY_DESCRIPTION_CHANGED=o.TOPOLOGY_DESCRIPTION_CHANGED,w.ERROR=o.ERROR,w.OPEN=o.OPEN,w.CONNECT=o.CONNECT,w.CLOSE=o.CLOSE,w.TIMEOUT=o.TIMEOUT;class A{constructor(e){this.minWireVersion=e.minWireVersion||0,this.maxWireVersion=e.maxWireVersion||0}get hasAggregationCursor(){return this.maxWireVersion>=1}get hasWriteCommands(){return this.maxWireVersion>=2}get hasTextSearch(){return this.minWireVersion>=0}get hasAuthCommands(){return this.maxWireVersion>=1}get hasListCollectionsCommand(){return this.maxWireVersion>=3}get hasListIndexesCommand(){return this.maxWireVersion>=3}get supportsSnapshotReads(){return this.maxWireVersion>=13}get commandsTakeWriteConcern(){return this.maxWireVersion>=5}get commandsTakeCollation(){return this.maxWireVersion>=5}}t.ServerCapabilities=A},3079:(e,t,n)=>{n.d(t,{_:()=>w});var r=n(66596);function i(e){const t=[];let n=-1,i=0,o=0;for(;++n<e.length;){const s=e.charCodeAt(n);let a="";if(37===s&&(0,r.lV)(e.charCodeAt(n+1))&&(0,r.lV)(e.charCodeAt(n+2)))o=2;else if(s<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(s))||(a=String.fromCharCode(s));else if(s>55295&&s<57344){const t=e.charCodeAt(n+1);s<56320&&t>56319&&t<57344?(a=String.fromCharCode(s,t),o=1):a="�"}else a=String.fromCharCode(s);a&&(t.push(e.slice(i,n),encodeURIComponent(a)),i=n+o+1,a=""),o&&(n+=o,o=0)}return t.join("")+e.slice(i)}var o=n(38411),s=n(2563),a=n(73429);const u={}.hasOwnProperty;function c(e){return String(e||"").toUpperCase()}function l(e,t){const n=String(t.identifier).toUpperCase(),r=i(n.toLowerCase()),o=e.footnoteOrder.indexOf(n);let s;-1===o?(e.footnoteOrder.push(n),e.footnoteCounts[n]=1,s=e.footnoteOrder.length):(e.footnoteCounts[n]++,s=o+1);const a=e.footnoteCounts[n],u={type:"element",tagName:"a",properties:{href:"#"+e.clobberPrefix+"fn-"+r,id:e.clobberPrefix+"fnref-"+r+(a>1?"-"+a:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(s)}]};e.patch(t,u);const c={type:"element",tagName:"sup",properties:{},children:[u]};return e.patch(t,c),e.applyData(t,c)}function h(e,t){const n=t.referenceType;let r="]";if("collapsed"===n?r+="[]":"full"===n&&(r+="["+(t.label||t.identifier)+"]"),"imageReference"===t.type)return{type:"text",value:"!["+t.alt+r};const i=e.all(t),o=i[0];o&&"text"===o.type?o.value="["+o.value:i.unshift({type:"text",value:"["});const s=i[i.length-1];return s&&"text"===s.type?s.value+=r:i.push({type:"text",value:r}),i}function d(e){const t=e.spread;return null==t?e.children.length>1:t}var f=n(10743);const p={blockquote:function(e,t){const n={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,n),e.applyData(t,n)},break:function(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:"\n"}]},code:function(e,t){const n=t.value?t.value+"\n":"",r=t.lang?t.lang.match(/^[^ \t]+(?=[ \t]|$)/):null,i={};r&&(i.className=["language-"+r]);let o={type:"element",tagName:"code",properties:i,children:[{type:"text",value:n}]};return t.meta&&(o.data={meta:t.meta}),e.patch(t,o),o=e.applyData(t,o),o={type:"element",tagName:"pre",properties:{},children:[o]},e.patch(t,o),o},delete:function(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)},emphasis:function(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)},footnoteReference:l,footnote:function(e,t){const n=e.footnoteById;let r=1;for(;r in n;)r++;const i=String(r);return n[i]={type:"footnoteDefinition",identifier:i,children:[{type:"paragraph",children:t.children}],position:t.position},l(e,{type:"footnoteReference",identifier:i,position:t.position})},heading:function(e,t){const n={type:"element",tagName:"h"+t.depth,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)},html:function(e,t){if(e.dangerous){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}return null},imageReference:function(e,t){const n=e.definition(t.identifier);if(!n)return h(e,t);const r={src:i(n.url||""),alt:t.alt};null!==n.title&&void 0!==n.title&&(r.title=n.title);const o={type:"element",tagName:"img",properties:r,children:[]};return e.patch(t,o),e.applyData(t,o)},image:function(e,t){const n={src:i(t.url)};null!==t.alt&&void 0!==t.alt&&(n.alt=t.alt),null!==t.title&&void 0!==t.title&&(n.title=t.title);const r={type:"element",tagName:"img",properties:n,children:[]};return e.patch(t,r),e.applyData(t,r)},inlineCode:function(e,t){const n={type:"text",value:t.value.replace(/\r?\n|\r/g," ")};e.patch(t,n);const r={type:"element",tagName:"code",properties:{},children:[n]};return e.patch(t,r),e.applyData(t,r)},linkReference:function(e,t){const n=e.definition(t.identifier);if(!n)return h(e,t);const r={href:i(n.url||"")};null!==n.title&&void 0!==n.title&&(r.title=n.title);const o={type:"element",tagName:"a",properties:r,children:e.all(t)};return e.patch(t,o),e.applyData(t,o)},link:function(e,t){const n={href:i(t.url)};null!==t.title&&void 0!==t.title&&(n.title=t.title);const r={type:"element",tagName:"a",properties:n,children:e.all(t)};return e.patch(t,r),e.applyData(t,r)},listItem:function(e,t,n){const r=e.all(t),i=n?function(e){let t=!1;if("list"===e.type){t=e.spread||!1;const n=e.children;let r=-1;for(;!t&&++r<n.length;)t=d(n[r])}return t}(n):d(t),o={},s=[];if("boolean"==typeof t.checked){const e=r[0];let n;e&&"element"===e.type&&"p"===e.tagName?n=e:(n={type:"element",tagName:"p",properties:{},children:[]},r.unshift(n)),n.children.length>0&&n.children.unshift({type:"text",value:" "}),n.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),o.className=["task-list-item"]}let a=-1;for(;++a<r.length;){const e=r[a];(i||0!==a||"element"!==e.type||"p"!==e.tagName)&&s.push({type:"text",value:"\n"}),"element"!==e.type||"p"!==e.tagName||i?s.push(e):s.push(...e.children)}const u=r[r.length-1];u&&(i||"element"!==u.type||"p"!==u.tagName)&&s.push({type:"text",value:"\n"});const c={type:"element",tagName:"li",properties:o,children:s};return e.patch(t,c),e.applyData(t,c)},list:function(e,t){const n={},r=e.all(t);let i=-1;for("number"==typeof t.start&&1!==t.start&&(n.start=t.start);++i<r.length;){const e=r[i];if("element"===e.type&&"li"===e.tagName&&e.properties&&Array.isArray(e.properties.className)&&e.properties.className.includes("task-list-item")){n.className=["contains-task-list"];break}}const o={type:"element",tagName:t.ordered?"ol":"ul",properties:n,children:e.wrap(r,!0)};return e.patch(t,o),e.applyData(t,o)},paragraph:function(e,t){const n={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)},root:function(e,t){const n={type:"root",children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)},strong:function(e,t){const n={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)},table:function(e,t){const n=e.all(t),r=n.shift(),i=[];if(r){const n={type:"element",tagName:"thead",properties:{},children:e.wrap([r],!0)};e.patch(t.children[0],n),i.push(n)}if(n.length>0){const r={type:"element",tagName:"tbody",properties:{},children:e.wrap(n,!0)},o=(0,s.PW)(t.children[1]),a=(0,s.Y)(t.children[t.children.length-1]);o.line&&a.line&&(r.position={start:o,end:a}),i.push(r)}const o={type:"element",tagName:"table",properties:{},children:e.wrap(i,!0)};return e.patch(t,o),e.applyData(t,o)},tableCell:function(e,t){const n={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)},tableRow:function(e,t,n){const r=n?n.children:void 0,i=0===(r?r.indexOf(t):1)?"th":"td",o=n&&"table"===n.type?n.align:void 0,s=o?o.length:t.children.length;let a=-1;const u=[];for(;++a<s;){const n=t.children[a],r={},s=o?o[a]:void 0;s&&(r.align=s);let c={type:"element",tagName:i,properties:r,children:[]};n&&(c.children=e.all(n),e.patch(n,c),c=e.applyData(t,c)),u.push(c)}const c={type:"element",tagName:"tr",properties:{},children:e.wrap(u,!0)};return e.patch(t,c),e.applyData(t,c)},text:function(e,t){const n={type:"text",value:(0,f.E)(String(t.value))};return e.patch(t,n),e.applyData(t,n)},thematicBreak:function(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)},toml:m,yaml:m,definition:m,footnoteDefinition:m};function m(){return null}const g={}.hasOwnProperty;function _(e,t){e.position&&(t.position=(0,s.G1)(e))}function y(e,t){let n=t;if(e&&e.data){const t=e.data.hName,r=e.data.hChildren,i=e.data.hProperties;"string"==typeof t&&("element"===n.type?n.tagName=t:n={type:"element",tagName:t,properties:{},children:[]}),"element"===n.type&&i&&(n.properties={...n.properties,...i}),"children"in n&&n.children&&null!=r&&(n.children=r)}return n}function v(e,t,n){const r=t&&t.type;if(!r)throw new Error("Expected node, got `"+t+"`");return g.call(e.handlers,r)?e.handlers[r](e,t,n):e.passThrough&&e.passThrough.includes(r)?"children"in t?{...t,children:E(e,t)}:t:e.unknownHandler?e.unknownHandler(e,t,n):function(e,t){const n=t.data||{},r=!("value"in t)||g.call(n,"hProperties")||g.call(n,"hChildren")?{type:"element",tagName:"div",properties:{},children:E(e,t)}:{type:"text",value:t.value};return e.patch(t,r),e.applyData(t,r)}(e,t)}function E(e,t){const n=[];if("children"in t){const r=t.children;let i=-1;for(;++i<r.length;){const o=v(e,r[i],t);if(o){if(i&&"break"===r[i-1].type&&(Array.isArray(o)||"text"!==o.type||(o.value=o.value.replace(/^\s+/,"")),!Array.isArray(o)&&"element"===o.type)){const e=o.children[0];e&&"text"===e.type&&(e.value=e.value.replace(/^\s+/,""))}Array.isArray(o)?n.push(...o):n.push(o)}}}return n}function S(e,t){const n=[];let r=-1;for(t&&n.push({type:"text",value:"\n"});++r<e.length;)r&&n.push({type:"text",value:"\n"}),n.push(e[r]);return t&&e.length>0&&n.push({type:"text",value:"\n"}),n}function w(e,t){const n=function(e,t){const n=t||{},r=n.allowDangerousHtml||!1,i={};return h.dangerous=r,h.clobberPrefix=void 0===n.clobberPrefix||null===n.clobberPrefix?"user-content-":n.clobberPrefix,h.footnoteLabel=n.footnoteLabel||"Footnotes",h.footnoteLabelTagName=n.footnoteLabelTagName||"h2",h.footnoteLabelProperties=n.footnoteLabelProperties||{className:["sr-only"]},h.footnoteBackLabel=n.footnoteBackLabel||"Back to content",h.unknownHandler=n.unknownHandler,h.passThrough=n.passThrough,h.handlers={...p,...n.handlers},h.definition=function(e){const t=Object.create(null);if(!e||!e.type)throw new Error("mdast-util-definitions expected node");return(0,o.YR)(e,"definition",(e=>{const n=c(e.identifier);n&&!u.call(t,n)&&(t[n]=e)})),function(e){const n=c(e);return n&&u.call(t,n)?t[n]:null}}(e),h.footnoteById=i,h.footnoteOrder=[],h.footnoteCounts={},h.patch=_,h.applyData=y,h.one=function(e,t){return v(h,e,t)},h.all=function(e){return E(h,e)},h.wrap=S,h.augment=l,(0,o.YR)(e,"footnoteDefinition",(e=>{const t=String(e.identifier).toUpperCase();g.call(i,t)||(i[t]=e)})),h;function l(e,t){if(e&&"data"in e&&e.data){const n=e.data;n.hName&&("element"!==t.type&&(t={type:"element",tagName:"",properties:{},children:[]}),t.tagName=n.hName),"element"===t.type&&n.hProperties&&(t.properties={...t.properties,...n.hProperties}),"children"in t&&t.children&&n.hChildren&&(t.children=n.hChildren)}if(e){const n="type"in e?e:{position:e};(0,a.g)(n)||(t.position={start:(0,s.PW)(n),end:(0,s.Y)(n)})}return t}function h(e,t,n,r){return Array.isArray(n)&&(r=n,n={}),l(e,{type:"element",tagName:t,properties:n||{},children:r||[]})}}(e,t),r=n.one(e,null),l=function(e){const t=[];let n=-1;for(;++n<e.footnoteOrder.length;){const r=e.footnoteById[e.footnoteOrder[n]];if(!r)continue;const o=e.all(r),s=String(r.identifier).toUpperCase(),a=i(s.toLowerCase());let u=0;const c=[];for(;++u<=e.footnoteCounts[s];){const t={type:"element",tagName:"a",properties:{href:"#"+e.clobberPrefix+"fnref-"+a+(u>1?"-"+u:""),dataFootnoteBackref:!0,className:["data-footnote-backref"],ariaLabel:e.footnoteBackLabel},children:[{type:"text",value:"↩"}]};u>1&&t.children.push({type:"element",tagName:"sup",children:[{type:"text",value:String(u)}]}),c.length>0&&c.push({type:"text",value:" "}),c.push(t)}const l=o[o.length-1];if(l&&"element"===l.type&&"p"===l.tagName){const e=l.children[l.children.length-1];e&&"text"===e.type?e.value+=" ":l.children.push({type:"text",value:" "}),l.children.push(...c)}else o.push(...c);const h={type:"element",tagName:"li",properties:{id:e.clobberPrefix+"fn-"+a},children:e.wrap(o,!0)};e.patch(r,h),t.push(h)}if(0!==t.length)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:e.footnoteLabelTagName,properties:{...JSON.parse(JSON.stringify(e.footnoteLabelProperties)),id:"footnote-label"},children:[{type:"text",value:e.footnoteLabel}]},{type:"text",value:"\n"},{type:"element",tagName:"ol",properties:{},children:e.wrap(t,!0)},{type:"text",value:"\n"}]}}(n);return l&&r.children.push({type:"text",value:"\n"},l),Array.isArray(r)?{type:"root",children:r}:r}},3357:(e,t,n)=>{var r=n(33433),i=n(372);function o(e){this.rand=e||new i.Rand}e.exports=o,o.create=function(e){return new o(e)},o.prototype._randbelow=function(e){var t=e.bitLength(),n=Math.ceil(t/8);do{var i=new r(this.rand.generate(n))}while(i.cmp(e)>=0);return i},o.prototype._randrange=function(e,t){var n=t.sub(e);return e.add(this._randbelow(n))},o.prototype.test=function(e,t,n){var i=e.bitLength(),o=r.mont(e),s=new r(1).toRed(o);t||(t=Math.max(1,i/48|0));for(var a=e.subn(1),u=0;!a.testn(u);u++);for(var c=e.shrn(u),l=a.toRed(o);t>0;t--){var h=this._randrange(new r(2),a);n&&n(h);var d=h.toRed(o).redPow(c);if(0!==d.cmp(s)&&0!==d.cmp(l)){for(var f=1;f<u;f++){if(0===(d=d.redSqr()).cmp(s))return!1;if(0===d.cmp(l))break}if(f===u)return!1}}return!0},o.prototype.getDivisor=function(e,t){var n=e.bitLength(),i=r.mont(e),o=new r(1).toRed(i);t||(t=Math.max(1,n/48|0));for(var s=e.subn(1),a=0;!s.testn(a);a++);for(var u=e.shrn(a),c=s.toRed(i);t>0;t--){var l=this._randrange(new r(2),s),h=e.gcd(l);if(0!==h.cmpn(1))return h;var d=l.toRed(i).redPow(u);if(0!==d.cmp(o)&&0!==d.cmp(c)){for(var f=1;f<a;f++){if(0===(d=d.redSqr()).cmp(o))return d.fromRed().subn(1).gcd(e);if(0===d.cmp(c))break}if(f===a)return(d=d.redSqr()).fromRed().subn(1).gcd(e)}}return!1}},3906:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.WaitingForSuitableServerEvent=t.ServerSelectionSucceededEvent=t.ServerSelectionFailedEvent=t.ServerSelectionStartedEvent=t.ServerSelectionEvent=void 0;const r=n(145),i=n(91869);class o{constructor(e,t,n){this.selector=e,this.operation=n,this.topologyDescription=t}}t.ServerSelectionEvent=o,t.ServerSelectionStartedEvent=class extends o{constructor(e,t,n){super(e,t,n),this.name=i.SERVER_SELECTION_STARTED,this.message="Server selection started"}},t.ServerSelectionFailedEvent=class extends o{constructor(e,t,n,r){super(e,t,r),this.name=i.SERVER_SELECTION_FAILED,this.message="Server selection failed",this.failure=n}},t.ServerSelectionSucceededEvent=class extends o{constructor(e,t,n,o){super(e,t,o),this.name=i.SERVER_SELECTION_SUCCEEDED,this.message="Server selection succeeded";const{host:s,port:a}=r.HostAddress.fromString(n).toHostPort();this.serverHost=s,this.serverPort=a}},t.WaitingForSuitableServerEvent=class extends o{constructor(e,t,n,r){super(e,t,r),this.name=i.WAITING_FOR_SUITABLE_SERVER,this.message="Waiting for suitable server to become available",this.remainingTimeMS=n}}},4313:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.SrvPoller=t.SrvPollingEvent=void 0;const r=n(95136),i=n(37668),o=n(17562),s=n(4642),a=n(145);class u{constructor(e){this.srvRecords=e}hostnames(){return new Set(this.srvRecords.map((e=>a.HostAddress.fromSrvRecord(e).toString())))}}t.SrvPollingEvent=u;class c extends s.TypedEventEmitter{constructor(e){if(super(),this.on("error",a.noop),!e||!e.srvHost)throw new o.MongoRuntimeError("Options for SrvPoller must exist and include srvHost");this.srvHost=e.srvHost,this.srvMaxHosts=e.srvMaxHosts??0,this.srvServiceName=e.srvServiceName??"mongodb",this.rescanSrvIntervalMS=6e4,this.heartbeatFrequencyMS=e.heartbeatFrequencyMS??1e4,this.haMode=!1,this.generation=0,this._timeout=void 0}get srvAddress(){return`_${this.srvServiceName}._tcp.${this.srvHost}`}get intervalMS(){return this.haMode?this.heartbeatFrequencyMS:this.rescanSrvIntervalMS}start(){this._timeout||this.schedule()}stop(){this._timeout&&((0,i.clearTimeout)(this._timeout),this.generation+=1,this._timeout=void 0)}schedule(){this._timeout&&(0,i.clearTimeout)(this._timeout),this._timeout=(0,i.setTimeout)((()=>{this._poll().then(void 0,a.squashError)}),this.intervalMS)}success(e){this.haMode=!1,this.schedule(),this.emit(c.SRV_RECORD_DISCOVERY,new u(e))}failure(){this.haMode=!0,this.schedule()}async _poll(){const e=this.generation;let t;try{t=await r.promises.resolveSrv(this.srvAddress)}catch{return void this.failure()}if(e!==this.generation)return;const n=[];for(const e of t)try{(0,a.checkParentDomainMatch)(e.name,this.srvHost),n.push(e)}catch(e){(0,a.squashError)(e)}n.length?this.success(n):this.failure()}}t.SrvPoller=c,c.SRV_RECORD_DISCOVERY="srvRecordDiscovery"},4642:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CancellationToken=t.TypedEventEmitter=void 0;const r=n(8763),i=n(93347),o=n(145);class s extends r.EventEmitter{emitAndLog(e,...t){this.emit(e,...t),this.component&&this.mongoLogger?.debug(this.component,t[0])}emitAndLogHeartbeat(e,t,n,...r){if(this.emit(e,...r),this.component){const e={topologyId:t,serverConnectionId:n??null,...r[0]};this.mongoLogger?.debug(this.component,e)}}emitAndLogCommand(e,t,n,r,...o){if(e&&this.emit(t,...o),r){const e={databaseName:n,...o[0]};this.mongoLogger?.debug(i.MongoLoggableComponent.COMMAND,e)}}}t.TypedEventEmitter=s,t.CancellationToken=class extends s{constructor(...e){super(...e),this.on("error",o.noop)}}},4752:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.DeleteManyOperation=t.DeleteOneOperation=t.DeleteOperation=void 0,t.makeDeleteStatement=l;const r=n(75725),i=n(17562),o=n(78130),s=n(35394);class a extends o.CommandOperation{constructor(e,t,n){super(void 0,n),this.SERVER_COMMAND_RESPONSE_TYPE=r.MongoDBResponse,this.options=n,this.ns=e,this.statements=t}get commandName(){return"delete"}get canRetryWrite(){return!1!==super.canRetryWrite&&this.statements.every((e=>null==e.limit||e.limit>0))}buildCommandDocument(e,t){const n=this.options,r="boolean"!=typeof n.ordered||n.ordered,o={delete:this.ns.collection,deletes:this.statements,ordered:r};if(n.let&&(o.let=n.let),void 0!==n.comment&&(o.comment=n.comment),this.writeConcern&&0===this.writeConcern.w&&this.statements.find((e=>e.hint)))throw new i.MongoCompatibilityError("hint is not supported with unacknowledged writes");return o}}t.DeleteOperation=a;class u extends a{constructor(e,t,n){super(e,[l(t,{...n,limit:1})],n)}handleOk(e){const t=super.handleOk(e);if(this.explain)return t;if(t.code)throw new i.MongoServerError(t);if(t.writeErrors)throw new i.MongoServerError(t.writeErrors[0]);return{acknowledged:0!==this.writeConcern?.w,deletedCount:t.n}}}t.DeleteOneOperation=u;class c extends a{constructor(e,t,n){super(e,[l(t,n)],n)}handleOk(e){const t=super.handleOk(e);if(this.explain)return t;if(t.code)throw new i.MongoServerError(t);if(t.writeErrors)throw new i.MongoServerError(t.writeErrors[0]);return{acknowledged:0!==this.writeConcern?.w,deletedCount:t.n}}}function l(e,t){const n={q:e,limit:"number"==typeof t.limit?t.limit:0};return t.collation&&(n.collation=t.collation),t.hint&&(n.hint=t.hint),n}t.DeleteManyOperation=c,(0,s.defineAspects)(a,[s.Aspect.RETRYABLE,s.Aspect.WRITE_OPERATION]),(0,s.defineAspects)(u,[s.Aspect.RETRYABLE,s.Aspect.WRITE_OPERATION,s.Aspect.EXPLAINABLE,s.Aspect.SKIP_COLLATION]),(0,s.defineAspects)(c,[s.Aspect.WRITE_OPERATION,s.Aspect.EXPLAINABLE,s.Aspect.SKIP_COLLATION])},5136:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.DbStatsOperation=void 0;const r=n(75725),i=n(78130),o=n(35394);class s extends i.CommandOperation{constructor(e,t){super(e,t),this.SERVER_COMMAND_RESPONSE_TYPE=r.MongoDBResponse,this.options=t}get commandName(){return"dbStats"}buildCommandDocument(e){const t={dbStats:!0};return null!=this.options.scale&&(t.scale=this.options.scale),t}}t.DbStatsOperation=s,(0,o.defineAspects)(s,[o.Aspect.READ_OPERATION])},5369:(e,t,n)=>{var r=n(65994).e;Object.defineProperty(t,"__esModule",{value:!0}),t.Server=void 0;const i=n(71470),o=n(75755),s=n(76013),a=n(91869),u=n(17562),c=n(4642),l=n(62016),h=n(85759),d=n(145),f=n(40012),p=n(89167),m=n(57590),g=n(9188),_=n(30588),y=(0,d.makeStateMachine)({[p.STATE_CLOSED]:[p.STATE_CLOSED,p.STATE_CONNECTING],[p.STATE_CONNECTING]:[p.STATE_CONNECTING,p.STATE_CLOSING,p.STATE_CONNECTED,p.STATE_CLOSED],[p.STATE_CONNECTED]:[p.STATE_CONNECTED,p.STATE_CLOSING,p.STATE_CLOSED],[p.STATE_CLOSING]:[p.STATE_CLOSING,p.STATE_CLOSED]});class v extends c.TypedEventEmitter{constructor(e,t,n){super(),this.on("error",d.noop),this.serverApi=n.serverApi;const r={hostAddress:t.hostAddress,...n};this.topology=e,this.pool=new o.ConnectionPool(this,r),this.s={description:t,options:n,state:p.STATE_CLOSED,operationCount:0};for(const e of[...a.CMAP_EVENTS,...a.APM_EVENTS])this.pool.on(e,(t=>this.emit(e,t)));if(this.pool.on(i.Connection.CLUSTER_TIME_RECEIVED,(e=>{this.clusterTime=e})),this.loadBalanced)this.monitor=null;else{this.monitor=new m.Monitor(this,this.s.options);for(const e of a.HEARTBEAT_EVENTS)this.monitor.on(e,(t=>this.emit(e,t)));this.monitor.on("resetServer",(e=>E(this,e))),this.monitor.on(v.SERVER_HEARTBEAT_SUCCEEDED,(e=>{this.emit(v.DESCRIPTION_RECEIVED,new g.ServerDescription(this.description.hostAddress,e.reply,{roundTripTime:this.monitor?.roundTripTime,minRoundTripTime:this.monitor?.minRoundTripTime})),this.s.state===p.STATE_CONNECTING&&(y(this,p.STATE_CONNECTED),this.emit(v.CONNECT,this))}))}}get clusterTime(){return this.topology.clusterTime}set clusterTime(e){this.topology.clusterTime=e}get description(){return this.s.description}get name(){return this.s.description.address}get autoEncrypter(){if(this.s.options&&this.s.options.autoEncrypter)return this.s.options.autoEncrypter}get loadBalanced(){return this.topology.description.type===p.TopologyType.LoadBalanced}connect(){this.s.state===p.STATE_CLOSED&&(y(this,p.STATE_CONNECTING),this.loadBalanced?(y(this,p.STATE_CONNECTED),this.emit(v.CONNECT,this)):this.monitor?.connect())}closeCheckedOutConnections(){return this.pool.closeCheckedOutConnections()}close(){this.s.state!==p.STATE_CLOSED&&(y(this,p.STATE_CLOSING),this.loadBalanced||this.monitor?.close(),this.pool.close(),y(this,p.STATE_CLOSED),this.emit("closed"))}requestCheck(){this.loadBalanced||this.monitor?.requestCheck()}async command(e,t){if(this.s.state===p.STATE_CLOSING||this.s.state===p.STATE_CLOSED)throw new u.MongoServerClosedError;const n=e.session;let r=n?.pinnedConnection;if(this.incrementOperationCount(),null==r)try{r=await this.pool.checkOut({timeoutContext:t,signal:e.options.signal})}catch(e){throw this.decrementOperationCount(),e instanceof s.PoolClearedError||this.handleError(e),e}let i=null;const o=()=>{if(this.decrementOperationCount(),n?.pinnedConnection!==r)if(null!=i){const e=()=>{this.pool.checkIn(r)};i.then(e,e)}else this.pool.checkIn(r)};let a;try{a=e.buildCommand(r,n)}catch(e){throw o(),e}const c=e.buildOptions(t),h=e.ns;this.loadBalanced&&function(e,t){return!!t&&(t.inTransaction()||t.transaction.isCommitted&&"commitTransaction"in e||"aggregate"in e||"find"in e||"getMore"in e||"listCollections"in e||"listIndexes"in e||"bulkWrite"in e)}(a,n)&&!n?.pinnedConnection&&n?.pin(r),c.directConnection=this.topology.s.options.directConnection,e instanceof l.AggregateOperation&&e.hasWriteStage&&(0,d.maxWireVersion)(r)<_.MIN_SECONDARY_WRITE_WIRE_VERSION&&delete c.readPreference,this.description.iscryptd&&(c.omitMaxTimeMS=!0);try{try{const t=await r.command(h,a,c,e.SERVER_COMMAND_RESPONSE_TYPE);return(0,f.throwIfWriteConcernError)(t),t}catch(e){throw this.decorateCommandError(r,a,c,e)}}catch(t){if(!(t instanceof u.MongoError&&t.code===u.MONGODB_ERROR_CODES.Reauthenticate))throw t;i=this.pool.reauthenticate(r),i.then(void 0,(e=>{i=null,(0,d.squashError)(e)})),await(0,d.abortable)(i,c),i=null;try{const t=await r.command(h,a,c,e.SERVER_COMMAND_RESPONSE_TYPE);return(0,f.throwIfWriteConcernError)(t),t}catch(e){throw this.decorateCommandError(r,a,c,e)}}finally{o()}}handleError(e,t){if(!(e instanceof u.MongoError))return;if(e.connectionGeneration&&e.connectionGeneration<this.pool.generation)return;const n=e instanceof u.MongoNetworkError&&!(e instanceof u.MongoNetworkTimeoutError),i=e instanceof u.MongoNetworkError&&e.beforeHandshake,o=e.hasErrorLabel(u.MongoErrorLabel.HandshakeError);if(n||i||o)this.loadBalanced?t&&this.pool.clear({serviceId:t.serviceId}):(e.addErrorLabel(u.MongoErrorLabel.ResetPool),E(this,e));else if((0,u.isSDAMUnrecoverableError)(e)&&function(e,t){const n=t.topologyVersion,r=e.description.topologyVersion;return(0,g.compareTopologyVersion)(r,n)<0}(this,e)){const n=(0,d.maxWireVersion)(this)<=7||(0,u.isNodeShuttingDownError)(e);this.loadBalanced&&t&&n&&this.pool.clear({serviceId:t.serviceId}),this.loadBalanced||(n&&e.addErrorLabel(u.MongoErrorLabel.ResetPool),E(this,e),r.nextTick((()=>this.requestCheck())))}}decorateCommandError(e,t,n,r){if("object"!=typeof r||null==r||!("name"in r))throw new u.MongoRuntimeError("An unexpected error type: "+typeof r);if("AbortError"===r.name&&"cause"in r&&r.cause instanceof u.MongoError&&(r=r.cause),!(r instanceof u.MongoError))return r;if(function(e,t){return t.serviceId?t.generation!==e.serviceGenerations.get(t.serviceId.toHexString()):t.generation!==e.generation}(this.pool,e))return r;const i=n?.session;return r instanceof u.MongoNetworkError?(i&&!i.hasEnded&&i.serverSession&&(i.serverSession.isDirty=!0),S(i,t)&&!r.hasErrorLabel(u.MongoErrorLabel.TransientTransactionError)&&r.addErrorLabel(u.MongoErrorLabel.TransientTransactionError),(w(this.topology)||(0,h.isTransactionCommand)(t))&&(0,d.supportsRetryableWrites)(this)&&!S(i,t)&&r.addErrorLabel(u.MongoErrorLabel.RetryableWriteError)):(w(this.topology)||(0,h.isTransactionCommand)(t))&&(0,u.needsRetryableWriteLabel)(r,(0,d.maxWireVersion)(this),this.description.type)&&!S(i,t)&&r.addErrorLabel(u.MongoErrorLabel.RetryableWriteError),i&&i.isPinned&&r.hasErrorLabel(u.MongoErrorLabel.TransientTransactionError)&&i.unpin({force:!0}),this.handleError(r,e),r}decrementOperationCount(){return this.s.operationCount-=1}incrementOperationCount(){return this.s.operationCount+=1}}function E(e,t){e.loadBalanced||(t instanceof u.MongoNetworkError&&!(t instanceof u.MongoNetworkTimeoutError)&&e.monitor?.reset(),e.emit(v.DESCRIPTION_RECEIVED,new g.ServerDescription(e.description.hostAddress,void 0,{error:t})))}function S(e,t){return e&&e.inTransaction()&&!(0,h.isTransactionCommand)(t)}function w(e){return!1!==e.s.options.retryWrites}t.Server=v,v.SERVER_HEARTBEAT_STARTED=a.SERVER_HEARTBEAT_STARTED,v.SERVER_HEARTBEAT_SUCCEEDED=a.SERVER_HEARTBEAT_SUCCEEDED,v.SERVER_HEARTBEAT_FAILED=a.SERVER_HEARTBEAT_FAILED,v.CONNECT=a.CONNECT,v.DESCRIPTION_RECEIVED=a.DESCRIPTION_RECEIVED,v.CLOSED=a.CLOSED,v.ENDED=a.ENDED},5465:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.FindCursor=t.FLAGS=void 0;const r=n(75725),i=n(17562),o=n(36411),s=n(17172),a=n(96357),u=n(50440),c=n(30770),l=n(145),h=n(36649);t.FLAGS=["tailable","oplogReplay","noCursorTimeout","awaitData","exhaust","partial"];class d extends h.ExplainableCursor{constructor(e,t,n={},r={}){super(e,t,r),this.numReturned=0,this.cursorFilter=n,this.findOptions=r,null!=r.sort&&(this.findOptions.sort=(0,c.formatSort)(r.sort))}clone(){const e=(0,l.mergeOptions)({},this.findOptions);return delete e.session,new d(this.client,this.namespace,this.cursorFilter,{...e})}map(e){return super.map(e)}async _initialize(e){const t={...this.findOptions,...this.cursorOptions,session:e,signal:this.signal};if(t.explain)try{(0,o.validateExplainTimeoutOptions)(t,o.Explain.fromOptions(t))}catch{throw new i.MongoAPIError("timeoutMS cannot be used with explain when explain is specified in findOptions")}const n=new u.FindOperation(this.namespace,this.cursorFilter,t),r=await(0,a.executeOperation)(this.client,n,this.timeoutContext);return this.numReturned=r.batchSize,{server:n.server,session:e,response:r}}async getMore(e){const t=this.numReturned;if(t){const n=this.findOptions.limit;if((e=n&&n>0&&t+e>n?n-t:e)<=0){try{await this.close()}catch(e){(0,l.squashError)(e)}return r.CursorResponse.emptyGetMore}}const n=await super.getMore(e);return this.numReturned=this.numReturned+n.batchSize,n}async count(e){if((0,l.emitWarningOnce)("cursor.count is deprecated and will be removed in the next major version, please use `collection.estimatedDocumentCount` or `collection.countDocuments` instead "),"boolean"==typeof e)throw new i.MongoInvalidArgumentError("Invalid first parameter to count");return await(0,a.executeOperation)(this.client,new s.CountOperation(this.namespace,this.cursorFilter,{...this.findOptions,...this.cursorOptions,...e}))}async explain(e,t){const{explain:n,timeout:r}=this.resolveExplainTimeoutOptions(e,t);return(await(0,a.executeOperation)(this.client,new u.FindOperation(this.namespace,this.cursorFilter,{...this.findOptions,...this.cursorOptions,...r,explain:n??!0}))).shift(this.deserializationOptions)}filter(e){return this.throwIfInitialized(),this.cursorFilter=e,this}hint(e){return this.throwIfInitialized(),this.findOptions.hint=e,this}min(e){return this.throwIfInitialized(),this.findOptions.min=e,this}max(e){return this.throwIfInitialized(),this.findOptions.max=e,this}returnKey(e){return this.throwIfInitialized(),this.findOptions.returnKey=e,this}showRecordId(e){return this.throwIfInitialized(),this.findOptions.showRecordId=e,this}addQueryModifier(e,t){if(this.throwIfInitialized(),"$"!==e[0])throw new i.MongoInvalidArgumentError(`${e} is not a valid query modifier`);switch(e.substr(1)){case"comment":this.findOptions.comment=t;break;case"explain":this.findOptions.explain=t;break;case"hint":this.findOptions.hint=t;break;case"max":this.findOptions.max=t;break;case"maxTimeMS":this.findOptions.maxTimeMS=t;break;case"min":this.findOptions.min=t;break;case"orderby":this.findOptions.sort=(0,c.formatSort)(t);break;case"query":this.cursorFilter=t;break;case"returnKey":this.findOptions.returnKey=t;break;case"showDiskLoc":this.findOptions.showRecordId=t;break;default:throw new i.MongoInvalidArgumentError(`Invalid query modifier: ${e}`)}return this}comment(e){return this.throwIfInitialized(),this.findOptions.comment=e,this}maxAwaitTimeMS(e){if(this.throwIfInitialized(),"number"!=typeof e)throw new i.MongoInvalidArgumentError("Argument for maxAwaitTimeMS must be a number");return this.findOptions.maxAwaitTimeMS=e,this}maxTimeMS(e){if(this.throwIfInitialized(),"number"!=typeof e)throw new i.MongoInvalidArgumentError("Argument for maxTimeMS must be a number");return this.findOptions.maxTimeMS=e,this}project(e){return this.throwIfInitialized(),this.findOptions.projection=e,this}sort(e,t){if(this.throwIfInitialized(),this.findOptions.tailable)throw new i.MongoTailableCursorError("Tailable cursor does not support sorting");return this.findOptions.sort=(0,c.formatSort)(e,t),this}allowDiskUse(e=!0){if(this.throwIfInitialized(),!this.findOptions.sort)throw new i.MongoInvalidArgumentError('Option "allowDiskUse" requires a sort specification');return e?(this.findOptions.allowDiskUse=!0,this):(this.findOptions.allowDiskUse=!1,this)}collation(e){return this.throwIfInitialized(),this.findOptions.collation=e,this}limit(e){if(this.throwIfInitialized(),this.findOptions.tailable)throw new i.MongoTailableCursorError("Tailable cursor does not support limit");if("number"!=typeof e)throw new i.MongoInvalidArgumentError('Operation "limit" requires an integer');return this.findOptions.limit=e,this}skip(e){if(this.throwIfInitialized(),this.findOptions.tailable)throw new i.MongoTailableCursorError("Tailable cursor does not support skip");if("number"!=typeof e)throw new i.MongoInvalidArgumentError('Operation "skip" requires an integer');return this.findOptions.skip=e,this}}t.FindCursor=d},6875:(e,t,n)=>{var r=n(65994).e;Object.defineProperty(t,"__esModule",{value:!0}),t.DEFAULT_OPTIONS=t.OPTIONS=void 0,t.resolveSRVRecord=async function(e){if("string"!=typeof e.srvHost)throw new d.MongoAPIError('Option "srvHost" must not be empty');const t=e.srvHost,n=M(t);n.then(void 0,y.squashError);const r=`_${e.srvServiceName}._tcp.${t}`,i=await b(r);if(0===i.length)throw new d.MongoAPIError("No addresses found at host");for(const{name:e}of i)(0,y.checkParentDomainMatch)(e,t);const o=i.map((e=>y.HostAddress.fromString(`${e.name}:${e.port??27017}`)));let c;x(o,e,!0);try{c=await n}catch(e){if("ENODATA"!==e.code&&"ENOTFOUND"!==e.code)throw e;return o}if(c.length>1)throw new d.MongoParseError("Multiple text records not allowed");const l=new s.URLSearchParams(c[0].join(""));if([...l.keys()].some((e=>!E.includes(e))))throw new d.MongoParseError(`Text record may only set any of: ${E.join(", ")}`);if(E.some((e=>""===l.get(e))))throw new d.MongoParseError("Cannot have empty URI params in DNS TXT Record");const h=l.get("authSource")??void 0,f=l.get("replicaSet")??void 0,p=l.get("loadBalanced")??void 0;if(!e.userSpecifiedAuthSource&&h&&e.credentials&&!u.AUTH_MECHS_AUTH_SRC_EXTERNAL.has(e.credentials.mechanism)&&(e.credentials=a.MongoCredentials.merge(e.credentials,{source:h})),!e.userSpecifiedReplicaSet&&f&&(e.replicaSet=f),"true"===p&&(e.loadBalanced=!0),e.replicaSet&&e.srvMaxHosts>0)throw new d.MongoParseError("Cannot combine replicaSet option with srvMaxHosts");return x(o,e,!0),o},t.parseOptions=function(e,n=void 0,i={}){if(null==n||n instanceof f.MongoClient||(i=n,n=void 0),i.useBigInt64&&"boolean"==typeof i.promoteLongs&&!i.promoteLongs)throw new d.MongoAPIError("Must request either bigint or Long for int64 deserialization");if(i.useBigInt64&&"boolean"==typeof i.promoteValues&&!i.promoteValues)throw new d.MongoAPIError("Must request either bigint or Long for int64 deserialization");const s=new o.default(e),{hosts:l,isSRV:m}=s,g=Object.create(null);g.hosts=m?[]:l.map(y.HostAddress.fromString);const _=new I;if("/"!==s.pathname&&""!==s.pathname){const e=decodeURIComponent("/"===s.pathname[0]?s.pathname.slice(1):s.pathname);e&&_.set("dbName",[e])}if(""!==s.username){const e={username:decodeURIComponent(s.username)};"string"==typeof s.password&&(e.password=decodeURIComponent(s.password)),_.set("auth",[e])}for(const e of s.searchParams.keys()){const t=s.searchParams.getAll(e),n=/readPreferenceTags/i.test(e);if(!n&&t.length>1)throw new d.MongoInvalidArgumentError(`URI option "${e}" cannot appear more than once in the connection string`);if(!n&&t.includes(""))throw new d.MongoAPIError(`URI option "${e}" cannot be specified with no value`);_.has(e)||_.set(e,t)}const v=new I(Object.entries(i).filter((([,e])=>null!=e)));if(_.has("serverApi"))throw new d.MongoParseError("URI cannot contain `serverApi`, it can only be passed to the client");const E=_.get("authMechanismProperties");if(E)for(const e of E)if(/(^|,)ALLOWED_HOSTS:/.test(e))throw new d.MongoParseError("Auth mechanism property ALLOWED_HOSTS is not allowed in the connection string.");if(v.has("loadBalanced"))throw new d.MongoParseError("loadBalanced is only a valid option in the URI");const S=new I,w=new Set([..._.keys(),...v.keys()]);for(const e of w){const t=[],n=v.get(e);null!=n&&t.push(n);const r=_.get(e)??[];t.push(...r),S.set(e,t)}if(S.has("tls")||S.has("ssl")){const e=(S.get("tls")||[]).concat(S.get("ssl")||[]).map(T.bind(null,"tls/ssl"));if(1!==new Set(e).size)throw new d.MongoParseError("All values of tls/ssl must be the same.")}!function(e){if(!e)return;const t=(t,n)=>{if(e.has(t)&&e.has(n))throw new d.MongoAPIError(`The '${t}' option cannot be used with the '${n}' option`)};t("tlsInsecure","tlsAllowInvalidCertificates"),t("tlsInsecure","tlsAllowInvalidHostnames")}(S);const C=(0,y.setDifference)(w,Array.from(Object.keys(t.OPTIONS)).map((e=>e.toLowerCase())));if(0!==C.size){const e=C.size>1?"options":"option",t=C.size>1?"are":"is";throw new d.MongoParseError(`${e} ${Array.from(C).join(", ")} ${t} not supported`)}for(const[e,n]of Object.entries(t.OPTIONS)){const r=S.get(e);if(r&&0!==r.length){const{deprecated:t}=n;if(t){const n="string"==typeof t?`: ${t}`:"";(0,y.emitWarning)(`${e} is a deprecated option${n}`)}k(g,e,n,r)}else t.DEFAULT_OPTIONS.has(e)&&k(g,e,n,[t.DEFAULT_OPTIONS.get(e)])}if(g.credentials){const e=g.credentials.mechanism===u.AuthMechanism.MONGODB_GSSAPI,t=g.credentials.mechanism===u.AuthMechanism.MONGODB_X509,n=g.credentials.mechanism===u.AuthMechanism.MONGODB_AWS,r=g.credentials.mechanism===u.AuthMechanism.MONGODB_OIDC;if((e||t)&&S.has("authSource")&&"$external"!==g.credentials.source)throw new d.MongoParseError(`authMechanism ${g.credentials.mechanism} requires an authSource of '$external'`);if(e||t||n||r||!g.dbName||S.has("authSource")||(g.credentials=a.MongoCredentials.merge(g.credentials,{source:g.dbName})),n&&g.credentials.username&&!g.credentials.password)throw new d.MongoMissingCredentialsError(`When using ${g.credentials.mechanism} password must be set when a username is specified`);g.credentials.validate(),""===g.credentials.password&&""===g.credentials.username&&g.credentials.mechanism===u.AuthMechanism.MONGODB_DEFAULT&&0===Object.keys(g.credentials.mechanismProperties).length&&delete g.credentials}if(g.dbName||(g.dbName="test"),x(l,g,m),n&&g.autoEncryption&&(h.Encrypter.checkForMongoCrypt(),g.encrypter=new h.Encrypter(n,e,i),g.autoEncrypter=g.encrypter.autoEncrypter),g.userSpecifiedAuthSource=v.has("authSource")||_.has("authSource"),g.userSpecifiedReplicaSet=v.has("replicaSet")||_.has("replicaSet"),m){if(g.srvHost=l[0],g.directConnection)throw new d.MongoAPIError("SRV URI does not support directConnection");if(g.srvMaxHosts>0&&"string"==typeof g.replicaSet)throw new d.MongoParseError("Cannot use srvMaxHosts option with replicaSet");const e=!v.has("tls")&&!_.has("tls"),t=!v.has("ssl")&&!_.has("ssl");e&&t&&(g.tls=!0)}else if(_.has("srvMaxHosts")||v.has("srvMaxHosts")||_.has("srvServiceName")||v.has("srvServiceName"))throw new d.MongoParseError("Cannot use srvMaxHosts or srvServiceName with a non-srv connection string");if(g.directConnection&&1!==g.hosts.length)throw new d.MongoParseError("directConnection option requires exactly one host");if(!g.proxyHost&&(g.proxyPort||g.proxyUsername||g.proxyPassword))throw new d.MongoParseError("Must specify proxyHost if other proxy options are passed");if(g.proxyUsername&&!g.proxyPassword||!g.proxyUsername&&g.proxyPassword)throw new d.MongoParseError("Can only specify both of proxy username/password or neither");if(["proxyHost","proxyPort","proxyUsername","proxyPassword"].map((e=>_.get(e)??[])).some((e=>e.length>1)))throw new d.MongoParseError("Proxy options cannot be specified multiple times in the connection string");return g.mongoLoggerOptions=p.MongoLogger.resolveOptions({MONGODB_LOG_COMMAND:r.env.MONGODB_LOG_COMMAND,MONGODB_LOG_TOPOLOGY:r.env.MONGODB_LOG_TOPOLOGY,MONGODB_LOG_SERVER_SELECTION:r.env.MONGODB_LOG_SERVER_SELECTION,MONGODB_LOG_CONNECTION:r.env.MONGODB_LOG_CONNECTION,MONGODB_LOG_CLIENT:r.env.MONGODB_LOG_CLIENT,MONGODB_LOG_ALL:r.env.MONGODB_LOG_ALL,MONGODB_LOG_MAX_DOCUMENT_LENGTH:r.env.MONGODB_LOG_MAX_DOCUMENT_LENGTH,MONGODB_LOG_PATH:r.env.MONGODB_LOG_PATH},{mongodbLogPath:g.mongodbLogPath,mongodbLogComponentSeverities:g.mongodbLogComponentSeverities,mongodbLogMaxDocumentLength:g.mongodbLogMaxDocumentLength}),g.additionalDriverInfo=[],g.metadata=(0,c.makeClientMetadata)(g),g.extendedMetadata=(0,c.addContainerMetadata)(g.metadata).then(void 0,y.squashError),g};const i=n(95136),o=n(65031),s=n(9606),a=n(91566),u=n(93065),c=n(56463),l=n(64515),h=n(48758),d=n(17562),f=n(22220),p=n(93347),m=n(28541),g=n(13700),_=n(57590),y=n(145),v=n(40012),E=["authSource","replicaSet","loadBalanced"],S="loadBalanced option only supported with a single host in the URI",w="loadBalanced option not supported with a replicaSet option",C="loadBalanced option not supported when directConnection is provided";function O(e){return async function(t){try{return await i.promises[e](t)}catch(n){if(n.code===i.TIMEOUT)return await i.promises[e](t);throw n}}}const b=O("resolveSrv"),M=O("resolveTxt");function T(e,t){if("boolean"==typeof t)return t;switch(t){case"true":return!0;case"false":return!1;default:throw new d.MongoParseError(`${e} must be either "true" or "false"`)}}function A(e,t){const n=(0,y.parseInteger)(t);if(null!=n)return n;throw new d.MongoParseError(`Expected ${e} to be stringified int value, got: ${t}`)}function R(e,t){const n=A(e,t);if(n<0)throw new d.MongoParseError(`${e} can only be a positive int value, got: ${t}`);return n}function*N(e){if(""===e)return;const t=e.split(",");for(const e of t){const[t,n]=e.split(/:(.*)/);if(null==n)throw new d.MongoParseError("Cannot have undefined values in key value pairs");yield[t,n]}}class I extends Map{constructor(e=[]){super(e.map((([e,t])=>[e.toLowerCase(),t])))}has(e){return super.has(e.toLowerCase())}get(e){return super.get(e.toLowerCase())}set(e,t){return super.set(e.toLowerCase(),t)}delete(e){return super.delete(e.toLowerCase())}}function x(e,t,n){if(t.loadBalanced){if(e.length>1)throw new d.MongoParseError(S);if(t.replicaSet)throw new d.MongoParseError(w);if(t.directConnection)throw new d.MongoParseError(C);if(n&&t.srvMaxHosts>0)throw new d.MongoParseError("Cannot limit srv hosts with loadBalanced enabled")}}function k(e,t,n,r){const{target:i,type:o,transform:s}=n,a=i??t;switch(o){case"boolean":e[a]=T(a,r[0]);break;case"int":e[a]=A(a,r[0]);break;case"uint":e[a]=R(a,r[0]);break;case"string":if(null==r[0])break;e[a]=String(r[0]);break;case"record":if(!(0,y.isRecord)(r[0]))throw new d.MongoParseError(`${a} must be an object`);e[a]=r[0];break;case"any":e[a]=r[0];break;default:{if(!s)throw new d.MongoParseError("Descriptors missing a type must define a transform");const t=s({name:a,options:e,values:r});e[a]=t;break}}}t.OPTIONS={appName:{type:"string"},auth:{target:"credentials",transform({name:e,options:t,values:[n]}){if(!(0,y.isRecord)(n,["username","password"]))throw new d.MongoParseError(`${e} must be an object with 'username' and 'password' properties`);return a.MongoCredentials.merge(t.credentials,{username:n.username,password:n.password})}},authMechanism:{target:"credentials",transform({options:e,values:[t]}){const n=Object.values(u.AuthMechanism),[r]=n.filter((e=>e.match(RegExp(String.raw`\b${t}\b`,"i"))));if(!r)throw new d.MongoParseError(`authMechanism one of ${n}, got ${t}`);let i=e.credentials?.source;(r===u.AuthMechanism.MONGODB_PLAIN||u.AUTH_MECHS_AUTH_SRC_EXTERNAL.has(r))&&(i="$external");let o=e.credentials?.password;return r===u.AuthMechanism.MONGODB_X509&&""===o&&(o=void 0),a.MongoCredentials.merge(e.credentials,{mechanism:r,source:i,password:o})}},authMechanismProperties:{target:"credentials",transform({options:e,values:t}){let n=Object.create(null);for(const e of t)if("string"==typeof e)for(const[t,r]of N(e))try{n[t]=T(t,r)}catch{n[t]=r}else{if(!(0,y.isRecord)(e))throw new d.MongoParseError("AuthMechanismProperties must be an object");n={...e}}return a.MongoCredentials.merge(e.credentials,{mechanismProperties:n})}},authSource:{target:"credentials",transform({options:e,values:[t]}){const n=String(t);return a.MongoCredentials.merge(e.credentials,{source:n})}},autoEncryption:{type:"record"},autoSelectFamily:{type:"boolean",default:!0},autoSelectFamilyAttemptTimeout:{type:"uint"},bsonRegExp:{type:"boolean"},serverApi:{target:"serverApi",transform({values:[e]}){const t="string"==typeof e?{version:e}:e,n=t&&t.version;if(!n)throw new d.MongoParseError(`Invalid \`serverApi\` property; must specify a version from the following enum: ["${Object.values(f.ServerApiVersion).join('", "')}"]`);if(!Object.values(f.ServerApiVersion).some((e=>e===n)))throw new d.MongoParseError(`Invalid server API version=${n}; must be in the following enum: ["${Object.values(f.ServerApiVersion).join('", "')}"]`);return t}},checkKeys:{type:"boolean"},compressors:{default:"none",target:"compressors",transform({values:e}){const t=new Set;for(const n of e){const e="string"==typeof n?n.split(","):n;if(!Array.isArray(e))throw new d.MongoInvalidArgumentError("compressors must be an array or a comma-delimited list of strings");for(const n of e){if(!Object.keys(l.Compressor).includes(String(n)))throw new d.MongoInvalidArgumentError(`${n} is not a valid compression mechanism. Must be one of: ${Object.keys(l.Compressor)}.`);t.add(String(n))}}return[...t]}},connectTimeoutMS:{default:3e4,type:"uint"},dbName:{type:"string"},directConnection:{default:!1,type:"boolean"},driverInfo:{default:{},type:"record"},enableUtf8Validation:{type:"boolean",default:!0},family:{transform({name:e,values:[t]}){const n=A(e,t);if(4===n||6===n)return n;throw new d.MongoParseError(`Option 'family' must be 4 or 6 got ${n}.`)}},fieldsAsRaw:{type:"record"},forceServerObjectId:{default:!1,type:"boolean"},fsync:{deprecated:"Please use journal instead",target:"writeConcern",transform({name:e,options:t,values:[n]}){const r=v.WriteConcern.fromOptions({writeConcern:{...t.writeConcern,fsync:T(e,n)}});if(!r)throw new d.MongoParseError(`Unable to make a writeConcern from fsync=${n}`);return r}},heartbeatFrequencyMS:{default:1e4,type:"uint"},ignoreUndefined:{type:"boolean"},j:{deprecated:"Please use journal instead",target:"writeConcern",transform({name:e,options:t,values:[n]}){const r=v.WriteConcern.fromOptions({writeConcern:{...t.writeConcern,journal:T(e,n)}});if(!r)throw new d.MongoParseError(`Unable to make a writeConcern from journal=${n}`);return r}},journal:{target:"writeConcern",transform({name:e,options:t,values:[n]}){const r=v.WriteConcern.fromOptions({writeConcern:{...t.writeConcern,journal:T(e,n)}});if(!r)throw new d.MongoParseError(`Unable to make a writeConcern from journal=${n}`);return r}},loadBalanced:{default:!1,type:"boolean"},localThresholdMS:{default:15,type:"uint"},maxConnecting:{default:2,transform({name:e,values:[t]}){const n=R(e,t);if(0===n)throw new d.MongoInvalidArgumentError("maxConnecting must be > 0 if specified");return n}},maxIdleTimeMS:{default:0,type:"uint"},maxPoolSize:{default:100,type:"uint"},maxStalenessSeconds:{target:"readPreference",transform({name:e,options:t,values:[n]}){const r=R(e,n);return t.readPreference?g.ReadPreference.fromOptions({readPreference:{...t.readPreference,maxStalenessSeconds:r}}):new g.ReadPreference("secondary",void 0,{maxStalenessSeconds:r})}},minInternalBufferSize:{type:"uint"},minPoolSize:{default:0,type:"uint"},minHeartbeatFrequencyMS:{default:500,type:"uint"},monitorCommands:{default:!1,type:"boolean"},name:{target:"driverInfo",transform:({values:[e],options:t})=>({...t.driverInfo,name:String(e)})},noDelay:{default:!0,type:"boolean"},pkFactory:{default:y.DEFAULT_PK_FACTORY,transform({values:[e]}){if((0,y.isRecord)(e,["createPk"])&&"function"==typeof e.createPk)return e;throw new d.MongoParseError(`Option pkFactory must be an object with a createPk function, got ${e}`)}},promoteBuffers:{type:"boolean"},promoteLongs:{type:"boolean"},promoteValues:{type:"boolean"},useBigInt64:{type:"boolean"},proxyHost:{type:"string"},proxyPassword:{type:"string"},proxyPort:{type:"uint"},proxyUsername:{type:"string"},raw:{default:!1,type:"boolean"},readConcern:{transform({values:[e],options:t}){if(e instanceof m.ReadConcern||(0,y.isRecord)(e,["level"]))return m.ReadConcern.fromOptions({...t.readConcern,...e});throw new d.MongoParseError(`ReadConcern must be an object, got ${JSON.stringify(e)}`)}},readConcernLevel:{target:"readConcern",transform:({values:[e],options:t})=>m.ReadConcern.fromOptions({...t.readConcern,level:e})},readPreference:{default:g.ReadPreference.primary,transform({values:[e],options:t}){if(e instanceof g.ReadPreference)return g.ReadPreference.fromOptions({readPreference:{...t.readPreference,...e},...e});if((0,y.isRecord)(e,["mode"])){const n=g.ReadPreference.fromOptions({readPreference:{...t.readPreference,...e},...e});if(n)return n;throw new d.MongoParseError(`Cannot make read preference from ${JSON.stringify(e)}`)}if("string"==typeof e){const n={hedge:t.readPreference?.hedge,maxStalenessSeconds:t.readPreference?.maxStalenessSeconds};return new g.ReadPreference(e,t.readPreference?.tags,n)}throw new d.MongoParseError(`Unknown ReadPreference value: ${e}`)}},readPreferenceTags:{target:"readPreference",transform({values:e,options:t}){const n=Array.isArray(e[0])?e[0]:e,r=[];for(const e of n){const t=Object.create(null);if("string"==typeof e)for(const[n,r]of N(e))t[n]=r;if((0,y.isRecord)(e))for(const[n,r]of Object.entries(e))t[n]=r;r.push(t)}return g.ReadPreference.fromOptions({readPreference:t.readPreference,readPreferenceTags:r})}},replicaSet:{type:"string"},retryReads:{default:!0,type:"boolean"},retryWrites:{default:!0,type:"boolean"},serializeFunctions:{type:"boolean"},serverMonitoringMode:{default:"auto",transform({values:[e]}){if(!Object.values(_.ServerMonitoringMode).includes(e))throw new d.MongoParseError("serverMonitoringMode must be one of `auto`, `poll`, or `stream`");return e}},serverSelectionTimeoutMS:{default:3e4,type:"uint"},servername:{type:"string"},socketTimeoutMS:{default:0,type:"uint"},srvMaxHosts:{type:"uint",default:0},srvServiceName:{type:"string",default:"mongodb"},ssl:{target:"tls",type:"boolean"},timeoutMS:{type:"uint"},tls:{type:"boolean"},tlsAllowInvalidCertificates:{target:"rejectUnauthorized",transform:({name:e,values:[t]})=>!T(e,t)},tlsAllowInvalidHostnames:{target:"checkServerIdentity",transform:({name:e,values:[t]})=>T(e,t)?()=>{}:void 0},tlsCAFile:{type:"string"},tlsCRLFile:{type:"string"},tlsCertificateKeyFile:{type:"string"},tlsCertificateKeyFilePassword:{target:"passphrase",type:"any"},tlsInsecure:{transform({name:e,options:t,values:[n]}){const r=T(e,n);return r?(t.checkServerIdentity=()=>{},t.rejectUnauthorized=!1):(t.checkServerIdentity=t.tlsAllowInvalidHostnames?()=>{}:void 0,t.rejectUnauthorized=!t.tlsAllowInvalidCertificates),r}},w:{target:"writeConcern",transform:({values:[e],options:t})=>v.WriteConcern.fromOptions({writeConcern:{...t.writeConcern,w:e}})},waitQueueTimeoutMS:{default:0,type:"uint"},writeConcern:{target:"writeConcern",transform({values:[e],options:t}){if((0,y.isRecord)(e)||e instanceof v.WriteConcern)return v.WriteConcern.fromOptions({writeConcern:{...t.writeConcern,...e}});if("majority"===e||"number"==typeof e)return v.WriteConcern.fromOptions({writeConcern:{...t.writeConcern,w:e}});throw new d.MongoParseError(`Invalid WriteConcern cannot parse: ${JSON.stringify(e)}`)}},wtimeout:{deprecated:"Please use wtimeoutMS instead",target:"writeConcern",transform({values:[e],options:t}){const n=v.WriteConcern.fromOptions({writeConcern:{...t.writeConcern,wtimeout:R("wtimeout",e)}});if(n)return n;throw new d.MongoParseError("Cannot make WriteConcern from wtimeout")}},wtimeoutMS:{target:"writeConcern",transform({values:[e],options:t}){const n=v.WriteConcern.fromOptions({writeConcern:{...t.writeConcern,wtimeoutMS:R("wtimeoutMS",e)}});if(n)return n;throw new d.MongoParseError("Cannot make WriteConcern from wtimeout")}},zlibCompressionLevel:{default:0,type:"int"},mongodbLogPath:{transform({values:[e]}){if(!("string"==typeof e&&["stderr","stdout"].includes(e)||e&&"object"==typeof e&&"write"in e&&"function"==typeof e.write))throw new d.MongoAPIError("Option 'mongodbLogPath' must be of type 'stderr' | 'stdout' | MongoDBLogWritable");return e}},mongodbLogComponentSeverities:{transform({values:[e]}){if("object"!=typeof e||!e)throw new d.MongoAPIError("Option 'mongodbLogComponentSeverities' must be a non-null object");for(const[t,n]of Object.entries(e)){if("string"!=typeof n||"string"!=typeof t)throw new d.MongoAPIError("User input for option 'mongodbLogComponentSeverities' object cannot include a non-string key or value");if(!Object.values(p.MongoLoggableComponent).some((e=>e===t))&&"default"!==t)throw new d.MongoAPIError(`User input for option 'mongodbLogComponentSeverities' contains invalid key: ${t}`);if(!Object.values(p.SeverityLevel).some((e=>e===n)))throw new d.MongoAPIError(`Option 'mongodbLogComponentSeverities' does not support ${n} as a value for ${t}`)}return e}},mongodbLogMaxDocumentLength:{type:"uint"},connectionType:{type:"any"},srvPoller:{type:"any"},allowPartialTrustChain:{type:"any"},minDHSize:{type:"any"},pskCallback:{type:"any"},secureContext:{type:"any"},enableTrace:{type:"any"},requestCert:{type:"any"},rejectUnauthorized:{type:"any"},checkServerIdentity:{type:"any"},keepAliveInitialDelay:{type:"any"},ALPNProtocols:{type:"any"},SNICallback:{type:"any"},session:{type:"any"},requestOCSP:{type:"any"},localAddress:{type:"any"},localPort:{type:"any"},hints:{type:"any"},lookup:{type:"any"},ca:{type:"any"},cert:{type:"any"},ciphers:{type:"any"},crl:{type:"any"},ecdhCurve:{type:"any"},key:{type:"any"},passphrase:{type:"any"},pfx:{type:"any"},secureProtocol:{type:"any"},index:{type:"any"},useNewUrlParser:{type:"boolean",deprecated:"useNewUrlParser has no effect since Node.js Driver version 4.0.0 and will be removed in the next major version"},useUnifiedTopology:{type:"boolean",deprecated:"useUnifiedTopology has no effect since Node.js Driver version 4.0.0 and will be removed in the next major version"},__skipPingOnConnect:{type:"boolean"}},t.DEFAULT_OPTIONS=new I(Object.entries(t.OPTIONS).filter((([,e])=>null!=e.default)).map((([e,t])=>[e,t.default])))},6987:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ClientBulkWriteResultsMerger=void 0;const r=n(16360),i=n(17562),o={acknowledged:!1,insertedCount:0,upsertedCount:0,matchedCount:0,modifiedCount:0,deletedCount:0,insertResults:void 0,updateResults:void 0,deleteResults:void 0};t.ClientBulkWriteResultsMerger=class{static unacknowledged(){return o}constructor(e){this.options=e,this.currentBatchOffset=0,this.writeConcernErrors=[],this.writeErrors=new Map,this.result={acknowledged:!0,insertedCount:0,upsertedCount:0,matchedCount:0,modifiedCount:0,deletedCount:0,insertResults:void 0,updateResults:void 0,deleteResults:void 0},e.verboseResults&&(this.result.insertResults=new Map,this.result.updateResults=new Map,this.result.deleteResults=new Map)}get bulkWriteResult(){return{acknowledged:this.result.acknowledged,insertedCount:this.result.insertedCount,upsertedCount:this.result.upsertedCount,matchedCount:this.result.matchedCount,modifiedCount:this.result.modifiedCount,deletedCount:this.result.deletedCount,insertResults:this.result.insertResults,updateResults:this.result.updateResults,deleteResults:this.result.deleteResults}}async merge(e){let t;try{for await(const t of e)if(1===t.ok)this.options.verboseResults&&this.processDocument(e,t);else{if(this.options.ordered){const e=new i.MongoClientBulkWriteError({message:"Mongo client ordered bulk write encountered a write error."});throw e.writeErrors.set(t.idx+this.currentBatchOffset,{code:t.code,message:t.errmsg}),e.partialResult=this.result,e}this.writeErrors.set(t.idx+this.currentBatchOffset,{code:t.code,message:t.errmsg})}}catch(n){if(!(n instanceof r.MongoWriteConcernError))throw n;{const r=n.result;if(t={insertedCount:r.nInserted,upsertedCount:r.nUpserted,matchedCount:r.nMatched,modifiedCount:r.nModified,deletedCount:r.nDeleted,writeConcernError:r.writeConcernError},this.options.verboseResults&&r.cursor.firstBatch)for(const t of r.cursor.firstBatch)1===t.ok&&this.processDocument(e,t)}}finally{if(e.response){const t=e.response;this.incrementCounts(t)}this.currentBatchOffset+=e.operations.length}if(t){const e=t.writeConcernError;this.incrementCounts(t),this.writeConcernErrors.push({code:e.code,message:e.errmsg})}return this.result}processDocument(e,t){const n=e.operations[t.idx];if("insert"in n&&this.result.insertResults?.set(t.idx+this.currentBatchOffset,{insertedId:n.document._id}),"update"in n){const e={matchedCount:t.n,modifiedCount:t.nModified??0,didUpsert:null!=t.upserted};t.upserted&&(e.upsertedId=t.upserted._id),this.result.updateResults?.set(t.idx+this.currentBatchOffset,e)}"delete"in n&&this.result.deleteResults?.set(t.idx+this.currentBatchOffset,{deletedCount:t.n})}incrementCounts(e){this.result.insertedCount+=e.insertedCount,this.result.upsertedCount+=e.upsertedCount,this.result.matchedCount+=e.matchedCount,this.result.modifiedCount+=e.modifiedCount,this.result.deletedCount+=e.deletedCount}}},7180:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ClientBulkWriteCursor=void 0;const r=n(34080),i=n(96357),o=n(145),s=n(61066);class a extends s.AbstractCursor{constructor(e,t,n={}){super(e,new o.MongoDBNamespace("admin","$cmd"),n),this.commandBuilder=t,this.clientBulkWriteOptions=n}get response(){return this.cursorResponse?this.cursorResponse:null}get operations(){return this.commandBuilder.lastOperations}clone(){const e=(0,o.mergeOptions)({},this.clientBulkWriteOptions);return delete e.session,new a(this.client,this.commandBuilder,{...e})}async _initialize(e){const t=new r.ClientBulkWriteOperation(this.commandBuilder,{...this.clientBulkWriteOptions,...this.cursorOptions,session:e}),n=await(0,i.executeOperation)(this.client,t,this.timeoutContext);return this.cursorResponse=n,{server:t.server,session:e,response:n}}}t.ClientBulkWriteCursor=a},7799:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.LegacyTimeoutContext=t.CSOTTimeoutContext=t.TimeoutContext=t.Timeout=t.TimeoutError=void 0;const r=n(37668),i=n(17562),o=n(145);class s extends Error{get name(){return"TimeoutError"}constructor(e,t){super(e,t),this.duration=t.duration}static is(e){return null!=e&&"object"==typeof e&&"name"in e&&"TimeoutError"===e.name}}t.TimeoutError=s;class a extends Promise{get remainingTime(){return this.timedOut?0:0===this.duration?1/0:this.start+this.duration-Math.trunc(performance.now())}get timeElapsed(){return Math.trunc(performance.now())-this.start}constructor(e=()=>null,t){const n=t?.duration??0,a=!!t?.unref,u=t?.rejection;if(n<0)throw new i.MongoInvalidArgumentError("Cannot create a Timeout with a negative duration");let c;super(((t,n)=>{c=n,e(o.noop,n)})),this.ended=null,this.timedOut=!1,this.cleared=!1,this.duration=n,this.start=Math.trunc(performance.now()),null==u&&this.duration>0?(this.id=(0,r.setTimeout)((()=>{this.ended=Math.trunc(performance.now()),this.timedOut=!0,c(new s(`Expired after ${n}ms`,{duration:n}))}),this.duration),"function"==typeof this.id.unref&&a&&this.id.unref()):null!=u&&(this.ended=Math.trunc(performance.now()),this.timedOut=!0,c(u))}clear(){(0,r.clearTimeout)(this.id),this.id=void 0,this.timedOut=!1,this.cleared=!0}throwIfExpired(){if(this.timedOut)throw this.then(void 0,o.squashError),new s("Timed out",{duration:this.duration})}static expires(e,t){return new a(void 0,{duration:e,unref:t})}static reject(e){return new a(void 0,{duration:0,unref:!0,rejection:e})}}t.Timeout=a;class u{static create(e){if(null!=e.session?.timeoutContext)return e.session?.timeoutContext;if(null!=(t=e)&&"object"==typeof t&&"serverSelectionTimeoutMS"in t&&"number"==typeof t.serverSelectionTimeoutMS&&"timeoutMS"in t&&"number"==typeof t.timeoutMS)return new c(e);if(function(e){return null!=e&&"object"==typeof e&&"serverSelectionTimeoutMS"in e&&"number"==typeof e.serverSelectionTimeoutMS&&"waitQueueTimeoutMS"in e&&"number"==typeof e.waitQueueTimeoutMS}(e))return new l(e);throw new i.MongoRuntimeError("Unrecognized options");var t}}t.TimeoutContext=u;class c extends u{constructor(e){super(),this.minRoundTripTime=0,this.start=Math.trunc(performance.now()),this.timeoutMS=e.timeoutMS,this.serverSelectionTimeoutMS=e.serverSelectionTimeoutMS,this.socketTimeoutMS=e.socketTimeoutMS,this.clearServerSelectionTimeout=!1}get maxTimeMS(){return this.remainingTimeMS-this.minRoundTripTime}get remainingTimeMS(){const e=Math.trunc(performance.now())-this.start;return this.timeoutMS<=0?1/0:this.timeoutMS-e}csotEnabled(){return!0}get serverSelectionTimeout(){if("object"!=typeof this._serverSelectionTimeout||this._serverSelectionTimeout?.cleared){const{remainingTimeMS:e,serverSelectionTimeoutMS:t}=this;if(e<=0)return a.reject(new i.MongoOperationTimeoutError(`Timed out in server selection after ${this.timeoutMS}ms`));0!==t&&(0,o.csotMin)(e,t)===t?this._serverSelectionTimeout=a.expires(t):e>0&&Number.isFinite(e)?this._serverSelectionTimeout=a.expires(e):this._serverSelectionTimeout=null}return this._serverSelectionTimeout}get connectionCheckoutTimeout(){if("object"!=typeof this._connectionCheckoutTimeout||this._connectionCheckoutTimeout?.cleared){if("object"!=typeof this._serverSelectionTimeout)throw new i.MongoRuntimeError("Unreachable. If you are seeing this error, please file a ticket on the NODE driver project on Jira");this._connectionCheckoutTimeout=this._serverSelectionTimeout}return this._connectionCheckoutTimeout}get timeoutForSocketWrite(){const{remainingTimeMS:e}=this;return Number.isFinite(e)?e>0?a.expires(e):a.reject(new i.MongoOperationTimeoutError("Timed out before socket write")):null}get timeoutForSocketRead(){const{remainingTimeMS:e}=this;return Number.isFinite(e)?e>0?a.expires(e):a.reject(new i.MongoOperationTimeoutError("Timed out before socket read")):null}refresh(){this.start=Math.trunc(performance.now()),this.minRoundTripTime=0,this._serverSelectionTimeout?.clear(),this._connectionCheckoutTimeout?.clear()}clear(){this._serverSelectionTimeout?.clear(),this._connectionCheckoutTimeout?.clear()}getRemainingTimeMSOrThrow(e){const{remainingTimeMS:t}=this;if(t<=0)throw new i.MongoOperationTimeoutError(e??`Expired after ${this.timeoutMS}ms`);return t}clone(){const e=new c({timeoutMS:this.timeoutMS,serverSelectionTimeoutMS:this.serverSelectionTimeoutMS});return e.start=this.start,e}refreshed(){return new c(this)}addMaxTimeMSToCommand(e,t){if(t.omitMaxTimeMS)return;const n=this.remainingTimeMS-this.minRoundTripTime;n>0&&Number.isFinite(n)&&(e.maxTimeMS=n)}getSocketTimeoutMS(){return 0}}t.CSOTTimeoutContext=c;class l extends u{constructor(e){super(),this.options=e,this.clearServerSelectionTimeout=!0}csotEnabled(){return!1}get serverSelectionTimeout(){return null!=this.options.serverSelectionTimeoutMS&&this.options.serverSelectionTimeoutMS>0?a.expires(this.options.serverSelectionTimeoutMS):null}get connectionCheckoutTimeout(){return null!=this.options.waitQueueTimeoutMS&&this.options.waitQueueTimeoutMS>0?a.expires(this.options.waitQueueTimeoutMS):null}get timeoutForSocketWrite(){return null}get timeoutForSocketRead(){return null}refresh(){}clear(){}get maxTimeMS(){return null}refreshed(){return new l(this.options)}addMaxTimeMSToCommand(e,t){}getSocketTimeoutMS(){return this.options.socketTimeoutMS}}t.LegacyTimeoutContext=l},8294:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.TokenCache=void 0;const r=n(17562);class i extends r.MongoDriverError{}t.TokenCache=class{get hasAccessToken(){return!!this.accessToken}get hasRefreshToken(){return!!this.refreshToken}get hasIdpInfo(){return!!this.idpInfo}getAccessToken(){if(!this.accessToken)throw new i("Attempted to get an access token when none exists.");return this.accessToken}getRefreshToken(){if(!this.refreshToken)throw new i("Attempted to get a refresh token when none exists.");return this.refreshToken}getIdpInfo(){if(!this.idpInfo)throw new i("Attempted to get IDP information when none exists.");return this.idpInfo}put(e,t){this.accessToken=e.accessToken,this.refreshToken=e.refreshToken,this.expiresInSeconds=e.expiresInSeconds,t&&(this.idpInfo=t)}removeAccessToken(){this.accessToken=void 0}removeRefreshToken(){this.refreshToken=void 0}}},8500:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.aws4=void 0,t.getKerberos=function(){let e;try{e=n(96751)}catch(t){e=i(new r.MongoMissingDependencyError("Optional module `kerberos` not found. Please install it to enable kerberos authentication",{cause:t,dependencyName:"kerberos"}))}return e},t.getZstdLibrary=function(){let e;try{e=n(96751)}catch(t){e=i(new r.MongoMissingDependencyError("Optional module `@mongodb-js/zstd` not found. Please install it to enable zstd compression",{cause:t,dependencyName:"zstd"}))}return e},t.getAwsCredentialProvider=function(){try{return n(96751)}catch(e){return i(new r.MongoMissingDependencyError("Optional module `@aws-sdk/credential-providers` not found. Please install it to enable getting aws credentials via the official sdk.",{cause:e,dependencyName:"@aws-sdk/credential-providers"}))}},t.getGcpMetadata=function(){try{return n(96751)}catch(e){return i(new r.MongoMissingDependencyError("Optional module `gcp-metadata` not found. Please install it to enable getting gcp credentials via the official sdk.",{cause:e,dependencyName:"gcp-metadata"}))}},t.getSnappy=function(){try{return n(96751)}catch(e){return{kModuleError:new r.MongoMissingDependencyError("Optional module `snappy` not found. Please install it to enable snappy compression",{cause:e,dependencyName:"snappy"})}}},t.getSocks=function(){try{return n(96751)}catch(e){return{kModuleError:new r.MongoMissingDependencyError("Optional module `socks` not found. Please install it to connections over a SOCKS5 proxy",{cause:e,dependencyName:"socks"})}}},t.getMongoDBClientEncryption=function(){let e=null;try{e=n(96751)}catch(e){return{kModuleError:new r.MongoMissingDependencyError("Optional module `mongodb-client-encryption` not found. Please install it to use auto encryption or ClientEncryption.",{cause:e,dependencyName:"mongodb-client-encryption"})}}return e};const r=n(17562);function i(e){return new Proxy(e?{kModuleError:e}:{},{get:(t,n)=>{if("kModuleError"===n)return e;throw e},set:()=>{throw e}})}t.aws4=function(){let e;try{e=n(96751)}catch(t){e=i(new r.MongoMissingDependencyError("Optional module `aws4` not found. Please install it to enable AWS authentication",{cause:t,dependencyName:"aws4"}))}return e}()},9188:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ServerDescription=void 0,t.parseServerType=c,t.compareTopologyVersion=l;const r=n(75080),i=n(17562),o=n(145),s=n(89167),a=new Set([s.ServerType.RSPrimary,s.ServerType.Standalone,s.ServerType.Mongos,s.ServerType.LoadBalancer]),u=new Set([s.ServerType.RSPrimary,s.ServerType.RSSecondary,s.ServerType.Mongos,s.ServerType.Standalone,s.ServerType.LoadBalancer]);function c(e,t){return t?.loadBalanced?s.ServerType.LoadBalancer:e&&e.ok?e.isreplicaset?s.ServerType.RSGhost:e.msg&&"isdbgrid"===e.msg?s.ServerType.Mongos:e.setName?e.hidden?s.ServerType.RSOther:e.isWritablePrimary?s.ServerType.RSPrimary:e.secondary?s.ServerType.RSSecondary:e.arbiterOnly?s.ServerType.RSArbiter:s.ServerType.RSOther:s.ServerType.Standalone:s.ServerType.Unknown}function l(e,t){if(null==e||null==t)return-1;if(!e.processId.equals(t.processId))return-1;const n="bigint"==typeof e.counter?r.Long.fromBigInt(e.counter):r.Long.isLong(e.counter)?e.counter:r.Long.fromNumber(e.counter),i="bigint"==typeof t.counter?r.Long.fromBigInt(t.counter):r.Long.isLong(t.counter)?t.counter:r.Long.fromNumber(t.counter);return n.compare(i)}t.ServerDescription=class{constructor(e,t,n={}){if(null==e||""===e)throw new i.MongoRuntimeError("ServerDescription must be provided with a non-empty address");this.address="string"==typeof e?o.HostAddress.fromString(e).toString():e.toString(),this.type=c(t,n),this.hosts=t?.hosts?.map((e=>e.toLowerCase()))??[],this.passives=t?.passives?.map((e=>e.toLowerCase()))??[],this.arbiters=t?.arbiters?.map((e=>e.toLowerCase()))??[],this.tags=t?.tags??{},this.minWireVersion=t?.minWireVersion??0,this.maxWireVersion=t?.maxWireVersion??0,this.roundTripTime=n?.roundTripTime??-1,this.minRoundTripTime=n?.minRoundTripTime??0,this.lastUpdateTime=(0,o.now)(),this.lastWriteDate=t?.lastWrite?.lastWriteDate??0,this.error=n.error??null,this.error,this.topologyVersion=this.error?.topologyVersion??t?.topologyVersion??null,this.setName=t?.setName??null,this.setVersion=t?.setVersion??null,this.electionId=t?.electionId??null,this.logicalSessionTimeoutMinutes=t?.logicalSessionTimeoutMinutes??null,this.maxMessageSizeBytes=t?.maxMessageSizeBytes??null,this.maxWriteBatchSize=t?.maxWriteBatchSize??null,this.maxBsonObjectSize=t?.maxBsonObjectSize??null,this.primary=t?.primary??null,this.me=t?.me?.toLowerCase()??null,this.$clusterTime=t?.$clusterTime??null,this.iscryptd=Boolean(t?.iscryptd)}get hostAddress(){return o.HostAddress.fromString(this.address)}get allHosts(){return this.hosts.concat(this.arbiters).concat(this.passives)}get isReadable(){return this.type===s.ServerType.RSSecondary||this.isWritable}get isDataBearing(){return u.has(this.type)}get isWritable(){return a.has(this.type)}get host(){const e=`:${this.port}`.length;return this.address.slice(0,-e)}get port(){const e=this.address.split(":").pop();return e?Number.parseInt(e,10):27017}equals(e){const t=this.topologyVersion===e?.topologyVersion||0===l(this.topologyVersion,e?.topologyVersion),n=null!=this.electionId&&null!=e?.electionId?0===(0,o.compareObjectId)(this.electionId,e.electionId):this.electionId===e?.electionId;return null!=e&&e.iscryptd===this.iscryptd&&(0,o.errorStrictEqual)(this.error,e.error)&&this.type===e.type&&this.minWireVersion===e.minWireVersion&&(0,o.arrayStrictEqual)(this.hosts,e.hosts)&&function(e,t){const n=Object.keys(e),r=Object.keys(t);return n.length===r.length&&n.every((n=>t[n]===e[n]))}(this.tags,e.tags)&&this.setName===e.setName&&this.setVersion===e.setVersion&&n&&this.primary===e.primary&&this.logicalSessionTimeoutMinutes===e.logicalSessionTimeoutMinutes&&t}}},9284:(e,t,n)=>{var r=n(9606).URL;Object.defineProperty(t,"__esModule",{value:!0}),t.callback=void 0;const i=n(17562),o=n(145),s=Object.freeze({"Metadata-Flavor":"Google"});t.callback=async e=>{const t=e.tokenAudience;if(!t)throw new i.MongoGCPError("TOKEN_RESOURCE must be set in the auth mechanism properties when ENVIRONMENT is gcp.");return await async function(e){const t=new r("http://metadata/computeMetadata/v1/instance/service-accounts/default/identity");t.searchParams.append("audience",e);const n=await(0,o.get)(t,{headers:s});if(200!==n.status)throw new i.MongoGCPError(`Status code ${n.status} returned from the GCP endpoint. Response body: ${n.body}`);return{accessToken:n.body}}(t)}},9326:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.InsertOneOperation=t.InsertOperation=void 0;const r=n(75725),i=n(17562),o=n(145),s=n(78130),a=n(35394);class u extends s.CommandOperation{constructor(e,t,n){super(void 0,n),this.SERVER_COMMAND_RESPONSE_TYPE=r.MongoDBResponse,this.options={...n,checkKeys:n.checkKeys??!1},this.ns=e,this.documents=t}get commandName(){return"insert"}buildCommandDocument(e,t){const n=this.options??{},r="boolean"!=typeof n.ordered||n.ordered,i={insert:this.ns.collection,documents:this.documents,ordered:r};return"boolean"==typeof n.bypassDocumentValidation&&(i.bypassDocumentValidation=n.bypassDocumentValidation),void 0!==n.comment&&(i.comment=n.comment),i}}t.InsertOperation=u;class c extends u{constructor(e,t,n){super(e.s.namespace,[(0,o.maybeAddIdToDocuments)(e,t,n)],n)}handleOk(e){const t=super.handleOk(e);if(t.code)throw new i.MongoServerError(t);if(t.writeErrors)throw new i.MongoServerError(t.writeErrors[0]);return{acknowledged:0!==this.writeConcern?.w,insertedId:this.documents[0]._id}}}t.InsertOneOperation=c,(0,a.defineAspects)(u,[a.Aspect.RETRYABLE,a.Aspect.WRITE_OPERATION]),(0,a.defineAspects)(c,[a.Aspect.RETRYABLE,a.Aspect.WRITE_OPERATION])},10089:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.UnorderedBulkOperation=void 0;const r=n(75080),i=n(17562),o=n(54564);class s extends o.BulkOperationBase{constructor(e,t){super(e,t,!1)}handleWriteError(e){if(!this.s.batches.length)return super.handleWriteError(e)}addToOperationsList(e,t){const n=r.calculateObjectSize(t,{checkKeys:!1,ignoreUndefined:!1});if(n>=this.s.maxBsonObjectSize)throw new i.MongoInvalidArgumentError(`Document is larger than the maximum size ${this.s.maxBsonObjectSize}`);this.s.currentBatch=void 0,e===o.BatchType.INSERT?this.s.currentBatch=this.s.currentInsertBatch:e===o.BatchType.UPDATE?this.s.currentBatch=this.s.currentUpdateBatch:e===o.BatchType.DELETE&&(this.s.currentBatch=this.s.currentRemoveBatch);const s=this.s.maxKeySize;if(null==this.s.currentBatch&&(this.s.currentBatch=new o.Batch(e,this.s.currentIndex)),(this.s.currentBatch.size+1>=this.s.maxWriteBatchSize||this.s.currentBatch.size>0&&this.s.currentBatch.sizeBytes+s+n>=this.s.maxBatchSizeBytes||this.s.currentBatch.batchType!==e)&&(this.s.batches.push(this.s.currentBatch),this.s.currentBatch=new o.Batch(e,this.s.currentIndex)),Array.isArray(t))throw new i.MongoInvalidArgumentError("Operation passed in cannot be an Array");return this.s.currentBatch.operations.push(t),this.s.currentBatch.originalIndexes.push(this.s.currentIndex),this.s.currentIndex=this.s.currentIndex+1,e===o.BatchType.INSERT?(this.s.currentInsertBatch=this.s.currentBatch,this.s.bulkResult.insertedIds.push({index:this.s.bulkResult.insertedIds.length,_id:t._id})):e===o.BatchType.UPDATE?this.s.currentUpdateBatch=this.s.currentBatch:e===o.BatchType.DELETE&&(this.s.currentRemoveBatch=this.s.currentBatch),this.s.currentBatch.size+=1,this.s.currentBatch.sizeBytes+=s+n,this}}t.UnorderedBulkOperation=s},10324:(e,t,n)=>{var r,i,o;i=[t,n(36257),n(90198),n(88470)],void 0===(o="function"==typeof(r=function(e,t,n,r){var i,o,s,a,u,c,l,h,d,f,p,m,g,_,y,v,E,S,w,C,O,b,M,T,A,R,N,I,x,k,P,D,$,L,B,j,q,F,z,U,V,W,G,H,K,Y,Q,J,X,Z,ee,te,ne,re,ie,oe,se,ae,ue,ce,le,he,de,fe,pe,me,ge,_e,ye,ve,Ee,Se,we,Ce,Oe,be,Me,Te,Ae,Re,Ne,Ie,xe,ke,Pe,De,$e,Le,Be,je,qe,Fe,ze,Ue,Ve=Math.imul,We=t.$_$.x4,Ge=t.$_$.j4,He=t.$_$.c4,Ke=t.$_$.a5,Ye=t.$_$.e4,Qe=t.$_$.b,Je=t.$_$.k4,Xe=t.$_$.y3,Ze=t.$_$.u3,et=t.$_$.z3,tt=t.$_$.r2,nt=n.$_$.a,rt=t.$_$.h2,it=t.$_$.i2,ot=t.$_$.m2,st=t.$_$.e,at=t.$_$.d2,ut=t.$_$.s1,ct=t.$_$.h1,lt=t.$_$.q2,ht=t.$_$.u1,dt=t.$_$.f2,ft=t.$_$.l4,pt=t.$_$.h,mt=t.$_$.y4,gt=t.$_$.t,_t=t.$_$.t3,yt=t.$_$.b2,vt=(t.$_$.g1,t.$_$.s4),Et=t.$_$.a1,St=t.$_$.e5,wt=t.$_$.c1,Ct=t.$_$.d,Ot=t.$_$.z1,bt=t.$_$.z,Mt=t.$_$.r3,Tt=t.$_$.q4,At=t.$_$.o2,Rt=t.$_$.s3,Nt=t.$_$.i,It=t.$_$.q1,xt=t.$_$.g4,kt=t.$_$.n1,Pt=t.$_$.f4,Dt=t.$_$.i5,$t=t.$_$.j5,Lt=t.$_$.p2,Bt=t.$_$.j,jt=t.$_$.a4,qt=t.$_$.o4,Ft=t.$_$.x3,zt=t.$_$.k2,Ut=t.$_$.g5,Vt=t.$_$.u4,Wt=t.$_$.m3,Gt=t.$_$.h4,Ht=t.$_$.x1,Kt=t.$_$.k3,Yt=t.$_$.v2,Qt=t.$_$.d4,Jt=r.$_$.c,Xt=r.$_$.d,Zt=r.$_$.a,en=t.$_$.c2,tn=t.$_$.b4,nn=t.$_$.p3,rn=t.$_$.j2;function on(){return new We(-1,2147483647)}function sn(){}function an(){i=this,this.ep_1=new We(1,0)}function un(){return null==i&&new an,i}function cn(){}function ln(){s=this,this.fp_1=new We(2,0)}function hn(){}function dn(){u=this,this.gp_1=new We(-1,2147483647)}function fn(){}function pn(e){this.hp_1=e}function mn(){}function gn(){h=this,this.ip_1=new We(-1,2147483647)}function _n(){}function yn(){}function vn(e){this.jp_1=e}function En(e){this.kp_1=e;var t=this.kp_1.j();if(!t.k())throw gt();for(var n=t.l().dp();t.k();){var r=t.l().dp();_t(n,r)<0&&(n=r)}this.lp_1=n}function Sn(e,t,n){if(t.p())return n;var r,i=yt(t);try{var o=vt(i);r=Et(o)}catch(e){if(!(e instanceof Error))throw e;r=Et(St(e))}var s=wt(r),a=st();if(n instanceof pn)if(s){var u=Sn(e,t.a1(1,t.m()),n.hp_1);a.h(u)}else a.h(un());else if(n instanceof vn){var c=n.jp_1.f1(t.q(0)),l=null==c?null:Sn(e,t.a1(1,t.m()),c);a.h(null==l?un():l)}else if(n instanceof En){for(var h=n.kp_1,d=Ct(ht(h,10)),f=h.j();f.k();){var p=Sn(e,t,f.l());d.h(p)}a.n(d)}else a.h(un());return 1===a.m()?yt(a):new En(lt(a))}function wn(e,t,n){n=n===Qe?p.mp(Ot()):n,this.np_1=e,this.op_1=t,this.pp_1=n}function Cn(e,t,n,r){for(var i=t.j();i.k();)for(var o=i.l().h1().j();o.k();){var s,a=o.l(),u=a.b1(),c=a.c1(),l=0===Rt(r)?u:r+"."+u,h=n.f1(l);if(null==h){var d=Nt();n.a3(l,d),s=d}else s=h;var f=s;if(null!=c&&xt(c,It)){var p=f.f1(m),_=(null==p?0:p)+1|0;f.a3(m,_);for(var y=Ct(c.m()),v=c.h1().j();v.k();){var E=v.l(),S=$t(Dt(E.b1()),E.c1());y.h(S)}var w=Lt(y);Cn(e,at(w),n,l)}else if(null!=c&&Pt(c)){var C=f.f1(g),O=(null==C?0:C)+1|0;f.a3(g,O);for(var b=st(),M=0,T=c.length;M<T;){var A=c[M];M=M+1|0,null!=A&&xt(A,It)&&b.h(A)}Cn(e,b,n,l)}else if(null!=c&&xt(c,kt)){var R=f.f1(g),N=(null==R?0:R)+1|0;f.a3(g,N);for(var I=st(),x=c.j();x.k();){var k=x.l();null!=k&&xt(k,It)&&I.h(k)}Cn(e,I,n,l)}else{var P=f.f1(c),D=(null==P?0:P)+1|0;f.a3(c,D)}}}function On(e,t,n,r,i){return Cn(e,t,n,r=r===Qe?"":r)}function bn(e,t,n,r){for(var i=t.h1().j();i.k();){var o=i.l(),s=o.b1(),a=o.c1(),u=0===Rt(r)?s:r+"."+s;if(n.h(u),null!=a&&xt(a,It)){for(var c=Ct(a.m()),l=a.h1().j();l.k();){var h=l.l(),d=$t(Dt(h.b1()),h.c1());c.h(d)}bn(e,Lt(c),n,u)}else if(null!=a&&Pt(a)){for(var f=st(),m=0,g=a.length;m<g;){var _=a[m];m=m+1|0,null!=_&&xt(_,It)&&f.h(_)}for(var y=f.j();y.k();){var v=y.l();bn(p,v,n,u)}}else if(null!=a&&xt(a,kt)){for(var E=st(),S=a.j();S.k();){var w=S.l();null!=w&&xt(w,It)&&E.h(w)}for(var C=E.j();C.k();){var O=C.l();bn(p,O,n,u)}}}return n}function Mn(e,t,n,r,i){return bn(e,t,n=n===Qe?Bt():n,r=r===Qe?"":r)}function Tn(){}function An(e){this.rp_1=e}function Rn(){}function Nn(){}function In(){}function xn(){}function kn(e,t){this.vp_1=e,this.wp_1=t;var n,r=this.vp_1;if(qt(r))n=!1;else{var i=this.wp_1;n=!qt(i)}this.xp_1=n}function Pn(e,t){this.yp_1=e,this.zp_1=t}function Dn(){}function $n(e){jn.call(this),this.fq_1=e}function Ln(e){jn.call(this),this.hq_1=e}function Bn(){}function jn(){}function qn(){}function Fn(e,t,n,r){r=r===Qe?null:r,this.kq_1=e,this.lq_1=t,this.mq_1=n,this.nq_1=r}function zn(e){this.oq_1=e}function Un(e,t,n){n=n===Qe?t:n,this.pq_1=e,this.qq_1=t,this.rq_1=n}function Vn(e){this.sq_1=e}function Wn(e){this.tq_1=e}function Gn(){}function Hn(){}function Kn(e,t){this.uq_1=e,this.vq_1=t}function Yn(){}function Qn(e){this.wq_1=e}function Jn(){if(b)return ct;b=!0,E=new Xn("EQUALITY",0),S=new Xn("SORT",1),w=new Xn("RANGE",2),C=new Xn("UNION",3),O=new Xn("IRRELEVANT",4)}function Xn(e,t){Vt.call(this,e,t)}function Zn(e){this.ar_1=e}function er(){hi.call(this,"ALL",0,"all"),M=this}function tr(){hi.call(this,"AND",1,"and"),T=this}function nr(){hi.call(this,"BITS_ALL_CLEAR",2,"bitsAllClear"),A=this}function rr(){hi.call(this,"BITS_ALL_SET",3,"bitsAllSet"),R=this}function ir(){hi.call(this,"BITS_ANY_CLEAR",4,"bitsAnyClear"),N=this}function or(){hi.call(this,"BITS_ANY_SET",5,"bitsAnySet"),I=this}function sr(){hi.call(this,"COMBINE",6,"combine"),x=this}function ar(){hi.call(this,"ELEM_MATCH",7,"elementMatch"),k=this}function ur(){hi.call(this,"EQ",8,"eq"),P=this}function cr(){hi.call(this,"EXISTS",9,"exists"),D=this}function lr(){hi.call(this,"GEO_INTERSECTS",10,"geoIntersects"),$=this}function hr(){hi.call(this,"GEO_WITHIN",11,"geoWithin"),L=this}function dr(){hi.call(this,"GEO_WITHIN_BOX",12,"geoWithinBox"),B=this}function fr(){hi.call(this,"GEO_WITHIN_CENTER",13,"geoWithinCenter"),j=this}function pr(){hi.call(this,"GEO_WITHIN_CENTER_SPHERE",14,"geoWithinCenterSphere"),q=this}function mr(){hi.call(this,"GEO_WITHIN_POLYGON",15,"geoWithinPolygon"),F=this}function gr(){hi.call(this,"GT",16,"gt"),z=this}function _r(){hi.call(this,"GTE",17,"gte"),U=this}function yr(){hi.call(this,"IN",18,"in"),V=this}function vr(){hi.call(this,"INC",19,"inc"),W=this}function Er(){hi.call(this,"LT",20,"lt"),G=this}function Sr(){hi.call(this,"LTE",21,"lte"),H=this}function wr(){hi.call(this,"NE",22,"ne"),K=this}function Cr(){hi.call(this,"NEAR",23,"near"),Y=this}function Or(){hi.call(this,"NEAR_SPHERE",24,"nearSphere"),Q=this}function br(){hi.call(this,"NIN",25,"nin"),J=this}function Mr(){hi.call(this,"NOR",26,"nor"),X=this}function Tr(){hi.call(this,"NOT",27,"not"),Z=this}function Ar(){hi.call(this,"OR",28,"or"),ee=this}function Rr(){hi.call(this,"REGEX",29,"regex"),te=this}function Nr(){hi.call(this,"SET",30,"set"),ne=this}function Ir(){hi.call(this,"SET_ON_INSERT",31,"setOnInsert"),re=this}function xr(){hi.call(this,"SIZE",32,"size"),ie=this}function kr(){hi.call(this,"TEXT",33,"text"),oe=this}function Pr(){hi.call(this,"TYPE",34,"type"),se=this}function Dr(){hi.call(this,"UNSET",35,"unset"),ae=this}function $r(){hi.call(this,"MATCH",36,"match"),ue=this}function Lr(){hi.call(this,"PROJECT",37,"project"),ce=this}function Br(){hi.call(this,"INCLUDE",38,"include"),le=this}function jr(){hi.call(this,"EXCLUDE",39,"exclude"),he=this}function qr(){hi.call(this,"GROUP",40,"group"),de=this}function Fr(){hi.call(this,"SUM",41,"sum"),fe=this}function zr(){hi.call(this,"AVG",42,"avg"),pe=this}function Ur(){hi.call(this,"FIRST",43,"first"),me=this}function Vr(){hi.call(this,"LAST",44,"last"),ge=this}function Wr(){hi.call(this,"TOP",45,"top"),_e=this}function Gr(){hi.call(this,"TOP_N",46,"topN"),ye=this}function Hr(){hi.call(this,"BOTTOM",47,"bottom"),ve=this}function Kr(){hi.call(this,"BOTTOM_N",48,"bottomN"),Ee=this}function Yr(){hi.call(this,"MAX",49,"max"),Se=this}function Qr(){hi.call(this,"MIN",50,"min"),we=this}function Jr(){hi.call(this,"PUSH",51,"push"),Ce=this}function Xr(){hi.call(this,"PULL",52,"pull"),Oe=this}function Zr(){hi.call(this,"PULL_ALL",53,"pullAll"),be=this}function ei(){hi.call(this,"POP",54,"pop"),Me=this}function ti(){hi.call(this,"ADD_TO_SET",55,"addToSet"),Te=this}function ni(){hi.call(this,"SORT",56,"sort"),Ae=this}function ri(){hi.call(this,"ASCENDING",57,"ascending"),Re=this}function ii(){hi.call(this,"DESCENDING",58,"descending"),Ne=this}function oi(){hi.call(this,"ADD_FIELDS",59,"addFields"),Ie=this}function si(){hi.call(this,"UNWIND",60,"unwind"),xe=this}function ai(){hi.call(this,"UNKNOWN",61,"<unknown operator>"),ke=this}function ui(){}function ci(){return null==$e&&($e=Wt([(li(),M),gi(),(li(),A),(li(),R),(li(),N),(li(),I),(li(),x),(li(),k),_i(),(li(),D),(li(),$),(li(),L),(li(),B),(li(),j),(li(),q),(li(),F),(li(),z),(li(),U),(li(),V),(li(),W),(li(),G),(li(),H),(li(),K),(li(),Y),(li(),Q),(li(),J),(li(),X),(li(),Z),(li(),ee),(li(),te),(li(),ne),(li(),re),(li(),ie),(li(),oe),(li(),se),(li(),ae),yi(),(li(),ce),(li(),le),(li(),he),(li(),de),(li(),fe),(li(),pe),(li(),me),(li(),ge),(li(),_e),(li(),ye),(li(),ve),(li(),Ee),(li(),Se),(li(),we),(li(),Ce),(li(),Oe),(li(),be),(li(),Me),(li(),Te),(li(),Ae),(li(),Re),(li(),Ne),(li(),Ie),(li(),xe),vi()])),$e}function li(){if(De)return ct;De=!0,M=new er,T=new tr,A=new nr,R=new rr,N=new ir,I=new or,x=new sr,k=new ar,P=new ur,D=new cr,$=new lr,L=new hr,B=new dr,j=new fr,q=new pr,F=new mr,z=new gr,U=new _r,V=new yr,W=new vr,G=new Er,H=new Sr,K=new wr,Y=new Cr,Q=new Or,J=new br,X=new Mr,Z=new Tr,ee=new Ar,te=new Rr,ne=new Nr,re=new Ir,ie=new xr,oe=new kr,se=new Pr,ae=new Dr,ue=new $r,ce=new Lr,le=new Br,he=new jr,de=new qr,fe=new Fr,pe=new zr,me=new Ur,ge=new Vr,_e=new Wr,ye=new Gr,ve=new Hr,Ee=new Kr,Se=new Yr,we=new Qr,Ce=new Jr,Oe=new Xr,be=new Zr,Me=new ei,Te=new ti,Ae=new ni,Re=new ri,Ne=new ii,Ie=new oi,xe=new si,ke=new ai}function hi(e,t,n){Vt.call(this,e,t),this.jy_1=n}function di(){return Jn(),S}function fi(){return Jn(),w}function pi(){return Jn(),C}function mi(){return Jn(),O}function gi(){return li(),T}function _i(){return li(),P}function yi(){return li(),ue}function vi(){return li(),ke}function Ei(){}function Si(e,t){return n=new Mi(e,t,null),(r=function(e,t){return n.vy(e,t)}).$arity=1,r;var n,r}function wi(){}function Ci(){}function Oi(e){return t=new qi(e,null),(n=function(e,n){return t.d14(e,n)}).$arity=1,n;var t,n}function bi(e){for(var t=Ct(e.length),n=0,r=e.length;n<r;){var i=e[n];n=n+1|0;var o=$t(Oi(i),i);t.h(o)}return s=Ht(t).slice(),a=new Ui(s,null),(u=function(e,t){return a.r15(e,t)}).$arity=1,u;var s,a,u}function Mi(e,t,n){this.sy_1=e,this.ty_1=t,Kt.call(this,n)}function Ti(e,t,n){this.fz_1=e,this.gz_1=t,Kt.call(this,n)}function Ai(e,t,n){var r=new Ti(e,t,n),i=function(e,t){return r.iz(e,t)};return i.$arity=1,i}function Ri(e,t,n){this.sz_1=e,this.tz_1=t,Kt.call(this,n)}function Ni(e,t,n){var r=new Ri(e,t,n),i=function(e,t){return r.vz(e,t)};return i.$arity=1,i}function Ii(e,t,n,r){this.e10_1=e,this.f10_1=t,this.g10_1=n,Kt.call(this,r)}function xi(e,t,n,r){var i=new Ii(e,t,n,r),o=function(e,t){return i.m10(e,t)};return o.$arity=1,o}function ki(e,t,n){this.v10_1=e,this.w10_1=t,Kt.call(this,n)}function Pi(e,t){this.h11_1=e,Kt.call(this,t)}function Di(e,t,n){this.t11_1=e,this.u11_1=t,Kt.call(this,n)}function $i(e,t,n){this.n12_1=e,this.o12_1=t,Kt.call(this,n)}function Li(){return!1}function Bi(e,t,n){this.b13_1=e,this.c13_1=t,Kt.call(this,n)}function ji(e,t,n){this.p13_1=e,this.q13_1=t,Kt.call(this,n)}function qi(e,t){this.b14_1=e,Kt.call(this,t)}function Fi(e,t,n){this.m14_1=e,this.n14_1=t,Kt.call(this,n)}function zi(e,t,n){Kt.call(this,n),this.x14_1=e,this.y14_1=t}function Ui(e,t){this.h15_1=e,Kt.call(this,t)}function Vi(e){Kt.call(this,e)}function Wi(){}function Gi(){}function Hi(e){var t;e:{for(var n=e.zp_1.j();n.k();){var r=n.l();if(r instanceof Vn){t=r;break e}}t=null}for(var i=null==t||t instanceof Vn?t:Ke(),o=(null==i?null:i.sq_1)instanceof Un?at(e):Ot(),s=e.cq(),a=st(),u=s.j();u.k();){var c=u.l().eq();ut(a,c)}for(var l=st(),h=a.j();h.k();){var d=Hi(h.l());ut(l,d)}return rn(o,l)}function Ki(e){Kt.call(this,e)}function Yi(){}function Qi(e,t,n){this.o16_1=e,this.p16_1=t,this.q16_1=n}function Ji(e){return new Qi(e.r16_1,e.t16_1,e.s16_1)}function Xi(e){return new Qi(e.uq_1,e.vq_1,null)}function Zi(e){return new Qi(e.u16_1,e.v16_1,null)}function eo(e){Kt.call(this,e)}function to(e){Kt.call(this,e)}function no(e){var t=new to(e),n=function(e,n){return t.q17(e,n)};return n.$arity=1,n}function ro(e){Kt.call(this,e)}function io(e){var t=new ro(e),n=function(e,n){return t.a18(e,n)};return n.$arity=1,n}function oo(){}function so(e){Kt.call(this,e)}function ao(e,t){this.t18_1=e,Kt.call(this,t)}return He(sn,"BsonType"),Ye(an,"BsonNull",Qe,Qe,[sn]),Ye(cn,"BsonString",Qe,Qe,[sn]),Ye(ln,"BsonBoolean",Qe,Qe,[sn]),Ye(hn,"BsonDouble",Qe,Qe,[sn]),Ye(dn,"BsonInt64",Qe,Qe,[sn]),Ye(fn,"BsonDate",Qe,Qe,[sn]),et(pn,"BsonArray",Qe,Qe,[sn]),Ye(mn,"BsonAny",Qe,Qe,[sn]),Ye(gn,"BsonDecimal128",Qe,Qe,[sn]),Ye(_n,"BsonInt32",Qe,Qe,[sn]),Ye(yn,"BsonObjectId",Qe,Qe,[sn]),et(vn,"BsonObject",Qe,Qe,[sn]),et(En,"BsonAnyOf",Qe,Qe,[sn]),et(wn,"CollectionSchema"),jt(Tn),et(An,"DataDistribution"),Ye(Rn,"JsonObject"),Ye(Nn,"JsonArray"),Ye(In,"JsonUndefined"),jt(xn),et(kn,"Namespace"),et(Pn,"Node"),He(Dn,"HasChildren"),et(jn,"Either"),et($n,"Left",Qe,jn),et(Ln,"Right",Qe,jn),jt(Bn),et(qn,"HasAggregation",Qe,Qe,[Dn]),et(Fn,"Known"),et(zn,"HasCollectionReference"),et(Un,"FromSchema"),et(Vn,"HasFieldReference"),et(Wn,"HasFilter",Qe,Qe,[Dn]),et(Gn,"Constant"),et(Hn,"Inferred"),et(Kn,"Runtime"),et(Yn,"Computed"),et(Qn,"HasValueReference",Qe,Qe,[Dn]),et(Xn,"QueryRole",Qe,Vt),et(Zn,"Named"),et(hi,"Name",Qe,Vt),et(er,"ALL",Qe,hi),et(tr,"AND",Qe,hi),et(nr,"BITS_ALL_CLEAR",Qe,hi),et(rr,"BITS_ALL_SET",Qe,hi),et(ir,"BITS_ANY_CLEAR",Qe,hi),et(or,"BITS_ANY_SET",Qe,hi),et(sr,"COMBINE",Qe,hi),et(ar,"ELEM_MATCH",Qe,hi),et(ur,"EQ",Qe,hi),et(cr,"EXISTS",Qe,hi),et(lr,"GEO_INTERSECTS",Qe,hi),et(hr,"GEO_WITHIN",Qe,hi),et(dr,"GEO_WITHIN_BOX",Qe,hi),et(fr,"GEO_WITHIN_CENTER",Qe,hi),et(pr,"GEO_WITHIN_CENTER_SPHERE",Qe,hi),et(mr,"GEO_WITHIN_POLYGON",Qe,hi),et(gr,"GT",Qe,hi),et(_r,"GTE",Qe,hi),et(yr,"IN",Qe,hi),et(vr,"INC",Qe,hi),et(Er,"LT",Qe,hi),et(Sr,"LTE",Qe,hi),et(wr,"NE",Qe,hi),et(Cr,"NEAR",Qe,hi),et(Or,"NEAR_SPHERE",Qe,hi),et(br,"NIN",Qe,hi),et(Mr,"NOR",Qe,hi),et(Tr,"NOT",Qe,hi),et(Ar,"OR",Qe,hi),et(Rr,"REGEX",Qe,hi),et(Nr,"SET",Qe,hi),et(Ir,"SET_ON_INSERT",Qe,hi),et(xr,"SIZE",Qe,hi),et(kr,"TEXT",Qe,hi),et(Pr,"TYPE",Qe,hi),et(Dr,"UNSET",Qe,hi),et($r,"MATCH",Qe,hi),et(Lr,"PROJECT",Qe,hi),et(Br,"INCLUDE",Qe,hi),et(jr,"EXCLUDE",Qe,hi),et(qr,"GROUP",Qe,hi),et(Fr,"SUM",Qe,hi),et(zr,"AVG",Qe,hi),et(Ur,"FIRST",Qe,hi),et(Vr,"LAST",Qe,hi),et(Wr,"TOP",Qe,hi),et(Gr,"TOP_N",Qe,hi),et(Hr,"BOTTOM",Qe,hi),et(Kr,"BOTTOM_N",Qe,hi),et(Yr,"MAX",Qe,hi),et(Qr,"MIN",Qe,hi),et(Jr,"PUSH",Qe,hi),et(Xr,"PULL",Qe,hi),et(Zr,"PULL_ALL",Qe,hi),et(ei,"POP",Qe,hi),et(ti,"ADD_TO_SET",Qe,hi),et(ni,"SORT",Qe,hi),et(ri,"ASCENDING",Qe,hi),et(ii,"DESCENDING",Qe,hi),et(oi,"ADD_FIELDS",Qe,hi),et(si,"UNWIND",Qe,hi),et(ai,"UNKNOWN",Qe,hi),jt(ui),Ye(Ei,"NoConditionFulfilled"),Ye(wi,"IndexOutOfBounds"),Ye(Ci,"ElementDoesNotMatchFilter"),Qt(Mi,Kt,Qe,[1]),Qt(Ti,Kt,Qe,[1]),Qt(Ri,Kt,Qe,[1]),Qt(Ii,Kt,Qe,[1]),Qt(ki,Kt,Qe,[1]),Qt(Pi,Kt,Qe,[1]),Qt(Di,Kt,Qe,[1]),Qt($i,Kt,Qe,[1]),Qt(Bi,Kt,Qe,[1]),Qt(ji,Kt,Qe,[1]),Qt(qi,Kt,Qe,[1]),Qt(Fi,Kt,Qe,[1]),tn(zi,Kt),Qt(Ui,Kt,Qe,[1,2]),Qt(Vi,Kt,Qe,[1]),Ye(Wi,"NoFieldReference"),Ye(Gi,"NoFieldReferences"),Qt(Ki,Kt,Qe,[1]),Ye(Yi,"NoValueReference"),et(Qi,"ParsedValueReference"),Qt(eo,Kt,Qe,[1]),Qt(to,Kt,Qe,[1]),Qt(ro,Kt,Qe,[1]),Ye(oo,"HasNoNamedOperation"),Qt(so,Kt,Qe,[1]),Qt(ao,Kt,Qe,[1]),Ge(an).dp=function(){return this.ep_1},Ge(an).toString=function(){return"BsonNull"},Ge(an).hashCode=function(){return-1552322025},Ge(an).equals=function(e){return this===e||e instanceof an&&(e instanceof an||Ke(),!0)},Ge(cn).toString=function(){return"BsonString"},Ge(cn).hashCode=function(){return-1285412703},Ge(cn).equals=function(e){return this===e||e instanceof cn&&(e instanceof cn||Ke(),!0)},Ge(ln).dp=function(){return this.fp_1},Ge(ln).toString=function(){return"BsonBoolean"},Ge(ln).hashCode=function(){return 753382808},Ge(ln).equals=function(e){return this===e||e instanceof ln&&(e instanceof ln||Ke(),!0)},Ge(hn).toString=function(){return"BsonDouble"},Ge(hn).hashCode=function(){return-1719384991},Ge(hn).equals=function(e){return this===e||e instanceof hn&&(e instanceof hn||Ke(),!0)},Ge(dn).dp=function(){return this.gp_1},Ge(dn).toString=function(){return"BsonInt64"},Ge(dn).hashCode=function(){return-882162595},Ge(dn).equals=function(e){return this===e||e instanceof dn&&(e instanceof dn||Ke(),!0)},Ge(fn).toString=function(){return"BsonDate"},Ge(fn).hashCode=function(){return-1552638914},Ge(fn).equals=function(e){return this===e||e instanceof fn&&(e instanceof fn||Ke(),!0)},Ge(pn).toString=function(){return"BsonArray(schema="+Je(this.hp_1)+")"},Ge(pn).hashCode=function(){return Xe(this.hp_1)},Ge(pn).equals=function(e){if(this===e)return!0;if(!(e instanceof pn))return!1;var t=e instanceof pn?e:Ke();return!!Ze(this.hp_1,t.hp_1)},Ge(mn).toString=function(){return"BsonAny"},Ge(mn).hashCode=function(){return 504101724},Ge(mn).equals=function(e){return this===e||e instanceof mn&&(e instanceof mn||Ke(),!0)},Ge(gn).dp=function(){return this.ip_1},Ge(gn).toString=function(){return"BsonDecimal128"},Ge(gn).hashCode=function(){return 1452383702},Ge(gn).equals=function(e){return this===e||e instanceof gn&&(e instanceof gn||Ke(),!0)},Ge(_n).toString=function(){return"BsonInt32"},Ge(_n).hashCode=function(){return-882162690},Ge(_n).equals=function(e){return this===e||e instanceof _n&&(e instanceof _n||Ke(),!0)},Ge(yn).toString=function(){return"BsonObjectId"},Ge(yn).hashCode=function(){return-35537590},Ge(yn).equals=function(e){return this===e||e instanceof yn&&(e instanceof yn||Ke(),!0)},Ge(vn).toString=function(){return"BsonObject(schema="+Je(this.jp_1)+")"},Ge(vn).hashCode=function(){return Xe(this.jp_1)},Ge(vn).equals=function(e){if(this===e)return!0;if(!(e instanceof vn))return!1;var t=e instanceof vn?e:Ke();return!!Ze(this.jp_1,t.jp_1)},Ge(En).dp=function(){return this.lp_1},Ge(En).toString=function(){return"BsonAnyOf(types="+Je(this.kp_1)+")"},Ge(En).hashCode=function(){return Xe(this.kp_1)},Ge(En).equals=function(e){if(this===e)return!0;if(!(e instanceof En))return!1;var t=e instanceof En?e:Ke();return!!Ze(this.kp_1,t.kp_1)},Ge(wn).qp=function(e){return Sn(this,At(Tt(e,Mt([bt(46)]))),this.op_1)},Ge(wn).toString=function(){return"CollectionSchema(namespace="+this.np_1.toString()+", schema="+this.op_1.toString()+", dataDistribution="+this.pp_1.toString()+")"},Ge(wn).hashCode=function(){var e=this.np_1.hashCode();return e=Ve(e,31)+this.op_1.hashCode()|0,Ve(e,31)+this.pp_1.hashCode()|0},Ge(wn).equals=function(e){if(this===e)return!0;if(!(e instanceof wn))return!1;var t=e instanceof wn?e:Ke();return!!this.np_1.equals(t.np_1)&&!!this.op_1.equals(t.op_1)&&!!this.pp_1.equals(t.pp_1)},Ge(Tn).mp=function(e){var t=Nt();return On(this,e,t),function(e,t,n){for(var r=t.j();r.k();)for(var i=Mn(e,r.l()),o=n.h1().j();o.k();){var s=o.l(),a=s.b1(),u=s.c1();if(!i.o(a)){var c=u.f1(_),l=(null==c?0:c)+1|0;u.a3(_,l)}}}(this,e,t),new An(function(e,t,n){for(var r=Nt(),i=t.h1().j();i.k();){for(var o=i.l(),s=o.b1(),a=o.c1(),u=Nt(),c=a.h1().j();c.k();){var l=c.l(),h=l.b1(),d=100*l.c1()/n;u.a3(h,d)}r.a3(s,u)}return r}(0,t,e.m()))},Ge(An).sp=function(e,t){var n=this.tp(e);if(null==n)return null;var r=n.f1(t);return null==r?null:r},Ge(An).tp=function(e){var t=this.rp_1.f1(e);return null==t?null:t},Ge(An).toString=function(){return"DataDistribution(distribution="+Je(this.rp_1)+")"},Ge(An).hashCode=function(){return Xe(this.rp_1)},Ge(An).equals=function(e){if(this===e)return!0;if(!(e instanceof An))return!1;var t=e instanceof An?e:Ke();return!!Ze(this.rp_1,t.rp_1)},Ge(Rn).toString=function(){return"JsonObject"},Ge(Rn).hashCode=function(){return 1306064071},Ge(Rn).equals=function(e){return this===e||e instanceof Rn&&(e instanceof Rn||Ke(),!0)},Ge(Nn).toString=function(){return"JsonArray"},Ge(Nn).hashCode=function(){return 1830801361},Ge(Nn).equals=function(e){return this===e||e instanceof Nn&&(e instanceof Nn||Ke(),!0)},Ge(In).toString=function(){return"JsonUndefined"},Ge(In).hashCode=function(){return 1297564360},Ge(In).equals=function(e){return this===e||e instanceof In&&(e instanceof In||Ke(),!0)},Ge(xn).up=function(e,t){return new kn(e,t)},Ge(kn).toString=function(){return this.vp_1+"."+this.wp_1},Ge(kn).equals=function(e){return e instanceof kn&&this.hashCode()===e.hashCode()},Ge(kn).hashCode=function(){return Ve(Ft(this.vp_1),Ft(this.wp_1))},Ge(Pn).aq=function(e){return this.bq(Qe,zt(this.zp_1,e))},Ge(Pn).cq=function(){for(var e=this.zp_1,t=st(),n=e.j();n.k();){var r=n.l();null!=r&&xt(r,Dn)&&t.h(r)}return t},Ge(Pn).toString=function(){return"Node(components="+Je(this.zp_1)+")"},Ge(Pn).dq=function(e,t){return new Pn(e,t)},Ge(Pn).bq=function(e,t,n){return e=e===Qe?this.yp_1:e,t=t===Qe?this.zp_1:t,n===Qe?this.dq(e,t):n.dq.call(this,e,t)},Ge(Pn).hashCode=function(){var e=null==this.yp_1?0:Xe(this.yp_1);return Ve(e,31)+Xe(this.zp_1)|0},Ge(Pn).equals=function(e){if(this===e)return!0;if(!(e instanceof Pn))return!1;var t=e instanceof Pn?e:Ke();return!!Ze(this.yp_1,t.yp_1)&&!!Ze(this.zp_1,t.zp_1)},Ge($n).toString=function(){return"Left(value="+Dt(this.fq_1)+")"},Ge($n).hashCode=function(){return null==this.fq_1?0:Xe(this.fq_1)},Ge($n).equals=function(e){if(this===e)return!0;if(!(e instanceof $n))return!1;var t=e instanceof $n?e:Ke();return!!Ze(this.fq_1,t.fq_1)},Ge(Ln).toString=function(){return"Right(value="+Dt(this.hq_1)+")"},Ge(Ln).hashCode=function(){return null==this.hq_1?0:Xe(this.hq_1)},Ge(Ln).equals=function(e){if(this===e)return!0;if(!(e instanceof Ln))return!1;var t=e instanceof Ln?e:Ke();return!!Ze(this.hq_1,t.hq_1)},Ge(Bn).iq=function(e){var t=new $n(e);return t instanceof jn?t:Ke()},Ge(Bn).jq=function(e){var t=new Ln(e);return t instanceof jn?t:Ke()},Ge(jn).gq=function(e){var t;return this instanceof $n?t=e():this instanceof Ln?t=this.hq_1:Ut(),t},Ge(Fn).toString=function(){return"Known(namespace="+this.mq_1.toString()+",schema="+Dt(this.nq_1)+")"},Ge(Fn).hashCode=function(){var e=null==this.kq_1?0:Xe(this.kq_1);return e=Ve(e,31)+(null==this.lq_1?0:Xe(this.lq_1))|0,e=Ve(e,31)+this.mq_1.hashCode()|0,Ve(e,31)+(null==this.nq_1?0:this.nq_1.hashCode())|0},Ge(Fn).equals=function(e){if(this===e)return!0;if(!(e instanceof Fn))return!1;var t=e instanceof Fn?e:Ke();return!!(Ze(this.kq_1,t.kq_1)&&Ze(this.lq_1,t.lq_1)&&this.mq_1.equals(t.mq_1)&&Ze(this.nq_1,t.nq_1))},Ge(zn).toString=function(){return"HasCollectionReference(reference="+Je(this.oq_1)+")"},Ge(zn).hashCode=function(){return Xe(this.oq_1)},Ge(zn).equals=function(e){if(this===e)return!0;if(!(e instanceof zn))return!1;var t=e instanceof zn?e:Ke();return!!Ze(this.oq_1,t.oq_1)},Ge(Un).toString=function(){return"FromSchema(fieldName="+this.qq_1+",displayName="+this.rq_1+")"},Ge(Un).hashCode=function(){var e=null==this.pq_1?0:Xe(this.pq_1);return e=Ve(e,31)+Ft(this.qq_1)|0,Ve(e,31)+Ft(this.rq_1)|0},Ge(Un).equals=function(e){if(this===e)return!0;if(!(e instanceof Un))return!1;var t=e instanceof Un?e:Ke();return!!Ze(this.pq_1,t.pq_1)&&this.qq_1===t.qq_1&&this.rq_1===t.rq_1},Ge(Vn).toString=function(){return"HasFieldReference(reference="+Je(this.sq_1)+")"},Ge(Vn).hashCode=function(){return Xe(this.sq_1)},Ge(Vn).equals=function(e){if(this===e)return!0;if(!(e instanceof Vn))return!1;var t=e instanceof Vn?e:Ke();return!!Ze(this.sq_1,t.sq_1)},Ge(Wn).eq=function(){return this.tq_1},Ge(Wn).toString=function(){return"HasFilter(children="+Je(this.tq_1)+")"},Ge(Wn).hashCode=function(){return Xe(this.tq_1)},Ge(Wn).equals=function(e){if(this===e)return!0;if(!(e instanceof Wn))return!1;var t=e instanceof Wn?e:Ke();return!!Ze(this.tq_1,t.tq_1)},Ge(Kn).toString=function(){return"Runtime(type="+Je(this.vq_1)+")"},Ge(Kn).hashCode=function(){var e=null==this.uq_1?0:Xe(this.uq_1);return Ve(e,31)+Xe(this.vq_1)|0},Ge(Kn).equals=function(e){if(this===e)return!0;if(!(e instanceof Kn))return!1;var t=e instanceof Kn?e:Ke();return!!Ze(this.uq_1,t.uq_1)&&!!Ze(this.vq_1,t.vq_1)},Ge(Qn).eq=function(){return this.wq_1 instanceof Yn?at(this.wq_1.zq_1.yq_1):Ot()},Ge(Qn).toString=function(){return"HasValueReference(reference="+Je(this.wq_1)+")"},Ge(Qn).hashCode=function(){return Xe(this.wq_1)},Ge(Qn).equals=function(e){if(this===e)return!0;if(!(e instanceof Qn))return!1;var t=e instanceof Qn?e:Ke();return!!Ze(this.wq_1,t.wq_1)},Ge(Zn).toString=function(){return"Named(name="+this.ar_1.toString()+")"},Ge(Zn).hashCode=function(){return this.ar_1.hashCode()},Ge(Zn).equals=function(e){if(this===e)return!0;if(!(e instanceof Zn))return!1;var t=e instanceof Zn?e:Ke();return!!this.ar_1.equals(t.ar_1)},Ge(Zn).br=function(e){return this.ar_1.br(e)},Ge(er).br=function(e){return mi()},Ge(tr).br=function(e){return mi()},Ge(nr).br=function(e){return mi()},Ge(rr).br=function(e){return mi()},Ge(ir).br=function(e){return mi()},Ge(or).br=function(e){return mi()},Ge(sr).br=function(e){return mi()},Ge(ar).br=function(e){return mi()},Ge(ur).br=function(e){return Jn(),E},Ge(cr).br=function(e){return mi()},Ge(lr).br=function(e){return fi()},Ge(hr).br=function(e){return fi()},Ge(dr).br=function(e){return fi()},Ge(fr).br=function(e){return fi()},Ge(pr).br=function(e){return fi()},Ge(mr).br=function(e){return fi()},Ge(gr).br=function(e){return fi()},Ge(_r).br=function(e){return fi()},Ge(yr).br=function(e){return fi()},Ge(vr).br=function(e){return mi()},Ge(Er).br=function(e){return fi()},Ge(Sr).br=function(e){return fi()},Ge(wr).br=function(e){return fi()},Ge(Cr).br=function(e){return fi()},Ge(Or).br=function(e){return fi()},Ge(br).br=function(e){return fi()},Ge(Mr).br=function(e){return pi()},Ge(Tr).br=function(e){return mi()},Ge(Ar).br=function(e){return pi()},Ge(Rr).br=function(e){return fi()},Ge(Nr).br=function(e){return mi()},Ge(Ir).br=function(e){return mi()},Ge(xr).br=function(e){return mi()},Ge(kr).br=function(e){return fi()},Ge(Pr).br=function(e){return mi()},Ge(Dr).br=function(e){return mi()},Ge($r).br=function(e){return mi()},Ge(Lr).br=function(e){return mi()},Ge(Br).br=function(e){return mi()},Ge(jr).br=function(e){return mi()},Ge(qr).br=function(e){return mi()},Ge(Fr).br=function(e){return mi()},Ge(zr).br=function(e){return mi()},Ge(Ur).br=function(e){return mi()},Ge(Vr).br=function(e){return mi()},Ge(Wr).br=function(e){return mi()},Ge(Gr).br=function(e){return mi()},Ge(Hr).br=function(e){return mi()},Ge(Kr).br=function(e){return mi()},Ge(Yr).br=function(e){return di()},Ge(Qr).br=function(e){return di()},Ge(Jr).br=function(e){return mi()},Ge(Xr).br=function(e){return mi()},Ge(Zr).br=function(e){return mi()},Ge(ei).br=function(e){return mi()},Ge(ti).br=function(e){return mi()},Ge(ni).br=function(e){return di()},Ge(ri).br=function(e){return di()},Ge(ii).br=function(e){return di()},Ge(oi).br=function(e){return mi()},Ge(si).br=function(e){return mi()},Ge(ai).br=function(e){return mi()},Ge(ui).gy=function(e){var t;e:{for(var n=ci().j();n.k();){var r=n.l();if(r.jy_1===e){t=r;break e}}t=null}var i=t;return null==i?vi():i},Ge(hi).toString=function(){return this.jy_1},Ge(Ei).toString=function(){return"NoConditionFulfilled"},Ge(Ei).hashCode=function(){return 1215837716},Ge(Ei).equals=function(e){return this===e||e instanceof Ei&&(e instanceof Ei||Ke(),!0)},Ge(wi).toString=function(){return"IndexOutOfBounds"},Ge(wi).hashCode=function(){return 1484570711},Ge(wi).equals=function(e){return this===e||e instanceof wi&&(e instanceof wi||Ke(),!0)},Ge(Ci).toString=function(){return"ElementDoesNotMatchFilter"},Ge(Ci).hashCode=function(){return 522593520},Ge(Ci).equals=function(e){return this===e||e instanceof Ci&&(e instanceof Ci||Ke(),!0)},Ge(Mi).vy=function(e,t){var n=this.wy(e,t);return n.g6_1=ct,n.h6_1=null,n.m6()},Ge(Mi).w6=function(e,t){return this.vy(null==e||null!=e?e:Ke(),t)},Ge(Mi).m6=function(){var e=this.g6_1;e:for(;;)try{switch(this.e6_1){case 0:if(this.f6_1=2,this.e6_1=1,(e=this.sy_1(this.uy_1,this))===Yt())return e;continue e;case 1:var t,n=e;return n instanceof $n?t=v.iq(n.fq_1):n instanceof Ln?t=v.jq(this.ty_1(n.hq_1)):Ut(),t;case 2:throw this.h6_1}}catch(e){var r=e;if(2===this.f6_1)throw r;this.e6_1=this.f6_1,this.h6_1=r}},Ge(Mi).wy=function(e,t){var n=new Mi(this.sy_1,this.ty_1,t);return n.uy_1=e,n},Ge(Ti).iz=function(e,t){var n=this.jz(e,t);return n.g6_1=ct,n.h6_1=null,n.m6()},Ge(Ti).w6=function(e,t){return this.iz(null!=e&&xt(e,Jt)?e:Ke(),t)},Ge(Ti).m6=function(){var e=this.g6_1;e:for(;;)try{switch(this.e6_1){case 0:if(this.f6_1=2,this.e6_1=1,(e=this.fz_1(this.gz_1,this))===Yt())return e;continue e;case 1:return e;case 2:throw this.h6_1}}catch(e){var t=e;if(2===this.f6_1)throw t;this.e6_1=this.f6_1,this.h6_1=t}},Ge(Ti).jz=function(e,t){var n=new Ti(this.fz_1,this.gz_1,t);return n.hz_1=e,n},Ge(Ri).vz=function(e,t){var n=this.jz(e,t);return n.g6_1=ct,n.h6_1=null,n.m6()},Ge(Ri).w6=function(e,t){return this.vz(null!=e&&xt(e,Jt)?e:Ke(),t)},Ge(Ri).m6=function(){var e=this.g6_1;e:for(;;)try{switch(this.e6_1){case 0:if(this.f6_1=2,this.e6_1=1,(e=this.sz_1(this.tz_1,this))===Yt())return e;continue e;case 1:return e;case 2:throw this.h6_1}}catch(e){var t=e;if(2===this.f6_1)throw t;this.e6_1=this.f6_1,this.h6_1=t}},Ge(Ri).jz=function(e,t){var n=new Ri(this.sz_1,this.tz_1,t);return n.uz_1=e,n},Ge(Ii).m10=function(e,t){var n=this.jz(e,t);return n.g6_1=ct,n.h6_1=null,n.m6()},Ge(Ii).w6=function(e,t){return this.m10(null!=e&&xt(e,Jt)?e:Ke(),t)},Ge(Ii).m6=function(){var e=this.g6_1;e:for(;;)try{switch(this.e6_1){case 0:if(this.f6_1=5,this.i10_1=Xt(this.h10_1,Qe,Qe,Ai(this.e10_1,this.f10_1,null)),this.j10_1=Xt(this.h10_1,Qe,Qe,Ni(this.g10_1,this.f10_1,null)),this.e6_1=1,(e=this.i10_1.xd(this))===Yt())return e;continue e;case 1:if(this.k10_1=e,this.k10_1 instanceof $n){if(this.e6_1=3,(e=this.j10_1.xd(this))===Yt())return e;continue e}if(this.k10_1 instanceof Ln){if(this.e6_1=2,(e=this.j10_1.xd(this))===Yt())return e;continue e}Ut();break;case 2:var t,n=e;n instanceof $n?t=v.iq($t(null,n.fq_1)):n instanceof Ln?t=v.jq($t(this.k10_1.hq_1,n.hq_1)):Ut(),this.l10_1=t,this.e6_1=4;continue e;case 3:var r,i=e;r=i instanceof $n?v.iq($t(this.k10_1.fq_1,i.fq_1)):v.iq($t(this.k10_1.fq_1,null)),this.l10_1=r,this.e6_1=4;continue e;case 4:return this.l10_1;case 5:throw this.h6_1}}catch(e){var o=e;if(5===this.f6_1)throw o;this.e6_1=this.f6_1,this.h6_1=o}},Ge(Ii).jz=function(e,t){var n=new Ii(this.e10_1,this.f10_1,this.g10_1,t);return n.h10_1=e,n},Ge(ki).y10=function(e,t){var n=this.wy(e,t);return n.g6_1=ct,n.h6_1=null,n.m6()},Ge(ki).w6=function(e,t){return this.y10(null==e||null!=e?e:Ke(),t)},Ge(ki).m6=function(){var e=this.g6_1;e:for(;;)try{switch(this.e6_1){case 0:if(this.f6_1=2,this.e6_1=1,(e=Zt(xi(this.v10_1,this.x10_1,this.w10_1,null),this))===Yt())return e;continue e;case 1:return e;case 2:throw this.h6_1}}catch(e){var t=e;if(2===this.f6_1)throw t;this.e6_1=this.f6_1,this.h6_1=t}},Ge(ki).wy=function(e,t){var n=new ki(this.v10_1,this.w10_1,t);return n.x10_1=e,n},Ge(Pi).j11=function(e,t){var n=this.k11(e,t);return n.g6_1=ct,n.h6_1=null,n.m6()},Ge(Pi).w6=function(e,t){return this.j11(null==e||null!=e?e:Ke(),t)},Ge(Pi).m6=function(){for(this.g6_1;;)try{var e=this.e6_1;if(0===e)return this.f6_1=1,null==this.i11_1?v.iq(this.h11_1):v.jq(this.i11_1);if(1===e)throw this.h6_1}catch(e){throw e}},Ge(Pi).k11=function(e,t){var n=new Pi(this.h11_1,t);return n.i11_1=e,n},Ge(Di).e12=function(e,t){var n=this.wy(e,t);return n.g6_1=ct,n.h6_1=null,n.m6()},Ge(Di).w6=function(e,t){return this.e12(null==e||null!=e?e:Ke(),t)},Ge(Di).m6=function(){var e=this.g6_1;e:for(;;)try{switch(this.e6_1){case 0:if(this.f6_1=6,this.e6_1=1,(e=this.t11_1(this.v11_1,this))===Yt())return e;continue e;case 1:if(this.w11_1=e,this.w11_1 instanceof $n){this.x11_1=v.iq(v.iq(this.w11_1.fq_1)),this.e6_1=5;continue e}if(this.w11_1 instanceof Ln){this.y11_1=this.w11_1.hq_1,this.z11_1=this.y11_1,this.a12_1=Ct(ht(this.y11_1,10)),this.b12_1=this.z11_1.j(),this.e6_1=2;continue e}Ut();break;case 2:if(!this.b12_1.k()){this.e6_1=4;continue e}if(this.c12_1=this.b12_1.l(),this.d12_1=this.c12_1,this.e6_1=3,(e=this.u11_1(this.d12_1,this))===Yt())return e;continue e;case 3:var t=e;this.a12_1.h(t),this.e6_1=2;continue e;case 4:for(var n=this.a12_1,r=Nt(),i=n.j();i.k();){var o,s=i.l(),a=s instanceof Ln,u=r.f1(a);if(null==u){var c=st();r.a3(a,c),o=c}else o=u;o.h(s)}var l,h=r,d=h.f1(!1),f=h.f1(!0);if(!0===(null==d?null:!d.p())){for(var p=v,m=v,g=st(),_=d.j();_.k();){var y=_.l(),E=y instanceof $n?y:null;null==E||g.h(E)}for(var S=Ct(ht(g,10)),w=g.j();w.k();){var C=w.l();S.h(C.fq_1)}l=p.iq(m.jq(S))}else{var O,b=v;if(null==f)O=null;else{for(var M=Ct(ht(f,10)),T=f.j();T.k();){var A=T.l();M.h(A instanceof Ln?A:Ke())}O=M}var R,N=O;if(null==N)R=null;else{for(var I=Ct(ht(N,10)),x=N.j();x.k();){var k=x.l();I.h(k.hq_1)}R=I}var P=R;l=b.jq(null==P?Ot():P)}this.x11_1=l,this.e6_1=5;continue e;case 5:return this.x11_1;case 6:throw this.h6_1}}catch(e){var D=e;if(6===this.f6_1)throw D;this.e6_1=this.f6_1,this.h6_1=D}},Ge(Di).wy=function(e,t){var n=new Di(this.t11_1,this.u11_1,t);return n.v11_1=e,n},Ge($i).s12=function(e,t){var n=this.wy(e,t);return n.g6_1=ct,n.h6_1=null,n.m6()},Ge($i).w6=function(e,t){return this.s12(null==e||null!=e?e:Ke(),t)},Ge($i).m6=function(){var e=this.g6_1;e:for(;;)try{switch(this.e6_1){case 0:if(this.f6_1=4,this.e6_1=1,(e=this.n12_1(this.p12_1,this))===Yt())return e;continue e;case 1:if(this.q12_1=e,this.q12_1 instanceof $n){this.r12_1=v.iq(v.iq(this.q12_1.fq_1)),this.e6_1=3;continue e}if(this.q12_1 instanceof Ln){if(this.e6_1=2,(e=this.o12_1(this.q12_1.hq_1,this))===Yt())return e;continue e}Ut();break;case 2:var t,n=e;n instanceof $n?t=v.iq(v.jq(n.fq_1)):n instanceof Ln?t=v.jq(n.hq_1):Ut(),this.r12_1=t,this.e6_1=3;continue e;case 3:return this.r12_1;case 4:throw this.h6_1}}catch(e){var r=e;if(4===this.f6_1)throw r;this.e6_1=this.f6_1,this.h6_1=r}},Ge($i).wy=function(e,t){var n=new $i(this.n12_1,this.o12_1,t);return n.p12_1=e,n},Ge(Bi).g13=function(e,t){var n=this.wy(e,t);return n.g6_1=ct,n.h6_1=null,n.m6()},Ge(Bi).w6=function(e,t){return this.g13(null==e||null!=e?e:Ke(),t)},Ge(Bi).m6=function(){var e=this.g6_1;e:for(;;)try{switch(this.e6_1){case 0:if(this.f6_1=4,this.e6_1=1,(e=this.b13_1(this.d13_1,this))===Yt())return e;continue e;case 1:if(this.e13_1=e,this.e13_1 instanceof $n){this.f13_1=v.iq(v.iq(this.e13_1.fq_1)),this.e6_1=3;continue e}if(this.e13_1 instanceof Ln){if(this.e6_1=2,(e=this.c13_1(this.e13_1.hq_1,this))===Yt())return e;continue e}Ut();break;case 2:var t;switch(e.gq(Li)){case!0:t=v.jq(this.e13_1.hq_1);break;case!1:t=v.iq(v.jq(je));break;default:Ut()}this.f13_1=t,this.e6_1=3;continue e;case 3:return this.f13_1;case 4:throw this.h6_1}}catch(e){var n=e;if(4===this.f6_1)throw n;this.e6_1=this.f6_1,this.h6_1=n}},Ge(Bi).wy=function(e,t){var n=new Bi(this.b13_1,this.c13_1,t);return n.d13_1=e,n},Ge(ji).s13=function(e,t){var n=this.wy(e,t);return n.g6_1=ct,n.h6_1=null,n.m6()},Ge(ji).w6=function(e,t){return this.s13(null==e||null!=e?e:Ke(),t)},Ge(ji).m6=function(){var e=this.g6_1;e:for(;;)try{switch(this.e6_1){case 0:if(this.f6_1=2,this.e6_1=1,(e=this.p13_1(this.r13_1,this))===Yt())return e;continue e;case 1:var t,n=e;if(n instanceof $n)t=v.iq(v.iq(n.fq_1));else if(n instanceof Ln){var r=en(n.hq_1,this.q13_1);t=null==r?v.iq(v.jq(Be)):v.jq(r)}else Ut();return t;case 2:throw this.h6_1}}catch(e){var i=e;if(2===this.f6_1)throw i;this.e6_1=this.f6_1,this.h6_1=i}},Ge(ji).wy=function(e,t){var n=new ji(this.p13_1,this.q13_1,t);return n.r13_1=e,n},Ge(qi).d14=function(e,t){var n=this.wy(e,t);return n.g6_1=ct,n.h6_1=null,n.m6()},Ge(qi).w6=function(e,t){return this.d14(null==e||null!=e?e:Ke(),t)},Ge(qi).m6=function(){var e=this.g6_1;e:for(;;)try{switch(this.e6_1){case 0:if(this.f6_1=2,this.e6_1=1,(e=this.b14_1(this.c14_1,this))===Yt())return e;continue e;case 1:var t,n=e;return n instanceof $n?t=v.iq(n.fq_1):n instanceof Ln?t=v.jq(!0):Ut(),t;case 2:throw this.h6_1}}catch(e){var r=e;if(2===this.f6_1)throw r;this.e6_1=this.f6_1,this.h6_1=r}},Ge(qi).wy=function(e,t){var n=new qi(this.b14_1,t);return n.c14_1=e,n},Ge(Fi).g13=function(e,t){var n=this.wy(e,t);return n.g6_1=ct,n.h6_1=null,n.m6()},Ge(Fi).w6=function(e,t){return this.g13(null==e||null!=e?e:Ke(),t)},Ge(Fi).m6=function(){var e=this.g6_1;e:for(;;)try{switch(this.e6_1){case 0:if(this.f6_1=2,this.e6_1=1,(e=this.m14_1(this.o14_1,this))===Yt())return e;continue e;case 1:var t,n=e;if(n instanceof $n)t=v.iq(v.iq(n.fq_1));else if(n instanceof Ln){var r;switch(this.n14_1(n.hq_1)){case!0:r=v.jq(n.hq_1);break;case!1:r=v.iq(v.jq(je));break;default:Ut()}t=r}else Ut();return t;case 2:throw this.h6_1}}catch(e){var i=e;if(2===this.f6_1)throw i;this.e6_1=this.f6_1,this.h6_1=i}},Ge(Fi).wy=function(e,t){var n=new Fi(this.m14_1,this.n14_1,t);return n.o14_1=e,n},Ge(zi).m6=function(){var e=this.g6_1;e:for(;;)try{switch(this.e6_1){case 0:if(this.f6_1=2,this.e6_1=1,(e=this.y14_1(this.x14_1,this))===Yt())return e;continue e;case 1:var t;return e instanceof $n?t=!1:e instanceof Ln?t=e.hq_1:Ut(),t;case 2:throw this.h6_1}}catch(e){var n=e;if(2===this.f6_1)throw n;this.e6_1=this.f6_1,this.h6_1=n}},Ge(Ui).r15=function(e,t){var n=this.wy(e,t);return n.g6_1=ct,n.h6_1=null,n.m6()},Ge(Ui).w6=function(e,t){return this.r15(null==e||null!=e?e:Ke(),t)},Ge(Ui).m6=function(){var e,t,n,r=this.g6_1;e:for(;;)try{switch(this.e6_1){case 0:this.f6_1=9,this.e6_1=1;continue e;case 1:this.k15_1=this.h15_1,this.l15_1=nn(this.k15_1),this.e6_1=2;continue e;case 2:if(!this.l15_1.k()){this.e6_1=5;continue e}if(this.m15_1=this.l15_1.l(),this.n15_1=this.m15_1,this.e6_1=3,e=this.i15_1,t=this.n15_1.r9_1,n=void 0,(n=new zi(e,t,this)).g6_1=ct,n.h6_1=null,(r=n.m6())===Yt())return r;continue e;case 3:if(r){this.j15_1=this.m15_1,this.e6_1=6;continue e}this.e6_1=4;continue e;case 4:this.e6_1=2;continue e;case 5:this.j15_1=null,this.e6_1=6;continue e;case 6:this.o15_1=this.j15_1;var i=this.o15_1;if(this.p15_1=null==i?null:i.s9_1,null==this.p15_1){this.q15_1=null,this.e6_1=8;continue e}if(this.e6_1=7,(r=this.p15_1(this.i15_1,this))===Yt())return r;continue e;case 7:this.q15_1=r,this.e6_1=8;continue e;case 8:var o,s=this.q15_1;return s instanceof $n?o=v.iq(v.jq(s.fq_1)):s instanceof Ln?o=v.jq(s.hq_1):null==s?o=v.iq(v.iq(Le)):Ut(),o;case 9:throw this.h6_1}}catch(e){var a=e;if(9===this.f6_1)throw a;this.e6_1=this.f6_1,this.h6_1=a}},Ge(Ui).wy=function(e,t){var n=new Ui(this.h15_1,t);return n.i15_1=e,n},Ge(Vi).b16=function(e,t){var n=this.c16(e,t);return n.g6_1=ct,n.h6_1=null,n.m6()},Ge(Vi).w6=function(e,t){return this.b16(e instanceof Pn?e:Ke(),t)},Ge(Vi).m6=function(){for(this.g6_1;;)try{var e=this.e6_1;if(0===e){this.f6_1=1;var t,n=this.a16_1;e:do{for(var r=n.zp_1.j();r.k();){var i=r.l();if(i instanceof qn){t=i;break e}}t=null}while(0);var o=null==t||t instanceof qn?t:Ke();return null==o?v.jq(Ot()):v.jq(o.d16_1)}if(1===e)throw this.h6_1}catch(e){throw e}},Ge(Vi).c16=function(e,t){var n=new Vi(t);return n.a16_1=e,n},Ge(Wi).toString=function(){return"NoFieldReference"},Ge(Wi).hashCode=function(){return 148300955},Ge(Wi).equals=function(e){return this===e||e instanceof Wi&&(e instanceof Wi||Ke(),!0)},Ge(Gi).toString=function(){return"NoFieldReferences"},Ge(Gi).hashCode=function(){return 302362424},Ge(Gi).equals=function(e){return this===e||e instanceof Gi&&(e instanceof Gi||Ke(),!0)},Ge(Ki).n16=function(e,t){var n=this.c16(e,t);return n.g6_1=ct,n.h6_1=null,n.m6()},Ge(Ki).w6=function(e,t){return this.n16(e instanceof Pn?e:Ke(),t)},Ge(Ki).m6=function(){for(this.g6_1;;)try{var e=this.e6_1;if(0===e){this.f6_1=1;var t=Hi(this.m16_1);return t.p()?v.iq(Fe):v.jq(t)}if(1===e)throw this.h6_1}catch(e){throw e}},Ge(Ki).c16=function(e,t){var n=new Ki(t);return n.m16_1=e,n},Ge(Yi).toString=function(){return"NoValueReference"},Ge(Yi).hashCode=function(){return 415926788},Ge(Yi).equals=function(e){return this===e||e instanceof Yi&&(e instanceof Yi||Ke(),!0)},Ge(Qi).toString=function(){return"ParsedValueReference(source="+Dt(this.o16_1)+", type="+Je(this.p16_1)+", value="+Dt(this.q16_1)+")"},Ge(Qi).hashCode=function(){var e=null==this.o16_1?0:Xe(this.o16_1);return e=Ve(e,31)+Xe(this.p16_1)|0,Ve(e,31)+(null==this.q16_1?0:Xe(this.q16_1))|0},Ge(Qi).equals=function(e){if(this===e)return!0;if(!(e instanceof Qi))return!1;var t=e instanceof Qi?e:Ke();return!!Ze(this.o16_1,t.o16_1)&&!!Ze(this.p16_1,t.p16_1)&&!!Ze(this.q16_1,t.q16_1)},Ge(eo).f17=function(e,t){var n=this.g17(e,t);return n.g6_1=ct,n.h6_1=null,n.m6()},Ge(eo).w6=function(e,t){return this.f17(e instanceof Pn?e:Ke(),t)},Ge(eo).m6=function(){for(this.g6_1;;)try{var e=this.e6_1;if(0===e){this.f6_1=1;var t,n=this.e17_1;e:do{for(var r=n.zp_1.j();r.k();){var i=r.l();if(i instanceof Qn){t=i;break e}}t=null}while(0);var o=null==t||t instanceof Qn?t:Ke(),s=null==o?null:o.wq_1;return null==s?v.iq(ze):s instanceof Gn?v.jq(s):v.iq(ze)}if(1===e)throw this.h6_1}catch(e){throw e}},Ge(eo).g17=function(e,t){var n=new eo(t);return n.e17_1=e,n},Ge(to).q17=function(e,t){var n=this.g17(e,t);return n.g6_1=ct,n.h6_1=null,n.m6()},Ge(to).w6=function(e,t){return this.q17(e instanceof Pn?e:Ke(),t)},Ge(to).m6=function(){for(this.g6_1;;)try{var e=this.e6_1;if(0===e){this.f6_1=1;var t,n=this.p17_1;e:do{for(var r=n.zp_1.j();r.k();){var i=r.l();if(i instanceof Qn){t=i;break e}}t=null}while(0);var o=null==t||t instanceof Qn?t:Ke(),s=null==o?null:o.wq_1;return null==s?v.iq(ze):s instanceof Kn?v.jq(s):v.iq(ze)}if(1===e)throw this.h6_1}catch(e){throw e}},Ge(to).g17=function(e,t){var n=new to(t);return n.p17_1=e,n},Ge(ro).a18=function(e,t){var n=this.g17(e,t);return n.g6_1=ct,n.h6_1=null,n.m6()},Ge(ro).w6=function(e,t){return this.a18(e instanceof Pn?e:Ke(),t)},Ge(ro).m6=function(){for(this.g6_1;;)try{var e=this.e6_1;if(0===e){this.f6_1=1;var t,n=this.z17_1;e:do{for(var r=n.zp_1.j();r.k();){var i=r.l();if(i instanceof Qn){t=i;break e}}t=null}while(0);var o=null==t||t instanceof Qn?t:Ke(),s=null==o?null:o.wq_1;return null==s?v.iq(ze):s instanceof Hn?v.jq(s):v.iq(ze)}if(1===e)throw this.h6_1}catch(e){throw e}},Ge(ro).g17=function(e,t){var n=new ro(t);return n.z17_1=e,n},Ge(oo).toString=function(){return"HasNoNamedOperation"},Ge(oo).hashCode=function(){return 405193568},Ge(oo).equals=function(e){return this===e||e instanceof oo&&(e instanceof oo||Ke(),!0)},Ge(so).k18=function(e,t){var n=this.c16(e,t);return n.g6_1=ct,n.h6_1=null,n.m6()},Ge(so).w6=function(e,t){return this.k18(e instanceof Pn?e:Ke(),t)},Ge(so).m6=function(){for(this.g6_1;;)try{var e=this.e6_1;if(0===e){this.f6_1=1;var t,n=this.j18_1;e:do{for(var r=n.zp_1.j();r.k();){var i=r.l();if(i instanceof Zn){t=i;break e}}t=null}while(0);var o=null==t||t instanceof Zn?t:Ke();return null!=o?v.jq(o):v.iq(Ue)}if(1===e)throw this.h6_1}catch(e){throw e}},Ge(so).c16=function(e,t){var n=new so(t);return n.j18_1=e,n},Ge(ao).v18=function(e,t){var n=this.c16(e,t);return n.g6_1=ct,n.h6_1=null,n.m6()},Ge(ao).w6=function(e,t){return this.v18(e instanceof Pn?e:Ke(),t)},Ge(ao).m6=function(){for(this.g6_1;;)try{var e=this.e6_1;if(0===e){this.f6_1=1;var t,n=this.u18_1;e:do{for(var r=n.zp_1.j();r.k();){var i=r.l();if(i instanceof Zn){t=i;break e}}t=null}while(0);var o=null==t||t instanceof Zn?t:Ke(),s=null==o?null:o.ar_1;return v.jq(Ze(s,this.t18_1))}if(1===e)throw this.h6_1}catch(e){throw e}},Ge(ao).c16=function(e,t){var n=new ao(this.t18_1,t);return n.u18_1=e,n},Ge(cn).dp=on,Ge(hn).dp=on,Ge(fn).dp=on,Ge(pn).dp=on,Ge(mn).dp=on,Ge(_n).dp=on,Ge(yn).dp=on,Ge(vn).dp=on,o=new cn,a=new hn,c=new fn,l=new mn,d=new _n,f=new yn,p=new Tn,m=new Rn,g=new Nn,_=new In,y=new xn,v=new Bn,Pe=new ui,Le=new Ei,Be=new wi,je=new Ci,qe=new Wi,Fe=new Gi,ze=new Yi,Ue=new oo,e.$_$=e.$_$||{},e.$_$.a=Fn,e.$_$.b=zn,e.$_$.c=Un,e.$_$.d=Vn,e.$_$.e=Wn,e.$_$.f=Kn,e.$_$.g=Qn,e.$_$.h=Zn,e.$_$.i=function(){return e=new Vi(null),(t=function(t,n){return e.b16(t,n)}).$arity=1,t;var e,t},e.$_$.j=function(){return e=new Ki(null),(t=function(t,n){return e.n16(t,n)}).$arity=1,t;var e,t},e.$_$.k=function(){return e=new so(null),(t=function(t,n){return e.k18(t,n)}).$arity=1,t;var e,t},e.$_$.l=function(){return bi([Si((e=null,t=new eo(e),n=function(e,n){return t.f17(e,n)},n.$arity=1,n),Ji),Si(no(null),Xi),Si(io(null),Zi)]);var e,t,n},e.$_$.m=function(e){return t=new ao(e,null),(n=function(e,n){return t.v18(e,n)}).$arity=1,n;var t,n},e.$_$.n=function(e){return Gt(e,1)?e:Ke()},e.$_$.o=function(e,t){return n=new Fi(e,t,null),(r=function(e,t){return n.g13(e,t)}).$arity=1,r;var n,r},e.$_$.p=bi,e.$_$.q=function(e,t){return n=new $i(e,t,null),(r=function(e,t){return n.s12(e,t)}).$arity=1,r;var n,r},e.$_$.r=function(e,t){return n=new Di(e,t,null),(r=function(e,t){return n.e12(e,t)}).$arity=1,r;var n,r},e.$_$.s=Si,e.$_$.t=function(e,t){return n=new Bi(e,t,null),(r=function(e,t){return n.g13(e,t)}).$arity=1,r;var n,r},e.$_$.u=Oi,e.$_$.v=function(e,t){return n=new ji(e,t,null),(r=function(e,t){return n.s13(e,t)}).$arity=1,r;var n,r},e.$_$.w=function(e){return t=new Pi(e,null),(n=function(e,n){return t.j11(e,n)}).$arity=1,n;var t,n},e.$_$.x=function(e,t){return n=new ki(e,t,null),(r=function(e,t){return n.y10(e,t)}).$arity=1,r;var n,r},e.$_$.y=pn,e.$_$.z=vn,e.$_$.a1=wn,e.$_$.b1=Pn,e.$_$.c1=function e(t){var n;if(t instanceof pn)n=new pn(e(t.hp_1));else if(t instanceof vn){for(var r=t.jp_1.h1(),i=ft(dt(ht(r,10)),16),o=pt(i),s=r.j();s.k();){var a=s.l(),u=new mt(a.b1(),e(a.c1()));o.a3(u.r9_1,u.s9_1)}n=new vn(o)}else if(t instanceof En){for(var c=t.kp_1,l=st(),h=c.j();h.k();){var d,f=e(h.l());d=f instanceof En?f.kp_1:at(f),ut(l,d)}n=new En(lt(l))}else n=t;return n},e.$_$.d1=function e(t,n){if(t instanceof vn&&n instanceof vn){for(var r=tt(t.jp_1.h1(),n.jp_1.h1()),i=nt(),o=r.j();o.k();){var s=o.l(),a=i,u=a.f1(s.b1());i=null!=u?a.a3(s.b1(),e(u,s.c1())):a.a3(s.b1(),s.c1())}return new vn(i)}return t instanceof pn&&n instanceof pn?new pn(e(t.hp_1,n.hp_1)):t instanceof En&&n instanceof En?new En(rt(t.kp_1,n.kp_1)):t instanceof En?new En(it(t.kp_1,n)):n instanceof En?new En(it(n.kp_1,t)):Ze(t,n)?t:new En(ot([t,n]))},e.$_$.e1=gi,e.$_$.f1=_i,e.$_$.g1=yi,e.$_$.h1=di,e.$_$.i1=function(e,t,n){return e(t,n)},e.$_$.j1=v,e.$_$.k1=Pe,e.$_$.l1=qe,e.$_$.m1=Le,e.$_$.n1=l,e.$_$.o1=function(){return null==s&&new ln,s},e.$_$.p1=c,e.$_$.q1=function(){return null==h&&new gn,h},e.$_$.r1=a,e.$_$.s1=d,e.$_$.t1=function(){return null==u&&new dn,u},e.$_$.u1=f,e.$_$.v1=o,e.$_$.w1=p,e.$_$.x1=y,e})?r.apply(t,i):r)||(e.exports=o)},10557:(e,t,n)=>{var r=n(67787).Buffer,i=n(65994).e;Object.defineProperty(t,"__esModule",{value:!0}),t.GridFSBucketWriteStream=void 0;const o=n(93874),s=n(75080),a=n(61066),u=n(17562),c=n(7799),l=n(145),h=n(40012);class d extends o.Writable{constructor(e,t,n){super(),this.gridFSFile=null,n=n??{},this.bucket=e,this.chunks=e.s._chunksCollection,this.filename=t,this.files=e.s._filesCollection,this.options=n,this.writeConcern=h.WriteConcern.fromOptions(n)||e.s.options.writeConcern,this.done=!1,this.id=n.id?n.id:new s.ObjectId,this.chunkSizeBytes=n.chunkSizeBytes||this.bucket.s.options.chunkSizeBytes,this.bufToStore=r.alloc(this.chunkSizeBytes),this.length=0,this.n=0,this.pos=0,this.state={streamEnd:!1,outstandingRequests:0,errored:!1,aborted:!1},null!=n.timeoutMS&&(this.timeoutContext=new c.CSOTTimeoutContext({timeoutMS:n.timeoutMS,serverSelectionTimeoutMS:(0,l.resolveTimeoutOptions)(this.bucket.s.db.client,{}).serverSelectionTimeoutMS}))}_construct(e){if(this.bucket.s.calledOpenUploadStream)return i.nextTick(e);this.bucket.s.calledOpenUploadStream=!0,async function(e){let t=e.timeoutContext?.getRemainingTimeMSOrThrow(`Upload timed out after ${e.timeoutContext?.timeoutMS}ms`);if(null!=await e.files.findOne({},{projection:{_id:1},timeoutMS:t}))return;let n;t=e.timeoutContext?.getRemainingTimeMSOrThrow(`Upload timed out after ${e.timeoutContext?.timeoutMS}ms`);const r={timeoutMode:null!=t?a.CursorTimeoutMode.LIFETIME:void 0,timeoutMS:t};try{n=await e.files.listIndexes(r).toArray()}catch(e){if(!(e instanceof u.MongoError&&e.code===u.MONGODB_ERROR_CODES.NamespaceNotFound))throw e;n=[]}n.find((e=>2===Object.keys(e.key).length&&1===e.key.filename&&1===e.key.uploadDate))||(t=e.timeoutContext?.getRemainingTimeMSOrThrow(`Upload timed out after ${e.timeoutContext?.timeoutMS}ms`),await e.files.createIndex({filename:1,uploadDate:1},{background:!1,timeoutMS:t})),await async function(e){let t,n;t=e.timeoutContext?.getRemainingTimeMSOrThrow(`Upload timed out after ${e.timeoutContext?.timeoutMS}ms`);try{n=await e.chunks.listIndexes({timeoutMode:null!=t?a.CursorTimeoutMode.LIFETIME:void 0,timeoutMS:t}).toArray()}catch(e){if(!(e instanceof u.MongoError&&e.code===u.MONGODB_ERROR_CODES.NamespaceNotFound))throw e;n=[]}const r=!!n.find((e=>2===Object.keys(e.key).length&&1===e.key.files_id&&1===e.key.n));r||(t=e.timeoutContext?.getRemainingTimeMSOrThrow(`Upload timed out after ${e.timeoutContext?.timeoutMS}ms`),await e.chunks.createIndex({files_id:1,n:1},{...e.writeConcern,background:!0,unique:!0,timeoutMS:t}))}(e)}(this).then((()=>{this.bucket.s.checkedIndexes=!0,this.bucket.emit("index"),e()}),(t=>{if(t instanceof u.MongoOperationTimeoutError)return f(this,t,e);(0,l.squashError)(t),e()}))}_write(e,t,n){!function(e,t,n,o){if(g(e,o))return;const s=r.isBuffer(t)?t:r.from(t,n);if(e.length+=s.length,e.pos+s.length<e.chunkSizeBytes)return s.copy(e.bufToStore,e.pos),e.pos+=s.length,void i.nextTick(o);let a=s.length,c=e.chunkSizeBytes-e.pos,l=Math.min(c,s.length),h=0;for(;a>0;){const t=s.length-a;let n;if(s.copy(e.bufToStore,e.pos,t,t+l),e.pos+=l,c-=l,0===c){n=p(e.id,e.n,r.from(e.bufToStore));const t=e.timeoutContext?.remainingTimeMS;if(null!=t&&t<=0)return f(e,new u.MongoOperationTimeoutError(`Upload timed out after ${e.timeoutContext?.timeoutMS}ms`),o);if(++e.state.outstandingRequests,++h,g(e,o))return;e.chunks.insertOne(n,{writeConcern:e.writeConcern,timeoutMS:t}).then((()=>{--e.state.outstandingRequests,--h,h||m(e,o)}),(t=>f(e,t,o))),c=e.chunkSizeBytes,e.pos=0,++e.n}a-=l,l=Math.min(c,a)}}(this,e,t,n)}_final(e){if(this.state.streamEnd)return i.nextTick(e);this.state.streamEnd=!0,function(e,t){if(0===e.pos)return m(e,t);const n=r.alloc(e.pos);e.bufToStore.copy(n,0,0,e.pos);const i=p(e.id,e.n,n);if(g(e,t))return;const o=e.timeoutContext?.remainingTimeMS;if(null!=o&&o<=0)return f(e,new u.MongoOperationTimeoutError(`Upload timed out after ${e.timeoutContext?.timeoutMS}ms`),t);++e.state.outstandingRequests,e.chunks.insertOne(i,{writeConcern:e.writeConcern,timeoutMS:o}).then((()=>{--e.state.outstandingRequests,m(e,t)}),(n=>f(e,n,t)))}(this,e)}async abort(){if(this.state.streamEnd)throw new u.MongoAPIError("Cannot abort a stream that has already completed");if(this.state.aborted)throw new u.MongoAPIError("Cannot call abort() on a stream twice");this.state.aborted=!0;const e=this.timeoutContext?.getRemainingTimeMSOrThrow(`Upload timed out after ${this.timeoutContext?.timeoutMS}ms`);await this.chunks.deleteMany({files_id:this.id},{timeoutMS:e})}}function f(e,t,n){e.state.errored?i.nextTick(n):(e.state.errored=!0,i.nextTick(n,t))}function p(e,t,n){return{_id:new s.ObjectId,files_id:e,n:t,data:n}}function m(e,t){if(e.done)return i.nextTick(t);if(e.state.streamEnd&&0===e.state.outstandingRequests&&!e.state.errored){e.done=!0;const n=function(e,t,n,r,i,o,s){const a={_id:e,length:t,chunkSize:n,uploadDate:new Date,filename:r};return i&&(a.contentType=i),o&&(a.aliases=o),s&&(a.metadata=s),a}(e.id,e.length,e.chunkSizeBytes,e.filename,e.options.contentType,e.options.aliases,e.options.metadata);if(g(e,t))return;const r=e.timeoutContext?.remainingTimeMS;return null!=r&&r<=0?f(e,new u.MongoOperationTimeoutError(`Upload timed out after ${e.timeoutContext?.timeoutMS}ms`),t):void e.files.insertOne(n,{writeConcern:e.writeConcern,timeoutMS:r}).then((()=>{e.gridFSFile=n,t()}),(n=>f(e,n,t)))}i.nextTick(t)}function g(e,t){return!!e.state.aborted&&(i.nextTick(t,new u.MongoAPIError("Stream has been aborted")),!0)}t.GridFSBucketWriteStream=d},11706:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ListDatabasesOperation=void 0;const r=n(75725),i=n(145),o=n(78130),s=n(35394);class a extends o.CommandOperation{constructor(e,t){super(e,t),this.SERVER_COMMAND_RESPONSE_TYPE=r.MongoDBResponse,this.options=t??{},this.ns=new i.MongoDBNamespace("admin","$cmd")}get commandName(){return"listDatabases"}buildCommandDocument(e,t){const n={listDatabases:1};return"boolean"==typeof this.options.nameOnly&&(n.nameOnly=this.options.nameOnly),this.options.filter&&(n.filter=this.options.filter),"boolean"==typeof this.options.authorizedDatabases&&(n.authorizedDatabases=this.options.authorizedDatabases),(0,i.maxWireVersion)(e)>=9&&void 0!==this.options.comment&&(n.comment=this.options.comment),n}}t.ListDatabasesOperation=a,(0,s.defineAspects)(a,[s.Aspect.READ_OPERATION,s.Aspect.RETRYABLE])},11737:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.buildReplaceOneOperation=t.buildUpdateManyOperation=t.buildUpdateOneOperation=t.buildDeleteManyOperation=t.buildDeleteOneOperation=t.buildInsertOneOperation=t.ClientBulkWriteCommandBuilder=void 0,t.buildOperation=h;const r=n(75080),i=n(15620),o=n(17562),s=n(30770),a=n(145);function u(e,t,n){if(t.length>n)throw new o.MongoInvalidArgumentError(`Client bulk write operation ${e} of length ${t.length} exceeds the max bson object size of ${n}`)}function c(e,t,n){const r={delete:t,multi:n,filter:e.filter};return e.hint&&(r.hint=e.hint),e.collation&&(r.collation=e.collation),r}function l(e,t,n,r){!function(e,t){if(!(0,a.hasAtomicOperators)(e,t))throw new o.MongoAPIError("Client bulk write update models must only contain atomic modifiers (start with $) and must not be empty.")}(e.update,r);const i={update:t,multi:n,filter:e.filter,updateMods:e.update};return e.hint&&(i.hint=e.hint),e.upsert&&(i.upsert=e.upsert),e.arrayFilters&&(i.arrayFilters=e.arrayFilters),e.collation&&(i.collation=e.collation),!n&&"sort"in e&&null!=e.sort&&(i.sort=(0,s.formatSort)(e.sort)),i}function h(e,n,r,i){switch(e.name){case"insertOne":return(0,t.buildInsertOneOperation)(e,n,r);case"deleteOne":return(0,t.buildDeleteOneOperation)(e,n);case"deleteMany":return(0,t.buildDeleteManyOperation)(e,n);case"updateOne":return(0,t.buildUpdateOneOperation)(e,n,i);case"updateMany":return(0,t.buildUpdateManyOperation)(e,n,i);case"replaceOne":return(0,t.buildReplaceOneOperation)(e,n)}}t.ClientBulkWriteCommandBuilder=class{constructor(e,t,n){this.models=e,this.options=t,this.pkFactory=n??a.DEFAULT_PK_FACTORY,this.currentModelIndex=0,this.previousModelIndex=0,this.lastOperations=[],this.isBatchRetryable=!0}get errorsOnly(){return!("verboseResults"in this.options)||!this.options.verboseResults}hasNextBatch(){return this.currentModelIndex<this.models.length}resetBatch(){return this.currentModelIndex=this.previousModelIndex,!0}buildBatch(e,t,n){this.isBatchRetryable=!0;let i=0,s=0;const a=this.baseCommand(),c=new Map;for(this.previousModelIndex=this.currentModelIndex;this.currentModelIndex<this.models.length;){const l=this.models[this.currentModelIndex],d=l.namespace,f=c.get(d);if("deleteMany"!==l.name&&"updateMany"!==l.name||(this.isBatchRetryable=!1),null!=f){const s=h(l,f,this.pkFactory,this.options);let c;try{c=r.BSON.serialize(s)}catch(e){throw new o.MongoInvalidArgumentError("Could not serialize operation to BSON",{cause:e})}if(u("ops",c,n),!(i+c.length<e&&a.ops.documents.length<t))break;i=1e3+a.ops.push(s,c),this.currentModelIndex++}else{c.set(d,s);const f={ns:d},p=h(l,s,this.pkFactory,this.options);let m,g;try{m=r.BSON.serialize(f),g=r.BSON.serialize(p)}catch(e){throw new o.MongoInvalidArgumentError("Could not serialize ns info to BSON",{cause:e})}if(u("nsInfo",m,n),u("ops",g,n),!(i+m.length+g.length<e&&a.ops.documents.length<t))break;i=1e3+a.nsInfo.push(f,m)+a.ops.push(p,g),s++,this.currentModelIndex++}}return this.lastOperations=a.ops.documents,a}baseCommand(){const e={bulkWrite:1,errorsOnly:this.errorsOnly,ordered:this.options.ordered??!0,ops:new i.DocumentSequence("ops"),nsInfo:new i.DocumentSequence("nsInfo")};return null!=this.options.bypassDocumentValidation&&(e.bypassDocumentValidation=this.options.bypassDocumentValidation),this.options.let&&(e.let=this.options.let),void 0!==this.options.comment&&(e.comment=this.options.comment),e}},t.buildInsertOneOperation=(e,t,n)=>{const r={insert:t,document:e.document};return r.document._id=e.document._id??n.createPk(),r},t.buildDeleteOneOperation=(e,t)=>c(e,t,!1),t.buildDeleteManyOperation=(e,t)=>c(e,t,!0),t.buildUpdateOneOperation=(e,t,n)=>l(e,t,!1,n),t.buildUpdateManyOperation=(e,t,n)=>l(e,t,!0,n),t.buildReplaceOneOperation=(e,t)=>{if((0,a.hasAtomicOperators)(e.replacement))throw new o.MongoAPIError("Client bulk write replace models must not contain atomic modifiers (start with $) and must not be empty.");const n={update:t,multi:!1,filter:e.filter,updateMods:e.replacement};return e.hint&&(n.hint=e.hint),e.upsert&&(n.upsert=e.upsert),e.collation&&(n.collation=e.collation),null!=e.sort&&(n.sort=(0,s.formatSort)(e.sort)),n}},12453:e=>{const t=function(e){return e=e.toString(),this instanceof t?(this.ns=e,this.dotIndex=e.indexOf("."),-1===this.dotIndex?(this.database=e,this.collection=""):(this.database=e.slice(0,this.dotIndex),this.collection=e.slice(this.dotIndex+1)),this.system=/^(?:system(?!\.profile$).*|enxcol_)\./.test(this.collection),this.oplog=/local\.oplog\.(\$main|rs)/.test(e),this.command="$cmd"===this.collection||0===this.collection.indexOf("$cmd.sys"),this.special=this.oplog||this.command||this.system||"config"===this.database||/^__mdb_internal_\w/.test(this.database),this.specialish=this.special||["local","admin"].indexOf(this.database)>-1,this.normal=this.oplog||-1===this.ns.indexOf("$"),this.validDatabaseName=new RegExp('^[^\\\\/". ]*$').test(this.database)&&this.database.length<=t.MAX_DATABASE_NAME_LENGTH,this.validCollectionName=this.collection.length>0&&(this.oplog||/^[^\0$]*$/.test(this.collection)),this.databaseHash=7,this.ns.split("").every(((e,t)=>"."!==e&&(this.databaseHash+=11*this.ns.charCodeAt(t),this.databaseHash*=3,!0))),this):new t(e)};t.prototype.database="",t.prototype.databaseHash=0,t.prototype.collection="",t.prototype.command=!1,t.prototype.special=!1,t.prototype.system=!1,t.prototype.oplog=!1,t.prototype.normal=!1,t.prototype.specialish=!1,t.prototype.isCommand=function(){return this.command},t.prototype.isSpecial=function(){return this.special},t.prototype.isSystem=function(){return this.system},t.prototype.isNormal=function(){return this.normal},t.prototype.isOplog=function(){return this.oplog},t.prototype.isConf=function(){},t.prototype.toString=function(){return this.ns},t.MAX_DATABASE_NAME_LENGTH=128,t.sort=function(e){return e.sort((function(e,n){return new t(e).specialish&&new t(n).specialish?0:new t(e).specialish&&!new t(n).specialish?1:!new t(e).specialish&&new t(n).specialish?-1:e>n?1:-1})),e},e.exports=t},13700:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ReadPreference=t.ReadPreferenceMode=void 0;const r=n(17562);t.ReadPreferenceMode=Object.freeze({primary:"primary",primaryPreferred:"primaryPreferred",secondary:"secondary",secondaryPreferred:"secondaryPreferred",nearest:"nearest"});class i{constructor(e,t,n){if(!i.isValid(e))throw new r.MongoInvalidArgumentError(`Invalid read preference mode ${JSON.stringify(e)}`);if(null!=n||"object"!=typeof t||Array.isArray(t)){if(t&&!Array.isArray(t))throw new r.MongoInvalidArgumentError("ReadPreference tags must be an array")}else n=t,t=void 0;if(this.mode=e,this.tags=t,this.hedge=n?.hedge,this.maxStalenessSeconds=void 0,this.minWireVersion=void 0,null!=(n=n??{}).maxStalenessSeconds){if(n.maxStalenessSeconds<=0)throw new r.MongoInvalidArgumentError("maxStalenessSeconds must be a positive integer");this.maxStalenessSeconds=n.maxStalenessSeconds,this.minWireVersion=5}if(this.mode===i.PRIMARY){if(this.tags&&Array.isArray(this.tags)&&this.tags.length>0)throw new r.MongoInvalidArgumentError("Primary read preference cannot be combined with tags");if(this.maxStalenessSeconds)throw new r.MongoInvalidArgumentError("Primary read preference cannot be combined with maxStalenessSeconds");if(this.hedge)throw new r.MongoInvalidArgumentError("Primary read preference cannot be combined with hedge")}}get preference(){return this.mode}static fromString(e){return new i(e)}static fromOptions(e){if(!e)return;const t=e.readPreference??e.session?.transaction.options.readPreference,n=e.readPreferenceTags;if(null!=t){if("string"==typeof t)return new i(t,n,{maxStalenessSeconds:e.maxStalenessSeconds,hedge:e.hedge});if(!(t instanceof i)&&"object"==typeof t){const r=t.mode||t.preference;if(r&&"string"==typeof r)return new i(r,t.tags??n,{maxStalenessSeconds:t.maxStalenessSeconds,hedge:e.hedge})}return n&&(t.tags=n),t}}static translate(e){if(null==e.readPreference)return e;const t=e.readPreference;if("string"==typeof t)e.readPreference=new i(t);else if(!t||t instanceof i||"object"!=typeof t){if(!(t instanceof i))throw new r.MongoInvalidArgumentError(`Invalid read preference: ${t}`)}else{const n=t.mode||t.preference;n&&"string"==typeof n&&(e.readPreference=new i(n,t.tags,{maxStalenessSeconds:t.maxStalenessSeconds}))}return e}static isValid(e){return new Set([i.PRIMARY,i.PRIMARY_PREFERRED,i.SECONDARY,i.SECONDARY_PREFERRED,i.NEAREST,null]).has(e)}isValid(e){return i.isValid("string"==typeof e?e:this.mode)}secondaryOk(){return new Set([i.PRIMARY_PREFERRED,i.SECONDARY,i.SECONDARY_PREFERRED,i.NEAREST]).has(this.mode)}equals(e){return e.mode===this.mode}toJSON(){const e={mode:this.mode};return Array.isArray(this.tags)&&(e.tags=this.tags),this.maxStalenessSeconds&&(e.maxStalenessSeconds=this.maxStalenessSeconds),this.hedge&&(e.hedge=this.hedge),e}}t.ReadPreference=i,i.PRIMARY=t.ReadPreferenceMode.primary,i.PRIMARY_PREFERRED=t.ReadPreferenceMode.primaryPreferred,i.SECONDARY=t.ReadPreferenceMode.secondary,i.SECONDARY_PREFERRED=t.ReadPreferenceMode.secondaryPreferred,i.NEAREST=t.ReadPreferenceMode.nearest,i.primary=new i(t.ReadPreferenceMode.primary),i.primaryPreferred=new i(t.ReadPreferenceMode.primaryPreferred),i.secondary=new i(t.ReadPreferenceMode.secondary),i.secondaryPreferred=new i(t.ReadPreferenceMode.secondaryPreferred),i.nearest=new i(t.ReadPreferenceMode.nearest)},14012:e=>{function t(e,t){if(!e)throw new Error(t||"Assertion failed")}e.exports=t,t.equal=function(e,t,n){if(e!=t)throw new Error(n||"Assertion failed: "+e+" != "+t)}},14019:(e,t,n)=>{var r=n(67787).Buffer;Object.defineProperty(t,"__esModule",{value:!0}),t.ServerSessionPool=t.ServerSession=t.ClientSession=void 0,t.maybeClearPinnedConnection=b,t.applySession=function(e,t,n){if(e.hasEnded)return new u.MongoExpiredSessionError;const r=e.serverSession;if(null==r)return new u.MongoRuntimeError("Unable to acquire server session");if(0===n.writeConcern?.w)return e&&e.explicit?new u.MongoAPIError("Cannot have explicit session with unacknowledged writes"):void 0;r.lastUse=(0,y.now)(),t.lsid=r.id;const o=e.inTransaction()||(0,_.isTransactionCommand)(t);if((n.willRetryWrite||o)&&(r.txnNumber+=e.txnNumberIncrement,e.txnNumberIncrement=0,t.txnNumber=i.Long.fromNumber(r.txnNumber)),!o)return e.transaction.state!==_.TxnState.NO_TRANSACTION&&e.transaction.transition(_.TxnState.NO_TRANSACTION),void(e.supports.causalConsistency&&e.operationTime&&(0,y.commandSupportsReadConcern)(t)?(t.readConcern=t.readConcern||{},Object.assign(t.readConcern,{afterClusterTime:e.operationTime})):e.snapshotEnabled&&(t.readConcern=t.readConcern||{level:d.ReadConcernLevel.snapshot},null!=e.snapshotTime&&Object.assign(t.readConcern,{atClusterTime:e.snapshotTime})));if(t.autocommit=!1,e.transaction.state===_.TxnState.STARTING_TRANSACTION){e.transaction.transition(_.TxnState.TRANSACTION_IN_PROGRESS),t.startTransaction=!0;const n=e.transaction.options.readConcern||e?.clientOptions?.readConcern;n&&(t.readConcern=n),e.supports.causalConsistency&&e.operationTime&&(t.readConcern=t.readConcern||{},Object.assign(t.readConcern,{afterClusterTime:e.operationTime}))}},t.updateSessionFromResponse=function(e,t){if(t.$clusterTime&&(0,m._advanceClusterTime)(e,t.$clusterTime),t.operationTime&&e&&e.supports.causalConsistency&&e.advanceOperationTime(t.operationTime),t.recoveryToken&&e&&e.inTransaction()&&(e.transaction._recoveryToken=t.recoveryToken),e?.snapshotEnabled&&null==e.snapshotTime){const n=t.atClusterTime;n&&(e.snapshotTime=n)}};const i=n(75080),o=n(55741),s=n(61428),a=n(91869),u=n(17562),c=n(4642),l=n(96357),h=n(17668),d=n(28541),f=n(13700),p=n(31790),m=n(89167),g=n(7799),_=n(85759),y=n(145),v=n(40012);class E extends c.TypedEventEmitter{constructor(e,t,n,r){if(super(),this.timeoutContext=null,this.on("error",y.noop),null==e)throw new u.MongoRuntimeError("ClientSession requires a MongoClient");if(null==t||!(t instanceof A))throw new u.MongoRuntimeError("ClientSession requires a ServerSessionPool");if(n=n??{},this.snapshotEnabled=!0===n.snapshot,!0===n.causalConsistency&&this.snapshotEnabled)throw new u.MongoInvalidArgumentError('Properties "causalConsistency" and "snapshot" are mutually exclusive');this.client=e,this.sessionPool=t,this.hasEnded=!1,this.clientOptions=r,this.timeoutMS=n.defaultTimeoutMS??e.s.options?.timeoutMS,this.explicit=!!n.explicit,this._serverSession=this.explicit?this.sessionPool.acquire():null,this.txnNumberIncrement=0;const i=this.explicit&&!0!==n.snapshot;this.supports={causalConsistency:n.causalConsistency??i},this.clusterTime=n.initialClusterTime,this.operationTime=void 0,this.owner=n.owner,this.defaultTransactionOptions={...n.defaultTransactionOptions},this.transaction=new _.Transaction}get id(){return this.serverSession?.id}get serverSession(){let e=this._serverSession;if(null==e){if(this.explicit)throw new u.MongoRuntimeError("Unexpected null serverSession for an explicit session");if(this.hasEnded)throw new u.MongoRuntimeError("Unexpected null serverSession for an ended implicit session");e=this.sessionPool.acquire(),this._serverSession=e}return e}get loadBalanced(){return this.client.topology?.description.type===m.TopologyType.LoadBalanced}pin(e){if(this.pinnedConnection)throw TypeError("Cannot pin multiple connections to the same session");this.pinnedConnection=e,e.emit(a.PINNED,this.inTransaction()?o.ConnectionPoolMetrics.TXN:o.ConnectionPoolMetrics.CURSOR)}unpin(e){if(this.loadBalanced)return b(this,e);this.transaction.unpinServer()}get isPinned(){return this.loadBalanced?!!this.pinnedConnection:this.transaction.isPinned}async endSession(e){try{this.inTransaction()&&await this.abortTransaction({...e,throwTimeout:!0})}catch(e){if("MongoOperationTimeoutError"===e.name)throw e;(0,y.squashError)(e)}finally{if(!this.hasEnded){const e=this.serverSession;null!=e&&(this.sessionPool.release(e),this._serverSession=new T(e)),this.hasEnded=!0,this.emit("ended",this)}b(this,{force:!0,...e})}}async asyncDispose(){await this.endSession({force:!0})}advanceOperationTime(e){null!=this.operationTime?e.greaterThan(this.operationTime)&&(this.operationTime=e):this.operationTime=e}advanceClusterTime(e){if(!e||"object"!=typeof e)throw new u.MongoInvalidArgumentError("input cluster time must be an object");if(!e.clusterTime||"Timestamp"!==e.clusterTime._bsontype)throw new u.MongoInvalidArgumentError('input cluster time "clusterTime" property must be a valid BSON Timestamp');if(!e.signature||"Binary"!==e.signature.hash?._bsontype||"bigint"!=typeof e.signature.keyId&&"number"!=typeof e.signature.keyId&&"Long"!==e.signature.keyId?._bsontype)throw new u.MongoInvalidArgumentError('input cluster time must have a valid "signature" property with BSON Binary hash and BSON Long keyId');(0,m._advanceClusterTime)(this,e)}equals(e){return e instanceof E&&null!=this.id&&null!=e.id&&y.ByteUtils.equals(this.id.id.buffer,e.id.id.buffer)}incrementTransactionNumber(){this.txnNumberIncrement+=1}inTransaction(){return this.transaction.isActive}startTransaction(e){if(this.snapshotEnabled)throw new u.MongoCompatibilityError("Transactions are not supported in snapshot sessions");if(this.inTransaction())throw new u.MongoTransactionError("Transaction already in progress");this.isPinned&&this.transaction.isCommitted&&this.unpin();const t=(0,y.maxWireVersion)(this.client.topology);if((0,s.isSharded)(this.client.topology)&&null!=t&&t<8)throw new u.MongoCompatibilityError("Transactions are not supported on sharded clusters in MongoDB < 4.2.");this.commitAttempted=!1,this.incrementTransactionNumber(),this.transaction=new _.Transaction({readConcern:e?.readConcern??this.defaultTransactionOptions.readConcern??this.clientOptions?.readConcern,writeConcern:e?.writeConcern??this.defaultTransactionOptions.writeConcern??this.clientOptions?.writeConcern,readPreference:e?.readPreference??this.defaultTransactionOptions.readPreference??this.clientOptions?.readPreference,maxCommitTimeMS:e?.maxCommitTimeMS??this.defaultTransactionOptions.maxCommitTimeMS}),this.transaction.transition(_.TxnState.STARTING_TRANSACTION)}async commitTransaction(e){if(this.transaction.state===_.TxnState.NO_TRANSACTION)throw new u.MongoTransactionError("No transaction started");if(this.transaction.state===_.TxnState.STARTING_TRANSACTION||this.transaction.state===_.TxnState.TRANSACTION_COMMITTED_EMPTY)return void this.transaction.transition(_.TxnState.TRANSACTION_COMMITTED_EMPTY);if(this.transaction.state===_.TxnState.TRANSACTION_ABORTED)throw new u.MongoTransactionError("Cannot call commitTransaction after calling abortTransaction");const t={commitTransaction:1},n="number"==typeof e?.timeoutMS?e.timeoutMS:"number"==typeof this.timeoutMS?this.timeoutMS:null,r=this.transaction.options.writeConcern??this.clientOptions?.writeConcern;if(null!=r)if(null==n&&null==this.timeoutContext)v.WriteConcern.apply(t,{wtimeoutMS:1e4,w:"majority",...r});else{const e=Object.keys(r);(e.length>2||!e.includes("wtimeoutMS")&&!e.includes("wTimeoutMS"))&&v.WriteConcern.apply(t,{...r,wtimeoutMS:void 0})}(this.transaction.state===_.TxnState.TRANSACTION_COMMITTED||this.commitAttempted)&&(null==n&&null==this.timeoutContext?v.WriteConcern.apply(t,{wtimeoutMS:1e4,...r,w:"majority"}):v.WriteConcern.apply(t,{w:"majority",...r,wtimeoutMS:void 0})),"number"==typeof this.transaction.options.maxTimeMS&&(t.maxTimeMS=this.transaction.options.maxTimeMS),this.transaction.recoveryToken&&(t.recoveryToken=this.transaction.recoveryToken);const i=new h.RunCommandOperation(new y.MongoDBNamespace("admin"),t,{session:this,readPreference:f.ReadPreference.primary,bypassPinningCheck:!0}),o=this.timeoutContext??("number"==typeof n?g.TimeoutContext.create({serverSelectionTimeoutMS:this.clientOptions.serverSelectionTimeoutMS,socketTimeoutMS:this.clientOptions.socketTimeoutMS,timeoutMS:n}):null);try{return await(0,l.executeOperation)(this.client,i,o),void(this.commitAttempted=void 0)}catch(e){if(this.commitAttempted=!0,e instanceof u.MongoError&&(0,u.isRetryableWriteError)(e)){v.WriteConcern.apply(t,{wtimeoutMS:1e4,...r,w:"majority"}),this.unpin({force:!0});try{return void await(0,l.executeOperation)(this.client,new h.RunCommandOperation(new y.MongoDBNamespace("admin"),t,{session:this,readPreference:f.ReadPreference.primary,bypassPinningCheck:!0}),o)}catch(e){throw C(e)&&e.addErrorLabel(u.MongoErrorLabel.UnknownTransactionCommitResult),w(e)&&this.unpin({error:e}),e}}throw C(e)&&e.addErrorLabel(u.MongoErrorLabel.UnknownTransactionCommitResult),w(e)&&this.unpin({error:e}),e}finally{this.transaction.transition(_.TxnState.TRANSACTION_COMMITTED)}}async abortTransaction(e){if(this.transaction.state===_.TxnState.NO_TRANSACTION)throw new u.MongoTransactionError("No transaction started");if(this.transaction.state===_.TxnState.STARTING_TRANSACTION)return void this.transaction.transition(_.TxnState.TRANSACTION_ABORTED);if(this.transaction.state===_.TxnState.TRANSACTION_ABORTED)throw new u.MongoTransactionError("Cannot call abortTransaction twice");if(this.transaction.state===_.TxnState.TRANSACTION_COMMITTED||this.transaction.state===_.TxnState.TRANSACTION_COMMITTED_EMPTY)throw new u.MongoTransactionError("Cannot call abortTransaction after calling commitTransaction");const t={abortTransaction:1},n="number"==typeof e?.timeoutMS?e.timeoutMS:this.timeoutContext?.csotEnabled()?this.timeoutContext.timeoutMS:"number"==typeof this.timeoutMS?this.timeoutMS:null,r=null!=n?g.TimeoutContext.create({timeoutMS:n,serverSelectionTimeoutMS:this.clientOptions.serverSelectionTimeoutMS,socketTimeoutMS:this.clientOptions.socketTimeoutMS}):null,i=this.transaction.options.writeConcern??this.clientOptions?.writeConcern;null!=i&&null==n&&v.WriteConcern.apply(t,{wtimeoutMS:1e4,w:"majority",...i}),this.transaction.recoveryToken&&(t.recoveryToken=this.transaction.recoveryToken);const o=new h.RunCommandOperation(new y.MongoDBNamespace("admin"),t,{session:this,readPreference:f.ReadPreference.primary,bypassPinningCheck:!0});try{return await(0,l.executeOperation)(this.client,o,r),void this.unpin()}catch(t){if(this.unpin(),"MongoRuntimeError"===t.name)throw t;if(e?.throwTimeout&&"MongoOperationTimeoutError"===t.name)throw t;if(t instanceof u.MongoError&&(0,u.isRetryableWriteError)(t))try{return void await(0,l.executeOperation)(this.client,o,r)}catch(t){if("MongoRuntimeError"===t.name)throw t;if(e?.throwTimeout&&"MongoOperationTimeoutError"===t.name)throw t}}finally{this.transaction.transition(_.TxnState.TRANSACTION_ABORTED),this.loadBalanced&&b(this,{force:!1})}}toBSON(){throw new u.MongoRuntimeError("ClientSession cannot be serialized to BSON.")}async withTransaction(e,t){const n=12e4,r=t?.timeoutMS??this.timeoutMS??null;this.timeoutContext=null!=r?g.TimeoutContext.create({timeoutMS:r,serverSelectionTimeoutMS:this.clientOptions.serverSelectionTimeoutMS,socketTimeoutMS:this.clientOptions.socketTimeoutMS}):null;const i=this.timeoutContext?.csotEnabled()?this.timeoutContext.start:(0,y.now)();let o,s=!1;try{for(;!s;){this.startTransaction(t);try{const t=e(this);if(!(0,y.isPromiseLike)(t))throw new u.MongoInvalidArgumentError("Function provided to `withTransaction` must return a Promise");if(o=await t,this.transaction.state===_.TxnState.NO_TRANSACTION||this.transaction.state===_.TxnState.TRANSACTION_COMMITTED||this.transaction.state===_.TxnState.TRANSACTION_ABORTED)return o}catch(e){if(!(e instanceof u.MongoError)||e instanceof u.MongoInvalidArgumentError)throw await this.abortTransaction(),e;if(this.transaction.state!==_.TxnState.STARTING_TRANSACTION&&this.transaction.state!==_.TxnState.TRANSACTION_IN_PROGRESS||await this.abortTransaction(),e.hasErrorLabel(u.MongoErrorLabel.TransientTransactionError)&&(null!=this.timeoutContext||(0,y.now)()-i<n))continue;throw e}for(;!s;)try{await this.commitTransaction(),s=!0}catch(e){if(!M(e)&&e.hasErrorLabel(u.MongoErrorLabel.UnknownTransactionCommitResult)&&(null!=this.timeoutContext||(0,y.now)()-i<n))continue;if(e.hasErrorLabel(u.MongoErrorLabel.TransientTransactionError)&&(null!=this.timeoutContext||(0,y.now)()-i<n))break;throw e}}return o}finally{this.timeoutContext=null}}}t.ClientSession=E,(0,p.configureResourceManagement)(E.prototype);const S=new Set(["CannotSatisfyWriteConcern","UnknownReplWriteConcern","UnsatisfiableWriteConcern"]);function w(e){if(e instanceof u.MongoError)if((0,u.isRetryableWriteError)(e)||e instanceof u.MongoWriteConcernError||M(e)){if(O(e))return!0}else if(e.hasErrorLabel(u.MongoErrorLabel.TransientTransactionError))return!0;return!1}function C(e){let t=(0,u.isRetryableWriteError)(e);return t||=e instanceof u.MongoWriteConcernError,t||=M(e),t&&=O(e),t}function O(e){const t=e instanceof u.MongoServerError&&e.codeName&&S.has(e.codeName);return M(e)||!t&&e.code!==u.MONGODB_ERROR_CODES.UnsatisfiableWriteConcern&&e.code!==u.MONGODB_ERROR_CODES.UnknownReplWriteConcern}function b(e,t){const n=e.pinnedConnection,r=t?.error;if(e.inTransaction()&&r&&r instanceof u.MongoError&&r.hasErrorLabel(u.MongoErrorLabel.TransientTransactionError))return;const i=e.client.topology;if(n&&null!=i){const r=Array.from(i.s.servers.values())[0];(null==t?.error||t?.force)&&(r.pool.checkIn(n),e.pinnedConnection=void 0,n.emit(a.UNPINNED,e.transaction.state!==_.TxnState.NO_TRANSACTION?o.ConnectionPoolMetrics.TXN:o.ConnectionPoolMetrics.CURSOR),t?.forceClear&&r.pool.clear({serviceId:n.serviceId}))}}function M(e){return null!=e&&e instanceof u.MongoServerError&&(e.code===u.MONGODB_ERROR_CODES.MaxTimeMSExpired||e.writeConcernError?.code===u.MONGODB_ERROR_CODES.MaxTimeMSExpired)}class T{constructor(e){if(null!=e){const t=r.allocUnsafe(16);return t.set(e.id.id.buffer),this.id={id:new i.Binary(t,e.id.id.sub_type)},this.lastUse=e.lastUse,this.txnNumber=e.txnNumber,void(this.isDirty=e.isDirty)}this.id={id:new i.Binary((0,y.uuidV4)(),i.Binary.SUBTYPE_UUID)},this.lastUse=(0,y.now)(),this.txnNumber=0,this.isDirty=!1}hasTimedOut(e){return Math.round((0,y.calculateDurationInMs)(this.lastUse)%864e5%36e5/6e4)>e-1}}t.ServerSession=T;class A{constructor(e){if(null==e)throw new u.MongoRuntimeError("ServerSessionPool requires a MongoClient");this.client=e,this.sessions=new y.List}acquire(){const e=this.client.topology?.logicalSessionTimeoutMinutes??10;let t=null;for(;this.sessions.length>0;){const n=this.sessions.shift();if(null!=n&&(this.client.topology?.loadBalanced||!n.hasTimedOut(e))){t=n;break}}return null==t&&(t=new T),t}release(e){const t=this.client.topology?.logicalSessionTimeoutMinutes??10;if(this.client.topology?.loadBalanced&&!t&&this.sessions.unshift(e),t&&(this.sessions.prune((e=>e.hasTimedOut(t))),!e.hasTimedOut(t))){if(e.isDirty)return;this.sessions.unshift(e)}}}t.ServerSessionPool=A},15620:(e,t,n)=>{var r=n(67787).Buffer;Object.defineProperty(t,"__esModule",{value:!0}),t.OpCompressedRequest=t.OpMsgResponse=t.OpMsgRequest=t.DocumentSequence=t.OpReply=t.OpQueryRequest=void 0;const i=n(75080),o=n(17562),s=n(64515),a=n(96856);let u=0;const c=i.BSON.onDemand.ByteUtils.encodeUTF8Into;class l{constructor(e,t,n){this.moreToCome=!1;const r=`${e}.$cmd`;if("string"!=typeof e)throw new o.MongoRuntimeError("Database name must be a string for a query");if(null==t)throw new o.MongoRuntimeError("A query document must be specified for query");if(-1!==r.indexOf("\0"))throw new o.MongoRuntimeError("Namespace cannot contain a null character");this.databaseName=e,this.query=t,this.ns=r,this.numberToSkip=n.numberToSkip||0,this.numberToReturn=n.numberToReturn||0,this.returnFieldSelector=n.returnFieldSelector||void 0,this.requestId=n.requestId??l.getRequestId(),this.pre32Limit=n.pre32Limit,this.serializeFunctions="boolean"==typeof n.serializeFunctions&&n.serializeFunctions,this.ignoreUndefined="boolean"==typeof n.ignoreUndefined&&n.ignoreUndefined,this.maxBsonSize=n.maxBsonSize||16777216,this.checkKeys="boolean"==typeof n.checkKeys&&n.checkKeys,this.batchSize=this.numberToReturn,this.tailable=!1,this.secondaryOk="boolean"==typeof n.secondaryOk&&n.secondaryOk,this.oplogReplay=!1,this.noCursorTimeout=!1,this.awaitData=!1,this.exhaust=!1,this.partial=!1}incRequestId(){this.requestId=u++}nextRequestId(){return u+1}static getRequestId(){return++u}toBin(){const e=[];let t=null,n=0;this.tailable&&(n|=2),this.secondaryOk&&(n|=4),this.oplogReplay&&(n|=8),this.noCursorTimeout&&(n|=16),this.awaitData&&(n|=32),this.exhaust&&(n|=64),this.partial&&(n|=128),this.batchSize!==this.numberToReturn&&(this.numberToReturn=this.batchSize);const o=r.alloc(20+r.byteLength(this.ns)+1+4+4);e.push(o);const s=i.serialize(this.query,{checkKeys:this.checkKeys,serializeFunctions:this.serializeFunctions,ignoreUndefined:this.ignoreUndefined});e.push(s),this.returnFieldSelector&&Object.keys(this.returnFieldSelector).length>0&&(t=i.serialize(this.returnFieldSelector,{checkKeys:this.checkKeys,serializeFunctions:this.serializeFunctions,ignoreUndefined:this.ignoreUndefined}),e.push(t));const u=o.length+s.length+(t?t.length:0);let c=4;return o[3]=u>>24&255,o[2]=u>>16&255,o[1]=u>>8&255,o[0]=255&u,o[c+3]=this.requestId>>24&255,o[c+2]=this.requestId>>16&255,o[c+1]=this.requestId>>8&255,o[c]=255&this.requestId,c+=4,o[c+3]=0,o[c+2]=0,o[c+1]=0,o[c]=0,c+=4,o[c+3]=a.OP_QUERY>>24&255,o[c+2]=a.OP_QUERY>>16&255,o[c+1]=a.OP_QUERY>>8&255,o[c]=255&a.OP_QUERY,c+=4,o[c+3]=n>>24&255,o[c+2]=n>>16&255,o[c+1]=n>>8&255,o[c]=255&n,c+=4,c=c+o.write(this.ns,c,"utf8")+1,o[c-1]=0,o[c+3]=this.numberToSkip>>24&255,o[c+2]=this.numberToSkip>>16&255,o[c+1]=this.numberToSkip>>8&255,o[c]=255&this.numberToSkip,c+=4,o[c+3]=this.numberToReturn>>24&255,o[c+2]=this.numberToReturn>>16&255,o[c+1]=this.numberToReturn>>8&255,o[c]=255&this.numberToReturn,c+=4,e}}t.OpQueryRequest=l,t.OpReply=class{constructor(e,t,n,r){this.index=0,this.sections=[],this.moreToCome=!1,this.parsed=!1,this.raw=e,this.data=n,this.opts=r??{useBigInt64:!1,promoteLongs:!0,promoteValues:!0,promoteBuffers:!1,bsonRegExp:!1},this.length=t.length,this.requestId=t.requestId,this.responseTo=t.responseTo,this.opCode=t.opCode,this.fromCompressed=t.fromCompressed,this.useBigInt64="boolean"==typeof this.opts.useBigInt64&&this.opts.useBigInt64,this.promoteLongs="boolean"!=typeof this.opts.promoteLongs||this.opts.promoteLongs,this.promoteValues="boolean"!=typeof this.opts.promoteValues||this.opts.promoteValues,this.promoteBuffers="boolean"==typeof this.opts.promoteBuffers&&this.opts.promoteBuffers,this.bsonRegExp="boolean"==typeof this.opts.bsonRegExp&&this.opts.bsonRegExp}isParsed(){return this.parsed}parse(){if(this.parsed)return this.sections[0];if(this.index=20,this.responseFlags=this.data.readInt32LE(0),this.cursorId=new i.Long(this.data.readInt32LE(4),this.data.readInt32LE(8)),this.startingFrom=this.data.readInt32LE(12),this.numberReturned=this.data.readInt32LE(16),this.numberReturned<0||this.numberReturned>2**32-1)throw new RangeError(`OP_REPLY numberReturned is an invalid array length ${this.numberReturned}`);this.cursorNotFound=!!(1&this.responseFlags),this.queryFailure=!!(2&this.responseFlags),this.shardConfigStale=!!(4&this.responseFlags),this.awaitCapable=!!(8&this.responseFlags);for(let e=0;e<this.numberReturned;e++){const e=this.data[this.index]|this.data[this.index+1]<<8|this.data[this.index+2]<<16|this.data[this.index+3]<<24,t=this.data.subarray(this.index,this.index+e);this.sections.push(t),this.index=this.index+e}return this.parsed=!0,this.sections[0]}};class h{constructor(e,t){this.field=e,this.documents=[],this.chunks=[],this.serializedDocumentsLength=0;const n=r.allocUnsafe(5+this.field.length+1);if(n[0]=1,c(n,`${this.field}\0`,5),this.chunks.push(n),this.header=n,t)for(const e of t)this.push(e,i.serialize(e))}push(e,t){return this.serializedDocumentsLength+=t.length,this.documents.push(e),this.chunks.push(t),this.header?.writeInt32LE(4+this.field.length+1+this.serializedDocumentsLength,1),this.serializedDocumentsLength+this.header.length}toBin(){return r.concat(this.chunks)}}t.DocumentSequence=h;class d{constructor(e,t,n){if(null==t)throw new o.MongoInvalidArgumentError("Query document must be specified for query");this.databaseName=e,this.command=t,this.command.$db=e,this.options=n??{},this.requestId=n.requestId?n.requestId:d.getRequestId(),this.serializeFunctions="boolean"==typeof n.serializeFunctions&&n.serializeFunctions,this.ignoreUndefined="boolean"==typeof n.ignoreUndefined&&n.ignoreUndefined,this.checkKeys="boolean"==typeof n.checkKeys&&n.checkKeys,this.maxBsonSize=n.maxBsonSize||16777216,this.checksumPresent=!1,this.moreToCome=n.moreToCome??0===t.writeConcern?.w,this.exhaustAllowed="boolean"==typeof n.exhaustAllowed&&n.exhaustAllowed}toBin(){const e=[];let t=0;this.checksumPresent&&(t|=1),this.moreToCome&&(t|=2),this.exhaustAllowed&&(t|=65536);const n=r.alloc(20);e.push(n);let i=n.length;const o=this.command;return i+=this.makeSections(e,o),n.writeInt32LE(i,0),n.writeInt32LE(this.requestId,4),n.writeInt32LE(0,8),n.writeInt32LE(a.OP_MSG,12),n.writeUInt32LE(t,16),e}makeSections(e,t){const n=this.extractDocumentSequences(t),i=r.allocUnsafe(1);i[0]=0;const o=this.serializeBson(t);return e.push(i),e.push(o),e.push(n),i.length+o.length+n.length}extractDocumentSequences(e){const t=[];for(const[n,r]of Object.entries(e))r instanceof h&&(t.push(r.toBin()),delete e[n]);return t.length>0?r.concat(t):r.alloc(0)}serializeBson(e){return i.serialize(e,{checkKeys:this.checkKeys,serializeFunctions:this.serializeFunctions,ignoreUndefined:this.ignoreUndefined})}static getRequestId(){return u=u+1&2147483647,u}}t.OpMsgRequest=d,t.OpMsgResponse=class{constructor(e,t,n,r){this.index=0,this.sections=[],this.parsed=!1,this.raw=e,this.data=n,this.opts=r??{useBigInt64:!1,promoteLongs:!0,promoteValues:!0,promoteBuffers:!1,bsonRegExp:!1},this.length=t.length,this.requestId=t.requestId,this.responseTo=t.responseTo,this.opCode=t.opCode,this.fromCompressed=t.fromCompressed,this.responseFlags=n.readInt32LE(0),this.checksumPresent=!!(1&this.responseFlags),this.moreToCome=!!(2&this.responseFlags),this.exhaustAllowed=!!(65536&this.responseFlags),this.useBigInt64="boolean"==typeof this.opts.useBigInt64&&this.opts.useBigInt64,this.promoteLongs="boolean"!=typeof this.opts.promoteLongs||this.opts.promoteLongs,this.promoteValues="boolean"!=typeof this.opts.promoteValues||this.opts.promoteValues,this.promoteBuffers="boolean"==typeof this.opts.promoteBuffers&&this.opts.promoteBuffers,this.bsonRegExp="boolean"==typeof this.opts.bsonRegExp&&this.opts.bsonRegExp}isParsed(){return this.parsed}parse(){if(this.parsed)return this.sections[0];for(this.index=4;this.index<this.data.length;){const e=this.data.readUInt8(this.index++);if(0===e){const e=this.data.readUInt32LE(this.index),t=this.data.subarray(this.index,this.index+e);this.sections.push(t),this.index+=e}else if(1===e)throw new o.MongoRuntimeError("OP_MSG Payload Type 1 detected unsupported protocol")}return this.parsed=!0,this.sections[0]}},t.OpCompressedRequest=class{constructor(e,t){this.command=e,this.options={zlibCompressionLevel:t.zlibCompressionLevel,agreedCompressor:t.agreedCompressor}}static canCompress(e){const t=e instanceof d?e.command:e.query,n=Object.keys(t)[0];return!s.uncompressibleCommands.has(n)}async toBin(){const e=r.concat(this.command.toBin()),t=e.slice(16),n=e.readInt32LE(12),i=await(0,s.compress)(this.options,t),o=r.alloc(16);o.writeInt32LE(25+i.length,0),o.writeInt32LE(this.command.requestId,4),o.writeInt32LE(0,8),o.writeInt32LE(a.OP_COMPRESSED,12);const u=r.alloc(9);return u.writeInt32LE(n,0),u.writeInt32LE(t.length,4),u.writeUInt8(s.Compressor[this.options.agreedCompressor],8),[o,u,i]}}},16360:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.MongoRuntimeError=t.MongoParseError=t.MongoOperationTimeoutError=t.MongoOIDCError=t.MongoNotConnectedError=t.MongoNetworkTimeoutError=t.MongoNetworkError=t.MongoMissingDependencyError=t.MongoMissingCredentialsError=t.MongoKerberosError=t.MongoInvalidArgumentError=t.MongoGridFSStreamError=t.MongoGridFSChunkError=t.MongoGCPError=t.MongoExpiredSessionError=t.MongoError=t.MongoDriverError=t.MongoDecompressionError=t.MongoCursorInUseError=t.MongoCursorExhaustedError=t.MongoCompatibilityError=t.MongoClientClosedError=t.MongoClientBulkWriteExecutionError=t.MongoClientBulkWriteError=t.MongoClientBulkWriteCursorError=t.MongoChangeStreamError=t.MongoBatchReExecutionError=t.MongoAzureError=t.MongoAWSError=t.MongoAPIError=t.ExplainableCursor=t.ChangeStreamCursor=t.ClientEncryption=t.MongoBulkWriteError=t.UUID=t.Timestamp=t.ObjectId=t.MinKey=t.MaxKey=t.Long=t.Int32=t.Double=t.Decimal128=t.DBRef=t.Code=t.BSONType=t.BSONSymbol=t.BSONRegExp=t.Binary=t.BSON=void 0,t.CommandFailedEvent=t.WriteConcern=t.ReadPreference=t.ReadConcern=t.TopologyType=t.ServerType=t.ReadPreferenceMode=t.ReadConcernLevel=t.ProfilingLevel=t.ReturnDocument=t.SeverityLevel=t.MongoLoggableComponent=t.ServerApiVersion=t.ExplainVerbosity=t.MongoErrorLabel=t.CursorTimeoutMode=t.CURSOR_FLAGS=t.Compressor=t.AuthMechanism=t.GSSAPICanonicalizationValue=t.AutoEncryptionLoggerLevel=t.BatchType=t.UnorderedBulkOperation=t.OrderedBulkOperation=t.MongoClient=t.ListIndexesCursor=t.ListCollectionsCursor=t.GridFSBucketWriteStream=t.GridFSBucketReadStream=t.GridFSBucket=t.FindCursor=t.Db=t.Collection=t.ClientSession=t.ChangeStream=t.CancellationToken=t.AggregationCursor=t.Admin=t.AbstractCursor=t.configureExplicitResourceManagement=t.MongoWriteConcernError=t.MongoUnexpectedServerResponseError=t.MongoTransactionError=t.MongoTopologyClosedError=t.MongoTailableCursorError=t.MongoSystemError=t.MongoStalePrimaryError=t.MongoServerSelectionError=t.MongoServerError=t.MongoServerClosedError=void 0,t.MongoClientAuthProviders=t.MongoCryptKMSRequestNetworkTimeoutError=t.MongoCryptInvalidArgumentError=t.MongoCryptError=t.MongoCryptCreateEncryptedCollectionError=t.MongoCryptCreateDataKeyError=t.MongoCryptAzureKMSRequestError=t.SrvPollingEvent=t.WaitingForSuitableServerEvent=t.ServerSelectionSucceededEvent=t.ServerSelectionStartedEvent=t.ServerSelectionFailedEvent=t.ServerSelectionEvent=t.TopologyOpeningEvent=t.TopologyDescriptionChangedEvent=t.TopologyClosedEvent=t.ServerOpeningEvent=t.ServerHeartbeatSucceededEvent=t.ServerHeartbeatStartedEvent=t.ServerHeartbeatFailedEvent=t.ServerDescriptionChangedEvent=t.ServerClosedEvent=t.ConnectionReadyEvent=t.ConnectionPoolReadyEvent=t.ConnectionPoolMonitoringEvent=t.ConnectionPoolCreatedEvent=t.ConnectionPoolClosedEvent=t.ConnectionPoolClearedEvent=t.ConnectionCreatedEvent=t.ConnectionClosedEvent=t.ConnectionCheckOutStartedEvent=t.ConnectionCheckOutFailedEvent=t.ConnectionCheckedOutEvent=t.ConnectionCheckedInEvent=t.CommandSucceededEvent=t.CommandStartedEvent=void 0;const r=n(71235);Object.defineProperty(t,"Admin",{enumerable:!0,get:function(){return r.Admin}});const i=n(29348);Object.defineProperty(t,"OrderedBulkOperation",{enumerable:!0,get:function(){return i.OrderedBulkOperation}});const o=n(10089);Object.defineProperty(t,"UnorderedBulkOperation",{enumerable:!0,get:function(){return o.UnorderedBulkOperation}});const s=n(22345);Object.defineProperty(t,"ChangeStream",{enumerable:!0,get:function(){return s.ChangeStream}});const a=n(19498);Object.defineProperty(t,"Collection",{enumerable:!0,get:function(){return a.Collection}});const u=n(61066);Object.defineProperty(t,"AbstractCursor",{enumerable:!0,get:function(){return u.AbstractCursor}});const c=n(68526);Object.defineProperty(t,"AggregationCursor",{enumerable:!0,get:function(){return c.AggregationCursor}});const l=n(5465);Object.defineProperty(t,"FindCursor",{enumerable:!0,get:function(){return l.FindCursor}});const h=n(55546);Object.defineProperty(t,"ListCollectionsCursor",{enumerable:!0,get:function(){return h.ListCollectionsCursor}});const d=n(32361);Object.defineProperty(t,"ListIndexesCursor",{enumerable:!0,get:function(){return d.ListIndexesCursor}});const f=n(44120);Object.defineProperty(t,"Db",{enumerable:!0,get:function(){return f.Db}});const p=n(74158);Object.defineProperty(t,"GridFSBucket",{enumerable:!0,get:function(){return p.GridFSBucket}});const m=n(33104);Object.defineProperty(t,"GridFSBucketReadStream",{enumerable:!0,get:function(){return m.GridFSBucketReadStream}});const g=n(10557);Object.defineProperty(t,"GridFSBucketWriteStream",{enumerable:!0,get:function(){return g.GridFSBucketWriteStream}});const _=n(22220);Object.defineProperty(t,"MongoClient",{enumerable:!0,get:function(){return _.MongoClient}});const y=n(4642);Object.defineProperty(t,"CancellationToken",{enumerable:!0,get:function(){return y.CancellationToken}});const v=n(14019);Object.defineProperty(t,"ClientSession",{enumerable:!0,get:function(){return v.ClientSession}});var E=n(75080);Object.defineProperty(t,"BSON",{enumerable:!0,get:function(){return E.BSON}});var S=n(75080);Object.defineProperty(t,"Binary",{enumerable:!0,get:function(){return S.Binary}}),Object.defineProperty(t,"BSONRegExp",{enumerable:!0,get:function(){return S.BSONRegExp}}),Object.defineProperty(t,"BSONSymbol",{enumerable:!0,get:function(){return S.BSONSymbol}}),Object.defineProperty(t,"BSONType",{enumerable:!0,get:function(){return S.BSONType}}),Object.defineProperty(t,"Code",{enumerable:!0,get:function(){return S.Code}}),Object.defineProperty(t,"DBRef",{enumerable:!0,get:function(){return S.DBRef}}),Object.defineProperty(t,"Decimal128",{enumerable:!0,get:function(){return S.Decimal128}}),Object.defineProperty(t,"Double",{enumerable:!0,get:function(){return S.Double}}),Object.defineProperty(t,"Int32",{enumerable:!0,get:function(){return S.Int32}}),Object.defineProperty(t,"Long",{enumerable:!0,get:function(){return S.Long}}),Object.defineProperty(t,"MaxKey",{enumerable:!0,get:function(){return S.MaxKey}}),Object.defineProperty(t,"MinKey",{enumerable:!0,get:function(){return S.MinKey}}),Object.defineProperty(t,"ObjectId",{enumerable:!0,get:function(){return S.ObjectId}}),Object.defineProperty(t,"Timestamp",{enumerable:!0,get:function(){return S.Timestamp}}),Object.defineProperty(t,"UUID",{enumerable:!0,get:function(){return S.UUID}});var w=n(54564);Object.defineProperty(t,"MongoBulkWriteError",{enumerable:!0,get:function(){return w.MongoBulkWriteError}});var C=n(73357);Object.defineProperty(t,"ClientEncryption",{enumerable:!0,get:function(){return C.ClientEncryption}});var O=n(40251);Object.defineProperty(t,"ChangeStreamCursor",{enumerable:!0,get:function(){return O.ChangeStreamCursor}});var b=n(36649);Object.defineProperty(t,"ExplainableCursor",{enumerable:!0,get:function(){return b.ExplainableCursor}});var M=n(17562);Object.defineProperty(t,"MongoAPIError",{enumerable:!0,get:function(){return M.MongoAPIError}}),Object.defineProperty(t,"MongoAWSError",{enumerable:!0,get:function(){return M.MongoAWSError}}),Object.defineProperty(t,"MongoAzureError",{enumerable:!0,get:function(){return M.MongoAzureError}}),Object.defineProperty(t,"MongoBatchReExecutionError",{enumerable:!0,get:function(){return M.MongoBatchReExecutionError}}),Object.defineProperty(t,"MongoChangeStreamError",{enumerable:!0,get:function(){return M.MongoChangeStreamError}}),Object.defineProperty(t,"MongoClientBulkWriteCursorError",{enumerable:!0,get:function(){return M.MongoClientBulkWriteCursorError}}),Object.defineProperty(t,"MongoClientBulkWriteError",{enumerable:!0,get:function(){return M.MongoClientBulkWriteError}}),Object.defineProperty(t,"MongoClientBulkWriteExecutionError",{enumerable:!0,get:function(){return M.MongoClientBulkWriteExecutionError}}),Object.defineProperty(t,"MongoClientClosedError",{enumerable:!0,get:function(){return M.MongoClientClosedError}}),Object.defineProperty(t,"MongoCompatibilityError",{enumerable:!0,get:function(){return M.MongoCompatibilityError}}),Object.defineProperty(t,"MongoCursorExhaustedError",{enumerable:!0,get:function(){return M.MongoCursorExhaustedError}}),Object.defineProperty(t,"MongoCursorInUseError",{enumerable:!0,get:function(){return M.MongoCursorInUseError}}),Object.defineProperty(t,"MongoDecompressionError",{enumerable:!0,get:function(){return M.MongoDecompressionError}}),Object.defineProperty(t,"MongoDriverError",{enumerable:!0,get:function(){return M.MongoDriverError}}),Object.defineProperty(t,"MongoError",{enumerable:!0,get:function(){return M.MongoError}}),Object.defineProperty(t,"MongoExpiredSessionError",{enumerable:!0,get:function(){return M.MongoExpiredSessionError}}),Object.defineProperty(t,"MongoGCPError",{enumerable:!0,get:function(){return M.MongoGCPError}}),Object.defineProperty(t,"MongoGridFSChunkError",{enumerable:!0,get:function(){return M.MongoGridFSChunkError}}),Object.defineProperty(t,"MongoGridFSStreamError",{enumerable:!0,get:function(){return M.MongoGridFSStreamError}}),Object.defineProperty(t,"MongoInvalidArgumentError",{enumerable:!0,get:function(){return M.MongoInvalidArgumentError}}),Object.defineProperty(t,"MongoKerberosError",{enumerable:!0,get:function(){return M.MongoKerberosError}}),Object.defineProperty(t,"MongoMissingCredentialsError",{enumerable:!0,get:function(){return M.MongoMissingCredentialsError}}),Object.defineProperty(t,"MongoMissingDependencyError",{enumerable:!0,get:function(){return M.MongoMissingDependencyError}}),Object.defineProperty(t,"MongoNetworkError",{enumerable:!0,get:function(){return M.MongoNetworkError}}),Object.defineProperty(t,"MongoNetworkTimeoutError",{enumerable:!0,get:function(){return M.MongoNetworkTimeoutError}}),Object.defineProperty(t,"MongoNotConnectedError",{enumerable:!0,get:function(){return M.MongoNotConnectedError}}),Object.defineProperty(t,"MongoOIDCError",{enumerable:!0,get:function(){return M.MongoOIDCError}}),Object.defineProperty(t,"MongoOperationTimeoutError",{enumerable:!0,get:function(){return M.MongoOperationTimeoutError}}),Object.defineProperty(t,"MongoParseError",{enumerable:!0,get:function(){return M.MongoParseError}}),Object.defineProperty(t,"MongoRuntimeError",{enumerable:!0,get:function(){return M.MongoRuntimeError}}),Object.defineProperty(t,"MongoServerClosedError",{enumerable:!0,get:function(){return M.MongoServerClosedError}}),Object.defineProperty(t,"MongoServerError",{enumerable:!0,get:function(){return M.MongoServerError}}),Object.defineProperty(t,"MongoServerSelectionError",{enumerable:!0,get:function(){return M.MongoServerSelectionError}}),Object.defineProperty(t,"MongoStalePrimaryError",{enumerable:!0,get:function(){return M.MongoStalePrimaryError}}),Object.defineProperty(t,"MongoSystemError",{enumerable:!0,get:function(){return M.MongoSystemError}}),Object.defineProperty(t,"MongoTailableCursorError",{enumerable:!0,get:function(){return M.MongoTailableCursorError}}),Object.defineProperty(t,"MongoTopologyClosedError",{enumerable:!0,get:function(){return M.MongoTopologyClosedError}}),Object.defineProperty(t,"MongoTransactionError",{enumerable:!0,get:function(){return M.MongoTransactionError}}),Object.defineProperty(t,"MongoUnexpectedServerResponseError",{enumerable:!0,get:function(){return M.MongoUnexpectedServerResponseError}}),Object.defineProperty(t,"MongoWriteConcernError",{enumerable:!0,get:function(){return M.MongoWriteConcernError}});var T=n(31790);Object.defineProperty(t,"configureExplicitResourceManagement",{enumerable:!0,get:function(){return T.configureExplicitResourceManagement}});var A=n(54564);Object.defineProperty(t,"BatchType",{enumerable:!0,get:function(){return A.BatchType}});var R=n(70136);Object.defineProperty(t,"AutoEncryptionLoggerLevel",{enumerable:!0,get:function(){return R.AutoEncryptionLoggerLevel}});var N=n(95750);Object.defineProperty(t,"GSSAPICanonicalizationValue",{enumerable:!0,get:function(){return N.GSSAPICanonicalizationValue}});var I=n(93065);Object.defineProperty(t,"AuthMechanism",{enumerable:!0,get:function(){return I.AuthMechanism}});var x=n(64515);Object.defineProperty(t,"Compressor",{enumerable:!0,get:function(){return x.Compressor}});var k=n(61066);Object.defineProperty(t,"CURSOR_FLAGS",{enumerable:!0,get:function(){return k.CURSOR_FLAGS}}),Object.defineProperty(t,"CursorTimeoutMode",{enumerable:!0,get:function(){return k.CursorTimeoutMode}});var P=n(17562);Object.defineProperty(t,"MongoErrorLabel",{enumerable:!0,get:function(){return P.MongoErrorLabel}});var D=n(36411);Object.defineProperty(t,"ExplainVerbosity",{enumerable:!0,get:function(){return D.ExplainVerbosity}});var $=n(22220);Object.defineProperty(t,"ServerApiVersion",{enumerable:!0,get:function(){return $.ServerApiVersion}});var L=n(93347);Object.defineProperty(t,"MongoLoggableComponent",{enumerable:!0,get:function(){return L.MongoLoggableComponent}}),Object.defineProperty(t,"SeverityLevel",{enumerable:!0,get:function(){return L.SeverityLevel}});var B=n(61635);Object.defineProperty(t,"ReturnDocument",{enumerable:!0,get:function(){return B.ReturnDocument}});var j=n(58127);Object.defineProperty(t,"ProfilingLevel",{enumerable:!0,get:function(){return j.ProfilingLevel}});var q=n(28541);Object.defineProperty(t,"ReadConcernLevel",{enumerable:!0,get:function(){return q.ReadConcernLevel}});var F=n(13700);Object.defineProperty(t,"ReadPreferenceMode",{enumerable:!0,get:function(){return F.ReadPreferenceMode}});var z=n(89167);Object.defineProperty(t,"ServerType",{enumerable:!0,get:function(){return z.ServerType}}),Object.defineProperty(t,"TopologyType",{enumerable:!0,get:function(){return z.TopologyType}});var U=n(28541);Object.defineProperty(t,"ReadConcern",{enumerable:!0,get:function(){return U.ReadConcern}});var V=n(13700);Object.defineProperty(t,"ReadPreference",{enumerable:!0,get:function(){return V.ReadPreference}});var W=n(40012);Object.defineProperty(t,"WriteConcern",{enumerable:!0,get:function(){return W.WriteConcern}});var G=n(38216);Object.defineProperty(t,"CommandFailedEvent",{enumerable:!0,get:function(){return G.CommandFailedEvent}}),Object.defineProperty(t,"CommandStartedEvent",{enumerable:!0,get:function(){return G.CommandStartedEvent}}),Object.defineProperty(t,"CommandSucceededEvent",{enumerable:!0,get:function(){return G.CommandSucceededEvent}});var H=n(287);Object.defineProperty(t,"ConnectionCheckedInEvent",{enumerable:!0,get:function(){return H.ConnectionCheckedInEvent}}),Object.defineProperty(t,"ConnectionCheckedOutEvent",{enumerable:!0,get:function(){return H.ConnectionCheckedOutEvent}}),Object.defineProperty(t,"ConnectionCheckOutFailedEvent",{enumerable:!0,get:function(){return H.ConnectionCheckOutFailedEvent}}),Object.defineProperty(t,"ConnectionCheckOutStartedEvent",{enumerable:!0,get:function(){return H.ConnectionCheckOutStartedEvent}}),Object.defineProperty(t,"ConnectionClosedEvent",{enumerable:!0,get:function(){return H.ConnectionClosedEvent}}),Object.defineProperty(t,"ConnectionCreatedEvent",{enumerable:!0,get:function(){return H.ConnectionCreatedEvent}}),Object.defineProperty(t,"ConnectionPoolClearedEvent",{enumerable:!0,get:function(){return H.ConnectionPoolClearedEvent}}),Object.defineProperty(t,"ConnectionPoolClosedEvent",{enumerable:!0,get:function(){return H.ConnectionPoolClosedEvent}}),Object.defineProperty(t,"ConnectionPoolCreatedEvent",{enumerable:!0,get:function(){return H.ConnectionPoolCreatedEvent}}),Object.defineProperty(t,"ConnectionPoolMonitoringEvent",{enumerable:!0,get:function(){return H.ConnectionPoolMonitoringEvent}}),Object.defineProperty(t,"ConnectionPoolReadyEvent",{enumerable:!0,get:function(){return H.ConnectionPoolReadyEvent}}),Object.defineProperty(t,"ConnectionReadyEvent",{enumerable:!0,get:function(){return H.ConnectionReadyEvent}});var K=n(43135);Object.defineProperty(t,"ServerClosedEvent",{enumerable:!0,get:function(){return K.ServerClosedEvent}}),Object.defineProperty(t,"ServerDescriptionChangedEvent",{enumerable:!0,get:function(){return K.ServerDescriptionChangedEvent}}),Object.defineProperty(t,"ServerHeartbeatFailedEvent",{enumerable:!0,get:function(){return K.ServerHeartbeatFailedEvent}}),Object.defineProperty(t,"ServerHeartbeatStartedEvent",{enumerable:!0,get:function(){return K.ServerHeartbeatStartedEvent}}),Object.defineProperty(t,"ServerHeartbeatSucceededEvent",{enumerable:!0,get:function(){return K.ServerHeartbeatSucceededEvent}}),Object.defineProperty(t,"ServerOpeningEvent",{enumerable:!0,get:function(){return K.ServerOpeningEvent}}),Object.defineProperty(t,"TopologyClosedEvent",{enumerable:!0,get:function(){return K.TopologyClosedEvent}}),Object.defineProperty(t,"TopologyDescriptionChangedEvent",{enumerable:!0,get:function(){return K.TopologyDescriptionChangedEvent}}),Object.defineProperty(t,"TopologyOpeningEvent",{enumerable:!0,get:function(){return K.TopologyOpeningEvent}});var Y=n(3906);Object.defineProperty(t,"ServerSelectionEvent",{enumerable:!0,get:function(){return Y.ServerSelectionEvent}}),Object.defineProperty(t,"ServerSelectionFailedEvent",{enumerable:!0,get:function(){return Y.ServerSelectionFailedEvent}}),Object.defineProperty(t,"ServerSelectionStartedEvent",{enumerable:!0,get:function(){return Y.ServerSelectionStartedEvent}}),Object.defineProperty(t,"ServerSelectionSucceededEvent",{enumerable:!0,get:function(){return Y.ServerSelectionSucceededEvent}}),Object.defineProperty(t,"WaitingForSuitableServerEvent",{enumerable:!0,get:function(){return Y.WaitingForSuitableServerEvent}});var Q=n(4313);Object.defineProperty(t,"SrvPollingEvent",{enumerable:!0,get:function(){return Q.SrvPollingEvent}});var J=n(86981);Object.defineProperty(t,"MongoCryptAzureKMSRequestError",{enumerable:!0,get:function(){return J.MongoCryptAzureKMSRequestError}}),Object.defineProperty(t,"MongoCryptCreateDataKeyError",{enumerable:!0,get:function(){return J.MongoCryptCreateDataKeyError}}),Object.defineProperty(t,"MongoCryptCreateEncryptedCollectionError",{enumerable:!0,get:function(){return J.MongoCryptCreateEncryptedCollectionError}}),Object.defineProperty(t,"MongoCryptError",{enumerable:!0,get:function(){return J.MongoCryptError}}),Object.defineProperty(t,"MongoCryptInvalidArgumentError",{enumerable:!0,get:function(){return J.MongoCryptInvalidArgumentError}}),Object.defineProperty(t,"MongoCryptKMSRequestNetworkTimeoutError",{enumerable:!0,get:function(){return J.MongoCryptKMSRequestNetworkTimeoutError}});var X=n(38944);Object.defineProperty(t,"MongoClientAuthProviders",{enumerable:!0,get:function(){return X.MongoClientAuthProviders}})},17172:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CountOperation=void 0;const r=n(75725),i=n(78130),o=n(35394);class s extends i.CommandOperation{constructor(e,t,n){super({s:{namespace:e}},n),this.SERVER_COMMAND_RESPONSE_TYPE=r.MongoDBResponse,this.options=n,this.collectionName=e.collection,this.query=t}get commandName(){return"count"}buildCommandDocument(e,t){const n=this.options,r={count:this.collectionName,query:this.query};return"number"==typeof n.limit&&(r.limit=n.limit),"number"==typeof n.skip&&(r.skip=n.skip),null!=n.hint&&(r.hint=n.hint),"number"==typeof n.maxTimeMS&&(r.maxTimeMS=n.maxTimeMS),r}handleOk(e){return e.getNumber("n")??0}}t.CountOperation=s,(0,o.defineAspects)(s,[o.Aspect.READ_OPERATION,o.Aspect.RETRYABLE])},17309:(e,t,n)=>{var r=n(65994).e;Object.defineProperty(t,"__esModule",{value:!0}),t.callback=void 0;const i=n(36374),o=n(17562);t.callback=async()=>{const e=r.env.OIDC_TOKEN_FILE;if(!e)throw new o.MongoAWSError("OIDC_TOKEN_FILE must be set in the environment.");return{accessToken:await i.promises.readFile(e,"utf8")}}},17562:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.MongoWriteConcernError=t.MongoServerSelectionError=t.MongoSystemError=t.MongoMissingDependencyError=t.MongoMissingCredentialsError=t.MongoCompatibilityError=t.MongoInvalidArgumentError=t.MongoParseError=t.MongoNetworkTimeoutError=t.MongoNetworkError=t.MongoClientClosedError=t.MongoTopologyClosedError=t.MongoCursorExhaustedError=t.MongoServerClosedError=t.MongoCursorInUseError=t.MongoOperationTimeoutError=t.MongoUnexpectedServerResponseError=t.MongoGridFSChunkError=t.MongoGridFSStreamError=t.MongoTailableCursorError=t.MongoChangeStreamError=t.MongoClientBulkWriteExecutionError=t.MongoClientBulkWriteCursorError=t.MongoClientBulkWriteError=t.MongoGCPError=t.MongoAzureError=t.MongoOIDCError=t.MongoAWSError=t.MongoKerberosError=t.MongoExpiredSessionError=t.MongoTransactionError=t.MongoNotConnectedError=t.MongoDecompressionError=t.MongoBatchReExecutionError=t.MongoStalePrimaryError=t.MongoRuntimeError=t.MongoAPIError=t.MongoDriverError=t.MongoServerError=t.MongoError=t.MongoErrorLabel=t.GET_MORE_RESUMABLE_CODES=t.MONGODB_ERROR_CODES=t.NODE_IS_RECOVERING_ERROR_MESSAGE=t.LEGACY_NOT_PRIMARY_OR_SECONDARY_ERROR_MESSAGE=t.LEGACY_NOT_WRITABLE_PRIMARY_ERROR_MESSAGE=void 0,t.needsRetryableWriteLabel=function(e,r,i){if(e instanceof u)return!0;if(e instanceof n&&(r>=9||p(e))&&!e.hasErrorLabel(t.MongoErrorLabel.HandshakeError))return!1;if(e instanceof h){if("Mongos"===i&&r<9)return f.has(e.result.code??0);const t=e.result.writeConcernError.code??Number(e.code);return f.has(Number.isNaN(t)?0:t)}if(e instanceof n)return f.has(Number(e.code));return!!t.LEGACY_NOT_WRITABLE_PRIMARY_ERROR_MESSAGE.test(e.message)||!!t.NODE_IS_RECOVERING_ERROR_MESSAGE.test(e.message)},t.isRetryableWriteError=p,t.isRetryableReadError=function(e){if("number"==typeof e.code&&d.has(e.code))return!0;if(e instanceof u)return!0;return!!t.LEGACY_NOT_WRITABLE_PRIMARY_ERROR_MESSAGE.test(e.message)||!!t.NODE_IS_RECOVERING_ERROR_MESSAGE.test(e.message)},t.isNodeShuttingDownError=function(e){return!("number"!=typeof e.code||!_.has(e.code))},t.isSDAMUnrecoverableError=function(e){return e instanceof c||null==e||(y(e)||("number"==typeof(n=e).code?g.has(n.code):!y(n)&&t.LEGACY_NOT_WRITABLE_PRIMARY_ERROR_MESSAGE.test(n.message)));var n},t.isNetworkTimeoutError=function(e){return!!(e instanceof u&&e.message.match(/timed out/))},t.isResumableError=function(e,r){return null!=e&&e instanceof n&&(e instanceof u||(null!=r&&r>=9?e.code===t.MONGODB_ERROR_CODES.CursorNotFound||e.hasErrorLabel(t.MongoErrorLabel.ResumableChangeStreamError):"number"==typeof e.code&&t.GET_MORE_RESUMABLE_CODES.has(e.code)))},t.LEGACY_NOT_WRITABLE_PRIMARY_ERROR_MESSAGE=new RegExp("not master","i"),t.LEGACY_NOT_PRIMARY_OR_SECONDARY_ERROR_MESSAGE=new RegExp("not master or secondary","i"),t.NODE_IS_RECOVERING_ERROR_MESSAGE=new RegExp("node is recovering","i"),t.MONGODB_ERROR_CODES=Object.freeze({HostUnreachable:6,HostNotFound:7,AuthenticationFailed:18,NetworkTimeout:89,ShutdownInProgress:91,PrimarySteppedDown:189,ExceededTimeLimit:262,SocketException:9001,NotWritablePrimary:10107,InterruptedAtShutdown:11600,InterruptedDueToReplStateChange:11602,NotPrimaryNoSecondaryOk:13435,NotPrimaryOrSecondary:13436,StaleShardVersion:63,StaleEpoch:150,StaleConfig:13388,RetryChangeStream:234,FailedToSatisfyReadPreference:133,CursorNotFound:43,LegacyNotPrimary:10058,WriteConcernTimeout:64,NamespaceNotFound:26,IllegalOperation:20,MaxTimeMSExpired:50,UnknownReplWriteConcern:79,UnsatisfiableWriteConcern:100,Reauthenticate:391,ReadConcernMajorityNotAvailableYet:134}),t.GET_MORE_RESUMABLE_CODES=new Set([t.MONGODB_ERROR_CODES.HostUnreachable,t.MONGODB_ERROR_CODES.HostNotFound,t.MONGODB_ERROR_CODES.NetworkTimeout,t.MONGODB_ERROR_CODES.ShutdownInProgress,t.MONGODB_ERROR_CODES.PrimarySteppedDown,t.MONGODB_ERROR_CODES.ExceededTimeLimit,t.MONGODB_ERROR_CODES.SocketException,t.MONGODB_ERROR_CODES.NotWritablePrimary,t.MONGODB_ERROR_CODES.InterruptedAtShutdown,t.MONGODB_ERROR_CODES.InterruptedDueToReplStateChange,t.MONGODB_ERROR_CODES.NotPrimaryNoSecondaryOk,t.MONGODB_ERROR_CODES.NotPrimaryOrSecondary,t.MONGODB_ERROR_CODES.StaleShardVersion,t.MONGODB_ERROR_CODES.StaleEpoch,t.MONGODB_ERROR_CODES.StaleConfig,t.MONGODB_ERROR_CODES.RetryChangeStream,t.MONGODB_ERROR_CODES.FailedToSatisfyReadPreference,t.MONGODB_ERROR_CODES.CursorNotFound]),t.MongoErrorLabel=Object.freeze({RetryableWriteError:"RetryableWriteError",TransientTransactionError:"TransientTransactionError",UnknownTransactionCommitResult:"UnknownTransactionCommitResult",ResumableChangeStreamError:"ResumableChangeStreamError",HandshakeError:"HandshakeError",ResetPool:"ResetPool",PoolRequstedRetry:"PoolRequstedRetry",InterruptInUseConnections:"InterruptInUseConnections",NoWritesPerformed:"NoWritesPerformed"});class n extends Error{get errorLabels(){return Array.from(this.errorLabelSet)}constructor(e,t){super(e,t),this.errorLabelSet=new Set}static buildErrorMessage(e){return"string"==typeof e?e:function(e){return null!=e&&"object"==typeof e&&"errors"in e&&Array.isArray(e.errors)}(e)&&0===e.message.length?0===e.errors.length?"AggregateError has an empty errors array. Please check the `cause` property for more information.":e.errors.map((({message:e})=>e)).join(", "):null!=e&&"object"==typeof e&&"message"in e&&"string"==typeof e.message?e.message:"empty error message"}get name(){return"MongoError"}get errmsg(){return this.message}hasErrorLabel(e){return this.errorLabelSet.has(e)}addErrorLabel(e){this.errorLabelSet.add(e)}}t.MongoError=n;class r extends n{constructor(e){if(super(e.message||e.errmsg||e.$err||"n/a"),e.errorLabels)for(const t of e.errorLabels)this.addErrorLabel(t);this.errorResponse=e;for(const t in e)"errorLabels"!==t&&"errmsg"!==t&&"message"!==t&&"errorResponse"!==t&&(this[t]=e[t])}get name(){return"MongoServerError"}}t.MongoServerError=r;class i extends n{constructor(e,t){super(e,t)}get name(){return"MongoDriverError"}}t.MongoDriverError=i;class o extends i{constructor(e,t){super(e,t)}get name(){return"MongoAPIError"}}t.MongoAPIError=o;class s extends i{constructor(e,t){super(e,t)}get name(){return"MongoRuntimeError"}}t.MongoRuntimeError=s,t.MongoStalePrimaryError=class extends s{constructor(e,t){super(e,t)}get name(){return"MongoStalePrimaryError"}},t.MongoBatchReExecutionError=class extends o{constructor(e="This batch has already been executed, create new batch to execute"){super(e)}get name(){return"MongoBatchReExecutionError"}},t.MongoDecompressionError=class extends s{constructor(e){super(e)}get name(){return"MongoDecompressionError"}},t.MongoNotConnectedError=class extends o{constructor(e){super(e)}get name(){return"MongoNotConnectedError"}},t.MongoTransactionError=class extends o{constructor(e){super(e)}get name(){return"MongoTransactionError"}},t.MongoExpiredSessionError=class extends o{constructor(e="Cannot use a session that has ended"){super(e)}get name(){return"MongoExpiredSessionError"}},t.MongoKerberosError=class extends s{constructor(e){super(e)}get name(){return"MongoKerberosError"}},t.MongoAWSError=class extends s{constructor(e,t){super(e,t)}get name(){return"MongoAWSError"}};class a extends s{constructor(e){super(e)}get name(){return"MongoOIDCError"}}t.MongoOIDCError=a,t.MongoAzureError=class extends a{constructor(e){super(e)}get name(){return"MongoAzureError"}},t.MongoGCPError=class extends a{constructor(e){super(e)}get name(){return"MongoGCPError"}},t.MongoClientBulkWriteError=class extends r{constructor(e){super(e),this.writeConcernErrors=[],this.writeErrors=new Map}get name(){return"MongoClientBulkWriteError"}},t.MongoClientBulkWriteCursorError=class extends s{constructor(e){super(e)}get name(){return"MongoClientBulkWriteCursorError"}},t.MongoClientBulkWriteExecutionError=class extends s{constructor(e){super(e)}get name(){return"MongoClientBulkWriteExecutionError"}},t.MongoChangeStreamError=class extends s{constructor(e){super(e)}get name(){return"MongoChangeStreamError"}},t.MongoTailableCursorError=class extends o{constructor(e="Tailable cursor does not support this operation"){super(e)}get name(){return"MongoTailableCursorError"}},t.MongoGridFSStreamError=class extends s{constructor(e){super(e)}get name(){return"MongoGridFSStreamError"}},t.MongoGridFSChunkError=class extends s{constructor(e){super(e)}get name(){return"MongoGridFSChunkError"}},t.MongoUnexpectedServerResponseError=class extends s{constructor(e,t){super(e,t)}get name(){return"MongoUnexpectedServerResponseError"}},t.MongoOperationTimeoutError=class extends i{get name(){return"MongoOperationTimeoutError"}},t.MongoCursorInUseError=class extends o{constructor(e="Cursor is already initialized"){super(e)}get name(){return"MongoCursorInUseError"}},t.MongoServerClosedError=class extends o{constructor(e="Server is closed"){super(e)}get name(){return"MongoServerClosedError"}},t.MongoCursorExhaustedError=class extends o{constructor(e){super(e||"Cursor is exhausted")}get name(){return"MongoCursorExhaustedError"}},t.MongoTopologyClosedError=class extends o{constructor(e="Topology is closed"){super(e)}get name(){return"MongoTopologyClosedError"}},t.MongoClientClosedError=class extends o{constructor(){super("Operation interrupted because client was closed")}get name(){return"MongoClientClosedError"}};class u extends n{constructor(e,t){super(e,{cause:t?.cause}),this.beforeHandshake=!!t?.beforeHandshake}get name(){return"MongoNetworkError"}}t.MongoNetworkError=u,t.MongoNetworkTimeoutError=class extends u{constructor(e,t){super(e,t)}get name(){return"MongoNetworkTimeoutError"}};class c extends i{constructor(e){super(e)}get name(){return"MongoParseError"}}t.MongoParseError=c,t.MongoInvalidArgumentError=class extends o{constructor(e,t){super(e,t)}get name(){return"MongoInvalidArgumentError"}},t.MongoCompatibilityError=class extends o{constructor(e){super(e)}get name(){return"MongoCompatibilityError"}},t.MongoMissingCredentialsError=class extends o{constructor(e){super(e)}get name(){return"MongoMissingCredentialsError"}},t.MongoMissingDependencyError=class extends o{constructor(e,t){super(e,t),this.dependencyName=t.dependencyName}get name(){return"MongoMissingDependencyError"}};class l extends n{constructor(e,t){t&&t.error?super(n.buildErrorMessage(t.error.message||t.error),{cause:t.error}):super(e),t&&(this.reason=t),this.code=t.error?.code}get name(){return"MongoSystemError"}}t.MongoSystemError=l,t.MongoServerSelectionError=class extends l{constructor(e,t){super(e,t)}get name(){return"MongoServerSelectionError"}};class h extends r{constructor(e){super({...e.writeConcernError,...e}),this.errInfo=e.writeConcernError.errInfo,this.result=e}get name(){return"MongoWriteConcernError"}}t.MongoWriteConcernError=h;const d=new Set([t.MONGODB_ERROR_CODES.HostUnreachable,t.MONGODB_ERROR_CODES.HostNotFound,t.MONGODB_ERROR_CODES.NetworkTimeout,t.MONGODB_ERROR_CODES.ShutdownInProgress,t.MONGODB_ERROR_CODES.PrimarySteppedDown,t.MONGODB_ERROR_CODES.SocketException,t.MONGODB_ERROR_CODES.NotWritablePrimary,t.MONGODB_ERROR_CODES.InterruptedAtShutdown,t.MONGODB_ERROR_CODES.InterruptedDueToReplStateChange,t.MONGODB_ERROR_CODES.NotPrimaryNoSecondaryOk,t.MONGODB_ERROR_CODES.NotPrimaryOrSecondary,t.MONGODB_ERROR_CODES.ExceededTimeLimit,t.MONGODB_ERROR_CODES.ReadConcernMajorityNotAvailableYet]),f=d;function p(e){return e.hasErrorLabel(t.MongoErrorLabel.RetryableWriteError)||e.hasErrorLabel(t.MongoErrorLabel.PoolRequstedRetry)}const m=new Set([t.MONGODB_ERROR_CODES.ShutdownInProgress,t.MONGODB_ERROR_CODES.PrimarySteppedDown,t.MONGODB_ERROR_CODES.InterruptedAtShutdown,t.MONGODB_ERROR_CODES.InterruptedDueToReplStateChange,t.MONGODB_ERROR_CODES.NotPrimaryOrSecondary]),g=new Set([t.MONGODB_ERROR_CODES.NotWritablePrimary,t.MONGODB_ERROR_CODES.NotPrimaryNoSecondaryOk,t.MONGODB_ERROR_CODES.LegacyNotPrimary]),_=new Set([t.MONGODB_ERROR_CODES.InterruptedAtShutdown,t.MONGODB_ERROR_CODES.ShutdownInProgress]);function y(e){return"number"==typeof e.code?m.has(e.code):t.LEGACY_NOT_PRIMARY_OR_SECONDARY_ERROR_MESSAGE.test(e.message)||t.NODE_IS_RECOVERING_ERROR_MESSAGE.test(e.message)}},17642:(e,t,n)=>{var r=n(65994).e;function i(e){if("string"!=typeof e)throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}function o(e,t){for(var n,r="",i=0,o=-1,s=0,a=0;a<=e.length;++a){if(a<e.length)n=e.charCodeAt(a);else{if(47===n)break;n=47}if(47===n){if(o===a-1||1===s);else if(o!==a-1&&2===s){if(r.length<2||2!==i||46!==r.charCodeAt(r.length-1)||46!==r.charCodeAt(r.length-2))if(r.length>2){var u=r.lastIndexOf("/");if(u!==r.length-1){-1===u?(r="",i=0):i=(r=r.slice(0,u)).length-1-r.lastIndexOf("/"),o=a,s=0;continue}}else if(2===r.length||1===r.length){r="",i=0,o=a,s=0;continue}t&&(r.length>0?r+="/..":r="..",i=2)}else r.length>0?r+="/"+e.slice(o+1,a):r=e.slice(o+1,a),i=a-o-1;o=a,s=0}else 46===n&&-1!==s?++s:s=-1}return r}var s={resolve:function(){for(var e,t="",n=!1,s=arguments.length-1;s>=-1&&!n;s--){var a;s>=0?a=arguments[s]:(void 0===e&&(e=r.cwd()),a=e),i(a),0!==a.length&&(t=a+"/"+t,n=47===a.charCodeAt(0))}return t=o(t,!n),n?t.length>0?"/"+t:"/":t.length>0?t:"."},normalize:function(e){if(i(e),0===e.length)return".";var t=47===e.charCodeAt(0),n=47===e.charCodeAt(e.length-1);return 0!==(e=o(e,!t)).length||t||(e="."),e.length>0&&n&&(e+="/"),t?"/"+e:e},isAbsolute:function(e){return i(e),e.length>0&&47===e.charCodeAt(0)},join:function(){if(0===arguments.length)return".";for(var e,t=0;t<arguments.length;++t){var n=arguments[t];i(n),n.length>0&&(void 0===e?e=n:e+="/"+n)}return void 0===e?".":s.normalize(e)},relative:function(e,t){if(i(e),i(t),e===t)return"";if((e=s.resolve(e))===(t=s.resolve(t)))return"";for(var n=1;n<e.length&&47===e.charCodeAt(n);++n);for(var r=e.length,o=r-n,a=1;a<t.length&&47===t.charCodeAt(a);++a);for(var u=t.length-a,c=o<u?o:u,l=-1,h=0;h<=c;++h){if(h===c){if(u>c){if(47===t.charCodeAt(a+h))return t.slice(a+h+1);if(0===h)return t.slice(a+h)}else o>c&&(47===e.charCodeAt(n+h)?l=h:0===h&&(l=0));break}var d=e.charCodeAt(n+h);if(d!==t.charCodeAt(a+h))break;47===d&&(l=h)}var f="";for(h=n+l+1;h<=r;++h)h!==r&&47!==e.charCodeAt(h)||(0===f.length?f+="..":f+="/..");return f.length>0?f+t.slice(a+l):(a+=l,47===t.charCodeAt(a)&&++a,t.slice(a))},_makeLong:function(e){return e},dirname:function(e){if(i(e),0===e.length)return".";for(var t=e.charCodeAt(0),n=47===t,r=-1,o=!0,s=e.length-1;s>=1;--s)if(47===(t=e.charCodeAt(s))){if(!o){r=s;break}}else o=!1;return-1===r?n?"/":".":n&&1===r?"//":e.slice(0,r)},basename:function(e,t){if(void 0!==t&&"string"!=typeof t)throw new TypeError('"ext" argument must be a string');i(e);var n,r=0,o=-1,s=!0;if(void 0!==t&&t.length>0&&t.length<=e.length){if(t.length===e.length&&t===e)return"";var a=t.length-1,u=-1;for(n=e.length-1;n>=0;--n){var c=e.charCodeAt(n);if(47===c){if(!s){r=n+1;break}}else-1===u&&(s=!1,u=n+1),a>=0&&(c===t.charCodeAt(a)?-1==--a&&(o=n):(a=-1,o=u))}return r===o?o=u:-1===o&&(o=e.length),e.slice(r,o)}for(n=e.length-1;n>=0;--n)if(47===e.charCodeAt(n)){if(!s){r=n+1;break}}else-1===o&&(s=!1,o=n+1);return-1===o?"":e.slice(r,o)},extname:function(e){i(e);for(var t=-1,n=0,r=-1,o=!0,s=0,a=e.length-1;a>=0;--a){var u=e.charCodeAt(a);if(47!==u)-1===r&&(o=!1,r=a+1),46===u?-1===t?t=a:1!==s&&(s=1):-1!==t&&(s=-1);else if(!o){n=a+1;break}}return-1===t||-1===r||0===s||1===s&&t===r-1&&t===n+1?"":e.slice(t,r)},format:function(e){if(null===e||"object"!=typeof e)throw new TypeError('The "pathObject" argument must be of type Object. Received type '+typeof e);return function(e,t){var n=t.dir||t.root,r=t.base||(t.name||"")+(t.ext||"");return n?n===t.root?n+r:n+"/"+r:r}(0,e)},parse:function(e){i(e);var t={root:"",dir:"",base:"",ext:"",name:""};if(0===e.length)return t;var n,r=e.charCodeAt(0),o=47===r;o?(t.root="/",n=1):n=0;for(var s=-1,a=0,u=-1,c=!0,l=e.length-1,h=0;l>=n;--l)if(47!==(r=e.charCodeAt(l)))-1===u&&(c=!1,u=l+1),46===r?-1===s?s=l:1!==h&&(h=1):-1!==s&&(h=-1);else if(!c){a=l+1;break}return-1===s||-1===u||0===h||1===h&&s===u-1&&s===a+1?-1!==u&&(t.base=t.name=0===a&&o?e.slice(1,u):e.slice(a,u)):(0===a&&o?(t.name=e.slice(1,s),t.base=e.slice(1,u)):(t.name=e.slice(a,s),t.base=e.slice(a,u)),t.ext=e.slice(s,u)),a>0?t.dir=e.slice(0,a-1):o&&(t.dir="/"),t},sep:"/",delimiter:":",win32:null,posix:null};s.posix=s,e.exports=s},17668:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.RunCursorCommandOperation=t.RunCommandOperation=void 0;const r=n(75725),i=n(35394);class o extends i.AbstractOperation{constructor(e,t,n){super(n),this.SERVER_COMMAND_RESPONSE_TYPE=r.MongoDBResponse,this.command=t,this.options=n,this.ns=e.withCollection("$cmd")}get commandName(){return"runCommand"}buildCommand(e,t){return this.command}buildOptions(e){return{...this.options,session:this.session,timeoutContext:e,signal:this.options.signal,readPreference:this.options.readPreference}}}t.RunCommandOperation=o,t.RunCursorCommandOperation=class extends o{constructor(){super(...arguments),this.SERVER_COMMAND_RESPONSE_TYPE=r.CursorResponse}handleOk(e){return e}}},17846:(e,t)=>{var n=t;function r(e){return 1===e.length?"0"+e:e}function i(e){for(var t="",n=0;n<e.length;n++)t+=r(e[n].toString(16));return t}n.toArray=function(e,t){if(Array.isArray(e))return e.slice();if(!e)return[];var n=[];if("string"!=typeof e){for(var r=0;r<e.length;r++)n[r]=0|e[r];return n}if("hex"===t)for((e=e.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(e="0"+e),r=0;r<e.length;r+=2)n.push(parseInt(e[r]+e[r+1],16));else for(r=0;r<e.length;r++){var i=e.charCodeAt(r),o=i>>8,s=255&i;o?n.push(o,s):n.push(s)}return n},n.zero2=r,n.toHex=i,n.encode=function(e,t){return"hex"===t?i(e):e}},19043:(e,t,n)=>{var r=n(65994).e;Object.defineProperty(t,"__esModule",{value:!0}),t.LegacyAWSTemporaryCredentialProvider=t.AWSSDKCredentialProvider=t.AWSTemporaryCredentialProvider=void 0;const i=n(8500),o=n(17562),s=n(145),a="http://169.254.169.254",u="/latest/meta-data/iam/security-credentials";class c{static get awsSDK(){return c._awsSDK??=(0,i.getAwsCredentialProvider)(),c._awsSDK}static get isAWSSDKInstalled(){return!("kModuleError"in c.awsSDK)}}t.AWSTemporaryCredentialProvider=c,t.AWSSDKCredentialProvider=class extends c{constructor(e){super(),e&&(this._provider=e)}get provider(){if("kModuleError"in c.awsSDK)throw c.awsSDK.kModuleError;if(this._provider)return this._provider;let{AWS_STS_REGIONAL_ENDPOINTS:e="",AWS_REGION:t=""}=r.env;e=e.toLowerCase(),t=t.toLowerCase();const n=0!==t.length&&0!==e.length,i=new Set(["ap-northeast-1","ap-south-1","ap-southeast-1","ap-southeast-2","aws-global","ca-central-1","eu-central-1","eu-north-1","eu-west-1","eu-west-2","eu-west-3","sa-east-1","us-east-1","us-east-2","us-west-1","us-west-2"]),o="regional"===e||"legacy"===e&&!i.has(t);return this._provider=n&&o?c.awsSDK.fromNodeProviderChain({clientConfig:{region:t}}):c.awsSDK.fromNodeProviderChain(),this._provider}async getCredentials(){try{const e=await this.provider();return{AccessKeyId:e.accessKeyId,SecretAccessKey:e.secretAccessKey,Token:e.sessionToken,Expiration:e.expiration}}catch(e){throw new o.MongoAWSError(e.message,{cause:e})}}},t.LegacyAWSTemporaryCredentialProvider=class extends c{async getCredentials(){if(r.env.AWS_CONTAINER_CREDENTIALS_RELATIVE_URI)return await(0,s.request)(`http://169.254.170.2${r.env.AWS_CONTAINER_CREDENTIALS_RELATIVE_URI}`);const e=await(0,s.request)(`${a}/latest/api/token`,{method:"PUT",json:!1,headers:{"X-aws-ec2-metadata-token-ttl-seconds":30}}),t=await(0,s.request)(`${a}/${u}`,{json:!1,headers:{"X-aws-ec2-metadata-token":e}});return await(0,s.request)(`${a}/${u}/${t}`,{headers:{"X-aws-ec2-metadata-token":e}})}}},19498:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Collection=void 0;const r=n(75080),i=n(29348),o=n(10089),s=n(22345),a=n(68526),u=n(5465),c=n(32361),l=n(71906),h=n(17562),d=n(17172),f=n(4752),p=n(815),m=n(93549),g=n(96357),_=n(61635),y=n(22847),v=n(9326),E=n(61861),S=n(32443),w=n(97350),C=n(40866),O=n(94330),b=n(28541),M=n(13700),T=n(145),A=n(40012);t.Collection=class{constructor(e,t,n){this.s={db:e,options:n,namespace:new T.MongoDBCollectionNamespace(e.databaseName,t),pkFactory:e.options?.pkFactory??T.DEFAULT_PK_FACTORY,readPreference:M.ReadPreference.fromOptions(n),bsonOptions:(0,r.resolveBSONOptions)(n,e),readConcern:b.ReadConcern.fromOptions(n),writeConcern:A.WriteConcern.fromOptions(n)},this.client=e.client}get dbName(){return this.s.namespace.db}get collectionName(){return this.s.namespace.collection}get namespace(){return this.fullNamespace.toString()}get fullNamespace(){return this.s.namespace}get readConcern(){return null==this.s.readConcern?this.s.db.readConcern:this.s.readConcern}get readPreference(){return null==this.s.readPreference?this.s.db.readPreference:this.s.readPreference}get bsonOptions(){return this.s.bsonOptions}get writeConcern(){return null==this.s.writeConcern?this.s.db.writeConcern:this.s.writeConcern}get hint(){return this.s.collectionHint}set hint(e){this.s.collectionHint=(0,T.normalizeHintField)(e)}get timeoutMS(){return this.s.options.timeoutMS}async insertOne(e,t){return await(0,g.executeOperation)(this.client,new v.InsertOneOperation(this,e,(0,T.resolveOptions)(this,t)))}async insertMany(e,t){if(!Array.isArray(e))throw new h.MongoInvalidArgumentError('Argument "docs" must be an array of documents');t=(0,T.resolveOptions)(this,t??{});const n=0!==A.WriteConcern.fromOptions(t)?.w;try{const r=await this.bulkWrite(e.map((e=>({insertOne:{document:e}}))),t);return{acknowledged:n,insertedCount:r.insertedCount,insertedIds:r.insertedIds}}catch(e){if(e&&"Operation must be an object with an operation key"===e.message)throw new h.MongoInvalidArgumentError("Collection.insertMany() cannot be called with an array that has null/undefined values");throw e}}async bulkWrite(e,t){if(!Array.isArray(e))throw new h.MongoInvalidArgumentError('Argument "operations" must be an array of documents');t=(0,T.resolveOptions)(this,t??{}),null!=this.client.topology||await(0,g.autoConnect)(this.client);const n=!1===t.ordered?this.initializeUnorderedBulkOp(t):this.initializeOrderedBulkOp(t);for(const t of e)n.raw(t);return await n.execute({...t})}async updateOne(e,t,n){return await(0,g.executeOperation)(this.client,new O.UpdateOneOperation(this.s.namespace,e,t,(0,T.resolveOptions)(this,n)))}async replaceOne(e,t,n){return await(0,g.executeOperation)(this.client,new O.ReplaceOneOperation(this.s.namespace,e,t,(0,T.resolveOptions)(this,n)))}async updateMany(e,t,n){return await(0,g.executeOperation)(this.client,new O.UpdateManyOperation(this.s.namespace,e,t,(0,T.resolveOptions)(this,n)))}async deleteOne(e={},t={}){return await(0,g.executeOperation)(this.client,new f.DeleteOneOperation(this.s.namespace,e,(0,T.resolveOptions)(this,t)))}async deleteMany(e={},t={}){return await(0,g.executeOperation)(this.client,new f.DeleteManyOperation(this.s.namespace,e,(0,T.resolveOptions)(this,t)))}async rename(e,t){return await(0,g.executeOperation)(this.client,new E.RenameOperation(this,e,(0,T.resolveOptions)(void 0,{...t,readPreference:M.ReadPreference.PRIMARY})))}async drop(e){return await this.s.db.dropCollection(this.collectionName,e)}async findOne(e={},t={}){const{batchSize:n,noCursorTimeout:r,...i}=t;i.singleBatch=!0;const o=this.find(e,i).limit(1),s=await o.next();return await o.close(),s}find(e={},t={}){return new u.FindCursor(this.client,this.s.namespace,e,(0,T.resolveOptions)(this,t))}async options(e){e=(0,T.resolveOptions)(this,e);const[t]=await this.s.db.listCollections({name:this.collectionName},{...e,nameOnly:!1}).toArray();if(null==t||null==t.options)throw new h.MongoAPIError(`collection ${this.namespace} not found`);return t.options}async isCapped(e){const{capped:t}=await this.options(e);return Boolean(t)}async createIndex(e,t){return(await(0,g.executeOperation)(this.client,y.CreateIndexesOperation.fromIndexSpecification(this,this.collectionName,e,(0,T.resolveOptions)(this,t))))[0]}async createIndexes(e,t){return await(0,g.executeOperation)(this.client,y.CreateIndexesOperation.fromIndexDescriptionArray(this,this.collectionName,e,(0,T.resolveOptions)(this,{...t,maxTimeMS:void 0})))}async dropIndex(e,t){return await(0,g.executeOperation)(this.client,new y.DropIndexOperation(this,e,{...(0,T.resolveOptions)(this,t),readPreference:M.ReadPreference.primary}))}async dropIndexes(e){try{return await(0,g.executeOperation)(this.client,new y.DropIndexOperation(this,"*",(0,T.resolveOptions)(this,e))),!0}catch(e){if(e instanceof h.MongoOperationTimeoutError)throw e;return!1}}listIndexes(e){return new c.ListIndexesCursor(this,(0,T.resolveOptions)(this,e))}async indexExists(e,t){const n=Array.isArray(e)?e:[e],r=new Set(await this.listIndexes(t).map((({name:e})=>e)).toArray());return n.every((e=>r.has(e)))}async indexInformation(e){return await this.indexes({...e,full:e?.full??!1})}async estimatedDocumentCount(e){return await(0,g.executeOperation)(this.client,new m.EstimatedDocumentCountOperation(this,(0,T.resolveOptions)(this,e)))}async countDocuments(e={},t={}){const n=[];n.push({$match:e}),"number"==typeof t.skip&&n.push({$skip:t.skip}),"number"==typeof t.limit&&n.push({$limit:t.limit}),n.push({$group:{_id:1,n:{$sum:1}}});const r=this.aggregate(n,t),i=await r.next();return await r.close(),i?.n??0}async distinct(e,t={},n={}){return await(0,g.executeOperation)(this.client,new p.DistinctOperation(this,e,t,(0,T.resolveOptions)(this,n)))}async indexes(e){const t=await this.listIndexes(e).toArray();return e?.full??1?t:Object.fromEntries(t.map((({name:e,key:t})=>[e,Object.entries(t)])))}async findOneAndDelete(e,t){return await(0,g.executeOperation)(this.client,new _.FindOneAndDeleteOperation(this,e,(0,T.resolveOptions)(this,t)))}async findOneAndReplace(e,t,n){return await(0,g.executeOperation)(this.client,new _.FindOneAndReplaceOperation(this,e,t,(0,T.resolveOptions)(this,n)))}async findOneAndUpdate(e,t,n){return await(0,g.executeOperation)(this.client,new _.FindOneAndUpdateOperation(this,e,t,(0,T.resolveOptions)(this,n)))}aggregate(e=[],t){if(!Array.isArray(e))throw new h.MongoInvalidArgumentError('Argument "pipeline" must be an array of aggregation stages');return new a.AggregationCursor(this.client,this.s.namespace,e,(0,T.resolveOptions)(this,t))}watch(e=[],t={}){return Array.isArray(e)||(t=e,e=[]),new s.ChangeStream(this,e,(0,T.resolveOptions)(this,t))}initializeUnorderedBulkOp(e){return new o.UnorderedBulkOperation(this,(0,T.resolveOptions)(this,e))}initializeOrderedBulkOp(e){return new i.OrderedBulkOperation(this,(0,T.resolveOptions)(this,e))}async count(e={},t={}){return await(0,g.executeOperation)(this.client,new d.CountOperation(this.fullNamespace,e,(0,T.resolveOptions)(this,t)))}listSearchIndexes(e,t){t="object"==typeof e?e:null==t?{}:t;const n=null==e||"object"==typeof e?null:e;return new l.ListSearchIndexesCursor(this,n,t)}async createSearchIndex(e){const[t]=await this.createSearchIndexes([e]);return t}async createSearchIndexes(e){return await(0,g.executeOperation)(this.client,new S.CreateSearchIndexesOperation(this,e))}async dropSearchIndex(e){return await(0,g.executeOperation)(this.client,new w.DropSearchIndexOperation(this,e))}async updateSearchIndex(e,t){return await(0,g.executeOperation)(this.client,new C.UpdateSearchIndexOperation(this,e,t))}}},19917:(e,t,n)=>{var r;n.d(t,{s:()=>r}),function(e){e[e.UNSET=0]="UNSET",e[e.OK=1]="OK",e[e.ERROR=2]="ERROR"}(r||(r={}))},21119:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.MongoDBAWS=void 0;const r=n(75080),i=n(8500),o=n(17562),s=n(145),a=n(31057),u=n(19043),c=n(91566),l=n(93065),h={useBigInt64:!1,promoteLongs:!0,promoteValues:!0,promoteBuffers:!1,bsonRegExp:!1};class d extends a.AuthProvider{constructor(e){super(),this.credentialProvider=e,this.credentialFetcher=u.AWSTemporaryCredentialProvider.isAWSSDKInstalled?new u.AWSSDKCredentialProvider(e):new u.LegacyAWSTemporaryCredentialProvider}async auth(e){const{connection:t}=e;if(!e.credentials)throw new o.MongoMissingCredentialsError("AuthContext must provide credentials.");if("kModuleError"in i.aws4)throw i.aws4.kModuleError;const{sign:n}=i.aws4;if((0,s.maxWireVersion)(t)<9)throw new o.MongoCompatibilityError("MONGODB-AWS authentication requires MongoDB version 4.4 or later");e.credentials.username||(e.credentials=await async function(e,t){return function(t){if(!t.AccessKeyId||!t.SecretAccessKey)throw new o.MongoMissingCredentialsError("Could not obtain temporary MONGODB-AWS credentials");return new c.MongoCredentials({username:t.AccessKeyId,password:t.SecretAccessKey,source:e.source,mechanism:l.AuthMechanism.MONGODB_AWS,mechanismProperties:{AWS_SESSION_TOKEN:t.Token}})}(await t.getCredentials())}(e.credentials,this.credentialFetcher));const{credentials:a}=e,u=a.username,d=a.password,p=a.mechanismProperties.AWS_SESSION_TOKEN,m=u&&d&&p?{accessKeyId:u,secretAccessKey:d,sessionToken:p}:u&&d?{accessKeyId:u,secretAccessKey:d}:void 0,g=a.source,_=await(0,s.randomBytes)(32),y={saslStart:1,mechanism:"MONGODB-AWS",payload:r.serialize({r:_,p:110},h)},v=await t.command((0,s.ns)(`${g}.$cmd`),y,void 0),E=r.deserialize(v.payload.buffer,h),S=E.h,w=E.s.buffer;if(64!==w.length)throw new o.MongoRuntimeError(`Invalid server nonce length ${w.length}, expected 64`);if(!s.ByteUtils.equals(w.subarray(0,_.byteLength),_))throw new o.MongoRuntimeError("Server nonce does not begin with client nonce");if(S.length<1||S.length>255||-1!==S.indexOf(".."))throw new o.MongoRuntimeError(`Server returned an invalid host: "${S}"`);const C=n({method:"POST",host:S,region:f(E.h),service:"sts",headers:{"Content-Type":"application/x-www-form-urlencoded","Content-Length":43,"X-MongoDB-Server-Nonce":s.ByteUtils.toBase64(w),"X-MongoDB-GS2-CB-Flag":"n"},path:"/",body:"Action=GetCallerIdentity&Version=2011-06-15"},m),O={a:C.headers.Authorization,d:C.headers["X-Amz-Date"]};p&&(O.t=p);const b={saslContinue:1,conversationId:v.conversationId,payload:r.serialize(O,h)};await t.command((0,s.ns)(`${g}.$cmd`),b,void 0)}}function f(e){const t=e.split(".");return 1===t.length||"amazonaws"===t[1]?"us-east-1":t[1]}t.MongoDBAWS=d},22220:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.MongoClient=t.ServerApiVersion=void 0;const r=n(36374),i=n(75080),o=n(22345),s=n(91566),a=n(93065),u=n(56463),c=n(75725),l=n(6875),h=n(91869),d=n(44120),f=n(17562),p=n(38944),m=n(93347),g=n(4642),_=n(47523),y=n(96357),v=n(35394),E=n(13700),S=n(31790),w=n(30588),C=n(1759),O=n(14019),b=n(145);t.ServerApiVersion=Object.freeze({v1:"1"});class M extends g.TypedEventEmitter{constructor(e,t){super(),this.on("error",b.noop),this.options=(0,l.parseOptions)(e,this,t);const n=Object.values(this.options.mongoLoggerOptions.componentSeverities).some((e=>e!==m.SeverityLevel.OFF));this.mongoLogger=n?new m.MongoLogger(this.options.mongoLoggerOptions):void 0;const r=this;this.s={url:e,bsonOptions:(0,i.resolveBSONOptions)(this.options),namespace:(0,b.ns)("admin"),hasBeenClosed:!1,sessionPool:new O.ServerSessionPool(this),activeSessions:new Set,activeCursors:new Set,authProviders:new p.MongoClientAuthProviders,get options(){return r.options},get readConcern(){return r.options.readConcern},get writeConcern(){return r.options.writeConcern},get readPreference(){return r.options.readPreference},get isMongoClient(){return!0}},this.checkForNonGenuineHosts()}async asyncDispose(){await this.close()}appendMetadata(e){this.options.additionalDriverInfo.push(e),this.options.metadata=(0,u.makeClientMetadata)(this.options),this.options.extendedMetadata=(0,u.addContainerMetadata)(this.options.metadata).then(void 0,b.squashError).then((e=>e??{}))}checkForNonGenuineHosts(){const e=this.options.hosts.filter((e=>(0,b.isHostMatch)(b.DOCUMENT_DB_CHECK,e.host))),t=(0,b.isHostMatch)(b.DOCUMENT_DB_CHECK,this.options.srvHost),n=this.options.hosts.filter((e=>(0,b.isHostMatch)(b.COSMOS_DB_CHECK,e.host))),r=(0,b.isHostMatch)(b.COSMOS_DB_CHECK,this.options.srvHost);0!==e.length||t?this.mongoLogger?.info("client",b.DOCUMENT_DB_MSG):(0!==n.length||r)&&this.mongoLogger?.info("client",b.COSMOS_DB_MSG)}get serverApi(){return this.options.serverApi&&Object.freeze({...this.options.serverApi})}get monitorCommands(){return this.options.monitorCommands}set monitorCommands(e){this.options.monitorCommands=e}get autoEncrypter(){return this.options.autoEncrypter}get readConcern(){return this.s.readConcern}get writeConcern(){return this.s.writeConcern}get readPreference(){return this.s.readPreference}get bsonOptions(){return this.s.bsonOptions}get timeoutMS(){return this.s.options.timeoutMS}async bulkWrite(e,t){if(this.autoEncrypter)throw new f.MongoInvalidArgumentError("MongoClient bulkWrite does not currently support automatic encryption.");return await new _.ClientBulkWriteExecutor(this,e,(0,b.resolveOptions)(this,t)).execute()}async connect(){if(this.connectionLock)return await this.connectionLock;try{this.connectionLock=this._connect(),await this.connectionLock}finally{this.connectionLock=void 0}return this}async _connect(){if(this.topology&&this.topology.isConnected())return this;const e=this.options;if(e.tls&&("string"==typeof e.tlsCAFile&&(e.ca??=await r.promises.readFile(e.tlsCAFile)),"string"==typeof e.tlsCRLFile&&(e.crl??=await r.promises.readFile(e.tlsCRLFile)),!("string"!=typeof e.tlsCertificateKeyFile||e.key&&e.cert))){const t=await r.promises.readFile(e.tlsCertificateKeyFile);e.key??=t,e.cert??=t}if("string"==typeof e.srvHost){const t=await(0,l.resolveSRVRecord)(e);for(const[n,r]of t.entries())e.hosts[n]=r}if(e.credentials?.mechanism===a.AuthMechanism.MONGODB_OIDC){const t=e.credentials?.mechanismProperties?.ALLOWED_HOSTS||s.DEFAULT_ALLOWED_HOSTS;if(!e.credentials?.mechanismProperties?.ENVIRONMENT)for(const n of e.hosts)if(!(0,b.hostMatchesWildcards)(n.toHostPort().host,t))throw new f.MongoInvalidArgumentError(`Host '${n}' is not valid for OIDC authentication with ALLOWED_HOSTS of '${t.join(",")}'`)}this.topology=new C.Topology(this,e.hosts,e),this.topology.once(C.Topology.OPEN,(()=>this.emit("open",this)));for(const e of h.MONGO_CLIENT_EVENTS)this.topology.on(e,((...t)=>this.emit(e,...t)));const t=async()=>{try{await(this.topology?.connect(e))}catch(e){throw this.topology?.close(),e}};return this.autoEncrypter?(await(this.autoEncrypter?.init()),await t(),await e.encrypter.connectInternalClient()):await t(),this}async close(e=!1){if(this.closeLock)return await this.closeLock;try{this.closeLock=this._close(),await this.closeLock}finally{this.closeLock=void 0}}async _close(){Object.defineProperty(this.s,"hasBeenClosed",{value:!0,enumerable:!0,configurable:!1,writable:!1}),this.topology?.closeCheckedOutConnections();const e=Array.from(this.s.activeCursors,(e=>e.close()));this.s.activeCursors.clear(),await Promise.all(e);const t=Array.from(this.s.activeSessions,(e=>e.endSession()));if(this.s.activeSessions.clear(),await Promise.all(t),null==this.topology)return;const n=(0,w.readPreferenceServerSelector)(E.ReadPreference.primaryPreferred),r=this.topology.description,i=Array.from(r.servers.values());if(0!==n(r,i).length){const e=Array.from(this.s.sessionPool.sessions,(({id:e})=>e));if(0!==e.length)try{class t extends v.AbstractOperation{constructor(){super(...arguments),this.ns=b.MongoDBNamespace.fromString("admin.$cmd"),this.SERVER_COMMAND_RESPONSE_TYPE=c.MongoDBResponse}buildCommand(t,n){return{endSessions:e}}buildOptions(e){return{timeoutContext:e,readPreference:E.ReadPreference.primaryPreferred,noResponse:!0}}get commandName(){return"endSessions"}}await(0,y.executeOperation)(this,new t)}catch(e){(0,b.squashError)(e)}}const o=this.topology;this.topology=void 0,o.close();const{encrypter:s}=this.options;s&&await s.close(this)}db(e,t){t=t??{},e||(e=this.s.options.dbName);const n=Object.assign({},this.options,t);return new d.Db(this,e,n)}static async connect(e,t){const n=new this(e,t);return await n.connect()}startSession(e){const t=new O.ClientSession(this,this.s.sessionPool,{explicit:!0,...e},this.options);return this.s.activeSessions.add(t),t.once("ended",(()=>{this.s.activeSessions.delete(t)})),t}async withSession(e,t){const n={owner:Symbol(),..."object"==typeof e?e:{}},r="function"==typeof e?e:t;if(null==r)throw new f.MongoInvalidArgumentError("Missing required callback parameter");const i=this.startSession(n);try{return await r(i)}finally{try{await i.endSession()}catch(e){(0,b.squashError)(e)}}}watch(e=[],t={}){return Array.isArray(e)||(t=e,e=[]),new o.ChangeStream(this,e,(0,b.resolveOptions)(this,t))}}t.MongoClient=M,(0,S.configureResourceManagement)(M.prototype)},22345:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ChangeStream=void 0;const r=n(19498),i=n(91869),o=n(61066),s=n(40251),a=n(44120),u=n(17562),c=n(22220),l=n(4642),h=n(31790),d=n(7799),f=n(145),p=["resumeAfter","startAfter","startAtOperationTime","fullDocument","fullDocumentBeforeChange","showExpandedEvents"],m={COLLECTION:Symbol("Collection"),DATABASE:Symbol("Database"),CLUSTER:Symbol("Cluster")},g=[i.RESUME_TOKEN_CHANGED,i.END,i.CLOSE],_="ChangeStream is closed";class y extends l.TypedEventEmitter{async asyncDispose(){await this.close()}constructor(e,t=[],n={}){let i;if(super(),this.pipeline=t,this.options={...n},delete this.options.writeConcern,e instanceof r.Collection)this.type=m.COLLECTION,i=e.s.db.client.options.serverSelectionTimeoutMS;else if(e instanceof a.Db)this.type=m.DATABASE,i=e.client.options.serverSelectionTimeoutMS;else{if(!(e instanceof c.MongoClient))throw new u.MongoChangeStreamError("Parent provided to ChangeStream constructor must be an instance of Collection, Db, or MongoClient");this.type=m.CLUSTER,i=e.options.serverSelectionTimeoutMS}this.contextOwner=Symbol(),this.parent=e,this.namespace=e.s.namespace,!this.options.readPreference&&e.readPreference&&(this.options.readPreference=e.readPreference),this.cursor=this._createChangeStreamCursor(n),this.isClosed=!1,this.mode=!1,this.on("newListener",(e=>{"change"===e&&this.cursor&&0===this.listenerCount("change")&&this._streamEvents(this.cursor)})),this.on("removeListener",(e=>{"change"===e&&0===this.listenerCount("change")&&this.cursor&&this.cursorStream?.removeAllListeners("data")})),null!=this.options.timeoutMS&&(this.timeoutContext=new d.CSOTTimeoutContext({timeoutMS:this.options.timeoutMS,serverSelectionTimeoutMS:i}))}get resumeToken(){return this.cursor?.resumeToken}async hasNext(){this._setIsIterator(),this.timeoutContext?.refresh();try{for(;;)try{return await this.cursor.hasNext()}catch(e){try{await this._processErrorIteratorMode(e,null!=this.cursor.id)}catch(e){if(e instanceof u.MongoOperationTimeoutError&&null==this.cursor.id)throw e;try{await this.close()}catch(e){(0,f.squashError)(e)}throw e}}}finally{this.timeoutContext?.clear()}}async next(){this._setIsIterator(),this.timeoutContext?.refresh();try{for(;;)try{const e=await this.cursor.next();return this._processChange(e??null)}catch(e){try{await this._processErrorIteratorMode(e,null!=this.cursor.id)}catch(e){if(e instanceof u.MongoOperationTimeoutError&&null==this.cursor.id)throw e;try{await this.close()}catch(e){(0,f.squashError)(e)}throw e}}}finally{this.timeoutContext?.clear()}}async tryNext(){this._setIsIterator(),this.timeoutContext?.refresh();try{for(;;)try{return await this.cursor.tryNext()??null}catch(e){try{await this._processErrorIteratorMode(e,null!=this.cursor.id)}catch(e){if(e instanceof u.MongoOperationTimeoutError&&null==this.cursor.id)throw e;try{await this.close()}catch(e){(0,f.squashError)(e)}throw e}}}finally{this.timeoutContext?.clear()}}async*[Symbol.asyncIterator](){if(!this.closed)try{for(;;)yield await this.next()}finally{try{await this.close()}catch(e){(0,f.squashError)(e)}}}get closed(){return this.isClosed||this.cursor.closed}async close(){this.timeoutContext?.clear(),this.timeoutContext=void 0,this.isClosed=!0;const e=this.cursor;try{await e.close()}finally{this._endStream()}}stream(e){if(this.closed)throw new u.MongoChangeStreamError(_);return this.streamOptions=e,this.cursor.stream(e)}_setIsEmitter(){if("iterator"===this.mode)throw new u.MongoAPIError("ChangeStream cannot be used as an EventEmitter after being used as an iterator");this.mode="emitter"}_setIsIterator(){if("emitter"===this.mode)throw new u.MongoAPIError("ChangeStream cannot be used as an iterator after being used as an EventEmitter");this.mode="iterator"}_createChangeStreamCursor(e){const t=(0,f.filterOptions)(e,p);this.type===m.CLUSTER&&(t.allChangesForCluster=!0);const n=[{$changeStream:t},...this.pipeline],r=this.type===m.CLUSTER?this.parent:this.type===m.DATABASE||this.type===m.COLLECTION?this.parent.client:null;if(null==r)throw new u.MongoRuntimeError(`Changestream type should only be one of cluster, database, collection. Found ${this.type.toString()}`);const i=new s.ChangeStreamCursor(r,this.namespace,n,{...e,timeoutContext:this.timeoutContext?new o.CursorTimeoutContext(this.timeoutContext,this.contextOwner):void 0});for(const e of g)i.on(e,(t=>this.emit(e,t)));return this.listenerCount(y.CHANGE)>0&&this._streamEvents(i),i}_closeEmitterModeWithError(e){this.emit(y.ERROR,e),this.close().then(void 0,f.squashError)}_streamEvents(e){this._setIsEmitter();const t=this.cursorStream??e.stream();this.cursorStream=t,t.on("data",(e=>{try{const t=this._processChange(e);this.emit(y.CHANGE,t)}catch(e){this.emit(y.ERROR,e)}this.timeoutContext?.refresh()})),t.on("error",(e=>this._processErrorStreamMode(e,null!=this.cursor.id)))}_endStream(){this.cursorStream?.removeAllListeners("data"),this.cursorStream?.removeAllListeners("close"),this.cursorStream?.removeAllListeners("end"),this.cursorStream?.destroy(),this.cursorStream=void 0}_processChange(e){if(this.isClosed)throw new u.MongoAPIError(_);if(null==e)throw new u.MongoRuntimeError(_);if(e&&!e._id)throw new u.MongoChangeStreamError("A change stream document has been received that lacks a resume token (_id).");return this.cursor.cacheResumeToken(e._id),this.options.startAtOperationTime=void 0,e}_processErrorStreamMode(e,t){this.isClosed||(t&&((0,u.isResumableError)(e,this.cursor.maxWireVersion)||e instanceof u.MongoOperationTimeoutError)?(this._endStream(),this.cursor.close().then((()=>this._resume(e)),(t=>((0,f.squashError)(t),this._resume(e)))).then((()=>{e instanceof u.MongoOperationTimeoutError&&this.emit(y.ERROR,e)}),(()=>this._closeEmitterModeWithError(e)))):this._closeEmitterModeWithError(e))}async _processErrorIteratorMode(e,t){if(this.isClosed)throw new u.MongoAPIError(_);if(!t||!((0,u.isResumableError)(e,this.cursor.maxWireVersion)||e instanceof u.MongoOperationTimeoutError)){try{await this.close()}catch(e){(0,f.squashError)(e)}throw e}try{await this.cursor.close()}catch(e){(0,f.squashError)(e)}if(await this._resume(e),e instanceof u.MongoOperationTimeoutError)throw e}async _resume(e){this.timeoutContext?.refresh();const t=(0,f.getTopology)(this.parent);try{await t.selectServer(this.cursor.readPreference,{operationName:"reconnect topology in change stream",timeoutContext:this.timeoutContext}),this.cursor=this._createChangeStreamCursor(this.cursor.resumeOptions)}catch{throw await this.close(),e}}}t.ChangeStream=y,y.RESPONSE=i.RESPONSE,y.MORE=i.MORE,y.INIT=i.INIT,y.CLOSE=i.CLOSE,y.CHANGE=i.CHANGE,y.END=i.END,y.ERROR=i.ERROR,y.RESUME_TOKEN_CHANGED=i.RESUME_TOKEN_CHANGED,(0,h.configureResourceManagement)(y.prototype)},22847:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ListIndexesOperation=t.DropIndexOperation=t.CreateIndexesOperation=void 0;const r=n(75725),i=n(17562),o=n(145),s=n(78130),a=n(35394),u=new Set(["background","unique","name","partialFilterExpression","sparse","hidden","expireAfterSeconds","storageEngine","collation","version","weights","default_language","language_override","textIndexVersion","2dsphereIndexVersion","bits","min","max","bucketSize","wildcardProjection"]);class c extends s.CommandOperation{constructor(e,t,n,i){super(e,i),this.SERVER_COMMAND_RESPONSE_TYPE=r.MongoDBResponse,this.options=i??{},this.options.collation=void 0,this.collectionName=t,this.indexes=n.map((e=>{const t=e.key instanceof Map?e.key:new Map(Object.entries(e.key)),n=e.name??Array.from(t).flat().join("_"),r=function(e){const t=Object.entries(e).filter((([e])=>u.has(e)));return Object.fromEntries(t.map((([e,t])=>"version"===e?["v",t]:[e,t])))}(e);return{...r,name:n,key:t}})),this.ns=e.s.namespace}static fromIndexDescriptionArray(e,t,n,r){return new c(e,t,n,r)}static fromIndexSpecification(e,t,n,r={}){const i=function(e){const t=new Map,n=Array.isArray(e)&&(r=e,!Array.isArray(r)||2!==r.length||"number"!=typeof(i=r[1])&&"2d"!==i&&"2dsphere"!==i&&"text"!==i&&"geoHaystack"!==i)?e:[e];var r,i;for(const e of n)if("string"==typeof e)t.set(e,1);else if(Array.isArray(e))t.set(e[0],e[1]??1);else if(e instanceof Map)for(const[n,r]of e)t.set(n,r);else if((0,o.isObject)(e))for(const[n,r]of Object.entries(e))t.set(n,r);return t}(n),s={...r,key:i};return new c(e,t,[s],r)}get commandName(){return"createIndexes"}buildCommandDocument(e){const t=this.options,n=this.indexes,r=(0,o.maxWireVersion)(e),s={createIndexes:this.collectionName,indexes:n};if(null!=t.commitQuorum){if(r<9)throw new i.MongoCompatibilityError("Option `commitQuorum` for `createIndexes` not supported on servers < 4.4");s.commitQuorum=t.commitQuorum}return s}handleOk(e){return this.indexes.map((e=>e.name||""))}}t.CreateIndexesOperation=c;class l extends s.CommandOperation{constructor(e,t,n){super(e,n),this.SERVER_COMMAND_RESPONSE_TYPE=r.MongoDBResponse,this.options=n??{},this.collection=e,this.indexName=t,this.ns=e.fullNamespace}get commandName(){return"dropIndexes"}buildCommandDocument(e){return{dropIndexes:this.collection.collectionName,index:this.indexName}}}t.DropIndexOperation=l;class h extends s.CommandOperation{constructor(e,t){super(e,t),this.SERVER_COMMAND_RESPONSE_TYPE=r.CursorResponse,this.options={...t},delete this.options.writeConcern,this.collectionNamespace=e.s.namespace}get commandName(){return"listIndexes"}buildCommandDocument(e){const t=(0,o.maxWireVersion)(e),n=this.options.batchSize?{batchSize:this.options.batchSize}:{},r={listIndexes:this.collectionNamespace.collection,cursor:n};return t>=9&&void 0!==this.options.comment&&(r.comment=this.options.comment),r}handleOk(e){return e}}t.ListIndexesOperation=h,(0,a.defineAspects)(h,[a.Aspect.READ_OPERATION,a.Aspect.RETRYABLE,a.Aspect.CURSOR_CREATING]),(0,a.defineAspects)(c,[a.Aspect.WRITE_OPERATION]),(0,a.defineAspects)(l,[a.Aspect.WRITE_OPERATION])},23611:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.StreamDescription=void 0;const r=n(75080),i=n(89167),o=n(9188),s=["minWireVersion","maxWireVersion","maxBsonObjectSize","maxMessageSizeBytes","maxWriteBatchSize","logicalSessionTimeoutMinutes"];t.StreamDescription=class{constructor(e,t){this.hello=null,this.address=e,this.type=i.ServerType.Unknown,this.minWireVersion=void 0,this.maxWireVersion=void 0,this.maxBsonObjectSize=16777216,this.maxMessageSizeBytes=48e6,this.maxWriteBatchSize=1e5,this.logicalSessionTimeoutMinutes=t?.logicalSessionTimeoutMinutes,this.loadBalanced=!!t?.loadBalanced,this.compressors=t&&t.compressors&&Array.isArray(t.compressors)?t.compressors:[],this.serverConnectionId=null}receiveResponse(e){if(null!=e){this.hello=e,this.type=(0,o.parseServerType)(e),this.serverConnectionId="connectionId"in e?this.parseServerConnectionID(e.connectionId):null;for(const t of s)null!=e[t]&&(this[t]=e[t]),"__nodejs_mock_server__"in e&&(this.__nodejs_mock_server__=e.__nodejs_mock_server__);e.compression&&(this.compressor=this.compressors.filter((t=>e.compression?.includes(t)))[0])}}parseServerConnectionID(e){return r.Long.isLong(e)?e.toBigInt():BigInt(e)}}},25220:(e,t,n)=>{n.d(t,{Ay:()=>i});var r=n(12453);const i=r;r.MAX_DATABASE_NAME_LENGTH,r.sort},26633:(e,t,n)=>{e.exports=function(e){function t(e){let n,i,o,s=null;function a(...e){if(!a.enabled)return;const r=a,i=Number(new Date),o=i-(n||i);r.diff=o,r.prev=n,r.curr=i,n=i,e[0]=t.coerce(e[0]),"string"!=typeof e[0]&&e.unshift("%O");let s=0;e[0]=e[0].replace(/%([a-zA-Z%])/g,((n,i)=>{if("%%"===n)return"%";s++;const o=t.formatters[i];if("function"==typeof o){const t=e[s];n=o.call(r,t),e.splice(s,1),s--}return n})),t.formatArgs.call(r,e),(r.log||t.log).apply(r,e)}return a.namespace=e,a.useColors=t.useColors(),a.color=t.selectColor(e),a.extend=r,a.destroy=t.destroy,Object.defineProperty(a,"enabled",{enumerable:!0,configurable:!1,get:()=>null!==s?s:(i!==t.namespaces&&(i=t.namespaces,o=t.enabled(e)),o),set:e=>{s=e}}),"function"==typeof t.init&&t.init(a),a}function r(e,n){const r=t(this.namespace+(void 0===n?":":n)+e);return r.log=this.log,r}function i(e,t){let n=0,r=0,i=-1,o=0;for(;n<e.length;)if(r<t.length&&(t[r]===e[n]||"*"===t[r]))"*"===t[r]?(i=r,o=n,r++):(n++,r++);else{if(-1===i)return!1;r=i+1,o++,n=o}for(;r<t.length&&"*"===t[r];)r++;return r===t.length}return t.debug=t,t.default=t,t.coerce=function(e){return e instanceof Error?e.stack||e.message:e},t.disable=function(){const e=[...t.names,...t.skips.map((e=>"-"+e))].join(",");return t.enable(""),e},t.enable=function(e){t.save(e),t.namespaces=e,t.names=[],t.skips=[];const n=("string"==typeof e?e:"").trim().replace(/\s+/g,",").split(",").filter(Boolean);for(const e of n)"-"===e[0]?t.skips.push(e.slice(1)):t.names.push(e)},t.enabled=function(e){for(const n of t.skips)if(i(e,n))return!1;for(const n of t.names)if(i(e,n))return!0;return!1},t.humanize=n(82630),t.destroy=function(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")},Object.keys(e).forEach((n=>{t[n]=e[n]})),t.names=[],t.skips=[],t.formatters={},t.selectColor=function(e){let n=0;for(let t=0;t<e.length;t++)n=(n<<5)-n+e.charCodeAt(t),n|=0;return t.colors[Math.abs(n)%t.colors.length]},t.enable(t.load()),t}},26767:(e,t,n)=>{n.d(t,{u:()=>W});var r="object"==typeof globalThis?globalThis:"object"==typeof self?self:"object"==typeof window?window:"object"==typeof n.g?n.g:{},i="1.9.0",o=/^(\d+)\.(\d+)\.(\d+)(-(.+))?$/,s=function(e){var t=new Set([e]),n=new Set,r=e.match(o);if(!r)return function(){return!1};var i=+r[1],s=+r[2],a=+r[3];if(null!=r[4])return function(t){return t===e};function u(e){return n.add(e),!1}function c(e){return t.add(e),!0}return function(e){if(t.has(e))return!0;if(n.has(e))return!1;var r=e.match(o);if(!r)return u(e);var l=+r[1],h=+r[2],d=+r[3];return null!=r[4]||i!==l?u(e):0===i?s===h&&a<=d?c(e):u(e):s<=h?c(e):u(e)}}(i),a=i.split(".")[0],u=Symbol.for("opentelemetry.js.api."+a),c=r;function l(e,t,n,r){var o;void 0===r&&(r=!1);var s=c[u]=null!==(o=c[u])&&void 0!==o?o:{version:i};if(!r&&s[e]){var a=new Error("@opentelemetry/api: Attempted duplicate registration of API: "+e);return n.error(a.stack||a.message),!1}return s.version!==i?(a=new Error("@opentelemetry/api: Registration of version v"+s.version+" for "+e+" does not match previously registered API v"+i),n.error(a.stack||a.message),!1):(s[e]=t,n.debug("@opentelemetry/api: Registered a global for "+e+" v"+i+"."),!0)}function h(e){var t,n,r=null===(t=c[u])||void 0===t?void 0:t.version;if(r&&s(r))return null===(n=c[u])||void 0===n?void 0:n[e]}function d(e,t){t.debug("@opentelemetry/api: Unregistering a global for "+e+" v"+i+".");var n=c[u];n&&delete n[e]}var f,p=new function e(t){var n=this;n._currentContext=t?new Map(t):new Map,n.getValue=function(e){return n._currentContext.get(e)},n.setValue=function(t,r){var i=new e(n._currentContext);return i._currentContext.set(t,r),i},n.deleteValue=function(t){var r=new e(n._currentContext);return r._currentContext.delete(t),r}},m=function(){function e(){}return e.prototype.active=function(){return p},e.prototype.with=function(e,t,n){for(var r=[],i=3;i<arguments.length;i++)r[i-3]=arguments[i];return t.call.apply(t,function(e,t,n){if(n||2===arguments.length)for(var r,i=0,o=t.length;i<o;i++)!r&&i in t||(r||(r=Array.prototype.slice.call(t,0,i)),r[i]=t[i]);return e.concat(r||Array.prototype.slice.call(t))}([n],function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)s.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return s}(r),!1))},e.prototype.bind=function(e,t){return t},e.prototype.enable=function(){return this},e.prototype.disable=function(){return this},e}(),g=function(){function e(e){this._namespace=e.namespace||"DiagComponentLogger"}return e.prototype.debug=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return _("debug",this._namespace,e)},e.prototype.error=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return _("error",this._namespace,e)},e.prototype.info=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return _("info",this._namespace,e)},e.prototype.warn=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return _("warn",this._namespace,e)},e.prototype.verbose=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return _("verbose",this._namespace,e)},e}();function _(e,t,n){var r=h("diag");if(r)return n.unshift(t),r[e].apply(r,function(e,t,n){if(n||2===arguments.length)for(var r,i=0,o=t.length;i<o;i++)!r&&i in t||(r||(r=Array.prototype.slice.call(t,0,i)),r[i]=t[i]);return e.concat(r||Array.prototype.slice.call(t))}([],function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)s.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return s}(n),!1))}!function(e){e[e.NONE=0]="NONE",e[e.ERROR=30]="ERROR",e[e.WARN=50]="WARN",e[e.INFO=60]="INFO",e[e.DEBUG=70]="DEBUG",e[e.VERBOSE=80]="VERBOSE",e[e.ALL=9999]="ALL"}(f||(f={}));var y,v=function(){function e(){function e(e){return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];var r=h("diag");if(r)return r[e].apply(r,function(e,t,n){if(n||2===arguments.length)for(var r,i=0,o=t.length;i<o;i++)!r&&i in t||(r||(r=Array.prototype.slice.call(t,0,i)),r[i]=t[i]);return e.concat(r||Array.prototype.slice.call(t))}([],function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)s.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return s}(t),!1))}}var t=this;t.setLogger=function(e,n){var r,i,o;if(void 0===n&&(n={logLevel:f.INFO}),e===t){var s=new Error("Cannot use diag as the logger for itself. Please use a DiagLogger implementation like ConsoleDiagLogger or a custom implementation");return t.error(null!==(r=s.stack)&&void 0!==r?r:s.message),!1}"number"==typeof n&&(n={logLevel:n});var a=h("diag"),u=function(e,t){function n(n,r){var i=t[n];return"function"==typeof i&&e>=r?i.bind(t):function(){}}return e<f.NONE?e=f.NONE:e>f.ALL&&(e=f.ALL),t=t||{},{error:n("error",f.ERROR),warn:n("warn",f.WARN),info:n("info",f.INFO),debug:n("debug",f.DEBUG),verbose:n("verbose",f.VERBOSE)}}(null!==(i=n.logLevel)&&void 0!==i?i:f.INFO,e);if(a&&!n.suppressOverrideMessage){var c=null!==(o=(new Error).stack)&&void 0!==o?o:"<failed to generate stacktrace>";a.warn("Current logger will be overwritten from "+c),u.warn("Current logger will overwrite one already registered from "+c)}return l("diag",u,t,!0)},t.disable=function(){d("diag",t)},t.createComponentLogger=function(e){return new g(e)},t.verbose=e("verbose"),t.debug=e("debug"),t.info=e("info"),t.warn=e("warn"),t.error=e("error")}return e.instance=function(){return this._instance||(this._instance=new e),this._instance},e}(),E="context",S=new m,w=function(){function e(){}return e.getInstance=function(){return this._instance||(this._instance=new e),this._instance},e.prototype.setGlobalContextManager=function(e){return l(E,e,v.instance())},e.prototype.active=function(){return this._getContextManager().active()},e.prototype.with=function(e,t,n){for(var r,i=[],o=3;o<arguments.length;o++)i[o-3]=arguments[o];return(r=this._getContextManager()).with.apply(r,function(e,t,n){if(n||2===arguments.length)for(var r,i=0,o=t.length;i<o;i++)!r&&i in t||(r||(r=Array.prototype.slice.call(t,0,i)),r[i]=t[i]);return e.concat(r||Array.prototype.slice.call(t))}([e,t,n],function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)s.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return s}(i),!1))},e.prototype.bind=function(e,t){return this._getContextManager().bind(e,t)},e.prototype._getContextManager=function(){return h(E)||S},e.prototype.disable=function(){this._getContextManager().disable(),d(E,v.instance())},e}();!function(e){e[e.NONE=0]="NONE",e[e.SAMPLED=1]="SAMPLED"}(y||(y={}));var C="0000000000000000",O="00000000000000000000000000000000",b={traceId:O,spanId:C,traceFlags:y.NONE},M=function(){function e(e){void 0===e&&(e=b),this._spanContext=e}return e.prototype.spanContext=function(){return this._spanContext},e.prototype.setAttribute=function(e,t){return this},e.prototype.setAttributes=function(e){return this},e.prototype.addEvent=function(e,t){return this},e.prototype.addLink=function(e){return this},e.prototype.addLinks=function(e){return this},e.prototype.setStatus=function(e){return this},e.prototype.updateName=function(e){return this},e.prototype.end=function(e){},e.prototype.isRecording=function(){return!1},e.prototype.recordException=function(e,t){},e}(),T=Symbol.for("OpenTelemetry Context Key SPAN");function A(e){return e.getValue(T)||void 0}function R(){return A(w.getInstance().active())}function N(e,t){return e.setValue(T,t)}function I(e){return e.deleteValue(T)}function x(e,t){return N(e,new M(t))}function k(e){var t;return null===(t=A(e))||void 0===t?void 0:t.spanContext()}var P=/^([0-9a-f]{32})$/i,D=/^[0-9a-f]{16}$/i;function $(e){return n=e.traceId,P.test(n)&&n!==O&&(t=e.spanId,D.test(t)&&t!==C);var t,n}function L(e){return new M(e)}var B=w.getInstance(),j=function(){function e(){}return e.prototype.startSpan=function(e,t,n){if(void 0===n&&(n=B.active()),Boolean(null==t?void 0:t.root))return new M;var r,i=n&&k(n);return"object"==typeof(r=i)&&"string"==typeof r.spanId&&"string"==typeof r.traceId&&"number"==typeof r.traceFlags&&$(i)?new M(i):new M},e.prototype.startActiveSpan=function(e,t,n,r){var i,o,s;if(!(arguments.length<2)){2===arguments.length?s=t:3===arguments.length?(i=t,s=n):(i=t,o=n,s=r);var a=null!=o?o:B.active(),u=this.startSpan(e,i,a),c=N(a,u);return B.with(c,s,void 0,u)}},e}(),q=new j,F=function(){function e(e,t,n,r){this._provider=e,this.name=t,this.version=n,this.options=r}return e.prototype.startSpan=function(e,t,n){return this._getTracer().startSpan(e,t,n)},e.prototype.startActiveSpan=function(e,t,n,r){var i=this._getTracer();return Reflect.apply(i.startActiveSpan,i,arguments)},e.prototype._getTracer=function(){if(this._delegate)return this._delegate;var e=this._provider.getDelegateTracer(this.name,this.version,this.options);return e?(this._delegate=e,this._delegate):q},e}(),z=new(function(){function e(){}return e.prototype.getTracer=function(e,t,n){return new j},e}()),U=function(){function e(){}return e.prototype.getTracer=function(e,t,n){var r;return null!==(r=this.getDelegateTracer(e,t,n))&&void 0!==r?r:new F(this,e,t,n)},e.prototype.getDelegate=function(){var e;return null!==(e=this._delegate)&&void 0!==e?e:z},e.prototype.setDelegate=function(e){this._delegate=e},e.prototype.getDelegateTracer=function(e,t,n){var r;return null===(r=this._delegate)||void 0===r?void 0:r.getTracer(e,t,n)},e}(),V="trace",W=function(){function e(){this._proxyTracerProvider=new U,this.wrapSpanContext=L,this.isSpanContextValid=$,this.deleteSpan=I,this.getSpan=A,this.getActiveSpan=R,this.getSpanContext=k,this.setSpan=N,this.setSpanContext=x}return e.getInstance=function(){return this._instance||(this._instance=new e),this._instance},e.prototype.setGlobalTracerProvider=function(e){var t=l(V,this._proxyTracerProvider,v.instance());return t&&this._proxyTracerProvider.setDelegate(e),t},e.prototype.getTracerProvider=function(){return h(V)||this._proxyTracerProvider},e.prototype.getTracer=function(e,t){return this.getTracerProvider().getTracer(e,t)},e.prototype.disable=function(){d(V,v.instance()),this._proxyTracerProvider=new U},e}().getInstance()},28113:(e,t,n)=>{var r=n(92992),i=n(81892),o=n(40642),s=n(90686),a=n(76023),u=n(79696).Buffer;function c(e){var t;"object"!=typeof e||u.isBuffer(e)||(t=e.passphrase,e=e.key),"string"==typeof e&&(e=u.from(e));var n,c,l=o(e,t),h=l.tag,d=l.data;switch(h){case"CERTIFICATE":c=r.certificate.decode(d,"der").tbsCertificate.subjectPublicKeyInfo;case"PUBLIC KEY":switch(c||(c=r.PublicKey.decode(d,"der")),n=c.algorithm.algorithm.join(".")){case"1.2.840.113549.1.1.1":return r.RSAPublicKey.decode(c.subjectPublicKey.data,"der");case"1.2.840.10045.2.1":return c.subjectPrivateKey=c.subjectPublicKey,{type:"ec",data:c};case"1.2.840.10040.4.1":return c.algorithm.params.pub_key=r.DSAparam.decode(c.subjectPublicKey.data,"der"),{type:"dsa",data:c.algorithm.params};default:throw new Error("unknown key id "+n)}case"ENCRYPTED PRIVATE KEY":d=function(e,t){var n=e.algorithm.decrypt.kde.kdeparams.salt,r=parseInt(e.algorithm.decrypt.kde.kdeparams.iters.toString(),10),o=i[e.algorithm.decrypt.cipher.algo.join(".")],c=e.algorithm.decrypt.cipher.iv,l=e.subjectPrivateKey,h=parseInt(o.split("-")[1],10)/8,d=a.pbkdf2Sync(t,n,r,h,"sha1"),f=s.createDecipheriv(o,d,c),p=[];return p.push(f.update(l)),p.push(f.final()),u.concat(p)}(d=r.EncryptedPrivateKey.decode(d,"der"),t);case"PRIVATE KEY":switch(n=(c=r.PrivateKey.decode(d,"der")).algorithm.algorithm.join(".")){case"1.2.840.113549.1.1.1":return r.RSAPrivateKey.decode(c.subjectPrivateKey,"der");case"1.2.840.10045.2.1":return{curve:c.algorithm.curve,privateKey:r.ECPrivateKey.decode(c.subjectPrivateKey,"der").privateKey};case"1.2.840.10040.4.1":return c.algorithm.params.priv_key=r.DSAparam.decode(c.subjectPrivateKey,"der"),{type:"dsa",params:c.algorithm.params};default:throw new Error("unknown key id "+n)}case"RSA PUBLIC KEY":return r.RSAPublicKey.decode(d,"der");case"RSA PRIVATE KEY":return r.RSAPrivateKey.decode(d,"der");case"DSA PRIVATE KEY":return{type:"dsa",params:r.DSAPrivateKey.decode(d,"der")};case"EC PRIVATE KEY":return{curve:(d=r.ECPrivateKey.decode(d,"der")).parameters.value,privateKey:d.privateKey};default:throw new Error("unknown key type "+h)}}c.signature=r.signature,e.exports=c},28541:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ReadConcern=t.ReadConcernLevel=void 0,t.ReadConcernLevel=Object.freeze({local:"local",majority:"majority",linearizable:"linearizable",available:"available",snapshot:"snapshot"});class n{constructor(e){this.level=t.ReadConcernLevel[e]??e}static fromOptions(e){if(null!=e){if(e.readConcern){const{readConcern:t}=e;if(t instanceof n)return t;if("string"==typeof t)return new n(t);if("level"in t&&t.level)return new n(t.level)}return e.level?new n(e.level):void 0}}static get MAJORITY(){return t.ReadConcernLevel.majority}static get AVAILABLE(){return t.ReadConcernLevel.available}static get LINEARIZABLE(){return t.ReadConcernLevel.linearizable}static get SNAPSHOT(){return t.ReadConcernLevel.snapshot}toJSON(){return{level:this.level}}}t.ReadConcern=n},29009:function(e,t,n){var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.getDataLake=function(e){return f(e)&&f(e.dataLake)&&"string"==typeof e.dataLake.version?{isDataLake:!0,dlVersion:e.dataLake.version}:{isDataLake:!1,dlVersion:null}},t.isEnterprise=function(e){return!!f(e)&&(!("string"!=typeof e.gitVersion||!e.gitVersion.match(/enterprise/))||!(!Array.isArray(e.modules)||-1===e.modules.indexOf("enterprise")))},t.isAtlas=function(e){return!!m(e).match(s)},t.isLocalAtlas=async function(e){try{return await e("admin","atlascli",{managedClusterType:"atlasCliLocalDevCluster"})>0}catch{return!1}},t.isAtlasStream=function(e){const t=m(e);return!(!t.match(s)||!t.match(a))},t.isLocalhost=function(e){return!!m(e).match(u)},t.isDigitalOcean=function(e){return!!m(e).match(c)},t.getGenuineMongoDB=function(e){const t=m(e);return t.match(l)?{isGenuine:!1,serverName:"cosmosdb"}:t.match(h)?{isGenuine:!1,serverName:"documentdb"}:{isGenuine:!0,serverName:"mongodb"}},t.identifyServerName=async function({connectionString:e,adminCommand:t}){try{const n=m(e);if(n.match(s))return"mongodb";if(n.match(l))return"cosmosdb";if(n.match(h))return"documentdb";if(n.match(d))return"firestore";const r=await Promise.all([t({buildInfo:1}).then((e=>"ferretdb"in e?["ferretdb"]:[]),(e=>(o("buildInfo command failed %O",e),[]))),t({getParameter:"foo"}).then((()=>[]),(e=>e instanceof Error&&/documentdb_api/.test(e.message)?["pg_documentdb"]:[]))]).then((e=>e.flat()));return 0===r.length?"mongodb":1===r.length?r[0]:"unknown"}catch(e){return o("Failed to identify server name",e),"unknown"}},t.getBuildEnv=function(e){if(!f(e)||!f(e.buildEnvironment))return{serverOs:null,serverArch:null};const{buildEnvironment:t}=e;return{serverOs:"string"==typeof t.target_os?t.target_os:null,serverArch:"string"==typeof t.target_arch?t.target_arch:null}};const i=r(n(65031)),o=(0,n(79254).debug)("mongodb-build-info"),s=/\.mongodb(-dev|-qa|-stage)?\.net$/i,a=/^atlas-stream-.+/i,u=/^(localhost|127\.([01]?[0-9][0-9]?|2[0-4][0-9]|25[0-5])\.([01]?[0-9][0-9]?|2[0-4][0-9]|25[0-5])\.([01]?[0-9][0-9]?|2[0-4][0-9]|25[0-5])|0\.0\.0\.0|(?:0*:)*?:?0*1)$/i,c=/\.mongo\.ondigitalocean\.com$/i,l=/\.cosmos\.azure\.com$/i,h=/docdb(-elastic)?\.amazonaws\.com$/i,d=/\.firestore.goog$/i;function f(e){return"object"==typeof e&&null!==e}function p(e){return e.startsWith("[")?e.substring(1).split("]")[0]:e.split(":")[0]}function m(e){if("string"!=typeof e)return"";try{return p(new i.default(e).hosts[0])}catch(t){return p(e)}}},29348:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.OrderedBulkOperation=void 0;const r=n(75080),i=n(17562),o=n(54564);class s extends o.BulkOperationBase{constructor(e,t){super(e,t,!0)}addToOperationsList(e,t){const n=r.calculateObjectSize(t,{checkKeys:!1,ignoreUndefined:!1});if(n>=this.s.maxBsonObjectSize)throw new i.MongoInvalidArgumentError(`Document is larger than the maximum size ${this.s.maxBsonObjectSize}`);null==this.s.currentBatch&&(this.s.currentBatch=new o.Batch(e,this.s.currentIndex));const s=this.s.maxKeySize;if((this.s.currentBatchSize+1>=this.s.maxWriteBatchSize||this.s.currentBatchSize>0&&this.s.currentBatchSizeBytes+s+n>=this.s.maxBatchSizeBytes||this.s.currentBatch.batchType!==e)&&(this.s.batches.push(this.s.currentBatch),this.s.currentBatch=new o.Batch(e,this.s.currentIndex),this.s.currentBatchSize=0,this.s.currentBatchSizeBytes=0),e===o.BatchType.INSERT&&this.s.bulkResult.insertedIds.push({index:this.s.currentIndex,_id:t._id}),Array.isArray(t))throw new i.MongoInvalidArgumentError("Operation passed in cannot be an Array");return this.s.currentBatch.originalIndexes.push(this.s.currentIndex),this.s.currentBatch.operations.push(t),this.s.currentBatchSize+=1,this.s.currentBatchSizeBytes+=s+n,this.s.currentIndex+=1,this}}t.OrderedBulkOperation=s},30588:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.MIN_SECONDARY_WRITE_WIRE_VERSION=void 0,t.writableServerSelector=function(){return function(e,t){return c(e,t.filter((e=>e.isWritable)))}},t.sameServerSelector=function(e){return function(t,n){return e?n.filter((t=>t.address===e.address&&t.type!==o.ServerType.Unknown)):[]}},t.secondaryWritableServerSelector=function(e,n){return!n||!e||e&&e<t.MIN_SECONDARY_WRITE_WIRE_VERSION?m(i.ReadPreference.primary):m(n)},t.readPreferenceServerSelector=m;const r=n(17562),i=n(13700),o=n(89167),s=1e4,a=90;function u(e,t){const n=Object.keys(e),r=Object.keys(t);for(let i=0;i<n.length;++i){const o=n[i];if(-1===r.indexOf(o)||t[o]!==e[o])return!1}return!0}function c(e,t){const n=t.reduce(((e,t)=>Math.min(t.roundTripTime,e)),1/0),r=n+e.localThresholdMS;return t.reduce(((e,t)=>(t.roundTripTime<=r&&t.roundTripTime>=n&&e.push(t),e)),[])}function l(e){return e.type===o.ServerType.RSPrimary}function h(e){return e.type===o.ServerType.RSSecondary}function d(e){return e.type===o.ServerType.RSSecondary||e.type===o.ServerType.RSPrimary}function f(e){return e.type!==o.ServerType.Unknown}function p(e){return e.type===o.ServerType.LoadBalancer}function m(e){if(!e.isValid())throw new r.MongoInvalidArgumentError("Invalid read preference specified");return function(t,n,m=[]){const g=t.commonWireVersion;if(g&&e.minWireVersion&&e.minWireVersion>g)throw new r.MongoCompatibilityError(`Minimum wire version '${e.minWireVersion}' required, but found '${g}'`);if(t.type===o.TopologyType.LoadBalanced)return n.filter(p);if(t.type===o.TopologyType.Unknown)return[];if(t.type===o.TopologyType.Single)return c(t,n.filter(f));if(t.type===o.TopologyType.Sharded){const e=n.filter((e=>!m.includes(e)));return c(t,(e.length>0?e:m).filter(f))}const _=e.mode;if(_===i.ReadPreference.PRIMARY)return n.filter(l);if(_===i.ReadPreference.PRIMARY_PREFERRED){const e=n.filter(l);if(e.length)return e}const y=_===i.ReadPreference.NEAREST?d:h,v=c(t,function(e,t){if(null==e.tags||Array.isArray(e.tags)&&0===e.tags.length)return t;for(let n=0;n<e.tags.length;++n){const r=e.tags[n],i=t.reduce(((e,t)=>(u(r,t.tags)&&e.push(t),e)),[]);if(i.length)return i}return[]}(e,function(e,t,n){if(null==e.maxStalenessSeconds||e.maxStalenessSeconds<0)return n;const i=e.maxStalenessSeconds,u=(t.heartbeatFrequencyMS+s)/1e3;if(i<u)throw new r.MongoInvalidArgumentError(`Option "maxStalenessSeconds" must be at least ${u} seconds`);if(i<a)throw new r.MongoInvalidArgumentError(`Option "maxStalenessSeconds" must be at least ${a} seconds`);if(t.type===o.TopologyType.ReplicaSetWithPrimary){const r=Array.from(t.servers.values()).filter(l)[0];return n.reduce(((n,i)=>((i.lastUpdateTime-i.lastWriteDate-(r.lastUpdateTime-r.lastWriteDate)+t.heartbeatFrequencyMS)/1e3<=(e.maxStalenessSeconds??0)&&n.push(i),n)),[])}if(t.type===o.TopologyType.ReplicaSetNoPrimary){if(0===n.length)return n;const r=n.reduce(((e,t)=>t.lastWriteDate>e.lastWriteDate?t:e));return n.reduce(((n,i)=>((r.lastWriteDate-i.lastWriteDate+t.heartbeatFrequencyMS)/1e3<=(e.maxStalenessSeconds??0)&&n.push(i),n)),[])}return n}(e,t,n.filter(y))));return _===i.ReadPreference.SECONDARY_PREFERRED&&0===v.length?n.filter(l):v}}t.MIN_SECONDARY_WRITE_WIRE_VERSION=13},30770:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.formatSort=function(e,t){if(null!=e){if("string"==typeof e)return new Map([[e,i(t)]]);if("object"!=typeof e)throw new r.MongoInvalidArgumentError(`Invalid sort format: ${JSON.stringify(e)} Sort must be a valid object`);return o=e,Array.isArray(o)?e.length?function(e){return Array.isArray(e)&&Array.isArray(e[0])}(e)?function(e){const t=e.map((([e,t])=>[`${e}`,i(t)]));return new Map(t)}(e):function(e){if(Array.isArray(e)&&2===e.length)try{return i(e[1]),!0}catch{return!1}return!1}(e)?(s=e,new Map([[`${s[0]}`,i([s[1]])]])):function(e){const t=e.map((e=>[`${e}`,1]));return new Map(t)}(e):void 0:(n=e)instanceof Map&&n.size>0?function(e){const t=Array.from(e).map((([e,t])=>[`${e}`,i(t)]));return new Map(t)}(e):Object.keys(e).length?function(e){const t=Object.entries(e).map((([e,t])=>[`${e}`,i(t)]));return new Map(t)}(e):void 0;var n,o,s}};const r=n(17562);function i(e=1){const t=`${e}`.toLowerCase();if("object"==typeof(n=e)&&null!=n&&"$meta"in n&&"string"==typeof n.$meta)return e;var n;switch(t){case"ascending":case"asc":case"1":return 1;case"descending":case"desc":case"-1":return-1;default:throw new r.MongoInvalidArgumentError(`Invalid sort direction: ${JSON.stringify(e)}`)}}},31057:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.AuthProvider=t.AuthContext=void 0;const r=n(17562);t.AuthContext=class{constructor(e,t,n){this.reauthenticating=!1,this.connection=e,this.credentials=t,this.options=n}},t.AuthProvider=class{async prepare(e,t){return e}async reauth(e){if(e.reauthenticating)throw new r.MongoRuntimeError("Reauthentication already in progress.");try{e.reauthenticating=!0,await this.auth(e)}finally{e.reauthenticating=!1}}}},31480:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ValidateCollectionOperation=void 0;const r=n(75725),i=n(17562),o=n(78130);class s extends o.CommandOperation{constructor(e,t,n){super(e.s.db,n),this.SERVER_COMMAND_RESPONSE_TYPE=r.MongoDBResponse,this.options=n,this.collectionName=t}get commandName(){return"validate"}buildCommandDocument(e,t){return{validate:this.collectionName,...Object.fromEntries(Object.entries(this.options).filter((e=>"session"!==e[0])))}}handleOk(e){const t=super.handleOk(e);if(null!=t.result&&"string"!=typeof t.result)throw new i.MongoUnexpectedServerResponseError("Error with validation data");if(null!=t.result&&null!=t.result.match(/exception|corrupt/))throw new i.MongoUnexpectedServerResponseError(`Invalid collection ${this.collectionName}`);if(null!=t.valid&&!t.valid)throw new i.MongoUnexpectedServerResponseError(`Invalid collection ${this.collectionName}`);return e}}t.ValidateCollectionOperation=s},31790:(e,t,n)=>{function r(e){Symbol.asyncDispose&&Object.defineProperty(e,Symbol.asyncDispose,{value:async function(){await this.asyncDispose()},enumerable:!1,configurable:!0,writable:!0})}Object.defineProperty(t,"__esModule",{value:!0}),t.configureResourceManagement=r,t.configureExplicitResourceManagement=function(){const{MongoClient:e}=n(22220),{ClientSession:t}=n(14019),{AbstractCursor:i}=n(61066),{ChangeStream:o}=n(22345);r(e.prototype),r(t.prototype),r(i.prototype),r(o.prototype)}},32361:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ListIndexesCursor=void 0;const r=n(96357),i=n(22847),o=n(61066);class s extends o.AbstractCursor{constructor(e,t){super(e.client,e.s.namespace,t),this.parent=e,this.options=t}clone(){return new s(this.parent,{...this.options,...this.cursorOptions})}async _initialize(e){const t=new i.ListIndexesOperation(this.parent,{...this.cursorOptions,...this.options,session:e}),n=await(0,r.executeOperation)(this.parent.client,t,this.timeoutContext);return{server:t.server,session:e,response:n}}}t.ListIndexesCursor=s},32443:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CreateSearchIndexesOperation=void 0;const r=n(75725),i=n(35394);class o extends i.AbstractOperation{constructor(e,t){super(),this.SERVER_COMMAND_RESPONSE_TYPE=r.MongoDBResponse,this.collection=e,this.descriptions=t,this.ns=e.fullNamespace}get commandName(){return"createSearchIndexes"}buildCommand(e,t){return{createSearchIndexes:this.collection.fullNamespace.collection,indexes:this.descriptions}}handleOk(e){return super.handleOk(e).indexesCreated.map((e=>e.name))}buildOptions(e){return{session:this.session,timeoutContext:e}}}t.CreateSearchIndexesOperation=o},33104:(e,t,n)=>{var r=n(67787).Buffer;Object.defineProperty(t,"__esModule",{value:!0}),t.GridFSBucketReadStream=void 0;const i=n(93874),o=n(61066),s=n(17562),a=n(7799);class u extends i.Readable{constructor(e,t,n,r,i){super({emitClose:!0}),this.s={bytesToTrim:0,bytesToSkip:0,bytesRead:0,chunks:e,expected:0,files:t,filter:r,init:!1,expectedEnd:0,options:{start:0,end:0,...i},readPreference:n,timeoutContext:null!=i?.timeoutMS?new a.CSOTTimeoutContext({timeoutMS:i.timeoutMS,serverSelectionTimeoutMS:0}):void 0}}_read(){this.destroyed||function(e,t){if(e.s.file)return t();e.s.init||(function(e){const t={};e.s.readPreference&&(t.readPreference=e.s.readPreference),e.s.options&&e.s.options.sort&&(t.sort=e.s.options.sort),e.s.options&&e.s.options.skip&&(t.skip=e.s.options.skip);let n;try{n=e.s.timeoutContext?.getRemainingTimeMSOrThrow(`Download timed out after ${e.s.timeoutContext?.timeoutMS}ms`)}catch(t){return void(e.destroyed||e.destroy(t))}t.timeoutMS=n,e.s.files.findOne(e.s.filter,t).then((t=>{if(e.destroyed)return;if(!t){const t=`FileNotFound: file ${e.s.filter._id?e.s.filter._id.toString():e.s.filter.filename} was not found`,n=new s.MongoRuntimeError(t);return n.code="ENOENT",e.destroy(n)}if(t.length<=0)return void e.push(null);if(e.destroyed)return void e.destroy();try{e.s.bytesToSkip=function(e,t,n){if(n&&null!=n.start){if(n.start>t.length)throw new s.MongoInvalidArgumentError(`Stream start (${n.start}) must not be more than the length of the file (${t.length})`);if(n.start<0)throw new s.MongoInvalidArgumentError(`Stream start (${n.start}) must not be negative`);if(null!=n.end&&n.end<n.start)throw new s.MongoInvalidArgumentError(`Stream start (${n.start}) must not be greater than stream end (${n.end})`);return e.s.bytesRead=Math.floor(n.start/t.chunkSize)*t.chunkSize,e.s.expected=Math.floor(n.start/t.chunkSize),n.start-e.s.bytesRead}throw new s.MongoInvalidArgumentError("Start option must be defined")}(e,t,e.s.options)}catch(t){return e.destroy(t)}const n={files_id:t._id};if(e.s.options&&null!=e.s.options.start){const r=Math.floor(e.s.options.start/t.chunkSize);r>0&&(n.n={$gte:r})}let r;try{r=e.s.timeoutContext?.getRemainingTimeMSOrThrow(`Download timed out after ${e.s.timeoutContext?.timeoutMS}ms`)}catch(t){return e.destroy(t)}e.s.cursor=e.s.chunks.find(n,{timeoutMode:null!=e.s.options.timeoutMS?o.CursorTimeoutMode.LIFETIME:void 0,timeoutMS:r}).sort({n:1}),e.s.readPreference&&e.s.cursor.withReadPreference(e.s.readPreference),e.s.expectedEnd=Math.ceil(t.length/t.chunkSize),e.s.file=t;try{e.s.bytesToTrim=function(e,t,n,r){if(r&&null!=r.end){if(r.end>t.length)throw new s.MongoInvalidArgumentError(`Stream end (${r.end}) must not be more than the length of the file (${t.length})`);if(null==r.start||r.start<0)throw new s.MongoInvalidArgumentError(`Stream end (${r.end}) must not be negative`);const i=null!=r.start?Math.floor(r.start/t.chunkSize):0;return n.limit(Math.ceil(r.end/t.chunkSize)-i),e.s.expectedEnd=Math.ceil(r.end/t.chunkSize),Math.ceil(r.end/t.chunkSize)*t.chunkSize-r.end}throw new s.MongoInvalidArgumentError("End option must be defined")}(e,t,e.s.cursor,e.s.options)}catch(t){return e.destroy(t)}e.emit(u.FILE,t)}),(t=>{e.destroyed||e.destroy(t)}))}(e),e.s.init=!0),e.once("file",(()=>{t()}))}(this,(()=>function(e){if(e.destroyed)return;if(!e.s.cursor)return;if(!e.s.file)return;e.s.cursor.next().then((t=>{if(e.destroyed)return;if(!t)return e.push(null),void e.s.cursor?.close().then(void 0,(t=>e.destroy(t)));if(!e.s.file)return;const n=e.s.file.length-e.s.bytesRead,i=e.s.expected++,o=Math.min(e.s.file.chunkSize,n);if(t.n>i)return e.destroy(new s.MongoGridFSChunkError(`ChunkIsMissing: Got unexpected n: ${t.n}, expected: ${i}`));if(t.n<i)return e.destroy(new s.MongoGridFSChunkError(`ExtraChunk: Got unexpected n: ${t.n}, expected: ${i}`));let a=r.isBuffer(t.data)?t.data:t.data.buffer;if(a.byteLength!==o)return n<=0?e.destroy(new s.MongoGridFSChunkError(`ExtraChunk: Got unexpected n: ${t.n}, expected file length ${e.s.file.length} bytes but already read ${e.s.bytesRead} bytes`)):e.destroy(new s.MongoGridFSChunkError(`ChunkIsWrongSize: Got unexpected length: ${a.byteLength}, expected: ${o}`));if(e.s.bytesRead+=a.byteLength,0===a.byteLength)return e.push(null);let u=null,c=null;null!=e.s.bytesToSkip&&(u=e.s.bytesToSkip,e.s.bytesToSkip=0);const l=i===e.s.expectedEnd-1,h=e.s.options.end-e.s.bytesToSkip;l&&null!=e.s.bytesToTrim?c=e.s.file.chunkSize-e.s.bytesToTrim:e.s.options.end&&h<t.data.byteLength&&(c=h),null==u&&null==c||(a=a.slice(u||0,c||a.byteLength)),e.push(a)}),(t=>{e.destroyed||e.destroy(t)}))}(this)))}start(e=0){return c(this),this.s.options.start=e,this}end(e=0){return c(this),this.s.options.end=e,this}async abort(){this.push(null),this.destroy();const e=this.s.timeoutContext?.getRemainingTimeMSOrThrow();await(this.s.cursor?.close({timeoutMS:e}))}}function c(e){if(e.s.init)throw new s.MongoGridFSStreamError("Options cannot be changed after the stream is initialized")}t.GridFSBucketReadStream=u,u.FILE="file"},33168:function(e,t,n){var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),i=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&r(t,e,n);return i(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.toTypescriptTypeDefinition=t.schemaStats=t.SchemaAnalyzer=t.getSimplifiedSchema=t.getSchemaPaths=t.analyzeDocuments=t.parseSchema=void 0;const s=n(37057),a=n(75996);Object.defineProperty(t,"SchemaAnalyzer",{enumerable:!0,get:function(){return a.SchemaAnalyzer}});const u=n(79059),c=n(59942),l=n(61283),h=o(n(33787));t.schemaStats=h;const d=n(33859);async function f(e,t){return(await(0,a.getCompletedSchemaAnalyzer)(e,t)).getResult()}Object.defineProperty(t,"toTypescriptTypeDefinition",{enumerable:!0,get:function(){return d.toTypescriptTypeDefinition}}),t.analyzeDocuments=async function(e,t){const n=(await(0,a.getCompletedSchemaAnalyzer)(e,t)).getResult();return new s.InternalSchemaBasedAccessor(n,{internalToStandard:l.convertInternalToStandard,internalToMongoDB:c.convertInternalToMongodb,internalToExpanded:u.convertInternalToExpanded})},t.parseSchema=f,t.getSchemaPaths=async function(e){return(await(0,a.getCompletedSchemaAnalyzer)(e)).getSchemaPaths()},t.getSimplifiedSchema=async function(e){return(await(0,a.getCompletedSchemaAnalyzer)(e)).getSimplifiedSchema()},t.default=f},33433:function(e,t,n){!function(e,t){function r(e,t){if(!e)throw new Error(t||"Assertion failed")}function i(e,t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}function o(e,t,n){if(o.isBN(e))return e;this.negative=0,this.words=null,this.length=0,this.red=null,null!==e&&("le"!==t&&"be"!==t||(n=t,t=10),this._init(e||0,t||10,n||"be"))}var s;"object"==typeof e?e.exports=o:t.BN=o,o.BN=o,o.wordSize=26;try{s="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:n(67787).Buffer}catch(e){}function a(e,t){var n=e.charCodeAt(t);return n>=65&&n<=70?n-55:n>=97&&n<=102?n-87:n-48&15}function u(e,t,n){var r=a(e,n);return n-1>=t&&(r|=a(e,n-1)<<4),r}function c(e,t,n,r){for(var i=0,o=Math.min(e.length,n),s=t;s<o;s++){var a=e.charCodeAt(s)-48;i*=r,i+=a>=49?a-49+10:a>=17?a-17+10:a}return i}o.isBN=function(e){return e instanceof o||null!==e&&"object"==typeof e&&e.constructor.wordSize===o.wordSize&&Array.isArray(e.words)},o.max=function(e,t){return e.cmp(t)>0?e:t},o.min=function(e,t){return e.cmp(t)<0?e:t},o.prototype._init=function(e,t,n){if("number"==typeof e)return this._initNumber(e,t,n);if("object"==typeof e)return this._initArray(e,t,n);"hex"===t&&(t=16),r(t===(0|t)&&t>=2&&t<=36);var i=0;"-"===(e=e.toString().replace(/\s+/g,""))[0]&&(i++,this.negative=1),i<e.length&&(16===t?this._parseHex(e,i,n):(this._parseBase(e,t,i),"le"===n&&this._initArray(this.toArray(),t,n)))},o.prototype._initNumber=function(e,t,n){e<0&&(this.negative=1,e=-e),e<67108864?(this.words=[67108863&e],this.length=1):e<4503599627370496?(this.words=[67108863&e,e/67108864&67108863],this.length=2):(r(e<9007199254740992),this.words=[67108863&e,e/67108864&67108863,1],this.length=3),"le"===n&&this._initArray(this.toArray(),t,n)},o.prototype._initArray=function(e,t,n){if(r("number"==typeof e.length),e.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(e.length/3),this.words=new Array(this.length);for(var i=0;i<this.length;i++)this.words[i]=0;var o,s,a=0;if("be"===n)for(i=e.length-1,o=0;i>=0;i-=3)s=e[i]|e[i-1]<<8|e[i-2]<<16,this.words[o]|=s<<a&67108863,this.words[o+1]=s>>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);else if("le"===n)for(i=0,o=0;i<e.length;i+=3)s=e[i]|e[i+1]<<8|e[i+2]<<16,this.words[o]|=s<<a&67108863,this.words[o+1]=s>>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);return this.strip()},o.prototype._parseHex=function(e,t,n){this.length=Math.ceil((e.length-t)/6),this.words=new Array(this.length);for(var r=0;r<this.length;r++)this.words[r]=0;var i,o=0,s=0;if("be"===n)for(r=e.length-1;r>=t;r-=2)i=u(e,t,r)<<o,this.words[s]|=67108863&i,o>=18?(o-=18,s+=1,this.words[s]|=i>>>26):o+=8;else for(r=(e.length-t)%2==0?t+1:t;r<e.length;r+=2)i=u(e,t,r)<<o,this.words[s]|=67108863&i,o>=18?(o-=18,s+=1,this.words[s]|=i>>>26):o+=8;this.strip()},o.prototype._parseBase=function(e,t,n){this.words=[0],this.length=1;for(var r=0,i=1;i<=67108863;i*=t)r++;r--,i=i/t|0;for(var o=e.length-n,s=o%r,a=Math.min(o,o-s)+n,u=0,l=n;l<a;l+=r)u=c(e,l,l+r,t),this.imuln(i),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u);if(0!==s){var h=1;for(u=c(e,l,e.length,t),l=0;l<s;l++)h*=t;this.imuln(h),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u)}this.strip()},o.prototype.copy=function(e){e.words=new Array(this.length);for(var t=0;t<this.length;t++)e.words[t]=this.words[t];e.length=this.length,e.negative=this.negative,e.red=this.red},o.prototype.clone=function(){var e=new o(null);return this.copy(e),e},o.prototype._expand=function(e){for(;this.length<e;)this.words[this.length++]=0;return this},o.prototype.strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},o.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},o.prototype.inspect=function(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"};var l=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],h=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],d=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function f(e,t,n){n.negative=t.negative^e.negative;var r=e.length+t.length|0;n.length=r,r=r-1|0;var i=0|e.words[0],o=0|t.words[0],s=i*o,a=67108863&s,u=s/67108864|0;n.words[0]=a;for(var c=1;c<r;c++){for(var l=u>>>26,h=67108863&u,d=Math.min(c,t.length-1),f=Math.max(0,c-e.length+1);f<=d;f++){var p=c-f|0;l+=(s=(i=0|e.words[p])*(o=0|t.words[f])+h)/67108864|0,h=67108863&s}n.words[c]=0|h,u=0|l}return 0!==u?n.words[c]=0|u:n.length--,n.strip()}o.prototype.toString=function(e,t){var n;if(t=0|t||1,16===(e=e||10)||"hex"===e){n="";for(var i=0,o=0,s=0;s<this.length;s++){var a=this.words[s],u=(16777215&(a<<i|o)).toString(16);n=0!=(o=a>>>24-i&16777215)||s!==this.length-1?l[6-u.length]+u+n:u+n,(i+=2)>=26&&(i-=26,s--)}for(0!==o&&(n=o.toString(16)+n);n.length%t!=0;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}if(e===(0|e)&&e>=2&&e<=36){var c=h[e],f=d[e];n="";var p=this.clone();for(p.negative=0;!p.isZero();){var m=p.modn(f).toString(e);n=(p=p.idivn(f)).isZero()?m+n:l[c-m.length]+m+n}for(this.isZero()&&(n="0"+n);n.length%t!=0;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}r(!1,"Base should be between 2 and 36")},o.prototype.toNumber=function(){var e=this.words[0];return 2===this.length?e+=67108864*this.words[1]:3===this.length&&1===this.words[2]?e+=4503599627370496+67108864*this.words[1]:this.length>2&&r(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-e:e},o.prototype.toJSON=function(){return this.toString(16)},o.prototype.toBuffer=function(e,t){return r(void 0!==s),this.toArrayLike(s,e,t)},o.prototype.toArray=function(e,t){return this.toArrayLike(Array,e,t)},o.prototype.toArrayLike=function(e,t,n){var i=this.byteLength(),o=n||Math.max(1,i);r(i<=o,"byte array longer than desired length"),r(o>0,"Requested array length <= 0"),this.strip();var s,a,u="le"===t,c=new e(o),l=this.clone();if(u){for(a=0;!l.isZero();a++)s=l.andln(255),l.iushrn(8),c[a]=s;for(;a<o;a++)c[a]=0}else{for(a=0;a<o-i;a++)c[a]=0;for(a=0;!l.isZero();a++)s=l.andln(255),l.iushrn(8),c[o-a-1]=s}return c},Math.clz32?o.prototype._countBits=function(e){return 32-Math.clz32(e)}:o.prototype._countBits=function(e){var t=e,n=0;return t>=4096&&(n+=13,t>>>=13),t>=64&&(n+=7,t>>>=7),t>=8&&(n+=4,t>>>=4),t>=2&&(n+=2,t>>>=2),n+t},o.prototype._zeroBits=function(e){if(0===e)return 26;var t=e,n=0;return 8191&t||(n+=13,t>>>=13),127&t||(n+=7,t>>>=7),15&t||(n+=4,t>>>=4),3&t||(n+=2,t>>>=2),1&t||n++,n},o.prototype.bitLength=function(){var e=this.words[this.length-1],t=this._countBits(e);return 26*(this.length-1)+t},o.prototype.zeroBits=function(){if(this.isZero())return 0;for(var e=0,t=0;t<this.length;t++){var n=this._zeroBits(this.words[t]);if(e+=n,26!==n)break}return e},o.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},o.prototype.toTwos=function(e){return 0!==this.negative?this.abs().inotn(e).iaddn(1):this.clone()},o.prototype.fromTwos=function(e){return this.testn(e-1)?this.notn(e).iaddn(1).ineg():this.clone()},o.prototype.isNeg=function(){return 0!==this.negative},o.prototype.neg=function(){return this.clone().ineg()},o.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},o.prototype.iuor=function(e){for(;this.length<e.length;)this.words[this.length++]=0;for(var t=0;t<e.length;t++)this.words[t]=this.words[t]|e.words[t];return this.strip()},o.prototype.ior=function(e){return r(!(this.negative|e.negative)),this.iuor(e)},o.prototype.or=function(e){return this.length>e.length?this.clone().ior(e):e.clone().ior(this)},o.prototype.uor=function(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},o.prototype.iuand=function(e){var t;t=this.length>e.length?e:this;for(var n=0;n<t.length;n++)this.words[n]=this.words[n]&e.words[n];return this.length=t.length,this.strip()},o.prototype.iand=function(e){return r(!(this.negative|e.negative)),this.iuand(e)},o.prototype.and=function(e){return this.length>e.length?this.clone().iand(e):e.clone().iand(this)},o.prototype.uand=function(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},o.prototype.iuxor=function(e){var t,n;this.length>e.length?(t=this,n=e):(t=e,n=this);for(var r=0;r<n.length;r++)this.words[r]=t.words[r]^n.words[r];if(this!==t)for(;r<t.length;r++)this.words[r]=t.words[r];return this.length=t.length,this.strip()},o.prototype.ixor=function(e){return r(!(this.negative|e.negative)),this.iuxor(e)},o.prototype.xor=function(e){return this.length>e.length?this.clone().ixor(e):e.clone().ixor(this)},o.prototype.uxor=function(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},o.prototype.inotn=function(e){r("number"==typeof e&&e>=0);var t=0|Math.ceil(e/26),n=e%26;this._expand(t),n>0&&t--;for(var i=0;i<t;i++)this.words[i]=67108863&~this.words[i];return n>0&&(this.words[i]=~this.words[i]&67108863>>26-n),this.strip()},o.prototype.notn=function(e){return this.clone().inotn(e)},o.prototype.setn=function(e,t){r("number"==typeof e&&e>=0);var n=e/26|0,i=e%26;return this._expand(n+1),this.words[n]=t?this.words[n]|1<<i:this.words[n]&~(1<<i),this.strip()},o.prototype.iadd=function(e){var t,n,r;if(0!==this.negative&&0===e.negative)return this.negative=0,t=this.isub(e),this.negative^=1,this._normSign();if(0===this.negative&&0!==e.negative)return e.negative=0,t=this.isub(e),e.negative=1,t._normSign();this.length>e.length?(n=this,r=e):(n=e,r=this);for(var i=0,o=0;o<r.length;o++)t=(0|n.words[o])+(0|r.words[o])+i,this.words[o]=67108863&t,i=t>>>26;for(;0!==i&&o<n.length;o++)t=(0|n.words[o])+i,this.words[o]=67108863&t,i=t>>>26;if(this.length=n.length,0!==i)this.words[this.length]=i,this.length++;else if(n!==this)for(;o<n.length;o++)this.words[o]=n.words[o];return this},o.prototype.add=function(e){var t;return 0!==e.negative&&0===this.negative?(e.negative=0,t=this.sub(e),e.negative^=1,t):0===e.negative&&0!==this.negative?(this.negative=0,t=e.sub(this),this.negative=1,t):this.length>e.length?this.clone().iadd(e):e.clone().iadd(this)},o.prototype.isub=function(e){if(0!==e.negative){e.negative=0;var t=this.iadd(e);return e.negative=1,t._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(e),this.negative=1,this._normSign();var n,r,i=this.cmp(e);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(n=this,r=e):(n=e,r=this);for(var o=0,s=0;s<r.length;s++)o=(t=(0|n.words[s])-(0|r.words[s])+o)>>26,this.words[s]=67108863&t;for(;0!==o&&s<n.length;s++)o=(t=(0|n.words[s])+o)>>26,this.words[s]=67108863&t;if(0===o&&s<n.length&&n!==this)for(;s<n.length;s++)this.words[s]=n.words[s];return this.length=Math.max(this.length,s),n!==this&&(this.negative=1),this.strip()},o.prototype.sub=function(e){return this.clone().isub(e)};var p=function(e,t,n){var r,i,o,s=e.words,a=t.words,u=n.words,c=0,l=0|s[0],h=8191&l,d=l>>>13,f=0|s[1],p=8191&f,m=f>>>13,g=0|s[2],_=8191&g,y=g>>>13,v=0|s[3],E=8191&v,S=v>>>13,w=0|s[4],C=8191&w,O=w>>>13,b=0|s[5],M=8191&b,T=b>>>13,A=0|s[6],R=8191&A,N=A>>>13,I=0|s[7],x=8191&I,k=I>>>13,P=0|s[8],D=8191&P,$=P>>>13,L=0|s[9],B=8191&L,j=L>>>13,q=0|a[0],F=8191&q,z=q>>>13,U=0|a[1],V=8191&U,W=U>>>13,G=0|a[2],H=8191&G,K=G>>>13,Y=0|a[3],Q=8191&Y,J=Y>>>13,X=0|a[4],Z=8191&X,ee=X>>>13,te=0|a[5],ne=8191&te,re=te>>>13,ie=0|a[6],oe=8191&ie,se=ie>>>13,ae=0|a[7],ue=8191&ae,ce=ae>>>13,le=0|a[8],he=8191&le,de=le>>>13,fe=0|a[9],pe=8191&fe,me=fe>>>13;n.negative=e.negative^t.negative,n.length=19;var ge=(c+(r=Math.imul(h,F))|0)+((8191&(i=(i=Math.imul(h,z))+Math.imul(d,F)|0))<<13)|0;c=((o=Math.imul(d,z))+(i>>>13)|0)+(ge>>>26)|0,ge&=67108863,r=Math.imul(p,F),i=(i=Math.imul(p,z))+Math.imul(m,F)|0,o=Math.imul(m,z);var _e=(c+(r=r+Math.imul(h,V)|0)|0)+((8191&(i=(i=i+Math.imul(h,W)|0)+Math.imul(d,V)|0))<<13)|0;c=((o=o+Math.imul(d,W)|0)+(i>>>13)|0)+(_e>>>26)|0,_e&=67108863,r=Math.imul(_,F),i=(i=Math.imul(_,z))+Math.imul(y,F)|0,o=Math.imul(y,z),r=r+Math.imul(p,V)|0,i=(i=i+Math.imul(p,W)|0)+Math.imul(m,V)|0,o=o+Math.imul(m,W)|0;var ye=(c+(r=r+Math.imul(h,H)|0)|0)+((8191&(i=(i=i+Math.imul(h,K)|0)+Math.imul(d,H)|0))<<13)|0;c=((o=o+Math.imul(d,K)|0)+(i>>>13)|0)+(ye>>>26)|0,ye&=67108863,r=Math.imul(E,F),i=(i=Math.imul(E,z))+Math.imul(S,F)|0,o=Math.imul(S,z),r=r+Math.imul(_,V)|0,i=(i=i+Math.imul(_,W)|0)+Math.imul(y,V)|0,o=o+Math.imul(y,W)|0,r=r+Math.imul(p,H)|0,i=(i=i+Math.imul(p,K)|0)+Math.imul(m,H)|0,o=o+Math.imul(m,K)|0;var ve=(c+(r=r+Math.imul(h,Q)|0)|0)+((8191&(i=(i=i+Math.imul(h,J)|0)+Math.imul(d,Q)|0))<<13)|0;c=((o=o+Math.imul(d,J)|0)+(i>>>13)|0)+(ve>>>26)|0,ve&=67108863,r=Math.imul(C,F),i=(i=Math.imul(C,z))+Math.imul(O,F)|0,o=Math.imul(O,z),r=r+Math.imul(E,V)|0,i=(i=i+Math.imul(E,W)|0)+Math.imul(S,V)|0,o=o+Math.imul(S,W)|0,r=r+Math.imul(_,H)|0,i=(i=i+Math.imul(_,K)|0)+Math.imul(y,H)|0,o=o+Math.imul(y,K)|0,r=r+Math.imul(p,Q)|0,i=(i=i+Math.imul(p,J)|0)+Math.imul(m,Q)|0,o=o+Math.imul(m,J)|0;var Ee=(c+(r=r+Math.imul(h,Z)|0)|0)+((8191&(i=(i=i+Math.imul(h,ee)|0)+Math.imul(d,Z)|0))<<13)|0;c=((o=o+Math.imul(d,ee)|0)+(i>>>13)|0)+(Ee>>>26)|0,Ee&=67108863,r=Math.imul(M,F),i=(i=Math.imul(M,z))+Math.imul(T,F)|0,o=Math.imul(T,z),r=r+Math.imul(C,V)|0,i=(i=i+Math.imul(C,W)|0)+Math.imul(O,V)|0,o=o+Math.imul(O,W)|0,r=r+Math.imul(E,H)|0,i=(i=i+Math.imul(E,K)|0)+Math.imul(S,H)|0,o=o+Math.imul(S,K)|0,r=r+Math.imul(_,Q)|0,i=(i=i+Math.imul(_,J)|0)+Math.imul(y,Q)|0,o=o+Math.imul(y,J)|0,r=r+Math.imul(p,Z)|0,i=(i=i+Math.imul(p,ee)|0)+Math.imul(m,Z)|0,o=o+Math.imul(m,ee)|0;var Se=(c+(r=r+Math.imul(h,ne)|0)|0)+((8191&(i=(i=i+Math.imul(h,re)|0)+Math.imul(d,ne)|0))<<13)|0;c=((o=o+Math.imul(d,re)|0)+(i>>>13)|0)+(Se>>>26)|0,Se&=67108863,r=Math.imul(R,F),i=(i=Math.imul(R,z))+Math.imul(N,F)|0,o=Math.imul(N,z),r=r+Math.imul(M,V)|0,i=(i=i+Math.imul(M,W)|0)+Math.imul(T,V)|0,o=o+Math.imul(T,W)|0,r=r+Math.imul(C,H)|0,i=(i=i+Math.imul(C,K)|0)+Math.imul(O,H)|0,o=o+Math.imul(O,K)|0,r=r+Math.imul(E,Q)|0,i=(i=i+Math.imul(E,J)|0)+Math.imul(S,Q)|0,o=o+Math.imul(S,J)|0,r=r+Math.imul(_,Z)|0,i=(i=i+Math.imul(_,ee)|0)+Math.imul(y,Z)|0,o=o+Math.imul(y,ee)|0,r=r+Math.imul(p,ne)|0,i=(i=i+Math.imul(p,re)|0)+Math.imul(m,ne)|0,o=o+Math.imul(m,re)|0;var we=(c+(r=r+Math.imul(h,oe)|0)|0)+((8191&(i=(i=i+Math.imul(h,se)|0)+Math.imul(d,oe)|0))<<13)|0;c=((o=o+Math.imul(d,se)|0)+(i>>>13)|0)+(we>>>26)|0,we&=67108863,r=Math.imul(x,F),i=(i=Math.imul(x,z))+Math.imul(k,F)|0,o=Math.imul(k,z),r=r+Math.imul(R,V)|0,i=(i=i+Math.imul(R,W)|0)+Math.imul(N,V)|0,o=o+Math.imul(N,W)|0,r=r+Math.imul(M,H)|0,i=(i=i+Math.imul(M,K)|0)+Math.imul(T,H)|0,o=o+Math.imul(T,K)|0,r=r+Math.imul(C,Q)|0,i=(i=i+Math.imul(C,J)|0)+Math.imul(O,Q)|0,o=o+Math.imul(O,J)|0,r=r+Math.imul(E,Z)|0,i=(i=i+Math.imul(E,ee)|0)+Math.imul(S,Z)|0,o=o+Math.imul(S,ee)|0,r=r+Math.imul(_,ne)|0,i=(i=i+Math.imul(_,re)|0)+Math.imul(y,ne)|0,o=o+Math.imul(y,re)|0,r=r+Math.imul(p,oe)|0,i=(i=i+Math.imul(p,se)|0)+Math.imul(m,oe)|0,o=o+Math.imul(m,se)|0;var Ce=(c+(r=r+Math.imul(h,ue)|0)|0)+((8191&(i=(i=i+Math.imul(h,ce)|0)+Math.imul(d,ue)|0))<<13)|0;c=((o=o+Math.imul(d,ce)|0)+(i>>>13)|0)+(Ce>>>26)|0,Ce&=67108863,r=Math.imul(D,F),i=(i=Math.imul(D,z))+Math.imul($,F)|0,o=Math.imul($,z),r=r+Math.imul(x,V)|0,i=(i=i+Math.imul(x,W)|0)+Math.imul(k,V)|0,o=o+Math.imul(k,W)|0,r=r+Math.imul(R,H)|0,i=(i=i+Math.imul(R,K)|0)+Math.imul(N,H)|0,o=o+Math.imul(N,K)|0,r=r+Math.imul(M,Q)|0,i=(i=i+Math.imul(M,J)|0)+Math.imul(T,Q)|0,o=o+Math.imul(T,J)|0,r=r+Math.imul(C,Z)|0,i=(i=i+Math.imul(C,ee)|0)+Math.imul(O,Z)|0,o=o+Math.imul(O,ee)|0,r=r+Math.imul(E,ne)|0,i=(i=i+Math.imul(E,re)|0)+Math.imul(S,ne)|0,o=o+Math.imul(S,re)|0,r=r+Math.imul(_,oe)|0,i=(i=i+Math.imul(_,se)|0)+Math.imul(y,oe)|0,o=o+Math.imul(y,se)|0,r=r+Math.imul(p,ue)|0,i=(i=i+Math.imul(p,ce)|0)+Math.imul(m,ue)|0,o=o+Math.imul(m,ce)|0;var Oe=(c+(r=r+Math.imul(h,he)|0)|0)+((8191&(i=(i=i+Math.imul(h,de)|0)+Math.imul(d,he)|0))<<13)|0;c=((o=o+Math.imul(d,de)|0)+(i>>>13)|0)+(Oe>>>26)|0,Oe&=67108863,r=Math.imul(B,F),i=(i=Math.imul(B,z))+Math.imul(j,F)|0,o=Math.imul(j,z),r=r+Math.imul(D,V)|0,i=(i=i+Math.imul(D,W)|0)+Math.imul($,V)|0,o=o+Math.imul($,W)|0,r=r+Math.imul(x,H)|0,i=(i=i+Math.imul(x,K)|0)+Math.imul(k,H)|0,o=o+Math.imul(k,K)|0,r=r+Math.imul(R,Q)|0,i=(i=i+Math.imul(R,J)|0)+Math.imul(N,Q)|0,o=o+Math.imul(N,J)|0,r=r+Math.imul(M,Z)|0,i=(i=i+Math.imul(M,ee)|0)+Math.imul(T,Z)|0,o=o+Math.imul(T,ee)|0,r=r+Math.imul(C,ne)|0,i=(i=i+Math.imul(C,re)|0)+Math.imul(O,ne)|0,o=o+Math.imul(O,re)|0,r=r+Math.imul(E,oe)|0,i=(i=i+Math.imul(E,se)|0)+Math.imul(S,oe)|0,o=o+Math.imul(S,se)|0,r=r+Math.imul(_,ue)|0,i=(i=i+Math.imul(_,ce)|0)+Math.imul(y,ue)|0,o=o+Math.imul(y,ce)|0,r=r+Math.imul(p,he)|0,i=(i=i+Math.imul(p,de)|0)+Math.imul(m,he)|0,o=o+Math.imul(m,de)|0;var be=(c+(r=r+Math.imul(h,pe)|0)|0)+((8191&(i=(i=i+Math.imul(h,me)|0)+Math.imul(d,pe)|0))<<13)|0;c=((o=o+Math.imul(d,me)|0)+(i>>>13)|0)+(be>>>26)|0,be&=67108863,r=Math.imul(B,V),i=(i=Math.imul(B,W))+Math.imul(j,V)|0,o=Math.imul(j,W),r=r+Math.imul(D,H)|0,i=(i=i+Math.imul(D,K)|0)+Math.imul($,H)|0,o=o+Math.imul($,K)|0,r=r+Math.imul(x,Q)|0,i=(i=i+Math.imul(x,J)|0)+Math.imul(k,Q)|0,o=o+Math.imul(k,J)|0,r=r+Math.imul(R,Z)|0,i=(i=i+Math.imul(R,ee)|0)+Math.imul(N,Z)|0,o=o+Math.imul(N,ee)|0,r=r+Math.imul(M,ne)|0,i=(i=i+Math.imul(M,re)|0)+Math.imul(T,ne)|0,o=o+Math.imul(T,re)|0,r=r+Math.imul(C,oe)|0,i=(i=i+Math.imul(C,se)|0)+Math.imul(O,oe)|0,o=o+Math.imul(O,se)|0,r=r+Math.imul(E,ue)|0,i=(i=i+Math.imul(E,ce)|0)+Math.imul(S,ue)|0,o=o+Math.imul(S,ce)|0,r=r+Math.imul(_,he)|0,i=(i=i+Math.imul(_,de)|0)+Math.imul(y,he)|0,o=o+Math.imul(y,de)|0;var Me=(c+(r=r+Math.imul(p,pe)|0)|0)+((8191&(i=(i=i+Math.imul(p,me)|0)+Math.imul(m,pe)|0))<<13)|0;c=((o=o+Math.imul(m,me)|0)+(i>>>13)|0)+(Me>>>26)|0,Me&=67108863,r=Math.imul(B,H),i=(i=Math.imul(B,K))+Math.imul(j,H)|0,o=Math.imul(j,K),r=r+Math.imul(D,Q)|0,i=(i=i+Math.imul(D,J)|0)+Math.imul($,Q)|0,o=o+Math.imul($,J)|0,r=r+Math.imul(x,Z)|0,i=(i=i+Math.imul(x,ee)|0)+Math.imul(k,Z)|0,o=o+Math.imul(k,ee)|0,r=r+Math.imul(R,ne)|0,i=(i=i+Math.imul(R,re)|0)+Math.imul(N,ne)|0,o=o+Math.imul(N,re)|0,r=r+Math.imul(M,oe)|0,i=(i=i+Math.imul(M,se)|0)+Math.imul(T,oe)|0,o=o+Math.imul(T,se)|0,r=r+Math.imul(C,ue)|0,i=(i=i+Math.imul(C,ce)|0)+Math.imul(O,ue)|0,o=o+Math.imul(O,ce)|0,r=r+Math.imul(E,he)|0,i=(i=i+Math.imul(E,de)|0)+Math.imul(S,he)|0,o=o+Math.imul(S,de)|0;var Te=(c+(r=r+Math.imul(_,pe)|0)|0)+((8191&(i=(i=i+Math.imul(_,me)|0)+Math.imul(y,pe)|0))<<13)|0;c=((o=o+Math.imul(y,me)|0)+(i>>>13)|0)+(Te>>>26)|0,Te&=67108863,r=Math.imul(B,Q),i=(i=Math.imul(B,J))+Math.imul(j,Q)|0,o=Math.imul(j,J),r=r+Math.imul(D,Z)|0,i=(i=i+Math.imul(D,ee)|0)+Math.imul($,Z)|0,o=o+Math.imul($,ee)|0,r=r+Math.imul(x,ne)|0,i=(i=i+Math.imul(x,re)|0)+Math.imul(k,ne)|0,o=o+Math.imul(k,re)|0,r=r+Math.imul(R,oe)|0,i=(i=i+Math.imul(R,se)|0)+Math.imul(N,oe)|0,o=o+Math.imul(N,se)|0,r=r+Math.imul(M,ue)|0,i=(i=i+Math.imul(M,ce)|0)+Math.imul(T,ue)|0,o=o+Math.imul(T,ce)|0,r=r+Math.imul(C,he)|0,i=(i=i+Math.imul(C,de)|0)+Math.imul(O,he)|0,o=o+Math.imul(O,de)|0;var Ae=(c+(r=r+Math.imul(E,pe)|0)|0)+((8191&(i=(i=i+Math.imul(E,me)|0)+Math.imul(S,pe)|0))<<13)|0;c=((o=o+Math.imul(S,me)|0)+(i>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,r=Math.imul(B,Z),i=(i=Math.imul(B,ee))+Math.imul(j,Z)|0,o=Math.imul(j,ee),r=r+Math.imul(D,ne)|0,i=(i=i+Math.imul(D,re)|0)+Math.imul($,ne)|0,o=o+Math.imul($,re)|0,r=r+Math.imul(x,oe)|0,i=(i=i+Math.imul(x,se)|0)+Math.imul(k,oe)|0,o=o+Math.imul(k,se)|0,r=r+Math.imul(R,ue)|0,i=(i=i+Math.imul(R,ce)|0)+Math.imul(N,ue)|0,o=o+Math.imul(N,ce)|0,r=r+Math.imul(M,he)|0,i=(i=i+Math.imul(M,de)|0)+Math.imul(T,he)|0,o=o+Math.imul(T,de)|0;var Re=(c+(r=r+Math.imul(C,pe)|0)|0)+((8191&(i=(i=i+Math.imul(C,me)|0)+Math.imul(O,pe)|0))<<13)|0;c=((o=o+Math.imul(O,me)|0)+(i>>>13)|0)+(Re>>>26)|0,Re&=67108863,r=Math.imul(B,ne),i=(i=Math.imul(B,re))+Math.imul(j,ne)|0,o=Math.imul(j,re),r=r+Math.imul(D,oe)|0,i=(i=i+Math.imul(D,se)|0)+Math.imul($,oe)|0,o=o+Math.imul($,se)|0,r=r+Math.imul(x,ue)|0,i=(i=i+Math.imul(x,ce)|0)+Math.imul(k,ue)|0,o=o+Math.imul(k,ce)|0,r=r+Math.imul(R,he)|0,i=(i=i+Math.imul(R,de)|0)+Math.imul(N,he)|0,o=o+Math.imul(N,de)|0;var Ne=(c+(r=r+Math.imul(M,pe)|0)|0)+((8191&(i=(i=i+Math.imul(M,me)|0)+Math.imul(T,pe)|0))<<13)|0;c=((o=o+Math.imul(T,me)|0)+(i>>>13)|0)+(Ne>>>26)|0,Ne&=67108863,r=Math.imul(B,oe),i=(i=Math.imul(B,se))+Math.imul(j,oe)|0,o=Math.imul(j,se),r=r+Math.imul(D,ue)|0,i=(i=i+Math.imul(D,ce)|0)+Math.imul($,ue)|0,o=o+Math.imul($,ce)|0,r=r+Math.imul(x,he)|0,i=(i=i+Math.imul(x,de)|0)+Math.imul(k,he)|0,o=o+Math.imul(k,de)|0;var Ie=(c+(r=r+Math.imul(R,pe)|0)|0)+((8191&(i=(i=i+Math.imul(R,me)|0)+Math.imul(N,pe)|0))<<13)|0;c=((o=o+Math.imul(N,me)|0)+(i>>>13)|0)+(Ie>>>26)|0,Ie&=67108863,r=Math.imul(B,ue),i=(i=Math.imul(B,ce))+Math.imul(j,ue)|0,o=Math.imul(j,ce),r=r+Math.imul(D,he)|0,i=(i=i+Math.imul(D,de)|0)+Math.imul($,he)|0,o=o+Math.imul($,de)|0;var xe=(c+(r=r+Math.imul(x,pe)|0)|0)+((8191&(i=(i=i+Math.imul(x,me)|0)+Math.imul(k,pe)|0))<<13)|0;c=((o=o+Math.imul(k,me)|0)+(i>>>13)|0)+(xe>>>26)|0,xe&=67108863,r=Math.imul(B,he),i=(i=Math.imul(B,de))+Math.imul(j,he)|0,o=Math.imul(j,de);var ke=(c+(r=r+Math.imul(D,pe)|0)|0)+((8191&(i=(i=i+Math.imul(D,me)|0)+Math.imul($,pe)|0))<<13)|0;c=((o=o+Math.imul($,me)|0)+(i>>>13)|0)+(ke>>>26)|0,ke&=67108863;var Pe=(c+(r=Math.imul(B,pe))|0)+((8191&(i=(i=Math.imul(B,me))+Math.imul(j,pe)|0))<<13)|0;return c=((o=Math.imul(j,me))+(i>>>13)|0)+(Pe>>>26)|0,Pe&=67108863,u[0]=ge,u[1]=_e,u[2]=ye,u[3]=ve,u[4]=Ee,u[5]=Se,u[6]=we,u[7]=Ce,u[8]=Oe,u[9]=be,u[10]=Me,u[11]=Te,u[12]=Ae,u[13]=Re,u[14]=Ne,u[15]=Ie,u[16]=xe,u[17]=ke,u[18]=Pe,0!==c&&(u[19]=c,n.length++),n};function m(e,t,n){return(new g).mulp(e,t,n)}function g(e,t){this.x=e,this.y=t}Math.imul||(p=f),o.prototype.mulTo=function(e,t){var n,r=this.length+e.length;return n=10===this.length&&10===e.length?p(this,e,t):r<63?f(this,e,t):r<1024?function(e,t,n){n.negative=t.negative^e.negative,n.length=e.length+t.length;for(var r=0,i=0,o=0;o<n.length-1;o++){var s=i;i=0;for(var a=67108863&r,u=Math.min(o,t.length-1),c=Math.max(0,o-e.length+1);c<=u;c++){var l=o-c,h=(0|e.words[l])*(0|t.words[c]),d=67108863&h;a=67108863&(d=d+a|0),i+=(s=(s=s+(h/67108864|0)|0)+(d>>>26)|0)>>>26,s&=67108863}n.words[o]=a,r=s,s=i}return 0!==r?n.words[o]=r:n.length--,n.strip()}(this,e,t):m(this,e,t),n},g.prototype.makeRBT=function(e){for(var t=new Array(e),n=o.prototype._countBits(e)-1,r=0;r<e;r++)t[r]=this.revBin(r,n,e);return t},g.prototype.revBin=function(e,t,n){if(0===e||e===n-1)return e;for(var r=0,i=0;i<t;i++)r|=(1&e)<<t-i-1,e>>=1;return r},g.prototype.permute=function(e,t,n,r,i,o){for(var s=0;s<o;s++)r[s]=t[e[s]],i[s]=n[e[s]]},g.prototype.transform=function(e,t,n,r,i,o){this.permute(o,e,t,n,r,i);for(var s=1;s<i;s<<=1)for(var a=s<<1,u=Math.cos(2*Math.PI/a),c=Math.sin(2*Math.PI/a),l=0;l<i;l+=a)for(var h=u,d=c,f=0;f<s;f++){var p=n[l+f],m=r[l+f],g=n[l+f+s],_=r[l+f+s],y=h*g-d*_;_=h*_+d*g,g=y,n[l+f]=p+g,r[l+f]=m+_,n[l+f+s]=p-g,r[l+f+s]=m-_,f!==a&&(y=u*h-c*d,d=u*d+c*h,h=y)}},g.prototype.guessLen13b=function(e,t){var n=1|Math.max(t,e),r=1&n,i=0;for(n=n/2|0;n;n>>>=1)i++;return 1<<i+1+r},g.prototype.conjugate=function(e,t,n){if(!(n<=1))for(var r=0;r<n/2;r++){var i=e[r];e[r]=e[n-r-1],e[n-r-1]=i,i=t[r],t[r]=-t[n-r-1],t[n-r-1]=-i}},g.prototype.normalize13b=function(e,t){for(var n=0,r=0;r<t/2;r++){var i=8192*Math.round(e[2*r+1]/t)+Math.round(e[2*r]/t)+n;e[r]=67108863&i,n=i<67108864?0:i/67108864|0}return e},g.prototype.convert13b=function(e,t,n,i){for(var o=0,s=0;s<t;s++)o+=0|e[s],n[2*s]=8191&o,o>>>=13,n[2*s+1]=8191&o,o>>>=13;for(s=2*t;s<i;++s)n[s]=0;r(0===o),r(!(-8192&o))},g.prototype.stub=function(e){for(var t=new Array(e),n=0;n<e;n++)t[n]=0;return t},g.prototype.mulp=function(e,t,n){var r=2*this.guessLen13b(e.length,t.length),i=this.makeRBT(r),o=this.stub(r),s=new Array(r),a=new Array(r),u=new Array(r),c=new Array(r),l=new Array(r),h=new Array(r),d=n.words;d.length=r,this.convert13b(e.words,e.length,s,r),this.convert13b(t.words,t.length,c,r),this.transform(s,o,a,u,r,i),this.transform(c,o,l,h,r,i);for(var f=0;f<r;f++){var p=a[f]*l[f]-u[f]*h[f];u[f]=a[f]*h[f]+u[f]*l[f],a[f]=p}return this.conjugate(a,u,r),this.transform(a,u,d,o,r,i),this.conjugate(d,o,r),this.normalize13b(d,r),n.negative=e.negative^t.negative,n.length=e.length+t.length,n.strip()},o.prototype.mul=function(e){var t=new o(null);return t.words=new Array(this.length+e.length),this.mulTo(e,t)},o.prototype.mulf=function(e){var t=new o(null);return t.words=new Array(this.length+e.length),m(this,e,t)},o.prototype.imul=function(e){return this.clone().mulTo(e,this)},o.prototype.imuln=function(e){r("number"==typeof e),r(e<67108864);for(var t=0,n=0;n<this.length;n++){var i=(0|this.words[n])*e,o=(67108863&i)+(67108863&t);t>>=26,t+=i/67108864|0,t+=o>>>26,this.words[n]=67108863&o}return 0!==t&&(this.words[n]=t,this.length++),this},o.prototype.muln=function(e){return this.clone().imuln(e)},o.prototype.sqr=function(){return this.mul(this)},o.prototype.isqr=function(){return this.imul(this.clone())},o.prototype.pow=function(e){var t=function(e){for(var t=new Array(e.bitLength()),n=0;n<t.length;n++){var r=n/26|0,i=n%26;t[n]=(e.words[r]&1<<i)>>>i}return t}(e);if(0===t.length)return new o(1);for(var n=this,r=0;r<t.length&&0===t[r];r++,n=n.sqr());if(++r<t.length)for(var i=n.sqr();r<t.length;r++,i=i.sqr())0!==t[r]&&(n=n.mul(i));return n},o.prototype.iushln=function(e){r("number"==typeof e&&e>=0);var t,n=e%26,i=(e-n)/26,o=67108863>>>26-n<<26-n;if(0!==n){var s=0;for(t=0;t<this.length;t++){var a=this.words[t]&o,u=(0|this.words[t])-a<<n;this.words[t]=u|s,s=a>>>26-n}s&&(this.words[t]=s,this.length++)}if(0!==i){for(t=this.length-1;t>=0;t--)this.words[t+i]=this.words[t];for(t=0;t<i;t++)this.words[t]=0;this.length+=i}return this.strip()},o.prototype.ishln=function(e){return r(0===this.negative),this.iushln(e)},o.prototype.iushrn=function(e,t,n){var i;r("number"==typeof e&&e>=0),i=t?(t-t%26)/26:0;var o=e%26,s=Math.min((e-o)/26,this.length),a=67108863^67108863>>>o<<o,u=n;if(i-=s,i=Math.max(0,i),u){for(var c=0;c<s;c++)u.words[c]=this.words[c];u.length=s}if(0===s);else if(this.length>s)for(this.length-=s,c=0;c<this.length;c++)this.words[c]=this.words[c+s];else this.words[0]=0,this.length=1;var l=0;for(c=this.length-1;c>=0&&(0!==l||c>=i);c--){var h=0|this.words[c];this.words[c]=l<<26-o|h>>>o,l=h&a}return u&&0!==l&&(u.words[u.length++]=l),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},o.prototype.ishrn=function(e,t,n){return r(0===this.negative),this.iushrn(e,t,n)},o.prototype.shln=function(e){return this.clone().ishln(e)},o.prototype.ushln=function(e){return this.clone().iushln(e)},o.prototype.shrn=function(e){return this.clone().ishrn(e)},o.prototype.ushrn=function(e){return this.clone().iushrn(e)},o.prototype.testn=function(e){r("number"==typeof e&&e>=0);var t=e%26,n=(e-t)/26,i=1<<t;return!(this.length<=n||!(this.words[n]&i))},o.prototype.imaskn=function(e){r("number"==typeof e&&e>=0);var t=e%26,n=(e-t)/26;if(r(0===this.negative,"imaskn works only with positive numbers"),this.length<=n)return this;if(0!==t&&n++,this.length=Math.min(n,this.length),0!==t){var i=67108863^67108863>>>t<<t;this.words[this.length-1]&=i}return this.strip()},o.prototype.maskn=function(e){return this.clone().imaskn(e)},o.prototype.iaddn=function(e){return r("number"==typeof e),r(e<67108864),e<0?this.isubn(-e):0!==this.negative?1===this.length&&(0|this.words[0])<e?(this.words[0]=e-(0|this.words[0]),this.negative=0,this):(this.negative=0,this.isubn(e),this.negative=1,this):this._iaddn(e)},o.prototype._iaddn=function(e){this.words[0]+=e;for(var t=0;t<this.length&&this.words[t]>=67108864;t++)this.words[t]-=67108864,t===this.length-1?this.words[t+1]=1:this.words[t+1]++;return this.length=Math.max(this.length,t+1),this},o.prototype.isubn=function(e){if(r("number"==typeof e),r(e<67108864),e<0)return this.iaddn(-e);if(0!==this.negative)return this.negative=0,this.iaddn(e),this.negative=1,this;if(this.words[0]-=e,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var t=0;t<this.length&&this.words[t]<0;t++)this.words[t]+=67108864,this.words[t+1]-=1;return this.strip()},o.prototype.addn=function(e){return this.clone().iaddn(e)},o.prototype.subn=function(e){return this.clone().isubn(e)},o.prototype.iabs=function(){return this.negative=0,this},o.prototype.abs=function(){return this.clone().iabs()},o.prototype._ishlnsubmul=function(e,t,n){var i,o,s=e.length+n;this._expand(s);var a=0;for(i=0;i<e.length;i++){o=(0|this.words[i+n])+a;var u=(0|e.words[i])*t;a=((o-=67108863&u)>>26)-(u/67108864|0),this.words[i+n]=67108863&o}for(;i<this.length-n;i++)a=(o=(0|this.words[i+n])+a)>>26,this.words[i+n]=67108863&o;if(0===a)return this.strip();for(r(-1===a),a=0,i=0;i<this.length;i++)a=(o=-(0|this.words[i])+a)>>26,this.words[i]=67108863&o;return this.negative=1,this.strip()},o.prototype._wordDiv=function(e,t){var n=(this.length,e.length),r=this.clone(),i=e,s=0|i.words[i.length-1];0!=(n=26-this._countBits(s))&&(i=i.ushln(n),r.iushln(n),s=0|i.words[i.length-1]);var a,u=r.length-i.length;if("mod"!==t){(a=new o(null)).length=u+1,a.words=new Array(a.length);for(var c=0;c<a.length;c++)a.words[c]=0}var l=r.clone()._ishlnsubmul(i,1,u);0===l.negative&&(r=l,a&&(a.words[u]=1));for(var h=u-1;h>=0;h--){var d=67108864*(0|r.words[i.length+h])+(0|r.words[i.length+h-1]);for(d=Math.min(d/s|0,67108863),r._ishlnsubmul(i,d,h);0!==r.negative;)d--,r.negative=0,r._ishlnsubmul(i,1,h),r.isZero()||(r.negative^=1);a&&(a.words[h]=d)}return a&&a.strip(),r.strip(),"div"!==t&&0!==n&&r.iushrn(n),{div:a||null,mod:r}},o.prototype.divmod=function(e,t,n){return r(!e.isZero()),this.isZero()?{div:new o(0),mod:new o(0)}:0!==this.negative&&0===e.negative?(a=this.neg().divmod(e,t),"mod"!==t&&(i=a.div.neg()),"div"!==t&&(s=a.mod.neg(),n&&0!==s.negative&&s.iadd(e)),{div:i,mod:s}):0===this.negative&&0!==e.negative?(a=this.divmod(e.neg(),t),"mod"!==t&&(i=a.div.neg()),{div:i,mod:a.mod}):this.negative&e.negative?(a=this.neg().divmod(e.neg(),t),"div"!==t&&(s=a.mod.neg(),n&&0!==s.negative&&s.isub(e)),{div:a.div,mod:s}):e.length>this.length||this.cmp(e)<0?{div:new o(0),mod:this}:1===e.length?"div"===t?{div:this.divn(e.words[0]),mod:null}:"mod"===t?{div:null,mod:new o(this.modn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new o(this.modn(e.words[0]))}:this._wordDiv(e,t);var i,s,a},o.prototype.div=function(e){return this.divmod(e,"div",!1).div},o.prototype.mod=function(e){return this.divmod(e,"mod",!1).mod},o.prototype.umod=function(e){return this.divmod(e,"mod",!0).mod},o.prototype.divRound=function(e){var t=this.divmod(e);if(t.mod.isZero())return t.div;var n=0!==t.div.negative?t.mod.isub(e):t.mod,r=e.ushrn(1),i=e.andln(1),o=n.cmp(r);return o<0||1===i&&0===o?t.div:0!==t.div.negative?t.div.isubn(1):t.div.iaddn(1)},o.prototype.modn=function(e){r(e<=67108863);for(var t=(1<<26)%e,n=0,i=this.length-1;i>=0;i--)n=(t*n+(0|this.words[i]))%e;return n},o.prototype.idivn=function(e){r(e<=67108863);for(var t=0,n=this.length-1;n>=0;n--){var i=(0|this.words[n])+67108864*t;this.words[n]=i/e|0,t=i%e}return this.strip()},o.prototype.divn=function(e){return this.clone().idivn(e)},o.prototype.egcd=function(e){r(0===e.negative),r(!e.isZero());var t=this,n=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var i=new o(1),s=new o(0),a=new o(0),u=new o(1),c=0;t.isEven()&&n.isEven();)t.iushrn(1),n.iushrn(1),++c;for(var l=n.clone(),h=t.clone();!t.isZero();){for(var d=0,f=1;!(t.words[0]&f)&&d<26;++d,f<<=1);if(d>0)for(t.iushrn(d);d-- >0;)(i.isOdd()||s.isOdd())&&(i.iadd(l),s.isub(h)),i.iushrn(1),s.iushrn(1);for(var p=0,m=1;!(n.words[0]&m)&&p<26;++p,m<<=1);if(p>0)for(n.iushrn(p);p-- >0;)(a.isOdd()||u.isOdd())&&(a.iadd(l),u.isub(h)),a.iushrn(1),u.iushrn(1);t.cmp(n)>=0?(t.isub(n),i.isub(a),s.isub(u)):(n.isub(t),a.isub(i),u.isub(s))}return{a,b:u,gcd:n.iushln(c)}},o.prototype._invmp=function(e){r(0===e.negative),r(!e.isZero());var t=this,n=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var i,s=new o(1),a=new o(0),u=n.clone();t.cmpn(1)>0&&n.cmpn(1)>0;){for(var c=0,l=1;!(t.words[0]&l)&&c<26;++c,l<<=1);if(c>0)for(t.iushrn(c);c-- >0;)s.isOdd()&&s.iadd(u),s.iushrn(1);for(var h=0,d=1;!(n.words[0]&d)&&h<26;++h,d<<=1);if(h>0)for(n.iushrn(h);h-- >0;)a.isOdd()&&a.iadd(u),a.iushrn(1);t.cmp(n)>=0?(t.isub(n),s.isub(a)):(n.isub(t),a.isub(s))}return(i=0===t.cmpn(1)?s:a).cmpn(0)<0&&i.iadd(e),i},o.prototype.gcd=function(e){if(this.isZero())return e.abs();if(e.isZero())return this.abs();var t=this.clone(),n=e.clone();t.negative=0,n.negative=0;for(var r=0;t.isEven()&&n.isEven();r++)t.iushrn(1),n.iushrn(1);for(;;){for(;t.isEven();)t.iushrn(1);for(;n.isEven();)n.iushrn(1);var i=t.cmp(n);if(i<0){var o=t;t=n,n=o}else if(0===i||0===n.cmpn(1))break;t.isub(n)}return n.iushln(r)},o.prototype.invm=function(e){return this.egcd(e).a.umod(e)},o.prototype.isEven=function(){return!(1&this.words[0])},o.prototype.isOdd=function(){return!(1&~this.words[0])},o.prototype.andln=function(e){return this.words[0]&e},o.prototype.bincn=function(e){r("number"==typeof e);var t=e%26,n=(e-t)/26,i=1<<t;if(this.length<=n)return this._expand(n+1),this.words[n]|=i,this;for(var o=i,s=n;0!==o&&s<this.length;s++){var a=0|this.words[s];o=(a+=o)>>>26,a&=67108863,this.words[s]=a}return 0!==o&&(this.words[s]=o,this.length++),this},o.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},o.prototype.cmpn=function(e){var t,n=e<0;if(0!==this.negative&&!n)return-1;if(0===this.negative&&n)return 1;if(this.strip(),this.length>1)t=1;else{n&&(e=-e),r(e<=67108863,"Number is too big");var i=0|this.words[0];t=i===e?0:i<e?-1:1}return 0!==this.negative?0|-t:t},o.prototype.cmp=function(e){if(0!==this.negative&&0===e.negative)return-1;if(0===this.negative&&0!==e.negative)return 1;var t=this.ucmp(e);return 0!==this.negative?0|-t:t},o.prototype.ucmp=function(e){if(this.length>e.length)return 1;if(this.length<e.length)return-1;for(var t=0,n=this.length-1;n>=0;n--){var r=0|this.words[n],i=0|e.words[n];if(r!==i){r<i?t=-1:r>i&&(t=1);break}}return t},o.prototype.gtn=function(e){return 1===this.cmpn(e)},o.prototype.gt=function(e){return 1===this.cmp(e)},o.prototype.gten=function(e){return this.cmpn(e)>=0},o.prototype.gte=function(e){return this.cmp(e)>=0},o.prototype.ltn=function(e){return-1===this.cmpn(e)},o.prototype.lt=function(e){return-1===this.cmp(e)},o.prototype.lten=function(e){return this.cmpn(e)<=0},o.prototype.lte=function(e){return this.cmp(e)<=0},o.prototype.eqn=function(e){return 0===this.cmpn(e)},o.prototype.eq=function(e){return 0===this.cmp(e)},o.red=function(e){return new C(e)},o.prototype.toRed=function(e){return r(!this.red,"Already a number in reduction context"),r(0===this.negative,"red works only with positives"),e.convertTo(this)._forceRed(e)},o.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},o.prototype._forceRed=function(e){return this.red=e,this},o.prototype.forceRed=function(e){return r(!this.red,"Already a number in reduction context"),this._forceRed(e)},o.prototype.redAdd=function(e){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},o.prototype.redIAdd=function(e){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},o.prototype.redSub=function(e){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},o.prototype.redISub=function(e){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},o.prototype.redShl=function(e){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},o.prototype.redMul=function(e){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},o.prototype.redIMul=function(e){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},o.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},o.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},o.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},o.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},o.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},o.prototype.redPow=function(e){return r(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var _={k256:null,p224:null,p192:null,p25519:null};function y(e,t){this.name=e,this.p=new o(t,16),this.n=this.p.bitLength(),this.k=new o(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function v(){y.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function E(){y.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function S(){y.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function w(){y.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function C(e){if("string"==typeof e){var t=o._prime(e);this.m=t.p,this.prime=t}else r(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function O(e){C.call(this,e),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new o(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}y.prototype._tmp=function(){var e=new o(null);return e.words=new Array(Math.ceil(this.n/13)),e},y.prototype.ireduce=function(e){var t,n=e;do{this.split(n,this.tmp),t=(n=(n=this.imulK(n)).iadd(this.tmp)).bitLength()}while(t>this.n);var r=t<this.n?-1:n.ucmp(this.p);return 0===r?(n.words[0]=0,n.length=1):r>0?n.isub(this.p):void 0!==n.strip?n.strip():n._strip(),n},y.prototype.split=function(e,t){e.iushrn(this.n,0,t)},y.prototype.imulK=function(e){return e.imul(this.k)},i(v,y),v.prototype.split=function(e,t){for(var n=4194303,r=Math.min(e.length,9),i=0;i<r;i++)t.words[i]=e.words[i];if(t.length=r,e.length<=9)return e.words[0]=0,void(e.length=1);var o=e.words[9];for(t.words[t.length++]=o&n,i=10;i<e.length;i++){var s=0|e.words[i];e.words[i-10]=(s&n)<<4|o>>>22,o=s}o>>>=22,e.words[i-10]=o,0===o&&e.length>10?e.length-=10:e.length-=9},v.prototype.imulK=function(e){e.words[e.length]=0,e.words[e.length+1]=0,e.length+=2;for(var t=0,n=0;n<e.length;n++){var r=0|e.words[n];t+=977*r,e.words[n]=67108863&t,t=64*r+(t/67108864|0)}return 0===e.words[e.length-1]&&(e.length--,0===e.words[e.length-1]&&e.length--),e},i(E,y),i(S,y),i(w,y),w.prototype.imulK=function(e){for(var t=0,n=0;n<e.length;n++){var r=19*(0|e.words[n])+t,i=67108863&r;r>>>=26,e.words[n]=i,t=r}return 0!==t&&(e.words[e.length++]=t),e},o._prime=function(e){if(_[e])return _[e];var t;if("k256"===e)t=new v;else if("p224"===e)t=new E;else if("p192"===e)t=new S;else{if("p25519"!==e)throw new Error("Unknown prime "+e);t=new w}return _[e]=t,t},C.prototype._verify1=function(e){r(0===e.negative,"red works only with positives"),r(e.red,"red works only with red numbers")},C.prototype._verify2=function(e,t){r(!(e.negative|t.negative),"red works only with positives"),r(e.red&&e.red===t.red,"red works only with red numbers")},C.prototype.imod=function(e){return this.prime?this.prime.ireduce(e)._forceRed(this):e.umod(this.m)._forceRed(this)},C.prototype.neg=function(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},C.prototype.add=function(e,t){this._verify2(e,t);var n=e.add(t);return n.cmp(this.m)>=0&&n.isub(this.m),n._forceRed(this)},C.prototype.iadd=function(e,t){this._verify2(e,t);var n=e.iadd(t);return n.cmp(this.m)>=0&&n.isub(this.m),n},C.prototype.sub=function(e,t){this._verify2(e,t);var n=e.sub(t);return n.cmpn(0)<0&&n.iadd(this.m),n._forceRed(this)},C.prototype.isub=function(e,t){this._verify2(e,t);var n=e.isub(t);return n.cmpn(0)<0&&n.iadd(this.m),n},C.prototype.shl=function(e,t){return this._verify1(e),this.imod(e.ushln(t))},C.prototype.imul=function(e,t){return this._verify2(e,t),this.imod(e.imul(t))},C.prototype.mul=function(e,t){return this._verify2(e,t),this.imod(e.mul(t))},C.prototype.isqr=function(e){return this.imul(e,e.clone())},C.prototype.sqr=function(e){return this.mul(e,e)},C.prototype.sqrt=function(e){if(e.isZero())return e.clone();var t=this.m.andln(3);if(r(t%2==1),3===t){var n=this.m.add(new o(1)).iushrn(2);return this.pow(e,n)}for(var i=this.m.subn(1),s=0;!i.isZero()&&0===i.andln(1);)s++,i.iushrn(1);r(!i.isZero());var a=new o(1).toRed(this),u=a.redNeg(),c=this.m.subn(1).iushrn(1),l=this.m.bitLength();for(l=new o(2*l*l).toRed(this);0!==this.pow(l,c).cmp(u);)l.redIAdd(u);for(var h=this.pow(l,i),d=this.pow(e,i.addn(1).iushrn(1)),f=this.pow(e,i),p=s;0!==f.cmp(a);){for(var m=f,g=0;0!==m.cmp(a);g++)m=m.redSqr();r(g<p);var _=this.pow(h,new o(1).iushln(p-g-1));d=d.redMul(_),h=_.redSqr(),f=f.redMul(h),p=g}return d},C.prototype.invm=function(e){var t=e._invmp(this.m);return 0!==t.negative?(t.negative=0,this.imod(t).redNeg()):this.imod(t)},C.prototype.pow=function(e,t){if(t.isZero())return new o(1).toRed(this);if(0===t.cmpn(1))return e.clone();var n=new Array(16);n[0]=new o(1).toRed(this),n[1]=e;for(var r=2;r<n.length;r++)n[r]=this.mul(n[r-1],e);var i=n[0],s=0,a=0,u=t.bitLength()%26;for(0===u&&(u=26),r=t.length-1;r>=0;r--){for(var c=t.words[r],l=u-1;l>=0;l--){var h=c>>l&1;i!==n[0]&&(i=this.sqr(i)),0!==h||0!==s?(s<<=1,s|=h,(4==++a||0===r&&0===l)&&(i=this.mul(i,n[s]),a=0,s=0)):a=0}u=26}return i},C.prototype.convertTo=function(e){var t=e.umod(this.m);return t===e?t.clone():t},C.prototype.convertFrom=function(e){var t=e.clone();return t.red=null,t},o.mont=function(e){return new O(e)},i(O,C),O.prototype.convertTo=function(e){return this.imod(e.ushln(this.shift))},O.prototype.convertFrom=function(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},O.prototype.imul=function(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var n=e.imul(t),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=n.isub(r).iushrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},O.prototype.mul=function(e,t){if(e.isZero()||t.isZero())return new o(0)._forceRed(this);var n=e.mul(t),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=n.isub(r).iushrn(this.shift),s=i;return i.cmp(this.m)>=0?s=i.isub(this.m):i.cmpn(0)<0&&(s=i.iadd(this.m)),s._forceRed(this)},O.prototype.invm=function(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(e=n.nmd(e),this)},33787:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.default={width:function e(t){var n;let r=0;return t?(void 0===t.fields||(r+=t.fields.length,r+=t.fields.map((t=>e(t.types.find((e=>"Document"===e.name))))).reduce(((e,t)=>e+t||0),0),r+=null!==(n=t.fields.map((t=>{const n=t.types.find((e=>"Array"===e.name));if(n)return e(n.types.find((e=>"Document"===e.name)))})).reduce(((e,t)=>(null!=e?e:0)+(null!=t?t:0)||0),0))&&void 0!==n?n:0),r):r},depth:function e(t){if(!t)return 0;let n=0;return void 0!==t.fields&&t.fields.length>0&&(n=1+Math.max(Math.max(...t.fields.map((t=>e(t.types.find((e=>"Document"===e.name)))))),Math.max(...t.fields.map((t=>{const n=t.types.find((e=>"Array"===e.name));return n?e(n.types.find((e=>"Document"===e.name))):0}))))),n},branch:function e(t){const n=[];let r;return t?(void 0!==t.fields&&t.fields.length>0&&(n.push(t.fields.length),r=t.fields.map((function(t){return e(t.types.find((e=>"Document"===e.name)))})),n.push(...r.flat(1/0)),r=t.fields.map((function(t){const n=t.types.find((e=>"Array"===e.name));return n?e(n.types.find((e=>"Document"===e.name))):[]})),n.push(...r.flat(1/0))),n.sort().reverse()):n}}},33859:(e,t)=>{function n(e){return e.bsonType||e.type}function r(e,t){if(null==e)throw new Error(t)}function i(e){const t=n(e),r=(Array.isArray(t)?t:[null!=t?t:"any"]).map((e=>function(e){switch(e){case"string":return"string";case"number":case"integer":return"number";case"boolean":case"bool":return"boolean";case"null":return"null";case"double":return["bson.Double","number"];case"binData":return"bson.Binary";case"objectId":return"bson.ObjectId";case"date":return"bson.Date";case"regex":return"bson.BSONRegExp";case"symbol":return"bson.BSONSymbol";case"javascript":case"javascriptWithScope":return"bson.Code";case"int":return["bson.Int32","number"];case"timestamp":return"bson.Timestamp";case"long":return["bson.Long","number"];case"decimal":return"bson.Decimal128";case"minKey":return"bson.MinKey";case"maxKey":return"bson.MaxKey";case"dbPointer":return"bson.DBPointer";case"undefined":return"undefined";default:return"any"}}(e))).flat();return new Set(r.flat())}function o(e){const t=[];for(let n=0;n<e;n++)t.push(" ");return t.join("")}function s(e,t){return`{\n${Object.entries(e).map((([e,a])=>{switch(n(a)){case"array":return r(a.items,"schema.items must be defined"),`${o(t)}${e}?: ${u=[...i(a.items)],1===u.length?`${u[0]}[]`:`${u.join(" | ")})[]`}`;case"object":return r(a.properties,"schema.properties must be defined"),`${o(t)}${e}?: ${s(a.properties,t+1)}`;default:return`${o(t)}${e}?: ${[...i(a)].join(" | ")}`}var u})).join(";\n")};\n${o(t-1)}}`}Object.defineProperty(t,"__esModule",{value:!0}),t.toTypescriptTypeDefinition=void 0,t.toTypescriptTypeDefinition=function(e){return r(e.properties,"schema.properties must be defined"),s(e.properties,1)}},34080:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ClientBulkWriteOperation=void 0;const r=n(75725),i=n(145),o=n(78130),s=n(35394);class a extends o.CommandOperation{get commandName(){return"bulkWrite"}constructor(e,t){super(void 0,t),this.SERVER_COMMAND_RESPONSE_TYPE=r.ClientBulkWriteCursorResponse,this.commandBuilder=e,this.options=t,this.ns=new i.MongoDBNamespace("admin","$cmd")}resetBatch(){return this.commandBuilder.resetBatch()}get canRetryWrite(){return this.commandBuilder.isBatchRetryable}handleOk(e){return e}buildCommandDocument(e,t){const n=this.commandBuilder.buildBatch(e.description.maxMessageSizeBytes,e.description.maxWriteBatchSize,e.description.maxBsonObjectSize);return this.canRetryWrite||(this.options.willRetryWrite=!1),n}}t.ClientBulkWriteOperation=a,(0,s.defineAspects)(a,[s.Aspect.WRITE_OPERATION,s.Aspect.SKIP_COLLATION,s.Aspect.CURSOR_CREATING,s.Aspect.RETRYABLE,s.Aspect.COMMAND_BATCHING])},34563:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.loadGCPCredentials=async function(e){const t=(0,r.getGcpMetadata)();if("kModuleError"in t)return e;const{access_token:n}=await t.instance({property:"service-accounts/default/token"});return{...e,gcp:{accessToken:n}}};const r=n(8500)},35293:(e,t,n)=>{var r=n(67787).Buffer;Object.defineProperty(t,"__esModule",{value:!0}),t.ScramSHA256=t.ScramSHA1=void 0;const i=n(21242),o=n(27348),s=n(75080),a=n(17562),u=n(145),c=n(31057),l=n(93065);class h extends c.AuthProvider{constructor(e){super(),this.cryptoMethod=e||"sha1"}async prepare(e,t){const n=this.cryptoMethod,r=t.credentials;if(!r)throw new a.MongoMissingCredentialsError("AuthContext must provide credentials.");const i=await(0,u.randomBytes)(24);return t.nonce=i,{...e,speculativeAuthenticate:{...p(n,r,i),db:r.source}}}async auth(e){const{reauthenticating:t,response:n}=e;return n?.speculativeAuthenticate&&!t?await m(this.cryptoMethod,n.speculativeAuthenticate,e):await async function(e,t){const{connection:n,credentials:r}=t;if(!r)throw new a.MongoMissingCredentialsError("AuthContext must provide credentials.");if(!t.nonce)throw new a.MongoInvalidArgumentError("AuthContext must contain a valid nonce property");const i=t.nonce,o=r.source,s=p(e,r,i),c=await n.command((0,u.ns)(`${o}.$cmd`),s,void 0);await m(e,c,t)}(this.cryptoMethod,e)}}function d(e){return e.replace("=","=3D").replace(",","=2C")}function f(e,t){return r.concat([r.from("n=","utf8"),r.from(e,"utf8"),r.from(",r=","utf8"),r.from(t.toString("base64"),"utf8")])}function p(e,t,n){const i=d(t.username);return{saslStart:1,mechanism:"sha1"===e?l.AuthMechanism.MONGODB_SCRAM_SHA1:l.AuthMechanism.MONGODB_SCRAM_SHA256,payload:new s.Binary(r.concat([r.from("n,,","utf8"),f(i,n)])),autoAuthorize:1,options:{skipEmptyExchange:!0}}}async function m(e,t,n){const c=n.connection,l=n.credentials;if(!l)throw new a.MongoMissingCredentialsError("AuthContext must provide credentials.");if(!n.nonce)throw new a.MongoInvalidArgumentError("Unable to continue SCRAM without valid nonce");const h=n.nonce,p=l.source,m=d(l.username),S=l.password,w="sha256"===e?(0,i.saslprep)(S):function(e,t){if("string"!=typeof e)throw new a.MongoInvalidArgumentError("Username must be a string");if("string"!=typeof t)throw new a.MongoInvalidArgumentError("Password must be a string");if(0===t.length)throw new a.MongoInvalidArgumentError("Password cannot be empty");let n;try{n=o.createHash("md5")}catch(e){if(o.getFips())throw new Error("Auth mechanism SCRAM-SHA-1 is not supported in FIPS mode");throw e}return n.update(`${e}:mongo:${t}`,"utf8"),n.digest("hex")}(m,S),C=r.isBuffer(t.payload)?new s.Binary(t.payload):t.payload,O=g(C),b=parseInt(O.i,10);if(b&&b<4096)throw new a.MongoRuntimeError(`Server returned an invalid iteration count ${b}`);const M=O.s,T=O.r;if(T.startsWith("nonce"))throw new a.MongoRuntimeError(`Server returned an invalid nonce: ${T}`);const A=`c=biws,r=${T}`,R=function(e,t,n,r){const i=[e,t.toString("base64"),n].join("_");if(null!=y[i])return y[i];const s=o.pbkdf2Sync(e,t,n,E[r],r);return v>=200&&(y={},v=0),y[i]=s,v+=1,s}(w,r.from(M,"base64"),b,e),N=_(e,R,"Client Key"),I=_(e,R,"Server Key"),x=(k=e,P=N,o.createHash(k).update(P).digest());var k,P;const D=[f(m,h),C.toString("utf8"),A].join(","),$=[A,`p=${function(e,t){r.isBuffer(e)||(e=r.from(e)),r.isBuffer(t)||(t=r.from(t));const n=Math.max(e.length,t.length),i=[];for(let r=0;r<n;r+=1)i.push(e[r]^t[r]);return r.from(i).toString("base64")}(N,_(e,x,D))}`].join(","),L=_(e,I,D),B={saslContinue:1,conversationId:t.conversationId,payload:new s.Binary(r.from($))},j=await c.command((0,u.ns)(`${p}.$cmd`),B,void 0),q=g(j.payload);if(!function(e,t){if(e.length!==t.length)return!1;if("function"==typeof o.timingSafeEqual)return o.timingSafeEqual(e,t);let n=0;for(let r=0;r<e.length;r++)n|=e[r]^t[r];return 0===n}(r.from(q.v,"base64"),L))throw new a.MongoRuntimeError("Server returned an invalid signature");if(!1!==j.done)return;const F={saslContinue:1,conversationId:j.conversationId,payload:r.alloc(0)};await c.command((0,u.ns)(`${p}.$cmd`),F,void 0)}function g(e){const t={},n=e.toString("utf8").split(",");for(let e=0;e<n.length;e++){const r=(n[e].match(/^([^=]*)=(.*)$/)??[]).slice(1);t[r[0]]=r[1]}return t}function _(e,t,n){return o.createHmac(e,t).update(n).digest()}let y={},v=0;const E={sha256:32,sha1:20};t.ScramSHA1=class extends h{constructor(){super("sha1")}},t.ScramSHA256=class extends h{constructor(){super("sha256")}}},35369:(e,t)=>{t.endianness=function(){return"LE"},t.hostname=function(){return"undefined"!=typeof location?location.hostname:""},t.loadavg=function(){return[]},t.uptime=function(){return 0},t.freemem=function(){return Number.MAX_VALUE},t.totalmem=function(){return Number.MAX_VALUE},t.cpus=function(){return[]},t.type=function(){return"Browser"},t.release=function(){return"undefined"!=typeof navigator?navigator.appVersion:""},t.networkInterfaces=t.getNetworkInterfaces=function(){return{}},t.arch=function(){return"javascript"},t.platform=function(){return"browser"},t.tmpdir=t.tmpDir=function(){return"/tmp"},t.EOL="\n",t.homedir=function(){return"/"}},35394:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.AbstractOperation=t.Aspect=void 0,t.defineAspects=function(e,t){return Array.isArray(t)||t instanceof Set||(t=[t]),t=new Set(t),Object.defineProperty(e,"aspects",{value:t,writable:!1}),t};const r=n(75080),i=n(13700);t.Aspect={READ_OPERATION:Symbol("READ_OPERATION"),WRITE_OPERATION:Symbol("WRITE_OPERATION"),RETRYABLE:Symbol("RETRYABLE"),EXPLAINABLE:Symbol("EXPLAINABLE"),SKIP_COLLATION:Symbol("SKIP_COLLATION"),CURSOR_CREATING:Symbol("CURSOR_CREATING"),MUST_SELECT_SAME_SERVER:Symbol("MUST_SELECT_SAME_SERVER"),COMMAND_BATCHING:Symbol("COMMAND_BATCHING")},t.AbstractOperation=class{constructor(e={}){this.readPreference=this.hasAspect(t.Aspect.WRITE_OPERATION)?i.ReadPreference.primary:i.ReadPreference.fromOptions(e)??i.ReadPreference.primary,this.bsonOptions=(0,r.resolveBSONOptions)(e),this._session=null!=e.session?e.session:void 0,this.options=e,this.bypassPinningCheck=!!e.bypassPinningCheck}hasAspect(e){const t=this.constructor;return null!=t.aspects&&t.aspects.has(e)}get session(){return this._session}set session(e){this._session=e}clearSession(){this._session=void 0}resetBatch(){return!0}get canRetryRead(){return this.hasAspect(t.Aspect.RETRYABLE)&&this.hasAspect(t.Aspect.READ_OPERATION)}get canRetryWrite(){return this.hasAspect(t.Aspect.RETRYABLE)&&this.hasAspect(t.Aspect.WRITE_OPERATION)}handleOk(e){return e.toObject(this.bsonOptions)}handleError(e){throw e}}},36257:(e,t)=>{var n,r,i,o;"object"!=typeof globalThis&&(Object.defineProperty(Object.prototype,"__magic__",{get:function(){return this},configurable:!0}),__magic__.globalThis=__magic__,delete Object.prototype.__magic__),void 0===Math.imul&&(Math.imul=function(e,t){return(4294901760&e)*(65535&t)+(65535&e)*(0|t)|0}),void 0===ArrayBuffer.isView&&(ArrayBuffer.isView=function(e){return null!=e&&null!=e.__proto__&&e.__proto__.__proto__===Int8Array.prototype.__proto__}),void 0===Array.prototype.fill&&Object.defineProperty(Array.prototype,"fill",{value:function(e){if(null==this)throw new TypeError("this is null or not defined");for(var t=Object(this),n=t.length>>>0,r=0|arguments[1],i=r<0?Math.max(n+r,0):Math.min(r,n),o=arguments[2],s=void 0===o?n:0|o,a=s<0?Math.max(n+s,0):Math.min(s,n);i<a;)t[i]=e,i++;return t}}),[Int8Array,Int16Array,Uint16Array,Int32Array,Float32Array,Float64Array].forEach((function(e){void 0===e.prototype.fill&&Object.defineProperty(e.prototype,"fill",{value:Array.prototype.fill})})),void 0===Math.clz32&&(Math.clz32=(i=Math.log,o=Math.LN2,function(e){var t=e>>>0;return 0===t?32:31-(i(t)/o|0)|0})),void 0===String.prototype.startsWith&&Object.defineProperty(String.prototype,"startsWith",{value:function(e,t){return t=t||0,this.lastIndexOf(e,t)===t}}),void 0===(r="function"==typeof(n=function(e){var t,n,r,i,o,s,a,u,c,l,h,d,f,p,m,g,_,y,v,E,S,w,C,O,b,M,T,A,R,N,I,x,k,P,D,$,L,B,j,q,F,z=Math.imul,U=ArrayBuffer.isView,V=Math.clz32;function W(e){return e===Ko()?this:e.ca(this,Wo)}function G(e){return Xe(this.b1(),e)?Bt(this,Vo)?this:st():null}function H(e,t){return t(e,this)}function K(e){return Xe(this.b1(),e)?Ko():this}function Y(){}function Q(){}function J(){}function X(){}function Z(e){switch(e.length){case 0:return bo();case 1:return rn(e[0]);default:return function(e){return Cn(function(e){return new No(e,!1)}(e))}(e)}}function ee(e,t){if(null==t){var n=0,r=e.length-1|0;if(n<=r)do{var i=n;if(n=n+1|0,null==e[i])return i}while(n<=r)}else{var o=0,s=e.length-1|0;if(o<=s)do{var a=o;if(o=o+1|0,Xe(t,e[a]))return a}while(o<=s)}return-1}function te(e){return e.length-1|0}function ne(e,t){for(var n=0,r=e.length;n<r;){var i=e[n];n=n+1|0,t.h(i)}return t}function re(e,t,n,r,i,o,s){return t=t===v?", ":t,n=n===v?"":n,r=r===v?"":r,i=i===v?-1:i,o=o===v?"...":o,s=s===v?null:s,function(e,t,n,r,i,o,s,a){n=n===v?", ":n,r=r===v?"":r,i=i===v?"":i,o=o===v?-1:o,s=s===v?"...":s,a=a===v?null:a,t.i(r);var u=0,c=0,l=e.length;e:for(;c<l;){var h=e[c];if(c=c+1|0,(u=u+1|0)>1&&t.i(n),!(o<0||u<=o))break e;ds(t,h,a)}return o>=0&&u>o&&t.i(s),t.i(i),t}(e,Yi(),t,n,r,i,o,s).toString()}function ie(e,t){return 0<=t&&t<=(e.length-1|0)?e[t]:null}function oe(e,t,n,r,i,o,s){return t=t===v?", ":t,n=n===v?"":n,r=r===v?"":r,i=i===v?-1:i,o=o===v?"...":o,s=s===v?null:s,function(e,t,n,r,i,o,s,a){n=n===v?", ":n,r=r===v?"":r,i=i===v?"":i,o=o===v?-1:o,s=s===v?"...":s,a=a===v?null:a,t.i(r);var u=0,c=e.j();e:for(;c.k();){var l=c.l();if((u=u+1|0)>1&&t.i(n),!(o<0||u<=o))break e;ds(t,l,a)}return o>=0&&u>o&&t.i(s),t.i(i),t}(e,Yi(),t,n,r,i,o,s).toString()}function se(e){if(Bt(e,Ee)){var t;switch(e.m()){case 0:t=bo();break;case 1:t=rn(Bt(e,ve)?e.q(0):e.j().l());break;default:t=ue(e)}return t}return function(e){switch(e.m()){case 0:return bo();case 1:return rn(e.q(0));default:return e}}(ce(e))}function ae(e,t){for(var n=e.j();n.k();){var r=n.l();t.h(r)}return t}function ue(e){return Cn(e)}function ce(e){return Bt(e,Ee)?ue(e):ae(e,Sn())}function le(e,t){return t<=-2147483648?as().s_1:$t(e,t-1|0)}function he(e,t){return e<t?t:e}function de(e,t){return e>t?t:e}function fe(e){this.x_1=e}function pe(e){return e}function me(e,t){return e-t|0}function ge(e,t){return e-t|0}function _e(e){return String.fromCharCode(e)}function ye(){}function ve(){}function Ee(){}function Se(){}function we(){}function Ce(){}function Oe(){}function be(e,t){this.i1_1=e,this.j1_1=t}function Me(e){var t=null==e?null:Je(e);return null==t?"null":t}function Te(){n=this,this.l1_1=new Ae(0,-2147483648),this.m1_1=new Ae(-1,2147483647),this.n1_1=8,this.o1_1=64}function Ae(e,t){null==n&&new Te,J.call(this),this.p1_1=e,this.q1_1=t}function Re(e){for(var t=1,n=[],r=0,i=e.length;r<i;){var o=e[r];r=r+1|0;var s=t,a=o.prototype.$imask$,u=null==a?o.$imask$:a;null!=u&&(n.push(u),s=u.length);var c=o.$metadata$.iid,l=null==c?null:(d=void 0,f=void 0,p=void 0,d=(h=c)>>5,f=new Int32Array(d+1|0),p=1<<(31&h),f[d]=f[d]|p,f);null!=l&&(n.push(l),s=Math.max(s,l.length)),s>t&&(t=s)}var h,d,f,p;return function(e,t){for(var n=0,r=new Int32Array(e);n<e;){for(var i=n,o=0,s=0,a=t.length;s<a;){var u=t[s];s=s+1|0,i<u.length&&(o|=u[i])}r[i]=o,n=n+1|0}return r}(t,n)}function Ne(){}function Ie(e,t){var n=0,r=e.length-1|0;if(n<=r)do{var i=n;n=n+1|0,e[i]=t}while(i!==r);return e}function xe(e){return new ke(e)}function ke(e){this.b2_1=e,this.a2_1=0}function Pe(){return je(),r}function De(){return je(),i}function $e(){return je(),o}function Le(){return je(),s}function Be(e){return je(),(0|e)===e?Dt(e):(De()[0]=e,z($e()[(je(),a)],31)+$e()[Le()]|0)}function je(){u||(u=!0,r=new ArrayBuffer(8),i=new Float64Array(Pe()),new Float32Array(Pe()),o=new Int32Array(Pe()),De()[0]=-1,s=0!==$e()[0]?1:0,a=1-Le()|0)}function qe(e,t){var n;if(Fe(e)){var r=e.charCodeAt(t);if(r<0||r>65535)throw xr("Invalid Char code: "+r);n=function(e){return function(e){return 65535&e}(function(e){return e<<16>>16}(Dt(e)))}(r)}else n=e.b(t);return n}function Fe(e){return"string"==typeof e}function ze(e){return Fe(e)?e.length:e.a()}function Ue(e,t,n){return Fe(e)?e.substring(t,n):e.c(t,n)}function Ve(e){return Je(e)}function We(e,t){var n;switch(typeof e){case"number":n="number"==typeof t?Ge(e,t):t instanceof Ae?Ge(e,t.y1()):He(e,t);break;case"string":case"boolean":n=He(e,t);break;default:n=function(e,t){return e.d(t)}(e,t)}return n}function Ge(e,t){var n;if(e<t)n=-1;else if(e>t)n=1;else if(e===t){var r;if(0!==e)r=0;else{var i=1/e;r=i===1/t?0:i<0?-1:1}n=r}else n=e!=e?t!=t?0:1:-1;return n}function He(e,t){return e<t?-1:e>t?1:0}function Ke(e){if(!("kotlinHashCodeValue$"in e)){var t=Ye(),n=new Object;n.value=t,n.enumerable=!1,Object.defineProperty(e,"kotlinHashCodeValue$",n)}return e.kotlinHashCodeValue$}function Ye(){return 4294967296*Math.random()|0}function Qe(e){return e=e===v?null:e,Object.create(e)}function Je(e){return null==e?"null":function(e){return Lt(e)||U(e)}(e)?"[...]":"function"!=typeof e.toString?et(e):e.toString()}function Xe(e,t){return null==e?null==t:null!=t&&("object"==typeof e&&"function"==typeof e.equals?e.equals(t):e!=e?t!=t:"number"==typeof e&&"number"==typeof t?e===t&&(0!==e||1/e==1/t):e===t)}function Ze(e){if(null==e)return 0;var t,n=typeof e;switch(n){case"object":t="function"==typeof e.hashCode?e.hashCode():Ke(e);break;case"function":t=Ke(e);break;case"number":t=Be(e);break;case"boolean":t=e?1231:1237;break;case"string":t=tt(String(e));break;case"bigint":t=function(e){for(var t=BigInt(32),n=BigInt(4294967295),r=e<0?-e:e,i=0,o=e<0?-1:1;0!=r;){var s=Number(r&n);i=z(31,i)+s|0,r>>=t}return z(i,o)}(e);break;case"symbol":t=function(e){var t=(r=e,Symbol.keyFor(r)!=v?(c===v&&(c=new Map),c):(l===v&&(l=new WeakMap),l)),n=t.get(e);var r;if(n!==v)return n;var i=Ye();return t.set(e,i),i}(e);break;default:t=function(){throw new Error("Unexpected typeof `"+n+"`")}()}return t}function et(e){return Object.prototype.toString.call(e)}function tt(e){var t=0,n=0,r=e.length-1|0;if(n<=r)do{var i=n;n=n+1|0;var o=e.charCodeAt(i);t=z(t,31)+o|0}while(i!==r);return t}function nt(e,t){null!=Error.captureStackTrace?Error.captureStackTrace(e,t):e.stack=(new Error).stack}function rt(e){return e.prototype}function it(e,t,n){Error.call(e),function(e,t,n){var r=Yt(Object.getPrototypeOf(e));if(!(1&r)){var i;if(null==t){var o;if(null!==t){var s=null==n?null:n.toString();o=null==s?v:s}else o=v;i=o}else i=t;e.message=i}2&r||(e.cause=n),e.name=Object.getPrototypeOf(e).constructor.name}(e,t,n)}function ot(e){var t;return null==e?function(){throw ui()}():t=e,t}function st(){throw di()}function at(){return Rt(),h}function ut(){return Rt(),d}function ct(){return Rt(),f}function lt(){return Rt(),m}function ht(){return Rt(),g}function dt(e,t){if(Rt(),vt(e,t))return 0;var n=St(e),r=St(t);return n&&!r?-1:!n&&r?1:St(pt(e,t))?-1:1}function ft(e,t){Rt();var n=e.q1_1>>>16|0,r=65535&e.q1_1,i=e.p1_1>>>16|0,o=65535&e.p1_1,s=t.q1_1>>>16|0,a=65535&t.q1_1,u=t.p1_1>>>16|0,c=0,l=0,h=0,d=0;return c=(c=c+((l=(l=l+((h=(h=h+((d=d+(o+(65535&t.p1_1)|0)|0)>>>16|0)|0)+(i+u|0)|0)>>>16|0)|0)+(r+a|0)|0)>>>16|0)|0)+(n+s|0)|0,new Ae((h&=65535)<<16|(d&=65535),(c&=65535)<<16|(l&=65535))}function pt(e,t){return Rt(),ft(e,t.v1())}function mt(e,t){if(Rt(),wt(e))return at();if(wt(t))return at();if(vt(e,lt()))return Ct(t)?lt():at();if(vt(t,lt()))return Ct(e)?lt():at();if(St(e))return St(t)?mt(Ot(e),Ot(t)):Ot(mt(Ot(e),t));if(St(t))return Ot(mt(e,Ot(t)));if(bt(e,ht())&&bt(t,ht()))return Mt(_t(e)*_t(t));var n=e.q1_1>>>16|0,r=65535&e.q1_1,i=e.p1_1>>>16|0,o=65535&e.p1_1,s=t.q1_1>>>16|0,a=65535&t.q1_1,u=t.p1_1>>>16|0,c=65535&t.p1_1,l=0,h=0,d=0,f=0;return d=d+((f=f+z(o,c)|0)>>>16|0)|0,f&=65535,h=(h=h+((d=d+z(i,c)|0)>>>16|0)|0)+((d=(d&=65535)+z(o,u)|0)>>>16|0)|0,d&=65535,l=(l=(l=l+((h=h+z(r,c)|0)>>>16|0)|0)+((h=(h&=65535)+z(i,u)|0)>>>16|0)|0)+((h=(h&=65535)+z(o,a)|0)>>>16|0)|0,h&=65535,l=l+(((z(n,c)+z(r,u)|0)+z(i,a)|0)+z(o,s)|0)|0,new Ae(d<<16|f,(l&=65535)<<16|h)}function gt(e,t){if(Rt(),wt(t))throw Ar("division by zero");if(wt(e))return at();if(vt(e,lt())){if(vt(t,ut())||vt(t,ct()))return lt();if(vt(t,lt()))return ut();var n=function(e,t){Rt();var n=63&t;return 0===n?e:n<32?new Ae(e.p1_1<<n,e.q1_1<<n|e.p1_1>>>(32-n|0)):new Ae(0,e.p1_1<<n-32)}(function(e,t){Rt();var n=63&t;return 0===n?e:n<32?new Ae(e.p1_1>>>n|e.q1_1<<32-n,e.q1_1>>n):new Ae(e.q1_1>>n-32,e.q1_1>=0?0:-1)}(e,1).u1(t),1);return vt(n,at())?St(t)?ut():ct():ft(n,pt(e,mt(t,n)).u1(t))}if(vt(t,lt()))return at();if(St(e))return St(t)?Ot(e).u1(Ot(t)):Ot(Ot(e).u1(t));if(St(t))return Ot(e.u1(Ot(t)));for(var r=at(),i=e;At(i,t);){for(var o=_t(i)/_t(t),s=Math.max(1,Math.floor(o)),a=Math.ceil(Math.log(s)/Math.LN2),u=a<=48?1:Math.pow(2,a-48),c=Mt(s),l=mt(c,t);St(l)||Tt(l,i);)l=mt(c=Mt(s-=u),t);wt(c)&&(c=ut()),r=ft(r,c),i=pt(i,l)}return r}function _t(e){return Rt(),4294967296*e.q1_1+function(e){return Rt(),e.p1_1>=0?e.p1_1:4294967296+e.p1_1}(e)}function yt(e,t){if(Rt(),t<2||36<t)throw Ar("radix out of range: "+t);if(wt(e))return"0";if(St(e)){if(vt(e,lt())){var n=Et(t),r=e.u1(n),i=pt(mt(r,n),e).x1();return yt(r,t)+i.toString(t)}return"-"+yt(Ot(e),t)}for(var o=2===t?31:t<=10?9:t<=21?7:t<=35?6:5,s=Mt(Math.pow(t,o)),a=e,u="";;){var c=a.u1(s),l=pt(a,mt(c,s)).x1().toString(t);if(wt(a=c))return l+u;for(;l.length<o;)l="0"+l;u=l+u}}function vt(e,t){return Rt(),e.q1_1===t.q1_1&&e.p1_1===t.p1_1}function Et(e){return Rt(),new Ae(e,e<0?-1:0)}function St(e){return Rt(),e.q1_1<0}function wt(e){return Rt(),0===e.q1_1&&0===e.p1_1}function Ct(e){return Rt(),!(1&~e.p1_1)}function Ot(e){return Rt(),e.v1()}function bt(e,t){return Rt(),dt(e,t)<0}function Mt(e){if(Rt(),(t=e)!=t)return at();var t;if(e<=-0x8000000000000000)return lt();if(e+1>=0x8000000000000000)return Rt(),p;if(e<0)return Ot(Mt(-e));var n=4294967296;return new Ae(e%n|0,e/n|0)}function Tt(e,t){return Rt(),dt(e,t)>0}function At(e,t){return Rt(),dt(e,t)>=0}function Rt(){_||(_=!0,h=Et(0),d=Et(1),f=Et(-1),p=new Ae(-1,2147483647),m=new Ae(0,-2147483648),g=Et(16777216))}function Nt(e,t,n,r,i,o,s,a,u){null!=i&&(t.prototype=Object.create(i.prototype),t.prototype.constructor=t);var c=function(e,t,n,r,i,o){return{kind:e,simpleName:t,associatedObjectKey:r,associatedObjects:i,suspendArity:o,$kClass$:v,defaultConstructor:n,iid:"interface"===e?(y===v&&(y=0),y=y+1|0):v}}(e,n,r,a,u,s);t.$metadata$=c,null!=o&&((Xe(c.iid,v)?t.prototype:t).$imask$=Re(o))}function It(e,t,n,r,i,o,s,a){Nt("class",e,t,n,r,i,o,s,a)}function xt(e,t,n,r,i,o,s,a){Nt("object",e,t,n,r,i,o,s,a)}function kt(e,t,n,r,i,o,s,a){Nt("interface",e,t,n,r,i,o,s,a)}function Pt(e,t,n,r){xt(e,"Companion",v,t,n,r,v,v)}function Dt(e){return e instanceof Ae?e.x1():function(e){return e>2147483647?2147483647:e<-2147483648?-2147483648:0|e}(e)}function $t(e,t){return new us(e,t)}function Lt(e){return Array.isArray(e)}function Bt(e,t){return function(e,t){var n=e.$imask$;return null!=n&&function(e,t){var n=t>>5;if(n>e.length)return!1;var r=1<<(31&t);return!!(e[n]&r)}(n,t)}(e,t.$metadata$.iid)}function jt(e){return!!Lt(e)&&!e.$type$}function qt(e){return"number"==typeof e||e instanceof Ae}function Ft(e){return Lt(e)&&"BooleanArray"===e.$type$}function zt(e){return e instanceof Int8Array}function Ut(e){return e instanceof Int16Array}function Vt(e){return e instanceof Uint16Array&&"CharArray"===e.$type$}function Wt(e){return e instanceof Int32Array}function Gt(e){return e instanceof Float32Array}function Ht(e){return Lt(e)&&"LongArray"===e.$type$}function Kt(e){return e instanceof Float64Array}function Yt(e){var t=e.constructor,n=null==t?null:t.$metadata$,r=null==n?null:n.errorInfo;if(null!=r)return r;var i,o=0;if(Qt(e,"message")&&(o|=1),Qt(e,"cause")&&(o|=2),3!==o){var s=(i=e,Object.getPrototypeOf(i));s!=Error.prototype&&(o|=Yt(s))}return null!=n&&(n.errorInfo=o),o}function Qt(e,t){return e.hasOwnProperty(t)}function Jt(e){return new bn(e)}function Xt(e,t){if(!(t>=0))throw xr(Je("Invalid new array size: "+t+"."));return function(e,t,n){var r=e.slice(0,t);void 0!==e.$type$&&(r.$type$=e.$type$);var i=e.length;if(t>i)for(r.length=t;i<t;){var o=i;i=o+1|0,r[o]=n}return r}(e,t,null)}function Zt(){E=this,this.c2_1=new Int32Array([48,1632,1776,1984,2406,2534,2662,2790,2918,3046,3174,3302,3430,3558,3664,3792,3872,4160,4240,6112,6160,6470,6608,6784,6800,6992,7088,7232,7248,42528,43216,43264,43472,43504,43600,44016,65296])}function en(){return null==E&&new Zt,E}function tn(){}function nn(e){return function(e){if(e.p())return[];for(var t=e.m(),n=Ie(Array(t),null),r=e.j(),i=0;r.k();){var o=i;i=o+1|0,n[o]=r.l()}return n}(e)}function rn(e){return 0===(t=[e]).length?Sn():Cn(new No(t,!0));var t}function on(e){return e}function sn(e){return e<0&&function(){throw ni("Index overflow has happened.")}(),e}function an(e){return void 0!==e.toArray?e.toArray():nn(e)}function un(e){return r=(t=[e]).length,function(e,t){for(var n=0,r=t.length;n<r;){var i=t[n];n=n+1|0;var o=i.t9(),s=i.u9();e.a3(o,s)}}(n=In(r,Qe(rt(xn))),t),n;var t,n,r}function cn(e,t,n,r,i){A.f2(r,i,e.length);var o=i-r|0;if(A.f2(n,n+o|0,t.length),U(t)&&U(e)){var s=e.subarray(r,i);t.set(s,n)}else if(e!==t||n<=r){var a=0;if(a<o)do{var u=a;a=a+1|0,t[n+u|0]=e[r+u|0]}while(a<o)}else{var c=o-1|0;if(0<=c)do{var l=c;c=c+-1|0,t[n+l|0]=e[r+l|0]}while(0<=c)}}function ln(e){return ne(t=[e],zn(t.length));var t}function hn(){no.call(this)}function dn(e){this.j2_1=e,this.h2_1=0,this.i2_1=-1}function fn(e,t,n){pn.call(this),this.l2_1=e,this.m2_1=t,this.n2_1=0,A.f2(this.m2_1,n,this.l2_1.m()),this.n2_1=n-this.m2_1|0}function pn(){hn.call(this),this.q2_1=0}function mn(){fo.call(this),this.x2_1=null,this.y2_1=null}function gn(){hn.call(this)}function _n(e){if(!(e>=0))throw xr(Je("capacity must be non-negative."));return Ie(Array(e),null)}function yn(e,t,n){e.fill(null,t,n)}function vn(e,t){return Xt(e,t)}function En(){S=this;var e=wn(0);e.g_1=!0,this.g3_1=e}function Sn(){return e=Qe(rt(bn)),bn.call(e,[]),e;var e}function wn(e){return function(e,t){if(bn.call(t,[]),!(e>=0))throw xr(Je("Negative initial capacity: "+e));return t}(e,Qe(rt(bn)))}function Cn(e){return function(e,t){var n=an(e);return bn.call(t,n),t}(e,Qe(rt(bn)))}function On(e,t){return A.r2(t,e.m()),t}function bn(e){null==S&&new En,pn.call(this),this.f_1=e,this.g_1=!1}function Mn(e,t){if(function(){if(null!=w)return w;w=!1;var e=[],t=0;if(t<600)do{var n=t;t=t+1|0,e.push(n)}while(t<600);var r=An;e.sort(r);var i=1,o=e.length;if(i<o)do{var s=i;i=i+1|0;var a=e[s-1|0],u=e[s];if((3&a)==(3&u)&&a>=u)return!1}while(i<o);return w=!0,!0}()){var n=(r=t,function(e,t){return r.compare(e,t)});e.sort(n)}else!function(e,t,n,r){var i=e.length,o=Tn(e,Ie(Array(i),null),t,n,r);if(o!==e){var s=t;if(s<=n)do{var a=s;s=s+1|0,e[a]=o[a]}while(a!==n)}}(e,0,te(e),t);var r}function Tn(e,t,n,r,i){if(n===r)return e;var o=(n+r|0)/2|0,s=Tn(e,t,n,o,i),a=Tn(e,t,o+1|0,r,i),u=s===t?e:t,c=n,l=o+1|0,h=n;if(h<=r)do{var d=h;if(h=h+1|0,c<=o&&l<=r){var f=s[c],p=a[l];i.compare(f,p)<=0?(u[d]=f,c=c+1|0):(u[d]=p,l=l+1|0)}else c<=o?(u[d]=s[c],c=c+1|0):(u[d]=a[l],l=l+1|0)}while(d!==r);return u}function An(e,t){return(3&e)-(3&t)|0}function Rn(e,t){return mn.call(t),xn.call(t),t.m3_1=e,t}function Nn(e){return Rn(Gn(),e),e}function In(e,t){return function(e,t,n){Rn(Kn(e,t),n)}(e,1,t),t}function xn(){this.n3_1=null}function kn(e){hn.call(this),this.p3_1=e}function Pn(e){Dn.call(this,e)}function Dn(e){gn.call(this),this.w3_1=e}function $n(e){this.c4_1=e}function Ln(e){hn.call(this),this.d4_1=e}function Bn(e,t){return gn.call(t),Un.call(t),t.y_1=e,t}function jn(e){return Bn(Gn(),e),e}function qn(){return jn(Qe(rt(Un)))}function Fn(e,t,n){return Bn(Kn(e,t),n),n}function zn(e){return function(e,t){return Fn(e,1,t),t}(e,Qe(rt(Un)))}function Un(){}function Vn(e,t){return 0===(n=z(he(t,1),3))?0:1<<31-V(n);var n}function Wn(e,t){return V(t)+1|0}function Gn(){return Hn(8,e=Qe(rt(lr))),e;var e}function Hn(e,t){return lr.call(t,_n(e),null,new Int32Array(e),new Int32Array(Vn(0,e)),2,0),t}function Kn(e,t){return function(e,t,n){if(Hn(e,n),!(t>0))throw xr(Je("Non-positive load factor: "+t));return n}(e,t,Qe(rt(lr)))}function Yn(e){return e.f4_1.length}function Qn(e){return e.i4_1.length}function Jn(e){e.m4_1=e.m4_1+1|0}function Xn(e,t){!function(e,t){var n=Yn(e)-e.k4_1|0,r=e.k4_1-e.m()|0;return n<t&&(r+n|0)>=t&&r>=(Yn(e)/4|0)}(e,t)?function(e,t){if(t<0)throw Gr("too many elements");if(t>Yn(e)){var n=A.p4(Yn(e),t);e.f4_1=vn(e.f4_1,n);var r=e,i=e.g4_1;r.g4_1=null==i?null:vn(i,n),e.h4_1=function(e,t){if(!(t>=0))throw xr(Je("Invalid new array size: "+t+"."));return function(e,t){for(var n=e.length,r=t.length,i=0,o=t;i<n&&i<r;){var s=i,a=i;i=a+1|0,o[s]=e[a]}return t}(e,new Int32Array(t))}(e.h4_1,n);var o=Vn(0,n);o>Qn(e)&&tr(e,o)}}(e,e.k4_1+t|0):er(e,!0)}function Zn(e,t){return null==t?0:z(Ze(t),-1640531527)>>>e.l4_1|0}function er(e,t){for(var n=0,r=0,i=e.g4_1;n<e.k4_1;){var o=e.h4_1[n];o>=0&&(e.f4_1[r]=e.f4_1[n],null!=i&&(i[r]=i[n]),t&&(e.h4_1[r]=o,e.i4_1[o]=r+1|0),r=r+1|0),n=n+1|0}yn(e.f4_1,r,e.k4_1),null==i||yn(i,r,e.k4_1),e.k4_1=r}function tr(e,t){Jn(e),e.k4_1>e.n4_1&&er(e,!1),e.i4_1=new Int32Array(t),e.l4_1=Wn(0,t);for(var n=0;n<e.k4_1;){var r=n;if(n=r+1|0,!nr(e,r))throw Br("This cannot happen with fixed magic multiplier and grow-only hash array. Have object hashCodes changed?")}}function nr(e,t){for(var n=Zn(e,e.f4_1[t]),r=e.j4_1;;){if(0===e.i4_1[n])return e.i4_1[n]=t+1|0,e.h4_1[t]=n,!0;if((r=r-1|0)<0)return!1;var i=n;n=i-1|0,0===i&&(n=Qn(e)-1|0)}}function rr(e,t){for(var n=Zn(e,t),r=e.j4_1;;){var i=e.i4_1[n];if(0===i)return-1;if(i>0&&Xe(e.f4_1[i-1|0],t))return i-1|0;if((r=r-1|0)<0)return-1;var o=n;n=o-1|0,0===o&&(n=Qn(e)-1|0)}}function ir(){this.q4_1=-1640531527,this.r4_1=8,this.s4_1=2,this.t4_1=-1}function or(e){this.u4_1=e,this.v4_1=0,this.w4_1=-1,this.x4_1=this.u4_1.m4_1,this.y4()}function sr(e){or.call(this,e)}function ar(e){or.call(this,e)}function ur(e){or.call(this,e)}function cr(e,t){this.s5_1=e,this.t5_1=t}function lr(e,t,n,r,i,o){this.f4_1=e,this.g4_1=t,this.h4_1=n,this.i4_1=r,this.j4_1=i,this.k4_1=o,this.l4_1=Wn(0,Qn(this)),this.m4_1=0,this.n4_1=0,this.o4_1=!1}function hr(){}function dr(){return Nn(e=Qe(rt(pr))),pr.call(e),e;var e}function fr(e){return function(e,t){return In(e,t),pr.call(t),t}(e,Qe(rt(pr)))}function pr(){}function mr(){return jn(e=Qe(rt(yr))),yr.call(e),e;var e}function gr(e,t){return function(e,t,n){Fn(e,t,n),yr.call(n)}(e,1,t),t}function _r(e){return gr(e,Qe(rt(yr)))}function yr(){}function vr(e){Sr.call(this),this.d6_1=e,this.e6_1=0,this.f6_1=0,this.g6_1=null,this.h6_1=null,this.i6_1=null;var t=this.d6_1;this.j6_1=null==t?null:t.k6()}function Er(){}function Sr(){this.n6_1=null}function wr(){nt(this,wr)}function Cr(e){var t=e instanceof Sr?e:null,n=null==t?null:t.q6();return null==n?e:n}function Or(e,t,n){return new br(n,e,t,n)}function br(e,t,n,r){this.f7_1=t,this.g7_1=n,this.h7_1=r,vr.call(this,Bt(e,Fo)?e:st())}function Mr(e){return it(e),Rr.call(e),e}function Tr(e,t){return it(t,e),Rr.call(t),t}function Ar(e){var t=Tr(e,Qe(rt(Rr)));return nt(t,Ar),t}function Rr(){nt(this,Rr)}function Nr(e){return Vr(e),kr.call(e),e}function Ir(e,t){return Wr(e,t),kr.call(t),t}function xr(e){var t=Ir(e,Qe(rt(kr)));return nt(t,xr),t}function kr(){nt(this,kr)}function Pr(e){var t=function(e,t){return Wr(e,t),Dr.call(t),t}(e,Qe(rt(Dr)));return nt(t,Pr),t}function Dr(){nt(this,Dr)}function $r(e){return Vr(e),qr.call(e),e}function Lr(e,t){return Wr(e,t),qr.call(t),t}function Br(e){var t=Lr(e,Qe(rt(qr)));return nt(t,Br),t}function jr(e,t,n){return Hr(e,t,n),qr.call(n),n}function qr(){nt(this,qr)}function Fr(){var e,t=(Vr(e=Qe(rt(Ur))),Ur.call(e),e);return nt(t,Fr),t}function zr(e){var t=function(e,t){return Wr(e,t),Ur.call(t),t}(e,Qe(rt(Ur)));return nt(t,zr),t}function Ur(){nt(this,Ur)}function Vr(e){return Mr(e),Kr.call(e),e}function Wr(e,t){return Tr(e,t),Kr.call(t),t}function Gr(e){var t=Wr(e,Qe(rt(Kr)));return nt(t,Gr),t}function Hr(e,t,n){return function(e,t,n){it(n,e,t),Rr.call(n)}(e,t,n),Kr.call(n),n}function Kr(){nt(this,Kr)}function Yr(){var e,t=(Vr(e=Qe(rt(Jr))),Jr.call(e),e);return nt(t,Yr),t}function Qr(e){var t=function(e,t){return Wr(e,t),Jr.call(t),t}(e,Qe(rt(Jr)));return nt(t,Qr),t}function Jr(){nt(this,Jr)}function Xr(e){return it(e),ei.call(e),e}function Zr(e,t){return it(t,e),ei.call(t),t}function ei(){nt(this,ei)}function ti(){nt(this,ti)}function ni(e){var t=function(e,t){return Wr(e,t),ri.call(t),t}(e,Qe(rt(ri)));return nt(t,ni),t}function ri(){nt(this,ri)}function ii(){var e,t=(Vr(e=Qe(rt(oi))),oi.call(e),e);return nt(t,ii),t}function oi(){nt(this,oi)}function si(e){var t=function(e,t){return Ir(e,t),ai.call(t),t}(e,Qe(rt(ai)));return nt(t,si),t}function ai(){nt(this,ai)}function ui(){var e,t=(Vr(e=Qe(rt(ci))),ci.call(e),e);return nt(t,ui),t}function ci(){nt(this,ci)}function li(){var e,t=(Vr(e=Qe(rt(hi))),hi.call(e),e);return nt(t,li),t}function hi(){nt(this,hi)}function di(){var e,t=(Vr(e=Qe(rt(fi))),fi.call(e),e);return nt(t,di),t}function fi(){nt(this,fi)}function pi(e){var t=function(e,t){return Wr(e,t),mi.call(t),t}(e,Qe(rt(mi)));return nt(t,pi),t}function mi(){nt(this,mi)}function gi(){}function _i(e){this.j7_1=e}function yi(){O=this,_i.call(this,Object),this.m7_1="Nothing"}function vi(){return null==O&&new yi,O}function Ei(){}function Si(e,t,n){_i.call(this,e),this.o7_1=t,this.p7_1=n}function wi(e){_i.call(this,e);var t=e.$metadata$;this.r7_1=null==t?null:t.simpleName}function Ci(){return T||(T=!0,b=Ie(Array(0),null)),b}function Oi(e){return!(null==e)}function bi(e){return qt(e)}function Mi(e){return null!=e&&"boolean"==typeof e}function Ti(e){return null!=e&&"number"==typeof e}function Ai(e){return null!=e&&"number"==typeof e}function Ri(e){return null!=e&&"number"==typeof e}function Ni(e){return null!=e&&"number"==typeof e}function Ii(e){return null!=e&&"number"==typeof e}function xi(e){return null!=e&&jt(e)}function ki(e){return null!=e&&"string"==typeof e}function Pi(e){return e instanceof Error}function Di(e){return null!=e&&Ft(e)}function $i(e){return null!=e&&Vt(e)}function Li(e){return null!=e&&zt(e)}function Bi(e){return null!=e&&Ut(e)}function ji(e){return null!=e&&Wt(e)}function qi(e){return null!=e&&Ht(e)}function Fi(e){return null!=e&&Gt(e)}function zi(e){return null!=e&&Kt(e)}function Ui(){M=this;var e=Object;this.anyClass=new Si(e,"Any",Oi);var t=Number;this.numberClass=new Si(t,"Number",bi),this.nothingClass=vi();var n=Boolean;this.booleanClass=new Si(n,"Boolean",Mi);var r=Number;this.byteClass=new Si(r,"Byte",Ti);var i=Number;this.shortClass=new Si(i,"Short",Ai);var o=Number;this.intClass=new Si(o,"Int",Ri);var s=Number;this.floatClass=new Si(s,"Float",Ni);var a=Number;this.doubleClass=new Si(a,"Double",Ii);var u=Array;this.arrayClass=new Si(u,"Array",xi);var c=String;this.stringClass=new Si(c,"String",ki);var l=Error;this.throwableClass=new Si(l,"Throwable",Pi);var h=Array;this.booleanArrayClass=new Si(h,"BooleanArray",Di);var d=Uint16Array;this.charArrayClass=new Si(d,"CharArray",$i);var f=Int8Array;this.byteArrayClass=new Si(f,"ByteArray",Li);var p=Int16Array;this.shortArrayClass=new Si(p,"ShortArray",Bi);var m=Int32Array;this.intArrayClass=new Si(m,"IntArray",ji);var g=Array;this.longArrayClass=new Si(g,"LongArray",qi);var _=Float32Array;this.floatArrayClass=new Si(_,"FloatArray",Fi);var y=Float64Array;this.doubleArrayClass=new Si(y,"DoubleArray",zi)}function Vi(){return null==M&&new Ui,M}function Wi(e){return Array.isArray(e)?function(e){var t;switch(e.length){case 1:t=Gi(e[0]);break;case 0:t=vi();break;default:t=new Ei}return t}(e):Gi(e)}function Gi(e){if(e===String)return Vi().stringClass;var t,n=e.$metadata$;if(null!=n){var r;if(null==n.$kClass$){var i=new wi(e);n.$kClass$=i,r=i}else r=n.$kClass$;t=r}else t=new wi(e);return t}function Hi(e){return Ki(t=Qe(rt(Qi))),t;var t}function Ki(e){return Qi.call(e,""),e}function Yi(){return Ki(Qe(rt(Qi)))}function Qi(e){this.o5_1=void 0!==e?e:""}function Ji(e){var t=_e(e).toUpperCase();return t.length>1?e:qe(t,0)}function Xi(e){return function(e){return 9<=e&&e<=13||28<=e&&e<=32||160===e||e>4096&&(5760===e||8192<=e&&e<=8202||8232===e||8233===e||8239===e||8287===e||12288===e)}(e)}function Zi(e,t){var n,r,i,o=me(e,48)>=0&&me(e,57)<=0?ge(e,48):me(e,65)>=0&&me(e,90)<=0?ge(e,65)+10|0:me(e,97)>=0&&me(e,122)<=0?ge(e,97)+10|0:me(e,128)<0?-1:me(e,65313)>=0&&me(e,65338)<=0?ge(e,65313)+10|0:me(e,65345)>=0&&me(e,65370)<=0?ge(e,65345)+10|0:(n=e,r=function(e,t){for(var n=0,r=e.length-1|0,i=-1,o=0;n<=r;)if(t>(o=e[i=(n+r|0)/2|0]))n=i+1|0;else{if(t===o)return i;r=i-1|0}return i-(t<o?1:0)|0}(en().c2_1,n),(i=n-en().c2_1[r]|0)<10?i:-1);return o>=t?-1:o}function eo(e,t,n){return(n=n!==v&&n)?to(e,0,t,0,t.length,n):e.startsWith(t,0)}function to(e,t,n,r,i,o){return gs(e,t,n,r,i,o=o!==v&&o)}function no(){}function ro(e,t,n){so.call(this),this.m8_1=e,this.n8_1=t,this.o8_1=0,A.f2(this.n8_1,n,this.m8_1.m()),this.o8_1=n-this.n8_1|0}function io(e){this.q8_1=e,this.p8_1=0}function oo(){this.e2_1=2147483639}function so(){no.call(this)}function ao(e){this.r8_1=e}function uo(e,t){return t===e?"(this Map)":Me(t)}function co(e,t){var n;e:{for(var r=e.h1().j();r.k();){var i=r.l();if(Xe(i.b1(),t)){n=i;break e}}n=null}return n}function lo(){}function ho(e){this.t8_1=e,no.call(this)}function fo(){this.b3_1=null,this.c3_1=null}function po(){}function mo(){no.call(this)}function go(){return e=Qe(rt(Oo)),pn.call(e),Oo.call(e),e.w8_1=Co().y8_1,e;var e}function _o(e,n){if(n<0)throw Br("Deque is too big.");if(n<=e.w8_1.length)return t;if(e.w8_1===Co().y8_1){var r=e,i=he(n,10);return r.w8_1=Ie(Array(i),null),t}!function(e,t){var n=Ie(Array(t),null);cn(e.w8_1,n,0,e.v8_1,e.w8_1.length),cn(e.w8_1,n,e.w8_1.length-e.v8_1|0,0,e.v8_1),e.v8_1=0,e.w8_1=n}(e,A.p4(e.w8_1.length,n))}function yo(e,t){return t>=e.w8_1.length?t-e.w8_1.length|0:t}function vo(e,t){return t===te(e.w8_1)?0:t+1|0}function Eo(e,t){return 0===t?te(e.w8_1):t-1|0}function So(e){e.q2_1=e.q2_1+1|0}function wo(){N=this,this.y8_1=[],this.z8_1=10}function Co(){return null==N&&new wo,N}function Oo(){Co(),this.v8_1=0,this.x8_1=0}function bo(){return Ro()}function Mo(e){return 0===e.length?Sn():Cn(new No(e,!0))}function To(e){return e.m()-1|0}function Ao(){I=this,this.g9_1=new Ae(-1478467534,-1720727600)}function Ro(){return null==I&&new Ao,I}function No(e,t){this.k9_1=e,this.l9_1=t}function Io(){}function xo(e,t){return Bt(e,Ee)?e.m():t}function ko(){var e=(null==k&&new Po,k);return Bt(e,Ce)?e:st()}function Po(){k=this,this.o9_1=new Ae(-888910638,1920087921)}function Do(e,t){return function(e,t){for(var n=t.j();n.k();){var r=n.l(),i=r.t9(),o=r.u9();e.a3(i,o)}}(t,e),t}function $o(e,t){if(Bt(t,Ee))return e.n(t);for(var n=!1,r=t.j();r.k();){var i=r.l();e.h(i)&&(n=!0)}return n}function Lo(){}function Bo(){P=this,this.w9_1=new Ae(1993859828,793161749)}function jo(){return null==P&&new Bo,P}function qo(){return jo()}function Fo(){}function zo(){}function Uo(){}function Vo(){}function Wo(e,t){var n,r=e.ba(t.b1());if(r===Ko())n=t;else{var i,o=r.r6(D);if(null==o)i=new Xo(r,t);else{var s=r.ba(D);i=s===Ko()?new Xo(t,o):new Xo(new Xo(s,t),o)}n=i}return n}function Go(){}function Ho(){$=this,this.ea_1=new Ae(0,0)}function Ko(){return null==$&&new Ho,$}function Yo(e){for(var t=e,n=2;;){var r=t.fa_1,i=r instanceof Xo?r:null;if(null==i)return n;t=i,n=n+1|0}}function Qo(e,t){return Xe(e.r6(t.b1()),t)}function Jo(e,t){return 0===ze(e)?Je(t):e+", "+Je(t)}function Xo(e,t){this.fa_1=e,this.ga_1=t}function Zo(e,t){this.x9_1=t;var n;n=e instanceof Zo?e.y9_1:e,this.y9_1=n}function es(e){this.ha_1=e}function ts(){return function(){if(B)return t;B=!0,L=new ns("COROUTINE_SUSPENDED",0),new ns("UNDECIDED",1),new ns("RESUMED",2)}(),L}function ns(e,t){be.call(this,e,t)}function rs(e){so.call(this),this.ia_1=e}function is(e,t,n){return os(os(e,n)-os(t,n)|0,n)}function os(e,t){var n=e%t|0;return n>=0?n:n+t|0}function ss(){j=this,this.s_1=new us(1,0)}function as(){return null==j&&new ss,j}function us(e,t){as(),hs.call(this,e,t,1)}function cs(e,t,n){Lo.call(this),this.qa_1=n,this.ra_1=t,this.sa_1=this.qa_1>0?e<=t:e>=t,this.ta_1=this.sa_1?e:this.ra_1}function ls(){}function hs(e,t,n){if(0===n)throw xr("Step must be non-zero.");if(-2147483648===n)throw xr("Step must be greater than Int.MIN_VALUE to avoid overflow on negation.");this.u_1=e,this.v_1=function(e,t,n){var r;if(n>0)r=e>=t?t:t-is(t,e,n)|0;else{if(!(n<0))throw xr("Step is zero.");r=e<=t?t:t+is(e,t,0|-n)|0}return r}(e,t,n),this.w_1=n}function ds(e,t,n){var r;null!=n?e.i(n(t)):null==t||("string"==typeof(r=t)||Bt(r,Y))?e.i(t):t instanceof ye?e.r5(t.ua_1):e.i(Me(t))}function fs(e,t,n){if(e===t)return!0;if(!(n=n!==v&&n))return!1;var r=Ji(e),i=Ji(t);return r===i||qe(_e(r).toLowerCase(),0)===qe(_e(i).toLowerCase(),0)}function ps(e){return ze(e)-1|0}function ms(e,t,n,r){if(n=n===v?0:n,!(r=r!==v&&r)&&1===t.length&&"string"==typeof e){var i=_e(function(e){var t;switch(e.length){case 0:throw Qr("Array is empty.");case 1:t=e[0];break;default:throw xr("Array has more than one element.")}return t}(t));return e.indexOf(i,n)}var o=he(n,0),s=ps(e);if(o<=s)do{var a=o;o=o+1|0;var u,c=qe(e,a);e:{for(var l=0,h=t.length;l<h;){var d=t[l];if(l=l+1|0,fs(d,c,r)){u=!0;break e}}u=!1}if(u)return a}while(a!==s);return-1}function gs(e,t,n,r,i,o){if(r<0||t<0||t>(ze(e)-i|0)||r>(ze(n)-i|0))return!1;var s=0;if(s<i)do{var a=s;if(s=s+1|0,!fs(qe(e,t+a|0),qe(n,r+a|0),o))return!1}while(s<i);return!0}function _s(e,t){return Je(Ue(e,t.oa(),t.pa()+1|0))}function ys(e){if(!(e>=0))throw xr(Je("Limit must be non-negative, but was "+e))}function vs(e,t,n,r){return n=n===v?0:n,(r=r!==v&&r)||"string"!=typeof e?function(e,t,n,r,i,o){var s=(o=o!==v&&o)?function(e,t){return q.t(e,t,-1)}(de(n,ps(e)),he(r,0)):$t(he(n,0),de(r,ze(e)));if("string"==typeof e&&"string"==typeof t){var a=s.u_1,u=s.v_1,c=s.w_1;if(c>0&&a<=u||c<0&&u<=a)do{var l=a;if(a=a+c|0,to(t,0,e,l,ze(t),i))return l}while(l!==u)}else{var h=s.u_1,d=s.v_1,f=s.w_1;if(f>0&&h<=d||f<0&&d<=h)do{var p=h;if(h=h+f|0,gs(t,0,e,p,ze(t),i))return p}while(p!==d)}return-1}(e,t,n,ze(e),r):e.indexOf(t,n)}function Es(e){if(e.xa_1<0)e.va_1=0,e.ya_1=null;else{var t;if(e.ab_1.db_1>0?(e.za_1=e.za_1+1|0,t=e.za_1>=e.ab_1.db_1):t=!1,t||e.xa_1>ze(e.ab_1.bb_1))e.ya_1=$t(e.wa_1,ps(e.ab_1.bb_1)),e.xa_1=-1;else{var n=e.ab_1.eb_1(e.ab_1.bb_1,e.xa_1);if(null==n)e.ya_1=$t(e.wa_1,ps(e.ab_1.bb_1)),e.xa_1=-1;else{var r=n.t9(),i=n.u9();e.ya_1=le(e.wa_1,r),e.wa_1=r+i|0,e.xa_1=e.wa_1+(0===i?1:0)|0}}e.va_1=1}}function Ss(e){this.ab_1=e,this.va_1=-1,this.wa_1=function(e,t,n){if(t>n)throw xr("Cannot coerce value to an empty range: maximum "+n+" is less than minimum "+t+".");return e<t?t:e>n?n:e}(e.cb_1,0,ze(e.bb_1)),this.xa_1=this.wa_1,this.ya_1=null,this.za_1=0}function ws(e,t,n,r){this.bb_1=e,this.cb_1=t,this.db_1=n,this.eb_1=r}function Cs(e){return e}function Os(e){return e}function bs(e){return e instanceof Ts?e.fb_1:null}function Ms(){}function Ts(e){this.fb_1=e}function As(e){return new Ts(e)}function Rs(e){Zr(e=e===v?"An operation is not implemented.":e,this),nt(this,Rs)}function Ns(e,t){this.r9_1=e,this.s9_1=t}function Is(e,t){return new Ns(e,t)}return kt(Y,"CharSequence"),kt(Q,"Comparable"),It(J,"Number"),xt(X,"Unit"),It(fe),It(ye,"Char",v,v,[Q]),kt(Ee,"Collection"),kt(ve,"List",v,v,[Ee]),kt(Se,"Set",v,v,[Ee]),kt(we,"Entry"),kt(Ce,"Map"),Pt(Oe),It(be,"Enum",v,v,[Q]),Pt(Te),It(Ae,"Long",v,J,[J,Q]),kt(Ne,"FunctionAdapter"),It(ke),xt(Zt,"Digit"),kt(tn,"Comparator"),It(no,"AbstractCollection",v,v,[Ee]),It(hn,"AbstractMutableCollection",v,no,[no,Ee]),It(dn,"IteratorImpl"),It(pn,"AbstractMutableList",v,hn,[hn,ve,Ee]),It(fn,"SubList",v,pn),It(fo,"AbstractMap",v,v,[Ce]),It(mn,"AbstractMutableMap",v,fo,[fo,Ce]),It(gn,"AbstractMutableSet",v,hn,[hn,Se,Ee]),Pt(En),It(bn,"ArrayList",Sn,pn,[pn,ve,Ee]),It(xn,"HashMap",(function(){return Nn(Qe(rt(xn)))}),mn,[mn,Ce]),It(kn,"HashMapValues",v,hn,[Ee,hn]),It(Dn,"HashMapEntrySetBase",v,gn,[Se,Ee,gn]),It(Pn,"HashMapEntrySet",v,Dn),It($n),It(Ln,"HashMapValuesDefault",v,hn),It(Un,"HashSet",qn,gn,[gn,Se,Ee]),Pt(ir),It(or,"Itr"),It(sr,"KeysItr",v,or),It(ar,"ValuesItr",v,or),It(ur,"EntriesItr",v,or),It(cr,"EntryRef",v,v,[we]),kt(hr,"InternalMap"),It(lr,"InternalHashMap",Gn,v,[hr]),It(pr,"LinkedHashMap",dr,xn,[xn,Ce]),It(yr,"LinkedHashSet",mr,Un,[Un,Se,Ee]),kt(Fo,"Continuation"),It(Sr,"InterceptedCoroutine",v,v,[Fo]),It(vr,"CoroutineImpl",v,Sr,[Sr,Fo]),xt(Er,"CompletedContinuation",v,v,[Fo]),It(Rr,"Exception",(function e(){var t=Mr(Qe(rt(Rr)));return nt(t,e),t}),Error),It(Kr,"RuntimeException",(function e(){var t=Vr(Qe(rt(Kr)));return nt(t,e),t}),Rr),It(qr,"IllegalStateException",(function e(){var t=$r(Qe(rt(qr)));return nt(t,e),t}),Kr),It(wr,"CancellationException",(function e(){var t,n=($r(t=Qe(rt(wr))),wr.call(t),t);return nt(n,e),n}),qr),It(br,v,v,vr),It(kr,"IllegalArgumentException",(function e(){var t=Nr(Qe(rt(kr)));return nt(t,e),t}),Kr),It(Dr,"IndexOutOfBoundsException",(function e(){var t,n=(Vr(t=Qe(rt(Dr))),Dr.call(t),t);return nt(n,e),n}),Kr),It(Ur,"UnsupportedOperationException",Fr,Kr),It(Jr,"NoSuchElementException",Yr,Kr),It(ei,"Error",(function e(){var t=Xr(Qe(rt(ei)));return nt(t,e),t}),Error),It(ti,"AssertionError",(function e(){var t,n=(Xr(t=Qe(rt(ti))),ti.call(t),t);return nt(n,e),n}),ei),It(ri,"ArithmeticException",(function e(){var t,n=(Vr(t=Qe(rt(ri))),ri.call(t),t);return nt(n,e),n}),Kr),It(oi,"ConcurrentModificationException",ii,Kr),It(ai,"NumberFormatException",(function e(){var t,n=(Nr(t=Qe(rt(ai))),ai.call(t),t);return nt(n,e),n}),kr),It(ci,"NullPointerException",ui,Kr),It(hi,"NoWhenBranchMatchedException",li,Kr),It(fi,"ClassCastException",di,Kr),It(mi,"UninitializedPropertyAccessException",(function e(){var t,n=(Vr(t=Qe(rt(mi))),mi.call(t),t);return nt(n,e),n}),Kr),kt(gi,"KClass"),It(_i,"KClassImpl",v,v,[gi]),xt(yi,"NothingKClassImpl",v,_i),It(Ei,"ErrorKClass",Ei,v,[gi]),It(Si,"PrimitiveKClassImpl",v,_i),It(wi,"SimpleKClassImpl",v,_i),xt(Ui,"PrimitiveClasses"),It(Qi,"StringBuilder",Yi,v,[Y]),It(so,"AbstractList",v,no,[no,ve]),It(ro,"SubList",v,so),It(io,"IteratorImpl"),Pt(oo),It(ao),Pt(lo),It(ho,v,v,no),Pt(po),It(mo,"AbstractSet",v,no,[no,Se]),Pt(wo),It(Oo,"ArrayDeque",go,pn),xt(Ao,"EmptyList",v,v,[ve]),It(No,"ArrayAsCollection",v,v,[Ee]),xt(Io,"EmptyIterator"),xt(Po,"EmptyMap",v,v,[Ce]),It(Lo,"IntIterator"),xt(Bo,"EmptySet",v,v,[Se]),xt(zo,"Key"),kt(Go,"CoroutineContext"),kt(Vo,"Element",v,v,[Go]),kt(Uo,"ContinuationInterceptor",v,v,[Vo]),xt(Ho,"EmptyCoroutineContext",v,v,[Go]),It(Xo,"CombinedContext",v,v,[Go]),It(Zo,"AbstractCoroutineContextKey"),It(es,"AbstractCoroutineContextElement",v,v,[Vo]),It(ns,"CoroutineSingletons",v,be),It(rs,"EnumEntriesList",v,so,[ve,so]),Pt(ss),It(hs,"IntProgression"),It(us,"IntRange",v,hs),It(cs,"IntProgressionIterator",v,Lo),Pt(ls),It(Ss),It(ws,"DelimitedRangesSequence"),Pt(Ms),It(Ts,"Failure"),It(Rs,"NotImplementedError",Rs,ei),It(Ns,"Pair"),rt(X).toString=function(){return"kotlin.Unit"},rt(fe).j=function(){return this.x_1.j()},rt(be).k1=function(e){return We(this.j1_1,e.j1_1)},rt(be).d=function(e){return this.k1(e instanceof be?e:st())},rt(be).equals=function(e){return this===e},rt(be).hashCode=function(){return Ke(this)},rt(be).toString=function(){return this.i1_1},rt(Ae).r1=function(e){return dt(this,e)},rt(Ae).d=function(e){return this.r1(e instanceof Ae?e:st())},rt(Ae).s1=function(e){return ft(this,e)},rt(Ae).t1=function(e){return pt(this,e)},rt(Ae).u1=function(e){return gt(this,e)},rt(Ae).v1=function(){return this.w1().s1(new Ae(1,0))},rt(Ae).w1=function(){return new Ae(~this.p1_1,~this.q1_1)},rt(Ae).x1=function(){return this.p1_1},rt(Ae).y1=function(){return _t(this)},rt(Ae).toString=function(){return yt(this,10)},rt(Ae).equals=function(e){return e instanceof Ae&&vt(this,e)},rt(Ae).hashCode=function(){return e=this,Rt(),e.p1_1^e.q1_1;var e},rt(Ae).valueOf=function(){return this.y1()},rt(ke).k=function(){return!(this.a2_1===this.b2_1.length)},rt(ke).l=function(){if(this.a2_1===this.b2_1.length)throw Qr(""+this.a2_1);var e=this.a2_1;return this.a2_1=e+1|0,this.b2_1[e]},rt(hn).n=function(e){this.g2();for(var t=!1,n=e.j();n.k();){var r=n.l();this.h(r)&&(t=!0)}return t},rt(hn).toJSON=function(){return this.toArray()},rt(hn).g2=function(){},rt(dn).k=function(){return this.h2_1<this.j2_1.m()},rt(dn).l=function(){if(!this.k())throw Yr();var e=this.h2_1;return this.h2_1=e+1|0,this.i2_1=e,this.j2_1.q(this.i2_1)},rt(fn).o2=function(e,t){A.p2(e,this.n2_1),this.l2_1.o2(this.m2_1+e|0,t),this.n2_1=this.n2_1+1|0},rt(fn).q=function(e){return A.r2(e,this.n2_1),this.l2_1.q(this.m2_1+e|0)},rt(fn).s2=function(e){A.r2(e,this.n2_1);var t=this.l2_1.s2(this.m2_1+e|0);return this.n2_1=this.n2_1-1|0,t},rt(fn).d2=function(e,t){return A.r2(e,this.n2_1),this.l2_1.d2(this.m2_1+e|0,t)},rt(fn).m=function(){return this.n2_1},rt(fn).g2=function(){return this.l2_1.g2()},rt(pn).h=function(e){return this.g2(),this.o2(this.m(),e),!0},rt(pn).j=function(){return new dn(this)},rt(pn).o=function(e){return this.r(e)>=0},rt(pn).r=function(e){var t;e:{for(var n=0,r=this.j();r.k();){if(Xe(r.l(),e)){t=n;break e}n=n+1|0}t=-1}return t},rt(pn).a1=function(e,t){return new fn(this,e,t)},rt(pn).equals=function(e){return e===this||!(null==e||!Bt(e,ve))&&A.t2(this,e)},rt(pn).hashCode=function(){return A.u2(this)},rt(mn).z2=function(){return new Ln(this)},rt(mn).g1=function(){var e,t=this.y2_1;if(null==t){var n=this.z2();this.y2_1=n,e=n}else e=t;return e},rt(mn).g2=function(){},rt(gn).equals=function(e){return e===this||!(null==e||!Bt(e,Se))&&R.e3(this,e)},rt(gn).hashCode=function(){return R.f3(this)},rt(bn).m=function(){return this.f_1.length},rt(bn).q=function(e){var t=this.f_1[On(this,e)];return null==t||null!=t?t:st()},rt(bn).d2=function(e,t){this.g2(),On(this,e);var n=this.f_1[e];return this.f_1[e]=t,null==n||null!=n?n:st()},rt(bn).h=function(e){return this.g2(),this.f_1.push(e),this.q2_1=this.q2_1+1|0,!0},rt(bn).o2=function(e,t){this.g2(),this.f_1.splice(function(e,t){return A.p2(t,e.m()),t}(this,e),0,t),this.q2_1=this.q2_1+1|0},rt(bn).n=function(e){if(this.g2(),e.p())return!1;for(var t=(a=this,u=e.m(),c=void 0,c=a.m(),a.f_1.length=a.m()+u|0,c),n=0,r=e.j();r.k();){var i=r.l(),o=n;n=o+1|0;var s=sn(o);this.f_1[t+s|0]=i}var a,u,c;return this.q2_1=this.q2_1+1|0,!0},rt(bn).s2=function(e){return this.g2(),On(this,e),this.q2_1=this.q2_1+1|0,e===To(this)?this.f_1.pop():this.f_1.splice(e,1)[0]},rt(bn).r=function(e){return ee(this.f_1,e)},rt(bn).toString=function(){return re(this.f_1,", ","[","]",v,v,Ve)},rt(bn).h3=function(){return[].slice.call(this.f_1)},rt(bn).toArray=function(){return this.h3()},rt(bn).g2=function(){if(this.g_1)throw Fr()},rt(xn).d1=function(e){return this.m3_1.o3(e)},rt(xn).e1=function(e){return this.m3_1.e1(e)},rt(xn).z2=function(){return new kn(this.m3_1)},rt(xn).h1=function(){var e,t=this.n3_1;if(null==t){var n=new Pn(this.m3_1);this.n3_1=n,e=n}else e=t;return e},rt(xn).f1=function(e){return this.m3_1.f1(e)},rt(xn).a3=function(e,t){return this.m3_1.a3(e,t)},rt(xn).m=function(){return this.m3_1.m()},rt(kn).m=function(){return this.p3_1.m()},rt(kn).p=function(){return 0===this.p3_1.m()},rt(kn).q3=function(e){return this.p3_1.e1(e)},rt(kn).o=function(e){return(null==e||null!=e)&&this.q3(null==e||null!=e?e:st())},rt(kn).r3=function(e){throw Fr()},rt(kn).h=function(e){return this.r3(null==e||null!=e?e:st())},rt(kn).s3=function(e){throw Fr()},rt(kn).n=function(e){return this.s3(e)},rt(kn).j=function(){return this.p3_1.t3()},rt(kn).g2=function(){return this.p3_1.u3()},rt(Pn).j=function(){return this.w3_1.x3()},rt(Dn).m=function(){return this.w3_1.m()},rt(Dn).p=function(){return 0===this.w3_1.m()},rt(Dn).y3=function(e){return this.w3_1.a4(e)},rt(Dn).o=function(e){return!(null==e||!Bt(e,we))&&this.y3(null!=e&&Bt(e,we)?e:st())},rt(Dn).z3=function(e){throw Fr()},rt(Dn).h=function(e){return this.z3(null!=e&&Bt(e,we)?e:st())},rt(Dn).n=function(e){throw Fr()},rt(Dn).z=function(e){return this.w3_1.b4(e)},rt(Dn).g2=function(){return this.w3_1.u3()},rt($n).k=function(){return this.c4_1.k()},rt($n).l=function(){return this.c4_1.l().c1()},rt(Ln).r3=function(e){throw zr("Add is not supported on values")},rt(Ln).h=function(e){return this.r3(null==e||null!=e?e:st())},rt(Ln).q3=function(e){return this.d4_1.e1(e)},rt(Ln).o=function(e){return(null==e||null!=e)&&this.q3(null==e||null!=e?e:st())},rt(Ln).j=function(){return new $n(this.d4_1.h1().j())},rt(Ln).m=function(){return this.d4_1.m()},rt(Ln).g2=function(){return this.d4_1.g2()},rt(Un).h=function(e){return null==this.y_1.a3(e,!0)},rt(Un).o=function(e){return this.y_1.o3(e)},rt(Un).p=function(){return 0===this.y_1.m()},rt(Un).j=function(){return this.y_1.e4()},rt(Un).m=function(){return this.y_1.m()},rt(or).y4=function(){for(;this.v4_1<this.u4_1.k4_1&&this.u4_1.h4_1[this.v4_1]<0;)this.v4_1=this.v4_1+1|0},rt(or).k=function(){return this.v4_1<this.u4_1.k4_1},rt(or).z4=function(){if(this.u4_1.m4_1!==this.x4_1)throw ii()},rt(sr).l=function(){if(this.z4(),this.v4_1>=this.u4_1.k4_1)throw Yr();var e=this.v4_1;this.v4_1=e+1|0,this.w4_1=e;var t=this.u4_1.f4_1[this.w4_1];return this.y4(),t},rt(ar).l=function(){if(this.z4(),this.v4_1>=this.u4_1.k4_1)throw Yr();var e=this.v4_1;this.v4_1=e+1|0,this.w4_1=e;var t=ot(this.u4_1.g4_1)[this.w4_1];return this.y4(),t},rt(ur).l=function(){if(this.z4(),this.v4_1>=this.u4_1.k4_1)throw Yr();var e=this.v4_1;this.v4_1=e+1|0,this.w4_1=e;var t=new cr(this.u4_1,this.w4_1);return this.y4(),t},rt(ur).m5=function(){if(this.v4_1>=this.u4_1.k4_1)throw Yr();var e=this.v4_1;this.v4_1=e+1|0,this.w4_1=e;var t=this.u4_1.f4_1[this.w4_1],n=null==t?null:Ze(t),r=null==n?0:n,i=ot(this.u4_1.g4_1)[this.w4_1],o=null==i?null:Ze(i),s=r^(null==o?0:o);return this.y4(),s},rt(ur).n5=function(e){if(this.v4_1>=this.u4_1.k4_1)throw Yr();var t=this.v4_1;this.v4_1=t+1|0,this.w4_1=t;var n=this.u4_1.f4_1[this.w4_1];Xe(n,this.u4_1)?e.q5("(this Map)"):e.p5(n),e.r5(61);var r=ot(this.u4_1.g4_1)[this.w4_1];Xe(r,this.u4_1)?e.q5("(this Map)"):e.p5(r),this.y4()},rt(cr).b1=function(){return this.s5_1.f4_1[this.t5_1]},rt(cr).c1=function(){return ot(this.s5_1.g4_1)[this.t5_1]},rt(cr).equals=function(e){return!(null==e||!Bt(e,we)||!Xe(e.b1(),this.b1()))&&Xe(e.c1(),this.c1())},rt(cr).hashCode=function(){var e=this.b1(),t=null==e?null:Ze(e),n=null==t?0:t,r=this.c1(),i=null==r?null:Ze(r);return n^(null==i?0:i)},rt(cr).toString=function(){return Me(this.b1())+"="+Me(this.c1())},rt(lr).m=function(){return this.n4_1},rt(lr).e1=function(e){return function(e,t){for(var n=e.k4_1;(n=n-1|0)>=0;)if(e.h4_1[n]>=0&&Xe(ot(e.g4_1)[n],t))return n;return-1}(this,e)>=0},rt(lr).f1=function(e){var t=rr(this,e);return t<0?null:ot(this.g4_1)[t]},rt(lr).o3=function(e){return rr(this,e)>=0},rt(lr).a3=function(e,t){var n=function(e,t){e.u3();e:for(;;)for(var n=Zn(e,t),r=de(z(e.j4_1,2),Qn(e)/2|0),i=0;;){var o=e.i4_1[n];if(o<=0){if(e.k4_1>=Yn(e)){Xn(e,1);continue e}var s=e.k4_1;e.k4_1=s+1|0;var a=s;return e.f4_1[a]=t,e.h4_1[a]=n,e.i4_1[n]=a+1|0,e.n4_1=e.n4_1+1|0,Jn(e),i>e.j4_1&&(e.j4_1=i),a}if(Xe(e.f4_1[o-1|0],t))return 0|-o;if((i=i+1|0)>r){tr(e,z(Qn(e),2));continue e}var u=n;n=u-1|0,0===u&&(n=Qn(e)-1|0)}}(this,e),r=function(e){var t=e.g4_1;if(null!=t)return t;var n=_n(Yn(e));return e.g4_1=n,n}(this);if(n<0){var i=r[(0|-n)-1|0];return r[(0|-n)-1|0]=t,i}return r[n]=t,null},rt(lr).equals=function(e){return e===this||!(null==e||!Bt(e,Ce))&&function(e,t){return e.n4_1===t.m()&&e.b4(t.h1())}(this,e)},rt(lr).hashCode=function(){for(var e=0,t=this.x3();t.k();)e=e+t.m5()|0;return e},rt(lr).toString=function(){var e=Hi(z(this.n4_1,3));e.q5("{");for(var t=0,n=this.x3();n.k();)t>0&&e.q5(", "),n.n5(e),t=t+1|0;return e.q5("}"),e.toString()},rt(lr).u3=function(){if(this.o4_1)throw Fr()},rt(lr).a4=function(e){var t=rr(this,e.b1());return!(t<0)&&Xe(ot(this.g4_1)[t],e.c1())},rt(lr).u5=function(e){return this.a4(Bt(e,we)?e:st())},rt(lr).e4=function(){return new sr(this)},rt(lr).t3=function(){return new ar(this)},rt(lr).x3=function(){return new ur(this)},rt(pr).g2=function(){return this.m3_1.u3()},rt(yr).g2=function(){return this.y_1.u3()},rt(vr).k6=function(){return ot(this.j6_1)},rt(vr).l6=function(e){var n,r=this;if(e instanceof Ts)n=null;else{n=null==e||null!=e?e:st()}for(var i=n,o=bs(e);;){var s=r;null==o?s.g6_1=i:(s.e6_1=s.f6_1,s.h6_1=o);try{var a=s.m6();if(a===ts())return t;i=a,o=null}catch(e){i=null,o=e}s.o6();var u=ot(s.d6_1);if(!(u instanceof vr)){if(null!=o){var c=As(ot(o));u.p6(c)}else{var l=i;u.p6(l)}return t}r=u}},rt(vr).p6=function(e){return this.l6(e)},rt(Er).k6=function(){throw Br(Je("This continuation is already complete"))},rt(Er).l6=function(e){throw Br(Je("This continuation is already complete"))},rt(Er).p6=function(e){return this.l6(e)},rt(Er).toString=function(){return"This continuation is already complete"},rt(Sr).q6=function(){var e,t=this.n6_1;if(null==t){var n=this.k6().r6(D),r=null==n?null:n.s6(this),i=null==r?this:r;this.n6_1=i,e=i}else e=t;return e},rt(Sr).o6=function(){var e=this.n6_1;null!=e&&e!==this&&ot(this.k6().r6(D)).t6(e),this.n6_1=C},rt(br).m6=function(){if(null!=this.h6_1)throw this.h6_1;var e=this.f7_1;return"function"==typeof e?e(this.g7_1,this.h7_1):this.f7_1.w6(this.g7_1,this.h7_1)},rt(_i).k7=function(){return this.j7_1},rt(_i).equals=function(e){return!(e instanceof yi)&&!(e instanceof Ei)&&e instanceof _i&&Xe(this.k7(),e.k7())},rt(_i).hashCode=function(){var e=this.i7(),t=null==e?null:tt(e);return null==t?0:t},rt(_i).toString=function(){return"class "+this.i7()},rt(yi).i7=function(){return this.m7_1},rt(yi).k7=function(){throw zr("There's no native JS class for Nothing type")},rt(yi).equals=function(e){return e===this},rt(yi).hashCode=function(){return 0},rt(Ei).i7=function(){throw Br(Je("Unknown simpleName for ErrorKClass"))},rt(Ei).equals=function(e){return e===this},rt(Ei).hashCode=function(){return 0},rt(Si).equals=function(e){return e instanceof Si&&rt(_i).equals.call(this,e)&&this.o7_1===e.o7_1},rt(Si).i7=function(){return this.o7_1},rt(wi).i7=function(){return this.r7_1},rt(Ui).s7=function(){return this.anyClass},rt(Ui).t7=function(){return this.numberClass},rt(Ui).u7=function(){return this.nothingClass},rt(Ui).v7=function(){return this.booleanClass},rt(Ui).w7=function(){return this.byteClass},rt(Ui).x7=function(){return this.shortClass},rt(Ui).y7=function(){return this.intClass},rt(Ui).z7=function(){return this.floatClass},rt(Ui).a8=function(){return this.doubleClass},rt(Ui).b8=function(){return this.arrayClass},rt(Ui).c8=function(){return this.stringClass},rt(Ui).d8=function(){return this.throwableClass},rt(Ui).e8=function(){return this.booleanArrayClass},rt(Ui).f8=function(){return this.charArrayClass},rt(Ui).g8=function(){return this.byteArrayClass},rt(Ui).h8=function(){return this.shortArrayClass},rt(Ui).i8=function(){return this.intArrayClass},rt(Ui).j8=function(){return this.longArrayClass},rt(Ui).k8=function(){return this.floatArrayClass},rt(Ui).l8=function(){return this.doubleArrayClass},rt(Ui).functionClass=function(e){var t,n,r=Ci()[e];if(null==r){var i=new Si(Function,"Function"+e,(n=e,function(e){return"function"==typeof e&&e.length===n}));Ci()[e]=i,t=i}else t=r;return t},rt(Qi).a=function(){return this.o5_1.length},rt(Qi).b=function(e){var t=this.o5_1;if(!(0<=e&&e<=(ze(t)-1|0)))throw Pr("index: "+e+", length: "+this.a()+"}");return qe(t,e)},rt(Qi).c=function(e,t){return this.o5_1.substring(e,t)},rt(Qi).r5=function(e){return this.o5_1=this.o5_1+_e(e),this},rt(Qi).i=function(e){return this.o5_1=this.o5_1+Me(e),this},rt(Qi).p5=function(e){return this.o5_1=this.o5_1+Me(e),this},rt(Qi).q5=function(e){var t=this.o5_1;return this.o5_1=t+(null==e?"null":e),this},rt(Qi).toString=function(){return this.o5_1},rt(no).o=function(e){var t;e:if(Bt(this,Ee)&&this.p())t=!1;else{for(var n=this.j();n.k();)if(Xe(n.l(),e)){t=!0;break e}t=!1}return t},rt(no).z=function(e){var t;e:if(Bt(e,Ee)&&e.p())t=!0;else{for(var n=e.j();n.k();){var r=n.l();if(!this.o(r)){t=!1;break e}}t=!0}return t},rt(no).p=function(){return 0===this.m()},rt(no).toString=function(){return oe(this,", ","[","]",v,v,(e=this,function(t){return t===e?"(this Collection)":Me(t)}));var e},rt(no).toArray=function(){return nn(this)},rt(ro).q=function(e){return A.r2(e,this.o8_1),this.m8_1.q(this.n8_1+e|0)},rt(ro).m=function(){return this.o8_1},rt(io).k=function(){return this.p8_1<this.q8_1.m()},rt(io).l=function(){if(!this.k())throw Yr();var e=this.p8_1;return this.p8_1=e+1|0,this.q8_1.q(e)},rt(oo).r2=function(e,t){if(e<0||e>=t)throw Pr("index: "+e+", size: "+t)},rt(oo).p2=function(e,t){if(e<0||e>t)throw Pr("index: "+e+", size: "+t)},rt(oo).f2=function(e,t,n){if(e<0||t>n)throw Pr("fromIndex: "+e+", toIndex: "+t+", size: "+n);if(e>t)throw xr("fromIndex: "+e+" > toIndex: "+t)},rt(oo).p4=function(e,t){var n=e+(e>>1)|0;return(n-t|0)<0&&(n=t),(n-2147483639|0)>0&&(n=t>2147483639?2147483647:2147483639),n},rt(oo).u2=function(e){for(var t=1,n=e.j();n.k();){var r=n.l(),i=z(31,t),o=null==r?null:Ze(r);t=i+(null==o?0:o)|0}return t},rt(oo).t2=function(e,t){if(e.m()!==t.m())return!1;for(var n=t.j(),r=e.j();r.k();)if(!Xe(r.l(),n.l()))return!1;return!0},rt(so).j=function(){return new io(this)},rt(so).r=function(e){var t;e:{for(var n=0,r=this.j();r.k();){if(Xe(r.l(),e)){t=n;break e}n=n+1|0}t=-1}return t},rt(so).a1=function(e,t){return new ro(this,e,t)},rt(so).equals=function(e){return e===this||!(null==e||!Bt(e,ve))&&A.t2(this,e)},rt(so).hashCode=function(){return A.u2(this)},rt(ao).k=function(){return this.r8_1.k()},rt(ao).l=function(){return this.r8_1.l().c1()},rt(ho).q3=function(e){return this.t8_1.e1(e)},rt(ho).o=function(e){return(null==e||null!=e)&&this.q3(null==e||null!=e?e:st())},rt(ho).j=function(){return new ao(this.t8_1.h1().j())},rt(ho).m=function(){return this.t8_1.m()},rt(fo).d1=function(e){return!(null==co(this,e))},rt(fo).e1=function(e){var t;e:{var n=this.h1();if(Bt(n,Ee)&&n.p())t=!1;else{for(var r=n.j();r.k();)if(Xe(r.l().c1(),e)){t=!0;break e}t=!1}}return t},rt(fo).d3=function(e){if(null==e||!Bt(e,we))return!1;var t=e.b1(),n=e.c1(),r=(Bt(this,Ce)?this:st()).f1(t);return!(!Xe(n,r)||null==r&&!(Bt(this,Ce)?this:st()).d1(t))},rt(fo).equals=function(e){if(e===this)return!0;if(null==e||!Bt(e,Ce))return!1;if(this.m()!==e.m())return!1;var t;e:{var n=e.h1();if(Bt(n,Ee)&&n.p())t=!0;else{for(var r=n.j();r.k();){var i=r.l();if(!this.d3(i)){t=!1;break e}}t=!0}}return t},rt(fo).f1=function(e){var t=co(this,e);return null==t?null:t.c1()},rt(fo).hashCode=function(){return Ze(this.h1())},rt(fo).p=function(){return 0===this.m()},rt(fo).m=function(){return this.h1().m()},rt(fo).toString=function(){return oe(this.h1(),", ","{","}",v,v,(e=this,function(t){return e.s8(t)}));var e},rt(fo).s8=function(e){return uo(this,e.b1())+"="+uo(this,e.c1())},rt(fo).g1=function(){return null==this.c3_1&&(this.c3_1=new ho(this)),ot(this.c3_1)},rt(po).f3=function(e){for(var t=0,n=e.j();n.k();){var r=n.l(),i=t,o=null==r?null:Ze(r);t=i+(null==o?0:o)|0}return t},rt(po).e3=function(e,t){return e.m()===t.m()&&e.z(t)},rt(mo).equals=function(e){return e===this||!(null==e||!Bt(e,Se))&&R.e3(this,e)},rt(mo).hashCode=function(){return R.f3(this)},rt(Oo).m=function(){return this.x8_1},rt(Oo).p=function(){return 0===this.x8_1},rt(Oo).a9=function(e){So(this),_o(this,this.x8_1+1|0),this.v8_1=Eo(this,this.v8_1),this.w8_1[this.v8_1]=e,this.x8_1=this.x8_1+1|0},rt(Oo).b9=function(e){So(this),_o(this,this.x8_1+1|0);var t=this.w8_1,n=this.x8_1;t[yo(this,this.v8_1+n|0)]=e,this.x8_1=this.x8_1+1|0},rt(Oo).c9=function(){if(this.p())throw Qr("ArrayDeque is empty.");So(this);var e=this.v8_1,t=this.w8_1[e],n=null==t||null!=t?t:st();return this.w8_1[this.v8_1]=null,this.v8_1=vo(this,this.v8_1),this.x8_1=this.x8_1-1|0,n},rt(Oo).d9=function(){return this.p()?null:this.c9()},rt(Oo).e9=function(){if(this.p())throw Qr("ArrayDeque is empty.");So(this);var e=To(this),t=yo(this,this.v8_1+e|0),n=this.w8_1[t],r=null==n||null!=n?n:st();return this.w8_1[t]=null,this.x8_1=this.x8_1-1|0,r},rt(Oo).h=function(e){return this.b9(e),!0},rt(Oo).o2=function(e,n){if(A.p2(e,this.x8_1),e===this.x8_1)return this.b9(n),t;if(0===e)return this.a9(n),t;So(this),_o(this,this.x8_1+1|0);var r=yo(this,this.v8_1+e|0);if(e<this.x8_1+1>>1){var i=Eo(this,r),o=Eo(this,this.v8_1);i>=this.v8_1?(this.w8_1[o]=this.w8_1[this.v8_1],cn(this.w8_1,this.w8_1,this.v8_1,this.v8_1+1|0,i+1|0)):(cn(this.w8_1,this.w8_1,this.v8_1-1|0,this.v8_1,this.w8_1.length),this.w8_1[this.w8_1.length-1|0]=this.w8_1[0],cn(this.w8_1,this.w8_1,0,1,i+1|0)),this.w8_1[i]=n,this.v8_1=o}else{var s=this.x8_1,a=yo(this,this.v8_1+s|0);r<a?cn(this.w8_1,this.w8_1,r+1|0,r,a):(cn(this.w8_1,this.w8_1,1,0,a),this.w8_1[0]=this.w8_1[this.w8_1.length-1|0],cn(this.w8_1,this.w8_1,r+1|0,r,this.w8_1.length-1|0)),this.w8_1[r]=n}this.x8_1=this.x8_1+1|0},rt(Oo).n=function(e){if(e.p())return!1;So(this),_o(this,this.x8_1+e.m()|0);var t=this.x8_1;return function(e,t,n){var r=n.j(),i=t,o=e.w8_1.length;if(i<o)e:do{var s=i;if(i=i+1|0,!r.k())break e;e.w8_1[s]=r.l()}while(i<o);var a=0,u=e.v8_1;if(a<u)e:do{var c=a;if(a=a+1|0,!r.k())break e;e.w8_1[c]=r.l()}while(a<u);e.x8_1=e.x8_1+n.m()|0}(this,yo(this,this.v8_1+t|0),e),!0},rt(Oo).q=function(e){A.r2(e,this.x8_1);var t=yo(this,this.v8_1+e|0),n=this.w8_1[t];return null==n||null!=n?n:st()},rt(Oo).d2=function(e,t){A.r2(e,this.x8_1);var n=yo(this,this.v8_1+e|0),r=this.w8_1[n],i=null==r||null!=r?r:st();return this.w8_1[n]=t,i},rt(Oo).o=function(e){return!(-1===this.r(e))},rt(Oo).r=function(e){var t=this.x8_1,n=yo(this,this.v8_1+t|0);if(this.v8_1<n){var r=this.v8_1;if(r<n)do{var i=r;if(r=r+1|0,Xe(e,this.w8_1[i]))return i-this.v8_1|0}while(r<n)}else if(this.v8_1>=n){var o=this.v8_1,s=this.w8_1.length;if(o<s)do{var a=o;if(o=o+1|0,Xe(e,this.w8_1[a]))return a-this.v8_1|0}while(o<s);var u=0;if(u<n)do{var c=u;if(u=u+1|0,Xe(e,this.w8_1[c]))return(c+this.w8_1.length|0)-this.v8_1|0}while(u<n)}return-1},rt(Oo).s2=function(e){if(A.r2(e,this.x8_1),e===To(this))return this.e9();if(0===e)return this.c9();So(this);var t=yo(this,this.v8_1+e|0),n=this.w8_1[t],r=null==n||null!=n?n:st();if(e<this.x8_1>>1)t>=this.v8_1?cn(this.w8_1,this.w8_1,this.v8_1+1|0,this.v8_1,t):(cn(this.w8_1,this.w8_1,1,0,t),this.w8_1[0]=this.w8_1[this.w8_1.length-1|0],cn(this.w8_1,this.w8_1,this.v8_1+1|0,this.v8_1,this.w8_1.length-1|0)),this.w8_1[this.v8_1]=null,this.v8_1=vo(this,this.v8_1);else{var i=To(this),o=yo(this,this.v8_1+i|0);t<=o?cn(this.w8_1,this.w8_1,t,t+1|0,o+1|0):(cn(this.w8_1,this.w8_1,t,t+1|0,this.w8_1.length),this.w8_1[this.w8_1.length-1|0]=this.w8_1[0],cn(this.w8_1,this.w8_1,0,1,o+1|0)),this.w8_1[o]=null}return this.x8_1=this.x8_1-1|0,r},rt(Oo).f9=function(e){var t=e.length>=this.x8_1?e:function(e,t){return Ie(Array(t),null)}(0,this.x8_1),n=jt(t)?t:st(),r=this.x8_1,i=yo(this,this.v8_1+r|0);this.v8_1<i?cn(this.w8_1,n,0,this.v8_1,i):this.p()||(cn(this.w8_1,n,0,this.v8_1,this.w8_1.length),cn(this.w8_1,n,this.w8_1.length-this.v8_1|0,0,i));var o=function(e,t){return t}(this.x8_1,n);return jt(o)?o:st()},rt(Oo).h3=function(){var e=this.x8_1,t=Ie(Array(e),null);return this.f9(t)},rt(Oo).toArray=function(){return this.h3()},rt(Ao).equals=function(e){return!(null==e||!Bt(e,ve))&&e.p()},rt(Ao).hashCode=function(){return 1},rt(Ao).toString=function(){return"[]"},rt(Ao).m=function(){return 0},rt(Ao).p=function(){return!0},rt(Ao).h9=function(e){return!1},rt(Ao).o=function(e){return!1},rt(Ao).i9=function(e){return e.p()},rt(Ao).z=function(e){return this.i9(e)},rt(Ao).q=function(e){throw Pr("Empty list doesn't contain element at index "+e+".")},rt(Ao).j9=function(e){return-1},rt(Ao).r=function(e){return-1},rt(Ao).j=function(){return x},rt(Ao).a1=function(e,t){if(0===e&&0===t)return this;throw Pr("fromIndex: "+e+", toIndex: "+t)},rt(No).m=function(){return this.k9_1.length},rt(No).p=function(){return 0===this.k9_1.length},rt(No).m9=function(e){return function(e,t){return ee(e,t)>=0}(this.k9_1,e)},rt(No).o=function(e){return(null==e||null!=e)&&this.m9(null==e||null!=e?e:st())},rt(No).n9=function(e){var t;e:if(Bt(e,Ee)&&e.p())t=!0;else{for(var n=e.j();n.k();){var r=n.l();if(!this.m9(r)){t=!1;break e}}t=!0}return t},rt(No).z=function(e){return this.n9(e)},rt(No).j=function(){return xe(this.k9_1)},rt(Io).k=function(){return!1},rt(Io).l=function(){throw Yr()},rt(Po).equals=function(e){return!(null==e||!Bt(e,Ce))&&e.p()},rt(Po).hashCode=function(){return 0},rt(Po).toString=function(){return"{}"},rt(Po).m=function(){return 0},rt(Po).p=function(){return!0},rt(Po).p9=function(e){return!1},rt(Po).d1=function(e){return(null==e||null!=e)&&this.p9(null==e||null!=e?e:st())},rt(Po).q9=function(e){return null},rt(Po).f1=function(e){return null!=e&&null==e?null:this.q9(null==e||null!=e?e:st())},rt(Po).h1=function(){return jo()},rt(Po).g1=function(){return Ro()},rt(Lo).l=function(){return this.v9()},rt(Bo).equals=function(e){return!(null==e||!Bt(e,Se))&&e.p()},rt(Bo).hashCode=function(){return 0},rt(Bo).toString=function(){return"[]"},rt(Bo).m=function(){return 0},rt(Bo).p=function(){return!0},rt(Bo).h9=function(e){return!1},rt(Bo).o=function(e){return!1},rt(Bo).i9=function(e){return e.p()},rt(Bo).z=function(e){return this.i9(e)},rt(Bo).j=function(){return x},rt(Ho).r6=function(e){return null},rt(Ho).ca=function(e,t){return e},rt(Ho).da=function(e){return e},rt(Ho).ba=function(e){return this},rt(Ho).hashCode=function(){return 0},rt(Ho).toString=function(){return"EmptyCoroutineContext"},rt(Xo).r6=function(e){for(var t=this;;){var n=t.ga_1.r6(e);if(null!=n)return n;var r=t.fa_1;if(!(r instanceof Xo))return r.r6(e);t=r}},rt(Xo).ca=function(e,t){return t(this.fa_1.ca(e,t),this.ga_1)},rt(Xo).ba=function(e){if(null!=this.ga_1.r6(e))return this.fa_1;var t=this.fa_1.ba(e);return t===this.fa_1?this:t===Ko()?this.ga_1:new Xo(t,this.ga_1)},rt(Xo).equals=function(e){return this===e||!!(e instanceof Xo&&Yo(e)===Yo(this))&&function(e,t){for(var n=t;;){if(!Qo(e,n.ga_1))return!1;var r=n.fa_1;if(!(r instanceof Xo))return Qo(e,Bt(r,Vo)?r:st());n=r}}(e,this)},rt(Xo).hashCode=function(){return Ze(this.fa_1)+Ze(this.ga_1)|0},rt(Xo).toString=function(){return"["+this.ca("",Jo)+"]"},rt(Zo).z9=function(e){return this.x9_1(e)},rt(Zo).aa=function(e){return e===this||this.y9_1===e},rt(es).b1=function(){return this.ha_1},rt(rs).m=function(){return this.ia_1.length},rt(rs).q=function(e){return A.r2(e,this.ia_1.length),this.ia_1[e]},rt(rs).ja=function(e){return null!==e&&ie(this.ia_1,e.j1_1)===e},rt(rs).o=function(e){return e instanceof be&&this.ja(e instanceof be?e:st())},rt(rs).ka=function(e){if(null===e)return-1;var t=e.j1_1;return ie(this.ia_1,t)===e?t:-1},rt(rs).r=function(e){return e instanceof be?this.ka(e instanceof be?e:st()):-1},rt(us).oa=function(){return this.u_1},rt(us).pa=function(){return this.v_1},rt(us).p=function(){return this.u_1>this.v_1},rt(us).equals=function(e){return e instanceof us&&(this.p()&&e.p()||this.u_1===e.u_1&&this.v_1===e.v_1)},rt(us).hashCode=function(){return this.p()?-1:z(31,this.u_1)+this.v_1|0},rt(us).toString=function(){return this.u_1+".."+this.v_1},rt(cs).k=function(){return this.sa_1},rt(cs).v9=function(){var e=this.ta_1;if(e===this.ra_1){if(!this.sa_1)throw Yr();this.sa_1=!1}else this.ta_1=this.ta_1+this.qa_1|0;return e},rt(ls).t=function(e,t,n){return new hs(e,t,n)},rt(hs).j=function(){return new cs(this.u_1,this.v_1,this.w_1)},rt(hs).p=function(){return this.w_1>0?this.u_1>this.v_1:this.u_1<this.v_1},rt(hs).equals=function(e){return e instanceof hs&&(this.p()&&e.p()||this.u_1===e.u_1&&this.v_1===e.v_1&&this.w_1===e.w_1)},rt(hs).hashCode=function(){return this.p()?-1:z(31,z(31,this.u_1)+this.v_1|0)+this.w_1|0},rt(hs).toString=function(){return this.w_1>0?this.u_1+".."+this.v_1+" step "+this.w_1:this.u_1+" downTo "+this.v_1+" step "+(0|-this.w_1)},rt(Ss).l=function(){if(-1===this.va_1&&Es(this),0===this.va_1)throw Yr();var e=this.ya_1,t=e instanceof us?e:st();return this.ya_1=null,this.va_1=-1,t},rt(Ss).k=function(){return-1===this.va_1&&Es(this),1===this.va_1},rt(ws).j=function(){return new Ss(this)},rt(Ts).equals=function(e){return e instanceof Ts&&Xe(this.fb_1,e.fb_1)},rt(Ts).hashCode=function(){return Ze(this.fb_1)},rt(Ts).toString=function(){return"Failure("+this.fb_1.toString()+")"},rt(Ns).toString=function(){return"("+Me(this.r9_1)+", "+Me(this.s9_1)+")"},rt(Ns).t9=function(){return this.r9_1},rt(Ns).u9=function(){return this.s9_1},rt(Ns).hashCode=function(){var e=null==this.r9_1?0:Ze(this.r9_1);return z(e,31)+(null==this.s9_1?0:Ze(this.s9_1))|0},rt(Ns).equals=function(e){if(this===e)return!0;if(!(e instanceof Ns))return!1;var t=e instanceof Ns?e:st();return!!Xe(this.r9_1,t.r9_1)&&!!Xe(this.s9_1,t.s9_1)},rt(lr).b4=function(e){var t;e:if(Bt(e,Ee)&&e.p())t=!0;else{for(var n=e.j();n.k();){var r=n.l();if(null==r||!Bt(r,we)||!this.u5(r)){t=!1;break e}}t=!0}return t},rt(Xo).da=W,rt(es).r6=G,rt(es).ca=H,rt(es).ba=K,rt(es).da=W,t=new X,new Oe,w=null,new ir,C=new Er,A=new oo,new lo,R=new po,x=new Io,D=new zo,q=new ls,F=new Ms,e.$_$=e.$_$||{},e.$_$.a=function(e){var t;switch(typeof e){case"string":t=Vi().stringClass;break;case"number":t=(0|e)===e?Vi().intClass:Vi().doubleClass;break;case"boolean":t=Vi().booleanClass;break;case"function":t=Vi().functionClass(e.length);break;default:var n;if(Ft(e))n=Vi().booleanArrayClass;else if(Vt(e))n=Vi().charArrayClass;else if(zt(e))n=Vi().byteArrayClass;else if(Ut(e))n=Vi().shortArrayClass;else if(Wt(e))n=Vi().intArrayClass;else if(Ht(e))n=Vi().longArrayClass;else if(Gt(e))n=Vi().floatArrayClass;else if(Kt(e))n=Vi().doubleArrayClass;else if(Bt(e,gi))n=Wi(gi);else if(jt(e))n=Vi().arrayClass;else{var r=Object.getPrototypeOf(e).constructor;n=r===Object?Vi().anyClass:r===Error?Vi().throwableClass:Gi(r)}t=n}return t},e.$_$.b=v,e.$_$.c=go,e.$_$.d=wn,e.$_$.e=Sn,e.$_$.f=zn,e.$_$.g=qn,e.$_$.h=fr,e.$_$.i=dr,e.$_$.j=mr,e.$_$.k=function e(t){var n=function(e,t){return Lr(e,t),wr.call(t),t}(t,Qe(rt(wr)));return nt(n,e),n},e.$_$.l=function(e,t,n){return jr(e,t,n),wr.call(n),n},e.$_$.m=Yi,e.$_$.n=function e(t){var n=function(e,t){return Zr(e,t),ti.call(t),t}(t,Qe(rt(ti)));return nt(n,e),n},e.$_$.o=function e(t){var n=function(e,t){return Wr(e,t),oi.call(t),t}(t,Qe(rt(oi)));return nt(n,e),n},e.$_$.p=function(e,t,n){return it(n,e,t),ei.call(n),n},e.$_$.q=xr,e.$_$.r=Br,e.$_$.s=function e(t,n){var r=jr(t,n,Qe(rt(qr)));return nt(r,e),r},e.$_$.t=Yr,e.$_$.u=Wr,e.$_$.v=Hr,e.$_$.w=function e(t,n){var r=Hr(t,n,Qe(rt(Kr)));return nt(r,e),r},e.$_$.x=Fr,e.$_$.y=zr,e.$_$.z=pe,e.$_$.a1=Cs,e.$_$.b1=bs,e.$_$.c1=function(e){return!(e instanceof Ts)},e.$_$.d1=Os,e.$_$.e1=D,e.$_$.f1=Ko,e.$_$.g1=F,e.$_$.h1=t,e.$_$.i1=no,e.$_$.j1=fo,e.$_$.k1=mn,e.$_$.l1=mo,e.$_$.m1=bn,e.$_$.n1=Ee,e.$_$.o1=ve,e.$_$.p1=we,e.$_$.q1=Ce,e.$_$.r1=Se,e.$_$.s1=$o,e.$_$.t1=cn,e.$_$.u1=xo,e.$_$.v1=function(e,t){return Bt(e,Ee)?e.o(t):function(e,t){if(Bt(e,ve))return e.r(t);for(var n=0,r=e.j();r.k();){var i=r.l();if(sn(n),Xe(t,i))return n;n=n+1|0}return-1}(e,t)>=0},e.$_$.w1=Xt,e.$_$.x1=an,e.$_$.y1=function(e,t){if(!(t>=0))throw xr(Je("Requested element count "+t+" is less than zero."));return function(e,t){if(!(t>=0))throw xr(Je("Requested element count "+t+" is less than zero."));if(0===t)return bo();var n=e.length;if(t>=n)return Z(e);if(1===t)return rn(e[n-1|0]);var r=wn(t),i=n-t|0;if(i<n)do{var o=i;i=i+1|0,r.h(e[o])}while(i<n);return r}(e,he(e.length-t|0,0))},e.$_$.z1=bo,e.$_$.a2=ko,e.$_$.b2=function(e){if(e.p())throw Qr("List is empty.");return e.q(0)},e.$_$.c2=function(e,t){return 0<=t&&t<e.m()?e.q(t):null},e.$_$.d2=rn,e.$_$.e2=function(e){return e.length>0?Jt(e):bo()},e.$_$.f2=on,e.$_$.g2=Mo,e.$_$.h2=function(e,t){var n=function(e){return Bt(e,Ee)?e.m():null}(t),r=null==n?null:e.m()+n|0,i=_r(null==r?z(e.m(),2):r);return i.n(e),$o(i,t),i},e.$_$.i2=function(e,t){var n=_r(e.m()+1|0);return n.n(e),n.h(t),n},e.$_$.j2=function(e,t){if(Bt(t,Ee)){var n=wn(e.m()+t.m()|0);return n.n(e),n.n(t),n}var r=Cn(e);return $o(r,t),r},e.$_$.k2=function(e,t){var n=wn(e.m()+1|0);return n.n(e),n.h(t),n},e.$_$.l2=function(e){return e.p()?null:e.s2(0)},e.$_$.m2=function(e){return function(e){switch(e.length){case 0:return qo();case 1:return ln(e[0]);default:return ne(e,_r(e.length))}}(e)},e.$_$.n2=function(e,n){if(Bt(e,Ee)){if(e.m()<=1)return se(e);var r=an(e),i=jt(r)?r:st();return function(e,t){e.length>1&&Mn(e,t)}(i,n),Jt(i)}var o=ce(e);return function(e,n){!function(e,n){if(e.m()<=1)return t;var r=an(e);Mn(r,n);var i=0,o=r.length;if(i<o)do{var s=i;i=i+1|0,e.d2(s,r[s])}while(i<o)}(e,n)}(o,n),o},e.$_$.o2=se,e.$_$.p2=function(e){if(Bt(e,Ee)){var t;switch(e.m()){case 0:t=ko();break;case 1:t=un(Bt(e,ve)?e.q(0):e.j().l());break;default:t=Do(e,fr(e.m()))}return t}return function(e){return 0===e.m()?ko():e}(Do(e,dr()))},e.$_$.q2=function(e){if(Bt(e,Ee)){var t;switch(e.m()){case 0:t=qo();break;case 1:t=ln(Bt(e,ve)?e.q(0):e.j().l());break;default:t=ae(e,_r(e.m()))}return t}return function(e){switch(e.m()){case 0:return qo();case 1:return ln(e.j().l());default:return e}}(ae(e,mr()))},e.$_$.r2=function(e,t){var n=function(e){return Bt(e,Ee)?(t=e,function(e,t){return function(e,t){Bn(Hn(e.m(),Qe(rt(lr))),t);for(var n=e.j();n.k();){var r=n.l();t.y_1.a3(r,!0)}}(e,t),yr.call(t),t}(t,Qe(rt(yr)))):ae(e,mr());var t}(e);return $o(n,t),n},e.$_$.s2=function(e,t){for(var n=e.j(),r=t.j(),i=xo(e,10),o=xo(t,10),s=wn(Math.min(i,o));n.k()&&r.k();){var a=Is(n.l(),r.l());s.h(a)}return s},e.$_$.t2=function(e,t){return e===t?0:null==e?-1:null==t?1:We(null!=e&&("string"===(r=typeof(n=e))||"boolean"===r||qt(n)||Bt(n,Q))?e:st(),t);var n,r},e.$_$.u2=wr,e.$_$.v2=ts,e.$_$.w2=Or,e.$_$.x2=Cr,e.$_$.y2=function(e,t,n){return"function"==typeof e?e(t,n):e.w6(t,n)},e.$_$.z2=es,e.$_$.a3=Zo,e.$_$.b3=function(e){if(e instanceof Zo){var t;if(e.aa(this.b1())){var n=e.z9(this);t=null!=n&&Bt(n,Vo)?n:null}else t=null;return t}return D===e?Bt(this,Vo)?this:st():null},e.$_$.c3=function(e){return e instanceof Zo?e.aa(this.b1())&&null!=e.z9(this)?Ko():this:D===e?Ko():this},e.$_$.d3=Uo,e.$_$.e3=Fo,e.$_$.f3=H,e.$_$.g3=G,e.$_$.h3=K,e.$_$.i3=Vo,e.$_$.j3=W,e.$_$.k3=vr,e.$_$.l3=function(e,n,r){var i=Cr(Or(e,n,r)),o=t;i.p6(o)},e.$_$.m3=function(e){return new rs(e)},e.$_$.n3=Ne,e.$_$.o3=et,e.$_$.p3=xe,e.$_$.q3=nt,e.$_$.r3=function(e){var t=new Uint16Array(e);return t.$type$="CharArray",t},e.$_$.s3=ze,e.$_$.t3=We,e.$_$.u3=Xe,e.$_$.v3=Ie,e.$_$.w3=Be,e.$_$.x3=tt,e.$_$.y3=Ze,e.$_$.z3=It,e.$_$.a4=Pt,e.$_$.b4=function(e,t,n,r){It(e,"Coroutine",v,t,n,r,v,v)},e.$_$.c4=kt,e.$_$.d4=function(e,t,n,r){It(e,"Lambda",v,t,n,r,v,v)},e.$_$.e4=xt,e.$_$.f4=jt,e.$_$.g4=Bt,e.$_$.h4=function(e,t){if("function"==typeof e)return e.$arity===t;var n=null==e?null:e.constructor,r=null==n?null:n.$metadata$,i=null==r?null:r.suspendArity;if(null==i)return!1;var o=i,s=!1,a=0,u=o.length;e:for(;a<u;){var c=o[a];if(a=a+1|0,t===c){s=!0;break e}}return s},e.$_$.i4=Qe,e.$_$.j4=rt,e.$_$.k4=Je,e.$_$.l4=he,e.$_$.m4=function(e,t){return function(e,t){if(!e)throw xr("Step must be positive, was: "+Je(t)+".")}(t>0,t),q.t(e.u_1,e.v_1,e.w_1>0?t:0|-t)},e.$_$.n4=le,e.$_$.o4=function(e){var t;e:{for(var n=0;n<ze(e);){var r=qe(e,n);if(n=n+1|0,!Xi(r)){t=!1;break e}}t=!0}return t},e.$_$.p4=function(e,t){if(function(e,t,n){return(n=n!==v&&n)||"string"!=typeof e||"string"!=typeof t?gs(e,0,t,0,ze(t),n):eo(e,t)}(e,t)){var n=ze(t);return e.substring(n)}return e},e.$_$.q4=function(e,t,n,r){if(n=n!==v&&n,r=r===v?0:r,1===t.length)return function(e,t,n,r){ys(r);var i=0,o=vs(e,t,i,n);if(-1===o||1===r)return rn(Je(e));var s=r>0,a=wn(s?de(r,10):10);e:do{var u=Je(Ue(e,i,o));if(a.h(u),i=o+t.length|0,s&&a.m()===(r-1|0))break e;o=vs(e,t,i,n)}while(-1!==o);var c=Je(Ue(e,i,ze(e)));return a.h(c),a}(e,_e(t[0]),n,r);for(var i=function(e){return new fe(e)}(function(e,t,n,r,i){return n=n===v?0:n,r=r!==v&&r,ys(i=i===v?0:i),new ws(e,n,i,(o=t,s=r,function(e,t){var n=ms(e,o,t,s);return n<0?null:Is(n,1)}));var o,s}(e,t,v,n,r)),o=wn(xo(i,10)),s=i.j();s.k();){var a=_s(e,s.l());o.h(a)}return o},e.$_$.r4=eo,e.$_$.s4=function(e){var t,n=function(e){return function(e,t){!function(e){if(!(2<=e&&e<=36))throw xr("radix "+e+" was not in valid range 2..36")}(t);var n,r,i,o=e.length;if(0===o)return null;var s=qe(e,0);if(me(s,48)<0){if(1===o)return null;if(n=1,45===s)r=!0,i=-2147483648;else{if(43!==s)return null;r=!1,i=-2147483647}}else n=0,r=!1,i=-2147483647;var a=-59652323,u=a,c=0,l=n;if(l<o)do{var h=l;l=l+1|0;var d=Zi(qe(e,h),t);if(d<0)return null;if(c<u){if(u!==a)return null;if(c<(u=i/t|0))return null}if((c=z(c,t))<(i+d|0))return null;c=c-d|0}while(l<o);return r?c:0|-c}(e,10)}(e);return null==n?function(e){throw si("Invalid number format: '"+e+"'")}(e):t=n,t},e.$_$.t4=tn,e.$_$.u4=be,e.$_$.v4=ei,e.$_$.w4=Rr,e.$_$.x4=Ae,e.$_$.y4=Ns,e.$_$.z4=Kr,e.$_$.a5=st,e.$_$.b5=Ur,e.$_$.c5=function(e,t){if(e!==t){var n=e._suppressed;null==n?e._suppressed=Mo([t]):n.h(t)}},e.$_$.d5=function(e){var t=e;return(65535&(t=(16711935&(t=(252645135&(t=(858993459&(t=(1431655765&t)+(t>>>1&1431655765)|0))+(t>>>2&858993459)|0))+(t>>>4&252645135)|0))+(t>>>8&16711935)|0))+(t>>>16|0)|0},e.$_$.e5=As,e.$_$.f5=ot,e.$_$.g5=function(){throw li()},e.$_$.h5=function(e){throw pi("lateinit property "+e+" has not been initialized")},e.$_$.i5=Me,e.$_$.j5=Is,e})?n.apply(t,[t]):n)||(e.exports=r)},36411:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Explain=t.ExplainVerbosity=void 0,t.validateExplainTimeoutOptions=function(e,t){const{maxTimeMS:n,timeoutMS:i}=e;if(null!=i&&(null!=n||null!=t?.maxTimeMS))throw new r.MongoAPIError("Cannot use maxTimeMS with timeoutMS for explain commands.")},t.decorateWithExplain=function(e,t){const{verbosity:n,maxTimeMS:r}=t,i={explain:e,verbosity:n};return"number"==typeof r&&(i.maxTimeMS=r),i};const r=n(17562);t.ExplainVerbosity=Object.freeze({queryPlanner:"queryPlanner",queryPlannerExtended:"queryPlannerExtended",executionStats:"executionStats",allPlansExecution:"allPlansExecution"});class i{constructor(e,n){this.verbosity="boolean"==typeof e?e?t.ExplainVerbosity.allPlansExecution:t.ExplainVerbosity.queryPlanner:e,this.maxTimeMS=n}static fromOptions({explain:e}={}){if(null==e)return;if("boolean"==typeof e||"string"==typeof e)return new i(e);const{verbosity:t,maxTimeMS:n}=e;return new i(t,n)}}t.Explain=i},36649:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ExplainableCursor=void 0;const r=n(61066);class i extends r.AbstractCursor{resolveExplainTimeoutOptions(e,t){let n,r;return null==e&&null==t?(n=void 0,r=void 0):null!=e&&null==t?(n="object"!=typeof e||"verbosity"in e?e:void 0,r="object"==typeof e&&"timeoutMS"in e?e:void 0):(n=e,r=t),{timeout:r,explain:n}}}t.ExplainableCursor=i},37057:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.InternalSchemaBasedAccessor=void 0,t.InternalSchemaBasedAccessor=class{constructor(e,t){this.internalSchema=e,this.converters=t}async getInternalSchema(){return this.internalSchema}async getStandardJsonSchema(e={}){var t;return null!==(t=this.standardJSONSchema)&&void 0!==t?t:this.standardJSONSchema=await this.converters.internalToStandard(this.internalSchema,e)}async getMongoDBJsonSchema(e={}){var t;return null!==(t=this.mongodbJSONSchema)&&void 0!==t?t:this.mongodbJSONSchema=await this.converters.internalToMongoDB(this.internalSchema,e)}async getExpandedJSONSchema(e={}){var t;return null!==(t=this.expandedJSONSchema)&&void 0!==t?t:this.expandedJSONSchema=await this.converters.internalToExpanded(this.internalSchema,e)}}},38216:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.SENSITIVE_COMMANDS=t.CommandFailedEvent=t.CommandSucceededEvent=t.CommandStartedEvent=void 0;const r=n(91869),i=n(145),o=n(15620);t.CommandStartedEvent=class{constructor(e,n,i){this.name=r.COMMAND_STARTED;const o=d(n),s=a(o),{address:u,connectionId:l,serviceId:h}=f(e);t.SENSITIVE_COMMANDS.has(s)&&(this.commandObj={},this.commandObj[s]=!0),this.address=u,this.connectionId=l,this.serviceId=h,this.requestId=n.requestId,this.databaseName=n.databaseName,this.commandName=s,this.command=c(s,o,o),this.serverConnectionId=i}get hasServiceId(){return!!this.serviceId}},t.CommandSucceededEvent=class{constructor(e,t,n,o,s){this.name=r.COMMAND_SUCCEEDED;const u=d(t),l=a(u),{address:h,connectionId:p,serviceId:m}=f(e);this.address=h,this.connectionId=p,this.serviceId=m,this.requestId=t.requestId,this.commandName=l,this.duration=(0,i.calculateDurationInMs)(o),this.reply=c(l,u,function(e){return e&&e.result?e.result:e}(n)),this.serverConnectionId=s,this.databaseName=t.databaseName}get hasServiceId(){return!!this.serviceId}},t.CommandFailedEvent=class{constructor(e,t,n,o,s){this.name=r.COMMAND_FAILED;const u=d(t),l=a(u),{address:h,connectionId:p,serviceId:m}=f(e);this.address=h,this.connectionId=p,this.serviceId=m,this.requestId=t.requestId,this.commandName=l,this.duration=(0,i.calculateDurationInMs)(o),this.failure=c(l,u,n),this.serverConnectionId=s,this.databaseName=t.databaseName}get hasServiceId(){return!!this.serviceId}},t.SENSITIVE_COMMANDS=new Set(["authenticate","saslStart","saslContinue","getnonce","createUser","updateUser","copydbgetnonce","copydbsaslstart","copydb"]);const s=new Set(["hello",r.LEGACY_HELLO_COMMAND,r.LEGACY_HELLO_COMMAND_CAMEL_CASE]),a=e=>Object.keys(e)[0],u=e=>e.ns.split(".")[1],c=(e,n,r)=>t.SENSITIVE_COMMANDS.has(e)||s.has(e)&&n.speculativeAuthenticate?{}:r,l={$query:"filter",$orderby:"sort",$hint:"hint",$comment:"comment",$maxScan:"maxScan",$max:"max",$min:"min",$returnKey:"returnKey",$showDiskLoc:"showRecordId",$maxTimeMS:"maxTimeMS",$snapshot:"snapshot"},h={numberToSkip:"skip",numberToReturn:"batchSize",returnFieldSelector:"projection"};function d(e){if(e instanceof o.OpMsgRequest){const t={...e.command};return t.ops instanceof o.DocumentSequence&&(t.ops=t.ops.documents),t.nsInfo instanceof o.DocumentSequence&&(t.nsInfo=t.nsInfo.documents),t}if(e.query?.$query){let t;return"admin.$cmd"===e.ns?t=Object.assign({},e.query.$query):(t={find:u(e)},Object.keys(l).forEach((n=>{null!=e.query[n]&&(t[l[n]]={...e.query[n]})}))),Object.keys(h).forEach((n=>{const r=n;null!=e[r]&&(t[h[r]]=e[r])})),t}let t={};const n={...e};return e.query&&(t={...e.query},n.query=t),e.query?t:n}function f(e){let t;return"id"in e&&(t=e.id),{address:e.address,serviceId:e.serviceId,connectionId:t}}},38944:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.MongoClientAuthProviders=void 0;const r=n(95750),i=n(21119),o=n(63257),s=n(88822),a=n(50373),u=n(8294),c=n(70839),l=n(93065),h=n(35293),d=n(64647),f=n(17562),p=new Map([[l.AuthMechanism.MONGODB_AWS,({AWS_CREDENTIAL_PROVIDER:e})=>new i.MongoDBAWS(e)],[l.AuthMechanism.MONGODB_CR,()=>{throw new f.MongoInvalidArgumentError("MONGODB-CR is no longer a supported auth mechanism in MongoDB 4.0+")}],[l.AuthMechanism.MONGODB_GSSAPI,()=>new r.GSSAPI],[l.AuthMechanism.MONGODB_OIDC,e=>new o.MongoDBOIDC(function(e){if(e.OIDC_HUMAN_CALLBACK)return new a.HumanCallbackWorkflow(new u.TokenCache,e.OIDC_HUMAN_CALLBACK);if(e.OIDC_CALLBACK)return new s.AutomatedCallbackWorkflow(new u.TokenCache,e.OIDC_CALLBACK);{const t=e.ENVIRONMENT,n=o.OIDC_WORKFLOWS.get(t)?.();if(!n)throw new f.MongoInvalidArgumentError(`Could not load workflow for environment ${e.ENVIRONMENT}`);return n}}(e))],[l.AuthMechanism.MONGODB_PLAIN,()=>new c.Plain],[l.AuthMechanism.MONGODB_SCRAM_SHA1,()=>new h.ScramSHA1],[l.AuthMechanism.MONGODB_SCRAM_SHA256,()=>new h.ScramSHA256],[l.AuthMechanism.MONGODB_X509,()=>new d.X509]]);t.MongoClientAuthProviders=class{constructor(){this.existingProviders=new Map}getOrCreateProvider(e,t){const n=this.existingProviders.get(e);if(n)return n;const r=p.get(e);if(!r)throw new f.MongoInvalidArgumentError(`authMechanism ${e} not supported`);const i=r(t);return this.existingProviders.set(e,i),i}}},40012:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.WriteConcern=t.WRITE_CONCERN_KEYS=void 0,t.throwIfWriteConcernError=function(e){if("object"==typeof e&&null!=e){const t=r.MongoDBResponse.is(e)&&e.has("writeConcernError")?e.toObject():!r.MongoDBResponse.is(e)&&"writeConcernError"in e?e:null;if(null!=t)throw new i.MongoWriteConcernError(t)}};const r=n(75725),i=n(17562);t.WRITE_CONCERN_KEYS=["w","wtimeout","j","journal","fsync"];class o{constructor(e,t,n,r){null!=e&&(Number.isNaN(Number(e))?this.w=e:this.w=Number(e)),null!=t&&(this.wtimeoutMS=this.wtimeout=t),null!=n&&(this.journal=this.j=n),null!=r&&(this.journal=this.j=!!r)}static apply(e,t){const n={};return null!=t.w&&(n.w=t.w),null!=t.wtimeoutMS&&(n.wtimeout=t.wtimeoutMS),null!=t.journal&&(n.j=t.j),e.writeConcern=n,e}static fromOptions(e,t){if(null==e)return;let n;t=t??{},n="string"==typeof e||"number"==typeof e?{w:e}:e instanceof o?e:e.writeConcern;const r={...t instanceof o?t:t.writeConcern,...n},{w:i,wtimeout:s,j:a,fsync:u,journal:c,wtimeoutMS:l}=r;return null!=i||null!=s||null!=l||null!=a||null!=c||null!=u?new o(i,s??l,a??c,u):void 0}}t.WriteConcern=o},40165:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0});const r=n(86493);t.default={Email:r.isEmail}},40251:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ChangeStreamCursor=void 0;const r=n(22345),i=n(91869),o=n(62016),s=n(96357),a=n(145),u=n(61066);class c extends u.AbstractCursor{constructor(e,t,n=[],r={}){super(e,t,{...r,tailable:!0,awaitData:!0}),this.pipeline=n,this.changeStreamCursorOptions=r,this._resumeToken=null,this.startAtOperationTime=r.startAtOperationTime??null,r.startAfter?this.resumeToken=r.startAfter:r.resumeAfter&&(this.resumeToken=r.resumeAfter)}set resumeToken(e){this._resumeToken=e,this.emit(r.ChangeStream.RESUME_TOKEN_CHANGED,e)}get resumeToken(){return this._resumeToken}get resumeOptions(){const e={...this.changeStreamCursorOptions};for(const t of["resumeAfter","startAfter","startAtOperationTime"])delete e[t];return null!=this.resumeToken?this.changeStreamCursorOptions.startAfter&&!this.hasReceived?e.startAfter=this.resumeToken:e.resumeAfter=this.resumeToken:null!=this.startAtOperationTime&&(0,a.maxWireVersion)(this.server)>=7&&(e.startAtOperationTime=this.startAtOperationTime),e}cacheResumeToken(e){0===this.bufferedCount()&&this.postBatchResumeToken?this.resumeToken=this.postBatchResumeToken:this.resumeToken=e,this.hasReceived=!0}_processBatch(e){const{postBatchResumeToken:t}=e;t&&(this.postBatchResumeToken=t,0===e.batchSize&&(this.resumeToken=t))}clone(){return new c(this.client,this.namespace,this.pipeline,{...this.cursorOptions})}async _initialize(e){const t=new o.AggregateOperation(this.namespace,this.pipeline,{...this.cursorOptions,...this.changeStreamCursorOptions,session:e}),n=await(0,s.executeOperation)(e.client,t,this.timeoutContext),r=t.server;return this.maxWireVersion=(0,a.maxWireVersion)(r),null==this.startAtOperationTime&&null==this.changeStreamCursorOptions.resumeAfter&&null==this.changeStreamCursorOptions.startAfter&&this.maxWireVersion>=7&&(this.startAtOperationTime=n.operationTime),this._processBatch(n),this.emit(i.INIT,n),this.emit(i.RESPONSE),{server:r,session:e,response:n}}async getMore(e){const t=await super.getMore(e);return this.maxWireVersion=(0,a.maxWireVersion)(this.server),this._processBatch(t),this.emit(r.ChangeStream.MORE,t),this.emit(r.ChangeStream.RESPONSE),t}}t.ChangeStreamCursor=c},40642:(e,t,n)=>{var r=/Proc-Type: 4,ENCRYPTED[\n\r]+DEK-Info: AES-((?:128)|(?:192)|(?:256))-CBC,([0-9A-H]+)[\n\r]+([0-9A-z\n\r+/=]+)[\n\r]+/m,i=/^-----BEGIN ((?:.*? KEY)|CERTIFICATE)-----/m,o=/^-----BEGIN ((?:.*? KEY)|CERTIFICATE)-----([0-9A-z\n\r+/=]+)-----END \1-----$/m,s=n(23457),a=n(90686),u=n(79696).Buffer;e.exports=function(e,t){var n,c=e.toString(),l=c.match(r);if(l){var h="aes"+l[1],d=u.from(l[2],"hex"),f=u.from(l[3].replace(/[\r\n]/g,""),"base64"),p=s(t,d.slice(0,8),parseInt(l[1],10)).key,m=[],g=a.createDecipheriv(h,p,d);m.push(g.update(f)),m.push(g.final()),n=u.concat(m)}else{var _=c.match(o);n=u.from(_[2].replace(/[\r\n]/g,""),"base64")}return{tag:c.match(i)[1],data:n}}},40866:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.UpdateSearchIndexOperation=void 0;const r=n(75725),i=n(35394);class o extends i.AbstractOperation{constructor(e,t,n){super(),this.SERVER_COMMAND_RESPONSE_TYPE=r.MongoDBResponse,this.collection=e,this.name=t,this.definition=n,this.ns=e.fullNamespace}get commandName(){return"updateSearchIndex"}buildCommand(e,t){return{updateSearchIndex:this.collection.fullNamespace.collection,name:this.name,definition:this.definition}}handleOk(e){}buildOptions(e){return{session:this.session,timeoutContext:e}}}t.UpdateSearchIndexOperation=o},43135:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ServerHeartbeatFailedEvent=t.ServerHeartbeatSucceededEvent=t.ServerHeartbeatStartedEvent=t.TopologyClosedEvent=t.TopologyOpeningEvent=t.TopologyDescriptionChangedEvent=t.ServerClosedEvent=t.ServerOpeningEvent=t.ServerDescriptionChangedEvent=void 0;const r=n(91869);t.ServerDescriptionChangedEvent=class{constructor(e,t,n,i){this.name=r.SERVER_DESCRIPTION_CHANGED,this.topologyId=e,this.address=t,this.previousDescription=n,this.newDescription=i}},t.ServerOpeningEvent=class{constructor(e,t){this.name=r.SERVER_OPENING,this.topologyId=e,this.address=t}},t.ServerClosedEvent=class{constructor(e,t){this.name=r.SERVER_CLOSED,this.topologyId=e,this.address=t}},t.TopologyDescriptionChangedEvent=class{constructor(e,t,n){this.name=r.TOPOLOGY_DESCRIPTION_CHANGED,this.topologyId=e,this.previousDescription=t,this.newDescription=n}},t.TopologyOpeningEvent=class{constructor(e){this.name=r.TOPOLOGY_OPENING,this.topologyId=e}},t.TopologyClosedEvent=class{constructor(e){this.name=r.TOPOLOGY_CLOSED,this.topologyId=e}},t.ServerHeartbeatStartedEvent=class{constructor(e,t){this.name=r.SERVER_HEARTBEAT_STARTED,this.connectionId=e,this.awaited=t}},t.ServerHeartbeatSucceededEvent=class{constructor(e,t,n,i){this.name=r.SERVER_HEARTBEAT_SUCCEEDED,this.connectionId=e,this.duration=t,this.reply=n??{},this.awaited=i}},t.ServerHeartbeatFailedEvent=class{constructor(e,t,n,i){this.name=r.SERVER_HEARTBEAT_FAILED,this.connectionId=e,this.duration=t,this.failure=n,this.awaited=i}}},43802:(e,t,n)=>{t.On=t.R5=void 0;var r=n(44558);Object.defineProperty(t,"R5",{enumerable:!0,get:function(){return r.extractProxySecrets}}),Object.defineProperty(t,"On",{enumerable:!0,get:function(){return r.mergeProxySecrets}})},44120:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Db=void 0;const r=n(71235),i=n(75080),o=n(22345),s=n(19498),a=n(91869),u=n(68526),c=n(55546),l=n(69429),h=n(17562),d=n(69878),f=n(95662),p=n(96357),m=n(22847),g=n(88536),_=n(64125),y=n(61861),v=n(17668),E=n(58127),S=n(5136),w=n(28541),C=n(13700),O=n(145),b=n(40012),M=["writeConcern","readPreference","readPreferenceTags","native_parser","forceServerObjectId","pkFactory","serializeFunctions","raw","authSource","ignoreUndefined","readConcern","retryMiliSeconds","numberOfRetries","useBigInt64","promoteBuffers","promoteLongs","bsonRegExp","enableUtf8Validation","promoteValues","compression","retryWrites","timeoutMS"];class T{constructor(e,t,n){if(n=n??{},n=(0,O.filterOptions)(n,M),"string"==typeof t&&t.includes("."))throw new h.MongoInvalidArgumentError("Database names cannot contain the character '.'");this.s={options:n,readPreference:C.ReadPreference.fromOptions(n),bsonOptions:(0,i.resolveBSONOptions)(n,e),pkFactory:n?.pkFactory??O.DEFAULT_PK_FACTORY,readConcern:w.ReadConcern.fromOptions(n),writeConcern:b.WriteConcern.fromOptions(n),namespace:new O.MongoDBNamespace(t)},this.client=e}get databaseName(){return this.s.namespace.db}get options(){return this.s.options}get secondaryOk(){return"primary"!==this.s.readPreference?.preference||!1}get readConcern(){return this.s.readConcern}get readPreference(){return null==this.s.readPreference?this.client.readPreference:this.s.readPreference}get bsonOptions(){return this.s.bsonOptions}get writeConcern(){return this.s.writeConcern}get namespace(){return this.s.namespace.toString()}get timeoutMS(){return this.s.options?.timeoutMS}async createCollection(e,t){return t=(0,O.resolveOptions)(this,t),await(0,d.createCollections)(this,e,t)}async command(e,t){return await(0,p.executeOperation)(this.client,new v.RunCommandOperation(this.s.namespace,e,(0,O.resolveOptions)(void 0,{...(0,i.resolveBSONOptions)(t),timeoutMS:t?.timeoutMS??this.timeoutMS,session:t?.session,readPreference:t?.readPreference,signal:t?.signal})))}aggregate(e=[],t){return new u.AggregationCursor(this.client,this.s.namespace,e,(0,O.resolveOptions)(this,t))}admin(){return new r.Admin(this)}collection(e,t={}){if("function"==typeof t)throw new h.MongoInvalidArgumentError("The callback form of this helper has been removed.");return new s.Collection(this,e,(0,O.resolveOptions)(this,t))}async stats(e){return await(0,p.executeOperation)(this.client,new S.DbStatsOperation(this,(0,O.resolveOptions)(this,e)))}listCollections(e={},t={}){return new c.ListCollectionsCursor(this,e,(0,O.resolveOptions)(this,t))}async renameCollection(e,t,n){return await(0,p.executeOperation)(this.client,new y.RenameOperation(this.collection(e),t,(0,O.resolveOptions)(void 0,{...n,new_collection:!0,readPreference:C.ReadPreference.primary})))}async dropCollection(e,t){return t=(0,O.resolveOptions)(this,t),await(0,f.dropCollections)(this,e,t)}async dropDatabase(e){return await(0,p.executeOperation)(this.client,new f.DropDatabaseOperation(this,(0,O.resolveOptions)(this,e)))}async collections(e){return e=(0,O.resolveOptions)(this,e),(await this.listCollections({},{...e,nameOnly:!0}).toArray()).filter((({name:e})=>!e.includes("$"))).map((({name:e})=>new s.Collection(this,e,this.s.options)))}async createIndex(e,t,n){return(await(0,p.executeOperation)(this.client,m.CreateIndexesOperation.fromIndexSpecification(this,e,t,n)))[0]}async removeUser(e,t){return await(0,p.executeOperation)(this.client,new _.RemoveUserOperation(this,e,(0,O.resolveOptions)(this,t)))}async setProfilingLevel(e,t){return await(0,p.executeOperation)(this.client,new E.SetProfilingLevelOperation(this,e,(0,O.resolveOptions)(this,t)))}async profilingLevel(e){return await(0,p.executeOperation)(this.client,new g.ProfilingLevelOperation(this,(0,O.resolveOptions)(this,e)))}async indexInformation(e,t){return await this.collection(e).indexInformation((0,O.resolveOptions)(this,t))}watch(e=[],t={}){return Array.isArray(e)||(t=e,e=[]),new o.ChangeStream(this,e,(0,O.resolveOptions)(this,t))}runCursorCommand(e,t){return new l.RunCommandCursor(this,e,t)}}t.Db=T,T.SYSTEM_NAMESPACE_COLLECTION=a.SYSTEM_NAMESPACE_COLLECTION,T.SYSTEM_INDEX_COLLECTION=a.SYSTEM_INDEX_COLLECTION,T.SYSTEM_PROFILE_COLLECTION=a.SYSTEM_PROFILE_COLLECTION,T.SYSTEM_USER_COLLECTION=a.SYSTEM_USER_COLLECTION,T.SYSTEM_COMMAND_COLLECTION=a.SYSTEM_COMMAND_COLLECTION,T.SYSTEM_JS_COLLECTION=a.SYSTEM_JS_COLLECTION},44558:(e,t,n)=>{var r=n(9606).URL,i=n(65994).e;function o(e){const t=new Map;let n="";for(const[r,i]of Object.entries(e)){if(void 0===i)continue;const e=r.toUpperCase();e.endsWith("_PROXY")&&"NO_PROXY"!==e&&t.set(e.replace(/_PROXY$/,"").toLowerCase(),i||"direct://"),"NO_PROXY"===e&&(n=i)}return{map:t,noProxy:n}}function s(e,t){if(!e)return!0;if("*"===e)return!1;for(const n of e.split(/[\s,]/)){let{host:e,port:r}=n.match(/(?<host>.+)(:(?<port>\d+)$)?/)?.groups??{};if(e||(e=n,r=""),(!r||t.port===r)&&(e===t.hostname||e.startsWith("*")&&t.hostname.endsWith(e.substring(1))))return!1}return!0}function a(e,t,n){if(e.proxy){const n=e.proxy;return"direct:"===new r(n).protocol?"":s(e.noProxyHosts||"",new r(t))?n:""}if(e.useEnvironmentVariableProxies){const{map:a,noProxy:u}=o(e.env??i.env),c=new r(t),l=(n?.overrideProtocol??c.protocol).replace(/:$/,""),h=[u,e.noProxyHosts].filter(Boolean).join(","),d=a.get(l)||a.get("all");return d&&s(h,c)?d:""}return""}function u(e){if("ssh:"===(e=new r(e.toString())).protocol)throw new Error(`Using ssh:// proxies for generic browser proxy usage is not supported (translating '${c(e)}')`);if(e.username||e.password)throw new Error(`Using authenticated proxies for generic browser proxy usage is not supported (translating '${c(e)}')`);if("http:"!==e.protocol&&"https:"!==e.protocol&&"socks5:"!==e.protocol)throw new Error(`Unsupported proxy protocol (translating '${c(e)}')`);if(e.search||e.hash)throw new Error(`Unsupported URL extensions in proxy specification (translating '${c(e)}')`);if(""===e.pathname)return e.toString();if("/"!==e.pathname)throw new Error(`Unsupported URL pathname in proxy specification (translating '${c(e)}')`);return e.toString().replace(/\/$/,"")}function c(e){const t=new r(e.toString());return t.password&&(t.password="(credential)"),t.toString()}Object.defineProperty(t,"__esModule",{value:!0}),t.proxyConfForEnvVars=o,t.proxyForUrl=a,t.translateToElectronProxyConfig=function(e){if(e.proxy){let t=e.proxy;return new r(t).protocol.startsWith("pac+")?(t=t.replace("pac+",""),{mode:"pac_script",pacScript:t.toString(),proxyBypassRules:e.noProxyHosts}):{mode:"fixed_servers",proxyRules:u(t),proxyBypassRules:e.noProxyHosts}}if(e.useEnvironmentVariableProxies){const t=[],n=[e.noProxyHosts],{map:r,noProxy:s}=o(e.env??i.env);for(const e of["http","https","ftp"]){const n=r.get(e)||r.get("all");n&&t.push(`${e}=${u(n)}`)}n.push(s);const a=t.join(";"),c=n.filter(Boolean).join(",")||void 0;return a?{mode:"fixed_servers",proxyBypassRules:c,proxyRules:a}:c?{proxyBypassRules:c}:{}}return{}},t.getSocks5OnlyProxyOptions=function(e,t){let n;if(void 0!==t?n=a(e,t):e.noProxyHosts||(n=e.proxy),!n)return;const i=new r(n);return"socks5:"!==i.protocol?void 0:{proxyHost:decodeURIComponent(i.hostname),proxyPort:+(i.port||1080),proxyUsername:decodeURIComponent(i.username)||void 0,proxyPassword:decodeURIComponent(i.password)||void 0}},t.extractProxySecrets=function(e){const t={};if(e.proxy){const n=new r(e.proxy);t.password=n.password,n.password="",e={...e,proxy:n.toString()}}return e.sshOptions&&(t.sshIdentityKeyPassphrase=e.sshOptions.identityKeyPassphrase,e={...e,sshOptions:{...e.sshOptions,identityKeyPassphrase:void 0}}),{secrets:JSON.stringify(t),proxyOptions:e}},t.mergeProxySecrets=function({proxyOptions:e,secrets:t}){const n=JSON.parse(t||"{}");if((n.username||n.password)&&e.proxy){const t=new r(e.proxy);t.password=n.password||"",e={...e,proxy:t.toString()}}return n.sshIdentityKeyPassphrase&&(e={...e,sshOptions:{...e.sshOptions,identityKeyPassphrase:n.sshIdentityKeyPassphrase}}),e},t.redactUrl=c},46195:e=>{e.exports={rE:"6.19.0"}},47523:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ClientBulkWriteExecutor=void 0;const r=n(61066),i=n(7180),o=n(17562),s=n(7799),a=n(145),u=n(40012),c=n(96357),l=n(34080),h=n(11737),d=n(6987);t.ClientBulkWriteExecutor=class{constructor(e,t,n){if(0===t.length)throw new o.MongoClientBulkWriteExecutionError("No client bulk write models were provided.");if(this.client=e,this.operations=t,this.options={ordered:!0,bypassDocumentValidation:!1,verboseResults:!1,...n},this.options.writeConcern||(this.options.writeConcern=u.WriteConcern.fromOptions(this.client.s.options)),0===this.options.writeConcern?.w){if(this.options.verboseResults)throw new o.MongoInvalidArgumentError("Cannot request unacknowledged write concern and verbose results");if(this.options.ordered)throw new o.MongoInvalidArgumentError("Cannot request unacknowledged write concern and ordered writes")}}async execute(){const e=this.client.s.options.pkFactory,t=new h.ClientBulkWriteCommandBuilder(this.operations,this.options,e),n=(0,a.resolveTimeoutOptions)(this.client,this.options),u=s.TimeoutContext.create(n);if(0===this.options.writeConcern?.w){for(;t.hasNextBatch();){const e=new l.ClientBulkWriteOperation(t,this.options);await(0,c.executeOperation)(this.client,e,u)}return d.ClientBulkWriteResultsMerger.unacknowledged()}{const e=new d.ClientBulkWriteResultsMerger(this.options);for(;t.hasNextBatch();){const s=new r.CursorTimeoutContext(u,Symbol()),a={...this.options,timeoutContext:s,...null!=n.timeoutMS&&{timeoutMode:r.CursorTimeoutMode.LIFETIME}},c=new i.ClientBulkWriteCursor(this.client,t,a);try{await e.merge(c)}catch(t){if(t instanceof o.MongoServerError&&!(t instanceof o.MongoClientBulkWriteError)){const n=new o.MongoClientBulkWriteError({message:"Mongo client bulk write encountered an error during execution"});throw n.cause=t,n.partialResult=e.bulkWriteResult,n}throw t}}if(e.writeConcernErrors.length>0||e.writeErrors.size>0){const t=new o.MongoClientBulkWriteError({message:"Mongo client bulk write encountered errors during execution."});throw t.writeConcernErrors=e.writeConcernErrors,t.writeErrors=e.writeErrors,t.partialResult=e.bulkWriteResult,t}return e.bulkWriteResult}}}},47730:(e,t,n)=>{var r,i,o;i=[t,n(36257),n(10324),n(90780),n(88470)],void 0===(o="function"==typeof(r=function(e,t,n,r,i){var o,s,a,u,c,l,h,d=Math.imul,f=t.$_$.j4,p=t.$_$.a5,m=t.$_$.z3,g=t.$_$.e,_=t.$_$.h1,y=t.$_$.s1,v=t.$_$.j2,E=t.$_$.g,S=t.$_$.t,w=t.$_$.t3,C=t.$_$.b,O=t.$_$.e4,b=t.$_$.v1,M=t.$_$.n1,T=t.$_$.g4,A=t.$_$.g2,R=t.$_$.s2,N=t.$_$.u3,I=t.$_$.n3,x=t.$_$.t4,k=t.$_$.y3,P=t.$_$.a4,D=t.$_$.i5,$=t.$_$.k4,L=t.$_$.x3,B=t.$_$.w3,j=t.$_$.c4,q=t.$_$.t2,F=t.$_$.k3,z=n.$_$.b1,U=n.$_$.d,V=n.$_$.j1,W=n.$_$.l1,G=n.$_$.c,H=t.$_$.d4,K=n.$_$.h1,Y=t.$_$.z1,Q=t.$_$.v2,J=t.$_$.d,X=t.$_$.p3,Z=t.$_$.b4,ee=n.$_$.b,te=n.$_$.a,ne=t.$_$.i,re=t.$_$.f2,ie=t.$_$.h,oe=t.$_$.n2,se=t.$_$.b2,ae=t.$_$.y,ue=t.$_$.u1,ce=t.$_$.o2,le=t.$_$.d2,he=n.$_$.m1,de=n.$_$.w,fe=n.$_$.k,pe=n.$_$.x,me=n.$_$.l,ge=n.$_$.s,_e=n.$_$.n,ye=n.$_$.j,ve=n.$_$.r,Ee=n.$_$.i,Se=n.$_$.v,we=n.$_$.g1,Ce=n.$_$.m,Oe=n.$_$.t,be=n.$_$.q,Me=n.$_$.o,Te=n.$_$.u,Ae=n.$_$.p,Re=n.$_$.i1,Ne=t.$_$.f4,Ie=t.$_$.l4,xe=n.$_$.w1,ke=t.$_$.m2,Pe=n.$_$.n1,De=n.$_$.f,$e=n.$_$.t1,Le=n.$_$.q1,Be=n.$_$.r1,je=n.$_$.s1,qe=n.$_$.u1,Fe=n.$_$.p1,ze=t.$_$.r4,Ue=n.$_$.y,Ve=n.$_$.o1,We=n.$_$.v1,Ge=n.$_$.g,He=n.$_$.x1,Ke=t.$_$.a2,Ye=n.$_$.z,Qe=n.$_$.a1,Je=r.$_$.a,Xe=n.$_$.d1,Ze=n.$_$.c1,et=i.$_$.b,tt=i.$_$.e,nt=i.$_$.c,rt=t.$_$.y1,it=t.$_$.x1,ot=n.$_$.f1,st=n.$_$.h,at=t.$_$.e2,ut=n.$_$.k1,ct=t.$_$.p4,lt=n.$_$.e1,ht=n.$_$.e,dt=t.$_$.o1;function ft(e){this.w18_1=e}function pt(e,t){return t.y18_1.m()}function mt(){}function gt(){this.c19_1=g()}function _t(e,t){if(e.y18_1.m()>t.y18_1.m())return!1;var n;e:{var r=R(e.y18_1,t.y18_1);if(T(r,M)&&r.p())n=!0;else{for(var i=r.j();i.k();){var o=i.l(),s=o.t9(),a=o.u9();if(s.g19_1!==a.g19_1){n=!1;break e}}n=!0}}return n}function yt(e){this.j19_1=e}function vt(e,t){var n=w(e.p19_1.j1_1,t.p19_1.j1_1);if(0!==n)return n;if(null!=e.q19_1&&null!=t.q19_1){var r=w(t.q19_1,e.q19_1);if(0!==r)return r}return e.n19_1.dp().r1(t.n19_1.dp())}function Et(){}function St(){}function wt(e,t,n){this.g19_1=e,this.h19_1=t,this.i19_1=n}function Ct(e,t,n){this.x18_1=e,this.y18_1=t,this.z18_1=n}function Ot(){}function bt(){}function Mt(){}function Tt(e,t,n){var r=new jt(e,t,n);return r.g6_1=_,r.h6_1=null,r.m6()}function At(e,t){switch(t.p19_1.j1_1){case 0:default:return u;case 1:return c;case 2:return l}}function Rt(e,t,n,r,i,o){this.l19_1=e,this.m19_1=t,this.n19_1=n,this.o19_1=r,this.p19_1=i,this.q19_1=o}function Nt(){}function It(e){this.y1a_1=e}function xt(e,t){var n=e.p19_1.j1_1,r=t.p19_1.j1_1;return q(n,r)}function kt(e){F.call(this,e)}function Pt(e){var t=new kt(e),n=function(e,n){return t.i1b(e,n)};return n.$arity=1,n}function Dt(e){return function(t){var n=t.r9_1.r9_1.s9_1,r=t.r9_1.s9_1,i=t.s9_1,o=n.br(r.p16_1),s=null==e?null:e.pp_1,a=null==s?null:s.sp(i.qq_1,r.q16_1),u=o.equals(K())?1:a,c=o.equals(K())&&null!=e?e.qp(i.qq_1):r.p16_1;return new Rt(i.pq_1,i.qq_1,c,r.q16_1,o,u)}}function $t(e){return e.p()}function Lt(){return Y()}function Bt(e,t,n,r,i){F.call(this,i),this.r1b_1=e,this.s1b_1=t,this.t1b_1=n,this.u1b_1=r}function jt(e,t,n){F.call(this,n),this.b1a_1=e,this.c1a_1=t}function qt(e,t,n,r){F.call(this,r),this.n1a_1=e,this.o1a_1=t,this.p1a_1=n}function Ft(){}function zt(e){for(var t=Object.keys(e),n=null!=t&&Ne(t)?t:p(),r=ie(Ie(re(n.length),16)),i=0,o=n.length;i<o;){var s=n[i];i=i+1|0;var a=e[s];r.a3(s,a)}return r}function Ut(e){var t=typeof e;return null!=t&&"string"==typeof t?t:p()}function Vt(e){var t;if("string"===Ut(e))t=new De(e,We);else if("boolean"===Ut(e))t=new De(e,Ve());else if("number"===Ut(e))t=new De(e,Be);else if("bigint"===Ut(e))t=new De(e,$e());else if(e instanceof Date)t=new De(e,Fe);else{var n=Array.isArray(e);if(null!=n&&"boolean"==typeof n?n:p())t=new De(e,new Ue(Pe));else if(null!=e&&"object"===Ut(e)){var r,i=Object.keys(e),o=null!=i&&Ne(i)?i:p();if(1===o.length&&ze(o[0],"$"))switch(o[0]){case"$numberLong":r=new De(e,$e());break;case"$numberDecimal":r=new De(e,Le());break;case"$numberDouble":r=new De(e,Be);break;case"$numberInt":r=new De(e,je);break;case"$oid":r=new De(e,qe);break;case"$date":r=new De(e,Fe);break;default:r=new De(e,Pe)}else r=new De(e,Pe);t=r}else t=new De(e,Pe)}return new Ge(t)}function Wt(e,t){var n=He.up(e.database,e.collection);if(null!=t){for(var r=J(t.length),i=0,o=t.length;i<o;){var s=t[i];i=i+1|0;var a=Je(s);r.h(a)}var u,c=r.j();if(c.k()){for(var l=c.l();c.k();){var h=l,d=c.l();l=Xe(h,d)}u=l}else u=null;var f=u,m=null==f?new Ye(Ke()):f,g=Ze(m),_=g instanceof Ye?g:p(),y=function(e){for(var t=J(e.length),n=0,r=e.length;n<r;){var i=e[n];n=n+1|0;var o=zt(i);t.h(o)}var s=t;return xe.mp(s)}(t);return new Qe(n,_,y)}return new Qe(n,new Ye(Ke()))}function Gt(e,t){var n=t;return Qt(e).aq(new ee(new te(e,e,n.np_1,n)))}function Ht(e){return tt(et,C,C,(t=new Yt(e,null),(n=function(e,n){return t.u1c(e,n)}).$arity=1,n));var t,n}function Kt(e){this.g1c_1=e}function Yt(e,t){this.q1c_1=e,F.call(this,t)}function Qt(e){var t,n;if("object"==typeof e){var r,i,o=Object.keys(e),s=null!=o&&Ne(o)?o:p();e:{for(var a=0,u=s.length;a<u;){var c=s[a];if(a=a+1|0,!ze(c,"$")){r=!1;break e}}r=!0}if(r){for(var l=J(s.length),h=0,d=s.length;h<d;){var f=s[h];h=h+1|0;var m,_=e[f];switch(f){case"$and":case"$or":case"$nor":for(var v=null!=_&&Ne(_)?_:p(),E=J(v.length),S=0,w=v.length;S<w;){var C=v[S];S=S+1|0;var O=Qt(C);E.h(O)}var b,A=E;if("$and"===f){for(var R=g(),N=A.j();N.k();){var I,x=N.l();e:{for(var k=x.zp_1.j();k.k();){var P=k.l();if(P instanceof st){I=P;break e}}I=null}var D,$=null==I||I instanceof st?I:p(),L=null==$?null:$.ar_1,B="and"===(null==L?null:L.jy_1);e:{for(var j=x.zp_1.j();j.k();){var q=j.l();if(q instanceof ht){D=q;break e}}D=null}var F=null==D||D instanceof ht?D:p(),V=B&&null!=F?F.tq_1:le(x);y(R,V)}b=R}else b=A;var W=b,H=new st(ut.gy(ct(f,"$")));m=new z(_,at([H,new ht(T(W,dt)?W:p())]));break;case"$not":m=new z(_,at([new st(ut.gy("not")),new ht(le(Qt(_)))]));break;default:m=new z(_,at([new st(ut.gy(ct(f,"$"))),Vt(_)]))}var K=m;l.h(K)}var Y=l;i=new z(e,at([new st(lt()),new ht(Y)]))}else{for(var Q=J(s.length),X=0,Z=s.length;X<Z;){var ee=s[X];X=X+1|0;var te,ne=e[ee];if("object"==typeof ne){var re=Object.keys(ne);te=null!=re&&Ne(re)?re:p()}else te=[];for(var ie=te,oe=g(),se=0,ae=ie.length;se<ae;){var ce=ie[se];se=se+1|0,ze(ce,"$")&&oe.h(ce)}var he,de,fe=oe;if(fe.p())de=!1;else{var pe;e:if(T(fe,M)&&fe.p())pe=!1;else{for(var me=fe.j();me.k();)if(n=me.l(),!ke(["$numberLong","$numberDecimal","$numberDouble","$numberInt","$oid","$date"]).o(n)){pe=!0;break e}pe=!1}de=pe}if(de){for(var ge=J(ue(fe,10)),_e=fe.j();_e.k();){var ye=_e.l(),ve=new z(ne,at([new st(ut.gy(ct(ye,"$"))),new U(new G(e,ee)),Vt(ne[ye])]));ge.h(ve)}var Ee=ge;he=new z(e,at([new st(lt()),new ht(Ee)]))}else he=new z(ne,at([new st(ot()),new U(new G(e,ee)),Vt(ne)]));var Se=he;Q.h(Se)}var we=Q;i=new z(e,at([new st(lt()),new ht(we)]))}t=i}else t=new z(e,at([new st(ot()),Vt(e)]));return t}return m(ft,"CollectionIndexConsolidationOptions"),O(mt,"CollectionIndexConsolidation"),m(gt,"IndexPartitions",gt),m(yt,"sam$kotlin_Comparator$0",C,C,[x,I]),P(Et),j(Nt,"SuggestedIndex"),O(St,"NoIndex",C,C,[Nt]),m(wt,"MongoDbIndexField"),m(Ct,"MongoDbIndex",C,C,[Nt]),O(Ot,"RoleEquality"),O(bt,"RoleSort"),O(Mt,"RoleRange"),m(Rt,"QueryFieldUsage"),m(It,"sam$kotlin_Comparator$0",C,C,[x,I]),H(kt,F,C,[1]),Z(Bt,F),Z(jt,F),Z(qt,F),O(Ft,"IndexAnalyzer",C,C,C,[3,1]),j((function(){}),"Opaque"),j((function(){}),"Query"),j((function(){}),"SuggestedIndex"),m(Kt),H(Yt,F,C,[1]),f(ft).toString=function(){return"CollectionIndexConsolidationOptions(indexesSoftLimit="+this.w18_1+")"},f(ft).hashCode=function(){return this.w18_1},f(ft).equals=function(e){if(this===e)return!0;if(!(e instanceof ft))return!1;var t=e instanceof ft?e:p();return this.w18_1===t.w18_1},f(mt).a19=function(e,t,n){if(!(e instanceof Ct))return a.b19();for(var r=g(),i=t.j();i.k();){var o=i.l();o instanceof Ct&&r.h(o)}for(var s=new gt,u=r.j();u.k();){var c=u.l();s=s.d19(c)}var l=s.d19(e).e19(e);if(null==l)return a.b19();for(var h=l,d=g(),f=h.j();f.k();){var p=f.l().z18_1;y(d,p)}for(var m=v(e.z18_1,d),_=E(),O=g(),b=m.j();b.k();){var M=b.l(),T=M.zp_1;_.h(T)&&O.h(M)}var A,R=O,N=h.j();if(!N.k())throw S();var I=N.l();if(N.k()){var x=pt(0,I);do{var k=N.l(),P=pt(0,k);w(x,P)<0&&(I=k,x=P)}while(N.k());A=I}else A=I;return A.f19(C,C,R)},f(gt).e19=function(e){var t;e:{for(var n=this.c19_1.j();n.k();){var r=n.l();if(b(r,e)){t=r;break e}}t=null}return t},f(gt).d19=function(e){var t;e:{for(var n=this.c19_1.j();n.k();){var r,i=n.l();t:if(T(i,M)&&i.p())r=!0;else{for(var o=i.j();o.k();){var s=o.l();if(!_t(s,e)&&!_t(e,s)){r=!1;break t}}r=!0}if(r){t=i;break e}}t=null}if(null!=t)t.h(e);else{var a=A([e]);this.c19_1.h(a)}return this},f(yt).k19=function(e,t){return this.j19_1(e,t)},f(yt).compare=function(e,t){return this.k19(e,t)},f(yt).z1=function(){return this.j19_1},f(yt).equals=function(e){return!(null==e||!T(e,x))&&!(null==e||!T(e,I))&&N(this.z1(),e.z1())},f(yt).hashCode=function(){return k(this.z1())},f(Et).r19=function(){return new yt(vt)},f(St).b19=function(){return T(this,Nt)?this:p()},f(St).toString=function(){return"NoIndex"},f(St).hashCode=function(){return-102017684},f(St).equals=function(e){return this===e||e instanceof St&&(e instanceof St||p(),!0)},f(wt).toString=function(){return"MongoDbIndexField(fieldName="+this.g19_1+", source="+D(this.h19_1)+", reason="+$(this.i19_1)+")"},f(wt).hashCode=function(){var e=L(this.g19_1);return e=d(e,31)+(null==this.h19_1?0:k(this.h19_1))|0,d(e,31)+k(this.i19_1)|0},f(wt).equals=function(e){if(this===e)return!0;if(!(e instanceof wt))return!1;var t=e instanceof wt?e:p();return this.g19_1===t.g19_1&&!!N(this.h19_1,t.h19_1)&&!!N(this.i19_1,t.i19_1)},f(Ct).s19=function(e,t,n){return new Ct(e,t,n)},f(Ct).f19=function(e,t,n,r){return e=e===C?this.x18_1:e,t=t===C?this.y18_1:t,n=n===C?this.z18_1:n,r===C?this.s19(e,t,n):r.s19.call(this,e,t,n)},f(Ct).toString=function(){return"MongoDbIndex(collectionReference="+this.x18_1.toString()+", fields="+$(this.y18_1)+", coveredQueries="+$(this.z18_1)+")"},f(Ct).hashCode=function(){var e=this.x18_1.hashCode();return e=d(e,31)+k(this.y18_1)|0,d(e,31)+k(this.z18_1)|0},f(Ct).equals=function(e){if(this===e)return!0;if(!(e instanceof Ct))return!1;var t=e instanceof Ct?e:p();return!!this.x18_1.equals(t.x18_1)&&!!N(this.y18_1,t.y18_1)&&!!N(this.z18_1,t.z18_1)},f(Ot).toString=function(){return"RoleEquality"},f(Ot).hashCode=function(){return-1362800612},f(Ot).equals=function(e){return this===e||e instanceof Ot&&(e instanceof Ot||p(),!0)},f(bt).toString=function(){return"RoleSort"},f(bt).hashCode=function(){return 254980544},f(bt).equals=function(e){return this===e||e instanceof bt&&(e instanceof bt||p(),!0)},f(Mt).toString=function(){return"RoleRange"},f(Mt).hashCode=function(){return-686882469},f(Mt).equals=function(e){return this===e||e instanceof Mt&&(e instanceof Mt||p(),!0)},f(Rt).v1a=function(e){return null==e.o19_1&&null==this.o19_1?this.n19_1.dp().r1(e.n19_1.dp())>0?this:e:null==e.o19_1?e:this},f(Rt).w1a=function(e,t,n,r,i,o){return new Rt(e,t,n,r,i,o)},f(Rt).x1a=function(e,t,n,r,i,o,s){return e=e===C?this.l19_1:e,t=t===C?this.m19_1:t,n=n===C?this.n19_1:n,r=r===C?this.o19_1:r,i=i===C?this.p19_1:i,o=o===C?this.q19_1:o,s===C?this.w1a(e,t,n,r,i,o):s.w1a.call(this,e,t,n,r,i,o)},f(Rt).toString=function(){return"QueryFieldUsage(source="+D(this.l19_1)+", fieldName="+this.m19_1+", type="+$(this.n19_1)+", value="+D(this.o19_1)+", role="+this.p19_1.toString()+", selectivity="+this.q19_1+")"},f(Rt).hashCode=function(){var e=null==this.l19_1?0:k(this.l19_1);return e=d(e,31)+L(this.m19_1)|0,e=d(e,31)+k(this.n19_1)|0,e=d(e,31)+(null==this.o19_1?0:k(this.o19_1))|0,e=d(e,31)+this.p19_1.hashCode()|0,d(e,31)+(null==this.q19_1?0:B(this.q19_1))|0},f(Rt).equals=function(e){if(this===e)return!0;if(!(e instanceof Rt))return!1;var t=e instanceof Rt?e:p();return!!(N(this.l19_1,t.l19_1)&&this.m19_1===t.m19_1&&N(this.n19_1,t.n19_1)&&N(this.o19_1,t.o19_1)&&this.p19_1.equals(t.p19_1)&&N(this.q19_1,t.q19_1))},f(It).k19=function(e,t){return this.y1a_1(e,t)},f(It).compare=function(e,t){return this.k19(e,t)},f(It).z1=function(){return this.y1a_1},f(It).equals=function(e){return!(null==e||!T(e,x))&&!(null==e||!T(e,I))&&N(this.z1(),e.z1())},f(It).hashCode=function(){return k(this.z1())},f(kt).i1b=function(e,t){var n=this.g17(e,t);return n.g6_1=_,n.h6_1=null,n.m6()},f(kt).w6=function(e,t){return this.i1b(e instanceof z?e:p(),t)},f(kt).m6=function(){for(this.g6_1;;)try{var e=this.e6_1;if(0===e){this.f6_1=1;var t,n=this.h1b_1;e:do{for(var r=n.zp_1.j();r.k();){var i=r.l();if(i instanceof U){t=i;break e}}t=null}while(0);var o=null==t||t instanceof U?t:p(),s=null==o?null:o.sq_1;return null==s?V.iq(W):s instanceof G?V.jq(s):V.iq(W)}if(1===e)throw this.h6_1}catch(e){throw e}},f(kt).g17=function(e,t){var n=new kt(t);return n.h1b_1=e,n},f(Bt).m6=function(){var e=this.g6_1;e:for(;;)try{switch(this.e6_1){case 0:if(this.f6_1=5,this.e6_1=1,(e=Tt(this.r1b_1,this.s1b_1,this))===Q())return e;continue e;case 1:this.v1b_1=e,this.w1b_1=this.t1b_1.c1c(this.s1b_1),this.x1b_1=this.w1b_1,this.y1b_1=J(this.w1b_1.length),this.z1b_1=X(this.x1b_1),this.e6_1=2;continue e;case 2:if(!this.z1b_1.k()){this.e6_1=4;continue e}if(this.a1c_1=this.z1b_1.l(),this.b1c_1=this.a1c_1,this.e6_1=3,(e=Tt(h,this.b1c_1,this))===Q())return e;continue e;case 3:var t=e;this.y1b_1.h(t),this.e6_1=2;continue e;case 4:var n=this.y1b_1;return o.a19(this.v1b_1,n,this.u1b_1);case 5:throw this.h6_1}}catch(e){var r=e;if(5===this.f6_1)throw r;this.e6_1=this.f6_1,this.h6_1=r}},f(jt).m6=function(){var e,t,n,r,i=this.g6_1;e:for(;;)try{switch(this.e6_1){case 0:this.f6_1=2;var o,u=this.c1a_1;t:do{for(var c=u.zp_1.j();c.k();){var l=c.l();if(l instanceof ee){o=l;break t}}o=null}while(0);var h,d=null==o||o instanceof ee?o:p();if(null==d)return a.b19();h=d,this.d1a_1=h;var f=this.d1a_1.oq_1,m=f instanceof te?f:null;if(this.e1a_1=null==m?null:m.nq_1,this.e6_1=1,e=this.c1a_1,t=this.b1a_1,n=this.e1a_1,r=void 0,(r=new qt(t,e,n,this)).g6_1=_,r.h6_1=null,(i=r.m6())===Q())return i;continue e;case 1:for(var y=i,v=ne(),E=y.j();E.k();){var S,w=E.l(),O=w.m19_1,b=v.f1(O);if(null==b){var M=g();v.a3(O,M),S=M}else S=b;S.h(w)}for(var T=ie(re(v.m())),A=v.h1().j();A.k();){var R=A.l(),N=R.b1(),I=R.c1(),x=xt;T.a3(N,oe(I,new It(x)))}for(var k=T,P=ie(re(k.m())),D=k.h1().j();D.k();){var $=D.l(),L=$.b1(),B=$.c1(),j=se(B),q=B.j();if(!q.k())throw ae("Empty collection can't be reduced.");for(var F=q.l();q.k();){var z=F,U=q.l();F=z.v1a(U)}P.a3(L,j.x1a(C,C,C,F))}for(var V=oe(P.g1(),s.r19()),W=J(ue(V,10)),G=V.j();G.k();){var H=G.l();W.h(new wt(H.m19_1,H.l19_1,At(0,H)))}var K=ce(W);return new Ct(this.d1a_1,K,le(this.c1a_1));case 2:throw this.h6_1}}catch(e){var Y=e;if(2===this.f6_1)throw Y;this.e6_1=this.f6_1,this.h6_1=Y}},f(qt).m6=function(){var e=this.g6_1;e:for(;;)try{switch(this.e6_1){case 0:this.f6_1=2;var t=pe(pe(de(he),fe()),me()),n=pe(t,Pt(null));this.q1a_1=_e(ge(n,Dt(this.p1a_1))),this.r1a_1=ve(ye(),this.q1a_1),this.s1a_1=_e(be(Oe(Se(Ee(),0),Ce(we())),this.r1a_1));var r=de(_),i=Ee();if(this.t1a_1=_e(be(Oe(r,Te(Me(i,$t))),this.r1a_1)),this.u1a_1=Ae([this.s1a_1,this.t1a_1]),this.e6_1=1,(e=Re(this.u1a_1,this.o1a_1,this))===Q())return e;continue e;case 1:return e.gq(Lt);case 2:throw this.h6_1}}catch(e){var o=e;if(2===this.f6_1)throw o;this.e6_1=this.f6_1,this.h6_1=o}},f(Ft).d1c=function(e,t,n,r){var i=new Bt(this,e,t,n,r);return i.g6_1=_,i.h6_1=null,i.m6()},f(Kt).h1c=function(e){return this.g1c_1},f(Kt).c1c=function(e){return this.h1c(e)},f(Yt).u1c=function(e,t){var n=this.jz(e,t);return n.g6_1=_,n.h6_1=null,n.m6()},f(Yt).w6=function(e,t){return this.u1c(null!=e&&T(e,nt)?e:p(),t)},f(Yt).m6=function(){var e=this.g6_1;e:for(;;)try{switch(this.e6_1){case 0:this.f6_1=2,this.s1c_1=this.q1c_1[0];var t=rt(this.q1c_1,1);if(this.t1c_1=it(t),this.e6_1=1,(e=h.d1c(this.s1c_1,new Kt(this.t1c_1),new ft(10),this))===Q())return e;continue e;case 1:var n={};if(e instanceof Ct)for(var r=e.y18_1.j();r.k();)n[r.l().g19_1]=1;for(var i=this.q1c_1,o=J(i.length),s=0,a=i.length;s<a;){var u=i[s];s=s+1|0,o.h(u)}for(var c=J(ue(o,10)),l=o.j();l.k();){var d=l.l();c.h(d.yp_1)}var f=c,p={};return p.index=n,p.coveredQueries=it(f),p;case 2:throw this.h6_1}}catch(e){var m=e;if(2===this.f6_1)throw m;this.e6_1=this.f6_1,this.h6_1=m}},f(Yt).jz=function(e,t){var n=new Yt(this.q1c_1,t);return n.r1c_1=e,n},o=new mt,s=new Et,a=new St,u=new Ot,c=new bt,l=new Mt,h=new Ft,function(e){e.analyzeNamespace=Wt,e.parseQuery=Gt,e.suggestIndex=Ht}(e),e})?r.apply(t,i):r)||(e.exports=o)},48758:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Encrypter=void 0;const r=n(70136),i=n(91869),o=n(8500),s=n(17562),a=n(22220);t.Encrypter=class{constructor(e,t,n){if("object"!=typeof n.autoEncryption)throw new s.MongoInvalidArgumentError('Option "autoEncryption" must be specified');this.internalClient=null,this.bypassAutoEncryption=!!n.autoEncryption.bypassAutoEncryption,this.needsConnecting=!1,0===n.maxPoolSize&&null==n.autoEncryption.keyVaultClient?n.autoEncryption.keyVaultClient=e:null==n.autoEncryption.keyVaultClient&&(n.autoEncryption.keyVaultClient=this.getInternalClient(e,t,n)),this.bypassAutoEncryption?n.autoEncryption.metadataClient=void 0:0===n.maxPoolSize?n.autoEncryption.metadataClient=e:n.autoEncryption.metadataClient=this.getInternalClient(e,t,n),n.proxyHost&&(n.autoEncryption.proxyOptions={proxyHost:n.proxyHost,proxyPort:n.proxyPort,proxyUsername:n.proxyUsername,proxyPassword:n.proxyPassword}),this.autoEncrypter=new r.AutoEncrypter(e,n.autoEncryption)}getInternalClient(e,t,n){let r=this.internalClient;if(null==r){const o={};for(const e of[...Object.getOwnPropertyNames(n),...Object.getOwnPropertySymbols(n)])["autoEncryption","minPoolSize","servers","caseTranslate","dbName"].includes(e)||Reflect.set(o,e,Reflect.get(n,e));o.minPoolSize=0,r=new a.MongoClient(t,o),this.internalClient=r;for(const t of i.MONGO_CLIENT_EVENTS)for(const n of e.listeners(t))r.on(t,n);e.on("newListener",((e,t)=>{r?.on(e,t)})),this.needsConnecting=!0}return r}async connectInternalClient(){const e=this.internalClient;this.needsConnecting&&null!=e&&(this.needsConnecting=!1,await e.connect())}async close(e){let t;try{await this.autoEncrypter.close()}catch(e){t=e}const n=this.internalClient;if(null!=n&&e!==n)return await n.close();if(null!=t)throw t}static checkForMongoCrypt(){const e=(0,o.getMongoDBClientEncryption)();if("kModuleError"in e)throw new s.MongoMissingDependencyError("Auto-encryption requested, but the module is not installed. Please add `mongodb-client-encryption` as a dependency of your project",{cause:e.kModuleError,dependencyName:"mongodb-client-encryption"})}}},49683:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CallbackWorkflow=t.AUTOMATED_TIMEOUT_MS=t.HUMAN_TIMEOUT_MS=void 0;const r=n(37668),i=n(17562),o=n(145),s=n(63178);t.HUMAN_TIMEOUT_MS=3e5,t.AUTOMATED_TIMEOUT_MS=6e4;const a=["accessToken","expiresInSeconds","refreshToken"];t.CallbackWorkflow=class{constructor(e,t){this.cache=e,this.callback=this.withLock(t),this.lastExecutionTime=Date.now()-100}async speculativeAuth(e,t){if(this.cache.hasAccessToken){const n=this.cache.getAccessToken();e.accessToken=n;const r=(0,s.finishCommandDocument)(n);return r.db=t.source,{speculativeAuthenticate:r}}return{}}async reauthenticate(e,t){this.cache.hasAccessToken&&(e.accessToken===this.cache.getAccessToken()?(this.cache.removeAccessToken(),delete e.accessToken):e.accessToken=this.cache.getAccessToken()),await this.execute(e,t)}async startAuthentication(e,t,n){let r;return r=n?.speculativeAuthenticate?n.speculativeAuthenticate:await e.command((0,o.ns)(t.source),(0,s.startCommandDocument)(t),void 0),r}async finishAuthentication(e,t,n,r){await e.command((0,o.ns)(t.source),(0,s.finishCommandDocument)(n,r),void 0)}async executeAndValidateCallback(e){const t=await this.callback(e);if(null==(n=t)||"object"!=typeof n||!("accessToken"in n)||!Object.getOwnPropertyNames(n).every((e=>a.includes(e))))throw new i.MongoMissingCredentialsError("User provided OIDC callbacks must return a valid object with an accessToken.");var n;return t}withLock(e){let t=Promise.resolve();return async n=>(await t,t=t.catch((()=>null)).then((async()=>{const t=Date.now()-this.lastExecutionTime;return t<=100&&await(0,r.setTimeout)(100-t,{signal:n.timeoutContext}),this.lastExecutionTime=Date.now(),await e(n)})),await t)}}},50373:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.HumanCallbackWorkflow=void 0;const r=n(75080),i=n(17562),o=n(7799),s=n(63257),a=n(49683);class u extends a.CallbackWorkflow{constructor(e,t){super(e,t)}async execute(e,t){if(this.cache.hasAccessToken){const n=this.cache.getAccessToken();e.accessToken=n;try{return await this.finishAuthentication(e,t,n)}catch(n){if(n instanceof i.MongoError&&n.code===i.MONGODB_ERROR_CODES.AuthenticationFailed)return this.cache.removeAccessToken(),delete e.accessToken,await this.execute(e,t);throw n}}if(this.cache.hasRefreshToken){const n=this.cache.getRefreshToken(),r=await this.fetchAccessToken(this.cache.getIdpInfo(),t,n);this.cache.put(r),e.accessToken=r.accessToken;try{return await this.finishAuthentication(e,t,r.accessToken)}catch(n){if(n instanceof i.MongoError&&n.code===i.MONGODB_ERROR_CODES.AuthenticationFailed)return this.cache.removeRefreshToken(),delete e.accessToken,await this.execute(e,t);throw n}}const n=await this.startAuthentication(e,t),o=n.conversationId,s=r.BSON.deserialize(n.payload.buffer),a=await this.fetchAccessToken(s,t);return this.cache.put(a,s),e.accessToken=a.accessToken,await this.finishAuthentication(e,t,a.accessToken,o)}async fetchAccessToken(e,t,n){const r=new AbortController,u={timeoutContext:r.signal,version:s.OIDC_VERSION,idpInfo:e};t.username&&(u.username=t.username),n&&(u.refreshToken=n);const c=o.Timeout.expires(a.HUMAN_TIMEOUT_MS);try{return await Promise.race([this.executeAndValidateCallback(u),c])}catch(e){if(o.TimeoutError.is(e))throw r.abort(),new i.MongoOIDCError(`OIDC callback timed out after ${a.HUMAN_TIMEOUT_MS}ms.`);throw e}finally{c.clear()}}}t.HumanCallbackWorkflow=u},50440:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.FindOperation=void 0;const r=n(75725),i=n(17562),o=n(30770),s=n(145),a=n(78130),u=n(35394);class c extends a.CommandOperation{constructor(e,t={},n={}){if(super(void 0,n),this.SERVER_COMMAND_RESPONSE_TYPE=r.CursorResponse,this.options={...n},delete this.options.writeConcern,this.ns=e,"object"!=typeof t||Array.isArray(t))throw new i.MongoInvalidArgumentError("Query filter must be a plain object or ObjectId");this.filter=null!=t&&"ObjectId"===t._bsontype?{_id:t}:t,this.SERVER_COMMAND_RESPONSE_TYPE=this.explain?r.ExplainedCursorResponse:r.CursorResponse}get commandName(){return"find"}buildOptions(e){return{...this.options,...this.bsonOptions,documentsReturnedIn:"firstBatch",session:this.session,timeoutContext:e}}handleOk(e){return e}buildCommandDocument(){return function(e,t,n){const r={find:e.collection,filter:t};if(n.sort&&(r.sort=(0,o.formatSort)(n.sort)),n.projection){let e=n.projection;e&&Array.isArray(e)&&(e=e.length?e.reduce(((e,t)=>(e[t]=1,e)),{}):{_id:1}),r.projection=e}return n.hint&&(r.hint=(0,s.normalizeHintField)(n.hint)),"number"==typeof n.skip&&(r.skip=n.skip),"number"==typeof n.limit&&(n.limit<0?(r.limit=-n.limit,r.singleBatch=!0):r.limit=n.limit),"number"==typeof n.batchSize&&(n.batchSize<0?r.limit=-n.batchSize:n.batchSize===n.limit?r.batchSize=n.batchSize+1:r.batchSize=n.batchSize),"boolean"==typeof n.singleBatch&&(r.singleBatch=n.singleBatch),void 0!==n.comment&&(r.comment=n.comment),n.max&&(r.max=n.max),n.min&&(r.min=n.min),"boolean"==typeof n.returnKey&&(r.returnKey=n.returnKey),"boolean"==typeof n.showRecordId&&(r.showRecordId=n.showRecordId),"boolean"==typeof n.tailable&&(r.tailable=n.tailable),"boolean"==typeof n.oplogReplay&&(r.oplogReplay=n.oplogReplay),"boolean"==typeof n.timeout?r.noCursorTimeout=!n.timeout:"boolean"==typeof n.noCursorTimeout&&(r.noCursorTimeout=n.noCursorTimeout),"boolean"==typeof n.awaitData&&(r.awaitData=n.awaitData),"boolean"==typeof n.allowPartialResults&&(r.allowPartialResults=n.allowPartialResults),"boolean"==typeof n.allowDiskUse&&(r.allowDiskUse=n.allowDiskUse),n.let&&(r.let=n.let),r}(this.ns,this.filter,this.options)}}t.FindOperation=c,(0,u.defineAspects)(c,[u.Aspect.READ_OPERATION,u.Aspect.RETRYABLE,u.Aspect.EXPLAINABLE,u.Aspect.CURSOR_CREATING])},51825:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.isEmptyCredentials=s,t.refreshKMSCredentials=async function(e,t){let n=e;return s("aws",e)&&(n=await(0,r.loadAWSCredentials)(n,t?.aws)),s("gcp",e)&&(n=await(0,o.loadGCPCredentials)(n)),s("azure",e)&&(n=await(0,i.loadAzureCredentials)(n)),n};const r=n(59888),i=n(79790),o=n(34563);function s(e,t){const n=t[e];return null!=n&&"object"==typeof n&&0===Object.keys(n).length}},53162:function(e,t,n){var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),i=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&r(t,e,n);return i(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.redactConnectionString=t.redactValidConnectionString=void 0;const s=o(n(65031));t.redactValidConnectionString=function(e,t){var n,r;const i=e.clone(),o=null!==(n=null==t?void 0:t.replacementString)&&void 0!==n?n:"_credentials_",a=null===(r=null==t?void 0:t.redactUsernames)||void 0===r||r;if((i.username||i.password)&&a?(i.username=o,i.password=""):i.password&&(i.password=o),i.searchParams.has("authMechanismProperties")){const e=new s.CommaAndColonSeparatedRecord(i.searchParams.get("authMechanismProperties"));e.get("AWS_SESSION_TOKEN")&&(e.set("AWS_SESSION_TOKEN",o),i.searchParams.set("authMechanismProperties",e.toString()))}return i.searchParams.has("tlsCertificateKeyFilePassword")&&i.searchParams.set("tlsCertificateKeyFilePassword",o),i.searchParams.has("proxyUsername")&&a&&i.searchParams.set("proxyUsername",o),i.searchParams.has("proxyPassword")&&i.searchParams.set("proxyPassword",o),i},t.redactConnectionString=function(e,t){var n,r;const i=null!==(n=null==t?void 0:t.replacementString)&&void 0!==n?n:"<credentials>",o=null===(r=null==t?void 0:t.redactUsernames)||void 0===r||r;let a;try{a=new s.default(e)}catch(e){}if(a)return t={...t,replacementString:"___credentials___"},a.redact(t).toString().replace(/___credentials___/g,i);const u=i,c=[e=>e.replace(o?/(\/\/)(.*)(@)/g:/(\/\/[^@]*:)(.*)(@)/g,`$1${u}$3`),e=>e.replace(/(AWS_SESSION_TOKEN(:|%3A))([^,&]+)/gi,`$1${u}`),e=>e.replace(/(tlsCertificateKeyFilePassword=)([^&]+)/gi,`$1${u}`),e=>o?e.replace(/(proxyUsername=)([^&]+)/gi,`$1${u}`):e,e=>e.replace(/(proxyPassword=)([^&]+)/gi,`$1${u}`)];for(const t of c)e=t(e);return e}},54564:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BulkOperationBase=t.FindOperators=t.MongoBulkWriteError=t.WriteError=t.WriteConcernError=t.BulkWriteResult=t.Batch=t.BatchType=void 0,t.mergeBatchResults=m;const r=n(75080),i=n(17562),o=n(4752),s=n(96357),a=n(9326),u=n(94330),c=n(7799),l=n(145),h=n(40012);t.BatchType=Object.freeze({INSERT:1,UPDATE:2,DELETE:3}),t.Batch=class{constructor(e,t){this.originalZeroIndex=t,this.currentIndex=0,this.originalIndexes=[],this.batchType=e,this.operations=[],this.size=0,this.sizeBytes=0}};class d{static generateIdMap(e){const t={};for(const n of e)t[n.index]=n._id;return t}constructor(e,t){this.result=e,this.insertedCount=this.result.nInserted??0,this.matchedCount=this.result.nMatched??0,this.modifiedCount=this.result.nModified??0,this.deletedCount=this.result.nRemoved??0,this.upsertedCount=this.result.upserted.length??0,this.upsertedIds=d.generateIdMap(this.result.upserted),this.insertedIds=d.generateIdMap(this.getSuccessfullyInsertedIds(e,t)),Object.defineProperty(this,"result",{value:this.result,enumerable:!1})}get ok(){return this.result.ok}getSuccessfullyInsertedIds(e,t){return 0===e.writeErrors.length?e.insertedIds:t?e.insertedIds.slice(0,e.writeErrors[0].index):e.insertedIds.filter((({index:t})=>!e.writeErrors.some((e=>t===e.index))))}getUpsertedIdAt(e){return this.result.upserted[e]}getRawResponse(){return this.result}hasWriteErrors(){return this.result.writeErrors.length>0}getWriteErrorCount(){return this.result.writeErrors.length}getWriteErrorAt(e){return e<this.result.writeErrors.length?this.result.writeErrors[e]:void 0}getWriteErrors(){return this.result.writeErrors}getWriteConcernError(){if(0!==this.result.writeConcernErrors.length){if(1===this.result.writeConcernErrors.length)return this.result.writeConcernErrors[0];{let e="";for(let t=0;t<this.result.writeConcernErrors.length;t++)e+=this.result.writeConcernErrors[t].errmsg,0===t&&(e+=" and ");return new f({errmsg:e,code:i.MONGODB_ERROR_CODES.WriteConcernTimeout})}}}toString(){return`BulkWriteResult(${r.EJSON.stringify(this.result)})`}isOk(){return 1===this.result.ok}}t.BulkWriteResult=d;class f{constructor(e){this.serverError=e}get code(){return this.serverError.code}get errmsg(){return this.serverError.errmsg}get errInfo(){return this.serverError.errInfo}toJSON(){return this.serverError}toString(){return`WriteConcernError(${this.errmsg})`}}t.WriteConcernError=f;class p{constructor(e){this.err=e}get code(){return this.err.code}get index(){return this.err.index}get errmsg(){return this.err.errmsg}get errInfo(){return this.err.errInfo}getOperation(){return this.err.op}toJSON(){return{code:this.err.code,index:this.err.index,errmsg:this.err.errmsg,op:this.err.op}}toString(){return`WriteError(${JSON.stringify(this.toJSON())})`}}function m(e,t,n,r){if(n?r=n:r&&r.result&&(r=r.result),null==r)return;if(0===r.ok&&1===t.ok){t.ok=0;const n={index:0,code:r.code||0,errmsg:r.message,errInfo:r.errInfo,op:e.operations[0]};return void t.writeErrors.push(new p(n))}if(0===r.ok&&0===t.ok)return;v(e)&&r.n&&(t.nInserted=t.nInserted+r.n),S(e)&&r.n&&(t.nRemoved=t.nRemoved+r.n);let i=0;if(Array.isArray(r.upserted)){i=r.upserted.length;for(let n=0;n<r.upserted.length;n++)t.upserted.push({index:r.upserted[n].index+e.originalZeroIndex,_id:r.upserted[n]._id})}else r.upserted&&(i=1,t.upserted.push({index:e.originalZeroIndex,_id:r.upserted}));if(E(e)&&r.n){const e=r.nModified;t.nUpserted=t.nUpserted+i,t.nMatched=t.nMatched+(r.n-i),t.nModified="number"==typeof e?t.nModified+e:0}if(Array.isArray(r.writeErrors))for(let n=0;n<r.writeErrors.length;n++){const i={index:e.originalIndexes[r.writeErrors[n].index],code:r.writeErrors[n].code,errmsg:r.writeErrors[n].errmsg,errInfo:r.writeErrors[n].errInfo,op:e.operations[r.writeErrors[n].index]};t.writeErrors.push(new p(i))}r.writeConcernError&&t.writeConcernErrors.push(new f(r.writeConcernError))}async function g(e,t){if(0===e.s.batches.length)return new d(e.s.bulkResult,e.isOrdered);for(const n of e.s.batches){const r=(0,l.resolveOptions)(e,{...t,ordered:e.isOrdered});!0!==r.bypassDocumentValidation&&delete r.bypassDocumentValidation,!0===e.s.bypassDocumentValidation&&(r.bypassDocumentValidation=!0),!1===e.s.checkKeys&&(r.checkKeys=!1),r.retryWrites&&(E(n)&&(r.retryWrites=r.retryWrites&&!n.operations.some((e=>e.multi))),S(n)&&(r.retryWrites=r.retryWrites&&!n.operations.some((e=>0===e.limit))));const c=v(n)?new a.InsertOperation(e.s.namespace,n.operations,r):E(n)?new u.UpdateOperation(e.s.namespace,n.operations,r):S(n)?new o.DeleteOperation(e.s.namespace,n.operations,r):null;if(null==c)throw new i.MongoRuntimeError(`Unknown batchType: ${n.batchType}`);let h,f=null;try{h=await(0,s.executeOperation)(e.s.collection.client,c,r.timeoutContext)}catch(e){f=e}if(null!=f){if(f instanceof i.MongoWriteConcernError){m(n,e.s.bulkResult,f,h);const t=new d(e.s.bulkResult,e.isOrdered);throw new _({message:f.result.writeConcernError.errmsg,code:f.result.writeConcernError.code},t)}throw new _(f,new d(e.s.bulkResult,e.isOrdered))}m(n,e.s.bulkResult,f,h);const p=new d(e.s.bulkResult,e.isOrdered);e.handleWriteError(p)}e.s.batches.length=0;const n=new d(e.s.bulkResult,e.isOrdered);return e.handleWriteError(n),n}t.WriteError=p;class _ extends i.MongoServerError{constructor(e,t){super(e),this.writeErrors=[],e instanceof f?this.err=e:e instanceof Error||(this.message=e.message,this.code=e.code,this.writeErrors=e.writeErrors??[]),this.result=t,Object.assign(this,e)}get name(){return"MongoBulkWriteError"}get insertedCount(){return this.result.insertedCount}get matchedCount(){return this.result.matchedCount}get modifiedCount(){return this.result.modifiedCount}get deletedCount(){return this.result.deletedCount}get upsertedCount(){return this.result.upsertedCount}get insertedIds(){return this.result.insertedIds}get upsertedIds(){return this.result.upsertedIds}}t.MongoBulkWriteError=_;class y{constructor(e){this.bulkOperation=e}update(e){const n=w(this.bulkOperation);return this.bulkOperation.addToOperationsList(t.BatchType.UPDATE,(0,u.makeUpdateStatement)(n.selector,e,{...n,multi:!0}))}updateOne(e){if(!(0,l.hasAtomicOperators)(e,this.bulkOperation.bsonOptions))throw new i.MongoInvalidArgumentError("Update document requires atomic operators");const n=w(this.bulkOperation);return this.bulkOperation.addToOperationsList(t.BatchType.UPDATE,(0,u.makeUpdateStatement)(n.selector,e,{...n,multi:!1}))}replaceOne(e){if((0,l.hasAtomicOperators)(e))throw new i.MongoInvalidArgumentError("Replacement document must not use atomic operators");const n=w(this.bulkOperation);return this.bulkOperation.addToOperationsList(t.BatchType.UPDATE,(0,u.makeUpdateStatement)(n.selector,e,{...n,multi:!1}))}deleteOne(){const e=w(this.bulkOperation);return this.bulkOperation.addToOperationsList(t.BatchType.DELETE,(0,o.makeDeleteStatement)(e.selector,{...e,limit:1}))}delete(){const e=w(this.bulkOperation);return this.bulkOperation.addToOperationsList(t.BatchType.DELETE,(0,o.makeDeleteStatement)(e.selector,{...e,limit:0}))}upsert(){return this.bulkOperation.s.currentOp||(this.bulkOperation.s.currentOp={}),this.bulkOperation.s.currentOp.upsert=!0,this}collation(e){return this.bulkOperation.s.currentOp||(this.bulkOperation.s.currentOp={}),this.bulkOperation.s.currentOp.collation=e,this}arrayFilters(e){return this.bulkOperation.s.currentOp||(this.bulkOperation.s.currentOp={}),this.bulkOperation.s.currentOp.arrayFilters=e,this}hint(e){return this.bulkOperation.s.currentOp||(this.bulkOperation.s.currentOp={}),this.bulkOperation.s.currentOp.hint=e,this}}function v(e){return e.batchType===t.BatchType.INSERT}function E(e){return e.batchType===t.BatchType.UPDATE}function S(e){return e.batchType===t.BatchType.DELETE}function w(e){let{currentOp:t}=e.s;return e.s.currentOp=void 0,t||(t={}),t}t.FindOperators=y,t.BulkOperationBase=class{constructor(e,t,n){this.collection=e,this.isOrdered=n;const i=(0,l.getTopology)(e);t=null==t?{}:t;const o=e.s.namespace,s=i.lastHello(),a=!(!i.s.options||!i.s.options.autoEncrypter),u=s&&s.maxBsonObjectSize?s.maxBsonObjectSize:16777216,c=a?2097152:u,d=s&&s.maxWriteBatchSize?s.maxWriteBatchSize:1e3,f=(d-1).toString(10).length+2;let p=Object.assign({},t);p=(0,l.applyRetryableWrites)(p,e.s.db),this.s={bulkResult:{ok:1,writeErrors:[],writeConcernErrors:[],insertedIds:[],nInserted:0,nUpserted:0,nMatched:0,nModified:0,nRemoved:0,upserted:[]},currentBatch:void 0,currentIndex:0,currentBatchSize:0,currentBatchSizeBytes:0,currentInsertBatch:void 0,currentUpdateBatch:void 0,currentRemoveBatch:void 0,batches:[],writeConcern:h.WriteConcern.fromOptions(t),maxBsonObjectSize:u,maxBatchSizeBytes:c,maxWriteBatchSize:d,maxKeySize:f,namespace:o,topology:i,options:p,bsonOptions:(0,r.resolveBSONOptions)(t),currentOp:void 0,executed:!1,collection:e,err:void 0,checkKeys:"boolean"==typeof t.checkKeys&&t.checkKeys},!0===t.bypassDocumentValidation&&(this.s.bypassDocumentValidation=!0)}insert(e){return(0,l.maybeAddIdToDocuments)(this.collection,e,{forceServerObjectId:this.shouldForceServerObjectId()}),this.addToOperationsList(t.BatchType.INSERT,e)}find(e){if(!e)throw new i.MongoInvalidArgumentError("Bulk find operation must specify a selector");return this.s.currentOp={selector:e},new y(this)}raw(e){if(null==e||"object"!=typeof e)throw new i.MongoInvalidArgumentError("Operation must be an object with an operation key");if("insertOne"in e){const n=this.shouldForceServerObjectId(),r=e.insertOne&&null==e.insertOne.document?e.insertOne:e.insertOne.document;return(0,l.maybeAddIdToDocuments)(this.collection,r,{forceServerObjectId:n}),this.addToOperationsList(t.BatchType.INSERT,r)}if("replaceOne"in e||"updateOne"in e||"updateMany"in e){if("replaceOne"in e){if("q"in e.replaceOne)throw new i.MongoInvalidArgumentError("Raw operations are not allowed");const n=(0,u.makeUpdateStatement)(e.replaceOne.filter,e.replaceOne.replacement,{...e.replaceOne,multi:!1});if((0,l.hasAtomicOperators)(n.u))throw new i.MongoInvalidArgumentError("Replacement document must not use atomic operators");return this.addToOperationsList(t.BatchType.UPDATE,n)}if("updateOne"in e){if("q"in e.updateOne)throw new i.MongoInvalidArgumentError("Raw operations are not allowed");const n=(0,u.makeUpdateStatement)(e.updateOne.filter,e.updateOne.update,{...e.updateOne,multi:!1});if(!(0,l.hasAtomicOperators)(n.u,this.bsonOptions))throw new i.MongoInvalidArgumentError("Update document requires atomic operators");return this.addToOperationsList(t.BatchType.UPDATE,n)}if("updateMany"in e){if("q"in e.updateMany)throw new i.MongoInvalidArgumentError("Raw operations are not allowed");const n=(0,u.makeUpdateStatement)(e.updateMany.filter,e.updateMany.update,{...e.updateMany,multi:!0});if(!(0,l.hasAtomicOperators)(n.u,this.bsonOptions))throw new i.MongoInvalidArgumentError("Update document requires atomic operators");return this.addToOperationsList(t.BatchType.UPDATE,n)}}if("deleteOne"in e){if("q"in e.deleteOne)throw new i.MongoInvalidArgumentError("Raw operations are not allowed");return this.addToOperationsList(t.BatchType.DELETE,(0,o.makeDeleteStatement)(e.deleteOne.filter,{...e.deleteOne,limit:1}))}if("deleteMany"in e){if("q"in e.deleteMany)throw new i.MongoInvalidArgumentError("Raw operations are not allowed");return this.addToOperationsList(t.BatchType.DELETE,(0,o.makeDeleteStatement)(e.deleteMany.filter,{...e.deleteMany,limit:0}))}throw new i.MongoInvalidArgumentError("bulkWrite only supports insertOne, updateOne, updateMany, deleteOne, deleteMany")}get length(){return this.s.currentIndex}get bsonOptions(){return this.s.bsonOptions}get writeConcern(){return this.s.writeConcern}get batches(){const e=[...this.s.batches];return this.isOrdered?this.s.currentBatch&&e.push(this.s.currentBatch):(this.s.currentInsertBatch&&e.push(this.s.currentInsertBatch),this.s.currentUpdateBatch&&e.push(this.s.currentUpdateBatch),this.s.currentRemoveBatch&&e.push(this.s.currentRemoveBatch)),e}async execute(e={}){if(this.s.executed)throw new i.MongoBatchReExecutionError;const t=h.WriteConcern.fromOptions(e);if(t&&(this.s.writeConcern=t),this.isOrdered?this.s.currentBatch&&this.s.batches.push(this.s.currentBatch):(this.s.currentInsertBatch&&this.s.batches.push(this.s.currentInsertBatch),this.s.currentUpdateBatch&&this.s.batches.push(this.s.currentUpdateBatch),this.s.currentRemoveBatch&&this.s.batches.push(this.s.currentRemoveBatch)),0===this.s.batches.length)throw new i.MongoInvalidArgumentError("Invalid BulkOperation, Batch cannot be empty");this.s.executed=!0;const n=(0,l.resolveOptions)(this.collection,{...this.s.options,...e});return n.timeoutContext??=c.TimeoutContext.create({session:n.session,timeoutMS:n.timeoutMS,serverSelectionTimeoutMS:this.collection.client.s.options.serverSelectionTimeoutMS,waitQueueTimeoutMS:this.collection.client.s.options.waitQueueTimeoutMS}),null==n.session?await this.collection.client.withSession({explicit:!1},(async e=>await g(this,{...n,session:e}))):await g(this,{...n})}handleWriteError(e){if(this.s.bulkResult.writeErrors.length>0){const t=this.s.bulkResult.writeErrors[0].errmsg?this.s.bulkResult.writeErrors[0].errmsg:"write operation failed";throw new _({message:t,code:this.s.bulkResult.writeErrors[0].code,writeErrors:this.s.bulkResult.writeErrors},e)}const t=e.getWriteConcernError();if(t)throw new _(t,e)}shouldForceServerObjectId(){return!0===this.s.options.forceServerObjectId||!0===this.s.collection.s.db.options?.forceServerObjectId}}},55546:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ListCollectionsCursor=void 0;const r=n(96357),i=n(88913),o=n(61066);class s extends o.AbstractCursor{constructor(e,t,n){super(e.client,e.s.namespace,n),this.parent=e,this.filter=t,this.options=n}clone(){return new s(this.parent,this.filter,{...this.options,...this.cursorOptions})}async _initialize(e){const t=new i.ListCollectionsOperation(this.parent,this.filter,{...this.cursorOptions,...this.options,session:e,signal:this.signal}),n=await(0,r.executeOperation)(this.parent.client,t,this.timeoutContext);return{server:t.server,session:e,response:n}}}t.ListCollectionsCursor=s},55741:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ConnectionPoolMetrics=void 0;class n{constructor(){this.txnConnections=0,this.cursorConnections=0,this.otherConnections=0}markPinned(e){e===n.TXN?this.txnConnections+=1:e===n.CURSOR?this.cursorConnections+=1:this.otherConnections+=1}markUnpinned(e){e===n.TXN?this.txnConnections-=1:e===n.CURSOR?this.cursorConnections-=1:this.otherConnections-=1}info(e){return`Timed out while checking out a connection from connection pool: maxPoolSize: ${e}, connections in use by cursors: ${this.cursorConnections}, connections in use by transactions: ${this.txnConnections}, connections in use by other operations: ${this.otherConnections}`}reset(){this.txnConnections=0,this.cursorConnections=0,this.otherConnections=0}}t.ConnectionPoolMetrics=n,n.TXN="txn",n.CURSOR="cursor",n.OTHER="other"},56463:(e,t,n)=>{var r=n(67787).Buffer;Object.defineProperty(t,"__esModule",{value:!0}),t.LimitedSizeDocument=void 0,t.makeClientMetadata=function(e){const t=new l(512),{appName:n=""}=e;if(n.length>0){const i=r.byteLength(n,"utf8")<=128?e.appName:r.from(n,"utf8").subarray(0,128).toString("utf8");t.ifItFitsItSits("application",{name:i})}const{name:s="",version:u="",platform:h=""}=e.driverInfo,f={name:s.length>0?`nodejs|${s}`:"nodejs",version:u.length>0?`${c}|${u}`:c};if(null==e.additionalDriverInfo)throw new a.MongoRuntimeError("Client options `additionalDriverInfo` must always default to an empty array");for(const{name:t="",version:n=""}of e.additionalDriverInfo)t.length>0&&(f.name=`${f.name}|${t}`),n.length>0&&(f.version=`${f.version}|${n}`);if(!t.ifItFitsItSits("driver",f))throw new a.MongoInvalidArgumentError("Unable to include driverInfo name and version, metadata cannot exceed 512 bytes");let p="Deno"in globalThis?`Deno v${"string"==typeof Deno?.version?.deno?Deno?.version?.deno:"0.0.0-unknown"}, ${i.endianness()}`:"Bun"in globalThis?`Bun v${"string"==typeof Bun?.version?Bun?.version:"0.0.0-unknown"}, ${i.endianness()}`:`Node.js ${o.version}, ${i.endianness()}`;h.length>0&&(p=`${p}|${h}`);for(const{platform:t=""}of e.additionalDriverInfo)t.length>0&&(p=`${p}|${t}`);if(!t.ifItFitsItSits("platform",p))throw new a.MongoInvalidArgumentError("Unable to include driverInfo platform, metadata cannot exceed 512 bytes");const m=(new Map).set("name",o.platform).set("architecture",o.arch).set("version",i.release()).set("type",i.type());if(!t.ifItFitsItSits("os",m))for(const e of m.keys()){if(m.delete(e),0===m.size)break;if(t.ifItFitsItSits("os",m))break}const g=d();if(null!=g&&!t.ifItFitsItSits("env",g))for(const e of g.keys()){if(g.delete(e),0===g.size)break;if(t.ifItFitsItSits("env",g))break}return t.toObject()},t.addContainerMetadata=async function(e){const t=await async function(){const e={};h??=(0,u.fileIsAccessible)("/.dockerenv");const t=await h,{KUBERNETES_SERVICE_HOST:n=""}=o.env,r=n.length>0;return t&&(e.runtime="docker"),r&&(e.orchestrator="kubernetes"),e}();if(0===Object.keys(t).length)return e;const n=new l(512),r={...e?.env,container:t};for(const[t,i]of Object.entries(e))"env"!==t?n.ifItFitsItSits(t,i):n.ifItFitsItSits("env",r)||n.ifItFitsItSits("env",i);return"env"in e||n.ifItFitsItSits("env",r),n.toObject()},t.getFAASEnv=d;const i=n(35369),o=n(98999),s=n(75080),a=n(17562),u=n(145),c=n(46195).rE;class l{constructor(e){this.document=new Map,this.documentSize=5,this.maxSize=e}ifItFitsItSits(e,t){const n=s.BSON.serialize((new Map).set(e,t)).byteLength-5;return!(n+this.documentSize>this.maxSize||(this.documentSize+=n,this.document.set(e,t),0))}toObject(){return s.BSON.deserialize(s.BSON.serialize(this.document),{promoteLongs:!1,promoteBuffers:!1,promoteValues:!1,useBigInt64:!1})}}let h;function d(){const{AWS_EXECUTION_ENV:e="",AWS_LAMBDA_RUNTIME_API:t="",FUNCTIONS_WORKER_RUNTIME:n="",K_SERVICE:r="",FUNCTION_NAME:i="",VERCEL:a="",AWS_LAMBDA_FUNCTION_MEMORY_SIZE:u="",AWS_REGION:c="",FUNCTION_MEMORY_MB:l="",FUNCTION_REGION:h="",FUNCTION_TIMEOUT_SEC:d="",VERCEL_REGION:f=""}=o.env,p=e.startsWith("AWS_Lambda_")||t.length>0,m=n.length>0,g=r.length>0||i.length>0,_=a.length>0,y=new Map;return!_||m||g?p&&!(m||g||_)?(c.length>0&&y.set("region",c),u.length>0&&Number.isInteger(+u)&&y.set("memory_mb",new s.Int32(u)),y.set("name","aws.lambda"),y):m&&!(g||p||_)?(y.set("name","azure.func"),y):g&&!(m||p||_)?(h.length>0&&y.set("region",h),l.length>0&&Number.isInteger(+l)&&y.set("memory_mb",new s.Int32(l)),d.length>0&&Number.isInteger(+d)&&y.set("timeout_sec",new s.Int32(d)),y.set("name","gcp.func"),y):null:(f.length>0&&y.set("region",f),y.set("name","vercel"),y)}t.LimitedSizeDocument=l},57590:(e,t,n)=>{var r=n(65994).e;Object.defineProperty(t,"__esModule",{value:!0}),t.RTTSampler=t.MonitorInterval=t.RTTPinger=t.Monitor=t.ServerMonitoringMode=void 0;const i=n(37668),o=n(75080),s=n(87758),a=n(56463),u=n(91869),c=n(17562),l=n(93347),h=n(4642),d=n(145),f=n(89167),p=n(43135),m=n(5369),g="idle",_="monitoring",y=(0,d.makeStateMachine)({[f.STATE_CLOSING]:[f.STATE_CLOSING,g,f.STATE_CLOSED],[f.STATE_CLOSED]:[f.STATE_CLOSED,_],[g]:[g,_,f.STATE_CLOSING],[_]:[_,g,f.STATE_CLOSING]}),v=new Set([f.STATE_CLOSING,f.STATE_CLOSED,_]);function E(e){return e.s.state===f.STATE_CLOSED||e.s.state===f.STATE_CLOSING}t.ServerMonitoringMode=Object.freeze({auto:"auto",poll:"poll",stream:"stream"});class S extends h.TypedEventEmitter{constructor(e,t){super(),this.component=l.MongoLoggableComponent.TOPOLOGY,this.on("error",d.noop),this.server=e,this.connection=null,this.cancellationToken=new h.CancellationToken,this.cancellationToken.setMaxListeners(1/0),this.monitorId=void 0,this.s={state:f.STATE_CLOSED},this.address=e.description.address,this.options=Object.freeze({connectTimeoutMS:t.connectTimeoutMS??1e4,heartbeatFrequencyMS:t.heartbeatFrequencyMS??1e4,minHeartbeatFrequencyMS:t.minHeartbeatFrequencyMS??500,serverMonitoringMode:t.serverMonitoringMode}),this.isRunningInFaasEnv=null!=(0,a.getFAASEnv)(),this.mongoLogger=this.server.topology.client?.mongoLogger,this.rttSampler=new T(10);const n=this.cancellationToken,r={id:"<monitor>",generation:e.pool.generation,cancellationToken:n,hostAddress:e.description.hostAddress,...t,raw:!1,useBigInt64:!1,promoteLongs:!0,promoteValues:!0,promoteBuffers:!0};delete r.credentials,r.autoEncrypter&&delete r.autoEncrypter,this.connectOptions=Object.freeze(r)}connect(){if(this.s.state!==f.STATE_CLOSED)return;const e=this.options.heartbeatFrequencyMS,t=this.options.minHeartbeatFrequencyMS;this.monitorId=new M(O(this),{heartbeatFrequencyMS:e,minHeartbeatFrequencyMS:t,immediate:!0})}requestCheck(){v.has(this.s.state)||this.monitorId?.wake()}reset(){const e=this.server.description.topologyVersion;if(E(this)||null==e)return;y(this,f.STATE_CLOSING),w(this),y(this,g);const t=this.options.heartbeatFrequencyMS,n=this.options.minHeartbeatFrequencyMS;this.monitorId=new M(O(this),{heartbeatFrequencyMS:t,minHeartbeatFrequencyMS:n})}close(){E(this)||(y(this,f.STATE_CLOSING),w(this),this.emit("close"),y(this,f.STATE_CLOSED))}get roundTripTime(){return this.rttSampler.average()}get minRoundTripTime(){return this.rttSampler.min()}get latestRtt(){return this.rttSampler.last}addRttSample(e){this.rttSampler.addSample(e)}clearRttSamples(){this.rttSampler.clear()}}function w(e){e.monitorId?.stop(),e.monitorId=void 0,e.rttPinger?.close(),e.rttPinger=void 0,e.cancellationToken.emit("cancel"),e.connection?.destroy(),e.connection=null,e.clearRttSamples()}function C(e,n){if(null==n)return!1;const r=e.options.serverMonitoringMode;return r!==t.ServerMonitoringMode.poll&&(r===t.ServerMonitoringMode.stream||!e.isRunningInFaasEnv)}function O(e){return t=>{function n(){E(e)||y(e,g),t()}e.s.state!==_?(y(e,_),function(e,t){let n,r;const i=e.server.description.topologyVersion,a=C(e,i);function l(i){e.connection?.destroy(),e.connection=null,e.emitAndLogHeartbeat(m.Server.SERVER_HEARTBEAT_FAILED,e.server.topology.s.id,void 0,new p.ServerHeartbeatFailedEvent(e.address,(0,d.calculateDurationInMs)(n),i,r));const o=i instanceof c.MongoError?i:new c.MongoError(c.MongoError.buildErrorMessage(i),{cause:i});o.addErrorLabel(c.MongoErrorLabel.ResetPool),o instanceof c.MongoNetworkTimeoutError&&o.addErrorLabel(c.MongoErrorLabel.InterruptInUseConnections),e.emit("resetServer",o),t(i)}function h(r){"isWritablePrimary"in r||(r.isWritablePrimary=r[u.LEGACY_HELLO_COMMAND]);const i=a&&e.rttPinger?e.rttPinger.latestRtt??(0,d.calculateDurationInMs)(n):(0,d.calculateDurationInMs)(n);e.addRttSample(i),e.emitAndLogHeartbeat(m.Server.SERVER_HEARTBEAT_SUCCEEDED,e.server.topology.s.id,r.connectionId,new p.ServerHeartbeatSucceededEvent(e.address,i,r,a)),a?(e.emitAndLogHeartbeat(m.Server.SERVER_HEARTBEAT_STARTED,e.server.topology.s.id,void 0,new p.ServerHeartbeatStartedEvent(e.address,!0)),n=(0,d.now)()):(e.rttPinger?.close(),e.rttPinger=void 0,t(void 0,r))}e.emitAndLogHeartbeat(m.Server.SERVER_HEARTBEAT_STARTED,e.server.topology.s.id,void 0,new p.ServerHeartbeatStartedEvent(e.address,a));const{connection:f}=e;if(f&&!f.closed){const{serverApi:t,helloOk:s}=f,c=e.options.connectTimeoutMS,p=e.options.heartbeatFrequencyMS,m={[t?.version||s?"hello":u.LEGACY_HELLO_COMMAND]:1,...a&&i?{maxAwaitTimeMS:p,topologyVersion:(g=i,{processId:g.processId,counter:o.Long.isLong(g.counter)?g.counter:o.Long.fromNumber(g.counter)})}:{}},_=a?{socketTimeoutMS:c?c+p:0,exhaustAllowed:!0}:{socketTimeoutMS:c};return a&&null==e.rttPinger&&(e.rttPinger=new b(e)),n=(0,d.now)(),a?(r=!0,f.exhaustCommand((0,d.ns)("admin.$cmd"),m,_,((e,t)=>e?l(e):h(t)))):(r=!1,void f.command((0,d.ns)("admin.$cmd"),m,_).then(h,l))}var g;(async()=>{const t=await(0,s.makeSocket)(e.connectOptions),r=(0,s.makeConnection)(e.connectOptions,t);n=(0,d.now)();try{return await(0,s.performInitialHandshake)(r,e.connectOptions),r}catch(e){throw r.destroy(),e}})().then((r=>{if(E(e))return void r.destroy();const i=(0,d.calculateDurationInMs)(n);e.addRttSample(i),e.connection=r,e.emitAndLogHeartbeat(m.Server.SERVER_HEARTBEAT_SUCCEEDED,e.server.topology.s.id,r.hello?.connectionId,new p.ServerHeartbeatSucceededEvent(e.address,i,r.hello,C(e,r.hello?.topologyVersion))),t(void 0,r.hello)}),(t=>{e.connection=null,r=!1,l(t)}))}(e,((t,r)=>{if(t&&e.server.description.type===f.ServerType.Unknown)return n();C(e,r?.topologyVersion)&&(0,i.setTimeout)((()=>{E(e)||e.monitorId?.wake()}),0),n()}))):r.nextTick(t)}}t.Monitor=S;class b{constructor(e){this.connection=void 0,this.cancellationToken=e.cancellationToken,this.closed=!1,this.monitor=e,this.latestRtt=e.latestRtt??void 0;const t=e.options.heartbeatFrequencyMS;this.monitorId=(0,i.setTimeout)((()=>this.measureRoundTripTime()),t)}get roundTripTime(){return this.monitor.roundTripTime}get minRoundTripTime(){return this.monitor.minRoundTripTime}close(){this.closed=!0,(0,i.clearTimeout)(this.monitorId),this.connection?.destroy(),this.connection=void 0}measureAndReschedule(e,t){this.closed?t?.destroy():(null==this.connection&&(this.connection=t),this.latestRtt=(0,d.calculateDurationInMs)(e),this.monitorId=(0,i.setTimeout)((()=>this.measureRoundTripTime()),this.monitor.options.heartbeatFrequencyMS))}measureRoundTripTime(){const e=(0,d.now)();if(this.closed)return;const t=this.connection;if(null==t)return void(0,s.connect)(this.monitor.connectOptions).then((t=>{this.measureAndReschedule(e,t)}),(()=>{this.connection=void 0}));const n=t.serverApi?.version||t.helloOk?"hello":u.LEGACY_HELLO_COMMAND;t.command((0,d.ns)("admin.$cmd"),{[n]:1},void 0).then((()=>this.measureAndReschedule(e)),(()=>{this.connection?.destroy(),this.connection=void 0}))}}t.RTTPinger=b;class M{constructor(e,t={}){this.isExpeditedCallToFnScheduled=!1,this.stopped=!1,this.isExecutionInProgress=!1,this.hasExecutedOnce=!1,this._executeAndReschedule=()=>{this.stopped||(this.timerId&&(0,i.clearTimeout)(this.timerId),this.isExpeditedCallToFnScheduled=!1,this.isExecutionInProgress=!0,this.fn((()=>{this.lastExecutionEnded=(0,d.now)(),this.isExecutionInProgress=!1,this._reschedule(this.heartbeatFrequencyMS)})))},this.fn=e,this.lastExecutionEnded=-1/0,this.heartbeatFrequencyMS=t.heartbeatFrequencyMS??1e3,this.minHeartbeatFrequencyMS=t.minHeartbeatFrequencyMS??500,t.immediate?this._executeAndReschedule():this._reschedule(void 0)}wake(){const e=(0,d.now)()-this.lastExecutionEnded;return e<0?this._executeAndReschedule():this.isExecutionInProgress||this.isExpeditedCallToFnScheduled?void 0:e<this.minHeartbeatFrequencyMS?(this.isExpeditedCallToFnScheduled=!0,void this._reschedule(this.minHeartbeatFrequencyMS-e)):void this._executeAndReschedule()}stop(){this.stopped=!0,this.timerId&&((0,i.clearTimeout)(this.timerId),this.timerId=void 0),this.lastExecutionEnded=-1/0,this.isExpeditedCallToFnScheduled=!1}toString(){return JSON.stringify(this)}toJSON(){const e=(0,d.now)(),t=e-this.lastExecutionEnded;return{timerId:null!=this.timerId?"set":"cleared",lastCallTime:this.lastExecutionEnded,isExpeditedCheckScheduled:this.isExpeditedCallToFnScheduled,stopped:this.stopped,heartbeatFrequencyMS:this.heartbeatFrequencyMS,minHeartbeatFrequencyMS:this.minHeartbeatFrequencyMS,currentTime:e,timeSinceLastCall:t}}_reschedule(e){this.stopped||(this.timerId&&(0,i.clearTimeout)(this.timerId),this.timerId=(0,i.setTimeout)(this._executeAndReschedule,e||this.heartbeatFrequencyMS))}}t.MonitorInterval=M;class T{constructor(e=10){this.rttSamples=new Float64Array(e),this.length=0,this.writeIndex=0}addSample(e){this.rttSamples[this.writeIndex++]=e,this.length<this.rttSamples.length&&this.length++,this.writeIndex%=this.rttSamples.length}min(){if(this.length<2)return 0;let e=this.rttSamples[0];for(let t=1;t<this.length;t++)this.rttSamples[t]<e&&(e=this.rttSamples[t]);return e}average(){if(0===this.length)return 0;let e=0;for(let t=0;t<this.length;t++)e+=this.rttSamples[t];return e/this.length}get last(){return 0===this.length?null:this.rttSamples[0===this.writeIndex?this.length-1:this.writeIndex-1]}clear(){this.length=0,this.writeIndex=0}}t.RTTSampler=T},58127:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.SetProfilingLevelOperation=t.ProfilingLevel=void 0;const r=n(75725),i=n(17562),o=n(145),s=n(78130),a=new Set(["off","slow_only","all"]);t.ProfilingLevel=Object.freeze({off:"off",slowOnly:"slow_only",all:"all"});class u extends s.CommandOperation{constructor(e,n,i){switch(super(e,i),this.SERVER_COMMAND_RESPONSE_TYPE=r.MongoDBResponse,this.options=i,n){case t.ProfilingLevel.off:this.profile=0;break;case t.ProfilingLevel.slowOnly:this.profile=1;break;case t.ProfilingLevel.all:this.profile=2;break;default:this.profile=0}this.level=n}get commandName(){return"profile"}buildCommandDocument(e){const n=this.level;if(!a.has(n))throw new i.MongoInvalidArgumentError(`Profiling level must be one of "${(0,o.enumToString)(t.ProfilingLevel)}"`);return{profile:this.profile}}handleOk(e){return this.level}}t.SetProfilingLevelOperation=u},58716:(e,t,n)=>{n.d(t,{A:()=>o});var r=Number.isNaN||function(e){return"number"==typeof e&&e!=e};function i(e,t){if(e.length!==t.length)return!1;for(var n=0;n<e.length;n++)if(!((i=e[n])===(o=t[n])||r(i)&&r(o)))return!1;var i,o;return!0}const o=function(e,t){var n;void 0===t&&(t=i);var r,o=[],s=!1;return function(){for(var i=[],a=0;a<arguments.length;a++)i[a]=arguments[a];return s&&n===this&&t(i,o)||(r=e.apply(this,i),s=!0,n=this,o=i),r}}},58782:(e,t,n)=>{var r=n(44775),i=r.define("Time",(function(){this.choice({utcTime:this.utctime(),generalTime:this.gentime()})})),o=r.define("AttributeTypeValue",(function(){this.seq().obj(this.key("type").objid(),this.key("value").any())})),s=r.define("AlgorithmIdentifier",(function(){this.seq().obj(this.key("algorithm").objid(),this.key("parameters").optional(),this.key("curve").objid().optional())})),a=r.define("SubjectPublicKeyInfo",(function(){this.seq().obj(this.key("algorithm").use(s),this.key("subjectPublicKey").bitstr())})),u=r.define("RelativeDistinguishedName",(function(){this.setof(o)})),c=r.define("RDNSequence",(function(){this.seqof(u)})),l=r.define("Name",(function(){this.choice({rdnSequence:this.use(c)})})),h=r.define("Validity",(function(){this.seq().obj(this.key("notBefore").use(i),this.key("notAfter").use(i))})),d=r.define("Extension",(function(){this.seq().obj(this.key("extnID").objid(),this.key("critical").bool().def(!1),this.key("extnValue").octstr())})),f=r.define("TBSCertificate",(function(){this.seq().obj(this.key("version").explicit(0).int().optional(),this.key("serialNumber").int(),this.key("signature").use(s),this.key("issuer").use(l),this.key("validity").use(h),this.key("subject").use(l),this.key("subjectPublicKeyInfo").use(a),this.key("issuerUniqueID").implicit(1).bitstr().optional(),this.key("subjectUniqueID").implicit(2).bitstr().optional(),this.key("extensions").explicit(3).seqof(d).optional())})),p=r.define("X509Certificate",(function(){this.seq().obj(this.key("tbsCertificate").use(f),this.key("signatureAlgorithm").use(s),this.key("signatureValue").bitstr())}));e.exports=p},59888:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.loadAWSCredentials=async function(e,t){const n=new r.AWSSDKCredentialProvider(t),{SecretAccessKey:i="",AccessKeyId:o="",Token:s}=await n.getCredentials(),a={secretAccessKey:i,accessKeyId:o};return null!=s&&(a.sessionToken=s),{...e,aws:a}};const r=n(19043)},59942:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.convertInternalToMongodb=t.InternalTypeToBsonTypeMap=void 0;const r=n(72506);t.InternalTypeToBsonTypeMap={Double:"double",Number:"double",String:"string",Document:"object",Array:"array",Binary:"binData",Undefined:"undefined",ObjectId:"objectId",Boolean:"bool",Date:"date",Null:"null",RegExp:"regex",BSONRegExp:"regex",DBRef:"dbPointer",BSONSymbol:"symbol",Symbol:"symbol",Code:"javascript",CodeWScope:"javascriptWithScope",Int32:"int",Timestamp:"timestamp",Long:"long",Decimal128:"decimal",MinKey:"minKey",MaxKey:"maxKey"};const i=e=>{const n=t.InternalTypeToBsonTypeMap[e];if(!n)throw new Error(`Encountered unknown type: ${e}`);return n};async function o(e,t){var n;await(0,r.allowAbort)(t);const o={bsonType:i(e.bsonType)};if("Array"===e.bsonType){const t=await s(e.types);(!t.bsonType||(null===(n=t.bsonType)||void 0===n?void 0:n.length)>0)&&(o.items=t)}else"Document"===e.bsonType&&Object.assign(o,await a(e.fields,t));return o}async function s(e,t){await(0,r.allowAbort)(t);const n=e.filter((e=>"undefined"!==e.bsonType.toLowerCase()));if(1===n.length)return o(n[0],t);const i=await Promise.all(n.map((e=>o(e,t))));return function(e){return e.every((e=>!!e.bsonType&&1===Object.keys(e).length))}(i)?{bsonType:i.map((({bsonType:e})=>e))}:{anyOf:i}}async function a(e,t){const n=[],r={};for(const i of e)1===i.probability&&n.push(i.name),r[i.name]=await s(i.types,t);return{properties:r,...n.length>0?{required:n}:{}}}t.convertInternalToMongodb=async function(e,t={}){const{required:n,properties:r}=await a(e.fields,t.signal);return{bsonType:"object",...void 0===n?{}:{required:n},properties:r}}},60620:(e,t,n)=>{n.d(t,{Db:()=>o,JV:()=>c,M8:()=>l,Sy:()=>i,kA:()=>u,mu:()=>s,qY:()=>a});var r=n(29009);r.getBuildEnv;const i=r.getDataLake,o=(r.getGenuineMongoDB,r.identifyServerName),s=r.isAtlas,a=r.isAtlasStream,u=(r.isDigitalOcean,r.isEnterprise),c=r.isLocalAtlas,l=r.isLocalhost},61066:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CursorTimeoutContext=t.AbstractCursor=t.CursorTimeoutMode=t.CURSOR_FLAGS=void 0;const r=n(93874),i=n(75080),o=n(17562),s=n(4642),a=n(96357),u=n(68923),c=n(1755),l=n(28541),h=n(13700),d=n(31790),f=n(14019),p=n(7799),m=n(145);function g(){this.client.s.activeCursors.delete(this)}t.CURSOR_FLAGS=["tailable","oplogReplay","noCursorTimeout","awaitData","exhaust","partial"],t.CursorTimeoutMode=Object.freeze({ITERATION:"iteration",LIFETIME:"cursorLifetime"});class _ extends s.TypedEventEmitter{constructor(e,n,r={}){if(super(),this.documents=null,this.hasEmittedClose=!1,this.on("error",m.noop),!e.s.isMongoClient)throw new o.MongoRuntimeError("Cursor must be constructed with MongoClient");if(this.cursorClient=e,this.cursorNamespace=n,this.cursorId=null,this.initialized=!1,this.isClosed=!1,this.isKilled=!1,this.cursorOptions={readPreference:r.readPreference&&r.readPreference instanceof h.ReadPreference?r.readPreference:h.ReadPreference.primary,...(0,i.pluckBSONSerializeOptions)(r),timeoutMS:r?.timeoutContext?.csotEnabled()?r.timeoutContext.timeoutMS:r.timeoutMS,tailable:r.tailable,awaitData:r.awaitData},null!=this.cursorOptions.timeoutMS)if(null==r.timeoutMode)if(r.tailable){if(r.awaitData&&null!=r.maxAwaitTimeMS&&r.maxAwaitTimeMS>=this.cursorOptions.timeoutMS)throw new o.MongoInvalidArgumentError("Cannot specify maxAwaitTimeMS >= timeoutMS for a tailable awaitData cursor");this.cursorOptions.timeoutMode=t.CursorTimeoutMode.ITERATION}else this.cursorOptions.timeoutMode=t.CursorTimeoutMode.LIFETIME;else{if(r.tailable&&r.timeoutMode===t.CursorTimeoutMode.LIFETIME)throw new o.MongoInvalidArgumentError("Cannot set tailable cursor's timeoutMode to LIFETIME");this.cursorOptions.timeoutMode=r.timeoutMode}else if(null!=r.timeoutMode)throw new o.MongoInvalidArgumentError("Cannot set timeoutMode without setting timeoutMS");this.cursorOptions.omitMaxTimeMS=null!=this.cursorOptions.timeoutMS&&(this.cursorOptions.timeoutMode===t.CursorTimeoutMode.ITERATION&&!this.cursorOptions.tailable||this.cursorOptions.tailable&&!this.cursorOptions.awaitData);const s=l.ReadConcern.fromOptions(r);s&&(this.cursorOptions.readConcern=s),"number"==typeof r.batchSize&&(this.cursorOptions.batchSize=r.batchSize),void 0!==r.comment&&(this.cursorOptions.comment=r.comment),"number"==typeof r.maxTimeMS&&(this.cursorOptions.maxTimeMS=r.maxTimeMS),"number"==typeof r.maxAwaitTimeMS&&(this.cursorOptions.maxAwaitTimeMS=r.maxAwaitTimeMS),this.cursorSession=r.session??null,this.deserializationOptions={...this.cursorOptions,validation:{utf8:!1!==r?.enableUtf8Validation}},this.timeoutContext=r.timeoutContext,this.signal=r.signal,this.abortListener=(0,m.addAbortListener)(this.signal,(()=>{this.close().then(void 0,m.squashError)})),this.trackCursor()}get id(){return this.cursorId??void 0}get isDead(){return(this.cursorId?.isZero()??!1)||this.isClosed||this.isKilled}get client(){return this.cursorClient}get server(){return this.selectedServer}get namespace(){return this.cursorNamespace}get readPreference(){return this.cursorOptions.readPreference}get readConcern(){return this.cursorOptions.readConcern}get session(){return this.cursorSession}set session(e){this.cursorSession=e}get closed(){return this.isClosed&&0===(this.documents?.length??0)}get killed(){return this.isKilled}get loadBalanced(){return!!this.cursorClient.topology?.loadBalanced}async asyncDispose(){await this.close()}trackCursor(){this.cursorClient.s.activeCursors.add(this),this.listeners("close").includes(g)||this.once("close",g)}bufferedCount(){return this.documents?.length??0}readBufferedDocuments(e){const t=[],n=Math.min(e??this.documents?.length??0,this.documents?.length??0);for(let e=0;e<n;e++){const e=this.documents?.shift(this.deserializationOptions);null!=e&&t.push(e)}return t}async*[Symbol.asyncIterator](){if(this.signal?.throwIfAborted(),!this.closed)try{for(;;){if(this.isKilled)return;if(this.closed)return;if(null!=this.cursorId&&this.isDead&&0===(this.documents?.length??0))return;const e=await this.next();if(null===e)return;yield e,this.signal?.throwIfAborted()}}finally{if(!this.isClosed)try{await this.close()}catch(e){(0,m.squashError)(e)}}}stream(e){const t=new y(this),n=(0,m.addAbortListener)(this.signal,(function(){t.destroy(this.reason)}));if(t.once("end",(()=>{n?.[m.kDispose]()})),e?.transform){const n=e.transform,i=t.pipe(new r.Transform({objectMode:!0,highWaterMark:1,transform(e,t,r){try{r(void 0,n(e))}catch(e){r(e)}}}));return t.on("error",(e=>i.emit("error",e))),i}return t}async hasNext(){if(this.signal?.throwIfAborted(),this.cursorId===i.Long.ZERO)return!1;this.cursorOptions.timeoutMode===t.CursorTimeoutMode.ITERATION&&null!=this.cursorId&&this.timeoutContext?.refresh();try{do{if(0!==(this.documents?.length??0))return!0;await this.fetchBatch()}while(!this.isDead||0!==(this.documents?.length??0))}finally{this.cursorOptions.timeoutMode===t.CursorTimeoutMode.ITERATION&&this.timeoutContext?.clear()}return!1}async next(){if(this.signal?.throwIfAborted(),this.cursorId===i.Long.ZERO)throw new o.MongoCursorExhaustedError;this.cursorOptions.timeoutMode===t.CursorTimeoutMode.ITERATION&&null!=this.cursorId&&this.timeoutContext?.refresh();try{do{const e=this.documents?.shift(this.deserializationOptions);if(null!=e)return null!=this.transform?await this.transformDocument(e):e;await this.fetchBatch()}while(!this.isDead||0!==(this.documents?.length??0))}finally{this.cursorOptions.timeoutMode===t.CursorTimeoutMode.ITERATION&&this.timeoutContext?.clear()}return null}async tryNext(){if(this.signal?.throwIfAborted(),this.cursorId===i.Long.ZERO)throw new o.MongoCursorExhaustedError;this.cursorOptions.timeoutMode===t.CursorTimeoutMode.ITERATION&&null!=this.cursorId&&this.timeoutContext?.refresh();try{let e=this.documents?.shift(this.deserializationOptions);if(null!=e)return null!=this.transform?await this.transformDocument(e):e;if(await this.fetchBatch(),e=this.documents?.shift(this.deserializationOptions),null!=e)return null!=this.transform?await this.transformDocument(e):e}finally{this.cursorOptions.timeoutMode===t.CursorTimeoutMode.ITERATION&&this.timeoutContext?.clear()}return null}async forEach(e){if(this.signal?.throwIfAborted(),"function"!=typeof e)throw new o.MongoInvalidArgumentError('Argument "iterator" must be a function');for await(const t of this)if(!1===e(t))break}async close(e){await this.cleanup(e?.timeoutMS)}async toArray(){this.signal?.throwIfAborted();const e=[];for await(const t of this){e.push(t);const n=this.readBufferedDocuments();if(null!=this.transform)for(const t of n)e.push(await this.transformDocument(t));else e.push(...n)}return e}addCursorFlag(e,n){if(this.throwIfInitialized(),!t.CURSOR_FLAGS.includes(e))throw new o.MongoInvalidArgumentError(`Flag ${e} is not one of ${t.CURSOR_FLAGS}`);if("boolean"!=typeof n)throw new o.MongoInvalidArgumentError(`Flag ${e} must be a boolean value`);return this.cursorOptions[e]=n,this}map(e){this.throwIfInitialized();const t=this.transform;return this.transform=t?n=>e(t(n)):e,this}withReadPreference(e){if(this.throwIfInitialized(),e instanceof h.ReadPreference)this.cursorOptions.readPreference=e;else{if("string"!=typeof e)throw new o.MongoInvalidArgumentError(`Invalid read preference: ${e}`);this.cursorOptions.readPreference=h.ReadPreference.fromString(e)}return this}withReadConcern(e){this.throwIfInitialized();const t=l.ReadConcern.fromOptions({readConcern:e});return t&&(this.cursorOptions.readConcern=t),this}maxTimeMS(e){if(this.throwIfInitialized(),"number"!=typeof e)throw new o.MongoInvalidArgumentError("Argument for maxTimeMS must be a number");return this.cursorOptions.maxTimeMS=e,this}batchSize(e){if(this.throwIfInitialized(),this.cursorOptions.tailable)throw new o.MongoTailableCursorError("Tailable cursor does not support batchSize");if("number"!=typeof e)throw new o.MongoInvalidArgumentError('Operation "batchSize" requires an integer');return this.cursorOptions.batchSize=e,this}rewind(){if(this.timeoutContext&&this.timeoutContext.owner!==this)throw new o.MongoAPIError("Cannot rewind cursor that does not own its timeout context.");this.initialized&&(this.cursorId=null,this.documents?.clear(),this.timeoutContext?.clear(),this.timeoutContext=void 0,this.isClosed=!1,this.isKilled=!1,this.initialized=!1,this.hasEmittedClose=!1,this.trackCursor(),!1===this.cursorSession?.explicit&&(this.cursorSession.hasEnded||this.cursorSession.endSession().then(void 0,m.squashError),this.cursorSession=null))}async getMore(e){if(null==this.cursorId)throw new o.MongoRuntimeError("Unexpected null cursor id. A cursor creating command should have set this");if(null==this.selectedServer)throw new o.MongoRuntimeError("Unexpected null selectedServer. A cursor creating command should have set this");if(null==this.cursorSession)throw new o.MongoRuntimeError("Unexpected null session. A cursor creating command should have set this");const t={...this.cursorOptions,session:this.cursorSession,batchSize:e},n=new u.GetMoreOperation(this.cursorNamespace,this.cursorId,this.selectedServer,t);return await(0,a.executeOperation)(this.cursorClient,n,this.timeoutContext)}async cursorInit(){null!=this.cursorOptions.timeoutMS&&(this.timeoutContext??=new v(p.TimeoutContext.create({serverSelectionTimeoutMS:this.client.s.options.serverSelectionTimeoutMS,timeoutMS:this.cursorOptions.timeoutMS}),this));try{this.cursorSession??=this.cursorClient.startSession({owner:this,explicit:!1});const e=await this._initialize(this.cursorSession);this.cursorOptions.omitMaxTimeMS=null!=this.cursorOptions.timeoutMS;const t=e.response;this.selectedServer=e.server,this.cursorId=t.id,this.cursorNamespace=t.ns??this.namespace,this.documents=t,this.initialized=!0}catch(e){throw this.initialized=!0,await this.cleanup(void 0,e),e}this.isDead&&await this.cleanup()}async fetchBatch(){if(this.isClosed)return;if(this.isDead)return void await this.cleanup();if(null==this.cursorId&&(await this.cursorInit(),0!==(this.documents?.length??0)||this.isDead))return;const e=this.cursorOptions.batchSize||1e3;try{const t=await this.getMore(e);this.cursorId=t.id,this.documents=t}catch(e){try{await this.cleanup(void 0,e)}catch(e){(0,m.squashError)(e)}throw e}this.isDead&&await this.cleanup()}async cleanup(e,t){this.abortListener?.[m.kDispose](),this.isClosed=!0;const n=()=>null!=e?(this.timeoutContext?.clear(),new v(p.TimeoutContext.create({serverSelectionTimeoutMS:this.client.s.options.serverSelectionTimeoutMS,timeoutMS:e}),this)):this.timeoutContext?.refreshed();await(async e=>{try{await e()}finally{this.emitClose()}})((async()=>{const e=this.cursorSession;if(e)try{if(!this.isKilled&&this.cursorId&&!this.cursorId.isZero()&&this.cursorNamespace&&this.selectedServer&&!e.hasEnded){this.isKilled=!0;const t=this.cursorId;this.cursorId=i.Long.ZERO,await(0,a.executeOperation)(this.cursorClient,new c.KillCursorsOperation(t,this.cursorNamespace,this.selectedServer,{session:e}),n())}}catch(e){(0,m.squashError)(e)}finally{e.owner===this&&await e.endSession({error:t}),e.inTransaction()||(0,f.maybeClearPinnedConnection)(e,{error:t})}}))}emitClose(){try{this.hasEmittedClose||0!==(this.documents?.length??0)&&!this.isClosed||this.emit("close")}finally{this.hasEmittedClose=!0}}async transformDocument(e){if(null==this.transform)return e;try{const t=this.transform(e);if(null===t){const e="Cursor returned a `null` document, but the cursor is not exhausted. Mapping documents to `null` is not supported in the cursor transform.";throw new o.MongoAPIError(e)}return t}catch(e){try{await this.close()}catch(e){(0,m.squashError)(e)}throw e}}throwIfInitialized(){if(this.initialized)throw new o.MongoCursorInUseError}}t.AbstractCursor=_,_.CLOSE="close";class y extends r.Readable{constructor(e){super({objectMode:!0,autoDestroy:!1,highWaterMark:1}),this._readInProgress=!1,this._cursor=e}_read(e){this._readInProgress||(this._readInProgress=!0,this._readNext())}_destroy(e,t){this._cursor.close().then((()=>t(e)),(e=>t(e)))}_readNext(){this._cursor.id!==i.Long.ZERO?this._cursor.next().then((e=>{if(null==e)this.push(null);else if(this.destroyed)this._cursor.close().then(void 0,m.squashError);else{if(this.push(e))return this._readNext();this._readInProgress=!1}}),(e=>e.message.match(/server is closed/)?(this._cursor.close().then(void 0,m.squashError),this.push(null)):e.message.match(/operation was interrupted/)?this.push(null):this.destroy(e))).catch((e=>{this._readInProgress=!1,this.destroy(e)})):this.push(null)}}(0,d.configureResourceManagement)(_.prototype);class v extends p.TimeoutContext{constructor(e,t){super(),this.timeoutContext=e,this.owner=t}get serverSelectionTimeout(){return this.timeoutContext.serverSelectionTimeout}get connectionCheckoutTimeout(){return this.timeoutContext.connectionCheckoutTimeout}get clearServerSelectionTimeout(){return this.timeoutContext.clearServerSelectionTimeout}get timeoutForSocketWrite(){return this.timeoutContext.timeoutForSocketWrite}get timeoutForSocketRead(){return this.timeoutContext.timeoutForSocketRead}csotEnabled(){return this.timeoutContext.csotEnabled()}refresh(){if("symbol"!=typeof this.owner)return this.timeoutContext.refresh()}clear(){if("symbol"!=typeof this.owner)return this.timeoutContext.clear()}get maxTimeMS(){return this.timeoutContext.maxTimeMS}get timeoutMS(){return this.timeoutContext.csotEnabled()?this.timeoutContext.timeoutMS:null}refreshed(){return new v(this.timeoutContext.refreshed(),this.owner)}addMaxTimeMSToCommand(e,t){this.timeoutContext.addMaxTimeMSToCommand(e,t)}getSocketTimeoutMS(){return this.timeoutContext.getSocketTimeoutMS()}}t.CursorTimeoutContext=v},61283:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.convertInternalToStandard=t.RELAXED_EJSON_DEFINITIONS=t.InternalTypeToStandardTypeMap=void 0;const r=n(72506);t.InternalTypeToStandardTypeMap={Double:{$ref:"#/$defs/Double"},Number:{$ref:"#/$defs/Double"},String:{type:"string"},Document:{type:"object"},Array:{type:"array"},Binary:{$ref:"#/$defs/Binary"},Undefined:{$ref:"#/$defs/Undefined"},ObjectId:{$ref:"#/$defs/ObjectId"},Boolean:{type:"boolean"},Date:{$ref:"#/$defs/Date"},Null:{type:"null"},RegExp:{$ref:"#/$defs/RegExp"},BSONRegExp:{$ref:"#/$defs/RegExp"},DBRef:{$ref:"#/$defs/DBRef"},DBPointer:{$ref:"#/$defs/DBPointer"},BSONSymbol:{$ref:"#/$defs/BSONSymbol"},Code:{$ref:"#/$defs/Code"},CodeWScope:{$ref:"#/$defs/CodeWScope"},Int32:{type:"integer"},Timestamp:{$ref:"#/$defs/Timestamp"},Long:{type:"integer"},Decimal128:{$ref:"#/$defs/Decimal128"},MinKey:{$ref:"#/$defs/MinKey"},MaxKey:{$ref:"#/$defs/MaxKey"}},t.RELAXED_EJSON_DEFINITIONS={ObjectId:{type:"object",properties:{$oid:{type:"string",pattern:"^[0-9a-fA-F]{24}$"}},required:["$oid"],additionalProperties:!1},BSONSymbol:{type:"object",properties:{$symbol:{type:"string"}},required:["$symbol"],additionalProperties:!1},Double:{oneOf:[{type:"number"},{type:"object",properties:{$numberDouble:{enum:["Infinity","-Infinity","NaN"]}}}]},Decimal128:{type:"object",properties:{$numberDecimal:{type:"string"}},required:["$numberDecimal"],additionalProperties:!1},Binary:{type:"object",properties:{$binary:{type:"object",properties:{base64:{type:"string"},subType:{type:"string",pattern:"^[0-9a-fA-F]{1,2}$"}},required:["base64","subType"],additionalProperties:!1}},required:["$binary"],additionalProperties:!1},Code:{type:"object",properties:{$code:{type:"string"}},required:["$code"],additionalProperties:!1},CodeWScope:{type:"object",properties:{$code:{type:"string"},$scope:{type:"object"}},required:["$code","$scope"],additionalProperties:!1},Timestamp:{type:"object",properties:{$timestamp:{type:"object",properties:{t:{type:"integer",minimum:0},i:{type:"integer",minimum:0}},required:["t","i"],additionalProperties:!1}},required:["$timestamp"],additionalProperties:!1},RegExp:{type:"object",properties:{$regularExpression:{type:"object",properties:{pattern:{type:"string"},options:{type:"string",pattern:"^[gimuy]*$"}},required:["pattern"],additionalProperties:!1}},required:["$regularExpression"],additionalProperties:!1},DBPointer:{type:"object",properties:{$dbPointer:{type:"object",properties:{$ref:{type:"string"},$id:{$ref:"#/$defs/ObjectId"}},required:["$ref","$id"],additionalProperties:!1}},required:["$dbPointer"],additionalProperties:!1},Date:{type:"object",properties:{$date:{type:"string",format:"date-time"}},required:["$date"],additionalProperties:!1},DBRef:{type:"object",properties:{$ref:{type:"string"},$id:{},$db:{type:"string"}},required:["$ref","$id"],additionalProperties:!0},MinKey:{type:"object",properties:{$minKey:{type:"integer",const:1}},required:["$minKey"],additionalProperties:!1},MaxKey:{type:"object",properties:{$maxKey:{type:"integer",const:1}},required:["$maxKey"],additionalProperties:!1},Undefined:{type:"object",properties:{$undefined:{type:"boolean",const:!0}},required:["$undefined"],additionalProperties:!1}};t.convertInternalToStandard=function(e,n={}){return function(){const e=new Set;function n(){const n=Object.fromEntries(Object.entries(t.RELAXED_EJSON_DEFINITIONS).filter((([t])=>e.has(t))));return Object.freeze(n)}async function i(n,i){await(0,r.allowAbort)(i);const a=function(e){const n=t.InternalTypeToStandardTypeMap[e];if(!n)throw new Error(`Encountered unknown type: ${e}`);return{...n}}(n.bsonType);var u;switch(a.$ref&&(u=a.$ref,e.add(u.split("/")[2])),n.bsonType){case"Array":a.items=await o(n.types,i);break;case"Document":Object.assign(a,await s(n.fields,i))}return a}async function o(e,t){await(0,r.allowAbort)(t);const n=e.filter((e=>"undefined"!==e.bsonType.toLowerCase()));if(1===n.length)return i(n[0],t);const o=await Promise.all(n.map((e=>i(e,t))));return function(e){return e.every((e=>!!e.type&&1===Object.keys(e).length))}(o)?{type:o.map((({type:e})=>e))}:{anyOf:o}}async function s(e,t){const n=[],r={};for(const i of e)1===i.probability&&n.push(i.name),r[i.name]=await o(i.types,t);return{required:n,properties:r}}return async function(e,t={}){const{required:r,properties:i}=await s(e.fields,t.signal);return{$schema:"https://json-schema.org/draft/2020-12/schema",type:"object",required:r,properties:i,$defs:n()}}}()(e,n)}},61428:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.getReadPreference=function(e){let t=e?.readPreference??i.ReadPreference.primary;if("string"==typeof t&&(t=i.ReadPreference.fromString(t)),!(t instanceof i.ReadPreference))throw new r.MongoInvalidArgumentError('Option "readPreference" must be a ReadPreference instance');return t},t.isSharded=function(e){return null!=e&&(!(!e.description||e.description.type!==o.ServerType.Mongos)||!!(e.description&&e.description instanceof s.TopologyDescription)&&Array.from(e.description.servers.values()).some((e=>e.type===o.ServerType.Mongos)))};const r=n(17562),i=n(13700),o=n(89167),s=n(97194)},61635:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.FindOneAndUpdateOperation=t.FindOneAndReplaceOperation=t.FindOneAndDeleteOperation=t.FindAndModifyOperation=t.ReturnDocument=void 0;const r=n(75725),i=n(17562),o=n(13700),s=n(30770),a=n(145),u=n(78130),c=n(35394);function l(e,n){return e.new=n.returnDocument===t.ReturnDocument.AFTER,e.upsert=!0===n.upsert,!0===n.bypassDocumentValidation&&(e.bypassDocumentValidation=n.bypassDocumentValidation),e}t.ReturnDocument=Object.freeze({BEFORE:"before",AFTER:"after"});class h extends u.CommandOperation{constructor(e,t,n){super(e,n),this.SERVER_COMMAND_RESPONSE_TYPE=r.MongoDBResponse,this.options=n,this.readPreference=o.ReadPreference.primary,this.collection=e,this.query=t}get commandName(){return"findAndModify"}buildCommandDocument(e,t){const n=this.options,r={findAndModify:this.collection.collectionName,query:this.query,remove:!1,new:!1,upsert:!1};n.includeResultMetadata??=!1;const o=(0,s.formatSort)(n.sort);if(o&&(r.sort=o),n.projection&&(r.fields=n.projection),n.maxTimeMS&&(r.maxTimeMS=n.maxTimeMS),n.writeConcern&&(r.writeConcern=n.writeConcern),n.let&&(r.let=n.let),void 0!==n.comment&&(r.comment=n.comment),(0,a.decorateWithCollation)(r,this.collection,n),n.hint){if(0===this.writeConcern?.w)throw new i.MongoCompatibilityError("The current topology does not support a hint on findAndModify commands");r.hint=n.hint}return r}handleOk(e){const t=super.handleOk(e);return this.options.includeResultMetadata?t:t.value??null}}t.FindAndModifyOperation=h,t.FindOneAndDeleteOperation=class extends h{constructor(e,t,n){if(null==t||"object"!=typeof t)throw new i.MongoInvalidArgumentError('Argument "filter" must be an object');super(e,t,n)}buildCommandDocument(e,t){const n=super.buildCommandDocument(e,t);return n.remove=!0,n}},t.FindOneAndReplaceOperation=class extends h{constructor(e,t,n,r){if(null==t||"object"!=typeof t)throw new i.MongoInvalidArgumentError('Argument "filter" must be an object');if(null==n||"object"!=typeof n)throw new i.MongoInvalidArgumentError('Argument "replacement" must be an object');if((0,a.hasAtomicOperators)(n))throw new i.MongoInvalidArgumentError("Replacement document must not contain atomic operators");super(e,t,r),this.replacement=n}buildCommandDocument(e,t){const n=super.buildCommandDocument(e,t);return n.update=this.replacement,l(n,this.options),n}},t.FindOneAndUpdateOperation=class extends h{constructor(e,t,n,r){if(null==t||"object"!=typeof t)throw new i.MongoInvalidArgumentError('Argument "filter" must be an object');if(null==n||"object"!=typeof n)throw new i.MongoInvalidArgumentError('Argument "update" must be an object');if(!(0,a.hasAtomicOperators)(n,r))throw new i.MongoInvalidArgumentError("Update document requires atomic operators");super(e,t,r),this.update=n,this.options=r}buildCommandDocument(e,t){const n=super.buildCommandDocument(e,t);return n.update=this.update,l(n,this.options),this.options.arrayFilters&&(n.arrayFilters=this.options.arrayFilters),n}},(0,c.defineAspects)(h,[c.Aspect.WRITE_OPERATION,c.Aspect.RETRYABLE,c.Aspect.EXPLAINABLE])},61861:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.RenameOperation=void 0;const r=n(75725),i=n(19498),o=n(145),s=n(78130),a=n(35394);class u extends s.CommandOperation{constructor(e,t,n){super(e,n),this.SERVER_COMMAND_RESPONSE_TYPE=r.MongoDBResponse,this.collection=e,this.newName=t,this.options=n,this.ns=new o.MongoDBNamespace("admin","$cmd")}get commandName(){return"renameCollection"}buildCommandDocument(e,t){return{renameCollection:this.collection.namespace,to:this.collection.s.namespace.withCollection(this.newName).toString(),dropTarget:"boolean"==typeof this.options.dropTarget&&this.options.dropTarget}}handleOk(e){return new i.Collection(this.collection.s.db,this.newName,this.collection.s.options)}}t.RenameOperation=u,(0,a.defineAspects)(u,[a.Aspect.WRITE_OPERATION])},62016:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.AggregateOperation=t.DB_AGGREGATE_COLLECTION=void 0;const r=n(75725),i=n(17562),o=n(145),s=n(40012),a=n(78130),u=n(35394);t.DB_AGGREGATE_COLLECTION=1;class c extends a.CommandOperation{constructor(e,n,o){if(super(void 0,{...o,dbName:e.db}),this.SERVER_COMMAND_RESPONSE_TYPE=r.CursorResponse,this.options={...o},this.target=e.collection||t.DB_AGGREGATE_COLLECTION,this.pipeline=n,this.hasWriteStage=!1,"string"==typeof o?.out)this.pipeline=this.pipeline.concat({$out:o.out}),this.hasWriteStage=!0;else if(n.length>0){const e=n[n.length-1];(e.$out||e.$merge)&&(this.hasWriteStage=!0)}if(this.hasWriteStage||delete this.options.writeConcern,this.explain&&this.writeConcern)throw new i.MongoInvalidArgumentError('Option "explain" cannot be used on an aggregate call with writeConcern');if(null!=o?.cursor&&"object"!=typeof o.cursor)throw new i.MongoInvalidArgumentError("Cursor options must be an object");this.SERVER_COMMAND_RESPONSE_TYPE=this.explain?r.ExplainedCursorResponse:r.CursorResponse}get commandName(){return"aggregate"}get canRetryRead(){return!this.hasWriteStage}addToPipeline(e){this.pipeline.push(e)}buildCommandDocument(e){const t=this.options,n=(0,o.maxWireVersion)(e),r={aggregate:this.target,pipeline:this.pipeline};return this.hasWriteStage&&n<8&&(this.readConcern=void 0),this.hasWriteStage&&this.writeConcern&&s.WriteConcern.apply(r,this.writeConcern),!0===t.bypassDocumentValidation&&(r.bypassDocumentValidation=t.bypassDocumentValidation),"boolean"==typeof t.allowDiskUse&&(r.allowDiskUse=t.allowDiskUse),t.hint&&(r.hint=t.hint),t.let&&(r.let=t.let),void 0!==t.comment&&(r.comment=t.comment),r.cursor=t.cursor||{},t.batchSize&&!this.hasWriteStage&&(r.cursor.batchSize=t.batchSize),r}handleOk(e){return e}}t.AggregateOperation=c,(0,u.defineAspects)(c,[u.Aspect.READ_OPERATION,u.Aspect.RETRYABLE,u.Aspect.EXPLAINABLE,u.Aspect.CURSOR_CREATING])},63178:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.finishCommandDocument=function(e,t){return null!=t?{saslContinue:1,conversationId:t,payload:new r.Binary(r.BSON.serialize({jwt:e}))}:{saslStart:1,mechanism:i.AuthMechanism.MONGODB_OIDC,payload:new r.Binary(r.BSON.serialize({jwt:e}))}},t.startCommandDocument=function(e){const t={};return e.username&&(t.n=e.username),{saslStart:1,autoAuthorize:1,mechanism:i.AuthMechanism.MONGODB_OIDC,payload:new r.Binary(r.BSON.serialize(t))}};const r=n(75080),i=n(93065)},63257:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.MongoDBOIDC=t.OIDC_WORKFLOWS=t.OIDC_VERSION=void 0;const r=n(17562),i=n(31057),o=n(88822),s=n(73619),a=n(9284),u=n(80890),c=n(8294),l=n(17309);t.OIDC_VERSION=1,t.OIDC_WORKFLOWS=new Map,t.OIDC_WORKFLOWS.set("test",(()=>new o.AutomatedCallbackWorkflow(new c.TokenCache,l.callback))),t.OIDC_WORKFLOWS.set("azure",(()=>new o.AutomatedCallbackWorkflow(new c.TokenCache,s.callback))),t.OIDC_WORKFLOWS.set("gcp",(()=>new o.AutomatedCallbackWorkflow(new c.TokenCache,a.callback))),t.OIDC_WORKFLOWS.set("k8s",(()=>new o.AutomatedCallbackWorkflow(new c.TokenCache,u.callback)));class h extends i.AuthProvider{constructor(e){if(super(),!e)throw new r.MongoInvalidArgumentError("No workflow provided to the OIDC auth provider.");this.workflow=e}async auth(e){const{connection:t,reauthenticating:n,response:r}=e;if(r?.speculativeAuthenticate?.done&&!n)return;const i=d(e);n?await this.workflow.reauthenticate(t,i):await this.workflow.execute(t,i,r)}async prepare(e,t){const{connection:n}=t,r=d(t);return{...e,...await this.workflow.speculativeAuth(n,r)}}}function d(e){const{credentials:t}=e;if(!t)throw new r.MongoMissingCredentialsError("AuthContext must provide credentials.");return t}t.MongoDBOIDC=h},64125:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.RemoveUserOperation=void 0;const r=n(75725),i=n(78130),o=n(35394);class s extends i.CommandOperation{constructor(e,t,n){super(e,n),this.SERVER_COMMAND_RESPONSE_TYPE=r.MongoDBResponse,this.options=n,this.username=t}get commandName(){return"dropUser"}buildCommandDocument(e){return{dropUser:this.username}}handleOk(e){return!0}}t.RemoveUserOperation=s,(0,o.defineAspects)(s,[o.Aspect.WRITE_OPERATION])},64515:(e,t,n)=>{var r=n(67787).Buffer;Object.defineProperty(t,"__esModule",{value:!0}),t.uncompressibleCommands=t.Compressor=void 0,t.compress=async function(e,t){const n={};switch(e.agreedCompressor){case"snappy":return m??=g(),await m.compress(t);case"zstd":if(y(),"kModuleError"in p)throw p.kModuleError;return await p.compress(t,h);case"zlib":return e.zlibCompressionLevel&&(n.level=e.zlibCompressionLevel),await f(t,n);default:throw new u.MongoInvalidArgumentError(`Unknown compressor ${e.agreedCompressor} failed to compress`)}},t.decompress=_,t.compressCommand=async function(e,t){const n="none"!==t.agreedCompressor&&c.OpCompressedRequest.canCompress(e)?new c.OpCompressedRequest(e,{agreedCompressor:t.agreedCompressor??"none",zlibCompressionLevel:t.zlibCompressionLevel??0}):e,i=await n.toBin();return r.concat(i)},t.decompressResponse=async function(e){const t={length:e.readInt32LE(0),requestId:e.readInt32LE(4),responseTo:e.readInt32LE(8),opCode:e.readInt32LE(12)};if(t.opCode!==l.OP_COMPRESSED){const n=t.opCode===l.OP_MSG?c.OpMsgResponse:c.OpReply,r=e.subarray(v);return new n(e,t,r)}const n={...t,fromCompressed:!0,opCode:e.readInt32LE(v),length:e.readInt32LE(v+4)},r=e[v+8],i=e.slice(v+9),o=n.opCode===l.OP_MSG?c.OpMsgResponse:c.OpReply,s=await _(r,i);if(s.length!==n.length)throw new u.MongoDecompressionError("Message body and message header must be the same length");return new o(e,n,s)};const i=n(98437),o=n(25900),s=n(91869),a=n(8500),u=n(17562),c=n(15620),l=n(96856);t.Compressor=Object.freeze({none:0,snappy:1,zlib:2,zstd:3}),t.uncompressibleCommands=new Set([s.LEGACY_HELLO_COMMAND,"saslStart","saslContinue","getnonce","authenticate","createUser","updateUser","copydbSaslStart","copydbgetnonce","copydb"]);const h=3,d=(0,i.promisify)(o.inflate.bind(o)),f=(0,i.promisify)(o.deflate.bind(o));let p,m=null;function g(){if(null==m){const e=(0,a.getSnappy)();if("kModuleError"in e)throw e.kModuleError;m=e}return m}async function _(e,n){if(e!==t.Compressor.snappy&&e!==t.Compressor.zstd&&e!==t.Compressor.zlib&&e!==t.Compressor.none)throw new u.MongoDecompressionError(`Server sent message compressed using an unsupported compressor. (Received compressor ID ${e})`);switch(e){case t.Compressor.snappy:return m??=g(),await m.uncompress(n,{asBuffer:!0});case t.Compressor.zstd:if(y(),"kModuleError"in p)throw p.kModuleError;return await p.decompress(n);case t.Compressor.zlib:return await d(n);default:return n}}function y(){p||(p=(0,a.getZstdLibrary)())}const v=16},64647:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.X509=void 0;const r=n(17562),i=n(145),o=n(31057);class s extends o.AuthProvider{async prepare(e,t){const{credentials:n}=t;if(!n)throw new r.MongoMissingCredentialsError("AuthContext must provide credentials.");return{...e,speculativeAuthenticate:a(n)}}async auth(e){const t=e.connection,n=e.credentials;if(!n)throw new r.MongoMissingCredentialsError("AuthContext must provide credentials.");const o=e.response;o?.speculativeAuthenticate||await t.command((0,i.ns)("$external.$cmd"),a(n),void 0)}}function a(e){const t={authenticate:1,mechanism:"MONGODB-X509"};return e.username&&(t.user=e.username),t}t.X509=s},65031:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CommaAndColonSeparatedRecord=t.ConnectionString=t.redactConnectionString=void 0;const r=n(9606),i=n(53162);Object.defineProperty(t,"redactConnectionString",{enumerable:!0,get:function(){return i.redactConnectionString}});const o="__this_is_a_placeholder__",s=/^(?<protocol>[^/]+):\/\/(?:(?<username>[^:@]*)(?::(?<password>[^@]*))?@)?(?<hosts>(?!:)[^/?@]*)(?<rest>.*)/;class a extends Map{delete(e){return super.delete(this._normalizeKey(e))}get(e){return super.get(this._normalizeKey(e))}has(e){return super.has(this._normalizeKey(e))}set(e,t){return super.set(this._normalizeKey(e),t)}_normalizeKey(e){e=`${e}`;for(const t of this.keys())if(t.toLowerCase()===e.toLowerCase()){e=t;break}return e}}class u extends r.URL{}class c extends Error{get name(){return"MongoParseError"}}class l extends u{constructor(e,t={}){var n;const{looseValidation:r}=t;if(!r&&!(i=e).startsWith("mongodb://")&&!i.startsWith("mongodb+srv://"))throw new c('Invalid scheme, expected connection string to start with "mongodb://" or "mongodb+srv://"');var i;const u=e.match(s);if(!u)throw new c(`Invalid connection string "${e}"`);const{protocol:h,username:d,password:f,hosts:p,rest:m}=null!==(n=u.groups)&&void 0!==n?n:{};if(!r){if(!h||!p)throw new c(`Protocol and host list are required in "${e}"`);try{decodeURIComponent(null!=d?d:""),decodeURIComponent(null!=f?f:"")}catch(e){throw new c(e.message)}const t=/[:/?#[\]@]/gi;if(null==d?void 0:d.match(t))throw new c(`Username contains unescaped characters ${d}`);if(!d||!f){const t=e.replace(`${h}://`,"");if(t.startsWith("@")||t.startsWith(":"))throw new c("URI contained empty userinfo section")}if(null==f?void 0:f.match(t))throw new c("Password contains unescaped characters")}let g="";"string"==typeof d&&(g+=d),"string"==typeof f&&(g+=`:${f}`),g&&(g+="@");try{super(`${h.toLowerCase()}://${g}${o}${m}`)}catch(n){throw r&&new l(e,{...t,looseValidation:!1}),"string"==typeof n.message&&(n.message=n.message.replace(o,p)),n}if(this._hosts=p.split(","),!r){if(this.isSRV&&1!==this.hosts.length)throw new c("mongodb+srv URI cannot have multiple service names");if(this.isSRV&&this.hosts.some((e=>e.includes(":"))))throw new c("mongodb+srv URI cannot have port number")}var _;this.pathname||(this.pathname="/"),Object.setPrototypeOf(this.searchParams,(_=this.searchParams.constructor,class extends _{append(e,t){return super.append(this._normalizeKey(e),t)}delete(e){return super.delete(this._normalizeKey(e))}get(e){return super.get(this._normalizeKey(e))}getAll(e){return super.getAll(this._normalizeKey(e))}has(e){return super.has(this._normalizeKey(e))}set(e,t){return super.set(this._normalizeKey(e),t)}keys(){return super.keys()}values(){return super.values()}entries(){return super.entries()}[Symbol.iterator](){return super[Symbol.iterator]()}_normalizeKey(e){return a.prototype._normalizeKey.call(this,e)}}).prototype)}get host(){return o}set host(e){throw new Error("No single host for connection string")}get hostname(){return o}set hostname(e){throw new Error("No single host for connection string")}get port(){return""}set port(e){throw new Error("No single host for connection string")}get href(){return this.toString()}set href(e){throw new Error("Cannot set href for connection strings")}get isSRV(){return this.protocol.includes("srv")}get hosts(){return this._hosts}set hosts(e){this._hosts=e}toString(){return super.toString().replace(o,this.hosts.join(","))}clone(){return new l(this.toString(),{looseValidation:!0})}redact(e){return(0,i.redactValidConnectionString)(this,e)}typedSearchParams(){return this.searchParams}[Symbol.for("nodejs.util.inspect.custom")](){const{href:e,origin:t,protocol:n,username:r,password:i,hosts:o,pathname:s,search:a,searchParams:u,hash:c}=this;return{href:e,origin:t,protocol:n,username:r,password:i,hosts:o,pathname:s,search:a,searchParams:u,hash:c}}}t.ConnectionString=l,t.CommaAndColonSeparatedRecord=class extends a{constructor(e){super();for(const t of(null!=e?e:"").split(",")){if(!t)continue;const e=t.indexOf(":");-1===e?this.set(t,""):this.set(t.slice(0,e),t.slice(e+1))}}toString(){return[...this].map((e=>e.join(":"))).join(",")}},t.default=l},66596:(e,t,n)=>{n.d(t,{CW:()=>r,lV:()=>i,cx:()=>o,JQ:()=>s,BM:()=>a,ok:()=>u,ol:()=>c,HP:()=>l,Ee:()=>h,On:()=>d,es:()=>f,Ny:()=>p});const r=m(/[A-Za-z]/),i=m(/[\dA-Za-z]/),o=m(/[#-'*+\--9=?A-Z^-~]/);function s(e){return null!==e&&(e<32||127===e)}const a=m(/\d/),u=m(/[\dA-Fa-f]/),c=m(/[!-/:-@[-`{-~]/);function l(e){return null!==e&&e<-2}function h(e){return null!==e&&(e<0||32===e)}function d(e){return-2===e||-1===e||32===e}const f=m(/[!-\/:-@\[-`\{-~\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061D-\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u09FD\u0A76\u0AF0\u0C77\u0C84\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1B7D\u1B7E\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E4F\u2E52-\u2E5D\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]/),p=m(/\s/);function m(e){return function(t){return null!==t&&e.test(String.fromCharCode(t))}}},67399:(e,t,n)=>{n.d(t,{Cv:()=>o,D0:()=>s,Dy:()=>i});var r=n(33168);r.default,r.SchemaAnalyzer;const i=r.analyzeDocuments,o=(r.getSchemaPaths,r.getSimplifiedSchema),s=r.parseSchema;r.schemaStats,r.toTypescriptTypeDefinition},68526:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.AggregationCursor=void 0;const r=n(17562),i=n(36411),o=n(62016),s=n(96357),a=n(145),u=n(61066),c=n(36649);class l extends c.ExplainableCursor{constructor(e,t,n=[],i={}){super(e,t,i),this.pipeline=n,this.aggregateOptions=i;const o=this.pipeline[this.pipeline.length-1];if(null!=this.cursorOptions.timeoutMS&&this.cursorOptions.timeoutMode===u.CursorTimeoutMode.ITERATION&&(null!=o?.$merge||null!=o?.$out))throw new r.MongoAPIError("Cannot use $out or $merge stage with ITERATION timeoutMode")}clone(){const e=(0,a.mergeOptions)({},this.aggregateOptions);return delete e.session,new l(this.client,this.namespace,this.pipeline,{...e})}map(e){return super.map(e)}async _initialize(e){const t={...this.aggregateOptions,...this.cursorOptions,session:e,signal:this.signal};if(t.explain)try{(0,i.validateExplainTimeoutOptions)(t,i.Explain.fromOptions(t))}catch{throw new r.MongoAPIError("timeoutMS cannot be used with explain when explain is specified in aggregateOptions")}const n=new o.AggregateOperation(this.namespace,this.pipeline,t),a=await(0,s.executeOperation)(this.client,n,this.timeoutContext);return{server:n.server,session:e,response:a}}async explain(e,t){const{explain:n,timeout:r}=this.resolveExplainTimeoutOptions(e,t);return(await(0,s.executeOperation)(this.client,new o.AggregateOperation(this.namespace,this.pipeline,{...this.aggregateOptions,...this.cursorOptions,...r,explain:n??!0}))).shift(this.deserializationOptions)}addStage(e){if(this.throwIfInitialized(),null!=this.cursorOptions.timeoutMS&&this.cursorOptions.timeoutMode===u.CursorTimeoutMode.ITERATION&&(null!=e.$out||null!=e.$merge))throw new r.MongoAPIError("Cannot use $out or $merge stage with ITERATION timeoutMode");return this.pipeline.push(e),this}group(e){return this.addStage({$group:e})}limit(e){return this.addStage({$limit:e})}match(e){return this.addStage({$match:e})}out(e){return this.addStage({$out:e})}project(e){return this.addStage({$project:e})}lookup(e){return this.addStage({$lookup:e})}redact(e){return this.addStage({$redact:e})}skip(e){return this.addStage({$skip:e})}sort(e){return this.addStage({$sort:e})}unwind(e){return this.addStage({$unwind:e})}geoNear(e){return this.addStage({$geoNear:e})}}t.AggregationCursor=l},68746:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.OnDemandDocument=void 0;const r=n(75080);class i{constructor(e,t=0,n=!1,i){this.cache=Object.create(null),this.indexFound=Object.create(null),this.bson=e,this.offset=t,this.isArray=n,this.elements=i??(0,r.parseToElementsToArray)(this.bson,t)}isElementName(e,t){const n=t[2],r=t[1];if(e.length!==n)return!1;const i=r+n;for(let t=r,n=0;n<e.length&&t<i;n++,t++)if(this.bson[t]!==e.charCodeAt(n))return!1;return!0}getElement(e){const t=this.cache[e];if(!1===t)return null;if(null!=t)return t;if("number"==typeof e){if(this.isArray){if(e<this.elements.length){const t={element:this.elements[e],value:void 0};return this.cache[e]=t,this.indexFound[e]=!0,t}return null}return null}for(let t=0;t<this.elements.length;t++){const n=this.elements[t];if(!(t in this.indexFound)&&this.isElementName(e,n)){const r={element:n,value:void 0};return this.cache[e]=r,this.indexFound[t]=!0,r}}return this.cache[e]=!1,null}toJSValue(e,t){const n=e[0],o=e[3],s=e[4];if(t!==n)return null;switch(t){case r.BSONType.null:case r.BSONType.undefined:return null;case r.BSONType.double:return(0,r.getFloat64LE)(this.bson,o);case r.BSONType.int:return(0,r.getInt32LE)(this.bson,o);case r.BSONType.long:return(0,r.getBigInt64LE)(this.bson,o);case r.BSONType.bool:return Boolean(this.bson[o]);case r.BSONType.objectId:return new r.ObjectId(this.bson.subarray(o,o+12));case r.BSONType.timestamp:return new r.Timestamp((0,r.getBigInt64LE)(this.bson,o));case r.BSONType.string:return(0,r.toUTF8)(this.bson,o+4,o+s-1,!1);case r.BSONType.binData:{const e=(0,r.getInt32LE)(this.bson,o),t=this.bson[o+4];if(2===t){const t=(0,r.getInt32LE)(this.bson,o+1+4);if(t<0)throw new r.BSONError("Negative binary type element size found for subtype 0x02");if(t>e-4)throw new r.BSONError("Binary type with subtype 0x02 contains too long binary size");if(t<e-4)throw new r.BSONError("Binary type with subtype 0x02 contains too short binary size");return new r.Binary(this.bson.subarray(o+1+4+4,o+1+4+4+t),2)}return new r.Binary(this.bson.subarray(o+1+4,o+1+4+e),t)}case r.BSONType.date:return new Date(Number((0,r.getBigInt64LE)(this.bson,o)));case r.BSONType.object:return new i(this.bson,o);case r.BSONType.array:return new i(this.bson,o,!0);default:throw new r.BSONError(`Unsupported BSON type: ${t}`)}}size(){return this.elements.length}has(e){const t=this.cache[e];return!1!==t&&(null!=t||null!=this.getElement(e))}get(e,t,n){const i=this.getElement(e);if(null==i){if(!0===n)throw new r.BSONError(`BSON element "${e}" is missing`);return null}if(null==i.value){const o=this.toJSValue(i.element,t);if(null==o){if(!0===n)throw new r.BSONError(`BSON element "${e}" is missing`);return null}i.value=o}return i.value}getNumber(e,t){const n=this.get(e,r.BSONType.bool),i=null==n?null:n?1:0,o=this.get(e,r.BSONType.long),s=null==o?null:Number(o),a=i??s??this.get(e,r.BSONType.int)??this.get(e,r.BSONType.double);if(!0===t&&null==a)throw new r.BSONError(`BSON element "${e}" is missing`);return a}toObject(e){return(0,r.deserialize)(this.bson,{...e,index:this.offset,allowObjectSmallerThanBufferSize:!0})}toBytes(){const e=(0,r.getInt32LE)(this.bson,this.offset);return this.bson.subarray(this.offset,this.offset+e)}}t.OnDemandDocument=i},68838:function(e,t){var n;(function(){var r,i={},o={currentLanguage:"en",zeroFormat:null,nullFormat:null,defaultFormat:"0,0"},s={currentLanguage:o.currentLanguage,zeroFormat:o.zeroFormat,nullFormat:o.nullFormat,defaultFormat:o.defaultFormat},a={bytes:["B","KB","MB","GB","TB","PB","EB","ZB","YB"],iec:["B","KiB","MiB","GiB","TiB","PiB","EiB","ZiB","YiB"]};function u(e){this._value=e}function c(e,t,n,r){var i,o,s,a,u=e.toString().split("."),c=t-(r||0);return i=2===u.length?Math.min(Math.max(u[1].length,c),t):c,a=(n(e*(s=Math.pow(10,i)))/s).toFixed(i),r>t-i&&(o=new RegExp("\\.?0{1,"+(r-(t-i))+"}$"),a=a.replace(o,"")),a}function l(e,t,n){var r,o,a,u,l=!1,h=!1,d=!1,f="",p=!1,m=!1,g=!1,_=!1,y=!1,v="",E=!1;return null===e&&(e=0),r=Math.abs(e),t.indexOf("(")>-1?(l=!0,t=t.slice(1,-1)):t.indexOf("+")>-1&&(h=!0,t=t.replace(/\+/g,"")),t.indexOf("a")>-1&&(p=t.indexOf("aK")>=0,m=t.indexOf("aM")>=0,g=t.indexOf("aB")>=0,_=t.indexOf("aT")>=0,y=p||m||g||_,t.indexOf(" a")>-1&&(f=" "),t=t.replace(new RegExp(f+"a[KMBT]?"),""),r>=Math.pow(10,12)&&!y||_?(f+=i[s.currentLanguage].abbreviations.trillion,e/=Math.pow(10,12)):r<Math.pow(10,12)&&r>=Math.pow(10,9)&&!y||g?(f+=i[s.currentLanguage].abbreviations.billion,e/=Math.pow(10,9)):r<Math.pow(10,9)&&r>=Math.pow(10,6)&&!y||m?(f+=i[s.currentLanguage].abbreviations.million,e/=Math.pow(10,6)):(r<Math.pow(10,6)&&r>=Math.pow(10,3)&&!y||p)&&(f+=i[s.currentLanguage].abbreviations.thousand,e/=Math.pow(10,3))),t.indexOf("[.]")>-1&&(d=!0,t=t.replace("[.]",".")),o=e.toString().split(".")[0],a=t.split(".")[1],u=t.indexOf(","),a?(o=(v=a.indexOf("[")>-1?c(e,(a=(a=a.replace("]","")).split("["))[0].length+a[1].length,n,a[1].length):c(e,a.length,n)).split(".")[0],v=v.indexOf(".")>-1?i[s.currentLanguage].delimiters.decimal+v.split(".")[1]:"",d&&0===Number(v.slice(1))&&(v="")):o=c(e,null,n),o.indexOf("-")>-1&&(o=o.slice(1),E=!0),u>-1&&(o=o.toString().replace(/(\d)(?=(\d{3})+(?!\d))/g,"$1"+i[s.currentLanguage].delimiters.thousands)),0===t.indexOf(".")&&(o=""),(l&&E?"(":"")+(!l&&E?"-":"")+(!E&&h?"+":"")+o+v+(f||"")+(l&&E?")":"")}function h(e){var t=e.toString().split(".");return t.length<2?1:Math.pow(10,t[1].length)}function d(){return Array.prototype.slice.call(arguments).reduce((function(e,t){var n=h(e),r=h(t);return n>r?n:r}),-1/0)}(r=function(e){return new u(e=r.isNumeral(e)?e.value():0===e||void 0===e?0:null===e?null:Number(e)?Number(e):r.fn.unformat(e))}).version="1.5.6",r.isNumeral=function(e){return e instanceof u},r.language=function(e,t){if(!e)return s.currentLanguage;if((e=e.toLowerCase())&&!t){if(!i[e])throw new Error("Unknown language : "+e);s.currentLanguage=e}return!t&&i[e]||function(e,t){i[e]=t}(e,t),r},r.reset=function(){for(var e in o)s[e]=o[e]},r.languageData=function(e){if(!e)return i[s.currentLanguage];if(!i[e])throw new Error("Unknown language : "+e);return i[e]},r.language("en",{delimiters:{thousands:",",decimal:"."},abbreviations:{thousand:"k",million:"m",billion:"b",trillion:"t"},ordinal:function(e){var t=e%10;return 1==~~(e%100/10)?"th":1===t?"st":2===t?"nd":3===t?"rd":"th"},currency:{symbol:"$"}}),r.zeroFormat=function(e){s.zeroFormat="string"==typeof e?e:null},r.nullFormat=function(e){s.nullFormat="string"==typeof e?e:null},r.defaultFormat=function(e){s.defaultFormat="string"==typeof e?e:"0.0"},r.validate=function(e,t){var n,i,o,s,a,u,c,l;if("string"!=typeof e&&(e+="",console.warn&&console.warn("Numeral.js: Value is not string. It has been co-erced to: ",e)),(e=e.trim()).match(/^\d+$/))return!0;if(""===e)return!1;try{c=r.languageData(t)}catch(e){c=r.languageData(r.language())}return o=c.currency.symbol,a=c.abbreviations,n=c.delimiters.decimal,i="."===c.delimiters.thousands?"\\.":c.delimiters.thousands,!(null!==(l=e.match(/^[^\d]+/))&&(e=e.substr(1),l[0]!==o)||null!==(l=e.match(/[^\d]+$/))&&(e=e.slice(0,-1),l[0]!==a.thousand&&l[0]!==a.million&&l[0]!==a.billion&&l[0]!==a.trillion)||(u=new RegExp(i+"{2}"),e.match(/[^\d.,]/g)||(s=e.split(n)).length>2||(s.length<2?!s[0].match(/^\d+.*\d$/)||s[0].match(u):1===s[0].length?!s[0].match(/^\d+$/)||s[0].match(u)||!s[1].match(/^\d+$/):!s[0].match(/^\d+.*\d$/)||s[0].match(u)||!s[1].match(/^\d+$/))))},Array.prototype.reduce||(Array.prototype.reduce=function(e){if(null===this)throw new TypeError("Array.prototype.reduce called on null or undefined");if("function"!=typeof e)throw new TypeError(e+" is not a function");var t,n=Object(this),r=n.length>>>0,i=0;if(2===arguments.length)t=arguments[1];else{for(;i<r&&!(i in n);)i++;if(i>=r)throw new TypeError("Reduce of empty array with no initial value");t=n[i++]}for(;i<r;i++)i in n&&(t=e(t,n[i],i,n));return t}),r.fn=u.prototype={clone:function(){return r(this)},format:function(e,t){return function(e,t,n){return 0===e._value&&null!==s.zeroFormat?s.zeroFormat:null===e._value&&null!==s.nullFormat?s.nullFormat:t.indexOf("$")>-1?function(e,t,n){var r,o,a=t.indexOf("$"),u=t.indexOf("("),c=t.indexOf("-"),h="";return t.indexOf(" $")>-1?(h=" ",t=t.replace(" $","")):t.indexOf("$ ")>-1?(h=" ",t=t.replace("$ ","")):t=t.replace("$",""),o=l(e._value,t,n),a<=1?o.indexOf("(")>-1||o.indexOf("-")>-1?(r=1,(a<u||a<c)&&(r=0),(o=o.split("")).splice(r,0,i[s.currentLanguage].currency.symbol+h),o=o.join("")):o=i[s.currentLanguage].currency.symbol+h+o:o.indexOf(")")>-1?((o=o.split("")).splice(-1,0,h+i[s.currentLanguage].currency.symbol),o=o.join("")):o=o+h+i[s.currentLanguage].currency.symbol,o}(e,t,n):t.indexOf("%")>-1?function(e,t,n){var r,i="",o=100*e._value;return t.indexOf(" %")>-1?(i=" ",t=t.replace(" %","")):t=t.replace("%",""),(r=l(o,t,n)).indexOf(")")>-1?((r=r.split("")).splice(-1,0,i+"%"),r=r.join("")):r=r+i+"%",r}(e,t,n):t.indexOf(":")>-1?function(e){var t=Math.floor(e._value/60/60),n=Math.floor((e._value-60*t*60)/60),r=Math.round(e._value-60*t*60-60*n);return t+":"+(n<10?"0"+n:n)+":"+(r<10?"0"+r:r)}(e):t.indexOf("b")>-1||t.indexOf("ib")>-1?function(e,t,n){var r,i,o,s=t.indexOf("ib")>-1?a.iec:a.bytes,u=e._value,c="";for(t.indexOf(" b")>-1||t.indexOf(" ib")>-1?(c=" ",t=t.replace(" ib","").replace(" b","")):t=t.replace("ib","").replace("b",""),r=0;r<=s.length;r++)if(i=Math.pow(1024,r),o=Math.pow(1024,r+1),null===u||0===u||u>=i&&u<o){c+=s[r],i>0&&(u/=i);break}return l(u,t,n)+c}(e,t,n):t.indexOf("o")>-1?function(e,t,n){var r="";return t.indexOf(" o")>-1?(r=" ",t=t.replace(" o","")):t=t.replace("o",""),r+=i[s.currentLanguage].ordinal(e._value),l(e._value,t,n)+r}(e,t,n):l(e._value,t,n)}(this,e||s.defaultFormat,void 0!==t?t:Math.round)},unformat:function(e){return"[object Number]"===Object.prototype.toString.call(e)?e:function(e,t){var n,r,o,u,c,l,h=t,d=!1;if(t.indexOf(":")>-1)l=function(e){var t=e.split(":"),n=0;return 3===t.length?(n+=60*Number(t[0])*60,n+=60*Number(t[1]),n+=Number(t[2])):2===t.length&&(n+=60*Number(t[0]),n+=Number(t[1])),Number(n)}(t);else if(t===s.zeroFormat||t===s.nullFormat)l=0;else{for("."!==i[s.currentLanguage].delimiters.decimal&&(t=t.replace(/\./g,"").replace(i[s.currentLanguage].delimiters.decimal,".")),n=new RegExp("[^a-zA-Z]"+i[s.currentLanguage].abbreviations.thousand+"(?:\\)|(\\"+i[s.currentLanguage].currency.symbol+")?(?:\\))?)?$"),r=new RegExp("[^a-zA-Z]"+i[s.currentLanguage].abbreviations.million+"(?:\\)|(\\"+i[s.currentLanguage].currency.symbol+")?(?:\\))?)?$"),o=new RegExp("[^a-zA-Z]"+i[s.currentLanguage].abbreviations.billion+"(?:\\)|(\\"+i[s.currentLanguage].currency.symbol+")?(?:\\))?)?$"),u=new RegExp("[^a-zA-Z]"+i[s.currentLanguage].abbreviations.trillion+"(?:\\)|(\\"+i[s.currentLanguage].currency.symbol+")?(?:\\))?)?$"),c=1;c<=a.bytes.length&&!(d=(t.indexOf(a.bytes[c])>-1||t.indexOf(a.iec[c])>-1)&&Math.pow(1024,c));c++);l=d||1,l*=h.match(n)?Math.pow(10,3):1,l*=h.match(r)?Math.pow(10,6):1,l*=h.match(o)?Math.pow(10,9):1,l*=h.match(u)?Math.pow(10,12):1,l*=t.indexOf("%")>-1?.01:1,l*=(t.split("-").length+Math.min(t.split("(").length-1,t.split(")").length-1))%2?1:-1,l*=Number(t.replace(/[^0-9\.]+/g,"")),l=d?Math.ceil(l):l}return e._value=l,e._value}(this,e||s.defaultFormat)},value:function(){return this._value},valueOf:function(){return this._value},set:function(e){return this._value=Number(e),this},add:function(e){var t=d.call(null,this._value,e);return this._value=[this._value,e].reduce((function(e,n,r,i){return e+t*n}),0)/t,this},subtract:function(e){var t=d.call(null,this._value,e);return this._value=[e].reduce((function(e,n,r,i){return e-t*n}),this._value*t)/t,this},multiply:function(e){return this._value=[this._value,e].reduce((function(e,t,n,r){var i=d(e,t);return e*i*(t*i)/(i*i)}),1),this},divide:function(e){return this._value=[this._value,e].reduce((function(e,t,n,r){var i=d(e,t);return e*i/(t*i)})),this},difference:function(e){return Math.abs(r(this._value).subtract(e).value())}},e.exports&&(e.exports=r),"undefined"==typeof ender&&(this.numeral=r),void 0===(n=function(){return r}.apply(t,[]))||(e.exports=n)}).call(this)},68923:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.GetMoreOperation=void 0;const r=n(75725),i=n(17562),o=n(145),s=n(35394);class a extends s.AbstractOperation{constructor(e,t,n,i){super(i),this.SERVER_COMMAND_RESPONSE_TYPE=r.CursorResponse,this.options=i,this.ns=e,this.cursorId=t,this.server=n}get commandName(){return"getMore"}buildCommand(e){if(null==this.cursorId||this.cursorId.isZero())throw new i.MongoRuntimeError("Unable to iterate cursor with no id");const t=this.ns.collection;if(null==t)throw new i.MongoRuntimeError("A collection name must be determined before getMore");const n={getMore:this.cursorId,collection:t};return"number"==typeof this.options.batchSize&&(n.batchSize=Math.abs(this.options.batchSize)),"number"==typeof this.options.maxAwaitTimeMS&&(n.maxTimeMS=this.options.maxAwaitTimeMS),void 0!==this.options.comment&&(0,o.maxWireVersion)(e)>=9&&(n.comment=this.options.comment),n}buildOptions(e){return{returnFieldSelector:null,documentsReturnedIn:"nextBatch",timeoutContext:e,...this.options}}handleOk(e){return e}}t.GetMoreOperation=a,(0,s.defineAspects)(a,[s.Aspect.READ_OPERATION,s.Aspect.MUST_SELECT_SAME_SERVER])},69429:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.RunCommandCursor=void 0;const r=n(17562),i=n(96357),o=n(68923),s=n(17668),a=n(145),u=n(61066);class c extends u.AbstractCursor{setComment(e){return this.getMoreOptions.comment=e,this}setMaxTimeMS(e){return this.getMoreOptions.maxAwaitTimeMS=e,this}setBatchSize(e){return this.getMoreOptions.batchSize=e,this}clone(){throw new r.MongoAPIError("Clone not supported, create a new cursor with db.runCursorCommand")}withReadConcern(e){throw new r.MongoAPIError("RunCommandCursor does not support readConcern it must be attached to the command being run")}addCursorFlag(e,t){throw new r.MongoAPIError("RunCommandCursor does not support cursor flags, they must be attached to the command being run")}maxTimeMS(e){throw new r.MongoAPIError("maxTimeMS must be configured on the command document directly, to configure getMore.maxTimeMS use cursor.setMaxTimeMS()")}batchSize(e){throw new r.MongoAPIError("batchSize must be configured on the command document directly, to configure getMore.batchSize use cursor.setBatchSize()")}constructor(e,t,n={}){super(e.client,(0,a.ns)(e.namespace),n),this.getMoreOptions={},this.db=e,this.command=Object.freeze({...t})}async _initialize(e){const t=new s.RunCursorCommandOperation(this.db.s.namespace,this.command,{...this.cursorOptions,session:e,readPreference:this.cursorOptions.readPreference}),n=await(0,i.executeOperation)(this.client,t,this.timeoutContext);return{server:t.server,session:e,response:n}}async getMore(e){if(!this.session)throw new r.MongoRuntimeError("Unexpected null session. A cursor creating command should have set this");const t=new o.GetMoreOperation(this.namespace,this.id,this.server,{...this.cursorOptions,session:this.session,...this.getMoreOptions});return await(0,i.executeOperation)(this.client,t,this.timeoutContext)}}t.RunCommandCursor=c},69878:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CreateCollectionOperation=void 0,t.createCollections=async function(e,t,n){const i=a.TimeoutContext.create({session:n.session,serverSelectionTimeoutMS:e.client.s.options.serverSelectionTimeoutMS,waitQueueTimeoutMS:e.client.s.options.waitQueueTimeoutMS,timeoutMS:n.timeoutMS}),o=n.encryptedFields??e.client.s.options.autoEncryption?.encryptedFieldsMap?.[`${e.databaseName}.${t}`];if(o){class a extends m{buildCommandDocument(e,t){if(!e.description.loadBalanced&&(0,u.maxWireVersion)(e)<r.MIN_SUPPORTED_QE_WIRE_VERSION)throw new s.MongoCompatibilityError(`${p} The minimum server version required is ${r.MIN_SUPPORTED_QE_SERVER_VERSION}`);return super.buildCommandDocument(e,t)}}const c=o.escCollection??`enxcol_.${t}.esc`,h=o.ecocCollection??`enxcol_.${t}.ecoc`;for(const t of[c,h]){const r=new a(e,t,{clusteredIndex:{key:{_id:1},unique:!0},session:n.session});await(0,l.executeOperation)(e.client,r,i)}n.encryptedFields||(n={...n,encryptedFields:o})}const c=await(0,l.executeOperation)(e.client,new m(e,t,n),i);if(o){const r=h.CreateIndexesOperation.fromIndexSpecification(e,t,{__safeContent__:1},{session:n.session});await(0,l.executeOperation)(e.client,r,i)}return c};const r=n(96856),i=n(75725),o=n(19498),s=n(17562),a=n(7799),u=n(145),c=n(78130),l=n(96357),h=n(22847),d=n(35394),f=new Set(["w","wtimeout","timeoutMS","j","fsync","autoIndexId","pkFactory","raw","readPreference","session","readConcern","writeConcern","raw","fieldsAsRaw","useBigInt64","promoteLongs","promoteValues","promoteBuffers","bsonRegExp","serializeFunctions","ignoreUndefined","enableUtf8Validation"]),p="Driver support of Queryable Encryption is incompatible with server. Upgrade server to use Queryable Encryption.";class m extends c.CommandOperation{constructor(e,t,n={}){super(e,n),this.SERVER_COMMAND_RESPONSE_TYPE=i.MongoDBResponse,this.options=n,this.db=e,this.name=t}get commandName(){return"create"}buildCommandDocument(e,t){return{create:this.name,...Object.fromEntries(Object.entries(this.options).filter((([e,t])=>null!=t&&"function"!=typeof t&&!f.has(e))))}}handleOk(e){return new o.Collection(this.db,this.name,this.options)}}t.CreateCollectionOperation=m,(0,d.defineAspects)(m,[d.Aspect.WRITE_OPERATION])},70136:(e,t,n)=>{var r,i=n(67787).Buffer;Object.defineProperty(t,"__esModule",{value:!0}),t.AutoEncrypter=t.AutoEncryptionLoggerLevel=void 0;const o=n(26272),s=n(75080),a=n(91869),u=n(8500),c=n(17562),l=n(22220),h=n(145),d=n(73357),f=n(93992),p=n(86981),m=n(95724),g=n(51825),_=n(97515);t.AutoEncryptionLoggerLevel=Object.freeze({FatalError:0,Error:1,Warning:2,Info:3,Trace:4});class y{static getMongoCrypt(){const e=(0,u.getMongoDBClientEncryption)();if("kModuleError"in e)throw e.kModuleError;return e.MongoCrypt}constructor(e,t){if(this[r]=!1,this._client=e,this._bypassEncryption=!0===t.bypassAutoEncryption,this._keyVaultNamespace=t.keyVaultNamespace||"admin.datakeys",this._keyVaultClient=t.keyVaultClient||e,this._metaDataClient=t.metadataClient||e,this._proxyOptions=t.proxyOptions||{},this._tlsOptions=t.tlsOptions||{},this._kmsProviders=t.kmsProviders||{},this._credentialProviders=t.credentialProviders,t.credentialProviders?.aws&&!(0,g.isEmptyCredentials)("aws",this._kmsProviders))throw new p.MongoCryptInvalidArgumentError("Can only provide a custom AWS credential provider when the state machine is configured for automatic AWS credential fetching");const n={enableMultipleCollinfo:!0,cryptoCallbacks:f};t.schemaMap&&(n.schemaMap=i.isBuffer(t.schemaMap)?t.schemaMap:(0,s.serialize)(t.schemaMap)),t.encryptedFieldsMap&&(n.encryptedFieldsMap=i.isBuffer(t.encryptedFieldsMap)?t.encryptedFieldsMap:(0,s.serialize)(t.encryptedFieldsMap)),n.kmsProviders=i.isBuffer(this._kmsProviders)?this._kmsProviders:(0,s.serialize)(this._kmsProviders),t.options?.logger&&(n.logger=t.options.logger),t.extraOptions&&t.extraOptions.cryptSharedLibPath&&(n.cryptSharedLibPath=t.extraOptions.cryptSharedLibPath),t.bypassQueryAnalysis&&(n.bypassQueryAnalysis=t.bypassQueryAnalysis),null!=t.keyExpirationMS&&(n.keyExpirationMS=t.keyExpirationMS),this._bypassMongocryptdAndCryptShared=this._bypassEncryption||!!t.bypassQueryAnalysis,t.extraOptions&&t.extraOptions.cryptSharedLibSearchPaths?n.cryptSharedLibSearchPaths=t.extraOptions.cryptSharedLibSearchPaths:this._bypassMongocryptdAndCryptShared||(n.cryptSharedLibSearchPaths=["$SYSTEM"]);const a=y.getMongoCrypt();if(this._mongocrypt=new a(n),this._contextCounter=0,t.extraOptions&&t.extraOptions.cryptSharedLibRequired&&!this.cryptSharedLibVersionInfo)throw new p.MongoCryptInvalidArgumentError("`cryptSharedLibRequired` set but no crypt_shared library loaded");if(!this._bypassMongocryptdAndCryptShared&&!this.cryptSharedLibVersionInfo){this._mongocryptdManager=new m.MongocryptdManager(t.extraOptions);const e={serverSelectionTimeoutMS:1e4};null!=t.extraOptions&&"string"==typeof t.extraOptions.mongocryptdURI||o.getDefaultAutoSelectFamily||(e.family=4),o.getDefaultAutoSelectFamily&&Object.assign(e,(0,d.autoSelectSocketOptions)(this._client.s?.options??{})),this._mongocryptdClient=new l.MongoClient(this._mongocryptdManager.uri,e)}}async init(){if(!this._bypassMongocryptdAndCryptShared&&!this.cryptSharedLibVersionInfo){if(!this._mongocryptdManager)throw new c.MongoRuntimeError("Reached impossible state: mongocryptdManager is undefined when neither bypassSpawn nor the shared lib are specified.");if(!this._mongocryptdClient)throw new c.MongoRuntimeError("Reached impossible state: mongocryptdClient is undefined when neither bypassSpawn nor the shared lib are specified.");this._mongocryptdManager.bypassSpawn||await this._mongocryptdManager.spawn();try{return await this._mongocryptdClient.connect()}catch(e){throw new c.MongoRuntimeError("Unable to connect to `mongocryptd`, please make sure it is running or in your PATH for auto-spawn",{cause:e})}}}async close(){await(this._mongocryptdClient?.close())}async encrypt(e,t,n={}){if(n.signal?.throwIfAborted(),this._bypassEncryption)return t;const r=i.isBuffer(t)?t:(0,s.serialize)(t,n),o=this._mongocrypt.makeEncryptionContext(h.MongoDBCollectionNamespace.fromString(e).db,r);o.id=this._contextCounter++,o.ns=e,o.document=t;const a=new _.StateMachine({promoteValues:!1,promoteLongs:!1,proxyOptions:this._proxyOptions,tlsOptions:this._tlsOptions,socketOptions:(0,d.autoSelectSocketOptions)(this._client.s.options)});return(0,s.deserialize)(await a.execute(this,o,n),{promoteValues:!1,promoteLongs:!1})}async decrypt(e,t={}){t.signal?.throwIfAborted();const n=this._mongocrypt.makeDecryptionContext(e);n.id=this._contextCounter++;const r=new _.StateMachine({...t,proxyOptions:this._proxyOptions,tlsOptions:this._tlsOptions,socketOptions:(0,d.autoSelectSocketOptions)(this._client.s.options)});return await r.execute(this,n,t)}async askForKMSCredentials(){return await(0,g.refreshKMSCredentials)(this._kmsProviders,this._credentialProviders)}get cryptSharedLibVersionInfo(){return this._mongocrypt.cryptSharedLibVersionInfo}static get libmongocryptVersion(){return y.getMongoCrypt().libmongocryptVersion}}t.AutoEncrypter=y,r=a.kDecorateResult},70839:(e,t,n)=>{var r=n(67787).Buffer;Object.defineProperty(t,"__esModule",{value:!0}),t.Plain=void 0;const i=n(75080),o=n(17562),s=n(145),a=n(31057);class u extends a.AuthProvider{async auth(e){const{connection:t,credentials:n}=e;if(!n)throw new o.MongoMissingCredentialsError("AuthContext must provide credentials.");const{username:a,password:u}=n,c={saslStart:1,mechanism:"PLAIN",payload:new i.Binary(r.from(`\0${a}\0${u}`)),autoAuthorize:1};await t.command((0,s.ns)("$external.$cmd"),c,void 0)}}t.Plain=u},71235:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Admin=void 0;const r=n(75080),i=n(96357),o=n(11706),s=n(64125),a=n(17668),u=n(31480),c=n(145);t.Admin=class{constructor(e){this.s={db:e}}async command(e,t){return await(0,i.executeOperation)(this.s.db.client,new a.RunCommandOperation(new c.MongoDBNamespace("admin"),e,{...(0,r.resolveBSONOptions)(t),session:t?.session,readPreference:t?.readPreference,timeoutMS:t?.timeoutMS??this.s.db.timeoutMS}))}async buildInfo(e){return await this.command({buildinfo:1},e)}async serverInfo(e){return await this.command({buildinfo:1},e)}async serverStatus(e){return await this.command({serverStatus:1},e)}async ping(e){return await this.command({ping:1},e)}async removeUser(e,t){return await(0,i.executeOperation)(this.s.db.client,new s.RemoveUserOperation(this.s.db,e,{dbName:"admin",...t}))}async validateCollection(e,t={}){return await(0,i.executeOperation)(this.s.db.client,new u.ValidateCollectionOperation(this,e,t))}async listDatabases(e){return await(0,i.executeOperation)(this.s.db.client,new o.ListDatabasesOperation(this.s.db,{timeoutMS:this.s.db.timeoutMS,...e}))}async replSetGetStatus(e){return await this.command({replSetGetStatus:1},e)}}},71470:(e,t,n)=>{var r=n(67787).Buffer;Object.defineProperty(t,"__esModule",{value:!0}),t.CryptoConnection=t.SizedMessageTransform=t.Connection=void 0,t.hasSessionSupport=function(e){return null!=e.description.logicalSessionTimeoutMinutes};const i=n(93874),o=n(37668),s=n(75080),a=n(91869),u=n(17562),c=n(93347),l=n(4642),h=n(13700),d=n(89167),f=n(14019),p=n(7799),m=n(145),g=n(38216),_=n(15620),y=n(23611),v=n(64515),E=n(97531),S=n(75725),w=n(61428);class C extends l.TypedEventEmitter{constructor(e,t){super(),this.lastHelloMS=-1,this.helloOk=!1,this.delayedTimeoutId=null,this.closed=!1,this.clusterTime=null,this.error=null,this.dataEvents=null,this.on("error",m.noop),this.socket=e,this.id=t.id,this.address=function(e,t){if(t.proxyHost)return t.hostAddress.toString();const{remoteAddress:n,remotePort:r}=e;return"string"==typeof n&&"number"==typeof r?m.HostAddress.fromHostPort(n,r).toString():(0,m.uuidV4)().toString("hex")}(e,t),this.socketTimeoutMS=t.socketTimeoutMS??0,this.monitorCommands=t.monitorCommands,this.serverApi=t.serverApi,this.mongoLogger=t.mongoLogger,this.established=!1,this.description=new y.StreamDescription(this.address,t),this.generation=t.generation,this.lastUseTime=(0,m.now)(),this.messageStream=this.socket.on("error",this.onSocketError.bind(this)).pipe(new O({connection:this})).on("error",this.onTransformError.bind(this)),this.socket.on("close",this.onClose.bind(this)),this.socket.on("timeout",this.onTimeout.bind(this)),this.messageStream.pause()}get hello(){return this.description.hello}set hello(e){this.description.receiveResponse(e),Object.freeze(this.description)}get serviceId(){return this.hello?.serviceId}get loadBalanced(){return this.description.loadBalanced}get idleTime(){return(0,m.calculateDurationInMs)(this.lastUseTime)}get hasSessionSupport(){return null!=this.description.logicalSessionTimeoutMinutes}get supportsOpMsg(){return null!=this.description&&(0,m.maxWireVersion)(this)>=6&&!this.description.__nodejs_mock_server__}get shouldEmitAndLogCommand(){return(this.monitorCommands||this.established&&!this.authContext?.reauthenticating&&this.mongoLogger?.willLog(c.MongoLoggableComponent.COMMAND,c.SeverityLevel.DEBUG))??!1}markAvailable(){this.lastUseTime=(0,m.now)()}onSocketError(e){this.onError(new u.MongoNetworkError(e.message,{cause:e}))}onTransformError(e){this.onError(e)}onError(e){this.cleanup(e)}onClose(){const e=`connection ${this.id} to ${this.address} closed`;this.cleanup(new u.MongoNetworkError(e))}onTimeout(){this.delayedTimeoutId=(0,o.setTimeout)((()=>{const e=`connection ${this.id} to ${this.address} timed out`,t=null==this.hello;this.cleanup(new u.MongoNetworkTimeoutError(e,{beforeHandshake:t}))}),1).unref()}destroy(){if(this.closed)return;this.removeAllListeners(C.PINNED),this.removeAllListeners(C.UNPINNED);const e=`connection ${this.id} to ${this.address} closed`;this.cleanup(new u.MongoNetworkError(e))}cleanup(e){this.closed||(this.socket.destroy(),this.error=e,this.dataEvents?.throw(e).then(void 0,m.squashError),this.closed=!0,this.emit(C.CLOSE))}prepareCommand(e,t,n){let r={...t};const i=(0,w.getReadPreference)(n),o=n?.session;let s=this.clusterTime;if(this.serverApi){const{version:e,strict:t,deprecationErrors:n}=this.serverApi;r.apiVersion=e,null!=t&&(r.apiStrict=t),null!=n&&(r.apiDeprecationErrors=n)}if(this.hasSessionSupport&&o){o.clusterTime&&s&&o.clusterTime.clusterTime.greaterThan(s.clusterTime)&&(s=o.clusterTime);const e=(0,f.applySession)(o,r,n);if(e)throw e}else if(o?.explicit)throw new u.MongoCompatibilityError("Current topology does not support sessions");s&&(r.$clusterTime=s),this.description.type!==d.ServerType.Standalone&&((0,w.isSharded)(this)||this.description.loadBalanced||!this.supportsOpMsg||!0!==n.directConnection||"primary"!==i?.mode?(0,w.isSharded)(this)&&!this.supportsOpMsg&&"primary"!==i?.mode?r={$query:r,$readPreference:i.toJSON()}:"primary"!==i?.mode&&(r.$readPreference=i.toJSON()):r.$readPreference=h.ReadPreference.primaryPreferred.toJSON());const a={numberToSkip:0,numberToReturn:-1,checkKeys:!1,secondaryOk:i.secondaryOk(),...n};return n.timeoutContext?.addMaxTimeMSToCommand(r,n),this.supportsOpMsg?new _.OpMsgRequest(e,r,a):new _.OpQueryRequest(e,r,a)}async*sendWire(e,t,n){this.throwIfAborted();const r=t.socketTimeoutMS??t?.timeoutContext?.getSocketTimeoutMS()??this.socketTimeoutMS;this.socket.setTimeout(r);try{if(await this.writeCommand(e,{agreedCompressor:this.description.compressor??"none",zlibCompressionLevel:this.description.zlibCompressionLevel,timeoutContext:t.timeoutContext,signal:t.signal}),t.noResponse||e.moreToCome)return void(yield S.MongoDBResponse.empty);if(this.throwIfAborted(),t.timeoutContext?.csotEnabled()&&null!=t.timeoutContext.minRoundTripTime&&t.timeoutContext.remainingTimeMS<t.timeoutContext.minRoundTripTime)throw new u.MongoOperationTimeoutError("Server roundtrip time is greater than the time remaining");for await(const e of this.readMany(t)){this.socket.setTimeout(0);const t=e.parse(),i=(n??S.MongoDBResponse).make(t);yield i,this.throwIfAborted(),this.socket.setTimeout(r)}}finally{this.socket.setTimeout(0)}}async*sendCommand(e,t,n,r){n?.signal?.throwIfAborted();const i=this.prepareCommand(e.db,t,n);let o=0;this.shouldEmitAndLogCommand&&(o=(0,m.now)(),this.emitAndLogCommand(this.monitorCommands,C.COMMAND_STARTED,i.databaseName,this.established,new g.CommandStartedEvent(this,i,this.description.serverConnectionId)));const s=null!=n.documentsReturnedIn&&n.raw?{...n,raw:!1,fieldsAsRaw:{[n.documentsReturnedIn]:!0}}:n;let a,c;try{for await(a of(this.throwIfAborted(),this.sendWire(i,n,r))){if(c=void 0,null!=n.session&&(0,f.updateSessionFromResponse)(n.session,a),a.$clusterTime&&(this.clusterTime=a.$clusterTime,this.emit(C.CLUSTER_TIME_RECEIVED,a.$clusterTime)),0===a.ok){if(n.timeoutContext?.csotEnabled()&&a.isMaxTimeExpiredError)throw new u.MongoOperationTimeoutError("Server reported a timeout error",{cause:new u.MongoServerError(c??=a.toObject(s))});throw new u.MongoServerError(c??=a.toObject(s))}this.shouldEmitAndLogCommand&&this.emitAndLogCommand(this.monitorCommands,C.COMMAND_SUCCEEDED,i.databaseName,this.established,new g.CommandSucceededEvent(this,i,n.noResponse?void 0:i.moreToCome?{ok:1}:c??=a.toObject(s),o,this.description.serverConnectionId)),null==r?yield c??=a.toObject(s):yield a,this.throwIfAborted()}}catch(e){throw this.shouldEmitAndLogCommand&&this.emitAndLogCommand(this.monitorCommands,C.COMMAND_FAILED,i.databaseName,this.established,new g.CommandFailedEvent(this,i,e,o,this.description.serverConnectionId)),e}}async command(e,t,n={},r){this.throwIfAborted(),n.signal?.throwIfAborted();for await(const i of this.sendCommand(e,t,n,r)){if(n.timeoutContext?.csotEnabled())if(S.MongoDBResponse.is(i)){if(i.isMaxTimeExpiredError)throw new u.MongoOperationTimeoutError("Server reported a timeout error",{cause:new u.MongoServerError(i.toObject())})}else if(Array.isArray(i?.writeErrors)&&i.writeErrors.some((e=>e?.code===u.MONGODB_ERROR_CODES.MaxTimeMSExpired))||i?.writeConcernError?.code===u.MONGODB_ERROR_CODES.MaxTimeMSExpired)throw new u.MongoOperationTimeoutError("Server reported a timeout error",{cause:new u.MongoServerError(i)});return i}throw new u.MongoUnexpectedServerResponseError("Unable to get response from server")}exhaustCommand(e,t,n,r){(async()=>{this.throwIfAborted();for await(const i of this.sendCommand(e,t,n))r(void 0,i),this.throwIfAborted();throw new u.MongoUnexpectedServerResponseError("Server ended moreToCome unexpectedly")})().then(void 0,r)}throwIfAborted(){if(this.error)throw this.error}async writeCommand(e,t){const n="none"!==t.agreedCompressor&&_.OpCompressedRequest.canCompress(e)?new _.OpCompressedRequest(e,{agreedCompressor:t.agreedCompressor??"none",zlibCompressionLevel:t.zlibCompressionLevel??0}):e,i=r.concat(await n.toBin());if(t.timeoutContext?.csotEnabled()&&null!=t.timeoutContext.minRoundTripTime&&t.timeoutContext.remainingTimeMS<t.timeoutContext.minRoundTripTime)throw new u.MongoOperationTimeoutError("Server roundtrip time is greater than the time remaining");if(this.socket.write(i))return;const o=(0,m.once)(this.socket,"drain",t),s=t?.timeoutContext?.timeoutForSocketWrite,a=s?Promise.race([o,s]):o;try{return await a}catch(e){if(p.TimeoutError.is(e)){const e=new u.MongoOperationTimeoutError("Timed out at socket write");throw this.onError(e),e}throw e===t.signal?.reason&&this.onError(e),e}finally{s?.clear()}}async*readMany(e){try{this.dataEvents=(0,E.onData)(this.messageStream,e),this.messageStream.resume();for await(const e of this.dataEvents){const t=await(0,v.decompressResponse)(e);if(yield t,!t.moreToCome)return}}catch(t){if(p.TimeoutError.is(t)){const e=new u.MongoOperationTimeoutError(`Timed out during socket read (${t.duration}ms)`);throw this.dataEvents=null,this.onError(e),e}throw t===e.signal?.reason&&this.onError(t),t}finally{this.dataEvents=null,this.messageStream.pause()}}}t.Connection=C,C.COMMAND_STARTED=a.COMMAND_STARTED,C.COMMAND_SUCCEEDED=a.COMMAND_SUCCEEDED,C.COMMAND_FAILED=a.COMMAND_FAILED,C.CLUSTER_TIME_RECEIVED=a.CLUSTER_TIME_RECEIVED,C.CLOSE=a.CLOSE,C.PINNED=a.PINNED,C.UNPINNED=a.UNPINNED;class O extends i.Transform{constructor({connection:e}){super({writableObjectMode:!1,readableObjectMode:!0}),this.bufferPool=new m.BufferPool,this.connection=e}_transform(e,t,n){for(null!=this.connection.delayedTimeoutId&&((0,o.clearTimeout)(this.connection.delayedTimeoutId),this.connection.delayedTimeoutId=null),this.bufferPool.append(e);this.bufferPool.length;){const e=this.bufferPool.getInt32();if(null==e)break;if(e<0)return n(new u.MongoParseError(`Message size cannot be negative: ${e}`));if(e>this.bufferPool.length)break;const t=this.bufferPool.read(e);if(!this.push(t))return n(new u.MongoRuntimeError("SizedMessageTransform does not support backpressure"))}n()}}t.SizedMessageTransform=O,t.CryptoConnection=class extends C{constructor(e,t){super(e,t),this.autoEncrypter=t.autoEncrypter}async command(e,t,n,r){const{autoEncrypter:i}=this;if(!i)throw new u.MongoMissingDependencyError("No AutoEncrypter available for encryption",{dependencyName:"n/a"});const o=(0,m.maxWireVersion)(this);if(0===o)return await super.command(e,t,n,r);if(o<8)throw new u.MongoCompatibilityError("Auto-encryption requires a minimum MongoDB version of 4.2");const c=t.find||t.findAndModify?t.sort:null,l=t.createIndexes?t.indexes.map((e=>e.key)):null,h=await i.encrypt(e.toString(),t,n);if(null!=c&&(t.find||t.findAndModify)&&(h.sort=c),null!=l&&t.createIndexes)for(const[e,t]of l.entries())h.indexes[e].key=t;const d=await super.command(e,h,n,r??S.MongoDBResponse),f=await i.decrypt(d.toBytes(),n),p=r?.make(f)??(0,s.deserialize)(f,n);return i[a.kDecorateResult]&&(null==r?(0,m.decorateDecryptionResult)(p,d.toObject(),!0):p instanceof S.CursorResponse&&(p.encryptedResponse=d)),p}}},71906:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ListSearchIndexesCursor=void 0;const r=n(68526);class i extends r.AggregationCursor{constructor({fullNamespace:e,client:t},n,r={}){super(t,e,null==n?[{$listSearchIndexes:{}}]:[{$listSearchIndexes:{name:n}}],r)}}t.ListSearchIndexesCursor=i},72506:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.allowAbort=t.ALLOW_ABORT_INTERVAL_COUNT=void 0,t.ALLOW_ABORT_INTERVAL_COUNT=1e3,t.allowAbort=async function(e){return new Promise(((t,n)=>setTimeout((()=>{if(null==e?void 0:e.aborted)return n((null==e?void 0:e.reason)||new Error("Operation aborted"));t()}))))}},73357:(e,t,n)=>{var r=n(67787).Buffer;Object.defineProperty(t,"__esModule",{value:!0}),t.ClientEncryption=void 0,t.autoSelectSocketOptions=f;const i=n(75080),o=n(8500),s=n(7799),a=n(145),u=n(93992),c=n(86981),l=n(51825),h=n(97515);class d{static getMongoCrypt(){const e=(0,o.getMongoDBClientEncryption)();if("kModuleError"in e)throw e.kModuleError;return e.MongoCrypt}constructor(e,t){this._client=e,this._proxyOptions=t.proxyOptions??{},this._tlsOptions=t.tlsOptions??{},this._kmsProviders=t.kmsProviders||{};const{timeoutMS:n}=(0,a.resolveTimeoutOptions)(e,t);if(this._timeoutMS=n,this._credentialProviders=t.credentialProviders,t.credentialProviders?.aws&&!(0,l.isEmptyCredentials)("aws",this._kmsProviders))throw new c.MongoCryptInvalidArgumentError("Can only provide a custom AWS credential provider when the state machine is configured for automatic AWS credential fetching");if(null==t.keyVaultNamespace)throw new c.MongoCryptInvalidArgumentError("Missing required option `keyVaultNamespace`");const o={...t,cryptoCallbacks:u,kmsProviders:r.isBuffer(this._kmsProviders)?this._kmsProviders:(0,i.serialize)(this._kmsProviders)};this._keyVaultNamespace=t.keyVaultNamespace,this._keyVaultClient=t.keyVaultClient||e;const s=d.getMongoCrypt();this._mongoCrypt=new s(o)}async createDataKey(e,t={}){if(t.keyAltNames&&!Array.isArray(t.keyAltNames))throw new c.MongoCryptInvalidArgumentError(`Option "keyAltNames" must be an array of strings, but was of type ${typeof t.keyAltNames}.`);let n,r;t.keyAltNames&&t.keyAltNames.length>0&&(n=t.keyAltNames.map(((e,t)=>{if("string"!=typeof e)throw new c.MongoCryptInvalidArgumentError(`Option "keyAltNames" must be an array of strings, but item at index ${t} was of type ${typeof e}`);return(0,i.serialize)({keyAltName:e})}))),t.keyMaterial&&(r=(0,i.serialize)({keyMaterial:t.keyMaterial}));const o=(0,i.serialize)({provider:e,...t.masterKey}),u=this._mongoCrypt.makeDataKeyContext(o,{keyAltNames:n,keyMaterial:r}),l=new h.StateMachine({proxyOptions:this._proxyOptions,tlsOptions:this._tlsOptions,socketOptions:f(this._client.s.options)}),d=t?.timeoutContext??s.TimeoutContext.create((0,a.resolveTimeoutOptions)(this._client,{timeoutMS:this._timeoutMS})),p=(0,i.deserialize)(await l.execute(this,u,{timeoutContext:d})),{db:m,collection:g}=a.MongoDBCollectionNamespace.fromString(this._keyVaultNamespace),{insertedId:_}=await this._keyVaultClient.db(m).collection(g).insertOne(p,{writeConcern:{w:"majority"},timeoutMS:d?.csotEnabled()?d?.getRemainingTimeMSOrThrow():void 0});return _}async rewrapManyDataKey(e,t){let n;if(t){const e=Object.assign({provider:t.provider},t.masterKey);n=(0,i.serialize)(e)}const r=(0,i.serialize)(e),o=this._mongoCrypt.makeRewrapManyDataKeyContext(r,n),u=new h.StateMachine({proxyOptions:this._proxyOptions,tlsOptions:this._tlsOptions,socketOptions:f(this._client.s.options)}),c=s.TimeoutContext.create((0,a.resolveTimeoutOptions)(this._client,{timeoutMS:this._timeoutMS})),{v:l}=(0,i.deserialize)(await u.execute(this,o,{timeoutContext:c}));if(0===l.length)return{};const{db:d,collection:p}=a.MongoDBCollectionNamespace.fromString(this._keyVaultNamespace),m=l.map((e=>({updateOne:{filter:{_id:e._id},update:{$set:{masterKey:e.masterKey,keyMaterial:e.keyMaterial},$currentDate:{updateDate:!0}}}})));return{bulkWriteResult:await this._keyVaultClient.db(d).collection(p).bulkWrite(m,{writeConcern:{w:"majority"},timeoutMS:c.csotEnabled()?c?.remainingTimeMS:void 0})}}async deleteKey(e){const{db:t,collection:n}=a.MongoDBCollectionNamespace.fromString(this._keyVaultNamespace);return await this._keyVaultClient.db(t).collection(n).deleteOne({_id:e},{writeConcern:{w:"majority"},timeoutMS:this._timeoutMS})}getKeys(){const{db:e,collection:t}=a.MongoDBCollectionNamespace.fromString(this._keyVaultNamespace);return this._keyVaultClient.db(e).collection(t).find({},{readConcern:{level:"majority"},timeoutMS:this._timeoutMS})}async getKey(e){const{db:t,collection:n}=a.MongoDBCollectionNamespace.fromString(this._keyVaultNamespace);return await this._keyVaultClient.db(t).collection(n).findOne({_id:e},{readConcern:{level:"majority"},timeoutMS:this._timeoutMS})}async getKeyByAltName(e){const{db:t,collection:n}=a.MongoDBCollectionNamespace.fromString(this._keyVaultNamespace);return await this._keyVaultClient.db(t).collection(n).findOne({keyAltNames:e},{readConcern:{level:"majority"},timeoutMS:this._timeoutMS})}async addKeyAltName(e,t){const{db:n,collection:r}=a.MongoDBCollectionNamespace.fromString(this._keyVaultNamespace);return await this._keyVaultClient.db(n).collection(r).findOneAndUpdate({_id:e},{$addToSet:{keyAltNames:t}},{writeConcern:{w:"majority"},returnDocument:"before",timeoutMS:this._timeoutMS})}async removeKeyAltName(e,t){const{db:n,collection:r}=a.MongoDBCollectionNamespace.fromString(this._keyVaultNamespace),i=[{$set:{keyAltNames:{$cond:[{$eq:["$keyAltNames",[t]]},"$$REMOVE",{$filter:{input:"$keyAltNames",cond:{$ne:["$$this",t]}}}]}}}];return await this._keyVaultClient.db(n).collection(r).findOneAndUpdate({_id:e},i,{writeConcern:{w:"majority"},returnDocument:"before",timeoutMS:this._timeoutMS})}async createEncryptedCollection(e,t,n){const{provider:r,masterKey:i,createCollectionOptions:{encryptedFields:{...o},...u}}=n,l=null!=this._timeoutMS?s.TimeoutContext.create((0,a.resolveTimeoutOptions)(this._client,{timeoutMS:this._timeoutMS})):void 0;if(Array.isArray(o.fields)){const e=o.fields.map((async e=>null==e||"object"!=typeof e||null!=e.keyId?e:{...e,keyId:await this.createDataKey(r,{masterKey:i,timeoutContext:l?.csotEnabled()?l?.clone():void 0})})),t=await Promise.allSettled(e);o.fields=t.map(((e,t)=>"fulfilled"===e.status?e.value:o.fields[t]));const n=t.find((e=>"rejected"===e.status));if(null!=n)throw new c.MongoCryptCreateDataKeyError(o,{cause:n.reason})}try{return{collection:await e.createCollection(t,{...u,encryptedFields:o,timeoutMS:l?.csotEnabled()?l?.getRemainingTimeMSOrThrow():void 0}),encryptedFields:o}}catch(e){throw new c.MongoCryptCreateEncryptedCollectionError(o,{cause:e})}}async encrypt(e,t){return await this._encrypt(e,!1,t)}async encryptExpression(e,t){return await this._encrypt(e,!0,t)}async decrypt(e){const t=(0,i.serialize)({v:e}),n=this._mongoCrypt.makeExplicitDecryptionContext(t),r=new h.StateMachine({proxyOptions:this._proxyOptions,tlsOptions:this._tlsOptions,socketOptions:f(this._client.s.options)}),o=null!=this._timeoutMS?s.TimeoutContext.create((0,a.resolveTimeoutOptions)(this._client,{timeoutMS:this._timeoutMS})):void 0,{v:u}=(0,i.deserialize)(await r.execute(this,n,{timeoutContext:o}));return u}async askForKMSCredentials(){return await(0,l.refreshKMSCredentials)(this._kmsProviders,this._credentialProviders)}static get libmongocryptVersion(){return d.getMongoCrypt().libmongocryptVersion}async _encrypt(e,t,n){const{algorithm:r,keyId:o,keyAltName:u,contentionFactor:l,queryType:d,rangeOptions:p,textOptions:m}=n,g={expressionMode:t,algorithm:r};if(o&&(g.keyId=o.buffer),u){if(o)throw new c.MongoCryptInvalidArgumentError('"options" cannot contain both "keyId" and "keyAltName"');if("string"!=typeof u)throw new c.MongoCryptInvalidArgumentError('"options.keyAltName" must be of type string, but was of type '+typeof u);g.keyAltName=(0,i.serialize)({keyAltName:u})}"number"!=typeof l&&"bigint"!=typeof l||(g.contentionFactor=l),"string"==typeof d&&(g.queryType=d),"object"==typeof p&&(g.rangeOptions=(0,i.serialize)(p)),"object"==typeof m&&(g.textOptions=(0,i.serialize)(m));const _=(0,i.serialize)({v:e}),y=new h.StateMachine({proxyOptions:this._proxyOptions,tlsOptions:this._tlsOptions,socketOptions:f(this._client.s.options)}),v=this._mongoCrypt.makeExplicitEncryptionContext(_,g),E=null!=this._timeoutMS?s.TimeoutContext.create((0,a.resolveTimeoutOptions)(this._client,{timeoutMS:this._timeoutMS})):void 0,{v:S}=(0,i.deserialize)(await y.execute(this,v,{timeoutContext:E}));return S}}function f(e){const t={autoSelectFamily:!0};return"autoSelectFamily"in e&&(t.autoSelectFamily=e.autoSelectFamily),"autoSelectFamilyAttemptTimeout"in e&&(t.autoSelectFamilyAttemptTimeout=e.autoSelectFamilyAttemptTimeout),t}t.ClientEncryption=d},73619:(e,t,n)=>{var r=n(9606).URL;Object.defineProperty(t,"__esModule",{value:!0}),t.callback=void 0;const i=n(79790),o=n(17562),s=n(145),a=Object.freeze({Metadata:"true",Accept:"application/json"});t.callback=async e=>{const t=e.tokenAudience,n=e.username;if(!t)throw new o.MongoAzureError("TOKEN_RESOURCE must be set in the auth mechanism properties when ENVIRONMENT is azure.");const u=await async function(e,t){const n=new r(i.AZURE_BASE_URL);(0,i.addAzureParams)(n,e,t);const u=await(0,s.get)(n,{headers:a});if(200!==u.status)throw new o.MongoAzureError(`Status code ${u.status} returned from the Azure endpoint. Response body: ${u.body}`);const c=JSON.parse(u.body);return{accessToken:c.access_token,expiresInSeconds:Number(c.expires_in)}}(t,n);if(null==(c=u)||"object"!=typeof c||!("accessToken"in c)||"string"!=typeof c.accessToken||!("expiresInSeconds"in c)||"number"!=typeof c.expiresInSeconds)throw new o.MongoAzureError("Azure endpoint did not return a value with only access_token and expires_in properties");var c;return u}},74158:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.GridFSBucket=void 0;const r=n(17562),i=n(4642),o=n(7799),s=n(145),a=n(40012),u=n(33104),c=n(10557),l={bucketName:"fs",chunkSizeBytes:261120};class h extends i.TypedEventEmitter{constructor(e,t){super(),this.on("error",s.noop),this.setMaxListeners(0);const n=(0,s.resolveOptions)(e,{...l,...t,writeConcern:a.WriteConcern.fromOptions(t)});this.s={db:e,options:n,_chunksCollection:e.collection(n.bucketName+".chunks"),_filesCollection:e.collection(n.bucketName+".files"),checkedIndexes:!1,calledOpenUploadStream:!1}}openUploadStream(e,t){return new c.GridFSBucketWriteStream(this,e,{timeoutMS:this.s.options.timeoutMS,...t})}openUploadStreamWithId(e,t,n){return new c.GridFSBucketWriteStream(this,t,{timeoutMS:this.s.options.timeoutMS,...n,id:e})}openDownloadStream(e,t){return new u.GridFSBucketReadStream(this.s._chunksCollection,this.s._filesCollection,this.s.options.readPreference,{_id:e},{timeoutMS:this.s.options.timeoutMS,...t})}async delete(e,t){const{timeoutMS:n}=(0,s.resolveOptions)(this.s.db,t);let i;n&&(i=new o.CSOTTimeoutContext({timeoutMS:n,serverSelectionTimeoutMS:this.s.db.client.s.options.serverSelectionTimeoutMS}));const{deletedCount:a}=await this.s._filesCollection.deleteOne({_id:e},{timeoutMS:i?.remainingTimeMS}),u=i?.remainingTimeMS;if(null!=u&&u<=0)throw new r.MongoOperationTimeoutError(`Timed out after ${n}ms`);if(await this.s._chunksCollection.deleteMany({files_id:e},{timeoutMS:u}),0===a)throw new r.MongoRuntimeError(`File not found for id ${e}`)}find(e={},t={}){return this.s._filesCollection.find(e,t)}openDownloadStreamByName(e,t){let n,r={uploadDate:-1};return t&&null!=t.revision&&(t.revision>=0?(r={uploadDate:1},n=t.revision):n=-t.revision-1),new u.GridFSBucketReadStream(this.s._chunksCollection,this.s._filesCollection,this.s.options.readPreference,{filename:e},{timeoutMS:this.s.options.timeoutMS,...t,sort:r,skip:n})}async rename(e,t,n){const i={_id:e},o={$set:{filename:t}},{matchedCount:s}=await this.s._filesCollection.updateOne(i,o,n);if(0===s)throw new r.MongoRuntimeError(`File with id ${e} not found`)}async drop(e){const{timeoutMS:t}=(0,s.resolveOptions)(this.s.db,e);let n;if(t&&(n=new o.CSOTTimeoutContext({timeoutMS:t,serverSelectionTimeoutMS:this.s.db.client.s.options.serverSelectionTimeoutMS})),n){await this.s._filesCollection.drop({timeoutMS:n.remainingTimeMS});const e=n.getRemainingTimeMSOrThrow(`Timed out after ${t}ms`);await this.s._chunksCollection.drop({timeoutMS:e})}else await this.s._filesCollection.drop(),await this.s._chunksCollection.drop()}}t.GridFSBucket=h,h.INDEX="index"},75080:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.toUTF8=t.getBigInt64LE=t.getFloat64LE=t.getInt32LE=t.UUID=t.Timestamp=t.serialize=t.ObjectId=t.MinKey=t.MaxKey=t.Long=t.Int32=t.EJSON=t.Double=t.deserialize=t.Decimal128=t.DBRef=t.Code=t.calculateObjectSize=t.BSONType=t.BSONSymbol=t.BSONRegExp=t.BSONError=t.BSON=t.Binary=void 0,t.parseToElementsToArray=function(e,t){const n=r.BSON.onDemand.parseToElements(e,t);return Array.isArray(n)?n:[...n]},t.pluckBSONSerializeOptions=function(e){const{fieldsAsRaw:t,useBigInt64:n,promoteValues:r,promoteBuffers:i,promoteLongs:o,serializeFunctions:s,ignoreUndefined:a,bsonRegExp:u,raw:c,enableUtf8Validation:l}=e;return{fieldsAsRaw:t,useBigInt64:n,promoteValues:r,promoteBuffers:i,promoteLongs:o,serializeFunctions:s,ignoreUndefined:a,bsonRegExp:u,raw:c,enableUtf8Validation:l}},t.resolveBSONOptions=function(e,t){const n=t?.bsonOptions;return{raw:e?.raw??n?.raw??!1,useBigInt64:e?.useBigInt64??n?.useBigInt64??!1,promoteLongs:e?.promoteLongs??n?.promoteLongs??!0,promoteValues:e?.promoteValues??n?.promoteValues??!0,promoteBuffers:e?.promoteBuffers??n?.promoteBuffers??!1,ignoreUndefined:e?.ignoreUndefined??n?.ignoreUndefined??!1,bsonRegExp:e?.bsonRegExp??n?.bsonRegExp??!1,serializeFunctions:e?.serializeFunctions??n?.serializeFunctions??!1,fieldsAsRaw:e?.fieldsAsRaw??n?.fieldsAsRaw??{},enableUtf8Validation:e?.enableUtf8Validation??n?.enableUtf8Validation??!0}},t.parseUtf8ValidationOption=function(e){const t=e?.enableUtf8Validation;return!1===t?{utf8:!1}:{utf8:{writeErrors:!1}}};const r=n(62444);var i=n(62444);Object.defineProperty(t,"Binary",{enumerable:!0,get:function(){return i.Binary}}),Object.defineProperty(t,"BSON",{enumerable:!0,get:function(){return i.BSON}}),Object.defineProperty(t,"BSONError",{enumerable:!0,get:function(){return i.BSONError}}),Object.defineProperty(t,"BSONRegExp",{enumerable:!0,get:function(){return i.BSONRegExp}}),Object.defineProperty(t,"BSONSymbol",{enumerable:!0,get:function(){return i.BSONSymbol}}),Object.defineProperty(t,"BSONType",{enumerable:!0,get:function(){return i.BSONType}}),Object.defineProperty(t,"calculateObjectSize",{enumerable:!0,get:function(){return i.calculateObjectSize}}),Object.defineProperty(t,"Code",{enumerable:!0,get:function(){return i.Code}}),Object.defineProperty(t,"DBRef",{enumerable:!0,get:function(){return i.DBRef}}),Object.defineProperty(t,"Decimal128",{enumerable:!0,get:function(){return i.Decimal128}}),Object.defineProperty(t,"deserialize",{enumerable:!0,get:function(){return i.deserialize}}),Object.defineProperty(t,"Double",{enumerable:!0,get:function(){return i.Double}}),Object.defineProperty(t,"EJSON",{enumerable:!0,get:function(){return i.EJSON}}),Object.defineProperty(t,"Int32",{enumerable:!0,get:function(){return i.Int32}}),Object.defineProperty(t,"Long",{enumerable:!0,get:function(){return i.Long}}),Object.defineProperty(t,"MaxKey",{enumerable:!0,get:function(){return i.MaxKey}}),Object.defineProperty(t,"MinKey",{enumerable:!0,get:function(){return i.MinKey}}),Object.defineProperty(t,"ObjectId",{enumerable:!0,get:function(){return i.ObjectId}}),Object.defineProperty(t,"serialize",{enumerable:!0,get:function(){return i.serialize}}),Object.defineProperty(t,"Timestamp",{enumerable:!0,get:function(){return i.Timestamp}}),Object.defineProperty(t,"UUID",{enumerable:!0,get:function(){return i.UUID}}),t.getInt32LE=r.BSON.onDemand.NumberUtils.getInt32LE,t.getFloat64LE=r.BSON.onDemand.NumberUtils.getFloat64LE,t.getBigInt64LE=r.BSON.onDemand.NumberUtils.getBigInt64LE,t.toUTF8=r.BSON.onDemand.ByteUtils.toUTF8},75725:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ClientBulkWriteCursorResponse=t.ExplainedCursorResponse=t.CursorResponse=t.MongoDBResponse=void 0,t.isErrorResponse=u;const r=n(75080),i=n(17562),o=n(145),s=n(68746),a={type:0,nameOffset:1,nameLength:2,offset:3,length:4};function u(e,t){for(let n=0;n<t.length;n++){const r=t[n];if(2===r[a.nameLength]){const t=r[a.nameOffset];if(111===e[t]&&107===e[t+1]){const t=r[a.offset],n=r[a.length];for(let r=t;r<t+n;r++)if(0!==e[r])return!1;return!0}}}return!0}class c extends s.OnDemandDocument{get(e,t,n){try{return super.get(e,t,n)}catch(e){throw new i.MongoUnexpectedServerResponseError(e.message,{cause:e})}}static is(e){return e instanceof c}static make(e){const t=(0,r.parseToElementsToArray)(e,0);return u(e,t)?new c(e,0,!1,t):new this(e,0,!1,t)}get isMaxTimeExpiredError(){if(0===this.ok&&this.code===i.MONGODB_ERROR_CODES.MaxTimeMSExpired)return!0;if(0===this.ok)return!1;if(this.get("writeConcernError",r.BSONType.object)?.getNumber("code")===i.MONGODB_ERROR_CODES.MaxTimeMSExpired)return!0;const e=this.get("writeErrors",r.BSONType.array);if(e?.size())for(let t=0;t<e.size();t++)if(e.get(t,r.BSONType.object)?.getNumber("code")===i.MONGODB_ERROR_CODES.MaxTimeMSExpired)return!0;return!1}get recoveryToken(){return this.get("recoveryToken",r.BSONType.object)?.toObject({promoteValues:!1,promoteLongs:!1,promoteBuffers:!1,validation:{utf8:!0}})??null}get atClusterTime(){return this.get("cursor",r.BSONType.object)?.get("atClusterTime",r.BSONType.timestamp)??this.get("atClusterTime",r.BSONType.timestamp)}get operationTime(){return this.get("operationTime",r.BSONType.timestamp)}get ok(){return this.getNumber("ok")?1:0}get $err(){return this.get("$err",r.BSONType.string)}get errmsg(){return this.get("errmsg",r.BSONType.string)}get code(){return this.getNumber("code")}get $clusterTime(){if(!("clusterTime"in this)){const e=this.get("$clusterTime",r.BSONType.object);if(null==e)return this.clusterTime=null,null;const t=e.get("clusterTime",r.BSONType.timestamp,!0),n=e.get("signature",r.BSONType.object)?.toObject();this.clusterTime={clusterTime:t,signature:n}}return this.clusterTime??null}toObject(e){const t={...(0,r.pluckBSONSerializeOptions)(e??{}),validation:(0,r.parseUtf8ValidationOption)(e)};return super.toObject(t)}}t.MongoDBResponse=c,c.empty=new c(new Uint8Array([13,0,0,0,16,111,107,0,1,0,0,0,0]));class l extends c{constructor(){super(...arguments),this._batch=null,this.iterated=0,this._encryptedBatch=null}static get emptyGetMore(){return new l((0,r.serialize)({ok:1,cursor:{id:0n,nextBatch:[]}}))}static is(e){return e instanceof l||e===l.emptyGetMore}get cursor(){return this.get("cursor",r.BSONType.object,!0)}get id(){try{return r.Long.fromBigInt(this.cursor.get("id",r.BSONType.long,!0))}catch(e){throw new i.MongoUnexpectedServerResponseError(e.message,{cause:e})}}get ns(){const e=this.cursor.get("ns",r.BSONType.string);return null!=e?(0,o.ns)(e):null}get length(){return Math.max(this.batchSize-this.iterated,0)}get encryptedBatch(){if(null==this.encryptedResponse)return null;if(null!=this._encryptedBatch)return this._encryptedBatch;const e=this.encryptedResponse?.get("cursor",r.BSONType.object);if(e?.has("firstBatch"))this._encryptedBatch=e.get("firstBatch",r.BSONType.array,!0);else{if(!e?.has("nextBatch"))throw new i.MongoUnexpectedServerResponseError("Cursor document did not contain a batch");this._encryptedBatch=e.get("nextBatch",r.BSONType.array,!0)}return this._encryptedBatch}get batch(){if(null!=this._batch)return this._batch;const e=this.cursor;if(e.has("firstBatch"))this._batch=e.get("firstBatch",r.BSONType.array,!0);else{if(!e.has("nextBatch"))throw new i.MongoUnexpectedServerResponseError("Cursor document did not contain a batch");this._batch=e.get("nextBatch",r.BSONType.array,!0)}return this._batch}get batchSize(){return this.batch?.size()}get postBatchResumeToken(){return this.cursor.get("postBatchResumeToken",r.BSONType.object)?.toObject({promoteValues:!1,promoteLongs:!1,promoteBuffers:!1,validation:{utf8:!0}})??null}shift(e){if(this.iterated>=this.batchSize)return null;const t=this.batch.get(this.iterated,r.BSONType.object,!0)??null,n=this.encryptedBatch?.get(this.iterated,r.BSONType.object,!0)??null;if(this.iterated+=1,e?.raw)return t.toBytes();{const r=t.toObject(e);return n&&(0,o.decorateDecryptionResult)(r,n.toObject(e),!0),r}}clear(){this.iterated=this.batchSize}}t.CursorResponse=l,t.ExplainedCursorResponse=class extends l{constructor(){super(...arguments),this.isExplain=!0,this._length=1}get id(){return r.Long.fromBigInt(0n)}get batchSize(){return 0}get ns(){return null}get length(){return this._length}shift(e){return 0===this._length?null:(this._length-=1,this.toObject(e))}},t.ClientBulkWriteCursorResponse=class extends l{get insertedCount(){return this.get("nInserted",r.BSONType.int,!0)}get upsertedCount(){return this.get("nUpserted",r.BSONType.int,!0)}get matchedCount(){return this.get("nMatched",r.BSONType.int,!0)}get modifiedCount(){return this.get("nModified",r.BSONType.int,!0)}get deletedCount(){return this.get("nDeleted",r.BSONType.int,!0)}get writeConcernError(){return this.get("writeConcernError",r.BSONType.object,!1)}}},75755:(e,t,n)=>{var r=n(65994).e;Object.defineProperty(t,"__esModule",{value:!0}),t.ConnectionPool=t.PoolState=void 0;const i=n(37668),o=n(91869),s=n(17562),a=n(4642),u=n(7799),c=n(145),l=n(87758),h=n(71470),d=n(287),f=n(76013),p=n(55741);t.PoolState=Object.freeze({paused:"paused",ready:"ready",closed:"closed"});class m extends a.TypedEventEmitter{constructor(e,n){if(super(),this.on("error",c.noop),this.options=Object.freeze({connectionType:h.Connection,...n,maxPoolSize:n.maxPoolSize??100,minPoolSize:n.minPoolSize??0,maxConnecting:n.maxConnecting??2,maxIdleTimeMS:n.maxIdleTimeMS??0,waitQueueTimeoutMS:n.waitQueueTimeoutMS??0,minPoolSizeCheckFrequencyMS:n.minPoolSizeCheckFrequencyMS??100,autoEncrypter:n.autoEncrypter}),this.options.minPoolSize>this.options.maxPoolSize)throw new s.MongoInvalidArgumentError("Connection pool minimum size must not be greater than maximum pool size");this.poolState=t.PoolState.paused,this.server=e,this.connections=new c.List,this.pending=0,this.checkedOut=new Set,this.minPoolSizeTimer=void 0,this.generation=0,this.serviceGenerations=new Map,this.connectionCounter=(0,c.makeCounter)(1),this.cancellationToken=new a.CancellationToken,this.cancellationToken.setMaxListeners(1/0),this.waitQueue=new c.List,this.metrics=new p.ConnectionPoolMetrics,this.processingWaitQueue=!1,this.mongoLogger=this.server.topology.client?.mongoLogger,this.component="connection",r.nextTick((()=>{this.emitAndLog(m.CONNECTION_POOL_CREATED,new d.ConnectionPoolCreatedEvent(this))}))}get address(){return this.options.hostAddress.toString()}get closed(){return this.poolState===t.PoolState.closed}get totalConnectionCount(){return this.availableConnectionCount+this.pendingConnectionCount+this.currentCheckedOutCount}get availableConnectionCount(){return this.connections.length}get pendingConnectionCount(){return this.pending}get currentCheckedOutCount(){return this.checkedOut.size}get waitQueueSize(){return this.waitQueue.length}get loadBalanced(){return this.options.loadBalanced}get serverError(){return this.server.description.error}get checkedOutConnections(){return this.checkedOut}waitQueueErrorMetrics(){return this.metrics.info(this.options.maxPoolSize)}ready(){this.poolState===t.PoolState.paused&&(this.poolState=t.PoolState.ready,this.emitAndLog(m.CONNECTION_POOL_READY,new d.ConnectionPoolReadyEvent(this)),(0,i.clearTimeout)(this.minPoolSizeTimer),this.ensureMinPoolSize())}async checkOut(e){const t=(0,c.now)();this.emitAndLog(m.CONNECTION_CHECK_OUT_STARTED,new d.ConnectionCheckOutStartedEvent(this));const{promise:n,resolve:i,reject:o}=(0,c.promiseWithResolvers)(),a=e.timeoutContext.connectionCheckoutTimeout,l={resolve:i,reject:o,cancelled:!1,checkoutTime:t},h=(0,c.addAbortListener)(e.signal,(function(){l.cancelled=!0,o(this.reason)}));this.waitQueue.push(l),r.nextTick((()=>this.processWaitQueue()));try{return a?.throwIfExpired(),await(a?Promise.race([n,a]):n)}catch(t){if(u.TimeoutError.is(t)){a?.clear(),l.cancelled=!0,this.emitAndLog(m.CONNECTION_CHECK_OUT_FAILED,new d.ConnectionCheckOutFailedEvent(this,"timeout",l.checkoutTime));const t=new f.WaitQueueTimeoutError(this.loadBalanced?this.waitQueueErrorMetrics():"Timed out while checking out a connection from connection pool",this.address);if(e.timeoutContext.csotEnabled())throw new s.MongoOperationTimeoutError("Timed out during connection checkout",{cause:t});throw t}throw t}finally{h?.[c.kDispose](),a?.clear()}}checkIn(e){if(!this.checkedOut.has(e))return;const t=this.closed,n=this.connectionIsStale(e),i=!!(t||n||e.closed);if(i||(e.markAvailable(),this.connections.unshift(e)),this.checkedOut.delete(e),this.emitAndLog(m.CONNECTION_CHECKED_IN,new d.ConnectionCheckedInEvent(this,e)),i){const n=e.closed?"error":t?"poolClosed":"stale";this.destroyConnection(e,n)}r.nextTick((()=>this.processWaitQueue()))}clear(e={}){if(this.closed)return;if(this.loadBalanced){const{serviceId:t}=e;if(!t)throw new s.MongoRuntimeError("ConnectionPool.clear() called in load balanced mode with no serviceId.");const n=t.toHexString(),r=this.serviceGenerations.get(n);if(null==r)throw new s.MongoRuntimeError("Service generations are required in load balancer mode.");return this.serviceGenerations.set(n,r+1),void this.emitAndLog(m.CONNECTION_POOL_CLEARED,new d.ConnectionPoolClearedEvent(this,{serviceId:t}))}const n=e.interruptInUseConnections??!1,i=this.generation;this.generation+=1;const o=this.poolState===t.PoolState.paused;this.poolState=t.PoolState.paused,this.clearMinPoolSizeTimer(),o||this.emitAndLog(m.CONNECTION_POOL_CLEARED,new d.ConnectionPoolClearedEvent(this,{interruptInUseConnections:n})),n&&r.nextTick((()=>this.interruptInUseConnections(i))),this.processWaitQueue()}interruptInUseConnections(e){for(const t of this.checkedOut)t.generation<=e&&t.onError(new f.PoolClearedOnNetworkError(this))}closeCheckedOutConnections(){for(const e of this.checkedOut)e.onError(new s.MongoClientClosedError)}close(){if(!this.closed){this.cancellationToken.emit("cancel"),"function"==typeof this.connectionCounter.return&&this.connectionCounter.return(void 0),this.poolState=t.PoolState.closed,this.clearMinPoolSizeTimer(),this.processWaitQueue();for(const e of this.connections)this.emitAndLog(m.CONNECTION_CLOSED,new d.ConnectionClosedEvent(this,e,"poolClosed")),e.destroy();this.connections.clear(),this.emitAndLog(m.CONNECTION_POOL_CLOSED,new d.ConnectionPoolClosedEvent(this))}}async reauthenticate(e){const t=e.authContext;if(!t)throw new s.MongoRuntimeError("No auth context found on connection.");const n=t.credentials;if(!n)throw new s.MongoMissingCredentialsError("Connection is missing credentials when asked to reauthenticate");const r=n.resolveAuthMechanism(e.hello),i=this.server.topology.client.s.authProviders.getOrCreateProvider(r.mechanism,r.mechanismProperties);if(!i)throw new s.MongoMissingCredentialsError(`Reauthenticate failed due to no auth provider for ${n.mechanism}`);await i.reauth(t)}clearMinPoolSizeTimer(){const e=this.minPoolSizeTimer;e&&(0,i.clearTimeout)(e)}destroyConnection(e,t){this.emitAndLog(m.CONNECTION_CLOSED,new d.ConnectionClosedEvent(this,e,t)),e.destroy()}connectionIsStale(e){const t=e.serviceId;if(this.loadBalanced&&t){const n=t.toHexString(),r=this.serviceGenerations.get(n);return e.generation!==r}return e.generation!==this.generation}connectionIsIdle(e){return!!(this.options.maxIdleTimeMS&&e.idleTime>this.options.maxIdleTimeMS)}destroyConnectionIfPerished(e){const t=this.connectionIsStale(e),n=this.connectionIsIdle(e);if(!t&&!n&&!e.closed)return!1;const r=e.closed?"error":t?"stale":"idle";return this.destroyConnection(e,r),!0}createConnection(e){const n={...this.options,id:this.connectionCounter.next().value,generation:this.generation,cancellationToken:this.cancellationToken,mongoLogger:this.mongoLogger,authProviders:this.server.topology.client.s.authProviders,extendedMetadata:this.server.topology.client.options.extendedMetadata};this.pending++;const r=(0,c.now)();this.emitAndLog(m.CONNECTION_CREATED,new d.ConnectionCreatedEvent(this,{id:n.id})),(0,l.connect)(n).then((n=>{if(this.poolState!==t.PoolState.ready)return this.pending--,n.destroy(),void e(this.closed?new f.PoolClosedError(this):new f.PoolClearedError(this));for(const e of[...o.APM_EVENTS,h.Connection.CLUSTER_TIME_RECEIVED])n.on(e,(t=>this.emit(e,t)));if(this.loadBalanced){n.on(h.Connection.PINNED,(e=>this.metrics.markPinned(e))),n.on(h.Connection.UNPINNED,(e=>this.metrics.markUnpinned(e)));const e=n.serviceId;if(e){let t;const r=e.toHexString();(t=this.serviceGenerations.get(r))?n.generation=t:(this.serviceGenerations.set(r,0),n.generation=0)}}n.markAvailable(),this.emitAndLog(m.CONNECTION_READY,new d.ConnectionReadyEvent(this,n,r)),this.pending--,e(void 0,n)}),(t=>{this.pending--,this.server.handleError(t),this.emitAndLog(m.CONNECTION_CLOSED,new d.ConnectionClosedEvent(this,{id:n.id,serviceId:void 0},"error",t)),(t instanceof s.MongoNetworkError||t instanceof s.MongoServerError)&&(t.connectionGeneration=n.generation),e(t??new s.MongoRuntimeError("Connection creation failed without error"))}))}ensureMinPoolSize(){const e=this.options.minPoolSize;this.poolState===t.PoolState.ready&&(this.connections.prune((e=>this.destroyConnectionIfPerished(e))),this.totalConnectionCount<e&&this.pendingConnectionCount<this.options.maxConnecting?this.createConnection(((e,n)=>{!e&&n&&(this.connections.push(n),r.nextTick((()=>this.processWaitQueue()))),this.poolState===t.PoolState.ready&&((0,i.clearTimeout)(this.minPoolSizeTimer),this.minPoolSizeTimer=(0,i.setTimeout)((()=>this.ensureMinPoolSize()),this.options.minPoolSizeCheckFrequencyMS))})):((0,i.clearTimeout)(this.minPoolSizeTimer),this.minPoolSizeTimer=(0,i.setTimeout)((()=>this.ensureMinPoolSize()),this.options.minPoolSizeCheckFrequencyMS)))}processWaitQueue(){if(this.processingWaitQueue)return;for(this.processingWaitQueue=!0;this.waitQueueSize;){const e=this.waitQueue.first();if(!e){this.waitQueue.shift();continue}if(e.cancelled){this.waitQueue.shift();continue}if(this.poolState!==t.PoolState.ready){const t=this.closed?"poolClosed":"connectionError",n=this.closed?new f.PoolClosedError(this):new f.PoolClearedError(this);this.emitAndLog(m.CONNECTION_CHECK_OUT_FAILED,new d.ConnectionCheckOutFailedEvent(this,t,e.checkoutTime,n)),this.waitQueue.shift(),e.reject(n);continue}if(!this.availableConnectionCount)break;const n=this.connections.shift();if(!n)break;this.destroyConnectionIfPerished(n)||(this.checkedOut.add(n),this.emitAndLog(m.CONNECTION_CHECKED_OUT,new d.ConnectionCheckedOutEvent(this,n,e.checkoutTime)),this.waitQueue.shift(),e.resolve(n))}const{maxPoolSize:e,maxConnecting:n}=this.options;for(;this.waitQueueSize>0&&this.pendingConnectionCount<n&&(0===e||this.totalConnectionCount<e);){const e=this.waitQueue.shift();e&&!e.cancelled&&this.createConnection(((t,n)=>{e.cancelled?!t&&n&&this.connections.push(n):t?(this.emitAndLog(m.CONNECTION_CHECK_OUT_FAILED,new d.ConnectionCheckOutFailedEvent(this,"connectionError",e.checkoutTime,t)),e.reject(t)):n&&(this.checkedOut.add(n),this.emitAndLog(m.CONNECTION_CHECKED_OUT,new d.ConnectionCheckedOutEvent(this,n,e.checkoutTime)),e.resolve(n)),r.nextTick((()=>this.processWaitQueue()))}))}this.processingWaitQueue=!1}}t.ConnectionPool=m,m.CONNECTION_POOL_CREATED=o.CONNECTION_POOL_CREATED,m.CONNECTION_POOL_CLOSED=o.CONNECTION_POOL_CLOSED,m.CONNECTION_POOL_CLEARED=o.CONNECTION_POOL_CLEARED,m.CONNECTION_POOL_READY=o.CONNECTION_POOL_READY,m.CONNECTION_CREATED=o.CONNECTION_CREATED,m.CONNECTION_READY=o.CONNECTION_READY,m.CONNECTION_CLOSED=o.CONNECTION_CLOSED,m.CONNECTION_CHECK_OUT_STARTED=o.CONNECTION_CHECK_OUT_STARTED,m.CONNECTION_CHECK_OUT_FAILED=o.CONNECTION_CHECK_OUT_FAILED,m.CONNECTION_CHECKED_OUT=o.CONNECTION_CHECKED_OUT,m.CONNECTION_CHECKED_IN=o.CONNECTION_CHECKED_IN},75996:function(e,t,n){var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.getCompletedSchemaAnalyzer=t.verifyStreamSource=t.SchemaAnalyzer=void 0;const i=r(n(57282)),o=n(62444),s=r(n(40165)),a=n(72506),u={semanticTypes:!1,storeValues:!0,storedValuesLengthLimit:1e4};function c(e){if(null==e?void 0:e._bsontype){if(["Decimal128","Long"].includes(e._bsontype))return e.toString();if(["Double","Int32"].includes(e._bsontype))return String(e.value)}return"string"==typeof e?e:String(e)}function l(e,t){const n=e.name,r=t.name;return"_id"===n?-1:"_id"===r?1:n.toLowerCase()<r.toLowerCase()?-1:1}function h(e){return"Null"===e.name}function d(e){return"Array"===e.name}function f(e){return"Document"===e.name}function p(e,t=[]){const n=[],r=Object.values(e).sort(l);for(const e of r){const r=[...t,e.name];n.push(r);const i=Object.values(e.types).find((e=>"Document"===e.bsonType));i&&n.push(...p(i.fields,r));const o=Object.values(e.types).find((e=>"Array"===e.bsonType));if(o){const e=Object.values(o.types).find((e=>"Document"===e.bsonType));e&&n.push(...p(e.fields,r))}}return n}function m(e){function t(e){return Object.values(e).sort(((e,t)=>t.count-e.count)).map((e=>({bsonType:e.bsonType,...d(e)?{types:t(e.types)}:{},...f(e)?{fields:n(e.fields)}:{}})))}function n(e){const n=Object.create(null);return Object.values(e).forEach((e=>{const r=t(e.types);n[e.name]={types:r}})),n}return n(e)}function g(e,t){return t<1?"":e.charCodeAt(t-1)===e.codePointAt(t-1)?e.slice(0,t):e.slice(0,t-1)}function _(e,t){return h(e)?e.count>0:e.values?t!==e.values.length:void 0}function y(e){function t(e){const t=Object.values(e.types).map((e=>e.count)).reduce(((e,t)=>e+t),0);return{types:n(e.types,t),totalCount:t,lengths:e.lengths,averageLength:t/e.lengths.length}}function n(e,n){return Object.values(e).map((e=>{const i=function(e){return h(e)?0===e.count?0:1:e.values?new Set(e.values.map(c)).size:void 0}(e);return{name:e.name,path:e.path,count:e.count,probability:e.count/n,unique:i,hasDuplicates:_(e,i),values:h(e)?void 0:e.values,bsonType:e.bsonType,...d(e)?t(e):{},...f(e)?{fields:r(e.fields,e.count)}:{}}})).sort(((e,t)=>t.probability-e.probability))}function r(e,t){return Object.values(e).map((e=>{const r=n(e.types,t),i=t-e.count;return i>0&&r.push({name:"Undefined",bsonType:"Undefined",unique:i>1?0:1,hasDuplicates:i>1,path:e.path,count:i,probability:i/t}),{name:e.name,path:e.path,count:e.count,type:1===r.length?r[0].name:r.map((e=>e.name)),probability:e.count/t,hasDuplicates:!!r.find((e=>e.hasDuplicates)),types:r}})).sort(l)}return r(e.fields,e.count)}class v{constructor(e){if(this.documentsAnalyzed=0,this.fieldsCount=0,this.schemaAnalysisRoot={fields:Object.create(null),count:0},this.finalized=!0,this.schemaResult={count:0,fields:[]},this.fieldAndTypeAnalysisCounter=0,this.options={...u,...e},this.semanticTypes={...s.default},"object"==typeof this.options.semanticTypes){const e=Object.entries(this.options.semanticTypes).filter((([,e])=>"boolean"==typeof e&&e)).map((([e])=>e.toLowerCase()));this.semanticTypes={...Object.entries(this.semanticTypes).filter((([t])=>e.includes(t.toLowerCase()))).reduce(((e,[t,n])=>({...e,[t]:n})),Object.create(null))},Object.entries(this.options.semanticTypes).filter((([,e])=>"function"==typeof e)).forEach((([e,t])=>{this.semanticTypes[e]=t}))}}allowAbortDuringAnalysis(){this.fieldAndTypeAnalysisCounter++%a.ALLOW_ABORT_INTERVAL_COUNT==0&&(0,a.allowAbort)()}increaseFieldCount(){if(this.options.distinctFieldsAbortThreshold&&(this.fieldsCount++,this.fieldsCount>this.options.distinctFieldsAbortThreshold))throw new Error(`Schema analysis aborted: Fields count above ${this.options.distinctFieldsAbortThreshold}`)}getSemanticType(e,t){return Object.entries(this.semanticTypes).filter((([,n])=>n(e,t))).map((([e])=>e))[0]}async analyzeDoc(e){this.finalized=!1;const t=async(e,r,s)=>{var a,u,c;await this.allowAbortDuringAnalysis();const l=function(e){const t=(null==e?void 0:e._bsontype)?e._bsontype:Object.prototype.toString.call(e).replace(/^\[object (\w+)\]$/,"$1");return"Object"===t?"Document":"Code"===t&&e.scope?"CodeWScope":t}(r),p=this.options.semanticTypes&&this.getSemanticType(r,e)||l;s[p]||(s[p]={name:p,bsonType:l,path:e,count:0});const m=s[p];if(m.count++,d(m)){m.types=null!==(a=m.types)&&void 0!==a?a:Object.create(null),m.lengths=null!==(u=m.lengths)&&void 0!==u?u:[],m.lengths.push(r.length);for(const n of r)await t(e,n,m.types)}else if(f(m)){m.fields=null!==(c=m.fields)&&void 0!==c?c:Object.create(null);for(const[t,i]of Object.entries(r))await n(t,[...e,t],i,m.fields)}else this.options.storeValues&&!h(m)&&(m.values||(m.values=["String","Binary","Code"].includes(l)?(0,i.default)(100):(0,i.default)(1e4)),m.values.pushSome(function(e,t,n){return"String"===e?g(t,n):"Binary"===e?t.buffer.length>n?new o.Binary(t.buffer.slice(0,n),t.sub_type):t:"Code"===e&&t.code.length>=n?new o.Code(g(t.code,n),t.scope):t}(m.bsonType,r,this.options.storedValuesLengthLimit)))},n=async(e,n,r,i)=>{await this.allowAbortDuringAnalysis(),i[e]||(i[e]={name:e,path:n,count:0,types:Object.create(null)},this.increaseFieldCount());const o=i[e];o.count++,await t(n,r,o.types)};for(const t of Object.keys(e))await n(t,[t],e[t],this.schemaAnalysisRoot.fields);this.schemaAnalysisRoot.count+=1}getResult(){return this.finalized||(this.schemaResult={count:this.schemaAnalysisRoot.count,fields:y(this.schemaAnalysisRoot)},this.finalized=!0),this.schemaResult}getSchemaPaths(){return p(this.schemaAnalysisRoot.fields)}getSimplifiedSchema(){return m(this.schemaAnalysisRoot.fields)}}function E(e){if(!(Symbol.iterator in e)&&!(Symbol.asyncIterator in e))throw new Error("Unknown input type for `docs`. Must be an array, stream or MongoDB Cursor.");return e}t.SchemaAnalyzer=v,t.verifyStreamSource=E,t.getCompletedSchemaAnalyzer=async function(e,t){var n;const r=new v(t);for await(const i of E(e)){if(null===(n=null==t?void 0:t.signal)||void 0===n?void 0:n.aborted)throw t.signal.reason;await r.analyzeDoc(i)}return r}},76013:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.WaitQueueTimeoutError=t.PoolClearedOnNetworkError=t.PoolClearedError=t.PoolClosedError=void 0;const r=n(17562);class i extends r.MongoDriverError{constructor(e){super("Attempted to check out a connection from closed connection pool"),this.address=e.address}get name(){return"MongoPoolClosedError"}}t.PoolClosedError=i;class o extends r.MongoNetworkError{constructor(e,t){super(t||`Connection pool for ${e.address} was cleared because another operation failed with: "${e.serverError?.message}"`,e.serverError?{cause:e.serverError}:void 0),this.address=e.address,this.addErrorLabel(r.MongoErrorLabel.PoolRequstedRetry)}get name(){return"MongoPoolClearedError"}}t.PoolClearedError=o,t.PoolClearedOnNetworkError=class extends o{constructor(e){super(e,`Connection to ${e.address} interrupted due to server monitor timeout`)}get name(){return"PoolClearedOnNetworkError"}};class s extends r.MongoDriverError{constructor(e,t){super(e),this.address=t}get name(){return"MongoWaitQueueTimeoutError"}}t.WaitQueueTimeoutError=s},77599:(e,t,n)=>{var r,i,o;i=[t,n(36257)],void 0===(o="function"==typeof(r=function(e,t){var n,r=t.$_$.j4,i=t.$_$.e4,o=t.$_$.b,s=t.$_$.z3,a=t.$_$.i5;function u(){n=this,l.call(this)}function c(){return null==n&&new u,n}function l(){}function h(e){this.kotlinx$atomicfu$value=e}function d(e){this.kotlinx$atomicfu$value=e}function f(e){this.kotlinx$atomicfu$value=e}return s(l,"TraceBase"),i(u,"None",o,l),s(h,"AtomicRef"),s(d,"AtomicBoolean"),s(f,"AtomicInt"),r(l).atomicfu$Trace$append$1=function(e){},r(l).atomicfu$Trace$append$2=function(e,t){},r(l).atomicfu$Trace$append$3=function(e,t,n){},r(l).atomicfu$Trace$append$4=function(e,t,n,r){},r(h).gb=function(e){this.kotlinx$atomicfu$value=e},r(h).hb=function(){return this.kotlinx$atomicfu$value},r(h).atomicfu$compareAndSet=function(e,t){return this.kotlinx$atomicfu$value===e&&(this.kotlinx$atomicfu$value=t,!0)},r(h).atomicfu$getAndSet=function(e){var t=this.kotlinx$atomicfu$value;return this.kotlinx$atomicfu$value=e,t},r(h).toString=function(){return a(this.kotlinx$atomicfu$value)},r(d).ib=function(e){this.kotlinx$atomicfu$value=e},r(d).hb=function(){return this.kotlinx$atomicfu$value},r(d).atomicfu$compareAndSet=function(e,t){return this.kotlinx$atomicfu$value===e&&(this.kotlinx$atomicfu$value=t,!0)},r(d).atomicfu$getAndSet=function(e){var t=this.kotlinx$atomicfu$value;return this.kotlinx$atomicfu$value=e,t},r(d).toString=function(){return this.kotlinx$atomicfu$value.toString()},r(f).jb=function(e){this.kotlinx$atomicfu$value=e},r(f).hb=function(){return this.kotlinx$atomicfu$value},r(f).atomicfu$compareAndSet=function(e,t){return this.kotlinx$atomicfu$value===e&&(this.kotlinx$atomicfu$value=t,!0)},r(f).atomicfu$getAndSet=function(e){var t=this.kotlinx$atomicfu$value;return this.kotlinx$atomicfu$value=e,t},r(f).atomicfu$getAndIncrement=function(){var e=this.kotlinx$atomicfu$value;return this.kotlinx$atomicfu$value=e+1|0,e},r(f).atomicfu$getAndDecrement=function(){var e=this.kotlinx$atomicfu$value;return this.kotlinx$atomicfu$value=e-1|0,e},r(f).atomicfu$getAndAdd=function(e){var t=this.kotlinx$atomicfu$value;return this.kotlinx$atomicfu$value=this.kotlinx$atomicfu$value+e|0,t},r(f).atomicfu$addAndGet=function(e){return this.kotlinx$atomicfu$value=this.kotlinx$atomicfu$value+e|0,this.kotlinx$atomicfu$value},r(f).atomicfu$incrementAndGet=function(){return this.kotlinx$atomicfu$value=this.kotlinx$atomicfu$value+1|0,this.kotlinx$atomicfu$value},r(f).atomicfu$decrementAndGet=function(){return this.kotlinx$atomicfu$value=this.kotlinx$atomicfu$value-1|0,this.kotlinx$atomicfu$value},r(f).toString=function(){return this.kotlinx$atomicfu$value.toString()},e.$_$=e.$_$||{},e.$_$.a=function(e){return function(e,t){return t=t===o?c():t,new d(e)}(e,c())},e.$_$.b=function(e){return function(e,t){return t=t===o?c():t,new h(e)}(e,c())},e.$_$.c=function(e){return function(e,t){return t=t===o?c():t,new f(e)}(e,c())},e})?r.apply(t,i):r)||(e.exports=o)},78130:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CommandOperation=void 0;const r=n(17562),i=n(36411),o=n(28541),s=n(145),a=n(40012),u=n(35394);class c extends u.AbstractOperation{constructor(e,t){super(t),this.options=t??{};const n=t?.dbName||t?.authdb;if(this.ns=n?new s.MongoDBNamespace(n,"$cmd"):e?e.s.namespace.withCollection("$cmd"):new s.MongoDBNamespace("admin","$cmd"),this.readConcern=o.ReadConcern.fromOptions(t),this.writeConcern=a.WriteConcern.fromOptions(t),this.hasAspect(u.Aspect.EXPLAINABLE))this.explain=i.Explain.fromOptions(t),this.explain&&(0,i.validateExplainTimeoutOptions)(this.options,this.explain);else if(null!=t?.explain)throw new r.MongoInvalidArgumentError('Option "explain" is not supported on this command')}get canRetryWrite(){return this.hasAspect(u.Aspect.EXPLAINABLE)?null==this.explain:super.canRetryWrite}buildOptions(e){return{...this.options,...this.bsonOptions,timeoutContext:e,readPreference:this.readPreference,session:this.session}}buildCommand(e,t){const n=this.buildCommandDocument(e,t),r=this.session&&this.session.inTransaction();return this.readConcern&&(0,s.commandSupportsReadConcern)(n)&&!r&&Object.assign(n,{readConcern:this.readConcern}),this.writeConcern&&this.hasAspect(u.Aspect.WRITE_OPERATION)&&!r&&a.WriteConcern.apply(n,this.writeConcern),this.options.collation&&"object"==typeof this.options.collation&&!this.hasAspect(u.Aspect.SKIP_COLLATION)&&Object.assign(n,{collation:this.options.collation}),"number"==typeof this.options.maxTimeMS&&(n.maxTimeMS=this.options.maxTimeMS),this.hasAspect(u.Aspect.EXPLAINABLE)&&this.explain?(0,i.decorateWithExplain)(n,this.explain):n}}t.CommandOperation=c},79059:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.convertInternalToExpanded=void 0;const r=n(61283),i=n(59942),o=n(72506);t.convertInternalToExpanded=function(e,t={}){return function(){const e=new Set;function t(){const t=Object.fromEntries(Object.entries(r.RELAXED_EJSON_DEFINITIONS).filter((([t])=>e.has(t))));return Object.freeze(t)}function n(e){const t=r.InternalTypeToStandardTypeMap[e];if(!t)throw new Error(`Encountered unknown type: ${e}`);return{...t}}function s(e){const t=i.InternalTypeToBsonTypeMap[e];if(!t)throw new Error(`Encountered unknown type: ${e}`);return t}async function a(t,r){await(0,o.allowAbort)(r);const i={...n(t.bsonType),"x-bsonType":s(t.bsonType),"x-metadata":u(t)};var a;switch("values"in t&&t.values&&(i["x-sampleValues"]=t.values),i.$ref&&(a=i.$ref,e.add(a.split("/")[2])),t.bsonType){case"Array":i.items=await c(t.types,r);break;case"Document":Object.assign(i,await l(t.fields,r))}return i}function u({hasDuplicates:e,probability:t,count:n}){return{..."boolean"==typeof e?{hasDuplicates:e}:{},probability:t,count:n}}async function c(e,t){await(0,o.allowAbort)(t);const n=e.filter((e=>"undefined"!==e.bsonType.toLowerCase()));return 1===n.length?a(n[0],t):{anyOf:await Promise.all(n.map((e=>a(e,t))))}}async function l(e,t){const n=[],r={};for(const i of e)1===i.probability&&n.push(i.name),r[i.name]={...await c(i.types,t),"x-metadata":u(i)};return{required:n,properties:r}}return async function(e,n={}){const{required:r,properties:i}=await l(e.fields,n.signal);return{type:"object","x-bsonType":"object",required:r,properties:i,$defs:t()}}}()(e,t)}},79254:(e,t,n)=>{var r=n(65994).e;t.formatArgs=function(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+e.exports.humanize(this.diff),!this.useColors)return;const n="color: "+this.color;t.splice(1,0,n,"color: inherit");let r=0,i=0;t[0].replace(/%[a-zA-Z%]/g,(e=>{"%%"!==e&&(r++,"%c"===e&&(i=r))})),t.splice(i,0,n)},t.save=function(e){try{e?t.storage.setItem("debug",e):t.storage.removeItem("debug")}catch(e){}},t.load=function(){let e;try{e=t.storage.getItem("debug")||t.storage.getItem("DEBUG")}catch(e){}return!e&&void 0!==r&&"env"in r&&(e=r.env.DEBUG),e},t.useColors=function(){if("undefined"!=typeof window&&window.process&&("renderer"===window.process.type||window.process.__nwjs))return!0;if("undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let e;return"undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&(e=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(e[1],10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)},t.storage=function(){try{return localStorage}catch(e){}}(),t.destroy=(()=>{let e=!1;return()=>{e||(e=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),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"],t.log=console.debug||console.log||(()=>{}),e.exports=n(26633)(t);const{formatters:i}=e.exports;i.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}},79790:(e,t,n)=>{var r=n(9606).URL;Object.defineProperty(t,"__esModule",{value:!0}),t.tokenCache=t.AzureCredentialCache=t.AZURE_BASE_URL=void 0,t.addAzureParams=u,t.prepareRequest=c,t.fetchAzureKMSToken=l,t.loadAzureCredentials=async function(e){return{...e,azure:await t.tokenCache.getToken()}};const i=n(17562),o=n(145),s=n(86981);t.AZURE_BASE_URL="http://169.254.169.254/metadata/identity/oauth2/token?";class a{constructor(){this.cachedToken=null}async getToken(){return(null==this.cachedToken||this.needsRefresh(this.cachedToken))&&(this.cachedToken=await this._getToken()),{accessToken:this.cachedToken.accessToken}}needsRefresh(e){return e.expiresOnTimestamp-Date.now()<=6e3}resetCache(){this.cachedToken=null}_getToken(){return l()}}function u(e,t,n){return e.searchParams.append("api-version","2018-02-01"),e.searchParams.append("resource",t),n&&e.searchParams.append("client_id",n),e}function c(e){const n=new r(e.url?.toString()??t.AZURE_BASE_URL);return u(n,"https://vault.azure.net"),{headers:{...e.headers,"Content-Type":"application/json",Metadata:!0},url:n}}async function l(e={}){const{headers:t,url:n}=c(e);try{const e=await(0,o.get)(n,{headers:t});return await async function(e){const{status:t,body:n}=e,r=(()=>{try{return JSON.parse(n)}catch{throw new s.MongoCryptAzureKMSRequestError("Malformed JSON body in GET request.")}})();if(200!==t)throw new s.MongoCryptAzureKMSRequestError("Unable to complete request.",r);if(!r.access_token)throw new s.MongoCryptAzureKMSRequestError("Malformed response body - missing field `access_token`.");if(!r.expires_in)throw new s.MongoCryptAzureKMSRequestError("Malformed response body - missing field `expires_in`.");const i=1e3*Number(r.expires_in);if(Number.isNaN(i))throw new s.MongoCryptAzureKMSRequestError("Malformed response body - unable to parse int from `expires_in` field.");return{accessToken:r.access_token,expiresOnTimestamp:Date.now()+i}}(e)}catch(e){if(e instanceof i.MongoNetworkTimeoutError)throw new s.MongoCryptAzureKMSRequestError(`[Azure KMS] ${e.message}`);throw e}}t.AzureCredentialCache=a,t.tokenCache=new a},80890:(e,t,n)=>{var r=n(65994).e;Object.defineProperty(t,"__esModule",{value:!0}),t.callback=void 0;const i=n(65981),o="AZURE_FEDERATED_TOKEN_FILE",s="AWS_WEB_IDENTITY_TOKEN_FILE";t.callback=async()=>{let e;return e=r.env[o]?r.env[o]:r.env[s]?r.env[s]:"/var/run/secrets/kubernetes.io/serviceaccount/token",{accessToken:await(0,i.readFile)(e,"utf8")}}},81892:e=>{e.exports=JSON.parse('{"2.16.840.1.101.3.4.1.1":"aes-128-ecb","2.16.840.1.101.3.4.1.2":"aes-128-cbc","2.16.840.1.101.3.4.1.3":"aes-128-ofb","2.16.840.1.101.3.4.1.4":"aes-128-cfb","2.16.840.1.101.3.4.1.21":"aes-192-ecb","2.16.840.1.101.3.4.1.22":"aes-192-cbc","2.16.840.1.101.3.4.1.23":"aes-192-ofb","2.16.840.1.101.3.4.1.24":"aes-192-cfb","2.16.840.1.101.3.4.1.41":"aes-256-ecb","2.16.840.1.101.3.4.1.42":"aes-256-cbc","2.16.840.1.101.3.4.1.43":"aes-256-ofb","2.16.840.1.101.3.4.1.44":"aes-256-cfb"}')},82630:e=>{var t=1e3,n=60*t,r=60*n,i=24*r,o=7*i;function s(e,t,n,r){var i=t>=1.5*n;return Math.round(e/n)+" "+r+(i?"s":"")}e.exports=function(e,a){a=a||{};var u,c,l=typeof e;if("string"===l&&e.length>0)return function(e){if(!((e=String(e)).length>100)){var s=/^(-?(?:\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(s){var a=parseFloat(s[1]);switch((s[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return 315576e5*a;case"weeks":case"week":case"w":return a*o;case"days":case"day":case"d":return a*i;case"hours":case"hour":case"hrs":case"hr":case"h":return a*r;case"minutes":case"minute":case"mins":case"min":case"m":return a*n;case"seconds":case"second":case"secs":case"sec":case"s":return a*t;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return a;default:return}}}}(e);if("number"===l&&isFinite(e))return a.long?(u=e,(c=Math.abs(u))>=i?s(u,c,i,"day"):c>=r?s(u,c,r,"hour"):c>=n?s(u,c,n,"minute"):c>=t?s(u,c,t,"second"):u+" ms"):function(e){var o=Math.abs(e);return o>=i?Math.round(e/i)+"d":o>=r?Math.round(e/r)+"h":o>=n?Math.round(e/n)+"m":o>=t?Math.round(e/t)+"s":e+"ms"}(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))}},84157:(e,t,n)=>{n.d(t,{Y:()=>xe});var r={};n.r(r),n.d(r,{attentionMarkers:()=>Oe,contentInitial:()=>ye,disable:()=>be,document:()=>_e,flow:()=>Ee,flowInitial:()=>ve,insideSpan:()=>Ce,string:()=>Se,text:()=>we});const i={};function o(e,t,n){if(function(e){return Boolean(e&&"object"==typeof e)}(e)){if("value"in e)return"html"!==e.type||n?e.value:"";if(t&&"alt"in e&&e.alt)return e.alt;if("children"in e)return s(e.children,t,n)}return Array.isArray(e)?s(e,t,n):""}function s(e,t,n){const r=[];let i=-1;for(;++i<e.length;)r[i]=o(e[i],t,n);return r.join("")}function a(e,t,n,r){const i=e.length;let o,s=0;if(t=t<0?-t>i?0:i+t:t>i?i:t,n=n>0?n:0,r.length<1e4)o=Array.from(r),o.unshift(t,n),e.splice(...o);else for(n&&e.splice(t,n);s<r.length;)o=r.slice(s,s+1e4),o.unshift(t,0),e.splice(...o),s+=1e4,t+=1e4}function u(e,t){return e.length>0?(a(e,e.length,0,t),e):t}const c={}.hasOwnProperty;function l(e,t){let n;for(n in t){const r=(c.call(e,n)?e[n]:void 0)||(e[n]={}),i=t[n];let o;if(i)for(o in i){c.call(r,o)||(r[o]=[]);const e=i[o];h(r[o],Array.isArray(e)?e:e?[e]:[])}}}function h(e,t){let n=-1;const r=[];for(;++n<t.length;)("after"===t[n].add?e:r).push(t[n]);a(e,0,0,r)}var d=n(66596);function f(e,t,n,r){const i=r?r-1:Number.POSITIVE_INFINITY;let o=0;return function(r){return(0,d.On)(r)?(e.enter(n),s(r)):t(r)};function s(r){return(0,d.On)(r)&&o++<i?(e.consume(r),s):(e.exit(n),t(r))}}const p={tokenize:function(e){const t=e.attempt(this.parser.constructs.contentInitial,(function(n){if(null!==n)return e.enter("lineEnding"),e.consume(n),e.exit("lineEnding"),f(e,t,"linePrefix");e.consume(n)}),(function(t){return e.enter("paragraph"),r(t)}));let n;return t;function r(t){const r=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=r),n=r,i(t)}function i(t){return null===t?(e.exit("chunkText"),e.exit("paragraph"),void e.consume(t)):(0,d.HP)(t)?(e.consume(t),e.exit("chunkText"),r):(e.consume(t),i)}}},m={tokenize:function(e){const t=this,n=[];let r,i,o,s=0;return u;function u(r){if(s<n.length){const i=n[s];return t.containerState=i[1],e.attempt(i[0].continuation,c,l)(r)}return l(r)}function c(e){if(s++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,r&&S();const n=t.events.length;let i,o=n;for(;o--;)if("exit"===t.events[o][0]&&"chunkFlow"===t.events[o][1].type){i=t.events[o][1].end;break}E(s);let u=n;for(;u<t.events.length;)t.events[u][1].end=Object.assign({},i),u++;return a(t.events,o+1,0,t.events.slice(n)),t.events.length=u,l(e)}return u(e)}function l(i){if(s===n.length){if(!r)return p(i);if(r.currentConstruct&&r.currentConstruct.concrete)return _(i);t.interrupt=Boolean(r.currentConstruct&&!r._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(g,h,f)(i)}function h(e){return r&&S(),E(s),p(e)}function f(e){return t.parser.lazy[t.now().line]=s!==n.length,o=t.now().offset,_(e)}function p(n){return t.containerState={},e.attempt(g,m,_)(n)}function m(e){return s++,n.push([t.currentConstruct,t.containerState]),p(e)}function _(n){return null===n?(r&&S(),E(0),void e.consume(n)):(r=r||t.parser.flow(t.now()),e.enter("chunkFlow",{contentType:"flow",previous:i,_tokenizer:r}),y(n))}function y(n){return null===n?(v(e.exit("chunkFlow"),!0),E(0),void e.consume(n)):(0,d.HP)(n)?(e.consume(n),v(e.exit("chunkFlow")),s=0,t.interrupt=void 0,u):(e.consume(n),y)}function v(e,n){const u=t.sliceStream(e);if(n&&u.push(null),e.previous=i,i&&(i.next=e),i=e,r.defineSkip(e.start),r.write(u),t.parser.lazy[e.start.line]){let e=r.events.length;for(;e--;)if(r.events[e][1].start.offset<o&&(!r.events[e][1].end||r.events[e][1].end.offset>o))return;const n=t.events.length;let i,u,c=n;for(;c--;)if("exit"===t.events[c][0]&&"chunkFlow"===t.events[c][1].type){if(i){u=t.events[c][1].end;break}i=!0}for(E(s),e=n;e<t.events.length;)t.events[e][1].end=Object.assign({},u),e++;a(t.events,c+1,0,t.events.slice(n)),t.events.length=e}}function E(r){let i=n.length;for(;i-- >r;){const r=n[i];t.containerState=r[1],r[0].exit.call(t,e)}n.length=r}function S(){r.write([null]),i=void 0,r=void 0,t.containerState._closeFlow=void 0}}},g={tokenize:function(e,t,n){return f(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}},_={tokenize:function(e,t,n){return function(t){return(0,d.On)(t)?f(e,r,"linePrefix")(t):r(t)};function r(e){return null===e||(0,d.HP)(e)?t(e):n(e)}},partial:!0};function y(e){const t={};let n,r,i,o,s,u,c,l=-1;for(;++l<e.length;){for(;l in t;)l=t[l];if(n=e[l],l&&"chunkFlow"===n[1].type&&"listItemPrefix"===e[l-1][1].type&&(u=n[1]._tokenizer.events,i=0,i<u.length&&"lineEndingBlank"===u[i][1].type&&(i+=2),i<u.length&&"content"===u[i][1].type))for(;++i<u.length&&"content"!==u[i][1].type;)"chunkText"===u[i][1].type&&(u[i][1]._isInFirstContentOfListItem=!0,i++);if("enter"===n[0])n[1].contentType&&(Object.assign(t,v(e,l)),l=t[l],c=!0);else if(n[1]._container){for(i=l,r=void 0;i--&&(o=e[i],"lineEnding"===o[1].type||"lineEndingBlank"===o[1].type);)"enter"===o[0]&&(r&&(e[r][1].type="lineEndingBlank"),o[1].type="lineEnding",r=i);r&&(n[1].end=Object.assign({},e[r][1].start),s=e.slice(r,l),s.unshift(n),a(e,r,l-r+1,s))}}return!c}function v(e,t){const n=e[t][1],r=e[t][2];let i=t-1;const o=[],s=n._tokenizer||r.parser[n.contentType](n.start),u=s.events,c=[],l={};let h,d,f=-1,p=n,m=0,g=0;const _=[g];for(;p;){for(;e[++i][1]!==p;);o.push(i),p._tokenizer||(h=r.sliceStream(p),p.next||h.push(null),d&&s.defineSkip(p.start),p._isInFirstContentOfListItem&&(s._gfmTasklistFirstContentOfListItem=!0),s.write(h),p._isInFirstContentOfListItem&&(s._gfmTasklistFirstContentOfListItem=void 0)),d=p,p=p.next}for(p=n;++f<u.length;)"exit"===u[f][0]&&"enter"===u[f-1][0]&&u[f][1].type===u[f-1][1].type&&u[f][1].start.line!==u[f][1].end.line&&(g=f+1,_.push(g),p._tokenizer=void 0,p.previous=void 0,p=p.next);for(s.events=[],p?(p._tokenizer=void 0,p.previous=void 0):_.pop(),f=_.length;f--;){const t=u.slice(_[f],_[f+1]),n=o.pop();c.unshift([n,n+t.length-1]),a(e,n,2,t)}for(f=-1;++f<c.length;)l[m+c[f][0]]=m+c[f][1],m+=c[f][1]-c[f][0]-1;return l}const E={tokenize:function(e,t){let n;return function(t){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),r(t)};function r(t){return null===t?i(t):(0,d.HP)(t)?e.check(S,o,i)(t):(e.consume(t),r)}function i(n){return e.exit("chunkContent"),e.exit("content"),t(n)}function o(t){return e.consume(t),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,r}},resolve:function(e){return y(e),e}},S={tokenize:function(e,t,n){const r=this;return function(t){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),f(e,i,"linePrefix")};function i(i){if(null===i||(0,d.HP)(i))return n(i);const o=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes("codeIndented")&&o&&"linePrefix"===o[1].type&&o[2].sliceSerialize(o[1],!0).length>=4?t(i):e.interrupt(r.parser.constructs.flow,n,t)(i)}},partial:!0},w={tokenize:function(e){const t=this,n=e.attempt(_,(function(r){if(null!==r)return e.enter("lineEndingBlank"),e.consume(r),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n;e.consume(r)}),e.attempt(this.parser.constructs.flowInitial,r,f(e,e.attempt(this.parser.constructs.flow,r,e.attempt(E,r)),"linePrefix")));return n;function r(r){if(null!==r)return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),t.currentConstruct=void 0,n;e.consume(r)}}},C={resolveAll:T()},O=M("string"),b=M("text");function M(e){return{tokenize:function(t){const n=this,r=this.parser.constructs[e],i=t.attempt(r,o,s);return o;function o(e){return u(e)?i(e):s(e)}function s(e){if(null!==e)return t.enter("data"),t.consume(e),a;t.consume(e)}function a(e){return u(e)?(t.exit("data"),i(e)):(t.consume(e),a)}function u(e){if(null===e)return!0;const t=r[e];let i=-1;if(t)for(;++i<t.length;){const e=t[i];if(!e.previous||e.previous.call(n,n.previous))return!0}return!1}},resolveAll:T("text"===e?A:void 0)}}function T(e){return function(t,n){let r,i=-1;for(;++i<=t.length;)void 0===r?t[i]&&"data"===t[i][1].type&&(r=i,i++):t[i]&&"data"===t[i][1].type||(i!==r+2&&(t[r][1].end=t[i-1][1].end,t.splice(r+2,i-r-2),i=r+2),r=void 0);return e?e(t,n):t}}function A(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||"lineEnding"===e[n][1].type)&&"data"===e[n-1][1].type){const r=e[n-1][1],i=t.sliceStream(r);let o,s=i.length,a=-1,u=0;for(;s--;){const e=i[s];if("string"==typeof e){for(a=e.length;32===e.charCodeAt(a-1);)u++,a--;if(a)break;a=-1}else if(-2===e)o=!0,u++;else if(-1!==e){s++;break}}if(u){const i={type:n===e.length||o||u<2?"lineSuffix":"hardBreakTrailing",start:{line:r.end.line,column:r.end.column-u,offset:r.end.offset-u,_index:r.start._index+s,_bufferIndex:s?a:r.start._bufferIndex+a},end:Object.assign({},r.end)};r.end=Object.assign({},i.start),r.start.offset===r.end.offset?Object.assign(r,i):(e.splice(n,0,["enter",i,t],["exit",i,t]),n+=2)}n++}return e}function R(e,t,n){const r=[];let i=-1;for(;++i<e.length;){const o=e[i].resolveAll;o&&!r.includes(o)&&(t=o(t,n),r.push(o))}return t}function N(e,t,n){let r=Object.assign(n?Object.assign({},n):{line:1,column:1,offset:0},{_index:0,_bufferIndex:-1});const i={},o=[];let s=[],c=[],l=!0;const h={consume:function(e){(0,d.HP)(e)?(r.line++,r.column=1,r.offset+=-3===e?2:1,w()):-1!==e&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===s[r._index].length&&(r._bufferIndex=-1,r._index++)),f.previous=e,l=!0},enter:function(e,t){const n=t||{};return n.type=e,n.start=_(),f.events.push(["enter",n,f]),c.push(n),n},exit:function(e){const t=c.pop();return t.end=_(),f.events.push(["exit",t,f]),t},attempt:E((function(e,t){S(e,t.from)})),check:E(v),interrupt:E(v,{interrupt:!0})},f={previous:null,code:null,containerState:{},events:[],parser:e,sliceStream:g,sliceSerialize:function(e,t){return function(e,t){let n=-1;const r=[];let i;for(;++n<e.length;){const o=e[n];let s;if("string"==typeof o)s=o;else switch(o){case-5:s="\r";break;case-4:s="\n";break;case-3:s="\r\n";break;case-2:s=t?" ":"\t";break;case-1:if(!t&&i)continue;s=" ";break;default:s=String.fromCharCode(o)}i=-2===o,r.push(s)}return r.join("")}(g(e),t)},now:_,defineSkip:function(e){i[e.line]=e.column,w()},write:function(e){return s=u(s,e),function(){let e;for(;r._index<s.length;){const t=s[r._index];if("string"==typeof t)for(e=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===e&&r._bufferIndex<t.length;)y(t.charCodeAt(r._bufferIndex));else y(t)}}(),null!==s[s.length-1]?[]:(S(t,0),f.events=R(o,f.events,f),f.events)}};let p,m=t.tokenize.call(f,h);return t.resolveAll&&o.push(t),f;function g(e){return function(e,t){const n=t.start._index,r=t.start._bufferIndex,i=t.end._index,o=t.end._bufferIndex;let s;if(n===i)s=[e[n].slice(r,o)];else{if(s=e.slice(n,i),r>-1){const e=s[0];"string"==typeof e?s[0]=e.slice(r):s.shift()}o>0&&s.push(e[i].slice(0,o))}return s}(s,e)}function _(){const{line:e,column:t,offset:n,_index:i,_bufferIndex:o}=r;return{line:e,column:t,offset:n,_index:i,_bufferIndex:o}}function y(e){l=void 0,p=e,m=m(e)}function v(e,t){t.restore()}function E(e,t){return function(n,i,o){let s,a,u,d;return Array.isArray(n)?m(n):"tokenize"in n?m([n]):(p=n,function(e){const t=null!==e&&p[e],n=null!==e&&p.null;return m([...Array.isArray(t)?t:t?[t]:[],...Array.isArray(n)?n:n?[n]:[]])(e)});var p;function m(e){return s=e,a=0,0===e.length?o:g(e[a])}function g(e){return function(n){return d=function(){const e=_(),t=f.previous,n=f.currentConstruct,i=f.events.length,o=Array.from(c);return{restore:function(){r=e,f.previous=t,f.currentConstruct=n,f.events.length=i,c=o,w()},from:i}}(),u=e,e.partial||(f.currentConstruct=e),e.name&&f.parser.constructs.disable.null.includes(e.name)?v():e.tokenize.call(t?Object.assign(Object.create(f),t):f,h,y,v)(n)}}function y(t){return l=!0,e(u,d),i}function v(e){return l=!0,d.restore(),++a<s.length?g(s[a]):o}}}function S(e,t){e.resolveAll&&!o.includes(e)&&o.push(e),e.resolve&&a(f.events,t,f.events.length-t,e.resolve(f.events.slice(t),f)),e.resolveTo&&(f.events=e.resolveTo(f.events,f))}function w(){r.line in i&&r.column<2&&(r.column=i[r.line],r.offset+=i[r.line]-1)}}const I={name:"thematicBreak",tokenize:function(e,t,n){let r,i=0;return function(t){return e.enter("thematicBreak"),function(e){return r=e,o(e)}(t)};function o(o){return o===r?(e.enter("thematicBreakSequence"),s(o)):i>=3&&(null===o||(0,d.HP)(o))?(e.exit("thematicBreak"),t(o)):n(o)}function s(t){return t===r?(e.consume(t),i++,s):(e.exit("thematicBreakSequence"),(0,d.On)(t)?f(e,o,"whitespace")(t):o(t))}}},x={name:"list",tokenize:function(e,t,n){const r=this,i=r.events[r.events.length-1];let o=i&&"linePrefix"===i[1].type?i[2].sliceSerialize(i[1],!0).length:0,s=0;return function(t){const i=r.containerState.type||(42===t||43===t||45===t?"listUnordered":"listOrdered");if("listUnordered"===i?!r.containerState.marker||t===r.containerState.marker:(0,d.BM)(t)){if(r.containerState.type||(r.containerState.type=i,e.enter(i,{_container:!0})),"listUnordered"===i)return e.enter("listItemPrefix"),42===t||45===t?e.check(I,n,u)(t):u(t);if(!r.interrupt||49===t)return e.enter("listItemPrefix"),e.enter("listItemValue"),a(t)}return n(t)};function a(t){return(0,d.BM)(t)&&++s<10?(e.consume(t),a):(!r.interrupt||s<2)&&(r.containerState.marker?t===r.containerState.marker:41===t||46===t)?(e.exit("listItemValue"),u(t)):n(t)}function u(t){return e.enter("listItemMarker"),e.consume(t),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||t,e.check(_,r.interrupt?n:c,e.attempt(k,h,l))}function c(e){return r.containerState.initialBlankLine=!0,o++,h(e)}function l(t){return(0,d.On)(t)?(e.enter("listItemPrefixWhitespace"),e.consume(t),e.exit("listItemPrefixWhitespace"),h):n(t)}function h(n){return r.containerState.size=o+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(n)}},continuation:{tokenize:function(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(_,(function(n){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,f(e,t,"listItemIndent",r.containerState.size+1)(n)}),(function(n){return r.containerState.furtherBlankLines||!(0,d.On)(n)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,i(n)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(P,t,i)(n))}));function i(i){return r.containerState._closeFlow=!0,r.interrupt=void 0,f(e,e.attempt(x,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(i)}}},exit:function(e){e.exit(this.containerState.type)}},k={tokenize:function(e,t,n){const r=this;return f(e,(function(e){const i=r.events[r.events.length-1];return!(0,d.On)(e)&&i&&"listItemPrefixWhitespace"===i[1].type?t(e):n(e)}),"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5)},partial:!0},P={tokenize:function(e,t,n){const r=this;return f(e,(function(e){const i=r.events[r.events.length-1];return i&&"listItemIndent"===i[1].type&&i[2].sliceSerialize(i[1],!0).length===r.containerState.size?t(e):n(e)}),"listItemIndent",r.containerState.size+1)},partial:!0},D={name:"blockQuote",tokenize:function(e,t,n){const r=this;return function(t){if(62===t){const n=r.containerState;return n.open||(e.enter("blockQuote",{_container:!0}),n.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(t),e.exit("blockQuoteMarker"),i}return n(t)};function i(n){return(0,d.On)(n)?(e.enter("blockQuotePrefixWhitespace"),e.consume(n),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(n))}},continuation:{tokenize:function(e,t,n){const r=this;return function(t){return(0,d.On)(t)?f(e,i,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(t):i(t)};function i(r){return e.attempt(D,t,n)(r)}}},exit:function(e){e.exit("blockQuote")}};function $(e,t,n,r,i,o,s,a,u){const c=u||Number.POSITIVE_INFINITY;let l=0;return function(t){return 60===t?(e.enter(r),e.enter(i),e.enter(o),e.consume(t),e.exit(o),h):null===t||32===t||41===t||(0,d.JQ)(t)?n(t):(e.enter(r),e.enter(s),e.enter(a),e.enter("chunkString",{contentType:"string"}),m(t))};function h(n){return 62===n?(e.enter(o),e.consume(n),e.exit(o),e.exit(i),e.exit(r),t):(e.enter(a),e.enter("chunkString",{contentType:"string"}),f(n))}function f(t){return 62===t?(e.exit("chunkString"),e.exit(a),h(t)):null===t||60===t||(0,d.HP)(t)?n(t):(e.consume(t),92===t?p:f)}function p(t){return 60===t||62===t||92===t?(e.consume(t),f):f(t)}function m(i){return l||null!==i&&41!==i&&!(0,d.Ee)(i)?l<c&&40===i?(e.consume(i),l++,m):41===i?(e.consume(i),l--,m):null===i||32===i||40===i||(0,d.JQ)(i)?n(i):(e.consume(i),92===i?g:m):(e.exit("chunkString"),e.exit(a),e.exit(s),e.exit(r),t(i))}function g(t){return 40===t||41===t||92===t?(e.consume(t),m):m(t)}}function L(e,t,n,r,i,o){const s=this;let a,u=0;return function(t){return e.enter(r),e.enter(i),e.consume(t),e.exit(i),e.enter(o),c};function c(h){return u>999||null===h||91===h||93===h&&!a||94===h&&!u&&"_hiddenFootnoteSupport"in s.parser.constructs?n(h):93===h?(e.exit(o),e.enter(i),e.consume(h),e.exit(i),e.exit(r),t):(0,d.HP)(h)?(e.enter("lineEnding"),e.consume(h),e.exit("lineEnding"),c):(e.enter("chunkString",{contentType:"string"}),l(h))}function l(t){return null===t||91===t||93===t||(0,d.HP)(t)||u++>999?(e.exit("chunkString"),c(t)):(e.consume(t),a||(a=!(0,d.On)(t)),92===t?h:l)}function h(t){return 91===t||92===t||93===t?(e.consume(t),u++,l):l(t)}}function B(e,t,n,r,i,o){let s;return function(t){return 34===t||39===t||40===t?(e.enter(r),e.enter(i),e.consume(t),e.exit(i),s=40===t?41:t,a):n(t)};function a(n){return n===s?(e.enter(i),e.consume(n),e.exit(i),e.exit(r),t):(e.enter(o),u(n))}function u(t){return t===s?(e.exit(o),a(s)):null===t?n(t):(0,d.HP)(t)?(e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),f(e,u,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),c(t))}function c(t){return t===s||null===t||(0,d.HP)(t)?(e.exit("chunkString"),u(t)):(e.consume(t),92===t?l:c)}function l(t){return t===s||92===t?(e.consume(t),c):c(t)}}function j(e,t){let n;return function r(i){return(0,d.HP)(i)?(e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),n=!0,r):(0,d.On)(i)?f(e,r,n?"linePrefix":"lineSuffix")(i):t(i)}}function q(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const F={name:"definition",tokenize:function(e,t,n){const r=this;let i;return function(t){return e.enter("definition"),function(t){return L.call(r,e,o,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(t)}(t)};function o(t){return i=q(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),58===t?(e.enter("definitionMarker"),e.consume(t),e.exit("definitionMarker"),s):n(t)}function s(t){return(0,d.Ee)(t)?j(e,a)(t):a(t)}function a(t){return $(e,u,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(t)}function u(t){return e.attempt(z,c,c)(t)}function c(t){return(0,d.On)(t)?f(e,l,"whitespace")(t):l(t)}function l(o){return null===o||(0,d.HP)(o)?(e.exit("definition"),r.parser.defined.push(i),t(o)):n(o)}}},z={tokenize:function(e,t,n){return function(t){return(0,d.Ee)(t)?j(e,r)(t):n(t)};function r(t){return B(e,i,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(t)}function i(t){return(0,d.On)(t)?f(e,o,"whitespace")(t):o(t)}function o(e){return null===e||(0,d.HP)(e)?t(e):n(e)}},partial:!0},U={name:"codeIndented",tokenize:function(e,t,n){const r=this;return function(t){return e.enter("codeIndented"),f(e,i,"linePrefix",5)(t)};function i(e){const t=r.events[r.events.length-1];return t&&"linePrefix"===t[1].type&&t[2].sliceSerialize(t[1],!0).length>=4?o(e):n(e)}function o(t){return null===t?a(t):(0,d.HP)(t)?e.attempt(V,o,a)(t):(e.enter("codeFlowValue"),s(t))}function s(t){return null===t||(0,d.HP)(t)?(e.exit("codeFlowValue"),o(t)):(e.consume(t),s)}function a(n){return e.exit("codeIndented"),t(n)}}},V={tokenize:function(e,t,n){const r=this;return i;function i(t){return r.parser.lazy[r.now().line]?n(t):(0,d.HP)(t)?(e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),i):f(e,o,"linePrefix",5)(t)}function o(e){const o=r.events[r.events.length-1];return o&&"linePrefix"===o[1].type&&o[2].sliceSerialize(o[1],!0).length>=4?t(e):(0,d.HP)(e)?i(e):n(e)}},partial:!0},W={name:"headingAtx",tokenize:function(e,t,n){let r=0;return function(t){return e.enter("atxHeading"),function(t){return e.enter("atxHeadingSequence"),i(t)}(t)};function i(t){return 35===t&&r++<6?(e.consume(t),i):null===t||(0,d.Ee)(t)?(e.exit("atxHeadingSequence"),o(t)):n(t)}function o(n){return 35===n?(e.enter("atxHeadingSequence"),s(n)):null===n||(0,d.HP)(n)?(e.exit("atxHeading"),t(n)):(0,d.On)(n)?f(e,o,"whitespace")(n):(e.enter("atxHeadingText"),a(n))}function s(t){return 35===t?(e.consume(t),s):(e.exit("atxHeadingSequence"),o(t))}function a(t){return null===t||35===t||(0,d.Ee)(t)?(e.exit("atxHeadingText"),o(t)):(e.consume(t),a)}},resolve:function(e,t){let n,r,i=e.length-2,o=3;return"whitespace"===e[o][1].type&&(o+=2),i-2>o&&"whitespace"===e[i][1].type&&(i-=2),"atxHeadingSequence"===e[i][1].type&&(o===i-1||i-4>o&&"whitespace"===e[i-2][1].type)&&(i-=o+1===i?2:4),i>o&&(n={type:"atxHeadingText",start:e[o][1].start,end:e[i][1].end},r={type:"chunkText",start:e[o][1].start,end:e[i][1].end,contentType:"text"},a(e,o,i-o+1,[["enter",n,t],["enter",r,t],["exit",r,t],["exit",n,t]])),e}},G={name:"setextUnderline",tokenize:function(e,t,n){const r=this;let i;return function(t){let s,a=r.events.length;for(;a--;)if("lineEnding"!==r.events[a][1].type&&"linePrefix"!==r.events[a][1].type&&"content"!==r.events[a][1].type){s="paragraph"===r.events[a][1].type;break}return r.parser.lazy[r.now().line]||!r.interrupt&&!s?n(t):(e.enter("setextHeadingLine"),i=t,function(t){return e.enter("setextHeadingLineSequence"),o(t)}(t))};function o(t){return t===i?(e.consume(t),o):(e.exit("setextHeadingLineSequence"),(0,d.On)(t)?f(e,s,"lineSuffix")(t):s(t))}function s(r){return null===r||(0,d.HP)(r)?(e.exit("setextHeadingLine"),t(r)):n(r)}},resolveTo:function(e,t){let n,r,i,o=e.length;for(;o--;)if("enter"===e[o][0]){if("content"===e[o][1].type){n=o;break}"paragraph"===e[o][1].type&&(r=o)}else"content"===e[o][1].type&&e.splice(o,1),i||"definition"!==e[o][1].type||(i=o);const s={type:"setextHeading",start:Object.assign({},e[r][1].start),end:Object.assign({},e[e.length-1][1].end)};return e[r][1].type="setextHeadingText",i?(e.splice(r,0,["enter",s,t]),e.splice(i+1,0,["exit",e[n][1],t]),e[n][1].end=Object.assign({},e[i][1].end)):e[n][1]=s,e.push(["exit",s,t]),e}},H=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],K=["pre","script","style","textarea"],Y={name:"htmlFlow",tokenize:function(e,t,n){const r=this;let i,o,s,a,u;return function(t){return function(t){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(t),c}(t)};function c(a){return 33===a?(e.consume(a),l):47===a?(e.consume(a),o=!0,p):63===a?(e.consume(a),i=3,r.interrupt?t:D):(0,d.CW)(a)?(e.consume(a),s=String.fromCharCode(a),m):n(a)}function l(o){return 45===o?(e.consume(o),i=2,h):91===o?(e.consume(o),i=5,a=0,f):(0,d.CW)(o)?(e.consume(o),i=4,r.interrupt?t:D):n(o)}function h(i){return 45===i?(e.consume(i),r.interrupt?t:D):n(i)}function f(i){return i==="CDATA[".charCodeAt(a++)?(e.consume(i),6===a?r.interrupt?t:T:f):n(i)}function p(t){return(0,d.CW)(t)?(e.consume(t),s=String.fromCharCode(t),m):n(t)}function m(a){if(null===a||47===a||62===a||(0,d.Ee)(a)){const u=47===a,c=s.toLowerCase();return u||o||!K.includes(c)?H.includes(s.toLowerCase())?(i=6,u?(e.consume(a),g):r.interrupt?t(a):T(a)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(a):o?_(a):y(a)):(i=1,r.interrupt?t(a):T(a))}return 45===a||(0,d.lV)(a)?(e.consume(a),s+=String.fromCharCode(a),m):n(a)}function g(i){return 62===i?(e.consume(i),r.interrupt?t:T):n(i)}function _(t){return(0,d.On)(t)?(e.consume(t),_):b(t)}function y(t){return 47===t?(e.consume(t),b):58===t||95===t||(0,d.CW)(t)?(e.consume(t),v):(0,d.On)(t)?(e.consume(t),y):b(t)}function v(t){return 45===t||46===t||58===t||95===t||(0,d.lV)(t)?(e.consume(t),v):E(t)}function E(t){return 61===t?(e.consume(t),S):(0,d.On)(t)?(e.consume(t),E):y(t)}function S(t){return null===t||60===t||61===t||62===t||96===t?n(t):34===t||39===t?(e.consume(t),u=t,w):(0,d.On)(t)?(e.consume(t),S):C(t)}function w(t){return t===u?(e.consume(t),u=null,O):null===t||(0,d.HP)(t)?n(t):(e.consume(t),w)}function C(t){return null===t||34===t||39===t||47===t||60===t||61===t||62===t||96===t||(0,d.Ee)(t)?E(t):(e.consume(t),C)}function O(e){return 47===e||62===e||(0,d.On)(e)?y(e):n(e)}function b(t){return 62===t?(e.consume(t),M):n(t)}function M(t){return null===t||(0,d.HP)(t)?T(t):(0,d.On)(t)?(e.consume(t),M):n(t)}function T(t){return 45===t&&2===i?(e.consume(t),I):60===t&&1===i?(e.consume(t),x):62===t&&4===i?(e.consume(t),$):63===t&&3===i?(e.consume(t),D):93===t&&5===i?(e.consume(t),P):!(0,d.HP)(t)||6!==i&&7!==i?null===t||(0,d.HP)(t)?(e.exit("htmlFlowData"),A(t)):(e.consume(t),T):(e.exit("htmlFlowData"),e.check(Q,L,A)(t))}function A(t){return e.check(J,R,L)(t)}function R(t){return e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),N}function N(t){return null===t||(0,d.HP)(t)?A(t):(e.enter("htmlFlowData"),T(t))}function I(t){return 45===t?(e.consume(t),D):T(t)}function x(t){return 47===t?(e.consume(t),s="",k):T(t)}function k(t){if(62===t){const n=s.toLowerCase();return K.includes(n)?(e.consume(t),$):T(t)}return(0,d.CW)(t)&&s.length<8?(e.consume(t),s+=String.fromCharCode(t),k):T(t)}function P(t){return 93===t?(e.consume(t),D):T(t)}function D(t){return 62===t?(e.consume(t),$):45===t&&2===i?(e.consume(t),D):T(t)}function $(t){return null===t||(0,d.HP)(t)?(e.exit("htmlFlowData"),L(t)):(e.consume(t),$)}function L(n){return e.exit("htmlFlow"),t(n)}},resolveTo:function(e){let t=e.length;for(;t--&&("enter"!==e[t][0]||"htmlFlow"!==e[t][1].type););return t>1&&"linePrefix"===e[t-2][1].type&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e},concrete:!0},Q={tokenize:function(e,t,n){return function(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),e.attempt(_,t,n)}},partial:!0},J={tokenize:function(e,t,n){const r=this;return function(t){return(0,d.HP)(t)?(e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),i):n(t)};function i(e){return r.parser.lazy[r.now().line]?n(e):t(e)}},partial:!0},X={tokenize:function(e,t,n){const r=this;return function(t){return null===t?n(t):(e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),i)};function i(e){return r.parser.lazy[r.now().line]?n(e):t(e)}},partial:!0},Z={name:"codeFenced",tokenize:function(e,t,n){const r=this,i={tokenize:function(e,t,n){let i=0;return function(t){return e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),s};function s(t){return e.enter("codeFencedFence"),(0,d.On)(t)?f(e,u,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(t):u(t)}function u(t){return t===o?(e.enter("codeFencedFenceSequence"),c(t)):n(t)}function c(t){return t===o?(i++,e.consume(t),c):i>=a?(e.exit("codeFencedFenceSequence"),(0,d.On)(t)?f(e,l,"whitespace")(t):l(t)):n(t)}function l(r){return null===r||(0,d.HP)(r)?(e.exit("codeFencedFence"),t(r)):n(r)}},partial:!0};let o,s=0,a=0;return function(t){return function(t){const n=r.events[r.events.length-1];return s=n&&"linePrefix"===n[1].type?n[2].sliceSerialize(n[1],!0).length:0,o=t,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),u(t)}(t)};function u(t){return t===o?(a++,e.consume(t),u):a<3?n(t):(e.exit("codeFencedFenceSequence"),(0,d.On)(t)?f(e,c,"whitespace")(t):c(t))}function c(n){return null===n||(0,d.HP)(n)?(e.exit("codeFencedFence"),r.interrupt?t(n):e.check(X,m,E)(n)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),l(n))}function l(t){return null===t||(0,d.HP)(t)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),c(t)):(0,d.On)(t)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),f(e,h,"whitespace")(t)):96===t&&t===o?n(t):(e.consume(t),l)}function h(t){return null===t||(0,d.HP)(t)?c(t):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),p(t))}function p(t){return null===t||(0,d.HP)(t)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),c(t)):96===t&&t===o?n(t):(e.consume(t),p)}function m(t){return e.attempt(i,E,g)(t)}function g(t){return e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),_}function _(t){return s>0&&(0,d.On)(t)?f(e,y,"linePrefix",s+1)(t):y(t)}function y(t){return null===t||(0,d.HP)(t)?e.check(X,m,E)(t):(e.enter("codeFlowValue"),v(t))}function v(t){return null===t||(0,d.HP)(t)?(e.exit("codeFlowValue"),y(t)):(e.consume(t),v)}function E(n){return e.exit("codeFenced"),t(n)}},concrete:!0};var ee=n(98915);const te={name:"characterReference",tokenize:function(e,t,n){const r=this;let i,o,s=0;return function(t){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(t),e.exit("characterReferenceMarker"),a};function a(t){return 35===t?(e.enter("characterReferenceMarkerNumeric"),e.consume(t),e.exit("characterReferenceMarkerNumeric"),u):(e.enter("characterReferenceValue"),i=31,o=d.lV,c(t))}function u(t){return 88===t||120===t?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(t),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),i=6,o=d.ok,c):(e.enter("characterReferenceValue"),i=7,o=d.BM,c(t))}function c(a){if(59===a&&s){const i=e.exit("characterReferenceValue");return o!==d.lV||(0,ee.s)(r.sliceSerialize(i))?(e.enter("characterReferenceMarker"),e.consume(a),e.exit("characterReferenceMarker"),e.exit("characterReference"),t):n(a)}return o(a)&&s++<i?(e.consume(a),c):n(a)}}},ne={name:"characterEscape",tokenize:function(e,t,n){return function(t){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(t),e.exit("escapeMarker"),r};function r(r){return(0,d.ol)(r)?(e.enter("characterEscapeValue"),e.consume(r),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(r)}}},re={name:"lineEnding",tokenize:function(e,t){return function(n){return e.enter("lineEnding"),e.consume(n),e.exit("lineEnding"),f(e,t,"linePrefix")}}},ie={name:"labelEnd",tokenize:function(e,t,n){const r=this;let i,o,s=r.events.length;for(;s--;)if(("labelImage"===r.events[s][1].type||"labelLink"===r.events[s][1].type)&&!r.events[s][1]._balanced){i=r.events[s][1];break}return function(t){return i?i._inactive?l(t):(o=r.parser.defined.includes(q(r.sliceSerialize({start:i.end,end:r.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(t),e.exit("labelMarker"),e.exit("labelEnd"),a):n(t)};function a(t){return 40===t?e.attempt(oe,c,o?c:l)(t):91===t?e.attempt(se,c,o?u:l)(t):o?c(t):l(t)}function u(t){return e.attempt(ae,c,l)(t)}function c(e){return t(e)}function l(e){return i._balanced=!0,n(e)}},resolveTo:function(e,t){let n,r,i,o,s=e.length,c=0;for(;s--;)if(n=e[s][1],r){if("link"===n.type||"labelLink"===n.type&&n._inactive)break;"enter"===e[s][0]&&"labelLink"===n.type&&(n._inactive=!0)}else if(i){if("enter"===e[s][0]&&("labelImage"===n.type||"labelLink"===n.type)&&!n._balanced&&(r=s,"labelLink"!==n.type)){c=2;break}}else"labelEnd"===n.type&&(i=s);const l={type:"labelLink"===e[r][1].type?"link":"image",start:Object.assign({},e[r][1].start),end:Object.assign({},e[e.length-1][1].end)},h={type:"label",start:Object.assign({},e[r][1].start),end:Object.assign({},e[i][1].end)},d={type:"labelText",start:Object.assign({},e[r+c+2][1].end),end:Object.assign({},e[i-2][1].start)};return o=[["enter",l,t],["enter",h,t]],o=u(o,e.slice(r+1,r+c+3)),o=u(o,[["enter",d,t]]),o=u(o,R(t.parser.constructs.insideSpan.null,e.slice(r+c+4,i-3),t)),o=u(o,[["exit",d,t],e[i-2],e[i-1],["exit",h,t]]),o=u(o,e.slice(i+1)),o=u(o,[["exit",l,t]]),a(e,r,e.length,o),e},resolveAll:function(e){let t=-1;for(;++t<e.length;){const n=e[t][1];"labelImage"!==n.type&&"labelLink"!==n.type&&"labelEnd"!==n.type||(e.splice(t+1,"labelImage"===n.type?4:2),n.type="data",t++)}return e}},oe={tokenize:function(e,t,n){return function(t){return e.enter("resource"),e.enter("resourceMarker"),e.consume(t),e.exit("resourceMarker"),r};function r(t){return(0,d.Ee)(t)?j(e,i)(t):i(t)}function i(t){return 41===t?c(t):$(e,o,s,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(t)}function o(t){return(0,d.Ee)(t)?j(e,a)(t):c(t)}function s(e){return n(e)}function a(t){return 34===t||39===t||40===t?B(e,u,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(t):c(t)}function u(t){return(0,d.Ee)(t)?j(e,c)(t):c(t)}function c(r){return 41===r?(e.enter("resourceMarker"),e.consume(r),e.exit("resourceMarker"),e.exit("resource"),t):n(r)}}},se={tokenize:function(e,t,n){const r=this;return function(t){return L.call(r,e,i,o,"reference","referenceMarker","referenceString")(t)};function i(e){return r.parser.defined.includes(q(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(e):n(e)}function o(e){return n(e)}}},ae={tokenize:function(e,t,n){return function(t){return e.enter("reference"),e.enter("referenceMarker"),e.consume(t),e.exit("referenceMarker"),r};function r(r){return 93===r?(e.enter("referenceMarker"),e.consume(r),e.exit("referenceMarker"),e.exit("reference"),t):n(r)}}},ue={name:"labelStartImage",tokenize:function(e,t,n){const r=this;return function(t){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(t),e.exit("labelImageMarker"),i};function i(t){return 91===t?(e.enter("labelMarker"),e.consume(t),e.exit("labelMarker"),e.exit("labelImage"),o):n(t)}function o(e){return 94===e&&"_hiddenFootnoteSupport"in r.parser.constructs?n(e):t(e)}},resolveAll:ie.resolveAll};function ce(e){return null===e||(0,d.Ee)(e)||(0,d.Ny)(e)?1:(0,d.es)(e)?2:void 0}const le={name:"attention",tokenize:function(e,t){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,i=ce(r);let o;return function(t){return o=t,e.enter("attentionSequence"),s(t)};function s(a){if(a===o)return e.consume(a),s;const u=e.exit("attentionSequence"),c=ce(a),l=!c||2===c&&i||n.includes(a),h=!i||2===i&&c||n.includes(r);return u._open=Boolean(42===o?l:l&&(i||!h)),u._close=Boolean(42===o?h:h&&(c||!l)),t(a)}},resolveAll:function(e,t){let n,r,i,o,s,c,l,h,d=-1;for(;++d<e.length;)if("enter"===e[d][0]&&"attentionSequence"===e[d][1].type&&e[d][1]._close)for(n=d;n--;)if("exit"===e[n][0]&&"attentionSequence"===e[n][1].type&&e[n][1]._open&&t.sliceSerialize(e[n][1]).charCodeAt(0)===t.sliceSerialize(e[d][1]).charCodeAt(0)){if((e[n][1]._close||e[d][1]._open)&&(e[d][1].end.offset-e[d][1].start.offset)%3&&!((e[n][1].end.offset-e[n][1].start.offset+e[d][1].end.offset-e[d][1].start.offset)%3))continue;c=e[n][1].end.offset-e[n][1].start.offset>1&&e[d][1].end.offset-e[d][1].start.offset>1?2:1;const f=Object.assign({},e[n][1].end),p=Object.assign({},e[d][1].start);he(f,-c),he(p,c),o={type:c>1?"strongSequence":"emphasisSequence",start:f,end:Object.assign({},e[n][1].end)},s={type:c>1?"strongSequence":"emphasisSequence",start:Object.assign({},e[d][1].start),end:p},i={type:c>1?"strongText":"emphasisText",start:Object.assign({},e[n][1].end),end:Object.assign({},e[d][1].start)},r={type:c>1?"strong":"emphasis",start:Object.assign({},o.start),end:Object.assign({},s.end)},e[n][1].end=Object.assign({},o.start),e[d][1].start=Object.assign({},s.end),l=[],e[n][1].end.offset-e[n][1].start.offset&&(l=u(l,[["enter",e[n][1],t],["exit",e[n][1],t]])),l=u(l,[["enter",r,t],["enter",o,t],["exit",o,t],["enter",i,t]]),l=u(l,R(t.parser.constructs.insideSpan.null,e.slice(n+1,d),t)),l=u(l,[["exit",i,t],["enter",s,t],["exit",s,t],["exit",r,t]]),e[d][1].end.offset-e[d][1].start.offset?(h=2,l=u(l,[["enter",e[d][1],t],["exit",e[d][1],t]])):h=0,a(e,n-1,d-n+3,l),d=n+l.length-h-2;break}for(d=-1;++d<e.length;)"attentionSequence"===e[d][1].type&&(e[d][1].type="data");return e}};function he(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const de={name:"autolink",tokenize:function(e,t,n){let r=0;return function(t){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(t),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),i};function i(t){return(0,d.CW)(t)?(e.consume(t),o):u(t)}function o(e){return 43===e||45===e||46===e||(0,d.lV)(e)?(r=1,s(e)):u(e)}function s(t){return 58===t?(e.consume(t),r=0,a):(43===t||45===t||46===t||(0,d.lV)(t))&&r++<32?(e.consume(t),s):(r=0,u(t))}function a(r){return 62===r?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(r),e.exit("autolinkMarker"),e.exit("autolink"),t):null===r||32===r||60===r||(0,d.JQ)(r)?n(r):(e.consume(r),a)}function u(t){return 64===t?(e.consume(t),c):(0,d.cx)(t)?(e.consume(t),u):n(t)}function c(e){return(0,d.lV)(e)?l(e):n(e)}function l(n){return 46===n?(e.consume(n),r=0,c):62===n?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(n),e.exit("autolinkMarker"),e.exit("autolink"),t):h(n)}function h(t){if((45===t||(0,d.lV)(t))&&r++<63){const n=45===t?h:l;return e.consume(t),n}return n(t)}}},fe={name:"htmlText",tokenize:function(e,t,n){const r=this;let i,o,s;return function(t){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(t),a};function a(t){return 33===t?(e.consume(t),u):47===t?(e.consume(t),w):63===t?(e.consume(t),E):(0,d.CW)(t)?(e.consume(t),b):n(t)}function u(t){return 45===t?(e.consume(t),c):91===t?(e.consume(t),o=0,m):(0,d.CW)(t)?(e.consume(t),v):n(t)}function c(t){return 45===t?(e.consume(t),p):n(t)}function l(t){return null===t?n(t):45===t?(e.consume(t),h):(0,d.HP)(t)?(s=l,P(t)):(e.consume(t),l)}function h(t){return 45===t?(e.consume(t),p):l(t)}function p(e){return 62===e?k(e):45===e?h(e):l(e)}function m(t){return t==="CDATA[".charCodeAt(o++)?(e.consume(t),6===o?g:m):n(t)}function g(t){return null===t?n(t):93===t?(e.consume(t),_):(0,d.HP)(t)?(s=g,P(t)):(e.consume(t),g)}function _(t){return 93===t?(e.consume(t),y):g(t)}function y(t){return 62===t?k(t):93===t?(e.consume(t),y):g(t)}function v(t){return null===t||62===t?k(t):(0,d.HP)(t)?(s=v,P(t)):(e.consume(t),v)}function E(t){return null===t?n(t):63===t?(e.consume(t),S):(0,d.HP)(t)?(s=E,P(t)):(e.consume(t),E)}function S(e){return 62===e?k(e):E(e)}function w(t){return(0,d.CW)(t)?(e.consume(t),C):n(t)}function C(t){return 45===t||(0,d.lV)(t)?(e.consume(t),C):O(t)}function O(t){return(0,d.HP)(t)?(s=O,P(t)):(0,d.On)(t)?(e.consume(t),O):k(t)}function b(t){return 45===t||(0,d.lV)(t)?(e.consume(t),b):47===t||62===t||(0,d.Ee)(t)?M(t):n(t)}function M(t){return 47===t?(e.consume(t),k):58===t||95===t||(0,d.CW)(t)?(e.consume(t),T):(0,d.HP)(t)?(s=M,P(t)):(0,d.On)(t)?(e.consume(t),M):k(t)}function T(t){return 45===t||46===t||58===t||95===t||(0,d.lV)(t)?(e.consume(t),T):A(t)}function A(t){return 61===t?(e.consume(t),R):(0,d.HP)(t)?(s=A,P(t)):(0,d.On)(t)?(e.consume(t),A):M(t)}function R(t){return null===t||60===t||61===t||62===t||96===t?n(t):34===t||39===t?(e.consume(t),i=t,N):(0,d.HP)(t)?(s=R,P(t)):(0,d.On)(t)?(e.consume(t),R):(e.consume(t),I)}function N(t){return t===i?(e.consume(t),i=void 0,x):null===t?n(t):(0,d.HP)(t)?(s=N,P(t)):(e.consume(t),N)}function I(t){return null===t||34===t||39===t||60===t||61===t||96===t?n(t):47===t||62===t||(0,d.Ee)(t)?M(t):(e.consume(t),I)}function x(e){return 47===e||62===e||(0,d.Ee)(e)?M(e):n(e)}function k(r){return 62===r?(e.consume(r),e.exit("htmlTextData"),e.exit("htmlText"),t):n(r)}function P(t){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),D}function D(t){return(0,d.On)(t)?f(e,$,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(t):$(t)}function $(t){return e.enter("htmlTextData"),s(t)}}},pe={name:"labelStartLink",tokenize:function(e,t,n){const r=this;return function(t){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(t),e.exit("labelMarker"),e.exit("labelLink"),i};function i(e){return 94===e&&"_hiddenFootnoteSupport"in r.parser.constructs?n(e):t(e)}},resolveAll:ie.resolveAll},me={name:"hardBreakEscape",tokenize:function(e,t,n){return function(t){return e.enter("hardBreakEscape"),e.consume(t),r};function r(r){return(0,d.HP)(r)?(e.exit("hardBreakEscape"),t(r)):n(r)}}},ge={name:"codeText",tokenize:function(e,t,n){let r,i,o=0;return function(t){return e.enter("codeText"),e.enter("codeTextSequence"),s(t)};function s(t){return 96===t?(e.consume(t),o++,s):(e.exit("codeTextSequence"),a(t))}function a(t){return null===t?n(t):32===t?(e.enter("space"),e.consume(t),e.exit("space"),a):96===t?(i=e.enter("codeTextSequence"),r=0,c(t)):(0,d.HP)(t)?(e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),a):(e.enter("codeTextData"),u(t))}function u(t){return null===t||32===t||96===t||(0,d.HP)(t)?(e.exit("codeTextData"),a(t)):(e.consume(t),u)}function c(n){return 96===n?(e.consume(n),r++,c):r===o?(e.exit("codeTextSequence"),e.exit("codeText"),t(n)):(i.type="codeTextData",u(n))}},resolve:function(e){let t,n,r=e.length-4,i=3;if(!("lineEnding"!==e[i][1].type&&"space"!==e[i][1].type||"lineEnding"!==e[r][1].type&&"space"!==e[r][1].type))for(t=i;++t<r;)if("codeTextData"===e[t][1].type){e[i][1].type="codeTextPadding",e[r][1].type="codeTextPadding",i+=2,r-=2;break}for(t=i-1,r++;++t<=r;)void 0===n?t!==r&&"lineEnding"!==e[t][1].type&&(n=t):t!==r&&"lineEnding"!==e[t][1].type||(e[n][1].type="codeTextData",t!==n+2&&(e[n][1].end=e[t-1][1].end,e.splice(n+2,t-n-2),r-=t-n-2,t=n+2),n=void 0);return e},previous:function(e){return 96!==e||"characterEscape"===this.events[this.events.length-1][1].type}},_e={42:x,43:x,45:x,48:x,49:x,50:x,51:x,52:x,53:x,54:x,55:x,56:x,57:x,62:D},ye={91:F},ve={[-2]:U,[-1]:U,32:U},Ee={35:W,42:I,45:[G,I],60:Y,61:G,95:I,96:Z,126:Z},Se={38:te,92:ne},we={[-5]:re,[-4]:re,[-3]:re,33:ue,38:te,42:le,60:[de,fe],91:pe,92:[me,ne],93:ie,95:le,96:ge},Ce={null:[le,C]},Oe={null:[42,95]},be={null:[]};const Me=/[\0\t\n\r]/g;function Te(e,t){const n=Number.parseInt(e,t);return n<9||11===n||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||!(65535&~n)||65534==(65535&n)||n>1114111?"�":String.fromCharCode(n)}const Ae=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function Re(e,t,n){if(t)return t;if(35===n.charCodeAt(0)){const e=n.charCodeAt(1),t=120===e||88===e;return Te(n.slice(t?2:1),t?16:10)}return(0,ee.s)(n)||e}var Ne=n(94271);const Ie={}.hasOwnProperty,xe=function(e,t,n){return"string"!=typeof t&&(n=t,t=void 0),function(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:u(w),autolinkProtocol:p,autolinkEmail:p,atxHeading:u(v),blockQuote:u((function(){return{type:"blockquote",children:[]}})),characterEscape:p,characterReference:p,codeFenced:u(y),codeFencedFenceInfo:c,codeFencedFenceMeta:c,codeIndented:u(y,c),codeText:u((function(){return{type:"inlineCode",value:""}}),c),codeTextData:p,data:p,codeFlowValue:p,definition:u((function(){return{type:"definition",identifier:"",label:null,title:null,url:""}})),definitionDestinationString:c,definitionLabelString:c,definitionTitleString:c,emphasis:u((function(){return{type:"emphasis",children:[]}})),hardBreakEscape:u(E),hardBreakTrailing:u(E),htmlFlow:u(S,c),htmlFlowData:p,htmlText:u(S,c),htmlTextData:p,image:u((function(){return{type:"image",title:null,url:"",alt:null}})),label:c,link:u(w),listItem:u((function(e){return{type:"listItem",spread:e._spread,checked:null,children:[]}})),listItemValue:function(e){a("expectingFirstListItemValue")&&(this.stack[this.stack.length-2].start=Number.parseInt(this.sliceSerialize(e),10),s("expectingFirstListItemValue"))},listOrdered:u(C,(function(){s("expectingFirstListItemValue",!0)})),listUnordered:u(C),paragraph:u((function(){return{type:"paragraph",children:[]}})),reference:function(){s("referenceType","collapsed")},referenceString:c,resourceDestinationString:c,resourceTitleString:c,setextHeading:u(v),strong:u((function(){return{type:"strong",children:[]}})),thematicBreak:u((function(){return{type:"thematicBreak"}}))},exit:{atxHeading:h(),atxHeadingSequence:function(e){const t=this.stack[this.stack.length-1];if(!t.depth){const n=this.sliceSerialize(e).length;t.depth=n}},autolink:h(),autolinkEmail:function(e){m.call(this,e),this.stack[this.stack.length-1].url="mailto:"+this.sliceSerialize(e)},autolinkProtocol:function(e){m.call(this,e),this.stack[this.stack.length-1].url=this.sliceSerialize(e)},blockQuote:h(),characterEscapeValue:m,characterReferenceMarkerHexadecimal:_,characterReferenceMarkerNumeric:_,characterReferenceValue:function(e){const t=this.sliceSerialize(e),n=a("characterReferenceType");let r;n?(r=Te(t,"characterReferenceMarkerNumeric"===n?10:16),s("characterReferenceType")):r=(0,ee.s)(t);const i=this.stack.pop();i.value+=r,i.position.end=ke(e.end)},codeFenced:h((function(){const e=this.resume();this.stack[this.stack.length-1].value=e.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),s("flowCodeInside")})),codeFencedFence:function(){a("flowCodeInside")||(this.buffer(),s("flowCodeInside",!0))},codeFencedFenceInfo:function(){const e=this.resume();this.stack[this.stack.length-1].lang=e},codeFencedFenceMeta:function(){const e=this.resume();this.stack[this.stack.length-1].meta=e},codeFlowValue:m,codeIndented:h((function(){const e=this.resume();this.stack[this.stack.length-1].value=e.replace(/(\r?\n|\r)$/g,"")})),codeText:h((function(){const e=this.resume();this.stack[this.stack.length-1].value=e})),codeTextData:m,data:m,definition:h(),definitionDestinationString:function(){const e=this.resume();this.stack[this.stack.length-1].url=e},definitionLabelString:function(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.label=t,n.identifier=q(this.sliceSerialize(e)).toLowerCase()},definitionTitleString:function(){const e=this.resume();this.stack[this.stack.length-1].title=e},emphasis:h(),hardBreakEscape:h(g),hardBreakTrailing:h(g),htmlFlow:h((function(){const e=this.resume();this.stack[this.stack.length-1].value=e})),htmlFlowData:m,htmlText:h((function(){const e=this.resume();this.stack[this.stack.length-1].value=e})),htmlTextData:m,image:h((function(){const e=this.stack[this.stack.length-1];if(a("inReference")){const t=a("referenceType")||"shortcut";e.type+="Reference",e.referenceType=t,delete e.url,delete e.title}else delete e.identifier,delete e.label;s("referenceType")})),label:function(){const e=this.stack[this.stack.length-1],t=this.resume(),n=this.stack[this.stack.length-1];if(s("inReference",!0),"link"===n.type){const t=e.children;n.children=t}else n.alt=t},labelText:function(e){const t=this.sliceSerialize(e),n=this.stack[this.stack.length-2];n.label=function(e){return e.replace(Ae,Re)}(t),n.identifier=q(t).toLowerCase()},lineEnding:function(e){const n=this.stack[this.stack.length-1];if(a("atHardBreak"))return n.children[n.children.length-1].position.end=ke(e.end),void s("atHardBreak");!a("setextHeadingSlurpLineEnding")&&t.canContainEols.includes(n.type)&&(p.call(this,e),m.call(this,e))},link:h((function(){const e=this.stack[this.stack.length-1];if(a("inReference")){const t=a("referenceType")||"shortcut";e.type+="Reference",e.referenceType=t,delete e.url,delete e.title}else delete e.identifier,delete e.label;s("referenceType")})),listItem:h(),listOrdered:h(),listUnordered:h(),paragraph:h(),referenceString:function(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.label=t,n.identifier=q(this.sliceSerialize(e)).toLowerCase(),s("referenceType","full")},resourceDestinationString:function(){const e=this.resume();this.stack[this.stack.length-1].url=e},resourceTitleString:function(){const e=this.resume();this.stack[this.stack.length-1].title=e},resource:function(){s("inReference")},setextHeading:h((function(){s("setextHeadingSlurpLineEnding")})),setextHeadingLineSequence:function(e){this.stack[this.stack.length-1].depth=61===this.sliceSerialize(e).charCodeAt(0)?1:2},setextHeadingText:function(){s("setextHeadingSlurpLineEnding",!0)},strong:h(),thematicBreak:h()}};Pe(t,(e||{}).mdastExtensions||[]);const n={};return function(e){let n={type:"root",children:[]};const i={stack:[n],tokenStack:[],config:t,enter:l,exit:d,buffer:c,resume:f,setData:s,getData:a},o=[];let u=-1;for(;++u<e.length;)"listOrdered"!==e[u][1].type&&"listUnordered"!==e[u][1].type||("enter"===e[u][0]?o.push(u):u=r(e,o.pop(),u));for(u=-1;++u<e.length;){const n=t[e[u][0]];Ie.call(n,e[u][1].type)&&n[e[u][1].type].call(Object.assign({sliceSerialize:e[u][2].sliceSerialize},i),e[u][1])}if(i.tokenStack.length>0){const e=i.tokenStack[i.tokenStack.length-1];(e[1]||$e).call(i,void 0,e[0])}for(n.position={start:ke(e.length>0?e[0][1].start:{line:1,column:1,offset:0}),end:ke(e.length>0?e[e.length-2][1].end:{line:1,column:1,offset:0})},u=-1;++u<t.transforms.length;)n=t.transforms[u](n)||n;return n};function r(e,t,n){let r,i,o,s,a=t-1,u=-1,c=!1;for(;++a<=n;){const t=e[a];if("listUnordered"===t[1].type||"listOrdered"===t[1].type||"blockQuote"===t[1].type?("enter"===t[0]?u++:u--,s=void 0):"lineEndingBlank"===t[1].type?"enter"===t[0]&&(!r||s||u||o||(o=a),s=void 0):"linePrefix"===t[1].type||"listItemValue"===t[1].type||"listItemMarker"===t[1].type||"listItemPrefix"===t[1].type||"listItemPrefixWhitespace"===t[1].type||(s=void 0),!u&&"enter"===t[0]&&"listItemPrefix"===t[1].type||-1===u&&"exit"===t[0]&&("listUnordered"===t[1].type||"listOrdered"===t[1].type)){if(r){let s=a;for(i=void 0;s--;){const t=e[s];if("lineEnding"===t[1].type||"lineEndingBlank"===t[1].type){if("exit"===t[0])continue;i&&(e[i][1].type="lineEndingBlank",c=!0),t[1].type="lineEnding",i=s}else if("linePrefix"!==t[1].type&&"blockQuotePrefix"!==t[1].type&&"blockQuotePrefixWhitespace"!==t[1].type&&"blockQuoteMarker"!==t[1].type&&"listItemIndent"!==t[1].type)break}o&&(!i||o<i)&&(r._spread=!0),r.end=Object.assign({},i?e[i][1].start:t[1].end),e.splice(i||a,0,["exit",r,t[2]]),a++,n++}"listItemPrefix"===t[1].type&&(r={type:"listItem",_spread:!1,start:Object.assign({},t[1].start),end:void 0},e.splice(a,0,["enter",r,t[2]]),a++,n++,o=void 0,s=!0)}}return e[t][1]._spread=c,n}function s(e,t){n[e]=t}function a(e){return n[e]}function u(e,t){return function(n){l.call(this,e(n),n),t&&t.call(this,n)}}function c(){this.stack.push({type:"fragment",children:[]})}function l(e,t,n){return this.stack[this.stack.length-1].children.push(e),this.stack.push(e),this.tokenStack.push([t,n]),e.position={start:ke(t.start)},e}function h(e){return function(t){e&&e.call(this,t),d.call(this,t)}}function d(e,t){const n=this.stack.pop(),r=this.tokenStack.pop();if(!r)throw new Error("Cannot close `"+e.type+"` ("+(0,Ne.L)({start:e.start,end:e.end})+"): it’s not open");return r[0].type!==e.type&&(t?t.call(this,e,r[0]):(r[1]||$e).call(this,e,r[0])),n.position.end=ke(e.end),n}function f(){return function(e){return o(e,"boolean"!=typeof i.includeImageAlt||i.includeImageAlt,"boolean"!=typeof i.includeHtml||i.includeHtml)}(this.stack.pop())}function p(e){const t=this.stack[this.stack.length-1];let n=t.children[t.children.length-1];n&&"text"===n.type||(n={type:"text",value:""},n.position={start:ke(e.start)},t.children.push(n)),this.stack.push(n)}function m(e){const t=this.stack.pop();t.value+=this.sliceSerialize(e),t.position.end=ke(e.end)}function g(){s("atHardBreak",!0)}function _(e){s("characterReferenceType",e.type)}function y(){return{type:"code",lang:null,meta:null,value:""}}function v(){return{type:"heading",depth:void 0,children:[]}}function E(){return{type:"break"}}function S(){return{type:"html",value:""}}function w(){return{type:"link",title:null,url:"",children:[]}}function C(e){return{type:"list",ordered:"listOrdered"===e.type,start:null,spread:e._spread,children:[]}}}(n)(function(e){for(;!y(e););return e}(function(e){const t={defined:[],lazy:{},constructs:function(e){const t={};let n=-1;for(;++n<e.length;)l(t,e[n]);return t}([r,...(e||{}).extensions||[]]),content:n(p),document:n(m),flow:n(w),string:n(O),text:n(b)};return t;function n(e){return function(n){return N(t,e,n)}}}(n).document().write(function(){let e,t=1,n="",r=!0;return function(i,o,s){const a=[];let u,c,l,h,d;for(i=n+i.toString(o),l=0,n="",r&&(65279===i.charCodeAt(0)&&l++,r=void 0);l<i.length;){if(Me.lastIndex=l,u=Me.exec(i),h=u&&void 0!==u.index?u.index:i.length,d=i.charCodeAt(h),!u){n=i.slice(l);break}if(10===d&&l===h&&e)a.push(-3),e=void 0;else switch(e&&(a.push(-5),e=void 0),l<h&&(a.push(i.slice(l,h)),t+=h-l),d){case 0:a.push(65533),t++;break;case 9:for(c=4*Math.ceil(t/4),a.push(-2);t++<c;)a.push(-1);break;case 10:a.push(-4),t=1;break;default:e=!0,t=1}l=h+1}return s&&(e&&a.push(-5),n&&a.push(n),a.push(null)),a}}()(e,t,!0))))};function ke(e){return{line:e.line,column:e.column,offset:e.offset}}function Pe(e,t){let n=-1;for(;++n<t.length;){const r=t[n];Array.isArray(r)?Pe(e,r):De(e,r)}}function De(e,t){let n;for(n in t)if(Ie.call(t,n))if("canContainEols"===n){const r=t[n];r&&e[n].push(...r)}else if("transforms"===n){const r=t[n];r&&e[n].push(...r)}else if("enter"===n||"exit"===n){const r=t[n];r&&Object.assign(e[n],r)}}function $e(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+(0,Ne.L)({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+(0,Ne.L)({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+(0,Ne.L)({start:t.start,end:t.end})+") is still open")}},85759:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Transaction=t.TxnState=void 0,t.isTransactionCommand=function(e){return!(!e.commitTransaction&&!e.abortTransaction)};const r=n(17562),i=n(28541),o=n(13700),s=n(40012);t.TxnState=Object.freeze({NO_TRANSACTION:"NO_TRANSACTION",STARTING_TRANSACTION:"STARTING_TRANSACTION",TRANSACTION_IN_PROGRESS:"TRANSACTION_IN_PROGRESS",TRANSACTION_COMMITTED:"TRANSACTION_COMMITTED",TRANSACTION_COMMITTED_EMPTY:"TRANSACTION_COMMITTED_EMPTY",TRANSACTION_ABORTED:"TRANSACTION_ABORTED"});const a={[t.TxnState.NO_TRANSACTION]:[t.TxnState.NO_TRANSACTION,t.TxnState.STARTING_TRANSACTION],[t.TxnState.STARTING_TRANSACTION]:[t.TxnState.TRANSACTION_IN_PROGRESS,t.TxnState.TRANSACTION_COMMITTED,t.TxnState.TRANSACTION_COMMITTED_EMPTY,t.TxnState.TRANSACTION_ABORTED],[t.TxnState.TRANSACTION_IN_PROGRESS]:[t.TxnState.TRANSACTION_IN_PROGRESS,t.TxnState.TRANSACTION_COMMITTED,t.TxnState.TRANSACTION_ABORTED],[t.TxnState.TRANSACTION_COMMITTED]:[t.TxnState.TRANSACTION_COMMITTED,t.TxnState.TRANSACTION_COMMITTED_EMPTY,t.TxnState.STARTING_TRANSACTION,t.TxnState.NO_TRANSACTION],[t.TxnState.TRANSACTION_ABORTED]:[t.TxnState.STARTING_TRANSACTION,t.TxnState.NO_TRANSACTION],[t.TxnState.TRANSACTION_COMMITTED_EMPTY]:[t.TxnState.TRANSACTION_COMMITTED_EMPTY,t.TxnState.NO_TRANSACTION]},u=new Set([t.TxnState.STARTING_TRANSACTION,t.TxnState.TRANSACTION_IN_PROGRESS]),c=new Set([t.TxnState.TRANSACTION_COMMITTED,t.TxnState.TRANSACTION_COMMITTED_EMPTY,t.TxnState.TRANSACTION_ABORTED]);t.Transaction=class{constructor(e){e=e??{},this.state=t.TxnState.NO_TRANSACTION,this.options={};const n=s.WriteConcern.fromOptions(e);if(n){if(0===n.w)throw new r.MongoTransactionError("Transactions do not support unacknowledged write concern");this.options.writeConcern=n}e.readConcern&&(this.options.readConcern=i.ReadConcern.fromOptions(e)),e.readPreference&&(this.options.readPreference=o.ReadPreference.fromOptions(e)),e.maxCommitTimeMS&&(this.options.maxTimeMS=e.maxCommitTimeMS),this._pinnedServer=void 0,this._recoveryToken=void 0}get server(){return this._pinnedServer}get recoveryToken(){return this._recoveryToken}get isPinned(){return!!this.server}get isStarting(){return this.state===t.TxnState.STARTING_TRANSACTION}get isActive(){return u.has(this.state)}get isCommitted(){return c.has(this.state)}transition(e){const n=a[this.state];if(n&&n.includes(e))return this.state=e,void(this.state!==t.TxnState.NO_TRANSACTION&&this.state!==t.TxnState.STARTING_TRANSACTION&&this.state!==t.TxnState.TRANSACTION_ABORTED||this.unpinServer());throw new r.MongoRuntimeError(`Attempted illegal state transition from [${this.state}] to [${e}]`)}pinServer(e){this.isActive&&(this._pinnedServer=e)}unpinServer(){this._pinnedServer=void 0}}},86493:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.isEmail=void 0;const n=/[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?/;t.isEmail=function(e){return n.test(e)}},86981:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.MongoCryptKMSRequestNetworkTimeoutError=t.MongoCryptAzureKMSRequestError=t.MongoCryptCreateEncryptedCollectionError=t.MongoCryptCreateDataKeyError=t.MongoCryptInvalidArgumentError=t.MongoCryptError=void 0;const r=n(17562);class i extends r.MongoError{constructor(e,t={}){super(e,t)}get name(){return"MongoCryptError"}}t.MongoCryptError=i,t.MongoCryptInvalidArgumentError=class extends i{constructor(e){super(e)}get name(){return"MongoCryptInvalidArgumentError"}},t.MongoCryptCreateDataKeyError=class extends i{constructor(e,{cause:t}){super(`Unable to complete creating data keys: ${t.message}`,{cause:t}),this.encryptedFields=e}get name(){return"MongoCryptCreateDataKeyError"}},t.MongoCryptCreateEncryptedCollectionError=class extends i{constructor(e,{cause:t}){super(`Unable to create collection: ${t.message}`,{cause:t}),this.encryptedFields=e}get name(){return"MongoCryptCreateEncryptedCollectionError"}},t.MongoCryptAzureKMSRequestError=class extends i{constructor(e,t){super(e),this.body=t}get name(){return"MongoCryptAzureKMSRequestError"}},t.MongoCryptKMSRequestNetworkTimeoutError=class extends i{get name(){return"MongoCryptKMSRequestNetworkTimeoutError"}}},87758:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.LEGAL_TCP_SOCKET_OPTIONS=t.LEGAL_TLS_SOCKET_OPTIONS=void 0,t.connect=async function(e){let t=null;try{return t=f(e,await _(e)),await p(t,e),t}catch(e){throw t?.destroy(),e}},t.makeConnection=f,t.performInitialHandshake=p,t.prepareHandshakeDocument=m,t.makeSocket=_;const r=n(26272),i=n(386),o=n(91869),s=n(8500),a=n(17562),u=n(145),c=n(31057),l=n(93065),h=n(71470),d=n(96856);function f(e,t){let n=e.connectionType??h.Connection;return e.autoEncrypter&&(n=h.CryptoConnection),new n(t,e)}async function p(e,t){const n=t.credentials;if(n&&n.mechanism!==l.AuthMechanism.MONGODB_DEFAULT&&!t.authProviders.getOrCreateProvider(n.mechanism,n.mechanismProperties))throw new a.MongoInvalidArgumentError(`AuthMechanism '${n.mechanism}' not supported`);const r=new c.AuthContext(e,n,t);e.authContext=r;const i=await m(r),s={...t,raw:!1};"number"==typeof t.connectTimeoutMS&&(s.socketTimeoutMS=t.connectTimeoutMS);const h=(new Date).getTime(),f=await async function(t,n){try{return await e.command((0,u.ns)("admin.$cmd"),t,n)}catch(e){throw e instanceof a.MongoError&&e.addErrorLabel(a.MongoErrorLabel.HandshakeError),e}}(i,s);"isWritablePrimary"in f||(f.isWritablePrimary=f[o.LEGACY_HELLO_COMMAND]),f.helloOk&&(e.helloOk=!0);const p=function(e,t){const n=Number(e.maxWireVersion),r=Number(e.minWireVersion),i=!Number.isNaN(n)&&n>=d.MIN_SUPPORTED_WIRE_VERSION,o=!Number.isNaN(r)&&r<=d.MAX_SUPPORTED_WIRE_VERSION;if(i){if(o)return null;const n=`Server at ${t.hostAddress} reports minimum wire version ${JSON.stringify(e.minWireVersion)}, but this version of the Node.js Driver requires at most ${d.MAX_SUPPORTED_WIRE_VERSION} (MongoDB ${d.MAX_SUPPORTED_SERVER_VERSION})`;return new a.MongoCompatibilityError(n)}const s=`Server at ${t.hostAddress} reports maximum wire version ${JSON.stringify(e.maxWireVersion)??0}, but this version of the Node.js Driver requires at least ${d.MIN_SUPPORTED_WIRE_VERSION} (MongoDB ${d.MIN_SUPPORTED_SERVER_VERSION})`;return new a.MongoCompatibilityError(s)}(f,t);if(p)throw p;if(t.loadBalanced&&!f.serviceId)throw new a.MongoCompatibilityError("Driver attempted to initialize in load balancing mode, but the server does not support this mode.");if(e.hello=f,e.lastHelloMS=(new Date).getTime()-h,!f.arbiterOnly&&n){r.response=f;const i=n.resolveAuthMechanism(f),o=t.authProviders.getOrCreateProvider(i.mechanism,i.mechanismProperties);if(!o)throw new a.MongoInvalidArgumentError(`No AuthProvider for ${i.mechanism} defined.`);try{await o.auth(r)}catch(t){throw t instanceof a.MongoError&&(t.addErrorLabel(a.MongoErrorLabel.HandshakeError),(0,a.needsRetryableWriteLabel)(t,f.maxWireVersion,e.description.type)&&t.addErrorLabel(a.MongoErrorLabel.RetryableWriteError)),t}}e.established=!0}async function m(e){const t=e.options,n=t.compressors?t.compressors:[],{serverApi:r}=e.connection,i=await t.extendedMetadata,s={[r?.version||!0===t.loadBalanced?"hello":o.LEGACY_HELLO_COMMAND]:1,helloOk:!0,client:i,compression:n};!0===t.loadBalanced&&(s.loadBalanced=!0);const u=e.credentials;if(u){if(u.mechanism===l.AuthMechanism.MONGODB_DEFAULT&&u.username){s.saslSupportedMechs=`${u.source}.${u.username}`;const t=e.options.authProviders.getOrCreateProvider(l.AuthMechanism.MONGODB_SCRAM_SHA256,u.mechanismProperties);if(!t)throw new a.MongoInvalidArgumentError(`No AuthProvider for ${l.AuthMechanism.MONGODB_SCRAM_SHA256} defined.`);return await t.prepare(s,e)}const t=e.options.authProviders.getOrCreateProvider(u.mechanism,u.mechanismProperties);if(!t)throw new a.MongoInvalidArgumentError(`No AuthProvider for ${u.mechanism} defined.`);return await t.prepare(s,e)}return s}function g(e){const n=e.hostAddress;if(!n)throw new a.MongoInvalidArgumentError('Option "hostAddress" is required');const r={};for(const n of t.LEGAL_TCP_SOCKET_OPTIONS)null!=e[n]&&(r[n]=e[n]);if(r.keepAliveInitialDelay??=12e4,r.keepAlive=!0,r.noDelay=e.noDelay??!0,"string"==typeof n.socketPath)return r.path=n.socketPath,r;if("string"==typeof n.host)return r.host=n.host,r.port=n.port,r;throw new a.MongoRuntimeError(`Unexpected HostAddress ${JSON.stringify(n)}`)}async function _(e){const n=e.tls??!1,o=e.connectTimeoutMS??3e4,c=e.existingSocket;let l;if(null!=e.proxyHost)return await async function(e){const t=u.HostAddress.fromHostPort(e.proxyHost??"",e.proxyPort??1080),n=await _({...e,hostAddress:t,tls:!1,proxyHost:void 0}),r=g(e);if("string"!=typeof r.host||"number"!=typeof r.port)throw new a.MongoInvalidArgumentError("Can only make Socks5 connections to TCP hosts");let i;y??=function(){if(null==y){const e=(0,s.getSocks)();if("kModuleError"in e)throw e.kModuleError;y=e}return y}();try{i=(await y.SocksClient.createConnection({existing_socket:n,timeout:e.connectTimeoutMS,command:"connect",destination:{host:r.host,port:r.port},proxy:{host:"iLoveJavaScript",port:0,type:5,userId:e.proxyUsername||void 0,password:e.proxyPassword||void 0}})).socket}catch(e){throw new a.MongoNetworkError(a.MongoError.buildErrorMessage(e),{cause:e})}return await _({...e,existingSocket:i,proxyHost:void 0})}({...e,connectTimeoutMS:o});if(n){const n=i.connect(function(e){const n=g(e);for(const r of t.LEGAL_TLS_SOCKET_OPTIONS)null!=e[r]&&(n[r]=e[r]);return e.existingSocket&&(n.socket=e.existingSocket),null==n.servername&&n.host&&!r.isIP(n.host)&&(n.servername=n.host),n}(e));"function"==typeof n.disableRenegotiation&&n.disableRenegotiation(),l=n}else l=c||r.createConnection(g(e));l.setTimeout(o);let h=null;const{promise:d,resolve:f,reject:p}=(0,u.promiseWithResolvers)();if(c)f(l);else{const t=performance.now(),r=n?"secureConnect":"connect";l.once(r,(()=>f(l))).once("error",(e=>p(new a.MongoNetworkError(a.MongoError.buildErrorMessage(e),{cause:e})))).once("timeout",(()=>{p(new a.MongoNetworkTimeoutError(`Socket '${r}' timed out after ${performance.now()-t|0}ms (connectTimeoutMS: ${o})`))})).once("close",(()=>p(new a.MongoNetworkError(`Socket closed after ${performance.now()-t|0} during connection establishment`)))),null!=e.cancellationToken&&(h=()=>p(new a.MongoNetworkError("Socket connection establishment was cancelled after "+(performance.now()-t|0))),e.cancellationToken.once("cancel",h))}try{return l=await d,l}catch(e){throw l.destroy(),e}finally{l.setTimeout(0),null!=h&&e.cancellationToken?.removeListener("cancel",h)}}t.LEGAL_TLS_SOCKET_OPTIONS=["allowPartialTrustChain","ALPNProtocols","ca","cert","checkServerIdentity","ciphers","crl","ecdhCurve","key","minDHSize","passphrase","pfx","rejectUnauthorized","secureContext","secureProtocol","servername","session"],t.LEGAL_TCP_SOCKET_OPTIONS=["autoSelectFamily","autoSelectFamilyAttemptTimeout","keepAliveInitialDelay","family","hints","localAddress","localPort","lookup"];let y=null},88470:(e,t,n)=>{var r,i,o,s=n(65994).e;i=[t,n(36257),n(77599)],void 0===(o="function"==typeof(r=function(e,t,n){var r,i,o,a,u,c,l,h,d,f,p,m,g,_,y,v,E,S,w,C,O,b,M,T,A,R,N,I,x,k,P,D=Math.imul,$=t.$_$.h1,L=t.$_$.j4,B=t.$_$.a5,j=t.$_$.e3,q=t.$_$.z3,F=t.$_$.b,z=t.$_$.f1,U=t.$_$.k3,V=t.$_$.v2,W=t.$_$.b4,G=t.$_$.w2,H=t.$_$.k4,K=t.$_$.g4,Y=t.$_$.r,Q=t.$_$.i5,J=n.$_$.c,X=n.$_$.b,Z=t.$_$.c4,ee=t.$_$.e4,te=t.$_$.y3,ne=t.$_$.u3,re=n.$_$.a,ie=t.$_$.k,oe=t.$_$.b1,se=t.$_$.d1,ae=(t.$_$.g1,t.$_$.a1),ue=t.$_$.e5,ce=t.$_$.a3,le=t.$_$.e1,he=t.$_$.z2,de=t.$_$.b3,fe=t.$_$.c3,pe=t.$_$.d3,me=t.$_$.w,ge=t.$_$.c5,_e=t.$_$.u4,ye=t.$_$.l3,ve=t.$_$.g5,Ee=t.$_$.x4,Se=t.$_$.c,we=t.$_$.z4,Ce=t.$_$.v,Oe=t.$_$.q3,be=t.$_$.v4,Me=t.$_$.p,Te=t.$_$.i3,Ae=t.$_$.m,Re=t.$_$.h5,Ne=t.$_$.d,Ie=t.$_$.u2,xe=t.$_$.m1,ke=t.$_$.x2,Pe=t.$_$.s,De=t.$_$.j3,$e=t.$_$.g3,Le=t.$_$.f3,Be=t.$_$.h3,je=t.$_$.o3,qe=t.$_$.b5,Fe=t.$_$.y,ze=t.$_$.w4,Ue=t.$_$.q,Ve=t.$_$.f5,We=t.$_$.y2,Ge=t.$_$.a,He=t.$_$.l,Ke=t.$_$.x3,Ye=t.$_$.f,Qe=t.$_$.u,Je=t.$_$.j,Xe=t.$_$.l2,Ze=t.$_$.o1,et=t.$_$.n1,tt=t.$_$.x;function nt(e,t,n){xn.call(this,n),t&&this.mb(e.r6(f)),this.pb_1=e.da(this)}function rt(e,t,n,r){t=t===F?z():t,n=n===F?qt():n;var i=function(e,t){var n=e.qb().da(t);return n!==Or().ck_1&&null==n.r6(le)?n.da(Or().ck_1):n}(e,t),o=n.jd()?new st(i,r):new ot(i,!0);return o.ec(n,o,r),o}function it(e,t){U.call(this,t),this.sd_1=e}function ot(e,t){nt.call(this,e,!0,t)}function st(e,t){ot.call(this,e,!1),this.be_1=G(t,this,this)}function at(e){Et.call(this),this.de_1=e}function ut(e){return e.le_1.kotlinx$atomicfu$value}function ct(e){var t;if(2===e.te_1){var n=e.he_1;t=(n instanceof tr?n:B()).se()}else t=!1;return t}function lt(e,t,n){var r=536870911&e.je_1.kotlinx$atomicfu$value;if(536870911===r)throw Y(H("The index for Segment.onCancellation(..) is broken"));try{t.ve(r,n,e.k6())}catch(t){if(!(t instanceof Error))throw t;var i=t;kt(e.k6(),new Wt("Exception in invokeOnCancellation handler for "+e.toString(),i))}}function ht(e){var t=e.k6().r6(f);if(null==t)return null;var n=t,r=new zn(e),i=n.tc(!0,F,r);return e.le_1.atomicfu$compareAndSet(null,i),i}function dt(e,t,n){var r="It's prohibited to register multiple handlers, tried to register "+H(t)+", already has "+Q(n);throw Y(H(r))}function ft(e,t){if(function(e){for(var t=e.je_1;;){var n=t.kotlinx$atomicfu$value;switch(n>>Ot()){case 0:var r=536870911&n,i=(2<<Ot())+r|0;if(e.je_1.atomicfu$compareAndSet(n,i))return!0;break;case 1:return!1;default:throw Y(H("Already resumed"))}}}(e))return $;!function(e,t){var n=e.lf(),r=4===t;if(!r&&n instanceof tr&&or(t)===or(e.te_1)){var i=n.ne_1,o=n.k6();i.gg(o)?i.hg(o,e):function(e){var t=Vt().wg();if(t.qg())t.pg(e);else{t.sg(!0);try{for(sr(e,e.lf(),!0);t.og(););}catch(t){if(!(t instanceof Error))throw t;var n=t;e.ag(n,null)}finally{t.tg(!0)}}}(e)}else sr(e,n,r)}(e,t)}function pt(e,t,n,r,i,o){return n instanceof bt?n:(or(r)||null!=o)&&(null!=i||t instanceof Et||null!=o)?new wt(n,t instanceof Et?t:null,i,o):n}function mt(e,t,n,r,i){return function(e,t,n,r){for(var i=e.ke_1;;)e:{var o=i.kotlinx$atomicfu$value;if(null!=o&&K(o,vt)){var s=pt(0,o,t,n,r,null);if(!e.ke_1.atomicfu$compareAndSet(o,s))break e;return _t(e),ft(e,n),$}if(o instanceof Mt&&o.jf())return null==r||e.ff(r,o.wb_1),$;gt(0,t)}}(e,t,n,r=r===F?null:r)}function gt(e,t){var n="Already resumed, but proposed with update "+Q(t);throw Y(H(n))}function _t(e){ct(e)||e.kf()}function yt(e,t){ir.call(this,t),this.he_1=e,this.ie_1=this.he_1.k6();var n=536870911+(0<<Ot())|0;this.je_1=J(n),this.ke_1=X(r),this.le_1=X(null)}function vt(){}function Et(){dr.call(this)}function St(){}function wt(e,t,n,r,i){t=t===F?null:t,n=n===F?null:n,r=r===F?null:r,i=i===F?null:i,this.we_1=e,this.xe_1=t,this.ye_1=n,this.ze_1=r,this.af_1=i}function Ct(e){Et.call(this),this.cg_1=e}function Ot(){return i||(i=!0,new ur("RESUME_TOKEN")),29}function bt(e,t){t=t!==F&&t,this.wb_1=e,this.xb_1=re(t)}function Mt(e,t,n){bt.call(this,null==t?ie("Continuation "+H(e)+" was cancelled normally"):t,n),this.if_1=re(!1)}function Tt(e,t){t=t===F?null:t;var n,r=oe(e);if(null==r){var i=se(e),o=null==i||null!=i?i:B();n=null!=t?new At(o,t):o}else n=new bt(r);return n}function At(e,t){this.dg_1=e,this.eg_1=t}function Rt(e,t){var n;if(e instanceof bt){var r=jr(e.wb_1);n=ae(ue(r))}else{var i=null==e||null!=e?e:B();n=ae(i)}return n}function Nt(e){return e instanceof xt?e:null}function It(){o=this;var e=le;ce.call(this,e,Nt)}function xt(){null==o&&new It,he.call(this,le)}function kt(e,t){try{var n=e.r6(a);if(null!=n)return n.jg(e,t),$}catch(n){if(n instanceof Error)return Jn(e,Dt(t,n)),$;throw n}Jn(e,t)}function Pt(){}function Dt(e,t){if(e===t)return e;var n=me("Exception while trying to handle coroutine exception",t);return ge(n,e),n}function $t(){}function Lt(){}function Bt(){if(h)return $;h=!0,c=new jt("DEFAULT",0),l=new jt("LAZY",1),new jt("ATOMIC",2),new jt("UNDISPATCHED",3)}function jt(e,t){_e.call(this,e,t)}function qt(){return Bt(),c}function Ft(e,t){return t?new Ee(0,1):new Ee(1,0)}function zt(){xt.call(this),this.lg_1=new Ee(0,0),this.mg_1=!1,this.ng_1=null}function Ut(){d=this,this.vg_1=(new ur("ThreadLocalEventLoop"),new Fr)}function Vt(){return null==d&&new Ut,d}function Wt(e,t){Ce(e,t,this),Oe(this,Wt)}function Gt(e,t){Me(e,t,this),Oe(this,Gt)}function Ht(){}function Kt(){}function Yt(){}function Qt(){}function Jt(){}function Xt(){return Un(),m}function Zt(){return Un(),g}function en(){return Un(),_}function tn(){return Un(),y}function nn(){return Un(),v}function rn(){return Un(),S}function on(e){this.ah_1=e}function sn(){}function an(){Lr.call(this)}function un(){lr.call(this)}function cn(e,t){e.yh_1.kotlinx$atomicfu$value=t}function ln(e){return e.yh_1.kotlinx$atomicfu$value}function hn(e){return Ne(4)}function dn(e,t,n){var r,i=n instanceof bt?n:null,o=null==i?null:i.wb_1;r=t.zh();var s=t.ai(o),a=function(e,t,n){if(n.p())return t.zh()?new Tr(e.ub(),null,e):null;var r;e:{for(var i=n.j();i.k();){var o=i.l();if(!(o instanceof Ie)){r=o;break e}}r=null}if(null!=r)return r;var s=n.q(0);if(s instanceof Wn){var a;e:{for(var u=n.j();u.k();){var c=u.l();if(c!==s&&c instanceof Wn){a=c;break e}}a=null}if(null!=a)return a}return s}(e,t,s);null!=a&&function(e,t,n){if(n.m()<=1)return $;for(var r=(a=n.m(),Ye(a)),i=t,o=n.j();o.k();){var s=o.l();!(s===t||s===i||s instanceof Ie)&&r.h(s)&&ge(t,s)}var a}(0,a,s);var u=a,c=null==u||u===o?n:new bt(u);return null!=u&&(mn(e,u)||e.ed(u))&&(c instanceof bt?c:B()).ef(),r||e.bd(u),e.vb(c),e.kb_1.atomicfu$compareAndSet(t,kn(c)),fn(e,t,c),c}function fn(e,t,n){var r=e.jc();null==r||(r.fe(),e.ic(p));var i=n instanceof bt?n:null,o=null==i?null:i.wb_1;if(t instanceof un)try{t.invoke(o)}catch(n){if(!(n instanceof Error))throw n;var s=n;e.cc(new Wt("Exception in completion handler "+H(t)+" for "+e.toString(),s))}else{var a=t.bh();null==a||function(e,t,n){for(var r=null,i=e.gh_1;!ne(i,e);){if(i instanceof un){var o=i;try{o.invoke(n)}catch(e){if(!(e instanceof Error))throw e;var s,a=e,u=r;null==u?s=null:(ge(u,a),s=u),null==s&&(r=new Wt("Exception in completion handler "+o.toString()+" for "+t.toString(),a))}}i=i.gh_1}var c=r;null==c||t.cc(c)}(a,e,o)}}function pn(e,t,n){e.bd(n);for(var r=null,i=t.gh_1;!ne(i,t);){if(i instanceof Pn){var o=i;try{o.invoke(n)}catch(t){if(!(t instanceof Error))throw t;var s,a=t,u=r;null==u?s=null:(ge(u,a),s=u),null==s&&(r=new Wt("Exception in completion handler "+o.toString()+" for "+e.toString(),a))}}i=i.gh_1}var c=r;null==c||e.cc(c),mn(e,n)}function mn(e,t){if(e.cd())return!0;var n=t instanceof Ie,r=e.jc();return null===r||r===p?n:r.xc(t)||n}function gn(e,t){return t instanceof on?t.ah_1?0:e.kb_1.atomicfu$compareAndSet(t,rn())?(e.nc(),1):-1:t instanceof Dn?e.kb_1.atomicfu$compareAndSet(t,t.bi_1)?(e.nc(),1):-1:0}function _n(e,t,n,r){var i;return e.kc()===t?(n.nh(r),i=!0):i=!1,i}function yn(e,t){var n=new an,r=t.ah_1?n:new Dn(n);e.kb_1.atomicfu$compareAndSet(t,r)}function vn(e,t){t.uh(new an);var n=t.gh_1;e.kb_1.atomicfu$compareAndSet(t,n)}function En(e,t){return null==t||t instanceof Error?null==t?new Tr(e.ub(),null,e):t:(null!=t&&K(t,Yt)?t:B()).zc()}function Sn(e,t){var n,r=t.bh();if(null==r){var i;if(t instanceof on)i=new an;else{if(!(t instanceof un)){var o="State should have list: "+H(t);throw Y(H(o))}vn(e,t),i=null}n=i}else n=r;return n}function wn(e,t,n){var r=Sn(e,t);if(null==r)return!1;var i=r,o=new An(i,!1,n);return!!e.kb_1.atomicfu$compareAndSet(t,o)&&(pn(e,i,n),!0)}function Cn(e,t,n){return null!=t&&K(t,sn)?!(t instanceof on||t instanceof un)||t instanceof $n||n instanceof bt?function(e,t,n){var r=Sn(e,t);if(null==r)return en();var i=r,o=t instanceof An?t:null,s=null==o?new An(i,!1,null):o,a=null;if(s.ci())return Xt();if(s.gi(!0),s!==t&&!e.kb_1.atomicfu$compareAndSet(t,s))return en();var u=s.zh(),c=n instanceof bt?n:null;null==c||s.ei(c.wb_1);var l=s.fi();null==(a=u?null:l)||pn(e,i,a);var h=function(e,t){var n,r=t instanceof $n?t:null;if(null==r){var i=t.bh();n=null==i?null:Mn(i)}else n=r;return n}(0,t);return null!=h&&bn(e,s,h,n)?Zt():dn(e,s,n)}(e,t,n):function(e,t,n){return!!e.kb_1.atomicfu$compareAndSet(t,kn(n))&&(e.bd(null),e.vb(n),fn(e,t,n),!0)}(e,t,n)?n:en():Xt()}function On(e,t){var n=e instanceof bt?e:null;return null==n?null:n.wb_1}function bn(e,t,n,r){for(var i=e,o=t,s=n,a=r;;){var u=s.li_1,c=new Rn(i,o,s,a);if(u.tc(F,!1,c)!==p)return!0;var l=Mn(s);if(null==l)return!1;s=l}}function Mn(e,t){for(var n=e;n.ih_1;)n=n.hh_1;for(;;)if(!(n=n.gh_1).ih_1){if(n instanceof $n)return n;if(n instanceof an)return null}}function Tn(e,t){return t instanceof An?t.zh()?"Cancelling":t.ci()?"Completing":"Active":null!=t&&K(t,sn)?t.rb()?"Active":"New":t instanceof bt?"Cancelled":"Completed"}function An(e,t,n){qr.call(this),this.vh_1=e,this.wh_1=re(t),this.xh_1=X(n),this.yh_1=X(null)}function Rn(e,t,n,r){un.call(this),this.ri_1=e,this.si_1=t,this.ti_1=n,this.ui_1=r}function Nn(e,t){yt.call(this,e,1),this.bj_1=t}function In(e,t){var n=new Nn(ke(t),e);n.mf();var r=new qn(n);return function(e,t){var n=new at(t);e.ce(n)}(n,e.rc(r)),n.tf()}function xn(e){this.kb_1=X(e?rn():(Un(),E)),this.lb_1=X(null)}function kn(e){return Un(),null!=e&&K(e,sn)?new Fn(e):e}function Pn(){un.call(this)}function Dn(e){this.bi_1=e}function $n(e){Pn.call(this),this.li_1=e}function Ln(e){Pn.call(this),this.hj_1=e,this.ij_1=J(0)}function Bn(e){un.call(this),this.nj_1=e}function jn(e){Un();var t=e instanceof Fn?e:null,n=null==t?null:t.oj_1;return null==n?e:n}function qn(e){un.call(this),this.tj_1=e}function Fn(e){this.oj_1=e}function zn(e){Pn.call(this),this.yj_1=e}function Un(){w||(w=!0,m=new ur("COMPLETING_ALREADY"),g=new ur("COMPLETING_WAITING_CHILDREN"),_=new ur("COMPLETING_RETRY"),y=new ur("TOO_LATE_TO_CANCEL"),v=new ur("SEALED"),E=new on(!1),S=new on(!0))}function Vn(){xt.call(this)}function Wn(){}function Gn(){C=this,xt.call(this)}function Hn(){}function Kn(){}function Yn(){}function Qn(){}function Jn(e,t){for(var n=(xr(),xr(),x).j();n.k();){var r=n.l();try{r.jg(e,t)}catch(e){if(e instanceof Xn)return $;if(!(e instanceof Error))throw e;wr(Dt(t,e))}}try{ge(t,new Ir(e))}catch(e){if(!(e instanceof Error))throw e}wr(t)}function Xn(){}function Zn(){return rr(),b}function er(){return rr(),M}function tr(e,t){ir.call(this,-1),this.ne_1=e,this.oe_1=t,this.pe_1=Zn(),this.qe_1=(this.k6(),0),this.re_1=X(null)}function nr(e,t,n){var r;if(n=n===F?null:n,rr(),e instanceof tr){var i,o=Tt(t,n);if(e.ne_1.gg(e.k6()))e.pe_1=o,e.te_1=1,e.ne_1.hg(e.k6(),e),i=$;else{var s=Vt().wg();if(s.qg())e.pe_1=o,e.te_1=1,s.pg(e);else{s.sg(!0);try{var a,u=e.k6().r6(f);if(null==u||u.rb())a=!1;else{var c=u.oc();e.of(o,c);var l=ae(ue(c));e.p6(l),a=!0}for(a||(e.oe_1,e.qe_1,e.oe_1.p6(t));s.og(););}catch(t){if(!(t instanceof Error))throw t;var h=t;e.ag(h,null)}finally{s.tg(!0)}}i=$}r=i}else e.p6(t),r=$;return r}function rr(){T||(T=!0,b=new ur("UNDEFINED"),M=new ur("REUSABLE_CLAIMED"))}function ir(e){Rr.call(this),this.te_1=e}function or(e){return 1===e||2===e}function sr(e,t,n){var r,i=e.nf(),o=e.xf(i);if(null!=o)r=ae(ue(o));else{var s=e.vf(i);r=ae(s)}var a=r;if(n){var u=t instanceof tr?t:B();u.oe_1,u.qe_1,u.oe_1.p6(a)}else t.p6(a)}function ar(e,t){nt.call(this,e,!0,!0),this.ok_1=t}function ur(e){this.pk_1=e}function cr(e,t){return function(e,t){var n=ae(ue(t));throw e.p6(n),t}(e,t)}function lr(){Br.call(this)}function hr(e,t){"function"==typeof e?e(t):e.invoke(t)}function dr(){}function fr(e){return H(e)}function pr(){return"undefined"!=typeof navigator&&null!=navigator&&null!=navigator.userAgent&&void 0!==navigator.userAgent&&void 0!==navigator.userAgent.match&&navigator.userAgent.match("\\bjsdom\\b")?vr():"undefined"!=typeof window&&null!=window&&void 0!==window.addEventListener?function(e){var t,n=e.coroutineDispatcher;if(null==n){var r=new $r(e);e.coroutineDispatcher=r,t=r}else t=n;return t}(window):void 0===s||void 0===s.nextTick?(null==P&&new kr,P):vr()}function mr(){return R}function gr(e){var t=Ge(e).i7();return null==t?"Unknown":t}function _r(e){var t=e.__debug_counter;return"number"!=typeof t&&(t=A=A+1|0,e.__debug_counter=t),(null!=t&&"number"==typeof t?t:B()).toString()}function yr(){N=this,Pr.call(this)}function vr(){return null==N&&new yr,N}function Er(e){var t;Dr.call(this),this.wk_1=e,this.xk_1=(t=this,function(){return t.dl(),$})}function Sr(e){var t;Dr.call(this),this.rl_1=e,this.sl_1="dispatchCoroutine",this.rl_1.addEventListener("message",(t=this,function(e){return e.source==t.rl_1&&e.data==t.sl_1&&(e.stopPropagation(),t.dl()),$}),!0)}function wr(e){console.error(e.toString())}function Cr(){I=this,this.ck_1=pr(),this.dk_1=(null==C&&new Gn,C),this.ek_1=new br(this.ck_1,!1),this.fk_1=null}function Or(){return null==I&&new Cr,I}function br(e,t){Vn.call(this),this.ul_1=e,this.vl_1=t,this.wl_1=this.vl_1?this:new br(this.ul_1,!0)}function Mr(){zt.call(this)}function Tr(e,t,n){He(e,t,this),Oe(this,Tr),this.bm_1=n}function Ar(){}function Rr(){}function Nr(){}function Ir(e){Qe(H(e),this),Oe(this,Ir)}function xr(){k||(k=!0,x=Je())}function kr(){P=this,Pr.call(this)}function Pr(){xt.call(this),this.zk_1=new Er(this)}function Dr(){this.al_1=Se(),this.bl_1=16,this.cl_1=!1}function $r(e){xt.call(this),this.fm_1=e,this.gm_1=new Sr(this.fm_1)}function Lr(){Br.call(this)}function Br(){this.gh_1=this,this.hh_1=this,this.ih_1=!1}function jr(e,t){return e}function qr(){}function Fr(){this.xg_1=null}return Z(Kt,"Job",F,F,[Te],[0]),Z(Yt,"ParentJob",F,F,[Kt],[0]),q(xn,"JobSupport",F,F,[Kt,Yt],[0]),Z($t,"CoroutineScope"),q(nt,"AbstractCoroutine",F,xn,[xn,Kt,j,$t],[0]),W(it,U),q(ot,"DeferredCoroutine",F,nt,[nt,Kt],[0]),q(st,"LazyDeferredCoroutine",F,ot,F,[0]),q(dr,"CancelHandlerBase"),Z(vt,"NotCompleted"),q(Et,"CancelHandler",F,dr,[dr,vt]),q(at,"DisposeOnCancel",F,Et),Z(Ar,"Runnable"),q(Rr,"SchedulerTask",F,F,[Ar]),q(ir,"DispatchedTask",F,Rr),q(yt,"CancellableContinuationImpl",F,ir,[ir,j]),ee(St,"Active",F,F,[vt]),q(wt,"CompletedContinuation"),q(Ct,"InvokeOnCancel",F,Et),q(bt,"CompletedExceptionally"),q(Mt,"CancelledContinuation",F,bt),q(At,"CompletedWithCancellation"),ee(It,"Key",F,ce),q(xt,"CoroutineDispatcher",F,he,[he,pe]),ee(Pt,"Key"),ee(Lt,"GlobalScope",F,F,[$t]),q(jt,"CoroutineStart",F,_e),q(zt,"EventLoop",F,xt),ee(Ut,"ThreadLocalEventLoop"),q(Wt,"CompletionHandlerException",F,we),q(Gt,"CoroutinesInternalError",F,be),ee(Ht,"Key"),Z(Qt,"ChildHandle"),ee(Jt,"NonDisposableHandle",F,F,[Qt]),Z(sn,"Incomplete"),q(on,"Empty",F,F,[sn]),q(Br,"LinkedListNode",Br),q(Lr,"LinkedListHead",Lr,Br),q(an,"NodeList",an,Lr,[Lr,sn]),q(lr,"CompletionHandlerBase",F,Br),q(un,"JobNode",F,lr,[lr,sn]),q(qr,"SynchronizedObject",qr),q(An,"Finishing",F,qr,[qr,sn]),q(Rn,"ChildCompletion",F,un),q(Nn,"AwaitContinuation",F,yt),q(Pn,"JobCancellingNode",F,un),q(Dn,"InactiveNodeList",F,F,[sn]),q($n,"ChildHandleNode",F,Pn,[Pn,Qt]),q(Ln,"InvokeOnCancelling",F,Pn),q(Bn,"InvokeOnCompletion",F,un),q(qn,"ResumeAwaitOnCompletion",F,un),q(Fn,"IncompleteStateBox"),q(zn,"ChildContinuation",F,Pn),q(Vn,"MainCoroutineDispatcher",F,xt),q(Wn,"TimeoutCancellationException",F,Ie),ee(Gn,"Unconfined",F,xt),ee(Hn,"Key"),q(Kn,"OpDescriptor"),q(Qn,"ConcurrentLinkedListNode"),q(Yn,"Segment",F,Qn,[Qn,vt]),ee(Xn,"ExceptionSuccessfullyProcessed",F,ze),q(tr,"DispatchedContinuation",F,ir,[ir,j]),q(ar,"ScopeCoroutine",F,nt,F,[0]),q(ur,"Symbol"),q(Pr,"SetTimeoutBasedDispatcher",F,xt,F,[1]),ee(yr,"NodeDispatcher",F,Pr,F,[1]),q(Dr,"MessageQueue",F,F,[Ze,et]),q(Er,"ScheduledMessageQueue",F,Dr),q(Sr,"WindowMessageQueue",F,Dr),ee(Cr,"Dispatchers"),q(br,"JsMainDispatcher",F,Vn),q(Mr,"UnconfinedEventLoop",Mr,zt),q(Tr,"JobCancellationException",F,Ie),ee(Nr,"TaskContext"),q(Ir,"DiagnosticCoroutineContextException",F,we),ee(kr,"SetTimeoutDispatcher",F,Pr,F,[1]),q($r,"WindowDispatcher",F,xt,F,[1]),q(Fr,"CommonThreadLocal",Fr),L(nt).k6=function(){return this.pb_1},L(nt).qb=function(){return this.pb_1},L(nt).rb=function(){return L(xn).rb.call(this)},L(nt).sb=function(e){},L(nt).tb=function(e,t){},L(nt).ub=function(){return gr(this)+" was cancelled"},L(nt).vb=function(e){e instanceof bt?this.tb(e.wb_1,e.yb()):this.sb(null==e||null!=e?e:B())},L(nt).p6=function(e){var t=this.zb(Tt(e));if(t===Zt())return $;this.ac(t)},L(nt).ac=function(e){return this.bc(e)},L(nt).cc=function(e){kt(this.pb_1,e)},L(nt).dc=function(){var e=(this.pb_1,null);return null==e?L(xn).dc.call(this):'"'+e+'":'+L(xn).dc.call(this)},L(nt).ec=function(e,t,n){e.hc(n,t,this)},L(it).m6=function(){var e=this.g6_1;e:for(;;)try{switch(this.e6_1){case 0:if(this.f6_1=2,this.e6_1=1,(e=this.sd_1.id(this))===V())return e;continue e;case 1:return null==e||null!=e?e:B();case 2:throw this.h6_1}}catch(e){var t=e;if(2===this.f6_1)throw t;this.e6_1=this.f6_1,this.h6_1=t}},L(ot).wd=function(){var e=this.hd();return null==e||null!=e?e:B()},L(ot).xd=function(e){var t=new it(this,e);return t.g6_1=$,t.h6_1=null,t.m6()},L(st).nc=function(){!function(e,t){var n;try{nr(ke(e),ae($)),n=$}catch(e){if(!(e instanceof Error))throw e;cr(t,e),n=$}}(this.be_1,this)},L(at).ee=function(e){return this.de_1.fe()},L(at).invoke=function(e){return this.ee(e)},L(at).toString=function(){return"DisposeOnCancel["+H(this.de_1)+"]"},L(yt).lf=function(){return this.he_1},L(yt).k6=function(){return this.ie_1},L(yt).kc=function(){return this.ke_1.kotlinx$atomicfu$value},L(yt).lc=function(){var e=this.kc();return!(null!=e&&K(e,vt))},L(yt).mf=function(){var e=ht(this);if(null==e)return $;var t=e;this.lc()&&(t.fe(),this.le_1.kotlinx$atomicfu$value=p)},L(yt).nf=function(){return this.kc()},L(yt).of=function(e,t){for(var n=this.ke_1;;){var r=n.kotlinx$atomicfu$value;if(null!=r&&K(r,vt))throw Y(H("Not completed"));if(r instanceof bt)return $;if(r instanceof wt){if(r.cf())throw Y(H("Must be called at most once"));var i=r.df(F,F,F,F,t);if(this.ke_1.atomicfu$compareAndSet(r,i))return r.pf(this,t),$}else if(this.ke_1.atomicfu$compareAndSet(r,new wt(r,F,F,F,t)))return $}return $},L(yt).qf=function(e){for(var t=this.ke_1;;){var n=t.kotlinx$atomicfu$value;if(null==n||!K(n,vt))return!1;var r=new Mt(this,e,n instanceof Et||n instanceof Yn);if(this.ke_1.atomicfu$compareAndSet(n,r))return n instanceof Et?this.bf(n,e):n instanceof Yn&&lt(this,n,e),_t(this),ft(this,this.te_1),!0}},L(yt).rf=function(e){if(function(e,t){if(!ct(e))return!1;var n=e.he_1;return(n instanceof tr?n:B()).ue(t)}(this,e))return $;this.qf(e),_t(this)},L(yt).bf=function(e,t){var n;try{e.invoke(t),n=$}catch(e){if(!(e instanceof Error))throw e;var r=e;kt(this.k6(),new Wt("Exception in invokeOnCancellation handler for "+this.toString(),r)),n=$}return n},L(yt).ff=function(e,t){try{e(t)}catch(e){if(!(e instanceof Error))throw e;var n=e;kt(this.k6(),new Wt("Exception in resume onCancellation handler for "+this.toString(),n))}},L(yt).sf=function(e){return e.oc()},L(yt).tf=function(){var e=ct(this);if(function(e){for(var t=e.je_1;;){var n=t.kotlinx$atomicfu$value;switch(n>>Ot()){case 0:var r=536870911&n,i=(1<<Ot())+r|0;if(e.je_1.atomicfu$compareAndSet(n,i))return!0;break;case 2:return!1;default:throw Y(H("Already suspended"))}}}(this))return null==ut(this)&&ht(this),e&&this.uf(),V();e&&this.uf();var t=this.kc();if(t instanceof bt)throw jr(t.wb_1);if(or(this.te_1)){var n=this.k6().r6(f);if(null!=n&&!n.rb()){var r=n.oc();throw this.of(t,r),jr(r)}}return this.vf(t)},L(yt).uf=function(){var e=this.he_1,t=e instanceof tr?e:null,n=null==t?null:t.wf(this);if(null==n)return $;var r=n;this.kf(),this.qf(r)},L(yt).p6=function(e){return mt(this,function(e){var t,n=oe(e);if(null==n){var r=se(e);t=null==r||null!=r?r:B()}else t=new bt(jr(n));return t}(e),this.te_1)},L(yt).ce=function(e){!function(e,t){for(var n=e.ke_1;;){var r=n.kotlinx$atomicfu$value;if(r instanceof St){if(e.ke_1.atomicfu$compareAndSet(r,t))return $}else if(r instanceof Et||r instanceof Yn)dt(0,t,r);else{if(r instanceof bt){if(r.ef()||dt(0,t,r),r instanceof Mt){var i=r instanceof bt?r:null,o=null==i?null:i.wb_1;t instanceof Et?e.bf(t,o):lt(e,t instanceof Yn?t:B(),o)}return $}if(r instanceof wt){if(null!=r.xe_1&&dt(0,t,r),t instanceof Yn)return $;if(t instanceof Et||B(),r.cf())return e.bf(t,r.af_1),$;var s=r.df(F,t);if(e.ke_1.atomicfu$compareAndSet(r,s))return $}else{if(t instanceof Yn)return $;t instanceof Et||B();var a=new wt(r,t);if(e.ke_1.atomicfu$compareAndSet(r,a))return $}}}}(this,function(e,t){return t instanceof Et?t:new Ct(t)}(0,e))},L(yt).kf=function(){var e=ut(this);if(null==e)return $;e.fe(),this.le_1.kotlinx$atomicfu$value=p},L(yt).vf=function(e){var t;if(e instanceof wt){var n=e.we_1;t=null==n||null!=n?n:B()}else t=null==e||null!=e?e:B();return t},L(yt).xf=function(e){var t=L(ir).xf.call(this,e);return null==t?null:jr(t,this.he_1)},L(yt).toString=function(){return this.yf()+"("+fr(this.he_1)+"){"+((null!=(e=this.kc())&&K(e,vt)?"Active":e instanceof Mt?"Cancelled":"Completed")+"}@")+_r(this);var e},L(yt).yf=function(){return"CancellableContinuation"},L(St).toString=function(){return"Active"},L(wt).cf=function(){return!(null==this.af_1)},L(wt).pf=function(e,t){var n=this.xe_1;null==n||e.bf(n,t);var r=this.ye_1;null==r||e.ff(r,t)},L(wt).bg=function(e,t,n,r,i){return new wt(e,t,n,r,i)},L(wt).df=function(e,t,n,r,i,o){return e=e===F?this.we_1:e,t=t===F?this.xe_1:t,n=n===F?this.ye_1:n,r=r===F?this.ze_1:r,i=i===F?this.af_1:i,o===F?this.bg(e,t,n,r,i):o.bg.call(this,e,t,n,r,i)},L(wt).toString=function(){return"CompletedContinuation(result="+Q(this.we_1)+", cancelHandler="+Q(this.xe_1)+", onCancellation="+Q(this.ye_1)+", idempotentResume="+Q(this.ze_1)+", cancelCause="+Q(this.af_1)+")"},L(wt).hashCode=function(){var e=null==this.we_1?0:te(this.we_1);return e=D(e,31)+(null==this.xe_1?0:te(this.xe_1))|0,e=D(e,31)+(null==this.ye_1?0:te(this.ye_1))|0,e=D(e,31)+(null==this.ze_1?0:te(this.ze_1))|0,D(e,31)+(null==this.af_1?0:te(this.af_1))|0},L(wt).equals=function(e){if(this===e)return!0;if(!(e instanceof wt))return!1;var t=e instanceof wt?e:B();return!!(ne(this.we_1,t.we_1)&&ne(this.xe_1,t.xe_1)&&ne(this.ye_1,t.ye_1)&&ne(this.ze_1,t.ze_1)&&ne(this.af_1,t.af_1))},L(Ct).ee=function(e){this.cg_1(e)},L(Ct).invoke=function(e){return this.ee(e)},L(Ct).toString=function(){return"InvokeOnCancel["+gr(this.cg_1)+"@"+_r(this)+"]"},L(bt).yb=function(){return this.xb_1.kotlinx$atomicfu$value},L(bt).ef=function(){return this.xb_1.atomicfu$compareAndSet(!1,!0)},L(bt).toString=function(){return gr(this)+"["+this.wb_1.toString()+"]"},L(Mt).jf=function(){return this.if_1.atomicfu$compareAndSet(!1,!0)},L(At).toString=function(){return"CompletedWithCancellation(result="+Q(this.dg_1)+", onCancellation="+H(this.eg_1)+")"},L(At).hashCode=function(){var e=null==this.dg_1?0:te(this.dg_1);return D(e,31)+te(this.eg_1)|0},L(At).equals=function(e){if(this===e)return!0;if(!(e instanceof At))return!1;var t=e instanceof At?e:B();return!!ne(this.dg_1,t.dg_1)&&!!ne(this.eg_1,t.eg_1)},L(xt).gg=function(e){return!0},L(xt).s6=function(e){return new tr(this,e)},L(xt).t6=function(e){(e instanceof tr?e:B()).ig()},L(xt).toString=function(){return gr(this)+"@"+_r(this)},L(Lt).qb=function(){return z()},L(jt).hc=function(e,t,n){var r;switch(this.j1_1){case 0:(function(e,t,n,r){var i;r=r===F?null:r;try{nr(ke(G(e,t,n)),ae($),r),i=$}catch(e){if(!(e instanceof Error))throw e;cr(n,e),i=$}})(e,t,n),r=$;break;case 2:ye(e,t,n),r=$;break;case 3:(function(e,t,n){e:{var r,i=n;try{n.k6(),r=We(e,t,i)}catch(e){if(e instanceof Error){var o=ae(ue(e));i.p6(o);break e}throw e}var s=r;if(s!==V()){var a=null==s||null!=s?s:B(),u=ae(a);i.p6(u)}}})(e,t,n),r=$;break;case 1:r=$;break;default:ve()}return r},L(jt).jd=function(){return this===(Bt(),l)},L(zt).og=function(){var e=this.ng_1;if(null==e)return!1;var t=e.d9();return null!=t&&(t.zf(),!0)},L(zt).pg=function(e){var t,n=this.ng_1;if(null==n){var r=Se();this.ng_1=r,t=r}else t=n;t.b9(e)},L(zt).qg=function(){return this.lg_1.r1(Ft(0,!0))>=0},L(zt).rg=function(){var e=this.ng_1,t=null==e?null:e.p();return null==t||t},L(zt).sg=function(e){this.lg_1=this.lg_1.s1(Ft(0,e)),e||(this.mg_1=!0)},L(zt).tg=function(e){if(this.lg_1=this.lg_1.t1(Ft(0,e)),this.lg_1.r1(new Ee(0,0))>0)return $;this.mg_1&&this.ug()},L(zt).ug=function(){},L(Ut).wg=function(){var e,t=this.vg_1.yg();if(null==t){var n=new Mr;Vt().vg_1.zg(n),e=n}else e=t;return e},L(Jt).fe=function(){},L(Jt).xc=function(e){return!1},L(Jt).toString=function(){return"NonDisposableHandle"},L(on).rb=function(){return this.ah_1},L(on).bh=function(){return null},L(on).toString=function(){return"Empty{"+(this.ah_1?"Active":"New")+"}"},L(an).rb=function(){return!0},L(an).bh=function(){return this},L(an).fh=function(e){var t=Ae();t.q5("List{"),t.q5(e),t.q5("}[");for(var n=!0,r=this.gh_1;!ne(r,this);){if(r instanceof un){var i=r;n?n=!1:t.q5(", "),t.p5(i)}r=r.gh_1}return t.q5("]"),t.toString()},L(an).toString=function(){return mr()?this.fh("Active"):L(Lr).toString.call(this)},L(un).th=function(){var e=this.sh_1;if(null!=e)return e;Re("job")},L(un).rb=function(){return!0},L(un).bh=function(){return null},L(un).fe=function(){return this.th().uc(this)},L(un).toString=function(){return gr(this)+"@"+_r(this)+"[job@"+_r(this.th())+"]"},L(An).bh=function(){return this.vh_1},L(An).gi=function(e){this.wh_1.kotlinx$atomicfu$value=e},L(An).ci=function(){return this.wh_1.kotlinx$atomicfu$value},L(An).mi=function(e){this.xh_1.kotlinx$atomicfu$value=e},L(An).fi=function(){return this.xh_1.kotlinx$atomicfu$value},L(An).di=function(){return ln(this)===nn()},L(An).zh=function(){return!(null==this.fi())},L(An).rb=function(){return null==this.fi()},L(An).ai=function(e){var t,n=ln(this);if(null==n)t=hn();else if(n instanceof Error){var r=hn();r.h(n),t=r}else{if(!(n instanceof xe)){var i="State is "+Q(n);throw Y(H(i))}t=n instanceof xe?n:B()}var o=t,s=this.fi();return null==s||o.o2(0,s),null==e||ne(e,s)||o.h(e),cn(this,nn()),o},L(An).ei=function(e){var t=this.fi();if(null==t)return this.mi(e),$;if(e===t)return $;var n=ln(this);if(null==n)cn(this,e);else if(n instanceof Error){if(e===n)return $;var r=hn();r.h(n),r.h(e),cn(this,r)}else{if(!(n instanceof xe)){var i="State is "+Q(n);throw Y(H(i))}(n instanceof xe?n:B()).h(e)}},L(An).toString=function(){return"Finishing[cancelling="+this.zh()+", completing="+this.ci()+", rootCause="+Q(this.fi())+", exceptions="+Q(ln(this))+", list="+this.vh_1.toString()+"]"},L(Rn).ee=function(e){!function(e,t,n,r){var i=Mn(n);if(null!=i&&bn(e,t,i,r))return $;var o=dn(e,t,r);e.bc(o)}(this.ri_1,this.si_1,this.ti_1,this.ui_1)},L(Rn).invoke=function(e){return this.ee(e)},L(Nn).sf=function(e){var t=this.bj_1.kc();if(t instanceof An){var n=t.fi();if(null!=n)return n}return t instanceof bt?t.wb_1:e.oc()},L(Nn).yf=function(){return"AwaitContinuation"},L(xn).b1=function(){return f},L(xn).ic=function(e){this.lb_1.kotlinx$atomicfu$value=e},L(xn).jc=function(){return this.lb_1.kotlinx$atomicfu$value},L(xn).mb=function(e){if(null==e)return this.ic(p),$;e.mc();var t=e.ad(this);this.ic(t),this.lc()&&(t.fe(),this.ic(p))},L(xn).kc=function(){for(var e=this.kb_1;;){var t=e.kotlinx$atomicfu$value;if(!(t instanceof Kn))return t;t.cj(this)}},L(xn).rb=function(){var e=this.kc();return!(null==e||!K(e,sn))&&e.rb()},L(xn).lc=function(){var e=this.kc();return!(null!=e&&K(e,sn))},L(xn).mc=function(){for(;;){var e=gn(this,this.kc());if(0===e)return!1;if(1===e)return!0}},L(xn).nc=function(){},L(xn).oc=function(){var e,t=this.kc();if(t instanceof An){var n=t.fi(),r=null==n?null:this.pc(n,gr(this)+" is cancelling");if(null==r){var i="Job is still new or active: "+this.toString();throw Y(H(i))}e=r}else{if(null!=t&&K(t,sn)){var o="Job is still new or active: "+this.toString();throw Y(H(o))}e=t instanceof bt?this.qc(t.wb_1):new Tr(gr(this)+" has completed normally",null,this)}return e},L(xn).pc=function(e,t){var n=e instanceof Ie?e:null;return null==n?new Tr(null==t?this.ub():t,e,this):n},L(xn).qc=function(e,t,n){return t=t===F?null:t,n===F?this.pc(e,t):n.pc.call(this,e,t)},L(xn).rc=function(e){return this.sc(!1,!0,e)},L(xn).sc=function(e,t,n){for(var r=function(e,t,n){var r;if(n){var i=t instanceof Pn?t:null;r=null==i?new Ln(t):i}else{var o=t instanceof un?t:null,s=null==o?null:o;r=null==s?new Bn(t):s}var a=r;return a.sh_1=e,a}(this,n,e);;)e:{var i=this.kc();if(i instanceof on)if(i.ah_1){if(this.kb_1.atomicfu$compareAndSet(i,r))return r}else yn(this,i);else{if(null==i||!K(i,sn)){if(t){var o=i instanceof bt?i:null;hr(n,null==o?null:o.wb_1)}return p}var s=i.bh();if(null==s)vn(this,i instanceof un?i:B());else{var a=null,u=p;if(e&&i instanceof An&&(null==(a=i.fi())||n instanceof $n&&!i.ci())){if(!_n(this,i,s,r))break e;if(null==a)return r;u=r}if(null!=a)return t&&hr(n,a),u;if(_n(this,i,s,r))return r}}}},L(xn).uc=function(e){for(;;){var t=this.kc();if(!(t instanceof un))return null!=t&&K(t,sn)?(null!=t.bh()&&e.mh(),$):$;if(t!==e)return $;if(this.kb_1.atomicfu$compareAndSet(t,rn()))return $}},L(xn).vc=function(){return!1},L(xn).ub=function(){return"Job was cancelled"},L(xn).wc=function(e){this.yc(e)},L(xn).xc=function(e){return e instanceof Ie||this.yc(e)&&this.dd()},L(xn).yc=function(e){var t,n=Xt();return!(!this.vc()||(n=function(e,t){for(;;){var n=e.kc();if(null==n||!K(n,sn)||n instanceof An&&n.ci())return Xt();var r=Cn(e,n,new bt(En(e,t)));if(r!==en())return r}}(this,e))!==Zt())||(n===Xt()&&(n=function(e,t){for(var n=null;;)e:{var r=e.kc();if(r instanceof An){if(r.di())return tn();var i=r.zh();if(null!=t||!i){var o,s=n;if(null==s){var a=En(e,t);n=a,o=a}else o=s;var u=o;r.ei(u)}var c=r.fi(),l=i?null:c;return null==l||pn(e,r.vh_1,l),Xt()}if(null==r||!K(r,sn))return tn();var h,d=n;if(null==d){var f=En(e,t);n=f,h=f}else h=d;var p=h;if(!r.rb()){var m=Cn(e,r,new bt(p));if(m===Xt()){var g="Cannot happen in "+Q(r);throw Y(H(g))}if(m===en())break e;return m}if(wn(e,r,p))return Xt()}}(this,e)),n===Xt()||n===Zt()?t=!0:n===tn()?t=!1:(this.bc(n),t=!0),t)},L(xn).zc=function(){var e,t=this.kc();if(t instanceof An)e=t.fi();else if(t instanceof bt)e=t.wb_1;else{if(null!=t&&K(t,sn)){var n="Cannot be cancelling child in this state: "+Q(t);throw Y(H(n))}e=null}var r=e,i=r instanceof Ie?r:null;return null==i?new Tr("Parent job is "+Tn(0,t),r,this):i},L(xn).zb=function(e){for(;;){var t=Cn(this,this.kc(),e);if(t===Xt())throw Pe("Job "+this.toString()+" is already complete or completing, but is being completed with "+Q(e),On(e));if(t!==en())return t}},L(xn).ad=function(e){var t=new $n(e),n=this.tc(!0,F,t);return K(n,Qt)?n:B()},L(xn).cc=function(e){throw e},L(xn).bd=function(e){},L(xn).cd=function(){return!1},L(xn).dd=function(){return!0},L(xn).ed=function(e){return!1},L(xn).vb=function(e){},L(xn).bc=function(e){},L(xn).toString=function(){return this.fd()+"@"+_r(this)},L(xn).fd=function(){return this.dc()+"{"+Tn(0,this.kc())+"}"},L(xn).dc=function(){return gr(this)},L(xn).gd=function(){var e=this.kc();if(null!=e&&K(e,sn))throw Y(H("This job has not completed yet"));return On(e)},L(xn).hd=function(){var e=this.kc();if(null!=e&&K(e,sn))throw Y(H("This job has not completed yet"));if(e instanceof bt)throw e.wb_1;return jn(e)},L(xn).id=function(e){e:for(;;){var t=this.kc();if(null==t||!K(t,sn)){if(t instanceof bt)throw t.wb_1;return jn(t)}if(gn(this,t)>=0)break e}return In(this,e)},L(Dn).bh=function(){return this.bi_1},L(Dn).rb=function(){return!1},L(Dn).toString=function(){return mr()?this.bi_1.fh("New"):je(this)},L($n).ee=function(e){return this.li_1.wc(this.th())},L($n).invoke=function(e){return this.ee(e)},L($n).xc=function(e){return this.th().xc(e)},L(Ln).ee=function(e){this.ij_1.atomicfu$compareAndSet(0,1)&&this.hj_1(e)},L(Ln).invoke=function(e){return this.ee(e)},L(Bn).ee=function(e){return this.nj_1(e)},L(Bn).invoke=function(e){return this.ee(e)},L(qn).ee=function(e){var t=this.th().kc();if(t instanceof bt){var n=this.tj_1,r=t.wb_1,i=ae(ue(r));n.p6(i)}else{var o=this.tj_1,s=jn(t),a=null==s||null!=s?s:B(),u=ae(a);o.p6(u)}},L(qn).invoke=function(e){return this.ee(e)},L(zn).ee=function(e){this.yj_1.rf(this.yj_1.sf(this.th()))},L(zn).invoke=function(e){return this.ee(e)},L(Vn).toString=function(){var e=this.bk();return null==e?gr(this)+"@"+_r(this):e},L(Vn).bk=function(){var e,t=Or().gk();if(this===t)return"Dispatchers.Main";try{e=t.ak()}catch(t){if(!(t instanceof qe))throw t;e=null}return this===e?"Dispatchers.Main.immediate":null},L(Gn).gg=function(e){return!1},L(Gn).hg=function(e,t){var n=e.r6(O);if(null!=n)return n.jk_1=!0,$;throw Fe("Dispatchers.Unconfined.dispatch function can only be used by the yield function. If you wrap Unconfined dispatcher in your code, make sure you properly delegate isDispatchNeeded and dispatch calls.")},L(Gn).toString=function(){return"Dispatchers.Unconfined"},L(tr).k6=function(){return this.oe_1.k6()},L(tr).se=function(){return!(null==this.re_1.kotlinx$atomicfu$value)},L(tr).kk=function(){for(var e=this.re_1;;)if(e.kotlinx$atomicfu$value!==er())return $},L(tr).ig=function(){this.kk();var e,t=(e=this.re_1.kotlinx$atomicfu$value)instanceof yt?e:null;null==t||t.kf()},L(tr).wf=function(e){for(var t=this.re_1;;){var n=t.kotlinx$atomicfu$value;if(n!==er()){if(n instanceof Error){if(!this.re_1.atomicfu$compareAndSet(n,null))throw Ue(H("Failed requirement."));return n}var r="Inconsistent state "+Q(n);throw Y(H(r))}if(this.re_1.atomicfu$compareAndSet(er(),e))return null}},L(tr).ue=function(e){for(var t=this.re_1;;){var n=t.kotlinx$atomicfu$value;if(ne(n,er())){if(this.re_1.atomicfu$compareAndSet(er(),e))return!0}else{if(n instanceof Error)return!0;if(this.re_1.atomicfu$compareAndSet(n,null))return!1}}},L(tr).nf=function(){var e=this.pe_1;return this.pe_1=Zn(),e},L(tr).lf=function(){return this},L(tr).p6=function(e){var t=this.oe_1.k6(),n=Tt(e);if(this.ne_1.gg(t))this.pe_1=n,this.te_1=0,this.ne_1.hg(t,this);else{var r=Vt().wg();if(r.qg())this.pe_1=n,this.te_1=0,r.pg(this);else{r.sg(!0);try{for(this.k6(),this.qe_1,this.oe_1.p6(e);r.og(););}catch(e){if(!(e instanceof Error))throw e;var i=e;this.ag(i,null)}finally{r.tg(!0)}}}},L(tr).of=function(e,t){e instanceof At&&e.eg_1(t)},L(tr).toString=function(){return"DispatchedContinuation["+this.ne_1.toString()+", "+fr(this.oe_1)+"]"},L(ir).of=function(e,t){},L(ir).vf=function(e){return null==e||null!=e?e:B()},L(ir).xf=function(e){var t=e instanceof bt?e:null;return null==t?null:t.wb_1},L(ir).zf=function(){var e=null;try{var t=this.lf(),n=t instanceof tr?t:B(),r=n.oe_1;n.qe_1;var i=r.k6(),o=this.nf(),s=this.xf(o),a=null==s&&or(this.te_1)?i.r6(f):null;if(null==a||a.rb())if(null!=s){var u=ae(ue(s));r.p6(u)}else{var c=this.vf(o),l=ae(c);r.p6(l)}else{var h=a.oc();this.of(o,h);var d=jr(h),p=ae(ue(d));r.p6(p)}}catch(t){if(!(t instanceof Error))throw t;e=t}finally{var m;try{m=ae($)}catch(e){if(!(e instanceof Error))throw e;m=ae(ue(e))}var g=m;this.ag(e,oe(g))}},L(ir).ag=function(e,t){if(null===e&&null===t)return $;null!==e&&null!==t&&ge(e,t);var n=null==e?t:e,r=new Gt("Fatal exception in coroutines machinery for "+H(this)+". Please read KDoc to 'handleFatalException' method and report this incident to maintainers",Ve(n));kt(this.lf().k6(),r)},L(ar).cd=function(){return!0},L(ar).bc=function(e){nr(ke(this.ok_1),Rt(e,this.ok_1))},L(ar).ac=function(e){this.ok_1.p6(Rt(e,this.ok_1))},L(ur).toString=function(){return"<"+this.pk_1+">"},L(yr).sk=function(){s.nextTick(this.zk_1.xk_1)},L(Er).el=function(){this.wk_1.sk()},L(Er).fl=function(){setTimeout(this.xk_1,0)},L(Er).gl=function(e){setTimeout(this.xk_1,e)},L(Sr).el=function(){var e;Promise.resolve($).then((e=this,function(t){return e.dl(),$}))},L(Sr).fl=function(){this.rl_1.postMessage(this.sl_1,"*")},L(Cr).gk=function(){var e=this.fk_1;return null==e?this.ek_1:e},L(br).ak=function(){return this.wl_1},L(br).gg=function(e){return!this.vl_1},L(br).hg=function(e,t){return this.ul_1.hg(e,t)},L(br).toString=function(){var e=this.bk();return null==e?this.ul_1.toString():e},L(Mr).hg=function(e,t){!function(){throw Fe("runBlocking event loop is not supported")}()},L(Tr).toString=function(){return L(Ie).toString.call(this)+"; job="+H(this.bm_1)},L(Tr).equals=function(e){return e===this||!!(e instanceof Tr&&e.message==this.message&&ne(e.bm_1,this.bm_1))&&ne(e.cause,this.cause)},L(Tr).hashCode=function(){var e=D(D(Ke(Ve(this.message)),31)+te(this.bm_1)|0,31),t=this.cause,n=null==t?null:te(t);return e+(null==n?0:n)|0},L(kr).sk=function(){this.zk_1.gl(0)},L(Pr).hg=function(e,t){this.zk_1.nl(t)},L(Dr).m=function(){return this.al_1.x8_1},L(Dr).hl=function(e){return this.al_1.h(e)},L(Dr).h=function(e){return this.hl(null!=e&&K(e,Ar)?e:B())},L(Dr).il=function(e){return this.al_1.n(e)},L(Dr).n=function(e){return this.il(e)},L(Dr).jl=function(e){return this.al_1.o(e)},L(Dr).o=function(e){return!(null==e||!K(e,Ar))&&this.jl(null!=e&&K(e,Ar)?e:B())},L(Dr).kl=function(e){return this.al_1.z(e)},L(Dr).z=function(e){return this.kl(e)},L(Dr).q=function(e){return this.al_1.q(e)},L(Dr).ll=function(e){return this.al_1.r(e)},L(Dr).r=function(e){return null!=e&&K(e,Ar)?this.ll(null!=e&&K(e,Ar)?e:B()):-1},L(Dr).p=function(){return this.al_1.p()},L(Dr).j=function(){return this.al_1.j()},L(Dr).s2=function(e){return this.al_1.s2(e)},L(Dr).ml=function(e,t){return this.al_1.d2(e,t)},L(Dr).d2=function(e,t){return this.ml(e,null!=t&&K(t,Ar)?t:B())},L(Dr).a1=function(e,t){return this.al_1.a1(e,t)},L(Dr).nl=function(e){this.hl(e),this.cl_1||(this.cl_1=!0,this.el())},L(Dr).dl=function(){try{var e=this.bl_1,t=0;if(t<e)do{t=t+1|0;var n=Xe(this);if(null==n)return $;n.zf()}while(t<e)}finally{this.p()?this.cl_1=!1:this.fl()}},L($r).hg=function(e,t){return this.gm_1.nl(t)},L(Lr).mh=function(){throw tt()},L(Br).nh=function(e){var t=this.hh_1;e.gh_1=this,e.hh_1=t,t.gh_1=e,this.hh_1=e},L(Br).mh=function(){return this.oh()},L(Br).fe=function(){this.mh()},L(Br).oh=function(){if(this.ih_1)return!1;var e=this.hh_1,t=this.gh_1;return e.gh_1=t,t.hh_1=e,this.ih_1=!0,!0},L(Br).uh=function(e){return this.gh_1===this&&(this.nh(e),!0)},L(Fr).yg=function(){var e=this.xg_1;return null==e||null!=e?e:B()},L(Fr).zg=function(e){this.xg_1=e},L(xn).tc=function(e,t,n,r){return e=e!==F&&e,t=t===F||t,r===F?this.sc(e,t,n):r.sc.call(this,e,t,n)},L(xn).da=De,L(xn).r6=$e,L(xn).ca=Le,L(xn).ba=Be,L(xt).r6=de,L(xt).ba=fe,r=new St,a=new Pt,u=new Lt,f=new Ht,p=new Jt,O=new Hn,A=0,R=!1,new Nr,e.$_$=e.$_$||{},e.$_$.a=function(e,t){var n=new ar(t.k6(),t);return function(e,t,n){var r,i;try{i=We(n,t,e)}catch(e){if(!(e instanceof Error))throw e;i=new bt(e)}var o=i;if(o!==V()){var s=e.zb(o);if(s!==Zt()){if(s instanceof bt)throw s.wb_1,jr(s.wb_1,e.ok_1);r=jn(s)}else r=V()}else r=V();return r}(n,n,e)},e.$_$.b=u,e.$_$.c=$t,e.$_$.d=rt,e.$_$.e=function(e,t,n,r){return function(e){var t=new Promise((n=e,function(e,t){return n.rc(function(e,t,n){return function(r){var i=e.gd();return null!=i?t(i):n(e.wd()),$}}(n,t,e)),$}));var n;return t.deferred=e,t}(rt(e,t=t===F?z():t,n=n===F?qt():n,r))},e})?r.apply(t,i):r)||(e.exports=o)},88536:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ProfilingLevelOperation=void 0;const r=n(75080),i=n(75725),o=n(17562),s=n(78130);class a extends i.MongoDBResponse{get was(){return this.get("was",r.BSONType.int,!0)}}class u extends s.CommandOperation{constructor(e,t){super(e,t),this.SERVER_COMMAND_RESPONSE_TYPE=a,this.options=t}get commandName(){return"profile"}buildCommandDocument(e){return{profile:-1}}handleOk(e){if(1===e.ok){const t=e.was;if(0===t)return"off";if(1===t)return"slow_only";if(2===t)return"all";throw new o.MongoUnexpectedServerResponseError(`Illegal profiling level value ${t}`)}throw new o.MongoUnexpectedServerResponseError("Error with profile command")}}t.ProfilingLevelOperation=u},88822:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.AutomatedCallbackWorkflow=void 0;const r=n(17562),i=n(7799),o=n(63257),s=n(49683);class a extends s.CallbackWorkflow{constructor(e,t){super(e,t)}async execute(e,t){if(this.cache.hasAccessToken){const n=this.cache.getAccessToken();e.accessToken||(e.accessToken=n);try{return await this.finishAuthentication(e,t,n)}catch(n){if(n instanceof r.MongoError&&n.code===r.MONGODB_ERROR_CODES.AuthenticationFailed)return this.cache.removeAccessToken(),await this.execute(e,t);throw n}}const n=await this.fetchAccessToken(t);this.cache.put(n),e.accessToken=n.accessToken,await this.finishAuthentication(e,t,n.accessToken)}async fetchAccessToken(e){const t=new AbortController,n={timeoutContext:t.signal,version:o.OIDC_VERSION};e.username&&(n.username=e.username),e.mechanismProperties.TOKEN_RESOURCE&&(n.tokenAudience=e.mechanismProperties.TOKEN_RESOURCE);const a=i.Timeout.expires(s.AUTOMATED_TIMEOUT_MS);try{return await Promise.race([this.executeAndValidateCallback(n),a])}catch(e){if(i.TimeoutError.is(e))throw t.abort(),new r.MongoOIDCError(`OIDC callback timed out after ${s.AUTOMATED_TIMEOUT_MS}ms.`);throw e}finally{a.clear()}}}t.AutomatedCallbackWorkflow=a},88913:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ListCollectionsOperation=void 0;const r=n(75725),i=n(145),o=n(78130),s=n(35394);class a extends o.CommandOperation{constructor(e,t,n){super(e,n),this.SERVER_COMMAND_RESPONSE_TYPE=r.CursorResponse,this.options={...n},delete this.options.writeConcern,this.db=e,this.filter=t,this.nameOnly=!!this.options.nameOnly,this.authorizedCollections=!!this.options.authorizedCollections,"number"==typeof this.options.batchSize&&(this.batchSize=this.options.batchSize),this.SERVER_COMMAND_RESPONSE_TYPE=this.explain?r.ExplainedCursorResponse:r.CursorResponse}get commandName(){return"listCollections"}buildCommandDocument(e){const t={listCollections:1,filter:this.filter,cursor:this.batchSize?{batchSize:this.batchSize}:{},nameOnly:this.nameOnly,authorizedCollections:this.authorizedCollections};return(0,i.maxWireVersion)(e)>=9&&void 0!==this.options.comment&&(t.comment=this.options.comment),t}handleOk(e){return e}}t.ListCollectionsOperation=a,(0,s.defineAspects)(a,[s.Aspect.READ_OPERATION,s.Aspect.RETRYABLE,s.Aspect.CURSOR_CREATING])},89167:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ServerType=t.TopologyType=t.STATE_CONNECTED=t.STATE_CONNECTING=t.STATE_CLOSED=t.STATE_CLOSING=void 0,t._advanceClusterTime=function(e,t){(null==e.clusterTime||t.clusterTime.greaterThan(e.clusterTime.clusterTime))&&(e.clusterTime=t)},t.STATE_CLOSING="closing",t.STATE_CLOSED="closed",t.STATE_CONNECTING="connecting",t.STATE_CONNECTED="connected",t.TopologyType=Object.freeze({Single:"Single",ReplicaSetNoPrimary:"ReplicaSetNoPrimary",ReplicaSetWithPrimary:"ReplicaSetWithPrimary",Sharded:"Sharded",Unknown:"Unknown",LoadBalanced:"LoadBalanced"}),t.ServerType=Object.freeze({Standalone:"Standalone",Mongos:"Mongos",PossiblePrimary:"PossiblePrimary",RSPrimary:"RSPrimary",RSSecondary:"RSSecondary",RSArbiter:"RSArbiter",RSOther:"RSOther",RSGhost:"RSGhost",Unknown:"Unknown",LoadBalancer:"LoadBalancer"})},90198:(e,t,n)=>{var r,i,o;i=[t,n(36257)],void 0===(o="function"==typeof(r=function(e,t){var n,r,i,o,s,a=Math.imul,u=t.$_$.a5,c=t.$_$.j4,l=t.$_$.a4,h=t.$_$.u3,d=t.$_$.j1,f=t.$_$.y3,p=t.$_$.q1,m=t.$_$.g4,g=t.$_$.z3,_=t.$_$.b,y=t.$_$.k1,v=t.$_$.v3,E=t.$_$.p1,S=t.$_$.i5,w=t.$_$.h1,C=t.$_$.t,O=t.$_$.i1,b=t.$_$.n1,M=t.$_$.l1,T=t.$_$.r1,A=t.$_$.i4,R=t.$_$.w1,N=t.$_$.n4,I=t.$_$.m4,x=t.$_$.d5,k=t.$_$.t1,P=t.$_$.f5,D=t.$_$.o,$=t.$_$.e4,L=t.$_$.n;function B(){n=this,this.jm_1=new V(me().km_1,0)}function j(){return null==n&&new B,n}function q(e,t){return h(e,t.lm_1)}function F(e,t){return h(e,t.lm_1)}function z(e,t){return h(e,t)}function U(e,t){return h(e,t)}function V(e,t){j(),d.call(this),this.qm_1=e,this.rm_1=t}function W(){}function G(e){for(var t=0,n=v(Array(8),null);t<8;)n[t]=new Z,t=t+1|0;J.call(this,e,n)}function H(e){for(var t=0,n=v(Array(8),null);t<8;)n[t]=new ee,t=t+1|0;J.call(this,e,n)}function K(e,t){this.un_1=e,this.vn_1=t}function Y(e,t){if(e.rn_1[t].zn())return t;if(e.rn_1[t].do()){var n=e.rn_1[t].ao();return 6===t?e.rn_1[t+1|0].co(n.vm_1,n.vm_1.length):e.rn_1[t+1|0].co(n.vm_1,a(2,n.bo())),Y(e,t+1|0)}return-1}function Q(e){if(e.rn_1[e.sn_1].zn())return w;var t=e.sn_1;if(0<=t)do{var n=t;t=t+-1|0;var r=Y(e,n);if(-1===r&&e.rn_1[n].do()&&(e.rn_1[n].eo(),r=Y(e,n)),-1!==r)return e.sn_1=r,w;n>0&&e.rn_1[n-1|0].eo(),e.rn_1[n].co(me().km_1.vm_1,0)}while(0<=t);e.tn_1=!1}function J(e,t){this.rn_1=t,this.sn_1=0,this.tn_1=!0,this.rn_1[0].co(e.vm_1,a(2,e.bo())),this.sn_1=0,Q(this)}function X(){this.wn_1=me().km_1.vm_1,this.xn_1=0,this.yn_1=0}function Z(){X.call(this)}function ee(){X.call(this)}function te(e){O.call(this),this.mo_1=e}function ne(e){M.call(this),this.no_1=e}function re(e,t,n){return function(e,t,n,r){return ge.call(r,e,t,n,null),r}(e,t,n,A(c(ge)))}function ie(e,t){this.zm_1=e,this.an_1=t}function oe(e){return new ie(e,1)}function se(e){return new ie(e,0)}function ae(e,t){return!!(e.tm_1&t)}function ue(e,t){var n=e.vm_1[t];return null==n||null!=n?n:u()}function ce(e,t){var n=e.vm_1[t+1|0];return null==n||null!=n?n:u()}function le(e,t,n,r){var i=r.vm_1;if(2===i.length&&0===r.tm_1){if(1===e.vm_1.length)return r.sm_1=e.tm_1,r;var o=e.qo(n),s=function(e,t,n,r,i){var o=R(e,e.length+1|0),s=t+2|0,a=t+1|0,u=e.length;return k(o,o,s,a,u),k(o,o,n+2|0,n,t),o[n]=r,o[n+1|0]=i,o}(e.vm_1,t,o,i[0],i[1]);return re(e.sm_1^n,e.tm_1^n,s)}var a=R(e.vm_1,e.vm_1.length);return a[t]=r,re(e.sm_1,e.tm_1,a)}function he(e,t,n,r,i,o,s,a){var u=ue(e,t),c=null==u?null:f(u),l=de(e,null==c?0:c,u,ce(e,t),r,i,o,s+5|0,a),h=e.ro(n)+1|0;return function(e,t,n,r){var i=n-2|0,o=1+(e.length-2|0)|0,s=v(Array(o),null);k(e,s,0,0,t),k(e,s,t,t+2|0,n),s[i]=r;var a=i+1|0,u=e.length;return k(e,s,a,n,u),s}(e.vm_1,t,h,l)}function de(e,t,n,r,i,o,s,a,u){if(a>30)return new ge(0,0,[n,r,o,s],u);var c=ye(t,a),l=ye(i,a);return c!==l?new ge(1<<c|1<<l,0,c<l?[n,r,o,s]:[o,s,n,r],u):new ge(0,1<<c,[de(e,t,n,r,i,o,s,a+5|0,u)],u)}function fe(e,t){var n=I(N(0,e.vm_1.length),2),r=n.u_1,i=n.v_1,o=n.w_1;if(o>0&&r<=i||o<0&&i<=r)do{var s=r;if(r=r+o|0,h(t,ue(e,s)))return s}while(s!==i);return-1}function pe(){r=this;this.km_1=re(0,0,[])}function me(){return null==r&&new pe,r}function ge(e,t,n,r){me(),this.sm_1=e,this.tm_1=t,this.um_1=r,this.vm_1=n}function _e(e,t,n,r){var i=e.length+2|0,o=v(Array(i),null);k(e,o,0,0,t);var s=t+2|0,a=e.length;return k(e,o,s,t,a),o[t]=n,o[t+1|0]=r,o}function ye(e,t){return e>>t&31}function ve(){i=this,this.hm_1=new be(o,o,j().im())}function Ee(){return null==i&&new ve,i}function Se(e,t){return h(e.lm_1,t.lm_1)}function we(e,t){return h(e.lm_1,t.lm_1)}function Ce(e,t){return h(e.lm_1,t)}function Oe(e,t){return h(e.lm_1,t)}function be(e,t,n){Ee(),d.call(this),this.on_1=e,this.pn_1=t,this.qn_1=n}function Me(e){return function(e,t){return Ae.call(t,e,o,o),t}(e,A(c(Ae)))}function Te(e,t){return function(e,t,n){return Ae.call(n,e,t,o),n}(e,t,A(c(Ae)))}function Ae(e,t,n){this.lm_1=e,this.mm_1=t,this.nm_1=n}function Re(){}function Ne(e){this.wo_1=new xe(e.on_1,e.qn_1)}function Ie(e){this.ap_1=new xe(e.on_1,e.qn_1)}function xe(e,t){this.xo_1=e,this.yo_1=t,this.zo_1=0}function ke(e){O.call(this),this.bp_1=e}function Pe(e){M.call(this),this.cp_1=e}function De(){}function $e(){}function Le(e){if(!e)throw L("Assertion failed")}return l(B),g(V,"PersistentHashMap",_,d,[d,p]),g(W,"PersistentHashMapBuilder",_,y,[p,y]),g(J,"PersistentHashMapBaseIterator"),g(G,"PersistentHashMapValuesIterator",_,J),g(H,"PersistentHashMapEntriesIterator",_,J),g(K,"MapEntry",_,_,[E]),g(X,"TrieNodeBaseIterator"),g(Z,"TrieNodeValuesIterator",Z,X),g(ee,"TrieNodeEntriesIterator",ee,X),g(te,"PersistentHashMapValues",_,O,[b,O]),g(ne,"PersistentHashMapEntries",_,M,[T,b,M]),g(ie,"ModificationResult"),l(pe),g(ge,"TrieNode"),l(ve),g(be,"PersistentOrderedMap",_,d,[d,p]),g(Ae,"LinkedValue"),g(Re,"PersistentOrderedMapBuilder",_,y,[y,p]),g(Ne,"PersistentOrderedMapValuesIterator"),g(Ie,"PersistentOrderedMapEntriesIterator"),g(xe,"PersistentOrderedMapLinksIterator"),g(ke,"PersistentOrderedMapValues",_,O,[b,O]),g(Pe,"PersistentOrderedMapEntries",_,M,[T,b,M]),$(De,"EndOfChain"),$($e,"MapImplementation"),c(B).im=function(){var e=this.jm_1;return e instanceof V?e:u()},c(V).m=function(){return this.rm_1},c(V).g1=function(){return new te(this)},c(V).h1=function(){return new ne(this)},c(V).d1=function(e){var t=null==e?null:f(e),n=null==t?0:t;return this.qm_1.wm(n,e,0)},c(V).f1=function(e){var t=null==e?null:f(e),n=null==t?0:t;return this.qm_1.xm(n,e,0)},c(V).a3=function(e,t){var n=null==e?null:f(e),r=null==n?0:n,i=this.qm_1.ym(r,e,t,0);if(null==i)return this;var o=i;return new V(o.zm_1,this.rm_1+o.an_1|0)},c(V).equals=function(e){if(e===this)return!0;if(null==e||!m(e,p))return!1;if(this.rm_1!==e.m())return!1;var t;if(e instanceof be)t=this.qm_1.gn(e.qn_1.qm_1,q);else if(e instanceof Re){var n=e.ln_1.fn_1;t=this.qm_1.gn(n,F)}else if(e instanceof V)t=this.qm_1.gn(e.qm_1,z);else if(e instanceof W){var r=e.fn_1;t=this.qm_1.gn(r,U)}else t=c(d).equals.call(this,e);return t},c(V).hashCode=function(){return c(d).hashCode.call(this)},c(K).b1=function(){return this.un_1},c(K).c1=function(){return this.vn_1},c(K).hashCode=function(){var e=this.b1(),t=null==e?null:f(e),n=null==t?0:t,r=this.c1(),i=null==r?null:f(r);return n^(null==i?0:i)},c(K).equals=function(e){var t,n=null!=e&&m(e,E)?e:null;return null!=(t=null==n?null:h(n.b1(),this.b1())&&h(n.c1(),this.c1()))&&t},c(K).toString=function(){return S(this.b1())+"="+S(this.c1())},c(J).k=function(){return this.tn_1},c(J).l=function(){!function(e){if(!e.k())throw C()}(this);var e=this.rn_1[this.sn_1].l();return Q(this),e},c(X).fo=function(e,t,n){this.wn_1=e,this.xn_1=t,this.yn_1=n},c(X).co=function(e,t){this.fo(e,t,0)},c(X).zn=function(){return this.yn_1<this.xn_1},c(X).do=function(){return Le(this.yn_1>=this.xn_1),this.yn_1<this.wn_1.length},c(X).ao=function(){Le(this.do());var e=this.wn_1[this.yn_1];return e instanceof ge?e:u()},c(X).eo=function(){Le(this.do()),this.yn_1=this.yn_1+1|0},c(X).k=function(){return this.zn()},c(Z).l=function(){Le(this.zn()),this.yn_1=this.yn_1+2|0;var e=this.wn_1[this.yn_1-1|0];return null==e||null!=e?e:u()},c(ee).l=function(){Le(this.zn()),this.yn_1=this.yn_1+2|0;var e=this.wn_1[this.yn_1-2|0],t=null==e||null!=e?e:u(),n=this.wn_1[this.yn_1-1|0];return new K(t,null==n||null!=n?n:u())},c(te).m=function(){return this.mo_1.rm_1},c(te).q3=function(e){return this.mo_1.e1(e)},c(te).o=function(e){return(null==e||null!=e)&&this.q3(null==e||null!=e?e:u())},c(te).j=function(){return new G(this.mo_1.qm_1)},c(ne).m=function(){return this.no_1.rm_1},c(ne).oo=function(e){return s.po(this.no_1,e)},c(ne).o=function(e){return!(null==e||!m(e,E))&&this.oo(null!=e&&m(e,E)?e:u())},c(ne).j=function(){return new H(this.no_1.qm_1)},c(ge).bo=function(){return x(this.sm_1)},c(ge).so=function(e){return!!(this.sm_1&e)},c(ge).qo=function(e){return a(2,x(this.sm_1&e-1))},c(ge).ro=function(e){return(this.vm_1.length-1|0)-x(this.tm_1&e-1)|0},c(ge).to=function(e){var t=this.vm_1[e];return t instanceof ge?t:u()},c(ge).wm=function(e,t,n){var r=1<<ye(e,n);if(this.so(r))return h(t,ue(this,this.qo(r)));if(ae(this,r)){var i=this.to(this.ro(r));return 30===n?function(e,t){return!(-1===fe(e,t))}(i,t):i.wm(e,t,n+5|0)}return!1},c(ge).xm=function(e,t,n){var r=1<<ye(e,n);if(this.so(r)){var i=this.qo(r);return h(t,ue(this,i))?ce(this,i):null}if(ae(this,r)){var o=this.to(this.ro(r));return 30===n?function(e,t){var n=fe(e,t);return-1!==n?ce(e,n):null}(o,t):o.xm(e,t,n+5|0)}return null},c(ge).ym=function(e,t,n,r){var i=1<<ye(e,r);if(this.so(i)){var o=this.qo(i);return h(t,ue(this,o))?ce(this,o)===n?null:se(function(e,t,n){var r=e.vm_1.slice();return r[t+1|0]=n,re(e.sm_1,e.tm_1,r)}(this,o,n)):oe(function(e,t,n,r,i,o,s){var a=he(e,t,n,r,i,o,s,null);return re(e.sm_1^n,e.tm_1|n,a)}(this,o,i,e,t,n,r))}if(ae(this,i)){var s,a=this.ro(i),u=this.to(a);if(30===r){var c=function(e,t,n){var r=fe(e,t);if(-1!==r){if(n===ce(e,r))return null;var i=e.vm_1.slice();return i[r+1|0]=n,se(re(0,0,i))}return oe(re(0,0,_e(e.vm_1,0,t,n)))}(u,t,n);if(null==c)return null;s=c}else{var l=u.ym(e,t,n,r+5|0);if(null==l)return null;s=l}var d=s,f=d,p=d.zm_1;return f.zm_1=le(this,a,i,p),d}return oe(function(e,t,n,r){var i=e.qo(t),o=_e(e.vm_1,i,n,r);return re(e.sm_1|t,e.tm_1,o)}(this,i,t,n))},c(ge).gn=function(e,t){if(this===e)return!0;if(this.sm_1!==e.sm_1||this.tm_1!==e.tm_1)return!1;if(0===this.sm_1&&0===this.tm_1){if(this.vm_1.length!==e.vm_1.length)return!1;var n;e:{var r=I(N(0,this.vm_1.length),2);if(m(r,b)&&r.p())n=!0;else{var i=r.u_1,o=r.v_1,s=r.w_1;if(s>0&&i<=o||s<0&&o<=i)do{var u=i;i=i+s|0;var c=u,l=ue(e,c),d=ce(e,c),f=fe(this,l);if(-1===f||!t(ce(this,f),d)){n=!1;break e}}while(u!==o);n=!0}}return n}var p=a(x(this.sm_1),2),g=I(N(0,p),2),_=g.u_1,y=g.v_1,v=g.w_1;if(v>0&&_<=y||v<0&&y<=_)do{var E=_;if(_=_+v|0,!h(ue(this,E),ue(e,E)))return!1;if(!t(ce(this,E),ce(e,E)))return!1}while(E!==y);var S=p,w=this.vm_1.length;if(S<w)do{var C=S;if(S=S+1|0,!this.to(C).gn(e.to(C),t))return!1}while(S<w);return!0},c(ve).im=function(){var e=this.hm_1;return e instanceof be?e:u()},c(be).m=function(){return this.qn_1.rm_1},c(be).g1=function(){return new ke(this)},c(be).h1=function(){return new Pe(this)},c(be).d1=function(e){return this.qn_1.d1(e)},c(be).f1=function(e){var t=this.qn_1.f1(e);return null==t?null:t.lm_1},c(be).a3=function(e,t){if(this.p())return new be(e,e,this.qn_1.a3(e,Me(t)));var n=this.qn_1.f1(e);if(null!=n){if(n.lm_1===t)return this;var r=this.qn_1.a3(e,n.uo(t));return new be(this.on_1,this.pn_1,r)}var i=this.pn_1,o=null==i||null!=i?i:u(),s=P(this.qn_1.f1(o)),a=this.qn_1.a3(o,s.vo(e)).a3(e,Te(t,o));return new be(this.on_1,e,a)},c(be).equals=function(e){if(e===this)return!0;if(null==e||!m(e,p))return!1;if(this.m()!==e.m())return!1;var t;if(e instanceof be)t=this.qn_1.qm_1.gn(e.qn_1.qm_1,Se);else if(e instanceof Re){var n=e.ln_1.fn_1;t=this.qn_1.qm_1.gn(n,we)}else if(e instanceof V)t=this.qn_1.qm_1.gn(e.qm_1,Ce);else if(e instanceof W){var r=e.fn_1;t=this.qn_1.qm_1.gn(r,Oe)}else t=c(d).equals.call(this,e);return t},c(be).hashCode=function(){return c(d).hashCode.call(this)},c(Ae).uo=function(e){return new Ae(e,this.mm_1,this.nm_1)},c(Ae).vo=function(e){return new Ae(this.lm_1,this.mm_1,e)},c(Ne).k=function(){return this.wo_1.k()},c(Ne).l=function(){return this.wo_1.l().lm_1},c(Ie).k=function(){return this.ap_1.k()},c(Ie).l=function(){var e=this.ap_1.xo_1;return new K(null==e||null!=e?e:u(),this.ap_1.l().lm_1)},c(xe).k=function(){return this.zo_1<this.yo_1.m()},c(xe).l=function(){if(!this.k())throw C();var e=this.yo_1,t=this.xo_1,n=null==t||null!=t?t:u(),r=e.f1(n);if(null==r)throw D("Hash code of a key ("+S(this.xo_1)+") has changed after it was added to the persistent map.");var i=r;return this.zo_1=this.zo_1+1|0,this.xo_1=i.nm_1,i},c(ke).m=function(){return this.bp_1.m()},c(ke).q3=function(e){return this.bp_1.e1(e)},c(ke).o=function(e){return(null==e||null!=e)&&this.q3(null==e||null!=e?e:u())},c(ke).j=function(){return new Ne(this.bp_1)},c(Pe).m=function(){return this.cp_1.m()},c(Pe).oo=function(e){return s.po(this.cp_1,e)},c(Pe).o=function(e){return!(null==e||!m(e,E))&&this.oo(null!=e&&m(e,E)?e:u())},c(Pe).j=function(){return new Ie(this.cp_1)},c($e).po=function(e,t){var n=null!=t?t:u();if(null==n||!m(n,E))return!1;var r=e.f1(t.b1()),i=null==r?null:h(r,t.c1());return null==i?null==t.c1()&&e.d1(t.b1()):i},o=new De,s=new $e,e.$_$=e.$_$||{},e.$_$.a=function(){return Ee().im()},e})?r.apply(t,i):r)||(e.exports=o)},90780:(e,t,n)=>{var r,i,o;i=[t,n(10324),n(36257)],void 0===(o="function"==typeof(r=function(e,t,n){var r=t.$_$.n1,i=n.$_$.a5,o=n.$_$.f4,s=n.$_$.f2,a=n.$_$.l4,u=n.$_$.h,c=(n.$_$.h1,t.$_$.z),l=t.$_$.t1,h=t.$_$.q1,d=t.$_$.r1,f=t.$_$.s1,p=t.$_$.u1,m=t.$_$.p1,g=n.$_$.r4,_=t.$_$.y,y=t.$_$.o1,v=t.$_$.v1;function E(e){var t=typeof e;return null!=t&&"string"==typeof t?t:i()}return e.$_$=e.$_$||{},e.$_$.a=function e(t){var n;if("string"===E(t))n=v;else if("boolean"===E(t))n=y();else if("number"===E(t))n=d;else if("bigint"===E(t))n=l();else if(t instanceof Date)n=m;else{var S=Array.isArray(t);if(null!=S&&"boolean"==typeof S?S:i())n=new _(r);else if(null!=t&&"object"===E(t)){var w,C=Object.keys(t),O=null!=C&&o(C)?C:i();if(1===O.length&&g(O[0],"$"))switch(O[0]){case"$numberLong":w=l();break;case"$numberDecimal":w=h();break;case"$numberDouble":w=d;break;case"$numberInt":w=f;break;case"$oid":w=p;break;case"$date":w=m;break;default:w=r}else{for(var b=u(a(s(O.length),16)),M=0,T=O.length;M<T;){var A=O[M];M=M+1|0;var R=e(t[A]);b.a3(A,R)}w=new c(b)}n=w}else n=r}return n},e})?r.apply(t,i):r)||(e.exports=o)},91566:(e,t,n)=>{var r=n(65994).e;Object.defineProperty(t,"__esModule",{value:!0}),t.MongoCredentials=t.DEFAULT_ALLOWED_HOSTS=void 0;const i=n(17562),o=n(95750),s=n(93065);function a(e){return e&&Array.isArray(e.saslSupportedMechs)?e.saslSupportedMechs.includes(s.AuthMechanism.MONGODB_SCRAM_SHA256)?s.AuthMechanism.MONGODB_SCRAM_SHA256:s.AuthMechanism.MONGODB_SCRAM_SHA1:s.AuthMechanism.MONGODB_SCRAM_SHA256}const u=["test","azure","gcp","k8s"],c="Auth mechanism property ALLOWED_HOSTS must be an array of strings.";t.DEFAULT_ALLOWED_HOSTS=["*.mongodb.net","*.mongodb-qa.net","*.mongodb-dev.net","*.mongodbgov.net","localhost","127.0.0.1","::1"];class l{constructor(e){this.username=e.username??"",this.password=e.password,this.source=e.source,!this.source&&e.db&&(this.source=e.db),this.mechanism=e.mechanism||s.AuthMechanism.MONGODB_DEFAULT,this.mechanismProperties=e.mechanismProperties||{},this.mechanism.match(/MONGODB-AWS/i)&&(!this.username&&r.env.AWS_ACCESS_KEY_ID&&(this.username=r.env.AWS_ACCESS_KEY_ID),!this.password&&r.env.AWS_SECRET_ACCESS_KEY&&(this.password=r.env.AWS_SECRET_ACCESS_KEY),null==this.mechanismProperties.AWS_SESSION_TOKEN&&null!=r.env.AWS_SESSION_TOKEN&&(this.mechanismProperties={...this.mechanismProperties,AWS_SESSION_TOKEN:r.env.AWS_SESSION_TOKEN})),this.mechanism!==s.AuthMechanism.MONGODB_OIDC||this.mechanismProperties.ALLOWED_HOSTS||(this.mechanismProperties={...this.mechanismProperties,ALLOWED_HOSTS:t.DEFAULT_ALLOWED_HOSTS}),Object.freeze(this.mechanismProperties),Object.freeze(this)}equals(e){return this.mechanism===e.mechanism&&this.username===e.username&&this.password===e.password&&this.source===e.source}resolveAuthMechanism(e){return this.mechanism.match(/DEFAULT/i)?new l({username:this.username,password:this.password,source:this.source,mechanism:a(e),mechanismProperties:this.mechanismProperties}):this}validate(){if((this.mechanism===s.AuthMechanism.MONGODB_GSSAPI||this.mechanism===s.AuthMechanism.MONGODB_PLAIN||this.mechanism===s.AuthMechanism.MONGODB_SCRAM_SHA1||this.mechanism===s.AuthMechanism.MONGODB_SCRAM_SHA256)&&!this.username)throw new i.MongoMissingCredentialsError(`Username required for mechanism '${this.mechanism}'`);if(this.mechanism===s.AuthMechanism.MONGODB_OIDC){if(this.username&&this.mechanismProperties.ENVIRONMENT&&"azure"!==this.mechanismProperties.ENVIRONMENT)throw new i.MongoInvalidArgumentError(`username and ENVIRONMENT '${this.mechanismProperties.ENVIRONMENT}' may not be used together for mechanism '${this.mechanism}'.`);if(this.username&&this.password)throw new i.MongoInvalidArgumentError(`No password is allowed in ENVIRONMENT '${this.mechanismProperties.ENVIRONMENT}' for '${this.mechanism}'.`);if(("azure"===this.mechanismProperties.ENVIRONMENT||"gcp"===this.mechanismProperties.ENVIRONMENT)&&!this.mechanismProperties.TOKEN_RESOURCE)throw new i.MongoInvalidArgumentError("TOKEN_RESOURCE must be set in the auth mechanism properties when ENVIRONMENT is azure or gcp.");if(this.mechanismProperties.ENVIRONMENT&&!u.includes(this.mechanismProperties.ENVIRONMENT))throw new i.MongoInvalidArgumentError(`Currently only a ENVIRONMENT in ${u.join(",")} is supported for mechanism '${this.mechanism}'.`);if(!this.mechanismProperties.ENVIRONMENT&&!this.mechanismProperties.OIDC_CALLBACK&&!this.mechanismProperties.OIDC_HUMAN_CALLBACK)throw new i.MongoInvalidArgumentError(`Either a ENVIRONMENT, OIDC_CALLBACK, or OIDC_HUMAN_CALLBACK must be specified for mechanism '${this.mechanism}'.`);if(this.mechanismProperties.ALLOWED_HOSTS){const e=this.mechanismProperties.ALLOWED_HOSTS;if(!Array.isArray(e))throw new i.MongoInvalidArgumentError(c);for(const t of e)if("string"!=typeof t)throw new i.MongoInvalidArgumentError(c)}}if(s.AUTH_MECHS_AUTH_SRC_EXTERNAL.has(this.mechanism)&&null!=this.source&&"$external"!==this.source)throw new i.MongoAPIError(`Invalid source '${this.source}' for mechanism '${this.mechanism}' specified.`);if(this.mechanism===s.AuthMechanism.MONGODB_PLAIN&&null==this.source)throw new i.MongoAPIError("PLAIN Authentication Mechanism needs an auth source");if(this.mechanism===s.AuthMechanism.MONGODB_X509&&null!=this.password){if(""===this.password)return void Reflect.set(this,"password",void 0);throw new i.MongoAPIError("Password not allowed for mechanism MONGODB-X509")}const e=this.mechanismProperties.CANONICALIZE_HOST_NAME??!1;if(!Object.values(o.GSSAPICanonicalizationValue).includes(e))throw new i.MongoAPIError(`Invalid CANONICALIZE_HOST_NAME value: ${e}`)}static merge(e,t){return new l({username:t.username??e?.username??"",password:t.password??e?.password??"",mechanism:t.mechanism??e?.mechanism??s.AuthMechanism.MONGODB_DEFAULT,mechanismProperties:t.mechanismProperties??e?.mechanismProperties??{},source:t.source??t.db??e?.source??"admin"})}}t.MongoCredentials=l},91869:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.END=t.CHANGE=t.INIT=t.MORE=t.RESPONSE=t.SERVER_HEARTBEAT_FAILED=t.SERVER_HEARTBEAT_SUCCEEDED=t.SERVER_HEARTBEAT_STARTED=t.COMMAND_FAILED=t.COMMAND_SUCCEEDED=t.COMMAND_STARTED=t.CLUSTER_TIME_RECEIVED=t.CONNECTION_CHECKED_IN=t.CONNECTION_CHECKED_OUT=t.CONNECTION_CHECK_OUT_FAILED=t.CONNECTION_CHECK_OUT_STARTED=t.CONNECTION_CLOSED=t.CONNECTION_READY=t.CONNECTION_CREATED=t.CONNECTION_POOL_READY=t.CONNECTION_POOL_CLEARED=t.CONNECTION_POOL_CLOSED=t.CONNECTION_POOL_CREATED=t.WAITING_FOR_SUITABLE_SERVER=t.SERVER_SELECTION_SUCCEEDED=t.SERVER_SELECTION_FAILED=t.SERVER_SELECTION_STARTED=t.TOPOLOGY_DESCRIPTION_CHANGED=t.TOPOLOGY_CLOSED=t.TOPOLOGY_OPENING=t.SERVER_DESCRIPTION_CHANGED=t.SERVER_CLOSED=t.SERVER_OPENING=t.DESCRIPTION_RECEIVED=t.UNPINNED=t.PINNED=t.MESSAGE=t.ENDED=t.CLOSED=t.CONNECT=t.OPEN=t.CLOSE=t.TIMEOUT=t.ERROR=t.SYSTEM_JS_COLLECTION=t.SYSTEM_COMMAND_COLLECTION=t.SYSTEM_USER_COLLECTION=t.SYSTEM_PROFILE_COLLECTION=t.SYSTEM_INDEX_COLLECTION=t.SYSTEM_NAMESPACE_COLLECTION=void 0,t.kDecoratedKeys=t.kDecorateResult=t.LEGACY_HELLO_COMMAND_CAMEL_CASE=t.LEGACY_HELLO_COMMAND=t.MONGO_CLIENT_EVENTS=t.LOCAL_SERVER_EVENTS=t.SERVER_RELAY_EVENTS=t.APM_EVENTS=t.TOPOLOGY_EVENTS=t.CMAP_EVENTS=t.HEARTBEAT_EVENTS=t.RESUME_TOKEN_CHANGED=void 0,t.SYSTEM_NAMESPACE_COLLECTION="system.namespaces",t.SYSTEM_INDEX_COLLECTION="system.indexes",t.SYSTEM_PROFILE_COLLECTION="system.profile",t.SYSTEM_USER_COLLECTION="system.users",t.SYSTEM_COMMAND_COLLECTION="$cmd",t.SYSTEM_JS_COLLECTION="system.js",t.ERROR="error",t.TIMEOUT="timeout",t.CLOSE="close",t.OPEN="open",t.CONNECT="connect",t.CLOSED="closed",t.ENDED="ended",t.MESSAGE="message",t.PINNED="pinned",t.UNPINNED="unpinned",t.DESCRIPTION_RECEIVED="descriptionReceived",t.SERVER_OPENING="serverOpening",t.SERVER_CLOSED="serverClosed",t.SERVER_DESCRIPTION_CHANGED="serverDescriptionChanged",t.TOPOLOGY_OPENING="topologyOpening",t.TOPOLOGY_CLOSED="topologyClosed",t.TOPOLOGY_DESCRIPTION_CHANGED="topologyDescriptionChanged",t.SERVER_SELECTION_STARTED="serverSelectionStarted",t.SERVER_SELECTION_FAILED="serverSelectionFailed",t.SERVER_SELECTION_SUCCEEDED="serverSelectionSucceeded",t.WAITING_FOR_SUITABLE_SERVER="waitingForSuitableServer",t.CONNECTION_POOL_CREATED="connectionPoolCreated",t.CONNECTION_POOL_CLOSED="connectionPoolClosed",t.CONNECTION_POOL_CLEARED="connectionPoolCleared",t.CONNECTION_POOL_READY="connectionPoolReady",t.CONNECTION_CREATED="connectionCreated",t.CONNECTION_READY="connectionReady",t.CONNECTION_CLOSED="connectionClosed",t.CONNECTION_CHECK_OUT_STARTED="connectionCheckOutStarted",t.CONNECTION_CHECK_OUT_FAILED="connectionCheckOutFailed",t.CONNECTION_CHECKED_OUT="connectionCheckedOut",t.CONNECTION_CHECKED_IN="connectionCheckedIn",t.CLUSTER_TIME_RECEIVED="clusterTimeReceived",t.COMMAND_STARTED="commandStarted",t.COMMAND_SUCCEEDED="commandSucceeded",t.COMMAND_FAILED="commandFailed",t.SERVER_HEARTBEAT_STARTED="serverHeartbeatStarted",t.SERVER_HEARTBEAT_SUCCEEDED="serverHeartbeatSucceeded",t.SERVER_HEARTBEAT_FAILED="serverHeartbeatFailed",t.RESPONSE="response",t.MORE="more",t.INIT="init",t.CHANGE="change",t.END="end",t.RESUME_TOKEN_CHANGED="resumeTokenChanged",t.HEARTBEAT_EVENTS=Object.freeze([t.SERVER_HEARTBEAT_STARTED,t.SERVER_HEARTBEAT_SUCCEEDED,t.SERVER_HEARTBEAT_FAILED]),t.CMAP_EVENTS=Object.freeze([t.CONNECTION_POOL_CREATED,t.CONNECTION_POOL_READY,t.CONNECTION_POOL_CLEARED,t.CONNECTION_POOL_CLOSED,t.CONNECTION_CREATED,t.CONNECTION_READY,t.CONNECTION_CLOSED,t.CONNECTION_CHECK_OUT_STARTED,t.CONNECTION_CHECK_OUT_FAILED,t.CONNECTION_CHECKED_OUT,t.CONNECTION_CHECKED_IN]),t.TOPOLOGY_EVENTS=Object.freeze([t.SERVER_OPENING,t.SERVER_CLOSED,t.SERVER_DESCRIPTION_CHANGED,t.TOPOLOGY_OPENING,t.TOPOLOGY_CLOSED,t.TOPOLOGY_DESCRIPTION_CHANGED,t.ERROR,t.TIMEOUT,t.CLOSE]),t.APM_EVENTS=Object.freeze([t.COMMAND_STARTED,t.COMMAND_SUCCEEDED,t.COMMAND_FAILED]),t.SERVER_RELAY_EVENTS=Object.freeze([t.SERVER_HEARTBEAT_STARTED,t.SERVER_HEARTBEAT_SUCCEEDED,t.SERVER_HEARTBEAT_FAILED,t.COMMAND_STARTED,t.COMMAND_SUCCEEDED,t.COMMAND_FAILED,...t.CMAP_EVENTS]),t.LOCAL_SERVER_EVENTS=Object.freeze([t.CONNECT,t.DESCRIPTION_RECEIVED,t.CLOSED,t.ENDED]),t.MONGO_CLIENT_EVENTS=Object.freeze([...t.CMAP_EVENTS,...t.APM_EVENTS,...t.TOPOLOGY_EVENTS,...t.HEARTBEAT_EVENTS]),t.LEGACY_HELLO_COMMAND="ismaster",t.LEGACY_HELLO_COMMAND_CAMEL_CASE="isMaster",t.kDecorateResult=Symbol.for("@@mdb.decorateDecryptionResult"),t.kDecoratedKeys=Symbol.for("@@mdb.decryptedKeys")},92992:(e,t,n)=>{var r=n(44775);t.certificate=n(58782);var i=r.define("RSAPrivateKey",(function(){this.seq().obj(this.key("version").int(),this.key("modulus").int(),this.key("publicExponent").int(),this.key("privateExponent").int(),this.key("prime1").int(),this.key("prime2").int(),this.key("exponent1").int(),this.key("exponent2").int(),this.key("coefficient").int())}));t.RSAPrivateKey=i;var o=r.define("RSAPublicKey",(function(){this.seq().obj(this.key("modulus").int(),this.key("publicExponent").int())}));t.RSAPublicKey=o;var s=r.define("AlgorithmIdentifier",(function(){this.seq().obj(this.key("algorithm").objid(),this.key("none").null_().optional(),this.key("curve").objid().optional(),this.key("params").seq().obj(this.key("p").int(),this.key("q").int(),this.key("g").int()).optional())})),a=r.define("SubjectPublicKeyInfo",(function(){this.seq().obj(this.key("algorithm").use(s),this.key("subjectPublicKey").bitstr())}));t.PublicKey=a;var u=r.define("PrivateKeyInfo",(function(){this.seq().obj(this.key("version").int(),this.key("algorithm").use(s),this.key("subjectPrivateKey").octstr())}));t.PrivateKey=u;var c=r.define("EncryptedPrivateKeyInfo",(function(){this.seq().obj(this.key("algorithm").seq().obj(this.key("id").objid(),this.key("decrypt").seq().obj(this.key("kde").seq().obj(this.key("id").objid(),this.key("kdeparams").seq().obj(this.key("salt").octstr(),this.key("iters").int())),this.key("cipher").seq().obj(this.key("algo").objid(),this.key("iv").octstr()))),this.key("subjectPrivateKey").octstr())}));t.EncryptedPrivateKey=c;var l=r.define("DSAPrivateKey",(function(){this.seq().obj(this.key("version").int(),this.key("p").int(),this.key("q").int(),this.key("g").int(),this.key("pub_key").int(),this.key("priv_key").int())}));t.DSAPrivateKey=l,t.DSAparam=r.define("DSAparam",(function(){this.int()}));var h=r.define("ECParameters",(function(){this.choice({namedCurve:this.objid()})})),d=r.define("ECPrivateKey",(function(){this.seq().obj(this.key("version").int(),this.key("privateKey").octstr(),this.key("parameters").optional().explicit(0).use(h),this.key("publicKey").optional().explicit(1).bitstr())}));t.ECPrivateKey=d,t.signature=r.define("signature",(function(){this.seq().obj(this.key("r").int(),this.key("s").int())}))},93065:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.AUTH_MECHS_AUTH_SRC_EXTERNAL=t.AuthMechanism=void 0,t.AuthMechanism=Object.freeze({MONGODB_AWS:"MONGODB-AWS",MONGODB_CR:"MONGODB-CR",MONGODB_DEFAULT:"DEFAULT",MONGODB_GSSAPI:"GSSAPI",MONGODB_PLAIN:"PLAIN",MONGODB_SCRAM_SHA1:"SCRAM-SHA-1",MONGODB_SCRAM_SHA256:"SCRAM-SHA-256",MONGODB_X509:"MONGODB-X509",MONGODB_OIDC:"MONGODB-OIDC"}),t.AUTH_MECHS_AUTH_SRC_EXTERNAL=new Set([t.AuthMechanism.MONGODB_GSSAPI,t.AuthMechanism.MONGODB_AWS,t.AuthMechanism.MONGODB_OIDC,t.AuthMechanism.MONGODB_X509])},93347:(e,t,n)=>{var r=n(65994).e;Object.defineProperty(t,"__esModule",{value:!0}),t.MongoLogger=t.MongoLoggableComponent=t.SEVERITY_LEVEL_MAP=t.DEFAULT_MAX_DOCUMENT_LENGTH=t.SeverityLevel=void 0,t.parseSeverityFromString=c,t.createStdioLogger=l,t.stringifyWithMaxLen=f,t.defaultLogTransform=v;const i=n(98437),o=n(75080),s=n(91869),a=n(145);t.SeverityLevel=Object.freeze({EMERGENCY:"emergency",ALERT:"alert",CRITICAL:"critical",ERROR:"error",WARNING:"warn",NOTICE:"notice",INFORMATIONAL:"info",DEBUG:"debug",TRACE:"trace",OFF:"off"}),t.DEFAULT_MAX_DOCUMENT_LENGTH=1e3;class u extends Map{constructor(e){const t=[];for(const[n,r]of e)t.push([r,n]);t.push(...e),super(t)}getNumericSeverityLevel(e){return this.get(e)}getSeverityLevelName(e){return this.get(e)}}function c(e){const n=Object.values(t.SeverityLevel),r=e?.toLowerCase();return null!=r&&n.includes(r)?r:null}function l(e){return{write:(0,i.promisify)(((t,n)=>{const r=(0,i.inspect)(t,{compact:!0,breakLength:1/0});e.write(`${r}\n`,"utf-8",n)}))}}function h(e,t,n){return c(e)??c(t)??n}function d(e,n){const r=t.SEVERITY_LEVEL_MAP.getNumericSeverityLevel(e),i=t.SEVERITY_LEVEL_MAP.getNumericSeverityLevel(n);return r<i?-1:r>i?1:0}function f(e,t,n={}){let r="",i=0;const s=function(e,n){if(!(i>=t)){if(""===e)return i+=1,n;if(i+=e.length+4,null==n)return n;switch(typeof n){case"string":i+=n.length+2;break;case"number":case"bigint":i+=String(n).length;break;case"boolean":i+=n?4:5;break;case"object":if((0,a.isUint8Array)(n))i+=22+n.byteLength+.33*n.byteLength+18|0;else if("_bsontype"in n){const e=n;switch(e._bsontype){case"Int32":i+=String(e.value).length;break;case"Double":i+=(0|e.value)===e.value?String(e.value).length+2:String(e.value).length;break;case"Long":i+=e.toString().length;break;case"ObjectId":i+=35;break;case"MaxKey":case"MinKey":i+=13;break;case"Binary":i+=22+n.position+.33*n.position+18|0;break;case"Timestamp":i+=19+String(e.t).length+5+String(e.i).length+2;break;case"Code":null==e.scope?i+=e.code.length+10+2:i+=e.code.length+10+11;break;case"BSONRegExp":i+=34+e.pattern.length+13+e.options.length+3}}}return n}};if("string"==typeof e)r=e;else if("function"==typeof e)r=e.name;else try{r=0!==t?o.EJSON.stringify(e,s,0,n):o.EJSON.stringify(e,n)}catch(e){r=`Extended JSON serialization failed with: ${e.message}`}return 0!==t&&r.length>t&&r.charCodeAt(t-1)!==r.codePointAt(t-1)&&0==--t?"":0!==t&&r.length>t?`${r.slice(0,t)}...`:r}function p(e,n,r=t.DEFAULT_MAX_DOCUMENT_LENGTH){const{selector:i,operation:o,topologyDescription:s,message:a}=n;return e.selector=f(i,r),e.operation=o,e.topologyDescription=f(s,r),e.message=a,e}function m(e,t){e.commandName=t.commandName,e.requestId=t.requestId,e.driverConnectionId=t.connectionId;const{host:n,port:r}=a.HostAddress.fromString(t.address).toHostPort();return e.serverHost=n,e.serverPort=r,t?.serviceId&&(e.serviceId=t.serviceId.toHexString()),e.databaseName=t.databaseName,e.serverConnectionId=t.serverConnectionId,e}function g(e,t){const{host:n,port:r}=a.HostAddress.fromString(t.address).toHostPort();return e.serverHost=n,e.serverPort=r,e}function _(e,t){return e.topologyId=t.topologyId,e}function y(e,t){const{awaited:n,connectionId:r}=t;e.awaited=n,e.driverConnectionId=t.connectionId;const{host:i,port:o}=a.HostAddress.fromString(r).toHostPort();return e.serverHost=i,e.serverPort=o,e}function v(e,n=t.DEFAULT_MAX_DOCUMENT_LENGTH){let r=Object.create(null);switch(e.name){case s.SERVER_SELECTION_STARTED:return r=p(r,e,n),r;case s.SERVER_SELECTION_FAILED:return r=p(r,e,n),r.failure=e.failure?.message,r;case s.SERVER_SELECTION_SUCCEEDED:return r=p(r,e,n),r.serverHost=e.serverHost,r.serverPort=e.serverPort,r;case s.WAITING_FOR_SUITABLE_SERVER:return r=p(r,e,n),r.remainingTimeMS=e.remainingTimeMS,r;case s.COMMAND_STARTED:return r=m(r,e),r.message="Command started",r.command=f(e.command,n,{relaxed:!0}),r.databaseName=e.databaseName,r;case s.COMMAND_SUCCEEDED:return r=m(r,e),r.message="Command succeeded",r.durationMS=e.duration,r.reply=f(e.reply,n,{relaxed:!0}),r;case s.COMMAND_FAILED:return r=m(r,e),r.message="Command failed",r.durationMS=e.duration,r.failure=e.failure?.message??"(redacted)",r;case s.CONNECTION_POOL_CREATED:if(r=g(r,e),r.message="Connection pool created",e.options){const{maxIdleTimeMS:t,minPoolSize:n,maxPoolSize:i,maxConnecting:o,waitQueueTimeoutMS:s}=e.options;r={...r,maxIdleTimeMS:t,minPoolSize:n,maxPoolSize:i,maxConnecting:o,waitQueueTimeoutMS:s}}return r;case s.CONNECTION_POOL_READY:return r=g(r,e),r.message="Connection pool ready",r;case s.CONNECTION_POOL_CLEARED:return r=g(r,e),r.message="Connection pool cleared","ObjectId"===e.serviceId?._bsontype&&(r.serviceId=e.serviceId?.toHexString()),r;case s.CONNECTION_POOL_CLOSED:return r=g(r,e),r.message="Connection pool closed",r;case s.CONNECTION_CREATED:return r=g(r,e),r.message="Connection created",r.driverConnectionId=e.connectionId,r;case s.CONNECTION_READY:return r=g(r,e),r.message="Connection ready",r.driverConnectionId=e.connectionId,r.durationMS=e.durationMS,r;case s.CONNECTION_CLOSED:switch(r=g(r,e),r.message="Connection closed",r.driverConnectionId=e.connectionId,e.reason){case"stale":r.reason="Connection became stale because the pool was cleared";break;case"idle":r.reason="Connection has been available but unused for longer than the configured max idle time";break;case"error":r.reason="An error occurred while using the connection",e.error&&(r.error=e.error);break;case"poolClosed":r.reason="Connection pool was closed";break;default:r.reason=`Unknown close reason: ${e.reason}`}return r;case s.CONNECTION_CHECK_OUT_STARTED:return r=g(r,e),r.message="Connection checkout started",r;case s.CONNECTION_CHECK_OUT_FAILED:switch(r=g(r,e),r.message="Connection checkout failed",e.reason){case"poolClosed":r.reason="Connection pool was closed";break;case"timeout":r.reason="Wait queue timeout elapsed without a connection becoming available";break;case"connectionError":r.reason="An error occurred while trying to establish a new connection",e.error&&(r.error=e.error);break;default:r.reason=`Unknown close reason: ${e.reason}`}return r.durationMS=e.durationMS,r;case s.CONNECTION_CHECKED_OUT:return r=g(r,e),r.message="Connection checked out",r.driverConnectionId=e.connectionId,r.durationMS=e.durationMS,r;case s.CONNECTION_CHECKED_IN:return r=g(r,e),r.message="Connection checked in",r.driverConnectionId=e.connectionId,r;case s.SERVER_OPENING:return r=_(r,e),r=g(r,e),r.message="Starting server monitoring",r;case s.SERVER_CLOSED:return r=_(r,e),r=g(r,e),r.message="Stopped server monitoring",r;case s.SERVER_HEARTBEAT_STARTED:return r=_(r,e),r=y(r,e),r.message="Server heartbeat started",r;case s.SERVER_HEARTBEAT_SUCCEEDED:return r=_(r,e),r=y(r,e),r.message="Server heartbeat succeeded",r.durationMS=e.duration,r.serverConnectionId=e.serverConnectionId,r.reply=f(e.reply,n,{relaxed:!0}),r;case s.SERVER_HEARTBEAT_FAILED:return r=_(r,e),r=y(r,e),r.message="Server heartbeat failed",r.durationMS=e.duration,r.failure=e.failure?.message,r;case s.TOPOLOGY_OPENING:return r=_(r,e),r.message="Starting topology monitoring",r;case s.TOPOLOGY_CLOSED:return r=_(r,e),r.message="Stopped topology monitoring",r;case s.TOPOLOGY_DESCRIPTION_CHANGED:return r=_(r,e),r.message="Topology description changed",r.previousDescription=r.reply=f(e.previousDescription,n),r.newDescription=r.reply=f(e.newDescription,n),r;default:for(const[t,n]of Object.entries(e))null!=n&&(r[t]=n)}return r}t.SEVERITY_LEVEL_MAP=new u([[t.SeverityLevel.OFF,-1/0],[t.SeverityLevel.EMERGENCY,0],[t.SeverityLevel.ALERT,1],[t.SeverityLevel.CRITICAL,2],[t.SeverityLevel.ERROR,3],[t.SeverityLevel.WARNING,4],[t.SeverityLevel.NOTICE,5],[t.SeverityLevel.INFORMATIONAL,6],[t.SeverityLevel.DEBUG,7],[t.SeverityLevel.TRACE,8]]),t.MongoLoggableComponent=Object.freeze({COMMAND:"command",TOPOLOGY:"topology",SERVER_SELECTION:"serverSelection",CONNECTION:"connection",CLIENT:"client"}),t.MongoLogger=class{constructor(e){this.pendingLog=null,this.error=this.log.bind(this,"error"),this.warn=this.log.bind(this,"warn"),this.info=this.log.bind(this,"info"),this.debug=this.log.bind(this,"debug"),this.trace=this.log.bind(this,"trace"),this.componentSeverities=e.componentSeverities,this.maxDocumentLength=e.maxDocumentLength,this.logDestination=e.logDestination,this.logDestinationIsStdErr=e.logDestinationIsStdErr,this.severities=this.createLoggingSeverities()}createLoggingSeverities(){const e=Object();for(const n of Object.values(t.MongoLoggableComponent)){e[n]={};for(const r of Object.values(t.SeverityLevel))e[n][r]=d(r,this.componentSeverities[n])<=0}return e}turnOffSeverities(){for(const e of Object.values(t.MongoLoggableComponent)){this.componentSeverities[e]=t.SeverityLevel.OFF;for(const n of Object.values(t.SeverityLevel))this.severities[e][n]=!1}}logWriteFailureHandler(e){if(this.logDestinationIsStdErr)return this.turnOffSeverities(),void this.clearPendingLog();this.logDestination=l(r.stderr),this.logDestinationIsStdErr=!0,this.clearPendingLog(),this.error(t.MongoLoggableComponent.CLIENT,{toLog:function(){return{message:"User input for mongodbLogPath is now invalid. Logging is halted.",error:e.message}}}),this.turnOffSeverities(),this.clearPendingLog()}clearPendingLog(){this.pendingLog=null}willLog(e,n){return n!==t.SeverityLevel.OFF&&this.severities[e][n]}log(e,t,n){if(!this.willLog(t,e))return;let r={t:new Date,c:t,s:e};if("string"==typeof n?r.message=n:"object"==typeof n&&(r=function(e){const t=e;return void 0!==t.toLog&&"function"==typeof t.toLog}(n)?{...r,...n.toLog()}:{...r,...v(n,this.maxDocumentLength)}),(0,a.isPromiseLike)(this.pendingLog))this.pendingLog=this.pendingLog.then((()=>this.logDestination.write(r))).then(this.clearPendingLog.bind(this),this.logWriteFailureHandler.bind(this));else try{const e=this.logDestination.write(r);(0,a.isPromiseLike)(e)&&(this.pendingLog=e.then(this.clearPendingLog.bind(this),this.logWriteFailureHandler.bind(this)))}catch(e){this.logWriteFailureHandler(e)}}static resolveOptions(e,n){const i=function({MONGODB_LOG_PATH:e},{mongodbLogPath:t}){return"string"==typeof t&&/^stderr$/i.test(t)?{mongodbLogPath:l(r.stderr),mongodbLogPathIsStdErr:!0}:"string"==typeof t&&/^stdout$/i.test(t)?{mongodbLogPath:l(r.stdout),mongodbLogPathIsStdErr:!1}:"object"==typeof t&&"function"==typeof t?.write?{mongodbLogPath:t,mongodbLogPathIsStdErr:!1}:e&&/^stderr$/i.test(e)?{mongodbLogPath:l(r.stderr),mongodbLogPathIsStdErr:!0}:e&&/^stdout$/i.test(e)?{mongodbLogPath:l(r.stdout),mongodbLogPathIsStdErr:!1}:{mongodbLogPath:l(r.stderr),mongodbLogPathIsStdErr:!0}}(e,n),o={...e,...n,mongodbLogPath:i.mongodbLogPath,mongodbLogPathIsStdErr:i.mongodbLogPathIsStdErr},s=h(o.mongodbLogComponentSeverities?.default,o.MONGODB_LOG_ALL,t.SeverityLevel.OFF);return{componentSeverities:{command:h(o.mongodbLogComponentSeverities?.command,o.MONGODB_LOG_COMMAND,s),topology:h(o.mongodbLogComponentSeverities?.topology,o.MONGODB_LOG_TOPOLOGY,s),serverSelection:h(o.mongodbLogComponentSeverities?.serverSelection,o.MONGODB_LOG_SERVER_SELECTION,s),connection:h(o.mongodbLogComponentSeverities?.connection,o.MONGODB_LOG_CONNECTION,s),client:h(o.mongodbLogComponentSeverities?.client,o.MONGODB_LOG_CLIENT,s),default:s},maxDocumentLength:o.mongodbLogMaxDocumentLength??(0,a.parseUnsignedInteger)(o.MONGODB_LOG_MAX_DOCUMENT_LENGTH)??1e3,logDestination:o.mongodbLogPath,logDestinationIsStdErr:o.mongodbLogPathIsStdErr}}}},93549:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.EstimatedDocumentCountOperation=void 0;const r=n(75725),i=n(78130),o=n(35394);class s extends i.CommandOperation{constructor(e,t={}){super(e,t),this.SERVER_COMMAND_RESPONSE_TYPE=r.MongoDBResponse,this.options=t,this.collectionName=e.collectionName}get commandName(){return"count"}buildCommandDocument(e,t){const n={count:this.collectionName};return"number"==typeof this.options.maxTimeMS&&(n.maxTimeMS=this.options.maxTimeMS),void 0!==this.options.comment&&(n.comment=this.options.comment),n}handleOk(e){return e.getNumber("n")??0}}t.EstimatedDocumentCountOperation=s,(0,o.defineAspects)(s,[o.Aspect.READ_OPERATION,o.Aspect.RETRYABLE,o.Aspect.CURSOR_CREATING])},93992:(e,t,n)=>{var r=n(67787).Buffer;Object.defineProperty(t,"__esModule",{value:!0}),t.hmacSha256Hook=t.hmacSha512Hook=t.aes256CtrDecryptHook=t.aes256CtrEncryptHook=t.aes256CbcDecryptHook=t.aes256CbcEncryptHook=void 0,t.makeAES256Hook=o,t.randomHook=function(e,t){try{i.randomFillSync(e,0,t)}catch(e){return e}return t},t.sha256Hook=function(e,t){let n;try{n=i.createHash("sha256").update(e).digest()}catch(e){return e}return n.copy(t),n.length},t.makeHmacHook=s,t.signRsaSha256Hook=function(e,t,n){let o;try{const n=i.createSign("sha256WithRSAEncryption"),s=r.from(`-----BEGIN PRIVATE KEY-----\n${e.toString("base64")}\n-----END PRIVATE KEY-----\n`);o=n.update(t).end().sign(s)}catch(e){return e}return o.copy(n),o.length};const i=n(27348);function o(e,t){return function(n,o,s,a){let u;try{const a=i[e](t,n,o);a.setAutoPadding(!1),u=a.update(s);const c=a.final();c.length>0&&(u=r.concat([u,c]))}catch(e){return e}return u.copy(a),u.length}}function s(e){return(t,n,r)=>{let o;try{o=i.createHmac(e,t).update(n).digest()}catch(e){return e}return o.copy(r),o.length}}t.aes256CbcEncryptHook=o("createCipheriv","aes-256-cbc"),t.aes256CbcDecryptHook=o("createDecipheriv","aes-256-cbc"),t.aes256CtrEncryptHook=o("createCipheriv","aes-256-ctr"),t.aes256CtrDecryptHook=o("createDecipheriv","aes-256-ctr"),t.hmacSha512Hook=s("sha512"),t.hmacSha256Hook=s("sha256")},94330:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ReplaceOneOperation=t.UpdateManyOperation=t.UpdateOneOperation=t.UpdateOperation=void 0,t.makeUpdateStatement=f;const r=n(75725),i=n(17562),o=n(30770),s=n(145),a=n(78130),u=n(35394);class c extends a.CommandOperation{constructor(e,t,n){super(void 0,n),this.SERVER_COMMAND_RESPONSE_TYPE=r.MongoDBResponse,this.options=n,this.ns=e,this.statements=t}get commandName(){return"update"}get canRetryWrite(){return!1!==super.canRetryWrite&&this.statements.every((e=>null==e.multi||!1===e.multi))}buildCommandDocument(e,t){const n=this.options,r={update:this.ns.collection,updates:this.statements,ordered:n.ordered??!0};if("boolean"==typeof n.bypassDocumentValidation&&(r.bypassDocumentValidation=n.bypassDocumentValidation),n.let&&(r.let=n.let),void 0!==n.comment&&(r.comment=n.comment),0===this.writeConcern?.w&&this.statements.find((e=>e.hint)))throw new i.MongoCompatibilityError("hint is not supported with unacknowledged writes");return r}}t.UpdateOperation=c;class l extends c{constructor(e,t,n,r){if(super(e,[f(t,n,{...r,multi:!1})],r),!(0,s.hasAtomicOperators)(n,r))throw new i.MongoInvalidArgumentError("Update document requires atomic operators")}handleOk(e){const t=super.handleOk(e);if(null!=this.explain)return t;if(t.code)throw new i.MongoServerError(t);if(t.writeErrors)throw new i.MongoServerError(t.writeErrors[0]);return{acknowledged:0!==this.writeConcern?.w,modifiedCount:t.nModified??t.n,upsertedId:Array.isArray(t.upserted)&&t.upserted.length>0?t.upserted[0]._id:null,upsertedCount:Array.isArray(t.upserted)&&t.upserted.length?t.upserted.length:0,matchedCount:Array.isArray(t.upserted)&&t.upserted.length>0?0:t.n}}}t.UpdateOneOperation=l;class h extends c{constructor(e,t,n,r){if(super(e,[f(t,n,{...r,multi:!0})],r),!(0,s.hasAtomicOperators)(n,r))throw new i.MongoInvalidArgumentError("Update document requires atomic operators")}handleOk(e){const t=super.handleOk(e);if(null!=this.explain)return t;if(t.code)throw new i.MongoServerError(t);if(t.writeErrors)throw new i.MongoServerError(t.writeErrors[0]);return{acknowledged:0!==this.writeConcern?.w,modifiedCount:t.nModified??t.n,upsertedId:Array.isArray(t.upserted)&&t.upserted.length>0?t.upserted[0]._id:null,upsertedCount:Array.isArray(t.upserted)&&t.upserted.length?t.upserted.length:0,matchedCount:Array.isArray(t.upserted)&&t.upserted.length>0?0:t.n}}}t.UpdateManyOperation=h;class d extends c{constructor(e,t,n,r){if(super(e,[f(t,n,{...r,multi:!1})],r),(0,s.hasAtomicOperators)(n))throw new i.MongoInvalidArgumentError("Replacement document must not contain atomic operators")}handleOk(e){const t=super.handleOk(e);if(null!=this.explain)return t;if(t.code)throw new i.MongoServerError(t);if(t.writeErrors)throw new i.MongoServerError(t.writeErrors[0]);return{acknowledged:0!==this.writeConcern?.w,modifiedCount:t.nModified??t.n,upsertedId:Array.isArray(t.upserted)&&t.upserted.length>0?t.upserted[0]._id:null,upsertedCount:Array.isArray(t.upserted)&&t.upserted.length?t.upserted.length:0,matchedCount:Array.isArray(t.upserted)&&t.upserted.length>0?0:t.n}}}function f(e,t,n){if(null==e||"object"!=typeof e)throw new i.MongoInvalidArgumentError("Selector must be a valid JavaScript object");if(null==t||"object"!=typeof t)throw new i.MongoInvalidArgumentError("Document must be a valid JavaScript object");const r={q:e,u:t};return"boolean"==typeof n.upsert&&(r.upsert=n.upsert),n.multi&&(r.multi=n.multi),n.hint&&(r.hint=n.hint),n.arrayFilters&&(r.arrayFilters=n.arrayFilters),n.collation&&(r.collation=n.collation),n.multi||null==n.sort||(r.sort=(0,o.formatSort)(n.sort)),r}t.ReplaceOneOperation=d,(0,u.defineAspects)(c,[u.Aspect.RETRYABLE,u.Aspect.WRITE_OPERATION,u.Aspect.SKIP_COLLATION]),(0,u.defineAspects)(l,[u.Aspect.RETRYABLE,u.Aspect.WRITE_OPERATION,u.Aspect.EXPLAINABLE,u.Aspect.SKIP_COLLATION]),(0,u.defineAspects)(h,[u.Aspect.WRITE_OPERATION,u.Aspect.EXPLAINABLE,u.Aspect.SKIP_COLLATION]),(0,u.defineAspects)(d,[u.Aspect.RETRYABLE,u.Aspect.WRITE_OPERATION,u.Aspect.SKIP_COLLATION])},95421:e=>{var t=Object.getOwnPropertySymbols,n=Object.prototype.hasOwnProperty,r=Object.prototype.propertyIsEnumerable;e.exports=function(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var t={},n=0;n<10;n++)t["_"+String.fromCharCode(n)]=n;if("0123456789"!==Object.getOwnPropertyNames(t).map((function(e){return t[e]})).join(""))return!1;var r={};return"abcdefghijklmnopqrst".split("").forEach((function(e){r[e]=e})),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},r)).join("")}catch(e){return!1}}()?Object.assign:function(e,i){for(var o,s,a=function(e){if(null==e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}(e),u=1;u<arguments.length;u++){for(var c in o=Object(arguments[u]))n.call(o,c)&&(a[c]=o[c]);if(t){s=t(o);for(var l=0;l<s.length;l++)r.call(o,s[l])&&(a[s[l]]=o[s[l]])}}return a}},95662:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.DropDatabaseOperation=t.DropCollectionOperation=void 0,t.dropCollections=async function(e,t,n){const i=a.TimeoutContext.create({session:n.session,serverSelectionTimeoutMS:e.client.s.options.serverSelectionTimeoutMS,waitQueueTimeoutMS:e.client.s.options.waitQueueTimeoutMS,timeoutMS:n.timeoutMS}),u=e.client.s.options.autoEncryption?.encryptedFieldsMap;let l=n.encryptedFields??u?.[`${e.databaseName}.${t}`];if(!l&&u){const r=await e.listCollections({name:t},{nameOnly:!1,session:n.session,timeoutContext:new o.CursorTimeoutContext(i,Symbol())}).toArray();l=r?.[0]?.options?.encryptedFields}if(l){const o=l.escCollection||`enxcol_.${t}.esc`,a=l.ecocCollection||`enxcol_.${t}.ecoc`;for(const t of[o,a]){const o=new h(e,t,n);try{await(0,c.executeOperation)(e.client,o,i)}catch(e){if(!(e instanceof r.MongoServerError)||e.code!==s.MONGODB_ERROR_CODES.NamespaceNotFound)throw e}}}return await(0,c.executeOperation)(e.client,new h(e,t,n),i)};const r=n(16360),i=n(75725),o=n(61066),s=n(17562),a=n(7799),u=n(78130),c=n(96357),l=n(35394);class h extends u.CommandOperation{constructor(e,t,n={}){super(e,n),this.SERVER_COMMAND_RESPONSE_TYPE=i.MongoDBResponse,this.options=n,this.name=t}get commandName(){return"drop"}buildCommandDocument(e,t){return{drop:this.name}}handleOk(e){return!0}}t.DropCollectionOperation=h;class d extends u.CommandOperation{constructor(e,t){super(e,t),this.SERVER_COMMAND_RESPONSE_TYPE=i.MongoDBResponse,this.options=t}get commandName(){return"dropDatabase"}buildCommandDocument(e,t){return{dropDatabase:1}}handleOk(e){return!0}}t.DropDatabaseOperation=d,(0,l.defineAspects)(h,[l.Aspect.WRITE_OPERATION]),(0,l.defineAspects)(d,[l.Aspect.WRITE_OPERATION])},95724:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.MongocryptdManager=void 0;const r=n(17562);class i{constructor(e={}){this.spawnPath="",this.spawnArgs=[],this.uri="string"==typeof e.mongocryptdURI&&e.mongocryptdURI.length>0?e.mongocryptdURI:i.DEFAULT_MONGOCRYPTD_URI,this.bypassSpawn=!!e.mongocryptdBypassSpawn,Object.hasOwn(e,"mongocryptdSpawnPath")&&e.mongocryptdSpawnPath&&(this.spawnPath=e.mongocryptdSpawnPath),Object.hasOwn(e,"mongocryptdSpawnArgs")&&Array.isArray(e.mongocryptdSpawnArgs)&&(this.spawnArgs=this.spawnArgs.concat(e.mongocryptdSpawnArgs)),this.spawnArgs.filter((e=>"string"==typeof e)).every((e=>e.indexOf("--idleShutdownTimeoutSecs")<0))&&this.spawnArgs.push("--idleShutdownTimeoutSecs","60")}async spawn(){const e=this.spawnPath||"mongocryptd",{spawn:t}=n(16154);this._child=t(e,this.spawnArgs,{stdio:"ignore",detached:!0}),this._child.on("error",(()=>{})),this._child.unref()}async withRespawn(e){try{return await e()}catch(e){if(!(e instanceof r.MongoNetworkTimeoutError)||this.bypassSpawn)throw e}return await this.spawn(),await e()}}t.MongocryptdManager=i,i.DEFAULT_MONGOCRYPTD_URI="mongodb://localhost:27020"},95750:(e,t,n)=>{var r=n(65994).e;Object.defineProperty(t,"__esModule",{value:!0}),t.GSSAPI=t.GSSAPICanonicalizationValue=void 0,t.performGSSAPICanonicalizeHostName=f,t.resolveCname=p;const i=n(95136),o=n(8500),s=n(17562),a=n(145),u=n(31057);async function c(e,t){return await e.command((0,a.ns)("$external.$cmd"),t)}let l;t.GSSAPICanonicalizationValue=Object.freeze({on:!0,off:!1,none:"none",forward:"forward",forwardAndReverse:"forwardAndReverse"});class h extends u.AuthProvider{async auth(e){const{connection:t,credentials:n}=e;if(null==n)throw new s.MongoMissingCredentialsError("Credentials required for GSSAPI authentication");const{username:i}=n,a=await async function(e){const{hostAddress:t}=e.options,{credentials:n}=e;if(!t||"string"!=typeof t.host||!n)throw new s.MongoInvalidArgumentError("Connection must have host and port and credentials defined.");if(l||(l=(0,o.getKerberos)()),"kModuleError"in l)throw l.kModuleError;const{initializeClient:i}=l,{username:a,password:u}=n,c=n.mechanismProperties,h=c.SERVICE_NAME??"mongodb",d=await f(t.host,c),p={};null!=u&&Object.assign(p,{user:a,password:u});const m=c.SERVICE_HOST??d;let g=`${h}${"win32"===r.platform?"/":"@"}${m}`;return"SERVICE_REALM"in c&&(g=`${g}@${c.SERVICE_REALM}`),await i(g,p)}(e),u=await a.step(""),h=await c(t,function(e){return{saslStart:1,mechanism:"GSSAPI",payload:e,autoAuthorize:1}}(u)),p=await d(a,10,h.payload),m=await c(t,function(e,t){return{saslContinue:1,conversationId:t,payload:e}}(p,h.conversationId)),g=await async function(e,t,n){const r=await e.unwrap(n);return await e.wrap(r||"",{user:t})}(a,i,m.payload);await c(t,{saslContinue:1,conversationId:m.conversationId,payload:g})}}async function d(e,t,n){try{return await e.step(n)||""}catch(r){if(0===t)throw r;return await d(e,t-1,n)}}async function f(e,n){const r=n.CANONICALIZE_HOST_NAME;if(!r||r===t.GSSAPICanonicalizationValue.none)return e;if(r!==t.GSSAPICanonicalizationValue.on&&r!==t.GSSAPICanonicalizationValue.forwardAndReverse)return await p(e);{const{address:t}=await i.promises.lookup(e);try{const n=await i.promises.resolvePtr(t);return n.length>0?n[0]:e}catch{return await p(e)}}}async function p(e){try{const t=await i.promises.resolveCname(e);return t.length>0?t[0]:e}catch{return e}}t.GSSAPI=h},96357:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.executeOperation=async function(e,t,n){if(!(t instanceof c.AbstractOperation))throw new r.MongoRuntimeError("This method requires a valid operation instance");const f=null==e.topology?await(0,a.abortable)(d(e),t.options):e.topology;let p,m=t.session;if(null==m)p=Symbol(),m=e.startSession({owner:p,explicit:!1});else{if(m.hasEnded)throw new r.MongoExpiredSessionError("Use of expired sessions is not permitted");if(m.snapshotEnabled&&!f.capabilities.supportsSnapshotReads)throw new r.MongoCompatibilityError("Snapshot reads require MongoDB 5.0 or later");if(m.client!==e)throw new r.MongoInvalidArgumentError("ClientSession must be from the same MongoClient")}t.session??=m;const g=t.readPreference??i.ReadPreference.primary,_=!!m?.inTransaction(),y=t.hasAspect(c.Aspect.READ_OPERATION);if(_&&!g.equals(i.ReadPreference.primary)&&(y||"runCommand"===t.commandName))throw new r.MongoTransactionError(`Read preference in a transaction must be primary, not: ${g.mode}`);m?.isPinned&&m.transaction.isCommitted&&!t.bypassPinningCheck&&m.unpin(),n??=s.TimeoutContext.create({session:m,serverSelectionTimeoutMS:e.s.options.serverSelectionTimeoutMS,waitQueueTimeoutMS:e.s.options.waitQueueTimeoutMS,timeoutMS:t.options.timeoutMS});try{return await async function(e,{topology:t,timeoutContext:n,session:i,readPreference:s}){let d;d=e.hasAspect(c.Aspect.MUST_SELECT_SAME_SERVER)?(0,o.sameServerSelector)(e.server?.description):e instanceof u.AggregateOperation&&e.hasWriteStage?(0,o.secondaryWritableServerSelector)(t.commonWireVersion,s):s;let f=await t.selectServer(d,{session:i,operationName:e.commandName,timeoutContext:n,signal:e.options.signal});const p=e.hasAspect(c.Aspect.READ_OPERATION),m=e.hasAspect(c.Aspect.WRITE_OPERATION),g=i?.inTransaction()??!1,_=t.s.options.retryReads&&!g&&e.canRetryRead,y=t.s.options.retryWrites&&!g&&(0,a.supportsRetryableWrites)(f)&&e.canRetryWrite,v=e.hasAspect(c.Aspect.RETRYABLE)&&null!=i&&(p&&_||m&&y);m&&y&&null!=i&&(e.options.willRetryWrite=!0,i.incrementTransactionNumber());const E=v?n.csotEnabled()?1/0:2:1;let S,w;for(let o=0;o<E;o++){if(S){if(m&&S.code===l)throw new r.MongoServerError({message:h,errmsg:h,originalError:S});if(e.hasAspect(c.Aspect.COMMAND_BATCHING)&&!e.canRetryWrite)throw S;if(m&&!(0,r.isRetryableWriteError)(S))throw S;if(p&&!(0,r.isRetryableReadError)(S))throw S;if(S instanceof r.MongoNetworkError&&e.hasAspect(c.Aspect.CURSOR_CREATING)&&null!=i&&i.isPinned&&!i.inTransaction()&&i.unpin({force:!0,forceClear:!0}),f=await t.selectServer(d,{session:i,operationName:e.commandName,previousServer:w,signal:e.options.signal}),m&&!(0,a.supportsRetryableWrites)(f))throw new r.MongoUnexpectedServerResponseError("Selected server does not support retryable writes")}e.server=f;try{o>0&&e.hasAspect(c.Aspect.COMMAND_BATCHING)&&e.resetBatch();try{const t=await f.command(e,n);return e.handleOk(t)}catch(t){return e.handleError(t)}}catch(e){if(!(e instanceof r.MongoError))throw e;if(null!=S&&e.hasErrorLabel(r.MongoErrorLabel.NoWritesPerformed))throw S;w=f.description,S=e,n.clear()}}throw S??new r.MongoRuntimeError("Tried to propagate retryability error, but no error was found.")}(t,{topology:f,timeoutContext:n,session:m,readPreference:g})}finally{null!=m?.owner&&m.owner===p&&await m.endSession()}},t.autoConnect=d;const r=n(17562),i=n(13700),o=n(30588),s=n(7799),a=n(145),u=n(62016),c=n(35394),l=r.MONGODB_ERROR_CODES.IllegalOperation,h="This MongoDB deployment does not support retryable writes. Please add retryWrites=false to your connection string.";async function d(e){if(null==e.topology){if(e.s.hasBeenClosed)throw new r.MongoNotConnectedError("Client must be connected before running operations");e.s.options.__skipPingOnConnect=!0;try{if(await e.connect(),null==e.topology)throw new r.MongoRuntimeError("client.connect did not create a topology but also did not throw");return e.topology}finally{delete e.s.options.__skipPingOnConnect}}return e.topology}},96856:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.OP_MSG=t.OP_COMPRESSED=t.OP_DELETE=t.OP_QUERY=t.OP_INSERT=t.OP_UPDATE=t.OP_REPLY=t.MIN_SUPPORTED_QE_SERVER_VERSION=t.MIN_SUPPORTED_QE_WIRE_VERSION=t.MAX_SUPPORTED_WIRE_VERSION=t.MIN_SUPPORTED_WIRE_VERSION=t.MAX_SUPPORTED_SERVER_VERSION=t.MIN_SUPPORTED_SERVER_VERSION=void 0,t.MIN_SUPPORTED_SERVER_VERSION="4.2",t.MAX_SUPPORTED_SERVER_VERSION="8.0",t.MIN_SUPPORTED_WIRE_VERSION=8,t.MAX_SUPPORTED_WIRE_VERSION=25,t.MIN_SUPPORTED_QE_WIRE_VERSION=21,t.MIN_SUPPORTED_QE_SERVER_VERSION="7.0",t.OP_REPLY=1,t.OP_UPDATE=2001,t.OP_INSERT=2002,t.OP_QUERY=2004,t.OP_DELETE=2006,t.OP_COMPRESSED=2012,t.OP_MSG=2013},97194:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.TopologyDescription=void 0;const r=n(75080),i=n(96856),o=n(17562),s=n(145),a=n(89167),u=n(9188),c=i.MIN_SUPPORTED_SERVER_VERSION,l=i.MAX_SUPPORTED_SERVER_VERSION,h=i.MIN_SUPPORTED_WIRE_VERSION,d=i.MAX_SUPPORTED_WIRE_VERSION,f=new Set([a.ServerType.Mongos,a.ServerType.Unknown]),p=new Set([a.ServerType.Mongos,a.ServerType.Standalone]),m=new Set([a.ServerType.RSSecondary,a.ServerType.RSArbiter,a.ServerType.RSOther]);class g{constructor(e,t=null,n=null,r=null,i=null,o=null,s=null){s=s??{},this.type=e??a.TopologyType.Unknown,this.servers=t??new Map,this.stale=!1,this.compatible=!0,this.heartbeatFrequencyMS=s.heartbeatFrequencyMS??0,this.localThresholdMS=s.localThresholdMS??15,this.setName=n??null,this.maxElectionId=i??null,this.maxSetVersion=r??null,this.commonWireVersion=o??0;for(const e of this.servers.values())if(e.type!==a.ServerType.Unknown&&e.type!==a.ServerType.LoadBalancer&&(e.minWireVersion>d&&(this.compatible=!1,this.compatibilityError=`Server at ${e.address} requires wire version ${e.minWireVersion}, but this version of the driver only supports up to ${d} (MongoDB ${l})`),e.maxWireVersion<h)){this.compatible=!1,this.compatibilityError=`Server at ${e.address} reports wire version ${e.maxWireVersion}, but this version of the driver requires at least ${h} (MongoDB ${c}).`;break}this.logicalSessionTimeoutMinutes=null;for(const[,e]of this.servers)if(e.isReadable){if(null==e.logicalSessionTimeoutMinutes){this.logicalSessionTimeoutMinutes=null;break}if(null==this.logicalSessionTimeoutMinutes){this.logicalSessionTimeoutMinutes=e.logicalSessionTimeoutMinutes;continue}this.logicalSessionTimeoutMinutes=Math.min(this.logicalSessionTimeoutMinutes,e.logicalSessionTimeoutMinutes)}}updateFromSrvPollingEvent(e,t=0){const n=e.hostnames(),r=new Set(this.servers.keys()),i=new Set(n),o=new Set;for(const e of r)i.delete(e),n.has(e)||o.add(e);if(0===i.size&&0===o.size)return this;const a=new Map(this.servers);for(const e of o)a.delete(e);if(i.size>0)if(0===t)for(const e of i)a.set(e,new u.ServerDescription(e));else if(a.size<t){const e=(0,s.shuffle)(i,t-a.size);for(const t of e)a.set(t,new u.ServerDescription(t))}return new g(this.type,a,this.setName,this.maxSetVersion,this.maxElectionId,this.commonWireVersion,{heartbeatFrequencyMS:this.heartbeatFrequencyMS,localThresholdMS:this.localThresholdMS})}update(e){const t=e.address;let{type:n,setName:r,maxSetVersion:i,maxElectionId:s,commonWireVersion:c}=this;const l=e.type,h=new Map(this.servers);if(0!==e.maxWireVersion&&(c=null==c?e.maxWireVersion:Math.min(c,e.maxWireVersion)),"string"==typeof e.setName&&"string"==typeof r&&e.setName!==r&&(n===a.TopologyType.Single?e=new u.ServerDescription(t):h.delete(t)),h.set(t,e),n===a.TopologyType.Single)return new g(a.TopologyType.Single,h,r,i,s,c,{heartbeatFrequencyMS:this.heartbeatFrequencyMS,localThresholdMS:this.localThresholdMS});if(n===a.TopologyType.Unknown&&(l===a.ServerType.Standalone&&1!==this.servers.size?h.delete(t):n=function(e){switch(e){case a.ServerType.Standalone:return a.TopologyType.Single;case a.ServerType.Mongos:return a.TopologyType.Sharded;case a.ServerType.RSPrimary:return a.TopologyType.ReplicaSetWithPrimary;case a.ServerType.RSOther:case a.ServerType.RSSecondary:return a.TopologyType.ReplicaSetNoPrimary;default:return a.TopologyType.Unknown}}(l)),n===a.TopologyType.Sharded&&(f.has(l)||h.delete(t)),n===a.TopologyType.ReplicaSetNoPrimary)if(p.has(l)&&h.delete(t),l===a.ServerType.RSPrimary){const t=_(h,e,r,i,s);n=t[0],r=t[1],i=t[2],s=t[3]}else if(m.has(l)){const t=function(e,t,n=null){const r=a.TopologyType.ReplicaSetNoPrimary;return(n=n??t.setName)!==t.setName?(e.delete(t.address),[r,n]):(t.allHosts.forEach((t=>{e.has(t)||e.set(t,new u.ServerDescription(t))})),t.me&&t.address!==t.me&&e.delete(t.address),[r,n])}(h,e,r);n=t[0],r=t[1]}if(n===a.TopologyType.ReplicaSetWithPrimary)if(p.has(l))h.delete(t),n=y(h);else if(l===a.ServerType.RSPrimary){const t=_(h,e,r,i,s);n=t[0],r=t[1],i=t[2],s=t[3]}else n=m.has(l)?function(e,t,n=null){if(null==n)throw new o.MongoRuntimeError('Argument "setName" is required if connected to a replica set');return(n!==t.setName||t.me&&t.address!==t.me)&&e.delete(t.address),y(e)}(h,e,r):y(h);return new g(n,h,r,i,s,c,{heartbeatFrequencyMS:this.heartbeatFrequencyMS,localThresholdMS:this.localThresholdMS})}get error(){const e=Array.from(this.servers.values()).filter((e=>e.error));return e.length>0?e[0].error:null}get hasKnownServers(){return Array.from(this.servers.values()).some((e=>e.type!==a.ServerType.Unknown))}get hasDataBearingServers(){return Array.from(this.servers.values()).some((e=>e.isDataBearing))}hasServer(e){return this.servers.has(e)}toJSON(){return r.EJSON.serialize(this)}}function _(e,t,n=null,r=null,i=null){const c=(e,t,n)=>`primary marked stale due to electionId/setVersion mismatch: server setVersion: ${e.setVersion}, server electionId: ${e.electionId}, topology setVersion: ${t}, topology electionId: ${n}`;if((n=n||t.setName)!==t.setName)return e.delete(t.address),[y(e),n,r,i];if(t.maxWireVersion>=17){const a=(0,s.compareObjectId)(i,t.electionId),l=0===a,h=-1===a,d=(r??-1)<=(t.setVersion??-1);if(!(h||l&&d))return e.set(t.address,new u.ServerDescription(t.address,void 0,{error:new o.MongoStalePrimaryError(c(t,r,i))})),[y(e),n,r,i];i=t.electionId,r=t.setVersion}else{const a=t.electionId?t.electionId:null;if(t.setVersion&&a){if(r&&i&&(r>t.setVersion||(0,s.compareObjectId)(i,a)>0))return e.set(t.address,new u.ServerDescription(t.address,void 0,{error:new o.MongoStalePrimaryError(c(t,r,i))})),[y(e),n,r,i];i=t.electionId}null!=t.setVersion&&(null==r||t.setVersion>r)&&(r=t.setVersion)}for(const[n,r]of e)if(r.type===a.ServerType.RSPrimary&&r.address!==t.address){e.set(n,new u.ServerDescription(r.address,void 0,{error:new o.MongoStalePrimaryError("primary marked stale due to discovery of newer primary")}));break}t.allHosts.forEach((t=>{e.has(t)||e.set(t,new u.ServerDescription(t))}));const l=Array.from(e.keys()),h=t.allHosts;return l.filter((e=>-1===h.indexOf(e))).forEach((t=>{e.delete(t)})),[y(e),n,r,i]}function y(e){for(const t of e.values())if(t.type===a.ServerType.RSPrimary)return a.TopologyType.ReplicaSetWithPrimary;return a.TopologyType.ReplicaSetNoPrimary}t.TopologyDescription=g},97350:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.DropSearchIndexOperation=void 0;const r=n(75725),i=n(17562),o=n(35394);class s extends o.AbstractOperation{constructor(e,t){super(),this.SERVER_COMMAND_RESPONSE_TYPE=r.MongoDBResponse,this.collection=e,this.name=t,this.ns=e.fullNamespace}get commandName(){return"dropSearchIndex"}buildCommand(e,t){const n={dropSearchIndex:this.collection.fullNamespace.collection};return"string"==typeof this.name&&(n.name=this.name),n}handleOk(e){}buildOptions(e){return{session:this.session,timeoutContext:e}}handleError(e){if(!(e instanceof i.MongoServerError&&e.code===i.MONGODB_ERROR_CODES.NamespaceNotFound))throw e}}t.DropSearchIndexOperation=s},97515:(e,t,n)=>{var r=n(65994).e;Object.defineProperty(t,"__esModule",{value:!0}),t.StateMachine=void 0;const i=n(65981),o=n(26272),s=n(386),a=n(75080),u=n(61066),c=n(8500),l=n(17562),h=n(7799),d=n(145),f=n(73357),p=n(86981);let m=null;const g=new Map([[0,"MONGOCRYPT_CTX_ERROR"],[1,"MONGOCRYPT_CTX_NEED_MONGO_COLLINFO"],[2,"MONGOCRYPT_CTX_NEED_MONGO_MARKINGS"],[3,"MONGOCRYPT_CTX_NEED_MONGO_KEYS"],[7,"MONGOCRYPT_CTX_NEED_KMS_CREDENTIALS"],[4,"MONGOCRYPT_CTX_NEED_KMS"],[5,"MONGOCRYPT_CTX_READY"],[6,"MONGOCRYPT_CTX_DONE"]]),_=["tlsInsecure","tlsAllowInvalidCertificates","tlsAllowInvalidHostnames"];function y(e){r.env.MONGODB_CRYPT_DEBUG&&console.error(e)}let v;t.StateMachine=class{constructor(e,t=(0,a.pluckBSONSerializeOptions)(e)){this.options=e,this.bsonOptions=t}async execute(e,t,n){const r=e._keyVaultNamespace,i=e._keyVaultClient,o=e._metaDataClient,s=e._mongocryptdClient,u=e._mongocryptdManager;let c=null;const l=()=>t.status,h=()=>t.state;for(;6!==h()&&0!==h();)switch(n.signal?.throwIfAborted(),y(`[context#${t.id}] ${g.get(h())||h()}`),h()){case 1:{const e=(0,a.deserialize)(t.nextMongoOperation());if(!o)throw new p.MongoCryptError("unreachable state machine state: entered MONGOCRYPT_CTX_NEED_MONGO_COLLINFO but metadata client is undefined");const r=this.fetchCollectionInfo(o,t.ns,e,n);for await(const e of r)if(t.addMongoOperationResponse((0,a.serialize)(e)),0===h())break;if(0===h())break;t.finishMongoOperation();break}case 2:{const e=t.nextMongoOperation();if(0===h())break;if(!s)throw new p.MongoCryptError("unreachable state machine state: entered MONGOCRYPT_CTX_NEED_MONGO_MARKINGS but mongocryptdClient is undefined");const r=u?await u.withRespawn(this.markCommand.bind(this,s,t.ns,e,n)):await this.markCommand(s,t.ns,e,n);t.addMongoOperationResponse(r),t.finishMongoOperation();break}case 3:{const e=t.nextMongoOperation(),o=await this.fetchKeys(i,r,e,n);0===o.length&&(c=v??=(0,a.serialize)({v:[]}));for(const e of o)t.addMongoOperationResponse((0,a.serialize)(e));t.finishMongoOperation();break}case 7:{const n=await e.askForKMSCredentials();t.provideKMSProviders((0,a.serialize)(n));break}case 4:await Promise.all(this.requests(t,n)),t.finishKMSRequests();break;case 5:{const e=t.finalize();if(0===h()){const e=l().message||"Finalization error";throw new p.MongoCryptError(e)}c=e;break}default:throw new p.MongoCryptError(`Unknown state: ${h()}`)}if(0===h()||null==c){const e=l().message;throw e||y("unidentifiable error in MongoCrypt - received an error status from `libmongocrypt` but received no error message."),new p.MongoCryptError(e??"unidentifiable error in MongoCrypt - received an error status from `libmongocrypt` but received no error message.")}return c}async kmsRequest(e,t){const n=e.endpoint.split(":"),r=null!=n[1]?Number.parseInt(n[1],10):443,i={host:n[0],servername:n[0],port:r,...(0,f.autoSelectSocketOptions)(this.options.socketOptions||{})},a=e.message,u=new d.BufferPool;let g,_;function y(){for(const e of[_,g])e&&e.destroy()}function v(e){return new p.MongoCryptError("KMS request failed",{cause:e})}function E(){return new p.MongoCryptError("KMS request closed")}const S=this.options.tlsOptions;if(S){const t=e.kmsProvider,n=S[t];if(n){const e=this.validateTlsOptions(t,n);if(e)throw e;try{await this.setTlsOptions(n,i)}catch(e){throw v(e)}}}let w;try{if(this.options.proxyOptions&&this.options.proxyOptions.proxyHost){g=new o.Socket;const{promise:e,reject:t,resolve:n}=(0,d.promiseWithResolvers)();g.once("error",(e=>t(v(e)))).once("close",(()=>t(E()))).once("connect",(()=>n()));const r={...i,host:this.options.proxyOptions.proxyHost,port:this.options.proxyOptions.proxyPort||1080};g.connect(r),await e;try{m??=function(){if(null==m){const e=(0,c.getSocks)();if("kModuleError"in e)throw e.kModuleError;m=e}return m}(),i.socket=(await m.SocksClient.createConnection({existing_socket:g,command:"connect",destination:{host:i.host,port:i.port},proxy:{host:"iLoveJavaScript",port:0,type:5,userId:this.options.proxyOptions.proxyUsername,password:this.options.proxyOptions.proxyPassword}})).socket}catch(e){throw v(e)}}_=s.connect(i,(()=>{_.write(a)}));const{promise:n,reject:r,resolve:l}=(0,d.promiseWithResolvers)();w=(0,d.addAbortListener)(t?.signal,(function(){y(),r(this.reason)})),_.once("error",(e=>r(v(e)))).once("close",(()=>r(E()))).on("data",(t=>{for(u.append(t);e.bytesNeeded>0&&u.length;){const t=Math.min(e.bytesNeeded,u.length);e.addResponse(u.read(t))}e.bytesNeeded<=0&&l()})),await(t?.timeoutContext?.csotEnabled()?Promise.all([n,h.Timeout.expires(t.timeoutContext?.remainingTimeMS)]):n)}catch(e){if(e instanceof h.TimeoutError)throw new l.MongoOperationTimeoutError("KMS request timed out");throw e}finally{y(),w?.[d.kDispose]()}}*requests(e,t){for(let n=e.nextKMSRequest();null!=n;n=e.nextKMSRequest())yield this.kmsRequest(n,t)}validateTlsOptions(e,t){const n=Object.keys(t);for(const t of _)if(n.includes(t))return new p.MongoCryptError(`Insecure TLS options prohibited for ${e}: ${t}`)}async setTlsOptions(e,t){if(e.secureContext&&(t.secureContext=e.secureContext),e.tlsCertificateKeyFile){const n=await i.readFile(e.tlsCertificateKeyFile);t.cert=t.key=n}e.tlsCAFile&&(t.ca=await i.readFile(e.tlsCAFile)),e.tlsCertificateKeyFilePassword&&(t.passphrase=e.tlsCertificateKeyFilePassword)}fetchCollectionInfo(e,t,n,r){const{db:i}=d.MongoDBCollectionNamespace.fromString(t);return e.db(i).listCollections(n,{promoteLongs:!1,promoteValues:!1,timeoutContext:r?.timeoutContext&&new u.CursorTimeoutContext(r?.timeoutContext,Symbol()),signal:r?.signal,nameOnly:!1})}async markCommand(e,t,n,r){const{db:i}=d.MongoDBCollectionNamespace.fromString(t),o={promoteLongs:!1,promoteValues:!1},s=(0,a.deserialize)(n,o),u={timeoutMS:void 0,signal:void 0};r?.timeoutContext?.csotEnabled()&&(u.timeoutMS=r.timeoutContext.remainingTimeMS),r?.signal&&(u.signal=r.signal);const c=await e.db(i).command(s,{...o,...u});return(0,a.serialize)(c,this.bsonOptions)}fetchKeys(e,t,n,r){const{db:i,collection:o}=d.MongoDBCollectionNamespace.fromString(t),s={timeoutContext:void 0,signal:void 0};return null!=r?.timeoutContext&&(s.timeoutContext=new u.CursorTimeoutContext(r.timeoutContext,Symbol())),null!=r?.signal&&(s.signal=r.signal),e.db(i).collection(o,{readConcern:{level:"majority"}}).find((0,a.deserialize)(n),s).toArray()}}},97531:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.onData=function(e,{timeoutContext:t,signal:n}){n?.throwIfAborted();const i=new r.List,o=new r.List;let s=null,a=!1;const u={next(){const e=i.shift();if(null!=e)return Promise.resolve({value:e,done:!1});if(null!=s){const e=Promise.reject(s);return s=null,e}if(a)return f();const{promise:t,resolve:n,reject:u}=(0,r.promiseWithResolvers)();return o.push({resolve:n,reject:u}),t},return:()=>f(),throw:e=>(d(e),Promise.resolve({value:void 0,done:!0})),[Symbol.asyncIterator](){return this},async[Symbol.asyncDispose](){await f()}};e.on("data",h),e.on("error",d);const c=(0,r.addAbortListener)(n,(function(){d(this.reason)})),l=t?.timeoutForSocketRead;return l?.throwIfExpired(),l?.then(void 0,d),u;function h(e){const t=o.shift();null!=t?t.resolve({value:e,done:!1}):i.push(e)}function d(e){const t=o.shift();null!=t?t.reject(e):s=e,f()}function f(){e.off("data",h),e.off("error",d),c?.[r.kDispose](),a=!0,l?.clear();const t={value:void 0,done:a};for(const e of o)e.resolve(t);return Promise.resolve(t)}};const r=n(145)},97557:(e,t,n)=>{t.Md=void 0,t.oW=a;const r=n(62444),i=n(93874),o=n(98437),s=Symbol("kFlushDummy");function a(e){return{__value:e}}class u extends i.Writable{constructor(e,t,n,r){super({objectMode:!0}),this.mongoLogId=a,this._logId=e,this._logFilePath=t,this._target=n,this._now=r??(()=>new Date)}get logId(){return this._logId}get logFilePath(){return this._logFilePath}get target(){return this._target}_write(e,t,i){if(e===s)return void this._target.write("",i);const a=function(e){return"string"!=typeof e.s?new TypeError("Cannot log messages without a severity field"):"string"!=typeof e.c?new TypeError("Cannot log messages without a component field"):"number"!=typeof e.id?.__value?new TypeError("Cannot log messages without an id field"):"string"!=typeof e.ctx?new TypeError("Cannot log messages without a context field"):"string"!=typeof e.msg?new TypeError("Cannot log messages without a message field"):null}(e);if(a)return void i(a);const u={t:e.t??this._now(),s:e.s,c:e.c,id:e.id.__value,ctx:e.ctx,msg:e.msg};e.attr&&("[object Error]"===Object.prototype.toString.call(e.attr)?u.attr={stack:e.attr.stack,name:e.attr.name,message:e.attr.message,code:e.attr.code,...e.attr}:u.attr=e.attr),this.emit("log",u);try{r.EJSON.stringify(u.attr)}catch{try{const e=n(96062),t=e.deserialize(e.serialize(u.attr));r.EJSON.stringify(t),u.attr=t}catch{try{const e=JSON.parse(JSON.stringify(u.attr));r.EJSON.stringify(e),u.attr=e}catch{u.attr={_inspected:(0,o.inspect)(u.attr)}}}}this._target.write(r.EJSON.stringify(u,{relaxed:!0})+"\n",i)}_final(e){this._target.end(e)}async flush(){await new Promise((e=>this.write(s,e)))}info(e,t,n,r,i){const o={s:"I",c:e,id:t,ctx:n,msg:r,attr:i};this.write(o)}warn(e,t,n,r,i){const o={s:"W",c:e,id:t,ctx:n,msg:r,attr:i};this.write(o)}error(e,t,n,r,i){const o={s:"E",c:e,id:t,ctx:n,msg:r,attr:i};this.write(o)}fatal(e,t,n,r,i){const o={s:"F",c:e,id:t,ctx:n,msg:r,attr:i};this.write(o)}debug(e,t,n,r,i,o=1){const s={s:`D${o}`,c:e,id:t,ctx:n,msg:r,attr:i};this.write(s)}bindComponent(e){return{unbound:this,component:e,write:(t,n)=>this.write({c:e,...t},n),info:this.info.bind(this,e),warn:this.warn.bind(this,e),error:this.error.bind(this,e),fatal:this.fatal.bind(this,e),debug:this.debug.bind(this,e)}}}t.Md=u},98362:(e,t,n)=>{n.d(t,{Ay:()=>i,J0:()=>a,QZ:()=>s,Y6:()=>o});var r=n(65031);const i=r.default,o=r.CommaAndColonSeparatedRecord,s=r.ConnectionString,a=r.redactConnectionString}};