File "stderr.log"

Full Path: /home/wiomgjqe/neduas.store/v2/views/auto-import/stderr.log
File size: 543.38 KB
MIME-type: text/plain
Charset: utf-8

/home/wiomgjqe/neduas.store/server.js:124
`}};MC.AggregateError=sJ});var n5e=A(AC=>{"use strict";Object.defineProperty(AC,"__esModule",{value:!0});AC.Deferred=void 0;var Tsr=iJ(),cJ=class{constructor(){this._promise=new Promise((r,a)=>{this._reject=a,this._resolve=r})}registerTimeout(r,a){this._timeout||(this._timeout=setTimeout(()=>{a(),this.reject(new Tsr.TimeoutError("Operation timeout"))},r))}_clearTimeout(){this._timeout&&clearTimeout(this._timeout)}resolve(r){this._clearTimeout(),this._resolve(r)}reject(r){this._clearTimeout(),this._reject(r)}promise(){return this._promise}};AC.Deferred=cJ});var i5e=A(OC=>{"use strict";Object.defineProperty(OC,"__esModule",{value:!0});OC.Pool=void 0;var qsr=n5e(),Nsr=oJ(),uJ=class{constructor(r){if(this.log=!1,!r.create)throw new Error("create function is required");if(!r.destroy)throw new Error("destroy function is required");if(!r.validate)throw new Error("validate function is required");if(typeof r.min!="number"||r.min<0||r.min!==Math.round(r.min))throw new Error("min must be an integer >= 0");if(typeof r.max!="number"||r.max<=0||r.max!==Math.round(r.max))throw new Error("max must be an integer > 0");if(r.min>r.max)throw new Error("max is smaller than min");if(r.maxUses!==void 0&&(typeof r.maxUses!="number"||r.maxUses<0))throw new Error("maxUses must be an integer >= 0");this.idleTimeoutMillis=r.idleTimeoutMillis||3e4,this.acquireTimeoutMillis=r.acquireTimeoutMillis||3e4,this.reapIntervalMillis=r.reapIntervalMillis||1e3,this.maxUsesPerResource=r.maxUses||1/0,this.log=r.log||!1,this._factory=r,this._count=0,this._draining=!1,this._pendingAcquires=[],this._inUseObjects=[],this._availableObjects=[],this._removeIdleScheduled=!1}get size(){return this._count}get name(){return this._factory.name}get available(){return this._availableObjects.length}get using(){return this._inUseObjects.length}get waiting(){return this._pendingAcquires.length}get maxSize(){return this._factory.max}get minSize(){return this._factory.min}_log(r,a){typeof this.log=="function"?this.log(r,a):this.log&&console.log(`${a.toUpperCase()} pool ${this.name||""} - ${r}`)}_removeIdle(){let r=[],a=Date.now(),n,i=this._availableObjects.length,s=this.size-this.minSize,o;for(this._removeIdleScheduled=!1,n=0;n<i&&s>r.length;n++)o=this._availableObjects[n].timeout,a>=o&&(this._log("removeIdle() destroying obj - now:"+a+" timeout:"+o,"verbose"),r.push(this._availableObjects[n].resource));r.forEach(this.destroy,this),i=this._availableObjects.length,i>0?(this._log("this._availableObjects.length="+i,"verbose"),this._scheduleRemoveIdle()):this._log("removeIdle() all objects removed","verbose")}_scheduleRemoveIdle(){this._removeIdleScheduled||(this._removeIdleScheduled=!0,this._removeIdleTimer=setTimeout(()=>{this._removeIdle()},this.reapIntervalMillis))}_dispense(){let r=null,a=this._pendingAcquires.length;if(this._log(`dispense() clients=${a} available=${this._availableObjects.length}`,"info"),!(a<1)){for(;this._availableObjects.length>0;){if(this._log("dispense() - reusing obj","verbose"),r=this._availableObjects[this._availableObjects.length-1],!this._factory.validate(r.resource)){this.destroy(r.resource);continue}return this._availableObjects.pop(),this._addResourceToInUseObjects(r.resource,r.useCount),this._pendingAcquires.shift().resolve(r.resource)}this.size<this.maxSize&&this._createResource()}}_createResource(){this._count+=1,this._log(`createResource() - creating obj - count=${this.size} min=${this.minSize} max=${this.maxSize}`,"verbose"),this._factory.create().then(r=>{let a=this._pendingAcquires.shift();a?(this._addResourceToInUseObjects(r,0),a.resolve(r)):this._addResourceToAvailableObjects(r,0)}).catch(r=>{let a=this._pendingAcquires.shift();this._count-=1,this._count<0&&(this._count=0),a&&a.reject(r),process.nextTick(()=>{this._dispense()})})}_addResourceToAvailableObjects(r,a){let n={resource:r,useCount:a,timeout:Date.now()+this.idleTimeoutMillis};this._availableObjects.push(n),this._dispense(),this._scheduleRemoveIdle()}_addResourceToInUseObjects(r,a){let n={resource:r,useCount:a};this._inUseObjects.push(n)}_ensureMinimum(){let r,a;if(!this._draining&&this.size<this.minSize)for(a=this.minSize-this.size,r=0;r<a;r++)this._createResource()}acquire(){if(this._draining)return Promise.reject(new Error("pool is draining and cannot accept work"));let r=new qsr.Deferred;return r.registerTimeout(this.acquireTimeoutMillis,()=>{this._pendingAcquires=this._pendingAcquires.filter(a=>a!==r)}),this._pendingAcquires.push(r),this._dispense(),r.promise()}release(r){if(this._availableObjects.some(i=>i.resource===r)){this._log("release called twice for the same resource: "+new Error().stack,"error");return}let a=this._inUseObjects.findIndex(i=>i.resource===r);if(a<0){this._log("attempt to release an invalid resource: "+new Error().stack,"error");return}let n=this._inUseObjects[a];n.useCount+=1,n.useCount>=this.maxUsesPerResource?(this._log("release() destroying obj - useCount:"+n.useCount+" maxUsesPerResource:"+this.maxUsesPerResource,"verbose"),this.destroy(n.resource),this._dispense()):(this._inUseObjects.splice(a,1),this._addResourceToAvailableObjects(n.resource,n.useCount))}async destroy(r){let a=this._availableObjects.length,n=this._inUseObjects.length;if(this._availableObjects=this._availableObjects.filter(i=>i.resource!==r),this._inUseObjects=this._inUseObjects.filter(i=>i.resource!==r),a===this._availableObjects.length&&n===this._inUseObjects.length){this._ensureMinimum();return}this._count-=1,this._count<0&&(this._count=0);try{await this._factory.destroy(r)}finally{this._ensureMinimum(),this._draining||process.nextTick(()=>{this._dispense()})}}drain(){this._log("draining","info"),this._draining=!0;let r=a=>{if(this._pendingAcquires.length>0){this._dispense(),setTimeout(()=>{r(a)},100);return}if(this._availableObjects.length!==this._count){setTimeout(()=>{r(a)},100);return}a()};return new Promise(a=>r(a))}async destroyAllNow(){this._log("force destroying all objects","info"),this._removeIdleScheduled=!1,clearTimeout(this._removeIdleTimer);let r=this._availableObjects.map(n=>n.resource),a=[];for(let n of r)try{await this.destroy(n)}catch(i){this._log("Error destroying resource: "+i.stack,"error"),a.push(i)}if(a.length>0)throw new Nsr.AggregateError(a)}};OC.Pool=uJ});var s5e=A(Nh=>{"use strict";Object.defineProperty(Nh,"__esModule",{value:!0});Nh.Pool=Nh.AggregateError=Nh.TimeoutError=void 0;var Isr=iJ();Object.defineProperty(Nh,"TimeoutError",{enumerable:!0,get:function(){return Isr.TimeoutError}});var Ssr=oJ();Object.defineProperty(Nh,"AggregateError",{enumerable:!0,get:function(){return Ssr.AggregateError}});var xsr=i5e();Object.defineProperty(Nh,"Pool",{enumerable:!0,get:function(){return xsr.Pool}})});var Df=A((j9a,yC)=>{"use strict";var{Pool:lJ,TimeoutError:ksr}=s5e(),Ih=hr(),pJ=qh(),Csr=cn(),{logger:Lsr}=Ti(),Dsr=nA(),Jl=Lsr.debugContext("pool"),uR=class{constructor(r,a){let n=Ih.cloneDeep(a.config);if(this.sequelize=a,this.config=n,this.dialect=r,this.versionPromise=null,this.dialectName=this.sequelize.options.dialect,n.pool===!1)throw new Error("Support for pool:false was removed in v4.0");n.pool=Ih.defaults(n.pool||{},{max:5,min:0,idle:1e4,acquire:6e4,evict:1e3,validate:this._validate.bind(this)}),this.initPools()}refreshTypeParser(r){Ih.each(r,a=>{if(Object.prototype.hasOwnProperty.call(a,"parse"))if(a.types[this.dialectName])this._refreshTypeParser(a);else throw new Error(`Parse function not supported for type ${a.key} in dialect ${this.dialectName}`)})}_loadDialectModule(r){try{return this.sequelize.config.dialectModulePath?require(this.sequelize.config.dialectModulePath):this.sequelize.config.dialectModule?this.sequelize.config.dialectModule:require(r)}catch(a){throw a.code==="MODULE_NOT_FOUND"?this.sequelize.config.dialectModulePath?new Error(`Unable to find dialect at ${this.sequelize.config.dialectModulePath}`):new Error(`Please install ${r} package manually`):a}}async _onProcessExit(){if(this.pool)return await this.pool.drain(),Jl("connection drain due to process exit"),await this.pool.destroyAllNow()}async close(){return this.getConnection=async function(){throw new Error("ConnectionManager.getConnection was called after the connection manager was closed!")},await this._onProcessExit()}initPools(){let r=this.config;if(!r.replication){this.pool=new lJ({name:"sequelize",create:()=>this._connect(r),destroy:async n=>{let i=await this._disconnect(n);return Jl("connection destroy"),i},validate:r.pool.validate,max:r.pool.max,min:r.pool.min,acquireTimeoutMillis:r.pool.acquire,idleTimeoutMillis:r.pool.idle,reapIntervalMillis:r.pool.evict,maxUses:r.pool.maxUses}),Jl(`pool created with max/min: ${r.pool.max}/${r.pool.min}, no replication`);return}Array.isArray(r.replication.read)||(r.replication.read=[r.replication.read]),r.replication.write=Ih.defaults(r.replication.write,Ih.omit(r,"replication")),r.replication.read=r.replication.read.map(n=>Ih.defaults(n,Ih.omit(this.config,"replication")));let a=0;this.pool={release:n=>{n.queryType==="read"?this.pool.read.release(n):this.pool.write.release(n)},acquire:(n,i)=>(i=i===void 0?!1:i,n==="SELECT"&&!i?this.pool.read.acquire():this.pool.write.acquire()),destroy:n=>{this.pool[n.queryType].destroy(n),Jl("connection destroy")},destroyAllNow:async()=>{await Promise.all([this.pool.read.destroyAllNow(),this.pool.write.destroyAllNow()]),Jl("all connections destroyed")},drain:async()=>Promise.all([this.pool.write.drain(),this.pool.read.drain()]),read:new lJ({name:"sequelize:read",create:async()=>{let n=a++%r.replication.read.length,i=await this._connect(r.replication.read[n]);return i.queryType="read",i},destroy:n=>this._disconnect(n),validate:r.pool.validate,max:r.pool.max,min:r.pool.min,acquireTimeoutMillis:r.pool.acquire,idleTimeoutMillis:r.pool.idle,reapIntervalMillis:r.pool.evict,maxUses:r.pool.maxUses}),write:new lJ({name:"sequelize:write",create:async()=>{let n=await this._connect(r.replication.write);return n.queryType="write",n},destroy:n=>this._disconnect(n),validate:r.pool.validate,max:r.pool.max,min:r.pool.min,acquireTimeoutMillis:r.pool.acquire,idleTimeoutMillis:r.pool.idle,reapIntervalMillis:r.pool.evict,maxUses:r.pool.maxUses})},Jl(`pool created with max/min: ${r.pool.max}/${r.pool.min}, with replication`)}async getConnection(r){r=r||{},this.sequelize.options.databaseVersion===0&&(this.versionPromise||(this.versionPromise=(async()=>{try{let n=await this._connect(this.config.replication.write||this.config),i={};if(i.transaction={connection:n},i.logging=()=>{},i.logging.__testLoggingFn=!0,this.sequelize.options.databaseVersion===0){let s=await this.sequelize.databaseVersion(i),o=Ih.get(pJ.coerce(s),"version")||s;this.sequelize.options.databaseVersion=pJ.valid(o)?o:this.dialect.defaultVersion}return pJ.lt(this.sequelize.options.databaseVersion,this.dialect.defaultVersion)&&(Dsr.unsupportedEngine(),Jl(`Unsupported database engine version ${this.sequelize.options.databaseVersion}`)),this.versionPromise=null,await this._disconnect(n)}catch(n){throw this.versionPromise=null,n}})()),await this.versionPromise);let a;try{await this.sequelize.runHooks("beforePoolAcquire",r),a=await this.pool.acquire(r.type,r.useMaster),await this.sequelize.runHooks("afterPoolAcquire",a,r)}catch(n){throw n instanceof ksr?new Csr.ConnectionAcquireTimeoutError(n):n}return Jl("connection acquired"),a}releaseConnection(r){this.pool.release(r),Jl("connection released")}async destroyConnection(r){await this.pool.destroy(r),Jl(`connection ${r.uuid} destroyed`)}async _connect(r){await this.sequelize.runHooks("beforeConnect",r);let a=await this.dialect.connectionManager.connect(r);return await this.sequelize.runHooks("afterConnect",a,r),a}async _disconnect(r){return await this.sequelize.runHooks("beforeDisconnect",r),await this.dialect.connectionManager.disconnect(r),this.sequelize.runHooks("afterDisconnect",r)}_validate(r){return this.dialect.connectionManager.validate?this.dialect.connectionManager.validate(r):!0}};yC.exports=uR;yC.exports.ConnectionManager=uR;yC.exports.default=uR});var Vc=A((G9a,o5e)=>{"use strict";var lR=new Map;o5e.exports=t=>(lR.has(t)||lR.set(t,new Map),{clear(){lR.get(t).clear()},refresh(r){for(let a of r.types[t])lR.get(t).set(a,r.parse)},get(r){return lR.get(t).get(r)}})});var p5e=A((Q9a,EC)=>{"use strict";var Bsr=Object.defineProperty,c5e=Object.getOwnPropertySymbols,Psr=Object.prototype.hasOwnProperty,Wsr=Object.prototype.propertyIsEnumerable,u5e=(t,r,a)=>r in t?Bsr(t,r,{enumerable:!0,configurable:!0,writable:!0,value:a}):t[r]=a,Usr=(t,r)=>{for(var a in r||(r={}))Psr.call(r,a)&&u5e(t,a,r[a]);if(c5e)for(var a of c5e(r))Wsr.call(r,a)&&u5e(t,a,r[a]);return t},Fsr=qh(),jsr=Df(),uA=cn(),{logger:Gsr}=Ti(),Qsr=Ja().mariadb,Hsr=Hl(),l5e=Gsr.debugContext("connection:mariadb"),zC=Vc()("mariadb"),pR=class t extends jsr{constructor(r,a){a.config.port=a.config.port||3306,super(r,a),this.lib=this._loadDialectModule("mariadb"),this.refreshTypeParser(Qsr)}static _typecast(r,a){return zC.get(r.type)?zC.get(r.type)(r,this.sequelize.options,a):a()}_refreshTypeParser(r){zC.refresh(r)}_clearTypeParser(){zC.clear()}async connect(r){let a=this.sequelize.options.timezone;a=/\//.test(a)?Hsr.tz(a).format("Z"):a;let n=Usr({host:r.host,port:r.port,user:r.username,password:r.password,database:r.database,timezone:a,typeCast:t._typecast.bind(this),bigNumberStrings:!1,supportBigNumbers:!0,foundRows:!1},r.dialectOptions);this.sequelize.config.keepDefaultTimezone||(n.initSql?(Array.isArray(n.initSql)||(n.initSql=[n.initSql]),n.initSql.push(`SET time_zone = '${a}'`)):n.initSql=`SET time_zone = '${a}'`);try{let i=await this.lib.createConnection(n);return this.sequelize.options.databaseVersion=Fsr.coerce(i.serverVersion()).version,l5e("connection acquired"),i.on("error",s=>{switch(s.code){case"ESOCKET":case"ECONNRESET":case"EPIPE":case"PROTOCOL_CONNECTION_LOST":this.pool.destroy(i)}}),i}catch(i){switch(i.code){case"ECONNREFUSED":throw new uA.ConnectionRefusedError(i);case"ER_ACCESS_DENIED_ERROR":case"ER_ACCESS_DENIED_NO_PASSWORD_ERROR":throw new uA.AccessDeniedError(i);case"ENOTFOUND":throw new uA.HostNotFoundError(i);case"EHOSTUNREACH":case"ENETUNREACH":case"EADDRNOTAVAIL":throw new uA.HostNotReachableError(i);case"EINVAL":throw new uA.InvalidConnectionError(i);default:throw new uA.ConnectionError(i)}}}async disconnect(r){if(!r.isValid()){l5e("connection tried to disconnect but was already at CLOSED state");return}return await r.end()}validate(r){return r&&r.isValid()}};EC.exports=pR;EC.exports.ConnectionManager=pR;EC.exports.default=pR});var Bf=A((H9a,wC)=>{"use strict";var Vsr=Object.defineProperty,f5e=Object.getOwnPropertySymbols,$sr=Object.prototype.hasOwnProperty,Ysr=Object.prototype.propertyIsEnumerable,d5e=(t,r,a)=>r in t?Vsr(t,r,{enumerable:!0,configurable:!0,writable:!0,value:a}):t[r]=a,Xsr=(t,r)=>{for(var a in r||(r={}))$sr.call(r,a)&&d5e(t,a,r[a]);if(f5e)for(var a of f5e(r))Ysr.call(r,a)&&d5e(t,a,r[a]);return t},Sh=hr(),Ksr=Cv(),rc=m1(),Jsr=Wv(),Zsr=nA(),eor=(JM(),gf(KM)).v4,{safeStringifyJson:h5e}=On(),fR=class t{constructor(r,a,n){this.uuid=eor(),this.connection=r,this.instance=n.instance,this.model=n.model,this.sequelize=a,this.options=Xsr({plain:!1,raw:!1,logging:console.log},n),this.checkLoggingOption(),n.rawErrors&&(this.formatError=t.prototype.formatError)}static formatBindParameters(r,a,n,i,s){if(!a)return[r,[]];if(s=s||{},typeof i!="function"&&(s=i||{},i=void 0),!i)s.skipValueReplace?i=(u,l,f)=>{if(f[l]!==void 0)return u}:i=(u,l,f,d,h)=>{if(f[l]!==void 0)return Ksr.escape(f[l],d,h)};else if(s.skipValueReplace){let u=i;i=(l,f,d,h,b,m)=>{if(u(l,f,d,h,b,m)!==void 0)return l}}let o=null,c=Array.isArray(a);return r=r.replace(/\B\$(\$|\w+)/g,(u,l)=>{if(l==="$")return s.skipUnescape?u:l;let f;if(c?l.match(/^[1-9]\d*$/)&&(l=l-1,f=i(u,l,a,o,n,s)):l.match(/^\d*$/)||(f=i(u,l,a,o,n,s)),f===void 0)throw new Error(`Named bind parameter "${u}" has no value in the given object.`);return f}),[r,[]]}formatError(r,a){return r.stack=a,r}run(){throw new Error("The run method wasn't overwritten!")}checkLoggingOption(){this.options.logging===!0&&(Zsr.noTrueLogging(),this.options.logging=console.log)}getInsertIdField(){return"insertId"}getUniqueConstraintErrorMessage(r){let a=r?`${r} must be unique`:"Must be unique";if(r&&this.model)for(let n of Object.keys(this.model.uniqueKeys))this.model.uniqueKeys[n].fields.includes(r.replace(/"/g,""))&&this.model.uniqueKeys[n].msg&&(a=this.model.uniqueKeys[n].msg);return a}isRawQuery(){return this.options.type===rc.RAW}isVersionQuery(){return this.options.type===rc.VERSION}isUpsertQuery(){return this.options.type===rc.UPSERT}isInsertQuery(r,a){let n=!0;return this.options.type===rc.INSERT?!0:(n=n&&this.sql.toLowerCase().startsWith("insert into"),n=n&&(!r||Object.prototype.hasOwnProperty.call(r,this.getInsertIdField())),n=n&&(!a||Object.prototype.hasOwnProperty.call(a,this.getInsertIdField())),n)}handleInsertQuery(r,a){if(this.instance){let n=this.model.autoIncrementAttribute,i=null;i=i||r&&r[this.getInsertIdField()],i=i||a&&a[this.getInsertIdField()],this.instance[n]=i}}isShowTablesQuery(){return this.options.type===rc.SHOWTABLES}handleShowTablesQuery(r){return Sh.flatten(r.map(a=>Object.values(a)))}isShowIndexesQuery(){return this.options.type===rc.SHOWINDEXES}isShowConstraintsQuery(){return this.options.type===rc.SHOWCONSTRAINTS}isDescribeQuery(){return this.options.type===rc.DESCRIBE}isSelectQuery(){return this.options.type===rc.SELECT}isBulkUpdateQuery(){return this.options.type===rc.BULKUPDATE}isBulkDeleteQuery(){return this.options.type===rc.BULKDELETE}isForeignKeysQuery(){return this.options.type===rc.FOREIGNKEYS}isUpdateQuery(){return this.options.type===rc.UPDATE}handleSelectQuery(r){let a=null;if(this.options.fieldMap){let n=this.options.fieldMap;r=r.map(i=>Sh.reduce(n,(s,o,c)=>(s[c]!==void 0&&o!==c&&(s[o]=s[c],delete s[c]),s),i))}return this.options.raw?a=r.map(n=>{let i={};for(let s in n)Object.prototype.hasOwnProperty.call(n,s)&&(i[s]=n[s]);return this.options.nest&&(i=Jsr.transform(i)),i}):this.options.hasJoin===!0?(r=t._groupJoinData(r,{model:this.model,includeMap:this.options.includeMap,includeNames:this.options.includeNames},{checkExisting:this.options.hasMultiAssociation}),a=this.model.bulkBuild(r,{isNewRecord:!1,include:this.options.include,includeNames:this.options.includeNames,includeMap:this.options.includeMap,includeValidated:!0,attributes:this.options.originalAttributes||this.options.attributes,raw:!0})):a=this.model.bulkBuild(r,{isNewRecord:!1,raw:!0,attributes:this.options.originalAttributes||this.options.attributes}),this.options.plain&&(a=a.length===0?null:a[0]),a}isShowOrDescribeQuery(){let r=!1;return r=r||this.sql.toLowerCase().startsWith("show"),r=r||this.sql.toLowerCase().startsWith("describe"),r}isCallQuery(){return this.sql.toLowerCase().startsWith("call")}_logQuery(r,a,n){let{connection:i,options:s}=this,o=this.sequelize.options.benchmark||s.benchmark,c=this.sequelize.options.logQueryParameters||s.logQueryParameters,u=Date.now(),l="";if(c&&n){let h=r.endsWith(";")?"":";",b;Array.isArray(n)?b=n.map(m=>h5e(m)).join(", "):b=h5e(n),l=`${h} ${b}`}let f=`(${i.uuid||"default"}): ${r}${l}`,d=`Executing ${f}`;return a(d),o||this.sequelize.log(`Executing ${f}`,s),()=>{let h=`Executed ${f}`;a(h),o&&this.sequelize.log(h,Date.now()-u,s)}}static _groupJoinData(r,a,n){if(!r.length)return[];let i,s,o,c,u,l,f=r.length,d,h,b,m,g,O,z,w,v=n.checkExisting,T,x,L,P=v?[]:new Array(f),C={},Q={},X,k,se,F,D,j,V,he,oe=ne=>{Object.prototype.hasOwnProperty.call(j.includeMap,ne)&&(Q[h]=j=j.includeMap[ne],he?he=`${he}.${ne}`:he=ne,Q[he]=j)},ie={},De=(ne,we)=>(Object.prototype.hasOwnProperty.call(we,ne)||(we[ne]=ne.substr(0,ne.lastIndexOf("."))),we[ne]),Ge={},Ze=ne=>{if(!Object.prototype.hasOwnProperty.call(Ge,ne)){let we=ne.lastIndexOf(".");Ge[ne]=ne.substr(we===-1?0:we+1)}return Ge[ne]},te={},me=ne=>{if(!Object.prototype.hasOwnProperty.call(te,ne)){let we=De(ne,ie);Object.prototype.hasOwnProperty.call(te,we)||(te[we]=we?we.split("."):[]),te[ne]=te[we]}return te[ne]},ve={},ye=ne=>{if(!Object.prototype.hasOwnProperty.call(ve,ne)){let we=me(ne),ke=we.length;ve[ne]=ke?we[ke-1]:""}return ve[ne]},Qe=ne=>{let we=Sh.chain(ne.uniqueKeys);return we=we.result(`${we.findKey()}.fields`).map(ke=>Sh.findKey(ne.attributes,je=>je.field===ke)).value(),we},Ke=ne=>ne instanceof Buffer?ne.toString("hex"):ne,Se,ft,qe;for(u=0;u<f;u++){if(l=r[u],u===0&&(d=Sh.sortBy(Object.keys(l),ne=>[ne.split(".").length]),m=d.length),v){if(w=!1,c=a.model.primaryKeyAttributes.length,L="",c===1)L=Ke(l[a.model.primaryKeyAttributes[0]]);else if(c>1)for(o=0;o<c;o++)L+=Ke(l[a.model.primaryKeyAttributes[o]]);else if(!Sh.isEmpty(a.model.uniqueKeys))for(ft=Qe(a.model),o=0;o<ft.length;o++)L+=l[ft[o]]}for(z=O={},F=void 0,b=0;b<m;b++){if(h=d[b],k=De(h,ie),X=me(h),u===0&&!Object.prototype.hasOwnProperty.call(Q,h)&&(X.length?(j=a,he=void 0,X.forEach(oe)):Q[h]=Q[""]=a),F!==void 0&&F!==X){if(v){if(s=F.length,V=null,x=null,s)for(i=0;i<s;i++){if(qe=V?`${V}.${F[i]}`:F[i],Se=Q[qe].model.primaryKeyAttributes,c=Se.length,T=qe,c===1)T+=Ke(l[`${qe}.${Se[0]}`]);else if(c>1)for(o=0;o<c;o++)T+=Ke(l[`${qe}.${Se[o]}`]);else if(!Sh.isEmpty(Q[qe].model.uniqueKeys))for(ft=Qe(Q[qe].model),o=0;o<ft.length;o++)T+=l[`${qe}.${ft[o]}`];x||(x=L),T=x+T,V=qe,i<s-1&&(x=T)}else T=L;T===L?C[T]?w=!0:C[T]=O:C[T]||(V=C[x],D=ye(g),Q[g].association.isSingleAssociation?V&&(V[D]=C[T]=O):(V[D]||(V[D]=[]),V[D].push(C[T]=O))),O={}}else if(j=z,s=X.length,s)for(i=0;i<s;i++)i===s-1&&(O=j[X[i]]={}),j=j[X[i]]||{}}O[Ze(h)]=l[h],g=h,F=X,se=k}if(v){if(s=F.length,V=null,x=null,s)for(i=0;i<s;i++){if(qe=V?`${V}.${F[i]}`:F[i],Se=Q[qe].model.primaryKeyAttributes,c=Se.length,T=qe,c===1)T+=Ke(l[`${qe}.${Se[0]}`]);else if(c>0)for(o=0;o<c;o++)T+=Ke(l[`${qe}.${Se[o]}`]);else if(!Sh.isEmpty(Q[qe].model.uniqueKeys))for(ft=Qe(Q[qe].model),o=0;o<ft.length;o++)T+=l[`${qe}.${ft[o]}`];x||(x=L),T=x+T,V=qe,i<s-1&&(x=T)}else T=L;T===L?C[T]?w=!0:C[T]=O:C[T]||(V=C[x],D=ye(g),Q[g].association.isSingleAssociation?V&&(V[D]=C[T]=O):(V[D]||(V[D]=[]),V[D].push(C[T]=O))),w||P.push(z)}else P[u]=z}return P}};wC.exports=fR;wC.exports.AbstractQuery=fR;wC.exports.default=fR});var y5e=A((V9a,O5e)=>{"use strict";var tor=Object.defineProperty,b5e=Object.getOwnPropertySymbols,ror=Object.prototype.hasOwnProperty,aor=Object.prototype.propertyIsEnumerable,m5e=(t,r,a)=>r in t?tor(t,r,{enumerable:!0,configurable:!0,writable:!0,value:a}):t[r]=a,nor=(t,r)=>{for(var a in r||(r={}))ror.call(r,a)&&m5e(t,a,r[a]);if(b5e)for(var a of b5e(r))aor.call(r,a)&&m5e(t,a,r[a]);return t},_5e=Bf(),vC=cn(),g5e=hr(),fJ=Ja(),{logger:ior}=Ti(),sor=1062,oor=1213,M5e=1451,cor=1452,A5e=ior.debugContext("sql:mariadb"),dJ=class extends _5e{constructor(r,a,n){super(r,a,nor({showWarnings:!1},n))}static formatBindParameters(r,a,n){let i=[],s=(o,c,u)=>{if(u[c]!==void 0)return i.push(u[c]),"?"};return r=_5e.formatBindParameters(r,a,n,s)[0],[r,i.length>0?i:void 0]}async run(r,a){this.sql=r;let{connection:n,options:i}=this,s=this.sequelize.options.showWarnings||i.showWarnings,o=this._logQuery(r,A5e,a);a&&A5e("parameters(%j)",a);let c,u=new Error;try{c=await n.query(this.sql,a)}catch(l){if(i.transaction&&l.errno===oor){try{await i.transaction.rollback()}catch{}i.transaction.finished="rollback"}throw l.sql=r,l.parameters=a,this.formatError(l,u.stack)}finally{o()}return s&&c&&c.warningStatus>0&&await this.logWarnings(c),this.formatResults(c)}formatResults(r){let a=this.instance;if(this.isBulkUpdateQuery()||this.isBulkDeleteQuery())return r.affectedRows;if(this.isUpsertQuery())return[a,r.affectedRows===1];if(this.isInsertQuery(r)&&(this.handleInsertQuery(r),!this.instance)){if(this.model&&this.model.autoIncrementAttribute&&this.model.autoIncrementAttribute===this.model.primaryKeyAttribute&&this.model.rawAttributes[this.model.primaryKeyAttribute]){let n=r[this.getInsertIdField()];a=new Array(r.affectedRows);let i=this.model.rawAttributes[this.model.primaryKeyAttribute].field;for(let s=0;s<r.affectedRows;s++)a[s]={[i]:n+s};return[a,r.affectedRows]}return[r[this.getInsertIdField()],r.affectedRows]}if(this.isSelectQuery())return this.handleJsonSelectQuery(r),this.handleSelectQuery(r);if(this.isInsertQuery()||this.isUpdateQuery())return[a,r.affectedRows];if(this.isCallQuery())return r[0];if(this.isRawQuery()){let n=r.meta;return delete r.meta,[r,n]}if(this.isShowIndexesQuery())return this.handleShowIndexesQuery(r);if(this.isForeignKeysQuery()||this.isShowConstraintsQuery())return r;if(this.isShowTablesQuery())return this.handleShowTablesQuery(r);if(this.isDescribeQuery()){a={};for(let n of r)a[n.Field]={type:n.Type.toLowerCase().startsWith("enum")?n.Type.replace(/^enum/i,"ENUM"):n.Type.toUpperCase(),allowNull:n.Null==="YES",defaultValue:n.Default,primaryKey:n.Key==="PRI",autoIncrement:Object.prototype.hasOwnProperty.call(n,"Extra")&&n.Extra.toLowerCase()==="auto_increment",comment:n.Comment?n.Comment:null};return a}return this.isVersionQuery()?r[0].version:a}handleJsonSelectQuery(r){if(!(!this.model||!this.model.fieldRawAttributesMap))for(let a of Object.keys(this.model.fieldRawAttributesMap)){let n=this.model.fieldRawAttributesMap[a];n.type instanceof fJ.JSON&&(r=r.map(i=>(i[n.fieldName]&&typeof i[n.fieldName]=="string"&&!this.connection.info.hasMinVersion(10,5,2)&&(i[n.fieldName]=JSON.parse(i[n.fieldName])),fJ.JSON.parse?fJ.JSON.parse(n,this.sequelize.options,i[n.fieldName]):i)))}}async logWarnings(r){let a=await this.run("SHOW WARNINGS"),n=`MariaDB Warnings (${this.connection.uuid||"default"}): `,i=[];for(let s of a)if(!(s===void 0||typeof s[Symbol.iterator]!="function"))for(let o of s)if(Object.prototype.hasOwnProperty.call(o,"Message"))i.push(o.Message);else for(let c of o.keys())i.push([c,o[c]].join(": "));return this.sequelize.log(n+i.join("; "),this.options),r}formatError(r,a){switch(r.errno){case sor:{let n=r.message.match(/Duplicate entry '([\s\S]*)' for key '?((.|\s)*?)'?\s.*$/),i={},s="Validation error",o=n?n[1].split("-"):void 0,c=n?n[2]:void 0,u=n?n[1]:void 0,l=this.model&&this.model.uniqueKeys[c];l?(l.msg&&(s=l.msg),i=g5e.zipObject(l.fields,o)):i[c]=u;let f=[];return g5e.forOwn(i,(d,h)=>{f.push(new vC.ValidationErrorItem(this.getUniqueConstraintErrorMessage(h),"unique violation",h,d,this.instance,"not_unique"))}),new vC.UniqueConstraintError({message:s,errors:f,parent:r,fields:i,stack:a})}case M5e:case cor:{let n=r.message.match(/CONSTRAINT ([`"])(.*)\1 FOREIGN KEY \(\1(.*)\1\) REFERENCES \1(.*)\1 \(\1(.*)\1\)/),i=n?n[1]:"`",s=n?n[3].split(new RegExp(`${i}, *${i}`)):void 0;return new vC.ForeignKeyConstraintError({reltype:r.errno===M5e?"parent":"child",table:n?n[4]:void 0,fields:s,value:s&&s.length&&this.instance&&this.instance[s[0]]||void 0,index:n?n[2]:void 0,parent:r,stack:a})}default:return new vC.DatabaseError(r,{stack:a})}}handleShowTablesQuery(r){return r.map(a=>({tableName:a.TABLE_NAME,schema:a.TABLE_SCHEMA}))}handleShowIndexesQuery(r){let a,n=[];return r.forEach(i=>{(!a||a.name!==i.Key_name)&&(a={primary:i.Key_name==="PRIMARY",fields:[],name:i.Key_name,tableName:i.Table,unique:i.Non_unique!==1,type:i.Index_type},n.push(a)),a.fields[i.Seq_in_index-1]={attribute:i.Column_name,length:i.Sub_part||void 0,order:i.Collation==="A"?"ASC":void 0}}),n}};O5e.exports=dJ});var v5e=A(($9a,w5e)=>{"use strict";var uor=Object.defineProperty,z5e=Object.getOwnPropertySymbols,lor=Object.prototype.hasOwnProperty,por=Object.prototype.propertyIsEnumerable,E5e=(t,r,a)=>r in t?uor(t,r,{enumerable:!0,configurable:!0,writable:!0,value:a}):t[r]=a,dor=(t,r)=>{for(var a in r||(r={}))lor.call(r,a)&&E5e(t,a,r[a]);if(z5e)for(var a of z5e(r))por.call(r,a)&&E5e(t,a,r[a]);return t},RC=hr(),sa=Ws(),hor=On(),bor={OperatorMap:{[sa.eq]:"=",[sa.ne]:"!=",[sa.gte]:">=",[sa.gt]:">",[sa.lte]:"<=",[sa.lt]:"<",[sa.not]:"IS NOT",[sa.is]:"IS",[sa.in]:"IN",[sa.notIn]:"NOT IN",[sa.like]:"LIKE",[sa.notLike]:"NOT LIKE",[sa.iLike]:"ILIKE",[sa.notILike]:"NOT ILIKE",[sa.startsWith]:"LIKE",[sa.endsWith]:"LIKE",[sa.substring]:"LIKE",[sa.regexp]:"~",[sa.notRegexp]:"!~",[sa.iRegexp]:"~*",[sa.notIRegexp]:"!~*",[sa.between]:"BETWEEN",[sa.notBetween]:"NOT BETWEEN",[sa.overlap]:"&&",[sa.contains]:"@>",[sa.contained]:"<@",[sa.adjacent]:"-|-",[sa.strictLeft]:"<<",[sa.strictRight]:">>",[sa.noExtendRight]:"&<",[sa.noExtendLeft]:"&>",[sa.any]:"ANY",[sa.all]:"ALL",[sa.and]:" AND ",[sa.or]:" OR ",[sa.col]:"COL",[sa.placeholder]:"$$PLACEHOLDER$$",[sa.match]:"@@"},OperatorsAliasMap:{},setOperatorsAliases(t){!t||RC.isEmpty(t)?this.OperatorsAliasMap=!1:this.OperatorsAliasMap=dor({},t)},_replaceAliases(t){let r={};return this.OperatorsAliasMap?(hor.getOperators(t).forEach(a=>{let n=t[a];RC.isPlainObject(n)?r[a]=this._replaceAliases(n):r[a]=n}),RC.forOwn(t,(a,n)=>{n=this.OperatorsAliasMap[n]||n,RC.isPlainObject(a)&&(a=this._replaceAliases(a)),r[n]=a}),r):t}};w5e.exports=bor});var T5e=A((Y9a,R5e)=>{"use strict";var mor=(JM(),gf(KM)).v4,_or={setIsolationLevelQuery(t,r){if(!r.parent)return`SET TRANSACTION ISOLATION LEVEL ${t};`},generateTransactionId(){return mor()},startTransactionQuery(t){return t.parent?`SAVEPOINT ${this.quoteIdentifier(t.name,!0)};`:"START TRANSACTION;"},deferConstraintsQuery(){},setConstraintQuery(){},setDeferredQuery(){},setImmediateQuery(){},commitTransactionQuery(t){if(!t.parent)return"COMMIT;"},rollbackTransactionQuery(t){return t.parent?`ROLLBACK TO SAVEPOINT ${this.quoteIdentifier(t.name,!0)};`:"ROLLBACK;"}};R5e.exports=_or});var xh=A((K9a,x5e)=>{"use strict";var gor=Object.defineProperty,Mor=Object.defineProperties,Aor=Object.getOwnPropertyDescriptors,q5e=Object.getOwnPropertySymbols,Oor=Object.prototype.hasOwnProperty,yor=Object.prototype.propertyIsEnumerable,N5e=(t,r,a)=>r in t?gor(t,r,{enumerable:!0,configurable:!0,writable:!0,value:a}):t[r]=a,A2=(t,r)=>{for(var a in r||(r={}))Oor.call(r,a)&&N5e(t,a,r[a]);if(q5e)for(var a of q5e(r))yor.call(r,a)&&N5e(t,a,r[a]);return t},TC=(t,r)=>Mor(t,Aor(r)),qC=require("util"),ra=hr(),zor=(JM(),gf(KM)).v4,Qt=On(),X9a=nA(),I5e=Cv(),lA=Ja(),Uu=vK(),pA=vh(),hJ=Rh(),Eor=tA(),wor=h2(),Rt=Ws(),bJ=cn(),S5e=LK(),dR=class{constructor(r){if(!r.sequelize)throw new Error("QueryGenerator initialized without options.sequelize");if(!r._dialect)throw new Error("QueryGenerator initialized without options._dialect");this.sequelize=r.sequelize,this.options=r.sequelize.options,this.dialect=r._dialect.name,this._dialect=r._dialect,this._initQuoteIdentifier()}extractTableDetails(r,a){return a=a||{},r=r||{},{schema:r.schema||a.schema||this.options.schema||"public",tableName:ra.isPlainObject(r)?r.tableName:r,delimiter:r.delimiter||a.delimiter||"."}}addSchema(r){if(!r._schema)return r.tableName||r;let a=this;return{tableName:r.tableName||r,table:r.tableName||r,name:r.name||r,schema:r._schema,delimiter:r._schemaDelimiter||".",toString(){return a.quoteTable(this)}}}dropSchema(r,a){return this.dropTableQuery(r,a)}describeTableQuery(r,a,n){return`DESCRIBE ${this.quoteTable(this.addSchema({tableName:r,_schema:a,_schemaDelimiter:n}))};`}dropTableQuery(r){return`DROP TABLE IF EXISTS ${this.quoteTable(r)};`}renameTableQuery(r,a){return`ALTER TABLE ${this.quoteTable(r)} RENAME TO ${this.quoteTable(a)};`}populateInsertQueryReturnIntoBinds(){}insertQuery(r,a,n,i){i=i||{},ra.defaults(i,this.options);let s={},o=i.bind||[],c=[],u=[],l=[],f=[],d=this.quoteTable(r),h=i.bindParam===void 0?this.bindParam(o):i.bindParam,b=[],m,g="",O="",z="",w="",v=!1,T="";if(n&&ra.each(n,(C,Q)=>{s[Q]=C,C.field&&(s[C.field]=C)}),this._dialect.supports["DEFAULT VALUES"]?O+=" DEFAULT VALUES":this._dialect.supports["VALUES ()"]&&(O+=" VALUES ()"),(this._dialect.supports.returnValues||this._dialect.supports.returnIntoValues)&&i.returning){let C=this.generateReturnValues(n,i);u.push(...C.returnFields),this._dialect.supports.returnIntoValues&&l.push(...C.returnTypes),w=C.returningFragment,T=C.tmpTable||"",z=C.outputFragment||""}(ra.get(this,["sequelize","options","dialectOptions","prependSearchPath"])||i.searchPath)&&(i.bindParam=!1),this._dialect.supports.EXCEPTION&&i.exception&&(i.bindParam=!1),a=Qt.removeNullValuesFromHash(a,this.options.omitNull);for(let C in a)if(Object.prototype.hasOwnProperty.call(a,C)){let Q=a[C];c.push(this.quoteIdentifier(C)),s&&s[C]&&s[C].autoIncrement===!0&&Q==null?this._dialect.supports.autoIncrement.defaultValue?this._dialect.supports.DEFAULT?f.push("DEFAULT"):f.push(this.escape(null)):c.splice(-1,1):(s&&s[C]&&s[C].autoIncrement===!0&&(v=!0),Q instanceof Qt.SequelizeMethod||i.bindParam===!1?f.push(this.escape(Q,s&&s[C]||void 0,{context:"INSERT"})):f.push(this.format(Q,s&&s[C]||void 0,{context:"INSERT"},h)))}let x="";if(!ra.isEmpty(i.conflictWhere)&&!this._dialect.supports.inserts.onConflictWhere)throw new Error("missing dialect support for conflictWhere option");if(this._dialect.supports.inserts.updateOnDuplicate&&i.updateOnDuplicate)if(this._dialect.supports.inserts.updateOnDuplicate==" ON CONFLICT DO UPDATE SET"){let C=i.upsertKeys.map(k=>this.quoteIdentifier(k)),Q=i.updateOnDuplicate.map(k=>`${this.quoteIdentifier(k)}=EXCLUDED.${this.quoteIdentifier(k)}`),X=["ON CONFLICT","(",C.join(","),")"];ra.isEmpty(i.conflictWhere)||X.push(this.whereQuery(i.conflictWhere,i)),ra.isEmpty(Q)?X.push("DO NOTHING"):X.push("DO UPDATE SET",Q.join(",")),x=` ${Qt.joinSQLFragments(X)}`}else{let C=i.updateOnDuplicate.map(Q=>`${this.quoteIdentifier(Q)}=VALUES(${this.quoteIdentifier(Q)})`);if(ra.isEmpty(C)&&i.upsertKeys&&C.push(...i.upsertKeys.map(Q=>`${this.quoteIdentifier(Q)}=${this.quoteIdentifier(Q)}`)),ra.isEmpty(C))throw new Error("No update values found for ON DUPLICATE KEY UPDATE clause, and no identifier fields could be found to use instead.");x+=`${this._dialect.supports.inserts.updateOnDuplicate} ${C.join(",")}`}let L={ignoreDuplicates:i.ignoreDuplicates?this._dialect.supports.inserts.ignoreDuplicates:"",onConflictDoNothing:i.ignoreDuplicates?this._dialect.supports.inserts.onConflictDoNothing:"",attributes:c.join(","),output:z,values:f.join(","),tmpTable:T};if(g=`${T}INSERT${L.ignoreDuplicates} INTO ${d} (${L.attributes})${L.output} VALUES (${L.values})${x}${L.onConflictDoNothing}${g}`,O=`${T}INSERT${L.ignoreDuplicates} INTO ${d}${L.output}${x}${L.onConflictDoNothing}${O}`,this._dialect.supports.EXCEPTION&&i.exception){let C="DROP FUNCTION IF EXISTS pg_temp.testfunc()";u.length===0&&u.push("*");let Q=`$func_${zor().replace(/-/g,"")}$`,X=`SELECT (testfunc.response).${u.join(", (testfunc.response).")}, testfunc.sequelize_caught_exception FROM pg_temp.testfunc();`;i.exception="WHEN unique_violation THEN GET STACKED DIAGNOSTICS sequelize_caught_exception = PG_EXCEPTION_DETAIL;",g=`CREATE OR REPLACE FUNCTION pg_temp.testfunc(OUT response ${d}, OUT sequelize_caught_exception text) RETURNS RECORD AS ${Q} BEGIN ${g} RETURNING * INTO response; EXCEPTION ${i.exception} END ${Q} LANGUAGE plpgsql; ${X} ${C}`}else g+=w,O+=w;this._dialect.supports.returnIntoValues&&i.returning&&this.populateInsertQueryReturnIntoBinds(u,l,o.length,b,i),m=`${L.attributes.length?g:O}${b.join(",")};`,this._dialect.supports.finalTable&&(m=`SELECT * FROM FINAL TABLE(${L.attributes.length?g:O});`),v&&this._dialect.supports.autoIncrement.identityInsert&&(m=`SET IDENTITY_INSERT ${d} ON; ${m} SET IDENTITY_INSERT ${d} OFF;`);let P={query:m};return i.bindParam!==!1&&(P.bind=o),P}bulkInsertQuery(r,a,n,i){n=n||{},i=i||{};let s=[],o={},c=[],u="";for(let b of a)ra.forOwn(b,(m,g)=>{c.includes(g)||c.push(g),i[g]&&i[g].autoIncrement===!0&&(o[g]=!0)});for(let b of a){let m=c.map(g=>this._dialect.supports.bulkDefault&&o[g]===!0?b[g]!=null?b[g]:"DEFAULT":this.escape(b[g],i[g],{context:"INSERT"}));s.push(`(${m.join(",")})`)}if(this._dialect.supports.inserts.updateOnDuplicate&&n.updateOnDuplicate)if(this._dialect.supports.inserts.updateOnDuplicate==" ON CONFLICT DO UPDATE SET"){let b=n.upsertKeys.map(O=>this.quoteIdentifier(O)),m=n.updateOnDuplicate.map(O=>`${this.quoteIdentifier(O)}=EXCLUDED.${this.quoteIdentifier(O)}`),g=!1;if(n.conflictWhere){if(!this._dialect.supports.inserts.onConflictWhere)throw new Error(`conflictWhere not supported for dialect ${this._dialect.name}`);g=this.whereQuery(n.conflictWhere,n)}u=["ON CONFLICT","(",b.join(","),")",g,"DO UPDATE SET",m.join(",")]}else{if(n.conflictWhere)throw new Error(`conflictWhere not supported for dialect ${this._dialect.name}`);let b=n.updateOnDuplicate.map(m=>`${this.quoteIdentifier(m)}=VALUES(${this.quoteIdentifier(m)})`);u=`${this._dialect.supports.inserts.updateOnDuplicate} ${b.join(",")}`}let l=n.ignoreDuplicates?this._dialect.supports.inserts.ignoreDuplicates:"",f=c.map(b=>this.quoteIdentifier(b)).join(","),d=n.ignoreDuplicates?this._dialect.supports.inserts.onConflictDoNothing:"",h="";if(this._dialect.supports.returnValues&&n.returning){let b=this.generateReturnValues(i,n);h+=b.returningFragment}return Qt.joinSQLFragments(["INSERT",l,"INTO",this.quoteTable(r),`(${f})`,"VALUES",s.join(","),u,d,h,";"])}updateQuery(r,a,n,i,s){i=i||{},ra.defaults(i,this.options),a=Qt.removeNullValuesFromHash(a,i.omitNull,i);let o=[],c=[],u={},l="",f="",d="";(ra.get(this,["sequelize","options","dialectOptions","prependSearchPath"])||i.searchPath)&&(i.bindParam=!1);let h=i.bindParam===void 0?this.bindParam(c):i.bindParam;if(this._dialect.supports["LIMIT ON UPDATE"]&&i.limit&&(["mssql","db2","oracle"].includes(this.dialect)?this.dialect==="oracle"&&(n&&(n.length&&n.length>0||Object.keys(n).length>0)?d+=" AND ":d+=" WHERE ",d+=`rownum <= ${this.escape(i.limit)} `):d=` LIMIT ${this.escape(i.limit)} `),this._dialect.supports.returnValues&&i.returning){let O=this.generateReturnValues(s,i);d+=O.returningFragment,f=O.tmpTable||"",l=O.outputFragment||"",!this._dialect.supports.returnValues.output&&i.returning&&(i.mapToModel=!0)}s&&ra.each(s,(O,z)=>{u[z]=O,O.field&&(u[O.field]=O)});for(let O in a){if(u&&u[O]&&u[O].autoIncrement===!0&&!this._dialect.supports.autoIncrement.update)continue;let z=a[O];z instanceof Qt.SequelizeMethod||i.bindParam===!1?o.push(`${this.quoteIdentifier(O)}=${this.escape(z,u&&u[O]||void 0,{context:"UPDATE"})}`):o.push(`${this.quoteIdentifier(O)}=${this.format(z,u&&u[O]||void 0,{context:"UPDATE"},h)}`)}let b=TC(A2({},i),{bindParam:h});if(o.length===0)return"";let g={query:`${f}UPDATE ${this.quoteTable(r)} SET ${o.join(",")}${l} ${this.whereQuery(n,b)}${d}`.trim()};return i.bindParam!==!1&&(g.bind=c),g}arithmeticQuery(r,a,n,i,s,o){o=o||{},ra.defaults(o,{returning:!0}),s=Qt.removeNullValuesFromHash(s,this.options.omitNull);let c="",u="";if(this._dialect.supports.returnValues&&o.returning){let f=this.generateReturnValues(null,o);c=f.outputFragment,u=f.returningFragment}let l=[];for(let f in i){let d=i[f],h=this.quoteIdentifier(f),b=this.escape(d);l.push(`${h}=${h}${r} ${b}`)}for(let f in s){let d=s[f],h=this.quoteIdentifier(f),b=this.escape(d);l.push(`${h}=${b}`)}return Qt.joinSQLFragments(["UPDATE",this.quoteTable(a),"SET",l.join(","),c,this.whereQuery(n),u])}addIndexQuery(r,a,n,i){n=n||{},Array.isArray(a)?n.fields=a:(n=a,a=void 0),n.prefix=n.prefix||i||r,n.prefix&&typeof n.prefix=="string"&&(n.prefix=n.prefix.replace(/\./g,"_"),n.prefix=n.prefix.replace(/("|')/g,""));let s=n.fields.map(u=>{if(u instanceof Qt.SequelizeMethod)return this.handleSequelizeMethod(u);typeof u=="string"&&(u={name:u});let l="";if(u.attribute&&(u.name=u.attribute),!u.name)throw new Error(`The following index field has no name: ${qC.inspect(u)}`);if(l+=this.quoteIdentifier(u.name),this._dialect.supports.index.collate&&u.collate&&(l+=` COLLATE ${this.quoteIdentifier(u.collate)}`),this._dialect.supports.index.operator){let f=u.operator||n.operator;f&&(l+=` ${f}`)}return this._dialect.supports.index.length&&u.length&&(l+=`(${u.length})`),u.order&&(l+=` ${u.order}`),l});n.name||(n=Qt.nameIndex(n,n.prefix)),n=Uu._conformIndex(n),this._dialect.supports.index.type||delete n.type,n.where&&(n.where=this.whereQuery(n.where)),typeof r=="string"?r=this.quoteIdentifiers(r):r=this.quoteTable(r);let o=this._dialect.supports.index.concurrently&&n.concurrently?"CONCURRENTLY":void 0,c;return this._dialect.supports.indexViaAlter?c=["ALTER TABLE",r,o,"ADD"]:c=["CREATE"],c=c.concat(n.unique?"UNIQUE":"",n.type,"INDEX",this._dialect.supports.indexViaAlter?void 0:o,this.quoteIdentifiers(n.name),this._dialect.supports.index.using===1&&n.using?`USING ${n.using}`:"",this._dialect.supports.indexViaAlter?void 0:`ON ${r}`,this._dialect.supports.index.using===2&&n.using?`USING ${n.using}`:"",`(${s.join(", ")})`,this._dialect.supports.index.parser&&n.parser?`WITH PARSER ${n.parser}`:void 0,this._dialect.supports.index.where&&n.where?n.where:void 0),ra.compact(c).join(" ")}addConstraintQuery(r,a){return typeof r=="string"?r=this.quoteIdentifiers(r):r=this.quoteTable(r),Qt.joinSQLFragments(["ALTER TABLE",r,"ADD",this.getConstraintSnippet(r,a||{}),";"])}getConstraintSnippet(r,a){let n,i,s=a.fields.map(u=>{if(typeof u=="string")return this.quoteIdentifier(u);if(u instanceof Qt.SequelizeMethod)return this.handleSequelizeMethod(u);if(u.attribute&&(u.name=u.attribute),!u.name)throw new Error(`The following index field has no name: ${u}`);return this.quoteIdentifier(u.name)}),o=s.join(", "),c=s.join("_");switch(a.type.toUpperCase()){case"UNIQUE":i=this.quoteIdentifier(a.name||`${r}_${c}_uk`),n=`CONSTRAINT ${i} UNIQUE (${o})`;break;case"CHECK":a.where=this.whereItemsQuery(a.where),i=this.quoteIdentifier(a.name||`${r}_${c}_ck`),n=`CONSTRAINT ${i} CHECK (${a.where})`;break;case"DEFAULT":if(a.defaultValue===void 0)throw new Error("Default value must be specified for DEFAULT CONSTRAINT");if(this._dialect.name!=="mssql")throw new Error("Default constraints are supported only for MSSQL dialect.");i=this.quoteIdentifier(a.name||`${r}_${c}_df`),n=`CONSTRAINT ${i} DEFAULT (${this.escape(a.defaultValue)}) FOR ${s[0]}`;break;case"PRIMARY KEY":i=this.quoteIdentifier(a.name||`${r}_${c}_pk`),n=`CONSTRAINT ${i} PRIMARY KEY (${o})`;break;case"FOREIGN KEY":let u=a.references;if(!u||!u.table||!(u.field||u.fields))throw new Error("references object with table and field must be specified");i=this.quoteIdentifier(a.name||`${r}_${c}_${u.table}_fk`);let l=typeof u.field<"u"?this.quoteIdentifier(u.field):u.fields.map(d=>this.quoteIdentifier(d)).join(", "),f=`${this.quoteTable(u.table)} (${l})`;n=`CONSTRAINT ${i} `,n+=`FOREIGN KEY (${o}) REFERENCES ${f}`,a.onUpdate&&(n+=` ON UPDATE ${a.onUpdate.toUpperCase()}`),a.onDelete&&(n+=` ON DELETE ${a.onDelete.toUpperCase()}`);break;default:throw new Error(`${a.type} is invalid.`)}return a.deferrable&&["UNIQUE","PRIMARY KEY","FOREIGN KEY"].includes(a.type.toUpperCase())&&(n+=` ${this.deferConstraintsQuery(a)}`),n}removeConstraintQuery(r,a){return typeof r=="string"?r=this.quoteIdentifiers(r):r=this.quoteTable(r),Qt.joinSQLFragments(["ALTER TABLE",r,"DROP CONSTRAINT",this.quoteIdentifiers(a)])}quote(r,a,n){let i=["ASC","DESC","ASC NULLS LAST","DESC NULLS LAST","ASC NULLS FIRST","DESC NULLS FIRST","NULLS FIRST","NULLS LAST"];if(n=n||".",typeof r=="string")return this.quoteIdentifiers(r);if(Array.isArray(r)){r.forEach((f,d)=>{let h=r[d-1],b,m;if(!h&&a!==void 0?m=a:h&&h instanceof pA&&(b=h,m=h.target),m&&m.prototype instanceof Uu){let g,O;if(typeof f=="function"&&f.prototype instanceof Uu?g=f:ra.isPlainObject(f)&&f.model&&f.model.prototype instanceof Uu&&(g=f.model,O=f.as),g&&(!O&&b&&b instanceof pA&&b.through&&b.through.model===g?f=new pA(m,g,{as:g.name}):(f=m.getAssociationForAlias(g,O),f||(f=m.getAssociationForAlias(g,g.name))),!(f instanceof pA)))throw new Error(qC.format("Unable to find a valid association for model, '%s'",g.name))}if(typeof f=="string"){let g=i.indexOf(f.toUpperCase());if(d>0&&g!==-1)f=this.sequelize.literal(` ${i[g]}`);else if(m&&m.prototype instanceof Uu){if(m.associations!==void 0&&m.associations[f])f=m.associations[f];else if(m.rawAttributes!==void 0&&m.rawAttributes[f]&&f!==m.rawAttributes[f].field)f=m.rawAttributes[f].field;else if(f.includes(".")&&m.rawAttributes!==void 0){let O=f.split(".");if(m.rawAttributes[O[0]].type instanceof lA.JSON){let z=this.quoteIdentifiers(`${m.name}.${m.rawAttributes[O[0]].field}`),w=O.slice(1);f=this.jsonPathExtractionQuery(z,w),f=this.sequelize.literal(f)}}}}r[d]=f},this);let s=r.length,o=[],c,u=0;for(u=0;u<s-1&&(c=r[u],!(typeof c=="string"||c._modelAttribute||c instanceof Qt.SequelizeMethod));u++)c instanceof pA&&(o[u]=c.as);let l="";return u>0?l+=`${this.quoteIdentifier(o.join(n))}.`:typeof r[0]=="string"&&a&&(l+=`${this.quoteIdentifier(a.name)}.`),r.slice(u).forEach(f=>{l+=this.quote(f,a,n)},this),l}if(r._modelAttribute)return`${this.quoteTable(r.Model.name)}.${this.quoteIdentifier(r.fieldName)}`;if(r instanceof Qt.SequelizeMethod)return this.handleSequelizeMethod(r);throw ra.isPlainObject(r)&&r.raw?new Error('The `{raw: "..."}` syntax is no longer supported.  Use `sequelize.literal` instead.'):new Error(`Unknown structure passed to order / group: ${qC.inspect(r)}`)}_initQuoteIdentifier(){this._quoteIdentifier=this.quoteIdentifier,this.quoteIdentifier=function(r,a){return r==="*"?r:this._quoteIdentifier(r,a)}}quoteIdentifier(r,a){throw new Error(`quoteIdentifier for Dialect "${this.dialect}" is not implemented`)}quoteIdentifiers(r){if(r.includes(".")){r=r.split(".");let a=r.slice(0,r.length-1).join("->"),n=r[r.length-1];return`${this.quoteIdentifier(a)}.${this.quoteIdentifier(n)}`}return this.quoteIdentifier(r)}quoteAttribute(r,a){return a&&r in a.rawAttributes?this.quoteIdentifier(r):this.quoteIdentifiers(r)}getAliasToken(){return"AS"}quoteTable(r,a){let n="";return a===!0&&(a=r.as||r.name||r),ra.isObject(r)?this._dialect.supports.schemas?(r.schema&&(n+=`${this.quoteIdentifier(r.schema)}.`),n+=this.quoteIdentifier(r.tableName)):(r.schema&&(n+=r.schema+(r.delimiter||".")),n+=r.tableName,n=this.quoteIdentifier(n)):n=this.quoteIdentifier(r),a&&(n+=` ${this.getAliasToken()} ${this.quoteIdentifier(a)}`),n}escape(r,a,n){if(n=n||{},r!=null){if(r instanceof Qt.SequelizeMethod)return this.handleSequelizeMethod(r);if(a&&a.type&&(a.type instanceof lA.STRING&&["mysql","mariadb"].includes(this.dialect)&&["number","boolean"].includes(typeof r)&&(r=String(Number(r))),this.validate(r,a,n),a.type.stringify)){let i=s=>I5e.escape(s,this.options.timezone,this.dialect);if(r=a.type.stringify(r,{escape:i,field:a,timezone:this.options.timezone,operation:n.operation}),a.type.escape===!1)return r}}return I5e.escape(r,this.options.timezone,this.dialect)}bindParam(r){return a=>(r.push(a),`$${r.length}`)}format(r,a,n,i){if(n=n||{},r!=null){if(r instanceof Qt.SequelizeMethod)throw new Error("Cannot pass SequelizeMethod as a bind parameter - use escape instead");if(a&&a.type&&(this.validate(r,a,n),a.type.bindParam))return a.type.bindParam(r,{escape:ra.identity,field:a,timezone:this.options.timezone,operation:n.operation,bindParam:i})}return i(r)}validate(r,a,n){if(this.typeValidation&&a.type.validate&&r)try{if(n.isList&&Array.isArray(r))for(let i of r)a.type.validate(i,n);else a.type.validate(r,n)}catch(i){throw i instanceof bJ.ValidationError&&i.errors.push(new bJ.ValidationErrorItem(i.message,"Validation error",a.fieldName,r,null,`${a.type.key} validator`)),i}}isIdentifierQuoted(r){return/^\s*(?:([`"'])(?:(?!\1).|\1{2})*\1\.?)+\s*$/i.test(r)}jsonPathExtractionQuery(r,a,n){let i=ra.toPath(a),s,o=this.isIdentifierQuoted(r)?r:this.quoteIdentifier(r);switch(this.dialect){case"mysql":case"mariadb":case"sqlite":return this.dialect==="mysql"&&(i=i.map(u=>/\D/.test(u)?Qt.addTicks(u,'"'):u)),s=this.escape(["$"].concat(i).join(".").replace(/\.(\d+)(?:(?=\.)|$)/g,(u,l)=>`[${l}]`)),this.dialect==="sqlite"?`json_extract(${o},${s})`:`json_unquote(json_extract(${o},${s}))`;case"postgres":let c=n?"#>":"#>>";return s=this.escape(`{${i.join(",")}}`),`(${o}${c}${s})`;default:throw new Error(`Unsupported ${this.dialect} for JSON operations`)}}selectQuery(r,a,n){a=a||{};let i=a.limit,s=[],o=[],c=a.subQuery===void 0?i&&a.hasMultiAssociation:a.subQuery,u={main:a.attributes&&a.attributes.slice(),subQuery:null},l={name:r,quotedName:null,as:null,model:n},f={names:l,options:a,subQuery:c},d=[],h=[],b;if(this.options.minifyAliases&&!a.aliasesMapping&&(a.aliasesMapping=new Map,a.aliasesByTable={},a.includeAliases=new Map),a.tableAs?l.as=this.quoteIdentifier(a.tableAs):!Array.isArray(l.name)&&l.model&&(l.as=this.quoteIdentifier(l.model.name)),l.quotedName=Array.isArray(l.name)?r.map(g=>Array.isArray(g)?this.quoteTable(g[0],g[1]):this.quoteTable(g,!0)).join(", "):this.quoteTable(l.name),c&&u.main)for(let g of l.model.primaryKeyAttributes)u.main.some(O=>g===O||g===O[0]||g===O[1])||u.main.push(l.model.rawAttributes[g].field?[g,l.model.rawAttributes[g].field]:g);if(u.main=this.escapeAttributes(u.main,a,l.as),u.main=u.main||(a.include?[`${l.as}.*`]:["*"]),(c||a.groupedLimit)&&(u.subQuery=u.main,u.main=[`${l.as||l.quotedName}.*`]),a.include)for(let g of a.include){if(g.separate)continue;let O=this.generateInclude(g,{externalAs:l.as,internalAs:l.as},f);h=h.concat(O.subQuery),d=d.concat(O.mainQuery),O.attributes.main.length>0&&(u.main=ra.uniq(u.main.concat(O.attributes.main))),O.attributes.subQuery.length>0&&(u.subQuery=ra.uniq(u.subQuery.concat(O.attributes.subQuery)))}if(c)o.push(this.selectFromTableFragment(a,l.model,u.subQuery,l.quotedName,l.as)),o.push(h.join(""));else{if(a.groupedLimit){l.as||(l.as=l.quotedName);let g=A2({},a.where),O,z,w,v=l.as;if(typeof a.groupedLimit.on=="string"?z=a.groupedLimit.on:a.groupedLimit.on instanceof wor&&(z=a.groupedLimit.on.foreignKeyField),a.groupedLimit.on instanceof Eor){v=a.groupedLimit.on.manyFromSource.as;let P=Uu._validateIncludedElements({include:[{association:a.groupedLimit.on.manyFromSource,duplicating:!1,required:!0,where:A2({[Rt.placeholder]:!0},a.groupedLimit.through&&a.groupedLimit.through.where)}],model:n});a.hasJoin=!0,a.hasMultiAssociation=!0,a.includeMap=Object.assign(P.includeMap,a.includeMap),a.includeNames=P.includeNames.concat(a.includeNames||[]),w=P.include,Array.isArray(a.order)&&(a.order.forEach((C,Q)=>{Array.isArray(C)&&(C=C[0]);let X=`subquery_order_${Q}`;a.attributes.push([C,X]),X=this.sequelize.literal(this.quote(X)),Array.isArray(a.order[Q])?a.order[Q][0]=X:a.order[Q]=X}),O=a.order)}else O=a.order,this._dialect.supports.topLevelOrderByRequired||delete a.order,g[Rt.placeholder]=!0;let T=`SELECT * FROM (${this.selectQuery(r,{attributes:a.attributes,offset:a.offset,limit:a.groupedLimit.limit,order:O,aliasesMapping:a.aliasesMapping,aliasesByTable:a.aliasesByTable,where:g,include:w,model:n},n).replace(/;$/,"")}) ${this.getAliasToken()} sub`,x=this.whereItemQuery(Rt.placeholder,!0,{model:n}),L=T.indexOf(x);s.push(this.selectFromTableFragment(a,l.model,u.main,`(${a.groupedLimit.values.map(P=>{let C;return z&&(C={[z]:P}),w&&(C={[a.groupedLimit.on.foreignIdentifierField]:P}),Qt.spliceStr(T,L,x.length,this.getWhereConditions(C,v))}).join(this._dialect.supports["UNION ALL"]?" UNION ALL ":" UNION ")})`,l.as))}else s.push(this.selectFromTableFragment(a,l.model,u.main,l.quotedName,l.as));s.push(d.join(""))}if(Object.prototype.hasOwnProperty.call(a,"where")&&!a.groupedLimit&&(a.where=this.getWhereConditions(a.where,l.as||r,n,a),a.where&&(c?o.push(` WHERE ${a.where}`):(s.push(` WHERE ${a.where}`),s.forEach((g,O)=>{g.startsWith("SELECT")&&(s[O]=this.selectFromTableFragment(a,n,u.main,l.quotedName,l.as,a.where))})))),a.group&&(a.group=Array.isArray(a.group)?a.group.map(g=>this.aliasGrouping(g,n,l.as,a)).join(", "):this.aliasGrouping(a.group,n,l.as,a),c&&a.group?o.push(` GROUP BY ${a.group}`):a.group&&s.push(` GROUP BY ${a.group}`)),Object.prototype.hasOwnProperty.call(a,"having")&&(a.having=this.getWhereConditions(a.having,r,n,a,!1),a.having&&(c?o.push(` HAVING ${a.having}`):s.push(` HAVING ${a.having}`))),a.order){let g=this.getQueryOrders(a,n,c);g.mainQueryOrder.length&&s.push(` ORDER BY ${g.mainQueryOrder.join(", ")}`),g.subQueryOrder.length&&o.push(` ORDER BY ${g.subQueryOrder.join(", ")}`)}let m=this.addLimitAndOffset(a,l.model);if(m&&!a.groupedLimit&&(c?o.push(m):s.push(m)),c?(this._throwOnEmptyAttributes(u.main,{modelName:n&&n.name,as:l.as}),b=`SELECT ${u.main.join(", ")} FROM (${o.join("")}) ${this.getAliasToken()} ${l.as}${d.join("")}${s.join("")}`):b=s.join(""),a.lock&&this._dialect.supports.lock){let g=a.lock;typeof a.lock=="object"&&(g=a.lock.level),this._dialect.supports.lockKey&&["KEY SHARE","NO KEY UPDATE"].includes(g)?b+=` FOR ${g}`:g==="SHARE"?b+=` ${this._dialect.supports.forShare}`:b+=" FOR UPDATE",this._dialect.supports.lockOf&&a.lock.of&&a.lock.of.prototype instanceof Uu&&(b+=` OF ${this.quoteTable(a.lock.of.name)}`),this._dialect.supports.skipLocked&&a.skipLocked&&(b+=" SKIP LOCKED")}return`${b};`}aliasGrouping(r,a,n,i){let s=Array.isArray(r)?r[0]:r;return this.quote(this._getAliasForField(n,s,i)||s,a)}escapeAttributes(r,a,n){return r&&r.map(i=>{let s=!0;if(i instanceof Qt.SequelizeMethod)return this.handleSequelizeMethod(i);if(Array.isArray(i)){if(i.length!==2)throw new Error(`${JSON.stringify(i)} is not a valid attribute definition. Please use the following format: ['attribute definition', 'alias']`);if(i=i.slice(),i[0]instanceof Qt.SequelizeMethod)i[0]=this.handleSequelizeMethod(i[0]),s=!1;else if(this.options.attributeBehavior==="escape"||!i[0].includes("(")&&!i[0].includes(")"))i[0]=this.quoteIdentifier(i[0]);else if(this.options.attributeBehavior!=="unsafe-legacy")throw new Error(`Attributes cannot include parentheses in Sequelize 6:
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            

Error: Please install mysql2 package manually
    at t._loadDialectModule (/home/wiomgjqe/neduas.store/server.js:124:7832)
    at new t (/home/wiomgjqe/neduas.store/server.js:136:66644)
    at new O1 (/home/wiomgjqe/neduas.store/server.js:136:73185)
    at new t (/home/wiomgjqe/neduas.store/server.js:136:229204)
    at Object.<anonymous> (/home/wiomgjqe/neduas.store/server.js:3649:2755)
    at Module._compile (node:internal/modules/cjs/loader:1275:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1329:10)
    at Module.load (node:internal/modules/cjs/loader:1133:32)
    at Module._load (node:internal/modules/cjs/loader:972:12)
    at Module.require (node:internal/modules/cjs/loader:1157:19)

Node.js v19.9.0
/home/wiomgjqe/neduas.store/server.js:124
`}};MC.AggregateError=sJ});var n5e=A(AC=>{"use strict";Object.defineProperty(AC,"__esModule",{value:!0});AC.Deferred=void 0;var Tsr=iJ(),cJ=class{constructor(){this._promise=new Promise((r,a)=>{this._reject=a,this._resolve=r})}registerTimeout(r,a){this._timeout||(this._timeout=setTimeout(()=>{a(),this.reject(new Tsr.TimeoutError("Operation timeout"))},r))}_clearTimeout(){this._timeout&&clearTimeout(this._timeout)}resolve(r){this._clearTimeout(),this._resolve(r)}reject(r){this._clearTimeout(),this._reject(r)}promise(){return this._promise}};AC.Deferred=cJ});var i5e=A(OC=>{"use strict";Object.defineProperty(OC,"__esModule",{value:!0});OC.Pool=void 0;var qsr=n5e(),Nsr=oJ(),uJ=class{constructor(r){if(this.log=!1,!r.create)throw new Error("create function is required");if(!r.destroy)throw new Error("destroy function is required");if(!r.validate)throw new Error("validate function is required");if(typeof r.min!="number"||r.min<0||r.min!==Math.round(r.min))throw new Error("min must be an integer >= 0");if(typeof r.max!="number"||r.max<=0||r.max!==Math.round(r.max))throw new Error("max must be an integer > 0");if(r.min>r.max)throw new Error("max is smaller than min");if(r.maxUses!==void 0&&(typeof r.maxUses!="number"||r.maxUses<0))throw new Error("maxUses must be an integer >= 0");this.idleTimeoutMillis=r.idleTimeoutMillis||3e4,this.acquireTimeoutMillis=r.acquireTimeoutMillis||3e4,this.reapIntervalMillis=r.reapIntervalMillis||1e3,this.maxUsesPerResource=r.maxUses||1/0,this.log=r.log||!1,this._factory=r,this._count=0,this._draining=!1,this._pendingAcquires=[],this._inUseObjects=[],this._availableObjects=[],this._removeIdleScheduled=!1}get size(){return this._count}get name(){return this._factory.name}get available(){return this._availableObjects.length}get using(){return this._inUseObjects.length}get waiting(){return this._pendingAcquires.length}get maxSize(){return this._factory.max}get minSize(){return this._factory.min}_log(r,a){typeof this.log=="function"?this.log(r,a):this.log&&console.log(`${a.toUpperCase()} pool ${this.name||""} - ${r}`)}_removeIdle(){let r=[],a=Date.now(),n,i=this._availableObjects.length,s=this.size-this.minSize,o;for(this._removeIdleScheduled=!1,n=0;n<i&&s>r.length;n++)o=this._availableObjects[n].timeout,a>=o&&(this._log("removeIdle() destroying obj - now:"+a+" timeout:"+o,"verbose"),r.push(this._availableObjects[n].resource));r.forEach(this.destroy,this),i=this._availableObjects.length,i>0?(this._log("this._availableObjects.length="+i,"verbose"),this._scheduleRemoveIdle()):this._log("removeIdle() all objects removed","verbose")}_scheduleRemoveIdle(){this._removeIdleScheduled||(this._removeIdleScheduled=!0,this._removeIdleTimer=setTimeout(()=>{this._removeIdle()},this.reapIntervalMillis))}_dispense(){let r=null,a=this._pendingAcquires.length;if(this._log(`dispense() clients=${a} available=${this._availableObjects.length}`,"info"),!(a<1)){for(;this._availableObjects.length>0;){if(this._log("dispense() - reusing obj","verbose"),r=this._availableObjects[this._availableObjects.length-1],!this._factory.validate(r.resource)){this.destroy(r.resource);continue}return this._availableObjects.pop(),this._addResourceToInUseObjects(r.resource,r.useCount),this._pendingAcquires.shift().resolve(r.resource)}this.size<this.maxSize&&this._createResource()}}_createResource(){this._count+=1,this._log(`createResource() - creating obj - count=${this.size} min=${this.minSize} max=${this.maxSize}`,"verbose"),this._factory.create().then(r=>{let a=this._pendingAcquires.shift();a?(this._addResourceToInUseObjects(r,0),a.resolve(r)):this._addResourceToAvailableObjects(r,0)}).catch(r=>{let a=this._pendingAcquires.shift();this._count-=1,this._count<0&&(this._count=0),a&&a.reject(r),process.nextTick(()=>{this._dispense()})})}_addResourceToAvailableObjects(r,a){let n={resource:r,useCount:a,timeout:Date.now()+this.idleTimeoutMillis};this._availableObjects.push(n),this._dispense(),this._scheduleRemoveIdle()}_addResourceToInUseObjects(r,a){let n={resource:r,useCount:a};this._inUseObjects.push(n)}_ensureMinimum(){let r,a;if(!this._draining&&this.size<this.minSize)for(a=this.minSize-this.size,r=0;r<a;r++)this._createResource()}acquire(){if(this._draining)return Promise.reject(new Error("pool is draining and cannot accept work"));let r=new qsr.Deferred;return r.registerTimeout(this.acquireTimeoutMillis,()=>{this._pendingAcquires=this._pendingAcquires.filter(a=>a!==r)}),this._pendingAcquires.push(r),this._dispense(),r.promise()}release(r){if(this._availableObjects.some(i=>i.resource===r)){this._log("release called twice for the same resource: "+new Error().stack,"error");return}let a=this._inUseObjects.findIndex(i=>i.resource===r);if(a<0){this._log("attempt to release an invalid resource: "+new Error().stack,"error");return}let n=this._inUseObjects[a];n.useCount+=1,n.useCount>=this.maxUsesPerResource?(this._log("release() destroying obj - useCount:"+n.useCount+" maxUsesPerResource:"+this.maxUsesPerResource,"verbose"),this.destroy(n.resource),this._dispense()):(this._inUseObjects.splice(a,1),this._addResourceToAvailableObjects(n.resource,n.useCount))}async destroy(r){let a=this._availableObjects.length,n=this._inUseObjects.length;if(this._availableObjects=this._availableObjects.filter(i=>i.resource!==r),this._inUseObjects=this._inUseObjects.filter(i=>i.resource!==r),a===this._availableObjects.length&&n===this._inUseObjects.length){this._ensureMinimum();return}this._count-=1,this._count<0&&(this._count=0);try{await this._factory.destroy(r)}finally{this._ensureMinimum(),this._draining||process.nextTick(()=>{this._dispense()})}}drain(){this._log("draining","info"),this._draining=!0;let r=a=>{if(this._pendingAcquires.length>0){this._dispense(),setTimeout(()=>{r(a)},100);return}if(this._availableObjects.length!==this._count){setTimeout(()=>{r(a)},100);return}a()};return new Promise(a=>r(a))}async destroyAllNow(){this._log("force destroying all objects","info"),this._removeIdleScheduled=!1,clearTimeout(this._removeIdleTimer);let r=this._availableObjects.map(n=>n.resource),a=[];for(let n of r)try{await this.destroy(n)}catch(i){this._log("Error destroying resource: "+i.stack,"error"),a.push(i)}if(a.length>0)throw new Nsr.AggregateError(a)}};OC.Pool=uJ});var s5e=A(Nh=>{"use strict";Object.defineProperty(Nh,"__esModule",{value:!0});Nh.Pool=Nh.AggregateError=Nh.TimeoutError=void 0;var Isr=iJ();Object.defineProperty(Nh,"TimeoutError",{enumerable:!0,get:function(){return Isr.TimeoutError}});var Ssr=oJ();Object.defineProperty(Nh,"AggregateError",{enumerable:!0,get:function(){return Ssr.AggregateError}});var xsr=i5e();Object.defineProperty(Nh,"Pool",{enumerable:!0,get:function(){return xsr.Pool}})});var Df=A((j9a,yC)=>{"use strict";var{Pool:lJ,TimeoutError:ksr}=s5e(),Ih=hr(),pJ=qh(),Csr=cn(),{logger:Lsr}=Ti(),Dsr=nA(),Jl=Lsr.debugContext("pool"),uR=class{constructor(r,a){let n=Ih.cloneDeep(a.config);if(this.sequelize=a,this.config=n,this.dialect=r,this.versionPromise=null,this.dialectName=this.sequelize.options.dialect,n.pool===!1)throw new Error("Support for pool:false was removed in v4.0");n.pool=Ih.defaults(n.pool||{},{max:5,min:0,idle:1e4,acquire:6e4,evict:1e3,validate:this._validate.bind(this)}),this.initPools()}refreshTypeParser(r){Ih.each(r,a=>{if(Object.prototype.hasOwnProperty.call(a,"parse"))if(a.types[this.dialectName])this._refreshTypeParser(a);else throw new Error(`Parse function not supported for type ${a.key} in dialect ${this.dialectName}`)})}_loadDialectModule(r){try{return this.sequelize.config.dialectModulePath?require(this.sequelize.config.dialectModulePath):this.sequelize.config.dialectModule?this.sequelize.config.dialectModule:require(r)}catch(a){throw a.code==="MODULE_NOT_FOUND"?this.sequelize.config.dialectModulePath?new Error(`Unable to find dialect at ${this.sequelize.config.dialectModulePath}`):new Error(`Please install ${r} package manually`):a}}async _onProcessExit(){if(this.pool)return await this.pool.drain(),Jl("connection drain due to process exit"),await this.pool.destroyAllNow()}async close(){return this.getConnection=async function(){throw new Error("ConnectionManager.getConnection was called after the connection manager was closed!")},await this._onProcessExit()}initPools(){let r=this.config;if(!r.replication){this.pool=new lJ({name:"sequelize",create:()=>this._connect(r),destroy:async n=>{let i=await this._disconnect(n);return Jl("connection destroy"),i},validate:r.pool.validate,max:r.pool.max,min:r.pool.min,acquireTimeoutMillis:r.pool.acquire,idleTimeoutMillis:r.pool.idle,reapIntervalMillis:r.pool.evict,maxUses:r.pool.maxUses}),Jl(`pool created with max/min: ${r.pool.max}/${r.pool.min}, no replication`);return}Array.isArray(r.replication.read)||(r.replication.read=[r.replication.read]),r.replication.write=Ih.defaults(r.replication.write,Ih.omit(r,"replication")),r.replication.read=r.replication.read.map(n=>Ih.defaults(n,Ih.omit(this.config,"replication")));let a=0;this.pool={release:n=>{n.queryType==="read"?this.pool.read.release(n):this.pool.write.release(n)},acquire:(n,i)=>(i=i===void 0?!1:i,n==="SELECT"&&!i?this.pool.read.acquire():this.pool.write.acquire()),destroy:n=>{this.pool[n.queryType].destroy(n),Jl("connection destroy")},destroyAllNow:async()=>{await Promise.all([this.pool.read.destroyAllNow(),this.pool.write.destroyAllNow()]),Jl("all connections destroyed")},drain:async()=>Promise.all([this.pool.write.drain(),this.pool.read.drain()]),read:new lJ({name:"sequelize:read",create:async()=>{let n=a++%r.replication.read.length,i=await this._connect(r.replication.read[n]);return i.queryType="read",i},destroy:n=>this._disconnect(n),validate:r.pool.validate,max:r.pool.max,min:r.pool.min,acquireTimeoutMillis:r.pool.acquire,idleTimeoutMillis:r.pool.idle,reapIntervalMillis:r.pool.evict,maxUses:r.pool.maxUses}),write:new lJ({name:"sequelize:write",create:async()=>{let n=await this._connect(r.replication.write);return n.queryType="write",n},destroy:n=>this._disconnect(n),validate:r.pool.validate,max:r.pool.max,min:r.pool.min,acquireTimeoutMillis:r.pool.acquire,idleTimeoutMillis:r.pool.idle,reapIntervalMillis:r.pool.evict,maxUses:r.pool.maxUses})},Jl(`pool created with max/min: ${r.pool.max}/${r.pool.min}, with replication`)}async getConnection(r){r=r||{},this.sequelize.options.databaseVersion===0&&(this.versionPromise||(this.versionPromise=(async()=>{try{let n=await this._connect(this.config.replication.write||this.config),i={};if(i.transaction={connection:n},i.logging=()=>{},i.logging.__testLoggingFn=!0,this.sequelize.options.databaseVersion===0){let s=await this.sequelize.databaseVersion(i),o=Ih.get(pJ.coerce(s),"version")||s;this.sequelize.options.databaseVersion=pJ.valid(o)?o:this.dialect.defaultVersion}return pJ.lt(this.sequelize.options.databaseVersion,this.dialect.defaultVersion)&&(Dsr.unsupportedEngine(),Jl(`Unsupported database engine version ${this.sequelize.options.databaseVersion}`)),this.versionPromise=null,await this._disconnect(n)}catch(n){throw this.versionPromise=null,n}})()),await this.versionPromise);let a;try{await this.sequelize.runHooks("beforePoolAcquire",r),a=await this.pool.acquire(r.type,r.useMaster),await this.sequelize.runHooks("afterPoolAcquire",a,r)}catch(n){throw n instanceof ksr?new Csr.ConnectionAcquireTimeoutError(n):n}return Jl("connection acquired"),a}releaseConnection(r){this.pool.release(r),Jl("connection released")}async destroyConnection(r){await this.pool.destroy(r),Jl(`connection ${r.uuid} destroyed`)}async _connect(r){await this.sequelize.runHooks("beforeConnect",r);let a=await this.dialect.connectionManager.connect(r);return await this.sequelize.runHooks("afterConnect",a,r),a}async _disconnect(r){return await this.sequelize.runHooks("beforeDisconnect",r),await this.dialect.connectionManager.disconnect(r),this.sequelize.runHooks("afterDisconnect",r)}_validate(r){return this.dialect.connectionManager.validate?this.dialect.connectionManager.validate(r):!0}};yC.exports=uR;yC.exports.ConnectionManager=uR;yC.exports.default=uR});var Vc=A((G9a,o5e)=>{"use strict";var lR=new Map;o5e.exports=t=>(lR.has(t)||lR.set(t,new Map),{clear(){lR.get(t).clear()},refresh(r){for(let a of r.types[t])lR.get(t).set(a,r.parse)},get(r){return lR.get(t).get(r)}})});var p5e=A((Q9a,EC)=>{"use strict";var Bsr=Object.defineProperty,c5e=Object.getOwnPropertySymbols,Psr=Object.prototype.hasOwnProperty,Wsr=Object.prototype.propertyIsEnumerable,u5e=(t,r,a)=>r in t?Bsr(t,r,{enumerable:!0,configurable:!0,writable:!0,value:a}):t[r]=a,Usr=(t,r)=>{for(var a in r||(r={}))Psr.call(r,a)&&u5e(t,a,r[a]);if(c5e)for(var a of c5e(r))Wsr.call(r,a)&&u5e(t,a,r[a]);return t},Fsr=qh(),jsr=Df(),uA=cn(),{logger:Gsr}=Ti(),Qsr=Ja().mariadb,Hsr=Hl(),l5e=Gsr.debugContext("connection:mariadb"),zC=Vc()("mariadb"),pR=class t extends jsr{constructor(r,a){a.config.port=a.config.port||3306,super(r,a),this.lib=this._loadDialectModule("mariadb"),this.refreshTypeParser(Qsr)}static _typecast(r,a){return zC.get(r.type)?zC.get(r.type)(r,this.sequelize.options,a):a()}_refreshTypeParser(r){zC.refresh(r)}_clearTypeParser(){zC.clear()}async connect(r){let a=this.sequelize.options.timezone;a=/\//.test(a)?Hsr.tz(a).format("Z"):a;let n=Usr({host:r.host,port:r.port,user:r.username,password:r.password,database:r.database,timezone:a,typeCast:t._typecast.bind(this),bigNumberStrings:!1,supportBigNumbers:!0,foundRows:!1},r.dialectOptions);this.sequelize.config.keepDefaultTimezone||(n.initSql?(Array.isArray(n.initSql)||(n.initSql=[n.initSql]),n.initSql.push(`SET time_zone = '${a}'`)):n.initSql=`SET time_zone = '${a}'`);try{let i=await this.lib.createConnection(n);return this.sequelize.options.databaseVersion=Fsr.coerce(i.serverVersion()).version,l5e("connection acquired"),i.on("error",s=>{switch(s.code){case"ESOCKET":case"ECONNRESET":case"EPIPE":case"PROTOCOL_CONNECTION_LOST":this.pool.destroy(i)}}),i}catch(i){switch(i.code){case"ECONNREFUSED":throw new uA.ConnectionRefusedError(i);case"ER_ACCESS_DENIED_ERROR":case"ER_ACCESS_DENIED_NO_PASSWORD_ERROR":throw new uA.AccessDeniedError(i);case"ENOTFOUND":throw new uA.HostNotFoundError(i);case"EHOSTUNREACH":case"ENETUNREACH":case"EADDRNOTAVAIL":throw new uA.HostNotReachableError(i);case"EINVAL":throw new uA.InvalidConnectionError(i);default:throw new uA.ConnectionError(i)}}}async disconnect(r){if(!r.isValid()){l5e("connection tried to disconnect but was already at CLOSED state");return}return await r.end()}validate(r){return r&&r.isValid()}};EC.exports=pR;EC.exports.ConnectionManager=pR;EC.exports.default=pR});var Bf=A((H9a,wC)=>{"use strict";var Vsr=Object.defineProperty,f5e=Object.getOwnPropertySymbols,$sr=Object.prototype.hasOwnProperty,Ysr=Object.prototype.propertyIsEnumerable,d5e=(t,r,a)=>r in t?Vsr(t,r,{enumerable:!0,configurable:!0,writable:!0,value:a}):t[r]=a,Xsr=(t,r)=>{for(var a in r||(r={}))$sr.call(r,a)&&d5e(t,a,r[a]);if(f5e)for(var a of f5e(r))Ysr.call(r,a)&&d5e(t,a,r[a]);return t},Sh=hr(),Ksr=Cv(),rc=m1(),Jsr=Wv(),Zsr=nA(),eor=(JM(),gf(KM)).v4,{safeStringifyJson:h5e}=On(),fR=class t{constructor(r,a,n){this.uuid=eor(),this.connection=r,this.instance=n.instance,this.model=n.model,this.sequelize=a,this.options=Xsr({plain:!1,raw:!1,logging:console.log},n),this.checkLoggingOption(),n.rawErrors&&(this.formatError=t.prototype.formatError)}static formatBindParameters(r,a,n,i,s){if(!a)return[r,[]];if(s=s||{},typeof i!="function"&&(s=i||{},i=void 0),!i)s.skipValueReplace?i=(u,l,f)=>{if(f[l]!==void 0)return u}:i=(u,l,f,d,h)=>{if(f[l]!==void 0)return Ksr.escape(f[l],d,h)};else if(s.skipValueReplace){let u=i;i=(l,f,d,h,b,m)=>{if(u(l,f,d,h,b,m)!==void 0)return l}}let o=null,c=Array.isArray(a);return r=r.replace(/\B\$(\$|\w+)/g,(u,l)=>{if(l==="$")return s.skipUnescape?u:l;let f;if(c?l.match(/^[1-9]\d*$/)&&(l=l-1,f=i(u,l,a,o,n,s)):l.match(/^\d*$/)||(f=i(u,l,a,o,n,s)),f===void 0)throw new Error(`Named bind parameter "${u}" has no value in the given object.`);return f}),[r,[]]}formatError(r,a){return r.stack=a,r}run(){throw new Error("The run method wasn't overwritten!")}checkLoggingOption(){this.options.logging===!0&&(Zsr.noTrueLogging(),this.options.logging=console.log)}getInsertIdField(){return"insertId"}getUniqueConstraintErrorMessage(r){let a=r?`${r} must be unique`:"Must be unique";if(r&&this.model)for(let n of Object.keys(this.model.uniqueKeys))this.model.uniqueKeys[n].fields.includes(r.replace(/"/g,""))&&this.model.uniqueKeys[n].msg&&(a=this.model.uniqueKeys[n].msg);return a}isRawQuery(){return this.options.type===rc.RAW}isVersionQuery(){return this.options.type===rc.VERSION}isUpsertQuery(){return this.options.type===rc.UPSERT}isInsertQuery(r,a){let n=!0;return this.options.type===rc.INSERT?!0:(n=n&&this.sql.toLowerCase().startsWith("insert into"),n=n&&(!r||Object.prototype.hasOwnProperty.call(r,this.getInsertIdField())),n=n&&(!a||Object.prototype.hasOwnProperty.call(a,this.getInsertIdField())),n)}handleInsertQuery(r,a){if(this.instance){let n=this.model.autoIncrementAttribute,i=null;i=i||r&&r[this.getInsertIdField()],i=i||a&&a[this.getInsertIdField()],this.instance[n]=i}}isShowTablesQuery(){return this.options.type===rc.SHOWTABLES}handleShowTablesQuery(r){return Sh.flatten(r.map(a=>Object.values(a)))}isShowIndexesQuery(){return this.options.type===rc.SHOWINDEXES}isShowConstraintsQuery(){return this.options.type===rc.SHOWCONSTRAINTS}isDescribeQuery(){return this.options.type===rc.DESCRIBE}isSelectQuery(){return this.options.type===rc.SELECT}isBulkUpdateQuery(){return this.options.type===rc.BULKUPDATE}isBulkDeleteQuery(){return this.options.type===rc.BULKDELETE}isForeignKeysQuery(){return this.options.type===rc.FOREIGNKEYS}isUpdateQuery(){return this.options.type===rc.UPDATE}handleSelectQuery(r){let a=null;if(this.options.fieldMap){let n=this.options.fieldMap;r=r.map(i=>Sh.reduce(n,(s,o,c)=>(s[c]!==void 0&&o!==c&&(s[o]=s[c],delete s[c]),s),i))}return this.options.raw?a=r.map(n=>{let i={};for(let s in n)Object.prototype.hasOwnProperty.call(n,s)&&(i[s]=n[s]);return this.options.nest&&(i=Jsr.transform(i)),i}):this.options.hasJoin===!0?(r=t._groupJoinData(r,{model:this.model,includeMap:this.options.includeMap,includeNames:this.options.includeNames},{checkExisting:this.options.hasMultiAssociation}),a=this.model.bulkBuild(r,{isNewRecord:!1,include:this.options.include,includeNames:this.options.includeNames,includeMap:this.options.includeMap,includeValidated:!0,attributes:this.options.originalAttributes||this.options.attributes,raw:!0})):a=this.model.bulkBuild(r,{isNewRecord:!1,raw:!0,attributes:this.options.originalAttributes||this.options.attributes}),this.options.plain&&(a=a.length===0?null:a[0]),a}isShowOrDescribeQuery(){let r=!1;return r=r||this.sql.toLowerCase().startsWith("show"),r=r||this.sql.toLowerCase().startsWith("describe"),r}isCallQuery(){return this.sql.toLowerCase().startsWith("call")}_logQuery(r,a,n){let{connection:i,options:s}=this,o=this.sequelize.options.benchmark||s.benchmark,c=this.sequelize.options.logQueryParameters||s.logQueryParameters,u=Date.now(),l="";if(c&&n){let h=r.endsWith(";")?"":";",b;Array.isArray(n)?b=n.map(m=>h5e(m)).join(", "):b=h5e(n),l=`${h} ${b}`}let f=`(${i.uuid||"default"}): ${r}${l}`,d=`Executing ${f}`;return a(d),o||this.sequelize.log(`Executing ${f}`,s),()=>{let h=`Executed ${f}`;a(h),o&&this.sequelize.log(h,Date.now()-u,s)}}static _groupJoinData(r,a,n){if(!r.length)return[];let i,s,o,c,u,l,f=r.length,d,h,b,m,g,O,z,w,v=n.checkExisting,T,x,L,P=v?[]:new Array(f),C={},Q={},X,k,se,F,D,j,V,he,oe=ne=>{Object.prototype.hasOwnProperty.call(j.includeMap,ne)&&(Q[h]=j=j.includeMap[ne],he?he=`${he}.${ne}`:he=ne,Q[he]=j)},ie={},De=(ne,we)=>(Object.prototype.hasOwnProperty.call(we,ne)||(we[ne]=ne.substr(0,ne.lastIndexOf("."))),we[ne]),Ge={},Ze=ne=>{if(!Object.prototype.hasOwnProperty.call(Ge,ne)){let we=ne.lastIndexOf(".");Ge[ne]=ne.substr(we===-1?0:we+1)}return Ge[ne]},te={},me=ne=>{if(!Object.prototype.hasOwnProperty.call(te,ne)){let we=De(ne,ie);Object.prototype.hasOwnProperty.call(te,we)||(te[we]=we?we.split("."):[]),te[ne]=te[we]}return te[ne]},ve={},ye=ne=>{if(!Object.prototype.hasOwnProperty.call(ve,ne)){let we=me(ne),ke=we.length;ve[ne]=ke?we[ke-1]:""}return ve[ne]},Qe=ne=>{let we=Sh.chain(ne.uniqueKeys);return we=we.result(`${we.findKey()}.fields`).map(ke=>Sh.findKey(ne.attributes,je=>je.field===ke)).value(),we},Ke=ne=>ne instanceof Buffer?ne.toString("hex"):ne,Se,ft,qe;for(u=0;u<f;u++){if(l=r[u],u===0&&(d=Sh.sortBy(Object.keys(l),ne=>[ne.split(".").length]),m=d.length),v){if(w=!1,c=a.model.primaryKeyAttributes.length,L="",c===1)L=Ke(l[a.model.primaryKeyAttributes[0]]);else if(c>1)for(o=0;o<c;o++)L+=Ke(l[a.model.primaryKeyAttributes[o]]);else if(!Sh.isEmpty(a.model.uniqueKeys))for(ft=Qe(a.model),o=0;o<ft.length;o++)L+=l[ft[o]]}for(z=O={},F=void 0,b=0;b<m;b++){if(h=d[b],k=De(h,ie),X=me(h),u===0&&!Object.prototype.hasOwnProperty.call(Q,h)&&(X.length?(j=a,he=void 0,X.forEach(oe)):Q[h]=Q[""]=a),F!==void 0&&F!==X){if(v){if(s=F.length,V=null,x=null,s)for(i=0;i<s;i++){if(qe=V?`${V}.${F[i]}`:F[i],Se=Q[qe].model.primaryKeyAttributes,c=Se.length,T=qe,c===1)T+=Ke(l[`${qe}.${Se[0]}`]);else if(c>1)for(o=0;o<c;o++)T+=Ke(l[`${qe}.${Se[o]}`]);else if(!Sh.isEmpty(Q[qe].model.uniqueKeys))for(ft=Qe(Q[qe].model),o=0;o<ft.length;o++)T+=l[`${qe}.${ft[o]}`];x||(x=L),T=x+T,V=qe,i<s-1&&(x=T)}else T=L;T===L?C[T]?w=!0:C[T]=O:C[T]||(V=C[x],D=ye(g),Q[g].association.isSingleAssociation?V&&(V[D]=C[T]=O):(V[D]||(V[D]=[]),V[D].push(C[T]=O))),O={}}else if(j=z,s=X.length,s)for(i=0;i<s;i++)i===s-1&&(O=j[X[i]]={}),j=j[X[i]]||{}}O[Ze(h)]=l[h],g=h,F=X,se=k}if(v){if(s=F.length,V=null,x=null,s)for(i=0;i<s;i++){if(qe=V?`${V}.${F[i]}`:F[i],Se=Q[qe].model.primaryKeyAttributes,c=Se.length,T=qe,c===1)T+=Ke(l[`${qe}.${Se[0]}`]);else if(c>0)for(o=0;o<c;o++)T+=Ke(l[`${qe}.${Se[o]}`]);else if(!Sh.isEmpty(Q[qe].model.uniqueKeys))for(ft=Qe(Q[qe].model),o=0;o<ft.length;o++)T+=l[`${qe}.${ft[o]}`];x||(x=L),T=x+T,V=qe,i<s-1&&(x=T)}else T=L;T===L?C[T]?w=!0:C[T]=O:C[T]||(V=C[x],D=ye(g),Q[g].association.isSingleAssociation?V&&(V[D]=C[T]=O):(V[D]||(V[D]=[]),V[D].push(C[T]=O))),w||P.push(z)}else P[u]=z}return P}};wC.exports=fR;wC.exports.AbstractQuery=fR;wC.exports.default=fR});var y5e=A((V9a,O5e)=>{"use strict";var tor=Object.defineProperty,b5e=Object.getOwnPropertySymbols,ror=Object.prototype.hasOwnProperty,aor=Object.prototype.propertyIsEnumerable,m5e=(t,r,a)=>r in t?tor(t,r,{enumerable:!0,configurable:!0,writable:!0,value:a}):t[r]=a,nor=(t,r)=>{for(var a in r||(r={}))ror.call(r,a)&&m5e(t,a,r[a]);if(b5e)for(var a of b5e(r))aor.call(r,a)&&m5e(t,a,r[a]);return t},_5e=Bf(),vC=cn(),g5e=hr(),fJ=Ja(),{logger:ior}=Ti(),sor=1062,oor=1213,M5e=1451,cor=1452,A5e=ior.debugContext("sql:mariadb"),dJ=class extends _5e{constructor(r,a,n){super(r,a,nor({showWarnings:!1},n))}static formatBindParameters(r,a,n){let i=[],s=(o,c,u)=>{if(u[c]!==void 0)return i.push(u[c]),"?"};return r=_5e.formatBindParameters(r,a,n,s)[0],[r,i.length>0?i:void 0]}async run(r,a){this.sql=r;let{connection:n,options:i}=this,s=this.sequelize.options.showWarnings||i.showWarnings,o=this._logQuery(r,A5e,a);a&&A5e("parameters(%j)",a);let c,u=new Error;try{c=await n.query(this.sql,a)}catch(l){if(i.transaction&&l.errno===oor){try{await i.transaction.rollback()}catch{}i.transaction.finished="rollback"}throw l.sql=r,l.parameters=a,this.formatError(l,u.stack)}finally{o()}return s&&c&&c.warningStatus>0&&await this.logWarnings(c),this.formatResults(c)}formatResults(r){let a=this.instance;if(this.isBulkUpdateQuery()||this.isBulkDeleteQuery())return r.affectedRows;if(this.isUpsertQuery())return[a,r.affectedRows===1];if(this.isInsertQuery(r)&&(this.handleInsertQuery(r),!this.instance)){if(this.model&&this.model.autoIncrementAttribute&&this.model.autoIncrementAttribute===this.model.primaryKeyAttribute&&this.model.rawAttributes[this.model.primaryKeyAttribute]){let n=r[this.getInsertIdField()];a=new Array(r.affectedRows);let i=this.model.rawAttributes[this.model.primaryKeyAttribute].field;for(let s=0;s<r.affectedRows;s++)a[s]={[i]:n+s};return[a,r.affectedRows]}return[r[this.getInsertIdField()],r.affectedRows]}if(this.isSelectQuery())return this.handleJsonSelectQuery(r),this.handleSelectQuery(r);if(this.isInsertQuery()||this.isUpdateQuery())return[a,r.affectedRows];if(this.isCallQuery())return r[0];if(this.isRawQuery()){let n=r.meta;return delete r.meta,[r,n]}if(this.isShowIndexesQuery())return this.handleShowIndexesQuery(r);if(this.isForeignKeysQuery()||this.isShowConstraintsQuery())return r;if(this.isShowTablesQuery())return this.handleShowTablesQuery(r);if(this.isDescribeQuery()){a={};for(let n of r)a[n.Field]={type:n.Type.toLowerCase().startsWith("enum")?n.Type.replace(/^enum/i,"ENUM"):n.Type.toUpperCase(),allowNull:n.Null==="YES",defaultValue:n.Default,primaryKey:n.Key==="PRI",autoIncrement:Object.prototype.hasOwnProperty.call(n,"Extra")&&n.Extra.toLowerCase()==="auto_increment",comment:n.Comment?n.Comment:null};return a}return this.isVersionQuery()?r[0].version:a}handleJsonSelectQuery(r){if(!(!this.model||!this.model.fieldRawAttributesMap))for(let a of Object.keys(this.model.fieldRawAttributesMap)){let n=this.model.fieldRawAttributesMap[a];n.type instanceof fJ.JSON&&(r=r.map(i=>(i[n.fieldName]&&typeof i[n.fieldName]=="string"&&!this.connection.info.hasMinVersion(10,5,2)&&(i[n.fieldName]=JSON.parse(i[n.fieldName])),fJ.JSON.parse?fJ.JSON.parse(n,this.sequelize.options,i[n.fieldName]):i)))}}async logWarnings(r){let a=await this.run("SHOW WARNINGS"),n=`MariaDB Warnings (${this.connection.uuid||"default"}): `,i=[];for(let s of a)if(!(s===void 0||typeof s[Symbol.iterator]!="function"))for(let o of s)if(Object.prototype.hasOwnProperty.call(o,"Message"))i.push(o.Message);else for(let c of o.keys())i.push([c,o[c]].join(": "));return this.sequelize.log(n+i.join("; "),this.options),r}formatError(r,a){switch(r.errno){case sor:{let n=r.message.match(/Duplicate entry '([\s\S]*)' for key '?((.|\s)*?)'?\s.*$/),i={},s="Validation error",o=n?n[1].split("-"):void 0,c=n?n[2]:void 0,u=n?n[1]:void 0,l=this.model&&this.model.uniqueKeys[c];l?(l.msg&&(s=l.msg),i=g5e.zipObject(l.fields,o)):i[c]=u;let f=[];return g5e.forOwn(i,(d,h)=>{f.push(new vC.ValidationErrorItem(this.getUniqueConstraintErrorMessage(h),"unique violation",h,d,this.instance,"not_unique"))}),new vC.UniqueConstraintError({message:s,errors:f,parent:r,fields:i,stack:a})}case M5e:case cor:{let n=r.message.match(/CONSTRAINT ([`"])(.*)\1 FOREIGN KEY \(\1(.*)\1\) REFERENCES \1(.*)\1 \(\1(.*)\1\)/),i=n?n[1]:"`",s=n?n[3].split(new RegExp(`${i}, *${i}`)):void 0;return new vC.ForeignKeyConstraintError({reltype:r.errno===M5e?"parent":"child",table:n?n[4]:void 0,fields:s,value:s&&s.length&&this.instance&&this.instance[s[0]]||void 0,index:n?n[2]:void 0,parent:r,stack:a})}default:return new vC.DatabaseError(r,{stack:a})}}handleShowTablesQuery(r){return r.map(a=>({tableName:a.TABLE_NAME,schema:a.TABLE_SCHEMA}))}handleShowIndexesQuery(r){let a,n=[];return r.forEach(i=>{(!a||a.name!==i.Key_name)&&(a={primary:i.Key_name==="PRIMARY",fields:[],name:i.Key_name,tableName:i.Table,unique:i.Non_unique!==1,type:i.Index_type},n.push(a)),a.fields[i.Seq_in_index-1]={attribute:i.Column_name,length:i.Sub_part||void 0,order:i.Collation==="A"?"ASC":void 0}}),n}};O5e.exports=dJ});var v5e=A(($9a,w5e)=>{"use strict";var uor=Object.defineProperty,z5e=Object.getOwnPropertySymbols,lor=Object.prototype.hasOwnProperty,por=Object.prototype.propertyIsEnumerable,E5e=(t,r,a)=>r in t?uor(t,r,{enumerable:!0,configurable:!0,writable:!0,value:a}):t[r]=a,dor=(t,r)=>{for(var a in r||(r={}))lor.call(r,a)&&E5e(t,a,r[a]);if(z5e)for(var a of z5e(r))por.call(r,a)&&E5e(t,a,r[a]);return t},RC=hr(),sa=Ws(),hor=On(),bor={OperatorMap:{[sa.eq]:"=",[sa.ne]:"!=",[sa.gte]:">=",[sa.gt]:">",[sa.lte]:"<=",[sa.lt]:"<",[sa.not]:"IS NOT",[sa.is]:"IS",[sa.in]:"IN",[sa.notIn]:"NOT IN",[sa.like]:"LIKE",[sa.notLike]:"NOT LIKE",[sa.iLike]:"ILIKE",[sa.notILike]:"NOT ILIKE",[sa.startsWith]:"LIKE",[sa.endsWith]:"LIKE",[sa.substring]:"LIKE",[sa.regexp]:"~",[sa.notRegexp]:"!~",[sa.iRegexp]:"~*",[sa.notIRegexp]:"!~*",[sa.between]:"BETWEEN",[sa.notBetween]:"NOT BETWEEN",[sa.overlap]:"&&",[sa.contains]:"@>",[sa.contained]:"<@",[sa.adjacent]:"-|-",[sa.strictLeft]:"<<",[sa.strictRight]:">>",[sa.noExtendRight]:"&<",[sa.noExtendLeft]:"&>",[sa.any]:"ANY",[sa.all]:"ALL",[sa.and]:" AND ",[sa.or]:" OR ",[sa.col]:"COL",[sa.placeholder]:"$$PLACEHOLDER$$",[sa.match]:"@@"},OperatorsAliasMap:{},setOperatorsAliases(t){!t||RC.isEmpty(t)?this.OperatorsAliasMap=!1:this.OperatorsAliasMap=dor({},t)},_replaceAliases(t){let r={};return this.OperatorsAliasMap?(hor.getOperators(t).forEach(a=>{let n=t[a];RC.isPlainObject(n)?r[a]=this._replaceAliases(n):r[a]=n}),RC.forOwn(t,(a,n)=>{n=this.OperatorsAliasMap[n]||n,RC.isPlainObject(a)&&(a=this._replaceAliases(a)),r[n]=a}),r):t}};w5e.exports=bor});var T5e=A((Y9a,R5e)=>{"use strict";var mor=(JM(),gf(KM)).v4,_or={setIsolationLevelQuery(t,r){if(!r.parent)return`SET TRANSACTION ISOLATION LEVEL ${t};`},generateTransactionId(){return mor()},startTransactionQuery(t){return t.parent?`SAVEPOINT ${this.quoteIdentifier(t.name,!0)};`:"START TRANSACTION;"},deferConstraintsQuery(){},setConstraintQuery(){},setDeferredQuery(){},setImmediateQuery(){},commitTransactionQuery(t){if(!t.parent)return"COMMIT;"},rollbackTransactionQuery(t){return t.parent?`ROLLBACK TO SAVEPOINT ${this.quoteIdentifier(t.name,!0)};`:"ROLLBACK;"}};R5e.exports=_or});var xh=A((K9a,x5e)=>{"use strict";var gor=Object.defineProperty,Mor=Object.defineProperties,Aor=Object.getOwnPropertyDescriptors,q5e=Object.getOwnPropertySymbols,Oor=Object.prototype.hasOwnProperty,yor=Object.prototype.propertyIsEnumerable,N5e=(t,r,a)=>r in t?gor(t,r,{enumerable:!0,configurable:!0,writable:!0,value:a}):t[r]=a,A2=(t,r)=>{for(var a in r||(r={}))Oor.call(r,a)&&N5e(t,a,r[a]);if(q5e)for(var a of q5e(r))yor.call(r,a)&&N5e(t,a,r[a]);return t},TC=(t,r)=>Mor(t,Aor(r)),qC=require("util"),ra=hr(),zor=(JM(),gf(KM)).v4,Qt=On(),X9a=nA(),I5e=Cv(),lA=Ja(),Uu=vK(),pA=vh(),hJ=Rh(),Eor=tA(),wor=h2(),Rt=Ws(),bJ=cn(),S5e=LK(),dR=class{constructor(r){if(!r.sequelize)throw new Error("QueryGenerator initialized without options.sequelize");if(!r._dialect)throw new Error("QueryGenerator initialized without options._dialect");this.sequelize=r.sequelize,this.options=r.sequelize.options,this.dialect=r._dialect.name,this._dialect=r._dialect,this._initQuoteIdentifier()}extractTableDetails(r,a){return a=a||{},r=r||{},{schema:r.schema||a.schema||this.options.schema||"public",tableName:ra.isPlainObject(r)?r.tableName:r,delimiter:r.delimiter||a.delimiter||"."}}addSchema(r){if(!r._schema)return r.tableName||r;let a=this;return{tableName:r.tableName||r,table:r.tableName||r,name:r.name||r,schema:r._schema,delimiter:r._schemaDelimiter||".",toString(){return a.quoteTable(this)}}}dropSchema(r,a){return this.dropTableQuery(r,a)}describeTableQuery(r,a,n){return`DESCRIBE ${this.quoteTable(this.addSchema({tableName:r,_schema:a,_schemaDelimiter:n}))};`}dropTableQuery(r){return`DROP TABLE IF EXISTS ${this.quoteTable(r)};`}renameTableQuery(r,a){return`ALTER TABLE ${this.quoteTable(r)} RENAME TO ${this.quoteTable(a)};`}populateInsertQueryReturnIntoBinds(){}insertQuery(r,a,n,i){i=i||{},ra.defaults(i,this.options);let s={},o=i.bind||[],c=[],u=[],l=[],f=[],d=this.quoteTable(r),h=i.bindParam===void 0?this.bindParam(o):i.bindParam,b=[],m,g="",O="",z="",w="",v=!1,T="";if(n&&ra.each(n,(C,Q)=>{s[Q]=C,C.field&&(s[C.field]=C)}),this._dialect.supports["DEFAULT VALUES"]?O+=" DEFAULT VALUES":this._dialect.supports["VALUES ()"]&&(O+=" VALUES ()"),(this._dialect.supports.returnValues||this._dialect.supports.returnIntoValues)&&i.returning){let C=this.generateReturnValues(n,i);u.push(...C.returnFields),this._dialect.supports.returnIntoValues&&l.push(...C.returnTypes),w=C.returningFragment,T=C.tmpTable||"",z=C.outputFragment||""}(ra.get(this,["sequelize","options","dialectOptions","prependSearchPath"])||i.searchPath)&&(i.bindParam=!1),this._dialect.supports.EXCEPTION&&i.exception&&(i.bindParam=!1),a=Qt.removeNullValuesFromHash(a,this.options.omitNull);for(let C in a)if(Object.prototype.hasOwnProperty.call(a,C)){let Q=a[C];c.push(this.quoteIdentifier(C)),s&&s[C]&&s[C].autoIncrement===!0&&Q==null?this._dialect.supports.autoIncrement.defaultValue?this._dialect.supports.DEFAULT?f.push("DEFAULT"):f.push(this.escape(null)):c.splice(-1,1):(s&&s[C]&&s[C].autoIncrement===!0&&(v=!0),Q instanceof Qt.SequelizeMethod||i.bindParam===!1?f.push(this.escape(Q,s&&s[C]||void 0,{context:"INSERT"})):f.push(this.format(Q,s&&s[C]||void 0,{context:"INSERT"},h)))}let x="";if(!ra.isEmpty(i.conflictWhere)&&!this._dialect.supports.inserts.onConflictWhere)throw new Error("missing dialect support for conflictWhere option");if(this._dialect.supports.inserts.updateOnDuplicate&&i.updateOnDuplicate)if(this._dialect.supports.inserts.updateOnDuplicate==" ON CONFLICT DO UPDATE SET"){let C=i.upsertKeys.map(k=>this.quoteIdentifier(k)),Q=i.updateOnDuplicate.map(k=>`${this.quoteIdentifier(k)}=EXCLUDED.${this.quoteIdentifier(k)}`),X=["ON CONFLICT","(",C.join(","),")"];ra.isEmpty(i.conflictWhere)||X.push(this.whereQuery(i.conflictWhere,i)),ra.isEmpty(Q)?X.push("DO NOTHING"):X.push("DO UPDATE SET",Q.join(",")),x=` ${Qt.joinSQLFragments(X)}`}else{let C=i.updateOnDuplicate.map(Q=>`${this.quoteIdentifier(Q)}=VALUES(${this.quoteIdentifier(Q)})`);if(ra.isEmpty(C)&&i.upsertKeys&&C.push(...i.upsertKeys.map(Q=>`${this.quoteIdentifier(Q)}=${this.quoteIdentifier(Q)}`)),ra.isEmpty(C))throw new Error("No update values found for ON DUPLICATE KEY UPDATE clause, and no identifier fields could be found to use instead.");x+=`${this._dialect.supports.inserts.updateOnDuplicate} ${C.join(",")}`}let L={ignoreDuplicates:i.ignoreDuplicates?this._dialect.supports.inserts.ignoreDuplicates:"",onConflictDoNothing:i.ignoreDuplicates?this._dialect.supports.inserts.onConflictDoNothing:"",attributes:c.join(","),output:z,values:f.join(","),tmpTable:T};if(g=`${T}INSERT${L.ignoreDuplicates} INTO ${d} (${L.attributes})${L.output} VALUES (${L.values})${x}${L.onConflictDoNothing}${g}`,O=`${T}INSERT${L.ignoreDuplicates} INTO ${d}${L.output}${x}${L.onConflictDoNothing}${O}`,this._dialect.supports.EXCEPTION&&i.exception){let C="DROP FUNCTION IF EXISTS pg_temp.testfunc()";u.length===0&&u.push("*");let Q=`$func_${zor().replace(/-/g,"")}$`,X=`SELECT (testfunc.response).${u.join(", (testfunc.response).")}, testfunc.sequelize_caught_exception FROM pg_temp.testfunc();`;i.exception="WHEN unique_violation THEN GET STACKED DIAGNOSTICS sequelize_caught_exception = PG_EXCEPTION_DETAIL;",g=`CREATE OR REPLACE FUNCTION pg_temp.testfunc(OUT response ${d}, OUT sequelize_caught_exception text) RETURNS RECORD AS ${Q} BEGIN ${g} RETURNING * INTO response; EXCEPTION ${i.exception} END ${Q} LANGUAGE plpgsql; ${X} ${C}`}else g+=w,O+=w;this._dialect.supports.returnIntoValues&&i.returning&&this.populateInsertQueryReturnIntoBinds(u,l,o.length,b,i),m=`${L.attributes.length?g:O}${b.join(",")};`,this._dialect.supports.finalTable&&(m=`SELECT * FROM FINAL TABLE(${L.attributes.length?g:O});`),v&&this._dialect.supports.autoIncrement.identityInsert&&(m=`SET IDENTITY_INSERT ${d} ON; ${m} SET IDENTITY_INSERT ${d} OFF;`);let P={query:m};return i.bindParam!==!1&&(P.bind=o),P}bulkInsertQuery(r,a,n,i){n=n||{},i=i||{};let s=[],o={},c=[],u="";for(let b of a)ra.forOwn(b,(m,g)=>{c.includes(g)||c.push(g),i[g]&&i[g].autoIncrement===!0&&(o[g]=!0)});for(let b of a){let m=c.map(g=>this._dialect.supports.bulkDefault&&o[g]===!0?b[g]!=null?b[g]:"DEFAULT":this.escape(b[g],i[g],{context:"INSERT"}));s.push(`(${m.join(",")})`)}if(this._dialect.supports.inserts.updateOnDuplicate&&n.updateOnDuplicate)if(this._dialect.supports.inserts.updateOnDuplicate==" ON CONFLICT DO UPDATE SET"){let b=n.upsertKeys.map(O=>this.quoteIdentifier(O)),m=n.updateOnDuplicate.map(O=>`${this.quoteIdentifier(O)}=EXCLUDED.${this.quoteIdentifier(O)}`),g=!1;if(n.conflictWhere){if(!this._dialect.supports.inserts.onConflictWhere)throw new Error(`conflictWhere not supported for dialect ${this._dialect.name}`);g=this.whereQuery(n.conflictWhere,n)}u=["ON CONFLICT","(",b.join(","),")",g,"DO UPDATE SET",m.join(",")]}else{if(n.conflictWhere)throw new Error(`conflictWhere not supported for dialect ${this._dialect.name}`);let b=n.updateOnDuplicate.map(m=>`${this.quoteIdentifier(m)}=VALUES(${this.quoteIdentifier(m)})`);u=`${this._dialect.supports.inserts.updateOnDuplicate} ${b.join(",")}`}let l=n.ignoreDuplicates?this._dialect.supports.inserts.ignoreDuplicates:"",f=c.map(b=>this.quoteIdentifier(b)).join(","),d=n.ignoreDuplicates?this._dialect.supports.inserts.onConflictDoNothing:"",h="";if(this._dialect.supports.returnValues&&n.returning){let b=this.generateReturnValues(i,n);h+=b.returningFragment}return Qt.joinSQLFragments(["INSERT",l,"INTO",this.quoteTable(r),`(${f})`,"VALUES",s.join(","),u,d,h,";"])}updateQuery(r,a,n,i,s){i=i||{},ra.defaults(i,this.options),a=Qt.removeNullValuesFromHash(a,i.omitNull,i);let o=[],c=[],u={},l="",f="",d="";(ra.get(this,["sequelize","options","dialectOptions","prependSearchPath"])||i.searchPath)&&(i.bindParam=!1);let h=i.bindParam===void 0?this.bindParam(c):i.bindParam;if(this._dialect.supports["LIMIT ON UPDATE"]&&i.limit&&(["mssql","db2","oracle"].includes(this.dialect)?this.dialect==="oracle"&&(n&&(n.length&&n.length>0||Object.keys(n).length>0)?d+=" AND ":d+=" WHERE ",d+=`rownum <= ${this.escape(i.limit)} `):d=` LIMIT ${this.escape(i.limit)} `),this._dialect.supports.returnValues&&i.returning){let O=this.generateReturnValues(s,i);d+=O.returningFragment,f=O.tmpTable||"",l=O.outputFragment||"",!this._dialect.supports.returnValues.output&&i.returning&&(i.mapToModel=!0)}s&&ra.each(s,(O,z)=>{u[z]=O,O.field&&(u[O.field]=O)});for(let O in a){if(u&&u[O]&&u[O].autoIncrement===!0&&!this._dialect.supports.autoIncrement.update)continue;let z=a[O];z instanceof Qt.SequelizeMethod||i.bindParam===!1?o.push(`${this.quoteIdentifier(O)}=${this.escape(z,u&&u[O]||void 0,{context:"UPDATE"})}`):o.push(`${this.quoteIdentifier(O)}=${this.format(z,u&&u[O]||void 0,{context:"UPDATE"},h)}`)}let b=TC(A2({},i),{bindParam:h});if(o.length===0)return"";let g={query:`${f}UPDATE ${this.quoteTable(r)} SET ${o.join(",")}${l} ${this.whereQuery(n,b)}${d}`.trim()};return i.bindParam!==!1&&(g.bind=c),g}arithmeticQuery(r,a,n,i,s,o){o=o||{},ra.defaults(o,{returning:!0}),s=Qt.removeNullValuesFromHash(s,this.options.omitNull);let c="",u="";if(this._dialect.supports.returnValues&&o.returning){let f=this.generateReturnValues(null,o);c=f.outputFragment,u=f.returningFragment}let l=[];for(let f in i){let d=i[f],h=this.quoteIdentifier(f),b=this.escape(d);l.push(`${h}=${h}${r} ${b}`)}for(let f in s){let d=s[f],h=this.quoteIdentifier(f),b=this.escape(d);l.push(`${h}=${b}`)}return Qt.joinSQLFragments(["UPDATE",this.quoteTable(a),"SET",l.join(","),c,this.whereQuery(n),u])}addIndexQuery(r,a,n,i){n=n||{},Array.isArray(a)?n.fields=a:(n=a,a=void 0),n.prefix=n.prefix||i||r,n.prefix&&typeof n.prefix=="string"&&(n.prefix=n.prefix.replace(/\./g,"_"),n.prefix=n.prefix.replace(/("|')/g,""));let s=n.fields.map(u=>{if(u instanceof Qt.SequelizeMethod)return this.handleSequelizeMethod(u);typeof u=="string"&&(u={name:u});let l="";if(u.attribute&&(u.name=u.attribute),!u.name)throw new Error(`The following index field has no name: ${qC.inspect(u)}`);if(l+=this.quoteIdentifier(u.name),this._dialect.supports.index.collate&&u.collate&&(l+=` COLLATE ${this.quoteIdentifier(u.collate)}`),this._dialect.supports.index.operator){let f=u.operator||n.operator;f&&(l+=` ${f}`)}return this._dialect.supports.index.length&&u.length&&(l+=`(${u.length})`),u.order&&(l+=` ${u.order}`),l});n.name||(n=Qt.nameIndex(n,n.prefix)),n=Uu._conformIndex(n),this._dialect.supports.index.type||delete n.type,n.where&&(n.where=this.whereQuery(n.where)),typeof r=="string"?r=this.quoteIdentifiers(r):r=this.quoteTable(r);let o=this._dialect.supports.index.concurrently&&n.concurrently?"CONCURRENTLY":void 0,c;return this._dialect.supports.indexViaAlter?c=["ALTER TABLE",r,o,"ADD"]:c=["CREATE"],c=c.concat(n.unique?"UNIQUE":"",n.type,"INDEX",this._dialect.supports.indexViaAlter?void 0:o,this.quoteIdentifiers(n.name),this._dialect.supports.index.using===1&&n.using?`USING ${n.using}`:"",this._dialect.supports.indexViaAlter?void 0:`ON ${r}`,this._dialect.supports.index.using===2&&n.using?`USING ${n.using}`:"",`(${s.join(", ")})`,this._dialect.supports.index.parser&&n.parser?`WITH PARSER ${n.parser}`:void 0,this._dialect.supports.index.where&&n.where?n.where:void 0),ra.compact(c).join(" ")}addConstraintQuery(r,a){return typeof r=="string"?r=this.quoteIdentifiers(r):r=this.quoteTable(r),Qt.joinSQLFragments(["ALTER TABLE",r,"ADD",this.getConstraintSnippet(r,a||{}),";"])}getConstraintSnippet(r,a){let n,i,s=a.fields.map(u=>{if(typeof u=="string")return this.quoteIdentifier(u);if(u instanceof Qt.SequelizeMethod)return this.handleSequelizeMethod(u);if(u.attribute&&(u.name=u.attribute),!u.name)throw new Error(`The following index field has no name: ${u}`);return this.quoteIdentifier(u.name)}),o=s.join(", "),c=s.join("_");switch(a.type.toUpperCase()){case"UNIQUE":i=this.quoteIdentifier(a.name||`${r}_${c}_uk`),n=`CONSTRAINT ${i} UNIQUE (${o})`;break;case"CHECK":a.where=this.whereItemsQuery(a.where),i=this.quoteIdentifier(a.name||`${r}_${c}_ck`),n=`CONSTRAINT ${i} CHECK (${a.where})`;break;case"DEFAULT":if(a.defaultValue===void 0)throw new Error("Default value must be specified for DEFAULT CONSTRAINT");if(this._dialect.name!=="mssql")throw new Error("Default constraints are supported only for MSSQL dialect.");i=this.quoteIdentifier(a.name||`${r}_${c}_df`),n=`CONSTRAINT ${i} DEFAULT (${this.escape(a.defaultValue)}) FOR ${s[0]}`;break;case"PRIMARY KEY":i=this.quoteIdentifier(a.name||`${r}_${c}_pk`),n=`CONSTRAINT ${i} PRIMARY KEY (${o})`;break;case"FOREIGN KEY":let u=a.references;if(!u||!u.table||!(u.field||u.fields))throw new Error("references object with table and field must be specified");i=this.quoteIdentifier(a.name||`${r}_${c}_${u.table}_fk`);let l=typeof u.field<"u"?this.quoteIdentifier(u.field):u.fields.map(d=>this.quoteIdentifier(d)).join(", "),f=`${this.quoteTable(u.table)} (${l})`;n=`CONSTRAINT ${i} `,n+=`FOREIGN KEY (${o}) REFERENCES ${f}`,a.onUpdate&&(n+=` ON UPDATE ${a.onUpdate.toUpperCase()}`),a.onDelete&&(n+=` ON DELETE ${a.onDelete.toUpperCase()}`);break;default:throw new Error(`${a.type} is invalid.`)}return a.deferrable&&["UNIQUE","PRIMARY KEY","FOREIGN KEY"].includes(a.type.toUpperCase())&&(n+=` ${this.deferConstraintsQuery(a)}`),n}removeConstraintQuery(r,a){return typeof r=="string"?r=this.quoteIdentifiers(r):r=this.quoteTable(r),Qt.joinSQLFragments(["ALTER TABLE",r,"DROP CONSTRAINT",this.quoteIdentifiers(a)])}quote(r,a,n){let i=["ASC","DESC","ASC NULLS LAST","DESC NULLS LAST","ASC NULLS FIRST","DESC NULLS FIRST","NULLS FIRST","NULLS LAST"];if(n=n||".",typeof r=="string")return this.quoteIdentifiers(r);if(Array.isArray(r)){r.forEach((f,d)=>{let h=r[d-1],b,m;if(!h&&a!==void 0?m=a:h&&h instanceof pA&&(b=h,m=h.target),m&&m.prototype instanceof Uu){let g,O;if(typeof f=="function"&&f.prototype instanceof Uu?g=f:ra.isPlainObject(f)&&f.model&&f.model.prototype instanceof Uu&&(g=f.model,O=f.as),g&&(!O&&b&&b instanceof pA&&b.through&&b.through.model===g?f=new pA(m,g,{as:g.name}):(f=m.getAssociationForAlias(g,O),f||(f=m.getAssociationForAlias(g,g.name))),!(f instanceof pA)))throw new Error(qC.format("Unable to find a valid association for model, '%s'",g.name))}if(typeof f=="string"){let g=i.indexOf(f.toUpperCase());if(d>0&&g!==-1)f=this.sequelize.literal(` ${i[g]}`);else if(m&&m.prototype instanceof Uu){if(m.associations!==void 0&&m.associations[f])f=m.associations[f];else if(m.rawAttributes!==void 0&&m.rawAttributes[f]&&f!==m.rawAttributes[f].field)f=m.rawAttributes[f].field;else if(f.includes(".")&&m.rawAttributes!==void 0){let O=f.split(".");if(m.rawAttributes[O[0]].type instanceof lA.JSON){let z=this.quoteIdentifiers(`${m.name}.${m.rawAttributes[O[0]].field}`),w=O.slice(1);f=this.jsonPathExtractionQuery(z,w),f=this.sequelize.literal(f)}}}}r[d]=f},this);let s=r.length,o=[],c,u=0;for(u=0;u<s-1&&(c=r[u],!(typeof c=="string"||c._modelAttribute||c instanceof Qt.SequelizeMethod));u++)c instanceof pA&&(o[u]=c.as);let l="";return u>0?l+=`${this.quoteIdentifier(o.join(n))}.`:typeof r[0]=="string"&&a&&(l+=`${this.quoteIdentifier(a.name)}.`),r.slice(u).forEach(f=>{l+=this.quote(f,a,n)},this),l}if(r._modelAttribute)return`${this.quoteTable(r.Model.name)}.${this.quoteIdentifier(r.fieldName)}`;if(r instanceof Qt.SequelizeMethod)return this.handleSequelizeMethod(r);throw ra.isPlainObject(r)&&r.raw?new Error('The `{raw: "..."}` syntax is no longer supported.  Use `sequelize.literal` instead.'):new Error(`Unknown structure passed to order / group: ${qC.inspect(r)}`)}_initQuoteIdentifier(){this._quoteIdentifier=this.quoteIdentifier,this.quoteIdentifier=function(r,a){return r==="*"?r:this._quoteIdentifier(r,a)}}quoteIdentifier(r,a){throw new Error(`quoteIdentifier for Dialect "${this.dialect}" is not implemented`)}quoteIdentifiers(r){if(r.includes(".")){r=r.split(".");let a=r.slice(0,r.length-1).join("->"),n=r[r.length-1];return`${this.quoteIdentifier(a)}.${this.quoteIdentifier(n)}`}return this.quoteIdentifier(r)}quoteAttribute(r,a){return a&&r in a.rawAttributes?this.quoteIdentifier(r):this.quoteIdentifiers(r)}getAliasToken(){return"AS"}quoteTable(r,a){let n="";return a===!0&&(a=r.as||r.name||r),ra.isObject(r)?this._dialect.supports.schemas?(r.schema&&(n+=`${this.quoteIdentifier(r.schema)}.`),n+=this.quoteIdentifier(r.tableName)):(r.schema&&(n+=r.schema+(r.delimiter||".")),n+=r.tableName,n=this.quoteIdentifier(n)):n=this.quoteIdentifier(r),a&&(n+=` ${this.getAliasToken()} ${this.quoteIdentifier(a)}`),n}escape(r,a,n){if(n=n||{},r!=null){if(r instanceof Qt.SequelizeMethod)return this.handleSequelizeMethod(r);if(a&&a.type&&(a.type instanceof lA.STRING&&["mysql","mariadb"].includes(this.dialect)&&["number","boolean"].includes(typeof r)&&(r=String(Number(r))),this.validate(r,a,n),a.type.stringify)){let i=s=>I5e.escape(s,this.options.timezone,this.dialect);if(r=a.type.stringify(r,{escape:i,field:a,timezone:this.options.timezone,operation:n.operation}),a.type.escape===!1)return r}}return I5e.escape(r,this.options.timezone,this.dialect)}bindParam(r){return a=>(r.push(a),`$${r.length}`)}format(r,a,n,i){if(n=n||{},r!=null){if(r instanceof Qt.SequelizeMethod)throw new Error("Cannot pass SequelizeMethod as a bind parameter - use escape instead");if(a&&a.type&&(this.validate(r,a,n),a.type.bindParam))return a.type.bindParam(r,{escape:ra.identity,field:a,timezone:this.options.timezone,operation:n.operation,bindParam:i})}return i(r)}validate(r,a,n){if(this.typeValidation&&a.type.validate&&r)try{if(n.isList&&Array.isArray(r))for(let i of r)a.type.validate(i,n);else a.type.validate(r,n)}catch(i){throw i instanceof bJ.ValidationError&&i.errors.push(new bJ.ValidationErrorItem(i.message,"Validation error",a.fieldName,r,null,`${a.type.key} validator`)),i}}isIdentifierQuoted(r){return/^\s*(?:([`"'])(?:(?!\1).|\1{2})*\1\.?)+\s*$/i.test(r)}jsonPathExtractionQuery(r,a,n){let i=ra.toPath(a),s,o=this.isIdentifierQuoted(r)?r:this.quoteIdentifier(r);switch(this.dialect){case"mysql":case"mariadb":case"sqlite":return this.dialect==="mysql"&&(i=i.map(u=>/\D/.test(u)?Qt.addTicks(u,'"'):u)),s=this.escape(["$"].concat(i).join(".").replace(/\.(\d+)(?:(?=\.)|$)/g,(u,l)=>`[${l}]`)),this.dialect==="sqlite"?`json_extract(${o},${s})`:`json_unquote(json_extract(${o},${s}))`;case"postgres":let c=n?"#>":"#>>";return s=this.escape(`{${i.join(",")}}`),`(${o}${c}${s})`;default:throw new Error(`Unsupported ${this.dialect} for JSON operations`)}}selectQuery(r,a,n){a=a||{};let i=a.limit,s=[],o=[],c=a.subQuery===void 0?i&&a.hasMultiAssociation:a.subQuery,u={main:a.attributes&&a.attributes.slice(),subQuery:null},l={name:r,quotedName:null,as:null,model:n},f={names:l,options:a,subQuery:c},d=[],h=[],b;if(this.options.minifyAliases&&!a.aliasesMapping&&(a.aliasesMapping=new Map,a.aliasesByTable={},a.includeAliases=new Map),a.tableAs?l.as=this.quoteIdentifier(a.tableAs):!Array.isArray(l.name)&&l.model&&(l.as=this.quoteIdentifier(l.model.name)),l.quotedName=Array.isArray(l.name)?r.map(g=>Array.isArray(g)?this.quoteTable(g[0],g[1]):this.quoteTable(g,!0)).join(", "):this.quoteTable(l.name),c&&u.main)for(let g of l.model.primaryKeyAttributes)u.main.some(O=>g===O||g===O[0]||g===O[1])||u.main.push(l.model.rawAttributes[g].field?[g,l.model.rawAttributes[g].field]:g);if(u.main=this.escapeAttributes(u.main,a,l.as),u.main=u.main||(a.include?[`${l.as}.*`]:["*"]),(c||a.groupedLimit)&&(u.subQuery=u.main,u.main=[`${l.as||l.quotedName}.*`]),a.include)for(let g of a.include){if(g.separate)continue;let O=this.generateInclude(g,{externalAs:l.as,internalAs:l.as},f);h=h.concat(O.subQuery),d=d.concat(O.mainQuery),O.attributes.main.length>0&&(u.main=ra.uniq(u.main.concat(O.attributes.main))),O.attributes.subQuery.length>0&&(u.subQuery=ra.uniq(u.subQuery.concat(O.attributes.subQuery)))}if(c)o.push(this.selectFromTableFragment(a,l.model,u.subQuery,l.quotedName,l.as)),o.push(h.join(""));else{if(a.groupedLimit){l.as||(l.as=l.quotedName);let g=A2({},a.where),O,z,w,v=l.as;if(typeof a.groupedLimit.on=="string"?z=a.groupedLimit.on:a.groupedLimit.on instanceof wor&&(z=a.groupedLimit.on.foreignKeyField),a.groupedLimit.on instanceof Eor){v=a.groupedLimit.on.manyFromSource.as;let P=Uu._validateIncludedElements({include:[{association:a.groupedLimit.on.manyFromSource,duplicating:!1,required:!0,where:A2({[Rt.placeholder]:!0},a.groupedLimit.through&&a.groupedLimit.through.where)}],model:n});a.hasJoin=!0,a.hasMultiAssociation=!0,a.includeMap=Object.assign(P.includeMap,a.includeMap),a.includeNames=P.includeNames.concat(a.includeNames||[]),w=P.include,Array.isArray(a.order)&&(a.order.forEach((C,Q)=>{Array.isArray(C)&&(C=C[0]);let X=`subquery_order_${Q}`;a.attributes.push([C,X]),X=this.sequelize.literal(this.quote(X)),Array.isArray(a.order[Q])?a.order[Q][0]=X:a.order[Q]=X}),O=a.order)}else O=a.order,this._dialect.supports.topLevelOrderByRequired||delete a.order,g[Rt.placeholder]=!0;let T=`SELECT * FROM (${this.selectQuery(r,{attributes:a.attributes,offset:a.offset,limit:a.groupedLimit.limit,order:O,aliasesMapping:a.aliasesMapping,aliasesByTable:a.aliasesByTable,where:g,include:w,model:n},n).replace(/;$/,"")}) ${this.getAliasToken()} sub`,x=this.whereItemQuery(Rt.placeholder,!0,{model:n}),L=T.indexOf(x);s.push(this.selectFromTableFragment(a,l.model,u.main,`(${a.groupedLimit.values.map(P=>{let C;return z&&(C={[z]:P}),w&&(C={[a.groupedLimit.on.foreignIdentifierField]:P}),Qt.spliceStr(T,L,x.length,this.getWhereConditions(C,v))}).join(this._dialect.supports["UNION ALL"]?" UNION ALL ":" UNION ")})`,l.as))}else s.push(this.selectFromTableFragment(a,l.model,u.main,l.quotedName,l.as));s.push(d.join(""))}if(Object.prototype.hasOwnProperty.call(a,"where")&&!a.groupedLimit&&(a.where=this.getWhereConditions(a.where,l.as||r,n,a),a.where&&(c?o.push(` WHERE ${a.where}`):(s.push(` WHERE ${a.where}`),s.forEach((g,O)=>{g.startsWith("SELECT")&&(s[O]=this.selectFromTableFragment(a,n,u.main,l.quotedName,l.as,a.where))})))),a.group&&(a.group=Array.isArray(a.group)?a.group.map(g=>this.aliasGrouping(g,n,l.as,a)).join(", "):this.aliasGrouping(a.group,n,l.as,a),c&&a.group?o.push(` GROUP BY ${a.group}`):a.group&&s.push(` GROUP BY ${a.group}`)),Object.prototype.hasOwnProperty.call(a,"having")&&(a.having=this.getWhereConditions(a.having,r,n,a,!1),a.having&&(c?o.push(` HAVING ${a.having}`):s.push(` HAVING ${a.having}`))),a.order){let g=this.getQueryOrders(a,n,c);g.mainQueryOrder.length&&s.push(` ORDER BY ${g.mainQueryOrder.join(", ")}`),g.subQueryOrder.length&&o.push(` ORDER BY ${g.subQueryOrder.join(", ")}`)}let m=this.addLimitAndOffset(a,l.model);if(m&&!a.groupedLimit&&(c?o.push(m):s.push(m)),c?(this._throwOnEmptyAttributes(u.main,{modelName:n&&n.name,as:l.as}),b=`SELECT ${u.main.join(", ")} FROM (${o.join("")}) ${this.getAliasToken()} ${l.as}${d.join("")}${s.join("")}`):b=s.join(""),a.lock&&this._dialect.supports.lock){let g=a.lock;typeof a.lock=="object"&&(g=a.lock.level),this._dialect.supports.lockKey&&["KEY SHARE","NO KEY UPDATE"].includes(g)?b+=` FOR ${g}`:g==="SHARE"?b+=` ${this._dialect.supports.forShare}`:b+=" FOR UPDATE",this._dialect.supports.lockOf&&a.lock.of&&a.lock.of.prototype instanceof Uu&&(b+=` OF ${this.quoteTable(a.lock.of.name)}`),this._dialect.supports.skipLocked&&a.skipLocked&&(b+=" SKIP LOCKED")}return`${b};`}aliasGrouping(r,a,n,i){let s=Array.isArray(r)?r[0]:r;return this.quote(this._getAliasForField(n,s,i)||s,a)}escapeAttributes(r,a,n){return r&&r.map(i=>{let s=!0;if(i instanceof Qt.SequelizeMethod)return this.handleSequelizeMethod(i);if(Array.isArray(i)){if(i.length!==2)throw new Error(`${JSON.stringify(i)} is not a valid attribute definition. Please use the following format: ['attribute definition', 'alias']`);if(i=i.slice(),i[0]instanceof Qt.SequelizeMethod)i[0]=this.handleSequelizeMethod(i[0]),s=!1;else if(this.options.attributeBehavior==="escape"||!i[0].includes("(")&&!i[0].includes(")"))i[0]=this.quoteIdentifier(i[0]);else if(this.options.attributeBehavior!=="unsafe-legacy")throw new Error(`Attributes cannot include parentheses in Sequelize 6:
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            

Error: Please install mysql2 package manually
    at t._loadDialectModule (/home/wiomgjqe/neduas.store/server.js:124:7832)
    at new t (/home/wiomgjqe/neduas.store/server.js:136:66644)
    at new O1 (/home/wiomgjqe/neduas.store/server.js:136:73185)
    at new t (/home/wiomgjqe/neduas.store/server.js:136:229204)
    at Object.<anonymous> (/home/wiomgjqe/neduas.store/server.js:3649:2755)
    at Module._compile (node:internal/modules/cjs/loader:1275:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1329:10)
    at Module.load (node:internal/modules/cjs/loader:1133:32)
    at Module._load (node:internal/modules/cjs/loader:972:12)
    at Module.require (node:internal/modules/cjs/loader:1157:19)

Node.js v19.9.0
/home/wiomgjqe/neduas.store/server.js:124
`}};MC.AggregateError=sJ});var n5e=A(AC=>{"use strict";Object.defineProperty(AC,"__esModule",{value:!0});AC.Deferred=void 0;var Tsr=iJ(),cJ=class{constructor(){this._promise=new Promise((r,a)=>{this._reject=a,this._resolve=r})}registerTimeout(r,a){this._timeout||(this._timeout=setTimeout(()=>{a(),this.reject(new Tsr.TimeoutError("Operation timeout"))},r))}_clearTimeout(){this._timeout&&clearTimeout(this._timeout)}resolve(r){this._clearTimeout(),this._resolve(r)}reject(r){this._clearTimeout(),this._reject(r)}promise(){return this._promise}};AC.Deferred=cJ});var i5e=A(OC=>{"use strict";Object.defineProperty(OC,"__esModule",{value:!0});OC.Pool=void 0;var qsr=n5e(),Nsr=oJ(),uJ=class{constructor(r){if(this.log=!1,!r.create)throw new Error("create function is required");if(!r.destroy)throw new Error("destroy function is required");if(!r.validate)throw new Error("validate function is required");if(typeof r.min!="number"||r.min<0||r.min!==Math.round(r.min))throw new Error("min must be an integer >= 0");if(typeof r.max!="number"||r.max<=0||r.max!==Math.round(r.max))throw new Error("max must be an integer > 0");if(r.min>r.max)throw new Error("max is smaller than min");if(r.maxUses!==void 0&&(typeof r.maxUses!="number"||r.maxUses<0))throw new Error("maxUses must be an integer >= 0");this.idleTimeoutMillis=r.idleTimeoutMillis||3e4,this.acquireTimeoutMillis=r.acquireTimeoutMillis||3e4,this.reapIntervalMillis=r.reapIntervalMillis||1e3,this.maxUsesPerResource=r.maxUses||1/0,this.log=r.log||!1,this._factory=r,this._count=0,this._draining=!1,this._pendingAcquires=[],this._inUseObjects=[],this._availableObjects=[],this._removeIdleScheduled=!1}get size(){return this._count}get name(){return this._factory.name}get available(){return this._availableObjects.length}get using(){return this._inUseObjects.length}get waiting(){return this._pendingAcquires.length}get maxSize(){return this._factory.max}get minSize(){return this._factory.min}_log(r,a){typeof this.log=="function"?this.log(r,a):this.log&&console.log(`${a.toUpperCase()} pool ${this.name||""} - ${r}`)}_removeIdle(){let r=[],a=Date.now(),n,i=this._availableObjects.length,s=this.size-this.minSize,o;for(this._removeIdleScheduled=!1,n=0;n<i&&s>r.length;n++)o=this._availableObjects[n].timeout,a>=o&&(this._log("removeIdle() destroying obj - now:"+a+" timeout:"+o,"verbose"),r.push(this._availableObjects[n].resource));r.forEach(this.destroy,this),i=this._availableObjects.length,i>0?(this._log("this._availableObjects.length="+i,"verbose"),this._scheduleRemoveIdle()):this._log("removeIdle() all objects removed","verbose")}_scheduleRemoveIdle(){this._removeIdleScheduled||(this._removeIdleScheduled=!0,this._removeIdleTimer=setTimeout(()=>{this._removeIdle()},this.reapIntervalMillis))}_dispense(){let r=null,a=this._pendingAcquires.length;if(this._log(`dispense() clients=${a} available=${this._availableObjects.length}`,"info"),!(a<1)){for(;this._availableObjects.length>0;){if(this._log("dispense() - reusing obj","verbose"),r=this._availableObjects[this._availableObjects.length-1],!this._factory.validate(r.resource)){this.destroy(r.resource);continue}return this._availableObjects.pop(),this._addResourceToInUseObjects(r.resource,r.useCount),this._pendingAcquires.shift().resolve(r.resource)}this.size<this.maxSize&&this._createResource()}}_createResource(){this._count+=1,this._log(`createResource() - creating obj - count=${this.size} min=${this.minSize} max=${this.maxSize}`,"verbose"),this._factory.create().then(r=>{let a=this._pendingAcquires.shift();a?(this._addResourceToInUseObjects(r,0),a.resolve(r)):this._addResourceToAvailableObjects(r,0)}).catch(r=>{let a=this._pendingAcquires.shift();this._count-=1,this._count<0&&(this._count=0),a&&a.reject(r),process.nextTick(()=>{this._dispense()})})}_addResourceToAvailableObjects(r,a){let n={resource:r,useCount:a,timeout:Date.now()+this.idleTimeoutMillis};this._availableObjects.push(n),this._dispense(),this._scheduleRemoveIdle()}_addResourceToInUseObjects(r,a){let n={resource:r,useCount:a};this._inUseObjects.push(n)}_ensureMinimum(){let r,a;if(!this._draining&&this.size<this.minSize)for(a=this.minSize-this.size,r=0;r<a;r++)this._createResource()}acquire(){if(this._draining)return Promise.reject(new Error("pool is draining and cannot accept work"));let r=new qsr.Deferred;return r.registerTimeout(this.acquireTimeoutMillis,()=>{this._pendingAcquires=this._pendingAcquires.filter(a=>a!==r)}),this._pendingAcquires.push(r),this._dispense(),r.promise()}release(r){if(this._availableObjects.some(i=>i.resource===r)){this._log("release called twice for the same resource: "+new Error().stack,"error");return}let a=this._inUseObjects.findIndex(i=>i.resource===r);if(a<0){this._log("attempt to release an invalid resource: "+new Error().stack,"error");return}let n=this._inUseObjects[a];n.useCount+=1,n.useCount>=this.maxUsesPerResource?(this._log("release() destroying obj - useCount:"+n.useCount+" maxUsesPerResource:"+this.maxUsesPerResource,"verbose"),this.destroy(n.resource),this._dispense()):(this._inUseObjects.splice(a,1),this._addResourceToAvailableObjects(n.resource,n.useCount))}async destroy(r){let a=this._availableObjects.length,n=this._inUseObjects.length;if(this._availableObjects=this._availableObjects.filter(i=>i.resource!==r),this._inUseObjects=this._inUseObjects.filter(i=>i.resource!==r),a===this._availableObjects.length&&n===this._inUseObjects.length){this._ensureMinimum();return}this._count-=1,this._count<0&&(this._count=0);try{await this._factory.destroy(r)}finally{this._ensureMinimum(),this._draining||process.nextTick(()=>{this._dispense()})}}drain(){this._log("draining","info"),this._draining=!0;let r=a=>{if(this._pendingAcquires.length>0){this._dispense(),setTimeout(()=>{r(a)},100);return}if(this._availableObjects.length!==this._count){setTimeout(()=>{r(a)},100);return}a()};return new Promise(a=>r(a))}async destroyAllNow(){this._log("force destroying all objects","info"),this._removeIdleScheduled=!1,clearTimeout(this._removeIdleTimer);let r=this._availableObjects.map(n=>n.resource),a=[];for(let n of r)try{await this.destroy(n)}catch(i){this._log("Error destroying resource: "+i.stack,"error"),a.push(i)}if(a.length>0)throw new Nsr.AggregateError(a)}};OC.Pool=uJ});var s5e=A(Nh=>{"use strict";Object.defineProperty(Nh,"__esModule",{value:!0});Nh.Pool=Nh.AggregateError=Nh.TimeoutError=void 0;var Isr=iJ();Object.defineProperty(Nh,"TimeoutError",{enumerable:!0,get:function(){return Isr.TimeoutError}});var Ssr=oJ();Object.defineProperty(Nh,"AggregateError",{enumerable:!0,get:function(){return Ssr.AggregateError}});var xsr=i5e();Object.defineProperty(Nh,"Pool",{enumerable:!0,get:function(){return xsr.Pool}})});var Df=A((j9a,yC)=>{"use strict";var{Pool:lJ,TimeoutError:ksr}=s5e(),Ih=hr(),pJ=qh(),Csr=cn(),{logger:Lsr}=Ti(),Dsr=nA(),Jl=Lsr.debugContext("pool"),uR=class{constructor(r,a){let n=Ih.cloneDeep(a.config);if(this.sequelize=a,this.config=n,this.dialect=r,this.versionPromise=null,this.dialectName=this.sequelize.options.dialect,n.pool===!1)throw new Error("Support for pool:false was removed in v4.0");n.pool=Ih.defaults(n.pool||{},{max:5,min:0,idle:1e4,acquire:6e4,evict:1e3,validate:this._validate.bind(this)}),this.initPools()}refreshTypeParser(r){Ih.each(r,a=>{if(Object.prototype.hasOwnProperty.call(a,"parse"))if(a.types[this.dialectName])this._refreshTypeParser(a);else throw new Error(`Parse function not supported for type ${a.key} in dialect ${this.dialectName}`)})}_loadDialectModule(r){try{return this.sequelize.config.dialectModulePath?require(this.sequelize.config.dialectModulePath):this.sequelize.config.dialectModule?this.sequelize.config.dialectModule:require(r)}catch(a){throw a.code==="MODULE_NOT_FOUND"?this.sequelize.config.dialectModulePath?new Error(`Unable to find dialect at ${this.sequelize.config.dialectModulePath}`):new Error(`Please install ${r} package manually`):a}}async _onProcessExit(){if(this.pool)return await this.pool.drain(),Jl("connection drain due to process exit"),await this.pool.destroyAllNow()}async close(){return this.getConnection=async function(){throw new Error("ConnectionManager.getConnection was called after the connection manager was closed!")},await this._onProcessExit()}initPools(){let r=this.config;if(!r.replication){this.pool=new lJ({name:"sequelize",create:()=>this._connect(r),destroy:async n=>{let i=await this._disconnect(n);return Jl("connection destroy"),i},validate:r.pool.validate,max:r.pool.max,min:r.pool.min,acquireTimeoutMillis:r.pool.acquire,idleTimeoutMillis:r.pool.idle,reapIntervalMillis:r.pool.evict,maxUses:r.pool.maxUses}),Jl(`pool created with max/min: ${r.pool.max}/${r.pool.min}, no replication`);return}Array.isArray(r.replication.read)||(r.replication.read=[r.replication.read]),r.replication.write=Ih.defaults(r.replication.write,Ih.omit(r,"replication")),r.replication.read=r.replication.read.map(n=>Ih.defaults(n,Ih.omit(this.config,"replication")));let a=0;this.pool={release:n=>{n.queryType==="read"?this.pool.read.release(n):this.pool.write.release(n)},acquire:(n,i)=>(i=i===void 0?!1:i,n==="SELECT"&&!i?this.pool.read.acquire():this.pool.write.acquire()),destroy:n=>{this.pool[n.queryType].destroy(n),Jl("connection destroy")},destroyAllNow:async()=>{await Promise.all([this.pool.read.destroyAllNow(),this.pool.write.destroyAllNow()]),Jl("all connections destroyed")},drain:async()=>Promise.all([this.pool.write.drain(),this.pool.read.drain()]),read:new lJ({name:"sequelize:read",create:async()=>{let n=a++%r.replication.read.length,i=await this._connect(r.replication.read[n]);return i.queryType="read",i},destroy:n=>this._disconnect(n),validate:r.pool.validate,max:r.pool.max,min:r.pool.min,acquireTimeoutMillis:r.pool.acquire,idleTimeoutMillis:r.pool.idle,reapIntervalMillis:r.pool.evict,maxUses:r.pool.maxUses}),write:new lJ({name:"sequelize:write",create:async()=>{let n=await this._connect(r.replication.write);return n.queryType="write",n},destroy:n=>this._disconnect(n),validate:r.pool.validate,max:r.pool.max,min:r.pool.min,acquireTimeoutMillis:r.pool.acquire,idleTimeoutMillis:r.pool.idle,reapIntervalMillis:r.pool.evict,maxUses:r.pool.maxUses})},Jl(`pool created with max/min: ${r.pool.max}/${r.pool.min}, with replication`)}async getConnection(r){r=r||{},this.sequelize.options.databaseVersion===0&&(this.versionPromise||(this.versionPromise=(async()=>{try{let n=await this._connect(this.config.replication.write||this.config),i={};if(i.transaction={connection:n},i.logging=()=>{},i.logging.__testLoggingFn=!0,this.sequelize.options.databaseVersion===0){let s=await this.sequelize.databaseVersion(i),o=Ih.get(pJ.coerce(s),"version")||s;this.sequelize.options.databaseVersion=pJ.valid(o)?o:this.dialect.defaultVersion}return pJ.lt(this.sequelize.options.databaseVersion,this.dialect.defaultVersion)&&(Dsr.unsupportedEngine(),Jl(`Unsupported database engine version ${this.sequelize.options.databaseVersion}`)),this.versionPromise=null,await this._disconnect(n)}catch(n){throw this.versionPromise=null,n}})()),await this.versionPromise);let a;try{await this.sequelize.runHooks("beforePoolAcquire",r),a=await this.pool.acquire(r.type,r.useMaster),await this.sequelize.runHooks("afterPoolAcquire",a,r)}catch(n){throw n instanceof ksr?new Csr.ConnectionAcquireTimeoutError(n):n}return Jl("connection acquired"),a}releaseConnection(r){this.pool.release(r),Jl("connection released")}async destroyConnection(r){await this.pool.destroy(r),Jl(`connection ${r.uuid} destroyed`)}async _connect(r){await this.sequelize.runHooks("beforeConnect",r);let a=await this.dialect.connectionManager.connect(r);return await this.sequelize.runHooks("afterConnect",a,r),a}async _disconnect(r){return await this.sequelize.runHooks("beforeDisconnect",r),await this.dialect.connectionManager.disconnect(r),this.sequelize.runHooks("afterDisconnect",r)}_validate(r){return this.dialect.connectionManager.validate?this.dialect.connectionManager.validate(r):!0}};yC.exports=uR;yC.exports.ConnectionManager=uR;yC.exports.default=uR});var Vc=A((G9a,o5e)=>{"use strict";var lR=new Map;o5e.exports=t=>(lR.has(t)||lR.set(t,new Map),{clear(){lR.get(t).clear()},refresh(r){for(let a of r.types[t])lR.get(t).set(a,r.parse)},get(r){return lR.get(t).get(r)}})});var p5e=A((Q9a,EC)=>{"use strict";var Bsr=Object.defineProperty,c5e=Object.getOwnPropertySymbols,Psr=Object.prototype.hasOwnProperty,Wsr=Object.prototype.propertyIsEnumerable,u5e=(t,r,a)=>r in t?Bsr(t,r,{enumerable:!0,configurable:!0,writable:!0,value:a}):t[r]=a,Usr=(t,r)=>{for(var a in r||(r={}))Psr.call(r,a)&&u5e(t,a,r[a]);if(c5e)for(var a of c5e(r))Wsr.call(r,a)&&u5e(t,a,r[a]);return t},Fsr=qh(),jsr=Df(),uA=cn(),{logger:Gsr}=Ti(),Qsr=Ja().mariadb,Hsr=Hl(),l5e=Gsr.debugContext("connection:mariadb"),zC=Vc()("mariadb"),pR=class t extends jsr{constructor(r,a){a.config.port=a.config.port||3306,super(r,a),this.lib=this._loadDialectModule("mariadb"),this.refreshTypeParser(Qsr)}static _typecast(r,a){return zC.get(r.type)?zC.get(r.type)(r,this.sequelize.options,a):a()}_refreshTypeParser(r){zC.refresh(r)}_clearTypeParser(){zC.clear()}async connect(r){let a=this.sequelize.options.timezone;a=/\//.test(a)?Hsr.tz(a).format("Z"):a;let n=Usr({host:r.host,port:r.port,user:r.username,password:r.password,database:r.database,timezone:a,typeCast:t._typecast.bind(this),bigNumberStrings:!1,supportBigNumbers:!0,foundRows:!1},r.dialectOptions);this.sequelize.config.keepDefaultTimezone||(n.initSql?(Array.isArray(n.initSql)||(n.initSql=[n.initSql]),n.initSql.push(`SET time_zone = '${a}'`)):n.initSql=`SET time_zone = '${a}'`);try{let i=await this.lib.createConnection(n);return this.sequelize.options.databaseVersion=Fsr.coerce(i.serverVersion()).version,l5e("connection acquired"),i.on("error",s=>{switch(s.code){case"ESOCKET":case"ECONNRESET":case"EPIPE":case"PROTOCOL_CONNECTION_LOST":this.pool.destroy(i)}}),i}catch(i){switch(i.code){case"ECONNREFUSED":throw new uA.ConnectionRefusedError(i);case"ER_ACCESS_DENIED_ERROR":case"ER_ACCESS_DENIED_NO_PASSWORD_ERROR":throw new uA.AccessDeniedError(i);case"ENOTFOUND":throw new uA.HostNotFoundError(i);case"EHOSTUNREACH":case"ENETUNREACH":case"EADDRNOTAVAIL":throw new uA.HostNotReachableError(i);case"EINVAL":throw new uA.InvalidConnectionError(i);default:throw new uA.ConnectionError(i)}}}async disconnect(r){if(!r.isValid()){l5e("connection tried to disconnect but was already at CLOSED state");return}return await r.end()}validate(r){return r&&r.isValid()}};EC.exports=pR;EC.exports.ConnectionManager=pR;EC.exports.default=pR});var Bf=A((H9a,wC)=>{"use strict";var Vsr=Object.defineProperty,f5e=Object.getOwnPropertySymbols,$sr=Object.prototype.hasOwnProperty,Ysr=Object.prototype.propertyIsEnumerable,d5e=(t,r,a)=>r in t?Vsr(t,r,{enumerable:!0,configurable:!0,writable:!0,value:a}):t[r]=a,Xsr=(t,r)=>{for(var a in r||(r={}))$sr.call(r,a)&&d5e(t,a,r[a]);if(f5e)for(var a of f5e(r))Ysr.call(r,a)&&d5e(t,a,r[a]);return t},Sh=hr(),Ksr=Cv(),rc=m1(),Jsr=Wv(),Zsr=nA(),eor=(JM(),gf(KM)).v4,{safeStringifyJson:h5e}=On(),fR=class t{constructor(r,a,n){this.uuid=eor(),this.connection=r,this.instance=n.instance,this.model=n.model,this.sequelize=a,this.options=Xsr({plain:!1,raw:!1,logging:console.log},n),this.checkLoggingOption(),n.rawErrors&&(this.formatError=t.prototype.formatError)}static formatBindParameters(r,a,n,i,s){if(!a)return[r,[]];if(s=s||{},typeof i!="function"&&(s=i||{},i=void 0),!i)s.skipValueReplace?i=(u,l,f)=>{if(f[l]!==void 0)return u}:i=(u,l,f,d,h)=>{if(f[l]!==void 0)return Ksr.escape(f[l],d,h)};else if(s.skipValueReplace){let u=i;i=(l,f,d,h,b,m)=>{if(u(l,f,d,h,b,m)!==void 0)return l}}let o=null,c=Array.isArray(a);return r=r.replace(/\B\$(\$|\w+)/g,(u,l)=>{if(l==="$")return s.skipUnescape?u:l;let f;if(c?l.match(/^[1-9]\d*$/)&&(l=l-1,f=i(u,l,a,o,n,s)):l.match(/^\d*$/)||(f=i(u,l,a,o,n,s)),f===void 0)throw new Error(`Named bind parameter "${u}" has no value in the given object.`);return f}),[r,[]]}formatError(r,a){return r.stack=a,r}run(){throw new Error("The run method wasn't overwritten!")}checkLoggingOption(){this.options.logging===!0&&(Zsr.noTrueLogging(),this.options.logging=console.log)}getInsertIdField(){return"insertId"}getUniqueConstraintErrorMessage(r){let a=r?`${r} must be unique`:"Must be unique";if(r&&this.model)for(let n of Object.keys(this.model.uniqueKeys))this.model.uniqueKeys[n].fields.includes(r.replace(/"/g,""))&&this.model.uniqueKeys[n].msg&&(a=this.model.uniqueKeys[n].msg);return a}isRawQuery(){return this.options.type===rc.RAW}isVersionQuery(){return this.options.type===rc.VERSION}isUpsertQuery(){return this.options.type===rc.UPSERT}isInsertQuery(r,a){let n=!0;return this.options.type===rc.INSERT?!0:(n=n&&this.sql.toLowerCase().startsWith("insert into"),n=n&&(!r||Object.prototype.hasOwnProperty.call(r,this.getInsertIdField())),n=n&&(!a||Object.prototype.hasOwnProperty.call(a,this.getInsertIdField())),n)}handleInsertQuery(r,a){if(this.instance){let n=this.model.autoIncrementAttribute,i=null;i=i||r&&r[this.getInsertIdField()],i=i||a&&a[this.getInsertIdField()],this.instance[n]=i}}isShowTablesQuery(){return this.options.type===rc.SHOWTABLES}handleShowTablesQuery(r){return Sh.flatten(r.map(a=>Object.values(a)))}isShowIndexesQuery(){return this.options.type===rc.SHOWINDEXES}isShowConstraintsQuery(){return this.options.type===rc.SHOWCONSTRAINTS}isDescribeQuery(){return this.options.type===rc.DESCRIBE}isSelectQuery(){return this.options.type===rc.SELECT}isBulkUpdateQuery(){return this.options.type===rc.BULKUPDATE}isBulkDeleteQuery(){return this.options.type===rc.BULKDELETE}isForeignKeysQuery(){return this.options.type===rc.FOREIGNKEYS}isUpdateQuery(){return this.options.type===rc.UPDATE}handleSelectQuery(r){let a=null;if(this.options.fieldMap){let n=this.options.fieldMap;r=r.map(i=>Sh.reduce(n,(s,o,c)=>(s[c]!==void 0&&o!==c&&(s[o]=s[c],delete s[c]),s),i))}return this.options.raw?a=r.map(n=>{let i={};for(let s in n)Object.prototype.hasOwnProperty.call(n,s)&&(i[s]=n[s]);return this.options.nest&&(i=Jsr.transform(i)),i}):this.options.hasJoin===!0?(r=t._groupJoinData(r,{model:this.model,includeMap:this.options.includeMap,includeNames:this.options.includeNames},{checkExisting:this.options.hasMultiAssociation}),a=this.model.bulkBuild(r,{isNewRecord:!1,include:this.options.include,includeNames:this.options.includeNames,includeMap:this.options.includeMap,includeValidated:!0,attributes:this.options.originalAttributes||this.options.attributes,raw:!0})):a=this.model.bulkBuild(r,{isNewRecord:!1,raw:!0,attributes:this.options.originalAttributes||this.options.attributes}),this.options.plain&&(a=a.length===0?null:a[0]),a}isShowOrDescribeQuery(){let r=!1;return r=r||this.sql.toLowerCase().startsWith("show"),r=r||this.sql.toLowerCase().startsWith("describe"),r}isCallQuery(){return this.sql.toLowerCase().startsWith("call")}_logQuery(r,a,n){let{connection:i,options:s}=this,o=this.sequelize.options.benchmark||s.benchmark,c=this.sequelize.options.logQueryParameters||s.logQueryParameters,u=Date.now(),l="";if(c&&n){let h=r.endsWith(";")?"":";",b;Array.isArray(n)?b=n.map(m=>h5e(m)).join(", "):b=h5e(n),l=`${h} ${b}`}let f=`(${i.uuid||"default"}): ${r}${l}`,d=`Executing ${f}`;return a(d),o||this.sequelize.log(`Executing ${f}`,s),()=>{let h=`Executed ${f}`;a(h),o&&this.sequelize.log(h,Date.now()-u,s)}}static _groupJoinData(r,a,n){if(!r.length)return[];let i,s,o,c,u,l,f=r.length,d,h,b,m,g,O,z,w,v=n.checkExisting,T,x,L,P=v?[]:new Array(f),C={},Q={},X,k,se,F,D,j,V,he,oe=ne=>{Object.prototype.hasOwnProperty.call(j.includeMap,ne)&&(Q[h]=j=j.includeMap[ne],he?he=`${he}.${ne}`:he=ne,Q[he]=j)},ie={},De=(ne,we)=>(Object.prototype.hasOwnProperty.call(we,ne)||(we[ne]=ne.substr(0,ne.lastIndexOf("."))),we[ne]),Ge={},Ze=ne=>{if(!Object.prototype.hasOwnProperty.call(Ge,ne)){let we=ne.lastIndexOf(".");Ge[ne]=ne.substr(we===-1?0:we+1)}return Ge[ne]},te={},me=ne=>{if(!Object.prototype.hasOwnProperty.call(te,ne)){let we=De(ne,ie);Object.prototype.hasOwnProperty.call(te,we)||(te[we]=we?we.split("."):[]),te[ne]=te[we]}return te[ne]},ve={},ye=ne=>{if(!Object.prototype.hasOwnProperty.call(ve,ne)){let we=me(ne),ke=we.length;ve[ne]=ke?we[ke-1]:""}return ve[ne]},Qe=ne=>{let we=Sh.chain(ne.uniqueKeys);return we=we.result(`${we.findKey()}.fields`).map(ke=>Sh.findKey(ne.attributes,je=>je.field===ke)).value(),we},Ke=ne=>ne instanceof Buffer?ne.toString("hex"):ne,Se,ft,qe;for(u=0;u<f;u++){if(l=r[u],u===0&&(d=Sh.sortBy(Object.keys(l),ne=>[ne.split(".").length]),m=d.length),v){if(w=!1,c=a.model.primaryKeyAttributes.length,L="",c===1)L=Ke(l[a.model.primaryKeyAttributes[0]]);else if(c>1)for(o=0;o<c;o++)L+=Ke(l[a.model.primaryKeyAttributes[o]]);else if(!Sh.isEmpty(a.model.uniqueKeys))for(ft=Qe(a.model),o=0;o<ft.length;o++)L+=l[ft[o]]}for(z=O={},F=void 0,b=0;b<m;b++){if(h=d[b],k=De(h,ie),X=me(h),u===0&&!Object.prototype.hasOwnProperty.call(Q,h)&&(X.length?(j=a,he=void 0,X.forEach(oe)):Q[h]=Q[""]=a),F!==void 0&&F!==X){if(v){if(s=F.length,V=null,x=null,s)for(i=0;i<s;i++){if(qe=V?`${V}.${F[i]}`:F[i],Se=Q[qe].model.primaryKeyAttributes,c=Se.length,T=qe,c===1)T+=Ke(l[`${qe}.${Se[0]}`]);else if(c>1)for(o=0;o<c;o++)T+=Ke(l[`${qe}.${Se[o]}`]);else if(!Sh.isEmpty(Q[qe].model.uniqueKeys))for(ft=Qe(Q[qe].model),o=0;o<ft.length;o++)T+=l[`${qe}.${ft[o]}`];x||(x=L),T=x+T,V=qe,i<s-1&&(x=T)}else T=L;T===L?C[T]?w=!0:C[T]=O:C[T]||(V=C[x],D=ye(g),Q[g].association.isSingleAssociation?V&&(V[D]=C[T]=O):(V[D]||(V[D]=[]),V[D].push(C[T]=O))),O={}}else if(j=z,s=X.length,s)for(i=0;i<s;i++)i===s-1&&(O=j[X[i]]={}),j=j[X[i]]||{}}O[Ze(h)]=l[h],g=h,F=X,se=k}if(v){if(s=F.length,V=null,x=null,s)for(i=0;i<s;i++){if(qe=V?`${V}.${F[i]}`:F[i],Se=Q[qe].model.primaryKeyAttributes,c=Se.length,T=qe,c===1)T+=Ke(l[`${qe}.${Se[0]}`]);else if(c>0)for(o=0;o<c;o++)T+=Ke(l[`${qe}.${Se[o]}`]);else if(!Sh.isEmpty(Q[qe].model.uniqueKeys))for(ft=Qe(Q[qe].model),o=0;o<ft.length;o++)T+=l[`${qe}.${ft[o]}`];x||(x=L),T=x+T,V=qe,i<s-1&&(x=T)}else T=L;T===L?C[T]?w=!0:C[T]=O:C[T]||(V=C[x],D=ye(g),Q[g].association.isSingleAssociation?V&&(V[D]=C[T]=O):(V[D]||(V[D]=[]),V[D].push(C[T]=O))),w||P.push(z)}else P[u]=z}return P}};wC.exports=fR;wC.exports.AbstractQuery=fR;wC.exports.default=fR});var y5e=A((V9a,O5e)=>{"use strict";var tor=Object.defineProperty,b5e=Object.getOwnPropertySymbols,ror=Object.prototype.hasOwnProperty,aor=Object.prototype.propertyIsEnumerable,m5e=(t,r,a)=>r in t?tor(t,r,{enumerable:!0,configurable:!0,writable:!0,value:a}):t[r]=a,nor=(t,r)=>{for(var a in r||(r={}))ror.call(r,a)&&m5e(t,a,r[a]);if(b5e)for(var a of b5e(r))aor.call(r,a)&&m5e(t,a,r[a]);return t},_5e=Bf(),vC=cn(),g5e=hr(),fJ=Ja(),{logger:ior}=Ti(),sor=1062,oor=1213,M5e=1451,cor=1452,A5e=ior.debugContext("sql:mariadb"),dJ=class extends _5e{constructor(r,a,n){super(r,a,nor({showWarnings:!1},n))}static formatBindParameters(r,a,n){let i=[],s=(o,c,u)=>{if(u[c]!==void 0)return i.push(u[c]),"?"};return r=_5e.formatBindParameters(r,a,n,s)[0],[r,i.length>0?i:void 0]}async run(r,a){this.sql=r;let{connection:n,options:i}=this,s=this.sequelize.options.showWarnings||i.showWarnings,o=this._logQuery(r,A5e,a);a&&A5e("parameters(%j)",a);let c,u=new Error;try{c=await n.query(this.sql,a)}catch(l){if(i.transaction&&l.errno===oor){try{await i.transaction.rollback()}catch{}i.transaction.finished="rollback"}throw l.sql=r,l.parameters=a,this.formatError(l,u.stack)}finally{o()}return s&&c&&c.warningStatus>0&&await this.logWarnings(c),this.formatResults(c)}formatResults(r){let a=this.instance;if(this.isBulkUpdateQuery()||this.isBulkDeleteQuery())return r.affectedRows;if(this.isUpsertQuery())return[a,r.affectedRows===1];if(this.isInsertQuery(r)&&(this.handleInsertQuery(r),!this.instance)){if(this.model&&this.model.autoIncrementAttribute&&this.model.autoIncrementAttribute===this.model.primaryKeyAttribute&&this.model.rawAttributes[this.model.primaryKeyAttribute]){let n=r[this.getInsertIdField()];a=new Array(r.affectedRows);let i=this.model.rawAttributes[this.model.primaryKeyAttribute].field;for(let s=0;s<r.affectedRows;s++)a[s]={[i]:n+s};return[a,r.affectedRows]}return[r[this.getInsertIdField()],r.affectedRows]}if(this.isSelectQuery())return this.handleJsonSelectQuery(r),this.handleSelectQuery(r);if(this.isInsertQuery()||this.isUpdateQuery())return[a,r.affectedRows];if(this.isCallQuery())return r[0];if(this.isRawQuery()){let n=r.meta;return delete r.meta,[r,n]}if(this.isShowIndexesQuery())return this.handleShowIndexesQuery(r);if(this.isForeignKeysQuery()||this.isShowConstraintsQuery())return r;if(this.isShowTablesQuery())return this.handleShowTablesQuery(r);if(this.isDescribeQuery()){a={};for(let n of r)a[n.Field]={type:n.Type.toLowerCase().startsWith("enum")?n.Type.replace(/^enum/i,"ENUM"):n.Type.toUpperCase(),allowNull:n.Null==="YES",defaultValue:n.Default,primaryKey:n.Key==="PRI",autoIncrement:Object.prototype.hasOwnProperty.call(n,"Extra")&&n.Extra.toLowerCase()==="auto_increment",comment:n.Comment?n.Comment:null};return a}return this.isVersionQuery()?r[0].version:a}handleJsonSelectQuery(r){if(!(!this.model||!this.model.fieldRawAttributesMap))for(let a of Object.keys(this.model.fieldRawAttributesMap)){let n=this.model.fieldRawAttributesMap[a];n.type instanceof fJ.JSON&&(r=r.map(i=>(i[n.fieldName]&&typeof i[n.fieldName]=="string"&&!this.connection.info.hasMinVersion(10,5,2)&&(i[n.fieldName]=JSON.parse(i[n.fieldName])),fJ.JSON.parse?fJ.JSON.parse(n,this.sequelize.options,i[n.fieldName]):i)))}}async logWarnings(r){let a=await this.run("SHOW WARNINGS"),n=`MariaDB Warnings (${this.connection.uuid||"default"}): `,i=[];for(let s of a)if(!(s===void 0||typeof s[Symbol.iterator]!="function"))for(let o of s)if(Object.prototype.hasOwnProperty.call(o,"Message"))i.push(o.Message);else for(let c of o.keys())i.push([c,o[c]].join(": "));return this.sequelize.log(n+i.join("; "),this.options),r}formatError(r,a){switch(r.errno){case sor:{let n=r.message.match(/Duplicate entry '([\s\S]*)' for key '?((.|\s)*?)'?\s.*$/),i={},s="Validation error",o=n?n[1].split("-"):void 0,c=n?n[2]:void 0,u=n?n[1]:void 0,l=this.model&&this.model.uniqueKeys[c];l?(l.msg&&(s=l.msg),i=g5e.zipObject(l.fields,o)):i[c]=u;let f=[];return g5e.forOwn(i,(d,h)=>{f.push(new vC.ValidationErrorItem(this.getUniqueConstraintErrorMessage(h),"unique violation",h,d,this.instance,"not_unique"))}),new vC.UniqueConstraintError({message:s,errors:f,parent:r,fields:i,stack:a})}case M5e:case cor:{let n=r.message.match(/CONSTRAINT ([`"])(.*)\1 FOREIGN KEY \(\1(.*)\1\) REFERENCES \1(.*)\1 \(\1(.*)\1\)/),i=n?n[1]:"`",s=n?n[3].split(new RegExp(`${i}, *${i}`)):void 0;return new vC.ForeignKeyConstraintError({reltype:r.errno===M5e?"parent":"child",table:n?n[4]:void 0,fields:s,value:s&&s.length&&this.instance&&this.instance[s[0]]||void 0,index:n?n[2]:void 0,parent:r,stack:a})}default:return new vC.DatabaseError(r,{stack:a})}}handleShowTablesQuery(r){return r.map(a=>({tableName:a.TABLE_NAME,schema:a.TABLE_SCHEMA}))}handleShowIndexesQuery(r){let a,n=[];return r.forEach(i=>{(!a||a.name!==i.Key_name)&&(a={primary:i.Key_name==="PRIMARY",fields:[],name:i.Key_name,tableName:i.Table,unique:i.Non_unique!==1,type:i.Index_type},n.push(a)),a.fields[i.Seq_in_index-1]={attribute:i.Column_name,length:i.Sub_part||void 0,order:i.Collation==="A"?"ASC":void 0}}),n}};O5e.exports=dJ});var v5e=A(($9a,w5e)=>{"use strict";var uor=Object.defineProperty,z5e=Object.getOwnPropertySymbols,lor=Object.prototype.hasOwnProperty,por=Object.prototype.propertyIsEnumerable,E5e=(t,r,a)=>r in t?uor(t,r,{enumerable:!0,configurable:!0,writable:!0,value:a}):t[r]=a,dor=(t,r)=>{for(var a in r||(r={}))lor.call(r,a)&&E5e(t,a,r[a]);if(z5e)for(var a of z5e(r))por.call(r,a)&&E5e(t,a,r[a]);return t},RC=hr(),sa=Ws(),hor=On(),bor={OperatorMap:{[sa.eq]:"=",[sa.ne]:"!=",[sa.gte]:">=",[sa.gt]:">",[sa.lte]:"<=",[sa.lt]:"<",[sa.not]:"IS NOT",[sa.is]:"IS",[sa.in]:"IN",[sa.notIn]:"NOT IN",[sa.like]:"LIKE",[sa.notLike]:"NOT LIKE",[sa.iLike]:"ILIKE",[sa.notILike]:"NOT ILIKE",[sa.startsWith]:"LIKE",[sa.endsWith]:"LIKE",[sa.substring]:"LIKE",[sa.regexp]:"~",[sa.notRegexp]:"!~",[sa.iRegexp]:"~*",[sa.notIRegexp]:"!~*",[sa.between]:"BETWEEN",[sa.notBetween]:"NOT BETWEEN",[sa.overlap]:"&&",[sa.contains]:"@>",[sa.contained]:"<@",[sa.adjacent]:"-|-",[sa.strictLeft]:"<<",[sa.strictRight]:">>",[sa.noExtendRight]:"&<",[sa.noExtendLeft]:"&>",[sa.any]:"ANY",[sa.all]:"ALL",[sa.and]:" AND ",[sa.or]:" OR ",[sa.col]:"COL",[sa.placeholder]:"$$PLACEHOLDER$$",[sa.match]:"@@"},OperatorsAliasMap:{},setOperatorsAliases(t){!t||RC.isEmpty(t)?this.OperatorsAliasMap=!1:this.OperatorsAliasMap=dor({},t)},_replaceAliases(t){let r={};return this.OperatorsAliasMap?(hor.getOperators(t).forEach(a=>{let n=t[a];RC.isPlainObject(n)?r[a]=this._replaceAliases(n):r[a]=n}),RC.forOwn(t,(a,n)=>{n=this.OperatorsAliasMap[n]||n,RC.isPlainObject(a)&&(a=this._replaceAliases(a)),r[n]=a}),r):t}};w5e.exports=bor});var T5e=A((Y9a,R5e)=>{"use strict";var mor=(JM(),gf(KM)).v4,_or={setIsolationLevelQuery(t,r){if(!r.parent)return`SET TRANSACTION ISOLATION LEVEL ${t};`},generateTransactionId(){return mor()},startTransactionQuery(t){return t.parent?`SAVEPOINT ${this.quoteIdentifier(t.name,!0)};`:"START TRANSACTION;"},deferConstraintsQuery(){},setConstraintQuery(){},setDeferredQuery(){},setImmediateQuery(){},commitTransactionQuery(t){if(!t.parent)return"COMMIT;"},rollbackTransactionQuery(t){return t.parent?`ROLLBACK TO SAVEPOINT ${this.quoteIdentifier(t.name,!0)};`:"ROLLBACK;"}};R5e.exports=_or});var xh=A((K9a,x5e)=>{"use strict";var gor=Object.defineProperty,Mor=Object.defineProperties,Aor=Object.getOwnPropertyDescriptors,q5e=Object.getOwnPropertySymbols,Oor=Object.prototype.hasOwnProperty,yor=Object.prototype.propertyIsEnumerable,N5e=(t,r,a)=>r in t?gor(t,r,{enumerable:!0,configurable:!0,writable:!0,value:a}):t[r]=a,A2=(t,r)=>{for(var a in r||(r={}))Oor.call(r,a)&&N5e(t,a,r[a]);if(q5e)for(var a of q5e(r))yor.call(r,a)&&N5e(t,a,r[a]);return t},TC=(t,r)=>Mor(t,Aor(r)),qC=require("util"),ra=hr(),zor=(JM(),gf(KM)).v4,Qt=On(),X9a=nA(),I5e=Cv(),lA=Ja(),Uu=vK(),pA=vh(),hJ=Rh(),Eor=tA(),wor=h2(),Rt=Ws(),bJ=cn(),S5e=LK(),dR=class{constructor(r){if(!r.sequelize)throw new Error("QueryGenerator initialized without options.sequelize");if(!r._dialect)throw new Error("QueryGenerator initialized without options._dialect");this.sequelize=r.sequelize,this.options=r.sequelize.options,this.dialect=r._dialect.name,this._dialect=r._dialect,this._initQuoteIdentifier()}extractTableDetails(r,a){return a=a||{},r=r||{},{schema:r.schema||a.schema||this.options.schema||"public",tableName:ra.isPlainObject(r)?r.tableName:r,delimiter:r.delimiter||a.delimiter||"."}}addSchema(r){if(!r._schema)return r.tableName||r;let a=this;return{tableName:r.tableName||r,table:r.tableName||r,name:r.name||r,schema:r._schema,delimiter:r._schemaDelimiter||".",toString(){return a.quoteTable(this)}}}dropSchema(r,a){return this.dropTableQuery(r,a)}describeTableQuery(r,a,n){return`DESCRIBE ${this.quoteTable(this.addSchema({tableName:r,_schema:a,_schemaDelimiter:n}))};`}dropTableQuery(r){return`DROP TABLE IF EXISTS ${this.quoteTable(r)};`}renameTableQuery(r,a){return`ALTER TABLE ${this.quoteTable(r)} RENAME TO ${this.quoteTable(a)};`}populateInsertQueryReturnIntoBinds(){}insertQuery(r,a,n,i){i=i||{},ra.defaults(i,this.options);let s={},o=i.bind||[],c=[],u=[],l=[],f=[],d=this.quoteTable(r),h=i.bindParam===void 0?this.bindParam(o):i.bindParam,b=[],m,g="",O="",z="",w="",v=!1,T="";if(n&&ra.each(n,(C,Q)=>{s[Q]=C,C.field&&(s[C.field]=C)}),this._dialect.supports["DEFAULT VALUES"]?O+=" DEFAULT VALUES":this._dialect.supports["VALUES ()"]&&(O+=" VALUES ()"),(this._dialect.supports.returnValues||this._dialect.supports.returnIntoValues)&&i.returning){let C=this.generateReturnValues(n,i);u.push(...C.returnFields),this._dialect.supports.returnIntoValues&&l.push(...C.returnTypes),w=C.returningFragment,T=C.tmpTable||"",z=C.outputFragment||""}(ra.get(this,["sequelize","options","dialectOptions","prependSearchPath"])||i.searchPath)&&(i.bindParam=!1),this._dialect.supports.EXCEPTION&&i.exception&&(i.bindParam=!1),a=Qt.removeNullValuesFromHash(a,this.options.omitNull);for(let C in a)if(Object.prototype.hasOwnProperty.call(a,C)){let Q=a[C];c.push(this.quoteIdentifier(C)),s&&s[C]&&s[C].autoIncrement===!0&&Q==null?this._dialect.supports.autoIncrement.defaultValue?this._dialect.supports.DEFAULT?f.push("DEFAULT"):f.push(this.escape(null)):c.splice(-1,1):(s&&s[C]&&s[C].autoIncrement===!0&&(v=!0),Q instanceof Qt.SequelizeMethod||i.bindParam===!1?f.push(this.escape(Q,s&&s[C]||void 0,{context:"INSERT"})):f.push(this.format(Q,s&&s[C]||void 0,{context:"INSERT"},h)))}let x="";if(!ra.isEmpty(i.conflictWhere)&&!this._dialect.supports.inserts.onConflictWhere)throw new Error("missing dialect support for conflictWhere option");if(this._dialect.supports.inserts.updateOnDuplicate&&i.updateOnDuplicate)if(this._dialect.supports.inserts.updateOnDuplicate==" ON CONFLICT DO UPDATE SET"){let C=i.upsertKeys.map(k=>this.quoteIdentifier(k)),Q=i.updateOnDuplicate.map(k=>`${this.quoteIdentifier(k)}=EXCLUDED.${this.quoteIdentifier(k)}`),X=["ON CONFLICT","(",C.join(","),")"];ra.isEmpty(i.conflictWhere)||X.push(this.whereQuery(i.conflictWhere,i)),ra.isEmpty(Q)?X.push("DO NOTHING"):X.push("DO UPDATE SET",Q.join(",")),x=` ${Qt.joinSQLFragments(X)}`}else{let C=i.updateOnDuplicate.map(Q=>`${this.quoteIdentifier(Q)}=VALUES(${this.quoteIdentifier(Q)})`);if(ra.isEmpty(C)&&i.upsertKeys&&C.push(...i.upsertKeys.map(Q=>`${this.quoteIdentifier(Q)}=${this.quoteIdentifier(Q)}`)),ra.isEmpty(C))throw new Error("No update values found for ON DUPLICATE KEY UPDATE clause, and no identifier fields could be found to use instead.");x+=`${this._dialect.supports.inserts.updateOnDuplicate} ${C.join(",")}`}let L={ignoreDuplicates:i.ignoreDuplicates?this._dialect.supports.inserts.ignoreDuplicates:"",onConflictDoNothing:i.ignoreDuplicates?this._dialect.supports.inserts.onConflictDoNothing:"",attributes:c.join(","),output:z,values:f.join(","),tmpTable:T};if(g=`${T}INSERT${L.ignoreDuplicates} INTO ${d} (${L.attributes})${L.output} VALUES (${L.values})${x}${L.onConflictDoNothing}${g}`,O=`${T}INSERT${L.ignoreDuplicates} INTO ${d}${L.output}${x}${L.onConflictDoNothing}${O}`,this._dialect.supports.EXCEPTION&&i.exception){let C="DROP FUNCTION IF EXISTS pg_temp.testfunc()";u.length===0&&u.push("*");let Q=`$func_${zor().replace(/-/g,"")}$`,X=`SELECT (testfunc.response).${u.join(", (testfunc.response).")}, testfunc.sequelize_caught_exception FROM pg_temp.testfunc();`;i.exception="WHEN unique_violation THEN GET STACKED DIAGNOSTICS sequelize_caught_exception = PG_EXCEPTION_DETAIL;",g=`CREATE OR REPLACE FUNCTION pg_temp.testfunc(OUT response ${d}, OUT sequelize_caught_exception text) RETURNS RECORD AS ${Q} BEGIN ${g} RETURNING * INTO response; EXCEPTION ${i.exception} END ${Q} LANGUAGE plpgsql; ${X} ${C}`}else g+=w,O+=w;this._dialect.supports.returnIntoValues&&i.returning&&this.populateInsertQueryReturnIntoBinds(u,l,o.length,b,i),m=`${L.attributes.length?g:O}${b.join(",")};`,this._dialect.supports.finalTable&&(m=`SELECT * FROM FINAL TABLE(${L.attributes.length?g:O});`),v&&this._dialect.supports.autoIncrement.identityInsert&&(m=`SET IDENTITY_INSERT ${d} ON; ${m} SET IDENTITY_INSERT ${d} OFF;`);let P={query:m};return i.bindParam!==!1&&(P.bind=o),P}bulkInsertQuery(r,a,n,i){n=n||{},i=i||{};let s=[],o={},c=[],u="";for(let b of a)ra.forOwn(b,(m,g)=>{c.includes(g)||c.push(g),i[g]&&i[g].autoIncrement===!0&&(o[g]=!0)});for(let b of a){let m=c.map(g=>this._dialect.supports.bulkDefault&&o[g]===!0?b[g]!=null?b[g]:"DEFAULT":this.escape(b[g],i[g],{context:"INSERT"}));s.push(`(${m.join(",")})`)}if(this._dialect.supports.inserts.updateOnDuplicate&&n.updateOnDuplicate)if(this._dialect.supports.inserts.updateOnDuplicate==" ON CONFLICT DO UPDATE SET"){let b=n.upsertKeys.map(O=>this.quoteIdentifier(O)),m=n.updateOnDuplicate.map(O=>`${this.quoteIdentifier(O)}=EXCLUDED.${this.quoteIdentifier(O)}`),g=!1;if(n.conflictWhere){if(!this._dialect.supports.inserts.onConflictWhere)throw new Error(`conflictWhere not supported for dialect ${this._dialect.name}`);g=this.whereQuery(n.conflictWhere,n)}u=["ON CONFLICT","(",b.join(","),")",g,"DO UPDATE SET",m.join(",")]}else{if(n.conflictWhere)throw new Error(`conflictWhere not supported for dialect ${this._dialect.name}`);let b=n.updateOnDuplicate.map(m=>`${this.quoteIdentifier(m)}=VALUES(${this.quoteIdentifier(m)})`);u=`${this._dialect.supports.inserts.updateOnDuplicate} ${b.join(",")}`}let l=n.ignoreDuplicates?this._dialect.supports.inserts.ignoreDuplicates:"",f=c.map(b=>this.quoteIdentifier(b)).join(","),d=n.ignoreDuplicates?this._dialect.supports.inserts.onConflictDoNothing:"",h="";if(this._dialect.supports.returnValues&&n.returning){let b=this.generateReturnValues(i,n);h+=b.returningFragment}return Qt.joinSQLFragments(["INSERT",l,"INTO",this.quoteTable(r),`(${f})`,"VALUES",s.join(","),u,d,h,";"])}updateQuery(r,a,n,i,s){i=i||{},ra.defaults(i,this.options),a=Qt.removeNullValuesFromHash(a,i.omitNull,i);let o=[],c=[],u={},l="",f="",d="";(ra.get(this,["sequelize","options","dialectOptions","prependSearchPath"])||i.searchPath)&&(i.bindParam=!1);let h=i.bindParam===void 0?this.bindParam(c):i.bindParam;if(this._dialect.supports["LIMIT ON UPDATE"]&&i.limit&&(["mssql","db2","oracle"].includes(this.dialect)?this.dialect==="oracle"&&(n&&(n.length&&n.length>0||Object.keys(n).length>0)?d+=" AND ":d+=" WHERE ",d+=`rownum <= ${this.escape(i.limit)} `):d=` LIMIT ${this.escape(i.limit)} `),this._dialect.supports.returnValues&&i.returning){let O=this.generateReturnValues(s,i);d+=O.returningFragment,f=O.tmpTable||"",l=O.outputFragment||"",!this._dialect.supports.returnValues.output&&i.returning&&(i.mapToModel=!0)}s&&ra.each(s,(O,z)=>{u[z]=O,O.field&&(u[O.field]=O)});for(let O in a){if(u&&u[O]&&u[O].autoIncrement===!0&&!this._dialect.supports.autoIncrement.update)continue;let z=a[O];z instanceof Qt.SequelizeMethod||i.bindParam===!1?o.push(`${this.quoteIdentifier(O)}=${this.escape(z,u&&u[O]||void 0,{context:"UPDATE"})}`):o.push(`${this.quoteIdentifier(O)}=${this.format(z,u&&u[O]||void 0,{context:"UPDATE"},h)}`)}let b=TC(A2({},i),{bindParam:h});if(o.length===0)return"";let g={query:`${f}UPDATE ${this.quoteTable(r)} SET ${o.join(",")}${l} ${this.whereQuery(n,b)}${d}`.trim()};return i.bindParam!==!1&&(g.bind=c),g}arithmeticQuery(r,a,n,i,s,o){o=o||{},ra.defaults(o,{returning:!0}),s=Qt.removeNullValuesFromHash(s,this.options.omitNull);let c="",u="";if(this._dialect.supports.returnValues&&o.returning){let f=this.generateReturnValues(null,o);c=f.outputFragment,u=f.returningFragment}let l=[];for(let f in i){let d=i[f],h=this.quoteIdentifier(f),b=this.escape(d);l.push(`${h}=${h}${r} ${b}`)}for(let f in s){let d=s[f],h=this.quoteIdentifier(f),b=this.escape(d);l.push(`${h}=${b}`)}return Qt.joinSQLFragments(["UPDATE",this.quoteTable(a),"SET",l.join(","),c,this.whereQuery(n),u])}addIndexQuery(r,a,n,i){n=n||{},Array.isArray(a)?n.fields=a:(n=a,a=void 0),n.prefix=n.prefix||i||r,n.prefix&&typeof n.prefix=="string"&&(n.prefix=n.prefix.replace(/\./g,"_"),n.prefix=n.prefix.replace(/("|')/g,""));let s=n.fields.map(u=>{if(u instanceof Qt.SequelizeMethod)return this.handleSequelizeMethod(u);typeof u=="string"&&(u={name:u});let l="";if(u.attribute&&(u.name=u.attribute),!u.name)throw new Error(`The following index field has no name: ${qC.inspect(u)}`);if(l+=this.quoteIdentifier(u.name),this._dialect.supports.index.collate&&u.collate&&(l+=` COLLATE ${this.quoteIdentifier(u.collate)}`),this._dialect.supports.index.operator){let f=u.operator||n.operator;f&&(l+=` ${f}`)}return this._dialect.supports.index.length&&u.length&&(l+=`(${u.length})`),u.order&&(l+=` ${u.order}`),l});n.name||(n=Qt.nameIndex(n,n.prefix)),n=Uu._conformIndex(n),this._dialect.supports.index.type||delete n.type,n.where&&(n.where=this.whereQuery(n.where)),typeof r=="string"?r=this.quoteIdentifiers(r):r=this.quoteTable(r);let o=this._dialect.supports.index.concurrently&&n.concurrently?"CONCURRENTLY":void 0,c;return this._dialect.supports.indexViaAlter?c=["ALTER TABLE",r,o,"ADD"]:c=["CREATE"],c=c.concat(n.unique?"UNIQUE":"",n.type,"INDEX",this._dialect.supports.indexViaAlter?void 0:o,this.quoteIdentifiers(n.name),this._dialect.supports.index.using===1&&n.using?`USING ${n.using}`:"",this._dialect.supports.indexViaAlter?void 0:`ON ${r}`,this._dialect.supports.index.using===2&&n.using?`USING ${n.using}`:"",`(${s.join(", ")})`,this._dialect.supports.index.parser&&n.parser?`WITH PARSER ${n.parser}`:void 0,this._dialect.supports.index.where&&n.where?n.where:void 0),ra.compact(c).join(" ")}addConstraintQuery(r,a){return typeof r=="string"?r=this.quoteIdentifiers(r):r=this.quoteTable(r),Qt.joinSQLFragments(["ALTER TABLE",r,"ADD",this.getConstraintSnippet(r,a||{}),";"])}getConstraintSnippet(r,a){let n,i,s=a.fields.map(u=>{if(typeof u=="string")return this.quoteIdentifier(u);if(u instanceof Qt.SequelizeMethod)return this.handleSequelizeMethod(u);if(u.attribute&&(u.name=u.attribute),!u.name)throw new Error(`The following index field has no name: ${u}`);return this.quoteIdentifier(u.name)}),o=s.join(", "),c=s.join("_");switch(a.type.toUpperCase()){case"UNIQUE":i=this.quoteIdentifier(a.name||`${r}_${c}_uk`),n=`CONSTRAINT ${i} UNIQUE (${o})`;break;case"CHECK":a.where=this.whereItemsQuery(a.where),i=this.quoteIdentifier(a.name||`${r}_${c}_ck`),n=`CONSTRAINT ${i} CHECK (${a.where})`;break;case"DEFAULT":if(a.defaultValue===void 0)throw new Error("Default value must be specified for DEFAULT CONSTRAINT");if(this._dialect.name!=="mssql")throw new Error("Default constraints are supported only for MSSQL dialect.");i=this.quoteIdentifier(a.name||`${r}_${c}_df`),n=`CONSTRAINT ${i} DEFAULT (${this.escape(a.defaultValue)}) FOR ${s[0]}`;break;case"PRIMARY KEY":i=this.quoteIdentifier(a.name||`${r}_${c}_pk`),n=`CONSTRAINT ${i} PRIMARY KEY (${o})`;break;case"FOREIGN KEY":let u=a.references;if(!u||!u.table||!(u.field||u.fields))throw new Error("references object with table and field must be specified");i=this.quoteIdentifier(a.name||`${r}_${c}_${u.table}_fk`);let l=typeof u.field<"u"?this.quoteIdentifier(u.field):u.fields.map(d=>this.quoteIdentifier(d)).join(", "),f=`${this.quoteTable(u.table)} (${l})`;n=`CONSTRAINT ${i} `,n+=`FOREIGN KEY (${o}) REFERENCES ${f}`,a.onUpdate&&(n+=` ON UPDATE ${a.onUpdate.toUpperCase()}`),a.onDelete&&(n+=` ON DELETE ${a.onDelete.toUpperCase()}`);break;default:throw new Error(`${a.type} is invalid.`)}return a.deferrable&&["UNIQUE","PRIMARY KEY","FOREIGN KEY"].includes(a.type.toUpperCase())&&(n+=` ${this.deferConstraintsQuery(a)}`),n}removeConstraintQuery(r,a){return typeof r=="string"?r=this.quoteIdentifiers(r):r=this.quoteTable(r),Qt.joinSQLFragments(["ALTER TABLE",r,"DROP CONSTRAINT",this.quoteIdentifiers(a)])}quote(r,a,n){let i=["ASC","DESC","ASC NULLS LAST","DESC NULLS LAST","ASC NULLS FIRST","DESC NULLS FIRST","NULLS FIRST","NULLS LAST"];if(n=n||".",typeof r=="string")return this.quoteIdentifiers(r);if(Array.isArray(r)){r.forEach((f,d)=>{let h=r[d-1],b,m;if(!h&&a!==void 0?m=a:h&&h instanceof pA&&(b=h,m=h.target),m&&m.prototype instanceof Uu){let g,O;if(typeof f=="function"&&f.prototype instanceof Uu?g=f:ra.isPlainObject(f)&&f.model&&f.model.prototype instanceof Uu&&(g=f.model,O=f.as),g&&(!O&&b&&b instanceof pA&&b.through&&b.through.model===g?f=new pA(m,g,{as:g.name}):(f=m.getAssociationForAlias(g,O),f||(f=m.getAssociationForAlias(g,g.name))),!(f instanceof pA)))throw new Error(qC.format("Unable to find a valid association for model, '%s'",g.name))}if(typeof f=="string"){let g=i.indexOf(f.toUpperCase());if(d>0&&g!==-1)f=this.sequelize.literal(` ${i[g]}`);else if(m&&m.prototype instanceof Uu){if(m.associations!==void 0&&m.associations[f])f=m.associations[f];else if(m.rawAttributes!==void 0&&m.rawAttributes[f]&&f!==m.rawAttributes[f].field)f=m.rawAttributes[f].field;else if(f.includes(".")&&m.rawAttributes!==void 0){let O=f.split(".");if(m.rawAttributes[O[0]].type instanceof lA.JSON){let z=this.quoteIdentifiers(`${m.name}.${m.rawAttributes[O[0]].field}`),w=O.slice(1);f=this.jsonPathExtractionQuery(z,w),f=this.sequelize.literal(f)}}}}r[d]=f},this);let s=r.length,o=[],c,u=0;for(u=0;u<s-1&&(c=r[u],!(typeof c=="string"||c._modelAttribute||c instanceof Qt.SequelizeMethod));u++)c instanceof pA&&(o[u]=c.as);let l="";return u>0?l+=`${this.quoteIdentifier(o.join(n))}.`:typeof r[0]=="string"&&a&&(l+=`${this.quoteIdentifier(a.name)}.`),r.slice(u).forEach(f=>{l+=this.quote(f,a,n)},this),l}if(r._modelAttribute)return`${this.quoteTable(r.Model.name)}.${this.quoteIdentifier(r.fieldName)}`;if(r instanceof Qt.SequelizeMethod)return this.handleSequelizeMethod(r);throw ra.isPlainObject(r)&&r.raw?new Error('The `{raw: "..."}` syntax is no longer supported.  Use `sequelize.literal` instead.'):new Error(`Unknown structure passed to order / group: ${qC.inspect(r)}`)}_initQuoteIdentifier(){this._quoteIdentifier=this.quoteIdentifier,this.quoteIdentifier=function(r,a){return r==="*"?r:this._quoteIdentifier(r,a)}}quoteIdentifier(r,a){throw new Error(`quoteIdentifier for Dialect "${this.dialect}" is not implemented`)}quoteIdentifiers(r){if(r.includes(".")){r=r.split(".");let a=r.slice(0,r.length-1).join("->"),n=r[r.length-1];return`${this.quoteIdentifier(a)}.${this.quoteIdentifier(n)}`}return this.quoteIdentifier(r)}quoteAttribute(r,a){return a&&r in a.rawAttributes?this.quoteIdentifier(r):this.quoteIdentifiers(r)}getAliasToken(){return"AS"}quoteTable(r,a){let n="";return a===!0&&(a=r.as||r.name||r),ra.isObject(r)?this._dialect.supports.schemas?(r.schema&&(n+=`${this.quoteIdentifier(r.schema)}.`),n+=this.quoteIdentifier(r.tableName)):(r.schema&&(n+=r.schema+(r.delimiter||".")),n+=r.tableName,n=this.quoteIdentifier(n)):n=this.quoteIdentifier(r),a&&(n+=` ${this.getAliasToken()} ${this.quoteIdentifier(a)}`),n}escape(r,a,n){if(n=n||{},r!=null){if(r instanceof Qt.SequelizeMethod)return this.handleSequelizeMethod(r);if(a&&a.type&&(a.type instanceof lA.STRING&&["mysql","mariadb"].includes(this.dialect)&&["number","boolean"].includes(typeof r)&&(r=String(Number(r))),this.validate(r,a,n),a.type.stringify)){let i=s=>I5e.escape(s,this.options.timezone,this.dialect);if(r=a.type.stringify(r,{escape:i,field:a,timezone:this.options.timezone,operation:n.operation}),a.type.escape===!1)return r}}return I5e.escape(r,this.options.timezone,this.dialect)}bindParam(r){return a=>(r.push(a),`$${r.length}`)}format(r,a,n,i){if(n=n||{},r!=null){if(r instanceof Qt.SequelizeMethod)throw new Error("Cannot pass SequelizeMethod as a bind parameter - use escape instead");if(a&&a.type&&(this.validate(r,a,n),a.type.bindParam))return a.type.bindParam(r,{escape:ra.identity,field:a,timezone:this.options.timezone,operation:n.operation,bindParam:i})}return i(r)}validate(r,a,n){if(this.typeValidation&&a.type.validate&&r)try{if(n.isList&&Array.isArray(r))for(let i of r)a.type.validate(i,n);else a.type.validate(r,n)}catch(i){throw i instanceof bJ.ValidationError&&i.errors.push(new bJ.ValidationErrorItem(i.message,"Validation error",a.fieldName,r,null,`${a.type.key} validator`)),i}}isIdentifierQuoted(r){return/^\s*(?:([`"'])(?:(?!\1).|\1{2})*\1\.?)+\s*$/i.test(r)}jsonPathExtractionQuery(r,a,n){let i=ra.toPath(a),s,o=this.isIdentifierQuoted(r)?r:this.quoteIdentifier(r);switch(this.dialect){case"mysql":case"mariadb":case"sqlite":return this.dialect==="mysql"&&(i=i.map(u=>/\D/.test(u)?Qt.addTicks(u,'"'):u)),s=this.escape(["$"].concat(i).join(".").replace(/\.(\d+)(?:(?=\.)|$)/g,(u,l)=>`[${l}]`)),this.dialect==="sqlite"?`json_extract(${o},${s})`:`json_unquote(json_extract(${o},${s}))`;case"postgres":let c=n?"#>":"#>>";return s=this.escape(`{${i.join(",")}}`),`(${o}${c}${s})`;default:throw new Error(`Unsupported ${this.dialect} for JSON operations`)}}selectQuery(r,a,n){a=a||{};let i=a.limit,s=[],o=[],c=a.subQuery===void 0?i&&a.hasMultiAssociation:a.subQuery,u={main:a.attributes&&a.attributes.slice(),subQuery:null},l={name:r,quotedName:null,as:null,model:n},f={names:l,options:a,subQuery:c},d=[],h=[],b;if(this.options.minifyAliases&&!a.aliasesMapping&&(a.aliasesMapping=new Map,a.aliasesByTable={},a.includeAliases=new Map),a.tableAs?l.as=this.quoteIdentifier(a.tableAs):!Array.isArray(l.name)&&l.model&&(l.as=this.quoteIdentifier(l.model.name)),l.quotedName=Array.isArray(l.name)?r.map(g=>Array.isArray(g)?this.quoteTable(g[0],g[1]):this.quoteTable(g,!0)).join(", "):this.quoteTable(l.name),c&&u.main)for(let g of l.model.primaryKeyAttributes)u.main.some(O=>g===O||g===O[0]||g===O[1])||u.main.push(l.model.rawAttributes[g].field?[g,l.model.rawAttributes[g].field]:g);if(u.main=this.escapeAttributes(u.main,a,l.as),u.main=u.main||(a.include?[`${l.as}.*`]:["*"]),(c||a.groupedLimit)&&(u.subQuery=u.main,u.main=[`${l.as||l.quotedName}.*`]),a.include)for(let g of a.include){if(g.separate)continue;let O=this.generateInclude(g,{externalAs:l.as,internalAs:l.as},f);h=h.concat(O.subQuery),d=d.concat(O.mainQuery),O.attributes.main.length>0&&(u.main=ra.uniq(u.main.concat(O.attributes.main))),O.attributes.subQuery.length>0&&(u.subQuery=ra.uniq(u.subQuery.concat(O.attributes.subQuery)))}if(c)o.push(this.selectFromTableFragment(a,l.model,u.subQuery,l.quotedName,l.as)),o.push(h.join(""));else{if(a.groupedLimit){l.as||(l.as=l.quotedName);let g=A2({},a.where),O,z,w,v=l.as;if(typeof a.groupedLimit.on=="string"?z=a.groupedLimit.on:a.groupedLimit.on instanceof wor&&(z=a.groupedLimit.on.foreignKeyField),a.groupedLimit.on instanceof Eor){v=a.groupedLimit.on.manyFromSource.as;let P=Uu._validateIncludedElements({include:[{association:a.groupedLimit.on.manyFromSource,duplicating:!1,required:!0,where:A2({[Rt.placeholder]:!0},a.groupedLimit.through&&a.groupedLimit.through.where)}],model:n});a.hasJoin=!0,a.hasMultiAssociation=!0,a.includeMap=Object.assign(P.includeMap,a.includeMap),a.includeNames=P.includeNames.concat(a.includeNames||[]),w=P.include,Array.isArray(a.order)&&(a.order.forEach((C,Q)=>{Array.isArray(C)&&(C=C[0]);let X=`subquery_order_${Q}`;a.attributes.push([C,X]),X=this.sequelize.literal(this.quote(X)),Array.isArray(a.order[Q])?a.order[Q][0]=X:a.order[Q]=X}),O=a.order)}else O=a.order,this._dialect.supports.topLevelOrderByRequired||delete a.order,g[Rt.placeholder]=!0;let T=`SELECT * FROM (${this.selectQuery(r,{attributes:a.attributes,offset:a.offset,limit:a.groupedLimit.limit,order:O,aliasesMapping:a.aliasesMapping,aliasesByTable:a.aliasesByTable,where:g,include:w,model:n},n).replace(/;$/,"")}) ${this.getAliasToken()} sub`,x=this.whereItemQuery(Rt.placeholder,!0,{model:n}),L=T.indexOf(x);s.push(this.selectFromTableFragment(a,l.model,u.main,`(${a.groupedLimit.values.map(P=>{let C;return z&&(C={[z]:P}),w&&(C={[a.groupedLimit.on.foreignIdentifierField]:P}),Qt.spliceStr(T,L,x.length,this.getWhereConditions(C,v))}).join(this._dialect.supports["UNION ALL"]?" UNION ALL ":" UNION ")})`,l.as))}else s.push(this.selectFromTableFragment(a,l.model,u.main,l.quotedName,l.as));s.push(d.join(""))}if(Object.prototype.hasOwnProperty.call(a,"where")&&!a.groupedLimit&&(a.where=this.getWhereConditions(a.where,l.as||r,n,a),a.where&&(c?o.push(` WHERE ${a.where}`):(s.push(` WHERE ${a.where}`),s.forEach((g,O)=>{g.startsWith("SELECT")&&(s[O]=this.selectFromTableFragment(a,n,u.main,l.quotedName,l.as,a.where))})))),a.group&&(a.group=Array.isArray(a.group)?a.group.map(g=>this.aliasGrouping(g,n,l.as,a)).join(", "):this.aliasGrouping(a.group,n,l.as,a),c&&a.group?o.push(` GROUP BY ${a.group}`):a.group&&s.push(` GROUP BY ${a.group}`)),Object.prototype.hasOwnProperty.call(a,"having")&&(a.having=this.getWhereConditions(a.having,r,n,a,!1),a.having&&(c?o.push(` HAVING ${a.having}`):s.push(` HAVING ${a.having}`))),a.order){let g=this.getQueryOrders(a,n,c);g.mainQueryOrder.length&&s.push(` ORDER BY ${g.mainQueryOrder.join(", ")}`),g.subQueryOrder.length&&o.push(` ORDER BY ${g.subQueryOrder.join(", ")}`)}let m=this.addLimitAndOffset(a,l.model);if(m&&!a.groupedLimit&&(c?o.push(m):s.push(m)),c?(this._throwOnEmptyAttributes(u.main,{modelName:n&&n.name,as:l.as}),b=`SELECT ${u.main.join(", ")} FROM (${o.join("")}) ${this.getAliasToken()} ${l.as}${d.join("")}${s.join("")}`):b=s.join(""),a.lock&&this._dialect.supports.lock){let g=a.lock;typeof a.lock=="object"&&(g=a.lock.level),this._dialect.supports.lockKey&&["KEY SHARE","NO KEY UPDATE"].includes(g)?b+=` FOR ${g}`:g==="SHARE"?b+=` ${this._dialect.supports.forShare}`:b+=" FOR UPDATE",this._dialect.supports.lockOf&&a.lock.of&&a.lock.of.prototype instanceof Uu&&(b+=` OF ${this.quoteTable(a.lock.of.name)}`),this._dialect.supports.skipLocked&&a.skipLocked&&(b+=" SKIP LOCKED")}return`${b};`}aliasGrouping(r,a,n,i){let s=Array.isArray(r)?r[0]:r;return this.quote(this._getAliasForField(n,s,i)||s,a)}escapeAttributes(r,a,n){return r&&r.map(i=>{let s=!0;if(i instanceof Qt.SequelizeMethod)return this.handleSequelizeMethod(i);if(Array.isArray(i)){if(i.length!==2)throw new Error(`${JSON.stringify(i)} is not a valid attribute definition. Please use the following format: ['attribute definition', 'alias']`);if(i=i.slice(),i[0]instanceof Qt.SequelizeMethod)i[0]=this.handleSequelizeMethod(i[0]),s=!1;else if(this.options.attributeBehavior==="escape"||!i[0].includes("(")&&!i[0].includes(")"))i[0]=this.quoteIdentifier(i[0]);else if(this.options.attributeBehavior!=="unsafe-legacy")throw new Error(`Attributes cannot include parentheses in Sequelize 6:
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            

Error: Please install mysql2 package manually
    at t._loadDialectModule (/home/wiomgjqe/neduas.store/server.js:124:7832)
    at new t (/home/wiomgjqe/neduas.store/server.js:136:66644)
    at new O1 (/home/wiomgjqe/neduas.store/server.js:136:73185)
    at new t (/home/wiomgjqe/neduas.store/server.js:136:229204)
    at Object.<anonymous> (/home/wiomgjqe/neduas.store/server.js:3649:2755)
    at Module._compile (node:internal/modules/cjs/loader:1275:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1329:10)
    at Module.load (node:internal/modules/cjs/loader:1133:32)
    at Module._load (node:internal/modules/cjs/loader:972:12)
    at Module.require (node:internal/modules/cjs/loader:1157:19)

Node.js v19.9.0
/home/wiomgjqe/neduas.store/server.js:124
`}};MC.AggregateError=sJ});var n5e=A(AC=>{"use strict";Object.defineProperty(AC,"__esModule",{value:!0});AC.Deferred=void 0;var Tsr=iJ(),cJ=class{constructor(){this._promise=new Promise((r,a)=>{this._reject=a,this._resolve=r})}registerTimeout(r,a){this._timeout||(this._timeout=setTimeout(()=>{a(),this.reject(new Tsr.TimeoutError("Operation timeout"))},r))}_clearTimeout(){this._timeout&&clearTimeout(this._timeout)}resolve(r){this._clearTimeout(),this._resolve(r)}reject(r){this._clearTimeout(),this._reject(r)}promise(){return this._promise}};AC.Deferred=cJ});var i5e=A(OC=>{"use strict";Object.defineProperty(OC,"__esModule",{value:!0});OC.Pool=void 0;var qsr=n5e(),Nsr=oJ(),uJ=class{constructor(r){if(this.log=!1,!r.create)throw new Error("create function is required");if(!r.destroy)throw new Error("destroy function is required");if(!r.validate)throw new Error("validate function is required");if(typeof r.min!="number"||r.min<0||r.min!==Math.round(r.min))throw new Error("min must be an integer >= 0");if(typeof r.max!="number"||r.max<=0||r.max!==Math.round(r.max))throw new Error("max must be an integer > 0");if(r.min>r.max)throw new Error("max is smaller than min");if(r.maxUses!==void 0&&(typeof r.maxUses!="number"||r.maxUses<0))throw new Error("maxUses must be an integer >= 0");this.idleTimeoutMillis=r.idleTimeoutMillis||3e4,this.acquireTimeoutMillis=r.acquireTimeoutMillis||3e4,this.reapIntervalMillis=r.reapIntervalMillis||1e3,this.maxUsesPerResource=r.maxUses||1/0,this.log=r.log||!1,this._factory=r,this._count=0,this._draining=!1,this._pendingAcquires=[],this._inUseObjects=[],this._availableObjects=[],this._removeIdleScheduled=!1}get size(){return this._count}get name(){return this._factory.name}get available(){return this._availableObjects.length}get using(){return this._inUseObjects.length}get waiting(){return this._pendingAcquires.length}get maxSize(){return this._factory.max}get minSize(){return this._factory.min}_log(r,a){typeof this.log=="function"?this.log(r,a):this.log&&console.log(`${a.toUpperCase()} pool ${this.name||""} - ${r}`)}_removeIdle(){let r=[],a=Date.now(),n,i=this._availableObjects.length,s=this.size-this.minSize,o;for(this._removeIdleScheduled=!1,n=0;n<i&&s>r.length;n++)o=this._availableObjects[n].timeout,a>=o&&(this._log("removeIdle() destroying obj - now:"+a+" timeout:"+o,"verbose"),r.push(this._availableObjects[n].resource));r.forEach(this.destroy,this),i=this._availableObjects.length,i>0?(this._log("this._availableObjects.length="+i,"verbose"),this._scheduleRemoveIdle()):this._log("removeIdle() all objects removed","verbose")}_scheduleRemoveIdle(){this._removeIdleScheduled||(this._removeIdleScheduled=!0,this._removeIdleTimer=setTimeout(()=>{this._removeIdle()},this.reapIntervalMillis))}_dispense(){let r=null,a=this._pendingAcquires.length;if(this._log(`dispense() clients=${a} available=${this._availableObjects.length}`,"info"),!(a<1)){for(;this._availableObjects.length>0;){if(this._log("dispense() - reusing obj","verbose"),r=this._availableObjects[this._availableObjects.length-1],!this._factory.validate(r.resource)){this.destroy(r.resource);continue}return this._availableObjects.pop(),this._addResourceToInUseObjects(r.resource,r.useCount),this._pendingAcquires.shift().resolve(r.resource)}this.size<this.maxSize&&this._createResource()}}_createResource(){this._count+=1,this._log(`createResource() - creating obj - count=${this.size} min=${this.minSize} max=${this.maxSize}`,"verbose"),this._factory.create().then(r=>{let a=this._pendingAcquires.shift();a?(this._addResourceToInUseObjects(r,0),a.resolve(r)):this._addResourceToAvailableObjects(r,0)}).catch(r=>{let a=this._pendingAcquires.shift();this._count-=1,this._count<0&&(this._count=0),a&&a.reject(r),process.nextTick(()=>{this._dispense()})})}_addResourceToAvailableObjects(r,a){let n={resource:r,useCount:a,timeout:Date.now()+this.idleTimeoutMillis};this._availableObjects.push(n),this._dispense(),this._scheduleRemoveIdle()}_addResourceToInUseObjects(r,a){let n={resource:r,useCount:a};this._inUseObjects.push(n)}_ensureMinimum(){let r,a;if(!this._draining&&this.size<this.minSize)for(a=this.minSize-this.size,r=0;r<a;r++)this._createResource()}acquire(){if(this._draining)return Promise.reject(new Error("pool is draining and cannot accept work"));let r=new qsr.Deferred;return r.registerTimeout(this.acquireTimeoutMillis,()=>{this._pendingAcquires=this._pendingAcquires.filter(a=>a!==r)}),this._pendingAcquires.push(r),this._dispense(),r.promise()}release(r){if(this._availableObjects.some(i=>i.resource===r)){this._log("release called twice for the same resource: "+new Error().stack,"error");return}let a=this._inUseObjects.findIndex(i=>i.resource===r);if(a<0){this._log("attempt to release an invalid resource: "+new Error().stack,"error");return}let n=this._inUseObjects[a];n.useCount+=1,n.useCount>=this.maxUsesPerResource?(this._log("release() destroying obj - useCount:"+n.useCount+" maxUsesPerResource:"+this.maxUsesPerResource,"verbose"),this.destroy(n.resource),this._dispense()):(this._inUseObjects.splice(a,1),this._addResourceToAvailableObjects(n.resource,n.useCount))}async destroy(r){let a=this._availableObjects.length,n=this._inUseObjects.length;if(this._availableObjects=this._availableObjects.filter(i=>i.resource!==r),this._inUseObjects=this._inUseObjects.filter(i=>i.resource!==r),a===this._availableObjects.length&&n===this._inUseObjects.length){this._ensureMinimum();return}this._count-=1,this._count<0&&(this._count=0);try{await this._factory.destroy(r)}finally{this._ensureMinimum(),this._draining||process.nextTick(()=>{this._dispense()})}}drain(){this._log("draining","info"),this._draining=!0;let r=a=>{if(this._pendingAcquires.length>0){this._dispense(),setTimeout(()=>{r(a)},100);return}if(this._availableObjects.length!==this._count){setTimeout(()=>{r(a)},100);return}a()};return new Promise(a=>r(a))}async destroyAllNow(){this._log("force destroying all objects","info"),this._removeIdleScheduled=!1,clearTimeout(this._removeIdleTimer);let r=this._availableObjects.map(n=>n.resource),a=[];for(let n of r)try{await this.destroy(n)}catch(i){this._log("Error destroying resource: "+i.stack,"error"),a.push(i)}if(a.length>0)throw new Nsr.AggregateError(a)}};OC.Pool=uJ});var s5e=A(Nh=>{"use strict";Object.defineProperty(Nh,"__esModule",{value:!0});Nh.Pool=Nh.AggregateError=Nh.TimeoutError=void 0;var Isr=iJ();Object.defineProperty(Nh,"TimeoutError",{enumerable:!0,get:function(){return Isr.TimeoutError}});var Ssr=oJ();Object.defineProperty(Nh,"AggregateError",{enumerable:!0,get:function(){return Ssr.AggregateError}});var xsr=i5e();Object.defineProperty(Nh,"Pool",{enumerable:!0,get:function(){return xsr.Pool}})});var Df=A((j9a,yC)=>{"use strict";var{Pool:lJ,TimeoutError:ksr}=s5e(),Ih=hr(),pJ=qh(),Csr=cn(),{logger:Lsr}=Ti(),Dsr=nA(),Jl=Lsr.debugContext("pool"),uR=class{constructor(r,a){let n=Ih.cloneDeep(a.config);if(this.sequelize=a,this.config=n,this.dialect=r,this.versionPromise=null,this.dialectName=this.sequelize.options.dialect,n.pool===!1)throw new Error("Support for pool:false was removed in v4.0");n.pool=Ih.defaults(n.pool||{},{max:5,min:0,idle:1e4,acquire:6e4,evict:1e3,validate:this._validate.bind(this)}),this.initPools()}refreshTypeParser(r){Ih.each(r,a=>{if(Object.prototype.hasOwnProperty.call(a,"parse"))if(a.types[this.dialectName])this._refreshTypeParser(a);else throw new Error(`Parse function not supported for type ${a.key} in dialect ${this.dialectName}`)})}_loadDialectModule(r){try{return this.sequelize.config.dialectModulePath?require(this.sequelize.config.dialectModulePath):this.sequelize.config.dialectModule?this.sequelize.config.dialectModule:require(r)}catch(a){throw a.code==="MODULE_NOT_FOUND"?this.sequelize.config.dialectModulePath?new Error(`Unable to find dialect at ${this.sequelize.config.dialectModulePath}`):new Error(`Please install ${r} package manually`):a}}async _onProcessExit(){if(this.pool)return await this.pool.drain(),Jl("connection drain due to process exit"),await this.pool.destroyAllNow()}async close(){return this.getConnection=async function(){throw new Error("ConnectionManager.getConnection was called after the connection manager was closed!")},await this._onProcessExit()}initPools(){let r=this.config;if(!r.replication){this.pool=new lJ({name:"sequelize",create:()=>this._connect(r),destroy:async n=>{let i=await this._disconnect(n);return Jl("connection destroy"),i},validate:r.pool.validate,max:r.pool.max,min:r.pool.min,acquireTimeoutMillis:r.pool.acquire,idleTimeoutMillis:r.pool.idle,reapIntervalMillis:r.pool.evict,maxUses:r.pool.maxUses}),Jl(`pool created with max/min: ${r.pool.max}/${r.pool.min}, no replication`);return}Array.isArray(r.replication.read)||(r.replication.read=[r.replication.read]),r.replication.write=Ih.defaults(r.replication.write,Ih.omit(r,"replication")),r.replication.read=r.replication.read.map(n=>Ih.defaults(n,Ih.omit(this.config,"replication")));let a=0;this.pool={release:n=>{n.queryType==="read"?this.pool.read.release(n):this.pool.write.release(n)},acquire:(n,i)=>(i=i===void 0?!1:i,n==="SELECT"&&!i?this.pool.read.acquire():this.pool.write.acquire()),destroy:n=>{this.pool[n.queryType].destroy(n),Jl("connection destroy")},destroyAllNow:async()=>{await Promise.all([this.pool.read.destroyAllNow(),this.pool.write.destroyAllNow()]),Jl("all connections destroyed")},drain:async()=>Promise.all([this.pool.write.drain(),this.pool.read.drain()]),read:new lJ({name:"sequelize:read",create:async()=>{let n=a++%r.replication.read.length,i=await this._connect(r.replication.read[n]);return i.queryType="read",i},destroy:n=>this._disconnect(n),validate:r.pool.validate,max:r.pool.max,min:r.pool.min,acquireTimeoutMillis:r.pool.acquire,idleTimeoutMillis:r.pool.idle,reapIntervalMillis:r.pool.evict,maxUses:r.pool.maxUses}),write:new lJ({name:"sequelize:write",create:async()=>{let n=await this._connect(r.replication.write);return n.queryType="write",n},destroy:n=>this._disconnect(n),validate:r.pool.validate,max:r.pool.max,min:r.pool.min,acquireTimeoutMillis:r.pool.acquire,idleTimeoutMillis:r.pool.idle,reapIntervalMillis:r.pool.evict,maxUses:r.pool.maxUses})},Jl(`pool created with max/min: ${r.pool.max}/${r.pool.min}, with replication`)}async getConnection(r){r=r||{},this.sequelize.options.databaseVersion===0&&(this.versionPromise||(this.versionPromise=(async()=>{try{let n=await this._connect(this.config.replication.write||this.config),i={};if(i.transaction={connection:n},i.logging=()=>{},i.logging.__testLoggingFn=!0,this.sequelize.options.databaseVersion===0){let s=await this.sequelize.databaseVersion(i),o=Ih.get(pJ.coerce(s),"version")||s;this.sequelize.options.databaseVersion=pJ.valid(o)?o:this.dialect.defaultVersion}return pJ.lt(this.sequelize.options.databaseVersion,this.dialect.defaultVersion)&&(Dsr.unsupportedEngine(),Jl(`Unsupported database engine version ${this.sequelize.options.databaseVersion}`)),this.versionPromise=null,await this._disconnect(n)}catch(n){throw this.versionPromise=null,n}})()),await this.versionPromise);let a;try{await this.sequelize.runHooks("beforePoolAcquire",r),a=await this.pool.acquire(r.type,r.useMaster),await this.sequelize.runHooks("afterPoolAcquire",a,r)}catch(n){throw n instanceof ksr?new Csr.ConnectionAcquireTimeoutError(n):n}return Jl("connection acquired"),a}releaseConnection(r){this.pool.release(r),Jl("connection released")}async destroyConnection(r){await this.pool.destroy(r),Jl(`connection ${r.uuid} destroyed`)}async _connect(r){await this.sequelize.runHooks("beforeConnect",r);let a=await this.dialect.connectionManager.connect(r);return await this.sequelize.runHooks("afterConnect",a,r),a}async _disconnect(r){return await this.sequelize.runHooks("beforeDisconnect",r),await this.dialect.connectionManager.disconnect(r),this.sequelize.runHooks("afterDisconnect",r)}_validate(r){return this.dialect.connectionManager.validate?this.dialect.connectionManager.validate(r):!0}};yC.exports=uR;yC.exports.ConnectionManager=uR;yC.exports.default=uR});var Vc=A((G9a,o5e)=>{"use strict";var lR=new Map;o5e.exports=t=>(lR.has(t)||lR.set(t,new Map),{clear(){lR.get(t).clear()},refresh(r){for(let a of r.types[t])lR.get(t).set(a,r.parse)},get(r){return lR.get(t).get(r)}})});var p5e=A((Q9a,EC)=>{"use strict";var Bsr=Object.defineProperty,c5e=Object.getOwnPropertySymbols,Psr=Object.prototype.hasOwnProperty,Wsr=Object.prototype.propertyIsEnumerable,u5e=(t,r,a)=>r in t?Bsr(t,r,{enumerable:!0,configurable:!0,writable:!0,value:a}):t[r]=a,Usr=(t,r)=>{for(var a in r||(r={}))Psr.call(r,a)&&u5e(t,a,r[a]);if(c5e)for(var a of c5e(r))Wsr.call(r,a)&&u5e(t,a,r[a]);return t},Fsr=qh(),jsr=Df(),uA=cn(),{logger:Gsr}=Ti(),Qsr=Ja().mariadb,Hsr=Hl(),l5e=Gsr.debugContext("connection:mariadb"),zC=Vc()("mariadb"),pR=class t extends jsr{constructor(r,a){a.config.port=a.config.port||3306,super(r,a),this.lib=this._loadDialectModule("mariadb"),this.refreshTypeParser(Qsr)}static _typecast(r,a){return zC.get(r.type)?zC.get(r.type)(r,this.sequelize.options,a):a()}_refreshTypeParser(r){zC.refresh(r)}_clearTypeParser(){zC.clear()}async connect(r){let a=this.sequelize.options.timezone;a=/\//.test(a)?Hsr.tz(a).format("Z"):a;let n=Usr({host:r.host,port:r.port,user:r.username,password:r.password,database:r.database,timezone:a,typeCast:t._typecast.bind(this),bigNumberStrings:!1,supportBigNumbers:!0,foundRows:!1},r.dialectOptions);this.sequelize.config.keepDefaultTimezone||(n.initSql?(Array.isArray(n.initSql)||(n.initSql=[n.initSql]),n.initSql.push(`SET time_zone = '${a}'`)):n.initSql=`SET time_zone = '${a}'`);try{let i=await this.lib.createConnection(n);return this.sequelize.options.databaseVersion=Fsr.coerce(i.serverVersion()).version,l5e("connection acquired"),i.on("error",s=>{switch(s.code){case"ESOCKET":case"ECONNRESET":case"EPIPE":case"PROTOCOL_CONNECTION_LOST":this.pool.destroy(i)}}),i}catch(i){switch(i.code){case"ECONNREFUSED":throw new uA.ConnectionRefusedError(i);case"ER_ACCESS_DENIED_ERROR":case"ER_ACCESS_DENIED_NO_PASSWORD_ERROR":throw new uA.AccessDeniedError(i);case"ENOTFOUND":throw new uA.HostNotFoundError(i);case"EHOSTUNREACH":case"ENETUNREACH":case"EADDRNOTAVAIL":throw new uA.HostNotReachableError(i);case"EINVAL":throw new uA.InvalidConnectionError(i);default:throw new uA.ConnectionError(i)}}}async disconnect(r){if(!r.isValid()){l5e("connection tried to disconnect but was already at CLOSED state");return}return await r.end()}validate(r){return r&&r.isValid()}};EC.exports=pR;EC.exports.ConnectionManager=pR;EC.exports.default=pR});var Bf=A((H9a,wC)=>{"use strict";var Vsr=Object.defineProperty,f5e=Object.getOwnPropertySymbols,$sr=Object.prototype.hasOwnProperty,Ysr=Object.prototype.propertyIsEnumerable,d5e=(t,r,a)=>r in t?Vsr(t,r,{enumerable:!0,configurable:!0,writable:!0,value:a}):t[r]=a,Xsr=(t,r)=>{for(var a in r||(r={}))$sr.call(r,a)&&d5e(t,a,r[a]);if(f5e)for(var a of f5e(r))Ysr.call(r,a)&&d5e(t,a,r[a]);return t},Sh=hr(),Ksr=Cv(),rc=m1(),Jsr=Wv(),Zsr=nA(),eor=(JM(),gf(KM)).v4,{safeStringifyJson:h5e}=On(),fR=class t{constructor(r,a,n){this.uuid=eor(),this.connection=r,this.instance=n.instance,this.model=n.model,this.sequelize=a,this.options=Xsr({plain:!1,raw:!1,logging:console.log},n),this.checkLoggingOption(),n.rawErrors&&(this.formatError=t.prototype.formatError)}static formatBindParameters(r,a,n,i,s){if(!a)return[r,[]];if(s=s||{},typeof i!="function"&&(s=i||{},i=void 0),!i)s.skipValueReplace?i=(u,l,f)=>{if(f[l]!==void 0)return u}:i=(u,l,f,d,h)=>{if(f[l]!==void 0)return Ksr.escape(f[l],d,h)};else if(s.skipValueReplace){let u=i;i=(l,f,d,h,b,m)=>{if(u(l,f,d,h,b,m)!==void 0)return l}}let o=null,c=Array.isArray(a);return r=r.replace(/\B\$(\$|\w+)/g,(u,l)=>{if(l==="$")return s.skipUnescape?u:l;let f;if(c?l.match(/^[1-9]\d*$/)&&(l=l-1,f=i(u,l,a,o,n,s)):l.match(/^\d*$/)||(f=i(u,l,a,o,n,s)),f===void 0)throw new Error(`Named bind parameter "${u}" has no value in the given object.`);return f}),[r,[]]}formatError(r,a){return r.stack=a,r}run(){throw new Error("The run method wasn't overwritten!")}checkLoggingOption(){this.options.logging===!0&&(Zsr.noTrueLogging(),this.options.logging=console.log)}getInsertIdField(){return"insertId"}getUniqueConstraintErrorMessage(r){let a=r?`${r} must be unique`:"Must be unique";if(r&&this.model)for(let n of Object.keys(this.model.uniqueKeys))this.model.uniqueKeys[n].fields.includes(r.replace(/"/g,""))&&this.model.uniqueKeys[n].msg&&(a=this.model.uniqueKeys[n].msg);return a}isRawQuery(){return this.options.type===rc.RAW}isVersionQuery(){return this.options.type===rc.VERSION}isUpsertQuery(){return this.options.type===rc.UPSERT}isInsertQuery(r,a){let n=!0;return this.options.type===rc.INSERT?!0:(n=n&&this.sql.toLowerCase().startsWith("insert into"),n=n&&(!r||Object.prototype.hasOwnProperty.call(r,this.getInsertIdField())),n=n&&(!a||Object.prototype.hasOwnProperty.call(a,this.getInsertIdField())),n)}handleInsertQuery(r,a){if(this.instance){let n=this.model.autoIncrementAttribute,i=null;i=i||r&&r[this.getInsertIdField()],i=i||a&&a[this.getInsertIdField()],this.instance[n]=i}}isShowTablesQuery(){return this.options.type===rc.SHOWTABLES}handleShowTablesQuery(r){return Sh.flatten(r.map(a=>Object.values(a)))}isShowIndexesQuery(){return this.options.type===rc.SHOWINDEXES}isShowConstraintsQuery(){return this.options.type===rc.SHOWCONSTRAINTS}isDescribeQuery(){return this.options.type===rc.DESCRIBE}isSelectQuery(){return this.options.type===rc.SELECT}isBulkUpdateQuery(){return this.options.type===rc.BULKUPDATE}isBulkDeleteQuery(){return this.options.type===rc.BULKDELETE}isForeignKeysQuery(){return this.options.type===rc.FOREIGNKEYS}isUpdateQuery(){return this.options.type===rc.UPDATE}handleSelectQuery(r){let a=null;if(this.options.fieldMap){let n=this.options.fieldMap;r=r.map(i=>Sh.reduce(n,(s,o,c)=>(s[c]!==void 0&&o!==c&&(s[o]=s[c],delete s[c]),s),i))}return this.options.raw?a=r.map(n=>{let i={};for(let s in n)Object.prototype.hasOwnProperty.call(n,s)&&(i[s]=n[s]);return this.options.nest&&(i=Jsr.transform(i)),i}):this.options.hasJoin===!0?(r=t._groupJoinData(r,{model:this.model,includeMap:this.options.includeMap,includeNames:this.options.includeNames},{checkExisting:this.options.hasMultiAssociation}),a=this.model.bulkBuild(r,{isNewRecord:!1,include:this.options.include,includeNames:this.options.includeNames,includeMap:this.options.includeMap,includeValidated:!0,attributes:this.options.originalAttributes||this.options.attributes,raw:!0})):a=this.model.bulkBuild(r,{isNewRecord:!1,raw:!0,attributes:this.options.originalAttributes||this.options.attributes}),this.options.plain&&(a=a.length===0?null:a[0]),a}isShowOrDescribeQuery(){let r=!1;return r=r||this.sql.toLowerCase().startsWith("show"),r=r||this.sql.toLowerCase().startsWith("describe"),r}isCallQuery(){return this.sql.toLowerCase().startsWith("call")}_logQuery(r,a,n){let{connection:i,options:s}=this,o=this.sequelize.options.benchmark||s.benchmark,c=this.sequelize.options.logQueryParameters||s.logQueryParameters,u=Date.now(),l="";if(c&&n){let h=r.endsWith(";")?"":";",b;Array.isArray(n)?b=n.map(m=>h5e(m)).join(", "):b=h5e(n),l=`${h} ${b}`}let f=`(${i.uuid||"default"}): ${r}${l}`,d=`Executing ${f}`;return a(d),o||this.sequelize.log(`Executing ${f}`,s),()=>{let h=`Executed ${f}`;a(h),o&&this.sequelize.log(h,Date.now()-u,s)}}static _groupJoinData(r,a,n){if(!r.length)return[];let i,s,o,c,u,l,f=r.length,d,h,b,m,g,O,z,w,v=n.checkExisting,T,x,L,P=v?[]:new Array(f),C={},Q={},X,k,se,F,D,j,V,he,oe=ne=>{Object.prototype.hasOwnProperty.call(j.includeMap,ne)&&(Q[h]=j=j.includeMap[ne],he?he=`${he}.${ne}`:he=ne,Q[he]=j)},ie={},De=(ne,we)=>(Object.prototype.hasOwnProperty.call(we,ne)||(we[ne]=ne.substr(0,ne.lastIndexOf("."))),we[ne]),Ge={},Ze=ne=>{if(!Object.prototype.hasOwnProperty.call(Ge,ne)){let we=ne.lastIndexOf(".");Ge[ne]=ne.substr(we===-1?0:we+1)}return Ge[ne]},te={},me=ne=>{if(!Object.prototype.hasOwnProperty.call(te,ne)){let we=De(ne,ie);Object.prototype.hasOwnProperty.call(te,we)||(te[we]=we?we.split("."):[]),te[ne]=te[we]}return te[ne]},ve={},ye=ne=>{if(!Object.prototype.hasOwnProperty.call(ve,ne)){let we=me(ne),ke=we.length;ve[ne]=ke?we[ke-1]:""}return ve[ne]},Qe=ne=>{let we=Sh.chain(ne.uniqueKeys);return we=we.result(`${we.findKey()}.fields`).map(ke=>Sh.findKey(ne.attributes,je=>je.field===ke)).value(),we},Ke=ne=>ne instanceof Buffer?ne.toString("hex"):ne,Se,ft,qe;for(u=0;u<f;u++){if(l=r[u],u===0&&(d=Sh.sortBy(Object.keys(l),ne=>[ne.split(".").length]),m=d.length),v){if(w=!1,c=a.model.primaryKeyAttributes.length,L="",c===1)L=Ke(l[a.model.primaryKeyAttributes[0]]);else if(c>1)for(o=0;o<c;o++)L+=Ke(l[a.model.primaryKeyAttributes[o]]);else if(!Sh.isEmpty(a.model.uniqueKeys))for(ft=Qe(a.model),o=0;o<ft.length;o++)L+=l[ft[o]]}for(z=O={},F=void 0,b=0;b<m;b++){if(h=d[b],k=De(h,ie),X=me(h),u===0&&!Object.prototype.hasOwnProperty.call(Q,h)&&(X.length?(j=a,he=void 0,X.forEach(oe)):Q[h]=Q[""]=a),F!==void 0&&F!==X){if(v){if(s=F.length,V=null,x=null,s)for(i=0;i<s;i++){if(qe=V?`${V}.${F[i]}`:F[i],Se=Q[qe].model.primaryKeyAttributes,c=Se.length,T=qe,c===1)T+=Ke(l[`${qe}.${Se[0]}`]);else if(c>1)for(o=0;o<c;o++)T+=Ke(l[`${qe}.${Se[o]}`]);else if(!Sh.isEmpty(Q[qe].model.uniqueKeys))for(ft=Qe(Q[qe].model),o=0;o<ft.length;o++)T+=l[`${qe}.${ft[o]}`];x||(x=L),T=x+T,V=qe,i<s-1&&(x=T)}else T=L;T===L?C[T]?w=!0:C[T]=O:C[T]||(V=C[x],D=ye(g),Q[g].association.isSingleAssociation?V&&(V[D]=C[T]=O):(V[D]||(V[D]=[]),V[D].push(C[T]=O))),O={}}else if(j=z,s=X.length,s)for(i=0;i<s;i++)i===s-1&&(O=j[X[i]]={}),j=j[X[i]]||{}}O[Ze(h)]=l[h],g=h,F=X,se=k}if(v){if(s=F.length,V=null,x=null,s)for(i=0;i<s;i++){if(qe=V?`${V}.${F[i]}`:F[i],Se=Q[qe].model.primaryKeyAttributes,c=Se.length,T=qe,c===1)T+=Ke(l[`${qe}.${Se[0]}`]);else if(c>0)for(o=0;o<c;o++)T+=Ke(l[`${qe}.${Se[o]}`]);else if(!Sh.isEmpty(Q[qe].model.uniqueKeys))for(ft=Qe(Q[qe].model),o=0;o<ft.length;o++)T+=l[`${qe}.${ft[o]}`];x||(x=L),T=x+T,V=qe,i<s-1&&(x=T)}else T=L;T===L?C[T]?w=!0:C[T]=O:C[T]||(V=C[x],D=ye(g),Q[g].association.isSingleAssociation?V&&(V[D]=C[T]=O):(V[D]||(V[D]=[]),V[D].push(C[T]=O))),w||P.push(z)}else P[u]=z}return P}};wC.exports=fR;wC.exports.AbstractQuery=fR;wC.exports.default=fR});var y5e=A((V9a,O5e)=>{"use strict";var tor=Object.defineProperty,b5e=Object.getOwnPropertySymbols,ror=Object.prototype.hasOwnProperty,aor=Object.prototype.propertyIsEnumerable,m5e=(t,r,a)=>r in t?tor(t,r,{enumerable:!0,configurable:!0,writable:!0,value:a}):t[r]=a,nor=(t,r)=>{for(var a in r||(r={}))ror.call(r,a)&&m5e(t,a,r[a]);if(b5e)for(var a of b5e(r))aor.call(r,a)&&m5e(t,a,r[a]);return t},_5e=Bf(),vC=cn(),g5e=hr(),fJ=Ja(),{logger:ior}=Ti(),sor=1062,oor=1213,M5e=1451,cor=1452,A5e=ior.debugContext("sql:mariadb"),dJ=class extends _5e{constructor(r,a,n){super(r,a,nor({showWarnings:!1},n))}static formatBindParameters(r,a,n){let i=[],s=(o,c,u)=>{if(u[c]!==void 0)return i.push(u[c]),"?"};return r=_5e.formatBindParameters(r,a,n,s)[0],[r,i.length>0?i:void 0]}async run(r,a){this.sql=r;let{connection:n,options:i}=this,s=this.sequelize.options.showWarnings||i.showWarnings,o=this._logQuery(r,A5e,a);a&&A5e("parameters(%j)",a);let c,u=new Error;try{c=await n.query(this.sql,a)}catch(l){if(i.transaction&&l.errno===oor){try{await i.transaction.rollback()}catch{}i.transaction.finished="rollback"}throw l.sql=r,l.parameters=a,this.formatError(l,u.stack)}finally{o()}return s&&c&&c.warningStatus>0&&await this.logWarnings(c),this.formatResults(c)}formatResults(r){let a=this.instance;if(this.isBulkUpdateQuery()||this.isBulkDeleteQuery())return r.affectedRows;if(this.isUpsertQuery())return[a,r.affectedRows===1];if(this.isInsertQuery(r)&&(this.handleInsertQuery(r),!this.instance)){if(this.model&&this.model.autoIncrementAttribute&&this.model.autoIncrementAttribute===this.model.primaryKeyAttribute&&this.model.rawAttributes[this.model.primaryKeyAttribute]){let n=r[this.getInsertIdField()];a=new Array(r.affectedRows);let i=this.model.rawAttributes[this.model.primaryKeyAttribute].field;for(let s=0;s<r.affectedRows;s++)a[s]={[i]:n+s};return[a,r.affectedRows]}return[r[this.getInsertIdField()],r.affectedRows]}if(this.isSelectQuery())return this.handleJsonSelectQuery(r),this.handleSelectQuery(r);if(this.isInsertQuery()||this.isUpdateQuery())return[a,r.affectedRows];if(this.isCallQuery())return r[0];if(this.isRawQuery()){let n=r.meta;return delete r.meta,[r,n]}if(this.isShowIndexesQuery())return this.handleShowIndexesQuery(r);if(this.isForeignKeysQuery()||this.isShowConstraintsQuery())return r;if(this.isShowTablesQuery())return this.handleShowTablesQuery(r);if(this.isDescribeQuery()){a={};for(let n of r)a[n.Field]={type:n.Type.toLowerCase().startsWith("enum")?n.Type.replace(/^enum/i,"ENUM"):n.Type.toUpperCase(),allowNull:n.Null==="YES",defaultValue:n.Default,primaryKey:n.Key==="PRI",autoIncrement:Object.prototype.hasOwnProperty.call(n,"Extra")&&n.Extra.toLowerCase()==="auto_increment",comment:n.Comment?n.Comment:null};return a}return this.isVersionQuery()?r[0].version:a}handleJsonSelectQuery(r){if(!(!this.model||!this.model.fieldRawAttributesMap))for(let a of Object.keys(this.model.fieldRawAttributesMap)){let n=this.model.fieldRawAttributesMap[a];n.type instanceof fJ.JSON&&(r=r.map(i=>(i[n.fieldName]&&typeof i[n.fieldName]=="string"&&!this.connection.info.hasMinVersion(10,5,2)&&(i[n.fieldName]=JSON.parse(i[n.fieldName])),fJ.JSON.parse?fJ.JSON.parse(n,this.sequelize.options,i[n.fieldName]):i)))}}async logWarnings(r){let a=await this.run("SHOW WARNINGS"),n=`MariaDB Warnings (${this.connection.uuid||"default"}): `,i=[];for(let s of a)if(!(s===void 0||typeof s[Symbol.iterator]!="function"))for(let o of s)if(Object.prototype.hasOwnProperty.call(o,"Message"))i.push(o.Message);else for(let c of o.keys())i.push([c,o[c]].join(": "));return this.sequelize.log(n+i.join("; "),this.options),r}formatError(r,a){switch(r.errno){case sor:{let n=r.message.match(/Duplicate entry '([\s\S]*)' for key '?((.|\s)*?)'?\s.*$/),i={},s="Validation error",o=n?n[1].split("-"):void 0,c=n?n[2]:void 0,u=n?n[1]:void 0,l=this.model&&this.model.uniqueKeys[c];l?(l.msg&&(s=l.msg),i=g5e.zipObject(l.fields,o)):i[c]=u;let f=[];return g5e.forOwn(i,(d,h)=>{f.push(new vC.ValidationErrorItem(this.getUniqueConstraintErrorMessage(h),"unique violation",h,d,this.instance,"not_unique"))}),new vC.UniqueConstraintError({message:s,errors:f,parent:r,fields:i,stack:a})}case M5e:case cor:{let n=r.message.match(/CONSTRAINT ([`"])(.*)\1 FOREIGN KEY \(\1(.*)\1\) REFERENCES \1(.*)\1 \(\1(.*)\1\)/),i=n?n[1]:"`",s=n?n[3].split(new RegExp(`${i}, *${i}`)):void 0;return new vC.ForeignKeyConstraintError({reltype:r.errno===M5e?"parent":"child",table:n?n[4]:void 0,fields:s,value:s&&s.length&&this.instance&&this.instance[s[0]]||void 0,index:n?n[2]:void 0,parent:r,stack:a})}default:return new vC.DatabaseError(r,{stack:a})}}handleShowTablesQuery(r){return r.map(a=>({tableName:a.TABLE_NAME,schema:a.TABLE_SCHEMA}))}handleShowIndexesQuery(r){let a,n=[];return r.forEach(i=>{(!a||a.name!==i.Key_name)&&(a={primary:i.Key_name==="PRIMARY",fields:[],name:i.Key_name,tableName:i.Table,unique:i.Non_unique!==1,type:i.Index_type},n.push(a)),a.fields[i.Seq_in_index-1]={attribute:i.Column_name,length:i.Sub_part||void 0,order:i.Collation==="A"?"ASC":void 0}}),n}};O5e.exports=dJ});var v5e=A(($9a,w5e)=>{"use strict";var uor=Object.defineProperty,z5e=Object.getOwnPropertySymbols,lor=Object.prototype.hasOwnProperty,por=Object.prototype.propertyIsEnumerable,E5e=(t,r,a)=>r in t?uor(t,r,{enumerable:!0,configurable:!0,writable:!0,value:a}):t[r]=a,dor=(t,r)=>{for(var a in r||(r={}))lor.call(r,a)&&E5e(t,a,r[a]);if(z5e)for(var a of z5e(r))por.call(r,a)&&E5e(t,a,r[a]);return t},RC=hr(),sa=Ws(),hor=On(),bor={OperatorMap:{[sa.eq]:"=",[sa.ne]:"!=",[sa.gte]:">=",[sa.gt]:">",[sa.lte]:"<=",[sa.lt]:"<",[sa.not]:"IS NOT",[sa.is]:"IS",[sa.in]:"IN",[sa.notIn]:"NOT IN",[sa.like]:"LIKE",[sa.notLike]:"NOT LIKE",[sa.iLike]:"ILIKE",[sa.notILike]:"NOT ILIKE",[sa.startsWith]:"LIKE",[sa.endsWith]:"LIKE",[sa.substring]:"LIKE",[sa.regexp]:"~",[sa.notRegexp]:"!~",[sa.iRegexp]:"~*",[sa.notIRegexp]:"!~*",[sa.between]:"BETWEEN",[sa.notBetween]:"NOT BETWEEN",[sa.overlap]:"&&",[sa.contains]:"@>",[sa.contained]:"<@",[sa.adjacent]:"-|-",[sa.strictLeft]:"<<",[sa.strictRight]:">>",[sa.noExtendRight]:"&<",[sa.noExtendLeft]:"&>",[sa.any]:"ANY",[sa.all]:"ALL",[sa.and]:" AND ",[sa.or]:" OR ",[sa.col]:"COL",[sa.placeholder]:"$$PLACEHOLDER$$",[sa.match]:"@@"},OperatorsAliasMap:{},setOperatorsAliases(t){!t||RC.isEmpty(t)?this.OperatorsAliasMap=!1:this.OperatorsAliasMap=dor({},t)},_replaceAliases(t){let r={};return this.OperatorsAliasMap?(hor.getOperators(t).forEach(a=>{let n=t[a];RC.isPlainObject(n)?r[a]=this._replaceAliases(n):r[a]=n}),RC.forOwn(t,(a,n)=>{n=this.OperatorsAliasMap[n]||n,RC.isPlainObject(a)&&(a=this._replaceAliases(a)),r[n]=a}),r):t}};w5e.exports=bor});var T5e=A((Y9a,R5e)=>{"use strict";var mor=(JM(),gf(KM)).v4,_or={setIsolationLevelQuery(t,r){if(!r.parent)return`SET TRANSACTION ISOLATION LEVEL ${t};`},generateTransactionId(){return mor()},startTransactionQuery(t){return t.parent?`SAVEPOINT ${this.quoteIdentifier(t.name,!0)};`:"START TRANSACTION;"},deferConstraintsQuery(){},setConstraintQuery(){},setDeferredQuery(){},setImmediateQuery(){},commitTransactionQuery(t){if(!t.parent)return"COMMIT;"},rollbackTransactionQuery(t){return t.parent?`ROLLBACK TO SAVEPOINT ${this.quoteIdentifier(t.name,!0)};`:"ROLLBACK;"}};R5e.exports=_or});var xh=A((K9a,x5e)=>{"use strict";var gor=Object.defineProperty,Mor=Object.defineProperties,Aor=Object.getOwnPropertyDescriptors,q5e=Object.getOwnPropertySymbols,Oor=Object.prototype.hasOwnProperty,yor=Object.prototype.propertyIsEnumerable,N5e=(t,r,a)=>r in t?gor(t,r,{enumerable:!0,configurable:!0,writable:!0,value:a}):t[r]=a,A2=(t,r)=>{for(var a in r||(r={}))Oor.call(r,a)&&N5e(t,a,r[a]);if(q5e)for(var a of q5e(r))yor.call(r,a)&&N5e(t,a,r[a]);return t},TC=(t,r)=>Mor(t,Aor(r)),qC=require("util"),ra=hr(),zor=(JM(),gf(KM)).v4,Qt=On(),X9a=nA(),I5e=Cv(),lA=Ja(),Uu=vK(),pA=vh(),hJ=Rh(),Eor=tA(),wor=h2(),Rt=Ws(),bJ=cn(),S5e=LK(),dR=class{constructor(r){if(!r.sequelize)throw new Error("QueryGenerator initialized without options.sequelize");if(!r._dialect)throw new Error("QueryGenerator initialized without options._dialect");this.sequelize=r.sequelize,this.options=r.sequelize.options,this.dialect=r._dialect.name,this._dialect=r._dialect,this._initQuoteIdentifier()}extractTableDetails(r,a){return a=a||{},r=r||{},{schema:r.schema||a.schema||this.options.schema||"public",tableName:ra.isPlainObject(r)?r.tableName:r,delimiter:r.delimiter||a.delimiter||"."}}addSchema(r){if(!r._schema)return r.tableName||r;let a=this;return{tableName:r.tableName||r,table:r.tableName||r,name:r.name||r,schema:r._schema,delimiter:r._schemaDelimiter||".",toString(){return a.quoteTable(this)}}}dropSchema(r,a){return this.dropTableQuery(r,a)}describeTableQuery(r,a,n){return`DESCRIBE ${this.quoteTable(this.addSchema({tableName:r,_schema:a,_schemaDelimiter:n}))};`}dropTableQuery(r){return`DROP TABLE IF EXISTS ${this.quoteTable(r)};`}renameTableQuery(r,a){return`ALTER TABLE ${this.quoteTable(r)} RENAME TO ${this.quoteTable(a)};`}populateInsertQueryReturnIntoBinds(){}insertQuery(r,a,n,i){i=i||{},ra.defaults(i,this.options);let s={},o=i.bind||[],c=[],u=[],l=[],f=[],d=this.quoteTable(r),h=i.bindParam===void 0?this.bindParam(o):i.bindParam,b=[],m,g="",O="",z="",w="",v=!1,T="";if(n&&ra.each(n,(C,Q)=>{s[Q]=C,C.field&&(s[C.field]=C)}),this._dialect.supports["DEFAULT VALUES"]?O+=" DEFAULT VALUES":this._dialect.supports["VALUES ()"]&&(O+=" VALUES ()"),(this._dialect.supports.returnValues||this._dialect.supports.returnIntoValues)&&i.returning){let C=this.generateReturnValues(n,i);u.push(...C.returnFields),this._dialect.supports.returnIntoValues&&l.push(...C.returnTypes),w=C.returningFragment,T=C.tmpTable||"",z=C.outputFragment||""}(ra.get(this,["sequelize","options","dialectOptions","prependSearchPath"])||i.searchPath)&&(i.bindParam=!1),this._dialect.supports.EXCEPTION&&i.exception&&(i.bindParam=!1),a=Qt.removeNullValuesFromHash(a,this.options.omitNull);for(let C in a)if(Object.prototype.hasOwnProperty.call(a,C)){let Q=a[C];c.push(this.quoteIdentifier(C)),s&&s[C]&&s[C].autoIncrement===!0&&Q==null?this._dialect.supports.autoIncrement.defaultValue?this._dialect.supports.DEFAULT?f.push("DEFAULT"):f.push(this.escape(null)):c.splice(-1,1):(s&&s[C]&&s[C].autoIncrement===!0&&(v=!0),Q instanceof Qt.SequelizeMethod||i.bindParam===!1?f.push(this.escape(Q,s&&s[C]||void 0,{context:"INSERT"})):f.push(this.format(Q,s&&s[C]||void 0,{context:"INSERT"},h)))}let x="";if(!ra.isEmpty(i.conflictWhere)&&!this._dialect.supports.inserts.onConflictWhere)throw new Error("missing dialect support for conflictWhere option");if(this._dialect.supports.inserts.updateOnDuplicate&&i.updateOnDuplicate)if(this._dialect.supports.inserts.updateOnDuplicate==" ON CONFLICT DO UPDATE SET"){let C=i.upsertKeys.map(k=>this.quoteIdentifier(k)),Q=i.updateOnDuplicate.map(k=>`${this.quoteIdentifier(k)}=EXCLUDED.${this.quoteIdentifier(k)}`),X=["ON CONFLICT","(",C.join(","),")"];ra.isEmpty(i.conflictWhere)||X.push(this.whereQuery(i.conflictWhere,i)),ra.isEmpty(Q)?X.push("DO NOTHING"):X.push("DO UPDATE SET",Q.join(",")),x=` ${Qt.joinSQLFragments(X)}`}else{let C=i.updateOnDuplicate.map(Q=>`${this.quoteIdentifier(Q)}=VALUES(${this.quoteIdentifier(Q)})`);if(ra.isEmpty(C)&&i.upsertKeys&&C.push(...i.upsertKeys.map(Q=>`${this.quoteIdentifier(Q)}=${this.quoteIdentifier(Q)}`)),ra.isEmpty(C))throw new Error("No update values found for ON DUPLICATE KEY UPDATE clause, and no identifier fields could be found to use instead.");x+=`${this._dialect.supports.inserts.updateOnDuplicate} ${C.join(",")}`}let L={ignoreDuplicates:i.ignoreDuplicates?this._dialect.supports.inserts.ignoreDuplicates:"",onConflictDoNothing:i.ignoreDuplicates?this._dialect.supports.inserts.onConflictDoNothing:"",attributes:c.join(","),output:z,values:f.join(","),tmpTable:T};if(g=`${T}INSERT${L.ignoreDuplicates} INTO ${d} (${L.attributes})${L.output} VALUES (${L.values})${x}${L.onConflictDoNothing}${g}`,O=`${T}INSERT${L.ignoreDuplicates} INTO ${d}${L.output}${x}${L.onConflictDoNothing}${O}`,this._dialect.supports.EXCEPTION&&i.exception){let C="DROP FUNCTION IF EXISTS pg_temp.testfunc()";u.length===0&&u.push("*");let Q=`$func_${zor().replace(/-/g,"")}$`,X=`SELECT (testfunc.response).${u.join(", (testfunc.response).")}, testfunc.sequelize_caught_exception FROM pg_temp.testfunc();`;i.exception="WHEN unique_violation THEN GET STACKED DIAGNOSTICS sequelize_caught_exception = PG_EXCEPTION_DETAIL;",g=`CREATE OR REPLACE FUNCTION pg_temp.testfunc(OUT response ${d}, OUT sequelize_caught_exception text) RETURNS RECORD AS ${Q} BEGIN ${g} RETURNING * INTO response; EXCEPTION ${i.exception} END ${Q} LANGUAGE plpgsql; ${X} ${C}`}else g+=w,O+=w;this._dialect.supports.returnIntoValues&&i.returning&&this.populateInsertQueryReturnIntoBinds(u,l,o.length,b,i),m=`${L.attributes.length?g:O}${b.join(",")};`,this._dialect.supports.finalTable&&(m=`SELECT * FROM FINAL TABLE(${L.attributes.length?g:O});`),v&&this._dialect.supports.autoIncrement.identityInsert&&(m=`SET IDENTITY_INSERT ${d} ON; ${m} SET IDENTITY_INSERT ${d} OFF;`);let P={query:m};return i.bindParam!==!1&&(P.bind=o),P}bulkInsertQuery(r,a,n,i){n=n||{},i=i||{};let s=[],o={},c=[],u="";for(let b of a)ra.forOwn(b,(m,g)=>{c.includes(g)||c.push(g),i[g]&&i[g].autoIncrement===!0&&(o[g]=!0)});for(let b of a){let m=c.map(g=>this._dialect.supports.bulkDefault&&o[g]===!0?b[g]!=null?b[g]:"DEFAULT":this.escape(b[g],i[g],{context:"INSERT"}));s.push(`(${m.join(",")})`)}if(this._dialect.supports.inserts.updateOnDuplicate&&n.updateOnDuplicate)if(this._dialect.supports.inserts.updateOnDuplicate==" ON CONFLICT DO UPDATE SET"){let b=n.upsertKeys.map(O=>this.quoteIdentifier(O)),m=n.updateOnDuplicate.map(O=>`${this.quoteIdentifier(O)}=EXCLUDED.${this.quoteIdentifier(O)}`),g=!1;if(n.conflictWhere){if(!this._dialect.supports.inserts.onConflictWhere)throw new Error(`conflictWhere not supported for dialect ${this._dialect.name}`);g=this.whereQuery(n.conflictWhere,n)}u=["ON CONFLICT","(",b.join(","),")",g,"DO UPDATE SET",m.join(",")]}else{if(n.conflictWhere)throw new Error(`conflictWhere not supported for dialect ${this._dialect.name}`);let b=n.updateOnDuplicate.map(m=>`${this.quoteIdentifier(m)}=VALUES(${this.quoteIdentifier(m)})`);u=`${this._dialect.supports.inserts.updateOnDuplicate} ${b.join(",")}`}let l=n.ignoreDuplicates?this._dialect.supports.inserts.ignoreDuplicates:"",f=c.map(b=>this.quoteIdentifier(b)).join(","),d=n.ignoreDuplicates?this._dialect.supports.inserts.onConflictDoNothing:"",h="";if(this._dialect.supports.returnValues&&n.returning){let b=this.generateReturnValues(i,n);h+=b.returningFragment}return Qt.joinSQLFragments(["INSERT",l,"INTO",this.quoteTable(r),`(${f})`,"VALUES",s.join(","),u,d,h,";"])}updateQuery(r,a,n,i,s){i=i||{},ra.defaults(i,this.options),a=Qt.removeNullValuesFromHash(a,i.omitNull,i);let o=[],c=[],u={},l="",f="",d="";(ra.get(this,["sequelize","options","dialectOptions","prependSearchPath"])||i.searchPath)&&(i.bindParam=!1);let h=i.bindParam===void 0?this.bindParam(c):i.bindParam;if(this._dialect.supports["LIMIT ON UPDATE"]&&i.limit&&(["mssql","db2","oracle"].includes(this.dialect)?this.dialect==="oracle"&&(n&&(n.length&&n.length>0||Object.keys(n).length>0)?d+=" AND ":d+=" WHERE ",d+=`rownum <= ${this.escape(i.limit)} `):d=` LIMIT ${this.escape(i.limit)} `),this._dialect.supports.returnValues&&i.returning){let O=this.generateReturnValues(s,i);d+=O.returningFragment,f=O.tmpTable||"",l=O.outputFragment||"",!this._dialect.supports.returnValues.output&&i.returning&&(i.mapToModel=!0)}s&&ra.each(s,(O,z)=>{u[z]=O,O.field&&(u[O.field]=O)});for(let O in a){if(u&&u[O]&&u[O].autoIncrement===!0&&!this._dialect.supports.autoIncrement.update)continue;let z=a[O];z instanceof Qt.SequelizeMethod||i.bindParam===!1?o.push(`${this.quoteIdentifier(O)}=${this.escape(z,u&&u[O]||void 0,{context:"UPDATE"})}`):o.push(`${this.quoteIdentifier(O)}=${this.format(z,u&&u[O]||void 0,{context:"UPDATE"},h)}`)}let b=TC(A2({},i),{bindParam:h});if(o.length===0)return"";let g={query:`${f}UPDATE ${this.quoteTable(r)} SET ${o.join(",")}${l} ${this.whereQuery(n,b)}${d}`.trim()};return i.bindParam!==!1&&(g.bind=c),g}arithmeticQuery(r,a,n,i,s,o){o=o||{},ra.defaults(o,{returning:!0}),s=Qt.removeNullValuesFromHash(s,this.options.omitNull);let c="",u="";if(this._dialect.supports.returnValues&&o.returning){let f=this.generateReturnValues(null,o);c=f.outputFragment,u=f.returningFragment}let l=[];for(let f in i){let d=i[f],h=this.quoteIdentifier(f),b=this.escape(d);l.push(`${h}=${h}${r} ${b}`)}for(let f in s){let d=s[f],h=this.quoteIdentifier(f),b=this.escape(d);l.push(`${h}=${b}`)}return Qt.joinSQLFragments(["UPDATE",this.quoteTable(a),"SET",l.join(","),c,this.whereQuery(n),u])}addIndexQuery(r,a,n,i){n=n||{},Array.isArray(a)?n.fields=a:(n=a,a=void 0),n.prefix=n.prefix||i||r,n.prefix&&typeof n.prefix=="string"&&(n.prefix=n.prefix.replace(/\./g,"_"),n.prefix=n.prefix.replace(/("|')/g,""));let s=n.fields.map(u=>{if(u instanceof Qt.SequelizeMethod)return this.handleSequelizeMethod(u);typeof u=="string"&&(u={name:u});let l="";if(u.attribute&&(u.name=u.attribute),!u.name)throw new Error(`The following index field has no name: ${qC.inspect(u)}`);if(l+=this.quoteIdentifier(u.name),this._dialect.supports.index.collate&&u.collate&&(l+=` COLLATE ${this.quoteIdentifier(u.collate)}`),this._dialect.supports.index.operator){let f=u.operator||n.operator;f&&(l+=` ${f}`)}return this._dialect.supports.index.length&&u.length&&(l+=`(${u.length})`),u.order&&(l+=` ${u.order}`),l});n.name||(n=Qt.nameIndex(n,n.prefix)),n=Uu._conformIndex(n),this._dialect.supports.index.type||delete n.type,n.where&&(n.where=this.whereQuery(n.where)),typeof r=="string"?r=this.quoteIdentifiers(r):r=this.quoteTable(r);let o=this._dialect.supports.index.concurrently&&n.concurrently?"CONCURRENTLY":void 0,c;return this._dialect.supports.indexViaAlter?c=["ALTER TABLE",r,o,"ADD"]:c=["CREATE"],c=c.concat(n.unique?"UNIQUE":"",n.type,"INDEX",this._dialect.supports.indexViaAlter?void 0:o,this.quoteIdentifiers(n.name),this._dialect.supports.index.using===1&&n.using?`USING ${n.using}`:"",this._dialect.supports.indexViaAlter?void 0:`ON ${r}`,this._dialect.supports.index.using===2&&n.using?`USING ${n.using}`:"",`(${s.join(", ")})`,this._dialect.supports.index.parser&&n.parser?`WITH PARSER ${n.parser}`:void 0,this._dialect.supports.index.where&&n.where?n.where:void 0),ra.compact(c).join(" ")}addConstraintQuery(r,a){return typeof r=="string"?r=this.quoteIdentifiers(r):r=this.quoteTable(r),Qt.joinSQLFragments(["ALTER TABLE",r,"ADD",this.getConstraintSnippet(r,a||{}),";"])}getConstraintSnippet(r,a){let n,i,s=a.fields.map(u=>{if(typeof u=="string")return this.quoteIdentifier(u);if(u instanceof Qt.SequelizeMethod)return this.handleSequelizeMethod(u);if(u.attribute&&(u.name=u.attribute),!u.name)throw new Error(`The following index field has no name: ${u}`);return this.quoteIdentifier(u.name)}),o=s.join(", "),c=s.join("_");switch(a.type.toUpperCase()){case"UNIQUE":i=this.quoteIdentifier(a.name||`${r}_${c}_uk`),n=`CONSTRAINT ${i} UNIQUE (${o})`;break;case"CHECK":a.where=this.whereItemsQuery(a.where),i=this.quoteIdentifier(a.name||`${r}_${c}_ck`),n=`CONSTRAINT ${i} CHECK (${a.where})`;break;case"DEFAULT":if(a.defaultValue===void 0)throw new Error("Default value must be specified for DEFAULT CONSTRAINT");if(this._dialect.name!=="mssql")throw new Error("Default constraints are supported only for MSSQL dialect.");i=this.quoteIdentifier(a.name||`${r}_${c}_df`),n=`CONSTRAINT ${i} DEFAULT (${this.escape(a.defaultValue)}) FOR ${s[0]}`;break;case"PRIMARY KEY":i=this.quoteIdentifier(a.name||`${r}_${c}_pk`),n=`CONSTRAINT ${i} PRIMARY KEY (${o})`;break;case"FOREIGN KEY":let u=a.references;if(!u||!u.table||!(u.field||u.fields))throw new Error("references object with table and field must be specified");i=this.quoteIdentifier(a.name||`${r}_${c}_${u.table}_fk`);let l=typeof u.field<"u"?this.quoteIdentifier(u.field):u.fields.map(d=>this.quoteIdentifier(d)).join(", "),f=`${this.quoteTable(u.table)} (${l})`;n=`CONSTRAINT ${i} `,n+=`FOREIGN KEY (${o}) REFERENCES ${f}`,a.onUpdate&&(n+=` ON UPDATE ${a.onUpdate.toUpperCase()}`),a.onDelete&&(n+=` ON DELETE ${a.onDelete.toUpperCase()}`);break;default:throw new Error(`${a.type} is invalid.`)}return a.deferrable&&["UNIQUE","PRIMARY KEY","FOREIGN KEY"].includes(a.type.toUpperCase())&&(n+=` ${this.deferConstraintsQuery(a)}`),n}removeConstraintQuery(r,a){return typeof r=="string"?r=this.quoteIdentifiers(r):r=this.quoteTable(r),Qt.joinSQLFragments(["ALTER TABLE",r,"DROP CONSTRAINT",this.quoteIdentifiers(a)])}quote(r,a,n){let i=["ASC","DESC","ASC NULLS LAST","DESC NULLS LAST","ASC NULLS FIRST","DESC NULLS FIRST","NULLS FIRST","NULLS LAST"];if(n=n||".",typeof r=="string")return this.quoteIdentifiers(r);if(Array.isArray(r)){r.forEach((f,d)=>{let h=r[d-1],b,m;if(!h&&a!==void 0?m=a:h&&h instanceof pA&&(b=h,m=h.target),m&&m.prototype instanceof Uu){let g,O;if(typeof f=="function"&&f.prototype instanceof Uu?g=f:ra.isPlainObject(f)&&f.model&&f.model.prototype instanceof Uu&&(g=f.model,O=f.as),g&&(!O&&b&&b instanceof pA&&b.through&&b.through.model===g?f=new pA(m,g,{as:g.name}):(f=m.getAssociationForAlias(g,O),f||(f=m.getAssociationForAlias(g,g.name))),!(f instanceof pA)))throw new Error(qC.format("Unable to find a valid association for model, '%s'",g.name))}if(typeof f=="string"){let g=i.indexOf(f.toUpperCase());if(d>0&&g!==-1)f=this.sequelize.literal(` ${i[g]}`);else if(m&&m.prototype instanceof Uu){if(m.associations!==void 0&&m.associations[f])f=m.associations[f];else if(m.rawAttributes!==void 0&&m.rawAttributes[f]&&f!==m.rawAttributes[f].field)f=m.rawAttributes[f].field;else if(f.includes(".")&&m.rawAttributes!==void 0){let O=f.split(".");if(m.rawAttributes[O[0]].type instanceof lA.JSON){let z=this.quoteIdentifiers(`${m.name}.${m.rawAttributes[O[0]].field}`),w=O.slice(1);f=this.jsonPathExtractionQuery(z,w),f=this.sequelize.literal(f)}}}}r[d]=f},this);let s=r.length,o=[],c,u=0;for(u=0;u<s-1&&(c=r[u],!(typeof c=="string"||c._modelAttribute||c instanceof Qt.SequelizeMethod));u++)c instanceof pA&&(o[u]=c.as);let l="";return u>0?l+=`${this.quoteIdentifier(o.join(n))}.`:typeof r[0]=="string"&&a&&(l+=`${this.quoteIdentifier(a.name)}.`),r.slice(u).forEach(f=>{l+=this.quote(f,a,n)},this),l}if(r._modelAttribute)return`${this.quoteTable(r.Model.name)}.${this.quoteIdentifier(r.fieldName)}`;if(r instanceof Qt.SequelizeMethod)return this.handleSequelizeMethod(r);throw ra.isPlainObject(r)&&r.raw?new Error('The `{raw: "..."}` syntax is no longer supported.  Use `sequelize.literal` instead.'):new Error(`Unknown structure passed to order / group: ${qC.inspect(r)}`)}_initQuoteIdentifier(){this._quoteIdentifier=this.quoteIdentifier,this.quoteIdentifier=function(r,a){return r==="*"?r:this._quoteIdentifier(r,a)}}quoteIdentifier(r,a){throw new Error(`quoteIdentifier for Dialect "${this.dialect}" is not implemented`)}quoteIdentifiers(r){if(r.includes(".")){r=r.split(".");let a=r.slice(0,r.length-1).join("->"),n=r[r.length-1];return`${this.quoteIdentifier(a)}.${this.quoteIdentifier(n)}`}return this.quoteIdentifier(r)}quoteAttribute(r,a){return a&&r in a.rawAttributes?this.quoteIdentifier(r):this.quoteIdentifiers(r)}getAliasToken(){return"AS"}quoteTable(r,a){let n="";return a===!0&&(a=r.as||r.name||r),ra.isObject(r)?this._dialect.supports.schemas?(r.schema&&(n+=`${this.quoteIdentifier(r.schema)}.`),n+=this.quoteIdentifier(r.tableName)):(r.schema&&(n+=r.schema+(r.delimiter||".")),n+=r.tableName,n=this.quoteIdentifier(n)):n=this.quoteIdentifier(r),a&&(n+=` ${this.getAliasToken()} ${this.quoteIdentifier(a)}`),n}escape(r,a,n){if(n=n||{},r!=null){if(r instanceof Qt.SequelizeMethod)return this.handleSequelizeMethod(r);if(a&&a.type&&(a.type instanceof lA.STRING&&["mysql","mariadb"].includes(this.dialect)&&["number","boolean"].includes(typeof r)&&(r=String(Number(r))),this.validate(r,a,n),a.type.stringify)){let i=s=>I5e.escape(s,this.options.timezone,this.dialect);if(r=a.type.stringify(r,{escape:i,field:a,timezone:this.options.timezone,operation:n.operation}),a.type.escape===!1)return r}}return I5e.escape(r,this.options.timezone,this.dialect)}bindParam(r){return a=>(r.push(a),`$${r.length}`)}format(r,a,n,i){if(n=n||{},r!=null){if(r instanceof Qt.SequelizeMethod)throw new Error("Cannot pass SequelizeMethod as a bind parameter - use escape instead");if(a&&a.type&&(this.validate(r,a,n),a.type.bindParam))return a.type.bindParam(r,{escape:ra.identity,field:a,timezone:this.options.timezone,operation:n.operation,bindParam:i})}return i(r)}validate(r,a,n){if(this.typeValidation&&a.type.validate&&r)try{if(n.isList&&Array.isArray(r))for(let i of r)a.type.validate(i,n);else a.type.validate(r,n)}catch(i){throw i instanceof bJ.ValidationError&&i.errors.push(new bJ.ValidationErrorItem(i.message,"Validation error",a.fieldName,r,null,`${a.type.key} validator`)),i}}isIdentifierQuoted(r){return/^\s*(?:([`"'])(?:(?!\1).|\1{2})*\1\.?)+\s*$/i.test(r)}jsonPathExtractionQuery(r,a,n){let i=ra.toPath(a),s,o=this.isIdentifierQuoted(r)?r:this.quoteIdentifier(r);switch(this.dialect){case"mysql":case"mariadb":case"sqlite":return this.dialect==="mysql"&&(i=i.map(u=>/\D/.test(u)?Qt.addTicks(u,'"'):u)),s=this.escape(["$"].concat(i).join(".").replace(/\.(\d+)(?:(?=\.)|$)/g,(u,l)=>`[${l}]`)),this.dialect==="sqlite"?`json_extract(${o},${s})`:`json_unquote(json_extract(${o},${s}))`;case"postgres":let c=n?"#>":"#>>";return s=this.escape(`{${i.join(",")}}`),`(${o}${c}${s})`;default:throw new Error(`Unsupported ${this.dialect} for JSON operations`)}}selectQuery(r,a,n){a=a||{};let i=a.limit,s=[],o=[],c=a.subQuery===void 0?i&&a.hasMultiAssociation:a.subQuery,u={main:a.attributes&&a.attributes.slice(),subQuery:null},l={name:r,quotedName:null,as:null,model:n},f={names:l,options:a,subQuery:c},d=[],h=[],b;if(this.options.minifyAliases&&!a.aliasesMapping&&(a.aliasesMapping=new Map,a.aliasesByTable={},a.includeAliases=new Map),a.tableAs?l.as=this.quoteIdentifier(a.tableAs):!Array.isArray(l.name)&&l.model&&(l.as=this.quoteIdentifier(l.model.name)),l.quotedName=Array.isArray(l.name)?r.map(g=>Array.isArray(g)?this.quoteTable(g[0],g[1]):this.quoteTable(g,!0)).join(", "):this.quoteTable(l.name),c&&u.main)for(let g of l.model.primaryKeyAttributes)u.main.some(O=>g===O||g===O[0]||g===O[1])||u.main.push(l.model.rawAttributes[g].field?[g,l.model.rawAttributes[g].field]:g);if(u.main=this.escapeAttributes(u.main,a,l.as),u.main=u.main||(a.include?[`${l.as}.*`]:["*"]),(c||a.groupedLimit)&&(u.subQuery=u.main,u.main=[`${l.as||l.quotedName}.*`]),a.include)for(let g of a.include){if(g.separate)continue;let O=this.generateInclude(g,{externalAs:l.as,internalAs:l.as},f);h=h.concat(O.subQuery),d=d.concat(O.mainQuery),O.attributes.main.length>0&&(u.main=ra.uniq(u.main.concat(O.attributes.main))),O.attributes.subQuery.length>0&&(u.subQuery=ra.uniq(u.subQuery.concat(O.attributes.subQuery)))}if(c)o.push(this.selectFromTableFragment(a,l.model,u.subQuery,l.quotedName,l.as)),o.push(h.join(""));else{if(a.groupedLimit){l.as||(l.as=l.quotedName);let g=A2({},a.where),O,z,w,v=l.as;if(typeof a.groupedLimit.on=="string"?z=a.groupedLimit.on:a.groupedLimit.on instanceof wor&&(z=a.groupedLimit.on.foreignKeyField),a.groupedLimit.on instanceof Eor){v=a.groupedLimit.on.manyFromSource.as;let P=Uu._validateIncludedElements({include:[{association:a.groupedLimit.on.manyFromSource,duplicating:!1,required:!0,where:A2({[Rt.placeholder]:!0},a.groupedLimit.through&&a.groupedLimit.through.where)}],model:n});a.hasJoin=!0,a.hasMultiAssociation=!0,a.includeMap=Object.assign(P.includeMap,a.includeMap),a.includeNames=P.includeNames.concat(a.includeNames||[]),w=P.include,Array.isArray(a.order)&&(a.order.forEach((C,Q)=>{Array.isArray(C)&&(C=C[0]);let X=`subquery_order_${Q}`;a.attributes.push([C,X]),X=this.sequelize.literal(this.quote(X)),Array.isArray(a.order[Q])?a.order[Q][0]=X:a.order[Q]=X}),O=a.order)}else O=a.order,this._dialect.supports.topLevelOrderByRequired||delete a.order,g[Rt.placeholder]=!0;let T=`SELECT * FROM (${this.selectQuery(r,{attributes:a.attributes,offset:a.offset,limit:a.groupedLimit.limit,order:O,aliasesMapping:a.aliasesMapping,aliasesByTable:a.aliasesByTable,where:g,include:w,model:n},n).replace(/;$/,"")}) ${this.getAliasToken()} sub`,x=this.whereItemQuery(Rt.placeholder,!0,{model:n}),L=T.indexOf(x);s.push(this.selectFromTableFragment(a,l.model,u.main,`(${a.groupedLimit.values.map(P=>{let C;return z&&(C={[z]:P}),w&&(C={[a.groupedLimit.on.foreignIdentifierField]:P}),Qt.spliceStr(T,L,x.length,this.getWhereConditions(C,v))}).join(this._dialect.supports["UNION ALL"]?" UNION ALL ":" UNION ")})`,l.as))}else s.push(this.selectFromTableFragment(a,l.model,u.main,l.quotedName,l.as));s.push(d.join(""))}if(Object.prototype.hasOwnProperty.call(a,"where")&&!a.groupedLimit&&(a.where=this.getWhereConditions(a.where,l.as||r,n,a),a.where&&(c?o.push(` WHERE ${a.where}`):(s.push(` WHERE ${a.where}`),s.forEach((g,O)=>{g.startsWith("SELECT")&&(s[O]=this.selectFromTableFragment(a,n,u.main,l.quotedName,l.as,a.where))})))),a.group&&(a.group=Array.isArray(a.group)?a.group.map(g=>this.aliasGrouping(g,n,l.as,a)).join(", "):this.aliasGrouping(a.group,n,l.as,a),c&&a.group?o.push(` GROUP BY ${a.group}`):a.group&&s.push(` GROUP BY ${a.group}`)),Object.prototype.hasOwnProperty.call(a,"having")&&(a.having=this.getWhereConditions(a.having,r,n,a,!1),a.having&&(c?o.push(` HAVING ${a.having}`):s.push(` HAVING ${a.having}`))),a.order){let g=this.getQueryOrders(a,n,c);g.mainQueryOrder.length&&s.push(` ORDER BY ${g.mainQueryOrder.join(", ")}`),g.subQueryOrder.length&&o.push(` ORDER BY ${g.subQueryOrder.join(", ")}`)}let m=this.addLimitAndOffset(a,l.model);if(m&&!a.groupedLimit&&(c?o.push(m):s.push(m)),c?(this._throwOnEmptyAttributes(u.main,{modelName:n&&n.name,as:l.as}),b=`SELECT ${u.main.join(", ")} FROM (${o.join("")}) ${this.getAliasToken()} ${l.as}${d.join("")}${s.join("")}`):b=s.join(""),a.lock&&this._dialect.supports.lock){let g=a.lock;typeof a.lock=="object"&&(g=a.lock.level),this._dialect.supports.lockKey&&["KEY SHARE","NO KEY UPDATE"].includes(g)?b+=` FOR ${g}`:g==="SHARE"?b+=` ${this._dialect.supports.forShare}`:b+=" FOR UPDATE",this._dialect.supports.lockOf&&a.lock.of&&a.lock.of.prototype instanceof Uu&&(b+=` OF ${this.quoteTable(a.lock.of.name)}`),this._dialect.supports.skipLocked&&a.skipLocked&&(b+=" SKIP LOCKED")}return`${b};`}aliasGrouping(r,a,n,i){let s=Array.isArray(r)?r[0]:r;return this.quote(this._getAliasForField(n,s,i)||s,a)}escapeAttributes(r,a,n){return r&&r.map(i=>{let s=!0;if(i instanceof Qt.SequelizeMethod)return this.handleSequelizeMethod(i);if(Array.isArray(i)){if(i.length!==2)throw new Error(`${JSON.stringify(i)} is not a valid attribute definition. Please use the following format: ['attribute definition', 'alias']`);if(i=i.slice(),i[0]instanceof Qt.SequelizeMethod)i[0]=this.handleSequelizeMethod(i[0]),s=!1;else if(this.options.attributeBehavior==="escape"||!i[0].includes("(")&&!i[0].includes(")"))i[0]=this.quoteIdentifier(i[0]);else if(this.options.attributeBehavior!=="unsafe-legacy")throw new Error(`Attributes cannot include parentheses in Sequelize 6:
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            

Error: Please install mysql2 package manually
    at t._loadDialectModule (/home/wiomgjqe/neduas.store/server.js:124:7832)
    at new t (/home/wiomgjqe/neduas.store/server.js:136:66644)
    at new O1 (/home/wiomgjqe/neduas.store/server.js:136:73185)
    at new t (/home/wiomgjqe/neduas.store/server.js:136:229204)
    at Object.<anonymous> (/home/wiomgjqe/neduas.store/server.js:3649:2755)
    at Module._compile (node:internal/modules/cjs/loader:1275:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1329:10)
    at Module.load (node:internal/modules/cjs/loader:1133:32)
    at Module._load (node:internal/modules/cjs/loader:972:12)
    at Module.require (node:internal/modules/cjs/loader:1157:19)

Node.js v19.9.0
/home/wiomgjqe/neduas.store/server.js:124
`}};MC.AggregateError=sJ});var n5e=A(AC=>{"use strict";Object.defineProperty(AC,"__esModule",{value:!0});AC.Deferred=void 0;var Tsr=iJ(),cJ=class{constructor(){this._promise=new Promise((r,a)=>{this._reject=a,this._resolve=r})}registerTimeout(r,a){this._timeout||(this._timeout=setTimeout(()=>{a(),this.reject(new Tsr.TimeoutError("Operation timeout"))},r))}_clearTimeout(){this._timeout&&clearTimeout(this._timeout)}resolve(r){this._clearTimeout(),this._resolve(r)}reject(r){this._clearTimeout(),this._reject(r)}promise(){return this._promise}};AC.Deferred=cJ});var i5e=A(OC=>{"use strict";Object.defineProperty(OC,"__esModule",{value:!0});OC.Pool=void 0;var qsr=n5e(),Nsr=oJ(),uJ=class{constructor(r){if(this.log=!1,!r.create)throw new Error("create function is required");if(!r.destroy)throw new Error("destroy function is required");if(!r.validate)throw new Error("validate function is required");if(typeof r.min!="number"||r.min<0||r.min!==Math.round(r.min))throw new Error("min must be an integer >= 0");if(typeof r.max!="number"||r.max<=0||r.max!==Math.round(r.max))throw new Error("max must be an integer > 0");if(r.min>r.max)throw new Error("max is smaller than min");if(r.maxUses!==void 0&&(typeof r.maxUses!="number"||r.maxUses<0))throw new Error("maxUses must be an integer >= 0");this.idleTimeoutMillis=r.idleTimeoutMillis||3e4,this.acquireTimeoutMillis=r.acquireTimeoutMillis||3e4,this.reapIntervalMillis=r.reapIntervalMillis||1e3,this.maxUsesPerResource=r.maxUses||1/0,this.log=r.log||!1,this._factory=r,this._count=0,this._draining=!1,this._pendingAcquires=[],this._inUseObjects=[],this._availableObjects=[],this._removeIdleScheduled=!1}get size(){return this._count}get name(){return this._factory.name}get available(){return this._availableObjects.length}get using(){return this._inUseObjects.length}get waiting(){return this._pendingAcquires.length}get maxSize(){return this._factory.max}get minSize(){return this._factory.min}_log(r,a){typeof this.log=="function"?this.log(r,a):this.log&&console.log(`${a.toUpperCase()} pool ${this.name||""} - ${r}`)}_removeIdle(){let r=[],a=Date.now(),n,i=this._availableObjects.length,s=this.size-this.minSize,o;for(this._removeIdleScheduled=!1,n=0;n<i&&s>r.length;n++)o=this._availableObjects[n].timeout,a>=o&&(this._log("removeIdle() destroying obj - now:"+a+" timeout:"+o,"verbose"),r.push(this._availableObjects[n].resource));r.forEach(this.destroy,this),i=this._availableObjects.length,i>0?(this._log("this._availableObjects.length="+i,"verbose"),this._scheduleRemoveIdle()):this._log("removeIdle() all objects removed","verbose")}_scheduleRemoveIdle(){this._removeIdleScheduled||(this._removeIdleScheduled=!0,this._removeIdleTimer=setTimeout(()=>{this._removeIdle()},this.reapIntervalMillis))}_dispense(){let r=null,a=this._pendingAcquires.length;if(this._log(`dispense() clients=${a} available=${this._availableObjects.length}`,"info"),!(a<1)){for(;this._availableObjects.length>0;){if(this._log("dispense() - reusing obj","verbose"),r=this._availableObjects[this._availableObjects.length-1],!this._factory.validate(r.resource)){this.destroy(r.resource);continue}return this._availableObjects.pop(),this._addResourceToInUseObjects(r.resource,r.useCount),this._pendingAcquires.shift().resolve(r.resource)}this.size<this.maxSize&&this._createResource()}}_createResource(){this._count+=1,this._log(`createResource() - creating obj - count=${this.size} min=${this.minSize} max=${this.maxSize}`,"verbose"),this._factory.create().then(r=>{let a=this._pendingAcquires.shift();a?(this._addResourceToInUseObjects(r,0),a.resolve(r)):this._addResourceToAvailableObjects(r,0)}).catch(r=>{let a=this._pendingAcquires.shift();this._count-=1,this._count<0&&(this._count=0),a&&a.reject(r),process.nextTick(()=>{this._dispense()})})}_addResourceToAvailableObjects(r,a){let n={resource:r,useCount:a,timeout:Date.now()+this.idleTimeoutMillis};this._availableObjects.push(n),this._dispense(),this._scheduleRemoveIdle()}_addResourceToInUseObjects(r,a){let n={resource:r,useCount:a};this._inUseObjects.push(n)}_ensureMinimum(){let r,a;if(!this._draining&&this.size<this.minSize)for(a=this.minSize-this.size,r=0;r<a;r++)this._createResource()}acquire(){if(this._draining)return Promise.reject(new Error("pool is draining and cannot accept work"));let r=new qsr.Deferred;return r.registerTimeout(this.acquireTimeoutMillis,()=>{this._pendingAcquires=this._pendingAcquires.filter(a=>a!==r)}),this._pendingAcquires.push(r),this._dispense(),r.promise()}release(r){if(this._availableObjects.some(i=>i.resource===r)){this._log("release called twice for the same resource: "+new Error().stack,"error");return}let a=this._inUseObjects.findIndex(i=>i.resource===r);if(a<0){this._log("attempt to release an invalid resource: "+new Error().stack,"error");return}let n=this._inUseObjects[a];n.useCount+=1,n.useCount>=this.maxUsesPerResource?(this._log("release() destroying obj - useCount:"+n.useCount+" maxUsesPerResource:"+this.maxUsesPerResource,"verbose"),this.destroy(n.resource),this._dispense()):(this._inUseObjects.splice(a,1),this._addResourceToAvailableObjects(n.resource,n.useCount))}async destroy(r){let a=this._availableObjects.length,n=this._inUseObjects.length;if(this._availableObjects=this._availableObjects.filter(i=>i.resource!==r),this._inUseObjects=this._inUseObjects.filter(i=>i.resource!==r),a===this._availableObjects.length&&n===this._inUseObjects.length){this._ensureMinimum();return}this._count-=1,this._count<0&&(this._count=0);try{await this._factory.destroy(r)}finally{this._ensureMinimum(),this._draining||process.nextTick(()=>{this._dispense()})}}drain(){this._log("draining","info"),this._draining=!0;let r=a=>{if(this._pendingAcquires.length>0){this._dispense(),setTimeout(()=>{r(a)},100);return}if(this._availableObjects.length!==this._count){setTimeout(()=>{r(a)},100);return}a()};return new Promise(a=>r(a))}async destroyAllNow(){this._log("force destroying all objects","info"),this._removeIdleScheduled=!1,clearTimeout(this._removeIdleTimer);let r=this._availableObjects.map(n=>n.resource),a=[];for(let n of r)try{await this.destroy(n)}catch(i){this._log("Error destroying resource: "+i.stack,"error"),a.push(i)}if(a.length>0)throw new Nsr.AggregateError(a)}};OC.Pool=uJ});var s5e=A(Nh=>{"use strict";Object.defineProperty(Nh,"__esModule",{value:!0});Nh.Pool=Nh.AggregateError=Nh.TimeoutError=void 0;var Isr=iJ();Object.defineProperty(Nh,"TimeoutError",{enumerable:!0,get:function(){return Isr.TimeoutError}});var Ssr=oJ();Object.defineProperty(Nh,"AggregateError",{enumerable:!0,get:function(){return Ssr.AggregateError}});var xsr=i5e();Object.defineProperty(Nh,"Pool",{enumerable:!0,get:function(){return xsr.Pool}})});var Df=A((j9a,yC)=>{"use strict";var{Pool:lJ,TimeoutError:ksr}=s5e(),Ih=hr(),pJ=qh(),Csr=cn(),{logger:Lsr}=Ti(),Dsr=nA(),Jl=Lsr.debugContext("pool"),uR=class{constructor(r,a){let n=Ih.cloneDeep(a.config);if(this.sequelize=a,this.config=n,this.dialect=r,this.versionPromise=null,this.dialectName=this.sequelize.options.dialect,n.pool===!1)throw new Error("Support for pool:false was removed in v4.0");n.pool=Ih.defaults(n.pool||{},{max:5,min:0,idle:1e4,acquire:6e4,evict:1e3,validate:this._validate.bind(this)}),this.initPools()}refreshTypeParser(r){Ih.each(r,a=>{if(Object.prototype.hasOwnProperty.call(a,"parse"))if(a.types[this.dialectName])this._refreshTypeParser(a);else throw new Error(`Parse function not supported for type ${a.key} in dialect ${this.dialectName}`)})}_loadDialectModule(r){try{return this.sequelize.config.dialectModulePath?require(this.sequelize.config.dialectModulePath):this.sequelize.config.dialectModule?this.sequelize.config.dialectModule:require(r)}catch(a){throw a.code==="MODULE_NOT_FOUND"?this.sequelize.config.dialectModulePath?new Error(`Unable to find dialect at ${this.sequelize.config.dialectModulePath}`):new Error(`Please install ${r} package manually`):a}}async _onProcessExit(){if(this.pool)return await this.pool.drain(),Jl("connection drain due to process exit"),await this.pool.destroyAllNow()}async close(){return this.getConnection=async function(){throw new Error("ConnectionManager.getConnection was called after the connection manager was closed!")},await this._onProcessExit()}initPools(){let r=this.config;if(!r.replication){this.pool=new lJ({name:"sequelize",create:()=>this._connect(r),destroy:async n=>{let i=await this._disconnect(n);return Jl("connection destroy"),i},validate:r.pool.validate,max:r.pool.max,min:r.pool.min,acquireTimeoutMillis:r.pool.acquire,idleTimeoutMillis:r.pool.idle,reapIntervalMillis:r.pool.evict,maxUses:r.pool.maxUses}),Jl(`pool created with max/min: ${r.pool.max}/${r.pool.min}, no replication`);return}Array.isArray(r.replication.read)||(r.replication.read=[r.replication.read]),r.replication.write=Ih.defaults(r.replication.write,Ih.omit(r,"replication")),r.replication.read=r.replication.read.map(n=>Ih.defaults(n,Ih.omit(this.config,"replication")));let a=0;this.pool={release:n=>{n.queryType==="read"?this.pool.read.release(n):this.pool.write.release(n)},acquire:(n,i)=>(i=i===void 0?!1:i,n==="SELECT"&&!i?this.pool.read.acquire():this.pool.write.acquire()),destroy:n=>{this.pool[n.queryType].destroy(n),Jl("connection destroy")},destroyAllNow:async()=>{await Promise.all([this.pool.read.destroyAllNow(),this.pool.write.destroyAllNow()]),Jl("all connections destroyed")},drain:async()=>Promise.all([this.pool.write.drain(),this.pool.read.drain()]),read:new lJ({name:"sequelize:read",create:async()=>{let n=a++%r.replication.read.length,i=await this._connect(r.replication.read[n]);return i.queryType="read",i},destroy:n=>this._disconnect(n),validate:r.pool.validate,max:r.pool.max,min:r.pool.min,acquireTimeoutMillis:r.pool.acquire,idleTimeoutMillis:r.pool.idle,reapIntervalMillis:r.pool.evict,maxUses:r.pool.maxUses}),write:new lJ({name:"sequelize:write",create:async()=>{let n=await this._connect(r.replication.write);return n.queryType="write",n},destroy:n=>this._disconnect(n),validate:r.pool.validate,max:r.pool.max,min:r.pool.min,acquireTimeoutMillis:r.pool.acquire,idleTimeoutMillis:r.pool.idle,reapIntervalMillis:r.pool.evict,maxUses:r.pool.maxUses})},Jl(`pool created with max/min: ${r.pool.max}/${r.pool.min}, with replication`)}async getConnection(r){r=r||{},this.sequelize.options.databaseVersion===0&&(this.versionPromise||(this.versionPromise=(async()=>{try{let n=await this._connect(this.config.replication.write||this.config),i={};if(i.transaction={connection:n},i.logging=()=>{},i.logging.__testLoggingFn=!0,this.sequelize.options.databaseVersion===0){let s=await this.sequelize.databaseVersion(i),o=Ih.get(pJ.coerce(s),"version")||s;this.sequelize.options.databaseVersion=pJ.valid(o)?o:this.dialect.defaultVersion}return pJ.lt(this.sequelize.options.databaseVersion,this.dialect.defaultVersion)&&(Dsr.unsupportedEngine(),Jl(`Unsupported database engine version ${this.sequelize.options.databaseVersion}`)),this.versionPromise=null,await this._disconnect(n)}catch(n){throw this.versionPromise=null,n}})()),await this.versionPromise);let a;try{await this.sequelize.runHooks("beforePoolAcquire",r),a=await this.pool.acquire(r.type,r.useMaster),await this.sequelize.runHooks("afterPoolAcquire",a,r)}catch(n){throw n instanceof ksr?new Csr.ConnectionAcquireTimeoutError(n):n}return Jl("connection acquired"),a}releaseConnection(r){this.pool.release(r),Jl("connection released")}async destroyConnection(r){await this.pool.destroy(r),Jl(`connection ${r.uuid} destroyed`)}async _connect(r){await this.sequelize.runHooks("beforeConnect",r);let a=await this.dialect.connectionManager.connect(r);return await this.sequelize.runHooks("afterConnect",a,r),a}async _disconnect(r){return await this.sequelize.runHooks("beforeDisconnect",r),await this.dialect.connectionManager.disconnect(r),this.sequelize.runHooks("afterDisconnect",r)}_validate(r){return this.dialect.connectionManager.validate?this.dialect.connectionManager.validate(r):!0}};yC.exports=uR;yC.exports.ConnectionManager=uR;yC.exports.default=uR});var Vc=A((G9a,o5e)=>{"use strict";var lR=new Map;o5e.exports=t=>(lR.has(t)||lR.set(t,new Map),{clear(){lR.get(t).clear()},refresh(r){for(let a of r.types[t])lR.get(t).set(a,r.parse)},get(r){return lR.get(t).get(r)}})});var p5e=A((Q9a,EC)=>{"use strict";var Bsr=Object.defineProperty,c5e=Object.getOwnPropertySymbols,Psr=Object.prototype.hasOwnProperty,Wsr=Object.prototype.propertyIsEnumerable,u5e=(t,r,a)=>r in t?Bsr(t,r,{enumerable:!0,configurable:!0,writable:!0,value:a}):t[r]=a,Usr=(t,r)=>{for(var a in r||(r={}))Psr.call(r,a)&&u5e(t,a,r[a]);if(c5e)for(var a of c5e(r))Wsr.call(r,a)&&u5e(t,a,r[a]);return t},Fsr=qh(),jsr=Df(),uA=cn(),{logger:Gsr}=Ti(),Qsr=Ja().mariadb,Hsr=Hl(),l5e=Gsr.debugContext("connection:mariadb"),zC=Vc()("mariadb"),pR=class t extends jsr{constructor(r,a){a.config.port=a.config.port||3306,super(r,a),this.lib=this._loadDialectModule("mariadb"),this.refreshTypeParser(Qsr)}static _typecast(r,a){return zC.get(r.type)?zC.get(r.type)(r,this.sequelize.options,a):a()}_refreshTypeParser(r){zC.refresh(r)}_clearTypeParser(){zC.clear()}async connect(r){let a=this.sequelize.options.timezone;a=/\//.test(a)?Hsr.tz(a).format("Z"):a;let n=Usr({host:r.host,port:r.port,user:r.username,password:r.password,database:r.database,timezone:a,typeCast:t._typecast.bind(this),bigNumberStrings:!1,supportBigNumbers:!0,foundRows:!1},r.dialectOptions);this.sequelize.config.keepDefaultTimezone||(n.initSql?(Array.isArray(n.initSql)||(n.initSql=[n.initSql]),n.initSql.push(`SET time_zone = '${a}'`)):n.initSql=`SET time_zone = '${a}'`);try{let i=await this.lib.createConnection(n);return this.sequelize.options.databaseVersion=Fsr.coerce(i.serverVersion()).version,l5e("connection acquired"),i.on("error",s=>{switch(s.code){case"ESOCKET":case"ECONNRESET":case"EPIPE":case"PROTOCOL_CONNECTION_LOST":this.pool.destroy(i)}}),i}catch(i){switch(i.code){case"ECONNREFUSED":throw new uA.ConnectionRefusedError(i);case"ER_ACCESS_DENIED_ERROR":case"ER_ACCESS_DENIED_NO_PASSWORD_ERROR":throw new uA.AccessDeniedError(i);case"ENOTFOUND":throw new uA.HostNotFoundError(i);case"EHOSTUNREACH":case"ENETUNREACH":case"EADDRNOTAVAIL":throw new uA.HostNotReachableError(i);case"EINVAL":throw new uA.InvalidConnectionError(i);default:throw new uA.ConnectionError(i)}}}async disconnect(r){if(!r.isValid()){l5e("connection tried to disconnect but was already at CLOSED state");return}return await r.end()}validate(r){return r&&r.isValid()}};EC.exports=pR;EC.exports.ConnectionManager=pR;EC.exports.default=pR});var Bf=A((H9a,wC)=>{"use strict";var Vsr=Object.defineProperty,f5e=Object.getOwnPropertySymbols,$sr=Object.prototype.hasOwnProperty,Ysr=Object.prototype.propertyIsEnumerable,d5e=(t,r,a)=>r in t?Vsr(t,r,{enumerable:!0,configurable:!0,writable:!0,value:a}):t[r]=a,Xsr=(t,r)=>{for(var a in r||(r={}))$sr.call(r,a)&&d5e(t,a,r[a]);if(f5e)for(var a of f5e(r))Ysr.call(r,a)&&d5e(t,a,r[a]);return t},Sh=hr(),Ksr=Cv(),rc=m1(),Jsr=Wv(),Zsr=nA(),eor=(JM(),gf(KM)).v4,{safeStringifyJson:h5e}=On(),fR=class t{constructor(r,a,n){this.uuid=eor(),this.connection=r,this.instance=n.instance,this.model=n.model,this.sequelize=a,this.options=Xsr({plain:!1,raw:!1,logging:console.log},n),this.checkLoggingOption(),n.rawErrors&&(this.formatError=t.prototype.formatError)}static formatBindParameters(r,a,n,i,s){if(!a)return[r,[]];if(s=s||{},typeof i!="function"&&(s=i||{},i=void 0),!i)s.skipValueReplace?i=(u,l,f)=>{if(f[l]!==void 0)return u}:i=(u,l,f,d,h)=>{if(f[l]!==void 0)return Ksr.escape(f[l],d,h)};else if(s.skipValueReplace){let u=i;i=(l,f,d,h,b,m)=>{if(u(l,f,d,h,b,m)!==void 0)return l}}let o=null,c=Array.isArray(a);return r=r.replace(/\B\$(\$|\w+)/g,(u,l)=>{if(l==="$")return s.skipUnescape?u:l;let f;if(c?l.match(/^[1-9]\d*$/)&&(l=l-1,f=i(u,l,a,o,n,s)):l.match(/^\d*$/)||(f=i(u,l,a,o,n,s)),f===void 0)throw new Error(`Named bind parameter "${u}" has no value in the given object.`);return f}),[r,[]]}formatError(r,a){return r.stack=a,r}run(){throw new Error("The run method wasn't overwritten!")}checkLoggingOption(){this.options.logging===!0&&(Zsr.noTrueLogging(),this.options.logging=console.log)}getInsertIdField(){return"insertId"}getUniqueConstraintErrorMessage(r){let a=r?`${r} must be unique`:"Must be unique";if(r&&this.model)for(let n of Object.keys(this.model.uniqueKeys))this.model.uniqueKeys[n].fields.includes(r.replace(/"/g,""))&&this.model.uniqueKeys[n].msg&&(a=this.model.uniqueKeys[n].msg);return a}isRawQuery(){return this.options.type===rc.RAW}isVersionQuery(){return this.options.type===rc.VERSION}isUpsertQuery(){return this.options.type===rc.UPSERT}isInsertQuery(r,a){let n=!0;return this.options.type===rc.INSERT?!0:(n=n&&this.sql.toLowerCase().startsWith("insert into"),n=n&&(!r||Object.prototype.hasOwnProperty.call(r,this.getInsertIdField())),n=n&&(!a||Object.prototype.hasOwnProperty.call(a,this.getInsertIdField())),n)}handleInsertQuery(r,a){if(this.instance){let n=this.model.autoIncrementAttribute,i=null;i=i||r&&r[this.getInsertIdField()],i=i||a&&a[this.getInsertIdField()],this.instance[n]=i}}isShowTablesQuery(){return this.options.type===rc.SHOWTABLES}handleShowTablesQuery(r){return Sh.flatten(r.map(a=>Object.values(a)))}isShowIndexesQuery(){return this.options.type===rc.SHOWINDEXES}isShowConstraintsQuery(){return this.options.type===rc.SHOWCONSTRAINTS}isDescribeQuery(){return this.options.type===rc.DESCRIBE}isSelectQuery(){return this.options.type===rc.SELECT}isBulkUpdateQuery(){return this.options.type===rc.BULKUPDATE}isBulkDeleteQuery(){return this.options.type===rc.BULKDELETE}isForeignKeysQuery(){return this.options.type===rc.FOREIGNKEYS}isUpdateQuery(){return this.options.type===rc.UPDATE}handleSelectQuery(r){let a=null;if(this.options.fieldMap){let n=this.options.fieldMap;r=r.map(i=>Sh.reduce(n,(s,o,c)=>(s[c]!==void 0&&o!==c&&(s[o]=s[c],delete s[c]),s),i))}return this.options.raw?a=r.map(n=>{let i={};for(let s in n)Object.prototype.hasOwnProperty.call(n,s)&&(i[s]=n[s]);return this.options.nest&&(i=Jsr.transform(i)),i}):this.options.hasJoin===!0?(r=t._groupJoinData(r,{model:this.model,includeMap:this.options.includeMap,includeNames:this.options.includeNames},{checkExisting:this.options.hasMultiAssociation}),a=this.model.bulkBuild(r,{isNewRecord:!1,include:this.options.include,includeNames:this.options.includeNames,includeMap:this.options.includeMap,includeValidated:!0,attributes:this.options.originalAttributes||this.options.attributes,raw:!0})):a=this.model.bulkBuild(r,{isNewRecord:!1,raw:!0,attributes:this.options.originalAttributes||this.options.attributes}),this.options.plain&&(a=a.length===0?null:a[0]),a}isShowOrDescribeQuery(){let r=!1;return r=r||this.sql.toLowerCase().startsWith("show"),r=r||this.sql.toLowerCase().startsWith("describe"),r}isCallQuery(){return this.sql.toLowerCase().startsWith("call")}_logQuery(r,a,n){let{connection:i,options:s}=this,o=this.sequelize.options.benchmark||s.benchmark,c=this.sequelize.options.logQueryParameters||s.logQueryParameters,u=Date.now(),l="";if(c&&n){let h=r.endsWith(";")?"":";",b;Array.isArray(n)?b=n.map(m=>h5e(m)).join(", "):b=h5e(n),l=`${h} ${b}`}let f=`(${i.uuid||"default"}): ${r}${l}`,d=`Executing ${f}`;return a(d),o||this.sequelize.log(`Executing ${f}`,s),()=>{let h=`Executed ${f}`;a(h),o&&this.sequelize.log(h,Date.now()-u,s)}}static _groupJoinData(r,a,n){if(!r.length)return[];let i,s,o,c,u,l,f=r.length,d,h,b,m,g,O,z,w,v=n.checkExisting,T,x,L,P=v?[]:new Array(f),C={},Q={},X,k,se,F,D,j,V,he,oe=ne=>{Object.prototype.hasOwnProperty.call(j.includeMap,ne)&&(Q[h]=j=j.includeMap[ne],he?he=`${he}.${ne}`:he=ne,Q[he]=j)},ie={},De=(ne,we)=>(Object.prototype.hasOwnProperty.call(we,ne)||(we[ne]=ne.substr(0,ne.lastIndexOf("."))),we[ne]),Ge={},Ze=ne=>{if(!Object.prototype.hasOwnProperty.call(Ge,ne)){let we=ne.lastIndexOf(".");Ge[ne]=ne.substr(we===-1?0:we+1)}return Ge[ne]},te={},me=ne=>{if(!Object.prototype.hasOwnProperty.call(te,ne)){let we=De(ne,ie);Object.prototype.hasOwnProperty.call(te,we)||(te[we]=we?we.split("."):[]),te[ne]=te[we]}return te[ne]},ve={},ye=ne=>{if(!Object.prototype.hasOwnProperty.call(ve,ne)){let we=me(ne),ke=we.length;ve[ne]=ke?we[ke-1]:""}return ve[ne]},Qe=ne=>{let we=Sh.chain(ne.uniqueKeys);return we=we.result(`${we.findKey()}.fields`).map(ke=>Sh.findKey(ne.attributes,je=>je.field===ke)).value(),we},Ke=ne=>ne instanceof Buffer?ne.toString("hex"):ne,Se,ft,qe;for(u=0;u<f;u++){if(l=r[u],u===0&&(d=Sh.sortBy(Object.keys(l),ne=>[ne.split(".").length]),m=d.length),v){if(w=!1,c=a.model.primaryKeyAttributes.length,L="",c===1)L=Ke(l[a.model.primaryKeyAttributes[0]]);else if(c>1)for(o=0;o<c;o++)L+=Ke(l[a.model.primaryKeyAttributes[o]]);else if(!Sh.isEmpty(a.model.uniqueKeys))for(ft=Qe(a.model),o=0;o<ft.length;o++)L+=l[ft[o]]}for(z=O={},F=void 0,b=0;b<m;b++){if(h=d[b],k=De(h,ie),X=me(h),u===0&&!Object.prototype.hasOwnProperty.call(Q,h)&&(X.length?(j=a,he=void 0,X.forEach(oe)):Q[h]=Q[""]=a),F!==void 0&&F!==X){if(v){if(s=F.length,V=null,x=null,s)for(i=0;i<s;i++){if(qe=V?`${V}.${F[i]}`:F[i],Se=Q[qe].model.primaryKeyAttributes,c=Se.length,T=qe,c===1)T+=Ke(l[`${qe}.${Se[0]}`]);else if(c>1)for(o=0;o<c;o++)T+=Ke(l[`${qe}.${Se[o]}`]);else if(!Sh.isEmpty(Q[qe].model.uniqueKeys))for(ft=Qe(Q[qe].model),o=0;o<ft.length;o++)T+=l[`${qe}.${ft[o]}`];x||(x=L),T=x+T,V=qe,i<s-1&&(x=T)}else T=L;T===L?C[T]?w=!0:C[T]=O:C[T]||(V=C[x],D=ye(g),Q[g].association.isSingleAssociation?V&&(V[D]=C[T]=O):(V[D]||(V[D]=[]),V[D].push(C[T]=O))),O={}}else if(j=z,s=X.length,s)for(i=0;i<s;i++)i===s-1&&(O=j[X[i]]={}),j=j[X[i]]||{}}O[Ze(h)]=l[h],g=h,F=X,se=k}if(v){if(s=F.length,V=null,x=null,s)for(i=0;i<s;i++){if(qe=V?`${V}.${F[i]}`:F[i],Se=Q[qe].model.primaryKeyAttributes,c=Se.length,T=qe,c===1)T+=Ke(l[`${qe}.${Se[0]}`]);else if(c>0)for(o=0;o<c;o++)T+=Ke(l[`${qe}.${Se[o]}`]);else if(!Sh.isEmpty(Q[qe].model.uniqueKeys))for(ft=Qe(Q[qe].model),o=0;o<ft.length;o++)T+=l[`${qe}.${ft[o]}`];x||(x=L),T=x+T,V=qe,i<s-1&&(x=T)}else T=L;T===L?C[T]?w=!0:C[T]=O:C[T]||(V=C[x],D=ye(g),Q[g].association.isSingleAssociation?V&&(V[D]=C[T]=O):(V[D]||(V[D]=[]),V[D].push(C[T]=O))),w||P.push(z)}else P[u]=z}return P}};wC.exports=fR;wC.exports.AbstractQuery=fR;wC.exports.default=fR});var y5e=A((V9a,O5e)=>{"use strict";var tor=Object.defineProperty,b5e=Object.getOwnPropertySymbols,ror=Object.prototype.hasOwnProperty,aor=Object.prototype.propertyIsEnumerable,m5e=(t,r,a)=>r in t?tor(t,r,{enumerable:!0,configurable:!0,writable:!0,value:a}):t[r]=a,nor=(t,r)=>{for(var a in r||(r={}))ror.call(r,a)&&m5e(t,a,r[a]);if(b5e)for(var a of b5e(r))aor.call(r,a)&&m5e(t,a,r[a]);return t},_5e=Bf(),vC=cn(),g5e=hr(),fJ=Ja(),{logger:ior}=Ti(),sor=1062,oor=1213,M5e=1451,cor=1452,A5e=ior.debugContext("sql:mariadb"),dJ=class extends _5e{constructor(r,a,n){super(r,a,nor({showWarnings:!1},n))}static formatBindParameters(r,a,n){let i=[],s=(o,c,u)=>{if(u[c]!==void 0)return i.push(u[c]),"?"};return r=_5e.formatBindParameters(r,a,n,s)[0],[r,i.length>0?i:void 0]}async run(r,a){this.sql=r;let{connection:n,options:i}=this,s=this.sequelize.options.showWarnings||i.showWarnings,o=this._logQuery(r,A5e,a);a&&A5e("parameters(%j)",a);let c,u=new Error;try{c=await n.query(this.sql,a)}catch(l){if(i.transaction&&l.errno===oor){try{await i.transaction.rollback()}catch{}i.transaction.finished="rollback"}throw l.sql=r,l.parameters=a,this.formatError(l,u.stack)}finally{o()}return s&&c&&c.warningStatus>0&&await this.logWarnings(c),this.formatResults(c)}formatResults(r){let a=this.instance;if(this.isBulkUpdateQuery()||this.isBulkDeleteQuery())return r.affectedRows;if(this.isUpsertQuery())return[a,r.affectedRows===1];if(this.isInsertQuery(r)&&(this.handleInsertQuery(r),!this.instance)){if(this.model&&this.model.autoIncrementAttribute&&this.model.autoIncrementAttribute===this.model.primaryKeyAttribute&&this.model.rawAttributes[this.model.primaryKeyAttribute]){let n=r[this.getInsertIdField()];a=new Array(r.affectedRows);let i=this.model.rawAttributes[this.model.primaryKeyAttribute].field;for(let s=0;s<r.affectedRows;s++)a[s]={[i]:n+s};return[a,r.affectedRows]}return[r[this.getInsertIdField()],r.affectedRows]}if(this.isSelectQuery())return this.handleJsonSelectQuery(r),this.handleSelectQuery(r);if(this.isInsertQuery()||this.isUpdateQuery())return[a,r.affectedRows];if(this.isCallQuery())return r[0];if(this.isRawQuery()){let n=r.meta;return delete r.meta,[r,n]}if(this.isShowIndexesQuery())return this.handleShowIndexesQuery(r);if(this.isForeignKeysQuery()||this.isShowConstraintsQuery())return r;if(this.isShowTablesQuery())return this.handleShowTablesQuery(r);if(this.isDescribeQuery()){a={};for(let n of r)a[n.Field]={type:n.Type.toLowerCase().startsWith("enum")?n.Type.replace(/^enum/i,"ENUM"):n.Type.toUpperCase(),allowNull:n.Null==="YES",defaultValue:n.Default,primaryKey:n.Key==="PRI",autoIncrement:Object.prototype.hasOwnProperty.call(n,"Extra")&&n.Extra.toLowerCase()==="auto_increment",comment:n.Comment?n.Comment:null};return a}return this.isVersionQuery()?r[0].version:a}handleJsonSelectQuery(r){if(!(!this.model||!this.model.fieldRawAttributesMap))for(let a of Object.keys(this.model.fieldRawAttributesMap)){let n=this.model.fieldRawAttributesMap[a];n.type instanceof fJ.JSON&&(r=r.map(i=>(i[n.fieldName]&&typeof i[n.fieldName]=="string"&&!this.connection.info.hasMinVersion(10,5,2)&&(i[n.fieldName]=JSON.parse(i[n.fieldName])),fJ.JSON.parse?fJ.JSON.parse(n,this.sequelize.options,i[n.fieldName]):i)))}}async logWarnings(r){let a=await this.run("SHOW WARNINGS"),n=`MariaDB Warnings (${this.connection.uuid||"default"}): `,i=[];for(let s of a)if(!(s===void 0||typeof s[Symbol.iterator]!="function"))for(let o of s)if(Object.prototype.hasOwnProperty.call(o,"Message"))i.push(o.Message);else for(let c of o.keys())i.push([c,o[c]].join(": "));return this.sequelize.log(n+i.join("; "),this.options),r}formatError(r,a){switch(r.errno){case sor:{let n=r.message.match(/Duplicate entry '([\s\S]*)' for key '?((.|\s)*?)'?\s.*$/),i={},s="Validation error",o=n?n[1].split("-"):void 0,c=n?n[2]:void 0,u=n?n[1]:void 0,l=this.model&&this.model.uniqueKeys[c];l?(l.msg&&(s=l.msg),i=g5e.zipObject(l.fields,o)):i[c]=u;let f=[];return g5e.forOwn(i,(d,h)=>{f.push(new vC.ValidationErrorItem(this.getUniqueConstraintErrorMessage(h),"unique violation",h,d,this.instance,"not_unique"))}),new vC.UniqueConstraintError({message:s,errors:f,parent:r,fields:i,stack:a})}case M5e:case cor:{let n=r.message.match(/CONSTRAINT ([`"])(.*)\1 FOREIGN KEY \(\1(.*)\1\) REFERENCES \1(.*)\1 \(\1(.*)\1\)/),i=n?n[1]:"`",s=n?n[3].split(new RegExp(`${i}, *${i}`)):void 0;return new vC.ForeignKeyConstraintError({reltype:r.errno===M5e?"parent":"child",table:n?n[4]:void 0,fields:s,value:s&&s.length&&this.instance&&this.instance[s[0]]||void 0,index:n?n[2]:void 0,parent:r,stack:a})}default:return new vC.DatabaseError(r,{stack:a})}}handleShowTablesQuery(r){return r.map(a=>({tableName:a.TABLE_NAME,schema:a.TABLE_SCHEMA}))}handleShowIndexesQuery(r){let a,n=[];return r.forEach(i=>{(!a||a.name!==i.Key_name)&&(a={primary:i.Key_name==="PRIMARY",fields:[],name:i.Key_name,tableName:i.Table,unique:i.Non_unique!==1,type:i.Index_type},n.push(a)),a.fields[i.Seq_in_index-1]={attribute:i.Column_name,length:i.Sub_part||void 0,order:i.Collation==="A"?"ASC":void 0}}),n}};O5e.exports=dJ});var v5e=A(($9a,w5e)=>{"use strict";var uor=Object.defineProperty,z5e=Object.getOwnPropertySymbols,lor=Object.prototype.hasOwnProperty,por=Object.prototype.propertyIsEnumerable,E5e=(t,r,a)=>r in t?uor(t,r,{enumerable:!0,configurable:!0,writable:!0,value:a}):t[r]=a,dor=(t,r)=>{for(var a in r||(r={}))lor.call(r,a)&&E5e(t,a,r[a]);if(z5e)for(var a of z5e(r))por.call(r,a)&&E5e(t,a,r[a]);return t},RC=hr(),sa=Ws(),hor=On(),bor={OperatorMap:{[sa.eq]:"=",[sa.ne]:"!=",[sa.gte]:">=",[sa.gt]:">",[sa.lte]:"<=",[sa.lt]:"<",[sa.not]:"IS NOT",[sa.is]:"IS",[sa.in]:"IN",[sa.notIn]:"NOT IN",[sa.like]:"LIKE",[sa.notLike]:"NOT LIKE",[sa.iLike]:"ILIKE",[sa.notILike]:"NOT ILIKE",[sa.startsWith]:"LIKE",[sa.endsWith]:"LIKE",[sa.substring]:"LIKE",[sa.regexp]:"~",[sa.notRegexp]:"!~",[sa.iRegexp]:"~*",[sa.notIRegexp]:"!~*",[sa.between]:"BETWEEN",[sa.notBetween]:"NOT BETWEEN",[sa.overlap]:"&&",[sa.contains]:"@>",[sa.contained]:"<@",[sa.adjacent]:"-|-",[sa.strictLeft]:"<<",[sa.strictRight]:">>",[sa.noExtendRight]:"&<",[sa.noExtendLeft]:"&>",[sa.any]:"ANY",[sa.all]:"ALL",[sa.and]:" AND ",[sa.or]:" OR ",[sa.col]:"COL",[sa.placeholder]:"$$PLACEHOLDER$$",[sa.match]:"@@"},OperatorsAliasMap:{},setOperatorsAliases(t){!t||RC.isEmpty(t)?this.OperatorsAliasMap=!1:this.OperatorsAliasMap=dor({},t)},_replaceAliases(t){let r={};return this.OperatorsAliasMap?(hor.getOperators(t).forEach(a=>{let n=t[a];RC.isPlainObject(n)?r[a]=this._replaceAliases(n):r[a]=n}),RC.forOwn(t,(a,n)=>{n=this.OperatorsAliasMap[n]||n,RC.isPlainObject(a)&&(a=this._replaceAliases(a)),r[n]=a}),r):t}};w5e.exports=bor});var T5e=A((Y9a,R5e)=>{"use strict";var mor=(JM(),gf(KM)).v4,_or={setIsolationLevelQuery(t,r){if(!r.parent)return`SET TRANSACTION ISOLATION LEVEL ${t};`},generateTransactionId(){return mor()},startTransactionQuery(t){return t.parent?`SAVEPOINT ${this.quoteIdentifier(t.name,!0)};`:"START TRANSACTION;"},deferConstraintsQuery(){},setConstraintQuery(){},setDeferredQuery(){},setImmediateQuery(){},commitTransactionQuery(t){if(!t.parent)return"COMMIT;"},rollbackTransactionQuery(t){return t.parent?`ROLLBACK TO SAVEPOINT ${this.quoteIdentifier(t.name,!0)};`:"ROLLBACK;"}};R5e.exports=_or});var xh=A((K9a,x5e)=>{"use strict";var gor=Object.defineProperty,Mor=Object.defineProperties,Aor=Object.getOwnPropertyDescriptors,q5e=Object.getOwnPropertySymbols,Oor=Object.prototype.hasOwnProperty,yor=Object.prototype.propertyIsEnumerable,N5e=(t,r,a)=>r in t?gor(t,r,{enumerable:!0,configurable:!0,writable:!0,value:a}):t[r]=a,A2=(t,r)=>{for(var a in r||(r={}))Oor.call(r,a)&&N5e(t,a,r[a]);if(q5e)for(var a of q5e(r))yor.call(r,a)&&N5e(t,a,r[a]);return t},TC=(t,r)=>Mor(t,Aor(r)),qC=require("util"),ra=hr(),zor=(JM(),gf(KM)).v4,Qt=On(),X9a=nA(),I5e=Cv(),lA=Ja(),Uu=vK(),pA=vh(),hJ=Rh(),Eor=tA(),wor=h2(),Rt=Ws(),bJ=cn(),S5e=LK(),dR=class{constructor(r){if(!r.sequelize)throw new Error("QueryGenerator initialized without options.sequelize");if(!r._dialect)throw new Error("QueryGenerator initialized without options._dialect");this.sequelize=r.sequelize,this.options=r.sequelize.options,this.dialect=r._dialect.name,this._dialect=r._dialect,this._initQuoteIdentifier()}extractTableDetails(r,a){return a=a||{},r=r||{},{schema:r.schema||a.schema||this.options.schema||"public",tableName:ra.isPlainObject(r)?r.tableName:r,delimiter:r.delimiter||a.delimiter||"."}}addSchema(r){if(!r._schema)return r.tableName||r;let a=this;return{tableName:r.tableName||r,table:r.tableName||r,name:r.name||r,schema:r._schema,delimiter:r._schemaDelimiter||".",toString(){return a.quoteTable(this)}}}dropSchema(r,a){return this.dropTableQuery(r,a)}describeTableQuery(r,a,n){return`DESCRIBE ${this.quoteTable(this.addSchema({tableName:r,_schema:a,_schemaDelimiter:n}))};`}dropTableQuery(r){return`DROP TABLE IF EXISTS ${this.quoteTable(r)};`}renameTableQuery(r,a){return`ALTER TABLE ${this.quoteTable(r)} RENAME TO ${this.quoteTable(a)};`}populateInsertQueryReturnIntoBinds(){}insertQuery(r,a,n,i){i=i||{},ra.defaults(i,this.options);let s={},o=i.bind||[],c=[],u=[],l=[],f=[],d=this.quoteTable(r),h=i.bindParam===void 0?this.bindParam(o):i.bindParam,b=[],m,g="",O="",z="",w="",v=!1,T="";if(n&&ra.each(n,(C,Q)=>{s[Q]=C,C.field&&(s[C.field]=C)}),this._dialect.supports["DEFAULT VALUES"]?O+=" DEFAULT VALUES":this._dialect.supports["VALUES ()"]&&(O+=" VALUES ()"),(this._dialect.supports.returnValues||this._dialect.supports.returnIntoValues)&&i.returning){let C=this.generateReturnValues(n,i);u.push(...C.returnFields),this._dialect.supports.returnIntoValues&&l.push(...C.returnTypes),w=C.returningFragment,T=C.tmpTable||"",z=C.outputFragment||""}(ra.get(this,["sequelize","options","dialectOptions","prependSearchPath"])||i.searchPath)&&(i.bindParam=!1),this._dialect.supports.EXCEPTION&&i.exception&&(i.bindParam=!1),a=Qt.removeNullValuesFromHash(a,this.options.omitNull);for(let C in a)if(Object.prototype.hasOwnProperty.call(a,C)){let Q=a[C];c.push(this.quoteIdentifier(C)),s&&s[C]&&s[C].autoIncrement===!0&&Q==null?this._dialect.supports.autoIncrement.defaultValue?this._dialect.supports.DEFAULT?f.push("DEFAULT"):f.push(this.escape(null)):c.splice(-1,1):(s&&s[C]&&s[C].autoIncrement===!0&&(v=!0),Q instanceof Qt.SequelizeMethod||i.bindParam===!1?f.push(this.escape(Q,s&&s[C]||void 0,{context:"INSERT"})):f.push(this.format(Q,s&&s[C]||void 0,{context:"INSERT"},h)))}let x="";if(!ra.isEmpty(i.conflictWhere)&&!this._dialect.supports.inserts.onConflictWhere)throw new Error("missing dialect support for conflictWhere option");if(this._dialect.supports.inserts.updateOnDuplicate&&i.updateOnDuplicate)if(this._dialect.supports.inserts.updateOnDuplicate==" ON CONFLICT DO UPDATE SET"){let C=i.upsertKeys.map(k=>this.quoteIdentifier(k)),Q=i.updateOnDuplicate.map(k=>`${this.quoteIdentifier(k)}=EXCLUDED.${this.quoteIdentifier(k)}`),X=["ON CONFLICT","(",C.join(","),")"];ra.isEmpty(i.conflictWhere)||X.push(this.whereQuery(i.conflictWhere,i)),ra.isEmpty(Q)?X.push("DO NOTHING"):X.push("DO UPDATE SET",Q.join(",")),x=` ${Qt.joinSQLFragments(X)}`}else{let C=i.updateOnDuplicate.map(Q=>`${this.quoteIdentifier(Q)}=VALUES(${this.quoteIdentifier(Q)})`);if(ra.isEmpty(C)&&i.upsertKeys&&C.push(...i.upsertKeys.map(Q=>`${this.quoteIdentifier(Q)}=${this.quoteIdentifier(Q)}`)),ra.isEmpty(C))throw new Error("No update values found for ON DUPLICATE KEY UPDATE clause, and no identifier fields could be found to use instead.");x+=`${this._dialect.supports.inserts.updateOnDuplicate} ${C.join(",")}`}let L={ignoreDuplicates:i.ignoreDuplicates?this._dialect.supports.inserts.ignoreDuplicates:"",onConflictDoNothing:i.ignoreDuplicates?this._dialect.supports.inserts.onConflictDoNothing:"",attributes:c.join(","),output:z,values:f.join(","),tmpTable:T};if(g=`${T}INSERT${L.ignoreDuplicates} INTO ${d} (${L.attributes})${L.output} VALUES (${L.values})${x}${L.onConflictDoNothing}${g}`,O=`${T}INSERT${L.ignoreDuplicates} INTO ${d}${L.output}${x}${L.onConflictDoNothing}${O}`,this._dialect.supports.EXCEPTION&&i.exception){let C="DROP FUNCTION IF EXISTS pg_temp.testfunc()";u.length===0&&u.push("*");let Q=`$func_${zor().replace(/-/g,"")}$`,X=`SELECT (testfunc.response).${u.join(", (testfunc.response).")}, testfunc.sequelize_caught_exception FROM pg_temp.testfunc();`;i.exception="WHEN unique_violation THEN GET STACKED DIAGNOSTICS sequelize_caught_exception = PG_EXCEPTION_DETAIL;",g=`CREATE OR REPLACE FUNCTION pg_temp.testfunc(OUT response ${d}, OUT sequelize_caught_exception text) RETURNS RECORD AS ${Q} BEGIN ${g} RETURNING * INTO response; EXCEPTION ${i.exception} END ${Q} LANGUAGE plpgsql; ${X} ${C}`}else g+=w,O+=w;this._dialect.supports.returnIntoValues&&i.returning&&this.populateInsertQueryReturnIntoBinds(u,l,o.length,b,i),m=`${L.attributes.length?g:O}${b.join(",")};`,this._dialect.supports.finalTable&&(m=`SELECT * FROM FINAL TABLE(${L.attributes.length?g:O});`),v&&this._dialect.supports.autoIncrement.identityInsert&&(m=`SET IDENTITY_INSERT ${d} ON; ${m} SET IDENTITY_INSERT ${d} OFF;`);let P={query:m};return i.bindParam!==!1&&(P.bind=o),P}bulkInsertQuery(r,a,n,i){n=n||{},i=i||{};let s=[],o={},c=[],u="";for(let b of a)ra.forOwn(b,(m,g)=>{c.includes(g)||c.push(g),i[g]&&i[g].autoIncrement===!0&&(o[g]=!0)});for(let b of a){let m=c.map(g=>this._dialect.supports.bulkDefault&&o[g]===!0?b[g]!=null?b[g]:"DEFAULT":this.escape(b[g],i[g],{context:"INSERT"}));s.push(`(${m.join(",")})`)}if(this._dialect.supports.inserts.updateOnDuplicate&&n.updateOnDuplicate)if(this._dialect.supports.inserts.updateOnDuplicate==" ON CONFLICT DO UPDATE SET"){let b=n.upsertKeys.map(O=>this.quoteIdentifier(O)),m=n.updateOnDuplicate.map(O=>`${this.quoteIdentifier(O)}=EXCLUDED.${this.quoteIdentifier(O)}`),g=!1;if(n.conflictWhere){if(!this._dialect.supports.inserts.onConflictWhere)throw new Error(`conflictWhere not supported for dialect ${this._dialect.name}`);g=this.whereQuery(n.conflictWhere,n)}u=["ON CONFLICT","(",b.join(","),")",g,"DO UPDATE SET",m.join(",")]}else{if(n.conflictWhere)throw new Error(`conflictWhere not supported for dialect ${this._dialect.name}`);let b=n.updateOnDuplicate.map(m=>`${this.quoteIdentifier(m)}=VALUES(${this.quoteIdentifier(m)})`);u=`${this._dialect.supports.inserts.updateOnDuplicate} ${b.join(",")}`}let l=n.ignoreDuplicates?this._dialect.supports.inserts.ignoreDuplicates:"",f=c.map(b=>this.quoteIdentifier(b)).join(","),d=n.ignoreDuplicates?this._dialect.supports.inserts.onConflictDoNothing:"",h="";if(this._dialect.supports.returnValues&&n.returning){let b=this.generateReturnValues(i,n);h+=b.returningFragment}return Qt.joinSQLFragments(["INSERT",l,"INTO",this.quoteTable(r),`(${f})`,"VALUES",s.join(","),u,d,h,";"])}updateQuery(r,a,n,i,s){i=i||{},ra.defaults(i,this.options),a=Qt.removeNullValuesFromHash(a,i.omitNull,i);let o=[],c=[],u={},l="",f="",d="";(ra.get(this,["sequelize","options","dialectOptions","prependSearchPath"])||i.searchPath)&&(i.bindParam=!1);let h=i.bindParam===void 0?this.bindParam(c):i.bindParam;if(this._dialect.supports["LIMIT ON UPDATE"]&&i.limit&&(["mssql","db2","oracle"].includes(this.dialect)?this.dialect==="oracle"&&(n&&(n.length&&n.length>0||Object.keys(n).length>0)?d+=" AND ":d+=" WHERE ",d+=`rownum <= ${this.escape(i.limit)} `):d=` LIMIT ${this.escape(i.limit)} `),this._dialect.supports.returnValues&&i.returning){let O=this.generateReturnValues(s,i);d+=O.returningFragment,f=O.tmpTable||"",l=O.outputFragment||"",!this._dialect.supports.returnValues.output&&i.returning&&(i.mapToModel=!0)}s&&ra.each(s,(O,z)=>{u[z]=O,O.field&&(u[O.field]=O)});for(let O in a){if(u&&u[O]&&u[O].autoIncrement===!0&&!this._dialect.supports.autoIncrement.update)continue;let z=a[O];z instanceof Qt.SequelizeMethod||i.bindParam===!1?o.push(`${this.quoteIdentifier(O)}=${this.escape(z,u&&u[O]||void 0,{context:"UPDATE"})}`):o.push(`${this.quoteIdentifier(O)}=${this.format(z,u&&u[O]||void 0,{context:"UPDATE"},h)}`)}let b=TC(A2({},i),{bindParam:h});if(o.length===0)return"";let g={query:`${f}UPDATE ${this.quoteTable(r)} SET ${o.join(",")}${l} ${this.whereQuery(n,b)}${d}`.trim()};return i.bindParam!==!1&&(g.bind=c),g}arithmeticQuery(r,a,n,i,s,o){o=o||{},ra.defaults(o,{returning:!0}),s=Qt.removeNullValuesFromHash(s,this.options.omitNull);let c="",u="";if(this._dialect.supports.returnValues&&o.returning){let f=this.generateReturnValues(null,o);c=f.outputFragment,u=f.returningFragment}let l=[];for(let f in i){let d=i[f],h=this.quoteIdentifier(f),b=this.escape(d);l.push(`${h}=${h}${r} ${b}`)}for(let f in s){let d=s[f],h=this.quoteIdentifier(f),b=this.escape(d);l.push(`${h}=${b}`)}return Qt.joinSQLFragments(["UPDATE",this.quoteTable(a),"SET",l.join(","),c,this.whereQuery(n),u])}addIndexQuery(r,a,n,i){n=n||{},Array.isArray(a)?n.fields=a:(n=a,a=void 0),n.prefix=n.prefix||i||r,n.prefix&&typeof n.prefix=="string"&&(n.prefix=n.prefix.replace(/\./g,"_"),n.prefix=n.prefix.replace(/("|')/g,""));let s=n.fields.map(u=>{if(u instanceof Qt.SequelizeMethod)return this.handleSequelizeMethod(u);typeof u=="string"&&(u={name:u});let l="";if(u.attribute&&(u.name=u.attribute),!u.name)throw new Error(`The following index field has no name: ${qC.inspect(u)}`);if(l+=this.quoteIdentifier(u.name),this._dialect.supports.index.collate&&u.collate&&(l+=` COLLATE ${this.quoteIdentifier(u.collate)}`),this._dialect.supports.index.operator){let f=u.operator||n.operator;f&&(l+=` ${f}`)}return this._dialect.supports.index.length&&u.length&&(l+=`(${u.length})`),u.order&&(l+=` ${u.order}`),l});n.name||(n=Qt.nameIndex(n,n.prefix)),n=Uu._conformIndex(n),this._dialect.supports.index.type||delete n.type,n.where&&(n.where=this.whereQuery(n.where)),typeof r=="string"?r=this.quoteIdentifiers(r):r=this.quoteTable(r);let o=this._dialect.supports.index.concurrently&&n.concurrently?"CONCURRENTLY":void 0,c;return this._dialect.supports.indexViaAlter?c=["ALTER TABLE",r,o,"ADD"]:c=["CREATE"],c=c.concat(n.unique?"UNIQUE":"",n.type,"INDEX",this._dialect.supports.indexViaAlter?void 0:o,this.quoteIdentifiers(n.name),this._dialect.supports.index.using===1&&n.using?`USING ${n.using}`:"",this._dialect.supports.indexViaAlter?void 0:`ON ${r}`,this._dialect.supports.index.using===2&&n.using?`USING ${n.using}`:"",`(${s.join(", ")})`,this._dialect.supports.index.parser&&n.parser?`WITH PARSER ${n.parser}`:void 0,this._dialect.supports.index.where&&n.where?n.where:void 0),ra.compact(c).join(" ")}addConstraintQuery(r,a){return typeof r=="string"?r=this.quoteIdentifiers(r):r=this.quoteTable(r),Qt.joinSQLFragments(["ALTER TABLE",r,"ADD",this.getConstraintSnippet(r,a||{}),";"])}getConstraintSnippet(r,a){let n,i,s=a.fields.map(u=>{if(typeof u=="string")return this.quoteIdentifier(u);if(u instanceof Qt.SequelizeMethod)return this.handleSequelizeMethod(u);if(u.attribute&&(u.name=u.attribute),!u.name)throw new Error(`The following index field has no name: ${u}`);return this.quoteIdentifier(u.name)}),o=s.join(", "),c=s.join("_");switch(a.type.toUpperCase()){case"UNIQUE":i=this.quoteIdentifier(a.name||`${r}_${c}_uk`),n=`CONSTRAINT ${i} UNIQUE (${o})`;break;case"CHECK":a.where=this.whereItemsQuery(a.where),i=this.quoteIdentifier(a.name||`${r}_${c}_ck`),n=`CONSTRAINT ${i} CHECK (${a.where})`;break;case"DEFAULT":if(a.defaultValue===void 0)throw new Error("Default value must be specified for DEFAULT CONSTRAINT");if(this._dialect.name!=="mssql")throw new Error("Default constraints are supported only for MSSQL dialect.");i=this.quoteIdentifier(a.name||`${r}_${c}_df`),n=`CONSTRAINT ${i} DEFAULT (${this.escape(a.defaultValue)}) FOR ${s[0]}`;break;case"PRIMARY KEY":i=this.quoteIdentifier(a.name||`${r}_${c}_pk`),n=`CONSTRAINT ${i} PRIMARY KEY (${o})`;break;case"FOREIGN KEY":let u=a.references;if(!u||!u.table||!(u.field||u.fields))throw new Error("references object with table and field must be specified");i=this.quoteIdentifier(a.name||`${r}_${c}_${u.table}_fk`);let l=typeof u.field<"u"?this.quoteIdentifier(u.field):u.fields.map(d=>this.quoteIdentifier(d)).join(", "),f=`${this.quoteTable(u.table)} (${l})`;n=`CONSTRAINT ${i} `,n+=`FOREIGN KEY (${o}) REFERENCES ${f}`,a.onUpdate&&(n+=` ON UPDATE ${a.onUpdate.toUpperCase()}`),a.onDelete&&(n+=` ON DELETE ${a.onDelete.toUpperCase()}`);break;default:throw new Error(`${a.type} is invalid.`)}return a.deferrable&&["UNIQUE","PRIMARY KEY","FOREIGN KEY"].includes(a.type.toUpperCase())&&(n+=` ${this.deferConstraintsQuery(a)}`),n}removeConstraintQuery(r,a){return typeof r=="string"?r=this.quoteIdentifiers(r):r=this.quoteTable(r),Qt.joinSQLFragments(["ALTER TABLE",r,"DROP CONSTRAINT",this.quoteIdentifiers(a)])}quote(r,a,n){let i=["ASC","DESC","ASC NULLS LAST","DESC NULLS LAST","ASC NULLS FIRST","DESC NULLS FIRST","NULLS FIRST","NULLS LAST"];if(n=n||".",typeof r=="string")return this.quoteIdentifiers(r);if(Array.isArray(r)){r.forEach((f,d)=>{let h=r[d-1],b,m;if(!h&&a!==void 0?m=a:h&&h instanceof pA&&(b=h,m=h.target),m&&m.prototype instanceof Uu){let g,O;if(typeof f=="function"&&f.prototype instanceof Uu?g=f:ra.isPlainObject(f)&&f.model&&f.model.prototype instanceof Uu&&(g=f.model,O=f.as),g&&(!O&&b&&b instanceof pA&&b.through&&b.through.model===g?f=new pA(m,g,{as:g.name}):(f=m.getAssociationForAlias(g,O),f||(f=m.getAssociationForAlias(g,g.name))),!(f instanceof pA)))throw new Error(qC.format("Unable to find a valid association for model, '%s'",g.name))}if(typeof f=="string"){let g=i.indexOf(f.toUpperCase());if(d>0&&g!==-1)f=this.sequelize.literal(` ${i[g]}`);else if(m&&m.prototype instanceof Uu){if(m.associations!==void 0&&m.associations[f])f=m.associations[f];else if(m.rawAttributes!==void 0&&m.rawAttributes[f]&&f!==m.rawAttributes[f].field)f=m.rawAttributes[f].field;else if(f.includes(".")&&m.rawAttributes!==void 0){let O=f.split(".");if(m.rawAttributes[O[0]].type instanceof lA.JSON){let z=this.quoteIdentifiers(`${m.name}.${m.rawAttributes[O[0]].field}`),w=O.slice(1);f=this.jsonPathExtractionQuery(z,w),f=this.sequelize.literal(f)}}}}r[d]=f},this);let s=r.length,o=[],c,u=0;for(u=0;u<s-1&&(c=r[u],!(typeof c=="string"||c._modelAttribute||c instanceof Qt.SequelizeMethod));u++)c instanceof pA&&(o[u]=c.as);let l="";return u>0?l+=`${this.quoteIdentifier(o.join(n))}.`:typeof r[0]=="string"&&a&&(l+=`${this.quoteIdentifier(a.name)}.`),r.slice(u).forEach(f=>{l+=this.quote(f,a,n)},this),l}if(r._modelAttribute)return`${this.quoteTable(r.Model.name)}.${this.quoteIdentifier(r.fieldName)}`;if(r instanceof Qt.SequelizeMethod)return this.handleSequelizeMethod(r);throw ra.isPlainObject(r)&&r.raw?new Error('The `{raw: "..."}` syntax is no longer supported.  Use `sequelize.literal` instead.'):new Error(`Unknown structure passed to order / group: ${qC.inspect(r)}`)}_initQuoteIdentifier(){this._quoteIdentifier=this.quoteIdentifier,this.quoteIdentifier=function(r,a){return r==="*"?r:this._quoteIdentifier(r,a)}}quoteIdentifier(r,a){throw new Error(`quoteIdentifier for Dialect "${this.dialect}" is not implemented`)}quoteIdentifiers(r){if(r.includes(".")){r=r.split(".");let a=r.slice(0,r.length-1).join("->"),n=r[r.length-1];return`${this.quoteIdentifier(a)}.${this.quoteIdentifier(n)}`}return this.quoteIdentifier(r)}quoteAttribute(r,a){return a&&r in a.rawAttributes?this.quoteIdentifier(r):this.quoteIdentifiers(r)}getAliasToken(){return"AS"}quoteTable(r,a){let n="";return a===!0&&(a=r.as||r.name||r),ra.isObject(r)?this._dialect.supports.schemas?(r.schema&&(n+=`${this.quoteIdentifier(r.schema)}.`),n+=this.quoteIdentifier(r.tableName)):(r.schema&&(n+=r.schema+(r.delimiter||".")),n+=r.tableName,n=this.quoteIdentifier(n)):n=this.quoteIdentifier(r),a&&(n+=` ${this.getAliasToken()} ${this.quoteIdentifier(a)}`),n}escape(r,a,n){if(n=n||{},r!=null){if(r instanceof Qt.SequelizeMethod)return this.handleSequelizeMethod(r);if(a&&a.type&&(a.type instanceof lA.STRING&&["mysql","mariadb"].includes(this.dialect)&&["number","boolean"].includes(typeof r)&&(r=String(Number(r))),this.validate(r,a,n),a.type.stringify)){let i=s=>I5e.escape(s,this.options.timezone,this.dialect);if(r=a.type.stringify(r,{escape:i,field:a,timezone:this.options.timezone,operation:n.operation}),a.type.escape===!1)return r}}return I5e.escape(r,this.options.timezone,this.dialect)}bindParam(r){return a=>(r.push(a),`$${r.length}`)}format(r,a,n,i){if(n=n||{},r!=null){if(r instanceof Qt.SequelizeMethod)throw new Error("Cannot pass SequelizeMethod as a bind parameter - use escape instead");if(a&&a.type&&(this.validate(r,a,n),a.type.bindParam))return a.type.bindParam(r,{escape:ra.identity,field:a,timezone:this.options.timezone,operation:n.operation,bindParam:i})}return i(r)}validate(r,a,n){if(this.typeValidation&&a.type.validate&&r)try{if(n.isList&&Array.isArray(r))for(let i of r)a.type.validate(i,n);else a.type.validate(r,n)}catch(i){throw i instanceof bJ.ValidationError&&i.errors.push(new bJ.ValidationErrorItem(i.message,"Validation error",a.fieldName,r,null,`${a.type.key} validator`)),i}}isIdentifierQuoted(r){return/^\s*(?:([`"'])(?:(?!\1).|\1{2})*\1\.?)+\s*$/i.test(r)}jsonPathExtractionQuery(r,a,n){let i=ra.toPath(a),s,o=this.isIdentifierQuoted(r)?r:this.quoteIdentifier(r);switch(this.dialect){case"mysql":case"mariadb":case"sqlite":return this.dialect==="mysql"&&(i=i.map(u=>/\D/.test(u)?Qt.addTicks(u,'"'):u)),s=this.escape(["$"].concat(i).join(".").replace(/\.(\d+)(?:(?=\.)|$)/g,(u,l)=>`[${l}]`)),this.dialect==="sqlite"?`json_extract(${o},${s})`:`json_unquote(json_extract(${o},${s}))`;case"postgres":let c=n?"#>":"#>>";return s=this.escape(`{${i.join(",")}}`),`(${o}${c}${s})`;default:throw new Error(`Unsupported ${this.dialect} for JSON operations`)}}selectQuery(r,a,n){a=a||{};let i=a.limit,s=[],o=[],c=a.subQuery===void 0?i&&a.hasMultiAssociation:a.subQuery,u={main:a.attributes&&a.attributes.slice(),subQuery:null},l={name:r,quotedName:null,as:null,model:n},f={names:l,options:a,subQuery:c},d=[],h=[],b;if(this.options.minifyAliases&&!a.aliasesMapping&&(a.aliasesMapping=new Map,a.aliasesByTable={},a.includeAliases=new Map),a.tableAs?l.as=this.quoteIdentifier(a.tableAs):!Array.isArray(l.name)&&l.model&&(l.as=this.quoteIdentifier(l.model.name)),l.quotedName=Array.isArray(l.name)?r.map(g=>Array.isArray(g)?this.quoteTable(g[0],g[1]):this.quoteTable(g,!0)).join(", "):this.quoteTable(l.name),c&&u.main)for(let g of l.model.primaryKeyAttributes)u.main.some(O=>g===O||g===O[0]||g===O[1])||u.main.push(l.model.rawAttributes[g].field?[g,l.model.rawAttributes[g].field]:g);if(u.main=this.escapeAttributes(u.main,a,l.as),u.main=u.main||(a.include?[`${l.as}.*`]:["*"]),(c||a.groupedLimit)&&(u.subQuery=u.main,u.main=[`${l.as||l.quotedName}.*`]),a.include)for(let g of a.include){if(g.separate)continue;let O=this.generateInclude(g,{externalAs:l.as,internalAs:l.as},f);h=h.concat(O.subQuery),d=d.concat(O.mainQuery),O.attributes.main.length>0&&(u.main=ra.uniq(u.main.concat(O.attributes.main))),O.attributes.subQuery.length>0&&(u.subQuery=ra.uniq(u.subQuery.concat(O.attributes.subQuery)))}if(c)o.push(this.selectFromTableFragment(a,l.model,u.subQuery,l.quotedName,l.as)),o.push(h.join(""));else{if(a.groupedLimit){l.as||(l.as=l.quotedName);let g=A2({},a.where),O,z,w,v=l.as;if(typeof a.groupedLimit.on=="string"?z=a.groupedLimit.on:a.groupedLimit.on instanceof wor&&(z=a.groupedLimit.on.foreignKeyField),a.groupedLimit.on instanceof Eor){v=a.groupedLimit.on.manyFromSource.as;let P=Uu._validateIncludedElements({include:[{association:a.groupedLimit.on.manyFromSource,duplicating:!1,required:!0,where:A2({[Rt.placeholder]:!0},a.groupedLimit.through&&a.groupedLimit.through.where)}],model:n});a.hasJoin=!0,a.hasMultiAssociation=!0,a.includeMap=Object.assign(P.includeMap,a.includeMap),a.includeNames=P.includeNames.concat(a.includeNames||[]),w=P.include,Array.isArray(a.order)&&(a.order.forEach((C,Q)=>{Array.isArray(C)&&(C=C[0]);let X=`subquery_order_${Q}`;a.attributes.push([C,X]),X=this.sequelize.literal(this.quote(X)),Array.isArray(a.order[Q])?a.order[Q][0]=X:a.order[Q]=X}),O=a.order)}else O=a.order,this._dialect.supports.topLevelOrderByRequired||delete a.order,g[Rt.placeholder]=!0;let T=`SELECT * FROM (${this.selectQuery(r,{attributes:a.attributes,offset:a.offset,limit:a.groupedLimit.limit,order:O,aliasesMapping:a.aliasesMapping,aliasesByTable:a.aliasesByTable,where:g,include:w,model:n},n).replace(/;$/,"")}) ${this.getAliasToken()} sub`,x=this.whereItemQuery(Rt.placeholder,!0,{model:n}),L=T.indexOf(x);s.push(this.selectFromTableFragment(a,l.model,u.main,`(${a.groupedLimit.values.map(P=>{let C;return z&&(C={[z]:P}),w&&(C={[a.groupedLimit.on.foreignIdentifierField]:P}),Qt.spliceStr(T,L,x.length,this.getWhereConditions(C,v))}).join(this._dialect.supports["UNION ALL"]?" UNION ALL ":" UNION ")})`,l.as))}else s.push(this.selectFromTableFragment(a,l.model,u.main,l.quotedName,l.as));s.push(d.join(""))}if(Object.prototype.hasOwnProperty.call(a,"where")&&!a.groupedLimit&&(a.where=this.getWhereConditions(a.where,l.as||r,n,a),a.where&&(c?o.push(` WHERE ${a.where}`):(s.push(` WHERE ${a.where}`),s.forEach((g,O)=>{g.startsWith("SELECT")&&(s[O]=this.selectFromTableFragment(a,n,u.main,l.quotedName,l.as,a.where))})))),a.group&&(a.group=Array.isArray(a.group)?a.group.map(g=>this.aliasGrouping(g,n,l.as,a)).join(", "):this.aliasGrouping(a.group,n,l.as,a),c&&a.group?o.push(` GROUP BY ${a.group}`):a.group&&s.push(` GROUP BY ${a.group}`)),Object.prototype.hasOwnProperty.call(a,"having")&&(a.having=this.getWhereConditions(a.having,r,n,a,!1),a.having&&(c?o.push(` HAVING ${a.having}`):s.push(` HAVING ${a.having}`))),a.order){let g=this.getQueryOrders(a,n,c);g.mainQueryOrder.length&&s.push(` ORDER BY ${g.mainQueryOrder.join(", ")}`),g.subQueryOrder.length&&o.push(` ORDER BY ${g.subQueryOrder.join(", ")}`)}let m=this.addLimitAndOffset(a,l.model);if(m&&!a.groupedLimit&&(c?o.push(m):s.push(m)),c?(this._throwOnEmptyAttributes(u.main,{modelName:n&&n.name,as:l.as}),b=`SELECT ${u.main.join(", ")} FROM (${o.join("")}) ${this.getAliasToken()} ${l.as}${d.join("")}${s.join("")}`):b=s.join(""),a.lock&&this._dialect.supports.lock){let g=a.lock;typeof a.lock=="object"&&(g=a.lock.level),this._dialect.supports.lockKey&&["KEY SHARE","NO KEY UPDATE"].includes(g)?b+=` FOR ${g}`:g==="SHARE"?b+=` ${this._dialect.supports.forShare}`:b+=" FOR UPDATE",this._dialect.supports.lockOf&&a.lock.of&&a.lock.of.prototype instanceof Uu&&(b+=` OF ${this.quoteTable(a.lock.of.name)}`),this._dialect.supports.skipLocked&&a.skipLocked&&(b+=" SKIP LOCKED")}return`${b};`}aliasGrouping(r,a,n,i){let s=Array.isArray(r)?r[0]:r;return this.quote(this._getAliasForField(n,s,i)||s,a)}escapeAttributes(r,a,n){return r&&r.map(i=>{let s=!0;if(i instanceof Qt.SequelizeMethod)return this.handleSequelizeMethod(i);if(Array.isArray(i)){if(i.length!==2)throw new Error(`${JSON.stringify(i)} is not a valid attribute definition. Please use the following format: ['attribute definition', 'alias']`);if(i=i.slice(),i[0]instanceof Qt.SequelizeMethod)i[0]=this.handleSequelizeMethod(i[0]),s=!1;else if(this.options.attributeBehavior==="escape"||!i[0].includes("(")&&!i[0].includes(")"))i[0]=this.quoteIdentifier(i[0]);else if(this.options.attributeBehavior!=="unsafe-legacy")throw new Error(`Attributes cannot include parentheses in Sequelize 6:
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            

Error: Please install mysql2 package manually
    at t._loadDialectModule (/home/wiomgjqe/neduas.store/server.js:124:7832)
    at new t (/home/wiomgjqe/neduas.store/server.js:136:66644)
    at new O1 (/home/wiomgjqe/neduas.store/server.js:136:73185)
    at new t (/home/wiomgjqe/neduas.store/server.js:136:229204)
    at Object.<anonymous> (/home/wiomgjqe/neduas.store/server.js:3649:2755)
    at Module._compile (node:internal/modules/cjs/loader:1275:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1329:10)
    at Module.load (node:internal/modules/cjs/loader:1133:32)
    at Module._load (node:internal/modules/cjs/loader:972:12)
    at Module.require (node:internal/modules/cjs/loader:1157:19)

Node.js v19.9.0
/home/wiomgjqe/neduas.store/server.js:124
`}};MC.AggregateError=sJ});var n5e=A(AC=>{"use strict";Object.defineProperty(AC,"__esModule",{value:!0});AC.Deferred=void 0;var Tsr=iJ(),cJ=class{constructor(){this._promise=new Promise((r,a)=>{this._reject=a,this._resolve=r})}registerTimeout(r,a){this._timeout||(this._timeout=setTimeout(()=>{a(),this.reject(new Tsr.TimeoutError("Operation timeout"))},r))}_clearTimeout(){this._timeout&&clearTimeout(this._timeout)}resolve(r){this._clearTimeout(),this._resolve(r)}reject(r){this._clearTimeout(),this._reject(r)}promise(){return this._promise}};AC.Deferred=cJ});var i5e=A(OC=>{"use strict";Object.defineProperty(OC,"__esModule",{value:!0});OC.Pool=void 0;var qsr=n5e(),Nsr=oJ(),uJ=class{constructor(r){if(this.log=!1,!r.create)throw new Error("create function is required");if(!r.destroy)throw new Error("destroy function is required");if(!r.validate)throw new Error("validate function is required");if(typeof r.min!="number"||r.min<0||r.min!==Math.round(r.min))throw new Error("min must be an integer >= 0");if(typeof r.max!="number"||r.max<=0||r.max!==Math.round(r.max))throw new Error("max must be an integer > 0");if(r.min>r.max)throw new Error("max is smaller than min");if(r.maxUses!==void 0&&(typeof r.maxUses!="number"||r.maxUses<0))throw new Error("maxUses must be an integer >= 0");this.idleTimeoutMillis=r.idleTimeoutMillis||3e4,this.acquireTimeoutMillis=r.acquireTimeoutMillis||3e4,this.reapIntervalMillis=r.reapIntervalMillis||1e3,this.maxUsesPerResource=r.maxUses||1/0,this.log=r.log||!1,this._factory=r,this._count=0,this._draining=!1,this._pendingAcquires=[],this._inUseObjects=[],this._availableObjects=[],this._removeIdleScheduled=!1}get size(){return this._count}get name(){return this._factory.name}get available(){return this._availableObjects.length}get using(){return this._inUseObjects.length}get waiting(){return this._pendingAcquires.length}get maxSize(){return this._factory.max}get minSize(){return this._factory.min}_log(r,a){typeof this.log=="function"?this.log(r,a):this.log&&console.log(`${a.toUpperCase()} pool ${this.name||""} - ${r}`)}_removeIdle(){let r=[],a=Date.now(),n,i=this._availableObjects.length,s=this.size-this.minSize,o;for(this._removeIdleScheduled=!1,n=0;n<i&&s>r.length;n++)o=this._availableObjects[n].timeout,a>=o&&(this._log("removeIdle() destroying obj - now:"+a+" timeout:"+o,"verbose"),r.push(this._availableObjects[n].resource));r.forEach(this.destroy,this),i=this._availableObjects.length,i>0?(this._log("this._availableObjects.length="+i,"verbose"),this._scheduleRemoveIdle()):this._log("removeIdle() all objects removed","verbose")}_scheduleRemoveIdle(){this._removeIdleScheduled||(this._removeIdleScheduled=!0,this._removeIdleTimer=setTimeout(()=>{this._removeIdle()},this.reapIntervalMillis))}_dispense(){let r=null,a=this._pendingAcquires.length;if(this._log(`dispense() clients=${a} available=${this._availableObjects.length}`,"info"),!(a<1)){for(;this._availableObjects.length>0;){if(this._log("dispense() - reusing obj","verbose"),r=this._availableObjects[this._availableObjects.length-1],!this._factory.validate(r.resource)){this.destroy(r.resource);continue}return this._availableObjects.pop(),this._addResourceToInUseObjects(r.resource,r.useCount),this._pendingAcquires.shift().resolve(r.resource)}this.size<this.maxSize&&this._createResource()}}_createResource(){this._count+=1,this._log(`createResource() - creating obj - count=${this.size} min=${this.minSize} max=${this.maxSize}`,"verbose"),this._factory.create().then(r=>{let a=this._pendingAcquires.shift();a?(this._addResourceToInUseObjects(r,0),a.resolve(r)):this._addResourceToAvailableObjects(r,0)}).catch(r=>{let a=this._pendingAcquires.shift();this._count-=1,this._count<0&&(this._count=0),a&&a.reject(r),process.nextTick(()=>{this._dispense()})})}_addResourceToAvailableObjects(r,a){let n={resource:r,useCount:a,timeout:Date.now()+this.idleTimeoutMillis};this._availableObjects.push(n),this._dispense(),this._scheduleRemoveIdle()}_addResourceToInUseObjects(r,a){let n={resource:r,useCount:a};this._inUseObjects.push(n)}_ensureMinimum(){let r,a;if(!this._draining&&this.size<this.minSize)for(a=this.minSize-this.size,r=0;r<a;r++)this._createResource()}acquire(){if(this._draining)return Promise.reject(new Error("pool is draining and cannot accept work"));let r=new qsr.Deferred;return r.registerTimeout(this.acquireTimeoutMillis,()=>{this._pendingAcquires=this._pendingAcquires.filter(a=>a!==r)}),this._pendingAcquires.push(r),this._dispense(),r.promise()}release(r){if(this._availableObjects.some(i=>i.resource===r)){this._log("release called twice for the same resource: "+new Error().stack,"error");return}let a=this._inUseObjects.findIndex(i=>i.resource===r);if(a<0){this._log("attempt to release an invalid resource: "+new Error().stack,"error");return}let n=this._inUseObjects[a];n.useCount+=1,n.useCount>=this.maxUsesPerResource?(this._log("release() destroying obj - useCount:"+n.useCount+" maxUsesPerResource:"+this.maxUsesPerResource,"verbose"),this.destroy(n.resource),this._dispense()):(this._inUseObjects.splice(a,1),this._addResourceToAvailableObjects(n.resource,n.useCount))}async destroy(r){let a=this._availableObjects.length,n=this._inUseObjects.length;if(this._availableObjects=this._availableObjects.filter(i=>i.resource!==r),this._inUseObjects=this._inUseObjects.filter(i=>i.resource!==r),a===this._availableObjects.length&&n===this._inUseObjects.length){this._ensureMinimum();return}this._count-=1,this._count<0&&(this._count=0);try{await this._factory.destroy(r)}finally{this._ensureMinimum(),this._draining||process.nextTick(()=>{this._dispense()})}}drain(){this._log("draining","info"),this._draining=!0;let r=a=>{if(this._pendingAcquires.length>0){this._dispense(),setTimeout(()=>{r(a)},100);return}if(this._availableObjects.length!==this._count){setTimeout(()=>{r(a)},100);return}a()};return new Promise(a=>r(a))}async destroyAllNow(){this._log("force destroying all objects","info"),this._removeIdleScheduled=!1,clearTimeout(this._removeIdleTimer);let r=this._availableObjects.map(n=>n.resource),a=[];for(let n of r)try{await this.destroy(n)}catch(i){this._log("Error destroying resource: "+i.stack,"error"),a.push(i)}if(a.length>0)throw new Nsr.AggregateError(a)}};OC.Pool=uJ});var s5e=A(Nh=>{"use strict";Object.defineProperty(Nh,"__esModule",{value:!0});Nh.Pool=Nh.AggregateError=Nh.TimeoutError=void 0;var Isr=iJ();Object.defineProperty(Nh,"TimeoutError",{enumerable:!0,get:function(){return Isr.TimeoutError}});var Ssr=oJ();Object.defineProperty(Nh,"AggregateError",{enumerable:!0,get:function(){return Ssr.AggregateError}});var xsr=i5e();Object.defineProperty(Nh,"Pool",{enumerable:!0,get:function(){return xsr.Pool}})});var Df=A((j9a,yC)=>{"use strict";var{Pool:lJ,TimeoutError:ksr}=s5e(),Ih=hr(),pJ=qh(),Csr=cn(),{logger:Lsr}=Ti(),Dsr=nA(),Jl=Lsr.debugContext("pool"),uR=class{constructor(r,a){let n=Ih.cloneDeep(a.config);if(this.sequelize=a,this.config=n,this.dialect=r,this.versionPromise=null,this.dialectName=this.sequelize.options.dialect,n.pool===!1)throw new Error("Support for pool:false was removed in v4.0");n.pool=Ih.defaults(n.pool||{},{max:5,min:0,idle:1e4,acquire:6e4,evict:1e3,validate:this._validate.bind(this)}),this.initPools()}refreshTypeParser(r){Ih.each(r,a=>{if(Object.prototype.hasOwnProperty.call(a,"parse"))if(a.types[this.dialectName])this._refreshTypeParser(a);else throw new Error(`Parse function not supported for type ${a.key} in dialect ${this.dialectName}`)})}_loadDialectModule(r){try{return this.sequelize.config.dialectModulePath?require(this.sequelize.config.dialectModulePath):this.sequelize.config.dialectModule?this.sequelize.config.dialectModule:require(r)}catch(a){throw a.code==="MODULE_NOT_FOUND"?this.sequelize.config.dialectModulePath?new Error(`Unable to find dialect at ${this.sequelize.config.dialectModulePath}`):new Error(`Please install ${r} package manually`):a}}async _onProcessExit(){if(this.pool)return await this.pool.drain(),Jl("connection drain due to process exit"),await this.pool.destroyAllNow()}async close(){return this.getConnection=async function(){throw new Error("ConnectionManager.getConnection was called after the connection manager was closed!")},await this._onProcessExit()}initPools(){let r=this.config;if(!r.replication){this.pool=new lJ({name:"sequelize",create:()=>this._connect(r),destroy:async n=>{let i=await this._disconnect(n);return Jl("connection destroy"),i},validate:r.pool.validate,max:r.pool.max,min:r.pool.min,acquireTimeoutMillis:r.pool.acquire,idleTimeoutMillis:r.pool.idle,reapIntervalMillis:r.pool.evict,maxUses:r.pool.maxUses}),Jl(`pool created with max/min: ${r.pool.max}/${r.pool.min}, no replication`);return}Array.isArray(r.replication.read)||(r.replication.read=[r.replication.read]),r.replication.write=Ih.defaults(r.replication.write,Ih.omit(r,"replication")),r.replication.read=r.replication.read.map(n=>Ih.defaults(n,Ih.omit(this.config,"replication")));let a=0;this.pool={release:n=>{n.queryType==="read"?this.pool.read.release(n):this.pool.write.release(n)},acquire:(n,i)=>(i=i===void 0?!1:i,n==="SELECT"&&!i?this.pool.read.acquire():this.pool.write.acquire()),destroy:n=>{this.pool[n.queryType].destroy(n),Jl("connection destroy")},destroyAllNow:async()=>{await Promise.all([this.pool.read.destroyAllNow(),this.pool.write.destroyAllNow()]),Jl("all connections destroyed")},drain:async()=>Promise.all([this.pool.write.drain(),this.pool.read.drain()]),read:new lJ({name:"sequelize:read",create:async()=>{let n=a++%r.replication.read.length,i=await this._connect(r.replication.read[n]);return i.queryType="read",i},destroy:n=>this._disconnect(n),validate:r.pool.validate,max:r.pool.max,min:r.pool.min,acquireTimeoutMillis:r.pool.acquire,idleTimeoutMillis:r.pool.idle,reapIntervalMillis:r.pool.evict,maxUses:r.pool.maxUses}),write:new lJ({name:"sequelize:write",create:async()=>{let n=await this._connect(r.replication.write);return n.queryType="write",n},destroy:n=>this._disconnect(n),validate:r.pool.validate,max:r.pool.max,min:r.pool.min,acquireTimeoutMillis:r.pool.acquire,idleTimeoutMillis:r.pool.idle,reapIntervalMillis:r.pool.evict,maxUses:r.pool.maxUses})},Jl(`pool created with max/min: ${r.pool.max}/${r.pool.min}, with replication`)}async getConnection(r){r=r||{},this.sequelize.options.databaseVersion===0&&(this.versionPromise||(this.versionPromise=(async()=>{try{let n=await this._connect(this.config.replication.write||this.config),i={};if(i.transaction={connection:n},i.logging=()=>{},i.logging.__testLoggingFn=!0,this.sequelize.options.databaseVersion===0){let s=await this.sequelize.databaseVersion(i),o=Ih.get(pJ.coerce(s),"version")||s;this.sequelize.options.databaseVersion=pJ.valid(o)?o:this.dialect.defaultVersion}return pJ.lt(this.sequelize.options.databaseVersion,this.dialect.defaultVersion)&&(Dsr.unsupportedEngine(),Jl(`Unsupported database engine version ${this.sequelize.options.databaseVersion}`)),this.versionPromise=null,await this._disconnect(n)}catch(n){throw this.versionPromise=null,n}})()),await this.versionPromise);let a;try{await this.sequelize.runHooks("beforePoolAcquire",r),a=await this.pool.acquire(r.type,r.useMaster),await this.sequelize.runHooks("afterPoolAcquire",a,r)}catch(n){throw n instanceof ksr?new Csr.ConnectionAcquireTimeoutError(n):n}return Jl("connection acquired"),a}releaseConnection(r){this.pool.release(r),Jl("connection released")}async destroyConnection(r){await this.pool.destroy(r),Jl(`connection ${r.uuid} destroyed`)}async _connect(r){await this.sequelize.runHooks("beforeConnect",r);let a=await this.dialect.connectionManager.connect(r);return await this.sequelize.runHooks("afterConnect",a,r),a}async _disconnect(r){return await this.sequelize.runHooks("beforeDisconnect",r),await this.dialect.connectionManager.disconnect(r),this.sequelize.runHooks("afterDisconnect",r)}_validate(r){return this.dialect.connectionManager.validate?this.dialect.connectionManager.validate(r):!0}};yC.exports=uR;yC.exports.ConnectionManager=uR;yC.exports.default=uR});var Vc=A((G9a,o5e)=>{"use strict";var lR=new Map;o5e.exports=t=>(lR.has(t)||lR.set(t,new Map),{clear(){lR.get(t).clear()},refresh(r){for(let a of r.types[t])lR.get(t).set(a,r.parse)},get(r){return lR.get(t).get(r)}})});var p5e=A((Q9a,EC)=>{"use strict";var Bsr=Object.defineProperty,c5e=Object.getOwnPropertySymbols,Psr=Object.prototype.hasOwnProperty,Wsr=Object.prototype.propertyIsEnumerable,u5e=(t,r,a)=>r in t?Bsr(t,r,{enumerable:!0,configurable:!0,writable:!0,value:a}):t[r]=a,Usr=(t,r)=>{for(var a in r||(r={}))Psr.call(r,a)&&u5e(t,a,r[a]);if(c5e)for(var a of c5e(r))Wsr.call(r,a)&&u5e(t,a,r[a]);return t},Fsr=qh(),jsr=Df(),uA=cn(),{logger:Gsr}=Ti(),Qsr=Ja().mariadb,Hsr=Hl(),l5e=Gsr.debugContext("connection:mariadb"),zC=Vc()("mariadb"),pR=class t extends jsr{constructor(r,a){a.config.port=a.config.port||3306,super(r,a),this.lib=this._loadDialectModule("mariadb"),this.refreshTypeParser(Qsr)}static _typecast(r,a){return zC.get(r.type)?zC.get(r.type)(r,this.sequelize.options,a):a()}_refreshTypeParser(r){zC.refresh(r)}_clearTypeParser(){zC.clear()}async connect(r){let a=this.sequelize.options.timezone;a=/\//.test(a)?Hsr.tz(a).format("Z"):a;let n=Usr({host:r.host,port:r.port,user:r.username,password:r.password,database:r.database,timezone:a,typeCast:t._typecast.bind(this),bigNumberStrings:!1,supportBigNumbers:!0,foundRows:!1},r.dialectOptions);this.sequelize.config.keepDefaultTimezone||(n.initSql?(Array.isArray(n.initSql)||(n.initSql=[n.initSql]),n.initSql.push(`SET time_zone = '${a}'`)):n.initSql=`SET time_zone = '${a}'`);try{let i=await this.lib.createConnection(n);return this.sequelize.options.databaseVersion=Fsr.coerce(i.serverVersion()).version,l5e("connection acquired"),i.on("error",s=>{switch(s.code){case"ESOCKET":case"ECONNRESET":case"EPIPE":case"PROTOCOL_CONNECTION_LOST":this.pool.destroy(i)}}),i}catch(i){switch(i.code){case"ECONNREFUSED":throw new uA.ConnectionRefusedError(i);case"ER_ACCESS_DENIED_ERROR":case"ER_ACCESS_DENIED_NO_PASSWORD_ERROR":throw new uA.AccessDeniedError(i);case"ENOTFOUND":throw new uA.HostNotFoundError(i);case"EHOSTUNREACH":case"ENETUNREACH":case"EADDRNOTAVAIL":throw new uA.HostNotReachableError(i);case"EINVAL":throw new uA.InvalidConnectionError(i);default:throw new uA.ConnectionError(i)}}}async disconnect(r){if(!r.isValid()){l5e("connection tried to disconnect but was already at CLOSED state");return}return await r.end()}validate(r){return r&&r.isValid()}};EC.exports=pR;EC.exports.ConnectionManager=pR;EC.exports.default=pR});var Bf=A((H9a,wC)=>{"use strict";var Vsr=Object.defineProperty,f5e=Object.getOwnPropertySymbols,$sr=Object.prototype.hasOwnProperty,Ysr=Object.prototype.propertyIsEnumerable,d5e=(t,r,a)=>r in t?Vsr(t,r,{enumerable:!0,configurable:!0,writable:!0,value:a}):t[r]=a,Xsr=(t,r)=>{for(var a in r||(r={}))$sr.call(r,a)&&d5e(t,a,r[a]);if(f5e)for(var a of f5e(r))Ysr.call(r,a)&&d5e(t,a,r[a]);return t},Sh=hr(),Ksr=Cv(),rc=m1(),Jsr=Wv(),Zsr=nA(),eor=(JM(),gf(KM)).v4,{safeStringifyJson:h5e}=On(),fR=class t{constructor(r,a,n){this.uuid=eor(),this.connection=r,this.instance=n.instance,this.model=n.model,this.sequelize=a,this.options=Xsr({plain:!1,raw:!1,logging:console.log},n),this.checkLoggingOption(),n.rawErrors&&(this.formatError=t.prototype.formatError)}static formatBindParameters(r,a,n,i,s){if(!a)return[r,[]];if(s=s||{},typeof i!="function"&&(s=i||{},i=void 0),!i)s.skipValueReplace?i=(u,l,f)=>{if(f[l]!==void 0)return u}:i=(u,l,f,d,h)=>{if(f[l]!==void 0)return Ksr.escape(f[l],d,h)};else if(s.skipValueReplace){let u=i;i=(l,f,d,h,b,m)=>{if(u(l,f,d,h,b,m)!==void 0)return l}}let o=null,c=Array.isArray(a);return r=r.replace(/\B\$(\$|\w+)/g,(u,l)=>{if(l==="$")return s.skipUnescape?u:l;let f;if(c?l.match(/^[1-9]\d*$/)&&(l=l-1,f=i(u,l,a,o,n,s)):l.match(/^\d*$/)||(f=i(u,l,a,o,n,s)),f===void 0)throw new Error(`Named bind parameter "${u}" has no value in the given object.`);return f}),[r,[]]}formatError(r,a){return r.stack=a,r}run(){throw new Error("The run method wasn't overwritten!")}checkLoggingOption(){this.options.logging===!0&&(Zsr.noTrueLogging(),this.options.logging=console.log)}getInsertIdField(){return"insertId"}getUniqueConstraintErrorMessage(r){let a=r?`${r} must be unique`:"Must be unique";if(r&&this.model)for(let n of Object.keys(this.model.uniqueKeys))this.model.uniqueKeys[n].fields.includes(r.replace(/"/g,""))&&this.model.uniqueKeys[n].msg&&(a=this.model.uniqueKeys[n].msg);return a}isRawQuery(){return this.options.type===rc.RAW}isVersionQuery(){return this.options.type===rc.VERSION}isUpsertQuery(){return this.options.type===rc.UPSERT}isInsertQuery(r,a){let n=!0;return this.options.type===rc.INSERT?!0:(n=n&&this.sql.toLowerCase().startsWith("insert into"),n=n&&(!r||Object.prototype.hasOwnProperty.call(r,this.getInsertIdField())),n=n&&(!a||Object.prototype.hasOwnProperty.call(a,this.getInsertIdField())),n)}handleInsertQuery(r,a){if(this.instance){let n=this.model.autoIncrementAttribute,i=null;i=i||r&&r[this.getInsertIdField()],i=i||a&&a[this.getInsertIdField()],this.instance[n]=i}}isShowTablesQuery(){return this.options.type===rc.SHOWTABLES}handleShowTablesQuery(r){return Sh.flatten(r.map(a=>Object.values(a)))}isShowIndexesQuery(){return this.options.type===rc.SHOWINDEXES}isShowConstraintsQuery(){return this.options.type===rc.SHOWCONSTRAINTS}isDescribeQuery(){return this.options.type===rc.DESCRIBE}isSelectQuery(){return this.options.type===rc.SELECT}isBulkUpdateQuery(){return this.options.type===rc.BULKUPDATE}isBulkDeleteQuery(){return this.options.type===rc.BULKDELETE}isForeignKeysQuery(){return this.options.type===rc.FOREIGNKEYS}isUpdateQuery(){return this.options.type===rc.UPDATE}handleSelectQuery(r){let a=null;if(this.options.fieldMap){let n=this.options.fieldMap;r=r.map(i=>Sh.reduce(n,(s,o,c)=>(s[c]!==void 0&&o!==c&&(s[o]=s[c],delete s[c]),s),i))}return this.options.raw?a=r.map(n=>{let i={};for(let s in n)Object.prototype.hasOwnProperty.call(n,s)&&(i[s]=n[s]);return this.options.nest&&(i=Jsr.transform(i)),i}):this.options.hasJoin===!0?(r=t._groupJoinData(r,{model:this.model,includeMap:this.options.includeMap,includeNames:this.options.includeNames},{checkExisting:this.options.hasMultiAssociation}),a=this.model.bulkBuild(r,{isNewRecord:!1,include:this.options.include,includeNames:this.options.includeNames,includeMap:this.options.includeMap,includeValidated:!0,attributes:this.options.originalAttributes||this.options.attributes,raw:!0})):a=this.model.bulkBuild(r,{isNewRecord:!1,raw:!0,attributes:this.options.originalAttributes||this.options.attributes}),this.options.plain&&(a=a.length===0?null:a[0]),a}isShowOrDescribeQuery(){let r=!1;return r=r||this.sql.toLowerCase().startsWith("show"),r=r||this.sql.toLowerCase().startsWith("describe"),r}isCallQuery(){return this.sql.toLowerCase().startsWith("call")}_logQuery(r,a,n){let{connection:i,options:s}=this,o=this.sequelize.options.benchmark||s.benchmark,c=this.sequelize.options.logQueryParameters||s.logQueryParameters,u=Date.now(),l="";if(c&&n){let h=r.endsWith(";")?"":";",b;Array.isArray(n)?b=n.map(m=>h5e(m)).join(", "):b=h5e(n),l=`${h} ${b}`}let f=`(${i.uuid||"default"}): ${r}${l}`,d=`Executing ${f}`;return a(d),o||this.sequelize.log(`Executing ${f}`,s),()=>{let h=`Executed ${f}`;a(h),o&&this.sequelize.log(h,Date.now()-u,s)}}static _groupJoinData(r,a,n){if(!r.length)return[];let i,s,o,c,u,l,f=r.length,d,h,b,m,g,O,z,w,v=n.checkExisting,T,x,L,P=v?[]:new Array(f),C={},Q={},X,k,se,F,D,j,V,he,oe=ne=>{Object.prototype.hasOwnProperty.call(j.includeMap,ne)&&(Q[h]=j=j.includeMap[ne],he?he=`${he}.${ne}`:he=ne,Q[he]=j)},ie={},De=(ne,we)=>(Object.prototype.hasOwnProperty.call(we,ne)||(we[ne]=ne.substr(0,ne.lastIndexOf("."))),we[ne]),Ge={},Ze=ne=>{if(!Object.prototype.hasOwnProperty.call(Ge,ne)){let we=ne.lastIndexOf(".");Ge[ne]=ne.substr(we===-1?0:we+1)}return Ge[ne]},te={},me=ne=>{if(!Object.prototype.hasOwnProperty.call(te,ne)){let we=De(ne,ie);Object.prototype.hasOwnProperty.call(te,we)||(te[we]=we?we.split("."):[]),te[ne]=te[we]}return te[ne]},ve={},ye=ne=>{if(!Object.prototype.hasOwnProperty.call(ve,ne)){let we=me(ne),ke=we.length;ve[ne]=ke?we[ke-1]:""}return ve[ne]},Qe=ne=>{let we=Sh.chain(ne.uniqueKeys);return we=we.result(`${we.findKey()}.fields`).map(ke=>Sh.findKey(ne.attributes,je=>je.field===ke)).value(),we},Ke=ne=>ne instanceof Buffer?ne.toString("hex"):ne,Se,ft,qe;for(u=0;u<f;u++){if(l=r[u],u===0&&(d=Sh.sortBy(Object.keys(l),ne=>[ne.split(".").length]),m=d.length),v){if(w=!1,c=a.model.primaryKeyAttributes.length,L="",c===1)L=Ke(l[a.model.primaryKeyAttributes[0]]);else if(c>1)for(o=0;o<c;o++)L+=Ke(l[a.model.primaryKeyAttributes[o]]);else if(!Sh.isEmpty(a.model.uniqueKeys))for(ft=Qe(a.model),o=0;o<ft.length;o++)L+=l[ft[o]]}for(z=O={},F=void 0,b=0;b<m;b++){if(h=d[b],k=De(h,ie),X=me(h),u===0&&!Object.prototype.hasOwnProperty.call(Q,h)&&(X.length?(j=a,he=void 0,X.forEach(oe)):Q[h]=Q[""]=a),F!==void 0&&F!==X){if(v){if(s=F.length,V=null,x=null,s)for(i=0;i<s;i++){if(qe=V?`${V}.${F[i]}`:F[i],Se=Q[qe].model.primaryKeyAttributes,c=Se.length,T=qe,c===1)T+=Ke(l[`${qe}.${Se[0]}`]);else if(c>1)for(o=0;o<c;o++)T+=Ke(l[`${qe}.${Se[o]}`]);else if(!Sh.isEmpty(Q[qe].model.uniqueKeys))for(ft=Qe(Q[qe].model),o=0;o<ft.length;o++)T+=l[`${qe}.${ft[o]}`];x||(x=L),T=x+T,V=qe,i<s-1&&(x=T)}else T=L;T===L?C[T]?w=!0:C[T]=O:C[T]||(V=C[x],D=ye(g),Q[g].association.isSingleAssociation?V&&(V[D]=C[T]=O):(V[D]||(V[D]=[]),V[D].push(C[T]=O))),O={}}else if(j=z,s=X.length,s)for(i=0;i<s;i++)i===s-1&&(O=j[X[i]]={}),j=j[X[i]]||{}}O[Ze(h)]=l[h],g=h,F=X,se=k}if(v){if(s=F.length,V=null,x=null,s)for(i=0;i<s;i++){if(qe=V?`${V}.${F[i]}`:F[i],Se=Q[qe].model.primaryKeyAttributes,c=Se.length,T=qe,c===1)T+=Ke(l[`${qe}.${Se[0]}`]);else if(c>0)for(o=0;o<c;o++)T+=Ke(l[`${qe}.${Se[o]}`]);else if(!Sh.isEmpty(Q[qe].model.uniqueKeys))for(ft=Qe(Q[qe].model),o=0;o<ft.length;o++)T+=l[`${qe}.${ft[o]}`];x||(x=L),T=x+T,V=qe,i<s-1&&(x=T)}else T=L;T===L?C[T]?w=!0:C[T]=O:C[T]||(V=C[x],D=ye(g),Q[g].association.isSingleAssociation?V&&(V[D]=C[T]=O):(V[D]||(V[D]=[]),V[D].push(C[T]=O))),w||P.push(z)}else P[u]=z}return P}};wC.exports=fR;wC.exports.AbstractQuery=fR;wC.exports.default=fR});var y5e=A((V9a,O5e)=>{"use strict";var tor=Object.defineProperty,b5e=Object.getOwnPropertySymbols,ror=Object.prototype.hasOwnProperty,aor=Object.prototype.propertyIsEnumerable,m5e=(t,r,a)=>r in t?tor(t,r,{enumerable:!0,configurable:!0,writable:!0,value:a}):t[r]=a,nor=(t,r)=>{for(var a in r||(r={}))ror.call(r,a)&&m5e(t,a,r[a]);if(b5e)for(var a of b5e(r))aor.call(r,a)&&m5e(t,a,r[a]);return t},_5e=Bf(),vC=cn(),g5e=hr(),fJ=Ja(),{logger:ior}=Ti(),sor=1062,oor=1213,M5e=1451,cor=1452,A5e=ior.debugContext("sql:mariadb"),dJ=class extends _5e{constructor(r,a,n){super(r,a,nor({showWarnings:!1},n))}static formatBindParameters(r,a,n){let i=[],s=(o,c,u)=>{if(u[c]!==void 0)return i.push(u[c]),"?"};return r=_5e.formatBindParameters(r,a,n,s)[0],[r,i.length>0?i:void 0]}async run(r,a){this.sql=r;let{connection:n,options:i}=this,s=this.sequelize.options.showWarnings||i.showWarnings,o=this._logQuery(r,A5e,a);a&&A5e("parameters(%j)",a);let c,u=new Error;try{c=await n.query(this.sql,a)}catch(l){if(i.transaction&&l.errno===oor){try{await i.transaction.rollback()}catch{}i.transaction.finished="rollback"}throw l.sql=r,l.parameters=a,this.formatError(l,u.stack)}finally{o()}return s&&c&&c.warningStatus>0&&await this.logWarnings(c),this.formatResults(c)}formatResults(r){let a=this.instance;if(this.isBulkUpdateQuery()||this.isBulkDeleteQuery())return r.affectedRows;if(this.isUpsertQuery())return[a,r.affectedRows===1];if(this.isInsertQuery(r)&&(this.handleInsertQuery(r),!this.instance)){if(this.model&&this.model.autoIncrementAttribute&&this.model.autoIncrementAttribute===this.model.primaryKeyAttribute&&this.model.rawAttributes[this.model.primaryKeyAttribute]){let n=r[this.getInsertIdField()];a=new Array(r.affectedRows);let i=this.model.rawAttributes[this.model.primaryKeyAttribute].field;for(let s=0;s<r.affectedRows;s++)a[s]={[i]:n+s};return[a,r.affectedRows]}return[r[this.getInsertIdField()],r.affectedRows]}if(this.isSelectQuery())return this.handleJsonSelectQuery(r),this.handleSelectQuery(r);if(this.isInsertQuery()||this.isUpdateQuery())return[a,r.affectedRows];if(this.isCallQuery())return r[0];if(this.isRawQuery()){let n=r.meta;return delete r.meta,[r,n]}if(this.isShowIndexesQuery())return this.handleShowIndexesQuery(r);if(this.isForeignKeysQuery()||this.isShowConstraintsQuery())return r;if(this.isShowTablesQuery())return this.handleShowTablesQuery(r);if(this.isDescribeQuery()){a={};for(let n of r)a[n.Field]={type:n.Type.toLowerCase().startsWith("enum")?n.Type.replace(/^enum/i,"ENUM"):n.Type.toUpperCase(),allowNull:n.Null==="YES",defaultValue:n.Default,primaryKey:n.Key==="PRI",autoIncrement:Object.prototype.hasOwnProperty.call(n,"Extra")&&n.Extra.toLowerCase()==="auto_increment",comment:n.Comment?n.Comment:null};return a}return this.isVersionQuery()?r[0].version:a}handleJsonSelectQuery(r){if(!(!this.model||!this.model.fieldRawAttributesMap))for(let a of Object.keys(this.model.fieldRawAttributesMap)){let n=this.model.fieldRawAttributesMap[a];n.type instanceof fJ.JSON&&(r=r.map(i=>(i[n.fieldName]&&typeof i[n.fieldName]=="string"&&!this.connection.info.hasMinVersion(10,5,2)&&(i[n.fieldName]=JSON.parse(i[n.fieldName])),fJ.JSON.parse?fJ.JSON.parse(n,this.sequelize.options,i[n.fieldName]):i)))}}async logWarnings(r){let a=await this.run("SHOW WARNINGS"),n=`MariaDB Warnings (${this.connection.uuid||"default"}): `,i=[];for(let s of a)if(!(s===void 0||typeof s[Symbol.iterator]!="function"))for(let o of s)if(Object.prototype.hasOwnProperty.call(o,"Message"))i.push(o.Message);else for(let c of o.keys())i.push([c,o[c]].join(": "));return this.sequelize.log(n+i.join("; "),this.options),r}formatError(r,a){switch(r.errno){case sor:{let n=r.message.match(/Duplicate entry '([\s\S]*)' for key '?((.|\s)*?)'?\s.*$/),i={},s="Validation error",o=n?n[1].split("-"):void 0,c=n?n[2]:void 0,u=n?n[1]:void 0,l=this.model&&this.model.uniqueKeys[c];l?(l.msg&&(s=l.msg),i=g5e.zipObject(l.fields,o)):i[c]=u;let f=[];return g5e.forOwn(i,(d,h)=>{f.push(new vC.ValidationErrorItem(this.getUniqueConstraintErrorMessage(h),"unique violation",h,d,this.instance,"not_unique"))}),new vC.UniqueConstraintError({message:s,errors:f,parent:r,fields:i,stack:a})}case M5e:case cor:{let n=r.message.match(/CONSTRAINT ([`"])(.*)\1 FOREIGN KEY \(\1(.*)\1\) REFERENCES \1(.*)\1 \(\1(.*)\1\)/),i=n?n[1]:"`",s=n?n[3].split(new RegExp(`${i}, *${i}`)):void 0;return new vC.ForeignKeyConstraintError({reltype:r.errno===M5e?"parent":"child",table:n?n[4]:void 0,fields:s,value:s&&s.length&&this.instance&&this.instance[s[0]]||void 0,index:n?n[2]:void 0,parent:r,stack:a})}default:return new vC.DatabaseError(r,{stack:a})}}handleShowTablesQuery(r){return r.map(a=>({tableName:a.TABLE_NAME,schema:a.TABLE_SCHEMA}))}handleShowIndexesQuery(r){let a,n=[];return r.forEach(i=>{(!a||a.name!==i.Key_name)&&(a={primary:i.Key_name==="PRIMARY",fields:[],name:i.Key_name,tableName:i.Table,unique:i.Non_unique!==1,type:i.Index_type},n.push(a)),a.fields[i.Seq_in_index-1]={attribute:i.Column_name,length:i.Sub_part||void 0,order:i.Collation==="A"?"ASC":void 0}}),n}};O5e.exports=dJ});var v5e=A(($9a,w5e)=>{"use strict";var uor=Object.defineProperty,z5e=Object.getOwnPropertySymbols,lor=Object.prototype.hasOwnProperty,por=Object.prototype.propertyIsEnumerable,E5e=(t,r,a)=>r in t?uor(t,r,{enumerable:!0,configurable:!0,writable:!0,value:a}):t[r]=a,dor=(t,r)=>{for(var a in r||(r={}))lor.call(r,a)&&E5e(t,a,r[a]);if(z5e)for(var a of z5e(r))por.call(r,a)&&E5e(t,a,r[a]);return t},RC=hr(),sa=Ws(),hor=On(),bor={OperatorMap:{[sa.eq]:"=",[sa.ne]:"!=",[sa.gte]:">=",[sa.gt]:">",[sa.lte]:"<=",[sa.lt]:"<",[sa.not]:"IS NOT",[sa.is]:"IS",[sa.in]:"IN",[sa.notIn]:"NOT IN",[sa.like]:"LIKE",[sa.notLike]:"NOT LIKE",[sa.iLike]:"ILIKE",[sa.notILike]:"NOT ILIKE",[sa.startsWith]:"LIKE",[sa.endsWith]:"LIKE",[sa.substring]:"LIKE",[sa.regexp]:"~",[sa.notRegexp]:"!~",[sa.iRegexp]:"~*",[sa.notIRegexp]:"!~*",[sa.between]:"BETWEEN",[sa.notBetween]:"NOT BETWEEN",[sa.overlap]:"&&",[sa.contains]:"@>",[sa.contained]:"<@",[sa.adjacent]:"-|-",[sa.strictLeft]:"<<",[sa.strictRight]:">>",[sa.noExtendRight]:"&<",[sa.noExtendLeft]:"&>",[sa.any]:"ANY",[sa.all]:"ALL",[sa.and]:" AND ",[sa.or]:" OR ",[sa.col]:"COL",[sa.placeholder]:"$$PLACEHOLDER$$",[sa.match]:"@@"},OperatorsAliasMap:{},setOperatorsAliases(t){!t||RC.isEmpty(t)?this.OperatorsAliasMap=!1:this.OperatorsAliasMap=dor({},t)},_replaceAliases(t){let r={};return this.OperatorsAliasMap?(hor.getOperators(t).forEach(a=>{let n=t[a];RC.isPlainObject(n)?r[a]=this._replaceAliases(n):r[a]=n}),RC.forOwn(t,(a,n)=>{n=this.OperatorsAliasMap[n]||n,RC.isPlainObject(a)&&(a=this._replaceAliases(a)),r[n]=a}),r):t}};w5e.exports=bor});var T5e=A((Y9a,R5e)=>{"use strict";var mor=(JM(),gf(KM)).v4,_or={setIsolationLevelQuery(t,r){if(!r.parent)return`SET TRANSACTION ISOLATION LEVEL ${t};`},generateTransactionId(){return mor()},startTransactionQuery(t){return t.parent?`SAVEPOINT ${this.quoteIdentifier(t.name,!0)};`:"START TRANSACTION;"},deferConstraintsQuery(){},setConstraintQuery(){},setDeferredQuery(){},setImmediateQuery(){},commitTransactionQuery(t){if(!t.parent)return"COMMIT;"},rollbackTransactionQuery(t){return t.parent?`ROLLBACK TO SAVEPOINT ${this.quoteIdentifier(t.name,!0)};`:"ROLLBACK;"}};R5e.exports=_or});var xh=A((K9a,x5e)=>{"use strict";var gor=Object.defineProperty,Mor=Object.defineProperties,Aor=Object.getOwnPropertyDescriptors,q5e=Object.getOwnPropertySymbols,Oor=Object.prototype.hasOwnProperty,yor=Object.prototype.propertyIsEnumerable,N5e=(t,r,a)=>r in t?gor(t,r,{enumerable:!0,configurable:!0,writable:!0,value:a}):t[r]=a,A2=(t,r)=>{for(var a in r||(r={}))Oor.call(r,a)&&N5e(t,a,r[a]);if(q5e)for(var a of q5e(r))yor.call(r,a)&&N5e(t,a,r[a]);return t},TC=(t,r)=>Mor(t,Aor(r)),qC=require("util"),ra=hr(),zor=(JM(),gf(KM)).v4,Qt=On(),X9a=nA(),I5e=Cv(),lA=Ja(),Uu=vK(),pA=vh(),hJ=Rh(),Eor=tA(),wor=h2(),Rt=Ws(),bJ=cn(),S5e=LK(),dR=class{constructor(r){if(!r.sequelize)throw new Error("QueryGenerator initialized without options.sequelize");if(!r._dialect)throw new Error("QueryGenerator initialized without options._dialect");this.sequelize=r.sequelize,this.options=r.sequelize.options,this.dialect=r._dialect.name,this._dialect=r._dialect,this._initQuoteIdentifier()}extractTableDetails(r,a){return a=a||{},r=r||{},{schema:r.schema||a.schema||this.options.schema||"public",tableName:ra.isPlainObject(r)?r.tableName:r,delimiter:r.delimiter||a.delimiter||"."}}addSchema(r){if(!r._schema)return r.tableName||r;let a=this;return{tableName:r.tableName||r,table:r.tableName||r,name:r.name||r,schema:r._schema,delimiter:r._schemaDelimiter||".",toString(){return a.quoteTable(this)}}}dropSchema(r,a){return this.dropTableQuery(r,a)}describeTableQuery(r,a,n){return`DESCRIBE ${this.quoteTable(this.addSchema({tableName:r,_schema:a,_schemaDelimiter:n}))};`}dropTableQuery(r){return`DROP TABLE IF EXISTS ${this.quoteTable(r)};`}renameTableQuery(r,a){return`ALTER TABLE ${this.quoteTable(r)} RENAME TO ${this.quoteTable(a)};`}populateInsertQueryReturnIntoBinds(){}insertQuery(r,a,n,i){i=i||{},ra.defaults(i,this.options);let s={},o=i.bind||[],c=[],u=[],l=[],f=[],d=this.quoteTable(r),h=i.bindParam===void 0?this.bindParam(o):i.bindParam,b=[],m,g="",O="",z="",w="",v=!1,T="";if(n&&ra.each(n,(C,Q)=>{s[Q]=C,C.field&&(s[C.field]=C)}),this._dialect.supports["DEFAULT VALUES"]?O+=" DEFAULT VALUES":this._dialect.supports["VALUES ()"]&&(O+=" VALUES ()"),(this._dialect.supports.returnValues||this._dialect.supports.returnIntoValues)&&i.returning){let C=this.generateReturnValues(n,i);u.push(...C.returnFields),this._dialect.supports.returnIntoValues&&l.push(...C.returnTypes),w=C.returningFragment,T=C.tmpTable||"",z=C.outputFragment||""}(ra.get(this,["sequelize","options","dialectOptions","prependSearchPath"])||i.searchPath)&&(i.bindParam=!1),this._dialect.supports.EXCEPTION&&i.exception&&(i.bindParam=!1),a=Qt.removeNullValuesFromHash(a,this.options.omitNull);for(let C in a)if(Object.prototype.hasOwnProperty.call(a,C)){let Q=a[C];c.push(this.quoteIdentifier(C)),s&&s[C]&&s[C].autoIncrement===!0&&Q==null?this._dialect.supports.autoIncrement.defaultValue?this._dialect.supports.DEFAULT?f.push("DEFAULT"):f.push(this.escape(null)):c.splice(-1,1):(s&&s[C]&&s[C].autoIncrement===!0&&(v=!0),Q instanceof Qt.SequelizeMethod||i.bindParam===!1?f.push(this.escape(Q,s&&s[C]||void 0,{context:"INSERT"})):f.push(this.format(Q,s&&s[C]||void 0,{context:"INSERT"},h)))}let x="";if(!ra.isEmpty(i.conflictWhere)&&!this._dialect.supports.inserts.onConflictWhere)throw new Error("missing dialect support for conflictWhere option");if(this._dialect.supports.inserts.updateOnDuplicate&&i.updateOnDuplicate)if(this._dialect.supports.inserts.updateOnDuplicate==" ON CONFLICT DO UPDATE SET"){let C=i.upsertKeys.map(k=>this.quoteIdentifier(k)),Q=i.updateOnDuplicate.map(k=>`${this.quoteIdentifier(k)}=EXCLUDED.${this.quoteIdentifier(k)}`),X=["ON CONFLICT","(",C.join(","),")"];ra.isEmpty(i.conflictWhere)||X.push(this.whereQuery(i.conflictWhere,i)),ra.isEmpty(Q)?X.push("DO NOTHING"):X.push("DO UPDATE SET",Q.join(",")),x=` ${Qt.joinSQLFragments(X)}`}else{let C=i.updateOnDuplicate.map(Q=>`${this.quoteIdentifier(Q)}=VALUES(${this.quoteIdentifier(Q)})`);if(ra.isEmpty(C)&&i.upsertKeys&&C.push(...i.upsertKeys.map(Q=>`${this.quoteIdentifier(Q)}=${this.quoteIdentifier(Q)}`)),ra.isEmpty(C))throw new Error("No update values found for ON DUPLICATE KEY UPDATE clause, and no identifier fields could be found to use instead.");x+=`${this._dialect.supports.inserts.updateOnDuplicate} ${C.join(",")}`}let L={ignoreDuplicates:i.ignoreDuplicates?this._dialect.supports.inserts.ignoreDuplicates:"",onConflictDoNothing:i.ignoreDuplicates?this._dialect.supports.inserts.onConflictDoNothing:"",attributes:c.join(","),output:z,values:f.join(","),tmpTable:T};if(g=`${T}INSERT${L.ignoreDuplicates} INTO ${d} (${L.attributes})${L.output} VALUES (${L.values})${x}${L.onConflictDoNothing}${g}`,O=`${T}INSERT${L.ignoreDuplicates} INTO ${d}${L.output}${x}${L.onConflictDoNothing}${O}`,this._dialect.supports.EXCEPTION&&i.exception){let C="DROP FUNCTION IF EXISTS pg_temp.testfunc()";u.length===0&&u.push("*");let Q=`$func_${zor().replace(/-/g,"")}$`,X=`SELECT (testfunc.response).${u.join(", (testfunc.response).")}, testfunc.sequelize_caught_exception FROM pg_temp.testfunc();`;i.exception="WHEN unique_violation THEN GET STACKED DIAGNOSTICS sequelize_caught_exception = PG_EXCEPTION_DETAIL;",g=`CREATE OR REPLACE FUNCTION pg_temp.testfunc(OUT response ${d}, OUT sequelize_caught_exception text) RETURNS RECORD AS ${Q} BEGIN ${g} RETURNING * INTO response; EXCEPTION ${i.exception} END ${Q} LANGUAGE plpgsql; ${X} ${C}`}else g+=w,O+=w;this._dialect.supports.returnIntoValues&&i.returning&&this.populateInsertQueryReturnIntoBinds(u,l,o.length,b,i),m=`${L.attributes.length?g:O}${b.join(",")};`,this._dialect.supports.finalTable&&(m=`SELECT * FROM FINAL TABLE(${L.attributes.length?g:O});`),v&&this._dialect.supports.autoIncrement.identityInsert&&(m=`SET IDENTITY_INSERT ${d} ON; ${m} SET IDENTITY_INSERT ${d} OFF;`);let P={query:m};return i.bindParam!==!1&&(P.bind=o),P}bulkInsertQuery(r,a,n,i){n=n||{},i=i||{};let s=[],o={},c=[],u="";for(let b of a)ra.forOwn(b,(m,g)=>{c.includes(g)||c.push(g),i[g]&&i[g].autoIncrement===!0&&(o[g]=!0)});for(let b of a){let m=c.map(g=>this._dialect.supports.bulkDefault&&o[g]===!0?b[g]!=null?b[g]:"DEFAULT":this.escape(b[g],i[g],{context:"INSERT"}));s.push(`(${m.join(",")})`)}if(this._dialect.supports.inserts.updateOnDuplicate&&n.updateOnDuplicate)if(this._dialect.supports.inserts.updateOnDuplicate==" ON CONFLICT DO UPDATE SET"){let b=n.upsertKeys.map(O=>this.quoteIdentifier(O)),m=n.updateOnDuplicate.map(O=>`${this.quoteIdentifier(O)}=EXCLUDED.${this.quoteIdentifier(O)}`),g=!1;if(n.conflictWhere){if(!this._dialect.supports.inserts.onConflictWhere)throw new Error(`conflictWhere not supported for dialect ${this._dialect.name}`);g=this.whereQuery(n.conflictWhere,n)}u=["ON CONFLICT","(",b.join(","),")",g,"DO UPDATE SET",m.join(",")]}else{if(n.conflictWhere)throw new Error(`conflictWhere not supported for dialect ${this._dialect.name}`);let b=n.updateOnDuplicate.map(m=>`${this.quoteIdentifier(m)}=VALUES(${this.quoteIdentifier(m)})`);u=`${this._dialect.supports.inserts.updateOnDuplicate} ${b.join(",")}`}let l=n.ignoreDuplicates?this._dialect.supports.inserts.ignoreDuplicates:"",f=c.map(b=>this.quoteIdentifier(b)).join(","),d=n.ignoreDuplicates?this._dialect.supports.inserts.onConflictDoNothing:"",h="";if(this._dialect.supports.returnValues&&n.returning){let b=this.generateReturnValues(i,n);h+=b.returningFragment}return Qt.joinSQLFragments(["INSERT",l,"INTO",this.quoteTable(r),`(${f})`,"VALUES",s.join(","),u,d,h,";"])}updateQuery(r,a,n,i,s){i=i||{},ra.defaults(i,this.options),a=Qt.removeNullValuesFromHash(a,i.omitNull,i);let o=[],c=[],u={},l="",f="",d="";(ra.get(this,["sequelize","options","dialectOptions","prependSearchPath"])||i.searchPath)&&(i.bindParam=!1);let h=i.bindParam===void 0?this.bindParam(c):i.bindParam;if(this._dialect.supports["LIMIT ON UPDATE"]&&i.limit&&(["mssql","db2","oracle"].includes(this.dialect)?this.dialect==="oracle"&&(n&&(n.length&&n.length>0||Object.keys(n).length>0)?d+=" AND ":d+=" WHERE ",d+=`rownum <= ${this.escape(i.limit)} `):d=` LIMIT ${this.escape(i.limit)} `),this._dialect.supports.returnValues&&i.returning){let O=this.generateReturnValues(s,i);d+=O.returningFragment,f=O.tmpTable||"",l=O.outputFragment||"",!this._dialect.supports.returnValues.output&&i.returning&&(i.mapToModel=!0)}s&&ra.each(s,(O,z)=>{u[z]=O,O.field&&(u[O.field]=O)});for(let O in a){if(u&&u[O]&&u[O].autoIncrement===!0&&!this._dialect.supports.autoIncrement.update)continue;let z=a[O];z instanceof Qt.SequelizeMethod||i.bindParam===!1?o.push(`${this.quoteIdentifier(O)}=${this.escape(z,u&&u[O]||void 0,{context:"UPDATE"})}`):o.push(`${this.quoteIdentifier(O)}=${this.format(z,u&&u[O]||void 0,{context:"UPDATE"},h)}`)}let b=TC(A2({},i),{bindParam:h});if(o.length===0)return"";let g={query:`${f}UPDATE ${this.quoteTable(r)} SET ${o.join(",")}${l} ${this.whereQuery(n,b)}${d}`.trim()};return i.bindParam!==!1&&(g.bind=c),g}arithmeticQuery(r,a,n,i,s,o){o=o||{},ra.defaults(o,{returning:!0}),s=Qt.removeNullValuesFromHash(s,this.options.omitNull);let c="",u="";if(this._dialect.supports.returnValues&&o.returning){let f=this.generateReturnValues(null,o);c=f.outputFragment,u=f.returningFragment}let l=[];for(let f in i){let d=i[f],h=this.quoteIdentifier(f),b=this.escape(d);l.push(`${h}=${h}${r} ${b}`)}for(let f in s){let d=s[f],h=this.quoteIdentifier(f),b=this.escape(d);l.push(`${h}=${b}`)}return Qt.joinSQLFragments(["UPDATE",this.quoteTable(a),"SET",l.join(","),c,this.whereQuery(n),u])}addIndexQuery(r,a,n,i){n=n||{},Array.isArray(a)?n.fields=a:(n=a,a=void 0),n.prefix=n.prefix||i||r,n.prefix&&typeof n.prefix=="string"&&(n.prefix=n.prefix.replace(/\./g,"_"),n.prefix=n.prefix.replace(/("|')/g,""));let s=n.fields.map(u=>{if(u instanceof Qt.SequelizeMethod)return this.handleSequelizeMethod(u);typeof u=="string"&&(u={name:u});let l="";if(u.attribute&&(u.name=u.attribute),!u.name)throw new Error(`The following index field has no name: ${qC.inspect(u)}`);if(l+=this.quoteIdentifier(u.name),this._dialect.supports.index.collate&&u.collate&&(l+=` COLLATE ${this.quoteIdentifier(u.collate)}`),this._dialect.supports.index.operator){let f=u.operator||n.operator;f&&(l+=` ${f}`)}return this._dialect.supports.index.length&&u.length&&(l+=`(${u.length})`),u.order&&(l+=` ${u.order}`),l});n.name||(n=Qt.nameIndex(n,n.prefix)),n=Uu._conformIndex(n),this._dialect.supports.index.type||delete n.type,n.where&&(n.where=this.whereQuery(n.where)),typeof r=="string"?r=this.quoteIdentifiers(r):r=this.quoteTable(r);let o=this._dialect.supports.index.concurrently&&n.concurrently?"CONCURRENTLY":void 0,c;return this._dialect.supports.indexViaAlter?c=["ALTER TABLE",r,o,"ADD"]:c=["CREATE"],c=c.concat(n.unique?"UNIQUE":"",n.type,"INDEX",this._dialect.supports.indexViaAlter?void 0:o,this.quoteIdentifiers(n.name),this._dialect.supports.index.using===1&&n.using?`USING ${n.using}`:"",this._dialect.supports.indexViaAlter?void 0:`ON ${r}`,this._dialect.supports.index.using===2&&n.using?`USING ${n.using}`:"",`(${s.join(", ")})`,this._dialect.supports.index.parser&&n.parser?`WITH PARSER ${n.parser}`:void 0,this._dialect.supports.index.where&&n.where?n.where:void 0),ra.compact(c).join(" ")}addConstraintQuery(r,a){return typeof r=="string"?r=this.quoteIdentifiers(r):r=this.quoteTable(r),Qt.joinSQLFragments(["ALTER TABLE",r,"ADD",this.getConstraintSnippet(r,a||{}),";"])}getConstraintSnippet(r,a){let n,i,s=a.fields.map(u=>{if(typeof u=="string")return this.quoteIdentifier(u);if(u instanceof Qt.SequelizeMethod)return this.handleSequelizeMethod(u);if(u.attribute&&(u.name=u.attribute),!u.name)throw new Error(`The following index field has no name: ${u}`);return this.quoteIdentifier(u.name)}),o=s.join(", "),c=s.join("_");switch(a.type.toUpperCase()){case"UNIQUE":i=this.quoteIdentifier(a.name||`${r}_${c}_uk`),n=`CONSTRAINT ${i} UNIQUE (${o})`;break;case"CHECK":a.where=this.whereItemsQuery(a.where),i=this.quoteIdentifier(a.name||`${r}_${c}_ck`),n=`CONSTRAINT ${i} CHECK (${a.where})`;break;case"DEFAULT":if(a.defaultValue===void 0)throw new Error("Default value must be specified for DEFAULT CONSTRAINT");if(this._dialect.name!=="mssql")throw new Error("Default constraints are supported only for MSSQL dialect.");i=this.quoteIdentifier(a.name||`${r}_${c}_df`),n=`CONSTRAINT ${i} DEFAULT (${this.escape(a.defaultValue)}) FOR ${s[0]}`;break;case"PRIMARY KEY":i=this.quoteIdentifier(a.name||`${r}_${c}_pk`),n=`CONSTRAINT ${i} PRIMARY KEY (${o})`;break;case"FOREIGN KEY":let u=a.references;if(!u||!u.table||!(u.field||u.fields))throw new Error("references object with table and field must be specified");i=this.quoteIdentifier(a.name||`${r}_${c}_${u.table}_fk`);let l=typeof u.field<"u"?this.quoteIdentifier(u.field):u.fields.map(d=>this.quoteIdentifier(d)).join(", "),f=`${this.quoteTable(u.table)} (${l})`;n=`CONSTRAINT ${i} `,n+=`FOREIGN KEY (${o}) REFERENCES ${f}`,a.onUpdate&&(n+=` ON UPDATE ${a.onUpdate.toUpperCase()}`),a.onDelete&&(n+=` ON DELETE ${a.onDelete.toUpperCase()}`);break;default:throw new Error(`${a.type} is invalid.`)}return a.deferrable&&["UNIQUE","PRIMARY KEY","FOREIGN KEY"].includes(a.type.toUpperCase())&&(n+=` ${this.deferConstraintsQuery(a)}`),n}removeConstraintQuery(r,a){return typeof r=="string"?r=this.quoteIdentifiers(r):r=this.quoteTable(r),Qt.joinSQLFragments(["ALTER TABLE",r,"DROP CONSTRAINT",this.quoteIdentifiers(a)])}quote(r,a,n){let i=["ASC","DESC","ASC NULLS LAST","DESC NULLS LAST","ASC NULLS FIRST","DESC NULLS FIRST","NULLS FIRST","NULLS LAST"];if(n=n||".",typeof r=="string")return this.quoteIdentifiers(r);if(Array.isArray(r)){r.forEach((f,d)=>{let h=r[d-1],b,m;if(!h&&a!==void 0?m=a:h&&h instanceof pA&&(b=h,m=h.target),m&&m.prototype instanceof Uu){let g,O;if(typeof f=="function"&&f.prototype instanceof Uu?g=f:ra.isPlainObject(f)&&f.model&&f.model.prototype instanceof Uu&&(g=f.model,O=f.as),g&&(!O&&b&&b instanceof pA&&b.through&&b.through.model===g?f=new pA(m,g,{as:g.name}):(f=m.getAssociationForAlias(g,O),f||(f=m.getAssociationForAlias(g,g.name))),!(f instanceof pA)))throw new Error(qC.format("Unable to find a valid association for model, '%s'",g.name))}if(typeof f=="string"){let g=i.indexOf(f.toUpperCase());if(d>0&&g!==-1)f=this.sequelize.literal(` ${i[g]}`);else if(m&&m.prototype instanceof Uu){if(m.associations!==void 0&&m.associations[f])f=m.associations[f];else if(m.rawAttributes!==void 0&&m.rawAttributes[f]&&f!==m.rawAttributes[f].field)f=m.rawAttributes[f].field;else if(f.includes(".")&&m.rawAttributes!==void 0){let O=f.split(".");if(m.rawAttributes[O[0]].type instanceof lA.JSON){let z=this.quoteIdentifiers(`${m.name}.${m.rawAttributes[O[0]].field}`),w=O.slice(1);f=this.jsonPathExtractionQuery(z,w),f=this.sequelize.literal(f)}}}}r[d]=f},this);let s=r.length,o=[],c,u=0;for(u=0;u<s-1&&(c=r[u],!(typeof c=="string"||c._modelAttribute||c instanceof Qt.SequelizeMethod));u++)c instanceof pA&&(o[u]=c.as);let l="";return u>0?l+=`${this.quoteIdentifier(o.join(n))}.`:typeof r[0]=="string"&&a&&(l+=`${this.quoteIdentifier(a.name)}.`),r.slice(u).forEach(f=>{l+=this.quote(f,a,n)},this),l}if(r._modelAttribute)return`${this.quoteTable(r.Model.name)}.${this.quoteIdentifier(r.fieldName)}`;if(r instanceof Qt.SequelizeMethod)return this.handleSequelizeMethod(r);throw ra.isPlainObject(r)&&r.raw?new Error('The `{raw: "..."}` syntax is no longer supported.  Use `sequelize.literal` instead.'):new Error(`Unknown structure passed to order / group: ${qC.inspect(r)}`)}_initQuoteIdentifier(){this._quoteIdentifier=this.quoteIdentifier,this.quoteIdentifier=function(r,a){return r==="*"?r:this._quoteIdentifier(r,a)}}quoteIdentifier(r,a){throw new Error(`quoteIdentifier for Dialect "${this.dialect}" is not implemented`)}quoteIdentifiers(r){if(r.includes(".")){r=r.split(".");let a=r.slice(0,r.length-1).join("->"),n=r[r.length-1];return`${this.quoteIdentifier(a)}.${this.quoteIdentifier(n)}`}return this.quoteIdentifier(r)}quoteAttribute(r,a){return a&&r in a.rawAttributes?this.quoteIdentifier(r):this.quoteIdentifiers(r)}getAliasToken(){return"AS"}quoteTable(r,a){let n="";return a===!0&&(a=r.as||r.name||r),ra.isObject(r)?this._dialect.supports.schemas?(r.schema&&(n+=`${this.quoteIdentifier(r.schema)}.`),n+=this.quoteIdentifier(r.tableName)):(r.schema&&(n+=r.schema+(r.delimiter||".")),n+=r.tableName,n=this.quoteIdentifier(n)):n=this.quoteIdentifier(r),a&&(n+=` ${this.getAliasToken()} ${this.quoteIdentifier(a)}`),n}escape(r,a,n){if(n=n||{},r!=null){if(r instanceof Qt.SequelizeMethod)return this.handleSequelizeMethod(r);if(a&&a.type&&(a.type instanceof lA.STRING&&["mysql","mariadb"].includes(this.dialect)&&["number","boolean"].includes(typeof r)&&(r=String(Number(r))),this.validate(r,a,n),a.type.stringify)){let i=s=>I5e.escape(s,this.options.timezone,this.dialect);if(r=a.type.stringify(r,{escape:i,field:a,timezone:this.options.timezone,operation:n.operation}),a.type.escape===!1)return r}}return I5e.escape(r,this.options.timezone,this.dialect)}bindParam(r){return a=>(r.push(a),`$${r.length}`)}format(r,a,n,i){if(n=n||{},r!=null){if(r instanceof Qt.SequelizeMethod)throw new Error("Cannot pass SequelizeMethod as a bind parameter - use escape instead");if(a&&a.type&&(this.validate(r,a,n),a.type.bindParam))return a.type.bindParam(r,{escape:ra.identity,field:a,timezone:this.options.timezone,operation:n.operation,bindParam:i})}return i(r)}validate(r,a,n){if(this.typeValidation&&a.type.validate&&r)try{if(n.isList&&Array.isArray(r))for(let i of r)a.type.validate(i,n);else a.type.validate(r,n)}catch(i){throw i instanceof bJ.ValidationError&&i.errors.push(new bJ.ValidationErrorItem(i.message,"Validation error",a.fieldName,r,null,`${a.type.key} validator`)),i}}isIdentifierQuoted(r){return/^\s*(?:([`"'])(?:(?!\1).|\1{2})*\1\.?)+\s*$/i.test(r)}jsonPathExtractionQuery(r,a,n){let i=ra.toPath(a),s,o=this.isIdentifierQuoted(r)?r:this.quoteIdentifier(r);switch(this.dialect){case"mysql":case"mariadb":case"sqlite":return this.dialect==="mysql"&&(i=i.map(u=>/\D/.test(u)?Qt.addTicks(u,'"'):u)),s=this.escape(["$"].concat(i).join(".").replace(/\.(\d+)(?:(?=\.)|$)/g,(u,l)=>`[${l}]`)),this.dialect==="sqlite"?`json_extract(${o},${s})`:`json_unquote(json_extract(${o},${s}))`;case"postgres":let c=n?"#>":"#>>";return s=this.escape(`{${i.join(",")}}`),`(${o}${c}${s})`;default:throw new Error(`Unsupported ${this.dialect} for JSON operations`)}}selectQuery(r,a,n){a=a||{};let i=a.limit,s=[],o=[],c=a.subQuery===void 0?i&&a.hasMultiAssociation:a.subQuery,u={main:a.attributes&&a.attributes.slice(),subQuery:null},l={name:r,quotedName:null,as:null,model:n},f={names:l,options:a,subQuery:c},d=[],h=[],b;if(this.options.minifyAliases&&!a.aliasesMapping&&(a.aliasesMapping=new Map,a.aliasesByTable={},a.includeAliases=new Map),a.tableAs?l.as=this.quoteIdentifier(a.tableAs):!Array.isArray(l.name)&&l.model&&(l.as=this.quoteIdentifier(l.model.name)),l.quotedName=Array.isArray(l.name)?r.map(g=>Array.isArray(g)?this.quoteTable(g[0],g[1]):this.quoteTable(g,!0)).join(", "):this.quoteTable(l.name),c&&u.main)for(let g of l.model.primaryKeyAttributes)u.main.some(O=>g===O||g===O[0]||g===O[1])||u.main.push(l.model.rawAttributes[g].field?[g,l.model.rawAttributes[g].field]:g);if(u.main=this.escapeAttributes(u.main,a,l.as),u.main=u.main||(a.include?[`${l.as}.*`]:["*"]),(c||a.groupedLimit)&&(u.subQuery=u.main,u.main=[`${l.as||l.quotedName}.*`]),a.include)for(let g of a.include){if(g.separate)continue;let O=this.generateInclude(g,{externalAs:l.as,internalAs:l.as},f);h=h.concat(O.subQuery),d=d.concat(O.mainQuery),O.attributes.main.length>0&&(u.main=ra.uniq(u.main.concat(O.attributes.main))),O.attributes.subQuery.length>0&&(u.subQuery=ra.uniq(u.subQuery.concat(O.attributes.subQuery)))}if(c)o.push(this.selectFromTableFragment(a,l.model,u.subQuery,l.quotedName,l.as)),o.push(h.join(""));else{if(a.groupedLimit){l.as||(l.as=l.quotedName);let g=A2({},a.where),O,z,w,v=l.as;if(typeof a.groupedLimit.on=="string"?z=a.groupedLimit.on:a.groupedLimit.on instanceof wor&&(z=a.groupedLimit.on.foreignKeyField),a.groupedLimit.on instanceof Eor){v=a.groupedLimit.on.manyFromSource.as;let P=Uu._validateIncludedElements({include:[{association:a.groupedLimit.on.manyFromSource,duplicating:!1,required:!0,where:A2({[Rt.placeholder]:!0},a.groupedLimit.through&&a.groupedLimit.through.where)}],model:n});a.hasJoin=!0,a.hasMultiAssociation=!0,a.includeMap=Object.assign(P.includeMap,a.includeMap),a.includeNames=P.includeNames.concat(a.includeNames||[]),w=P.include,Array.isArray(a.order)&&(a.order.forEach((C,Q)=>{Array.isArray(C)&&(C=C[0]);let X=`subquery_order_${Q}`;a.attributes.push([C,X]),X=this.sequelize.literal(this.quote(X)),Array.isArray(a.order[Q])?a.order[Q][0]=X:a.order[Q]=X}),O=a.order)}else O=a.order,this._dialect.supports.topLevelOrderByRequired||delete a.order,g[Rt.placeholder]=!0;let T=`SELECT * FROM (${this.selectQuery(r,{attributes:a.attributes,offset:a.offset,limit:a.groupedLimit.limit,order:O,aliasesMapping:a.aliasesMapping,aliasesByTable:a.aliasesByTable,where:g,include:w,model:n},n).replace(/;$/,"")}) ${this.getAliasToken()} sub`,x=this.whereItemQuery(Rt.placeholder,!0,{model:n}),L=T.indexOf(x);s.push(this.selectFromTableFragment(a,l.model,u.main,`(${a.groupedLimit.values.map(P=>{let C;return z&&(C={[z]:P}),w&&(C={[a.groupedLimit.on.foreignIdentifierField]:P}),Qt.spliceStr(T,L,x.length,this.getWhereConditions(C,v))}).join(this._dialect.supports["UNION ALL"]?" UNION ALL ":" UNION ")})`,l.as))}else s.push(this.selectFromTableFragment(a,l.model,u.main,l.quotedName,l.as));s.push(d.join(""))}if(Object.prototype.hasOwnProperty.call(a,"where")&&!a.groupedLimit&&(a.where=this.getWhereConditions(a.where,l.as||r,n,a),a.where&&(c?o.push(` WHERE ${a.where}`):(s.push(` WHERE ${a.where}`),s.forEach((g,O)=>{g.startsWith("SELECT")&&(s[O]=this.selectFromTableFragment(a,n,u.main,l.quotedName,l.as,a.where))})))),a.group&&(a.group=Array.isArray(a.group)?a.group.map(g=>this.aliasGrouping(g,n,l.as,a)).join(", "):this.aliasGrouping(a.group,n,l.as,a),c&&a.group?o.push(` GROUP BY ${a.group}`):a.group&&s.push(` GROUP BY ${a.group}`)),Object.prototype.hasOwnProperty.call(a,"having")&&(a.having=this.getWhereConditions(a.having,r,n,a,!1),a.having&&(c?o.push(` HAVING ${a.having}`):s.push(` HAVING ${a.having}`))),a.order){let g=this.getQueryOrders(a,n,c);g.mainQueryOrder.length&&s.push(` ORDER BY ${g.mainQueryOrder.join(", ")}`),g.subQueryOrder.length&&o.push(` ORDER BY ${g.subQueryOrder.join(", ")}`)}let m=this.addLimitAndOffset(a,l.model);if(m&&!a.groupedLimit&&(c?o.push(m):s.push(m)),c?(this._throwOnEmptyAttributes(u.main,{modelName:n&&n.name,as:l.as}),b=`SELECT ${u.main.join(", ")} FROM (${o.join("")}) ${this.getAliasToken()} ${l.as}${d.join("")}${s.join("")}`):b=s.join(""),a.lock&&this._dialect.supports.lock){let g=a.lock;typeof a.lock=="object"&&(g=a.lock.level),this._dialect.supports.lockKey&&["KEY SHARE","NO KEY UPDATE"].includes(g)?b+=` FOR ${g}`:g==="SHARE"?b+=` ${this._dialect.supports.forShare}`:b+=" FOR UPDATE",this._dialect.supports.lockOf&&a.lock.of&&a.lock.of.prototype instanceof Uu&&(b+=` OF ${this.quoteTable(a.lock.of.name)}`),this._dialect.supports.skipLocked&&a.skipLocked&&(b+=" SKIP LOCKED")}return`${b};`}aliasGrouping(r,a,n,i){let s=Array.isArray(r)?r[0]:r;return this.quote(this._getAliasForField(n,s,i)||s,a)}escapeAttributes(r,a,n){return r&&r.map(i=>{let s=!0;if(i instanceof Qt.SequelizeMethod)return this.handleSequelizeMethod(i);if(Array.isArray(i)){if(i.length!==2)throw new Error(`${JSON.stringify(i)} is not a valid attribute definition. Please use the following format: ['attribute definition', 'alias']`);if(i=i.slice(),i[0]instanceof Qt.SequelizeMethod)i[0]=this.handleSequelizeMethod(i[0]),s=!1;else if(this.options.attributeBehavior==="escape"||!i[0].includes("(")&&!i[0].includes(")"))i[0]=this.quoteIdentifier(i[0]);else if(this.options.attributeBehavior!=="unsafe-legacy")throw new Error(`Attributes cannot include parentheses in Sequelize 6:
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            

Error: Please install mysql2 package manually
    at t._loadDialectModule (/home/wiomgjqe/neduas.store/server.js:124:7832)
    at new t (/home/wiomgjqe/neduas.store/server.js:136:66644)
    at new O1 (/home/wiomgjqe/neduas.store/server.js:136:73185)
    at new t (/home/wiomgjqe/neduas.store/server.js:136:229204)
    at Object.<anonymous> (/home/wiomgjqe/neduas.store/server.js:3649:2755)
    at Module._compile (node:internal/modules/cjs/loader:1275:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1329:10)
    at Module.load (node:internal/modules/cjs/loader:1133:32)
    at Module._load (node:internal/modules/cjs/loader:972:12)
    at Module.require (node:internal/modules/cjs/loader:1157:19)

Node.js v19.9.0
/home/wiomgjqe/neduas.store/server.js:124
`}};MC.AggregateError=sJ});var n5e=A(AC=>{"use strict";Object.defineProperty(AC,"__esModule",{value:!0});AC.Deferred=void 0;var Tsr=iJ(),cJ=class{constructor(){this._promise=new Promise((r,a)=>{this._reject=a,this._resolve=r})}registerTimeout(r,a){this._timeout||(this._timeout=setTimeout(()=>{a(),this.reject(new Tsr.TimeoutError("Operation timeout"))},r))}_clearTimeout(){this._timeout&&clearTimeout(this._timeout)}resolve(r){this._clearTimeout(),this._resolve(r)}reject(r){this._clearTimeout(),this._reject(r)}promise(){return this._promise}};AC.Deferred=cJ});var i5e=A(OC=>{"use strict";Object.defineProperty(OC,"__esModule",{value:!0});OC.Pool=void 0;var qsr=n5e(),Nsr=oJ(),uJ=class{constructor(r){if(this.log=!1,!r.create)throw new Error("create function is required");if(!r.destroy)throw new Error("destroy function is required");if(!r.validate)throw new Error("validate function is required");if(typeof r.min!="number"||r.min<0||r.min!==Math.round(r.min))throw new Error("min must be an integer >= 0");if(typeof r.max!="number"||r.max<=0||r.max!==Math.round(r.max))throw new Error("max must be an integer > 0");if(r.min>r.max)throw new Error("max is smaller than min");if(r.maxUses!==void 0&&(typeof r.maxUses!="number"||r.maxUses<0))throw new Error("maxUses must be an integer >= 0");this.idleTimeoutMillis=r.idleTimeoutMillis||3e4,this.acquireTimeoutMillis=r.acquireTimeoutMillis||3e4,this.reapIntervalMillis=r.reapIntervalMillis||1e3,this.maxUsesPerResource=r.maxUses||1/0,this.log=r.log||!1,this._factory=r,this._count=0,this._draining=!1,this._pendingAcquires=[],this._inUseObjects=[],this._availableObjects=[],this._removeIdleScheduled=!1}get size(){return this._count}get name(){return this._factory.name}get available(){return this._availableObjects.length}get using(){return this._inUseObjects.length}get waiting(){return this._pendingAcquires.length}get maxSize(){return this._factory.max}get minSize(){return this._factory.min}_log(r,a){typeof this.log=="function"?this.log(r,a):this.log&&console.log(`${a.toUpperCase()} pool ${this.name||""} - ${r}`)}_removeIdle(){let r=[],a=Date.now(),n,i=this._availableObjects.length,s=this.size-this.minSize,o;for(this._removeIdleScheduled=!1,n=0;n<i&&s>r.length;n++)o=this._availableObjects[n].timeout,a>=o&&(this._log("removeIdle() destroying obj - now:"+a+" timeout:"+o,"verbose"),r.push(this._availableObjects[n].resource));r.forEach(this.destroy,this),i=this._availableObjects.length,i>0?(this._log("this._availableObjects.length="+i,"verbose"),this._scheduleRemoveIdle()):this._log("removeIdle() all objects removed","verbose")}_scheduleRemoveIdle(){this._removeIdleScheduled||(this._removeIdleScheduled=!0,this._removeIdleTimer=setTimeout(()=>{this._removeIdle()},this.reapIntervalMillis))}_dispense(){let r=null,a=this._pendingAcquires.length;if(this._log(`dispense() clients=${a} available=${this._availableObjects.length}`,"info"),!(a<1)){for(;this._availableObjects.length>0;){if(this._log("dispense() - reusing obj","verbose"),r=this._availableObjects[this._availableObjects.length-1],!this._factory.validate(r.resource)){this.destroy(r.resource);continue}return this._availableObjects.pop(),this._addResourceToInUseObjects(r.resource,r.useCount),this._pendingAcquires.shift().resolve(r.resource)}this.size<this.maxSize&&this._createResource()}}_createResource(){this._count+=1,this._log(`createResource() - creating obj - count=${this.size} min=${this.minSize} max=${this.maxSize}`,"verbose"),this._factory.create().then(r=>{let a=this._pendingAcquires.shift();a?(this._addResourceToInUseObjects(r,0),a.resolve(r)):this._addResourceToAvailableObjects(r,0)}).catch(r=>{let a=this._pendingAcquires.shift();this._count-=1,this._count<0&&(this._count=0),a&&a.reject(r),process.nextTick(()=>{this._dispense()})})}_addResourceToAvailableObjects(r,a){let n={resource:r,useCount:a,timeout:Date.now()+this.idleTimeoutMillis};this._availableObjects.push(n),this._dispense(),this._scheduleRemoveIdle()}_addResourceToInUseObjects(r,a){let n={resource:r,useCount:a};this._inUseObjects.push(n)}_ensureMinimum(){let r,a;if(!this._draining&&this.size<this.minSize)for(a=this.minSize-this.size,r=0;r<a;r++)this._createResource()}acquire(){if(this._draining)return Promise.reject(new Error("pool is draining and cannot accept work"));let r=new qsr.Deferred;return r.registerTimeout(this.acquireTimeoutMillis,()=>{this._pendingAcquires=this._pendingAcquires.filter(a=>a!==r)}),this._pendingAcquires.push(r),this._dispense(),r.promise()}release(r){if(this._availableObjects.some(i=>i.resource===r)){this._log("release called twice for the same resource: "+new Error().stack,"error");return}let a=this._inUseObjects.findIndex(i=>i.resource===r);if(a<0){this._log("attempt to release an invalid resource: "+new Error().stack,"error");return}let n=this._inUseObjects[a];n.useCount+=1,n.useCount>=this.maxUsesPerResource?(this._log("release() destroying obj - useCount:"+n.useCount+" maxUsesPerResource:"+this.maxUsesPerResource,"verbose"),this.destroy(n.resource),this._dispense()):(this._inUseObjects.splice(a,1),this._addResourceToAvailableObjects(n.resource,n.useCount))}async destroy(r){let a=this._availableObjects.length,n=this._inUseObjects.length;if(this._availableObjects=this._availableObjects.filter(i=>i.resource!==r),this._inUseObjects=this._inUseObjects.filter(i=>i.resource!==r),a===this._availableObjects.length&&n===this._inUseObjects.length){this._ensureMinimum();return}this._count-=1,this._count<0&&(this._count=0);try{await this._factory.destroy(r)}finally{this._ensureMinimum(),this._draining||process.nextTick(()=>{this._dispense()})}}drain(){this._log("draining","info"),this._draining=!0;let r=a=>{if(this._pendingAcquires.length>0){this._dispense(),setTimeout(()=>{r(a)},100);return}if(this._availableObjects.length!==this._count){setTimeout(()=>{r(a)},100);return}a()};return new Promise(a=>r(a))}async destroyAllNow(){this._log("force destroying all objects","info"),this._removeIdleScheduled=!1,clearTimeout(this._removeIdleTimer);let r=this._availableObjects.map(n=>n.resource),a=[];for(let n of r)try{await this.destroy(n)}catch(i){this._log("Error destroying resource: "+i.stack,"error"),a.push(i)}if(a.length>0)throw new Nsr.AggregateError(a)}};OC.Pool=uJ});var s5e=A(Nh=>{"use strict";Object.defineProperty(Nh,"__esModule",{value:!0});Nh.Pool=Nh.AggregateError=Nh.TimeoutError=void 0;var Isr=iJ();Object.defineProperty(Nh,"TimeoutError",{enumerable:!0,get:function(){return Isr.TimeoutError}});var Ssr=oJ();Object.defineProperty(Nh,"AggregateError",{enumerable:!0,get:function(){return Ssr.AggregateError}});var xsr=i5e();Object.defineProperty(Nh,"Pool",{enumerable:!0,get:function(){return xsr.Pool}})});var Df=A((j9a,yC)=>{"use strict";var{Pool:lJ,TimeoutError:ksr}=s5e(),Ih=hr(),pJ=qh(),Csr=cn(),{logger:Lsr}=Ti(),Dsr=nA(),Jl=Lsr.debugContext("pool"),uR=class{constructor(r,a){let n=Ih.cloneDeep(a.config);if(this.sequelize=a,this.config=n,this.dialect=r,this.versionPromise=null,this.dialectName=this.sequelize.options.dialect,n.pool===!1)throw new Error("Support for pool:false was removed in v4.0");n.pool=Ih.defaults(n.pool||{},{max:5,min:0,idle:1e4,acquire:6e4,evict:1e3,validate:this._validate.bind(this)}),this.initPools()}refreshTypeParser(r){Ih.each(r,a=>{if(Object.prototype.hasOwnProperty.call(a,"parse"))if(a.types[this.dialectName])this._refreshTypeParser(a);else throw new Error(`Parse function not supported for type ${a.key} in dialect ${this.dialectName}`)})}_loadDialectModule(r){try{return this.sequelize.config.dialectModulePath?require(this.sequelize.config.dialectModulePath):this.sequelize.config.dialectModule?this.sequelize.config.dialectModule:require(r)}catch(a){throw a.code==="MODULE_NOT_FOUND"?this.sequelize.config.dialectModulePath?new Error(`Unable to find dialect at ${this.sequelize.config.dialectModulePath}`):new Error(`Please install ${r} package manually`):a}}async _onProcessExit(){if(this.pool)return await this.pool.drain(),Jl("connection drain due to process exit"),await this.pool.destroyAllNow()}async close(){return this.getConnection=async function(){throw new Error("ConnectionManager.getConnection was called after the connection manager was closed!")},await this._onProcessExit()}initPools(){let r=this.config;if(!r.replication){this.pool=new lJ({name:"sequelize",create:()=>this._connect(r),destroy:async n=>{let i=await this._disconnect(n);return Jl("connection destroy"),i},validate:r.pool.validate,max:r.pool.max,min:r.pool.min,acquireTimeoutMillis:r.pool.acquire,idleTimeoutMillis:r.pool.idle,reapIntervalMillis:r.pool.evict,maxUses:r.pool.maxUses}),Jl(`pool created with max/min: ${r.pool.max}/${r.pool.min}, no replication`);return}Array.isArray(r.replication.read)||(r.replication.read=[r.replication.read]),r.replication.write=Ih.defaults(r.replication.write,Ih.omit(r,"replication")),r.replication.read=r.replication.read.map(n=>Ih.defaults(n,Ih.omit(this.config,"replication")));let a=0;this.pool={release:n=>{n.queryType==="read"?this.pool.read.release(n):this.pool.write.release(n)},acquire:(n,i)=>(i=i===void 0?!1:i,n==="SELECT"&&!i?this.pool.read.acquire():this.pool.write.acquire()),destroy:n=>{this.pool[n.queryType].destroy(n),Jl("connection destroy")},destroyAllNow:async()=>{await Promise.all([this.pool.read.destroyAllNow(),this.pool.write.destroyAllNow()]),Jl("all connections destroyed")},drain:async()=>Promise.all([this.pool.write.drain(),this.pool.read.drain()]),read:new lJ({name:"sequelize:read",create:async()=>{let n=a++%r.replication.read.length,i=await this._connect(r.replication.read[n]);return i.queryType="read",i},destroy:n=>this._disconnect(n),validate:r.pool.validate,max:r.pool.max,min:r.pool.min,acquireTimeoutMillis:r.pool.acquire,idleTimeoutMillis:r.pool.idle,reapIntervalMillis:r.pool.evict,maxUses:r.pool.maxUses}),write:new lJ({name:"sequelize:write",create:async()=>{let n=await this._connect(r.replication.write);return n.queryType="write",n},destroy:n=>this._disconnect(n),validate:r.pool.validate,max:r.pool.max,min:r.pool.min,acquireTimeoutMillis:r.pool.acquire,idleTimeoutMillis:r.pool.idle,reapIntervalMillis:r.pool.evict,maxUses:r.pool.maxUses})},Jl(`pool created with max/min: ${r.pool.max}/${r.pool.min}, with replication`)}async getConnection(r){r=r||{},this.sequelize.options.databaseVersion===0&&(this.versionPromise||(this.versionPromise=(async()=>{try{let n=await this._connect(this.config.replication.write||this.config),i={};if(i.transaction={connection:n},i.logging=()=>{},i.logging.__testLoggingFn=!0,this.sequelize.options.databaseVersion===0){let s=await this.sequelize.databaseVersion(i),o=Ih.get(pJ.coerce(s),"version")||s;this.sequelize.options.databaseVersion=pJ.valid(o)?o:this.dialect.defaultVersion}return pJ.lt(this.sequelize.options.databaseVersion,this.dialect.defaultVersion)&&(Dsr.unsupportedEngine(),Jl(`Unsupported database engine version ${this.sequelize.options.databaseVersion}`)),this.versionPromise=null,await this._disconnect(n)}catch(n){throw this.versionPromise=null,n}})()),await this.versionPromise);let a;try{await this.sequelize.runHooks("beforePoolAcquire",r),a=await this.pool.acquire(r.type,r.useMaster),await this.sequelize.runHooks("afterPoolAcquire",a,r)}catch(n){throw n instanceof ksr?new Csr.ConnectionAcquireTimeoutError(n):n}return Jl("connection acquired"),a}releaseConnection(r){this.pool.release(r),Jl("connection released")}async destroyConnection(r){await this.pool.destroy(r),Jl(`connection ${r.uuid} destroyed`)}async _connect(r){await this.sequelize.runHooks("beforeConnect",r);let a=await this.dialect.connectionManager.connect(r);return await this.sequelize.runHooks("afterConnect",a,r),a}async _disconnect(r){return await this.sequelize.runHooks("beforeDisconnect",r),await this.dialect.connectionManager.disconnect(r),this.sequelize.runHooks("afterDisconnect",r)}_validate(r){return this.dialect.connectionManager.validate?this.dialect.connectionManager.validate(r):!0}};yC.exports=uR;yC.exports.ConnectionManager=uR;yC.exports.default=uR});var Vc=A((G9a,o5e)=>{"use strict";var lR=new Map;o5e.exports=t=>(lR.has(t)||lR.set(t,new Map),{clear(){lR.get(t).clear()},refresh(r){for(let a of r.types[t])lR.get(t).set(a,r.parse)},get(r){return lR.get(t).get(r)}})});var p5e=A((Q9a,EC)=>{"use strict";var Bsr=Object.defineProperty,c5e=Object.getOwnPropertySymbols,Psr=Object.prototype.hasOwnProperty,Wsr=Object.prototype.propertyIsEnumerable,u5e=(t,r,a)=>r in t?Bsr(t,r,{enumerable:!0,configurable:!0,writable:!0,value:a}):t[r]=a,Usr=(t,r)=>{for(var a in r||(r={}))Psr.call(r,a)&&u5e(t,a,r[a]);if(c5e)for(var a of c5e(r))Wsr.call(r,a)&&u5e(t,a,r[a]);return t},Fsr=qh(),jsr=Df(),uA=cn(),{logger:Gsr}=Ti(),Qsr=Ja().mariadb,Hsr=Hl(),l5e=Gsr.debugContext("connection:mariadb"),zC=Vc()("mariadb"),pR=class t extends jsr{constructor(r,a){a.config.port=a.config.port||3306,super(r,a),this.lib=this._loadDialectModule("mariadb"),this.refreshTypeParser(Qsr)}static _typecast(r,a){return zC.get(r.type)?zC.get(r.type)(r,this.sequelize.options,a):a()}_refreshTypeParser(r){zC.refresh(r)}_clearTypeParser(){zC.clear()}async connect(r){let a=this.sequelize.options.timezone;a=/\//.test(a)?Hsr.tz(a).format("Z"):a;let n=Usr({host:r.host,port:r.port,user:r.username,password:r.password,database:r.database,timezone:a,typeCast:t._typecast.bind(this),bigNumberStrings:!1,supportBigNumbers:!0,foundRows:!1},r.dialectOptions);this.sequelize.config.keepDefaultTimezone||(n.initSql?(Array.isArray(n.initSql)||(n.initSql=[n.initSql]),n.initSql.push(`SET time_zone = '${a}'`)):n.initSql=`SET time_zone = '${a}'`);try{let i=await this.lib.createConnection(n);return this.sequelize.options.databaseVersion=Fsr.coerce(i.serverVersion()).version,l5e("connection acquired"),i.on("error",s=>{switch(s.code){case"ESOCKET":case"ECONNRESET":case"EPIPE":case"PROTOCOL_CONNECTION_LOST":this.pool.destroy(i)}}),i}catch(i){switch(i.code){case"ECONNREFUSED":throw new uA.ConnectionRefusedError(i);case"ER_ACCESS_DENIED_ERROR":case"ER_ACCESS_DENIED_NO_PASSWORD_ERROR":throw new uA.AccessDeniedError(i);case"ENOTFOUND":throw new uA.HostNotFoundError(i);case"EHOSTUNREACH":case"ENETUNREACH":case"EADDRNOTAVAIL":throw new uA.HostNotReachableError(i);case"EINVAL":throw new uA.InvalidConnectionError(i);default:throw new uA.ConnectionError(i)}}}async disconnect(r){if(!r.isValid()){l5e("connection tried to disconnect but was already at CLOSED state");return}return await r.end()}validate(r){return r&&r.isValid()}};EC.exports=pR;EC.exports.ConnectionManager=pR;EC.exports.default=pR});var Bf=A((H9a,wC)=>{"use strict";var Vsr=Object.defineProperty,f5e=Object.getOwnPropertySymbols,$sr=Object.prototype.hasOwnProperty,Ysr=Object.prototype.propertyIsEnumerable,d5e=(t,r,a)=>r in t?Vsr(t,r,{enumerable:!0,configurable:!0,writable:!0,value:a}):t[r]=a,Xsr=(t,r)=>{for(var a in r||(r={}))$sr.call(r,a)&&d5e(t,a,r[a]);if(f5e)for(var a of f5e(r))Ysr.call(r,a)&&d5e(t,a,r[a]);return t},Sh=hr(),Ksr=Cv(),rc=m1(),Jsr=Wv(),Zsr=nA(),eor=(JM(),gf(KM)).v4,{safeStringifyJson:h5e}=On(),fR=class t{constructor(r,a,n){this.uuid=eor(),this.connection=r,this.instance=n.instance,this.model=n.model,this.sequelize=a,this.options=Xsr({plain:!1,raw:!1,logging:console.log},n),this.checkLoggingOption(),n.rawErrors&&(this.formatError=t.prototype.formatError)}static formatBindParameters(r,a,n,i,s){if(!a)return[r,[]];if(s=s||{},typeof i!="function"&&(s=i||{},i=void 0),!i)s.skipValueReplace?i=(u,l,f)=>{if(f[l]!==void 0)return u}:i=(u,l,f,d,h)=>{if(f[l]!==void 0)return Ksr.escape(f[l],d,h)};else if(s.skipValueReplace){let u=i;i=(l,f,d,h,b,m)=>{if(u(l,f,d,h,b,m)!==void 0)return l}}let o=null,c=Array.isArray(a);return r=r.replace(/\B\$(\$|\w+)/g,(u,l)=>{if(l==="$")return s.skipUnescape?u:l;let f;if(c?l.match(/^[1-9]\d*$/)&&(l=l-1,f=i(u,l,a,o,n,s)):l.match(/^\d*$/)||(f=i(u,l,a,o,n,s)),f===void 0)throw new Error(`Named bind parameter "${u}" has no value in the given object.`);return f}),[r,[]]}formatError(r,a){return r.stack=a,r}run(){throw new Error("The run method wasn't overwritten!")}checkLoggingOption(){this.options.logging===!0&&(Zsr.noTrueLogging(),this.options.logging=console.log)}getInsertIdField(){return"insertId"}getUniqueConstraintErrorMessage(r){let a=r?`${r} must be unique`:"Must be unique";if(r&&this.model)for(let n of Object.keys(this.model.uniqueKeys))this.model.uniqueKeys[n].fields.includes(r.replace(/"/g,""))&&this.model.uniqueKeys[n].msg&&(a=this.model.uniqueKeys[n].msg);return a}isRawQuery(){return this.options.type===rc.RAW}isVersionQuery(){return this.options.type===rc.VERSION}isUpsertQuery(){return this.options.type===rc.UPSERT}isInsertQuery(r,a){let n=!0;return this.options.type===rc.INSERT?!0:(n=n&&this.sql.toLowerCase().startsWith("insert into"),n=n&&(!r||Object.prototype.hasOwnProperty.call(r,this.getInsertIdField())),n=n&&(!a||Object.prototype.hasOwnProperty.call(a,this.getInsertIdField())),n)}handleInsertQuery(r,a){if(this.instance){let n=this.model.autoIncrementAttribute,i=null;i=i||r&&r[this.getInsertIdField()],i=i||a&&a[this.getInsertIdField()],this.instance[n]=i}}isShowTablesQuery(){return this.options.type===rc.SHOWTABLES}handleShowTablesQuery(r){return Sh.flatten(r.map(a=>Object.values(a)))}isShowIndexesQuery(){return this.options.type===rc.SHOWINDEXES}isShowConstraintsQuery(){return this.options.type===rc.SHOWCONSTRAINTS}isDescribeQuery(){return this.options.type===rc.DESCRIBE}isSelectQuery(){return this.options.type===rc.SELECT}isBulkUpdateQuery(){return this.options.type===rc.BULKUPDATE}isBulkDeleteQuery(){return this.options.type===rc.BULKDELETE}isForeignKeysQuery(){return this.options.type===rc.FOREIGNKEYS}isUpdateQuery(){return this.options.type===rc.UPDATE}handleSelectQuery(r){let a=null;if(this.options.fieldMap){let n=this.options.fieldMap;r=r.map(i=>Sh.reduce(n,(s,o,c)=>(s[c]!==void 0&&o!==c&&(s[o]=s[c],delete s[c]),s),i))}return this.options.raw?a=r.map(n=>{let i={};for(let s in n)Object.prototype.hasOwnProperty.call(n,s)&&(i[s]=n[s]);return this.options.nest&&(i=Jsr.transform(i)),i}):this.options.hasJoin===!0?(r=t._groupJoinData(r,{model:this.model,includeMap:this.options.includeMap,includeNames:this.options.includeNames},{checkExisting:this.options.hasMultiAssociation}),a=this.model.bulkBuild(r,{isNewRecord:!1,include:this.options.include,includeNames:this.options.includeNames,includeMap:this.options.includeMap,includeValidated:!0,attributes:this.options.originalAttributes||this.options.attributes,raw:!0})):a=this.model.bulkBuild(r,{isNewRecord:!1,raw:!0,attributes:this.options.originalAttributes||this.options.attributes}),this.options.plain&&(a=a.length===0?null:a[0]),a}isShowOrDescribeQuery(){let r=!1;return r=r||this.sql.toLowerCase().startsWith("show"),r=r||this.sql.toLowerCase().startsWith("describe"),r}isCallQuery(){return this.sql.toLowerCase().startsWith("call")}_logQuery(r,a,n){let{connection:i,options:s}=this,o=this.sequelize.options.benchmark||s.benchmark,c=this.sequelize.options.logQueryParameters||s.logQueryParameters,u=Date.now(),l="";if(c&&n){let h=r.endsWith(";")?"":";",b;Array.isArray(n)?b=n.map(m=>h5e(m)).join(", "):b=h5e(n),l=`${h} ${b}`}let f=`(${i.uuid||"default"}): ${r}${l}`,d=`Executing ${f}`;return a(d),o||this.sequelize.log(`Executing ${f}`,s),()=>{let h=`Executed ${f}`;a(h),o&&this.sequelize.log(h,Date.now()-u,s)}}static _groupJoinData(r,a,n){if(!r.length)return[];let i,s,o,c,u,l,f=r.length,d,h,b,m,g,O,z,w,v=n.checkExisting,T,x,L,P=v?[]:new Array(f),C={},Q={},X,k,se,F,D,j,V,he,oe=ne=>{Object.prototype.hasOwnProperty.call(j.includeMap,ne)&&(Q[h]=j=j.includeMap[ne],he?he=`${he}.${ne}`:he=ne,Q[he]=j)},ie={},De=(ne,we)=>(Object.prototype.hasOwnProperty.call(we,ne)||(we[ne]=ne.substr(0,ne.lastIndexOf("."))),we[ne]),Ge={},Ze=ne=>{if(!Object.prototype.hasOwnProperty.call(Ge,ne)){let we=ne.lastIndexOf(".");Ge[ne]=ne.substr(we===-1?0:we+1)}return Ge[ne]},te={},me=ne=>{if(!Object.prototype.hasOwnProperty.call(te,ne)){let we=De(ne,ie);Object.prototype.hasOwnProperty.call(te,we)||(te[we]=we?we.split("."):[]),te[ne]=te[we]}return te[ne]},ve={},ye=ne=>{if(!Object.prototype.hasOwnProperty.call(ve,ne)){let we=me(ne),ke=we.length;ve[ne]=ke?we[ke-1]:""}return ve[ne]},Qe=ne=>{let we=Sh.chain(ne.uniqueKeys);return we=we.result(`${we.findKey()}.fields`).map(ke=>Sh.findKey(ne.attributes,je=>je.field===ke)).value(),we},Ke=ne=>ne instanceof Buffer?ne.toString("hex"):ne,Se,ft,qe;for(u=0;u<f;u++){if(l=r[u],u===0&&(d=Sh.sortBy(Object.keys(l),ne=>[ne.split(".").length]),m=d.length),v){if(w=!1,c=a.model.primaryKeyAttributes.length,L="",c===1)L=Ke(l[a.model.primaryKeyAttributes[0]]);else if(c>1)for(o=0;o<c;o++)L+=Ke(l[a.model.primaryKeyAttributes[o]]);else if(!Sh.isEmpty(a.model.uniqueKeys))for(ft=Qe(a.model),o=0;o<ft.length;o++)L+=l[ft[o]]}for(z=O={},F=void 0,b=0;b<m;b++){if(h=d[b],k=De(h,ie),X=me(h),u===0&&!Object.prototype.hasOwnProperty.call(Q,h)&&(X.length?(j=a,he=void 0,X.forEach(oe)):Q[h]=Q[""]=a),F!==void 0&&F!==X){if(v){if(s=F.length,V=null,x=null,s)for(i=0;i<s;i++){if(qe=V?`${V}.${F[i]}`:F[i],Se=Q[qe].model.primaryKeyAttributes,c=Se.length,T=qe,c===1)T+=Ke(l[`${qe}.${Se[0]}`]);else if(c>1)for(o=0;o<c;o++)T+=Ke(l[`${qe}.${Se[o]}`]);else if(!Sh.isEmpty(Q[qe].model.uniqueKeys))for(ft=Qe(Q[qe].model),o=0;o<ft.length;o++)T+=l[`${qe}.${ft[o]}`];x||(x=L),T=x+T,V=qe,i<s-1&&(x=T)}else T=L;T===L?C[T]?w=!0:C[T]=O:C[T]||(V=C[x],D=ye(g),Q[g].association.isSingleAssociation?V&&(V[D]=C[T]=O):(V[D]||(V[D]=[]),V[D].push(C[T]=O))),O={}}else if(j=z,s=X.length,s)for(i=0;i<s;i++)i===s-1&&(O=j[X[i]]={}),j=j[X[i]]||{}}O[Ze(h)]=l[h],g=h,F=X,se=k}if(v){if(s=F.length,V=null,x=null,s)for(i=0;i<s;i++){if(qe=V?`${V}.${F[i]}`:F[i],Se=Q[qe].model.primaryKeyAttributes,c=Se.length,T=qe,c===1)T+=Ke(l[`${qe}.${Se[0]}`]);else if(c>0)for(o=0;o<c;o++)T+=Ke(l[`${qe}.${Se[o]}`]);else if(!Sh.isEmpty(Q[qe].model.uniqueKeys))for(ft=Qe(Q[qe].model),o=0;o<ft.length;o++)T+=l[`${qe}.${ft[o]}`];x||(x=L),T=x+T,V=qe,i<s-1&&(x=T)}else T=L;T===L?C[T]?w=!0:C[T]=O:C[T]||(V=C[x],D=ye(g),Q[g].association.isSingleAssociation?V&&(V[D]=C[T]=O):(V[D]||(V[D]=[]),V[D].push(C[T]=O))),w||P.push(z)}else P[u]=z}return P}};wC.exports=fR;wC.exports.AbstractQuery=fR;wC.exports.default=fR});var y5e=A((V9a,O5e)=>{"use strict";var tor=Object.defineProperty,b5e=Object.getOwnPropertySymbols,ror=Object.prototype.hasOwnProperty,aor=Object.prototype.propertyIsEnumerable,m5e=(t,r,a)=>r in t?tor(t,r,{enumerable:!0,configurable:!0,writable:!0,value:a}):t[r]=a,nor=(t,r)=>{for(var a in r||(r={}))ror.call(r,a)&&m5e(t,a,r[a]);if(b5e)for(var a of b5e(r))aor.call(r,a)&&m5e(t,a,r[a]);return t},_5e=Bf(),vC=cn(),g5e=hr(),fJ=Ja(),{logger:ior}=Ti(),sor=1062,oor=1213,M5e=1451,cor=1452,A5e=ior.debugContext("sql:mariadb"),dJ=class extends _5e{constructor(r,a,n){super(r,a,nor({showWarnings:!1},n))}static formatBindParameters(r,a,n){let i=[],s=(o,c,u)=>{if(u[c]!==void 0)return i.push(u[c]),"?"};return r=_5e.formatBindParameters(r,a,n,s)[0],[r,i.length>0?i:void 0]}async run(r,a){this.sql=r;let{connection:n,options:i}=this,s=this.sequelize.options.showWarnings||i.showWarnings,o=this._logQuery(r,A5e,a);a&&A5e("parameters(%j)",a);let c,u=new Error;try{c=await n.query(this.sql,a)}catch(l){if(i.transaction&&l.errno===oor){try{await i.transaction.rollback()}catch{}i.transaction.finished="rollback"}throw l.sql=r,l.parameters=a,this.formatError(l,u.stack)}finally{o()}return s&&c&&c.warningStatus>0&&await this.logWarnings(c),this.formatResults(c)}formatResults(r){let a=this.instance;if(this.isBulkUpdateQuery()||this.isBulkDeleteQuery())return r.affectedRows;if(this.isUpsertQuery())return[a,r.affectedRows===1];if(this.isInsertQuery(r)&&(this.handleInsertQuery(r),!this.instance)){if(this.model&&this.model.autoIncrementAttribute&&this.model.autoIncrementAttribute===this.model.primaryKeyAttribute&&this.model.rawAttributes[this.model.primaryKeyAttribute]){let n=r[this.getInsertIdField()];a=new Array(r.affectedRows);let i=this.model.rawAttributes[this.model.primaryKeyAttribute].field;for(let s=0;s<r.affectedRows;s++)a[s]={[i]:n+s};return[a,r.affectedRows]}return[r[this.getInsertIdField()],r.affectedRows]}if(this.isSelectQuery())return this.handleJsonSelectQuery(r),this.handleSelectQuery(r);if(this.isInsertQuery()||this.isUpdateQuery())return[a,r.affectedRows];if(this.isCallQuery())return r[0];if(this.isRawQuery()){let n=r.meta;return delete r.meta,[r,n]}if(this.isShowIndexesQuery())return this.handleShowIndexesQuery(r);if(this.isForeignKeysQuery()||this.isShowConstraintsQuery())return r;if(this.isShowTablesQuery())return this.handleShowTablesQuery(r);if(this.isDescribeQuery()){a={};for(let n of r)a[n.Field]={type:n.Type.toLowerCase().startsWith("enum")?n.Type.replace(/^enum/i,"ENUM"):n.Type.toUpperCase(),allowNull:n.Null==="YES",defaultValue:n.Default,primaryKey:n.Key==="PRI",autoIncrement:Object.prototype.hasOwnProperty.call(n,"Extra")&&n.Extra.toLowerCase()==="auto_increment",comment:n.Comment?n.Comment:null};return a}return this.isVersionQuery()?r[0].version:a}handleJsonSelectQuery(r){if(!(!this.model||!this.model.fieldRawAttributesMap))for(let a of Object.keys(this.model.fieldRawAttributesMap)){let n=this.model.fieldRawAttributesMap[a];n.type instanceof fJ.JSON&&(r=r.map(i=>(i[n.fieldName]&&typeof i[n.fieldName]=="string"&&!this.connection.info.hasMinVersion(10,5,2)&&(i[n.fieldName]=JSON.parse(i[n.fieldName])),fJ.JSON.parse?fJ.JSON.parse(n,this.sequelize.options,i[n.fieldName]):i)))}}async logWarnings(r){let a=await this.run("SHOW WARNINGS"),n=`MariaDB Warnings (${this.connection.uuid||"default"}): `,i=[];for(let s of a)if(!(s===void 0||typeof s[Symbol.iterator]!="function"))for(let o of s)if(Object.prototype.hasOwnProperty.call(o,"Message"))i.push(o.Message);else for(let c of o.keys())i.push([c,o[c]].join(": "));return this.sequelize.log(n+i.join("; "),this.options),r}formatError(r,a){switch(r.errno){case sor:{let n=r.message.match(/Duplicate entry '([\s\S]*)' for key '?((.|\s)*?)'?\s.*$/),i={},s="Validation error",o=n?n[1].split("-"):void 0,c=n?n[2]:void 0,u=n?n[1]:void 0,l=this.model&&this.model.uniqueKeys[c];l?(l.msg&&(s=l.msg),i=g5e.zipObject(l.fields,o)):i[c]=u;let f=[];return g5e.forOwn(i,(d,h)=>{f.push(new vC.ValidationErrorItem(this.getUniqueConstraintErrorMessage(h),"unique violation",h,d,this.instance,"not_unique"))}),new vC.UniqueConstraintError({message:s,errors:f,parent:r,fields:i,stack:a})}case M5e:case cor:{let n=r.message.match(/CONSTRAINT ([`"])(.*)\1 FOREIGN KEY \(\1(.*)\1\) REFERENCES \1(.*)\1 \(\1(.*)\1\)/),i=n?n[1]:"`",s=n?n[3].split(new RegExp(`${i}, *${i}`)):void 0;return new vC.ForeignKeyConstraintError({reltype:r.errno===M5e?"parent":"child",table:n?n[4]:void 0,fields:s,value:s&&s.length&&this.instance&&this.instance[s[0]]||void 0,index:n?n[2]:void 0,parent:r,stack:a})}default:return new vC.DatabaseError(r,{stack:a})}}handleShowTablesQuery(r){return r.map(a=>({tableName:a.TABLE_NAME,schema:a.TABLE_SCHEMA}))}handleShowIndexesQuery(r){let a,n=[];return r.forEach(i=>{(!a||a.name!==i.Key_name)&&(a={primary:i.Key_name==="PRIMARY",fields:[],name:i.Key_name,tableName:i.Table,unique:i.Non_unique!==1,type:i.Index_type},n.push(a)),a.fields[i.Seq_in_index-1]={attribute:i.Column_name,length:i.Sub_part||void 0,order:i.Collation==="A"?"ASC":void 0}}),n}};O5e.exports=dJ});var v5e=A(($9a,w5e)=>{"use strict";var uor=Object.defineProperty,z5e=Object.getOwnPropertySymbols,lor=Object.prototype.hasOwnProperty,por=Object.prototype.propertyIsEnumerable,E5e=(t,r,a)=>r in t?uor(t,r,{enumerable:!0,configurable:!0,writable:!0,value:a}):t[r]=a,dor=(t,r)=>{for(var a in r||(r={}))lor.call(r,a)&&E5e(t,a,r[a]);if(z5e)for(var a of z5e(r))por.call(r,a)&&E5e(t,a,r[a]);return t},RC=hr(),sa=Ws(),hor=On(),bor={OperatorMap:{[sa.eq]:"=",[sa.ne]:"!=",[sa.gte]:">=",[sa.gt]:">",[sa.lte]:"<=",[sa.lt]:"<",[sa.not]:"IS NOT",[sa.is]:"IS",[sa.in]:"IN",[sa.notIn]:"NOT IN",[sa.like]:"LIKE",[sa.notLike]:"NOT LIKE",[sa.iLike]:"ILIKE",[sa.notILike]:"NOT ILIKE",[sa.startsWith]:"LIKE",[sa.endsWith]:"LIKE",[sa.substring]:"LIKE",[sa.regexp]:"~",[sa.notRegexp]:"!~",[sa.iRegexp]:"~*",[sa.notIRegexp]:"!~*",[sa.between]:"BETWEEN",[sa.notBetween]:"NOT BETWEEN",[sa.overlap]:"&&",[sa.contains]:"@>",[sa.contained]:"<@",[sa.adjacent]:"-|-",[sa.strictLeft]:"<<",[sa.strictRight]:">>",[sa.noExtendRight]:"&<",[sa.noExtendLeft]:"&>",[sa.any]:"ANY",[sa.all]:"ALL",[sa.and]:" AND ",[sa.or]:" OR ",[sa.col]:"COL",[sa.placeholder]:"$$PLACEHOLDER$$",[sa.match]:"@@"},OperatorsAliasMap:{},setOperatorsAliases(t){!t||RC.isEmpty(t)?this.OperatorsAliasMap=!1:this.OperatorsAliasMap=dor({},t)},_replaceAliases(t){let r={};return this.OperatorsAliasMap?(hor.getOperators(t).forEach(a=>{let n=t[a];RC.isPlainObject(n)?r[a]=this._replaceAliases(n):r[a]=n}),RC.forOwn(t,(a,n)=>{n=this.OperatorsAliasMap[n]||n,RC.isPlainObject(a)&&(a=this._replaceAliases(a)),r[n]=a}),r):t}};w5e.exports=bor});var T5e=A((Y9a,R5e)=>{"use strict";var mor=(JM(),gf(KM)).v4,_or={setIsolationLevelQuery(t,r){if(!r.parent)return`SET TRANSACTION ISOLATION LEVEL ${t};`},generateTransactionId(){return mor()},startTransactionQuery(t){return t.parent?`SAVEPOINT ${this.quoteIdentifier(t.name,!0)};`:"START TRANSACTION;"},deferConstraintsQuery(){},setConstraintQuery(){},setDeferredQuery(){},setImmediateQuery(){},commitTransactionQuery(t){if(!t.parent)return"COMMIT;"},rollbackTransactionQuery(t){return t.parent?`ROLLBACK TO SAVEPOINT ${this.quoteIdentifier(t.name,!0)};`:"ROLLBACK;"}};R5e.exports=_or});var xh=A((K9a,x5e)=>{"use strict";var gor=Object.defineProperty,Mor=Object.defineProperties,Aor=Object.getOwnPropertyDescriptors,q5e=Object.getOwnPropertySymbols,Oor=Object.prototype.hasOwnProperty,yor=Object.prototype.propertyIsEnumerable,N5e=(t,r,a)=>r in t?gor(t,r,{enumerable:!0,configurable:!0,writable:!0,value:a}):t[r]=a,A2=(t,r)=>{for(var a in r||(r={}))Oor.call(r,a)&&N5e(t,a,r[a]);if(q5e)for(var a of q5e(r))yor.call(r,a)&&N5e(t,a,r[a]);return t},TC=(t,r)=>Mor(t,Aor(r)),qC=require("util"),ra=hr(),zor=(JM(),gf(KM)).v4,Qt=On(),X9a=nA(),I5e=Cv(),lA=Ja(),Uu=vK(),pA=vh(),hJ=Rh(),Eor=tA(),wor=h2(),Rt=Ws(),bJ=cn(),S5e=LK(),dR=class{constructor(r){if(!r.sequelize)throw new Error("QueryGenerator initialized without options.sequelize");if(!r._dialect)throw new Error("QueryGenerator initialized without options._dialect");this.sequelize=r.sequelize,this.options=r.sequelize.options,this.dialect=r._dialect.name,this._dialect=r._dialect,this._initQuoteIdentifier()}extractTableDetails(r,a){return a=a||{},r=r||{},{schema:r.schema||a.schema||this.options.schema||"public",tableName:ra.isPlainObject(r)?r.tableName:r,delimiter:r.delimiter||a.delimiter||"."}}addSchema(r){if(!r._schema)return r.tableName||r;let a=this;return{tableName:r.tableName||r,table:r.tableName||r,name:r.name||r,schema:r._schema,delimiter:r._schemaDelimiter||".",toString(){return a.quoteTable(this)}}}dropSchema(r,a){return this.dropTableQuery(r,a)}describeTableQuery(r,a,n){return`DESCRIBE ${this.quoteTable(this.addSchema({tableName:r,_schema:a,_schemaDelimiter:n}))};`}dropTableQuery(r){return`DROP TABLE IF EXISTS ${this.quoteTable(r)};`}renameTableQuery(r,a){return`ALTER TABLE ${this.quoteTable(r)} RENAME TO ${this.quoteTable(a)};`}populateInsertQueryReturnIntoBinds(){}insertQuery(r,a,n,i){i=i||{},ra.defaults(i,this.options);let s={},o=i.bind||[],c=[],u=[],l=[],f=[],d=this.quoteTable(r),h=i.bindParam===void 0?this.bindParam(o):i.bindParam,b=[],m,g="",O="",z="",w="",v=!1,T="";if(n&&ra.each(n,(C,Q)=>{s[Q]=C,C.field&&(s[C.field]=C)}),this._dialect.supports["DEFAULT VALUES"]?O+=" DEFAULT VALUES":this._dialect.supports["VALUES ()"]&&(O+=" VALUES ()"),(this._dialect.supports.returnValues||this._dialect.supports.returnIntoValues)&&i.returning){let C=this.generateReturnValues(n,i);u.push(...C.returnFields),this._dialect.supports.returnIntoValues&&l.push(...C.returnTypes),w=C.returningFragment,T=C.tmpTable||"",z=C.outputFragment||""}(ra.get(this,["sequelize","options","dialectOptions","prependSearchPath"])||i.searchPath)&&(i.bindParam=!1),this._dialect.supports.EXCEPTION&&i.exception&&(i.bindParam=!1),a=Qt.removeNullValuesFromHash(a,this.options.omitNull);for(let C in a)if(Object.prototype.hasOwnProperty.call(a,C)){let Q=a[C];c.push(this.quoteIdentifier(C)),s&&s[C]&&s[C].autoIncrement===!0&&Q==null?this._dialect.supports.autoIncrement.defaultValue?this._dialect.supports.DEFAULT?f.push("DEFAULT"):f.push(this.escape(null)):c.splice(-1,1):(s&&s[C]&&s[C].autoIncrement===!0&&(v=!0),Q instanceof Qt.SequelizeMethod||i.bindParam===!1?f.push(this.escape(Q,s&&s[C]||void 0,{context:"INSERT"})):f.push(this.format(Q,s&&s[C]||void 0,{context:"INSERT"},h)))}let x="";if(!ra.isEmpty(i.conflictWhere)&&!this._dialect.supports.inserts.onConflictWhere)throw new Error("missing dialect support for conflictWhere option");if(this._dialect.supports.inserts.updateOnDuplicate&&i.updateOnDuplicate)if(this._dialect.supports.inserts.updateOnDuplicate==" ON CONFLICT DO UPDATE SET"){let C=i.upsertKeys.map(k=>this.quoteIdentifier(k)),Q=i.updateOnDuplicate.map(k=>`${this.quoteIdentifier(k)}=EXCLUDED.${this.quoteIdentifier(k)}`),X=["ON CONFLICT","(",C.join(","),")"];ra.isEmpty(i.conflictWhere)||X.push(this.whereQuery(i.conflictWhere,i)),ra.isEmpty(Q)?X.push("DO NOTHING"):X.push("DO UPDATE SET",Q.join(",")),x=` ${Qt.joinSQLFragments(X)}`}else{let C=i.updateOnDuplicate.map(Q=>`${this.quoteIdentifier(Q)}=VALUES(${this.quoteIdentifier(Q)})`);if(ra.isEmpty(C)&&i.upsertKeys&&C.push(...i.upsertKeys.map(Q=>`${this.quoteIdentifier(Q)}=${this.quoteIdentifier(Q)}`)),ra.isEmpty(C))throw new Error("No update values found for ON DUPLICATE KEY UPDATE clause, and no identifier fields could be found to use instead.");x+=`${this._dialect.supports.inserts.updateOnDuplicate} ${C.join(",")}`}let L={ignoreDuplicates:i.ignoreDuplicates?this._dialect.supports.inserts.ignoreDuplicates:"",onConflictDoNothing:i.ignoreDuplicates?this._dialect.supports.inserts.onConflictDoNothing:"",attributes:c.join(","),output:z,values:f.join(","),tmpTable:T};if(g=`${T}INSERT${L.ignoreDuplicates} INTO ${d} (${L.attributes})${L.output} VALUES (${L.values})${x}${L.onConflictDoNothing}${g}`,O=`${T}INSERT${L.ignoreDuplicates} INTO ${d}${L.output}${x}${L.onConflictDoNothing}${O}`,this._dialect.supports.EXCEPTION&&i.exception){let C="DROP FUNCTION IF EXISTS pg_temp.testfunc()";u.length===0&&u.push("*");let Q=`$func_${zor().replace(/-/g,"")}$`,X=`SELECT (testfunc.response).${u.join(", (testfunc.response).")}, testfunc.sequelize_caught_exception FROM pg_temp.testfunc();`;i.exception="WHEN unique_violation THEN GET STACKED DIAGNOSTICS sequelize_caught_exception = PG_EXCEPTION_DETAIL;",g=`CREATE OR REPLACE FUNCTION pg_temp.testfunc(OUT response ${d}, OUT sequelize_caught_exception text) RETURNS RECORD AS ${Q} BEGIN ${g} RETURNING * INTO response; EXCEPTION ${i.exception} END ${Q} LANGUAGE plpgsql; ${X} ${C}`}else g+=w,O+=w;this._dialect.supports.returnIntoValues&&i.returning&&this.populateInsertQueryReturnIntoBinds(u,l,o.length,b,i),m=`${L.attributes.length?g:O}${b.join(",")};`,this._dialect.supports.finalTable&&(m=`SELECT * FROM FINAL TABLE(${L.attributes.length?g:O});`),v&&this._dialect.supports.autoIncrement.identityInsert&&(m=`SET IDENTITY_INSERT ${d} ON; ${m} SET IDENTITY_INSERT ${d} OFF;`);let P={query:m};return i.bindParam!==!1&&(P.bind=o),P}bulkInsertQuery(r,a,n,i){n=n||{},i=i||{};let s=[],o={},c=[],u="";for(let b of a)ra.forOwn(b,(m,g)=>{c.includes(g)||c.push(g),i[g]&&i[g].autoIncrement===!0&&(o[g]=!0)});for(let b of a){let m=c.map(g=>this._dialect.supports.bulkDefault&&o[g]===!0?b[g]!=null?b[g]:"DEFAULT":this.escape(b[g],i[g],{context:"INSERT"}));s.push(`(${m.join(",")})`)}if(this._dialect.supports.inserts.updateOnDuplicate&&n.updateOnDuplicate)if(this._dialect.supports.inserts.updateOnDuplicate==" ON CONFLICT DO UPDATE SET"){let b=n.upsertKeys.map(O=>this.quoteIdentifier(O)),m=n.updateOnDuplicate.map(O=>`${this.quoteIdentifier(O)}=EXCLUDED.${this.quoteIdentifier(O)}`),g=!1;if(n.conflictWhere){if(!this._dialect.supports.inserts.onConflictWhere)throw new Error(`conflictWhere not supported for dialect ${this._dialect.name}`);g=this.whereQuery(n.conflictWhere,n)}u=["ON CONFLICT","(",b.join(","),")",g,"DO UPDATE SET",m.join(",")]}else{if(n.conflictWhere)throw new Error(`conflictWhere not supported for dialect ${this._dialect.name}`);let b=n.updateOnDuplicate.map(m=>`${this.quoteIdentifier(m)}=VALUES(${this.quoteIdentifier(m)})`);u=`${this._dialect.supports.inserts.updateOnDuplicate} ${b.join(",")}`}let l=n.ignoreDuplicates?this._dialect.supports.inserts.ignoreDuplicates:"",f=c.map(b=>this.quoteIdentifier(b)).join(","),d=n.ignoreDuplicates?this._dialect.supports.inserts.onConflictDoNothing:"",h="";if(this._dialect.supports.returnValues&&n.returning){let b=this.generateReturnValues(i,n);h+=b.returningFragment}return Qt.joinSQLFragments(["INSERT",l,"INTO",this.quoteTable(r),`(${f})`,"VALUES",s.join(","),u,d,h,";"])}updateQuery(r,a,n,i,s){i=i||{},ra.defaults(i,this.options),a=Qt.removeNullValuesFromHash(a,i.omitNull,i);let o=[],c=[],u={},l="",f="",d="";(ra.get(this,["sequelize","options","dialectOptions","prependSearchPath"])||i.searchPath)&&(i.bindParam=!1);let h=i.bindParam===void 0?this.bindParam(c):i.bindParam;if(this._dialect.supports["LIMIT ON UPDATE"]&&i.limit&&(["mssql","db2","oracle"].includes(this.dialect)?this.dialect==="oracle"&&(n&&(n.length&&n.length>0||Object.keys(n).length>0)?d+=" AND ":d+=" WHERE ",d+=`rownum <= ${this.escape(i.limit)} `):d=` LIMIT ${this.escape(i.limit)} `),this._dialect.supports.returnValues&&i.returning){let O=this.generateReturnValues(s,i);d+=O.returningFragment,f=O.tmpTable||"",l=O.outputFragment||"",!this._dialect.supports.returnValues.output&&i.returning&&(i.mapToModel=!0)}s&&ra.each(s,(O,z)=>{u[z]=O,O.field&&(u[O.field]=O)});for(let O in a){if(u&&u[O]&&u[O].autoIncrement===!0&&!this._dialect.supports.autoIncrement.update)continue;let z=a[O];z instanceof Qt.SequelizeMethod||i.bindParam===!1?o.push(`${this.quoteIdentifier(O)}=${this.escape(z,u&&u[O]||void 0,{context:"UPDATE"})}`):o.push(`${this.quoteIdentifier(O)}=${this.format(z,u&&u[O]||void 0,{context:"UPDATE"},h)}`)}let b=TC(A2({},i),{bindParam:h});if(o.length===0)return"";let g={query:`${f}UPDATE ${this.quoteTable(r)} SET ${o.join(",")}${l} ${this.whereQuery(n,b)}${d}`.trim()};return i.bindParam!==!1&&(g.bind=c),g}arithmeticQuery(r,a,n,i,s,o){o=o||{},ra.defaults(o,{returning:!0}),s=Qt.removeNullValuesFromHash(s,this.options.omitNull);let c="",u="";if(this._dialect.supports.returnValues&&o.returning){let f=this.generateReturnValues(null,o);c=f.outputFragment,u=f.returningFragment}let l=[];for(let f in i){let d=i[f],h=this.quoteIdentifier(f),b=this.escape(d);l.push(`${h}=${h}${r} ${b}`)}for(let f in s){let d=s[f],h=this.quoteIdentifier(f),b=this.escape(d);l.push(`${h}=${b}`)}return Qt.joinSQLFragments(["UPDATE",this.quoteTable(a),"SET",l.join(","),c,this.whereQuery(n),u])}addIndexQuery(r,a,n,i){n=n||{},Array.isArray(a)?n.fields=a:(n=a,a=void 0),n.prefix=n.prefix||i||r,n.prefix&&typeof n.prefix=="string"&&(n.prefix=n.prefix.replace(/\./g,"_"),n.prefix=n.prefix.replace(/("|')/g,""));let s=n.fields.map(u=>{if(u instanceof Qt.SequelizeMethod)return this.handleSequelizeMethod(u);typeof u=="string"&&(u={name:u});let l="";if(u.attribute&&(u.name=u.attribute),!u.name)throw new Error(`The following index field has no name: ${qC.inspect(u)}`);if(l+=this.quoteIdentifier(u.name),this._dialect.supports.index.collate&&u.collate&&(l+=` COLLATE ${this.quoteIdentifier(u.collate)}`),this._dialect.supports.index.operator){let f=u.operator||n.operator;f&&(l+=` ${f}`)}return this._dialect.supports.index.length&&u.length&&(l+=`(${u.length})`),u.order&&(l+=` ${u.order}`),l});n.name||(n=Qt.nameIndex(n,n.prefix)),n=Uu._conformIndex(n),this._dialect.supports.index.type||delete n.type,n.where&&(n.where=this.whereQuery(n.where)),typeof r=="string"?r=this.quoteIdentifiers(r):r=this.quoteTable(r);let o=this._dialect.supports.index.concurrently&&n.concurrently?"CONCURRENTLY":void 0,c;return this._dialect.supports.indexViaAlter?c=["ALTER TABLE",r,o,"ADD"]:c=["CREATE"],c=c.concat(n.unique?"UNIQUE":"",n.type,"INDEX",this._dialect.supports.indexViaAlter?void 0:o,this.quoteIdentifiers(n.name),this._dialect.supports.index.using===1&&n.using?`USING ${n.using}`:"",this._dialect.supports.indexViaAlter?void 0:`ON ${r}`,this._dialect.supports.index.using===2&&n.using?`USING ${n.using}`:"",`(${s.join(", ")})`,this._dialect.supports.index.parser&&n.parser?`WITH PARSER ${n.parser}`:void 0,this._dialect.supports.index.where&&n.where?n.where:void 0),ra.compact(c).join(" ")}addConstraintQuery(r,a){return typeof r=="string"?r=this.quoteIdentifiers(r):r=this.quoteTable(r),Qt.joinSQLFragments(["ALTER TABLE",r,"ADD",this.getConstraintSnippet(r,a||{}),";"])}getConstraintSnippet(r,a){let n,i,s=a.fields.map(u=>{if(typeof u=="string")return this.quoteIdentifier(u);if(u instanceof Qt.SequelizeMethod)return this.handleSequelizeMethod(u);if(u.attribute&&(u.name=u.attribute),!u.name)throw new Error(`The following index field has no name: ${u}`);return this.quoteIdentifier(u.name)}),o=s.join(", "),c=s.join("_");switch(a.type.toUpperCase()){case"UNIQUE":i=this.quoteIdentifier(a.name||`${r}_${c}_uk`),n=`CONSTRAINT ${i} UNIQUE (${o})`;break;case"CHECK":a.where=this.whereItemsQuery(a.where),i=this.quoteIdentifier(a.name||`${r}_${c}_ck`),n=`CONSTRAINT ${i} CHECK (${a.where})`;break;case"DEFAULT":if(a.defaultValue===void 0)throw new Error("Default value must be specified for DEFAULT CONSTRAINT");if(this._dialect.name!=="mssql")throw new Error("Default constraints are supported only for MSSQL dialect.");i=this.quoteIdentifier(a.name||`${r}_${c}_df`),n=`CONSTRAINT ${i} DEFAULT (${this.escape(a.defaultValue)}) FOR ${s[0]}`;break;case"PRIMARY KEY":i=this.quoteIdentifier(a.name||`${r}_${c}_pk`),n=`CONSTRAINT ${i} PRIMARY KEY (${o})`;break;case"FOREIGN KEY":let u=a.references;if(!u||!u.table||!(u.field||u.fields))throw new Error("references object with table and field must be specified");i=this.quoteIdentifier(a.name||`${r}_${c}_${u.table}_fk`);let l=typeof u.field<"u"?this.quoteIdentifier(u.field):u.fields.map(d=>this.quoteIdentifier(d)).join(", "),f=`${this.quoteTable(u.table)} (${l})`;n=`CONSTRAINT ${i} `,n+=`FOREIGN KEY (${o}) REFERENCES ${f}`,a.onUpdate&&(n+=` ON UPDATE ${a.onUpdate.toUpperCase()}`),a.onDelete&&(n+=` ON DELETE ${a.onDelete.toUpperCase()}`);break;default:throw new Error(`${a.type} is invalid.`)}return a.deferrable&&["UNIQUE","PRIMARY KEY","FOREIGN KEY"].includes(a.type.toUpperCase())&&(n+=` ${this.deferConstraintsQuery(a)}`),n}removeConstraintQuery(r,a){return typeof r=="string"?r=this.quoteIdentifiers(r):r=this.quoteTable(r),Qt.joinSQLFragments(["ALTER TABLE",r,"DROP CONSTRAINT",this.quoteIdentifiers(a)])}quote(r,a,n){let i=["ASC","DESC","ASC NULLS LAST","DESC NULLS LAST","ASC NULLS FIRST","DESC NULLS FIRST","NULLS FIRST","NULLS LAST"];if(n=n||".",typeof r=="string")return this.quoteIdentifiers(r);if(Array.isArray(r)){r.forEach((f,d)=>{let h=r[d-1],b,m;if(!h&&a!==void 0?m=a:h&&h instanceof pA&&(b=h,m=h.target),m&&m.prototype instanceof Uu){let g,O;if(typeof f=="function"&&f.prototype instanceof Uu?g=f:ra.isPlainObject(f)&&f.model&&f.model.prototype instanceof Uu&&(g=f.model,O=f.as),g&&(!O&&b&&b instanceof pA&&b.through&&b.through.model===g?f=new pA(m,g,{as:g.name}):(f=m.getAssociationForAlias(g,O),f||(f=m.getAssociationForAlias(g,g.name))),!(f instanceof pA)))throw new Error(qC.format("Unable to find a valid association for model, '%s'",g.name))}if(typeof f=="string"){let g=i.indexOf(f.toUpperCase());if(d>0&&g!==-1)f=this.sequelize.literal(` ${i[g]}`);else if(m&&m.prototype instanceof Uu){if(m.associations!==void 0&&m.associations[f])f=m.associations[f];else if(m.rawAttributes!==void 0&&m.rawAttributes[f]&&f!==m.rawAttributes[f].field)f=m.rawAttributes[f].field;else if(f.includes(".")&&m.rawAttributes!==void 0){let O=f.split(".");if(m.rawAttributes[O[0]].type instanceof lA.JSON){let z=this.quoteIdentifiers(`${m.name}.${m.rawAttributes[O[0]].field}`),w=O.slice(1);f=this.jsonPathExtractionQuery(z,w),f=this.sequelize.literal(f)}}}}r[d]=f},this);let s=r.length,o=[],c,u=0;for(u=0;u<s-1&&(c=r[u],!(typeof c=="string"||c._modelAttribute||c instanceof Qt.SequelizeMethod));u++)c instanceof pA&&(o[u]=c.as);let l="";return u>0?l+=`${this.quoteIdentifier(o.join(n))}.`:typeof r[0]=="string"&&a&&(l+=`${this.quoteIdentifier(a.name)}.`),r.slice(u).forEach(f=>{l+=this.quote(f,a,n)},this),l}if(r._modelAttribute)return`${this.quoteTable(r.Model.name)}.${this.quoteIdentifier(r.fieldName)}`;if(r instanceof Qt.SequelizeMethod)return this.handleSequelizeMethod(r);throw ra.isPlainObject(r)&&r.raw?new Error('The `{raw: "..."}` syntax is no longer supported.  Use `sequelize.literal` instead.'):new Error(`Unknown structure passed to order / group: ${qC.inspect(r)}`)}_initQuoteIdentifier(){this._quoteIdentifier=this.quoteIdentifier,this.quoteIdentifier=function(r,a){return r==="*"?r:this._quoteIdentifier(r,a)}}quoteIdentifier(r,a){throw new Error(`quoteIdentifier for Dialect "${this.dialect}" is not implemented`)}quoteIdentifiers(r){if(r.includes(".")){r=r.split(".");let a=r.slice(0,r.length-1).join("->"),n=r[r.length-1];return`${this.quoteIdentifier(a)}.${this.quoteIdentifier(n)}`}return this.quoteIdentifier(r)}quoteAttribute(r,a){return a&&r in a.rawAttributes?this.quoteIdentifier(r):this.quoteIdentifiers(r)}getAliasToken(){return"AS"}quoteTable(r,a){let n="";return a===!0&&(a=r.as||r.name||r),ra.isObject(r)?this._dialect.supports.schemas?(r.schema&&(n+=`${this.quoteIdentifier(r.schema)}.`),n+=this.quoteIdentifier(r.tableName)):(r.schema&&(n+=r.schema+(r.delimiter||".")),n+=r.tableName,n=this.quoteIdentifier(n)):n=this.quoteIdentifier(r),a&&(n+=` ${this.getAliasToken()} ${this.quoteIdentifier(a)}`),n}escape(r,a,n){if(n=n||{},r!=null){if(r instanceof Qt.SequelizeMethod)return this.handleSequelizeMethod(r);if(a&&a.type&&(a.type instanceof lA.STRING&&["mysql","mariadb"].includes(this.dialect)&&["number","boolean"].includes(typeof r)&&(r=String(Number(r))),this.validate(r,a,n),a.type.stringify)){let i=s=>I5e.escape(s,this.options.timezone,this.dialect);if(r=a.type.stringify(r,{escape:i,field:a,timezone:this.options.timezone,operation:n.operation}),a.type.escape===!1)return r}}return I5e.escape(r,this.options.timezone,this.dialect)}bindParam(r){return a=>(r.push(a),`$${r.length}`)}format(r,a,n,i){if(n=n||{},r!=null){if(r instanceof Qt.SequelizeMethod)throw new Error("Cannot pass SequelizeMethod as a bind parameter - use escape instead");if(a&&a.type&&(this.validate(r,a,n),a.type.bindParam))return a.type.bindParam(r,{escape:ra.identity,field:a,timezone:this.options.timezone,operation:n.operation,bindParam:i})}return i(r)}validate(r,a,n){if(this.typeValidation&&a.type.validate&&r)try{if(n.isList&&Array.isArray(r))for(let i of r)a.type.validate(i,n);else a.type.validate(r,n)}catch(i){throw i instanceof bJ.ValidationError&&i.errors.push(new bJ.ValidationErrorItem(i.message,"Validation error",a.fieldName,r,null,`${a.type.key} validator`)),i}}isIdentifierQuoted(r){return/^\s*(?:([`"'])(?:(?!\1).|\1{2})*\1\.?)+\s*$/i.test(r)}jsonPathExtractionQuery(r,a,n){let i=ra.toPath(a),s,o=this.isIdentifierQuoted(r)?r:this.quoteIdentifier(r);switch(this.dialect){case"mysql":case"mariadb":case"sqlite":return this.dialect==="mysql"&&(i=i.map(u=>/\D/.test(u)?Qt.addTicks(u,'"'):u)),s=this.escape(["$"].concat(i).join(".").replace(/\.(\d+)(?:(?=\.)|$)/g,(u,l)=>`[${l}]`)),this.dialect==="sqlite"?`json_extract(${o},${s})`:`json_unquote(json_extract(${o},${s}))`;case"postgres":let c=n?"#>":"#>>";return s=this.escape(`{${i.join(",")}}`),`(${o}${c}${s})`;default:throw new Error(`Unsupported ${this.dialect} for JSON operations`)}}selectQuery(r,a,n){a=a||{};let i=a.limit,s=[],o=[],c=a.subQuery===void 0?i&&a.hasMultiAssociation:a.subQuery,u={main:a.attributes&&a.attributes.slice(),subQuery:null},l={name:r,quotedName:null,as:null,model:n},f={names:l,options:a,subQuery:c},d=[],h=[],b;if(this.options.minifyAliases&&!a.aliasesMapping&&(a.aliasesMapping=new Map,a.aliasesByTable={},a.includeAliases=new Map),a.tableAs?l.as=this.quoteIdentifier(a.tableAs):!Array.isArray(l.name)&&l.model&&(l.as=this.quoteIdentifier(l.model.name)),l.quotedName=Array.isArray(l.name)?r.map(g=>Array.isArray(g)?this.quoteTable(g[0],g[1]):this.quoteTable(g,!0)).join(", "):this.quoteTable(l.name),c&&u.main)for(let g of l.model.primaryKeyAttributes)u.main.some(O=>g===O||g===O[0]||g===O[1])||u.main.push(l.model.rawAttributes[g].field?[g,l.model.rawAttributes[g].field]:g);if(u.main=this.escapeAttributes(u.main,a,l.as),u.main=u.main||(a.include?[`${l.as}.*`]:["*"]),(c||a.groupedLimit)&&(u.subQuery=u.main,u.main=[`${l.as||l.quotedName}.*`]),a.include)for(let g of a.include){if(g.separate)continue;let O=this.generateInclude(g,{externalAs:l.as,internalAs:l.as},f);h=h.concat(O.subQuery),d=d.concat(O.mainQuery),O.attributes.main.length>0&&(u.main=ra.uniq(u.main.concat(O.attributes.main))),O.attributes.subQuery.length>0&&(u.subQuery=ra.uniq(u.subQuery.concat(O.attributes.subQuery)))}if(c)o.push(this.selectFromTableFragment(a,l.model,u.subQuery,l.quotedName,l.as)),o.push(h.join(""));else{if(a.groupedLimit){l.as||(l.as=l.quotedName);let g=A2({},a.where),O,z,w,v=l.as;if(typeof a.groupedLimit.on=="string"?z=a.groupedLimit.on:a.groupedLimit.on instanceof wor&&(z=a.groupedLimit.on.foreignKeyField),a.groupedLimit.on instanceof Eor){v=a.groupedLimit.on.manyFromSource.as;let P=Uu._validateIncludedElements({include:[{association:a.groupedLimit.on.manyFromSource,duplicating:!1,required:!0,where:A2({[Rt.placeholder]:!0},a.groupedLimit.through&&a.groupedLimit.through.where)}],model:n});a.hasJoin=!0,a.hasMultiAssociation=!0,a.includeMap=Object.assign(P.includeMap,a.includeMap),a.includeNames=P.includeNames.concat(a.includeNames||[]),w=P.include,Array.isArray(a.order)&&(a.order.forEach((C,Q)=>{Array.isArray(C)&&(C=C[0]);let X=`subquery_order_${Q}`;a.attributes.push([C,X]),X=this.sequelize.literal(this.quote(X)),Array.isArray(a.order[Q])?a.order[Q][0]=X:a.order[Q]=X}),O=a.order)}else O=a.order,this._dialect.supports.topLevelOrderByRequired||delete a.order,g[Rt.placeholder]=!0;let T=`SELECT * FROM (${this.selectQuery(r,{attributes:a.attributes,offset:a.offset,limit:a.groupedLimit.limit,order:O,aliasesMapping:a.aliasesMapping,aliasesByTable:a.aliasesByTable,where:g,include:w,model:n},n).replace(/;$/,"")}) ${this.getAliasToken()} sub`,x=this.whereItemQuery(Rt.placeholder,!0,{model:n}),L=T.indexOf(x);s.push(this.selectFromTableFragment(a,l.model,u.main,`(${a.groupedLimit.values.map(P=>{let C;return z&&(C={[z]:P}),w&&(C={[a.groupedLimit.on.foreignIdentifierField]:P}),Qt.spliceStr(T,L,x.length,this.getWhereConditions(C,v))}).join(this._dialect.supports["UNION ALL"]?" UNION ALL ":" UNION ")})`,l.as))}else s.push(this.selectFromTableFragment(a,l.model,u.main,l.quotedName,l.as));s.push(d.join(""))}if(Object.prototype.hasOwnProperty.call(a,"where")&&!a.groupedLimit&&(a.where=this.getWhereConditions(a.where,l.as||r,n,a),a.where&&(c?o.push(` WHERE ${a.where}`):(s.push(` WHERE ${a.where}`),s.forEach((g,O)=>{g.startsWith("SELECT")&&(s[O]=this.selectFromTableFragment(a,n,u.main,l.quotedName,l.as,a.where))})))),a.group&&(a.group=Array.isArray(a.group)?a.group.map(g=>this.aliasGrouping(g,n,l.as,a)).join(", "):this.aliasGrouping(a.group,n,l.as,a),c&&a.group?o.push(` GROUP BY ${a.group}`):a.group&&s.push(` GROUP BY ${a.group}`)),Object.prototype.hasOwnProperty.call(a,"having")&&(a.having=this.getWhereConditions(a.having,r,n,a,!1),a.having&&(c?o.push(` HAVING ${a.having}`):s.push(` HAVING ${a.having}`))),a.order){let g=this.getQueryOrders(a,n,c);g.mainQueryOrder.length&&s.push(` ORDER BY ${g.mainQueryOrder.join(", ")}`),g.subQueryOrder.length&&o.push(` ORDER BY ${g.subQueryOrder.join(", ")}`)}let m=this.addLimitAndOffset(a,l.model);if(m&&!a.groupedLimit&&(c?o.push(m):s.push(m)),c?(this._throwOnEmptyAttributes(u.main,{modelName:n&&n.name,as:l.as}),b=`SELECT ${u.main.join(", ")} FROM (${o.join("")}) ${this.getAliasToken()} ${l.as}${d.join("")}${s.join("")}`):b=s.join(""),a.lock&&this._dialect.supports.lock){let g=a.lock;typeof a.lock=="object"&&(g=a.lock.level),this._dialect.supports.lockKey&&["KEY SHARE","NO KEY UPDATE"].includes(g)?b+=` FOR ${g}`:g==="SHARE"?b+=` ${this._dialect.supports.forShare}`:b+=" FOR UPDATE",this._dialect.supports.lockOf&&a.lock.of&&a.lock.of.prototype instanceof Uu&&(b+=` OF ${this.quoteTable(a.lock.of.name)}`),this._dialect.supports.skipLocked&&a.skipLocked&&(b+=" SKIP LOCKED")}return`${b};`}aliasGrouping(r,a,n,i){let s=Array.isArray(r)?r[0]:r;return this.quote(this._getAliasForField(n,s,i)||s,a)}escapeAttributes(r,a,n){return r&&r.map(i=>{let s=!0;if(i instanceof Qt.SequelizeMethod)return this.handleSequelizeMethod(i);if(Array.isArray(i)){if(i.length!==2)throw new Error(`${JSON.stringify(i)} is not a valid attribute definition. Please use the following format: ['attribute definition', 'alias']`);if(i=i.slice(),i[0]instanceof Qt.SequelizeMethod)i[0]=this.handleSequelizeMethod(i[0]),s=!1;else if(this.options.attributeBehavior==="escape"||!i[0].includes("(")&&!i[0].includes(")"))i[0]=this.quoteIdentifier(i[0]);else if(this.options.attributeBehavior!=="unsafe-legacy")throw new Error(`Attributes cannot include parentheses in Sequelize 6:
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            

Error: Please install mysql2 package manually
    at t._loadDialectModule (/home/wiomgjqe/neduas.store/server.js:124:7832)
    at new t (/home/wiomgjqe/neduas.store/server.js:136:66644)
    at new O1 (/home/wiomgjqe/neduas.store/server.js:136:73185)
    at new t (/home/wiomgjqe/neduas.store/server.js:136:229204)
    at Object.<anonymous> (/home/wiomgjqe/neduas.store/server.js:3649:2755)
    at Module._compile (node:internal/modules/cjs/loader:1275:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1329:10)
    at Module.load (node:internal/modules/cjs/loader:1133:32)
    at Module._load (node:internal/modules/cjs/loader:972:12)
    at Module.require (node:internal/modules/cjs/loader:1157:19)

Node.js v19.9.0
/home/wiomgjqe/neduas.store/server.js:124
`}};MC.AggregateError=sJ});var n5e=A(AC=>{"use strict";Object.defineProperty(AC,"__esModule",{value:!0});AC.Deferred=void 0;var Tsr=iJ(),cJ=class{constructor(){this._promise=new Promise((r,a)=>{this._reject=a,this._resolve=r})}registerTimeout(r,a){this._timeout||(this._timeout=setTimeout(()=>{a(),this.reject(new Tsr.TimeoutError("Operation timeout"))},r))}_clearTimeout(){this._timeout&&clearTimeout(this._timeout)}resolve(r){this._clearTimeout(),this._resolve(r)}reject(r){this._clearTimeout(),this._reject(r)}promise(){return this._promise}};AC.Deferred=cJ});var i5e=A(OC=>{"use strict";Object.defineProperty(OC,"__esModule",{value:!0});OC.Pool=void 0;var qsr=n5e(),Nsr=oJ(),uJ=class{constructor(r){if(this.log=!1,!r.create)throw new Error("create function is required");if(!r.destroy)throw new Error("destroy function is required");if(!r.validate)throw new Error("validate function is required");if(typeof r.min!="number"||r.min<0||r.min!==Math.round(r.min))throw new Error("min must be an integer >= 0");if(typeof r.max!="number"||r.max<=0||r.max!==Math.round(r.max))throw new Error("max must be an integer > 0");if(r.min>r.max)throw new Error("max is smaller than min");if(r.maxUses!==void 0&&(typeof r.maxUses!="number"||r.maxUses<0))throw new Error("maxUses must be an integer >= 0");this.idleTimeoutMillis=r.idleTimeoutMillis||3e4,this.acquireTimeoutMillis=r.acquireTimeoutMillis||3e4,this.reapIntervalMillis=r.reapIntervalMillis||1e3,this.maxUsesPerResource=r.maxUses||1/0,this.log=r.log||!1,this._factory=r,this._count=0,this._draining=!1,this._pendingAcquires=[],this._inUseObjects=[],this._availableObjects=[],this._removeIdleScheduled=!1}get size(){return this._count}get name(){return this._factory.name}get available(){return this._availableObjects.length}get using(){return this._inUseObjects.length}get waiting(){return this._pendingAcquires.length}get maxSize(){return this._factory.max}get minSize(){return this._factory.min}_log(r,a){typeof this.log=="function"?this.log(r,a):this.log&&console.log(`${a.toUpperCase()} pool ${this.name||""} - ${r}`)}_removeIdle(){let r=[],a=Date.now(),n,i=this._availableObjects.length,s=this.size-this.minSize,o;for(this._removeIdleScheduled=!1,n=0;n<i&&s>r.length;n++)o=this._availableObjects[n].timeout,a>=o&&(this._log("removeIdle() destroying obj - now:"+a+" timeout:"+o,"verbose"),r.push(this._availableObjects[n].resource));r.forEach(this.destroy,this),i=this._availableObjects.length,i>0?(this._log("this._availableObjects.length="+i,"verbose"),this._scheduleRemoveIdle()):this._log("removeIdle() all objects removed","verbose")}_scheduleRemoveIdle(){this._removeIdleScheduled||(this._removeIdleScheduled=!0,this._removeIdleTimer=setTimeout(()=>{this._removeIdle()},this.reapIntervalMillis))}_dispense(){let r=null,a=this._pendingAcquires.length;if(this._log(`dispense() clients=${a} available=${this._availableObjects.length}`,"info"),!(a<1)){for(;this._availableObjects.length>0;){if(this._log("dispense() - reusing obj","verbose"),r=this._availableObjects[this._availableObjects.length-1],!this._factory.validate(r.resource)){this.destroy(r.resource);continue}return this._availableObjects.pop(),this._addResourceToInUseObjects(r.resource,r.useCount),this._pendingAcquires.shift().resolve(r.resource)}this.size<this.maxSize&&this._createResource()}}_createResource(){this._count+=1,this._log(`createResource() - creating obj - count=${this.size} min=${this.minSize} max=${this.maxSize}`,"verbose"),this._factory.create().then(r=>{let a=this._pendingAcquires.shift();a?(this._addResourceToInUseObjects(r,0),a.resolve(r)):this._addResourceToAvailableObjects(r,0)}).catch(r=>{let a=this._pendingAcquires.shift();this._count-=1,this._count<0&&(this._count=0),a&&a.reject(r),process.nextTick(()=>{this._dispense()})})}_addResourceToAvailableObjects(r,a){let n={resource:r,useCount:a,timeout:Date.now()+this.idleTimeoutMillis};this._availableObjects.push(n),this._dispense(),this._scheduleRemoveIdle()}_addResourceToInUseObjects(r,a){let n={resource:r,useCount:a};this._inUseObjects.push(n)}_ensureMinimum(){let r,a;if(!this._draining&&this.size<this.minSize)for(a=this.minSize-this.size,r=0;r<a;r++)this._createResource()}acquire(){if(this._draining)return Promise.reject(new Error("pool is draining and cannot accept work"));let r=new qsr.Deferred;return r.registerTimeout(this.acquireTimeoutMillis,()=>{this._pendingAcquires=this._pendingAcquires.filter(a=>a!==r)}),this._pendingAcquires.push(r),this._dispense(),r.promise()}release(r){if(this._availableObjects.some(i=>i.resource===r)){this._log("release called twice for the same resource: "+new Error().stack,"error");return}let a=this._inUseObjects.findIndex(i=>i.resource===r);if(a<0){this._log("attempt to release an invalid resource: "+new Error().stack,"error");return}let n=this._inUseObjects[a];n.useCount+=1,n.useCount>=this.maxUsesPerResource?(this._log("release() destroying obj - useCount:"+n.useCount+" maxUsesPerResource:"+this.maxUsesPerResource,"verbose"),this.destroy(n.resource),this._dispense()):(this._inUseObjects.splice(a,1),this._addResourceToAvailableObjects(n.resource,n.useCount))}async destroy(r){let a=this._availableObjects.length,n=this._inUseObjects.length;if(this._availableObjects=this._availableObjects.filter(i=>i.resource!==r),this._inUseObjects=this._inUseObjects.filter(i=>i.resource!==r),a===this._availableObjects.length&&n===this._inUseObjects.length){this._ensureMinimum();return}this._count-=1,this._count<0&&(this._count=0);try{await this._factory.destroy(r)}finally{this._ensureMinimum(),this._draining||process.nextTick(()=>{this._dispense()})}}drain(){this._log("draining","info"),this._draining=!0;let r=a=>{if(this._pendingAcquires.length>0){this._dispense(),setTimeout(()=>{r(a)},100);return}if(this._availableObjects.length!==this._count){setTimeout(()=>{r(a)},100);return}a()};return new Promise(a=>r(a))}async destroyAllNow(){this._log("force destroying all objects","info"),this._removeIdleScheduled=!1,clearTimeout(this._removeIdleTimer);let r=this._availableObjects.map(n=>n.resource),a=[];for(let n of r)try{await this.destroy(n)}catch(i){this._log("Error destroying resource: "+i.stack,"error"),a.push(i)}if(a.length>0)throw new Nsr.AggregateError(a)}};OC.Pool=uJ});var s5e=A(Nh=>{"use strict";Object.defineProperty(Nh,"__esModule",{value:!0});Nh.Pool=Nh.AggregateError=Nh.TimeoutError=void 0;var Isr=iJ();Object.defineProperty(Nh,"TimeoutError",{enumerable:!0,get:function(){return Isr.TimeoutError}});var Ssr=oJ();Object.defineProperty(Nh,"AggregateError",{enumerable:!0,get:function(){return Ssr.AggregateError}});var xsr=i5e();Object.defineProperty(Nh,"Pool",{enumerable:!0,get:function(){return xsr.Pool}})});var Df=A((j9a,yC)=>{"use strict";var{Pool:lJ,TimeoutError:ksr}=s5e(),Ih=hr(),pJ=qh(),Csr=cn(),{logger:Lsr}=Ti(),Dsr=nA(),Jl=Lsr.debugContext("pool"),uR=class{constructor(r,a){let n=Ih.cloneDeep(a.config);if(this.sequelize=a,this.config=n,this.dialect=r,this.versionPromise=null,this.dialectName=this.sequelize.options.dialect,n.pool===!1)throw new Error("Support for pool:false was removed in v4.0");n.pool=Ih.defaults(n.pool||{},{max:5,min:0,idle:1e4,acquire:6e4,evict:1e3,validate:this._validate.bind(this)}),this.initPools()}refreshTypeParser(r){Ih.each(r,a=>{if(Object.prototype.hasOwnProperty.call(a,"parse"))if(a.types[this.dialectName])this._refreshTypeParser(a);else throw new Error(`Parse function not supported for type ${a.key} in dialect ${this.dialectName}`)})}_loadDialectModule(r){try{return this.sequelize.config.dialectModulePath?require(this.sequelize.config.dialectModulePath):this.sequelize.config.dialectModule?this.sequelize.config.dialectModule:require(r)}catch(a){throw a.code==="MODULE_NOT_FOUND"?this.sequelize.config.dialectModulePath?new Error(`Unable to find dialect at ${this.sequelize.config.dialectModulePath}`):new Error(`Please install ${r} package manually`):a}}async _onProcessExit(){if(this.pool)return await this.pool.drain(),Jl("connection drain due to process exit"),await this.pool.destroyAllNow()}async close(){return this.getConnection=async function(){throw new Error("ConnectionManager.getConnection was called after the connection manager was closed!")},await this._onProcessExit()}initPools(){let r=this.config;if(!r.replication){this.pool=new lJ({name:"sequelize",create:()=>this._connect(r),destroy:async n=>{let i=await this._disconnect(n);return Jl("connection destroy"),i},validate:r.pool.validate,max:r.pool.max,min:r.pool.min,acquireTimeoutMillis:r.pool.acquire,idleTimeoutMillis:r.pool.idle,reapIntervalMillis:r.pool.evict,maxUses:r.pool.maxUses}),Jl(`pool created with max/min: ${r.pool.max}/${r.pool.min}, no replication`);return}Array.isArray(r.replication.read)||(r.replication.read=[r.replication.read]),r.replication.write=Ih.defaults(r.replication.write,Ih.omit(r,"replication")),r.replication.read=r.replication.read.map(n=>Ih.defaults(n,Ih.omit(this.config,"replication")));let a=0;this.pool={release:n=>{n.queryType==="read"?this.pool.read.release(n):this.pool.write.release(n)},acquire:(n,i)=>(i=i===void 0?!1:i,n==="SELECT"&&!i?this.pool.read.acquire():this.pool.write.acquire()),destroy:n=>{this.pool[n.queryType].destroy(n),Jl("connection destroy")},destroyAllNow:async()=>{await Promise.all([this.pool.read.destroyAllNow(),this.pool.write.destroyAllNow()]),Jl("all connections destroyed")},drain:async()=>Promise.all([this.pool.write.drain(),this.pool.read.drain()]),read:new lJ({name:"sequelize:read",create:async()=>{let n=a++%r.replication.read.length,i=await this._connect(r.replication.read[n]);return i.queryType="read",i},destroy:n=>this._disconnect(n),validate:r.pool.validate,max:r.pool.max,min:r.pool.min,acquireTimeoutMillis:r.pool.acquire,idleTimeoutMillis:r.pool.idle,reapIntervalMillis:r.pool.evict,maxUses:r.pool.maxUses}),write:new lJ({name:"sequelize:write",create:async()=>{let n=await this._connect(r.replication.write);return n.queryType="write",n},destroy:n=>this._disconnect(n),validate:r.pool.validate,max:r.pool.max,min:r.pool.min,acquireTimeoutMillis:r.pool.acquire,idleTimeoutMillis:r.pool.idle,reapIntervalMillis:r.pool.evict,maxUses:r.pool.maxUses})},Jl(`pool created with max/min: ${r.pool.max}/${r.pool.min}, with replication`)}async getConnection(r){r=r||{},this.sequelize.options.databaseVersion===0&&(this.versionPromise||(this.versionPromise=(async()=>{try{let n=await this._connect(this.config.replication.write||this.config),i={};if(i.transaction={connection:n},i.logging=()=>{},i.logging.__testLoggingFn=!0,this.sequelize.options.databaseVersion===0){let s=await this.sequelize.databaseVersion(i),o=Ih.get(pJ.coerce(s),"version")||s;this.sequelize.options.databaseVersion=pJ.valid(o)?o:this.dialect.defaultVersion}return pJ.lt(this.sequelize.options.databaseVersion,this.dialect.defaultVersion)&&(Dsr.unsupportedEngine(),Jl(`Unsupported database engine version ${this.sequelize.options.databaseVersion}`)),this.versionPromise=null,await this._disconnect(n)}catch(n){throw this.versionPromise=null,n}})()),await this.versionPromise);let a;try{await this.sequelize.runHooks("beforePoolAcquire",r),a=await this.pool.acquire(r.type,r.useMaster),await this.sequelize.runHooks("afterPoolAcquire",a,r)}catch(n){throw n instanceof ksr?new Csr.ConnectionAcquireTimeoutError(n):n}return Jl("connection acquired"),a}releaseConnection(r){this.pool.release(r),Jl("connection released")}async destroyConnection(r){await this.pool.destroy(r),Jl(`connection ${r.uuid} destroyed`)}async _connect(r){await this.sequelize.runHooks("beforeConnect",r);let a=await this.dialect.connectionManager.connect(r);return await this.sequelize.runHooks("afterConnect",a,r),a}async _disconnect(r){return await this.sequelize.runHooks("beforeDisconnect",r),await this.dialect.connectionManager.disconnect(r),this.sequelize.runHooks("afterDisconnect",r)}_validate(r){return this.dialect.connectionManager.validate?this.dialect.connectionManager.validate(r):!0}};yC.exports=uR;yC.exports.ConnectionManager=uR;yC.exports.default=uR});var Vc=A((G9a,o5e)=>{"use strict";var lR=new Map;o5e.exports=t=>(lR.has(t)||lR.set(t,new Map),{clear(){lR.get(t).clear()},refresh(r){for(let a of r.types[t])lR.get(t).set(a,r.parse)},get(r){return lR.get(t).get(r)}})});var p5e=A((Q9a,EC)=>{"use strict";var Bsr=Object.defineProperty,c5e=Object.getOwnPropertySymbols,Psr=Object.prototype.hasOwnProperty,Wsr=Object.prototype.propertyIsEnumerable,u5e=(t,r,a)=>r in t?Bsr(t,r,{enumerable:!0,configurable:!0,writable:!0,value:a}):t[r]=a,Usr=(t,r)=>{for(var a in r||(r={}))Psr.call(r,a)&&u5e(t,a,r[a]);if(c5e)for(var a of c5e(r))Wsr.call(r,a)&&u5e(t,a,r[a]);return t},Fsr=qh(),jsr=Df(),uA=cn(),{logger:Gsr}=Ti(),Qsr=Ja().mariadb,Hsr=Hl(),l5e=Gsr.debugContext("connection:mariadb"),zC=Vc()("mariadb"),pR=class t extends jsr{constructor(r,a){a.config.port=a.config.port||3306,super(r,a),this.lib=this._loadDialectModule("mariadb"),this.refreshTypeParser(Qsr)}static _typecast(r,a){return zC.get(r.type)?zC.get(r.type)(r,this.sequelize.options,a):a()}_refreshTypeParser(r){zC.refresh(r)}_clearTypeParser(){zC.clear()}async connect(r){let a=this.sequelize.options.timezone;a=/\//.test(a)?Hsr.tz(a).format("Z"):a;let n=Usr({host:r.host,port:r.port,user:r.username,password:r.password,database:r.database,timezone:a,typeCast:t._typecast.bind(this),bigNumberStrings:!1,supportBigNumbers:!0,foundRows:!1},r.dialectOptions);this.sequelize.config.keepDefaultTimezone||(n.initSql?(Array.isArray(n.initSql)||(n.initSql=[n.initSql]),n.initSql.push(`SET time_zone = '${a}'`)):n.initSql=`SET time_zone = '${a}'`);try{let i=await this.lib.createConnection(n);return this.sequelize.options.databaseVersion=Fsr.coerce(i.serverVersion()).version,l5e("connection acquired"),i.on("error",s=>{switch(s.code){case"ESOCKET":case"ECONNRESET":case"EPIPE":case"PROTOCOL_CONNECTION_LOST":this.pool.destroy(i)}}),i}catch(i){switch(i.code){case"ECONNREFUSED":throw new uA.ConnectionRefusedError(i);case"ER_ACCESS_DENIED_ERROR":case"ER_ACCESS_DENIED_NO_PASSWORD_ERROR":throw new uA.AccessDeniedError(i);case"ENOTFOUND":throw new uA.HostNotFoundError(i);case"EHOSTUNREACH":case"ENETUNREACH":case"EADDRNOTAVAIL":throw new uA.HostNotReachableError(i);case"EINVAL":throw new uA.InvalidConnectionError(i);default:throw new uA.ConnectionError(i)}}}async disconnect(r){if(!r.isValid()){l5e("connection tried to disconnect but was already at CLOSED state");return}return await r.end()}validate(r){return r&&r.isValid()}};EC.exports=pR;EC.exports.ConnectionManager=pR;EC.exports.default=pR});var Bf=A((H9a,wC)=>{"use strict";var Vsr=Object.defineProperty,f5e=Object.getOwnPropertySymbols,$sr=Object.prototype.hasOwnProperty,Ysr=Object.prototype.propertyIsEnumerable,d5e=(t,r,a)=>r in t?Vsr(t,r,{enumerable:!0,configurable:!0,writable:!0,value:a}):t[r]=a,Xsr=(t,r)=>{for(var a in r||(r={}))$sr.call(r,a)&&d5e(t,a,r[a]);if(f5e)for(var a of f5e(r))Ysr.call(r,a)&&d5e(t,a,r[a]);return t},Sh=hr(),Ksr=Cv(),rc=m1(),Jsr=Wv(),Zsr=nA(),eor=(JM(),gf(KM)).v4,{safeStringifyJson:h5e}=On(),fR=class t{constructor(r,a,n){this.uuid=eor(),this.connection=r,this.instance=n.instance,this.model=n.model,this.sequelize=a,this.options=Xsr({plain:!1,raw:!1,logging:console.log},n),this.checkLoggingOption(),n.rawErrors&&(this.formatError=t.prototype.formatError)}static formatBindParameters(r,a,n,i,s){if(!a)return[r,[]];if(s=s||{},typeof i!="function"&&(s=i||{},i=void 0),!i)s.skipValueReplace?i=(u,l,f)=>{if(f[l]!==void 0)return u}:i=(u,l,f,d,h)=>{if(f[l]!==void 0)return Ksr.escape(f[l],d,h)};else if(s.skipValueReplace){let u=i;i=(l,f,d,h,b,m)=>{if(u(l,f,d,h,b,m)!==void 0)return l}}let o=null,c=Array.isArray(a);return r=r.replace(/\B\$(\$|\w+)/g,(u,l)=>{if(l==="$")return s.skipUnescape?u:l;let f;if(c?l.match(/^[1-9]\d*$/)&&(l=l-1,f=i(u,l,a,o,n,s)):l.match(/^\d*$/)||(f=i(u,l,a,o,n,s)),f===void 0)throw new Error(`Named bind parameter "${u}" has no value in the given object.`);return f}),[r,[]]}formatError(r,a){return r.stack=a,r}run(){throw new Error("The run method wasn't overwritten!")}checkLoggingOption(){this.options.logging===!0&&(Zsr.noTrueLogging(),this.options.logging=console.log)}getInsertIdField(){return"insertId"}getUniqueConstraintErrorMessage(r){let a=r?`${r} must be unique`:"Must be unique";if(r&&this.model)for(let n of Object.keys(this.model.uniqueKeys))this.model.uniqueKeys[n].fields.includes(r.replace(/"/g,""))&&this.model.uniqueKeys[n].msg&&(a=this.model.uniqueKeys[n].msg);return a}isRawQuery(){return this.options.type===rc.RAW}isVersionQuery(){return this.options.type===rc.VERSION}isUpsertQuery(){return this.options.type===rc.UPSERT}isInsertQuery(r,a){let n=!0;return this.options.type===rc.INSERT?!0:(n=n&&this.sql.toLowerCase().startsWith("insert into"),n=n&&(!r||Object.prototype.hasOwnProperty.call(r,this.getInsertIdField())),n=n&&(!a||Object.prototype.hasOwnProperty.call(a,this.getInsertIdField())),n)}handleInsertQuery(r,a){if(this.instance){let n=this.model.autoIncrementAttribute,i=null;i=i||r&&r[this.getInsertIdField()],i=i||a&&a[this.getInsertIdField()],this.instance[n]=i}}isShowTablesQuery(){return this.options.type===rc.SHOWTABLES}handleShowTablesQuery(r){return Sh.flatten(r.map(a=>Object.values(a)))}isShowIndexesQuery(){return this.options.type===rc.SHOWINDEXES}isShowConstraintsQuery(){return this.options.type===rc.SHOWCONSTRAINTS}isDescribeQuery(){return this.options.type===rc.DESCRIBE}isSelectQuery(){return this.options.type===rc.SELECT}isBulkUpdateQuery(){return this.options.type===rc.BULKUPDATE}isBulkDeleteQuery(){return this.options.type===rc.BULKDELETE}isForeignKeysQuery(){return this.options.type===rc.FOREIGNKEYS}isUpdateQuery(){return this.options.type===rc.UPDATE}handleSelectQuery(r){let a=null;if(this.options.fieldMap){let n=this.options.fieldMap;r=r.map(i=>Sh.reduce(n,(s,o,c)=>(s[c]!==void 0&&o!==c&&(s[o]=s[c],delete s[c]),s),i))}return this.options.raw?a=r.map(n=>{let i={};for(let s in n)Object.prototype.hasOwnProperty.call(n,s)&&(i[s]=n[s]);return this.options.nest&&(i=Jsr.transform(i)),i}):this.options.hasJoin===!0?(r=t._groupJoinData(r,{model:this.model,includeMap:this.options.includeMap,includeNames:this.options.includeNames},{checkExisting:this.options.hasMultiAssociation}),a=this.model.bulkBuild(r,{isNewRecord:!1,include:this.options.include,includeNames:this.options.includeNames,includeMap:this.options.includeMap,includeValidated:!0,attributes:this.options.originalAttributes||this.options.attributes,raw:!0})):a=this.model.bulkBuild(r,{isNewRecord:!1,raw:!0,attributes:this.options.originalAttributes||this.options.attributes}),this.options.plain&&(a=a.length===0?null:a[0]),a}isShowOrDescribeQuery(){let r=!1;return r=r||this.sql.toLowerCase().startsWith("show"),r=r||this.sql.toLowerCase().startsWith("describe"),r}isCallQuery(){return this.sql.toLowerCase().startsWith("call")}_logQuery(r,a,n){let{connection:i,options:s}=this,o=this.sequelize.options.benchmark||s.benchmark,c=this.sequelize.options.logQueryParameters||s.logQueryParameters,u=Date.now(),l="";if(c&&n){let h=r.endsWith(";")?"":";",b;Array.isArray(n)?b=n.map(m=>h5e(m)).join(", "):b=h5e(n),l=`${h} ${b}`}let f=`(${i.uuid||"default"}): ${r}${l}`,d=`Executing ${f}`;return a(d),o||this.sequelize.log(`Executing ${f}`,s),()=>{let h=`Executed ${f}`;a(h),o&&this.sequelize.log(h,Date.now()-u,s)}}static _groupJoinData(r,a,n){if(!r.length)return[];let i,s,o,c,u,l,f=r.length,d,h,b,m,g,O,z,w,v=n.checkExisting,T,x,L,P=v?[]:new Array(f),C={},Q={},X,k,se,F,D,j,V,he,oe=ne=>{Object.prototype.hasOwnProperty.call(j.includeMap,ne)&&(Q[h]=j=j.includeMap[ne],he?he=`${he}.${ne}`:he=ne,Q[he]=j)},ie={},De=(ne,we)=>(Object.prototype.hasOwnProperty.call(we,ne)||(we[ne]=ne.substr(0,ne.lastIndexOf("."))),we[ne]),Ge={},Ze=ne=>{if(!Object.prototype.hasOwnProperty.call(Ge,ne)){let we=ne.lastIndexOf(".");Ge[ne]=ne.substr(we===-1?0:we+1)}return Ge[ne]},te={},me=ne=>{if(!Object.prototype.hasOwnProperty.call(te,ne)){let we=De(ne,ie);Object.prototype.hasOwnProperty.call(te,we)||(te[we]=we?we.split("."):[]),te[ne]=te[we]}return te[ne]},ve={},ye=ne=>{if(!Object.prototype.hasOwnProperty.call(ve,ne)){let we=me(ne),ke=we.length;ve[ne]=ke?we[ke-1]:""}return ve[ne]},Qe=ne=>{let we=Sh.chain(ne.uniqueKeys);return we=we.result(`${we.findKey()}.fields`).map(ke=>Sh.findKey(ne.attributes,je=>je.field===ke)).value(),we},Ke=ne=>ne instanceof Buffer?ne.toString("hex"):ne,Se,ft,qe;for(u=0;u<f;u++){if(l=r[u],u===0&&(d=Sh.sortBy(Object.keys(l),ne=>[ne.split(".").length]),m=d.length),v){if(w=!1,c=a.model.primaryKeyAttributes.length,L="",c===1)L=Ke(l[a.model.primaryKeyAttributes[0]]);else if(c>1)for(o=0;o<c;o++)L+=Ke(l[a.model.primaryKeyAttributes[o]]);else if(!Sh.isEmpty(a.model.uniqueKeys))for(ft=Qe(a.model),o=0;o<ft.length;o++)L+=l[ft[o]]}for(z=O={},F=void 0,b=0;b<m;b++){if(h=d[b],k=De(h,ie),X=me(h),u===0&&!Object.prototype.hasOwnProperty.call(Q,h)&&(X.length?(j=a,he=void 0,X.forEach(oe)):Q[h]=Q[""]=a),F!==void 0&&F!==X){if(v){if(s=F.length,V=null,x=null,s)for(i=0;i<s;i++){if(qe=V?`${V}.${F[i]}`:F[i],Se=Q[qe].model.primaryKeyAttributes,c=Se.length,T=qe,c===1)T+=Ke(l[`${qe}.${Se[0]}`]);else if(c>1)for(o=0;o<c;o++)T+=Ke(l[`${qe}.${Se[o]}`]);else if(!Sh.isEmpty(Q[qe].model.uniqueKeys))for(ft=Qe(Q[qe].model),o=0;o<ft.length;o++)T+=l[`${qe}.${ft[o]}`];x||(x=L),T=x+T,V=qe,i<s-1&&(x=T)}else T=L;T===L?C[T]?w=!0:C[T]=O:C[T]||(V=C[x],D=ye(g),Q[g].association.isSingleAssociation?V&&(V[D]=C[T]=O):(V[D]||(V[D]=[]),V[D].push(C[T]=O))),O={}}else if(j=z,s=X.length,s)for(i=0;i<s;i++)i===s-1&&(O=j[X[i]]={}),j=j[X[i]]||{}}O[Ze(h)]=l[h],g=h,F=X,se=k}if(v){if(s=F.length,V=null,x=null,s)for(i=0;i<s;i++){if(qe=V?`${V}.${F[i]}`:F[i],Se=Q[qe].model.primaryKeyAttributes,c=Se.length,T=qe,c===1)T+=Ke(l[`${qe}.${Se[0]}`]);else if(c>0)for(o=0;o<c;o++)T+=Ke(l[`${qe}.${Se[o]}`]);else if(!Sh.isEmpty(Q[qe].model.uniqueKeys))for(ft=Qe(Q[qe].model),o=0;o<ft.length;o++)T+=l[`${qe}.${ft[o]}`];x||(x=L),T=x+T,V=qe,i<s-1&&(x=T)}else T=L;T===L?C[T]?w=!0:C[T]=O:C[T]||(V=C[x],D=ye(g),Q[g].association.isSingleAssociation?V&&(V[D]=C[T]=O):(V[D]||(V[D]=[]),V[D].push(C[T]=O))),w||P.push(z)}else P[u]=z}return P}};wC.exports=fR;wC.exports.AbstractQuery=fR;wC.exports.default=fR});var y5e=A((V9a,O5e)=>{"use strict";var tor=Object.defineProperty,b5e=Object.getOwnPropertySymbols,ror=Object.prototype.hasOwnProperty,aor=Object.prototype.propertyIsEnumerable,m5e=(t,r,a)=>r in t?tor(t,r,{enumerable:!0,configurable:!0,writable:!0,value:a}):t[r]=a,nor=(t,r)=>{for(var a in r||(r={}))ror.call(r,a)&&m5e(t,a,r[a]);if(b5e)for(var a of b5e(r))aor.call(r,a)&&m5e(t,a,r[a]);return t},_5e=Bf(),vC=cn(),g5e=hr(),fJ=Ja(),{logger:ior}=Ti(),sor=1062,oor=1213,M5e=1451,cor=1452,A5e=ior.debugContext("sql:mariadb"),dJ=class extends _5e{constructor(r,a,n){super(r,a,nor({showWarnings:!1},n))}static formatBindParameters(r,a,n){let i=[],s=(o,c,u)=>{if(u[c]!==void 0)return i.push(u[c]),"?"};return r=_5e.formatBindParameters(r,a,n,s)[0],[r,i.length>0?i:void 0]}async run(r,a){this.sql=r;let{connection:n,options:i}=this,s=this.sequelize.options.showWarnings||i.showWarnings,o=this._logQuery(r,A5e,a);a&&A5e("parameters(%j)",a);let c,u=new Error;try{c=await n.query(this.sql,a)}catch(l){if(i.transaction&&l.errno===oor){try{await i.transaction.rollback()}catch{}i.transaction.finished="rollback"}throw l.sql=r,l.parameters=a,this.formatError(l,u.stack)}finally{o()}return s&&c&&c.warningStatus>0&&await this.logWarnings(c),this.formatResults(c)}formatResults(r){let a=this.instance;if(this.isBulkUpdateQuery()||this.isBulkDeleteQuery())return r.affectedRows;if(this.isUpsertQuery())return[a,r.affectedRows===1];if(this.isInsertQuery(r)&&(this.handleInsertQuery(r),!this.instance)){if(this.model&&this.model.autoIncrementAttribute&&this.model.autoIncrementAttribute===this.model.primaryKeyAttribute&&this.model.rawAttributes[this.model.primaryKeyAttribute]){let n=r[this.getInsertIdField()];a=new Array(r.affectedRows);let i=this.model.rawAttributes[this.model.primaryKeyAttribute].field;for(let s=0;s<r.affectedRows;s++)a[s]={[i]:n+s};return[a,r.affectedRows]}return[r[this.getInsertIdField()],r.affectedRows]}if(this.isSelectQuery())return this.handleJsonSelectQuery(r),this.handleSelectQuery(r);if(this.isInsertQuery()||this.isUpdateQuery())return[a,r.affectedRows];if(this.isCallQuery())return r[0];if(this.isRawQuery()){let n=r.meta;return delete r.meta,[r,n]}if(this.isShowIndexesQuery())return this.handleShowIndexesQuery(r);if(this.isForeignKeysQuery()||this.isShowConstraintsQuery())return r;if(this.isShowTablesQuery())return this.handleShowTablesQuery(r);if(this.isDescribeQuery()){a={};for(let n of r)a[n.Field]={type:n.Type.toLowerCase().startsWith("enum")?n.Type.replace(/^enum/i,"ENUM"):n.Type.toUpperCase(),allowNull:n.Null==="YES",defaultValue:n.Default,primaryKey:n.Key==="PRI",autoIncrement:Object.prototype.hasOwnProperty.call(n,"Extra")&&n.Extra.toLowerCase()==="auto_increment",comment:n.Comment?n.Comment:null};return a}return this.isVersionQuery()?r[0].version:a}handleJsonSelectQuery(r){if(!(!this.model||!this.model.fieldRawAttributesMap))for(let a of Object.keys(this.model.fieldRawAttributesMap)){let n=this.model.fieldRawAttributesMap[a];n.type instanceof fJ.JSON&&(r=r.map(i=>(i[n.fieldName]&&typeof i[n.fieldName]=="string"&&!this.connection.info.hasMinVersion(10,5,2)&&(i[n.fieldName]=JSON.parse(i[n.fieldName])),fJ.JSON.parse?fJ.JSON.parse(n,this.sequelize.options,i[n.fieldName]):i)))}}async logWarnings(r){let a=await this.run("SHOW WARNINGS"),n=`MariaDB Warnings (${this.connection.uuid||"default"}): `,i=[];for(let s of a)if(!(s===void 0||typeof s[Symbol.iterator]!="function"))for(let o of s)if(Object.prototype.hasOwnProperty.call(o,"Message"))i.push(o.Message);else for(let c of o.keys())i.push([c,o[c]].join(": "));return this.sequelize.log(n+i.join("; "),this.options),r}formatError(r,a){switch(r.errno){case sor:{let n=r.message.match(/Duplicate entry '([\s\S]*)' for key '?((.|\s)*?)'?\s.*$/),i={},s="Validation error",o=n?n[1].split("-"):void 0,c=n?n[2]:void 0,u=n?n[1]:void 0,l=this.model&&this.model.uniqueKeys[c];l?(l.msg&&(s=l.msg),i=g5e.zipObject(l.fields,o)):i[c]=u;let f=[];return g5e.forOwn(i,(d,h)=>{f.push(new vC.ValidationErrorItem(this.getUniqueConstraintErrorMessage(h),"unique violation",h,d,this.instance,"not_unique"))}),new vC.UniqueConstraintError({message:s,errors:f,parent:r,fields:i,stack:a})}case M5e:case cor:{let n=r.message.match(/CONSTRAINT ([`"])(.*)\1 FOREIGN KEY \(\1(.*)\1\) REFERENCES \1(.*)\1 \(\1(.*)\1\)/),i=n?n[1]:"`",s=n?n[3].split(new RegExp(`${i}, *${i}`)):void 0;return new vC.ForeignKeyConstraintError({reltype:r.errno===M5e?"parent":"child",table:n?n[4]:void 0,fields:s,value:s&&s.length&&this.instance&&this.instance[s[0]]||void 0,index:n?n[2]:void 0,parent:r,stack:a})}default:return new vC.DatabaseError(r,{stack:a})}}handleShowTablesQuery(r){return r.map(a=>({tableName:a.TABLE_NAME,schema:a.TABLE_SCHEMA}))}handleShowIndexesQuery(r){let a,n=[];return r.forEach(i=>{(!a||a.name!==i.Key_name)&&(a={primary:i.Key_name==="PRIMARY",fields:[],name:i.Key_name,tableName:i.Table,unique:i.Non_unique!==1,type:i.Index_type},n.push(a)),a.fields[i.Seq_in_index-1]={attribute:i.Column_name,length:i.Sub_part||void 0,order:i.Collation==="A"?"ASC":void 0}}),n}};O5e.exports=dJ});var v5e=A(($9a,w5e)=>{"use strict";var uor=Object.defineProperty,z5e=Object.getOwnPropertySymbols,lor=Object.prototype.hasOwnProperty,por=Object.prototype.propertyIsEnumerable,E5e=(t,r,a)=>r in t?uor(t,r,{enumerable:!0,configurable:!0,writable:!0,value:a}):t[r]=a,dor=(t,r)=>{for(var a in r||(r={}))lor.call(r,a)&&E5e(t,a,r[a]);if(z5e)for(var a of z5e(r))por.call(r,a)&&E5e(t,a,r[a]);return t},RC=hr(),sa=Ws(),hor=On(),bor={OperatorMap:{[sa.eq]:"=",[sa.ne]:"!=",[sa.gte]:">=",[sa.gt]:">",[sa.lte]:"<=",[sa.lt]:"<",[sa.not]:"IS NOT",[sa.is]:"IS",[sa.in]:"IN",[sa.notIn]:"NOT IN",[sa.like]:"LIKE",[sa.notLike]:"NOT LIKE",[sa.iLike]:"ILIKE",[sa.notILike]:"NOT ILIKE",[sa.startsWith]:"LIKE",[sa.endsWith]:"LIKE",[sa.substring]:"LIKE",[sa.regexp]:"~",[sa.notRegexp]:"!~",[sa.iRegexp]:"~*",[sa.notIRegexp]:"!~*",[sa.between]:"BETWEEN",[sa.notBetween]:"NOT BETWEEN",[sa.overlap]:"&&",[sa.contains]:"@>",[sa.contained]:"<@",[sa.adjacent]:"-|-",[sa.strictLeft]:"<<",[sa.strictRight]:">>",[sa.noExtendRight]:"&<",[sa.noExtendLeft]:"&>",[sa.any]:"ANY",[sa.all]:"ALL",[sa.and]:" AND ",[sa.or]:" OR ",[sa.col]:"COL",[sa.placeholder]:"$$PLACEHOLDER$$",[sa.match]:"@@"},OperatorsAliasMap:{},setOperatorsAliases(t){!t||RC.isEmpty(t)?this.OperatorsAliasMap=!1:this.OperatorsAliasMap=dor({},t)},_replaceAliases(t){let r={};return this.OperatorsAliasMap?(hor.getOperators(t).forEach(a=>{let n=t[a];RC.isPlainObject(n)?r[a]=this._replaceAliases(n):r[a]=n}),RC.forOwn(t,(a,n)=>{n=this.OperatorsAliasMap[n]||n,RC.isPlainObject(a)&&(a=this._replaceAliases(a)),r[n]=a}),r):t}};w5e.exports=bor});var T5e=A((Y9a,R5e)=>{"use strict";var mor=(JM(),gf(KM)).v4,_or={setIsolationLevelQuery(t,r){if(!r.parent)return`SET TRANSACTION ISOLATION LEVEL ${t};`},generateTransactionId(){return mor()},startTransactionQuery(t){return t.parent?`SAVEPOINT ${this.quoteIdentifier(t.name,!0)};`:"START TRANSACTION;"},deferConstraintsQuery(){},setConstraintQuery(){},setDeferredQuery(){},setImmediateQuery(){},commitTransactionQuery(t){if(!t.parent)return"COMMIT;"},rollbackTransactionQuery(t){return t.parent?`ROLLBACK TO SAVEPOINT ${this.quoteIdentifier(t.name,!0)};`:"ROLLBACK;"}};R5e.exports=_or});var xh=A((K9a,x5e)=>{"use strict";var gor=Object.defineProperty,Mor=Object.defineProperties,Aor=Object.getOwnPropertyDescriptors,q5e=Object.getOwnPropertySymbols,Oor=Object.prototype.hasOwnProperty,yor=Object.prototype.propertyIsEnumerable,N5e=(t,r,a)=>r in t?gor(t,r,{enumerable:!0,configurable:!0,writable:!0,value:a}):t[r]=a,A2=(t,r)=>{for(var a in r||(r={}))Oor.call(r,a)&&N5e(t,a,r[a]);if(q5e)for(var a of q5e(r))yor.call(r,a)&&N5e(t,a,r[a]);return t},TC=(t,r)=>Mor(t,Aor(r)),qC=require("util"),ra=hr(),zor=(JM(),gf(KM)).v4,Qt=On(),X9a=nA(),I5e=Cv(),lA=Ja(),Uu=vK(),pA=vh(),hJ=Rh(),Eor=tA(),wor=h2(),Rt=Ws(),bJ=cn(),S5e=LK(),dR=class{constructor(r){if(!r.sequelize)throw new Error("QueryGenerator initialized without options.sequelize");if(!r._dialect)throw new Error("QueryGenerator initialized without options._dialect");this.sequelize=r.sequelize,this.options=r.sequelize.options,this.dialect=r._dialect.name,this._dialect=r._dialect,this._initQuoteIdentifier()}extractTableDetails(r,a){return a=a||{},r=r||{},{schema:r.schema||a.schema||this.options.schema||"public",tableName:ra.isPlainObject(r)?r.tableName:r,delimiter:r.delimiter||a.delimiter||"."}}addSchema(r){if(!r._schema)return r.tableName||r;let a=this;return{tableName:r.tableName||r,table:r.tableName||r,name:r.name||r,schema:r._schema,delimiter:r._schemaDelimiter||".",toString(){return a.quoteTable(this)}}}dropSchema(r,a){return this.dropTableQuery(r,a)}describeTableQuery(r,a,n){return`DESCRIBE ${this.quoteTable(this.addSchema({tableName:r,_schema:a,_schemaDelimiter:n}))};`}dropTableQuery(r){return`DROP TABLE IF EXISTS ${this.quoteTable(r)};`}renameTableQuery(r,a){return`ALTER TABLE ${this.quoteTable(r)} RENAME TO ${this.quoteTable(a)};`}populateInsertQueryReturnIntoBinds(){}insertQuery(r,a,n,i){i=i||{},ra.defaults(i,this.options);let s={},o=i.bind||[],c=[],u=[],l=[],f=[],d=this.quoteTable(r),h=i.bindParam===void 0?this.bindParam(o):i.bindParam,b=[],m,g="",O="",z="",w="",v=!1,T="";if(n&&ra.each(n,(C,Q)=>{s[Q]=C,C.field&&(s[C.field]=C)}),this._dialect.supports["DEFAULT VALUES"]?O+=" DEFAULT VALUES":this._dialect.supports["VALUES ()"]&&(O+=" VALUES ()"),(this._dialect.supports.returnValues||this._dialect.supports.returnIntoValues)&&i.returning){let C=this.generateReturnValues(n,i);u.push(...C.returnFields),this._dialect.supports.returnIntoValues&&l.push(...C.returnTypes),w=C.returningFragment,T=C.tmpTable||"",z=C.outputFragment||""}(ra.get(this,["sequelize","options","dialectOptions","prependSearchPath"])||i.searchPath)&&(i.bindParam=!1),this._dialect.supports.EXCEPTION&&i.exception&&(i.bindParam=!1),a=Qt.removeNullValuesFromHash(a,this.options.omitNull);for(let C in a)if(Object.prototype.hasOwnProperty.call(a,C)){let Q=a[C];c.push(this.quoteIdentifier(C)),s&&s[C]&&s[C].autoIncrement===!0&&Q==null?this._dialect.supports.autoIncrement.defaultValue?this._dialect.supports.DEFAULT?f.push("DEFAULT"):f.push(this.escape(null)):c.splice(-1,1):(s&&s[C]&&s[C].autoIncrement===!0&&(v=!0),Q instanceof Qt.SequelizeMethod||i.bindParam===!1?f.push(this.escape(Q,s&&s[C]||void 0,{context:"INSERT"})):f.push(this.format(Q,s&&s[C]||void 0,{context:"INSERT"},h)))}let x="";if(!ra.isEmpty(i.conflictWhere)&&!this._dialect.supports.inserts.onConflictWhere)throw new Error("missing dialect support for conflictWhere option");if(this._dialect.supports.inserts.updateOnDuplicate&&i.updateOnDuplicate)if(this._dialect.supports.inserts.updateOnDuplicate==" ON CONFLICT DO UPDATE SET"){let C=i.upsertKeys.map(k=>this.quoteIdentifier(k)),Q=i.updateOnDuplicate.map(k=>`${this.quoteIdentifier(k)}=EXCLUDED.${this.quoteIdentifier(k)}`),X=["ON CONFLICT","(",C.join(","),")"];ra.isEmpty(i.conflictWhere)||X.push(this.whereQuery(i.conflictWhere,i)),ra.isEmpty(Q)?X.push("DO NOTHING"):X.push("DO UPDATE SET",Q.join(",")),x=` ${Qt.joinSQLFragments(X)}`}else{let C=i.updateOnDuplicate.map(Q=>`${this.quoteIdentifier(Q)}=VALUES(${this.quoteIdentifier(Q)})`);if(ra.isEmpty(C)&&i.upsertKeys&&C.push(...i.upsertKeys.map(Q=>`${this.quoteIdentifier(Q)}=${this.quoteIdentifier(Q)}`)),ra.isEmpty(C))throw new Error("No update values found for ON DUPLICATE KEY UPDATE clause, and no identifier fields could be found to use instead.");x+=`${this._dialect.supports.inserts.updateOnDuplicate} ${C.join(",")}`}let L={ignoreDuplicates:i.ignoreDuplicates?this._dialect.supports.inserts.ignoreDuplicates:"",onConflictDoNothing:i.ignoreDuplicates?this._dialect.supports.inserts.onConflictDoNothing:"",attributes:c.join(","),output:z,values:f.join(","),tmpTable:T};if(g=`${T}INSERT${L.ignoreDuplicates} INTO ${d} (${L.attributes})${L.output} VALUES (${L.values})${x}${L.onConflictDoNothing}${g}`,O=`${T}INSERT${L.ignoreDuplicates} INTO ${d}${L.output}${x}${L.onConflictDoNothing}${O}`,this._dialect.supports.EXCEPTION&&i.exception){let C="DROP FUNCTION IF EXISTS pg_temp.testfunc()";u.length===0&&u.push("*");let Q=`$func_${zor().replace(/-/g,"")}$`,X=`SELECT (testfunc.response).${u.join(", (testfunc.response).")}, testfunc.sequelize_caught_exception FROM pg_temp.testfunc();`;i.exception="WHEN unique_violation THEN GET STACKED DIAGNOSTICS sequelize_caught_exception = PG_EXCEPTION_DETAIL;",g=`CREATE OR REPLACE FUNCTION pg_temp.testfunc(OUT response ${d}, OUT sequelize_caught_exception text) RETURNS RECORD AS ${Q} BEGIN ${g} RETURNING * INTO response; EXCEPTION ${i.exception} END ${Q} LANGUAGE plpgsql; ${X} ${C}`}else g+=w,O+=w;this._dialect.supports.returnIntoValues&&i.returning&&this.populateInsertQueryReturnIntoBinds(u,l,o.length,b,i),m=`${L.attributes.length?g:O}${b.join(",")};`,this._dialect.supports.finalTable&&(m=`SELECT * FROM FINAL TABLE(${L.attributes.length?g:O});`),v&&this._dialect.supports.autoIncrement.identityInsert&&(m=`SET IDENTITY_INSERT ${d} ON; ${m} SET IDENTITY_INSERT ${d} OFF;`);let P={query:m};return i.bindParam!==!1&&(P.bind=o),P}bulkInsertQuery(r,a,n,i){n=n||{},i=i||{};let s=[],o={},c=[],u="";for(let b of a)ra.forOwn(b,(m,g)=>{c.includes(g)||c.push(g),i[g]&&i[g].autoIncrement===!0&&(o[g]=!0)});for(let b of a){let m=c.map(g=>this._dialect.supports.bulkDefault&&o[g]===!0?b[g]!=null?b[g]:"DEFAULT":this.escape(b[g],i[g],{context:"INSERT"}));s.push(`(${m.join(",")})`)}if(this._dialect.supports.inserts.updateOnDuplicate&&n.updateOnDuplicate)if(this._dialect.supports.inserts.updateOnDuplicate==" ON CONFLICT DO UPDATE SET"){let b=n.upsertKeys.map(O=>this.quoteIdentifier(O)),m=n.updateOnDuplicate.map(O=>`${this.quoteIdentifier(O)}=EXCLUDED.${this.quoteIdentifier(O)}`),g=!1;if(n.conflictWhere){if(!this._dialect.supports.inserts.onConflictWhere)throw new Error(`conflictWhere not supported for dialect ${this._dialect.name}`);g=this.whereQuery(n.conflictWhere,n)}u=["ON CONFLICT","(",b.join(","),")",g,"DO UPDATE SET",m.join(",")]}else{if(n.conflictWhere)throw new Error(`conflictWhere not supported for dialect ${this._dialect.name}`);let b=n.updateOnDuplicate.map(m=>`${this.quoteIdentifier(m)}=VALUES(${this.quoteIdentifier(m)})`);u=`${this._dialect.supports.inserts.updateOnDuplicate} ${b.join(",")}`}let l=n.ignoreDuplicates?this._dialect.supports.inserts.ignoreDuplicates:"",f=c.map(b=>this.quoteIdentifier(b)).join(","),d=n.ignoreDuplicates?this._dialect.supports.inserts.onConflictDoNothing:"",h="";if(this._dialect.supports.returnValues&&n.returning){let b=this.generateReturnValues(i,n);h+=b.returningFragment}return Qt.joinSQLFragments(["INSERT",l,"INTO",this.quoteTable(r),`(${f})`,"VALUES",s.join(","),u,d,h,";"])}updateQuery(r,a,n,i,s){i=i||{},ra.defaults(i,this.options),a=Qt.removeNullValuesFromHash(a,i.omitNull,i);let o=[],c=[],u={},l="",f="",d="";(ra.get(this,["sequelize","options","dialectOptions","prependSearchPath"])||i.searchPath)&&(i.bindParam=!1);let h=i.bindParam===void 0?this.bindParam(c):i.bindParam;if(this._dialect.supports["LIMIT ON UPDATE"]&&i.limit&&(["mssql","db2","oracle"].includes(this.dialect)?this.dialect==="oracle"&&(n&&(n.length&&n.length>0||Object.keys(n).length>0)?d+=" AND ":d+=" WHERE ",d+=`rownum <= ${this.escape(i.limit)} `):d=` LIMIT ${this.escape(i.limit)} `),this._dialect.supports.returnValues&&i.returning){let O=this.generateReturnValues(s,i);d+=O.returningFragment,f=O.tmpTable||"",l=O.outputFragment||"",!this._dialect.supports.returnValues.output&&i.returning&&(i.mapToModel=!0)}s&&ra.each(s,(O,z)=>{u[z]=O,O.field&&(u[O.field]=O)});for(let O in a){if(u&&u[O]&&u[O].autoIncrement===!0&&!this._dialect.supports.autoIncrement.update)continue;let z=a[O];z instanceof Qt.SequelizeMethod||i.bindParam===!1?o.push(`${this.quoteIdentifier(O)}=${this.escape(z,u&&u[O]||void 0,{context:"UPDATE"})}`):o.push(`${this.quoteIdentifier(O)}=${this.format(z,u&&u[O]||void 0,{context:"UPDATE"},h)}`)}let b=TC(A2({},i),{bindParam:h});if(o.length===0)return"";let g={query:`${f}UPDATE ${this.quoteTable(r)} SET ${o.join(",")}${l} ${this.whereQuery(n,b)}${d}`.trim()};return i.bindParam!==!1&&(g.bind=c),g}arithmeticQuery(r,a,n,i,s,o){o=o||{},ra.defaults(o,{returning:!0}),s=Qt.removeNullValuesFromHash(s,this.options.omitNull);let c="",u="";if(this._dialect.supports.returnValues&&o.returning){let f=this.generateReturnValues(null,o);c=f.outputFragment,u=f.returningFragment}let l=[];for(let f in i){let d=i[f],h=this.quoteIdentifier(f),b=this.escape(d);l.push(`${h}=${h}${r} ${b}`)}for(let f in s){let d=s[f],h=this.quoteIdentifier(f),b=this.escape(d);l.push(`${h}=${b}`)}return Qt.joinSQLFragments(["UPDATE",this.quoteTable(a),"SET",l.join(","),c,this.whereQuery(n),u])}addIndexQuery(r,a,n,i){n=n||{},Array.isArray(a)?n.fields=a:(n=a,a=void 0),n.prefix=n.prefix||i||r,n.prefix&&typeof n.prefix=="string"&&(n.prefix=n.prefix.replace(/\./g,"_"),n.prefix=n.prefix.replace(/("|')/g,""));let s=n.fields.map(u=>{if(u instanceof Qt.SequelizeMethod)return this.handleSequelizeMethod(u);typeof u=="string"&&(u={name:u});let l="";if(u.attribute&&(u.name=u.attribute),!u.name)throw new Error(`The following index field has no name: ${qC.inspect(u)}`);if(l+=this.quoteIdentifier(u.name),this._dialect.supports.index.collate&&u.collate&&(l+=` COLLATE ${this.quoteIdentifier(u.collate)}`),this._dialect.supports.index.operator){let f=u.operator||n.operator;f&&(l+=` ${f}`)}return this._dialect.supports.index.length&&u.length&&(l+=`(${u.length})`),u.order&&(l+=` ${u.order}`),l});n.name||(n=Qt.nameIndex(n,n.prefix)),n=Uu._conformIndex(n),this._dialect.supports.index.type||delete n.type,n.where&&(n.where=this.whereQuery(n.where)),typeof r=="string"?r=this.quoteIdentifiers(r):r=this.quoteTable(r);let o=this._dialect.supports.index.concurrently&&n.concurrently?"CONCURRENTLY":void 0,c;return this._dialect.supports.indexViaAlter?c=["ALTER TABLE",r,o,"ADD"]:c=["CREATE"],c=c.concat(n.unique?"UNIQUE":"",n.type,"INDEX",this._dialect.supports.indexViaAlter?void 0:o,this.quoteIdentifiers(n.name),this._dialect.supports.index.using===1&&n.using?`USING ${n.using}`:"",this._dialect.supports.indexViaAlter?void 0:`ON ${r}`,this._dialect.supports.index.using===2&&n.using?`USING ${n.using}`:"",`(${s.join(", ")})`,this._dialect.supports.index.parser&&n.parser?`WITH PARSER ${n.parser}`:void 0,this._dialect.supports.index.where&&n.where?n.where:void 0),ra.compact(c).join(" ")}addConstraintQuery(r,a){return typeof r=="string"?r=this.quoteIdentifiers(r):r=this.quoteTable(r),Qt.joinSQLFragments(["ALTER TABLE",r,"ADD",this.getConstraintSnippet(r,a||{}),";"])}getConstraintSnippet(r,a){let n,i,s=a.fields.map(u=>{if(typeof u=="string")return this.quoteIdentifier(u);if(u instanceof Qt.SequelizeMethod)return this.handleSequelizeMethod(u);if(u.attribute&&(u.name=u.attribute),!u.name)throw new Error(`The following index field has no name: ${u}`);return this.quoteIdentifier(u.name)}),o=s.join(", "),c=s.join("_");switch(a.type.toUpperCase()){case"UNIQUE":i=this.quoteIdentifier(a.name||`${r}_${c}_uk`),n=`CONSTRAINT ${i} UNIQUE (${o})`;break;case"CHECK":a.where=this.whereItemsQuery(a.where),i=this.quoteIdentifier(a.name||`${r}_${c}_ck`),n=`CONSTRAINT ${i} CHECK (${a.where})`;break;case"DEFAULT":if(a.defaultValue===void 0)throw new Error("Default value must be specified for DEFAULT CONSTRAINT");if(this._dialect.name!=="mssql")throw new Error("Default constraints are supported only for MSSQL dialect.");i=this.quoteIdentifier(a.name||`${r}_${c}_df`),n=`CONSTRAINT ${i} DEFAULT (${this.escape(a.defaultValue)}) FOR ${s[0]}`;break;case"PRIMARY KEY":i=this.quoteIdentifier(a.name||`${r}_${c}_pk`),n=`CONSTRAINT ${i} PRIMARY KEY (${o})`;break;case"FOREIGN KEY":let u=a.references;if(!u||!u.table||!(u.field||u.fields))throw new Error("references object with table and field must be specified");i=this.quoteIdentifier(a.name||`${r}_${c}_${u.table}_fk`);let l=typeof u.field<"u"?this.quoteIdentifier(u.field):u.fields.map(d=>this.quoteIdentifier(d)).join(", "),f=`${this.quoteTable(u.table)} (${l})`;n=`CONSTRAINT ${i} `,n+=`FOREIGN KEY (${o}) REFERENCES ${f}`,a.onUpdate&&(n+=` ON UPDATE ${a.onUpdate.toUpperCase()}`),a.onDelete&&(n+=` ON DELETE ${a.onDelete.toUpperCase()}`);break;default:throw new Error(`${a.type} is invalid.`)}return a.deferrable&&["UNIQUE","PRIMARY KEY","FOREIGN KEY"].includes(a.type.toUpperCase())&&(n+=` ${this.deferConstraintsQuery(a)}`),n}removeConstraintQuery(r,a){return typeof r=="string"?r=this.quoteIdentifiers(r):r=this.quoteTable(r),Qt.joinSQLFragments(["ALTER TABLE",r,"DROP CONSTRAINT",this.quoteIdentifiers(a)])}quote(r,a,n){let i=["ASC","DESC","ASC NULLS LAST","DESC NULLS LAST","ASC NULLS FIRST","DESC NULLS FIRST","NULLS FIRST","NULLS LAST"];if(n=n||".",typeof r=="string")return this.quoteIdentifiers(r);if(Array.isArray(r)){r.forEach((f,d)=>{let h=r[d-1],b,m;if(!h&&a!==void 0?m=a:h&&h instanceof pA&&(b=h,m=h.target),m&&m.prototype instanceof Uu){let g,O;if(typeof f=="function"&&f.prototype instanceof Uu?g=f:ra.isPlainObject(f)&&f.model&&f.model.prototype instanceof Uu&&(g=f.model,O=f.as),g&&(!O&&b&&b instanceof pA&&b.through&&b.through.model===g?f=new pA(m,g,{as:g.name}):(f=m.getAssociationForAlias(g,O),f||(f=m.getAssociationForAlias(g,g.name))),!(f instanceof pA)))throw new Error(qC.format("Unable to find a valid association for model, '%s'",g.name))}if(typeof f=="string"){let g=i.indexOf(f.toUpperCase());if(d>0&&g!==-1)f=this.sequelize.literal(` ${i[g]}`);else if(m&&m.prototype instanceof Uu){if(m.associations!==void 0&&m.associations[f])f=m.associations[f];else if(m.rawAttributes!==void 0&&m.rawAttributes[f]&&f!==m.rawAttributes[f].field)f=m.rawAttributes[f].field;else if(f.includes(".")&&m.rawAttributes!==void 0){let O=f.split(".");if(m.rawAttributes[O[0]].type instanceof lA.JSON){let z=this.quoteIdentifiers(`${m.name}.${m.rawAttributes[O[0]].field}`),w=O.slice(1);f=this.jsonPathExtractionQuery(z,w),f=this.sequelize.literal(f)}}}}r[d]=f},this);let s=r.length,o=[],c,u=0;for(u=0;u<s-1&&(c=r[u],!(typeof c=="string"||c._modelAttribute||c instanceof Qt.SequelizeMethod));u++)c instanceof pA&&(o[u]=c.as);let l="";return u>0?l+=`${this.quoteIdentifier(o.join(n))}.`:typeof r[0]=="string"&&a&&(l+=`${this.quoteIdentifier(a.name)}.`),r.slice(u).forEach(f=>{l+=this.quote(f,a,n)},this),l}if(r._modelAttribute)return`${this.quoteTable(r.Model.name)}.${this.quoteIdentifier(r.fieldName)}`;if(r instanceof Qt.SequelizeMethod)return this.handleSequelizeMethod(r);throw ra.isPlainObject(r)&&r.raw?new Error('The `{raw: "..."}` syntax is no longer supported.  Use `sequelize.literal` instead.'):new Error(`Unknown structure passed to order / group: ${qC.inspect(r)}`)}_initQuoteIdentifier(){this._quoteIdentifier=this.quoteIdentifier,this.quoteIdentifier=function(r,a){return r==="*"?r:this._quoteIdentifier(r,a)}}quoteIdentifier(r,a){throw new Error(`quoteIdentifier for Dialect "${this.dialect}" is not implemented`)}quoteIdentifiers(r){if(r.includes(".")){r=r.split(".");let a=r.slice(0,r.length-1).join("->"),n=r[r.length-1];return`${this.quoteIdentifier(a)}.${this.quoteIdentifier(n)}`}return this.quoteIdentifier(r)}quoteAttribute(r,a){return a&&r in a.rawAttributes?this.quoteIdentifier(r):this.quoteIdentifiers(r)}getAliasToken(){return"AS"}quoteTable(r,a){let n="";return a===!0&&(a=r.as||r.name||r),ra.isObject(r)?this._dialect.supports.schemas?(r.schema&&(n+=`${this.quoteIdentifier(r.schema)}.`),n+=this.quoteIdentifier(r.tableName)):(r.schema&&(n+=r.schema+(r.delimiter||".")),n+=r.tableName,n=this.quoteIdentifier(n)):n=this.quoteIdentifier(r),a&&(n+=` ${this.getAliasToken()} ${this.quoteIdentifier(a)}`),n}escape(r,a,n){if(n=n||{},r!=null){if(r instanceof Qt.SequelizeMethod)return this.handleSequelizeMethod(r);if(a&&a.type&&(a.type instanceof lA.STRING&&["mysql","mariadb"].includes(this.dialect)&&["number","boolean"].includes(typeof r)&&(r=String(Number(r))),this.validate(r,a,n),a.type.stringify)){let i=s=>I5e.escape(s,this.options.timezone,this.dialect);if(r=a.type.stringify(r,{escape:i,field:a,timezone:this.options.timezone,operation:n.operation}),a.type.escape===!1)return r}}return I5e.escape(r,this.options.timezone,this.dialect)}bindParam(r){return a=>(r.push(a),`$${r.length}`)}format(r,a,n,i){if(n=n||{},r!=null){if(r instanceof Qt.SequelizeMethod)throw new Error("Cannot pass SequelizeMethod as a bind parameter - use escape instead");if(a&&a.type&&(this.validate(r,a,n),a.type.bindParam))return a.type.bindParam(r,{escape:ra.identity,field:a,timezone:this.options.timezone,operation:n.operation,bindParam:i})}return i(r)}validate(r,a,n){if(this.typeValidation&&a.type.validate&&r)try{if(n.isList&&Array.isArray(r))for(let i of r)a.type.validate(i,n);else a.type.validate(r,n)}catch(i){throw i instanceof bJ.ValidationError&&i.errors.push(new bJ.ValidationErrorItem(i.message,"Validation error",a.fieldName,r,null,`${a.type.key} validator`)),i}}isIdentifierQuoted(r){return/^\s*(?:([`"'])(?:(?!\1).|\1{2})*\1\.?)+\s*$/i.test(r)}jsonPathExtractionQuery(r,a,n){let i=ra.toPath(a),s,o=this.isIdentifierQuoted(r)?r:this.quoteIdentifier(r);switch(this.dialect){case"mysql":case"mariadb":case"sqlite":return this.dialect==="mysql"&&(i=i.map(u=>/\D/.test(u)?Qt.addTicks(u,'"'):u)),s=this.escape(["$"].concat(i).join(".").replace(/\.(\d+)(?:(?=\.)|$)/g,(u,l)=>`[${l}]`)),this.dialect==="sqlite"?`json_extract(${o},${s})`:`json_unquote(json_extract(${o},${s}))`;case"postgres":let c=n?"#>":"#>>";return s=this.escape(`{${i.join(",")}}`),`(${o}${c}${s})`;default:throw new Error(`Unsupported ${this.dialect} for JSON operations`)}}selectQuery(r,a,n){a=a||{};let i=a.limit,s=[],o=[],c=a.subQuery===void 0?i&&a.hasMultiAssociation:a.subQuery,u={main:a.attributes&&a.attributes.slice(),subQuery:null},l={name:r,quotedName:null,as:null,model:n},f={names:l,options:a,subQuery:c},d=[],h=[],b;if(this.options.minifyAliases&&!a.aliasesMapping&&(a.aliasesMapping=new Map,a.aliasesByTable={},a.includeAliases=new Map),a.tableAs?l.as=this.quoteIdentifier(a.tableAs):!Array.isArray(l.name)&&l.model&&(l.as=this.quoteIdentifier(l.model.name)),l.quotedName=Array.isArray(l.name)?r.map(g=>Array.isArray(g)?this.quoteTable(g[0],g[1]):this.quoteTable(g,!0)).join(", "):this.quoteTable(l.name),c&&u.main)for(let g of l.model.primaryKeyAttributes)u.main.some(O=>g===O||g===O[0]||g===O[1])||u.main.push(l.model.rawAttributes[g].field?[g,l.model.rawAttributes[g].field]:g);if(u.main=this.escapeAttributes(u.main,a,l.as),u.main=u.main||(a.include?[`${l.as}.*`]:["*"]),(c||a.groupedLimit)&&(u.subQuery=u.main,u.main=[`${l.as||l.quotedName}.*`]),a.include)for(let g of a.include){if(g.separate)continue;let O=this.generateInclude(g,{externalAs:l.as,internalAs:l.as},f);h=h.concat(O.subQuery),d=d.concat(O.mainQuery),O.attributes.main.length>0&&(u.main=ra.uniq(u.main.concat(O.attributes.main))),O.attributes.subQuery.length>0&&(u.subQuery=ra.uniq(u.subQuery.concat(O.attributes.subQuery)))}if(c)o.push(this.selectFromTableFragment(a,l.model,u.subQuery,l.quotedName,l.as)),o.push(h.join(""));else{if(a.groupedLimit){l.as||(l.as=l.quotedName);let g=A2({},a.where),O,z,w,v=l.as;if(typeof a.groupedLimit.on=="string"?z=a.groupedLimit.on:a.groupedLimit.on instanceof wor&&(z=a.groupedLimit.on.foreignKeyField),a.groupedLimit.on instanceof Eor){v=a.groupedLimit.on.manyFromSource.as;let P=Uu._validateIncludedElements({include:[{association:a.groupedLimit.on.manyFromSource,duplicating:!1,required:!0,where:A2({[Rt.placeholder]:!0},a.groupedLimit.through&&a.groupedLimit.through.where)}],model:n});a.hasJoin=!0,a.hasMultiAssociation=!0,a.includeMap=Object.assign(P.includeMap,a.includeMap),a.includeNames=P.includeNames.concat(a.includeNames||[]),w=P.include,Array.isArray(a.order)&&(a.order.forEach((C,Q)=>{Array.isArray(C)&&(C=C[0]);let X=`subquery_order_${Q}`;a.attributes.push([C,X]),X=this.sequelize.literal(this.quote(X)),Array.isArray(a.order[Q])?a.order[Q][0]=X:a.order[Q]=X}),O=a.order)}else O=a.order,this._dialect.supports.topLevelOrderByRequired||delete a.order,g[Rt.placeholder]=!0;let T=`SELECT * FROM (${this.selectQuery(r,{attributes:a.attributes,offset:a.offset,limit:a.groupedLimit.limit,order:O,aliasesMapping:a.aliasesMapping,aliasesByTable:a.aliasesByTable,where:g,include:w,model:n},n).replace(/;$/,"")}) ${this.getAliasToken()} sub`,x=this.whereItemQuery(Rt.placeholder,!0,{model:n}),L=T.indexOf(x);s.push(this.selectFromTableFragment(a,l.model,u.main,`(${a.groupedLimit.values.map(P=>{let C;return z&&(C={[z]:P}),w&&(C={[a.groupedLimit.on.foreignIdentifierField]:P}),Qt.spliceStr(T,L,x.length,this.getWhereConditions(C,v))}).join(this._dialect.supports["UNION ALL"]?" UNION ALL ":" UNION ")})`,l.as))}else s.push(this.selectFromTableFragment(a,l.model,u.main,l.quotedName,l.as));s.push(d.join(""))}if(Object.prototype.hasOwnProperty.call(a,"where")&&!a.groupedLimit&&(a.where=this.getWhereConditions(a.where,l.as||r,n,a),a.where&&(c?o.push(` WHERE ${a.where}`):(s.push(` WHERE ${a.where}`),s.forEach((g,O)=>{g.startsWith("SELECT")&&(s[O]=this.selectFromTableFragment(a,n,u.main,l.quotedName,l.as,a.where))})))),a.group&&(a.group=Array.isArray(a.group)?a.group.map(g=>this.aliasGrouping(g,n,l.as,a)).join(", "):this.aliasGrouping(a.group,n,l.as,a),c&&a.group?o.push(` GROUP BY ${a.group}`):a.group&&s.push(` GROUP BY ${a.group}`)),Object.prototype.hasOwnProperty.call(a,"having")&&(a.having=this.getWhereConditions(a.having,r,n,a,!1),a.having&&(c?o.push(` HAVING ${a.having}`):s.push(` HAVING ${a.having}`))),a.order){let g=this.getQueryOrders(a,n,c);g.mainQueryOrder.length&&s.push(` ORDER BY ${g.mainQueryOrder.join(", ")}`),g.subQueryOrder.length&&o.push(` ORDER BY ${g.subQueryOrder.join(", ")}`)}let m=this.addLimitAndOffset(a,l.model);if(m&&!a.groupedLimit&&(c?o.push(m):s.push(m)),c?(this._throwOnEmptyAttributes(u.main,{modelName:n&&n.name,as:l.as}),b=`SELECT ${u.main.join(", ")} FROM (${o.join("")}) ${this.getAliasToken()} ${l.as}${d.join("")}${s.join("")}`):b=s.join(""),a.lock&&this._dialect.supports.lock){let g=a.lock;typeof a.lock=="object"&&(g=a.lock.level),this._dialect.supports.lockKey&&["KEY SHARE","NO KEY UPDATE"].includes(g)?b+=` FOR ${g}`:g==="SHARE"?b+=` ${this._dialect.supports.forShare}`:b+=" FOR UPDATE",this._dialect.supports.lockOf&&a.lock.of&&a.lock.of.prototype instanceof Uu&&(b+=` OF ${this.quoteTable(a.lock.of.name)}`),this._dialect.supports.skipLocked&&a.skipLocked&&(b+=" SKIP LOCKED")}return`${b};`}aliasGrouping(r,a,n,i){let s=Array.isArray(r)?r[0]:r;return this.quote(this._getAliasForField(n,s,i)||s,a)}escapeAttributes(r,a,n){return r&&r.map(i=>{let s=!0;if(i instanceof Qt.SequelizeMethod)return this.handleSequelizeMethod(i);if(Array.isArray(i)){if(i.length!==2)throw new Error(`${JSON.stringify(i)} is not a valid attribute definition. Please use the following format: ['attribute definition', 'alias']`);if(i=i.slice(),i[0]instanceof Qt.SequelizeMethod)i[0]=this.handleSequelizeMethod(i[0]),s=!1;else if(this.options.attributeBehavior==="escape"||!i[0].includes("(")&&!i[0].includes(")"))i[0]=this.quoteIdentifier(i[0]);else if(this.options.attributeBehavior!=="unsafe-legacy")throw new Error(`Attributes cannot include parentheses in Sequelize 6:
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            

Error: Please install mysql2 package manually
    at t._loadDialectModule (/home/wiomgjqe/neduas.store/server.js:124:7832)
    at new t (/home/wiomgjqe/neduas.store/server.js:136:66644)
    at new O1 (/home/wiomgjqe/neduas.store/server.js:136:73185)
    at new t (/home/wiomgjqe/neduas.store/server.js:136:229204)
    at Object.<anonymous> (/home/wiomgjqe/neduas.store/server.js:3649:2755)
    at Module._compile (node:internal/modules/cjs/loader:1275:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1329:10)
    at Module.load (node:internal/modules/cjs/loader:1133:32)
    at Module._load (node:internal/modules/cjs/loader:972:12)
    at Module.require (node:internal/modules/cjs/loader:1157:19)

Node.js v19.9.0
/home/wiomgjqe/neduas.store/server.js:124
`}};MC.AggregateError=sJ});var n5e=A(AC=>{"use strict";Object.defineProperty(AC,"__esModule",{value:!0});AC.Deferred=void 0;var Tsr=iJ(),cJ=class{constructor(){this._promise=new Promise((r,a)=>{this._reject=a,this._resolve=r})}registerTimeout(r,a){this._timeout||(this._timeout=setTimeout(()=>{a(),this.reject(new Tsr.TimeoutError("Operation timeout"))},r))}_clearTimeout(){this._timeout&&clearTimeout(this._timeout)}resolve(r){this._clearTimeout(),this._resolve(r)}reject(r){this._clearTimeout(),this._reject(r)}promise(){return this._promise}};AC.Deferred=cJ});var i5e=A(OC=>{"use strict";Object.defineProperty(OC,"__esModule",{value:!0});OC.Pool=void 0;var qsr=n5e(),Nsr=oJ(),uJ=class{constructor(r){if(this.log=!1,!r.create)throw new Error("create function is required");if(!r.destroy)throw new Error("destroy function is required");if(!r.validate)throw new Error("validate function is required");if(typeof r.min!="number"||r.min<0||r.min!==Math.round(r.min))throw new Error("min must be an integer >= 0");if(typeof r.max!="number"||r.max<=0||r.max!==Math.round(r.max))throw new Error("max must be an integer > 0");if(r.min>r.max)throw new Error("max is smaller than min");if(r.maxUses!==void 0&&(typeof r.maxUses!="number"||r.maxUses<0))throw new Error("maxUses must be an integer >= 0");this.idleTimeoutMillis=r.idleTimeoutMillis||3e4,this.acquireTimeoutMillis=r.acquireTimeoutMillis||3e4,this.reapIntervalMillis=r.reapIntervalMillis||1e3,this.maxUsesPerResource=r.maxUses||1/0,this.log=r.log||!1,this._factory=r,this._count=0,this._draining=!1,this._pendingAcquires=[],this._inUseObjects=[],this._availableObjects=[],this._removeIdleScheduled=!1}get size(){return this._count}get name(){return this._factory.name}get available(){return this._availableObjects.length}get using(){return this._inUseObjects.length}get waiting(){return this._pendingAcquires.length}get maxSize(){return this._factory.max}get minSize(){return this._factory.min}_log(r,a){typeof this.log=="function"?this.log(r,a):this.log&&console.log(`${a.toUpperCase()} pool ${this.name||""} - ${r}`)}_removeIdle(){let r=[],a=Date.now(),n,i=this._availableObjects.length,s=this.size-this.minSize,o;for(this._removeIdleScheduled=!1,n=0;n<i&&s>r.length;n++)o=this._availableObjects[n].timeout,a>=o&&(this._log("removeIdle() destroying obj - now:"+a+" timeout:"+o,"verbose"),r.push(this._availableObjects[n].resource));r.forEach(this.destroy,this),i=this._availableObjects.length,i>0?(this._log("this._availableObjects.length="+i,"verbose"),this._scheduleRemoveIdle()):this._log("removeIdle() all objects removed","verbose")}_scheduleRemoveIdle(){this._removeIdleScheduled||(this._removeIdleScheduled=!0,this._removeIdleTimer=setTimeout(()=>{this._removeIdle()},this.reapIntervalMillis))}_dispense(){let r=null,a=this._pendingAcquires.length;if(this._log(`dispense() clients=${a} available=${this._availableObjects.length}`,"info"),!(a<1)){for(;this._availableObjects.length>0;){if(this._log("dispense() - reusing obj","verbose"),r=this._availableObjects[this._availableObjects.length-1],!this._factory.validate(r.resource)){this.destroy(r.resource);continue}return this._availableObjects.pop(),this._addResourceToInUseObjects(r.resource,r.useCount),this._pendingAcquires.shift().resolve(r.resource)}this.size<this.maxSize&&this._createResource()}}_createResource(){this._count+=1,this._log(`createResource() - creating obj - count=${this.size} min=${this.minSize} max=${this.maxSize}`,"verbose"),this._factory.create().then(r=>{let a=this._pendingAcquires.shift();a?(this._addResourceToInUseObjects(r,0),a.resolve(r)):this._addResourceToAvailableObjects(r,0)}).catch(r=>{let a=this._pendingAcquires.shift();this._count-=1,this._count<0&&(this._count=0),a&&a.reject(r),process.nextTick(()=>{this._dispense()})})}_addResourceToAvailableObjects(r,a){let n={resource:r,useCount:a,timeout:Date.now()+this.idleTimeoutMillis};this._availableObjects.push(n),this._dispense(),this._scheduleRemoveIdle()}_addResourceToInUseObjects(r,a){let n={resource:r,useCount:a};this._inUseObjects.push(n)}_ensureMinimum(){let r,a;if(!this._draining&&this.size<this.minSize)for(a=this.minSize-this.size,r=0;r<a;r++)this._createResource()}acquire(){if(this._draining)return Promise.reject(new Error("pool is draining and cannot accept work"));let r=new qsr.Deferred;return r.registerTimeout(this.acquireTimeoutMillis,()=>{this._pendingAcquires=this._pendingAcquires.filter(a=>a!==r)}),this._pendingAcquires.push(r),this._dispense(),r.promise()}release(r){if(this._availableObjects.some(i=>i.resource===r)){this._log("release called twice for the same resource: "+new Error().stack,"error");return}let a=this._inUseObjects.findIndex(i=>i.resource===r);if(a<0){this._log("attempt to release an invalid resource: "+new Error().stack,"error");return}let n=this._inUseObjects[a];n.useCount+=1,n.useCount>=this.maxUsesPerResource?(this._log("release() destroying obj - useCount:"+n.useCount+" maxUsesPerResource:"+this.maxUsesPerResource,"verbose"),this.destroy(n.resource),this._dispense()):(this._inUseObjects.splice(a,1),this._addResourceToAvailableObjects(n.resource,n.useCount))}async destroy(r){let a=this._availableObjects.length,n=this._inUseObjects.length;if(this._availableObjects=this._availableObjects.filter(i=>i.resource!==r),this._inUseObjects=this._inUseObjects.filter(i=>i.resource!==r),a===this._availableObjects.length&&n===this._inUseObjects.length){this._ensureMinimum();return}this._count-=1,this._count<0&&(this._count=0);try{await this._factory.destroy(r)}finally{this._ensureMinimum(),this._draining||process.nextTick(()=>{this._dispense()})}}drain(){this._log("draining","info"),this._draining=!0;let r=a=>{if(this._pendingAcquires.length>0){this._dispense(),setTimeout(()=>{r(a)},100);return}if(this._availableObjects.length!==this._count){setTimeout(()=>{r(a)},100);return}a()};return new Promise(a=>r(a))}async destroyAllNow(){this._log("force destroying all objects","info"),this._removeIdleScheduled=!1,clearTimeout(this._removeIdleTimer);let r=this._availableObjects.map(n=>n.resource),a=[];for(let n of r)try{await this.destroy(n)}catch(i){this._log("Error destroying resource: "+i.stack,"error"),a.push(i)}if(a.length>0)throw new Nsr.AggregateError(a)}};OC.Pool=uJ});var s5e=A(Nh=>{"use strict";Object.defineProperty(Nh,"__esModule",{value:!0});Nh.Pool=Nh.AggregateError=Nh.TimeoutError=void 0;var Isr=iJ();Object.defineProperty(Nh,"TimeoutError",{enumerable:!0,get:function(){return Isr.TimeoutError}});var Ssr=oJ();Object.defineProperty(Nh,"AggregateError",{enumerable:!0,get:function(){return Ssr.AggregateError}});var xsr=i5e();Object.defineProperty(Nh,"Pool",{enumerable:!0,get:function(){return xsr.Pool}})});var Df=A((j9a,yC)=>{"use strict";var{Pool:lJ,TimeoutError:ksr}=s5e(),Ih=hr(),pJ=qh(),Csr=cn(),{logger:Lsr}=Ti(),Dsr=nA(),Jl=Lsr.debugContext("pool"),uR=class{constructor(r,a){let n=Ih.cloneDeep(a.config);if(this.sequelize=a,this.config=n,this.dialect=r,this.versionPromise=null,this.dialectName=this.sequelize.options.dialect,n.pool===!1)throw new Error("Support for pool:false was removed in v4.0");n.pool=Ih.defaults(n.pool||{},{max:5,min:0,idle:1e4,acquire:6e4,evict:1e3,validate:this._validate.bind(this)}),this.initPools()}refreshTypeParser(r){Ih.each(r,a=>{if(Object.prototype.hasOwnProperty.call(a,"parse"))if(a.types[this.dialectName])this._refreshTypeParser(a);else throw new Error(`Parse function not supported for type ${a.key} in dialect ${this.dialectName}`)})}_loadDialectModule(r){try{return this.sequelize.config.dialectModulePath?require(this.sequelize.config.dialectModulePath):this.sequelize.config.dialectModule?this.sequelize.config.dialectModule:require(r)}catch(a){throw a.code==="MODULE_NOT_FOUND"?this.sequelize.config.dialectModulePath?new Error(`Unable to find dialect at ${this.sequelize.config.dialectModulePath}`):new Error(`Please install ${r} package manually`):a}}async _onProcessExit(){if(this.pool)return await this.pool.drain(),Jl("connection drain due to process exit"),await this.pool.destroyAllNow()}async close(){return this.getConnection=async function(){throw new Error("ConnectionManager.getConnection was called after the connection manager was closed!")},await this._onProcessExit()}initPools(){let r=this.config;if(!r.replication){this.pool=new lJ({name:"sequelize",create:()=>this._connect(r),destroy:async n=>{let i=await this._disconnect(n);return Jl("connection destroy"),i},validate:r.pool.validate,max:r.pool.max,min:r.pool.min,acquireTimeoutMillis:r.pool.acquire,idleTimeoutMillis:r.pool.idle,reapIntervalMillis:r.pool.evict,maxUses:r.pool.maxUses}),Jl(`pool created with max/min: ${r.pool.max}/${r.pool.min}, no replication`);return}Array.isArray(r.replication.read)||(r.replication.read=[r.replication.read]),r.replication.write=Ih.defaults(r.replication.write,Ih.omit(r,"replication")),r.replication.read=r.replication.read.map(n=>Ih.defaults(n,Ih.omit(this.config,"replication")));let a=0;this.pool={release:n=>{n.queryType==="read"?this.pool.read.release(n):this.pool.write.release(n)},acquire:(n,i)=>(i=i===void 0?!1:i,n==="SELECT"&&!i?this.pool.read.acquire():this.pool.write.acquire()),destroy:n=>{this.pool[n.queryType].destroy(n),Jl("connection destroy")},destroyAllNow:async()=>{await Promise.all([this.pool.read.destroyAllNow(),this.pool.write.destroyAllNow()]),Jl("all connections destroyed")},drain:async()=>Promise.all([this.pool.write.drain(),this.pool.read.drain()]),read:new lJ({name:"sequelize:read",create:async()=>{let n=a++%r.replication.read.length,i=await this._connect(r.replication.read[n]);return i.queryType="read",i},destroy:n=>this._disconnect(n),validate:r.pool.validate,max:r.pool.max,min:r.pool.min,acquireTimeoutMillis:r.pool.acquire,idleTimeoutMillis:r.pool.idle,reapIntervalMillis:r.pool.evict,maxUses:r.pool.maxUses}),write:new lJ({name:"sequelize:write",create:async()=>{let n=await this._connect(r.replication.write);return n.queryType="write",n},destroy:n=>this._disconnect(n),validate:r.pool.validate,max:r.pool.max,min:r.pool.min,acquireTimeoutMillis:r.pool.acquire,idleTimeoutMillis:r.pool.idle,reapIntervalMillis:r.pool.evict,maxUses:r.pool.maxUses})},Jl(`pool created with max/min: ${r.pool.max}/${r.pool.min}, with replication`)}async getConnection(r){r=r||{},this.sequelize.options.databaseVersion===0&&(this.versionPromise||(this.versionPromise=(async()=>{try{let n=await this._connect(this.config.replication.write||this.config),i={};if(i.transaction={connection:n},i.logging=()=>{},i.logging.__testLoggingFn=!0,this.sequelize.options.databaseVersion===0){let s=await this.sequelize.databaseVersion(i),o=Ih.get(pJ.coerce(s),"version")||s;this.sequelize.options.databaseVersion=pJ.valid(o)?o:this.dialect.defaultVersion}return pJ.lt(this.sequelize.options.databaseVersion,this.dialect.defaultVersion)&&(Dsr.unsupportedEngine(),Jl(`Unsupported database engine version ${this.sequelize.options.databaseVersion}`)),this.versionPromise=null,await this._disconnect(n)}catch(n){throw this.versionPromise=null,n}})()),await this.versionPromise);let a;try{await this.sequelize.runHooks("beforePoolAcquire",r),a=await this.pool.acquire(r.type,r.useMaster),await this.sequelize.runHooks("afterPoolAcquire",a,r)}catch(n){throw n instanceof ksr?new Csr.ConnectionAcquireTimeoutError(n):n}return Jl("connection acquired"),a}releaseConnection(r){this.pool.release(r),Jl("connection released")}async destroyConnection(r){await this.pool.destroy(r),Jl(`connection ${r.uuid} destroyed`)}async _connect(r){await this.sequelize.runHooks("beforeConnect",r);let a=await this.dialect.connectionManager.connect(r);return await this.sequelize.runHooks("afterConnect",a,r),a}async _disconnect(r){return await this.sequelize.runHooks("beforeDisconnect",r),await this.dialect.connectionManager.disconnect(r),this.sequelize.runHooks("afterDisconnect",r)}_validate(r){return this.dialect.connectionManager.validate?this.dialect.connectionManager.validate(r):!0}};yC.exports=uR;yC.exports.ConnectionManager=uR;yC.exports.default=uR});var Vc=A((G9a,o5e)=>{"use strict";var lR=new Map;o5e.exports=t=>(lR.has(t)||lR.set(t,new Map),{clear(){lR.get(t).clear()},refresh(r){for(let a of r.types[t])lR.get(t).set(a,r.parse)},get(r){return lR.get(t).get(r)}})});var p5e=A((Q9a,EC)=>{"use strict";var Bsr=Object.defineProperty,c5e=Object.getOwnPropertySymbols,Psr=Object.prototype.hasOwnProperty,Wsr=Object.prototype.propertyIsEnumerable,u5e=(t,r,a)=>r in t?Bsr(t,r,{enumerable:!0,configurable:!0,writable:!0,value:a}):t[r]=a,Usr=(t,r)=>{for(var a in r||(r={}))Psr.call(r,a)&&u5e(t,a,r[a]);if(c5e)for(var a of c5e(r))Wsr.call(r,a)&&u5e(t,a,r[a]);return t},Fsr=qh(),jsr=Df(),uA=cn(),{logger:Gsr}=Ti(),Qsr=Ja().mariadb,Hsr=Hl(),l5e=Gsr.debugContext("connection:mariadb"),zC=Vc()("mariadb"),pR=class t extends jsr{constructor(r,a){a.config.port=a.config.port||3306,super(r,a),this.lib=this._loadDialectModule("mariadb"),this.refreshTypeParser(Qsr)}static _typecast(r,a){return zC.get(r.type)?zC.get(r.type)(r,this.sequelize.options,a):a()}_refreshTypeParser(r){zC.refresh(r)}_clearTypeParser(){zC.clear()}async connect(r){let a=this.sequelize.options.timezone;a=/\//.test(a)?Hsr.tz(a).format("Z"):a;let n=Usr({host:r.host,port:r.port,user:r.username,password:r.password,database:r.database,timezone:a,typeCast:t._typecast.bind(this),bigNumberStrings:!1,supportBigNumbers:!0,foundRows:!1},r.dialectOptions);this.sequelize.config.keepDefaultTimezone||(n.initSql?(Array.isArray(n.initSql)||(n.initSql=[n.initSql]),n.initSql.push(`SET time_zone = '${a}'`)):n.initSql=`SET time_zone = '${a}'`);try{let i=await this.lib.createConnection(n);return this.sequelize.options.databaseVersion=Fsr.coerce(i.serverVersion()).version,l5e("connection acquired"),i.on("error",s=>{switch(s.code){case"ESOCKET":case"ECONNRESET":case"EPIPE":case"PROTOCOL_CONNECTION_LOST":this.pool.destroy(i)}}),i}catch(i){switch(i.code){case"ECONNREFUSED":throw new uA.ConnectionRefusedError(i);case"ER_ACCESS_DENIED_ERROR":case"ER_ACCESS_DENIED_NO_PASSWORD_ERROR":throw new uA.AccessDeniedError(i);case"ENOTFOUND":throw new uA.HostNotFoundError(i);case"EHOSTUNREACH":case"ENETUNREACH":case"EADDRNOTAVAIL":throw new uA.HostNotReachableError(i);case"EINVAL":throw new uA.InvalidConnectionError(i);default:throw new uA.ConnectionError(i)}}}async disconnect(r){if(!r.isValid()){l5e("connection tried to disconnect but was already at CLOSED state");return}return await r.end()}validate(r){return r&&r.isValid()}};EC.exports=pR;EC.exports.ConnectionManager=pR;EC.exports.default=pR});var Bf=A((H9a,wC)=>{"use strict";var Vsr=Object.defineProperty,f5e=Object.getOwnPropertySymbols,$sr=Object.prototype.hasOwnProperty,Ysr=Object.prototype.propertyIsEnumerable,d5e=(t,r,a)=>r in t?Vsr(t,r,{enumerable:!0,configurable:!0,writable:!0,value:a}):t[r]=a,Xsr=(t,r)=>{for(var a in r||(r={}))$sr.call(r,a)&&d5e(t,a,r[a]);if(f5e)for(var a of f5e(r))Ysr.call(r,a)&&d5e(t,a,r[a]);return t},Sh=hr(),Ksr=Cv(),rc=m1(),Jsr=Wv(),Zsr=nA(),eor=(JM(),gf(KM)).v4,{safeStringifyJson:h5e}=On(),fR=class t{constructor(r,a,n){this.uuid=eor(),this.connection=r,this.instance=n.instance,this.model=n.model,this.sequelize=a,this.options=Xsr({plain:!1,raw:!1,logging:console.log},n),this.checkLoggingOption(),n.rawErrors&&(this.formatError=t.prototype.formatError)}static formatBindParameters(r,a,n,i,s){if(!a)return[r,[]];if(s=s||{},typeof i!="function"&&(s=i||{},i=void 0),!i)s.skipValueReplace?i=(u,l,f)=>{if(f[l]!==void 0)return u}:i=(u,l,f,d,h)=>{if(f[l]!==void 0)return Ksr.escape(f[l],d,h)};else if(s.skipValueReplace){let u=i;i=(l,f,d,h,b,m)=>{if(u(l,f,d,h,b,m)!==void 0)return l}}let o=null,c=Array.isArray(a);return r=r.replace(/\B\$(\$|\w+)/g,(u,l)=>{if(l==="$")return s.skipUnescape?u:l;let f;if(c?l.match(/^[1-9]\d*$/)&&(l=l-1,f=i(u,l,a,o,n,s)):l.match(/^\d*$/)||(f=i(u,l,a,o,n,s)),f===void 0)throw new Error(`Named bind parameter "${u}" has no value in the given object.`);return f}),[r,[]]}formatError(r,a){return r.stack=a,r}run(){throw new Error("The run method wasn't overwritten!")}checkLoggingOption(){this.options.logging===!0&&(Zsr.noTrueLogging(),this.options.logging=console.log)}getInsertIdField(){return"insertId"}getUniqueConstraintErrorMessage(r){let a=r?`${r} must be unique`:"Must be unique";if(r&&this.model)for(let n of Object.keys(this.model.uniqueKeys))this.model.uniqueKeys[n].fields.includes(r.replace(/"/g,""))&&this.model.uniqueKeys[n].msg&&(a=this.model.uniqueKeys[n].msg);return a}isRawQuery(){return this.options.type===rc.RAW}isVersionQuery(){return this.options.type===rc.VERSION}isUpsertQuery(){return this.options.type===rc.UPSERT}isInsertQuery(r,a){let n=!0;return this.options.type===rc.INSERT?!0:(n=n&&this.sql.toLowerCase().startsWith("insert into"),n=n&&(!r||Object.prototype.hasOwnProperty.call(r,this.getInsertIdField())),n=n&&(!a||Object.prototype.hasOwnProperty.call(a,this.getInsertIdField())),n)}handleInsertQuery(r,a){if(this.instance){let n=this.model.autoIncrementAttribute,i=null;i=i||r&&r[this.getInsertIdField()],i=i||a&&a[this.getInsertIdField()],this.instance[n]=i}}isShowTablesQuery(){return this.options.type===rc.SHOWTABLES}handleShowTablesQuery(r){return Sh.flatten(r.map(a=>Object.values(a)))}isShowIndexesQuery(){return this.options.type===rc.SHOWINDEXES}isShowConstraintsQuery(){return this.options.type===rc.SHOWCONSTRAINTS}isDescribeQuery(){return this.options.type===rc.DESCRIBE}isSelectQuery(){return this.options.type===rc.SELECT}isBulkUpdateQuery(){return this.options.type===rc.BULKUPDATE}isBulkDeleteQuery(){return this.options.type===rc.BULKDELETE}isForeignKeysQuery(){return this.options.type===rc.FOREIGNKEYS}isUpdateQuery(){return this.options.type===rc.UPDATE}handleSelectQuery(r){let a=null;if(this.options.fieldMap){let n=this.options.fieldMap;r=r.map(i=>Sh.reduce(n,(s,o,c)=>(s[c]!==void 0&&o!==c&&(s[o]=s[c],delete s[c]),s),i))}return this.options.raw?a=r.map(n=>{let i={};for(let s in n)Object.prototype.hasOwnProperty.call(n,s)&&(i[s]=n[s]);return this.options.nest&&(i=Jsr.transform(i)),i}):this.options.hasJoin===!0?(r=t._groupJoinData(r,{model:this.model,includeMap:this.options.includeMap,includeNames:this.options.includeNames},{checkExisting:this.options.hasMultiAssociation}),a=this.model.bulkBuild(r,{isNewRecord:!1,include:this.options.include,includeNames:this.options.includeNames,includeMap:this.options.includeMap,includeValidated:!0,attributes:this.options.originalAttributes||this.options.attributes,raw:!0})):a=this.model.bulkBuild(r,{isNewRecord:!1,raw:!0,attributes:this.options.originalAttributes||this.options.attributes}),this.options.plain&&(a=a.length===0?null:a[0]),a}isShowOrDescribeQuery(){let r=!1;return r=r||this.sql.toLowerCase().startsWith("show"),r=r||this.sql.toLowerCase().startsWith("describe"),r}isCallQuery(){return this.sql.toLowerCase().startsWith("call")}_logQuery(r,a,n){let{connection:i,options:s}=this,o=this.sequelize.options.benchmark||s.benchmark,c=this.sequelize.options.logQueryParameters||s.logQueryParameters,u=Date.now(),l="";if(c&&n){let h=r.endsWith(";")?"":";",b;Array.isArray(n)?b=n.map(m=>h5e(m)).join(", "):b=h5e(n),l=`${h} ${b}`}let f=`(${i.uuid||"default"}): ${r}${l}`,d=`Executing ${f}`;return a(d),o||this.sequelize.log(`Executing ${f}`,s),()=>{let h=`Executed ${f}`;a(h),o&&this.sequelize.log(h,Date.now()-u,s)}}static _groupJoinData(r,a,n){if(!r.length)return[];let i,s,o,c,u,l,f=r.length,d,h,b,m,g,O,z,w,v=n.checkExisting,T,x,L,P=v?[]:new Array(f),C={},Q={},X,k,se,F,D,j,V,he,oe=ne=>{Object.prototype.hasOwnProperty.call(j.includeMap,ne)&&(Q[h]=j=j.includeMap[ne],he?he=`${he}.${ne}`:he=ne,Q[he]=j)},ie={},De=(ne,we)=>(Object.prototype.hasOwnProperty.call(we,ne)||(we[ne]=ne.substr(0,ne.lastIndexOf("."))),we[ne]),Ge={},Ze=ne=>{if(!Object.prototype.hasOwnProperty.call(Ge,ne)){let we=ne.lastIndexOf(".");Ge[ne]=ne.substr(we===-1?0:we+1)}return Ge[ne]},te={},me=ne=>{if(!Object.prototype.hasOwnProperty.call(te,ne)){let we=De(ne,ie);Object.prototype.hasOwnProperty.call(te,we)||(te[we]=we?we.split("."):[]),te[ne]=te[we]}return te[ne]},ve={},ye=ne=>{if(!Object.prototype.hasOwnProperty.call(ve,ne)){let we=me(ne),ke=we.length;ve[ne]=ke?we[ke-1]:""}return ve[ne]},Qe=ne=>{let we=Sh.chain(ne.uniqueKeys);return we=we.result(`${we.findKey()}.fields`).map(ke=>Sh.findKey(ne.attributes,je=>je.field===ke)).value(),we},Ke=ne=>ne instanceof Buffer?ne.toString("hex"):ne,Se,ft,qe;for(u=0;u<f;u++){if(l=r[u],u===0&&(d=Sh.sortBy(Object.keys(l),ne=>[ne.split(".").length]),m=d.length),v){if(w=!1,c=a.model.primaryKeyAttributes.length,L="",c===1)L=Ke(l[a.model.primaryKeyAttributes[0]]);else if(c>1)for(o=0;o<c;o++)L+=Ke(l[a.model.primaryKeyAttributes[o]]);else if(!Sh.isEmpty(a.model.uniqueKeys))for(ft=Qe(a.model),o=0;o<ft.length;o++)L+=l[ft[o]]}for(z=O={},F=void 0,b=0;b<m;b++){if(h=d[b],k=De(h,ie),X=me(h),u===0&&!Object.prototype.hasOwnProperty.call(Q,h)&&(X.length?(j=a,he=void 0,X.forEach(oe)):Q[h]=Q[""]=a),F!==void 0&&F!==X){if(v){if(s=F.length,V=null,x=null,s)for(i=0;i<s;i++){if(qe=V?`${V}.${F[i]}`:F[i],Se=Q[qe].model.primaryKeyAttributes,c=Se.length,T=qe,c===1)T+=Ke(l[`${qe}.${Se[0]}`]);else if(c>1)for(o=0;o<c;o++)T+=Ke(l[`${qe}.${Se[o]}`]);else if(!Sh.isEmpty(Q[qe].model.uniqueKeys))for(ft=Qe(Q[qe].model),o=0;o<ft.length;o++)T+=l[`${qe}.${ft[o]}`];x||(x=L),T=x+T,V=qe,i<s-1&&(x=T)}else T=L;T===L?C[T]?w=!0:C[T]=O:C[T]||(V=C[x],D=ye(g),Q[g].association.isSingleAssociation?V&&(V[D]=C[T]=O):(V[D]||(V[D]=[]),V[D].push(C[T]=O))),O={}}else if(j=z,s=X.length,s)for(i=0;i<s;i++)i===s-1&&(O=j[X[i]]={}),j=j[X[i]]||{}}O[Ze(h)]=l[h],g=h,F=X,se=k}if(v){if(s=F.length,V=null,x=null,s)for(i=0;i<s;i++){if(qe=V?`${V}.${F[i]}`:F[i],Se=Q[qe].model.primaryKeyAttributes,c=Se.length,T=qe,c===1)T+=Ke(l[`${qe}.${Se[0]}`]);else if(c>0)for(o=0;o<c;o++)T+=Ke(l[`${qe}.${Se[o]}`]);else if(!Sh.isEmpty(Q[qe].model.uniqueKeys))for(ft=Qe(Q[qe].model),o=0;o<ft.length;o++)T+=l[`${qe}.${ft[o]}`];x||(x=L),T=x+T,V=qe,i<s-1&&(x=T)}else T=L;T===L?C[T]?w=!0:C[T]=O:C[T]||(V=C[x],D=ye(g),Q[g].association.isSingleAssociation?V&&(V[D]=C[T]=O):(V[D]||(V[D]=[]),V[D].push(C[T]=O))),w||P.push(z)}else P[u]=z}return P}};wC.exports=fR;wC.exports.AbstractQuery=fR;wC.exports.default=fR});var y5e=A((V9a,O5e)=>{"use strict";var tor=Object.defineProperty,b5e=Object.getOwnPropertySymbols,ror=Object.prototype.hasOwnProperty,aor=Object.prototype.propertyIsEnumerable,m5e=(t,r,a)=>r in t?tor(t,r,{enumerable:!0,configurable:!0,writable:!0,value:a}):t[r]=a,nor=(t,r)=>{for(var a in r||(r={}))ror.call(r,a)&&m5e(t,a,r[a]);if(b5e)for(var a of b5e(r))aor.call(r,a)&&m5e(t,a,r[a]);return t},_5e=Bf(),vC=cn(),g5e=hr(),fJ=Ja(),{logger:ior}=Ti(),sor=1062,oor=1213,M5e=1451,cor=1452,A5e=ior.debugContext("sql:mariadb"),dJ=class extends _5e{constructor(r,a,n){super(r,a,nor({showWarnings:!1},n))}static formatBindParameters(r,a,n){let i=[],s=(o,c,u)=>{if(u[c]!==void 0)return i.push(u[c]),"?"};return r=_5e.formatBindParameters(r,a,n,s)[0],[r,i.length>0?i:void 0]}async run(r,a){this.sql=r;let{connection:n,options:i}=this,s=this.sequelize.options.showWarnings||i.showWarnings,o=this._logQuery(r,A5e,a);a&&A5e("parameters(%j)",a);let c,u=new Error;try{c=await n.query(this.sql,a)}catch(l){if(i.transaction&&l.errno===oor){try{await i.transaction.rollback()}catch{}i.transaction.finished="rollback"}throw l.sql=r,l.parameters=a,this.formatError(l,u.stack)}finally{o()}return s&&c&&c.warningStatus>0&&await this.logWarnings(c),this.formatResults(c)}formatResults(r){let a=this.instance;if(this.isBulkUpdateQuery()||this.isBulkDeleteQuery())return r.affectedRows;if(this.isUpsertQuery())return[a,r.affectedRows===1];if(this.isInsertQuery(r)&&(this.handleInsertQuery(r),!this.instance)){if(this.model&&this.model.autoIncrementAttribute&&this.model.autoIncrementAttribute===this.model.primaryKeyAttribute&&this.model.rawAttributes[this.model.primaryKeyAttribute]){let n=r[this.getInsertIdField()];a=new Array(r.affectedRows);let i=this.model.rawAttributes[this.model.primaryKeyAttribute].field;for(let s=0;s<r.affectedRows;s++)a[s]={[i]:n+s};return[a,r.affectedRows]}return[r[this.getInsertIdField()],r.affectedRows]}if(this.isSelectQuery())return this.handleJsonSelectQuery(r),this.handleSelectQuery(r);if(this.isInsertQuery()||this.isUpdateQuery())return[a,r.affectedRows];if(this.isCallQuery())return r[0];if(this.isRawQuery()){let n=r.meta;return delete r.meta,[r,n]}if(this.isShowIndexesQuery())return this.handleShowIndexesQuery(r);if(this.isForeignKeysQuery()||this.isShowConstraintsQuery())return r;if(this.isShowTablesQuery())return this.handleShowTablesQuery(r);if(this.isDescribeQuery()){a={};for(let n of r)a[n.Field]={type:n.Type.toLowerCase().startsWith("enum")?n.Type.replace(/^enum/i,"ENUM"):n.Type.toUpperCase(),allowNull:n.Null==="YES",defaultValue:n.Default,primaryKey:n.Key==="PRI",autoIncrement:Object.prototype.hasOwnProperty.call(n,"Extra")&&n.Extra.toLowerCase()==="auto_increment",comment:n.Comment?n.Comment:null};return a}return this.isVersionQuery()?r[0].version:a}handleJsonSelectQuery(r){if(!(!this.model||!this.model.fieldRawAttributesMap))for(let a of Object.keys(this.model.fieldRawAttributesMap)){let n=this.model.fieldRawAttributesMap[a];n.type instanceof fJ.JSON&&(r=r.map(i=>(i[n.fieldName]&&typeof i[n.fieldName]=="string"&&!this.connection.info.hasMinVersion(10,5,2)&&(i[n.fieldName]=JSON.parse(i[n.fieldName])),fJ.JSON.parse?fJ.JSON.parse(n,this.sequelize.options,i[n.fieldName]):i)))}}async logWarnings(r){let a=await this.run("SHOW WARNINGS"),n=`MariaDB Warnings (${this.connection.uuid||"default"}): `,i=[];for(let s of a)if(!(s===void 0||typeof s[Symbol.iterator]!="function"))for(let o of s)if(Object.prototype.hasOwnProperty.call(o,"Message"))i.push(o.Message);else for(let c of o.keys())i.push([c,o[c]].join(": "));return this.sequelize.log(n+i.join("; "),this.options),r}formatError(r,a){switch(r.errno){case sor:{let n=r.message.match(/Duplicate entry '([\s\S]*)' for key '?((.|\s)*?)'?\s.*$/),i={},s="Validation error",o=n?n[1].split("-"):void 0,c=n?n[2]:void 0,u=n?n[1]:void 0,l=this.model&&this.model.uniqueKeys[c];l?(l.msg&&(s=l.msg),i=g5e.zipObject(l.fields,o)):i[c]=u;let f=[];return g5e.forOwn(i,(d,h)=>{f.push(new vC.ValidationErrorItem(this.getUniqueConstraintErrorMessage(h),"unique violation",h,d,this.instance,"not_unique"))}),new vC.UniqueConstraintError({message:s,errors:f,parent:r,fields:i,stack:a})}case M5e:case cor:{let n=r.message.match(/CONSTRAINT ([`"])(.*)\1 FOREIGN KEY \(\1(.*)\1\) REFERENCES \1(.*)\1 \(\1(.*)\1\)/),i=n?n[1]:"`",s=n?n[3].split(new RegExp(`${i}, *${i}`)):void 0;return new vC.ForeignKeyConstraintError({reltype:r.errno===M5e?"parent":"child",table:n?n[4]:void 0,fields:s,value:s&&s.length&&this.instance&&this.instance[s[0]]||void 0,index:n?n[2]:void 0,parent:r,stack:a})}default:return new vC.DatabaseError(r,{stack:a})}}handleShowTablesQuery(r){return r.map(a=>({tableName:a.TABLE_NAME,schema:a.TABLE_SCHEMA}))}handleShowIndexesQuery(r){let a,n=[];return r.forEach(i=>{(!a||a.name!==i.Key_name)&&(a={primary:i.Key_name==="PRIMARY",fields:[],name:i.Key_name,tableName:i.Table,unique:i.Non_unique!==1,type:i.Index_type},n.push(a)),a.fields[i.Seq_in_index-1]={attribute:i.Column_name,length:i.Sub_part||void 0,order:i.Collation==="A"?"ASC":void 0}}),n}};O5e.exports=dJ});var v5e=A(($9a,w5e)=>{"use strict";var uor=Object.defineProperty,z5e=Object.getOwnPropertySymbols,lor=Object.prototype.hasOwnProperty,por=Object.prototype.propertyIsEnumerable,E5e=(t,r,a)=>r in t?uor(t,r,{enumerable:!0,configurable:!0,writable:!0,value:a}):t[r]=a,dor=(t,r)=>{for(var a in r||(r={}))lor.call(r,a)&&E5e(t,a,r[a]);if(z5e)for(var a of z5e(r))por.call(r,a)&&E5e(t,a,r[a]);return t},RC=hr(),sa=Ws(),hor=On(),bor={OperatorMap:{[sa.eq]:"=",[sa.ne]:"!=",[sa.gte]:">=",[sa.gt]:">",[sa.lte]:"<=",[sa.lt]:"<",[sa.not]:"IS NOT",[sa.is]:"IS",[sa.in]:"IN",[sa.notIn]:"NOT IN",[sa.like]:"LIKE",[sa.notLike]:"NOT LIKE",[sa.iLike]:"ILIKE",[sa.notILike]:"NOT ILIKE",[sa.startsWith]:"LIKE",[sa.endsWith]:"LIKE",[sa.substring]:"LIKE",[sa.regexp]:"~",[sa.notRegexp]:"!~",[sa.iRegexp]:"~*",[sa.notIRegexp]:"!~*",[sa.between]:"BETWEEN",[sa.notBetween]:"NOT BETWEEN",[sa.overlap]:"&&",[sa.contains]:"@>",[sa.contained]:"<@",[sa.adjacent]:"-|-",[sa.strictLeft]:"<<",[sa.strictRight]:">>",[sa.noExtendRight]:"&<",[sa.noExtendLeft]:"&>",[sa.any]:"ANY",[sa.all]:"ALL",[sa.and]:" AND ",[sa.or]:" OR ",[sa.col]:"COL",[sa.placeholder]:"$$PLACEHOLDER$$",[sa.match]:"@@"},OperatorsAliasMap:{},setOperatorsAliases(t){!t||RC.isEmpty(t)?this.OperatorsAliasMap=!1:this.OperatorsAliasMap=dor({},t)},_replaceAliases(t){let r={};return this.OperatorsAliasMap?(hor.getOperators(t).forEach(a=>{let n=t[a];RC.isPlainObject(n)?r[a]=this._replaceAliases(n):r[a]=n}),RC.forOwn(t,(a,n)=>{n=this.OperatorsAliasMap[n]||n,RC.isPlainObject(a)&&(a=this._replaceAliases(a)),r[n]=a}),r):t}};w5e.exports=bor});var T5e=A((Y9a,R5e)=>{"use strict";var mor=(JM(),gf(KM)).v4,_or={setIsolationLevelQuery(t,r){if(!r.parent)return`SET TRANSACTION ISOLATION LEVEL ${t};`},generateTransactionId(){return mor()},startTransactionQuery(t){return t.parent?`SAVEPOINT ${this.quoteIdentifier(t.name,!0)};`:"START TRANSACTION;"},deferConstraintsQuery(){},setConstraintQuery(){},setDeferredQuery(){},setImmediateQuery(){},commitTransactionQuery(t){if(!t.parent)return"COMMIT;"},rollbackTransactionQuery(t){return t.parent?`ROLLBACK TO SAVEPOINT ${this.quoteIdentifier(t.name,!0)};`:"ROLLBACK;"}};R5e.exports=_or});var xh=A((K9a,x5e)=>{"use strict";var gor=Object.defineProperty,Mor=Object.defineProperties,Aor=Object.getOwnPropertyDescriptors,q5e=Object.getOwnPropertySymbols,Oor=Object.prototype.hasOwnProperty,yor=Object.prototype.propertyIsEnumerable,N5e=(t,r,a)=>r in t?gor(t,r,{enumerable:!0,configurable:!0,writable:!0,value:a}):t[r]=a,A2=(t,r)=>{for(var a in r||(r={}))Oor.call(r,a)&&N5e(t,a,r[a]);if(q5e)for(var a of q5e(r))yor.call(r,a)&&N5e(t,a,r[a]);return t},TC=(t,r)=>Mor(t,Aor(r)),qC=require("util"),ra=hr(),zor=(JM(),gf(KM)).v4,Qt=On(),X9a=nA(),I5e=Cv(),lA=Ja(),Uu=vK(),pA=vh(),hJ=Rh(),Eor=tA(),wor=h2(),Rt=Ws(),bJ=cn(),S5e=LK(),dR=class{constructor(r){if(!r.sequelize)throw new Error("QueryGenerator initialized without options.sequelize");if(!r._dialect)throw new Error("QueryGenerator initialized without options._dialect");this.sequelize=r.sequelize,this.options=r.sequelize.options,this.dialect=r._dialect.name,this._dialect=r._dialect,this._initQuoteIdentifier()}extractTableDetails(r,a){return a=a||{},r=r||{},{schema:r.schema||a.schema||this.options.schema||"public",tableName:ra.isPlainObject(r)?r.tableName:r,delimiter:r.delimiter||a.delimiter||"."}}addSchema(r){if(!r._schema)return r.tableName||r;let a=this;return{tableName:r.tableName||r,table:r.tableName||r,name:r.name||r,schema:r._schema,delimiter:r._schemaDelimiter||".",toString(){return a.quoteTable(this)}}}dropSchema(r,a){return this.dropTableQuery(r,a)}describeTableQuery(r,a,n){return`DESCRIBE ${this.quoteTable(this.addSchema({tableName:r,_schema:a,_schemaDelimiter:n}))};`}dropTableQuery(r){return`DROP TABLE IF EXISTS ${this.quoteTable(r)};`}renameTableQuery(r,a){return`ALTER TABLE ${this.quoteTable(r)} RENAME TO ${this.quoteTable(a)};`}populateInsertQueryReturnIntoBinds(){}insertQuery(r,a,n,i){i=i||{},ra.defaults(i,this.options);let s={},o=i.bind||[],c=[],u=[],l=[],f=[],d=this.quoteTable(r),h=i.bindParam===void 0?this.bindParam(o):i.bindParam,b=[],m,g="",O="",z="",w="",v=!1,T="";if(n&&ra.each(n,(C,Q)=>{s[Q]=C,C.field&&(s[C.field]=C)}),this._dialect.supports["DEFAULT VALUES"]?O+=" DEFAULT VALUES":this._dialect.supports["VALUES ()"]&&(O+=" VALUES ()"),(this._dialect.supports.returnValues||this._dialect.supports.returnIntoValues)&&i.returning){let C=this.generateReturnValues(n,i);u.push(...C.returnFields),this._dialect.supports.returnIntoValues&&l.push(...C.returnTypes),w=C.returningFragment,T=C.tmpTable||"",z=C.outputFragment||""}(ra.get(this,["sequelize","options","dialectOptions","prependSearchPath"])||i.searchPath)&&(i.bindParam=!1),this._dialect.supports.EXCEPTION&&i.exception&&(i.bindParam=!1),a=Qt.removeNullValuesFromHash(a,this.options.omitNull);for(let C in a)if(Object.prototype.hasOwnProperty.call(a,C)){let Q=a[C];c.push(this.quoteIdentifier(C)),s&&s[C]&&s[C].autoIncrement===!0&&Q==null?this._dialect.supports.autoIncrement.defaultValue?this._dialect.supports.DEFAULT?f.push("DEFAULT"):f.push(this.escape(null)):c.splice(-1,1):(s&&s[C]&&s[C].autoIncrement===!0&&(v=!0),Q instanceof Qt.SequelizeMethod||i.bindParam===!1?f.push(this.escape(Q,s&&s[C]||void 0,{context:"INSERT"})):f.push(this.format(Q,s&&s[C]||void 0,{context:"INSERT"},h)))}let x="";if(!ra.isEmpty(i.conflictWhere)&&!this._dialect.supports.inserts.onConflictWhere)throw new Error("missing dialect support for conflictWhere option");if(this._dialect.supports.inserts.updateOnDuplicate&&i.updateOnDuplicate)if(this._dialect.supports.inserts.updateOnDuplicate==" ON CONFLICT DO UPDATE SET"){let C=i.upsertKeys.map(k=>this.quoteIdentifier(k)),Q=i.updateOnDuplicate.map(k=>`${this.quoteIdentifier(k)}=EXCLUDED.${this.quoteIdentifier(k)}`),X=["ON CONFLICT","(",C.join(","),")"];ra.isEmpty(i.conflictWhere)||X.push(this.whereQuery(i.conflictWhere,i)),ra.isEmpty(Q)?X.push("DO NOTHING"):X.push("DO UPDATE SET",Q.join(",")),x=` ${Qt.joinSQLFragments(X)}`}else{let C=i.updateOnDuplicate.map(Q=>`${this.quoteIdentifier(Q)}=VALUES(${this.quoteIdentifier(Q)})`);if(ra.isEmpty(C)&&i.upsertKeys&&C.push(...i.upsertKeys.map(Q=>`${this.quoteIdentifier(Q)}=${this.quoteIdentifier(Q)}`)),ra.isEmpty(C))throw new Error("No update values found for ON DUPLICATE KEY UPDATE clause, and no identifier fields could be found to use instead.");x+=`${this._dialect.supports.inserts.updateOnDuplicate} ${C.join(",")}`}let L={ignoreDuplicates:i.ignoreDuplicates?this._dialect.supports.inserts.ignoreDuplicates:"",onConflictDoNothing:i.ignoreDuplicates?this._dialect.supports.inserts.onConflictDoNothing:"",attributes:c.join(","),output:z,values:f.join(","),tmpTable:T};if(g=`${T}INSERT${L.ignoreDuplicates} INTO ${d} (${L.attributes})${L.output} VALUES (${L.values})${x}${L.onConflictDoNothing}${g}`,O=`${T}INSERT${L.ignoreDuplicates} INTO ${d}${L.output}${x}${L.onConflictDoNothing}${O}`,this._dialect.supports.EXCEPTION&&i.exception){let C="DROP FUNCTION IF EXISTS pg_temp.testfunc()";u.length===0&&u.push("*");let Q=`$func_${zor().replace(/-/g,"")}$`,X=`SELECT (testfunc.response).${u.join(", (testfunc.response).")}, testfunc.sequelize_caught_exception FROM pg_temp.testfunc();`;i.exception="WHEN unique_violation THEN GET STACKED DIAGNOSTICS sequelize_caught_exception = PG_EXCEPTION_DETAIL;",g=`CREATE OR REPLACE FUNCTION pg_temp.testfunc(OUT response ${d}, OUT sequelize_caught_exception text) RETURNS RECORD AS ${Q} BEGIN ${g} RETURNING * INTO response; EXCEPTION ${i.exception} END ${Q} LANGUAGE plpgsql; ${X} ${C}`}else g+=w,O+=w;this._dialect.supports.returnIntoValues&&i.returning&&this.populateInsertQueryReturnIntoBinds(u,l,o.length,b,i),m=`${L.attributes.length?g:O}${b.join(",")};`,this._dialect.supports.finalTable&&(m=`SELECT * FROM FINAL TABLE(${L.attributes.length?g:O});`),v&&this._dialect.supports.autoIncrement.identityInsert&&(m=`SET IDENTITY_INSERT ${d} ON; ${m} SET IDENTITY_INSERT ${d} OFF;`);let P={query:m};return i.bindParam!==!1&&(P.bind=o),P}bulkInsertQuery(r,a,n,i){n=n||{},i=i||{};let s=[],o={},c=[],u="";for(let b of a)ra.forOwn(b,(m,g)=>{c.includes(g)||c.push(g),i[g]&&i[g].autoIncrement===!0&&(o[g]=!0)});for(let b of a){let m=c.map(g=>this._dialect.supports.bulkDefault&&o[g]===!0?b[g]!=null?b[g]:"DEFAULT":this.escape(b[g],i[g],{context:"INSERT"}));s.push(`(${m.join(",")})`)}if(this._dialect.supports.inserts.updateOnDuplicate&&n.updateOnDuplicate)if(this._dialect.supports.inserts.updateOnDuplicate==" ON CONFLICT DO UPDATE SET"){let b=n.upsertKeys.map(O=>this.quoteIdentifier(O)),m=n.updateOnDuplicate.map(O=>`${this.quoteIdentifier(O)}=EXCLUDED.${this.quoteIdentifier(O)}`),g=!1;if(n.conflictWhere){if(!this._dialect.supports.inserts.onConflictWhere)throw new Error(`conflictWhere not supported for dialect ${this._dialect.name}`);g=this.whereQuery(n.conflictWhere,n)}u=["ON CONFLICT","(",b.join(","),")",g,"DO UPDATE SET",m.join(",")]}else{if(n.conflictWhere)throw new Error(`conflictWhere not supported for dialect ${this._dialect.name}`);let b=n.updateOnDuplicate.map(m=>`${this.quoteIdentifier(m)}=VALUES(${this.quoteIdentifier(m)})`);u=`${this._dialect.supports.inserts.updateOnDuplicate} ${b.join(",")}`}let l=n.ignoreDuplicates?this._dialect.supports.inserts.ignoreDuplicates:"",f=c.map(b=>this.quoteIdentifier(b)).join(","),d=n.ignoreDuplicates?this._dialect.supports.inserts.onConflictDoNothing:"",h="";if(this._dialect.supports.returnValues&&n.returning){let b=this.generateReturnValues(i,n);h+=b.returningFragment}return Qt.joinSQLFragments(["INSERT",l,"INTO",this.quoteTable(r),`(${f})`,"VALUES",s.join(","),u,d,h,";"])}updateQuery(r,a,n,i,s){i=i||{},ra.defaults(i,this.options),a=Qt.removeNullValuesFromHash(a,i.omitNull,i);let o=[],c=[],u={},l="",f="",d="";(ra.get(this,["sequelize","options","dialectOptions","prependSearchPath"])||i.searchPath)&&(i.bindParam=!1);let h=i.bindParam===void 0?this.bindParam(c):i.bindParam;if(this._dialect.supports["LIMIT ON UPDATE"]&&i.limit&&(["mssql","db2","oracle"].includes(this.dialect)?this.dialect==="oracle"&&(n&&(n.length&&n.length>0||Object.keys(n).length>0)?d+=" AND ":d+=" WHERE ",d+=`rownum <= ${this.escape(i.limit)} `):d=` LIMIT ${this.escape(i.limit)} `),this._dialect.supports.returnValues&&i.returning){let O=this.generateReturnValues(s,i);d+=O.returningFragment,f=O.tmpTable||"",l=O.outputFragment||"",!this._dialect.supports.returnValues.output&&i.returning&&(i.mapToModel=!0)}s&&ra.each(s,(O,z)=>{u[z]=O,O.field&&(u[O.field]=O)});for(let O in a){if(u&&u[O]&&u[O].autoIncrement===!0&&!this._dialect.supports.autoIncrement.update)continue;let z=a[O];z instanceof Qt.SequelizeMethod||i.bindParam===!1?o.push(`${this.quoteIdentifier(O)}=${this.escape(z,u&&u[O]||void 0,{context:"UPDATE"})}`):o.push(`${this.quoteIdentifier(O)}=${this.format(z,u&&u[O]||void 0,{context:"UPDATE"},h)}`)}let b=TC(A2({},i),{bindParam:h});if(o.length===0)return"";let g={query:`${f}UPDATE ${this.quoteTable(r)} SET ${o.join(",")}${l} ${this.whereQuery(n,b)}${d}`.trim()};return i.bindParam!==!1&&(g.bind=c),g}arithmeticQuery(r,a,n,i,s,o){o=o||{},ra.defaults(o,{returning:!0}),s=Qt.removeNullValuesFromHash(s,this.options.omitNull);let c="",u="";if(this._dialect.supports.returnValues&&o.returning){let f=this.generateReturnValues(null,o);c=f.outputFragment,u=f.returningFragment}let l=[];for(let f in i){let d=i[f],h=this.quoteIdentifier(f),b=this.escape(d);l.push(`${h}=${h}${r} ${b}`)}for(let f in s){let d=s[f],h=this.quoteIdentifier(f),b=this.escape(d);l.push(`${h}=${b}`)}return Qt.joinSQLFragments(["UPDATE",this.quoteTable(a),"SET",l.join(","),c,this.whereQuery(n),u])}addIndexQuery(r,a,n,i){n=n||{},Array.isArray(a)?n.fields=a:(n=a,a=void 0),n.prefix=n.prefix||i||r,n.prefix&&typeof n.prefix=="string"&&(n.prefix=n.prefix.replace(/\./g,"_"),n.prefix=n.prefix.replace(/("|')/g,""));let s=n.fields.map(u=>{if(u instanceof Qt.SequelizeMethod)return this.handleSequelizeMethod(u);typeof u=="string"&&(u={name:u});let l="";if(u.attribute&&(u.name=u.attribute),!u.name)throw new Error(`The following index field has no name: ${qC.inspect(u)}`);if(l+=this.quoteIdentifier(u.name),this._dialect.supports.index.collate&&u.collate&&(l+=` COLLATE ${this.quoteIdentifier(u.collate)}`),this._dialect.supports.index.operator){let f=u.operator||n.operator;f&&(l+=` ${f}`)}return this._dialect.supports.index.length&&u.length&&(l+=`(${u.length})`),u.order&&(l+=` ${u.order}`),l});n.name||(n=Qt.nameIndex(n,n.prefix)),n=Uu._conformIndex(n),this._dialect.supports.index.type||delete n.type,n.where&&(n.where=this.whereQuery(n.where)),typeof r=="string"?r=this.quoteIdentifiers(r):r=this.quoteTable(r);let o=this._dialect.supports.index.concurrently&&n.concurrently?"CONCURRENTLY":void 0,c;return this._dialect.supports.indexViaAlter?c=["ALTER TABLE",r,o,"ADD"]:c=["CREATE"],c=c.concat(n.unique?"UNIQUE":"",n.type,"INDEX",this._dialect.supports.indexViaAlter?void 0:o,this.quoteIdentifiers(n.name),this._dialect.supports.index.using===1&&n.using?`USING ${n.using}`:"",this._dialect.supports.indexViaAlter?void 0:`ON ${r}`,this._dialect.supports.index.using===2&&n.using?`USING ${n.using}`:"",`(${s.join(", ")})`,this._dialect.supports.index.parser&&n.parser?`WITH PARSER ${n.parser}`:void 0,this._dialect.supports.index.where&&n.where?n.where:void 0),ra.compact(c).join(" ")}addConstraintQuery(r,a){return typeof r=="string"?r=this.quoteIdentifiers(r):r=this.quoteTable(r),Qt.joinSQLFragments(["ALTER TABLE",r,"ADD",this.getConstraintSnippet(r,a||{}),";"])}getConstraintSnippet(r,a){let n,i,s=a.fields.map(u=>{if(typeof u=="string")return this.quoteIdentifier(u);if(u instanceof Qt.SequelizeMethod)return this.handleSequelizeMethod(u);if(u.attribute&&(u.name=u.attribute),!u.name)throw new Error(`The following index field has no name: ${u}`);return this.quoteIdentifier(u.name)}),o=s.join(", "),c=s.join("_");switch(a.type.toUpperCase()){case"UNIQUE":i=this.quoteIdentifier(a.name||`${r}_${c}_uk`),n=`CONSTRAINT ${i} UNIQUE (${o})`;break;case"CHECK":a.where=this.whereItemsQuery(a.where),i=this.quoteIdentifier(a.name||`${r}_${c}_ck`),n=`CONSTRAINT ${i} CHECK (${a.where})`;break;case"DEFAULT":if(a.defaultValue===void 0)throw new Error("Default value must be specified for DEFAULT CONSTRAINT");if(this._dialect.name!=="mssql")throw new Error("Default constraints are supported only for MSSQL dialect.");i=this.quoteIdentifier(a.name||`${r}_${c}_df`),n=`CONSTRAINT ${i} DEFAULT (${this.escape(a.defaultValue)}) FOR ${s[0]}`;break;case"PRIMARY KEY":i=this.quoteIdentifier(a.name||`${r}_${c}_pk`),n=`CONSTRAINT ${i} PRIMARY KEY (${o})`;break;case"FOREIGN KEY":let u=a.references;if(!u||!u.table||!(u.field||u.fields))throw new Error("references object with table and field must be specified");i=this.quoteIdentifier(a.name||`${r}_${c}_${u.table}_fk`);let l=typeof u.field<"u"?this.quoteIdentifier(u.field):u.fields.map(d=>this.quoteIdentifier(d)).join(", "),f=`${this.quoteTable(u.table)} (${l})`;n=`CONSTRAINT ${i} `,n+=`FOREIGN KEY (${o}) REFERENCES ${f}`,a.onUpdate&&(n+=` ON UPDATE ${a.onUpdate.toUpperCase()}`),a.onDelete&&(n+=` ON DELETE ${a.onDelete.toUpperCase()}`);break;default:throw new Error(`${a.type} is invalid.`)}return a.deferrable&&["UNIQUE","PRIMARY KEY","FOREIGN KEY"].includes(a.type.toUpperCase())&&(n+=` ${this.deferConstraintsQuery(a)}`),n}removeConstraintQuery(r,a){return typeof r=="string"?r=this.quoteIdentifiers(r):r=this.quoteTable(r),Qt.joinSQLFragments(["ALTER TABLE",r,"DROP CONSTRAINT",this.quoteIdentifiers(a)])}quote(r,a,n){let i=["ASC","DESC","ASC NULLS LAST","DESC NULLS LAST","ASC NULLS FIRST","DESC NULLS FIRST","NULLS FIRST","NULLS LAST"];if(n=n||".",typeof r=="string")return this.quoteIdentifiers(r);if(Array.isArray(r)){r.forEach((f,d)=>{let h=r[d-1],b,m;if(!h&&a!==void 0?m=a:h&&h instanceof pA&&(b=h,m=h.target),m&&m.prototype instanceof Uu){let g,O;if(typeof f=="function"&&f.prototype instanceof Uu?g=f:ra.isPlainObject(f)&&f.model&&f.model.prototype instanceof Uu&&(g=f.model,O=f.as),g&&(!O&&b&&b instanceof pA&&b.through&&b.through.model===g?f=new pA(m,g,{as:g.name}):(f=m.getAssociationForAlias(g,O),f||(f=m.getAssociationForAlias(g,g.name))),!(f instanceof pA)))throw new Error(qC.format("Unable to find a valid association for model, '%s'",g.name))}if(typeof f=="string"){let g=i.indexOf(f.toUpperCase());if(d>0&&g!==-1)f=this.sequelize.literal(` ${i[g]}`);else if(m&&m.prototype instanceof Uu){if(m.associations!==void 0&&m.associations[f])f=m.associations[f];else if(m.rawAttributes!==void 0&&m.rawAttributes[f]&&f!==m.rawAttributes[f].field)f=m.rawAttributes[f].field;else if(f.includes(".")&&m.rawAttributes!==void 0){let O=f.split(".");if(m.rawAttributes[O[0]].type instanceof lA.JSON){let z=this.quoteIdentifiers(`${m.name}.${m.rawAttributes[O[0]].field}`),w=O.slice(1);f=this.jsonPathExtractionQuery(z,w),f=this.sequelize.literal(f)}}}}r[d]=f},this);let s=r.length,o=[],c,u=0;for(u=0;u<s-1&&(c=r[u],!(typeof c=="string"||c._modelAttribute||c instanceof Qt.SequelizeMethod));u++)c instanceof pA&&(o[u]=c.as);let l="";return u>0?l+=`${this.quoteIdentifier(o.join(n))}.`:typeof r[0]=="string"&&a&&(l+=`${this.quoteIdentifier(a.name)}.`),r.slice(u).forEach(f=>{l+=this.quote(f,a,n)},this),l}if(r._modelAttribute)return`${this.quoteTable(r.Model.name)}.${this.quoteIdentifier(r.fieldName)}`;if(r instanceof Qt.SequelizeMethod)return this.handleSequelizeMethod(r);throw ra.isPlainObject(r)&&r.raw?new Error('The `{raw: "..."}` syntax is no longer supported.  Use `sequelize.literal` instead.'):new Error(`Unknown structure passed to order / group: ${qC.inspect(r)}`)}_initQuoteIdentifier(){this._quoteIdentifier=this.quoteIdentifier,this.quoteIdentifier=function(r,a){return r==="*"?r:this._quoteIdentifier(r,a)}}quoteIdentifier(r,a){throw new Error(`quoteIdentifier for Dialect "${this.dialect}" is not implemented`)}quoteIdentifiers(r){if(r.includes(".")){r=r.split(".");let a=r.slice(0,r.length-1).join("->"),n=r[r.length-1];return`${this.quoteIdentifier(a)}.${this.quoteIdentifier(n)}`}return this.quoteIdentifier(r)}quoteAttribute(r,a){return a&&r in a.rawAttributes?this.quoteIdentifier(r):this.quoteIdentifiers(r)}getAliasToken(){return"AS"}quoteTable(r,a){let n="";return a===!0&&(a=r.as||r.name||r),ra.isObject(r)?this._dialect.supports.schemas?(r.schema&&(n+=`${this.quoteIdentifier(r.schema)}.`),n+=this.quoteIdentifier(r.tableName)):(r.schema&&(n+=r.schema+(r.delimiter||".")),n+=r.tableName,n=this.quoteIdentifier(n)):n=this.quoteIdentifier(r),a&&(n+=` ${this.getAliasToken()} ${this.quoteIdentifier(a)}`),n}escape(r,a,n){if(n=n||{},r!=null){if(r instanceof Qt.SequelizeMethod)return this.handleSequelizeMethod(r);if(a&&a.type&&(a.type instanceof lA.STRING&&["mysql","mariadb"].includes(this.dialect)&&["number","boolean"].includes(typeof r)&&(r=String(Number(r))),this.validate(r,a,n),a.type.stringify)){let i=s=>I5e.escape(s,this.options.timezone,this.dialect);if(r=a.type.stringify(r,{escape:i,field:a,timezone:this.options.timezone,operation:n.operation}),a.type.escape===!1)return r}}return I5e.escape(r,this.options.timezone,this.dialect)}bindParam(r){return a=>(r.push(a),`$${r.length}`)}format(r,a,n,i){if(n=n||{},r!=null){if(r instanceof Qt.SequelizeMethod)throw new Error("Cannot pass SequelizeMethod as a bind parameter - use escape instead");if(a&&a.type&&(this.validate(r,a,n),a.type.bindParam))return a.type.bindParam(r,{escape:ra.identity,field:a,timezone:this.options.timezone,operation:n.operation,bindParam:i})}return i(r)}validate(r,a,n){if(this.typeValidation&&a.type.validate&&r)try{if(n.isList&&Array.isArray(r))for(let i of r)a.type.validate(i,n);else a.type.validate(r,n)}catch(i){throw i instanceof bJ.ValidationError&&i.errors.push(new bJ.ValidationErrorItem(i.message,"Validation error",a.fieldName,r,null,`${a.type.key} validator`)),i}}isIdentifierQuoted(r){return/^\s*(?:([`"'])(?:(?!\1).|\1{2})*\1\.?)+\s*$/i.test(r)}jsonPathExtractionQuery(r,a,n){let i=ra.toPath(a),s,o=this.isIdentifierQuoted(r)?r:this.quoteIdentifier(r);switch(this.dialect){case"mysql":case"mariadb":case"sqlite":return this.dialect==="mysql"&&(i=i.map(u=>/\D/.test(u)?Qt.addTicks(u,'"'):u)),s=this.escape(["$"].concat(i).join(".").replace(/\.(\d+)(?:(?=\.)|$)/g,(u,l)=>`[${l}]`)),this.dialect==="sqlite"?`json_extract(${o},${s})`:`json_unquote(json_extract(${o},${s}))`;case"postgres":let c=n?"#>":"#>>";return s=this.escape(`{${i.join(",")}}`),`(${o}${c}${s})`;default:throw new Error(`Unsupported ${this.dialect} for JSON operations`)}}selectQuery(r,a,n){a=a||{};let i=a.limit,s=[],o=[],c=a.subQuery===void 0?i&&a.hasMultiAssociation:a.subQuery,u={main:a.attributes&&a.attributes.slice(),subQuery:null},l={name:r,quotedName:null,as:null,model:n},f={names:l,options:a,subQuery:c},d=[],h=[],b;if(this.options.minifyAliases&&!a.aliasesMapping&&(a.aliasesMapping=new Map,a.aliasesByTable={},a.includeAliases=new Map),a.tableAs?l.as=this.quoteIdentifier(a.tableAs):!Array.isArray(l.name)&&l.model&&(l.as=this.quoteIdentifier(l.model.name)),l.quotedName=Array.isArray(l.name)?r.map(g=>Array.isArray(g)?this.quoteTable(g[0],g[1]):this.quoteTable(g,!0)).join(", "):this.quoteTable(l.name),c&&u.main)for(let g of l.model.primaryKeyAttributes)u.main.some(O=>g===O||g===O[0]||g===O[1])||u.main.push(l.model.rawAttributes[g].field?[g,l.model.rawAttributes[g].field]:g);if(u.main=this.escapeAttributes(u.main,a,l.as),u.main=u.main||(a.include?[`${l.as}.*`]:["*"]),(c||a.groupedLimit)&&(u.subQuery=u.main,u.main=[`${l.as||l.quotedName}.*`]),a.include)for(let g of a.include){if(g.separate)continue;let O=this.generateInclude(g,{externalAs:l.as,internalAs:l.as},f);h=h.concat(O.subQuery),d=d.concat(O.mainQuery),O.attributes.main.length>0&&(u.main=ra.uniq(u.main.concat(O.attributes.main))),O.attributes.subQuery.length>0&&(u.subQuery=ra.uniq(u.subQuery.concat(O.attributes.subQuery)))}if(c)o.push(this.selectFromTableFragment(a,l.model,u.subQuery,l.quotedName,l.as)),o.push(h.join(""));else{if(a.groupedLimit){l.as||(l.as=l.quotedName);let g=A2({},a.where),O,z,w,v=l.as;if(typeof a.groupedLimit.on=="string"?z=a.groupedLimit.on:a.groupedLimit.on instanceof wor&&(z=a.groupedLimit.on.foreignKeyField),a.groupedLimit.on instanceof Eor){v=a.groupedLimit.on.manyFromSource.as;let P=Uu._validateIncludedElements({include:[{association:a.groupedLimit.on.manyFromSource,duplicating:!1,required:!0,where:A2({[Rt.placeholder]:!0},a.groupedLimit.through&&a.groupedLimit.through.where)}],model:n});a.hasJoin=!0,a.hasMultiAssociation=!0,a.includeMap=Object.assign(P.includeMap,a.includeMap),a.includeNames=P.includeNames.concat(a.includeNames||[]),w=P.include,Array.isArray(a.order)&&(a.order.forEach((C,Q)=>{Array.isArray(C)&&(C=C[0]);let X=`subquery_order_${Q}`;a.attributes.push([C,X]),X=this.sequelize.literal(this.quote(X)),Array.isArray(a.order[Q])?a.order[Q][0]=X:a.order[Q]=X}),O=a.order)}else O=a.order,this._dialect.supports.topLevelOrderByRequired||delete a.order,g[Rt.placeholder]=!0;let T=`SELECT * FROM (${this.selectQuery(r,{attributes:a.attributes,offset:a.offset,limit:a.groupedLimit.limit,order:O,aliasesMapping:a.aliasesMapping,aliasesByTable:a.aliasesByTable,where:g,include:w,model:n},n).replace(/;$/,"")}) ${this.getAliasToken()} sub`,x=this.whereItemQuery(Rt.placeholder,!0,{model:n}),L=T.indexOf(x);s.push(this.selectFromTableFragment(a,l.model,u.main,`(${a.groupedLimit.values.map(P=>{let C;return z&&(C={[z]:P}),w&&(C={[a.groupedLimit.on.foreignIdentifierField]:P}),Qt.spliceStr(T,L,x.length,this.getWhereConditions(C,v))}).join(this._dialect.supports["UNION ALL"]?" UNION ALL ":" UNION ")})`,l.as))}else s.push(this.selectFromTableFragment(a,l.model,u.main,l.quotedName,l.as));s.push(d.join(""))}if(Object.prototype.hasOwnProperty.call(a,"where")&&!a.groupedLimit&&(a.where=this.getWhereConditions(a.where,l.as||r,n,a),a.where&&(c?o.push(` WHERE ${a.where}`):(s.push(` WHERE ${a.where}`),s.forEach((g,O)=>{g.startsWith("SELECT")&&(s[O]=this.selectFromTableFragment(a,n,u.main,l.quotedName,l.as,a.where))})))),a.group&&(a.group=Array.isArray(a.group)?a.group.map(g=>this.aliasGrouping(g,n,l.as,a)).join(", "):this.aliasGrouping(a.group,n,l.as,a),c&&a.group?o.push(` GROUP BY ${a.group}`):a.group&&s.push(` GROUP BY ${a.group}`)),Object.prototype.hasOwnProperty.call(a,"having")&&(a.having=this.getWhereConditions(a.having,r,n,a,!1),a.having&&(c?o.push(` HAVING ${a.having}`):s.push(` HAVING ${a.having}`))),a.order){let g=this.getQueryOrders(a,n,c);g.mainQueryOrder.length&&s.push(` ORDER BY ${g.mainQueryOrder.join(", ")}`),g.subQueryOrder.length&&o.push(` ORDER BY ${g.subQueryOrder.join(", ")}`)}let m=this.addLimitAndOffset(a,l.model);if(m&&!a.groupedLimit&&(c?o.push(m):s.push(m)),c?(this._throwOnEmptyAttributes(u.main,{modelName:n&&n.name,as:l.as}),b=`SELECT ${u.main.join(", ")} FROM (${o.join("")}) ${this.getAliasToken()} ${l.as}${d.join("")}${s.join("")}`):b=s.join(""),a.lock&&this._dialect.supports.lock){let g=a.lock;typeof a.lock=="object"&&(g=a.lock.level),this._dialect.supports.lockKey&&["KEY SHARE","NO KEY UPDATE"].includes(g)?b+=` FOR ${g}`:g==="SHARE"?b+=` ${this._dialect.supports.forShare}`:b+=" FOR UPDATE",this._dialect.supports.lockOf&&a.lock.of&&a.lock.of.prototype instanceof Uu&&(b+=` OF ${this.quoteTable(a.lock.of.name)}`),this._dialect.supports.skipLocked&&a.skipLocked&&(b+=" SKIP LOCKED")}return`${b};`}aliasGrouping(r,a,n,i){let s=Array.isArray(r)?r[0]:r;return this.quote(this._getAliasForField(n,s,i)||s,a)}escapeAttributes(r,a,n){return r&&r.map(i=>{let s=!0;if(i instanceof Qt.SequelizeMethod)return this.handleSequelizeMethod(i);if(Array.isArray(i)){if(i.length!==2)throw new Error(`${JSON.stringify(i)} is not a valid attribute definition. Please use the following format: ['attribute definition', 'alias']`);if(i=i.slice(),i[0]instanceof Qt.SequelizeMethod)i[0]=this.handleSequelizeMethod(i[0]),s=!1;else if(this.options.attributeBehavior==="escape"||!i[0].includes("(")&&!i[0].includes(")"))i[0]=this.quoteIdentifier(i[0]);else if(this.options.attributeBehavior!=="unsafe-legacy")throw new Error(`Attributes cannot include parentheses in Sequelize 6:
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            

Error: Please install mysql2 package manually
    at t._loadDialectModule (/home/wiomgjqe/neduas.store/server.js:124:7832)
    at new t (/home/wiomgjqe/neduas.store/server.js:136:66644)
    at new O1 (/home/wiomgjqe/neduas.store/server.js:136:73185)
    at new t (/home/wiomgjqe/neduas.store/server.js:136:229204)
    at Object.<anonymous> (/home/wiomgjqe/neduas.store/server.js:3649:2755)
    at Module._compile (node:internal/modules/cjs/loader:1275:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1329:10)
    at Module.load (node:internal/modules/cjs/loader:1133:32)
    at Module._load (node:internal/modules/cjs/loader:972:12)
    at Module.require (node:internal/modules/cjs/loader:1157:19)

Node.js v19.9.0
/home/wiomgjqe/neduas.store/server.js:124
`}};MC.AggregateError=sJ});var n5e=A(AC=>{"use strict";Object.defineProperty(AC,"__esModule",{value:!0});AC.Deferred=void 0;var Tsr=iJ(),cJ=class{constructor(){this._promise=new Promise((r,a)=>{this._reject=a,this._resolve=r})}registerTimeout(r,a){this._timeout||(this._timeout=setTimeout(()=>{a(),this.reject(new Tsr.TimeoutError("Operation timeout"))},r))}_clearTimeout(){this._timeout&&clearTimeout(this._timeout)}resolve(r){this._clearTimeout(),this._resolve(r)}reject(r){this._clearTimeout(),this._reject(r)}promise(){return this._promise}};AC.Deferred=cJ});var i5e=A(OC=>{"use strict";Object.defineProperty(OC,"__esModule",{value:!0});OC.Pool=void 0;var qsr=n5e(),Nsr=oJ(),uJ=class{constructor(r){if(this.log=!1,!r.create)throw new Error("create function is required");if(!r.destroy)throw new Error("destroy function is required");if(!r.validate)throw new Error("validate function is required");if(typeof r.min!="number"||r.min<0||r.min!==Math.round(r.min))throw new Error("min must be an integer >= 0");if(typeof r.max!="number"||r.max<=0||r.max!==Math.round(r.max))throw new Error("max must be an integer > 0");if(r.min>r.max)throw new Error("max is smaller than min");if(r.maxUses!==void 0&&(typeof r.maxUses!="number"||r.maxUses<0))throw new Error("maxUses must be an integer >= 0");this.idleTimeoutMillis=r.idleTimeoutMillis||3e4,this.acquireTimeoutMillis=r.acquireTimeoutMillis||3e4,this.reapIntervalMillis=r.reapIntervalMillis||1e3,this.maxUsesPerResource=r.maxUses||1/0,this.log=r.log||!1,this._factory=r,this._count=0,this._draining=!1,this._pendingAcquires=[],this._inUseObjects=[],this._availableObjects=[],this._removeIdleScheduled=!1}get size(){return this._count}get name(){return this._factory.name}get available(){return this._availableObjects.length}get using(){return this._inUseObjects.length}get waiting(){return this._pendingAcquires.length}get maxSize(){return this._factory.max}get minSize(){return this._factory.min}_log(r,a){typeof this.log=="function"?this.log(r,a):this.log&&console.log(`${a.toUpperCase()} pool ${this.name||""} - ${r}`)}_removeIdle(){let r=[],a=Date.now(),n,i=this._availableObjects.length,s=this.size-this.minSize,o;for(this._removeIdleScheduled=!1,n=0;n<i&&s>r.length;n++)o=this._availableObjects[n].timeout,a>=o&&(this._log("removeIdle() destroying obj - now:"+a+" timeout:"+o,"verbose"),r.push(this._availableObjects[n].resource));r.forEach(this.destroy,this),i=this._availableObjects.length,i>0?(this._log("this._availableObjects.length="+i,"verbose"),this._scheduleRemoveIdle()):this._log("removeIdle() all objects removed","verbose")}_scheduleRemoveIdle(){this._removeIdleScheduled||(this._removeIdleScheduled=!0,this._removeIdleTimer=setTimeout(()=>{this._removeIdle()},this.reapIntervalMillis))}_dispense(){let r=null,a=this._pendingAcquires.length;if(this._log(`dispense() clients=${a} available=${this._availableObjects.length}`,"info"),!(a<1)){for(;this._availableObjects.length>0;){if(this._log("dispense() - reusing obj","verbose"),r=this._availableObjects[this._availableObjects.length-1],!this._factory.validate(r.resource)){this.destroy(r.resource);continue}return this._availableObjects.pop(),this._addResourceToInUseObjects(r.resource,r.useCount),this._pendingAcquires.shift().resolve(r.resource)}this.size<this.maxSize&&this._createResource()}}_createResource(){this._count+=1,this._log(`createResource() - creating obj - count=${this.size} min=${this.minSize} max=${this.maxSize}`,"verbose"),this._factory.create().then(r=>{let a=this._pendingAcquires.shift();a?(this._addResourceToInUseObjects(r,0),a.resolve(r)):this._addResourceToAvailableObjects(r,0)}).catch(r=>{let a=this._pendingAcquires.shift();this._count-=1,this._count<0&&(this._count=0),a&&a.reject(r),process.nextTick(()=>{this._dispense()})})}_addResourceToAvailableObjects(r,a){let n={resource:r,useCount:a,timeout:Date.now()+this.idleTimeoutMillis};this._availableObjects.push(n),this._dispense(),this._scheduleRemoveIdle()}_addResourceToInUseObjects(r,a){let n={resource:r,useCount:a};this._inUseObjects.push(n)}_ensureMinimum(){let r,a;if(!this._draining&&this.size<this.minSize)for(a=this.minSize-this.size,r=0;r<a;r++)this._createResource()}acquire(){if(this._draining)return Promise.reject(new Error("pool is draining and cannot accept work"));let r=new qsr.Deferred;return r.registerTimeout(this.acquireTimeoutMillis,()=>{this._pendingAcquires=this._pendingAcquires.filter(a=>a!==r)}),this._pendingAcquires.push(r),this._dispense(),r.promise()}release(r){if(this._availableObjects.some(i=>i.resource===r)){this._log("release called twice for the same resource: "+new Error().stack,"error");return}let a=this._inUseObjects.findIndex(i=>i.resource===r);if(a<0){this._log("attempt to release an invalid resource: "+new Error().stack,"error");return}let n=this._inUseObjects[a];n.useCount+=1,n.useCount>=this.maxUsesPerResource?(this._log("release() destroying obj - useCount:"+n.useCount+" maxUsesPerResource:"+this.maxUsesPerResource,"verbose"),this.destroy(n.resource),this._dispense()):(this._inUseObjects.splice(a,1),this._addResourceToAvailableObjects(n.resource,n.useCount))}async destroy(r){let a=this._availableObjects.length,n=this._inUseObjects.length;if(this._availableObjects=this._availableObjects.filter(i=>i.resource!==r),this._inUseObjects=this._inUseObjects.filter(i=>i.resource!==r),a===this._availableObjects.length&&n===this._inUseObjects.length){this._ensureMinimum();return}this._count-=1,this._count<0&&(this._count=0);try{await this._factory.destroy(r)}finally{this._ensureMinimum(),this._draining||process.nextTick(()=>{this._dispense()})}}drain(){this._log("draining","info"),this._draining=!0;let r=a=>{if(this._pendingAcquires.length>0){this._dispense(),setTimeout(()=>{r(a)},100);return}if(this._availableObjects.length!==this._count){setTimeout(()=>{r(a)},100);return}a()};return new Promise(a=>r(a))}async destroyAllNow(){this._log("force destroying all objects","info"),this._removeIdleScheduled=!1,clearTimeout(this._removeIdleTimer);let r=this._availableObjects.map(n=>n.resource),a=[];for(let n of r)try{await this.destroy(n)}catch(i){this._log("Error destroying resource: "+i.stack,"error"),a.push(i)}if(a.length>0)throw new Nsr.AggregateError(a)}};OC.Pool=uJ});var s5e=A(Nh=>{"use strict";Object.defineProperty(Nh,"__esModule",{value:!0});Nh.Pool=Nh.AggregateError=Nh.TimeoutError=void 0;var Isr=iJ();Object.defineProperty(Nh,"TimeoutError",{enumerable:!0,get:function(){return Isr.TimeoutError}});var Ssr=oJ();Object.defineProperty(Nh,"AggregateError",{enumerable:!0,get:function(){return Ssr.AggregateError}});var xsr=i5e();Object.defineProperty(Nh,"Pool",{enumerable:!0,get:function(){return xsr.Pool}})});var Df=A((j9a,yC)=>{"use strict";var{Pool:lJ,TimeoutError:ksr}=s5e(),Ih=hr(),pJ=qh(),Csr=cn(),{logger:Lsr}=Ti(),Dsr=nA(),Jl=Lsr.debugContext("pool"),uR=class{constructor(r,a){let n=Ih.cloneDeep(a.config);if(this.sequelize=a,this.config=n,this.dialect=r,this.versionPromise=null,this.dialectName=this.sequelize.options.dialect,n.pool===!1)throw new Error("Support for pool:false was removed in v4.0");n.pool=Ih.defaults(n.pool||{},{max:5,min:0,idle:1e4,acquire:6e4,evict:1e3,validate:this._validate.bind(this)}),this.initPools()}refreshTypeParser(r){Ih.each(r,a=>{if(Object.prototype.hasOwnProperty.call(a,"parse"))if(a.types[this.dialectName])this._refreshTypeParser(a);else throw new Error(`Parse function not supported for type ${a.key} in dialect ${this.dialectName}`)})}_loadDialectModule(r){try{return this.sequelize.config.dialectModulePath?require(this.sequelize.config.dialectModulePath):this.sequelize.config.dialectModule?this.sequelize.config.dialectModule:require(r)}catch(a){throw a.code==="MODULE_NOT_FOUND"?this.sequelize.config.dialectModulePath?new Error(`Unable to find dialect at ${this.sequelize.config.dialectModulePath}`):new Error(`Please install ${r} package manually`):a}}async _onProcessExit(){if(this.pool)return await this.pool.drain(),Jl("connection drain due to process exit"),await this.pool.destroyAllNow()}async close(){return this.getConnection=async function(){throw new Error("ConnectionManager.getConnection was called after the connection manager was closed!")},await this._onProcessExit()}initPools(){let r=this.config;if(!r.replication){this.pool=new lJ({name:"sequelize",create:()=>this._connect(r),destroy:async n=>{let i=await this._disconnect(n);return Jl("connection destroy"),i},validate:r.pool.validate,max:r.pool.max,min:r.pool.min,acquireTimeoutMillis:r.pool.acquire,idleTimeoutMillis:r.pool.idle,reapIntervalMillis:r.pool.evict,maxUses:r.pool.maxUses}),Jl(`pool created with max/min: ${r.pool.max}/${r.pool.min}, no replication`);return}Array.isArray(r.replication.read)||(r.replication.read=[r.replication.read]),r.replication.write=Ih.defaults(r.replication.write,Ih.omit(r,"replication")),r.replication.read=r.replication.read.map(n=>Ih.defaults(n,Ih.omit(this.config,"replication")));let a=0;this.pool={release:n=>{n.queryType==="read"?this.pool.read.release(n):this.pool.write.release(n)},acquire:(n,i)=>(i=i===void 0?!1:i,n==="SELECT"&&!i?this.pool.read.acquire():this.pool.write.acquire()),destroy:n=>{this.pool[n.queryType].destroy(n),Jl("connection destroy")},destroyAllNow:async()=>{await Promise.all([this.pool.read.destroyAllNow(),this.pool.write.destroyAllNow()]),Jl("all connections destroyed")},drain:async()=>Promise.all([this.pool.write.drain(),this.pool.read.drain()]),read:new lJ({name:"sequelize:read",create:async()=>{let n=a++%r.replication.read.length,i=await this._connect(r.replication.read[n]);return i.queryType="read",i},destroy:n=>this._disconnect(n),validate:r.pool.validate,max:r.pool.max,min:r.pool.min,acquireTimeoutMillis:r.pool.acquire,idleTimeoutMillis:r.pool.idle,reapIntervalMillis:r.pool.evict,maxUses:r.pool.maxUses}),write:new lJ({name:"sequelize:write",create:async()=>{let n=await this._connect(r.replication.write);return n.queryType="write",n},destroy:n=>this._disconnect(n),validate:r.pool.validate,max:r.pool.max,min:r.pool.min,acquireTimeoutMillis:r.pool.acquire,idleTimeoutMillis:r.pool.idle,reapIntervalMillis:r.pool.evict,maxUses:r.pool.maxUses})},Jl(`pool created with max/min: ${r.pool.max}/${r.pool.min}, with replication`)}async getConnection(r){r=r||{},this.sequelize.options.databaseVersion===0&&(this.versionPromise||(this.versionPromise=(async()=>{try{let n=await this._connect(this.config.replication.write||this.config),i={};if(i.transaction={connection:n},i.logging=()=>{},i.logging.__testLoggingFn=!0,this.sequelize.options.databaseVersion===0){let s=await this.sequelize.databaseVersion(i),o=Ih.get(pJ.coerce(s),"version")||s;this.sequelize.options.databaseVersion=pJ.valid(o)?o:this.dialect.defaultVersion}return pJ.lt(this.sequelize.options.databaseVersion,this.dialect.defaultVersion)&&(Dsr.unsupportedEngine(),Jl(`Unsupported database engine version ${this.sequelize.options.databaseVersion}`)),this.versionPromise=null,await this._disconnect(n)}catch(n){throw this.versionPromise=null,n}})()),await this.versionPromise);let a;try{await this.sequelize.runHooks("beforePoolAcquire",r),a=await this.pool.acquire(r.type,r.useMaster),await this.sequelize.runHooks("afterPoolAcquire",a,r)}catch(n){throw n instanceof ksr?new Csr.ConnectionAcquireTimeoutError(n):n}return Jl("connection acquired"),a}releaseConnection(r){this.pool.release(r),Jl("connection released")}async destroyConnection(r){await this.pool.destroy(r),Jl(`connection ${r.uuid} destroyed`)}async _connect(r){await this.sequelize.runHooks("beforeConnect",r);let a=await this.dialect.connectionManager.connect(r);return await this.sequelize.runHooks("afterConnect",a,r),a}async _disconnect(r){return await this.sequelize.runHooks("beforeDisconnect",r),await this.dialect.connectionManager.disconnect(r),this.sequelize.runHooks("afterDisconnect",r)}_validate(r){return this.dialect.connectionManager.validate?this.dialect.connectionManager.validate(r):!0}};yC.exports=uR;yC.exports.ConnectionManager=uR;yC.exports.default=uR});var Vc=A((G9a,o5e)=>{"use strict";var lR=new Map;o5e.exports=t=>(lR.has(t)||lR.set(t,new Map),{clear(){lR.get(t).clear()},refresh(r){for(let a of r.types[t])lR.get(t).set(a,r.parse)},get(r){return lR.get(t).get(r)}})});var p5e=A((Q9a,EC)=>{"use strict";var Bsr=Object.defineProperty,c5e=Object.getOwnPropertySymbols,Psr=Object.prototype.hasOwnProperty,Wsr=Object.prototype.propertyIsEnumerable,u5e=(t,r,a)=>r in t?Bsr(t,r,{enumerable:!0,configurable:!0,writable:!0,value:a}):t[r]=a,Usr=(t,r)=>{for(var a in r||(r={}))Psr.call(r,a)&&u5e(t,a,r[a]);if(c5e)for(var a of c5e(r))Wsr.call(r,a)&&u5e(t,a,r[a]);return t},Fsr=qh(),jsr=Df(),uA=cn(),{logger:Gsr}=Ti(),Qsr=Ja().mariadb,Hsr=Hl(),l5e=Gsr.debugContext("connection:mariadb"),zC=Vc()("mariadb"),pR=class t extends jsr{constructor(r,a){a.config.port=a.config.port||3306,super(r,a),this.lib=this._loadDialectModule("mariadb"),this.refreshTypeParser(Qsr)}static _typecast(r,a){return zC.get(r.type)?zC.get(r.type)(r,this.sequelize.options,a):a()}_refreshTypeParser(r){zC.refresh(r)}_clearTypeParser(){zC.clear()}async connect(r){let a=this.sequelize.options.timezone;a=/\//.test(a)?Hsr.tz(a).format("Z"):a;let n=Usr({host:r.host,port:r.port,user:r.username,password:r.password,database:r.database,timezone:a,typeCast:t._typecast.bind(this),bigNumberStrings:!1,supportBigNumbers:!0,foundRows:!1},r.dialectOptions);this.sequelize.config.keepDefaultTimezone||(n.initSql?(Array.isArray(n.initSql)||(n.initSql=[n.initSql]),n.initSql.push(`SET time_zone = '${a}'`)):n.initSql=`SET time_zone = '${a}'`);try{let i=await this.lib.createConnection(n);return this.sequelize.options.databaseVersion=Fsr.coerce(i.serverVersion()).version,l5e("connection acquired"),i.on("error",s=>{switch(s.code){case"ESOCKET":case"ECONNRESET":case"EPIPE":case"PROTOCOL_CONNECTION_LOST":this.pool.destroy(i)}}),i}catch(i){switch(i.code){case"ECONNREFUSED":throw new uA.ConnectionRefusedError(i);case"ER_ACCESS_DENIED_ERROR":case"ER_ACCESS_DENIED_NO_PASSWORD_ERROR":throw new uA.AccessDeniedError(i);case"ENOTFOUND":throw new uA.HostNotFoundError(i);case"EHOSTUNREACH":case"ENETUNREACH":case"EADDRNOTAVAIL":throw new uA.HostNotReachableError(i);case"EINVAL":throw new uA.InvalidConnectionError(i);default:throw new uA.ConnectionError(i)}}}async disconnect(r){if(!r.isValid()){l5e("connection tried to disconnect but was already at CLOSED state");return}return await r.end()}validate(r){return r&&r.isValid()}};EC.exports=pR;EC.exports.ConnectionManager=pR;EC.exports.default=pR});var Bf=A((H9a,wC)=>{"use strict";var Vsr=Object.defineProperty,f5e=Object.getOwnPropertySymbols,$sr=Object.prototype.hasOwnProperty,Ysr=Object.prototype.propertyIsEnumerable,d5e=(t,r,a)=>r in t?Vsr(t,r,{enumerable:!0,configurable:!0,writable:!0,value:a}):t[r]=a,Xsr=(t,r)=>{for(var a in r||(r={}))$sr.call(r,a)&&d5e(t,a,r[a]);if(f5e)for(var a of f5e(r))Ysr.call(r,a)&&d5e(t,a,r[a]);return t},Sh=hr(),Ksr=Cv(),rc=m1(),Jsr=Wv(),Zsr=nA(),eor=(JM(),gf(KM)).v4,{safeStringifyJson:h5e}=On(),fR=class t{constructor(r,a,n){this.uuid=eor(),this.connection=r,this.instance=n.instance,this.model=n.model,this.sequelize=a,this.options=Xsr({plain:!1,raw:!1,logging:console.log},n),this.checkLoggingOption(),n.rawErrors&&(this.formatError=t.prototype.formatError)}static formatBindParameters(r,a,n,i,s){if(!a)return[r,[]];if(s=s||{},typeof i!="function"&&(s=i||{},i=void 0),!i)s.skipValueReplace?i=(u,l,f)=>{if(f[l]!==void 0)return u}:i=(u,l,f,d,h)=>{if(f[l]!==void 0)return Ksr.escape(f[l],d,h)};else if(s.skipValueReplace){let u=i;i=(l,f,d,h,b,m)=>{if(u(l,f,d,h,b,m)!==void 0)return l}}let o=null,c=Array.isArray(a);return r=r.replace(/\B\$(\$|\w+)/g,(u,l)=>{if(l==="$")return s.skipUnescape?u:l;let f;if(c?l.match(/^[1-9]\d*$/)&&(l=l-1,f=i(u,l,a,o,n,s)):l.match(/^\d*$/)||(f=i(u,l,a,o,n,s)),f===void 0)throw new Error(`Named bind parameter "${u}" has no value in the given object.`);return f}),[r,[]]}formatError(r,a){return r.stack=a,r}run(){throw new Error("The run method wasn't overwritten!")}checkLoggingOption(){this.options.logging===!0&&(Zsr.noTrueLogging(),this.options.logging=console.log)}getInsertIdField(){return"insertId"}getUniqueConstraintErrorMessage(r){let a=r?`${r} must be unique`:"Must be unique";if(r&&this.model)for(let n of Object.keys(this.model.uniqueKeys))this.model.uniqueKeys[n].fields.includes(r.replace(/"/g,""))&&this.model.uniqueKeys[n].msg&&(a=this.model.uniqueKeys[n].msg);return a}isRawQuery(){return this.options.type===rc.RAW}isVersionQuery(){return this.options.type===rc.VERSION}isUpsertQuery(){return this.options.type===rc.UPSERT}isInsertQuery(r,a){let n=!0;return this.options.type===rc.INSERT?!0:(n=n&&this.sql.toLowerCase().startsWith("insert into"),n=n&&(!r||Object.prototype.hasOwnProperty.call(r,this.getInsertIdField())),n=n&&(!a||Object.prototype.hasOwnProperty.call(a,this.getInsertIdField())),n)}handleInsertQuery(r,a){if(this.instance){let n=this.model.autoIncrementAttribute,i=null;i=i||r&&r[this.getInsertIdField()],i=i||a&&a[this.getInsertIdField()],this.instance[n]=i}}isShowTablesQuery(){return this.options.type===rc.SHOWTABLES}handleShowTablesQuery(r){return Sh.flatten(r.map(a=>Object.values(a)))}isShowIndexesQuery(){return this.options.type===rc.SHOWINDEXES}isShowConstraintsQuery(){return this.options.type===rc.SHOWCONSTRAINTS}isDescribeQuery(){return this.options.type===rc.DESCRIBE}isSelectQuery(){return this.options.type===rc.SELECT}isBulkUpdateQuery(){return this.options.type===rc.BULKUPDATE}isBulkDeleteQuery(){return this.options.type===rc.BULKDELETE}isForeignKeysQuery(){return this.options.type===rc.FOREIGNKEYS}isUpdateQuery(){return this.options.type===rc.UPDATE}handleSelectQuery(r){let a=null;if(this.options.fieldMap){let n=this.options.fieldMap;r=r.map(i=>Sh.reduce(n,(s,o,c)=>(s[c]!==void 0&&o!==c&&(s[o]=s[c],delete s[c]),s),i))}return this.options.raw?a=r.map(n=>{let i={};for(let s in n)Object.prototype.hasOwnProperty.call(n,s)&&(i[s]=n[s]);return this.options.nest&&(i=Jsr.transform(i)),i}):this.options.hasJoin===!0?(r=t._groupJoinData(r,{model:this.model,includeMap:this.options.includeMap,includeNames:this.options.includeNames},{checkExisting:this.options.hasMultiAssociation}),a=this.model.bulkBuild(r,{isNewRecord:!1,include:this.options.include,includeNames:this.options.includeNames,includeMap:this.options.includeMap,includeValidated:!0,attributes:this.options.originalAttributes||this.options.attributes,raw:!0})):a=this.model.bulkBuild(r,{isNewRecord:!1,raw:!0,attributes:this.options.originalAttributes||this.options.attributes}),this.options.plain&&(a=a.length===0?null:a[0]),a}isShowOrDescribeQuery(){let r=!1;return r=r||this.sql.toLowerCase().startsWith("show"),r=r||this.sql.toLowerCase().startsWith("describe"),r}isCallQuery(){return this.sql.toLowerCase().startsWith("call")}_logQuery(r,a,n){let{connection:i,options:s}=this,o=this.sequelize.options.benchmark||s.benchmark,c=this.sequelize.options.logQueryParameters||s.logQueryParameters,u=Date.now(),l="";if(c&&n){let h=r.endsWith(";")?"":";",b;Array.isArray(n)?b=n.map(m=>h5e(m)).join(", "):b=h5e(n),l=`${h} ${b}`}let f=`(${i.uuid||"default"}): ${r}${l}`,d=`Executing ${f}`;return a(d),o||this.sequelize.log(`Executing ${f}`,s),()=>{let h=`Executed ${f}`;a(h),o&&this.sequelize.log(h,Date.now()-u,s)}}static _groupJoinData(r,a,n){if(!r.length)return[];let i,s,o,c,u,l,f=r.length,d,h,b,m,g,O,z,w,v=n.checkExisting,T,x,L,P=v?[]:new Array(f),C={},Q={},X,k,se,F,D,j,V,he,oe=ne=>{Object.prototype.hasOwnProperty.call(j.includeMap,ne)&&(Q[h]=j=j.includeMap[ne],he?he=`${he}.${ne}`:he=ne,Q[he]=j)},ie={},De=(ne,we)=>(Object.prototype.hasOwnProperty.call(we,ne)||(we[ne]=ne.substr(0,ne.lastIndexOf("."))),we[ne]),Ge={},Ze=ne=>{if(!Object.prototype.hasOwnProperty.call(Ge,ne)){let we=ne.lastIndexOf(".");Ge[ne]=ne.substr(we===-1?0:we+1)}return Ge[ne]},te={},me=ne=>{if(!Object.prototype.hasOwnProperty.call(te,ne)){let we=De(ne,ie);Object.prototype.hasOwnProperty.call(te,we)||(te[we]=we?we.split("."):[]),te[ne]=te[we]}return te[ne]},ve={},ye=ne=>{if(!Object.prototype.hasOwnProperty.call(ve,ne)){let we=me(ne),ke=we.length;ve[ne]=ke?we[ke-1]:""}return ve[ne]},Qe=ne=>{let we=Sh.chain(ne.uniqueKeys);return we=we.result(`${we.findKey()}.fields`).map(ke=>Sh.findKey(ne.attributes,je=>je.field===ke)).value(),we},Ke=ne=>ne instanceof Buffer?ne.toString("hex"):ne,Se,ft,qe;for(u=0;u<f;u++){if(l=r[u],u===0&&(d=Sh.sortBy(Object.keys(l),ne=>[ne.split(".").length]),m=d.length),v){if(w=!1,c=a.model.primaryKeyAttributes.length,L="",c===1)L=Ke(l[a.model.primaryKeyAttributes[0]]);else if(c>1)for(o=0;o<c;o++)L+=Ke(l[a.model.primaryKeyAttributes[o]]);else if(!Sh.isEmpty(a.model.uniqueKeys))for(ft=Qe(a.model),o=0;o<ft.length;o++)L+=l[ft[o]]}for(z=O={},F=void 0,b=0;b<m;b++){if(h=d[b],k=De(h,ie),X=me(h),u===0&&!Object.prototype.hasOwnProperty.call(Q,h)&&(X.length?(j=a,he=void 0,X.forEach(oe)):Q[h]=Q[""]=a),F!==void 0&&F!==X){if(v){if(s=F.length,V=null,x=null,s)for(i=0;i<s;i++){if(qe=V?`${V}.${F[i]}`:F[i],Se=Q[qe].model.primaryKeyAttributes,c=Se.length,T=qe,c===1)T+=Ke(l[`${qe}.${Se[0]}`]);else if(c>1)for(o=0;o<c;o++)T+=Ke(l[`${qe}.${Se[o]}`]);else if(!Sh.isEmpty(Q[qe].model.uniqueKeys))for(ft=Qe(Q[qe].model),o=0;o<ft.length;o++)T+=l[`${qe}.${ft[o]}`];x||(x=L),T=x+T,V=qe,i<s-1&&(x=T)}else T=L;T===L?C[T]?w=!0:C[T]=O:C[T]||(V=C[x],D=ye(g),Q[g].association.isSingleAssociation?V&&(V[D]=C[T]=O):(V[D]||(V[D]=[]),V[D].push(C[T]=O))),O={}}else if(j=z,s=X.length,s)for(i=0;i<s;i++)i===s-1&&(O=j[X[i]]={}),j=j[X[i]]||{}}O[Ze(h)]=l[h],g=h,F=X,se=k}if(v){if(s=F.length,V=null,x=null,s)for(i=0;i<s;i++){if(qe=V?`${V}.${F[i]}`:F[i],Se=Q[qe].model.primaryKeyAttributes,c=Se.length,T=qe,c===1)T+=Ke(l[`${qe}.${Se[0]}`]);else if(c>0)for(o=0;o<c;o++)T+=Ke(l[`${qe}.${Se[o]}`]);else if(!Sh.isEmpty(Q[qe].model.uniqueKeys))for(ft=Qe(Q[qe].model),o=0;o<ft.length;o++)T+=l[`${qe}.${ft[o]}`];x||(x=L),T=x+T,V=qe,i<s-1&&(x=T)}else T=L;T===L?C[T]?w=!0:C[T]=O:C[T]||(V=C[x],D=ye(g),Q[g].association.isSingleAssociation?V&&(V[D]=C[T]=O):(V[D]||(V[D]=[]),V[D].push(C[T]=O))),w||P.push(z)}else P[u]=z}return P}};wC.exports=fR;wC.exports.AbstractQuery=fR;wC.exports.default=fR});var y5e=A((V9a,O5e)=>{"use strict";var tor=Object.defineProperty,b5e=Object.getOwnPropertySymbols,ror=Object.prototype.hasOwnProperty,aor=Object.prototype.propertyIsEnumerable,m5e=(t,r,a)=>r in t?tor(t,r,{enumerable:!0,configurable:!0,writable:!0,value:a}):t[r]=a,nor=(t,r)=>{for(var a in r||(r={}))ror.call(r,a)&&m5e(t,a,r[a]);if(b5e)for(var a of b5e(r))aor.call(r,a)&&m5e(t,a,r[a]);return t},_5e=Bf(),vC=cn(),g5e=hr(),fJ=Ja(),{logger:ior}=Ti(),sor=1062,oor=1213,M5e=1451,cor=1452,A5e=ior.debugContext("sql:mariadb"),dJ=class extends _5e{constructor(r,a,n){super(r,a,nor({showWarnings:!1},n))}static formatBindParameters(r,a,n){let i=[],s=(o,c,u)=>{if(u[c]!==void 0)return i.push(u[c]),"?"};return r=_5e.formatBindParameters(r,a,n,s)[0],[r,i.length>0?i:void 0]}async run(r,a){this.sql=r;let{connection:n,options:i}=this,s=this.sequelize.options.showWarnings||i.showWarnings,o=this._logQuery(r,A5e,a);a&&A5e("parameters(%j)",a);let c,u=new Error;try{c=await n.query(this.sql,a)}catch(l){if(i.transaction&&l.errno===oor){try{await i.transaction.rollback()}catch{}i.transaction.finished="rollback"}throw l.sql=r,l.parameters=a,this.formatError(l,u.stack)}finally{o()}return s&&c&&c.warningStatus>0&&await this.logWarnings(c),this.formatResults(c)}formatResults(r){let a=this.instance;if(this.isBulkUpdateQuery()||this.isBulkDeleteQuery())return r.affectedRows;if(this.isUpsertQuery())return[a,r.affectedRows===1];if(this.isInsertQuery(r)&&(this.handleInsertQuery(r),!this.instance)){if(this.model&&this.model.autoIncrementAttribute&&this.model.autoIncrementAttribute===this.model.primaryKeyAttribute&&this.model.rawAttributes[this.model.primaryKeyAttribute]){let n=r[this.getInsertIdField()];a=new Array(r.affectedRows);let i=this.model.rawAttributes[this.model.primaryKeyAttribute].field;for(let s=0;s<r.affectedRows;s++)a[s]={[i]:n+s};return[a,r.affectedRows]}return[r[this.getInsertIdField()],r.affectedRows]}if(this.isSelectQuery())return this.handleJsonSelectQuery(r),this.handleSelectQuery(r);if(this.isInsertQuery()||this.isUpdateQuery())return[a,r.affectedRows];if(this.isCallQuery())return r[0];if(this.isRawQuery()){let n=r.meta;return delete r.meta,[r,n]}if(this.isShowIndexesQuery())return this.handleShowIndexesQuery(r);if(this.isForeignKeysQuery()||this.isShowConstraintsQuery())return r;if(this.isShowTablesQuery())return this.handleShowTablesQuery(r);if(this.isDescribeQuery()){a={};for(let n of r)a[n.Field]={type:n.Type.toLowerCase().startsWith("enum")?n.Type.replace(/^enum/i,"ENUM"):n.Type.toUpperCase(),allowNull:n.Null==="YES",defaultValue:n.Default,primaryKey:n.Key==="PRI",autoIncrement:Object.prototype.hasOwnProperty.call(n,"Extra")&&n.Extra.toLowerCase()==="auto_increment",comment:n.Comment?n.Comment:null};return a}return this.isVersionQuery()?r[0].version:a}handleJsonSelectQuery(r){if(!(!this.model||!this.model.fieldRawAttributesMap))for(let a of Object.keys(this.model.fieldRawAttributesMap)){let n=this.model.fieldRawAttributesMap[a];n.type instanceof fJ.JSON&&(r=r.map(i=>(i[n.fieldName]&&typeof i[n.fieldName]=="string"&&!this.connection.info.hasMinVersion(10,5,2)&&(i[n.fieldName]=JSON.parse(i[n.fieldName])),fJ.JSON.parse?fJ.JSON.parse(n,this.sequelize.options,i[n.fieldName]):i)))}}async logWarnings(r){let a=await this.run("SHOW WARNINGS"),n=`MariaDB Warnings (${this.connection.uuid||"default"}): `,i=[];for(let s of a)if(!(s===void 0||typeof s[Symbol.iterator]!="function"))for(let o of s)if(Object.prototype.hasOwnProperty.call(o,"Message"))i.push(o.Message);else for(let c of o.keys())i.push([c,o[c]].join(": "));return this.sequelize.log(n+i.join("; "),this.options),r}formatError(r,a){switch(r.errno){case sor:{let n=r.message.match(/Duplicate entry '([\s\S]*)' for key '?((.|\s)*?)'?\s.*$/),i={},s="Validation error",o=n?n[1].split("-"):void 0,c=n?n[2]:void 0,u=n?n[1]:void 0,l=this.model&&this.model.uniqueKeys[c];l?(l.msg&&(s=l.msg),i=g5e.zipObject(l.fields,o)):i[c]=u;let f=[];return g5e.forOwn(i,(d,h)=>{f.push(new vC.ValidationErrorItem(this.getUniqueConstraintErrorMessage(h),"unique violation",h,d,this.instance,"not_unique"))}),new vC.UniqueConstraintError({message:s,errors:f,parent:r,fields:i,stack:a})}case M5e:case cor:{let n=r.message.match(/CONSTRAINT ([`"])(.*)\1 FOREIGN KEY \(\1(.*)\1\) REFERENCES \1(.*)\1 \(\1(.*)\1\)/),i=n?n[1]:"`",s=n?n[3].split(new RegExp(`${i}, *${i}`)):void 0;return new vC.ForeignKeyConstraintError({reltype:r.errno===M5e?"parent":"child",table:n?n[4]:void 0,fields:s,value:s&&s.length&&this.instance&&this.instance[s[0]]||void 0,index:n?n[2]:void 0,parent:r,stack:a})}default:return new vC.DatabaseError(r,{stack:a})}}handleShowTablesQuery(r){return r.map(a=>({tableName:a.TABLE_NAME,schema:a.TABLE_SCHEMA}))}handleShowIndexesQuery(r){let a,n=[];return r.forEach(i=>{(!a||a.name!==i.Key_name)&&(a={primary:i.Key_name==="PRIMARY",fields:[],name:i.Key_name,tableName:i.Table,unique:i.Non_unique!==1,type:i.Index_type},n.push(a)),a.fields[i.Seq_in_index-1]={attribute:i.Column_name,length:i.Sub_part||void 0,order:i.Collation==="A"?"ASC":void 0}}),n}};O5e.exports=dJ});var v5e=A(($9a,w5e)=>{"use strict";var uor=Object.defineProperty,z5e=Object.getOwnPropertySymbols,lor=Object.prototype.hasOwnProperty,por=Object.prototype.propertyIsEnumerable,E5e=(t,r,a)=>r in t?uor(t,r,{enumerable:!0,configurable:!0,writable:!0,value:a}):t[r]=a,dor=(t,r)=>{for(var a in r||(r={}))lor.call(r,a)&&E5e(t,a,r[a]);if(z5e)for(var a of z5e(r))por.call(r,a)&&E5e(t,a,r[a]);return t},RC=hr(),sa=Ws(),hor=On(),bor={OperatorMap:{[sa.eq]:"=",[sa.ne]:"!=",[sa.gte]:">=",[sa.gt]:">",[sa.lte]:"<=",[sa.lt]:"<",[sa.not]:"IS NOT",[sa.is]:"IS",[sa.in]:"IN",[sa.notIn]:"NOT IN",[sa.like]:"LIKE",[sa.notLike]:"NOT LIKE",[sa.iLike]:"ILIKE",[sa.notILike]:"NOT ILIKE",[sa.startsWith]:"LIKE",[sa.endsWith]:"LIKE",[sa.substring]:"LIKE",[sa.regexp]:"~",[sa.notRegexp]:"!~",[sa.iRegexp]:"~*",[sa.notIRegexp]:"!~*",[sa.between]:"BETWEEN",[sa.notBetween]:"NOT BETWEEN",[sa.overlap]:"&&",[sa.contains]:"@>",[sa.contained]:"<@",[sa.adjacent]:"-|-",[sa.strictLeft]:"<<",[sa.strictRight]:">>",[sa.noExtendRight]:"&<",[sa.noExtendLeft]:"&>",[sa.any]:"ANY",[sa.all]:"ALL",[sa.and]:" AND ",[sa.or]:" OR ",[sa.col]:"COL",[sa.placeholder]:"$$PLACEHOLDER$$",[sa.match]:"@@"},OperatorsAliasMap:{},setOperatorsAliases(t){!t||RC.isEmpty(t)?this.OperatorsAliasMap=!1:this.OperatorsAliasMap=dor({},t)},_replaceAliases(t){let r={};return this.OperatorsAliasMap?(hor.getOperators(t).forEach(a=>{let n=t[a];RC.isPlainObject(n)?r[a]=this._replaceAliases(n):r[a]=n}),RC.forOwn(t,(a,n)=>{n=this.OperatorsAliasMap[n]||n,RC.isPlainObject(a)&&(a=this._replaceAliases(a)),r[n]=a}),r):t}};w5e.exports=bor});var T5e=A((Y9a,R5e)=>{"use strict";var mor=(JM(),gf(KM)).v4,_or={setIsolationLevelQuery(t,r){if(!r.parent)return`SET TRANSACTION ISOLATION LEVEL ${t};`},generateTransactionId(){return mor()},startTransactionQuery(t){return t.parent?`SAVEPOINT ${this.quoteIdentifier(t.name,!0)};`:"START TRANSACTION;"},deferConstraintsQuery(){},setConstraintQuery(){},setDeferredQuery(){},setImmediateQuery(){},commitTransactionQuery(t){if(!t.parent)return"COMMIT;"},rollbackTransactionQuery(t){return t.parent?`ROLLBACK TO SAVEPOINT ${this.quoteIdentifier(t.name,!0)};`:"ROLLBACK;"}};R5e.exports=_or});var xh=A((K9a,x5e)=>{"use strict";var gor=Object.defineProperty,Mor=Object.defineProperties,Aor=Object.getOwnPropertyDescriptors,q5e=Object.getOwnPropertySymbols,Oor=Object.prototype.hasOwnProperty,yor=Object.prototype.propertyIsEnumerable,N5e=(t,r,a)=>r in t?gor(t,r,{enumerable:!0,configurable:!0,writable:!0,value:a}):t[r]=a,A2=(t,r)=>{for(var a in r||(r={}))Oor.call(r,a)&&N5e(t,a,r[a]);if(q5e)for(var a of q5e(r))yor.call(r,a)&&N5e(t,a,r[a]);return t},TC=(t,r)=>Mor(t,Aor(r)),qC=require("util"),ra=hr(),zor=(JM(),gf(KM)).v4,Qt=On(),X9a=nA(),I5e=Cv(),lA=Ja(),Uu=vK(),pA=vh(),hJ=Rh(),Eor=tA(),wor=h2(),Rt=Ws(),bJ=cn(),S5e=LK(),dR=class{constructor(r){if(!r.sequelize)throw new Error("QueryGenerator initialized without options.sequelize");if(!r._dialect)throw new Error("QueryGenerator initialized without options._dialect");this.sequelize=r.sequelize,this.options=r.sequelize.options,this.dialect=r._dialect.name,this._dialect=r._dialect,this._initQuoteIdentifier()}extractTableDetails(r,a){return a=a||{},r=r||{},{schema:r.schema||a.schema||this.options.schema||"public",tableName:ra.isPlainObject(r)?r.tableName:r,delimiter:r.delimiter||a.delimiter||"."}}addSchema(r){if(!r._schema)return r.tableName||r;let a=this;return{tableName:r.tableName||r,table:r.tableName||r,name:r.name||r,schema:r._schema,delimiter:r._schemaDelimiter||".",toString(){return a.quoteTable(this)}}}dropSchema(r,a){return this.dropTableQuery(r,a)}describeTableQuery(r,a,n){return`DESCRIBE ${this.quoteTable(this.addSchema({tableName:r,_schema:a,_schemaDelimiter:n}))};`}dropTableQuery(r){return`DROP TABLE IF EXISTS ${this.quoteTable(r)};`}renameTableQuery(r,a){return`ALTER TABLE ${this.quoteTable(r)} RENAME TO ${this.quoteTable(a)};`}populateInsertQueryReturnIntoBinds(){}insertQuery(r,a,n,i){i=i||{},ra.defaults(i,this.options);let s={},o=i.bind||[],c=[],u=[],l=[],f=[],d=this.quoteTable(r),h=i.bindParam===void 0?this.bindParam(o):i.bindParam,b=[],m,g="",O="",z="",w="",v=!1,T="";if(n&&ra.each(n,(C,Q)=>{s[Q]=C,C.field&&(s[C.field]=C)}),this._dialect.supports["DEFAULT VALUES"]?O+=" DEFAULT VALUES":this._dialect.supports["VALUES ()"]&&(O+=" VALUES ()"),(this._dialect.supports.returnValues||this._dialect.supports.returnIntoValues)&&i.returning){let C=this.generateReturnValues(n,i);u.push(...C.returnFields),this._dialect.supports.returnIntoValues&&l.push(...C.returnTypes),w=C.returningFragment,T=C.tmpTable||"",z=C.outputFragment||""}(ra.get(this,["sequelize","options","dialectOptions","prependSearchPath"])||i.searchPath)&&(i.bindParam=!1),this._dialect.supports.EXCEPTION&&i.exception&&(i.bindParam=!1),a=Qt.removeNullValuesFromHash(a,this.options.omitNull);for(let C in a)if(Object.prototype.hasOwnProperty.call(a,C)){let Q=a[C];c.push(this.quoteIdentifier(C)),s&&s[C]&&s[C].autoIncrement===!0&&Q==null?this._dialect.supports.autoIncrement.defaultValue?this._dialect.supports.DEFAULT?f.push("DEFAULT"):f.push(this.escape(null)):c.splice(-1,1):(s&&s[C]&&s[C].autoIncrement===!0&&(v=!0),Q instanceof Qt.SequelizeMethod||i.bindParam===!1?f.push(this.escape(Q,s&&s[C]||void 0,{context:"INSERT"})):f.push(this.format(Q,s&&s[C]||void 0,{context:"INSERT"},h)))}let x="";if(!ra.isEmpty(i.conflictWhere)&&!this._dialect.supports.inserts.onConflictWhere)throw new Error("missing dialect support for conflictWhere option");if(this._dialect.supports.inserts.updateOnDuplicate&&i.updateOnDuplicate)if(this._dialect.supports.inserts.updateOnDuplicate==" ON CONFLICT DO UPDATE SET"){let C=i.upsertKeys.map(k=>this.quoteIdentifier(k)),Q=i.updateOnDuplicate.map(k=>`${this.quoteIdentifier(k)}=EXCLUDED.${this.quoteIdentifier(k)}`),X=["ON CONFLICT","(",C.join(","),")"];ra.isEmpty(i.conflictWhere)||X.push(this.whereQuery(i.conflictWhere,i)),ra.isEmpty(Q)?X.push("DO NOTHING"):X.push("DO UPDATE SET",Q.join(",")),x=` ${Qt.joinSQLFragments(X)}`}else{let C=i.updateOnDuplicate.map(Q=>`${this.quoteIdentifier(Q)}=VALUES(${this.quoteIdentifier(Q)})`);if(ra.isEmpty(C)&&i.upsertKeys&&C.push(...i.upsertKeys.map(Q=>`${this.quoteIdentifier(Q)}=${this.quoteIdentifier(Q)}`)),ra.isEmpty(C))throw new Error("No update values found for ON DUPLICATE KEY UPDATE clause, and no identifier fields could be found to use instead.");x+=`${this._dialect.supports.inserts.updateOnDuplicate} ${C.join(",")}`}let L={ignoreDuplicates:i.ignoreDuplicates?this._dialect.supports.inserts.ignoreDuplicates:"",onConflictDoNothing:i.ignoreDuplicates?this._dialect.supports.inserts.onConflictDoNothing:"",attributes:c.join(","),output:z,values:f.join(","),tmpTable:T};if(g=`${T}INSERT${L.ignoreDuplicates} INTO ${d} (${L.attributes})${L.output} VALUES (${L.values})${x}${L.onConflictDoNothing}${g}`,O=`${T}INSERT${L.ignoreDuplicates} INTO ${d}${L.output}${x}${L.onConflictDoNothing}${O}`,this._dialect.supports.EXCEPTION&&i.exception){let C="DROP FUNCTION IF EXISTS pg_temp.testfunc()";u.length===0&&u.push("*");let Q=`$func_${zor().replace(/-/g,"")}$`,X=`SELECT (testfunc.response).${u.join(", (testfunc.response).")}, testfunc.sequelize_caught_exception FROM pg_temp.testfunc();`;i.exception="WHEN unique_violation THEN GET STACKED DIAGNOSTICS sequelize_caught_exception = PG_EXCEPTION_DETAIL;",g=`CREATE OR REPLACE FUNCTION pg_temp.testfunc(OUT response ${d}, OUT sequelize_caught_exception text) RETURNS RECORD AS ${Q} BEGIN ${g} RETURNING * INTO response; EXCEPTION ${i.exception} END ${Q} LANGUAGE plpgsql; ${X} ${C}`}else g+=w,O+=w;this._dialect.supports.returnIntoValues&&i.returning&&this.populateInsertQueryReturnIntoBinds(u,l,o.length,b,i),m=`${L.attributes.length?g:O}${b.join(",")};`,this._dialect.supports.finalTable&&(m=`SELECT * FROM FINAL TABLE(${L.attributes.length?g:O});`),v&&this._dialect.supports.autoIncrement.identityInsert&&(m=`SET IDENTITY_INSERT ${d} ON; ${m} SET IDENTITY_INSERT ${d} OFF;`);let P={query:m};return i.bindParam!==!1&&(P.bind=o),P}bulkInsertQuery(r,a,n,i){n=n||{},i=i||{};let s=[],o={},c=[],u="";for(let b of a)ra.forOwn(b,(m,g)=>{c.includes(g)||c.push(g),i[g]&&i[g].autoIncrement===!0&&(o[g]=!0)});for(let b of a){let m=c.map(g=>this._dialect.supports.bulkDefault&&o[g]===!0?b[g]!=null?b[g]:"DEFAULT":this.escape(b[g],i[g],{context:"INSERT"}));s.push(`(${m.join(",")})`)}if(this._dialect.supports.inserts.updateOnDuplicate&&n.updateOnDuplicate)if(this._dialect.supports.inserts.updateOnDuplicate==" ON CONFLICT DO UPDATE SET"){let b=n.upsertKeys.map(O=>this.quoteIdentifier(O)),m=n.updateOnDuplicate.map(O=>`${this.quoteIdentifier(O)}=EXCLUDED.${this.quoteIdentifier(O)}`),g=!1;if(n.conflictWhere){if(!this._dialect.supports.inserts.onConflictWhere)throw new Error(`conflictWhere not supported for dialect ${this._dialect.name}`);g=this.whereQuery(n.conflictWhere,n)}u=["ON CONFLICT","(",b.join(","),")",g,"DO UPDATE SET",m.join(",")]}else{if(n.conflictWhere)throw new Error(`conflictWhere not supported for dialect ${this._dialect.name}`);let b=n.updateOnDuplicate.map(m=>`${this.quoteIdentifier(m)}=VALUES(${this.quoteIdentifier(m)})`);u=`${this._dialect.supports.inserts.updateOnDuplicate} ${b.join(",")}`}let l=n.ignoreDuplicates?this._dialect.supports.inserts.ignoreDuplicates:"",f=c.map(b=>this.quoteIdentifier(b)).join(","),d=n.ignoreDuplicates?this._dialect.supports.inserts.onConflictDoNothing:"",h="";if(this._dialect.supports.returnValues&&n.returning){let b=this.generateReturnValues(i,n);h+=b.returningFragment}return Qt.joinSQLFragments(["INSERT",l,"INTO",this.quoteTable(r),`(${f})`,"VALUES",s.join(","),u,d,h,";"])}updateQuery(r,a,n,i,s){i=i||{},ra.defaults(i,this.options),a=Qt.removeNullValuesFromHash(a,i.omitNull,i);let o=[],c=[],u={},l="",f="",d="";(ra.get(this,["sequelize","options","dialectOptions","prependSearchPath"])||i.searchPath)&&(i.bindParam=!1);let h=i.bindParam===void 0?this.bindParam(c):i.bindParam;if(this._dialect.supports["LIMIT ON UPDATE"]&&i.limit&&(["mssql","db2","oracle"].includes(this.dialect)?this.dialect==="oracle"&&(n&&(n.length&&n.length>0||Object.keys(n).length>0)?d+=" AND ":d+=" WHERE ",d+=`rownum <= ${this.escape(i.limit)} `):d=` LIMIT ${this.escape(i.limit)} `),this._dialect.supports.returnValues&&i.returning){let O=this.generateReturnValues(s,i);d+=O.returningFragment,f=O.tmpTable||"",l=O.outputFragment||"",!this._dialect.supports.returnValues.output&&i.returning&&(i.mapToModel=!0)}s&&ra.each(s,(O,z)=>{u[z]=O,O.field&&(u[O.field]=O)});for(let O in a){if(u&&u[O]&&u[O].autoIncrement===!0&&!this._dialect.supports.autoIncrement.update)continue;let z=a[O];z instanceof Qt.SequelizeMethod||i.bindParam===!1?o.push(`${this.quoteIdentifier(O)}=${this.escape(z,u&&u[O]||void 0,{context:"UPDATE"})}`):o.push(`${this.quoteIdentifier(O)}=${this.format(z,u&&u[O]||void 0,{context:"UPDATE"},h)}`)}let b=TC(A2({},i),{bindParam:h});if(o.length===0)return"";let g={query:`${f}UPDATE ${this.quoteTable(r)} SET ${o.join(",")}${l} ${this.whereQuery(n,b)}${d}`.trim()};return i.bindParam!==!1&&(g.bind=c),g}arithmeticQuery(r,a,n,i,s,o){o=o||{},ra.defaults(o,{returning:!0}),s=Qt.removeNullValuesFromHash(s,this.options.omitNull);let c="",u="";if(this._dialect.supports.returnValues&&o.returning){let f=this.generateReturnValues(null,o);c=f.outputFragment,u=f.returningFragment}let l=[];for(let f in i){let d=i[f],h=this.quoteIdentifier(f),b=this.escape(d);l.push(`${h}=${h}${r} ${b}`)}for(let f in s){let d=s[f],h=this.quoteIdentifier(f),b=this.escape(d);l.push(`${h}=${b}`)}return Qt.joinSQLFragments(["UPDATE",this.quoteTable(a),"SET",l.join(","),c,this.whereQuery(n),u])}addIndexQuery(r,a,n,i){n=n||{},Array.isArray(a)?n.fields=a:(n=a,a=void 0),n.prefix=n.prefix||i||r,n.prefix&&typeof n.prefix=="string"&&(n.prefix=n.prefix.replace(/\./g,"_"),n.prefix=n.prefix.replace(/("|')/g,""));let s=n.fields.map(u=>{if(u instanceof Qt.SequelizeMethod)return this.handleSequelizeMethod(u);typeof u=="string"&&(u={name:u});let l="";if(u.attribute&&(u.name=u.attribute),!u.name)throw new Error(`The following index field has no name: ${qC.inspect(u)}`);if(l+=this.quoteIdentifier(u.name),this._dialect.supports.index.collate&&u.collate&&(l+=` COLLATE ${this.quoteIdentifier(u.collate)}`),this._dialect.supports.index.operator){let f=u.operator||n.operator;f&&(l+=` ${f}`)}return this._dialect.supports.index.length&&u.length&&(l+=`(${u.length})`),u.order&&(l+=` ${u.order}`),l});n.name||(n=Qt.nameIndex(n,n.prefix)),n=Uu._conformIndex(n),this._dialect.supports.index.type||delete n.type,n.where&&(n.where=this.whereQuery(n.where)),typeof r=="string"?r=this.quoteIdentifiers(r):r=this.quoteTable(r);let o=this._dialect.supports.index.concurrently&&n.concurrently?"CONCURRENTLY":void 0,c;return this._dialect.supports.indexViaAlter?c=["ALTER TABLE",r,o,"ADD"]:c=["CREATE"],c=c.concat(n.unique?"UNIQUE":"",n.type,"INDEX",this._dialect.supports.indexViaAlter?void 0:o,this.quoteIdentifiers(n.name),this._dialect.supports.index.using===1&&n.using?`USING ${n.using}`:"",this._dialect.supports.indexViaAlter?void 0:`ON ${r}`,this._dialect.supports.index.using===2&&n.using?`USING ${n.using}`:"",`(${s.join(", ")})`,this._dialect.supports.index.parser&&n.parser?`WITH PARSER ${n.parser}`:void 0,this._dialect.supports.index.where&&n.where?n.where:void 0),ra.compact(c).join(" ")}addConstraintQuery(r,a){return typeof r=="string"?r=this.quoteIdentifiers(r):r=this.quoteTable(r),Qt.joinSQLFragments(["ALTER TABLE",r,"ADD",this.getConstraintSnippet(r,a||{}),";"])}getConstraintSnippet(r,a){let n,i,s=a.fields.map(u=>{if(typeof u=="string")return this.quoteIdentifier(u);if(u instanceof Qt.SequelizeMethod)return this.handleSequelizeMethod(u);if(u.attribute&&(u.name=u.attribute),!u.name)throw new Error(`The following index field has no name: ${u}`);return this.quoteIdentifier(u.name)}),o=s.join(", "),c=s.join("_");switch(a.type.toUpperCase()){case"UNIQUE":i=this.quoteIdentifier(a.name||`${r}_${c}_uk`),n=`CONSTRAINT ${i} UNIQUE (${o})`;break;case"CHECK":a.where=this.whereItemsQuery(a.where),i=this.quoteIdentifier(a.name||`${r}_${c}_ck`),n=`CONSTRAINT ${i} CHECK (${a.where})`;break;case"DEFAULT":if(a.defaultValue===void 0)throw new Error("Default value must be specified for DEFAULT CONSTRAINT");if(this._dialect.name!=="mssql")throw new Error("Default constraints are supported only for MSSQL dialect.");i=this.quoteIdentifier(a.name||`${r}_${c}_df`),n=`CONSTRAINT ${i} DEFAULT (${this.escape(a.defaultValue)}) FOR ${s[0]}`;break;case"PRIMARY KEY":i=this.quoteIdentifier(a.name||`${r}_${c}_pk`),n=`CONSTRAINT ${i} PRIMARY KEY (${o})`;break;case"FOREIGN KEY":let u=a.references;if(!u||!u.table||!(u.field||u.fields))throw new Error("references object with table and field must be specified");i=this.quoteIdentifier(a.name||`${r}_${c}_${u.table}_fk`);let l=typeof u.field<"u"?this.quoteIdentifier(u.field):u.fields.map(d=>this.quoteIdentifier(d)).join(", "),f=`${this.quoteTable(u.table)} (${l})`;n=`CONSTRAINT ${i} `,n+=`FOREIGN KEY (${o}) REFERENCES ${f}`,a.onUpdate&&(n+=` ON UPDATE ${a.onUpdate.toUpperCase()}`),a.onDelete&&(n+=` ON DELETE ${a.onDelete.toUpperCase()}`);break;default:throw new Error(`${a.type} is invalid.`)}return a.deferrable&&["UNIQUE","PRIMARY KEY","FOREIGN KEY"].includes(a.type.toUpperCase())&&(n+=` ${this.deferConstraintsQuery(a)}`),n}removeConstraintQuery(r,a){return typeof r=="string"?r=this.quoteIdentifiers(r):r=this.quoteTable(r),Qt.joinSQLFragments(["ALTER TABLE",r,"DROP CONSTRAINT",this.quoteIdentifiers(a)])}quote(r,a,n){let i=["ASC","DESC","ASC NULLS LAST","DESC NULLS LAST","ASC NULLS FIRST","DESC NULLS FIRST","NULLS FIRST","NULLS LAST"];if(n=n||".",typeof r=="string")return this.quoteIdentifiers(r);if(Array.isArray(r)){r.forEach((f,d)=>{let h=r[d-1],b,m;if(!h&&a!==void 0?m=a:h&&h instanceof pA&&(b=h,m=h.target),m&&m.prototype instanceof Uu){let g,O;if(typeof f=="function"&&f.prototype instanceof Uu?g=f:ra.isPlainObject(f)&&f.model&&f.model.prototype instanceof Uu&&(g=f.model,O=f.as),g&&(!O&&b&&b instanceof pA&&b.through&&b.through.model===g?f=new pA(m,g,{as:g.name}):(f=m.getAssociationForAlias(g,O),f||(f=m.getAssociationForAlias(g,g.name))),!(f instanceof pA)))throw new Error(qC.format("Unable to find a valid association for model, '%s'",g.name))}if(typeof f=="string"){let g=i.indexOf(f.toUpperCase());if(d>0&&g!==-1)f=this.sequelize.literal(` ${i[g]}`);else if(m&&m.prototype instanceof Uu){if(m.associations!==void 0&&m.associations[f])f=m.associations[f];else if(m.rawAttributes!==void 0&&m.rawAttributes[f]&&f!==m.rawAttributes[f].field)f=m.rawAttributes[f].field;else if(f.includes(".")&&m.rawAttributes!==void 0){let O=f.split(".");if(m.rawAttributes[O[0]].type instanceof lA.JSON){let z=this.quoteIdentifiers(`${m.name}.${m.rawAttributes[O[0]].field}`),w=O.slice(1);f=this.jsonPathExtractionQuery(z,w),f=this.sequelize.literal(f)}}}}r[d]=f},this);let s=r.length,o=[],c,u=0;for(u=0;u<s-1&&(c=r[u],!(typeof c=="string"||c._modelAttribute||c instanceof Qt.SequelizeMethod));u++)c instanceof pA&&(o[u]=c.as);let l="";return u>0?l+=`${this.quoteIdentifier(o.join(n))}.`:typeof r[0]=="string"&&a&&(l+=`${this.quoteIdentifier(a.name)}.`),r.slice(u).forEach(f=>{l+=this.quote(f,a,n)},this),l}if(r._modelAttribute)return`${this.quoteTable(r.Model.name)}.${this.quoteIdentifier(r.fieldName)}`;if(r instanceof Qt.SequelizeMethod)return this.handleSequelizeMethod(r);throw ra.isPlainObject(r)&&r.raw?new Error('The `{raw: "..."}` syntax is no longer supported.  Use `sequelize.literal` instead.'):new Error(`Unknown structure passed to order / group: ${qC.inspect(r)}`)}_initQuoteIdentifier(){this._quoteIdentifier=this.quoteIdentifier,this.quoteIdentifier=function(r,a){return r==="*"?r:this._quoteIdentifier(r,a)}}quoteIdentifier(r,a){throw new Error(`quoteIdentifier for Dialect "${this.dialect}" is not implemented`)}quoteIdentifiers(r){if(r.includes(".")){r=r.split(".");let a=r.slice(0,r.length-1).join("->"),n=r[r.length-1];return`${this.quoteIdentifier(a)}.${this.quoteIdentifier(n)}`}return this.quoteIdentifier(r)}quoteAttribute(r,a){return a&&r in a.rawAttributes?this.quoteIdentifier(r):this.quoteIdentifiers(r)}getAliasToken(){return"AS"}quoteTable(r,a){let n="";return a===!0&&(a=r.as||r.name||r),ra.isObject(r)?this._dialect.supports.schemas?(r.schema&&(n+=`${this.quoteIdentifier(r.schema)}.`),n+=this.quoteIdentifier(r.tableName)):(r.schema&&(n+=r.schema+(r.delimiter||".")),n+=r.tableName,n=this.quoteIdentifier(n)):n=this.quoteIdentifier(r),a&&(n+=` ${this.getAliasToken()} ${this.quoteIdentifier(a)}`),n}escape(r,a,n){if(n=n||{},r!=null){if(r instanceof Qt.SequelizeMethod)return this.handleSequelizeMethod(r);if(a&&a.type&&(a.type instanceof lA.STRING&&["mysql","mariadb"].includes(this.dialect)&&["number","boolean"].includes(typeof r)&&(r=String(Number(r))),this.validate(r,a,n),a.type.stringify)){let i=s=>I5e.escape(s,this.options.timezone,this.dialect);if(r=a.type.stringify(r,{escape:i,field:a,timezone:this.options.timezone,operation:n.operation}),a.type.escape===!1)return r}}return I5e.escape(r,this.options.timezone,this.dialect)}bindParam(r){return a=>(r.push(a),`$${r.length}`)}format(r,a,n,i){if(n=n||{},r!=null){if(r instanceof Qt.SequelizeMethod)throw new Error("Cannot pass SequelizeMethod as a bind parameter - use escape instead");if(a&&a.type&&(this.validate(r,a,n),a.type.bindParam))return a.type.bindParam(r,{escape:ra.identity,field:a,timezone:this.options.timezone,operation:n.operation,bindParam:i})}return i(r)}validate(r,a,n){if(this.typeValidation&&a.type.validate&&r)try{if(n.isList&&Array.isArray(r))for(let i of r)a.type.validate(i,n);else a.type.validate(r,n)}catch(i){throw i instanceof bJ.ValidationError&&i.errors.push(new bJ.ValidationErrorItem(i.message,"Validation error",a.fieldName,r,null,`${a.type.key} validator`)),i}}isIdentifierQuoted(r){return/^\s*(?:([`"'])(?:(?!\1).|\1{2})*\1\.?)+\s*$/i.test(r)}jsonPathExtractionQuery(r,a,n){let i=ra.toPath(a),s,o=this.isIdentifierQuoted(r)?r:this.quoteIdentifier(r);switch(this.dialect){case"mysql":case"mariadb":case"sqlite":return this.dialect==="mysql"&&(i=i.map(u=>/\D/.test(u)?Qt.addTicks(u,'"'):u)),s=this.escape(["$"].concat(i).join(".").replace(/\.(\d+)(?:(?=\.)|$)/g,(u,l)=>`[${l}]`)),this.dialect==="sqlite"?`json_extract(${o},${s})`:`json_unquote(json_extract(${o},${s}))`;case"postgres":let c=n?"#>":"#>>";return s=this.escape(`{${i.join(",")}}`),`(${o}${c}${s})`;default:throw new Error(`Unsupported ${this.dialect} for JSON operations`)}}selectQuery(r,a,n){a=a||{};let i=a.limit,s=[],o=[],c=a.subQuery===void 0?i&&a.hasMultiAssociation:a.subQuery,u={main:a.attributes&&a.attributes.slice(),subQuery:null},l={name:r,quotedName:null,as:null,model:n},f={names:l,options:a,subQuery:c},d=[],h=[],b;if(this.options.minifyAliases&&!a.aliasesMapping&&(a.aliasesMapping=new Map,a.aliasesByTable={},a.includeAliases=new Map),a.tableAs?l.as=this.quoteIdentifier(a.tableAs):!Array.isArray(l.name)&&l.model&&(l.as=this.quoteIdentifier(l.model.name)),l.quotedName=Array.isArray(l.name)?r.map(g=>Array.isArray(g)?this.quoteTable(g[0],g[1]):this.quoteTable(g,!0)).join(", "):this.quoteTable(l.name),c&&u.main)for(let g of l.model.primaryKeyAttributes)u.main.some(O=>g===O||g===O[0]||g===O[1])||u.main.push(l.model.rawAttributes[g].field?[g,l.model.rawAttributes[g].field]:g);if(u.main=this.escapeAttributes(u.main,a,l.as),u.main=u.main||(a.include?[`${l.as}.*`]:["*"]),(c||a.groupedLimit)&&(u.subQuery=u.main,u.main=[`${l.as||l.quotedName}.*`]),a.include)for(let g of a.include){if(g.separate)continue;let O=this.generateInclude(g,{externalAs:l.as,internalAs:l.as},f);h=h.concat(O.subQuery),d=d.concat(O.mainQuery),O.attributes.main.length>0&&(u.main=ra.uniq(u.main.concat(O.attributes.main))),O.attributes.subQuery.length>0&&(u.subQuery=ra.uniq(u.subQuery.concat(O.attributes.subQuery)))}if(c)o.push(this.selectFromTableFragment(a,l.model,u.subQuery,l.quotedName,l.as)),o.push(h.join(""));else{if(a.groupedLimit){l.as||(l.as=l.quotedName);let g=A2({},a.where),O,z,w,v=l.as;if(typeof a.groupedLimit.on=="string"?z=a.groupedLimit.on:a.groupedLimit.on instanceof wor&&(z=a.groupedLimit.on.foreignKeyField),a.groupedLimit.on instanceof Eor){v=a.groupedLimit.on.manyFromSource.as;let P=Uu._validateIncludedElements({include:[{association:a.groupedLimit.on.manyFromSource,duplicating:!1,required:!0,where:A2({[Rt.placeholder]:!0},a.groupedLimit.through&&a.groupedLimit.through.where)}],model:n});a.hasJoin=!0,a.hasMultiAssociation=!0,a.includeMap=Object.assign(P.includeMap,a.includeMap),a.includeNames=P.includeNames.concat(a.includeNames||[]),w=P.include,Array.isArray(a.order)&&(a.order.forEach((C,Q)=>{Array.isArray(C)&&(C=C[0]);let X=`subquery_order_${Q}`;a.attributes.push([C,X]),X=this.sequelize.literal(this.quote(X)),Array.isArray(a.order[Q])?a.order[Q][0]=X:a.order[Q]=X}),O=a.order)}else O=a.order,this._dialect.supports.topLevelOrderByRequired||delete a.order,g[Rt.placeholder]=!0;let T=`SELECT * FROM (${this.selectQuery(r,{attributes:a.attributes,offset:a.offset,limit:a.groupedLimit.limit,order:O,aliasesMapping:a.aliasesMapping,aliasesByTable:a.aliasesByTable,where:g,include:w,model:n},n).replace(/;$/,"")}) ${this.getAliasToken()} sub`,x=this.whereItemQuery(Rt.placeholder,!0,{model:n}),L=T.indexOf(x);s.push(this.selectFromTableFragment(a,l.model,u.main,`(${a.groupedLimit.values.map(P=>{let C;return z&&(C={[z]:P}),w&&(C={[a.groupedLimit.on.foreignIdentifierField]:P}),Qt.spliceStr(T,L,x.length,this.getWhereConditions(C,v))}).join(this._dialect.supports["UNION ALL"]?" UNION ALL ":" UNION ")})`,l.as))}else s.push(this.selectFromTableFragment(a,l.model,u.main,l.quotedName,l.as));s.push(d.join(""))}if(Object.prototype.hasOwnProperty.call(a,"where")&&!a.groupedLimit&&(a.where=this.getWhereConditions(a.where,l.as||r,n,a),a.where&&(c?o.push(` WHERE ${a.where}`):(s.push(` WHERE ${a.where}`),s.forEach((g,O)=>{g.startsWith("SELECT")&&(s[O]=this.selectFromTableFragment(a,n,u.main,l.quotedName,l.as,a.where))})))),a.group&&(a.group=Array.isArray(a.group)?a.group.map(g=>this.aliasGrouping(g,n,l.as,a)).join(", "):this.aliasGrouping(a.group,n,l.as,a),c&&a.group?o.push(` GROUP BY ${a.group}`):a.group&&s.push(` GROUP BY ${a.group}`)),Object.prototype.hasOwnProperty.call(a,"having")&&(a.having=this.getWhereConditions(a.having,r,n,a,!1),a.having&&(c?o.push(` HAVING ${a.having}`):s.push(` HAVING ${a.having}`))),a.order){let g=this.getQueryOrders(a,n,c);g.mainQueryOrder.length&&s.push(` ORDER BY ${g.mainQueryOrder.join(", ")}`),g.subQueryOrder.length&&o.push(` ORDER BY ${g.subQueryOrder.join(", ")}`)}let m=this.addLimitAndOffset(a,l.model);if(m&&!a.groupedLimit&&(c?o.push(m):s.push(m)),c?(this._throwOnEmptyAttributes(u.main,{modelName:n&&n.name,as:l.as}),b=`SELECT ${u.main.join(", ")} FROM (${o.join("")}) ${this.getAliasToken()} ${l.as}${d.join("")}${s.join("")}`):b=s.join(""),a.lock&&this._dialect.supports.lock){let g=a.lock;typeof a.lock=="object"&&(g=a.lock.level),this._dialect.supports.lockKey&&["KEY SHARE","NO KEY UPDATE"].includes(g)?b+=` FOR ${g}`:g==="SHARE"?b+=` ${this._dialect.supports.forShare}`:b+=" FOR UPDATE",this._dialect.supports.lockOf&&a.lock.of&&a.lock.of.prototype instanceof Uu&&(b+=` OF ${this.quoteTable(a.lock.of.name)}`),this._dialect.supports.skipLocked&&a.skipLocked&&(b+=" SKIP LOCKED")}return`${b};`}aliasGrouping(r,a,n,i){let s=Array.isArray(r)?r[0]:r;return this.quote(this._getAliasForField(n,s,i)||s,a)}escapeAttributes(r,a,n){return r&&r.map(i=>{let s=!0;if(i instanceof Qt.SequelizeMethod)return this.handleSequelizeMethod(i);if(Array.isArray(i)){if(i.length!==2)throw new Error(`${JSON.stringify(i)} is not a valid attribute definition. Please use the following format: ['attribute definition', 'alias']`);if(i=i.slice(),i[0]instanceof Qt.SequelizeMethod)i[0]=this.handleSequelizeMethod(i[0]),s=!1;else if(this.options.attributeBehavior==="escape"||!i[0].includes("(")&&!i[0].includes(")"))i[0]=this.quoteIdentifier(i[0]);else if(this.options.attributeBehavior!=="unsafe-legacy")throw new Error(`Attributes cannot include parentheses in Sequelize 6:
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            

Error: Please install mysql2 package manually
    at t._loadDialectModule (/home/wiomgjqe/neduas.store/server.js:124:7832)
    at new t (/home/wiomgjqe/neduas.store/server.js:136:66644)
    at new O1 (/home/wiomgjqe/neduas.store/server.js:136:73185)
    at new t (/home/wiomgjqe/neduas.store/server.js:136:229204)
    at Object.<anonymous> (/home/wiomgjqe/neduas.store/server.js:3649:2755)
    at Module._compile (node:internal/modules/cjs/loader:1275:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1329:10)
    at Module.load (node:internal/modules/cjs/loader:1133:32)
    at Module._load (node:internal/modules/cjs/loader:972:12)
    at Module.require (node:internal/modules/cjs/loader:1157:19)

Node.js v19.9.0
error: [polling_error] {"code":"ETELEGRAM","message":"ETELEGRAM: 409 Conflict: terminated by other getUpdates request; make sure that only one bot instance is running"}
error: [polling_error] {"code":"ETELEGRAM","message":"ETELEGRAM: 409 Conflict: terminated by other getUpdates request; make sure that only one bot instance is running"}
error: [polling_error] {"code":"ETELEGRAM","message":"ETELEGRAM: 409 Conflict: terminated by other getUpdates request; make sure that only one bot instance is running"}
error: [polling_error] {"code":"ETELEGRAM","message":"ETELEGRAM: 409 Conflict: terminated by other getUpdates request; make sure that only one bot instance is running"}
error: [polling_error] {"code":"ETELEGRAM","message":"ETELEGRAM: 409 Conflict: terminated by other getUpdates request; make sure that only one bot instance is running"}
error: [polling_error] {"code":"ETELEGRAM","message":"ETELEGRAM: 409 Conflict: terminated by other getUpdates request; make sure that only one bot instance is running"}
error: [polling_error] {"code":"ETELEGRAM","message":"ETELEGRAM: 409 Conflict: terminated by other getUpdates request; make sure that only one bot instance is running"}
error: [polling_error] {"code":"ETELEGRAM","message":"ETELEGRAM: 409 Conflict: terminated by other getUpdates request; make sure that only one bot instance is running"}
error: [polling_error] {"code":"ETELEGRAM","message":"ETELEGRAM: 409 Conflict: terminated by other getUpdates request; make sure that only one bot instance is running"}
error: [polling_error] {"code":"ETELEGRAM","message":"ETELEGRAM: 409 Conflict: terminated by other getUpdates request; make sure that only one bot instance is running"}
error: [polling_error] {"code":"ETELEGRAM","message":"ETELEGRAM: 409 Conflict: terminated by other getUpdates request; make sure that only one bot instance is running"}
error: [polling_error] {"code":"ETELEGRAM","message":"ETELEGRAM: 409 Conflict: terminated by other getUpdates request; make sure that only one bot instance is running"}
error: [polling_error] {"code":"ETELEGRAM","message":"ETELEGRAM: 409 Conflict: terminated by other getUpdates request; make sure that only one bot instance is running"}
error: [polling_error] {"code":"ETELEGRAM","message":"ETELEGRAM: 409 Conflict: terminated by other getUpdates request; make sure that only one bot instance is running"}
error: [polling_error] {"code":"ETELEGRAM","message":"ETELEGRAM: 409 Conflict: terminated by other getUpdates request; make sure that only one bot instance is running"}
error: [polling_error] {"code":"ETELEGRAM","message":"ETELEGRAM: 409 Conflict: terminated by other getUpdates request; make sure that only one bot instance is running"}
error: [polling_error] {"code":"ETELEGRAM","message":"ETELEGRAM: 409 Conflict: terminated by other getUpdates request; make sure that only one bot instance is running"}
error: [polling_error] {"code":"ETELEGRAM","message":"ETELEGRAM: 409 Conflict: terminated by other getUpdates request; make sure that only one bot instance is running"}
error: [polling_error] {"code":"ETELEGRAM","message":"ETELEGRAM: 409 Conflict: terminated by other getUpdates request; make sure that only one bot instance is running"}
error: [polling_error] {"code":"ETELEGRAM","message":"ETELEGRAM: 409 Conflict: terminated by other getUpdates request; make sure that only one bot instance is running"}
error: [polling_error] {"code":"ETELEGRAM","message":"ETELEGRAM: 409 Conflict: terminated by other getUpdates request; make sure that only one bot instance is running"}
error: [polling_error] {"code":"ETELEGRAM","message":"ETELEGRAM: 409 Conflict: terminated by other getUpdates request; make sure that only one bot instance is running"}
error: [polling_error] {"code":"ETELEGRAM","message":"ETELEGRAM: 409 Conflict: terminated by other getUpdates request; make sure that only one bot instance is running"}
error: [polling_error] {"code":"ETELEGRAM","message":"ETELEGRAM: 409 Conflict: terminated by other getUpdates request; make sure that only one bot instance is running"}
error: [polling_error] {"code":"ETELEGRAM","message":"ETELEGRAM: 409 Conflict: terminated by other getUpdates request; make sure that only one bot instance is running"}
error: [polling_error] {"code":"ETELEGRAM","message":"ETELEGRAM: 409 Conflict: terminated by other getUpdates request; make sure that only one bot instance is running"}
error: [polling_error] {"code":"ETELEGRAM","message":"ETELEGRAM: 409 Conflict: terminated by other getUpdates request; make sure that only one bot instance is running"}
error: [polling_error] {"code":"ETELEGRAM","message":"ETELEGRAM: 409 Conflict: terminated by other getUpdates request; make sure that only one bot instance is running"}
error: [polling_error] {"code":"ETELEGRAM","message":"ETELEGRAM: 409 Conflict: terminated by other getUpdates request; make sure that only one bot instance is running"}
error: [polling_error] {"code":"ETELEGRAM","message":"ETELEGRAM: 409 Conflict: terminated by other getUpdates request; make sure that only one bot instance is running"}
error: [polling_error] {"code":"ETELEGRAM","message":"ETELEGRAM: 409 Conflict: terminated by other getUpdates request; make sure that only one bot instance is running"}
error: [polling_error] {"code":"ETELEGRAM","message":"ETELEGRAM: 409 Conflict: terminated by other getUpdates request; make sure that only one bot instance is running"}
error: [polling_error] {"code":"ETELEGRAM","message":"ETELEGRAM: 409 Conflict: terminated by other getUpdates request; make sure that only one bot instance is running"}
error: [polling_error] {"code":"ETELEGRAM","message":"ETELEGRAM: 409 Conflict: terminated by other getUpdates request; make sure that only one bot instance is running"}
error: [polling_error] {"code":"ETELEGRAM","message":"ETELEGRAM: 409 Conflict: terminated by other getUpdates request; make sure that only one bot instance is running"}
error: [polling_error] {"code":"ETELEGRAM","message":"ETELEGRAM: 409 Conflict: terminated by other getUpdates request; make sure that only one bot instance is running"}
error: [polling_error] {"code":"ETELEGRAM","message":"ETELEGRAM: 409 Conflict: terminated by other getUpdates request; make sure that only one bot instance is running"}
error: [polling_error] {"code":"ETELEGRAM","message":"ETELEGRAM: 409 Conflict: terminated by other getUpdates request; make sure that only one bot instance is running"}
error: [polling_error] {"code":"ETELEGRAM","message":"ETELEGRAM: 409 Conflict: terminated by other getUpdates request; make sure that only one bot instance is running"}
error: [polling_error] {"code":"ETELEGRAM","message":"ETELEGRAM: 409 Conflict: terminated by other getUpdates request; make sure that only one bot instance is running"}
error: [polling_error] {"code":"ETELEGRAM","message":"ETELEGRAM: 409 Conflict: terminated by other getUpdates request; make sure that only one bot instance is running"}
error: [polling_error] {"code":"ETELEGRAM","message":"ETELEGRAM: 409 Conflict: terminated by other getUpdates request; make sure that only one bot instance is running"}
error: [polling_error] {"code":"EFATAL","message":"EFATAL: Error: read ECONNRESET"}
error: [polling_error] {"code":"EFATAL","message":"EFATAL: Error: read ECONNRESET"}
error: [polling_error] {"code":"EFATAL","message":"EFATAL: Error: read ECONNRESET"}
error: [polling_error] {"code":"EFATAL","message":"EFATAL: Error: read ECONNRESET"}
error: [polling_error] {"code":"EFATAL","message":"EFATAL: Error: read ECONNRESET"}
error: [polling_error] {"code":"EFATAL","message":"EFATAL: Error: read ECONNRESET"}
error: [polling_error] {"code":"EFATAL","message":"EFATAL: Error: read ECONNRESET"}