@diagramers/api
Version:
Diagramers API - A comprehensive Node.js API template with TypeScript, Firebase Functions, and Socket.io
2 lines • 4.43 MB
JavaScript
/*! For license information please see main.js.LICENSE.txt */
(()=>{var e={410:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t){return(0,o.default)(e),e.replace(new RegExp("[".concat(t,"]+"),"g"),"")};var r,o=(r=n(83399))&&r.__esModule?r:{default:r};e.exports=t.default,e.exports.default=t.default},523:(e,t,n)=>{"use strict";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(13139),{ClientSession:t}=n(94452),{AbstractCursor:o}=n(65017),{ChangeStream:i}=n(9272);r(e.prototype),r(t.prototype),r(o.prototype),r(i.prototype)}},561:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t){(0,r.default)(e);var n=t?"\\x00-\\x09\\x0B\\x0C\\x0E-\\x1F\\x7F":"\\x00-\\x1F\\x7F";return(0,o.default)(e,n)};var r=i(n(83399)),o=i(n(410));function i(e){return e&&e.__esModule?e:{default:e}}e.exports=t.default,e.exports.default=t.default},920:(e,t,n)=>{"use strict";var r=n(69675),o=n(58859),i=n(14803),s=n(80507),a=n(72271)||s||i;e.exports=function(){var e,t={assert:function(e){if(!t.has(e))throw new r("Side channel does not contain "+o(e))},delete:function(t){return!!e&&e.delete(t)},get:function(t){return e&&e.get(t)},has:function(t){return!!e&&e.has(t)},set:function(t,n){e||(e=a()),e.set(t,n)}};return t}},932:e=>{"use strict";e.exports=require("process")},997:(e,t,n)=>{"use strict";var r=n(99541),o=n(25436);class i extends o.Pair{constructor(e){if(e instanceof o.Pair){let t=e.value;t instanceof o.YAMLSeq||(t=new o.YAMLSeq,t.items.push(e.value),t.range=e.value.range),super(e.key,t),this.range=e.range}else super(new o.Scalar("<<"),new o.YAMLSeq);this.type=o.Pair.Type.MERGE_PAIR}addToJSMap(e,t){for(const{source:n}of this.value.items){if(!(n instanceof o.YAMLMap))throw new Error("Merge sources must be maps");const r=n.toJSON(null,e,Map);for(const[e,n]of r)t instanceof Map?t.has(e)||t.set(e,n):t instanceof Set?t.add(e):Object.prototype.hasOwnProperty.call(t,e)||Object.defineProperty(t,e,{value:n,writable:!0,enumerable:!0,configurable:!0})}return t}toString(e,t){const n=this.value;if(n.items.length>1)return super.toString(e,t);this.value=n.items[0];const r=super.toString(e,t);return this.value=n,r}}const s={createNode:function(e,t,n){const{keepUndefined:r,replacer:i}=n,s=new o.YAMLMap(e),a=(e,a)=>{if("function"==typeof i)a=i.call(t,e,a);else if(Array.isArray(i)&&!i.includes(e))return;(void 0!==a||r)&&s.items.push(o.createPair(e,a,n))};if(t instanceof Map)for(const[e,n]of t)a(e,n);else if(t&&"object"==typeof t)for(const e of Object.keys(t))a(e,t[e]);return"function"==typeof e.sortMapEntries&&s.items.sort(e.sortMapEntries),s},default:!0,nodeClass:o.YAMLMap,tag:"tag:yaml.org,2002:map",resolve:e=>e},a={createNode:function(e,t,n){const{replacer:r}=n,i=new o.YAMLSeq(e);if(t&&t[Symbol.iterator]){let e=0;for(let s of t){if("function"==typeof r){const n=t instanceof Set?s:String(e++);s=r.call(t,n,s)}i.items.push(o.createNode(s,null,n))}}return i},default:!0,nodeClass:o.YAMLSeq,tag:"tag:yaml.org,2002:seq",resolve:e=>e},u=[s,a,{identify:e=>"string"==typeof e,default:!0,tag:"tag:yaml.org,2002:str",resolve:e=>e,stringify:(e,t,n,r)=>(t=Object.assign({actualString:!0},t),o.stringifyString(e,t,n,r)),options:o.strOptions}],c=e=>"bigint"==typeof e||Number.isInteger(e),l=(e,t,n)=>o.intOptions.asBigInt?BigInt(e):parseInt(e.substring(t),n);function p(e,t,n){const{value:r}=e;return c(r)&&r>=0?n+r.toString(t):o.stringifyNumber(e)}const d={identify:e=>null==e,createNode:(e,t,n)=>n.wrapScalars?new o.Scalar(null):null,default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:e=>{const t=new o.Scalar(null);return t.sourceStr=e,t},options:o.nullOptions,stringify:({sourceStr:e})=>null!=e?e:o.nullOptions.nullStr},h={identify:e=>"boolean"==typeof e,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:e=>"t"===e[0]||"T"===e[0],options:o.boolOptions,stringify:({value:e})=>e?o.boolOptions.trueStr:o.boolOptions.falseStr},f={identify:e=>c(e)&&e>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:e=>l(e,2,8),options:o.intOptions,stringify:e=>p(e,8,"0o")},m={identify:c,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:e=>l(e,0,10),options:o.intOptions,stringify:o.stringifyNumber},g={identify:e=>c(e)&&e>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:e=>l(e,2,16),options:o.intOptions,stringify:e=>p(e,16,"0x")},y={identify:e=>"number"==typeof e,default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF|nan|NaN|NAN))$/,resolve:e=>"nan"===e.slice(-3).toLowerCase()?NaN:"-"===e[0]?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:o.stringifyNumber},v={identify:e=>"number"==typeof e,default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/,resolve:e=>parseFloat(e),stringify:({value:e})=>Number(e).toExponential()},b={identify:e=>"number"==typeof e,default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,resolve(e){const t=new o.Scalar(parseFloat(e)),n=e.indexOf(".");return-1!==n&&"0"===e[e.length-1]&&(t.minFractionDigits=e.length-n-1),t},stringify:o.stringifyNumber},E=u.concat([d,h,f,m,g,y,v,b]),w=e=>"bigint"==typeof e||Number.isInteger(e),_=({value:e})=>JSON.stringify(e),A=[s,a,{identify:e=>"string"==typeof e,default:!0,tag:"tag:yaml.org,2002:str",resolve:e=>e,stringify:_},{identify:e=>null==e,createNode:(e,t,n)=>n.wrapScalars?new o.Scalar(null):null,default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:_},{identify:e=>"boolean"==typeof e,default:!0,tag:"tag:yaml.org,2002:bool",test:/^true|false$/,resolve:e=>"true"===e,stringify:_},{identify:w,default:!0,tag:"tag:yaml.org,2002:int",test:/^-?(?:0|[1-9][0-9]*)$/,resolve:e=>o.intOptions.asBigInt?BigInt(e):parseInt(e,10),stringify:({value:e})=>w(e)?e.toString():JSON.stringify(e)},{identify:e=>"number"==typeof e,default:!0,tag:"tag:yaml.org,2002:float",test:/^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,resolve:e=>parseFloat(e),stringify:_},{default:!0,test:/^/,resolve:(e,t)=>(t(`Unresolved plain scalar ${JSON.stringify(e)}`),e)}],x={identify:e=>e instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve(e,t){if("function"==typeof Buffer)return Buffer.from(e,"base64");if("function"==typeof atob){const t=atob(e.replace(/[\n\r]/g,"")),n=new Uint8Array(t.length);for(let e=0;e<t.length;++e)n[e]=t.charCodeAt(e);return n}return t("This environment does not support reading binary tags; either Buffer or atob is required"),e},options:o.binaryOptions,stringify:({comment:e,type:t,value:n},i,s,a)=>{let u;if("function"==typeof Buffer)u=n instanceof Buffer?n.toString("base64"):Buffer.from(n.buffer).toString("base64");else{if("function"!=typeof btoa)throw new Error("This environment does not support writing binary tags; either Buffer or btoa is required");{let e="";for(let t=0;t<n.length;++t)e+=String.fromCharCode(n[t]);u=btoa(e)}}if(t||(t=o.binaryOptions.defaultType),t===r.Type.QUOTE_DOUBLE)n=u;else{const{lineWidth:e}=o.binaryOptions,i=Math.ceil(u.length/e),s=new Array(i);for(let t=0,n=0;t<i;++t,n+=e)s[t]=u.substr(n,e);n=s.join(t===r.Type.BLOCK_LITERAL?"\n":" ")}return o.stringifyString({comment:e,type:t,value:n},i,s,a)}};function S(e,t){if(e instanceof o.YAMLSeq)for(let n=0;n<e.items.length;++n){let r=e.items[n];if(!(r instanceof o.Pair)){if(r instanceof o.YAMLMap){r.items.length>1&&t("Each pair must have its own sequence indicator");const e=r.items[0]||new o.Pair;r.commentBefore&&(e.commentBefore=e.commentBefore?`${r.commentBefore}\n${e.commentBefore}`:r.commentBefore),r.comment&&(e.comment=e.comment?`${r.comment}\n${e.comment}`:r.comment),r=e}e.items[n]=r instanceof o.Pair?r:new o.Pair(r)}}else t("Expected a sequence for this tag");return e}function C(e,t,n){const{replacer:r}=n,i=new o.YAMLSeq(e);i.tag="tag:yaml.org,2002:pairs";let s=0;for(let e of t){let a,u;if("function"==typeof r&&(e=r.call(t,String(s++),e)),Array.isArray(e)){if(2!==e.length)throw new TypeError(`Expected [key, value] tuple: ${e}`);a=e[0],u=e[1]}else if(e&&e instanceof Object){const t=Object.keys(e);if(1!==t.length)throw new TypeError(`Expected { key: value } tuple: ${e}`);a=t[0],u=e[a]}else a=e;i.items.push(o.createPair(a,u,n))}return i}const O={default:!1,tag:"tag:yaml.org,2002:pairs",resolve:S,createNode:C};class D extends o.YAMLSeq{constructor(){super(),r._defineProperty(this,"add",o.YAMLMap.prototype.add.bind(this)),r._defineProperty(this,"delete",o.YAMLMap.prototype.delete.bind(this)),r._defineProperty(this,"get",o.YAMLMap.prototype.get.bind(this)),r._defineProperty(this,"has",o.YAMLMap.prototype.has.bind(this)),r._defineProperty(this,"set",o.YAMLMap.prototype.set.bind(this)),this.tag=D.tag}toJSON(e,t){const n=new Map;t&&t.onCreate&&t.onCreate(n);for(const e of this.items){let r,i;if(e instanceof o.Pair?(r=o.toJS(e.key,"",t),i=o.toJS(e.value,r,t)):r=o.toJS(e,"",t),n.has(r))throw new Error("Ordered maps must not include duplicate keys");n.set(r,i)}return n}}r._defineProperty(D,"tag","tag:yaml.org,2002:omap");const T={identify:e=>e instanceof Map,nodeClass:D,default:!1,tag:"tag:yaml.org,2002:omap",resolve:function(e,t){const n=S(e,t),r=[];for(const{key:e}of n.items)e instanceof o.Scalar&&(r.includes(e.value)?t(`Ordered maps must not include duplicate keys: ${e.value}`):r.push(e.value));return Object.assign(new D,n)},createNode:function(e,t,n){const r=C(e,t,n),o=new D;return o.items=r.items,o}};class k extends o.YAMLMap{constructor(e){super(e),this.tag=k.tag}add(e){const t=e instanceof o.Pair?e:new o.Pair(e);o.findPair(this.items,t.key)||this.items.push(t)}get(e,t){const n=o.findPair(this.items,e);return!t&&n instanceof o.Pair?n.key instanceof o.Scalar?n.key.value:n.key:n}set(e,t){if("boolean"!=typeof t)throw new Error("Expected boolean value for set(key, value) in a YAML set, not "+typeof t);const n=o.findPair(this.items,e);n&&!t?this.items.splice(this.items.indexOf(n),1):!n&&t&&this.items.push(new o.Pair(e))}toJSON(e,t){return super.toJSON(e,t,Set)}toString(e,t,n){if(!e)return JSON.stringify(this);if(this.hasAllNullValues())return super.toString(e,t,n);throw new Error("Set items must all have null values")}}r._defineProperty(k,"tag","tag:yaml.org,2002:set");const M={identify:e=>e instanceof Set,nodeClass:k,default:!1,tag:"tag:yaml.org,2002:set",resolve:function(e,t){if(e instanceof o.YAMLMap){if(e.hasAllNullValues())return Object.assign(new k,e);t("Set items must all have null values")}else t("Expected a mapping for this tag");return e},createNode:function(e,t,n){const{replacer:r}=n,i=new k(e);for(let e of t)"function"==typeof r&&(e=r.call(t,e,e)),i.items.push(o.createPair(e,null,n));return i}},N=(e,t)=>{const n=e[0],r="-"===n||"+"===n?e.substring(1):e,i=e=>t&&o.intOptions.asBigInt?BigInt(e):Number(e),s=r.replace(/_/g,"").split(":").reduce((e,t)=>e*i(60)+i(t),i(0));return"-"===n?i(-1)*s:s},j=({value:e})=>{let t=e=>e;if("bigint"==typeof e)t=e=>BigInt(e);else if(isNaN(e)||!isFinite(e))return o.stringifyNumber(e);let n="";e<0&&(n="-",e*=t(-1));const r=t(60),i=[e%r];return e<60?i.unshift(0):(e=(e-i[0])/r,i.unshift(e%r),e>=60&&(e=(e-i[0])/r,i.unshift(e))),n+i.map(e=>e<10?"0"+String(e):String(e)).join(":").replace(/000000\d*$/,"")},P={identify:e=>"bigint"==typeof e||Number.isInteger(e),default:!0,tag:"tag:yaml.org,2002:int",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,resolve:e=>N(e,!0),stringify:j},I={identify:e=>"number"==typeof e,default:!0,tag:"tag:yaml.org,2002:float",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,resolve:e=>N(e,!1),stringify:j},F={identify:e=>e instanceof Date,default:!0,tag:"tag:yaml.org,2002:timestamp",test:RegExp("^([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})(?:(?:t|T|[ \\t]+)([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2}(\\.[0-9]+)?)(?:[ \\t]*(Z|[-+][012]?[0-9](?::[0-9]{2})?))?)?$"),resolve(e){let[,t,n,r,o,i,s,a,u]=e.match(F.test);a&&(a=(a+"00").substr(1,3));let c=Date.UTC(t,n-1,r,o||0,i||0,s||0,a||0);if(u&&"Z"!==u){let e=N(u,!1);Math.abs(e)<30&&(e*=60),c-=6e4*e}return new Date(c)},stringify:({value:e})=>e.toISOString().replace(/((T00:00)?:00)?\.000Z$/,"")},B=({value:e})=>e?o.boolOptions.trueStr:o.boolOptions.falseStr,$=e=>"bigint"==typeof e||Number.isInteger(e);function R(e,t,n){const r=e[0];if("-"!==r&&"+"!==r||(t+=1),e=e.substring(t).replace(/_/g,""),o.intOptions.asBigInt){switch(n){case 2:e=`0b${e}`;break;case 8:e=`0o${e}`;break;case 16:e=`0x${e}`}const t=BigInt(e);return"-"===r?BigInt(-1)*t:t}const i=parseInt(e,n);return"-"===r?-1*i:i}function L(e,t,n){const{value:r}=e;if($(r)){const e=r.toString(t);return r<0?"-"+n+e.substr(1):n+e}return o.stringifyNumber(e)}const U=u.concat([{identify:e=>null==e,createNode:(e,t,n)=>n.wrapScalars?new o.Scalar(null):null,default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:e=>{const t=new o.Scalar(null);return t.sourceStr=e,t},options:o.nullOptions,stringify:({sourceStr:e})=>null!=e?e:o.nullOptions.nullStr},{identify:e=>"boolean"==typeof e,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>!0,options:o.boolOptions,stringify:B},{identify:e=>"boolean"==typeof e,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,resolve:()=>!1,options:o.boolOptions,stringify:B},{identify:$,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:e=>R(e,2,2),stringify:e=>L(e,2,"0b")},{identify:$,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:e=>R(e,1,8),stringify:e=>L(e,8,"0")},{identify:$,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:e=>R(e,0,10),stringify:o.stringifyNumber},{identify:$,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:e=>R(e,2,16),stringify:e=>L(e,16,"0x")},{identify:e=>"number"==typeof e,default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?\.(?:inf|Inf|INF|nan|NaN|NAN)$/,resolve:e=>"nan"===e.slice(-3).toLowerCase()?NaN:"-"===e[0]?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:o.stringifyNumber},{identify:e=>"number"==typeof e,default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,resolve:e=>parseFloat(e.replace(/_/g,"")),stringify:({value:e})=>Number(e).toExponential()},{identify:e=>"number"==typeof e,default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve(e){const t=new o.Scalar(parseFloat(e.replace(/_/g,""))),n=e.indexOf(".");if(-1!==n){const r=e.substring(n+1).replace(/_/g,"");"0"===r[r.length-1]&&(t.minFractionDigits=r.length)}return t},stringify:o.stringifyNumber}],x,T,O,M,P,I,F),q={core:E,failsafe:u,json:A,yaml11:U},z={binary:x,bool:h,float:b,floatExp:v,floatNaN:y,floatTime:I,int:m,intHex:g,intOct:f,intTime:P,map:s,null:d,omap:T,pairs:O,seq:a,set:M,timestamp:F},V=(e,t)=>e.key<t.key?-1:e.key>t.key?1:0,W={"tag:yaml.org,2002:binary":z.binary,"tag:yaml.org,2002:omap":z.omap,"tag:yaml.org,2002:pairs":z.pairs,"tag:yaml.org,2002:set":z.set,"tag:yaml.org,2002:timestamp":z.timestamp};t.MERGE_KEY="<<",t.Merge=i,t.Schema=class{constructor({customTags:e,merge:t,resolveKnownTags:n,schema:r,sortMapEntries:o}){this.merge=!!t,this.name=r,this.knownTags=n?W:{},this.tags=function(e,t,n,r){let o=e[r.replace(/\W/g,"")];if(!o){const t=Object.keys(e).map(e=>JSON.stringify(e)).join(", ");throw new Error(`Unknown schema "${r}"; use one of ${t}`)}if(Array.isArray(n))for(const e of n)o=o.concat(e);else"function"==typeof n&&(o=n(o.slice()));for(let e=0;e<o.length;++e){const n=o[e];if("string"==typeof n){const r=t[n];if(!r){const e=Object.keys(t).map(e=>JSON.stringify(e)).join(", ");throw new Error(`Unknown custom tag "${n}"; use one of ${e}`)}o[e]=r}}return o}(q,z,e,r),this.map=z.map,this.seq=z.seq,this.sortMapEntries=!0===o?V:o||null}}},1148:(e,t,n)=>{"use strict";const r=n(35694),o=n(72521),i=n(72925),s=n(64149),a=n(86376),u=n(87103),c=n(22685),l=n(23825),p=n(66684),d=n(23388).schemaTypeSymbol,h=n(17058),f=n(23388).validatorErrorSymbol,m=n(23388).documentIsModified,g=n(23388).populateModelSymbol,y=r.CastError,v=r.ValidatorError,b={_skipMarkModified:!0};function E(e,t,n){this[d]=!0,this.path=e,this.instance=n,this.validators=[],this.getters=this.constructor.hasOwnProperty("getters")?this.constructor.getters.slice():[],this.setters=this.constructor.hasOwnProperty("setters")?this.constructor.setters.slice():[],this.splitPath(),t=t||{};const r=this.constructor.defaultOptions||{},i=Object.keys(r);for(const e of i)"validate"===e?this.validate(r.validate):r.hasOwnProperty(e)&&!Object.prototype.hasOwnProperty.call(t,e)&&(t[e]=r[e]);null==t.select&&delete t.select;const s=this.OptionsConstructor||o;this.options=new s(t),this._index=null,h.hasUserDefinedProperty(this.options,"immutable")&&(this.$immutable=this.options.immutable,u(this));const a=Object.keys(this.options);for(const e of a)if("cast"!==e){if(h.hasUserDefinedProperty(this.options,e)&&"function"==typeof this[e]){if("index"===e&&this._index){if(!1===t.index){const e=this._index;if("object"==typeof e&&null!=e){if(e.unique)throw new Error('Path "'+this.path+'" may not have `index` set to false and `unique` set to true');if(e.sparse)throw new Error('Path "'+this.path+'" may not have `index` set to false and `sparse` set to true')}this._index=!1}continue}const n=t[e];if("default"===e){this.default(n);continue}const r=Array.isArray(n)?n:[n];this[e].apply(this,r)}}else Array.isArray(this.options[e])?this.castFunction.apply(this,this.options[e]):this.castFunction(this.options[e]);Object.defineProperty(this,"$$context",{enumerable:!1,configurable:!1,writable:!0,value:null})}function w(e,t){if(void 0!==e&&!e){const e=new(t.ErrorConstructor||v)(t);return e[f]=!0,e}}function _(e,t){return this.castForQuery(null,e,t)}function A(e,t){const n=this;return Array.isArray(e)?e.map(function(e){return Array.isArray(e)&&0===e.length?e:n.castForQuery(null,e,t)}):[this.castForQuery(null,e,t)]}E.prototype.OptionsConstructor=o,E.prototype.path,E.prototype.validators,E.prototype.isRequired,E.prototype.splitPath=function(){return null!=this._presplitPath?this._presplitPath:null!=this.path?(this._presplitPath=-1===this.path.indexOf(".")?[this.path]:this.path.split("."),this._presplitPath):void 0},E.cast=function(e){return 0===arguments.length||(!1===e&&(e=e=>e),this._cast=e),this._cast},E.prototype.castFunction=function(e,t){return 0===arguments.length?this._castFunction:(!1===e&&(e=this.constructor._defaultCaster||(e=>e)),"string"==typeof e?(this._castErrorMessage=e,this._castFunction):(null!=e&&(this._castFunction=e),null!=t&&(this._castErrorMessage=t),this._castFunction))},E.prototype.cast=function(){throw new Error("Base SchemaType class does not implement a `cast()` function")},E.set=function(e,t){this.hasOwnProperty("defaultOptions")||(this.defaultOptions=Object.assign({},this.defaultOptions)),this.defaultOptions[e]=t},E.get=function(e){this.getters=this.hasOwnProperty("getters")?this.getters:[],this.getters.push(e)},E.prototype.default=function(e){if(1===arguments.length){if(void 0===e)return void(this.defaultValue=void 0);if(null!=e&&e.instanceOfSchema)throw new r("Cannot set default value of path `"+this.path+"` to a mongoose Schema instance.");return this.defaultValue=e,this.defaultValue}return arguments.length>1&&(this.defaultValue=[...arguments]),this.defaultValue},E.prototype.index=function(e){return this._index=e,h.expires(this._index),this},E.prototype.unique=function(e,t){if(!1===this._index){if(!e)return;throw new Error('Path "'+this.path+'" may not have `index` set to false and `unique` set to true')}return this.options.hasOwnProperty("index")||!1!==e?(null==this._index||!0===this._index?this._index={}:"string"==typeof this._index&&(this._index={type:this._index}),this._index.unique=!!e,"string"==typeof t&&(this._duplicateKeyErrorMessage=t),this):this},E.prototype.text=function(e){if(!1===this._index){if(!e)return this;throw new Error('Path "'+this.path+'" may not have `index` set to false and `text` set to true')}return this.options.hasOwnProperty("index")||!1!==e?(null===this._index||void 0===this._index||"boolean"==typeof this._index?this._index={}:"string"==typeof this._index&&(this._index={type:this._index}),this._index.text=e,this):this},E.prototype.sparse=function(e){if(!1===this._index){if(!e)return this;throw new Error('Path "'+this.path+'" may not have `index` set to false and `sparse` set to true')}return this.options.hasOwnProperty("index")||!1!==e?(null==this._index||"boolean"==typeof this._index?this._index={}:"string"==typeof this._index&&(this._index={type:this._index}),this._index.sparse=e,this):this},E.prototype.immutable=function(e){return this.$immutable=e,u(this),this},E.prototype.transform=function(e){return this.options.transform=e,this},E.prototype.set=function(e){if("function"!=typeof e)throw new TypeError("A setter must be a function.");return this.setters.push(e),this},E.prototype.get=function(e){if("function"!=typeof e)throw new TypeError("A getter must be a function.");return this.getters.push(e),this},E.prototype.validateAll=function(e){for(let t=0;t<e.length;t++)this.validate(e[t]);return this},E.prototype.validate=function(e,t,n){if("function"==typeof e||e&&"RegExp"===h.getFunctionName(e.constructor)){let o;return"function"==typeof t?(o={validator:e,message:t},o.type=n||"user defined"):t instanceof Object&&!n?(o=l(t)?Object.assign({},t):a(t),o.message||(o.message=o.msg),o.validator=e,o.type=o.type||"user defined"):(null==t&&(t=r.messages.general.default),n||(n="user defined"),o={message:t,type:n,validator:e}),this.validators.push(o),this}let o,i,s;for(o=0,i=arguments.length;o<i;o++){if(s=arguments[o],!h.isPOJO(s))throw new Error("Invalid validator. Received ("+typeof s+") "+s+". See https://mongoosejs.com/docs/api/schematype.html#SchemaType.prototype.validate()");this.validate(s.validator,s)}return this},E.prototype.required=function(e,t){let n={};if(arguments.length>0&&null==e)return this.validators=this.validators.filter(function(e){return e.validator!==this.requiredValidator},this),this.isRequired=!1,delete this.originalRequiredValue,this;if("object"==typeof e&&(n=e,t=n.message||t,e=e.isRequired),!1===e)return this.validators=this.validators.filter(function(e){return e.validator!==this.requiredValidator},this),this.isRequired=!1,delete this.originalRequiredValue,this;const o=this;this.isRequired=!0,this.requiredValidator=function(t){const n=this&&this.$__&&this.$__.cachedRequired;if(null!=n&&!this.$__isSelected(o.path)&&!this[m](o.path))return!0;if(null!=n&&o.path in n){const e=!n[o.path]||o.checkRequired(t,this);return delete n[o.path],e}return"function"==typeof e&&!e.apply(this)||o.checkRequired(t,this)},this.originalRequiredValue=e,"string"==typeof e&&(t=e,e=void 0);const i=t||r.messages.general.required;return this.validators.unshift(Object.assign({},n,{validator:this.requiredValidator,message:i,type:"required"})),this},E.prototype.ref=function(e){return this.options.ref=e,this},E.prototype.getDefault=function(e,t,n){let r;if(r="function"==typeof this.defaultValue?this.defaultValue===Date.now||this.defaultValue===Array||"objectid"===this.defaultValue.name.toLowerCase()?this.defaultValue.call(e):this.defaultValue.call(e,e):this.defaultValue,null!=r){if("object"!=typeof r||this.options&&this.options.shared||(r=a(r)),n&&n.skipCast)return this._applySetters(r,e);const o=this.applySetters(r,e,t,void 0,b);return o&&!Array.isArray(o)&&o.$isSingleNested&&(o.$__parent=e),o}return r},E.prototype._applySetters=function(e,t,n,r,o){let i=e;if(n)return i;const s=this.setters;for(let e=s.length-1;e>=0;e--)i=s[e].call(t,i,r,this,o);return i},E.prototype._castNullish=function(e){return e},E.prototype.applySetters=function(e,t,n,r,o){let i=this._applySetters(e,t,n,r,o);return null==i?this._castNullish(i):(i=this.cast(i,t,n,r,o),i)},E.prototype.applyGetters=function(e,t){let n=e;const r=this.getters,o=r.length;if(0===o)return n;for(let e=0;e<o;++e)n=r[e].call(t,n,this);return n},E.prototype.select=function(e){return this.selected=!!e,this},E.prototype.doValidate=function(e,t,n,r){let o=!1;const i=this.path;if("function"!=typeof t)throw new TypeError("Must pass callback function to doValidate(), got "+typeof t);const s=this.validators.filter(e=>"object"==typeof e&&null!==e);let u=s.length;if(!u)return t(null);for(let t=0,u=s.length;t<u&&!o;++t){const o=s[t],u=o.validator;let p;const d=l(o)?Object.assign({},o):a(o);if(d.path=r&&r.path?r.path:i,d.fullPath=this.$fullPath,d.value=e,u instanceof RegExp)c(u.test(e),d,n);else if("function"==typeof u)if(void 0!==e||u===this.requiredValidator){try{p=d.propsParameter?u.call(n,e,d):u.call(n,e)}catch(e){p=!1,d.reason=e,e.message&&(d.message=e.message)}null!=p&&"function"==typeof p.then?p.then(function(e){c(e,d,n)},function(e){d.reason=e,d.message=e.message,p=!1,c(p,d,n)}):c(p,d,n)}else c(!0,d,n)}function c(e,n,r){if(!o)if(void 0===e||e)--u<=0&&p(function(){t(null)});else{const e=n.ErrorConstructor||v;o=new e(n,r),o[f]=!0,p(function(){t(o)})}}},E.prototype.doValidateSync=function(e,t,n){const r=this.path;if(!this.validators.length)return null;let o=this.validators;if(void 0===e){if(0===this.validators.length||"required"!==this.validators[0].type)return null;o=[this.validators[0]]}let i=null,s=0;const u=o.length;for(s=0;s<u;++s){const u=o[s];if(null===u||"object"!=typeof u)continue;const p=u.validator,d=l(u)?Object.assign({},u):a(u);d.path=n&&n.path?n.path:r,d.fullPath=this.$fullPath,d.value=e;let h=!1;if(!c(p))if(p instanceof RegExp)i=w(p.test(e),d);else if("function"==typeof p){try{h=d.propsParameter?p.call(t,e,d):p.call(t,e)}catch(e){h=!1,d.reason=e}if((null==h||"function"!=typeof h.then)&&(i=w(h,d),i))break}}return i},E._isRef=function(e,t,n,r){let o=r&&e.options&&(e.options.ref||e.options.refPath);if(!o&&n&&null!=n.$__){const t=n.$__fullPath(e.path,!0),r=n.ownerDocument();o=null!=t&&r.$populated(t)||n.$populated(e.path)}return!!o&&(null==t||!(Buffer.isBuffer(t)||"Binary"===t._bsontype||!h.isObject(t))||r)},E.prototype._castRef=function(e,t,n,r){if(null==e)return e;if(null!=e.$__)return e.$__.wasPopulated=e.$__.wasPopulated||{value:e._doc._id},e;if(Buffer.isBuffer(e)||!h.isObject(e)){if(n)return e;throw new y(this.instance,e,this.path,null,this)}const o=t.$__fullPath(this.path,!0),i=t.ownerDocument().$populated(o,!0);let s=e;if(!(t.$__.populated&&t.$__.populated[o]&&t.$__.populated[o].options&&t.$__.populated[o].options.options&&t.$__.populated[o].options.options.lean)){const n=i?i.options[g]:t.constructor.db.model(this.options.ref);s=n.hydrate(e,null,r),s.$__.wasPopulated={value:s._doc._id,options:{[g]:n}}}return s},E.prototype.$conditionalHandlers={$all:function(e,t){const n=this;return Array.isArray(e)?e.map(function(e){return n.castForQuery(null,e,t)}):[this.castForQuery(null,e,t)]},$eq:_,$in:A,$ne:_,$nin:A,$exists:i,$type:s},E.prototype.castForQuery=function(e,t,n){let r;if(null!=e){if(r=this.$conditionalHandlers[e],!r)throw new Error("Can't use "+e);return r.call(this,t,n)}try{return this.applySetters(t,n)}catch(e){throw e instanceof y&&e.path===this.path&&null!=this.$fullPath&&(e.path=this.$fullPath),e}},E.checkRequired=function(e){return 0!==arguments.length&&(this._checkRequired=e),this._checkRequired},E.prototype.checkRequired=function(e){return null!=e},E.prototype.clone=function(){const e=Object.assign({},this.options),t=new this.constructor(this.path,e,this.instance);return t.validators=this.validators.slice(),void 0!==this.requiredValidator&&(t.requiredValidator=this.requiredValidator),void 0!==this.defaultValue&&(t.defaultValue=this.defaultValue),void 0!==this.$immutable&&void 0===this.options.immutable&&(t.$immutable=this.$immutable,u(t)),void 0!==this._index&&(t._index=this._index),void 0!==this.selected&&(t.selected=this.selected),void 0!==this.isRequired&&(t.isRequired=this.isRequired),void 0!==this.originalRequiredValue&&(t.originalRequiredValue=this.originalRequiredValue),t.getters=this.getters.slice(),t.setters=this.setters.slice(),t},E.prototype.getEmbeddedSchemaType=function(){return this.$embeddedSchemaType},E.prototype._duplicateKeyErrorMessage=null,E.prototype.toJSONSchema=function(e){throw new Error(`Converting unsupported SchemaType to JSON Schema: ${this.instance} at path "${this.path}"`)},E.prototype.autoEncryptionType=function(){return null},e.exports=t=E,t.CastError=y,t.ValidatorError=v},1227:(e,t,n)=>{"use strict";const r=n(35694);class o extends r{constructor(e,t,n,r){let o=e.map(e=>e.message).join(", ");o.length>200&&(o=o.slice(0,200)+"..."),super(`${r} failed with ${e.length} Mongoose validation errors: ${o}`),this.validationErrors=e,this.results=t,this.rawResult=n,this.operation=r}}Object.defineProperty(o.prototype,"name",{value:"MongooseBulkWriteError"}),e.exports=o},1393:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ConfigManager=void 0;const r=n(79896),o=n(16928),i=n(80998);class s{static instance;config=null;configPath;constructor(){this.configPath=o.join(process.cwd(),"config"),this.loadEnvironmentVariables()}loadEnvironmentVariables(){const e=o.join(process.cwd(),".env");r.existsSync(e)&&i.config({path:e});const t=o.join(process.cwd(),".env.production");r.existsSync(t)&&i.config({path:t});const n=o.join(process.cwd(),".env.local");r.existsSync(n)&&i.config({path:n})}static getInstance(){return s.instance||(s.instance=new s),s.instance}async load(e="production"){if(this.config)return this.config;try{const t=o.join(this.configPath,`${e}.ts`);let n={};r.existsSync(t)&&(n=await this.loadEnvironmentConfig(e));const i=await this.loadBaseConfig();this.config=this.mergeConfigs(i,n);const s=this.validate(this.config);if(!s.isValid)throw new Error(`Configuration validation failed: ${s.errors.join(", ")}`);return this.config}catch(e){throw new Error(`Failed to load configuration: ${e.message}`)}}get(){if(!this.config)throw new Error("Configuration not loaded. Call load() first.");return this.config}async reload(e){return this.config=null,await this.load(e)}validate(e){const t=[],n=[];return(!e.port||e.port<=0)&&t.push("Port must be a positive number"),e.host||t.push("Host is required"),e.auth?.jwtSecret||t.push("JWT secret is required"),e.database?.host||t.push("Database host is required"),e.auth?.providers?.firebase?.enabled&&!e.auth.providers.firebase.projectId&&t.push("Firebase project ID is required when Firebase auth is enabled"),e.notifications?.email?.enabled&&!e.notifications.email.defaults?.from&&n.push("Email from address is recommended when email notifications are enabled"),{isValid:0===t.length,errors:t,warnings:n}}getModuleConfig(e){const t=this.get();return t.plugins?.find(t=>t.name===e)?.config||{}}async updateConfig(e){if(!this.config)throw new Error("Configuration not loaded");this.config={...this.config,...e};const t=this.validate(this.config);if(!t.isValid)throw new Error(`Configuration validation failed: ${t.errors.join(", ")}`)}async loadEnvironmentConfig(e){return{environment:e,port:parseInt(process.env.PORT||"3000"),host:process.env.HOST||"localhost",logging:{level:process.env.LOG_LEVEL||("production"===e?"warn":"debug"),file:process.env.LOG_FILE||"logs/app.log"},cors:{origin:process.env.CORS_ORIGIN||"*",credentials:"true"===process.env.CORS_CREDENTIALS},security:{rateLimit:{windowMs:parseInt(process.env.RATE_LIMIT_WINDOW_MS||"900000"),max:parseInt(process.env.RATE_LIMIT_MAX_REQUESTS||"100")},helmet:"false"!==process.env.HELMET_ENABLED,compression:"false"!==process.env.COMPRESSION_ENABLED},database:{host:process.env.DB_HOST||"localhost",port:parseInt(process.env.DB_PORT||"3306"),username:process.env.DB_USERNAME||"root",password:process.env.DB_PASSWORD||"",database:process.env.DB_DATABASE||"diagramers",dialect:process.env.DB_DIALECT||"mysql",logging:"true"===process.env.DB_LOGGING},auth:{jwtSecret:process.env.JWT_SECRET||"your-secret-key",jwtExpiresIn:process.env.JWT_EXPIRES_IN||"1h",refreshTokenExpiresIn:process.env.REFRESH_TOKEN_EXPIRES_IN||"7d",providers:{internal:!0,firebase:{enabled:"true"===process.env.FIREBASE_ENABLED,projectId:process.env.FIREBASE_PROJECT_ID||"",privateKeyId:process.env.FIREBASE_PRIVATE_KEY_ID||"",privateKey:process.env.FIREBASE_PRIVATE_KEY||"",clientEmail:process.env.FIREBASE_CLIENT_EMAIL||"",clientId:process.env.FIREBASE_CLIENT_ID||"",authUri:process.env.FIREBASE_AUTH_URI||"",tokenUri:process.env.FIREBASE_TOKEN_URI||"",authProviderX509CertUrl:process.env.FIREBASE_AUTH_PROVIDER_X509_CERT_URL||"",clientX509CertUrl:process.env.FIREBASE_CLIENT_X509_CERT_URL||""},oauth:{enabled:"true"===process.env.OAUTH_ENABLED,providers:{google:{enabled:!!process.env.GOOGLE_CLIENT_ID,clientId:process.env.GOOGLE_CLIENT_ID||"",clientSecret:process.env.GOOGLE_CLIENT_SECRET||"",callbackUrl:process.env.GOOGLE_CALLBACK_URL||"",scope:["email","profile"]},github:{enabled:!1,clientId:"",clientSecret:"",callbackUrl:"",scope:[]},facebook:{enabled:!1,clientId:"",clientSecret:"",callbackUrl:"",scope:[]}}},sms:{enabled:"true"===process.env.SMS_ENABLED,provider:process.env.SMS_PROVIDER||"twilio",twilio:{accountSid:process.env.TWILIO_ACCOUNT_SID||"",authToken:process.env.TWILIO_AUTH_TOKEN||"",fromNumber:process.env.TWILIO_PHONE_NUMBER||""}},email:{enabled:"true"===process.env.EMAIL_ENABLED,provider:"nodemailer"}}},notifications:{email:{enabled:"true"===process.env.EMAIL_ENABLED,provider:"nodemailer",templates:{path:"./templates/email",engine:"handlebars"},defaults:{from:process.env.EMAIL_FROM||"",replyTo:process.env.EMAIL_FROM||""}},sms:{enabled:"true"===process.env.SMS_ENABLED,provider:"twilio",defaults:{from:process.env.TWILIO_PHONE_NUMBER||""}},push:{enabled:!1,provider:"firebase"}}}}async loadBaseConfig(){return{environment:"development",port:parseInt(process.env.PORT||"3000"),host:"localhost",cors:{origin:"*",credentials:!1},database:{host:"localhost",port:3306,username:"root",password:"",database:"diagramers",dialect:"mysql",logging:!1},auth:{jwtSecret:process.env.JWT_SECRET||"your-secret-key",jwtExpiresIn:"1h",refreshTokenExpiresIn:"7d",providers:{internal:!0,firebase:{enabled:!1,projectId:"",privateKeyId:"",privateKey:"",clientEmail:"",clientId:"",authUri:"",tokenUri:"",authProviderX509CertUrl:"",clientX509CertUrl:""},oauth:{enabled:!1,providers:{google:{enabled:!1,clientId:"",clientSecret:"",callbackUrl:"",scope:[]},github:{enabled:!1,clientId:"",clientSecret:"",callbackUrl:"",scope:[]},facebook:{enabled:!1,clientId:"",clientSecret:"",callbackUrl:"",scope:[]}}},sms:{enabled:!1,provider:"twilio"},email:{enabled:!1,provider:"nodemailer"}}},notifications:{email:{enabled:!1,provider:"nodemailer",templates:{path:"./templates/email",engine:"handlebars"},defaults:{from:"",replyTo:""}},sms:{enabled:!1,provider:"twilio",defaults:{from:""}},push:{enabled:!1,provider:"firebase"}},plugins:[],logging:{level:"info"},security:{rateLimit:{windowMs:9e5,max:100},helmet:!0,compression:!0}}}mergeConfigs(e,t){return{...e,...t,auth:{...e.auth,...t.auth,providers:{...e.auth?.providers,...t.auth?.providers}},notifications:{...e.notifications,...t.notifications},database:{...e.database,...t.database}}}}t.ConfigManager=s},1646:e=>{"use strict";e.exports=class{constructor(e,t,n){this.subdocSnapshot=e,this.activePaths=t,this.version=n}}},1697:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:s;return(0,r.default)(e),t.loose?(0,o.default)(u,e.toLowerCase()):(0,o.default)(a,e)};var r=i(n(83399)),o=i(n(78644));function i(e){return e&&e.__esModule?e:{default:e}}var s={loose:!1},a=["true","false","1","0"],u=[].concat(a,["yes","no"]);e.exports=t.default,e.exports.default=t.default},1708:e=>{"use strict";e.exports=require("node:process")},1715:e=>{"use strict";function t(e,n,r=new Set){if(r.has(e))throw new Error("Infinite subdocument loop: subdoc with _id "+e._id+" is a parent of itself");const o=e.$parent(),i=e.$__pathRelativeToParent(void 0,!1)+"."+n;o.$__.activePaths.clearPath(i),o.$isSubdocument&&t(o,i,r)}e.exports=function(e,n,r){const o=(r=r||{}).skipDocArrays;let i=0;if(!e)return i;for(const r of Object.keys(e.$__.activePaths.getStatePaths("modify"))){if(o){const t=e.$__schema.path(r);if(t&&t.$isMongooseDocumentArray)continue}r.startsWith(n+".")&&(e.$__.activePaths.clearPath(r),++i,e.$isSubdocument&&t(e,r))}return i}},1744:(e,t,n)=>{const r=n(52018),o=n(39023);t.init=function(e){e.inspectOpts={};const n=Object.keys(t.inspectOpts);for(let r=0;r<n.length;r++)e.inspectOpts[n[r]]=t.inspectOpts[n[r]]},t.log=function(...e){return process.stderr.write(o.formatWithOptions(t.inspectOpts,...e)+"\n")},t.formatArgs=function(n){const{namespace:r,useColors:o}=this;if(o){const t=this.color,o="[3"+(t<8?t:"8;5;"+t),i=` ${o};1m${r} [0m`;n[0]=i+n[0].split("\n").join("\n"+i),n.push(o+"m+"+e.exports.humanize(this.diff)+"[0m")}else n[0]=(t.inspectOpts.hideDate?"":(new Date).toISOString()+" ")+r+" "+n[0]},t.save=function(e){e?process.env.DEBUG=e:delete process.env.DEBUG},t.load=function(){return process.env.DEBUG},t.useColors=function(){return"colors"in t.inspectOpts?Boolean(t.inspectOpts.colors):r.isatty(process.stderr.fd)},t.destroy=o.deprecate(()=>{},"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."),t.colors=[6,2,3,4,5,1];try{const e=n(27687);e&&(e.stderr||e).level>=2&&(t.colors=[20,21,26,27,32,33,38,39,40,41,42,43,44,45,56,57,62,63,68,69,74,75,76,77,78,79,80,81,92,93,98,99,112,113,128,129,134,135,148,149,160,161,162,163,164,165,166,167,168,169,170,171,172,173,178,179,184,185,196,197,198,199,200,201,202,203,204,205,206,207,208,209,214,215,220,221])}catch(e){}t.inspectOpts=Object.keys(process.env).filter(e=>/^debug_/i.test(e)).reduce((e,t)=>{const n=t.substring(6).toLowerCase().replace(/_([a-z])/g,(e,t)=>t.toUpperCase());let r=process.env[t];return r=!!/^(yes|on|true|enabled)$/i.test(r)||!/^(no|off|false|disabled)$/i.test(r)&&("null"===r?null:Number(r)),e[n]=r,e},{}),e.exports=n(46325)(t);const{formatters:i}=e.exports;i.o=function(e){return this.inspectOpts.colors=this.useColors,o.inspect(e,this.inspectOpts).split("\n").map(e=>e.trim()).join(" ")},i.O=function(e){return this.inspectOpts.colors=this.useColors,o.inspect(e,this.inspectOpts)}},1769:(e,t,n)=>{"use strict";e.exports=n(46184)},1871:(e,t,n)=>{"use strict";const r=n(87735),o=n(19826),i=n(90656),s=n(69059),a=n(39023),u=n(17058),c=/(\.\d+$|\.\d+\.)/g;e.exports=function(e,t,n,l,p){if(null==e)return[];if("string"==typeof e&&null!=p&&o(p,e))throw new r("refPath `"+e+"` must not be excluded in projection, got "+a.inspect(p));if(c.test(n)){const r=n.split(c);if(""===r[r.length-1])throw new Error("Can't populate individual element in an array");let o="",a=e;for(let e=0;e<r.length;e+=2){const t=r[e];if(!a.startsWith(t+".")){if(e===r.length-1){o+=a,a="";break}throw new Error("Could not normalize ref path, chunk "+t+" not in populated path")}o+=a.substring(0,t.length)+r[e+1],a=a.substring(t.length+1)}const l=s.get(o,t,i);let p=Array.isArray(l)?l:[l];return p=u.array.flatten(p),p}const d=s.get(e,t,i);let h;return h=null!=l&&l.virtuals.hasOwnProperty(e)?[l.virtuals[e].applyGetters(void 0,t)]:Array.isArray(d)?d:[d],h}},1962:(e,t,n)=>{"use strict";var r=n(25508),o=n(58597),i=n(68134)("body-parser:text"),s=n(23499),a=n(81592);e.exports=function(e){var t=e||{},n=t.defaultCharset||"utf-8",u=!1!==t.inflate,c="number"!=typeof t.limit?r.parse(t.limit||"100kb"):t.limit,l=t.type||"text/plain",p=t.verify||!1;if(!1!==p&&"function"!=typeof p)throw new TypeError("option verify must be function");var d="function"!=typeof l?function(e){return function(t){return Boolean(a(t,e))}}(l):l;function h(e){return e}return function(e,t,r){if(e._body)return i("body already parsed"),void r();if(e.body=e.body||{},!a.hasBody(e))return i("skip empty body"),void r();if(i("content-type %j",e.headers["content-type"]),!d(e))return i("skip parsing"),void r();var l=function(e){try{return(o.parse(e).parameters.charset||"").toLowerCase()}catch(e){return}}(e)||n;s(e,t,r,h,i,{encoding:l,inflate:u,limit:c,verify:p})}}},1992:(e,t,n)=>{"use strict";const r=n(87735),o=n(2203).Readable,i=n(10255),s=n(96034),a=n(21382),u=n(66684),{once:c}=n(24434),l=n(39023);function p(e){o.call(this,{autoDestroy:!0,objectMode:!0}),this.cursor=null,this.skipped=!1,this.query=e,this._closed=!1;const t=e.model;this._mongooseOptions={},this._transforms=[],this.model=t,this.options={},t.hooks.execPre("find",e,n=>{if(null!=n){if(n instanceof a.skipWrappedFunction){const e=n.args[0];if(null!=e&&(!Array.isArray(e)||e.length)){const t=new r('Cannot `skipMiddlewareFunction()` with a value when using `.find().cursor()`, value must be nullish or empty array, got "'+l.inspect(e)+'".');return this._markError(t),void(this.listeners("error").length>0&&this.emit("error",t))}return this.skipped=!0,void this.emit("cursor",null)}return this._markError(n),void(this.listeners("error").length>0&&this.emit("error",n))}Object.assign(this.options,e._optionsForExec()),this._transforms=this._transforms.concat(e._transforms.slice()),this.options.transform&&this._transforms.push(this.options.transform),this.options.batchSize&&(this.options._populateBatchSize=Math.min(this.options.batchSize,5e3)),e._mongooseOptions._asyncIterator&&(this._mongooseOptions._asyncIterator=!0),t.collection._shouldBufferCommands()&&t.collection.buffer?t.collection.queue.push([()=>d(e,this)]):d(e,this)})}function d(e,t){try{const n=e.model.collection.find(e._conditions,t.options);t.cursor=n,t.emit("cursor",n)}catch(e){t._markError(e),t.listeners("error").length>0&&t.emit("error",t._error)}}function h(e,t){let n=t;return n=function(n,r){return n?t(n):null===r?e._mongooseOptions._asyncIterator?t(null,{done:!0}):t(null,null):(e._transforms.length&&null!==r&&(r=e._transforms.reduce(function(t,n){return n.call(e,t)},r)),e._mongooseOptions._asyncIterator?t(null,{value:r,done:!1}):t(null,r))},e._error?u(function(){n(e._error)}):e.skipped?u(()=>n(null,null)):e.cursor?(e.query._mongooseOptions.populate&&!e._pop&&(e._pop=s.preparePopulationOptionsMQ(e.query,e.query._mongooseOptions),e._pop.__noPromise=!0),e.query._mongooseOptions.populate&&e.options._populateBatchSize>1?e._batchDocs&&e._batchDocs.length?g(e,e._batchDocs.shift(),e._pop,n):e._batchExhausted?n(null,null):(e._batchDocs=[],void e.cursor.next().then(t=>{f.call({ctx:e,callback:n},null,t)},t=>{f.call({ctx:e,callback:n},t)})):e.cursor.next().then(t=>{if(t)return e.query._mongooseOptions.populate?void g(e,t,e._pop,(t,r)=>{if(null!=t)return n(t);e.query.model.populate(r,e._pop).then(e=>n(null,e),e=>n(e))}):g(e,t,null,n);n(null,null)},e=>{n(e)})):(e.once("error",t),void e.once("cursor",function(n){if(e.removeListener("error",t),null==n)return e.skipped?t(null,null):void 0;h(e,t)}))}function f(e,t){return e?this.callback(e):t?(this.ctx._batchDocs.push(t),void(this.ctx._batchDocs.length<this.ctx.options._populateBatchSize?u(()=>this.ctx.cursor.next().then(e=>{f.call(this,null,e)},e=>{f.call(this,e)})):m.call(this))):(this.ctx._batchExhausted=!0,m.call(this))}function m(){if(!this.ctx._batchDocs.length)return this.callback(null,null);this.ctx.query.model.populate(this.ctx._batchDocs,this.ctx._pop).then(()=>{g(this.ctx,this.ctx._batchDocs.shift(),this.ctx._pop,this.callback)},e=>{this.callback(e)})}function g(e,t,n,r){if(e.query._mongooseOptions.lean)return e.model.hooks.execPost("find",e.query,[[t]],e=>{if(null!=e)return r(e);r(null,t)});const{model:o,_fields:i,_userProvidedFields:a,options:u}=e.query;s.createModelAndInit(o,t,i,a,u,n,(t,n)=>{if(null!=t)return r(t);e.model.hooks.execPost("find",e.query,[[n]],e=>{if(null!=e)return r(e);r(null,n)})})}function y(e,t){if(e.cursor)return t();e.once("cursor",function(e){null!=e&&t()})}l.inherits(p,o),p.prototype._read=function(){h(this,(e,t)=>e?this.emit("error",e):t?void this.push(t):(this.push(null),void this.cursor.close(function(e){if(e)return this.emit("error",e)})))},p.prototype.getDriverCursor=async function(){return this.cursor||await c(this,"cursor"),this.cursor},Object.defineProperty(p.prototype,"map",{value:function(e){return this._transforms.push(e),this},enumerable:!0,configurable:!0,writable:!0}),p.prototype._markError=function(e){return this._error=e,this},p.prototype.close=async function(){if("function"==typeof arguments[0])throw new r("QueryCursor.prototype.close() no longer accepts a callback");try{await this.cursor.close(),this._closed=!0,this.emit("close")}catch(e){throw this.listeners("error").length>0&&this.emit("error",e),e}},p.prototype._destroy=function(e,t){let n=null;return n=this.cursor?Promise.resolve():new Promise(e=>{this.once("cursor",e)}),n.then(()=>{this.cursor.close()}).then(()=>{this._closed=!0,t()}).catch(e=>{t(e)}),this},p.prototype.rewind=function(){return y(this,()=>{this.cursor.rewind()}),this},p.prototype.next=async function(){if("function"==typeof arguments[0])throw new r("QueryCursor.prototype.next() no longer accepts a callback");if(this._closed)throw new r("Cannot call `next()` on a closed cursor");return new Promise((e,t)=>{h(this,function(n,r){if(n)return t(n);e(r)})})},p.prototype.eachAsync=function(e,t){if("function"==typeof arguments[2])throw new r("QueryCursor.prototype.eachAsync() no longer accepts a callback");return"function"==typeof t&&(t={}),i(e=>h(this,e),e,t=t||{})},p.prototype.options,p.prototype.addCursorFlag=function(e,t){return y(this,()=>{this.cursor.addCursorFlag(e,t)}),this},null!=Symbol.asyncIterator&&(p.prototype[Symbol.asyncIterator]=function(){return this._mongooseOptions._asyncIterator=!0,this}),e.exports=p},2056:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t){return(0,r.default)(e),0===((t=(0,o.default)(t,s)).ignore_whitespace?e.trim().length:e.length)};var r=i(n(83399)),o=i(n(93610));function i(e){return e&&e.__esModule?e:{default:e}}var s={ignore_whitespace:!1};e.exports=t.default,e.exports.default=t.default},2171:(e,t,n)=>{"use strict";var r=n(99541),o=n(18147),i=n(25436),s=n(997);const a={anchorPrefix:"a",customTags:null,indent:2,indentSeq:!0,keepCstNodes:!1,keepNodeTypes:!0,keepUndefined:!1,mapAsMap:!1,maxAliasCount:100,prettyErrors:!0,simpleKeys:!1,version:"1.2"},u={get binary(){return i.binaryOptions},set binary(e){Object.assign(i.binaryOptions,e)},get bool(){return i.boolOptions},set bool(e){Object.assign(i.boolOptions,e)},get int(){return i.intOptions},set int(e){Object.assign(i.intOptions,e)},get null(){return i.nullOptions},set null(e){Object.assign(i.nullOptions,e)},get str(){return i.strOptions},set str(e){Object.assign(i.strOptions,e)}},c={"1.0":{schema:"yaml-1.1",merge:!0,tagPrefixes:[{handle:"!",prefix:r.defaultTagPrefix},{handle:"!!",prefix:"tag:private.yaml.org,2002:"}]},1.1:{schema:"yaml-1.1",merge:!0,tagPrefixes:[{handle:"!",prefix:"!"},{handle:"!!",prefix:r.defaultTagPrefix}]},1.2:{schema:"core",merge:!1,resolveKnownTags:!0,tagPrefixes:[{handle:"!",prefix:"!"},{handle:"!!",prefix:r.defaultTagPrefix}]}};function l(e,t){if("1.0"===(e.version||e.options.version)){const e=t.match(/^tag:private\.yaml\.org,2002:([^:/]+)$/);if(e)return"!"+e[1];const n=t.match(/^tag:([a-zA-Z0-9-]+)\.yaml\.org,2002:(.*)/);return n?`!${n[1]}/${n[2]}`:`!${t.replace(/^tag:/,"")}`}let n=e.tagPrefixes.find(e=>0===t.indexOf(e.prefix));if(!n){const r=e.getDefaults().tagPrefixes;n=r&&r.find(e=>0===t.indexOf(e.prefix))}if(!n)return"!"===t[0]?t:`!<${t}>`;const r=t.substr(n.prefix.length).replace(/[!,[\]{}]/g,e=>({"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"}[e]));return n.handle+r}function p(e,t,n,r){const{schema:o}=t.doc;let s;if(e instanceof i.Node||(e=t.doc.createNode(e,{onTagObj:e=>s=e,wrapScalars:!0})),e instanceof i.Pair)return e.toString(t,n,r);s||(s=function(e,t){if(t instanceof i.Alias)return i.Alias;if(t.tag){const n=e.filter(e=>e.tag===t.tag);if(n.length>0)return n.find(e=>e.format===t.format)||n[0]}let n,r;if(t instanceof i.Scalar){r=t.value;const o=e.filter(e=>e.identify&&e.identify(r));n=o.find(e=>e.format===t.format)||o.find(e=>!e.format)}else r=t,n=e.find(e=>e.nodeClass&&r instanceof e.nodeClass);if(!n){const e=r&&r.constructor?r.constructor.name:typeof r;throw new Error(`Tag not resolved for ${e} value`)}return n}(o.tags,e));const a=function(e,t,{anchors:n,doc:r}){const o=[],i=r.anchors.getName(e);return i&&(n[i]=e,o.push(`&${i}`)),e.tag?o.push(l(r,e.tag)):t.default||o.push(l(r,t.tag)),o.join(" ")}(e,s,t);a.length>0&&(t.indentAtStart=(t.indentAtStart||0)+a.length+1);const u="function"==typeof s.stringify?s.stringify(e,t,n,r):e instanceof i.Scalar?i.stringifyString(e,t,n,r):e.toString(t,n,r);return a?e instanceof i.Scalar||"{"===u[0]||"["===u[0]?`${a} ${u}`:`${a}\n${t.indent}${u}`:u}class d{static validAnchorNode(e){return e instanceof i.Scalar||e instanceof i.YAMLSeq||e instanceof i.YAMLMap}constructor(e){r._defineProperty(this,"map",Object.create(null)),this.prefix=e}createAlias(e,t){return this.setAnchor(e,t),new i.Alias(e)}createMergePair(...e){const t=new s.Merge;return t.value.items=e.map(e=>{if(e instanceof i.Alias){if(e.source instanceof i.YAMLMap)return e}else if(e instanceof i.YAMLMap)return this.createAlias(e);throw new Error("Merge sources must be Map nodes or their Aliases")}),t}getName(e){const{map:t}=this;return Object.keys(t).find(n=>t[n]===e)}getNames(){return Object.keys(this.map)}getNode(e){return this.map[e]}newName(e){e||(e=this.prefix);const t=Object.keys(this.map);for(let n=1;;++n){const r=`${e}${n}`;if(!t.includes(r))return r}}resolveNodes(){const{map:e,_cstAliases:t}=this;Object.keys(e).forEach(t=>{e[t]=e[t].resolved}),t.forEach(e=>{e.source=e.source.resolved}),delete this._cstAliases}setAnchor(e,t){if(null!=e&&!d.validAnchorNode(e))throw new Error("Anchors may only be set for Scalar, Seq and Map nodes");if(t&&/[\x00-\x19\s,[\]{}]/.test(t))