node:internal/modules/cjs/loader:1093
  throw err;
  ^

Error: Cannot find module '/home/iyzmuwbu/api-user.simotp.xyz//index.js'
Require stack:
- /usr/local/lsws/fcgi-bin/lsnode.js
    at Module._resolveFilename (node:internal/modules/cjs/loader:1090:15)
    at Module._load (node:internal/modules/cjs/loader:934:27)
    at Module.require (node:internal/modules/cjs/loader:1157:19)
    at require (node:internal/modules/helpers:119:18)
    at startApplication (/usr/local/lsws/fcgi-bin/lsnode.js:48:15)
    at Object.<anonymous> (/usr/local/lsws/fcgi-bin/lsnode.js:16:1)
    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) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [ '/usr/local/lsws/fcgi-bin/lsnode.js' ]
}

Node.js v19.9.0
node:internal/modules/cjs/loader:1093
  throw err;
  ^

Error: Cannot find module '/home/iyzmuwbu/api-user.simotp.xyz//index.js'
Require stack:
- /usr/local/lsws/fcgi-bin/lsnode.js
    at Module._resolveFilename (node:internal/modules/cjs/loader:1090:15)
    at Module._load (node:internal/modules/cjs/loader:934:27)
    at Module.require (node:internal/modules/cjs/loader:1157:19)
    at require (node:internal/modules/helpers:119:18)
    at startApplication (/usr/local/lsws/fcgi-bin/lsnode.js:48:15)
    at Object.<anonymous> (/usr/local/lsws/fcgi-bin/lsnode.js:16:1)
    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) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [ '/usr/local/lsws/fcgi-bin/lsnode.js' ]
}

Node.js v19.9.0
node:internal/modules/cjs/loader:1093
  throw err;
  ^

Error: Cannot find module '/home/iyzmuwbu/api-user.simotp.xyz//index.js'
Require stack:
- /usr/local/lsws/fcgi-bin/lsnode.js
    at Module._resolveFilename (node:internal/modules/cjs/loader:1090:15)
    at Module._load (node:internal/modules/cjs/loader:934:27)
    at Module.require (node:internal/modules/cjs/loader:1157:19)
    at require (node:internal/modules/helpers:119:18)
    at startApplication (/usr/local/lsws/fcgi-bin/lsnode.js:48:15)
    at Object.<anonymous> (/usr/local/lsws/fcgi-bin/lsnode.js:16:1)
    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) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [ '/usr/local/lsws/fcgi-bin/lsnode.js' ]
}

Node.js v19.9.0
node:internal/modules/cjs/loader:1093
  throw err;
  ^

Error: Cannot find module '/home/iyzmuwbu/api-user.simotp.xyz//index.js'
Require stack:
- /usr/local/lsws/fcgi-bin/lsnode.js
    at Module._resolveFilename (node:internal/modules/cjs/loader:1090:15)
    at Module._load (node:internal/modules/cjs/loader:934:27)
    at Module.require (node:internal/modules/cjs/loader:1157:19)
    at require (node:internal/modules/helpers:119:18)
    at startApplication (/usr/local/lsws/fcgi-bin/lsnode.js:48:15)
    at Object.<anonymous> (/usr/local/lsws/fcgi-bin/lsnode.js:16:1)
    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) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [ '/usr/local/lsws/fcgi-bin/lsnode.js' ]
}

Node.js v19.9.0
node:internal/modules/cjs/loader:1093
  throw err;
  ^

Error: Cannot find module '/home/iyzmuwbu/api-user.simotp.xyz//index.js'
Require stack:
- /usr/local/lsws/fcgi-bin/lsnode.js
    at Module._resolveFilename (node:internal/modules/cjs/loader:1090:15)
    at Module._load (node:internal/modules/cjs/loader:934:27)
    at Module.require (node:internal/modules/cjs/loader:1157:19)
    at require (node:internal/modules/helpers:119:18)
    at startApplication (/usr/local/lsws/fcgi-bin/lsnode.js:48:15)
    at Object.<anonymous> (/usr/local/lsws/fcgi-bin/lsnode.js:16:1)
    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) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [ '/usr/local/lsws/fcgi-bin/lsnode.js' ]
}

Node.js v19.9.0
node:internal/modules/cjs/loader:1093
  throw err;
  ^

Error: Cannot find module '/home/iyzmuwbu/api-user.simotp.xyz//index.js'
Require stack:
- /usr/local/lsws/fcgi-bin/lsnode.js
    at Module._resolveFilename (node:internal/modules/cjs/loader:1090:15)
    at Module._load (node:internal/modules/cjs/loader:934:27)
    at Module.require (node:internal/modules/cjs/loader:1157:19)
    at require (node:internal/modules/helpers:119:18)
    at startApplication (/usr/local/lsws/fcgi-bin/lsnode.js:48:15)
    at Object.<anonymous> (/usr/local/lsws/fcgi-bin/lsnode.js:16:1)
    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) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [ '/usr/local/lsws/fcgi-bin/lsnode.js' ]
}

Node.js v19.9.0
node:internal/modules/cjs/loader:1093
  throw err;
  ^

Error: Cannot find module '/home/iyzmuwbu/api-user.simotp.xyz//index.js'
Require stack:
- /usr/local/lsws/fcgi-bin/lsnode.js
    at Module._resolveFilename (node:internal/modules/cjs/loader:1090:15)
    at Module._load (node:internal/modules/cjs/loader:934:27)
    at Module.require (node:internal/modules/cjs/loader:1157:19)
    at require (node:internal/modules/helpers:119:18)
    at startApplication (/usr/local/lsws/fcgi-bin/lsnode.js:48:15)
    at Object.<anonymous> (/usr/local/lsws/fcgi-bin/lsnode.js:16:1)
    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) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [ '/usr/local/lsws/fcgi-bin/lsnode.js' ]
}

Node.js v19.9.0
node:internal/modules/cjs/loader:1093
  throw err;
  ^

Error: Cannot find module '/home/iyzmuwbu/api-user.simotp.xyz//index.js'
Require stack:
- /usr/local/lsws/fcgi-bin/lsnode.js
    at Module._resolveFilename (node:internal/modules/cjs/loader:1090:15)
    at Module._load (node:internal/modules/cjs/loader:934:27)
    at Module.require (node:internal/modules/cjs/loader:1157:19)
    at require (node:internal/modules/helpers:119:18)
    at startApplication (/usr/local/lsws/fcgi-bin/lsnode.js:48:15)
    at Object.<anonymous> (/usr/local/lsws/fcgi-bin/lsnode.js:16:1)
    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) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [ '/usr/local/lsws/fcgi-bin/lsnode.js' ]
}

Node.js v19.9.0
node:internal/modules/cjs/loader:1093
  throw err;
  ^

Error: Cannot find module '/home/iyzmuwbu/api-user.simotp.xyz//index.js'
Require stack:
- /usr/local/lsws/fcgi-bin/lsnode.js
    at Module._resolveFilename (node:internal/modules/cjs/loader:1090:15)
    at Module._load (node:internal/modules/cjs/loader:934:27)
    at Module.require (node:internal/modules/cjs/loader:1157:19)
    at require (node:internal/modules/helpers:119:18)
    at startApplication (/usr/local/lsws/fcgi-bin/lsnode.js:48:15)
    at Object.<anonymous> (/usr/local/lsws/fcgi-bin/lsnode.js:16:1)
    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) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [ '/usr/local/lsws/fcgi-bin/lsnode.js' ]
}

Node.js v19.9.0
node:internal/modules/cjs/loader:1093
  throw err;
  ^

Error: Cannot find module '/home/iyzmuwbu/api-user.simotp.xyz//index.js'
Require stack:
- /usr/local/lsws/fcgi-bin/lsnode.js
    at Module._resolveFilename (node:internal/modules/cjs/loader:1090:15)
    at Module._load (node:internal/modules/cjs/loader:934:27)
    at Module.require (node:internal/modules/cjs/loader:1157:19)
    at require (node:internal/modules/helpers:119:18)
    at startApplication (/usr/local/lsws/fcgi-bin/lsnode.js:48:15)
    at Object.<anonymous> (/usr/local/lsws/fcgi-bin/lsnode.js:16:1)
    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) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [ '/usr/local/lsws/fcgi-bin/lsnode.js' ]
}

Node.js v19.9.0
/home/iyzmuwbu/simotp.xyz/index.js:136
`}};$I.AggregateError=OH});var dqe=A(JI=>{"use strict";Object.defineProperty(JI,"__esModule",{value:!0});JI.Deferred=void 0;var jQt=MH(),_H=class{constructor(){this._promise=new Promise((e,r)=>{this._reject=r,this._resolve=e})}registerTimeout(e,r){this._timeout||(this._timeout=setTimeout(()=>{r(),this.reject(new jQt.TimeoutError("Operation timeout"))},e))}_clearTimeout(){this._timeout&&clearTimeout(this._timeout)}resolve(e){this._clearTimeout(),this._resolve(e)}reject(e){this._clearTimeout(),this._reject(e)}promise(){return this._promise}};JI.Deferred=_H});var bqe=A(ZI=>{"use strict";Object.defineProperty(ZI,"__esModule",{value:!0});ZI.Pool=void 0;var QQt=dqe(),VQt=AH(),mH=class{constructor(e){if(this.log=!1,!e.create)throw new Error("create function is required");if(!e.destroy)throw new Error("destroy function is required");if(!e.validate)throw new Error("validate function is required");if(typeof e.min!="number"||e.min<0||e.min!==Math.round(e.min))throw new Error("min must be an integer >= 0");if(typeof e.max!="number"||e.max<=0||e.max!==Math.round(e.max))throw new Error("max must be an integer > 0");if(e.min>e.max)throw new Error("max is smaller than min");if(e.maxUses!==void 0&&(typeof e.maxUses!="number"||e.maxUses<0))throw new Error("maxUses must be an integer >= 0");this.idleTimeoutMillis=e.idleTimeoutMillis||3e4,this.acquireTimeoutMillis=e.acquireTimeoutMillis||3e4,this.reapIntervalMillis=e.reapIntervalMillis||1e3,this.maxUsesPerResource=e.maxUses||1/0,this.log=e.log||!1,this._factory=e,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(e,r){typeof this.log=="function"?this.log(e,r):this.log&&console.log(`${r.toUpperCase()} pool ${this.name||""} - ${e}`)}_removeIdle(){let e=[],r=Date.now(),n,i=this._availableObjects.length,a=this.size-this.minSize,s;for(this._removeIdleScheduled=!1,n=0;n<i&&a>e.length;n++)s=this._availableObjects[n].timeout,r>=s&&(this._log("removeIdle() destroying obj - now:"+r+" timeout:"+s,"verbose"),e.push(this._availableObjects[n].resource));e.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 e=null,r=this._pendingAcquires.length;if(this._log(`dispense() clients=${r} available=${this._availableObjects.length}`,"info"),!(r<1)){for(;this._availableObjects.length>0;){if(this._log("dispense() - reusing obj","verbose"),e=this._availableObjects[this._availableObjects.length-1],!this._factory.validate(e.resource)){this.destroy(e.resource);continue}return this._availableObjects.pop(),this._addResourceToInUseObjects(e.resource,e.useCount),this._pendingAcquires.shift().resolve(e.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(e=>{let r=this._pendingAcquires.shift();r?(this._addResourceToInUseObjects(e,0),r.resolve(e)):this._addResourceToAvailableObjects(e,0)}).catch(e=>{let r=this._pendingAcquires.shift();this._count-=1,this._count<0&&(this._count=0),r&&r.reject(e),process.nextTick(()=>{this._dispense()})})}_addResourceToAvailableObjects(e,r){let n={resource:e,useCount:r,timeout:Date.now()+this.idleTimeoutMillis};this._availableObjects.push(n),this._dispense(),this._scheduleRemoveIdle()}_addResourceToInUseObjects(e,r){let n={resource:e,useCount:r};this._inUseObjects.push(n)}_ensureMinimum(){let e,r;if(!this._draining&&this.size<this.minSize)for(r=this.minSize-this.size,e=0;e<r;e++)this._createResource()}acquire(){if(this._draining)return Promise.reject(new Error("pool is draining and cannot accept work"));let e=new QQt.Deferred;return e.registerTimeout(this.acquireTimeoutMillis,()=>{this._pendingAcquires=this._pendingAcquires.filter(r=>r!==e)}),this._pendingAcquires.push(e),this._dispense(),e.promise()}release(e){if(this._availableObjects.some(i=>i.resource===e)){this._log("release called twice for the same resource: "+new Error().stack,"error");return}let r=this._inUseObjects.findIndex(i=>i.resource===e);if(r<0){this._log("attempt to release an invalid resource: "+new Error().stack,"error");return}let n=this._inUseObjects[r];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(r,1),this._addResourceToAvailableObjects(n.resource,n.useCount))}async destroy(e){let r=this._availableObjects.length,n=this._inUseObjects.length;if(this._availableObjects=this._availableObjects.filter(i=>i.resource!==e),this._inUseObjects=this._inUseObjects.filter(i=>i.resource!==e),r===this._availableObjects.length&&n===this._inUseObjects.length){this._ensureMinimum();return}this._count-=1,this._count<0&&(this._count=0);try{await this._factory.destroy(e)}finally{this._ensureMinimum(),this._draining||process.nextTick(()=>{this._dispense()})}}drain(){this._log("draining","info"),this._draining=!0;let e=r=>{if(this._pendingAcquires.length>0){this._dispense(),setTimeout(()=>{e(r)},100);return}if(this._availableObjects.length!==this._count){setTimeout(()=>{e(r)},100);return}r()};return new Promise(r=>e(r))}async destroyAllNow(){this._log("force destroying all objects","info"),this._removeIdleScheduled=!1,clearTimeout(this._removeIdleTimer);let e=this._availableObjects.map(n=>n.resource),r=[];for(let n of e)try{await this.destroy(n)}catch(i){this._log("Error destroying resource: "+i.stack,"error"),r.push(i)}if(r.length>0)throw new VQt.AggregateError(r)}};ZI.Pool=mH});var hqe=A(sp=>{"use strict";Object.defineProperty(sp,"__esModule",{value:!0});sp.Pool=sp.AggregateError=sp.TimeoutError=void 0;var HQt=MH();Object.defineProperty(sp,"TimeoutError",{enumerable:!0,get:function(){return HQt.TimeoutError}});var XQt=AH();Object.defineProperty(sp,"AggregateError",{enumerable:!0,get:function(){return XQt.AggregateError}});var YQt=bqe();Object.defineProperty(sp,"Pool",{enumerable:!0,get:function(){return YQt.Pool}})});var uu=A((uzr,eS)=>{"use strict";var{Pool:EH,TimeoutError:KQt}=hqe(),op=it(),zH=Ks(),$Qt=v0(),{logger:JQt}=Gr(),ZQt=dM(),Zo=JQt.debugContext("pool"),$g=class{constructor(e,r){let n=op.cloneDeep(r.config);if(this.sequelize=r,this.config=n,this.dialect=e,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=op.defaults(n.pool||{},{max:5,min:0,idle:1e4,acquire:6e4,evict:1e3,validate:this._validate.bind(this)}),this.initPools()}refreshTypeParser(e){op.each(e,r=>{if(Object.prototype.hasOwnProperty.call(r,"parse"))if(r.types[this.dialectName])this._refreshTypeParser(r);else throw new Error(`Parse function not supported for type ${r.key} in dialect ${this.dialectName}`)})}_loadDialectModule(e){try{return this.sequelize.config.dialectModulePath?require(this.sequelize.config.dialectModulePath):this.sequelize.config.dialectModule?this.sequelize.config.dialectModule:require(e)}catch(r){throw r.code==="MODULE_NOT_FOUND"?this.sequelize.config.dialectModulePath?new Error(`Unable to find dialect at ${this.sequelize.config.dialectModulePath}`):new Error(`Please install ${e} package manually`):r}}async _onProcessExit(){if(this.pool)return await this.pool.drain(),Zo("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 e=this.config;if(!e.replication){this.pool=new EH({name:"sequelize",create:()=>this._connect(e),destroy:async n=>{let i=await this._disconnect(n);return Zo("connection destroy"),i},validate:e.pool.validate,max:e.pool.max,min:e.pool.min,acquireTimeoutMillis:e.pool.acquire,idleTimeoutMillis:e.pool.idle,reapIntervalMillis:e.pool.evict,maxUses:e.pool.maxUses}),Zo(`pool created with max/min: ${e.pool.max}/${e.pool.min}, no replication`);return}Array.isArray(e.replication.read)||(e.replication.read=[e.replication.read]),e.replication.write=op.defaults(e.replication.write,op.omit(e,"replication")),e.replication.read=e.replication.read.map(n=>op.defaults(n,op.omit(this.config,"replication")));let r=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),Zo("connection destroy")},destroyAllNow:async()=>{await Promise.all([this.pool.read.destroyAllNow(),this.pool.write.destroyAllNow()]),Zo("all connections destroyed")},drain:async()=>Promise.all([this.pool.write.drain(),this.pool.read.drain()]),read:new EH({name:"sequelize:read",create:async()=>{let n=r++%e.replication.read.length,i=await this._connect(e.replication.read[n]);return i.queryType="read",i},destroy:n=>this._disconnect(n),validate:e.pool.validate,max:e.pool.max,min:e.pool.min,acquireTimeoutMillis:e.pool.acquire,idleTimeoutMillis:e.pool.idle,reapIntervalMillis:e.pool.evict,maxUses:e.pool.maxUses}),write:new EH({name:"sequelize:write",create:async()=>{let n=await this._connect(e.replication.write);return n.queryType="write",n},destroy:n=>this._disconnect(n),validate:e.pool.validate,max:e.pool.max,min:e.pool.min,acquireTimeoutMillis:e.pool.acquire,idleTimeoutMillis:e.pool.idle,reapIntervalMillis:e.pool.evict,maxUses:e.pool.maxUses})},Zo(`pool created with max/min: ${e.pool.max}/${e.pool.min}, with replication`)}async getConnection(e){e=e||{},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 a=await this.sequelize.databaseVersion(i),s=op.get(zH.coerce(a),"version")||a;this.sequelize.options.databaseVersion=zH.valid(s)?s:this.dialect.defaultVersion}return zH.lt(this.sequelize.options.databaseVersion,this.dialect.defaultVersion)&&(ZQt.unsupportedEngine(),Zo(`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 r;try{await this.sequelize.runHooks("beforePoolAcquire",e),r=await this.pool.acquire(e.type,e.useMaster),await this.sequelize.runHooks("afterPoolAcquire",r,e)}catch(n){throw n instanceof KQt?new $Qt.ConnectionAcquireTimeoutError(n):n}return Zo("connection acquired"),r}releaseConnection(e){this.pool.release(e),Zo("connection released")}async destroyConnection(e){await this.pool.destroy(e),Zo(`connection ${e.uuid} destroyed`)}async _connect(e){await this.sequelize.runHooks("beforeConnect",e);let r=await this.dialect.connectionManager.connect(e);return await this.sequelize.runHooks("afterConnect",r,e),r}async _disconnect(e){return await this.sequelize.runHooks("beforeDisconnect",e),await this.dialect.connectionManager.disconnect(e),this.sequelize.runHooks("afterDisconnect",e)}_validate(e){return this.dialect.connectionManager.validate?this.dialect.connectionManager.validate(e):!0}};eS.exports=$g;eS.exports.ConnectionManager=$g;eS.exports.default=$g});var ss=A((lzr,Mqe)=>{"use strict";var Jg=new Map;Mqe.exports=t=>(Jg.has(t)||Jg.set(t,new Map),{clear(){Jg.get(t).clear()},refresh(e){for(let r of e.types[t])Jg.get(t).set(r,e.parse)},get(e){return Jg.get(t).get(e)}})});var mqe=A((pzr,rS)=>{"use strict";var eVt=Object.defineProperty,Oqe=Object.getOwnPropertySymbols,tVt=Object.prototype.hasOwnProperty,rVt=Object.prototype.propertyIsEnumerable,Aqe=(t,e,r)=>e in t?eVt(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,nVt=(t,e)=>{for(var r in e||(e={}))tVt.call(e,r)&&Aqe(t,r,e[r]);if(Oqe)for(var r of Oqe(e))rVt.call(e,r)&&Aqe(t,r,e[r]);return t},iVt=Ks(),aVt=uu(),AM=v0(),{logger:sVt}=Gr(),oVt=R0().mariadb,cVt=Xo(),_qe=sVt.debugContext("connection:mariadb"),tS=ss()("mariadb"),Zg=class t extends aVt{constructor(e,r){r.config.port=r.config.port||3306,super(e,r),this.lib=this._loadDialectModule("mariadb"),this.refreshTypeParser(oVt)}static _typecast(e,r){return tS.get(e.type)?tS.get(e.type)(e,this.sequelize.options,r):r()}_refreshTypeParser(e){tS.refresh(e)}_clearTypeParser(){tS.clear()}async connect(e){let r=this.sequelize.options.timezone;r=/\//.test(r)?cVt.tz(r).format("Z"):r;let n=nVt({host:e.host,port:e.port,user:e.username,password:e.password,database:e.database,timezone:r,typeCast:t._typecast.bind(this),bigNumberStrings:!1,supportBigNumbers:!0,foundRows:!1},e.dialectOptions);this.sequelize.config.keepDefaultTimezone||(n.initSql?(Array.isArray(n.initSql)||(n.initSql=[n.initSql]),n.initSql.push(`SET time_zone = '${r}'`)):n.initSql=`SET time_zone = '${r}'`);try{let i=await this.lib.createConnection(n);return this.sequelize.options.databaseVersion=iVt.coerce(i.serverVersion()).version,_qe("connection acquired"),i.on("error",a=>{switch(a.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 AM.ConnectionRefusedError(i);case"ER_ACCESS_DENIED_ERROR":case"ER_ACCESS_DENIED_NO_PASSWORD_ERROR":throw new AM.AccessDeniedError(i);case"ENOTFOUND":throw new AM.HostNotFoundError(i);case"EHOSTUNREACH":case"ENETUNREACH":case"EADDRNOTAVAIL":throw new AM.HostNotReachableError(i);case"EINVAL":throw new AM.InvalidConnectionError(i);default:throw new AM.ConnectionError(i)}}}async disconnect(e){if(!e.isValid()){_qe("connection tried to disconnect but was already at CLOSED state");return}return await e.end()}validate(e){return e&&e.isValid()}};rS.exports=Zg;rS.exports.ConnectionManager=Zg;rS.exports.default=Zg});var lu=A((fzr,nS)=>{"use strict";var uVt=Object.defineProperty,Eqe=Object.getOwnPropertySymbols,lVt=Object.prototype.hasOwnProperty,pVt=Object.prototype.propertyIsEnumerable,zqe=(t,e,r)=>e in t?uVt(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,fVt=(t,e)=>{for(var r in e||(e={}))lVt.call(e,r)&&zqe(t,r,e[r]);if(Eqe)for(var r of Eqe(e))pVt.call(e,r)&&zqe(t,r,e[r]);return t},cp=it(),dVt=zg(),ma=Pi(),bVt=wg(),hVt=dM(),MVt=(oM(),xc(sM)).v4,{safeStringifyJson:gqe}=G0(),ey=class t{constructor(e,r,n){this.uuid=MVt(),this.connection=e,this.instance=n.instance,this.model=n.model,this.sequelize=r,this.options=fVt({plain:!1,raw:!1,logging:console.log},n),this.checkLoggingOption(),n.rawErrors&&(this.formatError=t.prototype.formatError)}static formatBindParameters(e,r,n,i,a){if(!r)return[e,[]];if(a=a||{},typeof i!="function"&&(a=i||{},i=void 0),!i)a.skipValueReplace?i=(u,l,p)=>{if(p[l]!==void 0)return u}:i=(u,l,p,f,b)=>{if(p[l]!==void 0)return dVt.escape(p[l],f,b)};else if(a.skipValueReplace){let u=i;i=(l,p,f,b,O,M)=>{if(u(l,p,f,b,O,M)!==void 0)return l}}let s=null,o=Array.isArray(r);return e=e.replace(/\B\$(\$|\w+)/g,(u,l)=>{if(l==="$")return a.skipUnescape?u:l;let p;if(o?l.match(/^[1-9]\d*$/)&&(l=l-1,p=i(u,l,r,s,n,a)):l.match(/^\d*$/)||(p=i(u,l,r,s,n,a)),p===void 0)throw new Error(`Named bind parameter "${u}" has no value in the given object.`);return p}),[e,[]]}formatError(e,r){return e.stack=r,e}run(){throw new Error("The run method wasn't overwritten!")}checkLoggingOption(){this.options.logging===!0&&(hVt.noTrueLogging(),this.options.logging=console.log)}getInsertIdField(){return"insertId"}getUniqueConstraintErrorMessage(e){let r=e?`${e} must be unique`:"Must be unique";if(e&&this.model)for(let n of Object.keys(this.model.uniqueKeys))this.model.uniqueKeys[n].fields.includes(e.replace(/"/g,""))&&this.model.uniqueKeys[n].msg&&(r=this.model.uniqueKeys[n].msg);return r}isRawQuery(){return this.options.type===ma.RAW}isVersionQuery(){return this.options.type===ma.VERSION}isUpsertQuery(){return this.options.type===ma.UPSERT}isInsertQuery(e,r){let n=!0;return this.options.type===ma.INSERT?!0:(n=n&&this.sql.toLowerCase().startsWith("insert into"),n=n&&(!e||Object.prototype.hasOwnProperty.call(e,this.getInsertIdField())),n=n&&(!r||Object.prototype.hasOwnProperty.call(r,this.getInsertIdField())),n)}handleInsertQuery(e,r){if(this.instance){let n=this.model.autoIncrementAttribute,i=null;i=i||e&&e[this.getInsertIdField()],i=i||r&&r[this.getInsertIdField()],this.instance[n]=i}}isShowTablesQuery(){return this.options.type===ma.SHOWTABLES}handleShowTablesQuery(e){return cp.flatten(e.map(r=>Object.values(r)))}isShowIndexesQuery(){return this.options.type===ma.SHOWINDEXES}isShowConstraintsQuery(){return this.options.type===ma.SHOWCONSTRAINTS}isDescribeQuery(){return this.options.type===ma.DESCRIBE}isSelectQuery(){return this.options.type===ma.SELECT}isBulkUpdateQuery(){return this.options.type===ma.BULKUPDATE}isBulkDeleteQuery(){return this.options.type===ma.BULKDELETE}isForeignKeysQuery(){return this.options.type===ma.FOREIGNKEYS}isUpdateQuery(){return this.options.type===ma.UPDATE}handleSelectQuery(e){let r=null;if(this.options.fieldMap){let n=this.options.fieldMap;e=e.map(i=>cp.reduce(n,(a,s,o)=>(a[o]!==void 0&&s!==o&&(a[s]=a[o],delete a[o]),a),i))}return this.options.raw?r=e.map(n=>{let i={};for(let a in n)Object.prototype.hasOwnProperty.call(n,a)&&(i[a]=n[a]);return this.options.nest&&(i=bVt.transform(i)),i}):this.options.hasJoin===!0?(e=t._groupJoinData(e,{model:this.model,includeMap:this.options.includeMap,includeNames:this.options.includeNames},{checkExisting:this.options.hasMultiAssociation}),r=this.model.bulkBuild(e,{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})):r=this.model.bulkBuild(e,{isNewRecord:!1,raw:!0,attributes:this.options.originalAttributes||this.options.attributes}),this.options.plain&&(r=r.length===0?null:r[0]),r}isShowOrDescribeQuery(){let e=!1;return e=e||this.sql.toLowerCase().startsWith("show"),e=e||this.sql.toLowerCase().startsWith("describe"),e}isCallQuery(){return this.sql.toLowerCase().startsWith("call")}_logQuery(e,r,n){let{connection:i,options:a}=this,s=this.sequelize.options.benchmark||a.benchmark,o=this.sequelize.options.logQueryParameters||a.logQueryParameters,u=Date.now(),l="";if(o&&n){let b=e.endsWith(";")?"":";",O;Array.isArray(n)?O=n.map(M=>gqe(M)).join(", "):O=gqe(n),l=`${b} ${O}`}let p=`(${i.uuid||"default"}): ${e}${l}`,f=`Executing ${p}`;return r(f),s||this.sequelize.log(`Executing ${p}`,a),()=>{let b=`Executed ${p}`;r(b),s&&this.sequelize.log(b,Date.now()-u,a)}}static _groupJoinData(e,r,n){if(!e.length)return[];let i,a,s,o,u,l,p=e.length,f,b,O,M,m,z,y,R,w=n.checkExisting,q,C,L,j=w?[]:new Array(p),I={},U={},Y,S,te,V,D,P,F,re,ee=Q=>{Object.prototype.hasOwnProperty.call(P.includeMap,Q)&&(U[b]=P=P.includeMap[Q],re?re=`${re}.${Q}`:re=Q,U[re]=P)},Ae={},ge=(Q,ae)=>(Object.prototype.hasOwnProperty.call(ae,Q)||(ae[Q]=Q.substr(0,Q.lastIndexOf("."))),ae[Q]),we={},Qe=Q=>{if(!Object.prototype.hasOwnProperty.call(we,Q)){let ae=Q.lastIndexOf(".");we[Q]=Q.substr(ae===-1?0:ae+1)}return we[Q]},de={},tt=Q=>{if(!Object.prototype.hasOwnProperty.call(de,Q)){let ae=ge(Q,Ae);Object.prototype.hasOwnProperty.call(de,ae)||(de[ae]=ae?ae.split("."):[]),de[Q]=de[ae]}return de[Q]},je={},Ee=Q=>{if(!Object.prototype.hasOwnProperty.call(je,Q)){let ae=tt(Q),le=ae.length;je[Q]=le?ae[le-1]:""}return je[Q]},Ze=Q=>{let ae=cp.chain(Q.uniqueKeys);return ae=ae.result(`${ae.findKey()}.fields`).map(le=>cp.findKey(Q.attributes,Oe=>Oe.field===le)).value(),ae},Ke=Q=>Q instanceof Buffer?Q.toString("hex"):Q,_e,We,oe;for(u=0;u<p;u++){if(l=e[u],u===0&&(f=cp.sortBy(Object.keys(l),Q=>[Q.split(".").length]),M=f.length),w){if(R=!1,o=r.model.primaryKeyAttributes.length,L="",o===1)L=Ke(l[r.model.primaryKeyAttributes[0]]);else if(o>1)for(s=0;s<o;s++)L+=Ke(l[r.model.primaryKeyAttributes[s]]);else if(!cp.isEmpty(r.model.uniqueKeys))for(We=Ze(r.model),s=0;s<We.length;s++)L+=l[We[s]]}for(y=z={},V=void 0,O=0;O<M;O++){if(b=f[O],S=ge(b,Ae),Y=tt(b),u===0&&!Object.prototype.hasOwnProperty.call(U,b)&&(Y.length?(P=r,re=void 0,Y.forEach(ee)):U[b]=U[""]=r),V!==void 0&&V!==Y){if(w){if(a=V.length,F=null,C=null,a)for(i=0;i<a;i++){if(oe=F?`${F}.${V[i]}`:V[i],_e=U[oe].model.primaryKeyAttributes,o=_e.length,q=oe,o===1)q+=Ke(l[`${oe}.${_e[0]}`]);else if(o>1)for(s=0;s<o;s++)q+=Ke(l[`${oe}.${_e[s]}`]);else if(!cp.isEmpty(U[oe].model.uniqueKeys))for(We=Ze(U[oe].model),s=0;s<We.length;s++)q+=l[`${oe}.${We[s]}`];C||(C=L),q=C+q,F=oe,i<a-1&&(C=q)}else q=L;q===L?I[q]?R=!0:I[q]=z:I[q]||(F=I[C],D=Ee(m),U[m].association.isSingleAssociation?F&&(F[D]=I[q]=z):(F[D]||(F[D]=[]),F[D].push(I[q]=z))),z={}}else if(P=y,a=Y.length,a)for(i=0;i<a;i++)i===a-1&&(z=P[Y[i]]={}),P=P[Y[i]]||{}}z[Qe(b)]=l[b],m=b,V=Y,te=S}if(w){if(a=V.length,F=null,C=null,a)for(i=0;i<a;i++){if(oe=F?`${F}.${V[i]}`:V[i],_e=U[oe].model.primaryKeyAttributes,o=_e.length,q=oe,o===1)q+=Ke(l[`${oe}.${_e[0]}`]);else if(o>0)for(s=0;s<o;s++)q+=Ke(l[`${oe}.${_e[s]}`]);else if(!cp.isEmpty(U[oe].model.uniqueKeys))for(We=Ze(U[oe].model),s=0;s<We.length;s++)q+=l[`${oe}.${We[s]}`];C||(C=L),q=C+q,F=oe,i<a-1&&(C=q)}else q=L;q===L?I[q]?R=!0:I[q]=z:I[q]||(F=I[C],D=Ee(m),U[m].association.isSingleAssociation?F&&(F[D]=I[q]=z):(F[D]||(F[D]=[]),F[D].push(I[q]=z))),R||j.push(y)}else j[u]=y}return j}};nS.exports=ey;nS.exports.AbstractQuery=ey;nS.exports.default=ey});var Iqe=A((dzr,vqe)=>{"use strict";var OVt=Object.defineProperty,yqe=Object.getOwnPropertySymbols,AVt=Object.prototype.hasOwnProperty,_Vt=Object.prototype.propertyIsEnumerable,Rqe=(t,e,r)=>e in t?OVt(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,mVt=(t,e)=>{for(var r in e||(e={}))AVt.call(e,r)&&Rqe(t,r,e[r]);if(yqe)for(var r of yqe(e))_Vt.call(e,r)&&Rqe(t,r,e[r]);return t},Nqe=lu(),iS=v0(),Tqe=it(),gH=R0(),{logger:EVt}=Gr(),zVt=1062,gVt=1213,wqe=1451,yVt=1452,qqe=EVt.debugContext("sql:mariadb"),yH=class extends Nqe{constructor(e,r,n){super(e,r,mVt({showWarnings:!1},n))}static formatBindParameters(e,r,n){let i=[],a=(s,o,u)=>{if(u[o]!==void 0)return i.push(u[o]),"?"};return e=Nqe.formatBindParameters(e,r,n,a)[0],[e,i.length>0?i:void 0]}async run(e,r){this.sql=e;let{connection:n,options:i}=this,a=this.sequelize.options.showWarnings||i.showWarnings,s=this._logQuery(e,qqe,r);r&&qqe("parameters(%j)",r);let o,u=new Error;try{o=await n.query(this.sql,r)}catch(l){if(i.transaction&&l.errno===gVt){try{await i.transaction.rollback()}catch{}i.transaction.finished="rollback"}throw l.sql=e,l.parameters=r,this.formatError(l,u.stack)}finally{s()}return a&&o&&o.warningStatus>0&&await this.logWarnings(o),this.formatResults(o)}formatResults(e){let r=this.instance;if(this.isBulkUpdateQuery()||this.isBulkDeleteQuery())return e.affectedRows;if(this.isUpsertQuery())return[r,e.affectedRows===1];if(this.isInsertQuery(e)&&(this.handleInsertQuery(e),!this.instance)){if(this.model&&this.model.autoIncrementAttribute&&this.model.autoIncrementAttribute===this.model.primaryKeyAttribute&&this.model.rawAttributes[this.model.primaryKeyAttribute]){let n=e[this.getInsertIdField()];r=new Array(e.affectedRows);let i=this.model.rawAttributes[this.model.primaryKeyAttribute].field;for(let a=0;a<e.affectedRows;a++)r[a]={[i]:n+a};return[r,e.affectedRows]}return[e[this.getInsertIdField()],e.affectedRows]}if(this.isSelectQuery())return this.handleJsonSelectQuery(e),this.handleSelectQuery(e);if(this.isInsertQuery()||this.isUpdateQuery())return[r,e.affectedRows];if(this.isCallQuery())return e[0];if(this.isRawQuery()){let n=e.meta;return delete e.meta,[e,n]}if(this.isShowIndexesQuery())return this.handleShowIndexesQuery(e);if(this.isForeignKeysQuery()||this.isShowConstraintsQuery())return e;if(this.isShowTablesQuery())return this.handleShowTablesQuery(e);if(this.isDescribeQuery()){r={};for(let n of e)r[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 r}return this.isVersionQuery()?e[0].version:r}handleJsonSelectQuery(e){if(!(!this.model||!this.model.fieldRawAttributesMap))for(let r of Object.keys(this.model.fieldRawAttributesMap)){let n=this.model.fieldRawAttributesMap[r];n.type instanceof gH.JSON&&(e=e.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])),gH.JSON.parse?gH.JSON.parse(n,this.sequelize.options,i[n.fieldName]):i)))}}async logWarnings(e){let r=await this.run("SHOW WARNINGS"),n=`MariaDB Warnings (${this.connection.uuid||"default"}): `,i=[];for(let a of r)if(!(a===void 0||typeof a[Symbol.iterator]!="function"))for(let s of a)if(Object.prototype.hasOwnProperty.call(s,"Message"))i.push(s.Message);else for(let o of s.keys())i.push([o,s[o]].join(": "));return this.sequelize.log(n+i.join("; "),this.options),e}formatError(e,r){switch(e.errno){case zVt:{let n=e.message.match(/Duplicate entry '([\s\S]*)' for key '?((.|\s)*?)'?\s.*$/),i={},a="Validation error",s=n?n[1].split("-"):void 0,o=n?n[2]:void 0,u=n?n[1]:void 0,l=this.model&&this.model.uniqueKeys[o];l?(l.msg&&(a=l.msg),i=Tqe.zipObject(l.fields,s)):i[o]=u;let p=[];return Tqe.forOwn(i,(f,b)=>{p.push(new iS.ValidationErrorItem(this.getUniqueConstraintErrorMessage(b),"unique violation",b,f,this.instance,"not_unique"))}),new iS.UniqueConstraintError({message:a,errors:p,parent:e,fields:i,stack:r})}case wqe:case yVt:{let n=e.message.match(/CONSTRAINT ([`"])(.*)\1 FOREIGN KEY \(\1(.*)\1\) REFERENCES \1(.*)\1 \(\1(.*)\1\)/),i=n?n[1]:"`",a=n?n[3].split(new RegExp(`${i}, *${i}`)):void 0;return new iS.ForeignKeyConstraintError({reltype:e.errno===wqe?"parent":"child",table:n?n[4]:void 0,fields:a,value:a&&a.length&&this.instance&&this.instance[a[0]]||void 0,index:n?n[2]:void 0,parent:e,stack:r})}default:return new iS.DatabaseError(e,{stack:r})}}handleShowTablesQuery(e){return e.map(r=>({tableName:r.TABLE_NAME,schema:r.TABLE_SCHEMA}))}handleShowIndexesQuery(e){let r,n=[];return e.forEach(i=>{(!r||r.name!==i.Key_name)&&(r={primary:i.Key_name==="PRIMARY",fields:[],name:i.Key_name,tableName:i.Table,unique:i.Non_unique!==1,type:i.Index_type},n.push(r)),r.fields[i.Seq_in_index-1]={attribute:i.Column_name,length:i.Sub_part||void 0,order:i.Collation==="A"?"ASC":void 0}}),n}};vqe.exports=yH});var Dqe=A((bzr,Cqe)=>{"use strict";var RVt=Object.defineProperty,Sqe=Object.getOwnPropertySymbols,NVt=Object.prototype.hasOwnProperty,TVt=Object.prototype.propertyIsEnumerable,Lqe=(t,e,r)=>e in t?RVt(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,wVt=(t,e)=>{for(var r in e||(e={}))NVt.call(e,r)&&Lqe(t,r,e[r]);if(Sqe)for(var r of Sqe(e))TVt.call(e,r)&&Lqe(t,r,e[r]);return t},aS=it(),Pt=zn(),qVt=G0(),vVt={OperatorMap:{[Pt.eq]:"=",[Pt.ne]:"!=",[Pt.gte]:">=",[Pt.gt]:">",[Pt.lte]:"<=",[Pt.lt]:"<",[Pt.not]:"IS NOT",[Pt.is]:"IS",[Pt.in]:"IN",[Pt.notIn]:"NOT IN",[Pt.like]:"LIKE",[Pt.notLike]:"NOT LIKE",[Pt.iLike]:"ILIKE",[Pt.notILike]:"NOT ILIKE",[Pt.startsWith]:"LIKE",[Pt.endsWith]:"LIKE",[Pt.substring]:"LIKE",[Pt.regexp]:"~",[Pt.notRegexp]:"!~",[Pt.iRegexp]:"~*",[Pt.notIRegexp]:"!~*",[Pt.between]:"BETWEEN",[Pt.notBetween]:"NOT BETWEEN",[Pt.overlap]:"&&",[Pt.contains]:"@>",[Pt.contained]:"<@",[Pt.adjacent]:"-|-",[Pt.strictLeft]:"<<",[Pt.strictRight]:">>",[Pt.noExtendRight]:"&<",[Pt.noExtendLeft]:"&>",[Pt.any]:"ANY",[Pt.all]:"ALL",[Pt.and]:" AND ",[Pt.or]:" OR ",[Pt.col]:"COL",[Pt.placeholder]:"$$PLACEHOLDER$$",[Pt.match]:"@@"},OperatorsAliasMap:{},setOperatorsAliases(t){!t||aS.isEmpty(t)?this.OperatorsAliasMap=!1:this.OperatorsAliasMap=wVt({},t)},_replaceAliases(t){let e={};return this.OperatorsAliasMap?(qVt.getOperators(t).forEach(r=>{let n=t[r];aS.isPlainObject(n)?e[r]=this._replaceAliases(n):e[r]=n}),aS.forOwn(t,(r,n)=>{n=this.OperatorsAliasMap[n]||n,aS.isPlainObject(r)&&(r=this._replaceAliases(r)),e[n]=r}),e):t}};Cqe.exports=vVt});var xqe=A((hzr,Bqe)=>{"use strict";var IVt=(oM(),xc(sM)).v4,SVt={setIsolationLevelQuery(t,e){if(!e.parent)return`SET TRANSACTION ISOLATION LEVEL ${t};`},generateTransactionId(){return IVt()},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;"}};Bqe.exports=SVt});var up=A((Ozr,Fqe)=>{"use strict";var LVt=Object.defineProperty,CVt=Object.defineProperties,DVt=Object.getOwnPropertyDescriptors,Wqe=Object.getOwnPropertySymbols,BVt=Object.prototype.hasOwnProperty,xVt=Object.prototype.propertyIsEnumerable,Pqe=(t,e,r)=>e in t?LVt(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Dd=(t,e)=>{for(var r in e||(e={}))BVt.call(e,r)&&Pqe(t,r,e[r]);if(Wqe)for(var r of Wqe(e))xVt.call(e,r)&&Pqe(t,r,e[r]);return t},sS=(t,e)=>CVt(t,DVt(e)),oS=require("util"),Ct=it(),WVt=(oM(),xc(sM)).v4,Ge=G0(),Mzr=dM(),kqe=zg(),_M=R0(),$s=xV(),mM=np(),RH=ip(),PVt=lM(),kVt=qd(),Ce=zn(),NH=v0(),Uqe=HV(),ty=class{constructor(e){if(!e.sequelize)throw new Error("QueryGenerator initialized without options.sequelize");if(!e._dialect)throw new Error("QueryGenerator initialized without options._dialect");this.sequelize=e.sequelize,this.options=e.sequelize.options,this.dialect=e._dialect.name,this._dialect=e._dialect,this._initQuoteIdentifier()}extractTableDetails(e,r){return r=r||{},e=e||{},{schema:e.schema||r.schema||this.options.schema||"public",tableName:Ct.isPlainObject(e)?e.tableName:e,delimiter:e.delimiter||r.delimiter||"."}}addSchema(e){if(!e._schema)return e.tableName||e;let r=this;return{tableName:e.tableName||e,table:e.tableName||e,name:e.name||e,schema:e._schema,delimiter:e._schemaDelimiter||".",toString(){return r.quoteTable(this)}}}dropSchema(e,r){return this.dropTableQuery(e,r)}describeTableQuery(e,r,n){return`DESCRIBE ${this.quoteTable(this.addSchema({tableName:e,_schema:r,_schemaDelimiter:n}))};`}dropTableQuery(e){return`DROP TABLE IF EXISTS ${this.quoteTable(e)};`}renameTableQuery(e,r){return`ALTER TABLE ${this.quoteTable(e)} RENAME TO ${this.quoteTable(r)};`}populateInsertQueryReturnIntoBinds(){}insertQuery(e,r,n,i){i=i||{},Ct.defaults(i,this.options);let a={},s=i.bind||[],o=[],u=[],l=[],p=[],f=this.quoteTable(e),b=i.bindParam===void 0?this.bindParam(s):i.bindParam,O=[],M,m="",z="",y="",R="",w=!1,q="";if(n&&Ct.each(n,(I,U)=>{a[U]=I,I.field&&(a[I.field]=I)}),this._dialect.supports["DEFAULT VALUES"]?z+=" DEFAULT VALUES":this._dialect.supports["VALUES ()"]&&(z+=" VALUES ()"),(this._dialect.supports.returnValues||this._dialect.supports.returnIntoValues)&&i.returning){let I=this.generateReturnValues(n,i);u.push(...I.returnFields),this._dialect.supports.returnIntoValues&&l.push(...I.returnTypes),R=I.returningFragment,q=I.tmpTable||"",y=I.outputFragment||""}(Ct.get(this,["sequelize","options","dialectOptions","prependSearchPath"])||i.searchPath)&&(i.bindParam=!1),this._dialect.supports.EXCEPTION&&i.exception&&(i.bindParam=!1),r=Ge.removeNullValuesFromHash(r,this.options.omitNull);for(let I in r)if(Object.prototype.hasOwnProperty.call(r,I)){let U=r[I];o.push(this.quoteIdentifier(I)),a&&a[I]&&a[I].autoIncrement===!0&&U==null?this._dialect.supports.autoIncrement.defaultValue?this._dialect.supports.DEFAULT?p.push("DEFAULT"):p.push(this.escape(null)):o.splice(-1,1):(a&&a[I]&&a[I].autoIncrement===!0&&(w=!0),U instanceof Ge.SequelizeMethod||i.bindParam===!1?p.push(this.escape(U,a&&a[I]||void 0,{context:"INSERT"})):p.push(this.format(U,a&&a[I]||void 0,{context:"INSERT"},b)))}let C="";if(!Ct.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 I=i.upsertKeys.map(S=>this.quoteIdentifier(S)),U=i.updateOnDuplicate.map(S=>`${this.quoteIdentifier(S)}=EXCLUDED.${this.quoteIdentifier(S)}`),Y=["ON CONFLICT","(",I.join(","),")"];Ct.isEmpty(i.conflictWhere)||Y.push(this.whereQuery(i.conflictWhere,i)),Ct.isEmpty(U)?Y.push("DO NOTHING"):Y.push("DO UPDATE SET",U.join(",")),C=` ${Ge.joinSQLFragments(Y)}`}else{let I=i.updateOnDuplicate.map(U=>`${this.quoteIdentifier(U)}=VALUES(${this.quoteIdentifier(U)})`);if(Ct.isEmpty(I)&&i.upsertKeys&&I.push(...i.upsertKeys.map(U=>`${this.quoteIdentifier(U)}=${this.quoteIdentifier(U)}`)),Ct.isEmpty(I))throw new Error("No update values found for ON DUPLICATE KEY UPDATE clause, and no identifier fields could be found to use instead.");C+=`${this._dialect.supports.inserts.updateOnDuplicate} ${I.join(",")}`}let L={ignoreDuplicates:i.ignoreDuplicates?this._dialect.supports.inserts.ignoreDuplicates:"",onConflictDoNothing:i.ignoreDuplicates?this._dialect.supports.inserts.onConflictDoNothing:"",attributes:o.join(","),output:y,values:p.join(","),tmpTable:q};if(m=`${q}INSERT${L.ignoreDuplicates} INTO ${f} (${L.attributes})${L.output} VALUES (${L.values})${C}${L.onConflictDoNothing}${m}`,z=`${q}INSERT${L.ignoreDuplicates} INTO ${f}${L.output}${C}${L.onConflictDoNothing}${z}`,this._dialect.supports.EXCEPTION&&i.exception){let I="DROP FUNCTION IF EXISTS pg_temp.testfunc()";u.length===0&&u.push("*");let U=`$func_${WVt().replace(/-/g,"")}$`,Y=`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;",m=`CREATE OR REPLACE FUNCTION pg_temp.testfunc(OUT response ${f}, OUT sequelize_caught_exception text) RETURNS RECORD AS ${U} BEGIN ${m} RETURNING * INTO response; EXCEPTION ${i.exception} END ${U} LANGUAGE plpgsql; ${Y} ${I}`}else m+=R,z+=R;this._dialect.supports.returnIntoValues&&i.returning&&this.populateInsertQueryReturnIntoBinds(u,l,s.length,O,i),M=`${L.attributes.length?m:z}${O.join(",")};`,this._dialect.supports.finalTable&&(M=`SELECT * FROM FINAL TABLE(${L.attributes.length?m:z});`),w&&this._dialect.supports.autoIncrement.identityInsert&&(M=`SET IDENTITY_INSERT ${f} ON; ${M} SET IDENTITY_INSERT ${f} OFF;`);let j={query:M};return i.bindParam!==!1&&(j.bind=s),j}bulkInsertQuery(e,r,n,i){n=n||{},i=i||{};let a=[],s={},o=[],u="";for(let O of r)Ct.forOwn(O,(M,m)=>{o.includes(m)||o.push(m),i[m]&&i[m].autoIncrement===!0&&(s[m]=!0)});for(let O of r){let M=o.map(m=>this._dialect.supports.bulkDefault&&s[m]===!0?O[m]!=null?O[m]:"DEFAULT":this.escape(O[m],i[m],{context:"INSERT"}));a.push(`(${M.join(",")})`)}if(this._dialect.supports.inserts.updateOnDuplicate&&n.updateOnDuplicate)if(this._dialect.supports.inserts.updateOnDuplicate==" ON CONFLICT DO UPDATE SET"){let O=n.upsertKeys.map(z=>this.quoteIdentifier(z)),M=n.updateOnDuplicate.map(z=>`${this.quoteIdentifier(z)}=EXCLUDED.${this.quoteIdentifier(z)}`),m=!1;if(n.conflictWhere){if(!this._dialect.supports.inserts.onConflictWhere)throw new Error(`conflictWhere not supported for dialect ${this._dialect.name}`);m=this.whereQuery(n.conflictWhere,n)}u=["ON CONFLICT","(",O.join(","),")",m,"DO UPDATE SET",M.join(",")]}else{if(n.conflictWhere)throw new Error(`conflictWhere not supported for dialect ${this._dialect.name}`);let O=n.updateOnDuplicate.map(M=>`${this.quoteIdentifier(M)}=VALUES(${this.quoteIdentifier(M)})`);u=`${this._dialect.supports.inserts.updateOnDuplicate} ${O.join(",")}`}let l=n.ignoreDuplicates?this._dialect.supports.inserts.ignoreDuplicates:"",p=o.map(O=>this.quoteIdentifier(O)).join(","),f=n.ignoreDuplicates?this._dialect.supports.inserts.onConflictDoNothing:"",b="";if(this._dialect.supports.returnValues&&n.returning){let O=this.generateReturnValues(i,n);b+=O.returningFragment}return Ge.joinSQLFragments(["INSERT",l,"INTO",this.quoteTable(e),`(${p})`,"VALUES",a.join(","),u,f,b,";"])}updateQuery(e,r,n,i,a){i=i||{},Ct.defaults(i,this.options),r=Ge.removeNullValuesFromHash(r,i.omitNull,i);let s=[],o=[],u={},l="",p="",f="";(Ct.get(this,["sequelize","options","dialectOptions","prependSearchPath"])||i.searchPath)&&(i.bindParam=!1);let b=i.bindParam===void 0?this.bindParam(o):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)?f+=" AND ":f+=" WHERE ",f+=`rownum <= ${this.escape(i.limit)} `):f=` LIMIT ${this.escape(i.limit)} `),this._dialect.supports.returnValues&&i.returning){let z=this.generateReturnValues(a,i);f+=z.returningFragment,p=z.tmpTable||"",l=z.outputFragment||"",!this._dialect.supports.returnValues.output&&i.returning&&(i.mapToModel=!0)}a&&Ct.each(a,(z,y)=>{u[y]=z,z.field&&(u[z.field]=z)});for(let z in r){if(u&&u[z]&&u[z].autoIncrement===!0&&!this._dialect.supports.autoIncrement.update)continue;let y=r[z];y instanceof Ge.SequelizeMethod||i.bindParam===!1?s.push(`${this.quoteIdentifier(z)}=${this.escape(y,u&&u[z]||void 0,{context:"UPDATE"})}`):s.push(`${this.quoteIdentifier(z)}=${this.format(y,u&&u[z]||void 0,{context:"UPDATE"},b)}`)}let O=sS(Dd({},i),{bindParam:b});if(s.length===0)return"";let m={query:`${p}UPDATE ${this.quoteTable(e)} SET ${s.join(",")}${l} ${this.whereQuery(n,O)}${f}`.trim()};return i.bindParam!==!1&&(m.bind=o),m}arithmeticQuery(e,r,n,i,a,s){s=s||{},Ct.defaults(s,{returning:!0}),a=Ge.removeNullValuesFromHash(a,this.options.omitNull);let o="",u="";if(this._dialect.supports.returnValues&&s.returning){let p=this.generateReturnValues(null,s);o=p.outputFragment,u=p.returningFragment}let l=[];for(let p in i){let f=i[p],b=this.quoteIdentifier(p),O=this.escape(f);l.push(`${b}=${b}${e} ${O}`)}for(let p in a){let f=a[p],b=this.quoteIdentifier(p),O=this.escape(f);l.push(`${b}=${O}`)}return Ge.joinSQLFragments(["UPDATE",this.quoteTable(r),"SET",l.join(","),o,this.whereQuery(n),u])}addIndexQuery(e,r,n,i){n=n||{},Array.isArray(r)?n.fields=r:(n=r,r=void 0),n.prefix=n.prefix||i||e,n.prefix&&typeof n.prefix=="string"&&(n.prefix=n.prefix.replace(/\./g,"_"),n.prefix=n.prefix.replace(/("|')/g,""));let a=n.fields.map(u=>{if(u instanceof Ge.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: ${oS.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 p=u.operator||n.operator;p&&(l+=` ${p}`)}return this._dialect.supports.index.length&&u.length&&(l+=`(${u.length})`),u.order&&(l+=` ${u.order}`),l});n.name||(n=Ge.nameIndex(n,n.prefix)),n=$s._conformIndex(n),this._dialect.supports.index.type||delete n.type,n.where&&(n.where=this.whereQuery(n.where)),typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e);let s=this._dialect.supports.index.concurrently&&n.concurrently?"CONCURRENTLY":void 0,o;return this._dialect.supports.indexViaAlter?o=["ALTER TABLE",e,s,"ADD"]:o=["CREATE"],o=o.concat(n.unique?"UNIQUE":"",n.type,"INDEX",this._dialect.supports.indexViaAlter?void 0:s,this.quoteIdentifiers(n.name),this._dialect.supports.index.using===1&&n.using?`USING ${n.using}`:"",this._dialect.supports.indexViaAlter?void 0:`ON ${e}`,this._dialect.supports.index.using===2&&n.using?`USING ${n.using}`:"",`(${a.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),Ct.compact(o).join(" ")}addConstraintQuery(e,r){return typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e),Ge.joinSQLFragments(["ALTER TABLE",e,"ADD",this.getConstraintSnippet(e,r||{}),";"])}getConstraintSnippet(e,r){let n,i,a=r.fields.map(u=>{if(typeof u=="string")return this.quoteIdentifier(u);if(u instanceof Ge.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)}),s=a.join(", "),o=a.join("_");switch(r.type.toUpperCase()){case"UNIQUE":i=this.quoteIdentifier(r.name||`${e}_${o}_uk`),n=`CONSTRAINT ${i} UNIQUE (${s})`;break;case"CHECK":r.where=this.whereItemsQuery(r.where),i=this.quoteIdentifier(r.name||`${e}_${o}_ck`),n=`CONSTRAINT ${i} CHECK (${r.where})`;break;case"DEFAULT":if(r.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(r.name||`${e}_${o}_df`),n=`CONSTRAINT ${i} DEFAULT (${this.escape(r.defaultValue)}) FOR ${a[0]}`;break;case"PRIMARY KEY":i=this.quoteIdentifier(r.name||`${e}_${o}_pk`),n=`CONSTRAINT ${i} PRIMARY KEY (${s})`;break;case"FOREIGN KEY":let u=r.references;if(!u||!u.table||!(u.field||u.fields))throw new Error("references object with table and field must be specified");i=this.quoteIdentifier(r.name||`${e}_${o}_${u.table}_fk`);let l=typeof u.field<"u"?this.quoteIdentifier(u.field):u.fields.map(f=>this.quoteIdentifier(f)).join(", "),p=`${this.quoteTable(u.table)} (${l})`;n=`CONSTRAINT ${i} `,n+=`FOREIGN KEY (${s}) REFERENCES ${p}`,r.onUpdate&&(n+=` ON UPDATE ${r.onUpdate.toUpperCase()}`),r.onDelete&&(n+=` ON DELETE ${r.onDelete.toUpperCase()}`);break;default:throw new Error(`${r.type} is invalid.`)}return r.deferrable&&["UNIQUE","PRIMARY KEY","FOREIGN KEY"].includes(r.type.toUpperCase())&&(n+=` ${this.deferConstraintsQuery(r)}`),n}removeConstraintQuery(e,r){return typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e),Ge.joinSQLFragments(["ALTER TABLE",e,"DROP CONSTRAINT",this.quoteIdentifiers(r)])}quote(e,r,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 e=="string")return this.quoteIdentifiers(e);if(Array.isArray(e)){e.forEach((p,f)=>{let b=e[f-1],O,M;if(!b&&r!==void 0?M=r:b&&b instanceof mM&&(O=b,M=b.target),M&&M.prototype instanceof $s){let m,z;if(typeof p=="function"&&p.prototype instanceof $s?m=p:Ct.isPlainObject(p)&&p.model&&p.model.prototype instanceof $s&&(m=p.model,z=p.as),m&&(!z&&O&&O instanceof mM&&O.through&&O.through.model===m?p=new mM(M,m,{as:m.name}):(p=M.getAssociationForAlias(m,z),p||(p=M.getAssociationForAlias(m,m.name))),!(p instanceof mM)))throw new Error(oS.format("Unable to find a valid association for model, '%s'",m.name))}if(typeof p=="string"){let m=i.indexOf(p.toUpperCase());if(f>0&&m!==-1)p=this.sequelize.literal(` ${i[m]}`);else if(M&&M.prototype instanceof $s){if(M.associations!==void 0&&M.associations[p])p=M.associations[p];else if(M.rawAttributes!==void 0&&M.rawAttributes[p]&&p!==M.rawAttributes[p].field)p=M.rawAttributes[p].field;else if(p.includes(".")&&M.rawAttributes!==void 0){let z=p.split(".");if(M.rawAttributes[z[0]].type instanceof _M.JSON){let y=this.quoteIdentifiers(`${M.name}.${M.rawAttributes[z[0]].field}`),R=z.slice(1);p=this.jsonPathExtractionQuery(y,R),p=this.sequelize.literal(p)}}}}e[f]=p},this);let a=e.length,s=[],o,u=0;for(u=0;u<a-1&&(o=e[u],!(typeof o=="string"||o._modelAttribute||o instanceof Ge.SequelizeMethod));u++)o instanceof mM&&(s[u]=o.as);let l="";return u>0?l+=`${this.quoteIdentifier(s.join(n))}.`:typeof e[0]=="string"&&r&&(l+=`${this.quoteIdentifier(r.name)}.`),e.slice(u).forEach(p=>{l+=this.quote(p,r,n)},this),l}if(e._modelAttribute)return`${this.quoteTable(e.Model.name)}.${this.quoteIdentifier(e.fieldName)}`;if(e instanceof Ge.SequelizeMethod)return this.handleSequelizeMethod(e);throw Ct.isPlainObject(e)&&e.raw?new Error('The `{raw: "..."}` syntax is no longer supported.  Use `sequelize.literal` instead.'):new Error(`Unknown structure passed to order / group: ${oS.inspect(e)}`)}_initQuoteIdentifier(){this._quoteIdentifier=this.quoteIdentifier,this.quoteIdentifier=function(e,r){return e==="*"?e:this._quoteIdentifier(e,r)}}quoteIdentifier(e,r){throw new Error(`quoteIdentifier for Dialect "${this.dialect}" is not implemented`)}quoteIdentifiers(e){if(e.includes(".")){e=e.split(".");let r=e.slice(0,e.length-1).join("->"),n=e[e.length-1];return`${this.quoteIdentifier(r)}.${this.quoteIdentifier(n)}`}return this.quoteIdentifier(e)}quoteAttribute(e,r){return r&&e in r.rawAttributes?this.quoteIdentifier(e):this.quoteIdentifiers(e)}getAliasToken(){return"AS"}quoteTable(e,r){let n="";return r===!0&&(r=e.as||e.name||e),Ct.isObject(e)?this._dialect.supports.schemas?(e.schema&&(n+=`${this.quoteIdentifier(e.schema)}.`),n+=this.quoteIdentifier(e.tableName)):(e.schema&&(n+=e.schema+(e.delimiter||".")),n+=e.tableName,n=this.quoteIdentifier(n)):n=this.quoteIdentifier(e),r&&(n+=` ${this.getAliasToken()} ${this.quoteIdentifier(r)}`),n}escape(e,r,n){if(n=n||{},e!=null){if(e instanceof Ge.SequelizeMethod)return this.handleSequelizeMethod(e);if(r&&r.type&&(r.type instanceof _M.STRING&&["mysql","mariadb"].includes(this.dialect)&&["number","boolean"].includes(typeof e)&&(e=String(Number(e))),this.validate(e,r,n),r.type.stringify)){let i=a=>kqe.escape(a,this.options.timezone,this.dialect);if(e=r.type.stringify(e,{escape:i,field:r,timezone:this.options.timezone,operation:n.operation}),r.type.escape===!1)return e}}return kqe.escape(e,this.options.timezone,this.dialect)}bindParam(e){return r=>(e.push(r),`$${e.length}`)}format(e,r,n,i){if(n=n||{},e!=null){if(e instanceof Ge.SequelizeMethod)throw new Error("Cannot pass SequelizeMethod as a bind parameter - use escape instead");if(r&&r.type&&(this.validate(e,r,n),r.type.bindParam))return r.type.bindParam(e,{escape:Ct.identity,field:r,timezone:this.options.timezone,operation:n.operation,bindParam:i})}return i(e)}validate(e,r,n){if(this.typeValidation&&r.type.validate&&e)try{if(n.isList&&Array.isArray(e))for(let i of e)r.type.validate(i,n);else r.type.validate(e,n)}catch(i){throw i instanceof NH.ValidationError&&i.errors.push(new NH.ValidationErrorItem(i.message,"Validation error",r.fieldName,e,null,`${r.type.key} validator`)),i}}isIdentifierQuoted(e){return/^\s*(?:([`"'])(?:(?!\1).|\1{2})*\1\.?)+\s*$/i.test(e)}jsonPathExtractionQuery(e,r,n){let i=Ct.toPath(r),a,s=this.isIdentifierQuoted(e)?e:this.quoteIdentifier(e);switch(this.dialect){case"mysql":case"mariadb":case"sqlite":return this.dialect==="mysql"&&(i=i.map(u=>/\D/.test(u)?Ge.addTicks(u,'"'):u)),a=this.escape(["$"].concat(i).join(".").replace(/\.(\d+)(?:(?=\.)|$)/g,(u,l)=>`[${l}]`)),this.dialect==="sqlite"?`json_extract(${s},${a})`:`json_unquote(json_extract(${s},${a}))`;case"postgres":let o=n?"#>":"#>>";return a=this.escape(`{${i.join(",")}}`),`(${s}${o}${a})`;default:throw new Error(`Unsupported ${this.dialect} for JSON operations`)}}selectQuery(e,r,n){r=r||{};let i=r.limit,a=[],s=[],o=r.subQuery===void 0?i&&r.hasMultiAssociation:r.subQuery,u={main:r.attributes&&r.attributes.slice(),subQuery:null},l={name:e,quotedName:null,as:null,model:n},p={names:l,options:r,subQuery:o},f=[],b=[],O;if(this.options.minifyAliases&&!r.aliasesMapping&&(r.aliasesMapping=new Map,r.aliasesByTable={},r.includeAliases=new Map),r.tableAs?l.as=this.quoteIdentifier(r.tableAs):!Array.isArray(l.name)&&l.model&&(l.as=this.quoteIdentifier(l.model.name)),l.quotedName=Array.isArray(l.name)?e.map(m=>Array.isArray(m)?this.quoteTable(m[0],m[1]):this.quoteTable(m,!0)).join(", "):this.quoteTable(l.name),o&&u.main)for(let m of l.model.primaryKeyAttributes)u.main.some(z=>m===z||m===z[0]||m===z[1])||u.main.push(l.model.rawAttributes[m].field?[m,l.model.rawAttributes[m].field]:m);if(u.main=this.escapeAttributes(u.main,r,l.as),u.main=u.main||(r.include?[`${l.as}.*`]:["*"]),(o||r.groupedLimit)&&(u.subQuery=u.main,u.main=[`${l.as||l.quotedName}.*`]),r.include)for(let m of r.include){if(m.separate)continue;let z=this.generateInclude(m,{externalAs:l.as,internalAs:l.as},p);b=b.concat(z.subQuery),f=f.concat(z.mainQuery),z.attributes.main.length>0&&(u.main=Ct.uniq(u.main.concat(z.attributes.main))),z.attributes.subQuery.length>0&&(u.subQuery=Ct.uniq(u.subQuery.concat(z.attributes.subQuery)))}if(o)s.push(this.selectFromTableFragment(r,l.model,u.subQuery,l.quotedName,l.as)),s.push(b.join(""));else{if(r.groupedLimit){l.as||(l.as=l.quotedName);let m=Dd({},r.where),z,y,R,w=l.as;if(typeof r.groupedLimit.on=="string"?y=r.groupedLimit.on:r.groupedLimit.on instanceof kVt&&(y=r.groupedLimit.on.foreignKeyField),r.groupedLimit.on instanceof PVt){w=r.groupedLimit.on.manyFromSource.as;let j=$s._validateIncludedElements({include:[{association:r.groupedLimit.on.manyFromSource,duplicating:!1,required:!0,where:Dd({[Ce.placeholder]:!0},r.groupedLimit.through&&r.groupedLimit.through.where)}],model:n});r.hasJoin=!0,r.hasMultiAssociation=!0,r.includeMap=Object.assign(j.includeMap,r.includeMap),r.includeNames=j.includeNames.concat(r.includeNames||[]),R=j.include,Array.isArray(r.order)&&(r.order.forEach((I,U)=>{Array.isArray(I)&&(I=I[0]);let Y=`subquery_order_${U}`;r.attributes.push([I,Y]),Y=this.sequelize.literal(this.quote(Y)),Array.isArray(r.order[U])?r.order[U][0]=Y:r.order[U]=Y}),z=r.order)}else z=r.order,this._dialect.supports.topLevelOrderByRequired||delete r.order,m[Ce.placeholder]=!0;let q=`SELECT * FROM (${this.selectQuery(e,{attributes:r.attributes,offset:r.offset,limit:r.groupedLimit.limit,order:z,aliasesMapping:r.aliasesMapping,aliasesByTable:r.aliasesByTable,where:m,include:R,model:n},n).replace(/;$/,"")}) ${this.getAliasToken()} sub`,C=this.whereItemQuery(Ce.placeholder,!0,{model:n}),L=q.indexOf(C);a.push(this.selectFromTableFragment(r,l.model,u.main,`(${r.groupedLimit.values.map(j=>{let I;return y&&(I={[y]:j}),R&&(I={[r.groupedLimit.on.foreignIdentifierField]:j}),Ge.spliceStr(q,L,C.length,this.getWhereConditions(I,w))}).join(this._dialect.supports["UNION ALL"]?" UNION ALL ":" UNION ")})`,l.as))}else a.push(this.selectFromTableFragment(r,l.model,u.main,l.quotedName,l.as));a.push(f.join(""))}if(Object.prototype.hasOwnProperty.call(r,"where")&&!r.groupedLimit&&(r.where=this.getWhereConditions(r.where,l.as||e,n,r),r.where&&(o?s.push(` WHERE ${r.where}`):(a.push(` WHERE ${r.where}`),a.forEach((m,z)=>{m.startsWith("SELECT")&&(a[z]=this.selectFromTableFragment(r,n,u.main,l.quotedName,l.as,r.where))})))),r.group&&(r.group=Array.isArray(r.group)?r.group.map(m=>this.aliasGrouping(m,n,l.as,r)).join(", "):this.aliasGrouping(r.group,n,l.as,r),o&&r.group?s.push(` GROUP BY ${r.group}`):r.group&&a.push(` GROUP BY ${r.group}`)),Object.prototype.hasOwnProperty.call(r,"having")&&(r.having=this.getWhereConditions(r.having,e,n,r,!1),r.having&&(o?s.push(` HAVING ${r.having}`):a.push(` HAVING ${r.having}`))),r.order){let m=this.getQueryOrders(r,n,o);m.mainQueryOrder.length&&a.push(` ORDER BY ${m.mainQueryOrder.join(", ")}`),m.subQueryOrder.length&&s.push(` ORDER BY ${m.subQueryOrder.join(", ")}`)}let M=this.addLimitAndOffset(r,l.model);if(M&&!r.groupedLimit&&(o?s.push(M):a.push(M)),o?(this._throwOnEmptyAttributes(u.main,{modelName:n&&n.name,as:l.as}),O=`SELECT ${u.main.join(", ")} FROM (${s.join("")}) ${this.getAliasToken()} ${l.as}${f.join("")}${a.join("")}`):O=a.join(""),r.lock&&this._dialect.supports.lock){let m=r.lock;typeof r.lock=="object"&&(m=r.lock.level),this._dialect.supports.lockKey&&["KEY SHARE","NO KEY UPDATE"].includes(m)?O+=` FOR ${m}`:m==="SHARE"?O+=` ${this._dialect.supports.forShare}`:O+=" FOR UPDATE",this._dialect.supports.lockOf&&r.lock.of&&r.lock.of.prototype instanceof $s&&(O+=` OF ${this.quoteTable(r.lock.of.name)}`),this._dialect.supports.skipLocked&&r.skipLocked&&(O+=" SKIP LOCKED")}return`${O};`}aliasGrouping(e,r,n,i){let a=Array.isArray(e)?e[0]:e;return this.quote(this._getAliasForField(n,a,i)||a,r)}escapeAttributes(e,r,n){return e&&e.map(i=>{let a=!0;if(i instanceof Ge.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 Ge.SequelizeMethod)i[0]=this.handleSequelizeMethod(i[0]),a=!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/iyzmuwbu/simotp.xyz/index.js:136:7832)
    at new t (/home/iyzmuwbu/simotp.xyz/index.js:148:66644)
    at new Gi (/home/iyzmuwbu/simotp.xyz/index.js:148:73185)
    at new t (/home/iyzmuwbu/simotp.xyz/index.js:148:229204)
    at Object.<anonymous> (/home/iyzmuwbu/simotp.xyz/index.js:3371:28474)
    at Module._compile (node:internal/modules/cjs/loader:1469:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1548:10)
    at Module.load (node:internal/modules/cjs/loader:1288:32)
    at Module._load (node:internal/modules/cjs/loader:1104:12)
    at Module.require (node:internal/modules/cjs/loader:1311:19)

Node.js v20.17.0
Exception ignored in: <_io.TextIOWrapper name='<stdout>' mode='w' encoding='utf-8'>
BrokenPipeError: [Errno 32] Broken pipe
/home2/kzgqvuqk/sendotp.store/index.js:136
`}};$I.AggregateError=OH});var dqe=A(JI=>{"use strict";Object.defineProperty(JI,"__esModule",{value:!0});JI.Deferred=void 0;var jQt=MH(),_H=class{constructor(){this._promise=new Promise((e,r)=>{this._reject=r,this._resolve=e})}registerTimeout(e,r){this._timeout||(this._timeout=setTimeout(()=>{r(),this.reject(new jQt.TimeoutError("Operation timeout"))},e))}_clearTimeout(){this._timeout&&clearTimeout(this._timeout)}resolve(e){this._clearTimeout(),this._resolve(e)}reject(e){this._clearTimeout(),this._reject(e)}promise(){return this._promise}};JI.Deferred=_H});var bqe=A(ZI=>{"use strict";Object.defineProperty(ZI,"__esModule",{value:!0});ZI.Pool=void 0;var QQt=dqe(),VQt=AH(),mH=class{constructor(e){if(this.log=!1,!e.create)throw new Error("create function is required");if(!e.destroy)throw new Error("destroy function is required");if(!e.validate)throw new Error("validate function is required");if(typeof e.min!="number"||e.min<0||e.min!==Math.round(e.min))throw new Error("min must be an integer >= 0");if(typeof e.max!="number"||e.max<=0||e.max!==Math.round(e.max))throw new Error("max must be an integer > 0");if(e.min>e.max)throw new Error("max is smaller than min");if(e.maxUses!==void 0&&(typeof e.maxUses!="number"||e.maxUses<0))throw new Error("maxUses must be an integer >= 0");this.idleTimeoutMillis=e.idleTimeoutMillis||3e4,this.acquireTimeoutMillis=e.acquireTimeoutMillis||3e4,this.reapIntervalMillis=e.reapIntervalMillis||1e3,this.maxUsesPerResource=e.maxUses||1/0,this.log=e.log||!1,this._factory=e,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(e,r){typeof this.log=="function"?this.log(e,r):this.log&&console.log(`${r.toUpperCase()} pool ${this.name||""} - ${e}`)}_removeIdle(){let e=[],r=Date.now(),n,i=this._availableObjects.length,a=this.size-this.minSize,s;for(this._removeIdleScheduled=!1,n=0;n<i&&a>e.length;n++)s=this._availableObjects[n].timeout,r>=s&&(this._log("removeIdle() destroying obj - now:"+r+" timeout:"+s,"verbose"),e.push(this._availableObjects[n].resource));e.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 e=null,r=this._pendingAcquires.length;if(this._log(`dispense() clients=${r} available=${this._availableObjects.length}`,"info"),!(r<1)){for(;this._availableObjects.length>0;){if(this._log("dispense() - reusing obj","verbose"),e=this._availableObjects[this._availableObjects.length-1],!this._factory.validate(e.resource)){this.destroy(e.resource);continue}return this._availableObjects.pop(),this._addResourceToInUseObjects(e.resource,e.useCount),this._pendingAcquires.shift().resolve(e.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(e=>{let r=this._pendingAcquires.shift();r?(this._addResourceToInUseObjects(e,0),r.resolve(e)):this._addResourceToAvailableObjects(e,0)}).catch(e=>{let r=this._pendingAcquires.shift();this._count-=1,this._count<0&&(this._count=0),r&&r.reject(e),process.nextTick(()=>{this._dispense()})})}_addResourceToAvailableObjects(e,r){let n={resource:e,useCount:r,timeout:Date.now()+this.idleTimeoutMillis};this._availableObjects.push(n),this._dispense(),this._scheduleRemoveIdle()}_addResourceToInUseObjects(e,r){let n={resource:e,useCount:r};this._inUseObjects.push(n)}_ensureMinimum(){let e,r;if(!this._draining&&this.size<this.minSize)for(r=this.minSize-this.size,e=0;e<r;e++)this._createResource()}acquire(){if(this._draining)return Promise.reject(new Error("pool is draining and cannot accept work"));let e=new QQt.Deferred;return e.registerTimeout(this.acquireTimeoutMillis,()=>{this._pendingAcquires=this._pendingAcquires.filter(r=>r!==e)}),this._pendingAcquires.push(e),this._dispense(),e.promise()}release(e){if(this._availableObjects.some(i=>i.resource===e)){this._log("release called twice for the same resource: "+new Error().stack,"error");return}let r=this._inUseObjects.findIndex(i=>i.resource===e);if(r<0){this._log("attempt to release an invalid resource: "+new Error().stack,"error");return}let n=this._inUseObjects[r];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(r,1),this._addResourceToAvailableObjects(n.resource,n.useCount))}async destroy(e){let r=this._availableObjects.length,n=this._inUseObjects.length;if(this._availableObjects=this._availableObjects.filter(i=>i.resource!==e),this._inUseObjects=this._inUseObjects.filter(i=>i.resource!==e),r===this._availableObjects.length&&n===this._inUseObjects.length){this._ensureMinimum();return}this._count-=1,this._count<0&&(this._count=0);try{await this._factory.destroy(e)}finally{this._ensureMinimum(),this._draining||process.nextTick(()=>{this._dispense()})}}drain(){this._log("draining","info"),this._draining=!0;let e=r=>{if(this._pendingAcquires.length>0){this._dispense(),setTimeout(()=>{e(r)},100);return}if(this._availableObjects.length!==this._count){setTimeout(()=>{e(r)},100);return}r()};return new Promise(r=>e(r))}async destroyAllNow(){this._log("force destroying all objects","info"),this._removeIdleScheduled=!1,clearTimeout(this._removeIdleTimer);let e=this._availableObjects.map(n=>n.resource),r=[];for(let n of e)try{await this.destroy(n)}catch(i){this._log("Error destroying resource: "+i.stack,"error"),r.push(i)}if(r.length>0)throw new VQt.AggregateError(r)}};ZI.Pool=mH});var hqe=A(sp=>{"use strict";Object.defineProperty(sp,"__esModule",{value:!0});sp.Pool=sp.AggregateError=sp.TimeoutError=void 0;var HQt=MH();Object.defineProperty(sp,"TimeoutError",{enumerable:!0,get:function(){return HQt.TimeoutError}});var XQt=AH();Object.defineProperty(sp,"AggregateError",{enumerable:!0,get:function(){return XQt.AggregateError}});var YQt=bqe();Object.defineProperty(sp,"Pool",{enumerable:!0,get:function(){return YQt.Pool}})});var uu=A((uzr,eS)=>{"use strict";var{Pool:EH,TimeoutError:KQt}=hqe(),op=it(),zH=Ks(),$Qt=v0(),{logger:JQt}=Gr(),ZQt=dM(),Zo=JQt.debugContext("pool"),$g=class{constructor(e,r){let n=op.cloneDeep(r.config);if(this.sequelize=r,this.config=n,this.dialect=e,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=op.defaults(n.pool||{},{max:5,min:0,idle:1e4,acquire:6e4,evict:1e3,validate:this._validate.bind(this)}),this.initPools()}refreshTypeParser(e){op.each(e,r=>{if(Object.prototype.hasOwnProperty.call(r,"parse"))if(r.types[this.dialectName])this._refreshTypeParser(r);else throw new Error(`Parse function not supported for type ${r.key} in dialect ${this.dialectName}`)})}_loadDialectModule(e){try{return this.sequelize.config.dialectModulePath?require(this.sequelize.config.dialectModulePath):this.sequelize.config.dialectModule?this.sequelize.config.dialectModule:require(e)}catch(r){throw r.code==="MODULE_NOT_FOUND"?this.sequelize.config.dialectModulePath?new Error(`Unable to find dialect at ${this.sequelize.config.dialectModulePath}`):new Error(`Please install ${e} package manually`):r}}async _onProcessExit(){if(this.pool)return await this.pool.drain(),Zo("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 e=this.config;if(!e.replication){this.pool=new EH({name:"sequelize",create:()=>this._connect(e),destroy:async n=>{let i=await this._disconnect(n);return Zo("connection destroy"),i},validate:e.pool.validate,max:e.pool.max,min:e.pool.min,acquireTimeoutMillis:e.pool.acquire,idleTimeoutMillis:e.pool.idle,reapIntervalMillis:e.pool.evict,maxUses:e.pool.maxUses}),Zo(`pool created with max/min: ${e.pool.max}/${e.pool.min}, no replication`);return}Array.isArray(e.replication.read)||(e.replication.read=[e.replication.read]),e.replication.write=op.defaults(e.replication.write,op.omit(e,"replication")),e.replication.read=e.replication.read.map(n=>op.defaults(n,op.omit(this.config,"replication")));let r=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),Zo("connection destroy")},destroyAllNow:async()=>{await Promise.all([this.pool.read.destroyAllNow(),this.pool.write.destroyAllNow()]),Zo("all connections destroyed")},drain:async()=>Promise.all([this.pool.write.drain(),this.pool.read.drain()]),read:new EH({name:"sequelize:read",create:async()=>{let n=r++%e.replication.read.length,i=await this._connect(e.replication.read[n]);return i.queryType="read",i},destroy:n=>this._disconnect(n),validate:e.pool.validate,max:e.pool.max,min:e.pool.min,acquireTimeoutMillis:e.pool.acquire,idleTimeoutMillis:e.pool.idle,reapIntervalMillis:e.pool.evict,maxUses:e.pool.maxUses}),write:new EH({name:"sequelize:write",create:async()=>{let n=await this._connect(e.replication.write);return n.queryType="write",n},destroy:n=>this._disconnect(n),validate:e.pool.validate,max:e.pool.max,min:e.pool.min,acquireTimeoutMillis:e.pool.acquire,idleTimeoutMillis:e.pool.idle,reapIntervalMillis:e.pool.evict,maxUses:e.pool.maxUses})},Zo(`pool created with max/min: ${e.pool.max}/${e.pool.min}, with replication`)}async getConnection(e){e=e||{},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 a=await this.sequelize.databaseVersion(i),s=op.get(zH.coerce(a),"version")||a;this.sequelize.options.databaseVersion=zH.valid(s)?s:this.dialect.defaultVersion}return zH.lt(this.sequelize.options.databaseVersion,this.dialect.defaultVersion)&&(ZQt.unsupportedEngine(),Zo(`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 r;try{await this.sequelize.runHooks("beforePoolAcquire",e),r=await this.pool.acquire(e.type,e.useMaster),await this.sequelize.runHooks("afterPoolAcquire",r,e)}catch(n){throw n instanceof KQt?new $Qt.ConnectionAcquireTimeoutError(n):n}return Zo("connection acquired"),r}releaseConnection(e){this.pool.release(e),Zo("connection released")}async destroyConnection(e){await this.pool.destroy(e),Zo(`connection ${e.uuid} destroyed`)}async _connect(e){await this.sequelize.runHooks("beforeConnect",e);let r=await this.dialect.connectionManager.connect(e);return await this.sequelize.runHooks("afterConnect",r,e),r}async _disconnect(e){return await this.sequelize.runHooks("beforeDisconnect",e),await this.dialect.connectionManager.disconnect(e),this.sequelize.runHooks("afterDisconnect",e)}_validate(e){return this.dialect.connectionManager.validate?this.dialect.connectionManager.validate(e):!0}};eS.exports=$g;eS.exports.ConnectionManager=$g;eS.exports.default=$g});var ss=A((lzr,Mqe)=>{"use strict";var Jg=new Map;Mqe.exports=t=>(Jg.has(t)||Jg.set(t,new Map),{clear(){Jg.get(t).clear()},refresh(e){for(let r of e.types[t])Jg.get(t).set(r,e.parse)},get(e){return Jg.get(t).get(e)}})});var mqe=A((pzr,rS)=>{"use strict";var eVt=Object.defineProperty,Oqe=Object.getOwnPropertySymbols,tVt=Object.prototype.hasOwnProperty,rVt=Object.prototype.propertyIsEnumerable,Aqe=(t,e,r)=>e in t?eVt(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,nVt=(t,e)=>{for(var r in e||(e={}))tVt.call(e,r)&&Aqe(t,r,e[r]);if(Oqe)for(var r of Oqe(e))rVt.call(e,r)&&Aqe(t,r,e[r]);return t},iVt=Ks(),aVt=uu(),AM=v0(),{logger:sVt}=Gr(),oVt=R0().mariadb,cVt=Xo(),_qe=sVt.debugContext("connection:mariadb"),tS=ss()("mariadb"),Zg=class t extends aVt{constructor(e,r){r.config.port=r.config.port||3306,super(e,r),this.lib=this._loadDialectModule("mariadb"),this.refreshTypeParser(oVt)}static _typecast(e,r){return tS.get(e.type)?tS.get(e.type)(e,this.sequelize.options,r):r()}_refreshTypeParser(e){tS.refresh(e)}_clearTypeParser(){tS.clear()}async connect(e){let r=this.sequelize.options.timezone;r=/\//.test(r)?cVt.tz(r).format("Z"):r;let n=nVt({host:e.host,port:e.port,user:e.username,password:e.password,database:e.database,timezone:r,typeCast:t._typecast.bind(this),bigNumberStrings:!1,supportBigNumbers:!0,foundRows:!1},e.dialectOptions);this.sequelize.config.keepDefaultTimezone||(n.initSql?(Array.isArray(n.initSql)||(n.initSql=[n.initSql]),n.initSql.push(`SET time_zone = '${r}'`)):n.initSql=`SET time_zone = '${r}'`);try{let i=await this.lib.createConnection(n);return this.sequelize.options.databaseVersion=iVt.coerce(i.serverVersion()).version,_qe("connection acquired"),i.on("error",a=>{switch(a.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 AM.ConnectionRefusedError(i);case"ER_ACCESS_DENIED_ERROR":case"ER_ACCESS_DENIED_NO_PASSWORD_ERROR":throw new AM.AccessDeniedError(i);case"ENOTFOUND":throw new AM.HostNotFoundError(i);case"EHOSTUNREACH":case"ENETUNREACH":case"EADDRNOTAVAIL":throw new AM.HostNotReachableError(i);case"EINVAL":throw new AM.InvalidConnectionError(i);default:throw new AM.ConnectionError(i)}}}async disconnect(e){if(!e.isValid()){_qe("connection tried to disconnect but was already at CLOSED state");return}return await e.end()}validate(e){return e&&e.isValid()}};rS.exports=Zg;rS.exports.ConnectionManager=Zg;rS.exports.default=Zg});var lu=A((fzr,nS)=>{"use strict";var uVt=Object.defineProperty,Eqe=Object.getOwnPropertySymbols,lVt=Object.prototype.hasOwnProperty,pVt=Object.prototype.propertyIsEnumerable,zqe=(t,e,r)=>e in t?uVt(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,fVt=(t,e)=>{for(var r in e||(e={}))lVt.call(e,r)&&zqe(t,r,e[r]);if(Eqe)for(var r of Eqe(e))pVt.call(e,r)&&zqe(t,r,e[r]);return t},cp=it(),dVt=zg(),ma=Pi(),bVt=wg(),hVt=dM(),MVt=(oM(),xc(sM)).v4,{safeStringifyJson:gqe}=G0(),ey=class t{constructor(e,r,n){this.uuid=MVt(),this.connection=e,this.instance=n.instance,this.model=n.model,this.sequelize=r,this.options=fVt({plain:!1,raw:!1,logging:console.log},n),this.checkLoggingOption(),n.rawErrors&&(this.formatError=t.prototype.formatError)}static formatBindParameters(e,r,n,i,a){if(!r)return[e,[]];if(a=a||{},typeof i!="function"&&(a=i||{},i=void 0),!i)a.skipValueReplace?i=(u,l,p)=>{if(p[l]!==void 0)return u}:i=(u,l,p,f,b)=>{if(p[l]!==void 0)return dVt.escape(p[l],f,b)};else if(a.skipValueReplace){let u=i;i=(l,p,f,b,O,M)=>{if(u(l,p,f,b,O,M)!==void 0)return l}}let s=null,o=Array.isArray(r);return e=e.replace(/\B\$(\$|\w+)/g,(u,l)=>{if(l==="$")return a.skipUnescape?u:l;let p;if(o?l.match(/^[1-9]\d*$/)&&(l=l-1,p=i(u,l,r,s,n,a)):l.match(/^\d*$/)||(p=i(u,l,r,s,n,a)),p===void 0)throw new Error(`Named bind parameter "${u}" has no value in the given object.`);return p}),[e,[]]}formatError(e,r){return e.stack=r,e}run(){throw new Error("The run method wasn't overwritten!")}checkLoggingOption(){this.options.logging===!0&&(hVt.noTrueLogging(),this.options.logging=console.log)}getInsertIdField(){return"insertId"}getUniqueConstraintErrorMessage(e){let r=e?`${e} must be unique`:"Must be unique";if(e&&this.model)for(let n of Object.keys(this.model.uniqueKeys))this.model.uniqueKeys[n].fields.includes(e.replace(/"/g,""))&&this.model.uniqueKeys[n].msg&&(r=this.model.uniqueKeys[n].msg);return r}isRawQuery(){return this.options.type===ma.RAW}isVersionQuery(){return this.options.type===ma.VERSION}isUpsertQuery(){return this.options.type===ma.UPSERT}isInsertQuery(e,r){let n=!0;return this.options.type===ma.INSERT?!0:(n=n&&this.sql.toLowerCase().startsWith("insert into"),n=n&&(!e||Object.prototype.hasOwnProperty.call(e,this.getInsertIdField())),n=n&&(!r||Object.prototype.hasOwnProperty.call(r,this.getInsertIdField())),n)}handleInsertQuery(e,r){if(this.instance){let n=this.model.autoIncrementAttribute,i=null;i=i||e&&e[this.getInsertIdField()],i=i||r&&r[this.getInsertIdField()],this.instance[n]=i}}isShowTablesQuery(){return this.options.type===ma.SHOWTABLES}handleShowTablesQuery(e){return cp.flatten(e.map(r=>Object.values(r)))}isShowIndexesQuery(){return this.options.type===ma.SHOWINDEXES}isShowConstraintsQuery(){return this.options.type===ma.SHOWCONSTRAINTS}isDescribeQuery(){return this.options.type===ma.DESCRIBE}isSelectQuery(){return this.options.type===ma.SELECT}isBulkUpdateQuery(){return this.options.type===ma.BULKUPDATE}isBulkDeleteQuery(){return this.options.type===ma.BULKDELETE}isForeignKeysQuery(){return this.options.type===ma.FOREIGNKEYS}isUpdateQuery(){return this.options.type===ma.UPDATE}handleSelectQuery(e){let r=null;if(this.options.fieldMap){let n=this.options.fieldMap;e=e.map(i=>cp.reduce(n,(a,s,o)=>(a[o]!==void 0&&s!==o&&(a[s]=a[o],delete a[o]),a),i))}return this.options.raw?r=e.map(n=>{let i={};for(let a in n)Object.prototype.hasOwnProperty.call(n,a)&&(i[a]=n[a]);return this.options.nest&&(i=bVt.transform(i)),i}):this.options.hasJoin===!0?(e=t._groupJoinData(e,{model:this.model,includeMap:this.options.includeMap,includeNames:this.options.includeNames},{checkExisting:this.options.hasMultiAssociation}),r=this.model.bulkBuild(e,{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})):r=this.model.bulkBuild(e,{isNewRecord:!1,raw:!0,attributes:this.options.originalAttributes||this.options.attributes}),this.options.plain&&(r=r.length===0?null:r[0]),r}isShowOrDescribeQuery(){let e=!1;return e=e||this.sql.toLowerCase().startsWith("show"),e=e||this.sql.toLowerCase().startsWith("describe"),e}isCallQuery(){return this.sql.toLowerCase().startsWith("call")}_logQuery(e,r,n){let{connection:i,options:a}=this,s=this.sequelize.options.benchmark||a.benchmark,o=this.sequelize.options.logQueryParameters||a.logQueryParameters,u=Date.now(),l="";if(o&&n){let b=e.endsWith(";")?"":";",O;Array.isArray(n)?O=n.map(M=>gqe(M)).join(", "):O=gqe(n),l=`${b} ${O}`}let p=`(${i.uuid||"default"}): ${e}${l}`,f=`Executing ${p}`;return r(f),s||this.sequelize.log(`Executing ${p}`,a),()=>{let b=`Executed ${p}`;r(b),s&&this.sequelize.log(b,Date.now()-u,a)}}static _groupJoinData(e,r,n){if(!e.length)return[];let i,a,s,o,u,l,p=e.length,f,b,O,M,m,z,y,R,w=n.checkExisting,q,C,L,j=w?[]:new Array(p),I={},U={},Y,S,te,V,D,P,F,re,ee=Q=>{Object.prototype.hasOwnProperty.call(P.includeMap,Q)&&(U[b]=P=P.includeMap[Q],re?re=`${re}.${Q}`:re=Q,U[re]=P)},Ae={},ge=(Q,ae)=>(Object.prototype.hasOwnProperty.call(ae,Q)||(ae[Q]=Q.substr(0,Q.lastIndexOf("."))),ae[Q]),we={},Qe=Q=>{if(!Object.prototype.hasOwnProperty.call(we,Q)){let ae=Q.lastIndexOf(".");we[Q]=Q.substr(ae===-1?0:ae+1)}return we[Q]},de={},tt=Q=>{if(!Object.prototype.hasOwnProperty.call(de,Q)){let ae=ge(Q,Ae);Object.prototype.hasOwnProperty.call(de,ae)||(de[ae]=ae?ae.split("."):[]),de[Q]=de[ae]}return de[Q]},je={},Ee=Q=>{if(!Object.prototype.hasOwnProperty.call(je,Q)){let ae=tt(Q),le=ae.length;je[Q]=le?ae[le-1]:""}return je[Q]},Ze=Q=>{let ae=cp.chain(Q.uniqueKeys);return ae=ae.result(`${ae.findKey()}.fields`).map(le=>cp.findKey(Q.attributes,Oe=>Oe.field===le)).value(),ae},Ke=Q=>Q instanceof Buffer?Q.toString("hex"):Q,_e,We,oe;for(u=0;u<p;u++){if(l=e[u],u===0&&(f=cp.sortBy(Object.keys(l),Q=>[Q.split(".").length]),M=f.length),w){if(R=!1,o=r.model.primaryKeyAttributes.length,L="",o===1)L=Ke(l[r.model.primaryKeyAttributes[0]]);else if(o>1)for(s=0;s<o;s++)L+=Ke(l[r.model.primaryKeyAttributes[s]]);else if(!cp.isEmpty(r.model.uniqueKeys))for(We=Ze(r.model),s=0;s<We.length;s++)L+=l[We[s]]}for(y=z={},V=void 0,O=0;O<M;O++){if(b=f[O],S=ge(b,Ae),Y=tt(b),u===0&&!Object.prototype.hasOwnProperty.call(U,b)&&(Y.length?(P=r,re=void 0,Y.forEach(ee)):U[b]=U[""]=r),V!==void 0&&V!==Y){if(w){if(a=V.length,F=null,C=null,a)for(i=0;i<a;i++){if(oe=F?`${F}.${V[i]}`:V[i],_e=U[oe].model.primaryKeyAttributes,o=_e.length,q=oe,o===1)q+=Ke(l[`${oe}.${_e[0]}`]);else if(o>1)for(s=0;s<o;s++)q+=Ke(l[`${oe}.${_e[s]}`]);else if(!cp.isEmpty(U[oe].model.uniqueKeys))for(We=Ze(U[oe].model),s=0;s<We.length;s++)q+=l[`${oe}.${We[s]}`];C||(C=L),q=C+q,F=oe,i<a-1&&(C=q)}else q=L;q===L?I[q]?R=!0:I[q]=z:I[q]||(F=I[C],D=Ee(m),U[m].association.isSingleAssociation?F&&(F[D]=I[q]=z):(F[D]||(F[D]=[]),F[D].push(I[q]=z))),z={}}else if(P=y,a=Y.length,a)for(i=0;i<a;i++)i===a-1&&(z=P[Y[i]]={}),P=P[Y[i]]||{}}z[Qe(b)]=l[b],m=b,V=Y,te=S}if(w){if(a=V.length,F=null,C=null,a)for(i=0;i<a;i++){if(oe=F?`${F}.${V[i]}`:V[i],_e=U[oe].model.primaryKeyAttributes,o=_e.length,q=oe,o===1)q+=Ke(l[`${oe}.${_e[0]}`]);else if(o>0)for(s=0;s<o;s++)q+=Ke(l[`${oe}.${_e[s]}`]);else if(!cp.isEmpty(U[oe].model.uniqueKeys))for(We=Ze(U[oe].model),s=0;s<We.length;s++)q+=l[`${oe}.${We[s]}`];C||(C=L),q=C+q,F=oe,i<a-1&&(C=q)}else q=L;q===L?I[q]?R=!0:I[q]=z:I[q]||(F=I[C],D=Ee(m),U[m].association.isSingleAssociation?F&&(F[D]=I[q]=z):(F[D]||(F[D]=[]),F[D].push(I[q]=z))),R||j.push(y)}else j[u]=y}return j}};nS.exports=ey;nS.exports.AbstractQuery=ey;nS.exports.default=ey});var Iqe=A((dzr,vqe)=>{"use strict";var OVt=Object.defineProperty,yqe=Object.getOwnPropertySymbols,AVt=Object.prototype.hasOwnProperty,_Vt=Object.prototype.propertyIsEnumerable,Rqe=(t,e,r)=>e in t?OVt(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,mVt=(t,e)=>{for(var r in e||(e={}))AVt.call(e,r)&&Rqe(t,r,e[r]);if(yqe)for(var r of yqe(e))_Vt.call(e,r)&&Rqe(t,r,e[r]);return t},Nqe=lu(),iS=v0(),Tqe=it(),gH=R0(),{logger:EVt}=Gr(),zVt=1062,gVt=1213,wqe=1451,yVt=1452,qqe=EVt.debugContext("sql:mariadb"),yH=class extends Nqe{constructor(e,r,n){super(e,r,mVt({showWarnings:!1},n))}static formatBindParameters(e,r,n){let i=[],a=(s,o,u)=>{if(u[o]!==void 0)return i.push(u[o]),"?"};return e=Nqe.formatBindParameters(e,r,n,a)[0],[e,i.length>0?i:void 0]}async run(e,r){this.sql=e;let{connection:n,options:i}=this,a=this.sequelize.options.showWarnings||i.showWarnings,s=this._logQuery(e,qqe,r);r&&qqe("parameters(%j)",r);let o,u=new Error;try{o=await n.query(this.sql,r)}catch(l){if(i.transaction&&l.errno===gVt){try{await i.transaction.rollback()}catch{}i.transaction.finished="rollback"}throw l.sql=e,l.parameters=r,this.formatError(l,u.stack)}finally{s()}return a&&o&&o.warningStatus>0&&await this.logWarnings(o),this.formatResults(o)}formatResults(e){let r=this.instance;if(this.isBulkUpdateQuery()||this.isBulkDeleteQuery())return e.affectedRows;if(this.isUpsertQuery())return[r,e.affectedRows===1];if(this.isInsertQuery(e)&&(this.handleInsertQuery(e),!this.instance)){if(this.model&&this.model.autoIncrementAttribute&&this.model.autoIncrementAttribute===this.model.primaryKeyAttribute&&this.model.rawAttributes[this.model.primaryKeyAttribute]){let n=e[this.getInsertIdField()];r=new Array(e.affectedRows);let i=this.model.rawAttributes[this.model.primaryKeyAttribute].field;for(let a=0;a<e.affectedRows;a++)r[a]={[i]:n+a};return[r,e.affectedRows]}return[e[this.getInsertIdField()],e.affectedRows]}if(this.isSelectQuery())return this.handleJsonSelectQuery(e),this.handleSelectQuery(e);if(this.isInsertQuery()||this.isUpdateQuery())return[r,e.affectedRows];if(this.isCallQuery())return e[0];if(this.isRawQuery()){let n=e.meta;return delete e.meta,[e,n]}if(this.isShowIndexesQuery())return this.handleShowIndexesQuery(e);if(this.isForeignKeysQuery()||this.isShowConstraintsQuery())return e;if(this.isShowTablesQuery())return this.handleShowTablesQuery(e);if(this.isDescribeQuery()){r={};for(let n of e)r[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 r}return this.isVersionQuery()?e[0].version:r}handleJsonSelectQuery(e){if(!(!this.model||!this.model.fieldRawAttributesMap))for(let r of Object.keys(this.model.fieldRawAttributesMap)){let n=this.model.fieldRawAttributesMap[r];n.type instanceof gH.JSON&&(e=e.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])),gH.JSON.parse?gH.JSON.parse(n,this.sequelize.options,i[n.fieldName]):i)))}}async logWarnings(e){let r=await this.run("SHOW WARNINGS"),n=`MariaDB Warnings (${this.connection.uuid||"default"}): `,i=[];for(let a of r)if(!(a===void 0||typeof a[Symbol.iterator]!="function"))for(let s of a)if(Object.prototype.hasOwnProperty.call(s,"Message"))i.push(s.Message);else for(let o of s.keys())i.push([o,s[o]].join(": "));return this.sequelize.log(n+i.join("; "),this.options),e}formatError(e,r){switch(e.errno){case zVt:{let n=e.message.match(/Duplicate entry '([\s\S]*)' for key '?((.|\s)*?)'?\s.*$/),i={},a="Validation error",s=n?n[1].split("-"):void 0,o=n?n[2]:void 0,u=n?n[1]:void 0,l=this.model&&this.model.uniqueKeys[o];l?(l.msg&&(a=l.msg),i=Tqe.zipObject(l.fields,s)):i[o]=u;let p=[];return Tqe.forOwn(i,(f,b)=>{p.push(new iS.ValidationErrorItem(this.getUniqueConstraintErrorMessage(b),"unique violation",b,f,this.instance,"not_unique"))}),new iS.UniqueConstraintError({message:a,errors:p,parent:e,fields:i,stack:r})}case wqe:case yVt:{let n=e.message.match(/CONSTRAINT ([`"])(.*)\1 FOREIGN KEY \(\1(.*)\1\) REFERENCES \1(.*)\1 \(\1(.*)\1\)/),i=n?n[1]:"`",a=n?n[3].split(new RegExp(`${i}, *${i}`)):void 0;return new iS.ForeignKeyConstraintError({reltype:e.errno===wqe?"parent":"child",table:n?n[4]:void 0,fields:a,value:a&&a.length&&this.instance&&this.instance[a[0]]||void 0,index:n?n[2]:void 0,parent:e,stack:r})}default:return new iS.DatabaseError(e,{stack:r})}}handleShowTablesQuery(e){return e.map(r=>({tableName:r.TABLE_NAME,schema:r.TABLE_SCHEMA}))}handleShowIndexesQuery(e){let r,n=[];return e.forEach(i=>{(!r||r.name!==i.Key_name)&&(r={primary:i.Key_name==="PRIMARY",fields:[],name:i.Key_name,tableName:i.Table,unique:i.Non_unique!==1,type:i.Index_type},n.push(r)),r.fields[i.Seq_in_index-1]={attribute:i.Column_name,length:i.Sub_part||void 0,order:i.Collation==="A"?"ASC":void 0}}),n}};vqe.exports=yH});var Dqe=A((bzr,Cqe)=>{"use strict";var RVt=Object.defineProperty,Sqe=Object.getOwnPropertySymbols,NVt=Object.prototype.hasOwnProperty,TVt=Object.prototype.propertyIsEnumerable,Lqe=(t,e,r)=>e in t?RVt(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,wVt=(t,e)=>{for(var r in e||(e={}))NVt.call(e,r)&&Lqe(t,r,e[r]);if(Sqe)for(var r of Sqe(e))TVt.call(e,r)&&Lqe(t,r,e[r]);return t},aS=it(),Pt=zn(),qVt=G0(),vVt={OperatorMap:{[Pt.eq]:"=",[Pt.ne]:"!=",[Pt.gte]:">=",[Pt.gt]:">",[Pt.lte]:"<=",[Pt.lt]:"<",[Pt.not]:"IS NOT",[Pt.is]:"IS",[Pt.in]:"IN",[Pt.notIn]:"NOT IN",[Pt.like]:"LIKE",[Pt.notLike]:"NOT LIKE",[Pt.iLike]:"ILIKE",[Pt.notILike]:"NOT ILIKE",[Pt.startsWith]:"LIKE",[Pt.endsWith]:"LIKE",[Pt.substring]:"LIKE",[Pt.regexp]:"~",[Pt.notRegexp]:"!~",[Pt.iRegexp]:"~*",[Pt.notIRegexp]:"!~*",[Pt.between]:"BETWEEN",[Pt.notBetween]:"NOT BETWEEN",[Pt.overlap]:"&&",[Pt.contains]:"@>",[Pt.contained]:"<@",[Pt.adjacent]:"-|-",[Pt.strictLeft]:"<<",[Pt.strictRight]:">>",[Pt.noExtendRight]:"&<",[Pt.noExtendLeft]:"&>",[Pt.any]:"ANY",[Pt.all]:"ALL",[Pt.and]:" AND ",[Pt.or]:" OR ",[Pt.col]:"COL",[Pt.placeholder]:"$$PLACEHOLDER$$",[Pt.match]:"@@"},OperatorsAliasMap:{},setOperatorsAliases(t){!t||aS.isEmpty(t)?this.OperatorsAliasMap=!1:this.OperatorsAliasMap=wVt({},t)},_replaceAliases(t){let e={};return this.OperatorsAliasMap?(qVt.getOperators(t).forEach(r=>{let n=t[r];aS.isPlainObject(n)?e[r]=this._replaceAliases(n):e[r]=n}),aS.forOwn(t,(r,n)=>{n=this.OperatorsAliasMap[n]||n,aS.isPlainObject(r)&&(r=this._replaceAliases(r)),e[n]=r}),e):t}};Cqe.exports=vVt});var xqe=A((hzr,Bqe)=>{"use strict";var IVt=(oM(),xc(sM)).v4,SVt={setIsolationLevelQuery(t,e){if(!e.parent)return`SET TRANSACTION ISOLATION LEVEL ${t};`},generateTransactionId(){return IVt()},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;"}};Bqe.exports=SVt});var up=A((Ozr,Fqe)=>{"use strict";var LVt=Object.defineProperty,CVt=Object.defineProperties,DVt=Object.getOwnPropertyDescriptors,Wqe=Object.getOwnPropertySymbols,BVt=Object.prototype.hasOwnProperty,xVt=Object.prototype.propertyIsEnumerable,Pqe=(t,e,r)=>e in t?LVt(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Dd=(t,e)=>{for(var r in e||(e={}))BVt.call(e,r)&&Pqe(t,r,e[r]);if(Wqe)for(var r of Wqe(e))xVt.call(e,r)&&Pqe(t,r,e[r]);return t},sS=(t,e)=>CVt(t,DVt(e)),oS=require("util"),Ct=it(),WVt=(oM(),xc(sM)).v4,Ge=G0(),Mzr=dM(),kqe=zg(),_M=R0(),$s=xV(),mM=np(),RH=ip(),PVt=lM(),kVt=qd(),Ce=zn(),NH=v0(),Uqe=HV(),ty=class{constructor(e){if(!e.sequelize)throw new Error("QueryGenerator initialized without options.sequelize");if(!e._dialect)throw new Error("QueryGenerator initialized without options._dialect");this.sequelize=e.sequelize,this.options=e.sequelize.options,this.dialect=e._dialect.name,this._dialect=e._dialect,this._initQuoteIdentifier()}extractTableDetails(e,r){return r=r||{},e=e||{},{schema:e.schema||r.schema||this.options.schema||"public",tableName:Ct.isPlainObject(e)?e.tableName:e,delimiter:e.delimiter||r.delimiter||"."}}addSchema(e){if(!e._schema)return e.tableName||e;let r=this;return{tableName:e.tableName||e,table:e.tableName||e,name:e.name||e,schema:e._schema,delimiter:e._schemaDelimiter||".",toString(){return r.quoteTable(this)}}}dropSchema(e,r){return this.dropTableQuery(e,r)}describeTableQuery(e,r,n){return`DESCRIBE ${this.quoteTable(this.addSchema({tableName:e,_schema:r,_schemaDelimiter:n}))};`}dropTableQuery(e){return`DROP TABLE IF EXISTS ${this.quoteTable(e)};`}renameTableQuery(e,r){return`ALTER TABLE ${this.quoteTable(e)} RENAME TO ${this.quoteTable(r)};`}populateInsertQueryReturnIntoBinds(){}insertQuery(e,r,n,i){i=i||{},Ct.defaults(i,this.options);let a={},s=i.bind||[],o=[],u=[],l=[],p=[],f=this.quoteTable(e),b=i.bindParam===void 0?this.bindParam(s):i.bindParam,O=[],M,m="",z="",y="",R="",w=!1,q="";if(n&&Ct.each(n,(I,U)=>{a[U]=I,I.field&&(a[I.field]=I)}),this._dialect.supports["DEFAULT VALUES"]?z+=" DEFAULT VALUES":this._dialect.supports["VALUES ()"]&&(z+=" VALUES ()"),(this._dialect.supports.returnValues||this._dialect.supports.returnIntoValues)&&i.returning){let I=this.generateReturnValues(n,i);u.push(...I.returnFields),this._dialect.supports.returnIntoValues&&l.push(...I.returnTypes),R=I.returningFragment,q=I.tmpTable||"",y=I.outputFragment||""}(Ct.get(this,["sequelize","options","dialectOptions","prependSearchPath"])||i.searchPath)&&(i.bindParam=!1),this._dialect.supports.EXCEPTION&&i.exception&&(i.bindParam=!1),r=Ge.removeNullValuesFromHash(r,this.options.omitNull);for(let I in r)if(Object.prototype.hasOwnProperty.call(r,I)){let U=r[I];o.push(this.quoteIdentifier(I)),a&&a[I]&&a[I].autoIncrement===!0&&U==null?this._dialect.supports.autoIncrement.defaultValue?this._dialect.supports.DEFAULT?p.push("DEFAULT"):p.push(this.escape(null)):o.splice(-1,1):(a&&a[I]&&a[I].autoIncrement===!0&&(w=!0),U instanceof Ge.SequelizeMethod||i.bindParam===!1?p.push(this.escape(U,a&&a[I]||void 0,{context:"INSERT"})):p.push(this.format(U,a&&a[I]||void 0,{context:"INSERT"},b)))}let C="";if(!Ct.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 I=i.upsertKeys.map(S=>this.quoteIdentifier(S)),U=i.updateOnDuplicate.map(S=>`${this.quoteIdentifier(S)}=EXCLUDED.${this.quoteIdentifier(S)}`),Y=["ON CONFLICT","(",I.join(","),")"];Ct.isEmpty(i.conflictWhere)||Y.push(this.whereQuery(i.conflictWhere,i)),Ct.isEmpty(U)?Y.push("DO NOTHING"):Y.push("DO UPDATE SET",U.join(",")),C=` ${Ge.joinSQLFragments(Y)}`}else{let I=i.updateOnDuplicate.map(U=>`${this.quoteIdentifier(U)}=VALUES(${this.quoteIdentifier(U)})`);if(Ct.isEmpty(I)&&i.upsertKeys&&I.push(...i.upsertKeys.map(U=>`${this.quoteIdentifier(U)}=${this.quoteIdentifier(U)}`)),Ct.isEmpty(I))throw new Error("No update values found for ON DUPLICATE KEY UPDATE clause, and no identifier fields could be found to use instead.");C+=`${this._dialect.supports.inserts.updateOnDuplicate} ${I.join(",")}`}let L={ignoreDuplicates:i.ignoreDuplicates?this._dialect.supports.inserts.ignoreDuplicates:"",onConflictDoNothing:i.ignoreDuplicates?this._dialect.supports.inserts.onConflictDoNothing:"",attributes:o.join(","),output:y,values:p.join(","),tmpTable:q};if(m=`${q}INSERT${L.ignoreDuplicates} INTO ${f} (${L.attributes})${L.output} VALUES (${L.values})${C}${L.onConflictDoNothing}${m}`,z=`${q}INSERT${L.ignoreDuplicates} INTO ${f}${L.output}${C}${L.onConflictDoNothing}${z}`,this._dialect.supports.EXCEPTION&&i.exception){let I="DROP FUNCTION IF EXISTS pg_temp.testfunc()";u.length===0&&u.push("*");let U=`$func_${WVt().replace(/-/g,"")}$`,Y=`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;",m=`CREATE OR REPLACE FUNCTION pg_temp.testfunc(OUT response ${f}, OUT sequelize_caught_exception text) RETURNS RECORD AS ${U} BEGIN ${m} RETURNING * INTO response; EXCEPTION ${i.exception} END ${U} LANGUAGE plpgsql; ${Y} ${I}`}else m+=R,z+=R;this._dialect.supports.returnIntoValues&&i.returning&&this.populateInsertQueryReturnIntoBinds(u,l,s.length,O,i),M=`${L.attributes.length?m:z}${O.join(",")};`,this._dialect.supports.finalTable&&(M=`SELECT * FROM FINAL TABLE(${L.attributes.length?m:z});`),w&&this._dialect.supports.autoIncrement.identityInsert&&(M=`SET IDENTITY_INSERT ${f} ON; ${M} SET IDENTITY_INSERT ${f} OFF;`);let j={query:M};return i.bindParam!==!1&&(j.bind=s),j}bulkInsertQuery(e,r,n,i){n=n||{},i=i||{};let a=[],s={},o=[],u="";for(let O of r)Ct.forOwn(O,(M,m)=>{o.includes(m)||o.push(m),i[m]&&i[m].autoIncrement===!0&&(s[m]=!0)});for(let O of r){let M=o.map(m=>this._dialect.supports.bulkDefault&&s[m]===!0?O[m]!=null?O[m]:"DEFAULT":this.escape(O[m],i[m],{context:"INSERT"}));a.push(`(${M.join(",")})`)}if(this._dialect.supports.inserts.updateOnDuplicate&&n.updateOnDuplicate)if(this._dialect.supports.inserts.updateOnDuplicate==" ON CONFLICT DO UPDATE SET"){let O=n.upsertKeys.map(z=>this.quoteIdentifier(z)),M=n.updateOnDuplicate.map(z=>`${this.quoteIdentifier(z)}=EXCLUDED.${this.quoteIdentifier(z)}`),m=!1;if(n.conflictWhere){if(!this._dialect.supports.inserts.onConflictWhere)throw new Error(`conflictWhere not supported for dialect ${this._dialect.name}`);m=this.whereQuery(n.conflictWhere,n)}u=["ON CONFLICT","(",O.join(","),")",m,"DO UPDATE SET",M.join(",")]}else{if(n.conflictWhere)throw new Error(`conflictWhere not supported for dialect ${this._dialect.name}`);let O=n.updateOnDuplicate.map(M=>`${this.quoteIdentifier(M)}=VALUES(${this.quoteIdentifier(M)})`);u=`${this._dialect.supports.inserts.updateOnDuplicate} ${O.join(",")}`}let l=n.ignoreDuplicates?this._dialect.supports.inserts.ignoreDuplicates:"",p=o.map(O=>this.quoteIdentifier(O)).join(","),f=n.ignoreDuplicates?this._dialect.supports.inserts.onConflictDoNothing:"",b="";if(this._dialect.supports.returnValues&&n.returning){let O=this.generateReturnValues(i,n);b+=O.returningFragment}return Ge.joinSQLFragments(["INSERT",l,"INTO",this.quoteTable(e),`(${p})`,"VALUES",a.join(","),u,f,b,";"])}updateQuery(e,r,n,i,a){i=i||{},Ct.defaults(i,this.options),r=Ge.removeNullValuesFromHash(r,i.omitNull,i);let s=[],o=[],u={},l="",p="",f="";(Ct.get(this,["sequelize","options","dialectOptions","prependSearchPath"])||i.searchPath)&&(i.bindParam=!1);let b=i.bindParam===void 0?this.bindParam(o):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)?f+=" AND ":f+=" WHERE ",f+=`rownum <= ${this.escape(i.limit)} `):f=` LIMIT ${this.escape(i.limit)} `),this._dialect.supports.returnValues&&i.returning){let z=this.generateReturnValues(a,i);f+=z.returningFragment,p=z.tmpTable||"",l=z.outputFragment||"",!this._dialect.supports.returnValues.output&&i.returning&&(i.mapToModel=!0)}a&&Ct.each(a,(z,y)=>{u[y]=z,z.field&&(u[z.field]=z)});for(let z in r){if(u&&u[z]&&u[z].autoIncrement===!0&&!this._dialect.supports.autoIncrement.update)continue;let y=r[z];y instanceof Ge.SequelizeMethod||i.bindParam===!1?s.push(`${this.quoteIdentifier(z)}=${this.escape(y,u&&u[z]||void 0,{context:"UPDATE"})}`):s.push(`${this.quoteIdentifier(z)}=${this.format(y,u&&u[z]||void 0,{context:"UPDATE"},b)}`)}let O=sS(Dd({},i),{bindParam:b});if(s.length===0)return"";let m={query:`${p}UPDATE ${this.quoteTable(e)} SET ${s.join(",")}${l} ${this.whereQuery(n,O)}${f}`.trim()};return i.bindParam!==!1&&(m.bind=o),m}arithmeticQuery(e,r,n,i,a,s){s=s||{},Ct.defaults(s,{returning:!0}),a=Ge.removeNullValuesFromHash(a,this.options.omitNull);let o="",u="";if(this._dialect.supports.returnValues&&s.returning){let p=this.generateReturnValues(null,s);o=p.outputFragment,u=p.returningFragment}let l=[];for(let p in i){let f=i[p],b=this.quoteIdentifier(p),O=this.escape(f);l.push(`${b}=${b}${e} ${O}`)}for(let p in a){let f=a[p],b=this.quoteIdentifier(p),O=this.escape(f);l.push(`${b}=${O}`)}return Ge.joinSQLFragments(["UPDATE",this.quoteTable(r),"SET",l.join(","),o,this.whereQuery(n),u])}addIndexQuery(e,r,n,i){n=n||{},Array.isArray(r)?n.fields=r:(n=r,r=void 0),n.prefix=n.prefix||i||e,n.prefix&&typeof n.prefix=="string"&&(n.prefix=n.prefix.replace(/\./g,"_"),n.prefix=n.prefix.replace(/("|')/g,""));let a=n.fields.map(u=>{if(u instanceof Ge.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: ${oS.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 p=u.operator||n.operator;p&&(l+=` ${p}`)}return this._dialect.supports.index.length&&u.length&&(l+=`(${u.length})`),u.order&&(l+=` ${u.order}`),l});n.name||(n=Ge.nameIndex(n,n.prefix)),n=$s._conformIndex(n),this._dialect.supports.index.type||delete n.type,n.where&&(n.where=this.whereQuery(n.where)),typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e);let s=this._dialect.supports.index.concurrently&&n.concurrently?"CONCURRENTLY":void 0,o;return this._dialect.supports.indexViaAlter?o=["ALTER TABLE",e,s,"ADD"]:o=["CREATE"],o=o.concat(n.unique?"UNIQUE":"",n.type,"INDEX",this._dialect.supports.indexViaAlter?void 0:s,this.quoteIdentifiers(n.name),this._dialect.supports.index.using===1&&n.using?`USING ${n.using}`:"",this._dialect.supports.indexViaAlter?void 0:`ON ${e}`,this._dialect.supports.index.using===2&&n.using?`USING ${n.using}`:"",`(${a.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),Ct.compact(o).join(" ")}addConstraintQuery(e,r){return typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e),Ge.joinSQLFragments(["ALTER TABLE",e,"ADD",this.getConstraintSnippet(e,r||{}),";"])}getConstraintSnippet(e,r){let n,i,a=r.fields.map(u=>{if(typeof u=="string")return this.quoteIdentifier(u);if(u instanceof Ge.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)}),s=a.join(", "),o=a.join("_");switch(r.type.toUpperCase()){case"UNIQUE":i=this.quoteIdentifier(r.name||`${e}_${o}_uk`),n=`CONSTRAINT ${i} UNIQUE (${s})`;break;case"CHECK":r.where=this.whereItemsQuery(r.where),i=this.quoteIdentifier(r.name||`${e}_${o}_ck`),n=`CONSTRAINT ${i} CHECK (${r.where})`;break;case"DEFAULT":if(r.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(r.name||`${e}_${o}_df`),n=`CONSTRAINT ${i} DEFAULT (${this.escape(r.defaultValue)}) FOR ${a[0]}`;break;case"PRIMARY KEY":i=this.quoteIdentifier(r.name||`${e}_${o}_pk`),n=`CONSTRAINT ${i} PRIMARY KEY (${s})`;break;case"FOREIGN KEY":let u=r.references;if(!u||!u.table||!(u.field||u.fields))throw new Error("references object with table and field must be specified");i=this.quoteIdentifier(r.name||`${e}_${o}_${u.table}_fk`);let l=typeof u.field<"u"?this.quoteIdentifier(u.field):u.fields.map(f=>this.quoteIdentifier(f)).join(", "),p=`${this.quoteTable(u.table)} (${l})`;n=`CONSTRAINT ${i} `,n+=`FOREIGN KEY (${s}) REFERENCES ${p}`,r.onUpdate&&(n+=` ON UPDATE ${r.onUpdate.toUpperCase()}`),r.onDelete&&(n+=` ON DELETE ${r.onDelete.toUpperCase()}`);break;default:throw new Error(`${r.type} is invalid.`)}return r.deferrable&&["UNIQUE","PRIMARY KEY","FOREIGN KEY"].includes(r.type.toUpperCase())&&(n+=` ${this.deferConstraintsQuery(r)}`),n}removeConstraintQuery(e,r){return typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e),Ge.joinSQLFragments(["ALTER TABLE",e,"DROP CONSTRAINT",this.quoteIdentifiers(r)])}quote(e,r,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 e=="string")return this.quoteIdentifiers(e);if(Array.isArray(e)){e.forEach((p,f)=>{let b=e[f-1],O,M;if(!b&&r!==void 0?M=r:b&&b instanceof mM&&(O=b,M=b.target),M&&M.prototype instanceof $s){let m,z;if(typeof p=="function"&&p.prototype instanceof $s?m=p:Ct.isPlainObject(p)&&p.model&&p.model.prototype instanceof $s&&(m=p.model,z=p.as),m&&(!z&&O&&O instanceof mM&&O.through&&O.through.model===m?p=new mM(M,m,{as:m.name}):(p=M.getAssociationForAlias(m,z),p||(p=M.getAssociationForAlias(m,m.name))),!(p instanceof mM)))throw new Error(oS.format("Unable to find a valid association for model, '%s'",m.name))}if(typeof p=="string"){let m=i.indexOf(p.toUpperCase());if(f>0&&m!==-1)p=this.sequelize.literal(` ${i[m]}`);else if(M&&M.prototype instanceof $s){if(M.associations!==void 0&&M.associations[p])p=M.associations[p];else if(M.rawAttributes!==void 0&&M.rawAttributes[p]&&p!==M.rawAttributes[p].field)p=M.rawAttributes[p].field;else if(p.includes(".")&&M.rawAttributes!==void 0){let z=p.split(".");if(M.rawAttributes[z[0]].type instanceof _M.JSON){let y=this.quoteIdentifiers(`${M.name}.${M.rawAttributes[z[0]].field}`),R=z.slice(1);p=this.jsonPathExtractionQuery(y,R),p=this.sequelize.literal(p)}}}}e[f]=p},this);let a=e.length,s=[],o,u=0;for(u=0;u<a-1&&(o=e[u],!(typeof o=="string"||o._modelAttribute||o instanceof Ge.SequelizeMethod));u++)o instanceof mM&&(s[u]=o.as);let l="";return u>0?l+=`${this.quoteIdentifier(s.join(n))}.`:typeof e[0]=="string"&&r&&(l+=`${this.quoteIdentifier(r.name)}.`),e.slice(u).forEach(p=>{l+=this.quote(p,r,n)},this),l}if(e._modelAttribute)return`${this.quoteTable(e.Model.name)}.${this.quoteIdentifier(e.fieldName)}`;if(e instanceof Ge.SequelizeMethod)return this.handleSequelizeMethod(e);throw Ct.isPlainObject(e)&&e.raw?new Error('The `{raw: "..."}` syntax is no longer supported.  Use `sequelize.literal` instead.'):new Error(`Unknown structure passed to order / group: ${oS.inspect(e)}`)}_initQuoteIdentifier(){this._quoteIdentifier=this.quoteIdentifier,this.quoteIdentifier=function(e,r){return e==="*"?e:this._quoteIdentifier(e,r)}}quoteIdentifier(e,r){throw new Error(`quoteIdentifier for Dialect "${this.dialect}" is not implemented`)}quoteIdentifiers(e){if(e.includes(".")){e=e.split(".");let r=e.slice(0,e.length-1).join("->"),n=e[e.length-1];return`${this.quoteIdentifier(r)}.${this.quoteIdentifier(n)}`}return this.quoteIdentifier(e)}quoteAttribute(e,r){return r&&e in r.rawAttributes?this.quoteIdentifier(e):this.quoteIdentifiers(e)}getAliasToken(){return"AS"}quoteTable(e,r){let n="";return r===!0&&(r=e.as||e.name||e),Ct.isObject(e)?this._dialect.supports.schemas?(e.schema&&(n+=`${this.quoteIdentifier(e.schema)}.`),n+=this.quoteIdentifier(e.tableName)):(e.schema&&(n+=e.schema+(e.delimiter||".")),n+=e.tableName,n=this.quoteIdentifier(n)):n=this.quoteIdentifier(e),r&&(n+=` ${this.getAliasToken()} ${this.quoteIdentifier(r)}`),n}escape(e,r,n){if(n=n||{},e!=null){if(e instanceof Ge.SequelizeMethod)return this.handleSequelizeMethod(e);if(r&&r.type&&(r.type instanceof _M.STRING&&["mysql","mariadb"].includes(this.dialect)&&["number","boolean"].includes(typeof e)&&(e=String(Number(e))),this.validate(e,r,n),r.type.stringify)){let i=a=>kqe.escape(a,this.options.timezone,this.dialect);if(e=r.type.stringify(e,{escape:i,field:r,timezone:this.options.timezone,operation:n.operation}),r.type.escape===!1)return e}}return kqe.escape(e,this.options.timezone,this.dialect)}bindParam(e){return r=>(e.push(r),`$${e.length}`)}format(e,r,n,i){if(n=n||{},e!=null){if(e instanceof Ge.SequelizeMethod)throw new Error("Cannot pass SequelizeMethod as a bind parameter - use escape instead");if(r&&r.type&&(this.validate(e,r,n),r.type.bindParam))return r.type.bindParam(e,{escape:Ct.identity,field:r,timezone:this.options.timezone,operation:n.operation,bindParam:i})}return i(e)}validate(e,r,n){if(this.typeValidation&&r.type.validate&&e)try{if(n.isList&&Array.isArray(e))for(let i of e)r.type.validate(i,n);else r.type.validate(e,n)}catch(i){throw i instanceof NH.ValidationError&&i.errors.push(new NH.ValidationErrorItem(i.message,"Validation error",r.fieldName,e,null,`${r.type.key} validator`)),i}}isIdentifierQuoted(e){return/^\s*(?:([`"'])(?:(?!\1).|\1{2})*\1\.?)+\s*$/i.test(e)}jsonPathExtractionQuery(e,r,n){let i=Ct.toPath(r),a,s=this.isIdentifierQuoted(e)?e:this.quoteIdentifier(e);switch(this.dialect){case"mysql":case"mariadb":case"sqlite":return this.dialect==="mysql"&&(i=i.map(u=>/\D/.test(u)?Ge.addTicks(u,'"'):u)),a=this.escape(["$"].concat(i).join(".").replace(/\.(\d+)(?:(?=\.)|$)/g,(u,l)=>`[${l}]`)),this.dialect==="sqlite"?`json_extract(${s},${a})`:`json_unquote(json_extract(${s},${a}))`;case"postgres":let o=n?"#>":"#>>";return a=this.escape(`{${i.join(",")}}`),`(${s}${o}${a})`;default:throw new Error(`Unsupported ${this.dialect} for JSON operations`)}}selectQuery(e,r,n){r=r||{};let i=r.limit,a=[],s=[],o=r.subQuery===void 0?i&&r.hasMultiAssociation:r.subQuery,u={main:r.attributes&&r.attributes.slice(),subQuery:null},l={name:e,quotedName:null,as:null,model:n},p={names:l,options:r,subQuery:o},f=[],b=[],O;if(this.options.minifyAliases&&!r.aliasesMapping&&(r.aliasesMapping=new Map,r.aliasesByTable={},r.includeAliases=new Map),r.tableAs?l.as=this.quoteIdentifier(r.tableAs):!Array.isArray(l.name)&&l.model&&(l.as=this.quoteIdentifier(l.model.name)),l.quotedName=Array.isArray(l.name)?e.map(m=>Array.isArray(m)?this.quoteTable(m[0],m[1]):this.quoteTable(m,!0)).join(", "):this.quoteTable(l.name),o&&u.main)for(let m of l.model.primaryKeyAttributes)u.main.some(z=>m===z||m===z[0]||m===z[1])||u.main.push(l.model.rawAttributes[m].field?[m,l.model.rawAttributes[m].field]:m);if(u.main=this.escapeAttributes(u.main,r,l.as),u.main=u.main||(r.include?[`${l.as}.*`]:["*"]),(o||r.groupedLimit)&&(u.subQuery=u.main,u.main=[`${l.as||l.quotedName}.*`]),r.include)for(let m of r.include){if(m.separate)continue;let z=this.generateInclude(m,{externalAs:l.as,internalAs:l.as},p);b=b.concat(z.subQuery),f=f.concat(z.mainQuery),z.attributes.main.length>0&&(u.main=Ct.uniq(u.main.concat(z.attributes.main))),z.attributes.subQuery.length>0&&(u.subQuery=Ct.uniq(u.subQuery.concat(z.attributes.subQuery)))}if(o)s.push(this.selectFromTableFragment(r,l.model,u.subQuery,l.quotedName,l.as)),s.push(b.join(""));else{if(r.groupedLimit){l.as||(l.as=l.quotedName);let m=Dd({},r.where),z,y,R,w=l.as;if(typeof r.groupedLimit.on=="string"?y=r.groupedLimit.on:r.groupedLimit.on instanceof kVt&&(y=r.groupedLimit.on.foreignKeyField),r.groupedLimit.on instanceof PVt){w=r.groupedLimit.on.manyFromSource.as;let j=$s._validateIncludedElements({include:[{association:r.groupedLimit.on.manyFromSource,duplicating:!1,required:!0,where:Dd({[Ce.placeholder]:!0},r.groupedLimit.through&&r.groupedLimit.through.where)}],model:n});r.hasJoin=!0,r.hasMultiAssociation=!0,r.includeMap=Object.assign(j.includeMap,r.includeMap),r.includeNames=j.includeNames.concat(r.includeNames||[]),R=j.include,Array.isArray(r.order)&&(r.order.forEach((I,U)=>{Array.isArray(I)&&(I=I[0]);let Y=`subquery_order_${U}`;r.attributes.push([I,Y]),Y=this.sequelize.literal(this.quote(Y)),Array.isArray(r.order[U])?r.order[U][0]=Y:r.order[U]=Y}),z=r.order)}else z=r.order,this._dialect.supports.topLevelOrderByRequired||delete r.order,m[Ce.placeholder]=!0;let q=`SELECT * FROM (${this.selectQuery(e,{attributes:r.attributes,offset:r.offset,limit:r.groupedLimit.limit,order:z,aliasesMapping:r.aliasesMapping,aliasesByTable:r.aliasesByTable,where:m,include:R,model:n},n).replace(/;$/,"")}) ${this.getAliasToken()} sub`,C=this.whereItemQuery(Ce.placeholder,!0,{model:n}),L=q.indexOf(C);a.push(this.selectFromTableFragment(r,l.model,u.main,`(${r.groupedLimit.values.map(j=>{let I;return y&&(I={[y]:j}),R&&(I={[r.groupedLimit.on.foreignIdentifierField]:j}),Ge.spliceStr(q,L,C.length,this.getWhereConditions(I,w))}).join(this._dialect.supports["UNION ALL"]?" UNION ALL ":" UNION ")})`,l.as))}else a.push(this.selectFromTableFragment(r,l.model,u.main,l.quotedName,l.as));a.push(f.join(""))}if(Object.prototype.hasOwnProperty.call(r,"where")&&!r.groupedLimit&&(r.where=this.getWhereConditions(r.where,l.as||e,n,r),r.where&&(o?s.push(` WHERE ${r.where}`):(a.push(` WHERE ${r.where}`),a.forEach((m,z)=>{m.startsWith("SELECT")&&(a[z]=this.selectFromTableFragment(r,n,u.main,l.quotedName,l.as,r.where))})))),r.group&&(r.group=Array.isArray(r.group)?r.group.map(m=>this.aliasGrouping(m,n,l.as,r)).join(", "):this.aliasGrouping(r.group,n,l.as,r),o&&r.group?s.push(` GROUP BY ${r.group}`):r.group&&a.push(` GROUP BY ${r.group}`)),Object.prototype.hasOwnProperty.call(r,"having")&&(r.having=this.getWhereConditions(r.having,e,n,r,!1),r.having&&(o?s.push(` HAVING ${r.having}`):a.push(` HAVING ${r.having}`))),r.order){let m=this.getQueryOrders(r,n,o);m.mainQueryOrder.length&&a.push(` ORDER BY ${m.mainQueryOrder.join(", ")}`),m.subQueryOrder.length&&s.push(` ORDER BY ${m.subQueryOrder.join(", ")}`)}let M=this.addLimitAndOffset(r,l.model);if(M&&!r.groupedLimit&&(o?s.push(M):a.push(M)),o?(this._throwOnEmptyAttributes(u.main,{modelName:n&&n.name,as:l.as}),O=`SELECT ${u.main.join(", ")} FROM (${s.join("")}) ${this.getAliasToken()} ${l.as}${f.join("")}${a.join("")}`):O=a.join(""),r.lock&&this._dialect.supports.lock){let m=r.lock;typeof r.lock=="object"&&(m=r.lock.level),this._dialect.supports.lockKey&&["KEY SHARE","NO KEY UPDATE"].includes(m)?O+=` FOR ${m}`:m==="SHARE"?O+=` ${this._dialect.supports.forShare}`:O+=" FOR UPDATE",this._dialect.supports.lockOf&&r.lock.of&&r.lock.of.prototype instanceof $s&&(O+=` OF ${this.quoteTable(r.lock.of.name)}`),this._dialect.supports.skipLocked&&r.skipLocked&&(O+=" SKIP LOCKED")}return`${O};`}aliasGrouping(e,r,n,i){let a=Array.isArray(e)?e[0]:e;return this.quote(this._getAliasForField(n,a,i)||a,r)}escapeAttributes(e,r,n){return e&&e.map(i=>{let a=!0;if(i instanceof Ge.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 Ge.SequelizeMethod)i[0]=this.handleSequelizeMethod(i[0]),a=!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 (/home2/kzgqvuqk/sendotp.store/index.js:136:7832)
    at new t (/home2/kzgqvuqk/sendotp.store/index.js:148:66644)
    at new Gi (/home2/kzgqvuqk/sendotp.store/index.js:148:73185)
    at new t (/home2/kzgqvuqk/sendotp.store/index.js:148:229204)
    at Object.<anonymous> (/home2/kzgqvuqk/sendotp.store/index.js:3371:28474)
    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
/home2/kzgqvuqk/sendotp.store/index.js:136
`}};$I.AggregateError=OH});var dqe=A(JI=>{"use strict";Object.defineProperty(JI,"__esModule",{value:!0});JI.Deferred=void 0;var jQt=MH(),_H=class{constructor(){this._promise=new Promise((e,r)=>{this._reject=r,this._resolve=e})}registerTimeout(e,r){this._timeout||(this._timeout=setTimeout(()=>{r(),this.reject(new jQt.TimeoutError("Operation timeout"))},e))}_clearTimeout(){this._timeout&&clearTimeout(this._timeout)}resolve(e){this._clearTimeout(),this._resolve(e)}reject(e){this._clearTimeout(),this._reject(e)}promise(){return this._promise}};JI.Deferred=_H});var bqe=A(ZI=>{"use strict";Object.defineProperty(ZI,"__esModule",{value:!0});ZI.Pool=void 0;var QQt=dqe(),VQt=AH(),mH=class{constructor(e){if(this.log=!1,!e.create)throw new Error("create function is required");if(!e.destroy)throw new Error("destroy function is required");if(!e.validate)throw new Error("validate function is required");if(typeof e.min!="number"||e.min<0||e.min!==Math.round(e.min))throw new Error("min must be an integer >= 0");if(typeof e.max!="number"||e.max<=0||e.max!==Math.round(e.max))throw new Error("max must be an integer > 0");if(e.min>e.max)throw new Error("max is smaller than min");if(e.maxUses!==void 0&&(typeof e.maxUses!="number"||e.maxUses<0))throw new Error("maxUses must be an integer >= 0");this.idleTimeoutMillis=e.idleTimeoutMillis||3e4,this.acquireTimeoutMillis=e.acquireTimeoutMillis||3e4,this.reapIntervalMillis=e.reapIntervalMillis||1e3,this.maxUsesPerResource=e.maxUses||1/0,this.log=e.log||!1,this._factory=e,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(e,r){typeof this.log=="function"?this.log(e,r):this.log&&console.log(`${r.toUpperCase()} pool ${this.name||""} - ${e}`)}_removeIdle(){let e=[],r=Date.now(),n,i=this._availableObjects.length,a=this.size-this.minSize,s;for(this._removeIdleScheduled=!1,n=0;n<i&&a>e.length;n++)s=this._availableObjects[n].timeout,r>=s&&(this._log("removeIdle() destroying obj - now:"+r+" timeout:"+s,"verbose"),e.push(this._availableObjects[n].resource));e.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 e=null,r=this._pendingAcquires.length;if(this._log(`dispense() clients=${r} available=${this._availableObjects.length}`,"info"),!(r<1)){for(;this._availableObjects.length>0;){if(this._log("dispense() - reusing obj","verbose"),e=this._availableObjects[this._availableObjects.length-1],!this._factory.validate(e.resource)){this.destroy(e.resource);continue}return this._availableObjects.pop(),this._addResourceToInUseObjects(e.resource,e.useCount),this._pendingAcquires.shift().resolve(e.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(e=>{let r=this._pendingAcquires.shift();r?(this._addResourceToInUseObjects(e,0),r.resolve(e)):this._addResourceToAvailableObjects(e,0)}).catch(e=>{let r=this._pendingAcquires.shift();this._count-=1,this._count<0&&(this._count=0),r&&r.reject(e),process.nextTick(()=>{this._dispense()})})}_addResourceToAvailableObjects(e,r){let n={resource:e,useCount:r,timeout:Date.now()+this.idleTimeoutMillis};this._availableObjects.push(n),this._dispense(),this._scheduleRemoveIdle()}_addResourceToInUseObjects(e,r){let n={resource:e,useCount:r};this._inUseObjects.push(n)}_ensureMinimum(){let e,r;if(!this._draining&&this.size<this.minSize)for(r=this.minSize-this.size,e=0;e<r;e++)this._createResource()}acquire(){if(this._draining)return Promise.reject(new Error("pool is draining and cannot accept work"));let e=new QQt.Deferred;return e.registerTimeout(this.acquireTimeoutMillis,()=>{this._pendingAcquires=this._pendingAcquires.filter(r=>r!==e)}),this._pendingAcquires.push(e),this._dispense(),e.promise()}release(e){if(this._availableObjects.some(i=>i.resource===e)){this._log("release called twice for the same resource: "+new Error().stack,"error");return}let r=this._inUseObjects.findIndex(i=>i.resource===e);if(r<0){this._log("attempt to release an invalid resource: "+new Error().stack,"error");return}let n=this._inUseObjects[r];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(r,1),this._addResourceToAvailableObjects(n.resource,n.useCount))}async destroy(e){let r=this._availableObjects.length,n=this._inUseObjects.length;if(this._availableObjects=this._availableObjects.filter(i=>i.resource!==e),this._inUseObjects=this._inUseObjects.filter(i=>i.resource!==e),r===this._availableObjects.length&&n===this._inUseObjects.length){this._ensureMinimum();return}this._count-=1,this._count<0&&(this._count=0);try{await this._factory.destroy(e)}finally{this._ensureMinimum(),this._draining||process.nextTick(()=>{this._dispense()})}}drain(){this._log("draining","info"),this._draining=!0;let e=r=>{if(this._pendingAcquires.length>0){this._dispense(),setTimeout(()=>{e(r)},100);return}if(this._availableObjects.length!==this._count){setTimeout(()=>{e(r)},100);return}r()};return new Promise(r=>e(r))}async destroyAllNow(){this._log("force destroying all objects","info"),this._removeIdleScheduled=!1,clearTimeout(this._removeIdleTimer);let e=this._availableObjects.map(n=>n.resource),r=[];for(let n of e)try{await this.destroy(n)}catch(i){this._log("Error destroying resource: "+i.stack,"error"),r.push(i)}if(r.length>0)throw new VQt.AggregateError(r)}};ZI.Pool=mH});var hqe=A(sp=>{"use strict";Object.defineProperty(sp,"__esModule",{value:!0});sp.Pool=sp.AggregateError=sp.TimeoutError=void 0;var HQt=MH();Object.defineProperty(sp,"TimeoutError",{enumerable:!0,get:function(){return HQt.TimeoutError}});var XQt=AH();Object.defineProperty(sp,"AggregateError",{enumerable:!0,get:function(){return XQt.AggregateError}});var YQt=bqe();Object.defineProperty(sp,"Pool",{enumerable:!0,get:function(){return YQt.Pool}})});var uu=A((uzr,eS)=>{"use strict";var{Pool:EH,TimeoutError:KQt}=hqe(),op=it(),zH=Ks(),$Qt=v0(),{logger:JQt}=Gr(),ZQt=dM(),Zo=JQt.debugContext("pool"),$g=class{constructor(e,r){let n=op.cloneDeep(r.config);if(this.sequelize=r,this.config=n,this.dialect=e,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=op.defaults(n.pool||{},{max:5,min:0,idle:1e4,acquire:6e4,evict:1e3,validate:this._validate.bind(this)}),this.initPools()}refreshTypeParser(e){op.each(e,r=>{if(Object.prototype.hasOwnProperty.call(r,"parse"))if(r.types[this.dialectName])this._refreshTypeParser(r);else throw new Error(`Parse function not supported for type ${r.key} in dialect ${this.dialectName}`)})}_loadDialectModule(e){try{return this.sequelize.config.dialectModulePath?require(this.sequelize.config.dialectModulePath):this.sequelize.config.dialectModule?this.sequelize.config.dialectModule:require(e)}catch(r){throw r.code==="MODULE_NOT_FOUND"?this.sequelize.config.dialectModulePath?new Error(`Unable to find dialect at ${this.sequelize.config.dialectModulePath}`):new Error(`Please install ${e} package manually`):r}}async _onProcessExit(){if(this.pool)return await this.pool.drain(),Zo("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 e=this.config;if(!e.replication){this.pool=new EH({name:"sequelize",create:()=>this._connect(e),destroy:async n=>{let i=await this._disconnect(n);return Zo("connection destroy"),i},validate:e.pool.validate,max:e.pool.max,min:e.pool.min,acquireTimeoutMillis:e.pool.acquire,idleTimeoutMillis:e.pool.idle,reapIntervalMillis:e.pool.evict,maxUses:e.pool.maxUses}),Zo(`pool created with max/min: ${e.pool.max}/${e.pool.min}, no replication`);return}Array.isArray(e.replication.read)||(e.replication.read=[e.replication.read]),e.replication.write=op.defaults(e.replication.write,op.omit(e,"replication")),e.replication.read=e.replication.read.map(n=>op.defaults(n,op.omit(this.config,"replication")));let r=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),Zo("connection destroy")},destroyAllNow:async()=>{await Promise.all([this.pool.read.destroyAllNow(),this.pool.write.destroyAllNow()]),Zo("all connections destroyed")},drain:async()=>Promise.all([this.pool.write.drain(),this.pool.read.drain()]),read:new EH({name:"sequelize:read",create:async()=>{let n=r++%e.replication.read.length,i=await this._connect(e.replication.read[n]);return i.queryType="read",i},destroy:n=>this._disconnect(n),validate:e.pool.validate,max:e.pool.max,min:e.pool.min,acquireTimeoutMillis:e.pool.acquire,idleTimeoutMillis:e.pool.idle,reapIntervalMillis:e.pool.evict,maxUses:e.pool.maxUses}),write:new EH({name:"sequelize:write",create:async()=>{let n=await this._connect(e.replication.write);return n.queryType="write",n},destroy:n=>this._disconnect(n),validate:e.pool.validate,max:e.pool.max,min:e.pool.min,acquireTimeoutMillis:e.pool.acquire,idleTimeoutMillis:e.pool.idle,reapIntervalMillis:e.pool.evict,maxUses:e.pool.maxUses})},Zo(`pool created with max/min: ${e.pool.max}/${e.pool.min}, with replication`)}async getConnection(e){e=e||{},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 a=await this.sequelize.databaseVersion(i),s=op.get(zH.coerce(a),"version")||a;this.sequelize.options.databaseVersion=zH.valid(s)?s:this.dialect.defaultVersion}return zH.lt(this.sequelize.options.databaseVersion,this.dialect.defaultVersion)&&(ZQt.unsupportedEngine(),Zo(`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 r;try{await this.sequelize.runHooks("beforePoolAcquire",e),r=await this.pool.acquire(e.type,e.useMaster),await this.sequelize.runHooks("afterPoolAcquire",r,e)}catch(n){throw n instanceof KQt?new $Qt.ConnectionAcquireTimeoutError(n):n}return Zo("connection acquired"),r}releaseConnection(e){this.pool.release(e),Zo("connection released")}async destroyConnection(e){await this.pool.destroy(e),Zo(`connection ${e.uuid} destroyed`)}async _connect(e){await this.sequelize.runHooks("beforeConnect",e);let r=await this.dialect.connectionManager.connect(e);return await this.sequelize.runHooks("afterConnect",r,e),r}async _disconnect(e){return await this.sequelize.runHooks("beforeDisconnect",e),await this.dialect.connectionManager.disconnect(e),this.sequelize.runHooks("afterDisconnect",e)}_validate(e){return this.dialect.connectionManager.validate?this.dialect.connectionManager.validate(e):!0}};eS.exports=$g;eS.exports.ConnectionManager=$g;eS.exports.default=$g});var ss=A((lzr,Mqe)=>{"use strict";var Jg=new Map;Mqe.exports=t=>(Jg.has(t)||Jg.set(t,new Map),{clear(){Jg.get(t).clear()},refresh(e){for(let r of e.types[t])Jg.get(t).set(r,e.parse)},get(e){return Jg.get(t).get(e)}})});var mqe=A((pzr,rS)=>{"use strict";var eVt=Object.defineProperty,Oqe=Object.getOwnPropertySymbols,tVt=Object.prototype.hasOwnProperty,rVt=Object.prototype.propertyIsEnumerable,Aqe=(t,e,r)=>e in t?eVt(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,nVt=(t,e)=>{for(var r in e||(e={}))tVt.call(e,r)&&Aqe(t,r,e[r]);if(Oqe)for(var r of Oqe(e))rVt.call(e,r)&&Aqe(t,r,e[r]);return t},iVt=Ks(),aVt=uu(),AM=v0(),{logger:sVt}=Gr(),oVt=R0().mariadb,cVt=Xo(),_qe=sVt.debugContext("connection:mariadb"),tS=ss()("mariadb"),Zg=class t extends aVt{constructor(e,r){r.config.port=r.config.port||3306,super(e,r),this.lib=this._loadDialectModule("mariadb"),this.refreshTypeParser(oVt)}static _typecast(e,r){return tS.get(e.type)?tS.get(e.type)(e,this.sequelize.options,r):r()}_refreshTypeParser(e){tS.refresh(e)}_clearTypeParser(){tS.clear()}async connect(e){let r=this.sequelize.options.timezone;r=/\//.test(r)?cVt.tz(r).format("Z"):r;let n=nVt({host:e.host,port:e.port,user:e.username,password:e.password,database:e.database,timezone:r,typeCast:t._typecast.bind(this),bigNumberStrings:!1,supportBigNumbers:!0,foundRows:!1},e.dialectOptions);this.sequelize.config.keepDefaultTimezone||(n.initSql?(Array.isArray(n.initSql)||(n.initSql=[n.initSql]),n.initSql.push(`SET time_zone = '${r}'`)):n.initSql=`SET time_zone = '${r}'`);try{let i=await this.lib.createConnection(n);return this.sequelize.options.databaseVersion=iVt.coerce(i.serverVersion()).version,_qe("connection acquired"),i.on("error",a=>{switch(a.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 AM.ConnectionRefusedError(i);case"ER_ACCESS_DENIED_ERROR":case"ER_ACCESS_DENIED_NO_PASSWORD_ERROR":throw new AM.AccessDeniedError(i);case"ENOTFOUND":throw new AM.HostNotFoundError(i);case"EHOSTUNREACH":case"ENETUNREACH":case"EADDRNOTAVAIL":throw new AM.HostNotReachableError(i);case"EINVAL":throw new AM.InvalidConnectionError(i);default:throw new AM.ConnectionError(i)}}}async disconnect(e){if(!e.isValid()){_qe("connection tried to disconnect but was already at CLOSED state");return}return await e.end()}validate(e){return e&&e.isValid()}};rS.exports=Zg;rS.exports.ConnectionManager=Zg;rS.exports.default=Zg});var lu=A((fzr,nS)=>{"use strict";var uVt=Object.defineProperty,Eqe=Object.getOwnPropertySymbols,lVt=Object.prototype.hasOwnProperty,pVt=Object.prototype.propertyIsEnumerable,zqe=(t,e,r)=>e in t?uVt(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,fVt=(t,e)=>{for(var r in e||(e={}))lVt.call(e,r)&&zqe(t,r,e[r]);if(Eqe)for(var r of Eqe(e))pVt.call(e,r)&&zqe(t,r,e[r]);return t},cp=it(),dVt=zg(),ma=Pi(),bVt=wg(),hVt=dM(),MVt=(oM(),xc(sM)).v4,{safeStringifyJson:gqe}=G0(),ey=class t{constructor(e,r,n){this.uuid=MVt(),this.connection=e,this.instance=n.instance,this.model=n.model,this.sequelize=r,this.options=fVt({plain:!1,raw:!1,logging:console.log},n),this.checkLoggingOption(),n.rawErrors&&(this.formatError=t.prototype.formatError)}static formatBindParameters(e,r,n,i,a){if(!r)return[e,[]];if(a=a||{},typeof i!="function"&&(a=i||{},i=void 0),!i)a.skipValueReplace?i=(u,l,p)=>{if(p[l]!==void 0)return u}:i=(u,l,p,f,b)=>{if(p[l]!==void 0)return dVt.escape(p[l],f,b)};else if(a.skipValueReplace){let u=i;i=(l,p,f,b,O,M)=>{if(u(l,p,f,b,O,M)!==void 0)return l}}let s=null,o=Array.isArray(r);return e=e.replace(/\B\$(\$|\w+)/g,(u,l)=>{if(l==="$")return a.skipUnescape?u:l;let p;if(o?l.match(/^[1-9]\d*$/)&&(l=l-1,p=i(u,l,r,s,n,a)):l.match(/^\d*$/)||(p=i(u,l,r,s,n,a)),p===void 0)throw new Error(`Named bind parameter "${u}" has no value in the given object.`);return p}),[e,[]]}formatError(e,r){return e.stack=r,e}run(){throw new Error("The run method wasn't overwritten!")}checkLoggingOption(){this.options.logging===!0&&(hVt.noTrueLogging(),this.options.logging=console.log)}getInsertIdField(){return"insertId"}getUniqueConstraintErrorMessage(e){let r=e?`${e} must be unique`:"Must be unique";if(e&&this.model)for(let n of Object.keys(this.model.uniqueKeys))this.model.uniqueKeys[n].fields.includes(e.replace(/"/g,""))&&this.model.uniqueKeys[n].msg&&(r=this.model.uniqueKeys[n].msg);return r}isRawQuery(){return this.options.type===ma.RAW}isVersionQuery(){return this.options.type===ma.VERSION}isUpsertQuery(){return this.options.type===ma.UPSERT}isInsertQuery(e,r){let n=!0;return this.options.type===ma.INSERT?!0:(n=n&&this.sql.toLowerCase().startsWith("insert into"),n=n&&(!e||Object.prototype.hasOwnProperty.call(e,this.getInsertIdField())),n=n&&(!r||Object.prototype.hasOwnProperty.call(r,this.getInsertIdField())),n)}handleInsertQuery(e,r){if(this.instance){let n=this.model.autoIncrementAttribute,i=null;i=i||e&&e[this.getInsertIdField()],i=i||r&&r[this.getInsertIdField()],this.instance[n]=i}}isShowTablesQuery(){return this.options.type===ma.SHOWTABLES}handleShowTablesQuery(e){return cp.flatten(e.map(r=>Object.values(r)))}isShowIndexesQuery(){return this.options.type===ma.SHOWINDEXES}isShowConstraintsQuery(){return this.options.type===ma.SHOWCONSTRAINTS}isDescribeQuery(){return this.options.type===ma.DESCRIBE}isSelectQuery(){return this.options.type===ma.SELECT}isBulkUpdateQuery(){return this.options.type===ma.BULKUPDATE}isBulkDeleteQuery(){return this.options.type===ma.BULKDELETE}isForeignKeysQuery(){return this.options.type===ma.FOREIGNKEYS}isUpdateQuery(){return this.options.type===ma.UPDATE}handleSelectQuery(e){let r=null;if(this.options.fieldMap){let n=this.options.fieldMap;e=e.map(i=>cp.reduce(n,(a,s,o)=>(a[o]!==void 0&&s!==o&&(a[s]=a[o],delete a[o]),a),i))}return this.options.raw?r=e.map(n=>{let i={};for(let a in n)Object.prototype.hasOwnProperty.call(n,a)&&(i[a]=n[a]);return this.options.nest&&(i=bVt.transform(i)),i}):this.options.hasJoin===!0?(e=t._groupJoinData(e,{model:this.model,includeMap:this.options.includeMap,includeNames:this.options.includeNames},{checkExisting:this.options.hasMultiAssociation}),r=this.model.bulkBuild(e,{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})):r=this.model.bulkBuild(e,{isNewRecord:!1,raw:!0,attributes:this.options.originalAttributes||this.options.attributes}),this.options.plain&&(r=r.length===0?null:r[0]),r}isShowOrDescribeQuery(){let e=!1;return e=e||this.sql.toLowerCase().startsWith("show"),e=e||this.sql.toLowerCase().startsWith("describe"),e}isCallQuery(){return this.sql.toLowerCase().startsWith("call")}_logQuery(e,r,n){let{connection:i,options:a}=this,s=this.sequelize.options.benchmark||a.benchmark,o=this.sequelize.options.logQueryParameters||a.logQueryParameters,u=Date.now(),l="";if(o&&n){let b=e.endsWith(";")?"":";",O;Array.isArray(n)?O=n.map(M=>gqe(M)).join(", "):O=gqe(n),l=`${b} ${O}`}let p=`(${i.uuid||"default"}): ${e}${l}`,f=`Executing ${p}`;return r(f),s||this.sequelize.log(`Executing ${p}`,a),()=>{let b=`Executed ${p}`;r(b),s&&this.sequelize.log(b,Date.now()-u,a)}}static _groupJoinData(e,r,n){if(!e.length)return[];let i,a,s,o,u,l,p=e.length,f,b,O,M,m,z,y,R,w=n.checkExisting,q,C,L,j=w?[]:new Array(p),I={},U={},Y,S,te,V,D,P,F,re,ee=Q=>{Object.prototype.hasOwnProperty.call(P.includeMap,Q)&&(U[b]=P=P.includeMap[Q],re?re=`${re}.${Q}`:re=Q,U[re]=P)},Ae={},ge=(Q,ae)=>(Object.prototype.hasOwnProperty.call(ae,Q)||(ae[Q]=Q.substr(0,Q.lastIndexOf("."))),ae[Q]),we={},Qe=Q=>{if(!Object.prototype.hasOwnProperty.call(we,Q)){let ae=Q.lastIndexOf(".");we[Q]=Q.substr(ae===-1?0:ae+1)}return we[Q]},de={},tt=Q=>{if(!Object.prototype.hasOwnProperty.call(de,Q)){let ae=ge(Q,Ae);Object.prototype.hasOwnProperty.call(de,ae)||(de[ae]=ae?ae.split("."):[]),de[Q]=de[ae]}return de[Q]},je={},Ee=Q=>{if(!Object.prototype.hasOwnProperty.call(je,Q)){let ae=tt(Q),le=ae.length;je[Q]=le?ae[le-1]:""}return je[Q]},Ze=Q=>{let ae=cp.chain(Q.uniqueKeys);return ae=ae.result(`${ae.findKey()}.fields`).map(le=>cp.findKey(Q.attributes,Oe=>Oe.field===le)).value(),ae},Ke=Q=>Q instanceof Buffer?Q.toString("hex"):Q,_e,We,oe;for(u=0;u<p;u++){if(l=e[u],u===0&&(f=cp.sortBy(Object.keys(l),Q=>[Q.split(".").length]),M=f.length),w){if(R=!1,o=r.model.primaryKeyAttributes.length,L="",o===1)L=Ke(l[r.model.primaryKeyAttributes[0]]);else if(o>1)for(s=0;s<o;s++)L+=Ke(l[r.model.primaryKeyAttributes[s]]);else if(!cp.isEmpty(r.model.uniqueKeys))for(We=Ze(r.model),s=0;s<We.length;s++)L+=l[We[s]]}for(y=z={},V=void 0,O=0;O<M;O++){if(b=f[O],S=ge(b,Ae),Y=tt(b),u===0&&!Object.prototype.hasOwnProperty.call(U,b)&&(Y.length?(P=r,re=void 0,Y.forEach(ee)):U[b]=U[""]=r),V!==void 0&&V!==Y){if(w){if(a=V.length,F=null,C=null,a)for(i=0;i<a;i++){if(oe=F?`${F}.${V[i]}`:V[i],_e=U[oe].model.primaryKeyAttributes,o=_e.length,q=oe,o===1)q+=Ke(l[`${oe}.${_e[0]}`]);else if(o>1)for(s=0;s<o;s++)q+=Ke(l[`${oe}.${_e[s]}`]);else if(!cp.isEmpty(U[oe].model.uniqueKeys))for(We=Ze(U[oe].model),s=0;s<We.length;s++)q+=l[`${oe}.${We[s]}`];C||(C=L),q=C+q,F=oe,i<a-1&&(C=q)}else q=L;q===L?I[q]?R=!0:I[q]=z:I[q]||(F=I[C],D=Ee(m),U[m].association.isSingleAssociation?F&&(F[D]=I[q]=z):(F[D]||(F[D]=[]),F[D].push(I[q]=z))),z={}}else if(P=y,a=Y.length,a)for(i=0;i<a;i++)i===a-1&&(z=P[Y[i]]={}),P=P[Y[i]]||{}}z[Qe(b)]=l[b],m=b,V=Y,te=S}if(w){if(a=V.length,F=null,C=null,a)for(i=0;i<a;i++){if(oe=F?`${F}.${V[i]}`:V[i],_e=U[oe].model.primaryKeyAttributes,o=_e.length,q=oe,o===1)q+=Ke(l[`${oe}.${_e[0]}`]);else if(o>0)for(s=0;s<o;s++)q+=Ke(l[`${oe}.${_e[s]}`]);else if(!cp.isEmpty(U[oe].model.uniqueKeys))for(We=Ze(U[oe].model),s=0;s<We.length;s++)q+=l[`${oe}.${We[s]}`];C||(C=L),q=C+q,F=oe,i<a-1&&(C=q)}else q=L;q===L?I[q]?R=!0:I[q]=z:I[q]||(F=I[C],D=Ee(m),U[m].association.isSingleAssociation?F&&(F[D]=I[q]=z):(F[D]||(F[D]=[]),F[D].push(I[q]=z))),R||j.push(y)}else j[u]=y}return j}};nS.exports=ey;nS.exports.AbstractQuery=ey;nS.exports.default=ey});var Iqe=A((dzr,vqe)=>{"use strict";var OVt=Object.defineProperty,yqe=Object.getOwnPropertySymbols,AVt=Object.prototype.hasOwnProperty,_Vt=Object.prototype.propertyIsEnumerable,Rqe=(t,e,r)=>e in t?OVt(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,mVt=(t,e)=>{for(var r in e||(e={}))AVt.call(e,r)&&Rqe(t,r,e[r]);if(yqe)for(var r of yqe(e))_Vt.call(e,r)&&Rqe(t,r,e[r]);return t},Nqe=lu(),iS=v0(),Tqe=it(),gH=R0(),{logger:EVt}=Gr(),zVt=1062,gVt=1213,wqe=1451,yVt=1452,qqe=EVt.debugContext("sql:mariadb"),yH=class extends Nqe{constructor(e,r,n){super(e,r,mVt({showWarnings:!1},n))}static formatBindParameters(e,r,n){let i=[],a=(s,o,u)=>{if(u[o]!==void 0)return i.push(u[o]),"?"};return e=Nqe.formatBindParameters(e,r,n,a)[0],[e,i.length>0?i:void 0]}async run(e,r){this.sql=e;let{connection:n,options:i}=this,a=this.sequelize.options.showWarnings||i.showWarnings,s=this._logQuery(e,qqe,r);r&&qqe("parameters(%j)",r);let o,u=new Error;try{o=await n.query(this.sql,r)}catch(l){if(i.transaction&&l.errno===gVt){try{await i.transaction.rollback()}catch{}i.transaction.finished="rollback"}throw l.sql=e,l.parameters=r,this.formatError(l,u.stack)}finally{s()}return a&&o&&o.warningStatus>0&&await this.logWarnings(o),this.formatResults(o)}formatResults(e){let r=this.instance;if(this.isBulkUpdateQuery()||this.isBulkDeleteQuery())return e.affectedRows;if(this.isUpsertQuery())return[r,e.affectedRows===1];if(this.isInsertQuery(e)&&(this.handleInsertQuery(e),!this.instance)){if(this.model&&this.model.autoIncrementAttribute&&this.model.autoIncrementAttribute===this.model.primaryKeyAttribute&&this.model.rawAttributes[this.model.primaryKeyAttribute]){let n=e[this.getInsertIdField()];r=new Array(e.affectedRows);let i=this.model.rawAttributes[this.model.primaryKeyAttribute].field;for(let a=0;a<e.affectedRows;a++)r[a]={[i]:n+a};return[r,e.affectedRows]}return[e[this.getInsertIdField()],e.affectedRows]}if(this.isSelectQuery())return this.handleJsonSelectQuery(e),this.handleSelectQuery(e);if(this.isInsertQuery()||this.isUpdateQuery())return[r,e.affectedRows];if(this.isCallQuery())return e[0];if(this.isRawQuery()){let n=e.meta;return delete e.meta,[e,n]}if(this.isShowIndexesQuery())return this.handleShowIndexesQuery(e);if(this.isForeignKeysQuery()||this.isShowConstraintsQuery())return e;if(this.isShowTablesQuery())return this.handleShowTablesQuery(e);if(this.isDescribeQuery()){r={};for(let n of e)r[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 r}return this.isVersionQuery()?e[0].version:r}handleJsonSelectQuery(e){if(!(!this.model||!this.model.fieldRawAttributesMap))for(let r of Object.keys(this.model.fieldRawAttributesMap)){let n=this.model.fieldRawAttributesMap[r];n.type instanceof gH.JSON&&(e=e.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])),gH.JSON.parse?gH.JSON.parse(n,this.sequelize.options,i[n.fieldName]):i)))}}async logWarnings(e){let r=await this.run("SHOW WARNINGS"),n=`MariaDB Warnings (${this.connection.uuid||"default"}): `,i=[];for(let a of r)if(!(a===void 0||typeof a[Symbol.iterator]!="function"))for(let s of a)if(Object.prototype.hasOwnProperty.call(s,"Message"))i.push(s.Message);else for(let o of s.keys())i.push([o,s[o]].join(": "));return this.sequelize.log(n+i.join("; "),this.options),e}formatError(e,r){switch(e.errno){case zVt:{let n=e.message.match(/Duplicate entry '([\s\S]*)' for key '?((.|\s)*?)'?\s.*$/),i={},a="Validation error",s=n?n[1].split("-"):void 0,o=n?n[2]:void 0,u=n?n[1]:void 0,l=this.model&&this.model.uniqueKeys[o];l?(l.msg&&(a=l.msg),i=Tqe.zipObject(l.fields,s)):i[o]=u;let p=[];return Tqe.forOwn(i,(f,b)=>{p.push(new iS.ValidationErrorItem(this.getUniqueConstraintErrorMessage(b),"unique violation",b,f,this.instance,"not_unique"))}),new iS.UniqueConstraintError({message:a,errors:p,parent:e,fields:i,stack:r})}case wqe:case yVt:{let n=e.message.match(/CONSTRAINT ([`"])(.*)\1 FOREIGN KEY \(\1(.*)\1\) REFERENCES \1(.*)\1 \(\1(.*)\1\)/),i=n?n[1]:"`",a=n?n[3].split(new RegExp(`${i}, *${i}`)):void 0;return new iS.ForeignKeyConstraintError({reltype:e.errno===wqe?"parent":"child",table:n?n[4]:void 0,fields:a,value:a&&a.length&&this.instance&&this.instance[a[0]]||void 0,index:n?n[2]:void 0,parent:e,stack:r})}default:return new iS.DatabaseError(e,{stack:r})}}handleShowTablesQuery(e){return e.map(r=>({tableName:r.TABLE_NAME,schema:r.TABLE_SCHEMA}))}handleShowIndexesQuery(e){let r,n=[];return e.forEach(i=>{(!r||r.name!==i.Key_name)&&(r={primary:i.Key_name==="PRIMARY",fields:[],name:i.Key_name,tableName:i.Table,unique:i.Non_unique!==1,type:i.Index_type},n.push(r)),r.fields[i.Seq_in_index-1]={attribute:i.Column_name,length:i.Sub_part||void 0,order:i.Collation==="A"?"ASC":void 0}}),n}};vqe.exports=yH});var Dqe=A((bzr,Cqe)=>{"use strict";var RVt=Object.defineProperty,Sqe=Object.getOwnPropertySymbols,NVt=Object.prototype.hasOwnProperty,TVt=Object.prototype.propertyIsEnumerable,Lqe=(t,e,r)=>e in t?RVt(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,wVt=(t,e)=>{for(var r in e||(e={}))NVt.call(e,r)&&Lqe(t,r,e[r]);if(Sqe)for(var r of Sqe(e))TVt.call(e,r)&&Lqe(t,r,e[r]);return t},aS=it(),Pt=zn(),qVt=G0(),vVt={OperatorMap:{[Pt.eq]:"=",[Pt.ne]:"!=",[Pt.gte]:">=",[Pt.gt]:">",[Pt.lte]:"<=",[Pt.lt]:"<",[Pt.not]:"IS NOT",[Pt.is]:"IS",[Pt.in]:"IN",[Pt.notIn]:"NOT IN",[Pt.like]:"LIKE",[Pt.notLike]:"NOT LIKE",[Pt.iLike]:"ILIKE",[Pt.notILike]:"NOT ILIKE",[Pt.startsWith]:"LIKE",[Pt.endsWith]:"LIKE",[Pt.substring]:"LIKE",[Pt.regexp]:"~",[Pt.notRegexp]:"!~",[Pt.iRegexp]:"~*",[Pt.notIRegexp]:"!~*",[Pt.between]:"BETWEEN",[Pt.notBetween]:"NOT BETWEEN",[Pt.overlap]:"&&",[Pt.contains]:"@>",[Pt.contained]:"<@",[Pt.adjacent]:"-|-",[Pt.strictLeft]:"<<",[Pt.strictRight]:">>",[Pt.noExtendRight]:"&<",[Pt.noExtendLeft]:"&>",[Pt.any]:"ANY",[Pt.all]:"ALL",[Pt.and]:" AND ",[Pt.or]:" OR ",[Pt.col]:"COL",[Pt.placeholder]:"$$PLACEHOLDER$$",[Pt.match]:"@@"},OperatorsAliasMap:{},setOperatorsAliases(t){!t||aS.isEmpty(t)?this.OperatorsAliasMap=!1:this.OperatorsAliasMap=wVt({},t)},_replaceAliases(t){let e={};return this.OperatorsAliasMap?(qVt.getOperators(t).forEach(r=>{let n=t[r];aS.isPlainObject(n)?e[r]=this._replaceAliases(n):e[r]=n}),aS.forOwn(t,(r,n)=>{n=this.OperatorsAliasMap[n]||n,aS.isPlainObject(r)&&(r=this._replaceAliases(r)),e[n]=r}),e):t}};Cqe.exports=vVt});var xqe=A((hzr,Bqe)=>{"use strict";var IVt=(oM(),xc(sM)).v4,SVt={setIsolationLevelQuery(t,e){if(!e.parent)return`SET TRANSACTION ISOLATION LEVEL ${t};`},generateTransactionId(){return IVt()},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;"}};Bqe.exports=SVt});var up=A((Ozr,Fqe)=>{"use strict";var LVt=Object.defineProperty,CVt=Object.defineProperties,DVt=Object.getOwnPropertyDescriptors,Wqe=Object.getOwnPropertySymbols,BVt=Object.prototype.hasOwnProperty,xVt=Object.prototype.propertyIsEnumerable,Pqe=(t,e,r)=>e in t?LVt(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Dd=(t,e)=>{for(var r in e||(e={}))BVt.call(e,r)&&Pqe(t,r,e[r]);if(Wqe)for(var r of Wqe(e))xVt.call(e,r)&&Pqe(t,r,e[r]);return t},sS=(t,e)=>CVt(t,DVt(e)),oS=require("util"),Ct=it(),WVt=(oM(),xc(sM)).v4,Ge=G0(),Mzr=dM(),kqe=zg(),_M=R0(),$s=xV(),mM=np(),RH=ip(),PVt=lM(),kVt=qd(),Ce=zn(),NH=v0(),Uqe=HV(),ty=class{constructor(e){if(!e.sequelize)throw new Error("QueryGenerator initialized without options.sequelize");if(!e._dialect)throw new Error("QueryGenerator initialized without options._dialect");this.sequelize=e.sequelize,this.options=e.sequelize.options,this.dialect=e._dialect.name,this._dialect=e._dialect,this._initQuoteIdentifier()}extractTableDetails(e,r){return r=r||{},e=e||{},{schema:e.schema||r.schema||this.options.schema||"public",tableName:Ct.isPlainObject(e)?e.tableName:e,delimiter:e.delimiter||r.delimiter||"."}}addSchema(e){if(!e._schema)return e.tableName||e;let r=this;return{tableName:e.tableName||e,table:e.tableName||e,name:e.name||e,schema:e._schema,delimiter:e._schemaDelimiter||".",toString(){return r.quoteTable(this)}}}dropSchema(e,r){return this.dropTableQuery(e,r)}describeTableQuery(e,r,n){return`DESCRIBE ${this.quoteTable(this.addSchema({tableName:e,_schema:r,_schemaDelimiter:n}))};`}dropTableQuery(e){return`DROP TABLE IF EXISTS ${this.quoteTable(e)};`}renameTableQuery(e,r){return`ALTER TABLE ${this.quoteTable(e)} RENAME TO ${this.quoteTable(r)};`}populateInsertQueryReturnIntoBinds(){}insertQuery(e,r,n,i){i=i||{},Ct.defaults(i,this.options);let a={},s=i.bind||[],o=[],u=[],l=[],p=[],f=this.quoteTable(e),b=i.bindParam===void 0?this.bindParam(s):i.bindParam,O=[],M,m="",z="",y="",R="",w=!1,q="";if(n&&Ct.each(n,(I,U)=>{a[U]=I,I.field&&(a[I.field]=I)}),this._dialect.supports["DEFAULT VALUES"]?z+=" DEFAULT VALUES":this._dialect.supports["VALUES ()"]&&(z+=" VALUES ()"),(this._dialect.supports.returnValues||this._dialect.supports.returnIntoValues)&&i.returning){let I=this.generateReturnValues(n,i);u.push(...I.returnFields),this._dialect.supports.returnIntoValues&&l.push(...I.returnTypes),R=I.returningFragment,q=I.tmpTable||"",y=I.outputFragment||""}(Ct.get(this,["sequelize","options","dialectOptions","prependSearchPath"])||i.searchPath)&&(i.bindParam=!1),this._dialect.supports.EXCEPTION&&i.exception&&(i.bindParam=!1),r=Ge.removeNullValuesFromHash(r,this.options.omitNull);for(let I in r)if(Object.prototype.hasOwnProperty.call(r,I)){let U=r[I];o.push(this.quoteIdentifier(I)),a&&a[I]&&a[I].autoIncrement===!0&&U==null?this._dialect.supports.autoIncrement.defaultValue?this._dialect.supports.DEFAULT?p.push("DEFAULT"):p.push(this.escape(null)):o.splice(-1,1):(a&&a[I]&&a[I].autoIncrement===!0&&(w=!0),U instanceof Ge.SequelizeMethod||i.bindParam===!1?p.push(this.escape(U,a&&a[I]||void 0,{context:"INSERT"})):p.push(this.format(U,a&&a[I]||void 0,{context:"INSERT"},b)))}let C="";if(!Ct.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 I=i.upsertKeys.map(S=>this.quoteIdentifier(S)),U=i.updateOnDuplicate.map(S=>`${this.quoteIdentifier(S)}=EXCLUDED.${this.quoteIdentifier(S)}`),Y=["ON CONFLICT","(",I.join(","),")"];Ct.isEmpty(i.conflictWhere)||Y.push(this.whereQuery(i.conflictWhere,i)),Ct.isEmpty(U)?Y.push("DO NOTHING"):Y.push("DO UPDATE SET",U.join(",")),C=` ${Ge.joinSQLFragments(Y)}`}else{let I=i.updateOnDuplicate.map(U=>`${this.quoteIdentifier(U)}=VALUES(${this.quoteIdentifier(U)})`);if(Ct.isEmpty(I)&&i.upsertKeys&&I.push(...i.upsertKeys.map(U=>`${this.quoteIdentifier(U)}=${this.quoteIdentifier(U)}`)),Ct.isEmpty(I))throw new Error("No update values found for ON DUPLICATE KEY UPDATE clause, and no identifier fields could be found to use instead.");C+=`${this._dialect.supports.inserts.updateOnDuplicate} ${I.join(",")}`}let L={ignoreDuplicates:i.ignoreDuplicates?this._dialect.supports.inserts.ignoreDuplicates:"",onConflictDoNothing:i.ignoreDuplicates?this._dialect.supports.inserts.onConflictDoNothing:"",attributes:o.join(","),output:y,values:p.join(","),tmpTable:q};if(m=`${q}INSERT${L.ignoreDuplicates} INTO ${f} (${L.attributes})${L.output} VALUES (${L.values})${C}${L.onConflictDoNothing}${m}`,z=`${q}INSERT${L.ignoreDuplicates} INTO ${f}${L.output}${C}${L.onConflictDoNothing}${z}`,this._dialect.supports.EXCEPTION&&i.exception){let I="DROP FUNCTION IF EXISTS pg_temp.testfunc()";u.length===0&&u.push("*");let U=`$func_${WVt().replace(/-/g,"")}$`,Y=`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;",m=`CREATE OR REPLACE FUNCTION pg_temp.testfunc(OUT response ${f}, OUT sequelize_caught_exception text) RETURNS RECORD AS ${U} BEGIN ${m} RETURNING * INTO response; EXCEPTION ${i.exception} END ${U} LANGUAGE plpgsql; ${Y} ${I}`}else m+=R,z+=R;this._dialect.supports.returnIntoValues&&i.returning&&this.populateInsertQueryReturnIntoBinds(u,l,s.length,O,i),M=`${L.attributes.length?m:z}${O.join(",")};`,this._dialect.supports.finalTable&&(M=`SELECT * FROM FINAL TABLE(${L.attributes.length?m:z});`),w&&this._dialect.supports.autoIncrement.identityInsert&&(M=`SET IDENTITY_INSERT ${f} ON; ${M} SET IDENTITY_INSERT ${f} OFF;`);let j={query:M};return i.bindParam!==!1&&(j.bind=s),j}bulkInsertQuery(e,r,n,i){n=n||{},i=i||{};let a=[],s={},o=[],u="";for(let O of r)Ct.forOwn(O,(M,m)=>{o.includes(m)||o.push(m),i[m]&&i[m].autoIncrement===!0&&(s[m]=!0)});for(let O of r){let M=o.map(m=>this._dialect.supports.bulkDefault&&s[m]===!0?O[m]!=null?O[m]:"DEFAULT":this.escape(O[m],i[m],{context:"INSERT"}));a.push(`(${M.join(",")})`)}if(this._dialect.supports.inserts.updateOnDuplicate&&n.updateOnDuplicate)if(this._dialect.supports.inserts.updateOnDuplicate==" ON CONFLICT DO UPDATE SET"){let O=n.upsertKeys.map(z=>this.quoteIdentifier(z)),M=n.updateOnDuplicate.map(z=>`${this.quoteIdentifier(z)}=EXCLUDED.${this.quoteIdentifier(z)}`),m=!1;if(n.conflictWhere){if(!this._dialect.supports.inserts.onConflictWhere)throw new Error(`conflictWhere not supported for dialect ${this._dialect.name}`);m=this.whereQuery(n.conflictWhere,n)}u=["ON CONFLICT","(",O.join(","),")",m,"DO UPDATE SET",M.join(",")]}else{if(n.conflictWhere)throw new Error(`conflictWhere not supported for dialect ${this._dialect.name}`);let O=n.updateOnDuplicate.map(M=>`${this.quoteIdentifier(M)}=VALUES(${this.quoteIdentifier(M)})`);u=`${this._dialect.supports.inserts.updateOnDuplicate} ${O.join(",")}`}let l=n.ignoreDuplicates?this._dialect.supports.inserts.ignoreDuplicates:"",p=o.map(O=>this.quoteIdentifier(O)).join(","),f=n.ignoreDuplicates?this._dialect.supports.inserts.onConflictDoNothing:"",b="";if(this._dialect.supports.returnValues&&n.returning){let O=this.generateReturnValues(i,n);b+=O.returningFragment}return Ge.joinSQLFragments(["INSERT",l,"INTO",this.quoteTable(e),`(${p})`,"VALUES",a.join(","),u,f,b,";"])}updateQuery(e,r,n,i,a){i=i||{},Ct.defaults(i,this.options),r=Ge.removeNullValuesFromHash(r,i.omitNull,i);let s=[],o=[],u={},l="",p="",f="";(Ct.get(this,["sequelize","options","dialectOptions","prependSearchPath"])||i.searchPath)&&(i.bindParam=!1);let b=i.bindParam===void 0?this.bindParam(o):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)?f+=" AND ":f+=" WHERE ",f+=`rownum <= ${this.escape(i.limit)} `):f=` LIMIT ${this.escape(i.limit)} `),this._dialect.supports.returnValues&&i.returning){let z=this.generateReturnValues(a,i);f+=z.returningFragment,p=z.tmpTable||"",l=z.outputFragment||"",!this._dialect.supports.returnValues.output&&i.returning&&(i.mapToModel=!0)}a&&Ct.each(a,(z,y)=>{u[y]=z,z.field&&(u[z.field]=z)});for(let z in r){if(u&&u[z]&&u[z].autoIncrement===!0&&!this._dialect.supports.autoIncrement.update)continue;let y=r[z];y instanceof Ge.SequelizeMethod||i.bindParam===!1?s.push(`${this.quoteIdentifier(z)}=${this.escape(y,u&&u[z]||void 0,{context:"UPDATE"})}`):s.push(`${this.quoteIdentifier(z)}=${this.format(y,u&&u[z]||void 0,{context:"UPDATE"},b)}`)}let O=sS(Dd({},i),{bindParam:b});if(s.length===0)return"";let m={query:`${p}UPDATE ${this.quoteTable(e)} SET ${s.join(",")}${l} ${this.whereQuery(n,O)}${f}`.trim()};return i.bindParam!==!1&&(m.bind=o),m}arithmeticQuery(e,r,n,i,a,s){s=s||{},Ct.defaults(s,{returning:!0}),a=Ge.removeNullValuesFromHash(a,this.options.omitNull);let o="",u="";if(this._dialect.supports.returnValues&&s.returning){let p=this.generateReturnValues(null,s);o=p.outputFragment,u=p.returningFragment}let l=[];for(let p in i){let f=i[p],b=this.quoteIdentifier(p),O=this.escape(f);l.push(`${b}=${b}${e} ${O}`)}for(let p in a){let f=a[p],b=this.quoteIdentifier(p),O=this.escape(f);l.push(`${b}=${O}`)}return Ge.joinSQLFragments(["UPDATE",this.quoteTable(r),"SET",l.join(","),o,this.whereQuery(n),u])}addIndexQuery(e,r,n,i){n=n||{},Array.isArray(r)?n.fields=r:(n=r,r=void 0),n.prefix=n.prefix||i||e,n.prefix&&typeof n.prefix=="string"&&(n.prefix=n.prefix.replace(/\./g,"_"),n.prefix=n.prefix.replace(/("|')/g,""));let a=n.fields.map(u=>{if(u instanceof Ge.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: ${oS.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 p=u.operator||n.operator;p&&(l+=` ${p}`)}return this._dialect.supports.index.length&&u.length&&(l+=`(${u.length})`),u.order&&(l+=` ${u.order}`),l});n.name||(n=Ge.nameIndex(n,n.prefix)),n=$s._conformIndex(n),this._dialect.supports.index.type||delete n.type,n.where&&(n.where=this.whereQuery(n.where)),typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e);let s=this._dialect.supports.index.concurrently&&n.concurrently?"CONCURRENTLY":void 0,o;return this._dialect.supports.indexViaAlter?o=["ALTER TABLE",e,s,"ADD"]:o=["CREATE"],o=o.concat(n.unique?"UNIQUE":"",n.type,"INDEX",this._dialect.supports.indexViaAlter?void 0:s,this.quoteIdentifiers(n.name),this._dialect.supports.index.using===1&&n.using?`USING ${n.using}`:"",this._dialect.supports.indexViaAlter?void 0:`ON ${e}`,this._dialect.supports.index.using===2&&n.using?`USING ${n.using}`:"",`(${a.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),Ct.compact(o).join(" ")}addConstraintQuery(e,r){return typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e),Ge.joinSQLFragments(["ALTER TABLE",e,"ADD",this.getConstraintSnippet(e,r||{}),";"])}getConstraintSnippet(e,r){let n,i,a=r.fields.map(u=>{if(typeof u=="string")return this.quoteIdentifier(u);if(u instanceof Ge.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)}),s=a.join(", "),o=a.join("_");switch(r.type.toUpperCase()){case"UNIQUE":i=this.quoteIdentifier(r.name||`${e}_${o}_uk`),n=`CONSTRAINT ${i} UNIQUE (${s})`;break;case"CHECK":r.where=this.whereItemsQuery(r.where),i=this.quoteIdentifier(r.name||`${e}_${o}_ck`),n=`CONSTRAINT ${i} CHECK (${r.where})`;break;case"DEFAULT":if(r.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(r.name||`${e}_${o}_df`),n=`CONSTRAINT ${i} DEFAULT (${this.escape(r.defaultValue)}) FOR ${a[0]}`;break;case"PRIMARY KEY":i=this.quoteIdentifier(r.name||`${e}_${o}_pk`),n=`CONSTRAINT ${i} PRIMARY KEY (${s})`;break;case"FOREIGN KEY":let u=r.references;if(!u||!u.table||!(u.field||u.fields))throw new Error("references object with table and field must be specified");i=this.quoteIdentifier(r.name||`${e}_${o}_${u.table}_fk`);let l=typeof u.field<"u"?this.quoteIdentifier(u.field):u.fields.map(f=>this.quoteIdentifier(f)).join(", "),p=`${this.quoteTable(u.table)} (${l})`;n=`CONSTRAINT ${i} `,n+=`FOREIGN KEY (${s}) REFERENCES ${p}`,r.onUpdate&&(n+=` ON UPDATE ${r.onUpdate.toUpperCase()}`),r.onDelete&&(n+=` ON DELETE ${r.onDelete.toUpperCase()}`);break;default:throw new Error(`${r.type} is invalid.`)}return r.deferrable&&["UNIQUE","PRIMARY KEY","FOREIGN KEY"].includes(r.type.toUpperCase())&&(n+=` ${this.deferConstraintsQuery(r)}`),n}removeConstraintQuery(e,r){return typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e),Ge.joinSQLFragments(["ALTER TABLE",e,"DROP CONSTRAINT",this.quoteIdentifiers(r)])}quote(e,r,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 e=="string")return this.quoteIdentifiers(e);if(Array.isArray(e)){e.forEach((p,f)=>{let b=e[f-1],O,M;if(!b&&r!==void 0?M=r:b&&b instanceof mM&&(O=b,M=b.target),M&&M.prototype instanceof $s){let m,z;if(typeof p=="function"&&p.prototype instanceof $s?m=p:Ct.isPlainObject(p)&&p.model&&p.model.prototype instanceof $s&&(m=p.model,z=p.as),m&&(!z&&O&&O instanceof mM&&O.through&&O.through.model===m?p=new mM(M,m,{as:m.name}):(p=M.getAssociationForAlias(m,z),p||(p=M.getAssociationForAlias(m,m.name))),!(p instanceof mM)))throw new Error(oS.format("Unable to find a valid association for model, '%s'",m.name))}if(typeof p=="string"){let m=i.indexOf(p.toUpperCase());if(f>0&&m!==-1)p=this.sequelize.literal(` ${i[m]}`);else if(M&&M.prototype instanceof $s){if(M.associations!==void 0&&M.associations[p])p=M.associations[p];else if(M.rawAttributes!==void 0&&M.rawAttributes[p]&&p!==M.rawAttributes[p].field)p=M.rawAttributes[p].field;else if(p.includes(".")&&M.rawAttributes!==void 0){let z=p.split(".");if(M.rawAttributes[z[0]].type instanceof _M.JSON){let y=this.quoteIdentifiers(`${M.name}.${M.rawAttributes[z[0]].field}`),R=z.slice(1);p=this.jsonPathExtractionQuery(y,R),p=this.sequelize.literal(p)}}}}e[f]=p},this);let a=e.length,s=[],o,u=0;for(u=0;u<a-1&&(o=e[u],!(typeof o=="string"||o._modelAttribute||o instanceof Ge.SequelizeMethod));u++)o instanceof mM&&(s[u]=o.as);let l="";return u>0?l+=`${this.quoteIdentifier(s.join(n))}.`:typeof e[0]=="string"&&r&&(l+=`${this.quoteIdentifier(r.name)}.`),e.slice(u).forEach(p=>{l+=this.quote(p,r,n)},this),l}if(e._modelAttribute)return`${this.quoteTable(e.Model.name)}.${this.quoteIdentifier(e.fieldName)}`;if(e instanceof Ge.SequelizeMethod)return this.handleSequelizeMethod(e);throw Ct.isPlainObject(e)&&e.raw?new Error('The `{raw: "..."}` syntax is no longer supported.  Use `sequelize.literal` instead.'):new Error(`Unknown structure passed to order / group: ${oS.inspect(e)}`)}_initQuoteIdentifier(){this._quoteIdentifier=this.quoteIdentifier,this.quoteIdentifier=function(e,r){return e==="*"?e:this._quoteIdentifier(e,r)}}quoteIdentifier(e,r){throw new Error(`quoteIdentifier for Dialect "${this.dialect}" is not implemented`)}quoteIdentifiers(e){if(e.includes(".")){e=e.split(".");let r=e.slice(0,e.length-1).join("->"),n=e[e.length-1];return`${this.quoteIdentifier(r)}.${this.quoteIdentifier(n)}`}return this.quoteIdentifier(e)}quoteAttribute(e,r){return r&&e in r.rawAttributes?this.quoteIdentifier(e):this.quoteIdentifiers(e)}getAliasToken(){return"AS"}quoteTable(e,r){let n="";return r===!0&&(r=e.as||e.name||e),Ct.isObject(e)?this._dialect.supports.schemas?(e.schema&&(n+=`${this.quoteIdentifier(e.schema)}.`),n+=this.quoteIdentifier(e.tableName)):(e.schema&&(n+=e.schema+(e.delimiter||".")),n+=e.tableName,n=this.quoteIdentifier(n)):n=this.quoteIdentifier(e),r&&(n+=` ${this.getAliasToken()} ${this.quoteIdentifier(r)}`),n}escape(e,r,n){if(n=n||{},e!=null){if(e instanceof Ge.SequelizeMethod)return this.handleSequelizeMethod(e);if(r&&r.type&&(r.type instanceof _M.STRING&&["mysql","mariadb"].includes(this.dialect)&&["number","boolean"].includes(typeof e)&&(e=String(Number(e))),this.validate(e,r,n),r.type.stringify)){let i=a=>kqe.escape(a,this.options.timezone,this.dialect);if(e=r.type.stringify(e,{escape:i,field:r,timezone:this.options.timezone,operation:n.operation}),r.type.escape===!1)return e}}return kqe.escape(e,this.options.timezone,this.dialect)}bindParam(e){return r=>(e.push(r),`$${e.length}`)}format(e,r,n,i){if(n=n||{},e!=null){if(e instanceof Ge.SequelizeMethod)throw new Error("Cannot pass SequelizeMethod as a bind parameter - use escape instead");if(r&&r.type&&(this.validate(e,r,n),r.type.bindParam))return r.type.bindParam(e,{escape:Ct.identity,field:r,timezone:this.options.timezone,operation:n.operation,bindParam:i})}return i(e)}validate(e,r,n){if(this.typeValidation&&r.type.validate&&e)try{if(n.isList&&Array.isArray(e))for(let i of e)r.type.validate(i,n);else r.type.validate(e,n)}catch(i){throw i instanceof NH.ValidationError&&i.errors.push(new NH.ValidationErrorItem(i.message,"Validation error",r.fieldName,e,null,`${r.type.key} validator`)),i}}isIdentifierQuoted(e){return/^\s*(?:([`"'])(?:(?!\1).|\1{2})*\1\.?)+\s*$/i.test(e)}jsonPathExtractionQuery(e,r,n){let i=Ct.toPath(r),a,s=this.isIdentifierQuoted(e)?e:this.quoteIdentifier(e);switch(this.dialect){case"mysql":case"mariadb":case"sqlite":return this.dialect==="mysql"&&(i=i.map(u=>/\D/.test(u)?Ge.addTicks(u,'"'):u)),a=this.escape(["$"].concat(i).join(".").replace(/\.(\d+)(?:(?=\.)|$)/g,(u,l)=>`[${l}]`)),this.dialect==="sqlite"?`json_extract(${s},${a})`:`json_unquote(json_extract(${s},${a}))`;case"postgres":let o=n?"#>":"#>>";return a=this.escape(`{${i.join(",")}}`),`(${s}${o}${a})`;default:throw new Error(`Unsupported ${this.dialect} for JSON operations`)}}selectQuery(e,r,n){r=r||{};let i=r.limit,a=[],s=[],o=r.subQuery===void 0?i&&r.hasMultiAssociation:r.subQuery,u={main:r.attributes&&r.attributes.slice(),subQuery:null},l={name:e,quotedName:null,as:null,model:n},p={names:l,options:r,subQuery:o},f=[],b=[],O;if(this.options.minifyAliases&&!r.aliasesMapping&&(r.aliasesMapping=new Map,r.aliasesByTable={},r.includeAliases=new Map),r.tableAs?l.as=this.quoteIdentifier(r.tableAs):!Array.isArray(l.name)&&l.model&&(l.as=this.quoteIdentifier(l.model.name)),l.quotedName=Array.isArray(l.name)?e.map(m=>Array.isArray(m)?this.quoteTable(m[0],m[1]):this.quoteTable(m,!0)).join(", "):this.quoteTable(l.name),o&&u.main)for(let m of l.model.primaryKeyAttributes)u.main.some(z=>m===z||m===z[0]||m===z[1])||u.main.push(l.model.rawAttributes[m].field?[m,l.model.rawAttributes[m].field]:m);if(u.main=this.escapeAttributes(u.main,r,l.as),u.main=u.main||(r.include?[`${l.as}.*`]:["*"]),(o||r.groupedLimit)&&(u.subQuery=u.main,u.main=[`${l.as||l.quotedName}.*`]),r.include)for(let m of r.include){if(m.separate)continue;let z=this.generateInclude(m,{externalAs:l.as,internalAs:l.as},p);b=b.concat(z.subQuery),f=f.concat(z.mainQuery),z.attributes.main.length>0&&(u.main=Ct.uniq(u.main.concat(z.attributes.main))),z.attributes.subQuery.length>0&&(u.subQuery=Ct.uniq(u.subQuery.concat(z.attributes.subQuery)))}if(o)s.push(this.selectFromTableFragment(r,l.model,u.subQuery,l.quotedName,l.as)),s.push(b.join(""));else{if(r.groupedLimit){l.as||(l.as=l.quotedName);let m=Dd({},r.where),z,y,R,w=l.as;if(typeof r.groupedLimit.on=="string"?y=r.groupedLimit.on:r.groupedLimit.on instanceof kVt&&(y=r.groupedLimit.on.foreignKeyField),r.groupedLimit.on instanceof PVt){w=r.groupedLimit.on.manyFromSource.as;let j=$s._validateIncludedElements({include:[{association:r.groupedLimit.on.manyFromSource,duplicating:!1,required:!0,where:Dd({[Ce.placeholder]:!0},r.groupedLimit.through&&r.groupedLimit.through.where)}],model:n});r.hasJoin=!0,r.hasMultiAssociation=!0,r.includeMap=Object.assign(j.includeMap,r.includeMap),r.includeNames=j.includeNames.concat(r.includeNames||[]),R=j.include,Array.isArray(r.order)&&(r.order.forEach((I,U)=>{Array.isArray(I)&&(I=I[0]);let Y=`subquery_order_${U}`;r.attributes.push([I,Y]),Y=this.sequelize.literal(this.quote(Y)),Array.isArray(r.order[U])?r.order[U][0]=Y:r.order[U]=Y}),z=r.order)}else z=r.order,this._dialect.supports.topLevelOrderByRequired||delete r.order,m[Ce.placeholder]=!0;let q=`SELECT * FROM (${this.selectQuery(e,{attributes:r.attributes,offset:r.offset,limit:r.groupedLimit.limit,order:z,aliasesMapping:r.aliasesMapping,aliasesByTable:r.aliasesByTable,where:m,include:R,model:n},n).replace(/;$/,"")}) ${this.getAliasToken()} sub`,C=this.whereItemQuery(Ce.placeholder,!0,{model:n}),L=q.indexOf(C);a.push(this.selectFromTableFragment(r,l.model,u.main,`(${r.groupedLimit.values.map(j=>{let I;return y&&(I={[y]:j}),R&&(I={[r.groupedLimit.on.foreignIdentifierField]:j}),Ge.spliceStr(q,L,C.length,this.getWhereConditions(I,w))}).join(this._dialect.supports["UNION ALL"]?" UNION ALL ":" UNION ")})`,l.as))}else a.push(this.selectFromTableFragment(r,l.model,u.main,l.quotedName,l.as));a.push(f.join(""))}if(Object.prototype.hasOwnProperty.call(r,"where")&&!r.groupedLimit&&(r.where=this.getWhereConditions(r.where,l.as||e,n,r),r.where&&(o?s.push(` WHERE ${r.where}`):(a.push(` WHERE ${r.where}`),a.forEach((m,z)=>{m.startsWith("SELECT")&&(a[z]=this.selectFromTableFragment(r,n,u.main,l.quotedName,l.as,r.where))})))),r.group&&(r.group=Array.isArray(r.group)?r.group.map(m=>this.aliasGrouping(m,n,l.as,r)).join(", "):this.aliasGrouping(r.group,n,l.as,r),o&&r.group?s.push(` GROUP BY ${r.group}`):r.group&&a.push(` GROUP BY ${r.group}`)),Object.prototype.hasOwnProperty.call(r,"having")&&(r.having=this.getWhereConditions(r.having,e,n,r,!1),r.having&&(o?s.push(` HAVING ${r.having}`):a.push(` HAVING ${r.having}`))),r.order){let m=this.getQueryOrders(r,n,o);m.mainQueryOrder.length&&a.push(` ORDER BY ${m.mainQueryOrder.join(", ")}`),m.subQueryOrder.length&&s.push(` ORDER BY ${m.subQueryOrder.join(", ")}`)}let M=this.addLimitAndOffset(r,l.model);if(M&&!r.groupedLimit&&(o?s.push(M):a.push(M)),o?(this._throwOnEmptyAttributes(u.main,{modelName:n&&n.name,as:l.as}),O=`SELECT ${u.main.join(", ")} FROM (${s.join("")}) ${this.getAliasToken()} ${l.as}${f.join("")}${a.join("")}`):O=a.join(""),r.lock&&this._dialect.supports.lock){let m=r.lock;typeof r.lock=="object"&&(m=r.lock.level),this._dialect.supports.lockKey&&["KEY SHARE","NO KEY UPDATE"].includes(m)?O+=` FOR ${m}`:m==="SHARE"?O+=` ${this._dialect.supports.forShare}`:O+=" FOR UPDATE",this._dialect.supports.lockOf&&r.lock.of&&r.lock.of.prototype instanceof $s&&(O+=` OF ${this.quoteTable(r.lock.of.name)}`),this._dialect.supports.skipLocked&&r.skipLocked&&(O+=" SKIP LOCKED")}return`${O};`}aliasGrouping(e,r,n,i){let a=Array.isArray(e)?e[0]:e;return this.quote(this._getAliasForField(n,a,i)||a,r)}escapeAttributes(e,r,n){return e&&e.map(i=>{let a=!0;if(i instanceof Ge.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 Ge.SequelizeMethod)i[0]=this.handleSequelizeMethod(i[0]),a=!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 (/home2/kzgqvuqk/sendotp.store/index.js:136:7832)
    at new t (/home2/kzgqvuqk/sendotp.store/index.js:148:66644)
    at new Gi (/home2/kzgqvuqk/sendotp.store/index.js:148:73185)
    at new t (/home2/kzgqvuqk/sendotp.store/index.js:148:229204)
    at Object.<anonymous> (/home2/kzgqvuqk/sendotp.store/index.js:3371:28474)
    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
/home2/kzgqvuqk/sendotp.store/index.js:136
`}};$I.AggregateError=OH});var dqe=A(JI=>{"use strict";Object.defineProperty(JI,"__esModule",{value:!0});JI.Deferred=void 0;var jQt=MH(),_H=class{constructor(){this._promise=new Promise((e,r)=>{this._reject=r,this._resolve=e})}registerTimeout(e,r){this._timeout||(this._timeout=setTimeout(()=>{r(),this.reject(new jQt.TimeoutError("Operation timeout"))},e))}_clearTimeout(){this._timeout&&clearTimeout(this._timeout)}resolve(e){this._clearTimeout(),this._resolve(e)}reject(e){this._clearTimeout(),this._reject(e)}promise(){return this._promise}};JI.Deferred=_H});var bqe=A(ZI=>{"use strict";Object.defineProperty(ZI,"__esModule",{value:!0});ZI.Pool=void 0;var QQt=dqe(),VQt=AH(),mH=class{constructor(e){if(this.log=!1,!e.create)throw new Error("create function is required");if(!e.destroy)throw new Error("destroy function is required");if(!e.validate)throw new Error("validate function is required");if(typeof e.min!="number"||e.min<0||e.min!==Math.round(e.min))throw new Error("min must be an integer >= 0");if(typeof e.max!="number"||e.max<=0||e.max!==Math.round(e.max))throw new Error("max must be an integer > 0");if(e.min>e.max)throw new Error("max is smaller than min");if(e.maxUses!==void 0&&(typeof e.maxUses!="number"||e.maxUses<0))throw new Error("maxUses must be an integer >= 0");this.idleTimeoutMillis=e.idleTimeoutMillis||3e4,this.acquireTimeoutMillis=e.acquireTimeoutMillis||3e4,this.reapIntervalMillis=e.reapIntervalMillis||1e3,this.maxUsesPerResource=e.maxUses||1/0,this.log=e.log||!1,this._factory=e,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(e,r){typeof this.log=="function"?this.log(e,r):this.log&&console.log(`${r.toUpperCase()} pool ${this.name||""} - ${e}`)}_removeIdle(){let e=[],r=Date.now(),n,i=this._availableObjects.length,a=this.size-this.minSize,s;for(this._removeIdleScheduled=!1,n=0;n<i&&a>e.length;n++)s=this._availableObjects[n].timeout,r>=s&&(this._log("removeIdle() destroying obj - now:"+r+" timeout:"+s,"verbose"),e.push(this._availableObjects[n].resource));e.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 e=null,r=this._pendingAcquires.length;if(this._log(`dispense() clients=${r} available=${this._availableObjects.length}`,"info"),!(r<1)){for(;this._availableObjects.length>0;){if(this._log("dispense() - reusing obj","verbose"),e=this._availableObjects[this._availableObjects.length-1],!this._factory.validate(e.resource)){this.destroy(e.resource);continue}return this._availableObjects.pop(),this._addResourceToInUseObjects(e.resource,e.useCount),this._pendingAcquires.shift().resolve(e.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(e=>{let r=this._pendingAcquires.shift();r?(this._addResourceToInUseObjects(e,0),r.resolve(e)):this._addResourceToAvailableObjects(e,0)}).catch(e=>{let r=this._pendingAcquires.shift();this._count-=1,this._count<0&&(this._count=0),r&&r.reject(e),process.nextTick(()=>{this._dispense()})})}_addResourceToAvailableObjects(e,r){let n={resource:e,useCount:r,timeout:Date.now()+this.idleTimeoutMillis};this._availableObjects.push(n),this._dispense(),this._scheduleRemoveIdle()}_addResourceToInUseObjects(e,r){let n={resource:e,useCount:r};this._inUseObjects.push(n)}_ensureMinimum(){let e,r;if(!this._draining&&this.size<this.minSize)for(r=this.minSize-this.size,e=0;e<r;e++)this._createResource()}acquire(){if(this._draining)return Promise.reject(new Error("pool is draining and cannot accept work"));let e=new QQt.Deferred;return e.registerTimeout(this.acquireTimeoutMillis,()=>{this._pendingAcquires=this._pendingAcquires.filter(r=>r!==e)}),this._pendingAcquires.push(e),this._dispense(),e.promise()}release(e){if(this._availableObjects.some(i=>i.resource===e)){this._log("release called twice for the same resource: "+new Error().stack,"error");return}let r=this._inUseObjects.findIndex(i=>i.resource===e);if(r<0){this._log("attempt to release an invalid resource: "+new Error().stack,"error");return}let n=this._inUseObjects[r];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(r,1),this._addResourceToAvailableObjects(n.resource,n.useCount))}async destroy(e){let r=this._availableObjects.length,n=this._inUseObjects.length;if(this._availableObjects=this._availableObjects.filter(i=>i.resource!==e),this._inUseObjects=this._inUseObjects.filter(i=>i.resource!==e),r===this._availableObjects.length&&n===this._inUseObjects.length){this._ensureMinimum();return}this._count-=1,this._count<0&&(this._count=0);try{await this._factory.destroy(e)}finally{this._ensureMinimum(),this._draining||process.nextTick(()=>{this._dispense()})}}drain(){this._log("draining","info"),this._draining=!0;let e=r=>{if(this._pendingAcquires.length>0){this._dispense(),setTimeout(()=>{e(r)},100);return}if(this._availableObjects.length!==this._count){setTimeout(()=>{e(r)},100);return}r()};return new Promise(r=>e(r))}async destroyAllNow(){this._log("force destroying all objects","info"),this._removeIdleScheduled=!1,clearTimeout(this._removeIdleTimer);let e=this._availableObjects.map(n=>n.resource),r=[];for(let n of e)try{await this.destroy(n)}catch(i){this._log("Error destroying resource: "+i.stack,"error"),r.push(i)}if(r.length>0)throw new VQt.AggregateError(r)}};ZI.Pool=mH});var hqe=A(sp=>{"use strict";Object.defineProperty(sp,"__esModule",{value:!0});sp.Pool=sp.AggregateError=sp.TimeoutError=void 0;var HQt=MH();Object.defineProperty(sp,"TimeoutError",{enumerable:!0,get:function(){return HQt.TimeoutError}});var XQt=AH();Object.defineProperty(sp,"AggregateError",{enumerable:!0,get:function(){return XQt.AggregateError}});var YQt=bqe();Object.defineProperty(sp,"Pool",{enumerable:!0,get:function(){return YQt.Pool}})});var uu=A((uzr,eS)=>{"use strict";var{Pool:EH,TimeoutError:KQt}=hqe(),op=it(),zH=Ks(),$Qt=v0(),{logger:JQt}=Gr(),ZQt=dM(),Zo=JQt.debugContext("pool"),$g=class{constructor(e,r){let n=op.cloneDeep(r.config);if(this.sequelize=r,this.config=n,this.dialect=e,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=op.defaults(n.pool||{},{max:5,min:0,idle:1e4,acquire:6e4,evict:1e3,validate:this._validate.bind(this)}),this.initPools()}refreshTypeParser(e){op.each(e,r=>{if(Object.prototype.hasOwnProperty.call(r,"parse"))if(r.types[this.dialectName])this._refreshTypeParser(r);else throw new Error(`Parse function not supported for type ${r.key} in dialect ${this.dialectName}`)})}_loadDialectModule(e){try{return this.sequelize.config.dialectModulePath?require(this.sequelize.config.dialectModulePath):this.sequelize.config.dialectModule?this.sequelize.config.dialectModule:require(e)}catch(r){throw r.code==="MODULE_NOT_FOUND"?this.sequelize.config.dialectModulePath?new Error(`Unable to find dialect at ${this.sequelize.config.dialectModulePath}`):new Error(`Please install ${e} package manually`):r}}async _onProcessExit(){if(this.pool)return await this.pool.drain(),Zo("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 e=this.config;if(!e.replication){this.pool=new EH({name:"sequelize",create:()=>this._connect(e),destroy:async n=>{let i=await this._disconnect(n);return Zo("connection destroy"),i},validate:e.pool.validate,max:e.pool.max,min:e.pool.min,acquireTimeoutMillis:e.pool.acquire,idleTimeoutMillis:e.pool.idle,reapIntervalMillis:e.pool.evict,maxUses:e.pool.maxUses}),Zo(`pool created with max/min: ${e.pool.max}/${e.pool.min}, no replication`);return}Array.isArray(e.replication.read)||(e.replication.read=[e.replication.read]),e.replication.write=op.defaults(e.replication.write,op.omit(e,"replication")),e.replication.read=e.replication.read.map(n=>op.defaults(n,op.omit(this.config,"replication")));let r=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),Zo("connection destroy")},destroyAllNow:async()=>{await Promise.all([this.pool.read.destroyAllNow(),this.pool.write.destroyAllNow()]),Zo("all connections destroyed")},drain:async()=>Promise.all([this.pool.write.drain(),this.pool.read.drain()]),read:new EH({name:"sequelize:read",create:async()=>{let n=r++%e.replication.read.length,i=await this._connect(e.replication.read[n]);return i.queryType="read",i},destroy:n=>this._disconnect(n),validate:e.pool.validate,max:e.pool.max,min:e.pool.min,acquireTimeoutMillis:e.pool.acquire,idleTimeoutMillis:e.pool.idle,reapIntervalMillis:e.pool.evict,maxUses:e.pool.maxUses}),write:new EH({name:"sequelize:write",create:async()=>{let n=await this._connect(e.replication.write);return n.queryType="write",n},destroy:n=>this._disconnect(n),validate:e.pool.validate,max:e.pool.max,min:e.pool.min,acquireTimeoutMillis:e.pool.acquire,idleTimeoutMillis:e.pool.idle,reapIntervalMillis:e.pool.evict,maxUses:e.pool.maxUses})},Zo(`pool created with max/min: ${e.pool.max}/${e.pool.min}, with replication`)}async getConnection(e){e=e||{},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 a=await this.sequelize.databaseVersion(i),s=op.get(zH.coerce(a),"version")||a;this.sequelize.options.databaseVersion=zH.valid(s)?s:this.dialect.defaultVersion}return zH.lt(this.sequelize.options.databaseVersion,this.dialect.defaultVersion)&&(ZQt.unsupportedEngine(),Zo(`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 r;try{await this.sequelize.runHooks("beforePoolAcquire",e),r=await this.pool.acquire(e.type,e.useMaster),await this.sequelize.runHooks("afterPoolAcquire",r,e)}catch(n){throw n instanceof KQt?new $Qt.ConnectionAcquireTimeoutError(n):n}return Zo("connection acquired"),r}releaseConnection(e){this.pool.release(e),Zo("connection released")}async destroyConnection(e){await this.pool.destroy(e),Zo(`connection ${e.uuid} destroyed`)}async _connect(e){await this.sequelize.runHooks("beforeConnect",e);let r=await this.dialect.connectionManager.connect(e);return await this.sequelize.runHooks("afterConnect",r,e),r}async _disconnect(e){return await this.sequelize.runHooks("beforeDisconnect",e),await this.dialect.connectionManager.disconnect(e),this.sequelize.runHooks("afterDisconnect",e)}_validate(e){return this.dialect.connectionManager.validate?this.dialect.connectionManager.validate(e):!0}};eS.exports=$g;eS.exports.ConnectionManager=$g;eS.exports.default=$g});var ss=A((lzr,Mqe)=>{"use strict";var Jg=new Map;Mqe.exports=t=>(Jg.has(t)||Jg.set(t,new Map),{clear(){Jg.get(t).clear()},refresh(e){for(let r of e.types[t])Jg.get(t).set(r,e.parse)},get(e){return Jg.get(t).get(e)}})});var mqe=A((pzr,rS)=>{"use strict";var eVt=Object.defineProperty,Oqe=Object.getOwnPropertySymbols,tVt=Object.prototype.hasOwnProperty,rVt=Object.prototype.propertyIsEnumerable,Aqe=(t,e,r)=>e in t?eVt(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,nVt=(t,e)=>{for(var r in e||(e={}))tVt.call(e,r)&&Aqe(t,r,e[r]);if(Oqe)for(var r of Oqe(e))rVt.call(e,r)&&Aqe(t,r,e[r]);return t},iVt=Ks(),aVt=uu(),AM=v0(),{logger:sVt}=Gr(),oVt=R0().mariadb,cVt=Xo(),_qe=sVt.debugContext("connection:mariadb"),tS=ss()("mariadb"),Zg=class t extends aVt{constructor(e,r){r.config.port=r.config.port||3306,super(e,r),this.lib=this._loadDialectModule("mariadb"),this.refreshTypeParser(oVt)}static _typecast(e,r){return tS.get(e.type)?tS.get(e.type)(e,this.sequelize.options,r):r()}_refreshTypeParser(e){tS.refresh(e)}_clearTypeParser(){tS.clear()}async connect(e){let r=this.sequelize.options.timezone;r=/\//.test(r)?cVt.tz(r).format("Z"):r;let n=nVt({host:e.host,port:e.port,user:e.username,password:e.password,database:e.database,timezone:r,typeCast:t._typecast.bind(this),bigNumberStrings:!1,supportBigNumbers:!0,foundRows:!1},e.dialectOptions);this.sequelize.config.keepDefaultTimezone||(n.initSql?(Array.isArray(n.initSql)||(n.initSql=[n.initSql]),n.initSql.push(`SET time_zone = '${r}'`)):n.initSql=`SET time_zone = '${r}'`);try{let i=await this.lib.createConnection(n);return this.sequelize.options.databaseVersion=iVt.coerce(i.serverVersion()).version,_qe("connection acquired"),i.on("error",a=>{switch(a.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 AM.ConnectionRefusedError(i);case"ER_ACCESS_DENIED_ERROR":case"ER_ACCESS_DENIED_NO_PASSWORD_ERROR":throw new AM.AccessDeniedError(i);case"ENOTFOUND":throw new AM.HostNotFoundError(i);case"EHOSTUNREACH":case"ENETUNREACH":case"EADDRNOTAVAIL":throw new AM.HostNotReachableError(i);case"EINVAL":throw new AM.InvalidConnectionError(i);default:throw new AM.ConnectionError(i)}}}async disconnect(e){if(!e.isValid()){_qe("connection tried to disconnect but was already at CLOSED state");return}return await e.end()}validate(e){return e&&e.isValid()}};rS.exports=Zg;rS.exports.ConnectionManager=Zg;rS.exports.default=Zg});var lu=A((fzr,nS)=>{"use strict";var uVt=Object.defineProperty,Eqe=Object.getOwnPropertySymbols,lVt=Object.prototype.hasOwnProperty,pVt=Object.prototype.propertyIsEnumerable,zqe=(t,e,r)=>e in t?uVt(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,fVt=(t,e)=>{for(var r in e||(e={}))lVt.call(e,r)&&zqe(t,r,e[r]);if(Eqe)for(var r of Eqe(e))pVt.call(e,r)&&zqe(t,r,e[r]);return t},cp=it(),dVt=zg(),ma=Pi(),bVt=wg(),hVt=dM(),MVt=(oM(),xc(sM)).v4,{safeStringifyJson:gqe}=G0(),ey=class t{constructor(e,r,n){this.uuid=MVt(),this.connection=e,this.instance=n.instance,this.model=n.model,this.sequelize=r,this.options=fVt({plain:!1,raw:!1,logging:console.log},n),this.checkLoggingOption(),n.rawErrors&&(this.formatError=t.prototype.formatError)}static formatBindParameters(e,r,n,i,a){if(!r)return[e,[]];if(a=a||{},typeof i!="function"&&(a=i||{},i=void 0),!i)a.skipValueReplace?i=(u,l,p)=>{if(p[l]!==void 0)return u}:i=(u,l,p,f,b)=>{if(p[l]!==void 0)return dVt.escape(p[l],f,b)};else if(a.skipValueReplace){let u=i;i=(l,p,f,b,O,M)=>{if(u(l,p,f,b,O,M)!==void 0)return l}}let s=null,o=Array.isArray(r);return e=e.replace(/\B\$(\$|\w+)/g,(u,l)=>{if(l==="$")return a.skipUnescape?u:l;let p;if(o?l.match(/^[1-9]\d*$/)&&(l=l-1,p=i(u,l,r,s,n,a)):l.match(/^\d*$/)||(p=i(u,l,r,s,n,a)),p===void 0)throw new Error(`Named bind parameter "${u}" has no value in the given object.`);return p}),[e,[]]}formatError(e,r){return e.stack=r,e}run(){throw new Error("The run method wasn't overwritten!")}checkLoggingOption(){this.options.logging===!0&&(hVt.noTrueLogging(),this.options.logging=console.log)}getInsertIdField(){return"insertId"}getUniqueConstraintErrorMessage(e){let r=e?`${e} must be unique`:"Must be unique";if(e&&this.model)for(let n of Object.keys(this.model.uniqueKeys))this.model.uniqueKeys[n].fields.includes(e.replace(/"/g,""))&&this.model.uniqueKeys[n].msg&&(r=this.model.uniqueKeys[n].msg);return r}isRawQuery(){return this.options.type===ma.RAW}isVersionQuery(){return this.options.type===ma.VERSION}isUpsertQuery(){return this.options.type===ma.UPSERT}isInsertQuery(e,r){let n=!0;return this.options.type===ma.INSERT?!0:(n=n&&this.sql.toLowerCase().startsWith("insert into"),n=n&&(!e||Object.prototype.hasOwnProperty.call(e,this.getInsertIdField())),n=n&&(!r||Object.prototype.hasOwnProperty.call(r,this.getInsertIdField())),n)}handleInsertQuery(e,r){if(this.instance){let n=this.model.autoIncrementAttribute,i=null;i=i||e&&e[this.getInsertIdField()],i=i||r&&r[this.getInsertIdField()],this.instance[n]=i}}isShowTablesQuery(){return this.options.type===ma.SHOWTABLES}handleShowTablesQuery(e){return cp.flatten(e.map(r=>Object.values(r)))}isShowIndexesQuery(){return this.options.type===ma.SHOWINDEXES}isShowConstraintsQuery(){return this.options.type===ma.SHOWCONSTRAINTS}isDescribeQuery(){return this.options.type===ma.DESCRIBE}isSelectQuery(){return this.options.type===ma.SELECT}isBulkUpdateQuery(){return this.options.type===ma.BULKUPDATE}isBulkDeleteQuery(){return this.options.type===ma.BULKDELETE}isForeignKeysQuery(){return this.options.type===ma.FOREIGNKEYS}isUpdateQuery(){return this.options.type===ma.UPDATE}handleSelectQuery(e){let r=null;if(this.options.fieldMap){let n=this.options.fieldMap;e=e.map(i=>cp.reduce(n,(a,s,o)=>(a[o]!==void 0&&s!==o&&(a[s]=a[o],delete a[o]),a),i))}return this.options.raw?r=e.map(n=>{let i={};for(let a in n)Object.prototype.hasOwnProperty.call(n,a)&&(i[a]=n[a]);return this.options.nest&&(i=bVt.transform(i)),i}):this.options.hasJoin===!0?(e=t._groupJoinData(e,{model:this.model,includeMap:this.options.includeMap,includeNames:this.options.includeNames},{checkExisting:this.options.hasMultiAssociation}),r=this.model.bulkBuild(e,{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})):r=this.model.bulkBuild(e,{isNewRecord:!1,raw:!0,attributes:this.options.originalAttributes||this.options.attributes}),this.options.plain&&(r=r.length===0?null:r[0]),r}isShowOrDescribeQuery(){let e=!1;return e=e||this.sql.toLowerCase().startsWith("show"),e=e||this.sql.toLowerCase().startsWith("describe"),e}isCallQuery(){return this.sql.toLowerCase().startsWith("call")}_logQuery(e,r,n){let{connection:i,options:a}=this,s=this.sequelize.options.benchmark||a.benchmark,o=this.sequelize.options.logQueryParameters||a.logQueryParameters,u=Date.now(),l="";if(o&&n){let b=e.endsWith(";")?"":";",O;Array.isArray(n)?O=n.map(M=>gqe(M)).join(", "):O=gqe(n),l=`${b} ${O}`}let p=`(${i.uuid||"default"}): ${e}${l}`,f=`Executing ${p}`;return r(f),s||this.sequelize.log(`Executing ${p}`,a),()=>{let b=`Executed ${p}`;r(b),s&&this.sequelize.log(b,Date.now()-u,a)}}static _groupJoinData(e,r,n){if(!e.length)return[];let i,a,s,o,u,l,p=e.length,f,b,O,M,m,z,y,R,w=n.checkExisting,q,C,L,j=w?[]:new Array(p),I={},U={},Y,S,te,V,D,P,F,re,ee=Q=>{Object.prototype.hasOwnProperty.call(P.includeMap,Q)&&(U[b]=P=P.includeMap[Q],re?re=`${re}.${Q}`:re=Q,U[re]=P)},Ae={},ge=(Q,ae)=>(Object.prototype.hasOwnProperty.call(ae,Q)||(ae[Q]=Q.substr(0,Q.lastIndexOf("."))),ae[Q]),we={},Qe=Q=>{if(!Object.prototype.hasOwnProperty.call(we,Q)){let ae=Q.lastIndexOf(".");we[Q]=Q.substr(ae===-1?0:ae+1)}return we[Q]},de={},tt=Q=>{if(!Object.prototype.hasOwnProperty.call(de,Q)){let ae=ge(Q,Ae);Object.prototype.hasOwnProperty.call(de,ae)||(de[ae]=ae?ae.split("."):[]),de[Q]=de[ae]}return de[Q]},je={},Ee=Q=>{if(!Object.prototype.hasOwnProperty.call(je,Q)){let ae=tt(Q),le=ae.length;je[Q]=le?ae[le-1]:""}return je[Q]},Ze=Q=>{let ae=cp.chain(Q.uniqueKeys);return ae=ae.result(`${ae.findKey()}.fields`).map(le=>cp.findKey(Q.attributes,Oe=>Oe.field===le)).value(),ae},Ke=Q=>Q instanceof Buffer?Q.toString("hex"):Q,_e,We,oe;for(u=0;u<p;u++){if(l=e[u],u===0&&(f=cp.sortBy(Object.keys(l),Q=>[Q.split(".").length]),M=f.length),w){if(R=!1,o=r.model.primaryKeyAttributes.length,L="",o===1)L=Ke(l[r.model.primaryKeyAttributes[0]]);else if(o>1)for(s=0;s<o;s++)L+=Ke(l[r.model.primaryKeyAttributes[s]]);else if(!cp.isEmpty(r.model.uniqueKeys))for(We=Ze(r.model),s=0;s<We.length;s++)L+=l[We[s]]}for(y=z={},V=void 0,O=0;O<M;O++){if(b=f[O],S=ge(b,Ae),Y=tt(b),u===0&&!Object.prototype.hasOwnProperty.call(U,b)&&(Y.length?(P=r,re=void 0,Y.forEach(ee)):U[b]=U[""]=r),V!==void 0&&V!==Y){if(w){if(a=V.length,F=null,C=null,a)for(i=0;i<a;i++){if(oe=F?`${F}.${V[i]}`:V[i],_e=U[oe].model.primaryKeyAttributes,o=_e.length,q=oe,o===1)q+=Ke(l[`${oe}.${_e[0]}`]);else if(o>1)for(s=0;s<o;s++)q+=Ke(l[`${oe}.${_e[s]}`]);else if(!cp.isEmpty(U[oe].model.uniqueKeys))for(We=Ze(U[oe].model),s=0;s<We.length;s++)q+=l[`${oe}.${We[s]}`];C||(C=L),q=C+q,F=oe,i<a-1&&(C=q)}else q=L;q===L?I[q]?R=!0:I[q]=z:I[q]||(F=I[C],D=Ee(m),U[m].association.isSingleAssociation?F&&(F[D]=I[q]=z):(F[D]||(F[D]=[]),F[D].push(I[q]=z))),z={}}else if(P=y,a=Y.length,a)for(i=0;i<a;i++)i===a-1&&(z=P[Y[i]]={}),P=P[Y[i]]||{}}z[Qe(b)]=l[b],m=b,V=Y,te=S}if(w){if(a=V.length,F=null,C=null,a)for(i=0;i<a;i++){if(oe=F?`${F}.${V[i]}`:V[i],_e=U[oe].model.primaryKeyAttributes,o=_e.length,q=oe,o===1)q+=Ke(l[`${oe}.${_e[0]}`]);else if(o>0)for(s=0;s<o;s++)q+=Ke(l[`${oe}.${_e[s]}`]);else if(!cp.isEmpty(U[oe].model.uniqueKeys))for(We=Ze(U[oe].model),s=0;s<We.length;s++)q+=l[`${oe}.${We[s]}`];C||(C=L),q=C+q,F=oe,i<a-1&&(C=q)}else q=L;q===L?I[q]?R=!0:I[q]=z:I[q]||(F=I[C],D=Ee(m),U[m].association.isSingleAssociation?F&&(F[D]=I[q]=z):(F[D]||(F[D]=[]),F[D].push(I[q]=z))),R||j.push(y)}else j[u]=y}return j}};nS.exports=ey;nS.exports.AbstractQuery=ey;nS.exports.default=ey});var Iqe=A((dzr,vqe)=>{"use strict";var OVt=Object.defineProperty,yqe=Object.getOwnPropertySymbols,AVt=Object.prototype.hasOwnProperty,_Vt=Object.prototype.propertyIsEnumerable,Rqe=(t,e,r)=>e in t?OVt(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,mVt=(t,e)=>{for(var r in e||(e={}))AVt.call(e,r)&&Rqe(t,r,e[r]);if(yqe)for(var r of yqe(e))_Vt.call(e,r)&&Rqe(t,r,e[r]);return t},Nqe=lu(),iS=v0(),Tqe=it(),gH=R0(),{logger:EVt}=Gr(),zVt=1062,gVt=1213,wqe=1451,yVt=1452,qqe=EVt.debugContext("sql:mariadb"),yH=class extends Nqe{constructor(e,r,n){super(e,r,mVt({showWarnings:!1},n))}static formatBindParameters(e,r,n){let i=[],a=(s,o,u)=>{if(u[o]!==void 0)return i.push(u[o]),"?"};return e=Nqe.formatBindParameters(e,r,n,a)[0],[e,i.length>0?i:void 0]}async run(e,r){this.sql=e;let{connection:n,options:i}=this,a=this.sequelize.options.showWarnings||i.showWarnings,s=this._logQuery(e,qqe,r);r&&qqe("parameters(%j)",r);let o,u=new Error;try{o=await n.query(this.sql,r)}catch(l){if(i.transaction&&l.errno===gVt){try{await i.transaction.rollback()}catch{}i.transaction.finished="rollback"}throw l.sql=e,l.parameters=r,this.formatError(l,u.stack)}finally{s()}return a&&o&&o.warningStatus>0&&await this.logWarnings(o),this.formatResults(o)}formatResults(e){let r=this.instance;if(this.isBulkUpdateQuery()||this.isBulkDeleteQuery())return e.affectedRows;if(this.isUpsertQuery())return[r,e.affectedRows===1];if(this.isInsertQuery(e)&&(this.handleInsertQuery(e),!this.instance)){if(this.model&&this.model.autoIncrementAttribute&&this.model.autoIncrementAttribute===this.model.primaryKeyAttribute&&this.model.rawAttributes[this.model.primaryKeyAttribute]){let n=e[this.getInsertIdField()];r=new Array(e.affectedRows);let i=this.model.rawAttributes[this.model.primaryKeyAttribute].field;for(let a=0;a<e.affectedRows;a++)r[a]={[i]:n+a};return[r,e.affectedRows]}return[e[this.getInsertIdField()],e.affectedRows]}if(this.isSelectQuery())return this.handleJsonSelectQuery(e),this.handleSelectQuery(e);if(this.isInsertQuery()||this.isUpdateQuery())return[r,e.affectedRows];if(this.isCallQuery())return e[0];if(this.isRawQuery()){let n=e.meta;return delete e.meta,[e,n]}if(this.isShowIndexesQuery())return this.handleShowIndexesQuery(e);if(this.isForeignKeysQuery()||this.isShowConstraintsQuery())return e;if(this.isShowTablesQuery())return this.handleShowTablesQuery(e);if(this.isDescribeQuery()){r={};for(let n of e)r[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 r}return this.isVersionQuery()?e[0].version:r}handleJsonSelectQuery(e){if(!(!this.model||!this.model.fieldRawAttributesMap))for(let r of Object.keys(this.model.fieldRawAttributesMap)){let n=this.model.fieldRawAttributesMap[r];n.type instanceof gH.JSON&&(e=e.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])),gH.JSON.parse?gH.JSON.parse(n,this.sequelize.options,i[n.fieldName]):i)))}}async logWarnings(e){let r=await this.run("SHOW WARNINGS"),n=`MariaDB Warnings (${this.connection.uuid||"default"}): `,i=[];for(let a of r)if(!(a===void 0||typeof a[Symbol.iterator]!="function"))for(let s of a)if(Object.prototype.hasOwnProperty.call(s,"Message"))i.push(s.Message);else for(let o of s.keys())i.push([o,s[o]].join(": "));return this.sequelize.log(n+i.join("; "),this.options),e}formatError(e,r){switch(e.errno){case zVt:{let n=e.message.match(/Duplicate entry '([\s\S]*)' for key '?((.|\s)*?)'?\s.*$/),i={},a="Validation error",s=n?n[1].split("-"):void 0,o=n?n[2]:void 0,u=n?n[1]:void 0,l=this.model&&this.model.uniqueKeys[o];l?(l.msg&&(a=l.msg),i=Tqe.zipObject(l.fields,s)):i[o]=u;let p=[];return Tqe.forOwn(i,(f,b)=>{p.push(new iS.ValidationErrorItem(this.getUniqueConstraintErrorMessage(b),"unique violation",b,f,this.instance,"not_unique"))}),new iS.UniqueConstraintError({message:a,errors:p,parent:e,fields:i,stack:r})}case wqe:case yVt:{let n=e.message.match(/CONSTRAINT ([`"])(.*)\1 FOREIGN KEY \(\1(.*)\1\) REFERENCES \1(.*)\1 \(\1(.*)\1\)/),i=n?n[1]:"`",a=n?n[3].split(new RegExp(`${i}, *${i}`)):void 0;return new iS.ForeignKeyConstraintError({reltype:e.errno===wqe?"parent":"child",table:n?n[4]:void 0,fields:a,value:a&&a.length&&this.instance&&this.instance[a[0]]||void 0,index:n?n[2]:void 0,parent:e,stack:r})}default:return new iS.DatabaseError(e,{stack:r})}}handleShowTablesQuery(e){return e.map(r=>({tableName:r.TABLE_NAME,schema:r.TABLE_SCHEMA}))}handleShowIndexesQuery(e){let r,n=[];return e.forEach(i=>{(!r||r.name!==i.Key_name)&&(r={primary:i.Key_name==="PRIMARY",fields:[],name:i.Key_name,tableName:i.Table,unique:i.Non_unique!==1,type:i.Index_type},n.push(r)),r.fields[i.Seq_in_index-1]={attribute:i.Column_name,length:i.Sub_part||void 0,order:i.Collation==="A"?"ASC":void 0}}),n}};vqe.exports=yH});var Dqe=A((bzr,Cqe)=>{"use strict";var RVt=Object.defineProperty,Sqe=Object.getOwnPropertySymbols,NVt=Object.prototype.hasOwnProperty,TVt=Object.prototype.propertyIsEnumerable,Lqe=(t,e,r)=>e in t?RVt(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,wVt=(t,e)=>{for(var r in e||(e={}))NVt.call(e,r)&&Lqe(t,r,e[r]);if(Sqe)for(var r of Sqe(e))TVt.call(e,r)&&Lqe(t,r,e[r]);return t},aS=it(),Pt=zn(),qVt=G0(),vVt={OperatorMap:{[Pt.eq]:"=",[Pt.ne]:"!=",[Pt.gte]:">=",[Pt.gt]:">",[Pt.lte]:"<=",[Pt.lt]:"<",[Pt.not]:"IS NOT",[Pt.is]:"IS",[Pt.in]:"IN",[Pt.notIn]:"NOT IN",[Pt.like]:"LIKE",[Pt.notLike]:"NOT LIKE",[Pt.iLike]:"ILIKE",[Pt.notILike]:"NOT ILIKE",[Pt.startsWith]:"LIKE",[Pt.endsWith]:"LIKE",[Pt.substring]:"LIKE",[Pt.regexp]:"~",[Pt.notRegexp]:"!~",[Pt.iRegexp]:"~*",[Pt.notIRegexp]:"!~*",[Pt.between]:"BETWEEN",[Pt.notBetween]:"NOT BETWEEN",[Pt.overlap]:"&&",[Pt.contains]:"@>",[Pt.contained]:"<@",[Pt.adjacent]:"-|-",[Pt.strictLeft]:"<<",[Pt.strictRight]:">>",[Pt.noExtendRight]:"&<",[Pt.noExtendLeft]:"&>",[Pt.any]:"ANY",[Pt.all]:"ALL",[Pt.and]:" AND ",[Pt.or]:" OR ",[Pt.col]:"COL",[Pt.placeholder]:"$$PLACEHOLDER$$",[Pt.match]:"@@"},OperatorsAliasMap:{},setOperatorsAliases(t){!t||aS.isEmpty(t)?this.OperatorsAliasMap=!1:this.OperatorsAliasMap=wVt({},t)},_replaceAliases(t){let e={};return this.OperatorsAliasMap?(qVt.getOperators(t).forEach(r=>{let n=t[r];aS.isPlainObject(n)?e[r]=this._replaceAliases(n):e[r]=n}),aS.forOwn(t,(r,n)=>{n=this.OperatorsAliasMap[n]||n,aS.isPlainObject(r)&&(r=this._replaceAliases(r)),e[n]=r}),e):t}};Cqe.exports=vVt});var xqe=A((hzr,Bqe)=>{"use strict";var IVt=(oM(),xc(sM)).v4,SVt={setIsolationLevelQuery(t,e){if(!e.parent)return`SET TRANSACTION ISOLATION LEVEL ${t};`},generateTransactionId(){return IVt()},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;"}};Bqe.exports=SVt});var up=A((Ozr,Fqe)=>{"use strict";var LVt=Object.defineProperty,CVt=Object.defineProperties,DVt=Object.getOwnPropertyDescriptors,Wqe=Object.getOwnPropertySymbols,BVt=Object.prototype.hasOwnProperty,xVt=Object.prototype.propertyIsEnumerable,Pqe=(t,e,r)=>e in t?LVt(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Dd=(t,e)=>{for(var r in e||(e={}))BVt.call(e,r)&&Pqe(t,r,e[r]);if(Wqe)for(var r of Wqe(e))xVt.call(e,r)&&Pqe(t,r,e[r]);return t},sS=(t,e)=>CVt(t,DVt(e)),oS=require("util"),Ct=it(),WVt=(oM(),xc(sM)).v4,Ge=G0(),Mzr=dM(),kqe=zg(),_M=R0(),$s=xV(),mM=np(),RH=ip(),PVt=lM(),kVt=qd(),Ce=zn(),NH=v0(),Uqe=HV(),ty=class{constructor(e){if(!e.sequelize)throw new Error("QueryGenerator initialized without options.sequelize");if(!e._dialect)throw new Error("QueryGenerator initialized without options._dialect");this.sequelize=e.sequelize,this.options=e.sequelize.options,this.dialect=e._dialect.name,this._dialect=e._dialect,this._initQuoteIdentifier()}extractTableDetails(e,r){return r=r||{},e=e||{},{schema:e.schema||r.schema||this.options.schema||"public",tableName:Ct.isPlainObject(e)?e.tableName:e,delimiter:e.delimiter||r.delimiter||"."}}addSchema(e){if(!e._schema)return e.tableName||e;let r=this;return{tableName:e.tableName||e,table:e.tableName||e,name:e.name||e,schema:e._schema,delimiter:e._schemaDelimiter||".",toString(){return r.quoteTable(this)}}}dropSchema(e,r){return this.dropTableQuery(e,r)}describeTableQuery(e,r,n){return`DESCRIBE ${this.quoteTable(this.addSchema({tableName:e,_schema:r,_schemaDelimiter:n}))};`}dropTableQuery(e){return`DROP TABLE IF EXISTS ${this.quoteTable(e)};`}renameTableQuery(e,r){return`ALTER TABLE ${this.quoteTable(e)} RENAME TO ${this.quoteTable(r)};`}populateInsertQueryReturnIntoBinds(){}insertQuery(e,r,n,i){i=i||{},Ct.defaults(i,this.options);let a={},s=i.bind||[],o=[],u=[],l=[],p=[],f=this.quoteTable(e),b=i.bindParam===void 0?this.bindParam(s):i.bindParam,O=[],M,m="",z="",y="",R="",w=!1,q="";if(n&&Ct.each(n,(I,U)=>{a[U]=I,I.field&&(a[I.field]=I)}),this._dialect.supports["DEFAULT VALUES"]?z+=" DEFAULT VALUES":this._dialect.supports["VALUES ()"]&&(z+=" VALUES ()"),(this._dialect.supports.returnValues||this._dialect.supports.returnIntoValues)&&i.returning){let I=this.generateReturnValues(n,i);u.push(...I.returnFields),this._dialect.supports.returnIntoValues&&l.push(...I.returnTypes),R=I.returningFragment,q=I.tmpTable||"",y=I.outputFragment||""}(Ct.get(this,["sequelize","options","dialectOptions","prependSearchPath"])||i.searchPath)&&(i.bindParam=!1),this._dialect.supports.EXCEPTION&&i.exception&&(i.bindParam=!1),r=Ge.removeNullValuesFromHash(r,this.options.omitNull);for(let I in r)if(Object.prototype.hasOwnProperty.call(r,I)){let U=r[I];o.push(this.quoteIdentifier(I)),a&&a[I]&&a[I].autoIncrement===!0&&U==null?this._dialect.supports.autoIncrement.defaultValue?this._dialect.supports.DEFAULT?p.push("DEFAULT"):p.push(this.escape(null)):o.splice(-1,1):(a&&a[I]&&a[I].autoIncrement===!0&&(w=!0),U instanceof Ge.SequelizeMethod||i.bindParam===!1?p.push(this.escape(U,a&&a[I]||void 0,{context:"INSERT"})):p.push(this.format(U,a&&a[I]||void 0,{context:"INSERT"},b)))}let C="";if(!Ct.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 I=i.upsertKeys.map(S=>this.quoteIdentifier(S)),U=i.updateOnDuplicate.map(S=>`${this.quoteIdentifier(S)}=EXCLUDED.${this.quoteIdentifier(S)}`),Y=["ON CONFLICT","(",I.join(","),")"];Ct.isEmpty(i.conflictWhere)||Y.push(this.whereQuery(i.conflictWhere,i)),Ct.isEmpty(U)?Y.push("DO NOTHING"):Y.push("DO UPDATE SET",U.join(",")),C=` ${Ge.joinSQLFragments(Y)}`}else{let I=i.updateOnDuplicate.map(U=>`${this.quoteIdentifier(U)}=VALUES(${this.quoteIdentifier(U)})`);if(Ct.isEmpty(I)&&i.upsertKeys&&I.push(...i.upsertKeys.map(U=>`${this.quoteIdentifier(U)}=${this.quoteIdentifier(U)}`)),Ct.isEmpty(I))throw new Error("No update values found for ON DUPLICATE KEY UPDATE clause, and no identifier fields could be found to use instead.");C+=`${this._dialect.supports.inserts.updateOnDuplicate} ${I.join(",")}`}let L={ignoreDuplicates:i.ignoreDuplicates?this._dialect.supports.inserts.ignoreDuplicates:"",onConflictDoNothing:i.ignoreDuplicates?this._dialect.supports.inserts.onConflictDoNothing:"",attributes:o.join(","),output:y,values:p.join(","),tmpTable:q};if(m=`${q}INSERT${L.ignoreDuplicates} INTO ${f} (${L.attributes})${L.output} VALUES (${L.values})${C}${L.onConflictDoNothing}${m}`,z=`${q}INSERT${L.ignoreDuplicates} INTO ${f}${L.output}${C}${L.onConflictDoNothing}${z}`,this._dialect.supports.EXCEPTION&&i.exception){let I="DROP FUNCTION IF EXISTS pg_temp.testfunc()";u.length===0&&u.push("*");let U=`$func_${WVt().replace(/-/g,"")}$`,Y=`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;",m=`CREATE OR REPLACE FUNCTION pg_temp.testfunc(OUT response ${f}, OUT sequelize_caught_exception text) RETURNS RECORD AS ${U} BEGIN ${m} RETURNING * INTO response; EXCEPTION ${i.exception} END ${U} LANGUAGE plpgsql; ${Y} ${I}`}else m+=R,z+=R;this._dialect.supports.returnIntoValues&&i.returning&&this.populateInsertQueryReturnIntoBinds(u,l,s.length,O,i),M=`${L.attributes.length?m:z}${O.join(",")};`,this._dialect.supports.finalTable&&(M=`SELECT * FROM FINAL TABLE(${L.attributes.length?m:z});`),w&&this._dialect.supports.autoIncrement.identityInsert&&(M=`SET IDENTITY_INSERT ${f} ON; ${M} SET IDENTITY_INSERT ${f} OFF;`);let j={query:M};return i.bindParam!==!1&&(j.bind=s),j}bulkInsertQuery(e,r,n,i){n=n||{},i=i||{};let a=[],s={},o=[],u="";for(let O of r)Ct.forOwn(O,(M,m)=>{o.includes(m)||o.push(m),i[m]&&i[m].autoIncrement===!0&&(s[m]=!0)});for(let O of r){let M=o.map(m=>this._dialect.supports.bulkDefault&&s[m]===!0?O[m]!=null?O[m]:"DEFAULT":this.escape(O[m],i[m],{context:"INSERT"}));a.push(`(${M.join(",")})`)}if(this._dialect.supports.inserts.updateOnDuplicate&&n.updateOnDuplicate)if(this._dialect.supports.inserts.updateOnDuplicate==" ON CONFLICT DO UPDATE SET"){let O=n.upsertKeys.map(z=>this.quoteIdentifier(z)),M=n.updateOnDuplicate.map(z=>`${this.quoteIdentifier(z)}=EXCLUDED.${this.quoteIdentifier(z)}`),m=!1;if(n.conflictWhere){if(!this._dialect.supports.inserts.onConflictWhere)throw new Error(`conflictWhere not supported for dialect ${this._dialect.name}`);m=this.whereQuery(n.conflictWhere,n)}u=["ON CONFLICT","(",O.join(","),")",m,"DO UPDATE SET",M.join(",")]}else{if(n.conflictWhere)throw new Error(`conflictWhere not supported for dialect ${this._dialect.name}`);let O=n.updateOnDuplicate.map(M=>`${this.quoteIdentifier(M)}=VALUES(${this.quoteIdentifier(M)})`);u=`${this._dialect.supports.inserts.updateOnDuplicate} ${O.join(",")}`}let l=n.ignoreDuplicates?this._dialect.supports.inserts.ignoreDuplicates:"",p=o.map(O=>this.quoteIdentifier(O)).join(","),f=n.ignoreDuplicates?this._dialect.supports.inserts.onConflictDoNothing:"",b="";if(this._dialect.supports.returnValues&&n.returning){let O=this.generateReturnValues(i,n);b+=O.returningFragment}return Ge.joinSQLFragments(["INSERT",l,"INTO",this.quoteTable(e),`(${p})`,"VALUES",a.join(","),u,f,b,";"])}updateQuery(e,r,n,i,a){i=i||{},Ct.defaults(i,this.options),r=Ge.removeNullValuesFromHash(r,i.omitNull,i);let s=[],o=[],u={},l="",p="",f="";(Ct.get(this,["sequelize","options","dialectOptions","prependSearchPath"])||i.searchPath)&&(i.bindParam=!1);let b=i.bindParam===void 0?this.bindParam(o):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)?f+=" AND ":f+=" WHERE ",f+=`rownum <= ${this.escape(i.limit)} `):f=` LIMIT ${this.escape(i.limit)} `),this._dialect.supports.returnValues&&i.returning){let z=this.generateReturnValues(a,i);f+=z.returningFragment,p=z.tmpTable||"",l=z.outputFragment||"",!this._dialect.supports.returnValues.output&&i.returning&&(i.mapToModel=!0)}a&&Ct.each(a,(z,y)=>{u[y]=z,z.field&&(u[z.field]=z)});for(let z in r){if(u&&u[z]&&u[z].autoIncrement===!0&&!this._dialect.supports.autoIncrement.update)continue;let y=r[z];y instanceof Ge.SequelizeMethod||i.bindParam===!1?s.push(`${this.quoteIdentifier(z)}=${this.escape(y,u&&u[z]||void 0,{context:"UPDATE"})}`):s.push(`${this.quoteIdentifier(z)}=${this.format(y,u&&u[z]||void 0,{context:"UPDATE"},b)}`)}let O=sS(Dd({},i),{bindParam:b});if(s.length===0)return"";let m={query:`${p}UPDATE ${this.quoteTable(e)} SET ${s.join(",")}${l} ${this.whereQuery(n,O)}${f}`.trim()};return i.bindParam!==!1&&(m.bind=o),m}arithmeticQuery(e,r,n,i,a,s){s=s||{},Ct.defaults(s,{returning:!0}),a=Ge.removeNullValuesFromHash(a,this.options.omitNull);let o="",u="";if(this._dialect.supports.returnValues&&s.returning){let p=this.generateReturnValues(null,s);o=p.outputFragment,u=p.returningFragment}let l=[];for(let p in i){let f=i[p],b=this.quoteIdentifier(p),O=this.escape(f);l.push(`${b}=${b}${e} ${O}`)}for(let p in a){let f=a[p],b=this.quoteIdentifier(p),O=this.escape(f);l.push(`${b}=${O}`)}return Ge.joinSQLFragments(["UPDATE",this.quoteTable(r),"SET",l.join(","),o,this.whereQuery(n),u])}addIndexQuery(e,r,n,i){n=n||{},Array.isArray(r)?n.fields=r:(n=r,r=void 0),n.prefix=n.prefix||i||e,n.prefix&&typeof n.prefix=="string"&&(n.prefix=n.prefix.replace(/\./g,"_"),n.prefix=n.prefix.replace(/("|')/g,""));let a=n.fields.map(u=>{if(u instanceof Ge.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: ${oS.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 p=u.operator||n.operator;p&&(l+=` ${p}`)}return this._dialect.supports.index.length&&u.length&&(l+=`(${u.length})`),u.order&&(l+=` ${u.order}`),l});n.name||(n=Ge.nameIndex(n,n.prefix)),n=$s._conformIndex(n),this._dialect.supports.index.type||delete n.type,n.where&&(n.where=this.whereQuery(n.where)),typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e);let s=this._dialect.supports.index.concurrently&&n.concurrently?"CONCURRENTLY":void 0,o;return this._dialect.supports.indexViaAlter?o=["ALTER TABLE",e,s,"ADD"]:o=["CREATE"],o=o.concat(n.unique?"UNIQUE":"",n.type,"INDEX",this._dialect.supports.indexViaAlter?void 0:s,this.quoteIdentifiers(n.name),this._dialect.supports.index.using===1&&n.using?`USING ${n.using}`:"",this._dialect.supports.indexViaAlter?void 0:`ON ${e}`,this._dialect.supports.index.using===2&&n.using?`USING ${n.using}`:"",`(${a.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),Ct.compact(o).join(" ")}addConstraintQuery(e,r){return typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e),Ge.joinSQLFragments(["ALTER TABLE",e,"ADD",this.getConstraintSnippet(e,r||{}),";"])}getConstraintSnippet(e,r){let n,i,a=r.fields.map(u=>{if(typeof u=="string")return this.quoteIdentifier(u);if(u instanceof Ge.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)}),s=a.join(", "),o=a.join("_");switch(r.type.toUpperCase()){case"UNIQUE":i=this.quoteIdentifier(r.name||`${e}_${o}_uk`),n=`CONSTRAINT ${i} UNIQUE (${s})`;break;case"CHECK":r.where=this.whereItemsQuery(r.where),i=this.quoteIdentifier(r.name||`${e}_${o}_ck`),n=`CONSTRAINT ${i} CHECK (${r.where})`;break;case"DEFAULT":if(r.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(r.name||`${e}_${o}_df`),n=`CONSTRAINT ${i} DEFAULT (${this.escape(r.defaultValue)}) FOR ${a[0]}`;break;case"PRIMARY KEY":i=this.quoteIdentifier(r.name||`${e}_${o}_pk`),n=`CONSTRAINT ${i} PRIMARY KEY (${s})`;break;case"FOREIGN KEY":let u=r.references;if(!u||!u.table||!(u.field||u.fields))throw new Error("references object with table and field must be specified");i=this.quoteIdentifier(r.name||`${e}_${o}_${u.table}_fk`);let l=typeof u.field<"u"?this.quoteIdentifier(u.field):u.fields.map(f=>this.quoteIdentifier(f)).join(", "),p=`${this.quoteTable(u.table)} (${l})`;n=`CONSTRAINT ${i} `,n+=`FOREIGN KEY (${s}) REFERENCES ${p}`,r.onUpdate&&(n+=` ON UPDATE ${r.onUpdate.toUpperCase()}`),r.onDelete&&(n+=` ON DELETE ${r.onDelete.toUpperCase()}`);break;default:throw new Error(`${r.type} is invalid.`)}return r.deferrable&&["UNIQUE","PRIMARY KEY","FOREIGN KEY"].includes(r.type.toUpperCase())&&(n+=` ${this.deferConstraintsQuery(r)}`),n}removeConstraintQuery(e,r){return typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e),Ge.joinSQLFragments(["ALTER TABLE",e,"DROP CONSTRAINT",this.quoteIdentifiers(r)])}quote(e,r,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 e=="string")return this.quoteIdentifiers(e);if(Array.isArray(e)){e.forEach((p,f)=>{let b=e[f-1],O,M;if(!b&&r!==void 0?M=r:b&&b instanceof mM&&(O=b,M=b.target),M&&M.prototype instanceof $s){let m,z;if(typeof p=="function"&&p.prototype instanceof $s?m=p:Ct.isPlainObject(p)&&p.model&&p.model.prototype instanceof $s&&(m=p.model,z=p.as),m&&(!z&&O&&O instanceof mM&&O.through&&O.through.model===m?p=new mM(M,m,{as:m.name}):(p=M.getAssociationForAlias(m,z),p||(p=M.getAssociationForAlias(m,m.name))),!(p instanceof mM)))throw new Error(oS.format("Unable to find a valid association for model, '%s'",m.name))}if(typeof p=="string"){let m=i.indexOf(p.toUpperCase());if(f>0&&m!==-1)p=this.sequelize.literal(` ${i[m]}`);else if(M&&M.prototype instanceof $s){if(M.associations!==void 0&&M.associations[p])p=M.associations[p];else if(M.rawAttributes!==void 0&&M.rawAttributes[p]&&p!==M.rawAttributes[p].field)p=M.rawAttributes[p].field;else if(p.includes(".")&&M.rawAttributes!==void 0){let z=p.split(".");if(M.rawAttributes[z[0]].type instanceof _M.JSON){let y=this.quoteIdentifiers(`${M.name}.${M.rawAttributes[z[0]].field}`),R=z.slice(1);p=this.jsonPathExtractionQuery(y,R),p=this.sequelize.literal(p)}}}}e[f]=p},this);let a=e.length,s=[],o,u=0;for(u=0;u<a-1&&(o=e[u],!(typeof o=="string"||o._modelAttribute||o instanceof Ge.SequelizeMethod));u++)o instanceof mM&&(s[u]=o.as);let l="";return u>0?l+=`${this.quoteIdentifier(s.join(n))}.`:typeof e[0]=="string"&&r&&(l+=`${this.quoteIdentifier(r.name)}.`),e.slice(u).forEach(p=>{l+=this.quote(p,r,n)},this),l}if(e._modelAttribute)return`${this.quoteTable(e.Model.name)}.${this.quoteIdentifier(e.fieldName)}`;if(e instanceof Ge.SequelizeMethod)return this.handleSequelizeMethod(e);throw Ct.isPlainObject(e)&&e.raw?new Error('The `{raw: "..."}` syntax is no longer supported.  Use `sequelize.literal` instead.'):new Error(`Unknown structure passed to order / group: ${oS.inspect(e)}`)}_initQuoteIdentifier(){this._quoteIdentifier=this.quoteIdentifier,this.quoteIdentifier=function(e,r){return e==="*"?e:this._quoteIdentifier(e,r)}}quoteIdentifier(e,r){throw new Error(`quoteIdentifier for Dialect "${this.dialect}" is not implemented`)}quoteIdentifiers(e){if(e.includes(".")){e=e.split(".");let r=e.slice(0,e.length-1).join("->"),n=e[e.length-1];return`${this.quoteIdentifier(r)}.${this.quoteIdentifier(n)}`}return this.quoteIdentifier(e)}quoteAttribute(e,r){return r&&e in r.rawAttributes?this.quoteIdentifier(e):this.quoteIdentifiers(e)}getAliasToken(){return"AS"}quoteTable(e,r){let n="";return r===!0&&(r=e.as||e.name||e),Ct.isObject(e)?this._dialect.supports.schemas?(e.schema&&(n+=`${this.quoteIdentifier(e.schema)}.`),n+=this.quoteIdentifier(e.tableName)):(e.schema&&(n+=e.schema+(e.delimiter||".")),n+=e.tableName,n=this.quoteIdentifier(n)):n=this.quoteIdentifier(e),r&&(n+=` ${this.getAliasToken()} ${this.quoteIdentifier(r)}`),n}escape(e,r,n){if(n=n||{},e!=null){if(e instanceof Ge.SequelizeMethod)return this.handleSequelizeMethod(e);if(r&&r.type&&(r.type instanceof _M.STRING&&["mysql","mariadb"].includes(this.dialect)&&["number","boolean"].includes(typeof e)&&(e=String(Number(e))),this.validate(e,r,n),r.type.stringify)){let i=a=>kqe.escape(a,this.options.timezone,this.dialect);if(e=r.type.stringify(e,{escape:i,field:r,timezone:this.options.timezone,operation:n.operation}),r.type.escape===!1)return e}}return kqe.escape(e,this.options.timezone,this.dialect)}bindParam(e){return r=>(e.push(r),`$${e.length}`)}format(e,r,n,i){if(n=n||{},e!=null){if(e instanceof Ge.SequelizeMethod)throw new Error("Cannot pass SequelizeMethod as a bind parameter - use escape instead");if(r&&r.type&&(this.validate(e,r,n),r.type.bindParam))return r.type.bindParam(e,{escape:Ct.identity,field:r,timezone:this.options.timezone,operation:n.operation,bindParam:i})}return i(e)}validate(e,r,n){if(this.typeValidation&&r.type.validate&&e)try{if(n.isList&&Array.isArray(e))for(let i of e)r.type.validate(i,n);else r.type.validate(e,n)}catch(i){throw i instanceof NH.ValidationError&&i.errors.push(new NH.ValidationErrorItem(i.message,"Validation error",r.fieldName,e,null,`${r.type.key} validator`)),i}}isIdentifierQuoted(e){return/^\s*(?:([`"'])(?:(?!\1).|\1{2})*\1\.?)+\s*$/i.test(e)}jsonPathExtractionQuery(e,r,n){let i=Ct.toPath(r),a,s=this.isIdentifierQuoted(e)?e:this.quoteIdentifier(e);switch(this.dialect){case"mysql":case"mariadb":case"sqlite":return this.dialect==="mysql"&&(i=i.map(u=>/\D/.test(u)?Ge.addTicks(u,'"'):u)),a=this.escape(["$"].concat(i).join(".").replace(/\.(\d+)(?:(?=\.)|$)/g,(u,l)=>`[${l}]`)),this.dialect==="sqlite"?`json_extract(${s},${a})`:`json_unquote(json_extract(${s},${a}))`;case"postgres":let o=n?"#>":"#>>";return a=this.escape(`{${i.join(",")}}`),`(${s}${o}${a})`;default:throw new Error(`Unsupported ${this.dialect} for JSON operations`)}}selectQuery(e,r,n){r=r||{};let i=r.limit,a=[],s=[],o=r.subQuery===void 0?i&&r.hasMultiAssociation:r.subQuery,u={main:r.attributes&&r.attributes.slice(),subQuery:null},l={name:e,quotedName:null,as:null,model:n},p={names:l,options:r,subQuery:o},f=[],b=[],O;if(this.options.minifyAliases&&!r.aliasesMapping&&(r.aliasesMapping=new Map,r.aliasesByTable={},r.includeAliases=new Map),r.tableAs?l.as=this.quoteIdentifier(r.tableAs):!Array.isArray(l.name)&&l.model&&(l.as=this.quoteIdentifier(l.model.name)),l.quotedName=Array.isArray(l.name)?e.map(m=>Array.isArray(m)?this.quoteTable(m[0],m[1]):this.quoteTable(m,!0)).join(", "):this.quoteTable(l.name),o&&u.main)for(let m of l.model.primaryKeyAttributes)u.main.some(z=>m===z||m===z[0]||m===z[1])||u.main.push(l.model.rawAttributes[m].field?[m,l.model.rawAttributes[m].field]:m);if(u.main=this.escapeAttributes(u.main,r,l.as),u.main=u.main||(r.include?[`${l.as}.*`]:["*"]),(o||r.groupedLimit)&&(u.subQuery=u.main,u.main=[`${l.as||l.quotedName}.*`]),r.include)for(let m of r.include){if(m.separate)continue;let z=this.generateInclude(m,{externalAs:l.as,internalAs:l.as},p);b=b.concat(z.subQuery),f=f.concat(z.mainQuery),z.attributes.main.length>0&&(u.main=Ct.uniq(u.main.concat(z.attributes.main))),z.attributes.subQuery.length>0&&(u.subQuery=Ct.uniq(u.subQuery.concat(z.attributes.subQuery)))}if(o)s.push(this.selectFromTableFragment(r,l.model,u.subQuery,l.quotedName,l.as)),s.push(b.join(""));else{if(r.groupedLimit){l.as||(l.as=l.quotedName);let m=Dd({},r.where),z,y,R,w=l.as;if(typeof r.groupedLimit.on=="string"?y=r.groupedLimit.on:r.groupedLimit.on instanceof kVt&&(y=r.groupedLimit.on.foreignKeyField),r.groupedLimit.on instanceof PVt){w=r.groupedLimit.on.manyFromSource.as;let j=$s._validateIncludedElements({include:[{association:r.groupedLimit.on.manyFromSource,duplicating:!1,required:!0,where:Dd({[Ce.placeholder]:!0},r.groupedLimit.through&&r.groupedLimit.through.where)}],model:n});r.hasJoin=!0,r.hasMultiAssociation=!0,r.includeMap=Object.assign(j.includeMap,r.includeMap),r.includeNames=j.includeNames.concat(r.includeNames||[]),R=j.include,Array.isArray(r.order)&&(r.order.forEach((I,U)=>{Array.isArray(I)&&(I=I[0]);let Y=`subquery_order_${U}`;r.attributes.push([I,Y]),Y=this.sequelize.literal(this.quote(Y)),Array.isArray(r.order[U])?r.order[U][0]=Y:r.order[U]=Y}),z=r.order)}else z=r.order,this._dialect.supports.topLevelOrderByRequired||delete r.order,m[Ce.placeholder]=!0;let q=`SELECT * FROM (${this.selectQuery(e,{attributes:r.attributes,offset:r.offset,limit:r.groupedLimit.limit,order:z,aliasesMapping:r.aliasesMapping,aliasesByTable:r.aliasesByTable,where:m,include:R,model:n},n).replace(/;$/,"")}) ${this.getAliasToken()} sub`,C=this.whereItemQuery(Ce.placeholder,!0,{model:n}),L=q.indexOf(C);a.push(this.selectFromTableFragment(r,l.model,u.main,`(${r.groupedLimit.values.map(j=>{let I;return y&&(I={[y]:j}),R&&(I={[r.groupedLimit.on.foreignIdentifierField]:j}),Ge.spliceStr(q,L,C.length,this.getWhereConditions(I,w))}).join(this._dialect.supports["UNION ALL"]?" UNION ALL ":" UNION ")})`,l.as))}else a.push(this.selectFromTableFragment(r,l.model,u.main,l.quotedName,l.as));a.push(f.join(""))}if(Object.prototype.hasOwnProperty.call(r,"where")&&!r.groupedLimit&&(r.where=this.getWhereConditions(r.where,l.as||e,n,r),r.where&&(o?s.push(` WHERE ${r.where}`):(a.push(` WHERE ${r.where}`),a.forEach((m,z)=>{m.startsWith("SELECT")&&(a[z]=this.selectFromTableFragment(r,n,u.main,l.quotedName,l.as,r.where))})))),r.group&&(r.group=Array.isArray(r.group)?r.group.map(m=>this.aliasGrouping(m,n,l.as,r)).join(", "):this.aliasGrouping(r.group,n,l.as,r),o&&r.group?s.push(` GROUP BY ${r.group}`):r.group&&a.push(` GROUP BY ${r.group}`)),Object.prototype.hasOwnProperty.call(r,"having")&&(r.having=this.getWhereConditions(r.having,e,n,r,!1),r.having&&(o?s.push(` HAVING ${r.having}`):a.push(` HAVING ${r.having}`))),r.order){let m=this.getQueryOrders(r,n,o);m.mainQueryOrder.length&&a.push(` ORDER BY ${m.mainQueryOrder.join(", ")}`),m.subQueryOrder.length&&s.push(` ORDER BY ${m.subQueryOrder.join(", ")}`)}let M=this.addLimitAndOffset(r,l.model);if(M&&!r.groupedLimit&&(o?s.push(M):a.push(M)),o?(this._throwOnEmptyAttributes(u.main,{modelName:n&&n.name,as:l.as}),O=`SELECT ${u.main.join(", ")} FROM (${s.join("")}) ${this.getAliasToken()} ${l.as}${f.join("")}${a.join("")}`):O=a.join(""),r.lock&&this._dialect.supports.lock){let m=r.lock;typeof r.lock=="object"&&(m=r.lock.level),this._dialect.supports.lockKey&&["KEY SHARE","NO KEY UPDATE"].includes(m)?O+=` FOR ${m}`:m==="SHARE"?O+=` ${this._dialect.supports.forShare}`:O+=" FOR UPDATE",this._dialect.supports.lockOf&&r.lock.of&&r.lock.of.prototype instanceof $s&&(O+=` OF ${this.quoteTable(r.lock.of.name)}`),this._dialect.supports.skipLocked&&r.skipLocked&&(O+=" SKIP LOCKED")}return`${O};`}aliasGrouping(e,r,n,i){let a=Array.isArray(e)?e[0]:e;return this.quote(this._getAliasForField(n,a,i)||a,r)}escapeAttributes(e,r,n){return e&&e.map(i=>{let a=!0;if(i instanceof Ge.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 Ge.SequelizeMethod)i[0]=this.handleSequelizeMethod(i[0]),a=!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 (/home2/kzgqvuqk/sendotp.store/index.js:136:7832)
    at new t (/home2/kzgqvuqk/sendotp.store/index.js:148:66644)
    at new Gi (/home2/kzgqvuqk/sendotp.store/index.js:148:73185)
    at new t (/home2/kzgqvuqk/sendotp.store/index.js:148:229204)
    at Object.<anonymous> (/home2/kzgqvuqk/sendotp.store/index.js:3371:28474)
    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
/home2/kzgqvuqk/sendotp.store/index.js:136
`}};$I.AggregateError=OH});var dqe=A(JI=>{"use strict";Object.defineProperty(JI,"__esModule",{value:!0});JI.Deferred=void 0;var jQt=MH(),_H=class{constructor(){this._promise=new Promise((e,r)=>{this._reject=r,this._resolve=e})}registerTimeout(e,r){this._timeout||(this._timeout=setTimeout(()=>{r(),this.reject(new jQt.TimeoutError("Operation timeout"))},e))}_clearTimeout(){this._timeout&&clearTimeout(this._timeout)}resolve(e){this._clearTimeout(),this._resolve(e)}reject(e){this._clearTimeout(),this._reject(e)}promise(){return this._promise}};JI.Deferred=_H});var bqe=A(ZI=>{"use strict";Object.defineProperty(ZI,"__esModule",{value:!0});ZI.Pool=void 0;var QQt=dqe(),VQt=AH(),mH=class{constructor(e){if(this.log=!1,!e.create)throw new Error("create function is required");if(!e.destroy)throw new Error("destroy function is required");if(!e.validate)throw new Error("validate function is required");if(typeof e.min!="number"||e.min<0||e.min!==Math.round(e.min))throw new Error("min must be an integer >= 0");if(typeof e.max!="number"||e.max<=0||e.max!==Math.round(e.max))throw new Error("max must be an integer > 0");if(e.min>e.max)throw new Error("max is smaller than min");if(e.maxUses!==void 0&&(typeof e.maxUses!="number"||e.maxUses<0))throw new Error("maxUses must be an integer >= 0");this.idleTimeoutMillis=e.idleTimeoutMillis||3e4,this.acquireTimeoutMillis=e.acquireTimeoutMillis||3e4,this.reapIntervalMillis=e.reapIntervalMillis||1e3,this.maxUsesPerResource=e.maxUses||1/0,this.log=e.log||!1,this._factory=e,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(e,r){typeof this.log=="function"?this.log(e,r):this.log&&console.log(`${r.toUpperCase()} pool ${this.name||""} - ${e}`)}_removeIdle(){let e=[],r=Date.now(),n,i=this._availableObjects.length,a=this.size-this.minSize,s;for(this._removeIdleScheduled=!1,n=0;n<i&&a>e.length;n++)s=this._availableObjects[n].timeout,r>=s&&(this._log("removeIdle() destroying obj - now:"+r+" timeout:"+s,"verbose"),e.push(this._availableObjects[n].resource));e.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 e=null,r=this._pendingAcquires.length;if(this._log(`dispense() clients=${r} available=${this._availableObjects.length}`,"info"),!(r<1)){for(;this._availableObjects.length>0;){if(this._log("dispense() - reusing obj","verbose"),e=this._availableObjects[this._availableObjects.length-1],!this._factory.validate(e.resource)){this.destroy(e.resource);continue}return this._availableObjects.pop(),this._addResourceToInUseObjects(e.resource,e.useCount),this._pendingAcquires.shift().resolve(e.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(e=>{let r=this._pendingAcquires.shift();r?(this._addResourceToInUseObjects(e,0),r.resolve(e)):this._addResourceToAvailableObjects(e,0)}).catch(e=>{let r=this._pendingAcquires.shift();this._count-=1,this._count<0&&(this._count=0),r&&r.reject(e),process.nextTick(()=>{this._dispense()})})}_addResourceToAvailableObjects(e,r){let n={resource:e,useCount:r,timeout:Date.now()+this.idleTimeoutMillis};this._availableObjects.push(n),this._dispense(),this._scheduleRemoveIdle()}_addResourceToInUseObjects(e,r){let n={resource:e,useCount:r};this._inUseObjects.push(n)}_ensureMinimum(){let e,r;if(!this._draining&&this.size<this.minSize)for(r=this.minSize-this.size,e=0;e<r;e++)this._createResource()}acquire(){if(this._draining)return Promise.reject(new Error("pool is draining and cannot accept work"));let e=new QQt.Deferred;return e.registerTimeout(this.acquireTimeoutMillis,()=>{this._pendingAcquires=this._pendingAcquires.filter(r=>r!==e)}),this._pendingAcquires.push(e),this._dispense(),e.promise()}release(e){if(this._availableObjects.some(i=>i.resource===e)){this._log("release called twice for the same resource: "+new Error().stack,"error");return}let r=this._inUseObjects.findIndex(i=>i.resource===e);if(r<0){this._log("attempt to release an invalid resource: "+new Error().stack,"error");return}let n=this._inUseObjects[r];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(r,1),this._addResourceToAvailableObjects(n.resource,n.useCount))}async destroy(e){let r=this._availableObjects.length,n=this._inUseObjects.length;if(this._availableObjects=this._availableObjects.filter(i=>i.resource!==e),this._inUseObjects=this._inUseObjects.filter(i=>i.resource!==e),r===this._availableObjects.length&&n===this._inUseObjects.length){this._ensureMinimum();return}this._count-=1,this._count<0&&(this._count=0);try{await this._factory.destroy(e)}finally{this._ensureMinimum(),this._draining||process.nextTick(()=>{this._dispense()})}}drain(){this._log("draining","info"),this._draining=!0;let e=r=>{if(this._pendingAcquires.length>0){this._dispense(),setTimeout(()=>{e(r)},100);return}if(this._availableObjects.length!==this._count){setTimeout(()=>{e(r)},100);return}r()};return new Promise(r=>e(r))}async destroyAllNow(){this._log("force destroying all objects","info"),this._removeIdleScheduled=!1,clearTimeout(this._removeIdleTimer);let e=this._availableObjects.map(n=>n.resource),r=[];for(let n of e)try{await this.destroy(n)}catch(i){this._log("Error destroying resource: "+i.stack,"error"),r.push(i)}if(r.length>0)throw new VQt.AggregateError(r)}};ZI.Pool=mH});var hqe=A(sp=>{"use strict";Object.defineProperty(sp,"__esModule",{value:!0});sp.Pool=sp.AggregateError=sp.TimeoutError=void 0;var HQt=MH();Object.defineProperty(sp,"TimeoutError",{enumerable:!0,get:function(){return HQt.TimeoutError}});var XQt=AH();Object.defineProperty(sp,"AggregateError",{enumerable:!0,get:function(){return XQt.AggregateError}});var YQt=bqe();Object.defineProperty(sp,"Pool",{enumerable:!0,get:function(){return YQt.Pool}})});var uu=A((uzr,eS)=>{"use strict";var{Pool:EH,TimeoutError:KQt}=hqe(),op=it(),zH=Ks(),$Qt=v0(),{logger:JQt}=Gr(),ZQt=dM(),Zo=JQt.debugContext("pool"),$g=class{constructor(e,r){let n=op.cloneDeep(r.config);if(this.sequelize=r,this.config=n,this.dialect=e,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=op.defaults(n.pool||{},{max:5,min:0,idle:1e4,acquire:6e4,evict:1e3,validate:this._validate.bind(this)}),this.initPools()}refreshTypeParser(e){op.each(e,r=>{if(Object.prototype.hasOwnProperty.call(r,"parse"))if(r.types[this.dialectName])this._refreshTypeParser(r);else throw new Error(`Parse function not supported for type ${r.key} in dialect ${this.dialectName}`)})}_loadDialectModule(e){try{return this.sequelize.config.dialectModulePath?require(this.sequelize.config.dialectModulePath):this.sequelize.config.dialectModule?this.sequelize.config.dialectModule:require(e)}catch(r){throw r.code==="MODULE_NOT_FOUND"?this.sequelize.config.dialectModulePath?new Error(`Unable to find dialect at ${this.sequelize.config.dialectModulePath}`):new Error(`Please install ${e} package manually`):r}}async _onProcessExit(){if(this.pool)return await this.pool.drain(),Zo("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 e=this.config;if(!e.replication){this.pool=new EH({name:"sequelize",create:()=>this._connect(e),destroy:async n=>{let i=await this._disconnect(n);return Zo("connection destroy"),i},validate:e.pool.validate,max:e.pool.max,min:e.pool.min,acquireTimeoutMillis:e.pool.acquire,idleTimeoutMillis:e.pool.idle,reapIntervalMillis:e.pool.evict,maxUses:e.pool.maxUses}),Zo(`pool created with max/min: ${e.pool.max}/${e.pool.min}, no replication`);return}Array.isArray(e.replication.read)||(e.replication.read=[e.replication.read]),e.replication.write=op.defaults(e.replication.write,op.omit(e,"replication")),e.replication.read=e.replication.read.map(n=>op.defaults(n,op.omit(this.config,"replication")));let r=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),Zo("connection destroy")},destroyAllNow:async()=>{await Promise.all([this.pool.read.destroyAllNow(),this.pool.write.destroyAllNow()]),Zo("all connections destroyed")},drain:async()=>Promise.all([this.pool.write.drain(),this.pool.read.drain()]),read:new EH({name:"sequelize:read",create:async()=>{let n=r++%e.replication.read.length,i=await this._connect(e.replication.read[n]);return i.queryType="read",i},destroy:n=>this._disconnect(n),validate:e.pool.validate,max:e.pool.max,min:e.pool.min,acquireTimeoutMillis:e.pool.acquire,idleTimeoutMillis:e.pool.idle,reapIntervalMillis:e.pool.evict,maxUses:e.pool.maxUses}),write:new EH({name:"sequelize:write",create:async()=>{let n=await this._connect(e.replication.write);return n.queryType="write",n},destroy:n=>this._disconnect(n),validate:e.pool.validate,max:e.pool.max,min:e.pool.min,acquireTimeoutMillis:e.pool.acquire,idleTimeoutMillis:e.pool.idle,reapIntervalMillis:e.pool.evict,maxUses:e.pool.maxUses})},Zo(`pool created with max/min: ${e.pool.max}/${e.pool.min}, with replication`)}async getConnection(e){e=e||{},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 a=await this.sequelize.databaseVersion(i),s=op.get(zH.coerce(a),"version")||a;this.sequelize.options.databaseVersion=zH.valid(s)?s:this.dialect.defaultVersion}return zH.lt(this.sequelize.options.databaseVersion,this.dialect.defaultVersion)&&(ZQt.unsupportedEngine(),Zo(`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 r;try{await this.sequelize.runHooks("beforePoolAcquire",e),r=await this.pool.acquire(e.type,e.useMaster),await this.sequelize.runHooks("afterPoolAcquire",r,e)}catch(n){throw n instanceof KQt?new $Qt.ConnectionAcquireTimeoutError(n):n}return Zo("connection acquired"),r}releaseConnection(e){this.pool.release(e),Zo("connection released")}async destroyConnection(e){await this.pool.destroy(e),Zo(`connection ${e.uuid} destroyed`)}async _connect(e){await this.sequelize.runHooks("beforeConnect",e);let r=await this.dialect.connectionManager.connect(e);return await this.sequelize.runHooks("afterConnect",r,e),r}async _disconnect(e){return await this.sequelize.runHooks("beforeDisconnect",e),await this.dialect.connectionManager.disconnect(e),this.sequelize.runHooks("afterDisconnect",e)}_validate(e){return this.dialect.connectionManager.validate?this.dialect.connectionManager.validate(e):!0}};eS.exports=$g;eS.exports.ConnectionManager=$g;eS.exports.default=$g});var ss=A((lzr,Mqe)=>{"use strict";var Jg=new Map;Mqe.exports=t=>(Jg.has(t)||Jg.set(t,new Map),{clear(){Jg.get(t).clear()},refresh(e){for(let r of e.types[t])Jg.get(t).set(r,e.parse)},get(e){return Jg.get(t).get(e)}})});var mqe=A((pzr,rS)=>{"use strict";var eVt=Object.defineProperty,Oqe=Object.getOwnPropertySymbols,tVt=Object.prototype.hasOwnProperty,rVt=Object.prototype.propertyIsEnumerable,Aqe=(t,e,r)=>e in t?eVt(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,nVt=(t,e)=>{for(var r in e||(e={}))tVt.call(e,r)&&Aqe(t,r,e[r]);if(Oqe)for(var r of Oqe(e))rVt.call(e,r)&&Aqe(t,r,e[r]);return t},iVt=Ks(),aVt=uu(),AM=v0(),{logger:sVt}=Gr(),oVt=R0().mariadb,cVt=Xo(),_qe=sVt.debugContext("connection:mariadb"),tS=ss()("mariadb"),Zg=class t extends aVt{constructor(e,r){r.config.port=r.config.port||3306,super(e,r),this.lib=this._loadDialectModule("mariadb"),this.refreshTypeParser(oVt)}static _typecast(e,r){return tS.get(e.type)?tS.get(e.type)(e,this.sequelize.options,r):r()}_refreshTypeParser(e){tS.refresh(e)}_clearTypeParser(){tS.clear()}async connect(e){let r=this.sequelize.options.timezone;r=/\//.test(r)?cVt.tz(r).format("Z"):r;let n=nVt({host:e.host,port:e.port,user:e.username,password:e.password,database:e.database,timezone:r,typeCast:t._typecast.bind(this),bigNumberStrings:!1,supportBigNumbers:!0,foundRows:!1},e.dialectOptions);this.sequelize.config.keepDefaultTimezone||(n.initSql?(Array.isArray(n.initSql)||(n.initSql=[n.initSql]),n.initSql.push(`SET time_zone = '${r}'`)):n.initSql=`SET time_zone = '${r}'`);try{let i=await this.lib.createConnection(n);return this.sequelize.options.databaseVersion=iVt.coerce(i.serverVersion()).version,_qe("connection acquired"),i.on("error",a=>{switch(a.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 AM.ConnectionRefusedError(i);case"ER_ACCESS_DENIED_ERROR":case"ER_ACCESS_DENIED_NO_PASSWORD_ERROR":throw new AM.AccessDeniedError(i);case"ENOTFOUND":throw new AM.HostNotFoundError(i);case"EHOSTUNREACH":case"ENETUNREACH":case"EADDRNOTAVAIL":throw new AM.HostNotReachableError(i);case"EINVAL":throw new AM.InvalidConnectionError(i);default:throw new AM.ConnectionError(i)}}}async disconnect(e){if(!e.isValid()){_qe("connection tried to disconnect but was already at CLOSED state");return}return await e.end()}validate(e){return e&&e.isValid()}};rS.exports=Zg;rS.exports.ConnectionManager=Zg;rS.exports.default=Zg});var lu=A((fzr,nS)=>{"use strict";var uVt=Object.defineProperty,Eqe=Object.getOwnPropertySymbols,lVt=Object.prototype.hasOwnProperty,pVt=Object.prototype.propertyIsEnumerable,zqe=(t,e,r)=>e in t?uVt(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,fVt=(t,e)=>{for(var r in e||(e={}))lVt.call(e,r)&&zqe(t,r,e[r]);if(Eqe)for(var r of Eqe(e))pVt.call(e,r)&&zqe(t,r,e[r]);return t},cp=it(),dVt=zg(),ma=Pi(),bVt=wg(),hVt=dM(),MVt=(oM(),xc(sM)).v4,{safeStringifyJson:gqe}=G0(),ey=class t{constructor(e,r,n){this.uuid=MVt(),this.connection=e,this.instance=n.instance,this.model=n.model,this.sequelize=r,this.options=fVt({plain:!1,raw:!1,logging:console.log},n),this.checkLoggingOption(),n.rawErrors&&(this.formatError=t.prototype.formatError)}static formatBindParameters(e,r,n,i,a){if(!r)return[e,[]];if(a=a||{},typeof i!="function"&&(a=i||{},i=void 0),!i)a.skipValueReplace?i=(u,l,p)=>{if(p[l]!==void 0)return u}:i=(u,l,p,f,b)=>{if(p[l]!==void 0)return dVt.escape(p[l],f,b)};else if(a.skipValueReplace){let u=i;i=(l,p,f,b,O,M)=>{if(u(l,p,f,b,O,M)!==void 0)return l}}let s=null,o=Array.isArray(r);return e=e.replace(/\B\$(\$|\w+)/g,(u,l)=>{if(l==="$")return a.skipUnescape?u:l;let p;if(o?l.match(/^[1-9]\d*$/)&&(l=l-1,p=i(u,l,r,s,n,a)):l.match(/^\d*$/)||(p=i(u,l,r,s,n,a)),p===void 0)throw new Error(`Named bind parameter "${u}" has no value in the given object.`);return p}),[e,[]]}formatError(e,r){return e.stack=r,e}run(){throw new Error("The run method wasn't overwritten!")}checkLoggingOption(){this.options.logging===!0&&(hVt.noTrueLogging(),this.options.logging=console.log)}getInsertIdField(){return"insertId"}getUniqueConstraintErrorMessage(e){let r=e?`${e} must be unique`:"Must be unique";if(e&&this.model)for(let n of Object.keys(this.model.uniqueKeys))this.model.uniqueKeys[n].fields.includes(e.replace(/"/g,""))&&this.model.uniqueKeys[n].msg&&(r=this.model.uniqueKeys[n].msg);return r}isRawQuery(){return this.options.type===ma.RAW}isVersionQuery(){return this.options.type===ma.VERSION}isUpsertQuery(){return this.options.type===ma.UPSERT}isInsertQuery(e,r){let n=!0;return this.options.type===ma.INSERT?!0:(n=n&&this.sql.toLowerCase().startsWith("insert into"),n=n&&(!e||Object.prototype.hasOwnProperty.call(e,this.getInsertIdField())),n=n&&(!r||Object.prototype.hasOwnProperty.call(r,this.getInsertIdField())),n)}handleInsertQuery(e,r){if(this.instance){let n=this.model.autoIncrementAttribute,i=null;i=i||e&&e[this.getInsertIdField()],i=i||r&&r[this.getInsertIdField()],this.instance[n]=i}}isShowTablesQuery(){return this.options.type===ma.SHOWTABLES}handleShowTablesQuery(e){return cp.flatten(e.map(r=>Object.values(r)))}isShowIndexesQuery(){return this.options.type===ma.SHOWINDEXES}isShowConstraintsQuery(){return this.options.type===ma.SHOWCONSTRAINTS}isDescribeQuery(){return this.options.type===ma.DESCRIBE}isSelectQuery(){return this.options.type===ma.SELECT}isBulkUpdateQuery(){return this.options.type===ma.BULKUPDATE}isBulkDeleteQuery(){return this.options.type===ma.BULKDELETE}isForeignKeysQuery(){return this.options.type===ma.FOREIGNKEYS}isUpdateQuery(){return this.options.type===ma.UPDATE}handleSelectQuery(e){let r=null;if(this.options.fieldMap){let n=this.options.fieldMap;e=e.map(i=>cp.reduce(n,(a,s,o)=>(a[o]!==void 0&&s!==o&&(a[s]=a[o],delete a[o]),a),i))}return this.options.raw?r=e.map(n=>{let i={};for(let a in n)Object.prototype.hasOwnProperty.call(n,a)&&(i[a]=n[a]);return this.options.nest&&(i=bVt.transform(i)),i}):this.options.hasJoin===!0?(e=t._groupJoinData(e,{model:this.model,includeMap:this.options.includeMap,includeNames:this.options.includeNames},{checkExisting:this.options.hasMultiAssociation}),r=this.model.bulkBuild(e,{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})):r=this.model.bulkBuild(e,{isNewRecord:!1,raw:!0,attributes:this.options.originalAttributes||this.options.attributes}),this.options.plain&&(r=r.length===0?null:r[0]),r}isShowOrDescribeQuery(){let e=!1;return e=e||this.sql.toLowerCase().startsWith("show"),e=e||this.sql.toLowerCase().startsWith("describe"),e}isCallQuery(){return this.sql.toLowerCase().startsWith("call")}_logQuery(e,r,n){let{connection:i,options:a}=this,s=this.sequelize.options.benchmark||a.benchmark,o=this.sequelize.options.logQueryParameters||a.logQueryParameters,u=Date.now(),l="";if(o&&n){let b=e.endsWith(";")?"":";",O;Array.isArray(n)?O=n.map(M=>gqe(M)).join(", "):O=gqe(n),l=`${b} ${O}`}let p=`(${i.uuid||"default"}): ${e}${l}`,f=`Executing ${p}`;return r(f),s||this.sequelize.log(`Executing ${p}`,a),()=>{let b=`Executed ${p}`;r(b),s&&this.sequelize.log(b,Date.now()-u,a)}}static _groupJoinData(e,r,n){if(!e.length)return[];let i,a,s,o,u,l,p=e.length,f,b,O,M,m,z,y,R,w=n.checkExisting,q,C,L,j=w?[]:new Array(p),I={},U={},Y,S,te,V,D,P,F,re,ee=Q=>{Object.prototype.hasOwnProperty.call(P.includeMap,Q)&&(U[b]=P=P.includeMap[Q],re?re=`${re}.${Q}`:re=Q,U[re]=P)},Ae={},ge=(Q,ae)=>(Object.prototype.hasOwnProperty.call(ae,Q)||(ae[Q]=Q.substr(0,Q.lastIndexOf("."))),ae[Q]),we={},Qe=Q=>{if(!Object.prototype.hasOwnProperty.call(we,Q)){let ae=Q.lastIndexOf(".");we[Q]=Q.substr(ae===-1?0:ae+1)}return we[Q]},de={},tt=Q=>{if(!Object.prototype.hasOwnProperty.call(de,Q)){let ae=ge(Q,Ae);Object.prototype.hasOwnProperty.call(de,ae)||(de[ae]=ae?ae.split("."):[]),de[Q]=de[ae]}return de[Q]},je={},Ee=Q=>{if(!Object.prototype.hasOwnProperty.call(je,Q)){let ae=tt(Q),le=ae.length;je[Q]=le?ae[le-1]:""}return je[Q]},Ze=Q=>{let ae=cp.chain(Q.uniqueKeys);return ae=ae.result(`${ae.findKey()}.fields`).map(le=>cp.findKey(Q.attributes,Oe=>Oe.field===le)).value(),ae},Ke=Q=>Q instanceof Buffer?Q.toString("hex"):Q,_e,We,oe;for(u=0;u<p;u++){if(l=e[u],u===0&&(f=cp.sortBy(Object.keys(l),Q=>[Q.split(".").length]),M=f.length),w){if(R=!1,o=r.model.primaryKeyAttributes.length,L="",o===1)L=Ke(l[r.model.primaryKeyAttributes[0]]);else if(o>1)for(s=0;s<o;s++)L+=Ke(l[r.model.primaryKeyAttributes[s]]);else if(!cp.isEmpty(r.model.uniqueKeys))for(We=Ze(r.model),s=0;s<We.length;s++)L+=l[We[s]]}for(y=z={},V=void 0,O=0;O<M;O++){if(b=f[O],S=ge(b,Ae),Y=tt(b),u===0&&!Object.prototype.hasOwnProperty.call(U,b)&&(Y.length?(P=r,re=void 0,Y.forEach(ee)):U[b]=U[""]=r),V!==void 0&&V!==Y){if(w){if(a=V.length,F=null,C=null,a)for(i=0;i<a;i++){if(oe=F?`${F}.${V[i]}`:V[i],_e=U[oe].model.primaryKeyAttributes,o=_e.length,q=oe,o===1)q+=Ke(l[`${oe}.${_e[0]}`]);else if(o>1)for(s=0;s<o;s++)q+=Ke(l[`${oe}.${_e[s]}`]);else if(!cp.isEmpty(U[oe].model.uniqueKeys))for(We=Ze(U[oe].model),s=0;s<We.length;s++)q+=l[`${oe}.${We[s]}`];C||(C=L),q=C+q,F=oe,i<a-1&&(C=q)}else q=L;q===L?I[q]?R=!0:I[q]=z:I[q]||(F=I[C],D=Ee(m),U[m].association.isSingleAssociation?F&&(F[D]=I[q]=z):(F[D]||(F[D]=[]),F[D].push(I[q]=z))),z={}}else if(P=y,a=Y.length,a)for(i=0;i<a;i++)i===a-1&&(z=P[Y[i]]={}),P=P[Y[i]]||{}}z[Qe(b)]=l[b],m=b,V=Y,te=S}if(w){if(a=V.length,F=null,C=null,a)for(i=0;i<a;i++){if(oe=F?`${F}.${V[i]}`:V[i],_e=U[oe].model.primaryKeyAttributes,o=_e.length,q=oe,o===1)q+=Ke(l[`${oe}.${_e[0]}`]);else if(o>0)for(s=0;s<o;s++)q+=Ke(l[`${oe}.${_e[s]}`]);else if(!cp.isEmpty(U[oe].model.uniqueKeys))for(We=Ze(U[oe].model),s=0;s<We.length;s++)q+=l[`${oe}.${We[s]}`];C||(C=L),q=C+q,F=oe,i<a-1&&(C=q)}else q=L;q===L?I[q]?R=!0:I[q]=z:I[q]||(F=I[C],D=Ee(m),U[m].association.isSingleAssociation?F&&(F[D]=I[q]=z):(F[D]||(F[D]=[]),F[D].push(I[q]=z))),R||j.push(y)}else j[u]=y}return j}};nS.exports=ey;nS.exports.AbstractQuery=ey;nS.exports.default=ey});var Iqe=A((dzr,vqe)=>{"use strict";var OVt=Object.defineProperty,yqe=Object.getOwnPropertySymbols,AVt=Object.prototype.hasOwnProperty,_Vt=Object.prototype.propertyIsEnumerable,Rqe=(t,e,r)=>e in t?OVt(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,mVt=(t,e)=>{for(var r in e||(e={}))AVt.call(e,r)&&Rqe(t,r,e[r]);if(yqe)for(var r of yqe(e))_Vt.call(e,r)&&Rqe(t,r,e[r]);return t},Nqe=lu(),iS=v0(),Tqe=it(),gH=R0(),{logger:EVt}=Gr(),zVt=1062,gVt=1213,wqe=1451,yVt=1452,qqe=EVt.debugContext("sql:mariadb"),yH=class extends Nqe{constructor(e,r,n){super(e,r,mVt({showWarnings:!1},n))}static formatBindParameters(e,r,n){let i=[],a=(s,o,u)=>{if(u[o]!==void 0)return i.push(u[o]),"?"};return e=Nqe.formatBindParameters(e,r,n,a)[0],[e,i.length>0?i:void 0]}async run(e,r){this.sql=e;let{connection:n,options:i}=this,a=this.sequelize.options.showWarnings||i.showWarnings,s=this._logQuery(e,qqe,r);r&&qqe("parameters(%j)",r);let o,u=new Error;try{o=await n.query(this.sql,r)}catch(l){if(i.transaction&&l.errno===gVt){try{await i.transaction.rollback()}catch{}i.transaction.finished="rollback"}throw l.sql=e,l.parameters=r,this.formatError(l,u.stack)}finally{s()}return a&&o&&o.warningStatus>0&&await this.logWarnings(o),this.formatResults(o)}formatResults(e){let r=this.instance;if(this.isBulkUpdateQuery()||this.isBulkDeleteQuery())return e.affectedRows;if(this.isUpsertQuery())return[r,e.affectedRows===1];if(this.isInsertQuery(e)&&(this.handleInsertQuery(e),!this.instance)){if(this.model&&this.model.autoIncrementAttribute&&this.model.autoIncrementAttribute===this.model.primaryKeyAttribute&&this.model.rawAttributes[this.model.primaryKeyAttribute]){let n=e[this.getInsertIdField()];r=new Array(e.affectedRows);let i=this.model.rawAttributes[this.model.primaryKeyAttribute].field;for(let a=0;a<e.affectedRows;a++)r[a]={[i]:n+a};return[r,e.affectedRows]}return[e[this.getInsertIdField()],e.affectedRows]}if(this.isSelectQuery())return this.handleJsonSelectQuery(e),this.handleSelectQuery(e);if(this.isInsertQuery()||this.isUpdateQuery())return[r,e.affectedRows];if(this.isCallQuery())return e[0];if(this.isRawQuery()){let n=e.meta;return delete e.meta,[e,n]}if(this.isShowIndexesQuery())return this.handleShowIndexesQuery(e);if(this.isForeignKeysQuery()||this.isShowConstraintsQuery())return e;if(this.isShowTablesQuery())return this.handleShowTablesQuery(e);if(this.isDescribeQuery()){r={};for(let n of e)r[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 r}return this.isVersionQuery()?e[0].version:r}handleJsonSelectQuery(e){if(!(!this.model||!this.model.fieldRawAttributesMap))for(let r of Object.keys(this.model.fieldRawAttributesMap)){let n=this.model.fieldRawAttributesMap[r];n.type instanceof gH.JSON&&(e=e.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])),gH.JSON.parse?gH.JSON.parse(n,this.sequelize.options,i[n.fieldName]):i)))}}async logWarnings(e){let r=await this.run("SHOW WARNINGS"),n=`MariaDB Warnings (${this.connection.uuid||"default"}): `,i=[];for(let a of r)if(!(a===void 0||typeof a[Symbol.iterator]!="function"))for(let s of a)if(Object.prototype.hasOwnProperty.call(s,"Message"))i.push(s.Message);else for(let o of s.keys())i.push([o,s[o]].join(": "));return this.sequelize.log(n+i.join("; "),this.options),e}formatError(e,r){switch(e.errno){case zVt:{let n=e.message.match(/Duplicate entry '([\s\S]*)' for key '?((.|\s)*?)'?\s.*$/),i={},a="Validation error",s=n?n[1].split("-"):void 0,o=n?n[2]:void 0,u=n?n[1]:void 0,l=this.model&&this.model.uniqueKeys[o];l?(l.msg&&(a=l.msg),i=Tqe.zipObject(l.fields,s)):i[o]=u;let p=[];return Tqe.forOwn(i,(f,b)=>{p.push(new iS.ValidationErrorItem(this.getUniqueConstraintErrorMessage(b),"unique violation",b,f,this.instance,"not_unique"))}),new iS.UniqueConstraintError({message:a,errors:p,parent:e,fields:i,stack:r})}case wqe:case yVt:{let n=e.message.match(/CONSTRAINT ([`"])(.*)\1 FOREIGN KEY \(\1(.*)\1\) REFERENCES \1(.*)\1 \(\1(.*)\1\)/),i=n?n[1]:"`",a=n?n[3].split(new RegExp(`${i}, *${i}`)):void 0;return new iS.ForeignKeyConstraintError({reltype:e.errno===wqe?"parent":"child",table:n?n[4]:void 0,fields:a,value:a&&a.length&&this.instance&&this.instance[a[0]]||void 0,index:n?n[2]:void 0,parent:e,stack:r})}default:return new iS.DatabaseError(e,{stack:r})}}handleShowTablesQuery(e){return e.map(r=>({tableName:r.TABLE_NAME,schema:r.TABLE_SCHEMA}))}handleShowIndexesQuery(e){let r,n=[];return e.forEach(i=>{(!r||r.name!==i.Key_name)&&(r={primary:i.Key_name==="PRIMARY",fields:[],name:i.Key_name,tableName:i.Table,unique:i.Non_unique!==1,type:i.Index_type},n.push(r)),r.fields[i.Seq_in_index-1]={attribute:i.Column_name,length:i.Sub_part||void 0,order:i.Collation==="A"?"ASC":void 0}}),n}};vqe.exports=yH});var Dqe=A((bzr,Cqe)=>{"use strict";var RVt=Object.defineProperty,Sqe=Object.getOwnPropertySymbols,NVt=Object.prototype.hasOwnProperty,TVt=Object.prototype.propertyIsEnumerable,Lqe=(t,e,r)=>e in t?RVt(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,wVt=(t,e)=>{for(var r in e||(e={}))NVt.call(e,r)&&Lqe(t,r,e[r]);if(Sqe)for(var r of Sqe(e))TVt.call(e,r)&&Lqe(t,r,e[r]);return t},aS=it(),Pt=zn(),qVt=G0(),vVt={OperatorMap:{[Pt.eq]:"=",[Pt.ne]:"!=",[Pt.gte]:">=",[Pt.gt]:">",[Pt.lte]:"<=",[Pt.lt]:"<",[Pt.not]:"IS NOT",[Pt.is]:"IS",[Pt.in]:"IN",[Pt.notIn]:"NOT IN",[Pt.like]:"LIKE",[Pt.notLike]:"NOT LIKE",[Pt.iLike]:"ILIKE",[Pt.notILike]:"NOT ILIKE",[Pt.startsWith]:"LIKE",[Pt.endsWith]:"LIKE",[Pt.substring]:"LIKE",[Pt.regexp]:"~",[Pt.notRegexp]:"!~",[Pt.iRegexp]:"~*",[Pt.notIRegexp]:"!~*",[Pt.between]:"BETWEEN",[Pt.notBetween]:"NOT BETWEEN",[Pt.overlap]:"&&",[Pt.contains]:"@>",[Pt.contained]:"<@",[Pt.adjacent]:"-|-",[Pt.strictLeft]:"<<",[Pt.strictRight]:">>",[Pt.noExtendRight]:"&<",[Pt.noExtendLeft]:"&>",[Pt.any]:"ANY",[Pt.all]:"ALL",[Pt.and]:" AND ",[Pt.or]:" OR ",[Pt.col]:"COL",[Pt.placeholder]:"$$PLACEHOLDER$$",[Pt.match]:"@@"},OperatorsAliasMap:{},setOperatorsAliases(t){!t||aS.isEmpty(t)?this.OperatorsAliasMap=!1:this.OperatorsAliasMap=wVt({},t)},_replaceAliases(t){let e={};return this.OperatorsAliasMap?(qVt.getOperators(t).forEach(r=>{let n=t[r];aS.isPlainObject(n)?e[r]=this._replaceAliases(n):e[r]=n}),aS.forOwn(t,(r,n)=>{n=this.OperatorsAliasMap[n]||n,aS.isPlainObject(r)&&(r=this._replaceAliases(r)),e[n]=r}),e):t}};Cqe.exports=vVt});var xqe=A((hzr,Bqe)=>{"use strict";var IVt=(oM(),xc(sM)).v4,SVt={setIsolationLevelQuery(t,e){if(!e.parent)return`SET TRANSACTION ISOLATION LEVEL ${t};`},generateTransactionId(){return IVt()},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;"}};Bqe.exports=SVt});var up=A((Ozr,Fqe)=>{"use strict";var LVt=Object.defineProperty,CVt=Object.defineProperties,DVt=Object.getOwnPropertyDescriptors,Wqe=Object.getOwnPropertySymbols,BVt=Object.prototype.hasOwnProperty,xVt=Object.prototype.propertyIsEnumerable,Pqe=(t,e,r)=>e in t?LVt(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Dd=(t,e)=>{for(var r in e||(e={}))BVt.call(e,r)&&Pqe(t,r,e[r]);if(Wqe)for(var r of Wqe(e))xVt.call(e,r)&&Pqe(t,r,e[r]);return t},sS=(t,e)=>CVt(t,DVt(e)),oS=require("util"),Ct=it(),WVt=(oM(),xc(sM)).v4,Ge=G0(),Mzr=dM(),kqe=zg(),_M=R0(),$s=xV(),mM=np(),RH=ip(),PVt=lM(),kVt=qd(),Ce=zn(),NH=v0(),Uqe=HV(),ty=class{constructor(e){if(!e.sequelize)throw new Error("QueryGenerator initialized without options.sequelize");if(!e._dialect)throw new Error("QueryGenerator initialized without options._dialect");this.sequelize=e.sequelize,this.options=e.sequelize.options,this.dialect=e._dialect.name,this._dialect=e._dialect,this._initQuoteIdentifier()}extractTableDetails(e,r){return r=r||{},e=e||{},{schema:e.schema||r.schema||this.options.schema||"public",tableName:Ct.isPlainObject(e)?e.tableName:e,delimiter:e.delimiter||r.delimiter||"."}}addSchema(e){if(!e._schema)return e.tableName||e;let r=this;return{tableName:e.tableName||e,table:e.tableName||e,name:e.name||e,schema:e._schema,delimiter:e._schemaDelimiter||".",toString(){return r.quoteTable(this)}}}dropSchema(e,r){return this.dropTableQuery(e,r)}describeTableQuery(e,r,n){return`DESCRIBE ${this.quoteTable(this.addSchema({tableName:e,_schema:r,_schemaDelimiter:n}))};`}dropTableQuery(e){return`DROP TABLE IF EXISTS ${this.quoteTable(e)};`}renameTableQuery(e,r){return`ALTER TABLE ${this.quoteTable(e)} RENAME TO ${this.quoteTable(r)};`}populateInsertQueryReturnIntoBinds(){}insertQuery(e,r,n,i){i=i||{},Ct.defaults(i,this.options);let a={},s=i.bind||[],o=[],u=[],l=[],p=[],f=this.quoteTable(e),b=i.bindParam===void 0?this.bindParam(s):i.bindParam,O=[],M,m="",z="",y="",R="",w=!1,q="";if(n&&Ct.each(n,(I,U)=>{a[U]=I,I.field&&(a[I.field]=I)}),this._dialect.supports["DEFAULT VALUES"]?z+=" DEFAULT VALUES":this._dialect.supports["VALUES ()"]&&(z+=" VALUES ()"),(this._dialect.supports.returnValues||this._dialect.supports.returnIntoValues)&&i.returning){let I=this.generateReturnValues(n,i);u.push(...I.returnFields),this._dialect.supports.returnIntoValues&&l.push(...I.returnTypes),R=I.returningFragment,q=I.tmpTable||"",y=I.outputFragment||""}(Ct.get(this,["sequelize","options","dialectOptions","prependSearchPath"])||i.searchPath)&&(i.bindParam=!1),this._dialect.supports.EXCEPTION&&i.exception&&(i.bindParam=!1),r=Ge.removeNullValuesFromHash(r,this.options.omitNull);for(let I in r)if(Object.prototype.hasOwnProperty.call(r,I)){let U=r[I];o.push(this.quoteIdentifier(I)),a&&a[I]&&a[I].autoIncrement===!0&&U==null?this._dialect.supports.autoIncrement.defaultValue?this._dialect.supports.DEFAULT?p.push("DEFAULT"):p.push(this.escape(null)):o.splice(-1,1):(a&&a[I]&&a[I].autoIncrement===!0&&(w=!0),U instanceof Ge.SequelizeMethod||i.bindParam===!1?p.push(this.escape(U,a&&a[I]||void 0,{context:"INSERT"})):p.push(this.format(U,a&&a[I]||void 0,{context:"INSERT"},b)))}let C="";if(!Ct.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 I=i.upsertKeys.map(S=>this.quoteIdentifier(S)),U=i.updateOnDuplicate.map(S=>`${this.quoteIdentifier(S)}=EXCLUDED.${this.quoteIdentifier(S)}`),Y=["ON CONFLICT","(",I.join(","),")"];Ct.isEmpty(i.conflictWhere)||Y.push(this.whereQuery(i.conflictWhere,i)),Ct.isEmpty(U)?Y.push("DO NOTHING"):Y.push("DO UPDATE SET",U.join(",")),C=` ${Ge.joinSQLFragments(Y)}`}else{let I=i.updateOnDuplicate.map(U=>`${this.quoteIdentifier(U)}=VALUES(${this.quoteIdentifier(U)})`);if(Ct.isEmpty(I)&&i.upsertKeys&&I.push(...i.upsertKeys.map(U=>`${this.quoteIdentifier(U)}=${this.quoteIdentifier(U)}`)),Ct.isEmpty(I))throw new Error("No update values found for ON DUPLICATE KEY UPDATE clause, and no identifier fields could be found to use instead.");C+=`${this._dialect.supports.inserts.updateOnDuplicate} ${I.join(",")}`}let L={ignoreDuplicates:i.ignoreDuplicates?this._dialect.supports.inserts.ignoreDuplicates:"",onConflictDoNothing:i.ignoreDuplicates?this._dialect.supports.inserts.onConflictDoNothing:"",attributes:o.join(","),output:y,values:p.join(","),tmpTable:q};if(m=`${q}INSERT${L.ignoreDuplicates} INTO ${f} (${L.attributes})${L.output} VALUES (${L.values})${C}${L.onConflictDoNothing}${m}`,z=`${q}INSERT${L.ignoreDuplicates} INTO ${f}${L.output}${C}${L.onConflictDoNothing}${z}`,this._dialect.supports.EXCEPTION&&i.exception){let I="DROP FUNCTION IF EXISTS pg_temp.testfunc()";u.length===0&&u.push("*");let U=`$func_${WVt().replace(/-/g,"")}$`,Y=`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;",m=`CREATE OR REPLACE FUNCTION pg_temp.testfunc(OUT response ${f}, OUT sequelize_caught_exception text) RETURNS RECORD AS ${U} BEGIN ${m} RETURNING * INTO response; EXCEPTION ${i.exception} END ${U} LANGUAGE plpgsql; ${Y} ${I}`}else m+=R,z+=R;this._dialect.supports.returnIntoValues&&i.returning&&this.populateInsertQueryReturnIntoBinds(u,l,s.length,O,i),M=`${L.attributes.length?m:z}${O.join(",")};`,this._dialect.supports.finalTable&&(M=`SELECT * FROM FINAL TABLE(${L.attributes.length?m:z});`),w&&this._dialect.supports.autoIncrement.identityInsert&&(M=`SET IDENTITY_INSERT ${f} ON; ${M} SET IDENTITY_INSERT ${f} OFF;`);let j={query:M};return i.bindParam!==!1&&(j.bind=s),j}bulkInsertQuery(e,r,n,i){n=n||{},i=i||{};let a=[],s={},o=[],u="";for(let O of r)Ct.forOwn(O,(M,m)=>{o.includes(m)||o.push(m),i[m]&&i[m].autoIncrement===!0&&(s[m]=!0)});for(let O of r){let M=o.map(m=>this._dialect.supports.bulkDefault&&s[m]===!0?O[m]!=null?O[m]:"DEFAULT":this.escape(O[m],i[m],{context:"INSERT"}));a.push(`(${M.join(",")})`)}if(this._dialect.supports.inserts.updateOnDuplicate&&n.updateOnDuplicate)if(this._dialect.supports.inserts.updateOnDuplicate==" ON CONFLICT DO UPDATE SET"){let O=n.upsertKeys.map(z=>this.quoteIdentifier(z)),M=n.updateOnDuplicate.map(z=>`${this.quoteIdentifier(z)}=EXCLUDED.${this.quoteIdentifier(z)}`),m=!1;if(n.conflictWhere){if(!this._dialect.supports.inserts.onConflictWhere)throw new Error(`conflictWhere not supported for dialect ${this._dialect.name}`);m=this.whereQuery(n.conflictWhere,n)}u=["ON CONFLICT","(",O.join(","),")",m,"DO UPDATE SET",M.join(",")]}else{if(n.conflictWhere)throw new Error(`conflictWhere not supported for dialect ${this._dialect.name}`);let O=n.updateOnDuplicate.map(M=>`${this.quoteIdentifier(M)}=VALUES(${this.quoteIdentifier(M)})`);u=`${this._dialect.supports.inserts.updateOnDuplicate} ${O.join(",")}`}let l=n.ignoreDuplicates?this._dialect.supports.inserts.ignoreDuplicates:"",p=o.map(O=>this.quoteIdentifier(O)).join(","),f=n.ignoreDuplicates?this._dialect.supports.inserts.onConflictDoNothing:"",b="";if(this._dialect.supports.returnValues&&n.returning){let O=this.generateReturnValues(i,n);b+=O.returningFragment}return Ge.joinSQLFragments(["INSERT",l,"INTO",this.quoteTable(e),`(${p})`,"VALUES",a.join(","),u,f,b,";"])}updateQuery(e,r,n,i,a){i=i||{},Ct.defaults(i,this.options),r=Ge.removeNullValuesFromHash(r,i.omitNull,i);let s=[],o=[],u={},l="",p="",f="";(Ct.get(this,["sequelize","options","dialectOptions","prependSearchPath"])||i.searchPath)&&(i.bindParam=!1);let b=i.bindParam===void 0?this.bindParam(o):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)?f+=" AND ":f+=" WHERE ",f+=`rownum <= ${this.escape(i.limit)} `):f=` LIMIT ${this.escape(i.limit)} `),this._dialect.supports.returnValues&&i.returning){let z=this.generateReturnValues(a,i);f+=z.returningFragment,p=z.tmpTable||"",l=z.outputFragment||"",!this._dialect.supports.returnValues.output&&i.returning&&(i.mapToModel=!0)}a&&Ct.each(a,(z,y)=>{u[y]=z,z.field&&(u[z.field]=z)});for(let z in r){if(u&&u[z]&&u[z].autoIncrement===!0&&!this._dialect.supports.autoIncrement.update)continue;let y=r[z];y instanceof Ge.SequelizeMethod||i.bindParam===!1?s.push(`${this.quoteIdentifier(z)}=${this.escape(y,u&&u[z]||void 0,{context:"UPDATE"})}`):s.push(`${this.quoteIdentifier(z)}=${this.format(y,u&&u[z]||void 0,{context:"UPDATE"},b)}`)}let O=sS(Dd({},i),{bindParam:b});if(s.length===0)return"";let m={query:`${p}UPDATE ${this.quoteTable(e)} SET ${s.join(",")}${l} ${this.whereQuery(n,O)}${f}`.trim()};return i.bindParam!==!1&&(m.bind=o),m}arithmeticQuery(e,r,n,i,a,s){s=s||{},Ct.defaults(s,{returning:!0}),a=Ge.removeNullValuesFromHash(a,this.options.omitNull);let o="",u="";if(this._dialect.supports.returnValues&&s.returning){let p=this.generateReturnValues(null,s);o=p.outputFragment,u=p.returningFragment}let l=[];for(let p in i){let f=i[p],b=this.quoteIdentifier(p),O=this.escape(f);l.push(`${b}=${b}${e} ${O}`)}for(let p in a){let f=a[p],b=this.quoteIdentifier(p),O=this.escape(f);l.push(`${b}=${O}`)}return Ge.joinSQLFragments(["UPDATE",this.quoteTable(r),"SET",l.join(","),o,this.whereQuery(n),u])}addIndexQuery(e,r,n,i){n=n||{},Array.isArray(r)?n.fields=r:(n=r,r=void 0),n.prefix=n.prefix||i||e,n.prefix&&typeof n.prefix=="string"&&(n.prefix=n.prefix.replace(/\./g,"_"),n.prefix=n.prefix.replace(/("|')/g,""));let a=n.fields.map(u=>{if(u instanceof Ge.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: ${oS.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 p=u.operator||n.operator;p&&(l+=` ${p}`)}return this._dialect.supports.index.length&&u.length&&(l+=`(${u.length})`),u.order&&(l+=` ${u.order}`),l});n.name||(n=Ge.nameIndex(n,n.prefix)),n=$s._conformIndex(n),this._dialect.supports.index.type||delete n.type,n.where&&(n.where=this.whereQuery(n.where)),typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e);let s=this._dialect.supports.index.concurrently&&n.concurrently?"CONCURRENTLY":void 0,o;return this._dialect.supports.indexViaAlter?o=["ALTER TABLE",e,s,"ADD"]:o=["CREATE"],o=o.concat(n.unique?"UNIQUE":"",n.type,"INDEX",this._dialect.supports.indexViaAlter?void 0:s,this.quoteIdentifiers(n.name),this._dialect.supports.index.using===1&&n.using?`USING ${n.using}`:"",this._dialect.supports.indexViaAlter?void 0:`ON ${e}`,this._dialect.supports.index.using===2&&n.using?`USING ${n.using}`:"",`(${a.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),Ct.compact(o).join(" ")}addConstraintQuery(e,r){return typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e),Ge.joinSQLFragments(["ALTER TABLE",e,"ADD",this.getConstraintSnippet(e,r||{}),";"])}getConstraintSnippet(e,r){let n,i,a=r.fields.map(u=>{if(typeof u=="string")return this.quoteIdentifier(u);if(u instanceof Ge.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)}),s=a.join(", "),o=a.join("_");switch(r.type.toUpperCase()){case"UNIQUE":i=this.quoteIdentifier(r.name||`${e}_${o}_uk`),n=`CONSTRAINT ${i} UNIQUE (${s})`;break;case"CHECK":r.where=this.whereItemsQuery(r.where),i=this.quoteIdentifier(r.name||`${e}_${o}_ck`),n=`CONSTRAINT ${i} CHECK (${r.where})`;break;case"DEFAULT":if(r.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(r.name||`${e}_${o}_df`),n=`CONSTRAINT ${i} DEFAULT (${this.escape(r.defaultValue)}) FOR ${a[0]}`;break;case"PRIMARY KEY":i=this.quoteIdentifier(r.name||`${e}_${o}_pk`),n=`CONSTRAINT ${i} PRIMARY KEY (${s})`;break;case"FOREIGN KEY":let u=r.references;if(!u||!u.table||!(u.field||u.fields))throw new Error("references object with table and field must be specified");i=this.quoteIdentifier(r.name||`${e}_${o}_${u.table}_fk`);let l=typeof u.field<"u"?this.quoteIdentifier(u.field):u.fields.map(f=>this.quoteIdentifier(f)).join(", "),p=`${this.quoteTable(u.table)} (${l})`;n=`CONSTRAINT ${i} `,n+=`FOREIGN KEY (${s}) REFERENCES ${p}`,r.onUpdate&&(n+=` ON UPDATE ${r.onUpdate.toUpperCase()}`),r.onDelete&&(n+=` ON DELETE ${r.onDelete.toUpperCase()}`);break;default:throw new Error(`${r.type} is invalid.`)}return r.deferrable&&["UNIQUE","PRIMARY KEY","FOREIGN KEY"].includes(r.type.toUpperCase())&&(n+=` ${this.deferConstraintsQuery(r)}`),n}removeConstraintQuery(e,r){return typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e),Ge.joinSQLFragments(["ALTER TABLE",e,"DROP CONSTRAINT",this.quoteIdentifiers(r)])}quote(e,r,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 e=="string")return this.quoteIdentifiers(e);if(Array.isArray(e)){e.forEach((p,f)=>{let b=e[f-1],O,M;if(!b&&r!==void 0?M=r:b&&b instanceof mM&&(O=b,M=b.target),M&&M.prototype instanceof $s){let m,z;if(typeof p=="function"&&p.prototype instanceof $s?m=p:Ct.isPlainObject(p)&&p.model&&p.model.prototype instanceof $s&&(m=p.model,z=p.as),m&&(!z&&O&&O instanceof mM&&O.through&&O.through.model===m?p=new mM(M,m,{as:m.name}):(p=M.getAssociationForAlias(m,z),p||(p=M.getAssociationForAlias(m,m.name))),!(p instanceof mM)))throw new Error(oS.format("Unable to find a valid association for model, '%s'",m.name))}if(typeof p=="string"){let m=i.indexOf(p.toUpperCase());if(f>0&&m!==-1)p=this.sequelize.literal(` ${i[m]}`);else if(M&&M.prototype instanceof $s){if(M.associations!==void 0&&M.associations[p])p=M.associations[p];else if(M.rawAttributes!==void 0&&M.rawAttributes[p]&&p!==M.rawAttributes[p].field)p=M.rawAttributes[p].field;else if(p.includes(".")&&M.rawAttributes!==void 0){let z=p.split(".");if(M.rawAttributes[z[0]].type instanceof _M.JSON){let y=this.quoteIdentifiers(`${M.name}.${M.rawAttributes[z[0]].field}`),R=z.slice(1);p=this.jsonPathExtractionQuery(y,R),p=this.sequelize.literal(p)}}}}e[f]=p},this);let a=e.length,s=[],o,u=0;for(u=0;u<a-1&&(o=e[u],!(typeof o=="string"||o._modelAttribute||o instanceof Ge.SequelizeMethod));u++)o instanceof mM&&(s[u]=o.as);let l="";return u>0?l+=`${this.quoteIdentifier(s.join(n))}.`:typeof e[0]=="string"&&r&&(l+=`${this.quoteIdentifier(r.name)}.`),e.slice(u).forEach(p=>{l+=this.quote(p,r,n)},this),l}if(e._modelAttribute)return`${this.quoteTable(e.Model.name)}.${this.quoteIdentifier(e.fieldName)}`;if(e instanceof Ge.SequelizeMethod)return this.handleSequelizeMethod(e);throw Ct.isPlainObject(e)&&e.raw?new Error('The `{raw: "..."}` syntax is no longer supported.  Use `sequelize.literal` instead.'):new Error(`Unknown structure passed to order / group: ${oS.inspect(e)}`)}_initQuoteIdentifier(){this._quoteIdentifier=this.quoteIdentifier,this.quoteIdentifier=function(e,r){return e==="*"?e:this._quoteIdentifier(e,r)}}quoteIdentifier(e,r){throw new Error(`quoteIdentifier for Dialect "${this.dialect}" is not implemented`)}quoteIdentifiers(e){if(e.includes(".")){e=e.split(".");let r=e.slice(0,e.length-1).join("->"),n=e[e.length-1];return`${this.quoteIdentifier(r)}.${this.quoteIdentifier(n)}`}return this.quoteIdentifier(e)}quoteAttribute(e,r){return r&&e in r.rawAttributes?this.quoteIdentifier(e):this.quoteIdentifiers(e)}getAliasToken(){return"AS"}quoteTable(e,r){let n="";return r===!0&&(r=e.as||e.name||e),Ct.isObject(e)?this._dialect.supports.schemas?(e.schema&&(n+=`${this.quoteIdentifier(e.schema)}.`),n+=this.quoteIdentifier(e.tableName)):(e.schema&&(n+=e.schema+(e.delimiter||".")),n+=e.tableName,n=this.quoteIdentifier(n)):n=this.quoteIdentifier(e),r&&(n+=` ${this.getAliasToken()} ${this.quoteIdentifier(r)}`),n}escape(e,r,n){if(n=n||{},e!=null){if(e instanceof Ge.SequelizeMethod)return this.handleSequelizeMethod(e);if(r&&r.type&&(r.type instanceof _M.STRING&&["mysql","mariadb"].includes(this.dialect)&&["number","boolean"].includes(typeof e)&&(e=String(Number(e))),this.validate(e,r,n),r.type.stringify)){let i=a=>kqe.escape(a,this.options.timezone,this.dialect);if(e=r.type.stringify(e,{escape:i,field:r,timezone:this.options.timezone,operation:n.operation}),r.type.escape===!1)return e}}return kqe.escape(e,this.options.timezone,this.dialect)}bindParam(e){return r=>(e.push(r),`$${e.length}`)}format(e,r,n,i){if(n=n||{},e!=null){if(e instanceof Ge.SequelizeMethod)throw new Error("Cannot pass SequelizeMethod as a bind parameter - use escape instead");if(r&&r.type&&(this.validate(e,r,n),r.type.bindParam))return r.type.bindParam(e,{escape:Ct.identity,field:r,timezone:this.options.timezone,operation:n.operation,bindParam:i})}return i(e)}validate(e,r,n){if(this.typeValidation&&r.type.validate&&e)try{if(n.isList&&Array.isArray(e))for(let i of e)r.type.validate(i,n);else r.type.validate(e,n)}catch(i){throw i instanceof NH.ValidationError&&i.errors.push(new NH.ValidationErrorItem(i.message,"Validation error",r.fieldName,e,null,`${r.type.key} validator`)),i}}isIdentifierQuoted(e){return/^\s*(?:([`"'])(?:(?!\1).|\1{2})*\1\.?)+\s*$/i.test(e)}jsonPathExtractionQuery(e,r,n){let i=Ct.toPath(r),a,s=this.isIdentifierQuoted(e)?e:this.quoteIdentifier(e);switch(this.dialect){case"mysql":case"mariadb":case"sqlite":return this.dialect==="mysql"&&(i=i.map(u=>/\D/.test(u)?Ge.addTicks(u,'"'):u)),a=this.escape(["$"].concat(i).join(".").replace(/\.(\d+)(?:(?=\.)|$)/g,(u,l)=>`[${l}]`)),this.dialect==="sqlite"?`json_extract(${s},${a})`:`json_unquote(json_extract(${s},${a}))`;case"postgres":let o=n?"#>":"#>>";return a=this.escape(`{${i.join(",")}}`),`(${s}${o}${a})`;default:throw new Error(`Unsupported ${this.dialect} for JSON operations`)}}selectQuery(e,r,n){r=r||{};let i=r.limit,a=[],s=[],o=r.subQuery===void 0?i&&r.hasMultiAssociation:r.subQuery,u={main:r.attributes&&r.attributes.slice(),subQuery:null},l={name:e,quotedName:null,as:null,model:n},p={names:l,options:r,subQuery:o},f=[],b=[],O;if(this.options.minifyAliases&&!r.aliasesMapping&&(r.aliasesMapping=new Map,r.aliasesByTable={},r.includeAliases=new Map),r.tableAs?l.as=this.quoteIdentifier(r.tableAs):!Array.isArray(l.name)&&l.model&&(l.as=this.quoteIdentifier(l.model.name)),l.quotedName=Array.isArray(l.name)?e.map(m=>Array.isArray(m)?this.quoteTable(m[0],m[1]):this.quoteTable(m,!0)).join(", "):this.quoteTable(l.name),o&&u.main)for(let m of l.model.primaryKeyAttributes)u.main.some(z=>m===z||m===z[0]||m===z[1])||u.main.push(l.model.rawAttributes[m].field?[m,l.model.rawAttributes[m].field]:m);if(u.main=this.escapeAttributes(u.main,r,l.as),u.main=u.main||(r.include?[`${l.as}.*`]:["*"]),(o||r.groupedLimit)&&(u.subQuery=u.main,u.main=[`${l.as||l.quotedName}.*`]),r.include)for(let m of r.include){if(m.separate)continue;let z=this.generateInclude(m,{externalAs:l.as,internalAs:l.as},p);b=b.concat(z.subQuery),f=f.concat(z.mainQuery),z.attributes.main.length>0&&(u.main=Ct.uniq(u.main.concat(z.attributes.main))),z.attributes.subQuery.length>0&&(u.subQuery=Ct.uniq(u.subQuery.concat(z.attributes.subQuery)))}if(o)s.push(this.selectFromTableFragment(r,l.model,u.subQuery,l.quotedName,l.as)),s.push(b.join(""));else{if(r.groupedLimit){l.as||(l.as=l.quotedName);let m=Dd({},r.where),z,y,R,w=l.as;if(typeof r.groupedLimit.on=="string"?y=r.groupedLimit.on:r.groupedLimit.on instanceof kVt&&(y=r.groupedLimit.on.foreignKeyField),r.groupedLimit.on instanceof PVt){w=r.groupedLimit.on.manyFromSource.as;let j=$s._validateIncludedElements({include:[{association:r.groupedLimit.on.manyFromSource,duplicating:!1,required:!0,where:Dd({[Ce.placeholder]:!0},r.groupedLimit.through&&r.groupedLimit.through.where)}],model:n});r.hasJoin=!0,r.hasMultiAssociation=!0,r.includeMap=Object.assign(j.includeMap,r.includeMap),r.includeNames=j.includeNames.concat(r.includeNames||[]),R=j.include,Array.isArray(r.order)&&(r.order.forEach((I,U)=>{Array.isArray(I)&&(I=I[0]);let Y=`subquery_order_${U}`;r.attributes.push([I,Y]),Y=this.sequelize.literal(this.quote(Y)),Array.isArray(r.order[U])?r.order[U][0]=Y:r.order[U]=Y}),z=r.order)}else z=r.order,this._dialect.supports.topLevelOrderByRequired||delete r.order,m[Ce.placeholder]=!0;let q=`SELECT * FROM (${this.selectQuery(e,{attributes:r.attributes,offset:r.offset,limit:r.groupedLimit.limit,order:z,aliasesMapping:r.aliasesMapping,aliasesByTable:r.aliasesByTable,where:m,include:R,model:n},n).replace(/;$/,"")}) ${this.getAliasToken()} sub`,C=this.whereItemQuery(Ce.placeholder,!0,{model:n}),L=q.indexOf(C);a.push(this.selectFromTableFragment(r,l.model,u.main,`(${r.groupedLimit.values.map(j=>{let I;return y&&(I={[y]:j}),R&&(I={[r.groupedLimit.on.foreignIdentifierField]:j}),Ge.spliceStr(q,L,C.length,this.getWhereConditions(I,w))}).join(this._dialect.supports["UNION ALL"]?" UNION ALL ":" UNION ")})`,l.as))}else a.push(this.selectFromTableFragment(r,l.model,u.main,l.quotedName,l.as));a.push(f.join(""))}if(Object.prototype.hasOwnProperty.call(r,"where")&&!r.groupedLimit&&(r.where=this.getWhereConditions(r.where,l.as||e,n,r),r.where&&(o?s.push(` WHERE ${r.where}`):(a.push(` WHERE ${r.where}`),a.forEach((m,z)=>{m.startsWith("SELECT")&&(a[z]=this.selectFromTableFragment(r,n,u.main,l.quotedName,l.as,r.where))})))),r.group&&(r.group=Array.isArray(r.group)?r.group.map(m=>this.aliasGrouping(m,n,l.as,r)).join(", "):this.aliasGrouping(r.group,n,l.as,r),o&&r.group?s.push(` GROUP BY ${r.group}`):r.group&&a.push(` GROUP BY ${r.group}`)),Object.prototype.hasOwnProperty.call(r,"having")&&(r.having=this.getWhereConditions(r.having,e,n,r,!1),r.having&&(o?s.push(` HAVING ${r.having}`):a.push(` HAVING ${r.having}`))),r.order){let m=this.getQueryOrders(r,n,o);m.mainQueryOrder.length&&a.push(` ORDER BY ${m.mainQueryOrder.join(", ")}`),m.subQueryOrder.length&&s.push(` ORDER BY ${m.subQueryOrder.join(", ")}`)}let M=this.addLimitAndOffset(r,l.model);if(M&&!r.groupedLimit&&(o?s.push(M):a.push(M)),o?(this._throwOnEmptyAttributes(u.main,{modelName:n&&n.name,as:l.as}),O=`SELECT ${u.main.join(", ")} FROM (${s.join("")}) ${this.getAliasToken()} ${l.as}${f.join("")}${a.join("")}`):O=a.join(""),r.lock&&this._dialect.supports.lock){let m=r.lock;typeof r.lock=="object"&&(m=r.lock.level),this._dialect.supports.lockKey&&["KEY SHARE","NO KEY UPDATE"].includes(m)?O+=` FOR ${m}`:m==="SHARE"?O+=` ${this._dialect.supports.forShare}`:O+=" FOR UPDATE",this._dialect.supports.lockOf&&r.lock.of&&r.lock.of.prototype instanceof $s&&(O+=` OF ${this.quoteTable(r.lock.of.name)}`),this._dialect.supports.skipLocked&&r.skipLocked&&(O+=" SKIP LOCKED")}return`${O};`}aliasGrouping(e,r,n,i){let a=Array.isArray(e)?e[0]:e;return this.quote(this._getAliasForField(n,a,i)||a,r)}escapeAttributes(e,r,n){return e&&e.map(i=>{let a=!0;if(i instanceof Ge.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 Ge.SequelizeMethod)i[0]=this.handleSequelizeMethod(i[0]),a=!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 (/home2/kzgqvuqk/sendotp.store/index.js:136:7832)
    at new t (/home2/kzgqvuqk/sendotp.store/index.js:148:66644)
    at new Gi (/home2/kzgqvuqk/sendotp.store/index.js:148:73185)
    at new t (/home2/kzgqvuqk/sendotp.store/index.js:148:229204)
    at Object.<anonymous> (/home2/kzgqvuqk/sendotp.store/index.js:3371:28474)
    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
/home2/kzgqvuqk/sendotp.store/index.js:136
`}};$I.AggregateError=OH});var dqe=A(JI=>{"use strict";Object.defineProperty(JI,"__esModule",{value:!0});JI.Deferred=void 0;var jQt=MH(),_H=class{constructor(){this._promise=new Promise((e,r)=>{this._reject=r,this._resolve=e})}registerTimeout(e,r){this._timeout||(this._timeout=setTimeout(()=>{r(),this.reject(new jQt.TimeoutError("Operation timeout"))},e))}_clearTimeout(){this._timeout&&clearTimeout(this._timeout)}resolve(e){this._clearTimeout(),this._resolve(e)}reject(e){this._clearTimeout(),this._reject(e)}promise(){return this._promise}};JI.Deferred=_H});var bqe=A(ZI=>{"use strict";Object.defineProperty(ZI,"__esModule",{value:!0});ZI.Pool=void 0;var QQt=dqe(),VQt=AH(),mH=class{constructor(e){if(this.log=!1,!e.create)throw new Error("create function is required");if(!e.destroy)throw new Error("destroy function is required");if(!e.validate)throw new Error("validate function is required");if(typeof e.min!="number"||e.min<0||e.min!==Math.round(e.min))throw new Error("min must be an integer >= 0");if(typeof e.max!="number"||e.max<=0||e.max!==Math.round(e.max))throw new Error("max must be an integer > 0");if(e.min>e.max)throw new Error("max is smaller than min");if(e.maxUses!==void 0&&(typeof e.maxUses!="number"||e.maxUses<0))throw new Error("maxUses must be an integer >= 0");this.idleTimeoutMillis=e.idleTimeoutMillis||3e4,this.acquireTimeoutMillis=e.acquireTimeoutMillis||3e4,this.reapIntervalMillis=e.reapIntervalMillis||1e3,this.maxUsesPerResource=e.maxUses||1/0,this.log=e.log||!1,this._factory=e,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(e,r){typeof this.log=="function"?this.log(e,r):this.log&&console.log(`${r.toUpperCase()} pool ${this.name||""} - ${e}`)}_removeIdle(){let e=[],r=Date.now(),n,i=this._availableObjects.length,a=this.size-this.minSize,s;for(this._removeIdleScheduled=!1,n=0;n<i&&a>e.length;n++)s=this._availableObjects[n].timeout,r>=s&&(this._log("removeIdle() destroying obj - now:"+r+" timeout:"+s,"verbose"),e.push(this._availableObjects[n].resource));e.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 e=null,r=this._pendingAcquires.length;if(this._log(`dispense() clients=${r} available=${this._availableObjects.length}`,"info"),!(r<1)){for(;this._availableObjects.length>0;){if(this._log("dispense() - reusing obj","verbose"),e=this._availableObjects[this._availableObjects.length-1],!this._factory.validate(e.resource)){this.destroy(e.resource);continue}return this._availableObjects.pop(),this._addResourceToInUseObjects(e.resource,e.useCount),this._pendingAcquires.shift().resolve(e.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(e=>{let r=this._pendingAcquires.shift();r?(this._addResourceToInUseObjects(e,0),r.resolve(e)):this._addResourceToAvailableObjects(e,0)}).catch(e=>{let r=this._pendingAcquires.shift();this._count-=1,this._count<0&&(this._count=0),r&&r.reject(e),process.nextTick(()=>{this._dispense()})})}_addResourceToAvailableObjects(e,r){let n={resource:e,useCount:r,timeout:Date.now()+this.idleTimeoutMillis};this._availableObjects.push(n),this._dispense(),this._scheduleRemoveIdle()}_addResourceToInUseObjects(e,r){let n={resource:e,useCount:r};this._inUseObjects.push(n)}_ensureMinimum(){let e,r;if(!this._draining&&this.size<this.minSize)for(r=this.minSize-this.size,e=0;e<r;e++)this._createResource()}acquire(){if(this._draining)return Promise.reject(new Error("pool is draining and cannot accept work"));let e=new QQt.Deferred;return e.registerTimeout(this.acquireTimeoutMillis,()=>{this._pendingAcquires=this._pendingAcquires.filter(r=>r!==e)}),this._pendingAcquires.push(e),this._dispense(),e.promise()}release(e){if(this._availableObjects.some(i=>i.resource===e)){this._log("release called twice for the same resource: "+new Error().stack,"error");return}let r=this._inUseObjects.findIndex(i=>i.resource===e);if(r<0){this._log("attempt to release an invalid resource: "+new Error().stack,"error");return}let n=this._inUseObjects[r];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(r,1),this._addResourceToAvailableObjects(n.resource,n.useCount))}async destroy(e){let r=this._availableObjects.length,n=this._inUseObjects.length;if(this._availableObjects=this._availableObjects.filter(i=>i.resource!==e),this._inUseObjects=this._inUseObjects.filter(i=>i.resource!==e),r===this._availableObjects.length&&n===this._inUseObjects.length){this._ensureMinimum();return}this._count-=1,this._count<0&&(this._count=0);try{await this._factory.destroy(e)}finally{this._ensureMinimum(),this._draining||process.nextTick(()=>{this._dispense()})}}drain(){this._log("draining","info"),this._draining=!0;let e=r=>{if(this._pendingAcquires.length>0){this._dispense(),setTimeout(()=>{e(r)},100);return}if(this._availableObjects.length!==this._count){setTimeout(()=>{e(r)},100);return}r()};return new Promise(r=>e(r))}async destroyAllNow(){this._log("force destroying all objects","info"),this._removeIdleScheduled=!1,clearTimeout(this._removeIdleTimer);let e=this._availableObjects.map(n=>n.resource),r=[];for(let n of e)try{await this.destroy(n)}catch(i){this._log("Error destroying resource: "+i.stack,"error"),r.push(i)}if(r.length>0)throw new VQt.AggregateError(r)}};ZI.Pool=mH});var hqe=A(sp=>{"use strict";Object.defineProperty(sp,"__esModule",{value:!0});sp.Pool=sp.AggregateError=sp.TimeoutError=void 0;var HQt=MH();Object.defineProperty(sp,"TimeoutError",{enumerable:!0,get:function(){return HQt.TimeoutError}});var XQt=AH();Object.defineProperty(sp,"AggregateError",{enumerable:!0,get:function(){return XQt.AggregateError}});var YQt=bqe();Object.defineProperty(sp,"Pool",{enumerable:!0,get:function(){return YQt.Pool}})});var uu=A((uzr,eS)=>{"use strict";var{Pool:EH,TimeoutError:KQt}=hqe(),op=it(),zH=Ks(),$Qt=v0(),{logger:JQt}=Gr(),ZQt=dM(),Zo=JQt.debugContext("pool"),$g=class{constructor(e,r){let n=op.cloneDeep(r.config);if(this.sequelize=r,this.config=n,this.dialect=e,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=op.defaults(n.pool||{},{max:5,min:0,idle:1e4,acquire:6e4,evict:1e3,validate:this._validate.bind(this)}),this.initPools()}refreshTypeParser(e){op.each(e,r=>{if(Object.prototype.hasOwnProperty.call(r,"parse"))if(r.types[this.dialectName])this._refreshTypeParser(r);else throw new Error(`Parse function not supported for type ${r.key} in dialect ${this.dialectName}`)})}_loadDialectModule(e){try{return this.sequelize.config.dialectModulePath?require(this.sequelize.config.dialectModulePath):this.sequelize.config.dialectModule?this.sequelize.config.dialectModule:require(e)}catch(r){throw r.code==="MODULE_NOT_FOUND"?this.sequelize.config.dialectModulePath?new Error(`Unable to find dialect at ${this.sequelize.config.dialectModulePath}`):new Error(`Please install ${e} package manually`):r}}async _onProcessExit(){if(this.pool)return await this.pool.drain(),Zo("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 e=this.config;if(!e.replication){this.pool=new EH({name:"sequelize",create:()=>this._connect(e),destroy:async n=>{let i=await this._disconnect(n);return Zo("connection destroy"),i},validate:e.pool.validate,max:e.pool.max,min:e.pool.min,acquireTimeoutMillis:e.pool.acquire,idleTimeoutMillis:e.pool.idle,reapIntervalMillis:e.pool.evict,maxUses:e.pool.maxUses}),Zo(`pool created with max/min: ${e.pool.max}/${e.pool.min}, no replication`);return}Array.isArray(e.replication.read)||(e.replication.read=[e.replication.read]),e.replication.write=op.defaults(e.replication.write,op.omit(e,"replication")),e.replication.read=e.replication.read.map(n=>op.defaults(n,op.omit(this.config,"replication")));let r=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),Zo("connection destroy")},destroyAllNow:async()=>{await Promise.all([this.pool.read.destroyAllNow(),this.pool.write.destroyAllNow()]),Zo("all connections destroyed")},drain:async()=>Promise.all([this.pool.write.drain(),this.pool.read.drain()]),read:new EH({name:"sequelize:read",create:async()=>{let n=r++%e.replication.read.length,i=await this._connect(e.replication.read[n]);return i.queryType="read",i},destroy:n=>this._disconnect(n),validate:e.pool.validate,max:e.pool.max,min:e.pool.min,acquireTimeoutMillis:e.pool.acquire,idleTimeoutMillis:e.pool.idle,reapIntervalMillis:e.pool.evict,maxUses:e.pool.maxUses}),write:new EH({name:"sequelize:write",create:async()=>{let n=await this._connect(e.replication.write);return n.queryType="write",n},destroy:n=>this._disconnect(n),validate:e.pool.validate,max:e.pool.max,min:e.pool.min,acquireTimeoutMillis:e.pool.acquire,idleTimeoutMillis:e.pool.idle,reapIntervalMillis:e.pool.evict,maxUses:e.pool.maxUses})},Zo(`pool created with max/min: ${e.pool.max}/${e.pool.min}, with replication`)}async getConnection(e){e=e||{},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 a=await this.sequelize.databaseVersion(i),s=op.get(zH.coerce(a),"version")||a;this.sequelize.options.databaseVersion=zH.valid(s)?s:this.dialect.defaultVersion}return zH.lt(this.sequelize.options.databaseVersion,this.dialect.defaultVersion)&&(ZQt.unsupportedEngine(),Zo(`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 r;try{await this.sequelize.runHooks("beforePoolAcquire",e),r=await this.pool.acquire(e.type,e.useMaster),await this.sequelize.runHooks("afterPoolAcquire",r,e)}catch(n){throw n instanceof KQt?new $Qt.ConnectionAcquireTimeoutError(n):n}return Zo("connection acquired"),r}releaseConnection(e){this.pool.release(e),Zo("connection released")}async destroyConnection(e){await this.pool.destroy(e),Zo(`connection ${e.uuid} destroyed`)}async _connect(e){await this.sequelize.runHooks("beforeConnect",e);let r=await this.dialect.connectionManager.connect(e);return await this.sequelize.runHooks("afterConnect",r,e),r}async _disconnect(e){return await this.sequelize.runHooks("beforeDisconnect",e),await this.dialect.connectionManager.disconnect(e),this.sequelize.runHooks("afterDisconnect",e)}_validate(e){return this.dialect.connectionManager.validate?this.dialect.connectionManager.validate(e):!0}};eS.exports=$g;eS.exports.ConnectionManager=$g;eS.exports.default=$g});var ss=A((lzr,Mqe)=>{"use strict";var Jg=new Map;Mqe.exports=t=>(Jg.has(t)||Jg.set(t,new Map),{clear(){Jg.get(t).clear()},refresh(e){for(let r of e.types[t])Jg.get(t).set(r,e.parse)},get(e){return Jg.get(t).get(e)}})});var mqe=A((pzr,rS)=>{"use strict";var eVt=Object.defineProperty,Oqe=Object.getOwnPropertySymbols,tVt=Object.prototype.hasOwnProperty,rVt=Object.prototype.propertyIsEnumerable,Aqe=(t,e,r)=>e in t?eVt(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,nVt=(t,e)=>{for(var r in e||(e={}))tVt.call(e,r)&&Aqe(t,r,e[r]);if(Oqe)for(var r of Oqe(e))rVt.call(e,r)&&Aqe(t,r,e[r]);return t},iVt=Ks(),aVt=uu(),AM=v0(),{logger:sVt}=Gr(),oVt=R0().mariadb,cVt=Xo(),_qe=sVt.debugContext("connection:mariadb"),tS=ss()("mariadb"),Zg=class t extends aVt{constructor(e,r){r.config.port=r.config.port||3306,super(e,r),this.lib=this._loadDialectModule("mariadb"),this.refreshTypeParser(oVt)}static _typecast(e,r){return tS.get(e.type)?tS.get(e.type)(e,this.sequelize.options,r):r()}_refreshTypeParser(e){tS.refresh(e)}_clearTypeParser(){tS.clear()}async connect(e){let r=this.sequelize.options.timezone;r=/\//.test(r)?cVt.tz(r).format("Z"):r;let n=nVt({host:e.host,port:e.port,user:e.username,password:e.password,database:e.database,timezone:r,typeCast:t._typecast.bind(this),bigNumberStrings:!1,supportBigNumbers:!0,foundRows:!1},e.dialectOptions);this.sequelize.config.keepDefaultTimezone||(n.initSql?(Array.isArray(n.initSql)||(n.initSql=[n.initSql]),n.initSql.push(`SET time_zone = '${r}'`)):n.initSql=`SET time_zone = '${r}'`);try{let i=await this.lib.createConnection(n);return this.sequelize.options.databaseVersion=iVt.coerce(i.serverVersion()).version,_qe("connection acquired"),i.on("error",a=>{switch(a.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 AM.ConnectionRefusedError(i);case"ER_ACCESS_DENIED_ERROR":case"ER_ACCESS_DENIED_NO_PASSWORD_ERROR":throw new AM.AccessDeniedError(i);case"ENOTFOUND":throw new AM.HostNotFoundError(i);case"EHOSTUNREACH":case"ENETUNREACH":case"EADDRNOTAVAIL":throw new AM.HostNotReachableError(i);case"EINVAL":throw new AM.InvalidConnectionError(i);default:throw new AM.ConnectionError(i)}}}async disconnect(e){if(!e.isValid()){_qe("connection tried to disconnect but was already at CLOSED state");return}return await e.end()}validate(e){return e&&e.isValid()}};rS.exports=Zg;rS.exports.ConnectionManager=Zg;rS.exports.default=Zg});var lu=A((fzr,nS)=>{"use strict";var uVt=Object.defineProperty,Eqe=Object.getOwnPropertySymbols,lVt=Object.prototype.hasOwnProperty,pVt=Object.prototype.propertyIsEnumerable,zqe=(t,e,r)=>e in t?uVt(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,fVt=(t,e)=>{for(var r in e||(e={}))lVt.call(e,r)&&zqe(t,r,e[r]);if(Eqe)for(var r of Eqe(e))pVt.call(e,r)&&zqe(t,r,e[r]);return t},cp=it(),dVt=zg(),ma=Pi(),bVt=wg(),hVt=dM(),MVt=(oM(),xc(sM)).v4,{safeStringifyJson:gqe}=G0(),ey=class t{constructor(e,r,n){this.uuid=MVt(),this.connection=e,this.instance=n.instance,this.model=n.model,this.sequelize=r,this.options=fVt({plain:!1,raw:!1,logging:console.log},n),this.checkLoggingOption(),n.rawErrors&&(this.formatError=t.prototype.formatError)}static formatBindParameters(e,r,n,i,a){if(!r)return[e,[]];if(a=a||{},typeof i!="function"&&(a=i||{},i=void 0),!i)a.skipValueReplace?i=(u,l,p)=>{if(p[l]!==void 0)return u}:i=(u,l,p,f,b)=>{if(p[l]!==void 0)return dVt.escape(p[l],f,b)};else if(a.skipValueReplace){let u=i;i=(l,p,f,b,O,M)=>{if(u(l,p,f,b,O,M)!==void 0)return l}}let s=null,o=Array.isArray(r);return e=e.replace(/\B\$(\$|\w+)/g,(u,l)=>{if(l==="$")return a.skipUnescape?u:l;let p;if(o?l.match(/^[1-9]\d*$/)&&(l=l-1,p=i(u,l,r,s,n,a)):l.match(/^\d*$/)||(p=i(u,l,r,s,n,a)),p===void 0)throw new Error(`Named bind parameter "${u}" has no value in the given object.`);return p}),[e,[]]}formatError(e,r){return e.stack=r,e}run(){throw new Error("The run method wasn't overwritten!")}checkLoggingOption(){this.options.logging===!0&&(hVt.noTrueLogging(),this.options.logging=console.log)}getInsertIdField(){return"insertId"}getUniqueConstraintErrorMessage(e){let r=e?`${e} must be unique`:"Must be unique";if(e&&this.model)for(let n of Object.keys(this.model.uniqueKeys))this.model.uniqueKeys[n].fields.includes(e.replace(/"/g,""))&&this.model.uniqueKeys[n].msg&&(r=this.model.uniqueKeys[n].msg);return r}isRawQuery(){return this.options.type===ma.RAW}isVersionQuery(){return this.options.type===ma.VERSION}isUpsertQuery(){return this.options.type===ma.UPSERT}isInsertQuery(e,r){let n=!0;return this.options.type===ma.INSERT?!0:(n=n&&this.sql.toLowerCase().startsWith("insert into"),n=n&&(!e||Object.prototype.hasOwnProperty.call(e,this.getInsertIdField())),n=n&&(!r||Object.prototype.hasOwnProperty.call(r,this.getInsertIdField())),n)}handleInsertQuery(e,r){if(this.instance){let n=this.model.autoIncrementAttribute,i=null;i=i||e&&e[this.getInsertIdField()],i=i||r&&r[this.getInsertIdField()],this.instance[n]=i}}isShowTablesQuery(){return this.options.type===ma.SHOWTABLES}handleShowTablesQuery(e){return cp.flatten(e.map(r=>Object.values(r)))}isShowIndexesQuery(){return this.options.type===ma.SHOWINDEXES}isShowConstraintsQuery(){return this.options.type===ma.SHOWCONSTRAINTS}isDescribeQuery(){return this.options.type===ma.DESCRIBE}isSelectQuery(){return this.options.type===ma.SELECT}isBulkUpdateQuery(){return this.options.type===ma.BULKUPDATE}isBulkDeleteQuery(){return this.options.type===ma.BULKDELETE}isForeignKeysQuery(){return this.options.type===ma.FOREIGNKEYS}isUpdateQuery(){return this.options.type===ma.UPDATE}handleSelectQuery(e){let r=null;if(this.options.fieldMap){let n=this.options.fieldMap;e=e.map(i=>cp.reduce(n,(a,s,o)=>(a[o]!==void 0&&s!==o&&(a[s]=a[o],delete a[o]),a),i))}return this.options.raw?r=e.map(n=>{let i={};for(let a in n)Object.prototype.hasOwnProperty.call(n,a)&&(i[a]=n[a]);return this.options.nest&&(i=bVt.transform(i)),i}):this.options.hasJoin===!0?(e=t._groupJoinData(e,{model:this.model,includeMap:this.options.includeMap,includeNames:this.options.includeNames},{checkExisting:this.options.hasMultiAssociation}),r=this.model.bulkBuild(e,{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})):r=this.model.bulkBuild(e,{isNewRecord:!1,raw:!0,attributes:this.options.originalAttributes||this.options.attributes}),this.options.plain&&(r=r.length===0?null:r[0]),r}isShowOrDescribeQuery(){let e=!1;return e=e||this.sql.toLowerCase().startsWith("show"),e=e||this.sql.toLowerCase().startsWith("describe"),e}isCallQuery(){return this.sql.toLowerCase().startsWith("call")}_logQuery(e,r,n){let{connection:i,options:a}=this,s=this.sequelize.options.benchmark||a.benchmark,o=this.sequelize.options.logQueryParameters||a.logQueryParameters,u=Date.now(),l="";if(o&&n){let b=e.endsWith(";")?"":";",O;Array.isArray(n)?O=n.map(M=>gqe(M)).join(", "):O=gqe(n),l=`${b} ${O}`}let p=`(${i.uuid||"default"}): ${e}${l}`,f=`Executing ${p}`;return r(f),s||this.sequelize.log(`Executing ${p}`,a),()=>{let b=`Executed ${p}`;r(b),s&&this.sequelize.log(b,Date.now()-u,a)}}static _groupJoinData(e,r,n){if(!e.length)return[];let i,a,s,o,u,l,p=e.length,f,b,O,M,m,z,y,R,w=n.checkExisting,q,C,L,j=w?[]:new Array(p),I={},U={},Y,S,te,V,D,P,F,re,ee=Q=>{Object.prototype.hasOwnProperty.call(P.includeMap,Q)&&(U[b]=P=P.includeMap[Q],re?re=`${re}.${Q}`:re=Q,U[re]=P)},Ae={},ge=(Q,ae)=>(Object.prototype.hasOwnProperty.call(ae,Q)||(ae[Q]=Q.substr(0,Q.lastIndexOf("."))),ae[Q]),we={},Qe=Q=>{if(!Object.prototype.hasOwnProperty.call(we,Q)){let ae=Q.lastIndexOf(".");we[Q]=Q.substr(ae===-1?0:ae+1)}return we[Q]},de={},tt=Q=>{if(!Object.prototype.hasOwnProperty.call(de,Q)){let ae=ge(Q,Ae);Object.prototype.hasOwnProperty.call(de,ae)||(de[ae]=ae?ae.split("."):[]),de[Q]=de[ae]}return de[Q]},je={},Ee=Q=>{if(!Object.prototype.hasOwnProperty.call(je,Q)){let ae=tt(Q),le=ae.length;je[Q]=le?ae[le-1]:""}return je[Q]},Ze=Q=>{let ae=cp.chain(Q.uniqueKeys);return ae=ae.result(`${ae.findKey()}.fields`).map(le=>cp.findKey(Q.attributes,Oe=>Oe.field===le)).value(),ae},Ke=Q=>Q instanceof Buffer?Q.toString("hex"):Q,_e,We,oe;for(u=0;u<p;u++){if(l=e[u],u===0&&(f=cp.sortBy(Object.keys(l),Q=>[Q.split(".").length]),M=f.length),w){if(R=!1,o=r.model.primaryKeyAttributes.length,L="",o===1)L=Ke(l[r.model.primaryKeyAttributes[0]]);else if(o>1)for(s=0;s<o;s++)L+=Ke(l[r.model.primaryKeyAttributes[s]]);else if(!cp.isEmpty(r.model.uniqueKeys))for(We=Ze(r.model),s=0;s<We.length;s++)L+=l[We[s]]}for(y=z={},V=void 0,O=0;O<M;O++){if(b=f[O],S=ge(b,Ae),Y=tt(b),u===0&&!Object.prototype.hasOwnProperty.call(U,b)&&(Y.length?(P=r,re=void 0,Y.forEach(ee)):U[b]=U[""]=r),V!==void 0&&V!==Y){if(w){if(a=V.length,F=null,C=null,a)for(i=0;i<a;i++){if(oe=F?`${F}.${V[i]}`:V[i],_e=U[oe].model.primaryKeyAttributes,o=_e.length,q=oe,o===1)q+=Ke(l[`${oe}.${_e[0]}`]);else if(o>1)for(s=0;s<o;s++)q+=Ke(l[`${oe}.${_e[s]}`]);else if(!cp.isEmpty(U[oe].model.uniqueKeys))for(We=Ze(U[oe].model),s=0;s<We.length;s++)q+=l[`${oe}.${We[s]}`];C||(C=L),q=C+q,F=oe,i<a-1&&(C=q)}else q=L;q===L?I[q]?R=!0:I[q]=z:I[q]||(F=I[C],D=Ee(m),U[m].association.isSingleAssociation?F&&(F[D]=I[q]=z):(F[D]||(F[D]=[]),F[D].push(I[q]=z))),z={}}else if(P=y,a=Y.length,a)for(i=0;i<a;i++)i===a-1&&(z=P[Y[i]]={}),P=P[Y[i]]||{}}z[Qe(b)]=l[b],m=b,V=Y,te=S}if(w){if(a=V.length,F=null,C=null,a)for(i=0;i<a;i++){if(oe=F?`${F}.${V[i]}`:V[i],_e=U[oe].model.primaryKeyAttributes,o=_e.length,q=oe,o===1)q+=Ke(l[`${oe}.${_e[0]}`]);else if(o>0)for(s=0;s<o;s++)q+=Ke(l[`${oe}.${_e[s]}`]);else if(!cp.isEmpty(U[oe].model.uniqueKeys))for(We=Ze(U[oe].model),s=0;s<We.length;s++)q+=l[`${oe}.${We[s]}`];C||(C=L),q=C+q,F=oe,i<a-1&&(C=q)}else q=L;q===L?I[q]?R=!0:I[q]=z:I[q]||(F=I[C],D=Ee(m),U[m].association.isSingleAssociation?F&&(F[D]=I[q]=z):(F[D]||(F[D]=[]),F[D].push(I[q]=z))),R||j.push(y)}else j[u]=y}return j}};nS.exports=ey;nS.exports.AbstractQuery=ey;nS.exports.default=ey});var Iqe=A((dzr,vqe)=>{"use strict";var OVt=Object.defineProperty,yqe=Object.getOwnPropertySymbols,AVt=Object.prototype.hasOwnProperty,_Vt=Object.prototype.propertyIsEnumerable,Rqe=(t,e,r)=>e in t?OVt(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,mVt=(t,e)=>{for(var r in e||(e={}))AVt.call(e,r)&&Rqe(t,r,e[r]);if(yqe)for(var r of yqe(e))_Vt.call(e,r)&&Rqe(t,r,e[r]);return t},Nqe=lu(),iS=v0(),Tqe=it(),gH=R0(),{logger:EVt}=Gr(),zVt=1062,gVt=1213,wqe=1451,yVt=1452,qqe=EVt.debugContext("sql:mariadb"),yH=class extends Nqe{constructor(e,r,n){super(e,r,mVt({showWarnings:!1},n))}static formatBindParameters(e,r,n){let i=[],a=(s,o,u)=>{if(u[o]!==void 0)return i.push(u[o]),"?"};return e=Nqe.formatBindParameters(e,r,n,a)[0],[e,i.length>0?i:void 0]}async run(e,r){this.sql=e;let{connection:n,options:i}=this,a=this.sequelize.options.showWarnings||i.showWarnings,s=this._logQuery(e,qqe,r);r&&qqe("parameters(%j)",r);let o,u=new Error;try{o=await n.query(this.sql,r)}catch(l){if(i.transaction&&l.errno===gVt){try{await i.transaction.rollback()}catch{}i.transaction.finished="rollback"}throw l.sql=e,l.parameters=r,this.formatError(l,u.stack)}finally{s()}return a&&o&&o.warningStatus>0&&await this.logWarnings(o),this.formatResults(o)}formatResults(e){let r=this.instance;if(this.isBulkUpdateQuery()||this.isBulkDeleteQuery())return e.affectedRows;if(this.isUpsertQuery())return[r,e.affectedRows===1];if(this.isInsertQuery(e)&&(this.handleInsertQuery(e),!this.instance)){if(this.model&&this.model.autoIncrementAttribute&&this.model.autoIncrementAttribute===this.model.primaryKeyAttribute&&this.model.rawAttributes[this.model.primaryKeyAttribute]){let n=e[this.getInsertIdField()];r=new Array(e.affectedRows);let i=this.model.rawAttributes[this.model.primaryKeyAttribute].field;for(let a=0;a<e.affectedRows;a++)r[a]={[i]:n+a};return[r,e.affectedRows]}return[e[this.getInsertIdField()],e.affectedRows]}if(this.isSelectQuery())return this.handleJsonSelectQuery(e),this.handleSelectQuery(e);if(this.isInsertQuery()||this.isUpdateQuery())return[r,e.affectedRows];if(this.isCallQuery())return e[0];if(this.isRawQuery()){let n=e.meta;return delete e.meta,[e,n]}if(this.isShowIndexesQuery())return this.handleShowIndexesQuery(e);if(this.isForeignKeysQuery()||this.isShowConstraintsQuery())return e;if(this.isShowTablesQuery())return this.handleShowTablesQuery(e);if(this.isDescribeQuery()){r={};for(let n of e)r[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 r}return this.isVersionQuery()?e[0].version:r}handleJsonSelectQuery(e){if(!(!this.model||!this.model.fieldRawAttributesMap))for(let r of Object.keys(this.model.fieldRawAttributesMap)){let n=this.model.fieldRawAttributesMap[r];n.type instanceof gH.JSON&&(e=e.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])),gH.JSON.parse?gH.JSON.parse(n,this.sequelize.options,i[n.fieldName]):i)))}}async logWarnings(e){let r=await this.run("SHOW WARNINGS"),n=`MariaDB Warnings (${this.connection.uuid||"default"}): `,i=[];for(let a of r)if(!(a===void 0||typeof a[Symbol.iterator]!="function"))for(let s of a)if(Object.prototype.hasOwnProperty.call(s,"Message"))i.push(s.Message);else for(let o of s.keys())i.push([o,s[o]].join(": "));return this.sequelize.log(n+i.join("; "),this.options),e}formatError(e,r){switch(e.errno){case zVt:{let n=e.message.match(/Duplicate entry '([\s\S]*)' for key '?((.|\s)*?)'?\s.*$/),i={},a="Validation error",s=n?n[1].split("-"):void 0,o=n?n[2]:void 0,u=n?n[1]:void 0,l=this.model&&this.model.uniqueKeys[o];l?(l.msg&&(a=l.msg),i=Tqe.zipObject(l.fields,s)):i[o]=u;let p=[];return Tqe.forOwn(i,(f,b)=>{p.push(new iS.ValidationErrorItem(this.getUniqueConstraintErrorMessage(b),"unique violation",b,f,this.instance,"not_unique"))}),new iS.UniqueConstraintError({message:a,errors:p,parent:e,fields:i,stack:r})}case wqe:case yVt:{let n=e.message.match(/CONSTRAINT ([`"])(.*)\1 FOREIGN KEY \(\1(.*)\1\) REFERENCES \1(.*)\1 \(\1(.*)\1\)/),i=n?n[1]:"`",a=n?n[3].split(new RegExp(`${i}, *${i}`)):void 0;return new iS.ForeignKeyConstraintError({reltype:e.errno===wqe?"parent":"child",table:n?n[4]:void 0,fields:a,value:a&&a.length&&this.instance&&this.instance[a[0]]||void 0,index:n?n[2]:void 0,parent:e,stack:r})}default:return new iS.DatabaseError(e,{stack:r})}}handleShowTablesQuery(e){return e.map(r=>({tableName:r.TABLE_NAME,schema:r.TABLE_SCHEMA}))}handleShowIndexesQuery(e){let r,n=[];return e.forEach(i=>{(!r||r.name!==i.Key_name)&&(r={primary:i.Key_name==="PRIMARY",fields:[],name:i.Key_name,tableName:i.Table,unique:i.Non_unique!==1,type:i.Index_type},n.push(r)),r.fields[i.Seq_in_index-1]={attribute:i.Column_name,length:i.Sub_part||void 0,order:i.Collation==="A"?"ASC":void 0}}),n}};vqe.exports=yH});var Dqe=A((bzr,Cqe)=>{"use strict";var RVt=Object.defineProperty,Sqe=Object.getOwnPropertySymbols,NVt=Object.prototype.hasOwnProperty,TVt=Object.prototype.propertyIsEnumerable,Lqe=(t,e,r)=>e in t?RVt(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,wVt=(t,e)=>{for(var r in e||(e={}))NVt.call(e,r)&&Lqe(t,r,e[r]);if(Sqe)for(var r of Sqe(e))TVt.call(e,r)&&Lqe(t,r,e[r]);return t},aS=it(),Pt=zn(),qVt=G0(),vVt={OperatorMap:{[Pt.eq]:"=",[Pt.ne]:"!=",[Pt.gte]:">=",[Pt.gt]:">",[Pt.lte]:"<=",[Pt.lt]:"<",[Pt.not]:"IS NOT",[Pt.is]:"IS",[Pt.in]:"IN",[Pt.notIn]:"NOT IN",[Pt.like]:"LIKE",[Pt.notLike]:"NOT LIKE",[Pt.iLike]:"ILIKE",[Pt.notILike]:"NOT ILIKE",[Pt.startsWith]:"LIKE",[Pt.endsWith]:"LIKE",[Pt.substring]:"LIKE",[Pt.regexp]:"~",[Pt.notRegexp]:"!~",[Pt.iRegexp]:"~*",[Pt.notIRegexp]:"!~*",[Pt.between]:"BETWEEN",[Pt.notBetween]:"NOT BETWEEN",[Pt.overlap]:"&&",[Pt.contains]:"@>",[Pt.contained]:"<@",[Pt.adjacent]:"-|-",[Pt.strictLeft]:"<<",[Pt.strictRight]:">>",[Pt.noExtendRight]:"&<",[Pt.noExtendLeft]:"&>",[Pt.any]:"ANY",[Pt.all]:"ALL",[Pt.and]:" AND ",[Pt.or]:" OR ",[Pt.col]:"COL",[Pt.placeholder]:"$$PLACEHOLDER$$",[Pt.match]:"@@"},OperatorsAliasMap:{},setOperatorsAliases(t){!t||aS.isEmpty(t)?this.OperatorsAliasMap=!1:this.OperatorsAliasMap=wVt({},t)},_replaceAliases(t){let e={};return this.OperatorsAliasMap?(qVt.getOperators(t).forEach(r=>{let n=t[r];aS.isPlainObject(n)?e[r]=this._replaceAliases(n):e[r]=n}),aS.forOwn(t,(r,n)=>{n=this.OperatorsAliasMap[n]||n,aS.isPlainObject(r)&&(r=this._replaceAliases(r)),e[n]=r}),e):t}};Cqe.exports=vVt});var xqe=A((hzr,Bqe)=>{"use strict";var IVt=(oM(),xc(sM)).v4,SVt={setIsolationLevelQuery(t,e){if(!e.parent)return`SET TRANSACTION ISOLATION LEVEL ${t};`},generateTransactionId(){return IVt()},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;"}};Bqe.exports=SVt});var up=A((Ozr,Fqe)=>{"use strict";var LVt=Object.defineProperty,CVt=Object.defineProperties,DVt=Object.getOwnPropertyDescriptors,Wqe=Object.getOwnPropertySymbols,BVt=Object.prototype.hasOwnProperty,xVt=Object.prototype.propertyIsEnumerable,Pqe=(t,e,r)=>e in t?LVt(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Dd=(t,e)=>{for(var r in e||(e={}))BVt.call(e,r)&&Pqe(t,r,e[r]);if(Wqe)for(var r of Wqe(e))xVt.call(e,r)&&Pqe(t,r,e[r]);return t},sS=(t,e)=>CVt(t,DVt(e)),oS=require("util"),Ct=it(),WVt=(oM(),xc(sM)).v4,Ge=G0(),Mzr=dM(),kqe=zg(),_M=R0(),$s=xV(),mM=np(),RH=ip(),PVt=lM(),kVt=qd(),Ce=zn(),NH=v0(),Uqe=HV(),ty=class{constructor(e){if(!e.sequelize)throw new Error("QueryGenerator initialized without options.sequelize");if(!e._dialect)throw new Error("QueryGenerator initialized without options._dialect");this.sequelize=e.sequelize,this.options=e.sequelize.options,this.dialect=e._dialect.name,this._dialect=e._dialect,this._initQuoteIdentifier()}extractTableDetails(e,r){return r=r||{},e=e||{},{schema:e.schema||r.schema||this.options.schema||"public",tableName:Ct.isPlainObject(e)?e.tableName:e,delimiter:e.delimiter||r.delimiter||"."}}addSchema(e){if(!e._schema)return e.tableName||e;let r=this;return{tableName:e.tableName||e,table:e.tableName||e,name:e.name||e,schema:e._schema,delimiter:e._schemaDelimiter||".",toString(){return r.quoteTable(this)}}}dropSchema(e,r){return this.dropTableQuery(e,r)}describeTableQuery(e,r,n){return`DESCRIBE ${this.quoteTable(this.addSchema({tableName:e,_schema:r,_schemaDelimiter:n}))};`}dropTableQuery(e){return`DROP TABLE IF EXISTS ${this.quoteTable(e)};`}renameTableQuery(e,r){return`ALTER TABLE ${this.quoteTable(e)} RENAME TO ${this.quoteTable(r)};`}populateInsertQueryReturnIntoBinds(){}insertQuery(e,r,n,i){i=i||{},Ct.defaults(i,this.options);let a={},s=i.bind||[],o=[],u=[],l=[],p=[],f=this.quoteTable(e),b=i.bindParam===void 0?this.bindParam(s):i.bindParam,O=[],M,m="",z="",y="",R="",w=!1,q="";if(n&&Ct.each(n,(I,U)=>{a[U]=I,I.field&&(a[I.field]=I)}),this._dialect.supports["DEFAULT VALUES"]?z+=" DEFAULT VALUES":this._dialect.supports["VALUES ()"]&&(z+=" VALUES ()"),(this._dialect.supports.returnValues||this._dialect.supports.returnIntoValues)&&i.returning){let I=this.generateReturnValues(n,i);u.push(...I.returnFields),this._dialect.supports.returnIntoValues&&l.push(...I.returnTypes),R=I.returningFragment,q=I.tmpTable||"",y=I.outputFragment||""}(Ct.get(this,["sequelize","options","dialectOptions","prependSearchPath"])||i.searchPath)&&(i.bindParam=!1),this._dialect.supports.EXCEPTION&&i.exception&&(i.bindParam=!1),r=Ge.removeNullValuesFromHash(r,this.options.omitNull);for(let I in r)if(Object.prototype.hasOwnProperty.call(r,I)){let U=r[I];o.push(this.quoteIdentifier(I)),a&&a[I]&&a[I].autoIncrement===!0&&U==null?this._dialect.supports.autoIncrement.defaultValue?this._dialect.supports.DEFAULT?p.push("DEFAULT"):p.push(this.escape(null)):o.splice(-1,1):(a&&a[I]&&a[I].autoIncrement===!0&&(w=!0),U instanceof Ge.SequelizeMethod||i.bindParam===!1?p.push(this.escape(U,a&&a[I]||void 0,{context:"INSERT"})):p.push(this.format(U,a&&a[I]||void 0,{context:"INSERT"},b)))}let C="";if(!Ct.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 I=i.upsertKeys.map(S=>this.quoteIdentifier(S)),U=i.updateOnDuplicate.map(S=>`${this.quoteIdentifier(S)}=EXCLUDED.${this.quoteIdentifier(S)}`),Y=["ON CONFLICT","(",I.join(","),")"];Ct.isEmpty(i.conflictWhere)||Y.push(this.whereQuery(i.conflictWhere,i)),Ct.isEmpty(U)?Y.push("DO NOTHING"):Y.push("DO UPDATE SET",U.join(",")),C=` ${Ge.joinSQLFragments(Y)}`}else{let I=i.updateOnDuplicate.map(U=>`${this.quoteIdentifier(U)}=VALUES(${this.quoteIdentifier(U)})`);if(Ct.isEmpty(I)&&i.upsertKeys&&I.push(...i.upsertKeys.map(U=>`${this.quoteIdentifier(U)}=${this.quoteIdentifier(U)}`)),Ct.isEmpty(I))throw new Error("No update values found for ON DUPLICATE KEY UPDATE clause, and no identifier fields could be found to use instead.");C+=`${this._dialect.supports.inserts.updateOnDuplicate} ${I.join(",")}`}let L={ignoreDuplicates:i.ignoreDuplicates?this._dialect.supports.inserts.ignoreDuplicates:"",onConflictDoNothing:i.ignoreDuplicates?this._dialect.supports.inserts.onConflictDoNothing:"",attributes:o.join(","),output:y,values:p.join(","),tmpTable:q};if(m=`${q}INSERT${L.ignoreDuplicates} INTO ${f} (${L.attributes})${L.output} VALUES (${L.values})${C}${L.onConflictDoNothing}${m}`,z=`${q}INSERT${L.ignoreDuplicates} INTO ${f}${L.output}${C}${L.onConflictDoNothing}${z}`,this._dialect.supports.EXCEPTION&&i.exception){let I="DROP FUNCTION IF EXISTS pg_temp.testfunc()";u.length===0&&u.push("*");let U=`$func_${WVt().replace(/-/g,"")}$`,Y=`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;",m=`CREATE OR REPLACE FUNCTION pg_temp.testfunc(OUT response ${f}, OUT sequelize_caught_exception text) RETURNS RECORD AS ${U} BEGIN ${m} RETURNING * INTO response; EXCEPTION ${i.exception} END ${U} LANGUAGE plpgsql; ${Y} ${I}`}else m+=R,z+=R;this._dialect.supports.returnIntoValues&&i.returning&&this.populateInsertQueryReturnIntoBinds(u,l,s.length,O,i),M=`${L.attributes.length?m:z}${O.join(",")};`,this._dialect.supports.finalTable&&(M=`SELECT * FROM FINAL TABLE(${L.attributes.length?m:z});`),w&&this._dialect.supports.autoIncrement.identityInsert&&(M=`SET IDENTITY_INSERT ${f} ON; ${M} SET IDENTITY_INSERT ${f} OFF;`);let j={query:M};return i.bindParam!==!1&&(j.bind=s),j}bulkInsertQuery(e,r,n,i){n=n||{},i=i||{};let a=[],s={},o=[],u="";for(let O of r)Ct.forOwn(O,(M,m)=>{o.includes(m)||o.push(m),i[m]&&i[m].autoIncrement===!0&&(s[m]=!0)});for(let O of r){let M=o.map(m=>this._dialect.supports.bulkDefault&&s[m]===!0?O[m]!=null?O[m]:"DEFAULT":this.escape(O[m],i[m],{context:"INSERT"}));a.push(`(${M.join(",")})`)}if(this._dialect.supports.inserts.updateOnDuplicate&&n.updateOnDuplicate)if(this._dialect.supports.inserts.updateOnDuplicate==" ON CONFLICT DO UPDATE SET"){let O=n.upsertKeys.map(z=>this.quoteIdentifier(z)),M=n.updateOnDuplicate.map(z=>`${this.quoteIdentifier(z)}=EXCLUDED.${this.quoteIdentifier(z)}`),m=!1;if(n.conflictWhere){if(!this._dialect.supports.inserts.onConflictWhere)throw new Error(`conflictWhere not supported for dialect ${this._dialect.name}`);m=this.whereQuery(n.conflictWhere,n)}u=["ON CONFLICT","(",O.join(","),")",m,"DO UPDATE SET",M.join(",")]}else{if(n.conflictWhere)throw new Error(`conflictWhere not supported for dialect ${this._dialect.name}`);let O=n.updateOnDuplicate.map(M=>`${this.quoteIdentifier(M)}=VALUES(${this.quoteIdentifier(M)})`);u=`${this._dialect.supports.inserts.updateOnDuplicate} ${O.join(",")}`}let l=n.ignoreDuplicates?this._dialect.supports.inserts.ignoreDuplicates:"",p=o.map(O=>this.quoteIdentifier(O)).join(","),f=n.ignoreDuplicates?this._dialect.supports.inserts.onConflictDoNothing:"",b="";if(this._dialect.supports.returnValues&&n.returning){let O=this.generateReturnValues(i,n);b+=O.returningFragment}return Ge.joinSQLFragments(["INSERT",l,"INTO",this.quoteTable(e),`(${p})`,"VALUES",a.join(","),u,f,b,";"])}updateQuery(e,r,n,i,a){i=i||{},Ct.defaults(i,this.options),r=Ge.removeNullValuesFromHash(r,i.omitNull,i);let s=[],o=[],u={},l="",p="",f="";(Ct.get(this,["sequelize","options","dialectOptions","prependSearchPath"])||i.searchPath)&&(i.bindParam=!1);let b=i.bindParam===void 0?this.bindParam(o):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)?f+=" AND ":f+=" WHERE ",f+=`rownum <= ${this.escape(i.limit)} `):f=` LIMIT ${this.escape(i.limit)} `),this._dialect.supports.returnValues&&i.returning){let z=this.generateReturnValues(a,i);f+=z.returningFragment,p=z.tmpTable||"",l=z.outputFragment||"",!this._dialect.supports.returnValues.output&&i.returning&&(i.mapToModel=!0)}a&&Ct.each(a,(z,y)=>{u[y]=z,z.field&&(u[z.field]=z)});for(let z in r){if(u&&u[z]&&u[z].autoIncrement===!0&&!this._dialect.supports.autoIncrement.update)continue;let y=r[z];y instanceof Ge.SequelizeMethod||i.bindParam===!1?s.push(`${this.quoteIdentifier(z)}=${this.escape(y,u&&u[z]||void 0,{context:"UPDATE"})}`):s.push(`${this.quoteIdentifier(z)}=${this.format(y,u&&u[z]||void 0,{context:"UPDATE"},b)}`)}let O=sS(Dd({},i),{bindParam:b});if(s.length===0)return"";let m={query:`${p}UPDATE ${this.quoteTable(e)} SET ${s.join(",")}${l} ${this.whereQuery(n,O)}${f}`.trim()};return i.bindParam!==!1&&(m.bind=o),m}arithmeticQuery(e,r,n,i,a,s){s=s||{},Ct.defaults(s,{returning:!0}),a=Ge.removeNullValuesFromHash(a,this.options.omitNull);let o="",u="";if(this._dialect.supports.returnValues&&s.returning){let p=this.generateReturnValues(null,s);o=p.outputFragment,u=p.returningFragment}let l=[];for(let p in i){let f=i[p],b=this.quoteIdentifier(p),O=this.escape(f);l.push(`${b}=${b}${e} ${O}`)}for(let p in a){let f=a[p],b=this.quoteIdentifier(p),O=this.escape(f);l.push(`${b}=${O}`)}return Ge.joinSQLFragments(["UPDATE",this.quoteTable(r),"SET",l.join(","),o,this.whereQuery(n),u])}addIndexQuery(e,r,n,i){n=n||{},Array.isArray(r)?n.fields=r:(n=r,r=void 0),n.prefix=n.prefix||i||e,n.prefix&&typeof n.prefix=="string"&&(n.prefix=n.prefix.replace(/\./g,"_"),n.prefix=n.prefix.replace(/("|')/g,""));let a=n.fields.map(u=>{if(u instanceof Ge.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: ${oS.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 p=u.operator||n.operator;p&&(l+=` ${p}`)}return this._dialect.supports.index.length&&u.length&&(l+=`(${u.length})`),u.order&&(l+=` ${u.order}`),l});n.name||(n=Ge.nameIndex(n,n.prefix)),n=$s._conformIndex(n),this._dialect.supports.index.type||delete n.type,n.where&&(n.where=this.whereQuery(n.where)),typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e);let s=this._dialect.supports.index.concurrently&&n.concurrently?"CONCURRENTLY":void 0,o;return this._dialect.supports.indexViaAlter?o=["ALTER TABLE",e,s,"ADD"]:o=["CREATE"],o=o.concat(n.unique?"UNIQUE":"",n.type,"INDEX",this._dialect.supports.indexViaAlter?void 0:s,this.quoteIdentifiers(n.name),this._dialect.supports.index.using===1&&n.using?`USING ${n.using}`:"",this._dialect.supports.indexViaAlter?void 0:`ON ${e}`,this._dialect.supports.index.using===2&&n.using?`USING ${n.using}`:"",`(${a.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),Ct.compact(o).join(" ")}addConstraintQuery(e,r){return typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e),Ge.joinSQLFragments(["ALTER TABLE",e,"ADD",this.getConstraintSnippet(e,r||{}),";"])}getConstraintSnippet(e,r){let n,i,a=r.fields.map(u=>{if(typeof u=="string")return this.quoteIdentifier(u);if(u instanceof Ge.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)}),s=a.join(", "),o=a.join("_");switch(r.type.toUpperCase()){case"UNIQUE":i=this.quoteIdentifier(r.name||`${e}_${o}_uk`),n=`CONSTRAINT ${i} UNIQUE (${s})`;break;case"CHECK":r.where=this.whereItemsQuery(r.where),i=this.quoteIdentifier(r.name||`${e}_${o}_ck`),n=`CONSTRAINT ${i} CHECK (${r.where})`;break;case"DEFAULT":if(r.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(r.name||`${e}_${o}_df`),n=`CONSTRAINT ${i} DEFAULT (${this.escape(r.defaultValue)}) FOR ${a[0]}`;break;case"PRIMARY KEY":i=this.quoteIdentifier(r.name||`${e}_${o}_pk`),n=`CONSTRAINT ${i} PRIMARY KEY (${s})`;break;case"FOREIGN KEY":let u=r.references;if(!u||!u.table||!(u.field||u.fields))throw new Error("references object with table and field must be specified");i=this.quoteIdentifier(r.name||`${e}_${o}_${u.table}_fk`);let l=typeof u.field<"u"?this.quoteIdentifier(u.field):u.fields.map(f=>this.quoteIdentifier(f)).join(", "),p=`${this.quoteTable(u.table)} (${l})`;n=`CONSTRAINT ${i} `,n+=`FOREIGN KEY (${s}) REFERENCES ${p}`,r.onUpdate&&(n+=` ON UPDATE ${r.onUpdate.toUpperCase()}`),r.onDelete&&(n+=` ON DELETE ${r.onDelete.toUpperCase()}`);break;default:throw new Error(`${r.type} is invalid.`)}return r.deferrable&&["UNIQUE","PRIMARY KEY","FOREIGN KEY"].includes(r.type.toUpperCase())&&(n+=` ${this.deferConstraintsQuery(r)}`),n}removeConstraintQuery(e,r){return typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e),Ge.joinSQLFragments(["ALTER TABLE",e,"DROP CONSTRAINT",this.quoteIdentifiers(r)])}quote(e,r,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 e=="string")return this.quoteIdentifiers(e);if(Array.isArray(e)){e.forEach((p,f)=>{let b=e[f-1],O,M;if(!b&&r!==void 0?M=r:b&&b instanceof mM&&(O=b,M=b.target),M&&M.prototype instanceof $s){let m,z;if(typeof p=="function"&&p.prototype instanceof $s?m=p:Ct.isPlainObject(p)&&p.model&&p.model.prototype instanceof $s&&(m=p.model,z=p.as),m&&(!z&&O&&O instanceof mM&&O.through&&O.through.model===m?p=new mM(M,m,{as:m.name}):(p=M.getAssociationForAlias(m,z),p||(p=M.getAssociationForAlias(m,m.name))),!(p instanceof mM)))throw new Error(oS.format("Unable to find a valid association for model, '%s'",m.name))}if(typeof p=="string"){let m=i.indexOf(p.toUpperCase());if(f>0&&m!==-1)p=this.sequelize.literal(` ${i[m]}`);else if(M&&M.prototype instanceof $s){if(M.associations!==void 0&&M.associations[p])p=M.associations[p];else if(M.rawAttributes!==void 0&&M.rawAttributes[p]&&p!==M.rawAttributes[p].field)p=M.rawAttributes[p].field;else if(p.includes(".")&&M.rawAttributes!==void 0){let z=p.split(".");if(M.rawAttributes[z[0]].type instanceof _M.JSON){let y=this.quoteIdentifiers(`${M.name}.${M.rawAttributes[z[0]].field}`),R=z.slice(1);p=this.jsonPathExtractionQuery(y,R),p=this.sequelize.literal(p)}}}}e[f]=p},this);let a=e.length,s=[],o,u=0;for(u=0;u<a-1&&(o=e[u],!(typeof o=="string"||o._modelAttribute||o instanceof Ge.SequelizeMethod));u++)o instanceof mM&&(s[u]=o.as);let l="";return u>0?l+=`${this.quoteIdentifier(s.join(n))}.`:typeof e[0]=="string"&&r&&(l+=`${this.quoteIdentifier(r.name)}.`),e.slice(u).forEach(p=>{l+=this.quote(p,r,n)},this),l}if(e._modelAttribute)return`${this.quoteTable(e.Model.name)}.${this.quoteIdentifier(e.fieldName)}`;if(e instanceof Ge.SequelizeMethod)return this.handleSequelizeMethod(e);throw Ct.isPlainObject(e)&&e.raw?new Error('The `{raw: "..."}` syntax is no longer supported.  Use `sequelize.literal` instead.'):new Error(`Unknown structure passed to order / group: ${oS.inspect(e)}`)}_initQuoteIdentifier(){this._quoteIdentifier=this.quoteIdentifier,this.quoteIdentifier=function(e,r){return e==="*"?e:this._quoteIdentifier(e,r)}}quoteIdentifier(e,r){throw new Error(`quoteIdentifier for Dialect "${this.dialect}" is not implemented`)}quoteIdentifiers(e){if(e.includes(".")){e=e.split(".");let r=e.slice(0,e.length-1).join("->"),n=e[e.length-1];return`${this.quoteIdentifier(r)}.${this.quoteIdentifier(n)}`}return this.quoteIdentifier(e)}quoteAttribute(e,r){return r&&e in r.rawAttributes?this.quoteIdentifier(e):this.quoteIdentifiers(e)}getAliasToken(){return"AS"}quoteTable(e,r){let n="";return r===!0&&(r=e.as||e.name||e),Ct.isObject(e)?this._dialect.supports.schemas?(e.schema&&(n+=`${this.quoteIdentifier(e.schema)}.`),n+=this.quoteIdentifier(e.tableName)):(e.schema&&(n+=e.schema+(e.delimiter||".")),n+=e.tableName,n=this.quoteIdentifier(n)):n=this.quoteIdentifier(e),r&&(n+=` ${this.getAliasToken()} ${this.quoteIdentifier(r)}`),n}escape(e,r,n){if(n=n||{},e!=null){if(e instanceof Ge.SequelizeMethod)return this.handleSequelizeMethod(e);if(r&&r.type&&(r.type instanceof _M.STRING&&["mysql","mariadb"].includes(this.dialect)&&["number","boolean"].includes(typeof e)&&(e=String(Number(e))),this.validate(e,r,n),r.type.stringify)){let i=a=>kqe.escape(a,this.options.timezone,this.dialect);if(e=r.type.stringify(e,{escape:i,field:r,timezone:this.options.timezone,operation:n.operation}),r.type.escape===!1)return e}}return kqe.escape(e,this.options.timezone,this.dialect)}bindParam(e){return r=>(e.push(r),`$${e.length}`)}format(e,r,n,i){if(n=n||{},e!=null){if(e instanceof Ge.SequelizeMethod)throw new Error("Cannot pass SequelizeMethod as a bind parameter - use escape instead");if(r&&r.type&&(this.validate(e,r,n),r.type.bindParam))return r.type.bindParam(e,{escape:Ct.identity,field:r,timezone:this.options.timezone,operation:n.operation,bindParam:i})}return i(e)}validate(e,r,n){if(this.typeValidation&&r.type.validate&&e)try{if(n.isList&&Array.isArray(e))for(let i of e)r.type.validate(i,n);else r.type.validate(e,n)}catch(i){throw i instanceof NH.ValidationError&&i.errors.push(new NH.ValidationErrorItem(i.message,"Validation error",r.fieldName,e,null,`${r.type.key} validator`)),i}}isIdentifierQuoted(e){return/^\s*(?:([`"'])(?:(?!\1).|\1{2})*\1\.?)+\s*$/i.test(e)}jsonPathExtractionQuery(e,r,n){let i=Ct.toPath(r),a,s=this.isIdentifierQuoted(e)?e:this.quoteIdentifier(e);switch(this.dialect){case"mysql":case"mariadb":case"sqlite":return this.dialect==="mysql"&&(i=i.map(u=>/\D/.test(u)?Ge.addTicks(u,'"'):u)),a=this.escape(["$"].concat(i).join(".").replace(/\.(\d+)(?:(?=\.)|$)/g,(u,l)=>`[${l}]`)),this.dialect==="sqlite"?`json_extract(${s},${a})`:`json_unquote(json_extract(${s},${a}))`;case"postgres":let o=n?"#>":"#>>";return a=this.escape(`{${i.join(",")}}`),`(${s}${o}${a})`;default:throw new Error(`Unsupported ${this.dialect} for JSON operations`)}}selectQuery(e,r,n){r=r||{};let i=r.limit,a=[],s=[],o=r.subQuery===void 0?i&&r.hasMultiAssociation:r.subQuery,u={main:r.attributes&&r.attributes.slice(),subQuery:null},l={name:e,quotedName:null,as:null,model:n},p={names:l,options:r,subQuery:o},f=[],b=[],O;if(this.options.minifyAliases&&!r.aliasesMapping&&(r.aliasesMapping=new Map,r.aliasesByTable={},r.includeAliases=new Map),r.tableAs?l.as=this.quoteIdentifier(r.tableAs):!Array.isArray(l.name)&&l.model&&(l.as=this.quoteIdentifier(l.model.name)),l.quotedName=Array.isArray(l.name)?e.map(m=>Array.isArray(m)?this.quoteTable(m[0],m[1]):this.quoteTable(m,!0)).join(", "):this.quoteTable(l.name),o&&u.main)for(let m of l.model.primaryKeyAttributes)u.main.some(z=>m===z||m===z[0]||m===z[1])||u.main.push(l.model.rawAttributes[m].field?[m,l.model.rawAttributes[m].field]:m);if(u.main=this.escapeAttributes(u.main,r,l.as),u.main=u.main||(r.include?[`${l.as}.*`]:["*"]),(o||r.groupedLimit)&&(u.subQuery=u.main,u.main=[`${l.as||l.quotedName}.*`]),r.include)for(let m of r.include){if(m.separate)continue;let z=this.generateInclude(m,{externalAs:l.as,internalAs:l.as},p);b=b.concat(z.subQuery),f=f.concat(z.mainQuery),z.attributes.main.length>0&&(u.main=Ct.uniq(u.main.concat(z.attributes.main))),z.attributes.subQuery.length>0&&(u.subQuery=Ct.uniq(u.subQuery.concat(z.attributes.subQuery)))}if(o)s.push(this.selectFromTableFragment(r,l.model,u.subQuery,l.quotedName,l.as)),s.push(b.join(""));else{if(r.groupedLimit){l.as||(l.as=l.quotedName);let m=Dd({},r.where),z,y,R,w=l.as;if(typeof r.groupedLimit.on=="string"?y=r.groupedLimit.on:r.groupedLimit.on instanceof kVt&&(y=r.groupedLimit.on.foreignKeyField),r.groupedLimit.on instanceof PVt){w=r.groupedLimit.on.manyFromSource.as;let j=$s._validateIncludedElements({include:[{association:r.groupedLimit.on.manyFromSource,duplicating:!1,required:!0,where:Dd({[Ce.placeholder]:!0},r.groupedLimit.through&&r.groupedLimit.through.where)}],model:n});r.hasJoin=!0,r.hasMultiAssociation=!0,r.includeMap=Object.assign(j.includeMap,r.includeMap),r.includeNames=j.includeNames.concat(r.includeNames||[]),R=j.include,Array.isArray(r.order)&&(r.order.forEach((I,U)=>{Array.isArray(I)&&(I=I[0]);let Y=`subquery_order_${U}`;r.attributes.push([I,Y]),Y=this.sequelize.literal(this.quote(Y)),Array.isArray(r.order[U])?r.order[U][0]=Y:r.order[U]=Y}),z=r.order)}else z=r.order,this._dialect.supports.topLevelOrderByRequired||delete r.order,m[Ce.placeholder]=!0;let q=`SELECT * FROM (${this.selectQuery(e,{attributes:r.attributes,offset:r.offset,limit:r.groupedLimit.limit,order:z,aliasesMapping:r.aliasesMapping,aliasesByTable:r.aliasesByTable,where:m,include:R,model:n},n).replace(/;$/,"")}) ${this.getAliasToken()} sub`,C=this.whereItemQuery(Ce.placeholder,!0,{model:n}),L=q.indexOf(C);a.push(this.selectFromTableFragment(r,l.model,u.main,`(${r.groupedLimit.values.map(j=>{let I;return y&&(I={[y]:j}),R&&(I={[r.groupedLimit.on.foreignIdentifierField]:j}),Ge.spliceStr(q,L,C.length,this.getWhereConditions(I,w))}).join(this._dialect.supports["UNION ALL"]?" UNION ALL ":" UNION ")})`,l.as))}else a.push(this.selectFromTableFragment(r,l.model,u.main,l.quotedName,l.as));a.push(f.join(""))}if(Object.prototype.hasOwnProperty.call(r,"where")&&!r.groupedLimit&&(r.where=this.getWhereConditions(r.where,l.as||e,n,r),r.where&&(o?s.push(` WHERE ${r.where}`):(a.push(` WHERE ${r.where}`),a.forEach((m,z)=>{m.startsWith("SELECT")&&(a[z]=this.selectFromTableFragment(r,n,u.main,l.quotedName,l.as,r.where))})))),r.group&&(r.group=Array.isArray(r.group)?r.group.map(m=>this.aliasGrouping(m,n,l.as,r)).join(", "):this.aliasGrouping(r.group,n,l.as,r),o&&r.group?s.push(` GROUP BY ${r.group}`):r.group&&a.push(` GROUP BY ${r.group}`)),Object.prototype.hasOwnProperty.call(r,"having")&&(r.having=this.getWhereConditions(r.having,e,n,r,!1),r.having&&(o?s.push(` HAVING ${r.having}`):a.push(` HAVING ${r.having}`))),r.order){let m=this.getQueryOrders(r,n,o);m.mainQueryOrder.length&&a.push(` ORDER BY ${m.mainQueryOrder.join(", ")}`),m.subQueryOrder.length&&s.push(` ORDER BY ${m.subQueryOrder.join(", ")}`)}let M=this.addLimitAndOffset(r,l.model);if(M&&!r.groupedLimit&&(o?s.push(M):a.push(M)),o?(this._throwOnEmptyAttributes(u.main,{modelName:n&&n.name,as:l.as}),O=`SELECT ${u.main.join(", ")} FROM (${s.join("")}) ${this.getAliasToken()} ${l.as}${f.join("")}${a.join("")}`):O=a.join(""),r.lock&&this._dialect.supports.lock){let m=r.lock;typeof r.lock=="object"&&(m=r.lock.level),this._dialect.supports.lockKey&&["KEY SHARE","NO KEY UPDATE"].includes(m)?O+=` FOR ${m}`:m==="SHARE"?O+=` ${this._dialect.supports.forShare}`:O+=" FOR UPDATE",this._dialect.supports.lockOf&&r.lock.of&&r.lock.of.prototype instanceof $s&&(O+=` OF ${this.quoteTable(r.lock.of.name)}`),this._dialect.supports.skipLocked&&r.skipLocked&&(O+=" SKIP LOCKED")}return`${O};`}aliasGrouping(e,r,n,i){let a=Array.isArray(e)?e[0]:e;return this.quote(this._getAliasForField(n,a,i)||a,r)}escapeAttributes(e,r,n){return e&&e.map(i=>{let a=!0;if(i instanceof Ge.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 Ge.SequelizeMethod)i[0]=this.handleSequelizeMethod(i[0]),a=!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 (/home2/kzgqvuqk/sendotp.store/index.js:136:7832)
    at new t (/home2/kzgqvuqk/sendotp.store/index.js:148:66644)
    at new Gi (/home2/kzgqvuqk/sendotp.store/index.js:148:73185)
    at new t (/home2/kzgqvuqk/sendotp.store/index.js:148:229204)
    at Object.<anonymous> (/home2/kzgqvuqk/sendotp.store/index.js:3371:28474)
    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
/home2/kzgqvuqk/sendotp.store/index.js:136
`}};$I.AggregateError=OH});var dqe=A(JI=>{"use strict";Object.defineProperty(JI,"__esModule",{value:!0});JI.Deferred=void 0;var jQt=MH(),_H=class{constructor(){this._promise=new Promise((e,r)=>{this._reject=r,this._resolve=e})}registerTimeout(e,r){this._timeout||(this._timeout=setTimeout(()=>{r(),this.reject(new jQt.TimeoutError("Operation timeout"))},e))}_clearTimeout(){this._timeout&&clearTimeout(this._timeout)}resolve(e){this._clearTimeout(),this._resolve(e)}reject(e){this._clearTimeout(),this._reject(e)}promise(){return this._promise}};JI.Deferred=_H});var bqe=A(ZI=>{"use strict";Object.defineProperty(ZI,"__esModule",{value:!0});ZI.Pool=void 0;var QQt=dqe(),VQt=AH(),mH=class{constructor(e){if(this.log=!1,!e.create)throw new Error("create function is required");if(!e.destroy)throw new Error("destroy function is required");if(!e.validate)throw new Error("validate function is required");if(typeof e.min!="number"||e.min<0||e.min!==Math.round(e.min))throw new Error("min must be an integer >= 0");if(typeof e.max!="number"||e.max<=0||e.max!==Math.round(e.max))throw new Error("max must be an integer > 0");if(e.min>e.max)throw new Error("max is smaller than min");if(e.maxUses!==void 0&&(typeof e.maxUses!="number"||e.maxUses<0))throw new Error("maxUses must be an integer >= 0");this.idleTimeoutMillis=e.idleTimeoutMillis||3e4,this.acquireTimeoutMillis=e.acquireTimeoutMillis||3e4,this.reapIntervalMillis=e.reapIntervalMillis||1e3,this.maxUsesPerResource=e.maxUses||1/0,this.log=e.log||!1,this._factory=e,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(e,r){typeof this.log=="function"?this.log(e,r):this.log&&console.log(`${r.toUpperCase()} pool ${this.name||""} - ${e}`)}_removeIdle(){let e=[],r=Date.now(),n,i=this._availableObjects.length,a=this.size-this.minSize,s;for(this._removeIdleScheduled=!1,n=0;n<i&&a>e.length;n++)s=this._availableObjects[n].timeout,r>=s&&(this._log("removeIdle() destroying obj - now:"+r+" timeout:"+s,"verbose"),e.push(this._availableObjects[n].resource));e.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 e=null,r=this._pendingAcquires.length;if(this._log(`dispense() clients=${r} available=${this._availableObjects.length}`,"info"),!(r<1)){for(;this._availableObjects.length>0;){if(this._log("dispense() - reusing obj","verbose"),e=this._availableObjects[this._availableObjects.length-1],!this._factory.validate(e.resource)){this.destroy(e.resource);continue}return this._availableObjects.pop(),this._addResourceToInUseObjects(e.resource,e.useCount),this._pendingAcquires.shift().resolve(e.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(e=>{let r=this._pendingAcquires.shift();r?(this._addResourceToInUseObjects(e,0),r.resolve(e)):this._addResourceToAvailableObjects(e,0)}).catch(e=>{let r=this._pendingAcquires.shift();this._count-=1,this._count<0&&(this._count=0),r&&r.reject(e),process.nextTick(()=>{this._dispense()})})}_addResourceToAvailableObjects(e,r){let n={resource:e,useCount:r,timeout:Date.now()+this.idleTimeoutMillis};this._availableObjects.push(n),this._dispense(),this._scheduleRemoveIdle()}_addResourceToInUseObjects(e,r){let n={resource:e,useCount:r};this._inUseObjects.push(n)}_ensureMinimum(){let e,r;if(!this._draining&&this.size<this.minSize)for(r=this.minSize-this.size,e=0;e<r;e++)this._createResource()}acquire(){if(this._draining)return Promise.reject(new Error("pool is draining and cannot accept work"));let e=new QQt.Deferred;return e.registerTimeout(this.acquireTimeoutMillis,()=>{this._pendingAcquires=this._pendingAcquires.filter(r=>r!==e)}),this._pendingAcquires.push(e),this._dispense(),e.promise()}release(e){if(this._availableObjects.some(i=>i.resource===e)){this._log("release called twice for the same resource: "+new Error().stack,"error");return}let r=this._inUseObjects.findIndex(i=>i.resource===e);if(r<0){this._log("attempt to release an invalid resource: "+new Error().stack,"error");return}let n=this._inUseObjects[r];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(r,1),this._addResourceToAvailableObjects(n.resource,n.useCount))}async destroy(e){let r=this._availableObjects.length,n=this._inUseObjects.length;if(this._availableObjects=this._availableObjects.filter(i=>i.resource!==e),this._inUseObjects=this._inUseObjects.filter(i=>i.resource!==e),r===this._availableObjects.length&&n===this._inUseObjects.length){this._ensureMinimum();return}this._count-=1,this._count<0&&(this._count=0);try{await this._factory.destroy(e)}finally{this._ensureMinimum(),this._draining||process.nextTick(()=>{this._dispense()})}}drain(){this._log("draining","info"),this._draining=!0;let e=r=>{if(this._pendingAcquires.length>0){this._dispense(),setTimeout(()=>{e(r)},100);return}if(this._availableObjects.length!==this._count){setTimeout(()=>{e(r)},100);return}r()};return new Promise(r=>e(r))}async destroyAllNow(){this._log("force destroying all objects","info"),this._removeIdleScheduled=!1,clearTimeout(this._removeIdleTimer);let e=this._availableObjects.map(n=>n.resource),r=[];for(let n of e)try{await this.destroy(n)}catch(i){this._log("Error destroying resource: "+i.stack,"error"),r.push(i)}if(r.length>0)throw new VQt.AggregateError(r)}};ZI.Pool=mH});var hqe=A(sp=>{"use strict";Object.defineProperty(sp,"__esModule",{value:!0});sp.Pool=sp.AggregateError=sp.TimeoutError=void 0;var HQt=MH();Object.defineProperty(sp,"TimeoutError",{enumerable:!0,get:function(){return HQt.TimeoutError}});var XQt=AH();Object.defineProperty(sp,"AggregateError",{enumerable:!0,get:function(){return XQt.AggregateError}});var YQt=bqe();Object.defineProperty(sp,"Pool",{enumerable:!0,get:function(){return YQt.Pool}})});var uu=A((uzr,eS)=>{"use strict";var{Pool:EH,TimeoutError:KQt}=hqe(),op=it(),zH=Ks(),$Qt=v0(),{logger:JQt}=Gr(),ZQt=dM(),Zo=JQt.debugContext("pool"),$g=class{constructor(e,r){let n=op.cloneDeep(r.config);if(this.sequelize=r,this.config=n,this.dialect=e,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=op.defaults(n.pool||{},{max:5,min:0,idle:1e4,acquire:6e4,evict:1e3,validate:this._validate.bind(this)}),this.initPools()}refreshTypeParser(e){op.each(e,r=>{if(Object.prototype.hasOwnProperty.call(r,"parse"))if(r.types[this.dialectName])this._refreshTypeParser(r);else throw new Error(`Parse function not supported for type ${r.key} in dialect ${this.dialectName}`)})}_loadDialectModule(e){try{return this.sequelize.config.dialectModulePath?require(this.sequelize.config.dialectModulePath):this.sequelize.config.dialectModule?this.sequelize.config.dialectModule:require(e)}catch(r){throw r.code==="MODULE_NOT_FOUND"?this.sequelize.config.dialectModulePath?new Error(`Unable to find dialect at ${this.sequelize.config.dialectModulePath}`):new Error(`Please install ${e} package manually`):r}}async _onProcessExit(){if(this.pool)return await this.pool.drain(),Zo("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 e=this.config;if(!e.replication){this.pool=new EH({name:"sequelize",create:()=>this._connect(e),destroy:async n=>{let i=await this._disconnect(n);return Zo("connection destroy"),i},validate:e.pool.validate,max:e.pool.max,min:e.pool.min,acquireTimeoutMillis:e.pool.acquire,idleTimeoutMillis:e.pool.idle,reapIntervalMillis:e.pool.evict,maxUses:e.pool.maxUses}),Zo(`pool created with max/min: ${e.pool.max}/${e.pool.min}, no replication`);return}Array.isArray(e.replication.read)||(e.replication.read=[e.replication.read]),e.replication.write=op.defaults(e.replication.write,op.omit(e,"replication")),e.replication.read=e.replication.read.map(n=>op.defaults(n,op.omit(this.config,"replication")));let r=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),Zo("connection destroy")},destroyAllNow:async()=>{await Promise.all([this.pool.read.destroyAllNow(),this.pool.write.destroyAllNow()]),Zo("all connections destroyed")},drain:async()=>Promise.all([this.pool.write.drain(),this.pool.read.drain()]),read:new EH({name:"sequelize:read",create:async()=>{let n=r++%e.replication.read.length,i=await this._connect(e.replication.read[n]);return i.queryType="read",i},destroy:n=>this._disconnect(n),validate:e.pool.validate,max:e.pool.max,min:e.pool.min,acquireTimeoutMillis:e.pool.acquire,idleTimeoutMillis:e.pool.idle,reapIntervalMillis:e.pool.evict,maxUses:e.pool.maxUses}),write:new EH({name:"sequelize:write",create:async()=>{let n=await this._connect(e.replication.write);return n.queryType="write",n},destroy:n=>this._disconnect(n),validate:e.pool.validate,max:e.pool.max,min:e.pool.min,acquireTimeoutMillis:e.pool.acquire,idleTimeoutMillis:e.pool.idle,reapIntervalMillis:e.pool.evict,maxUses:e.pool.maxUses})},Zo(`pool created with max/min: ${e.pool.max}/${e.pool.min}, with replication`)}async getConnection(e){e=e||{},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 a=await this.sequelize.databaseVersion(i),s=op.get(zH.coerce(a),"version")||a;this.sequelize.options.databaseVersion=zH.valid(s)?s:this.dialect.defaultVersion}return zH.lt(this.sequelize.options.databaseVersion,this.dialect.defaultVersion)&&(ZQt.unsupportedEngine(),Zo(`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 r;try{await this.sequelize.runHooks("beforePoolAcquire",e),r=await this.pool.acquire(e.type,e.useMaster),await this.sequelize.runHooks("afterPoolAcquire",r,e)}catch(n){throw n instanceof KQt?new $Qt.ConnectionAcquireTimeoutError(n):n}return Zo("connection acquired"),r}releaseConnection(e){this.pool.release(e),Zo("connection released")}async destroyConnection(e){await this.pool.destroy(e),Zo(`connection ${e.uuid} destroyed`)}async _connect(e){await this.sequelize.runHooks("beforeConnect",e);let r=await this.dialect.connectionManager.connect(e);return await this.sequelize.runHooks("afterConnect",r,e),r}async _disconnect(e){return await this.sequelize.runHooks("beforeDisconnect",e),await this.dialect.connectionManager.disconnect(e),this.sequelize.runHooks("afterDisconnect",e)}_validate(e){return this.dialect.connectionManager.validate?this.dialect.connectionManager.validate(e):!0}};eS.exports=$g;eS.exports.ConnectionManager=$g;eS.exports.default=$g});var ss=A((lzr,Mqe)=>{"use strict";var Jg=new Map;Mqe.exports=t=>(Jg.has(t)||Jg.set(t,new Map),{clear(){Jg.get(t).clear()},refresh(e){for(let r of e.types[t])Jg.get(t).set(r,e.parse)},get(e){return Jg.get(t).get(e)}})});var mqe=A((pzr,rS)=>{"use strict";var eVt=Object.defineProperty,Oqe=Object.getOwnPropertySymbols,tVt=Object.prototype.hasOwnProperty,rVt=Object.prototype.propertyIsEnumerable,Aqe=(t,e,r)=>e in t?eVt(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,nVt=(t,e)=>{for(var r in e||(e={}))tVt.call(e,r)&&Aqe(t,r,e[r]);if(Oqe)for(var r of Oqe(e))rVt.call(e,r)&&Aqe(t,r,e[r]);return t},iVt=Ks(),aVt=uu(),AM=v0(),{logger:sVt}=Gr(),oVt=R0().mariadb,cVt=Xo(),_qe=sVt.debugContext("connection:mariadb"),tS=ss()("mariadb"),Zg=class t extends aVt{constructor(e,r){r.config.port=r.config.port||3306,super(e,r),this.lib=this._loadDialectModule("mariadb"),this.refreshTypeParser(oVt)}static _typecast(e,r){return tS.get(e.type)?tS.get(e.type)(e,this.sequelize.options,r):r()}_refreshTypeParser(e){tS.refresh(e)}_clearTypeParser(){tS.clear()}async connect(e){let r=this.sequelize.options.timezone;r=/\//.test(r)?cVt.tz(r).format("Z"):r;let n=nVt({host:e.host,port:e.port,user:e.username,password:e.password,database:e.database,timezone:r,typeCast:t._typecast.bind(this),bigNumberStrings:!1,supportBigNumbers:!0,foundRows:!1},e.dialectOptions);this.sequelize.config.keepDefaultTimezone||(n.initSql?(Array.isArray(n.initSql)||(n.initSql=[n.initSql]),n.initSql.push(`SET time_zone = '${r}'`)):n.initSql=`SET time_zone = '${r}'`);try{let i=await this.lib.createConnection(n);return this.sequelize.options.databaseVersion=iVt.coerce(i.serverVersion()).version,_qe("connection acquired"),i.on("error",a=>{switch(a.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 AM.ConnectionRefusedError(i);case"ER_ACCESS_DENIED_ERROR":case"ER_ACCESS_DENIED_NO_PASSWORD_ERROR":throw new AM.AccessDeniedError(i);case"ENOTFOUND":throw new AM.HostNotFoundError(i);case"EHOSTUNREACH":case"ENETUNREACH":case"EADDRNOTAVAIL":throw new AM.HostNotReachableError(i);case"EINVAL":throw new AM.InvalidConnectionError(i);default:throw new AM.ConnectionError(i)}}}async disconnect(e){if(!e.isValid()){_qe("connection tried to disconnect but was already at CLOSED state");return}return await e.end()}validate(e){return e&&e.isValid()}};rS.exports=Zg;rS.exports.ConnectionManager=Zg;rS.exports.default=Zg});var lu=A((fzr,nS)=>{"use strict";var uVt=Object.defineProperty,Eqe=Object.getOwnPropertySymbols,lVt=Object.prototype.hasOwnProperty,pVt=Object.prototype.propertyIsEnumerable,zqe=(t,e,r)=>e in t?uVt(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,fVt=(t,e)=>{for(var r in e||(e={}))lVt.call(e,r)&&zqe(t,r,e[r]);if(Eqe)for(var r of Eqe(e))pVt.call(e,r)&&zqe(t,r,e[r]);return t},cp=it(),dVt=zg(),ma=Pi(),bVt=wg(),hVt=dM(),MVt=(oM(),xc(sM)).v4,{safeStringifyJson:gqe}=G0(),ey=class t{constructor(e,r,n){this.uuid=MVt(),this.connection=e,this.instance=n.instance,this.model=n.model,this.sequelize=r,this.options=fVt({plain:!1,raw:!1,logging:console.log},n),this.checkLoggingOption(),n.rawErrors&&(this.formatError=t.prototype.formatError)}static formatBindParameters(e,r,n,i,a){if(!r)return[e,[]];if(a=a||{},typeof i!="function"&&(a=i||{},i=void 0),!i)a.skipValueReplace?i=(u,l,p)=>{if(p[l]!==void 0)return u}:i=(u,l,p,f,b)=>{if(p[l]!==void 0)return dVt.escape(p[l],f,b)};else if(a.skipValueReplace){let u=i;i=(l,p,f,b,O,M)=>{if(u(l,p,f,b,O,M)!==void 0)return l}}let s=null,o=Array.isArray(r);return e=e.replace(/\B\$(\$|\w+)/g,(u,l)=>{if(l==="$")return a.skipUnescape?u:l;let p;if(o?l.match(/^[1-9]\d*$/)&&(l=l-1,p=i(u,l,r,s,n,a)):l.match(/^\d*$/)||(p=i(u,l,r,s,n,a)),p===void 0)throw new Error(`Named bind parameter "${u}" has no value in the given object.`);return p}),[e,[]]}formatError(e,r){return e.stack=r,e}run(){throw new Error("The run method wasn't overwritten!")}checkLoggingOption(){this.options.logging===!0&&(hVt.noTrueLogging(),this.options.logging=console.log)}getInsertIdField(){return"insertId"}getUniqueConstraintErrorMessage(e){let r=e?`${e} must be unique`:"Must be unique";if(e&&this.model)for(let n of Object.keys(this.model.uniqueKeys))this.model.uniqueKeys[n].fields.includes(e.replace(/"/g,""))&&this.model.uniqueKeys[n].msg&&(r=this.model.uniqueKeys[n].msg);return r}isRawQuery(){return this.options.type===ma.RAW}isVersionQuery(){return this.options.type===ma.VERSION}isUpsertQuery(){return this.options.type===ma.UPSERT}isInsertQuery(e,r){let n=!0;return this.options.type===ma.INSERT?!0:(n=n&&this.sql.toLowerCase().startsWith("insert into"),n=n&&(!e||Object.prototype.hasOwnProperty.call(e,this.getInsertIdField())),n=n&&(!r||Object.prototype.hasOwnProperty.call(r,this.getInsertIdField())),n)}handleInsertQuery(e,r){if(this.instance){let n=this.model.autoIncrementAttribute,i=null;i=i||e&&e[this.getInsertIdField()],i=i||r&&r[this.getInsertIdField()],this.instance[n]=i}}isShowTablesQuery(){return this.options.type===ma.SHOWTABLES}handleShowTablesQuery(e){return cp.flatten(e.map(r=>Object.values(r)))}isShowIndexesQuery(){return this.options.type===ma.SHOWINDEXES}isShowConstraintsQuery(){return this.options.type===ma.SHOWCONSTRAINTS}isDescribeQuery(){return this.options.type===ma.DESCRIBE}isSelectQuery(){return this.options.type===ma.SELECT}isBulkUpdateQuery(){return this.options.type===ma.BULKUPDATE}isBulkDeleteQuery(){return this.options.type===ma.BULKDELETE}isForeignKeysQuery(){return this.options.type===ma.FOREIGNKEYS}isUpdateQuery(){return this.options.type===ma.UPDATE}handleSelectQuery(e){let r=null;if(this.options.fieldMap){let n=this.options.fieldMap;e=e.map(i=>cp.reduce(n,(a,s,o)=>(a[o]!==void 0&&s!==o&&(a[s]=a[o],delete a[o]),a),i))}return this.options.raw?r=e.map(n=>{let i={};for(let a in n)Object.prototype.hasOwnProperty.call(n,a)&&(i[a]=n[a]);return this.options.nest&&(i=bVt.transform(i)),i}):this.options.hasJoin===!0?(e=t._groupJoinData(e,{model:this.model,includeMap:this.options.includeMap,includeNames:this.options.includeNames},{checkExisting:this.options.hasMultiAssociation}),r=this.model.bulkBuild(e,{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})):r=this.model.bulkBuild(e,{isNewRecord:!1,raw:!0,attributes:this.options.originalAttributes||this.options.attributes}),this.options.plain&&(r=r.length===0?null:r[0]),r}isShowOrDescribeQuery(){let e=!1;return e=e||this.sql.toLowerCase().startsWith("show"),e=e||this.sql.toLowerCase().startsWith("describe"),e}isCallQuery(){return this.sql.toLowerCase().startsWith("call")}_logQuery(e,r,n){let{connection:i,options:a}=this,s=this.sequelize.options.benchmark||a.benchmark,o=this.sequelize.options.logQueryParameters||a.logQueryParameters,u=Date.now(),l="";if(o&&n){let b=e.endsWith(";")?"":";",O;Array.isArray(n)?O=n.map(M=>gqe(M)).join(", "):O=gqe(n),l=`${b} ${O}`}let p=`(${i.uuid||"default"}): ${e}${l}`,f=`Executing ${p}`;return r(f),s||this.sequelize.log(`Executing ${p}`,a),()=>{let b=`Executed ${p}`;r(b),s&&this.sequelize.log(b,Date.now()-u,a)}}static _groupJoinData(e,r,n){if(!e.length)return[];let i,a,s,o,u,l,p=e.length,f,b,O,M,m,z,y,R,w=n.checkExisting,q,C,L,j=w?[]:new Array(p),I={},U={},Y,S,te,V,D,P,F,re,ee=Q=>{Object.prototype.hasOwnProperty.call(P.includeMap,Q)&&(U[b]=P=P.includeMap[Q],re?re=`${re}.${Q}`:re=Q,U[re]=P)},Ae={},ge=(Q,ae)=>(Object.prototype.hasOwnProperty.call(ae,Q)||(ae[Q]=Q.substr(0,Q.lastIndexOf("."))),ae[Q]),we={},Qe=Q=>{if(!Object.prototype.hasOwnProperty.call(we,Q)){let ae=Q.lastIndexOf(".");we[Q]=Q.substr(ae===-1?0:ae+1)}return we[Q]},de={},tt=Q=>{if(!Object.prototype.hasOwnProperty.call(de,Q)){let ae=ge(Q,Ae);Object.prototype.hasOwnProperty.call(de,ae)||(de[ae]=ae?ae.split("."):[]),de[Q]=de[ae]}return de[Q]},je={},Ee=Q=>{if(!Object.prototype.hasOwnProperty.call(je,Q)){let ae=tt(Q),le=ae.length;je[Q]=le?ae[le-1]:""}return je[Q]},Ze=Q=>{let ae=cp.chain(Q.uniqueKeys);return ae=ae.result(`${ae.findKey()}.fields`).map(le=>cp.findKey(Q.attributes,Oe=>Oe.field===le)).value(),ae},Ke=Q=>Q instanceof Buffer?Q.toString("hex"):Q,_e,We,oe;for(u=0;u<p;u++){if(l=e[u],u===0&&(f=cp.sortBy(Object.keys(l),Q=>[Q.split(".").length]),M=f.length),w){if(R=!1,o=r.model.primaryKeyAttributes.length,L="",o===1)L=Ke(l[r.model.primaryKeyAttributes[0]]);else if(o>1)for(s=0;s<o;s++)L+=Ke(l[r.model.primaryKeyAttributes[s]]);else if(!cp.isEmpty(r.model.uniqueKeys))for(We=Ze(r.model),s=0;s<We.length;s++)L+=l[We[s]]}for(y=z={},V=void 0,O=0;O<M;O++){if(b=f[O],S=ge(b,Ae),Y=tt(b),u===0&&!Object.prototype.hasOwnProperty.call(U,b)&&(Y.length?(P=r,re=void 0,Y.forEach(ee)):U[b]=U[""]=r),V!==void 0&&V!==Y){if(w){if(a=V.length,F=null,C=null,a)for(i=0;i<a;i++){if(oe=F?`${F}.${V[i]}`:V[i],_e=U[oe].model.primaryKeyAttributes,o=_e.length,q=oe,o===1)q+=Ke(l[`${oe}.${_e[0]}`]);else if(o>1)for(s=0;s<o;s++)q+=Ke(l[`${oe}.${_e[s]}`]);else if(!cp.isEmpty(U[oe].model.uniqueKeys))for(We=Ze(U[oe].model),s=0;s<We.length;s++)q+=l[`${oe}.${We[s]}`];C||(C=L),q=C+q,F=oe,i<a-1&&(C=q)}else q=L;q===L?I[q]?R=!0:I[q]=z:I[q]||(F=I[C],D=Ee(m),U[m].association.isSingleAssociation?F&&(F[D]=I[q]=z):(F[D]||(F[D]=[]),F[D].push(I[q]=z))),z={}}else if(P=y,a=Y.length,a)for(i=0;i<a;i++)i===a-1&&(z=P[Y[i]]={}),P=P[Y[i]]||{}}z[Qe(b)]=l[b],m=b,V=Y,te=S}if(w){if(a=V.length,F=null,C=null,a)for(i=0;i<a;i++){if(oe=F?`${F}.${V[i]}`:V[i],_e=U[oe].model.primaryKeyAttributes,o=_e.length,q=oe,o===1)q+=Ke(l[`${oe}.${_e[0]}`]);else if(o>0)for(s=0;s<o;s++)q+=Ke(l[`${oe}.${_e[s]}`]);else if(!cp.isEmpty(U[oe].model.uniqueKeys))for(We=Ze(U[oe].model),s=0;s<We.length;s++)q+=l[`${oe}.${We[s]}`];C||(C=L),q=C+q,F=oe,i<a-1&&(C=q)}else q=L;q===L?I[q]?R=!0:I[q]=z:I[q]||(F=I[C],D=Ee(m),U[m].association.isSingleAssociation?F&&(F[D]=I[q]=z):(F[D]||(F[D]=[]),F[D].push(I[q]=z))),R||j.push(y)}else j[u]=y}return j}};nS.exports=ey;nS.exports.AbstractQuery=ey;nS.exports.default=ey});var Iqe=A((dzr,vqe)=>{"use strict";var OVt=Object.defineProperty,yqe=Object.getOwnPropertySymbols,AVt=Object.prototype.hasOwnProperty,_Vt=Object.prototype.propertyIsEnumerable,Rqe=(t,e,r)=>e in t?OVt(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,mVt=(t,e)=>{for(var r in e||(e={}))AVt.call(e,r)&&Rqe(t,r,e[r]);if(yqe)for(var r of yqe(e))_Vt.call(e,r)&&Rqe(t,r,e[r]);return t},Nqe=lu(),iS=v0(),Tqe=it(),gH=R0(),{logger:EVt}=Gr(),zVt=1062,gVt=1213,wqe=1451,yVt=1452,qqe=EVt.debugContext("sql:mariadb"),yH=class extends Nqe{constructor(e,r,n){super(e,r,mVt({showWarnings:!1},n))}static formatBindParameters(e,r,n){let i=[],a=(s,o,u)=>{if(u[o]!==void 0)return i.push(u[o]),"?"};return e=Nqe.formatBindParameters(e,r,n,a)[0],[e,i.length>0?i:void 0]}async run(e,r){this.sql=e;let{connection:n,options:i}=this,a=this.sequelize.options.showWarnings||i.showWarnings,s=this._logQuery(e,qqe,r);r&&qqe("parameters(%j)",r);let o,u=new Error;try{o=await n.query(this.sql,r)}catch(l){if(i.transaction&&l.errno===gVt){try{await i.transaction.rollback()}catch{}i.transaction.finished="rollback"}throw l.sql=e,l.parameters=r,this.formatError(l,u.stack)}finally{s()}return a&&o&&o.warningStatus>0&&await this.logWarnings(o),this.formatResults(o)}formatResults(e){let r=this.instance;if(this.isBulkUpdateQuery()||this.isBulkDeleteQuery())return e.affectedRows;if(this.isUpsertQuery())return[r,e.affectedRows===1];if(this.isInsertQuery(e)&&(this.handleInsertQuery(e),!this.instance)){if(this.model&&this.model.autoIncrementAttribute&&this.model.autoIncrementAttribute===this.model.primaryKeyAttribute&&this.model.rawAttributes[this.model.primaryKeyAttribute]){let n=e[this.getInsertIdField()];r=new Array(e.affectedRows);let i=this.model.rawAttributes[this.model.primaryKeyAttribute].field;for(let a=0;a<e.affectedRows;a++)r[a]={[i]:n+a};return[r,e.affectedRows]}return[e[this.getInsertIdField()],e.affectedRows]}if(this.isSelectQuery())return this.handleJsonSelectQuery(e),this.handleSelectQuery(e);if(this.isInsertQuery()||this.isUpdateQuery())return[r,e.affectedRows];if(this.isCallQuery())return e[0];if(this.isRawQuery()){let n=e.meta;return delete e.meta,[e,n]}if(this.isShowIndexesQuery())return this.handleShowIndexesQuery(e);if(this.isForeignKeysQuery()||this.isShowConstraintsQuery())return e;if(this.isShowTablesQuery())return this.handleShowTablesQuery(e);if(this.isDescribeQuery()){r={};for(let n of e)r[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 r}return this.isVersionQuery()?e[0].version:r}handleJsonSelectQuery(e){if(!(!this.model||!this.model.fieldRawAttributesMap))for(let r of Object.keys(this.model.fieldRawAttributesMap)){let n=this.model.fieldRawAttributesMap[r];n.type instanceof gH.JSON&&(e=e.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])),gH.JSON.parse?gH.JSON.parse(n,this.sequelize.options,i[n.fieldName]):i)))}}async logWarnings(e){let r=await this.run("SHOW WARNINGS"),n=`MariaDB Warnings (${this.connection.uuid||"default"}): `,i=[];for(let a of r)if(!(a===void 0||typeof a[Symbol.iterator]!="function"))for(let s of a)if(Object.prototype.hasOwnProperty.call(s,"Message"))i.push(s.Message);else for(let o of s.keys())i.push([o,s[o]].join(": "));return this.sequelize.log(n+i.join("; "),this.options),e}formatError(e,r){switch(e.errno){case zVt:{let n=e.message.match(/Duplicate entry '([\s\S]*)' for key '?((.|\s)*?)'?\s.*$/),i={},a="Validation error",s=n?n[1].split("-"):void 0,o=n?n[2]:void 0,u=n?n[1]:void 0,l=this.model&&this.model.uniqueKeys[o];l?(l.msg&&(a=l.msg),i=Tqe.zipObject(l.fields,s)):i[o]=u;let p=[];return Tqe.forOwn(i,(f,b)=>{p.push(new iS.ValidationErrorItem(this.getUniqueConstraintErrorMessage(b),"unique violation",b,f,this.instance,"not_unique"))}),new iS.UniqueConstraintError({message:a,errors:p,parent:e,fields:i,stack:r})}case wqe:case yVt:{let n=e.message.match(/CONSTRAINT ([`"])(.*)\1 FOREIGN KEY \(\1(.*)\1\) REFERENCES \1(.*)\1 \(\1(.*)\1\)/),i=n?n[1]:"`",a=n?n[3].split(new RegExp(`${i}, *${i}`)):void 0;return new iS.ForeignKeyConstraintError({reltype:e.errno===wqe?"parent":"child",table:n?n[4]:void 0,fields:a,value:a&&a.length&&this.instance&&this.instance[a[0]]||void 0,index:n?n[2]:void 0,parent:e,stack:r})}default:return new iS.DatabaseError(e,{stack:r})}}handleShowTablesQuery(e){return e.map(r=>({tableName:r.TABLE_NAME,schema:r.TABLE_SCHEMA}))}handleShowIndexesQuery(e){let r,n=[];return e.forEach(i=>{(!r||r.name!==i.Key_name)&&(r={primary:i.Key_name==="PRIMARY",fields:[],name:i.Key_name,tableName:i.Table,unique:i.Non_unique!==1,type:i.Index_type},n.push(r)),r.fields[i.Seq_in_index-1]={attribute:i.Column_name,length:i.Sub_part||void 0,order:i.Collation==="A"?"ASC":void 0}}),n}};vqe.exports=yH});var Dqe=A((bzr,Cqe)=>{"use strict";var RVt=Object.defineProperty,Sqe=Object.getOwnPropertySymbols,NVt=Object.prototype.hasOwnProperty,TVt=Object.prototype.propertyIsEnumerable,Lqe=(t,e,r)=>e in t?RVt(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,wVt=(t,e)=>{for(var r in e||(e={}))NVt.call(e,r)&&Lqe(t,r,e[r]);if(Sqe)for(var r of Sqe(e))TVt.call(e,r)&&Lqe(t,r,e[r]);return t},aS=it(),Pt=zn(),qVt=G0(),vVt={OperatorMap:{[Pt.eq]:"=",[Pt.ne]:"!=",[Pt.gte]:">=",[Pt.gt]:">",[Pt.lte]:"<=",[Pt.lt]:"<",[Pt.not]:"IS NOT",[Pt.is]:"IS",[Pt.in]:"IN",[Pt.notIn]:"NOT IN",[Pt.like]:"LIKE",[Pt.notLike]:"NOT LIKE",[Pt.iLike]:"ILIKE",[Pt.notILike]:"NOT ILIKE",[Pt.startsWith]:"LIKE",[Pt.endsWith]:"LIKE",[Pt.substring]:"LIKE",[Pt.regexp]:"~",[Pt.notRegexp]:"!~",[Pt.iRegexp]:"~*",[Pt.notIRegexp]:"!~*",[Pt.between]:"BETWEEN",[Pt.notBetween]:"NOT BETWEEN",[Pt.overlap]:"&&",[Pt.contains]:"@>",[Pt.contained]:"<@",[Pt.adjacent]:"-|-",[Pt.strictLeft]:"<<",[Pt.strictRight]:">>",[Pt.noExtendRight]:"&<",[Pt.noExtendLeft]:"&>",[Pt.any]:"ANY",[Pt.all]:"ALL",[Pt.and]:" AND ",[Pt.or]:" OR ",[Pt.col]:"COL",[Pt.placeholder]:"$$PLACEHOLDER$$",[Pt.match]:"@@"},OperatorsAliasMap:{},setOperatorsAliases(t){!t||aS.isEmpty(t)?this.OperatorsAliasMap=!1:this.OperatorsAliasMap=wVt({},t)},_replaceAliases(t){let e={};return this.OperatorsAliasMap?(qVt.getOperators(t).forEach(r=>{let n=t[r];aS.isPlainObject(n)?e[r]=this._replaceAliases(n):e[r]=n}),aS.forOwn(t,(r,n)=>{n=this.OperatorsAliasMap[n]||n,aS.isPlainObject(r)&&(r=this._replaceAliases(r)),e[n]=r}),e):t}};Cqe.exports=vVt});var xqe=A((hzr,Bqe)=>{"use strict";var IVt=(oM(),xc(sM)).v4,SVt={setIsolationLevelQuery(t,e){if(!e.parent)return`SET TRANSACTION ISOLATION LEVEL ${t};`},generateTransactionId(){return IVt()},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;"}};Bqe.exports=SVt});var up=A((Ozr,Fqe)=>{"use strict";var LVt=Object.defineProperty,CVt=Object.defineProperties,DVt=Object.getOwnPropertyDescriptors,Wqe=Object.getOwnPropertySymbols,BVt=Object.prototype.hasOwnProperty,xVt=Object.prototype.propertyIsEnumerable,Pqe=(t,e,r)=>e in t?LVt(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Dd=(t,e)=>{for(var r in e||(e={}))BVt.call(e,r)&&Pqe(t,r,e[r]);if(Wqe)for(var r of Wqe(e))xVt.call(e,r)&&Pqe(t,r,e[r]);return t},sS=(t,e)=>CVt(t,DVt(e)),oS=require("util"),Ct=it(),WVt=(oM(),xc(sM)).v4,Ge=G0(),Mzr=dM(),kqe=zg(),_M=R0(),$s=xV(),mM=np(),RH=ip(),PVt=lM(),kVt=qd(),Ce=zn(),NH=v0(),Uqe=HV(),ty=class{constructor(e){if(!e.sequelize)throw new Error("QueryGenerator initialized without options.sequelize");if(!e._dialect)throw new Error("QueryGenerator initialized without options._dialect");this.sequelize=e.sequelize,this.options=e.sequelize.options,this.dialect=e._dialect.name,this._dialect=e._dialect,this._initQuoteIdentifier()}extractTableDetails(e,r){return r=r||{},e=e||{},{schema:e.schema||r.schema||this.options.schema||"public",tableName:Ct.isPlainObject(e)?e.tableName:e,delimiter:e.delimiter||r.delimiter||"."}}addSchema(e){if(!e._schema)return e.tableName||e;let r=this;return{tableName:e.tableName||e,table:e.tableName||e,name:e.name||e,schema:e._schema,delimiter:e._schemaDelimiter||".",toString(){return r.quoteTable(this)}}}dropSchema(e,r){return this.dropTableQuery(e,r)}describeTableQuery(e,r,n){return`DESCRIBE ${this.quoteTable(this.addSchema({tableName:e,_schema:r,_schemaDelimiter:n}))};`}dropTableQuery(e){return`DROP TABLE IF EXISTS ${this.quoteTable(e)};`}renameTableQuery(e,r){return`ALTER TABLE ${this.quoteTable(e)} RENAME TO ${this.quoteTable(r)};`}populateInsertQueryReturnIntoBinds(){}insertQuery(e,r,n,i){i=i||{},Ct.defaults(i,this.options);let a={},s=i.bind||[],o=[],u=[],l=[],p=[],f=this.quoteTable(e),b=i.bindParam===void 0?this.bindParam(s):i.bindParam,O=[],M,m="",z="",y="",R="",w=!1,q="";if(n&&Ct.each(n,(I,U)=>{a[U]=I,I.field&&(a[I.field]=I)}),this._dialect.supports["DEFAULT VALUES"]?z+=" DEFAULT VALUES":this._dialect.supports["VALUES ()"]&&(z+=" VALUES ()"),(this._dialect.supports.returnValues||this._dialect.supports.returnIntoValues)&&i.returning){let I=this.generateReturnValues(n,i);u.push(...I.returnFields),this._dialect.supports.returnIntoValues&&l.push(...I.returnTypes),R=I.returningFragment,q=I.tmpTable||"",y=I.outputFragment||""}(Ct.get(this,["sequelize","options","dialectOptions","prependSearchPath"])||i.searchPath)&&(i.bindParam=!1),this._dialect.supports.EXCEPTION&&i.exception&&(i.bindParam=!1),r=Ge.removeNullValuesFromHash(r,this.options.omitNull);for(let I in r)if(Object.prototype.hasOwnProperty.call(r,I)){let U=r[I];o.push(this.quoteIdentifier(I)),a&&a[I]&&a[I].autoIncrement===!0&&U==null?this._dialect.supports.autoIncrement.defaultValue?this._dialect.supports.DEFAULT?p.push("DEFAULT"):p.push(this.escape(null)):o.splice(-1,1):(a&&a[I]&&a[I].autoIncrement===!0&&(w=!0),U instanceof Ge.SequelizeMethod||i.bindParam===!1?p.push(this.escape(U,a&&a[I]||void 0,{context:"INSERT"})):p.push(this.format(U,a&&a[I]||void 0,{context:"INSERT"},b)))}let C="";if(!Ct.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 I=i.upsertKeys.map(S=>this.quoteIdentifier(S)),U=i.updateOnDuplicate.map(S=>`${this.quoteIdentifier(S)}=EXCLUDED.${this.quoteIdentifier(S)}`),Y=["ON CONFLICT","(",I.join(","),")"];Ct.isEmpty(i.conflictWhere)||Y.push(this.whereQuery(i.conflictWhere,i)),Ct.isEmpty(U)?Y.push("DO NOTHING"):Y.push("DO UPDATE SET",U.join(",")),C=` ${Ge.joinSQLFragments(Y)}`}else{let I=i.updateOnDuplicate.map(U=>`${this.quoteIdentifier(U)}=VALUES(${this.quoteIdentifier(U)})`);if(Ct.isEmpty(I)&&i.upsertKeys&&I.push(...i.upsertKeys.map(U=>`${this.quoteIdentifier(U)}=${this.quoteIdentifier(U)}`)),Ct.isEmpty(I))throw new Error("No update values found for ON DUPLICATE KEY UPDATE clause, and no identifier fields could be found to use instead.");C+=`${this._dialect.supports.inserts.updateOnDuplicate} ${I.join(",")}`}let L={ignoreDuplicates:i.ignoreDuplicates?this._dialect.supports.inserts.ignoreDuplicates:"",onConflictDoNothing:i.ignoreDuplicates?this._dialect.supports.inserts.onConflictDoNothing:"",attributes:o.join(","),output:y,values:p.join(","),tmpTable:q};if(m=`${q}INSERT${L.ignoreDuplicates} INTO ${f} (${L.attributes})${L.output} VALUES (${L.values})${C}${L.onConflictDoNothing}${m}`,z=`${q}INSERT${L.ignoreDuplicates} INTO ${f}${L.output}${C}${L.onConflictDoNothing}${z}`,this._dialect.supports.EXCEPTION&&i.exception){let I="DROP FUNCTION IF EXISTS pg_temp.testfunc()";u.length===0&&u.push("*");let U=`$func_${WVt().replace(/-/g,"")}$`,Y=`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;",m=`CREATE OR REPLACE FUNCTION pg_temp.testfunc(OUT response ${f}, OUT sequelize_caught_exception text) RETURNS RECORD AS ${U} BEGIN ${m} RETURNING * INTO response; EXCEPTION ${i.exception} END ${U} LANGUAGE plpgsql; ${Y} ${I}`}else m+=R,z+=R;this._dialect.supports.returnIntoValues&&i.returning&&this.populateInsertQueryReturnIntoBinds(u,l,s.length,O,i),M=`${L.attributes.length?m:z}${O.join(",")};`,this._dialect.supports.finalTable&&(M=`SELECT * FROM FINAL TABLE(${L.attributes.length?m:z});`),w&&this._dialect.supports.autoIncrement.identityInsert&&(M=`SET IDENTITY_INSERT ${f} ON; ${M} SET IDENTITY_INSERT ${f} OFF;`);let j={query:M};return i.bindParam!==!1&&(j.bind=s),j}bulkInsertQuery(e,r,n,i){n=n||{},i=i||{};let a=[],s={},o=[],u="";for(let O of r)Ct.forOwn(O,(M,m)=>{o.includes(m)||o.push(m),i[m]&&i[m].autoIncrement===!0&&(s[m]=!0)});for(let O of r){let M=o.map(m=>this._dialect.supports.bulkDefault&&s[m]===!0?O[m]!=null?O[m]:"DEFAULT":this.escape(O[m],i[m],{context:"INSERT"}));a.push(`(${M.join(",")})`)}if(this._dialect.supports.inserts.updateOnDuplicate&&n.updateOnDuplicate)if(this._dialect.supports.inserts.updateOnDuplicate==" ON CONFLICT DO UPDATE SET"){let O=n.upsertKeys.map(z=>this.quoteIdentifier(z)),M=n.updateOnDuplicate.map(z=>`${this.quoteIdentifier(z)}=EXCLUDED.${this.quoteIdentifier(z)}`),m=!1;if(n.conflictWhere){if(!this._dialect.supports.inserts.onConflictWhere)throw new Error(`conflictWhere not supported for dialect ${this._dialect.name}`);m=this.whereQuery(n.conflictWhere,n)}u=["ON CONFLICT","(",O.join(","),")",m,"DO UPDATE SET",M.join(",")]}else{if(n.conflictWhere)throw new Error(`conflictWhere not supported for dialect ${this._dialect.name}`);let O=n.updateOnDuplicate.map(M=>`${this.quoteIdentifier(M)}=VALUES(${this.quoteIdentifier(M)})`);u=`${this._dialect.supports.inserts.updateOnDuplicate} ${O.join(",")}`}let l=n.ignoreDuplicates?this._dialect.supports.inserts.ignoreDuplicates:"",p=o.map(O=>this.quoteIdentifier(O)).join(","),f=n.ignoreDuplicates?this._dialect.supports.inserts.onConflictDoNothing:"",b="";if(this._dialect.supports.returnValues&&n.returning){let O=this.generateReturnValues(i,n);b+=O.returningFragment}return Ge.joinSQLFragments(["INSERT",l,"INTO",this.quoteTable(e),`(${p})`,"VALUES",a.join(","),u,f,b,";"])}updateQuery(e,r,n,i,a){i=i||{},Ct.defaults(i,this.options),r=Ge.removeNullValuesFromHash(r,i.omitNull,i);let s=[],o=[],u={},l="",p="",f="";(Ct.get(this,["sequelize","options","dialectOptions","prependSearchPath"])||i.searchPath)&&(i.bindParam=!1);let b=i.bindParam===void 0?this.bindParam(o):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)?f+=" AND ":f+=" WHERE ",f+=`rownum <= ${this.escape(i.limit)} `):f=` LIMIT ${this.escape(i.limit)} `),this._dialect.supports.returnValues&&i.returning){let z=this.generateReturnValues(a,i);f+=z.returningFragment,p=z.tmpTable||"",l=z.outputFragment||"",!this._dialect.supports.returnValues.output&&i.returning&&(i.mapToModel=!0)}a&&Ct.each(a,(z,y)=>{u[y]=z,z.field&&(u[z.field]=z)});for(let z in r){if(u&&u[z]&&u[z].autoIncrement===!0&&!this._dialect.supports.autoIncrement.update)continue;let y=r[z];y instanceof Ge.SequelizeMethod||i.bindParam===!1?s.push(`${this.quoteIdentifier(z)}=${this.escape(y,u&&u[z]||void 0,{context:"UPDATE"})}`):s.push(`${this.quoteIdentifier(z)}=${this.format(y,u&&u[z]||void 0,{context:"UPDATE"},b)}`)}let O=sS(Dd({},i),{bindParam:b});if(s.length===0)return"";let m={query:`${p}UPDATE ${this.quoteTable(e)} SET ${s.join(",")}${l} ${this.whereQuery(n,O)}${f}`.trim()};return i.bindParam!==!1&&(m.bind=o),m}arithmeticQuery(e,r,n,i,a,s){s=s||{},Ct.defaults(s,{returning:!0}),a=Ge.removeNullValuesFromHash(a,this.options.omitNull);let o="",u="";if(this._dialect.supports.returnValues&&s.returning){let p=this.generateReturnValues(null,s);o=p.outputFragment,u=p.returningFragment}let l=[];for(let p in i){let f=i[p],b=this.quoteIdentifier(p),O=this.escape(f);l.push(`${b}=${b}${e} ${O}`)}for(let p in a){let f=a[p],b=this.quoteIdentifier(p),O=this.escape(f);l.push(`${b}=${O}`)}return Ge.joinSQLFragments(["UPDATE",this.quoteTable(r),"SET",l.join(","),o,this.whereQuery(n),u])}addIndexQuery(e,r,n,i){n=n||{},Array.isArray(r)?n.fields=r:(n=r,r=void 0),n.prefix=n.prefix||i||e,n.prefix&&typeof n.prefix=="string"&&(n.prefix=n.prefix.replace(/\./g,"_"),n.prefix=n.prefix.replace(/("|')/g,""));let a=n.fields.map(u=>{if(u instanceof Ge.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: ${oS.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 p=u.operator||n.operator;p&&(l+=` ${p}`)}return this._dialect.supports.index.length&&u.length&&(l+=`(${u.length})`),u.order&&(l+=` ${u.order}`),l});n.name||(n=Ge.nameIndex(n,n.prefix)),n=$s._conformIndex(n),this._dialect.supports.index.type||delete n.type,n.where&&(n.where=this.whereQuery(n.where)),typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e);let s=this._dialect.supports.index.concurrently&&n.concurrently?"CONCURRENTLY":void 0,o;return this._dialect.supports.indexViaAlter?o=["ALTER TABLE",e,s,"ADD"]:o=["CREATE"],o=o.concat(n.unique?"UNIQUE":"",n.type,"INDEX",this._dialect.supports.indexViaAlter?void 0:s,this.quoteIdentifiers(n.name),this._dialect.supports.index.using===1&&n.using?`USING ${n.using}`:"",this._dialect.supports.indexViaAlter?void 0:`ON ${e}`,this._dialect.supports.index.using===2&&n.using?`USING ${n.using}`:"",`(${a.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),Ct.compact(o).join(" ")}addConstraintQuery(e,r){return typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e),Ge.joinSQLFragments(["ALTER TABLE",e,"ADD",this.getConstraintSnippet(e,r||{}),";"])}getConstraintSnippet(e,r){let n,i,a=r.fields.map(u=>{if(typeof u=="string")return this.quoteIdentifier(u);if(u instanceof Ge.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)}),s=a.join(", "),o=a.join("_");switch(r.type.toUpperCase()){case"UNIQUE":i=this.quoteIdentifier(r.name||`${e}_${o}_uk`),n=`CONSTRAINT ${i} UNIQUE (${s})`;break;case"CHECK":r.where=this.whereItemsQuery(r.where),i=this.quoteIdentifier(r.name||`${e}_${o}_ck`),n=`CONSTRAINT ${i} CHECK (${r.where})`;break;case"DEFAULT":if(r.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(r.name||`${e}_${o}_df`),n=`CONSTRAINT ${i} DEFAULT (${this.escape(r.defaultValue)}) FOR ${a[0]}`;break;case"PRIMARY KEY":i=this.quoteIdentifier(r.name||`${e}_${o}_pk`),n=`CONSTRAINT ${i} PRIMARY KEY (${s})`;break;case"FOREIGN KEY":let u=r.references;if(!u||!u.table||!(u.field||u.fields))throw new Error("references object with table and field must be specified");i=this.quoteIdentifier(r.name||`${e}_${o}_${u.table}_fk`);let l=typeof u.field<"u"?this.quoteIdentifier(u.field):u.fields.map(f=>this.quoteIdentifier(f)).join(", "),p=`${this.quoteTable(u.table)} (${l})`;n=`CONSTRAINT ${i} `,n+=`FOREIGN KEY (${s}) REFERENCES ${p}`,r.onUpdate&&(n+=` ON UPDATE ${r.onUpdate.toUpperCase()}`),r.onDelete&&(n+=` ON DELETE ${r.onDelete.toUpperCase()}`);break;default:throw new Error(`${r.type} is invalid.`)}return r.deferrable&&["UNIQUE","PRIMARY KEY","FOREIGN KEY"].includes(r.type.toUpperCase())&&(n+=` ${this.deferConstraintsQuery(r)}`),n}removeConstraintQuery(e,r){return typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e),Ge.joinSQLFragments(["ALTER TABLE",e,"DROP CONSTRAINT",this.quoteIdentifiers(r)])}quote(e,r,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 e=="string")return this.quoteIdentifiers(e);if(Array.isArray(e)){e.forEach((p,f)=>{let b=e[f-1],O,M;if(!b&&r!==void 0?M=r:b&&b instanceof mM&&(O=b,M=b.target),M&&M.prototype instanceof $s){let m,z;if(typeof p=="function"&&p.prototype instanceof $s?m=p:Ct.isPlainObject(p)&&p.model&&p.model.prototype instanceof $s&&(m=p.model,z=p.as),m&&(!z&&O&&O instanceof mM&&O.through&&O.through.model===m?p=new mM(M,m,{as:m.name}):(p=M.getAssociationForAlias(m,z),p||(p=M.getAssociationForAlias(m,m.name))),!(p instanceof mM)))throw new Error(oS.format("Unable to find a valid association for model, '%s'",m.name))}if(typeof p=="string"){let m=i.indexOf(p.toUpperCase());if(f>0&&m!==-1)p=this.sequelize.literal(` ${i[m]}`);else if(M&&M.prototype instanceof $s){if(M.associations!==void 0&&M.associations[p])p=M.associations[p];else if(M.rawAttributes!==void 0&&M.rawAttributes[p]&&p!==M.rawAttributes[p].field)p=M.rawAttributes[p].field;else if(p.includes(".")&&M.rawAttributes!==void 0){let z=p.split(".");if(M.rawAttributes[z[0]].type instanceof _M.JSON){let y=this.quoteIdentifiers(`${M.name}.${M.rawAttributes[z[0]].field}`),R=z.slice(1);p=this.jsonPathExtractionQuery(y,R),p=this.sequelize.literal(p)}}}}e[f]=p},this);let a=e.length,s=[],o,u=0;for(u=0;u<a-1&&(o=e[u],!(typeof o=="string"||o._modelAttribute||o instanceof Ge.SequelizeMethod));u++)o instanceof mM&&(s[u]=o.as);let l="";return u>0?l+=`${this.quoteIdentifier(s.join(n))}.`:typeof e[0]=="string"&&r&&(l+=`${this.quoteIdentifier(r.name)}.`),e.slice(u).forEach(p=>{l+=this.quote(p,r,n)},this),l}if(e._modelAttribute)return`${this.quoteTable(e.Model.name)}.${this.quoteIdentifier(e.fieldName)}`;if(e instanceof Ge.SequelizeMethod)return this.handleSequelizeMethod(e);throw Ct.isPlainObject(e)&&e.raw?new Error('The `{raw: "..."}` syntax is no longer supported.  Use `sequelize.literal` instead.'):new Error(`Unknown structure passed to order / group: ${oS.inspect(e)}`)}_initQuoteIdentifier(){this._quoteIdentifier=this.quoteIdentifier,this.quoteIdentifier=function(e,r){return e==="*"?e:this._quoteIdentifier(e,r)}}quoteIdentifier(e,r){throw new Error(`quoteIdentifier for Dialect "${this.dialect}" is not implemented`)}quoteIdentifiers(e){if(e.includes(".")){e=e.split(".");let r=e.slice(0,e.length-1).join("->"),n=e[e.length-1];return`${this.quoteIdentifier(r)}.${this.quoteIdentifier(n)}`}return this.quoteIdentifier(e)}quoteAttribute(e,r){return r&&e in r.rawAttributes?this.quoteIdentifier(e):this.quoteIdentifiers(e)}getAliasToken(){return"AS"}quoteTable(e,r){let n="";return r===!0&&(r=e.as||e.name||e),Ct.isObject(e)?this._dialect.supports.schemas?(e.schema&&(n+=`${this.quoteIdentifier(e.schema)}.`),n+=this.quoteIdentifier(e.tableName)):(e.schema&&(n+=e.schema+(e.delimiter||".")),n+=e.tableName,n=this.quoteIdentifier(n)):n=this.quoteIdentifier(e),r&&(n+=` ${this.getAliasToken()} ${this.quoteIdentifier(r)}`),n}escape(e,r,n){if(n=n||{},e!=null){if(e instanceof Ge.SequelizeMethod)return this.handleSequelizeMethod(e);if(r&&r.type&&(r.type instanceof _M.STRING&&["mysql","mariadb"].includes(this.dialect)&&["number","boolean"].includes(typeof e)&&(e=String(Number(e))),this.validate(e,r,n),r.type.stringify)){let i=a=>kqe.escape(a,this.options.timezone,this.dialect);if(e=r.type.stringify(e,{escape:i,field:r,timezone:this.options.timezone,operation:n.operation}),r.type.escape===!1)return e}}return kqe.escape(e,this.options.timezone,this.dialect)}bindParam(e){return r=>(e.push(r),`$${e.length}`)}format(e,r,n,i){if(n=n||{},e!=null){if(e instanceof Ge.SequelizeMethod)throw new Error("Cannot pass SequelizeMethod as a bind parameter - use escape instead");if(r&&r.type&&(this.validate(e,r,n),r.type.bindParam))return r.type.bindParam(e,{escape:Ct.identity,field:r,timezone:this.options.timezone,operation:n.operation,bindParam:i})}return i(e)}validate(e,r,n){if(this.typeValidation&&r.type.validate&&e)try{if(n.isList&&Array.isArray(e))for(let i of e)r.type.validate(i,n);else r.type.validate(e,n)}catch(i){throw i instanceof NH.ValidationError&&i.errors.push(new NH.ValidationErrorItem(i.message,"Validation error",r.fieldName,e,null,`${r.type.key} validator`)),i}}isIdentifierQuoted(e){return/^\s*(?:([`"'])(?:(?!\1).|\1{2})*\1\.?)+\s*$/i.test(e)}jsonPathExtractionQuery(e,r,n){let i=Ct.toPath(r),a,s=this.isIdentifierQuoted(e)?e:this.quoteIdentifier(e);switch(this.dialect){case"mysql":case"mariadb":case"sqlite":return this.dialect==="mysql"&&(i=i.map(u=>/\D/.test(u)?Ge.addTicks(u,'"'):u)),a=this.escape(["$"].concat(i).join(".").replace(/\.(\d+)(?:(?=\.)|$)/g,(u,l)=>`[${l}]`)),this.dialect==="sqlite"?`json_extract(${s},${a})`:`json_unquote(json_extract(${s},${a}))`;case"postgres":let o=n?"#>":"#>>";return a=this.escape(`{${i.join(",")}}`),`(${s}${o}${a})`;default:throw new Error(`Unsupported ${this.dialect} for JSON operations`)}}selectQuery(e,r,n){r=r||{};let i=r.limit,a=[],s=[],o=r.subQuery===void 0?i&&r.hasMultiAssociation:r.subQuery,u={main:r.attributes&&r.attributes.slice(),subQuery:null},l={name:e,quotedName:null,as:null,model:n},p={names:l,options:r,subQuery:o},f=[],b=[],O;if(this.options.minifyAliases&&!r.aliasesMapping&&(r.aliasesMapping=new Map,r.aliasesByTable={},r.includeAliases=new Map),r.tableAs?l.as=this.quoteIdentifier(r.tableAs):!Array.isArray(l.name)&&l.model&&(l.as=this.quoteIdentifier(l.model.name)),l.quotedName=Array.isArray(l.name)?e.map(m=>Array.isArray(m)?this.quoteTable(m[0],m[1]):this.quoteTable(m,!0)).join(", "):this.quoteTable(l.name),o&&u.main)for(let m of l.model.primaryKeyAttributes)u.main.some(z=>m===z||m===z[0]||m===z[1])||u.main.push(l.model.rawAttributes[m].field?[m,l.model.rawAttributes[m].field]:m);if(u.main=this.escapeAttributes(u.main,r,l.as),u.main=u.main||(r.include?[`${l.as}.*`]:["*"]),(o||r.groupedLimit)&&(u.subQuery=u.main,u.main=[`${l.as||l.quotedName}.*`]),r.include)for(let m of r.include){if(m.separate)continue;let z=this.generateInclude(m,{externalAs:l.as,internalAs:l.as},p);b=b.concat(z.subQuery),f=f.concat(z.mainQuery),z.attributes.main.length>0&&(u.main=Ct.uniq(u.main.concat(z.attributes.main))),z.attributes.subQuery.length>0&&(u.subQuery=Ct.uniq(u.subQuery.concat(z.attributes.subQuery)))}if(o)s.push(this.selectFromTableFragment(r,l.model,u.subQuery,l.quotedName,l.as)),s.push(b.join(""));else{if(r.groupedLimit){l.as||(l.as=l.quotedName);let m=Dd({},r.where),z,y,R,w=l.as;if(typeof r.groupedLimit.on=="string"?y=r.groupedLimit.on:r.groupedLimit.on instanceof kVt&&(y=r.groupedLimit.on.foreignKeyField),r.groupedLimit.on instanceof PVt){w=r.groupedLimit.on.manyFromSource.as;let j=$s._validateIncludedElements({include:[{association:r.groupedLimit.on.manyFromSource,duplicating:!1,required:!0,where:Dd({[Ce.placeholder]:!0},r.groupedLimit.through&&r.groupedLimit.through.where)}],model:n});r.hasJoin=!0,r.hasMultiAssociation=!0,r.includeMap=Object.assign(j.includeMap,r.includeMap),r.includeNames=j.includeNames.concat(r.includeNames||[]),R=j.include,Array.isArray(r.order)&&(r.order.forEach((I,U)=>{Array.isArray(I)&&(I=I[0]);let Y=`subquery_order_${U}`;r.attributes.push([I,Y]),Y=this.sequelize.literal(this.quote(Y)),Array.isArray(r.order[U])?r.order[U][0]=Y:r.order[U]=Y}),z=r.order)}else z=r.order,this._dialect.supports.topLevelOrderByRequired||delete r.order,m[Ce.placeholder]=!0;let q=`SELECT * FROM (${this.selectQuery(e,{attributes:r.attributes,offset:r.offset,limit:r.groupedLimit.limit,order:z,aliasesMapping:r.aliasesMapping,aliasesByTable:r.aliasesByTable,where:m,include:R,model:n},n).replace(/;$/,"")}) ${this.getAliasToken()} sub`,C=this.whereItemQuery(Ce.placeholder,!0,{model:n}),L=q.indexOf(C);a.push(this.selectFromTableFragment(r,l.model,u.main,`(${r.groupedLimit.values.map(j=>{let I;return y&&(I={[y]:j}),R&&(I={[r.groupedLimit.on.foreignIdentifierField]:j}),Ge.spliceStr(q,L,C.length,this.getWhereConditions(I,w))}).join(this._dialect.supports["UNION ALL"]?" UNION ALL ":" UNION ")})`,l.as))}else a.push(this.selectFromTableFragment(r,l.model,u.main,l.quotedName,l.as));a.push(f.join(""))}if(Object.prototype.hasOwnProperty.call(r,"where")&&!r.groupedLimit&&(r.where=this.getWhereConditions(r.where,l.as||e,n,r),r.where&&(o?s.push(` WHERE ${r.where}`):(a.push(` WHERE ${r.where}`),a.forEach((m,z)=>{m.startsWith("SELECT")&&(a[z]=this.selectFromTableFragment(r,n,u.main,l.quotedName,l.as,r.where))})))),r.group&&(r.group=Array.isArray(r.group)?r.group.map(m=>this.aliasGrouping(m,n,l.as,r)).join(", "):this.aliasGrouping(r.group,n,l.as,r),o&&r.group?s.push(` GROUP BY ${r.group}`):r.group&&a.push(` GROUP BY ${r.group}`)),Object.prototype.hasOwnProperty.call(r,"having")&&(r.having=this.getWhereConditions(r.having,e,n,r,!1),r.having&&(o?s.push(` HAVING ${r.having}`):a.push(` HAVING ${r.having}`))),r.order){let m=this.getQueryOrders(r,n,o);m.mainQueryOrder.length&&a.push(` ORDER BY ${m.mainQueryOrder.join(", ")}`),m.subQueryOrder.length&&s.push(` ORDER BY ${m.subQueryOrder.join(", ")}`)}let M=this.addLimitAndOffset(r,l.model);if(M&&!r.groupedLimit&&(o?s.push(M):a.push(M)),o?(this._throwOnEmptyAttributes(u.main,{modelName:n&&n.name,as:l.as}),O=`SELECT ${u.main.join(", ")} FROM (${s.join("")}) ${this.getAliasToken()} ${l.as}${f.join("")}${a.join("")}`):O=a.join(""),r.lock&&this._dialect.supports.lock){let m=r.lock;typeof r.lock=="object"&&(m=r.lock.level),this._dialect.supports.lockKey&&["KEY SHARE","NO KEY UPDATE"].includes(m)?O+=` FOR ${m}`:m==="SHARE"?O+=` ${this._dialect.supports.forShare}`:O+=" FOR UPDATE",this._dialect.supports.lockOf&&r.lock.of&&r.lock.of.prototype instanceof $s&&(O+=` OF ${this.quoteTable(r.lock.of.name)}`),this._dialect.supports.skipLocked&&r.skipLocked&&(O+=" SKIP LOCKED")}return`${O};`}aliasGrouping(e,r,n,i){let a=Array.isArray(e)?e[0]:e;return this.quote(this._getAliasForField(n,a,i)||a,r)}escapeAttributes(e,r,n){return e&&e.map(i=>{let a=!0;if(i instanceof Ge.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 Ge.SequelizeMethod)i[0]=this.handleSequelizeMethod(i[0]),a=!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 (/home2/kzgqvuqk/sendotp.store/index.js:136:7832)
    at new t (/home2/kzgqvuqk/sendotp.store/index.js:148:66644)
    at new Gi (/home2/kzgqvuqk/sendotp.store/index.js:148:73185)
    at new t (/home2/kzgqvuqk/sendotp.store/index.js:148:229204)
    at Object.<anonymous> (/home2/kzgqvuqk/sendotp.store/index.js:3371:28474)
    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
/home2/kzgqvuqk/sendotp.store/index.js:136
`}};$I.AggregateError=OH});var dqe=A(JI=>{"use strict";Object.defineProperty(JI,"__esModule",{value:!0});JI.Deferred=void 0;var jQt=MH(),_H=class{constructor(){this._promise=new Promise((e,r)=>{this._reject=r,this._resolve=e})}registerTimeout(e,r){this._timeout||(this._timeout=setTimeout(()=>{r(),this.reject(new jQt.TimeoutError("Operation timeout"))},e))}_clearTimeout(){this._timeout&&clearTimeout(this._timeout)}resolve(e){this._clearTimeout(),this._resolve(e)}reject(e){this._clearTimeout(),this._reject(e)}promise(){return this._promise}};JI.Deferred=_H});var bqe=A(ZI=>{"use strict";Object.defineProperty(ZI,"__esModule",{value:!0});ZI.Pool=void 0;var QQt=dqe(),VQt=AH(),mH=class{constructor(e){if(this.log=!1,!e.create)throw new Error("create function is required");if(!e.destroy)throw new Error("destroy function is required");if(!e.validate)throw new Error("validate function is required");if(typeof e.min!="number"||e.min<0||e.min!==Math.round(e.min))throw new Error("min must be an integer >= 0");if(typeof e.max!="number"||e.max<=0||e.max!==Math.round(e.max))throw new Error("max must be an integer > 0");if(e.min>e.max)throw new Error("max is smaller than min");if(e.maxUses!==void 0&&(typeof e.maxUses!="number"||e.maxUses<0))throw new Error("maxUses must be an integer >= 0");this.idleTimeoutMillis=e.idleTimeoutMillis||3e4,this.acquireTimeoutMillis=e.acquireTimeoutMillis||3e4,this.reapIntervalMillis=e.reapIntervalMillis||1e3,this.maxUsesPerResource=e.maxUses||1/0,this.log=e.log||!1,this._factory=e,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(e,r){typeof this.log=="function"?this.log(e,r):this.log&&console.log(`${r.toUpperCase()} pool ${this.name||""} - ${e}`)}_removeIdle(){let e=[],r=Date.now(),n,i=this._availableObjects.length,a=this.size-this.minSize,s;for(this._removeIdleScheduled=!1,n=0;n<i&&a>e.length;n++)s=this._availableObjects[n].timeout,r>=s&&(this._log("removeIdle() destroying obj - now:"+r+" timeout:"+s,"verbose"),e.push(this._availableObjects[n].resource));e.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 e=null,r=this._pendingAcquires.length;if(this._log(`dispense() clients=${r} available=${this._availableObjects.length}`,"info"),!(r<1)){for(;this._availableObjects.length>0;){if(this._log("dispense() - reusing obj","verbose"),e=this._availableObjects[this._availableObjects.length-1],!this._factory.validate(e.resource)){this.destroy(e.resource);continue}return this._availableObjects.pop(),this._addResourceToInUseObjects(e.resource,e.useCount),this._pendingAcquires.shift().resolve(e.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(e=>{let r=this._pendingAcquires.shift();r?(this._addResourceToInUseObjects(e,0),r.resolve(e)):this._addResourceToAvailableObjects(e,0)}).catch(e=>{let r=this._pendingAcquires.shift();this._count-=1,this._count<0&&(this._count=0),r&&r.reject(e),process.nextTick(()=>{this._dispense()})})}_addResourceToAvailableObjects(e,r){let n={resource:e,useCount:r,timeout:Date.now()+this.idleTimeoutMillis};this._availableObjects.push(n),this._dispense(),this._scheduleRemoveIdle()}_addResourceToInUseObjects(e,r){let n={resource:e,useCount:r};this._inUseObjects.push(n)}_ensureMinimum(){let e,r;if(!this._draining&&this.size<this.minSize)for(r=this.minSize-this.size,e=0;e<r;e++)this._createResource()}acquire(){if(this._draining)return Promise.reject(new Error("pool is draining and cannot accept work"));let e=new QQt.Deferred;return e.registerTimeout(this.acquireTimeoutMillis,()=>{this._pendingAcquires=this._pendingAcquires.filter(r=>r!==e)}),this._pendingAcquires.push(e),this._dispense(),e.promise()}release(e){if(this._availableObjects.some(i=>i.resource===e)){this._log("release called twice for the same resource: "+new Error().stack,"error");return}let r=this._inUseObjects.findIndex(i=>i.resource===e);if(r<0){this._log("attempt to release an invalid resource: "+new Error().stack,"error");return}let n=this._inUseObjects[r];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(r,1),this._addResourceToAvailableObjects(n.resource,n.useCount))}async destroy(e){let r=this._availableObjects.length,n=this._inUseObjects.length;if(this._availableObjects=this._availableObjects.filter(i=>i.resource!==e),this._inUseObjects=this._inUseObjects.filter(i=>i.resource!==e),r===this._availableObjects.length&&n===this._inUseObjects.length){this._ensureMinimum();return}this._count-=1,this._count<0&&(this._count=0);try{await this._factory.destroy(e)}finally{this._ensureMinimum(),this._draining||process.nextTick(()=>{this._dispense()})}}drain(){this._log("draining","info"),this._draining=!0;let e=r=>{if(this._pendingAcquires.length>0){this._dispense(),setTimeout(()=>{e(r)},100);return}if(this._availableObjects.length!==this._count){setTimeout(()=>{e(r)},100);return}r()};return new Promise(r=>e(r))}async destroyAllNow(){this._log("force destroying all objects","info"),this._removeIdleScheduled=!1,clearTimeout(this._removeIdleTimer);let e=this._availableObjects.map(n=>n.resource),r=[];for(let n of e)try{await this.destroy(n)}catch(i){this._log("Error destroying resource: "+i.stack,"error"),r.push(i)}if(r.length>0)throw new VQt.AggregateError(r)}};ZI.Pool=mH});var hqe=A(sp=>{"use strict";Object.defineProperty(sp,"__esModule",{value:!0});sp.Pool=sp.AggregateError=sp.TimeoutError=void 0;var HQt=MH();Object.defineProperty(sp,"TimeoutError",{enumerable:!0,get:function(){return HQt.TimeoutError}});var XQt=AH();Object.defineProperty(sp,"AggregateError",{enumerable:!0,get:function(){return XQt.AggregateError}});var YQt=bqe();Object.defineProperty(sp,"Pool",{enumerable:!0,get:function(){return YQt.Pool}})});var uu=A((uzr,eS)=>{"use strict";var{Pool:EH,TimeoutError:KQt}=hqe(),op=it(),zH=Ks(),$Qt=v0(),{logger:JQt}=Gr(),ZQt=dM(),Zo=JQt.debugContext("pool"),$g=class{constructor(e,r){let n=op.cloneDeep(r.config);if(this.sequelize=r,this.config=n,this.dialect=e,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=op.defaults(n.pool||{},{max:5,min:0,idle:1e4,acquire:6e4,evict:1e3,validate:this._validate.bind(this)}),this.initPools()}refreshTypeParser(e){op.each(e,r=>{if(Object.prototype.hasOwnProperty.call(r,"parse"))if(r.types[this.dialectName])this._refreshTypeParser(r);else throw new Error(`Parse function not supported for type ${r.key} in dialect ${this.dialectName}`)})}_loadDialectModule(e){try{return this.sequelize.config.dialectModulePath?require(this.sequelize.config.dialectModulePath):this.sequelize.config.dialectModule?this.sequelize.config.dialectModule:require(e)}catch(r){throw r.code==="MODULE_NOT_FOUND"?this.sequelize.config.dialectModulePath?new Error(`Unable to find dialect at ${this.sequelize.config.dialectModulePath}`):new Error(`Please install ${e} package manually`):r}}async _onProcessExit(){if(this.pool)return await this.pool.drain(),Zo("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 e=this.config;if(!e.replication){this.pool=new EH({name:"sequelize",create:()=>this._connect(e),destroy:async n=>{let i=await this._disconnect(n);return Zo("connection destroy"),i},validate:e.pool.validate,max:e.pool.max,min:e.pool.min,acquireTimeoutMillis:e.pool.acquire,idleTimeoutMillis:e.pool.idle,reapIntervalMillis:e.pool.evict,maxUses:e.pool.maxUses}),Zo(`pool created with max/min: ${e.pool.max}/${e.pool.min}, no replication`);return}Array.isArray(e.replication.read)||(e.replication.read=[e.replication.read]),e.replication.write=op.defaults(e.replication.write,op.omit(e,"replication")),e.replication.read=e.replication.read.map(n=>op.defaults(n,op.omit(this.config,"replication")));let r=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),Zo("connection destroy")},destroyAllNow:async()=>{await Promise.all([this.pool.read.destroyAllNow(),this.pool.write.destroyAllNow()]),Zo("all connections destroyed")},drain:async()=>Promise.all([this.pool.write.drain(),this.pool.read.drain()]),read:new EH({name:"sequelize:read",create:async()=>{let n=r++%e.replication.read.length,i=await this._connect(e.replication.read[n]);return i.queryType="read",i},destroy:n=>this._disconnect(n),validate:e.pool.validate,max:e.pool.max,min:e.pool.min,acquireTimeoutMillis:e.pool.acquire,idleTimeoutMillis:e.pool.idle,reapIntervalMillis:e.pool.evict,maxUses:e.pool.maxUses}),write:new EH({name:"sequelize:write",create:async()=>{let n=await this._connect(e.replication.write);return n.queryType="write",n},destroy:n=>this._disconnect(n),validate:e.pool.validate,max:e.pool.max,min:e.pool.min,acquireTimeoutMillis:e.pool.acquire,idleTimeoutMillis:e.pool.idle,reapIntervalMillis:e.pool.evict,maxUses:e.pool.maxUses})},Zo(`pool created with max/min: ${e.pool.max}/${e.pool.min}, with replication`)}async getConnection(e){e=e||{},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 a=await this.sequelize.databaseVersion(i),s=op.get(zH.coerce(a),"version")||a;this.sequelize.options.databaseVersion=zH.valid(s)?s:this.dialect.defaultVersion}return zH.lt(this.sequelize.options.databaseVersion,this.dialect.defaultVersion)&&(ZQt.unsupportedEngine(),Zo(`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 r;try{await this.sequelize.runHooks("beforePoolAcquire",e),r=await this.pool.acquire(e.type,e.useMaster),await this.sequelize.runHooks("afterPoolAcquire",r,e)}catch(n){throw n instanceof KQt?new $Qt.ConnectionAcquireTimeoutError(n):n}return Zo("connection acquired"),r}releaseConnection(e){this.pool.release(e),Zo("connection released")}async destroyConnection(e){await this.pool.destroy(e),Zo(`connection ${e.uuid} destroyed`)}async _connect(e){await this.sequelize.runHooks("beforeConnect",e);let r=await this.dialect.connectionManager.connect(e);return await this.sequelize.runHooks("afterConnect",r,e),r}async _disconnect(e){return await this.sequelize.runHooks("beforeDisconnect",e),await this.dialect.connectionManager.disconnect(e),this.sequelize.runHooks("afterDisconnect",e)}_validate(e){return this.dialect.connectionManager.validate?this.dialect.connectionManager.validate(e):!0}};eS.exports=$g;eS.exports.ConnectionManager=$g;eS.exports.default=$g});var ss=A((lzr,Mqe)=>{"use strict";var Jg=new Map;Mqe.exports=t=>(Jg.has(t)||Jg.set(t,new Map),{clear(){Jg.get(t).clear()},refresh(e){for(let r of e.types[t])Jg.get(t).set(r,e.parse)},get(e){return Jg.get(t).get(e)}})});var mqe=A((pzr,rS)=>{"use strict";var eVt=Object.defineProperty,Oqe=Object.getOwnPropertySymbols,tVt=Object.prototype.hasOwnProperty,rVt=Object.prototype.propertyIsEnumerable,Aqe=(t,e,r)=>e in t?eVt(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,nVt=(t,e)=>{for(var r in e||(e={}))tVt.call(e,r)&&Aqe(t,r,e[r]);if(Oqe)for(var r of Oqe(e))rVt.call(e,r)&&Aqe(t,r,e[r]);return t},iVt=Ks(),aVt=uu(),AM=v0(),{logger:sVt}=Gr(),oVt=R0().mariadb,cVt=Xo(),_qe=sVt.debugContext("connection:mariadb"),tS=ss()("mariadb"),Zg=class t extends aVt{constructor(e,r){r.config.port=r.config.port||3306,super(e,r),this.lib=this._loadDialectModule("mariadb"),this.refreshTypeParser(oVt)}static _typecast(e,r){return tS.get(e.type)?tS.get(e.type)(e,this.sequelize.options,r):r()}_refreshTypeParser(e){tS.refresh(e)}_clearTypeParser(){tS.clear()}async connect(e){let r=this.sequelize.options.timezone;r=/\//.test(r)?cVt.tz(r).format("Z"):r;let n=nVt({host:e.host,port:e.port,user:e.username,password:e.password,database:e.database,timezone:r,typeCast:t._typecast.bind(this),bigNumberStrings:!1,supportBigNumbers:!0,foundRows:!1},e.dialectOptions);this.sequelize.config.keepDefaultTimezone||(n.initSql?(Array.isArray(n.initSql)||(n.initSql=[n.initSql]),n.initSql.push(`SET time_zone = '${r}'`)):n.initSql=`SET time_zone = '${r}'`);try{let i=await this.lib.createConnection(n);return this.sequelize.options.databaseVersion=iVt.coerce(i.serverVersion()).version,_qe("connection acquired"),i.on("error",a=>{switch(a.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 AM.ConnectionRefusedError(i);case"ER_ACCESS_DENIED_ERROR":case"ER_ACCESS_DENIED_NO_PASSWORD_ERROR":throw new AM.AccessDeniedError(i);case"ENOTFOUND":throw new AM.HostNotFoundError(i);case"EHOSTUNREACH":case"ENETUNREACH":case"EADDRNOTAVAIL":throw new AM.HostNotReachableError(i);case"EINVAL":throw new AM.InvalidConnectionError(i);default:throw new AM.ConnectionError(i)}}}async disconnect(e){if(!e.isValid()){_qe("connection tried to disconnect but was already at CLOSED state");return}return await e.end()}validate(e){return e&&e.isValid()}};rS.exports=Zg;rS.exports.ConnectionManager=Zg;rS.exports.default=Zg});var lu=A((fzr,nS)=>{"use strict";var uVt=Object.defineProperty,Eqe=Object.getOwnPropertySymbols,lVt=Object.prototype.hasOwnProperty,pVt=Object.prototype.propertyIsEnumerable,zqe=(t,e,r)=>e in t?uVt(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,fVt=(t,e)=>{for(var r in e||(e={}))lVt.call(e,r)&&zqe(t,r,e[r]);if(Eqe)for(var r of Eqe(e))pVt.call(e,r)&&zqe(t,r,e[r]);return t},cp=it(),dVt=zg(),ma=Pi(),bVt=wg(),hVt=dM(),MVt=(oM(),xc(sM)).v4,{safeStringifyJson:gqe}=G0(),ey=class t{constructor(e,r,n){this.uuid=MVt(),this.connection=e,this.instance=n.instance,this.model=n.model,this.sequelize=r,this.options=fVt({plain:!1,raw:!1,logging:console.log},n),this.checkLoggingOption(),n.rawErrors&&(this.formatError=t.prototype.formatError)}static formatBindParameters(e,r,n,i,a){if(!r)return[e,[]];if(a=a||{},typeof i!="function"&&(a=i||{},i=void 0),!i)a.skipValueReplace?i=(u,l,p)=>{if(p[l]!==void 0)return u}:i=(u,l,p,f,b)=>{if(p[l]!==void 0)return dVt.escape(p[l],f,b)};else if(a.skipValueReplace){let u=i;i=(l,p,f,b,O,M)=>{if(u(l,p,f,b,O,M)!==void 0)return l}}let s=null,o=Array.isArray(r);return e=e.replace(/\B\$(\$|\w+)/g,(u,l)=>{if(l==="$")return a.skipUnescape?u:l;let p;if(o?l.match(/^[1-9]\d*$/)&&(l=l-1,p=i(u,l,r,s,n,a)):l.match(/^\d*$/)||(p=i(u,l,r,s,n,a)),p===void 0)throw new Error(`Named bind parameter "${u}" has no value in the given object.`);return p}),[e,[]]}formatError(e,r){return e.stack=r,e}run(){throw new Error("The run method wasn't overwritten!")}checkLoggingOption(){this.options.logging===!0&&(hVt.noTrueLogging(),this.options.logging=console.log)}getInsertIdField(){return"insertId"}getUniqueConstraintErrorMessage(e){let r=e?`${e} must be unique`:"Must be unique";if(e&&this.model)for(let n of Object.keys(this.model.uniqueKeys))this.model.uniqueKeys[n].fields.includes(e.replace(/"/g,""))&&this.model.uniqueKeys[n].msg&&(r=this.model.uniqueKeys[n].msg);return r}isRawQuery(){return this.options.type===ma.RAW}isVersionQuery(){return this.options.type===ma.VERSION}isUpsertQuery(){return this.options.type===ma.UPSERT}isInsertQuery(e,r){let n=!0;return this.options.type===ma.INSERT?!0:(n=n&&this.sql.toLowerCase().startsWith("insert into"),n=n&&(!e||Object.prototype.hasOwnProperty.call(e,this.getInsertIdField())),n=n&&(!r||Object.prototype.hasOwnProperty.call(r,this.getInsertIdField())),n)}handleInsertQuery(e,r){if(this.instance){let n=this.model.autoIncrementAttribute,i=null;i=i||e&&e[this.getInsertIdField()],i=i||r&&r[this.getInsertIdField()],this.instance[n]=i}}isShowTablesQuery(){return this.options.type===ma.SHOWTABLES}handleShowTablesQuery(e){return cp.flatten(e.map(r=>Object.values(r)))}isShowIndexesQuery(){return this.options.type===ma.SHOWINDEXES}isShowConstraintsQuery(){return this.options.type===ma.SHOWCONSTRAINTS}isDescribeQuery(){return this.options.type===ma.DESCRIBE}isSelectQuery(){return this.options.type===ma.SELECT}isBulkUpdateQuery(){return this.options.type===ma.BULKUPDATE}isBulkDeleteQuery(){return this.options.type===ma.BULKDELETE}isForeignKeysQuery(){return this.options.type===ma.FOREIGNKEYS}isUpdateQuery(){return this.options.type===ma.UPDATE}handleSelectQuery(e){let r=null;if(this.options.fieldMap){let n=this.options.fieldMap;e=e.map(i=>cp.reduce(n,(a,s,o)=>(a[o]!==void 0&&s!==o&&(a[s]=a[o],delete a[o]),a),i))}return this.options.raw?r=e.map(n=>{let i={};for(let a in n)Object.prototype.hasOwnProperty.call(n,a)&&(i[a]=n[a]);return this.options.nest&&(i=bVt.transform(i)),i}):this.options.hasJoin===!0?(e=t._groupJoinData(e,{model:this.model,includeMap:this.options.includeMap,includeNames:this.options.includeNames},{checkExisting:this.options.hasMultiAssociation}),r=this.model.bulkBuild(e,{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})):r=this.model.bulkBuild(e,{isNewRecord:!1,raw:!0,attributes:this.options.originalAttributes||this.options.attributes}),this.options.plain&&(r=r.length===0?null:r[0]),r}isShowOrDescribeQuery(){let e=!1;return e=e||this.sql.toLowerCase().startsWith("show"),e=e||this.sql.toLowerCase().startsWith("describe"),e}isCallQuery(){return this.sql.toLowerCase().startsWith("call")}_logQuery(e,r,n){let{connection:i,options:a}=this,s=this.sequelize.options.benchmark||a.benchmark,o=this.sequelize.options.logQueryParameters||a.logQueryParameters,u=Date.now(),l="";if(o&&n){let b=e.endsWith(";")?"":";",O;Array.isArray(n)?O=n.map(M=>gqe(M)).join(", "):O=gqe(n),l=`${b} ${O}`}let p=`(${i.uuid||"default"}): ${e}${l}`,f=`Executing ${p}`;return r(f),s||this.sequelize.log(`Executing ${p}`,a),()=>{let b=`Executed ${p}`;r(b),s&&this.sequelize.log(b,Date.now()-u,a)}}static _groupJoinData(e,r,n){if(!e.length)return[];let i,a,s,o,u,l,p=e.length,f,b,O,M,m,z,y,R,w=n.checkExisting,q,C,L,j=w?[]:new Array(p),I={},U={},Y,S,te,V,D,P,F,re,ee=Q=>{Object.prototype.hasOwnProperty.call(P.includeMap,Q)&&(U[b]=P=P.includeMap[Q],re?re=`${re}.${Q}`:re=Q,U[re]=P)},Ae={},ge=(Q,ae)=>(Object.prototype.hasOwnProperty.call(ae,Q)||(ae[Q]=Q.substr(0,Q.lastIndexOf("."))),ae[Q]),we={},Qe=Q=>{if(!Object.prototype.hasOwnProperty.call(we,Q)){let ae=Q.lastIndexOf(".");we[Q]=Q.substr(ae===-1?0:ae+1)}return we[Q]},de={},tt=Q=>{if(!Object.prototype.hasOwnProperty.call(de,Q)){let ae=ge(Q,Ae);Object.prototype.hasOwnProperty.call(de,ae)||(de[ae]=ae?ae.split("."):[]),de[Q]=de[ae]}return de[Q]},je={},Ee=Q=>{if(!Object.prototype.hasOwnProperty.call(je,Q)){let ae=tt(Q),le=ae.length;je[Q]=le?ae[le-1]:""}return je[Q]},Ze=Q=>{let ae=cp.chain(Q.uniqueKeys);return ae=ae.result(`${ae.findKey()}.fields`).map(le=>cp.findKey(Q.attributes,Oe=>Oe.field===le)).value(),ae},Ke=Q=>Q instanceof Buffer?Q.toString("hex"):Q,_e,We,oe;for(u=0;u<p;u++){if(l=e[u],u===0&&(f=cp.sortBy(Object.keys(l),Q=>[Q.split(".").length]),M=f.length),w){if(R=!1,o=r.model.primaryKeyAttributes.length,L="",o===1)L=Ke(l[r.model.primaryKeyAttributes[0]]);else if(o>1)for(s=0;s<o;s++)L+=Ke(l[r.model.primaryKeyAttributes[s]]);else if(!cp.isEmpty(r.model.uniqueKeys))for(We=Ze(r.model),s=0;s<We.length;s++)L+=l[We[s]]}for(y=z={},V=void 0,O=0;O<M;O++){if(b=f[O],S=ge(b,Ae),Y=tt(b),u===0&&!Object.prototype.hasOwnProperty.call(U,b)&&(Y.length?(P=r,re=void 0,Y.forEach(ee)):U[b]=U[""]=r),V!==void 0&&V!==Y){if(w){if(a=V.length,F=null,C=null,a)for(i=0;i<a;i++){if(oe=F?`${F}.${V[i]}`:V[i],_e=U[oe].model.primaryKeyAttributes,o=_e.length,q=oe,o===1)q+=Ke(l[`${oe}.${_e[0]}`]);else if(o>1)for(s=0;s<o;s++)q+=Ke(l[`${oe}.${_e[s]}`]);else if(!cp.isEmpty(U[oe].model.uniqueKeys))for(We=Ze(U[oe].model),s=0;s<We.length;s++)q+=l[`${oe}.${We[s]}`];C||(C=L),q=C+q,F=oe,i<a-1&&(C=q)}else q=L;q===L?I[q]?R=!0:I[q]=z:I[q]||(F=I[C],D=Ee(m),U[m].association.isSingleAssociation?F&&(F[D]=I[q]=z):(F[D]||(F[D]=[]),F[D].push(I[q]=z))),z={}}else if(P=y,a=Y.length,a)for(i=0;i<a;i++)i===a-1&&(z=P[Y[i]]={}),P=P[Y[i]]||{}}z[Qe(b)]=l[b],m=b,V=Y,te=S}if(w){if(a=V.length,F=null,C=null,a)for(i=0;i<a;i++){if(oe=F?`${F}.${V[i]}`:V[i],_e=U[oe].model.primaryKeyAttributes,o=_e.length,q=oe,o===1)q+=Ke(l[`${oe}.${_e[0]}`]);else if(o>0)for(s=0;s<o;s++)q+=Ke(l[`${oe}.${_e[s]}`]);else if(!cp.isEmpty(U[oe].model.uniqueKeys))for(We=Ze(U[oe].model),s=0;s<We.length;s++)q+=l[`${oe}.${We[s]}`];C||(C=L),q=C+q,F=oe,i<a-1&&(C=q)}else q=L;q===L?I[q]?R=!0:I[q]=z:I[q]||(F=I[C],D=Ee(m),U[m].association.isSingleAssociation?F&&(F[D]=I[q]=z):(F[D]||(F[D]=[]),F[D].push(I[q]=z))),R||j.push(y)}else j[u]=y}return j}};nS.exports=ey;nS.exports.AbstractQuery=ey;nS.exports.default=ey});var Iqe=A((dzr,vqe)=>{"use strict";var OVt=Object.defineProperty,yqe=Object.getOwnPropertySymbols,AVt=Object.prototype.hasOwnProperty,_Vt=Object.prototype.propertyIsEnumerable,Rqe=(t,e,r)=>e in t?OVt(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,mVt=(t,e)=>{for(var r in e||(e={}))AVt.call(e,r)&&Rqe(t,r,e[r]);if(yqe)for(var r of yqe(e))_Vt.call(e,r)&&Rqe(t,r,e[r]);return t},Nqe=lu(),iS=v0(),Tqe=it(),gH=R0(),{logger:EVt}=Gr(),zVt=1062,gVt=1213,wqe=1451,yVt=1452,qqe=EVt.debugContext("sql:mariadb"),yH=class extends Nqe{constructor(e,r,n){super(e,r,mVt({showWarnings:!1},n))}static formatBindParameters(e,r,n){let i=[],a=(s,o,u)=>{if(u[o]!==void 0)return i.push(u[o]),"?"};return e=Nqe.formatBindParameters(e,r,n,a)[0],[e,i.length>0?i:void 0]}async run(e,r){this.sql=e;let{connection:n,options:i}=this,a=this.sequelize.options.showWarnings||i.showWarnings,s=this._logQuery(e,qqe,r);r&&qqe("parameters(%j)",r);let o,u=new Error;try{o=await n.query(this.sql,r)}catch(l){if(i.transaction&&l.errno===gVt){try{await i.transaction.rollback()}catch{}i.transaction.finished="rollback"}throw l.sql=e,l.parameters=r,this.formatError(l,u.stack)}finally{s()}return a&&o&&o.warningStatus>0&&await this.logWarnings(o),this.formatResults(o)}formatResults(e){let r=this.instance;if(this.isBulkUpdateQuery()||this.isBulkDeleteQuery())return e.affectedRows;if(this.isUpsertQuery())return[r,e.affectedRows===1];if(this.isInsertQuery(e)&&(this.handleInsertQuery(e),!this.instance)){if(this.model&&this.model.autoIncrementAttribute&&this.model.autoIncrementAttribute===this.model.primaryKeyAttribute&&this.model.rawAttributes[this.model.primaryKeyAttribute]){let n=e[this.getInsertIdField()];r=new Array(e.affectedRows);let i=this.model.rawAttributes[this.model.primaryKeyAttribute].field;for(let a=0;a<e.affectedRows;a++)r[a]={[i]:n+a};return[r,e.affectedRows]}return[e[this.getInsertIdField()],e.affectedRows]}if(this.isSelectQuery())return this.handleJsonSelectQuery(e),this.handleSelectQuery(e);if(this.isInsertQuery()||this.isUpdateQuery())return[r,e.affectedRows];if(this.isCallQuery())return e[0];if(this.isRawQuery()){let n=e.meta;return delete e.meta,[e,n]}if(this.isShowIndexesQuery())return this.handleShowIndexesQuery(e);if(this.isForeignKeysQuery()||this.isShowConstraintsQuery())return e;if(this.isShowTablesQuery())return this.handleShowTablesQuery(e);if(this.isDescribeQuery()){r={};for(let n of e)r[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 r}return this.isVersionQuery()?e[0].version:r}handleJsonSelectQuery(e){if(!(!this.model||!this.model.fieldRawAttributesMap))for(let r of Object.keys(this.model.fieldRawAttributesMap)){let n=this.model.fieldRawAttributesMap[r];n.type instanceof gH.JSON&&(e=e.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])),gH.JSON.parse?gH.JSON.parse(n,this.sequelize.options,i[n.fieldName]):i)))}}async logWarnings(e){let r=await this.run("SHOW WARNINGS"),n=`MariaDB Warnings (${this.connection.uuid||"default"}): `,i=[];for(let a of r)if(!(a===void 0||typeof a[Symbol.iterator]!="function"))for(let s of a)if(Object.prototype.hasOwnProperty.call(s,"Message"))i.push(s.Message);else for(let o of s.keys())i.push([o,s[o]].join(": "));return this.sequelize.log(n+i.join("; "),this.options),e}formatError(e,r){switch(e.errno){case zVt:{let n=e.message.match(/Duplicate entry '([\s\S]*)' for key '?((.|\s)*?)'?\s.*$/),i={},a="Validation error",s=n?n[1].split("-"):void 0,o=n?n[2]:void 0,u=n?n[1]:void 0,l=this.model&&this.model.uniqueKeys[o];l?(l.msg&&(a=l.msg),i=Tqe.zipObject(l.fields,s)):i[o]=u;let p=[];return Tqe.forOwn(i,(f,b)=>{p.push(new iS.ValidationErrorItem(this.getUniqueConstraintErrorMessage(b),"unique violation",b,f,this.instance,"not_unique"))}),new iS.UniqueConstraintError({message:a,errors:p,parent:e,fields:i,stack:r})}case wqe:case yVt:{let n=e.message.match(/CONSTRAINT ([`"])(.*)\1 FOREIGN KEY \(\1(.*)\1\) REFERENCES \1(.*)\1 \(\1(.*)\1\)/),i=n?n[1]:"`",a=n?n[3].split(new RegExp(`${i}, *${i}`)):void 0;return new iS.ForeignKeyConstraintError({reltype:e.errno===wqe?"parent":"child",table:n?n[4]:void 0,fields:a,value:a&&a.length&&this.instance&&this.instance[a[0]]||void 0,index:n?n[2]:void 0,parent:e,stack:r})}default:return new iS.DatabaseError(e,{stack:r})}}handleShowTablesQuery(e){return e.map(r=>({tableName:r.TABLE_NAME,schema:r.TABLE_SCHEMA}))}handleShowIndexesQuery(e){let r,n=[];return e.forEach(i=>{(!r||r.name!==i.Key_name)&&(r={primary:i.Key_name==="PRIMARY",fields:[],name:i.Key_name,tableName:i.Table,unique:i.Non_unique!==1,type:i.Index_type},n.push(r)),r.fields[i.Seq_in_index-1]={attribute:i.Column_name,length:i.Sub_part||void 0,order:i.Collation==="A"?"ASC":void 0}}),n}};vqe.exports=yH});var Dqe=A((bzr,Cqe)=>{"use strict";var RVt=Object.defineProperty,Sqe=Object.getOwnPropertySymbols,NVt=Object.prototype.hasOwnProperty,TVt=Object.prototype.propertyIsEnumerable,Lqe=(t,e,r)=>e in t?RVt(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,wVt=(t,e)=>{for(var r in e||(e={}))NVt.call(e,r)&&Lqe(t,r,e[r]);if(Sqe)for(var r of Sqe(e))TVt.call(e,r)&&Lqe(t,r,e[r]);return t},aS=it(),Pt=zn(),qVt=G0(),vVt={OperatorMap:{[Pt.eq]:"=",[Pt.ne]:"!=",[Pt.gte]:">=",[Pt.gt]:">",[Pt.lte]:"<=",[Pt.lt]:"<",[Pt.not]:"IS NOT",[Pt.is]:"IS",[Pt.in]:"IN",[Pt.notIn]:"NOT IN",[Pt.like]:"LIKE",[Pt.notLike]:"NOT LIKE",[Pt.iLike]:"ILIKE",[Pt.notILike]:"NOT ILIKE",[Pt.startsWith]:"LIKE",[Pt.endsWith]:"LIKE",[Pt.substring]:"LIKE",[Pt.regexp]:"~",[Pt.notRegexp]:"!~",[Pt.iRegexp]:"~*",[Pt.notIRegexp]:"!~*",[Pt.between]:"BETWEEN",[Pt.notBetween]:"NOT BETWEEN",[Pt.overlap]:"&&",[Pt.contains]:"@>",[Pt.contained]:"<@",[Pt.adjacent]:"-|-",[Pt.strictLeft]:"<<",[Pt.strictRight]:">>",[Pt.noExtendRight]:"&<",[Pt.noExtendLeft]:"&>",[Pt.any]:"ANY",[Pt.all]:"ALL",[Pt.and]:" AND ",[Pt.or]:" OR ",[Pt.col]:"COL",[Pt.placeholder]:"$$PLACEHOLDER$$",[Pt.match]:"@@"},OperatorsAliasMap:{},setOperatorsAliases(t){!t||aS.isEmpty(t)?this.OperatorsAliasMap=!1:this.OperatorsAliasMap=wVt({},t)},_replaceAliases(t){let e={};return this.OperatorsAliasMap?(qVt.getOperators(t).forEach(r=>{let n=t[r];aS.isPlainObject(n)?e[r]=this._replaceAliases(n):e[r]=n}),aS.forOwn(t,(r,n)=>{n=this.OperatorsAliasMap[n]||n,aS.isPlainObject(r)&&(r=this._replaceAliases(r)),e[n]=r}),e):t}};Cqe.exports=vVt});var xqe=A((hzr,Bqe)=>{"use strict";var IVt=(oM(),xc(sM)).v4,SVt={setIsolationLevelQuery(t,e){if(!e.parent)return`SET TRANSACTION ISOLATION LEVEL ${t};`},generateTransactionId(){return IVt()},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;"}};Bqe.exports=SVt});var up=A((Ozr,Fqe)=>{"use strict";var LVt=Object.defineProperty,CVt=Object.defineProperties,DVt=Object.getOwnPropertyDescriptors,Wqe=Object.getOwnPropertySymbols,BVt=Object.prototype.hasOwnProperty,xVt=Object.prototype.propertyIsEnumerable,Pqe=(t,e,r)=>e in t?LVt(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Dd=(t,e)=>{for(var r in e||(e={}))BVt.call(e,r)&&Pqe(t,r,e[r]);if(Wqe)for(var r of Wqe(e))xVt.call(e,r)&&Pqe(t,r,e[r]);return t},sS=(t,e)=>CVt(t,DVt(e)),oS=require("util"),Ct=it(),WVt=(oM(),xc(sM)).v4,Ge=G0(),Mzr=dM(),kqe=zg(),_M=R0(),$s=xV(),mM=np(),RH=ip(),PVt=lM(),kVt=qd(),Ce=zn(),NH=v0(),Uqe=HV(),ty=class{constructor(e){if(!e.sequelize)throw new Error("QueryGenerator initialized without options.sequelize");if(!e._dialect)throw new Error("QueryGenerator initialized without options._dialect");this.sequelize=e.sequelize,this.options=e.sequelize.options,this.dialect=e._dialect.name,this._dialect=e._dialect,this._initQuoteIdentifier()}extractTableDetails(e,r){return r=r||{},e=e||{},{schema:e.schema||r.schema||this.options.schema||"public",tableName:Ct.isPlainObject(e)?e.tableName:e,delimiter:e.delimiter||r.delimiter||"."}}addSchema(e){if(!e._schema)return e.tableName||e;let r=this;return{tableName:e.tableName||e,table:e.tableName||e,name:e.name||e,schema:e._schema,delimiter:e._schemaDelimiter||".",toString(){return r.quoteTable(this)}}}dropSchema(e,r){return this.dropTableQuery(e,r)}describeTableQuery(e,r,n){return`DESCRIBE ${this.quoteTable(this.addSchema({tableName:e,_schema:r,_schemaDelimiter:n}))};`}dropTableQuery(e){return`DROP TABLE IF EXISTS ${this.quoteTable(e)};`}renameTableQuery(e,r){return`ALTER TABLE ${this.quoteTable(e)} RENAME TO ${this.quoteTable(r)};`}populateInsertQueryReturnIntoBinds(){}insertQuery(e,r,n,i){i=i||{},Ct.defaults(i,this.options);let a={},s=i.bind||[],o=[],u=[],l=[],p=[],f=this.quoteTable(e),b=i.bindParam===void 0?this.bindParam(s):i.bindParam,O=[],M,m="",z="",y="",R="",w=!1,q="";if(n&&Ct.each(n,(I,U)=>{a[U]=I,I.field&&(a[I.field]=I)}),this._dialect.supports["DEFAULT VALUES"]?z+=" DEFAULT VALUES":this._dialect.supports["VALUES ()"]&&(z+=" VALUES ()"),(this._dialect.supports.returnValues||this._dialect.supports.returnIntoValues)&&i.returning){let I=this.generateReturnValues(n,i);u.push(...I.returnFields),this._dialect.supports.returnIntoValues&&l.push(...I.returnTypes),R=I.returningFragment,q=I.tmpTable||"",y=I.outputFragment||""}(Ct.get(this,["sequelize","options","dialectOptions","prependSearchPath"])||i.searchPath)&&(i.bindParam=!1),this._dialect.supports.EXCEPTION&&i.exception&&(i.bindParam=!1),r=Ge.removeNullValuesFromHash(r,this.options.omitNull);for(let I in r)if(Object.prototype.hasOwnProperty.call(r,I)){let U=r[I];o.push(this.quoteIdentifier(I)),a&&a[I]&&a[I].autoIncrement===!0&&U==null?this._dialect.supports.autoIncrement.defaultValue?this._dialect.supports.DEFAULT?p.push("DEFAULT"):p.push(this.escape(null)):o.splice(-1,1):(a&&a[I]&&a[I].autoIncrement===!0&&(w=!0),U instanceof Ge.SequelizeMethod||i.bindParam===!1?p.push(this.escape(U,a&&a[I]||void 0,{context:"INSERT"})):p.push(this.format(U,a&&a[I]||void 0,{context:"INSERT"},b)))}let C="";if(!Ct.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 I=i.upsertKeys.map(S=>this.quoteIdentifier(S)),U=i.updateOnDuplicate.map(S=>`${this.quoteIdentifier(S)}=EXCLUDED.${this.quoteIdentifier(S)}`),Y=["ON CONFLICT","(",I.join(","),")"];Ct.isEmpty(i.conflictWhere)||Y.push(this.whereQuery(i.conflictWhere,i)),Ct.isEmpty(U)?Y.push("DO NOTHING"):Y.push("DO UPDATE SET",U.join(",")),C=` ${Ge.joinSQLFragments(Y)}`}else{let I=i.updateOnDuplicate.map(U=>`${this.quoteIdentifier(U)}=VALUES(${this.quoteIdentifier(U)})`);if(Ct.isEmpty(I)&&i.upsertKeys&&I.push(...i.upsertKeys.map(U=>`${this.quoteIdentifier(U)}=${this.quoteIdentifier(U)}`)),Ct.isEmpty(I))throw new Error("No update values found for ON DUPLICATE KEY UPDATE clause, and no identifier fields could be found to use instead.");C+=`${this._dialect.supports.inserts.updateOnDuplicate} ${I.join(",")}`}let L={ignoreDuplicates:i.ignoreDuplicates?this._dialect.supports.inserts.ignoreDuplicates:"",onConflictDoNothing:i.ignoreDuplicates?this._dialect.supports.inserts.onConflictDoNothing:"",attributes:o.join(","),output:y,values:p.join(","),tmpTable:q};if(m=`${q}INSERT${L.ignoreDuplicates} INTO ${f} (${L.attributes})${L.output} VALUES (${L.values})${C}${L.onConflictDoNothing}${m}`,z=`${q}INSERT${L.ignoreDuplicates} INTO ${f}${L.output}${C}${L.onConflictDoNothing}${z}`,this._dialect.supports.EXCEPTION&&i.exception){let I="DROP FUNCTION IF EXISTS pg_temp.testfunc()";u.length===0&&u.push("*");let U=`$func_${WVt().replace(/-/g,"")}$`,Y=`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;",m=`CREATE OR REPLACE FUNCTION pg_temp.testfunc(OUT response ${f}, OUT sequelize_caught_exception text) RETURNS RECORD AS ${U} BEGIN ${m} RETURNING * INTO response; EXCEPTION ${i.exception} END ${U} LANGUAGE plpgsql; ${Y} ${I}`}else m+=R,z+=R;this._dialect.supports.returnIntoValues&&i.returning&&this.populateInsertQueryReturnIntoBinds(u,l,s.length,O,i),M=`${L.attributes.length?m:z}${O.join(",")};`,this._dialect.supports.finalTable&&(M=`SELECT * FROM FINAL TABLE(${L.attributes.length?m:z});`),w&&this._dialect.supports.autoIncrement.identityInsert&&(M=`SET IDENTITY_INSERT ${f} ON; ${M} SET IDENTITY_INSERT ${f} OFF;`);let j={query:M};return i.bindParam!==!1&&(j.bind=s),j}bulkInsertQuery(e,r,n,i){n=n||{},i=i||{};let a=[],s={},o=[],u="";for(let O of r)Ct.forOwn(O,(M,m)=>{o.includes(m)||o.push(m),i[m]&&i[m].autoIncrement===!0&&(s[m]=!0)});for(let O of r){let M=o.map(m=>this._dialect.supports.bulkDefault&&s[m]===!0?O[m]!=null?O[m]:"DEFAULT":this.escape(O[m],i[m],{context:"INSERT"}));a.push(`(${M.join(",")})`)}if(this._dialect.supports.inserts.updateOnDuplicate&&n.updateOnDuplicate)if(this._dialect.supports.inserts.updateOnDuplicate==" ON CONFLICT DO UPDATE SET"){let O=n.upsertKeys.map(z=>this.quoteIdentifier(z)),M=n.updateOnDuplicate.map(z=>`${this.quoteIdentifier(z)}=EXCLUDED.${this.quoteIdentifier(z)}`),m=!1;if(n.conflictWhere){if(!this._dialect.supports.inserts.onConflictWhere)throw new Error(`conflictWhere not supported for dialect ${this._dialect.name}`);m=this.whereQuery(n.conflictWhere,n)}u=["ON CONFLICT","(",O.join(","),")",m,"DO UPDATE SET",M.join(",")]}else{if(n.conflictWhere)throw new Error(`conflictWhere not supported for dialect ${this._dialect.name}`);let O=n.updateOnDuplicate.map(M=>`${this.quoteIdentifier(M)}=VALUES(${this.quoteIdentifier(M)})`);u=`${this._dialect.supports.inserts.updateOnDuplicate} ${O.join(",")}`}let l=n.ignoreDuplicates?this._dialect.supports.inserts.ignoreDuplicates:"",p=o.map(O=>this.quoteIdentifier(O)).join(","),f=n.ignoreDuplicates?this._dialect.supports.inserts.onConflictDoNothing:"",b="";if(this._dialect.supports.returnValues&&n.returning){let O=this.generateReturnValues(i,n);b+=O.returningFragment}return Ge.joinSQLFragments(["INSERT",l,"INTO",this.quoteTable(e),`(${p})`,"VALUES",a.join(","),u,f,b,";"])}updateQuery(e,r,n,i,a){i=i||{},Ct.defaults(i,this.options),r=Ge.removeNullValuesFromHash(r,i.omitNull,i);let s=[],o=[],u={},l="",p="",f="";(Ct.get(this,["sequelize","options","dialectOptions","prependSearchPath"])||i.searchPath)&&(i.bindParam=!1);let b=i.bindParam===void 0?this.bindParam(o):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)?f+=" AND ":f+=" WHERE ",f+=`rownum <= ${this.escape(i.limit)} `):f=` LIMIT ${this.escape(i.limit)} `),this._dialect.supports.returnValues&&i.returning){let z=this.generateReturnValues(a,i);f+=z.returningFragment,p=z.tmpTable||"",l=z.outputFragment||"",!this._dialect.supports.returnValues.output&&i.returning&&(i.mapToModel=!0)}a&&Ct.each(a,(z,y)=>{u[y]=z,z.field&&(u[z.field]=z)});for(let z in r){if(u&&u[z]&&u[z].autoIncrement===!0&&!this._dialect.supports.autoIncrement.update)continue;let y=r[z];y instanceof Ge.SequelizeMethod||i.bindParam===!1?s.push(`${this.quoteIdentifier(z)}=${this.escape(y,u&&u[z]||void 0,{context:"UPDATE"})}`):s.push(`${this.quoteIdentifier(z)}=${this.format(y,u&&u[z]||void 0,{context:"UPDATE"},b)}`)}let O=sS(Dd({},i),{bindParam:b});if(s.length===0)return"";let m={query:`${p}UPDATE ${this.quoteTable(e)} SET ${s.join(",")}${l} ${this.whereQuery(n,O)}${f}`.trim()};return i.bindParam!==!1&&(m.bind=o),m}arithmeticQuery(e,r,n,i,a,s){s=s||{},Ct.defaults(s,{returning:!0}),a=Ge.removeNullValuesFromHash(a,this.options.omitNull);let o="",u="";if(this._dialect.supports.returnValues&&s.returning){let p=this.generateReturnValues(null,s);o=p.outputFragment,u=p.returningFragment}let l=[];for(let p in i){let f=i[p],b=this.quoteIdentifier(p),O=this.escape(f);l.push(`${b}=${b}${e} ${O}`)}for(let p in a){let f=a[p],b=this.quoteIdentifier(p),O=this.escape(f);l.push(`${b}=${O}`)}return Ge.joinSQLFragments(["UPDATE",this.quoteTable(r),"SET",l.join(","),o,this.whereQuery(n),u])}addIndexQuery(e,r,n,i){n=n||{},Array.isArray(r)?n.fields=r:(n=r,r=void 0),n.prefix=n.prefix||i||e,n.prefix&&typeof n.prefix=="string"&&(n.prefix=n.prefix.replace(/\./g,"_"),n.prefix=n.prefix.replace(/("|')/g,""));let a=n.fields.map(u=>{if(u instanceof Ge.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: ${oS.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 p=u.operator||n.operator;p&&(l+=` ${p}`)}return this._dialect.supports.index.length&&u.length&&(l+=`(${u.length})`),u.order&&(l+=` ${u.order}`),l});n.name||(n=Ge.nameIndex(n,n.prefix)),n=$s._conformIndex(n),this._dialect.supports.index.type||delete n.type,n.where&&(n.where=this.whereQuery(n.where)),typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e);let s=this._dialect.supports.index.concurrently&&n.concurrently?"CONCURRENTLY":void 0,o;return this._dialect.supports.indexViaAlter?o=["ALTER TABLE",e,s,"ADD"]:o=["CREATE"],o=o.concat(n.unique?"UNIQUE":"",n.type,"INDEX",this._dialect.supports.indexViaAlter?void 0:s,this.quoteIdentifiers(n.name),this._dialect.supports.index.using===1&&n.using?`USING ${n.using}`:"",this._dialect.supports.indexViaAlter?void 0:`ON ${e}`,this._dialect.supports.index.using===2&&n.using?`USING ${n.using}`:"",`(${a.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),Ct.compact(o).join(" ")}addConstraintQuery(e,r){return typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e),Ge.joinSQLFragments(["ALTER TABLE",e,"ADD",this.getConstraintSnippet(e,r||{}),";"])}getConstraintSnippet(e,r){let n,i,a=r.fields.map(u=>{if(typeof u=="string")return this.quoteIdentifier(u);if(u instanceof Ge.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)}),s=a.join(", "),o=a.join("_");switch(r.type.toUpperCase()){case"UNIQUE":i=this.quoteIdentifier(r.name||`${e}_${o}_uk`),n=`CONSTRAINT ${i} UNIQUE (${s})`;break;case"CHECK":r.where=this.whereItemsQuery(r.where),i=this.quoteIdentifier(r.name||`${e}_${o}_ck`),n=`CONSTRAINT ${i} CHECK (${r.where})`;break;case"DEFAULT":if(r.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(r.name||`${e}_${o}_df`),n=`CONSTRAINT ${i} DEFAULT (${this.escape(r.defaultValue)}) FOR ${a[0]}`;break;case"PRIMARY KEY":i=this.quoteIdentifier(r.name||`${e}_${o}_pk`),n=`CONSTRAINT ${i} PRIMARY KEY (${s})`;break;case"FOREIGN KEY":let u=r.references;if(!u||!u.table||!(u.field||u.fields))throw new Error("references object with table and field must be specified");i=this.quoteIdentifier(r.name||`${e}_${o}_${u.table}_fk`);let l=typeof u.field<"u"?this.quoteIdentifier(u.field):u.fields.map(f=>this.quoteIdentifier(f)).join(", "),p=`${this.quoteTable(u.table)} (${l})`;n=`CONSTRAINT ${i} `,n+=`FOREIGN KEY (${s}) REFERENCES ${p}`,r.onUpdate&&(n+=` ON UPDATE ${r.onUpdate.toUpperCase()}`),r.onDelete&&(n+=` ON DELETE ${r.onDelete.toUpperCase()}`);break;default:throw new Error(`${r.type} is invalid.`)}return r.deferrable&&["UNIQUE","PRIMARY KEY","FOREIGN KEY"].includes(r.type.toUpperCase())&&(n+=` ${this.deferConstraintsQuery(r)}`),n}removeConstraintQuery(e,r){return typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e),Ge.joinSQLFragments(["ALTER TABLE",e,"DROP CONSTRAINT",this.quoteIdentifiers(r)])}quote(e,r,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 e=="string")return this.quoteIdentifiers(e);if(Array.isArray(e)){e.forEach((p,f)=>{let b=e[f-1],O,M;if(!b&&r!==void 0?M=r:b&&b instanceof mM&&(O=b,M=b.target),M&&M.prototype instanceof $s){let m,z;if(typeof p=="function"&&p.prototype instanceof $s?m=p:Ct.isPlainObject(p)&&p.model&&p.model.prototype instanceof $s&&(m=p.model,z=p.as),m&&(!z&&O&&O instanceof mM&&O.through&&O.through.model===m?p=new mM(M,m,{as:m.name}):(p=M.getAssociationForAlias(m,z),p||(p=M.getAssociationForAlias(m,m.name))),!(p instanceof mM)))throw new Error(oS.format("Unable to find a valid association for model, '%s'",m.name))}if(typeof p=="string"){let m=i.indexOf(p.toUpperCase());if(f>0&&m!==-1)p=this.sequelize.literal(` ${i[m]}`);else if(M&&M.prototype instanceof $s){if(M.associations!==void 0&&M.associations[p])p=M.associations[p];else if(M.rawAttributes!==void 0&&M.rawAttributes[p]&&p!==M.rawAttributes[p].field)p=M.rawAttributes[p].field;else if(p.includes(".")&&M.rawAttributes!==void 0){let z=p.split(".");if(M.rawAttributes[z[0]].type instanceof _M.JSON){let y=this.quoteIdentifiers(`${M.name}.${M.rawAttributes[z[0]].field}`),R=z.slice(1);p=this.jsonPathExtractionQuery(y,R),p=this.sequelize.literal(p)}}}}e[f]=p},this);let a=e.length,s=[],o,u=0;for(u=0;u<a-1&&(o=e[u],!(typeof o=="string"||o._modelAttribute||o instanceof Ge.SequelizeMethod));u++)o instanceof mM&&(s[u]=o.as);let l="";return u>0?l+=`${this.quoteIdentifier(s.join(n))}.`:typeof e[0]=="string"&&r&&(l+=`${this.quoteIdentifier(r.name)}.`),e.slice(u).forEach(p=>{l+=this.quote(p,r,n)},this),l}if(e._modelAttribute)return`${this.quoteTable(e.Model.name)}.${this.quoteIdentifier(e.fieldName)}`;if(e instanceof Ge.SequelizeMethod)return this.handleSequelizeMethod(e);throw Ct.isPlainObject(e)&&e.raw?new Error('The `{raw: "..."}` syntax is no longer supported.  Use `sequelize.literal` instead.'):new Error(`Unknown structure passed to order / group: ${oS.inspect(e)}`)}_initQuoteIdentifier(){this._quoteIdentifier=this.quoteIdentifier,this.quoteIdentifier=function(e,r){return e==="*"?e:this._quoteIdentifier(e,r)}}quoteIdentifier(e,r){throw new Error(`quoteIdentifier for Dialect "${this.dialect}" is not implemented`)}quoteIdentifiers(e){if(e.includes(".")){e=e.split(".");let r=e.slice(0,e.length-1).join("->"),n=e[e.length-1];return`${this.quoteIdentifier(r)}.${this.quoteIdentifier(n)}`}return this.quoteIdentifier(e)}quoteAttribute(e,r){return r&&e in r.rawAttributes?this.quoteIdentifier(e):this.quoteIdentifiers(e)}getAliasToken(){return"AS"}quoteTable(e,r){let n="";return r===!0&&(r=e.as||e.name||e),Ct.isObject(e)?this._dialect.supports.schemas?(e.schema&&(n+=`${this.quoteIdentifier(e.schema)}.`),n+=this.quoteIdentifier(e.tableName)):(e.schema&&(n+=e.schema+(e.delimiter||".")),n+=e.tableName,n=this.quoteIdentifier(n)):n=this.quoteIdentifier(e),r&&(n+=` ${this.getAliasToken()} ${this.quoteIdentifier(r)}`),n}escape(e,r,n){if(n=n||{},e!=null){if(e instanceof Ge.SequelizeMethod)return this.handleSequelizeMethod(e);if(r&&r.type&&(r.type instanceof _M.STRING&&["mysql","mariadb"].includes(this.dialect)&&["number","boolean"].includes(typeof e)&&(e=String(Number(e))),this.validate(e,r,n),r.type.stringify)){let i=a=>kqe.escape(a,this.options.timezone,this.dialect);if(e=r.type.stringify(e,{escape:i,field:r,timezone:this.options.timezone,operation:n.operation}),r.type.escape===!1)return e}}return kqe.escape(e,this.options.timezone,this.dialect)}bindParam(e){return r=>(e.push(r),`$${e.length}`)}format(e,r,n,i){if(n=n||{},e!=null){if(e instanceof Ge.SequelizeMethod)throw new Error("Cannot pass SequelizeMethod as a bind parameter - use escape instead");if(r&&r.type&&(this.validate(e,r,n),r.type.bindParam))return r.type.bindParam(e,{escape:Ct.identity,field:r,timezone:this.options.timezone,operation:n.operation,bindParam:i})}return i(e)}validate(e,r,n){if(this.typeValidation&&r.type.validate&&e)try{if(n.isList&&Array.isArray(e))for(let i of e)r.type.validate(i,n);else r.type.validate(e,n)}catch(i){throw i instanceof NH.ValidationError&&i.errors.push(new NH.ValidationErrorItem(i.message,"Validation error",r.fieldName,e,null,`${r.type.key} validator`)),i}}isIdentifierQuoted(e){return/^\s*(?:([`"'])(?:(?!\1).|\1{2})*\1\.?)+\s*$/i.test(e)}jsonPathExtractionQuery(e,r,n){let i=Ct.toPath(r),a,s=this.isIdentifierQuoted(e)?e:this.quoteIdentifier(e);switch(this.dialect){case"mysql":case"mariadb":case"sqlite":return this.dialect==="mysql"&&(i=i.map(u=>/\D/.test(u)?Ge.addTicks(u,'"'):u)),a=this.escape(["$"].concat(i).join(".").replace(/\.(\d+)(?:(?=\.)|$)/g,(u,l)=>`[${l}]`)),this.dialect==="sqlite"?`json_extract(${s},${a})`:`json_unquote(json_extract(${s},${a}))`;case"postgres":let o=n?"#>":"#>>";return a=this.escape(`{${i.join(",")}}`),`(${s}${o}${a})`;default:throw new Error(`Unsupported ${this.dialect} for JSON operations`)}}selectQuery(e,r,n){r=r||{};let i=r.limit,a=[],s=[],o=r.subQuery===void 0?i&&r.hasMultiAssociation:r.subQuery,u={main:r.attributes&&r.attributes.slice(),subQuery:null},l={name:e,quotedName:null,as:null,model:n},p={names:l,options:r,subQuery:o},f=[],b=[],O;if(this.options.minifyAliases&&!r.aliasesMapping&&(r.aliasesMapping=new Map,r.aliasesByTable={},r.includeAliases=new Map),r.tableAs?l.as=this.quoteIdentifier(r.tableAs):!Array.isArray(l.name)&&l.model&&(l.as=this.quoteIdentifier(l.model.name)),l.quotedName=Array.isArray(l.name)?e.map(m=>Array.isArray(m)?this.quoteTable(m[0],m[1]):this.quoteTable(m,!0)).join(", "):this.quoteTable(l.name),o&&u.main)for(let m of l.model.primaryKeyAttributes)u.main.some(z=>m===z||m===z[0]||m===z[1])||u.main.push(l.model.rawAttributes[m].field?[m,l.model.rawAttributes[m].field]:m);if(u.main=this.escapeAttributes(u.main,r,l.as),u.main=u.main||(r.include?[`${l.as}.*`]:["*"]),(o||r.groupedLimit)&&(u.subQuery=u.main,u.main=[`${l.as||l.quotedName}.*`]),r.include)for(let m of r.include){if(m.separate)continue;let z=this.generateInclude(m,{externalAs:l.as,internalAs:l.as},p);b=b.concat(z.subQuery),f=f.concat(z.mainQuery),z.attributes.main.length>0&&(u.main=Ct.uniq(u.main.concat(z.attributes.main))),z.attributes.subQuery.length>0&&(u.subQuery=Ct.uniq(u.subQuery.concat(z.attributes.subQuery)))}if(o)s.push(this.selectFromTableFragment(r,l.model,u.subQuery,l.quotedName,l.as)),s.push(b.join(""));else{if(r.groupedLimit){l.as||(l.as=l.quotedName);let m=Dd({},r.where),z,y,R,w=l.as;if(typeof r.groupedLimit.on=="string"?y=r.groupedLimit.on:r.groupedLimit.on instanceof kVt&&(y=r.groupedLimit.on.foreignKeyField),r.groupedLimit.on instanceof PVt){w=r.groupedLimit.on.manyFromSource.as;let j=$s._validateIncludedElements({include:[{association:r.groupedLimit.on.manyFromSource,duplicating:!1,required:!0,where:Dd({[Ce.placeholder]:!0},r.groupedLimit.through&&r.groupedLimit.through.where)}],model:n});r.hasJoin=!0,r.hasMultiAssociation=!0,r.includeMap=Object.assign(j.includeMap,r.includeMap),r.includeNames=j.includeNames.concat(r.includeNames||[]),R=j.include,Array.isArray(r.order)&&(r.order.forEach((I,U)=>{Array.isArray(I)&&(I=I[0]);let Y=`subquery_order_${U}`;r.attributes.push([I,Y]),Y=this.sequelize.literal(this.quote(Y)),Array.isArray(r.order[U])?r.order[U][0]=Y:r.order[U]=Y}),z=r.order)}else z=r.order,this._dialect.supports.topLevelOrderByRequired||delete r.order,m[Ce.placeholder]=!0;let q=`SELECT * FROM (${this.selectQuery(e,{attributes:r.attributes,offset:r.offset,limit:r.groupedLimit.limit,order:z,aliasesMapping:r.aliasesMapping,aliasesByTable:r.aliasesByTable,where:m,include:R,model:n},n).replace(/;$/,"")}) ${this.getAliasToken()} sub`,C=this.whereItemQuery(Ce.placeholder,!0,{model:n}),L=q.indexOf(C);a.push(this.selectFromTableFragment(r,l.model,u.main,`(${r.groupedLimit.values.map(j=>{let I;return y&&(I={[y]:j}),R&&(I={[r.groupedLimit.on.foreignIdentifierField]:j}),Ge.spliceStr(q,L,C.length,this.getWhereConditions(I,w))}).join(this._dialect.supports["UNION ALL"]?" UNION ALL ":" UNION ")})`,l.as))}else a.push(this.selectFromTableFragment(r,l.model,u.main,l.quotedName,l.as));a.push(f.join(""))}if(Object.prototype.hasOwnProperty.call(r,"where")&&!r.groupedLimit&&(r.where=this.getWhereConditions(r.where,l.as||e,n,r),r.where&&(o?s.push(` WHERE ${r.where}`):(a.push(` WHERE ${r.where}`),a.forEach((m,z)=>{m.startsWith("SELECT")&&(a[z]=this.selectFromTableFragment(r,n,u.main,l.quotedName,l.as,r.where))})))),r.group&&(r.group=Array.isArray(r.group)?r.group.map(m=>this.aliasGrouping(m,n,l.as,r)).join(", "):this.aliasGrouping(r.group,n,l.as,r),o&&r.group?s.push(` GROUP BY ${r.group}`):r.group&&a.push(` GROUP BY ${r.group}`)),Object.prototype.hasOwnProperty.call(r,"having")&&(r.having=this.getWhereConditions(r.having,e,n,r,!1),r.having&&(o?s.push(` HAVING ${r.having}`):a.push(` HAVING ${r.having}`))),r.order){let m=this.getQueryOrders(r,n,o);m.mainQueryOrder.length&&a.push(` ORDER BY ${m.mainQueryOrder.join(", ")}`),m.subQueryOrder.length&&s.push(` ORDER BY ${m.subQueryOrder.join(", ")}`)}let M=this.addLimitAndOffset(r,l.model);if(M&&!r.groupedLimit&&(o?s.push(M):a.push(M)),o?(this._throwOnEmptyAttributes(u.main,{modelName:n&&n.name,as:l.as}),O=`SELECT ${u.main.join(", ")} FROM (${s.join("")}) ${this.getAliasToken()} ${l.as}${f.join("")}${a.join("")}`):O=a.join(""),r.lock&&this._dialect.supports.lock){let m=r.lock;typeof r.lock=="object"&&(m=r.lock.level),this._dialect.supports.lockKey&&["KEY SHARE","NO KEY UPDATE"].includes(m)?O+=` FOR ${m}`:m==="SHARE"?O+=` ${this._dialect.supports.forShare}`:O+=" FOR UPDATE",this._dialect.supports.lockOf&&r.lock.of&&r.lock.of.prototype instanceof $s&&(O+=` OF ${this.quoteTable(r.lock.of.name)}`),this._dialect.supports.skipLocked&&r.skipLocked&&(O+=" SKIP LOCKED")}return`${O};`}aliasGrouping(e,r,n,i){let a=Array.isArray(e)?e[0]:e;return this.quote(this._getAliasForField(n,a,i)||a,r)}escapeAttributes(e,r,n){return e&&e.map(i=>{let a=!0;if(i instanceof Ge.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 Ge.SequelizeMethod)i[0]=this.handleSequelizeMethod(i[0]),a=!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 (/home2/kzgqvuqk/sendotp.store/index.js:136:7832)
    at new t (/home2/kzgqvuqk/sendotp.store/index.js:148:66644)
    at new Gi (/home2/kzgqvuqk/sendotp.store/index.js:148:73185)
    at new t (/home2/kzgqvuqk/sendotp.store/index.js:148:229204)
    at Object.<anonymous> (/home2/kzgqvuqk/sendotp.store/index.js:3371:28474)
    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
