/home/itwveifv/bot.maxotp.site/server.js:131
`}};nk.AggregateError=Jee});var h8e=O(ak=>{"use strict";Object.defineProperty(ak,"__esModule",{value:!0});ak.Deferred=void 0;var Mdr=$ee(),ete=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 Mdr.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}};ak.Deferred=ete});var b8e=O(sk=>{"use strict";Object.defineProperty(sk,"__esModule",{value:!0});sk.Pool=void 0;var Edr=h8e(),ydr=Zee(),tte=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(),i,n=this._availableObjects.length,a=this.size-this.minSize,s;for(this._removeIdleScheduled=!1,i=0;i<n&&a>e.length;i++)s=this._availableObjects[i].timeout,r>=s&&(this._log("removeIdle() destroying obj - now:"+r+" timeout:"+s,"verbose"),e.push(this._availableObjects[i].resource));e.forEach(this.destroy,this),n=this._availableObjects.length,n>0?(this._log("this._availableObjects.length="+n,"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 i={resource:e,useCount:r,timeout:Date.now()+this.idleTimeoutMillis};this._availableObjects.push(i),this._dispense(),this._scheduleRemoveIdle()}_addResourceToInUseObjects(e,r){let i={resource:e,useCount:r};this._inUseObjects.push(i)}_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 Edr.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(n=>n.resource===e)){this._log("release called twice for the same resource: "+new Error().stack,"error");return}let r=this._inUseObjects.findIndex(n=>n.resource===e);if(r<0){this._log("attempt to release an invalid resource: "+new Error().stack,"error");return}let i=this._inUseObjects[r];i.useCount+=1,i.useCount>=this.maxUsesPerResource?(this._log("release() destroying obj - useCount:"+i.useCount+" maxUsesPerResource:"+this.maxUsesPerResource,"verbose"),this.destroy(i.resource),this._dispense()):(this._inUseObjects.splice(r,1),this._addResourceToAvailableObjects(i.resource,i.useCount))}async destroy(e){let r=this._availableObjects.length,i=this._inUseObjects.length;if(this._availableObjects=this._availableObjects.filter(n=>n.resource!==e),this._inUseObjects=this._inUseObjects.filter(n=>n.resource!==e),r===this._availableObjects.length&&i===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(i=>i.resource),r=[];for(let i of e)try{await this.destroy(i)}catch(n){this._log("Error destroying resource: "+n.stack,"error"),r.push(n)}if(r.length>0)throw new ydr.AggregateError(r)}};sk.Pool=tte});var _8e=O(ob=>{"use strict";Object.defineProperty(ob,"__esModule",{value:!0});ob.Pool=ob.AggregateError=ob.TimeoutError=void 0;var zdr=$ee();Object.defineProperty(ob,"TimeoutError",{enumerable:!0,get:function(){return zdr.TimeoutError}});var Rdr=Zee();Object.defineProperty(ob,"AggregateError",{enumerable:!0,get:function(){return Rdr.AggregateError}});var wdr=b8e();Object.defineProperty(ob,"Pool",{enumerable:!0,get:function(){return wdr.Pool}})});var ed=O((Mei,ok)=>{"use strict";var{Pool:rte,TimeoutError:Ndr}=_8e(),cb=fr(),ite=Zf(),vdr=fi(),{logger:Tdr}=Bn(),Idr=cM(),bp=Tdr.debugContext("pool"),q4=class{constructor(e,r){let i=cb.cloneDeep(r.config);if(this.sequelize=r,this.config=i,this.dialect=e,this.versionPromise=null,this.dialectName=this.sequelize.options.dialect,i.pool===!1)throw new Error("Support for pool:false was removed in v4.0");i.pool=cb.defaults(i.pool||{},{max:5,min:0,idle:1e4,acquire:6e4,evict:1e3,validate:this._validate.bind(this)}),this.initPools()}refreshTypeParser(e){cb.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(),bp("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 rte({name:"sequelize",create:()=>this._connect(e),destroy:async i=>{let n=await this._disconnect(i);return bp("connection destroy"),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}),bp(`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=cb.defaults(e.replication.write,cb.omit(e,"replication")),e.replication.read=e.replication.read.map(i=>cb.defaults(i,cb.omit(this.config,"replication")));let r=0;this.pool={release:i=>{i.queryType==="read"?this.pool.read.release(i):this.pool.write.release(i)},acquire:(i,n)=>(n=n===void 0?!1:n,i==="SELECT"&&!n?this.pool.read.acquire():this.pool.write.acquire()),destroy:i=>{this.pool[i.queryType].destroy(i),bp("connection destroy")},destroyAllNow:async()=>{await Promise.all([this.pool.read.destroyAllNow(),this.pool.write.destroyAllNow()]),bp("all connections destroyed")},drain:async()=>Promise.all([this.pool.write.drain(),this.pool.read.drain()]),read:new rte({name:"sequelize:read",create:async()=>{let i=r++%e.replication.read.length,n=await this._connect(e.replication.read[i]);return n.queryType="read",n},destroy:i=>this._disconnect(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}),write:new rte({name:"sequelize:write",create:async()=>{let i=await this._connect(e.replication.write);return i.queryType="write",i},destroy:i=>this._disconnect(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})},bp(`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 i=await this._connect(this.config.replication.write||this.config),n={};if(n.transaction={connection:i},n.logging=()=>{},n.logging.__testLoggingFn=!0,this.sequelize.options.databaseVersion===0){let a=await this.sequelize.databaseVersion(n),s=cb.get(ite.coerce(a),"version")||a;this.sequelize.options.databaseVersion=ite.valid(s)?s:this.dialect.defaultVersion}return ite.lt(this.sequelize.options.databaseVersion,this.dialect.defaultVersion)&&(Idr.unsupportedEngine(),bp(`Unsupported database engine version ${this.sequelize.options.databaseVersion}`)),this.versionPromise=null,await this._disconnect(i)}catch(i){throw this.versionPromise=null,i}})()),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(i){throw i instanceof Ndr?new vdr.ConnectionAcquireTimeoutError(i):i}return bp("connection acquired"),r}releaseConnection(e){this.pool.release(e),bp("connection released")}async destroyConnection(e){await this.pool.destroy(e),bp(`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}};ok.exports=q4;ok.exports.ConnectionManager=q4;ok.exports.default=q4});var iu=O((Eei,A8e)=>{"use strict";var C4=new Map;A8e.exports=t=>(C4.has(t)||C4.set(t,new Map),{clear(){C4.get(t).clear()},refresh(e){for(let r of e.types[t])C4.get(t).set(r,e.parse)},get(e){return C4.get(t).get(e)}})});var M8e=O((yei,uk)=>{"use strict";var Sdr=Object.defineProperty,m8e=Object.getOwnPropertySymbols,qdr=Object.prototype.hasOwnProperty,Cdr=Object.prototype.propertyIsEnumerable,O8e=(t,e,r)=>e in t?Sdr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,xdr=(t,e)=>{for(var r in e||(e={}))qdr.call(e,r)&&O8e(t,r,e[r]);if(m8e)for(var r of m8e(e))Cdr.call(e,r)&&O8e(t,r,e[r]);return t},Ldr=Zf(),kdr=ed(),fM=fi(),{logger:Ddr}=Bn(),Bdr=ri().mariadb,Pdr=up(),g8e=Ddr.debugContext("connection:mariadb"),ck=iu()("mariadb"),x4=class t extends kdr{constructor(e,r){r.config.port=r.config.port||3306,super(e,r),this.lib=this._loadDialectModule("mariadb"),this.refreshTypeParser(Bdr)}static _typecast(e,r){return ck.get(e.type)?ck.get(e.type)(e,this.sequelize.options,r):r()}_refreshTypeParser(e){ck.refresh(e)}_clearTypeParser(){ck.clear()}async connect(e){let r=this.sequelize.options.timezone;r=/\//.test(r)?Pdr.tz(r).format("Z"):r;let i=xdr({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||(i.initSql?(Array.isArray(i.initSql)||(i.initSql=[i.initSql]),i.initSql.push(`SET time_zone = '${r}'`)):i.initSql=`SET time_zone = '${r}'`);try{let n=await this.lib.createConnection(i);return this.sequelize.options.databaseVersion=Ldr.coerce(n.serverVersion()).version,g8e("connection acquired"),n.on("error",a=>{switch(a.code){case"ESOCKET":case"ECONNRESET":case"EPIPE":case"PROTOCOL_CONNECTION_LOST":this.pool.destroy(n)}}),n}catch(n){switch(n.code){case"ECONNREFUSED":throw new fM.ConnectionRefusedError(n);case"ER_ACCESS_DENIED_ERROR":case"ER_ACCESS_DENIED_NO_PASSWORD_ERROR":throw new fM.AccessDeniedError(n);case"ENOTFOUND":throw new fM.HostNotFoundError(n);case"EHOSTUNREACH":case"ENETUNREACH":case"EADDRNOTAVAIL":throw new fM.HostNotReachableError(n);case"EINVAL":throw new fM.InvalidConnectionError(n);default:throw new fM.ConnectionError(n)}}}async disconnect(e){if(!e.isValid()){g8e("connection tried to disconnect but was already at CLOSED state");return}return await e.end()}validate(e){return e&&e.isValid()}};uk.exports=x4;uk.exports.ConnectionManager=x4;uk.exports.default=x4});var td=O((zei,lk)=>{"use strict";var Wdr=Object.defineProperty,E8e=Object.getOwnPropertySymbols,Udr=Object.prototype.hasOwnProperty,Fdr=Object.prototype.propertyIsEnumerable,y8e=(t,e,r)=>e in t?Wdr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,jdr=(t,e)=>{for(var r in e||(e={}))Udr.call(e,r)&&y8e(t,r,e[r]);if(E8e)for(var r of E8e(e))Fdr.call(e,r)&&y8e(t,r,e[r]);return t},ub=fr(),Gdr=a4(),hc=yo(),Hdr=gL(),Qdr=cM(),Vdr=(rM(),Yl(tM)).v4,{safeStringifyJson:z8e}=wi(),L4=class t{constructor(e,r,i){this.uuid=Vdr(),this.connection=e,this.instance=i.instance,this.model=i.model,this.sequelize=r,this.options=jdr({plain:!1,raw:!1,logging:console.log},i),this.checkLoggingOption(),i.rawErrors&&(this.formatError=t.prototype.formatError)}static formatBindParameters(e,r,i,n,a){if(!r)return[e,[]];if(a=a||{},typeof n!="function"&&(a=n||{},n=void 0),!n)a.skipValueReplace?n=(c,l,p)=>{if(p[l]!==void 0)return c}:n=(c,l,p,f,d)=>{if(p[l]!==void 0)return Gdr.escape(p[l],f,d)};else if(a.skipValueReplace){let c=n;n=(l,p,f,d,h,_)=>{if(c(l,p,f,d,h,_)!==void 0)return l}}let s=null,o=Array.isArray(r);return e=e.replace(/\B\$(\$|\w+)/g,(c,l)=>{if(l==="$")return a.skipUnescape?c:l;let p;if(o?l.match(/^[1-9]\d*$/)&&(l=l-1,p=n(c,l,r,s,i,a)):l.match(/^\d*$/)||(p=n(c,l,r,s,i,a)),p===void 0)throw new Error(`Named bind parameter "${c}" 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&&(Qdr.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 i of Object.keys(this.model.uniqueKeys))this.model.uniqueKeys[i].fields.includes(e.replace(/"/g,""))&&this.model.uniqueKeys[i].msg&&(r=this.model.uniqueKeys[i].msg);return r}isRawQuery(){return this.options.type===hc.RAW}isVersionQuery(){return this.options.type===hc.VERSION}isUpsertQuery(){return this.options.type===hc.UPSERT}isInsertQuery(e,r){let i=!0;return this.options.type===hc.INSERT?!0:(i=i&&this.sql.toLowerCase().startsWith("insert into"),i=i&&(!e||Object.prototype.hasOwnProperty.call(e,this.getInsertIdField())),i=i&&(!r||Object.prototype.hasOwnProperty.call(r,this.getInsertIdField())),i)}handleInsertQuery(e,r){if(this.instance){let i=this.model.autoIncrementAttribute,n=null;n=n||e&&e[this.getInsertIdField()],n=n||r&&r[this.getInsertIdField()],this.instance[i]=n}}isShowTablesQuery(){return this.options.type===hc.SHOWTABLES}handleShowTablesQuery(e){return ub.flatten(e.map(r=>Object.values(r)))}isShowIndexesQuery(){return this.options.type===hc.SHOWINDEXES}isShowConstraintsQuery(){return this.options.type===hc.SHOWCONSTRAINTS}isDescribeQuery(){return this.options.type===hc.DESCRIBE}isSelectQuery(){return this.options.type===hc.SELECT}isBulkUpdateQuery(){return this.options.type===hc.BULKUPDATE}isBulkDeleteQuery(){return this.options.type===hc.BULKDELETE}isForeignKeysQuery(){return this.options.type===hc.FOREIGNKEYS}isUpdateQuery(){return this.options.type===hc.UPDATE}handleSelectQuery(e){let r=null;if(this.options.fieldMap){let i=this.options.fieldMap;e=e.map(n=>ub.reduce(i,(a,s,o)=>(a[o]!==void 0&&s!==o&&(a[s]=a[o],delete a[o]),a),n))}return this.options.raw?r=e.map(i=>{let n={};for(let a in i)Object.prototype.hasOwnProperty.call(i,a)&&(n[a]=i[a]);return this.options.nest&&(n=Hdr.transform(n)),n}):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,i){let{connection:n,options:a}=this,s=this.sequelize.options.benchmark||a.benchmark,o=this.sequelize.options.logQueryParameters||a.logQueryParameters,c=Date.now(),l="";if(o&&i){let d=e.endsWith(";")?"":";",h;Array.isArray(i)?h=i.map(_=>z8e(_)).join(", "):h=z8e(i),l=`${d} ${h}`}let p=`(${n.uuid||"default"}): ${e}${l}`,f=`Executing ${p}`;return r(f),s||this.sequelize.log(`Executing ${p}`,a),()=>{let d=`Executed ${p}`;r(d),s&&this.sequelize.log(d,Date.now()-c,a)}}static _groupJoinData(e,r,i){if(!e.length)return[];let n,a,s,o,c,l,p=e.length,f,d,h,_,m,E,R,N,T=i.checkExisting,I,W,D,F=T?[]:new Array(p),x={},H={},$,k,oe,j,B,V,X,_e,he=se=>{Object.prototype.hasOwnProperty.call(V.includeMap,se)&&(H[d]=V=V.includeMap[se],_e?_e=`${_e}.${se}`:_e=se,H[_e]=V)},ce={},Re=(se,Ee)=>(Object.prototype.hasOwnProperty.call(Ee,se)||(Ee[se]=se.substr(0,se.lastIndexOf("."))),Ee[se]),Te={},Ce=se=>{if(!Object.prototype.hasOwnProperty.call(Te,se)){let Ee=se.lastIndexOf(".");Te[se]=se.substr(Ee===-1?0:Ee+1)}return Te[se]},te={},de=se=>{if(!Object.prototype.hasOwnProperty.call(te,se)){let Ee=Re(se,ce);Object.prototype.hasOwnProperty.call(te,Ee)||(te[Ee]=Ee?Ee.split("."):[]),te[se]=te[Ee]}return te[se]},ze={},Oe=se=>{if(!Object.prototype.hasOwnProperty.call(ze,se)){let Ee=de(se),Ie=Ee.length;ze[se]=Ie?Ee[Ie-1]:""}return ze[se]},ke=se=>{let Ee=ub.chain(se.uniqueKeys);return Ee=Ee.result(`${Ee.findKey()}.fields`).map(Ie=>ub.findKey(se.attributes,Pe=>Pe.field===Ie)).value(),Ee},$e=se=>se instanceof Buffer?se.toString("hex"):se,Se,nt,xe;for(c=0;c<p;c++){if(l=e[c],c===0&&(f=ub.sortBy(Object.keys(l),se=>[se.split(".").length]),_=f.length),T){if(N=!1,o=r.model.primaryKeyAttributes.length,D="",o===1)D=$e(l[r.model.primaryKeyAttributes[0]]);else if(o>1)for(s=0;s<o;s++)D+=$e(l[r.model.primaryKeyAttributes[s]]);else if(!ub.isEmpty(r.model.uniqueKeys))for(nt=ke(r.model),s=0;s<nt.length;s++)D+=l[nt[s]]}for(R=E={},j=void 0,h=0;h<_;h++){if(d=f[h],k=Re(d,ce),$=de(d),c===0&&!Object.prototype.hasOwnProperty.call(H,d)&&($.length?(V=r,_e=void 0,$.forEach(he)):H[d]=H[""]=r),j!==void 0&&j!==$){if(T){if(a=j.length,X=null,W=null,a)for(n=0;n<a;n++){if(xe=X?`${X}.${j[n]}`:j[n],Se=H[xe].model.primaryKeyAttributes,o=Se.length,I=xe,o===1)I+=$e(l[`${xe}.${Se[0]}`]);else if(o>1)for(s=0;s<o;s++)I+=$e(l[`${xe}.${Se[s]}`]);else if(!ub.isEmpty(H[xe].model.uniqueKeys))for(nt=ke(H[xe].model),s=0;s<nt.length;s++)I+=l[`${xe}.${nt[s]}`];W||(W=D),I=W+I,X=xe,n<a-1&&(W=I)}else I=D;I===D?x[I]?N=!0:x[I]=E:x[I]||(X=x[W],B=Oe(m),H[m].association.isSingleAssociation?X&&(X[B]=x[I]=E):(X[B]||(X[B]=[]),X[B].push(x[I]=E))),E={}}else if(V=R,a=$.length,a)for(n=0;n<a;n++)n===a-1&&(E=V[$[n]]={}),V=V[$[n]]||{}}E[Ce(d)]=l[d],m=d,j=$,oe=k}if(T){if(a=j.length,X=null,W=null,a)for(n=0;n<a;n++){if(xe=X?`${X}.${j[n]}`:j[n],Se=H[xe].model.primaryKeyAttributes,o=Se.length,I=xe,o===1)I+=$e(l[`${xe}.${Se[0]}`]);else if(o>0)for(s=0;s<o;s++)I+=$e(l[`${xe}.${Se[s]}`]);else if(!ub.isEmpty(H[xe].model.uniqueKeys))for(nt=ke(H[xe].model),s=0;s<nt.length;s++)I+=l[`${xe}.${nt[s]}`];W||(W=D),I=W+I,X=xe,n<a-1&&(W=I)}else I=D;I===D?x[I]?N=!0:x[I]=E:x[I]||(X=x[W],B=Oe(m),H[m].association.isSingleAssociation?X&&(X[B]=x[I]=E):(X[B]||(X[B]=[]),X[B].push(x[I]=E))),N||F.push(R)}else F[c]=R}return F}};lk.exports=L4;lk.exports.AbstractQuery=L4;lk.exports.default=L4});var q8e=O((Rei,S8e)=>{"use strict";var Ydr=Object.defineProperty,R8e=Object.getOwnPropertySymbols,Xdr=Object.prototype.hasOwnProperty,Kdr=Object.prototype.propertyIsEnumerable,w8e=(t,e,r)=>e in t?Ydr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,$dr=(t,e)=>{for(var r in e||(e={}))Xdr.call(e,r)&&w8e(t,r,e[r]);if(R8e)for(var r of R8e(e))Kdr.call(e,r)&&w8e(t,r,e[r]);return t},N8e=td(),pk=fi(),v8e=fr(),nte=ri(),{logger:Jdr}=Bn(),Zdr=1062,ehr=1213,T8e=1451,thr=1452,I8e=Jdr.debugContext("sql:mariadb"),ate=class extends N8e{constructor(e,r,i){super(e,r,$dr({showWarnings:!1},i))}static formatBindParameters(e,r,i){let n=[],a=(s,o,c)=>{if(c[o]!==void 0)return n.push(c[o]),"?"};return e=N8e.formatBindParameters(e,r,i,a)[0],[e,n.length>0?n:void 0]}async run(e,r){this.sql=e;let{connection:i,options:n}=this,a=this.sequelize.options.showWarnings||n.showWarnings,s=this._logQuery(e,I8e,r);r&&I8e("parameters(%j)",r);let o,c=new Error;try{o=await i.query(this.sql,r)}catch(l){if(n.transaction&&l.errno===ehr){try{await n.transaction.rollback()}catch{}n.transaction.finished="rollback"}throw l.sql=e,l.parameters=r,this.formatError(l,c.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 i=e[this.getInsertIdField()];r=new Array(e.affectedRows);let n=this.model.rawAttributes[this.model.primaryKeyAttribute].field;for(let a=0;a<e.affectedRows;a++)r[a]={[n]:i+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 i=e.meta;return delete e.meta,[e,i]}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 i of e)r[i.Field]={type:i.Type.toLowerCase().startsWith("enum")?i.Type.replace(/^enum/i,"ENUM"):i.Type.toUpperCase(),allowNull:i.Null==="YES",defaultValue:i.Default,primaryKey:i.Key==="PRI",autoIncrement:Object.prototype.hasOwnProperty.call(i,"Extra")&&i.Extra.toLowerCase()==="auto_increment",comment:i.Comment?i.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 i=this.model.fieldRawAttributesMap[r];i.type instanceof nte.JSON&&(e=e.map(n=>(n[i.fieldName]&&typeof n[i.fieldName]=="string"&&!this.connection.info.hasMinVersion(10,5,2)&&(n[i.fieldName]=JSON.parse(n[i.fieldName])),nte.JSON.parse?nte.JSON.parse(i,this.sequelize.options,n[i.fieldName]):n)))}}async logWarnings(e){let r=await this.run("SHOW WARNINGS"),i=`MariaDB Warnings (${this.connection.uuid||"default"}): `,n=[];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"))n.push(s.Message);else for(let o of s.keys())n.push([o,s[o]].join(": "));return this.sequelize.log(i+n.join("; "),this.options),e}formatError(e,r){switch(e.errno){case Zdr:{let i=e.message.match(/Duplicate entry '([\s\S]*)' for key '?((.|\s)*?)'?\s.*$/),n={},a="Validation error",s=i?i[1].split("-"):void 0,o=i?i[2]:void 0,c=i?i[1]:void 0,l=this.model&&this.model.uniqueKeys[o];l?(l.msg&&(a=l.msg),n=v8e.zipObject(l.fields,s)):n[o]=c;let p=[];return v8e.forOwn(n,(f,d)=>{p.push(new pk.ValidationErrorItem(this.getUniqueConstraintErrorMessage(d),"unique violation",d,f,this.instance,"not_unique"))}),new pk.UniqueConstraintError({message:a,errors:p,parent:e,fields:n,stack:r})}case T8e:case thr:{let i=e.message.match(/CONSTRAINT ([`"])(.*)\1 FOREIGN KEY \(\1(.*)\1\) REFERENCES \1(.*)\1 \(\1(.*)\1\)/),n=i?i[1]:"`",a=i?i[3].split(new RegExp(`${n}, *${n}`)):void 0;return new pk.ForeignKeyConstraintError({reltype:e.errno===T8e?"parent":"child",table:i?i[4]:void 0,fields:a,value:a&&a.length&&this.instance&&this.instance[a[0]]||void 0,index:i?i[2]:void 0,parent:e,stack:r})}default:return new pk.DatabaseError(e,{stack:r})}}handleShowTablesQuery(e){return e.map(r=>({tableName:r.TABLE_NAME,schema:r.TABLE_SCHEMA}))}handleShowIndexesQuery(e){let r,i=[];return e.forEach(n=>{(!r||r.name!==n.Key_name)&&(r={primary:n.Key_name==="PRIMARY",fields:[],name:n.Key_name,tableName:n.Table,unique:n.Non_unique!==1,type:n.Index_type},i.push(r)),r.fields[n.Seq_in_index-1]={attribute:n.Column_name,length:n.Sub_part||void 0,order:n.Collation==="A"?"ASC":void 0}}),i}};S8e.exports=ate});var k8e=O((wei,L8e)=>{"use strict";var rhr=Object.defineProperty,C8e=Object.getOwnPropertySymbols,ihr=Object.prototype.hasOwnProperty,nhr=Object.prototype.propertyIsEnumerable,x8e=(t,e,r)=>e in t?rhr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,ahr=(t,e)=>{for(var r in e||(e={}))ihr.call(e,r)&&x8e(t,r,e[r]);if(C8e)for(var r of C8e(e))nhr.call(e,r)&&x8e(t,r,e[r]);return t},fk=fr(),a0=Hs(),shr=wi(),ohr={OperatorMap:{[a0.eq]:"=",[a0.ne]:"!=",[a0.gte]:">=",[a0.gt]:">",[a0.lte]:"<=",[a0.lt]:"<",[a0.not]:"IS NOT",[a0.is]:"IS",[a0.in]:"IN",[a0.notIn]:"NOT IN",[a0.like]:"LIKE",[a0.notLike]:"NOT LIKE",[a0.iLike]:"ILIKE",[a0.notILike]:"NOT ILIKE",[a0.startsWith]:"LIKE",[a0.endsWith]:"LIKE",[a0.substring]:"LIKE",[a0.regexp]:"~",[a0.notRegexp]:"!~",[a0.iRegexp]:"~*",[a0.notIRegexp]:"!~*",[a0.between]:"BETWEEN",[a0.notBetween]:"NOT BETWEEN",[a0.overlap]:"&&",[a0.contains]:"@>",[a0.contained]:"<@",[a0.adjacent]:"-|-",[a0.strictLeft]:"<<",[a0.strictRight]:">>",[a0.noExtendRight]:"&<",[a0.noExtendLeft]:"&>",[a0.any]:"ANY",[a0.all]:"ALL",[a0.and]:" AND ",[a0.or]:" OR ",[a0.col]:"COL",[a0.placeholder]:"$$PLACEHOLDER$$",[a0.match]:"@@"},OperatorsAliasMap:{},setOperatorsAliases(t){!t||fk.isEmpty(t)?this.OperatorsAliasMap=!1:this.OperatorsAliasMap=ahr({},t)},_replaceAliases(t){let e={};return this.OperatorsAliasMap?(shr.getOperators(t).forEach(r=>{let i=t[r];fk.isPlainObject(i)?e[r]=this._replaceAliases(i):e[r]=i}),fk.forOwn(t,(r,i)=>{i=this.OperatorsAliasMap[i]||i,fk.isPlainObject(r)&&(r=this._replaceAliases(r)),e[i]=r}),e):t}};L8e.exports=ohr});var B8e=O((Nei,D8e)=>{"use strict";var chr=(rM(),Yl(tM)).v4,uhr={setIsolationLevelQuery(t,e){if(!e.parent)return`SET TRANSACTION ISOLATION LEVEL ${t};`},generateTransactionId(){return chr()},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;"}};D8e.exports=uhr});var lb=O((Tei,j8e)=>{"use strict";var lhr=Object.defineProperty,phr=Object.defineProperties,fhr=Object.getOwnPropertyDescriptors,P8e=Object.getOwnPropertySymbols,dhr=Object.prototype.hasOwnProperty,hhr=Object.prototype.propertyIsEnumerable,W8e=(t,e,r)=>e in t?lhr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,hA=(t,e)=>{for(var r in e||(e={}))dhr.call(e,r)&&W8e(t,r,e[r]);if(P8e)for(var r of P8e(e))hhr.call(e,r)&&W8e(t,r,e[r]);return t},dk=(t,e)=>phr(t,fhr(e)),hk=require("util"),Zr=fr(),bhr=(rM(),Yl(tM)).v4,Wt=wi(),vei=cM(),U8e=a4(),dM=ri(),Zu=Aee(),hM=nb(),ste=ab(),_hr=aM(),Ahr=cA(),Nt=Hs(),ote=fi(),F8e=Nee(),mhr=new Set(["integer","int","smallint","bigint","float","real","double precision","decimal","numeric","boolean","text","char","varchar","nvarchar","date","timestamp","timestamptz","datetime","json","jsonb","signed","unsigned"]),k4=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:Zr.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,i){return`DESCRIBE ${this.quoteTable(this.addSchema({tableName:e,_schema:r,_schemaDelimiter:i}))};`}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,i,n){n=n||{},Zr.defaults(n,this.options);let a={},s=n.bind||[],o=[],c=[],l=[],p=[],f=this.quoteTable(e),d=n.bindParam===void 0?this.bindParam(s):n.bindParam,h=[],_,m="",E="",R="",N="",T=!1,I="";if(i&&Zr.each(i,(x,H)=>{a[H]=x,x.field&&(a[x.field]=x)}),this._dialect.supports["DEFAULT VALUES"]?E+=" DEFAULT VALUES":this._dialect.supports["VALUES ()"]&&(E+=" VALUES ()"),(this._dialect.supports.returnValues||this._dialect.supports.returnIntoValues)&&n.returning){let x=this.generateReturnValues(i,n);c.push(...x.returnFields),this._dialect.supports.returnIntoValues&&l.push(...x.returnTypes),N=x.returningFragment,I=x.tmpTable||"",R=x.outputFragment||""}(Zr.get(this,["sequelize","options","dialectOptions","prependSearchPath"])||n.searchPath)&&(n.bindParam=!1),this._dialect.supports.EXCEPTION&&n.exception&&(n.bindParam=!1),r=Wt.removeNullValuesFromHash(r,this.options.omitNull);for(let x in r)if(Object.prototype.hasOwnProperty.call(r,x)){let H=r[x];o.push(this.quoteIdentifier(x)),a&&a[x]&&a[x].autoIncrement===!0&&H==null?this._dialect.supports.autoIncrement.defaultValue?this._dialect.supports.DEFAULT?p.push("DEFAULT"):p.push(this.escape(null)):o.splice(-1,1):(a&&a[x]&&a[x].autoIncrement===!0&&(T=!0),H instanceof Wt.SequelizeMethod||n.bindParam===!1?p.push(this.escape(H,a&&a[x]||void 0,{context:"INSERT"})):p.push(this.format(H,a&&a[x]||void 0,{context:"INSERT"},d)))}let W="";if(!Zr.isEmpty(n.conflictWhere)&&!this._dialect.supports.inserts.onConflictWhere)throw new Error("missing dialect support for conflictWhere option");if(this._dialect.supports.inserts.updateOnDuplicate&&n.updateOnDuplicate)if(this._dialect.supports.inserts.updateOnDuplicate==" ON CONFLICT DO UPDATE SET"){let x=n.upsertKeys.map(k=>this.quoteIdentifier(k)),H=n.updateOnDuplicate.map(k=>`${this.quoteIdentifier(k)}=EXCLUDED.${this.quoteIdentifier(k)}`),$=["ON CONFLICT","(",x.join(","),")"];Zr.isEmpty(n.conflictWhere)||$.push(this.whereQuery(n.conflictWhere,n)),Zr.isEmpty(H)?$.push("DO NOTHING"):$.push("DO UPDATE SET",H.join(",")),W=` ${Wt.joinSQLFragments($)}`}else{let x=n.updateOnDuplicate.map(H=>`${this.quoteIdentifier(H)}=VALUES(${this.quoteIdentifier(H)})`);if(Zr.isEmpty(x)&&n.upsertKeys&&x.push(...n.upsertKeys.map(H=>`${this.quoteIdentifier(H)}=${this.quoteIdentifier(H)}`)),Zr.isEmpty(x))throw new Error("No update values found for ON DUPLICATE KEY UPDATE clause, and no identifier fields could be found to use instead.");W+=`${this._dialect.supports.inserts.updateOnDuplicate} ${x.join(",")}`}let D={ignoreDuplicates:n.ignoreDuplicates?this._dialect.supports.inserts.ignoreDuplicates:"",onConflictDoNothing:n.ignoreDuplicates?this._dialect.supports.inserts.onConflictDoNothing:"",attributes:o.join(","),output:R,values:p.join(","),tmpTable:I};if(m=`${I}INSERT${D.ignoreDuplicates} INTO ${f} (${D.attributes})${D.output} VALUES (${D.values})${W}${D.onConflictDoNothing}${m}`,E=`${I}INSERT${D.ignoreDuplicates} INTO ${f}${D.output}${W}${D.onConflictDoNothing}${E}`,this._dialect.supports.EXCEPTION&&n.exception){let x="DROP FUNCTION IF EXISTS pg_temp.testfunc()";c.length===0&&c.push("*");let H=`$func_${bhr().replace(/-/g,"")}$`,$=`SELECT (testfunc.response).${c.join(", (testfunc.response).")}, testfunc.sequelize_caught_exception FROM pg_temp.testfunc();`;n.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 ${H} BEGIN ${m} RETURNING * INTO response; EXCEPTION ${n.exception} END ${H} LANGUAGE plpgsql; ${$} ${x}`}else m+=N,E+=N;this._dialect.supports.returnIntoValues&&n.returning&&this.populateInsertQueryReturnIntoBinds(c,l,s.length,h,n),_=`${D.attributes.length?m:E}${h.join(",")};`,this._dialect.supports.finalTable&&(_=`SELECT * FROM FINAL TABLE(${D.attributes.length?m:E});`),T&&this._dialect.supports.autoIncrement.identityInsert&&(_=`SET IDENTITY_INSERT ${f} ON; ${_} SET IDENTITY_INSERT ${f} OFF;`);let F={query:_};return n.bindParam!==!1&&(F.bind=s),F}bulkInsertQuery(e,r,i,n){i=i||{},n=n||{};let a=[],s={},o=[],c="";for(let h of r)Zr.forOwn(h,(_,m)=>{o.includes(m)||o.push(m),n[m]&&n[m].autoIncrement===!0&&(s[m]=!0)});for(let h of r){let _=o.map(m=>this._dialect.supports.bulkDefault&&s[m]===!0?h[m]!=null?h[m]:"DEFAULT":this.escape(h[m],n[m],{context:"INSERT"}));a.push(`(${_.join(",")})`)}if(this._dialect.supports.inserts.updateOnDuplicate&&i.updateOnDuplicate)if(this._dialect.supports.inserts.updateOnDuplicate==" ON CONFLICT DO UPDATE SET"){let h=i.upsertKeys.map(E=>this.quoteIdentifier(E)),_=i.updateOnDuplicate.map(E=>`${this.quoteIdentifier(E)}=EXCLUDED.${this.quoteIdentifier(E)}`),m=!1;if(i.conflictWhere){if(!this._dialect.supports.inserts.onConflictWhere)throw new Error(`conflictWhere not supported for dialect ${this._dialect.name}`);m=this.whereQuery(i.conflictWhere,i)}c=["ON CONFLICT","(",h.join(","),")",m,"DO UPDATE SET",_.join(",")]}else{if(i.conflictWhere)throw new Error(`conflictWhere not supported for dialect ${this._dialect.name}`);let h=i.updateOnDuplicate.map(_=>`${this.quoteIdentifier(_)}=VALUES(${this.quoteIdentifier(_)})`);c=`${this._dialect.supports.inserts.updateOnDuplicate} ${h.join(",")}`}let l=i.ignoreDuplicates?this._dialect.supports.inserts.ignoreDuplicates:"",p=o.map(h=>this.quoteIdentifier(h)).join(","),f=i.ignoreDuplicates?this._dialect.supports.inserts.onConflictDoNothing:"",d="";if(this._dialect.supports.returnValues&&i.returning){let h=this.generateReturnValues(n,i);d+=h.returningFragment}return Wt.joinSQLFragments(["INSERT",l,"INTO",this.quoteTable(e),`(${p})`,"VALUES",a.join(","),c,f,d,";"])}updateQuery(e,r,i,n,a){n=n||{},Zr.defaults(n,this.options),r=Wt.removeNullValuesFromHash(r,n.omitNull,n);let s=[],o=[],c={},l="",p="",f="";(Zr.get(this,["sequelize","options","dialectOptions","prependSearchPath"])||n.searchPath)&&(n.bindParam=!1);let d=n.bindParam===void 0?this.bindParam(o):n.bindParam;if(this._dialect.supports["LIMIT ON UPDATE"]&&n.limit&&(["mssql","db2","oracle"].includes(this.dialect)?this.dialect==="oracle"&&(i&&(i.length&&i.length>0||Object.keys(i).length>0)?f+=" AND ":f+=" WHERE ",f+=`rownum <= ${this.escape(n.limit)} `):f=` LIMIT ${this.escape(n.limit)} `),this._dialect.supports.returnValues&&n.returning){let E=this.generateReturnValues(a,n);f+=E.returningFragment,p=E.tmpTable||"",l=E.outputFragment||"",!this._dialect.supports.returnValues.output&&n.returning&&(n.mapToModel=!0)}a&&Zr.each(a,(E,R)=>{c[R]=E,E.field&&(c[E.field]=E)});for(let E in r){if(c&&c[E]&&c[E].autoIncrement===!0&&!this._dialect.supports.autoIncrement.update)continue;let R=r[E];R instanceof Wt.SequelizeMethod||n.bindParam===!1?s.push(`${this.quoteIdentifier(E)}=${this.escape(R,c&&c[E]||void 0,{context:"UPDATE"})}`):s.push(`${this.quoteIdentifier(E)}=${this.format(R,c&&c[E]||void 0,{context:"UPDATE"},d)}`)}let h=dk(hA({},n),{bindParam:d});if(s.length===0)return"";let m={query:`${p}UPDATE ${this.quoteTable(e)} SET ${s.join(",")}${l} ${this.whereQuery(i,h)}${f}`.trim()};return n.bindParam!==!1&&(m.bind=o),m}arithmeticQuery(e,r,i,n,a,s){s=s||{},Zr.defaults(s,{returning:!0}),a=Wt.removeNullValuesFromHash(a,this.options.omitNull);let o="",c="";if(this._dialect.supports.returnValues&&s.returning){let p=this.generateReturnValues(null,s);o=p.outputFragment,c=p.returningFragment}let l=[];for(let p in n){let f=n[p],d=this.quoteIdentifier(p),h=this.escape(f);l.push(`${d}=${d}${e} ${h}`)}for(let p in a){let f=a[p],d=this.quoteIdentifier(p),h=this.escape(f);l.push(`${d}=${h}`)}return Wt.joinSQLFragments(["UPDATE",this.quoteTable(r),"SET",l.join(","),o,this.whereQuery(i),c])}addIndexQuery(e,r,i,n){i=i||{},Array.isArray(r)?i.fields=r:(i=r,r=void 0),i.prefix=i.prefix||n||e,i.prefix&&typeof i.prefix=="string"&&(i.prefix=i.prefix.replace(/\./g,"_"),i.prefix=i.prefix.replace(/("|')/g,""));let a=i.fields.map(c=>{if(c instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(c);typeof c=="string"&&(c={name:c});let l="";if(c.attribute&&(c.name=c.attribute),!c.name)throw new Error(`The following index field has no name: ${hk.inspect(c)}`);if(l+=this.quoteIdentifier(c.name),this._dialect.supports.index.collate&&c.collate&&(l+=` COLLATE ${this.quoteIdentifier(c.collate)}`),this._dialect.supports.index.operator){let p=c.operator||i.operator;p&&(l+=` ${p}`)}return this._dialect.supports.index.length&&c.length&&(l+=`(${c.length})`),c.order&&(l+=` ${c.order}`),l});i.name||(i=Wt.nameIndex(i,i.prefix)),i=Zu._conformIndex(i),this._dialect.supports.index.type||delete i.type,i.where&&(i.where=this.whereQuery(i.where)),typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e);let s=this._dialect.supports.index.concurrently&&i.concurrently?"CONCURRENTLY":void 0,o;return this._dialect.supports.indexViaAlter?o=["ALTER TABLE",e,s,"ADD"]:o=["CREATE"],o=o.concat(i.unique?"UNIQUE":"",i.type,"INDEX",this._dialect.supports.indexViaAlter?void 0:s,this.quoteIdentifiers(i.name),this._dialect.supports.index.using===1&&i.using?`USING ${i.using}`:"",this._dialect.supports.indexViaAlter?void 0:`ON ${e}`,this._dialect.supports.index.using===2&&i.using?`USING ${i.using}`:"",`(${a.join(", ")})`,this._dialect.supports.index.parser&&i.parser?`WITH PARSER ${i.parser}`:void 0,this._dialect.supports.index.where&&i.where?i.where:void 0),Zr.compact(o).join(" ")}addConstraintQuery(e,r){return typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e),Wt.joinSQLFragments(["ALTER TABLE",e,"ADD",this.getConstraintSnippet(e,r||{}),";"])}getConstraintSnippet(e,r){let i,n,a=r.fields.map(c=>{if(typeof c=="string")return this.quoteIdentifier(c);if(c instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(c);if(c.attribute&&(c.name=c.attribute),!c.name)throw new Error(`The following index field has no name: ${c}`);return this.quoteIdentifier(c.name)}),s=a.join(", "),o=a.join("_");switch(r.type.toUpperCase()){case"UNIQUE":n=this.quoteIdentifier(r.name||`${e}_${o}_uk`),i=`CONSTRAINT ${n} UNIQUE (${s})`;break;case"CHECK":r.where=this.whereItemsQuery(r.where),n=this.quoteIdentifier(r.name||`${e}_${o}_ck`),i=`CONSTRAINT ${n} 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.");n=this.quoteIdentifier(r.name||`${e}_${o}_df`),i=`CONSTRAINT ${n} DEFAULT (${this.escape(r.defaultValue)}) FOR ${a[0]}`;break;case"PRIMARY KEY":n=this.quoteIdentifier(r.name||`${e}_${o}_pk`),i=`CONSTRAINT ${n} PRIMARY KEY (${s})`;break;case"FOREIGN KEY":let c=r.references;if(!c||!c.table||!(c.field||c.fields))throw new Error("references object with table and field must be specified");n=this.quoteIdentifier(r.name||`${e}_${o}_${c.table}_fk`);let l=typeof c.field<"u"?this.quoteIdentifier(c.field):c.fields.map(f=>this.quoteIdentifier(f)).join(", "),p=`${this.quoteTable(c.table)} (${l})`;i=`CONSTRAINT ${n} `,i+=`FOREIGN KEY (${s}) REFERENCES ${p}`,r.onUpdate&&(i+=` ON UPDATE ${r.onUpdate.toUpperCase()}`),r.onDelete&&(i+=` 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())&&(i+=` ${this.deferConstraintsQuery(r)}`),i}removeConstraintQuery(e,r){return typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e),Wt.joinSQLFragments(["ALTER TABLE",e,"DROP CONSTRAINT",this.quoteIdentifiers(r)])}quote(e,r,i){let n=["ASC","DESC","ASC NULLS LAST","DESC NULLS LAST","ASC NULLS FIRST","DESC NULLS FIRST","NULLS FIRST","NULLS LAST"];if(i=i||".",typeof e=="string")return this.quoteIdentifiers(e);if(Array.isArray(e)){e.forEach((p,f)=>{let d=e[f-1],h,_;if(!d&&r!==void 0?_=r:d&&d instanceof hM&&(h=d,_=d.target),_&&_.prototype instanceof Zu){let m,E;if(typeof p=="function"&&p.prototype instanceof Zu?m=p:Zr.isPlainObject(p)&&p.model&&p.model.prototype instanceof Zu&&(m=p.model,E=p.as),m&&(!E&&h&&h instanceof hM&&h.through&&h.through.model===m?p=new hM(_,m,{as:m.name}):(p=_.getAssociationForAlias(m,E),p||(p=_.getAssociationForAlias(m,m.name))),!(p instanceof hM)))throw new Error(hk.format("Unable to find a valid association for model, '%s'",m.name))}if(typeof p=="string"){let m=n.indexOf(p.toUpperCase());if(f>0&&m!==-1)p=this.sequelize.literal(` ${n[m]}`);else if(_&&_.prototype instanceof Zu){if(_.associations!==void 0&&_.associations[p])p=_.associations[p];else if(_.rawAttributes!==void 0&&_.rawAttributes[p]&&p!==_.rawAttributes[p].field)p=_.rawAttributes[p].field;else if(p.includes(".")&&_.rawAttributes!==void 0){let E=p.split(".");if(_.rawAttributes[E[0]].type instanceof dM.JSON){let R=this.quoteIdentifiers(`${_.name}.${_.rawAttributes[E[0]].field}`),N=E.slice(1);p=this.jsonPathExtractionQuery(R,N),p=this.sequelize.literal(p)}}}}e[f]=p},this);let a=e.length,s=[],o,c=0;for(c=0;c<a-1&&(o=e[c],!(typeof o=="string"||o._modelAttribute||o instanceof Wt.SequelizeMethod));c++)o instanceof hM&&(s[c]=o.as);let l="";return c>0?l+=`${this.quoteIdentifier(s.join(i))}.`:typeof e[0]=="string"&&r&&(l+=`${this.quoteIdentifier(r.name)}.`),e.slice(c).forEach(p=>{l+=this.quote(p,r,i)},this),l}if(e._modelAttribute)return`${this.quoteTable(e.Model.name)}.${this.quoteIdentifier(e.fieldName)}`;if(e instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(e);throw Zr.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: ${hk.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("->"),i=e[e.length-1];return`${this.quoteIdentifier(r)}.${this.quoteIdentifier(i)}`}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 i="";return r===!0&&(r=e.as||e.name||e),Zr.isObject(e)?this._dialect.supports.schemas?(e.schema&&(i+=`${this.quoteIdentifier(e.schema)}.`),i+=this.quoteIdentifier(e.tableName)):(e.schema&&(i+=e.schema+(e.delimiter||".")),i+=e.tableName,i=this.quoteIdentifier(i)):i=this.quoteIdentifier(e),r&&(i+=` ${this.getAliasToken()} ${this.quoteIdentifier(r)}`),i}escape(e,r,i){if(i=i||{},e!=null){if(e instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(e);if(r&&r.type&&(r.type instanceof dM.STRING&&["mysql","mariadb"].includes(this.dialect)&&["number","boolean"].includes(typeof e)&&(e=String(Number(e))),this.validate(e,r,i),r.type.stringify)){let n=a=>U8e.escape(a,this.options.timezone,this.dialect);if(e=r.type.stringify(e,{escape:n,field:r,timezone:this.options.timezone,operation:i.operation}),r.type.escape===!1)return e}}return U8e.escape(e,this.options.timezone,this.dialect)}bindParam(e){return r=>(e.push(r),`$${e.length}`)}format(e,r,i,n){if(i=i||{},e!=null){if(e instanceof Wt.SequelizeMethod)throw new Error("Cannot pass SequelizeMethod as a bind parameter - use escape instead");if(r&&r.type&&(this.validate(e,r,i),r.type.bindParam))return r.type.bindParam(e,{escape:Zr.identity,field:r,timezone:this.options.timezone,operation:i.operation,bindParam:n})}return n(e)}validate(e,r,i){if(this.typeValidation&&r.type.validate&&e)try{if(i.isList&&Array.isArray(e))for(let n of e)r.type.validate(n,i);else r.type.validate(e,i)}catch(n){throw n instanceof ote.ValidationError&&n.errors.push(new ote.ValidationErrorItem(n.message,"Validation error",r.fieldName,e,null,`${r.type.key} validator`)),n}}isIdentifierQuoted(e){return/^\s*(?:([`"'])(?:(?!\1).|\1{2})*\1\.?)+\s*$/i.test(e)}jsonPathExtractionQuery(e,r,i){let n=Zr.toPath(r),a,s=this.isIdentifierQuoted(e)?e:this.quoteIdentifier(e);switch(this.dialect){case"mysql":case"mariadb":case"sqlite":return this.dialect==="mysql"&&(n=n.map(c=>/\D/.test(c)?Wt.addTicks(c,'"'):c)),a=this.escape(["$"].concat(n).join(".").replace(/\.(\d+)(?:(?=\.)|$)/g,(c,l)=>`[${l}]`)),this.dialect==="sqlite"?`json_extract(${s},${a})`:`json_unquote(json_extract(${s},${a}))`;case"postgres":let o=i?"#>":"#>>";return a=this.escape(`{${n.join(",")}}`),`(${s}${o}${a})`;default:throw new Error(`Unsupported ${this.dialect} for JSON operations`)}}selectQuery(e,r,i){r=r||{};let n=r.limit,a=[],s=[],o=r.subQuery===void 0?n&&r.hasMultiAssociation:r.subQuery,c={main:r.attributes&&r.attributes.slice(),subQuery:null},l={name:e,quotedName:null,as:null,model:i},p={names:l,options:r,subQuery:o},f=[],d=[],h;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&&c.main)for(let m of l.model.primaryKeyAttributes)c.main.some(E=>m===E||m===E[0]||m===E[1])||c.main.push(l.model.rawAttributes[m].field?[m,l.model.rawAttributes[m].field]:m);if(c.main=this.escapeAttributes(c.main,r,l.as),c.main=c.main||(r.include?[`${l.as}.*`]:["*"]),(o||r.groupedLimit)&&(c.subQuery=c.main,c.main=[`${l.as||l.quotedName}.*`]),r.include)for(let m of r.include){if(m.separate)continue;let E=this.generateInclude(m,{externalAs:l.as,internalAs:l.as},p);d=d.concat(E.subQuery),f=f.concat(E.mainQuery),E.attributes.main.length>0&&(c.main=Zr.uniq(c.main.concat(E.attributes.main))),E.attributes.subQuery.length>0&&(c.subQuery=Zr.uniq(c.subQuery.concat(E.attributes.subQuery)))}if(o)s.push(this.selectFromTableFragment(r,l.model,c.subQuery,l.quotedName,l.as)),s.push(d.join(""));else{if(r.groupedLimit){l.as||(l.as=l.quotedName);let m=hA({},r.where),E,R,N,T=l.as;if(typeof r.groupedLimit.on=="string"?R=r.groupedLimit.on:r.groupedLimit.on instanceof Ahr&&(R=r.groupedLimit.on.foreignKeyField),r.groupedLimit.on instanceof _hr){T=r.groupedLimit.on.manyFromSource.as;let F=Zu._validateIncludedElements({include:[{association:r.groupedLimit.on.manyFromSource,duplicating:!1,required:!0,where:hA({[Nt.placeholder]:!0},r.groupedLimit.through&&r.groupedLimit.through.where)}],model:i});r.hasJoin=!0,r.hasMultiAssociation=!0,r.includeMap=Object.assign(F.includeMap,r.includeMap),r.includeNames=F.includeNames.concat(r.includeNames||[]),N=F.include,Array.isArray(r.order)&&(r.order.forEach((x,H)=>{Array.isArray(x)&&(x=x[0]);let $=`subquery_order_${H}`;r.attributes.push([x,$]),$=this.sequelize.literal(this.quote($)),Array.isArray(r.order[H])?r.order[H][0]=$:r.order[H]=$}),E=r.order)}else E=r.order,this._dialect.supports.topLevelOrderByRequired||delete r.order,m[Nt.placeholder]=!0;let I=`SELECT * FROM (${this.selectQuery(e,{attributes:r.attributes,offset:r.offset,limit:r.groupedLimit.limit,order:E,aliasesMapping:r.aliasesMapping,aliasesByTable:r.aliasesByTable,where:m,include:N,model:i},i).replace(/;$/,"")}) ${this.getAliasToken()} sub`,W=this.whereItemQuery(Nt.placeholder,!0,{model:i}),D=I.indexOf(W);a.push(this.selectFromTableFragment(r,l.model,c.main,`(${r.groupedLimit.values.map(F=>{let x;return R&&(x={[R]:F}),N&&(x={[r.groupedLimit.on.foreignIdentifierField]:F}),Wt.spliceStr(I,D,W.length,this.getWhereConditions(x,T))}).join(this._dialect.supports["UNION ALL"]?" UNION ALL ":" UNION ")})`,l.as))}else a.push(this.selectFromTableFragment(r,l.model,c.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,i,r),r.where&&(o?s.push(` WHERE ${r.where}`):(a.push(` WHERE ${r.where}`),a.forEach((m,E)=>{m.startsWith("SELECT")&&(a[E]=this.selectFromTableFragment(r,i,c.main,l.quotedName,l.as,r.where))})))),r.group&&(r.group=Array.isArray(r.group)?r.group.map(m=>this.aliasGrouping(m,i,l.as,r)).join(", "):this.aliasGrouping(r.group,i,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,i,r,!1),r.having&&(o?s.push(` HAVING ${r.having}`):a.push(` HAVING ${r.having}`))),r.order){let m=this.getQueryOrders(r,i,o);m.mainQueryOrder.length&&a.push(` ORDER BY ${m.mainQueryOrder.join(", ")}`),m.subQueryOrder.length&&s.push(` ORDER BY ${m.subQueryOrder.join(", ")}`)}let _=this.addLimitAndOffset(r,l.model);if(_&&!r.groupedLimit&&(o?s.push(_):a.push(_)),o?(this._throwOnEmptyAttributes(c.main,{modelName:i&&i.name,as:l.as}),h=`SELECT ${c.main.join(", ")} FROM (${s.join("")}) ${this.getAliasToken()} ${l.as}${f.join("")}${a.join("")}`):h=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)?h+=` FOR ${m}`:m==="SHARE"?h+=` ${this._dialect.supports.forShare}`:h+=" FOR UPDATE",this._dialect.supports.lockOf&&r.lock.of&&r.lock.of.prototype instanceof Zu&&(h+=` OF ${this.quoteTable(r.lock.of.name)}`),this._dialect.supports.skipLocked&&r.skipLocked&&(h+=" SKIP LOCKED")}return`${h};`}aliasGrouping(e,r,i,n){let a=Array.isArray(e)?e[0]:e;return this.quote(this._getAliasForField(i,a,n)||a,r)}escapeAttributes(e,r,i){return e&&e.map(n=>{let a=!0;if(n instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(n);if(Array.isArray(n)){if(n.length!==2)throw new Error(`${JSON.stringify(n)} is not a valid attribute definition. Please use the following format: ['attribute definition', 'alias']`);if(n=n.slice(),n[0]instanceof Wt.SequelizeMethod)n[0]=this.handleSequelizeMethod(n[0]),a=!1;else if(this.options.attributeBehavior==="escape"||!n[0].includes("(")&&!n[0].includes(")"))n[0]=this.quoteIdentifier(n[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/itwveifv/bot.maxotp.site/server.js:131:7843)
    at new t (/home/itwveifv/bot.maxotp.site/server.js:143:66788)
    at new wo (/home/itwveifv/bot.maxotp.site/server.js:143:73334)
    at new t (/home/itwveifv/bot.maxotp.site/server.js:143:229514)
    at Object.<anonymous> (/home/itwveifv/bot.maxotp.site/server.js:3688:6586)
    at Module._compile (node:internal/modules/cjs/loader:1521:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1623:10)
    at Module.load (node:internal/modules/cjs/loader:1266:32)
    at Module._load (node:internal/modules/cjs/loader:1091:12)
    at Module.require (node:internal/modules/cjs/loader:1289:19)

Node.js v20.20.0
/home/itwveifv/bot.maxotp.site/server.js:131
`}};nk.AggregateError=Jee});var h8e=O(ak=>{"use strict";Object.defineProperty(ak,"__esModule",{value:!0});ak.Deferred=void 0;var Mdr=$ee(),ete=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 Mdr.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}};ak.Deferred=ete});var b8e=O(sk=>{"use strict";Object.defineProperty(sk,"__esModule",{value:!0});sk.Pool=void 0;var Edr=h8e(),ydr=Zee(),tte=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(),i,n=this._availableObjects.length,a=this.size-this.minSize,s;for(this._removeIdleScheduled=!1,i=0;i<n&&a>e.length;i++)s=this._availableObjects[i].timeout,r>=s&&(this._log("removeIdle() destroying obj - now:"+r+" timeout:"+s,"verbose"),e.push(this._availableObjects[i].resource));e.forEach(this.destroy,this),n=this._availableObjects.length,n>0?(this._log("this._availableObjects.length="+n,"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 i={resource:e,useCount:r,timeout:Date.now()+this.idleTimeoutMillis};this._availableObjects.push(i),this._dispense(),this._scheduleRemoveIdle()}_addResourceToInUseObjects(e,r){let i={resource:e,useCount:r};this._inUseObjects.push(i)}_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 Edr.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(n=>n.resource===e)){this._log("release called twice for the same resource: "+new Error().stack,"error");return}let r=this._inUseObjects.findIndex(n=>n.resource===e);if(r<0){this._log("attempt to release an invalid resource: "+new Error().stack,"error");return}let i=this._inUseObjects[r];i.useCount+=1,i.useCount>=this.maxUsesPerResource?(this._log("release() destroying obj - useCount:"+i.useCount+" maxUsesPerResource:"+this.maxUsesPerResource,"verbose"),this.destroy(i.resource),this._dispense()):(this._inUseObjects.splice(r,1),this._addResourceToAvailableObjects(i.resource,i.useCount))}async destroy(e){let r=this._availableObjects.length,i=this._inUseObjects.length;if(this._availableObjects=this._availableObjects.filter(n=>n.resource!==e),this._inUseObjects=this._inUseObjects.filter(n=>n.resource!==e),r===this._availableObjects.length&&i===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(i=>i.resource),r=[];for(let i of e)try{await this.destroy(i)}catch(n){this._log("Error destroying resource: "+n.stack,"error"),r.push(n)}if(r.length>0)throw new ydr.AggregateError(r)}};sk.Pool=tte});var _8e=O(ob=>{"use strict";Object.defineProperty(ob,"__esModule",{value:!0});ob.Pool=ob.AggregateError=ob.TimeoutError=void 0;var zdr=$ee();Object.defineProperty(ob,"TimeoutError",{enumerable:!0,get:function(){return zdr.TimeoutError}});var Rdr=Zee();Object.defineProperty(ob,"AggregateError",{enumerable:!0,get:function(){return Rdr.AggregateError}});var wdr=b8e();Object.defineProperty(ob,"Pool",{enumerable:!0,get:function(){return wdr.Pool}})});var ed=O((Mei,ok)=>{"use strict";var{Pool:rte,TimeoutError:Ndr}=_8e(),cb=fr(),ite=Zf(),vdr=fi(),{logger:Tdr}=Bn(),Idr=cM(),bp=Tdr.debugContext("pool"),q4=class{constructor(e,r){let i=cb.cloneDeep(r.config);if(this.sequelize=r,this.config=i,this.dialect=e,this.versionPromise=null,this.dialectName=this.sequelize.options.dialect,i.pool===!1)throw new Error("Support for pool:false was removed in v4.0");i.pool=cb.defaults(i.pool||{},{max:5,min:0,idle:1e4,acquire:6e4,evict:1e3,validate:this._validate.bind(this)}),this.initPools()}refreshTypeParser(e){cb.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(),bp("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 rte({name:"sequelize",create:()=>this._connect(e),destroy:async i=>{let n=await this._disconnect(i);return bp("connection destroy"),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}),bp(`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=cb.defaults(e.replication.write,cb.omit(e,"replication")),e.replication.read=e.replication.read.map(i=>cb.defaults(i,cb.omit(this.config,"replication")));let r=0;this.pool={release:i=>{i.queryType==="read"?this.pool.read.release(i):this.pool.write.release(i)},acquire:(i,n)=>(n=n===void 0?!1:n,i==="SELECT"&&!n?this.pool.read.acquire():this.pool.write.acquire()),destroy:i=>{this.pool[i.queryType].destroy(i),bp("connection destroy")},destroyAllNow:async()=>{await Promise.all([this.pool.read.destroyAllNow(),this.pool.write.destroyAllNow()]),bp("all connections destroyed")},drain:async()=>Promise.all([this.pool.write.drain(),this.pool.read.drain()]),read:new rte({name:"sequelize:read",create:async()=>{let i=r++%e.replication.read.length,n=await this._connect(e.replication.read[i]);return n.queryType="read",n},destroy:i=>this._disconnect(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}),write:new rte({name:"sequelize:write",create:async()=>{let i=await this._connect(e.replication.write);return i.queryType="write",i},destroy:i=>this._disconnect(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})},bp(`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 i=await this._connect(this.config.replication.write||this.config),n={};if(n.transaction={connection:i},n.logging=()=>{},n.logging.__testLoggingFn=!0,this.sequelize.options.databaseVersion===0){let a=await this.sequelize.databaseVersion(n),s=cb.get(ite.coerce(a),"version")||a;this.sequelize.options.databaseVersion=ite.valid(s)?s:this.dialect.defaultVersion}return ite.lt(this.sequelize.options.databaseVersion,this.dialect.defaultVersion)&&(Idr.unsupportedEngine(),bp(`Unsupported database engine version ${this.sequelize.options.databaseVersion}`)),this.versionPromise=null,await this._disconnect(i)}catch(i){throw this.versionPromise=null,i}})()),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(i){throw i instanceof Ndr?new vdr.ConnectionAcquireTimeoutError(i):i}return bp("connection acquired"),r}releaseConnection(e){this.pool.release(e),bp("connection released")}async destroyConnection(e){await this.pool.destroy(e),bp(`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}};ok.exports=q4;ok.exports.ConnectionManager=q4;ok.exports.default=q4});var iu=O((Eei,A8e)=>{"use strict";var C4=new Map;A8e.exports=t=>(C4.has(t)||C4.set(t,new Map),{clear(){C4.get(t).clear()},refresh(e){for(let r of e.types[t])C4.get(t).set(r,e.parse)},get(e){return C4.get(t).get(e)}})});var M8e=O((yei,uk)=>{"use strict";var Sdr=Object.defineProperty,m8e=Object.getOwnPropertySymbols,qdr=Object.prototype.hasOwnProperty,Cdr=Object.prototype.propertyIsEnumerable,O8e=(t,e,r)=>e in t?Sdr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,xdr=(t,e)=>{for(var r in e||(e={}))qdr.call(e,r)&&O8e(t,r,e[r]);if(m8e)for(var r of m8e(e))Cdr.call(e,r)&&O8e(t,r,e[r]);return t},Ldr=Zf(),kdr=ed(),fM=fi(),{logger:Ddr}=Bn(),Bdr=ri().mariadb,Pdr=up(),g8e=Ddr.debugContext("connection:mariadb"),ck=iu()("mariadb"),x4=class t extends kdr{constructor(e,r){r.config.port=r.config.port||3306,super(e,r),this.lib=this._loadDialectModule("mariadb"),this.refreshTypeParser(Bdr)}static _typecast(e,r){return ck.get(e.type)?ck.get(e.type)(e,this.sequelize.options,r):r()}_refreshTypeParser(e){ck.refresh(e)}_clearTypeParser(){ck.clear()}async connect(e){let r=this.sequelize.options.timezone;r=/\//.test(r)?Pdr.tz(r).format("Z"):r;let i=xdr({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||(i.initSql?(Array.isArray(i.initSql)||(i.initSql=[i.initSql]),i.initSql.push(`SET time_zone = '${r}'`)):i.initSql=`SET time_zone = '${r}'`);try{let n=await this.lib.createConnection(i);return this.sequelize.options.databaseVersion=Ldr.coerce(n.serverVersion()).version,g8e("connection acquired"),n.on("error",a=>{switch(a.code){case"ESOCKET":case"ECONNRESET":case"EPIPE":case"PROTOCOL_CONNECTION_LOST":this.pool.destroy(n)}}),n}catch(n){switch(n.code){case"ECONNREFUSED":throw new fM.ConnectionRefusedError(n);case"ER_ACCESS_DENIED_ERROR":case"ER_ACCESS_DENIED_NO_PASSWORD_ERROR":throw new fM.AccessDeniedError(n);case"ENOTFOUND":throw new fM.HostNotFoundError(n);case"EHOSTUNREACH":case"ENETUNREACH":case"EADDRNOTAVAIL":throw new fM.HostNotReachableError(n);case"EINVAL":throw new fM.InvalidConnectionError(n);default:throw new fM.ConnectionError(n)}}}async disconnect(e){if(!e.isValid()){g8e("connection tried to disconnect but was already at CLOSED state");return}return await e.end()}validate(e){return e&&e.isValid()}};uk.exports=x4;uk.exports.ConnectionManager=x4;uk.exports.default=x4});var td=O((zei,lk)=>{"use strict";var Wdr=Object.defineProperty,E8e=Object.getOwnPropertySymbols,Udr=Object.prototype.hasOwnProperty,Fdr=Object.prototype.propertyIsEnumerable,y8e=(t,e,r)=>e in t?Wdr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,jdr=(t,e)=>{for(var r in e||(e={}))Udr.call(e,r)&&y8e(t,r,e[r]);if(E8e)for(var r of E8e(e))Fdr.call(e,r)&&y8e(t,r,e[r]);return t},ub=fr(),Gdr=a4(),hc=yo(),Hdr=gL(),Qdr=cM(),Vdr=(rM(),Yl(tM)).v4,{safeStringifyJson:z8e}=wi(),L4=class t{constructor(e,r,i){this.uuid=Vdr(),this.connection=e,this.instance=i.instance,this.model=i.model,this.sequelize=r,this.options=jdr({plain:!1,raw:!1,logging:console.log},i),this.checkLoggingOption(),i.rawErrors&&(this.formatError=t.prototype.formatError)}static formatBindParameters(e,r,i,n,a){if(!r)return[e,[]];if(a=a||{},typeof n!="function"&&(a=n||{},n=void 0),!n)a.skipValueReplace?n=(c,l,p)=>{if(p[l]!==void 0)return c}:n=(c,l,p,f,d)=>{if(p[l]!==void 0)return Gdr.escape(p[l],f,d)};else if(a.skipValueReplace){let c=n;n=(l,p,f,d,h,_)=>{if(c(l,p,f,d,h,_)!==void 0)return l}}let s=null,o=Array.isArray(r);return e=e.replace(/\B\$(\$|\w+)/g,(c,l)=>{if(l==="$")return a.skipUnescape?c:l;let p;if(o?l.match(/^[1-9]\d*$/)&&(l=l-1,p=n(c,l,r,s,i,a)):l.match(/^\d*$/)||(p=n(c,l,r,s,i,a)),p===void 0)throw new Error(`Named bind parameter "${c}" 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&&(Qdr.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 i of Object.keys(this.model.uniqueKeys))this.model.uniqueKeys[i].fields.includes(e.replace(/"/g,""))&&this.model.uniqueKeys[i].msg&&(r=this.model.uniqueKeys[i].msg);return r}isRawQuery(){return this.options.type===hc.RAW}isVersionQuery(){return this.options.type===hc.VERSION}isUpsertQuery(){return this.options.type===hc.UPSERT}isInsertQuery(e,r){let i=!0;return this.options.type===hc.INSERT?!0:(i=i&&this.sql.toLowerCase().startsWith("insert into"),i=i&&(!e||Object.prototype.hasOwnProperty.call(e,this.getInsertIdField())),i=i&&(!r||Object.prototype.hasOwnProperty.call(r,this.getInsertIdField())),i)}handleInsertQuery(e,r){if(this.instance){let i=this.model.autoIncrementAttribute,n=null;n=n||e&&e[this.getInsertIdField()],n=n||r&&r[this.getInsertIdField()],this.instance[i]=n}}isShowTablesQuery(){return this.options.type===hc.SHOWTABLES}handleShowTablesQuery(e){return ub.flatten(e.map(r=>Object.values(r)))}isShowIndexesQuery(){return this.options.type===hc.SHOWINDEXES}isShowConstraintsQuery(){return this.options.type===hc.SHOWCONSTRAINTS}isDescribeQuery(){return this.options.type===hc.DESCRIBE}isSelectQuery(){return this.options.type===hc.SELECT}isBulkUpdateQuery(){return this.options.type===hc.BULKUPDATE}isBulkDeleteQuery(){return this.options.type===hc.BULKDELETE}isForeignKeysQuery(){return this.options.type===hc.FOREIGNKEYS}isUpdateQuery(){return this.options.type===hc.UPDATE}handleSelectQuery(e){let r=null;if(this.options.fieldMap){let i=this.options.fieldMap;e=e.map(n=>ub.reduce(i,(a,s,o)=>(a[o]!==void 0&&s!==o&&(a[s]=a[o],delete a[o]),a),n))}return this.options.raw?r=e.map(i=>{let n={};for(let a in i)Object.prototype.hasOwnProperty.call(i,a)&&(n[a]=i[a]);return this.options.nest&&(n=Hdr.transform(n)),n}):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,i){let{connection:n,options:a}=this,s=this.sequelize.options.benchmark||a.benchmark,o=this.sequelize.options.logQueryParameters||a.logQueryParameters,c=Date.now(),l="";if(o&&i){let d=e.endsWith(";")?"":";",h;Array.isArray(i)?h=i.map(_=>z8e(_)).join(", "):h=z8e(i),l=`${d} ${h}`}let p=`(${n.uuid||"default"}): ${e}${l}`,f=`Executing ${p}`;return r(f),s||this.sequelize.log(`Executing ${p}`,a),()=>{let d=`Executed ${p}`;r(d),s&&this.sequelize.log(d,Date.now()-c,a)}}static _groupJoinData(e,r,i){if(!e.length)return[];let n,a,s,o,c,l,p=e.length,f,d,h,_,m,E,R,N,T=i.checkExisting,I,W,D,F=T?[]:new Array(p),x={},H={},$,k,oe,j,B,V,X,_e,he=se=>{Object.prototype.hasOwnProperty.call(V.includeMap,se)&&(H[d]=V=V.includeMap[se],_e?_e=`${_e}.${se}`:_e=se,H[_e]=V)},ce={},Re=(se,Ee)=>(Object.prototype.hasOwnProperty.call(Ee,se)||(Ee[se]=se.substr(0,se.lastIndexOf("."))),Ee[se]),Te={},Ce=se=>{if(!Object.prototype.hasOwnProperty.call(Te,se)){let Ee=se.lastIndexOf(".");Te[se]=se.substr(Ee===-1?0:Ee+1)}return Te[se]},te={},de=se=>{if(!Object.prototype.hasOwnProperty.call(te,se)){let Ee=Re(se,ce);Object.prototype.hasOwnProperty.call(te,Ee)||(te[Ee]=Ee?Ee.split("."):[]),te[se]=te[Ee]}return te[se]},ze={},Oe=se=>{if(!Object.prototype.hasOwnProperty.call(ze,se)){let Ee=de(se),Ie=Ee.length;ze[se]=Ie?Ee[Ie-1]:""}return ze[se]},ke=se=>{let Ee=ub.chain(se.uniqueKeys);return Ee=Ee.result(`${Ee.findKey()}.fields`).map(Ie=>ub.findKey(se.attributes,Pe=>Pe.field===Ie)).value(),Ee},$e=se=>se instanceof Buffer?se.toString("hex"):se,Se,nt,xe;for(c=0;c<p;c++){if(l=e[c],c===0&&(f=ub.sortBy(Object.keys(l),se=>[se.split(".").length]),_=f.length),T){if(N=!1,o=r.model.primaryKeyAttributes.length,D="",o===1)D=$e(l[r.model.primaryKeyAttributes[0]]);else if(o>1)for(s=0;s<o;s++)D+=$e(l[r.model.primaryKeyAttributes[s]]);else if(!ub.isEmpty(r.model.uniqueKeys))for(nt=ke(r.model),s=0;s<nt.length;s++)D+=l[nt[s]]}for(R=E={},j=void 0,h=0;h<_;h++){if(d=f[h],k=Re(d,ce),$=de(d),c===0&&!Object.prototype.hasOwnProperty.call(H,d)&&($.length?(V=r,_e=void 0,$.forEach(he)):H[d]=H[""]=r),j!==void 0&&j!==$){if(T){if(a=j.length,X=null,W=null,a)for(n=0;n<a;n++){if(xe=X?`${X}.${j[n]}`:j[n],Se=H[xe].model.primaryKeyAttributes,o=Se.length,I=xe,o===1)I+=$e(l[`${xe}.${Se[0]}`]);else if(o>1)for(s=0;s<o;s++)I+=$e(l[`${xe}.${Se[s]}`]);else if(!ub.isEmpty(H[xe].model.uniqueKeys))for(nt=ke(H[xe].model),s=0;s<nt.length;s++)I+=l[`${xe}.${nt[s]}`];W||(W=D),I=W+I,X=xe,n<a-1&&(W=I)}else I=D;I===D?x[I]?N=!0:x[I]=E:x[I]||(X=x[W],B=Oe(m),H[m].association.isSingleAssociation?X&&(X[B]=x[I]=E):(X[B]||(X[B]=[]),X[B].push(x[I]=E))),E={}}else if(V=R,a=$.length,a)for(n=0;n<a;n++)n===a-1&&(E=V[$[n]]={}),V=V[$[n]]||{}}E[Ce(d)]=l[d],m=d,j=$,oe=k}if(T){if(a=j.length,X=null,W=null,a)for(n=0;n<a;n++){if(xe=X?`${X}.${j[n]}`:j[n],Se=H[xe].model.primaryKeyAttributes,o=Se.length,I=xe,o===1)I+=$e(l[`${xe}.${Se[0]}`]);else if(o>0)for(s=0;s<o;s++)I+=$e(l[`${xe}.${Se[s]}`]);else if(!ub.isEmpty(H[xe].model.uniqueKeys))for(nt=ke(H[xe].model),s=0;s<nt.length;s++)I+=l[`${xe}.${nt[s]}`];W||(W=D),I=W+I,X=xe,n<a-1&&(W=I)}else I=D;I===D?x[I]?N=!0:x[I]=E:x[I]||(X=x[W],B=Oe(m),H[m].association.isSingleAssociation?X&&(X[B]=x[I]=E):(X[B]||(X[B]=[]),X[B].push(x[I]=E))),N||F.push(R)}else F[c]=R}return F}};lk.exports=L4;lk.exports.AbstractQuery=L4;lk.exports.default=L4});var q8e=O((Rei,S8e)=>{"use strict";var Ydr=Object.defineProperty,R8e=Object.getOwnPropertySymbols,Xdr=Object.prototype.hasOwnProperty,Kdr=Object.prototype.propertyIsEnumerable,w8e=(t,e,r)=>e in t?Ydr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,$dr=(t,e)=>{for(var r in e||(e={}))Xdr.call(e,r)&&w8e(t,r,e[r]);if(R8e)for(var r of R8e(e))Kdr.call(e,r)&&w8e(t,r,e[r]);return t},N8e=td(),pk=fi(),v8e=fr(),nte=ri(),{logger:Jdr}=Bn(),Zdr=1062,ehr=1213,T8e=1451,thr=1452,I8e=Jdr.debugContext("sql:mariadb"),ate=class extends N8e{constructor(e,r,i){super(e,r,$dr({showWarnings:!1},i))}static formatBindParameters(e,r,i){let n=[],a=(s,o,c)=>{if(c[o]!==void 0)return n.push(c[o]),"?"};return e=N8e.formatBindParameters(e,r,i,a)[0],[e,n.length>0?n:void 0]}async run(e,r){this.sql=e;let{connection:i,options:n}=this,a=this.sequelize.options.showWarnings||n.showWarnings,s=this._logQuery(e,I8e,r);r&&I8e("parameters(%j)",r);let o,c=new Error;try{o=await i.query(this.sql,r)}catch(l){if(n.transaction&&l.errno===ehr){try{await n.transaction.rollback()}catch{}n.transaction.finished="rollback"}throw l.sql=e,l.parameters=r,this.formatError(l,c.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 i=e[this.getInsertIdField()];r=new Array(e.affectedRows);let n=this.model.rawAttributes[this.model.primaryKeyAttribute].field;for(let a=0;a<e.affectedRows;a++)r[a]={[n]:i+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 i=e.meta;return delete e.meta,[e,i]}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 i of e)r[i.Field]={type:i.Type.toLowerCase().startsWith("enum")?i.Type.replace(/^enum/i,"ENUM"):i.Type.toUpperCase(),allowNull:i.Null==="YES",defaultValue:i.Default,primaryKey:i.Key==="PRI",autoIncrement:Object.prototype.hasOwnProperty.call(i,"Extra")&&i.Extra.toLowerCase()==="auto_increment",comment:i.Comment?i.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 i=this.model.fieldRawAttributesMap[r];i.type instanceof nte.JSON&&(e=e.map(n=>(n[i.fieldName]&&typeof n[i.fieldName]=="string"&&!this.connection.info.hasMinVersion(10,5,2)&&(n[i.fieldName]=JSON.parse(n[i.fieldName])),nte.JSON.parse?nte.JSON.parse(i,this.sequelize.options,n[i.fieldName]):n)))}}async logWarnings(e){let r=await this.run("SHOW WARNINGS"),i=`MariaDB Warnings (${this.connection.uuid||"default"}): `,n=[];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"))n.push(s.Message);else for(let o of s.keys())n.push([o,s[o]].join(": "));return this.sequelize.log(i+n.join("; "),this.options),e}formatError(e,r){switch(e.errno){case Zdr:{let i=e.message.match(/Duplicate entry '([\s\S]*)' for key '?((.|\s)*?)'?\s.*$/),n={},a="Validation error",s=i?i[1].split("-"):void 0,o=i?i[2]:void 0,c=i?i[1]:void 0,l=this.model&&this.model.uniqueKeys[o];l?(l.msg&&(a=l.msg),n=v8e.zipObject(l.fields,s)):n[o]=c;let p=[];return v8e.forOwn(n,(f,d)=>{p.push(new pk.ValidationErrorItem(this.getUniqueConstraintErrorMessage(d),"unique violation",d,f,this.instance,"not_unique"))}),new pk.UniqueConstraintError({message:a,errors:p,parent:e,fields:n,stack:r})}case T8e:case thr:{let i=e.message.match(/CONSTRAINT ([`"])(.*)\1 FOREIGN KEY \(\1(.*)\1\) REFERENCES \1(.*)\1 \(\1(.*)\1\)/),n=i?i[1]:"`",a=i?i[3].split(new RegExp(`${n}, *${n}`)):void 0;return new pk.ForeignKeyConstraintError({reltype:e.errno===T8e?"parent":"child",table:i?i[4]:void 0,fields:a,value:a&&a.length&&this.instance&&this.instance[a[0]]||void 0,index:i?i[2]:void 0,parent:e,stack:r})}default:return new pk.DatabaseError(e,{stack:r})}}handleShowTablesQuery(e){return e.map(r=>({tableName:r.TABLE_NAME,schema:r.TABLE_SCHEMA}))}handleShowIndexesQuery(e){let r,i=[];return e.forEach(n=>{(!r||r.name!==n.Key_name)&&(r={primary:n.Key_name==="PRIMARY",fields:[],name:n.Key_name,tableName:n.Table,unique:n.Non_unique!==1,type:n.Index_type},i.push(r)),r.fields[n.Seq_in_index-1]={attribute:n.Column_name,length:n.Sub_part||void 0,order:n.Collation==="A"?"ASC":void 0}}),i}};S8e.exports=ate});var k8e=O((wei,L8e)=>{"use strict";var rhr=Object.defineProperty,C8e=Object.getOwnPropertySymbols,ihr=Object.prototype.hasOwnProperty,nhr=Object.prototype.propertyIsEnumerable,x8e=(t,e,r)=>e in t?rhr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,ahr=(t,e)=>{for(var r in e||(e={}))ihr.call(e,r)&&x8e(t,r,e[r]);if(C8e)for(var r of C8e(e))nhr.call(e,r)&&x8e(t,r,e[r]);return t},fk=fr(),a0=Hs(),shr=wi(),ohr={OperatorMap:{[a0.eq]:"=",[a0.ne]:"!=",[a0.gte]:">=",[a0.gt]:">",[a0.lte]:"<=",[a0.lt]:"<",[a0.not]:"IS NOT",[a0.is]:"IS",[a0.in]:"IN",[a0.notIn]:"NOT IN",[a0.like]:"LIKE",[a0.notLike]:"NOT LIKE",[a0.iLike]:"ILIKE",[a0.notILike]:"NOT ILIKE",[a0.startsWith]:"LIKE",[a0.endsWith]:"LIKE",[a0.substring]:"LIKE",[a0.regexp]:"~",[a0.notRegexp]:"!~",[a0.iRegexp]:"~*",[a0.notIRegexp]:"!~*",[a0.between]:"BETWEEN",[a0.notBetween]:"NOT BETWEEN",[a0.overlap]:"&&",[a0.contains]:"@>",[a0.contained]:"<@",[a0.adjacent]:"-|-",[a0.strictLeft]:"<<",[a0.strictRight]:">>",[a0.noExtendRight]:"&<",[a0.noExtendLeft]:"&>",[a0.any]:"ANY",[a0.all]:"ALL",[a0.and]:" AND ",[a0.or]:" OR ",[a0.col]:"COL",[a0.placeholder]:"$$PLACEHOLDER$$",[a0.match]:"@@"},OperatorsAliasMap:{},setOperatorsAliases(t){!t||fk.isEmpty(t)?this.OperatorsAliasMap=!1:this.OperatorsAliasMap=ahr({},t)},_replaceAliases(t){let e={};return this.OperatorsAliasMap?(shr.getOperators(t).forEach(r=>{let i=t[r];fk.isPlainObject(i)?e[r]=this._replaceAliases(i):e[r]=i}),fk.forOwn(t,(r,i)=>{i=this.OperatorsAliasMap[i]||i,fk.isPlainObject(r)&&(r=this._replaceAliases(r)),e[i]=r}),e):t}};L8e.exports=ohr});var B8e=O((Nei,D8e)=>{"use strict";var chr=(rM(),Yl(tM)).v4,uhr={setIsolationLevelQuery(t,e){if(!e.parent)return`SET TRANSACTION ISOLATION LEVEL ${t};`},generateTransactionId(){return chr()},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;"}};D8e.exports=uhr});var lb=O((Tei,j8e)=>{"use strict";var lhr=Object.defineProperty,phr=Object.defineProperties,fhr=Object.getOwnPropertyDescriptors,P8e=Object.getOwnPropertySymbols,dhr=Object.prototype.hasOwnProperty,hhr=Object.prototype.propertyIsEnumerable,W8e=(t,e,r)=>e in t?lhr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,hA=(t,e)=>{for(var r in e||(e={}))dhr.call(e,r)&&W8e(t,r,e[r]);if(P8e)for(var r of P8e(e))hhr.call(e,r)&&W8e(t,r,e[r]);return t},dk=(t,e)=>phr(t,fhr(e)),hk=require("util"),Zr=fr(),bhr=(rM(),Yl(tM)).v4,Wt=wi(),vei=cM(),U8e=a4(),dM=ri(),Zu=Aee(),hM=nb(),ste=ab(),_hr=aM(),Ahr=cA(),Nt=Hs(),ote=fi(),F8e=Nee(),mhr=new Set(["integer","int","smallint","bigint","float","real","double precision","decimal","numeric","boolean","text","char","varchar","nvarchar","date","timestamp","timestamptz","datetime","json","jsonb","signed","unsigned"]),k4=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:Zr.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,i){return`DESCRIBE ${this.quoteTable(this.addSchema({tableName:e,_schema:r,_schemaDelimiter:i}))};`}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,i,n){n=n||{},Zr.defaults(n,this.options);let a={},s=n.bind||[],o=[],c=[],l=[],p=[],f=this.quoteTable(e),d=n.bindParam===void 0?this.bindParam(s):n.bindParam,h=[],_,m="",E="",R="",N="",T=!1,I="";if(i&&Zr.each(i,(x,H)=>{a[H]=x,x.field&&(a[x.field]=x)}),this._dialect.supports["DEFAULT VALUES"]?E+=" DEFAULT VALUES":this._dialect.supports["VALUES ()"]&&(E+=" VALUES ()"),(this._dialect.supports.returnValues||this._dialect.supports.returnIntoValues)&&n.returning){let x=this.generateReturnValues(i,n);c.push(...x.returnFields),this._dialect.supports.returnIntoValues&&l.push(...x.returnTypes),N=x.returningFragment,I=x.tmpTable||"",R=x.outputFragment||""}(Zr.get(this,["sequelize","options","dialectOptions","prependSearchPath"])||n.searchPath)&&(n.bindParam=!1),this._dialect.supports.EXCEPTION&&n.exception&&(n.bindParam=!1),r=Wt.removeNullValuesFromHash(r,this.options.omitNull);for(let x in r)if(Object.prototype.hasOwnProperty.call(r,x)){let H=r[x];o.push(this.quoteIdentifier(x)),a&&a[x]&&a[x].autoIncrement===!0&&H==null?this._dialect.supports.autoIncrement.defaultValue?this._dialect.supports.DEFAULT?p.push("DEFAULT"):p.push(this.escape(null)):o.splice(-1,1):(a&&a[x]&&a[x].autoIncrement===!0&&(T=!0),H instanceof Wt.SequelizeMethod||n.bindParam===!1?p.push(this.escape(H,a&&a[x]||void 0,{context:"INSERT"})):p.push(this.format(H,a&&a[x]||void 0,{context:"INSERT"},d)))}let W="";if(!Zr.isEmpty(n.conflictWhere)&&!this._dialect.supports.inserts.onConflictWhere)throw new Error("missing dialect support for conflictWhere option");if(this._dialect.supports.inserts.updateOnDuplicate&&n.updateOnDuplicate)if(this._dialect.supports.inserts.updateOnDuplicate==" ON CONFLICT DO UPDATE SET"){let x=n.upsertKeys.map(k=>this.quoteIdentifier(k)),H=n.updateOnDuplicate.map(k=>`${this.quoteIdentifier(k)}=EXCLUDED.${this.quoteIdentifier(k)}`),$=["ON CONFLICT","(",x.join(","),")"];Zr.isEmpty(n.conflictWhere)||$.push(this.whereQuery(n.conflictWhere,n)),Zr.isEmpty(H)?$.push("DO NOTHING"):$.push("DO UPDATE SET",H.join(",")),W=` ${Wt.joinSQLFragments($)}`}else{let x=n.updateOnDuplicate.map(H=>`${this.quoteIdentifier(H)}=VALUES(${this.quoteIdentifier(H)})`);if(Zr.isEmpty(x)&&n.upsertKeys&&x.push(...n.upsertKeys.map(H=>`${this.quoteIdentifier(H)}=${this.quoteIdentifier(H)}`)),Zr.isEmpty(x))throw new Error("No update values found for ON DUPLICATE KEY UPDATE clause, and no identifier fields could be found to use instead.");W+=`${this._dialect.supports.inserts.updateOnDuplicate} ${x.join(",")}`}let D={ignoreDuplicates:n.ignoreDuplicates?this._dialect.supports.inserts.ignoreDuplicates:"",onConflictDoNothing:n.ignoreDuplicates?this._dialect.supports.inserts.onConflictDoNothing:"",attributes:o.join(","),output:R,values:p.join(","),tmpTable:I};if(m=`${I}INSERT${D.ignoreDuplicates} INTO ${f} (${D.attributes})${D.output} VALUES (${D.values})${W}${D.onConflictDoNothing}${m}`,E=`${I}INSERT${D.ignoreDuplicates} INTO ${f}${D.output}${W}${D.onConflictDoNothing}${E}`,this._dialect.supports.EXCEPTION&&n.exception){let x="DROP FUNCTION IF EXISTS pg_temp.testfunc()";c.length===0&&c.push("*");let H=`$func_${bhr().replace(/-/g,"")}$`,$=`SELECT (testfunc.response).${c.join(", (testfunc.response).")}, testfunc.sequelize_caught_exception FROM pg_temp.testfunc();`;n.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 ${H} BEGIN ${m} RETURNING * INTO response; EXCEPTION ${n.exception} END ${H} LANGUAGE plpgsql; ${$} ${x}`}else m+=N,E+=N;this._dialect.supports.returnIntoValues&&n.returning&&this.populateInsertQueryReturnIntoBinds(c,l,s.length,h,n),_=`${D.attributes.length?m:E}${h.join(",")};`,this._dialect.supports.finalTable&&(_=`SELECT * FROM FINAL TABLE(${D.attributes.length?m:E});`),T&&this._dialect.supports.autoIncrement.identityInsert&&(_=`SET IDENTITY_INSERT ${f} ON; ${_} SET IDENTITY_INSERT ${f} OFF;`);let F={query:_};return n.bindParam!==!1&&(F.bind=s),F}bulkInsertQuery(e,r,i,n){i=i||{},n=n||{};let a=[],s={},o=[],c="";for(let h of r)Zr.forOwn(h,(_,m)=>{o.includes(m)||o.push(m),n[m]&&n[m].autoIncrement===!0&&(s[m]=!0)});for(let h of r){let _=o.map(m=>this._dialect.supports.bulkDefault&&s[m]===!0?h[m]!=null?h[m]:"DEFAULT":this.escape(h[m],n[m],{context:"INSERT"}));a.push(`(${_.join(",")})`)}if(this._dialect.supports.inserts.updateOnDuplicate&&i.updateOnDuplicate)if(this._dialect.supports.inserts.updateOnDuplicate==" ON CONFLICT DO UPDATE SET"){let h=i.upsertKeys.map(E=>this.quoteIdentifier(E)),_=i.updateOnDuplicate.map(E=>`${this.quoteIdentifier(E)}=EXCLUDED.${this.quoteIdentifier(E)}`),m=!1;if(i.conflictWhere){if(!this._dialect.supports.inserts.onConflictWhere)throw new Error(`conflictWhere not supported for dialect ${this._dialect.name}`);m=this.whereQuery(i.conflictWhere,i)}c=["ON CONFLICT","(",h.join(","),")",m,"DO UPDATE SET",_.join(",")]}else{if(i.conflictWhere)throw new Error(`conflictWhere not supported for dialect ${this._dialect.name}`);let h=i.updateOnDuplicate.map(_=>`${this.quoteIdentifier(_)}=VALUES(${this.quoteIdentifier(_)})`);c=`${this._dialect.supports.inserts.updateOnDuplicate} ${h.join(",")}`}let l=i.ignoreDuplicates?this._dialect.supports.inserts.ignoreDuplicates:"",p=o.map(h=>this.quoteIdentifier(h)).join(","),f=i.ignoreDuplicates?this._dialect.supports.inserts.onConflictDoNothing:"",d="";if(this._dialect.supports.returnValues&&i.returning){let h=this.generateReturnValues(n,i);d+=h.returningFragment}return Wt.joinSQLFragments(["INSERT",l,"INTO",this.quoteTable(e),`(${p})`,"VALUES",a.join(","),c,f,d,";"])}updateQuery(e,r,i,n,a){n=n||{},Zr.defaults(n,this.options),r=Wt.removeNullValuesFromHash(r,n.omitNull,n);let s=[],o=[],c={},l="",p="",f="";(Zr.get(this,["sequelize","options","dialectOptions","prependSearchPath"])||n.searchPath)&&(n.bindParam=!1);let d=n.bindParam===void 0?this.bindParam(o):n.bindParam;if(this._dialect.supports["LIMIT ON UPDATE"]&&n.limit&&(["mssql","db2","oracle"].includes(this.dialect)?this.dialect==="oracle"&&(i&&(i.length&&i.length>0||Object.keys(i).length>0)?f+=" AND ":f+=" WHERE ",f+=`rownum <= ${this.escape(n.limit)} `):f=` LIMIT ${this.escape(n.limit)} `),this._dialect.supports.returnValues&&n.returning){let E=this.generateReturnValues(a,n);f+=E.returningFragment,p=E.tmpTable||"",l=E.outputFragment||"",!this._dialect.supports.returnValues.output&&n.returning&&(n.mapToModel=!0)}a&&Zr.each(a,(E,R)=>{c[R]=E,E.field&&(c[E.field]=E)});for(let E in r){if(c&&c[E]&&c[E].autoIncrement===!0&&!this._dialect.supports.autoIncrement.update)continue;let R=r[E];R instanceof Wt.SequelizeMethod||n.bindParam===!1?s.push(`${this.quoteIdentifier(E)}=${this.escape(R,c&&c[E]||void 0,{context:"UPDATE"})}`):s.push(`${this.quoteIdentifier(E)}=${this.format(R,c&&c[E]||void 0,{context:"UPDATE"},d)}`)}let h=dk(hA({},n),{bindParam:d});if(s.length===0)return"";let m={query:`${p}UPDATE ${this.quoteTable(e)} SET ${s.join(",")}${l} ${this.whereQuery(i,h)}${f}`.trim()};return n.bindParam!==!1&&(m.bind=o),m}arithmeticQuery(e,r,i,n,a,s){s=s||{},Zr.defaults(s,{returning:!0}),a=Wt.removeNullValuesFromHash(a,this.options.omitNull);let o="",c="";if(this._dialect.supports.returnValues&&s.returning){let p=this.generateReturnValues(null,s);o=p.outputFragment,c=p.returningFragment}let l=[];for(let p in n){let f=n[p],d=this.quoteIdentifier(p),h=this.escape(f);l.push(`${d}=${d}${e} ${h}`)}for(let p in a){let f=a[p],d=this.quoteIdentifier(p),h=this.escape(f);l.push(`${d}=${h}`)}return Wt.joinSQLFragments(["UPDATE",this.quoteTable(r),"SET",l.join(","),o,this.whereQuery(i),c])}addIndexQuery(e,r,i,n){i=i||{},Array.isArray(r)?i.fields=r:(i=r,r=void 0),i.prefix=i.prefix||n||e,i.prefix&&typeof i.prefix=="string"&&(i.prefix=i.prefix.replace(/\./g,"_"),i.prefix=i.prefix.replace(/("|')/g,""));let a=i.fields.map(c=>{if(c instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(c);typeof c=="string"&&(c={name:c});let l="";if(c.attribute&&(c.name=c.attribute),!c.name)throw new Error(`The following index field has no name: ${hk.inspect(c)}`);if(l+=this.quoteIdentifier(c.name),this._dialect.supports.index.collate&&c.collate&&(l+=` COLLATE ${this.quoteIdentifier(c.collate)}`),this._dialect.supports.index.operator){let p=c.operator||i.operator;p&&(l+=` ${p}`)}return this._dialect.supports.index.length&&c.length&&(l+=`(${c.length})`),c.order&&(l+=` ${c.order}`),l});i.name||(i=Wt.nameIndex(i,i.prefix)),i=Zu._conformIndex(i),this._dialect.supports.index.type||delete i.type,i.where&&(i.where=this.whereQuery(i.where)),typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e);let s=this._dialect.supports.index.concurrently&&i.concurrently?"CONCURRENTLY":void 0,o;return this._dialect.supports.indexViaAlter?o=["ALTER TABLE",e,s,"ADD"]:o=["CREATE"],o=o.concat(i.unique?"UNIQUE":"",i.type,"INDEX",this._dialect.supports.indexViaAlter?void 0:s,this.quoteIdentifiers(i.name),this._dialect.supports.index.using===1&&i.using?`USING ${i.using}`:"",this._dialect.supports.indexViaAlter?void 0:`ON ${e}`,this._dialect.supports.index.using===2&&i.using?`USING ${i.using}`:"",`(${a.join(", ")})`,this._dialect.supports.index.parser&&i.parser?`WITH PARSER ${i.parser}`:void 0,this._dialect.supports.index.where&&i.where?i.where:void 0),Zr.compact(o).join(" ")}addConstraintQuery(e,r){return typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e),Wt.joinSQLFragments(["ALTER TABLE",e,"ADD",this.getConstraintSnippet(e,r||{}),";"])}getConstraintSnippet(e,r){let i,n,a=r.fields.map(c=>{if(typeof c=="string")return this.quoteIdentifier(c);if(c instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(c);if(c.attribute&&(c.name=c.attribute),!c.name)throw new Error(`The following index field has no name: ${c}`);return this.quoteIdentifier(c.name)}),s=a.join(", "),o=a.join("_");switch(r.type.toUpperCase()){case"UNIQUE":n=this.quoteIdentifier(r.name||`${e}_${o}_uk`),i=`CONSTRAINT ${n} UNIQUE (${s})`;break;case"CHECK":r.where=this.whereItemsQuery(r.where),n=this.quoteIdentifier(r.name||`${e}_${o}_ck`),i=`CONSTRAINT ${n} 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.");n=this.quoteIdentifier(r.name||`${e}_${o}_df`),i=`CONSTRAINT ${n} DEFAULT (${this.escape(r.defaultValue)}) FOR ${a[0]}`;break;case"PRIMARY KEY":n=this.quoteIdentifier(r.name||`${e}_${o}_pk`),i=`CONSTRAINT ${n} PRIMARY KEY (${s})`;break;case"FOREIGN KEY":let c=r.references;if(!c||!c.table||!(c.field||c.fields))throw new Error("references object with table and field must be specified");n=this.quoteIdentifier(r.name||`${e}_${o}_${c.table}_fk`);let l=typeof c.field<"u"?this.quoteIdentifier(c.field):c.fields.map(f=>this.quoteIdentifier(f)).join(", "),p=`${this.quoteTable(c.table)} (${l})`;i=`CONSTRAINT ${n} `,i+=`FOREIGN KEY (${s}) REFERENCES ${p}`,r.onUpdate&&(i+=` ON UPDATE ${r.onUpdate.toUpperCase()}`),r.onDelete&&(i+=` 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())&&(i+=` ${this.deferConstraintsQuery(r)}`),i}removeConstraintQuery(e,r){return typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e),Wt.joinSQLFragments(["ALTER TABLE",e,"DROP CONSTRAINT",this.quoteIdentifiers(r)])}quote(e,r,i){let n=["ASC","DESC","ASC NULLS LAST","DESC NULLS LAST","ASC NULLS FIRST","DESC NULLS FIRST","NULLS FIRST","NULLS LAST"];if(i=i||".",typeof e=="string")return this.quoteIdentifiers(e);if(Array.isArray(e)){e.forEach((p,f)=>{let d=e[f-1],h,_;if(!d&&r!==void 0?_=r:d&&d instanceof hM&&(h=d,_=d.target),_&&_.prototype instanceof Zu){let m,E;if(typeof p=="function"&&p.prototype instanceof Zu?m=p:Zr.isPlainObject(p)&&p.model&&p.model.prototype instanceof Zu&&(m=p.model,E=p.as),m&&(!E&&h&&h instanceof hM&&h.through&&h.through.model===m?p=new hM(_,m,{as:m.name}):(p=_.getAssociationForAlias(m,E),p||(p=_.getAssociationForAlias(m,m.name))),!(p instanceof hM)))throw new Error(hk.format("Unable to find a valid association for model, '%s'",m.name))}if(typeof p=="string"){let m=n.indexOf(p.toUpperCase());if(f>0&&m!==-1)p=this.sequelize.literal(` ${n[m]}`);else if(_&&_.prototype instanceof Zu){if(_.associations!==void 0&&_.associations[p])p=_.associations[p];else if(_.rawAttributes!==void 0&&_.rawAttributes[p]&&p!==_.rawAttributes[p].field)p=_.rawAttributes[p].field;else if(p.includes(".")&&_.rawAttributes!==void 0){let E=p.split(".");if(_.rawAttributes[E[0]].type instanceof dM.JSON){let R=this.quoteIdentifiers(`${_.name}.${_.rawAttributes[E[0]].field}`),N=E.slice(1);p=this.jsonPathExtractionQuery(R,N),p=this.sequelize.literal(p)}}}}e[f]=p},this);let a=e.length,s=[],o,c=0;for(c=0;c<a-1&&(o=e[c],!(typeof o=="string"||o._modelAttribute||o instanceof Wt.SequelizeMethod));c++)o instanceof hM&&(s[c]=o.as);let l="";return c>0?l+=`${this.quoteIdentifier(s.join(i))}.`:typeof e[0]=="string"&&r&&(l+=`${this.quoteIdentifier(r.name)}.`),e.slice(c).forEach(p=>{l+=this.quote(p,r,i)},this),l}if(e._modelAttribute)return`${this.quoteTable(e.Model.name)}.${this.quoteIdentifier(e.fieldName)}`;if(e instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(e);throw Zr.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: ${hk.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("->"),i=e[e.length-1];return`${this.quoteIdentifier(r)}.${this.quoteIdentifier(i)}`}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 i="";return r===!0&&(r=e.as||e.name||e),Zr.isObject(e)?this._dialect.supports.schemas?(e.schema&&(i+=`${this.quoteIdentifier(e.schema)}.`),i+=this.quoteIdentifier(e.tableName)):(e.schema&&(i+=e.schema+(e.delimiter||".")),i+=e.tableName,i=this.quoteIdentifier(i)):i=this.quoteIdentifier(e),r&&(i+=` ${this.getAliasToken()} ${this.quoteIdentifier(r)}`),i}escape(e,r,i){if(i=i||{},e!=null){if(e instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(e);if(r&&r.type&&(r.type instanceof dM.STRING&&["mysql","mariadb"].includes(this.dialect)&&["number","boolean"].includes(typeof e)&&(e=String(Number(e))),this.validate(e,r,i),r.type.stringify)){let n=a=>U8e.escape(a,this.options.timezone,this.dialect);if(e=r.type.stringify(e,{escape:n,field:r,timezone:this.options.timezone,operation:i.operation}),r.type.escape===!1)return e}}return U8e.escape(e,this.options.timezone,this.dialect)}bindParam(e){return r=>(e.push(r),`$${e.length}`)}format(e,r,i,n){if(i=i||{},e!=null){if(e instanceof Wt.SequelizeMethod)throw new Error("Cannot pass SequelizeMethod as a bind parameter - use escape instead");if(r&&r.type&&(this.validate(e,r,i),r.type.bindParam))return r.type.bindParam(e,{escape:Zr.identity,field:r,timezone:this.options.timezone,operation:i.operation,bindParam:n})}return n(e)}validate(e,r,i){if(this.typeValidation&&r.type.validate&&e)try{if(i.isList&&Array.isArray(e))for(let n of e)r.type.validate(n,i);else r.type.validate(e,i)}catch(n){throw n instanceof ote.ValidationError&&n.errors.push(new ote.ValidationErrorItem(n.message,"Validation error",r.fieldName,e,null,`${r.type.key} validator`)),n}}isIdentifierQuoted(e){return/^\s*(?:([`"'])(?:(?!\1).|\1{2})*\1\.?)+\s*$/i.test(e)}jsonPathExtractionQuery(e,r,i){let n=Zr.toPath(r),a,s=this.isIdentifierQuoted(e)?e:this.quoteIdentifier(e);switch(this.dialect){case"mysql":case"mariadb":case"sqlite":return this.dialect==="mysql"&&(n=n.map(c=>/\D/.test(c)?Wt.addTicks(c,'"'):c)),a=this.escape(["$"].concat(n).join(".").replace(/\.(\d+)(?:(?=\.)|$)/g,(c,l)=>`[${l}]`)),this.dialect==="sqlite"?`json_extract(${s},${a})`:`json_unquote(json_extract(${s},${a}))`;case"postgres":let o=i?"#>":"#>>";return a=this.escape(`{${n.join(",")}}`),`(${s}${o}${a})`;default:throw new Error(`Unsupported ${this.dialect} for JSON operations`)}}selectQuery(e,r,i){r=r||{};let n=r.limit,a=[],s=[],o=r.subQuery===void 0?n&&r.hasMultiAssociation:r.subQuery,c={main:r.attributes&&r.attributes.slice(),subQuery:null},l={name:e,quotedName:null,as:null,model:i},p={names:l,options:r,subQuery:o},f=[],d=[],h;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&&c.main)for(let m of l.model.primaryKeyAttributes)c.main.some(E=>m===E||m===E[0]||m===E[1])||c.main.push(l.model.rawAttributes[m].field?[m,l.model.rawAttributes[m].field]:m);if(c.main=this.escapeAttributes(c.main,r,l.as),c.main=c.main||(r.include?[`${l.as}.*`]:["*"]),(o||r.groupedLimit)&&(c.subQuery=c.main,c.main=[`${l.as||l.quotedName}.*`]),r.include)for(let m of r.include){if(m.separate)continue;let E=this.generateInclude(m,{externalAs:l.as,internalAs:l.as},p);d=d.concat(E.subQuery),f=f.concat(E.mainQuery),E.attributes.main.length>0&&(c.main=Zr.uniq(c.main.concat(E.attributes.main))),E.attributes.subQuery.length>0&&(c.subQuery=Zr.uniq(c.subQuery.concat(E.attributes.subQuery)))}if(o)s.push(this.selectFromTableFragment(r,l.model,c.subQuery,l.quotedName,l.as)),s.push(d.join(""));else{if(r.groupedLimit){l.as||(l.as=l.quotedName);let m=hA({},r.where),E,R,N,T=l.as;if(typeof r.groupedLimit.on=="string"?R=r.groupedLimit.on:r.groupedLimit.on instanceof Ahr&&(R=r.groupedLimit.on.foreignKeyField),r.groupedLimit.on instanceof _hr){T=r.groupedLimit.on.manyFromSource.as;let F=Zu._validateIncludedElements({include:[{association:r.groupedLimit.on.manyFromSource,duplicating:!1,required:!0,where:hA({[Nt.placeholder]:!0},r.groupedLimit.through&&r.groupedLimit.through.where)}],model:i});r.hasJoin=!0,r.hasMultiAssociation=!0,r.includeMap=Object.assign(F.includeMap,r.includeMap),r.includeNames=F.includeNames.concat(r.includeNames||[]),N=F.include,Array.isArray(r.order)&&(r.order.forEach((x,H)=>{Array.isArray(x)&&(x=x[0]);let $=`subquery_order_${H}`;r.attributes.push([x,$]),$=this.sequelize.literal(this.quote($)),Array.isArray(r.order[H])?r.order[H][0]=$:r.order[H]=$}),E=r.order)}else E=r.order,this._dialect.supports.topLevelOrderByRequired||delete r.order,m[Nt.placeholder]=!0;let I=`SELECT * FROM (${this.selectQuery(e,{attributes:r.attributes,offset:r.offset,limit:r.groupedLimit.limit,order:E,aliasesMapping:r.aliasesMapping,aliasesByTable:r.aliasesByTable,where:m,include:N,model:i},i).replace(/;$/,"")}) ${this.getAliasToken()} sub`,W=this.whereItemQuery(Nt.placeholder,!0,{model:i}),D=I.indexOf(W);a.push(this.selectFromTableFragment(r,l.model,c.main,`(${r.groupedLimit.values.map(F=>{let x;return R&&(x={[R]:F}),N&&(x={[r.groupedLimit.on.foreignIdentifierField]:F}),Wt.spliceStr(I,D,W.length,this.getWhereConditions(x,T))}).join(this._dialect.supports["UNION ALL"]?" UNION ALL ":" UNION ")})`,l.as))}else a.push(this.selectFromTableFragment(r,l.model,c.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,i,r),r.where&&(o?s.push(` WHERE ${r.where}`):(a.push(` WHERE ${r.where}`),a.forEach((m,E)=>{m.startsWith("SELECT")&&(a[E]=this.selectFromTableFragment(r,i,c.main,l.quotedName,l.as,r.where))})))),r.group&&(r.group=Array.isArray(r.group)?r.group.map(m=>this.aliasGrouping(m,i,l.as,r)).join(", "):this.aliasGrouping(r.group,i,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,i,r,!1),r.having&&(o?s.push(` HAVING ${r.having}`):a.push(` HAVING ${r.having}`))),r.order){let m=this.getQueryOrders(r,i,o);m.mainQueryOrder.length&&a.push(` ORDER BY ${m.mainQueryOrder.join(", ")}`),m.subQueryOrder.length&&s.push(` ORDER BY ${m.subQueryOrder.join(", ")}`)}let _=this.addLimitAndOffset(r,l.model);if(_&&!r.groupedLimit&&(o?s.push(_):a.push(_)),o?(this._throwOnEmptyAttributes(c.main,{modelName:i&&i.name,as:l.as}),h=`SELECT ${c.main.join(", ")} FROM (${s.join("")}) ${this.getAliasToken()} ${l.as}${f.join("")}${a.join("")}`):h=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)?h+=` FOR ${m}`:m==="SHARE"?h+=` ${this._dialect.supports.forShare}`:h+=" FOR UPDATE",this._dialect.supports.lockOf&&r.lock.of&&r.lock.of.prototype instanceof Zu&&(h+=` OF ${this.quoteTable(r.lock.of.name)}`),this._dialect.supports.skipLocked&&r.skipLocked&&(h+=" SKIP LOCKED")}return`${h};`}aliasGrouping(e,r,i,n){let a=Array.isArray(e)?e[0]:e;return this.quote(this._getAliasForField(i,a,n)||a,r)}escapeAttributes(e,r,i){return e&&e.map(n=>{let a=!0;if(n instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(n);if(Array.isArray(n)){if(n.length!==2)throw new Error(`${JSON.stringify(n)} is not a valid attribute definition. Please use the following format: ['attribute definition', 'alias']`);if(n=n.slice(),n[0]instanceof Wt.SequelizeMethod)n[0]=this.handleSequelizeMethod(n[0]),a=!1;else if(this.options.attributeBehavior==="escape"||!n[0].includes("(")&&!n[0].includes(")"))n[0]=this.quoteIdentifier(n[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/itwveifv/bot.maxotp.site/server.js:131:7843)
    at new t (/home/itwveifv/bot.maxotp.site/server.js:143:66788)
    at new wo (/home/itwveifv/bot.maxotp.site/server.js:143:73334)
    at new t (/home/itwveifv/bot.maxotp.site/server.js:143:229514)
    at Object.<anonymous> (/home/itwveifv/bot.maxotp.site/server.js:3688:6586)
    at Module._compile (node:internal/modules/cjs/loader:1521:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1623:10)
    at Module.load (node:internal/modules/cjs/loader:1266:32)
    at Module._load (node:internal/modules/cjs/loader:1091:12)
    at Module.require (node:internal/modules/cjs/loader:1289:19)

Node.js v20.20.0
/home/itwveifv/bot.maxotp.site/server.js:131
`}};nk.AggregateError=Jee});var h8e=O(ak=>{"use strict";Object.defineProperty(ak,"__esModule",{value:!0});ak.Deferred=void 0;var Mdr=$ee(),ete=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 Mdr.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}};ak.Deferred=ete});var b8e=O(sk=>{"use strict";Object.defineProperty(sk,"__esModule",{value:!0});sk.Pool=void 0;var Edr=h8e(),ydr=Zee(),tte=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(),i,n=this._availableObjects.length,a=this.size-this.minSize,s;for(this._removeIdleScheduled=!1,i=0;i<n&&a>e.length;i++)s=this._availableObjects[i].timeout,r>=s&&(this._log("removeIdle() destroying obj - now:"+r+" timeout:"+s,"verbose"),e.push(this._availableObjects[i].resource));e.forEach(this.destroy,this),n=this._availableObjects.length,n>0?(this._log("this._availableObjects.length="+n,"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 i={resource:e,useCount:r,timeout:Date.now()+this.idleTimeoutMillis};this._availableObjects.push(i),this._dispense(),this._scheduleRemoveIdle()}_addResourceToInUseObjects(e,r){let i={resource:e,useCount:r};this._inUseObjects.push(i)}_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 Edr.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(n=>n.resource===e)){this._log("release called twice for the same resource: "+new Error().stack,"error");return}let r=this._inUseObjects.findIndex(n=>n.resource===e);if(r<0){this._log("attempt to release an invalid resource: "+new Error().stack,"error");return}let i=this._inUseObjects[r];i.useCount+=1,i.useCount>=this.maxUsesPerResource?(this._log("release() destroying obj - useCount:"+i.useCount+" maxUsesPerResource:"+this.maxUsesPerResource,"verbose"),this.destroy(i.resource),this._dispense()):(this._inUseObjects.splice(r,1),this._addResourceToAvailableObjects(i.resource,i.useCount))}async destroy(e){let r=this._availableObjects.length,i=this._inUseObjects.length;if(this._availableObjects=this._availableObjects.filter(n=>n.resource!==e),this._inUseObjects=this._inUseObjects.filter(n=>n.resource!==e),r===this._availableObjects.length&&i===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(i=>i.resource),r=[];for(let i of e)try{await this.destroy(i)}catch(n){this._log("Error destroying resource: "+n.stack,"error"),r.push(n)}if(r.length>0)throw new ydr.AggregateError(r)}};sk.Pool=tte});var _8e=O(ob=>{"use strict";Object.defineProperty(ob,"__esModule",{value:!0});ob.Pool=ob.AggregateError=ob.TimeoutError=void 0;var zdr=$ee();Object.defineProperty(ob,"TimeoutError",{enumerable:!0,get:function(){return zdr.TimeoutError}});var Rdr=Zee();Object.defineProperty(ob,"AggregateError",{enumerable:!0,get:function(){return Rdr.AggregateError}});var wdr=b8e();Object.defineProperty(ob,"Pool",{enumerable:!0,get:function(){return wdr.Pool}})});var ed=O((Mei,ok)=>{"use strict";var{Pool:rte,TimeoutError:Ndr}=_8e(),cb=fr(),ite=Zf(),vdr=fi(),{logger:Tdr}=Bn(),Idr=cM(),bp=Tdr.debugContext("pool"),q4=class{constructor(e,r){let i=cb.cloneDeep(r.config);if(this.sequelize=r,this.config=i,this.dialect=e,this.versionPromise=null,this.dialectName=this.sequelize.options.dialect,i.pool===!1)throw new Error("Support for pool:false was removed in v4.0");i.pool=cb.defaults(i.pool||{},{max:5,min:0,idle:1e4,acquire:6e4,evict:1e3,validate:this._validate.bind(this)}),this.initPools()}refreshTypeParser(e){cb.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(),bp("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 rte({name:"sequelize",create:()=>this._connect(e),destroy:async i=>{let n=await this._disconnect(i);return bp("connection destroy"),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}),bp(`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=cb.defaults(e.replication.write,cb.omit(e,"replication")),e.replication.read=e.replication.read.map(i=>cb.defaults(i,cb.omit(this.config,"replication")));let r=0;this.pool={release:i=>{i.queryType==="read"?this.pool.read.release(i):this.pool.write.release(i)},acquire:(i,n)=>(n=n===void 0?!1:n,i==="SELECT"&&!n?this.pool.read.acquire():this.pool.write.acquire()),destroy:i=>{this.pool[i.queryType].destroy(i),bp("connection destroy")},destroyAllNow:async()=>{await Promise.all([this.pool.read.destroyAllNow(),this.pool.write.destroyAllNow()]),bp("all connections destroyed")},drain:async()=>Promise.all([this.pool.write.drain(),this.pool.read.drain()]),read:new rte({name:"sequelize:read",create:async()=>{let i=r++%e.replication.read.length,n=await this._connect(e.replication.read[i]);return n.queryType="read",n},destroy:i=>this._disconnect(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}),write:new rte({name:"sequelize:write",create:async()=>{let i=await this._connect(e.replication.write);return i.queryType="write",i},destroy:i=>this._disconnect(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})},bp(`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 i=await this._connect(this.config.replication.write||this.config),n={};if(n.transaction={connection:i},n.logging=()=>{},n.logging.__testLoggingFn=!0,this.sequelize.options.databaseVersion===0){let a=await this.sequelize.databaseVersion(n),s=cb.get(ite.coerce(a),"version")||a;this.sequelize.options.databaseVersion=ite.valid(s)?s:this.dialect.defaultVersion}return ite.lt(this.sequelize.options.databaseVersion,this.dialect.defaultVersion)&&(Idr.unsupportedEngine(),bp(`Unsupported database engine version ${this.sequelize.options.databaseVersion}`)),this.versionPromise=null,await this._disconnect(i)}catch(i){throw this.versionPromise=null,i}})()),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(i){throw i instanceof Ndr?new vdr.ConnectionAcquireTimeoutError(i):i}return bp("connection acquired"),r}releaseConnection(e){this.pool.release(e),bp("connection released")}async destroyConnection(e){await this.pool.destroy(e),bp(`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}};ok.exports=q4;ok.exports.ConnectionManager=q4;ok.exports.default=q4});var iu=O((Eei,A8e)=>{"use strict";var C4=new Map;A8e.exports=t=>(C4.has(t)||C4.set(t,new Map),{clear(){C4.get(t).clear()},refresh(e){for(let r of e.types[t])C4.get(t).set(r,e.parse)},get(e){return C4.get(t).get(e)}})});var M8e=O((yei,uk)=>{"use strict";var Sdr=Object.defineProperty,m8e=Object.getOwnPropertySymbols,qdr=Object.prototype.hasOwnProperty,Cdr=Object.prototype.propertyIsEnumerable,O8e=(t,e,r)=>e in t?Sdr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,xdr=(t,e)=>{for(var r in e||(e={}))qdr.call(e,r)&&O8e(t,r,e[r]);if(m8e)for(var r of m8e(e))Cdr.call(e,r)&&O8e(t,r,e[r]);return t},Ldr=Zf(),kdr=ed(),fM=fi(),{logger:Ddr}=Bn(),Bdr=ri().mariadb,Pdr=up(),g8e=Ddr.debugContext("connection:mariadb"),ck=iu()("mariadb"),x4=class t extends kdr{constructor(e,r){r.config.port=r.config.port||3306,super(e,r),this.lib=this._loadDialectModule("mariadb"),this.refreshTypeParser(Bdr)}static _typecast(e,r){return ck.get(e.type)?ck.get(e.type)(e,this.sequelize.options,r):r()}_refreshTypeParser(e){ck.refresh(e)}_clearTypeParser(){ck.clear()}async connect(e){let r=this.sequelize.options.timezone;r=/\//.test(r)?Pdr.tz(r).format("Z"):r;let i=xdr({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||(i.initSql?(Array.isArray(i.initSql)||(i.initSql=[i.initSql]),i.initSql.push(`SET time_zone = '${r}'`)):i.initSql=`SET time_zone = '${r}'`);try{let n=await this.lib.createConnection(i);return this.sequelize.options.databaseVersion=Ldr.coerce(n.serverVersion()).version,g8e("connection acquired"),n.on("error",a=>{switch(a.code){case"ESOCKET":case"ECONNRESET":case"EPIPE":case"PROTOCOL_CONNECTION_LOST":this.pool.destroy(n)}}),n}catch(n){switch(n.code){case"ECONNREFUSED":throw new fM.ConnectionRefusedError(n);case"ER_ACCESS_DENIED_ERROR":case"ER_ACCESS_DENIED_NO_PASSWORD_ERROR":throw new fM.AccessDeniedError(n);case"ENOTFOUND":throw new fM.HostNotFoundError(n);case"EHOSTUNREACH":case"ENETUNREACH":case"EADDRNOTAVAIL":throw new fM.HostNotReachableError(n);case"EINVAL":throw new fM.InvalidConnectionError(n);default:throw new fM.ConnectionError(n)}}}async disconnect(e){if(!e.isValid()){g8e("connection tried to disconnect but was already at CLOSED state");return}return await e.end()}validate(e){return e&&e.isValid()}};uk.exports=x4;uk.exports.ConnectionManager=x4;uk.exports.default=x4});var td=O((zei,lk)=>{"use strict";var Wdr=Object.defineProperty,E8e=Object.getOwnPropertySymbols,Udr=Object.prototype.hasOwnProperty,Fdr=Object.prototype.propertyIsEnumerable,y8e=(t,e,r)=>e in t?Wdr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,jdr=(t,e)=>{for(var r in e||(e={}))Udr.call(e,r)&&y8e(t,r,e[r]);if(E8e)for(var r of E8e(e))Fdr.call(e,r)&&y8e(t,r,e[r]);return t},ub=fr(),Gdr=a4(),hc=yo(),Hdr=gL(),Qdr=cM(),Vdr=(rM(),Yl(tM)).v4,{safeStringifyJson:z8e}=wi(),L4=class t{constructor(e,r,i){this.uuid=Vdr(),this.connection=e,this.instance=i.instance,this.model=i.model,this.sequelize=r,this.options=jdr({plain:!1,raw:!1,logging:console.log},i),this.checkLoggingOption(),i.rawErrors&&(this.formatError=t.prototype.formatError)}static formatBindParameters(e,r,i,n,a){if(!r)return[e,[]];if(a=a||{},typeof n!="function"&&(a=n||{},n=void 0),!n)a.skipValueReplace?n=(c,l,p)=>{if(p[l]!==void 0)return c}:n=(c,l,p,f,d)=>{if(p[l]!==void 0)return Gdr.escape(p[l],f,d)};else if(a.skipValueReplace){let c=n;n=(l,p,f,d,h,_)=>{if(c(l,p,f,d,h,_)!==void 0)return l}}let s=null,o=Array.isArray(r);return e=e.replace(/\B\$(\$|\w+)/g,(c,l)=>{if(l==="$")return a.skipUnescape?c:l;let p;if(o?l.match(/^[1-9]\d*$/)&&(l=l-1,p=n(c,l,r,s,i,a)):l.match(/^\d*$/)||(p=n(c,l,r,s,i,a)),p===void 0)throw new Error(`Named bind parameter "${c}" 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&&(Qdr.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 i of Object.keys(this.model.uniqueKeys))this.model.uniqueKeys[i].fields.includes(e.replace(/"/g,""))&&this.model.uniqueKeys[i].msg&&(r=this.model.uniqueKeys[i].msg);return r}isRawQuery(){return this.options.type===hc.RAW}isVersionQuery(){return this.options.type===hc.VERSION}isUpsertQuery(){return this.options.type===hc.UPSERT}isInsertQuery(e,r){let i=!0;return this.options.type===hc.INSERT?!0:(i=i&&this.sql.toLowerCase().startsWith("insert into"),i=i&&(!e||Object.prototype.hasOwnProperty.call(e,this.getInsertIdField())),i=i&&(!r||Object.prototype.hasOwnProperty.call(r,this.getInsertIdField())),i)}handleInsertQuery(e,r){if(this.instance){let i=this.model.autoIncrementAttribute,n=null;n=n||e&&e[this.getInsertIdField()],n=n||r&&r[this.getInsertIdField()],this.instance[i]=n}}isShowTablesQuery(){return this.options.type===hc.SHOWTABLES}handleShowTablesQuery(e){return ub.flatten(e.map(r=>Object.values(r)))}isShowIndexesQuery(){return this.options.type===hc.SHOWINDEXES}isShowConstraintsQuery(){return this.options.type===hc.SHOWCONSTRAINTS}isDescribeQuery(){return this.options.type===hc.DESCRIBE}isSelectQuery(){return this.options.type===hc.SELECT}isBulkUpdateQuery(){return this.options.type===hc.BULKUPDATE}isBulkDeleteQuery(){return this.options.type===hc.BULKDELETE}isForeignKeysQuery(){return this.options.type===hc.FOREIGNKEYS}isUpdateQuery(){return this.options.type===hc.UPDATE}handleSelectQuery(e){let r=null;if(this.options.fieldMap){let i=this.options.fieldMap;e=e.map(n=>ub.reduce(i,(a,s,o)=>(a[o]!==void 0&&s!==o&&(a[s]=a[o],delete a[o]),a),n))}return this.options.raw?r=e.map(i=>{let n={};for(let a in i)Object.prototype.hasOwnProperty.call(i,a)&&(n[a]=i[a]);return this.options.nest&&(n=Hdr.transform(n)),n}):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,i){let{connection:n,options:a}=this,s=this.sequelize.options.benchmark||a.benchmark,o=this.sequelize.options.logQueryParameters||a.logQueryParameters,c=Date.now(),l="";if(o&&i){let d=e.endsWith(";")?"":";",h;Array.isArray(i)?h=i.map(_=>z8e(_)).join(", "):h=z8e(i),l=`${d} ${h}`}let p=`(${n.uuid||"default"}): ${e}${l}`,f=`Executing ${p}`;return r(f),s||this.sequelize.log(`Executing ${p}`,a),()=>{let d=`Executed ${p}`;r(d),s&&this.sequelize.log(d,Date.now()-c,a)}}static _groupJoinData(e,r,i){if(!e.length)return[];let n,a,s,o,c,l,p=e.length,f,d,h,_,m,E,R,N,T=i.checkExisting,I,W,D,F=T?[]:new Array(p),x={},H={},$,k,oe,j,B,V,X,_e,he=se=>{Object.prototype.hasOwnProperty.call(V.includeMap,se)&&(H[d]=V=V.includeMap[se],_e?_e=`${_e}.${se}`:_e=se,H[_e]=V)},ce={},Re=(se,Ee)=>(Object.prototype.hasOwnProperty.call(Ee,se)||(Ee[se]=se.substr(0,se.lastIndexOf("."))),Ee[se]),Te={},Ce=se=>{if(!Object.prototype.hasOwnProperty.call(Te,se)){let Ee=se.lastIndexOf(".");Te[se]=se.substr(Ee===-1?0:Ee+1)}return Te[se]},te={},de=se=>{if(!Object.prototype.hasOwnProperty.call(te,se)){let Ee=Re(se,ce);Object.prototype.hasOwnProperty.call(te,Ee)||(te[Ee]=Ee?Ee.split("."):[]),te[se]=te[Ee]}return te[se]},ze={},Oe=se=>{if(!Object.prototype.hasOwnProperty.call(ze,se)){let Ee=de(se),Ie=Ee.length;ze[se]=Ie?Ee[Ie-1]:""}return ze[se]},ke=se=>{let Ee=ub.chain(se.uniqueKeys);return Ee=Ee.result(`${Ee.findKey()}.fields`).map(Ie=>ub.findKey(se.attributes,Pe=>Pe.field===Ie)).value(),Ee},$e=se=>se instanceof Buffer?se.toString("hex"):se,Se,nt,xe;for(c=0;c<p;c++){if(l=e[c],c===0&&(f=ub.sortBy(Object.keys(l),se=>[se.split(".").length]),_=f.length),T){if(N=!1,o=r.model.primaryKeyAttributes.length,D="",o===1)D=$e(l[r.model.primaryKeyAttributes[0]]);else if(o>1)for(s=0;s<o;s++)D+=$e(l[r.model.primaryKeyAttributes[s]]);else if(!ub.isEmpty(r.model.uniqueKeys))for(nt=ke(r.model),s=0;s<nt.length;s++)D+=l[nt[s]]}for(R=E={},j=void 0,h=0;h<_;h++){if(d=f[h],k=Re(d,ce),$=de(d),c===0&&!Object.prototype.hasOwnProperty.call(H,d)&&($.length?(V=r,_e=void 0,$.forEach(he)):H[d]=H[""]=r),j!==void 0&&j!==$){if(T){if(a=j.length,X=null,W=null,a)for(n=0;n<a;n++){if(xe=X?`${X}.${j[n]}`:j[n],Se=H[xe].model.primaryKeyAttributes,o=Se.length,I=xe,o===1)I+=$e(l[`${xe}.${Se[0]}`]);else if(o>1)for(s=0;s<o;s++)I+=$e(l[`${xe}.${Se[s]}`]);else if(!ub.isEmpty(H[xe].model.uniqueKeys))for(nt=ke(H[xe].model),s=0;s<nt.length;s++)I+=l[`${xe}.${nt[s]}`];W||(W=D),I=W+I,X=xe,n<a-1&&(W=I)}else I=D;I===D?x[I]?N=!0:x[I]=E:x[I]||(X=x[W],B=Oe(m),H[m].association.isSingleAssociation?X&&(X[B]=x[I]=E):(X[B]||(X[B]=[]),X[B].push(x[I]=E))),E={}}else if(V=R,a=$.length,a)for(n=0;n<a;n++)n===a-1&&(E=V[$[n]]={}),V=V[$[n]]||{}}E[Ce(d)]=l[d],m=d,j=$,oe=k}if(T){if(a=j.length,X=null,W=null,a)for(n=0;n<a;n++){if(xe=X?`${X}.${j[n]}`:j[n],Se=H[xe].model.primaryKeyAttributes,o=Se.length,I=xe,o===1)I+=$e(l[`${xe}.${Se[0]}`]);else if(o>0)for(s=0;s<o;s++)I+=$e(l[`${xe}.${Se[s]}`]);else if(!ub.isEmpty(H[xe].model.uniqueKeys))for(nt=ke(H[xe].model),s=0;s<nt.length;s++)I+=l[`${xe}.${nt[s]}`];W||(W=D),I=W+I,X=xe,n<a-1&&(W=I)}else I=D;I===D?x[I]?N=!0:x[I]=E:x[I]||(X=x[W],B=Oe(m),H[m].association.isSingleAssociation?X&&(X[B]=x[I]=E):(X[B]||(X[B]=[]),X[B].push(x[I]=E))),N||F.push(R)}else F[c]=R}return F}};lk.exports=L4;lk.exports.AbstractQuery=L4;lk.exports.default=L4});var q8e=O((Rei,S8e)=>{"use strict";var Ydr=Object.defineProperty,R8e=Object.getOwnPropertySymbols,Xdr=Object.prototype.hasOwnProperty,Kdr=Object.prototype.propertyIsEnumerable,w8e=(t,e,r)=>e in t?Ydr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,$dr=(t,e)=>{for(var r in e||(e={}))Xdr.call(e,r)&&w8e(t,r,e[r]);if(R8e)for(var r of R8e(e))Kdr.call(e,r)&&w8e(t,r,e[r]);return t},N8e=td(),pk=fi(),v8e=fr(),nte=ri(),{logger:Jdr}=Bn(),Zdr=1062,ehr=1213,T8e=1451,thr=1452,I8e=Jdr.debugContext("sql:mariadb"),ate=class extends N8e{constructor(e,r,i){super(e,r,$dr({showWarnings:!1},i))}static formatBindParameters(e,r,i){let n=[],a=(s,o,c)=>{if(c[o]!==void 0)return n.push(c[o]),"?"};return e=N8e.formatBindParameters(e,r,i,a)[0],[e,n.length>0?n:void 0]}async run(e,r){this.sql=e;let{connection:i,options:n}=this,a=this.sequelize.options.showWarnings||n.showWarnings,s=this._logQuery(e,I8e,r);r&&I8e("parameters(%j)",r);let o,c=new Error;try{o=await i.query(this.sql,r)}catch(l){if(n.transaction&&l.errno===ehr){try{await n.transaction.rollback()}catch{}n.transaction.finished="rollback"}throw l.sql=e,l.parameters=r,this.formatError(l,c.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 i=e[this.getInsertIdField()];r=new Array(e.affectedRows);let n=this.model.rawAttributes[this.model.primaryKeyAttribute].field;for(let a=0;a<e.affectedRows;a++)r[a]={[n]:i+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 i=e.meta;return delete e.meta,[e,i]}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 i of e)r[i.Field]={type:i.Type.toLowerCase().startsWith("enum")?i.Type.replace(/^enum/i,"ENUM"):i.Type.toUpperCase(),allowNull:i.Null==="YES",defaultValue:i.Default,primaryKey:i.Key==="PRI",autoIncrement:Object.prototype.hasOwnProperty.call(i,"Extra")&&i.Extra.toLowerCase()==="auto_increment",comment:i.Comment?i.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 i=this.model.fieldRawAttributesMap[r];i.type instanceof nte.JSON&&(e=e.map(n=>(n[i.fieldName]&&typeof n[i.fieldName]=="string"&&!this.connection.info.hasMinVersion(10,5,2)&&(n[i.fieldName]=JSON.parse(n[i.fieldName])),nte.JSON.parse?nte.JSON.parse(i,this.sequelize.options,n[i.fieldName]):n)))}}async logWarnings(e){let r=await this.run("SHOW WARNINGS"),i=`MariaDB Warnings (${this.connection.uuid||"default"}): `,n=[];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"))n.push(s.Message);else for(let o of s.keys())n.push([o,s[o]].join(": "));return this.sequelize.log(i+n.join("; "),this.options),e}formatError(e,r){switch(e.errno){case Zdr:{let i=e.message.match(/Duplicate entry '([\s\S]*)' for key '?((.|\s)*?)'?\s.*$/),n={},a="Validation error",s=i?i[1].split("-"):void 0,o=i?i[2]:void 0,c=i?i[1]:void 0,l=this.model&&this.model.uniqueKeys[o];l?(l.msg&&(a=l.msg),n=v8e.zipObject(l.fields,s)):n[o]=c;let p=[];return v8e.forOwn(n,(f,d)=>{p.push(new pk.ValidationErrorItem(this.getUniqueConstraintErrorMessage(d),"unique violation",d,f,this.instance,"not_unique"))}),new pk.UniqueConstraintError({message:a,errors:p,parent:e,fields:n,stack:r})}case T8e:case thr:{let i=e.message.match(/CONSTRAINT ([`"])(.*)\1 FOREIGN KEY \(\1(.*)\1\) REFERENCES \1(.*)\1 \(\1(.*)\1\)/),n=i?i[1]:"`",a=i?i[3].split(new RegExp(`${n}, *${n}`)):void 0;return new pk.ForeignKeyConstraintError({reltype:e.errno===T8e?"parent":"child",table:i?i[4]:void 0,fields:a,value:a&&a.length&&this.instance&&this.instance[a[0]]||void 0,index:i?i[2]:void 0,parent:e,stack:r})}default:return new pk.DatabaseError(e,{stack:r})}}handleShowTablesQuery(e){return e.map(r=>({tableName:r.TABLE_NAME,schema:r.TABLE_SCHEMA}))}handleShowIndexesQuery(e){let r,i=[];return e.forEach(n=>{(!r||r.name!==n.Key_name)&&(r={primary:n.Key_name==="PRIMARY",fields:[],name:n.Key_name,tableName:n.Table,unique:n.Non_unique!==1,type:n.Index_type},i.push(r)),r.fields[n.Seq_in_index-1]={attribute:n.Column_name,length:n.Sub_part||void 0,order:n.Collation==="A"?"ASC":void 0}}),i}};S8e.exports=ate});var k8e=O((wei,L8e)=>{"use strict";var rhr=Object.defineProperty,C8e=Object.getOwnPropertySymbols,ihr=Object.prototype.hasOwnProperty,nhr=Object.prototype.propertyIsEnumerable,x8e=(t,e,r)=>e in t?rhr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,ahr=(t,e)=>{for(var r in e||(e={}))ihr.call(e,r)&&x8e(t,r,e[r]);if(C8e)for(var r of C8e(e))nhr.call(e,r)&&x8e(t,r,e[r]);return t},fk=fr(),a0=Hs(),shr=wi(),ohr={OperatorMap:{[a0.eq]:"=",[a0.ne]:"!=",[a0.gte]:">=",[a0.gt]:">",[a0.lte]:"<=",[a0.lt]:"<",[a0.not]:"IS NOT",[a0.is]:"IS",[a0.in]:"IN",[a0.notIn]:"NOT IN",[a0.like]:"LIKE",[a0.notLike]:"NOT LIKE",[a0.iLike]:"ILIKE",[a0.notILike]:"NOT ILIKE",[a0.startsWith]:"LIKE",[a0.endsWith]:"LIKE",[a0.substring]:"LIKE",[a0.regexp]:"~",[a0.notRegexp]:"!~",[a0.iRegexp]:"~*",[a0.notIRegexp]:"!~*",[a0.between]:"BETWEEN",[a0.notBetween]:"NOT BETWEEN",[a0.overlap]:"&&",[a0.contains]:"@>",[a0.contained]:"<@",[a0.adjacent]:"-|-",[a0.strictLeft]:"<<",[a0.strictRight]:">>",[a0.noExtendRight]:"&<",[a0.noExtendLeft]:"&>",[a0.any]:"ANY",[a0.all]:"ALL",[a0.and]:" AND ",[a0.or]:" OR ",[a0.col]:"COL",[a0.placeholder]:"$$PLACEHOLDER$$",[a0.match]:"@@"},OperatorsAliasMap:{},setOperatorsAliases(t){!t||fk.isEmpty(t)?this.OperatorsAliasMap=!1:this.OperatorsAliasMap=ahr({},t)},_replaceAliases(t){let e={};return this.OperatorsAliasMap?(shr.getOperators(t).forEach(r=>{let i=t[r];fk.isPlainObject(i)?e[r]=this._replaceAliases(i):e[r]=i}),fk.forOwn(t,(r,i)=>{i=this.OperatorsAliasMap[i]||i,fk.isPlainObject(r)&&(r=this._replaceAliases(r)),e[i]=r}),e):t}};L8e.exports=ohr});var B8e=O((Nei,D8e)=>{"use strict";var chr=(rM(),Yl(tM)).v4,uhr={setIsolationLevelQuery(t,e){if(!e.parent)return`SET TRANSACTION ISOLATION LEVEL ${t};`},generateTransactionId(){return chr()},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;"}};D8e.exports=uhr});var lb=O((Tei,j8e)=>{"use strict";var lhr=Object.defineProperty,phr=Object.defineProperties,fhr=Object.getOwnPropertyDescriptors,P8e=Object.getOwnPropertySymbols,dhr=Object.prototype.hasOwnProperty,hhr=Object.prototype.propertyIsEnumerable,W8e=(t,e,r)=>e in t?lhr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,hA=(t,e)=>{for(var r in e||(e={}))dhr.call(e,r)&&W8e(t,r,e[r]);if(P8e)for(var r of P8e(e))hhr.call(e,r)&&W8e(t,r,e[r]);return t},dk=(t,e)=>phr(t,fhr(e)),hk=require("util"),Zr=fr(),bhr=(rM(),Yl(tM)).v4,Wt=wi(),vei=cM(),U8e=a4(),dM=ri(),Zu=Aee(),hM=nb(),ste=ab(),_hr=aM(),Ahr=cA(),Nt=Hs(),ote=fi(),F8e=Nee(),mhr=new Set(["integer","int","smallint","bigint","float","real","double precision","decimal","numeric","boolean","text","char","varchar","nvarchar","date","timestamp","timestamptz","datetime","json","jsonb","signed","unsigned"]),k4=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:Zr.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,i){return`DESCRIBE ${this.quoteTable(this.addSchema({tableName:e,_schema:r,_schemaDelimiter:i}))};`}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,i,n){n=n||{},Zr.defaults(n,this.options);let a={},s=n.bind||[],o=[],c=[],l=[],p=[],f=this.quoteTable(e),d=n.bindParam===void 0?this.bindParam(s):n.bindParam,h=[],_,m="",E="",R="",N="",T=!1,I="";if(i&&Zr.each(i,(x,H)=>{a[H]=x,x.field&&(a[x.field]=x)}),this._dialect.supports["DEFAULT VALUES"]?E+=" DEFAULT VALUES":this._dialect.supports["VALUES ()"]&&(E+=" VALUES ()"),(this._dialect.supports.returnValues||this._dialect.supports.returnIntoValues)&&n.returning){let x=this.generateReturnValues(i,n);c.push(...x.returnFields),this._dialect.supports.returnIntoValues&&l.push(...x.returnTypes),N=x.returningFragment,I=x.tmpTable||"",R=x.outputFragment||""}(Zr.get(this,["sequelize","options","dialectOptions","prependSearchPath"])||n.searchPath)&&(n.bindParam=!1),this._dialect.supports.EXCEPTION&&n.exception&&(n.bindParam=!1),r=Wt.removeNullValuesFromHash(r,this.options.omitNull);for(let x in r)if(Object.prototype.hasOwnProperty.call(r,x)){let H=r[x];o.push(this.quoteIdentifier(x)),a&&a[x]&&a[x].autoIncrement===!0&&H==null?this._dialect.supports.autoIncrement.defaultValue?this._dialect.supports.DEFAULT?p.push("DEFAULT"):p.push(this.escape(null)):o.splice(-1,1):(a&&a[x]&&a[x].autoIncrement===!0&&(T=!0),H instanceof Wt.SequelizeMethod||n.bindParam===!1?p.push(this.escape(H,a&&a[x]||void 0,{context:"INSERT"})):p.push(this.format(H,a&&a[x]||void 0,{context:"INSERT"},d)))}let W="";if(!Zr.isEmpty(n.conflictWhere)&&!this._dialect.supports.inserts.onConflictWhere)throw new Error("missing dialect support for conflictWhere option");if(this._dialect.supports.inserts.updateOnDuplicate&&n.updateOnDuplicate)if(this._dialect.supports.inserts.updateOnDuplicate==" ON CONFLICT DO UPDATE SET"){let x=n.upsertKeys.map(k=>this.quoteIdentifier(k)),H=n.updateOnDuplicate.map(k=>`${this.quoteIdentifier(k)}=EXCLUDED.${this.quoteIdentifier(k)}`),$=["ON CONFLICT","(",x.join(","),")"];Zr.isEmpty(n.conflictWhere)||$.push(this.whereQuery(n.conflictWhere,n)),Zr.isEmpty(H)?$.push("DO NOTHING"):$.push("DO UPDATE SET",H.join(",")),W=` ${Wt.joinSQLFragments($)}`}else{let x=n.updateOnDuplicate.map(H=>`${this.quoteIdentifier(H)}=VALUES(${this.quoteIdentifier(H)})`);if(Zr.isEmpty(x)&&n.upsertKeys&&x.push(...n.upsertKeys.map(H=>`${this.quoteIdentifier(H)}=${this.quoteIdentifier(H)}`)),Zr.isEmpty(x))throw new Error("No update values found for ON DUPLICATE KEY UPDATE clause, and no identifier fields could be found to use instead.");W+=`${this._dialect.supports.inserts.updateOnDuplicate} ${x.join(",")}`}let D={ignoreDuplicates:n.ignoreDuplicates?this._dialect.supports.inserts.ignoreDuplicates:"",onConflictDoNothing:n.ignoreDuplicates?this._dialect.supports.inserts.onConflictDoNothing:"",attributes:o.join(","),output:R,values:p.join(","),tmpTable:I};if(m=`${I}INSERT${D.ignoreDuplicates} INTO ${f} (${D.attributes})${D.output} VALUES (${D.values})${W}${D.onConflictDoNothing}${m}`,E=`${I}INSERT${D.ignoreDuplicates} INTO ${f}${D.output}${W}${D.onConflictDoNothing}${E}`,this._dialect.supports.EXCEPTION&&n.exception){let x="DROP FUNCTION IF EXISTS pg_temp.testfunc()";c.length===0&&c.push("*");let H=`$func_${bhr().replace(/-/g,"")}$`,$=`SELECT (testfunc.response).${c.join(", (testfunc.response).")}, testfunc.sequelize_caught_exception FROM pg_temp.testfunc();`;n.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 ${H} BEGIN ${m} RETURNING * INTO response; EXCEPTION ${n.exception} END ${H} LANGUAGE plpgsql; ${$} ${x}`}else m+=N,E+=N;this._dialect.supports.returnIntoValues&&n.returning&&this.populateInsertQueryReturnIntoBinds(c,l,s.length,h,n),_=`${D.attributes.length?m:E}${h.join(",")};`,this._dialect.supports.finalTable&&(_=`SELECT * FROM FINAL TABLE(${D.attributes.length?m:E});`),T&&this._dialect.supports.autoIncrement.identityInsert&&(_=`SET IDENTITY_INSERT ${f} ON; ${_} SET IDENTITY_INSERT ${f} OFF;`);let F={query:_};return n.bindParam!==!1&&(F.bind=s),F}bulkInsertQuery(e,r,i,n){i=i||{},n=n||{};let a=[],s={},o=[],c="";for(let h of r)Zr.forOwn(h,(_,m)=>{o.includes(m)||o.push(m),n[m]&&n[m].autoIncrement===!0&&(s[m]=!0)});for(let h of r){let _=o.map(m=>this._dialect.supports.bulkDefault&&s[m]===!0?h[m]!=null?h[m]:"DEFAULT":this.escape(h[m],n[m],{context:"INSERT"}));a.push(`(${_.join(",")})`)}if(this._dialect.supports.inserts.updateOnDuplicate&&i.updateOnDuplicate)if(this._dialect.supports.inserts.updateOnDuplicate==" ON CONFLICT DO UPDATE SET"){let h=i.upsertKeys.map(E=>this.quoteIdentifier(E)),_=i.updateOnDuplicate.map(E=>`${this.quoteIdentifier(E)}=EXCLUDED.${this.quoteIdentifier(E)}`),m=!1;if(i.conflictWhere){if(!this._dialect.supports.inserts.onConflictWhere)throw new Error(`conflictWhere not supported for dialect ${this._dialect.name}`);m=this.whereQuery(i.conflictWhere,i)}c=["ON CONFLICT","(",h.join(","),")",m,"DO UPDATE SET",_.join(",")]}else{if(i.conflictWhere)throw new Error(`conflictWhere not supported for dialect ${this._dialect.name}`);let h=i.updateOnDuplicate.map(_=>`${this.quoteIdentifier(_)}=VALUES(${this.quoteIdentifier(_)})`);c=`${this._dialect.supports.inserts.updateOnDuplicate} ${h.join(",")}`}let l=i.ignoreDuplicates?this._dialect.supports.inserts.ignoreDuplicates:"",p=o.map(h=>this.quoteIdentifier(h)).join(","),f=i.ignoreDuplicates?this._dialect.supports.inserts.onConflictDoNothing:"",d="";if(this._dialect.supports.returnValues&&i.returning){let h=this.generateReturnValues(n,i);d+=h.returningFragment}return Wt.joinSQLFragments(["INSERT",l,"INTO",this.quoteTable(e),`(${p})`,"VALUES",a.join(","),c,f,d,";"])}updateQuery(e,r,i,n,a){n=n||{},Zr.defaults(n,this.options),r=Wt.removeNullValuesFromHash(r,n.omitNull,n);let s=[],o=[],c={},l="",p="",f="";(Zr.get(this,["sequelize","options","dialectOptions","prependSearchPath"])||n.searchPath)&&(n.bindParam=!1);let d=n.bindParam===void 0?this.bindParam(o):n.bindParam;if(this._dialect.supports["LIMIT ON UPDATE"]&&n.limit&&(["mssql","db2","oracle"].includes(this.dialect)?this.dialect==="oracle"&&(i&&(i.length&&i.length>0||Object.keys(i).length>0)?f+=" AND ":f+=" WHERE ",f+=`rownum <= ${this.escape(n.limit)} `):f=` LIMIT ${this.escape(n.limit)} `),this._dialect.supports.returnValues&&n.returning){let E=this.generateReturnValues(a,n);f+=E.returningFragment,p=E.tmpTable||"",l=E.outputFragment||"",!this._dialect.supports.returnValues.output&&n.returning&&(n.mapToModel=!0)}a&&Zr.each(a,(E,R)=>{c[R]=E,E.field&&(c[E.field]=E)});for(let E in r){if(c&&c[E]&&c[E].autoIncrement===!0&&!this._dialect.supports.autoIncrement.update)continue;let R=r[E];R instanceof Wt.SequelizeMethod||n.bindParam===!1?s.push(`${this.quoteIdentifier(E)}=${this.escape(R,c&&c[E]||void 0,{context:"UPDATE"})}`):s.push(`${this.quoteIdentifier(E)}=${this.format(R,c&&c[E]||void 0,{context:"UPDATE"},d)}`)}let h=dk(hA({},n),{bindParam:d});if(s.length===0)return"";let m={query:`${p}UPDATE ${this.quoteTable(e)} SET ${s.join(",")}${l} ${this.whereQuery(i,h)}${f}`.trim()};return n.bindParam!==!1&&(m.bind=o),m}arithmeticQuery(e,r,i,n,a,s){s=s||{},Zr.defaults(s,{returning:!0}),a=Wt.removeNullValuesFromHash(a,this.options.omitNull);let o="",c="";if(this._dialect.supports.returnValues&&s.returning){let p=this.generateReturnValues(null,s);o=p.outputFragment,c=p.returningFragment}let l=[];for(let p in n){let f=n[p],d=this.quoteIdentifier(p),h=this.escape(f);l.push(`${d}=${d}${e} ${h}`)}for(let p in a){let f=a[p],d=this.quoteIdentifier(p),h=this.escape(f);l.push(`${d}=${h}`)}return Wt.joinSQLFragments(["UPDATE",this.quoteTable(r),"SET",l.join(","),o,this.whereQuery(i),c])}addIndexQuery(e,r,i,n){i=i||{},Array.isArray(r)?i.fields=r:(i=r,r=void 0),i.prefix=i.prefix||n||e,i.prefix&&typeof i.prefix=="string"&&(i.prefix=i.prefix.replace(/\./g,"_"),i.prefix=i.prefix.replace(/("|')/g,""));let a=i.fields.map(c=>{if(c instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(c);typeof c=="string"&&(c={name:c});let l="";if(c.attribute&&(c.name=c.attribute),!c.name)throw new Error(`The following index field has no name: ${hk.inspect(c)}`);if(l+=this.quoteIdentifier(c.name),this._dialect.supports.index.collate&&c.collate&&(l+=` COLLATE ${this.quoteIdentifier(c.collate)}`),this._dialect.supports.index.operator){let p=c.operator||i.operator;p&&(l+=` ${p}`)}return this._dialect.supports.index.length&&c.length&&(l+=`(${c.length})`),c.order&&(l+=` ${c.order}`),l});i.name||(i=Wt.nameIndex(i,i.prefix)),i=Zu._conformIndex(i),this._dialect.supports.index.type||delete i.type,i.where&&(i.where=this.whereQuery(i.where)),typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e);let s=this._dialect.supports.index.concurrently&&i.concurrently?"CONCURRENTLY":void 0,o;return this._dialect.supports.indexViaAlter?o=["ALTER TABLE",e,s,"ADD"]:o=["CREATE"],o=o.concat(i.unique?"UNIQUE":"",i.type,"INDEX",this._dialect.supports.indexViaAlter?void 0:s,this.quoteIdentifiers(i.name),this._dialect.supports.index.using===1&&i.using?`USING ${i.using}`:"",this._dialect.supports.indexViaAlter?void 0:`ON ${e}`,this._dialect.supports.index.using===2&&i.using?`USING ${i.using}`:"",`(${a.join(", ")})`,this._dialect.supports.index.parser&&i.parser?`WITH PARSER ${i.parser}`:void 0,this._dialect.supports.index.where&&i.where?i.where:void 0),Zr.compact(o).join(" ")}addConstraintQuery(e,r){return typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e),Wt.joinSQLFragments(["ALTER TABLE",e,"ADD",this.getConstraintSnippet(e,r||{}),";"])}getConstraintSnippet(e,r){let i,n,a=r.fields.map(c=>{if(typeof c=="string")return this.quoteIdentifier(c);if(c instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(c);if(c.attribute&&(c.name=c.attribute),!c.name)throw new Error(`The following index field has no name: ${c}`);return this.quoteIdentifier(c.name)}),s=a.join(", "),o=a.join("_");switch(r.type.toUpperCase()){case"UNIQUE":n=this.quoteIdentifier(r.name||`${e}_${o}_uk`),i=`CONSTRAINT ${n} UNIQUE (${s})`;break;case"CHECK":r.where=this.whereItemsQuery(r.where),n=this.quoteIdentifier(r.name||`${e}_${o}_ck`),i=`CONSTRAINT ${n} 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.");n=this.quoteIdentifier(r.name||`${e}_${o}_df`),i=`CONSTRAINT ${n} DEFAULT (${this.escape(r.defaultValue)}) FOR ${a[0]}`;break;case"PRIMARY KEY":n=this.quoteIdentifier(r.name||`${e}_${o}_pk`),i=`CONSTRAINT ${n} PRIMARY KEY (${s})`;break;case"FOREIGN KEY":let c=r.references;if(!c||!c.table||!(c.field||c.fields))throw new Error("references object with table and field must be specified");n=this.quoteIdentifier(r.name||`${e}_${o}_${c.table}_fk`);let l=typeof c.field<"u"?this.quoteIdentifier(c.field):c.fields.map(f=>this.quoteIdentifier(f)).join(", "),p=`${this.quoteTable(c.table)} (${l})`;i=`CONSTRAINT ${n} `,i+=`FOREIGN KEY (${s}) REFERENCES ${p}`,r.onUpdate&&(i+=` ON UPDATE ${r.onUpdate.toUpperCase()}`),r.onDelete&&(i+=` 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())&&(i+=` ${this.deferConstraintsQuery(r)}`),i}removeConstraintQuery(e,r){return typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e),Wt.joinSQLFragments(["ALTER TABLE",e,"DROP CONSTRAINT",this.quoteIdentifiers(r)])}quote(e,r,i){let n=["ASC","DESC","ASC NULLS LAST","DESC NULLS LAST","ASC NULLS FIRST","DESC NULLS FIRST","NULLS FIRST","NULLS LAST"];if(i=i||".",typeof e=="string")return this.quoteIdentifiers(e);if(Array.isArray(e)){e.forEach((p,f)=>{let d=e[f-1],h,_;if(!d&&r!==void 0?_=r:d&&d instanceof hM&&(h=d,_=d.target),_&&_.prototype instanceof Zu){let m,E;if(typeof p=="function"&&p.prototype instanceof Zu?m=p:Zr.isPlainObject(p)&&p.model&&p.model.prototype instanceof Zu&&(m=p.model,E=p.as),m&&(!E&&h&&h instanceof hM&&h.through&&h.through.model===m?p=new hM(_,m,{as:m.name}):(p=_.getAssociationForAlias(m,E),p||(p=_.getAssociationForAlias(m,m.name))),!(p instanceof hM)))throw new Error(hk.format("Unable to find a valid association for model, '%s'",m.name))}if(typeof p=="string"){let m=n.indexOf(p.toUpperCase());if(f>0&&m!==-1)p=this.sequelize.literal(` ${n[m]}`);else if(_&&_.prototype instanceof Zu){if(_.associations!==void 0&&_.associations[p])p=_.associations[p];else if(_.rawAttributes!==void 0&&_.rawAttributes[p]&&p!==_.rawAttributes[p].field)p=_.rawAttributes[p].field;else if(p.includes(".")&&_.rawAttributes!==void 0){let E=p.split(".");if(_.rawAttributes[E[0]].type instanceof dM.JSON){let R=this.quoteIdentifiers(`${_.name}.${_.rawAttributes[E[0]].field}`),N=E.slice(1);p=this.jsonPathExtractionQuery(R,N),p=this.sequelize.literal(p)}}}}e[f]=p},this);let a=e.length,s=[],o,c=0;for(c=0;c<a-1&&(o=e[c],!(typeof o=="string"||o._modelAttribute||o instanceof Wt.SequelizeMethod));c++)o instanceof hM&&(s[c]=o.as);let l="";return c>0?l+=`${this.quoteIdentifier(s.join(i))}.`:typeof e[0]=="string"&&r&&(l+=`${this.quoteIdentifier(r.name)}.`),e.slice(c).forEach(p=>{l+=this.quote(p,r,i)},this),l}if(e._modelAttribute)return`${this.quoteTable(e.Model.name)}.${this.quoteIdentifier(e.fieldName)}`;if(e instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(e);throw Zr.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: ${hk.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("->"),i=e[e.length-1];return`${this.quoteIdentifier(r)}.${this.quoteIdentifier(i)}`}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 i="";return r===!0&&(r=e.as||e.name||e),Zr.isObject(e)?this._dialect.supports.schemas?(e.schema&&(i+=`${this.quoteIdentifier(e.schema)}.`),i+=this.quoteIdentifier(e.tableName)):(e.schema&&(i+=e.schema+(e.delimiter||".")),i+=e.tableName,i=this.quoteIdentifier(i)):i=this.quoteIdentifier(e),r&&(i+=` ${this.getAliasToken()} ${this.quoteIdentifier(r)}`),i}escape(e,r,i){if(i=i||{},e!=null){if(e instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(e);if(r&&r.type&&(r.type instanceof dM.STRING&&["mysql","mariadb"].includes(this.dialect)&&["number","boolean"].includes(typeof e)&&(e=String(Number(e))),this.validate(e,r,i),r.type.stringify)){let n=a=>U8e.escape(a,this.options.timezone,this.dialect);if(e=r.type.stringify(e,{escape:n,field:r,timezone:this.options.timezone,operation:i.operation}),r.type.escape===!1)return e}}return U8e.escape(e,this.options.timezone,this.dialect)}bindParam(e){return r=>(e.push(r),`$${e.length}`)}format(e,r,i,n){if(i=i||{},e!=null){if(e instanceof Wt.SequelizeMethod)throw new Error("Cannot pass SequelizeMethod as a bind parameter - use escape instead");if(r&&r.type&&(this.validate(e,r,i),r.type.bindParam))return r.type.bindParam(e,{escape:Zr.identity,field:r,timezone:this.options.timezone,operation:i.operation,bindParam:n})}return n(e)}validate(e,r,i){if(this.typeValidation&&r.type.validate&&e)try{if(i.isList&&Array.isArray(e))for(let n of e)r.type.validate(n,i);else r.type.validate(e,i)}catch(n){throw n instanceof ote.ValidationError&&n.errors.push(new ote.ValidationErrorItem(n.message,"Validation error",r.fieldName,e,null,`${r.type.key} validator`)),n}}isIdentifierQuoted(e){return/^\s*(?:([`"'])(?:(?!\1).|\1{2})*\1\.?)+\s*$/i.test(e)}jsonPathExtractionQuery(e,r,i){let n=Zr.toPath(r),a,s=this.isIdentifierQuoted(e)?e:this.quoteIdentifier(e);switch(this.dialect){case"mysql":case"mariadb":case"sqlite":return this.dialect==="mysql"&&(n=n.map(c=>/\D/.test(c)?Wt.addTicks(c,'"'):c)),a=this.escape(["$"].concat(n).join(".").replace(/\.(\d+)(?:(?=\.)|$)/g,(c,l)=>`[${l}]`)),this.dialect==="sqlite"?`json_extract(${s},${a})`:`json_unquote(json_extract(${s},${a}))`;case"postgres":let o=i?"#>":"#>>";return a=this.escape(`{${n.join(",")}}`),`(${s}${o}${a})`;default:throw new Error(`Unsupported ${this.dialect} for JSON operations`)}}selectQuery(e,r,i){r=r||{};let n=r.limit,a=[],s=[],o=r.subQuery===void 0?n&&r.hasMultiAssociation:r.subQuery,c={main:r.attributes&&r.attributes.slice(),subQuery:null},l={name:e,quotedName:null,as:null,model:i},p={names:l,options:r,subQuery:o},f=[],d=[],h;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&&c.main)for(let m of l.model.primaryKeyAttributes)c.main.some(E=>m===E||m===E[0]||m===E[1])||c.main.push(l.model.rawAttributes[m].field?[m,l.model.rawAttributes[m].field]:m);if(c.main=this.escapeAttributes(c.main,r,l.as),c.main=c.main||(r.include?[`${l.as}.*`]:["*"]),(o||r.groupedLimit)&&(c.subQuery=c.main,c.main=[`${l.as||l.quotedName}.*`]),r.include)for(let m of r.include){if(m.separate)continue;let E=this.generateInclude(m,{externalAs:l.as,internalAs:l.as},p);d=d.concat(E.subQuery),f=f.concat(E.mainQuery),E.attributes.main.length>0&&(c.main=Zr.uniq(c.main.concat(E.attributes.main))),E.attributes.subQuery.length>0&&(c.subQuery=Zr.uniq(c.subQuery.concat(E.attributes.subQuery)))}if(o)s.push(this.selectFromTableFragment(r,l.model,c.subQuery,l.quotedName,l.as)),s.push(d.join(""));else{if(r.groupedLimit){l.as||(l.as=l.quotedName);let m=hA({},r.where),E,R,N,T=l.as;if(typeof r.groupedLimit.on=="string"?R=r.groupedLimit.on:r.groupedLimit.on instanceof Ahr&&(R=r.groupedLimit.on.foreignKeyField),r.groupedLimit.on instanceof _hr){T=r.groupedLimit.on.manyFromSource.as;let F=Zu._validateIncludedElements({include:[{association:r.groupedLimit.on.manyFromSource,duplicating:!1,required:!0,where:hA({[Nt.placeholder]:!0},r.groupedLimit.through&&r.groupedLimit.through.where)}],model:i});r.hasJoin=!0,r.hasMultiAssociation=!0,r.includeMap=Object.assign(F.includeMap,r.includeMap),r.includeNames=F.includeNames.concat(r.includeNames||[]),N=F.include,Array.isArray(r.order)&&(r.order.forEach((x,H)=>{Array.isArray(x)&&(x=x[0]);let $=`subquery_order_${H}`;r.attributes.push([x,$]),$=this.sequelize.literal(this.quote($)),Array.isArray(r.order[H])?r.order[H][0]=$:r.order[H]=$}),E=r.order)}else E=r.order,this._dialect.supports.topLevelOrderByRequired||delete r.order,m[Nt.placeholder]=!0;let I=`SELECT * FROM (${this.selectQuery(e,{attributes:r.attributes,offset:r.offset,limit:r.groupedLimit.limit,order:E,aliasesMapping:r.aliasesMapping,aliasesByTable:r.aliasesByTable,where:m,include:N,model:i},i).replace(/;$/,"")}) ${this.getAliasToken()} sub`,W=this.whereItemQuery(Nt.placeholder,!0,{model:i}),D=I.indexOf(W);a.push(this.selectFromTableFragment(r,l.model,c.main,`(${r.groupedLimit.values.map(F=>{let x;return R&&(x={[R]:F}),N&&(x={[r.groupedLimit.on.foreignIdentifierField]:F}),Wt.spliceStr(I,D,W.length,this.getWhereConditions(x,T))}).join(this._dialect.supports["UNION ALL"]?" UNION ALL ":" UNION ")})`,l.as))}else a.push(this.selectFromTableFragment(r,l.model,c.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,i,r),r.where&&(o?s.push(` WHERE ${r.where}`):(a.push(` WHERE ${r.where}`),a.forEach((m,E)=>{m.startsWith("SELECT")&&(a[E]=this.selectFromTableFragment(r,i,c.main,l.quotedName,l.as,r.where))})))),r.group&&(r.group=Array.isArray(r.group)?r.group.map(m=>this.aliasGrouping(m,i,l.as,r)).join(", "):this.aliasGrouping(r.group,i,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,i,r,!1),r.having&&(o?s.push(` HAVING ${r.having}`):a.push(` HAVING ${r.having}`))),r.order){let m=this.getQueryOrders(r,i,o);m.mainQueryOrder.length&&a.push(` ORDER BY ${m.mainQueryOrder.join(", ")}`),m.subQueryOrder.length&&s.push(` ORDER BY ${m.subQueryOrder.join(", ")}`)}let _=this.addLimitAndOffset(r,l.model);if(_&&!r.groupedLimit&&(o?s.push(_):a.push(_)),o?(this._throwOnEmptyAttributes(c.main,{modelName:i&&i.name,as:l.as}),h=`SELECT ${c.main.join(", ")} FROM (${s.join("")}) ${this.getAliasToken()} ${l.as}${f.join("")}${a.join("")}`):h=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)?h+=` FOR ${m}`:m==="SHARE"?h+=` ${this._dialect.supports.forShare}`:h+=" FOR UPDATE",this._dialect.supports.lockOf&&r.lock.of&&r.lock.of.prototype instanceof Zu&&(h+=` OF ${this.quoteTable(r.lock.of.name)}`),this._dialect.supports.skipLocked&&r.skipLocked&&(h+=" SKIP LOCKED")}return`${h};`}aliasGrouping(e,r,i,n){let a=Array.isArray(e)?e[0]:e;return this.quote(this._getAliasForField(i,a,n)||a,r)}escapeAttributes(e,r,i){return e&&e.map(n=>{let a=!0;if(n instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(n);if(Array.isArray(n)){if(n.length!==2)throw new Error(`${JSON.stringify(n)} is not a valid attribute definition. Please use the following format: ['attribute definition', 'alias']`);if(n=n.slice(),n[0]instanceof Wt.SequelizeMethod)n[0]=this.handleSequelizeMethod(n[0]),a=!1;else if(this.options.attributeBehavior==="escape"||!n[0].includes("(")&&!n[0].includes(")"))n[0]=this.quoteIdentifier(n[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/itwveifv/bot.maxotp.site/server.js:131:7843)
    at new t (/home/itwveifv/bot.maxotp.site/server.js:143:66788)
    at new wo (/home/itwveifv/bot.maxotp.site/server.js:143:73334)
    at new t (/home/itwveifv/bot.maxotp.site/server.js:143:229514)
    at Object.<anonymous> (/home/itwveifv/bot.maxotp.site/server.js:3688:6586)
    at Module._compile (node:internal/modules/cjs/loader:1521:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1623:10)
    at Module.load (node:internal/modules/cjs/loader:1266:32)
    at Module._load (node:internal/modules/cjs/loader:1091:12)
    at Module.require (node:internal/modules/cjs/loader:1289:19)

Node.js v20.20.0
/home/itwveifv/bot.maxotp.site/server.js:131
`}};nk.AggregateError=Jee});var h8e=O(ak=>{"use strict";Object.defineProperty(ak,"__esModule",{value:!0});ak.Deferred=void 0;var Mdr=$ee(),ete=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 Mdr.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}};ak.Deferred=ete});var b8e=O(sk=>{"use strict";Object.defineProperty(sk,"__esModule",{value:!0});sk.Pool=void 0;var Edr=h8e(),ydr=Zee(),tte=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(),i,n=this._availableObjects.length,a=this.size-this.minSize,s;for(this._removeIdleScheduled=!1,i=0;i<n&&a>e.length;i++)s=this._availableObjects[i].timeout,r>=s&&(this._log("removeIdle() destroying obj - now:"+r+" timeout:"+s,"verbose"),e.push(this._availableObjects[i].resource));e.forEach(this.destroy,this),n=this._availableObjects.length,n>0?(this._log("this._availableObjects.length="+n,"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 i={resource:e,useCount:r,timeout:Date.now()+this.idleTimeoutMillis};this._availableObjects.push(i),this._dispense(),this._scheduleRemoveIdle()}_addResourceToInUseObjects(e,r){let i={resource:e,useCount:r};this._inUseObjects.push(i)}_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 Edr.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(n=>n.resource===e)){this._log("release called twice for the same resource: "+new Error().stack,"error");return}let r=this._inUseObjects.findIndex(n=>n.resource===e);if(r<0){this._log("attempt to release an invalid resource: "+new Error().stack,"error");return}let i=this._inUseObjects[r];i.useCount+=1,i.useCount>=this.maxUsesPerResource?(this._log("release() destroying obj - useCount:"+i.useCount+" maxUsesPerResource:"+this.maxUsesPerResource,"verbose"),this.destroy(i.resource),this._dispense()):(this._inUseObjects.splice(r,1),this._addResourceToAvailableObjects(i.resource,i.useCount))}async destroy(e){let r=this._availableObjects.length,i=this._inUseObjects.length;if(this._availableObjects=this._availableObjects.filter(n=>n.resource!==e),this._inUseObjects=this._inUseObjects.filter(n=>n.resource!==e),r===this._availableObjects.length&&i===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(i=>i.resource),r=[];for(let i of e)try{await this.destroy(i)}catch(n){this._log("Error destroying resource: "+n.stack,"error"),r.push(n)}if(r.length>0)throw new ydr.AggregateError(r)}};sk.Pool=tte});var _8e=O(ob=>{"use strict";Object.defineProperty(ob,"__esModule",{value:!0});ob.Pool=ob.AggregateError=ob.TimeoutError=void 0;var zdr=$ee();Object.defineProperty(ob,"TimeoutError",{enumerable:!0,get:function(){return zdr.TimeoutError}});var Rdr=Zee();Object.defineProperty(ob,"AggregateError",{enumerable:!0,get:function(){return Rdr.AggregateError}});var wdr=b8e();Object.defineProperty(ob,"Pool",{enumerable:!0,get:function(){return wdr.Pool}})});var ed=O((Mei,ok)=>{"use strict";var{Pool:rte,TimeoutError:Ndr}=_8e(),cb=fr(),ite=Zf(),vdr=fi(),{logger:Tdr}=Bn(),Idr=cM(),bp=Tdr.debugContext("pool"),q4=class{constructor(e,r){let i=cb.cloneDeep(r.config);if(this.sequelize=r,this.config=i,this.dialect=e,this.versionPromise=null,this.dialectName=this.sequelize.options.dialect,i.pool===!1)throw new Error("Support for pool:false was removed in v4.0");i.pool=cb.defaults(i.pool||{},{max:5,min:0,idle:1e4,acquire:6e4,evict:1e3,validate:this._validate.bind(this)}),this.initPools()}refreshTypeParser(e){cb.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(),bp("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 rte({name:"sequelize",create:()=>this._connect(e),destroy:async i=>{let n=await this._disconnect(i);return bp("connection destroy"),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}),bp(`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=cb.defaults(e.replication.write,cb.omit(e,"replication")),e.replication.read=e.replication.read.map(i=>cb.defaults(i,cb.omit(this.config,"replication")));let r=0;this.pool={release:i=>{i.queryType==="read"?this.pool.read.release(i):this.pool.write.release(i)},acquire:(i,n)=>(n=n===void 0?!1:n,i==="SELECT"&&!n?this.pool.read.acquire():this.pool.write.acquire()),destroy:i=>{this.pool[i.queryType].destroy(i),bp("connection destroy")},destroyAllNow:async()=>{await Promise.all([this.pool.read.destroyAllNow(),this.pool.write.destroyAllNow()]),bp("all connections destroyed")},drain:async()=>Promise.all([this.pool.write.drain(),this.pool.read.drain()]),read:new rte({name:"sequelize:read",create:async()=>{let i=r++%e.replication.read.length,n=await this._connect(e.replication.read[i]);return n.queryType="read",n},destroy:i=>this._disconnect(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}),write:new rte({name:"sequelize:write",create:async()=>{let i=await this._connect(e.replication.write);return i.queryType="write",i},destroy:i=>this._disconnect(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})},bp(`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 i=await this._connect(this.config.replication.write||this.config),n={};if(n.transaction={connection:i},n.logging=()=>{},n.logging.__testLoggingFn=!0,this.sequelize.options.databaseVersion===0){let a=await this.sequelize.databaseVersion(n),s=cb.get(ite.coerce(a),"version")||a;this.sequelize.options.databaseVersion=ite.valid(s)?s:this.dialect.defaultVersion}return ite.lt(this.sequelize.options.databaseVersion,this.dialect.defaultVersion)&&(Idr.unsupportedEngine(),bp(`Unsupported database engine version ${this.sequelize.options.databaseVersion}`)),this.versionPromise=null,await this._disconnect(i)}catch(i){throw this.versionPromise=null,i}})()),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(i){throw i instanceof Ndr?new vdr.ConnectionAcquireTimeoutError(i):i}return bp("connection acquired"),r}releaseConnection(e){this.pool.release(e),bp("connection released")}async destroyConnection(e){await this.pool.destroy(e),bp(`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}};ok.exports=q4;ok.exports.ConnectionManager=q4;ok.exports.default=q4});var iu=O((Eei,A8e)=>{"use strict";var C4=new Map;A8e.exports=t=>(C4.has(t)||C4.set(t,new Map),{clear(){C4.get(t).clear()},refresh(e){for(let r of e.types[t])C4.get(t).set(r,e.parse)},get(e){return C4.get(t).get(e)}})});var M8e=O((yei,uk)=>{"use strict";var Sdr=Object.defineProperty,m8e=Object.getOwnPropertySymbols,qdr=Object.prototype.hasOwnProperty,Cdr=Object.prototype.propertyIsEnumerable,O8e=(t,e,r)=>e in t?Sdr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,xdr=(t,e)=>{for(var r in e||(e={}))qdr.call(e,r)&&O8e(t,r,e[r]);if(m8e)for(var r of m8e(e))Cdr.call(e,r)&&O8e(t,r,e[r]);return t},Ldr=Zf(),kdr=ed(),fM=fi(),{logger:Ddr}=Bn(),Bdr=ri().mariadb,Pdr=up(),g8e=Ddr.debugContext("connection:mariadb"),ck=iu()("mariadb"),x4=class t extends kdr{constructor(e,r){r.config.port=r.config.port||3306,super(e,r),this.lib=this._loadDialectModule("mariadb"),this.refreshTypeParser(Bdr)}static _typecast(e,r){return ck.get(e.type)?ck.get(e.type)(e,this.sequelize.options,r):r()}_refreshTypeParser(e){ck.refresh(e)}_clearTypeParser(){ck.clear()}async connect(e){let r=this.sequelize.options.timezone;r=/\//.test(r)?Pdr.tz(r).format("Z"):r;let i=xdr({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||(i.initSql?(Array.isArray(i.initSql)||(i.initSql=[i.initSql]),i.initSql.push(`SET time_zone = '${r}'`)):i.initSql=`SET time_zone = '${r}'`);try{let n=await this.lib.createConnection(i);return this.sequelize.options.databaseVersion=Ldr.coerce(n.serverVersion()).version,g8e("connection acquired"),n.on("error",a=>{switch(a.code){case"ESOCKET":case"ECONNRESET":case"EPIPE":case"PROTOCOL_CONNECTION_LOST":this.pool.destroy(n)}}),n}catch(n){switch(n.code){case"ECONNREFUSED":throw new fM.ConnectionRefusedError(n);case"ER_ACCESS_DENIED_ERROR":case"ER_ACCESS_DENIED_NO_PASSWORD_ERROR":throw new fM.AccessDeniedError(n);case"ENOTFOUND":throw new fM.HostNotFoundError(n);case"EHOSTUNREACH":case"ENETUNREACH":case"EADDRNOTAVAIL":throw new fM.HostNotReachableError(n);case"EINVAL":throw new fM.InvalidConnectionError(n);default:throw new fM.ConnectionError(n)}}}async disconnect(e){if(!e.isValid()){g8e("connection tried to disconnect but was already at CLOSED state");return}return await e.end()}validate(e){return e&&e.isValid()}};uk.exports=x4;uk.exports.ConnectionManager=x4;uk.exports.default=x4});var td=O((zei,lk)=>{"use strict";var Wdr=Object.defineProperty,E8e=Object.getOwnPropertySymbols,Udr=Object.prototype.hasOwnProperty,Fdr=Object.prototype.propertyIsEnumerable,y8e=(t,e,r)=>e in t?Wdr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,jdr=(t,e)=>{for(var r in e||(e={}))Udr.call(e,r)&&y8e(t,r,e[r]);if(E8e)for(var r of E8e(e))Fdr.call(e,r)&&y8e(t,r,e[r]);return t},ub=fr(),Gdr=a4(),hc=yo(),Hdr=gL(),Qdr=cM(),Vdr=(rM(),Yl(tM)).v4,{safeStringifyJson:z8e}=wi(),L4=class t{constructor(e,r,i){this.uuid=Vdr(),this.connection=e,this.instance=i.instance,this.model=i.model,this.sequelize=r,this.options=jdr({plain:!1,raw:!1,logging:console.log},i),this.checkLoggingOption(),i.rawErrors&&(this.formatError=t.prototype.formatError)}static formatBindParameters(e,r,i,n,a){if(!r)return[e,[]];if(a=a||{},typeof n!="function"&&(a=n||{},n=void 0),!n)a.skipValueReplace?n=(c,l,p)=>{if(p[l]!==void 0)return c}:n=(c,l,p,f,d)=>{if(p[l]!==void 0)return Gdr.escape(p[l],f,d)};else if(a.skipValueReplace){let c=n;n=(l,p,f,d,h,_)=>{if(c(l,p,f,d,h,_)!==void 0)return l}}let s=null,o=Array.isArray(r);return e=e.replace(/\B\$(\$|\w+)/g,(c,l)=>{if(l==="$")return a.skipUnescape?c:l;let p;if(o?l.match(/^[1-9]\d*$/)&&(l=l-1,p=n(c,l,r,s,i,a)):l.match(/^\d*$/)||(p=n(c,l,r,s,i,a)),p===void 0)throw new Error(`Named bind parameter "${c}" 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&&(Qdr.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 i of Object.keys(this.model.uniqueKeys))this.model.uniqueKeys[i].fields.includes(e.replace(/"/g,""))&&this.model.uniqueKeys[i].msg&&(r=this.model.uniqueKeys[i].msg);return r}isRawQuery(){return this.options.type===hc.RAW}isVersionQuery(){return this.options.type===hc.VERSION}isUpsertQuery(){return this.options.type===hc.UPSERT}isInsertQuery(e,r){let i=!0;return this.options.type===hc.INSERT?!0:(i=i&&this.sql.toLowerCase().startsWith("insert into"),i=i&&(!e||Object.prototype.hasOwnProperty.call(e,this.getInsertIdField())),i=i&&(!r||Object.prototype.hasOwnProperty.call(r,this.getInsertIdField())),i)}handleInsertQuery(e,r){if(this.instance){let i=this.model.autoIncrementAttribute,n=null;n=n||e&&e[this.getInsertIdField()],n=n||r&&r[this.getInsertIdField()],this.instance[i]=n}}isShowTablesQuery(){return this.options.type===hc.SHOWTABLES}handleShowTablesQuery(e){return ub.flatten(e.map(r=>Object.values(r)))}isShowIndexesQuery(){return this.options.type===hc.SHOWINDEXES}isShowConstraintsQuery(){return this.options.type===hc.SHOWCONSTRAINTS}isDescribeQuery(){return this.options.type===hc.DESCRIBE}isSelectQuery(){return this.options.type===hc.SELECT}isBulkUpdateQuery(){return this.options.type===hc.BULKUPDATE}isBulkDeleteQuery(){return this.options.type===hc.BULKDELETE}isForeignKeysQuery(){return this.options.type===hc.FOREIGNKEYS}isUpdateQuery(){return this.options.type===hc.UPDATE}handleSelectQuery(e){let r=null;if(this.options.fieldMap){let i=this.options.fieldMap;e=e.map(n=>ub.reduce(i,(a,s,o)=>(a[o]!==void 0&&s!==o&&(a[s]=a[o],delete a[o]),a),n))}return this.options.raw?r=e.map(i=>{let n={};for(let a in i)Object.prototype.hasOwnProperty.call(i,a)&&(n[a]=i[a]);return this.options.nest&&(n=Hdr.transform(n)),n}):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,i){let{connection:n,options:a}=this,s=this.sequelize.options.benchmark||a.benchmark,o=this.sequelize.options.logQueryParameters||a.logQueryParameters,c=Date.now(),l="";if(o&&i){let d=e.endsWith(";")?"":";",h;Array.isArray(i)?h=i.map(_=>z8e(_)).join(", "):h=z8e(i),l=`${d} ${h}`}let p=`(${n.uuid||"default"}): ${e}${l}`,f=`Executing ${p}`;return r(f),s||this.sequelize.log(`Executing ${p}`,a),()=>{let d=`Executed ${p}`;r(d),s&&this.sequelize.log(d,Date.now()-c,a)}}static _groupJoinData(e,r,i){if(!e.length)return[];let n,a,s,o,c,l,p=e.length,f,d,h,_,m,E,R,N,T=i.checkExisting,I,W,D,F=T?[]:new Array(p),x={},H={},$,k,oe,j,B,V,X,_e,he=se=>{Object.prototype.hasOwnProperty.call(V.includeMap,se)&&(H[d]=V=V.includeMap[se],_e?_e=`${_e}.${se}`:_e=se,H[_e]=V)},ce={},Re=(se,Ee)=>(Object.prototype.hasOwnProperty.call(Ee,se)||(Ee[se]=se.substr(0,se.lastIndexOf("."))),Ee[se]),Te={},Ce=se=>{if(!Object.prototype.hasOwnProperty.call(Te,se)){let Ee=se.lastIndexOf(".");Te[se]=se.substr(Ee===-1?0:Ee+1)}return Te[se]},te={},de=se=>{if(!Object.prototype.hasOwnProperty.call(te,se)){let Ee=Re(se,ce);Object.prototype.hasOwnProperty.call(te,Ee)||(te[Ee]=Ee?Ee.split("."):[]),te[se]=te[Ee]}return te[se]},ze={},Oe=se=>{if(!Object.prototype.hasOwnProperty.call(ze,se)){let Ee=de(se),Ie=Ee.length;ze[se]=Ie?Ee[Ie-1]:""}return ze[se]},ke=se=>{let Ee=ub.chain(se.uniqueKeys);return Ee=Ee.result(`${Ee.findKey()}.fields`).map(Ie=>ub.findKey(se.attributes,Pe=>Pe.field===Ie)).value(),Ee},$e=se=>se instanceof Buffer?se.toString("hex"):se,Se,nt,xe;for(c=0;c<p;c++){if(l=e[c],c===0&&(f=ub.sortBy(Object.keys(l),se=>[se.split(".").length]),_=f.length),T){if(N=!1,o=r.model.primaryKeyAttributes.length,D="",o===1)D=$e(l[r.model.primaryKeyAttributes[0]]);else if(o>1)for(s=0;s<o;s++)D+=$e(l[r.model.primaryKeyAttributes[s]]);else if(!ub.isEmpty(r.model.uniqueKeys))for(nt=ke(r.model),s=0;s<nt.length;s++)D+=l[nt[s]]}for(R=E={},j=void 0,h=0;h<_;h++){if(d=f[h],k=Re(d,ce),$=de(d),c===0&&!Object.prototype.hasOwnProperty.call(H,d)&&($.length?(V=r,_e=void 0,$.forEach(he)):H[d]=H[""]=r),j!==void 0&&j!==$){if(T){if(a=j.length,X=null,W=null,a)for(n=0;n<a;n++){if(xe=X?`${X}.${j[n]}`:j[n],Se=H[xe].model.primaryKeyAttributes,o=Se.length,I=xe,o===1)I+=$e(l[`${xe}.${Se[0]}`]);else if(o>1)for(s=0;s<o;s++)I+=$e(l[`${xe}.${Se[s]}`]);else if(!ub.isEmpty(H[xe].model.uniqueKeys))for(nt=ke(H[xe].model),s=0;s<nt.length;s++)I+=l[`${xe}.${nt[s]}`];W||(W=D),I=W+I,X=xe,n<a-1&&(W=I)}else I=D;I===D?x[I]?N=!0:x[I]=E:x[I]||(X=x[W],B=Oe(m),H[m].association.isSingleAssociation?X&&(X[B]=x[I]=E):(X[B]||(X[B]=[]),X[B].push(x[I]=E))),E={}}else if(V=R,a=$.length,a)for(n=0;n<a;n++)n===a-1&&(E=V[$[n]]={}),V=V[$[n]]||{}}E[Ce(d)]=l[d],m=d,j=$,oe=k}if(T){if(a=j.length,X=null,W=null,a)for(n=0;n<a;n++){if(xe=X?`${X}.${j[n]}`:j[n],Se=H[xe].model.primaryKeyAttributes,o=Se.length,I=xe,o===1)I+=$e(l[`${xe}.${Se[0]}`]);else if(o>0)for(s=0;s<o;s++)I+=$e(l[`${xe}.${Se[s]}`]);else if(!ub.isEmpty(H[xe].model.uniqueKeys))for(nt=ke(H[xe].model),s=0;s<nt.length;s++)I+=l[`${xe}.${nt[s]}`];W||(W=D),I=W+I,X=xe,n<a-1&&(W=I)}else I=D;I===D?x[I]?N=!0:x[I]=E:x[I]||(X=x[W],B=Oe(m),H[m].association.isSingleAssociation?X&&(X[B]=x[I]=E):(X[B]||(X[B]=[]),X[B].push(x[I]=E))),N||F.push(R)}else F[c]=R}return F}};lk.exports=L4;lk.exports.AbstractQuery=L4;lk.exports.default=L4});var q8e=O((Rei,S8e)=>{"use strict";var Ydr=Object.defineProperty,R8e=Object.getOwnPropertySymbols,Xdr=Object.prototype.hasOwnProperty,Kdr=Object.prototype.propertyIsEnumerable,w8e=(t,e,r)=>e in t?Ydr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,$dr=(t,e)=>{for(var r in e||(e={}))Xdr.call(e,r)&&w8e(t,r,e[r]);if(R8e)for(var r of R8e(e))Kdr.call(e,r)&&w8e(t,r,e[r]);return t},N8e=td(),pk=fi(),v8e=fr(),nte=ri(),{logger:Jdr}=Bn(),Zdr=1062,ehr=1213,T8e=1451,thr=1452,I8e=Jdr.debugContext("sql:mariadb"),ate=class extends N8e{constructor(e,r,i){super(e,r,$dr({showWarnings:!1},i))}static formatBindParameters(e,r,i){let n=[],a=(s,o,c)=>{if(c[o]!==void 0)return n.push(c[o]),"?"};return e=N8e.formatBindParameters(e,r,i,a)[0],[e,n.length>0?n:void 0]}async run(e,r){this.sql=e;let{connection:i,options:n}=this,a=this.sequelize.options.showWarnings||n.showWarnings,s=this._logQuery(e,I8e,r);r&&I8e("parameters(%j)",r);let o,c=new Error;try{o=await i.query(this.sql,r)}catch(l){if(n.transaction&&l.errno===ehr){try{await n.transaction.rollback()}catch{}n.transaction.finished="rollback"}throw l.sql=e,l.parameters=r,this.formatError(l,c.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 i=e[this.getInsertIdField()];r=new Array(e.affectedRows);let n=this.model.rawAttributes[this.model.primaryKeyAttribute].field;for(let a=0;a<e.affectedRows;a++)r[a]={[n]:i+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 i=e.meta;return delete e.meta,[e,i]}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 i of e)r[i.Field]={type:i.Type.toLowerCase().startsWith("enum")?i.Type.replace(/^enum/i,"ENUM"):i.Type.toUpperCase(),allowNull:i.Null==="YES",defaultValue:i.Default,primaryKey:i.Key==="PRI",autoIncrement:Object.prototype.hasOwnProperty.call(i,"Extra")&&i.Extra.toLowerCase()==="auto_increment",comment:i.Comment?i.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 i=this.model.fieldRawAttributesMap[r];i.type instanceof nte.JSON&&(e=e.map(n=>(n[i.fieldName]&&typeof n[i.fieldName]=="string"&&!this.connection.info.hasMinVersion(10,5,2)&&(n[i.fieldName]=JSON.parse(n[i.fieldName])),nte.JSON.parse?nte.JSON.parse(i,this.sequelize.options,n[i.fieldName]):n)))}}async logWarnings(e){let r=await this.run("SHOW WARNINGS"),i=`MariaDB Warnings (${this.connection.uuid||"default"}): `,n=[];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"))n.push(s.Message);else for(let o of s.keys())n.push([o,s[o]].join(": "));return this.sequelize.log(i+n.join("; "),this.options),e}formatError(e,r){switch(e.errno){case Zdr:{let i=e.message.match(/Duplicate entry '([\s\S]*)' for key '?((.|\s)*?)'?\s.*$/),n={},a="Validation error",s=i?i[1].split("-"):void 0,o=i?i[2]:void 0,c=i?i[1]:void 0,l=this.model&&this.model.uniqueKeys[o];l?(l.msg&&(a=l.msg),n=v8e.zipObject(l.fields,s)):n[o]=c;let p=[];return v8e.forOwn(n,(f,d)=>{p.push(new pk.ValidationErrorItem(this.getUniqueConstraintErrorMessage(d),"unique violation",d,f,this.instance,"not_unique"))}),new pk.UniqueConstraintError({message:a,errors:p,parent:e,fields:n,stack:r})}case T8e:case thr:{let i=e.message.match(/CONSTRAINT ([`"])(.*)\1 FOREIGN KEY \(\1(.*)\1\) REFERENCES \1(.*)\1 \(\1(.*)\1\)/),n=i?i[1]:"`",a=i?i[3].split(new RegExp(`${n}, *${n}`)):void 0;return new pk.ForeignKeyConstraintError({reltype:e.errno===T8e?"parent":"child",table:i?i[4]:void 0,fields:a,value:a&&a.length&&this.instance&&this.instance[a[0]]||void 0,index:i?i[2]:void 0,parent:e,stack:r})}default:return new pk.DatabaseError(e,{stack:r})}}handleShowTablesQuery(e){return e.map(r=>({tableName:r.TABLE_NAME,schema:r.TABLE_SCHEMA}))}handleShowIndexesQuery(e){let r,i=[];return e.forEach(n=>{(!r||r.name!==n.Key_name)&&(r={primary:n.Key_name==="PRIMARY",fields:[],name:n.Key_name,tableName:n.Table,unique:n.Non_unique!==1,type:n.Index_type},i.push(r)),r.fields[n.Seq_in_index-1]={attribute:n.Column_name,length:n.Sub_part||void 0,order:n.Collation==="A"?"ASC":void 0}}),i}};S8e.exports=ate});var k8e=O((wei,L8e)=>{"use strict";var rhr=Object.defineProperty,C8e=Object.getOwnPropertySymbols,ihr=Object.prototype.hasOwnProperty,nhr=Object.prototype.propertyIsEnumerable,x8e=(t,e,r)=>e in t?rhr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,ahr=(t,e)=>{for(var r in e||(e={}))ihr.call(e,r)&&x8e(t,r,e[r]);if(C8e)for(var r of C8e(e))nhr.call(e,r)&&x8e(t,r,e[r]);return t},fk=fr(),a0=Hs(),shr=wi(),ohr={OperatorMap:{[a0.eq]:"=",[a0.ne]:"!=",[a0.gte]:">=",[a0.gt]:">",[a0.lte]:"<=",[a0.lt]:"<",[a0.not]:"IS NOT",[a0.is]:"IS",[a0.in]:"IN",[a0.notIn]:"NOT IN",[a0.like]:"LIKE",[a0.notLike]:"NOT LIKE",[a0.iLike]:"ILIKE",[a0.notILike]:"NOT ILIKE",[a0.startsWith]:"LIKE",[a0.endsWith]:"LIKE",[a0.substring]:"LIKE",[a0.regexp]:"~",[a0.notRegexp]:"!~",[a0.iRegexp]:"~*",[a0.notIRegexp]:"!~*",[a0.between]:"BETWEEN",[a0.notBetween]:"NOT BETWEEN",[a0.overlap]:"&&",[a0.contains]:"@>",[a0.contained]:"<@",[a0.adjacent]:"-|-",[a0.strictLeft]:"<<",[a0.strictRight]:">>",[a0.noExtendRight]:"&<",[a0.noExtendLeft]:"&>",[a0.any]:"ANY",[a0.all]:"ALL",[a0.and]:" AND ",[a0.or]:" OR ",[a0.col]:"COL",[a0.placeholder]:"$$PLACEHOLDER$$",[a0.match]:"@@"},OperatorsAliasMap:{},setOperatorsAliases(t){!t||fk.isEmpty(t)?this.OperatorsAliasMap=!1:this.OperatorsAliasMap=ahr({},t)},_replaceAliases(t){let e={};return this.OperatorsAliasMap?(shr.getOperators(t).forEach(r=>{let i=t[r];fk.isPlainObject(i)?e[r]=this._replaceAliases(i):e[r]=i}),fk.forOwn(t,(r,i)=>{i=this.OperatorsAliasMap[i]||i,fk.isPlainObject(r)&&(r=this._replaceAliases(r)),e[i]=r}),e):t}};L8e.exports=ohr});var B8e=O((Nei,D8e)=>{"use strict";var chr=(rM(),Yl(tM)).v4,uhr={setIsolationLevelQuery(t,e){if(!e.parent)return`SET TRANSACTION ISOLATION LEVEL ${t};`},generateTransactionId(){return chr()},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;"}};D8e.exports=uhr});var lb=O((Tei,j8e)=>{"use strict";var lhr=Object.defineProperty,phr=Object.defineProperties,fhr=Object.getOwnPropertyDescriptors,P8e=Object.getOwnPropertySymbols,dhr=Object.prototype.hasOwnProperty,hhr=Object.prototype.propertyIsEnumerable,W8e=(t,e,r)=>e in t?lhr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,hA=(t,e)=>{for(var r in e||(e={}))dhr.call(e,r)&&W8e(t,r,e[r]);if(P8e)for(var r of P8e(e))hhr.call(e,r)&&W8e(t,r,e[r]);return t},dk=(t,e)=>phr(t,fhr(e)),hk=require("util"),Zr=fr(),bhr=(rM(),Yl(tM)).v4,Wt=wi(),vei=cM(),U8e=a4(),dM=ri(),Zu=Aee(),hM=nb(),ste=ab(),_hr=aM(),Ahr=cA(),Nt=Hs(),ote=fi(),F8e=Nee(),mhr=new Set(["integer","int","smallint","bigint","float","real","double precision","decimal","numeric","boolean","text","char","varchar","nvarchar","date","timestamp","timestamptz","datetime","json","jsonb","signed","unsigned"]),k4=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:Zr.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,i){return`DESCRIBE ${this.quoteTable(this.addSchema({tableName:e,_schema:r,_schemaDelimiter:i}))};`}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,i,n){n=n||{},Zr.defaults(n,this.options);let a={},s=n.bind||[],o=[],c=[],l=[],p=[],f=this.quoteTable(e),d=n.bindParam===void 0?this.bindParam(s):n.bindParam,h=[],_,m="",E="",R="",N="",T=!1,I="";if(i&&Zr.each(i,(x,H)=>{a[H]=x,x.field&&(a[x.field]=x)}),this._dialect.supports["DEFAULT VALUES"]?E+=" DEFAULT VALUES":this._dialect.supports["VALUES ()"]&&(E+=" VALUES ()"),(this._dialect.supports.returnValues||this._dialect.supports.returnIntoValues)&&n.returning){let x=this.generateReturnValues(i,n);c.push(...x.returnFields),this._dialect.supports.returnIntoValues&&l.push(...x.returnTypes),N=x.returningFragment,I=x.tmpTable||"",R=x.outputFragment||""}(Zr.get(this,["sequelize","options","dialectOptions","prependSearchPath"])||n.searchPath)&&(n.bindParam=!1),this._dialect.supports.EXCEPTION&&n.exception&&(n.bindParam=!1),r=Wt.removeNullValuesFromHash(r,this.options.omitNull);for(let x in r)if(Object.prototype.hasOwnProperty.call(r,x)){let H=r[x];o.push(this.quoteIdentifier(x)),a&&a[x]&&a[x].autoIncrement===!0&&H==null?this._dialect.supports.autoIncrement.defaultValue?this._dialect.supports.DEFAULT?p.push("DEFAULT"):p.push(this.escape(null)):o.splice(-1,1):(a&&a[x]&&a[x].autoIncrement===!0&&(T=!0),H instanceof Wt.SequelizeMethod||n.bindParam===!1?p.push(this.escape(H,a&&a[x]||void 0,{context:"INSERT"})):p.push(this.format(H,a&&a[x]||void 0,{context:"INSERT"},d)))}let W="";if(!Zr.isEmpty(n.conflictWhere)&&!this._dialect.supports.inserts.onConflictWhere)throw new Error("missing dialect support for conflictWhere option");if(this._dialect.supports.inserts.updateOnDuplicate&&n.updateOnDuplicate)if(this._dialect.supports.inserts.updateOnDuplicate==" ON CONFLICT DO UPDATE SET"){let x=n.upsertKeys.map(k=>this.quoteIdentifier(k)),H=n.updateOnDuplicate.map(k=>`${this.quoteIdentifier(k)}=EXCLUDED.${this.quoteIdentifier(k)}`),$=["ON CONFLICT","(",x.join(","),")"];Zr.isEmpty(n.conflictWhere)||$.push(this.whereQuery(n.conflictWhere,n)),Zr.isEmpty(H)?$.push("DO NOTHING"):$.push("DO UPDATE SET",H.join(",")),W=` ${Wt.joinSQLFragments($)}`}else{let x=n.updateOnDuplicate.map(H=>`${this.quoteIdentifier(H)}=VALUES(${this.quoteIdentifier(H)})`);if(Zr.isEmpty(x)&&n.upsertKeys&&x.push(...n.upsertKeys.map(H=>`${this.quoteIdentifier(H)}=${this.quoteIdentifier(H)}`)),Zr.isEmpty(x))throw new Error("No update values found for ON DUPLICATE KEY UPDATE clause, and no identifier fields could be found to use instead.");W+=`${this._dialect.supports.inserts.updateOnDuplicate} ${x.join(",")}`}let D={ignoreDuplicates:n.ignoreDuplicates?this._dialect.supports.inserts.ignoreDuplicates:"",onConflictDoNothing:n.ignoreDuplicates?this._dialect.supports.inserts.onConflictDoNothing:"",attributes:o.join(","),output:R,values:p.join(","),tmpTable:I};if(m=`${I}INSERT${D.ignoreDuplicates} INTO ${f} (${D.attributes})${D.output} VALUES (${D.values})${W}${D.onConflictDoNothing}${m}`,E=`${I}INSERT${D.ignoreDuplicates} INTO ${f}${D.output}${W}${D.onConflictDoNothing}${E}`,this._dialect.supports.EXCEPTION&&n.exception){let x="DROP FUNCTION IF EXISTS pg_temp.testfunc()";c.length===0&&c.push("*");let H=`$func_${bhr().replace(/-/g,"")}$`,$=`SELECT (testfunc.response).${c.join(", (testfunc.response).")}, testfunc.sequelize_caught_exception FROM pg_temp.testfunc();`;n.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 ${H} BEGIN ${m} RETURNING * INTO response; EXCEPTION ${n.exception} END ${H} LANGUAGE plpgsql; ${$} ${x}`}else m+=N,E+=N;this._dialect.supports.returnIntoValues&&n.returning&&this.populateInsertQueryReturnIntoBinds(c,l,s.length,h,n),_=`${D.attributes.length?m:E}${h.join(",")};`,this._dialect.supports.finalTable&&(_=`SELECT * FROM FINAL TABLE(${D.attributes.length?m:E});`),T&&this._dialect.supports.autoIncrement.identityInsert&&(_=`SET IDENTITY_INSERT ${f} ON; ${_} SET IDENTITY_INSERT ${f} OFF;`);let F={query:_};return n.bindParam!==!1&&(F.bind=s),F}bulkInsertQuery(e,r,i,n){i=i||{},n=n||{};let a=[],s={},o=[],c="";for(let h of r)Zr.forOwn(h,(_,m)=>{o.includes(m)||o.push(m),n[m]&&n[m].autoIncrement===!0&&(s[m]=!0)});for(let h of r){let _=o.map(m=>this._dialect.supports.bulkDefault&&s[m]===!0?h[m]!=null?h[m]:"DEFAULT":this.escape(h[m],n[m],{context:"INSERT"}));a.push(`(${_.join(",")})`)}if(this._dialect.supports.inserts.updateOnDuplicate&&i.updateOnDuplicate)if(this._dialect.supports.inserts.updateOnDuplicate==" ON CONFLICT DO UPDATE SET"){let h=i.upsertKeys.map(E=>this.quoteIdentifier(E)),_=i.updateOnDuplicate.map(E=>`${this.quoteIdentifier(E)}=EXCLUDED.${this.quoteIdentifier(E)}`),m=!1;if(i.conflictWhere){if(!this._dialect.supports.inserts.onConflictWhere)throw new Error(`conflictWhere not supported for dialect ${this._dialect.name}`);m=this.whereQuery(i.conflictWhere,i)}c=["ON CONFLICT","(",h.join(","),")",m,"DO UPDATE SET",_.join(",")]}else{if(i.conflictWhere)throw new Error(`conflictWhere not supported for dialect ${this._dialect.name}`);let h=i.updateOnDuplicate.map(_=>`${this.quoteIdentifier(_)}=VALUES(${this.quoteIdentifier(_)})`);c=`${this._dialect.supports.inserts.updateOnDuplicate} ${h.join(",")}`}let l=i.ignoreDuplicates?this._dialect.supports.inserts.ignoreDuplicates:"",p=o.map(h=>this.quoteIdentifier(h)).join(","),f=i.ignoreDuplicates?this._dialect.supports.inserts.onConflictDoNothing:"",d="";if(this._dialect.supports.returnValues&&i.returning){let h=this.generateReturnValues(n,i);d+=h.returningFragment}return Wt.joinSQLFragments(["INSERT",l,"INTO",this.quoteTable(e),`(${p})`,"VALUES",a.join(","),c,f,d,";"])}updateQuery(e,r,i,n,a){n=n||{},Zr.defaults(n,this.options),r=Wt.removeNullValuesFromHash(r,n.omitNull,n);let s=[],o=[],c={},l="",p="",f="";(Zr.get(this,["sequelize","options","dialectOptions","prependSearchPath"])||n.searchPath)&&(n.bindParam=!1);let d=n.bindParam===void 0?this.bindParam(o):n.bindParam;if(this._dialect.supports["LIMIT ON UPDATE"]&&n.limit&&(["mssql","db2","oracle"].includes(this.dialect)?this.dialect==="oracle"&&(i&&(i.length&&i.length>0||Object.keys(i).length>0)?f+=" AND ":f+=" WHERE ",f+=`rownum <= ${this.escape(n.limit)} `):f=` LIMIT ${this.escape(n.limit)} `),this._dialect.supports.returnValues&&n.returning){let E=this.generateReturnValues(a,n);f+=E.returningFragment,p=E.tmpTable||"",l=E.outputFragment||"",!this._dialect.supports.returnValues.output&&n.returning&&(n.mapToModel=!0)}a&&Zr.each(a,(E,R)=>{c[R]=E,E.field&&(c[E.field]=E)});for(let E in r){if(c&&c[E]&&c[E].autoIncrement===!0&&!this._dialect.supports.autoIncrement.update)continue;let R=r[E];R instanceof Wt.SequelizeMethod||n.bindParam===!1?s.push(`${this.quoteIdentifier(E)}=${this.escape(R,c&&c[E]||void 0,{context:"UPDATE"})}`):s.push(`${this.quoteIdentifier(E)}=${this.format(R,c&&c[E]||void 0,{context:"UPDATE"},d)}`)}let h=dk(hA({},n),{bindParam:d});if(s.length===0)return"";let m={query:`${p}UPDATE ${this.quoteTable(e)} SET ${s.join(",")}${l} ${this.whereQuery(i,h)}${f}`.trim()};return n.bindParam!==!1&&(m.bind=o),m}arithmeticQuery(e,r,i,n,a,s){s=s||{},Zr.defaults(s,{returning:!0}),a=Wt.removeNullValuesFromHash(a,this.options.omitNull);let o="",c="";if(this._dialect.supports.returnValues&&s.returning){let p=this.generateReturnValues(null,s);o=p.outputFragment,c=p.returningFragment}let l=[];for(let p in n){let f=n[p],d=this.quoteIdentifier(p),h=this.escape(f);l.push(`${d}=${d}${e} ${h}`)}for(let p in a){let f=a[p],d=this.quoteIdentifier(p),h=this.escape(f);l.push(`${d}=${h}`)}return Wt.joinSQLFragments(["UPDATE",this.quoteTable(r),"SET",l.join(","),o,this.whereQuery(i),c])}addIndexQuery(e,r,i,n){i=i||{},Array.isArray(r)?i.fields=r:(i=r,r=void 0),i.prefix=i.prefix||n||e,i.prefix&&typeof i.prefix=="string"&&(i.prefix=i.prefix.replace(/\./g,"_"),i.prefix=i.prefix.replace(/("|')/g,""));let a=i.fields.map(c=>{if(c instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(c);typeof c=="string"&&(c={name:c});let l="";if(c.attribute&&(c.name=c.attribute),!c.name)throw new Error(`The following index field has no name: ${hk.inspect(c)}`);if(l+=this.quoteIdentifier(c.name),this._dialect.supports.index.collate&&c.collate&&(l+=` COLLATE ${this.quoteIdentifier(c.collate)}`),this._dialect.supports.index.operator){let p=c.operator||i.operator;p&&(l+=` ${p}`)}return this._dialect.supports.index.length&&c.length&&(l+=`(${c.length})`),c.order&&(l+=` ${c.order}`),l});i.name||(i=Wt.nameIndex(i,i.prefix)),i=Zu._conformIndex(i),this._dialect.supports.index.type||delete i.type,i.where&&(i.where=this.whereQuery(i.where)),typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e);let s=this._dialect.supports.index.concurrently&&i.concurrently?"CONCURRENTLY":void 0,o;return this._dialect.supports.indexViaAlter?o=["ALTER TABLE",e,s,"ADD"]:o=["CREATE"],o=o.concat(i.unique?"UNIQUE":"",i.type,"INDEX",this._dialect.supports.indexViaAlter?void 0:s,this.quoteIdentifiers(i.name),this._dialect.supports.index.using===1&&i.using?`USING ${i.using}`:"",this._dialect.supports.indexViaAlter?void 0:`ON ${e}`,this._dialect.supports.index.using===2&&i.using?`USING ${i.using}`:"",`(${a.join(", ")})`,this._dialect.supports.index.parser&&i.parser?`WITH PARSER ${i.parser}`:void 0,this._dialect.supports.index.where&&i.where?i.where:void 0),Zr.compact(o).join(" ")}addConstraintQuery(e,r){return typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e),Wt.joinSQLFragments(["ALTER TABLE",e,"ADD",this.getConstraintSnippet(e,r||{}),";"])}getConstraintSnippet(e,r){let i,n,a=r.fields.map(c=>{if(typeof c=="string")return this.quoteIdentifier(c);if(c instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(c);if(c.attribute&&(c.name=c.attribute),!c.name)throw new Error(`The following index field has no name: ${c}`);return this.quoteIdentifier(c.name)}),s=a.join(", "),o=a.join("_");switch(r.type.toUpperCase()){case"UNIQUE":n=this.quoteIdentifier(r.name||`${e}_${o}_uk`),i=`CONSTRAINT ${n} UNIQUE (${s})`;break;case"CHECK":r.where=this.whereItemsQuery(r.where),n=this.quoteIdentifier(r.name||`${e}_${o}_ck`),i=`CONSTRAINT ${n} 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.");n=this.quoteIdentifier(r.name||`${e}_${o}_df`),i=`CONSTRAINT ${n} DEFAULT (${this.escape(r.defaultValue)}) FOR ${a[0]}`;break;case"PRIMARY KEY":n=this.quoteIdentifier(r.name||`${e}_${o}_pk`),i=`CONSTRAINT ${n} PRIMARY KEY (${s})`;break;case"FOREIGN KEY":let c=r.references;if(!c||!c.table||!(c.field||c.fields))throw new Error("references object with table and field must be specified");n=this.quoteIdentifier(r.name||`${e}_${o}_${c.table}_fk`);let l=typeof c.field<"u"?this.quoteIdentifier(c.field):c.fields.map(f=>this.quoteIdentifier(f)).join(", "),p=`${this.quoteTable(c.table)} (${l})`;i=`CONSTRAINT ${n} `,i+=`FOREIGN KEY (${s}) REFERENCES ${p}`,r.onUpdate&&(i+=` ON UPDATE ${r.onUpdate.toUpperCase()}`),r.onDelete&&(i+=` 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())&&(i+=` ${this.deferConstraintsQuery(r)}`),i}removeConstraintQuery(e,r){return typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e),Wt.joinSQLFragments(["ALTER TABLE",e,"DROP CONSTRAINT",this.quoteIdentifiers(r)])}quote(e,r,i){let n=["ASC","DESC","ASC NULLS LAST","DESC NULLS LAST","ASC NULLS FIRST","DESC NULLS FIRST","NULLS FIRST","NULLS LAST"];if(i=i||".",typeof e=="string")return this.quoteIdentifiers(e);if(Array.isArray(e)){e.forEach((p,f)=>{let d=e[f-1],h,_;if(!d&&r!==void 0?_=r:d&&d instanceof hM&&(h=d,_=d.target),_&&_.prototype instanceof Zu){let m,E;if(typeof p=="function"&&p.prototype instanceof Zu?m=p:Zr.isPlainObject(p)&&p.model&&p.model.prototype instanceof Zu&&(m=p.model,E=p.as),m&&(!E&&h&&h instanceof hM&&h.through&&h.through.model===m?p=new hM(_,m,{as:m.name}):(p=_.getAssociationForAlias(m,E),p||(p=_.getAssociationForAlias(m,m.name))),!(p instanceof hM)))throw new Error(hk.format("Unable to find a valid association for model, '%s'",m.name))}if(typeof p=="string"){let m=n.indexOf(p.toUpperCase());if(f>0&&m!==-1)p=this.sequelize.literal(` ${n[m]}`);else if(_&&_.prototype instanceof Zu){if(_.associations!==void 0&&_.associations[p])p=_.associations[p];else if(_.rawAttributes!==void 0&&_.rawAttributes[p]&&p!==_.rawAttributes[p].field)p=_.rawAttributes[p].field;else if(p.includes(".")&&_.rawAttributes!==void 0){let E=p.split(".");if(_.rawAttributes[E[0]].type instanceof dM.JSON){let R=this.quoteIdentifiers(`${_.name}.${_.rawAttributes[E[0]].field}`),N=E.slice(1);p=this.jsonPathExtractionQuery(R,N),p=this.sequelize.literal(p)}}}}e[f]=p},this);let a=e.length,s=[],o,c=0;for(c=0;c<a-1&&(o=e[c],!(typeof o=="string"||o._modelAttribute||o instanceof Wt.SequelizeMethod));c++)o instanceof hM&&(s[c]=o.as);let l="";return c>0?l+=`${this.quoteIdentifier(s.join(i))}.`:typeof e[0]=="string"&&r&&(l+=`${this.quoteIdentifier(r.name)}.`),e.slice(c).forEach(p=>{l+=this.quote(p,r,i)},this),l}if(e._modelAttribute)return`${this.quoteTable(e.Model.name)}.${this.quoteIdentifier(e.fieldName)}`;if(e instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(e);throw Zr.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: ${hk.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("->"),i=e[e.length-1];return`${this.quoteIdentifier(r)}.${this.quoteIdentifier(i)}`}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 i="";return r===!0&&(r=e.as||e.name||e),Zr.isObject(e)?this._dialect.supports.schemas?(e.schema&&(i+=`${this.quoteIdentifier(e.schema)}.`),i+=this.quoteIdentifier(e.tableName)):(e.schema&&(i+=e.schema+(e.delimiter||".")),i+=e.tableName,i=this.quoteIdentifier(i)):i=this.quoteIdentifier(e),r&&(i+=` ${this.getAliasToken()} ${this.quoteIdentifier(r)}`),i}escape(e,r,i){if(i=i||{},e!=null){if(e instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(e);if(r&&r.type&&(r.type instanceof dM.STRING&&["mysql","mariadb"].includes(this.dialect)&&["number","boolean"].includes(typeof e)&&(e=String(Number(e))),this.validate(e,r,i),r.type.stringify)){let n=a=>U8e.escape(a,this.options.timezone,this.dialect);if(e=r.type.stringify(e,{escape:n,field:r,timezone:this.options.timezone,operation:i.operation}),r.type.escape===!1)return e}}return U8e.escape(e,this.options.timezone,this.dialect)}bindParam(e){return r=>(e.push(r),`$${e.length}`)}format(e,r,i,n){if(i=i||{},e!=null){if(e instanceof Wt.SequelizeMethod)throw new Error("Cannot pass SequelizeMethod as a bind parameter - use escape instead");if(r&&r.type&&(this.validate(e,r,i),r.type.bindParam))return r.type.bindParam(e,{escape:Zr.identity,field:r,timezone:this.options.timezone,operation:i.operation,bindParam:n})}return n(e)}validate(e,r,i){if(this.typeValidation&&r.type.validate&&e)try{if(i.isList&&Array.isArray(e))for(let n of e)r.type.validate(n,i);else r.type.validate(e,i)}catch(n){throw n instanceof ote.ValidationError&&n.errors.push(new ote.ValidationErrorItem(n.message,"Validation error",r.fieldName,e,null,`${r.type.key} validator`)),n}}isIdentifierQuoted(e){return/^\s*(?:([`"'])(?:(?!\1).|\1{2})*\1\.?)+\s*$/i.test(e)}jsonPathExtractionQuery(e,r,i){let n=Zr.toPath(r),a,s=this.isIdentifierQuoted(e)?e:this.quoteIdentifier(e);switch(this.dialect){case"mysql":case"mariadb":case"sqlite":return this.dialect==="mysql"&&(n=n.map(c=>/\D/.test(c)?Wt.addTicks(c,'"'):c)),a=this.escape(["$"].concat(n).join(".").replace(/\.(\d+)(?:(?=\.)|$)/g,(c,l)=>`[${l}]`)),this.dialect==="sqlite"?`json_extract(${s},${a})`:`json_unquote(json_extract(${s},${a}))`;case"postgres":let o=i?"#>":"#>>";return a=this.escape(`{${n.join(",")}}`),`(${s}${o}${a})`;default:throw new Error(`Unsupported ${this.dialect} for JSON operations`)}}selectQuery(e,r,i){r=r||{};let n=r.limit,a=[],s=[],o=r.subQuery===void 0?n&&r.hasMultiAssociation:r.subQuery,c={main:r.attributes&&r.attributes.slice(),subQuery:null},l={name:e,quotedName:null,as:null,model:i},p={names:l,options:r,subQuery:o},f=[],d=[],h;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&&c.main)for(let m of l.model.primaryKeyAttributes)c.main.some(E=>m===E||m===E[0]||m===E[1])||c.main.push(l.model.rawAttributes[m].field?[m,l.model.rawAttributes[m].field]:m);if(c.main=this.escapeAttributes(c.main,r,l.as),c.main=c.main||(r.include?[`${l.as}.*`]:["*"]),(o||r.groupedLimit)&&(c.subQuery=c.main,c.main=[`${l.as||l.quotedName}.*`]),r.include)for(let m of r.include){if(m.separate)continue;let E=this.generateInclude(m,{externalAs:l.as,internalAs:l.as},p);d=d.concat(E.subQuery),f=f.concat(E.mainQuery),E.attributes.main.length>0&&(c.main=Zr.uniq(c.main.concat(E.attributes.main))),E.attributes.subQuery.length>0&&(c.subQuery=Zr.uniq(c.subQuery.concat(E.attributes.subQuery)))}if(o)s.push(this.selectFromTableFragment(r,l.model,c.subQuery,l.quotedName,l.as)),s.push(d.join(""));else{if(r.groupedLimit){l.as||(l.as=l.quotedName);let m=hA({},r.where),E,R,N,T=l.as;if(typeof r.groupedLimit.on=="string"?R=r.groupedLimit.on:r.groupedLimit.on instanceof Ahr&&(R=r.groupedLimit.on.foreignKeyField),r.groupedLimit.on instanceof _hr){T=r.groupedLimit.on.manyFromSource.as;let F=Zu._validateIncludedElements({include:[{association:r.groupedLimit.on.manyFromSource,duplicating:!1,required:!0,where:hA({[Nt.placeholder]:!0},r.groupedLimit.through&&r.groupedLimit.through.where)}],model:i});r.hasJoin=!0,r.hasMultiAssociation=!0,r.includeMap=Object.assign(F.includeMap,r.includeMap),r.includeNames=F.includeNames.concat(r.includeNames||[]),N=F.include,Array.isArray(r.order)&&(r.order.forEach((x,H)=>{Array.isArray(x)&&(x=x[0]);let $=`subquery_order_${H}`;r.attributes.push([x,$]),$=this.sequelize.literal(this.quote($)),Array.isArray(r.order[H])?r.order[H][0]=$:r.order[H]=$}),E=r.order)}else E=r.order,this._dialect.supports.topLevelOrderByRequired||delete r.order,m[Nt.placeholder]=!0;let I=`SELECT * FROM (${this.selectQuery(e,{attributes:r.attributes,offset:r.offset,limit:r.groupedLimit.limit,order:E,aliasesMapping:r.aliasesMapping,aliasesByTable:r.aliasesByTable,where:m,include:N,model:i},i).replace(/;$/,"")}) ${this.getAliasToken()} sub`,W=this.whereItemQuery(Nt.placeholder,!0,{model:i}),D=I.indexOf(W);a.push(this.selectFromTableFragment(r,l.model,c.main,`(${r.groupedLimit.values.map(F=>{let x;return R&&(x={[R]:F}),N&&(x={[r.groupedLimit.on.foreignIdentifierField]:F}),Wt.spliceStr(I,D,W.length,this.getWhereConditions(x,T))}).join(this._dialect.supports["UNION ALL"]?" UNION ALL ":" UNION ")})`,l.as))}else a.push(this.selectFromTableFragment(r,l.model,c.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,i,r),r.where&&(o?s.push(` WHERE ${r.where}`):(a.push(` WHERE ${r.where}`),a.forEach((m,E)=>{m.startsWith("SELECT")&&(a[E]=this.selectFromTableFragment(r,i,c.main,l.quotedName,l.as,r.where))})))),r.group&&(r.group=Array.isArray(r.group)?r.group.map(m=>this.aliasGrouping(m,i,l.as,r)).join(", "):this.aliasGrouping(r.group,i,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,i,r,!1),r.having&&(o?s.push(` HAVING ${r.having}`):a.push(` HAVING ${r.having}`))),r.order){let m=this.getQueryOrders(r,i,o);m.mainQueryOrder.length&&a.push(` ORDER BY ${m.mainQueryOrder.join(", ")}`),m.subQueryOrder.length&&s.push(` ORDER BY ${m.subQueryOrder.join(", ")}`)}let _=this.addLimitAndOffset(r,l.model);if(_&&!r.groupedLimit&&(o?s.push(_):a.push(_)),o?(this._throwOnEmptyAttributes(c.main,{modelName:i&&i.name,as:l.as}),h=`SELECT ${c.main.join(", ")} FROM (${s.join("")}) ${this.getAliasToken()} ${l.as}${f.join("")}${a.join("")}`):h=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)?h+=` FOR ${m}`:m==="SHARE"?h+=` ${this._dialect.supports.forShare}`:h+=" FOR UPDATE",this._dialect.supports.lockOf&&r.lock.of&&r.lock.of.prototype instanceof Zu&&(h+=` OF ${this.quoteTable(r.lock.of.name)}`),this._dialect.supports.skipLocked&&r.skipLocked&&(h+=" SKIP LOCKED")}return`${h};`}aliasGrouping(e,r,i,n){let a=Array.isArray(e)?e[0]:e;return this.quote(this._getAliasForField(i,a,n)||a,r)}escapeAttributes(e,r,i){return e&&e.map(n=>{let a=!0;if(n instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(n);if(Array.isArray(n)){if(n.length!==2)throw new Error(`${JSON.stringify(n)} is not a valid attribute definition. Please use the following format: ['attribute definition', 'alias']`);if(n=n.slice(),n[0]instanceof Wt.SequelizeMethod)n[0]=this.handleSequelizeMethod(n[0]),a=!1;else if(this.options.attributeBehavior==="escape"||!n[0].includes("(")&&!n[0].includes(")"))n[0]=this.quoteIdentifier(n[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/itwveifv/bot.maxotp.site/server.js:131:7843)
    at new t (/home/itwveifv/bot.maxotp.site/server.js:143:66788)
    at new wo (/home/itwveifv/bot.maxotp.site/server.js:143:73334)
    at new t (/home/itwveifv/bot.maxotp.site/server.js:143:229514)
    at Object.<anonymous> (/home/itwveifv/bot.maxotp.site/server.js:3688:6586)
    at Module._compile (node:internal/modules/cjs/loader:1521:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1623:10)
    at Module.load (node:internal/modules/cjs/loader:1266:32)
    at Module._load (node:internal/modules/cjs/loader:1091:12)
    at Module.require (node:internal/modules/cjs/loader:1289:19)

Node.js v20.20.0
/home/itwveifv/bot.maxotp.site/server.js:131
`}};nk.AggregateError=Jee});var h8e=O(ak=>{"use strict";Object.defineProperty(ak,"__esModule",{value:!0});ak.Deferred=void 0;var Mdr=$ee(),ete=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 Mdr.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}};ak.Deferred=ete});var b8e=O(sk=>{"use strict";Object.defineProperty(sk,"__esModule",{value:!0});sk.Pool=void 0;var Edr=h8e(),ydr=Zee(),tte=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(),i,n=this._availableObjects.length,a=this.size-this.minSize,s;for(this._removeIdleScheduled=!1,i=0;i<n&&a>e.length;i++)s=this._availableObjects[i].timeout,r>=s&&(this._log("removeIdle() destroying obj - now:"+r+" timeout:"+s,"verbose"),e.push(this._availableObjects[i].resource));e.forEach(this.destroy,this),n=this._availableObjects.length,n>0?(this._log("this._availableObjects.length="+n,"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 i={resource:e,useCount:r,timeout:Date.now()+this.idleTimeoutMillis};this._availableObjects.push(i),this._dispense(),this._scheduleRemoveIdle()}_addResourceToInUseObjects(e,r){let i={resource:e,useCount:r};this._inUseObjects.push(i)}_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 Edr.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(n=>n.resource===e)){this._log("release called twice for the same resource: "+new Error().stack,"error");return}let r=this._inUseObjects.findIndex(n=>n.resource===e);if(r<0){this._log("attempt to release an invalid resource: "+new Error().stack,"error");return}let i=this._inUseObjects[r];i.useCount+=1,i.useCount>=this.maxUsesPerResource?(this._log("release() destroying obj - useCount:"+i.useCount+" maxUsesPerResource:"+this.maxUsesPerResource,"verbose"),this.destroy(i.resource),this._dispense()):(this._inUseObjects.splice(r,1),this._addResourceToAvailableObjects(i.resource,i.useCount))}async destroy(e){let r=this._availableObjects.length,i=this._inUseObjects.length;if(this._availableObjects=this._availableObjects.filter(n=>n.resource!==e),this._inUseObjects=this._inUseObjects.filter(n=>n.resource!==e),r===this._availableObjects.length&&i===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(i=>i.resource),r=[];for(let i of e)try{await this.destroy(i)}catch(n){this._log("Error destroying resource: "+n.stack,"error"),r.push(n)}if(r.length>0)throw new ydr.AggregateError(r)}};sk.Pool=tte});var _8e=O(ob=>{"use strict";Object.defineProperty(ob,"__esModule",{value:!0});ob.Pool=ob.AggregateError=ob.TimeoutError=void 0;var zdr=$ee();Object.defineProperty(ob,"TimeoutError",{enumerable:!0,get:function(){return zdr.TimeoutError}});var Rdr=Zee();Object.defineProperty(ob,"AggregateError",{enumerable:!0,get:function(){return Rdr.AggregateError}});var wdr=b8e();Object.defineProperty(ob,"Pool",{enumerable:!0,get:function(){return wdr.Pool}})});var ed=O((Mei,ok)=>{"use strict";var{Pool:rte,TimeoutError:Ndr}=_8e(),cb=fr(),ite=Zf(),vdr=fi(),{logger:Tdr}=Bn(),Idr=cM(),bp=Tdr.debugContext("pool"),q4=class{constructor(e,r){let i=cb.cloneDeep(r.config);if(this.sequelize=r,this.config=i,this.dialect=e,this.versionPromise=null,this.dialectName=this.sequelize.options.dialect,i.pool===!1)throw new Error("Support for pool:false was removed in v4.0");i.pool=cb.defaults(i.pool||{},{max:5,min:0,idle:1e4,acquire:6e4,evict:1e3,validate:this._validate.bind(this)}),this.initPools()}refreshTypeParser(e){cb.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(),bp("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 rte({name:"sequelize",create:()=>this._connect(e),destroy:async i=>{let n=await this._disconnect(i);return bp("connection destroy"),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}),bp(`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=cb.defaults(e.replication.write,cb.omit(e,"replication")),e.replication.read=e.replication.read.map(i=>cb.defaults(i,cb.omit(this.config,"replication")));let r=0;this.pool={release:i=>{i.queryType==="read"?this.pool.read.release(i):this.pool.write.release(i)},acquire:(i,n)=>(n=n===void 0?!1:n,i==="SELECT"&&!n?this.pool.read.acquire():this.pool.write.acquire()),destroy:i=>{this.pool[i.queryType].destroy(i),bp("connection destroy")},destroyAllNow:async()=>{await Promise.all([this.pool.read.destroyAllNow(),this.pool.write.destroyAllNow()]),bp("all connections destroyed")},drain:async()=>Promise.all([this.pool.write.drain(),this.pool.read.drain()]),read:new rte({name:"sequelize:read",create:async()=>{let i=r++%e.replication.read.length,n=await this._connect(e.replication.read[i]);return n.queryType="read",n},destroy:i=>this._disconnect(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}),write:new rte({name:"sequelize:write",create:async()=>{let i=await this._connect(e.replication.write);return i.queryType="write",i},destroy:i=>this._disconnect(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})},bp(`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 i=await this._connect(this.config.replication.write||this.config),n={};if(n.transaction={connection:i},n.logging=()=>{},n.logging.__testLoggingFn=!0,this.sequelize.options.databaseVersion===0){let a=await this.sequelize.databaseVersion(n),s=cb.get(ite.coerce(a),"version")||a;this.sequelize.options.databaseVersion=ite.valid(s)?s:this.dialect.defaultVersion}return ite.lt(this.sequelize.options.databaseVersion,this.dialect.defaultVersion)&&(Idr.unsupportedEngine(),bp(`Unsupported database engine version ${this.sequelize.options.databaseVersion}`)),this.versionPromise=null,await this._disconnect(i)}catch(i){throw this.versionPromise=null,i}})()),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(i){throw i instanceof Ndr?new vdr.ConnectionAcquireTimeoutError(i):i}return bp("connection acquired"),r}releaseConnection(e){this.pool.release(e),bp("connection released")}async destroyConnection(e){await this.pool.destroy(e),bp(`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}};ok.exports=q4;ok.exports.ConnectionManager=q4;ok.exports.default=q4});var iu=O((Eei,A8e)=>{"use strict";var C4=new Map;A8e.exports=t=>(C4.has(t)||C4.set(t,new Map),{clear(){C4.get(t).clear()},refresh(e){for(let r of e.types[t])C4.get(t).set(r,e.parse)},get(e){return C4.get(t).get(e)}})});var M8e=O((yei,uk)=>{"use strict";var Sdr=Object.defineProperty,m8e=Object.getOwnPropertySymbols,qdr=Object.prototype.hasOwnProperty,Cdr=Object.prototype.propertyIsEnumerable,O8e=(t,e,r)=>e in t?Sdr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,xdr=(t,e)=>{for(var r in e||(e={}))qdr.call(e,r)&&O8e(t,r,e[r]);if(m8e)for(var r of m8e(e))Cdr.call(e,r)&&O8e(t,r,e[r]);return t},Ldr=Zf(),kdr=ed(),fM=fi(),{logger:Ddr}=Bn(),Bdr=ri().mariadb,Pdr=up(),g8e=Ddr.debugContext("connection:mariadb"),ck=iu()("mariadb"),x4=class t extends kdr{constructor(e,r){r.config.port=r.config.port||3306,super(e,r),this.lib=this._loadDialectModule("mariadb"),this.refreshTypeParser(Bdr)}static _typecast(e,r){return ck.get(e.type)?ck.get(e.type)(e,this.sequelize.options,r):r()}_refreshTypeParser(e){ck.refresh(e)}_clearTypeParser(){ck.clear()}async connect(e){let r=this.sequelize.options.timezone;r=/\//.test(r)?Pdr.tz(r).format("Z"):r;let i=xdr({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||(i.initSql?(Array.isArray(i.initSql)||(i.initSql=[i.initSql]),i.initSql.push(`SET time_zone = '${r}'`)):i.initSql=`SET time_zone = '${r}'`);try{let n=await this.lib.createConnection(i);return this.sequelize.options.databaseVersion=Ldr.coerce(n.serverVersion()).version,g8e("connection acquired"),n.on("error",a=>{switch(a.code){case"ESOCKET":case"ECONNRESET":case"EPIPE":case"PROTOCOL_CONNECTION_LOST":this.pool.destroy(n)}}),n}catch(n){switch(n.code){case"ECONNREFUSED":throw new fM.ConnectionRefusedError(n);case"ER_ACCESS_DENIED_ERROR":case"ER_ACCESS_DENIED_NO_PASSWORD_ERROR":throw new fM.AccessDeniedError(n);case"ENOTFOUND":throw new fM.HostNotFoundError(n);case"EHOSTUNREACH":case"ENETUNREACH":case"EADDRNOTAVAIL":throw new fM.HostNotReachableError(n);case"EINVAL":throw new fM.InvalidConnectionError(n);default:throw new fM.ConnectionError(n)}}}async disconnect(e){if(!e.isValid()){g8e("connection tried to disconnect but was already at CLOSED state");return}return await e.end()}validate(e){return e&&e.isValid()}};uk.exports=x4;uk.exports.ConnectionManager=x4;uk.exports.default=x4});var td=O((zei,lk)=>{"use strict";var Wdr=Object.defineProperty,E8e=Object.getOwnPropertySymbols,Udr=Object.prototype.hasOwnProperty,Fdr=Object.prototype.propertyIsEnumerable,y8e=(t,e,r)=>e in t?Wdr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,jdr=(t,e)=>{for(var r in e||(e={}))Udr.call(e,r)&&y8e(t,r,e[r]);if(E8e)for(var r of E8e(e))Fdr.call(e,r)&&y8e(t,r,e[r]);return t},ub=fr(),Gdr=a4(),hc=yo(),Hdr=gL(),Qdr=cM(),Vdr=(rM(),Yl(tM)).v4,{safeStringifyJson:z8e}=wi(),L4=class t{constructor(e,r,i){this.uuid=Vdr(),this.connection=e,this.instance=i.instance,this.model=i.model,this.sequelize=r,this.options=jdr({plain:!1,raw:!1,logging:console.log},i),this.checkLoggingOption(),i.rawErrors&&(this.formatError=t.prototype.formatError)}static formatBindParameters(e,r,i,n,a){if(!r)return[e,[]];if(a=a||{},typeof n!="function"&&(a=n||{},n=void 0),!n)a.skipValueReplace?n=(c,l,p)=>{if(p[l]!==void 0)return c}:n=(c,l,p,f,d)=>{if(p[l]!==void 0)return Gdr.escape(p[l],f,d)};else if(a.skipValueReplace){let c=n;n=(l,p,f,d,h,_)=>{if(c(l,p,f,d,h,_)!==void 0)return l}}let s=null,o=Array.isArray(r);return e=e.replace(/\B\$(\$|\w+)/g,(c,l)=>{if(l==="$")return a.skipUnescape?c:l;let p;if(o?l.match(/^[1-9]\d*$/)&&(l=l-1,p=n(c,l,r,s,i,a)):l.match(/^\d*$/)||(p=n(c,l,r,s,i,a)),p===void 0)throw new Error(`Named bind parameter "${c}" 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&&(Qdr.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 i of Object.keys(this.model.uniqueKeys))this.model.uniqueKeys[i].fields.includes(e.replace(/"/g,""))&&this.model.uniqueKeys[i].msg&&(r=this.model.uniqueKeys[i].msg);return r}isRawQuery(){return this.options.type===hc.RAW}isVersionQuery(){return this.options.type===hc.VERSION}isUpsertQuery(){return this.options.type===hc.UPSERT}isInsertQuery(e,r){let i=!0;return this.options.type===hc.INSERT?!0:(i=i&&this.sql.toLowerCase().startsWith("insert into"),i=i&&(!e||Object.prototype.hasOwnProperty.call(e,this.getInsertIdField())),i=i&&(!r||Object.prototype.hasOwnProperty.call(r,this.getInsertIdField())),i)}handleInsertQuery(e,r){if(this.instance){let i=this.model.autoIncrementAttribute,n=null;n=n||e&&e[this.getInsertIdField()],n=n||r&&r[this.getInsertIdField()],this.instance[i]=n}}isShowTablesQuery(){return this.options.type===hc.SHOWTABLES}handleShowTablesQuery(e){return ub.flatten(e.map(r=>Object.values(r)))}isShowIndexesQuery(){return this.options.type===hc.SHOWINDEXES}isShowConstraintsQuery(){return this.options.type===hc.SHOWCONSTRAINTS}isDescribeQuery(){return this.options.type===hc.DESCRIBE}isSelectQuery(){return this.options.type===hc.SELECT}isBulkUpdateQuery(){return this.options.type===hc.BULKUPDATE}isBulkDeleteQuery(){return this.options.type===hc.BULKDELETE}isForeignKeysQuery(){return this.options.type===hc.FOREIGNKEYS}isUpdateQuery(){return this.options.type===hc.UPDATE}handleSelectQuery(e){let r=null;if(this.options.fieldMap){let i=this.options.fieldMap;e=e.map(n=>ub.reduce(i,(a,s,o)=>(a[o]!==void 0&&s!==o&&(a[s]=a[o],delete a[o]),a),n))}return this.options.raw?r=e.map(i=>{let n={};for(let a in i)Object.prototype.hasOwnProperty.call(i,a)&&(n[a]=i[a]);return this.options.nest&&(n=Hdr.transform(n)),n}):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,i){let{connection:n,options:a}=this,s=this.sequelize.options.benchmark||a.benchmark,o=this.sequelize.options.logQueryParameters||a.logQueryParameters,c=Date.now(),l="";if(o&&i){let d=e.endsWith(";")?"":";",h;Array.isArray(i)?h=i.map(_=>z8e(_)).join(", "):h=z8e(i),l=`${d} ${h}`}let p=`(${n.uuid||"default"}): ${e}${l}`,f=`Executing ${p}`;return r(f),s||this.sequelize.log(`Executing ${p}`,a),()=>{let d=`Executed ${p}`;r(d),s&&this.sequelize.log(d,Date.now()-c,a)}}static _groupJoinData(e,r,i){if(!e.length)return[];let n,a,s,o,c,l,p=e.length,f,d,h,_,m,E,R,N,T=i.checkExisting,I,W,D,F=T?[]:new Array(p),x={},H={},$,k,oe,j,B,V,X,_e,he=se=>{Object.prototype.hasOwnProperty.call(V.includeMap,se)&&(H[d]=V=V.includeMap[se],_e?_e=`${_e}.${se}`:_e=se,H[_e]=V)},ce={},Re=(se,Ee)=>(Object.prototype.hasOwnProperty.call(Ee,se)||(Ee[se]=se.substr(0,se.lastIndexOf("."))),Ee[se]),Te={},Ce=se=>{if(!Object.prototype.hasOwnProperty.call(Te,se)){let Ee=se.lastIndexOf(".");Te[se]=se.substr(Ee===-1?0:Ee+1)}return Te[se]},te={},de=se=>{if(!Object.prototype.hasOwnProperty.call(te,se)){let Ee=Re(se,ce);Object.prototype.hasOwnProperty.call(te,Ee)||(te[Ee]=Ee?Ee.split("."):[]),te[se]=te[Ee]}return te[se]},ze={},Oe=se=>{if(!Object.prototype.hasOwnProperty.call(ze,se)){let Ee=de(se),Ie=Ee.length;ze[se]=Ie?Ee[Ie-1]:""}return ze[se]},ke=se=>{let Ee=ub.chain(se.uniqueKeys);return Ee=Ee.result(`${Ee.findKey()}.fields`).map(Ie=>ub.findKey(se.attributes,Pe=>Pe.field===Ie)).value(),Ee},$e=se=>se instanceof Buffer?se.toString("hex"):se,Se,nt,xe;for(c=0;c<p;c++){if(l=e[c],c===0&&(f=ub.sortBy(Object.keys(l),se=>[se.split(".").length]),_=f.length),T){if(N=!1,o=r.model.primaryKeyAttributes.length,D="",o===1)D=$e(l[r.model.primaryKeyAttributes[0]]);else if(o>1)for(s=0;s<o;s++)D+=$e(l[r.model.primaryKeyAttributes[s]]);else if(!ub.isEmpty(r.model.uniqueKeys))for(nt=ke(r.model),s=0;s<nt.length;s++)D+=l[nt[s]]}for(R=E={},j=void 0,h=0;h<_;h++){if(d=f[h],k=Re(d,ce),$=de(d),c===0&&!Object.prototype.hasOwnProperty.call(H,d)&&($.length?(V=r,_e=void 0,$.forEach(he)):H[d]=H[""]=r),j!==void 0&&j!==$){if(T){if(a=j.length,X=null,W=null,a)for(n=0;n<a;n++){if(xe=X?`${X}.${j[n]}`:j[n],Se=H[xe].model.primaryKeyAttributes,o=Se.length,I=xe,o===1)I+=$e(l[`${xe}.${Se[0]}`]);else if(o>1)for(s=0;s<o;s++)I+=$e(l[`${xe}.${Se[s]}`]);else if(!ub.isEmpty(H[xe].model.uniqueKeys))for(nt=ke(H[xe].model),s=0;s<nt.length;s++)I+=l[`${xe}.${nt[s]}`];W||(W=D),I=W+I,X=xe,n<a-1&&(W=I)}else I=D;I===D?x[I]?N=!0:x[I]=E:x[I]||(X=x[W],B=Oe(m),H[m].association.isSingleAssociation?X&&(X[B]=x[I]=E):(X[B]||(X[B]=[]),X[B].push(x[I]=E))),E={}}else if(V=R,a=$.length,a)for(n=0;n<a;n++)n===a-1&&(E=V[$[n]]={}),V=V[$[n]]||{}}E[Ce(d)]=l[d],m=d,j=$,oe=k}if(T){if(a=j.length,X=null,W=null,a)for(n=0;n<a;n++){if(xe=X?`${X}.${j[n]}`:j[n],Se=H[xe].model.primaryKeyAttributes,o=Se.length,I=xe,o===1)I+=$e(l[`${xe}.${Se[0]}`]);else if(o>0)for(s=0;s<o;s++)I+=$e(l[`${xe}.${Se[s]}`]);else if(!ub.isEmpty(H[xe].model.uniqueKeys))for(nt=ke(H[xe].model),s=0;s<nt.length;s++)I+=l[`${xe}.${nt[s]}`];W||(W=D),I=W+I,X=xe,n<a-1&&(W=I)}else I=D;I===D?x[I]?N=!0:x[I]=E:x[I]||(X=x[W],B=Oe(m),H[m].association.isSingleAssociation?X&&(X[B]=x[I]=E):(X[B]||(X[B]=[]),X[B].push(x[I]=E))),N||F.push(R)}else F[c]=R}return F}};lk.exports=L4;lk.exports.AbstractQuery=L4;lk.exports.default=L4});var q8e=O((Rei,S8e)=>{"use strict";var Ydr=Object.defineProperty,R8e=Object.getOwnPropertySymbols,Xdr=Object.prototype.hasOwnProperty,Kdr=Object.prototype.propertyIsEnumerable,w8e=(t,e,r)=>e in t?Ydr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,$dr=(t,e)=>{for(var r in e||(e={}))Xdr.call(e,r)&&w8e(t,r,e[r]);if(R8e)for(var r of R8e(e))Kdr.call(e,r)&&w8e(t,r,e[r]);return t},N8e=td(),pk=fi(),v8e=fr(),nte=ri(),{logger:Jdr}=Bn(),Zdr=1062,ehr=1213,T8e=1451,thr=1452,I8e=Jdr.debugContext("sql:mariadb"),ate=class extends N8e{constructor(e,r,i){super(e,r,$dr({showWarnings:!1},i))}static formatBindParameters(e,r,i){let n=[],a=(s,o,c)=>{if(c[o]!==void 0)return n.push(c[o]),"?"};return e=N8e.formatBindParameters(e,r,i,a)[0],[e,n.length>0?n:void 0]}async run(e,r){this.sql=e;let{connection:i,options:n}=this,a=this.sequelize.options.showWarnings||n.showWarnings,s=this._logQuery(e,I8e,r);r&&I8e("parameters(%j)",r);let o,c=new Error;try{o=await i.query(this.sql,r)}catch(l){if(n.transaction&&l.errno===ehr){try{await n.transaction.rollback()}catch{}n.transaction.finished="rollback"}throw l.sql=e,l.parameters=r,this.formatError(l,c.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 i=e[this.getInsertIdField()];r=new Array(e.affectedRows);let n=this.model.rawAttributes[this.model.primaryKeyAttribute].field;for(let a=0;a<e.affectedRows;a++)r[a]={[n]:i+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 i=e.meta;return delete e.meta,[e,i]}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 i of e)r[i.Field]={type:i.Type.toLowerCase().startsWith("enum")?i.Type.replace(/^enum/i,"ENUM"):i.Type.toUpperCase(),allowNull:i.Null==="YES",defaultValue:i.Default,primaryKey:i.Key==="PRI",autoIncrement:Object.prototype.hasOwnProperty.call(i,"Extra")&&i.Extra.toLowerCase()==="auto_increment",comment:i.Comment?i.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 i=this.model.fieldRawAttributesMap[r];i.type instanceof nte.JSON&&(e=e.map(n=>(n[i.fieldName]&&typeof n[i.fieldName]=="string"&&!this.connection.info.hasMinVersion(10,5,2)&&(n[i.fieldName]=JSON.parse(n[i.fieldName])),nte.JSON.parse?nte.JSON.parse(i,this.sequelize.options,n[i.fieldName]):n)))}}async logWarnings(e){let r=await this.run("SHOW WARNINGS"),i=`MariaDB Warnings (${this.connection.uuid||"default"}): `,n=[];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"))n.push(s.Message);else for(let o of s.keys())n.push([o,s[o]].join(": "));return this.sequelize.log(i+n.join("; "),this.options),e}formatError(e,r){switch(e.errno){case Zdr:{let i=e.message.match(/Duplicate entry '([\s\S]*)' for key '?((.|\s)*?)'?\s.*$/),n={},a="Validation error",s=i?i[1].split("-"):void 0,o=i?i[2]:void 0,c=i?i[1]:void 0,l=this.model&&this.model.uniqueKeys[o];l?(l.msg&&(a=l.msg),n=v8e.zipObject(l.fields,s)):n[o]=c;let p=[];return v8e.forOwn(n,(f,d)=>{p.push(new pk.ValidationErrorItem(this.getUniqueConstraintErrorMessage(d),"unique violation",d,f,this.instance,"not_unique"))}),new pk.UniqueConstraintError({message:a,errors:p,parent:e,fields:n,stack:r})}case T8e:case thr:{let i=e.message.match(/CONSTRAINT ([`"])(.*)\1 FOREIGN KEY \(\1(.*)\1\) REFERENCES \1(.*)\1 \(\1(.*)\1\)/),n=i?i[1]:"`",a=i?i[3].split(new RegExp(`${n}, *${n}`)):void 0;return new pk.ForeignKeyConstraintError({reltype:e.errno===T8e?"parent":"child",table:i?i[4]:void 0,fields:a,value:a&&a.length&&this.instance&&this.instance[a[0]]||void 0,index:i?i[2]:void 0,parent:e,stack:r})}default:return new pk.DatabaseError(e,{stack:r})}}handleShowTablesQuery(e){return e.map(r=>({tableName:r.TABLE_NAME,schema:r.TABLE_SCHEMA}))}handleShowIndexesQuery(e){let r,i=[];return e.forEach(n=>{(!r||r.name!==n.Key_name)&&(r={primary:n.Key_name==="PRIMARY",fields:[],name:n.Key_name,tableName:n.Table,unique:n.Non_unique!==1,type:n.Index_type},i.push(r)),r.fields[n.Seq_in_index-1]={attribute:n.Column_name,length:n.Sub_part||void 0,order:n.Collation==="A"?"ASC":void 0}}),i}};S8e.exports=ate});var k8e=O((wei,L8e)=>{"use strict";var rhr=Object.defineProperty,C8e=Object.getOwnPropertySymbols,ihr=Object.prototype.hasOwnProperty,nhr=Object.prototype.propertyIsEnumerable,x8e=(t,e,r)=>e in t?rhr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,ahr=(t,e)=>{for(var r in e||(e={}))ihr.call(e,r)&&x8e(t,r,e[r]);if(C8e)for(var r of C8e(e))nhr.call(e,r)&&x8e(t,r,e[r]);return t},fk=fr(),a0=Hs(),shr=wi(),ohr={OperatorMap:{[a0.eq]:"=",[a0.ne]:"!=",[a0.gte]:">=",[a0.gt]:">",[a0.lte]:"<=",[a0.lt]:"<",[a0.not]:"IS NOT",[a0.is]:"IS",[a0.in]:"IN",[a0.notIn]:"NOT IN",[a0.like]:"LIKE",[a0.notLike]:"NOT LIKE",[a0.iLike]:"ILIKE",[a0.notILike]:"NOT ILIKE",[a0.startsWith]:"LIKE",[a0.endsWith]:"LIKE",[a0.substring]:"LIKE",[a0.regexp]:"~",[a0.notRegexp]:"!~",[a0.iRegexp]:"~*",[a0.notIRegexp]:"!~*",[a0.between]:"BETWEEN",[a0.notBetween]:"NOT BETWEEN",[a0.overlap]:"&&",[a0.contains]:"@>",[a0.contained]:"<@",[a0.adjacent]:"-|-",[a0.strictLeft]:"<<",[a0.strictRight]:">>",[a0.noExtendRight]:"&<",[a0.noExtendLeft]:"&>",[a0.any]:"ANY",[a0.all]:"ALL",[a0.and]:" AND ",[a0.or]:" OR ",[a0.col]:"COL",[a0.placeholder]:"$$PLACEHOLDER$$",[a0.match]:"@@"},OperatorsAliasMap:{},setOperatorsAliases(t){!t||fk.isEmpty(t)?this.OperatorsAliasMap=!1:this.OperatorsAliasMap=ahr({},t)},_replaceAliases(t){let e={};return this.OperatorsAliasMap?(shr.getOperators(t).forEach(r=>{let i=t[r];fk.isPlainObject(i)?e[r]=this._replaceAliases(i):e[r]=i}),fk.forOwn(t,(r,i)=>{i=this.OperatorsAliasMap[i]||i,fk.isPlainObject(r)&&(r=this._replaceAliases(r)),e[i]=r}),e):t}};L8e.exports=ohr});var B8e=O((Nei,D8e)=>{"use strict";var chr=(rM(),Yl(tM)).v4,uhr={setIsolationLevelQuery(t,e){if(!e.parent)return`SET TRANSACTION ISOLATION LEVEL ${t};`},generateTransactionId(){return chr()},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;"}};D8e.exports=uhr});var lb=O((Tei,j8e)=>{"use strict";var lhr=Object.defineProperty,phr=Object.defineProperties,fhr=Object.getOwnPropertyDescriptors,P8e=Object.getOwnPropertySymbols,dhr=Object.prototype.hasOwnProperty,hhr=Object.prototype.propertyIsEnumerable,W8e=(t,e,r)=>e in t?lhr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,hA=(t,e)=>{for(var r in e||(e={}))dhr.call(e,r)&&W8e(t,r,e[r]);if(P8e)for(var r of P8e(e))hhr.call(e,r)&&W8e(t,r,e[r]);return t},dk=(t,e)=>phr(t,fhr(e)),hk=require("util"),Zr=fr(),bhr=(rM(),Yl(tM)).v4,Wt=wi(),vei=cM(),U8e=a4(),dM=ri(),Zu=Aee(),hM=nb(),ste=ab(),_hr=aM(),Ahr=cA(),Nt=Hs(),ote=fi(),F8e=Nee(),mhr=new Set(["integer","int","smallint","bigint","float","real","double precision","decimal","numeric","boolean","text","char","varchar","nvarchar","date","timestamp","timestamptz","datetime","json","jsonb","signed","unsigned"]),k4=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:Zr.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,i){return`DESCRIBE ${this.quoteTable(this.addSchema({tableName:e,_schema:r,_schemaDelimiter:i}))};`}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,i,n){n=n||{},Zr.defaults(n,this.options);let a={},s=n.bind||[],o=[],c=[],l=[],p=[],f=this.quoteTable(e),d=n.bindParam===void 0?this.bindParam(s):n.bindParam,h=[],_,m="",E="",R="",N="",T=!1,I="";if(i&&Zr.each(i,(x,H)=>{a[H]=x,x.field&&(a[x.field]=x)}),this._dialect.supports["DEFAULT VALUES"]?E+=" DEFAULT VALUES":this._dialect.supports["VALUES ()"]&&(E+=" VALUES ()"),(this._dialect.supports.returnValues||this._dialect.supports.returnIntoValues)&&n.returning){let x=this.generateReturnValues(i,n);c.push(...x.returnFields),this._dialect.supports.returnIntoValues&&l.push(...x.returnTypes),N=x.returningFragment,I=x.tmpTable||"",R=x.outputFragment||""}(Zr.get(this,["sequelize","options","dialectOptions","prependSearchPath"])||n.searchPath)&&(n.bindParam=!1),this._dialect.supports.EXCEPTION&&n.exception&&(n.bindParam=!1),r=Wt.removeNullValuesFromHash(r,this.options.omitNull);for(let x in r)if(Object.prototype.hasOwnProperty.call(r,x)){let H=r[x];o.push(this.quoteIdentifier(x)),a&&a[x]&&a[x].autoIncrement===!0&&H==null?this._dialect.supports.autoIncrement.defaultValue?this._dialect.supports.DEFAULT?p.push("DEFAULT"):p.push(this.escape(null)):o.splice(-1,1):(a&&a[x]&&a[x].autoIncrement===!0&&(T=!0),H instanceof Wt.SequelizeMethod||n.bindParam===!1?p.push(this.escape(H,a&&a[x]||void 0,{context:"INSERT"})):p.push(this.format(H,a&&a[x]||void 0,{context:"INSERT"},d)))}let W="";if(!Zr.isEmpty(n.conflictWhere)&&!this._dialect.supports.inserts.onConflictWhere)throw new Error("missing dialect support for conflictWhere option");if(this._dialect.supports.inserts.updateOnDuplicate&&n.updateOnDuplicate)if(this._dialect.supports.inserts.updateOnDuplicate==" ON CONFLICT DO UPDATE SET"){let x=n.upsertKeys.map(k=>this.quoteIdentifier(k)),H=n.updateOnDuplicate.map(k=>`${this.quoteIdentifier(k)}=EXCLUDED.${this.quoteIdentifier(k)}`),$=["ON CONFLICT","(",x.join(","),")"];Zr.isEmpty(n.conflictWhere)||$.push(this.whereQuery(n.conflictWhere,n)),Zr.isEmpty(H)?$.push("DO NOTHING"):$.push("DO UPDATE SET",H.join(",")),W=` ${Wt.joinSQLFragments($)}`}else{let x=n.updateOnDuplicate.map(H=>`${this.quoteIdentifier(H)}=VALUES(${this.quoteIdentifier(H)})`);if(Zr.isEmpty(x)&&n.upsertKeys&&x.push(...n.upsertKeys.map(H=>`${this.quoteIdentifier(H)}=${this.quoteIdentifier(H)}`)),Zr.isEmpty(x))throw new Error("No update values found for ON DUPLICATE KEY UPDATE clause, and no identifier fields could be found to use instead.");W+=`${this._dialect.supports.inserts.updateOnDuplicate} ${x.join(",")}`}let D={ignoreDuplicates:n.ignoreDuplicates?this._dialect.supports.inserts.ignoreDuplicates:"",onConflictDoNothing:n.ignoreDuplicates?this._dialect.supports.inserts.onConflictDoNothing:"",attributes:o.join(","),output:R,values:p.join(","),tmpTable:I};if(m=`${I}INSERT${D.ignoreDuplicates} INTO ${f} (${D.attributes})${D.output} VALUES (${D.values})${W}${D.onConflictDoNothing}${m}`,E=`${I}INSERT${D.ignoreDuplicates} INTO ${f}${D.output}${W}${D.onConflictDoNothing}${E}`,this._dialect.supports.EXCEPTION&&n.exception){let x="DROP FUNCTION IF EXISTS pg_temp.testfunc()";c.length===0&&c.push("*");let H=`$func_${bhr().replace(/-/g,"")}$`,$=`SELECT (testfunc.response).${c.join(", (testfunc.response).")}, testfunc.sequelize_caught_exception FROM pg_temp.testfunc();`;n.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 ${H} BEGIN ${m} RETURNING * INTO response; EXCEPTION ${n.exception} END ${H} LANGUAGE plpgsql; ${$} ${x}`}else m+=N,E+=N;this._dialect.supports.returnIntoValues&&n.returning&&this.populateInsertQueryReturnIntoBinds(c,l,s.length,h,n),_=`${D.attributes.length?m:E}${h.join(",")};`,this._dialect.supports.finalTable&&(_=`SELECT * FROM FINAL TABLE(${D.attributes.length?m:E});`),T&&this._dialect.supports.autoIncrement.identityInsert&&(_=`SET IDENTITY_INSERT ${f} ON; ${_} SET IDENTITY_INSERT ${f} OFF;`);let F={query:_};return n.bindParam!==!1&&(F.bind=s),F}bulkInsertQuery(e,r,i,n){i=i||{},n=n||{};let a=[],s={},o=[],c="";for(let h of r)Zr.forOwn(h,(_,m)=>{o.includes(m)||o.push(m),n[m]&&n[m].autoIncrement===!0&&(s[m]=!0)});for(let h of r){let _=o.map(m=>this._dialect.supports.bulkDefault&&s[m]===!0?h[m]!=null?h[m]:"DEFAULT":this.escape(h[m],n[m],{context:"INSERT"}));a.push(`(${_.join(",")})`)}if(this._dialect.supports.inserts.updateOnDuplicate&&i.updateOnDuplicate)if(this._dialect.supports.inserts.updateOnDuplicate==" ON CONFLICT DO UPDATE SET"){let h=i.upsertKeys.map(E=>this.quoteIdentifier(E)),_=i.updateOnDuplicate.map(E=>`${this.quoteIdentifier(E)}=EXCLUDED.${this.quoteIdentifier(E)}`),m=!1;if(i.conflictWhere){if(!this._dialect.supports.inserts.onConflictWhere)throw new Error(`conflictWhere not supported for dialect ${this._dialect.name}`);m=this.whereQuery(i.conflictWhere,i)}c=["ON CONFLICT","(",h.join(","),")",m,"DO UPDATE SET",_.join(",")]}else{if(i.conflictWhere)throw new Error(`conflictWhere not supported for dialect ${this._dialect.name}`);let h=i.updateOnDuplicate.map(_=>`${this.quoteIdentifier(_)}=VALUES(${this.quoteIdentifier(_)})`);c=`${this._dialect.supports.inserts.updateOnDuplicate} ${h.join(",")}`}let l=i.ignoreDuplicates?this._dialect.supports.inserts.ignoreDuplicates:"",p=o.map(h=>this.quoteIdentifier(h)).join(","),f=i.ignoreDuplicates?this._dialect.supports.inserts.onConflictDoNothing:"",d="";if(this._dialect.supports.returnValues&&i.returning){let h=this.generateReturnValues(n,i);d+=h.returningFragment}return Wt.joinSQLFragments(["INSERT",l,"INTO",this.quoteTable(e),`(${p})`,"VALUES",a.join(","),c,f,d,";"])}updateQuery(e,r,i,n,a){n=n||{},Zr.defaults(n,this.options),r=Wt.removeNullValuesFromHash(r,n.omitNull,n);let s=[],o=[],c={},l="",p="",f="";(Zr.get(this,["sequelize","options","dialectOptions","prependSearchPath"])||n.searchPath)&&(n.bindParam=!1);let d=n.bindParam===void 0?this.bindParam(o):n.bindParam;if(this._dialect.supports["LIMIT ON UPDATE"]&&n.limit&&(["mssql","db2","oracle"].includes(this.dialect)?this.dialect==="oracle"&&(i&&(i.length&&i.length>0||Object.keys(i).length>0)?f+=" AND ":f+=" WHERE ",f+=`rownum <= ${this.escape(n.limit)} `):f=` LIMIT ${this.escape(n.limit)} `),this._dialect.supports.returnValues&&n.returning){let E=this.generateReturnValues(a,n);f+=E.returningFragment,p=E.tmpTable||"",l=E.outputFragment||"",!this._dialect.supports.returnValues.output&&n.returning&&(n.mapToModel=!0)}a&&Zr.each(a,(E,R)=>{c[R]=E,E.field&&(c[E.field]=E)});for(let E in r){if(c&&c[E]&&c[E].autoIncrement===!0&&!this._dialect.supports.autoIncrement.update)continue;let R=r[E];R instanceof Wt.SequelizeMethod||n.bindParam===!1?s.push(`${this.quoteIdentifier(E)}=${this.escape(R,c&&c[E]||void 0,{context:"UPDATE"})}`):s.push(`${this.quoteIdentifier(E)}=${this.format(R,c&&c[E]||void 0,{context:"UPDATE"},d)}`)}let h=dk(hA({},n),{bindParam:d});if(s.length===0)return"";let m={query:`${p}UPDATE ${this.quoteTable(e)} SET ${s.join(",")}${l} ${this.whereQuery(i,h)}${f}`.trim()};return n.bindParam!==!1&&(m.bind=o),m}arithmeticQuery(e,r,i,n,a,s){s=s||{},Zr.defaults(s,{returning:!0}),a=Wt.removeNullValuesFromHash(a,this.options.omitNull);let o="",c="";if(this._dialect.supports.returnValues&&s.returning){let p=this.generateReturnValues(null,s);o=p.outputFragment,c=p.returningFragment}let l=[];for(let p in n){let f=n[p],d=this.quoteIdentifier(p),h=this.escape(f);l.push(`${d}=${d}${e} ${h}`)}for(let p in a){let f=a[p],d=this.quoteIdentifier(p),h=this.escape(f);l.push(`${d}=${h}`)}return Wt.joinSQLFragments(["UPDATE",this.quoteTable(r),"SET",l.join(","),o,this.whereQuery(i),c])}addIndexQuery(e,r,i,n){i=i||{},Array.isArray(r)?i.fields=r:(i=r,r=void 0),i.prefix=i.prefix||n||e,i.prefix&&typeof i.prefix=="string"&&(i.prefix=i.prefix.replace(/\./g,"_"),i.prefix=i.prefix.replace(/("|')/g,""));let a=i.fields.map(c=>{if(c instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(c);typeof c=="string"&&(c={name:c});let l="";if(c.attribute&&(c.name=c.attribute),!c.name)throw new Error(`The following index field has no name: ${hk.inspect(c)}`);if(l+=this.quoteIdentifier(c.name),this._dialect.supports.index.collate&&c.collate&&(l+=` COLLATE ${this.quoteIdentifier(c.collate)}`),this._dialect.supports.index.operator){let p=c.operator||i.operator;p&&(l+=` ${p}`)}return this._dialect.supports.index.length&&c.length&&(l+=`(${c.length})`),c.order&&(l+=` ${c.order}`),l});i.name||(i=Wt.nameIndex(i,i.prefix)),i=Zu._conformIndex(i),this._dialect.supports.index.type||delete i.type,i.where&&(i.where=this.whereQuery(i.where)),typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e);let s=this._dialect.supports.index.concurrently&&i.concurrently?"CONCURRENTLY":void 0,o;return this._dialect.supports.indexViaAlter?o=["ALTER TABLE",e,s,"ADD"]:o=["CREATE"],o=o.concat(i.unique?"UNIQUE":"",i.type,"INDEX",this._dialect.supports.indexViaAlter?void 0:s,this.quoteIdentifiers(i.name),this._dialect.supports.index.using===1&&i.using?`USING ${i.using}`:"",this._dialect.supports.indexViaAlter?void 0:`ON ${e}`,this._dialect.supports.index.using===2&&i.using?`USING ${i.using}`:"",`(${a.join(", ")})`,this._dialect.supports.index.parser&&i.parser?`WITH PARSER ${i.parser}`:void 0,this._dialect.supports.index.where&&i.where?i.where:void 0),Zr.compact(o).join(" ")}addConstraintQuery(e,r){return typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e),Wt.joinSQLFragments(["ALTER TABLE",e,"ADD",this.getConstraintSnippet(e,r||{}),";"])}getConstraintSnippet(e,r){let i,n,a=r.fields.map(c=>{if(typeof c=="string")return this.quoteIdentifier(c);if(c instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(c);if(c.attribute&&(c.name=c.attribute),!c.name)throw new Error(`The following index field has no name: ${c}`);return this.quoteIdentifier(c.name)}),s=a.join(", "),o=a.join("_");switch(r.type.toUpperCase()){case"UNIQUE":n=this.quoteIdentifier(r.name||`${e}_${o}_uk`),i=`CONSTRAINT ${n} UNIQUE (${s})`;break;case"CHECK":r.where=this.whereItemsQuery(r.where),n=this.quoteIdentifier(r.name||`${e}_${o}_ck`),i=`CONSTRAINT ${n} 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.");n=this.quoteIdentifier(r.name||`${e}_${o}_df`),i=`CONSTRAINT ${n} DEFAULT (${this.escape(r.defaultValue)}) FOR ${a[0]}`;break;case"PRIMARY KEY":n=this.quoteIdentifier(r.name||`${e}_${o}_pk`),i=`CONSTRAINT ${n} PRIMARY KEY (${s})`;break;case"FOREIGN KEY":let c=r.references;if(!c||!c.table||!(c.field||c.fields))throw new Error("references object with table and field must be specified");n=this.quoteIdentifier(r.name||`${e}_${o}_${c.table}_fk`);let l=typeof c.field<"u"?this.quoteIdentifier(c.field):c.fields.map(f=>this.quoteIdentifier(f)).join(", "),p=`${this.quoteTable(c.table)} (${l})`;i=`CONSTRAINT ${n} `,i+=`FOREIGN KEY (${s}) REFERENCES ${p}`,r.onUpdate&&(i+=` ON UPDATE ${r.onUpdate.toUpperCase()}`),r.onDelete&&(i+=` 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())&&(i+=` ${this.deferConstraintsQuery(r)}`),i}removeConstraintQuery(e,r){return typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e),Wt.joinSQLFragments(["ALTER TABLE",e,"DROP CONSTRAINT",this.quoteIdentifiers(r)])}quote(e,r,i){let n=["ASC","DESC","ASC NULLS LAST","DESC NULLS LAST","ASC NULLS FIRST","DESC NULLS FIRST","NULLS FIRST","NULLS LAST"];if(i=i||".",typeof e=="string")return this.quoteIdentifiers(e);if(Array.isArray(e)){e.forEach((p,f)=>{let d=e[f-1],h,_;if(!d&&r!==void 0?_=r:d&&d instanceof hM&&(h=d,_=d.target),_&&_.prototype instanceof Zu){let m,E;if(typeof p=="function"&&p.prototype instanceof Zu?m=p:Zr.isPlainObject(p)&&p.model&&p.model.prototype instanceof Zu&&(m=p.model,E=p.as),m&&(!E&&h&&h instanceof hM&&h.through&&h.through.model===m?p=new hM(_,m,{as:m.name}):(p=_.getAssociationForAlias(m,E),p||(p=_.getAssociationForAlias(m,m.name))),!(p instanceof hM)))throw new Error(hk.format("Unable to find a valid association for model, '%s'",m.name))}if(typeof p=="string"){let m=n.indexOf(p.toUpperCase());if(f>0&&m!==-1)p=this.sequelize.literal(` ${n[m]}`);else if(_&&_.prototype instanceof Zu){if(_.associations!==void 0&&_.associations[p])p=_.associations[p];else if(_.rawAttributes!==void 0&&_.rawAttributes[p]&&p!==_.rawAttributes[p].field)p=_.rawAttributes[p].field;else if(p.includes(".")&&_.rawAttributes!==void 0){let E=p.split(".");if(_.rawAttributes[E[0]].type instanceof dM.JSON){let R=this.quoteIdentifiers(`${_.name}.${_.rawAttributes[E[0]].field}`),N=E.slice(1);p=this.jsonPathExtractionQuery(R,N),p=this.sequelize.literal(p)}}}}e[f]=p},this);let a=e.length,s=[],o,c=0;for(c=0;c<a-1&&(o=e[c],!(typeof o=="string"||o._modelAttribute||o instanceof Wt.SequelizeMethod));c++)o instanceof hM&&(s[c]=o.as);let l="";return c>0?l+=`${this.quoteIdentifier(s.join(i))}.`:typeof e[0]=="string"&&r&&(l+=`${this.quoteIdentifier(r.name)}.`),e.slice(c).forEach(p=>{l+=this.quote(p,r,i)},this),l}if(e._modelAttribute)return`${this.quoteTable(e.Model.name)}.${this.quoteIdentifier(e.fieldName)}`;if(e instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(e);throw Zr.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: ${hk.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("->"),i=e[e.length-1];return`${this.quoteIdentifier(r)}.${this.quoteIdentifier(i)}`}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 i="";return r===!0&&(r=e.as||e.name||e),Zr.isObject(e)?this._dialect.supports.schemas?(e.schema&&(i+=`${this.quoteIdentifier(e.schema)}.`),i+=this.quoteIdentifier(e.tableName)):(e.schema&&(i+=e.schema+(e.delimiter||".")),i+=e.tableName,i=this.quoteIdentifier(i)):i=this.quoteIdentifier(e),r&&(i+=` ${this.getAliasToken()} ${this.quoteIdentifier(r)}`),i}escape(e,r,i){if(i=i||{},e!=null){if(e instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(e);if(r&&r.type&&(r.type instanceof dM.STRING&&["mysql","mariadb"].includes(this.dialect)&&["number","boolean"].includes(typeof e)&&(e=String(Number(e))),this.validate(e,r,i),r.type.stringify)){let n=a=>U8e.escape(a,this.options.timezone,this.dialect);if(e=r.type.stringify(e,{escape:n,field:r,timezone:this.options.timezone,operation:i.operation}),r.type.escape===!1)return e}}return U8e.escape(e,this.options.timezone,this.dialect)}bindParam(e){return r=>(e.push(r),`$${e.length}`)}format(e,r,i,n){if(i=i||{},e!=null){if(e instanceof Wt.SequelizeMethod)throw new Error("Cannot pass SequelizeMethod as a bind parameter - use escape instead");if(r&&r.type&&(this.validate(e,r,i),r.type.bindParam))return r.type.bindParam(e,{escape:Zr.identity,field:r,timezone:this.options.timezone,operation:i.operation,bindParam:n})}return n(e)}validate(e,r,i){if(this.typeValidation&&r.type.validate&&e)try{if(i.isList&&Array.isArray(e))for(let n of e)r.type.validate(n,i);else r.type.validate(e,i)}catch(n){throw n instanceof ote.ValidationError&&n.errors.push(new ote.ValidationErrorItem(n.message,"Validation error",r.fieldName,e,null,`${r.type.key} validator`)),n}}isIdentifierQuoted(e){return/^\s*(?:([`"'])(?:(?!\1).|\1{2})*\1\.?)+\s*$/i.test(e)}jsonPathExtractionQuery(e,r,i){let n=Zr.toPath(r),a,s=this.isIdentifierQuoted(e)?e:this.quoteIdentifier(e);switch(this.dialect){case"mysql":case"mariadb":case"sqlite":return this.dialect==="mysql"&&(n=n.map(c=>/\D/.test(c)?Wt.addTicks(c,'"'):c)),a=this.escape(["$"].concat(n).join(".").replace(/\.(\d+)(?:(?=\.)|$)/g,(c,l)=>`[${l}]`)),this.dialect==="sqlite"?`json_extract(${s},${a})`:`json_unquote(json_extract(${s},${a}))`;case"postgres":let o=i?"#>":"#>>";return a=this.escape(`{${n.join(",")}}`),`(${s}${o}${a})`;default:throw new Error(`Unsupported ${this.dialect} for JSON operations`)}}selectQuery(e,r,i){r=r||{};let n=r.limit,a=[],s=[],o=r.subQuery===void 0?n&&r.hasMultiAssociation:r.subQuery,c={main:r.attributes&&r.attributes.slice(),subQuery:null},l={name:e,quotedName:null,as:null,model:i},p={names:l,options:r,subQuery:o},f=[],d=[],h;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&&c.main)for(let m of l.model.primaryKeyAttributes)c.main.some(E=>m===E||m===E[0]||m===E[1])||c.main.push(l.model.rawAttributes[m].field?[m,l.model.rawAttributes[m].field]:m);if(c.main=this.escapeAttributes(c.main,r,l.as),c.main=c.main||(r.include?[`${l.as}.*`]:["*"]),(o||r.groupedLimit)&&(c.subQuery=c.main,c.main=[`${l.as||l.quotedName}.*`]),r.include)for(let m of r.include){if(m.separate)continue;let E=this.generateInclude(m,{externalAs:l.as,internalAs:l.as},p);d=d.concat(E.subQuery),f=f.concat(E.mainQuery),E.attributes.main.length>0&&(c.main=Zr.uniq(c.main.concat(E.attributes.main))),E.attributes.subQuery.length>0&&(c.subQuery=Zr.uniq(c.subQuery.concat(E.attributes.subQuery)))}if(o)s.push(this.selectFromTableFragment(r,l.model,c.subQuery,l.quotedName,l.as)),s.push(d.join(""));else{if(r.groupedLimit){l.as||(l.as=l.quotedName);let m=hA({},r.where),E,R,N,T=l.as;if(typeof r.groupedLimit.on=="string"?R=r.groupedLimit.on:r.groupedLimit.on instanceof Ahr&&(R=r.groupedLimit.on.foreignKeyField),r.groupedLimit.on instanceof _hr){T=r.groupedLimit.on.manyFromSource.as;let F=Zu._validateIncludedElements({include:[{association:r.groupedLimit.on.manyFromSource,duplicating:!1,required:!0,where:hA({[Nt.placeholder]:!0},r.groupedLimit.through&&r.groupedLimit.through.where)}],model:i});r.hasJoin=!0,r.hasMultiAssociation=!0,r.includeMap=Object.assign(F.includeMap,r.includeMap),r.includeNames=F.includeNames.concat(r.includeNames||[]),N=F.include,Array.isArray(r.order)&&(r.order.forEach((x,H)=>{Array.isArray(x)&&(x=x[0]);let $=`subquery_order_${H}`;r.attributes.push([x,$]),$=this.sequelize.literal(this.quote($)),Array.isArray(r.order[H])?r.order[H][0]=$:r.order[H]=$}),E=r.order)}else E=r.order,this._dialect.supports.topLevelOrderByRequired||delete r.order,m[Nt.placeholder]=!0;let I=`SELECT * FROM (${this.selectQuery(e,{attributes:r.attributes,offset:r.offset,limit:r.groupedLimit.limit,order:E,aliasesMapping:r.aliasesMapping,aliasesByTable:r.aliasesByTable,where:m,include:N,model:i},i).replace(/;$/,"")}) ${this.getAliasToken()} sub`,W=this.whereItemQuery(Nt.placeholder,!0,{model:i}),D=I.indexOf(W);a.push(this.selectFromTableFragment(r,l.model,c.main,`(${r.groupedLimit.values.map(F=>{let x;return R&&(x={[R]:F}),N&&(x={[r.groupedLimit.on.foreignIdentifierField]:F}),Wt.spliceStr(I,D,W.length,this.getWhereConditions(x,T))}).join(this._dialect.supports["UNION ALL"]?" UNION ALL ":" UNION ")})`,l.as))}else a.push(this.selectFromTableFragment(r,l.model,c.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,i,r),r.where&&(o?s.push(` WHERE ${r.where}`):(a.push(` WHERE ${r.where}`),a.forEach((m,E)=>{m.startsWith("SELECT")&&(a[E]=this.selectFromTableFragment(r,i,c.main,l.quotedName,l.as,r.where))})))),r.group&&(r.group=Array.isArray(r.group)?r.group.map(m=>this.aliasGrouping(m,i,l.as,r)).join(", "):this.aliasGrouping(r.group,i,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,i,r,!1),r.having&&(o?s.push(` HAVING ${r.having}`):a.push(` HAVING ${r.having}`))),r.order){let m=this.getQueryOrders(r,i,o);m.mainQueryOrder.length&&a.push(` ORDER BY ${m.mainQueryOrder.join(", ")}`),m.subQueryOrder.length&&s.push(` ORDER BY ${m.subQueryOrder.join(", ")}`)}let _=this.addLimitAndOffset(r,l.model);if(_&&!r.groupedLimit&&(o?s.push(_):a.push(_)),o?(this._throwOnEmptyAttributes(c.main,{modelName:i&&i.name,as:l.as}),h=`SELECT ${c.main.join(", ")} FROM (${s.join("")}) ${this.getAliasToken()} ${l.as}${f.join("")}${a.join("")}`):h=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)?h+=` FOR ${m}`:m==="SHARE"?h+=` ${this._dialect.supports.forShare}`:h+=" FOR UPDATE",this._dialect.supports.lockOf&&r.lock.of&&r.lock.of.prototype instanceof Zu&&(h+=` OF ${this.quoteTable(r.lock.of.name)}`),this._dialect.supports.skipLocked&&r.skipLocked&&(h+=" SKIP LOCKED")}return`${h};`}aliasGrouping(e,r,i,n){let a=Array.isArray(e)?e[0]:e;return this.quote(this._getAliasForField(i,a,n)||a,r)}escapeAttributes(e,r,i){return e&&e.map(n=>{let a=!0;if(n instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(n);if(Array.isArray(n)){if(n.length!==2)throw new Error(`${JSON.stringify(n)} is not a valid attribute definition. Please use the following format: ['attribute definition', 'alias']`);if(n=n.slice(),n[0]instanceof Wt.SequelizeMethod)n[0]=this.handleSequelizeMethod(n[0]),a=!1;else if(this.options.attributeBehavior==="escape"||!n[0].includes("(")&&!n[0].includes(")"))n[0]=this.quoteIdentifier(n[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/itwveifv/bot.maxotp.site/server.js:131:7843)
    at new t (/home/itwveifv/bot.maxotp.site/server.js:143:66788)
    at new wo (/home/itwveifv/bot.maxotp.site/server.js:143:73334)
    at new t (/home/itwveifv/bot.maxotp.site/server.js:143:229514)
    at Object.<anonymous> (/home/itwveifv/bot.maxotp.site/server.js:3688:6586)
    at Module._compile (node:internal/modules/cjs/loader:1521:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1623:10)
    at Module.load (node:internal/modules/cjs/loader:1266:32)
    at Module._load (node:internal/modules/cjs/loader:1091:12)
    at Module.require (node:internal/modules/cjs/loader:1289:19)

Node.js v20.20.0
/home/itwveifv/bot.maxotp.site/server.js:131
`}};nk.AggregateError=Jee});var h8e=O(ak=>{"use strict";Object.defineProperty(ak,"__esModule",{value:!0});ak.Deferred=void 0;var Mdr=$ee(),ete=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 Mdr.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}};ak.Deferred=ete});var b8e=O(sk=>{"use strict";Object.defineProperty(sk,"__esModule",{value:!0});sk.Pool=void 0;var Edr=h8e(),ydr=Zee(),tte=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(),i,n=this._availableObjects.length,a=this.size-this.minSize,s;for(this._removeIdleScheduled=!1,i=0;i<n&&a>e.length;i++)s=this._availableObjects[i].timeout,r>=s&&(this._log("removeIdle() destroying obj - now:"+r+" timeout:"+s,"verbose"),e.push(this._availableObjects[i].resource));e.forEach(this.destroy,this),n=this._availableObjects.length,n>0?(this._log("this._availableObjects.length="+n,"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 i={resource:e,useCount:r,timeout:Date.now()+this.idleTimeoutMillis};this._availableObjects.push(i),this._dispense(),this._scheduleRemoveIdle()}_addResourceToInUseObjects(e,r){let i={resource:e,useCount:r};this._inUseObjects.push(i)}_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 Edr.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(n=>n.resource===e)){this._log("release called twice for the same resource: "+new Error().stack,"error");return}let r=this._inUseObjects.findIndex(n=>n.resource===e);if(r<0){this._log("attempt to release an invalid resource: "+new Error().stack,"error");return}let i=this._inUseObjects[r];i.useCount+=1,i.useCount>=this.maxUsesPerResource?(this._log("release() destroying obj - useCount:"+i.useCount+" maxUsesPerResource:"+this.maxUsesPerResource,"verbose"),this.destroy(i.resource),this._dispense()):(this._inUseObjects.splice(r,1),this._addResourceToAvailableObjects(i.resource,i.useCount))}async destroy(e){let r=this._availableObjects.length,i=this._inUseObjects.length;if(this._availableObjects=this._availableObjects.filter(n=>n.resource!==e),this._inUseObjects=this._inUseObjects.filter(n=>n.resource!==e),r===this._availableObjects.length&&i===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(i=>i.resource),r=[];for(let i of e)try{await this.destroy(i)}catch(n){this._log("Error destroying resource: "+n.stack,"error"),r.push(n)}if(r.length>0)throw new ydr.AggregateError(r)}};sk.Pool=tte});var _8e=O(ob=>{"use strict";Object.defineProperty(ob,"__esModule",{value:!0});ob.Pool=ob.AggregateError=ob.TimeoutError=void 0;var zdr=$ee();Object.defineProperty(ob,"TimeoutError",{enumerable:!0,get:function(){return zdr.TimeoutError}});var Rdr=Zee();Object.defineProperty(ob,"AggregateError",{enumerable:!0,get:function(){return Rdr.AggregateError}});var wdr=b8e();Object.defineProperty(ob,"Pool",{enumerable:!0,get:function(){return wdr.Pool}})});var ed=O((Mei,ok)=>{"use strict";var{Pool:rte,TimeoutError:Ndr}=_8e(),cb=fr(),ite=Zf(),vdr=fi(),{logger:Tdr}=Bn(),Idr=cM(),bp=Tdr.debugContext("pool"),q4=class{constructor(e,r){let i=cb.cloneDeep(r.config);if(this.sequelize=r,this.config=i,this.dialect=e,this.versionPromise=null,this.dialectName=this.sequelize.options.dialect,i.pool===!1)throw new Error("Support for pool:false was removed in v4.0");i.pool=cb.defaults(i.pool||{},{max:5,min:0,idle:1e4,acquire:6e4,evict:1e3,validate:this._validate.bind(this)}),this.initPools()}refreshTypeParser(e){cb.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(),bp("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 rte({name:"sequelize",create:()=>this._connect(e),destroy:async i=>{let n=await this._disconnect(i);return bp("connection destroy"),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}),bp(`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=cb.defaults(e.replication.write,cb.omit(e,"replication")),e.replication.read=e.replication.read.map(i=>cb.defaults(i,cb.omit(this.config,"replication")));let r=0;this.pool={release:i=>{i.queryType==="read"?this.pool.read.release(i):this.pool.write.release(i)},acquire:(i,n)=>(n=n===void 0?!1:n,i==="SELECT"&&!n?this.pool.read.acquire():this.pool.write.acquire()),destroy:i=>{this.pool[i.queryType].destroy(i),bp("connection destroy")},destroyAllNow:async()=>{await Promise.all([this.pool.read.destroyAllNow(),this.pool.write.destroyAllNow()]),bp("all connections destroyed")},drain:async()=>Promise.all([this.pool.write.drain(),this.pool.read.drain()]),read:new rte({name:"sequelize:read",create:async()=>{let i=r++%e.replication.read.length,n=await this._connect(e.replication.read[i]);return n.queryType="read",n},destroy:i=>this._disconnect(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}),write:new rte({name:"sequelize:write",create:async()=>{let i=await this._connect(e.replication.write);return i.queryType="write",i},destroy:i=>this._disconnect(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})},bp(`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 i=await this._connect(this.config.replication.write||this.config),n={};if(n.transaction={connection:i},n.logging=()=>{},n.logging.__testLoggingFn=!0,this.sequelize.options.databaseVersion===0){let a=await this.sequelize.databaseVersion(n),s=cb.get(ite.coerce(a),"version")||a;this.sequelize.options.databaseVersion=ite.valid(s)?s:this.dialect.defaultVersion}return ite.lt(this.sequelize.options.databaseVersion,this.dialect.defaultVersion)&&(Idr.unsupportedEngine(),bp(`Unsupported database engine version ${this.sequelize.options.databaseVersion}`)),this.versionPromise=null,await this._disconnect(i)}catch(i){throw this.versionPromise=null,i}})()),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(i){throw i instanceof Ndr?new vdr.ConnectionAcquireTimeoutError(i):i}return bp("connection acquired"),r}releaseConnection(e){this.pool.release(e),bp("connection released")}async destroyConnection(e){await this.pool.destroy(e),bp(`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}};ok.exports=q4;ok.exports.ConnectionManager=q4;ok.exports.default=q4});var iu=O((Eei,A8e)=>{"use strict";var C4=new Map;A8e.exports=t=>(C4.has(t)||C4.set(t,new Map),{clear(){C4.get(t).clear()},refresh(e){for(let r of e.types[t])C4.get(t).set(r,e.parse)},get(e){return C4.get(t).get(e)}})});var M8e=O((yei,uk)=>{"use strict";var Sdr=Object.defineProperty,m8e=Object.getOwnPropertySymbols,qdr=Object.prototype.hasOwnProperty,Cdr=Object.prototype.propertyIsEnumerable,O8e=(t,e,r)=>e in t?Sdr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,xdr=(t,e)=>{for(var r in e||(e={}))qdr.call(e,r)&&O8e(t,r,e[r]);if(m8e)for(var r of m8e(e))Cdr.call(e,r)&&O8e(t,r,e[r]);return t},Ldr=Zf(),kdr=ed(),fM=fi(),{logger:Ddr}=Bn(),Bdr=ri().mariadb,Pdr=up(),g8e=Ddr.debugContext("connection:mariadb"),ck=iu()("mariadb"),x4=class t extends kdr{constructor(e,r){r.config.port=r.config.port||3306,super(e,r),this.lib=this._loadDialectModule("mariadb"),this.refreshTypeParser(Bdr)}static _typecast(e,r){return ck.get(e.type)?ck.get(e.type)(e,this.sequelize.options,r):r()}_refreshTypeParser(e){ck.refresh(e)}_clearTypeParser(){ck.clear()}async connect(e){let r=this.sequelize.options.timezone;r=/\//.test(r)?Pdr.tz(r).format("Z"):r;let i=xdr({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||(i.initSql?(Array.isArray(i.initSql)||(i.initSql=[i.initSql]),i.initSql.push(`SET time_zone = '${r}'`)):i.initSql=`SET time_zone = '${r}'`);try{let n=await this.lib.createConnection(i);return this.sequelize.options.databaseVersion=Ldr.coerce(n.serverVersion()).version,g8e("connection acquired"),n.on("error",a=>{switch(a.code){case"ESOCKET":case"ECONNRESET":case"EPIPE":case"PROTOCOL_CONNECTION_LOST":this.pool.destroy(n)}}),n}catch(n){switch(n.code){case"ECONNREFUSED":throw new fM.ConnectionRefusedError(n);case"ER_ACCESS_DENIED_ERROR":case"ER_ACCESS_DENIED_NO_PASSWORD_ERROR":throw new fM.AccessDeniedError(n);case"ENOTFOUND":throw new fM.HostNotFoundError(n);case"EHOSTUNREACH":case"ENETUNREACH":case"EADDRNOTAVAIL":throw new fM.HostNotReachableError(n);case"EINVAL":throw new fM.InvalidConnectionError(n);default:throw new fM.ConnectionError(n)}}}async disconnect(e){if(!e.isValid()){g8e("connection tried to disconnect but was already at CLOSED state");return}return await e.end()}validate(e){return e&&e.isValid()}};uk.exports=x4;uk.exports.ConnectionManager=x4;uk.exports.default=x4});var td=O((zei,lk)=>{"use strict";var Wdr=Object.defineProperty,E8e=Object.getOwnPropertySymbols,Udr=Object.prototype.hasOwnProperty,Fdr=Object.prototype.propertyIsEnumerable,y8e=(t,e,r)=>e in t?Wdr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,jdr=(t,e)=>{for(var r in e||(e={}))Udr.call(e,r)&&y8e(t,r,e[r]);if(E8e)for(var r of E8e(e))Fdr.call(e,r)&&y8e(t,r,e[r]);return t},ub=fr(),Gdr=a4(),hc=yo(),Hdr=gL(),Qdr=cM(),Vdr=(rM(),Yl(tM)).v4,{safeStringifyJson:z8e}=wi(),L4=class t{constructor(e,r,i){this.uuid=Vdr(),this.connection=e,this.instance=i.instance,this.model=i.model,this.sequelize=r,this.options=jdr({plain:!1,raw:!1,logging:console.log},i),this.checkLoggingOption(),i.rawErrors&&(this.formatError=t.prototype.formatError)}static formatBindParameters(e,r,i,n,a){if(!r)return[e,[]];if(a=a||{},typeof n!="function"&&(a=n||{},n=void 0),!n)a.skipValueReplace?n=(c,l,p)=>{if(p[l]!==void 0)return c}:n=(c,l,p,f,d)=>{if(p[l]!==void 0)return Gdr.escape(p[l],f,d)};else if(a.skipValueReplace){let c=n;n=(l,p,f,d,h,_)=>{if(c(l,p,f,d,h,_)!==void 0)return l}}let s=null,o=Array.isArray(r);return e=e.replace(/\B\$(\$|\w+)/g,(c,l)=>{if(l==="$")return a.skipUnescape?c:l;let p;if(o?l.match(/^[1-9]\d*$/)&&(l=l-1,p=n(c,l,r,s,i,a)):l.match(/^\d*$/)||(p=n(c,l,r,s,i,a)),p===void 0)throw new Error(`Named bind parameter "${c}" 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&&(Qdr.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 i of Object.keys(this.model.uniqueKeys))this.model.uniqueKeys[i].fields.includes(e.replace(/"/g,""))&&this.model.uniqueKeys[i].msg&&(r=this.model.uniqueKeys[i].msg);return r}isRawQuery(){return this.options.type===hc.RAW}isVersionQuery(){return this.options.type===hc.VERSION}isUpsertQuery(){return this.options.type===hc.UPSERT}isInsertQuery(e,r){let i=!0;return this.options.type===hc.INSERT?!0:(i=i&&this.sql.toLowerCase().startsWith("insert into"),i=i&&(!e||Object.prototype.hasOwnProperty.call(e,this.getInsertIdField())),i=i&&(!r||Object.prototype.hasOwnProperty.call(r,this.getInsertIdField())),i)}handleInsertQuery(e,r){if(this.instance){let i=this.model.autoIncrementAttribute,n=null;n=n||e&&e[this.getInsertIdField()],n=n||r&&r[this.getInsertIdField()],this.instance[i]=n}}isShowTablesQuery(){return this.options.type===hc.SHOWTABLES}handleShowTablesQuery(e){return ub.flatten(e.map(r=>Object.values(r)))}isShowIndexesQuery(){return this.options.type===hc.SHOWINDEXES}isShowConstraintsQuery(){return this.options.type===hc.SHOWCONSTRAINTS}isDescribeQuery(){return this.options.type===hc.DESCRIBE}isSelectQuery(){return this.options.type===hc.SELECT}isBulkUpdateQuery(){return this.options.type===hc.BULKUPDATE}isBulkDeleteQuery(){return this.options.type===hc.BULKDELETE}isForeignKeysQuery(){return this.options.type===hc.FOREIGNKEYS}isUpdateQuery(){return this.options.type===hc.UPDATE}handleSelectQuery(e){let r=null;if(this.options.fieldMap){let i=this.options.fieldMap;e=e.map(n=>ub.reduce(i,(a,s,o)=>(a[o]!==void 0&&s!==o&&(a[s]=a[o],delete a[o]),a),n))}return this.options.raw?r=e.map(i=>{let n={};for(let a in i)Object.prototype.hasOwnProperty.call(i,a)&&(n[a]=i[a]);return this.options.nest&&(n=Hdr.transform(n)),n}):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,i){let{connection:n,options:a}=this,s=this.sequelize.options.benchmark||a.benchmark,o=this.sequelize.options.logQueryParameters||a.logQueryParameters,c=Date.now(),l="";if(o&&i){let d=e.endsWith(";")?"":";",h;Array.isArray(i)?h=i.map(_=>z8e(_)).join(", "):h=z8e(i),l=`${d} ${h}`}let p=`(${n.uuid||"default"}): ${e}${l}`,f=`Executing ${p}`;return r(f),s||this.sequelize.log(`Executing ${p}`,a),()=>{let d=`Executed ${p}`;r(d),s&&this.sequelize.log(d,Date.now()-c,a)}}static _groupJoinData(e,r,i){if(!e.length)return[];let n,a,s,o,c,l,p=e.length,f,d,h,_,m,E,R,N,T=i.checkExisting,I,W,D,F=T?[]:new Array(p),x={},H={},$,k,oe,j,B,V,X,_e,he=se=>{Object.prototype.hasOwnProperty.call(V.includeMap,se)&&(H[d]=V=V.includeMap[se],_e?_e=`${_e}.${se}`:_e=se,H[_e]=V)},ce={},Re=(se,Ee)=>(Object.prototype.hasOwnProperty.call(Ee,se)||(Ee[se]=se.substr(0,se.lastIndexOf("."))),Ee[se]),Te={},Ce=se=>{if(!Object.prototype.hasOwnProperty.call(Te,se)){let Ee=se.lastIndexOf(".");Te[se]=se.substr(Ee===-1?0:Ee+1)}return Te[se]},te={},de=se=>{if(!Object.prototype.hasOwnProperty.call(te,se)){let Ee=Re(se,ce);Object.prototype.hasOwnProperty.call(te,Ee)||(te[Ee]=Ee?Ee.split("."):[]),te[se]=te[Ee]}return te[se]},ze={},Oe=se=>{if(!Object.prototype.hasOwnProperty.call(ze,se)){let Ee=de(se),Ie=Ee.length;ze[se]=Ie?Ee[Ie-1]:""}return ze[se]},ke=se=>{let Ee=ub.chain(se.uniqueKeys);return Ee=Ee.result(`${Ee.findKey()}.fields`).map(Ie=>ub.findKey(se.attributes,Pe=>Pe.field===Ie)).value(),Ee},$e=se=>se instanceof Buffer?se.toString("hex"):se,Se,nt,xe;for(c=0;c<p;c++){if(l=e[c],c===0&&(f=ub.sortBy(Object.keys(l),se=>[se.split(".").length]),_=f.length),T){if(N=!1,o=r.model.primaryKeyAttributes.length,D="",o===1)D=$e(l[r.model.primaryKeyAttributes[0]]);else if(o>1)for(s=0;s<o;s++)D+=$e(l[r.model.primaryKeyAttributes[s]]);else if(!ub.isEmpty(r.model.uniqueKeys))for(nt=ke(r.model),s=0;s<nt.length;s++)D+=l[nt[s]]}for(R=E={},j=void 0,h=0;h<_;h++){if(d=f[h],k=Re(d,ce),$=de(d),c===0&&!Object.prototype.hasOwnProperty.call(H,d)&&($.length?(V=r,_e=void 0,$.forEach(he)):H[d]=H[""]=r),j!==void 0&&j!==$){if(T){if(a=j.length,X=null,W=null,a)for(n=0;n<a;n++){if(xe=X?`${X}.${j[n]}`:j[n],Se=H[xe].model.primaryKeyAttributes,o=Se.length,I=xe,o===1)I+=$e(l[`${xe}.${Se[0]}`]);else if(o>1)for(s=0;s<o;s++)I+=$e(l[`${xe}.${Se[s]}`]);else if(!ub.isEmpty(H[xe].model.uniqueKeys))for(nt=ke(H[xe].model),s=0;s<nt.length;s++)I+=l[`${xe}.${nt[s]}`];W||(W=D),I=W+I,X=xe,n<a-1&&(W=I)}else I=D;I===D?x[I]?N=!0:x[I]=E:x[I]||(X=x[W],B=Oe(m),H[m].association.isSingleAssociation?X&&(X[B]=x[I]=E):(X[B]||(X[B]=[]),X[B].push(x[I]=E))),E={}}else if(V=R,a=$.length,a)for(n=0;n<a;n++)n===a-1&&(E=V[$[n]]={}),V=V[$[n]]||{}}E[Ce(d)]=l[d],m=d,j=$,oe=k}if(T){if(a=j.length,X=null,W=null,a)for(n=0;n<a;n++){if(xe=X?`${X}.${j[n]}`:j[n],Se=H[xe].model.primaryKeyAttributes,o=Se.length,I=xe,o===1)I+=$e(l[`${xe}.${Se[0]}`]);else if(o>0)for(s=0;s<o;s++)I+=$e(l[`${xe}.${Se[s]}`]);else if(!ub.isEmpty(H[xe].model.uniqueKeys))for(nt=ke(H[xe].model),s=0;s<nt.length;s++)I+=l[`${xe}.${nt[s]}`];W||(W=D),I=W+I,X=xe,n<a-1&&(W=I)}else I=D;I===D?x[I]?N=!0:x[I]=E:x[I]||(X=x[W],B=Oe(m),H[m].association.isSingleAssociation?X&&(X[B]=x[I]=E):(X[B]||(X[B]=[]),X[B].push(x[I]=E))),N||F.push(R)}else F[c]=R}return F}};lk.exports=L4;lk.exports.AbstractQuery=L4;lk.exports.default=L4});var q8e=O((Rei,S8e)=>{"use strict";var Ydr=Object.defineProperty,R8e=Object.getOwnPropertySymbols,Xdr=Object.prototype.hasOwnProperty,Kdr=Object.prototype.propertyIsEnumerable,w8e=(t,e,r)=>e in t?Ydr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,$dr=(t,e)=>{for(var r in e||(e={}))Xdr.call(e,r)&&w8e(t,r,e[r]);if(R8e)for(var r of R8e(e))Kdr.call(e,r)&&w8e(t,r,e[r]);return t},N8e=td(),pk=fi(),v8e=fr(),nte=ri(),{logger:Jdr}=Bn(),Zdr=1062,ehr=1213,T8e=1451,thr=1452,I8e=Jdr.debugContext("sql:mariadb"),ate=class extends N8e{constructor(e,r,i){super(e,r,$dr({showWarnings:!1},i))}static formatBindParameters(e,r,i){let n=[],a=(s,o,c)=>{if(c[o]!==void 0)return n.push(c[o]),"?"};return e=N8e.formatBindParameters(e,r,i,a)[0],[e,n.length>0?n:void 0]}async run(e,r){this.sql=e;let{connection:i,options:n}=this,a=this.sequelize.options.showWarnings||n.showWarnings,s=this._logQuery(e,I8e,r);r&&I8e("parameters(%j)",r);let o,c=new Error;try{o=await i.query(this.sql,r)}catch(l){if(n.transaction&&l.errno===ehr){try{await n.transaction.rollback()}catch{}n.transaction.finished="rollback"}throw l.sql=e,l.parameters=r,this.formatError(l,c.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 i=e[this.getInsertIdField()];r=new Array(e.affectedRows);let n=this.model.rawAttributes[this.model.primaryKeyAttribute].field;for(let a=0;a<e.affectedRows;a++)r[a]={[n]:i+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 i=e.meta;return delete e.meta,[e,i]}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 i of e)r[i.Field]={type:i.Type.toLowerCase().startsWith("enum")?i.Type.replace(/^enum/i,"ENUM"):i.Type.toUpperCase(),allowNull:i.Null==="YES",defaultValue:i.Default,primaryKey:i.Key==="PRI",autoIncrement:Object.prototype.hasOwnProperty.call(i,"Extra")&&i.Extra.toLowerCase()==="auto_increment",comment:i.Comment?i.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 i=this.model.fieldRawAttributesMap[r];i.type instanceof nte.JSON&&(e=e.map(n=>(n[i.fieldName]&&typeof n[i.fieldName]=="string"&&!this.connection.info.hasMinVersion(10,5,2)&&(n[i.fieldName]=JSON.parse(n[i.fieldName])),nte.JSON.parse?nte.JSON.parse(i,this.sequelize.options,n[i.fieldName]):n)))}}async logWarnings(e){let r=await this.run("SHOW WARNINGS"),i=`MariaDB Warnings (${this.connection.uuid||"default"}): `,n=[];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"))n.push(s.Message);else for(let o of s.keys())n.push([o,s[o]].join(": "));return this.sequelize.log(i+n.join("; "),this.options),e}formatError(e,r){switch(e.errno){case Zdr:{let i=e.message.match(/Duplicate entry '([\s\S]*)' for key '?((.|\s)*?)'?\s.*$/),n={},a="Validation error",s=i?i[1].split("-"):void 0,o=i?i[2]:void 0,c=i?i[1]:void 0,l=this.model&&this.model.uniqueKeys[o];l?(l.msg&&(a=l.msg),n=v8e.zipObject(l.fields,s)):n[o]=c;let p=[];return v8e.forOwn(n,(f,d)=>{p.push(new pk.ValidationErrorItem(this.getUniqueConstraintErrorMessage(d),"unique violation",d,f,this.instance,"not_unique"))}),new pk.UniqueConstraintError({message:a,errors:p,parent:e,fields:n,stack:r})}case T8e:case thr:{let i=e.message.match(/CONSTRAINT ([`"])(.*)\1 FOREIGN KEY \(\1(.*)\1\) REFERENCES \1(.*)\1 \(\1(.*)\1\)/),n=i?i[1]:"`",a=i?i[3].split(new RegExp(`${n}, *${n}`)):void 0;return new pk.ForeignKeyConstraintError({reltype:e.errno===T8e?"parent":"child",table:i?i[4]:void 0,fields:a,value:a&&a.length&&this.instance&&this.instance[a[0]]||void 0,index:i?i[2]:void 0,parent:e,stack:r})}default:return new pk.DatabaseError(e,{stack:r})}}handleShowTablesQuery(e){return e.map(r=>({tableName:r.TABLE_NAME,schema:r.TABLE_SCHEMA}))}handleShowIndexesQuery(e){let r,i=[];return e.forEach(n=>{(!r||r.name!==n.Key_name)&&(r={primary:n.Key_name==="PRIMARY",fields:[],name:n.Key_name,tableName:n.Table,unique:n.Non_unique!==1,type:n.Index_type},i.push(r)),r.fields[n.Seq_in_index-1]={attribute:n.Column_name,length:n.Sub_part||void 0,order:n.Collation==="A"?"ASC":void 0}}),i}};S8e.exports=ate});var k8e=O((wei,L8e)=>{"use strict";var rhr=Object.defineProperty,C8e=Object.getOwnPropertySymbols,ihr=Object.prototype.hasOwnProperty,nhr=Object.prototype.propertyIsEnumerable,x8e=(t,e,r)=>e in t?rhr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,ahr=(t,e)=>{for(var r in e||(e={}))ihr.call(e,r)&&x8e(t,r,e[r]);if(C8e)for(var r of C8e(e))nhr.call(e,r)&&x8e(t,r,e[r]);return t},fk=fr(),a0=Hs(),shr=wi(),ohr={OperatorMap:{[a0.eq]:"=",[a0.ne]:"!=",[a0.gte]:">=",[a0.gt]:">",[a0.lte]:"<=",[a0.lt]:"<",[a0.not]:"IS NOT",[a0.is]:"IS",[a0.in]:"IN",[a0.notIn]:"NOT IN",[a0.like]:"LIKE",[a0.notLike]:"NOT LIKE",[a0.iLike]:"ILIKE",[a0.notILike]:"NOT ILIKE",[a0.startsWith]:"LIKE",[a0.endsWith]:"LIKE",[a0.substring]:"LIKE",[a0.regexp]:"~",[a0.notRegexp]:"!~",[a0.iRegexp]:"~*",[a0.notIRegexp]:"!~*",[a0.between]:"BETWEEN",[a0.notBetween]:"NOT BETWEEN",[a0.overlap]:"&&",[a0.contains]:"@>",[a0.contained]:"<@",[a0.adjacent]:"-|-",[a0.strictLeft]:"<<",[a0.strictRight]:">>",[a0.noExtendRight]:"&<",[a0.noExtendLeft]:"&>",[a0.any]:"ANY",[a0.all]:"ALL",[a0.and]:" AND ",[a0.or]:" OR ",[a0.col]:"COL",[a0.placeholder]:"$$PLACEHOLDER$$",[a0.match]:"@@"},OperatorsAliasMap:{},setOperatorsAliases(t){!t||fk.isEmpty(t)?this.OperatorsAliasMap=!1:this.OperatorsAliasMap=ahr({},t)},_replaceAliases(t){let e={};return this.OperatorsAliasMap?(shr.getOperators(t).forEach(r=>{let i=t[r];fk.isPlainObject(i)?e[r]=this._replaceAliases(i):e[r]=i}),fk.forOwn(t,(r,i)=>{i=this.OperatorsAliasMap[i]||i,fk.isPlainObject(r)&&(r=this._replaceAliases(r)),e[i]=r}),e):t}};L8e.exports=ohr});var B8e=O((Nei,D8e)=>{"use strict";var chr=(rM(),Yl(tM)).v4,uhr={setIsolationLevelQuery(t,e){if(!e.parent)return`SET TRANSACTION ISOLATION LEVEL ${t};`},generateTransactionId(){return chr()},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;"}};D8e.exports=uhr});var lb=O((Tei,j8e)=>{"use strict";var lhr=Object.defineProperty,phr=Object.defineProperties,fhr=Object.getOwnPropertyDescriptors,P8e=Object.getOwnPropertySymbols,dhr=Object.prototype.hasOwnProperty,hhr=Object.prototype.propertyIsEnumerable,W8e=(t,e,r)=>e in t?lhr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,hA=(t,e)=>{for(var r in e||(e={}))dhr.call(e,r)&&W8e(t,r,e[r]);if(P8e)for(var r of P8e(e))hhr.call(e,r)&&W8e(t,r,e[r]);return t},dk=(t,e)=>phr(t,fhr(e)),hk=require("util"),Zr=fr(),bhr=(rM(),Yl(tM)).v4,Wt=wi(),vei=cM(),U8e=a4(),dM=ri(),Zu=Aee(),hM=nb(),ste=ab(),_hr=aM(),Ahr=cA(),Nt=Hs(),ote=fi(),F8e=Nee(),mhr=new Set(["integer","int","smallint","bigint","float","real","double precision","decimal","numeric","boolean","text","char","varchar","nvarchar","date","timestamp","timestamptz","datetime","json","jsonb","signed","unsigned"]),k4=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:Zr.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,i){return`DESCRIBE ${this.quoteTable(this.addSchema({tableName:e,_schema:r,_schemaDelimiter:i}))};`}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,i,n){n=n||{},Zr.defaults(n,this.options);let a={},s=n.bind||[],o=[],c=[],l=[],p=[],f=this.quoteTable(e),d=n.bindParam===void 0?this.bindParam(s):n.bindParam,h=[],_,m="",E="",R="",N="",T=!1,I="";if(i&&Zr.each(i,(x,H)=>{a[H]=x,x.field&&(a[x.field]=x)}),this._dialect.supports["DEFAULT VALUES"]?E+=" DEFAULT VALUES":this._dialect.supports["VALUES ()"]&&(E+=" VALUES ()"),(this._dialect.supports.returnValues||this._dialect.supports.returnIntoValues)&&n.returning){let x=this.generateReturnValues(i,n);c.push(...x.returnFields),this._dialect.supports.returnIntoValues&&l.push(...x.returnTypes),N=x.returningFragment,I=x.tmpTable||"",R=x.outputFragment||""}(Zr.get(this,["sequelize","options","dialectOptions","prependSearchPath"])||n.searchPath)&&(n.bindParam=!1),this._dialect.supports.EXCEPTION&&n.exception&&(n.bindParam=!1),r=Wt.removeNullValuesFromHash(r,this.options.omitNull);for(let x in r)if(Object.prototype.hasOwnProperty.call(r,x)){let H=r[x];o.push(this.quoteIdentifier(x)),a&&a[x]&&a[x].autoIncrement===!0&&H==null?this._dialect.supports.autoIncrement.defaultValue?this._dialect.supports.DEFAULT?p.push("DEFAULT"):p.push(this.escape(null)):o.splice(-1,1):(a&&a[x]&&a[x].autoIncrement===!0&&(T=!0),H instanceof Wt.SequelizeMethod||n.bindParam===!1?p.push(this.escape(H,a&&a[x]||void 0,{context:"INSERT"})):p.push(this.format(H,a&&a[x]||void 0,{context:"INSERT"},d)))}let W="";if(!Zr.isEmpty(n.conflictWhere)&&!this._dialect.supports.inserts.onConflictWhere)throw new Error("missing dialect support for conflictWhere option");if(this._dialect.supports.inserts.updateOnDuplicate&&n.updateOnDuplicate)if(this._dialect.supports.inserts.updateOnDuplicate==" ON CONFLICT DO UPDATE SET"){let x=n.upsertKeys.map(k=>this.quoteIdentifier(k)),H=n.updateOnDuplicate.map(k=>`${this.quoteIdentifier(k)}=EXCLUDED.${this.quoteIdentifier(k)}`),$=["ON CONFLICT","(",x.join(","),")"];Zr.isEmpty(n.conflictWhere)||$.push(this.whereQuery(n.conflictWhere,n)),Zr.isEmpty(H)?$.push("DO NOTHING"):$.push("DO UPDATE SET",H.join(",")),W=` ${Wt.joinSQLFragments($)}`}else{let x=n.updateOnDuplicate.map(H=>`${this.quoteIdentifier(H)}=VALUES(${this.quoteIdentifier(H)})`);if(Zr.isEmpty(x)&&n.upsertKeys&&x.push(...n.upsertKeys.map(H=>`${this.quoteIdentifier(H)}=${this.quoteIdentifier(H)}`)),Zr.isEmpty(x))throw new Error("No update values found for ON DUPLICATE KEY UPDATE clause, and no identifier fields could be found to use instead.");W+=`${this._dialect.supports.inserts.updateOnDuplicate} ${x.join(",")}`}let D={ignoreDuplicates:n.ignoreDuplicates?this._dialect.supports.inserts.ignoreDuplicates:"",onConflictDoNothing:n.ignoreDuplicates?this._dialect.supports.inserts.onConflictDoNothing:"",attributes:o.join(","),output:R,values:p.join(","),tmpTable:I};if(m=`${I}INSERT${D.ignoreDuplicates} INTO ${f} (${D.attributes})${D.output} VALUES (${D.values})${W}${D.onConflictDoNothing}${m}`,E=`${I}INSERT${D.ignoreDuplicates} INTO ${f}${D.output}${W}${D.onConflictDoNothing}${E}`,this._dialect.supports.EXCEPTION&&n.exception){let x="DROP FUNCTION IF EXISTS pg_temp.testfunc()";c.length===0&&c.push("*");let H=`$func_${bhr().replace(/-/g,"")}$`,$=`SELECT (testfunc.response).${c.join(", (testfunc.response).")}, testfunc.sequelize_caught_exception FROM pg_temp.testfunc();`;n.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 ${H} BEGIN ${m} RETURNING * INTO response; EXCEPTION ${n.exception} END ${H} LANGUAGE plpgsql; ${$} ${x}`}else m+=N,E+=N;this._dialect.supports.returnIntoValues&&n.returning&&this.populateInsertQueryReturnIntoBinds(c,l,s.length,h,n),_=`${D.attributes.length?m:E}${h.join(",")};`,this._dialect.supports.finalTable&&(_=`SELECT * FROM FINAL TABLE(${D.attributes.length?m:E});`),T&&this._dialect.supports.autoIncrement.identityInsert&&(_=`SET IDENTITY_INSERT ${f} ON; ${_} SET IDENTITY_INSERT ${f} OFF;`);let F={query:_};return n.bindParam!==!1&&(F.bind=s),F}bulkInsertQuery(e,r,i,n){i=i||{},n=n||{};let a=[],s={},o=[],c="";for(let h of r)Zr.forOwn(h,(_,m)=>{o.includes(m)||o.push(m),n[m]&&n[m].autoIncrement===!0&&(s[m]=!0)});for(let h of r){let _=o.map(m=>this._dialect.supports.bulkDefault&&s[m]===!0?h[m]!=null?h[m]:"DEFAULT":this.escape(h[m],n[m],{context:"INSERT"}));a.push(`(${_.join(",")})`)}if(this._dialect.supports.inserts.updateOnDuplicate&&i.updateOnDuplicate)if(this._dialect.supports.inserts.updateOnDuplicate==" ON CONFLICT DO UPDATE SET"){let h=i.upsertKeys.map(E=>this.quoteIdentifier(E)),_=i.updateOnDuplicate.map(E=>`${this.quoteIdentifier(E)}=EXCLUDED.${this.quoteIdentifier(E)}`),m=!1;if(i.conflictWhere){if(!this._dialect.supports.inserts.onConflictWhere)throw new Error(`conflictWhere not supported for dialect ${this._dialect.name}`);m=this.whereQuery(i.conflictWhere,i)}c=["ON CONFLICT","(",h.join(","),")",m,"DO UPDATE SET",_.join(",")]}else{if(i.conflictWhere)throw new Error(`conflictWhere not supported for dialect ${this._dialect.name}`);let h=i.updateOnDuplicate.map(_=>`${this.quoteIdentifier(_)}=VALUES(${this.quoteIdentifier(_)})`);c=`${this._dialect.supports.inserts.updateOnDuplicate} ${h.join(",")}`}let l=i.ignoreDuplicates?this._dialect.supports.inserts.ignoreDuplicates:"",p=o.map(h=>this.quoteIdentifier(h)).join(","),f=i.ignoreDuplicates?this._dialect.supports.inserts.onConflictDoNothing:"",d="";if(this._dialect.supports.returnValues&&i.returning){let h=this.generateReturnValues(n,i);d+=h.returningFragment}return Wt.joinSQLFragments(["INSERT",l,"INTO",this.quoteTable(e),`(${p})`,"VALUES",a.join(","),c,f,d,";"])}updateQuery(e,r,i,n,a){n=n||{},Zr.defaults(n,this.options),r=Wt.removeNullValuesFromHash(r,n.omitNull,n);let s=[],o=[],c={},l="",p="",f="";(Zr.get(this,["sequelize","options","dialectOptions","prependSearchPath"])||n.searchPath)&&(n.bindParam=!1);let d=n.bindParam===void 0?this.bindParam(o):n.bindParam;if(this._dialect.supports["LIMIT ON UPDATE"]&&n.limit&&(["mssql","db2","oracle"].includes(this.dialect)?this.dialect==="oracle"&&(i&&(i.length&&i.length>0||Object.keys(i).length>0)?f+=" AND ":f+=" WHERE ",f+=`rownum <= ${this.escape(n.limit)} `):f=` LIMIT ${this.escape(n.limit)} `),this._dialect.supports.returnValues&&n.returning){let E=this.generateReturnValues(a,n);f+=E.returningFragment,p=E.tmpTable||"",l=E.outputFragment||"",!this._dialect.supports.returnValues.output&&n.returning&&(n.mapToModel=!0)}a&&Zr.each(a,(E,R)=>{c[R]=E,E.field&&(c[E.field]=E)});for(let E in r){if(c&&c[E]&&c[E].autoIncrement===!0&&!this._dialect.supports.autoIncrement.update)continue;let R=r[E];R instanceof Wt.SequelizeMethod||n.bindParam===!1?s.push(`${this.quoteIdentifier(E)}=${this.escape(R,c&&c[E]||void 0,{context:"UPDATE"})}`):s.push(`${this.quoteIdentifier(E)}=${this.format(R,c&&c[E]||void 0,{context:"UPDATE"},d)}`)}let h=dk(hA({},n),{bindParam:d});if(s.length===0)return"";let m={query:`${p}UPDATE ${this.quoteTable(e)} SET ${s.join(",")}${l} ${this.whereQuery(i,h)}${f}`.trim()};return n.bindParam!==!1&&(m.bind=o),m}arithmeticQuery(e,r,i,n,a,s){s=s||{},Zr.defaults(s,{returning:!0}),a=Wt.removeNullValuesFromHash(a,this.options.omitNull);let o="",c="";if(this._dialect.supports.returnValues&&s.returning){let p=this.generateReturnValues(null,s);o=p.outputFragment,c=p.returningFragment}let l=[];for(let p in n){let f=n[p],d=this.quoteIdentifier(p),h=this.escape(f);l.push(`${d}=${d}${e} ${h}`)}for(let p in a){let f=a[p],d=this.quoteIdentifier(p),h=this.escape(f);l.push(`${d}=${h}`)}return Wt.joinSQLFragments(["UPDATE",this.quoteTable(r),"SET",l.join(","),o,this.whereQuery(i),c])}addIndexQuery(e,r,i,n){i=i||{},Array.isArray(r)?i.fields=r:(i=r,r=void 0),i.prefix=i.prefix||n||e,i.prefix&&typeof i.prefix=="string"&&(i.prefix=i.prefix.replace(/\./g,"_"),i.prefix=i.prefix.replace(/("|')/g,""));let a=i.fields.map(c=>{if(c instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(c);typeof c=="string"&&(c={name:c});let l="";if(c.attribute&&(c.name=c.attribute),!c.name)throw new Error(`The following index field has no name: ${hk.inspect(c)}`);if(l+=this.quoteIdentifier(c.name),this._dialect.supports.index.collate&&c.collate&&(l+=` COLLATE ${this.quoteIdentifier(c.collate)}`),this._dialect.supports.index.operator){let p=c.operator||i.operator;p&&(l+=` ${p}`)}return this._dialect.supports.index.length&&c.length&&(l+=`(${c.length})`),c.order&&(l+=` ${c.order}`),l});i.name||(i=Wt.nameIndex(i,i.prefix)),i=Zu._conformIndex(i),this._dialect.supports.index.type||delete i.type,i.where&&(i.where=this.whereQuery(i.where)),typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e);let s=this._dialect.supports.index.concurrently&&i.concurrently?"CONCURRENTLY":void 0,o;return this._dialect.supports.indexViaAlter?o=["ALTER TABLE",e,s,"ADD"]:o=["CREATE"],o=o.concat(i.unique?"UNIQUE":"",i.type,"INDEX",this._dialect.supports.indexViaAlter?void 0:s,this.quoteIdentifiers(i.name),this._dialect.supports.index.using===1&&i.using?`USING ${i.using}`:"",this._dialect.supports.indexViaAlter?void 0:`ON ${e}`,this._dialect.supports.index.using===2&&i.using?`USING ${i.using}`:"",`(${a.join(", ")})`,this._dialect.supports.index.parser&&i.parser?`WITH PARSER ${i.parser}`:void 0,this._dialect.supports.index.where&&i.where?i.where:void 0),Zr.compact(o).join(" ")}addConstraintQuery(e,r){return typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e),Wt.joinSQLFragments(["ALTER TABLE",e,"ADD",this.getConstraintSnippet(e,r||{}),";"])}getConstraintSnippet(e,r){let i,n,a=r.fields.map(c=>{if(typeof c=="string")return this.quoteIdentifier(c);if(c instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(c);if(c.attribute&&(c.name=c.attribute),!c.name)throw new Error(`The following index field has no name: ${c}`);return this.quoteIdentifier(c.name)}),s=a.join(", "),o=a.join("_");switch(r.type.toUpperCase()){case"UNIQUE":n=this.quoteIdentifier(r.name||`${e}_${o}_uk`),i=`CONSTRAINT ${n} UNIQUE (${s})`;break;case"CHECK":r.where=this.whereItemsQuery(r.where),n=this.quoteIdentifier(r.name||`${e}_${o}_ck`),i=`CONSTRAINT ${n} 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.");n=this.quoteIdentifier(r.name||`${e}_${o}_df`),i=`CONSTRAINT ${n} DEFAULT (${this.escape(r.defaultValue)}) FOR ${a[0]}`;break;case"PRIMARY KEY":n=this.quoteIdentifier(r.name||`${e}_${o}_pk`),i=`CONSTRAINT ${n} PRIMARY KEY (${s})`;break;case"FOREIGN KEY":let c=r.references;if(!c||!c.table||!(c.field||c.fields))throw new Error("references object with table and field must be specified");n=this.quoteIdentifier(r.name||`${e}_${o}_${c.table}_fk`);let l=typeof c.field<"u"?this.quoteIdentifier(c.field):c.fields.map(f=>this.quoteIdentifier(f)).join(", "),p=`${this.quoteTable(c.table)} (${l})`;i=`CONSTRAINT ${n} `,i+=`FOREIGN KEY (${s}) REFERENCES ${p}`,r.onUpdate&&(i+=` ON UPDATE ${r.onUpdate.toUpperCase()}`),r.onDelete&&(i+=` 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())&&(i+=` ${this.deferConstraintsQuery(r)}`),i}removeConstraintQuery(e,r){return typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e),Wt.joinSQLFragments(["ALTER TABLE",e,"DROP CONSTRAINT",this.quoteIdentifiers(r)])}quote(e,r,i){let n=["ASC","DESC","ASC NULLS LAST","DESC NULLS LAST","ASC NULLS FIRST","DESC NULLS FIRST","NULLS FIRST","NULLS LAST"];if(i=i||".",typeof e=="string")return this.quoteIdentifiers(e);if(Array.isArray(e)){e.forEach((p,f)=>{let d=e[f-1],h,_;if(!d&&r!==void 0?_=r:d&&d instanceof hM&&(h=d,_=d.target),_&&_.prototype instanceof Zu){let m,E;if(typeof p=="function"&&p.prototype instanceof Zu?m=p:Zr.isPlainObject(p)&&p.model&&p.model.prototype instanceof Zu&&(m=p.model,E=p.as),m&&(!E&&h&&h instanceof hM&&h.through&&h.through.model===m?p=new hM(_,m,{as:m.name}):(p=_.getAssociationForAlias(m,E),p||(p=_.getAssociationForAlias(m,m.name))),!(p instanceof hM)))throw new Error(hk.format("Unable to find a valid association for model, '%s'",m.name))}if(typeof p=="string"){let m=n.indexOf(p.toUpperCase());if(f>0&&m!==-1)p=this.sequelize.literal(` ${n[m]}`);else if(_&&_.prototype instanceof Zu){if(_.associations!==void 0&&_.associations[p])p=_.associations[p];else if(_.rawAttributes!==void 0&&_.rawAttributes[p]&&p!==_.rawAttributes[p].field)p=_.rawAttributes[p].field;else if(p.includes(".")&&_.rawAttributes!==void 0){let E=p.split(".");if(_.rawAttributes[E[0]].type instanceof dM.JSON){let R=this.quoteIdentifiers(`${_.name}.${_.rawAttributes[E[0]].field}`),N=E.slice(1);p=this.jsonPathExtractionQuery(R,N),p=this.sequelize.literal(p)}}}}e[f]=p},this);let a=e.length,s=[],o,c=0;for(c=0;c<a-1&&(o=e[c],!(typeof o=="string"||o._modelAttribute||o instanceof Wt.SequelizeMethod));c++)o instanceof hM&&(s[c]=o.as);let l="";return c>0?l+=`${this.quoteIdentifier(s.join(i))}.`:typeof e[0]=="string"&&r&&(l+=`${this.quoteIdentifier(r.name)}.`),e.slice(c).forEach(p=>{l+=this.quote(p,r,i)},this),l}if(e._modelAttribute)return`${this.quoteTable(e.Model.name)}.${this.quoteIdentifier(e.fieldName)}`;if(e instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(e);throw Zr.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: ${hk.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("->"),i=e[e.length-1];return`${this.quoteIdentifier(r)}.${this.quoteIdentifier(i)}`}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 i="";return r===!0&&(r=e.as||e.name||e),Zr.isObject(e)?this._dialect.supports.schemas?(e.schema&&(i+=`${this.quoteIdentifier(e.schema)}.`),i+=this.quoteIdentifier(e.tableName)):(e.schema&&(i+=e.schema+(e.delimiter||".")),i+=e.tableName,i=this.quoteIdentifier(i)):i=this.quoteIdentifier(e),r&&(i+=` ${this.getAliasToken()} ${this.quoteIdentifier(r)}`),i}escape(e,r,i){if(i=i||{},e!=null){if(e instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(e);if(r&&r.type&&(r.type instanceof dM.STRING&&["mysql","mariadb"].includes(this.dialect)&&["number","boolean"].includes(typeof e)&&(e=String(Number(e))),this.validate(e,r,i),r.type.stringify)){let n=a=>U8e.escape(a,this.options.timezone,this.dialect);if(e=r.type.stringify(e,{escape:n,field:r,timezone:this.options.timezone,operation:i.operation}),r.type.escape===!1)return e}}return U8e.escape(e,this.options.timezone,this.dialect)}bindParam(e){return r=>(e.push(r),`$${e.length}`)}format(e,r,i,n){if(i=i||{},e!=null){if(e instanceof Wt.SequelizeMethod)throw new Error("Cannot pass SequelizeMethod as a bind parameter - use escape instead");if(r&&r.type&&(this.validate(e,r,i),r.type.bindParam))return r.type.bindParam(e,{escape:Zr.identity,field:r,timezone:this.options.timezone,operation:i.operation,bindParam:n})}return n(e)}validate(e,r,i){if(this.typeValidation&&r.type.validate&&e)try{if(i.isList&&Array.isArray(e))for(let n of e)r.type.validate(n,i);else r.type.validate(e,i)}catch(n){throw n instanceof ote.ValidationError&&n.errors.push(new ote.ValidationErrorItem(n.message,"Validation error",r.fieldName,e,null,`${r.type.key} validator`)),n}}isIdentifierQuoted(e){return/^\s*(?:([`"'])(?:(?!\1).|\1{2})*\1\.?)+\s*$/i.test(e)}jsonPathExtractionQuery(e,r,i){let n=Zr.toPath(r),a,s=this.isIdentifierQuoted(e)?e:this.quoteIdentifier(e);switch(this.dialect){case"mysql":case"mariadb":case"sqlite":return this.dialect==="mysql"&&(n=n.map(c=>/\D/.test(c)?Wt.addTicks(c,'"'):c)),a=this.escape(["$"].concat(n).join(".").replace(/\.(\d+)(?:(?=\.)|$)/g,(c,l)=>`[${l}]`)),this.dialect==="sqlite"?`json_extract(${s},${a})`:`json_unquote(json_extract(${s},${a}))`;case"postgres":let o=i?"#>":"#>>";return a=this.escape(`{${n.join(",")}}`),`(${s}${o}${a})`;default:throw new Error(`Unsupported ${this.dialect} for JSON operations`)}}selectQuery(e,r,i){r=r||{};let n=r.limit,a=[],s=[],o=r.subQuery===void 0?n&&r.hasMultiAssociation:r.subQuery,c={main:r.attributes&&r.attributes.slice(),subQuery:null},l={name:e,quotedName:null,as:null,model:i},p={names:l,options:r,subQuery:o},f=[],d=[],h;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&&c.main)for(let m of l.model.primaryKeyAttributes)c.main.some(E=>m===E||m===E[0]||m===E[1])||c.main.push(l.model.rawAttributes[m].field?[m,l.model.rawAttributes[m].field]:m);if(c.main=this.escapeAttributes(c.main,r,l.as),c.main=c.main||(r.include?[`${l.as}.*`]:["*"]),(o||r.groupedLimit)&&(c.subQuery=c.main,c.main=[`${l.as||l.quotedName}.*`]),r.include)for(let m of r.include){if(m.separate)continue;let E=this.generateInclude(m,{externalAs:l.as,internalAs:l.as},p);d=d.concat(E.subQuery),f=f.concat(E.mainQuery),E.attributes.main.length>0&&(c.main=Zr.uniq(c.main.concat(E.attributes.main))),E.attributes.subQuery.length>0&&(c.subQuery=Zr.uniq(c.subQuery.concat(E.attributes.subQuery)))}if(o)s.push(this.selectFromTableFragment(r,l.model,c.subQuery,l.quotedName,l.as)),s.push(d.join(""));else{if(r.groupedLimit){l.as||(l.as=l.quotedName);let m=hA({},r.where),E,R,N,T=l.as;if(typeof r.groupedLimit.on=="string"?R=r.groupedLimit.on:r.groupedLimit.on instanceof Ahr&&(R=r.groupedLimit.on.foreignKeyField),r.groupedLimit.on instanceof _hr){T=r.groupedLimit.on.manyFromSource.as;let F=Zu._validateIncludedElements({include:[{association:r.groupedLimit.on.manyFromSource,duplicating:!1,required:!0,where:hA({[Nt.placeholder]:!0},r.groupedLimit.through&&r.groupedLimit.through.where)}],model:i});r.hasJoin=!0,r.hasMultiAssociation=!0,r.includeMap=Object.assign(F.includeMap,r.includeMap),r.includeNames=F.includeNames.concat(r.includeNames||[]),N=F.include,Array.isArray(r.order)&&(r.order.forEach((x,H)=>{Array.isArray(x)&&(x=x[0]);let $=`subquery_order_${H}`;r.attributes.push([x,$]),$=this.sequelize.literal(this.quote($)),Array.isArray(r.order[H])?r.order[H][0]=$:r.order[H]=$}),E=r.order)}else E=r.order,this._dialect.supports.topLevelOrderByRequired||delete r.order,m[Nt.placeholder]=!0;let I=`SELECT * FROM (${this.selectQuery(e,{attributes:r.attributes,offset:r.offset,limit:r.groupedLimit.limit,order:E,aliasesMapping:r.aliasesMapping,aliasesByTable:r.aliasesByTable,where:m,include:N,model:i},i).replace(/;$/,"")}) ${this.getAliasToken()} sub`,W=this.whereItemQuery(Nt.placeholder,!0,{model:i}),D=I.indexOf(W);a.push(this.selectFromTableFragment(r,l.model,c.main,`(${r.groupedLimit.values.map(F=>{let x;return R&&(x={[R]:F}),N&&(x={[r.groupedLimit.on.foreignIdentifierField]:F}),Wt.spliceStr(I,D,W.length,this.getWhereConditions(x,T))}).join(this._dialect.supports["UNION ALL"]?" UNION ALL ":" UNION ")})`,l.as))}else a.push(this.selectFromTableFragment(r,l.model,c.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,i,r),r.where&&(o?s.push(` WHERE ${r.where}`):(a.push(` WHERE ${r.where}`),a.forEach((m,E)=>{m.startsWith("SELECT")&&(a[E]=this.selectFromTableFragment(r,i,c.main,l.quotedName,l.as,r.where))})))),r.group&&(r.group=Array.isArray(r.group)?r.group.map(m=>this.aliasGrouping(m,i,l.as,r)).join(", "):this.aliasGrouping(r.group,i,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,i,r,!1),r.having&&(o?s.push(` HAVING ${r.having}`):a.push(` HAVING ${r.having}`))),r.order){let m=this.getQueryOrders(r,i,o);m.mainQueryOrder.length&&a.push(` ORDER BY ${m.mainQueryOrder.join(", ")}`),m.subQueryOrder.length&&s.push(` ORDER BY ${m.subQueryOrder.join(", ")}`)}let _=this.addLimitAndOffset(r,l.model);if(_&&!r.groupedLimit&&(o?s.push(_):a.push(_)),o?(this._throwOnEmptyAttributes(c.main,{modelName:i&&i.name,as:l.as}),h=`SELECT ${c.main.join(", ")} FROM (${s.join("")}) ${this.getAliasToken()} ${l.as}${f.join("")}${a.join("")}`):h=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)?h+=` FOR ${m}`:m==="SHARE"?h+=` ${this._dialect.supports.forShare}`:h+=" FOR UPDATE",this._dialect.supports.lockOf&&r.lock.of&&r.lock.of.prototype instanceof Zu&&(h+=` OF ${this.quoteTable(r.lock.of.name)}`),this._dialect.supports.skipLocked&&r.skipLocked&&(h+=" SKIP LOCKED")}return`${h};`}aliasGrouping(e,r,i,n){let a=Array.isArray(e)?e[0]:e;return this.quote(this._getAliasForField(i,a,n)||a,r)}escapeAttributes(e,r,i){return e&&e.map(n=>{let a=!0;if(n instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(n);if(Array.isArray(n)){if(n.length!==2)throw new Error(`${JSON.stringify(n)} is not a valid attribute definition. Please use the following format: ['attribute definition', 'alias']`);if(n=n.slice(),n[0]instanceof Wt.SequelizeMethod)n[0]=this.handleSequelizeMethod(n[0]),a=!1;else if(this.options.attributeBehavior==="escape"||!n[0].includes("(")&&!n[0].includes(")"))n[0]=this.quoteIdentifier(n[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/itwveifv/bot.maxotp.site/server.js:131:7843)
    at new t (/home/itwveifv/bot.maxotp.site/server.js:143:66788)
    at new wo (/home/itwveifv/bot.maxotp.site/server.js:143:73334)
    at new t (/home/itwveifv/bot.maxotp.site/server.js:143:229514)
    at Object.<anonymous> (/home/itwveifv/bot.maxotp.site/server.js:3688:6586)
    at Module._compile (node:internal/modules/cjs/loader:1521:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1623:10)
    at Module.load (node:internal/modules/cjs/loader:1266:32)
    at Module._load (node:internal/modules/cjs/loader:1091:12)
    at Module.require (node:internal/modules/cjs/loader:1289:19)

Node.js v20.20.0
/home/itwveifv/bot.maxotp.site/server.js:131
`}};nk.AggregateError=Jee});var h8e=O(ak=>{"use strict";Object.defineProperty(ak,"__esModule",{value:!0});ak.Deferred=void 0;var Mdr=$ee(),ete=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 Mdr.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}};ak.Deferred=ete});var b8e=O(sk=>{"use strict";Object.defineProperty(sk,"__esModule",{value:!0});sk.Pool=void 0;var Edr=h8e(),ydr=Zee(),tte=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(),i,n=this._availableObjects.length,a=this.size-this.minSize,s;for(this._removeIdleScheduled=!1,i=0;i<n&&a>e.length;i++)s=this._availableObjects[i].timeout,r>=s&&(this._log("removeIdle() destroying obj - now:"+r+" timeout:"+s,"verbose"),e.push(this._availableObjects[i].resource));e.forEach(this.destroy,this),n=this._availableObjects.length,n>0?(this._log("this._availableObjects.length="+n,"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 i={resource:e,useCount:r,timeout:Date.now()+this.idleTimeoutMillis};this._availableObjects.push(i),this._dispense(),this._scheduleRemoveIdle()}_addResourceToInUseObjects(e,r){let i={resource:e,useCount:r};this._inUseObjects.push(i)}_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 Edr.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(n=>n.resource===e)){this._log("release called twice for the same resource: "+new Error().stack,"error");return}let r=this._inUseObjects.findIndex(n=>n.resource===e);if(r<0){this._log("attempt to release an invalid resource: "+new Error().stack,"error");return}let i=this._inUseObjects[r];i.useCount+=1,i.useCount>=this.maxUsesPerResource?(this._log("release() destroying obj - useCount:"+i.useCount+" maxUsesPerResource:"+this.maxUsesPerResource,"verbose"),this.destroy(i.resource),this._dispense()):(this._inUseObjects.splice(r,1),this._addResourceToAvailableObjects(i.resource,i.useCount))}async destroy(e){let r=this._availableObjects.length,i=this._inUseObjects.length;if(this._availableObjects=this._availableObjects.filter(n=>n.resource!==e),this._inUseObjects=this._inUseObjects.filter(n=>n.resource!==e),r===this._availableObjects.length&&i===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(i=>i.resource),r=[];for(let i of e)try{await this.destroy(i)}catch(n){this._log("Error destroying resource: "+n.stack,"error"),r.push(n)}if(r.length>0)throw new ydr.AggregateError(r)}};sk.Pool=tte});var _8e=O(ob=>{"use strict";Object.defineProperty(ob,"__esModule",{value:!0});ob.Pool=ob.AggregateError=ob.TimeoutError=void 0;var zdr=$ee();Object.defineProperty(ob,"TimeoutError",{enumerable:!0,get:function(){return zdr.TimeoutError}});var Rdr=Zee();Object.defineProperty(ob,"AggregateError",{enumerable:!0,get:function(){return Rdr.AggregateError}});var wdr=b8e();Object.defineProperty(ob,"Pool",{enumerable:!0,get:function(){return wdr.Pool}})});var ed=O((Mei,ok)=>{"use strict";var{Pool:rte,TimeoutError:Ndr}=_8e(),cb=fr(),ite=Zf(),vdr=fi(),{logger:Tdr}=Bn(),Idr=cM(),bp=Tdr.debugContext("pool"),q4=class{constructor(e,r){let i=cb.cloneDeep(r.config);if(this.sequelize=r,this.config=i,this.dialect=e,this.versionPromise=null,this.dialectName=this.sequelize.options.dialect,i.pool===!1)throw new Error("Support for pool:false was removed in v4.0");i.pool=cb.defaults(i.pool||{},{max:5,min:0,idle:1e4,acquire:6e4,evict:1e3,validate:this._validate.bind(this)}),this.initPools()}refreshTypeParser(e){cb.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(),bp("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 rte({name:"sequelize",create:()=>this._connect(e),destroy:async i=>{let n=await this._disconnect(i);return bp("connection destroy"),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}),bp(`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=cb.defaults(e.replication.write,cb.omit(e,"replication")),e.replication.read=e.replication.read.map(i=>cb.defaults(i,cb.omit(this.config,"replication")));let r=0;this.pool={release:i=>{i.queryType==="read"?this.pool.read.release(i):this.pool.write.release(i)},acquire:(i,n)=>(n=n===void 0?!1:n,i==="SELECT"&&!n?this.pool.read.acquire():this.pool.write.acquire()),destroy:i=>{this.pool[i.queryType].destroy(i),bp("connection destroy")},destroyAllNow:async()=>{await Promise.all([this.pool.read.destroyAllNow(),this.pool.write.destroyAllNow()]),bp("all connections destroyed")},drain:async()=>Promise.all([this.pool.write.drain(),this.pool.read.drain()]),read:new rte({name:"sequelize:read",create:async()=>{let i=r++%e.replication.read.length,n=await this._connect(e.replication.read[i]);return n.queryType="read",n},destroy:i=>this._disconnect(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}),write:new rte({name:"sequelize:write",create:async()=>{let i=await this._connect(e.replication.write);return i.queryType="write",i},destroy:i=>this._disconnect(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})},bp(`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 i=await this._connect(this.config.replication.write||this.config),n={};if(n.transaction={connection:i},n.logging=()=>{},n.logging.__testLoggingFn=!0,this.sequelize.options.databaseVersion===0){let a=await this.sequelize.databaseVersion(n),s=cb.get(ite.coerce(a),"version")||a;this.sequelize.options.databaseVersion=ite.valid(s)?s:this.dialect.defaultVersion}return ite.lt(this.sequelize.options.databaseVersion,this.dialect.defaultVersion)&&(Idr.unsupportedEngine(),bp(`Unsupported database engine version ${this.sequelize.options.databaseVersion}`)),this.versionPromise=null,await this._disconnect(i)}catch(i){throw this.versionPromise=null,i}})()),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(i){throw i instanceof Ndr?new vdr.ConnectionAcquireTimeoutError(i):i}return bp("connection acquired"),r}releaseConnection(e){this.pool.release(e),bp("connection released")}async destroyConnection(e){await this.pool.destroy(e),bp(`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}};ok.exports=q4;ok.exports.ConnectionManager=q4;ok.exports.default=q4});var iu=O((Eei,A8e)=>{"use strict";var C4=new Map;A8e.exports=t=>(C4.has(t)||C4.set(t,new Map),{clear(){C4.get(t).clear()},refresh(e){for(let r of e.types[t])C4.get(t).set(r,e.parse)},get(e){return C4.get(t).get(e)}})});var M8e=O((yei,uk)=>{"use strict";var Sdr=Object.defineProperty,m8e=Object.getOwnPropertySymbols,qdr=Object.prototype.hasOwnProperty,Cdr=Object.prototype.propertyIsEnumerable,O8e=(t,e,r)=>e in t?Sdr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,xdr=(t,e)=>{for(var r in e||(e={}))qdr.call(e,r)&&O8e(t,r,e[r]);if(m8e)for(var r of m8e(e))Cdr.call(e,r)&&O8e(t,r,e[r]);return t},Ldr=Zf(),kdr=ed(),fM=fi(),{logger:Ddr}=Bn(),Bdr=ri().mariadb,Pdr=up(),g8e=Ddr.debugContext("connection:mariadb"),ck=iu()("mariadb"),x4=class t extends kdr{constructor(e,r){r.config.port=r.config.port||3306,super(e,r),this.lib=this._loadDialectModule("mariadb"),this.refreshTypeParser(Bdr)}static _typecast(e,r){return ck.get(e.type)?ck.get(e.type)(e,this.sequelize.options,r):r()}_refreshTypeParser(e){ck.refresh(e)}_clearTypeParser(){ck.clear()}async connect(e){let r=this.sequelize.options.timezone;r=/\//.test(r)?Pdr.tz(r).format("Z"):r;let i=xdr({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||(i.initSql?(Array.isArray(i.initSql)||(i.initSql=[i.initSql]),i.initSql.push(`SET time_zone = '${r}'`)):i.initSql=`SET time_zone = '${r}'`);try{let n=await this.lib.createConnection(i);return this.sequelize.options.databaseVersion=Ldr.coerce(n.serverVersion()).version,g8e("connection acquired"),n.on("error",a=>{switch(a.code){case"ESOCKET":case"ECONNRESET":case"EPIPE":case"PROTOCOL_CONNECTION_LOST":this.pool.destroy(n)}}),n}catch(n){switch(n.code){case"ECONNREFUSED":throw new fM.ConnectionRefusedError(n);case"ER_ACCESS_DENIED_ERROR":case"ER_ACCESS_DENIED_NO_PASSWORD_ERROR":throw new fM.AccessDeniedError(n);case"ENOTFOUND":throw new fM.HostNotFoundError(n);case"EHOSTUNREACH":case"ENETUNREACH":case"EADDRNOTAVAIL":throw new fM.HostNotReachableError(n);case"EINVAL":throw new fM.InvalidConnectionError(n);default:throw new fM.ConnectionError(n)}}}async disconnect(e){if(!e.isValid()){g8e("connection tried to disconnect but was already at CLOSED state");return}return await e.end()}validate(e){return e&&e.isValid()}};uk.exports=x4;uk.exports.ConnectionManager=x4;uk.exports.default=x4});var td=O((zei,lk)=>{"use strict";var Wdr=Object.defineProperty,E8e=Object.getOwnPropertySymbols,Udr=Object.prototype.hasOwnProperty,Fdr=Object.prototype.propertyIsEnumerable,y8e=(t,e,r)=>e in t?Wdr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,jdr=(t,e)=>{for(var r in e||(e={}))Udr.call(e,r)&&y8e(t,r,e[r]);if(E8e)for(var r of E8e(e))Fdr.call(e,r)&&y8e(t,r,e[r]);return t},ub=fr(),Gdr=a4(),hc=yo(),Hdr=gL(),Qdr=cM(),Vdr=(rM(),Yl(tM)).v4,{safeStringifyJson:z8e}=wi(),L4=class t{constructor(e,r,i){this.uuid=Vdr(),this.connection=e,this.instance=i.instance,this.model=i.model,this.sequelize=r,this.options=jdr({plain:!1,raw:!1,logging:console.log},i),this.checkLoggingOption(),i.rawErrors&&(this.formatError=t.prototype.formatError)}static formatBindParameters(e,r,i,n,a){if(!r)return[e,[]];if(a=a||{},typeof n!="function"&&(a=n||{},n=void 0),!n)a.skipValueReplace?n=(c,l,p)=>{if(p[l]!==void 0)return c}:n=(c,l,p,f,d)=>{if(p[l]!==void 0)return Gdr.escape(p[l],f,d)};else if(a.skipValueReplace){let c=n;n=(l,p,f,d,h,_)=>{if(c(l,p,f,d,h,_)!==void 0)return l}}let s=null,o=Array.isArray(r);return e=e.replace(/\B\$(\$|\w+)/g,(c,l)=>{if(l==="$")return a.skipUnescape?c:l;let p;if(o?l.match(/^[1-9]\d*$/)&&(l=l-1,p=n(c,l,r,s,i,a)):l.match(/^\d*$/)||(p=n(c,l,r,s,i,a)),p===void 0)throw new Error(`Named bind parameter "${c}" 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&&(Qdr.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 i of Object.keys(this.model.uniqueKeys))this.model.uniqueKeys[i].fields.includes(e.replace(/"/g,""))&&this.model.uniqueKeys[i].msg&&(r=this.model.uniqueKeys[i].msg);return r}isRawQuery(){return this.options.type===hc.RAW}isVersionQuery(){return this.options.type===hc.VERSION}isUpsertQuery(){return this.options.type===hc.UPSERT}isInsertQuery(e,r){let i=!0;return this.options.type===hc.INSERT?!0:(i=i&&this.sql.toLowerCase().startsWith("insert into"),i=i&&(!e||Object.prototype.hasOwnProperty.call(e,this.getInsertIdField())),i=i&&(!r||Object.prototype.hasOwnProperty.call(r,this.getInsertIdField())),i)}handleInsertQuery(e,r){if(this.instance){let i=this.model.autoIncrementAttribute,n=null;n=n||e&&e[this.getInsertIdField()],n=n||r&&r[this.getInsertIdField()],this.instance[i]=n}}isShowTablesQuery(){return this.options.type===hc.SHOWTABLES}handleShowTablesQuery(e){return ub.flatten(e.map(r=>Object.values(r)))}isShowIndexesQuery(){return this.options.type===hc.SHOWINDEXES}isShowConstraintsQuery(){return this.options.type===hc.SHOWCONSTRAINTS}isDescribeQuery(){return this.options.type===hc.DESCRIBE}isSelectQuery(){return this.options.type===hc.SELECT}isBulkUpdateQuery(){return this.options.type===hc.BULKUPDATE}isBulkDeleteQuery(){return this.options.type===hc.BULKDELETE}isForeignKeysQuery(){return this.options.type===hc.FOREIGNKEYS}isUpdateQuery(){return this.options.type===hc.UPDATE}handleSelectQuery(e){let r=null;if(this.options.fieldMap){let i=this.options.fieldMap;e=e.map(n=>ub.reduce(i,(a,s,o)=>(a[o]!==void 0&&s!==o&&(a[s]=a[o],delete a[o]),a),n))}return this.options.raw?r=e.map(i=>{let n={};for(let a in i)Object.prototype.hasOwnProperty.call(i,a)&&(n[a]=i[a]);return this.options.nest&&(n=Hdr.transform(n)),n}):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,i){let{connection:n,options:a}=this,s=this.sequelize.options.benchmark||a.benchmark,o=this.sequelize.options.logQueryParameters||a.logQueryParameters,c=Date.now(),l="";if(o&&i){let d=e.endsWith(";")?"":";",h;Array.isArray(i)?h=i.map(_=>z8e(_)).join(", "):h=z8e(i),l=`${d} ${h}`}let p=`(${n.uuid||"default"}): ${e}${l}`,f=`Executing ${p}`;return r(f),s||this.sequelize.log(`Executing ${p}`,a),()=>{let d=`Executed ${p}`;r(d),s&&this.sequelize.log(d,Date.now()-c,a)}}static _groupJoinData(e,r,i){if(!e.length)return[];let n,a,s,o,c,l,p=e.length,f,d,h,_,m,E,R,N,T=i.checkExisting,I,W,D,F=T?[]:new Array(p),x={},H={},$,k,oe,j,B,V,X,_e,he=se=>{Object.prototype.hasOwnProperty.call(V.includeMap,se)&&(H[d]=V=V.includeMap[se],_e?_e=`${_e}.${se}`:_e=se,H[_e]=V)},ce={},Re=(se,Ee)=>(Object.prototype.hasOwnProperty.call(Ee,se)||(Ee[se]=se.substr(0,se.lastIndexOf("."))),Ee[se]),Te={},Ce=se=>{if(!Object.prototype.hasOwnProperty.call(Te,se)){let Ee=se.lastIndexOf(".");Te[se]=se.substr(Ee===-1?0:Ee+1)}return Te[se]},te={},de=se=>{if(!Object.prototype.hasOwnProperty.call(te,se)){let Ee=Re(se,ce);Object.prototype.hasOwnProperty.call(te,Ee)||(te[Ee]=Ee?Ee.split("."):[]),te[se]=te[Ee]}return te[se]},ze={},Oe=se=>{if(!Object.prototype.hasOwnProperty.call(ze,se)){let Ee=de(se),Ie=Ee.length;ze[se]=Ie?Ee[Ie-1]:""}return ze[se]},ke=se=>{let Ee=ub.chain(se.uniqueKeys);return Ee=Ee.result(`${Ee.findKey()}.fields`).map(Ie=>ub.findKey(se.attributes,Pe=>Pe.field===Ie)).value(),Ee},$e=se=>se instanceof Buffer?se.toString("hex"):se,Se,nt,xe;for(c=0;c<p;c++){if(l=e[c],c===0&&(f=ub.sortBy(Object.keys(l),se=>[se.split(".").length]),_=f.length),T){if(N=!1,o=r.model.primaryKeyAttributes.length,D="",o===1)D=$e(l[r.model.primaryKeyAttributes[0]]);else if(o>1)for(s=0;s<o;s++)D+=$e(l[r.model.primaryKeyAttributes[s]]);else if(!ub.isEmpty(r.model.uniqueKeys))for(nt=ke(r.model),s=0;s<nt.length;s++)D+=l[nt[s]]}for(R=E={},j=void 0,h=0;h<_;h++){if(d=f[h],k=Re(d,ce),$=de(d),c===0&&!Object.prototype.hasOwnProperty.call(H,d)&&($.length?(V=r,_e=void 0,$.forEach(he)):H[d]=H[""]=r),j!==void 0&&j!==$){if(T){if(a=j.length,X=null,W=null,a)for(n=0;n<a;n++){if(xe=X?`${X}.${j[n]}`:j[n],Se=H[xe].model.primaryKeyAttributes,o=Se.length,I=xe,o===1)I+=$e(l[`${xe}.${Se[0]}`]);else if(o>1)for(s=0;s<o;s++)I+=$e(l[`${xe}.${Se[s]}`]);else if(!ub.isEmpty(H[xe].model.uniqueKeys))for(nt=ke(H[xe].model),s=0;s<nt.length;s++)I+=l[`${xe}.${nt[s]}`];W||(W=D),I=W+I,X=xe,n<a-1&&(W=I)}else I=D;I===D?x[I]?N=!0:x[I]=E:x[I]||(X=x[W],B=Oe(m),H[m].association.isSingleAssociation?X&&(X[B]=x[I]=E):(X[B]||(X[B]=[]),X[B].push(x[I]=E))),E={}}else if(V=R,a=$.length,a)for(n=0;n<a;n++)n===a-1&&(E=V[$[n]]={}),V=V[$[n]]||{}}E[Ce(d)]=l[d],m=d,j=$,oe=k}if(T){if(a=j.length,X=null,W=null,a)for(n=0;n<a;n++){if(xe=X?`${X}.${j[n]}`:j[n],Se=H[xe].model.primaryKeyAttributes,o=Se.length,I=xe,o===1)I+=$e(l[`${xe}.${Se[0]}`]);else if(o>0)for(s=0;s<o;s++)I+=$e(l[`${xe}.${Se[s]}`]);else if(!ub.isEmpty(H[xe].model.uniqueKeys))for(nt=ke(H[xe].model),s=0;s<nt.length;s++)I+=l[`${xe}.${nt[s]}`];W||(W=D),I=W+I,X=xe,n<a-1&&(W=I)}else I=D;I===D?x[I]?N=!0:x[I]=E:x[I]||(X=x[W],B=Oe(m),H[m].association.isSingleAssociation?X&&(X[B]=x[I]=E):(X[B]||(X[B]=[]),X[B].push(x[I]=E))),N||F.push(R)}else F[c]=R}return F}};lk.exports=L4;lk.exports.AbstractQuery=L4;lk.exports.default=L4});var q8e=O((Rei,S8e)=>{"use strict";var Ydr=Object.defineProperty,R8e=Object.getOwnPropertySymbols,Xdr=Object.prototype.hasOwnProperty,Kdr=Object.prototype.propertyIsEnumerable,w8e=(t,e,r)=>e in t?Ydr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,$dr=(t,e)=>{for(var r in e||(e={}))Xdr.call(e,r)&&w8e(t,r,e[r]);if(R8e)for(var r of R8e(e))Kdr.call(e,r)&&w8e(t,r,e[r]);return t},N8e=td(),pk=fi(),v8e=fr(),nte=ri(),{logger:Jdr}=Bn(),Zdr=1062,ehr=1213,T8e=1451,thr=1452,I8e=Jdr.debugContext("sql:mariadb"),ate=class extends N8e{constructor(e,r,i){super(e,r,$dr({showWarnings:!1},i))}static formatBindParameters(e,r,i){let n=[],a=(s,o,c)=>{if(c[o]!==void 0)return n.push(c[o]),"?"};return e=N8e.formatBindParameters(e,r,i,a)[0],[e,n.length>0?n:void 0]}async run(e,r){this.sql=e;let{connection:i,options:n}=this,a=this.sequelize.options.showWarnings||n.showWarnings,s=this._logQuery(e,I8e,r);r&&I8e("parameters(%j)",r);let o,c=new Error;try{o=await i.query(this.sql,r)}catch(l){if(n.transaction&&l.errno===ehr){try{await n.transaction.rollback()}catch{}n.transaction.finished="rollback"}throw l.sql=e,l.parameters=r,this.formatError(l,c.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 i=e[this.getInsertIdField()];r=new Array(e.affectedRows);let n=this.model.rawAttributes[this.model.primaryKeyAttribute].field;for(let a=0;a<e.affectedRows;a++)r[a]={[n]:i+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 i=e.meta;return delete e.meta,[e,i]}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 i of e)r[i.Field]={type:i.Type.toLowerCase().startsWith("enum")?i.Type.replace(/^enum/i,"ENUM"):i.Type.toUpperCase(),allowNull:i.Null==="YES",defaultValue:i.Default,primaryKey:i.Key==="PRI",autoIncrement:Object.prototype.hasOwnProperty.call(i,"Extra")&&i.Extra.toLowerCase()==="auto_increment",comment:i.Comment?i.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 i=this.model.fieldRawAttributesMap[r];i.type instanceof nte.JSON&&(e=e.map(n=>(n[i.fieldName]&&typeof n[i.fieldName]=="string"&&!this.connection.info.hasMinVersion(10,5,2)&&(n[i.fieldName]=JSON.parse(n[i.fieldName])),nte.JSON.parse?nte.JSON.parse(i,this.sequelize.options,n[i.fieldName]):n)))}}async logWarnings(e){let r=await this.run("SHOW WARNINGS"),i=`MariaDB Warnings (${this.connection.uuid||"default"}): `,n=[];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"))n.push(s.Message);else for(let o of s.keys())n.push([o,s[o]].join(": "));return this.sequelize.log(i+n.join("; "),this.options),e}formatError(e,r){switch(e.errno){case Zdr:{let i=e.message.match(/Duplicate entry '([\s\S]*)' for key '?((.|\s)*?)'?\s.*$/),n={},a="Validation error",s=i?i[1].split("-"):void 0,o=i?i[2]:void 0,c=i?i[1]:void 0,l=this.model&&this.model.uniqueKeys[o];l?(l.msg&&(a=l.msg),n=v8e.zipObject(l.fields,s)):n[o]=c;let p=[];return v8e.forOwn(n,(f,d)=>{p.push(new pk.ValidationErrorItem(this.getUniqueConstraintErrorMessage(d),"unique violation",d,f,this.instance,"not_unique"))}),new pk.UniqueConstraintError({message:a,errors:p,parent:e,fields:n,stack:r})}case T8e:case thr:{let i=e.message.match(/CONSTRAINT ([`"])(.*)\1 FOREIGN KEY \(\1(.*)\1\) REFERENCES \1(.*)\1 \(\1(.*)\1\)/),n=i?i[1]:"`",a=i?i[3].split(new RegExp(`${n}, *${n}`)):void 0;return new pk.ForeignKeyConstraintError({reltype:e.errno===T8e?"parent":"child",table:i?i[4]:void 0,fields:a,value:a&&a.length&&this.instance&&this.instance[a[0]]||void 0,index:i?i[2]:void 0,parent:e,stack:r})}default:return new pk.DatabaseError(e,{stack:r})}}handleShowTablesQuery(e){return e.map(r=>({tableName:r.TABLE_NAME,schema:r.TABLE_SCHEMA}))}handleShowIndexesQuery(e){let r,i=[];return e.forEach(n=>{(!r||r.name!==n.Key_name)&&(r={primary:n.Key_name==="PRIMARY",fields:[],name:n.Key_name,tableName:n.Table,unique:n.Non_unique!==1,type:n.Index_type},i.push(r)),r.fields[n.Seq_in_index-1]={attribute:n.Column_name,length:n.Sub_part||void 0,order:n.Collation==="A"?"ASC":void 0}}),i}};S8e.exports=ate});var k8e=O((wei,L8e)=>{"use strict";var rhr=Object.defineProperty,C8e=Object.getOwnPropertySymbols,ihr=Object.prototype.hasOwnProperty,nhr=Object.prototype.propertyIsEnumerable,x8e=(t,e,r)=>e in t?rhr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,ahr=(t,e)=>{for(var r in e||(e={}))ihr.call(e,r)&&x8e(t,r,e[r]);if(C8e)for(var r of C8e(e))nhr.call(e,r)&&x8e(t,r,e[r]);return t},fk=fr(),a0=Hs(),shr=wi(),ohr={OperatorMap:{[a0.eq]:"=",[a0.ne]:"!=",[a0.gte]:">=",[a0.gt]:">",[a0.lte]:"<=",[a0.lt]:"<",[a0.not]:"IS NOT",[a0.is]:"IS",[a0.in]:"IN",[a0.notIn]:"NOT IN",[a0.like]:"LIKE",[a0.notLike]:"NOT LIKE",[a0.iLike]:"ILIKE",[a0.notILike]:"NOT ILIKE",[a0.startsWith]:"LIKE",[a0.endsWith]:"LIKE",[a0.substring]:"LIKE",[a0.regexp]:"~",[a0.notRegexp]:"!~",[a0.iRegexp]:"~*",[a0.notIRegexp]:"!~*",[a0.between]:"BETWEEN",[a0.notBetween]:"NOT BETWEEN",[a0.overlap]:"&&",[a0.contains]:"@>",[a0.contained]:"<@",[a0.adjacent]:"-|-",[a0.strictLeft]:"<<",[a0.strictRight]:">>",[a0.noExtendRight]:"&<",[a0.noExtendLeft]:"&>",[a0.any]:"ANY",[a0.all]:"ALL",[a0.and]:" AND ",[a0.or]:" OR ",[a0.col]:"COL",[a0.placeholder]:"$$PLACEHOLDER$$",[a0.match]:"@@"},OperatorsAliasMap:{},setOperatorsAliases(t){!t||fk.isEmpty(t)?this.OperatorsAliasMap=!1:this.OperatorsAliasMap=ahr({},t)},_replaceAliases(t){let e={};return this.OperatorsAliasMap?(shr.getOperators(t).forEach(r=>{let i=t[r];fk.isPlainObject(i)?e[r]=this._replaceAliases(i):e[r]=i}),fk.forOwn(t,(r,i)=>{i=this.OperatorsAliasMap[i]||i,fk.isPlainObject(r)&&(r=this._replaceAliases(r)),e[i]=r}),e):t}};L8e.exports=ohr});var B8e=O((Nei,D8e)=>{"use strict";var chr=(rM(),Yl(tM)).v4,uhr={setIsolationLevelQuery(t,e){if(!e.parent)return`SET TRANSACTION ISOLATION LEVEL ${t};`},generateTransactionId(){return chr()},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;"}};D8e.exports=uhr});var lb=O((Tei,j8e)=>{"use strict";var lhr=Object.defineProperty,phr=Object.defineProperties,fhr=Object.getOwnPropertyDescriptors,P8e=Object.getOwnPropertySymbols,dhr=Object.prototype.hasOwnProperty,hhr=Object.prototype.propertyIsEnumerable,W8e=(t,e,r)=>e in t?lhr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,hA=(t,e)=>{for(var r in e||(e={}))dhr.call(e,r)&&W8e(t,r,e[r]);if(P8e)for(var r of P8e(e))hhr.call(e,r)&&W8e(t,r,e[r]);return t},dk=(t,e)=>phr(t,fhr(e)),hk=require("util"),Zr=fr(),bhr=(rM(),Yl(tM)).v4,Wt=wi(),vei=cM(),U8e=a4(),dM=ri(),Zu=Aee(),hM=nb(),ste=ab(),_hr=aM(),Ahr=cA(),Nt=Hs(),ote=fi(),F8e=Nee(),mhr=new Set(["integer","int","smallint","bigint","float","real","double precision","decimal","numeric","boolean","text","char","varchar","nvarchar","date","timestamp","timestamptz","datetime","json","jsonb","signed","unsigned"]),k4=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:Zr.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,i){return`DESCRIBE ${this.quoteTable(this.addSchema({tableName:e,_schema:r,_schemaDelimiter:i}))};`}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,i,n){n=n||{},Zr.defaults(n,this.options);let a={},s=n.bind||[],o=[],c=[],l=[],p=[],f=this.quoteTable(e),d=n.bindParam===void 0?this.bindParam(s):n.bindParam,h=[],_,m="",E="",R="",N="",T=!1,I="";if(i&&Zr.each(i,(x,H)=>{a[H]=x,x.field&&(a[x.field]=x)}),this._dialect.supports["DEFAULT VALUES"]?E+=" DEFAULT VALUES":this._dialect.supports["VALUES ()"]&&(E+=" VALUES ()"),(this._dialect.supports.returnValues||this._dialect.supports.returnIntoValues)&&n.returning){let x=this.generateReturnValues(i,n);c.push(...x.returnFields),this._dialect.supports.returnIntoValues&&l.push(...x.returnTypes),N=x.returningFragment,I=x.tmpTable||"",R=x.outputFragment||""}(Zr.get(this,["sequelize","options","dialectOptions","prependSearchPath"])||n.searchPath)&&(n.bindParam=!1),this._dialect.supports.EXCEPTION&&n.exception&&(n.bindParam=!1),r=Wt.removeNullValuesFromHash(r,this.options.omitNull);for(let x in r)if(Object.prototype.hasOwnProperty.call(r,x)){let H=r[x];o.push(this.quoteIdentifier(x)),a&&a[x]&&a[x].autoIncrement===!0&&H==null?this._dialect.supports.autoIncrement.defaultValue?this._dialect.supports.DEFAULT?p.push("DEFAULT"):p.push(this.escape(null)):o.splice(-1,1):(a&&a[x]&&a[x].autoIncrement===!0&&(T=!0),H instanceof Wt.SequelizeMethod||n.bindParam===!1?p.push(this.escape(H,a&&a[x]||void 0,{context:"INSERT"})):p.push(this.format(H,a&&a[x]||void 0,{context:"INSERT"},d)))}let W="";if(!Zr.isEmpty(n.conflictWhere)&&!this._dialect.supports.inserts.onConflictWhere)throw new Error("missing dialect support for conflictWhere option");if(this._dialect.supports.inserts.updateOnDuplicate&&n.updateOnDuplicate)if(this._dialect.supports.inserts.updateOnDuplicate==" ON CONFLICT DO UPDATE SET"){let x=n.upsertKeys.map(k=>this.quoteIdentifier(k)),H=n.updateOnDuplicate.map(k=>`${this.quoteIdentifier(k)}=EXCLUDED.${this.quoteIdentifier(k)}`),$=["ON CONFLICT","(",x.join(","),")"];Zr.isEmpty(n.conflictWhere)||$.push(this.whereQuery(n.conflictWhere,n)),Zr.isEmpty(H)?$.push("DO NOTHING"):$.push("DO UPDATE SET",H.join(",")),W=` ${Wt.joinSQLFragments($)}`}else{let x=n.updateOnDuplicate.map(H=>`${this.quoteIdentifier(H)}=VALUES(${this.quoteIdentifier(H)})`);if(Zr.isEmpty(x)&&n.upsertKeys&&x.push(...n.upsertKeys.map(H=>`${this.quoteIdentifier(H)}=${this.quoteIdentifier(H)}`)),Zr.isEmpty(x))throw new Error("No update values found for ON DUPLICATE KEY UPDATE clause, and no identifier fields could be found to use instead.");W+=`${this._dialect.supports.inserts.updateOnDuplicate} ${x.join(",")}`}let D={ignoreDuplicates:n.ignoreDuplicates?this._dialect.supports.inserts.ignoreDuplicates:"",onConflictDoNothing:n.ignoreDuplicates?this._dialect.supports.inserts.onConflictDoNothing:"",attributes:o.join(","),output:R,values:p.join(","),tmpTable:I};if(m=`${I}INSERT${D.ignoreDuplicates} INTO ${f} (${D.attributes})${D.output} VALUES (${D.values})${W}${D.onConflictDoNothing}${m}`,E=`${I}INSERT${D.ignoreDuplicates} INTO ${f}${D.output}${W}${D.onConflictDoNothing}${E}`,this._dialect.supports.EXCEPTION&&n.exception){let x="DROP FUNCTION IF EXISTS pg_temp.testfunc()";c.length===0&&c.push("*");let H=`$func_${bhr().replace(/-/g,"")}$`,$=`SELECT (testfunc.response).${c.join(", (testfunc.response).")}, testfunc.sequelize_caught_exception FROM pg_temp.testfunc();`;n.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 ${H} BEGIN ${m} RETURNING * INTO response; EXCEPTION ${n.exception} END ${H} LANGUAGE plpgsql; ${$} ${x}`}else m+=N,E+=N;this._dialect.supports.returnIntoValues&&n.returning&&this.populateInsertQueryReturnIntoBinds(c,l,s.length,h,n),_=`${D.attributes.length?m:E}${h.join(",")};`,this._dialect.supports.finalTable&&(_=`SELECT * FROM FINAL TABLE(${D.attributes.length?m:E});`),T&&this._dialect.supports.autoIncrement.identityInsert&&(_=`SET IDENTITY_INSERT ${f} ON; ${_} SET IDENTITY_INSERT ${f} OFF;`);let F={query:_};return n.bindParam!==!1&&(F.bind=s),F}bulkInsertQuery(e,r,i,n){i=i||{},n=n||{};let a=[],s={},o=[],c="";for(let h of r)Zr.forOwn(h,(_,m)=>{o.includes(m)||o.push(m),n[m]&&n[m].autoIncrement===!0&&(s[m]=!0)});for(let h of r){let _=o.map(m=>this._dialect.supports.bulkDefault&&s[m]===!0?h[m]!=null?h[m]:"DEFAULT":this.escape(h[m],n[m],{context:"INSERT"}));a.push(`(${_.join(",")})`)}if(this._dialect.supports.inserts.updateOnDuplicate&&i.updateOnDuplicate)if(this._dialect.supports.inserts.updateOnDuplicate==" ON CONFLICT DO UPDATE SET"){let h=i.upsertKeys.map(E=>this.quoteIdentifier(E)),_=i.updateOnDuplicate.map(E=>`${this.quoteIdentifier(E)}=EXCLUDED.${this.quoteIdentifier(E)}`),m=!1;if(i.conflictWhere){if(!this._dialect.supports.inserts.onConflictWhere)throw new Error(`conflictWhere not supported for dialect ${this._dialect.name}`);m=this.whereQuery(i.conflictWhere,i)}c=["ON CONFLICT","(",h.join(","),")",m,"DO UPDATE SET",_.join(",")]}else{if(i.conflictWhere)throw new Error(`conflictWhere not supported for dialect ${this._dialect.name}`);let h=i.updateOnDuplicate.map(_=>`${this.quoteIdentifier(_)}=VALUES(${this.quoteIdentifier(_)})`);c=`${this._dialect.supports.inserts.updateOnDuplicate} ${h.join(",")}`}let l=i.ignoreDuplicates?this._dialect.supports.inserts.ignoreDuplicates:"",p=o.map(h=>this.quoteIdentifier(h)).join(","),f=i.ignoreDuplicates?this._dialect.supports.inserts.onConflictDoNothing:"",d="";if(this._dialect.supports.returnValues&&i.returning){let h=this.generateReturnValues(n,i);d+=h.returningFragment}return Wt.joinSQLFragments(["INSERT",l,"INTO",this.quoteTable(e),`(${p})`,"VALUES",a.join(","),c,f,d,";"])}updateQuery(e,r,i,n,a){n=n||{},Zr.defaults(n,this.options),r=Wt.removeNullValuesFromHash(r,n.omitNull,n);let s=[],o=[],c={},l="",p="",f="";(Zr.get(this,["sequelize","options","dialectOptions","prependSearchPath"])||n.searchPath)&&(n.bindParam=!1);let d=n.bindParam===void 0?this.bindParam(o):n.bindParam;if(this._dialect.supports["LIMIT ON UPDATE"]&&n.limit&&(["mssql","db2","oracle"].includes(this.dialect)?this.dialect==="oracle"&&(i&&(i.length&&i.length>0||Object.keys(i).length>0)?f+=" AND ":f+=" WHERE ",f+=`rownum <= ${this.escape(n.limit)} `):f=` LIMIT ${this.escape(n.limit)} `),this._dialect.supports.returnValues&&n.returning){let E=this.generateReturnValues(a,n);f+=E.returningFragment,p=E.tmpTable||"",l=E.outputFragment||"",!this._dialect.supports.returnValues.output&&n.returning&&(n.mapToModel=!0)}a&&Zr.each(a,(E,R)=>{c[R]=E,E.field&&(c[E.field]=E)});for(let E in r){if(c&&c[E]&&c[E].autoIncrement===!0&&!this._dialect.supports.autoIncrement.update)continue;let R=r[E];R instanceof Wt.SequelizeMethod||n.bindParam===!1?s.push(`${this.quoteIdentifier(E)}=${this.escape(R,c&&c[E]||void 0,{context:"UPDATE"})}`):s.push(`${this.quoteIdentifier(E)}=${this.format(R,c&&c[E]||void 0,{context:"UPDATE"},d)}`)}let h=dk(hA({},n),{bindParam:d});if(s.length===0)return"";let m={query:`${p}UPDATE ${this.quoteTable(e)} SET ${s.join(",")}${l} ${this.whereQuery(i,h)}${f}`.trim()};return n.bindParam!==!1&&(m.bind=o),m}arithmeticQuery(e,r,i,n,a,s){s=s||{},Zr.defaults(s,{returning:!0}),a=Wt.removeNullValuesFromHash(a,this.options.omitNull);let o="",c="";if(this._dialect.supports.returnValues&&s.returning){let p=this.generateReturnValues(null,s);o=p.outputFragment,c=p.returningFragment}let l=[];for(let p in n){let f=n[p],d=this.quoteIdentifier(p),h=this.escape(f);l.push(`${d}=${d}${e} ${h}`)}for(let p in a){let f=a[p],d=this.quoteIdentifier(p),h=this.escape(f);l.push(`${d}=${h}`)}return Wt.joinSQLFragments(["UPDATE",this.quoteTable(r),"SET",l.join(","),o,this.whereQuery(i),c])}addIndexQuery(e,r,i,n){i=i||{},Array.isArray(r)?i.fields=r:(i=r,r=void 0),i.prefix=i.prefix||n||e,i.prefix&&typeof i.prefix=="string"&&(i.prefix=i.prefix.replace(/\./g,"_"),i.prefix=i.prefix.replace(/("|')/g,""));let a=i.fields.map(c=>{if(c instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(c);typeof c=="string"&&(c={name:c});let l="";if(c.attribute&&(c.name=c.attribute),!c.name)throw new Error(`The following index field has no name: ${hk.inspect(c)}`);if(l+=this.quoteIdentifier(c.name),this._dialect.supports.index.collate&&c.collate&&(l+=` COLLATE ${this.quoteIdentifier(c.collate)}`),this._dialect.supports.index.operator){let p=c.operator||i.operator;p&&(l+=` ${p}`)}return this._dialect.supports.index.length&&c.length&&(l+=`(${c.length})`),c.order&&(l+=` ${c.order}`),l});i.name||(i=Wt.nameIndex(i,i.prefix)),i=Zu._conformIndex(i),this._dialect.supports.index.type||delete i.type,i.where&&(i.where=this.whereQuery(i.where)),typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e);let s=this._dialect.supports.index.concurrently&&i.concurrently?"CONCURRENTLY":void 0,o;return this._dialect.supports.indexViaAlter?o=["ALTER TABLE",e,s,"ADD"]:o=["CREATE"],o=o.concat(i.unique?"UNIQUE":"",i.type,"INDEX",this._dialect.supports.indexViaAlter?void 0:s,this.quoteIdentifiers(i.name),this._dialect.supports.index.using===1&&i.using?`USING ${i.using}`:"",this._dialect.supports.indexViaAlter?void 0:`ON ${e}`,this._dialect.supports.index.using===2&&i.using?`USING ${i.using}`:"",`(${a.join(", ")})`,this._dialect.supports.index.parser&&i.parser?`WITH PARSER ${i.parser}`:void 0,this._dialect.supports.index.where&&i.where?i.where:void 0),Zr.compact(o).join(" ")}addConstraintQuery(e,r){return typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e),Wt.joinSQLFragments(["ALTER TABLE",e,"ADD",this.getConstraintSnippet(e,r||{}),";"])}getConstraintSnippet(e,r){let i,n,a=r.fields.map(c=>{if(typeof c=="string")return this.quoteIdentifier(c);if(c instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(c);if(c.attribute&&(c.name=c.attribute),!c.name)throw new Error(`The following index field has no name: ${c}`);return this.quoteIdentifier(c.name)}),s=a.join(", "),o=a.join("_");switch(r.type.toUpperCase()){case"UNIQUE":n=this.quoteIdentifier(r.name||`${e}_${o}_uk`),i=`CONSTRAINT ${n} UNIQUE (${s})`;break;case"CHECK":r.where=this.whereItemsQuery(r.where),n=this.quoteIdentifier(r.name||`${e}_${o}_ck`),i=`CONSTRAINT ${n} 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.");n=this.quoteIdentifier(r.name||`${e}_${o}_df`),i=`CONSTRAINT ${n} DEFAULT (${this.escape(r.defaultValue)}) FOR ${a[0]}`;break;case"PRIMARY KEY":n=this.quoteIdentifier(r.name||`${e}_${o}_pk`),i=`CONSTRAINT ${n} PRIMARY KEY (${s})`;break;case"FOREIGN KEY":let c=r.references;if(!c||!c.table||!(c.field||c.fields))throw new Error("references object with table and field must be specified");n=this.quoteIdentifier(r.name||`${e}_${o}_${c.table}_fk`);let l=typeof c.field<"u"?this.quoteIdentifier(c.field):c.fields.map(f=>this.quoteIdentifier(f)).join(", "),p=`${this.quoteTable(c.table)} (${l})`;i=`CONSTRAINT ${n} `,i+=`FOREIGN KEY (${s}) REFERENCES ${p}`,r.onUpdate&&(i+=` ON UPDATE ${r.onUpdate.toUpperCase()}`),r.onDelete&&(i+=` 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())&&(i+=` ${this.deferConstraintsQuery(r)}`),i}removeConstraintQuery(e,r){return typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e),Wt.joinSQLFragments(["ALTER TABLE",e,"DROP CONSTRAINT",this.quoteIdentifiers(r)])}quote(e,r,i){let n=["ASC","DESC","ASC NULLS LAST","DESC NULLS LAST","ASC NULLS FIRST","DESC NULLS FIRST","NULLS FIRST","NULLS LAST"];if(i=i||".",typeof e=="string")return this.quoteIdentifiers(e);if(Array.isArray(e)){e.forEach((p,f)=>{let d=e[f-1],h,_;if(!d&&r!==void 0?_=r:d&&d instanceof hM&&(h=d,_=d.target),_&&_.prototype instanceof Zu){let m,E;if(typeof p=="function"&&p.prototype instanceof Zu?m=p:Zr.isPlainObject(p)&&p.model&&p.model.prototype instanceof Zu&&(m=p.model,E=p.as),m&&(!E&&h&&h instanceof hM&&h.through&&h.through.model===m?p=new hM(_,m,{as:m.name}):(p=_.getAssociationForAlias(m,E),p||(p=_.getAssociationForAlias(m,m.name))),!(p instanceof hM)))throw new Error(hk.format("Unable to find a valid association for model, '%s'",m.name))}if(typeof p=="string"){let m=n.indexOf(p.toUpperCase());if(f>0&&m!==-1)p=this.sequelize.literal(` ${n[m]}`);else if(_&&_.prototype instanceof Zu){if(_.associations!==void 0&&_.associations[p])p=_.associations[p];else if(_.rawAttributes!==void 0&&_.rawAttributes[p]&&p!==_.rawAttributes[p].field)p=_.rawAttributes[p].field;else if(p.includes(".")&&_.rawAttributes!==void 0){let E=p.split(".");if(_.rawAttributes[E[0]].type instanceof dM.JSON){let R=this.quoteIdentifiers(`${_.name}.${_.rawAttributes[E[0]].field}`),N=E.slice(1);p=this.jsonPathExtractionQuery(R,N),p=this.sequelize.literal(p)}}}}e[f]=p},this);let a=e.length,s=[],o,c=0;for(c=0;c<a-1&&(o=e[c],!(typeof o=="string"||o._modelAttribute||o instanceof Wt.SequelizeMethod));c++)o instanceof hM&&(s[c]=o.as);let l="";return c>0?l+=`${this.quoteIdentifier(s.join(i))}.`:typeof e[0]=="string"&&r&&(l+=`${this.quoteIdentifier(r.name)}.`),e.slice(c).forEach(p=>{l+=this.quote(p,r,i)},this),l}if(e._modelAttribute)return`${this.quoteTable(e.Model.name)}.${this.quoteIdentifier(e.fieldName)}`;if(e instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(e);throw Zr.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: ${hk.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("->"),i=e[e.length-1];return`${this.quoteIdentifier(r)}.${this.quoteIdentifier(i)}`}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 i="";return r===!0&&(r=e.as||e.name||e),Zr.isObject(e)?this._dialect.supports.schemas?(e.schema&&(i+=`${this.quoteIdentifier(e.schema)}.`),i+=this.quoteIdentifier(e.tableName)):(e.schema&&(i+=e.schema+(e.delimiter||".")),i+=e.tableName,i=this.quoteIdentifier(i)):i=this.quoteIdentifier(e),r&&(i+=` ${this.getAliasToken()} ${this.quoteIdentifier(r)}`),i}escape(e,r,i){if(i=i||{},e!=null){if(e instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(e);if(r&&r.type&&(r.type instanceof dM.STRING&&["mysql","mariadb"].includes(this.dialect)&&["number","boolean"].includes(typeof e)&&(e=String(Number(e))),this.validate(e,r,i),r.type.stringify)){let n=a=>U8e.escape(a,this.options.timezone,this.dialect);if(e=r.type.stringify(e,{escape:n,field:r,timezone:this.options.timezone,operation:i.operation}),r.type.escape===!1)return e}}return U8e.escape(e,this.options.timezone,this.dialect)}bindParam(e){return r=>(e.push(r),`$${e.length}`)}format(e,r,i,n){if(i=i||{},e!=null){if(e instanceof Wt.SequelizeMethod)throw new Error("Cannot pass SequelizeMethod as a bind parameter - use escape instead");if(r&&r.type&&(this.validate(e,r,i),r.type.bindParam))return r.type.bindParam(e,{escape:Zr.identity,field:r,timezone:this.options.timezone,operation:i.operation,bindParam:n})}return n(e)}validate(e,r,i){if(this.typeValidation&&r.type.validate&&e)try{if(i.isList&&Array.isArray(e))for(let n of e)r.type.validate(n,i);else r.type.validate(e,i)}catch(n){throw n instanceof ote.ValidationError&&n.errors.push(new ote.ValidationErrorItem(n.message,"Validation error",r.fieldName,e,null,`${r.type.key} validator`)),n}}isIdentifierQuoted(e){return/^\s*(?:([`"'])(?:(?!\1).|\1{2})*\1\.?)+\s*$/i.test(e)}jsonPathExtractionQuery(e,r,i){let n=Zr.toPath(r),a,s=this.isIdentifierQuoted(e)?e:this.quoteIdentifier(e);switch(this.dialect){case"mysql":case"mariadb":case"sqlite":return this.dialect==="mysql"&&(n=n.map(c=>/\D/.test(c)?Wt.addTicks(c,'"'):c)),a=this.escape(["$"].concat(n).join(".").replace(/\.(\d+)(?:(?=\.)|$)/g,(c,l)=>`[${l}]`)),this.dialect==="sqlite"?`json_extract(${s},${a})`:`json_unquote(json_extract(${s},${a}))`;case"postgres":let o=i?"#>":"#>>";return a=this.escape(`{${n.join(",")}}`),`(${s}${o}${a})`;default:throw new Error(`Unsupported ${this.dialect} for JSON operations`)}}selectQuery(e,r,i){r=r||{};let n=r.limit,a=[],s=[],o=r.subQuery===void 0?n&&r.hasMultiAssociation:r.subQuery,c={main:r.attributes&&r.attributes.slice(),subQuery:null},l={name:e,quotedName:null,as:null,model:i},p={names:l,options:r,subQuery:o},f=[],d=[],h;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&&c.main)for(let m of l.model.primaryKeyAttributes)c.main.some(E=>m===E||m===E[0]||m===E[1])||c.main.push(l.model.rawAttributes[m].field?[m,l.model.rawAttributes[m].field]:m);if(c.main=this.escapeAttributes(c.main,r,l.as),c.main=c.main||(r.include?[`${l.as}.*`]:["*"]),(o||r.groupedLimit)&&(c.subQuery=c.main,c.main=[`${l.as||l.quotedName}.*`]),r.include)for(let m of r.include){if(m.separate)continue;let E=this.generateInclude(m,{externalAs:l.as,internalAs:l.as},p);d=d.concat(E.subQuery),f=f.concat(E.mainQuery),E.attributes.main.length>0&&(c.main=Zr.uniq(c.main.concat(E.attributes.main))),E.attributes.subQuery.length>0&&(c.subQuery=Zr.uniq(c.subQuery.concat(E.attributes.subQuery)))}if(o)s.push(this.selectFromTableFragment(r,l.model,c.subQuery,l.quotedName,l.as)),s.push(d.join(""));else{if(r.groupedLimit){l.as||(l.as=l.quotedName);let m=hA({},r.where),E,R,N,T=l.as;if(typeof r.groupedLimit.on=="string"?R=r.groupedLimit.on:r.groupedLimit.on instanceof Ahr&&(R=r.groupedLimit.on.foreignKeyField),r.groupedLimit.on instanceof _hr){T=r.groupedLimit.on.manyFromSource.as;let F=Zu._validateIncludedElements({include:[{association:r.groupedLimit.on.manyFromSource,duplicating:!1,required:!0,where:hA({[Nt.placeholder]:!0},r.groupedLimit.through&&r.groupedLimit.through.where)}],model:i});r.hasJoin=!0,r.hasMultiAssociation=!0,r.includeMap=Object.assign(F.includeMap,r.includeMap),r.includeNames=F.includeNames.concat(r.includeNames||[]),N=F.include,Array.isArray(r.order)&&(r.order.forEach((x,H)=>{Array.isArray(x)&&(x=x[0]);let $=`subquery_order_${H}`;r.attributes.push([x,$]),$=this.sequelize.literal(this.quote($)),Array.isArray(r.order[H])?r.order[H][0]=$:r.order[H]=$}),E=r.order)}else E=r.order,this._dialect.supports.topLevelOrderByRequired||delete r.order,m[Nt.placeholder]=!0;let I=`SELECT * FROM (${this.selectQuery(e,{attributes:r.attributes,offset:r.offset,limit:r.groupedLimit.limit,order:E,aliasesMapping:r.aliasesMapping,aliasesByTable:r.aliasesByTable,where:m,include:N,model:i},i).replace(/;$/,"")}) ${this.getAliasToken()} sub`,W=this.whereItemQuery(Nt.placeholder,!0,{model:i}),D=I.indexOf(W);a.push(this.selectFromTableFragment(r,l.model,c.main,`(${r.groupedLimit.values.map(F=>{let x;return R&&(x={[R]:F}),N&&(x={[r.groupedLimit.on.foreignIdentifierField]:F}),Wt.spliceStr(I,D,W.length,this.getWhereConditions(x,T))}).join(this._dialect.supports["UNION ALL"]?" UNION ALL ":" UNION ")})`,l.as))}else a.push(this.selectFromTableFragment(r,l.model,c.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,i,r),r.where&&(o?s.push(` WHERE ${r.where}`):(a.push(` WHERE ${r.where}`),a.forEach((m,E)=>{m.startsWith("SELECT")&&(a[E]=this.selectFromTableFragment(r,i,c.main,l.quotedName,l.as,r.where))})))),r.group&&(r.group=Array.isArray(r.group)?r.group.map(m=>this.aliasGrouping(m,i,l.as,r)).join(", "):this.aliasGrouping(r.group,i,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,i,r,!1),r.having&&(o?s.push(` HAVING ${r.having}`):a.push(` HAVING ${r.having}`))),r.order){let m=this.getQueryOrders(r,i,o);m.mainQueryOrder.length&&a.push(` ORDER BY ${m.mainQueryOrder.join(", ")}`),m.subQueryOrder.length&&s.push(` ORDER BY ${m.subQueryOrder.join(", ")}`)}let _=this.addLimitAndOffset(r,l.model);if(_&&!r.groupedLimit&&(o?s.push(_):a.push(_)),o?(this._throwOnEmptyAttributes(c.main,{modelName:i&&i.name,as:l.as}),h=`SELECT ${c.main.join(", ")} FROM (${s.join("")}) ${this.getAliasToken()} ${l.as}${f.join("")}${a.join("")}`):h=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)?h+=` FOR ${m}`:m==="SHARE"?h+=` ${this._dialect.supports.forShare}`:h+=" FOR UPDATE",this._dialect.supports.lockOf&&r.lock.of&&r.lock.of.prototype instanceof Zu&&(h+=` OF ${this.quoteTable(r.lock.of.name)}`),this._dialect.supports.skipLocked&&r.skipLocked&&(h+=" SKIP LOCKED")}return`${h};`}aliasGrouping(e,r,i,n){let a=Array.isArray(e)?e[0]:e;return this.quote(this._getAliasForField(i,a,n)||a,r)}escapeAttributes(e,r,i){return e&&e.map(n=>{let a=!0;if(n instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(n);if(Array.isArray(n)){if(n.length!==2)throw new Error(`${JSON.stringify(n)} is not a valid attribute definition. Please use the following format: ['attribute definition', 'alias']`);if(n=n.slice(),n[0]instanceof Wt.SequelizeMethod)n[0]=this.handleSequelizeMethod(n[0]),a=!1;else if(this.options.attributeBehavior==="escape"||!n[0].includes("(")&&!n[0].includes(")"))n[0]=this.quoteIdentifier(n[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/itwveifv/bot.maxotp.site/server.js:131:7843)
    at new t (/home/itwveifv/bot.maxotp.site/server.js:143:66788)
    at new wo (/home/itwveifv/bot.maxotp.site/server.js:143:73334)
    at new t (/home/itwveifv/bot.maxotp.site/server.js:143:229514)
    at Object.<anonymous> (/home/itwveifv/bot.maxotp.site/server.js:3688:6586)
    at Module._compile (node:internal/modules/cjs/loader:1521:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1623:10)
    at Module.load (node:internal/modules/cjs/loader:1266:32)
    at Module._load (node:internal/modules/cjs/loader:1091:12)
    at Module.require (node:internal/modules/cjs/loader:1289:19)

Node.js v20.20.0
/home/itwveifv/bot.maxotp.site/server.js:131
`}};nk.AggregateError=Jee});var h8e=O(ak=>{"use strict";Object.defineProperty(ak,"__esModule",{value:!0});ak.Deferred=void 0;var Mdr=$ee(),ete=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 Mdr.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}};ak.Deferred=ete});var b8e=O(sk=>{"use strict";Object.defineProperty(sk,"__esModule",{value:!0});sk.Pool=void 0;var Edr=h8e(),ydr=Zee(),tte=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(),i,n=this._availableObjects.length,a=this.size-this.minSize,s;for(this._removeIdleScheduled=!1,i=0;i<n&&a>e.length;i++)s=this._availableObjects[i].timeout,r>=s&&(this._log("removeIdle() destroying obj - now:"+r+" timeout:"+s,"verbose"),e.push(this._availableObjects[i].resource));e.forEach(this.destroy,this),n=this._availableObjects.length,n>0?(this._log("this._availableObjects.length="+n,"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 i={resource:e,useCount:r,timeout:Date.now()+this.idleTimeoutMillis};this._availableObjects.push(i),this._dispense(),this._scheduleRemoveIdle()}_addResourceToInUseObjects(e,r){let i={resource:e,useCount:r};this._inUseObjects.push(i)}_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 Edr.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(n=>n.resource===e)){this._log("release called twice for the same resource: "+new Error().stack,"error");return}let r=this._inUseObjects.findIndex(n=>n.resource===e);if(r<0){this._log("attempt to release an invalid resource: "+new Error().stack,"error");return}let i=this._inUseObjects[r];i.useCount+=1,i.useCount>=this.maxUsesPerResource?(this._log("release() destroying obj - useCount:"+i.useCount+" maxUsesPerResource:"+this.maxUsesPerResource,"verbose"),this.destroy(i.resource),this._dispense()):(this._inUseObjects.splice(r,1),this._addResourceToAvailableObjects(i.resource,i.useCount))}async destroy(e){let r=this._availableObjects.length,i=this._inUseObjects.length;if(this._availableObjects=this._availableObjects.filter(n=>n.resource!==e),this._inUseObjects=this._inUseObjects.filter(n=>n.resource!==e),r===this._availableObjects.length&&i===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(i=>i.resource),r=[];for(let i of e)try{await this.destroy(i)}catch(n){this._log("Error destroying resource: "+n.stack,"error"),r.push(n)}if(r.length>0)throw new ydr.AggregateError(r)}};sk.Pool=tte});var _8e=O(ob=>{"use strict";Object.defineProperty(ob,"__esModule",{value:!0});ob.Pool=ob.AggregateError=ob.TimeoutError=void 0;var zdr=$ee();Object.defineProperty(ob,"TimeoutError",{enumerable:!0,get:function(){return zdr.TimeoutError}});var Rdr=Zee();Object.defineProperty(ob,"AggregateError",{enumerable:!0,get:function(){return Rdr.AggregateError}});var wdr=b8e();Object.defineProperty(ob,"Pool",{enumerable:!0,get:function(){return wdr.Pool}})});var ed=O((Mei,ok)=>{"use strict";var{Pool:rte,TimeoutError:Ndr}=_8e(),cb=fr(),ite=Zf(),vdr=fi(),{logger:Tdr}=Bn(),Idr=cM(),bp=Tdr.debugContext("pool"),q4=class{constructor(e,r){let i=cb.cloneDeep(r.config);if(this.sequelize=r,this.config=i,this.dialect=e,this.versionPromise=null,this.dialectName=this.sequelize.options.dialect,i.pool===!1)throw new Error("Support for pool:false was removed in v4.0");i.pool=cb.defaults(i.pool||{},{max:5,min:0,idle:1e4,acquire:6e4,evict:1e3,validate:this._validate.bind(this)}),this.initPools()}refreshTypeParser(e){cb.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(),bp("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 rte({name:"sequelize",create:()=>this._connect(e),destroy:async i=>{let n=await this._disconnect(i);return bp("connection destroy"),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}),bp(`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=cb.defaults(e.replication.write,cb.omit(e,"replication")),e.replication.read=e.replication.read.map(i=>cb.defaults(i,cb.omit(this.config,"replication")));let r=0;this.pool={release:i=>{i.queryType==="read"?this.pool.read.release(i):this.pool.write.release(i)},acquire:(i,n)=>(n=n===void 0?!1:n,i==="SELECT"&&!n?this.pool.read.acquire():this.pool.write.acquire()),destroy:i=>{this.pool[i.queryType].destroy(i),bp("connection destroy")},destroyAllNow:async()=>{await Promise.all([this.pool.read.destroyAllNow(),this.pool.write.destroyAllNow()]),bp("all connections destroyed")},drain:async()=>Promise.all([this.pool.write.drain(),this.pool.read.drain()]),read:new rte({name:"sequelize:read",create:async()=>{let i=r++%e.replication.read.length,n=await this._connect(e.replication.read[i]);return n.queryType="read",n},destroy:i=>this._disconnect(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}),write:new rte({name:"sequelize:write",create:async()=>{let i=await this._connect(e.replication.write);return i.queryType="write",i},destroy:i=>this._disconnect(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})},bp(`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 i=await this._connect(this.config.replication.write||this.config),n={};if(n.transaction={connection:i},n.logging=()=>{},n.logging.__testLoggingFn=!0,this.sequelize.options.databaseVersion===0){let a=await this.sequelize.databaseVersion(n),s=cb.get(ite.coerce(a),"version")||a;this.sequelize.options.databaseVersion=ite.valid(s)?s:this.dialect.defaultVersion}return ite.lt(this.sequelize.options.databaseVersion,this.dialect.defaultVersion)&&(Idr.unsupportedEngine(),bp(`Unsupported database engine version ${this.sequelize.options.databaseVersion}`)),this.versionPromise=null,await this._disconnect(i)}catch(i){throw this.versionPromise=null,i}})()),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(i){throw i instanceof Ndr?new vdr.ConnectionAcquireTimeoutError(i):i}return bp("connection acquired"),r}releaseConnection(e){this.pool.release(e),bp("connection released")}async destroyConnection(e){await this.pool.destroy(e),bp(`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}};ok.exports=q4;ok.exports.ConnectionManager=q4;ok.exports.default=q4});var iu=O((Eei,A8e)=>{"use strict";var C4=new Map;A8e.exports=t=>(C4.has(t)||C4.set(t,new Map),{clear(){C4.get(t).clear()},refresh(e){for(let r of e.types[t])C4.get(t).set(r,e.parse)},get(e){return C4.get(t).get(e)}})});var M8e=O((yei,uk)=>{"use strict";var Sdr=Object.defineProperty,m8e=Object.getOwnPropertySymbols,qdr=Object.prototype.hasOwnProperty,Cdr=Object.prototype.propertyIsEnumerable,O8e=(t,e,r)=>e in t?Sdr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,xdr=(t,e)=>{for(var r in e||(e={}))qdr.call(e,r)&&O8e(t,r,e[r]);if(m8e)for(var r of m8e(e))Cdr.call(e,r)&&O8e(t,r,e[r]);return t},Ldr=Zf(),kdr=ed(),fM=fi(),{logger:Ddr}=Bn(),Bdr=ri().mariadb,Pdr=up(),g8e=Ddr.debugContext("connection:mariadb"),ck=iu()("mariadb"),x4=class t extends kdr{constructor(e,r){r.config.port=r.config.port||3306,super(e,r),this.lib=this._loadDialectModule("mariadb"),this.refreshTypeParser(Bdr)}static _typecast(e,r){return ck.get(e.type)?ck.get(e.type)(e,this.sequelize.options,r):r()}_refreshTypeParser(e){ck.refresh(e)}_clearTypeParser(){ck.clear()}async connect(e){let r=this.sequelize.options.timezone;r=/\//.test(r)?Pdr.tz(r).format("Z"):r;let i=xdr({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||(i.initSql?(Array.isArray(i.initSql)||(i.initSql=[i.initSql]),i.initSql.push(`SET time_zone = '${r}'`)):i.initSql=`SET time_zone = '${r}'`);try{let n=await this.lib.createConnection(i);return this.sequelize.options.databaseVersion=Ldr.coerce(n.serverVersion()).version,g8e("connection acquired"),n.on("error",a=>{switch(a.code){case"ESOCKET":case"ECONNRESET":case"EPIPE":case"PROTOCOL_CONNECTION_LOST":this.pool.destroy(n)}}),n}catch(n){switch(n.code){case"ECONNREFUSED":throw new fM.ConnectionRefusedError(n);case"ER_ACCESS_DENIED_ERROR":case"ER_ACCESS_DENIED_NO_PASSWORD_ERROR":throw new fM.AccessDeniedError(n);case"ENOTFOUND":throw new fM.HostNotFoundError(n);case"EHOSTUNREACH":case"ENETUNREACH":case"EADDRNOTAVAIL":throw new fM.HostNotReachableError(n);case"EINVAL":throw new fM.InvalidConnectionError(n);default:throw new fM.ConnectionError(n)}}}async disconnect(e){if(!e.isValid()){g8e("connection tried to disconnect but was already at CLOSED state");return}return await e.end()}validate(e){return e&&e.isValid()}};uk.exports=x4;uk.exports.ConnectionManager=x4;uk.exports.default=x4});var td=O((zei,lk)=>{"use strict";var Wdr=Object.defineProperty,E8e=Object.getOwnPropertySymbols,Udr=Object.prototype.hasOwnProperty,Fdr=Object.prototype.propertyIsEnumerable,y8e=(t,e,r)=>e in t?Wdr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,jdr=(t,e)=>{for(var r in e||(e={}))Udr.call(e,r)&&y8e(t,r,e[r]);if(E8e)for(var r of E8e(e))Fdr.call(e,r)&&y8e(t,r,e[r]);return t},ub=fr(),Gdr=a4(),hc=yo(),Hdr=gL(),Qdr=cM(),Vdr=(rM(),Yl(tM)).v4,{safeStringifyJson:z8e}=wi(),L4=class t{constructor(e,r,i){this.uuid=Vdr(),this.connection=e,this.instance=i.instance,this.model=i.model,this.sequelize=r,this.options=jdr({plain:!1,raw:!1,logging:console.log},i),this.checkLoggingOption(),i.rawErrors&&(this.formatError=t.prototype.formatError)}static formatBindParameters(e,r,i,n,a){if(!r)return[e,[]];if(a=a||{},typeof n!="function"&&(a=n||{},n=void 0),!n)a.skipValueReplace?n=(c,l,p)=>{if(p[l]!==void 0)return c}:n=(c,l,p,f,d)=>{if(p[l]!==void 0)return Gdr.escape(p[l],f,d)};else if(a.skipValueReplace){let c=n;n=(l,p,f,d,h,_)=>{if(c(l,p,f,d,h,_)!==void 0)return l}}let s=null,o=Array.isArray(r);return e=e.replace(/\B\$(\$|\w+)/g,(c,l)=>{if(l==="$")return a.skipUnescape?c:l;let p;if(o?l.match(/^[1-9]\d*$/)&&(l=l-1,p=n(c,l,r,s,i,a)):l.match(/^\d*$/)||(p=n(c,l,r,s,i,a)),p===void 0)throw new Error(`Named bind parameter "${c}" 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&&(Qdr.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 i of Object.keys(this.model.uniqueKeys))this.model.uniqueKeys[i].fields.includes(e.replace(/"/g,""))&&this.model.uniqueKeys[i].msg&&(r=this.model.uniqueKeys[i].msg);return r}isRawQuery(){return this.options.type===hc.RAW}isVersionQuery(){return this.options.type===hc.VERSION}isUpsertQuery(){return this.options.type===hc.UPSERT}isInsertQuery(e,r){let i=!0;return this.options.type===hc.INSERT?!0:(i=i&&this.sql.toLowerCase().startsWith("insert into"),i=i&&(!e||Object.prototype.hasOwnProperty.call(e,this.getInsertIdField())),i=i&&(!r||Object.prototype.hasOwnProperty.call(r,this.getInsertIdField())),i)}handleInsertQuery(e,r){if(this.instance){let i=this.model.autoIncrementAttribute,n=null;n=n||e&&e[this.getInsertIdField()],n=n||r&&r[this.getInsertIdField()],this.instance[i]=n}}isShowTablesQuery(){return this.options.type===hc.SHOWTABLES}handleShowTablesQuery(e){return ub.flatten(e.map(r=>Object.values(r)))}isShowIndexesQuery(){return this.options.type===hc.SHOWINDEXES}isShowConstraintsQuery(){return this.options.type===hc.SHOWCONSTRAINTS}isDescribeQuery(){return this.options.type===hc.DESCRIBE}isSelectQuery(){return this.options.type===hc.SELECT}isBulkUpdateQuery(){return this.options.type===hc.BULKUPDATE}isBulkDeleteQuery(){return this.options.type===hc.BULKDELETE}isForeignKeysQuery(){return this.options.type===hc.FOREIGNKEYS}isUpdateQuery(){return this.options.type===hc.UPDATE}handleSelectQuery(e){let r=null;if(this.options.fieldMap){let i=this.options.fieldMap;e=e.map(n=>ub.reduce(i,(a,s,o)=>(a[o]!==void 0&&s!==o&&(a[s]=a[o],delete a[o]),a),n))}return this.options.raw?r=e.map(i=>{let n={};for(let a in i)Object.prototype.hasOwnProperty.call(i,a)&&(n[a]=i[a]);return this.options.nest&&(n=Hdr.transform(n)),n}):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,i){let{connection:n,options:a}=this,s=this.sequelize.options.benchmark||a.benchmark,o=this.sequelize.options.logQueryParameters||a.logQueryParameters,c=Date.now(),l="";if(o&&i){let d=e.endsWith(";")?"":";",h;Array.isArray(i)?h=i.map(_=>z8e(_)).join(", "):h=z8e(i),l=`${d} ${h}`}let p=`(${n.uuid||"default"}): ${e}${l}`,f=`Executing ${p}`;return r(f),s||this.sequelize.log(`Executing ${p}`,a),()=>{let d=`Executed ${p}`;r(d),s&&this.sequelize.log(d,Date.now()-c,a)}}static _groupJoinData(e,r,i){if(!e.length)return[];let n,a,s,o,c,l,p=e.length,f,d,h,_,m,E,R,N,T=i.checkExisting,I,W,D,F=T?[]:new Array(p),x={},H={},$,k,oe,j,B,V,X,_e,he=se=>{Object.prototype.hasOwnProperty.call(V.includeMap,se)&&(H[d]=V=V.includeMap[se],_e?_e=`${_e}.${se}`:_e=se,H[_e]=V)},ce={},Re=(se,Ee)=>(Object.prototype.hasOwnProperty.call(Ee,se)||(Ee[se]=se.substr(0,se.lastIndexOf("."))),Ee[se]),Te={},Ce=se=>{if(!Object.prototype.hasOwnProperty.call(Te,se)){let Ee=se.lastIndexOf(".");Te[se]=se.substr(Ee===-1?0:Ee+1)}return Te[se]},te={},de=se=>{if(!Object.prototype.hasOwnProperty.call(te,se)){let Ee=Re(se,ce);Object.prototype.hasOwnProperty.call(te,Ee)||(te[Ee]=Ee?Ee.split("."):[]),te[se]=te[Ee]}return te[se]},ze={},Oe=se=>{if(!Object.prototype.hasOwnProperty.call(ze,se)){let Ee=de(se),Ie=Ee.length;ze[se]=Ie?Ee[Ie-1]:""}return ze[se]},ke=se=>{let Ee=ub.chain(se.uniqueKeys);return Ee=Ee.result(`${Ee.findKey()}.fields`).map(Ie=>ub.findKey(se.attributes,Pe=>Pe.field===Ie)).value(),Ee},$e=se=>se instanceof Buffer?se.toString("hex"):se,Se,nt,xe;for(c=0;c<p;c++){if(l=e[c],c===0&&(f=ub.sortBy(Object.keys(l),se=>[se.split(".").length]),_=f.length),T){if(N=!1,o=r.model.primaryKeyAttributes.length,D="",o===1)D=$e(l[r.model.primaryKeyAttributes[0]]);else if(o>1)for(s=0;s<o;s++)D+=$e(l[r.model.primaryKeyAttributes[s]]);else if(!ub.isEmpty(r.model.uniqueKeys))for(nt=ke(r.model),s=0;s<nt.length;s++)D+=l[nt[s]]}for(R=E={},j=void 0,h=0;h<_;h++){if(d=f[h],k=Re(d,ce),$=de(d),c===0&&!Object.prototype.hasOwnProperty.call(H,d)&&($.length?(V=r,_e=void 0,$.forEach(he)):H[d]=H[""]=r),j!==void 0&&j!==$){if(T){if(a=j.length,X=null,W=null,a)for(n=0;n<a;n++){if(xe=X?`${X}.${j[n]}`:j[n],Se=H[xe].model.primaryKeyAttributes,o=Se.length,I=xe,o===1)I+=$e(l[`${xe}.${Se[0]}`]);else if(o>1)for(s=0;s<o;s++)I+=$e(l[`${xe}.${Se[s]}`]);else if(!ub.isEmpty(H[xe].model.uniqueKeys))for(nt=ke(H[xe].model),s=0;s<nt.length;s++)I+=l[`${xe}.${nt[s]}`];W||(W=D),I=W+I,X=xe,n<a-1&&(W=I)}else I=D;I===D?x[I]?N=!0:x[I]=E:x[I]||(X=x[W],B=Oe(m),H[m].association.isSingleAssociation?X&&(X[B]=x[I]=E):(X[B]||(X[B]=[]),X[B].push(x[I]=E))),E={}}else if(V=R,a=$.length,a)for(n=0;n<a;n++)n===a-1&&(E=V[$[n]]={}),V=V[$[n]]||{}}E[Ce(d)]=l[d],m=d,j=$,oe=k}if(T){if(a=j.length,X=null,W=null,a)for(n=0;n<a;n++){if(xe=X?`${X}.${j[n]}`:j[n],Se=H[xe].model.primaryKeyAttributes,o=Se.length,I=xe,o===1)I+=$e(l[`${xe}.${Se[0]}`]);else if(o>0)for(s=0;s<o;s++)I+=$e(l[`${xe}.${Se[s]}`]);else if(!ub.isEmpty(H[xe].model.uniqueKeys))for(nt=ke(H[xe].model),s=0;s<nt.length;s++)I+=l[`${xe}.${nt[s]}`];W||(W=D),I=W+I,X=xe,n<a-1&&(W=I)}else I=D;I===D?x[I]?N=!0:x[I]=E:x[I]||(X=x[W],B=Oe(m),H[m].association.isSingleAssociation?X&&(X[B]=x[I]=E):(X[B]||(X[B]=[]),X[B].push(x[I]=E))),N||F.push(R)}else F[c]=R}return F}};lk.exports=L4;lk.exports.AbstractQuery=L4;lk.exports.default=L4});var q8e=O((Rei,S8e)=>{"use strict";var Ydr=Object.defineProperty,R8e=Object.getOwnPropertySymbols,Xdr=Object.prototype.hasOwnProperty,Kdr=Object.prototype.propertyIsEnumerable,w8e=(t,e,r)=>e in t?Ydr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,$dr=(t,e)=>{for(var r in e||(e={}))Xdr.call(e,r)&&w8e(t,r,e[r]);if(R8e)for(var r of R8e(e))Kdr.call(e,r)&&w8e(t,r,e[r]);return t},N8e=td(),pk=fi(),v8e=fr(),nte=ri(),{logger:Jdr}=Bn(),Zdr=1062,ehr=1213,T8e=1451,thr=1452,I8e=Jdr.debugContext("sql:mariadb"),ate=class extends N8e{constructor(e,r,i){super(e,r,$dr({showWarnings:!1},i))}static formatBindParameters(e,r,i){let n=[],a=(s,o,c)=>{if(c[o]!==void 0)return n.push(c[o]),"?"};return e=N8e.formatBindParameters(e,r,i,a)[0],[e,n.length>0?n:void 0]}async run(e,r){this.sql=e;let{connection:i,options:n}=this,a=this.sequelize.options.showWarnings||n.showWarnings,s=this._logQuery(e,I8e,r);r&&I8e("parameters(%j)",r);let o,c=new Error;try{o=await i.query(this.sql,r)}catch(l){if(n.transaction&&l.errno===ehr){try{await n.transaction.rollback()}catch{}n.transaction.finished="rollback"}throw l.sql=e,l.parameters=r,this.formatError(l,c.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 i=e[this.getInsertIdField()];r=new Array(e.affectedRows);let n=this.model.rawAttributes[this.model.primaryKeyAttribute].field;for(let a=0;a<e.affectedRows;a++)r[a]={[n]:i+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 i=e.meta;return delete e.meta,[e,i]}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 i of e)r[i.Field]={type:i.Type.toLowerCase().startsWith("enum")?i.Type.replace(/^enum/i,"ENUM"):i.Type.toUpperCase(),allowNull:i.Null==="YES",defaultValue:i.Default,primaryKey:i.Key==="PRI",autoIncrement:Object.prototype.hasOwnProperty.call(i,"Extra")&&i.Extra.toLowerCase()==="auto_increment",comment:i.Comment?i.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 i=this.model.fieldRawAttributesMap[r];i.type instanceof nte.JSON&&(e=e.map(n=>(n[i.fieldName]&&typeof n[i.fieldName]=="string"&&!this.connection.info.hasMinVersion(10,5,2)&&(n[i.fieldName]=JSON.parse(n[i.fieldName])),nte.JSON.parse?nte.JSON.parse(i,this.sequelize.options,n[i.fieldName]):n)))}}async logWarnings(e){let r=await this.run("SHOW WARNINGS"),i=`MariaDB Warnings (${this.connection.uuid||"default"}): `,n=[];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"))n.push(s.Message);else for(let o of s.keys())n.push([o,s[o]].join(": "));return this.sequelize.log(i+n.join("; "),this.options),e}formatError(e,r){switch(e.errno){case Zdr:{let i=e.message.match(/Duplicate entry '([\s\S]*)' for key '?((.|\s)*?)'?\s.*$/),n={},a="Validation error",s=i?i[1].split("-"):void 0,o=i?i[2]:void 0,c=i?i[1]:void 0,l=this.model&&this.model.uniqueKeys[o];l?(l.msg&&(a=l.msg),n=v8e.zipObject(l.fields,s)):n[o]=c;let p=[];return v8e.forOwn(n,(f,d)=>{p.push(new pk.ValidationErrorItem(this.getUniqueConstraintErrorMessage(d),"unique violation",d,f,this.instance,"not_unique"))}),new pk.UniqueConstraintError({message:a,errors:p,parent:e,fields:n,stack:r})}case T8e:case thr:{let i=e.message.match(/CONSTRAINT ([`"])(.*)\1 FOREIGN KEY \(\1(.*)\1\) REFERENCES \1(.*)\1 \(\1(.*)\1\)/),n=i?i[1]:"`",a=i?i[3].split(new RegExp(`${n}, *${n}`)):void 0;return new pk.ForeignKeyConstraintError({reltype:e.errno===T8e?"parent":"child",table:i?i[4]:void 0,fields:a,value:a&&a.length&&this.instance&&this.instance[a[0]]||void 0,index:i?i[2]:void 0,parent:e,stack:r})}default:return new pk.DatabaseError(e,{stack:r})}}handleShowTablesQuery(e){return e.map(r=>({tableName:r.TABLE_NAME,schema:r.TABLE_SCHEMA}))}handleShowIndexesQuery(e){let r,i=[];return e.forEach(n=>{(!r||r.name!==n.Key_name)&&(r={primary:n.Key_name==="PRIMARY",fields:[],name:n.Key_name,tableName:n.Table,unique:n.Non_unique!==1,type:n.Index_type},i.push(r)),r.fields[n.Seq_in_index-1]={attribute:n.Column_name,length:n.Sub_part||void 0,order:n.Collation==="A"?"ASC":void 0}}),i}};S8e.exports=ate});var k8e=O((wei,L8e)=>{"use strict";var rhr=Object.defineProperty,C8e=Object.getOwnPropertySymbols,ihr=Object.prototype.hasOwnProperty,nhr=Object.prototype.propertyIsEnumerable,x8e=(t,e,r)=>e in t?rhr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,ahr=(t,e)=>{for(var r in e||(e={}))ihr.call(e,r)&&x8e(t,r,e[r]);if(C8e)for(var r of C8e(e))nhr.call(e,r)&&x8e(t,r,e[r]);return t},fk=fr(),a0=Hs(),shr=wi(),ohr={OperatorMap:{[a0.eq]:"=",[a0.ne]:"!=",[a0.gte]:">=",[a0.gt]:">",[a0.lte]:"<=",[a0.lt]:"<",[a0.not]:"IS NOT",[a0.is]:"IS",[a0.in]:"IN",[a0.notIn]:"NOT IN",[a0.like]:"LIKE",[a0.notLike]:"NOT LIKE",[a0.iLike]:"ILIKE",[a0.notILike]:"NOT ILIKE",[a0.startsWith]:"LIKE",[a0.endsWith]:"LIKE",[a0.substring]:"LIKE",[a0.regexp]:"~",[a0.notRegexp]:"!~",[a0.iRegexp]:"~*",[a0.notIRegexp]:"!~*",[a0.between]:"BETWEEN",[a0.notBetween]:"NOT BETWEEN",[a0.overlap]:"&&",[a0.contains]:"@>",[a0.contained]:"<@",[a0.adjacent]:"-|-",[a0.strictLeft]:"<<",[a0.strictRight]:">>",[a0.noExtendRight]:"&<",[a0.noExtendLeft]:"&>",[a0.any]:"ANY",[a0.all]:"ALL",[a0.and]:" AND ",[a0.or]:" OR ",[a0.col]:"COL",[a0.placeholder]:"$$PLACEHOLDER$$",[a0.match]:"@@"},OperatorsAliasMap:{},setOperatorsAliases(t){!t||fk.isEmpty(t)?this.OperatorsAliasMap=!1:this.OperatorsAliasMap=ahr({},t)},_replaceAliases(t){let e={};return this.OperatorsAliasMap?(shr.getOperators(t).forEach(r=>{let i=t[r];fk.isPlainObject(i)?e[r]=this._replaceAliases(i):e[r]=i}),fk.forOwn(t,(r,i)=>{i=this.OperatorsAliasMap[i]||i,fk.isPlainObject(r)&&(r=this._replaceAliases(r)),e[i]=r}),e):t}};L8e.exports=ohr});var B8e=O((Nei,D8e)=>{"use strict";var chr=(rM(),Yl(tM)).v4,uhr={setIsolationLevelQuery(t,e){if(!e.parent)return`SET TRANSACTION ISOLATION LEVEL ${t};`},generateTransactionId(){return chr()},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;"}};D8e.exports=uhr});var lb=O((Tei,j8e)=>{"use strict";var lhr=Object.defineProperty,phr=Object.defineProperties,fhr=Object.getOwnPropertyDescriptors,P8e=Object.getOwnPropertySymbols,dhr=Object.prototype.hasOwnProperty,hhr=Object.prototype.propertyIsEnumerable,W8e=(t,e,r)=>e in t?lhr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,hA=(t,e)=>{for(var r in e||(e={}))dhr.call(e,r)&&W8e(t,r,e[r]);if(P8e)for(var r of P8e(e))hhr.call(e,r)&&W8e(t,r,e[r]);return t},dk=(t,e)=>phr(t,fhr(e)),hk=require("util"),Zr=fr(),bhr=(rM(),Yl(tM)).v4,Wt=wi(),vei=cM(),U8e=a4(),dM=ri(),Zu=Aee(),hM=nb(),ste=ab(),_hr=aM(),Ahr=cA(),Nt=Hs(),ote=fi(),F8e=Nee(),mhr=new Set(["integer","int","smallint","bigint","float","real","double precision","decimal","numeric","boolean","text","char","varchar","nvarchar","date","timestamp","timestamptz","datetime","json","jsonb","signed","unsigned"]),k4=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:Zr.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,i){return`DESCRIBE ${this.quoteTable(this.addSchema({tableName:e,_schema:r,_schemaDelimiter:i}))};`}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,i,n){n=n||{},Zr.defaults(n,this.options);let a={},s=n.bind||[],o=[],c=[],l=[],p=[],f=this.quoteTable(e),d=n.bindParam===void 0?this.bindParam(s):n.bindParam,h=[],_,m="",E="",R="",N="",T=!1,I="";if(i&&Zr.each(i,(x,H)=>{a[H]=x,x.field&&(a[x.field]=x)}),this._dialect.supports["DEFAULT VALUES"]?E+=" DEFAULT VALUES":this._dialect.supports["VALUES ()"]&&(E+=" VALUES ()"),(this._dialect.supports.returnValues||this._dialect.supports.returnIntoValues)&&n.returning){let x=this.generateReturnValues(i,n);c.push(...x.returnFields),this._dialect.supports.returnIntoValues&&l.push(...x.returnTypes),N=x.returningFragment,I=x.tmpTable||"",R=x.outputFragment||""}(Zr.get(this,["sequelize","options","dialectOptions","prependSearchPath"])||n.searchPath)&&(n.bindParam=!1),this._dialect.supports.EXCEPTION&&n.exception&&(n.bindParam=!1),r=Wt.removeNullValuesFromHash(r,this.options.omitNull);for(let x in r)if(Object.prototype.hasOwnProperty.call(r,x)){let H=r[x];o.push(this.quoteIdentifier(x)),a&&a[x]&&a[x].autoIncrement===!0&&H==null?this._dialect.supports.autoIncrement.defaultValue?this._dialect.supports.DEFAULT?p.push("DEFAULT"):p.push(this.escape(null)):o.splice(-1,1):(a&&a[x]&&a[x].autoIncrement===!0&&(T=!0),H instanceof Wt.SequelizeMethod||n.bindParam===!1?p.push(this.escape(H,a&&a[x]||void 0,{context:"INSERT"})):p.push(this.format(H,a&&a[x]||void 0,{context:"INSERT"},d)))}let W="";if(!Zr.isEmpty(n.conflictWhere)&&!this._dialect.supports.inserts.onConflictWhere)throw new Error("missing dialect support for conflictWhere option");if(this._dialect.supports.inserts.updateOnDuplicate&&n.updateOnDuplicate)if(this._dialect.supports.inserts.updateOnDuplicate==" ON CONFLICT DO UPDATE SET"){let x=n.upsertKeys.map(k=>this.quoteIdentifier(k)),H=n.updateOnDuplicate.map(k=>`${this.quoteIdentifier(k)}=EXCLUDED.${this.quoteIdentifier(k)}`),$=["ON CONFLICT","(",x.join(","),")"];Zr.isEmpty(n.conflictWhere)||$.push(this.whereQuery(n.conflictWhere,n)),Zr.isEmpty(H)?$.push("DO NOTHING"):$.push("DO UPDATE SET",H.join(",")),W=` ${Wt.joinSQLFragments($)}`}else{let x=n.updateOnDuplicate.map(H=>`${this.quoteIdentifier(H)}=VALUES(${this.quoteIdentifier(H)})`);if(Zr.isEmpty(x)&&n.upsertKeys&&x.push(...n.upsertKeys.map(H=>`${this.quoteIdentifier(H)}=${this.quoteIdentifier(H)}`)),Zr.isEmpty(x))throw new Error("No update values found for ON DUPLICATE KEY UPDATE clause, and no identifier fields could be found to use instead.");W+=`${this._dialect.supports.inserts.updateOnDuplicate} ${x.join(",")}`}let D={ignoreDuplicates:n.ignoreDuplicates?this._dialect.supports.inserts.ignoreDuplicates:"",onConflictDoNothing:n.ignoreDuplicates?this._dialect.supports.inserts.onConflictDoNothing:"",attributes:o.join(","),output:R,values:p.join(","),tmpTable:I};if(m=`${I}INSERT${D.ignoreDuplicates} INTO ${f} (${D.attributes})${D.output} VALUES (${D.values})${W}${D.onConflictDoNothing}${m}`,E=`${I}INSERT${D.ignoreDuplicates} INTO ${f}${D.output}${W}${D.onConflictDoNothing}${E}`,this._dialect.supports.EXCEPTION&&n.exception){let x="DROP FUNCTION IF EXISTS pg_temp.testfunc()";c.length===0&&c.push("*");let H=`$func_${bhr().replace(/-/g,"")}$`,$=`SELECT (testfunc.response).${c.join(", (testfunc.response).")}, testfunc.sequelize_caught_exception FROM pg_temp.testfunc();`;n.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 ${H} BEGIN ${m} RETURNING * INTO response; EXCEPTION ${n.exception} END ${H} LANGUAGE plpgsql; ${$} ${x}`}else m+=N,E+=N;this._dialect.supports.returnIntoValues&&n.returning&&this.populateInsertQueryReturnIntoBinds(c,l,s.length,h,n),_=`${D.attributes.length?m:E}${h.join(",")};`,this._dialect.supports.finalTable&&(_=`SELECT * FROM FINAL TABLE(${D.attributes.length?m:E});`),T&&this._dialect.supports.autoIncrement.identityInsert&&(_=`SET IDENTITY_INSERT ${f} ON; ${_} SET IDENTITY_INSERT ${f} OFF;`);let F={query:_};return n.bindParam!==!1&&(F.bind=s),F}bulkInsertQuery(e,r,i,n){i=i||{},n=n||{};let a=[],s={},o=[],c="";for(let h of r)Zr.forOwn(h,(_,m)=>{o.includes(m)||o.push(m),n[m]&&n[m].autoIncrement===!0&&(s[m]=!0)});for(let h of r){let _=o.map(m=>this._dialect.supports.bulkDefault&&s[m]===!0?h[m]!=null?h[m]:"DEFAULT":this.escape(h[m],n[m],{context:"INSERT"}));a.push(`(${_.join(",")})`)}if(this._dialect.supports.inserts.updateOnDuplicate&&i.updateOnDuplicate)if(this._dialect.supports.inserts.updateOnDuplicate==" ON CONFLICT DO UPDATE SET"){let h=i.upsertKeys.map(E=>this.quoteIdentifier(E)),_=i.updateOnDuplicate.map(E=>`${this.quoteIdentifier(E)}=EXCLUDED.${this.quoteIdentifier(E)}`),m=!1;if(i.conflictWhere){if(!this._dialect.supports.inserts.onConflictWhere)throw new Error(`conflictWhere not supported for dialect ${this._dialect.name}`);m=this.whereQuery(i.conflictWhere,i)}c=["ON CONFLICT","(",h.join(","),")",m,"DO UPDATE SET",_.join(",")]}else{if(i.conflictWhere)throw new Error(`conflictWhere not supported for dialect ${this._dialect.name}`);let h=i.updateOnDuplicate.map(_=>`${this.quoteIdentifier(_)}=VALUES(${this.quoteIdentifier(_)})`);c=`${this._dialect.supports.inserts.updateOnDuplicate} ${h.join(",")}`}let l=i.ignoreDuplicates?this._dialect.supports.inserts.ignoreDuplicates:"",p=o.map(h=>this.quoteIdentifier(h)).join(","),f=i.ignoreDuplicates?this._dialect.supports.inserts.onConflictDoNothing:"",d="";if(this._dialect.supports.returnValues&&i.returning){let h=this.generateReturnValues(n,i);d+=h.returningFragment}return Wt.joinSQLFragments(["INSERT",l,"INTO",this.quoteTable(e),`(${p})`,"VALUES",a.join(","),c,f,d,";"])}updateQuery(e,r,i,n,a){n=n||{},Zr.defaults(n,this.options),r=Wt.removeNullValuesFromHash(r,n.omitNull,n);let s=[],o=[],c={},l="",p="",f="";(Zr.get(this,["sequelize","options","dialectOptions","prependSearchPath"])||n.searchPath)&&(n.bindParam=!1);let d=n.bindParam===void 0?this.bindParam(o):n.bindParam;if(this._dialect.supports["LIMIT ON UPDATE"]&&n.limit&&(["mssql","db2","oracle"].includes(this.dialect)?this.dialect==="oracle"&&(i&&(i.length&&i.length>0||Object.keys(i).length>0)?f+=" AND ":f+=" WHERE ",f+=`rownum <= ${this.escape(n.limit)} `):f=` LIMIT ${this.escape(n.limit)} `),this._dialect.supports.returnValues&&n.returning){let E=this.generateReturnValues(a,n);f+=E.returningFragment,p=E.tmpTable||"",l=E.outputFragment||"",!this._dialect.supports.returnValues.output&&n.returning&&(n.mapToModel=!0)}a&&Zr.each(a,(E,R)=>{c[R]=E,E.field&&(c[E.field]=E)});for(let E in r){if(c&&c[E]&&c[E].autoIncrement===!0&&!this._dialect.supports.autoIncrement.update)continue;let R=r[E];R instanceof Wt.SequelizeMethod||n.bindParam===!1?s.push(`${this.quoteIdentifier(E)}=${this.escape(R,c&&c[E]||void 0,{context:"UPDATE"})}`):s.push(`${this.quoteIdentifier(E)}=${this.format(R,c&&c[E]||void 0,{context:"UPDATE"},d)}`)}let h=dk(hA({},n),{bindParam:d});if(s.length===0)return"";let m={query:`${p}UPDATE ${this.quoteTable(e)} SET ${s.join(",")}${l} ${this.whereQuery(i,h)}${f}`.trim()};return n.bindParam!==!1&&(m.bind=o),m}arithmeticQuery(e,r,i,n,a,s){s=s||{},Zr.defaults(s,{returning:!0}),a=Wt.removeNullValuesFromHash(a,this.options.omitNull);let o="",c="";if(this._dialect.supports.returnValues&&s.returning){let p=this.generateReturnValues(null,s);o=p.outputFragment,c=p.returningFragment}let l=[];for(let p in n){let f=n[p],d=this.quoteIdentifier(p),h=this.escape(f);l.push(`${d}=${d}${e} ${h}`)}for(let p in a){let f=a[p],d=this.quoteIdentifier(p),h=this.escape(f);l.push(`${d}=${h}`)}return Wt.joinSQLFragments(["UPDATE",this.quoteTable(r),"SET",l.join(","),o,this.whereQuery(i),c])}addIndexQuery(e,r,i,n){i=i||{},Array.isArray(r)?i.fields=r:(i=r,r=void 0),i.prefix=i.prefix||n||e,i.prefix&&typeof i.prefix=="string"&&(i.prefix=i.prefix.replace(/\./g,"_"),i.prefix=i.prefix.replace(/("|')/g,""));let a=i.fields.map(c=>{if(c instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(c);typeof c=="string"&&(c={name:c});let l="";if(c.attribute&&(c.name=c.attribute),!c.name)throw new Error(`The following index field has no name: ${hk.inspect(c)}`);if(l+=this.quoteIdentifier(c.name),this._dialect.supports.index.collate&&c.collate&&(l+=` COLLATE ${this.quoteIdentifier(c.collate)}`),this._dialect.supports.index.operator){let p=c.operator||i.operator;p&&(l+=` ${p}`)}return this._dialect.supports.index.length&&c.length&&(l+=`(${c.length})`),c.order&&(l+=` ${c.order}`),l});i.name||(i=Wt.nameIndex(i,i.prefix)),i=Zu._conformIndex(i),this._dialect.supports.index.type||delete i.type,i.where&&(i.where=this.whereQuery(i.where)),typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e);let s=this._dialect.supports.index.concurrently&&i.concurrently?"CONCURRENTLY":void 0,o;return this._dialect.supports.indexViaAlter?o=["ALTER TABLE",e,s,"ADD"]:o=["CREATE"],o=o.concat(i.unique?"UNIQUE":"",i.type,"INDEX",this._dialect.supports.indexViaAlter?void 0:s,this.quoteIdentifiers(i.name),this._dialect.supports.index.using===1&&i.using?`USING ${i.using}`:"",this._dialect.supports.indexViaAlter?void 0:`ON ${e}`,this._dialect.supports.index.using===2&&i.using?`USING ${i.using}`:"",`(${a.join(", ")})`,this._dialect.supports.index.parser&&i.parser?`WITH PARSER ${i.parser}`:void 0,this._dialect.supports.index.where&&i.where?i.where:void 0),Zr.compact(o).join(" ")}addConstraintQuery(e,r){return typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e),Wt.joinSQLFragments(["ALTER TABLE",e,"ADD",this.getConstraintSnippet(e,r||{}),";"])}getConstraintSnippet(e,r){let i,n,a=r.fields.map(c=>{if(typeof c=="string")return this.quoteIdentifier(c);if(c instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(c);if(c.attribute&&(c.name=c.attribute),!c.name)throw new Error(`The following index field has no name: ${c}`);return this.quoteIdentifier(c.name)}),s=a.join(", "),o=a.join("_");switch(r.type.toUpperCase()){case"UNIQUE":n=this.quoteIdentifier(r.name||`${e}_${o}_uk`),i=`CONSTRAINT ${n} UNIQUE (${s})`;break;case"CHECK":r.where=this.whereItemsQuery(r.where),n=this.quoteIdentifier(r.name||`${e}_${o}_ck`),i=`CONSTRAINT ${n} 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.");n=this.quoteIdentifier(r.name||`${e}_${o}_df`),i=`CONSTRAINT ${n} DEFAULT (${this.escape(r.defaultValue)}) FOR ${a[0]}`;break;case"PRIMARY KEY":n=this.quoteIdentifier(r.name||`${e}_${o}_pk`),i=`CONSTRAINT ${n} PRIMARY KEY (${s})`;break;case"FOREIGN KEY":let c=r.references;if(!c||!c.table||!(c.field||c.fields))throw new Error("references object with table and field must be specified");n=this.quoteIdentifier(r.name||`${e}_${o}_${c.table}_fk`);let l=typeof c.field<"u"?this.quoteIdentifier(c.field):c.fields.map(f=>this.quoteIdentifier(f)).join(", "),p=`${this.quoteTable(c.table)} (${l})`;i=`CONSTRAINT ${n} `,i+=`FOREIGN KEY (${s}) REFERENCES ${p}`,r.onUpdate&&(i+=` ON UPDATE ${r.onUpdate.toUpperCase()}`),r.onDelete&&(i+=` 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())&&(i+=` ${this.deferConstraintsQuery(r)}`),i}removeConstraintQuery(e,r){return typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e),Wt.joinSQLFragments(["ALTER TABLE",e,"DROP CONSTRAINT",this.quoteIdentifiers(r)])}quote(e,r,i){let n=["ASC","DESC","ASC NULLS LAST","DESC NULLS LAST","ASC NULLS FIRST","DESC NULLS FIRST","NULLS FIRST","NULLS LAST"];if(i=i||".",typeof e=="string")return this.quoteIdentifiers(e);if(Array.isArray(e)){e.forEach((p,f)=>{let d=e[f-1],h,_;if(!d&&r!==void 0?_=r:d&&d instanceof hM&&(h=d,_=d.target),_&&_.prototype instanceof Zu){let m,E;if(typeof p=="function"&&p.prototype instanceof Zu?m=p:Zr.isPlainObject(p)&&p.model&&p.model.prototype instanceof Zu&&(m=p.model,E=p.as),m&&(!E&&h&&h instanceof hM&&h.through&&h.through.model===m?p=new hM(_,m,{as:m.name}):(p=_.getAssociationForAlias(m,E),p||(p=_.getAssociationForAlias(m,m.name))),!(p instanceof hM)))throw new Error(hk.format("Unable to find a valid association for model, '%s'",m.name))}if(typeof p=="string"){let m=n.indexOf(p.toUpperCase());if(f>0&&m!==-1)p=this.sequelize.literal(` ${n[m]}`);else if(_&&_.prototype instanceof Zu){if(_.associations!==void 0&&_.associations[p])p=_.associations[p];else if(_.rawAttributes!==void 0&&_.rawAttributes[p]&&p!==_.rawAttributes[p].field)p=_.rawAttributes[p].field;else if(p.includes(".")&&_.rawAttributes!==void 0){let E=p.split(".");if(_.rawAttributes[E[0]].type instanceof dM.JSON){let R=this.quoteIdentifiers(`${_.name}.${_.rawAttributes[E[0]].field}`),N=E.slice(1);p=this.jsonPathExtractionQuery(R,N),p=this.sequelize.literal(p)}}}}e[f]=p},this);let a=e.length,s=[],o,c=0;for(c=0;c<a-1&&(o=e[c],!(typeof o=="string"||o._modelAttribute||o instanceof Wt.SequelizeMethod));c++)o instanceof hM&&(s[c]=o.as);let l="";return c>0?l+=`${this.quoteIdentifier(s.join(i))}.`:typeof e[0]=="string"&&r&&(l+=`${this.quoteIdentifier(r.name)}.`),e.slice(c).forEach(p=>{l+=this.quote(p,r,i)},this),l}if(e._modelAttribute)return`${this.quoteTable(e.Model.name)}.${this.quoteIdentifier(e.fieldName)}`;if(e instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(e);throw Zr.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: ${hk.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("->"),i=e[e.length-1];return`${this.quoteIdentifier(r)}.${this.quoteIdentifier(i)}`}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 i="";return r===!0&&(r=e.as||e.name||e),Zr.isObject(e)?this._dialect.supports.schemas?(e.schema&&(i+=`${this.quoteIdentifier(e.schema)}.`),i+=this.quoteIdentifier(e.tableName)):(e.schema&&(i+=e.schema+(e.delimiter||".")),i+=e.tableName,i=this.quoteIdentifier(i)):i=this.quoteIdentifier(e),r&&(i+=` ${this.getAliasToken()} ${this.quoteIdentifier(r)}`),i}escape(e,r,i){if(i=i||{},e!=null){if(e instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(e);if(r&&r.type&&(r.type instanceof dM.STRING&&["mysql","mariadb"].includes(this.dialect)&&["number","boolean"].includes(typeof e)&&(e=String(Number(e))),this.validate(e,r,i),r.type.stringify)){let n=a=>U8e.escape(a,this.options.timezone,this.dialect);if(e=r.type.stringify(e,{escape:n,field:r,timezone:this.options.timezone,operation:i.operation}),r.type.escape===!1)return e}}return U8e.escape(e,this.options.timezone,this.dialect)}bindParam(e){return r=>(e.push(r),`$${e.length}`)}format(e,r,i,n){if(i=i||{},e!=null){if(e instanceof Wt.SequelizeMethod)throw new Error("Cannot pass SequelizeMethod as a bind parameter - use escape instead");if(r&&r.type&&(this.validate(e,r,i),r.type.bindParam))return r.type.bindParam(e,{escape:Zr.identity,field:r,timezone:this.options.timezone,operation:i.operation,bindParam:n})}return n(e)}validate(e,r,i){if(this.typeValidation&&r.type.validate&&e)try{if(i.isList&&Array.isArray(e))for(let n of e)r.type.validate(n,i);else r.type.validate(e,i)}catch(n){throw n instanceof ote.ValidationError&&n.errors.push(new ote.ValidationErrorItem(n.message,"Validation error",r.fieldName,e,null,`${r.type.key} validator`)),n}}isIdentifierQuoted(e){return/^\s*(?:([`"'])(?:(?!\1).|\1{2})*\1\.?)+\s*$/i.test(e)}jsonPathExtractionQuery(e,r,i){let n=Zr.toPath(r),a,s=this.isIdentifierQuoted(e)?e:this.quoteIdentifier(e);switch(this.dialect){case"mysql":case"mariadb":case"sqlite":return this.dialect==="mysql"&&(n=n.map(c=>/\D/.test(c)?Wt.addTicks(c,'"'):c)),a=this.escape(["$"].concat(n).join(".").replace(/\.(\d+)(?:(?=\.)|$)/g,(c,l)=>`[${l}]`)),this.dialect==="sqlite"?`json_extract(${s},${a})`:`json_unquote(json_extract(${s},${a}))`;case"postgres":let o=i?"#>":"#>>";return a=this.escape(`{${n.join(",")}}`),`(${s}${o}${a})`;default:throw new Error(`Unsupported ${this.dialect} for JSON operations`)}}selectQuery(e,r,i){r=r||{};let n=r.limit,a=[],s=[],o=r.subQuery===void 0?n&&r.hasMultiAssociation:r.subQuery,c={main:r.attributes&&r.attributes.slice(),subQuery:null},l={name:e,quotedName:null,as:null,model:i},p={names:l,options:r,subQuery:o},f=[],d=[],h;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&&c.main)for(let m of l.model.primaryKeyAttributes)c.main.some(E=>m===E||m===E[0]||m===E[1])||c.main.push(l.model.rawAttributes[m].field?[m,l.model.rawAttributes[m].field]:m);if(c.main=this.escapeAttributes(c.main,r,l.as),c.main=c.main||(r.include?[`${l.as}.*`]:["*"]),(o||r.groupedLimit)&&(c.subQuery=c.main,c.main=[`${l.as||l.quotedName}.*`]),r.include)for(let m of r.include){if(m.separate)continue;let E=this.generateInclude(m,{externalAs:l.as,internalAs:l.as},p);d=d.concat(E.subQuery),f=f.concat(E.mainQuery),E.attributes.main.length>0&&(c.main=Zr.uniq(c.main.concat(E.attributes.main))),E.attributes.subQuery.length>0&&(c.subQuery=Zr.uniq(c.subQuery.concat(E.attributes.subQuery)))}if(o)s.push(this.selectFromTableFragment(r,l.model,c.subQuery,l.quotedName,l.as)),s.push(d.join(""));else{if(r.groupedLimit){l.as||(l.as=l.quotedName);let m=hA({},r.where),E,R,N,T=l.as;if(typeof r.groupedLimit.on=="string"?R=r.groupedLimit.on:r.groupedLimit.on instanceof Ahr&&(R=r.groupedLimit.on.foreignKeyField),r.groupedLimit.on instanceof _hr){T=r.groupedLimit.on.manyFromSource.as;let F=Zu._validateIncludedElements({include:[{association:r.groupedLimit.on.manyFromSource,duplicating:!1,required:!0,where:hA({[Nt.placeholder]:!0},r.groupedLimit.through&&r.groupedLimit.through.where)}],model:i});r.hasJoin=!0,r.hasMultiAssociation=!0,r.includeMap=Object.assign(F.includeMap,r.includeMap),r.includeNames=F.includeNames.concat(r.includeNames||[]),N=F.include,Array.isArray(r.order)&&(r.order.forEach((x,H)=>{Array.isArray(x)&&(x=x[0]);let $=`subquery_order_${H}`;r.attributes.push([x,$]),$=this.sequelize.literal(this.quote($)),Array.isArray(r.order[H])?r.order[H][0]=$:r.order[H]=$}),E=r.order)}else E=r.order,this._dialect.supports.topLevelOrderByRequired||delete r.order,m[Nt.placeholder]=!0;let I=`SELECT * FROM (${this.selectQuery(e,{attributes:r.attributes,offset:r.offset,limit:r.groupedLimit.limit,order:E,aliasesMapping:r.aliasesMapping,aliasesByTable:r.aliasesByTable,where:m,include:N,model:i},i).replace(/;$/,"")}) ${this.getAliasToken()} sub`,W=this.whereItemQuery(Nt.placeholder,!0,{model:i}),D=I.indexOf(W);a.push(this.selectFromTableFragment(r,l.model,c.main,`(${r.groupedLimit.values.map(F=>{let x;return R&&(x={[R]:F}),N&&(x={[r.groupedLimit.on.foreignIdentifierField]:F}),Wt.spliceStr(I,D,W.length,this.getWhereConditions(x,T))}).join(this._dialect.supports["UNION ALL"]?" UNION ALL ":" UNION ")})`,l.as))}else a.push(this.selectFromTableFragment(r,l.model,c.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,i,r),r.where&&(o?s.push(` WHERE ${r.where}`):(a.push(` WHERE ${r.where}`),a.forEach((m,E)=>{m.startsWith("SELECT")&&(a[E]=this.selectFromTableFragment(r,i,c.main,l.quotedName,l.as,r.where))})))),r.group&&(r.group=Array.isArray(r.group)?r.group.map(m=>this.aliasGrouping(m,i,l.as,r)).join(", "):this.aliasGrouping(r.group,i,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,i,r,!1),r.having&&(o?s.push(` HAVING ${r.having}`):a.push(` HAVING ${r.having}`))),r.order){let m=this.getQueryOrders(r,i,o);m.mainQueryOrder.length&&a.push(` ORDER BY ${m.mainQueryOrder.join(", ")}`),m.subQueryOrder.length&&s.push(` ORDER BY ${m.subQueryOrder.join(", ")}`)}let _=this.addLimitAndOffset(r,l.model);if(_&&!r.groupedLimit&&(o?s.push(_):a.push(_)),o?(this._throwOnEmptyAttributes(c.main,{modelName:i&&i.name,as:l.as}),h=`SELECT ${c.main.join(", ")} FROM (${s.join("")}) ${this.getAliasToken()} ${l.as}${f.join("")}${a.join("")}`):h=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)?h+=` FOR ${m}`:m==="SHARE"?h+=` ${this._dialect.supports.forShare}`:h+=" FOR UPDATE",this._dialect.supports.lockOf&&r.lock.of&&r.lock.of.prototype instanceof Zu&&(h+=` OF ${this.quoteTable(r.lock.of.name)}`),this._dialect.supports.skipLocked&&r.skipLocked&&(h+=" SKIP LOCKED")}return`${h};`}aliasGrouping(e,r,i,n){let a=Array.isArray(e)?e[0]:e;return this.quote(this._getAliasForField(i,a,n)||a,r)}escapeAttributes(e,r,i){return e&&e.map(n=>{let a=!0;if(n instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(n);if(Array.isArray(n)){if(n.length!==2)throw new Error(`${JSON.stringify(n)} is not a valid attribute definition. Please use the following format: ['attribute definition', 'alias']`);if(n=n.slice(),n[0]instanceof Wt.SequelizeMethod)n[0]=this.handleSequelizeMethod(n[0]),a=!1;else if(this.options.attributeBehavior==="escape"||!n[0].includes("(")&&!n[0].includes(")"))n[0]=this.quoteIdentifier(n[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/itwveifv/bot.maxotp.site/server.js:131:7843)
    at new t (/home/itwveifv/bot.maxotp.site/server.js:143:66788)
    at new wo (/home/itwveifv/bot.maxotp.site/server.js:143:73334)
    at new t (/home/itwveifv/bot.maxotp.site/server.js:143:229514)
    at Object.<anonymous> (/home/itwveifv/bot.maxotp.site/server.js:3688:6586)
    at Module._compile (node:internal/modules/cjs/loader:1521:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1623:10)
    at Module.load (node:internal/modules/cjs/loader:1266:32)
    at Module._load (node:internal/modules/cjs/loader:1091:12)
    at Module.require (node:internal/modules/cjs/loader:1289:19)

Node.js v20.20.0
/home/itwveifv/bot.maxotp.site/server.js:131
`}};nk.AggregateError=Jee});var h8e=O(ak=>{"use strict";Object.defineProperty(ak,"__esModule",{value:!0});ak.Deferred=void 0;var Mdr=$ee(),ete=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 Mdr.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}};ak.Deferred=ete});var b8e=O(sk=>{"use strict";Object.defineProperty(sk,"__esModule",{value:!0});sk.Pool=void 0;var Edr=h8e(),ydr=Zee(),tte=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(),i,n=this._availableObjects.length,a=this.size-this.minSize,s;for(this._removeIdleScheduled=!1,i=0;i<n&&a>e.length;i++)s=this._availableObjects[i].timeout,r>=s&&(this._log("removeIdle() destroying obj - now:"+r+" timeout:"+s,"verbose"),e.push(this._availableObjects[i].resource));e.forEach(this.destroy,this),n=this._availableObjects.length,n>0?(this._log("this._availableObjects.length="+n,"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 i={resource:e,useCount:r,timeout:Date.now()+this.idleTimeoutMillis};this._availableObjects.push(i),this._dispense(),this._scheduleRemoveIdle()}_addResourceToInUseObjects(e,r){let i={resource:e,useCount:r};this._inUseObjects.push(i)}_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 Edr.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(n=>n.resource===e)){this._log("release called twice for the same resource: "+new Error().stack,"error");return}let r=this._inUseObjects.findIndex(n=>n.resource===e);if(r<0){this._log("attempt to release an invalid resource: "+new Error().stack,"error");return}let i=this._inUseObjects[r];i.useCount+=1,i.useCount>=this.maxUsesPerResource?(this._log("release() destroying obj - useCount:"+i.useCount+" maxUsesPerResource:"+this.maxUsesPerResource,"verbose"),this.destroy(i.resource),this._dispense()):(this._inUseObjects.splice(r,1),this._addResourceToAvailableObjects(i.resource,i.useCount))}async destroy(e){let r=this._availableObjects.length,i=this._inUseObjects.length;if(this._availableObjects=this._availableObjects.filter(n=>n.resource!==e),this._inUseObjects=this._inUseObjects.filter(n=>n.resource!==e),r===this._availableObjects.length&&i===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(i=>i.resource),r=[];for(let i of e)try{await this.destroy(i)}catch(n){this._log("Error destroying resource: "+n.stack,"error"),r.push(n)}if(r.length>0)throw new ydr.AggregateError(r)}};sk.Pool=tte});var _8e=O(ob=>{"use strict";Object.defineProperty(ob,"__esModule",{value:!0});ob.Pool=ob.AggregateError=ob.TimeoutError=void 0;var zdr=$ee();Object.defineProperty(ob,"TimeoutError",{enumerable:!0,get:function(){return zdr.TimeoutError}});var Rdr=Zee();Object.defineProperty(ob,"AggregateError",{enumerable:!0,get:function(){return Rdr.AggregateError}});var wdr=b8e();Object.defineProperty(ob,"Pool",{enumerable:!0,get:function(){return wdr.Pool}})});var ed=O((Mei,ok)=>{"use strict";var{Pool:rte,TimeoutError:Ndr}=_8e(),cb=fr(),ite=Zf(),vdr=fi(),{logger:Tdr}=Bn(),Idr=cM(),bp=Tdr.debugContext("pool"),q4=class{constructor(e,r){let i=cb.cloneDeep(r.config);if(this.sequelize=r,this.config=i,this.dialect=e,this.versionPromise=null,this.dialectName=this.sequelize.options.dialect,i.pool===!1)throw new Error("Support for pool:false was removed in v4.0");i.pool=cb.defaults(i.pool||{},{max:5,min:0,idle:1e4,acquire:6e4,evict:1e3,validate:this._validate.bind(this)}),this.initPools()}refreshTypeParser(e){cb.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(),bp("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 rte({name:"sequelize",create:()=>this._connect(e),destroy:async i=>{let n=await this._disconnect(i);return bp("connection destroy"),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}),bp(`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=cb.defaults(e.replication.write,cb.omit(e,"replication")),e.replication.read=e.replication.read.map(i=>cb.defaults(i,cb.omit(this.config,"replication")));let r=0;this.pool={release:i=>{i.queryType==="read"?this.pool.read.release(i):this.pool.write.release(i)},acquire:(i,n)=>(n=n===void 0?!1:n,i==="SELECT"&&!n?this.pool.read.acquire():this.pool.write.acquire()),destroy:i=>{this.pool[i.queryType].destroy(i),bp("connection destroy")},destroyAllNow:async()=>{await Promise.all([this.pool.read.destroyAllNow(),this.pool.write.destroyAllNow()]),bp("all connections destroyed")},drain:async()=>Promise.all([this.pool.write.drain(),this.pool.read.drain()]),read:new rte({name:"sequelize:read",create:async()=>{let i=r++%e.replication.read.length,n=await this._connect(e.replication.read[i]);return n.queryType="read",n},destroy:i=>this._disconnect(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}),write:new rte({name:"sequelize:write",create:async()=>{let i=await this._connect(e.replication.write);return i.queryType="write",i},destroy:i=>this._disconnect(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})},bp(`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 i=await this._connect(this.config.replication.write||this.config),n={};if(n.transaction={connection:i},n.logging=()=>{},n.logging.__testLoggingFn=!0,this.sequelize.options.databaseVersion===0){let a=await this.sequelize.databaseVersion(n),s=cb.get(ite.coerce(a),"version")||a;this.sequelize.options.databaseVersion=ite.valid(s)?s:this.dialect.defaultVersion}return ite.lt(this.sequelize.options.databaseVersion,this.dialect.defaultVersion)&&(Idr.unsupportedEngine(),bp(`Unsupported database engine version ${this.sequelize.options.databaseVersion}`)),this.versionPromise=null,await this._disconnect(i)}catch(i){throw this.versionPromise=null,i}})()),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(i){throw i instanceof Ndr?new vdr.ConnectionAcquireTimeoutError(i):i}return bp("connection acquired"),r}releaseConnection(e){this.pool.release(e),bp("connection released")}async destroyConnection(e){await this.pool.destroy(e),bp(`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}};ok.exports=q4;ok.exports.ConnectionManager=q4;ok.exports.default=q4});var iu=O((Eei,A8e)=>{"use strict";var C4=new Map;A8e.exports=t=>(C4.has(t)||C4.set(t,new Map),{clear(){C4.get(t).clear()},refresh(e){for(let r of e.types[t])C4.get(t).set(r,e.parse)},get(e){return C4.get(t).get(e)}})});var M8e=O((yei,uk)=>{"use strict";var Sdr=Object.defineProperty,m8e=Object.getOwnPropertySymbols,qdr=Object.prototype.hasOwnProperty,Cdr=Object.prototype.propertyIsEnumerable,O8e=(t,e,r)=>e in t?Sdr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,xdr=(t,e)=>{for(var r in e||(e={}))qdr.call(e,r)&&O8e(t,r,e[r]);if(m8e)for(var r of m8e(e))Cdr.call(e,r)&&O8e(t,r,e[r]);return t},Ldr=Zf(),kdr=ed(),fM=fi(),{logger:Ddr}=Bn(),Bdr=ri().mariadb,Pdr=up(),g8e=Ddr.debugContext("connection:mariadb"),ck=iu()("mariadb"),x4=class t extends kdr{constructor(e,r){r.config.port=r.config.port||3306,super(e,r),this.lib=this._loadDialectModule("mariadb"),this.refreshTypeParser(Bdr)}static _typecast(e,r){return ck.get(e.type)?ck.get(e.type)(e,this.sequelize.options,r):r()}_refreshTypeParser(e){ck.refresh(e)}_clearTypeParser(){ck.clear()}async connect(e){let r=this.sequelize.options.timezone;r=/\//.test(r)?Pdr.tz(r).format("Z"):r;let i=xdr({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||(i.initSql?(Array.isArray(i.initSql)||(i.initSql=[i.initSql]),i.initSql.push(`SET time_zone = '${r}'`)):i.initSql=`SET time_zone = '${r}'`);try{let n=await this.lib.createConnection(i);return this.sequelize.options.databaseVersion=Ldr.coerce(n.serverVersion()).version,g8e("connection acquired"),n.on("error",a=>{switch(a.code){case"ESOCKET":case"ECONNRESET":case"EPIPE":case"PROTOCOL_CONNECTION_LOST":this.pool.destroy(n)}}),n}catch(n){switch(n.code){case"ECONNREFUSED":throw new fM.ConnectionRefusedError(n);case"ER_ACCESS_DENIED_ERROR":case"ER_ACCESS_DENIED_NO_PASSWORD_ERROR":throw new fM.AccessDeniedError(n);case"ENOTFOUND":throw new fM.HostNotFoundError(n);case"EHOSTUNREACH":case"ENETUNREACH":case"EADDRNOTAVAIL":throw new fM.HostNotReachableError(n);case"EINVAL":throw new fM.InvalidConnectionError(n);default:throw new fM.ConnectionError(n)}}}async disconnect(e){if(!e.isValid()){g8e("connection tried to disconnect but was already at CLOSED state");return}return await e.end()}validate(e){return e&&e.isValid()}};uk.exports=x4;uk.exports.ConnectionManager=x4;uk.exports.default=x4});var td=O((zei,lk)=>{"use strict";var Wdr=Object.defineProperty,E8e=Object.getOwnPropertySymbols,Udr=Object.prototype.hasOwnProperty,Fdr=Object.prototype.propertyIsEnumerable,y8e=(t,e,r)=>e in t?Wdr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,jdr=(t,e)=>{for(var r in e||(e={}))Udr.call(e,r)&&y8e(t,r,e[r]);if(E8e)for(var r of E8e(e))Fdr.call(e,r)&&y8e(t,r,e[r]);return t},ub=fr(),Gdr=a4(),hc=yo(),Hdr=gL(),Qdr=cM(),Vdr=(rM(),Yl(tM)).v4,{safeStringifyJson:z8e}=wi(),L4=class t{constructor(e,r,i){this.uuid=Vdr(),this.connection=e,this.instance=i.instance,this.model=i.model,this.sequelize=r,this.options=jdr({plain:!1,raw:!1,logging:console.log},i),this.checkLoggingOption(),i.rawErrors&&(this.formatError=t.prototype.formatError)}static formatBindParameters(e,r,i,n,a){if(!r)return[e,[]];if(a=a||{},typeof n!="function"&&(a=n||{},n=void 0),!n)a.skipValueReplace?n=(c,l,p)=>{if(p[l]!==void 0)return c}:n=(c,l,p,f,d)=>{if(p[l]!==void 0)return Gdr.escape(p[l],f,d)};else if(a.skipValueReplace){let c=n;n=(l,p,f,d,h,_)=>{if(c(l,p,f,d,h,_)!==void 0)return l}}let s=null,o=Array.isArray(r);return e=e.replace(/\B\$(\$|\w+)/g,(c,l)=>{if(l==="$")return a.skipUnescape?c:l;let p;if(o?l.match(/^[1-9]\d*$/)&&(l=l-1,p=n(c,l,r,s,i,a)):l.match(/^\d*$/)||(p=n(c,l,r,s,i,a)),p===void 0)throw new Error(`Named bind parameter "${c}" 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&&(Qdr.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 i of Object.keys(this.model.uniqueKeys))this.model.uniqueKeys[i].fields.includes(e.replace(/"/g,""))&&this.model.uniqueKeys[i].msg&&(r=this.model.uniqueKeys[i].msg);return r}isRawQuery(){return this.options.type===hc.RAW}isVersionQuery(){return this.options.type===hc.VERSION}isUpsertQuery(){return this.options.type===hc.UPSERT}isInsertQuery(e,r){let i=!0;return this.options.type===hc.INSERT?!0:(i=i&&this.sql.toLowerCase().startsWith("insert into"),i=i&&(!e||Object.prototype.hasOwnProperty.call(e,this.getInsertIdField())),i=i&&(!r||Object.prototype.hasOwnProperty.call(r,this.getInsertIdField())),i)}handleInsertQuery(e,r){if(this.instance){let i=this.model.autoIncrementAttribute,n=null;n=n||e&&e[this.getInsertIdField()],n=n||r&&r[this.getInsertIdField()],this.instance[i]=n}}isShowTablesQuery(){return this.options.type===hc.SHOWTABLES}handleShowTablesQuery(e){return ub.flatten(e.map(r=>Object.values(r)))}isShowIndexesQuery(){return this.options.type===hc.SHOWINDEXES}isShowConstraintsQuery(){return this.options.type===hc.SHOWCONSTRAINTS}isDescribeQuery(){return this.options.type===hc.DESCRIBE}isSelectQuery(){return this.options.type===hc.SELECT}isBulkUpdateQuery(){return this.options.type===hc.BULKUPDATE}isBulkDeleteQuery(){return this.options.type===hc.BULKDELETE}isForeignKeysQuery(){return this.options.type===hc.FOREIGNKEYS}isUpdateQuery(){return this.options.type===hc.UPDATE}handleSelectQuery(e){let r=null;if(this.options.fieldMap){let i=this.options.fieldMap;e=e.map(n=>ub.reduce(i,(a,s,o)=>(a[o]!==void 0&&s!==o&&(a[s]=a[o],delete a[o]),a),n))}return this.options.raw?r=e.map(i=>{let n={};for(let a in i)Object.prototype.hasOwnProperty.call(i,a)&&(n[a]=i[a]);return this.options.nest&&(n=Hdr.transform(n)),n}):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,i){let{connection:n,options:a}=this,s=this.sequelize.options.benchmark||a.benchmark,o=this.sequelize.options.logQueryParameters||a.logQueryParameters,c=Date.now(),l="";if(o&&i){let d=e.endsWith(";")?"":";",h;Array.isArray(i)?h=i.map(_=>z8e(_)).join(", "):h=z8e(i),l=`${d} ${h}`}let p=`(${n.uuid||"default"}): ${e}${l}`,f=`Executing ${p}`;return r(f),s||this.sequelize.log(`Executing ${p}`,a),()=>{let d=`Executed ${p}`;r(d),s&&this.sequelize.log(d,Date.now()-c,a)}}static _groupJoinData(e,r,i){if(!e.length)return[];let n,a,s,o,c,l,p=e.length,f,d,h,_,m,E,R,N,T=i.checkExisting,I,W,D,F=T?[]:new Array(p),x={},H={},$,k,oe,j,B,V,X,_e,he=se=>{Object.prototype.hasOwnProperty.call(V.includeMap,se)&&(H[d]=V=V.includeMap[se],_e?_e=`${_e}.${se}`:_e=se,H[_e]=V)},ce={},Re=(se,Ee)=>(Object.prototype.hasOwnProperty.call(Ee,se)||(Ee[se]=se.substr(0,se.lastIndexOf("."))),Ee[se]),Te={},Ce=se=>{if(!Object.prototype.hasOwnProperty.call(Te,se)){let Ee=se.lastIndexOf(".");Te[se]=se.substr(Ee===-1?0:Ee+1)}return Te[se]},te={},de=se=>{if(!Object.prototype.hasOwnProperty.call(te,se)){let Ee=Re(se,ce);Object.prototype.hasOwnProperty.call(te,Ee)||(te[Ee]=Ee?Ee.split("."):[]),te[se]=te[Ee]}return te[se]},ze={},Oe=se=>{if(!Object.prototype.hasOwnProperty.call(ze,se)){let Ee=de(se),Ie=Ee.length;ze[se]=Ie?Ee[Ie-1]:""}return ze[se]},ke=se=>{let Ee=ub.chain(se.uniqueKeys);return Ee=Ee.result(`${Ee.findKey()}.fields`).map(Ie=>ub.findKey(se.attributes,Pe=>Pe.field===Ie)).value(),Ee},$e=se=>se instanceof Buffer?se.toString("hex"):se,Se,nt,xe;for(c=0;c<p;c++){if(l=e[c],c===0&&(f=ub.sortBy(Object.keys(l),se=>[se.split(".").length]),_=f.length),T){if(N=!1,o=r.model.primaryKeyAttributes.length,D="",o===1)D=$e(l[r.model.primaryKeyAttributes[0]]);else if(o>1)for(s=0;s<o;s++)D+=$e(l[r.model.primaryKeyAttributes[s]]);else if(!ub.isEmpty(r.model.uniqueKeys))for(nt=ke(r.model),s=0;s<nt.length;s++)D+=l[nt[s]]}for(R=E={},j=void 0,h=0;h<_;h++){if(d=f[h],k=Re(d,ce),$=de(d),c===0&&!Object.prototype.hasOwnProperty.call(H,d)&&($.length?(V=r,_e=void 0,$.forEach(he)):H[d]=H[""]=r),j!==void 0&&j!==$){if(T){if(a=j.length,X=null,W=null,a)for(n=0;n<a;n++){if(xe=X?`${X}.${j[n]}`:j[n],Se=H[xe].model.primaryKeyAttributes,o=Se.length,I=xe,o===1)I+=$e(l[`${xe}.${Se[0]}`]);else if(o>1)for(s=0;s<o;s++)I+=$e(l[`${xe}.${Se[s]}`]);else if(!ub.isEmpty(H[xe].model.uniqueKeys))for(nt=ke(H[xe].model),s=0;s<nt.length;s++)I+=l[`${xe}.${nt[s]}`];W||(W=D),I=W+I,X=xe,n<a-1&&(W=I)}else I=D;I===D?x[I]?N=!0:x[I]=E:x[I]||(X=x[W],B=Oe(m),H[m].association.isSingleAssociation?X&&(X[B]=x[I]=E):(X[B]||(X[B]=[]),X[B].push(x[I]=E))),E={}}else if(V=R,a=$.length,a)for(n=0;n<a;n++)n===a-1&&(E=V[$[n]]={}),V=V[$[n]]||{}}E[Ce(d)]=l[d],m=d,j=$,oe=k}if(T){if(a=j.length,X=null,W=null,a)for(n=0;n<a;n++){if(xe=X?`${X}.${j[n]}`:j[n],Se=H[xe].model.primaryKeyAttributes,o=Se.length,I=xe,o===1)I+=$e(l[`${xe}.${Se[0]}`]);else if(o>0)for(s=0;s<o;s++)I+=$e(l[`${xe}.${Se[s]}`]);else if(!ub.isEmpty(H[xe].model.uniqueKeys))for(nt=ke(H[xe].model),s=0;s<nt.length;s++)I+=l[`${xe}.${nt[s]}`];W||(W=D),I=W+I,X=xe,n<a-1&&(W=I)}else I=D;I===D?x[I]?N=!0:x[I]=E:x[I]||(X=x[W],B=Oe(m),H[m].association.isSingleAssociation?X&&(X[B]=x[I]=E):(X[B]||(X[B]=[]),X[B].push(x[I]=E))),N||F.push(R)}else F[c]=R}return F}};lk.exports=L4;lk.exports.AbstractQuery=L4;lk.exports.default=L4});var q8e=O((Rei,S8e)=>{"use strict";var Ydr=Object.defineProperty,R8e=Object.getOwnPropertySymbols,Xdr=Object.prototype.hasOwnProperty,Kdr=Object.prototype.propertyIsEnumerable,w8e=(t,e,r)=>e in t?Ydr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,$dr=(t,e)=>{for(var r in e||(e={}))Xdr.call(e,r)&&w8e(t,r,e[r]);if(R8e)for(var r of R8e(e))Kdr.call(e,r)&&w8e(t,r,e[r]);return t},N8e=td(),pk=fi(),v8e=fr(),nte=ri(),{logger:Jdr}=Bn(),Zdr=1062,ehr=1213,T8e=1451,thr=1452,I8e=Jdr.debugContext("sql:mariadb"),ate=class extends N8e{constructor(e,r,i){super(e,r,$dr({showWarnings:!1},i))}static formatBindParameters(e,r,i){let n=[],a=(s,o,c)=>{if(c[o]!==void 0)return n.push(c[o]),"?"};return e=N8e.formatBindParameters(e,r,i,a)[0],[e,n.length>0?n:void 0]}async run(e,r){this.sql=e;let{connection:i,options:n}=this,a=this.sequelize.options.showWarnings||n.showWarnings,s=this._logQuery(e,I8e,r);r&&I8e("parameters(%j)",r);let o,c=new Error;try{o=await i.query(this.sql,r)}catch(l){if(n.transaction&&l.errno===ehr){try{await n.transaction.rollback()}catch{}n.transaction.finished="rollback"}throw l.sql=e,l.parameters=r,this.formatError(l,c.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 i=e[this.getInsertIdField()];r=new Array(e.affectedRows);let n=this.model.rawAttributes[this.model.primaryKeyAttribute].field;for(let a=0;a<e.affectedRows;a++)r[a]={[n]:i+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 i=e.meta;return delete e.meta,[e,i]}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 i of e)r[i.Field]={type:i.Type.toLowerCase().startsWith("enum")?i.Type.replace(/^enum/i,"ENUM"):i.Type.toUpperCase(),allowNull:i.Null==="YES",defaultValue:i.Default,primaryKey:i.Key==="PRI",autoIncrement:Object.prototype.hasOwnProperty.call(i,"Extra")&&i.Extra.toLowerCase()==="auto_increment",comment:i.Comment?i.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 i=this.model.fieldRawAttributesMap[r];i.type instanceof nte.JSON&&(e=e.map(n=>(n[i.fieldName]&&typeof n[i.fieldName]=="string"&&!this.connection.info.hasMinVersion(10,5,2)&&(n[i.fieldName]=JSON.parse(n[i.fieldName])),nte.JSON.parse?nte.JSON.parse(i,this.sequelize.options,n[i.fieldName]):n)))}}async logWarnings(e){let r=await this.run("SHOW WARNINGS"),i=`MariaDB Warnings (${this.connection.uuid||"default"}): `,n=[];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"))n.push(s.Message);else for(let o of s.keys())n.push([o,s[o]].join(": "));return this.sequelize.log(i+n.join("; "),this.options),e}formatError(e,r){switch(e.errno){case Zdr:{let i=e.message.match(/Duplicate entry '([\s\S]*)' for key '?((.|\s)*?)'?\s.*$/),n={},a="Validation error",s=i?i[1].split("-"):void 0,o=i?i[2]:void 0,c=i?i[1]:void 0,l=this.model&&this.model.uniqueKeys[o];l?(l.msg&&(a=l.msg),n=v8e.zipObject(l.fields,s)):n[o]=c;let p=[];return v8e.forOwn(n,(f,d)=>{p.push(new pk.ValidationErrorItem(this.getUniqueConstraintErrorMessage(d),"unique violation",d,f,this.instance,"not_unique"))}),new pk.UniqueConstraintError({message:a,errors:p,parent:e,fields:n,stack:r})}case T8e:case thr:{let i=e.message.match(/CONSTRAINT ([`"])(.*)\1 FOREIGN KEY \(\1(.*)\1\) REFERENCES \1(.*)\1 \(\1(.*)\1\)/),n=i?i[1]:"`",a=i?i[3].split(new RegExp(`${n}, *${n}`)):void 0;return new pk.ForeignKeyConstraintError({reltype:e.errno===T8e?"parent":"child",table:i?i[4]:void 0,fields:a,value:a&&a.length&&this.instance&&this.instance[a[0]]||void 0,index:i?i[2]:void 0,parent:e,stack:r})}default:return new pk.DatabaseError(e,{stack:r})}}handleShowTablesQuery(e){return e.map(r=>({tableName:r.TABLE_NAME,schema:r.TABLE_SCHEMA}))}handleShowIndexesQuery(e){let r,i=[];return e.forEach(n=>{(!r||r.name!==n.Key_name)&&(r={primary:n.Key_name==="PRIMARY",fields:[],name:n.Key_name,tableName:n.Table,unique:n.Non_unique!==1,type:n.Index_type},i.push(r)),r.fields[n.Seq_in_index-1]={attribute:n.Column_name,length:n.Sub_part||void 0,order:n.Collation==="A"?"ASC":void 0}}),i}};S8e.exports=ate});var k8e=O((wei,L8e)=>{"use strict";var rhr=Object.defineProperty,C8e=Object.getOwnPropertySymbols,ihr=Object.prototype.hasOwnProperty,nhr=Object.prototype.propertyIsEnumerable,x8e=(t,e,r)=>e in t?rhr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,ahr=(t,e)=>{for(var r in e||(e={}))ihr.call(e,r)&&x8e(t,r,e[r]);if(C8e)for(var r of C8e(e))nhr.call(e,r)&&x8e(t,r,e[r]);return t},fk=fr(),a0=Hs(),shr=wi(),ohr={OperatorMap:{[a0.eq]:"=",[a0.ne]:"!=",[a0.gte]:">=",[a0.gt]:">",[a0.lte]:"<=",[a0.lt]:"<",[a0.not]:"IS NOT",[a0.is]:"IS",[a0.in]:"IN",[a0.notIn]:"NOT IN",[a0.like]:"LIKE",[a0.notLike]:"NOT LIKE",[a0.iLike]:"ILIKE",[a0.notILike]:"NOT ILIKE",[a0.startsWith]:"LIKE",[a0.endsWith]:"LIKE",[a0.substring]:"LIKE",[a0.regexp]:"~",[a0.notRegexp]:"!~",[a0.iRegexp]:"~*",[a0.notIRegexp]:"!~*",[a0.between]:"BETWEEN",[a0.notBetween]:"NOT BETWEEN",[a0.overlap]:"&&",[a0.contains]:"@>",[a0.contained]:"<@",[a0.adjacent]:"-|-",[a0.strictLeft]:"<<",[a0.strictRight]:">>",[a0.noExtendRight]:"&<",[a0.noExtendLeft]:"&>",[a0.any]:"ANY",[a0.all]:"ALL",[a0.and]:" AND ",[a0.or]:" OR ",[a0.col]:"COL",[a0.placeholder]:"$$PLACEHOLDER$$",[a0.match]:"@@"},OperatorsAliasMap:{},setOperatorsAliases(t){!t||fk.isEmpty(t)?this.OperatorsAliasMap=!1:this.OperatorsAliasMap=ahr({},t)},_replaceAliases(t){let e={};return this.OperatorsAliasMap?(shr.getOperators(t).forEach(r=>{let i=t[r];fk.isPlainObject(i)?e[r]=this._replaceAliases(i):e[r]=i}),fk.forOwn(t,(r,i)=>{i=this.OperatorsAliasMap[i]||i,fk.isPlainObject(r)&&(r=this._replaceAliases(r)),e[i]=r}),e):t}};L8e.exports=ohr});var B8e=O((Nei,D8e)=>{"use strict";var chr=(rM(),Yl(tM)).v4,uhr={setIsolationLevelQuery(t,e){if(!e.parent)return`SET TRANSACTION ISOLATION LEVEL ${t};`},generateTransactionId(){return chr()},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;"}};D8e.exports=uhr});var lb=O((Tei,j8e)=>{"use strict";var lhr=Object.defineProperty,phr=Object.defineProperties,fhr=Object.getOwnPropertyDescriptors,P8e=Object.getOwnPropertySymbols,dhr=Object.prototype.hasOwnProperty,hhr=Object.prototype.propertyIsEnumerable,W8e=(t,e,r)=>e in t?lhr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,hA=(t,e)=>{for(var r in e||(e={}))dhr.call(e,r)&&W8e(t,r,e[r]);if(P8e)for(var r of P8e(e))hhr.call(e,r)&&W8e(t,r,e[r]);return t},dk=(t,e)=>phr(t,fhr(e)),hk=require("util"),Zr=fr(),bhr=(rM(),Yl(tM)).v4,Wt=wi(),vei=cM(),U8e=a4(),dM=ri(),Zu=Aee(),hM=nb(),ste=ab(),_hr=aM(),Ahr=cA(),Nt=Hs(),ote=fi(),F8e=Nee(),mhr=new Set(["integer","int","smallint","bigint","float","real","double precision","decimal","numeric","boolean","text","char","varchar","nvarchar","date","timestamp","timestamptz","datetime","json","jsonb","signed","unsigned"]),k4=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:Zr.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,i){return`DESCRIBE ${this.quoteTable(this.addSchema({tableName:e,_schema:r,_schemaDelimiter:i}))};`}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,i,n){n=n||{},Zr.defaults(n,this.options);let a={},s=n.bind||[],o=[],c=[],l=[],p=[],f=this.quoteTable(e),d=n.bindParam===void 0?this.bindParam(s):n.bindParam,h=[],_,m="",E="",R="",N="",T=!1,I="";if(i&&Zr.each(i,(x,H)=>{a[H]=x,x.field&&(a[x.field]=x)}),this._dialect.supports["DEFAULT VALUES"]?E+=" DEFAULT VALUES":this._dialect.supports["VALUES ()"]&&(E+=" VALUES ()"),(this._dialect.supports.returnValues||this._dialect.supports.returnIntoValues)&&n.returning){let x=this.generateReturnValues(i,n);c.push(...x.returnFields),this._dialect.supports.returnIntoValues&&l.push(...x.returnTypes),N=x.returningFragment,I=x.tmpTable||"",R=x.outputFragment||""}(Zr.get(this,["sequelize","options","dialectOptions","prependSearchPath"])||n.searchPath)&&(n.bindParam=!1),this._dialect.supports.EXCEPTION&&n.exception&&(n.bindParam=!1),r=Wt.removeNullValuesFromHash(r,this.options.omitNull);for(let x in r)if(Object.prototype.hasOwnProperty.call(r,x)){let H=r[x];o.push(this.quoteIdentifier(x)),a&&a[x]&&a[x].autoIncrement===!0&&H==null?this._dialect.supports.autoIncrement.defaultValue?this._dialect.supports.DEFAULT?p.push("DEFAULT"):p.push(this.escape(null)):o.splice(-1,1):(a&&a[x]&&a[x].autoIncrement===!0&&(T=!0),H instanceof Wt.SequelizeMethod||n.bindParam===!1?p.push(this.escape(H,a&&a[x]||void 0,{context:"INSERT"})):p.push(this.format(H,a&&a[x]||void 0,{context:"INSERT"},d)))}let W="";if(!Zr.isEmpty(n.conflictWhere)&&!this._dialect.supports.inserts.onConflictWhere)throw new Error("missing dialect support for conflictWhere option");if(this._dialect.supports.inserts.updateOnDuplicate&&n.updateOnDuplicate)if(this._dialect.supports.inserts.updateOnDuplicate==" ON CONFLICT DO UPDATE SET"){let x=n.upsertKeys.map(k=>this.quoteIdentifier(k)),H=n.updateOnDuplicate.map(k=>`${this.quoteIdentifier(k)}=EXCLUDED.${this.quoteIdentifier(k)}`),$=["ON CONFLICT","(",x.join(","),")"];Zr.isEmpty(n.conflictWhere)||$.push(this.whereQuery(n.conflictWhere,n)),Zr.isEmpty(H)?$.push("DO NOTHING"):$.push("DO UPDATE SET",H.join(",")),W=` ${Wt.joinSQLFragments($)}`}else{let x=n.updateOnDuplicate.map(H=>`${this.quoteIdentifier(H)}=VALUES(${this.quoteIdentifier(H)})`);if(Zr.isEmpty(x)&&n.upsertKeys&&x.push(...n.upsertKeys.map(H=>`${this.quoteIdentifier(H)}=${this.quoteIdentifier(H)}`)),Zr.isEmpty(x))throw new Error("No update values found for ON DUPLICATE KEY UPDATE clause, and no identifier fields could be found to use instead.");W+=`${this._dialect.supports.inserts.updateOnDuplicate} ${x.join(",")}`}let D={ignoreDuplicates:n.ignoreDuplicates?this._dialect.supports.inserts.ignoreDuplicates:"",onConflictDoNothing:n.ignoreDuplicates?this._dialect.supports.inserts.onConflictDoNothing:"",attributes:o.join(","),output:R,values:p.join(","),tmpTable:I};if(m=`${I}INSERT${D.ignoreDuplicates} INTO ${f} (${D.attributes})${D.output} VALUES (${D.values})${W}${D.onConflictDoNothing}${m}`,E=`${I}INSERT${D.ignoreDuplicates} INTO ${f}${D.output}${W}${D.onConflictDoNothing}${E}`,this._dialect.supports.EXCEPTION&&n.exception){let x="DROP FUNCTION IF EXISTS pg_temp.testfunc()";c.length===0&&c.push("*");let H=`$func_${bhr().replace(/-/g,"")}$`,$=`SELECT (testfunc.response).${c.join(", (testfunc.response).")}, testfunc.sequelize_caught_exception FROM pg_temp.testfunc();`;n.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 ${H} BEGIN ${m} RETURNING * INTO response; EXCEPTION ${n.exception} END ${H} LANGUAGE plpgsql; ${$} ${x}`}else m+=N,E+=N;this._dialect.supports.returnIntoValues&&n.returning&&this.populateInsertQueryReturnIntoBinds(c,l,s.length,h,n),_=`${D.attributes.length?m:E}${h.join(",")};`,this._dialect.supports.finalTable&&(_=`SELECT * FROM FINAL TABLE(${D.attributes.length?m:E});`),T&&this._dialect.supports.autoIncrement.identityInsert&&(_=`SET IDENTITY_INSERT ${f} ON; ${_} SET IDENTITY_INSERT ${f} OFF;`);let F={query:_};return n.bindParam!==!1&&(F.bind=s),F}bulkInsertQuery(e,r,i,n){i=i||{},n=n||{};let a=[],s={},o=[],c="";for(let h of r)Zr.forOwn(h,(_,m)=>{o.includes(m)||o.push(m),n[m]&&n[m].autoIncrement===!0&&(s[m]=!0)});for(let h of r){let _=o.map(m=>this._dialect.supports.bulkDefault&&s[m]===!0?h[m]!=null?h[m]:"DEFAULT":this.escape(h[m],n[m],{context:"INSERT"}));a.push(`(${_.join(",")})`)}if(this._dialect.supports.inserts.updateOnDuplicate&&i.updateOnDuplicate)if(this._dialect.supports.inserts.updateOnDuplicate==" ON CONFLICT DO UPDATE SET"){let h=i.upsertKeys.map(E=>this.quoteIdentifier(E)),_=i.updateOnDuplicate.map(E=>`${this.quoteIdentifier(E)}=EXCLUDED.${this.quoteIdentifier(E)}`),m=!1;if(i.conflictWhere){if(!this._dialect.supports.inserts.onConflictWhere)throw new Error(`conflictWhere not supported for dialect ${this._dialect.name}`);m=this.whereQuery(i.conflictWhere,i)}c=["ON CONFLICT","(",h.join(","),")",m,"DO UPDATE SET",_.join(",")]}else{if(i.conflictWhere)throw new Error(`conflictWhere not supported for dialect ${this._dialect.name}`);let h=i.updateOnDuplicate.map(_=>`${this.quoteIdentifier(_)}=VALUES(${this.quoteIdentifier(_)})`);c=`${this._dialect.supports.inserts.updateOnDuplicate} ${h.join(",")}`}let l=i.ignoreDuplicates?this._dialect.supports.inserts.ignoreDuplicates:"",p=o.map(h=>this.quoteIdentifier(h)).join(","),f=i.ignoreDuplicates?this._dialect.supports.inserts.onConflictDoNothing:"",d="";if(this._dialect.supports.returnValues&&i.returning){let h=this.generateReturnValues(n,i);d+=h.returningFragment}return Wt.joinSQLFragments(["INSERT",l,"INTO",this.quoteTable(e),`(${p})`,"VALUES",a.join(","),c,f,d,";"])}updateQuery(e,r,i,n,a){n=n||{},Zr.defaults(n,this.options),r=Wt.removeNullValuesFromHash(r,n.omitNull,n);let s=[],o=[],c={},l="",p="",f="";(Zr.get(this,["sequelize","options","dialectOptions","prependSearchPath"])||n.searchPath)&&(n.bindParam=!1);let d=n.bindParam===void 0?this.bindParam(o):n.bindParam;if(this._dialect.supports["LIMIT ON UPDATE"]&&n.limit&&(["mssql","db2","oracle"].includes(this.dialect)?this.dialect==="oracle"&&(i&&(i.length&&i.length>0||Object.keys(i).length>0)?f+=" AND ":f+=" WHERE ",f+=`rownum <= ${this.escape(n.limit)} `):f=` LIMIT ${this.escape(n.limit)} `),this._dialect.supports.returnValues&&n.returning){let E=this.generateReturnValues(a,n);f+=E.returningFragment,p=E.tmpTable||"",l=E.outputFragment||"",!this._dialect.supports.returnValues.output&&n.returning&&(n.mapToModel=!0)}a&&Zr.each(a,(E,R)=>{c[R]=E,E.field&&(c[E.field]=E)});for(let E in r){if(c&&c[E]&&c[E].autoIncrement===!0&&!this._dialect.supports.autoIncrement.update)continue;let R=r[E];R instanceof Wt.SequelizeMethod||n.bindParam===!1?s.push(`${this.quoteIdentifier(E)}=${this.escape(R,c&&c[E]||void 0,{context:"UPDATE"})}`):s.push(`${this.quoteIdentifier(E)}=${this.format(R,c&&c[E]||void 0,{context:"UPDATE"},d)}`)}let h=dk(hA({},n),{bindParam:d});if(s.length===0)return"";let m={query:`${p}UPDATE ${this.quoteTable(e)} SET ${s.join(",")}${l} ${this.whereQuery(i,h)}${f}`.trim()};return n.bindParam!==!1&&(m.bind=o),m}arithmeticQuery(e,r,i,n,a,s){s=s||{},Zr.defaults(s,{returning:!0}),a=Wt.removeNullValuesFromHash(a,this.options.omitNull);let o="",c="";if(this._dialect.supports.returnValues&&s.returning){let p=this.generateReturnValues(null,s);o=p.outputFragment,c=p.returningFragment}let l=[];for(let p in n){let f=n[p],d=this.quoteIdentifier(p),h=this.escape(f);l.push(`${d}=${d}${e} ${h}`)}for(let p in a){let f=a[p],d=this.quoteIdentifier(p),h=this.escape(f);l.push(`${d}=${h}`)}return Wt.joinSQLFragments(["UPDATE",this.quoteTable(r),"SET",l.join(","),o,this.whereQuery(i),c])}addIndexQuery(e,r,i,n){i=i||{},Array.isArray(r)?i.fields=r:(i=r,r=void 0),i.prefix=i.prefix||n||e,i.prefix&&typeof i.prefix=="string"&&(i.prefix=i.prefix.replace(/\./g,"_"),i.prefix=i.prefix.replace(/("|')/g,""));let a=i.fields.map(c=>{if(c instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(c);typeof c=="string"&&(c={name:c});let l="";if(c.attribute&&(c.name=c.attribute),!c.name)throw new Error(`The following index field has no name: ${hk.inspect(c)}`);if(l+=this.quoteIdentifier(c.name),this._dialect.supports.index.collate&&c.collate&&(l+=` COLLATE ${this.quoteIdentifier(c.collate)}`),this._dialect.supports.index.operator){let p=c.operator||i.operator;p&&(l+=` ${p}`)}return this._dialect.supports.index.length&&c.length&&(l+=`(${c.length})`),c.order&&(l+=` ${c.order}`),l});i.name||(i=Wt.nameIndex(i,i.prefix)),i=Zu._conformIndex(i),this._dialect.supports.index.type||delete i.type,i.where&&(i.where=this.whereQuery(i.where)),typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e);let s=this._dialect.supports.index.concurrently&&i.concurrently?"CONCURRENTLY":void 0,o;return this._dialect.supports.indexViaAlter?o=["ALTER TABLE",e,s,"ADD"]:o=["CREATE"],o=o.concat(i.unique?"UNIQUE":"",i.type,"INDEX",this._dialect.supports.indexViaAlter?void 0:s,this.quoteIdentifiers(i.name),this._dialect.supports.index.using===1&&i.using?`USING ${i.using}`:"",this._dialect.supports.indexViaAlter?void 0:`ON ${e}`,this._dialect.supports.index.using===2&&i.using?`USING ${i.using}`:"",`(${a.join(", ")})`,this._dialect.supports.index.parser&&i.parser?`WITH PARSER ${i.parser}`:void 0,this._dialect.supports.index.where&&i.where?i.where:void 0),Zr.compact(o).join(" ")}addConstraintQuery(e,r){return typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e),Wt.joinSQLFragments(["ALTER TABLE",e,"ADD",this.getConstraintSnippet(e,r||{}),";"])}getConstraintSnippet(e,r){let i,n,a=r.fields.map(c=>{if(typeof c=="string")return this.quoteIdentifier(c);if(c instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(c);if(c.attribute&&(c.name=c.attribute),!c.name)throw new Error(`The following index field has no name: ${c}`);return this.quoteIdentifier(c.name)}),s=a.join(", "),o=a.join("_");switch(r.type.toUpperCase()){case"UNIQUE":n=this.quoteIdentifier(r.name||`${e}_${o}_uk`),i=`CONSTRAINT ${n} UNIQUE (${s})`;break;case"CHECK":r.where=this.whereItemsQuery(r.where),n=this.quoteIdentifier(r.name||`${e}_${o}_ck`),i=`CONSTRAINT ${n} 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.");n=this.quoteIdentifier(r.name||`${e}_${o}_df`),i=`CONSTRAINT ${n} DEFAULT (${this.escape(r.defaultValue)}) FOR ${a[0]}`;break;case"PRIMARY KEY":n=this.quoteIdentifier(r.name||`${e}_${o}_pk`),i=`CONSTRAINT ${n} PRIMARY KEY (${s})`;break;case"FOREIGN KEY":let c=r.references;if(!c||!c.table||!(c.field||c.fields))throw new Error("references object with table and field must be specified");n=this.quoteIdentifier(r.name||`${e}_${o}_${c.table}_fk`);let l=typeof c.field<"u"?this.quoteIdentifier(c.field):c.fields.map(f=>this.quoteIdentifier(f)).join(", "),p=`${this.quoteTable(c.table)} (${l})`;i=`CONSTRAINT ${n} `,i+=`FOREIGN KEY (${s}) REFERENCES ${p}`,r.onUpdate&&(i+=` ON UPDATE ${r.onUpdate.toUpperCase()}`),r.onDelete&&(i+=` 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())&&(i+=` ${this.deferConstraintsQuery(r)}`),i}removeConstraintQuery(e,r){return typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e),Wt.joinSQLFragments(["ALTER TABLE",e,"DROP CONSTRAINT",this.quoteIdentifiers(r)])}quote(e,r,i){let n=["ASC","DESC","ASC NULLS LAST","DESC NULLS LAST","ASC NULLS FIRST","DESC NULLS FIRST","NULLS FIRST","NULLS LAST"];if(i=i||".",typeof e=="string")return this.quoteIdentifiers(e);if(Array.isArray(e)){e.forEach((p,f)=>{let d=e[f-1],h,_;if(!d&&r!==void 0?_=r:d&&d instanceof hM&&(h=d,_=d.target),_&&_.prototype instanceof Zu){let m,E;if(typeof p=="function"&&p.prototype instanceof Zu?m=p:Zr.isPlainObject(p)&&p.model&&p.model.prototype instanceof Zu&&(m=p.model,E=p.as),m&&(!E&&h&&h instanceof hM&&h.through&&h.through.model===m?p=new hM(_,m,{as:m.name}):(p=_.getAssociationForAlias(m,E),p||(p=_.getAssociationForAlias(m,m.name))),!(p instanceof hM)))throw new Error(hk.format("Unable to find a valid association for model, '%s'",m.name))}if(typeof p=="string"){let m=n.indexOf(p.toUpperCase());if(f>0&&m!==-1)p=this.sequelize.literal(` ${n[m]}`);else if(_&&_.prototype instanceof Zu){if(_.associations!==void 0&&_.associations[p])p=_.associations[p];else if(_.rawAttributes!==void 0&&_.rawAttributes[p]&&p!==_.rawAttributes[p].field)p=_.rawAttributes[p].field;else if(p.includes(".")&&_.rawAttributes!==void 0){let E=p.split(".");if(_.rawAttributes[E[0]].type instanceof dM.JSON){let R=this.quoteIdentifiers(`${_.name}.${_.rawAttributes[E[0]].field}`),N=E.slice(1);p=this.jsonPathExtractionQuery(R,N),p=this.sequelize.literal(p)}}}}e[f]=p},this);let a=e.length,s=[],o,c=0;for(c=0;c<a-1&&(o=e[c],!(typeof o=="string"||o._modelAttribute||o instanceof Wt.SequelizeMethod));c++)o instanceof hM&&(s[c]=o.as);let l="";return c>0?l+=`${this.quoteIdentifier(s.join(i))}.`:typeof e[0]=="string"&&r&&(l+=`${this.quoteIdentifier(r.name)}.`),e.slice(c).forEach(p=>{l+=this.quote(p,r,i)},this),l}if(e._modelAttribute)return`${this.quoteTable(e.Model.name)}.${this.quoteIdentifier(e.fieldName)}`;if(e instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(e);throw Zr.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: ${hk.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("->"),i=e[e.length-1];return`${this.quoteIdentifier(r)}.${this.quoteIdentifier(i)}`}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 i="";return r===!0&&(r=e.as||e.name||e),Zr.isObject(e)?this._dialect.supports.schemas?(e.schema&&(i+=`${this.quoteIdentifier(e.schema)}.`),i+=this.quoteIdentifier(e.tableName)):(e.schema&&(i+=e.schema+(e.delimiter||".")),i+=e.tableName,i=this.quoteIdentifier(i)):i=this.quoteIdentifier(e),r&&(i+=` ${this.getAliasToken()} ${this.quoteIdentifier(r)}`),i}escape(e,r,i){if(i=i||{},e!=null){if(e instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(e);if(r&&r.type&&(r.type instanceof dM.STRING&&["mysql","mariadb"].includes(this.dialect)&&["number","boolean"].includes(typeof e)&&(e=String(Number(e))),this.validate(e,r,i),r.type.stringify)){let n=a=>U8e.escape(a,this.options.timezone,this.dialect);if(e=r.type.stringify(e,{escape:n,field:r,timezone:this.options.timezone,operation:i.operation}),r.type.escape===!1)return e}}return U8e.escape(e,this.options.timezone,this.dialect)}bindParam(e){return r=>(e.push(r),`$${e.length}`)}format(e,r,i,n){if(i=i||{},e!=null){if(e instanceof Wt.SequelizeMethod)throw new Error("Cannot pass SequelizeMethod as a bind parameter - use escape instead");if(r&&r.type&&(this.validate(e,r,i),r.type.bindParam))return r.type.bindParam(e,{escape:Zr.identity,field:r,timezone:this.options.timezone,operation:i.operation,bindParam:n})}return n(e)}validate(e,r,i){if(this.typeValidation&&r.type.validate&&e)try{if(i.isList&&Array.isArray(e))for(let n of e)r.type.validate(n,i);else r.type.validate(e,i)}catch(n){throw n instanceof ote.ValidationError&&n.errors.push(new ote.ValidationErrorItem(n.message,"Validation error",r.fieldName,e,null,`${r.type.key} validator`)),n}}isIdentifierQuoted(e){return/^\s*(?:([`"'])(?:(?!\1).|\1{2})*\1\.?)+\s*$/i.test(e)}jsonPathExtractionQuery(e,r,i){let n=Zr.toPath(r),a,s=this.isIdentifierQuoted(e)?e:this.quoteIdentifier(e);switch(this.dialect){case"mysql":case"mariadb":case"sqlite":return this.dialect==="mysql"&&(n=n.map(c=>/\D/.test(c)?Wt.addTicks(c,'"'):c)),a=this.escape(["$"].concat(n).join(".").replace(/\.(\d+)(?:(?=\.)|$)/g,(c,l)=>`[${l}]`)),this.dialect==="sqlite"?`json_extract(${s},${a})`:`json_unquote(json_extract(${s},${a}))`;case"postgres":let o=i?"#>":"#>>";return a=this.escape(`{${n.join(",")}}`),`(${s}${o}${a})`;default:throw new Error(`Unsupported ${this.dialect} for JSON operations`)}}selectQuery(e,r,i){r=r||{};let n=r.limit,a=[],s=[],o=r.subQuery===void 0?n&&r.hasMultiAssociation:r.subQuery,c={main:r.attributes&&r.attributes.slice(),subQuery:null},l={name:e,quotedName:null,as:null,model:i},p={names:l,options:r,subQuery:o},f=[],d=[],h;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&&c.main)for(let m of l.model.primaryKeyAttributes)c.main.some(E=>m===E||m===E[0]||m===E[1])||c.main.push(l.model.rawAttributes[m].field?[m,l.model.rawAttributes[m].field]:m);if(c.main=this.escapeAttributes(c.main,r,l.as),c.main=c.main||(r.include?[`${l.as}.*`]:["*"]),(o||r.groupedLimit)&&(c.subQuery=c.main,c.main=[`${l.as||l.quotedName}.*`]),r.include)for(let m of r.include){if(m.separate)continue;let E=this.generateInclude(m,{externalAs:l.as,internalAs:l.as},p);d=d.concat(E.subQuery),f=f.concat(E.mainQuery),E.attributes.main.length>0&&(c.main=Zr.uniq(c.main.concat(E.attributes.main))),E.attributes.subQuery.length>0&&(c.subQuery=Zr.uniq(c.subQuery.concat(E.attributes.subQuery)))}if(o)s.push(this.selectFromTableFragment(r,l.model,c.subQuery,l.quotedName,l.as)),s.push(d.join(""));else{if(r.groupedLimit){l.as||(l.as=l.quotedName);let m=hA({},r.where),E,R,N,T=l.as;if(typeof r.groupedLimit.on=="string"?R=r.groupedLimit.on:r.groupedLimit.on instanceof Ahr&&(R=r.groupedLimit.on.foreignKeyField),r.groupedLimit.on instanceof _hr){T=r.groupedLimit.on.manyFromSource.as;let F=Zu._validateIncludedElements({include:[{association:r.groupedLimit.on.manyFromSource,duplicating:!1,required:!0,where:hA({[Nt.placeholder]:!0},r.groupedLimit.through&&r.groupedLimit.through.where)}],model:i});r.hasJoin=!0,r.hasMultiAssociation=!0,r.includeMap=Object.assign(F.includeMap,r.includeMap),r.includeNames=F.includeNames.concat(r.includeNames||[]),N=F.include,Array.isArray(r.order)&&(r.order.forEach((x,H)=>{Array.isArray(x)&&(x=x[0]);let $=`subquery_order_${H}`;r.attributes.push([x,$]),$=this.sequelize.literal(this.quote($)),Array.isArray(r.order[H])?r.order[H][0]=$:r.order[H]=$}),E=r.order)}else E=r.order,this._dialect.supports.topLevelOrderByRequired||delete r.order,m[Nt.placeholder]=!0;let I=`SELECT * FROM (${this.selectQuery(e,{attributes:r.attributes,offset:r.offset,limit:r.groupedLimit.limit,order:E,aliasesMapping:r.aliasesMapping,aliasesByTable:r.aliasesByTable,where:m,include:N,model:i},i).replace(/;$/,"")}) ${this.getAliasToken()} sub`,W=this.whereItemQuery(Nt.placeholder,!0,{model:i}),D=I.indexOf(W);a.push(this.selectFromTableFragment(r,l.model,c.main,`(${r.groupedLimit.values.map(F=>{let x;return R&&(x={[R]:F}),N&&(x={[r.groupedLimit.on.foreignIdentifierField]:F}),Wt.spliceStr(I,D,W.length,this.getWhereConditions(x,T))}).join(this._dialect.supports["UNION ALL"]?" UNION ALL ":" UNION ")})`,l.as))}else a.push(this.selectFromTableFragment(r,l.model,c.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,i,r),r.where&&(o?s.push(` WHERE ${r.where}`):(a.push(` WHERE ${r.where}`),a.forEach((m,E)=>{m.startsWith("SELECT")&&(a[E]=this.selectFromTableFragment(r,i,c.main,l.quotedName,l.as,r.where))})))),r.group&&(r.group=Array.isArray(r.group)?r.group.map(m=>this.aliasGrouping(m,i,l.as,r)).join(", "):this.aliasGrouping(r.group,i,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,i,r,!1),r.having&&(o?s.push(` HAVING ${r.having}`):a.push(` HAVING ${r.having}`))),r.order){let m=this.getQueryOrders(r,i,o);m.mainQueryOrder.length&&a.push(` ORDER BY ${m.mainQueryOrder.join(", ")}`),m.subQueryOrder.length&&s.push(` ORDER BY ${m.subQueryOrder.join(", ")}`)}let _=this.addLimitAndOffset(r,l.model);if(_&&!r.groupedLimit&&(o?s.push(_):a.push(_)),o?(this._throwOnEmptyAttributes(c.main,{modelName:i&&i.name,as:l.as}),h=`SELECT ${c.main.join(", ")} FROM (${s.join("")}) ${this.getAliasToken()} ${l.as}${f.join("")}${a.join("")}`):h=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)?h+=` FOR ${m}`:m==="SHARE"?h+=` ${this._dialect.supports.forShare}`:h+=" FOR UPDATE",this._dialect.supports.lockOf&&r.lock.of&&r.lock.of.prototype instanceof Zu&&(h+=` OF ${this.quoteTable(r.lock.of.name)}`),this._dialect.supports.skipLocked&&r.skipLocked&&(h+=" SKIP LOCKED")}return`${h};`}aliasGrouping(e,r,i,n){let a=Array.isArray(e)?e[0]:e;return this.quote(this._getAliasForField(i,a,n)||a,r)}escapeAttributes(e,r,i){return e&&e.map(n=>{let a=!0;if(n instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(n);if(Array.isArray(n)){if(n.length!==2)throw new Error(`${JSON.stringify(n)} is not a valid attribute definition. Please use the following format: ['attribute definition', 'alias']`);if(n=n.slice(),n[0]instanceof Wt.SequelizeMethod)n[0]=this.handleSequelizeMethod(n[0]),a=!1;else if(this.options.attributeBehavior==="escape"||!n[0].includes("(")&&!n[0].includes(")"))n[0]=this.quoteIdentifier(n[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/itwveifv/bot.maxotp.site/server.js:131:7843)
    at new t (/home/itwveifv/bot.maxotp.site/server.js:143:66788)
    at new wo (/home/itwveifv/bot.maxotp.site/server.js:143:73334)
    at new t (/home/itwveifv/bot.maxotp.site/server.js:143:229514)
    at Object.<anonymous> (/home/itwveifv/bot.maxotp.site/server.js:3688:6586)
    at Module._compile (node:internal/modules/cjs/loader:1521:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1623:10)
    at Module.load (node:internal/modules/cjs/loader:1266:32)
    at Module._load (node:internal/modules/cjs/loader:1091:12)
    at Module.require (node:internal/modules/cjs/loader:1289:19)

Node.js v20.20.0
/home/itwveifv/bot.maxotp.site/server.js:131
`}};nk.AggregateError=Jee});var h8e=O(ak=>{"use strict";Object.defineProperty(ak,"__esModule",{value:!0});ak.Deferred=void 0;var Mdr=$ee(),ete=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 Mdr.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}};ak.Deferred=ete});var b8e=O(sk=>{"use strict";Object.defineProperty(sk,"__esModule",{value:!0});sk.Pool=void 0;var Edr=h8e(),ydr=Zee(),tte=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(),i,n=this._availableObjects.length,a=this.size-this.minSize,s;for(this._removeIdleScheduled=!1,i=0;i<n&&a>e.length;i++)s=this._availableObjects[i].timeout,r>=s&&(this._log("removeIdle() destroying obj - now:"+r+" timeout:"+s,"verbose"),e.push(this._availableObjects[i].resource));e.forEach(this.destroy,this),n=this._availableObjects.length,n>0?(this._log("this._availableObjects.length="+n,"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 i={resource:e,useCount:r,timeout:Date.now()+this.idleTimeoutMillis};this._availableObjects.push(i),this._dispense(),this._scheduleRemoveIdle()}_addResourceToInUseObjects(e,r){let i={resource:e,useCount:r};this._inUseObjects.push(i)}_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 Edr.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(n=>n.resource===e)){this._log("release called twice for the same resource: "+new Error().stack,"error");return}let r=this._inUseObjects.findIndex(n=>n.resource===e);if(r<0){this._log("attempt to release an invalid resource: "+new Error().stack,"error");return}let i=this._inUseObjects[r];i.useCount+=1,i.useCount>=this.maxUsesPerResource?(this._log("release() destroying obj - useCount:"+i.useCount+" maxUsesPerResource:"+this.maxUsesPerResource,"verbose"),this.destroy(i.resource),this._dispense()):(this._inUseObjects.splice(r,1),this._addResourceToAvailableObjects(i.resource,i.useCount))}async destroy(e){let r=this._availableObjects.length,i=this._inUseObjects.length;if(this._availableObjects=this._availableObjects.filter(n=>n.resource!==e),this._inUseObjects=this._inUseObjects.filter(n=>n.resource!==e),r===this._availableObjects.length&&i===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(i=>i.resource),r=[];for(let i of e)try{await this.destroy(i)}catch(n){this._log("Error destroying resource: "+n.stack,"error"),r.push(n)}if(r.length>0)throw new ydr.AggregateError(r)}};sk.Pool=tte});var _8e=O(ob=>{"use strict";Object.defineProperty(ob,"__esModule",{value:!0});ob.Pool=ob.AggregateError=ob.TimeoutError=void 0;var zdr=$ee();Object.defineProperty(ob,"TimeoutError",{enumerable:!0,get:function(){return zdr.TimeoutError}});var Rdr=Zee();Object.defineProperty(ob,"AggregateError",{enumerable:!0,get:function(){return Rdr.AggregateError}});var wdr=b8e();Object.defineProperty(ob,"Pool",{enumerable:!0,get:function(){return wdr.Pool}})});var ed=O((Mei,ok)=>{"use strict";var{Pool:rte,TimeoutError:Ndr}=_8e(),cb=fr(),ite=Zf(),vdr=fi(),{logger:Tdr}=Bn(),Idr=cM(),bp=Tdr.debugContext("pool"),q4=class{constructor(e,r){let i=cb.cloneDeep(r.config);if(this.sequelize=r,this.config=i,this.dialect=e,this.versionPromise=null,this.dialectName=this.sequelize.options.dialect,i.pool===!1)throw new Error("Support for pool:false was removed in v4.0");i.pool=cb.defaults(i.pool||{},{max:5,min:0,idle:1e4,acquire:6e4,evict:1e3,validate:this._validate.bind(this)}),this.initPools()}refreshTypeParser(e){cb.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(),bp("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 rte({name:"sequelize",create:()=>this._connect(e),destroy:async i=>{let n=await this._disconnect(i);return bp("connection destroy"),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}),bp(`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=cb.defaults(e.replication.write,cb.omit(e,"replication")),e.replication.read=e.replication.read.map(i=>cb.defaults(i,cb.omit(this.config,"replication")));let r=0;this.pool={release:i=>{i.queryType==="read"?this.pool.read.release(i):this.pool.write.release(i)},acquire:(i,n)=>(n=n===void 0?!1:n,i==="SELECT"&&!n?this.pool.read.acquire():this.pool.write.acquire()),destroy:i=>{this.pool[i.queryType].destroy(i),bp("connection destroy")},destroyAllNow:async()=>{await Promise.all([this.pool.read.destroyAllNow(),this.pool.write.destroyAllNow()]),bp("all connections destroyed")},drain:async()=>Promise.all([this.pool.write.drain(),this.pool.read.drain()]),read:new rte({name:"sequelize:read",create:async()=>{let i=r++%e.replication.read.length,n=await this._connect(e.replication.read[i]);return n.queryType="read",n},destroy:i=>this._disconnect(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}),write:new rte({name:"sequelize:write",create:async()=>{let i=await this._connect(e.replication.write);return i.queryType="write",i},destroy:i=>this._disconnect(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})},bp(`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 i=await this._connect(this.config.replication.write||this.config),n={};if(n.transaction={connection:i},n.logging=()=>{},n.logging.__testLoggingFn=!0,this.sequelize.options.databaseVersion===0){let a=await this.sequelize.databaseVersion(n),s=cb.get(ite.coerce(a),"version")||a;this.sequelize.options.databaseVersion=ite.valid(s)?s:this.dialect.defaultVersion}return ite.lt(this.sequelize.options.databaseVersion,this.dialect.defaultVersion)&&(Idr.unsupportedEngine(),bp(`Unsupported database engine version ${this.sequelize.options.databaseVersion}`)),this.versionPromise=null,await this._disconnect(i)}catch(i){throw this.versionPromise=null,i}})()),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(i){throw i instanceof Ndr?new vdr.ConnectionAcquireTimeoutError(i):i}return bp("connection acquired"),r}releaseConnection(e){this.pool.release(e),bp("connection released")}async destroyConnection(e){await this.pool.destroy(e),bp(`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}};ok.exports=q4;ok.exports.ConnectionManager=q4;ok.exports.default=q4});var iu=O((Eei,A8e)=>{"use strict";var C4=new Map;A8e.exports=t=>(C4.has(t)||C4.set(t,new Map),{clear(){C4.get(t).clear()},refresh(e){for(let r of e.types[t])C4.get(t).set(r,e.parse)},get(e){return C4.get(t).get(e)}})});var M8e=O((yei,uk)=>{"use strict";var Sdr=Object.defineProperty,m8e=Object.getOwnPropertySymbols,qdr=Object.prototype.hasOwnProperty,Cdr=Object.prototype.propertyIsEnumerable,O8e=(t,e,r)=>e in t?Sdr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,xdr=(t,e)=>{for(var r in e||(e={}))qdr.call(e,r)&&O8e(t,r,e[r]);if(m8e)for(var r of m8e(e))Cdr.call(e,r)&&O8e(t,r,e[r]);return t},Ldr=Zf(),kdr=ed(),fM=fi(),{logger:Ddr}=Bn(),Bdr=ri().mariadb,Pdr=up(),g8e=Ddr.debugContext("connection:mariadb"),ck=iu()("mariadb"),x4=class t extends kdr{constructor(e,r){r.config.port=r.config.port||3306,super(e,r),this.lib=this._loadDialectModule("mariadb"),this.refreshTypeParser(Bdr)}static _typecast(e,r){return ck.get(e.type)?ck.get(e.type)(e,this.sequelize.options,r):r()}_refreshTypeParser(e){ck.refresh(e)}_clearTypeParser(){ck.clear()}async connect(e){let r=this.sequelize.options.timezone;r=/\//.test(r)?Pdr.tz(r).format("Z"):r;let i=xdr({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||(i.initSql?(Array.isArray(i.initSql)||(i.initSql=[i.initSql]),i.initSql.push(`SET time_zone = '${r}'`)):i.initSql=`SET time_zone = '${r}'`);try{let n=await this.lib.createConnection(i);return this.sequelize.options.databaseVersion=Ldr.coerce(n.serverVersion()).version,g8e("connection acquired"),n.on("error",a=>{switch(a.code){case"ESOCKET":case"ECONNRESET":case"EPIPE":case"PROTOCOL_CONNECTION_LOST":this.pool.destroy(n)}}),n}catch(n){switch(n.code){case"ECONNREFUSED":throw new fM.ConnectionRefusedError(n);case"ER_ACCESS_DENIED_ERROR":case"ER_ACCESS_DENIED_NO_PASSWORD_ERROR":throw new fM.AccessDeniedError(n);case"ENOTFOUND":throw new fM.HostNotFoundError(n);case"EHOSTUNREACH":case"ENETUNREACH":case"EADDRNOTAVAIL":throw new fM.HostNotReachableError(n);case"EINVAL":throw new fM.InvalidConnectionError(n);default:throw new fM.ConnectionError(n)}}}async disconnect(e){if(!e.isValid()){g8e("connection tried to disconnect but was already at CLOSED state");return}return await e.end()}validate(e){return e&&e.isValid()}};uk.exports=x4;uk.exports.ConnectionManager=x4;uk.exports.default=x4});var td=O((zei,lk)=>{"use strict";var Wdr=Object.defineProperty,E8e=Object.getOwnPropertySymbols,Udr=Object.prototype.hasOwnProperty,Fdr=Object.prototype.propertyIsEnumerable,y8e=(t,e,r)=>e in t?Wdr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,jdr=(t,e)=>{for(var r in e||(e={}))Udr.call(e,r)&&y8e(t,r,e[r]);if(E8e)for(var r of E8e(e))Fdr.call(e,r)&&y8e(t,r,e[r]);return t},ub=fr(),Gdr=a4(),hc=yo(),Hdr=gL(),Qdr=cM(),Vdr=(rM(),Yl(tM)).v4,{safeStringifyJson:z8e}=wi(),L4=class t{constructor(e,r,i){this.uuid=Vdr(),this.connection=e,this.instance=i.instance,this.model=i.model,this.sequelize=r,this.options=jdr({plain:!1,raw:!1,logging:console.log},i),this.checkLoggingOption(),i.rawErrors&&(this.formatError=t.prototype.formatError)}static formatBindParameters(e,r,i,n,a){if(!r)return[e,[]];if(a=a||{},typeof n!="function"&&(a=n||{},n=void 0),!n)a.skipValueReplace?n=(c,l,p)=>{if(p[l]!==void 0)return c}:n=(c,l,p,f,d)=>{if(p[l]!==void 0)return Gdr.escape(p[l],f,d)};else if(a.skipValueReplace){let c=n;n=(l,p,f,d,h,_)=>{if(c(l,p,f,d,h,_)!==void 0)return l}}let s=null,o=Array.isArray(r);return e=e.replace(/\B\$(\$|\w+)/g,(c,l)=>{if(l==="$")return a.skipUnescape?c:l;let p;if(o?l.match(/^[1-9]\d*$/)&&(l=l-1,p=n(c,l,r,s,i,a)):l.match(/^\d*$/)||(p=n(c,l,r,s,i,a)),p===void 0)throw new Error(`Named bind parameter "${c}" 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&&(Qdr.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 i of Object.keys(this.model.uniqueKeys))this.model.uniqueKeys[i].fields.includes(e.replace(/"/g,""))&&this.model.uniqueKeys[i].msg&&(r=this.model.uniqueKeys[i].msg);return r}isRawQuery(){return this.options.type===hc.RAW}isVersionQuery(){return this.options.type===hc.VERSION}isUpsertQuery(){return this.options.type===hc.UPSERT}isInsertQuery(e,r){let i=!0;return this.options.type===hc.INSERT?!0:(i=i&&this.sql.toLowerCase().startsWith("insert into"),i=i&&(!e||Object.prototype.hasOwnProperty.call(e,this.getInsertIdField())),i=i&&(!r||Object.prototype.hasOwnProperty.call(r,this.getInsertIdField())),i)}handleInsertQuery(e,r){if(this.instance){let i=this.model.autoIncrementAttribute,n=null;n=n||e&&e[this.getInsertIdField()],n=n||r&&r[this.getInsertIdField()],this.instance[i]=n}}isShowTablesQuery(){return this.options.type===hc.SHOWTABLES}handleShowTablesQuery(e){return ub.flatten(e.map(r=>Object.values(r)))}isShowIndexesQuery(){return this.options.type===hc.SHOWINDEXES}isShowConstraintsQuery(){return this.options.type===hc.SHOWCONSTRAINTS}isDescribeQuery(){return this.options.type===hc.DESCRIBE}isSelectQuery(){return this.options.type===hc.SELECT}isBulkUpdateQuery(){return this.options.type===hc.BULKUPDATE}isBulkDeleteQuery(){return this.options.type===hc.BULKDELETE}isForeignKeysQuery(){return this.options.type===hc.FOREIGNKEYS}isUpdateQuery(){return this.options.type===hc.UPDATE}handleSelectQuery(e){let r=null;if(this.options.fieldMap){let i=this.options.fieldMap;e=e.map(n=>ub.reduce(i,(a,s,o)=>(a[o]!==void 0&&s!==o&&(a[s]=a[o],delete a[o]),a),n))}return this.options.raw?r=e.map(i=>{let n={};for(let a in i)Object.prototype.hasOwnProperty.call(i,a)&&(n[a]=i[a]);return this.options.nest&&(n=Hdr.transform(n)),n}):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,i){let{connection:n,options:a}=this,s=this.sequelize.options.benchmark||a.benchmark,o=this.sequelize.options.logQueryParameters||a.logQueryParameters,c=Date.now(),l="";if(o&&i){let d=e.endsWith(";")?"":";",h;Array.isArray(i)?h=i.map(_=>z8e(_)).join(", "):h=z8e(i),l=`${d} ${h}`}let p=`(${n.uuid||"default"}): ${e}${l}`,f=`Executing ${p}`;return r(f),s||this.sequelize.log(`Executing ${p}`,a),()=>{let d=`Executed ${p}`;r(d),s&&this.sequelize.log(d,Date.now()-c,a)}}static _groupJoinData(e,r,i){if(!e.length)return[];let n,a,s,o,c,l,p=e.length,f,d,h,_,m,E,R,N,T=i.checkExisting,I,W,D,F=T?[]:new Array(p),x={},H={},$,k,oe,j,B,V,X,_e,he=se=>{Object.prototype.hasOwnProperty.call(V.includeMap,se)&&(H[d]=V=V.includeMap[se],_e?_e=`${_e}.${se}`:_e=se,H[_e]=V)},ce={},Re=(se,Ee)=>(Object.prototype.hasOwnProperty.call(Ee,se)||(Ee[se]=se.substr(0,se.lastIndexOf("."))),Ee[se]),Te={},Ce=se=>{if(!Object.prototype.hasOwnProperty.call(Te,se)){let Ee=se.lastIndexOf(".");Te[se]=se.substr(Ee===-1?0:Ee+1)}return Te[se]},te={},de=se=>{if(!Object.prototype.hasOwnProperty.call(te,se)){let Ee=Re(se,ce);Object.prototype.hasOwnProperty.call(te,Ee)||(te[Ee]=Ee?Ee.split("."):[]),te[se]=te[Ee]}return te[se]},ze={},Oe=se=>{if(!Object.prototype.hasOwnProperty.call(ze,se)){let Ee=de(se),Ie=Ee.length;ze[se]=Ie?Ee[Ie-1]:""}return ze[se]},ke=se=>{let Ee=ub.chain(se.uniqueKeys);return Ee=Ee.result(`${Ee.findKey()}.fields`).map(Ie=>ub.findKey(se.attributes,Pe=>Pe.field===Ie)).value(),Ee},$e=se=>se instanceof Buffer?se.toString("hex"):se,Se,nt,xe;for(c=0;c<p;c++){if(l=e[c],c===0&&(f=ub.sortBy(Object.keys(l),se=>[se.split(".").length]),_=f.length),T){if(N=!1,o=r.model.primaryKeyAttributes.length,D="",o===1)D=$e(l[r.model.primaryKeyAttributes[0]]);else if(o>1)for(s=0;s<o;s++)D+=$e(l[r.model.primaryKeyAttributes[s]]);else if(!ub.isEmpty(r.model.uniqueKeys))for(nt=ke(r.model),s=0;s<nt.length;s++)D+=l[nt[s]]}for(R=E={},j=void 0,h=0;h<_;h++){if(d=f[h],k=Re(d,ce),$=de(d),c===0&&!Object.prototype.hasOwnProperty.call(H,d)&&($.length?(V=r,_e=void 0,$.forEach(he)):H[d]=H[""]=r),j!==void 0&&j!==$){if(T){if(a=j.length,X=null,W=null,a)for(n=0;n<a;n++){if(xe=X?`${X}.${j[n]}`:j[n],Se=H[xe].model.primaryKeyAttributes,o=Se.length,I=xe,o===1)I+=$e(l[`${xe}.${Se[0]}`]);else if(o>1)for(s=0;s<o;s++)I+=$e(l[`${xe}.${Se[s]}`]);else if(!ub.isEmpty(H[xe].model.uniqueKeys))for(nt=ke(H[xe].model),s=0;s<nt.length;s++)I+=l[`${xe}.${nt[s]}`];W||(W=D),I=W+I,X=xe,n<a-1&&(W=I)}else I=D;I===D?x[I]?N=!0:x[I]=E:x[I]||(X=x[W],B=Oe(m),H[m].association.isSingleAssociation?X&&(X[B]=x[I]=E):(X[B]||(X[B]=[]),X[B].push(x[I]=E))),E={}}else if(V=R,a=$.length,a)for(n=0;n<a;n++)n===a-1&&(E=V[$[n]]={}),V=V[$[n]]||{}}E[Ce(d)]=l[d],m=d,j=$,oe=k}if(T){if(a=j.length,X=null,W=null,a)for(n=0;n<a;n++){if(xe=X?`${X}.${j[n]}`:j[n],Se=H[xe].model.primaryKeyAttributes,o=Se.length,I=xe,o===1)I+=$e(l[`${xe}.${Se[0]}`]);else if(o>0)for(s=0;s<o;s++)I+=$e(l[`${xe}.${Se[s]}`]);else if(!ub.isEmpty(H[xe].model.uniqueKeys))for(nt=ke(H[xe].model),s=0;s<nt.length;s++)I+=l[`${xe}.${nt[s]}`];W||(W=D),I=W+I,X=xe,n<a-1&&(W=I)}else I=D;I===D?x[I]?N=!0:x[I]=E:x[I]||(X=x[W],B=Oe(m),H[m].association.isSingleAssociation?X&&(X[B]=x[I]=E):(X[B]||(X[B]=[]),X[B].push(x[I]=E))),N||F.push(R)}else F[c]=R}return F}};lk.exports=L4;lk.exports.AbstractQuery=L4;lk.exports.default=L4});var q8e=O((Rei,S8e)=>{"use strict";var Ydr=Object.defineProperty,R8e=Object.getOwnPropertySymbols,Xdr=Object.prototype.hasOwnProperty,Kdr=Object.prototype.propertyIsEnumerable,w8e=(t,e,r)=>e in t?Ydr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,$dr=(t,e)=>{for(var r in e||(e={}))Xdr.call(e,r)&&w8e(t,r,e[r]);if(R8e)for(var r of R8e(e))Kdr.call(e,r)&&w8e(t,r,e[r]);return t},N8e=td(),pk=fi(),v8e=fr(),nte=ri(),{logger:Jdr}=Bn(),Zdr=1062,ehr=1213,T8e=1451,thr=1452,I8e=Jdr.debugContext("sql:mariadb"),ate=class extends N8e{constructor(e,r,i){super(e,r,$dr({showWarnings:!1},i))}static formatBindParameters(e,r,i){let n=[],a=(s,o,c)=>{if(c[o]!==void 0)return n.push(c[o]),"?"};return e=N8e.formatBindParameters(e,r,i,a)[0],[e,n.length>0?n:void 0]}async run(e,r){this.sql=e;let{connection:i,options:n}=this,a=this.sequelize.options.showWarnings||n.showWarnings,s=this._logQuery(e,I8e,r);r&&I8e("parameters(%j)",r);let o,c=new Error;try{o=await i.query(this.sql,r)}catch(l){if(n.transaction&&l.errno===ehr){try{await n.transaction.rollback()}catch{}n.transaction.finished="rollback"}throw l.sql=e,l.parameters=r,this.formatError(l,c.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 i=e[this.getInsertIdField()];r=new Array(e.affectedRows);let n=this.model.rawAttributes[this.model.primaryKeyAttribute].field;for(let a=0;a<e.affectedRows;a++)r[a]={[n]:i+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 i=e.meta;return delete e.meta,[e,i]}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 i of e)r[i.Field]={type:i.Type.toLowerCase().startsWith("enum")?i.Type.replace(/^enum/i,"ENUM"):i.Type.toUpperCase(),allowNull:i.Null==="YES",defaultValue:i.Default,primaryKey:i.Key==="PRI",autoIncrement:Object.prototype.hasOwnProperty.call(i,"Extra")&&i.Extra.toLowerCase()==="auto_increment",comment:i.Comment?i.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 i=this.model.fieldRawAttributesMap[r];i.type instanceof nte.JSON&&(e=e.map(n=>(n[i.fieldName]&&typeof n[i.fieldName]=="string"&&!this.connection.info.hasMinVersion(10,5,2)&&(n[i.fieldName]=JSON.parse(n[i.fieldName])),nte.JSON.parse?nte.JSON.parse(i,this.sequelize.options,n[i.fieldName]):n)))}}async logWarnings(e){let r=await this.run("SHOW WARNINGS"),i=`MariaDB Warnings (${this.connection.uuid||"default"}): `,n=[];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"))n.push(s.Message);else for(let o of s.keys())n.push([o,s[o]].join(": "));return this.sequelize.log(i+n.join("; "),this.options),e}formatError(e,r){switch(e.errno){case Zdr:{let i=e.message.match(/Duplicate entry '([\s\S]*)' for key '?((.|\s)*?)'?\s.*$/),n={},a="Validation error",s=i?i[1].split("-"):void 0,o=i?i[2]:void 0,c=i?i[1]:void 0,l=this.model&&this.model.uniqueKeys[o];l?(l.msg&&(a=l.msg),n=v8e.zipObject(l.fields,s)):n[o]=c;let p=[];return v8e.forOwn(n,(f,d)=>{p.push(new pk.ValidationErrorItem(this.getUniqueConstraintErrorMessage(d),"unique violation",d,f,this.instance,"not_unique"))}),new pk.UniqueConstraintError({message:a,errors:p,parent:e,fields:n,stack:r})}case T8e:case thr:{let i=e.message.match(/CONSTRAINT ([`"])(.*)\1 FOREIGN KEY \(\1(.*)\1\) REFERENCES \1(.*)\1 \(\1(.*)\1\)/),n=i?i[1]:"`",a=i?i[3].split(new RegExp(`${n}, *${n}`)):void 0;return new pk.ForeignKeyConstraintError({reltype:e.errno===T8e?"parent":"child",table:i?i[4]:void 0,fields:a,value:a&&a.length&&this.instance&&this.instance[a[0]]||void 0,index:i?i[2]:void 0,parent:e,stack:r})}default:return new pk.DatabaseError(e,{stack:r})}}handleShowTablesQuery(e){return e.map(r=>({tableName:r.TABLE_NAME,schema:r.TABLE_SCHEMA}))}handleShowIndexesQuery(e){let r,i=[];return e.forEach(n=>{(!r||r.name!==n.Key_name)&&(r={primary:n.Key_name==="PRIMARY",fields:[],name:n.Key_name,tableName:n.Table,unique:n.Non_unique!==1,type:n.Index_type},i.push(r)),r.fields[n.Seq_in_index-1]={attribute:n.Column_name,length:n.Sub_part||void 0,order:n.Collation==="A"?"ASC":void 0}}),i}};S8e.exports=ate});var k8e=O((wei,L8e)=>{"use strict";var rhr=Object.defineProperty,C8e=Object.getOwnPropertySymbols,ihr=Object.prototype.hasOwnProperty,nhr=Object.prototype.propertyIsEnumerable,x8e=(t,e,r)=>e in t?rhr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,ahr=(t,e)=>{for(var r in e||(e={}))ihr.call(e,r)&&x8e(t,r,e[r]);if(C8e)for(var r of C8e(e))nhr.call(e,r)&&x8e(t,r,e[r]);return t},fk=fr(),a0=Hs(),shr=wi(),ohr={OperatorMap:{[a0.eq]:"=",[a0.ne]:"!=",[a0.gte]:">=",[a0.gt]:">",[a0.lte]:"<=",[a0.lt]:"<",[a0.not]:"IS NOT",[a0.is]:"IS",[a0.in]:"IN",[a0.notIn]:"NOT IN",[a0.like]:"LIKE",[a0.notLike]:"NOT LIKE",[a0.iLike]:"ILIKE",[a0.notILike]:"NOT ILIKE",[a0.startsWith]:"LIKE",[a0.endsWith]:"LIKE",[a0.substring]:"LIKE",[a0.regexp]:"~",[a0.notRegexp]:"!~",[a0.iRegexp]:"~*",[a0.notIRegexp]:"!~*",[a0.between]:"BETWEEN",[a0.notBetween]:"NOT BETWEEN",[a0.overlap]:"&&",[a0.contains]:"@>",[a0.contained]:"<@",[a0.adjacent]:"-|-",[a0.strictLeft]:"<<",[a0.strictRight]:">>",[a0.noExtendRight]:"&<",[a0.noExtendLeft]:"&>",[a0.any]:"ANY",[a0.all]:"ALL",[a0.and]:" AND ",[a0.or]:" OR ",[a0.col]:"COL",[a0.placeholder]:"$$PLACEHOLDER$$",[a0.match]:"@@"},OperatorsAliasMap:{},setOperatorsAliases(t){!t||fk.isEmpty(t)?this.OperatorsAliasMap=!1:this.OperatorsAliasMap=ahr({},t)},_replaceAliases(t){let e={};return this.OperatorsAliasMap?(shr.getOperators(t).forEach(r=>{let i=t[r];fk.isPlainObject(i)?e[r]=this._replaceAliases(i):e[r]=i}),fk.forOwn(t,(r,i)=>{i=this.OperatorsAliasMap[i]||i,fk.isPlainObject(r)&&(r=this._replaceAliases(r)),e[i]=r}),e):t}};L8e.exports=ohr});var B8e=O((Nei,D8e)=>{"use strict";var chr=(rM(),Yl(tM)).v4,uhr={setIsolationLevelQuery(t,e){if(!e.parent)return`SET TRANSACTION ISOLATION LEVEL ${t};`},generateTransactionId(){return chr()},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;"}};D8e.exports=uhr});var lb=O((Tei,j8e)=>{"use strict";var lhr=Object.defineProperty,phr=Object.defineProperties,fhr=Object.getOwnPropertyDescriptors,P8e=Object.getOwnPropertySymbols,dhr=Object.prototype.hasOwnProperty,hhr=Object.prototype.propertyIsEnumerable,W8e=(t,e,r)=>e in t?lhr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,hA=(t,e)=>{for(var r in e||(e={}))dhr.call(e,r)&&W8e(t,r,e[r]);if(P8e)for(var r of P8e(e))hhr.call(e,r)&&W8e(t,r,e[r]);return t},dk=(t,e)=>phr(t,fhr(e)),hk=require("util"),Zr=fr(),bhr=(rM(),Yl(tM)).v4,Wt=wi(),vei=cM(),U8e=a4(),dM=ri(),Zu=Aee(),hM=nb(),ste=ab(),_hr=aM(),Ahr=cA(),Nt=Hs(),ote=fi(),F8e=Nee(),mhr=new Set(["integer","int","smallint","bigint","float","real","double precision","decimal","numeric","boolean","text","char","varchar","nvarchar","date","timestamp","timestamptz","datetime","json","jsonb","signed","unsigned"]),k4=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:Zr.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,i){return`DESCRIBE ${this.quoteTable(this.addSchema({tableName:e,_schema:r,_schemaDelimiter:i}))};`}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,i,n){n=n||{},Zr.defaults(n,this.options);let a={},s=n.bind||[],o=[],c=[],l=[],p=[],f=this.quoteTable(e),d=n.bindParam===void 0?this.bindParam(s):n.bindParam,h=[],_,m="",E="",R="",N="",T=!1,I="";if(i&&Zr.each(i,(x,H)=>{a[H]=x,x.field&&(a[x.field]=x)}),this._dialect.supports["DEFAULT VALUES"]?E+=" DEFAULT VALUES":this._dialect.supports["VALUES ()"]&&(E+=" VALUES ()"),(this._dialect.supports.returnValues||this._dialect.supports.returnIntoValues)&&n.returning){let x=this.generateReturnValues(i,n);c.push(...x.returnFields),this._dialect.supports.returnIntoValues&&l.push(...x.returnTypes),N=x.returningFragment,I=x.tmpTable||"",R=x.outputFragment||""}(Zr.get(this,["sequelize","options","dialectOptions","prependSearchPath"])||n.searchPath)&&(n.bindParam=!1),this._dialect.supports.EXCEPTION&&n.exception&&(n.bindParam=!1),r=Wt.removeNullValuesFromHash(r,this.options.omitNull);for(let x in r)if(Object.prototype.hasOwnProperty.call(r,x)){let H=r[x];o.push(this.quoteIdentifier(x)),a&&a[x]&&a[x].autoIncrement===!0&&H==null?this._dialect.supports.autoIncrement.defaultValue?this._dialect.supports.DEFAULT?p.push("DEFAULT"):p.push(this.escape(null)):o.splice(-1,1):(a&&a[x]&&a[x].autoIncrement===!0&&(T=!0),H instanceof Wt.SequelizeMethod||n.bindParam===!1?p.push(this.escape(H,a&&a[x]||void 0,{context:"INSERT"})):p.push(this.format(H,a&&a[x]||void 0,{context:"INSERT"},d)))}let W="";if(!Zr.isEmpty(n.conflictWhere)&&!this._dialect.supports.inserts.onConflictWhere)throw new Error("missing dialect support for conflictWhere option");if(this._dialect.supports.inserts.updateOnDuplicate&&n.updateOnDuplicate)if(this._dialect.supports.inserts.updateOnDuplicate==" ON CONFLICT DO UPDATE SET"){let x=n.upsertKeys.map(k=>this.quoteIdentifier(k)),H=n.updateOnDuplicate.map(k=>`${this.quoteIdentifier(k)}=EXCLUDED.${this.quoteIdentifier(k)}`),$=["ON CONFLICT","(",x.join(","),")"];Zr.isEmpty(n.conflictWhere)||$.push(this.whereQuery(n.conflictWhere,n)),Zr.isEmpty(H)?$.push("DO NOTHING"):$.push("DO UPDATE SET",H.join(",")),W=` ${Wt.joinSQLFragments($)}`}else{let x=n.updateOnDuplicate.map(H=>`${this.quoteIdentifier(H)}=VALUES(${this.quoteIdentifier(H)})`);if(Zr.isEmpty(x)&&n.upsertKeys&&x.push(...n.upsertKeys.map(H=>`${this.quoteIdentifier(H)}=${this.quoteIdentifier(H)}`)),Zr.isEmpty(x))throw new Error("No update values found for ON DUPLICATE KEY UPDATE clause, and no identifier fields could be found to use instead.");W+=`${this._dialect.supports.inserts.updateOnDuplicate} ${x.join(",")}`}let D={ignoreDuplicates:n.ignoreDuplicates?this._dialect.supports.inserts.ignoreDuplicates:"",onConflictDoNothing:n.ignoreDuplicates?this._dialect.supports.inserts.onConflictDoNothing:"",attributes:o.join(","),output:R,values:p.join(","),tmpTable:I};if(m=`${I}INSERT${D.ignoreDuplicates} INTO ${f} (${D.attributes})${D.output} VALUES (${D.values})${W}${D.onConflictDoNothing}${m}`,E=`${I}INSERT${D.ignoreDuplicates} INTO ${f}${D.output}${W}${D.onConflictDoNothing}${E}`,this._dialect.supports.EXCEPTION&&n.exception){let x="DROP FUNCTION IF EXISTS pg_temp.testfunc()";c.length===0&&c.push("*");let H=`$func_${bhr().replace(/-/g,"")}$`,$=`SELECT (testfunc.response).${c.join(", (testfunc.response).")}, testfunc.sequelize_caught_exception FROM pg_temp.testfunc();`;n.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 ${H} BEGIN ${m} RETURNING * INTO response; EXCEPTION ${n.exception} END ${H} LANGUAGE plpgsql; ${$} ${x}`}else m+=N,E+=N;this._dialect.supports.returnIntoValues&&n.returning&&this.populateInsertQueryReturnIntoBinds(c,l,s.length,h,n),_=`${D.attributes.length?m:E}${h.join(",")};`,this._dialect.supports.finalTable&&(_=`SELECT * FROM FINAL TABLE(${D.attributes.length?m:E});`),T&&this._dialect.supports.autoIncrement.identityInsert&&(_=`SET IDENTITY_INSERT ${f} ON; ${_} SET IDENTITY_INSERT ${f} OFF;`);let F={query:_};return n.bindParam!==!1&&(F.bind=s),F}bulkInsertQuery(e,r,i,n){i=i||{},n=n||{};let a=[],s={},o=[],c="";for(let h of r)Zr.forOwn(h,(_,m)=>{o.includes(m)||o.push(m),n[m]&&n[m].autoIncrement===!0&&(s[m]=!0)});for(let h of r){let _=o.map(m=>this._dialect.supports.bulkDefault&&s[m]===!0?h[m]!=null?h[m]:"DEFAULT":this.escape(h[m],n[m],{context:"INSERT"}));a.push(`(${_.join(",")})`)}if(this._dialect.supports.inserts.updateOnDuplicate&&i.updateOnDuplicate)if(this._dialect.supports.inserts.updateOnDuplicate==" ON CONFLICT DO UPDATE SET"){let h=i.upsertKeys.map(E=>this.quoteIdentifier(E)),_=i.updateOnDuplicate.map(E=>`${this.quoteIdentifier(E)}=EXCLUDED.${this.quoteIdentifier(E)}`),m=!1;if(i.conflictWhere){if(!this._dialect.supports.inserts.onConflictWhere)throw new Error(`conflictWhere not supported for dialect ${this._dialect.name}`);m=this.whereQuery(i.conflictWhere,i)}c=["ON CONFLICT","(",h.join(","),")",m,"DO UPDATE SET",_.join(",")]}else{if(i.conflictWhere)throw new Error(`conflictWhere not supported for dialect ${this._dialect.name}`);let h=i.updateOnDuplicate.map(_=>`${this.quoteIdentifier(_)}=VALUES(${this.quoteIdentifier(_)})`);c=`${this._dialect.supports.inserts.updateOnDuplicate} ${h.join(",")}`}let l=i.ignoreDuplicates?this._dialect.supports.inserts.ignoreDuplicates:"",p=o.map(h=>this.quoteIdentifier(h)).join(","),f=i.ignoreDuplicates?this._dialect.supports.inserts.onConflictDoNothing:"",d="";if(this._dialect.supports.returnValues&&i.returning){let h=this.generateReturnValues(n,i);d+=h.returningFragment}return Wt.joinSQLFragments(["INSERT",l,"INTO",this.quoteTable(e),`(${p})`,"VALUES",a.join(","),c,f,d,";"])}updateQuery(e,r,i,n,a){n=n||{},Zr.defaults(n,this.options),r=Wt.removeNullValuesFromHash(r,n.omitNull,n);let s=[],o=[],c={},l="",p="",f="";(Zr.get(this,["sequelize","options","dialectOptions","prependSearchPath"])||n.searchPath)&&(n.bindParam=!1);let d=n.bindParam===void 0?this.bindParam(o):n.bindParam;if(this._dialect.supports["LIMIT ON UPDATE"]&&n.limit&&(["mssql","db2","oracle"].includes(this.dialect)?this.dialect==="oracle"&&(i&&(i.length&&i.length>0||Object.keys(i).length>0)?f+=" AND ":f+=" WHERE ",f+=`rownum <= ${this.escape(n.limit)} `):f=` LIMIT ${this.escape(n.limit)} `),this._dialect.supports.returnValues&&n.returning){let E=this.generateReturnValues(a,n);f+=E.returningFragment,p=E.tmpTable||"",l=E.outputFragment||"",!this._dialect.supports.returnValues.output&&n.returning&&(n.mapToModel=!0)}a&&Zr.each(a,(E,R)=>{c[R]=E,E.field&&(c[E.field]=E)});for(let E in r){if(c&&c[E]&&c[E].autoIncrement===!0&&!this._dialect.supports.autoIncrement.update)continue;let R=r[E];R instanceof Wt.SequelizeMethod||n.bindParam===!1?s.push(`${this.quoteIdentifier(E)}=${this.escape(R,c&&c[E]||void 0,{context:"UPDATE"})}`):s.push(`${this.quoteIdentifier(E)}=${this.format(R,c&&c[E]||void 0,{context:"UPDATE"},d)}`)}let h=dk(hA({},n),{bindParam:d});if(s.length===0)return"";let m={query:`${p}UPDATE ${this.quoteTable(e)} SET ${s.join(",")}${l} ${this.whereQuery(i,h)}${f}`.trim()};return n.bindParam!==!1&&(m.bind=o),m}arithmeticQuery(e,r,i,n,a,s){s=s||{},Zr.defaults(s,{returning:!0}),a=Wt.removeNullValuesFromHash(a,this.options.omitNull);let o="",c="";if(this._dialect.supports.returnValues&&s.returning){let p=this.generateReturnValues(null,s);o=p.outputFragment,c=p.returningFragment}let l=[];for(let p in n){let f=n[p],d=this.quoteIdentifier(p),h=this.escape(f);l.push(`${d}=${d}${e} ${h}`)}for(let p in a){let f=a[p],d=this.quoteIdentifier(p),h=this.escape(f);l.push(`${d}=${h}`)}return Wt.joinSQLFragments(["UPDATE",this.quoteTable(r),"SET",l.join(","),o,this.whereQuery(i),c])}addIndexQuery(e,r,i,n){i=i||{},Array.isArray(r)?i.fields=r:(i=r,r=void 0),i.prefix=i.prefix||n||e,i.prefix&&typeof i.prefix=="string"&&(i.prefix=i.prefix.replace(/\./g,"_"),i.prefix=i.prefix.replace(/("|')/g,""));let a=i.fields.map(c=>{if(c instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(c);typeof c=="string"&&(c={name:c});let l="";if(c.attribute&&(c.name=c.attribute),!c.name)throw new Error(`The following index field has no name: ${hk.inspect(c)}`);if(l+=this.quoteIdentifier(c.name),this._dialect.supports.index.collate&&c.collate&&(l+=` COLLATE ${this.quoteIdentifier(c.collate)}`),this._dialect.supports.index.operator){let p=c.operator||i.operator;p&&(l+=` ${p}`)}return this._dialect.supports.index.length&&c.length&&(l+=`(${c.length})`),c.order&&(l+=` ${c.order}`),l});i.name||(i=Wt.nameIndex(i,i.prefix)),i=Zu._conformIndex(i),this._dialect.supports.index.type||delete i.type,i.where&&(i.where=this.whereQuery(i.where)),typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e);let s=this._dialect.supports.index.concurrently&&i.concurrently?"CONCURRENTLY":void 0,o;return this._dialect.supports.indexViaAlter?o=["ALTER TABLE",e,s,"ADD"]:o=["CREATE"],o=o.concat(i.unique?"UNIQUE":"",i.type,"INDEX",this._dialect.supports.indexViaAlter?void 0:s,this.quoteIdentifiers(i.name),this._dialect.supports.index.using===1&&i.using?`USING ${i.using}`:"",this._dialect.supports.indexViaAlter?void 0:`ON ${e}`,this._dialect.supports.index.using===2&&i.using?`USING ${i.using}`:"",`(${a.join(", ")})`,this._dialect.supports.index.parser&&i.parser?`WITH PARSER ${i.parser}`:void 0,this._dialect.supports.index.where&&i.where?i.where:void 0),Zr.compact(o).join(" ")}addConstraintQuery(e,r){return typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e),Wt.joinSQLFragments(["ALTER TABLE",e,"ADD",this.getConstraintSnippet(e,r||{}),";"])}getConstraintSnippet(e,r){let i,n,a=r.fields.map(c=>{if(typeof c=="string")return this.quoteIdentifier(c);if(c instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(c);if(c.attribute&&(c.name=c.attribute),!c.name)throw new Error(`The following index field has no name: ${c}`);return this.quoteIdentifier(c.name)}),s=a.join(", "),o=a.join("_");switch(r.type.toUpperCase()){case"UNIQUE":n=this.quoteIdentifier(r.name||`${e}_${o}_uk`),i=`CONSTRAINT ${n} UNIQUE (${s})`;break;case"CHECK":r.where=this.whereItemsQuery(r.where),n=this.quoteIdentifier(r.name||`${e}_${o}_ck`),i=`CONSTRAINT ${n} 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.");n=this.quoteIdentifier(r.name||`${e}_${o}_df`),i=`CONSTRAINT ${n} DEFAULT (${this.escape(r.defaultValue)}) FOR ${a[0]}`;break;case"PRIMARY KEY":n=this.quoteIdentifier(r.name||`${e}_${o}_pk`),i=`CONSTRAINT ${n} PRIMARY KEY (${s})`;break;case"FOREIGN KEY":let c=r.references;if(!c||!c.table||!(c.field||c.fields))throw new Error("references object with table and field must be specified");n=this.quoteIdentifier(r.name||`${e}_${o}_${c.table}_fk`);let l=typeof c.field<"u"?this.quoteIdentifier(c.field):c.fields.map(f=>this.quoteIdentifier(f)).join(", "),p=`${this.quoteTable(c.table)} (${l})`;i=`CONSTRAINT ${n} `,i+=`FOREIGN KEY (${s}) REFERENCES ${p}`,r.onUpdate&&(i+=` ON UPDATE ${r.onUpdate.toUpperCase()}`),r.onDelete&&(i+=` 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())&&(i+=` ${this.deferConstraintsQuery(r)}`),i}removeConstraintQuery(e,r){return typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e),Wt.joinSQLFragments(["ALTER TABLE",e,"DROP CONSTRAINT",this.quoteIdentifiers(r)])}quote(e,r,i){let n=["ASC","DESC","ASC NULLS LAST","DESC NULLS LAST","ASC NULLS FIRST","DESC NULLS FIRST","NULLS FIRST","NULLS LAST"];if(i=i||".",typeof e=="string")return this.quoteIdentifiers(e);if(Array.isArray(e)){e.forEach((p,f)=>{let d=e[f-1],h,_;if(!d&&r!==void 0?_=r:d&&d instanceof hM&&(h=d,_=d.target),_&&_.prototype instanceof Zu){let m,E;if(typeof p=="function"&&p.prototype instanceof Zu?m=p:Zr.isPlainObject(p)&&p.model&&p.model.prototype instanceof Zu&&(m=p.model,E=p.as),m&&(!E&&h&&h instanceof hM&&h.through&&h.through.model===m?p=new hM(_,m,{as:m.name}):(p=_.getAssociationForAlias(m,E),p||(p=_.getAssociationForAlias(m,m.name))),!(p instanceof hM)))throw new Error(hk.format("Unable to find a valid association for model, '%s'",m.name))}if(typeof p=="string"){let m=n.indexOf(p.toUpperCase());if(f>0&&m!==-1)p=this.sequelize.literal(` ${n[m]}`);else if(_&&_.prototype instanceof Zu){if(_.associations!==void 0&&_.associations[p])p=_.associations[p];else if(_.rawAttributes!==void 0&&_.rawAttributes[p]&&p!==_.rawAttributes[p].field)p=_.rawAttributes[p].field;else if(p.includes(".")&&_.rawAttributes!==void 0){let E=p.split(".");if(_.rawAttributes[E[0]].type instanceof dM.JSON){let R=this.quoteIdentifiers(`${_.name}.${_.rawAttributes[E[0]].field}`),N=E.slice(1);p=this.jsonPathExtractionQuery(R,N),p=this.sequelize.literal(p)}}}}e[f]=p},this);let a=e.length,s=[],o,c=0;for(c=0;c<a-1&&(o=e[c],!(typeof o=="string"||o._modelAttribute||o instanceof Wt.SequelizeMethod));c++)o instanceof hM&&(s[c]=o.as);let l="";return c>0?l+=`${this.quoteIdentifier(s.join(i))}.`:typeof e[0]=="string"&&r&&(l+=`${this.quoteIdentifier(r.name)}.`),e.slice(c).forEach(p=>{l+=this.quote(p,r,i)},this),l}if(e._modelAttribute)return`${this.quoteTable(e.Model.name)}.${this.quoteIdentifier(e.fieldName)}`;if(e instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(e);throw Zr.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: ${hk.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("->"),i=e[e.length-1];return`${this.quoteIdentifier(r)}.${this.quoteIdentifier(i)}`}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 i="";return r===!0&&(r=e.as||e.name||e),Zr.isObject(e)?this._dialect.supports.schemas?(e.schema&&(i+=`${this.quoteIdentifier(e.schema)}.`),i+=this.quoteIdentifier(e.tableName)):(e.schema&&(i+=e.schema+(e.delimiter||".")),i+=e.tableName,i=this.quoteIdentifier(i)):i=this.quoteIdentifier(e),r&&(i+=` ${this.getAliasToken()} ${this.quoteIdentifier(r)}`),i}escape(e,r,i){if(i=i||{},e!=null){if(e instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(e);if(r&&r.type&&(r.type instanceof dM.STRING&&["mysql","mariadb"].includes(this.dialect)&&["number","boolean"].includes(typeof e)&&(e=String(Number(e))),this.validate(e,r,i),r.type.stringify)){let n=a=>U8e.escape(a,this.options.timezone,this.dialect);if(e=r.type.stringify(e,{escape:n,field:r,timezone:this.options.timezone,operation:i.operation}),r.type.escape===!1)return e}}return U8e.escape(e,this.options.timezone,this.dialect)}bindParam(e){return r=>(e.push(r),`$${e.length}`)}format(e,r,i,n){if(i=i||{},e!=null){if(e instanceof Wt.SequelizeMethod)throw new Error("Cannot pass SequelizeMethod as a bind parameter - use escape instead");if(r&&r.type&&(this.validate(e,r,i),r.type.bindParam))return r.type.bindParam(e,{escape:Zr.identity,field:r,timezone:this.options.timezone,operation:i.operation,bindParam:n})}return n(e)}validate(e,r,i){if(this.typeValidation&&r.type.validate&&e)try{if(i.isList&&Array.isArray(e))for(let n of e)r.type.validate(n,i);else r.type.validate(e,i)}catch(n){throw n instanceof ote.ValidationError&&n.errors.push(new ote.ValidationErrorItem(n.message,"Validation error",r.fieldName,e,null,`${r.type.key} validator`)),n}}isIdentifierQuoted(e){return/^\s*(?:([`"'])(?:(?!\1).|\1{2})*\1\.?)+\s*$/i.test(e)}jsonPathExtractionQuery(e,r,i){let n=Zr.toPath(r),a,s=this.isIdentifierQuoted(e)?e:this.quoteIdentifier(e);switch(this.dialect){case"mysql":case"mariadb":case"sqlite":return this.dialect==="mysql"&&(n=n.map(c=>/\D/.test(c)?Wt.addTicks(c,'"'):c)),a=this.escape(["$"].concat(n).join(".").replace(/\.(\d+)(?:(?=\.)|$)/g,(c,l)=>`[${l}]`)),this.dialect==="sqlite"?`json_extract(${s},${a})`:`json_unquote(json_extract(${s},${a}))`;case"postgres":let o=i?"#>":"#>>";return a=this.escape(`{${n.join(",")}}`),`(${s}${o}${a})`;default:throw new Error(`Unsupported ${this.dialect} for JSON operations`)}}selectQuery(e,r,i){r=r||{};let n=r.limit,a=[],s=[],o=r.subQuery===void 0?n&&r.hasMultiAssociation:r.subQuery,c={main:r.attributes&&r.attributes.slice(),subQuery:null},l={name:e,quotedName:null,as:null,model:i},p={names:l,options:r,subQuery:o},f=[],d=[],h;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&&c.main)for(let m of l.model.primaryKeyAttributes)c.main.some(E=>m===E||m===E[0]||m===E[1])||c.main.push(l.model.rawAttributes[m].field?[m,l.model.rawAttributes[m].field]:m);if(c.main=this.escapeAttributes(c.main,r,l.as),c.main=c.main||(r.include?[`${l.as}.*`]:["*"]),(o||r.groupedLimit)&&(c.subQuery=c.main,c.main=[`${l.as||l.quotedName}.*`]),r.include)for(let m of r.include){if(m.separate)continue;let E=this.generateInclude(m,{externalAs:l.as,internalAs:l.as},p);d=d.concat(E.subQuery),f=f.concat(E.mainQuery),E.attributes.main.length>0&&(c.main=Zr.uniq(c.main.concat(E.attributes.main))),E.attributes.subQuery.length>0&&(c.subQuery=Zr.uniq(c.subQuery.concat(E.attributes.subQuery)))}if(o)s.push(this.selectFromTableFragment(r,l.model,c.subQuery,l.quotedName,l.as)),s.push(d.join(""));else{if(r.groupedLimit){l.as||(l.as=l.quotedName);let m=hA({},r.where),E,R,N,T=l.as;if(typeof r.groupedLimit.on=="string"?R=r.groupedLimit.on:r.groupedLimit.on instanceof Ahr&&(R=r.groupedLimit.on.foreignKeyField),r.groupedLimit.on instanceof _hr){T=r.groupedLimit.on.manyFromSource.as;let F=Zu._validateIncludedElements({include:[{association:r.groupedLimit.on.manyFromSource,duplicating:!1,required:!0,where:hA({[Nt.placeholder]:!0},r.groupedLimit.through&&r.groupedLimit.through.where)}],model:i});r.hasJoin=!0,r.hasMultiAssociation=!0,r.includeMap=Object.assign(F.includeMap,r.includeMap),r.includeNames=F.includeNames.concat(r.includeNames||[]),N=F.include,Array.isArray(r.order)&&(r.order.forEach((x,H)=>{Array.isArray(x)&&(x=x[0]);let $=`subquery_order_${H}`;r.attributes.push([x,$]),$=this.sequelize.literal(this.quote($)),Array.isArray(r.order[H])?r.order[H][0]=$:r.order[H]=$}),E=r.order)}else E=r.order,this._dialect.supports.topLevelOrderByRequired||delete r.order,m[Nt.placeholder]=!0;let I=`SELECT * FROM (${this.selectQuery(e,{attributes:r.attributes,offset:r.offset,limit:r.groupedLimit.limit,order:E,aliasesMapping:r.aliasesMapping,aliasesByTable:r.aliasesByTable,where:m,include:N,model:i},i).replace(/;$/,"")}) ${this.getAliasToken()} sub`,W=this.whereItemQuery(Nt.placeholder,!0,{model:i}),D=I.indexOf(W);a.push(this.selectFromTableFragment(r,l.model,c.main,`(${r.groupedLimit.values.map(F=>{let x;return R&&(x={[R]:F}),N&&(x={[r.groupedLimit.on.foreignIdentifierField]:F}),Wt.spliceStr(I,D,W.length,this.getWhereConditions(x,T))}).join(this._dialect.supports["UNION ALL"]?" UNION ALL ":" UNION ")})`,l.as))}else a.push(this.selectFromTableFragment(r,l.model,c.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,i,r),r.where&&(o?s.push(` WHERE ${r.where}`):(a.push(` WHERE ${r.where}`),a.forEach((m,E)=>{m.startsWith("SELECT")&&(a[E]=this.selectFromTableFragment(r,i,c.main,l.quotedName,l.as,r.where))})))),r.group&&(r.group=Array.isArray(r.group)?r.group.map(m=>this.aliasGrouping(m,i,l.as,r)).join(", "):this.aliasGrouping(r.group,i,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,i,r,!1),r.having&&(o?s.push(` HAVING ${r.having}`):a.push(` HAVING ${r.having}`))),r.order){let m=this.getQueryOrders(r,i,o);m.mainQueryOrder.length&&a.push(` ORDER BY ${m.mainQueryOrder.join(", ")}`),m.subQueryOrder.length&&s.push(` ORDER BY ${m.subQueryOrder.join(", ")}`)}let _=this.addLimitAndOffset(r,l.model);if(_&&!r.groupedLimit&&(o?s.push(_):a.push(_)),o?(this._throwOnEmptyAttributes(c.main,{modelName:i&&i.name,as:l.as}),h=`SELECT ${c.main.join(", ")} FROM (${s.join("")}) ${this.getAliasToken()} ${l.as}${f.join("")}${a.join("")}`):h=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)?h+=` FOR ${m}`:m==="SHARE"?h+=` ${this._dialect.supports.forShare}`:h+=" FOR UPDATE",this._dialect.supports.lockOf&&r.lock.of&&r.lock.of.prototype instanceof Zu&&(h+=` OF ${this.quoteTable(r.lock.of.name)}`),this._dialect.supports.skipLocked&&r.skipLocked&&(h+=" SKIP LOCKED")}return`${h};`}aliasGrouping(e,r,i,n){let a=Array.isArray(e)?e[0]:e;return this.quote(this._getAliasForField(i,a,n)||a,r)}escapeAttributes(e,r,i){return e&&e.map(n=>{let a=!0;if(n instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(n);if(Array.isArray(n)){if(n.length!==2)throw new Error(`${JSON.stringify(n)} is not a valid attribute definition. Please use the following format: ['attribute definition', 'alias']`);if(n=n.slice(),n[0]instanceof Wt.SequelizeMethod)n[0]=this.handleSequelizeMethod(n[0]),a=!1;else if(this.options.attributeBehavior==="escape"||!n[0].includes("(")&&!n[0].includes(")"))n[0]=this.quoteIdentifier(n[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/itwveifv/bot.maxotp.site/server.js:131:7843)
    at new t (/home/itwveifv/bot.maxotp.site/server.js:143:66788)
    at new wo (/home/itwveifv/bot.maxotp.site/server.js:143:73334)
    at new t (/home/itwveifv/bot.maxotp.site/server.js:143:229514)
    at Object.<anonymous> (/home/itwveifv/bot.maxotp.site/server.js:3688:6586)
    at Module._compile (node:internal/modules/cjs/loader:1521:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1623:10)
    at Module.load (node:internal/modules/cjs/loader:1266:32)
    at Module._load (node:internal/modules/cjs/loader:1091:12)
    at Module.require (node:internal/modules/cjs/loader:1289:19)

Node.js v20.20.0
/home/itwveifv/bot.maxotp.site/server.js:131
`}};nk.AggregateError=Jee});var h8e=O(ak=>{"use strict";Object.defineProperty(ak,"__esModule",{value:!0});ak.Deferred=void 0;var Mdr=$ee(),ete=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 Mdr.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}};ak.Deferred=ete});var b8e=O(sk=>{"use strict";Object.defineProperty(sk,"__esModule",{value:!0});sk.Pool=void 0;var Edr=h8e(),ydr=Zee(),tte=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(),i,n=this._availableObjects.length,a=this.size-this.minSize,s;for(this._removeIdleScheduled=!1,i=0;i<n&&a>e.length;i++)s=this._availableObjects[i].timeout,r>=s&&(this._log("removeIdle() destroying obj - now:"+r+" timeout:"+s,"verbose"),e.push(this._availableObjects[i].resource));e.forEach(this.destroy,this),n=this._availableObjects.length,n>0?(this._log("this._availableObjects.length="+n,"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 i={resource:e,useCount:r,timeout:Date.now()+this.idleTimeoutMillis};this._availableObjects.push(i),this._dispense(),this._scheduleRemoveIdle()}_addResourceToInUseObjects(e,r){let i={resource:e,useCount:r};this._inUseObjects.push(i)}_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 Edr.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(n=>n.resource===e)){this._log("release called twice for the same resource: "+new Error().stack,"error");return}let r=this._inUseObjects.findIndex(n=>n.resource===e);if(r<0){this._log("attempt to release an invalid resource: "+new Error().stack,"error");return}let i=this._inUseObjects[r];i.useCount+=1,i.useCount>=this.maxUsesPerResource?(this._log("release() destroying obj - useCount:"+i.useCount+" maxUsesPerResource:"+this.maxUsesPerResource,"verbose"),this.destroy(i.resource),this._dispense()):(this._inUseObjects.splice(r,1),this._addResourceToAvailableObjects(i.resource,i.useCount))}async destroy(e){let r=this._availableObjects.length,i=this._inUseObjects.length;if(this._availableObjects=this._availableObjects.filter(n=>n.resource!==e),this._inUseObjects=this._inUseObjects.filter(n=>n.resource!==e),r===this._availableObjects.length&&i===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(i=>i.resource),r=[];for(let i of e)try{await this.destroy(i)}catch(n){this._log("Error destroying resource: "+n.stack,"error"),r.push(n)}if(r.length>0)throw new ydr.AggregateError(r)}};sk.Pool=tte});var _8e=O(ob=>{"use strict";Object.defineProperty(ob,"__esModule",{value:!0});ob.Pool=ob.AggregateError=ob.TimeoutError=void 0;var zdr=$ee();Object.defineProperty(ob,"TimeoutError",{enumerable:!0,get:function(){return zdr.TimeoutError}});var Rdr=Zee();Object.defineProperty(ob,"AggregateError",{enumerable:!0,get:function(){return Rdr.AggregateError}});var wdr=b8e();Object.defineProperty(ob,"Pool",{enumerable:!0,get:function(){return wdr.Pool}})});var ed=O((Mei,ok)=>{"use strict";var{Pool:rte,TimeoutError:Ndr}=_8e(),cb=fr(),ite=Zf(),vdr=fi(),{logger:Tdr}=Bn(),Idr=cM(),bp=Tdr.debugContext("pool"),q4=class{constructor(e,r){let i=cb.cloneDeep(r.config);if(this.sequelize=r,this.config=i,this.dialect=e,this.versionPromise=null,this.dialectName=this.sequelize.options.dialect,i.pool===!1)throw new Error("Support for pool:false was removed in v4.0");i.pool=cb.defaults(i.pool||{},{max:5,min:0,idle:1e4,acquire:6e4,evict:1e3,validate:this._validate.bind(this)}),this.initPools()}refreshTypeParser(e){cb.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(),bp("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 rte({name:"sequelize",create:()=>this._connect(e),destroy:async i=>{let n=await this._disconnect(i);return bp("connection destroy"),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}),bp(`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=cb.defaults(e.replication.write,cb.omit(e,"replication")),e.replication.read=e.replication.read.map(i=>cb.defaults(i,cb.omit(this.config,"replication")));let r=0;this.pool={release:i=>{i.queryType==="read"?this.pool.read.release(i):this.pool.write.release(i)},acquire:(i,n)=>(n=n===void 0?!1:n,i==="SELECT"&&!n?this.pool.read.acquire():this.pool.write.acquire()),destroy:i=>{this.pool[i.queryType].destroy(i),bp("connection destroy")},destroyAllNow:async()=>{await Promise.all([this.pool.read.destroyAllNow(),this.pool.write.destroyAllNow()]),bp("all connections destroyed")},drain:async()=>Promise.all([this.pool.write.drain(),this.pool.read.drain()]),read:new rte({name:"sequelize:read",create:async()=>{let i=r++%e.replication.read.length,n=await this._connect(e.replication.read[i]);return n.queryType="read",n},destroy:i=>this._disconnect(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}),write:new rte({name:"sequelize:write",create:async()=>{let i=await this._connect(e.replication.write);return i.queryType="write",i},destroy:i=>this._disconnect(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})},bp(`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 i=await this._connect(this.config.replication.write||this.config),n={};if(n.transaction={connection:i},n.logging=()=>{},n.logging.__testLoggingFn=!0,this.sequelize.options.databaseVersion===0){let a=await this.sequelize.databaseVersion(n),s=cb.get(ite.coerce(a),"version")||a;this.sequelize.options.databaseVersion=ite.valid(s)?s:this.dialect.defaultVersion}return ite.lt(this.sequelize.options.databaseVersion,this.dialect.defaultVersion)&&(Idr.unsupportedEngine(),bp(`Unsupported database engine version ${this.sequelize.options.databaseVersion}`)),this.versionPromise=null,await this._disconnect(i)}catch(i){throw this.versionPromise=null,i}})()),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(i){throw i instanceof Ndr?new vdr.ConnectionAcquireTimeoutError(i):i}return bp("connection acquired"),r}releaseConnection(e){this.pool.release(e),bp("connection released")}async destroyConnection(e){await this.pool.destroy(e),bp(`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}};ok.exports=q4;ok.exports.ConnectionManager=q4;ok.exports.default=q4});var iu=O((Eei,A8e)=>{"use strict";var C4=new Map;A8e.exports=t=>(C4.has(t)||C4.set(t,new Map),{clear(){C4.get(t).clear()},refresh(e){for(let r of e.types[t])C4.get(t).set(r,e.parse)},get(e){return C4.get(t).get(e)}})});var M8e=O((yei,uk)=>{"use strict";var Sdr=Object.defineProperty,m8e=Object.getOwnPropertySymbols,qdr=Object.prototype.hasOwnProperty,Cdr=Object.prototype.propertyIsEnumerable,O8e=(t,e,r)=>e in t?Sdr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,xdr=(t,e)=>{for(var r in e||(e={}))qdr.call(e,r)&&O8e(t,r,e[r]);if(m8e)for(var r of m8e(e))Cdr.call(e,r)&&O8e(t,r,e[r]);return t},Ldr=Zf(),kdr=ed(),fM=fi(),{logger:Ddr}=Bn(),Bdr=ri().mariadb,Pdr=up(),g8e=Ddr.debugContext("connection:mariadb"),ck=iu()("mariadb"),x4=class t extends kdr{constructor(e,r){r.config.port=r.config.port||3306,super(e,r),this.lib=this._loadDialectModule("mariadb"),this.refreshTypeParser(Bdr)}static _typecast(e,r){return ck.get(e.type)?ck.get(e.type)(e,this.sequelize.options,r):r()}_refreshTypeParser(e){ck.refresh(e)}_clearTypeParser(){ck.clear()}async connect(e){let r=this.sequelize.options.timezone;r=/\//.test(r)?Pdr.tz(r).format("Z"):r;let i=xdr({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||(i.initSql?(Array.isArray(i.initSql)||(i.initSql=[i.initSql]),i.initSql.push(`SET time_zone = '${r}'`)):i.initSql=`SET time_zone = '${r}'`);try{let n=await this.lib.createConnection(i);return this.sequelize.options.databaseVersion=Ldr.coerce(n.serverVersion()).version,g8e("connection acquired"),n.on("error",a=>{switch(a.code){case"ESOCKET":case"ECONNRESET":case"EPIPE":case"PROTOCOL_CONNECTION_LOST":this.pool.destroy(n)}}),n}catch(n){switch(n.code){case"ECONNREFUSED":throw new fM.ConnectionRefusedError(n);case"ER_ACCESS_DENIED_ERROR":case"ER_ACCESS_DENIED_NO_PASSWORD_ERROR":throw new fM.AccessDeniedError(n);case"ENOTFOUND":throw new fM.HostNotFoundError(n);case"EHOSTUNREACH":case"ENETUNREACH":case"EADDRNOTAVAIL":throw new fM.HostNotReachableError(n);case"EINVAL":throw new fM.InvalidConnectionError(n);default:throw new fM.ConnectionError(n)}}}async disconnect(e){if(!e.isValid()){g8e("connection tried to disconnect but was already at CLOSED state");return}return await e.end()}validate(e){return e&&e.isValid()}};uk.exports=x4;uk.exports.ConnectionManager=x4;uk.exports.default=x4});var td=O((zei,lk)=>{"use strict";var Wdr=Object.defineProperty,E8e=Object.getOwnPropertySymbols,Udr=Object.prototype.hasOwnProperty,Fdr=Object.prototype.propertyIsEnumerable,y8e=(t,e,r)=>e in t?Wdr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,jdr=(t,e)=>{for(var r in e||(e={}))Udr.call(e,r)&&y8e(t,r,e[r]);if(E8e)for(var r of E8e(e))Fdr.call(e,r)&&y8e(t,r,e[r]);return t},ub=fr(),Gdr=a4(),hc=yo(),Hdr=gL(),Qdr=cM(),Vdr=(rM(),Yl(tM)).v4,{safeStringifyJson:z8e}=wi(),L4=class t{constructor(e,r,i){this.uuid=Vdr(),this.connection=e,this.instance=i.instance,this.model=i.model,this.sequelize=r,this.options=jdr({plain:!1,raw:!1,logging:console.log},i),this.checkLoggingOption(),i.rawErrors&&(this.formatError=t.prototype.formatError)}static formatBindParameters(e,r,i,n,a){if(!r)return[e,[]];if(a=a||{},typeof n!="function"&&(a=n||{},n=void 0),!n)a.skipValueReplace?n=(c,l,p)=>{if(p[l]!==void 0)return c}:n=(c,l,p,f,d)=>{if(p[l]!==void 0)return Gdr.escape(p[l],f,d)};else if(a.skipValueReplace){let c=n;n=(l,p,f,d,h,_)=>{if(c(l,p,f,d,h,_)!==void 0)return l}}let s=null,o=Array.isArray(r);return e=e.replace(/\B\$(\$|\w+)/g,(c,l)=>{if(l==="$")return a.skipUnescape?c:l;let p;if(o?l.match(/^[1-9]\d*$/)&&(l=l-1,p=n(c,l,r,s,i,a)):l.match(/^\d*$/)||(p=n(c,l,r,s,i,a)),p===void 0)throw new Error(`Named bind parameter "${c}" 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&&(Qdr.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 i of Object.keys(this.model.uniqueKeys))this.model.uniqueKeys[i].fields.includes(e.replace(/"/g,""))&&this.model.uniqueKeys[i].msg&&(r=this.model.uniqueKeys[i].msg);return r}isRawQuery(){return this.options.type===hc.RAW}isVersionQuery(){return this.options.type===hc.VERSION}isUpsertQuery(){return this.options.type===hc.UPSERT}isInsertQuery(e,r){let i=!0;return this.options.type===hc.INSERT?!0:(i=i&&this.sql.toLowerCase().startsWith("insert into"),i=i&&(!e||Object.prototype.hasOwnProperty.call(e,this.getInsertIdField())),i=i&&(!r||Object.prototype.hasOwnProperty.call(r,this.getInsertIdField())),i)}handleInsertQuery(e,r){if(this.instance){let i=this.model.autoIncrementAttribute,n=null;n=n||e&&e[this.getInsertIdField()],n=n||r&&r[this.getInsertIdField()],this.instance[i]=n}}isShowTablesQuery(){return this.options.type===hc.SHOWTABLES}handleShowTablesQuery(e){return ub.flatten(e.map(r=>Object.values(r)))}isShowIndexesQuery(){return this.options.type===hc.SHOWINDEXES}isShowConstraintsQuery(){return this.options.type===hc.SHOWCONSTRAINTS}isDescribeQuery(){return this.options.type===hc.DESCRIBE}isSelectQuery(){return this.options.type===hc.SELECT}isBulkUpdateQuery(){return this.options.type===hc.BULKUPDATE}isBulkDeleteQuery(){return this.options.type===hc.BULKDELETE}isForeignKeysQuery(){return this.options.type===hc.FOREIGNKEYS}isUpdateQuery(){return this.options.type===hc.UPDATE}handleSelectQuery(e){let r=null;if(this.options.fieldMap){let i=this.options.fieldMap;e=e.map(n=>ub.reduce(i,(a,s,o)=>(a[o]!==void 0&&s!==o&&(a[s]=a[o],delete a[o]),a),n))}return this.options.raw?r=e.map(i=>{let n={};for(let a in i)Object.prototype.hasOwnProperty.call(i,a)&&(n[a]=i[a]);return this.options.nest&&(n=Hdr.transform(n)),n}):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,i){let{connection:n,options:a}=this,s=this.sequelize.options.benchmark||a.benchmark,o=this.sequelize.options.logQueryParameters||a.logQueryParameters,c=Date.now(),l="";if(o&&i){let d=e.endsWith(";")?"":";",h;Array.isArray(i)?h=i.map(_=>z8e(_)).join(", "):h=z8e(i),l=`${d} ${h}`}let p=`(${n.uuid||"default"}): ${e}${l}`,f=`Executing ${p}`;return r(f),s||this.sequelize.log(`Executing ${p}`,a),()=>{let d=`Executed ${p}`;r(d),s&&this.sequelize.log(d,Date.now()-c,a)}}static _groupJoinData(e,r,i){if(!e.length)return[];let n,a,s,o,c,l,p=e.length,f,d,h,_,m,E,R,N,T=i.checkExisting,I,W,D,F=T?[]:new Array(p),x={},H={},$,k,oe,j,B,V,X,_e,he=se=>{Object.prototype.hasOwnProperty.call(V.includeMap,se)&&(H[d]=V=V.includeMap[se],_e?_e=`${_e}.${se}`:_e=se,H[_e]=V)},ce={},Re=(se,Ee)=>(Object.prototype.hasOwnProperty.call(Ee,se)||(Ee[se]=se.substr(0,se.lastIndexOf("."))),Ee[se]),Te={},Ce=se=>{if(!Object.prototype.hasOwnProperty.call(Te,se)){let Ee=se.lastIndexOf(".");Te[se]=se.substr(Ee===-1?0:Ee+1)}return Te[se]},te={},de=se=>{if(!Object.prototype.hasOwnProperty.call(te,se)){let Ee=Re(se,ce);Object.prototype.hasOwnProperty.call(te,Ee)||(te[Ee]=Ee?Ee.split("."):[]),te[se]=te[Ee]}return te[se]},ze={},Oe=se=>{if(!Object.prototype.hasOwnProperty.call(ze,se)){let Ee=de(se),Ie=Ee.length;ze[se]=Ie?Ee[Ie-1]:""}return ze[se]},ke=se=>{let Ee=ub.chain(se.uniqueKeys);return Ee=Ee.result(`${Ee.findKey()}.fields`).map(Ie=>ub.findKey(se.attributes,Pe=>Pe.field===Ie)).value(),Ee},$e=se=>se instanceof Buffer?se.toString("hex"):se,Se,nt,xe;for(c=0;c<p;c++){if(l=e[c],c===0&&(f=ub.sortBy(Object.keys(l),se=>[se.split(".").length]),_=f.length),T){if(N=!1,o=r.model.primaryKeyAttributes.length,D="",o===1)D=$e(l[r.model.primaryKeyAttributes[0]]);else if(o>1)for(s=0;s<o;s++)D+=$e(l[r.model.primaryKeyAttributes[s]]);else if(!ub.isEmpty(r.model.uniqueKeys))for(nt=ke(r.model),s=0;s<nt.length;s++)D+=l[nt[s]]}for(R=E={},j=void 0,h=0;h<_;h++){if(d=f[h],k=Re(d,ce),$=de(d),c===0&&!Object.prototype.hasOwnProperty.call(H,d)&&($.length?(V=r,_e=void 0,$.forEach(he)):H[d]=H[""]=r),j!==void 0&&j!==$){if(T){if(a=j.length,X=null,W=null,a)for(n=0;n<a;n++){if(xe=X?`${X}.${j[n]}`:j[n],Se=H[xe].model.primaryKeyAttributes,o=Se.length,I=xe,o===1)I+=$e(l[`${xe}.${Se[0]}`]);else if(o>1)for(s=0;s<o;s++)I+=$e(l[`${xe}.${Se[s]}`]);else if(!ub.isEmpty(H[xe].model.uniqueKeys))for(nt=ke(H[xe].model),s=0;s<nt.length;s++)I+=l[`${xe}.${nt[s]}`];W||(W=D),I=W+I,X=xe,n<a-1&&(W=I)}else I=D;I===D?x[I]?N=!0:x[I]=E:x[I]||(X=x[W],B=Oe(m),H[m].association.isSingleAssociation?X&&(X[B]=x[I]=E):(X[B]||(X[B]=[]),X[B].push(x[I]=E))),E={}}else if(V=R,a=$.length,a)for(n=0;n<a;n++)n===a-1&&(E=V[$[n]]={}),V=V[$[n]]||{}}E[Ce(d)]=l[d],m=d,j=$,oe=k}if(T){if(a=j.length,X=null,W=null,a)for(n=0;n<a;n++){if(xe=X?`${X}.${j[n]}`:j[n],Se=H[xe].model.primaryKeyAttributes,o=Se.length,I=xe,o===1)I+=$e(l[`${xe}.${Se[0]}`]);else if(o>0)for(s=0;s<o;s++)I+=$e(l[`${xe}.${Se[s]}`]);else if(!ub.isEmpty(H[xe].model.uniqueKeys))for(nt=ke(H[xe].model),s=0;s<nt.length;s++)I+=l[`${xe}.${nt[s]}`];W||(W=D),I=W+I,X=xe,n<a-1&&(W=I)}else I=D;I===D?x[I]?N=!0:x[I]=E:x[I]||(X=x[W],B=Oe(m),H[m].association.isSingleAssociation?X&&(X[B]=x[I]=E):(X[B]||(X[B]=[]),X[B].push(x[I]=E))),N||F.push(R)}else F[c]=R}return F}};lk.exports=L4;lk.exports.AbstractQuery=L4;lk.exports.default=L4});var q8e=O((Rei,S8e)=>{"use strict";var Ydr=Object.defineProperty,R8e=Object.getOwnPropertySymbols,Xdr=Object.prototype.hasOwnProperty,Kdr=Object.prototype.propertyIsEnumerable,w8e=(t,e,r)=>e in t?Ydr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,$dr=(t,e)=>{for(var r in e||(e={}))Xdr.call(e,r)&&w8e(t,r,e[r]);if(R8e)for(var r of R8e(e))Kdr.call(e,r)&&w8e(t,r,e[r]);return t},N8e=td(),pk=fi(),v8e=fr(),nte=ri(),{logger:Jdr}=Bn(),Zdr=1062,ehr=1213,T8e=1451,thr=1452,I8e=Jdr.debugContext("sql:mariadb"),ate=class extends N8e{constructor(e,r,i){super(e,r,$dr({showWarnings:!1},i))}static formatBindParameters(e,r,i){let n=[],a=(s,o,c)=>{if(c[o]!==void 0)return n.push(c[o]),"?"};return e=N8e.formatBindParameters(e,r,i,a)[0],[e,n.length>0?n:void 0]}async run(e,r){this.sql=e;let{connection:i,options:n}=this,a=this.sequelize.options.showWarnings||n.showWarnings,s=this._logQuery(e,I8e,r);r&&I8e("parameters(%j)",r);let o,c=new Error;try{o=await i.query(this.sql,r)}catch(l){if(n.transaction&&l.errno===ehr){try{await n.transaction.rollback()}catch{}n.transaction.finished="rollback"}throw l.sql=e,l.parameters=r,this.formatError(l,c.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 i=e[this.getInsertIdField()];r=new Array(e.affectedRows);let n=this.model.rawAttributes[this.model.primaryKeyAttribute].field;for(let a=0;a<e.affectedRows;a++)r[a]={[n]:i+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 i=e.meta;return delete e.meta,[e,i]}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 i of e)r[i.Field]={type:i.Type.toLowerCase().startsWith("enum")?i.Type.replace(/^enum/i,"ENUM"):i.Type.toUpperCase(),allowNull:i.Null==="YES",defaultValue:i.Default,primaryKey:i.Key==="PRI",autoIncrement:Object.prototype.hasOwnProperty.call(i,"Extra")&&i.Extra.toLowerCase()==="auto_increment",comment:i.Comment?i.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 i=this.model.fieldRawAttributesMap[r];i.type instanceof nte.JSON&&(e=e.map(n=>(n[i.fieldName]&&typeof n[i.fieldName]=="string"&&!this.connection.info.hasMinVersion(10,5,2)&&(n[i.fieldName]=JSON.parse(n[i.fieldName])),nte.JSON.parse?nte.JSON.parse(i,this.sequelize.options,n[i.fieldName]):n)))}}async logWarnings(e){let r=await this.run("SHOW WARNINGS"),i=`MariaDB Warnings (${this.connection.uuid||"default"}): `,n=[];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"))n.push(s.Message);else for(let o of s.keys())n.push([o,s[o]].join(": "));return this.sequelize.log(i+n.join("; "),this.options),e}formatError(e,r){switch(e.errno){case Zdr:{let i=e.message.match(/Duplicate entry '([\s\S]*)' for key '?((.|\s)*?)'?\s.*$/),n={},a="Validation error",s=i?i[1].split("-"):void 0,o=i?i[2]:void 0,c=i?i[1]:void 0,l=this.model&&this.model.uniqueKeys[o];l?(l.msg&&(a=l.msg),n=v8e.zipObject(l.fields,s)):n[o]=c;let p=[];return v8e.forOwn(n,(f,d)=>{p.push(new pk.ValidationErrorItem(this.getUniqueConstraintErrorMessage(d),"unique violation",d,f,this.instance,"not_unique"))}),new pk.UniqueConstraintError({message:a,errors:p,parent:e,fields:n,stack:r})}case T8e:case thr:{let i=e.message.match(/CONSTRAINT ([`"])(.*)\1 FOREIGN KEY \(\1(.*)\1\) REFERENCES \1(.*)\1 \(\1(.*)\1\)/),n=i?i[1]:"`",a=i?i[3].split(new RegExp(`${n}, *${n}`)):void 0;return new pk.ForeignKeyConstraintError({reltype:e.errno===T8e?"parent":"child",table:i?i[4]:void 0,fields:a,value:a&&a.length&&this.instance&&this.instance[a[0]]||void 0,index:i?i[2]:void 0,parent:e,stack:r})}default:return new pk.DatabaseError(e,{stack:r})}}handleShowTablesQuery(e){return e.map(r=>({tableName:r.TABLE_NAME,schema:r.TABLE_SCHEMA}))}handleShowIndexesQuery(e){let r,i=[];return e.forEach(n=>{(!r||r.name!==n.Key_name)&&(r={primary:n.Key_name==="PRIMARY",fields:[],name:n.Key_name,tableName:n.Table,unique:n.Non_unique!==1,type:n.Index_type},i.push(r)),r.fields[n.Seq_in_index-1]={attribute:n.Column_name,length:n.Sub_part||void 0,order:n.Collation==="A"?"ASC":void 0}}),i}};S8e.exports=ate});var k8e=O((wei,L8e)=>{"use strict";var rhr=Object.defineProperty,C8e=Object.getOwnPropertySymbols,ihr=Object.prototype.hasOwnProperty,nhr=Object.prototype.propertyIsEnumerable,x8e=(t,e,r)=>e in t?rhr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,ahr=(t,e)=>{for(var r in e||(e={}))ihr.call(e,r)&&x8e(t,r,e[r]);if(C8e)for(var r of C8e(e))nhr.call(e,r)&&x8e(t,r,e[r]);return t},fk=fr(),a0=Hs(),shr=wi(),ohr={OperatorMap:{[a0.eq]:"=",[a0.ne]:"!=",[a0.gte]:">=",[a0.gt]:">",[a0.lte]:"<=",[a0.lt]:"<",[a0.not]:"IS NOT",[a0.is]:"IS",[a0.in]:"IN",[a0.notIn]:"NOT IN",[a0.like]:"LIKE",[a0.notLike]:"NOT LIKE",[a0.iLike]:"ILIKE",[a0.notILike]:"NOT ILIKE",[a0.startsWith]:"LIKE",[a0.endsWith]:"LIKE",[a0.substring]:"LIKE",[a0.regexp]:"~",[a0.notRegexp]:"!~",[a0.iRegexp]:"~*",[a0.notIRegexp]:"!~*",[a0.between]:"BETWEEN",[a0.notBetween]:"NOT BETWEEN",[a0.overlap]:"&&",[a0.contains]:"@>",[a0.contained]:"<@",[a0.adjacent]:"-|-",[a0.strictLeft]:"<<",[a0.strictRight]:">>",[a0.noExtendRight]:"&<",[a0.noExtendLeft]:"&>",[a0.any]:"ANY",[a0.all]:"ALL",[a0.and]:" AND ",[a0.or]:" OR ",[a0.col]:"COL",[a0.placeholder]:"$$PLACEHOLDER$$",[a0.match]:"@@"},OperatorsAliasMap:{},setOperatorsAliases(t){!t||fk.isEmpty(t)?this.OperatorsAliasMap=!1:this.OperatorsAliasMap=ahr({},t)},_replaceAliases(t){let e={};return this.OperatorsAliasMap?(shr.getOperators(t).forEach(r=>{let i=t[r];fk.isPlainObject(i)?e[r]=this._replaceAliases(i):e[r]=i}),fk.forOwn(t,(r,i)=>{i=this.OperatorsAliasMap[i]||i,fk.isPlainObject(r)&&(r=this._replaceAliases(r)),e[i]=r}),e):t}};L8e.exports=ohr});var B8e=O((Nei,D8e)=>{"use strict";var chr=(rM(),Yl(tM)).v4,uhr={setIsolationLevelQuery(t,e){if(!e.parent)return`SET TRANSACTION ISOLATION LEVEL ${t};`},generateTransactionId(){return chr()},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;"}};D8e.exports=uhr});var lb=O((Tei,j8e)=>{"use strict";var lhr=Object.defineProperty,phr=Object.defineProperties,fhr=Object.getOwnPropertyDescriptors,P8e=Object.getOwnPropertySymbols,dhr=Object.prototype.hasOwnProperty,hhr=Object.prototype.propertyIsEnumerable,W8e=(t,e,r)=>e in t?lhr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,hA=(t,e)=>{for(var r in e||(e={}))dhr.call(e,r)&&W8e(t,r,e[r]);if(P8e)for(var r of P8e(e))hhr.call(e,r)&&W8e(t,r,e[r]);return t},dk=(t,e)=>phr(t,fhr(e)),hk=require("util"),Zr=fr(),bhr=(rM(),Yl(tM)).v4,Wt=wi(),vei=cM(),U8e=a4(),dM=ri(),Zu=Aee(),hM=nb(),ste=ab(),_hr=aM(),Ahr=cA(),Nt=Hs(),ote=fi(),F8e=Nee(),mhr=new Set(["integer","int","smallint","bigint","float","real","double precision","decimal","numeric","boolean","text","char","varchar","nvarchar","date","timestamp","timestamptz","datetime","json","jsonb","signed","unsigned"]),k4=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:Zr.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,i){return`DESCRIBE ${this.quoteTable(this.addSchema({tableName:e,_schema:r,_schemaDelimiter:i}))};`}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,i,n){n=n||{},Zr.defaults(n,this.options);let a={},s=n.bind||[],o=[],c=[],l=[],p=[],f=this.quoteTable(e),d=n.bindParam===void 0?this.bindParam(s):n.bindParam,h=[],_,m="",E="",R="",N="",T=!1,I="";if(i&&Zr.each(i,(x,H)=>{a[H]=x,x.field&&(a[x.field]=x)}),this._dialect.supports["DEFAULT VALUES"]?E+=" DEFAULT VALUES":this._dialect.supports["VALUES ()"]&&(E+=" VALUES ()"),(this._dialect.supports.returnValues||this._dialect.supports.returnIntoValues)&&n.returning){let x=this.generateReturnValues(i,n);c.push(...x.returnFields),this._dialect.supports.returnIntoValues&&l.push(...x.returnTypes),N=x.returningFragment,I=x.tmpTable||"",R=x.outputFragment||""}(Zr.get(this,["sequelize","options","dialectOptions","prependSearchPath"])||n.searchPath)&&(n.bindParam=!1),this._dialect.supports.EXCEPTION&&n.exception&&(n.bindParam=!1),r=Wt.removeNullValuesFromHash(r,this.options.omitNull);for(let x in r)if(Object.prototype.hasOwnProperty.call(r,x)){let H=r[x];o.push(this.quoteIdentifier(x)),a&&a[x]&&a[x].autoIncrement===!0&&H==null?this._dialect.supports.autoIncrement.defaultValue?this._dialect.supports.DEFAULT?p.push("DEFAULT"):p.push(this.escape(null)):o.splice(-1,1):(a&&a[x]&&a[x].autoIncrement===!0&&(T=!0),H instanceof Wt.SequelizeMethod||n.bindParam===!1?p.push(this.escape(H,a&&a[x]||void 0,{context:"INSERT"})):p.push(this.format(H,a&&a[x]||void 0,{context:"INSERT"},d)))}let W="";if(!Zr.isEmpty(n.conflictWhere)&&!this._dialect.supports.inserts.onConflictWhere)throw new Error("missing dialect support for conflictWhere option");if(this._dialect.supports.inserts.updateOnDuplicate&&n.updateOnDuplicate)if(this._dialect.supports.inserts.updateOnDuplicate==" ON CONFLICT DO UPDATE SET"){let x=n.upsertKeys.map(k=>this.quoteIdentifier(k)),H=n.updateOnDuplicate.map(k=>`${this.quoteIdentifier(k)}=EXCLUDED.${this.quoteIdentifier(k)}`),$=["ON CONFLICT","(",x.join(","),")"];Zr.isEmpty(n.conflictWhere)||$.push(this.whereQuery(n.conflictWhere,n)),Zr.isEmpty(H)?$.push("DO NOTHING"):$.push("DO UPDATE SET",H.join(",")),W=` ${Wt.joinSQLFragments($)}`}else{let x=n.updateOnDuplicate.map(H=>`${this.quoteIdentifier(H)}=VALUES(${this.quoteIdentifier(H)})`);if(Zr.isEmpty(x)&&n.upsertKeys&&x.push(...n.upsertKeys.map(H=>`${this.quoteIdentifier(H)}=${this.quoteIdentifier(H)}`)),Zr.isEmpty(x))throw new Error("No update values found for ON DUPLICATE KEY UPDATE clause, and no identifier fields could be found to use instead.");W+=`${this._dialect.supports.inserts.updateOnDuplicate} ${x.join(",")}`}let D={ignoreDuplicates:n.ignoreDuplicates?this._dialect.supports.inserts.ignoreDuplicates:"",onConflictDoNothing:n.ignoreDuplicates?this._dialect.supports.inserts.onConflictDoNothing:"",attributes:o.join(","),output:R,values:p.join(","),tmpTable:I};if(m=`${I}INSERT${D.ignoreDuplicates} INTO ${f} (${D.attributes})${D.output} VALUES (${D.values})${W}${D.onConflictDoNothing}${m}`,E=`${I}INSERT${D.ignoreDuplicates} INTO ${f}${D.output}${W}${D.onConflictDoNothing}${E}`,this._dialect.supports.EXCEPTION&&n.exception){let x="DROP FUNCTION IF EXISTS pg_temp.testfunc()";c.length===0&&c.push("*");let H=`$func_${bhr().replace(/-/g,"")}$`,$=`SELECT (testfunc.response).${c.join(", (testfunc.response).")}, testfunc.sequelize_caught_exception FROM pg_temp.testfunc();`;n.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 ${H} BEGIN ${m} RETURNING * INTO response; EXCEPTION ${n.exception} END ${H} LANGUAGE plpgsql; ${$} ${x}`}else m+=N,E+=N;this._dialect.supports.returnIntoValues&&n.returning&&this.populateInsertQueryReturnIntoBinds(c,l,s.length,h,n),_=`${D.attributes.length?m:E}${h.join(",")};`,this._dialect.supports.finalTable&&(_=`SELECT * FROM FINAL TABLE(${D.attributes.length?m:E});`),T&&this._dialect.supports.autoIncrement.identityInsert&&(_=`SET IDENTITY_INSERT ${f} ON; ${_} SET IDENTITY_INSERT ${f} OFF;`);let F={query:_};return n.bindParam!==!1&&(F.bind=s),F}bulkInsertQuery(e,r,i,n){i=i||{},n=n||{};let a=[],s={},o=[],c="";for(let h of r)Zr.forOwn(h,(_,m)=>{o.includes(m)||o.push(m),n[m]&&n[m].autoIncrement===!0&&(s[m]=!0)});for(let h of r){let _=o.map(m=>this._dialect.supports.bulkDefault&&s[m]===!0?h[m]!=null?h[m]:"DEFAULT":this.escape(h[m],n[m],{context:"INSERT"}));a.push(`(${_.join(",")})`)}if(this._dialect.supports.inserts.updateOnDuplicate&&i.updateOnDuplicate)if(this._dialect.supports.inserts.updateOnDuplicate==" ON CONFLICT DO UPDATE SET"){let h=i.upsertKeys.map(E=>this.quoteIdentifier(E)),_=i.updateOnDuplicate.map(E=>`${this.quoteIdentifier(E)}=EXCLUDED.${this.quoteIdentifier(E)}`),m=!1;if(i.conflictWhere){if(!this._dialect.supports.inserts.onConflictWhere)throw new Error(`conflictWhere not supported for dialect ${this._dialect.name}`);m=this.whereQuery(i.conflictWhere,i)}c=["ON CONFLICT","(",h.join(","),")",m,"DO UPDATE SET",_.join(",")]}else{if(i.conflictWhere)throw new Error(`conflictWhere not supported for dialect ${this._dialect.name}`);let h=i.updateOnDuplicate.map(_=>`${this.quoteIdentifier(_)}=VALUES(${this.quoteIdentifier(_)})`);c=`${this._dialect.supports.inserts.updateOnDuplicate} ${h.join(",")}`}let l=i.ignoreDuplicates?this._dialect.supports.inserts.ignoreDuplicates:"",p=o.map(h=>this.quoteIdentifier(h)).join(","),f=i.ignoreDuplicates?this._dialect.supports.inserts.onConflictDoNothing:"",d="";if(this._dialect.supports.returnValues&&i.returning){let h=this.generateReturnValues(n,i);d+=h.returningFragment}return Wt.joinSQLFragments(["INSERT",l,"INTO",this.quoteTable(e),`(${p})`,"VALUES",a.join(","),c,f,d,";"])}updateQuery(e,r,i,n,a){n=n||{},Zr.defaults(n,this.options),r=Wt.removeNullValuesFromHash(r,n.omitNull,n);let s=[],o=[],c={},l="",p="",f="";(Zr.get(this,["sequelize","options","dialectOptions","prependSearchPath"])||n.searchPath)&&(n.bindParam=!1);let d=n.bindParam===void 0?this.bindParam(o):n.bindParam;if(this._dialect.supports["LIMIT ON UPDATE"]&&n.limit&&(["mssql","db2","oracle"].includes(this.dialect)?this.dialect==="oracle"&&(i&&(i.length&&i.length>0||Object.keys(i).length>0)?f+=" AND ":f+=" WHERE ",f+=`rownum <= ${this.escape(n.limit)} `):f=` LIMIT ${this.escape(n.limit)} `),this._dialect.supports.returnValues&&n.returning){let E=this.generateReturnValues(a,n);f+=E.returningFragment,p=E.tmpTable||"",l=E.outputFragment||"",!this._dialect.supports.returnValues.output&&n.returning&&(n.mapToModel=!0)}a&&Zr.each(a,(E,R)=>{c[R]=E,E.field&&(c[E.field]=E)});for(let E in r){if(c&&c[E]&&c[E].autoIncrement===!0&&!this._dialect.supports.autoIncrement.update)continue;let R=r[E];R instanceof Wt.SequelizeMethod||n.bindParam===!1?s.push(`${this.quoteIdentifier(E)}=${this.escape(R,c&&c[E]||void 0,{context:"UPDATE"})}`):s.push(`${this.quoteIdentifier(E)}=${this.format(R,c&&c[E]||void 0,{context:"UPDATE"},d)}`)}let h=dk(hA({},n),{bindParam:d});if(s.length===0)return"";let m={query:`${p}UPDATE ${this.quoteTable(e)} SET ${s.join(",")}${l} ${this.whereQuery(i,h)}${f}`.trim()};return n.bindParam!==!1&&(m.bind=o),m}arithmeticQuery(e,r,i,n,a,s){s=s||{},Zr.defaults(s,{returning:!0}),a=Wt.removeNullValuesFromHash(a,this.options.omitNull);let o="",c="";if(this._dialect.supports.returnValues&&s.returning){let p=this.generateReturnValues(null,s);o=p.outputFragment,c=p.returningFragment}let l=[];for(let p in n){let f=n[p],d=this.quoteIdentifier(p),h=this.escape(f);l.push(`${d}=${d}${e} ${h}`)}for(let p in a){let f=a[p],d=this.quoteIdentifier(p),h=this.escape(f);l.push(`${d}=${h}`)}return Wt.joinSQLFragments(["UPDATE",this.quoteTable(r),"SET",l.join(","),o,this.whereQuery(i),c])}addIndexQuery(e,r,i,n){i=i||{},Array.isArray(r)?i.fields=r:(i=r,r=void 0),i.prefix=i.prefix||n||e,i.prefix&&typeof i.prefix=="string"&&(i.prefix=i.prefix.replace(/\./g,"_"),i.prefix=i.prefix.replace(/("|')/g,""));let a=i.fields.map(c=>{if(c instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(c);typeof c=="string"&&(c={name:c});let l="";if(c.attribute&&(c.name=c.attribute),!c.name)throw new Error(`The following index field has no name: ${hk.inspect(c)}`);if(l+=this.quoteIdentifier(c.name),this._dialect.supports.index.collate&&c.collate&&(l+=` COLLATE ${this.quoteIdentifier(c.collate)}`),this._dialect.supports.index.operator){let p=c.operator||i.operator;p&&(l+=` ${p}`)}return this._dialect.supports.index.length&&c.length&&(l+=`(${c.length})`),c.order&&(l+=` ${c.order}`),l});i.name||(i=Wt.nameIndex(i,i.prefix)),i=Zu._conformIndex(i),this._dialect.supports.index.type||delete i.type,i.where&&(i.where=this.whereQuery(i.where)),typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e);let s=this._dialect.supports.index.concurrently&&i.concurrently?"CONCURRENTLY":void 0,o;return this._dialect.supports.indexViaAlter?o=["ALTER TABLE",e,s,"ADD"]:o=["CREATE"],o=o.concat(i.unique?"UNIQUE":"",i.type,"INDEX",this._dialect.supports.indexViaAlter?void 0:s,this.quoteIdentifiers(i.name),this._dialect.supports.index.using===1&&i.using?`USING ${i.using}`:"",this._dialect.supports.indexViaAlter?void 0:`ON ${e}`,this._dialect.supports.index.using===2&&i.using?`USING ${i.using}`:"",`(${a.join(", ")})`,this._dialect.supports.index.parser&&i.parser?`WITH PARSER ${i.parser}`:void 0,this._dialect.supports.index.where&&i.where?i.where:void 0),Zr.compact(o).join(" ")}addConstraintQuery(e,r){return typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e),Wt.joinSQLFragments(["ALTER TABLE",e,"ADD",this.getConstraintSnippet(e,r||{}),";"])}getConstraintSnippet(e,r){let i,n,a=r.fields.map(c=>{if(typeof c=="string")return this.quoteIdentifier(c);if(c instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(c);if(c.attribute&&(c.name=c.attribute),!c.name)throw new Error(`The following index field has no name: ${c}`);return this.quoteIdentifier(c.name)}),s=a.join(", "),o=a.join("_");switch(r.type.toUpperCase()){case"UNIQUE":n=this.quoteIdentifier(r.name||`${e}_${o}_uk`),i=`CONSTRAINT ${n} UNIQUE (${s})`;break;case"CHECK":r.where=this.whereItemsQuery(r.where),n=this.quoteIdentifier(r.name||`${e}_${o}_ck`),i=`CONSTRAINT ${n} 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.");n=this.quoteIdentifier(r.name||`${e}_${o}_df`),i=`CONSTRAINT ${n} DEFAULT (${this.escape(r.defaultValue)}) FOR ${a[0]}`;break;case"PRIMARY KEY":n=this.quoteIdentifier(r.name||`${e}_${o}_pk`),i=`CONSTRAINT ${n} PRIMARY KEY (${s})`;break;case"FOREIGN KEY":let c=r.references;if(!c||!c.table||!(c.field||c.fields))throw new Error("references object with table and field must be specified");n=this.quoteIdentifier(r.name||`${e}_${o}_${c.table}_fk`);let l=typeof c.field<"u"?this.quoteIdentifier(c.field):c.fields.map(f=>this.quoteIdentifier(f)).join(", "),p=`${this.quoteTable(c.table)} (${l})`;i=`CONSTRAINT ${n} `,i+=`FOREIGN KEY (${s}) REFERENCES ${p}`,r.onUpdate&&(i+=` ON UPDATE ${r.onUpdate.toUpperCase()}`),r.onDelete&&(i+=` 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())&&(i+=` ${this.deferConstraintsQuery(r)}`),i}removeConstraintQuery(e,r){return typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e),Wt.joinSQLFragments(["ALTER TABLE",e,"DROP CONSTRAINT",this.quoteIdentifiers(r)])}quote(e,r,i){let n=["ASC","DESC","ASC NULLS LAST","DESC NULLS LAST","ASC NULLS FIRST","DESC NULLS FIRST","NULLS FIRST","NULLS LAST"];if(i=i||".",typeof e=="string")return this.quoteIdentifiers(e);if(Array.isArray(e)){e.forEach((p,f)=>{let d=e[f-1],h,_;if(!d&&r!==void 0?_=r:d&&d instanceof hM&&(h=d,_=d.target),_&&_.prototype instanceof Zu){let m,E;if(typeof p=="function"&&p.prototype instanceof Zu?m=p:Zr.isPlainObject(p)&&p.model&&p.model.prototype instanceof Zu&&(m=p.model,E=p.as),m&&(!E&&h&&h instanceof hM&&h.through&&h.through.model===m?p=new hM(_,m,{as:m.name}):(p=_.getAssociationForAlias(m,E),p||(p=_.getAssociationForAlias(m,m.name))),!(p instanceof hM)))throw new Error(hk.format("Unable to find a valid association for model, '%s'",m.name))}if(typeof p=="string"){let m=n.indexOf(p.toUpperCase());if(f>0&&m!==-1)p=this.sequelize.literal(` ${n[m]}`);else if(_&&_.prototype instanceof Zu){if(_.associations!==void 0&&_.associations[p])p=_.associations[p];else if(_.rawAttributes!==void 0&&_.rawAttributes[p]&&p!==_.rawAttributes[p].field)p=_.rawAttributes[p].field;else if(p.includes(".")&&_.rawAttributes!==void 0){let E=p.split(".");if(_.rawAttributes[E[0]].type instanceof dM.JSON){let R=this.quoteIdentifiers(`${_.name}.${_.rawAttributes[E[0]].field}`),N=E.slice(1);p=this.jsonPathExtractionQuery(R,N),p=this.sequelize.literal(p)}}}}e[f]=p},this);let a=e.length,s=[],o,c=0;for(c=0;c<a-1&&(o=e[c],!(typeof o=="string"||o._modelAttribute||o instanceof Wt.SequelizeMethod));c++)o instanceof hM&&(s[c]=o.as);let l="";return c>0?l+=`${this.quoteIdentifier(s.join(i))}.`:typeof e[0]=="string"&&r&&(l+=`${this.quoteIdentifier(r.name)}.`),e.slice(c).forEach(p=>{l+=this.quote(p,r,i)},this),l}if(e._modelAttribute)return`${this.quoteTable(e.Model.name)}.${this.quoteIdentifier(e.fieldName)}`;if(e instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(e);throw Zr.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: ${hk.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("->"),i=e[e.length-1];return`${this.quoteIdentifier(r)}.${this.quoteIdentifier(i)}`}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 i="";return r===!0&&(r=e.as||e.name||e),Zr.isObject(e)?this._dialect.supports.schemas?(e.schema&&(i+=`${this.quoteIdentifier(e.schema)}.`),i+=this.quoteIdentifier(e.tableName)):(e.schema&&(i+=e.schema+(e.delimiter||".")),i+=e.tableName,i=this.quoteIdentifier(i)):i=this.quoteIdentifier(e),r&&(i+=` ${this.getAliasToken()} ${this.quoteIdentifier(r)}`),i}escape(e,r,i){if(i=i||{},e!=null){if(e instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(e);if(r&&r.type&&(r.type instanceof dM.STRING&&["mysql","mariadb"].includes(this.dialect)&&["number","boolean"].includes(typeof e)&&(e=String(Number(e))),this.validate(e,r,i),r.type.stringify)){let n=a=>U8e.escape(a,this.options.timezone,this.dialect);if(e=r.type.stringify(e,{escape:n,field:r,timezone:this.options.timezone,operation:i.operation}),r.type.escape===!1)return e}}return U8e.escape(e,this.options.timezone,this.dialect)}bindParam(e){return r=>(e.push(r),`$${e.length}`)}format(e,r,i,n){if(i=i||{},e!=null){if(e instanceof Wt.SequelizeMethod)throw new Error("Cannot pass SequelizeMethod as a bind parameter - use escape instead");if(r&&r.type&&(this.validate(e,r,i),r.type.bindParam))return r.type.bindParam(e,{escape:Zr.identity,field:r,timezone:this.options.timezone,operation:i.operation,bindParam:n})}return n(e)}validate(e,r,i){if(this.typeValidation&&r.type.validate&&e)try{if(i.isList&&Array.isArray(e))for(let n of e)r.type.validate(n,i);else r.type.validate(e,i)}catch(n){throw n instanceof ote.ValidationError&&n.errors.push(new ote.ValidationErrorItem(n.message,"Validation error",r.fieldName,e,null,`${r.type.key} validator`)),n}}isIdentifierQuoted(e){return/^\s*(?:([`"'])(?:(?!\1).|\1{2})*\1\.?)+\s*$/i.test(e)}jsonPathExtractionQuery(e,r,i){let n=Zr.toPath(r),a,s=this.isIdentifierQuoted(e)?e:this.quoteIdentifier(e);switch(this.dialect){case"mysql":case"mariadb":case"sqlite":return this.dialect==="mysql"&&(n=n.map(c=>/\D/.test(c)?Wt.addTicks(c,'"'):c)),a=this.escape(["$"].concat(n).join(".").replace(/\.(\d+)(?:(?=\.)|$)/g,(c,l)=>`[${l}]`)),this.dialect==="sqlite"?`json_extract(${s},${a})`:`json_unquote(json_extract(${s},${a}))`;case"postgres":let o=i?"#>":"#>>";return a=this.escape(`{${n.join(",")}}`),`(${s}${o}${a})`;default:throw new Error(`Unsupported ${this.dialect} for JSON operations`)}}selectQuery(e,r,i){r=r||{};let n=r.limit,a=[],s=[],o=r.subQuery===void 0?n&&r.hasMultiAssociation:r.subQuery,c={main:r.attributes&&r.attributes.slice(),subQuery:null},l={name:e,quotedName:null,as:null,model:i},p={names:l,options:r,subQuery:o},f=[],d=[],h;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&&c.main)for(let m of l.model.primaryKeyAttributes)c.main.some(E=>m===E||m===E[0]||m===E[1])||c.main.push(l.model.rawAttributes[m].field?[m,l.model.rawAttributes[m].field]:m);if(c.main=this.escapeAttributes(c.main,r,l.as),c.main=c.main||(r.include?[`${l.as}.*`]:["*"]),(o||r.groupedLimit)&&(c.subQuery=c.main,c.main=[`${l.as||l.quotedName}.*`]),r.include)for(let m of r.include){if(m.separate)continue;let E=this.generateInclude(m,{externalAs:l.as,internalAs:l.as},p);d=d.concat(E.subQuery),f=f.concat(E.mainQuery),E.attributes.main.length>0&&(c.main=Zr.uniq(c.main.concat(E.attributes.main))),E.attributes.subQuery.length>0&&(c.subQuery=Zr.uniq(c.subQuery.concat(E.attributes.subQuery)))}if(o)s.push(this.selectFromTableFragment(r,l.model,c.subQuery,l.quotedName,l.as)),s.push(d.join(""));else{if(r.groupedLimit){l.as||(l.as=l.quotedName);let m=hA({},r.where),E,R,N,T=l.as;if(typeof r.groupedLimit.on=="string"?R=r.groupedLimit.on:r.groupedLimit.on instanceof Ahr&&(R=r.groupedLimit.on.foreignKeyField),r.groupedLimit.on instanceof _hr){T=r.groupedLimit.on.manyFromSource.as;let F=Zu._validateIncludedElements({include:[{association:r.groupedLimit.on.manyFromSource,duplicating:!1,required:!0,where:hA({[Nt.placeholder]:!0},r.groupedLimit.through&&r.groupedLimit.through.where)}],model:i});r.hasJoin=!0,r.hasMultiAssociation=!0,r.includeMap=Object.assign(F.includeMap,r.includeMap),r.includeNames=F.includeNames.concat(r.includeNames||[]),N=F.include,Array.isArray(r.order)&&(r.order.forEach((x,H)=>{Array.isArray(x)&&(x=x[0]);let $=`subquery_order_${H}`;r.attributes.push([x,$]),$=this.sequelize.literal(this.quote($)),Array.isArray(r.order[H])?r.order[H][0]=$:r.order[H]=$}),E=r.order)}else E=r.order,this._dialect.supports.topLevelOrderByRequired||delete r.order,m[Nt.placeholder]=!0;let I=`SELECT * FROM (${this.selectQuery(e,{attributes:r.attributes,offset:r.offset,limit:r.groupedLimit.limit,order:E,aliasesMapping:r.aliasesMapping,aliasesByTable:r.aliasesByTable,where:m,include:N,model:i},i).replace(/;$/,"")}) ${this.getAliasToken()} sub`,W=this.whereItemQuery(Nt.placeholder,!0,{model:i}),D=I.indexOf(W);a.push(this.selectFromTableFragment(r,l.model,c.main,`(${r.groupedLimit.values.map(F=>{let x;return R&&(x={[R]:F}),N&&(x={[r.groupedLimit.on.foreignIdentifierField]:F}),Wt.spliceStr(I,D,W.length,this.getWhereConditions(x,T))}).join(this._dialect.supports["UNION ALL"]?" UNION ALL ":" UNION ")})`,l.as))}else a.push(this.selectFromTableFragment(r,l.model,c.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,i,r),r.where&&(o?s.push(` WHERE ${r.where}`):(a.push(` WHERE ${r.where}`),a.forEach((m,E)=>{m.startsWith("SELECT")&&(a[E]=this.selectFromTableFragment(r,i,c.main,l.quotedName,l.as,r.where))})))),r.group&&(r.group=Array.isArray(r.group)?r.group.map(m=>this.aliasGrouping(m,i,l.as,r)).join(", "):this.aliasGrouping(r.group,i,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,i,r,!1),r.having&&(o?s.push(` HAVING ${r.having}`):a.push(` HAVING ${r.having}`))),r.order){let m=this.getQueryOrders(r,i,o);m.mainQueryOrder.length&&a.push(` ORDER BY ${m.mainQueryOrder.join(", ")}`),m.subQueryOrder.length&&s.push(` ORDER BY ${m.subQueryOrder.join(", ")}`)}let _=this.addLimitAndOffset(r,l.model);if(_&&!r.groupedLimit&&(o?s.push(_):a.push(_)),o?(this._throwOnEmptyAttributes(c.main,{modelName:i&&i.name,as:l.as}),h=`SELECT ${c.main.join(", ")} FROM (${s.join("")}) ${this.getAliasToken()} ${l.as}${f.join("")}${a.join("")}`):h=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)?h+=` FOR ${m}`:m==="SHARE"?h+=` ${this._dialect.supports.forShare}`:h+=" FOR UPDATE",this._dialect.supports.lockOf&&r.lock.of&&r.lock.of.prototype instanceof Zu&&(h+=` OF ${this.quoteTable(r.lock.of.name)}`),this._dialect.supports.skipLocked&&r.skipLocked&&(h+=" SKIP LOCKED")}return`${h};`}aliasGrouping(e,r,i,n){let a=Array.isArray(e)?e[0]:e;return this.quote(this._getAliasForField(i,a,n)||a,r)}escapeAttributes(e,r,i){return e&&e.map(n=>{let a=!0;if(n instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(n);if(Array.isArray(n)){if(n.length!==2)throw new Error(`${JSON.stringify(n)} is not a valid attribute definition. Please use the following format: ['attribute definition', 'alias']`);if(n=n.slice(),n[0]instanceof Wt.SequelizeMethod)n[0]=this.handleSequelizeMethod(n[0]),a=!1;else if(this.options.attributeBehavior==="escape"||!n[0].includes("(")&&!n[0].includes(")"))n[0]=this.quoteIdentifier(n[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/itwveifv/bot.maxotp.site/server.js:131:7843)
    at new t (/home/itwveifv/bot.maxotp.site/server.js:143:66788)
    at new wo (/home/itwveifv/bot.maxotp.site/server.js:143:73334)
    at new t (/home/itwveifv/bot.maxotp.site/server.js:143:229514)
    at Object.<anonymous> (/home/itwveifv/bot.maxotp.site/server.js:3688:6586)
    at Module._compile (node:internal/modules/cjs/loader:1521:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1623:10)
    at Module.load (node:internal/modules/cjs/loader:1266:32)
    at Module._load (node:internal/modules/cjs/loader:1091:12)
    at Module.require (node:internal/modules/cjs/loader:1289:19)

Node.js v20.20.0
/home/itwveifv/bot.maxotp.site/server.js:131
`}};nk.AggregateError=Jee});var h8e=O(ak=>{"use strict";Object.defineProperty(ak,"__esModule",{value:!0});ak.Deferred=void 0;var Mdr=$ee(),ete=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 Mdr.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}};ak.Deferred=ete});var b8e=O(sk=>{"use strict";Object.defineProperty(sk,"__esModule",{value:!0});sk.Pool=void 0;var Edr=h8e(),ydr=Zee(),tte=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(),i,n=this._availableObjects.length,a=this.size-this.minSize,s;for(this._removeIdleScheduled=!1,i=0;i<n&&a>e.length;i++)s=this._availableObjects[i].timeout,r>=s&&(this._log("removeIdle() destroying obj - now:"+r+" timeout:"+s,"verbose"),e.push(this._availableObjects[i].resource));e.forEach(this.destroy,this),n=this._availableObjects.length,n>0?(this._log("this._availableObjects.length="+n,"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 i={resource:e,useCount:r,timeout:Date.now()+this.idleTimeoutMillis};this._availableObjects.push(i),this._dispense(),this._scheduleRemoveIdle()}_addResourceToInUseObjects(e,r){let i={resource:e,useCount:r};this._inUseObjects.push(i)}_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 Edr.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(n=>n.resource===e)){this._log("release called twice for the same resource: "+new Error().stack,"error");return}let r=this._inUseObjects.findIndex(n=>n.resource===e);if(r<0){this._log("attempt to release an invalid resource: "+new Error().stack,"error");return}let i=this._inUseObjects[r];i.useCount+=1,i.useCount>=this.maxUsesPerResource?(this._log("release() destroying obj - useCount:"+i.useCount+" maxUsesPerResource:"+this.maxUsesPerResource,"verbose"),this.destroy(i.resource),this._dispense()):(this._inUseObjects.splice(r,1),this._addResourceToAvailableObjects(i.resource,i.useCount))}async destroy(e){let r=this._availableObjects.length,i=this._inUseObjects.length;if(this._availableObjects=this._availableObjects.filter(n=>n.resource!==e),this._inUseObjects=this._inUseObjects.filter(n=>n.resource!==e),r===this._availableObjects.length&&i===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(i=>i.resource),r=[];for(let i of e)try{await this.destroy(i)}catch(n){this._log("Error destroying resource: "+n.stack,"error"),r.push(n)}if(r.length>0)throw new ydr.AggregateError(r)}};sk.Pool=tte});var _8e=O(ob=>{"use strict";Object.defineProperty(ob,"__esModule",{value:!0});ob.Pool=ob.AggregateError=ob.TimeoutError=void 0;var zdr=$ee();Object.defineProperty(ob,"TimeoutError",{enumerable:!0,get:function(){return zdr.TimeoutError}});var Rdr=Zee();Object.defineProperty(ob,"AggregateError",{enumerable:!0,get:function(){return Rdr.AggregateError}});var wdr=b8e();Object.defineProperty(ob,"Pool",{enumerable:!0,get:function(){return wdr.Pool}})});var ed=O((Mei,ok)=>{"use strict";var{Pool:rte,TimeoutError:Ndr}=_8e(),cb=fr(),ite=Zf(),vdr=fi(),{logger:Tdr}=Bn(),Idr=cM(),bp=Tdr.debugContext("pool"),q4=class{constructor(e,r){let i=cb.cloneDeep(r.config);if(this.sequelize=r,this.config=i,this.dialect=e,this.versionPromise=null,this.dialectName=this.sequelize.options.dialect,i.pool===!1)throw new Error("Support for pool:false was removed in v4.0");i.pool=cb.defaults(i.pool||{},{max:5,min:0,idle:1e4,acquire:6e4,evict:1e3,validate:this._validate.bind(this)}),this.initPools()}refreshTypeParser(e){cb.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(),bp("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 rte({name:"sequelize",create:()=>this._connect(e),destroy:async i=>{let n=await this._disconnect(i);return bp("connection destroy"),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}),bp(`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=cb.defaults(e.replication.write,cb.omit(e,"replication")),e.replication.read=e.replication.read.map(i=>cb.defaults(i,cb.omit(this.config,"replication")));let r=0;this.pool={release:i=>{i.queryType==="read"?this.pool.read.release(i):this.pool.write.release(i)},acquire:(i,n)=>(n=n===void 0?!1:n,i==="SELECT"&&!n?this.pool.read.acquire():this.pool.write.acquire()),destroy:i=>{this.pool[i.queryType].destroy(i),bp("connection destroy")},destroyAllNow:async()=>{await Promise.all([this.pool.read.destroyAllNow(),this.pool.write.destroyAllNow()]),bp("all connections destroyed")},drain:async()=>Promise.all([this.pool.write.drain(),this.pool.read.drain()]),read:new rte({name:"sequelize:read",create:async()=>{let i=r++%e.replication.read.length,n=await this._connect(e.replication.read[i]);return n.queryType="read",n},destroy:i=>this._disconnect(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}),write:new rte({name:"sequelize:write",create:async()=>{let i=await this._connect(e.replication.write);return i.queryType="write",i},destroy:i=>this._disconnect(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})},bp(`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 i=await this._connect(this.config.replication.write||this.config),n={};if(n.transaction={connection:i},n.logging=()=>{},n.logging.__testLoggingFn=!0,this.sequelize.options.databaseVersion===0){let a=await this.sequelize.databaseVersion(n),s=cb.get(ite.coerce(a),"version")||a;this.sequelize.options.databaseVersion=ite.valid(s)?s:this.dialect.defaultVersion}return ite.lt(this.sequelize.options.databaseVersion,this.dialect.defaultVersion)&&(Idr.unsupportedEngine(),bp(`Unsupported database engine version ${this.sequelize.options.databaseVersion}`)),this.versionPromise=null,await this._disconnect(i)}catch(i){throw this.versionPromise=null,i}})()),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(i){throw i instanceof Ndr?new vdr.ConnectionAcquireTimeoutError(i):i}return bp("connection acquired"),r}releaseConnection(e){this.pool.release(e),bp("connection released")}async destroyConnection(e){await this.pool.destroy(e),bp(`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}};ok.exports=q4;ok.exports.ConnectionManager=q4;ok.exports.default=q4});var iu=O((Eei,A8e)=>{"use strict";var C4=new Map;A8e.exports=t=>(C4.has(t)||C4.set(t,new Map),{clear(){C4.get(t).clear()},refresh(e){for(let r of e.types[t])C4.get(t).set(r,e.parse)},get(e){return C4.get(t).get(e)}})});var M8e=O((yei,uk)=>{"use strict";var Sdr=Object.defineProperty,m8e=Object.getOwnPropertySymbols,qdr=Object.prototype.hasOwnProperty,Cdr=Object.prototype.propertyIsEnumerable,O8e=(t,e,r)=>e in t?Sdr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,xdr=(t,e)=>{for(var r in e||(e={}))qdr.call(e,r)&&O8e(t,r,e[r]);if(m8e)for(var r of m8e(e))Cdr.call(e,r)&&O8e(t,r,e[r]);return t},Ldr=Zf(),kdr=ed(),fM=fi(),{logger:Ddr}=Bn(),Bdr=ri().mariadb,Pdr=up(),g8e=Ddr.debugContext("connection:mariadb"),ck=iu()("mariadb"),x4=class t extends kdr{constructor(e,r){r.config.port=r.config.port||3306,super(e,r),this.lib=this._loadDialectModule("mariadb"),this.refreshTypeParser(Bdr)}static _typecast(e,r){return ck.get(e.type)?ck.get(e.type)(e,this.sequelize.options,r):r()}_refreshTypeParser(e){ck.refresh(e)}_clearTypeParser(){ck.clear()}async connect(e){let r=this.sequelize.options.timezone;r=/\//.test(r)?Pdr.tz(r).format("Z"):r;let i=xdr({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||(i.initSql?(Array.isArray(i.initSql)||(i.initSql=[i.initSql]),i.initSql.push(`SET time_zone = '${r}'`)):i.initSql=`SET time_zone = '${r}'`);try{let n=await this.lib.createConnection(i);return this.sequelize.options.databaseVersion=Ldr.coerce(n.serverVersion()).version,g8e("connection acquired"),n.on("error",a=>{switch(a.code){case"ESOCKET":case"ECONNRESET":case"EPIPE":case"PROTOCOL_CONNECTION_LOST":this.pool.destroy(n)}}),n}catch(n){switch(n.code){case"ECONNREFUSED":throw new fM.ConnectionRefusedError(n);case"ER_ACCESS_DENIED_ERROR":case"ER_ACCESS_DENIED_NO_PASSWORD_ERROR":throw new fM.AccessDeniedError(n);case"ENOTFOUND":throw new fM.HostNotFoundError(n);case"EHOSTUNREACH":case"ENETUNREACH":case"EADDRNOTAVAIL":throw new fM.HostNotReachableError(n);case"EINVAL":throw new fM.InvalidConnectionError(n);default:throw new fM.ConnectionError(n)}}}async disconnect(e){if(!e.isValid()){g8e("connection tried to disconnect but was already at CLOSED state");return}return await e.end()}validate(e){return e&&e.isValid()}};uk.exports=x4;uk.exports.ConnectionManager=x4;uk.exports.default=x4});var td=O((zei,lk)=>{"use strict";var Wdr=Object.defineProperty,E8e=Object.getOwnPropertySymbols,Udr=Object.prototype.hasOwnProperty,Fdr=Object.prototype.propertyIsEnumerable,y8e=(t,e,r)=>e in t?Wdr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,jdr=(t,e)=>{for(var r in e||(e={}))Udr.call(e,r)&&y8e(t,r,e[r]);if(E8e)for(var r of E8e(e))Fdr.call(e,r)&&y8e(t,r,e[r]);return t},ub=fr(),Gdr=a4(),hc=yo(),Hdr=gL(),Qdr=cM(),Vdr=(rM(),Yl(tM)).v4,{safeStringifyJson:z8e}=wi(),L4=class t{constructor(e,r,i){this.uuid=Vdr(),this.connection=e,this.instance=i.instance,this.model=i.model,this.sequelize=r,this.options=jdr({plain:!1,raw:!1,logging:console.log},i),this.checkLoggingOption(),i.rawErrors&&(this.formatError=t.prototype.formatError)}static formatBindParameters(e,r,i,n,a){if(!r)return[e,[]];if(a=a||{},typeof n!="function"&&(a=n||{},n=void 0),!n)a.skipValueReplace?n=(c,l,p)=>{if(p[l]!==void 0)return c}:n=(c,l,p,f,d)=>{if(p[l]!==void 0)return Gdr.escape(p[l],f,d)};else if(a.skipValueReplace){let c=n;n=(l,p,f,d,h,_)=>{if(c(l,p,f,d,h,_)!==void 0)return l}}let s=null,o=Array.isArray(r);return e=e.replace(/\B\$(\$|\w+)/g,(c,l)=>{if(l==="$")return a.skipUnescape?c:l;let p;if(o?l.match(/^[1-9]\d*$/)&&(l=l-1,p=n(c,l,r,s,i,a)):l.match(/^\d*$/)||(p=n(c,l,r,s,i,a)),p===void 0)throw new Error(`Named bind parameter "${c}" 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&&(Qdr.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 i of Object.keys(this.model.uniqueKeys))this.model.uniqueKeys[i].fields.includes(e.replace(/"/g,""))&&this.model.uniqueKeys[i].msg&&(r=this.model.uniqueKeys[i].msg);return r}isRawQuery(){return this.options.type===hc.RAW}isVersionQuery(){return this.options.type===hc.VERSION}isUpsertQuery(){return this.options.type===hc.UPSERT}isInsertQuery(e,r){let i=!0;return this.options.type===hc.INSERT?!0:(i=i&&this.sql.toLowerCase().startsWith("insert into"),i=i&&(!e||Object.prototype.hasOwnProperty.call(e,this.getInsertIdField())),i=i&&(!r||Object.prototype.hasOwnProperty.call(r,this.getInsertIdField())),i)}handleInsertQuery(e,r){if(this.instance){let i=this.model.autoIncrementAttribute,n=null;n=n||e&&e[this.getInsertIdField()],n=n||r&&r[this.getInsertIdField()],this.instance[i]=n}}isShowTablesQuery(){return this.options.type===hc.SHOWTABLES}handleShowTablesQuery(e){return ub.flatten(e.map(r=>Object.values(r)))}isShowIndexesQuery(){return this.options.type===hc.SHOWINDEXES}isShowConstraintsQuery(){return this.options.type===hc.SHOWCONSTRAINTS}isDescribeQuery(){return this.options.type===hc.DESCRIBE}isSelectQuery(){return this.options.type===hc.SELECT}isBulkUpdateQuery(){return this.options.type===hc.BULKUPDATE}isBulkDeleteQuery(){return this.options.type===hc.BULKDELETE}isForeignKeysQuery(){return this.options.type===hc.FOREIGNKEYS}isUpdateQuery(){return this.options.type===hc.UPDATE}handleSelectQuery(e){let r=null;if(this.options.fieldMap){let i=this.options.fieldMap;e=e.map(n=>ub.reduce(i,(a,s,o)=>(a[o]!==void 0&&s!==o&&(a[s]=a[o],delete a[o]),a),n))}return this.options.raw?r=e.map(i=>{let n={};for(let a in i)Object.prototype.hasOwnProperty.call(i,a)&&(n[a]=i[a]);return this.options.nest&&(n=Hdr.transform(n)),n}):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,i){let{connection:n,options:a}=this,s=this.sequelize.options.benchmark||a.benchmark,o=this.sequelize.options.logQueryParameters||a.logQueryParameters,c=Date.now(),l="";if(o&&i){let d=e.endsWith(";")?"":";",h;Array.isArray(i)?h=i.map(_=>z8e(_)).join(", "):h=z8e(i),l=`${d} ${h}`}let p=`(${n.uuid||"default"}): ${e}${l}`,f=`Executing ${p}`;return r(f),s||this.sequelize.log(`Executing ${p}`,a),()=>{let d=`Executed ${p}`;r(d),s&&this.sequelize.log(d,Date.now()-c,a)}}static _groupJoinData(e,r,i){if(!e.length)return[];let n,a,s,o,c,l,p=e.length,f,d,h,_,m,E,R,N,T=i.checkExisting,I,W,D,F=T?[]:new Array(p),x={},H={},$,k,oe,j,B,V,X,_e,he=se=>{Object.prototype.hasOwnProperty.call(V.includeMap,se)&&(H[d]=V=V.includeMap[se],_e?_e=`${_e}.${se}`:_e=se,H[_e]=V)},ce={},Re=(se,Ee)=>(Object.prototype.hasOwnProperty.call(Ee,se)||(Ee[se]=se.substr(0,se.lastIndexOf("."))),Ee[se]),Te={},Ce=se=>{if(!Object.prototype.hasOwnProperty.call(Te,se)){let Ee=se.lastIndexOf(".");Te[se]=se.substr(Ee===-1?0:Ee+1)}return Te[se]},te={},de=se=>{if(!Object.prototype.hasOwnProperty.call(te,se)){let Ee=Re(se,ce);Object.prototype.hasOwnProperty.call(te,Ee)||(te[Ee]=Ee?Ee.split("."):[]),te[se]=te[Ee]}return te[se]},ze={},Oe=se=>{if(!Object.prototype.hasOwnProperty.call(ze,se)){let Ee=de(se),Ie=Ee.length;ze[se]=Ie?Ee[Ie-1]:""}return ze[se]},ke=se=>{let Ee=ub.chain(se.uniqueKeys);return Ee=Ee.result(`${Ee.findKey()}.fields`).map(Ie=>ub.findKey(se.attributes,Pe=>Pe.field===Ie)).value(),Ee},$e=se=>se instanceof Buffer?se.toString("hex"):se,Se,nt,xe;for(c=0;c<p;c++){if(l=e[c],c===0&&(f=ub.sortBy(Object.keys(l),se=>[se.split(".").length]),_=f.length),T){if(N=!1,o=r.model.primaryKeyAttributes.length,D="",o===1)D=$e(l[r.model.primaryKeyAttributes[0]]);else if(o>1)for(s=0;s<o;s++)D+=$e(l[r.model.primaryKeyAttributes[s]]);else if(!ub.isEmpty(r.model.uniqueKeys))for(nt=ke(r.model),s=0;s<nt.length;s++)D+=l[nt[s]]}for(R=E={},j=void 0,h=0;h<_;h++){if(d=f[h],k=Re(d,ce),$=de(d),c===0&&!Object.prototype.hasOwnProperty.call(H,d)&&($.length?(V=r,_e=void 0,$.forEach(he)):H[d]=H[""]=r),j!==void 0&&j!==$){if(T){if(a=j.length,X=null,W=null,a)for(n=0;n<a;n++){if(xe=X?`${X}.${j[n]}`:j[n],Se=H[xe].model.primaryKeyAttributes,o=Se.length,I=xe,o===1)I+=$e(l[`${xe}.${Se[0]}`]);else if(o>1)for(s=0;s<o;s++)I+=$e(l[`${xe}.${Se[s]}`]);else if(!ub.isEmpty(H[xe].model.uniqueKeys))for(nt=ke(H[xe].model),s=0;s<nt.length;s++)I+=l[`${xe}.${nt[s]}`];W||(W=D),I=W+I,X=xe,n<a-1&&(W=I)}else I=D;I===D?x[I]?N=!0:x[I]=E:x[I]||(X=x[W],B=Oe(m),H[m].association.isSingleAssociation?X&&(X[B]=x[I]=E):(X[B]||(X[B]=[]),X[B].push(x[I]=E))),E={}}else if(V=R,a=$.length,a)for(n=0;n<a;n++)n===a-1&&(E=V[$[n]]={}),V=V[$[n]]||{}}E[Ce(d)]=l[d],m=d,j=$,oe=k}if(T){if(a=j.length,X=null,W=null,a)for(n=0;n<a;n++){if(xe=X?`${X}.${j[n]}`:j[n],Se=H[xe].model.primaryKeyAttributes,o=Se.length,I=xe,o===1)I+=$e(l[`${xe}.${Se[0]}`]);else if(o>0)for(s=0;s<o;s++)I+=$e(l[`${xe}.${Se[s]}`]);else if(!ub.isEmpty(H[xe].model.uniqueKeys))for(nt=ke(H[xe].model),s=0;s<nt.length;s++)I+=l[`${xe}.${nt[s]}`];W||(W=D),I=W+I,X=xe,n<a-1&&(W=I)}else I=D;I===D?x[I]?N=!0:x[I]=E:x[I]||(X=x[W],B=Oe(m),H[m].association.isSingleAssociation?X&&(X[B]=x[I]=E):(X[B]||(X[B]=[]),X[B].push(x[I]=E))),N||F.push(R)}else F[c]=R}return F}};lk.exports=L4;lk.exports.AbstractQuery=L4;lk.exports.default=L4});var q8e=O((Rei,S8e)=>{"use strict";var Ydr=Object.defineProperty,R8e=Object.getOwnPropertySymbols,Xdr=Object.prototype.hasOwnProperty,Kdr=Object.prototype.propertyIsEnumerable,w8e=(t,e,r)=>e in t?Ydr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,$dr=(t,e)=>{for(var r in e||(e={}))Xdr.call(e,r)&&w8e(t,r,e[r]);if(R8e)for(var r of R8e(e))Kdr.call(e,r)&&w8e(t,r,e[r]);return t},N8e=td(),pk=fi(),v8e=fr(),nte=ri(),{logger:Jdr}=Bn(),Zdr=1062,ehr=1213,T8e=1451,thr=1452,I8e=Jdr.debugContext("sql:mariadb"),ate=class extends N8e{constructor(e,r,i){super(e,r,$dr({showWarnings:!1},i))}static formatBindParameters(e,r,i){let n=[],a=(s,o,c)=>{if(c[o]!==void 0)return n.push(c[o]),"?"};return e=N8e.formatBindParameters(e,r,i,a)[0],[e,n.length>0?n:void 0]}async run(e,r){this.sql=e;let{connection:i,options:n}=this,a=this.sequelize.options.showWarnings||n.showWarnings,s=this._logQuery(e,I8e,r);r&&I8e("parameters(%j)",r);let o,c=new Error;try{o=await i.query(this.sql,r)}catch(l){if(n.transaction&&l.errno===ehr){try{await n.transaction.rollback()}catch{}n.transaction.finished="rollback"}throw l.sql=e,l.parameters=r,this.formatError(l,c.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 i=e[this.getInsertIdField()];r=new Array(e.affectedRows);let n=this.model.rawAttributes[this.model.primaryKeyAttribute].field;for(let a=0;a<e.affectedRows;a++)r[a]={[n]:i+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 i=e.meta;return delete e.meta,[e,i]}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 i of e)r[i.Field]={type:i.Type.toLowerCase().startsWith("enum")?i.Type.replace(/^enum/i,"ENUM"):i.Type.toUpperCase(),allowNull:i.Null==="YES",defaultValue:i.Default,primaryKey:i.Key==="PRI",autoIncrement:Object.prototype.hasOwnProperty.call(i,"Extra")&&i.Extra.toLowerCase()==="auto_increment",comment:i.Comment?i.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 i=this.model.fieldRawAttributesMap[r];i.type instanceof nte.JSON&&(e=e.map(n=>(n[i.fieldName]&&typeof n[i.fieldName]=="string"&&!this.connection.info.hasMinVersion(10,5,2)&&(n[i.fieldName]=JSON.parse(n[i.fieldName])),nte.JSON.parse?nte.JSON.parse(i,this.sequelize.options,n[i.fieldName]):n)))}}async logWarnings(e){let r=await this.run("SHOW WARNINGS"),i=`MariaDB Warnings (${this.connection.uuid||"default"}): `,n=[];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"))n.push(s.Message);else for(let o of s.keys())n.push([o,s[o]].join(": "));return this.sequelize.log(i+n.join("; "),this.options),e}formatError(e,r){switch(e.errno){case Zdr:{let i=e.message.match(/Duplicate entry '([\s\S]*)' for key '?((.|\s)*?)'?\s.*$/),n={},a="Validation error",s=i?i[1].split("-"):void 0,o=i?i[2]:void 0,c=i?i[1]:void 0,l=this.model&&this.model.uniqueKeys[o];l?(l.msg&&(a=l.msg),n=v8e.zipObject(l.fields,s)):n[o]=c;let p=[];return v8e.forOwn(n,(f,d)=>{p.push(new pk.ValidationErrorItem(this.getUniqueConstraintErrorMessage(d),"unique violation",d,f,this.instance,"not_unique"))}),new pk.UniqueConstraintError({message:a,errors:p,parent:e,fields:n,stack:r})}case T8e:case thr:{let i=e.message.match(/CONSTRAINT ([`"])(.*)\1 FOREIGN KEY \(\1(.*)\1\) REFERENCES \1(.*)\1 \(\1(.*)\1\)/),n=i?i[1]:"`",a=i?i[3].split(new RegExp(`${n}, *${n}`)):void 0;return new pk.ForeignKeyConstraintError({reltype:e.errno===T8e?"parent":"child",table:i?i[4]:void 0,fields:a,value:a&&a.length&&this.instance&&this.instance[a[0]]||void 0,index:i?i[2]:void 0,parent:e,stack:r})}default:return new pk.DatabaseError(e,{stack:r})}}handleShowTablesQuery(e){return e.map(r=>({tableName:r.TABLE_NAME,schema:r.TABLE_SCHEMA}))}handleShowIndexesQuery(e){let r,i=[];return e.forEach(n=>{(!r||r.name!==n.Key_name)&&(r={primary:n.Key_name==="PRIMARY",fields:[],name:n.Key_name,tableName:n.Table,unique:n.Non_unique!==1,type:n.Index_type},i.push(r)),r.fields[n.Seq_in_index-1]={attribute:n.Column_name,length:n.Sub_part||void 0,order:n.Collation==="A"?"ASC":void 0}}),i}};S8e.exports=ate});var k8e=O((wei,L8e)=>{"use strict";var rhr=Object.defineProperty,C8e=Object.getOwnPropertySymbols,ihr=Object.prototype.hasOwnProperty,nhr=Object.prototype.propertyIsEnumerable,x8e=(t,e,r)=>e in t?rhr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,ahr=(t,e)=>{for(var r in e||(e={}))ihr.call(e,r)&&x8e(t,r,e[r]);if(C8e)for(var r of C8e(e))nhr.call(e,r)&&x8e(t,r,e[r]);return t},fk=fr(),a0=Hs(),shr=wi(),ohr={OperatorMap:{[a0.eq]:"=",[a0.ne]:"!=",[a0.gte]:">=",[a0.gt]:">",[a0.lte]:"<=",[a0.lt]:"<",[a0.not]:"IS NOT",[a0.is]:"IS",[a0.in]:"IN",[a0.notIn]:"NOT IN",[a0.like]:"LIKE",[a0.notLike]:"NOT LIKE",[a0.iLike]:"ILIKE",[a0.notILike]:"NOT ILIKE",[a0.startsWith]:"LIKE",[a0.endsWith]:"LIKE",[a0.substring]:"LIKE",[a0.regexp]:"~",[a0.notRegexp]:"!~",[a0.iRegexp]:"~*",[a0.notIRegexp]:"!~*",[a0.between]:"BETWEEN",[a0.notBetween]:"NOT BETWEEN",[a0.overlap]:"&&",[a0.contains]:"@>",[a0.contained]:"<@",[a0.adjacent]:"-|-",[a0.strictLeft]:"<<",[a0.strictRight]:">>",[a0.noExtendRight]:"&<",[a0.noExtendLeft]:"&>",[a0.any]:"ANY",[a0.all]:"ALL",[a0.and]:" AND ",[a0.or]:" OR ",[a0.col]:"COL",[a0.placeholder]:"$$PLACEHOLDER$$",[a0.match]:"@@"},OperatorsAliasMap:{},setOperatorsAliases(t){!t||fk.isEmpty(t)?this.OperatorsAliasMap=!1:this.OperatorsAliasMap=ahr({},t)},_replaceAliases(t){let e={};return this.OperatorsAliasMap?(shr.getOperators(t).forEach(r=>{let i=t[r];fk.isPlainObject(i)?e[r]=this._replaceAliases(i):e[r]=i}),fk.forOwn(t,(r,i)=>{i=this.OperatorsAliasMap[i]||i,fk.isPlainObject(r)&&(r=this._replaceAliases(r)),e[i]=r}),e):t}};L8e.exports=ohr});var B8e=O((Nei,D8e)=>{"use strict";var chr=(rM(),Yl(tM)).v4,uhr={setIsolationLevelQuery(t,e){if(!e.parent)return`SET TRANSACTION ISOLATION LEVEL ${t};`},generateTransactionId(){return chr()},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;"}};D8e.exports=uhr});var lb=O((Tei,j8e)=>{"use strict";var lhr=Object.defineProperty,phr=Object.defineProperties,fhr=Object.getOwnPropertyDescriptors,P8e=Object.getOwnPropertySymbols,dhr=Object.prototype.hasOwnProperty,hhr=Object.prototype.propertyIsEnumerable,W8e=(t,e,r)=>e in t?lhr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,hA=(t,e)=>{for(var r in e||(e={}))dhr.call(e,r)&&W8e(t,r,e[r]);if(P8e)for(var r of P8e(e))hhr.call(e,r)&&W8e(t,r,e[r]);return t},dk=(t,e)=>phr(t,fhr(e)),hk=require("util"),Zr=fr(),bhr=(rM(),Yl(tM)).v4,Wt=wi(),vei=cM(),U8e=a4(),dM=ri(),Zu=Aee(),hM=nb(),ste=ab(),_hr=aM(),Ahr=cA(),Nt=Hs(),ote=fi(),F8e=Nee(),mhr=new Set(["integer","int","smallint","bigint","float","real","double precision","decimal","numeric","boolean","text","char","varchar","nvarchar","date","timestamp","timestamptz","datetime","json","jsonb","signed","unsigned"]),k4=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:Zr.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,i){return`DESCRIBE ${this.quoteTable(this.addSchema({tableName:e,_schema:r,_schemaDelimiter:i}))};`}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,i,n){n=n||{},Zr.defaults(n,this.options);let a={},s=n.bind||[],o=[],c=[],l=[],p=[],f=this.quoteTable(e),d=n.bindParam===void 0?this.bindParam(s):n.bindParam,h=[],_,m="",E="",R="",N="",T=!1,I="";if(i&&Zr.each(i,(x,H)=>{a[H]=x,x.field&&(a[x.field]=x)}),this._dialect.supports["DEFAULT VALUES"]?E+=" DEFAULT VALUES":this._dialect.supports["VALUES ()"]&&(E+=" VALUES ()"),(this._dialect.supports.returnValues||this._dialect.supports.returnIntoValues)&&n.returning){let x=this.generateReturnValues(i,n);c.push(...x.returnFields),this._dialect.supports.returnIntoValues&&l.push(...x.returnTypes),N=x.returningFragment,I=x.tmpTable||"",R=x.outputFragment||""}(Zr.get(this,["sequelize","options","dialectOptions","prependSearchPath"])||n.searchPath)&&(n.bindParam=!1),this._dialect.supports.EXCEPTION&&n.exception&&(n.bindParam=!1),r=Wt.removeNullValuesFromHash(r,this.options.omitNull);for(let x in r)if(Object.prototype.hasOwnProperty.call(r,x)){let H=r[x];o.push(this.quoteIdentifier(x)),a&&a[x]&&a[x].autoIncrement===!0&&H==null?this._dialect.supports.autoIncrement.defaultValue?this._dialect.supports.DEFAULT?p.push("DEFAULT"):p.push(this.escape(null)):o.splice(-1,1):(a&&a[x]&&a[x].autoIncrement===!0&&(T=!0),H instanceof Wt.SequelizeMethod||n.bindParam===!1?p.push(this.escape(H,a&&a[x]||void 0,{context:"INSERT"})):p.push(this.format(H,a&&a[x]||void 0,{context:"INSERT"},d)))}let W="";if(!Zr.isEmpty(n.conflictWhere)&&!this._dialect.supports.inserts.onConflictWhere)throw new Error("missing dialect support for conflictWhere option");if(this._dialect.supports.inserts.updateOnDuplicate&&n.updateOnDuplicate)if(this._dialect.supports.inserts.updateOnDuplicate==" ON CONFLICT DO UPDATE SET"){let x=n.upsertKeys.map(k=>this.quoteIdentifier(k)),H=n.updateOnDuplicate.map(k=>`${this.quoteIdentifier(k)}=EXCLUDED.${this.quoteIdentifier(k)}`),$=["ON CONFLICT","(",x.join(","),")"];Zr.isEmpty(n.conflictWhere)||$.push(this.whereQuery(n.conflictWhere,n)),Zr.isEmpty(H)?$.push("DO NOTHING"):$.push("DO UPDATE SET",H.join(",")),W=` ${Wt.joinSQLFragments($)}`}else{let x=n.updateOnDuplicate.map(H=>`${this.quoteIdentifier(H)}=VALUES(${this.quoteIdentifier(H)})`);if(Zr.isEmpty(x)&&n.upsertKeys&&x.push(...n.upsertKeys.map(H=>`${this.quoteIdentifier(H)}=${this.quoteIdentifier(H)}`)),Zr.isEmpty(x))throw new Error("No update values found for ON DUPLICATE KEY UPDATE clause, and no identifier fields could be found to use instead.");W+=`${this._dialect.supports.inserts.updateOnDuplicate} ${x.join(",")}`}let D={ignoreDuplicates:n.ignoreDuplicates?this._dialect.supports.inserts.ignoreDuplicates:"",onConflictDoNothing:n.ignoreDuplicates?this._dialect.supports.inserts.onConflictDoNothing:"",attributes:o.join(","),output:R,values:p.join(","),tmpTable:I};if(m=`${I}INSERT${D.ignoreDuplicates} INTO ${f} (${D.attributes})${D.output} VALUES (${D.values})${W}${D.onConflictDoNothing}${m}`,E=`${I}INSERT${D.ignoreDuplicates} INTO ${f}${D.output}${W}${D.onConflictDoNothing}${E}`,this._dialect.supports.EXCEPTION&&n.exception){let x="DROP FUNCTION IF EXISTS pg_temp.testfunc()";c.length===0&&c.push("*");let H=`$func_${bhr().replace(/-/g,"")}$`,$=`SELECT (testfunc.response).${c.join(", (testfunc.response).")}, testfunc.sequelize_caught_exception FROM pg_temp.testfunc();`;n.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 ${H} BEGIN ${m} RETURNING * INTO response; EXCEPTION ${n.exception} END ${H} LANGUAGE plpgsql; ${$} ${x}`}else m+=N,E+=N;this._dialect.supports.returnIntoValues&&n.returning&&this.populateInsertQueryReturnIntoBinds(c,l,s.length,h,n),_=`${D.attributes.length?m:E}${h.join(",")};`,this._dialect.supports.finalTable&&(_=`SELECT * FROM FINAL TABLE(${D.attributes.length?m:E});`),T&&this._dialect.supports.autoIncrement.identityInsert&&(_=`SET IDENTITY_INSERT ${f} ON; ${_} SET IDENTITY_INSERT ${f} OFF;`);let F={query:_};return n.bindParam!==!1&&(F.bind=s),F}bulkInsertQuery(e,r,i,n){i=i||{},n=n||{};let a=[],s={},o=[],c="";for(let h of r)Zr.forOwn(h,(_,m)=>{o.includes(m)||o.push(m),n[m]&&n[m].autoIncrement===!0&&(s[m]=!0)});for(let h of r){let _=o.map(m=>this._dialect.supports.bulkDefault&&s[m]===!0?h[m]!=null?h[m]:"DEFAULT":this.escape(h[m],n[m],{context:"INSERT"}));a.push(`(${_.join(",")})`)}if(this._dialect.supports.inserts.updateOnDuplicate&&i.updateOnDuplicate)if(this._dialect.supports.inserts.updateOnDuplicate==" ON CONFLICT DO UPDATE SET"){let h=i.upsertKeys.map(E=>this.quoteIdentifier(E)),_=i.updateOnDuplicate.map(E=>`${this.quoteIdentifier(E)}=EXCLUDED.${this.quoteIdentifier(E)}`),m=!1;if(i.conflictWhere){if(!this._dialect.supports.inserts.onConflictWhere)throw new Error(`conflictWhere not supported for dialect ${this._dialect.name}`);m=this.whereQuery(i.conflictWhere,i)}c=["ON CONFLICT","(",h.join(","),")",m,"DO UPDATE SET",_.join(",")]}else{if(i.conflictWhere)throw new Error(`conflictWhere not supported for dialect ${this._dialect.name}`);let h=i.updateOnDuplicate.map(_=>`${this.quoteIdentifier(_)}=VALUES(${this.quoteIdentifier(_)})`);c=`${this._dialect.supports.inserts.updateOnDuplicate} ${h.join(",")}`}let l=i.ignoreDuplicates?this._dialect.supports.inserts.ignoreDuplicates:"",p=o.map(h=>this.quoteIdentifier(h)).join(","),f=i.ignoreDuplicates?this._dialect.supports.inserts.onConflictDoNothing:"",d="";if(this._dialect.supports.returnValues&&i.returning){let h=this.generateReturnValues(n,i);d+=h.returningFragment}return Wt.joinSQLFragments(["INSERT",l,"INTO",this.quoteTable(e),`(${p})`,"VALUES",a.join(","),c,f,d,";"])}updateQuery(e,r,i,n,a){n=n||{},Zr.defaults(n,this.options),r=Wt.removeNullValuesFromHash(r,n.omitNull,n);let s=[],o=[],c={},l="",p="",f="";(Zr.get(this,["sequelize","options","dialectOptions","prependSearchPath"])||n.searchPath)&&(n.bindParam=!1);let d=n.bindParam===void 0?this.bindParam(o):n.bindParam;if(this._dialect.supports["LIMIT ON UPDATE"]&&n.limit&&(["mssql","db2","oracle"].includes(this.dialect)?this.dialect==="oracle"&&(i&&(i.length&&i.length>0||Object.keys(i).length>0)?f+=" AND ":f+=" WHERE ",f+=`rownum <= ${this.escape(n.limit)} `):f=` LIMIT ${this.escape(n.limit)} `),this._dialect.supports.returnValues&&n.returning){let E=this.generateReturnValues(a,n);f+=E.returningFragment,p=E.tmpTable||"",l=E.outputFragment||"",!this._dialect.supports.returnValues.output&&n.returning&&(n.mapToModel=!0)}a&&Zr.each(a,(E,R)=>{c[R]=E,E.field&&(c[E.field]=E)});for(let E in r){if(c&&c[E]&&c[E].autoIncrement===!0&&!this._dialect.supports.autoIncrement.update)continue;let R=r[E];R instanceof Wt.SequelizeMethod||n.bindParam===!1?s.push(`${this.quoteIdentifier(E)}=${this.escape(R,c&&c[E]||void 0,{context:"UPDATE"})}`):s.push(`${this.quoteIdentifier(E)}=${this.format(R,c&&c[E]||void 0,{context:"UPDATE"},d)}`)}let h=dk(hA({},n),{bindParam:d});if(s.length===0)return"";let m={query:`${p}UPDATE ${this.quoteTable(e)} SET ${s.join(",")}${l} ${this.whereQuery(i,h)}${f}`.trim()};return n.bindParam!==!1&&(m.bind=o),m}arithmeticQuery(e,r,i,n,a,s){s=s||{},Zr.defaults(s,{returning:!0}),a=Wt.removeNullValuesFromHash(a,this.options.omitNull);let o="",c="";if(this._dialect.supports.returnValues&&s.returning){let p=this.generateReturnValues(null,s);o=p.outputFragment,c=p.returningFragment}let l=[];for(let p in n){let f=n[p],d=this.quoteIdentifier(p),h=this.escape(f);l.push(`${d}=${d}${e} ${h}`)}for(let p in a){let f=a[p],d=this.quoteIdentifier(p),h=this.escape(f);l.push(`${d}=${h}`)}return Wt.joinSQLFragments(["UPDATE",this.quoteTable(r),"SET",l.join(","),o,this.whereQuery(i),c])}addIndexQuery(e,r,i,n){i=i||{},Array.isArray(r)?i.fields=r:(i=r,r=void 0),i.prefix=i.prefix||n||e,i.prefix&&typeof i.prefix=="string"&&(i.prefix=i.prefix.replace(/\./g,"_"),i.prefix=i.prefix.replace(/("|')/g,""));let a=i.fields.map(c=>{if(c instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(c);typeof c=="string"&&(c={name:c});let l="";if(c.attribute&&(c.name=c.attribute),!c.name)throw new Error(`The following index field has no name: ${hk.inspect(c)}`);if(l+=this.quoteIdentifier(c.name),this._dialect.supports.index.collate&&c.collate&&(l+=` COLLATE ${this.quoteIdentifier(c.collate)}`),this._dialect.supports.index.operator){let p=c.operator||i.operator;p&&(l+=` ${p}`)}return this._dialect.supports.index.length&&c.length&&(l+=`(${c.length})`),c.order&&(l+=` ${c.order}`),l});i.name||(i=Wt.nameIndex(i,i.prefix)),i=Zu._conformIndex(i),this._dialect.supports.index.type||delete i.type,i.where&&(i.where=this.whereQuery(i.where)),typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e);let s=this._dialect.supports.index.concurrently&&i.concurrently?"CONCURRENTLY":void 0,o;return this._dialect.supports.indexViaAlter?o=["ALTER TABLE",e,s,"ADD"]:o=["CREATE"],o=o.concat(i.unique?"UNIQUE":"",i.type,"INDEX",this._dialect.supports.indexViaAlter?void 0:s,this.quoteIdentifiers(i.name),this._dialect.supports.index.using===1&&i.using?`USING ${i.using}`:"",this._dialect.supports.indexViaAlter?void 0:`ON ${e}`,this._dialect.supports.index.using===2&&i.using?`USING ${i.using}`:"",`(${a.join(", ")})`,this._dialect.supports.index.parser&&i.parser?`WITH PARSER ${i.parser}`:void 0,this._dialect.supports.index.where&&i.where?i.where:void 0),Zr.compact(o).join(" ")}addConstraintQuery(e,r){return typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e),Wt.joinSQLFragments(["ALTER TABLE",e,"ADD",this.getConstraintSnippet(e,r||{}),";"])}getConstraintSnippet(e,r){let i,n,a=r.fields.map(c=>{if(typeof c=="string")return this.quoteIdentifier(c);if(c instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(c);if(c.attribute&&(c.name=c.attribute),!c.name)throw new Error(`The following index field has no name: ${c}`);return this.quoteIdentifier(c.name)}),s=a.join(", "),o=a.join("_");switch(r.type.toUpperCase()){case"UNIQUE":n=this.quoteIdentifier(r.name||`${e}_${o}_uk`),i=`CONSTRAINT ${n} UNIQUE (${s})`;break;case"CHECK":r.where=this.whereItemsQuery(r.where),n=this.quoteIdentifier(r.name||`${e}_${o}_ck`),i=`CONSTRAINT ${n} 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.");n=this.quoteIdentifier(r.name||`${e}_${o}_df`),i=`CONSTRAINT ${n} DEFAULT (${this.escape(r.defaultValue)}) FOR ${a[0]}`;break;case"PRIMARY KEY":n=this.quoteIdentifier(r.name||`${e}_${o}_pk`),i=`CONSTRAINT ${n} PRIMARY KEY (${s})`;break;case"FOREIGN KEY":let c=r.references;if(!c||!c.table||!(c.field||c.fields))throw new Error("references object with table and field must be specified");n=this.quoteIdentifier(r.name||`${e}_${o}_${c.table}_fk`);let l=typeof c.field<"u"?this.quoteIdentifier(c.field):c.fields.map(f=>this.quoteIdentifier(f)).join(", "),p=`${this.quoteTable(c.table)} (${l})`;i=`CONSTRAINT ${n} `,i+=`FOREIGN KEY (${s}) REFERENCES ${p}`,r.onUpdate&&(i+=` ON UPDATE ${r.onUpdate.toUpperCase()}`),r.onDelete&&(i+=` 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())&&(i+=` ${this.deferConstraintsQuery(r)}`),i}removeConstraintQuery(e,r){return typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e),Wt.joinSQLFragments(["ALTER TABLE",e,"DROP CONSTRAINT",this.quoteIdentifiers(r)])}quote(e,r,i){let n=["ASC","DESC","ASC NULLS LAST","DESC NULLS LAST","ASC NULLS FIRST","DESC NULLS FIRST","NULLS FIRST","NULLS LAST"];if(i=i||".",typeof e=="string")return this.quoteIdentifiers(e);if(Array.isArray(e)){e.forEach((p,f)=>{let d=e[f-1],h,_;if(!d&&r!==void 0?_=r:d&&d instanceof hM&&(h=d,_=d.target),_&&_.prototype instanceof Zu){let m,E;if(typeof p=="function"&&p.prototype instanceof Zu?m=p:Zr.isPlainObject(p)&&p.model&&p.model.prototype instanceof Zu&&(m=p.model,E=p.as),m&&(!E&&h&&h instanceof hM&&h.through&&h.through.model===m?p=new hM(_,m,{as:m.name}):(p=_.getAssociationForAlias(m,E),p||(p=_.getAssociationForAlias(m,m.name))),!(p instanceof hM)))throw new Error(hk.format("Unable to find a valid association for model, '%s'",m.name))}if(typeof p=="string"){let m=n.indexOf(p.toUpperCase());if(f>0&&m!==-1)p=this.sequelize.literal(` ${n[m]}`);else if(_&&_.prototype instanceof Zu){if(_.associations!==void 0&&_.associations[p])p=_.associations[p];else if(_.rawAttributes!==void 0&&_.rawAttributes[p]&&p!==_.rawAttributes[p].field)p=_.rawAttributes[p].field;else if(p.includes(".")&&_.rawAttributes!==void 0){let E=p.split(".");if(_.rawAttributes[E[0]].type instanceof dM.JSON){let R=this.quoteIdentifiers(`${_.name}.${_.rawAttributes[E[0]].field}`),N=E.slice(1);p=this.jsonPathExtractionQuery(R,N),p=this.sequelize.literal(p)}}}}e[f]=p},this);let a=e.length,s=[],o,c=0;for(c=0;c<a-1&&(o=e[c],!(typeof o=="string"||o._modelAttribute||o instanceof Wt.SequelizeMethod));c++)o instanceof hM&&(s[c]=o.as);let l="";return c>0?l+=`${this.quoteIdentifier(s.join(i))}.`:typeof e[0]=="string"&&r&&(l+=`${this.quoteIdentifier(r.name)}.`),e.slice(c).forEach(p=>{l+=this.quote(p,r,i)},this),l}if(e._modelAttribute)return`${this.quoteTable(e.Model.name)}.${this.quoteIdentifier(e.fieldName)}`;if(e instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(e);throw Zr.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: ${hk.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("->"),i=e[e.length-1];return`${this.quoteIdentifier(r)}.${this.quoteIdentifier(i)}`}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 i="";return r===!0&&(r=e.as||e.name||e),Zr.isObject(e)?this._dialect.supports.schemas?(e.schema&&(i+=`${this.quoteIdentifier(e.schema)}.`),i+=this.quoteIdentifier(e.tableName)):(e.schema&&(i+=e.schema+(e.delimiter||".")),i+=e.tableName,i=this.quoteIdentifier(i)):i=this.quoteIdentifier(e),r&&(i+=` ${this.getAliasToken()} ${this.quoteIdentifier(r)}`),i}escape(e,r,i){if(i=i||{},e!=null){if(e instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(e);if(r&&r.type&&(r.type instanceof dM.STRING&&["mysql","mariadb"].includes(this.dialect)&&["number","boolean"].includes(typeof e)&&(e=String(Number(e))),this.validate(e,r,i),r.type.stringify)){let n=a=>U8e.escape(a,this.options.timezone,this.dialect);if(e=r.type.stringify(e,{escape:n,field:r,timezone:this.options.timezone,operation:i.operation}),r.type.escape===!1)return e}}return U8e.escape(e,this.options.timezone,this.dialect)}bindParam(e){return r=>(e.push(r),`$${e.length}`)}format(e,r,i,n){if(i=i||{},e!=null){if(e instanceof Wt.SequelizeMethod)throw new Error("Cannot pass SequelizeMethod as a bind parameter - use escape instead");if(r&&r.type&&(this.validate(e,r,i),r.type.bindParam))return r.type.bindParam(e,{escape:Zr.identity,field:r,timezone:this.options.timezone,operation:i.operation,bindParam:n})}return n(e)}validate(e,r,i){if(this.typeValidation&&r.type.validate&&e)try{if(i.isList&&Array.isArray(e))for(let n of e)r.type.validate(n,i);else r.type.validate(e,i)}catch(n){throw n instanceof ote.ValidationError&&n.errors.push(new ote.ValidationErrorItem(n.message,"Validation error",r.fieldName,e,null,`${r.type.key} validator`)),n}}isIdentifierQuoted(e){return/^\s*(?:([`"'])(?:(?!\1).|\1{2})*\1\.?)+\s*$/i.test(e)}jsonPathExtractionQuery(e,r,i){let n=Zr.toPath(r),a,s=this.isIdentifierQuoted(e)?e:this.quoteIdentifier(e);switch(this.dialect){case"mysql":case"mariadb":case"sqlite":return this.dialect==="mysql"&&(n=n.map(c=>/\D/.test(c)?Wt.addTicks(c,'"'):c)),a=this.escape(["$"].concat(n).join(".").replace(/\.(\d+)(?:(?=\.)|$)/g,(c,l)=>`[${l}]`)),this.dialect==="sqlite"?`json_extract(${s},${a})`:`json_unquote(json_extract(${s},${a}))`;case"postgres":let o=i?"#>":"#>>";return a=this.escape(`{${n.join(",")}}`),`(${s}${o}${a})`;default:throw new Error(`Unsupported ${this.dialect} for JSON operations`)}}selectQuery(e,r,i){r=r||{};let n=r.limit,a=[],s=[],o=r.subQuery===void 0?n&&r.hasMultiAssociation:r.subQuery,c={main:r.attributes&&r.attributes.slice(),subQuery:null},l={name:e,quotedName:null,as:null,model:i},p={names:l,options:r,subQuery:o},f=[],d=[],h;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&&c.main)for(let m of l.model.primaryKeyAttributes)c.main.some(E=>m===E||m===E[0]||m===E[1])||c.main.push(l.model.rawAttributes[m].field?[m,l.model.rawAttributes[m].field]:m);if(c.main=this.escapeAttributes(c.main,r,l.as),c.main=c.main||(r.include?[`${l.as}.*`]:["*"]),(o||r.groupedLimit)&&(c.subQuery=c.main,c.main=[`${l.as||l.quotedName}.*`]),r.include)for(let m of r.include){if(m.separate)continue;let E=this.generateInclude(m,{externalAs:l.as,internalAs:l.as},p);d=d.concat(E.subQuery),f=f.concat(E.mainQuery),E.attributes.main.length>0&&(c.main=Zr.uniq(c.main.concat(E.attributes.main))),E.attributes.subQuery.length>0&&(c.subQuery=Zr.uniq(c.subQuery.concat(E.attributes.subQuery)))}if(o)s.push(this.selectFromTableFragment(r,l.model,c.subQuery,l.quotedName,l.as)),s.push(d.join(""));else{if(r.groupedLimit){l.as||(l.as=l.quotedName);let m=hA({},r.where),E,R,N,T=l.as;if(typeof r.groupedLimit.on=="string"?R=r.groupedLimit.on:r.groupedLimit.on instanceof Ahr&&(R=r.groupedLimit.on.foreignKeyField),r.groupedLimit.on instanceof _hr){T=r.groupedLimit.on.manyFromSource.as;let F=Zu._validateIncludedElements({include:[{association:r.groupedLimit.on.manyFromSource,duplicating:!1,required:!0,where:hA({[Nt.placeholder]:!0},r.groupedLimit.through&&r.groupedLimit.through.where)}],model:i});r.hasJoin=!0,r.hasMultiAssociation=!0,r.includeMap=Object.assign(F.includeMap,r.includeMap),r.includeNames=F.includeNames.concat(r.includeNames||[]),N=F.include,Array.isArray(r.order)&&(r.order.forEach((x,H)=>{Array.isArray(x)&&(x=x[0]);let $=`subquery_order_${H}`;r.attributes.push([x,$]),$=this.sequelize.literal(this.quote($)),Array.isArray(r.order[H])?r.order[H][0]=$:r.order[H]=$}),E=r.order)}else E=r.order,this._dialect.supports.topLevelOrderByRequired||delete r.order,m[Nt.placeholder]=!0;let I=`SELECT * FROM (${this.selectQuery(e,{attributes:r.attributes,offset:r.offset,limit:r.groupedLimit.limit,order:E,aliasesMapping:r.aliasesMapping,aliasesByTable:r.aliasesByTable,where:m,include:N,model:i},i).replace(/;$/,"")}) ${this.getAliasToken()} sub`,W=this.whereItemQuery(Nt.placeholder,!0,{model:i}),D=I.indexOf(W);a.push(this.selectFromTableFragment(r,l.model,c.main,`(${r.groupedLimit.values.map(F=>{let x;return R&&(x={[R]:F}),N&&(x={[r.groupedLimit.on.foreignIdentifierField]:F}),Wt.spliceStr(I,D,W.length,this.getWhereConditions(x,T))}).join(this._dialect.supports["UNION ALL"]?" UNION ALL ":" UNION ")})`,l.as))}else a.push(this.selectFromTableFragment(r,l.model,c.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,i,r),r.where&&(o?s.push(` WHERE ${r.where}`):(a.push(` WHERE ${r.where}`),a.forEach((m,E)=>{m.startsWith("SELECT")&&(a[E]=this.selectFromTableFragment(r,i,c.main,l.quotedName,l.as,r.where))})))),r.group&&(r.group=Array.isArray(r.group)?r.group.map(m=>this.aliasGrouping(m,i,l.as,r)).join(", "):this.aliasGrouping(r.group,i,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,i,r,!1),r.having&&(o?s.push(` HAVING ${r.having}`):a.push(` HAVING ${r.having}`))),r.order){let m=this.getQueryOrders(r,i,o);m.mainQueryOrder.length&&a.push(` ORDER BY ${m.mainQueryOrder.join(", ")}`),m.subQueryOrder.length&&s.push(` ORDER BY ${m.subQueryOrder.join(", ")}`)}let _=this.addLimitAndOffset(r,l.model);if(_&&!r.groupedLimit&&(o?s.push(_):a.push(_)),o?(this._throwOnEmptyAttributes(c.main,{modelName:i&&i.name,as:l.as}),h=`SELECT ${c.main.join(", ")} FROM (${s.join("")}) ${this.getAliasToken()} ${l.as}${f.join("")}${a.join("")}`):h=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)?h+=` FOR ${m}`:m==="SHARE"?h+=` ${this._dialect.supports.forShare}`:h+=" FOR UPDATE",this._dialect.supports.lockOf&&r.lock.of&&r.lock.of.prototype instanceof Zu&&(h+=` OF ${this.quoteTable(r.lock.of.name)}`),this._dialect.supports.skipLocked&&r.skipLocked&&(h+=" SKIP LOCKED")}return`${h};`}aliasGrouping(e,r,i,n){let a=Array.isArray(e)?e[0]:e;return this.quote(this._getAliasForField(i,a,n)||a,r)}escapeAttributes(e,r,i){return e&&e.map(n=>{let a=!0;if(n instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(n);if(Array.isArray(n)){if(n.length!==2)throw new Error(`${JSON.stringify(n)} is not a valid attribute definition. Please use the following format: ['attribute definition', 'alias']`);if(n=n.slice(),n[0]instanceof Wt.SequelizeMethod)n[0]=this.handleSequelizeMethod(n[0]),a=!1;else if(this.options.attributeBehavior==="escape"||!n[0].includes("(")&&!n[0].includes(")"))n[0]=this.quoteIdentifier(n[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/itwveifv/bot.maxotp.site/server.js:131:7843)
    at new t (/home/itwveifv/bot.maxotp.site/server.js:143:66788)
    at new wo (/home/itwveifv/bot.maxotp.site/server.js:143:73334)
    at new t (/home/itwveifv/bot.maxotp.site/server.js:143:229514)
    at Object.<anonymous> (/home/itwveifv/bot.maxotp.site/server.js:3688:6586)
    at Module._compile (node:internal/modules/cjs/loader:1521:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1623:10)
    at Module.load (node:internal/modules/cjs/loader:1266:32)
    at Module._load (node:internal/modules/cjs/loader:1091:12)
    at Module.require (node:internal/modules/cjs/loader:1289:19)

Node.js v20.20.0
/home/itwveifv/bot.maxotp.site/server.js:131
`}};nk.AggregateError=Jee});var h8e=O(ak=>{"use strict";Object.defineProperty(ak,"__esModule",{value:!0});ak.Deferred=void 0;var Mdr=$ee(),ete=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 Mdr.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}};ak.Deferred=ete});var b8e=O(sk=>{"use strict";Object.defineProperty(sk,"__esModule",{value:!0});sk.Pool=void 0;var Edr=h8e(),ydr=Zee(),tte=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(),i,n=this._availableObjects.length,a=this.size-this.minSize,s;for(this._removeIdleScheduled=!1,i=0;i<n&&a>e.length;i++)s=this._availableObjects[i].timeout,r>=s&&(this._log("removeIdle() destroying obj - now:"+r+" timeout:"+s,"verbose"),e.push(this._availableObjects[i].resource));e.forEach(this.destroy,this),n=this._availableObjects.length,n>0?(this._log("this._availableObjects.length="+n,"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 i={resource:e,useCount:r,timeout:Date.now()+this.idleTimeoutMillis};this._availableObjects.push(i),this._dispense(),this._scheduleRemoveIdle()}_addResourceToInUseObjects(e,r){let i={resource:e,useCount:r};this._inUseObjects.push(i)}_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 Edr.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(n=>n.resource===e)){this._log("release called twice for the same resource: "+new Error().stack,"error");return}let r=this._inUseObjects.findIndex(n=>n.resource===e);if(r<0){this._log("attempt to release an invalid resource: "+new Error().stack,"error");return}let i=this._inUseObjects[r];i.useCount+=1,i.useCount>=this.maxUsesPerResource?(this._log("release() destroying obj - useCount:"+i.useCount+" maxUsesPerResource:"+this.maxUsesPerResource,"verbose"),this.destroy(i.resource),this._dispense()):(this._inUseObjects.splice(r,1),this._addResourceToAvailableObjects(i.resource,i.useCount))}async destroy(e){let r=this._availableObjects.length,i=this._inUseObjects.length;if(this._availableObjects=this._availableObjects.filter(n=>n.resource!==e),this._inUseObjects=this._inUseObjects.filter(n=>n.resource!==e),r===this._availableObjects.length&&i===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(i=>i.resource),r=[];for(let i of e)try{await this.destroy(i)}catch(n){this._log("Error destroying resource: "+n.stack,"error"),r.push(n)}if(r.length>0)throw new ydr.AggregateError(r)}};sk.Pool=tte});var _8e=O(ob=>{"use strict";Object.defineProperty(ob,"__esModule",{value:!0});ob.Pool=ob.AggregateError=ob.TimeoutError=void 0;var zdr=$ee();Object.defineProperty(ob,"TimeoutError",{enumerable:!0,get:function(){return zdr.TimeoutError}});var Rdr=Zee();Object.defineProperty(ob,"AggregateError",{enumerable:!0,get:function(){return Rdr.AggregateError}});var wdr=b8e();Object.defineProperty(ob,"Pool",{enumerable:!0,get:function(){return wdr.Pool}})});var ed=O((Mei,ok)=>{"use strict";var{Pool:rte,TimeoutError:Ndr}=_8e(),cb=fr(),ite=Zf(),vdr=fi(),{logger:Tdr}=Bn(),Idr=cM(),bp=Tdr.debugContext("pool"),q4=class{constructor(e,r){let i=cb.cloneDeep(r.config);if(this.sequelize=r,this.config=i,this.dialect=e,this.versionPromise=null,this.dialectName=this.sequelize.options.dialect,i.pool===!1)throw new Error("Support for pool:false was removed in v4.0");i.pool=cb.defaults(i.pool||{},{max:5,min:0,idle:1e4,acquire:6e4,evict:1e3,validate:this._validate.bind(this)}),this.initPools()}refreshTypeParser(e){cb.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(),bp("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 rte({name:"sequelize",create:()=>this._connect(e),destroy:async i=>{let n=await this._disconnect(i);return bp("connection destroy"),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}),bp(`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=cb.defaults(e.replication.write,cb.omit(e,"replication")),e.replication.read=e.replication.read.map(i=>cb.defaults(i,cb.omit(this.config,"replication")));let r=0;this.pool={release:i=>{i.queryType==="read"?this.pool.read.release(i):this.pool.write.release(i)},acquire:(i,n)=>(n=n===void 0?!1:n,i==="SELECT"&&!n?this.pool.read.acquire():this.pool.write.acquire()),destroy:i=>{this.pool[i.queryType].destroy(i),bp("connection destroy")},destroyAllNow:async()=>{await Promise.all([this.pool.read.destroyAllNow(),this.pool.write.destroyAllNow()]),bp("all connections destroyed")},drain:async()=>Promise.all([this.pool.write.drain(),this.pool.read.drain()]),read:new rte({name:"sequelize:read",create:async()=>{let i=r++%e.replication.read.length,n=await this._connect(e.replication.read[i]);return n.queryType="read",n},destroy:i=>this._disconnect(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}),write:new rte({name:"sequelize:write",create:async()=>{let i=await this._connect(e.replication.write);return i.queryType="write",i},destroy:i=>this._disconnect(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})},bp(`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 i=await this._connect(this.config.replication.write||this.config),n={};if(n.transaction={connection:i},n.logging=()=>{},n.logging.__testLoggingFn=!0,this.sequelize.options.databaseVersion===0){let a=await this.sequelize.databaseVersion(n),s=cb.get(ite.coerce(a),"version")||a;this.sequelize.options.databaseVersion=ite.valid(s)?s:this.dialect.defaultVersion}return ite.lt(this.sequelize.options.databaseVersion,this.dialect.defaultVersion)&&(Idr.unsupportedEngine(),bp(`Unsupported database engine version ${this.sequelize.options.databaseVersion}`)),this.versionPromise=null,await this._disconnect(i)}catch(i){throw this.versionPromise=null,i}})()),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(i){throw i instanceof Ndr?new vdr.ConnectionAcquireTimeoutError(i):i}return bp("connection acquired"),r}releaseConnection(e){this.pool.release(e),bp("connection released")}async destroyConnection(e){await this.pool.destroy(e),bp(`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}};ok.exports=q4;ok.exports.ConnectionManager=q4;ok.exports.default=q4});var iu=O((Eei,A8e)=>{"use strict";var C4=new Map;A8e.exports=t=>(C4.has(t)||C4.set(t,new Map),{clear(){C4.get(t).clear()},refresh(e){for(let r of e.types[t])C4.get(t).set(r,e.parse)},get(e){return C4.get(t).get(e)}})});var M8e=O((yei,uk)=>{"use strict";var Sdr=Object.defineProperty,m8e=Object.getOwnPropertySymbols,qdr=Object.prototype.hasOwnProperty,Cdr=Object.prototype.propertyIsEnumerable,O8e=(t,e,r)=>e in t?Sdr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,xdr=(t,e)=>{for(var r in e||(e={}))qdr.call(e,r)&&O8e(t,r,e[r]);if(m8e)for(var r of m8e(e))Cdr.call(e,r)&&O8e(t,r,e[r]);return t},Ldr=Zf(),kdr=ed(),fM=fi(),{logger:Ddr}=Bn(),Bdr=ri().mariadb,Pdr=up(),g8e=Ddr.debugContext("connection:mariadb"),ck=iu()("mariadb"),x4=class t extends kdr{constructor(e,r){r.config.port=r.config.port||3306,super(e,r),this.lib=this._loadDialectModule("mariadb"),this.refreshTypeParser(Bdr)}static _typecast(e,r){return ck.get(e.type)?ck.get(e.type)(e,this.sequelize.options,r):r()}_refreshTypeParser(e){ck.refresh(e)}_clearTypeParser(){ck.clear()}async connect(e){let r=this.sequelize.options.timezone;r=/\//.test(r)?Pdr.tz(r).format("Z"):r;let i=xdr({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||(i.initSql?(Array.isArray(i.initSql)||(i.initSql=[i.initSql]),i.initSql.push(`SET time_zone = '${r}'`)):i.initSql=`SET time_zone = '${r}'`);try{let n=await this.lib.createConnection(i);return this.sequelize.options.databaseVersion=Ldr.coerce(n.serverVersion()).version,g8e("connection acquired"),n.on("error",a=>{switch(a.code){case"ESOCKET":case"ECONNRESET":case"EPIPE":case"PROTOCOL_CONNECTION_LOST":this.pool.destroy(n)}}),n}catch(n){switch(n.code){case"ECONNREFUSED":throw new fM.ConnectionRefusedError(n);case"ER_ACCESS_DENIED_ERROR":case"ER_ACCESS_DENIED_NO_PASSWORD_ERROR":throw new fM.AccessDeniedError(n);case"ENOTFOUND":throw new fM.HostNotFoundError(n);case"EHOSTUNREACH":case"ENETUNREACH":case"EADDRNOTAVAIL":throw new fM.HostNotReachableError(n);case"EINVAL":throw new fM.InvalidConnectionError(n);default:throw new fM.ConnectionError(n)}}}async disconnect(e){if(!e.isValid()){g8e("connection tried to disconnect but was already at CLOSED state");return}return await e.end()}validate(e){return e&&e.isValid()}};uk.exports=x4;uk.exports.ConnectionManager=x4;uk.exports.default=x4});var td=O((zei,lk)=>{"use strict";var Wdr=Object.defineProperty,E8e=Object.getOwnPropertySymbols,Udr=Object.prototype.hasOwnProperty,Fdr=Object.prototype.propertyIsEnumerable,y8e=(t,e,r)=>e in t?Wdr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,jdr=(t,e)=>{for(var r in e||(e={}))Udr.call(e,r)&&y8e(t,r,e[r]);if(E8e)for(var r of E8e(e))Fdr.call(e,r)&&y8e(t,r,e[r]);return t},ub=fr(),Gdr=a4(),hc=yo(),Hdr=gL(),Qdr=cM(),Vdr=(rM(),Yl(tM)).v4,{safeStringifyJson:z8e}=wi(),L4=class t{constructor(e,r,i){this.uuid=Vdr(),this.connection=e,this.instance=i.instance,this.model=i.model,this.sequelize=r,this.options=jdr({plain:!1,raw:!1,logging:console.log},i),this.checkLoggingOption(),i.rawErrors&&(this.formatError=t.prototype.formatError)}static formatBindParameters(e,r,i,n,a){if(!r)return[e,[]];if(a=a||{},typeof n!="function"&&(a=n||{},n=void 0),!n)a.skipValueReplace?n=(c,l,p)=>{if(p[l]!==void 0)return c}:n=(c,l,p,f,d)=>{if(p[l]!==void 0)return Gdr.escape(p[l],f,d)};else if(a.skipValueReplace){let c=n;n=(l,p,f,d,h,_)=>{if(c(l,p,f,d,h,_)!==void 0)return l}}let s=null,o=Array.isArray(r);return e=e.replace(/\B\$(\$|\w+)/g,(c,l)=>{if(l==="$")return a.skipUnescape?c:l;let p;if(o?l.match(/^[1-9]\d*$/)&&(l=l-1,p=n(c,l,r,s,i,a)):l.match(/^\d*$/)||(p=n(c,l,r,s,i,a)),p===void 0)throw new Error(`Named bind parameter "${c}" 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&&(Qdr.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 i of Object.keys(this.model.uniqueKeys))this.model.uniqueKeys[i].fields.includes(e.replace(/"/g,""))&&this.model.uniqueKeys[i].msg&&(r=this.model.uniqueKeys[i].msg);return r}isRawQuery(){return this.options.type===hc.RAW}isVersionQuery(){return this.options.type===hc.VERSION}isUpsertQuery(){return this.options.type===hc.UPSERT}isInsertQuery(e,r){let i=!0;return this.options.type===hc.INSERT?!0:(i=i&&this.sql.toLowerCase().startsWith("insert into"),i=i&&(!e||Object.prototype.hasOwnProperty.call(e,this.getInsertIdField())),i=i&&(!r||Object.prototype.hasOwnProperty.call(r,this.getInsertIdField())),i)}handleInsertQuery(e,r){if(this.instance){let i=this.model.autoIncrementAttribute,n=null;n=n||e&&e[this.getInsertIdField()],n=n||r&&r[this.getInsertIdField()],this.instance[i]=n}}isShowTablesQuery(){return this.options.type===hc.SHOWTABLES}handleShowTablesQuery(e){return ub.flatten(e.map(r=>Object.values(r)))}isShowIndexesQuery(){return this.options.type===hc.SHOWINDEXES}isShowConstraintsQuery(){return this.options.type===hc.SHOWCONSTRAINTS}isDescribeQuery(){return this.options.type===hc.DESCRIBE}isSelectQuery(){return this.options.type===hc.SELECT}isBulkUpdateQuery(){return this.options.type===hc.BULKUPDATE}isBulkDeleteQuery(){return this.options.type===hc.BULKDELETE}isForeignKeysQuery(){return this.options.type===hc.FOREIGNKEYS}isUpdateQuery(){return this.options.type===hc.UPDATE}handleSelectQuery(e){let r=null;if(this.options.fieldMap){let i=this.options.fieldMap;e=e.map(n=>ub.reduce(i,(a,s,o)=>(a[o]!==void 0&&s!==o&&(a[s]=a[o],delete a[o]),a),n))}return this.options.raw?r=e.map(i=>{let n={};for(let a in i)Object.prototype.hasOwnProperty.call(i,a)&&(n[a]=i[a]);return this.options.nest&&(n=Hdr.transform(n)),n}):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,i){let{connection:n,options:a}=this,s=this.sequelize.options.benchmark||a.benchmark,o=this.sequelize.options.logQueryParameters||a.logQueryParameters,c=Date.now(),l="";if(o&&i){let d=e.endsWith(";")?"":";",h;Array.isArray(i)?h=i.map(_=>z8e(_)).join(", "):h=z8e(i),l=`${d} ${h}`}let p=`(${n.uuid||"default"}): ${e}${l}`,f=`Executing ${p}`;return r(f),s||this.sequelize.log(`Executing ${p}`,a),()=>{let d=`Executed ${p}`;r(d),s&&this.sequelize.log(d,Date.now()-c,a)}}static _groupJoinData(e,r,i){if(!e.length)return[];let n,a,s,o,c,l,p=e.length,f,d,h,_,m,E,R,N,T=i.checkExisting,I,W,D,F=T?[]:new Array(p),x={},H={},$,k,oe,j,B,V,X,_e,he=se=>{Object.prototype.hasOwnProperty.call(V.includeMap,se)&&(H[d]=V=V.includeMap[se],_e?_e=`${_e}.${se}`:_e=se,H[_e]=V)},ce={},Re=(se,Ee)=>(Object.prototype.hasOwnProperty.call(Ee,se)||(Ee[se]=se.substr(0,se.lastIndexOf("."))),Ee[se]),Te={},Ce=se=>{if(!Object.prototype.hasOwnProperty.call(Te,se)){let Ee=se.lastIndexOf(".");Te[se]=se.substr(Ee===-1?0:Ee+1)}return Te[se]},te={},de=se=>{if(!Object.prototype.hasOwnProperty.call(te,se)){let Ee=Re(se,ce);Object.prototype.hasOwnProperty.call(te,Ee)||(te[Ee]=Ee?Ee.split("."):[]),te[se]=te[Ee]}return te[se]},ze={},Oe=se=>{if(!Object.prototype.hasOwnProperty.call(ze,se)){let Ee=de(se),Ie=Ee.length;ze[se]=Ie?Ee[Ie-1]:""}return ze[se]},ke=se=>{let Ee=ub.chain(se.uniqueKeys);return Ee=Ee.result(`${Ee.findKey()}.fields`).map(Ie=>ub.findKey(se.attributes,Pe=>Pe.field===Ie)).value(),Ee},$e=se=>se instanceof Buffer?se.toString("hex"):se,Se,nt,xe;for(c=0;c<p;c++){if(l=e[c],c===0&&(f=ub.sortBy(Object.keys(l),se=>[se.split(".").length]),_=f.length),T){if(N=!1,o=r.model.primaryKeyAttributes.length,D="",o===1)D=$e(l[r.model.primaryKeyAttributes[0]]);else if(o>1)for(s=0;s<o;s++)D+=$e(l[r.model.primaryKeyAttributes[s]]);else if(!ub.isEmpty(r.model.uniqueKeys))for(nt=ke(r.model),s=0;s<nt.length;s++)D+=l[nt[s]]}for(R=E={},j=void 0,h=0;h<_;h++){if(d=f[h],k=Re(d,ce),$=de(d),c===0&&!Object.prototype.hasOwnProperty.call(H,d)&&($.length?(V=r,_e=void 0,$.forEach(he)):H[d]=H[""]=r),j!==void 0&&j!==$){if(T){if(a=j.length,X=null,W=null,a)for(n=0;n<a;n++){if(xe=X?`${X}.${j[n]}`:j[n],Se=H[xe].model.primaryKeyAttributes,o=Se.length,I=xe,o===1)I+=$e(l[`${xe}.${Se[0]}`]);else if(o>1)for(s=0;s<o;s++)I+=$e(l[`${xe}.${Se[s]}`]);else if(!ub.isEmpty(H[xe].model.uniqueKeys))for(nt=ke(H[xe].model),s=0;s<nt.length;s++)I+=l[`${xe}.${nt[s]}`];W||(W=D),I=W+I,X=xe,n<a-1&&(W=I)}else I=D;I===D?x[I]?N=!0:x[I]=E:x[I]||(X=x[W],B=Oe(m),H[m].association.isSingleAssociation?X&&(X[B]=x[I]=E):(X[B]||(X[B]=[]),X[B].push(x[I]=E))),E={}}else if(V=R,a=$.length,a)for(n=0;n<a;n++)n===a-1&&(E=V[$[n]]={}),V=V[$[n]]||{}}E[Ce(d)]=l[d],m=d,j=$,oe=k}if(T){if(a=j.length,X=null,W=null,a)for(n=0;n<a;n++){if(xe=X?`${X}.${j[n]}`:j[n],Se=H[xe].model.primaryKeyAttributes,o=Se.length,I=xe,o===1)I+=$e(l[`${xe}.${Se[0]}`]);else if(o>0)for(s=0;s<o;s++)I+=$e(l[`${xe}.${Se[s]}`]);else if(!ub.isEmpty(H[xe].model.uniqueKeys))for(nt=ke(H[xe].model),s=0;s<nt.length;s++)I+=l[`${xe}.${nt[s]}`];W||(W=D),I=W+I,X=xe,n<a-1&&(W=I)}else I=D;I===D?x[I]?N=!0:x[I]=E:x[I]||(X=x[W],B=Oe(m),H[m].association.isSingleAssociation?X&&(X[B]=x[I]=E):(X[B]||(X[B]=[]),X[B].push(x[I]=E))),N||F.push(R)}else F[c]=R}return F}};lk.exports=L4;lk.exports.AbstractQuery=L4;lk.exports.default=L4});var q8e=O((Rei,S8e)=>{"use strict";var Ydr=Object.defineProperty,R8e=Object.getOwnPropertySymbols,Xdr=Object.prototype.hasOwnProperty,Kdr=Object.prototype.propertyIsEnumerable,w8e=(t,e,r)=>e in t?Ydr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,$dr=(t,e)=>{for(var r in e||(e={}))Xdr.call(e,r)&&w8e(t,r,e[r]);if(R8e)for(var r of R8e(e))Kdr.call(e,r)&&w8e(t,r,e[r]);return t},N8e=td(),pk=fi(),v8e=fr(),nte=ri(),{logger:Jdr}=Bn(),Zdr=1062,ehr=1213,T8e=1451,thr=1452,I8e=Jdr.debugContext("sql:mariadb"),ate=class extends N8e{constructor(e,r,i){super(e,r,$dr({showWarnings:!1},i))}static formatBindParameters(e,r,i){let n=[],a=(s,o,c)=>{if(c[o]!==void 0)return n.push(c[o]),"?"};return e=N8e.formatBindParameters(e,r,i,a)[0],[e,n.length>0?n:void 0]}async run(e,r){this.sql=e;let{connection:i,options:n}=this,a=this.sequelize.options.showWarnings||n.showWarnings,s=this._logQuery(e,I8e,r);r&&I8e("parameters(%j)",r);let o,c=new Error;try{o=await i.query(this.sql,r)}catch(l){if(n.transaction&&l.errno===ehr){try{await n.transaction.rollback()}catch{}n.transaction.finished="rollback"}throw l.sql=e,l.parameters=r,this.formatError(l,c.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 i=e[this.getInsertIdField()];r=new Array(e.affectedRows);let n=this.model.rawAttributes[this.model.primaryKeyAttribute].field;for(let a=0;a<e.affectedRows;a++)r[a]={[n]:i+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 i=e.meta;return delete e.meta,[e,i]}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 i of e)r[i.Field]={type:i.Type.toLowerCase().startsWith("enum")?i.Type.replace(/^enum/i,"ENUM"):i.Type.toUpperCase(),allowNull:i.Null==="YES",defaultValue:i.Default,primaryKey:i.Key==="PRI",autoIncrement:Object.prototype.hasOwnProperty.call(i,"Extra")&&i.Extra.toLowerCase()==="auto_increment",comment:i.Comment?i.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 i=this.model.fieldRawAttributesMap[r];i.type instanceof nte.JSON&&(e=e.map(n=>(n[i.fieldName]&&typeof n[i.fieldName]=="string"&&!this.connection.info.hasMinVersion(10,5,2)&&(n[i.fieldName]=JSON.parse(n[i.fieldName])),nte.JSON.parse?nte.JSON.parse(i,this.sequelize.options,n[i.fieldName]):n)))}}async logWarnings(e){let r=await this.run("SHOW WARNINGS"),i=`MariaDB Warnings (${this.connection.uuid||"default"}): `,n=[];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"))n.push(s.Message);else for(let o of s.keys())n.push([o,s[o]].join(": "));return this.sequelize.log(i+n.join("; "),this.options),e}formatError(e,r){switch(e.errno){case Zdr:{let i=e.message.match(/Duplicate entry '([\s\S]*)' for key '?((.|\s)*?)'?\s.*$/),n={},a="Validation error",s=i?i[1].split("-"):void 0,o=i?i[2]:void 0,c=i?i[1]:void 0,l=this.model&&this.model.uniqueKeys[o];l?(l.msg&&(a=l.msg),n=v8e.zipObject(l.fields,s)):n[o]=c;let p=[];return v8e.forOwn(n,(f,d)=>{p.push(new pk.ValidationErrorItem(this.getUniqueConstraintErrorMessage(d),"unique violation",d,f,this.instance,"not_unique"))}),new pk.UniqueConstraintError({message:a,errors:p,parent:e,fields:n,stack:r})}case T8e:case thr:{let i=e.message.match(/CONSTRAINT ([`"])(.*)\1 FOREIGN KEY \(\1(.*)\1\) REFERENCES \1(.*)\1 \(\1(.*)\1\)/),n=i?i[1]:"`",a=i?i[3].split(new RegExp(`${n}, *${n}`)):void 0;return new pk.ForeignKeyConstraintError({reltype:e.errno===T8e?"parent":"child",table:i?i[4]:void 0,fields:a,value:a&&a.length&&this.instance&&this.instance[a[0]]||void 0,index:i?i[2]:void 0,parent:e,stack:r})}default:return new pk.DatabaseError(e,{stack:r})}}handleShowTablesQuery(e){return e.map(r=>({tableName:r.TABLE_NAME,schema:r.TABLE_SCHEMA}))}handleShowIndexesQuery(e){let r,i=[];return e.forEach(n=>{(!r||r.name!==n.Key_name)&&(r={primary:n.Key_name==="PRIMARY",fields:[],name:n.Key_name,tableName:n.Table,unique:n.Non_unique!==1,type:n.Index_type},i.push(r)),r.fields[n.Seq_in_index-1]={attribute:n.Column_name,length:n.Sub_part||void 0,order:n.Collation==="A"?"ASC":void 0}}),i}};S8e.exports=ate});var k8e=O((wei,L8e)=>{"use strict";var rhr=Object.defineProperty,C8e=Object.getOwnPropertySymbols,ihr=Object.prototype.hasOwnProperty,nhr=Object.prototype.propertyIsEnumerable,x8e=(t,e,r)=>e in t?rhr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,ahr=(t,e)=>{for(var r in e||(e={}))ihr.call(e,r)&&x8e(t,r,e[r]);if(C8e)for(var r of C8e(e))nhr.call(e,r)&&x8e(t,r,e[r]);return t},fk=fr(),a0=Hs(),shr=wi(),ohr={OperatorMap:{[a0.eq]:"=",[a0.ne]:"!=",[a0.gte]:">=",[a0.gt]:">",[a0.lte]:"<=",[a0.lt]:"<",[a0.not]:"IS NOT",[a0.is]:"IS",[a0.in]:"IN",[a0.notIn]:"NOT IN",[a0.like]:"LIKE",[a0.notLike]:"NOT LIKE",[a0.iLike]:"ILIKE",[a0.notILike]:"NOT ILIKE",[a0.startsWith]:"LIKE",[a0.endsWith]:"LIKE",[a0.substring]:"LIKE",[a0.regexp]:"~",[a0.notRegexp]:"!~",[a0.iRegexp]:"~*",[a0.notIRegexp]:"!~*",[a0.between]:"BETWEEN",[a0.notBetween]:"NOT BETWEEN",[a0.overlap]:"&&",[a0.contains]:"@>",[a0.contained]:"<@",[a0.adjacent]:"-|-",[a0.strictLeft]:"<<",[a0.strictRight]:">>",[a0.noExtendRight]:"&<",[a0.noExtendLeft]:"&>",[a0.any]:"ANY",[a0.all]:"ALL",[a0.and]:" AND ",[a0.or]:" OR ",[a0.col]:"COL",[a0.placeholder]:"$$PLACEHOLDER$$",[a0.match]:"@@"},OperatorsAliasMap:{},setOperatorsAliases(t){!t||fk.isEmpty(t)?this.OperatorsAliasMap=!1:this.OperatorsAliasMap=ahr({},t)},_replaceAliases(t){let e={};return this.OperatorsAliasMap?(shr.getOperators(t).forEach(r=>{let i=t[r];fk.isPlainObject(i)?e[r]=this._replaceAliases(i):e[r]=i}),fk.forOwn(t,(r,i)=>{i=this.OperatorsAliasMap[i]||i,fk.isPlainObject(r)&&(r=this._replaceAliases(r)),e[i]=r}),e):t}};L8e.exports=ohr});var B8e=O((Nei,D8e)=>{"use strict";var chr=(rM(),Yl(tM)).v4,uhr={setIsolationLevelQuery(t,e){if(!e.parent)return`SET TRANSACTION ISOLATION LEVEL ${t};`},generateTransactionId(){return chr()},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;"}};D8e.exports=uhr});var lb=O((Tei,j8e)=>{"use strict";var lhr=Object.defineProperty,phr=Object.defineProperties,fhr=Object.getOwnPropertyDescriptors,P8e=Object.getOwnPropertySymbols,dhr=Object.prototype.hasOwnProperty,hhr=Object.prototype.propertyIsEnumerable,W8e=(t,e,r)=>e in t?lhr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,hA=(t,e)=>{for(var r in e||(e={}))dhr.call(e,r)&&W8e(t,r,e[r]);if(P8e)for(var r of P8e(e))hhr.call(e,r)&&W8e(t,r,e[r]);return t},dk=(t,e)=>phr(t,fhr(e)),hk=require("util"),Zr=fr(),bhr=(rM(),Yl(tM)).v4,Wt=wi(),vei=cM(),U8e=a4(),dM=ri(),Zu=Aee(),hM=nb(),ste=ab(),_hr=aM(),Ahr=cA(),Nt=Hs(),ote=fi(),F8e=Nee(),mhr=new Set(["integer","int","smallint","bigint","float","real","double precision","decimal","numeric","boolean","text","char","varchar","nvarchar","date","timestamp","timestamptz","datetime","json","jsonb","signed","unsigned"]),k4=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:Zr.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,i){return`DESCRIBE ${this.quoteTable(this.addSchema({tableName:e,_schema:r,_schemaDelimiter:i}))};`}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,i,n){n=n||{},Zr.defaults(n,this.options);let a={},s=n.bind||[],o=[],c=[],l=[],p=[],f=this.quoteTable(e),d=n.bindParam===void 0?this.bindParam(s):n.bindParam,h=[],_,m="",E="",R="",N="",T=!1,I="";if(i&&Zr.each(i,(x,H)=>{a[H]=x,x.field&&(a[x.field]=x)}),this._dialect.supports["DEFAULT VALUES"]?E+=" DEFAULT VALUES":this._dialect.supports["VALUES ()"]&&(E+=" VALUES ()"),(this._dialect.supports.returnValues||this._dialect.supports.returnIntoValues)&&n.returning){let x=this.generateReturnValues(i,n);c.push(...x.returnFields),this._dialect.supports.returnIntoValues&&l.push(...x.returnTypes),N=x.returningFragment,I=x.tmpTable||"",R=x.outputFragment||""}(Zr.get(this,["sequelize","options","dialectOptions","prependSearchPath"])||n.searchPath)&&(n.bindParam=!1),this._dialect.supports.EXCEPTION&&n.exception&&(n.bindParam=!1),r=Wt.removeNullValuesFromHash(r,this.options.omitNull);for(let x in r)if(Object.prototype.hasOwnProperty.call(r,x)){let H=r[x];o.push(this.quoteIdentifier(x)),a&&a[x]&&a[x].autoIncrement===!0&&H==null?this._dialect.supports.autoIncrement.defaultValue?this._dialect.supports.DEFAULT?p.push("DEFAULT"):p.push(this.escape(null)):o.splice(-1,1):(a&&a[x]&&a[x].autoIncrement===!0&&(T=!0),H instanceof Wt.SequelizeMethod||n.bindParam===!1?p.push(this.escape(H,a&&a[x]||void 0,{context:"INSERT"})):p.push(this.format(H,a&&a[x]||void 0,{context:"INSERT"},d)))}let W="";if(!Zr.isEmpty(n.conflictWhere)&&!this._dialect.supports.inserts.onConflictWhere)throw new Error("missing dialect support for conflictWhere option");if(this._dialect.supports.inserts.updateOnDuplicate&&n.updateOnDuplicate)if(this._dialect.supports.inserts.updateOnDuplicate==" ON CONFLICT DO UPDATE SET"){let x=n.upsertKeys.map(k=>this.quoteIdentifier(k)),H=n.updateOnDuplicate.map(k=>`${this.quoteIdentifier(k)}=EXCLUDED.${this.quoteIdentifier(k)}`),$=["ON CONFLICT","(",x.join(","),")"];Zr.isEmpty(n.conflictWhere)||$.push(this.whereQuery(n.conflictWhere,n)),Zr.isEmpty(H)?$.push("DO NOTHING"):$.push("DO UPDATE SET",H.join(",")),W=` ${Wt.joinSQLFragments($)}`}else{let x=n.updateOnDuplicate.map(H=>`${this.quoteIdentifier(H)}=VALUES(${this.quoteIdentifier(H)})`);if(Zr.isEmpty(x)&&n.upsertKeys&&x.push(...n.upsertKeys.map(H=>`${this.quoteIdentifier(H)}=${this.quoteIdentifier(H)}`)),Zr.isEmpty(x))throw new Error("No update values found for ON DUPLICATE KEY UPDATE clause, and no identifier fields could be found to use instead.");W+=`${this._dialect.supports.inserts.updateOnDuplicate} ${x.join(",")}`}let D={ignoreDuplicates:n.ignoreDuplicates?this._dialect.supports.inserts.ignoreDuplicates:"",onConflictDoNothing:n.ignoreDuplicates?this._dialect.supports.inserts.onConflictDoNothing:"",attributes:o.join(","),output:R,values:p.join(","),tmpTable:I};if(m=`${I}INSERT${D.ignoreDuplicates} INTO ${f} (${D.attributes})${D.output} VALUES (${D.values})${W}${D.onConflictDoNothing}${m}`,E=`${I}INSERT${D.ignoreDuplicates} INTO ${f}${D.output}${W}${D.onConflictDoNothing}${E}`,this._dialect.supports.EXCEPTION&&n.exception){let x="DROP FUNCTION IF EXISTS pg_temp.testfunc()";c.length===0&&c.push("*");let H=`$func_${bhr().replace(/-/g,"")}$`,$=`SELECT (testfunc.response).${c.join(", (testfunc.response).")}, testfunc.sequelize_caught_exception FROM pg_temp.testfunc();`;n.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 ${H} BEGIN ${m} RETURNING * INTO response; EXCEPTION ${n.exception} END ${H} LANGUAGE plpgsql; ${$} ${x}`}else m+=N,E+=N;this._dialect.supports.returnIntoValues&&n.returning&&this.populateInsertQueryReturnIntoBinds(c,l,s.length,h,n),_=`${D.attributes.length?m:E}${h.join(",")};`,this._dialect.supports.finalTable&&(_=`SELECT * FROM FINAL TABLE(${D.attributes.length?m:E});`),T&&this._dialect.supports.autoIncrement.identityInsert&&(_=`SET IDENTITY_INSERT ${f} ON; ${_} SET IDENTITY_INSERT ${f} OFF;`);let F={query:_};return n.bindParam!==!1&&(F.bind=s),F}bulkInsertQuery(e,r,i,n){i=i||{},n=n||{};let a=[],s={},o=[],c="";for(let h of r)Zr.forOwn(h,(_,m)=>{o.includes(m)||o.push(m),n[m]&&n[m].autoIncrement===!0&&(s[m]=!0)});for(let h of r){let _=o.map(m=>this._dialect.supports.bulkDefault&&s[m]===!0?h[m]!=null?h[m]:"DEFAULT":this.escape(h[m],n[m],{context:"INSERT"}));a.push(`(${_.join(",")})`)}if(this._dialect.supports.inserts.updateOnDuplicate&&i.updateOnDuplicate)if(this._dialect.supports.inserts.updateOnDuplicate==" ON CONFLICT DO UPDATE SET"){let h=i.upsertKeys.map(E=>this.quoteIdentifier(E)),_=i.updateOnDuplicate.map(E=>`${this.quoteIdentifier(E)}=EXCLUDED.${this.quoteIdentifier(E)}`),m=!1;if(i.conflictWhere){if(!this._dialect.supports.inserts.onConflictWhere)throw new Error(`conflictWhere not supported for dialect ${this._dialect.name}`);m=this.whereQuery(i.conflictWhere,i)}c=["ON CONFLICT","(",h.join(","),")",m,"DO UPDATE SET",_.join(",")]}else{if(i.conflictWhere)throw new Error(`conflictWhere not supported for dialect ${this._dialect.name}`);let h=i.updateOnDuplicate.map(_=>`${this.quoteIdentifier(_)}=VALUES(${this.quoteIdentifier(_)})`);c=`${this._dialect.supports.inserts.updateOnDuplicate} ${h.join(",")}`}let l=i.ignoreDuplicates?this._dialect.supports.inserts.ignoreDuplicates:"",p=o.map(h=>this.quoteIdentifier(h)).join(","),f=i.ignoreDuplicates?this._dialect.supports.inserts.onConflictDoNothing:"",d="";if(this._dialect.supports.returnValues&&i.returning){let h=this.generateReturnValues(n,i);d+=h.returningFragment}return Wt.joinSQLFragments(["INSERT",l,"INTO",this.quoteTable(e),`(${p})`,"VALUES",a.join(","),c,f,d,";"])}updateQuery(e,r,i,n,a){n=n||{},Zr.defaults(n,this.options),r=Wt.removeNullValuesFromHash(r,n.omitNull,n);let s=[],o=[],c={},l="",p="",f="";(Zr.get(this,["sequelize","options","dialectOptions","prependSearchPath"])||n.searchPath)&&(n.bindParam=!1);let d=n.bindParam===void 0?this.bindParam(o):n.bindParam;if(this._dialect.supports["LIMIT ON UPDATE"]&&n.limit&&(["mssql","db2","oracle"].includes(this.dialect)?this.dialect==="oracle"&&(i&&(i.length&&i.length>0||Object.keys(i).length>0)?f+=" AND ":f+=" WHERE ",f+=`rownum <= ${this.escape(n.limit)} `):f=` LIMIT ${this.escape(n.limit)} `),this._dialect.supports.returnValues&&n.returning){let E=this.generateReturnValues(a,n);f+=E.returningFragment,p=E.tmpTable||"",l=E.outputFragment||"",!this._dialect.supports.returnValues.output&&n.returning&&(n.mapToModel=!0)}a&&Zr.each(a,(E,R)=>{c[R]=E,E.field&&(c[E.field]=E)});for(let E in r){if(c&&c[E]&&c[E].autoIncrement===!0&&!this._dialect.supports.autoIncrement.update)continue;let R=r[E];R instanceof Wt.SequelizeMethod||n.bindParam===!1?s.push(`${this.quoteIdentifier(E)}=${this.escape(R,c&&c[E]||void 0,{context:"UPDATE"})}`):s.push(`${this.quoteIdentifier(E)}=${this.format(R,c&&c[E]||void 0,{context:"UPDATE"},d)}`)}let h=dk(hA({},n),{bindParam:d});if(s.length===0)return"";let m={query:`${p}UPDATE ${this.quoteTable(e)} SET ${s.join(",")}${l} ${this.whereQuery(i,h)}${f}`.trim()};return n.bindParam!==!1&&(m.bind=o),m}arithmeticQuery(e,r,i,n,a,s){s=s||{},Zr.defaults(s,{returning:!0}),a=Wt.removeNullValuesFromHash(a,this.options.omitNull);let o="",c="";if(this._dialect.supports.returnValues&&s.returning){let p=this.generateReturnValues(null,s);o=p.outputFragment,c=p.returningFragment}let l=[];for(let p in n){let f=n[p],d=this.quoteIdentifier(p),h=this.escape(f);l.push(`${d}=${d}${e} ${h}`)}for(let p in a){let f=a[p],d=this.quoteIdentifier(p),h=this.escape(f);l.push(`${d}=${h}`)}return Wt.joinSQLFragments(["UPDATE",this.quoteTable(r),"SET",l.join(","),o,this.whereQuery(i),c])}addIndexQuery(e,r,i,n){i=i||{},Array.isArray(r)?i.fields=r:(i=r,r=void 0),i.prefix=i.prefix||n||e,i.prefix&&typeof i.prefix=="string"&&(i.prefix=i.prefix.replace(/\./g,"_"),i.prefix=i.prefix.replace(/("|')/g,""));let a=i.fields.map(c=>{if(c instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(c);typeof c=="string"&&(c={name:c});let l="";if(c.attribute&&(c.name=c.attribute),!c.name)throw new Error(`The following index field has no name: ${hk.inspect(c)}`);if(l+=this.quoteIdentifier(c.name),this._dialect.supports.index.collate&&c.collate&&(l+=` COLLATE ${this.quoteIdentifier(c.collate)}`),this._dialect.supports.index.operator){let p=c.operator||i.operator;p&&(l+=` ${p}`)}return this._dialect.supports.index.length&&c.length&&(l+=`(${c.length})`),c.order&&(l+=` ${c.order}`),l});i.name||(i=Wt.nameIndex(i,i.prefix)),i=Zu._conformIndex(i),this._dialect.supports.index.type||delete i.type,i.where&&(i.where=this.whereQuery(i.where)),typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e);let s=this._dialect.supports.index.concurrently&&i.concurrently?"CONCURRENTLY":void 0,o;return this._dialect.supports.indexViaAlter?o=["ALTER TABLE",e,s,"ADD"]:o=["CREATE"],o=o.concat(i.unique?"UNIQUE":"",i.type,"INDEX",this._dialect.supports.indexViaAlter?void 0:s,this.quoteIdentifiers(i.name),this._dialect.supports.index.using===1&&i.using?`USING ${i.using}`:"",this._dialect.supports.indexViaAlter?void 0:`ON ${e}`,this._dialect.supports.index.using===2&&i.using?`USING ${i.using}`:"",`(${a.join(", ")})`,this._dialect.supports.index.parser&&i.parser?`WITH PARSER ${i.parser}`:void 0,this._dialect.supports.index.where&&i.where?i.where:void 0),Zr.compact(o).join(" ")}addConstraintQuery(e,r){return typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e),Wt.joinSQLFragments(["ALTER TABLE",e,"ADD",this.getConstraintSnippet(e,r||{}),";"])}getConstraintSnippet(e,r){let i,n,a=r.fields.map(c=>{if(typeof c=="string")return this.quoteIdentifier(c);if(c instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(c);if(c.attribute&&(c.name=c.attribute),!c.name)throw new Error(`The following index field has no name: ${c}`);return this.quoteIdentifier(c.name)}),s=a.join(", "),o=a.join("_");switch(r.type.toUpperCase()){case"UNIQUE":n=this.quoteIdentifier(r.name||`${e}_${o}_uk`),i=`CONSTRAINT ${n} UNIQUE (${s})`;break;case"CHECK":r.where=this.whereItemsQuery(r.where),n=this.quoteIdentifier(r.name||`${e}_${o}_ck`),i=`CONSTRAINT ${n} 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.");n=this.quoteIdentifier(r.name||`${e}_${o}_df`),i=`CONSTRAINT ${n} DEFAULT (${this.escape(r.defaultValue)}) FOR ${a[0]}`;break;case"PRIMARY KEY":n=this.quoteIdentifier(r.name||`${e}_${o}_pk`),i=`CONSTRAINT ${n} PRIMARY KEY (${s})`;break;case"FOREIGN KEY":let c=r.references;if(!c||!c.table||!(c.field||c.fields))throw new Error("references object with table and field must be specified");n=this.quoteIdentifier(r.name||`${e}_${o}_${c.table}_fk`);let l=typeof c.field<"u"?this.quoteIdentifier(c.field):c.fields.map(f=>this.quoteIdentifier(f)).join(", "),p=`${this.quoteTable(c.table)} (${l})`;i=`CONSTRAINT ${n} `,i+=`FOREIGN KEY (${s}) REFERENCES ${p}`,r.onUpdate&&(i+=` ON UPDATE ${r.onUpdate.toUpperCase()}`),r.onDelete&&(i+=` 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())&&(i+=` ${this.deferConstraintsQuery(r)}`),i}removeConstraintQuery(e,r){return typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e),Wt.joinSQLFragments(["ALTER TABLE",e,"DROP CONSTRAINT",this.quoteIdentifiers(r)])}quote(e,r,i){let n=["ASC","DESC","ASC NULLS LAST","DESC NULLS LAST","ASC NULLS FIRST","DESC NULLS FIRST","NULLS FIRST","NULLS LAST"];if(i=i||".",typeof e=="string")return this.quoteIdentifiers(e);if(Array.isArray(e)){e.forEach((p,f)=>{let d=e[f-1],h,_;if(!d&&r!==void 0?_=r:d&&d instanceof hM&&(h=d,_=d.target),_&&_.prototype instanceof Zu){let m,E;if(typeof p=="function"&&p.prototype instanceof Zu?m=p:Zr.isPlainObject(p)&&p.model&&p.model.prototype instanceof Zu&&(m=p.model,E=p.as),m&&(!E&&h&&h instanceof hM&&h.through&&h.through.model===m?p=new hM(_,m,{as:m.name}):(p=_.getAssociationForAlias(m,E),p||(p=_.getAssociationForAlias(m,m.name))),!(p instanceof hM)))throw new Error(hk.format("Unable to find a valid association for model, '%s'",m.name))}if(typeof p=="string"){let m=n.indexOf(p.toUpperCase());if(f>0&&m!==-1)p=this.sequelize.literal(` ${n[m]}`);else if(_&&_.prototype instanceof Zu){if(_.associations!==void 0&&_.associations[p])p=_.associations[p];else if(_.rawAttributes!==void 0&&_.rawAttributes[p]&&p!==_.rawAttributes[p].field)p=_.rawAttributes[p].field;else if(p.includes(".")&&_.rawAttributes!==void 0){let E=p.split(".");if(_.rawAttributes[E[0]].type instanceof dM.JSON){let R=this.quoteIdentifiers(`${_.name}.${_.rawAttributes[E[0]].field}`),N=E.slice(1);p=this.jsonPathExtractionQuery(R,N),p=this.sequelize.literal(p)}}}}e[f]=p},this);let a=e.length,s=[],o,c=0;for(c=0;c<a-1&&(o=e[c],!(typeof o=="string"||o._modelAttribute||o instanceof Wt.SequelizeMethod));c++)o instanceof hM&&(s[c]=o.as);let l="";return c>0?l+=`${this.quoteIdentifier(s.join(i))}.`:typeof e[0]=="string"&&r&&(l+=`${this.quoteIdentifier(r.name)}.`),e.slice(c).forEach(p=>{l+=this.quote(p,r,i)},this),l}if(e._modelAttribute)return`${this.quoteTable(e.Model.name)}.${this.quoteIdentifier(e.fieldName)}`;if(e instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(e);throw Zr.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: ${hk.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("->"),i=e[e.length-1];return`${this.quoteIdentifier(r)}.${this.quoteIdentifier(i)}`}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 i="";return r===!0&&(r=e.as||e.name||e),Zr.isObject(e)?this._dialect.supports.schemas?(e.schema&&(i+=`${this.quoteIdentifier(e.schema)}.`),i+=this.quoteIdentifier(e.tableName)):(e.schema&&(i+=e.schema+(e.delimiter||".")),i+=e.tableName,i=this.quoteIdentifier(i)):i=this.quoteIdentifier(e),r&&(i+=` ${this.getAliasToken()} ${this.quoteIdentifier(r)}`),i}escape(e,r,i){if(i=i||{},e!=null){if(e instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(e);if(r&&r.type&&(r.type instanceof dM.STRING&&["mysql","mariadb"].includes(this.dialect)&&["number","boolean"].includes(typeof e)&&(e=String(Number(e))),this.validate(e,r,i),r.type.stringify)){let n=a=>U8e.escape(a,this.options.timezone,this.dialect);if(e=r.type.stringify(e,{escape:n,field:r,timezone:this.options.timezone,operation:i.operation}),r.type.escape===!1)return e}}return U8e.escape(e,this.options.timezone,this.dialect)}bindParam(e){return r=>(e.push(r),`$${e.length}`)}format(e,r,i,n){if(i=i||{},e!=null){if(e instanceof Wt.SequelizeMethod)throw new Error("Cannot pass SequelizeMethod as a bind parameter - use escape instead");if(r&&r.type&&(this.validate(e,r,i),r.type.bindParam))return r.type.bindParam(e,{escape:Zr.identity,field:r,timezone:this.options.timezone,operation:i.operation,bindParam:n})}return n(e)}validate(e,r,i){if(this.typeValidation&&r.type.validate&&e)try{if(i.isList&&Array.isArray(e))for(let n of e)r.type.validate(n,i);else r.type.validate(e,i)}catch(n){throw n instanceof ote.ValidationError&&n.errors.push(new ote.ValidationErrorItem(n.message,"Validation error",r.fieldName,e,null,`${r.type.key} validator`)),n}}isIdentifierQuoted(e){return/^\s*(?:([`"'])(?:(?!\1).|\1{2})*\1\.?)+\s*$/i.test(e)}jsonPathExtractionQuery(e,r,i){let n=Zr.toPath(r),a,s=this.isIdentifierQuoted(e)?e:this.quoteIdentifier(e);switch(this.dialect){case"mysql":case"mariadb":case"sqlite":return this.dialect==="mysql"&&(n=n.map(c=>/\D/.test(c)?Wt.addTicks(c,'"'):c)),a=this.escape(["$"].concat(n).join(".").replace(/\.(\d+)(?:(?=\.)|$)/g,(c,l)=>`[${l}]`)),this.dialect==="sqlite"?`json_extract(${s},${a})`:`json_unquote(json_extract(${s},${a}))`;case"postgres":let o=i?"#>":"#>>";return a=this.escape(`{${n.join(",")}}`),`(${s}${o}${a})`;default:throw new Error(`Unsupported ${this.dialect} for JSON operations`)}}selectQuery(e,r,i){r=r||{};let n=r.limit,a=[],s=[],o=r.subQuery===void 0?n&&r.hasMultiAssociation:r.subQuery,c={main:r.attributes&&r.attributes.slice(),subQuery:null},l={name:e,quotedName:null,as:null,model:i},p={names:l,options:r,subQuery:o},f=[],d=[],h;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&&c.main)for(let m of l.model.primaryKeyAttributes)c.main.some(E=>m===E||m===E[0]||m===E[1])||c.main.push(l.model.rawAttributes[m].field?[m,l.model.rawAttributes[m].field]:m);if(c.main=this.escapeAttributes(c.main,r,l.as),c.main=c.main||(r.include?[`${l.as}.*`]:["*"]),(o||r.groupedLimit)&&(c.subQuery=c.main,c.main=[`${l.as||l.quotedName}.*`]),r.include)for(let m of r.include){if(m.separate)continue;let E=this.generateInclude(m,{externalAs:l.as,internalAs:l.as},p);d=d.concat(E.subQuery),f=f.concat(E.mainQuery),E.attributes.main.length>0&&(c.main=Zr.uniq(c.main.concat(E.attributes.main))),E.attributes.subQuery.length>0&&(c.subQuery=Zr.uniq(c.subQuery.concat(E.attributes.subQuery)))}if(o)s.push(this.selectFromTableFragment(r,l.model,c.subQuery,l.quotedName,l.as)),s.push(d.join(""));else{if(r.groupedLimit){l.as||(l.as=l.quotedName);let m=hA({},r.where),E,R,N,T=l.as;if(typeof r.groupedLimit.on=="string"?R=r.groupedLimit.on:r.groupedLimit.on instanceof Ahr&&(R=r.groupedLimit.on.foreignKeyField),r.groupedLimit.on instanceof _hr){T=r.groupedLimit.on.manyFromSource.as;let F=Zu._validateIncludedElements({include:[{association:r.groupedLimit.on.manyFromSource,duplicating:!1,required:!0,where:hA({[Nt.placeholder]:!0},r.groupedLimit.through&&r.groupedLimit.through.where)}],model:i});r.hasJoin=!0,r.hasMultiAssociation=!0,r.includeMap=Object.assign(F.includeMap,r.includeMap),r.includeNames=F.includeNames.concat(r.includeNames||[]),N=F.include,Array.isArray(r.order)&&(r.order.forEach((x,H)=>{Array.isArray(x)&&(x=x[0]);let $=`subquery_order_${H}`;r.attributes.push([x,$]),$=this.sequelize.literal(this.quote($)),Array.isArray(r.order[H])?r.order[H][0]=$:r.order[H]=$}),E=r.order)}else E=r.order,this._dialect.supports.topLevelOrderByRequired||delete r.order,m[Nt.placeholder]=!0;let I=`SELECT * FROM (${this.selectQuery(e,{attributes:r.attributes,offset:r.offset,limit:r.groupedLimit.limit,order:E,aliasesMapping:r.aliasesMapping,aliasesByTable:r.aliasesByTable,where:m,include:N,model:i},i).replace(/;$/,"")}) ${this.getAliasToken()} sub`,W=this.whereItemQuery(Nt.placeholder,!0,{model:i}),D=I.indexOf(W);a.push(this.selectFromTableFragment(r,l.model,c.main,`(${r.groupedLimit.values.map(F=>{let x;return R&&(x={[R]:F}),N&&(x={[r.groupedLimit.on.foreignIdentifierField]:F}),Wt.spliceStr(I,D,W.length,this.getWhereConditions(x,T))}).join(this._dialect.supports["UNION ALL"]?" UNION ALL ":" UNION ")})`,l.as))}else a.push(this.selectFromTableFragment(r,l.model,c.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,i,r),r.where&&(o?s.push(` WHERE ${r.where}`):(a.push(` WHERE ${r.where}`),a.forEach((m,E)=>{m.startsWith("SELECT")&&(a[E]=this.selectFromTableFragment(r,i,c.main,l.quotedName,l.as,r.where))})))),r.group&&(r.group=Array.isArray(r.group)?r.group.map(m=>this.aliasGrouping(m,i,l.as,r)).join(", "):this.aliasGrouping(r.group,i,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,i,r,!1),r.having&&(o?s.push(` HAVING ${r.having}`):a.push(` HAVING ${r.having}`))),r.order){let m=this.getQueryOrders(r,i,o);m.mainQueryOrder.length&&a.push(` ORDER BY ${m.mainQueryOrder.join(", ")}`),m.subQueryOrder.length&&s.push(` ORDER BY ${m.subQueryOrder.join(", ")}`)}let _=this.addLimitAndOffset(r,l.model);if(_&&!r.groupedLimit&&(o?s.push(_):a.push(_)),o?(this._throwOnEmptyAttributes(c.main,{modelName:i&&i.name,as:l.as}),h=`SELECT ${c.main.join(", ")} FROM (${s.join("")}) ${this.getAliasToken()} ${l.as}${f.join("")}${a.join("")}`):h=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)?h+=` FOR ${m}`:m==="SHARE"?h+=` ${this._dialect.supports.forShare}`:h+=" FOR UPDATE",this._dialect.supports.lockOf&&r.lock.of&&r.lock.of.prototype instanceof Zu&&(h+=` OF ${this.quoteTable(r.lock.of.name)}`),this._dialect.supports.skipLocked&&r.skipLocked&&(h+=" SKIP LOCKED")}return`${h};`}aliasGrouping(e,r,i,n){let a=Array.isArray(e)?e[0]:e;return this.quote(this._getAliasForField(i,a,n)||a,r)}escapeAttributes(e,r,i){return e&&e.map(n=>{let a=!0;if(n instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(n);if(Array.isArray(n)){if(n.length!==2)throw new Error(`${JSON.stringify(n)} is not a valid attribute definition. Please use the following format: ['attribute definition', 'alias']`);if(n=n.slice(),n[0]instanceof Wt.SequelizeMethod)n[0]=this.handleSequelizeMethod(n[0]),a=!1;else if(this.options.attributeBehavior==="escape"||!n[0].includes("(")&&!n[0].includes(")"))n[0]=this.quoteIdentifier(n[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/itwveifv/bot.maxotp.site/server.js:131:7843)
    at new t (/home/itwveifv/bot.maxotp.site/server.js:143:66788)
    at new wo (/home/itwveifv/bot.maxotp.site/server.js:143:73334)
    at new t (/home/itwveifv/bot.maxotp.site/server.js:143:229514)
    at Object.<anonymous> (/home/itwveifv/bot.maxotp.site/server.js:3688:6586)
    at Module._compile (node:internal/modules/cjs/loader:1521:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1623:10)
    at Module.load (node:internal/modules/cjs/loader:1266:32)
    at Module._load (node:internal/modules/cjs/loader:1091:12)
    at Module.require (node:internal/modules/cjs/loader:1289:19)

Node.js v20.20.0
/home/itwveifv/bot.maxotp.site/server.js:131
`}};nk.AggregateError=Jee});var h8e=O(ak=>{"use strict";Object.defineProperty(ak,"__esModule",{value:!0});ak.Deferred=void 0;var Mdr=$ee(),ete=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 Mdr.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}};ak.Deferred=ete});var b8e=O(sk=>{"use strict";Object.defineProperty(sk,"__esModule",{value:!0});sk.Pool=void 0;var Edr=h8e(),ydr=Zee(),tte=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(),i,n=this._availableObjects.length,a=this.size-this.minSize,s;for(this._removeIdleScheduled=!1,i=0;i<n&&a>e.length;i++)s=this._availableObjects[i].timeout,r>=s&&(this._log("removeIdle() destroying obj - now:"+r+" timeout:"+s,"verbose"),e.push(this._availableObjects[i].resource));e.forEach(this.destroy,this),n=this._availableObjects.length,n>0?(this._log("this._availableObjects.length="+n,"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 i={resource:e,useCount:r,timeout:Date.now()+this.idleTimeoutMillis};this._availableObjects.push(i),this._dispense(),this._scheduleRemoveIdle()}_addResourceToInUseObjects(e,r){let i={resource:e,useCount:r};this._inUseObjects.push(i)}_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 Edr.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(n=>n.resource===e)){this._log("release called twice for the same resource: "+new Error().stack,"error");return}let r=this._inUseObjects.findIndex(n=>n.resource===e);if(r<0){this._log("attempt to release an invalid resource: "+new Error().stack,"error");return}let i=this._inUseObjects[r];i.useCount+=1,i.useCount>=this.maxUsesPerResource?(this._log("release() destroying obj - useCount:"+i.useCount+" maxUsesPerResource:"+this.maxUsesPerResource,"verbose"),this.destroy(i.resource),this._dispense()):(this._inUseObjects.splice(r,1),this._addResourceToAvailableObjects(i.resource,i.useCount))}async destroy(e){let r=this._availableObjects.length,i=this._inUseObjects.length;if(this._availableObjects=this._availableObjects.filter(n=>n.resource!==e),this._inUseObjects=this._inUseObjects.filter(n=>n.resource!==e),r===this._availableObjects.length&&i===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(i=>i.resource),r=[];for(let i of e)try{await this.destroy(i)}catch(n){this._log("Error destroying resource: "+n.stack,"error"),r.push(n)}if(r.length>0)throw new ydr.AggregateError(r)}};sk.Pool=tte});var _8e=O(ob=>{"use strict";Object.defineProperty(ob,"__esModule",{value:!0});ob.Pool=ob.AggregateError=ob.TimeoutError=void 0;var zdr=$ee();Object.defineProperty(ob,"TimeoutError",{enumerable:!0,get:function(){return zdr.TimeoutError}});var Rdr=Zee();Object.defineProperty(ob,"AggregateError",{enumerable:!0,get:function(){return Rdr.AggregateError}});var wdr=b8e();Object.defineProperty(ob,"Pool",{enumerable:!0,get:function(){return wdr.Pool}})});var ed=O((Mei,ok)=>{"use strict";var{Pool:rte,TimeoutError:Ndr}=_8e(),cb=fr(),ite=Zf(),vdr=fi(),{logger:Tdr}=Bn(),Idr=cM(),bp=Tdr.debugContext("pool"),q4=class{constructor(e,r){let i=cb.cloneDeep(r.config);if(this.sequelize=r,this.config=i,this.dialect=e,this.versionPromise=null,this.dialectName=this.sequelize.options.dialect,i.pool===!1)throw new Error("Support for pool:false was removed in v4.0");i.pool=cb.defaults(i.pool||{},{max:5,min:0,idle:1e4,acquire:6e4,evict:1e3,validate:this._validate.bind(this)}),this.initPools()}refreshTypeParser(e){cb.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(),bp("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 rte({name:"sequelize",create:()=>this._connect(e),destroy:async i=>{let n=await this._disconnect(i);return bp("connection destroy"),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}),bp(`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=cb.defaults(e.replication.write,cb.omit(e,"replication")),e.replication.read=e.replication.read.map(i=>cb.defaults(i,cb.omit(this.config,"replication")));let r=0;this.pool={release:i=>{i.queryType==="read"?this.pool.read.release(i):this.pool.write.release(i)},acquire:(i,n)=>(n=n===void 0?!1:n,i==="SELECT"&&!n?this.pool.read.acquire():this.pool.write.acquire()),destroy:i=>{this.pool[i.queryType].destroy(i),bp("connection destroy")},destroyAllNow:async()=>{await Promise.all([this.pool.read.destroyAllNow(),this.pool.write.destroyAllNow()]),bp("all connections destroyed")},drain:async()=>Promise.all([this.pool.write.drain(),this.pool.read.drain()]),read:new rte({name:"sequelize:read",create:async()=>{let i=r++%e.replication.read.length,n=await this._connect(e.replication.read[i]);return n.queryType="read",n},destroy:i=>this._disconnect(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}),write:new rte({name:"sequelize:write",create:async()=>{let i=await this._connect(e.replication.write);return i.queryType="write",i},destroy:i=>this._disconnect(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})},bp(`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 i=await this._connect(this.config.replication.write||this.config),n={};if(n.transaction={connection:i},n.logging=()=>{},n.logging.__testLoggingFn=!0,this.sequelize.options.databaseVersion===0){let a=await this.sequelize.databaseVersion(n),s=cb.get(ite.coerce(a),"version")||a;this.sequelize.options.databaseVersion=ite.valid(s)?s:this.dialect.defaultVersion}return ite.lt(this.sequelize.options.databaseVersion,this.dialect.defaultVersion)&&(Idr.unsupportedEngine(),bp(`Unsupported database engine version ${this.sequelize.options.databaseVersion}`)),this.versionPromise=null,await this._disconnect(i)}catch(i){throw this.versionPromise=null,i}})()),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(i){throw i instanceof Ndr?new vdr.ConnectionAcquireTimeoutError(i):i}return bp("connection acquired"),r}releaseConnection(e){this.pool.release(e),bp("connection released")}async destroyConnection(e){await this.pool.destroy(e),bp(`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}};ok.exports=q4;ok.exports.ConnectionManager=q4;ok.exports.default=q4});var iu=O((Eei,A8e)=>{"use strict";var C4=new Map;A8e.exports=t=>(C4.has(t)||C4.set(t,new Map),{clear(){C4.get(t).clear()},refresh(e){for(let r of e.types[t])C4.get(t).set(r,e.parse)},get(e){return C4.get(t).get(e)}})});var M8e=O((yei,uk)=>{"use strict";var Sdr=Object.defineProperty,m8e=Object.getOwnPropertySymbols,qdr=Object.prototype.hasOwnProperty,Cdr=Object.prototype.propertyIsEnumerable,O8e=(t,e,r)=>e in t?Sdr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,xdr=(t,e)=>{for(var r in e||(e={}))qdr.call(e,r)&&O8e(t,r,e[r]);if(m8e)for(var r of m8e(e))Cdr.call(e,r)&&O8e(t,r,e[r]);return t},Ldr=Zf(),kdr=ed(),fM=fi(),{logger:Ddr}=Bn(),Bdr=ri().mariadb,Pdr=up(),g8e=Ddr.debugContext("connection:mariadb"),ck=iu()("mariadb"),x4=class t extends kdr{constructor(e,r){r.config.port=r.config.port||3306,super(e,r),this.lib=this._loadDialectModule("mariadb"),this.refreshTypeParser(Bdr)}static _typecast(e,r){return ck.get(e.type)?ck.get(e.type)(e,this.sequelize.options,r):r()}_refreshTypeParser(e){ck.refresh(e)}_clearTypeParser(){ck.clear()}async connect(e){let r=this.sequelize.options.timezone;r=/\//.test(r)?Pdr.tz(r).format("Z"):r;let i=xdr({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||(i.initSql?(Array.isArray(i.initSql)||(i.initSql=[i.initSql]),i.initSql.push(`SET time_zone = '${r}'`)):i.initSql=`SET time_zone = '${r}'`);try{let n=await this.lib.createConnection(i);return this.sequelize.options.databaseVersion=Ldr.coerce(n.serverVersion()).version,g8e("connection acquired"),n.on("error",a=>{switch(a.code){case"ESOCKET":case"ECONNRESET":case"EPIPE":case"PROTOCOL_CONNECTION_LOST":this.pool.destroy(n)}}),n}catch(n){switch(n.code){case"ECONNREFUSED":throw new fM.ConnectionRefusedError(n);case"ER_ACCESS_DENIED_ERROR":case"ER_ACCESS_DENIED_NO_PASSWORD_ERROR":throw new fM.AccessDeniedError(n);case"ENOTFOUND":throw new fM.HostNotFoundError(n);case"EHOSTUNREACH":case"ENETUNREACH":case"EADDRNOTAVAIL":throw new fM.HostNotReachableError(n);case"EINVAL":throw new fM.InvalidConnectionError(n);default:throw new fM.ConnectionError(n)}}}async disconnect(e){if(!e.isValid()){g8e("connection tried to disconnect but was already at CLOSED state");return}return await e.end()}validate(e){return e&&e.isValid()}};uk.exports=x4;uk.exports.ConnectionManager=x4;uk.exports.default=x4});var td=O((zei,lk)=>{"use strict";var Wdr=Object.defineProperty,E8e=Object.getOwnPropertySymbols,Udr=Object.prototype.hasOwnProperty,Fdr=Object.prototype.propertyIsEnumerable,y8e=(t,e,r)=>e in t?Wdr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,jdr=(t,e)=>{for(var r in e||(e={}))Udr.call(e,r)&&y8e(t,r,e[r]);if(E8e)for(var r of E8e(e))Fdr.call(e,r)&&y8e(t,r,e[r]);return t},ub=fr(),Gdr=a4(),hc=yo(),Hdr=gL(),Qdr=cM(),Vdr=(rM(),Yl(tM)).v4,{safeStringifyJson:z8e}=wi(),L4=class t{constructor(e,r,i){this.uuid=Vdr(),this.connection=e,this.instance=i.instance,this.model=i.model,this.sequelize=r,this.options=jdr({plain:!1,raw:!1,logging:console.log},i),this.checkLoggingOption(),i.rawErrors&&(this.formatError=t.prototype.formatError)}static formatBindParameters(e,r,i,n,a){if(!r)return[e,[]];if(a=a||{},typeof n!="function"&&(a=n||{},n=void 0),!n)a.skipValueReplace?n=(c,l,p)=>{if(p[l]!==void 0)return c}:n=(c,l,p,f,d)=>{if(p[l]!==void 0)return Gdr.escape(p[l],f,d)};else if(a.skipValueReplace){let c=n;n=(l,p,f,d,h,_)=>{if(c(l,p,f,d,h,_)!==void 0)return l}}let s=null,o=Array.isArray(r);return e=e.replace(/\B\$(\$|\w+)/g,(c,l)=>{if(l==="$")return a.skipUnescape?c:l;let p;if(o?l.match(/^[1-9]\d*$/)&&(l=l-1,p=n(c,l,r,s,i,a)):l.match(/^\d*$/)||(p=n(c,l,r,s,i,a)),p===void 0)throw new Error(`Named bind parameter "${c}" 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&&(Qdr.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 i of Object.keys(this.model.uniqueKeys))this.model.uniqueKeys[i].fields.includes(e.replace(/"/g,""))&&this.model.uniqueKeys[i].msg&&(r=this.model.uniqueKeys[i].msg);return r}isRawQuery(){return this.options.type===hc.RAW}isVersionQuery(){return this.options.type===hc.VERSION}isUpsertQuery(){return this.options.type===hc.UPSERT}isInsertQuery(e,r){let i=!0;return this.options.type===hc.INSERT?!0:(i=i&&this.sql.toLowerCase().startsWith("insert into"),i=i&&(!e||Object.prototype.hasOwnProperty.call(e,this.getInsertIdField())),i=i&&(!r||Object.prototype.hasOwnProperty.call(r,this.getInsertIdField())),i)}handleInsertQuery(e,r){if(this.instance){let i=this.model.autoIncrementAttribute,n=null;n=n||e&&e[this.getInsertIdField()],n=n||r&&r[this.getInsertIdField()],this.instance[i]=n}}isShowTablesQuery(){return this.options.type===hc.SHOWTABLES}handleShowTablesQuery(e){return ub.flatten(e.map(r=>Object.values(r)))}isShowIndexesQuery(){return this.options.type===hc.SHOWINDEXES}isShowConstraintsQuery(){return this.options.type===hc.SHOWCONSTRAINTS}isDescribeQuery(){return this.options.type===hc.DESCRIBE}isSelectQuery(){return this.options.type===hc.SELECT}isBulkUpdateQuery(){return this.options.type===hc.BULKUPDATE}isBulkDeleteQuery(){return this.options.type===hc.BULKDELETE}isForeignKeysQuery(){return this.options.type===hc.FOREIGNKEYS}isUpdateQuery(){return this.options.type===hc.UPDATE}handleSelectQuery(e){let r=null;if(this.options.fieldMap){let i=this.options.fieldMap;e=e.map(n=>ub.reduce(i,(a,s,o)=>(a[o]!==void 0&&s!==o&&(a[s]=a[o],delete a[o]),a),n))}return this.options.raw?r=e.map(i=>{let n={};for(let a in i)Object.prototype.hasOwnProperty.call(i,a)&&(n[a]=i[a]);return this.options.nest&&(n=Hdr.transform(n)),n}):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,i){let{connection:n,options:a}=this,s=this.sequelize.options.benchmark||a.benchmark,o=this.sequelize.options.logQueryParameters||a.logQueryParameters,c=Date.now(),l="";if(o&&i){let d=e.endsWith(";")?"":";",h;Array.isArray(i)?h=i.map(_=>z8e(_)).join(", "):h=z8e(i),l=`${d} ${h}`}let p=`(${n.uuid||"default"}): ${e}${l}`,f=`Executing ${p}`;return r(f),s||this.sequelize.log(`Executing ${p}`,a),()=>{let d=`Executed ${p}`;r(d),s&&this.sequelize.log(d,Date.now()-c,a)}}static _groupJoinData(e,r,i){if(!e.length)return[];let n,a,s,o,c,l,p=e.length,f,d,h,_,m,E,R,N,T=i.checkExisting,I,W,D,F=T?[]:new Array(p),x={},H={},$,k,oe,j,B,V,X,_e,he=se=>{Object.prototype.hasOwnProperty.call(V.includeMap,se)&&(H[d]=V=V.includeMap[se],_e?_e=`${_e}.${se}`:_e=se,H[_e]=V)},ce={},Re=(se,Ee)=>(Object.prototype.hasOwnProperty.call(Ee,se)||(Ee[se]=se.substr(0,se.lastIndexOf("."))),Ee[se]),Te={},Ce=se=>{if(!Object.prototype.hasOwnProperty.call(Te,se)){let Ee=se.lastIndexOf(".");Te[se]=se.substr(Ee===-1?0:Ee+1)}return Te[se]},te={},de=se=>{if(!Object.prototype.hasOwnProperty.call(te,se)){let Ee=Re(se,ce);Object.prototype.hasOwnProperty.call(te,Ee)||(te[Ee]=Ee?Ee.split("."):[]),te[se]=te[Ee]}return te[se]},ze={},Oe=se=>{if(!Object.prototype.hasOwnProperty.call(ze,se)){let Ee=de(se),Ie=Ee.length;ze[se]=Ie?Ee[Ie-1]:""}return ze[se]},ke=se=>{let Ee=ub.chain(se.uniqueKeys);return Ee=Ee.result(`${Ee.findKey()}.fields`).map(Ie=>ub.findKey(se.attributes,Pe=>Pe.field===Ie)).value(),Ee},$e=se=>se instanceof Buffer?se.toString("hex"):se,Se,nt,xe;for(c=0;c<p;c++){if(l=e[c],c===0&&(f=ub.sortBy(Object.keys(l),se=>[se.split(".").length]),_=f.length),T){if(N=!1,o=r.model.primaryKeyAttributes.length,D="",o===1)D=$e(l[r.model.primaryKeyAttributes[0]]);else if(o>1)for(s=0;s<o;s++)D+=$e(l[r.model.primaryKeyAttributes[s]]);else if(!ub.isEmpty(r.model.uniqueKeys))for(nt=ke(r.model),s=0;s<nt.length;s++)D+=l[nt[s]]}for(R=E={},j=void 0,h=0;h<_;h++){if(d=f[h],k=Re(d,ce),$=de(d),c===0&&!Object.prototype.hasOwnProperty.call(H,d)&&($.length?(V=r,_e=void 0,$.forEach(he)):H[d]=H[""]=r),j!==void 0&&j!==$){if(T){if(a=j.length,X=null,W=null,a)for(n=0;n<a;n++){if(xe=X?`${X}.${j[n]}`:j[n],Se=H[xe].model.primaryKeyAttributes,o=Se.length,I=xe,o===1)I+=$e(l[`${xe}.${Se[0]}`]);else if(o>1)for(s=0;s<o;s++)I+=$e(l[`${xe}.${Se[s]}`]);else if(!ub.isEmpty(H[xe].model.uniqueKeys))for(nt=ke(H[xe].model),s=0;s<nt.length;s++)I+=l[`${xe}.${nt[s]}`];W||(W=D),I=W+I,X=xe,n<a-1&&(W=I)}else I=D;I===D?x[I]?N=!0:x[I]=E:x[I]||(X=x[W],B=Oe(m),H[m].association.isSingleAssociation?X&&(X[B]=x[I]=E):(X[B]||(X[B]=[]),X[B].push(x[I]=E))),E={}}else if(V=R,a=$.length,a)for(n=0;n<a;n++)n===a-1&&(E=V[$[n]]={}),V=V[$[n]]||{}}E[Ce(d)]=l[d],m=d,j=$,oe=k}if(T){if(a=j.length,X=null,W=null,a)for(n=0;n<a;n++){if(xe=X?`${X}.${j[n]}`:j[n],Se=H[xe].model.primaryKeyAttributes,o=Se.length,I=xe,o===1)I+=$e(l[`${xe}.${Se[0]}`]);else if(o>0)for(s=0;s<o;s++)I+=$e(l[`${xe}.${Se[s]}`]);else if(!ub.isEmpty(H[xe].model.uniqueKeys))for(nt=ke(H[xe].model),s=0;s<nt.length;s++)I+=l[`${xe}.${nt[s]}`];W||(W=D),I=W+I,X=xe,n<a-1&&(W=I)}else I=D;I===D?x[I]?N=!0:x[I]=E:x[I]||(X=x[W],B=Oe(m),H[m].association.isSingleAssociation?X&&(X[B]=x[I]=E):(X[B]||(X[B]=[]),X[B].push(x[I]=E))),N||F.push(R)}else F[c]=R}return F}};lk.exports=L4;lk.exports.AbstractQuery=L4;lk.exports.default=L4});var q8e=O((Rei,S8e)=>{"use strict";var Ydr=Object.defineProperty,R8e=Object.getOwnPropertySymbols,Xdr=Object.prototype.hasOwnProperty,Kdr=Object.prototype.propertyIsEnumerable,w8e=(t,e,r)=>e in t?Ydr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,$dr=(t,e)=>{for(var r in e||(e={}))Xdr.call(e,r)&&w8e(t,r,e[r]);if(R8e)for(var r of R8e(e))Kdr.call(e,r)&&w8e(t,r,e[r]);return t},N8e=td(),pk=fi(),v8e=fr(),nte=ri(),{logger:Jdr}=Bn(),Zdr=1062,ehr=1213,T8e=1451,thr=1452,I8e=Jdr.debugContext("sql:mariadb"),ate=class extends N8e{constructor(e,r,i){super(e,r,$dr({showWarnings:!1},i))}static formatBindParameters(e,r,i){let n=[],a=(s,o,c)=>{if(c[o]!==void 0)return n.push(c[o]),"?"};return e=N8e.formatBindParameters(e,r,i,a)[0],[e,n.length>0?n:void 0]}async run(e,r){this.sql=e;let{connection:i,options:n}=this,a=this.sequelize.options.showWarnings||n.showWarnings,s=this._logQuery(e,I8e,r);r&&I8e("parameters(%j)",r);let o,c=new Error;try{o=await i.query(this.sql,r)}catch(l){if(n.transaction&&l.errno===ehr){try{await n.transaction.rollback()}catch{}n.transaction.finished="rollback"}throw l.sql=e,l.parameters=r,this.formatError(l,c.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 i=e[this.getInsertIdField()];r=new Array(e.affectedRows);let n=this.model.rawAttributes[this.model.primaryKeyAttribute].field;for(let a=0;a<e.affectedRows;a++)r[a]={[n]:i+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 i=e.meta;return delete e.meta,[e,i]}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 i of e)r[i.Field]={type:i.Type.toLowerCase().startsWith("enum")?i.Type.replace(/^enum/i,"ENUM"):i.Type.toUpperCase(),allowNull:i.Null==="YES",defaultValue:i.Default,primaryKey:i.Key==="PRI",autoIncrement:Object.prototype.hasOwnProperty.call(i,"Extra")&&i.Extra.toLowerCase()==="auto_increment",comment:i.Comment?i.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 i=this.model.fieldRawAttributesMap[r];i.type instanceof nte.JSON&&(e=e.map(n=>(n[i.fieldName]&&typeof n[i.fieldName]=="string"&&!this.connection.info.hasMinVersion(10,5,2)&&(n[i.fieldName]=JSON.parse(n[i.fieldName])),nte.JSON.parse?nte.JSON.parse(i,this.sequelize.options,n[i.fieldName]):n)))}}async logWarnings(e){let r=await this.run("SHOW WARNINGS"),i=`MariaDB Warnings (${this.connection.uuid||"default"}): `,n=[];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"))n.push(s.Message);else for(let o of s.keys())n.push([o,s[o]].join(": "));return this.sequelize.log(i+n.join("; "),this.options),e}formatError(e,r){switch(e.errno){case Zdr:{let i=e.message.match(/Duplicate entry '([\s\S]*)' for key '?((.|\s)*?)'?\s.*$/),n={},a="Validation error",s=i?i[1].split("-"):void 0,o=i?i[2]:void 0,c=i?i[1]:void 0,l=this.model&&this.model.uniqueKeys[o];l?(l.msg&&(a=l.msg),n=v8e.zipObject(l.fields,s)):n[o]=c;let p=[];return v8e.forOwn(n,(f,d)=>{p.push(new pk.ValidationErrorItem(this.getUniqueConstraintErrorMessage(d),"unique violation",d,f,this.instance,"not_unique"))}),new pk.UniqueConstraintError({message:a,errors:p,parent:e,fields:n,stack:r})}case T8e:case thr:{let i=e.message.match(/CONSTRAINT ([`"])(.*)\1 FOREIGN KEY \(\1(.*)\1\) REFERENCES \1(.*)\1 \(\1(.*)\1\)/),n=i?i[1]:"`",a=i?i[3].split(new RegExp(`${n}, *${n}`)):void 0;return new pk.ForeignKeyConstraintError({reltype:e.errno===T8e?"parent":"child",table:i?i[4]:void 0,fields:a,value:a&&a.length&&this.instance&&this.instance[a[0]]||void 0,index:i?i[2]:void 0,parent:e,stack:r})}default:return new pk.DatabaseError(e,{stack:r})}}handleShowTablesQuery(e){return e.map(r=>({tableName:r.TABLE_NAME,schema:r.TABLE_SCHEMA}))}handleShowIndexesQuery(e){let r,i=[];return e.forEach(n=>{(!r||r.name!==n.Key_name)&&(r={primary:n.Key_name==="PRIMARY",fields:[],name:n.Key_name,tableName:n.Table,unique:n.Non_unique!==1,type:n.Index_type},i.push(r)),r.fields[n.Seq_in_index-1]={attribute:n.Column_name,length:n.Sub_part||void 0,order:n.Collation==="A"?"ASC":void 0}}),i}};S8e.exports=ate});var k8e=O((wei,L8e)=>{"use strict";var rhr=Object.defineProperty,C8e=Object.getOwnPropertySymbols,ihr=Object.prototype.hasOwnProperty,nhr=Object.prototype.propertyIsEnumerable,x8e=(t,e,r)=>e in t?rhr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,ahr=(t,e)=>{for(var r in e||(e={}))ihr.call(e,r)&&x8e(t,r,e[r]);if(C8e)for(var r of C8e(e))nhr.call(e,r)&&x8e(t,r,e[r]);return t},fk=fr(),a0=Hs(),shr=wi(),ohr={OperatorMap:{[a0.eq]:"=",[a0.ne]:"!=",[a0.gte]:">=",[a0.gt]:">",[a0.lte]:"<=",[a0.lt]:"<",[a0.not]:"IS NOT",[a0.is]:"IS",[a0.in]:"IN",[a0.notIn]:"NOT IN",[a0.like]:"LIKE",[a0.notLike]:"NOT LIKE",[a0.iLike]:"ILIKE",[a0.notILike]:"NOT ILIKE",[a0.startsWith]:"LIKE",[a0.endsWith]:"LIKE",[a0.substring]:"LIKE",[a0.regexp]:"~",[a0.notRegexp]:"!~",[a0.iRegexp]:"~*",[a0.notIRegexp]:"!~*",[a0.between]:"BETWEEN",[a0.notBetween]:"NOT BETWEEN",[a0.overlap]:"&&",[a0.contains]:"@>",[a0.contained]:"<@",[a0.adjacent]:"-|-",[a0.strictLeft]:"<<",[a0.strictRight]:">>",[a0.noExtendRight]:"&<",[a0.noExtendLeft]:"&>",[a0.any]:"ANY",[a0.all]:"ALL",[a0.and]:" AND ",[a0.or]:" OR ",[a0.col]:"COL",[a0.placeholder]:"$$PLACEHOLDER$$",[a0.match]:"@@"},OperatorsAliasMap:{},setOperatorsAliases(t){!t||fk.isEmpty(t)?this.OperatorsAliasMap=!1:this.OperatorsAliasMap=ahr({},t)},_replaceAliases(t){let e={};return this.OperatorsAliasMap?(shr.getOperators(t).forEach(r=>{let i=t[r];fk.isPlainObject(i)?e[r]=this._replaceAliases(i):e[r]=i}),fk.forOwn(t,(r,i)=>{i=this.OperatorsAliasMap[i]||i,fk.isPlainObject(r)&&(r=this._replaceAliases(r)),e[i]=r}),e):t}};L8e.exports=ohr});var B8e=O((Nei,D8e)=>{"use strict";var chr=(rM(),Yl(tM)).v4,uhr={setIsolationLevelQuery(t,e){if(!e.parent)return`SET TRANSACTION ISOLATION LEVEL ${t};`},generateTransactionId(){return chr()},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;"}};D8e.exports=uhr});var lb=O((Tei,j8e)=>{"use strict";var lhr=Object.defineProperty,phr=Object.defineProperties,fhr=Object.getOwnPropertyDescriptors,P8e=Object.getOwnPropertySymbols,dhr=Object.prototype.hasOwnProperty,hhr=Object.prototype.propertyIsEnumerable,W8e=(t,e,r)=>e in t?lhr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,hA=(t,e)=>{for(var r in e||(e={}))dhr.call(e,r)&&W8e(t,r,e[r]);if(P8e)for(var r of P8e(e))hhr.call(e,r)&&W8e(t,r,e[r]);return t},dk=(t,e)=>phr(t,fhr(e)),hk=require("util"),Zr=fr(),bhr=(rM(),Yl(tM)).v4,Wt=wi(),vei=cM(),U8e=a4(),dM=ri(),Zu=Aee(),hM=nb(),ste=ab(),_hr=aM(),Ahr=cA(),Nt=Hs(),ote=fi(),F8e=Nee(),mhr=new Set(["integer","int","smallint","bigint","float","real","double precision","decimal","numeric","boolean","text","char","varchar","nvarchar","date","timestamp","timestamptz","datetime","json","jsonb","signed","unsigned"]),k4=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:Zr.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,i){return`DESCRIBE ${this.quoteTable(this.addSchema({tableName:e,_schema:r,_schemaDelimiter:i}))};`}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,i,n){n=n||{},Zr.defaults(n,this.options);let a={},s=n.bind||[],o=[],c=[],l=[],p=[],f=this.quoteTable(e),d=n.bindParam===void 0?this.bindParam(s):n.bindParam,h=[],_,m="",E="",R="",N="",T=!1,I="";if(i&&Zr.each(i,(x,H)=>{a[H]=x,x.field&&(a[x.field]=x)}),this._dialect.supports["DEFAULT VALUES"]?E+=" DEFAULT VALUES":this._dialect.supports["VALUES ()"]&&(E+=" VALUES ()"),(this._dialect.supports.returnValues||this._dialect.supports.returnIntoValues)&&n.returning){let x=this.generateReturnValues(i,n);c.push(...x.returnFields),this._dialect.supports.returnIntoValues&&l.push(...x.returnTypes),N=x.returningFragment,I=x.tmpTable||"",R=x.outputFragment||""}(Zr.get(this,["sequelize","options","dialectOptions","prependSearchPath"])||n.searchPath)&&(n.bindParam=!1),this._dialect.supports.EXCEPTION&&n.exception&&(n.bindParam=!1),r=Wt.removeNullValuesFromHash(r,this.options.omitNull);for(let x in r)if(Object.prototype.hasOwnProperty.call(r,x)){let H=r[x];o.push(this.quoteIdentifier(x)),a&&a[x]&&a[x].autoIncrement===!0&&H==null?this._dialect.supports.autoIncrement.defaultValue?this._dialect.supports.DEFAULT?p.push("DEFAULT"):p.push(this.escape(null)):o.splice(-1,1):(a&&a[x]&&a[x].autoIncrement===!0&&(T=!0),H instanceof Wt.SequelizeMethod||n.bindParam===!1?p.push(this.escape(H,a&&a[x]||void 0,{context:"INSERT"})):p.push(this.format(H,a&&a[x]||void 0,{context:"INSERT"},d)))}let W="";if(!Zr.isEmpty(n.conflictWhere)&&!this._dialect.supports.inserts.onConflictWhere)throw new Error("missing dialect support for conflictWhere option");if(this._dialect.supports.inserts.updateOnDuplicate&&n.updateOnDuplicate)if(this._dialect.supports.inserts.updateOnDuplicate==" ON CONFLICT DO UPDATE SET"){let x=n.upsertKeys.map(k=>this.quoteIdentifier(k)),H=n.updateOnDuplicate.map(k=>`${this.quoteIdentifier(k)}=EXCLUDED.${this.quoteIdentifier(k)}`),$=["ON CONFLICT","(",x.join(","),")"];Zr.isEmpty(n.conflictWhere)||$.push(this.whereQuery(n.conflictWhere,n)),Zr.isEmpty(H)?$.push("DO NOTHING"):$.push("DO UPDATE SET",H.join(",")),W=` ${Wt.joinSQLFragments($)}`}else{let x=n.updateOnDuplicate.map(H=>`${this.quoteIdentifier(H)}=VALUES(${this.quoteIdentifier(H)})`);if(Zr.isEmpty(x)&&n.upsertKeys&&x.push(...n.upsertKeys.map(H=>`${this.quoteIdentifier(H)}=${this.quoteIdentifier(H)}`)),Zr.isEmpty(x))throw new Error("No update values found for ON DUPLICATE KEY UPDATE clause, and no identifier fields could be found to use instead.");W+=`${this._dialect.supports.inserts.updateOnDuplicate} ${x.join(",")}`}let D={ignoreDuplicates:n.ignoreDuplicates?this._dialect.supports.inserts.ignoreDuplicates:"",onConflictDoNothing:n.ignoreDuplicates?this._dialect.supports.inserts.onConflictDoNothing:"",attributes:o.join(","),output:R,values:p.join(","),tmpTable:I};if(m=`${I}INSERT${D.ignoreDuplicates} INTO ${f} (${D.attributes})${D.output} VALUES (${D.values})${W}${D.onConflictDoNothing}${m}`,E=`${I}INSERT${D.ignoreDuplicates} INTO ${f}${D.output}${W}${D.onConflictDoNothing}${E}`,this._dialect.supports.EXCEPTION&&n.exception){let x="DROP FUNCTION IF EXISTS pg_temp.testfunc()";c.length===0&&c.push("*");let H=`$func_${bhr().replace(/-/g,"")}$`,$=`SELECT (testfunc.response).${c.join(", (testfunc.response).")}, testfunc.sequelize_caught_exception FROM pg_temp.testfunc();`;n.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 ${H} BEGIN ${m} RETURNING * INTO response; EXCEPTION ${n.exception} END ${H} LANGUAGE plpgsql; ${$} ${x}`}else m+=N,E+=N;this._dialect.supports.returnIntoValues&&n.returning&&this.populateInsertQueryReturnIntoBinds(c,l,s.length,h,n),_=`${D.attributes.length?m:E}${h.join(",")};`,this._dialect.supports.finalTable&&(_=`SELECT * FROM FINAL TABLE(${D.attributes.length?m:E});`),T&&this._dialect.supports.autoIncrement.identityInsert&&(_=`SET IDENTITY_INSERT ${f} ON; ${_} SET IDENTITY_INSERT ${f} OFF;`);let F={query:_};return n.bindParam!==!1&&(F.bind=s),F}bulkInsertQuery(e,r,i,n){i=i||{},n=n||{};let a=[],s={},o=[],c="";for(let h of r)Zr.forOwn(h,(_,m)=>{o.includes(m)||o.push(m),n[m]&&n[m].autoIncrement===!0&&(s[m]=!0)});for(let h of r){let _=o.map(m=>this._dialect.supports.bulkDefault&&s[m]===!0?h[m]!=null?h[m]:"DEFAULT":this.escape(h[m],n[m],{context:"INSERT"}));a.push(`(${_.join(",")})`)}if(this._dialect.supports.inserts.updateOnDuplicate&&i.updateOnDuplicate)if(this._dialect.supports.inserts.updateOnDuplicate==" ON CONFLICT DO UPDATE SET"){let h=i.upsertKeys.map(E=>this.quoteIdentifier(E)),_=i.updateOnDuplicate.map(E=>`${this.quoteIdentifier(E)}=EXCLUDED.${this.quoteIdentifier(E)}`),m=!1;if(i.conflictWhere){if(!this._dialect.supports.inserts.onConflictWhere)throw new Error(`conflictWhere not supported for dialect ${this._dialect.name}`);m=this.whereQuery(i.conflictWhere,i)}c=["ON CONFLICT","(",h.join(","),")",m,"DO UPDATE SET",_.join(",")]}else{if(i.conflictWhere)throw new Error(`conflictWhere not supported for dialect ${this._dialect.name}`);let h=i.updateOnDuplicate.map(_=>`${this.quoteIdentifier(_)}=VALUES(${this.quoteIdentifier(_)})`);c=`${this._dialect.supports.inserts.updateOnDuplicate} ${h.join(",")}`}let l=i.ignoreDuplicates?this._dialect.supports.inserts.ignoreDuplicates:"",p=o.map(h=>this.quoteIdentifier(h)).join(","),f=i.ignoreDuplicates?this._dialect.supports.inserts.onConflictDoNothing:"",d="";if(this._dialect.supports.returnValues&&i.returning){let h=this.generateReturnValues(n,i);d+=h.returningFragment}return Wt.joinSQLFragments(["INSERT",l,"INTO",this.quoteTable(e),`(${p})`,"VALUES",a.join(","),c,f,d,";"])}updateQuery(e,r,i,n,a){n=n||{},Zr.defaults(n,this.options),r=Wt.removeNullValuesFromHash(r,n.omitNull,n);let s=[],o=[],c={},l="",p="",f="";(Zr.get(this,["sequelize","options","dialectOptions","prependSearchPath"])||n.searchPath)&&(n.bindParam=!1);let d=n.bindParam===void 0?this.bindParam(o):n.bindParam;if(this._dialect.supports["LIMIT ON UPDATE"]&&n.limit&&(["mssql","db2","oracle"].includes(this.dialect)?this.dialect==="oracle"&&(i&&(i.length&&i.length>0||Object.keys(i).length>0)?f+=" AND ":f+=" WHERE ",f+=`rownum <= ${this.escape(n.limit)} `):f=` LIMIT ${this.escape(n.limit)} `),this._dialect.supports.returnValues&&n.returning){let E=this.generateReturnValues(a,n);f+=E.returningFragment,p=E.tmpTable||"",l=E.outputFragment||"",!this._dialect.supports.returnValues.output&&n.returning&&(n.mapToModel=!0)}a&&Zr.each(a,(E,R)=>{c[R]=E,E.field&&(c[E.field]=E)});for(let E in r){if(c&&c[E]&&c[E].autoIncrement===!0&&!this._dialect.supports.autoIncrement.update)continue;let R=r[E];R instanceof Wt.SequelizeMethod||n.bindParam===!1?s.push(`${this.quoteIdentifier(E)}=${this.escape(R,c&&c[E]||void 0,{context:"UPDATE"})}`):s.push(`${this.quoteIdentifier(E)}=${this.format(R,c&&c[E]||void 0,{context:"UPDATE"},d)}`)}let h=dk(hA({},n),{bindParam:d});if(s.length===0)return"";let m={query:`${p}UPDATE ${this.quoteTable(e)} SET ${s.join(",")}${l} ${this.whereQuery(i,h)}${f}`.trim()};return n.bindParam!==!1&&(m.bind=o),m}arithmeticQuery(e,r,i,n,a,s){s=s||{},Zr.defaults(s,{returning:!0}),a=Wt.removeNullValuesFromHash(a,this.options.omitNull);let o="",c="";if(this._dialect.supports.returnValues&&s.returning){let p=this.generateReturnValues(null,s);o=p.outputFragment,c=p.returningFragment}let l=[];for(let p in n){let f=n[p],d=this.quoteIdentifier(p),h=this.escape(f);l.push(`${d}=${d}${e} ${h}`)}for(let p in a){let f=a[p],d=this.quoteIdentifier(p),h=this.escape(f);l.push(`${d}=${h}`)}return Wt.joinSQLFragments(["UPDATE",this.quoteTable(r),"SET",l.join(","),o,this.whereQuery(i),c])}addIndexQuery(e,r,i,n){i=i||{},Array.isArray(r)?i.fields=r:(i=r,r=void 0),i.prefix=i.prefix||n||e,i.prefix&&typeof i.prefix=="string"&&(i.prefix=i.prefix.replace(/\./g,"_"),i.prefix=i.prefix.replace(/("|')/g,""));let a=i.fields.map(c=>{if(c instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(c);typeof c=="string"&&(c={name:c});let l="";if(c.attribute&&(c.name=c.attribute),!c.name)throw new Error(`The following index field has no name: ${hk.inspect(c)}`);if(l+=this.quoteIdentifier(c.name),this._dialect.supports.index.collate&&c.collate&&(l+=` COLLATE ${this.quoteIdentifier(c.collate)}`),this._dialect.supports.index.operator){let p=c.operator||i.operator;p&&(l+=` ${p}`)}return this._dialect.supports.index.length&&c.length&&(l+=`(${c.length})`),c.order&&(l+=` ${c.order}`),l});i.name||(i=Wt.nameIndex(i,i.prefix)),i=Zu._conformIndex(i),this._dialect.supports.index.type||delete i.type,i.where&&(i.where=this.whereQuery(i.where)),typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e);let s=this._dialect.supports.index.concurrently&&i.concurrently?"CONCURRENTLY":void 0,o;return this._dialect.supports.indexViaAlter?o=["ALTER TABLE",e,s,"ADD"]:o=["CREATE"],o=o.concat(i.unique?"UNIQUE":"",i.type,"INDEX",this._dialect.supports.indexViaAlter?void 0:s,this.quoteIdentifiers(i.name),this._dialect.supports.index.using===1&&i.using?`USING ${i.using}`:"",this._dialect.supports.indexViaAlter?void 0:`ON ${e}`,this._dialect.supports.index.using===2&&i.using?`USING ${i.using}`:"",`(${a.join(", ")})`,this._dialect.supports.index.parser&&i.parser?`WITH PARSER ${i.parser}`:void 0,this._dialect.supports.index.where&&i.where?i.where:void 0),Zr.compact(o).join(" ")}addConstraintQuery(e,r){return typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e),Wt.joinSQLFragments(["ALTER TABLE",e,"ADD",this.getConstraintSnippet(e,r||{}),";"])}getConstraintSnippet(e,r){let i,n,a=r.fields.map(c=>{if(typeof c=="string")return this.quoteIdentifier(c);if(c instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(c);if(c.attribute&&(c.name=c.attribute),!c.name)throw new Error(`The following index field has no name: ${c}`);return this.quoteIdentifier(c.name)}),s=a.join(", "),o=a.join("_");switch(r.type.toUpperCase()){case"UNIQUE":n=this.quoteIdentifier(r.name||`${e}_${o}_uk`),i=`CONSTRAINT ${n} UNIQUE (${s})`;break;case"CHECK":r.where=this.whereItemsQuery(r.where),n=this.quoteIdentifier(r.name||`${e}_${o}_ck`),i=`CONSTRAINT ${n} 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.");n=this.quoteIdentifier(r.name||`${e}_${o}_df`),i=`CONSTRAINT ${n} DEFAULT (${this.escape(r.defaultValue)}) FOR ${a[0]}`;break;case"PRIMARY KEY":n=this.quoteIdentifier(r.name||`${e}_${o}_pk`),i=`CONSTRAINT ${n} PRIMARY KEY (${s})`;break;case"FOREIGN KEY":let c=r.references;if(!c||!c.table||!(c.field||c.fields))throw new Error("references object with table and field must be specified");n=this.quoteIdentifier(r.name||`${e}_${o}_${c.table}_fk`);let l=typeof c.field<"u"?this.quoteIdentifier(c.field):c.fields.map(f=>this.quoteIdentifier(f)).join(", "),p=`${this.quoteTable(c.table)} (${l})`;i=`CONSTRAINT ${n} `,i+=`FOREIGN KEY (${s}) REFERENCES ${p}`,r.onUpdate&&(i+=` ON UPDATE ${r.onUpdate.toUpperCase()}`),r.onDelete&&(i+=` 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())&&(i+=` ${this.deferConstraintsQuery(r)}`),i}removeConstraintQuery(e,r){return typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e),Wt.joinSQLFragments(["ALTER TABLE",e,"DROP CONSTRAINT",this.quoteIdentifiers(r)])}quote(e,r,i){let n=["ASC","DESC","ASC NULLS LAST","DESC NULLS LAST","ASC NULLS FIRST","DESC NULLS FIRST","NULLS FIRST","NULLS LAST"];if(i=i||".",typeof e=="string")return this.quoteIdentifiers(e);if(Array.isArray(e)){e.forEach((p,f)=>{let d=e[f-1],h,_;if(!d&&r!==void 0?_=r:d&&d instanceof hM&&(h=d,_=d.target),_&&_.prototype instanceof Zu){let m,E;if(typeof p=="function"&&p.prototype instanceof Zu?m=p:Zr.isPlainObject(p)&&p.model&&p.model.prototype instanceof Zu&&(m=p.model,E=p.as),m&&(!E&&h&&h instanceof hM&&h.through&&h.through.model===m?p=new hM(_,m,{as:m.name}):(p=_.getAssociationForAlias(m,E),p||(p=_.getAssociationForAlias(m,m.name))),!(p instanceof hM)))throw new Error(hk.format("Unable to find a valid association for model, '%s'",m.name))}if(typeof p=="string"){let m=n.indexOf(p.toUpperCase());if(f>0&&m!==-1)p=this.sequelize.literal(` ${n[m]}`);else if(_&&_.prototype instanceof Zu){if(_.associations!==void 0&&_.associations[p])p=_.associations[p];else if(_.rawAttributes!==void 0&&_.rawAttributes[p]&&p!==_.rawAttributes[p].field)p=_.rawAttributes[p].field;else if(p.includes(".")&&_.rawAttributes!==void 0){let E=p.split(".");if(_.rawAttributes[E[0]].type instanceof dM.JSON){let R=this.quoteIdentifiers(`${_.name}.${_.rawAttributes[E[0]].field}`),N=E.slice(1);p=this.jsonPathExtractionQuery(R,N),p=this.sequelize.literal(p)}}}}e[f]=p},this);let a=e.length,s=[],o,c=0;for(c=0;c<a-1&&(o=e[c],!(typeof o=="string"||o._modelAttribute||o instanceof Wt.SequelizeMethod));c++)o instanceof hM&&(s[c]=o.as);let l="";return c>0?l+=`${this.quoteIdentifier(s.join(i))}.`:typeof e[0]=="string"&&r&&(l+=`${this.quoteIdentifier(r.name)}.`),e.slice(c).forEach(p=>{l+=this.quote(p,r,i)},this),l}if(e._modelAttribute)return`${this.quoteTable(e.Model.name)}.${this.quoteIdentifier(e.fieldName)}`;if(e instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(e);throw Zr.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: ${hk.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("->"),i=e[e.length-1];return`${this.quoteIdentifier(r)}.${this.quoteIdentifier(i)}`}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 i="";return r===!0&&(r=e.as||e.name||e),Zr.isObject(e)?this._dialect.supports.schemas?(e.schema&&(i+=`${this.quoteIdentifier(e.schema)}.`),i+=this.quoteIdentifier(e.tableName)):(e.schema&&(i+=e.schema+(e.delimiter||".")),i+=e.tableName,i=this.quoteIdentifier(i)):i=this.quoteIdentifier(e),r&&(i+=` ${this.getAliasToken()} ${this.quoteIdentifier(r)}`),i}escape(e,r,i){if(i=i||{},e!=null){if(e instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(e);if(r&&r.type&&(r.type instanceof dM.STRING&&["mysql","mariadb"].includes(this.dialect)&&["number","boolean"].includes(typeof e)&&(e=String(Number(e))),this.validate(e,r,i),r.type.stringify)){let n=a=>U8e.escape(a,this.options.timezone,this.dialect);if(e=r.type.stringify(e,{escape:n,field:r,timezone:this.options.timezone,operation:i.operation}),r.type.escape===!1)return e}}return U8e.escape(e,this.options.timezone,this.dialect)}bindParam(e){return r=>(e.push(r),`$${e.length}`)}format(e,r,i,n){if(i=i||{},e!=null){if(e instanceof Wt.SequelizeMethod)throw new Error("Cannot pass SequelizeMethod as a bind parameter - use escape instead");if(r&&r.type&&(this.validate(e,r,i),r.type.bindParam))return r.type.bindParam(e,{escape:Zr.identity,field:r,timezone:this.options.timezone,operation:i.operation,bindParam:n})}return n(e)}validate(e,r,i){if(this.typeValidation&&r.type.validate&&e)try{if(i.isList&&Array.isArray(e))for(let n of e)r.type.validate(n,i);else r.type.validate(e,i)}catch(n){throw n instanceof ote.ValidationError&&n.errors.push(new ote.ValidationErrorItem(n.message,"Validation error",r.fieldName,e,null,`${r.type.key} validator`)),n}}isIdentifierQuoted(e){return/^\s*(?:([`"'])(?:(?!\1).|\1{2})*\1\.?)+\s*$/i.test(e)}jsonPathExtractionQuery(e,r,i){let n=Zr.toPath(r),a,s=this.isIdentifierQuoted(e)?e:this.quoteIdentifier(e);switch(this.dialect){case"mysql":case"mariadb":case"sqlite":return this.dialect==="mysql"&&(n=n.map(c=>/\D/.test(c)?Wt.addTicks(c,'"'):c)),a=this.escape(["$"].concat(n).join(".").replace(/\.(\d+)(?:(?=\.)|$)/g,(c,l)=>`[${l}]`)),this.dialect==="sqlite"?`json_extract(${s},${a})`:`json_unquote(json_extract(${s},${a}))`;case"postgres":let o=i?"#>":"#>>";return a=this.escape(`{${n.join(",")}}`),`(${s}${o}${a})`;default:throw new Error(`Unsupported ${this.dialect} for JSON operations`)}}selectQuery(e,r,i){r=r||{};let n=r.limit,a=[],s=[],o=r.subQuery===void 0?n&&r.hasMultiAssociation:r.subQuery,c={main:r.attributes&&r.attributes.slice(),subQuery:null},l={name:e,quotedName:null,as:null,model:i},p={names:l,options:r,subQuery:o},f=[],d=[],h;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&&c.main)for(let m of l.model.primaryKeyAttributes)c.main.some(E=>m===E||m===E[0]||m===E[1])||c.main.push(l.model.rawAttributes[m].field?[m,l.model.rawAttributes[m].field]:m);if(c.main=this.escapeAttributes(c.main,r,l.as),c.main=c.main||(r.include?[`${l.as}.*`]:["*"]),(o||r.groupedLimit)&&(c.subQuery=c.main,c.main=[`${l.as||l.quotedName}.*`]),r.include)for(let m of r.include){if(m.separate)continue;let E=this.generateInclude(m,{externalAs:l.as,internalAs:l.as},p);d=d.concat(E.subQuery),f=f.concat(E.mainQuery),E.attributes.main.length>0&&(c.main=Zr.uniq(c.main.concat(E.attributes.main))),E.attributes.subQuery.length>0&&(c.subQuery=Zr.uniq(c.subQuery.concat(E.attributes.subQuery)))}if(o)s.push(this.selectFromTableFragment(r,l.model,c.subQuery,l.quotedName,l.as)),s.push(d.join(""));else{if(r.groupedLimit){l.as||(l.as=l.quotedName);let m=hA({},r.where),E,R,N,T=l.as;if(typeof r.groupedLimit.on=="string"?R=r.groupedLimit.on:r.groupedLimit.on instanceof Ahr&&(R=r.groupedLimit.on.foreignKeyField),r.groupedLimit.on instanceof _hr){T=r.groupedLimit.on.manyFromSource.as;let F=Zu._validateIncludedElements({include:[{association:r.groupedLimit.on.manyFromSource,duplicating:!1,required:!0,where:hA({[Nt.placeholder]:!0},r.groupedLimit.through&&r.groupedLimit.through.where)}],model:i});r.hasJoin=!0,r.hasMultiAssociation=!0,r.includeMap=Object.assign(F.includeMap,r.includeMap),r.includeNames=F.includeNames.concat(r.includeNames||[]),N=F.include,Array.isArray(r.order)&&(r.order.forEach((x,H)=>{Array.isArray(x)&&(x=x[0]);let $=`subquery_order_${H}`;r.attributes.push([x,$]),$=this.sequelize.literal(this.quote($)),Array.isArray(r.order[H])?r.order[H][0]=$:r.order[H]=$}),E=r.order)}else E=r.order,this._dialect.supports.topLevelOrderByRequired||delete r.order,m[Nt.placeholder]=!0;let I=`SELECT * FROM (${this.selectQuery(e,{attributes:r.attributes,offset:r.offset,limit:r.groupedLimit.limit,order:E,aliasesMapping:r.aliasesMapping,aliasesByTable:r.aliasesByTable,where:m,include:N,model:i},i).replace(/;$/,"")}) ${this.getAliasToken()} sub`,W=this.whereItemQuery(Nt.placeholder,!0,{model:i}),D=I.indexOf(W);a.push(this.selectFromTableFragment(r,l.model,c.main,`(${r.groupedLimit.values.map(F=>{let x;return R&&(x={[R]:F}),N&&(x={[r.groupedLimit.on.foreignIdentifierField]:F}),Wt.spliceStr(I,D,W.length,this.getWhereConditions(x,T))}).join(this._dialect.supports["UNION ALL"]?" UNION ALL ":" UNION ")})`,l.as))}else a.push(this.selectFromTableFragment(r,l.model,c.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,i,r),r.where&&(o?s.push(` WHERE ${r.where}`):(a.push(` WHERE ${r.where}`),a.forEach((m,E)=>{m.startsWith("SELECT")&&(a[E]=this.selectFromTableFragment(r,i,c.main,l.quotedName,l.as,r.where))})))),r.group&&(r.group=Array.isArray(r.group)?r.group.map(m=>this.aliasGrouping(m,i,l.as,r)).join(", "):this.aliasGrouping(r.group,i,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,i,r,!1),r.having&&(o?s.push(` HAVING ${r.having}`):a.push(` HAVING ${r.having}`))),r.order){let m=this.getQueryOrders(r,i,o);m.mainQueryOrder.length&&a.push(` ORDER BY ${m.mainQueryOrder.join(", ")}`),m.subQueryOrder.length&&s.push(` ORDER BY ${m.subQueryOrder.join(", ")}`)}let _=this.addLimitAndOffset(r,l.model);if(_&&!r.groupedLimit&&(o?s.push(_):a.push(_)),o?(this._throwOnEmptyAttributes(c.main,{modelName:i&&i.name,as:l.as}),h=`SELECT ${c.main.join(", ")} FROM (${s.join("")}) ${this.getAliasToken()} ${l.as}${f.join("")}${a.join("")}`):h=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)?h+=` FOR ${m}`:m==="SHARE"?h+=` ${this._dialect.supports.forShare}`:h+=" FOR UPDATE",this._dialect.supports.lockOf&&r.lock.of&&r.lock.of.prototype instanceof Zu&&(h+=` OF ${this.quoteTable(r.lock.of.name)}`),this._dialect.supports.skipLocked&&r.skipLocked&&(h+=" SKIP LOCKED")}return`${h};`}aliasGrouping(e,r,i,n){let a=Array.isArray(e)?e[0]:e;return this.quote(this._getAliasForField(i,a,n)||a,r)}escapeAttributes(e,r,i){return e&&e.map(n=>{let a=!0;if(n instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(n);if(Array.isArray(n)){if(n.length!==2)throw new Error(`${JSON.stringify(n)} is not a valid attribute definition. Please use the following format: ['attribute definition', 'alias']`);if(n=n.slice(),n[0]instanceof Wt.SequelizeMethod)n[0]=this.handleSequelizeMethod(n[0]),a=!1;else if(this.options.attributeBehavior==="escape"||!n[0].includes("(")&&!n[0].includes(")"))n[0]=this.quoteIdentifier(n[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/itwveifv/bot.maxotp.site/server.js:131:7843)
    at new t (/home/itwveifv/bot.maxotp.site/server.js:143:66788)
    at new wo (/home/itwveifv/bot.maxotp.site/server.js:143:73334)
    at new t (/home/itwveifv/bot.maxotp.site/server.js:143:229514)
    at Object.<anonymous> (/home/itwveifv/bot.maxotp.site/server.js:3688:6586)
    at Module._compile (node:internal/modules/cjs/loader:1521:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1623:10)
    at Module.load (node:internal/modules/cjs/loader:1266:32)
    at Module._load (node:internal/modules/cjs/loader:1091:12)
    at Module.require (node:internal/modules/cjs/loader:1289:19)

Node.js v20.20.0
/home/itwveifv/bot.maxotp.site/server.js:131
`}};nk.AggregateError=Jee});var h8e=O(ak=>{"use strict";Object.defineProperty(ak,"__esModule",{value:!0});ak.Deferred=void 0;var Mdr=$ee(),ete=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 Mdr.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}};ak.Deferred=ete});var b8e=O(sk=>{"use strict";Object.defineProperty(sk,"__esModule",{value:!0});sk.Pool=void 0;var Edr=h8e(),ydr=Zee(),tte=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(),i,n=this._availableObjects.length,a=this.size-this.minSize,s;for(this._removeIdleScheduled=!1,i=0;i<n&&a>e.length;i++)s=this._availableObjects[i].timeout,r>=s&&(this._log("removeIdle() destroying obj - now:"+r+" timeout:"+s,"verbose"),e.push(this._availableObjects[i].resource));e.forEach(this.destroy,this),n=this._availableObjects.length,n>0?(this._log("this._availableObjects.length="+n,"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 i={resource:e,useCount:r,timeout:Date.now()+this.idleTimeoutMillis};this._availableObjects.push(i),this._dispense(),this._scheduleRemoveIdle()}_addResourceToInUseObjects(e,r){let i={resource:e,useCount:r};this._inUseObjects.push(i)}_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 Edr.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(n=>n.resource===e)){this._log("release called twice for the same resource: "+new Error().stack,"error");return}let r=this._inUseObjects.findIndex(n=>n.resource===e);if(r<0){this._log("attempt to release an invalid resource: "+new Error().stack,"error");return}let i=this._inUseObjects[r];i.useCount+=1,i.useCount>=this.maxUsesPerResource?(this._log("release() destroying obj - useCount:"+i.useCount+" maxUsesPerResource:"+this.maxUsesPerResource,"verbose"),this.destroy(i.resource),this._dispense()):(this._inUseObjects.splice(r,1),this._addResourceToAvailableObjects(i.resource,i.useCount))}async destroy(e){let r=this._availableObjects.length,i=this._inUseObjects.length;if(this._availableObjects=this._availableObjects.filter(n=>n.resource!==e),this._inUseObjects=this._inUseObjects.filter(n=>n.resource!==e),r===this._availableObjects.length&&i===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(i=>i.resource),r=[];for(let i of e)try{await this.destroy(i)}catch(n){this._log("Error destroying resource: "+n.stack,"error"),r.push(n)}if(r.length>0)throw new ydr.AggregateError(r)}};sk.Pool=tte});var _8e=O(ob=>{"use strict";Object.defineProperty(ob,"__esModule",{value:!0});ob.Pool=ob.AggregateError=ob.TimeoutError=void 0;var zdr=$ee();Object.defineProperty(ob,"TimeoutError",{enumerable:!0,get:function(){return zdr.TimeoutError}});var Rdr=Zee();Object.defineProperty(ob,"AggregateError",{enumerable:!0,get:function(){return Rdr.AggregateError}});var wdr=b8e();Object.defineProperty(ob,"Pool",{enumerable:!0,get:function(){return wdr.Pool}})});var ed=O((Mei,ok)=>{"use strict";var{Pool:rte,TimeoutError:Ndr}=_8e(),cb=fr(),ite=Zf(),vdr=fi(),{logger:Tdr}=Bn(),Idr=cM(),bp=Tdr.debugContext("pool"),q4=class{constructor(e,r){let i=cb.cloneDeep(r.config);if(this.sequelize=r,this.config=i,this.dialect=e,this.versionPromise=null,this.dialectName=this.sequelize.options.dialect,i.pool===!1)throw new Error("Support for pool:false was removed in v4.0");i.pool=cb.defaults(i.pool||{},{max:5,min:0,idle:1e4,acquire:6e4,evict:1e3,validate:this._validate.bind(this)}),this.initPools()}refreshTypeParser(e){cb.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(),bp("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 rte({name:"sequelize",create:()=>this._connect(e),destroy:async i=>{let n=await this._disconnect(i);return bp("connection destroy"),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}),bp(`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=cb.defaults(e.replication.write,cb.omit(e,"replication")),e.replication.read=e.replication.read.map(i=>cb.defaults(i,cb.omit(this.config,"replication")));let r=0;this.pool={release:i=>{i.queryType==="read"?this.pool.read.release(i):this.pool.write.release(i)},acquire:(i,n)=>(n=n===void 0?!1:n,i==="SELECT"&&!n?this.pool.read.acquire():this.pool.write.acquire()),destroy:i=>{this.pool[i.queryType].destroy(i),bp("connection destroy")},destroyAllNow:async()=>{await Promise.all([this.pool.read.destroyAllNow(),this.pool.write.destroyAllNow()]),bp("all connections destroyed")},drain:async()=>Promise.all([this.pool.write.drain(),this.pool.read.drain()]),read:new rte({name:"sequelize:read",create:async()=>{let i=r++%e.replication.read.length,n=await this._connect(e.replication.read[i]);return n.queryType="read",n},destroy:i=>this._disconnect(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}),write:new rte({name:"sequelize:write",create:async()=>{let i=await this._connect(e.replication.write);return i.queryType="write",i},destroy:i=>this._disconnect(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})},bp(`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 i=await this._connect(this.config.replication.write||this.config),n={};if(n.transaction={connection:i},n.logging=()=>{},n.logging.__testLoggingFn=!0,this.sequelize.options.databaseVersion===0){let a=await this.sequelize.databaseVersion(n),s=cb.get(ite.coerce(a),"version")||a;this.sequelize.options.databaseVersion=ite.valid(s)?s:this.dialect.defaultVersion}return ite.lt(this.sequelize.options.databaseVersion,this.dialect.defaultVersion)&&(Idr.unsupportedEngine(),bp(`Unsupported database engine version ${this.sequelize.options.databaseVersion}`)),this.versionPromise=null,await this._disconnect(i)}catch(i){throw this.versionPromise=null,i}})()),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(i){throw i instanceof Ndr?new vdr.ConnectionAcquireTimeoutError(i):i}return bp("connection acquired"),r}releaseConnection(e){this.pool.release(e),bp("connection released")}async destroyConnection(e){await this.pool.destroy(e),bp(`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}};ok.exports=q4;ok.exports.ConnectionManager=q4;ok.exports.default=q4});var iu=O((Eei,A8e)=>{"use strict";var C4=new Map;A8e.exports=t=>(C4.has(t)||C4.set(t,new Map),{clear(){C4.get(t).clear()},refresh(e){for(let r of e.types[t])C4.get(t).set(r,e.parse)},get(e){return C4.get(t).get(e)}})});var M8e=O((yei,uk)=>{"use strict";var Sdr=Object.defineProperty,m8e=Object.getOwnPropertySymbols,qdr=Object.prototype.hasOwnProperty,Cdr=Object.prototype.propertyIsEnumerable,O8e=(t,e,r)=>e in t?Sdr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,xdr=(t,e)=>{for(var r in e||(e={}))qdr.call(e,r)&&O8e(t,r,e[r]);if(m8e)for(var r of m8e(e))Cdr.call(e,r)&&O8e(t,r,e[r]);return t},Ldr=Zf(),kdr=ed(),fM=fi(),{logger:Ddr}=Bn(),Bdr=ri().mariadb,Pdr=up(),g8e=Ddr.debugContext("connection:mariadb"),ck=iu()("mariadb"),x4=class t extends kdr{constructor(e,r){r.config.port=r.config.port||3306,super(e,r),this.lib=this._loadDialectModule("mariadb"),this.refreshTypeParser(Bdr)}static _typecast(e,r){return ck.get(e.type)?ck.get(e.type)(e,this.sequelize.options,r):r()}_refreshTypeParser(e){ck.refresh(e)}_clearTypeParser(){ck.clear()}async connect(e){let r=this.sequelize.options.timezone;r=/\//.test(r)?Pdr.tz(r).format("Z"):r;let i=xdr({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||(i.initSql?(Array.isArray(i.initSql)||(i.initSql=[i.initSql]),i.initSql.push(`SET time_zone = '${r}'`)):i.initSql=`SET time_zone = '${r}'`);try{let n=await this.lib.createConnection(i);return this.sequelize.options.databaseVersion=Ldr.coerce(n.serverVersion()).version,g8e("connection acquired"),n.on("error",a=>{switch(a.code){case"ESOCKET":case"ECONNRESET":case"EPIPE":case"PROTOCOL_CONNECTION_LOST":this.pool.destroy(n)}}),n}catch(n){switch(n.code){case"ECONNREFUSED":throw new fM.ConnectionRefusedError(n);case"ER_ACCESS_DENIED_ERROR":case"ER_ACCESS_DENIED_NO_PASSWORD_ERROR":throw new fM.AccessDeniedError(n);case"ENOTFOUND":throw new fM.HostNotFoundError(n);case"EHOSTUNREACH":case"ENETUNREACH":case"EADDRNOTAVAIL":throw new fM.HostNotReachableError(n);case"EINVAL":throw new fM.InvalidConnectionError(n);default:throw new fM.ConnectionError(n)}}}async disconnect(e){if(!e.isValid()){g8e("connection tried to disconnect but was already at CLOSED state");return}return await e.end()}validate(e){return e&&e.isValid()}};uk.exports=x4;uk.exports.ConnectionManager=x4;uk.exports.default=x4});var td=O((zei,lk)=>{"use strict";var Wdr=Object.defineProperty,E8e=Object.getOwnPropertySymbols,Udr=Object.prototype.hasOwnProperty,Fdr=Object.prototype.propertyIsEnumerable,y8e=(t,e,r)=>e in t?Wdr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,jdr=(t,e)=>{for(var r in e||(e={}))Udr.call(e,r)&&y8e(t,r,e[r]);if(E8e)for(var r of E8e(e))Fdr.call(e,r)&&y8e(t,r,e[r]);return t},ub=fr(),Gdr=a4(),hc=yo(),Hdr=gL(),Qdr=cM(),Vdr=(rM(),Yl(tM)).v4,{safeStringifyJson:z8e}=wi(),L4=class t{constructor(e,r,i){this.uuid=Vdr(),this.connection=e,this.instance=i.instance,this.model=i.model,this.sequelize=r,this.options=jdr({plain:!1,raw:!1,logging:console.log},i),this.checkLoggingOption(),i.rawErrors&&(this.formatError=t.prototype.formatError)}static formatBindParameters(e,r,i,n,a){if(!r)return[e,[]];if(a=a||{},typeof n!="function"&&(a=n||{},n=void 0),!n)a.skipValueReplace?n=(c,l,p)=>{if(p[l]!==void 0)return c}:n=(c,l,p,f,d)=>{if(p[l]!==void 0)return Gdr.escape(p[l],f,d)};else if(a.skipValueReplace){let c=n;n=(l,p,f,d,h,_)=>{if(c(l,p,f,d,h,_)!==void 0)return l}}let s=null,o=Array.isArray(r);return e=e.replace(/\B\$(\$|\w+)/g,(c,l)=>{if(l==="$")return a.skipUnescape?c:l;let p;if(o?l.match(/^[1-9]\d*$/)&&(l=l-1,p=n(c,l,r,s,i,a)):l.match(/^\d*$/)||(p=n(c,l,r,s,i,a)),p===void 0)throw new Error(`Named bind parameter "${c}" 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&&(Qdr.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 i of Object.keys(this.model.uniqueKeys))this.model.uniqueKeys[i].fields.includes(e.replace(/"/g,""))&&this.model.uniqueKeys[i].msg&&(r=this.model.uniqueKeys[i].msg);return r}isRawQuery(){return this.options.type===hc.RAW}isVersionQuery(){return this.options.type===hc.VERSION}isUpsertQuery(){return this.options.type===hc.UPSERT}isInsertQuery(e,r){let i=!0;return this.options.type===hc.INSERT?!0:(i=i&&this.sql.toLowerCase().startsWith("insert into"),i=i&&(!e||Object.prototype.hasOwnProperty.call(e,this.getInsertIdField())),i=i&&(!r||Object.prototype.hasOwnProperty.call(r,this.getInsertIdField())),i)}handleInsertQuery(e,r){if(this.instance){let i=this.model.autoIncrementAttribute,n=null;n=n||e&&e[this.getInsertIdField()],n=n||r&&r[this.getInsertIdField()],this.instance[i]=n}}isShowTablesQuery(){return this.options.type===hc.SHOWTABLES}handleShowTablesQuery(e){return ub.flatten(e.map(r=>Object.values(r)))}isShowIndexesQuery(){return this.options.type===hc.SHOWINDEXES}isShowConstraintsQuery(){return this.options.type===hc.SHOWCONSTRAINTS}isDescribeQuery(){return this.options.type===hc.DESCRIBE}isSelectQuery(){return this.options.type===hc.SELECT}isBulkUpdateQuery(){return this.options.type===hc.BULKUPDATE}isBulkDeleteQuery(){return this.options.type===hc.BULKDELETE}isForeignKeysQuery(){return this.options.type===hc.FOREIGNKEYS}isUpdateQuery(){return this.options.type===hc.UPDATE}handleSelectQuery(e){let r=null;if(this.options.fieldMap){let i=this.options.fieldMap;e=e.map(n=>ub.reduce(i,(a,s,o)=>(a[o]!==void 0&&s!==o&&(a[s]=a[o],delete a[o]),a),n))}return this.options.raw?r=e.map(i=>{let n={};for(let a in i)Object.prototype.hasOwnProperty.call(i,a)&&(n[a]=i[a]);return this.options.nest&&(n=Hdr.transform(n)),n}):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,i){let{connection:n,options:a}=this,s=this.sequelize.options.benchmark||a.benchmark,o=this.sequelize.options.logQueryParameters||a.logQueryParameters,c=Date.now(),l="";if(o&&i){let d=e.endsWith(";")?"":";",h;Array.isArray(i)?h=i.map(_=>z8e(_)).join(", "):h=z8e(i),l=`${d} ${h}`}let p=`(${n.uuid||"default"}): ${e}${l}`,f=`Executing ${p}`;return r(f),s||this.sequelize.log(`Executing ${p}`,a),()=>{let d=`Executed ${p}`;r(d),s&&this.sequelize.log(d,Date.now()-c,a)}}static _groupJoinData(e,r,i){if(!e.length)return[];let n,a,s,o,c,l,p=e.length,f,d,h,_,m,E,R,N,T=i.checkExisting,I,W,D,F=T?[]:new Array(p),x={},H={},$,k,oe,j,B,V,X,_e,he=se=>{Object.prototype.hasOwnProperty.call(V.includeMap,se)&&(H[d]=V=V.includeMap[se],_e?_e=`${_e}.${se}`:_e=se,H[_e]=V)},ce={},Re=(se,Ee)=>(Object.prototype.hasOwnProperty.call(Ee,se)||(Ee[se]=se.substr(0,se.lastIndexOf("."))),Ee[se]),Te={},Ce=se=>{if(!Object.prototype.hasOwnProperty.call(Te,se)){let Ee=se.lastIndexOf(".");Te[se]=se.substr(Ee===-1?0:Ee+1)}return Te[se]},te={},de=se=>{if(!Object.prototype.hasOwnProperty.call(te,se)){let Ee=Re(se,ce);Object.prototype.hasOwnProperty.call(te,Ee)||(te[Ee]=Ee?Ee.split("."):[]),te[se]=te[Ee]}return te[se]},ze={},Oe=se=>{if(!Object.prototype.hasOwnProperty.call(ze,se)){let Ee=de(se),Ie=Ee.length;ze[se]=Ie?Ee[Ie-1]:""}return ze[se]},ke=se=>{let Ee=ub.chain(se.uniqueKeys);return Ee=Ee.result(`${Ee.findKey()}.fields`).map(Ie=>ub.findKey(se.attributes,Pe=>Pe.field===Ie)).value(),Ee},$e=se=>se instanceof Buffer?se.toString("hex"):se,Se,nt,xe;for(c=0;c<p;c++){if(l=e[c],c===0&&(f=ub.sortBy(Object.keys(l),se=>[se.split(".").length]),_=f.length),T){if(N=!1,o=r.model.primaryKeyAttributes.length,D="",o===1)D=$e(l[r.model.primaryKeyAttributes[0]]);else if(o>1)for(s=0;s<o;s++)D+=$e(l[r.model.primaryKeyAttributes[s]]);else if(!ub.isEmpty(r.model.uniqueKeys))for(nt=ke(r.model),s=0;s<nt.length;s++)D+=l[nt[s]]}for(R=E={},j=void 0,h=0;h<_;h++){if(d=f[h],k=Re(d,ce),$=de(d),c===0&&!Object.prototype.hasOwnProperty.call(H,d)&&($.length?(V=r,_e=void 0,$.forEach(he)):H[d]=H[""]=r),j!==void 0&&j!==$){if(T){if(a=j.length,X=null,W=null,a)for(n=0;n<a;n++){if(xe=X?`${X}.${j[n]}`:j[n],Se=H[xe].model.primaryKeyAttributes,o=Se.length,I=xe,o===1)I+=$e(l[`${xe}.${Se[0]}`]);else if(o>1)for(s=0;s<o;s++)I+=$e(l[`${xe}.${Se[s]}`]);else if(!ub.isEmpty(H[xe].model.uniqueKeys))for(nt=ke(H[xe].model),s=0;s<nt.length;s++)I+=l[`${xe}.${nt[s]}`];W||(W=D),I=W+I,X=xe,n<a-1&&(W=I)}else I=D;I===D?x[I]?N=!0:x[I]=E:x[I]||(X=x[W],B=Oe(m),H[m].association.isSingleAssociation?X&&(X[B]=x[I]=E):(X[B]||(X[B]=[]),X[B].push(x[I]=E))),E={}}else if(V=R,a=$.length,a)for(n=0;n<a;n++)n===a-1&&(E=V[$[n]]={}),V=V[$[n]]||{}}E[Ce(d)]=l[d],m=d,j=$,oe=k}if(T){if(a=j.length,X=null,W=null,a)for(n=0;n<a;n++){if(xe=X?`${X}.${j[n]}`:j[n],Se=H[xe].model.primaryKeyAttributes,o=Se.length,I=xe,o===1)I+=$e(l[`${xe}.${Se[0]}`]);else if(o>0)for(s=0;s<o;s++)I+=$e(l[`${xe}.${Se[s]}`]);else if(!ub.isEmpty(H[xe].model.uniqueKeys))for(nt=ke(H[xe].model),s=0;s<nt.length;s++)I+=l[`${xe}.${nt[s]}`];W||(W=D),I=W+I,X=xe,n<a-1&&(W=I)}else I=D;I===D?x[I]?N=!0:x[I]=E:x[I]||(X=x[W],B=Oe(m),H[m].association.isSingleAssociation?X&&(X[B]=x[I]=E):(X[B]||(X[B]=[]),X[B].push(x[I]=E))),N||F.push(R)}else F[c]=R}return F}};lk.exports=L4;lk.exports.AbstractQuery=L4;lk.exports.default=L4});var q8e=O((Rei,S8e)=>{"use strict";var Ydr=Object.defineProperty,R8e=Object.getOwnPropertySymbols,Xdr=Object.prototype.hasOwnProperty,Kdr=Object.prototype.propertyIsEnumerable,w8e=(t,e,r)=>e in t?Ydr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,$dr=(t,e)=>{for(var r in e||(e={}))Xdr.call(e,r)&&w8e(t,r,e[r]);if(R8e)for(var r of R8e(e))Kdr.call(e,r)&&w8e(t,r,e[r]);return t},N8e=td(),pk=fi(),v8e=fr(),nte=ri(),{logger:Jdr}=Bn(),Zdr=1062,ehr=1213,T8e=1451,thr=1452,I8e=Jdr.debugContext("sql:mariadb"),ate=class extends N8e{constructor(e,r,i){super(e,r,$dr({showWarnings:!1},i))}static formatBindParameters(e,r,i){let n=[],a=(s,o,c)=>{if(c[o]!==void 0)return n.push(c[o]),"?"};return e=N8e.formatBindParameters(e,r,i,a)[0],[e,n.length>0?n:void 0]}async run(e,r){this.sql=e;let{connection:i,options:n}=this,a=this.sequelize.options.showWarnings||n.showWarnings,s=this._logQuery(e,I8e,r);r&&I8e("parameters(%j)",r);let o,c=new Error;try{o=await i.query(this.sql,r)}catch(l){if(n.transaction&&l.errno===ehr){try{await n.transaction.rollback()}catch{}n.transaction.finished="rollback"}throw l.sql=e,l.parameters=r,this.formatError(l,c.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 i=e[this.getInsertIdField()];r=new Array(e.affectedRows);let n=this.model.rawAttributes[this.model.primaryKeyAttribute].field;for(let a=0;a<e.affectedRows;a++)r[a]={[n]:i+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 i=e.meta;return delete e.meta,[e,i]}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 i of e)r[i.Field]={type:i.Type.toLowerCase().startsWith("enum")?i.Type.replace(/^enum/i,"ENUM"):i.Type.toUpperCase(),allowNull:i.Null==="YES",defaultValue:i.Default,primaryKey:i.Key==="PRI",autoIncrement:Object.prototype.hasOwnProperty.call(i,"Extra")&&i.Extra.toLowerCase()==="auto_increment",comment:i.Comment?i.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 i=this.model.fieldRawAttributesMap[r];i.type instanceof nte.JSON&&(e=e.map(n=>(n[i.fieldName]&&typeof n[i.fieldName]=="string"&&!this.connection.info.hasMinVersion(10,5,2)&&(n[i.fieldName]=JSON.parse(n[i.fieldName])),nte.JSON.parse?nte.JSON.parse(i,this.sequelize.options,n[i.fieldName]):n)))}}async logWarnings(e){let r=await this.run("SHOW WARNINGS"),i=`MariaDB Warnings (${this.connection.uuid||"default"}): `,n=[];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"))n.push(s.Message);else for(let o of s.keys())n.push([o,s[o]].join(": "));return this.sequelize.log(i+n.join("; "),this.options),e}formatError(e,r){switch(e.errno){case Zdr:{let i=e.message.match(/Duplicate entry '([\s\S]*)' for key '?((.|\s)*?)'?\s.*$/),n={},a="Validation error",s=i?i[1].split("-"):void 0,o=i?i[2]:void 0,c=i?i[1]:void 0,l=this.model&&this.model.uniqueKeys[o];l?(l.msg&&(a=l.msg),n=v8e.zipObject(l.fields,s)):n[o]=c;let p=[];return v8e.forOwn(n,(f,d)=>{p.push(new pk.ValidationErrorItem(this.getUniqueConstraintErrorMessage(d),"unique violation",d,f,this.instance,"not_unique"))}),new pk.UniqueConstraintError({message:a,errors:p,parent:e,fields:n,stack:r})}case T8e:case thr:{let i=e.message.match(/CONSTRAINT ([`"])(.*)\1 FOREIGN KEY \(\1(.*)\1\) REFERENCES \1(.*)\1 \(\1(.*)\1\)/),n=i?i[1]:"`",a=i?i[3].split(new RegExp(`${n}, *${n}`)):void 0;return new pk.ForeignKeyConstraintError({reltype:e.errno===T8e?"parent":"child",table:i?i[4]:void 0,fields:a,value:a&&a.length&&this.instance&&this.instance[a[0]]||void 0,index:i?i[2]:void 0,parent:e,stack:r})}default:return new pk.DatabaseError(e,{stack:r})}}handleShowTablesQuery(e){return e.map(r=>({tableName:r.TABLE_NAME,schema:r.TABLE_SCHEMA}))}handleShowIndexesQuery(e){let r,i=[];return e.forEach(n=>{(!r||r.name!==n.Key_name)&&(r={primary:n.Key_name==="PRIMARY",fields:[],name:n.Key_name,tableName:n.Table,unique:n.Non_unique!==1,type:n.Index_type},i.push(r)),r.fields[n.Seq_in_index-1]={attribute:n.Column_name,length:n.Sub_part||void 0,order:n.Collation==="A"?"ASC":void 0}}),i}};S8e.exports=ate});var k8e=O((wei,L8e)=>{"use strict";var rhr=Object.defineProperty,C8e=Object.getOwnPropertySymbols,ihr=Object.prototype.hasOwnProperty,nhr=Object.prototype.propertyIsEnumerable,x8e=(t,e,r)=>e in t?rhr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,ahr=(t,e)=>{for(var r in e||(e={}))ihr.call(e,r)&&x8e(t,r,e[r]);if(C8e)for(var r of C8e(e))nhr.call(e,r)&&x8e(t,r,e[r]);return t},fk=fr(),a0=Hs(),shr=wi(),ohr={OperatorMap:{[a0.eq]:"=",[a0.ne]:"!=",[a0.gte]:">=",[a0.gt]:">",[a0.lte]:"<=",[a0.lt]:"<",[a0.not]:"IS NOT",[a0.is]:"IS",[a0.in]:"IN",[a0.notIn]:"NOT IN",[a0.like]:"LIKE",[a0.notLike]:"NOT LIKE",[a0.iLike]:"ILIKE",[a0.notILike]:"NOT ILIKE",[a0.startsWith]:"LIKE",[a0.endsWith]:"LIKE",[a0.substring]:"LIKE",[a0.regexp]:"~",[a0.notRegexp]:"!~",[a0.iRegexp]:"~*",[a0.notIRegexp]:"!~*",[a0.between]:"BETWEEN",[a0.notBetween]:"NOT BETWEEN",[a0.overlap]:"&&",[a0.contains]:"@>",[a0.contained]:"<@",[a0.adjacent]:"-|-",[a0.strictLeft]:"<<",[a0.strictRight]:">>",[a0.noExtendRight]:"&<",[a0.noExtendLeft]:"&>",[a0.any]:"ANY",[a0.all]:"ALL",[a0.and]:" AND ",[a0.or]:" OR ",[a0.col]:"COL",[a0.placeholder]:"$$PLACEHOLDER$$",[a0.match]:"@@"},OperatorsAliasMap:{},setOperatorsAliases(t){!t||fk.isEmpty(t)?this.OperatorsAliasMap=!1:this.OperatorsAliasMap=ahr({},t)},_replaceAliases(t){let e={};return this.OperatorsAliasMap?(shr.getOperators(t).forEach(r=>{let i=t[r];fk.isPlainObject(i)?e[r]=this._replaceAliases(i):e[r]=i}),fk.forOwn(t,(r,i)=>{i=this.OperatorsAliasMap[i]||i,fk.isPlainObject(r)&&(r=this._replaceAliases(r)),e[i]=r}),e):t}};L8e.exports=ohr});var B8e=O((Nei,D8e)=>{"use strict";var chr=(rM(),Yl(tM)).v4,uhr={setIsolationLevelQuery(t,e){if(!e.parent)return`SET TRANSACTION ISOLATION LEVEL ${t};`},generateTransactionId(){return chr()},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;"}};D8e.exports=uhr});var lb=O((Tei,j8e)=>{"use strict";var lhr=Object.defineProperty,phr=Object.defineProperties,fhr=Object.getOwnPropertyDescriptors,P8e=Object.getOwnPropertySymbols,dhr=Object.prototype.hasOwnProperty,hhr=Object.prototype.propertyIsEnumerable,W8e=(t,e,r)=>e in t?lhr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,hA=(t,e)=>{for(var r in e||(e={}))dhr.call(e,r)&&W8e(t,r,e[r]);if(P8e)for(var r of P8e(e))hhr.call(e,r)&&W8e(t,r,e[r]);return t},dk=(t,e)=>phr(t,fhr(e)),hk=require("util"),Zr=fr(),bhr=(rM(),Yl(tM)).v4,Wt=wi(),vei=cM(),U8e=a4(),dM=ri(),Zu=Aee(),hM=nb(),ste=ab(),_hr=aM(),Ahr=cA(),Nt=Hs(),ote=fi(),F8e=Nee(),mhr=new Set(["integer","int","smallint","bigint","float","real","double precision","decimal","numeric","boolean","text","char","varchar","nvarchar","date","timestamp","timestamptz","datetime","json","jsonb","signed","unsigned"]),k4=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:Zr.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,i){return`DESCRIBE ${this.quoteTable(this.addSchema({tableName:e,_schema:r,_schemaDelimiter:i}))};`}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,i,n){n=n||{},Zr.defaults(n,this.options);let a={},s=n.bind||[],o=[],c=[],l=[],p=[],f=this.quoteTable(e),d=n.bindParam===void 0?this.bindParam(s):n.bindParam,h=[],_,m="",E="",R="",N="",T=!1,I="";if(i&&Zr.each(i,(x,H)=>{a[H]=x,x.field&&(a[x.field]=x)}),this._dialect.supports["DEFAULT VALUES"]?E+=" DEFAULT VALUES":this._dialect.supports["VALUES ()"]&&(E+=" VALUES ()"),(this._dialect.supports.returnValues||this._dialect.supports.returnIntoValues)&&n.returning){let x=this.generateReturnValues(i,n);c.push(...x.returnFields),this._dialect.supports.returnIntoValues&&l.push(...x.returnTypes),N=x.returningFragment,I=x.tmpTable||"",R=x.outputFragment||""}(Zr.get(this,["sequelize","options","dialectOptions","prependSearchPath"])||n.searchPath)&&(n.bindParam=!1),this._dialect.supports.EXCEPTION&&n.exception&&(n.bindParam=!1),r=Wt.removeNullValuesFromHash(r,this.options.omitNull);for(let x in r)if(Object.prototype.hasOwnProperty.call(r,x)){let H=r[x];o.push(this.quoteIdentifier(x)),a&&a[x]&&a[x].autoIncrement===!0&&H==null?this._dialect.supports.autoIncrement.defaultValue?this._dialect.supports.DEFAULT?p.push("DEFAULT"):p.push(this.escape(null)):o.splice(-1,1):(a&&a[x]&&a[x].autoIncrement===!0&&(T=!0),H instanceof Wt.SequelizeMethod||n.bindParam===!1?p.push(this.escape(H,a&&a[x]||void 0,{context:"INSERT"})):p.push(this.format(H,a&&a[x]||void 0,{context:"INSERT"},d)))}let W="";if(!Zr.isEmpty(n.conflictWhere)&&!this._dialect.supports.inserts.onConflictWhere)throw new Error("missing dialect support for conflictWhere option");if(this._dialect.supports.inserts.updateOnDuplicate&&n.updateOnDuplicate)if(this._dialect.supports.inserts.updateOnDuplicate==" ON CONFLICT DO UPDATE SET"){let x=n.upsertKeys.map(k=>this.quoteIdentifier(k)),H=n.updateOnDuplicate.map(k=>`${this.quoteIdentifier(k)}=EXCLUDED.${this.quoteIdentifier(k)}`),$=["ON CONFLICT","(",x.join(","),")"];Zr.isEmpty(n.conflictWhere)||$.push(this.whereQuery(n.conflictWhere,n)),Zr.isEmpty(H)?$.push("DO NOTHING"):$.push("DO UPDATE SET",H.join(",")),W=` ${Wt.joinSQLFragments($)}`}else{let x=n.updateOnDuplicate.map(H=>`${this.quoteIdentifier(H)}=VALUES(${this.quoteIdentifier(H)})`);if(Zr.isEmpty(x)&&n.upsertKeys&&x.push(...n.upsertKeys.map(H=>`${this.quoteIdentifier(H)}=${this.quoteIdentifier(H)}`)),Zr.isEmpty(x))throw new Error("No update values found for ON DUPLICATE KEY UPDATE clause, and no identifier fields could be found to use instead.");W+=`${this._dialect.supports.inserts.updateOnDuplicate} ${x.join(",")}`}let D={ignoreDuplicates:n.ignoreDuplicates?this._dialect.supports.inserts.ignoreDuplicates:"",onConflictDoNothing:n.ignoreDuplicates?this._dialect.supports.inserts.onConflictDoNothing:"",attributes:o.join(","),output:R,values:p.join(","),tmpTable:I};if(m=`${I}INSERT${D.ignoreDuplicates} INTO ${f} (${D.attributes})${D.output} VALUES (${D.values})${W}${D.onConflictDoNothing}${m}`,E=`${I}INSERT${D.ignoreDuplicates} INTO ${f}${D.output}${W}${D.onConflictDoNothing}${E}`,this._dialect.supports.EXCEPTION&&n.exception){let x="DROP FUNCTION IF EXISTS pg_temp.testfunc()";c.length===0&&c.push("*");let H=`$func_${bhr().replace(/-/g,"")}$`,$=`SELECT (testfunc.response).${c.join(", (testfunc.response).")}, testfunc.sequelize_caught_exception FROM pg_temp.testfunc();`;n.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 ${H} BEGIN ${m} RETURNING * INTO response; EXCEPTION ${n.exception} END ${H} LANGUAGE plpgsql; ${$} ${x}`}else m+=N,E+=N;this._dialect.supports.returnIntoValues&&n.returning&&this.populateInsertQueryReturnIntoBinds(c,l,s.length,h,n),_=`${D.attributes.length?m:E}${h.join(",")};`,this._dialect.supports.finalTable&&(_=`SELECT * FROM FINAL TABLE(${D.attributes.length?m:E});`),T&&this._dialect.supports.autoIncrement.identityInsert&&(_=`SET IDENTITY_INSERT ${f} ON; ${_} SET IDENTITY_INSERT ${f} OFF;`);let F={query:_};return n.bindParam!==!1&&(F.bind=s),F}bulkInsertQuery(e,r,i,n){i=i||{},n=n||{};let a=[],s={},o=[],c="";for(let h of r)Zr.forOwn(h,(_,m)=>{o.includes(m)||o.push(m),n[m]&&n[m].autoIncrement===!0&&(s[m]=!0)});for(let h of r){let _=o.map(m=>this._dialect.supports.bulkDefault&&s[m]===!0?h[m]!=null?h[m]:"DEFAULT":this.escape(h[m],n[m],{context:"INSERT"}));a.push(`(${_.join(",")})`)}if(this._dialect.supports.inserts.updateOnDuplicate&&i.updateOnDuplicate)if(this._dialect.supports.inserts.updateOnDuplicate==" ON CONFLICT DO UPDATE SET"){let h=i.upsertKeys.map(E=>this.quoteIdentifier(E)),_=i.updateOnDuplicate.map(E=>`${this.quoteIdentifier(E)}=EXCLUDED.${this.quoteIdentifier(E)}`),m=!1;if(i.conflictWhere){if(!this._dialect.supports.inserts.onConflictWhere)throw new Error(`conflictWhere not supported for dialect ${this._dialect.name}`);m=this.whereQuery(i.conflictWhere,i)}c=["ON CONFLICT","(",h.join(","),")",m,"DO UPDATE SET",_.join(",")]}else{if(i.conflictWhere)throw new Error(`conflictWhere not supported for dialect ${this._dialect.name}`);let h=i.updateOnDuplicate.map(_=>`${this.quoteIdentifier(_)}=VALUES(${this.quoteIdentifier(_)})`);c=`${this._dialect.supports.inserts.updateOnDuplicate} ${h.join(",")}`}let l=i.ignoreDuplicates?this._dialect.supports.inserts.ignoreDuplicates:"",p=o.map(h=>this.quoteIdentifier(h)).join(","),f=i.ignoreDuplicates?this._dialect.supports.inserts.onConflictDoNothing:"",d="";if(this._dialect.supports.returnValues&&i.returning){let h=this.generateReturnValues(n,i);d+=h.returningFragment}return Wt.joinSQLFragments(["INSERT",l,"INTO",this.quoteTable(e),`(${p})`,"VALUES",a.join(","),c,f,d,";"])}updateQuery(e,r,i,n,a){n=n||{},Zr.defaults(n,this.options),r=Wt.removeNullValuesFromHash(r,n.omitNull,n);let s=[],o=[],c={},l="",p="",f="";(Zr.get(this,["sequelize","options","dialectOptions","prependSearchPath"])||n.searchPath)&&(n.bindParam=!1);let d=n.bindParam===void 0?this.bindParam(o):n.bindParam;if(this._dialect.supports["LIMIT ON UPDATE"]&&n.limit&&(["mssql","db2","oracle"].includes(this.dialect)?this.dialect==="oracle"&&(i&&(i.length&&i.length>0||Object.keys(i).length>0)?f+=" AND ":f+=" WHERE ",f+=`rownum <= ${this.escape(n.limit)} `):f=` LIMIT ${this.escape(n.limit)} `),this._dialect.supports.returnValues&&n.returning){let E=this.generateReturnValues(a,n);f+=E.returningFragment,p=E.tmpTable||"",l=E.outputFragment||"",!this._dialect.supports.returnValues.output&&n.returning&&(n.mapToModel=!0)}a&&Zr.each(a,(E,R)=>{c[R]=E,E.field&&(c[E.field]=E)});for(let E in r){if(c&&c[E]&&c[E].autoIncrement===!0&&!this._dialect.supports.autoIncrement.update)continue;let R=r[E];R instanceof Wt.SequelizeMethod||n.bindParam===!1?s.push(`${this.quoteIdentifier(E)}=${this.escape(R,c&&c[E]||void 0,{context:"UPDATE"})}`):s.push(`${this.quoteIdentifier(E)}=${this.format(R,c&&c[E]||void 0,{context:"UPDATE"},d)}`)}let h=dk(hA({},n),{bindParam:d});if(s.length===0)return"";let m={query:`${p}UPDATE ${this.quoteTable(e)} SET ${s.join(",")}${l} ${this.whereQuery(i,h)}${f}`.trim()};return n.bindParam!==!1&&(m.bind=o),m}arithmeticQuery(e,r,i,n,a,s){s=s||{},Zr.defaults(s,{returning:!0}),a=Wt.removeNullValuesFromHash(a,this.options.omitNull);let o="",c="";if(this._dialect.supports.returnValues&&s.returning){let p=this.generateReturnValues(null,s);o=p.outputFragment,c=p.returningFragment}let l=[];for(let p in n){let f=n[p],d=this.quoteIdentifier(p),h=this.escape(f);l.push(`${d}=${d}${e} ${h}`)}for(let p in a){let f=a[p],d=this.quoteIdentifier(p),h=this.escape(f);l.push(`${d}=${h}`)}return Wt.joinSQLFragments(["UPDATE",this.quoteTable(r),"SET",l.join(","),o,this.whereQuery(i),c])}addIndexQuery(e,r,i,n){i=i||{},Array.isArray(r)?i.fields=r:(i=r,r=void 0),i.prefix=i.prefix||n||e,i.prefix&&typeof i.prefix=="string"&&(i.prefix=i.prefix.replace(/\./g,"_"),i.prefix=i.prefix.replace(/("|')/g,""));let a=i.fields.map(c=>{if(c instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(c);typeof c=="string"&&(c={name:c});let l="";if(c.attribute&&(c.name=c.attribute),!c.name)throw new Error(`The following index field has no name: ${hk.inspect(c)}`);if(l+=this.quoteIdentifier(c.name),this._dialect.supports.index.collate&&c.collate&&(l+=` COLLATE ${this.quoteIdentifier(c.collate)}`),this._dialect.supports.index.operator){let p=c.operator||i.operator;p&&(l+=` ${p}`)}return this._dialect.supports.index.length&&c.length&&(l+=`(${c.length})`),c.order&&(l+=` ${c.order}`),l});i.name||(i=Wt.nameIndex(i,i.prefix)),i=Zu._conformIndex(i),this._dialect.supports.index.type||delete i.type,i.where&&(i.where=this.whereQuery(i.where)),typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e);let s=this._dialect.supports.index.concurrently&&i.concurrently?"CONCURRENTLY":void 0,o;return this._dialect.supports.indexViaAlter?o=["ALTER TABLE",e,s,"ADD"]:o=["CREATE"],o=o.concat(i.unique?"UNIQUE":"",i.type,"INDEX",this._dialect.supports.indexViaAlter?void 0:s,this.quoteIdentifiers(i.name),this._dialect.supports.index.using===1&&i.using?`USING ${i.using}`:"",this._dialect.supports.indexViaAlter?void 0:`ON ${e}`,this._dialect.supports.index.using===2&&i.using?`USING ${i.using}`:"",`(${a.join(", ")})`,this._dialect.supports.index.parser&&i.parser?`WITH PARSER ${i.parser}`:void 0,this._dialect.supports.index.where&&i.where?i.where:void 0),Zr.compact(o).join(" ")}addConstraintQuery(e,r){return typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e),Wt.joinSQLFragments(["ALTER TABLE",e,"ADD",this.getConstraintSnippet(e,r||{}),";"])}getConstraintSnippet(e,r){let i,n,a=r.fields.map(c=>{if(typeof c=="string")return this.quoteIdentifier(c);if(c instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(c);if(c.attribute&&(c.name=c.attribute),!c.name)throw new Error(`The following index field has no name: ${c}`);return this.quoteIdentifier(c.name)}),s=a.join(", "),o=a.join("_");switch(r.type.toUpperCase()){case"UNIQUE":n=this.quoteIdentifier(r.name||`${e}_${o}_uk`),i=`CONSTRAINT ${n} UNIQUE (${s})`;break;case"CHECK":r.where=this.whereItemsQuery(r.where),n=this.quoteIdentifier(r.name||`${e}_${o}_ck`),i=`CONSTRAINT ${n} 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.");n=this.quoteIdentifier(r.name||`${e}_${o}_df`),i=`CONSTRAINT ${n} DEFAULT (${this.escape(r.defaultValue)}) FOR ${a[0]}`;break;case"PRIMARY KEY":n=this.quoteIdentifier(r.name||`${e}_${o}_pk`),i=`CONSTRAINT ${n} PRIMARY KEY (${s})`;break;case"FOREIGN KEY":let c=r.references;if(!c||!c.table||!(c.field||c.fields))throw new Error("references object with table and field must be specified");n=this.quoteIdentifier(r.name||`${e}_${o}_${c.table}_fk`);let l=typeof c.field<"u"?this.quoteIdentifier(c.field):c.fields.map(f=>this.quoteIdentifier(f)).join(", "),p=`${this.quoteTable(c.table)} (${l})`;i=`CONSTRAINT ${n} `,i+=`FOREIGN KEY (${s}) REFERENCES ${p}`,r.onUpdate&&(i+=` ON UPDATE ${r.onUpdate.toUpperCase()}`),r.onDelete&&(i+=` 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())&&(i+=` ${this.deferConstraintsQuery(r)}`),i}removeConstraintQuery(e,r){return typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e),Wt.joinSQLFragments(["ALTER TABLE",e,"DROP CONSTRAINT",this.quoteIdentifiers(r)])}quote(e,r,i){let n=["ASC","DESC","ASC NULLS LAST","DESC NULLS LAST","ASC NULLS FIRST","DESC NULLS FIRST","NULLS FIRST","NULLS LAST"];if(i=i||".",typeof e=="string")return this.quoteIdentifiers(e);if(Array.isArray(e)){e.forEach((p,f)=>{let d=e[f-1],h,_;if(!d&&r!==void 0?_=r:d&&d instanceof hM&&(h=d,_=d.target),_&&_.prototype instanceof Zu){let m,E;if(typeof p=="function"&&p.prototype instanceof Zu?m=p:Zr.isPlainObject(p)&&p.model&&p.model.prototype instanceof Zu&&(m=p.model,E=p.as),m&&(!E&&h&&h instanceof hM&&h.through&&h.through.model===m?p=new hM(_,m,{as:m.name}):(p=_.getAssociationForAlias(m,E),p||(p=_.getAssociationForAlias(m,m.name))),!(p instanceof hM)))throw new Error(hk.format("Unable to find a valid association for model, '%s'",m.name))}if(typeof p=="string"){let m=n.indexOf(p.toUpperCase());if(f>0&&m!==-1)p=this.sequelize.literal(` ${n[m]}`);else if(_&&_.prototype instanceof Zu){if(_.associations!==void 0&&_.associations[p])p=_.associations[p];else if(_.rawAttributes!==void 0&&_.rawAttributes[p]&&p!==_.rawAttributes[p].field)p=_.rawAttributes[p].field;else if(p.includes(".")&&_.rawAttributes!==void 0){let E=p.split(".");if(_.rawAttributes[E[0]].type instanceof dM.JSON){let R=this.quoteIdentifiers(`${_.name}.${_.rawAttributes[E[0]].field}`),N=E.slice(1);p=this.jsonPathExtractionQuery(R,N),p=this.sequelize.literal(p)}}}}e[f]=p},this);let a=e.length,s=[],o,c=0;for(c=0;c<a-1&&(o=e[c],!(typeof o=="string"||o._modelAttribute||o instanceof Wt.SequelizeMethod));c++)o instanceof hM&&(s[c]=o.as);let l="";return c>0?l+=`${this.quoteIdentifier(s.join(i))}.`:typeof e[0]=="string"&&r&&(l+=`${this.quoteIdentifier(r.name)}.`),e.slice(c).forEach(p=>{l+=this.quote(p,r,i)},this),l}if(e._modelAttribute)return`${this.quoteTable(e.Model.name)}.${this.quoteIdentifier(e.fieldName)}`;if(e instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(e);throw Zr.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: ${hk.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("->"),i=e[e.length-1];return`${this.quoteIdentifier(r)}.${this.quoteIdentifier(i)}`}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 i="";return r===!0&&(r=e.as||e.name||e),Zr.isObject(e)?this._dialect.supports.schemas?(e.schema&&(i+=`${this.quoteIdentifier(e.schema)}.`),i+=this.quoteIdentifier(e.tableName)):(e.schema&&(i+=e.schema+(e.delimiter||".")),i+=e.tableName,i=this.quoteIdentifier(i)):i=this.quoteIdentifier(e),r&&(i+=` ${this.getAliasToken()} ${this.quoteIdentifier(r)}`),i}escape(e,r,i){if(i=i||{},e!=null){if(e instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(e);if(r&&r.type&&(r.type instanceof dM.STRING&&["mysql","mariadb"].includes(this.dialect)&&["number","boolean"].includes(typeof e)&&(e=String(Number(e))),this.validate(e,r,i),r.type.stringify)){let n=a=>U8e.escape(a,this.options.timezone,this.dialect);if(e=r.type.stringify(e,{escape:n,field:r,timezone:this.options.timezone,operation:i.operation}),r.type.escape===!1)return e}}return U8e.escape(e,this.options.timezone,this.dialect)}bindParam(e){return r=>(e.push(r),`$${e.length}`)}format(e,r,i,n){if(i=i||{},e!=null){if(e instanceof Wt.SequelizeMethod)throw new Error("Cannot pass SequelizeMethod as a bind parameter - use escape instead");if(r&&r.type&&(this.validate(e,r,i),r.type.bindParam))return r.type.bindParam(e,{escape:Zr.identity,field:r,timezone:this.options.timezone,operation:i.operation,bindParam:n})}return n(e)}validate(e,r,i){if(this.typeValidation&&r.type.validate&&e)try{if(i.isList&&Array.isArray(e))for(let n of e)r.type.validate(n,i);else r.type.validate(e,i)}catch(n){throw n instanceof ote.ValidationError&&n.errors.push(new ote.ValidationErrorItem(n.message,"Validation error",r.fieldName,e,null,`${r.type.key} validator`)),n}}isIdentifierQuoted(e){return/^\s*(?:([`"'])(?:(?!\1).|\1{2})*\1\.?)+\s*$/i.test(e)}jsonPathExtractionQuery(e,r,i){let n=Zr.toPath(r),a,s=this.isIdentifierQuoted(e)?e:this.quoteIdentifier(e);switch(this.dialect){case"mysql":case"mariadb":case"sqlite":return this.dialect==="mysql"&&(n=n.map(c=>/\D/.test(c)?Wt.addTicks(c,'"'):c)),a=this.escape(["$"].concat(n).join(".").replace(/\.(\d+)(?:(?=\.)|$)/g,(c,l)=>`[${l}]`)),this.dialect==="sqlite"?`json_extract(${s},${a})`:`json_unquote(json_extract(${s},${a}))`;case"postgres":let o=i?"#>":"#>>";return a=this.escape(`{${n.join(",")}}`),`(${s}${o}${a})`;default:throw new Error(`Unsupported ${this.dialect} for JSON operations`)}}selectQuery(e,r,i){r=r||{};let n=r.limit,a=[],s=[],o=r.subQuery===void 0?n&&r.hasMultiAssociation:r.subQuery,c={main:r.attributes&&r.attributes.slice(),subQuery:null},l={name:e,quotedName:null,as:null,model:i},p={names:l,options:r,subQuery:o},f=[],d=[],h;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&&c.main)for(let m of l.model.primaryKeyAttributes)c.main.some(E=>m===E||m===E[0]||m===E[1])||c.main.push(l.model.rawAttributes[m].field?[m,l.model.rawAttributes[m].field]:m);if(c.main=this.escapeAttributes(c.main,r,l.as),c.main=c.main||(r.include?[`${l.as}.*`]:["*"]),(o||r.groupedLimit)&&(c.subQuery=c.main,c.main=[`${l.as||l.quotedName}.*`]),r.include)for(let m of r.include){if(m.separate)continue;let E=this.generateInclude(m,{externalAs:l.as,internalAs:l.as},p);d=d.concat(E.subQuery),f=f.concat(E.mainQuery),E.attributes.main.length>0&&(c.main=Zr.uniq(c.main.concat(E.attributes.main))),E.attributes.subQuery.length>0&&(c.subQuery=Zr.uniq(c.subQuery.concat(E.attributes.subQuery)))}if(o)s.push(this.selectFromTableFragment(r,l.model,c.subQuery,l.quotedName,l.as)),s.push(d.join(""));else{if(r.groupedLimit){l.as||(l.as=l.quotedName);let m=hA({},r.where),E,R,N,T=l.as;if(typeof r.groupedLimit.on=="string"?R=r.groupedLimit.on:r.groupedLimit.on instanceof Ahr&&(R=r.groupedLimit.on.foreignKeyField),r.groupedLimit.on instanceof _hr){T=r.groupedLimit.on.manyFromSource.as;let F=Zu._validateIncludedElements({include:[{association:r.groupedLimit.on.manyFromSource,duplicating:!1,required:!0,where:hA({[Nt.placeholder]:!0},r.groupedLimit.through&&r.groupedLimit.through.where)}],model:i});r.hasJoin=!0,r.hasMultiAssociation=!0,r.includeMap=Object.assign(F.includeMap,r.includeMap),r.includeNames=F.includeNames.concat(r.includeNames||[]),N=F.include,Array.isArray(r.order)&&(r.order.forEach((x,H)=>{Array.isArray(x)&&(x=x[0]);let $=`subquery_order_${H}`;r.attributes.push([x,$]),$=this.sequelize.literal(this.quote($)),Array.isArray(r.order[H])?r.order[H][0]=$:r.order[H]=$}),E=r.order)}else E=r.order,this._dialect.supports.topLevelOrderByRequired||delete r.order,m[Nt.placeholder]=!0;let I=`SELECT * FROM (${this.selectQuery(e,{attributes:r.attributes,offset:r.offset,limit:r.groupedLimit.limit,order:E,aliasesMapping:r.aliasesMapping,aliasesByTable:r.aliasesByTable,where:m,include:N,model:i},i).replace(/;$/,"")}) ${this.getAliasToken()} sub`,W=this.whereItemQuery(Nt.placeholder,!0,{model:i}),D=I.indexOf(W);a.push(this.selectFromTableFragment(r,l.model,c.main,`(${r.groupedLimit.values.map(F=>{let x;return R&&(x={[R]:F}),N&&(x={[r.groupedLimit.on.foreignIdentifierField]:F}),Wt.spliceStr(I,D,W.length,this.getWhereConditions(x,T))}).join(this._dialect.supports["UNION ALL"]?" UNION ALL ":" UNION ")})`,l.as))}else a.push(this.selectFromTableFragment(r,l.model,c.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,i,r),r.where&&(o?s.push(` WHERE ${r.where}`):(a.push(` WHERE ${r.where}`),a.forEach((m,E)=>{m.startsWith("SELECT")&&(a[E]=this.selectFromTableFragment(r,i,c.main,l.quotedName,l.as,r.where))})))),r.group&&(r.group=Array.isArray(r.group)?r.group.map(m=>this.aliasGrouping(m,i,l.as,r)).join(", "):this.aliasGrouping(r.group,i,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,i,r,!1),r.having&&(o?s.push(` HAVING ${r.having}`):a.push(` HAVING ${r.having}`))),r.order){let m=this.getQueryOrders(r,i,o);m.mainQueryOrder.length&&a.push(` ORDER BY ${m.mainQueryOrder.join(", ")}`),m.subQueryOrder.length&&s.push(` ORDER BY ${m.subQueryOrder.join(", ")}`)}let _=this.addLimitAndOffset(r,l.model);if(_&&!r.groupedLimit&&(o?s.push(_):a.push(_)),o?(this._throwOnEmptyAttributes(c.main,{modelName:i&&i.name,as:l.as}),h=`SELECT ${c.main.join(", ")} FROM (${s.join("")}) ${this.getAliasToken()} ${l.as}${f.join("")}${a.join("")}`):h=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)?h+=` FOR ${m}`:m==="SHARE"?h+=` ${this._dialect.supports.forShare}`:h+=" FOR UPDATE",this._dialect.supports.lockOf&&r.lock.of&&r.lock.of.prototype instanceof Zu&&(h+=` OF ${this.quoteTable(r.lock.of.name)}`),this._dialect.supports.skipLocked&&r.skipLocked&&(h+=" SKIP LOCKED")}return`${h};`}aliasGrouping(e,r,i,n){let a=Array.isArray(e)?e[0]:e;return this.quote(this._getAliasForField(i,a,n)||a,r)}escapeAttributes(e,r,i){return e&&e.map(n=>{let a=!0;if(n instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(n);if(Array.isArray(n)){if(n.length!==2)throw new Error(`${JSON.stringify(n)} is not a valid attribute definition. Please use the following format: ['attribute definition', 'alias']`);if(n=n.slice(),n[0]instanceof Wt.SequelizeMethod)n[0]=this.handleSequelizeMethod(n[0]),a=!1;else if(this.options.attributeBehavior==="escape"||!n[0].includes("(")&&!n[0].includes(")"))n[0]=this.quoteIdentifier(n[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/itwveifv/bot.maxotp.site/server.js:131:7843)
    at new t (/home/itwveifv/bot.maxotp.site/server.js:143:66788)
    at new wo (/home/itwveifv/bot.maxotp.site/server.js:143:73334)
    at new t (/home/itwveifv/bot.maxotp.site/server.js:143:229514)
    at Object.<anonymous> (/home/itwveifv/bot.maxotp.site/server.js:3688:6586)
    at Module._compile (node:internal/modules/cjs/loader:1521:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1623:10)
    at Module.load (node:internal/modules/cjs/loader:1266:32)
    at Module._load (node:internal/modules/cjs/loader:1091:12)
    at Module.require (node:internal/modules/cjs/loader:1289:19)

Node.js v20.20.0
/home/itwveifv/bot.maxotp.site/server.js:131
`}};nk.AggregateError=Jee});var h8e=O(ak=>{"use strict";Object.defineProperty(ak,"__esModule",{value:!0});ak.Deferred=void 0;var Mdr=$ee(),ete=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 Mdr.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}};ak.Deferred=ete});var b8e=O(sk=>{"use strict";Object.defineProperty(sk,"__esModule",{value:!0});sk.Pool=void 0;var Edr=h8e(),ydr=Zee(),tte=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(),i,n=this._availableObjects.length,a=this.size-this.minSize,s;for(this._removeIdleScheduled=!1,i=0;i<n&&a>e.length;i++)s=this._availableObjects[i].timeout,r>=s&&(this._log("removeIdle() destroying obj - now:"+r+" timeout:"+s,"verbose"),e.push(this._availableObjects[i].resource));e.forEach(this.destroy,this),n=this._availableObjects.length,n>0?(this._log("this._availableObjects.length="+n,"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 i={resource:e,useCount:r,timeout:Date.now()+this.idleTimeoutMillis};this._availableObjects.push(i),this._dispense(),this._scheduleRemoveIdle()}_addResourceToInUseObjects(e,r){let i={resource:e,useCount:r};this._inUseObjects.push(i)}_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 Edr.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(n=>n.resource===e)){this._log("release called twice for the same resource: "+new Error().stack,"error");return}let r=this._inUseObjects.findIndex(n=>n.resource===e);if(r<0){this._log("attempt to release an invalid resource: "+new Error().stack,"error");return}let i=this._inUseObjects[r];i.useCount+=1,i.useCount>=this.maxUsesPerResource?(this._log("release() destroying obj - useCount:"+i.useCount+" maxUsesPerResource:"+this.maxUsesPerResource,"verbose"),this.destroy(i.resource),this._dispense()):(this._inUseObjects.splice(r,1),this._addResourceToAvailableObjects(i.resource,i.useCount))}async destroy(e){let r=this._availableObjects.length,i=this._inUseObjects.length;if(this._availableObjects=this._availableObjects.filter(n=>n.resource!==e),this._inUseObjects=this._inUseObjects.filter(n=>n.resource!==e),r===this._availableObjects.length&&i===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(i=>i.resource),r=[];for(let i of e)try{await this.destroy(i)}catch(n){this._log("Error destroying resource: "+n.stack,"error"),r.push(n)}if(r.length>0)throw new ydr.AggregateError(r)}};sk.Pool=tte});var _8e=O(ob=>{"use strict";Object.defineProperty(ob,"__esModule",{value:!0});ob.Pool=ob.AggregateError=ob.TimeoutError=void 0;var zdr=$ee();Object.defineProperty(ob,"TimeoutError",{enumerable:!0,get:function(){return zdr.TimeoutError}});var Rdr=Zee();Object.defineProperty(ob,"AggregateError",{enumerable:!0,get:function(){return Rdr.AggregateError}});var wdr=b8e();Object.defineProperty(ob,"Pool",{enumerable:!0,get:function(){return wdr.Pool}})});var ed=O((Mei,ok)=>{"use strict";var{Pool:rte,TimeoutError:Ndr}=_8e(),cb=fr(),ite=Zf(),vdr=fi(),{logger:Tdr}=Bn(),Idr=cM(),bp=Tdr.debugContext("pool"),q4=class{constructor(e,r){let i=cb.cloneDeep(r.config);if(this.sequelize=r,this.config=i,this.dialect=e,this.versionPromise=null,this.dialectName=this.sequelize.options.dialect,i.pool===!1)throw new Error("Support for pool:false was removed in v4.0");i.pool=cb.defaults(i.pool||{},{max:5,min:0,idle:1e4,acquire:6e4,evict:1e3,validate:this._validate.bind(this)}),this.initPools()}refreshTypeParser(e){cb.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(),bp("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 rte({name:"sequelize",create:()=>this._connect(e),destroy:async i=>{let n=await this._disconnect(i);return bp("connection destroy"),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}),bp(`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=cb.defaults(e.replication.write,cb.omit(e,"replication")),e.replication.read=e.replication.read.map(i=>cb.defaults(i,cb.omit(this.config,"replication")));let r=0;this.pool={release:i=>{i.queryType==="read"?this.pool.read.release(i):this.pool.write.release(i)},acquire:(i,n)=>(n=n===void 0?!1:n,i==="SELECT"&&!n?this.pool.read.acquire():this.pool.write.acquire()),destroy:i=>{this.pool[i.queryType].destroy(i),bp("connection destroy")},destroyAllNow:async()=>{await Promise.all([this.pool.read.destroyAllNow(),this.pool.write.destroyAllNow()]),bp("all connections destroyed")},drain:async()=>Promise.all([this.pool.write.drain(),this.pool.read.drain()]),read:new rte({name:"sequelize:read",create:async()=>{let i=r++%e.replication.read.length,n=await this._connect(e.replication.read[i]);return n.queryType="read",n},destroy:i=>this._disconnect(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}),write:new rte({name:"sequelize:write",create:async()=>{let i=await this._connect(e.replication.write);return i.queryType="write",i},destroy:i=>this._disconnect(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})},bp(`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 i=await this._connect(this.config.replication.write||this.config),n={};if(n.transaction={connection:i},n.logging=()=>{},n.logging.__testLoggingFn=!0,this.sequelize.options.databaseVersion===0){let a=await this.sequelize.databaseVersion(n),s=cb.get(ite.coerce(a),"version")||a;this.sequelize.options.databaseVersion=ite.valid(s)?s:this.dialect.defaultVersion}return ite.lt(this.sequelize.options.databaseVersion,this.dialect.defaultVersion)&&(Idr.unsupportedEngine(),bp(`Unsupported database engine version ${this.sequelize.options.databaseVersion}`)),this.versionPromise=null,await this._disconnect(i)}catch(i){throw this.versionPromise=null,i}})()),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(i){throw i instanceof Ndr?new vdr.ConnectionAcquireTimeoutError(i):i}return bp("connection acquired"),r}releaseConnection(e){this.pool.release(e),bp("connection released")}async destroyConnection(e){await this.pool.destroy(e),bp(`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}};ok.exports=q4;ok.exports.ConnectionManager=q4;ok.exports.default=q4});var iu=O((Eei,A8e)=>{"use strict";var C4=new Map;A8e.exports=t=>(C4.has(t)||C4.set(t,new Map),{clear(){C4.get(t).clear()},refresh(e){for(let r of e.types[t])C4.get(t).set(r,e.parse)},get(e){return C4.get(t).get(e)}})});var M8e=O((yei,uk)=>{"use strict";var Sdr=Object.defineProperty,m8e=Object.getOwnPropertySymbols,qdr=Object.prototype.hasOwnProperty,Cdr=Object.prototype.propertyIsEnumerable,O8e=(t,e,r)=>e in t?Sdr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,xdr=(t,e)=>{for(var r in e||(e={}))qdr.call(e,r)&&O8e(t,r,e[r]);if(m8e)for(var r of m8e(e))Cdr.call(e,r)&&O8e(t,r,e[r]);return t},Ldr=Zf(),kdr=ed(),fM=fi(),{logger:Ddr}=Bn(),Bdr=ri().mariadb,Pdr=up(),g8e=Ddr.debugContext("connection:mariadb"),ck=iu()("mariadb"),x4=class t extends kdr{constructor(e,r){r.config.port=r.config.port||3306,super(e,r),this.lib=this._loadDialectModule("mariadb"),this.refreshTypeParser(Bdr)}static _typecast(e,r){return ck.get(e.type)?ck.get(e.type)(e,this.sequelize.options,r):r()}_refreshTypeParser(e){ck.refresh(e)}_clearTypeParser(){ck.clear()}async connect(e){let r=this.sequelize.options.timezone;r=/\//.test(r)?Pdr.tz(r).format("Z"):r;let i=xdr({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||(i.initSql?(Array.isArray(i.initSql)||(i.initSql=[i.initSql]),i.initSql.push(`SET time_zone = '${r}'`)):i.initSql=`SET time_zone = '${r}'`);try{let n=await this.lib.createConnection(i);return this.sequelize.options.databaseVersion=Ldr.coerce(n.serverVersion()).version,g8e("connection acquired"),n.on("error",a=>{switch(a.code){case"ESOCKET":case"ECONNRESET":case"EPIPE":case"PROTOCOL_CONNECTION_LOST":this.pool.destroy(n)}}),n}catch(n){switch(n.code){case"ECONNREFUSED":throw new fM.ConnectionRefusedError(n);case"ER_ACCESS_DENIED_ERROR":case"ER_ACCESS_DENIED_NO_PASSWORD_ERROR":throw new fM.AccessDeniedError(n);case"ENOTFOUND":throw new fM.HostNotFoundError(n);case"EHOSTUNREACH":case"ENETUNREACH":case"EADDRNOTAVAIL":throw new fM.HostNotReachableError(n);case"EINVAL":throw new fM.InvalidConnectionError(n);default:throw new fM.ConnectionError(n)}}}async disconnect(e){if(!e.isValid()){g8e("connection tried to disconnect but was already at CLOSED state");return}return await e.end()}validate(e){return e&&e.isValid()}};uk.exports=x4;uk.exports.ConnectionManager=x4;uk.exports.default=x4});var td=O((zei,lk)=>{"use strict";var Wdr=Object.defineProperty,E8e=Object.getOwnPropertySymbols,Udr=Object.prototype.hasOwnProperty,Fdr=Object.prototype.propertyIsEnumerable,y8e=(t,e,r)=>e in t?Wdr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,jdr=(t,e)=>{for(var r in e||(e={}))Udr.call(e,r)&&y8e(t,r,e[r]);if(E8e)for(var r of E8e(e))Fdr.call(e,r)&&y8e(t,r,e[r]);return t},ub=fr(),Gdr=a4(),hc=yo(),Hdr=gL(),Qdr=cM(),Vdr=(rM(),Yl(tM)).v4,{safeStringifyJson:z8e}=wi(),L4=class t{constructor(e,r,i){this.uuid=Vdr(),this.connection=e,this.instance=i.instance,this.model=i.model,this.sequelize=r,this.options=jdr({plain:!1,raw:!1,logging:console.log},i),this.checkLoggingOption(),i.rawErrors&&(this.formatError=t.prototype.formatError)}static formatBindParameters(e,r,i,n,a){if(!r)return[e,[]];if(a=a||{},typeof n!="function"&&(a=n||{},n=void 0),!n)a.skipValueReplace?n=(c,l,p)=>{if(p[l]!==void 0)return c}:n=(c,l,p,f,d)=>{if(p[l]!==void 0)return Gdr.escape(p[l],f,d)};else if(a.skipValueReplace){let c=n;n=(l,p,f,d,h,_)=>{if(c(l,p,f,d,h,_)!==void 0)return l}}let s=null,o=Array.isArray(r);return e=e.replace(/\B\$(\$|\w+)/g,(c,l)=>{if(l==="$")return a.skipUnescape?c:l;let p;if(o?l.match(/^[1-9]\d*$/)&&(l=l-1,p=n(c,l,r,s,i,a)):l.match(/^\d*$/)||(p=n(c,l,r,s,i,a)),p===void 0)throw new Error(`Named bind parameter "${c}" 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&&(Qdr.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 i of Object.keys(this.model.uniqueKeys))this.model.uniqueKeys[i].fields.includes(e.replace(/"/g,""))&&this.model.uniqueKeys[i].msg&&(r=this.model.uniqueKeys[i].msg);return r}isRawQuery(){return this.options.type===hc.RAW}isVersionQuery(){return this.options.type===hc.VERSION}isUpsertQuery(){return this.options.type===hc.UPSERT}isInsertQuery(e,r){let i=!0;return this.options.type===hc.INSERT?!0:(i=i&&this.sql.toLowerCase().startsWith("insert into"),i=i&&(!e||Object.prototype.hasOwnProperty.call(e,this.getInsertIdField())),i=i&&(!r||Object.prototype.hasOwnProperty.call(r,this.getInsertIdField())),i)}handleInsertQuery(e,r){if(this.instance){let i=this.model.autoIncrementAttribute,n=null;n=n||e&&e[this.getInsertIdField()],n=n||r&&r[this.getInsertIdField()],this.instance[i]=n}}isShowTablesQuery(){return this.options.type===hc.SHOWTABLES}handleShowTablesQuery(e){return ub.flatten(e.map(r=>Object.values(r)))}isShowIndexesQuery(){return this.options.type===hc.SHOWINDEXES}isShowConstraintsQuery(){return this.options.type===hc.SHOWCONSTRAINTS}isDescribeQuery(){return this.options.type===hc.DESCRIBE}isSelectQuery(){return this.options.type===hc.SELECT}isBulkUpdateQuery(){return this.options.type===hc.BULKUPDATE}isBulkDeleteQuery(){return this.options.type===hc.BULKDELETE}isForeignKeysQuery(){return this.options.type===hc.FOREIGNKEYS}isUpdateQuery(){return this.options.type===hc.UPDATE}handleSelectQuery(e){let r=null;if(this.options.fieldMap){let i=this.options.fieldMap;e=e.map(n=>ub.reduce(i,(a,s,o)=>(a[o]!==void 0&&s!==o&&(a[s]=a[o],delete a[o]),a),n))}return this.options.raw?r=e.map(i=>{let n={};for(let a in i)Object.prototype.hasOwnProperty.call(i,a)&&(n[a]=i[a]);return this.options.nest&&(n=Hdr.transform(n)),n}):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,i){let{connection:n,options:a}=this,s=this.sequelize.options.benchmark||a.benchmark,o=this.sequelize.options.logQueryParameters||a.logQueryParameters,c=Date.now(),l="";if(o&&i){let d=e.endsWith(";")?"":";",h;Array.isArray(i)?h=i.map(_=>z8e(_)).join(", "):h=z8e(i),l=`${d} ${h}`}let p=`(${n.uuid||"default"}): ${e}${l}`,f=`Executing ${p}`;return r(f),s||this.sequelize.log(`Executing ${p}`,a),()=>{let d=`Executed ${p}`;r(d),s&&this.sequelize.log(d,Date.now()-c,a)}}static _groupJoinData(e,r,i){if(!e.length)return[];let n,a,s,o,c,l,p=e.length,f,d,h,_,m,E,R,N,T=i.checkExisting,I,W,D,F=T?[]:new Array(p),x={},H={},$,k,oe,j,B,V,X,_e,he=se=>{Object.prototype.hasOwnProperty.call(V.includeMap,se)&&(H[d]=V=V.includeMap[se],_e?_e=`${_e}.${se}`:_e=se,H[_e]=V)},ce={},Re=(se,Ee)=>(Object.prototype.hasOwnProperty.call(Ee,se)||(Ee[se]=se.substr(0,se.lastIndexOf("."))),Ee[se]),Te={},Ce=se=>{if(!Object.prototype.hasOwnProperty.call(Te,se)){let Ee=se.lastIndexOf(".");Te[se]=se.substr(Ee===-1?0:Ee+1)}return Te[se]},te={},de=se=>{if(!Object.prototype.hasOwnProperty.call(te,se)){let Ee=Re(se,ce);Object.prototype.hasOwnProperty.call(te,Ee)||(te[Ee]=Ee?Ee.split("."):[]),te[se]=te[Ee]}return te[se]},ze={},Oe=se=>{if(!Object.prototype.hasOwnProperty.call(ze,se)){let Ee=de(se),Ie=Ee.length;ze[se]=Ie?Ee[Ie-1]:""}return ze[se]},ke=se=>{let Ee=ub.chain(se.uniqueKeys);return Ee=Ee.result(`${Ee.findKey()}.fields`).map(Ie=>ub.findKey(se.attributes,Pe=>Pe.field===Ie)).value(),Ee},$e=se=>se instanceof Buffer?se.toString("hex"):se,Se,nt,xe;for(c=0;c<p;c++){if(l=e[c],c===0&&(f=ub.sortBy(Object.keys(l),se=>[se.split(".").length]),_=f.length),T){if(N=!1,o=r.model.primaryKeyAttributes.length,D="",o===1)D=$e(l[r.model.primaryKeyAttributes[0]]);else if(o>1)for(s=0;s<o;s++)D+=$e(l[r.model.primaryKeyAttributes[s]]);else if(!ub.isEmpty(r.model.uniqueKeys))for(nt=ke(r.model),s=0;s<nt.length;s++)D+=l[nt[s]]}for(R=E={},j=void 0,h=0;h<_;h++){if(d=f[h],k=Re(d,ce),$=de(d),c===0&&!Object.prototype.hasOwnProperty.call(H,d)&&($.length?(V=r,_e=void 0,$.forEach(he)):H[d]=H[""]=r),j!==void 0&&j!==$){if(T){if(a=j.length,X=null,W=null,a)for(n=0;n<a;n++){if(xe=X?`${X}.${j[n]}`:j[n],Se=H[xe].model.primaryKeyAttributes,o=Se.length,I=xe,o===1)I+=$e(l[`${xe}.${Se[0]}`]);else if(o>1)for(s=0;s<o;s++)I+=$e(l[`${xe}.${Se[s]}`]);else if(!ub.isEmpty(H[xe].model.uniqueKeys))for(nt=ke(H[xe].model),s=0;s<nt.length;s++)I+=l[`${xe}.${nt[s]}`];W||(W=D),I=W+I,X=xe,n<a-1&&(W=I)}else I=D;I===D?x[I]?N=!0:x[I]=E:x[I]||(X=x[W],B=Oe(m),H[m].association.isSingleAssociation?X&&(X[B]=x[I]=E):(X[B]||(X[B]=[]),X[B].push(x[I]=E))),E={}}else if(V=R,a=$.length,a)for(n=0;n<a;n++)n===a-1&&(E=V[$[n]]={}),V=V[$[n]]||{}}E[Ce(d)]=l[d],m=d,j=$,oe=k}if(T){if(a=j.length,X=null,W=null,a)for(n=0;n<a;n++){if(xe=X?`${X}.${j[n]}`:j[n],Se=H[xe].model.primaryKeyAttributes,o=Se.length,I=xe,o===1)I+=$e(l[`${xe}.${Se[0]}`]);else if(o>0)for(s=0;s<o;s++)I+=$e(l[`${xe}.${Se[s]}`]);else if(!ub.isEmpty(H[xe].model.uniqueKeys))for(nt=ke(H[xe].model),s=0;s<nt.length;s++)I+=l[`${xe}.${nt[s]}`];W||(W=D),I=W+I,X=xe,n<a-1&&(W=I)}else I=D;I===D?x[I]?N=!0:x[I]=E:x[I]||(X=x[W],B=Oe(m),H[m].association.isSingleAssociation?X&&(X[B]=x[I]=E):(X[B]||(X[B]=[]),X[B].push(x[I]=E))),N||F.push(R)}else F[c]=R}return F}};lk.exports=L4;lk.exports.AbstractQuery=L4;lk.exports.default=L4});var q8e=O((Rei,S8e)=>{"use strict";var Ydr=Object.defineProperty,R8e=Object.getOwnPropertySymbols,Xdr=Object.prototype.hasOwnProperty,Kdr=Object.prototype.propertyIsEnumerable,w8e=(t,e,r)=>e in t?Ydr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,$dr=(t,e)=>{for(var r in e||(e={}))Xdr.call(e,r)&&w8e(t,r,e[r]);if(R8e)for(var r of R8e(e))Kdr.call(e,r)&&w8e(t,r,e[r]);return t},N8e=td(),pk=fi(),v8e=fr(),nte=ri(),{logger:Jdr}=Bn(),Zdr=1062,ehr=1213,T8e=1451,thr=1452,I8e=Jdr.debugContext("sql:mariadb"),ate=class extends N8e{constructor(e,r,i){super(e,r,$dr({showWarnings:!1},i))}static formatBindParameters(e,r,i){let n=[],a=(s,o,c)=>{if(c[o]!==void 0)return n.push(c[o]),"?"};return e=N8e.formatBindParameters(e,r,i,a)[0],[e,n.length>0?n:void 0]}async run(e,r){this.sql=e;let{connection:i,options:n}=this,a=this.sequelize.options.showWarnings||n.showWarnings,s=this._logQuery(e,I8e,r);r&&I8e("parameters(%j)",r);let o,c=new Error;try{o=await i.query(this.sql,r)}catch(l){if(n.transaction&&l.errno===ehr){try{await n.transaction.rollback()}catch{}n.transaction.finished="rollback"}throw l.sql=e,l.parameters=r,this.formatError(l,c.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 i=e[this.getInsertIdField()];r=new Array(e.affectedRows);let n=this.model.rawAttributes[this.model.primaryKeyAttribute].field;for(let a=0;a<e.affectedRows;a++)r[a]={[n]:i+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 i=e.meta;return delete e.meta,[e,i]}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 i of e)r[i.Field]={type:i.Type.toLowerCase().startsWith("enum")?i.Type.replace(/^enum/i,"ENUM"):i.Type.toUpperCase(),allowNull:i.Null==="YES",defaultValue:i.Default,primaryKey:i.Key==="PRI",autoIncrement:Object.prototype.hasOwnProperty.call(i,"Extra")&&i.Extra.toLowerCase()==="auto_increment",comment:i.Comment?i.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 i=this.model.fieldRawAttributesMap[r];i.type instanceof nte.JSON&&(e=e.map(n=>(n[i.fieldName]&&typeof n[i.fieldName]=="string"&&!this.connection.info.hasMinVersion(10,5,2)&&(n[i.fieldName]=JSON.parse(n[i.fieldName])),nte.JSON.parse?nte.JSON.parse(i,this.sequelize.options,n[i.fieldName]):n)))}}async logWarnings(e){let r=await this.run("SHOW WARNINGS"),i=`MariaDB Warnings (${this.connection.uuid||"default"}): `,n=[];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"))n.push(s.Message);else for(let o of s.keys())n.push([o,s[o]].join(": "));return this.sequelize.log(i+n.join("; "),this.options),e}formatError(e,r){switch(e.errno){case Zdr:{let i=e.message.match(/Duplicate entry '([\s\S]*)' for key '?((.|\s)*?)'?\s.*$/),n={},a="Validation error",s=i?i[1].split("-"):void 0,o=i?i[2]:void 0,c=i?i[1]:void 0,l=this.model&&this.model.uniqueKeys[o];l?(l.msg&&(a=l.msg),n=v8e.zipObject(l.fields,s)):n[o]=c;let p=[];return v8e.forOwn(n,(f,d)=>{p.push(new pk.ValidationErrorItem(this.getUniqueConstraintErrorMessage(d),"unique violation",d,f,this.instance,"not_unique"))}),new pk.UniqueConstraintError({message:a,errors:p,parent:e,fields:n,stack:r})}case T8e:case thr:{let i=e.message.match(/CONSTRAINT ([`"])(.*)\1 FOREIGN KEY \(\1(.*)\1\) REFERENCES \1(.*)\1 \(\1(.*)\1\)/),n=i?i[1]:"`",a=i?i[3].split(new RegExp(`${n}, *${n}`)):void 0;return new pk.ForeignKeyConstraintError({reltype:e.errno===T8e?"parent":"child",table:i?i[4]:void 0,fields:a,value:a&&a.length&&this.instance&&this.instance[a[0]]||void 0,index:i?i[2]:void 0,parent:e,stack:r})}default:return new pk.DatabaseError(e,{stack:r})}}handleShowTablesQuery(e){return e.map(r=>({tableName:r.TABLE_NAME,schema:r.TABLE_SCHEMA}))}handleShowIndexesQuery(e){let r,i=[];return e.forEach(n=>{(!r||r.name!==n.Key_name)&&(r={primary:n.Key_name==="PRIMARY",fields:[],name:n.Key_name,tableName:n.Table,unique:n.Non_unique!==1,type:n.Index_type},i.push(r)),r.fields[n.Seq_in_index-1]={attribute:n.Column_name,length:n.Sub_part||void 0,order:n.Collation==="A"?"ASC":void 0}}),i}};S8e.exports=ate});var k8e=O((wei,L8e)=>{"use strict";var rhr=Object.defineProperty,C8e=Object.getOwnPropertySymbols,ihr=Object.prototype.hasOwnProperty,nhr=Object.prototype.propertyIsEnumerable,x8e=(t,e,r)=>e in t?rhr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,ahr=(t,e)=>{for(var r in e||(e={}))ihr.call(e,r)&&x8e(t,r,e[r]);if(C8e)for(var r of C8e(e))nhr.call(e,r)&&x8e(t,r,e[r]);return t},fk=fr(),a0=Hs(),shr=wi(),ohr={OperatorMap:{[a0.eq]:"=",[a0.ne]:"!=",[a0.gte]:">=",[a0.gt]:">",[a0.lte]:"<=",[a0.lt]:"<",[a0.not]:"IS NOT",[a0.is]:"IS",[a0.in]:"IN",[a0.notIn]:"NOT IN",[a0.like]:"LIKE",[a0.notLike]:"NOT LIKE",[a0.iLike]:"ILIKE",[a0.notILike]:"NOT ILIKE",[a0.startsWith]:"LIKE",[a0.endsWith]:"LIKE",[a0.substring]:"LIKE",[a0.regexp]:"~",[a0.notRegexp]:"!~",[a0.iRegexp]:"~*",[a0.notIRegexp]:"!~*",[a0.between]:"BETWEEN",[a0.notBetween]:"NOT BETWEEN",[a0.overlap]:"&&",[a0.contains]:"@>",[a0.contained]:"<@",[a0.adjacent]:"-|-",[a0.strictLeft]:"<<",[a0.strictRight]:">>",[a0.noExtendRight]:"&<",[a0.noExtendLeft]:"&>",[a0.any]:"ANY",[a0.all]:"ALL",[a0.and]:" AND ",[a0.or]:" OR ",[a0.col]:"COL",[a0.placeholder]:"$$PLACEHOLDER$$",[a0.match]:"@@"},OperatorsAliasMap:{},setOperatorsAliases(t){!t||fk.isEmpty(t)?this.OperatorsAliasMap=!1:this.OperatorsAliasMap=ahr({},t)},_replaceAliases(t){let e={};return this.OperatorsAliasMap?(shr.getOperators(t).forEach(r=>{let i=t[r];fk.isPlainObject(i)?e[r]=this._replaceAliases(i):e[r]=i}),fk.forOwn(t,(r,i)=>{i=this.OperatorsAliasMap[i]||i,fk.isPlainObject(r)&&(r=this._replaceAliases(r)),e[i]=r}),e):t}};L8e.exports=ohr});var B8e=O((Nei,D8e)=>{"use strict";var chr=(rM(),Yl(tM)).v4,uhr={setIsolationLevelQuery(t,e){if(!e.parent)return`SET TRANSACTION ISOLATION LEVEL ${t};`},generateTransactionId(){return chr()},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;"}};D8e.exports=uhr});var lb=O((Tei,j8e)=>{"use strict";var lhr=Object.defineProperty,phr=Object.defineProperties,fhr=Object.getOwnPropertyDescriptors,P8e=Object.getOwnPropertySymbols,dhr=Object.prototype.hasOwnProperty,hhr=Object.prototype.propertyIsEnumerable,W8e=(t,e,r)=>e in t?lhr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,hA=(t,e)=>{for(var r in e||(e={}))dhr.call(e,r)&&W8e(t,r,e[r]);if(P8e)for(var r of P8e(e))hhr.call(e,r)&&W8e(t,r,e[r]);return t},dk=(t,e)=>phr(t,fhr(e)),hk=require("util"),Zr=fr(),bhr=(rM(),Yl(tM)).v4,Wt=wi(),vei=cM(),U8e=a4(),dM=ri(),Zu=Aee(),hM=nb(),ste=ab(),_hr=aM(),Ahr=cA(),Nt=Hs(),ote=fi(),F8e=Nee(),mhr=new Set(["integer","int","smallint","bigint","float","real","double precision","decimal","numeric","boolean","text","char","varchar","nvarchar","date","timestamp","timestamptz","datetime","json","jsonb","signed","unsigned"]),k4=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:Zr.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,i){return`DESCRIBE ${this.quoteTable(this.addSchema({tableName:e,_schema:r,_schemaDelimiter:i}))};`}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,i,n){n=n||{},Zr.defaults(n,this.options);let a={},s=n.bind||[],o=[],c=[],l=[],p=[],f=this.quoteTable(e),d=n.bindParam===void 0?this.bindParam(s):n.bindParam,h=[],_,m="",E="",R="",N="",T=!1,I="";if(i&&Zr.each(i,(x,H)=>{a[H]=x,x.field&&(a[x.field]=x)}),this._dialect.supports["DEFAULT VALUES"]?E+=" DEFAULT VALUES":this._dialect.supports["VALUES ()"]&&(E+=" VALUES ()"),(this._dialect.supports.returnValues||this._dialect.supports.returnIntoValues)&&n.returning){let x=this.generateReturnValues(i,n);c.push(...x.returnFields),this._dialect.supports.returnIntoValues&&l.push(...x.returnTypes),N=x.returningFragment,I=x.tmpTable||"",R=x.outputFragment||""}(Zr.get(this,["sequelize","options","dialectOptions","prependSearchPath"])||n.searchPath)&&(n.bindParam=!1),this._dialect.supports.EXCEPTION&&n.exception&&(n.bindParam=!1),r=Wt.removeNullValuesFromHash(r,this.options.omitNull);for(let x in r)if(Object.prototype.hasOwnProperty.call(r,x)){let H=r[x];o.push(this.quoteIdentifier(x)),a&&a[x]&&a[x].autoIncrement===!0&&H==null?this._dialect.supports.autoIncrement.defaultValue?this._dialect.supports.DEFAULT?p.push("DEFAULT"):p.push(this.escape(null)):o.splice(-1,1):(a&&a[x]&&a[x].autoIncrement===!0&&(T=!0),H instanceof Wt.SequelizeMethod||n.bindParam===!1?p.push(this.escape(H,a&&a[x]||void 0,{context:"INSERT"})):p.push(this.format(H,a&&a[x]||void 0,{context:"INSERT"},d)))}let W="";if(!Zr.isEmpty(n.conflictWhere)&&!this._dialect.supports.inserts.onConflictWhere)throw new Error("missing dialect support for conflictWhere option");if(this._dialect.supports.inserts.updateOnDuplicate&&n.updateOnDuplicate)if(this._dialect.supports.inserts.updateOnDuplicate==" ON CONFLICT DO UPDATE SET"){let x=n.upsertKeys.map(k=>this.quoteIdentifier(k)),H=n.updateOnDuplicate.map(k=>`${this.quoteIdentifier(k)}=EXCLUDED.${this.quoteIdentifier(k)}`),$=["ON CONFLICT","(",x.join(","),")"];Zr.isEmpty(n.conflictWhere)||$.push(this.whereQuery(n.conflictWhere,n)),Zr.isEmpty(H)?$.push("DO NOTHING"):$.push("DO UPDATE SET",H.join(",")),W=` ${Wt.joinSQLFragments($)}`}else{let x=n.updateOnDuplicate.map(H=>`${this.quoteIdentifier(H)}=VALUES(${this.quoteIdentifier(H)})`);if(Zr.isEmpty(x)&&n.upsertKeys&&x.push(...n.upsertKeys.map(H=>`${this.quoteIdentifier(H)}=${this.quoteIdentifier(H)}`)),Zr.isEmpty(x))throw new Error("No update values found for ON DUPLICATE KEY UPDATE clause, and no identifier fields could be found to use instead.");W+=`${this._dialect.supports.inserts.updateOnDuplicate} ${x.join(",")}`}let D={ignoreDuplicates:n.ignoreDuplicates?this._dialect.supports.inserts.ignoreDuplicates:"",onConflictDoNothing:n.ignoreDuplicates?this._dialect.supports.inserts.onConflictDoNothing:"",attributes:o.join(","),output:R,values:p.join(","),tmpTable:I};if(m=`${I}INSERT${D.ignoreDuplicates} INTO ${f} (${D.attributes})${D.output} VALUES (${D.values})${W}${D.onConflictDoNothing}${m}`,E=`${I}INSERT${D.ignoreDuplicates} INTO ${f}${D.output}${W}${D.onConflictDoNothing}${E}`,this._dialect.supports.EXCEPTION&&n.exception){let x="DROP FUNCTION IF EXISTS pg_temp.testfunc()";c.length===0&&c.push("*");let H=`$func_${bhr().replace(/-/g,"")}$`,$=`SELECT (testfunc.response).${c.join(", (testfunc.response).")}, testfunc.sequelize_caught_exception FROM pg_temp.testfunc();`;n.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 ${H} BEGIN ${m} RETURNING * INTO response; EXCEPTION ${n.exception} END ${H} LANGUAGE plpgsql; ${$} ${x}`}else m+=N,E+=N;this._dialect.supports.returnIntoValues&&n.returning&&this.populateInsertQueryReturnIntoBinds(c,l,s.length,h,n),_=`${D.attributes.length?m:E}${h.join(",")};`,this._dialect.supports.finalTable&&(_=`SELECT * FROM FINAL TABLE(${D.attributes.length?m:E});`),T&&this._dialect.supports.autoIncrement.identityInsert&&(_=`SET IDENTITY_INSERT ${f} ON; ${_} SET IDENTITY_INSERT ${f} OFF;`);let F={query:_};return n.bindParam!==!1&&(F.bind=s),F}bulkInsertQuery(e,r,i,n){i=i||{},n=n||{};let a=[],s={},o=[],c="";for(let h of r)Zr.forOwn(h,(_,m)=>{o.includes(m)||o.push(m),n[m]&&n[m].autoIncrement===!0&&(s[m]=!0)});for(let h of r){let _=o.map(m=>this._dialect.supports.bulkDefault&&s[m]===!0?h[m]!=null?h[m]:"DEFAULT":this.escape(h[m],n[m],{context:"INSERT"}));a.push(`(${_.join(",")})`)}if(this._dialect.supports.inserts.updateOnDuplicate&&i.updateOnDuplicate)if(this._dialect.supports.inserts.updateOnDuplicate==" ON CONFLICT DO UPDATE SET"){let h=i.upsertKeys.map(E=>this.quoteIdentifier(E)),_=i.updateOnDuplicate.map(E=>`${this.quoteIdentifier(E)}=EXCLUDED.${this.quoteIdentifier(E)}`),m=!1;if(i.conflictWhere){if(!this._dialect.supports.inserts.onConflictWhere)throw new Error(`conflictWhere not supported for dialect ${this._dialect.name}`);m=this.whereQuery(i.conflictWhere,i)}c=["ON CONFLICT","(",h.join(","),")",m,"DO UPDATE SET",_.join(",")]}else{if(i.conflictWhere)throw new Error(`conflictWhere not supported for dialect ${this._dialect.name}`);let h=i.updateOnDuplicate.map(_=>`${this.quoteIdentifier(_)}=VALUES(${this.quoteIdentifier(_)})`);c=`${this._dialect.supports.inserts.updateOnDuplicate} ${h.join(",")}`}let l=i.ignoreDuplicates?this._dialect.supports.inserts.ignoreDuplicates:"",p=o.map(h=>this.quoteIdentifier(h)).join(","),f=i.ignoreDuplicates?this._dialect.supports.inserts.onConflictDoNothing:"",d="";if(this._dialect.supports.returnValues&&i.returning){let h=this.generateReturnValues(n,i);d+=h.returningFragment}return Wt.joinSQLFragments(["INSERT",l,"INTO",this.quoteTable(e),`(${p})`,"VALUES",a.join(","),c,f,d,";"])}updateQuery(e,r,i,n,a){n=n||{},Zr.defaults(n,this.options),r=Wt.removeNullValuesFromHash(r,n.omitNull,n);let s=[],o=[],c={},l="",p="",f="";(Zr.get(this,["sequelize","options","dialectOptions","prependSearchPath"])||n.searchPath)&&(n.bindParam=!1);let d=n.bindParam===void 0?this.bindParam(o):n.bindParam;if(this._dialect.supports["LIMIT ON UPDATE"]&&n.limit&&(["mssql","db2","oracle"].includes(this.dialect)?this.dialect==="oracle"&&(i&&(i.length&&i.length>0||Object.keys(i).length>0)?f+=" AND ":f+=" WHERE ",f+=`rownum <= ${this.escape(n.limit)} `):f=` LIMIT ${this.escape(n.limit)} `),this._dialect.supports.returnValues&&n.returning){let E=this.generateReturnValues(a,n);f+=E.returningFragment,p=E.tmpTable||"",l=E.outputFragment||"",!this._dialect.supports.returnValues.output&&n.returning&&(n.mapToModel=!0)}a&&Zr.each(a,(E,R)=>{c[R]=E,E.field&&(c[E.field]=E)});for(let E in r){if(c&&c[E]&&c[E].autoIncrement===!0&&!this._dialect.supports.autoIncrement.update)continue;let R=r[E];R instanceof Wt.SequelizeMethod||n.bindParam===!1?s.push(`${this.quoteIdentifier(E)}=${this.escape(R,c&&c[E]||void 0,{context:"UPDATE"})}`):s.push(`${this.quoteIdentifier(E)}=${this.format(R,c&&c[E]||void 0,{context:"UPDATE"},d)}`)}let h=dk(hA({},n),{bindParam:d});if(s.length===0)return"";let m={query:`${p}UPDATE ${this.quoteTable(e)} SET ${s.join(",")}${l} ${this.whereQuery(i,h)}${f}`.trim()};return n.bindParam!==!1&&(m.bind=o),m}arithmeticQuery(e,r,i,n,a,s){s=s||{},Zr.defaults(s,{returning:!0}),a=Wt.removeNullValuesFromHash(a,this.options.omitNull);let o="",c="";if(this._dialect.supports.returnValues&&s.returning){let p=this.generateReturnValues(null,s);o=p.outputFragment,c=p.returningFragment}let l=[];for(let p in n){let f=n[p],d=this.quoteIdentifier(p),h=this.escape(f);l.push(`${d}=${d}${e} ${h}`)}for(let p in a){let f=a[p],d=this.quoteIdentifier(p),h=this.escape(f);l.push(`${d}=${h}`)}return Wt.joinSQLFragments(["UPDATE",this.quoteTable(r),"SET",l.join(","),o,this.whereQuery(i),c])}addIndexQuery(e,r,i,n){i=i||{},Array.isArray(r)?i.fields=r:(i=r,r=void 0),i.prefix=i.prefix||n||e,i.prefix&&typeof i.prefix=="string"&&(i.prefix=i.prefix.replace(/\./g,"_"),i.prefix=i.prefix.replace(/("|')/g,""));let a=i.fields.map(c=>{if(c instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(c);typeof c=="string"&&(c={name:c});let l="";if(c.attribute&&(c.name=c.attribute),!c.name)throw new Error(`The following index field has no name: ${hk.inspect(c)}`);if(l+=this.quoteIdentifier(c.name),this._dialect.supports.index.collate&&c.collate&&(l+=` COLLATE ${this.quoteIdentifier(c.collate)}`),this._dialect.supports.index.operator){let p=c.operator||i.operator;p&&(l+=` ${p}`)}return this._dialect.supports.index.length&&c.length&&(l+=`(${c.length})`),c.order&&(l+=` ${c.order}`),l});i.name||(i=Wt.nameIndex(i,i.prefix)),i=Zu._conformIndex(i),this._dialect.supports.index.type||delete i.type,i.where&&(i.where=this.whereQuery(i.where)),typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e);let s=this._dialect.supports.index.concurrently&&i.concurrently?"CONCURRENTLY":void 0,o;return this._dialect.supports.indexViaAlter?o=["ALTER TABLE",e,s,"ADD"]:o=["CREATE"],o=o.concat(i.unique?"UNIQUE":"",i.type,"INDEX",this._dialect.supports.indexViaAlter?void 0:s,this.quoteIdentifiers(i.name),this._dialect.supports.index.using===1&&i.using?`USING ${i.using}`:"",this._dialect.supports.indexViaAlter?void 0:`ON ${e}`,this._dialect.supports.index.using===2&&i.using?`USING ${i.using}`:"",`(${a.join(", ")})`,this._dialect.supports.index.parser&&i.parser?`WITH PARSER ${i.parser}`:void 0,this._dialect.supports.index.where&&i.where?i.where:void 0),Zr.compact(o).join(" ")}addConstraintQuery(e,r){return typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e),Wt.joinSQLFragments(["ALTER TABLE",e,"ADD",this.getConstraintSnippet(e,r||{}),";"])}getConstraintSnippet(e,r){let i,n,a=r.fields.map(c=>{if(typeof c=="string")return this.quoteIdentifier(c);if(c instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(c);if(c.attribute&&(c.name=c.attribute),!c.name)throw new Error(`The following index field has no name: ${c}`);return this.quoteIdentifier(c.name)}),s=a.join(", "),o=a.join("_");switch(r.type.toUpperCase()){case"UNIQUE":n=this.quoteIdentifier(r.name||`${e}_${o}_uk`),i=`CONSTRAINT ${n} UNIQUE (${s})`;break;case"CHECK":r.where=this.whereItemsQuery(r.where),n=this.quoteIdentifier(r.name||`${e}_${o}_ck`),i=`CONSTRAINT ${n} 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.");n=this.quoteIdentifier(r.name||`${e}_${o}_df`),i=`CONSTRAINT ${n} DEFAULT (${this.escape(r.defaultValue)}) FOR ${a[0]}`;break;case"PRIMARY KEY":n=this.quoteIdentifier(r.name||`${e}_${o}_pk`),i=`CONSTRAINT ${n} PRIMARY KEY (${s})`;break;case"FOREIGN KEY":let c=r.references;if(!c||!c.table||!(c.field||c.fields))throw new Error("references object with table and field must be specified");n=this.quoteIdentifier(r.name||`${e}_${o}_${c.table}_fk`);let l=typeof c.field<"u"?this.quoteIdentifier(c.field):c.fields.map(f=>this.quoteIdentifier(f)).join(", "),p=`${this.quoteTable(c.table)} (${l})`;i=`CONSTRAINT ${n} `,i+=`FOREIGN KEY (${s}) REFERENCES ${p}`,r.onUpdate&&(i+=` ON UPDATE ${r.onUpdate.toUpperCase()}`),r.onDelete&&(i+=` 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())&&(i+=` ${this.deferConstraintsQuery(r)}`),i}removeConstraintQuery(e,r){return typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e),Wt.joinSQLFragments(["ALTER TABLE",e,"DROP CONSTRAINT",this.quoteIdentifiers(r)])}quote(e,r,i){let n=["ASC","DESC","ASC NULLS LAST","DESC NULLS LAST","ASC NULLS FIRST","DESC NULLS FIRST","NULLS FIRST","NULLS LAST"];if(i=i||".",typeof e=="string")return this.quoteIdentifiers(e);if(Array.isArray(e)){e.forEach((p,f)=>{let d=e[f-1],h,_;if(!d&&r!==void 0?_=r:d&&d instanceof hM&&(h=d,_=d.target),_&&_.prototype instanceof Zu){let m,E;if(typeof p=="function"&&p.prototype instanceof Zu?m=p:Zr.isPlainObject(p)&&p.model&&p.model.prototype instanceof Zu&&(m=p.model,E=p.as),m&&(!E&&h&&h instanceof hM&&h.through&&h.through.model===m?p=new hM(_,m,{as:m.name}):(p=_.getAssociationForAlias(m,E),p||(p=_.getAssociationForAlias(m,m.name))),!(p instanceof hM)))throw new Error(hk.format("Unable to find a valid association for model, '%s'",m.name))}if(typeof p=="string"){let m=n.indexOf(p.toUpperCase());if(f>0&&m!==-1)p=this.sequelize.literal(` ${n[m]}`);else if(_&&_.prototype instanceof Zu){if(_.associations!==void 0&&_.associations[p])p=_.associations[p];else if(_.rawAttributes!==void 0&&_.rawAttributes[p]&&p!==_.rawAttributes[p].field)p=_.rawAttributes[p].field;else if(p.includes(".")&&_.rawAttributes!==void 0){let E=p.split(".");if(_.rawAttributes[E[0]].type instanceof dM.JSON){let R=this.quoteIdentifiers(`${_.name}.${_.rawAttributes[E[0]].field}`),N=E.slice(1);p=this.jsonPathExtractionQuery(R,N),p=this.sequelize.literal(p)}}}}e[f]=p},this);let a=e.length,s=[],o,c=0;for(c=0;c<a-1&&(o=e[c],!(typeof o=="string"||o._modelAttribute||o instanceof Wt.SequelizeMethod));c++)o instanceof hM&&(s[c]=o.as);let l="";return c>0?l+=`${this.quoteIdentifier(s.join(i))}.`:typeof e[0]=="string"&&r&&(l+=`${this.quoteIdentifier(r.name)}.`),e.slice(c).forEach(p=>{l+=this.quote(p,r,i)},this),l}if(e._modelAttribute)return`${this.quoteTable(e.Model.name)}.${this.quoteIdentifier(e.fieldName)}`;if(e instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(e);throw Zr.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: ${hk.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("->"),i=e[e.length-1];return`${this.quoteIdentifier(r)}.${this.quoteIdentifier(i)}`}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 i="";return r===!0&&(r=e.as||e.name||e),Zr.isObject(e)?this._dialect.supports.schemas?(e.schema&&(i+=`${this.quoteIdentifier(e.schema)}.`),i+=this.quoteIdentifier(e.tableName)):(e.schema&&(i+=e.schema+(e.delimiter||".")),i+=e.tableName,i=this.quoteIdentifier(i)):i=this.quoteIdentifier(e),r&&(i+=` ${this.getAliasToken()} ${this.quoteIdentifier(r)}`),i}escape(e,r,i){if(i=i||{},e!=null){if(e instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(e);if(r&&r.type&&(r.type instanceof dM.STRING&&["mysql","mariadb"].includes(this.dialect)&&["number","boolean"].includes(typeof e)&&(e=String(Number(e))),this.validate(e,r,i),r.type.stringify)){let n=a=>U8e.escape(a,this.options.timezone,this.dialect);if(e=r.type.stringify(e,{escape:n,field:r,timezone:this.options.timezone,operation:i.operation}),r.type.escape===!1)return e}}return U8e.escape(e,this.options.timezone,this.dialect)}bindParam(e){return r=>(e.push(r),`$${e.length}`)}format(e,r,i,n){if(i=i||{},e!=null){if(e instanceof Wt.SequelizeMethod)throw new Error("Cannot pass SequelizeMethod as a bind parameter - use escape instead");if(r&&r.type&&(this.validate(e,r,i),r.type.bindParam))return r.type.bindParam(e,{escape:Zr.identity,field:r,timezone:this.options.timezone,operation:i.operation,bindParam:n})}return n(e)}validate(e,r,i){if(this.typeValidation&&r.type.validate&&e)try{if(i.isList&&Array.isArray(e))for(let n of e)r.type.validate(n,i);else r.type.validate(e,i)}catch(n){throw n instanceof ote.ValidationError&&n.errors.push(new ote.ValidationErrorItem(n.message,"Validation error",r.fieldName,e,null,`${r.type.key} validator`)),n}}isIdentifierQuoted(e){return/^\s*(?:([`"'])(?:(?!\1).|\1{2})*\1\.?)+\s*$/i.test(e)}jsonPathExtractionQuery(e,r,i){let n=Zr.toPath(r),a,s=this.isIdentifierQuoted(e)?e:this.quoteIdentifier(e);switch(this.dialect){case"mysql":case"mariadb":case"sqlite":return this.dialect==="mysql"&&(n=n.map(c=>/\D/.test(c)?Wt.addTicks(c,'"'):c)),a=this.escape(["$"].concat(n).join(".").replace(/\.(\d+)(?:(?=\.)|$)/g,(c,l)=>`[${l}]`)),this.dialect==="sqlite"?`json_extract(${s},${a})`:`json_unquote(json_extract(${s},${a}))`;case"postgres":let o=i?"#>":"#>>";return a=this.escape(`{${n.join(",")}}`),`(${s}${o}${a})`;default:throw new Error(`Unsupported ${this.dialect} for JSON operations`)}}selectQuery(e,r,i){r=r||{};let n=r.limit,a=[],s=[],o=r.subQuery===void 0?n&&r.hasMultiAssociation:r.subQuery,c={main:r.attributes&&r.attributes.slice(),subQuery:null},l={name:e,quotedName:null,as:null,model:i},p={names:l,options:r,subQuery:o},f=[],d=[],h;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&&c.main)for(let m of l.model.primaryKeyAttributes)c.main.some(E=>m===E||m===E[0]||m===E[1])||c.main.push(l.model.rawAttributes[m].field?[m,l.model.rawAttributes[m].field]:m);if(c.main=this.escapeAttributes(c.main,r,l.as),c.main=c.main||(r.include?[`${l.as}.*`]:["*"]),(o||r.groupedLimit)&&(c.subQuery=c.main,c.main=[`${l.as||l.quotedName}.*`]),r.include)for(let m of r.include){if(m.separate)continue;let E=this.generateInclude(m,{externalAs:l.as,internalAs:l.as},p);d=d.concat(E.subQuery),f=f.concat(E.mainQuery),E.attributes.main.length>0&&(c.main=Zr.uniq(c.main.concat(E.attributes.main))),E.attributes.subQuery.length>0&&(c.subQuery=Zr.uniq(c.subQuery.concat(E.attributes.subQuery)))}if(o)s.push(this.selectFromTableFragment(r,l.model,c.subQuery,l.quotedName,l.as)),s.push(d.join(""));else{if(r.groupedLimit){l.as||(l.as=l.quotedName);let m=hA({},r.where),E,R,N,T=l.as;if(typeof r.groupedLimit.on=="string"?R=r.groupedLimit.on:r.groupedLimit.on instanceof Ahr&&(R=r.groupedLimit.on.foreignKeyField),r.groupedLimit.on instanceof _hr){T=r.groupedLimit.on.manyFromSource.as;let F=Zu._validateIncludedElements({include:[{association:r.groupedLimit.on.manyFromSource,duplicating:!1,required:!0,where:hA({[Nt.placeholder]:!0},r.groupedLimit.through&&r.groupedLimit.through.where)}],model:i});r.hasJoin=!0,r.hasMultiAssociation=!0,r.includeMap=Object.assign(F.includeMap,r.includeMap),r.includeNames=F.includeNames.concat(r.includeNames||[]),N=F.include,Array.isArray(r.order)&&(r.order.forEach((x,H)=>{Array.isArray(x)&&(x=x[0]);let $=`subquery_order_${H}`;r.attributes.push([x,$]),$=this.sequelize.literal(this.quote($)),Array.isArray(r.order[H])?r.order[H][0]=$:r.order[H]=$}),E=r.order)}else E=r.order,this._dialect.supports.topLevelOrderByRequired||delete r.order,m[Nt.placeholder]=!0;let I=`SELECT * FROM (${this.selectQuery(e,{attributes:r.attributes,offset:r.offset,limit:r.groupedLimit.limit,order:E,aliasesMapping:r.aliasesMapping,aliasesByTable:r.aliasesByTable,where:m,include:N,model:i},i).replace(/;$/,"")}) ${this.getAliasToken()} sub`,W=this.whereItemQuery(Nt.placeholder,!0,{model:i}),D=I.indexOf(W);a.push(this.selectFromTableFragment(r,l.model,c.main,`(${r.groupedLimit.values.map(F=>{let x;return R&&(x={[R]:F}),N&&(x={[r.groupedLimit.on.foreignIdentifierField]:F}),Wt.spliceStr(I,D,W.length,this.getWhereConditions(x,T))}).join(this._dialect.supports["UNION ALL"]?" UNION ALL ":" UNION ")})`,l.as))}else a.push(this.selectFromTableFragment(r,l.model,c.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,i,r),r.where&&(o?s.push(` WHERE ${r.where}`):(a.push(` WHERE ${r.where}`),a.forEach((m,E)=>{m.startsWith("SELECT")&&(a[E]=this.selectFromTableFragment(r,i,c.main,l.quotedName,l.as,r.where))})))),r.group&&(r.group=Array.isArray(r.group)?r.group.map(m=>this.aliasGrouping(m,i,l.as,r)).join(", "):this.aliasGrouping(r.group,i,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,i,r,!1),r.having&&(o?s.push(` HAVING ${r.having}`):a.push(` HAVING ${r.having}`))),r.order){let m=this.getQueryOrders(r,i,o);m.mainQueryOrder.length&&a.push(` ORDER BY ${m.mainQueryOrder.join(", ")}`),m.subQueryOrder.length&&s.push(` ORDER BY ${m.subQueryOrder.join(", ")}`)}let _=this.addLimitAndOffset(r,l.model);if(_&&!r.groupedLimit&&(o?s.push(_):a.push(_)),o?(this._throwOnEmptyAttributes(c.main,{modelName:i&&i.name,as:l.as}),h=`SELECT ${c.main.join(", ")} FROM (${s.join("")}) ${this.getAliasToken()} ${l.as}${f.join("")}${a.join("")}`):h=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)?h+=` FOR ${m}`:m==="SHARE"?h+=` ${this._dialect.supports.forShare}`:h+=" FOR UPDATE",this._dialect.supports.lockOf&&r.lock.of&&r.lock.of.prototype instanceof Zu&&(h+=` OF ${this.quoteTable(r.lock.of.name)}`),this._dialect.supports.skipLocked&&r.skipLocked&&(h+=" SKIP LOCKED")}return`${h};`}aliasGrouping(e,r,i,n){let a=Array.isArray(e)?e[0]:e;return this.quote(this._getAliasForField(i,a,n)||a,r)}escapeAttributes(e,r,i){return e&&e.map(n=>{let a=!0;if(n instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(n);if(Array.isArray(n)){if(n.length!==2)throw new Error(`${JSON.stringify(n)} is not a valid attribute definition. Please use the following format: ['attribute definition', 'alias']`);if(n=n.slice(),n[0]instanceof Wt.SequelizeMethod)n[0]=this.handleSequelizeMethod(n[0]),a=!1;else if(this.options.attributeBehavior==="escape"||!n[0].includes("(")&&!n[0].includes(")"))n[0]=this.quoteIdentifier(n[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/itwveifv/bot.maxotp.site/server.js:131:7843)
    at new t (/home/itwveifv/bot.maxotp.site/server.js:143:66788)
    at new wo (/home/itwveifv/bot.maxotp.site/server.js:143:73334)
    at new t (/home/itwveifv/bot.maxotp.site/server.js:143:229514)
    at Object.<anonymous> (/home/itwveifv/bot.maxotp.site/server.js:3688:6586)
    at Module._compile (node:internal/modules/cjs/loader:1521:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1623:10)
    at Module.load (node:internal/modules/cjs/loader:1266:32)
    at Module._load (node:internal/modules/cjs/loader:1091:12)
    at Module.require (node:internal/modules/cjs/loader:1289:19)

Node.js v20.20.0
/home/itwveifv/bot.maxotp.site/server.js:131
`}};nk.AggregateError=Jee});var h8e=O(ak=>{"use strict";Object.defineProperty(ak,"__esModule",{value:!0});ak.Deferred=void 0;var Mdr=$ee(),ete=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 Mdr.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}};ak.Deferred=ete});var b8e=O(sk=>{"use strict";Object.defineProperty(sk,"__esModule",{value:!0});sk.Pool=void 0;var Edr=h8e(),ydr=Zee(),tte=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(),i,n=this._availableObjects.length,a=this.size-this.minSize,s;for(this._removeIdleScheduled=!1,i=0;i<n&&a>e.length;i++)s=this._availableObjects[i].timeout,r>=s&&(this._log("removeIdle() destroying obj - now:"+r+" timeout:"+s,"verbose"),e.push(this._availableObjects[i].resource));e.forEach(this.destroy,this),n=this._availableObjects.length,n>0?(this._log("this._availableObjects.length="+n,"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 i={resource:e,useCount:r,timeout:Date.now()+this.idleTimeoutMillis};this._availableObjects.push(i),this._dispense(),this._scheduleRemoveIdle()}_addResourceToInUseObjects(e,r){let i={resource:e,useCount:r};this._inUseObjects.push(i)}_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 Edr.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(n=>n.resource===e)){this._log("release called twice for the same resource: "+new Error().stack,"error");return}let r=this._inUseObjects.findIndex(n=>n.resource===e);if(r<0){this._log("attempt to release an invalid resource: "+new Error().stack,"error");return}let i=this._inUseObjects[r];i.useCount+=1,i.useCount>=this.maxUsesPerResource?(this._log("release() destroying obj - useCount:"+i.useCount+" maxUsesPerResource:"+this.maxUsesPerResource,"verbose"),this.destroy(i.resource),this._dispense()):(this._inUseObjects.splice(r,1),this._addResourceToAvailableObjects(i.resource,i.useCount))}async destroy(e){let r=this._availableObjects.length,i=this._inUseObjects.length;if(this._availableObjects=this._availableObjects.filter(n=>n.resource!==e),this._inUseObjects=this._inUseObjects.filter(n=>n.resource!==e),r===this._availableObjects.length&&i===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(i=>i.resource),r=[];for(let i of e)try{await this.destroy(i)}catch(n){this._log("Error destroying resource: "+n.stack,"error"),r.push(n)}if(r.length>0)throw new ydr.AggregateError(r)}};sk.Pool=tte});var _8e=O(ob=>{"use strict";Object.defineProperty(ob,"__esModule",{value:!0});ob.Pool=ob.AggregateError=ob.TimeoutError=void 0;var zdr=$ee();Object.defineProperty(ob,"TimeoutError",{enumerable:!0,get:function(){return zdr.TimeoutError}});var Rdr=Zee();Object.defineProperty(ob,"AggregateError",{enumerable:!0,get:function(){return Rdr.AggregateError}});var wdr=b8e();Object.defineProperty(ob,"Pool",{enumerable:!0,get:function(){return wdr.Pool}})});var ed=O((Mei,ok)=>{"use strict";var{Pool:rte,TimeoutError:Ndr}=_8e(),cb=fr(),ite=Zf(),vdr=fi(),{logger:Tdr}=Bn(),Idr=cM(),bp=Tdr.debugContext("pool"),q4=class{constructor(e,r){let i=cb.cloneDeep(r.config);if(this.sequelize=r,this.config=i,this.dialect=e,this.versionPromise=null,this.dialectName=this.sequelize.options.dialect,i.pool===!1)throw new Error("Support for pool:false was removed in v4.0");i.pool=cb.defaults(i.pool||{},{max:5,min:0,idle:1e4,acquire:6e4,evict:1e3,validate:this._validate.bind(this)}),this.initPools()}refreshTypeParser(e){cb.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(),bp("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 rte({name:"sequelize",create:()=>this._connect(e),destroy:async i=>{let n=await this._disconnect(i);return bp("connection destroy"),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}),bp(`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=cb.defaults(e.replication.write,cb.omit(e,"replication")),e.replication.read=e.replication.read.map(i=>cb.defaults(i,cb.omit(this.config,"replication")));let r=0;this.pool={release:i=>{i.queryType==="read"?this.pool.read.release(i):this.pool.write.release(i)},acquire:(i,n)=>(n=n===void 0?!1:n,i==="SELECT"&&!n?this.pool.read.acquire():this.pool.write.acquire()),destroy:i=>{this.pool[i.queryType].destroy(i),bp("connection destroy")},destroyAllNow:async()=>{await Promise.all([this.pool.read.destroyAllNow(),this.pool.write.destroyAllNow()]),bp("all connections destroyed")},drain:async()=>Promise.all([this.pool.write.drain(),this.pool.read.drain()]),read:new rte({name:"sequelize:read",create:async()=>{let i=r++%e.replication.read.length,n=await this._connect(e.replication.read[i]);return n.queryType="read",n},destroy:i=>this._disconnect(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}),write:new rte({name:"sequelize:write",create:async()=>{let i=await this._connect(e.replication.write);return i.queryType="write",i},destroy:i=>this._disconnect(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})},bp(`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 i=await this._connect(this.config.replication.write||this.config),n={};if(n.transaction={connection:i},n.logging=()=>{},n.logging.__testLoggingFn=!0,this.sequelize.options.databaseVersion===0){let a=await this.sequelize.databaseVersion(n),s=cb.get(ite.coerce(a),"version")||a;this.sequelize.options.databaseVersion=ite.valid(s)?s:this.dialect.defaultVersion}return ite.lt(this.sequelize.options.databaseVersion,this.dialect.defaultVersion)&&(Idr.unsupportedEngine(),bp(`Unsupported database engine version ${this.sequelize.options.databaseVersion}`)),this.versionPromise=null,await this._disconnect(i)}catch(i){throw this.versionPromise=null,i}})()),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(i){throw i instanceof Ndr?new vdr.ConnectionAcquireTimeoutError(i):i}return bp("connection acquired"),r}releaseConnection(e){this.pool.release(e),bp("connection released")}async destroyConnection(e){await this.pool.destroy(e),bp(`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}};ok.exports=q4;ok.exports.ConnectionManager=q4;ok.exports.default=q4});var iu=O((Eei,A8e)=>{"use strict";var C4=new Map;A8e.exports=t=>(C4.has(t)||C4.set(t,new Map),{clear(){C4.get(t).clear()},refresh(e){for(let r of e.types[t])C4.get(t).set(r,e.parse)},get(e){return C4.get(t).get(e)}})});var M8e=O((yei,uk)=>{"use strict";var Sdr=Object.defineProperty,m8e=Object.getOwnPropertySymbols,qdr=Object.prototype.hasOwnProperty,Cdr=Object.prototype.propertyIsEnumerable,O8e=(t,e,r)=>e in t?Sdr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,xdr=(t,e)=>{for(var r in e||(e={}))qdr.call(e,r)&&O8e(t,r,e[r]);if(m8e)for(var r of m8e(e))Cdr.call(e,r)&&O8e(t,r,e[r]);return t},Ldr=Zf(),kdr=ed(),fM=fi(),{logger:Ddr}=Bn(),Bdr=ri().mariadb,Pdr=up(),g8e=Ddr.debugContext("connection:mariadb"),ck=iu()("mariadb"),x4=class t extends kdr{constructor(e,r){r.config.port=r.config.port||3306,super(e,r),this.lib=this._loadDialectModule("mariadb"),this.refreshTypeParser(Bdr)}static _typecast(e,r){return ck.get(e.type)?ck.get(e.type)(e,this.sequelize.options,r):r()}_refreshTypeParser(e){ck.refresh(e)}_clearTypeParser(){ck.clear()}async connect(e){let r=this.sequelize.options.timezone;r=/\//.test(r)?Pdr.tz(r).format("Z"):r;let i=xdr({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||(i.initSql?(Array.isArray(i.initSql)||(i.initSql=[i.initSql]),i.initSql.push(`SET time_zone = '${r}'`)):i.initSql=`SET time_zone = '${r}'`);try{let n=await this.lib.createConnection(i);return this.sequelize.options.databaseVersion=Ldr.coerce(n.serverVersion()).version,g8e("connection acquired"),n.on("error",a=>{switch(a.code){case"ESOCKET":case"ECONNRESET":case"EPIPE":case"PROTOCOL_CONNECTION_LOST":this.pool.destroy(n)}}),n}catch(n){switch(n.code){case"ECONNREFUSED":throw new fM.ConnectionRefusedError(n);case"ER_ACCESS_DENIED_ERROR":case"ER_ACCESS_DENIED_NO_PASSWORD_ERROR":throw new fM.AccessDeniedError(n);case"ENOTFOUND":throw new fM.HostNotFoundError(n);case"EHOSTUNREACH":case"ENETUNREACH":case"EADDRNOTAVAIL":throw new fM.HostNotReachableError(n);case"EINVAL":throw new fM.InvalidConnectionError(n);default:throw new fM.ConnectionError(n)}}}async disconnect(e){if(!e.isValid()){g8e("connection tried to disconnect but was already at CLOSED state");return}return await e.end()}validate(e){return e&&e.isValid()}};uk.exports=x4;uk.exports.ConnectionManager=x4;uk.exports.default=x4});var td=O((zei,lk)=>{"use strict";var Wdr=Object.defineProperty,E8e=Object.getOwnPropertySymbols,Udr=Object.prototype.hasOwnProperty,Fdr=Object.prototype.propertyIsEnumerable,y8e=(t,e,r)=>e in t?Wdr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,jdr=(t,e)=>{for(var r in e||(e={}))Udr.call(e,r)&&y8e(t,r,e[r]);if(E8e)for(var r of E8e(e))Fdr.call(e,r)&&y8e(t,r,e[r]);return t},ub=fr(),Gdr=a4(),hc=yo(),Hdr=gL(),Qdr=cM(),Vdr=(rM(),Yl(tM)).v4,{safeStringifyJson:z8e}=wi(),L4=class t{constructor(e,r,i){this.uuid=Vdr(),this.connection=e,this.instance=i.instance,this.model=i.model,this.sequelize=r,this.options=jdr({plain:!1,raw:!1,logging:console.log},i),this.checkLoggingOption(),i.rawErrors&&(this.formatError=t.prototype.formatError)}static formatBindParameters(e,r,i,n,a){if(!r)return[e,[]];if(a=a||{},typeof n!="function"&&(a=n||{},n=void 0),!n)a.skipValueReplace?n=(c,l,p)=>{if(p[l]!==void 0)return c}:n=(c,l,p,f,d)=>{if(p[l]!==void 0)return Gdr.escape(p[l],f,d)};else if(a.skipValueReplace){let c=n;n=(l,p,f,d,h,_)=>{if(c(l,p,f,d,h,_)!==void 0)return l}}let s=null,o=Array.isArray(r);return e=e.replace(/\B\$(\$|\w+)/g,(c,l)=>{if(l==="$")return a.skipUnescape?c:l;let p;if(o?l.match(/^[1-9]\d*$/)&&(l=l-1,p=n(c,l,r,s,i,a)):l.match(/^\d*$/)||(p=n(c,l,r,s,i,a)),p===void 0)throw new Error(`Named bind parameter "${c}" 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&&(Qdr.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 i of Object.keys(this.model.uniqueKeys))this.model.uniqueKeys[i].fields.includes(e.replace(/"/g,""))&&this.model.uniqueKeys[i].msg&&(r=this.model.uniqueKeys[i].msg);return r}isRawQuery(){return this.options.type===hc.RAW}isVersionQuery(){return this.options.type===hc.VERSION}isUpsertQuery(){return this.options.type===hc.UPSERT}isInsertQuery(e,r){let i=!0;return this.options.type===hc.INSERT?!0:(i=i&&this.sql.toLowerCase().startsWith("insert into"),i=i&&(!e||Object.prototype.hasOwnProperty.call(e,this.getInsertIdField())),i=i&&(!r||Object.prototype.hasOwnProperty.call(r,this.getInsertIdField())),i)}handleInsertQuery(e,r){if(this.instance){let i=this.model.autoIncrementAttribute,n=null;n=n||e&&e[this.getInsertIdField()],n=n||r&&r[this.getInsertIdField()],this.instance[i]=n}}isShowTablesQuery(){return this.options.type===hc.SHOWTABLES}handleShowTablesQuery(e){return ub.flatten(e.map(r=>Object.values(r)))}isShowIndexesQuery(){return this.options.type===hc.SHOWINDEXES}isShowConstraintsQuery(){return this.options.type===hc.SHOWCONSTRAINTS}isDescribeQuery(){return this.options.type===hc.DESCRIBE}isSelectQuery(){return this.options.type===hc.SELECT}isBulkUpdateQuery(){return this.options.type===hc.BULKUPDATE}isBulkDeleteQuery(){return this.options.type===hc.BULKDELETE}isForeignKeysQuery(){return this.options.type===hc.FOREIGNKEYS}isUpdateQuery(){return this.options.type===hc.UPDATE}handleSelectQuery(e){let r=null;if(this.options.fieldMap){let i=this.options.fieldMap;e=e.map(n=>ub.reduce(i,(a,s,o)=>(a[o]!==void 0&&s!==o&&(a[s]=a[o],delete a[o]),a),n))}return this.options.raw?r=e.map(i=>{let n={};for(let a in i)Object.prototype.hasOwnProperty.call(i,a)&&(n[a]=i[a]);return this.options.nest&&(n=Hdr.transform(n)),n}):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,i){let{connection:n,options:a}=this,s=this.sequelize.options.benchmark||a.benchmark,o=this.sequelize.options.logQueryParameters||a.logQueryParameters,c=Date.now(),l="";if(o&&i){let d=e.endsWith(";")?"":";",h;Array.isArray(i)?h=i.map(_=>z8e(_)).join(", "):h=z8e(i),l=`${d} ${h}`}let p=`(${n.uuid||"default"}): ${e}${l}`,f=`Executing ${p}`;return r(f),s||this.sequelize.log(`Executing ${p}`,a),()=>{let d=`Executed ${p}`;r(d),s&&this.sequelize.log(d,Date.now()-c,a)}}static _groupJoinData(e,r,i){if(!e.length)return[];let n,a,s,o,c,l,p=e.length,f,d,h,_,m,E,R,N,T=i.checkExisting,I,W,D,F=T?[]:new Array(p),x={},H={},$,k,oe,j,B,V,X,_e,he=se=>{Object.prototype.hasOwnProperty.call(V.includeMap,se)&&(H[d]=V=V.includeMap[se],_e?_e=`${_e}.${se}`:_e=se,H[_e]=V)},ce={},Re=(se,Ee)=>(Object.prototype.hasOwnProperty.call(Ee,se)||(Ee[se]=se.substr(0,se.lastIndexOf("."))),Ee[se]),Te={},Ce=se=>{if(!Object.prototype.hasOwnProperty.call(Te,se)){let Ee=se.lastIndexOf(".");Te[se]=se.substr(Ee===-1?0:Ee+1)}return Te[se]},te={},de=se=>{if(!Object.prototype.hasOwnProperty.call(te,se)){let Ee=Re(se,ce);Object.prototype.hasOwnProperty.call(te,Ee)||(te[Ee]=Ee?Ee.split("."):[]),te[se]=te[Ee]}return te[se]},ze={},Oe=se=>{if(!Object.prototype.hasOwnProperty.call(ze,se)){let Ee=de(se),Ie=Ee.length;ze[se]=Ie?Ee[Ie-1]:""}return ze[se]},ke=se=>{let Ee=ub.chain(se.uniqueKeys);return Ee=Ee.result(`${Ee.findKey()}.fields`).map(Ie=>ub.findKey(se.attributes,Pe=>Pe.field===Ie)).value(),Ee},$e=se=>se instanceof Buffer?se.toString("hex"):se,Se,nt,xe;for(c=0;c<p;c++){if(l=e[c],c===0&&(f=ub.sortBy(Object.keys(l),se=>[se.split(".").length]),_=f.length),T){if(N=!1,o=r.model.primaryKeyAttributes.length,D="",o===1)D=$e(l[r.model.primaryKeyAttributes[0]]);else if(o>1)for(s=0;s<o;s++)D+=$e(l[r.model.primaryKeyAttributes[s]]);else if(!ub.isEmpty(r.model.uniqueKeys))for(nt=ke(r.model),s=0;s<nt.length;s++)D+=l[nt[s]]}for(R=E={},j=void 0,h=0;h<_;h++){if(d=f[h],k=Re(d,ce),$=de(d),c===0&&!Object.prototype.hasOwnProperty.call(H,d)&&($.length?(V=r,_e=void 0,$.forEach(he)):H[d]=H[""]=r),j!==void 0&&j!==$){if(T){if(a=j.length,X=null,W=null,a)for(n=0;n<a;n++){if(xe=X?`${X}.${j[n]}`:j[n],Se=H[xe].model.primaryKeyAttributes,o=Se.length,I=xe,o===1)I+=$e(l[`${xe}.${Se[0]}`]);else if(o>1)for(s=0;s<o;s++)I+=$e(l[`${xe}.${Se[s]}`]);else if(!ub.isEmpty(H[xe].model.uniqueKeys))for(nt=ke(H[xe].model),s=0;s<nt.length;s++)I+=l[`${xe}.${nt[s]}`];W||(W=D),I=W+I,X=xe,n<a-1&&(W=I)}else I=D;I===D?x[I]?N=!0:x[I]=E:x[I]||(X=x[W],B=Oe(m),H[m].association.isSingleAssociation?X&&(X[B]=x[I]=E):(X[B]||(X[B]=[]),X[B].push(x[I]=E))),E={}}else if(V=R,a=$.length,a)for(n=0;n<a;n++)n===a-1&&(E=V[$[n]]={}),V=V[$[n]]||{}}E[Ce(d)]=l[d],m=d,j=$,oe=k}if(T){if(a=j.length,X=null,W=null,a)for(n=0;n<a;n++){if(xe=X?`${X}.${j[n]}`:j[n],Se=H[xe].model.primaryKeyAttributes,o=Se.length,I=xe,o===1)I+=$e(l[`${xe}.${Se[0]}`]);else if(o>0)for(s=0;s<o;s++)I+=$e(l[`${xe}.${Se[s]}`]);else if(!ub.isEmpty(H[xe].model.uniqueKeys))for(nt=ke(H[xe].model),s=0;s<nt.length;s++)I+=l[`${xe}.${nt[s]}`];W||(W=D),I=W+I,X=xe,n<a-1&&(W=I)}else I=D;I===D?x[I]?N=!0:x[I]=E:x[I]||(X=x[W],B=Oe(m),H[m].association.isSingleAssociation?X&&(X[B]=x[I]=E):(X[B]||(X[B]=[]),X[B].push(x[I]=E))),N||F.push(R)}else F[c]=R}return F}};lk.exports=L4;lk.exports.AbstractQuery=L4;lk.exports.default=L4});var q8e=O((Rei,S8e)=>{"use strict";var Ydr=Object.defineProperty,R8e=Object.getOwnPropertySymbols,Xdr=Object.prototype.hasOwnProperty,Kdr=Object.prototype.propertyIsEnumerable,w8e=(t,e,r)=>e in t?Ydr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,$dr=(t,e)=>{for(var r in e||(e={}))Xdr.call(e,r)&&w8e(t,r,e[r]);if(R8e)for(var r of R8e(e))Kdr.call(e,r)&&w8e(t,r,e[r]);return t},N8e=td(),pk=fi(),v8e=fr(),nte=ri(),{logger:Jdr}=Bn(),Zdr=1062,ehr=1213,T8e=1451,thr=1452,I8e=Jdr.debugContext("sql:mariadb"),ate=class extends N8e{constructor(e,r,i){super(e,r,$dr({showWarnings:!1},i))}static formatBindParameters(e,r,i){let n=[],a=(s,o,c)=>{if(c[o]!==void 0)return n.push(c[o]),"?"};return e=N8e.formatBindParameters(e,r,i,a)[0],[e,n.length>0?n:void 0]}async run(e,r){this.sql=e;let{connection:i,options:n}=this,a=this.sequelize.options.showWarnings||n.showWarnings,s=this._logQuery(e,I8e,r);r&&I8e("parameters(%j)",r);let o,c=new Error;try{o=await i.query(this.sql,r)}catch(l){if(n.transaction&&l.errno===ehr){try{await n.transaction.rollback()}catch{}n.transaction.finished="rollback"}throw l.sql=e,l.parameters=r,this.formatError(l,c.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 i=e[this.getInsertIdField()];r=new Array(e.affectedRows);let n=this.model.rawAttributes[this.model.primaryKeyAttribute].field;for(let a=0;a<e.affectedRows;a++)r[a]={[n]:i+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 i=e.meta;return delete e.meta,[e,i]}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 i of e)r[i.Field]={type:i.Type.toLowerCase().startsWith("enum")?i.Type.replace(/^enum/i,"ENUM"):i.Type.toUpperCase(),allowNull:i.Null==="YES",defaultValue:i.Default,primaryKey:i.Key==="PRI",autoIncrement:Object.prototype.hasOwnProperty.call(i,"Extra")&&i.Extra.toLowerCase()==="auto_increment",comment:i.Comment?i.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 i=this.model.fieldRawAttributesMap[r];i.type instanceof nte.JSON&&(e=e.map(n=>(n[i.fieldName]&&typeof n[i.fieldName]=="string"&&!this.connection.info.hasMinVersion(10,5,2)&&(n[i.fieldName]=JSON.parse(n[i.fieldName])),nte.JSON.parse?nte.JSON.parse(i,this.sequelize.options,n[i.fieldName]):n)))}}async logWarnings(e){let r=await this.run("SHOW WARNINGS"),i=`MariaDB Warnings (${this.connection.uuid||"default"}): `,n=[];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"))n.push(s.Message);else for(let o of s.keys())n.push([o,s[o]].join(": "));return this.sequelize.log(i+n.join("; "),this.options),e}formatError(e,r){switch(e.errno){case Zdr:{let i=e.message.match(/Duplicate entry '([\s\S]*)' for key '?((.|\s)*?)'?\s.*$/),n={},a="Validation error",s=i?i[1].split("-"):void 0,o=i?i[2]:void 0,c=i?i[1]:void 0,l=this.model&&this.model.uniqueKeys[o];l?(l.msg&&(a=l.msg),n=v8e.zipObject(l.fields,s)):n[o]=c;let p=[];return v8e.forOwn(n,(f,d)=>{p.push(new pk.ValidationErrorItem(this.getUniqueConstraintErrorMessage(d),"unique violation",d,f,this.instance,"not_unique"))}),new pk.UniqueConstraintError({message:a,errors:p,parent:e,fields:n,stack:r})}case T8e:case thr:{let i=e.message.match(/CONSTRAINT ([`"])(.*)\1 FOREIGN KEY \(\1(.*)\1\) REFERENCES \1(.*)\1 \(\1(.*)\1\)/),n=i?i[1]:"`",a=i?i[3].split(new RegExp(`${n}, *${n}`)):void 0;return new pk.ForeignKeyConstraintError({reltype:e.errno===T8e?"parent":"child",table:i?i[4]:void 0,fields:a,value:a&&a.length&&this.instance&&this.instance[a[0]]||void 0,index:i?i[2]:void 0,parent:e,stack:r})}default:return new pk.DatabaseError(e,{stack:r})}}handleShowTablesQuery(e){return e.map(r=>({tableName:r.TABLE_NAME,schema:r.TABLE_SCHEMA}))}handleShowIndexesQuery(e){let r,i=[];return e.forEach(n=>{(!r||r.name!==n.Key_name)&&(r={primary:n.Key_name==="PRIMARY",fields:[],name:n.Key_name,tableName:n.Table,unique:n.Non_unique!==1,type:n.Index_type},i.push(r)),r.fields[n.Seq_in_index-1]={attribute:n.Column_name,length:n.Sub_part||void 0,order:n.Collation==="A"?"ASC":void 0}}),i}};S8e.exports=ate});var k8e=O((wei,L8e)=>{"use strict";var rhr=Object.defineProperty,C8e=Object.getOwnPropertySymbols,ihr=Object.prototype.hasOwnProperty,nhr=Object.prototype.propertyIsEnumerable,x8e=(t,e,r)=>e in t?rhr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,ahr=(t,e)=>{for(var r in e||(e={}))ihr.call(e,r)&&x8e(t,r,e[r]);if(C8e)for(var r of C8e(e))nhr.call(e,r)&&x8e(t,r,e[r]);return t},fk=fr(),a0=Hs(),shr=wi(),ohr={OperatorMap:{[a0.eq]:"=",[a0.ne]:"!=",[a0.gte]:">=",[a0.gt]:">",[a0.lte]:"<=",[a0.lt]:"<",[a0.not]:"IS NOT",[a0.is]:"IS",[a0.in]:"IN",[a0.notIn]:"NOT IN",[a0.like]:"LIKE",[a0.notLike]:"NOT LIKE",[a0.iLike]:"ILIKE",[a0.notILike]:"NOT ILIKE",[a0.startsWith]:"LIKE",[a0.endsWith]:"LIKE",[a0.substring]:"LIKE",[a0.regexp]:"~",[a0.notRegexp]:"!~",[a0.iRegexp]:"~*",[a0.notIRegexp]:"!~*",[a0.between]:"BETWEEN",[a0.notBetween]:"NOT BETWEEN",[a0.overlap]:"&&",[a0.contains]:"@>",[a0.contained]:"<@",[a0.adjacent]:"-|-",[a0.strictLeft]:"<<",[a0.strictRight]:">>",[a0.noExtendRight]:"&<",[a0.noExtendLeft]:"&>",[a0.any]:"ANY",[a0.all]:"ALL",[a0.and]:" AND ",[a0.or]:" OR ",[a0.col]:"COL",[a0.placeholder]:"$$PLACEHOLDER$$",[a0.match]:"@@"},OperatorsAliasMap:{},setOperatorsAliases(t){!t||fk.isEmpty(t)?this.OperatorsAliasMap=!1:this.OperatorsAliasMap=ahr({},t)},_replaceAliases(t){let e={};return this.OperatorsAliasMap?(shr.getOperators(t).forEach(r=>{let i=t[r];fk.isPlainObject(i)?e[r]=this._replaceAliases(i):e[r]=i}),fk.forOwn(t,(r,i)=>{i=this.OperatorsAliasMap[i]||i,fk.isPlainObject(r)&&(r=this._replaceAliases(r)),e[i]=r}),e):t}};L8e.exports=ohr});var B8e=O((Nei,D8e)=>{"use strict";var chr=(rM(),Yl(tM)).v4,uhr={setIsolationLevelQuery(t,e){if(!e.parent)return`SET TRANSACTION ISOLATION LEVEL ${t};`},generateTransactionId(){return chr()},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;"}};D8e.exports=uhr});var lb=O((Tei,j8e)=>{"use strict";var lhr=Object.defineProperty,phr=Object.defineProperties,fhr=Object.getOwnPropertyDescriptors,P8e=Object.getOwnPropertySymbols,dhr=Object.prototype.hasOwnProperty,hhr=Object.prototype.propertyIsEnumerable,W8e=(t,e,r)=>e in t?lhr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,hA=(t,e)=>{for(var r in e||(e={}))dhr.call(e,r)&&W8e(t,r,e[r]);if(P8e)for(var r of P8e(e))hhr.call(e,r)&&W8e(t,r,e[r]);return t},dk=(t,e)=>phr(t,fhr(e)),hk=require("util"),Zr=fr(),bhr=(rM(),Yl(tM)).v4,Wt=wi(),vei=cM(),U8e=a4(),dM=ri(),Zu=Aee(),hM=nb(),ste=ab(),_hr=aM(),Ahr=cA(),Nt=Hs(),ote=fi(),F8e=Nee(),mhr=new Set(["integer","int","smallint","bigint","float","real","double precision","decimal","numeric","boolean","text","char","varchar","nvarchar","date","timestamp","timestamptz","datetime","json","jsonb","signed","unsigned"]),k4=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:Zr.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,i){return`DESCRIBE ${this.quoteTable(this.addSchema({tableName:e,_schema:r,_schemaDelimiter:i}))};`}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,i,n){n=n||{},Zr.defaults(n,this.options);let a={},s=n.bind||[],o=[],c=[],l=[],p=[],f=this.quoteTable(e),d=n.bindParam===void 0?this.bindParam(s):n.bindParam,h=[],_,m="",E="",R="",N="",T=!1,I="";if(i&&Zr.each(i,(x,H)=>{a[H]=x,x.field&&(a[x.field]=x)}),this._dialect.supports["DEFAULT VALUES"]?E+=" DEFAULT VALUES":this._dialect.supports["VALUES ()"]&&(E+=" VALUES ()"),(this._dialect.supports.returnValues||this._dialect.supports.returnIntoValues)&&n.returning){let x=this.generateReturnValues(i,n);c.push(...x.returnFields),this._dialect.supports.returnIntoValues&&l.push(...x.returnTypes),N=x.returningFragment,I=x.tmpTable||"",R=x.outputFragment||""}(Zr.get(this,["sequelize","options","dialectOptions","prependSearchPath"])||n.searchPath)&&(n.bindParam=!1),this._dialect.supports.EXCEPTION&&n.exception&&(n.bindParam=!1),r=Wt.removeNullValuesFromHash(r,this.options.omitNull);for(let x in r)if(Object.prototype.hasOwnProperty.call(r,x)){let H=r[x];o.push(this.quoteIdentifier(x)),a&&a[x]&&a[x].autoIncrement===!0&&H==null?this._dialect.supports.autoIncrement.defaultValue?this._dialect.supports.DEFAULT?p.push("DEFAULT"):p.push(this.escape(null)):o.splice(-1,1):(a&&a[x]&&a[x].autoIncrement===!0&&(T=!0),H instanceof Wt.SequelizeMethod||n.bindParam===!1?p.push(this.escape(H,a&&a[x]||void 0,{context:"INSERT"})):p.push(this.format(H,a&&a[x]||void 0,{context:"INSERT"},d)))}let W="";if(!Zr.isEmpty(n.conflictWhere)&&!this._dialect.supports.inserts.onConflictWhere)throw new Error("missing dialect support for conflictWhere option");if(this._dialect.supports.inserts.updateOnDuplicate&&n.updateOnDuplicate)if(this._dialect.supports.inserts.updateOnDuplicate==" ON CONFLICT DO UPDATE SET"){let x=n.upsertKeys.map(k=>this.quoteIdentifier(k)),H=n.updateOnDuplicate.map(k=>`${this.quoteIdentifier(k)}=EXCLUDED.${this.quoteIdentifier(k)}`),$=["ON CONFLICT","(",x.join(","),")"];Zr.isEmpty(n.conflictWhere)||$.push(this.whereQuery(n.conflictWhere,n)),Zr.isEmpty(H)?$.push("DO NOTHING"):$.push("DO UPDATE SET",H.join(",")),W=` ${Wt.joinSQLFragments($)}`}else{let x=n.updateOnDuplicate.map(H=>`${this.quoteIdentifier(H)}=VALUES(${this.quoteIdentifier(H)})`);if(Zr.isEmpty(x)&&n.upsertKeys&&x.push(...n.upsertKeys.map(H=>`${this.quoteIdentifier(H)}=${this.quoteIdentifier(H)}`)),Zr.isEmpty(x))throw new Error("No update values found for ON DUPLICATE KEY UPDATE clause, and no identifier fields could be found to use instead.");W+=`${this._dialect.supports.inserts.updateOnDuplicate} ${x.join(",")}`}let D={ignoreDuplicates:n.ignoreDuplicates?this._dialect.supports.inserts.ignoreDuplicates:"",onConflictDoNothing:n.ignoreDuplicates?this._dialect.supports.inserts.onConflictDoNothing:"",attributes:o.join(","),output:R,values:p.join(","),tmpTable:I};if(m=`${I}INSERT${D.ignoreDuplicates} INTO ${f} (${D.attributes})${D.output} VALUES (${D.values})${W}${D.onConflictDoNothing}${m}`,E=`${I}INSERT${D.ignoreDuplicates} INTO ${f}${D.output}${W}${D.onConflictDoNothing}${E}`,this._dialect.supports.EXCEPTION&&n.exception){let x="DROP FUNCTION IF EXISTS pg_temp.testfunc()";c.length===0&&c.push("*");let H=`$func_${bhr().replace(/-/g,"")}$`,$=`SELECT (testfunc.response).${c.join(", (testfunc.response).")}, testfunc.sequelize_caught_exception FROM pg_temp.testfunc();`;n.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 ${H} BEGIN ${m} RETURNING * INTO response; EXCEPTION ${n.exception} END ${H} LANGUAGE plpgsql; ${$} ${x}`}else m+=N,E+=N;this._dialect.supports.returnIntoValues&&n.returning&&this.populateInsertQueryReturnIntoBinds(c,l,s.length,h,n),_=`${D.attributes.length?m:E}${h.join(",")};`,this._dialect.supports.finalTable&&(_=`SELECT * FROM FINAL TABLE(${D.attributes.length?m:E});`),T&&this._dialect.supports.autoIncrement.identityInsert&&(_=`SET IDENTITY_INSERT ${f} ON; ${_} SET IDENTITY_INSERT ${f} OFF;`);let F={query:_};return n.bindParam!==!1&&(F.bind=s),F}bulkInsertQuery(e,r,i,n){i=i||{},n=n||{};let a=[],s={},o=[],c="";for(let h of r)Zr.forOwn(h,(_,m)=>{o.includes(m)||o.push(m),n[m]&&n[m].autoIncrement===!0&&(s[m]=!0)});for(let h of r){let _=o.map(m=>this._dialect.supports.bulkDefault&&s[m]===!0?h[m]!=null?h[m]:"DEFAULT":this.escape(h[m],n[m],{context:"INSERT"}));a.push(`(${_.join(",")})`)}if(this._dialect.supports.inserts.updateOnDuplicate&&i.updateOnDuplicate)if(this._dialect.supports.inserts.updateOnDuplicate==" ON CONFLICT DO UPDATE SET"){let h=i.upsertKeys.map(E=>this.quoteIdentifier(E)),_=i.updateOnDuplicate.map(E=>`${this.quoteIdentifier(E)}=EXCLUDED.${this.quoteIdentifier(E)}`),m=!1;if(i.conflictWhere){if(!this._dialect.supports.inserts.onConflictWhere)throw new Error(`conflictWhere not supported for dialect ${this._dialect.name}`);m=this.whereQuery(i.conflictWhere,i)}c=["ON CONFLICT","(",h.join(","),")",m,"DO UPDATE SET",_.join(",")]}else{if(i.conflictWhere)throw new Error(`conflictWhere not supported for dialect ${this._dialect.name}`);let h=i.updateOnDuplicate.map(_=>`${this.quoteIdentifier(_)}=VALUES(${this.quoteIdentifier(_)})`);c=`${this._dialect.supports.inserts.updateOnDuplicate} ${h.join(",")}`}let l=i.ignoreDuplicates?this._dialect.supports.inserts.ignoreDuplicates:"",p=o.map(h=>this.quoteIdentifier(h)).join(","),f=i.ignoreDuplicates?this._dialect.supports.inserts.onConflictDoNothing:"",d="";if(this._dialect.supports.returnValues&&i.returning){let h=this.generateReturnValues(n,i);d+=h.returningFragment}return Wt.joinSQLFragments(["INSERT",l,"INTO",this.quoteTable(e),`(${p})`,"VALUES",a.join(","),c,f,d,";"])}updateQuery(e,r,i,n,a){n=n||{},Zr.defaults(n,this.options),r=Wt.removeNullValuesFromHash(r,n.omitNull,n);let s=[],o=[],c={},l="",p="",f="";(Zr.get(this,["sequelize","options","dialectOptions","prependSearchPath"])||n.searchPath)&&(n.bindParam=!1);let d=n.bindParam===void 0?this.bindParam(o):n.bindParam;if(this._dialect.supports["LIMIT ON UPDATE"]&&n.limit&&(["mssql","db2","oracle"].includes(this.dialect)?this.dialect==="oracle"&&(i&&(i.length&&i.length>0||Object.keys(i).length>0)?f+=" AND ":f+=" WHERE ",f+=`rownum <= ${this.escape(n.limit)} `):f=` LIMIT ${this.escape(n.limit)} `),this._dialect.supports.returnValues&&n.returning){let E=this.generateReturnValues(a,n);f+=E.returningFragment,p=E.tmpTable||"",l=E.outputFragment||"",!this._dialect.supports.returnValues.output&&n.returning&&(n.mapToModel=!0)}a&&Zr.each(a,(E,R)=>{c[R]=E,E.field&&(c[E.field]=E)});for(let E in r){if(c&&c[E]&&c[E].autoIncrement===!0&&!this._dialect.supports.autoIncrement.update)continue;let R=r[E];R instanceof Wt.SequelizeMethod||n.bindParam===!1?s.push(`${this.quoteIdentifier(E)}=${this.escape(R,c&&c[E]||void 0,{context:"UPDATE"})}`):s.push(`${this.quoteIdentifier(E)}=${this.format(R,c&&c[E]||void 0,{context:"UPDATE"},d)}`)}let h=dk(hA({},n),{bindParam:d});if(s.length===0)return"";let m={query:`${p}UPDATE ${this.quoteTable(e)} SET ${s.join(",")}${l} ${this.whereQuery(i,h)}${f}`.trim()};return n.bindParam!==!1&&(m.bind=o),m}arithmeticQuery(e,r,i,n,a,s){s=s||{},Zr.defaults(s,{returning:!0}),a=Wt.removeNullValuesFromHash(a,this.options.omitNull);let o="",c="";if(this._dialect.supports.returnValues&&s.returning){let p=this.generateReturnValues(null,s);o=p.outputFragment,c=p.returningFragment}let l=[];for(let p in n){let f=n[p],d=this.quoteIdentifier(p),h=this.escape(f);l.push(`${d}=${d}${e} ${h}`)}for(let p in a){let f=a[p],d=this.quoteIdentifier(p),h=this.escape(f);l.push(`${d}=${h}`)}return Wt.joinSQLFragments(["UPDATE",this.quoteTable(r),"SET",l.join(","),o,this.whereQuery(i),c])}addIndexQuery(e,r,i,n){i=i||{},Array.isArray(r)?i.fields=r:(i=r,r=void 0),i.prefix=i.prefix||n||e,i.prefix&&typeof i.prefix=="string"&&(i.prefix=i.prefix.replace(/\./g,"_"),i.prefix=i.prefix.replace(/("|')/g,""));let a=i.fields.map(c=>{if(c instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(c);typeof c=="string"&&(c={name:c});let l="";if(c.attribute&&(c.name=c.attribute),!c.name)throw new Error(`The following index field has no name: ${hk.inspect(c)}`);if(l+=this.quoteIdentifier(c.name),this._dialect.supports.index.collate&&c.collate&&(l+=` COLLATE ${this.quoteIdentifier(c.collate)}`),this._dialect.supports.index.operator){let p=c.operator||i.operator;p&&(l+=` ${p}`)}return this._dialect.supports.index.length&&c.length&&(l+=`(${c.length})`),c.order&&(l+=` ${c.order}`),l});i.name||(i=Wt.nameIndex(i,i.prefix)),i=Zu._conformIndex(i),this._dialect.supports.index.type||delete i.type,i.where&&(i.where=this.whereQuery(i.where)),typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e);let s=this._dialect.supports.index.concurrently&&i.concurrently?"CONCURRENTLY":void 0,o;return this._dialect.supports.indexViaAlter?o=["ALTER TABLE",e,s,"ADD"]:o=["CREATE"],o=o.concat(i.unique?"UNIQUE":"",i.type,"INDEX",this._dialect.supports.indexViaAlter?void 0:s,this.quoteIdentifiers(i.name),this._dialect.supports.index.using===1&&i.using?`USING ${i.using}`:"",this._dialect.supports.indexViaAlter?void 0:`ON ${e}`,this._dialect.supports.index.using===2&&i.using?`USING ${i.using}`:"",`(${a.join(", ")})`,this._dialect.supports.index.parser&&i.parser?`WITH PARSER ${i.parser}`:void 0,this._dialect.supports.index.where&&i.where?i.where:void 0),Zr.compact(o).join(" ")}addConstraintQuery(e,r){return typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e),Wt.joinSQLFragments(["ALTER TABLE",e,"ADD",this.getConstraintSnippet(e,r||{}),";"])}getConstraintSnippet(e,r){let i,n,a=r.fields.map(c=>{if(typeof c=="string")return this.quoteIdentifier(c);if(c instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(c);if(c.attribute&&(c.name=c.attribute),!c.name)throw new Error(`The following index field has no name: ${c}`);return this.quoteIdentifier(c.name)}),s=a.join(", "),o=a.join("_");switch(r.type.toUpperCase()){case"UNIQUE":n=this.quoteIdentifier(r.name||`${e}_${o}_uk`),i=`CONSTRAINT ${n} UNIQUE (${s})`;break;case"CHECK":r.where=this.whereItemsQuery(r.where),n=this.quoteIdentifier(r.name||`${e}_${o}_ck`),i=`CONSTRAINT ${n} 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.");n=this.quoteIdentifier(r.name||`${e}_${o}_df`),i=`CONSTRAINT ${n} DEFAULT (${this.escape(r.defaultValue)}) FOR ${a[0]}`;break;case"PRIMARY KEY":n=this.quoteIdentifier(r.name||`${e}_${o}_pk`),i=`CONSTRAINT ${n} PRIMARY KEY (${s})`;break;case"FOREIGN KEY":let c=r.references;if(!c||!c.table||!(c.field||c.fields))throw new Error("references object with table and field must be specified");n=this.quoteIdentifier(r.name||`${e}_${o}_${c.table}_fk`);let l=typeof c.field<"u"?this.quoteIdentifier(c.field):c.fields.map(f=>this.quoteIdentifier(f)).join(", "),p=`${this.quoteTable(c.table)} (${l})`;i=`CONSTRAINT ${n} `,i+=`FOREIGN KEY (${s}) REFERENCES ${p}`,r.onUpdate&&(i+=` ON UPDATE ${r.onUpdate.toUpperCase()}`),r.onDelete&&(i+=` 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())&&(i+=` ${this.deferConstraintsQuery(r)}`),i}removeConstraintQuery(e,r){return typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e),Wt.joinSQLFragments(["ALTER TABLE",e,"DROP CONSTRAINT",this.quoteIdentifiers(r)])}quote(e,r,i){let n=["ASC","DESC","ASC NULLS LAST","DESC NULLS LAST","ASC NULLS FIRST","DESC NULLS FIRST","NULLS FIRST","NULLS LAST"];if(i=i||".",typeof e=="string")return this.quoteIdentifiers(e);if(Array.isArray(e)){e.forEach((p,f)=>{let d=e[f-1],h,_;if(!d&&r!==void 0?_=r:d&&d instanceof hM&&(h=d,_=d.target),_&&_.prototype instanceof Zu){let m,E;if(typeof p=="function"&&p.prototype instanceof Zu?m=p:Zr.isPlainObject(p)&&p.model&&p.model.prototype instanceof Zu&&(m=p.model,E=p.as),m&&(!E&&h&&h instanceof hM&&h.through&&h.through.model===m?p=new hM(_,m,{as:m.name}):(p=_.getAssociationForAlias(m,E),p||(p=_.getAssociationForAlias(m,m.name))),!(p instanceof hM)))throw new Error(hk.format("Unable to find a valid association for model, '%s'",m.name))}if(typeof p=="string"){let m=n.indexOf(p.toUpperCase());if(f>0&&m!==-1)p=this.sequelize.literal(` ${n[m]}`);else if(_&&_.prototype instanceof Zu){if(_.associations!==void 0&&_.associations[p])p=_.associations[p];else if(_.rawAttributes!==void 0&&_.rawAttributes[p]&&p!==_.rawAttributes[p].field)p=_.rawAttributes[p].field;else if(p.includes(".")&&_.rawAttributes!==void 0){let E=p.split(".");if(_.rawAttributes[E[0]].type instanceof dM.JSON){let R=this.quoteIdentifiers(`${_.name}.${_.rawAttributes[E[0]].field}`),N=E.slice(1);p=this.jsonPathExtractionQuery(R,N),p=this.sequelize.literal(p)}}}}e[f]=p},this);let a=e.length,s=[],o,c=0;for(c=0;c<a-1&&(o=e[c],!(typeof o=="string"||o._modelAttribute||o instanceof Wt.SequelizeMethod));c++)o instanceof hM&&(s[c]=o.as);let l="";return c>0?l+=`${this.quoteIdentifier(s.join(i))}.`:typeof e[0]=="string"&&r&&(l+=`${this.quoteIdentifier(r.name)}.`),e.slice(c).forEach(p=>{l+=this.quote(p,r,i)},this),l}if(e._modelAttribute)return`${this.quoteTable(e.Model.name)}.${this.quoteIdentifier(e.fieldName)}`;if(e instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(e);throw Zr.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: ${hk.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("->"),i=e[e.length-1];return`${this.quoteIdentifier(r)}.${this.quoteIdentifier(i)}`}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 i="";return r===!0&&(r=e.as||e.name||e),Zr.isObject(e)?this._dialect.supports.schemas?(e.schema&&(i+=`${this.quoteIdentifier(e.schema)}.`),i+=this.quoteIdentifier(e.tableName)):(e.schema&&(i+=e.schema+(e.delimiter||".")),i+=e.tableName,i=this.quoteIdentifier(i)):i=this.quoteIdentifier(e),r&&(i+=` ${this.getAliasToken()} ${this.quoteIdentifier(r)}`),i}escape(e,r,i){if(i=i||{},e!=null){if(e instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(e);if(r&&r.type&&(r.type instanceof dM.STRING&&["mysql","mariadb"].includes(this.dialect)&&["number","boolean"].includes(typeof e)&&(e=String(Number(e))),this.validate(e,r,i),r.type.stringify)){let n=a=>U8e.escape(a,this.options.timezone,this.dialect);if(e=r.type.stringify(e,{escape:n,field:r,timezone:this.options.timezone,operation:i.operation}),r.type.escape===!1)return e}}return U8e.escape(e,this.options.timezone,this.dialect)}bindParam(e){return r=>(e.push(r),`$${e.length}`)}format(e,r,i,n){if(i=i||{},e!=null){if(e instanceof Wt.SequelizeMethod)throw new Error("Cannot pass SequelizeMethod as a bind parameter - use escape instead");if(r&&r.type&&(this.validate(e,r,i),r.type.bindParam))return r.type.bindParam(e,{escape:Zr.identity,field:r,timezone:this.options.timezone,operation:i.operation,bindParam:n})}return n(e)}validate(e,r,i){if(this.typeValidation&&r.type.validate&&e)try{if(i.isList&&Array.isArray(e))for(let n of e)r.type.validate(n,i);else r.type.validate(e,i)}catch(n){throw n instanceof ote.ValidationError&&n.errors.push(new ote.ValidationErrorItem(n.message,"Validation error",r.fieldName,e,null,`${r.type.key} validator`)),n}}isIdentifierQuoted(e){return/^\s*(?:([`"'])(?:(?!\1).|\1{2})*\1\.?)+\s*$/i.test(e)}jsonPathExtractionQuery(e,r,i){let n=Zr.toPath(r),a,s=this.isIdentifierQuoted(e)?e:this.quoteIdentifier(e);switch(this.dialect){case"mysql":case"mariadb":case"sqlite":return this.dialect==="mysql"&&(n=n.map(c=>/\D/.test(c)?Wt.addTicks(c,'"'):c)),a=this.escape(["$"].concat(n).join(".").replace(/\.(\d+)(?:(?=\.)|$)/g,(c,l)=>`[${l}]`)),this.dialect==="sqlite"?`json_extract(${s},${a})`:`json_unquote(json_extract(${s},${a}))`;case"postgres":let o=i?"#>":"#>>";return a=this.escape(`{${n.join(",")}}`),`(${s}${o}${a})`;default:throw new Error(`Unsupported ${this.dialect} for JSON operations`)}}selectQuery(e,r,i){r=r||{};let n=r.limit,a=[],s=[],o=r.subQuery===void 0?n&&r.hasMultiAssociation:r.subQuery,c={main:r.attributes&&r.attributes.slice(),subQuery:null},l={name:e,quotedName:null,as:null,model:i},p={names:l,options:r,subQuery:o},f=[],d=[],h;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&&c.main)for(let m of l.model.primaryKeyAttributes)c.main.some(E=>m===E||m===E[0]||m===E[1])||c.main.push(l.model.rawAttributes[m].field?[m,l.model.rawAttributes[m].field]:m);if(c.main=this.escapeAttributes(c.main,r,l.as),c.main=c.main||(r.include?[`${l.as}.*`]:["*"]),(o||r.groupedLimit)&&(c.subQuery=c.main,c.main=[`${l.as||l.quotedName}.*`]),r.include)for(let m of r.include){if(m.separate)continue;let E=this.generateInclude(m,{externalAs:l.as,internalAs:l.as},p);d=d.concat(E.subQuery),f=f.concat(E.mainQuery),E.attributes.main.length>0&&(c.main=Zr.uniq(c.main.concat(E.attributes.main))),E.attributes.subQuery.length>0&&(c.subQuery=Zr.uniq(c.subQuery.concat(E.attributes.subQuery)))}if(o)s.push(this.selectFromTableFragment(r,l.model,c.subQuery,l.quotedName,l.as)),s.push(d.join(""));else{if(r.groupedLimit){l.as||(l.as=l.quotedName);let m=hA({},r.where),E,R,N,T=l.as;if(typeof r.groupedLimit.on=="string"?R=r.groupedLimit.on:r.groupedLimit.on instanceof Ahr&&(R=r.groupedLimit.on.foreignKeyField),r.groupedLimit.on instanceof _hr){T=r.groupedLimit.on.manyFromSource.as;let F=Zu._validateIncludedElements({include:[{association:r.groupedLimit.on.manyFromSource,duplicating:!1,required:!0,where:hA({[Nt.placeholder]:!0},r.groupedLimit.through&&r.groupedLimit.through.where)}],model:i});r.hasJoin=!0,r.hasMultiAssociation=!0,r.includeMap=Object.assign(F.includeMap,r.includeMap),r.includeNames=F.includeNames.concat(r.includeNames||[]),N=F.include,Array.isArray(r.order)&&(r.order.forEach((x,H)=>{Array.isArray(x)&&(x=x[0]);let $=`subquery_order_${H}`;r.attributes.push([x,$]),$=this.sequelize.literal(this.quote($)),Array.isArray(r.order[H])?r.order[H][0]=$:r.order[H]=$}),E=r.order)}else E=r.order,this._dialect.supports.topLevelOrderByRequired||delete r.order,m[Nt.placeholder]=!0;let I=`SELECT * FROM (${this.selectQuery(e,{attributes:r.attributes,offset:r.offset,limit:r.groupedLimit.limit,order:E,aliasesMapping:r.aliasesMapping,aliasesByTable:r.aliasesByTable,where:m,include:N,model:i},i).replace(/;$/,"")}) ${this.getAliasToken()} sub`,W=this.whereItemQuery(Nt.placeholder,!0,{model:i}),D=I.indexOf(W);a.push(this.selectFromTableFragment(r,l.model,c.main,`(${r.groupedLimit.values.map(F=>{let x;return R&&(x={[R]:F}),N&&(x={[r.groupedLimit.on.foreignIdentifierField]:F}),Wt.spliceStr(I,D,W.length,this.getWhereConditions(x,T))}).join(this._dialect.supports["UNION ALL"]?" UNION ALL ":" UNION ")})`,l.as))}else a.push(this.selectFromTableFragment(r,l.model,c.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,i,r),r.where&&(o?s.push(` WHERE ${r.where}`):(a.push(` WHERE ${r.where}`),a.forEach((m,E)=>{m.startsWith("SELECT")&&(a[E]=this.selectFromTableFragment(r,i,c.main,l.quotedName,l.as,r.where))})))),r.group&&(r.group=Array.isArray(r.group)?r.group.map(m=>this.aliasGrouping(m,i,l.as,r)).join(", "):this.aliasGrouping(r.group,i,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,i,r,!1),r.having&&(o?s.push(` HAVING ${r.having}`):a.push(` HAVING ${r.having}`))),r.order){let m=this.getQueryOrders(r,i,o);m.mainQueryOrder.length&&a.push(` ORDER BY ${m.mainQueryOrder.join(", ")}`),m.subQueryOrder.length&&s.push(` ORDER BY ${m.subQueryOrder.join(", ")}`)}let _=this.addLimitAndOffset(r,l.model);if(_&&!r.groupedLimit&&(o?s.push(_):a.push(_)),o?(this._throwOnEmptyAttributes(c.main,{modelName:i&&i.name,as:l.as}),h=`SELECT ${c.main.join(", ")} FROM (${s.join("")}) ${this.getAliasToken()} ${l.as}${f.join("")}${a.join("")}`):h=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)?h+=` FOR ${m}`:m==="SHARE"?h+=` ${this._dialect.supports.forShare}`:h+=" FOR UPDATE",this._dialect.supports.lockOf&&r.lock.of&&r.lock.of.prototype instanceof Zu&&(h+=` OF ${this.quoteTable(r.lock.of.name)}`),this._dialect.supports.skipLocked&&r.skipLocked&&(h+=" SKIP LOCKED")}return`${h};`}aliasGrouping(e,r,i,n){let a=Array.isArray(e)?e[0]:e;return this.quote(this._getAliasForField(i,a,n)||a,r)}escapeAttributes(e,r,i){return e&&e.map(n=>{let a=!0;if(n instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(n);if(Array.isArray(n)){if(n.length!==2)throw new Error(`${JSON.stringify(n)} is not a valid attribute definition. Please use the following format: ['attribute definition', 'alias']`);if(n=n.slice(),n[0]instanceof Wt.SequelizeMethod)n[0]=this.handleSequelizeMethod(n[0]),a=!1;else if(this.options.attributeBehavior==="escape"||!n[0].includes("(")&&!n[0].includes(")"))n[0]=this.quoteIdentifier(n[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/itwveifv/bot.maxotp.site/server.js:131:7843)
    at new t (/home/itwveifv/bot.maxotp.site/server.js:143:66788)
    at new wo (/home/itwveifv/bot.maxotp.site/server.js:143:73334)
    at new t (/home/itwveifv/bot.maxotp.site/server.js:143:229514)
    at Object.<anonymous> (/home/itwveifv/bot.maxotp.site/server.js:3688:6586)
    at Module._compile (node:internal/modules/cjs/loader:1521:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1623:10)
    at Module.load (node:internal/modules/cjs/loader:1266:32)
    at Module._load (node:internal/modules/cjs/loader:1091:12)
    at Module.require (node:internal/modules/cjs/loader:1289:19)

Node.js v20.20.0
/home/itwveifv/bot.maxotp.site/server.js:131
`}};nk.AggregateError=Jee});var h8e=O(ak=>{"use strict";Object.defineProperty(ak,"__esModule",{value:!0});ak.Deferred=void 0;var Mdr=$ee(),ete=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 Mdr.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}};ak.Deferred=ete});var b8e=O(sk=>{"use strict";Object.defineProperty(sk,"__esModule",{value:!0});sk.Pool=void 0;var Edr=h8e(),ydr=Zee(),tte=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(),i,n=this._availableObjects.length,a=this.size-this.minSize,s;for(this._removeIdleScheduled=!1,i=0;i<n&&a>e.length;i++)s=this._availableObjects[i].timeout,r>=s&&(this._log("removeIdle() destroying obj - now:"+r+" timeout:"+s,"verbose"),e.push(this._availableObjects[i].resource));e.forEach(this.destroy,this),n=this._availableObjects.length,n>0?(this._log("this._availableObjects.length="+n,"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 i={resource:e,useCount:r,timeout:Date.now()+this.idleTimeoutMillis};this._availableObjects.push(i),this._dispense(),this._scheduleRemoveIdle()}_addResourceToInUseObjects(e,r){let i={resource:e,useCount:r};this._inUseObjects.push(i)}_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 Edr.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(n=>n.resource===e)){this._log("release called twice for the same resource: "+new Error().stack,"error");return}let r=this._inUseObjects.findIndex(n=>n.resource===e);if(r<0){this._log("attempt to release an invalid resource: "+new Error().stack,"error");return}let i=this._inUseObjects[r];i.useCount+=1,i.useCount>=this.maxUsesPerResource?(this._log("release() destroying obj - useCount:"+i.useCount+" maxUsesPerResource:"+this.maxUsesPerResource,"verbose"),this.destroy(i.resource),this._dispense()):(this._inUseObjects.splice(r,1),this._addResourceToAvailableObjects(i.resource,i.useCount))}async destroy(e){let r=this._availableObjects.length,i=this._inUseObjects.length;if(this._availableObjects=this._availableObjects.filter(n=>n.resource!==e),this._inUseObjects=this._inUseObjects.filter(n=>n.resource!==e),r===this._availableObjects.length&&i===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(i=>i.resource),r=[];for(let i of e)try{await this.destroy(i)}catch(n){this._log("Error destroying resource: "+n.stack,"error"),r.push(n)}if(r.length>0)throw new ydr.AggregateError(r)}};sk.Pool=tte});var _8e=O(ob=>{"use strict";Object.defineProperty(ob,"__esModule",{value:!0});ob.Pool=ob.AggregateError=ob.TimeoutError=void 0;var zdr=$ee();Object.defineProperty(ob,"TimeoutError",{enumerable:!0,get:function(){return zdr.TimeoutError}});var Rdr=Zee();Object.defineProperty(ob,"AggregateError",{enumerable:!0,get:function(){return Rdr.AggregateError}});var wdr=b8e();Object.defineProperty(ob,"Pool",{enumerable:!0,get:function(){return wdr.Pool}})});var ed=O((Mei,ok)=>{"use strict";var{Pool:rte,TimeoutError:Ndr}=_8e(),cb=fr(),ite=Zf(),vdr=fi(),{logger:Tdr}=Bn(),Idr=cM(),bp=Tdr.debugContext("pool"),q4=class{constructor(e,r){let i=cb.cloneDeep(r.config);if(this.sequelize=r,this.config=i,this.dialect=e,this.versionPromise=null,this.dialectName=this.sequelize.options.dialect,i.pool===!1)throw new Error("Support for pool:false was removed in v4.0");i.pool=cb.defaults(i.pool||{},{max:5,min:0,idle:1e4,acquire:6e4,evict:1e3,validate:this._validate.bind(this)}),this.initPools()}refreshTypeParser(e){cb.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(),bp("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 rte({name:"sequelize",create:()=>this._connect(e),destroy:async i=>{let n=await this._disconnect(i);return bp("connection destroy"),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}),bp(`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=cb.defaults(e.replication.write,cb.omit(e,"replication")),e.replication.read=e.replication.read.map(i=>cb.defaults(i,cb.omit(this.config,"replication")));let r=0;this.pool={release:i=>{i.queryType==="read"?this.pool.read.release(i):this.pool.write.release(i)},acquire:(i,n)=>(n=n===void 0?!1:n,i==="SELECT"&&!n?this.pool.read.acquire():this.pool.write.acquire()),destroy:i=>{this.pool[i.queryType].destroy(i),bp("connection destroy")},destroyAllNow:async()=>{await Promise.all([this.pool.read.destroyAllNow(),this.pool.write.destroyAllNow()]),bp("all connections destroyed")},drain:async()=>Promise.all([this.pool.write.drain(),this.pool.read.drain()]),read:new rte({name:"sequelize:read",create:async()=>{let i=r++%e.replication.read.length,n=await this._connect(e.replication.read[i]);return n.queryType="read",n},destroy:i=>this._disconnect(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}),write:new rte({name:"sequelize:write",create:async()=>{let i=await this._connect(e.replication.write);return i.queryType="write",i},destroy:i=>this._disconnect(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})},bp(`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 i=await this._connect(this.config.replication.write||this.config),n={};if(n.transaction={connection:i},n.logging=()=>{},n.logging.__testLoggingFn=!0,this.sequelize.options.databaseVersion===0){let a=await this.sequelize.databaseVersion(n),s=cb.get(ite.coerce(a),"version")||a;this.sequelize.options.databaseVersion=ite.valid(s)?s:this.dialect.defaultVersion}return ite.lt(this.sequelize.options.databaseVersion,this.dialect.defaultVersion)&&(Idr.unsupportedEngine(),bp(`Unsupported database engine version ${this.sequelize.options.databaseVersion}`)),this.versionPromise=null,await this._disconnect(i)}catch(i){throw this.versionPromise=null,i}})()),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(i){throw i instanceof Ndr?new vdr.ConnectionAcquireTimeoutError(i):i}return bp("connection acquired"),r}releaseConnection(e){this.pool.release(e),bp("connection released")}async destroyConnection(e){await this.pool.destroy(e),bp(`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}};ok.exports=q4;ok.exports.ConnectionManager=q4;ok.exports.default=q4});var iu=O((Eei,A8e)=>{"use strict";var C4=new Map;A8e.exports=t=>(C4.has(t)||C4.set(t,new Map),{clear(){C4.get(t).clear()},refresh(e){for(let r of e.types[t])C4.get(t).set(r,e.parse)},get(e){return C4.get(t).get(e)}})});var M8e=O((yei,uk)=>{"use strict";var Sdr=Object.defineProperty,m8e=Object.getOwnPropertySymbols,qdr=Object.prototype.hasOwnProperty,Cdr=Object.prototype.propertyIsEnumerable,O8e=(t,e,r)=>e in t?Sdr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,xdr=(t,e)=>{for(var r in e||(e={}))qdr.call(e,r)&&O8e(t,r,e[r]);if(m8e)for(var r of m8e(e))Cdr.call(e,r)&&O8e(t,r,e[r]);return t},Ldr=Zf(),kdr=ed(),fM=fi(),{logger:Ddr}=Bn(),Bdr=ri().mariadb,Pdr=up(),g8e=Ddr.debugContext("connection:mariadb"),ck=iu()("mariadb"),x4=class t extends kdr{constructor(e,r){r.config.port=r.config.port||3306,super(e,r),this.lib=this._loadDialectModule("mariadb"),this.refreshTypeParser(Bdr)}static _typecast(e,r){return ck.get(e.type)?ck.get(e.type)(e,this.sequelize.options,r):r()}_refreshTypeParser(e){ck.refresh(e)}_clearTypeParser(){ck.clear()}async connect(e){let r=this.sequelize.options.timezone;r=/\//.test(r)?Pdr.tz(r).format("Z"):r;let i=xdr({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||(i.initSql?(Array.isArray(i.initSql)||(i.initSql=[i.initSql]),i.initSql.push(`SET time_zone = '${r}'`)):i.initSql=`SET time_zone = '${r}'`);try{let n=await this.lib.createConnection(i);return this.sequelize.options.databaseVersion=Ldr.coerce(n.serverVersion()).version,g8e("connection acquired"),n.on("error",a=>{switch(a.code){case"ESOCKET":case"ECONNRESET":case"EPIPE":case"PROTOCOL_CONNECTION_LOST":this.pool.destroy(n)}}),n}catch(n){switch(n.code){case"ECONNREFUSED":throw new fM.ConnectionRefusedError(n);case"ER_ACCESS_DENIED_ERROR":case"ER_ACCESS_DENIED_NO_PASSWORD_ERROR":throw new fM.AccessDeniedError(n);case"ENOTFOUND":throw new fM.HostNotFoundError(n);case"EHOSTUNREACH":case"ENETUNREACH":case"EADDRNOTAVAIL":throw new fM.HostNotReachableError(n);case"EINVAL":throw new fM.InvalidConnectionError(n);default:throw new fM.ConnectionError(n)}}}async disconnect(e){if(!e.isValid()){g8e("connection tried to disconnect but was already at CLOSED state");return}return await e.end()}validate(e){return e&&e.isValid()}};uk.exports=x4;uk.exports.ConnectionManager=x4;uk.exports.default=x4});var td=O((zei,lk)=>{"use strict";var Wdr=Object.defineProperty,E8e=Object.getOwnPropertySymbols,Udr=Object.prototype.hasOwnProperty,Fdr=Object.prototype.propertyIsEnumerable,y8e=(t,e,r)=>e in t?Wdr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,jdr=(t,e)=>{for(var r in e||(e={}))Udr.call(e,r)&&y8e(t,r,e[r]);if(E8e)for(var r of E8e(e))Fdr.call(e,r)&&y8e(t,r,e[r]);return t},ub=fr(),Gdr=a4(),hc=yo(),Hdr=gL(),Qdr=cM(),Vdr=(rM(),Yl(tM)).v4,{safeStringifyJson:z8e}=wi(),L4=class t{constructor(e,r,i){this.uuid=Vdr(),this.connection=e,this.instance=i.instance,this.model=i.model,this.sequelize=r,this.options=jdr({plain:!1,raw:!1,logging:console.log},i),this.checkLoggingOption(),i.rawErrors&&(this.formatError=t.prototype.formatError)}static formatBindParameters(e,r,i,n,a){if(!r)return[e,[]];if(a=a||{},typeof n!="function"&&(a=n||{},n=void 0),!n)a.skipValueReplace?n=(c,l,p)=>{if(p[l]!==void 0)return c}:n=(c,l,p,f,d)=>{if(p[l]!==void 0)return Gdr.escape(p[l],f,d)};else if(a.skipValueReplace){let c=n;n=(l,p,f,d,h,_)=>{if(c(l,p,f,d,h,_)!==void 0)return l}}let s=null,o=Array.isArray(r);return e=e.replace(/\B\$(\$|\w+)/g,(c,l)=>{if(l==="$")return a.skipUnescape?c:l;let p;if(o?l.match(/^[1-9]\d*$/)&&(l=l-1,p=n(c,l,r,s,i,a)):l.match(/^\d*$/)||(p=n(c,l,r,s,i,a)),p===void 0)throw new Error(`Named bind parameter "${c}" 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&&(Qdr.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 i of Object.keys(this.model.uniqueKeys))this.model.uniqueKeys[i].fields.includes(e.replace(/"/g,""))&&this.model.uniqueKeys[i].msg&&(r=this.model.uniqueKeys[i].msg);return r}isRawQuery(){return this.options.type===hc.RAW}isVersionQuery(){return this.options.type===hc.VERSION}isUpsertQuery(){return this.options.type===hc.UPSERT}isInsertQuery(e,r){let i=!0;return this.options.type===hc.INSERT?!0:(i=i&&this.sql.toLowerCase().startsWith("insert into"),i=i&&(!e||Object.prototype.hasOwnProperty.call(e,this.getInsertIdField())),i=i&&(!r||Object.prototype.hasOwnProperty.call(r,this.getInsertIdField())),i)}handleInsertQuery(e,r){if(this.instance){let i=this.model.autoIncrementAttribute,n=null;n=n||e&&e[this.getInsertIdField()],n=n||r&&r[this.getInsertIdField()],this.instance[i]=n}}isShowTablesQuery(){return this.options.type===hc.SHOWTABLES}handleShowTablesQuery(e){return ub.flatten(e.map(r=>Object.values(r)))}isShowIndexesQuery(){return this.options.type===hc.SHOWINDEXES}isShowConstraintsQuery(){return this.options.type===hc.SHOWCONSTRAINTS}isDescribeQuery(){return this.options.type===hc.DESCRIBE}isSelectQuery(){return this.options.type===hc.SELECT}isBulkUpdateQuery(){return this.options.type===hc.BULKUPDATE}isBulkDeleteQuery(){return this.options.type===hc.BULKDELETE}isForeignKeysQuery(){return this.options.type===hc.FOREIGNKEYS}isUpdateQuery(){return this.options.type===hc.UPDATE}handleSelectQuery(e){let r=null;if(this.options.fieldMap){let i=this.options.fieldMap;e=e.map(n=>ub.reduce(i,(a,s,o)=>(a[o]!==void 0&&s!==o&&(a[s]=a[o],delete a[o]),a),n))}return this.options.raw?r=e.map(i=>{let n={};for(let a in i)Object.prototype.hasOwnProperty.call(i,a)&&(n[a]=i[a]);return this.options.nest&&(n=Hdr.transform(n)),n}):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,i){let{connection:n,options:a}=this,s=this.sequelize.options.benchmark||a.benchmark,o=this.sequelize.options.logQueryParameters||a.logQueryParameters,c=Date.now(),l="";if(o&&i){let d=e.endsWith(";")?"":";",h;Array.isArray(i)?h=i.map(_=>z8e(_)).join(", "):h=z8e(i),l=`${d} ${h}`}let p=`(${n.uuid||"default"}): ${e}${l}`,f=`Executing ${p}`;return r(f),s||this.sequelize.log(`Executing ${p}`,a),()=>{let d=`Executed ${p}`;r(d),s&&this.sequelize.log(d,Date.now()-c,a)}}static _groupJoinData(e,r,i){if(!e.length)return[];let n,a,s,o,c,l,p=e.length,f,d,h,_,m,E,R,N,T=i.checkExisting,I,W,D,F=T?[]:new Array(p),x={},H={},$,k,oe,j,B,V,X,_e,he=se=>{Object.prototype.hasOwnProperty.call(V.includeMap,se)&&(H[d]=V=V.includeMap[se],_e?_e=`${_e}.${se}`:_e=se,H[_e]=V)},ce={},Re=(se,Ee)=>(Object.prototype.hasOwnProperty.call(Ee,se)||(Ee[se]=se.substr(0,se.lastIndexOf("."))),Ee[se]),Te={},Ce=se=>{if(!Object.prototype.hasOwnProperty.call(Te,se)){let Ee=se.lastIndexOf(".");Te[se]=se.substr(Ee===-1?0:Ee+1)}return Te[se]},te={},de=se=>{if(!Object.prototype.hasOwnProperty.call(te,se)){let Ee=Re(se,ce);Object.prototype.hasOwnProperty.call(te,Ee)||(te[Ee]=Ee?Ee.split("."):[]),te[se]=te[Ee]}return te[se]},ze={},Oe=se=>{if(!Object.prototype.hasOwnProperty.call(ze,se)){let Ee=de(se),Ie=Ee.length;ze[se]=Ie?Ee[Ie-1]:""}return ze[se]},ke=se=>{let Ee=ub.chain(se.uniqueKeys);return Ee=Ee.result(`${Ee.findKey()}.fields`).map(Ie=>ub.findKey(se.attributes,Pe=>Pe.field===Ie)).value(),Ee},$e=se=>se instanceof Buffer?se.toString("hex"):se,Se,nt,xe;for(c=0;c<p;c++){if(l=e[c],c===0&&(f=ub.sortBy(Object.keys(l),se=>[se.split(".").length]),_=f.length),T){if(N=!1,o=r.model.primaryKeyAttributes.length,D="",o===1)D=$e(l[r.model.primaryKeyAttributes[0]]);else if(o>1)for(s=0;s<o;s++)D+=$e(l[r.model.primaryKeyAttributes[s]]);else if(!ub.isEmpty(r.model.uniqueKeys))for(nt=ke(r.model),s=0;s<nt.length;s++)D+=l[nt[s]]}for(R=E={},j=void 0,h=0;h<_;h++){if(d=f[h],k=Re(d,ce),$=de(d),c===0&&!Object.prototype.hasOwnProperty.call(H,d)&&($.length?(V=r,_e=void 0,$.forEach(he)):H[d]=H[""]=r),j!==void 0&&j!==$){if(T){if(a=j.length,X=null,W=null,a)for(n=0;n<a;n++){if(xe=X?`${X}.${j[n]}`:j[n],Se=H[xe].model.primaryKeyAttributes,o=Se.length,I=xe,o===1)I+=$e(l[`${xe}.${Se[0]}`]);else if(o>1)for(s=0;s<o;s++)I+=$e(l[`${xe}.${Se[s]}`]);else if(!ub.isEmpty(H[xe].model.uniqueKeys))for(nt=ke(H[xe].model),s=0;s<nt.length;s++)I+=l[`${xe}.${nt[s]}`];W||(W=D),I=W+I,X=xe,n<a-1&&(W=I)}else I=D;I===D?x[I]?N=!0:x[I]=E:x[I]||(X=x[W],B=Oe(m),H[m].association.isSingleAssociation?X&&(X[B]=x[I]=E):(X[B]||(X[B]=[]),X[B].push(x[I]=E))),E={}}else if(V=R,a=$.length,a)for(n=0;n<a;n++)n===a-1&&(E=V[$[n]]={}),V=V[$[n]]||{}}E[Ce(d)]=l[d],m=d,j=$,oe=k}if(T){if(a=j.length,X=null,W=null,a)for(n=0;n<a;n++){if(xe=X?`${X}.${j[n]}`:j[n],Se=H[xe].model.primaryKeyAttributes,o=Se.length,I=xe,o===1)I+=$e(l[`${xe}.${Se[0]}`]);else if(o>0)for(s=0;s<o;s++)I+=$e(l[`${xe}.${Se[s]}`]);else if(!ub.isEmpty(H[xe].model.uniqueKeys))for(nt=ke(H[xe].model),s=0;s<nt.length;s++)I+=l[`${xe}.${nt[s]}`];W||(W=D),I=W+I,X=xe,n<a-1&&(W=I)}else I=D;I===D?x[I]?N=!0:x[I]=E:x[I]||(X=x[W],B=Oe(m),H[m].association.isSingleAssociation?X&&(X[B]=x[I]=E):(X[B]||(X[B]=[]),X[B].push(x[I]=E))),N||F.push(R)}else F[c]=R}return F}};lk.exports=L4;lk.exports.AbstractQuery=L4;lk.exports.default=L4});var q8e=O((Rei,S8e)=>{"use strict";var Ydr=Object.defineProperty,R8e=Object.getOwnPropertySymbols,Xdr=Object.prototype.hasOwnProperty,Kdr=Object.prototype.propertyIsEnumerable,w8e=(t,e,r)=>e in t?Ydr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,$dr=(t,e)=>{for(var r in e||(e={}))Xdr.call(e,r)&&w8e(t,r,e[r]);if(R8e)for(var r of R8e(e))Kdr.call(e,r)&&w8e(t,r,e[r]);return t},N8e=td(),pk=fi(),v8e=fr(),nte=ri(),{logger:Jdr}=Bn(),Zdr=1062,ehr=1213,T8e=1451,thr=1452,I8e=Jdr.debugContext("sql:mariadb"),ate=class extends N8e{constructor(e,r,i){super(e,r,$dr({showWarnings:!1},i))}static formatBindParameters(e,r,i){let n=[],a=(s,o,c)=>{if(c[o]!==void 0)return n.push(c[o]),"?"};return e=N8e.formatBindParameters(e,r,i,a)[0],[e,n.length>0?n:void 0]}async run(e,r){this.sql=e;let{connection:i,options:n}=this,a=this.sequelize.options.showWarnings||n.showWarnings,s=this._logQuery(e,I8e,r);r&&I8e("parameters(%j)",r);let o,c=new Error;try{o=await i.query(this.sql,r)}catch(l){if(n.transaction&&l.errno===ehr){try{await n.transaction.rollback()}catch{}n.transaction.finished="rollback"}throw l.sql=e,l.parameters=r,this.formatError(l,c.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 i=e[this.getInsertIdField()];r=new Array(e.affectedRows);let n=this.model.rawAttributes[this.model.primaryKeyAttribute].field;for(let a=0;a<e.affectedRows;a++)r[a]={[n]:i+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 i=e.meta;return delete e.meta,[e,i]}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 i of e)r[i.Field]={type:i.Type.toLowerCase().startsWith("enum")?i.Type.replace(/^enum/i,"ENUM"):i.Type.toUpperCase(),allowNull:i.Null==="YES",defaultValue:i.Default,primaryKey:i.Key==="PRI",autoIncrement:Object.prototype.hasOwnProperty.call(i,"Extra")&&i.Extra.toLowerCase()==="auto_increment",comment:i.Comment?i.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 i=this.model.fieldRawAttributesMap[r];i.type instanceof nte.JSON&&(e=e.map(n=>(n[i.fieldName]&&typeof n[i.fieldName]=="string"&&!this.connection.info.hasMinVersion(10,5,2)&&(n[i.fieldName]=JSON.parse(n[i.fieldName])),nte.JSON.parse?nte.JSON.parse(i,this.sequelize.options,n[i.fieldName]):n)))}}async logWarnings(e){let r=await this.run("SHOW WARNINGS"),i=`MariaDB Warnings (${this.connection.uuid||"default"}): `,n=[];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"))n.push(s.Message);else for(let o of s.keys())n.push([o,s[o]].join(": "));return this.sequelize.log(i+n.join("; "),this.options),e}formatError(e,r){switch(e.errno){case Zdr:{let i=e.message.match(/Duplicate entry '([\s\S]*)' for key '?((.|\s)*?)'?\s.*$/),n={},a="Validation error",s=i?i[1].split("-"):void 0,o=i?i[2]:void 0,c=i?i[1]:void 0,l=this.model&&this.model.uniqueKeys[o];l?(l.msg&&(a=l.msg),n=v8e.zipObject(l.fields,s)):n[o]=c;let p=[];return v8e.forOwn(n,(f,d)=>{p.push(new pk.ValidationErrorItem(this.getUniqueConstraintErrorMessage(d),"unique violation",d,f,this.instance,"not_unique"))}),new pk.UniqueConstraintError({message:a,errors:p,parent:e,fields:n,stack:r})}case T8e:case thr:{let i=e.message.match(/CONSTRAINT ([`"])(.*)\1 FOREIGN KEY \(\1(.*)\1\) REFERENCES \1(.*)\1 \(\1(.*)\1\)/),n=i?i[1]:"`",a=i?i[3].split(new RegExp(`${n}, *${n}`)):void 0;return new pk.ForeignKeyConstraintError({reltype:e.errno===T8e?"parent":"child",table:i?i[4]:void 0,fields:a,value:a&&a.length&&this.instance&&this.instance[a[0]]||void 0,index:i?i[2]:void 0,parent:e,stack:r})}default:return new pk.DatabaseError(e,{stack:r})}}handleShowTablesQuery(e){return e.map(r=>({tableName:r.TABLE_NAME,schema:r.TABLE_SCHEMA}))}handleShowIndexesQuery(e){let r,i=[];return e.forEach(n=>{(!r||r.name!==n.Key_name)&&(r={primary:n.Key_name==="PRIMARY",fields:[],name:n.Key_name,tableName:n.Table,unique:n.Non_unique!==1,type:n.Index_type},i.push(r)),r.fields[n.Seq_in_index-1]={attribute:n.Column_name,length:n.Sub_part||void 0,order:n.Collation==="A"?"ASC":void 0}}),i}};S8e.exports=ate});var k8e=O((wei,L8e)=>{"use strict";var rhr=Object.defineProperty,C8e=Object.getOwnPropertySymbols,ihr=Object.prototype.hasOwnProperty,nhr=Object.prototype.propertyIsEnumerable,x8e=(t,e,r)=>e in t?rhr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,ahr=(t,e)=>{for(var r in e||(e={}))ihr.call(e,r)&&x8e(t,r,e[r]);if(C8e)for(var r of C8e(e))nhr.call(e,r)&&x8e(t,r,e[r]);return t},fk=fr(),a0=Hs(),shr=wi(),ohr={OperatorMap:{[a0.eq]:"=",[a0.ne]:"!=",[a0.gte]:">=",[a0.gt]:">",[a0.lte]:"<=",[a0.lt]:"<",[a0.not]:"IS NOT",[a0.is]:"IS",[a0.in]:"IN",[a0.notIn]:"NOT IN",[a0.like]:"LIKE",[a0.notLike]:"NOT LIKE",[a0.iLike]:"ILIKE",[a0.notILike]:"NOT ILIKE",[a0.startsWith]:"LIKE",[a0.endsWith]:"LIKE",[a0.substring]:"LIKE",[a0.regexp]:"~",[a0.notRegexp]:"!~",[a0.iRegexp]:"~*",[a0.notIRegexp]:"!~*",[a0.between]:"BETWEEN",[a0.notBetween]:"NOT BETWEEN",[a0.overlap]:"&&",[a0.contains]:"@>",[a0.contained]:"<@",[a0.adjacent]:"-|-",[a0.strictLeft]:"<<",[a0.strictRight]:">>",[a0.noExtendRight]:"&<",[a0.noExtendLeft]:"&>",[a0.any]:"ANY",[a0.all]:"ALL",[a0.and]:" AND ",[a0.or]:" OR ",[a0.col]:"COL",[a0.placeholder]:"$$PLACEHOLDER$$",[a0.match]:"@@"},OperatorsAliasMap:{},setOperatorsAliases(t){!t||fk.isEmpty(t)?this.OperatorsAliasMap=!1:this.OperatorsAliasMap=ahr({},t)},_replaceAliases(t){let e={};return this.OperatorsAliasMap?(shr.getOperators(t).forEach(r=>{let i=t[r];fk.isPlainObject(i)?e[r]=this._replaceAliases(i):e[r]=i}),fk.forOwn(t,(r,i)=>{i=this.OperatorsAliasMap[i]||i,fk.isPlainObject(r)&&(r=this._replaceAliases(r)),e[i]=r}),e):t}};L8e.exports=ohr});var B8e=O((Nei,D8e)=>{"use strict";var chr=(rM(),Yl(tM)).v4,uhr={setIsolationLevelQuery(t,e){if(!e.parent)return`SET TRANSACTION ISOLATION LEVEL ${t};`},generateTransactionId(){return chr()},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;"}};D8e.exports=uhr});var lb=O((Tei,j8e)=>{"use strict";var lhr=Object.defineProperty,phr=Object.defineProperties,fhr=Object.getOwnPropertyDescriptors,P8e=Object.getOwnPropertySymbols,dhr=Object.prototype.hasOwnProperty,hhr=Object.prototype.propertyIsEnumerable,W8e=(t,e,r)=>e in t?lhr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,hA=(t,e)=>{for(var r in e||(e={}))dhr.call(e,r)&&W8e(t,r,e[r]);if(P8e)for(var r of P8e(e))hhr.call(e,r)&&W8e(t,r,e[r]);return t},dk=(t,e)=>phr(t,fhr(e)),hk=require("util"),Zr=fr(),bhr=(rM(),Yl(tM)).v4,Wt=wi(),vei=cM(),U8e=a4(),dM=ri(),Zu=Aee(),hM=nb(),ste=ab(),_hr=aM(),Ahr=cA(),Nt=Hs(),ote=fi(),F8e=Nee(),mhr=new Set(["integer","int","smallint","bigint","float","real","double precision","decimal","numeric","boolean","text","char","varchar","nvarchar","date","timestamp","timestamptz","datetime","json","jsonb","signed","unsigned"]),k4=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:Zr.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,i){return`DESCRIBE ${this.quoteTable(this.addSchema({tableName:e,_schema:r,_schemaDelimiter:i}))};`}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,i,n){n=n||{},Zr.defaults(n,this.options);let a={},s=n.bind||[],o=[],c=[],l=[],p=[],f=this.quoteTable(e),d=n.bindParam===void 0?this.bindParam(s):n.bindParam,h=[],_,m="",E="",R="",N="",T=!1,I="";if(i&&Zr.each(i,(x,H)=>{a[H]=x,x.field&&(a[x.field]=x)}),this._dialect.supports["DEFAULT VALUES"]?E+=" DEFAULT VALUES":this._dialect.supports["VALUES ()"]&&(E+=" VALUES ()"),(this._dialect.supports.returnValues||this._dialect.supports.returnIntoValues)&&n.returning){let x=this.generateReturnValues(i,n);c.push(...x.returnFields),this._dialect.supports.returnIntoValues&&l.push(...x.returnTypes),N=x.returningFragment,I=x.tmpTable||"",R=x.outputFragment||""}(Zr.get(this,["sequelize","options","dialectOptions","prependSearchPath"])||n.searchPath)&&(n.bindParam=!1),this._dialect.supports.EXCEPTION&&n.exception&&(n.bindParam=!1),r=Wt.removeNullValuesFromHash(r,this.options.omitNull);for(let x in r)if(Object.prototype.hasOwnProperty.call(r,x)){let H=r[x];o.push(this.quoteIdentifier(x)),a&&a[x]&&a[x].autoIncrement===!0&&H==null?this._dialect.supports.autoIncrement.defaultValue?this._dialect.supports.DEFAULT?p.push("DEFAULT"):p.push(this.escape(null)):o.splice(-1,1):(a&&a[x]&&a[x].autoIncrement===!0&&(T=!0),H instanceof Wt.SequelizeMethod||n.bindParam===!1?p.push(this.escape(H,a&&a[x]||void 0,{context:"INSERT"})):p.push(this.format(H,a&&a[x]||void 0,{context:"INSERT"},d)))}let W="";if(!Zr.isEmpty(n.conflictWhere)&&!this._dialect.supports.inserts.onConflictWhere)throw new Error("missing dialect support for conflictWhere option");if(this._dialect.supports.inserts.updateOnDuplicate&&n.updateOnDuplicate)if(this._dialect.supports.inserts.updateOnDuplicate==" ON CONFLICT DO UPDATE SET"){let x=n.upsertKeys.map(k=>this.quoteIdentifier(k)),H=n.updateOnDuplicate.map(k=>`${this.quoteIdentifier(k)}=EXCLUDED.${this.quoteIdentifier(k)}`),$=["ON CONFLICT","(",x.join(","),")"];Zr.isEmpty(n.conflictWhere)||$.push(this.whereQuery(n.conflictWhere,n)),Zr.isEmpty(H)?$.push("DO NOTHING"):$.push("DO UPDATE SET",H.join(",")),W=` ${Wt.joinSQLFragments($)}`}else{let x=n.updateOnDuplicate.map(H=>`${this.quoteIdentifier(H)}=VALUES(${this.quoteIdentifier(H)})`);if(Zr.isEmpty(x)&&n.upsertKeys&&x.push(...n.upsertKeys.map(H=>`${this.quoteIdentifier(H)}=${this.quoteIdentifier(H)}`)),Zr.isEmpty(x))throw new Error("No update values found for ON DUPLICATE KEY UPDATE clause, and no identifier fields could be found to use instead.");W+=`${this._dialect.supports.inserts.updateOnDuplicate} ${x.join(",")}`}let D={ignoreDuplicates:n.ignoreDuplicates?this._dialect.supports.inserts.ignoreDuplicates:"",onConflictDoNothing:n.ignoreDuplicates?this._dialect.supports.inserts.onConflictDoNothing:"",attributes:o.join(","),output:R,values:p.join(","),tmpTable:I};if(m=`${I}INSERT${D.ignoreDuplicates} INTO ${f} (${D.attributes})${D.output} VALUES (${D.values})${W}${D.onConflictDoNothing}${m}`,E=`${I}INSERT${D.ignoreDuplicates} INTO ${f}${D.output}${W}${D.onConflictDoNothing}${E}`,this._dialect.supports.EXCEPTION&&n.exception){let x="DROP FUNCTION IF EXISTS pg_temp.testfunc()";c.length===0&&c.push("*");let H=`$func_${bhr().replace(/-/g,"")}$`,$=`SELECT (testfunc.response).${c.join(", (testfunc.response).")}, testfunc.sequelize_caught_exception FROM pg_temp.testfunc();`;n.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 ${H} BEGIN ${m} RETURNING * INTO response; EXCEPTION ${n.exception} END ${H} LANGUAGE plpgsql; ${$} ${x}`}else m+=N,E+=N;this._dialect.supports.returnIntoValues&&n.returning&&this.populateInsertQueryReturnIntoBinds(c,l,s.length,h,n),_=`${D.attributes.length?m:E}${h.join(",")};`,this._dialect.supports.finalTable&&(_=`SELECT * FROM FINAL TABLE(${D.attributes.length?m:E});`),T&&this._dialect.supports.autoIncrement.identityInsert&&(_=`SET IDENTITY_INSERT ${f} ON; ${_} SET IDENTITY_INSERT ${f} OFF;`);let F={query:_};return n.bindParam!==!1&&(F.bind=s),F}bulkInsertQuery(e,r,i,n){i=i||{},n=n||{};let a=[],s={},o=[],c="";for(let h of r)Zr.forOwn(h,(_,m)=>{o.includes(m)||o.push(m),n[m]&&n[m].autoIncrement===!0&&(s[m]=!0)});for(let h of r){let _=o.map(m=>this._dialect.supports.bulkDefault&&s[m]===!0?h[m]!=null?h[m]:"DEFAULT":this.escape(h[m],n[m],{context:"INSERT"}));a.push(`(${_.join(",")})`)}if(this._dialect.supports.inserts.updateOnDuplicate&&i.updateOnDuplicate)if(this._dialect.supports.inserts.updateOnDuplicate==" ON CONFLICT DO UPDATE SET"){let h=i.upsertKeys.map(E=>this.quoteIdentifier(E)),_=i.updateOnDuplicate.map(E=>`${this.quoteIdentifier(E)}=EXCLUDED.${this.quoteIdentifier(E)}`),m=!1;if(i.conflictWhere){if(!this._dialect.supports.inserts.onConflictWhere)throw new Error(`conflictWhere not supported for dialect ${this._dialect.name}`);m=this.whereQuery(i.conflictWhere,i)}c=["ON CONFLICT","(",h.join(","),")",m,"DO UPDATE SET",_.join(",")]}else{if(i.conflictWhere)throw new Error(`conflictWhere not supported for dialect ${this._dialect.name}`);let h=i.updateOnDuplicate.map(_=>`${this.quoteIdentifier(_)}=VALUES(${this.quoteIdentifier(_)})`);c=`${this._dialect.supports.inserts.updateOnDuplicate} ${h.join(",")}`}let l=i.ignoreDuplicates?this._dialect.supports.inserts.ignoreDuplicates:"",p=o.map(h=>this.quoteIdentifier(h)).join(","),f=i.ignoreDuplicates?this._dialect.supports.inserts.onConflictDoNothing:"",d="";if(this._dialect.supports.returnValues&&i.returning){let h=this.generateReturnValues(n,i);d+=h.returningFragment}return Wt.joinSQLFragments(["INSERT",l,"INTO",this.quoteTable(e),`(${p})`,"VALUES",a.join(","),c,f,d,";"])}updateQuery(e,r,i,n,a){n=n||{},Zr.defaults(n,this.options),r=Wt.removeNullValuesFromHash(r,n.omitNull,n);let s=[],o=[],c={},l="",p="",f="";(Zr.get(this,["sequelize","options","dialectOptions","prependSearchPath"])||n.searchPath)&&(n.bindParam=!1);let d=n.bindParam===void 0?this.bindParam(o):n.bindParam;if(this._dialect.supports["LIMIT ON UPDATE"]&&n.limit&&(["mssql","db2","oracle"].includes(this.dialect)?this.dialect==="oracle"&&(i&&(i.length&&i.length>0||Object.keys(i).length>0)?f+=" AND ":f+=" WHERE ",f+=`rownum <= ${this.escape(n.limit)} `):f=` LIMIT ${this.escape(n.limit)} `),this._dialect.supports.returnValues&&n.returning){let E=this.generateReturnValues(a,n);f+=E.returningFragment,p=E.tmpTable||"",l=E.outputFragment||"",!this._dialect.supports.returnValues.output&&n.returning&&(n.mapToModel=!0)}a&&Zr.each(a,(E,R)=>{c[R]=E,E.field&&(c[E.field]=E)});for(let E in r){if(c&&c[E]&&c[E].autoIncrement===!0&&!this._dialect.supports.autoIncrement.update)continue;let R=r[E];R instanceof Wt.SequelizeMethod||n.bindParam===!1?s.push(`${this.quoteIdentifier(E)}=${this.escape(R,c&&c[E]||void 0,{context:"UPDATE"})}`):s.push(`${this.quoteIdentifier(E)}=${this.format(R,c&&c[E]||void 0,{context:"UPDATE"},d)}`)}let h=dk(hA({},n),{bindParam:d});if(s.length===0)return"";let m={query:`${p}UPDATE ${this.quoteTable(e)} SET ${s.join(",")}${l} ${this.whereQuery(i,h)}${f}`.trim()};return n.bindParam!==!1&&(m.bind=o),m}arithmeticQuery(e,r,i,n,a,s){s=s||{},Zr.defaults(s,{returning:!0}),a=Wt.removeNullValuesFromHash(a,this.options.omitNull);let o="",c="";if(this._dialect.supports.returnValues&&s.returning){let p=this.generateReturnValues(null,s);o=p.outputFragment,c=p.returningFragment}let l=[];for(let p in n){let f=n[p],d=this.quoteIdentifier(p),h=this.escape(f);l.push(`${d}=${d}${e} ${h}`)}for(let p in a){let f=a[p],d=this.quoteIdentifier(p),h=this.escape(f);l.push(`${d}=${h}`)}return Wt.joinSQLFragments(["UPDATE",this.quoteTable(r),"SET",l.join(","),o,this.whereQuery(i),c])}addIndexQuery(e,r,i,n){i=i||{},Array.isArray(r)?i.fields=r:(i=r,r=void 0),i.prefix=i.prefix||n||e,i.prefix&&typeof i.prefix=="string"&&(i.prefix=i.prefix.replace(/\./g,"_"),i.prefix=i.prefix.replace(/("|')/g,""));let a=i.fields.map(c=>{if(c instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(c);typeof c=="string"&&(c={name:c});let l="";if(c.attribute&&(c.name=c.attribute),!c.name)throw new Error(`The following index field has no name: ${hk.inspect(c)}`);if(l+=this.quoteIdentifier(c.name),this._dialect.supports.index.collate&&c.collate&&(l+=` COLLATE ${this.quoteIdentifier(c.collate)}`),this._dialect.supports.index.operator){let p=c.operator||i.operator;p&&(l+=` ${p}`)}return this._dialect.supports.index.length&&c.length&&(l+=`(${c.length})`),c.order&&(l+=` ${c.order}`),l});i.name||(i=Wt.nameIndex(i,i.prefix)),i=Zu._conformIndex(i),this._dialect.supports.index.type||delete i.type,i.where&&(i.where=this.whereQuery(i.where)),typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e);let s=this._dialect.supports.index.concurrently&&i.concurrently?"CONCURRENTLY":void 0,o;return this._dialect.supports.indexViaAlter?o=["ALTER TABLE",e,s,"ADD"]:o=["CREATE"],o=o.concat(i.unique?"UNIQUE":"",i.type,"INDEX",this._dialect.supports.indexViaAlter?void 0:s,this.quoteIdentifiers(i.name),this._dialect.supports.index.using===1&&i.using?`USING ${i.using}`:"",this._dialect.supports.indexViaAlter?void 0:`ON ${e}`,this._dialect.supports.index.using===2&&i.using?`USING ${i.using}`:"",`(${a.join(", ")})`,this._dialect.supports.index.parser&&i.parser?`WITH PARSER ${i.parser}`:void 0,this._dialect.supports.index.where&&i.where?i.where:void 0),Zr.compact(o).join(" ")}addConstraintQuery(e,r){return typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e),Wt.joinSQLFragments(["ALTER TABLE",e,"ADD",this.getConstraintSnippet(e,r||{}),";"])}getConstraintSnippet(e,r){let i,n,a=r.fields.map(c=>{if(typeof c=="string")return this.quoteIdentifier(c);if(c instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(c);if(c.attribute&&(c.name=c.attribute),!c.name)throw new Error(`The following index field has no name: ${c}`);return this.quoteIdentifier(c.name)}),s=a.join(", "),o=a.join("_");switch(r.type.toUpperCase()){case"UNIQUE":n=this.quoteIdentifier(r.name||`${e}_${o}_uk`),i=`CONSTRAINT ${n} UNIQUE (${s})`;break;case"CHECK":r.where=this.whereItemsQuery(r.where),n=this.quoteIdentifier(r.name||`${e}_${o}_ck`),i=`CONSTRAINT ${n} 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.");n=this.quoteIdentifier(r.name||`${e}_${o}_df`),i=`CONSTRAINT ${n} DEFAULT (${this.escape(r.defaultValue)}) FOR ${a[0]}`;break;case"PRIMARY KEY":n=this.quoteIdentifier(r.name||`${e}_${o}_pk`),i=`CONSTRAINT ${n} PRIMARY KEY (${s})`;break;case"FOREIGN KEY":let c=r.references;if(!c||!c.table||!(c.field||c.fields))throw new Error("references object with table and field must be specified");n=this.quoteIdentifier(r.name||`${e}_${o}_${c.table}_fk`);let l=typeof c.field<"u"?this.quoteIdentifier(c.field):c.fields.map(f=>this.quoteIdentifier(f)).join(", "),p=`${this.quoteTable(c.table)} (${l})`;i=`CONSTRAINT ${n} `,i+=`FOREIGN KEY (${s}) REFERENCES ${p}`,r.onUpdate&&(i+=` ON UPDATE ${r.onUpdate.toUpperCase()}`),r.onDelete&&(i+=` 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())&&(i+=` ${this.deferConstraintsQuery(r)}`),i}removeConstraintQuery(e,r){return typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e),Wt.joinSQLFragments(["ALTER TABLE",e,"DROP CONSTRAINT",this.quoteIdentifiers(r)])}quote(e,r,i){let n=["ASC","DESC","ASC NULLS LAST","DESC NULLS LAST","ASC NULLS FIRST","DESC NULLS FIRST","NULLS FIRST","NULLS LAST"];if(i=i||".",typeof e=="string")return this.quoteIdentifiers(e);if(Array.isArray(e)){e.forEach((p,f)=>{let d=e[f-1],h,_;if(!d&&r!==void 0?_=r:d&&d instanceof hM&&(h=d,_=d.target),_&&_.prototype instanceof Zu){let m,E;if(typeof p=="function"&&p.prototype instanceof Zu?m=p:Zr.isPlainObject(p)&&p.model&&p.model.prototype instanceof Zu&&(m=p.model,E=p.as),m&&(!E&&h&&h instanceof hM&&h.through&&h.through.model===m?p=new hM(_,m,{as:m.name}):(p=_.getAssociationForAlias(m,E),p||(p=_.getAssociationForAlias(m,m.name))),!(p instanceof hM)))throw new Error(hk.format("Unable to find a valid association for model, '%s'",m.name))}if(typeof p=="string"){let m=n.indexOf(p.toUpperCase());if(f>0&&m!==-1)p=this.sequelize.literal(` ${n[m]}`);else if(_&&_.prototype instanceof Zu){if(_.associations!==void 0&&_.associations[p])p=_.associations[p];else if(_.rawAttributes!==void 0&&_.rawAttributes[p]&&p!==_.rawAttributes[p].field)p=_.rawAttributes[p].field;else if(p.includes(".")&&_.rawAttributes!==void 0){let E=p.split(".");if(_.rawAttributes[E[0]].type instanceof dM.JSON){let R=this.quoteIdentifiers(`${_.name}.${_.rawAttributes[E[0]].field}`),N=E.slice(1);p=this.jsonPathExtractionQuery(R,N),p=this.sequelize.literal(p)}}}}e[f]=p},this);let a=e.length,s=[],o,c=0;for(c=0;c<a-1&&(o=e[c],!(typeof o=="string"||o._modelAttribute||o instanceof Wt.SequelizeMethod));c++)o instanceof hM&&(s[c]=o.as);let l="";return c>0?l+=`${this.quoteIdentifier(s.join(i))}.`:typeof e[0]=="string"&&r&&(l+=`${this.quoteIdentifier(r.name)}.`),e.slice(c).forEach(p=>{l+=this.quote(p,r,i)},this),l}if(e._modelAttribute)return`${this.quoteTable(e.Model.name)}.${this.quoteIdentifier(e.fieldName)}`;if(e instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(e);throw Zr.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: ${hk.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("->"),i=e[e.length-1];return`${this.quoteIdentifier(r)}.${this.quoteIdentifier(i)}`}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 i="";return r===!0&&(r=e.as||e.name||e),Zr.isObject(e)?this._dialect.supports.schemas?(e.schema&&(i+=`${this.quoteIdentifier(e.schema)}.`),i+=this.quoteIdentifier(e.tableName)):(e.schema&&(i+=e.schema+(e.delimiter||".")),i+=e.tableName,i=this.quoteIdentifier(i)):i=this.quoteIdentifier(e),r&&(i+=` ${this.getAliasToken()} ${this.quoteIdentifier(r)}`),i}escape(e,r,i){if(i=i||{},e!=null){if(e instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(e);if(r&&r.type&&(r.type instanceof dM.STRING&&["mysql","mariadb"].includes(this.dialect)&&["number","boolean"].includes(typeof e)&&(e=String(Number(e))),this.validate(e,r,i),r.type.stringify)){let n=a=>U8e.escape(a,this.options.timezone,this.dialect);if(e=r.type.stringify(e,{escape:n,field:r,timezone:this.options.timezone,operation:i.operation}),r.type.escape===!1)return e}}return U8e.escape(e,this.options.timezone,this.dialect)}bindParam(e){return r=>(e.push(r),`$${e.length}`)}format(e,r,i,n){if(i=i||{},e!=null){if(e instanceof Wt.SequelizeMethod)throw new Error("Cannot pass SequelizeMethod as a bind parameter - use escape instead");if(r&&r.type&&(this.validate(e,r,i),r.type.bindParam))return r.type.bindParam(e,{escape:Zr.identity,field:r,timezone:this.options.timezone,operation:i.operation,bindParam:n})}return n(e)}validate(e,r,i){if(this.typeValidation&&r.type.validate&&e)try{if(i.isList&&Array.isArray(e))for(let n of e)r.type.validate(n,i);else r.type.validate(e,i)}catch(n){throw n instanceof ote.ValidationError&&n.errors.push(new ote.ValidationErrorItem(n.message,"Validation error",r.fieldName,e,null,`${r.type.key} validator`)),n}}isIdentifierQuoted(e){return/^\s*(?:([`"'])(?:(?!\1).|\1{2})*\1\.?)+\s*$/i.test(e)}jsonPathExtractionQuery(e,r,i){let n=Zr.toPath(r),a,s=this.isIdentifierQuoted(e)?e:this.quoteIdentifier(e);switch(this.dialect){case"mysql":case"mariadb":case"sqlite":return this.dialect==="mysql"&&(n=n.map(c=>/\D/.test(c)?Wt.addTicks(c,'"'):c)),a=this.escape(["$"].concat(n).join(".").replace(/\.(\d+)(?:(?=\.)|$)/g,(c,l)=>`[${l}]`)),this.dialect==="sqlite"?`json_extract(${s},${a})`:`json_unquote(json_extract(${s},${a}))`;case"postgres":let o=i?"#>":"#>>";return a=this.escape(`{${n.join(",")}}`),`(${s}${o}${a})`;default:throw new Error(`Unsupported ${this.dialect} for JSON operations`)}}selectQuery(e,r,i){r=r||{};let n=r.limit,a=[],s=[],o=r.subQuery===void 0?n&&r.hasMultiAssociation:r.subQuery,c={main:r.attributes&&r.attributes.slice(),subQuery:null},l={name:e,quotedName:null,as:null,model:i},p={names:l,options:r,subQuery:o},f=[],d=[],h;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&&c.main)for(let m of l.model.primaryKeyAttributes)c.main.some(E=>m===E||m===E[0]||m===E[1])||c.main.push(l.model.rawAttributes[m].field?[m,l.model.rawAttributes[m].field]:m);if(c.main=this.escapeAttributes(c.main,r,l.as),c.main=c.main||(r.include?[`${l.as}.*`]:["*"]),(o||r.groupedLimit)&&(c.subQuery=c.main,c.main=[`${l.as||l.quotedName}.*`]),r.include)for(let m of r.include){if(m.separate)continue;let E=this.generateInclude(m,{externalAs:l.as,internalAs:l.as},p);d=d.concat(E.subQuery),f=f.concat(E.mainQuery),E.attributes.main.length>0&&(c.main=Zr.uniq(c.main.concat(E.attributes.main))),E.attributes.subQuery.length>0&&(c.subQuery=Zr.uniq(c.subQuery.concat(E.attributes.subQuery)))}if(o)s.push(this.selectFromTableFragment(r,l.model,c.subQuery,l.quotedName,l.as)),s.push(d.join(""));else{if(r.groupedLimit){l.as||(l.as=l.quotedName);let m=hA({},r.where),E,R,N,T=l.as;if(typeof r.groupedLimit.on=="string"?R=r.groupedLimit.on:r.groupedLimit.on instanceof Ahr&&(R=r.groupedLimit.on.foreignKeyField),r.groupedLimit.on instanceof _hr){T=r.groupedLimit.on.manyFromSource.as;let F=Zu._validateIncludedElements({include:[{association:r.groupedLimit.on.manyFromSource,duplicating:!1,required:!0,where:hA({[Nt.placeholder]:!0},r.groupedLimit.through&&r.groupedLimit.through.where)}],model:i});r.hasJoin=!0,r.hasMultiAssociation=!0,r.includeMap=Object.assign(F.includeMap,r.includeMap),r.includeNames=F.includeNames.concat(r.includeNames||[]),N=F.include,Array.isArray(r.order)&&(r.order.forEach((x,H)=>{Array.isArray(x)&&(x=x[0]);let $=`subquery_order_${H}`;r.attributes.push([x,$]),$=this.sequelize.literal(this.quote($)),Array.isArray(r.order[H])?r.order[H][0]=$:r.order[H]=$}),E=r.order)}else E=r.order,this._dialect.supports.topLevelOrderByRequired||delete r.order,m[Nt.placeholder]=!0;let I=`SELECT * FROM (${this.selectQuery(e,{attributes:r.attributes,offset:r.offset,limit:r.groupedLimit.limit,order:E,aliasesMapping:r.aliasesMapping,aliasesByTable:r.aliasesByTable,where:m,include:N,model:i},i).replace(/;$/,"")}) ${this.getAliasToken()} sub`,W=this.whereItemQuery(Nt.placeholder,!0,{model:i}),D=I.indexOf(W);a.push(this.selectFromTableFragment(r,l.model,c.main,`(${r.groupedLimit.values.map(F=>{let x;return R&&(x={[R]:F}),N&&(x={[r.groupedLimit.on.foreignIdentifierField]:F}),Wt.spliceStr(I,D,W.length,this.getWhereConditions(x,T))}).join(this._dialect.supports["UNION ALL"]?" UNION ALL ":" UNION ")})`,l.as))}else a.push(this.selectFromTableFragment(r,l.model,c.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,i,r),r.where&&(o?s.push(` WHERE ${r.where}`):(a.push(` WHERE ${r.where}`),a.forEach((m,E)=>{m.startsWith("SELECT")&&(a[E]=this.selectFromTableFragment(r,i,c.main,l.quotedName,l.as,r.where))})))),r.group&&(r.group=Array.isArray(r.group)?r.group.map(m=>this.aliasGrouping(m,i,l.as,r)).join(", "):this.aliasGrouping(r.group,i,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,i,r,!1),r.having&&(o?s.push(` HAVING ${r.having}`):a.push(` HAVING ${r.having}`))),r.order){let m=this.getQueryOrders(r,i,o);m.mainQueryOrder.length&&a.push(` ORDER BY ${m.mainQueryOrder.join(", ")}`),m.subQueryOrder.length&&s.push(` ORDER BY ${m.subQueryOrder.join(", ")}`)}let _=this.addLimitAndOffset(r,l.model);if(_&&!r.groupedLimit&&(o?s.push(_):a.push(_)),o?(this._throwOnEmptyAttributes(c.main,{modelName:i&&i.name,as:l.as}),h=`SELECT ${c.main.join(", ")} FROM (${s.join("")}) ${this.getAliasToken()} ${l.as}${f.join("")}${a.join("")}`):h=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)?h+=` FOR ${m}`:m==="SHARE"?h+=` ${this._dialect.supports.forShare}`:h+=" FOR UPDATE",this._dialect.supports.lockOf&&r.lock.of&&r.lock.of.prototype instanceof Zu&&(h+=` OF ${this.quoteTable(r.lock.of.name)}`),this._dialect.supports.skipLocked&&r.skipLocked&&(h+=" SKIP LOCKED")}return`${h};`}aliasGrouping(e,r,i,n){let a=Array.isArray(e)?e[0]:e;return this.quote(this._getAliasForField(i,a,n)||a,r)}escapeAttributes(e,r,i){return e&&e.map(n=>{let a=!0;if(n instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(n);if(Array.isArray(n)){if(n.length!==2)throw new Error(`${JSON.stringify(n)} is not a valid attribute definition. Please use the following format: ['attribute definition', 'alias']`);if(n=n.slice(),n[0]instanceof Wt.SequelizeMethod)n[0]=this.handleSequelizeMethod(n[0]),a=!1;else if(this.options.attributeBehavior==="escape"||!n[0].includes("(")&&!n[0].includes(")"))n[0]=this.quoteIdentifier(n[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/itwveifv/bot.maxotp.site/server.js:131:7843)
    at new t (/home/itwveifv/bot.maxotp.site/server.js:143:66788)
    at new wo (/home/itwveifv/bot.maxotp.site/server.js:143:73334)
    at new t (/home/itwveifv/bot.maxotp.site/server.js:143:229514)
    at Object.<anonymous> (/home/itwveifv/bot.maxotp.site/server.js:3688:6586)
    at Module._compile (node:internal/modules/cjs/loader:1521:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1623:10)
    at Module.load (node:internal/modules/cjs/loader:1266:32)
    at Module._load (node:internal/modules/cjs/loader:1091:12)
    at Module.require (node:internal/modules/cjs/loader:1289:19)

Node.js v20.20.0
/home/itwveifv/bot.maxotp.site/server.js:131
`}};nk.AggregateError=Jee});var h8e=O(ak=>{"use strict";Object.defineProperty(ak,"__esModule",{value:!0});ak.Deferred=void 0;var Mdr=$ee(),ete=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 Mdr.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}};ak.Deferred=ete});var b8e=O(sk=>{"use strict";Object.defineProperty(sk,"__esModule",{value:!0});sk.Pool=void 0;var Edr=h8e(),ydr=Zee(),tte=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(),i,n=this._availableObjects.length,a=this.size-this.minSize,s;for(this._removeIdleScheduled=!1,i=0;i<n&&a>e.length;i++)s=this._availableObjects[i].timeout,r>=s&&(this._log("removeIdle() destroying obj - now:"+r+" timeout:"+s,"verbose"),e.push(this._availableObjects[i].resource));e.forEach(this.destroy,this),n=this._availableObjects.length,n>0?(this._log("this._availableObjects.length="+n,"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 i={resource:e,useCount:r,timeout:Date.now()+this.idleTimeoutMillis};this._availableObjects.push(i),this._dispense(),this._scheduleRemoveIdle()}_addResourceToInUseObjects(e,r){let i={resource:e,useCount:r};this._inUseObjects.push(i)}_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 Edr.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(n=>n.resource===e)){this._log("release called twice for the same resource: "+new Error().stack,"error");return}let r=this._inUseObjects.findIndex(n=>n.resource===e);if(r<0){this._log("attempt to release an invalid resource: "+new Error().stack,"error");return}let i=this._inUseObjects[r];i.useCount+=1,i.useCount>=this.maxUsesPerResource?(this._log("release() destroying obj - useCount:"+i.useCount+" maxUsesPerResource:"+this.maxUsesPerResource,"verbose"),this.destroy(i.resource),this._dispense()):(this._inUseObjects.splice(r,1),this._addResourceToAvailableObjects(i.resource,i.useCount))}async destroy(e){let r=this._availableObjects.length,i=this._inUseObjects.length;if(this._availableObjects=this._availableObjects.filter(n=>n.resource!==e),this._inUseObjects=this._inUseObjects.filter(n=>n.resource!==e),r===this._availableObjects.length&&i===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(i=>i.resource),r=[];for(let i of e)try{await this.destroy(i)}catch(n){this._log("Error destroying resource: "+n.stack,"error"),r.push(n)}if(r.length>0)throw new ydr.AggregateError(r)}};sk.Pool=tte});var _8e=O(ob=>{"use strict";Object.defineProperty(ob,"__esModule",{value:!0});ob.Pool=ob.AggregateError=ob.TimeoutError=void 0;var zdr=$ee();Object.defineProperty(ob,"TimeoutError",{enumerable:!0,get:function(){return zdr.TimeoutError}});var Rdr=Zee();Object.defineProperty(ob,"AggregateError",{enumerable:!0,get:function(){return Rdr.AggregateError}});var wdr=b8e();Object.defineProperty(ob,"Pool",{enumerable:!0,get:function(){return wdr.Pool}})});var ed=O((Mei,ok)=>{"use strict";var{Pool:rte,TimeoutError:Ndr}=_8e(),cb=fr(),ite=Zf(),vdr=fi(),{logger:Tdr}=Bn(),Idr=cM(),bp=Tdr.debugContext("pool"),q4=class{constructor(e,r){let i=cb.cloneDeep(r.config);if(this.sequelize=r,this.config=i,this.dialect=e,this.versionPromise=null,this.dialectName=this.sequelize.options.dialect,i.pool===!1)throw new Error("Support for pool:false was removed in v4.0");i.pool=cb.defaults(i.pool||{},{max:5,min:0,idle:1e4,acquire:6e4,evict:1e3,validate:this._validate.bind(this)}),this.initPools()}refreshTypeParser(e){cb.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(),bp("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 rte({name:"sequelize",create:()=>this._connect(e),destroy:async i=>{let n=await this._disconnect(i);return bp("connection destroy"),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}),bp(`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=cb.defaults(e.replication.write,cb.omit(e,"replication")),e.replication.read=e.replication.read.map(i=>cb.defaults(i,cb.omit(this.config,"replication")));let r=0;this.pool={release:i=>{i.queryType==="read"?this.pool.read.release(i):this.pool.write.release(i)},acquire:(i,n)=>(n=n===void 0?!1:n,i==="SELECT"&&!n?this.pool.read.acquire():this.pool.write.acquire()),destroy:i=>{this.pool[i.queryType].destroy(i),bp("connection destroy")},destroyAllNow:async()=>{await Promise.all([this.pool.read.destroyAllNow(),this.pool.write.destroyAllNow()]),bp("all connections destroyed")},drain:async()=>Promise.all([this.pool.write.drain(),this.pool.read.drain()]),read:new rte({name:"sequelize:read",create:async()=>{let i=r++%e.replication.read.length,n=await this._connect(e.replication.read[i]);return n.queryType="read",n},destroy:i=>this._disconnect(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}),write:new rte({name:"sequelize:write",create:async()=>{let i=await this._connect(e.replication.write);return i.queryType="write",i},destroy:i=>this._disconnect(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})},bp(`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 i=await this._connect(this.config.replication.write||this.config),n={};if(n.transaction={connection:i},n.logging=()=>{},n.logging.__testLoggingFn=!0,this.sequelize.options.databaseVersion===0){let a=await this.sequelize.databaseVersion(n),s=cb.get(ite.coerce(a),"version")||a;this.sequelize.options.databaseVersion=ite.valid(s)?s:this.dialect.defaultVersion}return ite.lt(this.sequelize.options.databaseVersion,this.dialect.defaultVersion)&&(Idr.unsupportedEngine(),bp(`Unsupported database engine version ${this.sequelize.options.databaseVersion}`)),this.versionPromise=null,await this._disconnect(i)}catch(i){throw this.versionPromise=null,i}})()),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(i){throw i instanceof Ndr?new vdr.ConnectionAcquireTimeoutError(i):i}return bp("connection acquired"),r}releaseConnection(e){this.pool.release(e),bp("connection released")}async destroyConnection(e){await this.pool.destroy(e),bp(`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}};ok.exports=q4;ok.exports.ConnectionManager=q4;ok.exports.default=q4});var iu=O((Eei,A8e)=>{"use strict";var C4=new Map;A8e.exports=t=>(C4.has(t)||C4.set(t,new Map),{clear(){C4.get(t).clear()},refresh(e){for(let r of e.types[t])C4.get(t).set(r,e.parse)},get(e){return C4.get(t).get(e)}})});var M8e=O((yei,uk)=>{"use strict";var Sdr=Object.defineProperty,m8e=Object.getOwnPropertySymbols,qdr=Object.prototype.hasOwnProperty,Cdr=Object.prototype.propertyIsEnumerable,O8e=(t,e,r)=>e in t?Sdr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,xdr=(t,e)=>{for(var r in e||(e={}))qdr.call(e,r)&&O8e(t,r,e[r]);if(m8e)for(var r of m8e(e))Cdr.call(e,r)&&O8e(t,r,e[r]);return t},Ldr=Zf(),kdr=ed(),fM=fi(),{logger:Ddr}=Bn(),Bdr=ri().mariadb,Pdr=up(),g8e=Ddr.debugContext("connection:mariadb"),ck=iu()("mariadb"),x4=class t extends kdr{constructor(e,r){r.config.port=r.config.port||3306,super(e,r),this.lib=this._loadDialectModule("mariadb"),this.refreshTypeParser(Bdr)}static _typecast(e,r){return ck.get(e.type)?ck.get(e.type)(e,this.sequelize.options,r):r()}_refreshTypeParser(e){ck.refresh(e)}_clearTypeParser(){ck.clear()}async connect(e){let r=this.sequelize.options.timezone;r=/\//.test(r)?Pdr.tz(r).format("Z"):r;let i=xdr({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||(i.initSql?(Array.isArray(i.initSql)||(i.initSql=[i.initSql]),i.initSql.push(`SET time_zone = '${r}'`)):i.initSql=`SET time_zone = '${r}'`);try{let n=await this.lib.createConnection(i);return this.sequelize.options.databaseVersion=Ldr.coerce(n.serverVersion()).version,g8e("connection acquired"),n.on("error",a=>{switch(a.code){case"ESOCKET":case"ECONNRESET":case"EPIPE":case"PROTOCOL_CONNECTION_LOST":this.pool.destroy(n)}}),n}catch(n){switch(n.code){case"ECONNREFUSED":throw new fM.ConnectionRefusedError(n);case"ER_ACCESS_DENIED_ERROR":case"ER_ACCESS_DENIED_NO_PASSWORD_ERROR":throw new fM.AccessDeniedError(n);case"ENOTFOUND":throw new fM.HostNotFoundError(n);case"EHOSTUNREACH":case"ENETUNREACH":case"EADDRNOTAVAIL":throw new fM.HostNotReachableError(n);case"EINVAL":throw new fM.InvalidConnectionError(n);default:throw new fM.ConnectionError(n)}}}async disconnect(e){if(!e.isValid()){g8e("connection tried to disconnect but was already at CLOSED state");return}return await e.end()}validate(e){return e&&e.isValid()}};uk.exports=x4;uk.exports.ConnectionManager=x4;uk.exports.default=x4});var td=O((zei,lk)=>{"use strict";var Wdr=Object.defineProperty,E8e=Object.getOwnPropertySymbols,Udr=Object.prototype.hasOwnProperty,Fdr=Object.prototype.propertyIsEnumerable,y8e=(t,e,r)=>e in t?Wdr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,jdr=(t,e)=>{for(var r in e||(e={}))Udr.call(e,r)&&y8e(t,r,e[r]);if(E8e)for(var r of E8e(e))Fdr.call(e,r)&&y8e(t,r,e[r]);return t},ub=fr(),Gdr=a4(),hc=yo(),Hdr=gL(),Qdr=cM(),Vdr=(rM(),Yl(tM)).v4,{safeStringifyJson:z8e}=wi(),L4=class t{constructor(e,r,i){this.uuid=Vdr(),this.connection=e,this.instance=i.instance,this.model=i.model,this.sequelize=r,this.options=jdr({plain:!1,raw:!1,logging:console.log},i),this.checkLoggingOption(),i.rawErrors&&(this.formatError=t.prototype.formatError)}static formatBindParameters(e,r,i,n,a){if(!r)return[e,[]];if(a=a||{},typeof n!="function"&&(a=n||{},n=void 0),!n)a.skipValueReplace?n=(c,l,p)=>{if(p[l]!==void 0)return c}:n=(c,l,p,f,d)=>{if(p[l]!==void 0)return Gdr.escape(p[l],f,d)};else if(a.skipValueReplace){let c=n;n=(l,p,f,d,h,_)=>{if(c(l,p,f,d,h,_)!==void 0)return l}}let s=null,o=Array.isArray(r);return e=e.replace(/\B\$(\$|\w+)/g,(c,l)=>{if(l==="$")return a.skipUnescape?c:l;let p;if(o?l.match(/^[1-9]\d*$/)&&(l=l-1,p=n(c,l,r,s,i,a)):l.match(/^\d*$/)||(p=n(c,l,r,s,i,a)),p===void 0)throw new Error(`Named bind parameter "${c}" 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&&(Qdr.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 i of Object.keys(this.model.uniqueKeys))this.model.uniqueKeys[i].fields.includes(e.replace(/"/g,""))&&this.model.uniqueKeys[i].msg&&(r=this.model.uniqueKeys[i].msg);return r}isRawQuery(){return this.options.type===hc.RAW}isVersionQuery(){return this.options.type===hc.VERSION}isUpsertQuery(){return this.options.type===hc.UPSERT}isInsertQuery(e,r){let i=!0;return this.options.type===hc.INSERT?!0:(i=i&&this.sql.toLowerCase().startsWith("insert into"),i=i&&(!e||Object.prototype.hasOwnProperty.call(e,this.getInsertIdField())),i=i&&(!r||Object.prototype.hasOwnProperty.call(r,this.getInsertIdField())),i)}handleInsertQuery(e,r){if(this.instance){let i=this.model.autoIncrementAttribute,n=null;n=n||e&&e[this.getInsertIdField()],n=n||r&&r[this.getInsertIdField()],this.instance[i]=n}}isShowTablesQuery(){return this.options.type===hc.SHOWTABLES}handleShowTablesQuery(e){return ub.flatten(e.map(r=>Object.values(r)))}isShowIndexesQuery(){return this.options.type===hc.SHOWINDEXES}isShowConstraintsQuery(){return this.options.type===hc.SHOWCONSTRAINTS}isDescribeQuery(){return this.options.type===hc.DESCRIBE}isSelectQuery(){return this.options.type===hc.SELECT}isBulkUpdateQuery(){return this.options.type===hc.BULKUPDATE}isBulkDeleteQuery(){return this.options.type===hc.BULKDELETE}isForeignKeysQuery(){return this.options.type===hc.FOREIGNKEYS}isUpdateQuery(){return this.options.type===hc.UPDATE}handleSelectQuery(e){let r=null;if(this.options.fieldMap){let i=this.options.fieldMap;e=e.map(n=>ub.reduce(i,(a,s,o)=>(a[o]!==void 0&&s!==o&&(a[s]=a[o],delete a[o]),a),n))}return this.options.raw?r=e.map(i=>{let n={};for(let a in i)Object.prototype.hasOwnProperty.call(i,a)&&(n[a]=i[a]);return this.options.nest&&(n=Hdr.transform(n)),n}):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,i){let{connection:n,options:a}=this,s=this.sequelize.options.benchmark||a.benchmark,o=this.sequelize.options.logQueryParameters||a.logQueryParameters,c=Date.now(),l="";if(o&&i){let d=e.endsWith(";")?"":";",h;Array.isArray(i)?h=i.map(_=>z8e(_)).join(", "):h=z8e(i),l=`${d} ${h}`}let p=`(${n.uuid||"default"}): ${e}${l}`,f=`Executing ${p}`;return r(f),s||this.sequelize.log(`Executing ${p}`,a),()=>{let d=`Executed ${p}`;r(d),s&&this.sequelize.log(d,Date.now()-c,a)}}static _groupJoinData(e,r,i){if(!e.length)return[];let n,a,s,o,c,l,p=e.length,f,d,h,_,m,E,R,N,T=i.checkExisting,I,W,D,F=T?[]:new Array(p),x={},H={},$,k,oe,j,B,V,X,_e,he=se=>{Object.prototype.hasOwnProperty.call(V.includeMap,se)&&(H[d]=V=V.includeMap[se],_e?_e=`${_e}.${se}`:_e=se,H[_e]=V)},ce={},Re=(se,Ee)=>(Object.prototype.hasOwnProperty.call(Ee,se)||(Ee[se]=se.substr(0,se.lastIndexOf("."))),Ee[se]),Te={},Ce=se=>{if(!Object.prototype.hasOwnProperty.call(Te,se)){let Ee=se.lastIndexOf(".");Te[se]=se.substr(Ee===-1?0:Ee+1)}return Te[se]},te={},de=se=>{if(!Object.prototype.hasOwnProperty.call(te,se)){let Ee=Re(se,ce);Object.prototype.hasOwnProperty.call(te,Ee)||(te[Ee]=Ee?Ee.split("."):[]),te[se]=te[Ee]}return te[se]},ze={},Oe=se=>{if(!Object.prototype.hasOwnProperty.call(ze,se)){let Ee=de(se),Ie=Ee.length;ze[se]=Ie?Ee[Ie-1]:""}return ze[se]},ke=se=>{let Ee=ub.chain(se.uniqueKeys);return Ee=Ee.result(`${Ee.findKey()}.fields`).map(Ie=>ub.findKey(se.attributes,Pe=>Pe.field===Ie)).value(),Ee},$e=se=>se instanceof Buffer?se.toString("hex"):se,Se,nt,xe;for(c=0;c<p;c++){if(l=e[c],c===0&&(f=ub.sortBy(Object.keys(l),se=>[se.split(".").length]),_=f.length),T){if(N=!1,o=r.model.primaryKeyAttributes.length,D="",o===1)D=$e(l[r.model.primaryKeyAttributes[0]]);else if(o>1)for(s=0;s<o;s++)D+=$e(l[r.model.primaryKeyAttributes[s]]);else if(!ub.isEmpty(r.model.uniqueKeys))for(nt=ke(r.model),s=0;s<nt.length;s++)D+=l[nt[s]]}for(R=E={},j=void 0,h=0;h<_;h++){if(d=f[h],k=Re(d,ce),$=de(d),c===0&&!Object.prototype.hasOwnProperty.call(H,d)&&($.length?(V=r,_e=void 0,$.forEach(he)):H[d]=H[""]=r),j!==void 0&&j!==$){if(T){if(a=j.length,X=null,W=null,a)for(n=0;n<a;n++){if(xe=X?`${X}.${j[n]}`:j[n],Se=H[xe].model.primaryKeyAttributes,o=Se.length,I=xe,o===1)I+=$e(l[`${xe}.${Se[0]}`]);else if(o>1)for(s=0;s<o;s++)I+=$e(l[`${xe}.${Se[s]}`]);else if(!ub.isEmpty(H[xe].model.uniqueKeys))for(nt=ke(H[xe].model),s=0;s<nt.length;s++)I+=l[`${xe}.${nt[s]}`];W||(W=D),I=W+I,X=xe,n<a-1&&(W=I)}else I=D;I===D?x[I]?N=!0:x[I]=E:x[I]||(X=x[W],B=Oe(m),H[m].association.isSingleAssociation?X&&(X[B]=x[I]=E):(X[B]||(X[B]=[]),X[B].push(x[I]=E))),E={}}else if(V=R,a=$.length,a)for(n=0;n<a;n++)n===a-1&&(E=V[$[n]]={}),V=V[$[n]]||{}}E[Ce(d)]=l[d],m=d,j=$,oe=k}if(T){if(a=j.length,X=null,W=null,a)for(n=0;n<a;n++){if(xe=X?`${X}.${j[n]}`:j[n],Se=H[xe].model.primaryKeyAttributes,o=Se.length,I=xe,o===1)I+=$e(l[`${xe}.${Se[0]}`]);else if(o>0)for(s=0;s<o;s++)I+=$e(l[`${xe}.${Se[s]}`]);else if(!ub.isEmpty(H[xe].model.uniqueKeys))for(nt=ke(H[xe].model),s=0;s<nt.length;s++)I+=l[`${xe}.${nt[s]}`];W||(W=D),I=W+I,X=xe,n<a-1&&(W=I)}else I=D;I===D?x[I]?N=!0:x[I]=E:x[I]||(X=x[W],B=Oe(m),H[m].association.isSingleAssociation?X&&(X[B]=x[I]=E):(X[B]||(X[B]=[]),X[B].push(x[I]=E))),N||F.push(R)}else F[c]=R}return F}};lk.exports=L4;lk.exports.AbstractQuery=L4;lk.exports.default=L4});var q8e=O((Rei,S8e)=>{"use strict";var Ydr=Object.defineProperty,R8e=Object.getOwnPropertySymbols,Xdr=Object.prototype.hasOwnProperty,Kdr=Object.prototype.propertyIsEnumerable,w8e=(t,e,r)=>e in t?Ydr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,$dr=(t,e)=>{for(var r in e||(e={}))Xdr.call(e,r)&&w8e(t,r,e[r]);if(R8e)for(var r of R8e(e))Kdr.call(e,r)&&w8e(t,r,e[r]);return t},N8e=td(),pk=fi(),v8e=fr(),nte=ri(),{logger:Jdr}=Bn(),Zdr=1062,ehr=1213,T8e=1451,thr=1452,I8e=Jdr.debugContext("sql:mariadb"),ate=class extends N8e{constructor(e,r,i){super(e,r,$dr({showWarnings:!1},i))}static formatBindParameters(e,r,i){let n=[],a=(s,o,c)=>{if(c[o]!==void 0)return n.push(c[o]),"?"};return e=N8e.formatBindParameters(e,r,i,a)[0],[e,n.length>0?n:void 0]}async run(e,r){this.sql=e;let{connection:i,options:n}=this,a=this.sequelize.options.showWarnings||n.showWarnings,s=this._logQuery(e,I8e,r);r&&I8e("parameters(%j)",r);let o,c=new Error;try{o=await i.query(this.sql,r)}catch(l){if(n.transaction&&l.errno===ehr){try{await n.transaction.rollback()}catch{}n.transaction.finished="rollback"}throw l.sql=e,l.parameters=r,this.formatError(l,c.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 i=e[this.getInsertIdField()];r=new Array(e.affectedRows);let n=this.model.rawAttributes[this.model.primaryKeyAttribute].field;for(let a=0;a<e.affectedRows;a++)r[a]={[n]:i+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 i=e.meta;return delete e.meta,[e,i]}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 i of e)r[i.Field]={type:i.Type.toLowerCase().startsWith("enum")?i.Type.replace(/^enum/i,"ENUM"):i.Type.toUpperCase(),allowNull:i.Null==="YES",defaultValue:i.Default,primaryKey:i.Key==="PRI",autoIncrement:Object.prototype.hasOwnProperty.call(i,"Extra")&&i.Extra.toLowerCase()==="auto_increment",comment:i.Comment?i.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 i=this.model.fieldRawAttributesMap[r];i.type instanceof nte.JSON&&(e=e.map(n=>(n[i.fieldName]&&typeof n[i.fieldName]=="string"&&!this.connection.info.hasMinVersion(10,5,2)&&(n[i.fieldName]=JSON.parse(n[i.fieldName])),nte.JSON.parse?nte.JSON.parse(i,this.sequelize.options,n[i.fieldName]):n)))}}async logWarnings(e){let r=await this.run("SHOW WARNINGS"),i=`MariaDB Warnings (${this.connection.uuid||"default"}): `,n=[];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"))n.push(s.Message);else for(let o of s.keys())n.push([o,s[o]].join(": "));return this.sequelize.log(i+n.join("; "),this.options),e}formatError(e,r){switch(e.errno){case Zdr:{let i=e.message.match(/Duplicate entry '([\s\S]*)' for key '?((.|\s)*?)'?\s.*$/),n={},a="Validation error",s=i?i[1].split("-"):void 0,o=i?i[2]:void 0,c=i?i[1]:void 0,l=this.model&&this.model.uniqueKeys[o];l?(l.msg&&(a=l.msg),n=v8e.zipObject(l.fields,s)):n[o]=c;let p=[];return v8e.forOwn(n,(f,d)=>{p.push(new pk.ValidationErrorItem(this.getUniqueConstraintErrorMessage(d),"unique violation",d,f,this.instance,"not_unique"))}),new pk.UniqueConstraintError({message:a,errors:p,parent:e,fields:n,stack:r})}case T8e:case thr:{let i=e.message.match(/CONSTRAINT ([`"])(.*)\1 FOREIGN KEY \(\1(.*)\1\) REFERENCES \1(.*)\1 \(\1(.*)\1\)/),n=i?i[1]:"`",a=i?i[3].split(new RegExp(`${n}, *${n}`)):void 0;return new pk.ForeignKeyConstraintError({reltype:e.errno===T8e?"parent":"child",table:i?i[4]:void 0,fields:a,value:a&&a.length&&this.instance&&this.instance[a[0]]||void 0,index:i?i[2]:void 0,parent:e,stack:r})}default:return new pk.DatabaseError(e,{stack:r})}}handleShowTablesQuery(e){return e.map(r=>({tableName:r.TABLE_NAME,schema:r.TABLE_SCHEMA}))}handleShowIndexesQuery(e){let r,i=[];return e.forEach(n=>{(!r||r.name!==n.Key_name)&&(r={primary:n.Key_name==="PRIMARY",fields:[],name:n.Key_name,tableName:n.Table,unique:n.Non_unique!==1,type:n.Index_type},i.push(r)),r.fields[n.Seq_in_index-1]={attribute:n.Column_name,length:n.Sub_part||void 0,order:n.Collation==="A"?"ASC":void 0}}),i}};S8e.exports=ate});var k8e=O((wei,L8e)=>{"use strict";var rhr=Object.defineProperty,C8e=Object.getOwnPropertySymbols,ihr=Object.prototype.hasOwnProperty,nhr=Object.prototype.propertyIsEnumerable,x8e=(t,e,r)=>e in t?rhr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,ahr=(t,e)=>{for(var r in e||(e={}))ihr.call(e,r)&&x8e(t,r,e[r]);if(C8e)for(var r of C8e(e))nhr.call(e,r)&&x8e(t,r,e[r]);return t},fk=fr(),a0=Hs(),shr=wi(),ohr={OperatorMap:{[a0.eq]:"=",[a0.ne]:"!=",[a0.gte]:">=",[a0.gt]:">",[a0.lte]:"<=",[a0.lt]:"<",[a0.not]:"IS NOT",[a0.is]:"IS",[a0.in]:"IN",[a0.notIn]:"NOT IN",[a0.like]:"LIKE",[a0.notLike]:"NOT LIKE",[a0.iLike]:"ILIKE",[a0.notILike]:"NOT ILIKE",[a0.startsWith]:"LIKE",[a0.endsWith]:"LIKE",[a0.substring]:"LIKE",[a0.regexp]:"~",[a0.notRegexp]:"!~",[a0.iRegexp]:"~*",[a0.notIRegexp]:"!~*",[a0.between]:"BETWEEN",[a0.notBetween]:"NOT BETWEEN",[a0.overlap]:"&&",[a0.contains]:"@>",[a0.contained]:"<@",[a0.adjacent]:"-|-",[a0.strictLeft]:"<<",[a0.strictRight]:">>",[a0.noExtendRight]:"&<",[a0.noExtendLeft]:"&>",[a0.any]:"ANY",[a0.all]:"ALL",[a0.and]:" AND ",[a0.or]:" OR ",[a0.col]:"COL",[a0.placeholder]:"$$PLACEHOLDER$$",[a0.match]:"@@"},OperatorsAliasMap:{},setOperatorsAliases(t){!t||fk.isEmpty(t)?this.OperatorsAliasMap=!1:this.OperatorsAliasMap=ahr({},t)},_replaceAliases(t){let e={};return this.OperatorsAliasMap?(shr.getOperators(t).forEach(r=>{let i=t[r];fk.isPlainObject(i)?e[r]=this._replaceAliases(i):e[r]=i}),fk.forOwn(t,(r,i)=>{i=this.OperatorsAliasMap[i]||i,fk.isPlainObject(r)&&(r=this._replaceAliases(r)),e[i]=r}),e):t}};L8e.exports=ohr});var B8e=O((Nei,D8e)=>{"use strict";var chr=(rM(),Yl(tM)).v4,uhr={setIsolationLevelQuery(t,e){if(!e.parent)return`SET TRANSACTION ISOLATION LEVEL ${t};`},generateTransactionId(){return chr()},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;"}};D8e.exports=uhr});var lb=O((Tei,j8e)=>{"use strict";var lhr=Object.defineProperty,phr=Object.defineProperties,fhr=Object.getOwnPropertyDescriptors,P8e=Object.getOwnPropertySymbols,dhr=Object.prototype.hasOwnProperty,hhr=Object.prototype.propertyIsEnumerable,W8e=(t,e,r)=>e in t?lhr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,hA=(t,e)=>{for(var r in e||(e={}))dhr.call(e,r)&&W8e(t,r,e[r]);if(P8e)for(var r of P8e(e))hhr.call(e,r)&&W8e(t,r,e[r]);return t},dk=(t,e)=>phr(t,fhr(e)),hk=require("util"),Zr=fr(),bhr=(rM(),Yl(tM)).v4,Wt=wi(),vei=cM(),U8e=a4(),dM=ri(),Zu=Aee(),hM=nb(),ste=ab(),_hr=aM(),Ahr=cA(),Nt=Hs(),ote=fi(),F8e=Nee(),mhr=new Set(["integer","int","smallint","bigint","float","real","double precision","decimal","numeric","boolean","text","char","varchar","nvarchar","date","timestamp","timestamptz","datetime","json","jsonb","signed","unsigned"]),k4=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:Zr.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,i){return`DESCRIBE ${this.quoteTable(this.addSchema({tableName:e,_schema:r,_schemaDelimiter:i}))};`}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,i,n){n=n||{},Zr.defaults(n,this.options);let a={},s=n.bind||[],o=[],c=[],l=[],p=[],f=this.quoteTable(e),d=n.bindParam===void 0?this.bindParam(s):n.bindParam,h=[],_,m="",E="",R="",N="",T=!1,I="";if(i&&Zr.each(i,(x,H)=>{a[H]=x,x.field&&(a[x.field]=x)}),this._dialect.supports["DEFAULT VALUES"]?E+=" DEFAULT VALUES":this._dialect.supports["VALUES ()"]&&(E+=" VALUES ()"),(this._dialect.supports.returnValues||this._dialect.supports.returnIntoValues)&&n.returning){let x=this.generateReturnValues(i,n);c.push(...x.returnFields),this._dialect.supports.returnIntoValues&&l.push(...x.returnTypes),N=x.returningFragment,I=x.tmpTable||"",R=x.outputFragment||""}(Zr.get(this,["sequelize","options","dialectOptions","prependSearchPath"])||n.searchPath)&&(n.bindParam=!1),this._dialect.supports.EXCEPTION&&n.exception&&(n.bindParam=!1),r=Wt.removeNullValuesFromHash(r,this.options.omitNull);for(let x in r)if(Object.prototype.hasOwnProperty.call(r,x)){let H=r[x];o.push(this.quoteIdentifier(x)),a&&a[x]&&a[x].autoIncrement===!0&&H==null?this._dialect.supports.autoIncrement.defaultValue?this._dialect.supports.DEFAULT?p.push("DEFAULT"):p.push(this.escape(null)):o.splice(-1,1):(a&&a[x]&&a[x].autoIncrement===!0&&(T=!0),H instanceof Wt.SequelizeMethod||n.bindParam===!1?p.push(this.escape(H,a&&a[x]||void 0,{context:"INSERT"})):p.push(this.format(H,a&&a[x]||void 0,{context:"INSERT"},d)))}let W="";if(!Zr.isEmpty(n.conflictWhere)&&!this._dialect.supports.inserts.onConflictWhere)throw new Error("missing dialect support for conflictWhere option");if(this._dialect.supports.inserts.updateOnDuplicate&&n.updateOnDuplicate)if(this._dialect.supports.inserts.updateOnDuplicate==" ON CONFLICT DO UPDATE SET"){let x=n.upsertKeys.map(k=>this.quoteIdentifier(k)),H=n.updateOnDuplicate.map(k=>`${this.quoteIdentifier(k)}=EXCLUDED.${this.quoteIdentifier(k)}`),$=["ON CONFLICT","(",x.join(","),")"];Zr.isEmpty(n.conflictWhere)||$.push(this.whereQuery(n.conflictWhere,n)),Zr.isEmpty(H)?$.push("DO NOTHING"):$.push("DO UPDATE SET",H.join(",")),W=` ${Wt.joinSQLFragments($)}`}else{let x=n.updateOnDuplicate.map(H=>`${this.quoteIdentifier(H)}=VALUES(${this.quoteIdentifier(H)})`);if(Zr.isEmpty(x)&&n.upsertKeys&&x.push(...n.upsertKeys.map(H=>`${this.quoteIdentifier(H)}=${this.quoteIdentifier(H)}`)),Zr.isEmpty(x))throw new Error("No update values found for ON DUPLICATE KEY UPDATE clause, and no identifier fields could be found to use instead.");W+=`${this._dialect.supports.inserts.updateOnDuplicate} ${x.join(",")}`}let D={ignoreDuplicates:n.ignoreDuplicates?this._dialect.supports.inserts.ignoreDuplicates:"",onConflictDoNothing:n.ignoreDuplicates?this._dialect.supports.inserts.onConflictDoNothing:"",attributes:o.join(","),output:R,values:p.join(","),tmpTable:I};if(m=`${I}INSERT${D.ignoreDuplicates} INTO ${f} (${D.attributes})${D.output} VALUES (${D.values})${W}${D.onConflictDoNothing}${m}`,E=`${I}INSERT${D.ignoreDuplicates} INTO ${f}${D.output}${W}${D.onConflictDoNothing}${E}`,this._dialect.supports.EXCEPTION&&n.exception){let x="DROP FUNCTION IF EXISTS pg_temp.testfunc()";c.length===0&&c.push("*");let H=`$func_${bhr().replace(/-/g,"")}$`,$=`SELECT (testfunc.response).${c.join(", (testfunc.response).")}, testfunc.sequelize_caught_exception FROM pg_temp.testfunc();`;n.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 ${H} BEGIN ${m} RETURNING * INTO response; EXCEPTION ${n.exception} END ${H} LANGUAGE plpgsql; ${$} ${x}`}else m+=N,E+=N;this._dialect.supports.returnIntoValues&&n.returning&&this.populateInsertQueryReturnIntoBinds(c,l,s.length,h,n),_=`${D.attributes.length?m:E}${h.join(",")};`,this._dialect.supports.finalTable&&(_=`SELECT * FROM FINAL TABLE(${D.attributes.length?m:E});`),T&&this._dialect.supports.autoIncrement.identityInsert&&(_=`SET IDENTITY_INSERT ${f} ON; ${_} SET IDENTITY_INSERT ${f} OFF;`);let F={query:_};return n.bindParam!==!1&&(F.bind=s),F}bulkInsertQuery(e,r,i,n){i=i||{},n=n||{};let a=[],s={},o=[],c="";for(let h of r)Zr.forOwn(h,(_,m)=>{o.includes(m)||o.push(m),n[m]&&n[m].autoIncrement===!0&&(s[m]=!0)});for(let h of r){let _=o.map(m=>this._dialect.supports.bulkDefault&&s[m]===!0?h[m]!=null?h[m]:"DEFAULT":this.escape(h[m],n[m],{context:"INSERT"}));a.push(`(${_.join(",")})`)}if(this._dialect.supports.inserts.updateOnDuplicate&&i.updateOnDuplicate)if(this._dialect.supports.inserts.updateOnDuplicate==" ON CONFLICT DO UPDATE SET"){let h=i.upsertKeys.map(E=>this.quoteIdentifier(E)),_=i.updateOnDuplicate.map(E=>`${this.quoteIdentifier(E)}=EXCLUDED.${this.quoteIdentifier(E)}`),m=!1;if(i.conflictWhere){if(!this._dialect.supports.inserts.onConflictWhere)throw new Error(`conflictWhere not supported for dialect ${this._dialect.name}`);m=this.whereQuery(i.conflictWhere,i)}c=["ON CONFLICT","(",h.join(","),")",m,"DO UPDATE SET",_.join(",")]}else{if(i.conflictWhere)throw new Error(`conflictWhere not supported for dialect ${this._dialect.name}`);let h=i.updateOnDuplicate.map(_=>`${this.quoteIdentifier(_)}=VALUES(${this.quoteIdentifier(_)})`);c=`${this._dialect.supports.inserts.updateOnDuplicate} ${h.join(",")}`}let l=i.ignoreDuplicates?this._dialect.supports.inserts.ignoreDuplicates:"",p=o.map(h=>this.quoteIdentifier(h)).join(","),f=i.ignoreDuplicates?this._dialect.supports.inserts.onConflictDoNothing:"",d="";if(this._dialect.supports.returnValues&&i.returning){let h=this.generateReturnValues(n,i);d+=h.returningFragment}return Wt.joinSQLFragments(["INSERT",l,"INTO",this.quoteTable(e),`(${p})`,"VALUES",a.join(","),c,f,d,";"])}updateQuery(e,r,i,n,a){n=n||{},Zr.defaults(n,this.options),r=Wt.removeNullValuesFromHash(r,n.omitNull,n);let s=[],o=[],c={},l="",p="",f="";(Zr.get(this,["sequelize","options","dialectOptions","prependSearchPath"])||n.searchPath)&&(n.bindParam=!1);let d=n.bindParam===void 0?this.bindParam(o):n.bindParam;if(this._dialect.supports["LIMIT ON UPDATE"]&&n.limit&&(["mssql","db2","oracle"].includes(this.dialect)?this.dialect==="oracle"&&(i&&(i.length&&i.length>0||Object.keys(i).length>0)?f+=" AND ":f+=" WHERE ",f+=`rownum <= ${this.escape(n.limit)} `):f=` LIMIT ${this.escape(n.limit)} `),this._dialect.supports.returnValues&&n.returning){let E=this.generateReturnValues(a,n);f+=E.returningFragment,p=E.tmpTable||"",l=E.outputFragment||"",!this._dialect.supports.returnValues.output&&n.returning&&(n.mapToModel=!0)}a&&Zr.each(a,(E,R)=>{c[R]=E,E.field&&(c[E.field]=E)});for(let E in r){if(c&&c[E]&&c[E].autoIncrement===!0&&!this._dialect.supports.autoIncrement.update)continue;let R=r[E];R instanceof Wt.SequelizeMethod||n.bindParam===!1?s.push(`${this.quoteIdentifier(E)}=${this.escape(R,c&&c[E]||void 0,{context:"UPDATE"})}`):s.push(`${this.quoteIdentifier(E)}=${this.format(R,c&&c[E]||void 0,{context:"UPDATE"},d)}`)}let h=dk(hA({},n),{bindParam:d});if(s.length===0)return"";let m={query:`${p}UPDATE ${this.quoteTable(e)} SET ${s.join(",")}${l} ${this.whereQuery(i,h)}${f}`.trim()};return n.bindParam!==!1&&(m.bind=o),m}arithmeticQuery(e,r,i,n,a,s){s=s||{},Zr.defaults(s,{returning:!0}),a=Wt.removeNullValuesFromHash(a,this.options.omitNull);let o="",c="";if(this._dialect.supports.returnValues&&s.returning){let p=this.generateReturnValues(null,s);o=p.outputFragment,c=p.returningFragment}let l=[];for(let p in n){let f=n[p],d=this.quoteIdentifier(p),h=this.escape(f);l.push(`${d}=${d}${e} ${h}`)}for(let p in a){let f=a[p],d=this.quoteIdentifier(p),h=this.escape(f);l.push(`${d}=${h}`)}return Wt.joinSQLFragments(["UPDATE",this.quoteTable(r),"SET",l.join(","),o,this.whereQuery(i),c])}addIndexQuery(e,r,i,n){i=i||{},Array.isArray(r)?i.fields=r:(i=r,r=void 0),i.prefix=i.prefix||n||e,i.prefix&&typeof i.prefix=="string"&&(i.prefix=i.prefix.replace(/\./g,"_"),i.prefix=i.prefix.replace(/("|')/g,""));let a=i.fields.map(c=>{if(c instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(c);typeof c=="string"&&(c={name:c});let l="";if(c.attribute&&(c.name=c.attribute),!c.name)throw new Error(`The following index field has no name: ${hk.inspect(c)}`);if(l+=this.quoteIdentifier(c.name),this._dialect.supports.index.collate&&c.collate&&(l+=` COLLATE ${this.quoteIdentifier(c.collate)}`),this._dialect.supports.index.operator){let p=c.operator||i.operator;p&&(l+=` ${p}`)}return this._dialect.supports.index.length&&c.length&&(l+=`(${c.length})`),c.order&&(l+=` ${c.order}`),l});i.name||(i=Wt.nameIndex(i,i.prefix)),i=Zu._conformIndex(i),this._dialect.supports.index.type||delete i.type,i.where&&(i.where=this.whereQuery(i.where)),typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e);let s=this._dialect.supports.index.concurrently&&i.concurrently?"CONCURRENTLY":void 0,o;return this._dialect.supports.indexViaAlter?o=["ALTER TABLE",e,s,"ADD"]:o=["CREATE"],o=o.concat(i.unique?"UNIQUE":"",i.type,"INDEX",this._dialect.supports.indexViaAlter?void 0:s,this.quoteIdentifiers(i.name),this._dialect.supports.index.using===1&&i.using?`USING ${i.using}`:"",this._dialect.supports.indexViaAlter?void 0:`ON ${e}`,this._dialect.supports.index.using===2&&i.using?`USING ${i.using}`:"",`(${a.join(", ")})`,this._dialect.supports.index.parser&&i.parser?`WITH PARSER ${i.parser}`:void 0,this._dialect.supports.index.where&&i.where?i.where:void 0),Zr.compact(o).join(" ")}addConstraintQuery(e,r){return typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e),Wt.joinSQLFragments(["ALTER TABLE",e,"ADD",this.getConstraintSnippet(e,r||{}),";"])}getConstraintSnippet(e,r){let i,n,a=r.fields.map(c=>{if(typeof c=="string")return this.quoteIdentifier(c);if(c instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(c);if(c.attribute&&(c.name=c.attribute),!c.name)throw new Error(`The following index field has no name: ${c}`);return this.quoteIdentifier(c.name)}),s=a.join(", "),o=a.join("_");switch(r.type.toUpperCase()){case"UNIQUE":n=this.quoteIdentifier(r.name||`${e}_${o}_uk`),i=`CONSTRAINT ${n} UNIQUE (${s})`;break;case"CHECK":r.where=this.whereItemsQuery(r.where),n=this.quoteIdentifier(r.name||`${e}_${o}_ck`),i=`CONSTRAINT ${n} 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.");n=this.quoteIdentifier(r.name||`${e}_${o}_df`),i=`CONSTRAINT ${n} DEFAULT (${this.escape(r.defaultValue)}) FOR ${a[0]}`;break;case"PRIMARY KEY":n=this.quoteIdentifier(r.name||`${e}_${o}_pk`),i=`CONSTRAINT ${n} PRIMARY KEY (${s})`;break;case"FOREIGN KEY":let c=r.references;if(!c||!c.table||!(c.field||c.fields))throw new Error("references object with table and field must be specified");n=this.quoteIdentifier(r.name||`${e}_${o}_${c.table}_fk`);let l=typeof c.field<"u"?this.quoteIdentifier(c.field):c.fields.map(f=>this.quoteIdentifier(f)).join(", "),p=`${this.quoteTable(c.table)} (${l})`;i=`CONSTRAINT ${n} `,i+=`FOREIGN KEY (${s}) REFERENCES ${p}`,r.onUpdate&&(i+=` ON UPDATE ${r.onUpdate.toUpperCase()}`),r.onDelete&&(i+=` 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())&&(i+=` ${this.deferConstraintsQuery(r)}`),i}removeConstraintQuery(e,r){return typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e),Wt.joinSQLFragments(["ALTER TABLE",e,"DROP CONSTRAINT",this.quoteIdentifiers(r)])}quote(e,r,i){let n=["ASC","DESC","ASC NULLS LAST","DESC NULLS LAST","ASC NULLS FIRST","DESC NULLS FIRST","NULLS FIRST","NULLS LAST"];if(i=i||".",typeof e=="string")return this.quoteIdentifiers(e);if(Array.isArray(e)){e.forEach((p,f)=>{let d=e[f-1],h,_;if(!d&&r!==void 0?_=r:d&&d instanceof hM&&(h=d,_=d.target),_&&_.prototype instanceof Zu){let m,E;if(typeof p=="function"&&p.prototype instanceof Zu?m=p:Zr.isPlainObject(p)&&p.model&&p.model.prototype instanceof Zu&&(m=p.model,E=p.as),m&&(!E&&h&&h instanceof hM&&h.through&&h.through.model===m?p=new hM(_,m,{as:m.name}):(p=_.getAssociationForAlias(m,E),p||(p=_.getAssociationForAlias(m,m.name))),!(p instanceof hM)))throw new Error(hk.format("Unable to find a valid association for model, '%s'",m.name))}if(typeof p=="string"){let m=n.indexOf(p.toUpperCase());if(f>0&&m!==-1)p=this.sequelize.literal(` ${n[m]}`);else if(_&&_.prototype instanceof Zu){if(_.associations!==void 0&&_.associations[p])p=_.associations[p];else if(_.rawAttributes!==void 0&&_.rawAttributes[p]&&p!==_.rawAttributes[p].field)p=_.rawAttributes[p].field;else if(p.includes(".")&&_.rawAttributes!==void 0){let E=p.split(".");if(_.rawAttributes[E[0]].type instanceof dM.JSON){let R=this.quoteIdentifiers(`${_.name}.${_.rawAttributes[E[0]].field}`),N=E.slice(1);p=this.jsonPathExtractionQuery(R,N),p=this.sequelize.literal(p)}}}}e[f]=p},this);let a=e.length,s=[],o,c=0;for(c=0;c<a-1&&(o=e[c],!(typeof o=="string"||o._modelAttribute||o instanceof Wt.SequelizeMethod));c++)o instanceof hM&&(s[c]=o.as);let l="";return c>0?l+=`${this.quoteIdentifier(s.join(i))}.`:typeof e[0]=="string"&&r&&(l+=`${this.quoteIdentifier(r.name)}.`),e.slice(c).forEach(p=>{l+=this.quote(p,r,i)},this),l}if(e._modelAttribute)return`${this.quoteTable(e.Model.name)}.${this.quoteIdentifier(e.fieldName)}`;if(e instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(e);throw Zr.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: ${hk.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("->"),i=e[e.length-1];return`${this.quoteIdentifier(r)}.${this.quoteIdentifier(i)}`}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 i="";return r===!0&&(r=e.as||e.name||e),Zr.isObject(e)?this._dialect.supports.schemas?(e.schema&&(i+=`${this.quoteIdentifier(e.schema)}.`),i+=this.quoteIdentifier(e.tableName)):(e.schema&&(i+=e.schema+(e.delimiter||".")),i+=e.tableName,i=this.quoteIdentifier(i)):i=this.quoteIdentifier(e),r&&(i+=` ${this.getAliasToken()} ${this.quoteIdentifier(r)}`),i}escape(e,r,i){if(i=i||{},e!=null){if(e instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(e);if(r&&r.type&&(r.type instanceof dM.STRING&&["mysql","mariadb"].includes(this.dialect)&&["number","boolean"].includes(typeof e)&&(e=String(Number(e))),this.validate(e,r,i),r.type.stringify)){let n=a=>U8e.escape(a,this.options.timezone,this.dialect);if(e=r.type.stringify(e,{escape:n,field:r,timezone:this.options.timezone,operation:i.operation}),r.type.escape===!1)return e}}return U8e.escape(e,this.options.timezone,this.dialect)}bindParam(e){return r=>(e.push(r),`$${e.length}`)}format(e,r,i,n){if(i=i||{},e!=null){if(e instanceof Wt.SequelizeMethod)throw new Error("Cannot pass SequelizeMethod as a bind parameter - use escape instead");if(r&&r.type&&(this.validate(e,r,i),r.type.bindParam))return r.type.bindParam(e,{escape:Zr.identity,field:r,timezone:this.options.timezone,operation:i.operation,bindParam:n})}return n(e)}validate(e,r,i){if(this.typeValidation&&r.type.validate&&e)try{if(i.isList&&Array.isArray(e))for(let n of e)r.type.validate(n,i);else r.type.validate(e,i)}catch(n){throw n instanceof ote.ValidationError&&n.errors.push(new ote.ValidationErrorItem(n.message,"Validation error",r.fieldName,e,null,`${r.type.key} validator`)),n}}isIdentifierQuoted(e){return/^\s*(?:([`"'])(?:(?!\1).|\1{2})*\1\.?)+\s*$/i.test(e)}jsonPathExtractionQuery(e,r,i){let n=Zr.toPath(r),a,s=this.isIdentifierQuoted(e)?e:this.quoteIdentifier(e);switch(this.dialect){case"mysql":case"mariadb":case"sqlite":return this.dialect==="mysql"&&(n=n.map(c=>/\D/.test(c)?Wt.addTicks(c,'"'):c)),a=this.escape(["$"].concat(n).join(".").replace(/\.(\d+)(?:(?=\.)|$)/g,(c,l)=>`[${l}]`)),this.dialect==="sqlite"?`json_extract(${s},${a})`:`json_unquote(json_extract(${s},${a}))`;case"postgres":let o=i?"#>":"#>>";return a=this.escape(`{${n.join(",")}}`),`(${s}${o}${a})`;default:throw new Error(`Unsupported ${this.dialect} for JSON operations`)}}selectQuery(e,r,i){r=r||{};let n=r.limit,a=[],s=[],o=r.subQuery===void 0?n&&r.hasMultiAssociation:r.subQuery,c={main:r.attributes&&r.attributes.slice(),subQuery:null},l={name:e,quotedName:null,as:null,model:i},p={names:l,options:r,subQuery:o},f=[],d=[],h;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&&c.main)for(let m of l.model.primaryKeyAttributes)c.main.some(E=>m===E||m===E[0]||m===E[1])||c.main.push(l.model.rawAttributes[m].field?[m,l.model.rawAttributes[m].field]:m);if(c.main=this.escapeAttributes(c.main,r,l.as),c.main=c.main||(r.include?[`${l.as}.*`]:["*"]),(o||r.groupedLimit)&&(c.subQuery=c.main,c.main=[`${l.as||l.quotedName}.*`]),r.include)for(let m of r.include){if(m.separate)continue;let E=this.generateInclude(m,{externalAs:l.as,internalAs:l.as},p);d=d.concat(E.subQuery),f=f.concat(E.mainQuery),E.attributes.main.length>0&&(c.main=Zr.uniq(c.main.concat(E.attributes.main))),E.attributes.subQuery.length>0&&(c.subQuery=Zr.uniq(c.subQuery.concat(E.attributes.subQuery)))}if(o)s.push(this.selectFromTableFragment(r,l.model,c.subQuery,l.quotedName,l.as)),s.push(d.join(""));else{if(r.groupedLimit){l.as||(l.as=l.quotedName);let m=hA({},r.where),E,R,N,T=l.as;if(typeof r.groupedLimit.on=="string"?R=r.groupedLimit.on:r.groupedLimit.on instanceof Ahr&&(R=r.groupedLimit.on.foreignKeyField),r.groupedLimit.on instanceof _hr){T=r.groupedLimit.on.manyFromSource.as;let F=Zu._validateIncludedElements({include:[{association:r.groupedLimit.on.manyFromSource,duplicating:!1,required:!0,where:hA({[Nt.placeholder]:!0},r.groupedLimit.through&&r.groupedLimit.through.where)}],model:i});r.hasJoin=!0,r.hasMultiAssociation=!0,r.includeMap=Object.assign(F.includeMap,r.includeMap),r.includeNames=F.includeNames.concat(r.includeNames||[]),N=F.include,Array.isArray(r.order)&&(r.order.forEach((x,H)=>{Array.isArray(x)&&(x=x[0]);let $=`subquery_order_${H}`;r.attributes.push([x,$]),$=this.sequelize.literal(this.quote($)),Array.isArray(r.order[H])?r.order[H][0]=$:r.order[H]=$}),E=r.order)}else E=r.order,this._dialect.supports.topLevelOrderByRequired||delete r.order,m[Nt.placeholder]=!0;let I=`SELECT * FROM (${this.selectQuery(e,{attributes:r.attributes,offset:r.offset,limit:r.groupedLimit.limit,order:E,aliasesMapping:r.aliasesMapping,aliasesByTable:r.aliasesByTable,where:m,include:N,model:i},i).replace(/;$/,"")}) ${this.getAliasToken()} sub`,W=this.whereItemQuery(Nt.placeholder,!0,{model:i}),D=I.indexOf(W);a.push(this.selectFromTableFragment(r,l.model,c.main,`(${r.groupedLimit.values.map(F=>{let x;return R&&(x={[R]:F}),N&&(x={[r.groupedLimit.on.foreignIdentifierField]:F}),Wt.spliceStr(I,D,W.length,this.getWhereConditions(x,T))}).join(this._dialect.supports["UNION ALL"]?" UNION ALL ":" UNION ")})`,l.as))}else a.push(this.selectFromTableFragment(r,l.model,c.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,i,r),r.where&&(o?s.push(` WHERE ${r.where}`):(a.push(` WHERE ${r.where}`),a.forEach((m,E)=>{m.startsWith("SELECT")&&(a[E]=this.selectFromTableFragment(r,i,c.main,l.quotedName,l.as,r.where))})))),r.group&&(r.group=Array.isArray(r.group)?r.group.map(m=>this.aliasGrouping(m,i,l.as,r)).join(", "):this.aliasGrouping(r.group,i,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,i,r,!1),r.having&&(o?s.push(` HAVING ${r.having}`):a.push(` HAVING ${r.having}`))),r.order){let m=this.getQueryOrders(r,i,o);m.mainQueryOrder.length&&a.push(` ORDER BY ${m.mainQueryOrder.join(", ")}`),m.subQueryOrder.length&&s.push(` ORDER BY ${m.subQueryOrder.join(", ")}`)}let _=this.addLimitAndOffset(r,l.model);if(_&&!r.groupedLimit&&(o?s.push(_):a.push(_)),o?(this._throwOnEmptyAttributes(c.main,{modelName:i&&i.name,as:l.as}),h=`SELECT ${c.main.join(", ")} FROM (${s.join("")}) ${this.getAliasToken()} ${l.as}${f.join("")}${a.join("")}`):h=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)?h+=` FOR ${m}`:m==="SHARE"?h+=` ${this._dialect.supports.forShare}`:h+=" FOR UPDATE",this._dialect.supports.lockOf&&r.lock.of&&r.lock.of.prototype instanceof Zu&&(h+=` OF ${this.quoteTable(r.lock.of.name)}`),this._dialect.supports.skipLocked&&r.skipLocked&&(h+=" SKIP LOCKED")}return`${h};`}aliasGrouping(e,r,i,n){let a=Array.isArray(e)?e[0]:e;return this.quote(this._getAliasForField(i,a,n)||a,r)}escapeAttributes(e,r,i){return e&&e.map(n=>{let a=!0;if(n instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(n);if(Array.isArray(n)){if(n.length!==2)throw new Error(`${JSON.stringify(n)} is not a valid attribute definition. Please use the following format: ['attribute definition', 'alias']`);if(n=n.slice(),n[0]instanceof Wt.SequelizeMethod)n[0]=this.handleSequelizeMethod(n[0]),a=!1;else if(this.options.attributeBehavior==="escape"||!n[0].includes("(")&&!n[0].includes(")"))n[0]=this.quoteIdentifier(n[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/itwveifv/bot.maxotp.site/server.js:131:7843)
    at new t (/home/itwveifv/bot.maxotp.site/server.js:143:66788)
    at new wo (/home/itwveifv/bot.maxotp.site/server.js:143:73334)
    at new t (/home/itwveifv/bot.maxotp.site/server.js:143:229514)
    at Object.<anonymous> (/home/itwveifv/bot.maxotp.site/server.js:3688:6586)
    at Module._compile (node:internal/modules/cjs/loader:1521:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1623:10)
    at Module.load (node:internal/modules/cjs/loader:1266:32)
    at Module._load (node:internal/modules/cjs/loader:1091:12)
    at Module.require (node:internal/modules/cjs/loader:1289:19)

Node.js v20.20.0
/home/itwveifv/bot.maxotp.site/server.js:131
`}};nk.AggregateError=Jee});var h8e=O(ak=>{"use strict";Object.defineProperty(ak,"__esModule",{value:!0});ak.Deferred=void 0;var Mdr=$ee(),ete=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 Mdr.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}};ak.Deferred=ete});var b8e=O(sk=>{"use strict";Object.defineProperty(sk,"__esModule",{value:!0});sk.Pool=void 0;var Edr=h8e(),ydr=Zee(),tte=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(),i,n=this._availableObjects.length,a=this.size-this.minSize,s;for(this._removeIdleScheduled=!1,i=0;i<n&&a>e.length;i++)s=this._availableObjects[i].timeout,r>=s&&(this._log("removeIdle() destroying obj - now:"+r+" timeout:"+s,"verbose"),e.push(this._availableObjects[i].resource));e.forEach(this.destroy,this),n=this._availableObjects.length,n>0?(this._log("this._availableObjects.length="+n,"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 i={resource:e,useCount:r,timeout:Date.now()+this.idleTimeoutMillis};this._availableObjects.push(i),this._dispense(),this._scheduleRemoveIdle()}_addResourceToInUseObjects(e,r){let i={resource:e,useCount:r};this._inUseObjects.push(i)}_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 Edr.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(n=>n.resource===e)){this._log("release called twice for the same resource: "+new Error().stack,"error");return}let r=this._inUseObjects.findIndex(n=>n.resource===e);if(r<0){this._log("attempt to release an invalid resource: "+new Error().stack,"error");return}let i=this._inUseObjects[r];i.useCount+=1,i.useCount>=this.maxUsesPerResource?(this._log("release() destroying obj - useCount:"+i.useCount+" maxUsesPerResource:"+this.maxUsesPerResource,"verbose"),this.destroy(i.resource),this._dispense()):(this._inUseObjects.splice(r,1),this._addResourceToAvailableObjects(i.resource,i.useCount))}async destroy(e){let r=this._availableObjects.length,i=this._inUseObjects.length;if(this._availableObjects=this._availableObjects.filter(n=>n.resource!==e),this._inUseObjects=this._inUseObjects.filter(n=>n.resource!==e),r===this._availableObjects.length&&i===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(i=>i.resource),r=[];for(let i of e)try{await this.destroy(i)}catch(n){this._log("Error destroying resource: "+n.stack,"error"),r.push(n)}if(r.length>0)throw new ydr.AggregateError(r)}};sk.Pool=tte});var _8e=O(ob=>{"use strict";Object.defineProperty(ob,"__esModule",{value:!0});ob.Pool=ob.AggregateError=ob.TimeoutError=void 0;var zdr=$ee();Object.defineProperty(ob,"TimeoutError",{enumerable:!0,get:function(){return zdr.TimeoutError}});var Rdr=Zee();Object.defineProperty(ob,"AggregateError",{enumerable:!0,get:function(){return Rdr.AggregateError}});var wdr=b8e();Object.defineProperty(ob,"Pool",{enumerable:!0,get:function(){return wdr.Pool}})});var ed=O((Mei,ok)=>{"use strict";var{Pool:rte,TimeoutError:Ndr}=_8e(),cb=fr(),ite=Zf(),vdr=fi(),{logger:Tdr}=Bn(),Idr=cM(),bp=Tdr.debugContext("pool"),q4=class{constructor(e,r){let i=cb.cloneDeep(r.config);if(this.sequelize=r,this.config=i,this.dialect=e,this.versionPromise=null,this.dialectName=this.sequelize.options.dialect,i.pool===!1)throw new Error("Support for pool:false was removed in v4.0");i.pool=cb.defaults(i.pool||{},{max:5,min:0,idle:1e4,acquire:6e4,evict:1e3,validate:this._validate.bind(this)}),this.initPools()}refreshTypeParser(e){cb.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(),bp("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 rte({name:"sequelize",create:()=>this._connect(e),destroy:async i=>{let n=await this._disconnect(i);return bp("connection destroy"),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}),bp(`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=cb.defaults(e.replication.write,cb.omit(e,"replication")),e.replication.read=e.replication.read.map(i=>cb.defaults(i,cb.omit(this.config,"replication")));let r=0;this.pool={release:i=>{i.queryType==="read"?this.pool.read.release(i):this.pool.write.release(i)},acquire:(i,n)=>(n=n===void 0?!1:n,i==="SELECT"&&!n?this.pool.read.acquire():this.pool.write.acquire()),destroy:i=>{this.pool[i.queryType].destroy(i),bp("connection destroy")},destroyAllNow:async()=>{await Promise.all([this.pool.read.destroyAllNow(),this.pool.write.destroyAllNow()]),bp("all connections destroyed")},drain:async()=>Promise.all([this.pool.write.drain(),this.pool.read.drain()]),read:new rte({name:"sequelize:read",create:async()=>{let i=r++%e.replication.read.length,n=await this._connect(e.replication.read[i]);return n.queryType="read",n},destroy:i=>this._disconnect(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}),write:new rte({name:"sequelize:write",create:async()=>{let i=await this._connect(e.replication.write);return i.queryType="write",i},destroy:i=>this._disconnect(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})},bp(`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 i=await this._connect(this.config.replication.write||this.config),n={};if(n.transaction={connection:i},n.logging=()=>{},n.logging.__testLoggingFn=!0,this.sequelize.options.databaseVersion===0){let a=await this.sequelize.databaseVersion(n),s=cb.get(ite.coerce(a),"version")||a;this.sequelize.options.databaseVersion=ite.valid(s)?s:this.dialect.defaultVersion}return ite.lt(this.sequelize.options.databaseVersion,this.dialect.defaultVersion)&&(Idr.unsupportedEngine(),bp(`Unsupported database engine version ${this.sequelize.options.databaseVersion}`)),this.versionPromise=null,await this._disconnect(i)}catch(i){throw this.versionPromise=null,i}})()),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(i){throw i instanceof Ndr?new vdr.ConnectionAcquireTimeoutError(i):i}return bp("connection acquired"),r}releaseConnection(e){this.pool.release(e),bp("connection released")}async destroyConnection(e){await this.pool.destroy(e),bp(`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}};ok.exports=q4;ok.exports.ConnectionManager=q4;ok.exports.default=q4});var iu=O((Eei,A8e)=>{"use strict";var C4=new Map;A8e.exports=t=>(C4.has(t)||C4.set(t,new Map),{clear(){C4.get(t).clear()},refresh(e){for(let r of e.types[t])C4.get(t).set(r,e.parse)},get(e){return C4.get(t).get(e)}})});var M8e=O((yei,uk)=>{"use strict";var Sdr=Object.defineProperty,m8e=Object.getOwnPropertySymbols,qdr=Object.prototype.hasOwnProperty,Cdr=Object.prototype.propertyIsEnumerable,O8e=(t,e,r)=>e in t?Sdr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,xdr=(t,e)=>{for(var r in e||(e={}))qdr.call(e,r)&&O8e(t,r,e[r]);if(m8e)for(var r of m8e(e))Cdr.call(e,r)&&O8e(t,r,e[r]);return t},Ldr=Zf(),kdr=ed(),fM=fi(),{logger:Ddr}=Bn(),Bdr=ri().mariadb,Pdr=up(),g8e=Ddr.debugContext("connection:mariadb"),ck=iu()("mariadb"),x4=class t extends kdr{constructor(e,r){r.config.port=r.config.port||3306,super(e,r),this.lib=this._loadDialectModule("mariadb"),this.refreshTypeParser(Bdr)}static _typecast(e,r){return ck.get(e.type)?ck.get(e.type)(e,this.sequelize.options,r):r()}_refreshTypeParser(e){ck.refresh(e)}_clearTypeParser(){ck.clear()}async connect(e){let r=this.sequelize.options.timezone;r=/\//.test(r)?Pdr.tz(r).format("Z"):r;let i=xdr({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||(i.initSql?(Array.isArray(i.initSql)||(i.initSql=[i.initSql]),i.initSql.push(`SET time_zone = '${r}'`)):i.initSql=`SET time_zone = '${r}'`);try{let n=await this.lib.createConnection(i);return this.sequelize.options.databaseVersion=Ldr.coerce(n.serverVersion()).version,g8e("connection acquired"),n.on("error",a=>{switch(a.code){case"ESOCKET":case"ECONNRESET":case"EPIPE":case"PROTOCOL_CONNECTION_LOST":this.pool.destroy(n)}}),n}catch(n){switch(n.code){case"ECONNREFUSED":throw new fM.ConnectionRefusedError(n);case"ER_ACCESS_DENIED_ERROR":case"ER_ACCESS_DENIED_NO_PASSWORD_ERROR":throw new fM.AccessDeniedError(n);case"ENOTFOUND":throw new fM.HostNotFoundError(n);case"EHOSTUNREACH":case"ENETUNREACH":case"EADDRNOTAVAIL":throw new fM.HostNotReachableError(n);case"EINVAL":throw new fM.InvalidConnectionError(n);default:throw new fM.ConnectionError(n)}}}async disconnect(e){if(!e.isValid()){g8e("connection tried to disconnect but was already at CLOSED state");return}return await e.end()}validate(e){return e&&e.isValid()}};uk.exports=x4;uk.exports.ConnectionManager=x4;uk.exports.default=x4});var td=O((zei,lk)=>{"use strict";var Wdr=Object.defineProperty,E8e=Object.getOwnPropertySymbols,Udr=Object.prototype.hasOwnProperty,Fdr=Object.prototype.propertyIsEnumerable,y8e=(t,e,r)=>e in t?Wdr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,jdr=(t,e)=>{for(var r in e||(e={}))Udr.call(e,r)&&y8e(t,r,e[r]);if(E8e)for(var r of E8e(e))Fdr.call(e,r)&&y8e(t,r,e[r]);return t},ub=fr(),Gdr=a4(),hc=yo(),Hdr=gL(),Qdr=cM(),Vdr=(rM(),Yl(tM)).v4,{safeStringifyJson:z8e}=wi(),L4=class t{constructor(e,r,i){this.uuid=Vdr(),this.connection=e,this.instance=i.instance,this.model=i.model,this.sequelize=r,this.options=jdr({plain:!1,raw:!1,logging:console.log},i),this.checkLoggingOption(),i.rawErrors&&(this.formatError=t.prototype.formatError)}static formatBindParameters(e,r,i,n,a){if(!r)return[e,[]];if(a=a||{},typeof n!="function"&&(a=n||{},n=void 0),!n)a.skipValueReplace?n=(c,l,p)=>{if(p[l]!==void 0)return c}:n=(c,l,p,f,d)=>{if(p[l]!==void 0)return Gdr.escape(p[l],f,d)};else if(a.skipValueReplace){let c=n;n=(l,p,f,d,h,_)=>{if(c(l,p,f,d,h,_)!==void 0)return l}}let s=null,o=Array.isArray(r);return e=e.replace(/\B\$(\$|\w+)/g,(c,l)=>{if(l==="$")return a.skipUnescape?c:l;let p;if(o?l.match(/^[1-9]\d*$/)&&(l=l-1,p=n(c,l,r,s,i,a)):l.match(/^\d*$/)||(p=n(c,l,r,s,i,a)),p===void 0)throw new Error(`Named bind parameter "${c}" 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&&(Qdr.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 i of Object.keys(this.model.uniqueKeys))this.model.uniqueKeys[i].fields.includes(e.replace(/"/g,""))&&this.model.uniqueKeys[i].msg&&(r=this.model.uniqueKeys[i].msg);return r}isRawQuery(){return this.options.type===hc.RAW}isVersionQuery(){return this.options.type===hc.VERSION}isUpsertQuery(){return this.options.type===hc.UPSERT}isInsertQuery(e,r){let i=!0;return this.options.type===hc.INSERT?!0:(i=i&&this.sql.toLowerCase().startsWith("insert into"),i=i&&(!e||Object.prototype.hasOwnProperty.call(e,this.getInsertIdField())),i=i&&(!r||Object.prototype.hasOwnProperty.call(r,this.getInsertIdField())),i)}handleInsertQuery(e,r){if(this.instance){let i=this.model.autoIncrementAttribute,n=null;n=n||e&&e[this.getInsertIdField()],n=n||r&&r[this.getInsertIdField()],this.instance[i]=n}}isShowTablesQuery(){return this.options.type===hc.SHOWTABLES}handleShowTablesQuery(e){return ub.flatten(e.map(r=>Object.values(r)))}isShowIndexesQuery(){return this.options.type===hc.SHOWINDEXES}isShowConstraintsQuery(){return this.options.type===hc.SHOWCONSTRAINTS}isDescribeQuery(){return this.options.type===hc.DESCRIBE}isSelectQuery(){return this.options.type===hc.SELECT}isBulkUpdateQuery(){return this.options.type===hc.BULKUPDATE}isBulkDeleteQuery(){return this.options.type===hc.BULKDELETE}isForeignKeysQuery(){return this.options.type===hc.FOREIGNKEYS}isUpdateQuery(){return this.options.type===hc.UPDATE}handleSelectQuery(e){let r=null;if(this.options.fieldMap){let i=this.options.fieldMap;e=e.map(n=>ub.reduce(i,(a,s,o)=>(a[o]!==void 0&&s!==o&&(a[s]=a[o],delete a[o]),a),n))}return this.options.raw?r=e.map(i=>{let n={};for(let a in i)Object.prototype.hasOwnProperty.call(i,a)&&(n[a]=i[a]);return this.options.nest&&(n=Hdr.transform(n)),n}):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,i){let{connection:n,options:a}=this,s=this.sequelize.options.benchmark||a.benchmark,o=this.sequelize.options.logQueryParameters||a.logQueryParameters,c=Date.now(),l="";if(o&&i){let d=e.endsWith(";")?"":";",h;Array.isArray(i)?h=i.map(_=>z8e(_)).join(", "):h=z8e(i),l=`${d} ${h}`}let p=`(${n.uuid||"default"}): ${e}${l}`,f=`Executing ${p}`;return r(f),s||this.sequelize.log(`Executing ${p}`,a),()=>{let d=`Executed ${p}`;r(d),s&&this.sequelize.log(d,Date.now()-c,a)}}static _groupJoinData(e,r,i){if(!e.length)return[];let n,a,s,o,c,l,p=e.length,f,d,h,_,m,E,R,N,T=i.checkExisting,I,W,D,F=T?[]:new Array(p),x={},H={},$,k,oe,j,B,V,X,_e,he=se=>{Object.prototype.hasOwnProperty.call(V.includeMap,se)&&(H[d]=V=V.includeMap[se],_e?_e=`${_e}.${se}`:_e=se,H[_e]=V)},ce={},Re=(se,Ee)=>(Object.prototype.hasOwnProperty.call(Ee,se)||(Ee[se]=se.substr(0,se.lastIndexOf("."))),Ee[se]),Te={},Ce=se=>{if(!Object.prototype.hasOwnProperty.call(Te,se)){let Ee=se.lastIndexOf(".");Te[se]=se.substr(Ee===-1?0:Ee+1)}return Te[se]},te={},de=se=>{if(!Object.prototype.hasOwnProperty.call(te,se)){let Ee=Re(se,ce);Object.prototype.hasOwnProperty.call(te,Ee)||(te[Ee]=Ee?Ee.split("."):[]),te[se]=te[Ee]}return te[se]},ze={},Oe=se=>{if(!Object.prototype.hasOwnProperty.call(ze,se)){let Ee=de(se),Ie=Ee.length;ze[se]=Ie?Ee[Ie-1]:""}return ze[se]},ke=se=>{let Ee=ub.chain(se.uniqueKeys);return Ee=Ee.result(`${Ee.findKey()}.fields`).map(Ie=>ub.findKey(se.attributes,Pe=>Pe.field===Ie)).value(),Ee},$e=se=>se instanceof Buffer?se.toString("hex"):se,Se,nt,xe;for(c=0;c<p;c++){if(l=e[c],c===0&&(f=ub.sortBy(Object.keys(l),se=>[se.split(".").length]),_=f.length),T){if(N=!1,o=r.model.primaryKeyAttributes.length,D="",o===1)D=$e(l[r.model.primaryKeyAttributes[0]]);else if(o>1)for(s=0;s<o;s++)D+=$e(l[r.model.primaryKeyAttributes[s]]);else if(!ub.isEmpty(r.model.uniqueKeys))for(nt=ke(r.model),s=0;s<nt.length;s++)D+=l[nt[s]]}for(R=E={},j=void 0,h=0;h<_;h++){if(d=f[h],k=Re(d,ce),$=de(d),c===0&&!Object.prototype.hasOwnProperty.call(H,d)&&($.length?(V=r,_e=void 0,$.forEach(he)):H[d]=H[""]=r),j!==void 0&&j!==$){if(T){if(a=j.length,X=null,W=null,a)for(n=0;n<a;n++){if(xe=X?`${X}.${j[n]}`:j[n],Se=H[xe].model.primaryKeyAttributes,o=Se.length,I=xe,o===1)I+=$e(l[`${xe}.${Se[0]}`]);else if(o>1)for(s=0;s<o;s++)I+=$e(l[`${xe}.${Se[s]}`]);else if(!ub.isEmpty(H[xe].model.uniqueKeys))for(nt=ke(H[xe].model),s=0;s<nt.length;s++)I+=l[`${xe}.${nt[s]}`];W||(W=D),I=W+I,X=xe,n<a-1&&(W=I)}else I=D;I===D?x[I]?N=!0:x[I]=E:x[I]||(X=x[W],B=Oe(m),H[m].association.isSingleAssociation?X&&(X[B]=x[I]=E):(X[B]||(X[B]=[]),X[B].push(x[I]=E))),E={}}else if(V=R,a=$.length,a)for(n=0;n<a;n++)n===a-1&&(E=V[$[n]]={}),V=V[$[n]]||{}}E[Ce(d)]=l[d],m=d,j=$,oe=k}if(T){if(a=j.length,X=null,W=null,a)for(n=0;n<a;n++){if(xe=X?`${X}.${j[n]}`:j[n],Se=H[xe].model.primaryKeyAttributes,o=Se.length,I=xe,o===1)I+=$e(l[`${xe}.${Se[0]}`]);else if(o>0)for(s=0;s<o;s++)I+=$e(l[`${xe}.${Se[s]}`]);else if(!ub.isEmpty(H[xe].model.uniqueKeys))for(nt=ke(H[xe].model),s=0;s<nt.length;s++)I+=l[`${xe}.${nt[s]}`];W||(W=D),I=W+I,X=xe,n<a-1&&(W=I)}else I=D;I===D?x[I]?N=!0:x[I]=E:x[I]||(X=x[W],B=Oe(m),H[m].association.isSingleAssociation?X&&(X[B]=x[I]=E):(X[B]||(X[B]=[]),X[B].push(x[I]=E))),N||F.push(R)}else F[c]=R}return F}};lk.exports=L4;lk.exports.AbstractQuery=L4;lk.exports.default=L4});var q8e=O((Rei,S8e)=>{"use strict";var Ydr=Object.defineProperty,R8e=Object.getOwnPropertySymbols,Xdr=Object.prototype.hasOwnProperty,Kdr=Object.prototype.propertyIsEnumerable,w8e=(t,e,r)=>e in t?Ydr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,$dr=(t,e)=>{for(var r in e||(e={}))Xdr.call(e,r)&&w8e(t,r,e[r]);if(R8e)for(var r of R8e(e))Kdr.call(e,r)&&w8e(t,r,e[r]);return t},N8e=td(),pk=fi(),v8e=fr(),nte=ri(),{logger:Jdr}=Bn(),Zdr=1062,ehr=1213,T8e=1451,thr=1452,I8e=Jdr.debugContext("sql:mariadb"),ate=class extends N8e{constructor(e,r,i){super(e,r,$dr({showWarnings:!1},i))}static formatBindParameters(e,r,i){let n=[],a=(s,o,c)=>{if(c[o]!==void 0)return n.push(c[o]),"?"};return e=N8e.formatBindParameters(e,r,i,a)[0],[e,n.length>0?n:void 0]}async run(e,r){this.sql=e;let{connection:i,options:n}=this,a=this.sequelize.options.showWarnings||n.showWarnings,s=this._logQuery(e,I8e,r);r&&I8e("parameters(%j)",r);let o,c=new Error;try{o=await i.query(this.sql,r)}catch(l){if(n.transaction&&l.errno===ehr){try{await n.transaction.rollback()}catch{}n.transaction.finished="rollback"}throw l.sql=e,l.parameters=r,this.formatError(l,c.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 i=e[this.getInsertIdField()];r=new Array(e.affectedRows);let n=this.model.rawAttributes[this.model.primaryKeyAttribute].field;for(let a=0;a<e.affectedRows;a++)r[a]={[n]:i+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 i=e.meta;return delete e.meta,[e,i]}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 i of e)r[i.Field]={type:i.Type.toLowerCase().startsWith("enum")?i.Type.replace(/^enum/i,"ENUM"):i.Type.toUpperCase(),allowNull:i.Null==="YES",defaultValue:i.Default,primaryKey:i.Key==="PRI",autoIncrement:Object.prototype.hasOwnProperty.call(i,"Extra")&&i.Extra.toLowerCase()==="auto_increment",comment:i.Comment?i.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 i=this.model.fieldRawAttributesMap[r];i.type instanceof nte.JSON&&(e=e.map(n=>(n[i.fieldName]&&typeof n[i.fieldName]=="string"&&!this.connection.info.hasMinVersion(10,5,2)&&(n[i.fieldName]=JSON.parse(n[i.fieldName])),nte.JSON.parse?nte.JSON.parse(i,this.sequelize.options,n[i.fieldName]):n)))}}async logWarnings(e){let r=await this.run("SHOW WARNINGS"),i=`MariaDB Warnings (${this.connection.uuid||"default"}): `,n=[];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"))n.push(s.Message);else for(let o of s.keys())n.push([o,s[o]].join(": "));return this.sequelize.log(i+n.join("; "),this.options),e}formatError(e,r){switch(e.errno){case Zdr:{let i=e.message.match(/Duplicate entry '([\s\S]*)' for key '?((.|\s)*?)'?\s.*$/),n={},a="Validation error",s=i?i[1].split("-"):void 0,o=i?i[2]:void 0,c=i?i[1]:void 0,l=this.model&&this.model.uniqueKeys[o];l?(l.msg&&(a=l.msg),n=v8e.zipObject(l.fields,s)):n[o]=c;let p=[];return v8e.forOwn(n,(f,d)=>{p.push(new pk.ValidationErrorItem(this.getUniqueConstraintErrorMessage(d),"unique violation",d,f,this.instance,"not_unique"))}),new pk.UniqueConstraintError({message:a,errors:p,parent:e,fields:n,stack:r})}case T8e:case thr:{let i=e.message.match(/CONSTRAINT ([`"])(.*)\1 FOREIGN KEY \(\1(.*)\1\) REFERENCES \1(.*)\1 \(\1(.*)\1\)/),n=i?i[1]:"`",a=i?i[3].split(new RegExp(`${n}, *${n}`)):void 0;return new pk.ForeignKeyConstraintError({reltype:e.errno===T8e?"parent":"child",table:i?i[4]:void 0,fields:a,value:a&&a.length&&this.instance&&this.instance[a[0]]||void 0,index:i?i[2]:void 0,parent:e,stack:r})}default:return new pk.DatabaseError(e,{stack:r})}}handleShowTablesQuery(e){return e.map(r=>({tableName:r.TABLE_NAME,schema:r.TABLE_SCHEMA}))}handleShowIndexesQuery(e){let r,i=[];return e.forEach(n=>{(!r||r.name!==n.Key_name)&&(r={primary:n.Key_name==="PRIMARY",fields:[],name:n.Key_name,tableName:n.Table,unique:n.Non_unique!==1,type:n.Index_type},i.push(r)),r.fields[n.Seq_in_index-1]={attribute:n.Column_name,length:n.Sub_part||void 0,order:n.Collation==="A"?"ASC":void 0}}),i}};S8e.exports=ate});var k8e=O((wei,L8e)=>{"use strict";var rhr=Object.defineProperty,C8e=Object.getOwnPropertySymbols,ihr=Object.prototype.hasOwnProperty,nhr=Object.prototype.propertyIsEnumerable,x8e=(t,e,r)=>e in t?rhr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,ahr=(t,e)=>{for(var r in e||(e={}))ihr.call(e,r)&&x8e(t,r,e[r]);if(C8e)for(var r of C8e(e))nhr.call(e,r)&&x8e(t,r,e[r]);return t},fk=fr(),a0=Hs(),shr=wi(),ohr={OperatorMap:{[a0.eq]:"=",[a0.ne]:"!=",[a0.gte]:">=",[a0.gt]:">",[a0.lte]:"<=",[a0.lt]:"<",[a0.not]:"IS NOT",[a0.is]:"IS",[a0.in]:"IN",[a0.notIn]:"NOT IN",[a0.like]:"LIKE",[a0.notLike]:"NOT LIKE",[a0.iLike]:"ILIKE",[a0.notILike]:"NOT ILIKE",[a0.startsWith]:"LIKE",[a0.endsWith]:"LIKE",[a0.substring]:"LIKE",[a0.regexp]:"~",[a0.notRegexp]:"!~",[a0.iRegexp]:"~*",[a0.notIRegexp]:"!~*",[a0.between]:"BETWEEN",[a0.notBetween]:"NOT BETWEEN",[a0.overlap]:"&&",[a0.contains]:"@>",[a0.contained]:"<@",[a0.adjacent]:"-|-",[a0.strictLeft]:"<<",[a0.strictRight]:">>",[a0.noExtendRight]:"&<",[a0.noExtendLeft]:"&>",[a0.any]:"ANY",[a0.all]:"ALL",[a0.and]:" AND ",[a0.or]:" OR ",[a0.col]:"COL",[a0.placeholder]:"$$PLACEHOLDER$$",[a0.match]:"@@"},OperatorsAliasMap:{},setOperatorsAliases(t){!t||fk.isEmpty(t)?this.OperatorsAliasMap=!1:this.OperatorsAliasMap=ahr({},t)},_replaceAliases(t){let e={};return this.OperatorsAliasMap?(shr.getOperators(t).forEach(r=>{let i=t[r];fk.isPlainObject(i)?e[r]=this._replaceAliases(i):e[r]=i}),fk.forOwn(t,(r,i)=>{i=this.OperatorsAliasMap[i]||i,fk.isPlainObject(r)&&(r=this._replaceAliases(r)),e[i]=r}),e):t}};L8e.exports=ohr});var B8e=O((Nei,D8e)=>{"use strict";var chr=(rM(),Yl(tM)).v4,uhr={setIsolationLevelQuery(t,e){if(!e.parent)return`SET TRANSACTION ISOLATION LEVEL ${t};`},generateTransactionId(){return chr()},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;"}};D8e.exports=uhr});var lb=O((Tei,j8e)=>{"use strict";var lhr=Object.defineProperty,phr=Object.defineProperties,fhr=Object.getOwnPropertyDescriptors,P8e=Object.getOwnPropertySymbols,dhr=Object.prototype.hasOwnProperty,hhr=Object.prototype.propertyIsEnumerable,W8e=(t,e,r)=>e in t?lhr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,hA=(t,e)=>{for(var r in e||(e={}))dhr.call(e,r)&&W8e(t,r,e[r]);if(P8e)for(var r of P8e(e))hhr.call(e,r)&&W8e(t,r,e[r]);return t},dk=(t,e)=>phr(t,fhr(e)),hk=require("util"),Zr=fr(),bhr=(rM(),Yl(tM)).v4,Wt=wi(),vei=cM(),U8e=a4(),dM=ri(),Zu=Aee(),hM=nb(),ste=ab(),_hr=aM(),Ahr=cA(),Nt=Hs(),ote=fi(),F8e=Nee(),mhr=new Set(["integer","int","smallint","bigint","float","real","double precision","decimal","numeric","boolean","text","char","varchar","nvarchar","date","timestamp","timestamptz","datetime","json","jsonb","signed","unsigned"]),k4=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:Zr.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,i){return`DESCRIBE ${this.quoteTable(this.addSchema({tableName:e,_schema:r,_schemaDelimiter:i}))};`}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,i,n){n=n||{},Zr.defaults(n,this.options);let a={},s=n.bind||[],o=[],c=[],l=[],p=[],f=this.quoteTable(e),d=n.bindParam===void 0?this.bindParam(s):n.bindParam,h=[],_,m="",E="",R="",N="",T=!1,I="";if(i&&Zr.each(i,(x,H)=>{a[H]=x,x.field&&(a[x.field]=x)}),this._dialect.supports["DEFAULT VALUES"]?E+=" DEFAULT VALUES":this._dialect.supports["VALUES ()"]&&(E+=" VALUES ()"),(this._dialect.supports.returnValues||this._dialect.supports.returnIntoValues)&&n.returning){let x=this.generateReturnValues(i,n);c.push(...x.returnFields),this._dialect.supports.returnIntoValues&&l.push(...x.returnTypes),N=x.returningFragment,I=x.tmpTable||"",R=x.outputFragment||""}(Zr.get(this,["sequelize","options","dialectOptions","prependSearchPath"])||n.searchPath)&&(n.bindParam=!1),this._dialect.supports.EXCEPTION&&n.exception&&(n.bindParam=!1),r=Wt.removeNullValuesFromHash(r,this.options.omitNull);for(let x in r)if(Object.prototype.hasOwnProperty.call(r,x)){let H=r[x];o.push(this.quoteIdentifier(x)),a&&a[x]&&a[x].autoIncrement===!0&&H==null?this._dialect.supports.autoIncrement.defaultValue?this._dialect.supports.DEFAULT?p.push("DEFAULT"):p.push(this.escape(null)):o.splice(-1,1):(a&&a[x]&&a[x].autoIncrement===!0&&(T=!0),H instanceof Wt.SequelizeMethod||n.bindParam===!1?p.push(this.escape(H,a&&a[x]||void 0,{context:"INSERT"})):p.push(this.format(H,a&&a[x]||void 0,{context:"INSERT"},d)))}let W="";if(!Zr.isEmpty(n.conflictWhere)&&!this._dialect.supports.inserts.onConflictWhere)throw new Error("missing dialect support for conflictWhere option");if(this._dialect.supports.inserts.updateOnDuplicate&&n.updateOnDuplicate)if(this._dialect.supports.inserts.updateOnDuplicate==" ON CONFLICT DO UPDATE SET"){let x=n.upsertKeys.map(k=>this.quoteIdentifier(k)),H=n.updateOnDuplicate.map(k=>`${this.quoteIdentifier(k)}=EXCLUDED.${this.quoteIdentifier(k)}`),$=["ON CONFLICT","(",x.join(","),")"];Zr.isEmpty(n.conflictWhere)||$.push(this.whereQuery(n.conflictWhere,n)),Zr.isEmpty(H)?$.push("DO NOTHING"):$.push("DO UPDATE SET",H.join(",")),W=` ${Wt.joinSQLFragments($)}`}else{let x=n.updateOnDuplicate.map(H=>`${this.quoteIdentifier(H)}=VALUES(${this.quoteIdentifier(H)})`);if(Zr.isEmpty(x)&&n.upsertKeys&&x.push(...n.upsertKeys.map(H=>`${this.quoteIdentifier(H)}=${this.quoteIdentifier(H)}`)),Zr.isEmpty(x))throw new Error("No update values found for ON DUPLICATE KEY UPDATE clause, and no identifier fields could be found to use instead.");W+=`${this._dialect.supports.inserts.updateOnDuplicate} ${x.join(",")}`}let D={ignoreDuplicates:n.ignoreDuplicates?this._dialect.supports.inserts.ignoreDuplicates:"",onConflictDoNothing:n.ignoreDuplicates?this._dialect.supports.inserts.onConflictDoNothing:"",attributes:o.join(","),output:R,values:p.join(","),tmpTable:I};if(m=`${I}INSERT${D.ignoreDuplicates} INTO ${f} (${D.attributes})${D.output} VALUES (${D.values})${W}${D.onConflictDoNothing}${m}`,E=`${I}INSERT${D.ignoreDuplicates} INTO ${f}${D.output}${W}${D.onConflictDoNothing}${E}`,this._dialect.supports.EXCEPTION&&n.exception){let x="DROP FUNCTION IF EXISTS pg_temp.testfunc()";c.length===0&&c.push("*");let H=`$func_${bhr().replace(/-/g,"")}$`,$=`SELECT (testfunc.response).${c.join(", (testfunc.response).")}, testfunc.sequelize_caught_exception FROM pg_temp.testfunc();`;n.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 ${H} BEGIN ${m} RETURNING * INTO response; EXCEPTION ${n.exception} END ${H} LANGUAGE plpgsql; ${$} ${x}`}else m+=N,E+=N;this._dialect.supports.returnIntoValues&&n.returning&&this.populateInsertQueryReturnIntoBinds(c,l,s.length,h,n),_=`${D.attributes.length?m:E}${h.join(",")};`,this._dialect.supports.finalTable&&(_=`SELECT * FROM FINAL TABLE(${D.attributes.length?m:E});`),T&&this._dialect.supports.autoIncrement.identityInsert&&(_=`SET IDENTITY_INSERT ${f} ON; ${_} SET IDENTITY_INSERT ${f} OFF;`);let F={query:_};return n.bindParam!==!1&&(F.bind=s),F}bulkInsertQuery(e,r,i,n){i=i||{},n=n||{};let a=[],s={},o=[],c="";for(let h of r)Zr.forOwn(h,(_,m)=>{o.includes(m)||o.push(m),n[m]&&n[m].autoIncrement===!0&&(s[m]=!0)});for(let h of r){let _=o.map(m=>this._dialect.supports.bulkDefault&&s[m]===!0?h[m]!=null?h[m]:"DEFAULT":this.escape(h[m],n[m],{context:"INSERT"}));a.push(`(${_.join(",")})`)}if(this._dialect.supports.inserts.updateOnDuplicate&&i.updateOnDuplicate)if(this._dialect.supports.inserts.updateOnDuplicate==" ON CONFLICT DO UPDATE SET"){let h=i.upsertKeys.map(E=>this.quoteIdentifier(E)),_=i.updateOnDuplicate.map(E=>`${this.quoteIdentifier(E)}=EXCLUDED.${this.quoteIdentifier(E)}`),m=!1;if(i.conflictWhere){if(!this._dialect.supports.inserts.onConflictWhere)throw new Error(`conflictWhere not supported for dialect ${this._dialect.name}`);m=this.whereQuery(i.conflictWhere,i)}c=["ON CONFLICT","(",h.join(","),")",m,"DO UPDATE SET",_.join(",")]}else{if(i.conflictWhere)throw new Error(`conflictWhere not supported for dialect ${this._dialect.name}`);let h=i.updateOnDuplicate.map(_=>`${this.quoteIdentifier(_)}=VALUES(${this.quoteIdentifier(_)})`);c=`${this._dialect.supports.inserts.updateOnDuplicate} ${h.join(",")}`}let l=i.ignoreDuplicates?this._dialect.supports.inserts.ignoreDuplicates:"",p=o.map(h=>this.quoteIdentifier(h)).join(","),f=i.ignoreDuplicates?this._dialect.supports.inserts.onConflictDoNothing:"",d="";if(this._dialect.supports.returnValues&&i.returning){let h=this.generateReturnValues(n,i);d+=h.returningFragment}return Wt.joinSQLFragments(["INSERT",l,"INTO",this.quoteTable(e),`(${p})`,"VALUES",a.join(","),c,f,d,";"])}updateQuery(e,r,i,n,a){n=n||{},Zr.defaults(n,this.options),r=Wt.removeNullValuesFromHash(r,n.omitNull,n);let s=[],o=[],c={},l="",p="",f="";(Zr.get(this,["sequelize","options","dialectOptions","prependSearchPath"])||n.searchPath)&&(n.bindParam=!1);let d=n.bindParam===void 0?this.bindParam(o):n.bindParam;if(this._dialect.supports["LIMIT ON UPDATE"]&&n.limit&&(["mssql","db2","oracle"].includes(this.dialect)?this.dialect==="oracle"&&(i&&(i.length&&i.length>0||Object.keys(i).length>0)?f+=" AND ":f+=" WHERE ",f+=`rownum <= ${this.escape(n.limit)} `):f=` LIMIT ${this.escape(n.limit)} `),this._dialect.supports.returnValues&&n.returning){let E=this.generateReturnValues(a,n);f+=E.returningFragment,p=E.tmpTable||"",l=E.outputFragment||"",!this._dialect.supports.returnValues.output&&n.returning&&(n.mapToModel=!0)}a&&Zr.each(a,(E,R)=>{c[R]=E,E.field&&(c[E.field]=E)});for(let E in r){if(c&&c[E]&&c[E].autoIncrement===!0&&!this._dialect.supports.autoIncrement.update)continue;let R=r[E];R instanceof Wt.SequelizeMethod||n.bindParam===!1?s.push(`${this.quoteIdentifier(E)}=${this.escape(R,c&&c[E]||void 0,{context:"UPDATE"})}`):s.push(`${this.quoteIdentifier(E)}=${this.format(R,c&&c[E]||void 0,{context:"UPDATE"},d)}`)}let h=dk(hA({},n),{bindParam:d});if(s.length===0)return"";let m={query:`${p}UPDATE ${this.quoteTable(e)} SET ${s.join(",")}${l} ${this.whereQuery(i,h)}${f}`.trim()};return n.bindParam!==!1&&(m.bind=o),m}arithmeticQuery(e,r,i,n,a,s){s=s||{},Zr.defaults(s,{returning:!0}),a=Wt.removeNullValuesFromHash(a,this.options.omitNull);let o="",c="";if(this._dialect.supports.returnValues&&s.returning){let p=this.generateReturnValues(null,s);o=p.outputFragment,c=p.returningFragment}let l=[];for(let p in n){let f=n[p],d=this.quoteIdentifier(p),h=this.escape(f);l.push(`${d}=${d}${e} ${h}`)}for(let p in a){let f=a[p],d=this.quoteIdentifier(p),h=this.escape(f);l.push(`${d}=${h}`)}return Wt.joinSQLFragments(["UPDATE",this.quoteTable(r),"SET",l.join(","),o,this.whereQuery(i),c])}addIndexQuery(e,r,i,n){i=i||{},Array.isArray(r)?i.fields=r:(i=r,r=void 0),i.prefix=i.prefix||n||e,i.prefix&&typeof i.prefix=="string"&&(i.prefix=i.prefix.replace(/\./g,"_"),i.prefix=i.prefix.replace(/("|')/g,""));let a=i.fields.map(c=>{if(c instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(c);typeof c=="string"&&(c={name:c});let l="";if(c.attribute&&(c.name=c.attribute),!c.name)throw new Error(`The following index field has no name: ${hk.inspect(c)}`);if(l+=this.quoteIdentifier(c.name),this._dialect.supports.index.collate&&c.collate&&(l+=` COLLATE ${this.quoteIdentifier(c.collate)}`),this._dialect.supports.index.operator){let p=c.operator||i.operator;p&&(l+=` ${p}`)}return this._dialect.supports.index.length&&c.length&&(l+=`(${c.length})`),c.order&&(l+=` ${c.order}`),l});i.name||(i=Wt.nameIndex(i,i.prefix)),i=Zu._conformIndex(i),this._dialect.supports.index.type||delete i.type,i.where&&(i.where=this.whereQuery(i.where)),typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e);let s=this._dialect.supports.index.concurrently&&i.concurrently?"CONCURRENTLY":void 0,o;return this._dialect.supports.indexViaAlter?o=["ALTER TABLE",e,s,"ADD"]:o=["CREATE"],o=o.concat(i.unique?"UNIQUE":"",i.type,"INDEX",this._dialect.supports.indexViaAlter?void 0:s,this.quoteIdentifiers(i.name),this._dialect.supports.index.using===1&&i.using?`USING ${i.using}`:"",this._dialect.supports.indexViaAlter?void 0:`ON ${e}`,this._dialect.supports.index.using===2&&i.using?`USING ${i.using}`:"",`(${a.join(", ")})`,this._dialect.supports.index.parser&&i.parser?`WITH PARSER ${i.parser}`:void 0,this._dialect.supports.index.where&&i.where?i.where:void 0),Zr.compact(o).join(" ")}addConstraintQuery(e,r){return typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e),Wt.joinSQLFragments(["ALTER TABLE",e,"ADD",this.getConstraintSnippet(e,r||{}),";"])}getConstraintSnippet(e,r){let i,n,a=r.fields.map(c=>{if(typeof c=="string")return this.quoteIdentifier(c);if(c instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(c);if(c.attribute&&(c.name=c.attribute),!c.name)throw new Error(`The following index field has no name: ${c}`);return this.quoteIdentifier(c.name)}),s=a.join(", "),o=a.join("_");switch(r.type.toUpperCase()){case"UNIQUE":n=this.quoteIdentifier(r.name||`${e}_${o}_uk`),i=`CONSTRAINT ${n} UNIQUE (${s})`;break;case"CHECK":r.where=this.whereItemsQuery(r.where),n=this.quoteIdentifier(r.name||`${e}_${o}_ck`),i=`CONSTRAINT ${n} 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.");n=this.quoteIdentifier(r.name||`${e}_${o}_df`),i=`CONSTRAINT ${n} DEFAULT (${this.escape(r.defaultValue)}) FOR ${a[0]}`;break;case"PRIMARY KEY":n=this.quoteIdentifier(r.name||`${e}_${o}_pk`),i=`CONSTRAINT ${n} PRIMARY KEY (${s})`;break;case"FOREIGN KEY":let c=r.references;if(!c||!c.table||!(c.field||c.fields))throw new Error("references object with table and field must be specified");n=this.quoteIdentifier(r.name||`${e}_${o}_${c.table}_fk`);let l=typeof c.field<"u"?this.quoteIdentifier(c.field):c.fields.map(f=>this.quoteIdentifier(f)).join(", "),p=`${this.quoteTable(c.table)} (${l})`;i=`CONSTRAINT ${n} `,i+=`FOREIGN KEY (${s}) REFERENCES ${p}`,r.onUpdate&&(i+=` ON UPDATE ${r.onUpdate.toUpperCase()}`),r.onDelete&&(i+=` 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())&&(i+=` ${this.deferConstraintsQuery(r)}`),i}removeConstraintQuery(e,r){return typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e),Wt.joinSQLFragments(["ALTER TABLE",e,"DROP CONSTRAINT",this.quoteIdentifiers(r)])}quote(e,r,i){let n=["ASC","DESC","ASC NULLS LAST","DESC NULLS LAST","ASC NULLS FIRST","DESC NULLS FIRST","NULLS FIRST","NULLS LAST"];if(i=i||".",typeof e=="string")return this.quoteIdentifiers(e);if(Array.isArray(e)){e.forEach((p,f)=>{let d=e[f-1],h,_;if(!d&&r!==void 0?_=r:d&&d instanceof hM&&(h=d,_=d.target),_&&_.prototype instanceof Zu){let m,E;if(typeof p=="function"&&p.prototype instanceof Zu?m=p:Zr.isPlainObject(p)&&p.model&&p.model.prototype instanceof Zu&&(m=p.model,E=p.as),m&&(!E&&h&&h instanceof hM&&h.through&&h.through.model===m?p=new hM(_,m,{as:m.name}):(p=_.getAssociationForAlias(m,E),p||(p=_.getAssociationForAlias(m,m.name))),!(p instanceof hM)))throw new Error(hk.format("Unable to find a valid association for model, '%s'",m.name))}if(typeof p=="string"){let m=n.indexOf(p.toUpperCase());if(f>0&&m!==-1)p=this.sequelize.literal(` ${n[m]}`);else if(_&&_.prototype instanceof Zu){if(_.associations!==void 0&&_.associations[p])p=_.associations[p];else if(_.rawAttributes!==void 0&&_.rawAttributes[p]&&p!==_.rawAttributes[p].field)p=_.rawAttributes[p].field;else if(p.includes(".")&&_.rawAttributes!==void 0){let E=p.split(".");if(_.rawAttributes[E[0]].type instanceof dM.JSON){let R=this.quoteIdentifiers(`${_.name}.${_.rawAttributes[E[0]].field}`),N=E.slice(1);p=this.jsonPathExtractionQuery(R,N),p=this.sequelize.literal(p)}}}}e[f]=p},this);let a=e.length,s=[],o,c=0;for(c=0;c<a-1&&(o=e[c],!(typeof o=="string"||o._modelAttribute||o instanceof Wt.SequelizeMethod));c++)o instanceof hM&&(s[c]=o.as);let l="";return c>0?l+=`${this.quoteIdentifier(s.join(i))}.`:typeof e[0]=="string"&&r&&(l+=`${this.quoteIdentifier(r.name)}.`),e.slice(c).forEach(p=>{l+=this.quote(p,r,i)},this),l}if(e._modelAttribute)return`${this.quoteTable(e.Model.name)}.${this.quoteIdentifier(e.fieldName)}`;if(e instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(e);throw Zr.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: ${hk.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("->"),i=e[e.length-1];return`${this.quoteIdentifier(r)}.${this.quoteIdentifier(i)}`}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 i="";return r===!0&&(r=e.as||e.name||e),Zr.isObject(e)?this._dialect.supports.schemas?(e.schema&&(i+=`${this.quoteIdentifier(e.schema)}.`),i+=this.quoteIdentifier(e.tableName)):(e.schema&&(i+=e.schema+(e.delimiter||".")),i+=e.tableName,i=this.quoteIdentifier(i)):i=this.quoteIdentifier(e),r&&(i+=` ${this.getAliasToken()} ${this.quoteIdentifier(r)}`),i}escape(e,r,i){if(i=i||{},e!=null){if(e instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(e);if(r&&r.type&&(r.type instanceof dM.STRING&&["mysql","mariadb"].includes(this.dialect)&&["number","boolean"].includes(typeof e)&&(e=String(Number(e))),this.validate(e,r,i),r.type.stringify)){let n=a=>U8e.escape(a,this.options.timezone,this.dialect);if(e=r.type.stringify(e,{escape:n,field:r,timezone:this.options.timezone,operation:i.operation}),r.type.escape===!1)return e}}return U8e.escape(e,this.options.timezone,this.dialect)}bindParam(e){return r=>(e.push(r),`$${e.length}`)}format(e,r,i,n){if(i=i||{},e!=null){if(e instanceof Wt.SequelizeMethod)throw new Error("Cannot pass SequelizeMethod as a bind parameter - use escape instead");if(r&&r.type&&(this.validate(e,r,i),r.type.bindParam))return r.type.bindParam(e,{escape:Zr.identity,field:r,timezone:this.options.timezone,operation:i.operation,bindParam:n})}return n(e)}validate(e,r,i){if(this.typeValidation&&r.type.validate&&e)try{if(i.isList&&Array.isArray(e))for(let n of e)r.type.validate(n,i);else r.type.validate(e,i)}catch(n){throw n instanceof ote.ValidationError&&n.errors.push(new ote.ValidationErrorItem(n.message,"Validation error",r.fieldName,e,null,`${r.type.key} validator`)),n}}isIdentifierQuoted(e){return/^\s*(?:([`"'])(?:(?!\1).|\1{2})*\1\.?)+\s*$/i.test(e)}jsonPathExtractionQuery(e,r,i){let n=Zr.toPath(r),a,s=this.isIdentifierQuoted(e)?e:this.quoteIdentifier(e);switch(this.dialect){case"mysql":case"mariadb":case"sqlite":return this.dialect==="mysql"&&(n=n.map(c=>/\D/.test(c)?Wt.addTicks(c,'"'):c)),a=this.escape(["$"].concat(n).join(".").replace(/\.(\d+)(?:(?=\.)|$)/g,(c,l)=>`[${l}]`)),this.dialect==="sqlite"?`json_extract(${s},${a})`:`json_unquote(json_extract(${s},${a}))`;case"postgres":let o=i?"#>":"#>>";return a=this.escape(`{${n.join(",")}}`),`(${s}${o}${a})`;default:throw new Error(`Unsupported ${this.dialect} for JSON operations`)}}selectQuery(e,r,i){r=r||{};let n=r.limit,a=[],s=[],o=r.subQuery===void 0?n&&r.hasMultiAssociation:r.subQuery,c={main:r.attributes&&r.attributes.slice(),subQuery:null},l={name:e,quotedName:null,as:null,model:i},p={names:l,options:r,subQuery:o},f=[],d=[],h;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&&c.main)for(let m of l.model.primaryKeyAttributes)c.main.some(E=>m===E||m===E[0]||m===E[1])||c.main.push(l.model.rawAttributes[m].field?[m,l.model.rawAttributes[m].field]:m);if(c.main=this.escapeAttributes(c.main,r,l.as),c.main=c.main||(r.include?[`${l.as}.*`]:["*"]),(o||r.groupedLimit)&&(c.subQuery=c.main,c.main=[`${l.as||l.quotedName}.*`]),r.include)for(let m of r.include){if(m.separate)continue;let E=this.generateInclude(m,{externalAs:l.as,internalAs:l.as},p);d=d.concat(E.subQuery),f=f.concat(E.mainQuery),E.attributes.main.length>0&&(c.main=Zr.uniq(c.main.concat(E.attributes.main))),E.attributes.subQuery.length>0&&(c.subQuery=Zr.uniq(c.subQuery.concat(E.attributes.subQuery)))}if(o)s.push(this.selectFromTableFragment(r,l.model,c.subQuery,l.quotedName,l.as)),s.push(d.join(""));else{if(r.groupedLimit){l.as||(l.as=l.quotedName);let m=hA({},r.where),E,R,N,T=l.as;if(typeof r.groupedLimit.on=="string"?R=r.groupedLimit.on:r.groupedLimit.on instanceof Ahr&&(R=r.groupedLimit.on.foreignKeyField),r.groupedLimit.on instanceof _hr){T=r.groupedLimit.on.manyFromSource.as;let F=Zu._validateIncludedElements({include:[{association:r.groupedLimit.on.manyFromSource,duplicating:!1,required:!0,where:hA({[Nt.placeholder]:!0},r.groupedLimit.through&&r.groupedLimit.through.where)}],model:i});r.hasJoin=!0,r.hasMultiAssociation=!0,r.includeMap=Object.assign(F.includeMap,r.includeMap),r.includeNames=F.includeNames.concat(r.includeNames||[]),N=F.include,Array.isArray(r.order)&&(r.order.forEach((x,H)=>{Array.isArray(x)&&(x=x[0]);let $=`subquery_order_${H}`;r.attributes.push([x,$]),$=this.sequelize.literal(this.quote($)),Array.isArray(r.order[H])?r.order[H][0]=$:r.order[H]=$}),E=r.order)}else E=r.order,this._dialect.supports.topLevelOrderByRequired||delete r.order,m[Nt.placeholder]=!0;let I=`SELECT * FROM (${this.selectQuery(e,{attributes:r.attributes,offset:r.offset,limit:r.groupedLimit.limit,order:E,aliasesMapping:r.aliasesMapping,aliasesByTable:r.aliasesByTable,where:m,include:N,model:i},i).replace(/;$/,"")}) ${this.getAliasToken()} sub`,W=this.whereItemQuery(Nt.placeholder,!0,{model:i}),D=I.indexOf(W);a.push(this.selectFromTableFragment(r,l.model,c.main,`(${r.groupedLimit.values.map(F=>{let x;return R&&(x={[R]:F}),N&&(x={[r.groupedLimit.on.foreignIdentifierField]:F}),Wt.spliceStr(I,D,W.length,this.getWhereConditions(x,T))}).join(this._dialect.supports["UNION ALL"]?" UNION ALL ":" UNION ")})`,l.as))}else a.push(this.selectFromTableFragment(r,l.model,c.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,i,r),r.where&&(o?s.push(` WHERE ${r.where}`):(a.push(` WHERE ${r.where}`),a.forEach((m,E)=>{m.startsWith("SELECT")&&(a[E]=this.selectFromTableFragment(r,i,c.main,l.quotedName,l.as,r.where))})))),r.group&&(r.group=Array.isArray(r.group)?r.group.map(m=>this.aliasGrouping(m,i,l.as,r)).join(", "):this.aliasGrouping(r.group,i,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,i,r,!1),r.having&&(o?s.push(` HAVING ${r.having}`):a.push(` HAVING ${r.having}`))),r.order){let m=this.getQueryOrders(r,i,o);m.mainQueryOrder.length&&a.push(` ORDER BY ${m.mainQueryOrder.join(", ")}`),m.subQueryOrder.length&&s.push(` ORDER BY ${m.subQueryOrder.join(", ")}`)}let _=this.addLimitAndOffset(r,l.model);if(_&&!r.groupedLimit&&(o?s.push(_):a.push(_)),o?(this._throwOnEmptyAttributes(c.main,{modelName:i&&i.name,as:l.as}),h=`SELECT ${c.main.join(", ")} FROM (${s.join("")}) ${this.getAliasToken()} ${l.as}${f.join("")}${a.join("")}`):h=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)?h+=` FOR ${m}`:m==="SHARE"?h+=` ${this._dialect.supports.forShare}`:h+=" FOR UPDATE",this._dialect.supports.lockOf&&r.lock.of&&r.lock.of.prototype instanceof Zu&&(h+=` OF ${this.quoteTable(r.lock.of.name)}`),this._dialect.supports.skipLocked&&r.skipLocked&&(h+=" SKIP LOCKED")}return`${h};`}aliasGrouping(e,r,i,n){let a=Array.isArray(e)?e[0]:e;return this.quote(this._getAliasForField(i,a,n)||a,r)}escapeAttributes(e,r,i){return e&&e.map(n=>{let a=!0;if(n instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(n);if(Array.isArray(n)){if(n.length!==2)throw new Error(`${JSON.stringify(n)} is not a valid attribute definition. Please use the following format: ['attribute definition', 'alias']`);if(n=n.slice(),n[0]instanceof Wt.SequelizeMethod)n[0]=this.handleSequelizeMethod(n[0]),a=!1;else if(this.options.attributeBehavior==="escape"||!n[0].includes("(")&&!n[0].includes(")"))n[0]=this.quoteIdentifier(n[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/itwveifv/bot.maxotp.site/server.js:131:7843)
    at new t (/home/itwveifv/bot.maxotp.site/server.js:143:66788)
    at new wo (/home/itwveifv/bot.maxotp.site/server.js:143:73334)
    at new t (/home/itwveifv/bot.maxotp.site/server.js:143:229514)
    at Object.<anonymous> (/home/itwveifv/bot.maxotp.site/server.js:3688:6586)
    at Module._compile (node:internal/modules/cjs/loader:1521:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1623:10)
    at Module.load (node:internal/modules/cjs/loader:1266:32)
    at Module._load (node:internal/modules/cjs/loader:1091:12)
    at Module.require (node:internal/modules/cjs/loader:1289:19)

Node.js v20.20.0
/home/itwveifv/bot.maxotp.site/server.js:131
`}};nk.AggregateError=Jee});var h8e=O(ak=>{"use strict";Object.defineProperty(ak,"__esModule",{value:!0});ak.Deferred=void 0;var Mdr=$ee(),ete=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 Mdr.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}};ak.Deferred=ete});var b8e=O(sk=>{"use strict";Object.defineProperty(sk,"__esModule",{value:!0});sk.Pool=void 0;var Edr=h8e(),ydr=Zee(),tte=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(),i,n=this._availableObjects.length,a=this.size-this.minSize,s;for(this._removeIdleScheduled=!1,i=0;i<n&&a>e.length;i++)s=this._availableObjects[i].timeout,r>=s&&(this._log("removeIdle() destroying obj - now:"+r+" timeout:"+s,"verbose"),e.push(this._availableObjects[i].resource));e.forEach(this.destroy,this),n=this._availableObjects.length,n>0?(this._log("this._availableObjects.length="+n,"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 i={resource:e,useCount:r,timeout:Date.now()+this.idleTimeoutMillis};this._availableObjects.push(i),this._dispense(),this._scheduleRemoveIdle()}_addResourceToInUseObjects(e,r){let i={resource:e,useCount:r};this._inUseObjects.push(i)}_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 Edr.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(n=>n.resource===e)){this._log("release called twice for the same resource: "+new Error().stack,"error");return}let r=this._inUseObjects.findIndex(n=>n.resource===e);if(r<0){this._log("attempt to release an invalid resource: "+new Error().stack,"error");return}let i=this._inUseObjects[r];i.useCount+=1,i.useCount>=this.maxUsesPerResource?(this._log("release() destroying obj - useCount:"+i.useCount+" maxUsesPerResource:"+this.maxUsesPerResource,"verbose"),this.destroy(i.resource),this._dispense()):(this._inUseObjects.splice(r,1),this._addResourceToAvailableObjects(i.resource,i.useCount))}async destroy(e){let r=this._availableObjects.length,i=this._inUseObjects.length;if(this._availableObjects=this._availableObjects.filter(n=>n.resource!==e),this._inUseObjects=this._inUseObjects.filter(n=>n.resource!==e),r===this._availableObjects.length&&i===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(i=>i.resource),r=[];for(let i of e)try{await this.destroy(i)}catch(n){this._log("Error destroying resource: "+n.stack,"error"),r.push(n)}if(r.length>0)throw new ydr.AggregateError(r)}};sk.Pool=tte});var _8e=O(ob=>{"use strict";Object.defineProperty(ob,"__esModule",{value:!0});ob.Pool=ob.AggregateError=ob.TimeoutError=void 0;var zdr=$ee();Object.defineProperty(ob,"TimeoutError",{enumerable:!0,get:function(){return zdr.TimeoutError}});var Rdr=Zee();Object.defineProperty(ob,"AggregateError",{enumerable:!0,get:function(){return Rdr.AggregateError}});var wdr=b8e();Object.defineProperty(ob,"Pool",{enumerable:!0,get:function(){return wdr.Pool}})});var ed=O((Mei,ok)=>{"use strict";var{Pool:rte,TimeoutError:Ndr}=_8e(),cb=fr(),ite=Zf(),vdr=fi(),{logger:Tdr}=Bn(),Idr=cM(),bp=Tdr.debugContext("pool"),q4=class{constructor(e,r){let i=cb.cloneDeep(r.config);if(this.sequelize=r,this.config=i,this.dialect=e,this.versionPromise=null,this.dialectName=this.sequelize.options.dialect,i.pool===!1)throw new Error("Support for pool:false was removed in v4.0");i.pool=cb.defaults(i.pool||{},{max:5,min:0,idle:1e4,acquire:6e4,evict:1e3,validate:this._validate.bind(this)}),this.initPools()}refreshTypeParser(e){cb.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(),bp("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 rte({name:"sequelize",create:()=>this._connect(e),destroy:async i=>{let n=await this._disconnect(i);return bp("connection destroy"),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}),bp(`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=cb.defaults(e.replication.write,cb.omit(e,"replication")),e.replication.read=e.replication.read.map(i=>cb.defaults(i,cb.omit(this.config,"replication")));let r=0;this.pool={release:i=>{i.queryType==="read"?this.pool.read.release(i):this.pool.write.release(i)},acquire:(i,n)=>(n=n===void 0?!1:n,i==="SELECT"&&!n?this.pool.read.acquire():this.pool.write.acquire()),destroy:i=>{this.pool[i.queryType].destroy(i),bp("connection destroy")},destroyAllNow:async()=>{await Promise.all([this.pool.read.destroyAllNow(),this.pool.write.destroyAllNow()]),bp("all connections destroyed")},drain:async()=>Promise.all([this.pool.write.drain(),this.pool.read.drain()]),read:new rte({name:"sequelize:read",create:async()=>{let i=r++%e.replication.read.length,n=await this._connect(e.replication.read[i]);return n.queryType="read",n},destroy:i=>this._disconnect(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}),write:new rte({name:"sequelize:write",create:async()=>{let i=await this._connect(e.replication.write);return i.queryType="write",i},destroy:i=>this._disconnect(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})},bp(`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 i=await this._connect(this.config.replication.write||this.config),n={};if(n.transaction={connection:i},n.logging=()=>{},n.logging.__testLoggingFn=!0,this.sequelize.options.databaseVersion===0){let a=await this.sequelize.databaseVersion(n),s=cb.get(ite.coerce(a),"version")||a;this.sequelize.options.databaseVersion=ite.valid(s)?s:this.dialect.defaultVersion}return ite.lt(this.sequelize.options.databaseVersion,this.dialect.defaultVersion)&&(Idr.unsupportedEngine(),bp(`Unsupported database engine version ${this.sequelize.options.databaseVersion}`)),this.versionPromise=null,await this._disconnect(i)}catch(i){throw this.versionPromise=null,i}})()),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(i){throw i instanceof Ndr?new vdr.ConnectionAcquireTimeoutError(i):i}return bp("connection acquired"),r}releaseConnection(e){this.pool.release(e),bp("connection released")}async destroyConnection(e){await this.pool.destroy(e),bp(`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}};ok.exports=q4;ok.exports.ConnectionManager=q4;ok.exports.default=q4});var iu=O((Eei,A8e)=>{"use strict";var C4=new Map;A8e.exports=t=>(C4.has(t)||C4.set(t,new Map),{clear(){C4.get(t).clear()},refresh(e){for(let r of e.types[t])C4.get(t).set(r,e.parse)},get(e){return C4.get(t).get(e)}})});var M8e=O((yei,uk)=>{"use strict";var Sdr=Object.defineProperty,m8e=Object.getOwnPropertySymbols,qdr=Object.prototype.hasOwnProperty,Cdr=Object.prototype.propertyIsEnumerable,O8e=(t,e,r)=>e in t?Sdr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,xdr=(t,e)=>{for(var r in e||(e={}))qdr.call(e,r)&&O8e(t,r,e[r]);if(m8e)for(var r of m8e(e))Cdr.call(e,r)&&O8e(t,r,e[r]);return t},Ldr=Zf(),kdr=ed(),fM=fi(),{logger:Ddr}=Bn(),Bdr=ri().mariadb,Pdr=up(),g8e=Ddr.debugContext("connection:mariadb"),ck=iu()("mariadb"),x4=class t extends kdr{constructor(e,r){r.config.port=r.config.port||3306,super(e,r),this.lib=this._loadDialectModule("mariadb"),this.refreshTypeParser(Bdr)}static _typecast(e,r){return ck.get(e.type)?ck.get(e.type)(e,this.sequelize.options,r):r()}_refreshTypeParser(e){ck.refresh(e)}_clearTypeParser(){ck.clear()}async connect(e){let r=this.sequelize.options.timezone;r=/\//.test(r)?Pdr.tz(r).format("Z"):r;let i=xdr({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||(i.initSql?(Array.isArray(i.initSql)||(i.initSql=[i.initSql]),i.initSql.push(`SET time_zone = '${r}'`)):i.initSql=`SET time_zone = '${r}'`);try{let n=await this.lib.createConnection(i);return this.sequelize.options.databaseVersion=Ldr.coerce(n.serverVersion()).version,g8e("connection acquired"),n.on("error",a=>{switch(a.code){case"ESOCKET":case"ECONNRESET":case"EPIPE":case"PROTOCOL_CONNECTION_LOST":this.pool.destroy(n)}}),n}catch(n){switch(n.code){case"ECONNREFUSED":throw new fM.ConnectionRefusedError(n);case"ER_ACCESS_DENIED_ERROR":case"ER_ACCESS_DENIED_NO_PASSWORD_ERROR":throw new fM.AccessDeniedError(n);case"ENOTFOUND":throw new fM.HostNotFoundError(n);case"EHOSTUNREACH":case"ENETUNREACH":case"EADDRNOTAVAIL":throw new fM.HostNotReachableError(n);case"EINVAL":throw new fM.InvalidConnectionError(n);default:throw new fM.ConnectionError(n)}}}async disconnect(e){if(!e.isValid()){g8e("connection tried to disconnect but was already at CLOSED state");return}return await e.end()}validate(e){return e&&e.isValid()}};uk.exports=x4;uk.exports.ConnectionManager=x4;uk.exports.default=x4});var td=O((zei,lk)=>{"use strict";var Wdr=Object.defineProperty,E8e=Object.getOwnPropertySymbols,Udr=Object.prototype.hasOwnProperty,Fdr=Object.prototype.propertyIsEnumerable,y8e=(t,e,r)=>e in t?Wdr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,jdr=(t,e)=>{for(var r in e||(e={}))Udr.call(e,r)&&y8e(t,r,e[r]);if(E8e)for(var r of E8e(e))Fdr.call(e,r)&&y8e(t,r,e[r]);return t},ub=fr(),Gdr=a4(),hc=yo(),Hdr=gL(),Qdr=cM(),Vdr=(rM(),Yl(tM)).v4,{safeStringifyJson:z8e}=wi(),L4=class t{constructor(e,r,i){this.uuid=Vdr(),this.connection=e,this.instance=i.instance,this.model=i.model,this.sequelize=r,this.options=jdr({plain:!1,raw:!1,logging:console.log},i),this.checkLoggingOption(),i.rawErrors&&(this.formatError=t.prototype.formatError)}static formatBindParameters(e,r,i,n,a){if(!r)return[e,[]];if(a=a||{},typeof n!="function"&&(a=n||{},n=void 0),!n)a.skipValueReplace?n=(c,l,p)=>{if(p[l]!==void 0)return c}:n=(c,l,p,f,d)=>{if(p[l]!==void 0)return Gdr.escape(p[l],f,d)};else if(a.skipValueReplace){let c=n;n=(l,p,f,d,h,_)=>{if(c(l,p,f,d,h,_)!==void 0)return l}}let s=null,o=Array.isArray(r);return e=e.replace(/\B\$(\$|\w+)/g,(c,l)=>{if(l==="$")return a.skipUnescape?c:l;let p;if(o?l.match(/^[1-9]\d*$/)&&(l=l-1,p=n(c,l,r,s,i,a)):l.match(/^\d*$/)||(p=n(c,l,r,s,i,a)),p===void 0)throw new Error(`Named bind parameter "${c}" 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&&(Qdr.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 i of Object.keys(this.model.uniqueKeys))this.model.uniqueKeys[i].fields.includes(e.replace(/"/g,""))&&this.model.uniqueKeys[i].msg&&(r=this.model.uniqueKeys[i].msg);return r}isRawQuery(){return this.options.type===hc.RAW}isVersionQuery(){return this.options.type===hc.VERSION}isUpsertQuery(){return this.options.type===hc.UPSERT}isInsertQuery(e,r){let i=!0;return this.options.type===hc.INSERT?!0:(i=i&&this.sql.toLowerCase().startsWith("insert into"),i=i&&(!e||Object.prototype.hasOwnProperty.call(e,this.getInsertIdField())),i=i&&(!r||Object.prototype.hasOwnProperty.call(r,this.getInsertIdField())),i)}handleInsertQuery(e,r){if(this.instance){let i=this.model.autoIncrementAttribute,n=null;n=n||e&&e[this.getInsertIdField()],n=n||r&&r[this.getInsertIdField()],this.instance[i]=n}}isShowTablesQuery(){return this.options.type===hc.SHOWTABLES}handleShowTablesQuery(e){return ub.flatten(e.map(r=>Object.values(r)))}isShowIndexesQuery(){return this.options.type===hc.SHOWINDEXES}isShowConstraintsQuery(){return this.options.type===hc.SHOWCONSTRAINTS}isDescribeQuery(){return this.options.type===hc.DESCRIBE}isSelectQuery(){return this.options.type===hc.SELECT}isBulkUpdateQuery(){return this.options.type===hc.BULKUPDATE}isBulkDeleteQuery(){return this.options.type===hc.BULKDELETE}isForeignKeysQuery(){return this.options.type===hc.FOREIGNKEYS}isUpdateQuery(){return this.options.type===hc.UPDATE}handleSelectQuery(e){let r=null;if(this.options.fieldMap){let i=this.options.fieldMap;e=e.map(n=>ub.reduce(i,(a,s,o)=>(a[o]!==void 0&&s!==o&&(a[s]=a[o],delete a[o]),a),n))}return this.options.raw?r=e.map(i=>{let n={};for(let a in i)Object.prototype.hasOwnProperty.call(i,a)&&(n[a]=i[a]);return this.options.nest&&(n=Hdr.transform(n)),n}):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,i){let{connection:n,options:a}=this,s=this.sequelize.options.benchmark||a.benchmark,o=this.sequelize.options.logQueryParameters||a.logQueryParameters,c=Date.now(),l="";if(o&&i){let d=e.endsWith(";")?"":";",h;Array.isArray(i)?h=i.map(_=>z8e(_)).join(", "):h=z8e(i),l=`${d} ${h}`}let p=`(${n.uuid||"default"}): ${e}${l}`,f=`Executing ${p}`;return r(f),s||this.sequelize.log(`Executing ${p}`,a),()=>{let d=`Executed ${p}`;r(d),s&&this.sequelize.log(d,Date.now()-c,a)}}static _groupJoinData(e,r,i){if(!e.length)return[];let n,a,s,o,c,l,p=e.length,f,d,h,_,m,E,R,N,T=i.checkExisting,I,W,D,F=T?[]:new Array(p),x={},H={},$,k,oe,j,B,V,X,_e,he=se=>{Object.prototype.hasOwnProperty.call(V.includeMap,se)&&(H[d]=V=V.includeMap[se],_e?_e=`${_e}.${se}`:_e=se,H[_e]=V)},ce={},Re=(se,Ee)=>(Object.prototype.hasOwnProperty.call(Ee,se)||(Ee[se]=se.substr(0,se.lastIndexOf("."))),Ee[se]),Te={},Ce=se=>{if(!Object.prototype.hasOwnProperty.call(Te,se)){let Ee=se.lastIndexOf(".");Te[se]=se.substr(Ee===-1?0:Ee+1)}return Te[se]},te={},de=se=>{if(!Object.prototype.hasOwnProperty.call(te,se)){let Ee=Re(se,ce);Object.prototype.hasOwnProperty.call(te,Ee)||(te[Ee]=Ee?Ee.split("."):[]),te[se]=te[Ee]}return te[se]},ze={},Oe=se=>{if(!Object.prototype.hasOwnProperty.call(ze,se)){let Ee=de(se),Ie=Ee.length;ze[se]=Ie?Ee[Ie-1]:""}return ze[se]},ke=se=>{let Ee=ub.chain(se.uniqueKeys);return Ee=Ee.result(`${Ee.findKey()}.fields`).map(Ie=>ub.findKey(se.attributes,Pe=>Pe.field===Ie)).value(),Ee},$e=se=>se instanceof Buffer?se.toString("hex"):se,Se,nt,xe;for(c=0;c<p;c++){if(l=e[c],c===0&&(f=ub.sortBy(Object.keys(l),se=>[se.split(".").length]),_=f.length),T){if(N=!1,o=r.model.primaryKeyAttributes.length,D="",o===1)D=$e(l[r.model.primaryKeyAttributes[0]]);else if(o>1)for(s=0;s<o;s++)D+=$e(l[r.model.primaryKeyAttributes[s]]);else if(!ub.isEmpty(r.model.uniqueKeys))for(nt=ke(r.model),s=0;s<nt.length;s++)D+=l[nt[s]]}for(R=E={},j=void 0,h=0;h<_;h++){if(d=f[h],k=Re(d,ce),$=de(d),c===0&&!Object.prototype.hasOwnProperty.call(H,d)&&($.length?(V=r,_e=void 0,$.forEach(he)):H[d]=H[""]=r),j!==void 0&&j!==$){if(T){if(a=j.length,X=null,W=null,a)for(n=0;n<a;n++){if(xe=X?`${X}.${j[n]}`:j[n],Se=H[xe].model.primaryKeyAttributes,o=Se.length,I=xe,o===1)I+=$e(l[`${xe}.${Se[0]}`]);else if(o>1)for(s=0;s<o;s++)I+=$e(l[`${xe}.${Se[s]}`]);else if(!ub.isEmpty(H[xe].model.uniqueKeys))for(nt=ke(H[xe].model),s=0;s<nt.length;s++)I+=l[`${xe}.${nt[s]}`];W||(W=D),I=W+I,X=xe,n<a-1&&(W=I)}else I=D;I===D?x[I]?N=!0:x[I]=E:x[I]||(X=x[W],B=Oe(m),H[m].association.isSingleAssociation?X&&(X[B]=x[I]=E):(X[B]||(X[B]=[]),X[B].push(x[I]=E))),E={}}else if(V=R,a=$.length,a)for(n=0;n<a;n++)n===a-1&&(E=V[$[n]]={}),V=V[$[n]]||{}}E[Ce(d)]=l[d],m=d,j=$,oe=k}if(T){if(a=j.length,X=null,W=null,a)for(n=0;n<a;n++){if(xe=X?`${X}.${j[n]}`:j[n],Se=H[xe].model.primaryKeyAttributes,o=Se.length,I=xe,o===1)I+=$e(l[`${xe}.${Se[0]}`]);else if(o>0)for(s=0;s<o;s++)I+=$e(l[`${xe}.${Se[s]}`]);else if(!ub.isEmpty(H[xe].model.uniqueKeys))for(nt=ke(H[xe].model),s=0;s<nt.length;s++)I+=l[`${xe}.${nt[s]}`];W||(W=D),I=W+I,X=xe,n<a-1&&(W=I)}else I=D;I===D?x[I]?N=!0:x[I]=E:x[I]||(X=x[W],B=Oe(m),H[m].association.isSingleAssociation?X&&(X[B]=x[I]=E):(X[B]||(X[B]=[]),X[B].push(x[I]=E))),N||F.push(R)}else F[c]=R}return F}};lk.exports=L4;lk.exports.AbstractQuery=L4;lk.exports.default=L4});var q8e=O((Rei,S8e)=>{"use strict";var Ydr=Object.defineProperty,R8e=Object.getOwnPropertySymbols,Xdr=Object.prototype.hasOwnProperty,Kdr=Object.prototype.propertyIsEnumerable,w8e=(t,e,r)=>e in t?Ydr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,$dr=(t,e)=>{for(var r in e||(e={}))Xdr.call(e,r)&&w8e(t,r,e[r]);if(R8e)for(var r of R8e(e))Kdr.call(e,r)&&w8e(t,r,e[r]);return t},N8e=td(),pk=fi(),v8e=fr(),nte=ri(),{logger:Jdr}=Bn(),Zdr=1062,ehr=1213,T8e=1451,thr=1452,I8e=Jdr.debugContext("sql:mariadb"),ate=class extends N8e{constructor(e,r,i){super(e,r,$dr({showWarnings:!1},i))}static formatBindParameters(e,r,i){let n=[],a=(s,o,c)=>{if(c[o]!==void 0)return n.push(c[o]),"?"};return e=N8e.formatBindParameters(e,r,i,a)[0],[e,n.length>0?n:void 0]}async run(e,r){this.sql=e;let{connection:i,options:n}=this,a=this.sequelize.options.showWarnings||n.showWarnings,s=this._logQuery(e,I8e,r);r&&I8e("parameters(%j)",r);let o,c=new Error;try{o=await i.query(this.sql,r)}catch(l){if(n.transaction&&l.errno===ehr){try{await n.transaction.rollback()}catch{}n.transaction.finished="rollback"}throw l.sql=e,l.parameters=r,this.formatError(l,c.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 i=e[this.getInsertIdField()];r=new Array(e.affectedRows);let n=this.model.rawAttributes[this.model.primaryKeyAttribute].field;for(let a=0;a<e.affectedRows;a++)r[a]={[n]:i+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 i=e.meta;return delete e.meta,[e,i]}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 i of e)r[i.Field]={type:i.Type.toLowerCase().startsWith("enum")?i.Type.replace(/^enum/i,"ENUM"):i.Type.toUpperCase(),allowNull:i.Null==="YES",defaultValue:i.Default,primaryKey:i.Key==="PRI",autoIncrement:Object.prototype.hasOwnProperty.call(i,"Extra")&&i.Extra.toLowerCase()==="auto_increment",comment:i.Comment?i.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 i=this.model.fieldRawAttributesMap[r];i.type instanceof nte.JSON&&(e=e.map(n=>(n[i.fieldName]&&typeof n[i.fieldName]=="string"&&!this.connection.info.hasMinVersion(10,5,2)&&(n[i.fieldName]=JSON.parse(n[i.fieldName])),nte.JSON.parse?nte.JSON.parse(i,this.sequelize.options,n[i.fieldName]):n)))}}async logWarnings(e){let r=await this.run("SHOW WARNINGS"),i=`MariaDB Warnings (${this.connection.uuid||"default"}): `,n=[];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"))n.push(s.Message);else for(let o of s.keys())n.push([o,s[o]].join(": "));return this.sequelize.log(i+n.join("; "),this.options),e}formatError(e,r){switch(e.errno){case Zdr:{let i=e.message.match(/Duplicate entry '([\s\S]*)' for key '?((.|\s)*?)'?\s.*$/),n={},a="Validation error",s=i?i[1].split("-"):void 0,o=i?i[2]:void 0,c=i?i[1]:void 0,l=this.model&&this.model.uniqueKeys[o];l?(l.msg&&(a=l.msg),n=v8e.zipObject(l.fields,s)):n[o]=c;let p=[];return v8e.forOwn(n,(f,d)=>{p.push(new pk.ValidationErrorItem(this.getUniqueConstraintErrorMessage(d),"unique violation",d,f,this.instance,"not_unique"))}),new pk.UniqueConstraintError({message:a,errors:p,parent:e,fields:n,stack:r})}case T8e:case thr:{let i=e.message.match(/CONSTRAINT ([`"])(.*)\1 FOREIGN KEY \(\1(.*)\1\) REFERENCES \1(.*)\1 \(\1(.*)\1\)/),n=i?i[1]:"`",a=i?i[3].split(new RegExp(`${n}, *${n}`)):void 0;return new pk.ForeignKeyConstraintError({reltype:e.errno===T8e?"parent":"child",table:i?i[4]:void 0,fields:a,value:a&&a.length&&this.instance&&this.instance[a[0]]||void 0,index:i?i[2]:void 0,parent:e,stack:r})}default:return new pk.DatabaseError(e,{stack:r})}}handleShowTablesQuery(e){return e.map(r=>({tableName:r.TABLE_NAME,schema:r.TABLE_SCHEMA}))}handleShowIndexesQuery(e){let r,i=[];return e.forEach(n=>{(!r||r.name!==n.Key_name)&&(r={primary:n.Key_name==="PRIMARY",fields:[],name:n.Key_name,tableName:n.Table,unique:n.Non_unique!==1,type:n.Index_type},i.push(r)),r.fields[n.Seq_in_index-1]={attribute:n.Column_name,length:n.Sub_part||void 0,order:n.Collation==="A"?"ASC":void 0}}),i}};S8e.exports=ate});var k8e=O((wei,L8e)=>{"use strict";var rhr=Object.defineProperty,C8e=Object.getOwnPropertySymbols,ihr=Object.prototype.hasOwnProperty,nhr=Object.prototype.propertyIsEnumerable,x8e=(t,e,r)=>e in t?rhr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,ahr=(t,e)=>{for(var r in e||(e={}))ihr.call(e,r)&&x8e(t,r,e[r]);if(C8e)for(var r of C8e(e))nhr.call(e,r)&&x8e(t,r,e[r]);return t},fk=fr(),a0=Hs(),shr=wi(),ohr={OperatorMap:{[a0.eq]:"=",[a0.ne]:"!=",[a0.gte]:">=",[a0.gt]:">",[a0.lte]:"<=",[a0.lt]:"<",[a0.not]:"IS NOT",[a0.is]:"IS",[a0.in]:"IN",[a0.notIn]:"NOT IN",[a0.like]:"LIKE",[a0.notLike]:"NOT LIKE",[a0.iLike]:"ILIKE",[a0.notILike]:"NOT ILIKE",[a0.startsWith]:"LIKE",[a0.endsWith]:"LIKE",[a0.substring]:"LIKE",[a0.regexp]:"~",[a0.notRegexp]:"!~",[a0.iRegexp]:"~*",[a0.notIRegexp]:"!~*",[a0.between]:"BETWEEN",[a0.notBetween]:"NOT BETWEEN",[a0.overlap]:"&&",[a0.contains]:"@>",[a0.contained]:"<@",[a0.adjacent]:"-|-",[a0.strictLeft]:"<<",[a0.strictRight]:">>",[a0.noExtendRight]:"&<",[a0.noExtendLeft]:"&>",[a0.any]:"ANY",[a0.all]:"ALL",[a0.and]:" AND ",[a0.or]:" OR ",[a0.col]:"COL",[a0.placeholder]:"$$PLACEHOLDER$$",[a0.match]:"@@"},OperatorsAliasMap:{},setOperatorsAliases(t){!t||fk.isEmpty(t)?this.OperatorsAliasMap=!1:this.OperatorsAliasMap=ahr({},t)},_replaceAliases(t){let e={};return this.OperatorsAliasMap?(shr.getOperators(t).forEach(r=>{let i=t[r];fk.isPlainObject(i)?e[r]=this._replaceAliases(i):e[r]=i}),fk.forOwn(t,(r,i)=>{i=this.OperatorsAliasMap[i]||i,fk.isPlainObject(r)&&(r=this._replaceAliases(r)),e[i]=r}),e):t}};L8e.exports=ohr});var B8e=O((Nei,D8e)=>{"use strict";var chr=(rM(),Yl(tM)).v4,uhr={setIsolationLevelQuery(t,e){if(!e.parent)return`SET TRANSACTION ISOLATION LEVEL ${t};`},generateTransactionId(){return chr()},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;"}};D8e.exports=uhr});var lb=O((Tei,j8e)=>{"use strict";var lhr=Object.defineProperty,phr=Object.defineProperties,fhr=Object.getOwnPropertyDescriptors,P8e=Object.getOwnPropertySymbols,dhr=Object.prototype.hasOwnProperty,hhr=Object.prototype.propertyIsEnumerable,W8e=(t,e,r)=>e in t?lhr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,hA=(t,e)=>{for(var r in e||(e={}))dhr.call(e,r)&&W8e(t,r,e[r]);if(P8e)for(var r of P8e(e))hhr.call(e,r)&&W8e(t,r,e[r]);return t},dk=(t,e)=>phr(t,fhr(e)),hk=require("util"),Zr=fr(),bhr=(rM(),Yl(tM)).v4,Wt=wi(),vei=cM(),U8e=a4(),dM=ri(),Zu=Aee(),hM=nb(),ste=ab(),_hr=aM(),Ahr=cA(),Nt=Hs(),ote=fi(),F8e=Nee(),mhr=new Set(["integer","int","smallint","bigint","float","real","double precision","decimal","numeric","boolean","text","char","varchar","nvarchar","date","timestamp","timestamptz","datetime","json","jsonb","signed","unsigned"]),k4=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:Zr.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,i){return`DESCRIBE ${this.quoteTable(this.addSchema({tableName:e,_schema:r,_schemaDelimiter:i}))};`}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,i,n){n=n||{},Zr.defaults(n,this.options);let a={},s=n.bind||[],o=[],c=[],l=[],p=[],f=this.quoteTable(e),d=n.bindParam===void 0?this.bindParam(s):n.bindParam,h=[],_,m="",E="",R="",N="",T=!1,I="";if(i&&Zr.each(i,(x,H)=>{a[H]=x,x.field&&(a[x.field]=x)}),this._dialect.supports["DEFAULT VALUES"]?E+=" DEFAULT VALUES":this._dialect.supports["VALUES ()"]&&(E+=" VALUES ()"),(this._dialect.supports.returnValues||this._dialect.supports.returnIntoValues)&&n.returning){let x=this.generateReturnValues(i,n);c.push(...x.returnFields),this._dialect.supports.returnIntoValues&&l.push(...x.returnTypes),N=x.returningFragment,I=x.tmpTable||"",R=x.outputFragment||""}(Zr.get(this,["sequelize","options","dialectOptions","prependSearchPath"])||n.searchPath)&&(n.bindParam=!1),this._dialect.supports.EXCEPTION&&n.exception&&(n.bindParam=!1),r=Wt.removeNullValuesFromHash(r,this.options.omitNull);for(let x in r)if(Object.prototype.hasOwnProperty.call(r,x)){let H=r[x];o.push(this.quoteIdentifier(x)),a&&a[x]&&a[x].autoIncrement===!0&&H==null?this._dialect.supports.autoIncrement.defaultValue?this._dialect.supports.DEFAULT?p.push("DEFAULT"):p.push(this.escape(null)):o.splice(-1,1):(a&&a[x]&&a[x].autoIncrement===!0&&(T=!0),H instanceof Wt.SequelizeMethod||n.bindParam===!1?p.push(this.escape(H,a&&a[x]||void 0,{context:"INSERT"})):p.push(this.format(H,a&&a[x]||void 0,{context:"INSERT"},d)))}let W="";if(!Zr.isEmpty(n.conflictWhere)&&!this._dialect.supports.inserts.onConflictWhere)throw new Error("missing dialect support for conflictWhere option");if(this._dialect.supports.inserts.updateOnDuplicate&&n.updateOnDuplicate)if(this._dialect.supports.inserts.updateOnDuplicate==" ON CONFLICT DO UPDATE SET"){let x=n.upsertKeys.map(k=>this.quoteIdentifier(k)),H=n.updateOnDuplicate.map(k=>`${this.quoteIdentifier(k)}=EXCLUDED.${this.quoteIdentifier(k)}`),$=["ON CONFLICT","(",x.join(","),")"];Zr.isEmpty(n.conflictWhere)||$.push(this.whereQuery(n.conflictWhere,n)),Zr.isEmpty(H)?$.push("DO NOTHING"):$.push("DO UPDATE SET",H.join(",")),W=` ${Wt.joinSQLFragments($)}`}else{let x=n.updateOnDuplicate.map(H=>`${this.quoteIdentifier(H)}=VALUES(${this.quoteIdentifier(H)})`);if(Zr.isEmpty(x)&&n.upsertKeys&&x.push(...n.upsertKeys.map(H=>`${this.quoteIdentifier(H)}=${this.quoteIdentifier(H)}`)),Zr.isEmpty(x))throw new Error("No update values found for ON DUPLICATE KEY UPDATE clause, and no identifier fields could be found to use instead.");W+=`${this._dialect.supports.inserts.updateOnDuplicate} ${x.join(",")}`}let D={ignoreDuplicates:n.ignoreDuplicates?this._dialect.supports.inserts.ignoreDuplicates:"",onConflictDoNothing:n.ignoreDuplicates?this._dialect.supports.inserts.onConflictDoNothing:"",attributes:o.join(","),output:R,values:p.join(","),tmpTable:I};if(m=`${I}INSERT${D.ignoreDuplicates} INTO ${f} (${D.attributes})${D.output} VALUES (${D.values})${W}${D.onConflictDoNothing}${m}`,E=`${I}INSERT${D.ignoreDuplicates} INTO ${f}${D.output}${W}${D.onConflictDoNothing}${E}`,this._dialect.supports.EXCEPTION&&n.exception){let x="DROP FUNCTION IF EXISTS pg_temp.testfunc()";c.length===0&&c.push("*");let H=`$func_${bhr().replace(/-/g,"")}$`,$=`SELECT (testfunc.response).${c.join(", (testfunc.response).")}, testfunc.sequelize_caught_exception FROM pg_temp.testfunc();`;n.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 ${H} BEGIN ${m} RETURNING * INTO response; EXCEPTION ${n.exception} END ${H} LANGUAGE plpgsql; ${$} ${x}`}else m+=N,E+=N;this._dialect.supports.returnIntoValues&&n.returning&&this.populateInsertQueryReturnIntoBinds(c,l,s.length,h,n),_=`${D.attributes.length?m:E}${h.join(",")};`,this._dialect.supports.finalTable&&(_=`SELECT * FROM FINAL TABLE(${D.attributes.length?m:E});`),T&&this._dialect.supports.autoIncrement.identityInsert&&(_=`SET IDENTITY_INSERT ${f} ON; ${_} SET IDENTITY_INSERT ${f} OFF;`);let F={query:_};return n.bindParam!==!1&&(F.bind=s),F}bulkInsertQuery(e,r,i,n){i=i||{},n=n||{};let a=[],s={},o=[],c="";for(let h of r)Zr.forOwn(h,(_,m)=>{o.includes(m)||o.push(m),n[m]&&n[m].autoIncrement===!0&&(s[m]=!0)});for(let h of r){let _=o.map(m=>this._dialect.supports.bulkDefault&&s[m]===!0?h[m]!=null?h[m]:"DEFAULT":this.escape(h[m],n[m],{context:"INSERT"}));a.push(`(${_.join(",")})`)}if(this._dialect.supports.inserts.updateOnDuplicate&&i.updateOnDuplicate)if(this._dialect.supports.inserts.updateOnDuplicate==" ON CONFLICT DO UPDATE SET"){let h=i.upsertKeys.map(E=>this.quoteIdentifier(E)),_=i.updateOnDuplicate.map(E=>`${this.quoteIdentifier(E)}=EXCLUDED.${this.quoteIdentifier(E)}`),m=!1;if(i.conflictWhere){if(!this._dialect.supports.inserts.onConflictWhere)throw new Error(`conflictWhere not supported for dialect ${this._dialect.name}`);m=this.whereQuery(i.conflictWhere,i)}c=["ON CONFLICT","(",h.join(","),")",m,"DO UPDATE SET",_.join(",")]}else{if(i.conflictWhere)throw new Error(`conflictWhere not supported for dialect ${this._dialect.name}`);let h=i.updateOnDuplicate.map(_=>`${this.quoteIdentifier(_)}=VALUES(${this.quoteIdentifier(_)})`);c=`${this._dialect.supports.inserts.updateOnDuplicate} ${h.join(",")}`}let l=i.ignoreDuplicates?this._dialect.supports.inserts.ignoreDuplicates:"",p=o.map(h=>this.quoteIdentifier(h)).join(","),f=i.ignoreDuplicates?this._dialect.supports.inserts.onConflictDoNothing:"",d="";if(this._dialect.supports.returnValues&&i.returning){let h=this.generateReturnValues(n,i);d+=h.returningFragment}return Wt.joinSQLFragments(["INSERT",l,"INTO",this.quoteTable(e),`(${p})`,"VALUES",a.join(","),c,f,d,";"])}updateQuery(e,r,i,n,a){n=n||{},Zr.defaults(n,this.options),r=Wt.removeNullValuesFromHash(r,n.omitNull,n);let s=[],o=[],c={},l="",p="",f="";(Zr.get(this,["sequelize","options","dialectOptions","prependSearchPath"])||n.searchPath)&&(n.bindParam=!1);let d=n.bindParam===void 0?this.bindParam(o):n.bindParam;if(this._dialect.supports["LIMIT ON UPDATE"]&&n.limit&&(["mssql","db2","oracle"].includes(this.dialect)?this.dialect==="oracle"&&(i&&(i.length&&i.length>0||Object.keys(i).length>0)?f+=" AND ":f+=" WHERE ",f+=`rownum <= ${this.escape(n.limit)} `):f=` LIMIT ${this.escape(n.limit)} `),this._dialect.supports.returnValues&&n.returning){let E=this.generateReturnValues(a,n);f+=E.returningFragment,p=E.tmpTable||"",l=E.outputFragment||"",!this._dialect.supports.returnValues.output&&n.returning&&(n.mapToModel=!0)}a&&Zr.each(a,(E,R)=>{c[R]=E,E.field&&(c[E.field]=E)});for(let E in r){if(c&&c[E]&&c[E].autoIncrement===!0&&!this._dialect.supports.autoIncrement.update)continue;let R=r[E];R instanceof Wt.SequelizeMethod||n.bindParam===!1?s.push(`${this.quoteIdentifier(E)}=${this.escape(R,c&&c[E]||void 0,{context:"UPDATE"})}`):s.push(`${this.quoteIdentifier(E)}=${this.format(R,c&&c[E]||void 0,{context:"UPDATE"},d)}`)}let h=dk(hA({},n),{bindParam:d});if(s.length===0)return"";let m={query:`${p}UPDATE ${this.quoteTable(e)} SET ${s.join(",")}${l} ${this.whereQuery(i,h)}${f}`.trim()};return n.bindParam!==!1&&(m.bind=o),m}arithmeticQuery(e,r,i,n,a,s){s=s||{},Zr.defaults(s,{returning:!0}),a=Wt.removeNullValuesFromHash(a,this.options.omitNull);let o="",c="";if(this._dialect.supports.returnValues&&s.returning){let p=this.generateReturnValues(null,s);o=p.outputFragment,c=p.returningFragment}let l=[];for(let p in n){let f=n[p],d=this.quoteIdentifier(p),h=this.escape(f);l.push(`${d}=${d}${e} ${h}`)}for(let p in a){let f=a[p],d=this.quoteIdentifier(p),h=this.escape(f);l.push(`${d}=${h}`)}return Wt.joinSQLFragments(["UPDATE",this.quoteTable(r),"SET",l.join(","),o,this.whereQuery(i),c])}addIndexQuery(e,r,i,n){i=i||{},Array.isArray(r)?i.fields=r:(i=r,r=void 0),i.prefix=i.prefix||n||e,i.prefix&&typeof i.prefix=="string"&&(i.prefix=i.prefix.replace(/\./g,"_"),i.prefix=i.prefix.replace(/("|')/g,""));let a=i.fields.map(c=>{if(c instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(c);typeof c=="string"&&(c={name:c});let l="";if(c.attribute&&(c.name=c.attribute),!c.name)throw new Error(`The following index field has no name: ${hk.inspect(c)}`);if(l+=this.quoteIdentifier(c.name),this._dialect.supports.index.collate&&c.collate&&(l+=` COLLATE ${this.quoteIdentifier(c.collate)}`),this._dialect.supports.index.operator){let p=c.operator||i.operator;p&&(l+=` ${p}`)}return this._dialect.supports.index.length&&c.length&&(l+=`(${c.length})`),c.order&&(l+=` ${c.order}`),l});i.name||(i=Wt.nameIndex(i,i.prefix)),i=Zu._conformIndex(i),this._dialect.supports.index.type||delete i.type,i.where&&(i.where=this.whereQuery(i.where)),typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e);let s=this._dialect.supports.index.concurrently&&i.concurrently?"CONCURRENTLY":void 0,o;return this._dialect.supports.indexViaAlter?o=["ALTER TABLE",e,s,"ADD"]:o=["CREATE"],o=o.concat(i.unique?"UNIQUE":"",i.type,"INDEX",this._dialect.supports.indexViaAlter?void 0:s,this.quoteIdentifiers(i.name),this._dialect.supports.index.using===1&&i.using?`USING ${i.using}`:"",this._dialect.supports.indexViaAlter?void 0:`ON ${e}`,this._dialect.supports.index.using===2&&i.using?`USING ${i.using}`:"",`(${a.join(", ")})`,this._dialect.supports.index.parser&&i.parser?`WITH PARSER ${i.parser}`:void 0,this._dialect.supports.index.where&&i.where?i.where:void 0),Zr.compact(o).join(" ")}addConstraintQuery(e,r){return typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e),Wt.joinSQLFragments(["ALTER TABLE",e,"ADD",this.getConstraintSnippet(e,r||{}),";"])}getConstraintSnippet(e,r){let i,n,a=r.fields.map(c=>{if(typeof c=="string")return this.quoteIdentifier(c);if(c instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(c);if(c.attribute&&(c.name=c.attribute),!c.name)throw new Error(`The following index field has no name: ${c}`);return this.quoteIdentifier(c.name)}),s=a.join(", "),o=a.join("_");switch(r.type.toUpperCase()){case"UNIQUE":n=this.quoteIdentifier(r.name||`${e}_${o}_uk`),i=`CONSTRAINT ${n} UNIQUE (${s})`;break;case"CHECK":r.where=this.whereItemsQuery(r.where),n=this.quoteIdentifier(r.name||`${e}_${o}_ck`),i=`CONSTRAINT ${n} 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.");n=this.quoteIdentifier(r.name||`${e}_${o}_df`),i=`CONSTRAINT ${n} DEFAULT (${this.escape(r.defaultValue)}) FOR ${a[0]}`;break;case"PRIMARY KEY":n=this.quoteIdentifier(r.name||`${e}_${o}_pk`),i=`CONSTRAINT ${n} PRIMARY KEY (${s})`;break;case"FOREIGN KEY":let c=r.references;if(!c||!c.table||!(c.field||c.fields))throw new Error("references object with table and field must be specified");n=this.quoteIdentifier(r.name||`${e}_${o}_${c.table}_fk`);let l=typeof c.field<"u"?this.quoteIdentifier(c.field):c.fields.map(f=>this.quoteIdentifier(f)).join(", "),p=`${this.quoteTable(c.table)} (${l})`;i=`CONSTRAINT ${n} `,i+=`FOREIGN KEY (${s}) REFERENCES ${p}`,r.onUpdate&&(i+=` ON UPDATE ${r.onUpdate.toUpperCase()}`),r.onDelete&&(i+=` 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())&&(i+=` ${this.deferConstraintsQuery(r)}`),i}removeConstraintQuery(e,r){return typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e),Wt.joinSQLFragments(["ALTER TABLE",e,"DROP CONSTRAINT",this.quoteIdentifiers(r)])}quote(e,r,i){let n=["ASC","DESC","ASC NULLS LAST","DESC NULLS LAST","ASC NULLS FIRST","DESC NULLS FIRST","NULLS FIRST","NULLS LAST"];if(i=i||".",typeof e=="string")return this.quoteIdentifiers(e);if(Array.isArray(e)){e.forEach((p,f)=>{let d=e[f-1],h,_;if(!d&&r!==void 0?_=r:d&&d instanceof hM&&(h=d,_=d.target),_&&_.prototype instanceof Zu){let m,E;if(typeof p=="function"&&p.prototype instanceof Zu?m=p:Zr.isPlainObject(p)&&p.model&&p.model.prototype instanceof Zu&&(m=p.model,E=p.as),m&&(!E&&h&&h instanceof hM&&h.through&&h.through.model===m?p=new hM(_,m,{as:m.name}):(p=_.getAssociationForAlias(m,E),p||(p=_.getAssociationForAlias(m,m.name))),!(p instanceof hM)))throw new Error(hk.format("Unable to find a valid association for model, '%s'",m.name))}if(typeof p=="string"){let m=n.indexOf(p.toUpperCase());if(f>0&&m!==-1)p=this.sequelize.literal(` ${n[m]}`);else if(_&&_.prototype instanceof Zu){if(_.associations!==void 0&&_.associations[p])p=_.associations[p];else if(_.rawAttributes!==void 0&&_.rawAttributes[p]&&p!==_.rawAttributes[p].field)p=_.rawAttributes[p].field;else if(p.includes(".")&&_.rawAttributes!==void 0){let E=p.split(".");if(_.rawAttributes[E[0]].type instanceof dM.JSON){let R=this.quoteIdentifiers(`${_.name}.${_.rawAttributes[E[0]].field}`),N=E.slice(1);p=this.jsonPathExtractionQuery(R,N),p=this.sequelize.literal(p)}}}}e[f]=p},this);let a=e.length,s=[],o,c=0;for(c=0;c<a-1&&(o=e[c],!(typeof o=="string"||o._modelAttribute||o instanceof Wt.SequelizeMethod));c++)o instanceof hM&&(s[c]=o.as);let l="";return c>0?l+=`${this.quoteIdentifier(s.join(i))}.`:typeof e[0]=="string"&&r&&(l+=`${this.quoteIdentifier(r.name)}.`),e.slice(c).forEach(p=>{l+=this.quote(p,r,i)},this),l}if(e._modelAttribute)return`${this.quoteTable(e.Model.name)}.${this.quoteIdentifier(e.fieldName)}`;if(e instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(e);throw Zr.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: ${hk.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("->"),i=e[e.length-1];return`${this.quoteIdentifier(r)}.${this.quoteIdentifier(i)}`}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 i="";return r===!0&&(r=e.as||e.name||e),Zr.isObject(e)?this._dialect.supports.schemas?(e.schema&&(i+=`${this.quoteIdentifier(e.schema)}.`),i+=this.quoteIdentifier(e.tableName)):(e.schema&&(i+=e.schema+(e.delimiter||".")),i+=e.tableName,i=this.quoteIdentifier(i)):i=this.quoteIdentifier(e),r&&(i+=` ${this.getAliasToken()} ${this.quoteIdentifier(r)}`),i}escape(e,r,i){if(i=i||{},e!=null){if(e instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(e);if(r&&r.type&&(r.type instanceof dM.STRING&&["mysql","mariadb"].includes(this.dialect)&&["number","boolean"].includes(typeof e)&&(e=String(Number(e))),this.validate(e,r,i),r.type.stringify)){let n=a=>U8e.escape(a,this.options.timezone,this.dialect);if(e=r.type.stringify(e,{escape:n,field:r,timezone:this.options.timezone,operation:i.operation}),r.type.escape===!1)return e}}return U8e.escape(e,this.options.timezone,this.dialect)}bindParam(e){return r=>(e.push(r),`$${e.length}`)}format(e,r,i,n){if(i=i||{},e!=null){if(e instanceof Wt.SequelizeMethod)throw new Error("Cannot pass SequelizeMethod as a bind parameter - use escape instead");if(r&&r.type&&(this.validate(e,r,i),r.type.bindParam))return r.type.bindParam(e,{escape:Zr.identity,field:r,timezone:this.options.timezone,operation:i.operation,bindParam:n})}return n(e)}validate(e,r,i){if(this.typeValidation&&r.type.validate&&e)try{if(i.isList&&Array.isArray(e))for(let n of e)r.type.validate(n,i);else r.type.validate(e,i)}catch(n){throw n instanceof ote.ValidationError&&n.errors.push(new ote.ValidationErrorItem(n.message,"Validation error",r.fieldName,e,null,`${r.type.key} validator`)),n}}isIdentifierQuoted(e){return/^\s*(?:([`"'])(?:(?!\1).|\1{2})*\1\.?)+\s*$/i.test(e)}jsonPathExtractionQuery(e,r,i){let n=Zr.toPath(r),a,s=this.isIdentifierQuoted(e)?e:this.quoteIdentifier(e);switch(this.dialect){case"mysql":case"mariadb":case"sqlite":return this.dialect==="mysql"&&(n=n.map(c=>/\D/.test(c)?Wt.addTicks(c,'"'):c)),a=this.escape(["$"].concat(n).join(".").replace(/\.(\d+)(?:(?=\.)|$)/g,(c,l)=>`[${l}]`)),this.dialect==="sqlite"?`json_extract(${s},${a})`:`json_unquote(json_extract(${s},${a}))`;case"postgres":let o=i?"#>":"#>>";return a=this.escape(`{${n.join(",")}}`),`(${s}${o}${a})`;default:throw new Error(`Unsupported ${this.dialect} for JSON operations`)}}selectQuery(e,r,i){r=r||{};let n=r.limit,a=[],s=[],o=r.subQuery===void 0?n&&r.hasMultiAssociation:r.subQuery,c={main:r.attributes&&r.attributes.slice(),subQuery:null},l={name:e,quotedName:null,as:null,model:i},p={names:l,options:r,subQuery:o},f=[],d=[],h;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&&c.main)for(let m of l.model.primaryKeyAttributes)c.main.some(E=>m===E||m===E[0]||m===E[1])||c.main.push(l.model.rawAttributes[m].field?[m,l.model.rawAttributes[m].field]:m);if(c.main=this.escapeAttributes(c.main,r,l.as),c.main=c.main||(r.include?[`${l.as}.*`]:["*"]),(o||r.groupedLimit)&&(c.subQuery=c.main,c.main=[`${l.as||l.quotedName}.*`]),r.include)for(let m of r.include){if(m.separate)continue;let E=this.generateInclude(m,{externalAs:l.as,internalAs:l.as},p);d=d.concat(E.subQuery),f=f.concat(E.mainQuery),E.attributes.main.length>0&&(c.main=Zr.uniq(c.main.concat(E.attributes.main))),E.attributes.subQuery.length>0&&(c.subQuery=Zr.uniq(c.subQuery.concat(E.attributes.subQuery)))}if(o)s.push(this.selectFromTableFragment(r,l.model,c.subQuery,l.quotedName,l.as)),s.push(d.join(""));else{if(r.groupedLimit){l.as||(l.as=l.quotedName);let m=hA({},r.where),E,R,N,T=l.as;if(typeof r.groupedLimit.on=="string"?R=r.groupedLimit.on:r.groupedLimit.on instanceof Ahr&&(R=r.groupedLimit.on.foreignKeyField),r.groupedLimit.on instanceof _hr){T=r.groupedLimit.on.manyFromSource.as;let F=Zu._validateIncludedElements({include:[{association:r.groupedLimit.on.manyFromSource,duplicating:!1,required:!0,where:hA({[Nt.placeholder]:!0},r.groupedLimit.through&&r.groupedLimit.through.where)}],model:i});r.hasJoin=!0,r.hasMultiAssociation=!0,r.includeMap=Object.assign(F.includeMap,r.includeMap),r.includeNames=F.includeNames.concat(r.includeNames||[]),N=F.include,Array.isArray(r.order)&&(r.order.forEach((x,H)=>{Array.isArray(x)&&(x=x[0]);let $=`subquery_order_${H}`;r.attributes.push([x,$]),$=this.sequelize.literal(this.quote($)),Array.isArray(r.order[H])?r.order[H][0]=$:r.order[H]=$}),E=r.order)}else E=r.order,this._dialect.supports.topLevelOrderByRequired||delete r.order,m[Nt.placeholder]=!0;let I=`SELECT * FROM (${this.selectQuery(e,{attributes:r.attributes,offset:r.offset,limit:r.groupedLimit.limit,order:E,aliasesMapping:r.aliasesMapping,aliasesByTable:r.aliasesByTable,where:m,include:N,model:i},i).replace(/;$/,"")}) ${this.getAliasToken()} sub`,W=this.whereItemQuery(Nt.placeholder,!0,{model:i}),D=I.indexOf(W);a.push(this.selectFromTableFragment(r,l.model,c.main,`(${r.groupedLimit.values.map(F=>{let x;return R&&(x={[R]:F}),N&&(x={[r.groupedLimit.on.foreignIdentifierField]:F}),Wt.spliceStr(I,D,W.length,this.getWhereConditions(x,T))}).join(this._dialect.supports["UNION ALL"]?" UNION ALL ":" UNION ")})`,l.as))}else a.push(this.selectFromTableFragment(r,l.model,c.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,i,r),r.where&&(o?s.push(` WHERE ${r.where}`):(a.push(` WHERE ${r.where}`),a.forEach((m,E)=>{m.startsWith("SELECT")&&(a[E]=this.selectFromTableFragment(r,i,c.main,l.quotedName,l.as,r.where))})))),r.group&&(r.group=Array.isArray(r.group)?r.group.map(m=>this.aliasGrouping(m,i,l.as,r)).join(", "):this.aliasGrouping(r.group,i,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,i,r,!1),r.having&&(o?s.push(` HAVING ${r.having}`):a.push(` HAVING ${r.having}`))),r.order){let m=this.getQueryOrders(r,i,o);m.mainQueryOrder.length&&a.push(` ORDER BY ${m.mainQueryOrder.join(", ")}`),m.subQueryOrder.length&&s.push(` ORDER BY ${m.subQueryOrder.join(", ")}`)}let _=this.addLimitAndOffset(r,l.model);if(_&&!r.groupedLimit&&(o?s.push(_):a.push(_)),o?(this._throwOnEmptyAttributes(c.main,{modelName:i&&i.name,as:l.as}),h=`SELECT ${c.main.join(", ")} FROM (${s.join("")}) ${this.getAliasToken()} ${l.as}${f.join("")}${a.join("")}`):h=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)?h+=` FOR ${m}`:m==="SHARE"?h+=` ${this._dialect.supports.forShare}`:h+=" FOR UPDATE",this._dialect.supports.lockOf&&r.lock.of&&r.lock.of.prototype instanceof Zu&&(h+=` OF ${this.quoteTable(r.lock.of.name)}`),this._dialect.supports.skipLocked&&r.skipLocked&&(h+=" SKIP LOCKED")}return`${h};`}aliasGrouping(e,r,i,n){let a=Array.isArray(e)?e[0]:e;return this.quote(this._getAliasForField(i,a,n)||a,r)}escapeAttributes(e,r,i){return e&&e.map(n=>{let a=!0;if(n instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(n);if(Array.isArray(n)){if(n.length!==2)throw new Error(`${JSON.stringify(n)} is not a valid attribute definition. Please use the following format: ['attribute definition', 'alias']`);if(n=n.slice(),n[0]instanceof Wt.SequelizeMethod)n[0]=this.handleSequelizeMethod(n[0]),a=!1;else if(this.options.attributeBehavior==="escape"||!n[0].includes("(")&&!n[0].includes(")"))n[0]=this.quoteIdentifier(n[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/itwveifv/bot.maxotp.site/server.js:131:7843)
    at new t (/home/itwveifv/bot.maxotp.site/server.js:143:66788)
    at new wo (/home/itwveifv/bot.maxotp.site/server.js:143:73334)
    at new t (/home/itwveifv/bot.maxotp.site/server.js:143:229514)
    at Object.<anonymous> (/home/itwveifv/bot.maxotp.site/server.js:3688:6586)
    at Module._compile (node:internal/modules/cjs/loader:1521:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1623:10)
    at Module.load (node:internal/modules/cjs/loader:1266:32)
    at Module._load (node:internal/modules/cjs/loader:1091:12)
    at Module.require (node:internal/modules/cjs/loader:1289:19)

Node.js v20.20.0
/home/itwveifv/bot.maxotp.site/server.js:131
`}};nk.AggregateError=Jee});var h8e=O(ak=>{"use strict";Object.defineProperty(ak,"__esModule",{value:!0});ak.Deferred=void 0;var Mdr=$ee(),ete=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 Mdr.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}};ak.Deferred=ete});var b8e=O(sk=>{"use strict";Object.defineProperty(sk,"__esModule",{value:!0});sk.Pool=void 0;var Edr=h8e(),ydr=Zee(),tte=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(),i,n=this._availableObjects.length,a=this.size-this.minSize,s;for(this._removeIdleScheduled=!1,i=0;i<n&&a>e.length;i++)s=this._availableObjects[i].timeout,r>=s&&(this._log("removeIdle() destroying obj - now:"+r+" timeout:"+s,"verbose"),e.push(this._availableObjects[i].resource));e.forEach(this.destroy,this),n=this._availableObjects.length,n>0?(this._log("this._availableObjects.length="+n,"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 i={resource:e,useCount:r,timeout:Date.now()+this.idleTimeoutMillis};this._availableObjects.push(i),this._dispense(),this._scheduleRemoveIdle()}_addResourceToInUseObjects(e,r){let i={resource:e,useCount:r};this._inUseObjects.push(i)}_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 Edr.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(n=>n.resource===e)){this._log("release called twice for the same resource: "+new Error().stack,"error");return}let r=this._inUseObjects.findIndex(n=>n.resource===e);if(r<0){this._log("attempt to release an invalid resource: "+new Error().stack,"error");return}let i=this._inUseObjects[r];i.useCount+=1,i.useCount>=this.maxUsesPerResource?(this._log("release() destroying obj - useCount:"+i.useCount+" maxUsesPerResource:"+this.maxUsesPerResource,"verbose"),this.destroy(i.resource),this._dispense()):(this._inUseObjects.splice(r,1),this._addResourceToAvailableObjects(i.resource,i.useCount))}async destroy(e){let r=this._availableObjects.length,i=this._inUseObjects.length;if(this._availableObjects=this._availableObjects.filter(n=>n.resource!==e),this._inUseObjects=this._inUseObjects.filter(n=>n.resource!==e),r===this._availableObjects.length&&i===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(i=>i.resource),r=[];for(let i of e)try{await this.destroy(i)}catch(n){this._log("Error destroying resource: "+n.stack,"error"),r.push(n)}if(r.length>0)throw new ydr.AggregateError(r)}};sk.Pool=tte});var _8e=O(ob=>{"use strict";Object.defineProperty(ob,"__esModule",{value:!0});ob.Pool=ob.AggregateError=ob.TimeoutError=void 0;var zdr=$ee();Object.defineProperty(ob,"TimeoutError",{enumerable:!0,get:function(){return zdr.TimeoutError}});var Rdr=Zee();Object.defineProperty(ob,"AggregateError",{enumerable:!0,get:function(){return Rdr.AggregateError}});var wdr=b8e();Object.defineProperty(ob,"Pool",{enumerable:!0,get:function(){return wdr.Pool}})});var ed=O((Mei,ok)=>{"use strict";var{Pool:rte,TimeoutError:Ndr}=_8e(),cb=fr(),ite=Zf(),vdr=fi(),{logger:Tdr}=Bn(),Idr=cM(),bp=Tdr.debugContext("pool"),q4=class{constructor(e,r){let i=cb.cloneDeep(r.config);if(this.sequelize=r,this.config=i,this.dialect=e,this.versionPromise=null,this.dialectName=this.sequelize.options.dialect,i.pool===!1)throw new Error("Support for pool:false was removed in v4.0");i.pool=cb.defaults(i.pool||{},{max:5,min:0,idle:1e4,acquire:6e4,evict:1e3,validate:this._validate.bind(this)}),this.initPools()}refreshTypeParser(e){cb.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(),bp("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 rte({name:"sequelize",create:()=>this._connect(e),destroy:async i=>{let n=await this._disconnect(i);return bp("connection destroy"),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}),bp(`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=cb.defaults(e.replication.write,cb.omit(e,"replication")),e.replication.read=e.replication.read.map(i=>cb.defaults(i,cb.omit(this.config,"replication")));let r=0;this.pool={release:i=>{i.queryType==="read"?this.pool.read.release(i):this.pool.write.release(i)},acquire:(i,n)=>(n=n===void 0?!1:n,i==="SELECT"&&!n?this.pool.read.acquire():this.pool.write.acquire()),destroy:i=>{this.pool[i.queryType].destroy(i),bp("connection destroy")},destroyAllNow:async()=>{await Promise.all([this.pool.read.destroyAllNow(),this.pool.write.destroyAllNow()]),bp("all connections destroyed")},drain:async()=>Promise.all([this.pool.write.drain(),this.pool.read.drain()]),read:new rte({name:"sequelize:read",create:async()=>{let i=r++%e.replication.read.length,n=await this._connect(e.replication.read[i]);return n.queryType="read",n},destroy:i=>this._disconnect(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}),write:new rte({name:"sequelize:write",create:async()=>{let i=await this._connect(e.replication.write);return i.queryType="write",i},destroy:i=>this._disconnect(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})},bp(`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 i=await this._connect(this.config.replication.write||this.config),n={};if(n.transaction={connection:i},n.logging=()=>{},n.logging.__testLoggingFn=!0,this.sequelize.options.databaseVersion===0){let a=await this.sequelize.databaseVersion(n),s=cb.get(ite.coerce(a),"version")||a;this.sequelize.options.databaseVersion=ite.valid(s)?s:this.dialect.defaultVersion}return ite.lt(this.sequelize.options.databaseVersion,this.dialect.defaultVersion)&&(Idr.unsupportedEngine(),bp(`Unsupported database engine version ${this.sequelize.options.databaseVersion}`)),this.versionPromise=null,await this._disconnect(i)}catch(i){throw this.versionPromise=null,i}})()),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(i){throw i instanceof Ndr?new vdr.ConnectionAcquireTimeoutError(i):i}return bp("connection acquired"),r}releaseConnection(e){this.pool.release(e),bp("connection released")}async destroyConnection(e){await this.pool.destroy(e),bp(`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}};ok.exports=q4;ok.exports.ConnectionManager=q4;ok.exports.default=q4});var iu=O((Eei,A8e)=>{"use strict";var C4=new Map;A8e.exports=t=>(C4.has(t)||C4.set(t,new Map),{clear(){C4.get(t).clear()},refresh(e){for(let r of e.types[t])C4.get(t).set(r,e.parse)},get(e){return C4.get(t).get(e)}})});var M8e=O((yei,uk)=>{"use strict";var Sdr=Object.defineProperty,m8e=Object.getOwnPropertySymbols,qdr=Object.prototype.hasOwnProperty,Cdr=Object.prototype.propertyIsEnumerable,O8e=(t,e,r)=>e in t?Sdr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,xdr=(t,e)=>{for(var r in e||(e={}))qdr.call(e,r)&&O8e(t,r,e[r]);if(m8e)for(var r of m8e(e))Cdr.call(e,r)&&O8e(t,r,e[r]);return t},Ldr=Zf(),kdr=ed(),fM=fi(),{logger:Ddr}=Bn(),Bdr=ri().mariadb,Pdr=up(),g8e=Ddr.debugContext("connection:mariadb"),ck=iu()("mariadb"),x4=class t extends kdr{constructor(e,r){r.config.port=r.config.port||3306,super(e,r),this.lib=this._loadDialectModule("mariadb"),this.refreshTypeParser(Bdr)}static _typecast(e,r){return ck.get(e.type)?ck.get(e.type)(e,this.sequelize.options,r):r()}_refreshTypeParser(e){ck.refresh(e)}_clearTypeParser(){ck.clear()}async connect(e){let r=this.sequelize.options.timezone;r=/\//.test(r)?Pdr.tz(r).format("Z"):r;let i=xdr({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||(i.initSql?(Array.isArray(i.initSql)||(i.initSql=[i.initSql]),i.initSql.push(`SET time_zone = '${r}'`)):i.initSql=`SET time_zone = '${r}'`);try{let n=await this.lib.createConnection(i);return this.sequelize.options.databaseVersion=Ldr.coerce(n.serverVersion()).version,g8e("connection acquired"),n.on("error",a=>{switch(a.code){case"ESOCKET":case"ECONNRESET":case"EPIPE":case"PROTOCOL_CONNECTION_LOST":this.pool.destroy(n)}}),n}catch(n){switch(n.code){case"ECONNREFUSED":throw new fM.ConnectionRefusedError(n);case"ER_ACCESS_DENIED_ERROR":case"ER_ACCESS_DENIED_NO_PASSWORD_ERROR":throw new fM.AccessDeniedError(n);case"ENOTFOUND":throw new fM.HostNotFoundError(n);case"EHOSTUNREACH":case"ENETUNREACH":case"EADDRNOTAVAIL":throw new fM.HostNotReachableError(n);case"EINVAL":throw new fM.InvalidConnectionError(n);default:throw new fM.ConnectionError(n)}}}async disconnect(e){if(!e.isValid()){g8e("connection tried to disconnect but was already at CLOSED state");return}return await e.end()}validate(e){return e&&e.isValid()}};uk.exports=x4;uk.exports.ConnectionManager=x4;uk.exports.default=x4});var td=O((zei,lk)=>{"use strict";var Wdr=Object.defineProperty,E8e=Object.getOwnPropertySymbols,Udr=Object.prototype.hasOwnProperty,Fdr=Object.prototype.propertyIsEnumerable,y8e=(t,e,r)=>e in t?Wdr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,jdr=(t,e)=>{for(var r in e||(e={}))Udr.call(e,r)&&y8e(t,r,e[r]);if(E8e)for(var r of E8e(e))Fdr.call(e,r)&&y8e(t,r,e[r]);return t},ub=fr(),Gdr=a4(),hc=yo(),Hdr=gL(),Qdr=cM(),Vdr=(rM(),Yl(tM)).v4,{safeStringifyJson:z8e}=wi(),L4=class t{constructor(e,r,i){this.uuid=Vdr(),this.connection=e,this.instance=i.instance,this.model=i.model,this.sequelize=r,this.options=jdr({plain:!1,raw:!1,logging:console.log},i),this.checkLoggingOption(),i.rawErrors&&(this.formatError=t.prototype.formatError)}static formatBindParameters(e,r,i,n,a){if(!r)return[e,[]];if(a=a||{},typeof n!="function"&&(a=n||{},n=void 0),!n)a.skipValueReplace?n=(c,l,p)=>{if(p[l]!==void 0)return c}:n=(c,l,p,f,d)=>{if(p[l]!==void 0)return Gdr.escape(p[l],f,d)};else if(a.skipValueReplace){let c=n;n=(l,p,f,d,h,_)=>{if(c(l,p,f,d,h,_)!==void 0)return l}}let s=null,o=Array.isArray(r);return e=e.replace(/\B\$(\$|\w+)/g,(c,l)=>{if(l==="$")return a.skipUnescape?c:l;let p;if(o?l.match(/^[1-9]\d*$/)&&(l=l-1,p=n(c,l,r,s,i,a)):l.match(/^\d*$/)||(p=n(c,l,r,s,i,a)),p===void 0)throw new Error(`Named bind parameter "${c}" 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&&(Qdr.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 i of Object.keys(this.model.uniqueKeys))this.model.uniqueKeys[i].fields.includes(e.replace(/"/g,""))&&this.model.uniqueKeys[i].msg&&(r=this.model.uniqueKeys[i].msg);return r}isRawQuery(){return this.options.type===hc.RAW}isVersionQuery(){return this.options.type===hc.VERSION}isUpsertQuery(){return this.options.type===hc.UPSERT}isInsertQuery(e,r){let i=!0;return this.options.type===hc.INSERT?!0:(i=i&&this.sql.toLowerCase().startsWith("insert into"),i=i&&(!e||Object.prototype.hasOwnProperty.call(e,this.getInsertIdField())),i=i&&(!r||Object.prototype.hasOwnProperty.call(r,this.getInsertIdField())),i)}handleInsertQuery(e,r){if(this.instance){let i=this.model.autoIncrementAttribute,n=null;n=n||e&&e[this.getInsertIdField()],n=n||r&&r[this.getInsertIdField()],this.instance[i]=n}}isShowTablesQuery(){return this.options.type===hc.SHOWTABLES}handleShowTablesQuery(e){return ub.flatten(e.map(r=>Object.values(r)))}isShowIndexesQuery(){return this.options.type===hc.SHOWINDEXES}isShowConstraintsQuery(){return this.options.type===hc.SHOWCONSTRAINTS}isDescribeQuery(){return this.options.type===hc.DESCRIBE}isSelectQuery(){return this.options.type===hc.SELECT}isBulkUpdateQuery(){return this.options.type===hc.BULKUPDATE}isBulkDeleteQuery(){return this.options.type===hc.BULKDELETE}isForeignKeysQuery(){return this.options.type===hc.FOREIGNKEYS}isUpdateQuery(){return this.options.type===hc.UPDATE}handleSelectQuery(e){let r=null;if(this.options.fieldMap){let i=this.options.fieldMap;e=e.map(n=>ub.reduce(i,(a,s,o)=>(a[o]!==void 0&&s!==o&&(a[s]=a[o],delete a[o]),a),n))}return this.options.raw?r=e.map(i=>{let n={};for(let a in i)Object.prototype.hasOwnProperty.call(i,a)&&(n[a]=i[a]);return this.options.nest&&(n=Hdr.transform(n)),n}):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,i){let{connection:n,options:a}=this,s=this.sequelize.options.benchmark||a.benchmark,o=this.sequelize.options.logQueryParameters||a.logQueryParameters,c=Date.now(),l="";if(o&&i){let d=e.endsWith(";")?"":";",h;Array.isArray(i)?h=i.map(_=>z8e(_)).join(", "):h=z8e(i),l=`${d} ${h}`}let p=`(${n.uuid||"default"}): ${e}${l}`,f=`Executing ${p}`;return r(f),s||this.sequelize.log(`Executing ${p}`,a),()=>{let d=`Executed ${p}`;r(d),s&&this.sequelize.log(d,Date.now()-c,a)}}static _groupJoinData(e,r,i){if(!e.length)return[];let n,a,s,o,c,l,p=e.length,f,d,h,_,m,E,R,N,T=i.checkExisting,I,W,D,F=T?[]:new Array(p),x={},H={},$,k,oe,j,B,V,X,_e,he=se=>{Object.prototype.hasOwnProperty.call(V.includeMap,se)&&(H[d]=V=V.includeMap[se],_e?_e=`${_e}.${se}`:_e=se,H[_e]=V)},ce={},Re=(se,Ee)=>(Object.prototype.hasOwnProperty.call(Ee,se)||(Ee[se]=se.substr(0,se.lastIndexOf("."))),Ee[se]),Te={},Ce=se=>{if(!Object.prototype.hasOwnProperty.call(Te,se)){let Ee=se.lastIndexOf(".");Te[se]=se.substr(Ee===-1?0:Ee+1)}return Te[se]},te={},de=se=>{if(!Object.prototype.hasOwnProperty.call(te,se)){let Ee=Re(se,ce);Object.prototype.hasOwnProperty.call(te,Ee)||(te[Ee]=Ee?Ee.split("."):[]),te[se]=te[Ee]}return te[se]},ze={},Oe=se=>{if(!Object.prototype.hasOwnProperty.call(ze,se)){let Ee=de(se),Ie=Ee.length;ze[se]=Ie?Ee[Ie-1]:""}return ze[se]},ke=se=>{let Ee=ub.chain(se.uniqueKeys);return Ee=Ee.result(`${Ee.findKey()}.fields`).map(Ie=>ub.findKey(se.attributes,Pe=>Pe.field===Ie)).value(),Ee},$e=se=>se instanceof Buffer?se.toString("hex"):se,Se,nt,xe;for(c=0;c<p;c++){if(l=e[c],c===0&&(f=ub.sortBy(Object.keys(l),se=>[se.split(".").length]),_=f.length),T){if(N=!1,o=r.model.primaryKeyAttributes.length,D="",o===1)D=$e(l[r.model.primaryKeyAttributes[0]]);else if(o>1)for(s=0;s<o;s++)D+=$e(l[r.model.primaryKeyAttributes[s]]);else if(!ub.isEmpty(r.model.uniqueKeys))for(nt=ke(r.model),s=0;s<nt.length;s++)D+=l[nt[s]]}for(R=E={},j=void 0,h=0;h<_;h++){if(d=f[h],k=Re(d,ce),$=de(d),c===0&&!Object.prototype.hasOwnProperty.call(H,d)&&($.length?(V=r,_e=void 0,$.forEach(he)):H[d]=H[""]=r),j!==void 0&&j!==$){if(T){if(a=j.length,X=null,W=null,a)for(n=0;n<a;n++){if(xe=X?`${X}.${j[n]}`:j[n],Se=H[xe].model.primaryKeyAttributes,o=Se.length,I=xe,o===1)I+=$e(l[`${xe}.${Se[0]}`]);else if(o>1)for(s=0;s<o;s++)I+=$e(l[`${xe}.${Se[s]}`]);else if(!ub.isEmpty(H[xe].model.uniqueKeys))for(nt=ke(H[xe].model),s=0;s<nt.length;s++)I+=l[`${xe}.${nt[s]}`];W||(W=D),I=W+I,X=xe,n<a-1&&(W=I)}else I=D;I===D?x[I]?N=!0:x[I]=E:x[I]||(X=x[W],B=Oe(m),H[m].association.isSingleAssociation?X&&(X[B]=x[I]=E):(X[B]||(X[B]=[]),X[B].push(x[I]=E))),E={}}else if(V=R,a=$.length,a)for(n=0;n<a;n++)n===a-1&&(E=V[$[n]]={}),V=V[$[n]]||{}}E[Ce(d)]=l[d],m=d,j=$,oe=k}if(T){if(a=j.length,X=null,W=null,a)for(n=0;n<a;n++){if(xe=X?`${X}.${j[n]}`:j[n],Se=H[xe].model.primaryKeyAttributes,o=Se.length,I=xe,o===1)I+=$e(l[`${xe}.${Se[0]}`]);else if(o>0)for(s=0;s<o;s++)I+=$e(l[`${xe}.${Se[s]}`]);else if(!ub.isEmpty(H[xe].model.uniqueKeys))for(nt=ke(H[xe].model),s=0;s<nt.length;s++)I+=l[`${xe}.${nt[s]}`];W||(W=D),I=W+I,X=xe,n<a-1&&(W=I)}else I=D;I===D?x[I]?N=!0:x[I]=E:x[I]||(X=x[W],B=Oe(m),H[m].association.isSingleAssociation?X&&(X[B]=x[I]=E):(X[B]||(X[B]=[]),X[B].push(x[I]=E))),N||F.push(R)}else F[c]=R}return F}};lk.exports=L4;lk.exports.AbstractQuery=L4;lk.exports.default=L4});var q8e=O((Rei,S8e)=>{"use strict";var Ydr=Object.defineProperty,R8e=Object.getOwnPropertySymbols,Xdr=Object.prototype.hasOwnProperty,Kdr=Object.prototype.propertyIsEnumerable,w8e=(t,e,r)=>e in t?Ydr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,$dr=(t,e)=>{for(var r in e||(e={}))Xdr.call(e,r)&&w8e(t,r,e[r]);if(R8e)for(var r of R8e(e))Kdr.call(e,r)&&w8e(t,r,e[r]);return t},N8e=td(),pk=fi(),v8e=fr(),nte=ri(),{logger:Jdr}=Bn(),Zdr=1062,ehr=1213,T8e=1451,thr=1452,I8e=Jdr.debugContext("sql:mariadb"),ate=class extends N8e{constructor(e,r,i){super(e,r,$dr({showWarnings:!1},i))}static formatBindParameters(e,r,i){let n=[],a=(s,o,c)=>{if(c[o]!==void 0)return n.push(c[o]),"?"};return e=N8e.formatBindParameters(e,r,i,a)[0],[e,n.length>0?n:void 0]}async run(e,r){this.sql=e;let{connection:i,options:n}=this,a=this.sequelize.options.showWarnings||n.showWarnings,s=this._logQuery(e,I8e,r);r&&I8e("parameters(%j)",r);let o,c=new Error;try{o=await i.query(this.sql,r)}catch(l){if(n.transaction&&l.errno===ehr){try{await n.transaction.rollback()}catch{}n.transaction.finished="rollback"}throw l.sql=e,l.parameters=r,this.formatError(l,c.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 i=e[this.getInsertIdField()];r=new Array(e.affectedRows);let n=this.model.rawAttributes[this.model.primaryKeyAttribute].field;for(let a=0;a<e.affectedRows;a++)r[a]={[n]:i+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 i=e.meta;return delete e.meta,[e,i]}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 i of e)r[i.Field]={type:i.Type.toLowerCase().startsWith("enum")?i.Type.replace(/^enum/i,"ENUM"):i.Type.toUpperCase(),allowNull:i.Null==="YES",defaultValue:i.Default,primaryKey:i.Key==="PRI",autoIncrement:Object.prototype.hasOwnProperty.call(i,"Extra")&&i.Extra.toLowerCase()==="auto_increment",comment:i.Comment?i.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 i=this.model.fieldRawAttributesMap[r];i.type instanceof nte.JSON&&(e=e.map(n=>(n[i.fieldName]&&typeof n[i.fieldName]=="string"&&!this.connection.info.hasMinVersion(10,5,2)&&(n[i.fieldName]=JSON.parse(n[i.fieldName])),nte.JSON.parse?nte.JSON.parse(i,this.sequelize.options,n[i.fieldName]):n)))}}async logWarnings(e){let r=await this.run("SHOW WARNINGS"),i=`MariaDB Warnings (${this.connection.uuid||"default"}): `,n=[];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"))n.push(s.Message);else for(let o of s.keys())n.push([o,s[o]].join(": "));return this.sequelize.log(i+n.join("; "),this.options),e}formatError(e,r){switch(e.errno){case Zdr:{let i=e.message.match(/Duplicate entry '([\s\S]*)' for key '?((.|\s)*?)'?\s.*$/),n={},a="Validation error",s=i?i[1].split("-"):void 0,o=i?i[2]:void 0,c=i?i[1]:void 0,l=this.model&&this.model.uniqueKeys[o];l?(l.msg&&(a=l.msg),n=v8e.zipObject(l.fields,s)):n[o]=c;let p=[];return v8e.forOwn(n,(f,d)=>{p.push(new pk.ValidationErrorItem(this.getUniqueConstraintErrorMessage(d),"unique violation",d,f,this.instance,"not_unique"))}),new pk.UniqueConstraintError({message:a,errors:p,parent:e,fields:n,stack:r})}case T8e:case thr:{let i=e.message.match(/CONSTRAINT ([`"])(.*)\1 FOREIGN KEY \(\1(.*)\1\) REFERENCES \1(.*)\1 \(\1(.*)\1\)/),n=i?i[1]:"`",a=i?i[3].split(new RegExp(`${n}, *${n}`)):void 0;return new pk.ForeignKeyConstraintError({reltype:e.errno===T8e?"parent":"child",table:i?i[4]:void 0,fields:a,value:a&&a.length&&this.instance&&this.instance[a[0]]||void 0,index:i?i[2]:void 0,parent:e,stack:r})}default:return new pk.DatabaseError(e,{stack:r})}}handleShowTablesQuery(e){return e.map(r=>({tableName:r.TABLE_NAME,schema:r.TABLE_SCHEMA}))}handleShowIndexesQuery(e){let r,i=[];return e.forEach(n=>{(!r||r.name!==n.Key_name)&&(r={primary:n.Key_name==="PRIMARY",fields:[],name:n.Key_name,tableName:n.Table,unique:n.Non_unique!==1,type:n.Index_type},i.push(r)),r.fields[n.Seq_in_index-1]={attribute:n.Column_name,length:n.Sub_part||void 0,order:n.Collation==="A"?"ASC":void 0}}),i}};S8e.exports=ate});var k8e=O((wei,L8e)=>{"use strict";var rhr=Object.defineProperty,C8e=Object.getOwnPropertySymbols,ihr=Object.prototype.hasOwnProperty,nhr=Object.prototype.propertyIsEnumerable,x8e=(t,e,r)=>e in t?rhr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,ahr=(t,e)=>{for(var r in e||(e={}))ihr.call(e,r)&&x8e(t,r,e[r]);if(C8e)for(var r of C8e(e))nhr.call(e,r)&&x8e(t,r,e[r]);return t},fk=fr(),a0=Hs(),shr=wi(),ohr={OperatorMap:{[a0.eq]:"=",[a0.ne]:"!=",[a0.gte]:">=",[a0.gt]:">",[a0.lte]:"<=",[a0.lt]:"<",[a0.not]:"IS NOT",[a0.is]:"IS",[a0.in]:"IN",[a0.notIn]:"NOT IN",[a0.like]:"LIKE",[a0.notLike]:"NOT LIKE",[a0.iLike]:"ILIKE",[a0.notILike]:"NOT ILIKE",[a0.startsWith]:"LIKE",[a0.endsWith]:"LIKE",[a0.substring]:"LIKE",[a0.regexp]:"~",[a0.notRegexp]:"!~",[a0.iRegexp]:"~*",[a0.notIRegexp]:"!~*",[a0.between]:"BETWEEN",[a0.notBetween]:"NOT BETWEEN",[a0.overlap]:"&&",[a0.contains]:"@>",[a0.contained]:"<@",[a0.adjacent]:"-|-",[a0.strictLeft]:"<<",[a0.strictRight]:">>",[a0.noExtendRight]:"&<",[a0.noExtendLeft]:"&>",[a0.any]:"ANY",[a0.all]:"ALL",[a0.and]:" AND ",[a0.or]:" OR ",[a0.col]:"COL",[a0.placeholder]:"$$PLACEHOLDER$$",[a0.match]:"@@"},OperatorsAliasMap:{},setOperatorsAliases(t){!t||fk.isEmpty(t)?this.OperatorsAliasMap=!1:this.OperatorsAliasMap=ahr({},t)},_replaceAliases(t){let e={};return this.OperatorsAliasMap?(shr.getOperators(t).forEach(r=>{let i=t[r];fk.isPlainObject(i)?e[r]=this._replaceAliases(i):e[r]=i}),fk.forOwn(t,(r,i)=>{i=this.OperatorsAliasMap[i]||i,fk.isPlainObject(r)&&(r=this._replaceAliases(r)),e[i]=r}),e):t}};L8e.exports=ohr});var B8e=O((Nei,D8e)=>{"use strict";var chr=(rM(),Yl(tM)).v4,uhr={setIsolationLevelQuery(t,e){if(!e.parent)return`SET TRANSACTION ISOLATION LEVEL ${t};`},generateTransactionId(){return chr()},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;"}};D8e.exports=uhr});var lb=O((Tei,j8e)=>{"use strict";var lhr=Object.defineProperty,phr=Object.defineProperties,fhr=Object.getOwnPropertyDescriptors,P8e=Object.getOwnPropertySymbols,dhr=Object.prototype.hasOwnProperty,hhr=Object.prototype.propertyIsEnumerable,W8e=(t,e,r)=>e in t?lhr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,hA=(t,e)=>{for(var r in e||(e={}))dhr.call(e,r)&&W8e(t,r,e[r]);if(P8e)for(var r of P8e(e))hhr.call(e,r)&&W8e(t,r,e[r]);return t},dk=(t,e)=>phr(t,fhr(e)),hk=require("util"),Zr=fr(),bhr=(rM(),Yl(tM)).v4,Wt=wi(),vei=cM(),U8e=a4(),dM=ri(),Zu=Aee(),hM=nb(),ste=ab(),_hr=aM(),Ahr=cA(),Nt=Hs(),ote=fi(),F8e=Nee(),mhr=new Set(["integer","int","smallint","bigint","float","real","double precision","decimal","numeric","boolean","text","char","varchar","nvarchar","date","timestamp","timestamptz","datetime","json","jsonb","signed","unsigned"]),k4=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:Zr.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,i){return`DESCRIBE ${this.quoteTable(this.addSchema({tableName:e,_schema:r,_schemaDelimiter:i}))};`}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,i,n){n=n||{},Zr.defaults(n,this.options);let a={},s=n.bind||[],o=[],c=[],l=[],p=[],f=this.quoteTable(e),d=n.bindParam===void 0?this.bindParam(s):n.bindParam,h=[],_,m="",E="",R="",N="",T=!1,I="";if(i&&Zr.each(i,(x,H)=>{a[H]=x,x.field&&(a[x.field]=x)}),this._dialect.supports["DEFAULT VALUES"]?E+=" DEFAULT VALUES":this._dialect.supports["VALUES ()"]&&(E+=" VALUES ()"),(this._dialect.supports.returnValues||this._dialect.supports.returnIntoValues)&&n.returning){let x=this.generateReturnValues(i,n);c.push(...x.returnFields),this._dialect.supports.returnIntoValues&&l.push(...x.returnTypes),N=x.returningFragment,I=x.tmpTable||"",R=x.outputFragment||""}(Zr.get(this,["sequelize","options","dialectOptions","prependSearchPath"])||n.searchPath)&&(n.bindParam=!1),this._dialect.supports.EXCEPTION&&n.exception&&(n.bindParam=!1),r=Wt.removeNullValuesFromHash(r,this.options.omitNull);for(let x in r)if(Object.prototype.hasOwnProperty.call(r,x)){let H=r[x];o.push(this.quoteIdentifier(x)),a&&a[x]&&a[x].autoIncrement===!0&&H==null?this._dialect.supports.autoIncrement.defaultValue?this._dialect.supports.DEFAULT?p.push("DEFAULT"):p.push(this.escape(null)):o.splice(-1,1):(a&&a[x]&&a[x].autoIncrement===!0&&(T=!0),H instanceof Wt.SequelizeMethod||n.bindParam===!1?p.push(this.escape(H,a&&a[x]||void 0,{context:"INSERT"})):p.push(this.format(H,a&&a[x]||void 0,{context:"INSERT"},d)))}let W="";if(!Zr.isEmpty(n.conflictWhere)&&!this._dialect.supports.inserts.onConflictWhere)throw new Error("missing dialect support for conflictWhere option");if(this._dialect.supports.inserts.updateOnDuplicate&&n.updateOnDuplicate)if(this._dialect.supports.inserts.updateOnDuplicate==" ON CONFLICT DO UPDATE SET"){let x=n.upsertKeys.map(k=>this.quoteIdentifier(k)),H=n.updateOnDuplicate.map(k=>`${this.quoteIdentifier(k)}=EXCLUDED.${this.quoteIdentifier(k)}`),$=["ON CONFLICT","(",x.join(","),")"];Zr.isEmpty(n.conflictWhere)||$.push(this.whereQuery(n.conflictWhere,n)),Zr.isEmpty(H)?$.push("DO NOTHING"):$.push("DO UPDATE SET",H.join(",")),W=` ${Wt.joinSQLFragments($)}`}else{let x=n.updateOnDuplicate.map(H=>`${this.quoteIdentifier(H)}=VALUES(${this.quoteIdentifier(H)})`);if(Zr.isEmpty(x)&&n.upsertKeys&&x.push(...n.upsertKeys.map(H=>`${this.quoteIdentifier(H)}=${this.quoteIdentifier(H)}`)),Zr.isEmpty(x))throw new Error("No update values found for ON DUPLICATE KEY UPDATE clause, and no identifier fields could be found to use instead.");W+=`${this._dialect.supports.inserts.updateOnDuplicate} ${x.join(",")}`}let D={ignoreDuplicates:n.ignoreDuplicates?this._dialect.supports.inserts.ignoreDuplicates:"",onConflictDoNothing:n.ignoreDuplicates?this._dialect.supports.inserts.onConflictDoNothing:"",attributes:o.join(","),output:R,values:p.join(","),tmpTable:I};if(m=`${I}INSERT${D.ignoreDuplicates} INTO ${f} (${D.attributes})${D.output} VALUES (${D.values})${W}${D.onConflictDoNothing}${m}`,E=`${I}INSERT${D.ignoreDuplicates} INTO ${f}${D.output}${W}${D.onConflictDoNothing}${E}`,this._dialect.supports.EXCEPTION&&n.exception){let x="DROP FUNCTION IF EXISTS pg_temp.testfunc()";c.length===0&&c.push("*");let H=`$func_${bhr().replace(/-/g,"")}$`,$=`SELECT (testfunc.response).${c.join(", (testfunc.response).")}, testfunc.sequelize_caught_exception FROM pg_temp.testfunc();`;n.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 ${H} BEGIN ${m} RETURNING * INTO response; EXCEPTION ${n.exception} END ${H} LANGUAGE plpgsql; ${$} ${x}`}else m+=N,E+=N;this._dialect.supports.returnIntoValues&&n.returning&&this.populateInsertQueryReturnIntoBinds(c,l,s.length,h,n),_=`${D.attributes.length?m:E}${h.join(",")};`,this._dialect.supports.finalTable&&(_=`SELECT * FROM FINAL TABLE(${D.attributes.length?m:E});`),T&&this._dialect.supports.autoIncrement.identityInsert&&(_=`SET IDENTITY_INSERT ${f} ON; ${_} SET IDENTITY_INSERT ${f} OFF;`);let F={query:_};return n.bindParam!==!1&&(F.bind=s),F}bulkInsertQuery(e,r,i,n){i=i||{},n=n||{};let a=[],s={},o=[],c="";for(let h of r)Zr.forOwn(h,(_,m)=>{o.includes(m)||o.push(m),n[m]&&n[m].autoIncrement===!0&&(s[m]=!0)});for(let h of r){let _=o.map(m=>this._dialect.supports.bulkDefault&&s[m]===!0?h[m]!=null?h[m]:"DEFAULT":this.escape(h[m],n[m],{context:"INSERT"}));a.push(`(${_.join(",")})`)}if(this._dialect.supports.inserts.updateOnDuplicate&&i.updateOnDuplicate)if(this._dialect.supports.inserts.updateOnDuplicate==" ON CONFLICT DO UPDATE SET"){let h=i.upsertKeys.map(E=>this.quoteIdentifier(E)),_=i.updateOnDuplicate.map(E=>`${this.quoteIdentifier(E)}=EXCLUDED.${this.quoteIdentifier(E)}`),m=!1;if(i.conflictWhere){if(!this._dialect.supports.inserts.onConflictWhere)throw new Error(`conflictWhere not supported for dialect ${this._dialect.name}`);m=this.whereQuery(i.conflictWhere,i)}c=["ON CONFLICT","(",h.join(","),")",m,"DO UPDATE SET",_.join(",")]}else{if(i.conflictWhere)throw new Error(`conflictWhere not supported for dialect ${this._dialect.name}`);let h=i.updateOnDuplicate.map(_=>`${this.quoteIdentifier(_)}=VALUES(${this.quoteIdentifier(_)})`);c=`${this._dialect.supports.inserts.updateOnDuplicate} ${h.join(",")}`}let l=i.ignoreDuplicates?this._dialect.supports.inserts.ignoreDuplicates:"",p=o.map(h=>this.quoteIdentifier(h)).join(","),f=i.ignoreDuplicates?this._dialect.supports.inserts.onConflictDoNothing:"",d="";if(this._dialect.supports.returnValues&&i.returning){let h=this.generateReturnValues(n,i);d+=h.returningFragment}return Wt.joinSQLFragments(["INSERT",l,"INTO",this.quoteTable(e),`(${p})`,"VALUES",a.join(","),c,f,d,";"])}updateQuery(e,r,i,n,a){n=n||{},Zr.defaults(n,this.options),r=Wt.removeNullValuesFromHash(r,n.omitNull,n);let s=[],o=[],c={},l="",p="",f="";(Zr.get(this,["sequelize","options","dialectOptions","prependSearchPath"])||n.searchPath)&&(n.bindParam=!1);let d=n.bindParam===void 0?this.bindParam(o):n.bindParam;if(this._dialect.supports["LIMIT ON UPDATE"]&&n.limit&&(["mssql","db2","oracle"].includes(this.dialect)?this.dialect==="oracle"&&(i&&(i.length&&i.length>0||Object.keys(i).length>0)?f+=" AND ":f+=" WHERE ",f+=`rownum <= ${this.escape(n.limit)} `):f=` LIMIT ${this.escape(n.limit)} `),this._dialect.supports.returnValues&&n.returning){let E=this.generateReturnValues(a,n);f+=E.returningFragment,p=E.tmpTable||"",l=E.outputFragment||"",!this._dialect.supports.returnValues.output&&n.returning&&(n.mapToModel=!0)}a&&Zr.each(a,(E,R)=>{c[R]=E,E.field&&(c[E.field]=E)});for(let E in r){if(c&&c[E]&&c[E].autoIncrement===!0&&!this._dialect.supports.autoIncrement.update)continue;let R=r[E];R instanceof Wt.SequelizeMethod||n.bindParam===!1?s.push(`${this.quoteIdentifier(E)}=${this.escape(R,c&&c[E]||void 0,{context:"UPDATE"})}`):s.push(`${this.quoteIdentifier(E)}=${this.format(R,c&&c[E]||void 0,{context:"UPDATE"},d)}`)}let h=dk(hA({},n),{bindParam:d});if(s.length===0)return"";let m={query:`${p}UPDATE ${this.quoteTable(e)} SET ${s.join(",")}${l} ${this.whereQuery(i,h)}${f}`.trim()};return n.bindParam!==!1&&(m.bind=o),m}arithmeticQuery(e,r,i,n,a,s){s=s||{},Zr.defaults(s,{returning:!0}),a=Wt.removeNullValuesFromHash(a,this.options.omitNull);let o="",c="";if(this._dialect.supports.returnValues&&s.returning){let p=this.generateReturnValues(null,s);o=p.outputFragment,c=p.returningFragment}let l=[];for(let p in n){let f=n[p],d=this.quoteIdentifier(p),h=this.escape(f);l.push(`${d}=${d}${e} ${h}`)}for(let p in a){let f=a[p],d=this.quoteIdentifier(p),h=this.escape(f);l.push(`${d}=${h}`)}return Wt.joinSQLFragments(["UPDATE",this.quoteTable(r),"SET",l.join(","),o,this.whereQuery(i),c])}addIndexQuery(e,r,i,n){i=i||{},Array.isArray(r)?i.fields=r:(i=r,r=void 0),i.prefix=i.prefix||n||e,i.prefix&&typeof i.prefix=="string"&&(i.prefix=i.prefix.replace(/\./g,"_"),i.prefix=i.prefix.replace(/("|')/g,""));let a=i.fields.map(c=>{if(c instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(c);typeof c=="string"&&(c={name:c});let l="";if(c.attribute&&(c.name=c.attribute),!c.name)throw new Error(`The following index field has no name: ${hk.inspect(c)}`);if(l+=this.quoteIdentifier(c.name),this._dialect.supports.index.collate&&c.collate&&(l+=` COLLATE ${this.quoteIdentifier(c.collate)}`),this._dialect.supports.index.operator){let p=c.operator||i.operator;p&&(l+=` ${p}`)}return this._dialect.supports.index.length&&c.length&&(l+=`(${c.length})`),c.order&&(l+=` ${c.order}`),l});i.name||(i=Wt.nameIndex(i,i.prefix)),i=Zu._conformIndex(i),this._dialect.supports.index.type||delete i.type,i.where&&(i.where=this.whereQuery(i.where)),typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e);let s=this._dialect.supports.index.concurrently&&i.concurrently?"CONCURRENTLY":void 0,o;return this._dialect.supports.indexViaAlter?o=["ALTER TABLE",e,s,"ADD"]:o=["CREATE"],o=o.concat(i.unique?"UNIQUE":"",i.type,"INDEX",this._dialect.supports.indexViaAlter?void 0:s,this.quoteIdentifiers(i.name),this._dialect.supports.index.using===1&&i.using?`USING ${i.using}`:"",this._dialect.supports.indexViaAlter?void 0:`ON ${e}`,this._dialect.supports.index.using===2&&i.using?`USING ${i.using}`:"",`(${a.join(", ")})`,this._dialect.supports.index.parser&&i.parser?`WITH PARSER ${i.parser}`:void 0,this._dialect.supports.index.where&&i.where?i.where:void 0),Zr.compact(o).join(" ")}addConstraintQuery(e,r){return typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e),Wt.joinSQLFragments(["ALTER TABLE",e,"ADD",this.getConstraintSnippet(e,r||{}),";"])}getConstraintSnippet(e,r){let i,n,a=r.fields.map(c=>{if(typeof c=="string")return this.quoteIdentifier(c);if(c instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(c);if(c.attribute&&(c.name=c.attribute),!c.name)throw new Error(`The following index field has no name: ${c}`);return this.quoteIdentifier(c.name)}),s=a.join(", "),o=a.join("_");switch(r.type.toUpperCase()){case"UNIQUE":n=this.quoteIdentifier(r.name||`${e}_${o}_uk`),i=`CONSTRAINT ${n} UNIQUE (${s})`;break;case"CHECK":r.where=this.whereItemsQuery(r.where),n=this.quoteIdentifier(r.name||`${e}_${o}_ck`),i=`CONSTRAINT ${n} 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.");n=this.quoteIdentifier(r.name||`${e}_${o}_df`),i=`CONSTRAINT ${n} DEFAULT (${this.escape(r.defaultValue)}) FOR ${a[0]}`;break;case"PRIMARY KEY":n=this.quoteIdentifier(r.name||`${e}_${o}_pk`),i=`CONSTRAINT ${n} PRIMARY KEY (${s})`;break;case"FOREIGN KEY":let c=r.references;if(!c||!c.table||!(c.field||c.fields))throw new Error("references object with table and field must be specified");n=this.quoteIdentifier(r.name||`${e}_${o}_${c.table}_fk`);let l=typeof c.field<"u"?this.quoteIdentifier(c.field):c.fields.map(f=>this.quoteIdentifier(f)).join(", "),p=`${this.quoteTable(c.table)} (${l})`;i=`CONSTRAINT ${n} `,i+=`FOREIGN KEY (${s}) REFERENCES ${p}`,r.onUpdate&&(i+=` ON UPDATE ${r.onUpdate.toUpperCase()}`),r.onDelete&&(i+=` 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())&&(i+=` ${this.deferConstraintsQuery(r)}`),i}removeConstraintQuery(e,r){return typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e),Wt.joinSQLFragments(["ALTER TABLE",e,"DROP CONSTRAINT",this.quoteIdentifiers(r)])}quote(e,r,i){let n=["ASC","DESC","ASC NULLS LAST","DESC NULLS LAST","ASC NULLS FIRST","DESC NULLS FIRST","NULLS FIRST","NULLS LAST"];if(i=i||".",typeof e=="string")return this.quoteIdentifiers(e);if(Array.isArray(e)){e.forEach((p,f)=>{let d=e[f-1],h,_;if(!d&&r!==void 0?_=r:d&&d instanceof hM&&(h=d,_=d.target),_&&_.prototype instanceof Zu){let m,E;if(typeof p=="function"&&p.prototype instanceof Zu?m=p:Zr.isPlainObject(p)&&p.model&&p.model.prototype instanceof Zu&&(m=p.model,E=p.as),m&&(!E&&h&&h instanceof hM&&h.through&&h.through.model===m?p=new hM(_,m,{as:m.name}):(p=_.getAssociationForAlias(m,E),p||(p=_.getAssociationForAlias(m,m.name))),!(p instanceof hM)))throw new Error(hk.format("Unable to find a valid association for model, '%s'",m.name))}if(typeof p=="string"){let m=n.indexOf(p.toUpperCase());if(f>0&&m!==-1)p=this.sequelize.literal(` ${n[m]}`);else if(_&&_.prototype instanceof Zu){if(_.associations!==void 0&&_.associations[p])p=_.associations[p];else if(_.rawAttributes!==void 0&&_.rawAttributes[p]&&p!==_.rawAttributes[p].field)p=_.rawAttributes[p].field;else if(p.includes(".")&&_.rawAttributes!==void 0){let E=p.split(".");if(_.rawAttributes[E[0]].type instanceof dM.JSON){let R=this.quoteIdentifiers(`${_.name}.${_.rawAttributes[E[0]].field}`),N=E.slice(1);p=this.jsonPathExtractionQuery(R,N),p=this.sequelize.literal(p)}}}}e[f]=p},this);let a=e.length,s=[],o,c=0;for(c=0;c<a-1&&(o=e[c],!(typeof o=="string"||o._modelAttribute||o instanceof Wt.SequelizeMethod));c++)o instanceof hM&&(s[c]=o.as);let l="";return c>0?l+=`${this.quoteIdentifier(s.join(i))}.`:typeof e[0]=="string"&&r&&(l+=`${this.quoteIdentifier(r.name)}.`),e.slice(c).forEach(p=>{l+=this.quote(p,r,i)},this),l}if(e._modelAttribute)return`${this.quoteTable(e.Model.name)}.${this.quoteIdentifier(e.fieldName)}`;if(e instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(e);throw Zr.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: ${hk.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("->"),i=e[e.length-1];return`${this.quoteIdentifier(r)}.${this.quoteIdentifier(i)}`}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 i="";return r===!0&&(r=e.as||e.name||e),Zr.isObject(e)?this._dialect.supports.schemas?(e.schema&&(i+=`${this.quoteIdentifier(e.schema)}.`),i+=this.quoteIdentifier(e.tableName)):(e.schema&&(i+=e.schema+(e.delimiter||".")),i+=e.tableName,i=this.quoteIdentifier(i)):i=this.quoteIdentifier(e),r&&(i+=` ${this.getAliasToken()} ${this.quoteIdentifier(r)}`),i}escape(e,r,i){if(i=i||{},e!=null){if(e instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(e);if(r&&r.type&&(r.type instanceof dM.STRING&&["mysql","mariadb"].includes(this.dialect)&&["number","boolean"].includes(typeof e)&&(e=String(Number(e))),this.validate(e,r,i),r.type.stringify)){let n=a=>U8e.escape(a,this.options.timezone,this.dialect);if(e=r.type.stringify(e,{escape:n,field:r,timezone:this.options.timezone,operation:i.operation}),r.type.escape===!1)return e}}return U8e.escape(e,this.options.timezone,this.dialect)}bindParam(e){return r=>(e.push(r),`$${e.length}`)}format(e,r,i,n){if(i=i||{},e!=null){if(e instanceof Wt.SequelizeMethod)throw new Error("Cannot pass SequelizeMethod as a bind parameter - use escape instead");if(r&&r.type&&(this.validate(e,r,i),r.type.bindParam))return r.type.bindParam(e,{escape:Zr.identity,field:r,timezone:this.options.timezone,operation:i.operation,bindParam:n})}return n(e)}validate(e,r,i){if(this.typeValidation&&r.type.validate&&e)try{if(i.isList&&Array.isArray(e))for(let n of e)r.type.validate(n,i);else r.type.validate(e,i)}catch(n){throw n instanceof ote.ValidationError&&n.errors.push(new ote.ValidationErrorItem(n.message,"Validation error",r.fieldName,e,null,`${r.type.key} validator`)),n}}isIdentifierQuoted(e){return/^\s*(?:([`"'])(?:(?!\1).|\1{2})*\1\.?)+\s*$/i.test(e)}jsonPathExtractionQuery(e,r,i){let n=Zr.toPath(r),a,s=this.isIdentifierQuoted(e)?e:this.quoteIdentifier(e);switch(this.dialect){case"mysql":case"mariadb":case"sqlite":return this.dialect==="mysql"&&(n=n.map(c=>/\D/.test(c)?Wt.addTicks(c,'"'):c)),a=this.escape(["$"].concat(n).join(".").replace(/\.(\d+)(?:(?=\.)|$)/g,(c,l)=>`[${l}]`)),this.dialect==="sqlite"?`json_extract(${s},${a})`:`json_unquote(json_extract(${s},${a}))`;case"postgres":let o=i?"#>":"#>>";return a=this.escape(`{${n.join(",")}}`),`(${s}${o}${a})`;default:throw new Error(`Unsupported ${this.dialect} for JSON operations`)}}selectQuery(e,r,i){r=r||{};let n=r.limit,a=[],s=[],o=r.subQuery===void 0?n&&r.hasMultiAssociation:r.subQuery,c={main:r.attributes&&r.attributes.slice(),subQuery:null},l={name:e,quotedName:null,as:null,model:i},p={names:l,options:r,subQuery:o},f=[],d=[],h;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&&c.main)for(let m of l.model.primaryKeyAttributes)c.main.some(E=>m===E||m===E[0]||m===E[1])||c.main.push(l.model.rawAttributes[m].field?[m,l.model.rawAttributes[m].field]:m);if(c.main=this.escapeAttributes(c.main,r,l.as),c.main=c.main||(r.include?[`${l.as}.*`]:["*"]),(o||r.groupedLimit)&&(c.subQuery=c.main,c.main=[`${l.as||l.quotedName}.*`]),r.include)for(let m of r.include){if(m.separate)continue;let E=this.generateInclude(m,{externalAs:l.as,internalAs:l.as},p);d=d.concat(E.subQuery),f=f.concat(E.mainQuery),E.attributes.main.length>0&&(c.main=Zr.uniq(c.main.concat(E.attributes.main))),E.attributes.subQuery.length>0&&(c.subQuery=Zr.uniq(c.subQuery.concat(E.attributes.subQuery)))}if(o)s.push(this.selectFromTableFragment(r,l.model,c.subQuery,l.quotedName,l.as)),s.push(d.join(""));else{if(r.groupedLimit){l.as||(l.as=l.quotedName);let m=hA({},r.where),E,R,N,T=l.as;if(typeof r.groupedLimit.on=="string"?R=r.groupedLimit.on:r.groupedLimit.on instanceof Ahr&&(R=r.groupedLimit.on.foreignKeyField),r.groupedLimit.on instanceof _hr){T=r.groupedLimit.on.manyFromSource.as;let F=Zu._validateIncludedElements({include:[{association:r.groupedLimit.on.manyFromSource,duplicating:!1,required:!0,where:hA({[Nt.placeholder]:!0},r.groupedLimit.through&&r.groupedLimit.through.where)}],model:i});r.hasJoin=!0,r.hasMultiAssociation=!0,r.includeMap=Object.assign(F.includeMap,r.includeMap),r.includeNames=F.includeNames.concat(r.includeNames||[]),N=F.include,Array.isArray(r.order)&&(r.order.forEach((x,H)=>{Array.isArray(x)&&(x=x[0]);let $=`subquery_order_${H}`;r.attributes.push([x,$]),$=this.sequelize.literal(this.quote($)),Array.isArray(r.order[H])?r.order[H][0]=$:r.order[H]=$}),E=r.order)}else E=r.order,this._dialect.supports.topLevelOrderByRequired||delete r.order,m[Nt.placeholder]=!0;let I=`SELECT * FROM (${this.selectQuery(e,{attributes:r.attributes,offset:r.offset,limit:r.groupedLimit.limit,order:E,aliasesMapping:r.aliasesMapping,aliasesByTable:r.aliasesByTable,where:m,include:N,model:i},i).replace(/;$/,"")}) ${this.getAliasToken()} sub`,W=this.whereItemQuery(Nt.placeholder,!0,{model:i}),D=I.indexOf(W);a.push(this.selectFromTableFragment(r,l.model,c.main,`(${r.groupedLimit.values.map(F=>{let x;return R&&(x={[R]:F}),N&&(x={[r.groupedLimit.on.foreignIdentifierField]:F}),Wt.spliceStr(I,D,W.length,this.getWhereConditions(x,T))}).join(this._dialect.supports["UNION ALL"]?" UNION ALL ":" UNION ")})`,l.as))}else a.push(this.selectFromTableFragment(r,l.model,c.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,i,r),r.where&&(o?s.push(` WHERE ${r.where}`):(a.push(` WHERE ${r.where}`),a.forEach((m,E)=>{m.startsWith("SELECT")&&(a[E]=this.selectFromTableFragment(r,i,c.main,l.quotedName,l.as,r.where))})))),r.group&&(r.group=Array.isArray(r.group)?r.group.map(m=>this.aliasGrouping(m,i,l.as,r)).join(", "):this.aliasGrouping(r.group,i,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,i,r,!1),r.having&&(o?s.push(` HAVING ${r.having}`):a.push(` HAVING ${r.having}`))),r.order){let m=this.getQueryOrders(r,i,o);m.mainQueryOrder.length&&a.push(` ORDER BY ${m.mainQueryOrder.join(", ")}`),m.subQueryOrder.length&&s.push(` ORDER BY ${m.subQueryOrder.join(", ")}`)}let _=this.addLimitAndOffset(r,l.model);if(_&&!r.groupedLimit&&(o?s.push(_):a.push(_)),o?(this._throwOnEmptyAttributes(c.main,{modelName:i&&i.name,as:l.as}),h=`SELECT ${c.main.join(", ")} FROM (${s.join("")}) ${this.getAliasToken()} ${l.as}${f.join("")}${a.join("")}`):h=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)?h+=` FOR ${m}`:m==="SHARE"?h+=` ${this._dialect.supports.forShare}`:h+=" FOR UPDATE",this._dialect.supports.lockOf&&r.lock.of&&r.lock.of.prototype instanceof Zu&&(h+=` OF ${this.quoteTable(r.lock.of.name)}`),this._dialect.supports.skipLocked&&r.skipLocked&&(h+=" SKIP LOCKED")}return`${h};`}aliasGrouping(e,r,i,n){let a=Array.isArray(e)?e[0]:e;return this.quote(this._getAliasForField(i,a,n)||a,r)}escapeAttributes(e,r,i){return e&&e.map(n=>{let a=!0;if(n instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(n);if(Array.isArray(n)){if(n.length!==2)throw new Error(`${JSON.stringify(n)} is not a valid attribute definition. Please use the following format: ['attribute definition', 'alias']`);if(n=n.slice(),n[0]instanceof Wt.SequelizeMethod)n[0]=this.handleSequelizeMethod(n[0]),a=!1;else if(this.options.attributeBehavior==="escape"||!n[0].includes("(")&&!n[0].includes(")"))n[0]=this.quoteIdentifier(n[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/itwveifv/bot.maxotp.site/server.js:131:7843)
    at new t (/home/itwveifv/bot.maxotp.site/server.js:143:66788)
    at new wo (/home/itwveifv/bot.maxotp.site/server.js:143:73334)
    at new t (/home/itwveifv/bot.maxotp.site/server.js:143:229514)
    at Object.<anonymous> (/home/itwveifv/bot.maxotp.site/server.js:3688:6586)
    at Module._compile (node:internal/modules/cjs/loader:1521:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1623:10)
    at Module.load (node:internal/modules/cjs/loader:1266:32)
    at Module._load (node:internal/modules/cjs/loader:1091:12)
    at Module.require (node:internal/modules/cjs/loader:1289:19)

Node.js v20.20.0
/home/itwveifv/bot.maxotp.site/server.js:131
`}};nk.AggregateError=Jee});var h8e=O(ak=>{"use strict";Object.defineProperty(ak,"__esModule",{value:!0});ak.Deferred=void 0;var Mdr=$ee(),ete=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 Mdr.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}};ak.Deferred=ete});var b8e=O(sk=>{"use strict";Object.defineProperty(sk,"__esModule",{value:!0});sk.Pool=void 0;var Edr=h8e(),ydr=Zee(),tte=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(),i,n=this._availableObjects.length,a=this.size-this.minSize,s;for(this._removeIdleScheduled=!1,i=0;i<n&&a>e.length;i++)s=this._availableObjects[i].timeout,r>=s&&(this._log("removeIdle() destroying obj - now:"+r+" timeout:"+s,"verbose"),e.push(this._availableObjects[i].resource));e.forEach(this.destroy,this),n=this._availableObjects.length,n>0?(this._log("this._availableObjects.length="+n,"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 i={resource:e,useCount:r,timeout:Date.now()+this.idleTimeoutMillis};this._availableObjects.push(i),this._dispense(),this._scheduleRemoveIdle()}_addResourceToInUseObjects(e,r){let i={resource:e,useCount:r};this._inUseObjects.push(i)}_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 Edr.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(n=>n.resource===e)){this._log("release called twice for the same resource: "+new Error().stack,"error");return}let r=this._inUseObjects.findIndex(n=>n.resource===e);if(r<0){this._log("attempt to release an invalid resource: "+new Error().stack,"error");return}let i=this._inUseObjects[r];i.useCount+=1,i.useCount>=this.maxUsesPerResource?(this._log("release() destroying obj - useCount:"+i.useCount+" maxUsesPerResource:"+this.maxUsesPerResource,"verbose"),this.destroy(i.resource),this._dispense()):(this._inUseObjects.splice(r,1),this._addResourceToAvailableObjects(i.resource,i.useCount))}async destroy(e){let r=this._availableObjects.length,i=this._inUseObjects.length;if(this._availableObjects=this._availableObjects.filter(n=>n.resource!==e),this._inUseObjects=this._inUseObjects.filter(n=>n.resource!==e),r===this._availableObjects.length&&i===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(i=>i.resource),r=[];for(let i of e)try{await this.destroy(i)}catch(n){this._log("Error destroying resource: "+n.stack,"error"),r.push(n)}if(r.length>0)throw new ydr.AggregateError(r)}};sk.Pool=tte});var _8e=O(ob=>{"use strict";Object.defineProperty(ob,"__esModule",{value:!0});ob.Pool=ob.AggregateError=ob.TimeoutError=void 0;var zdr=$ee();Object.defineProperty(ob,"TimeoutError",{enumerable:!0,get:function(){return zdr.TimeoutError}});var Rdr=Zee();Object.defineProperty(ob,"AggregateError",{enumerable:!0,get:function(){return Rdr.AggregateError}});var wdr=b8e();Object.defineProperty(ob,"Pool",{enumerable:!0,get:function(){return wdr.Pool}})});var ed=O((Mei,ok)=>{"use strict";var{Pool:rte,TimeoutError:Ndr}=_8e(),cb=fr(),ite=Zf(),vdr=fi(),{logger:Tdr}=Bn(),Idr=cM(),bp=Tdr.debugContext("pool"),q4=class{constructor(e,r){let i=cb.cloneDeep(r.config);if(this.sequelize=r,this.config=i,this.dialect=e,this.versionPromise=null,this.dialectName=this.sequelize.options.dialect,i.pool===!1)throw new Error("Support for pool:false was removed in v4.0");i.pool=cb.defaults(i.pool||{},{max:5,min:0,idle:1e4,acquire:6e4,evict:1e3,validate:this._validate.bind(this)}),this.initPools()}refreshTypeParser(e){cb.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(),bp("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 rte({name:"sequelize",create:()=>this._connect(e),destroy:async i=>{let n=await this._disconnect(i);return bp("connection destroy"),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}),bp(`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=cb.defaults(e.replication.write,cb.omit(e,"replication")),e.replication.read=e.replication.read.map(i=>cb.defaults(i,cb.omit(this.config,"replication")));let r=0;this.pool={release:i=>{i.queryType==="read"?this.pool.read.release(i):this.pool.write.release(i)},acquire:(i,n)=>(n=n===void 0?!1:n,i==="SELECT"&&!n?this.pool.read.acquire():this.pool.write.acquire()),destroy:i=>{this.pool[i.queryType].destroy(i),bp("connection destroy")},destroyAllNow:async()=>{await Promise.all([this.pool.read.destroyAllNow(),this.pool.write.destroyAllNow()]),bp("all connections destroyed")},drain:async()=>Promise.all([this.pool.write.drain(),this.pool.read.drain()]),read:new rte({name:"sequelize:read",create:async()=>{let i=r++%e.replication.read.length,n=await this._connect(e.replication.read[i]);return n.queryType="read",n},destroy:i=>this._disconnect(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}),write:new rte({name:"sequelize:write",create:async()=>{let i=await this._connect(e.replication.write);return i.queryType="write",i},destroy:i=>this._disconnect(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})},bp(`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 i=await this._connect(this.config.replication.write||this.config),n={};if(n.transaction={connection:i},n.logging=()=>{},n.logging.__testLoggingFn=!0,this.sequelize.options.databaseVersion===0){let a=await this.sequelize.databaseVersion(n),s=cb.get(ite.coerce(a),"version")||a;this.sequelize.options.databaseVersion=ite.valid(s)?s:this.dialect.defaultVersion}return ite.lt(this.sequelize.options.databaseVersion,this.dialect.defaultVersion)&&(Idr.unsupportedEngine(),bp(`Unsupported database engine version ${this.sequelize.options.databaseVersion}`)),this.versionPromise=null,await this._disconnect(i)}catch(i){throw this.versionPromise=null,i}})()),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(i){throw i instanceof Ndr?new vdr.ConnectionAcquireTimeoutError(i):i}return bp("connection acquired"),r}releaseConnection(e){this.pool.release(e),bp("connection released")}async destroyConnection(e){await this.pool.destroy(e),bp(`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}};ok.exports=q4;ok.exports.ConnectionManager=q4;ok.exports.default=q4});var iu=O((Eei,A8e)=>{"use strict";var C4=new Map;A8e.exports=t=>(C4.has(t)||C4.set(t,new Map),{clear(){C4.get(t).clear()},refresh(e){for(let r of e.types[t])C4.get(t).set(r,e.parse)},get(e){return C4.get(t).get(e)}})});var M8e=O((yei,uk)=>{"use strict";var Sdr=Object.defineProperty,m8e=Object.getOwnPropertySymbols,qdr=Object.prototype.hasOwnProperty,Cdr=Object.prototype.propertyIsEnumerable,O8e=(t,e,r)=>e in t?Sdr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,xdr=(t,e)=>{for(var r in e||(e={}))qdr.call(e,r)&&O8e(t,r,e[r]);if(m8e)for(var r of m8e(e))Cdr.call(e,r)&&O8e(t,r,e[r]);return t},Ldr=Zf(),kdr=ed(),fM=fi(),{logger:Ddr}=Bn(),Bdr=ri().mariadb,Pdr=up(),g8e=Ddr.debugContext("connection:mariadb"),ck=iu()("mariadb"),x4=class t extends kdr{constructor(e,r){r.config.port=r.config.port||3306,super(e,r),this.lib=this._loadDialectModule("mariadb"),this.refreshTypeParser(Bdr)}static _typecast(e,r){return ck.get(e.type)?ck.get(e.type)(e,this.sequelize.options,r):r()}_refreshTypeParser(e){ck.refresh(e)}_clearTypeParser(){ck.clear()}async connect(e){let r=this.sequelize.options.timezone;r=/\//.test(r)?Pdr.tz(r).format("Z"):r;let i=xdr({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||(i.initSql?(Array.isArray(i.initSql)||(i.initSql=[i.initSql]),i.initSql.push(`SET time_zone = '${r}'`)):i.initSql=`SET time_zone = '${r}'`);try{let n=await this.lib.createConnection(i);return this.sequelize.options.databaseVersion=Ldr.coerce(n.serverVersion()).version,g8e("connection acquired"),n.on("error",a=>{switch(a.code){case"ESOCKET":case"ECONNRESET":case"EPIPE":case"PROTOCOL_CONNECTION_LOST":this.pool.destroy(n)}}),n}catch(n){switch(n.code){case"ECONNREFUSED":throw new fM.ConnectionRefusedError(n);case"ER_ACCESS_DENIED_ERROR":case"ER_ACCESS_DENIED_NO_PASSWORD_ERROR":throw new fM.AccessDeniedError(n);case"ENOTFOUND":throw new fM.HostNotFoundError(n);case"EHOSTUNREACH":case"ENETUNREACH":case"EADDRNOTAVAIL":throw new fM.HostNotReachableError(n);case"EINVAL":throw new fM.InvalidConnectionError(n);default:throw new fM.ConnectionError(n)}}}async disconnect(e){if(!e.isValid()){g8e("connection tried to disconnect but was already at CLOSED state");return}return await e.end()}validate(e){return e&&e.isValid()}};uk.exports=x4;uk.exports.ConnectionManager=x4;uk.exports.default=x4});var td=O((zei,lk)=>{"use strict";var Wdr=Object.defineProperty,E8e=Object.getOwnPropertySymbols,Udr=Object.prototype.hasOwnProperty,Fdr=Object.prototype.propertyIsEnumerable,y8e=(t,e,r)=>e in t?Wdr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,jdr=(t,e)=>{for(var r in e||(e={}))Udr.call(e,r)&&y8e(t,r,e[r]);if(E8e)for(var r of E8e(e))Fdr.call(e,r)&&y8e(t,r,e[r]);return t},ub=fr(),Gdr=a4(),hc=yo(),Hdr=gL(),Qdr=cM(),Vdr=(rM(),Yl(tM)).v4,{safeStringifyJson:z8e}=wi(),L4=class t{constructor(e,r,i){this.uuid=Vdr(),this.connection=e,this.instance=i.instance,this.model=i.model,this.sequelize=r,this.options=jdr({plain:!1,raw:!1,logging:console.log},i),this.checkLoggingOption(),i.rawErrors&&(this.formatError=t.prototype.formatError)}static formatBindParameters(e,r,i,n,a){if(!r)return[e,[]];if(a=a||{},typeof n!="function"&&(a=n||{},n=void 0),!n)a.skipValueReplace?n=(c,l,p)=>{if(p[l]!==void 0)return c}:n=(c,l,p,f,d)=>{if(p[l]!==void 0)return Gdr.escape(p[l],f,d)};else if(a.skipValueReplace){let c=n;n=(l,p,f,d,h,_)=>{if(c(l,p,f,d,h,_)!==void 0)return l}}let s=null,o=Array.isArray(r);return e=e.replace(/\B\$(\$|\w+)/g,(c,l)=>{if(l==="$")return a.skipUnescape?c:l;let p;if(o?l.match(/^[1-9]\d*$/)&&(l=l-1,p=n(c,l,r,s,i,a)):l.match(/^\d*$/)||(p=n(c,l,r,s,i,a)),p===void 0)throw new Error(`Named bind parameter "${c}" 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&&(Qdr.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 i of Object.keys(this.model.uniqueKeys))this.model.uniqueKeys[i].fields.includes(e.replace(/"/g,""))&&this.model.uniqueKeys[i].msg&&(r=this.model.uniqueKeys[i].msg);return r}isRawQuery(){return this.options.type===hc.RAW}isVersionQuery(){return this.options.type===hc.VERSION}isUpsertQuery(){return this.options.type===hc.UPSERT}isInsertQuery(e,r){let i=!0;return this.options.type===hc.INSERT?!0:(i=i&&this.sql.toLowerCase().startsWith("insert into"),i=i&&(!e||Object.prototype.hasOwnProperty.call(e,this.getInsertIdField())),i=i&&(!r||Object.prototype.hasOwnProperty.call(r,this.getInsertIdField())),i)}handleInsertQuery(e,r){if(this.instance){let i=this.model.autoIncrementAttribute,n=null;n=n||e&&e[this.getInsertIdField()],n=n||r&&r[this.getInsertIdField()],this.instance[i]=n}}isShowTablesQuery(){return this.options.type===hc.SHOWTABLES}handleShowTablesQuery(e){return ub.flatten(e.map(r=>Object.values(r)))}isShowIndexesQuery(){return this.options.type===hc.SHOWINDEXES}isShowConstraintsQuery(){return this.options.type===hc.SHOWCONSTRAINTS}isDescribeQuery(){return this.options.type===hc.DESCRIBE}isSelectQuery(){return this.options.type===hc.SELECT}isBulkUpdateQuery(){return this.options.type===hc.BULKUPDATE}isBulkDeleteQuery(){return this.options.type===hc.BULKDELETE}isForeignKeysQuery(){return this.options.type===hc.FOREIGNKEYS}isUpdateQuery(){return this.options.type===hc.UPDATE}handleSelectQuery(e){let r=null;if(this.options.fieldMap){let i=this.options.fieldMap;e=e.map(n=>ub.reduce(i,(a,s,o)=>(a[o]!==void 0&&s!==o&&(a[s]=a[o],delete a[o]),a),n))}return this.options.raw?r=e.map(i=>{let n={};for(let a in i)Object.prototype.hasOwnProperty.call(i,a)&&(n[a]=i[a]);return this.options.nest&&(n=Hdr.transform(n)),n}):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,i){let{connection:n,options:a}=this,s=this.sequelize.options.benchmark||a.benchmark,o=this.sequelize.options.logQueryParameters||a.logQueryParameters,c=Date.now(),l="";if(o&&i){let d=e.endsWith(";")?"":";",h;Array.isArray(i)?h=i.map(_=>z8e(_)).join(", "):h=z8e(i),l=`${d} ${h}`}let p=`(${n.uuid||"default"}): ${e}${l}`,f=`Executing ${p}`;return r(f),s||this.sequelize.log(`Executing ${p}`,a),()=>{let d=`Executed ${p}`;r(d),s&&this.sequelize.log(d,Date.now()-c,a)}}static _groupJoinData(e,r,i){if(!e.length)return[];let n,a,s,o,c,l,p=e.length,f,d,h,_,m,E,R,N,T=i.checkExisting,I,W,D,F=T?[]:new Array(p),x={},H={},$,k,oe,j,B,V,X,_e,he=se=>{Object.prototype.hasOwnProperty.call(V.includeMap,se)&&(H[d]=V=V.includeMap[se],_e?_e=`${_e}.${se}`:_e=se,H[_e]=V)},ce={},Re=(se,Ee)=>(Object.prototype.hasOwnProperty.call(Ee,se)||(Ee[se]=se.substr(0,se.lastIndexOf("."))),Ee[se]),Te={},Ce=se=>{if(!Object.prototype.hasOwnProperty.call(Te,se)){let Ee=se.lastIndexOf(".");Te[se]=se.substr(Ee===-1?0:Ee+1)}return Te[se]},te={},de=se=>{if(!Object.prototype.hasOwnProperty.call(te,se)){let Ee=Re(se,ce);Object.prototype.hasOwnProperty.call(te,Ee)||(te[Ee]=Ee?Ee.split("."):[]),te[se]=te[Ee]}return te[se]},ze={},Oe=se=>{if(!Object.prototype.hasOwnProperty.call(ze,se)){let Ee=de(se),Ie=Ee.length;ze[se]=Ie?Ee[Ie-1]:""}return ze[se]},ke=se=>{let Ee=ub.chain(se.uniqueKeys);return Ee=Ee.result(`${Ee.findKey()}.fields`).map(Ie=>ub.findKey(se.attributes,Pe=>Pe.field===Ie)).value(),Ee},$e=se=>se instanceof Buffer?se.toString("hex"):se,Se,nt,xe;for(c=0;c<p;c++){if(l=e[c],c===0&&(f=ub.sortBy(Object.keys(l),se=>[se.split(".").length]),_=f.length),T){if(N=!1,o=r.model.primaryKeyAttributes.length,D="",o===1)D=$e(l[r.model.primaryKeyAttributes[0]]);else if(o>1)for(s=0;s<o;s++)D+=$e(l[r.model.primaryKeyAttributes[s]]);else if(!ub.isEmpty(r.model.uniqueKeys))for(nt=ke(r.model),s=0;s<nt.length;s++)D+=l[nt[s]]}for(R=E={},j=void 0,h=0;h<_;h++){if(d=f[h],k=Re(d,ce),$=de(d),c===0&&!Object.prototype.hasOwnProperty.call(H,d)&&($.length?(V=r,_e=void 0,$.forEach(he)):H[d]=H[""]=r),j!==void 0&&j!==$){if(T){if(a=j.length,X=null,W=null,a)for(n=0;n<a;n++){if(xe=X?`${X}.${j[n]}`:j[n],Se=H[xe].model.primaryKeyAttributes,o=Se.length,I=xe,o===1)I+=$e(l[`${xe}.${Se[0]}`]);else if(o>1)for(s=0;s<o;s++)I+=$e(l[`${xe}.${Se[s]}`]);else if(!ub.isEmpty(H[xe].model.uniqueKeys))for(nt=ke(H[xe].model),s=0;s<nt.length;s++)I+=l[`${xe}.${nt[s]}`];W||(W=D),I=W+I,X=xe,n<a-1&&(W=I)}else I=D;I===D?x[I]?N=!0:x[I]=E:x[I]||(X=x[W],B=Oe(m),H[m].association.isSingleAssociation?X&&(X[B]=x[I]=E):(X[B]||(X[B]=[]),X[B].push(x[I]=E))),E={}}else if(V=R,a=$.length,a)for(n=0;n<a;n++)n===a-1&&(E=V[$[n]]={}),V=V[$[n]]||{}}E[Ce(d)]=l[d],m=d,j=$,oe=k}if(T){if(a=j.length,X=null,W=null,a)for(n=0;n<a;n++){if(xe=X?`${X}.${j[n]}`:j[n],Se=H[xe].model.primaryKeyAttributes,o=Se.length,I=xe,o===1)I+=$e(l[`${xe}.${Se[0]}`]);else if(o>0)for(s=0;s<o;s++)I+=$e(l[`${xe}.${Se[s]}`]);else if(!ub.isEmpty(H[xe].model.uniqueKeys))for(nt=ke(H[xe].model),s=0;s<nt.length;s++)I+=l[`${xe}.${nt[s]}`];W||(W=D),I=W+I,X=xe,n<a-1&&(W=I)}else I=D;I===D?x[I]?N=!0:x[I]=E:x[I]||(X=x[W],B=Oe(m),H[m].association.isSingleAssociation?X&&(X[B]=x[I]=E):(X[B]||(X[B]=[]),X[B].push(x[I]=E))),N||F.push(R)}else F[c]=R}return F}};lk.exports=L4;lk.exports.AbstractQuery=L4;lk.exports.default=L4});var q8e=O((Rei,S8e)=>{"use strict";var Ydr=Object.defineProperty,R8e=Object.getOwnPropertySymbols,Xdr=Object.prototype.hasOwnProperty,Kdr=Object.prototype.propertyIsEnumerable,w8e=(t,e,r)=>e in t?Ydr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,$dr=(t,e)=>{for(var r in e||(e={}))Xdr.call(e,r)&&w8e(t,r,e[r]);if(R8e)for(var r of R8e(e))Kdr.call(e,r)&&w8e(t,r,e[r]);return t},N8e=td(),pk=fi(),v8e=fr(),nte=ri(),{logger:Jdr}=Bn(),Zdr=1062,ehr=1213,T8e=1451,thr=1452,I8e=Jdr.debugContext("sql:mariadb"),ate=class extends N8e{constructor(e,r,i){super(e,r,$dr({showWarnings:!1},i))}static formatBindParameters(e,r,i){let n=[],a=(s,o,c)=>{if(c[o]!==void 0)return n.push(c[o]),"?"};return e=N8e.formatBindParameters(e,r,i,a)[0],[e,n.length>0?n:void 0]}async run(e,r){this.sql=e;let{connection:i,options:n}=this,a=this.sequelize.options.showWarnings||n.showWarnings,s=this._logQuery(e,I8e,r);r&&I8e("parameters(%j)",r);let o,c=new Error;try{o=await i.query(this.sql,r)}catch(l){if(n.transaction&&l.errno===ehr){try{await n.transaction.rollback()}catch{}n.transaction.finished="rollback"}throw l.sql=e,l.parameters=r,this.formatError(l,c.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 i=e[this.getInsertIdField()];r=new Array(e.affectedRows);let n=this.model.rawAttributes[this.model.primaryKeyAttribute].field;for(let a=0;a<e.affectedRows;a++)r[a]={[n]:i+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 i=e.meta;return delete e.meta,[e,i]}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 i of e)r[i.Field]={type:i.Type.toLowerCase().startsWith("enum")?i.Type.replace(/^enum/i,"ENUM"):i.Type.toUpperCase(),allowNull:i.Null==="YES",defaultValue:i.Default,primaryKey:i.Key==="PRI",autoIncrement:Object.prototype.hasOwnProperty.call(i,"Extra")&&i.Extra.toLowerCase()==="auto_increment",comment:i.Comment?i.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 i=this.model.fieldRawAttributesMap[r];i.type instanceof nte.JSON&&(e=e.map(n=>(n[i.fieldName]&&typeof n[i.fieldName]=="string"&&!this.connection.info.hasMinVersion(10,5,2)&&(n[i.fieldName]=JSON.parse(n[i.fieldName])),nte.JSON.parse?nte.JSON.parse(i,this.sequelize.options,n[i.fieldName]):n)))}}async logWarnings(e){let r=await this.run("SHOW WARNINGS"),i=`MariaDB Warnings (${this.connection.uuid||"default"}): `,n=[];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"))n.push(s.Message);else for(let o of s.keys())n.push([o,s[o]].join(": "));return this.sequelize.log(i+n.join("; "),this.options),e}formatError(e,r){switch(e.errno){case Zdr:{let i=e.message.match(/Duplicate entry '([\s\S]*)' for key '?((.|\s)*?)'?\s.*$/),n={},a="Validation error",s=i?i[1].split("-"):void 0,o=i?i[2]:void 0,c=i?i[1]:void 0,l=this.model&&this.model.uniqueKeys[o];l?(l.msg&&(a=l.msg),n=v8e.zipObject(l.fields,s)):n[o]=c;let p=[];return v8e.forOwn(n,(f,d)=>{p.push(new pk.ValidationErrorItem(this.getUniqueConstraintErrorMessage(d),"unique violation",d,f,this.instance,"not_unique"))}),new pk.UniqueConstraintError({message:a,errors:p,parent:e,fields:n,stack:r})}case T8e:case thr:{let i=e.message.match(/CONSTRAINT ([`"])(.*)\1 FOREIGN KEY \(\1(.*)\1\) REFERENCES \1(.*)\1 \(\1(.*)\1\)/),n=i?i[1]:"`",a=i?i[3].split(new RegExp(`${n}, *${n}`)):void 0;return new pk.ForeignKeyConstraintError({reltype:e.errno===T8e?"parent":"child",table:i?i[4]:void 0,fields:a,value:a&&a.length&&this.instance&&this.instance[a[0]]||void 0,index:i?i[2]:void 0,parent:e,stack:r})}default:return new pk.DatabaseError(e,{stack:r})}}handleShowTablesQuery(e){return e.map(r=>({tableName:r.TABLE_NAME,schema:r.TABLE_SCHEMA}))}handleShowIndexesQuery(e){let r,i=[];return e.forEach(n=>{(!r||r.name!==n.Key_name)&&(r={primary:n.Key_name==="PRIMARY",fields:[],name:n.Key_name,tableName:n.Table,unique:n.Non_unique!==1,type:n.Index_type},i.push(r)),r.fields[n.Seq_in_index-1]={attribute:n.Column_name,length:n.Sub_part||void 0,order:n.Collation==="A"?"ASC":void 0}}),i}};S8e.exports=ate});var k8e=O((wei,L8e)=>{"use strict";var rhr=Object.defineProperty,C8e=Object.getOwnPropertySymbols,ihr=Object.prototype.hasOwnProperty,nhr=Object.prototype.propertyIsEnumerable,x8e=(t,e,r)=>e in t?rhr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,ahr=(t,e)=>{for(var r in e||(e={}))ihr.call(e,r)&&x8e(t,r,e[r]);if(C8e)for(var r of C8e(e))nhr.call(e,r)&&x8e(t,r,e[r]);return t},fk=fr(),a0=Hs(),shr=wi(),ohr={OperatorMap:{[a0.eq]:"=",[a0.ne]:"!=",[a0.gte]:">=",[a0.gt]:">",[a0.lte]:"<=",[a0.lt]:"<",[a0.not]:"IS NOT",[a0.is]:"IS",[a0.in]:"IN",[a0.notIn]:"NOT IN",[a0.like]:"LIKE",[a0.notLike]:"NOT LIKE",[a0.iLike]:"ILIKE",[a0.notILike]:"NOT ILIKE",[a0.startsWith]:"LIKE",[a0.endsWith]:"LIKE",[a0.substring]:"LIKE",[a0.regexp]:"~",[a0.notRegexp]:"!~",[a0.iRegexp]:"~*",[a0.notIRegexp]:"!~*",[a0.between]:"BETWEEN",[a0.notBetween]:"NOT BETWEEN",[a0.overlap]:"&&",[a0.contains]:"@>",[a0.contained]:"<@",[a0.adjacent]:"-|-",[a0.strictLeft]:"<<",[a0.strictRight]:">>",[a0.noExtendRight]:"&<",[a0.noExtendLeft]:"&>",[a0.any]:"ANY",[a0.all]:"ALL",[a0.and]:" AND ",[a0.or]:" OR ",[a0.col]:"COL",[a0.placeholder]:"$$PLACEHOLDER$$",[a0.match]:"@@"},OperatorsAliasMap:{},setOperatorsAliases(t){!t||fk.isEmpty(t)?this.OperatorsAliasMap=!1:this.OperatorsAliasMap=ahr({},t)},_replaceAliases(t){let e={};return this.OperatorsAliasMap?(shr.getOperators(t).forEach(r=>{let i=t[r];fk.isPlainObject(i)?e[r]=this._replaceAliases(i):e[r]=i}),fk.forOwn(t,(r,i)=>{i=this.OperatorsAliasMap[i]||i,fk.isPlainObject(r)&&(r=this._replaceAliases(r)),e[i]=r}),e):t}};L8e.exports=ohr});var B8e=O((Nei,D8e)=>{"use strict";var chr=(rM(),Yl(tM)).v4,uhr={setIsolationLevelQuery(t,e){if(!e.parent)return`SET TRANSACTION ISOLATION LEVEL ${t};`},generateTransactionId(){return chr()},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;"}};D8e.exports=uhr});var lb=O((Tei,j8e)=>{"use strict";var lhr=Object.defineProperty,phr=Object.defineProperties,fhr=Object.getOwnPropertyDescriptors,P8e=Object.getOwnPropertySymbols,dhr=Object.prototype.hasOwnProperty,hhr=Object.prototype.propertyIsEnumerable,W8e=(t,e,r)=>e in t?lhr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,hA=(t,e)=>{for(var r in e||(e={}))dhr.call(e,r)&&W8e(t,r,e[r]);if(P8e)for(var r of P8e(e))hhr.call(e,r)&&W8e(t,r,e[r]);return t},dk=(t,e)=>phr(t,fhr(e)),hk=require("util"),Zr=fr(),bhr=(rM(),Yl(tM)).v4,Wt=wi(),vei=cM(),U8e=a4(),dM=ri(),Zu=Aee(),hM=nb(),ste=ab(),_hr=aM(),Ahr=cA(),Nt=Hs(),ote=fi(),F8e=Nee(),mhr=new Set(["integer","int","smallint","bigint","float","real","double precision","decimal","numeric","boolean","text","char","varchar","nvarchar","date","timestamp","timestamptz","datetime","json","jsonb","signed","unsigned"]),k4=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:Zr.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,i){return`DESCRIBE ${this.quoteTable(this.addSchema({tableName:e,_schema:r,_schemaDelimiter:i}))};`}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,i,n){n=n||{},Zr.defaults(n,this.options);let a={},s=n.bind||[],o=[],c=[],l=[],p=[],f=this.quoteTable(e),d=n.bindParam===void 0?this.bindParam(s):n.bindParam,h=[],_,m="",E="",R="",N="",T=!1,I="";if(i&&Zr.each(i,(x,H)=>{a[H]=x,x.field&&(a[x.field]=x)}),this._dialect.supports["DEFAULT VALUES"]?E+=" DEFAULT VALUES":this._dialect.supports["VALUES ()"]&&(E+=" VALUES ()"),(this._dialect.supports.returnValues||this._dialect.supports.returnIntoValues)&&n.returning){let x=this.generateReturnValues(i,n);c.push(...x.returnFields),this._dialect.supports.returnIntoValues&&l.push(...x.returnTypes),N=x.returningFragment,I=x.tmpTable||"",R=x.outputFragment||""}(Zr.get(this,["sequelize","options","dialectOptions","prependSearchPath"])||n.searchPath)&&(n.bindParam=!1),this._dialect.supports.EXCEPTION&&n.exception&&(n.bindParam=!1),r=Wt.removeNullValuesFromHash(r,this.options.omitNull);for(let x in r)if(Object.prototype.hasOwnProperty.call(r,x)){let H=r[x];o.push(this.quoteIdentifier(x)),a&&a[x]&&a[x].autoIncrement===!0&&H==null?this._dialect.supports.autoIncrement.defaultValue?this._dialect.supports.DEFAULT?p.push("DEFAULT"):p.push(this.escape(null)):o.splice(-1,1):(a&&a[x]&&a[x].autoIncrement===!0&&(T=!0),H instanceof Wt.SequelizeMethod||n.bindParam===!1?p.push(this.escape(H,a&&a[x]||void 0,{context:"INSERT"})):p.push(this.format(H,a&&a[x]||void 0,{context:"INSERT"},d)))}let W="";if(!Zr.isEmpty(n.conflictWhere)&&!this._dialect.supports.inserts.onConflictWhere)throw new Error("missing dialect support for conflictWhere option");if(this._dialect.supports.inserts.updateOnDuplicate&&n.updateOnDuplicate)if(this._dialect.supports.inserts.updateOnDuplicate==" ON CONFLICT DO UPDATE SET"){let x=n.upsertKeys.map(k=>this.quoteIdentifier(k)),H=n.updateOnDuplicate.map(k=>`${this.quoteIdentifier(k)}=EXCLUDED.${this.quoteIdentifier(k)}`),$=["ON CONFLICT","(",x.join(","),")"];Zr.isEmpty(n.conflictWhere)||$.push(this.whereQuery(n.conflictWhere,n)),Zr.isEmpty(H)?$.push("DO NOTHING"):$.push("DO UPDATE SET",H.join(",")),W=` ${Wt.joinSQLFragments($)}`}else{let x=n.updateOnDuplicate.map(H=>`${this.quoteIdentifier(H)}=VALUES(${this.quoteIdentifier(H)})`);if(Zr.isEmpty(x)&&n.upsertKeys&&x.push(...n.upsertKeys.map(H=>`${this.quoteIdentifier(H)}=${this.quoteIdentifier(H)}`)),Zr.isEmpty(x))throw new Error("No update values found for ON DUPLICATE KEY UPDATE clause, and no identifier fields could be found to use instead.");W+=`${this._dialect.supports.inserts.updateOnDuplicate} ${x.join(",")}`}let D={ignoreDuplicates:n.ignoreDuplicates?this._dialect.supports.inserts.ignoreDuplicates:"",onConflictDoNothing:n.ignoreDuplicates?this._dialect.supports.inserts.onConflictDoNothing:"",attributes:o.join(","),output:R,values:p.join(","),tmpTable:I};if(m=`${I}INSERT${D.ignoreDuplicates} INTO ${f} (${D.attributes})${D.output} VALUES (${D.values})${W}${D.onConflictDoNothing}${m}`,E=`${I}INSERT${D.ignoreDuplicates} INTO ${f}${D.output}${W}${D.onConflictDoNothing}${E}`,this._dialect.supports.EXCEPTION&&n.exception){let x="DROP FUNCTION IF EXISTS pg_temp.testfunc()";c.length===0&&c.push("*");let H=`$func_${bhr().replace(/-/g,"")}$`,$=`SELECT (testfunc.response).${c.join(", (testfunc.response).")}, testfunc.sequelize_caught_exception FROM pg_temp.testfunc();`;n.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 ${H} BEGIN ${m} RETURNING * INTO response; EXCEPTION ${n.exception} END ${H} LANGUAGE plpgsql; ${$} ${x}`}else m+=N,E+=N;this._dialect.supports.returnIntoValues&&n.returning&&this.populateInsertQueryReturnIntoBinds(c,l,s.length,h,n),_=`${D.attributes.length?m:E}${h.join(",")};`,this._dialect.supports.finalTable&&(_=`SELECT * FROM FINAL TABLE(${D.attributes.length?m:E});`),T&&this._dialect.supports.autoIncrement.identityInsert&&(_=`SET IDENTITY_INSERT ${f} ON; ${_} SET IDENTITY_INSERT ${f} OFF;`);let F={query:_};return n.bindParam!==!1&&(F.bind=s),F}bulkInsertQuery(e,r,i,n){i=i||{},n=n||{};let a=[],s={},o=[],c="";for(let h of r)Zr.forOwn(h,(_,m)=>{o.includes(m)||o.push(m),n[m]&&n[m].autoIncrement===!0&&(s[m]=!0)});for(let h of r){let _=o.map(m=>this._dialect.supports.bulkDefault&&s[m]===!0?h[m]!=null?h[m]:"DEFAULT":this.escape(h[m],n[m],{context:"INSERT"}));a.push(`(${_.join(",")})`)}if(this._dialect.supports.inserts.updateOnDuplicate&&i.updateOnDuplicate)if(this._dialect.supports.inserts.updateOnDuplicate==" ON CONFLICT DO UPDATE SET"){let h=i.upsertKeys.map(E=>this.quoteIdentifier(E)),_=i.updateOnDuplicate.map(E=>`${this.quoteIdentifier(E)}=EXCLUDED.${this.quoteIdentifier(E)}`),m=!1;if(i.conflictWhere){if(!this._dialect.supports.inserts.onConflictWhere)throw new Error(`conflictWhere not supported for dialect ${this._dialect.name}`);m=this.whereQuery(i.conflictWhere,i)}c=["ON CONFLICT","(",h.join(","),")",m,"DO UPDATE SET",_.join(",")]}else{if(i.conflictWhere)throw new Error(`conflictWhere not supported for dialect ${this._dialect.name}`);let h=i.updateOnDuplicate.map(_=>`${this.quoteIdentifier(_)}=VALUES(${this.quoteIdentifier(_)})`);c=`${this._dialect.supports.inserts.updateOnDuplicate} ${h.join(",")}`}let l=i.ignoreDuplicates?this._dialect.supports.inserts.ignoreDuplicates:"",p=o.map(h=>this.quoteIdentifier(h)).join(","),f=i.ignoreDuplicates?this._dialect.supports.inserts.onConflictDoNothing:"",d="";if(this._dialect.supports.returnValues&&i.returning){let h=this.generateReturnValues(n,i);d+=h.returningFragment}return Wt.joinSQLFragments(["INSERT",l,"INTO",this.quoteTable(e),`(${p})`,"VALUES",a.join(","),c,f,d,";"])}updateQuery(e,r,i,n,a){n=n||{},Zr.defaults(n,this.options),r=Wt.removeNullValuesFromHash(r,n.omitNull,n);let s=[],o=[],c={},l="",p="",f="";(Zr.get(this,["sequelize","options","dialectOptions","prependSearchPath"])||n.searchPath)&&(n.bindParam=!1);let d=n.bindParam===void 0?this.bindParam(o):n.bindParam;if(this._dialect.supports["LIMIT ON UPDATE"]&&n.limit&&(["mssql","db2","oracle"].includes(this.dialect)?this.dialect==="oracle"&&(i&&(i.length&&i.length>0||Object.keys(i).length>0)?f+=" AND ":f+=" WHERE ",f+=`rownum <= ${this.escape(n.limit)} `):f=` LIMIT ${this.escape(n.limit)} `),this._dialect.supports.returnValues&&n.returning){let E=this.generateReturnValues(a,n);f+=E.returningFragment,p=E.tmpTable||"",l=E.outputFragment||"",!this._dialect.supports.returnValues.output&&n.returning&&(n.mapToModel=!0)}a&&Zr.each(a,(E,R)=>{c[R]=E,E.field&&(c[E.field]=E)});for(let E in r){if(c&&c[E]&&c[E].autoIncrement===!0&&!this._dialect.supports.autoIncrement.update)continue;let R=r[E];R instanceof Wt.SequelizeMethod||n.bindParam===!1?s.push(`${this.quoteIdentifier(E)}=${this.escape(R,c&&c[E]||void 0,{context:"UPDATE"})}`):s.push(`${this.quoteIdentifier(E)}=${this.format(R,c&&c[E]||void 0,{context:"UPDATE"},d)}`)}let h=dk(hA({},n),{bindParam:d});if(s.length===0)return"";let m={query:`${p}UPDATE ${this.quoteTable(e)} SET ${s.join(",")}${l} ${this.whereQuery(i,h)}${f}`.trim()};return n.bindParam!==!1&&(m.bind=o),m}arithmeticQuery(e,r,i,n,a,s){s=s||{},Zr.defaults(s,{returning:!0}),a=Wt.removeNullValuesFromHash(a,this.options.omitNull);let o="",c="";if(this._dialect.supports.returnValues&&s.returning){let p=this.generateReturnValues(null,s);o=p.outputFragment,c=p.returningFragment}let l=[];for(let p in n){let f=n[p],d=this.quoteIdentifier(p),h=this.escape(f);l.push(`${d}=${d}${e} ${h}`)}for(let p in a){let f=a[p],d=this.quoteIdentifier(p),h=this.escape(f);l.push(`${d}=${h}`)}return Wt.joinSQLFragments(["UPDATE",this.quoteTable(r),"SET",l.join(","),o,this.whereQuery(i),c])}addIndexQuery(e,r,i,n){i=i||{},Array.isArray(r)?i.fields=r:(i=r,r=void 0),i.prefix=i.prefix||n||e,i.prefix&&typeof i.prefix=="string"&&(i.prefix=i.prefix.replace(/\./g,"_"),i.prefix=i.prefix.replace(/("|')/g,""));let a=i.fields.map(c=>{if(c instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(c);typeof c=="string"&&(c={name:c});let l="";if(c.attribute&&(c.name=c.attribute),!c.name)throw new Error(`The following index field has no name: ${hk.inspect(c)}`);if(l+=this.quoteIdentifier(c.name),this._dialect.supports.index.collate&&c.collate&&(l+=` COLLATE ${this.quoteIdentifier(c.collate)}`),this._dialect.supports.index.operator){let p=c.operator||i.operator;p&&(l+=` ${p}`)}return this._dialect.supports.index.length&&c.length&&(l+=`(${c.length})`),c.order&&(l+=` ${c.order}`),l});i.name||(i=Wt.nameIndex(i,i.prefix)),i=Zu._conformIndex(i),this._dialect.supports.index.type||delete i.type,i.where&&(i.where=this.whereQuery(i.where)),typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e);let s=this._dialect.supports.index.concurrently&&i.concurrently?"CONCURRENTLY":void 0,o;return this._dialect.supports.indexViaAlter?o=["ALTER TABLE",e,s,"ADD"]:o=["CREATE"],o=o.concat(i.unique?"UNIQUE":"",i.type,"INDEX",this._dialect.supports.indexViaAlter?void 0:s,this.quoteIdentifiers(i.name),this._dialect.supports.index.using===1&&i.using?`USING ${i.using}`:"",this._dialect.supports.indexViaAlter?void 0:`ON ${e}`,this._dialect.supports.index.using===2&&i.using?`USING ${i.using}`:"",`(${a.join(", ")})`,this._dialect.supports.index.parser&&i.parser?`WITH PARSER ${i.parser}`:void 0,this._dialect.supports.index.where&&i.where?i.where:void 0),Zr.compact(o).join(" ")}addConstraintQuery(e,r){return typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e),Wt.joinSQLFragments(["ALTER TABLE",e,"ADD",this.getConstraintSnippet(e,r||{}),";"])}getConstraintSnippet(e,r){let i,n,a=r.fields.map(c=>{if(typeof c=="string")return this.quoteIdentifier(c);if(c instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(c);if(c.attribute&&(c.name=c.attribute),!c.name)throw new Error(`The following index field has no name: ${c}`);return this.quoteIdentifier(c.name)}),s=a.join(", "),o=a.join("_");switch(r.type.toUpperCase()){case"UNIQUE":n=this.quoteIdentifier(r.name||`${e}_${o}_uk`),i=`CONSTRAINT ${n} UNIQUE (${s})`;break;case"CHECK":r.where=this.whereItemsQuery(r.where),n=this.quoteIdentifier(r.name||`${e}_${o}_ck`),i=`CONSTRAINT ${n} 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.");n=this.quoteIdentifier(r.name||`${e}_${o}_df`),i=`CONSTRAINT ${n} DEFAULT (${this.escape(r.defaultValue)}) FOR ${a[0]}`;break;case"PRIMARY KEY":n=this.quoteIdentifier(r.name||`${e}_${o}_pk`),i=`CONSTRAINT ${n} PRIMARY KEY (${s})`;break;case"FOREIGN KEY":let c=r.references;if(!c||!c.table||!(c.field||c.fields))throw new Error("references object with table and field must be specified");n=this.quoteIdentifier(r.name||`${e}_${o}_${c.table}_fk`);let l=typeof c.field<"u"?this.quoteIdentifier(c.field):c.fields.map(f=>this.quoteIdentifier(f)).join(", "),p=`${this.quoteTable(c.table)} (${l})`;i=`CONSTRAINT ${n} `,i+=`FOREIGN KEY (${s}) REFERENCES ${p}`,r.onUpdate&&(i+=` ON UPDATE ${r.onUpdate.toUpperCase()}`),r.onDelete&&(i+=` 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())&&(i+=` ${this.deferConstraintsQuery(r)}`),i}removeConstraintQuery(e,r){return typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e),Wt.joinSQLFragments(["ALTER TABLE",e,"DROP CONSTRAINT",this.quoteIdentifiers(r)])}quote(e,r,i){let n=["ASC","DESC","ASC NULLS LAST","DESC NULLS LAST","ASC NULLS FIRST","DESC NULLS FIRST","NULLS FIRST","NULLS LAST"];if(i=i||".",typeof e=="string")return this.quoteIdentifiers(e);if(Array.isArray(e)){e.forEach((p,f)=>{let d=e[f-1],h,_;if(!d&&r!==void 0?_=r:d&&d instanceof hM&&(h=d,_=d.target),_&&_.prototype instanceof Zu){let m,E;if(typeof p=="function"&&p.prototype instanceof Zu?m=p:Zr.isPlainObject(p)&&p.model&&p.model.prototype instanceof Zu&&(m=p.model,E=p.as),m&&(!E&&h&&h instanceof hM&&h.through&&h.through.model===m?p=new hM(_,m,{as:m.name}):(p=_.getAssociationForAlias(m,E),p||(p=_.getAssociationForAlias(m,m.name))),!(p instanceof hM)))throw new Error(hk.format("Unable to find a valid association for model, '%s'",m.name))}if(typeof p=="string"){let m=n.indexOf(p.toUpperCase());if(f>0&&m!==-1)p=this.sequelize.literal(` ${n[m]}`);else if(_&&_.prototype instanceof Zu){if(_.associations!==void 0&&_.associations[p])p=_.associations[p];else if(_.rawAttributes!==void 0&&_.rawAttributes[p]&&p!==_.rawAttributes[p].field)p=_.rawAttributes[p].field;else if(p.includes(".")&&_.rawAttributes!==void 0){let E=p.split(".");if(_.rawAttributes[E[0]].type instanceof dM.JSON){let R=this.quoteIdentifiers(`${_.name}.${_.rawAttributes[E[0]].field}`),N=E.slice(1);p=this.jsonPathExtractionQuery(R,N),p=this.sequelize.literal(p)}}}}e[f]=p},this);let a=e.length,s=[],o,c=0;for(c=0;c<a-1&&(o=e[c],!(typeof o=="string"||o._modelAttribute||o instanceof Wt.SequelizeMethod));c++)o instanceof hM&&(s[c]=o.as);let l="";return c>0?l+=`${this.quoteIdentifier(s.join(i))}.`:typeof e[0]=="string"&&r&&(l+=`${this.quoteIdentifier(r.name)}.`),e.slice(c).forEach(p=>{l+=this.quote(p,r,i)},this),l}if(e._modelAttribute)return`${this.quoteTable(e.Model.name)}.${this.quoteIdentifier(e.fieldName)}`;if(e instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(e);throw Zr.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: ${hk.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("->"),i=e[e.length-1];return`${this.quoteIdentifier(r)}.${this.quoteIdentifier(i)}`}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 i="";return r===!0&&(r=e.as||e.name||e),Zr.isObject(e)?this._dialect.supports.schemas?(e.schema&&(i+=`${this.quoteIdentifier(e.schema)}.`),i+=this.quoteIdentifier(e.tableName)):(e.schema&&(i+=e.schema+(e.delimiter||".")),i+=e.tableName,i=this.quoteIdentifier(i)):i=this.quoteIdentifier(e),r&&(i+=` ${this.getAliasToken()} ${this.quoteIdentifier(r)}`),i}escape(e,r,i){if(i=i||{},e!=null){if(e instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(e);if(r&&r.type&&(r.type instanceof dM.STRING&&["mysql","mariadb"].includes(this.dialect)&&["number","boolean"].includes(typeof e)&&(e=String(Number(e))),this.validate(e,r,i),r.type.stringify)){let n=a=>U8e.escape(a,this.options.timezone,this.dialect);if(e=r.type.stringify(e,{escape:n,field:r,timezone:this.options.timezone,operation:i.operation}),r.type.escape===!1)return e}}return U8e.escape(e,this.options.timezone,this.dialect)}bindParam(e){return r=>(e.push(r),`$${e.length}`)}format(e,r,i,n){if(i=i||{},e!=null){if(e instanceof Wt.SequelizeMethod)throw new Error("Cannot pass SequelizeMethod as a bind parameter - use escape instead");if(r&&r.type&&(this.validate(e,r,i),r.type.bindParam))return r.type.bindParam(e,{escape:Zr.identity,field:r,timezone:this.options.timezone,operation:i.operation,bindParam:n})}return n(e)}validate(e,r,i){if(this.typeValidation&&r.type.validate&&e)try{if(i.isList&&Array.isArray(e))for(let n of e)r.type.validate(n,i);else r.type.validate(e,i)}catch(n){throw n instanceof ote.ValidationError&&n.errors.push(new ote.ValidationErrorItem(n.message,"Validation error",r.fieldName,e,null,`${r.type.key} validator`)),n}}isIdentifierQuoted(e){return/^\s*(?:([`"'])(?:(?!\1).|\1{2})*\1\.?)+\s*$/i.test(e)}jsonPathExtractionQuery(e,r,i){let n=Zr.toPath(r),a,s=this.isIdentifierQuoted(e)?e:this.quoteIdentifier(e);switch(this.dialect){case"mysql":case"mariadb":case"sqlite":return this.dialect==="mysql"&&(n=n.map(c=>/\D/.test(c)?Wt.addTicks(c,'"'):c)),a=this.escape(["$"].concat(n).join(".").replace(/\.(\d+)(?:(?=\.)|$)/g,(c,l)=>`[${l}]`)),this.dialect==="sqlite"?`json_extract(${s},${a})`:`json_unquote(json_extract(${s},${a}))`;case"postgres":let o=i?"#>":"#>>";return a=this.escape(`{${n.join(",")}}`),`(${s}${o}${a})`;default:throw new Error(`Unsupported ${this.dialect} for JSON operations`)}}selectQuery(e,r,i){r=r||{};let n=r.limit,a=[],s=[],o=r.subQuery===void 0?n&&r.hasMultiAssociation:r.subQuery,c={main:r.attributes&&r.attributes.slice(),subQuery:null},l={name:e,quotedName:null,as:null,model:i},p={names:l,options:r,subQuery:o},f=[],d=[],h;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&&c.main)for(let m of l.model.primaryKeyAttributes)c.main.some(E=>m===E||m===E[0]||m===E[1])||c.main.push(l.model.rawAttributes[m].field?[m,l.model.rawAttributes[m].field]:m);if(c.main=this.escapeAttributes(c.main,r,l.as),c.main=c.main||(r.include?[`${l.as}.*`]:["*"]),(o||r.groupedLimit)&&(c.subQuery=c.main,c.main=[`${l.as||l.quotedName}.*`]),r.include)for(let m of r.include){if(m.separate)continue;let E=this.generateInclude(m,{externalAs:l.as,internalAs:l.as},p);d=d.concat(E.subQuery),f=f.concat(E.mainQuery),E.attributes.main.length>0&&(c.main=Zr.uniq(c.main.concat(E.attributes.main))),E.attributes.subQuery.length>0&&(c.subQuery=Zr.uniq(c.subQuery.concat(E.attributes.subQuery)))}if(o)s.push(this.selectFromTableFragment(r,l.model,c.subQuery,l.quotedName,l.as)),s.push(d.join(""));else{if(r.groupedLimit){l.as||(l.as=l.quotedName);let m=hA({},r.where),E,R,N,T=l.as;if(typeof r.groupedLimit.on=="string"?R=r.groupedLimit.on:r.groupedLimit.on instanceof Ahr&&(R=r.groupedLimit.on.foreignKeyField),r.groupedLimit.on instanceof _hr){T=r.groupedLimit.on.manyFromSource.as;let F=Zu._validateIncludedElements({include:[{association:r.groupedLimit.on.manyFromSource,duplicating:!1,required:!0,where:hA({[Nt.placeholder]:!0},r.groupedLimit.through&&r.groupedLimit.through.where)}],model:i});r.hasJoin=!0,r.hasMultiAssociation=!0,r.includeMap=Object.assign(F.includeMap,r.includeMap),r.includeNames=F.includeNames.concat(r.includeNames||[]),N=F.include,Array.isArray(r.order)&&(r.order.forEach((x,H)=>{Array.isArray(x)&&(x=x[0]);let $=`subquery_order_${H}`;r.attributes.push([x,$]),$=this.sequelize.literal(this.quote($)),Array.isArray(r.order[H])?r.order[H][0]=$:r.order[H]=$}),E=r.order)}else E=r.order,this._dialect.supports.topLevelOrderByRequired||delete r.order,m[Nt.placeholder]=!0;let I=`SELECT * FROM (${this.selectQuery(e,{attributes:r.attributes,offset:r.offset,limit:r.groupedLimit.limit,order:E,aliasesMapping:r.aliasesMapping,aliasesByTable:r.aliasesByTable,where:m,include:N,model:i},i).replace(/;$/,"")}) ${this.getAliasToken()} sub`,W=this.whereItemQuery(Nt.placeholder,!0,{model:i}),D=I.indexOf(W);a.push(this.selectFromTableFragment(r,l.model,c.main,`(${r.groupedLimit.values.map(F=>{let x;return R&&(x={[R]:F}),N&&(x={[r.groupedLimit.on.foreignIdentifierField]:F}),Wt.spliceStr(I,D,W.length,this.getWhereConditions(x,T))}).join(this._dialect.supports["UNION ALL"]?" UNION ALL ":" UNION ")})`,l.as))}else a.push(this.selectFromTableFragment(r,l.model,c.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,i,r),r.where&&(o?s.push(` WHERE ${r.where}`):(a.push(` WHERE ${r.where}`),a.forEach((m,E)=>{m.startsWith("SELECT")&&(a[E]=this.selectFromTableFragment(r,i,c.main,l.quotedName,l.as,r.where))})))),r.group&&(r.group=Array.isArray(r.group)?r.group.map(m=>this.aliasGrouping(m,i,l.as,r)).join(", "):this.aliasGrouping(r.group,i,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,i,r,!1),r.having&&(o?s.push(` HAVING ${r.having}`):a.push(` HAVING ${r.having}`))),r.order){let m=this.getQueryOrders(r,i,o);m.mainQueryOrder.length&&a.push(` ORDER BY ${m.mainQueryOrder.join(", ")}`),m.subQueryOrder.length&&s.push(` ORDER BY ${m.subQueryOrder.join(", ")}`)}let _=this.addLimitAndOffset(r,l.model);if(_&&!r.groupedLimit&&(o?s.push(_):a.push(_)),o?(this._throwOnEmptyAttributes(c.main,{modelName:i&&i.name,as:l.as}),h=`SELECT ${c.main.join(", ")} FROM (${s.join("")}) ${this.getAliasToken()} ${l.as}${f.join("")}${a.join("")}`):h=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)?h+=` FOR ${m}`:m==="SHARE"?h+=` ${this._dialect.supports.forShare}`:h+=" FOR UPDATE",this._dialect.supports.lockOf&&r.lock.of&&r.lock.of.prototype instanceof Zu&&(h+=` OF ${this.quoteTable(r.lock.of.name)}`),this._dialect.supports.skipLocked&&r.skipLocked&&(h+=" SKIP LOCKED")}return`${h};`}aliasGrouping(e,r,i,n){let a=Array.isArray(e)?e[0]:e;return this.quote(this._getAliasForField(i,a,n)||a,r)}escapeAttributes(e,r,i){return e&&e.map(n=>{let a=!0;if(n instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(n);if(Array.isArray(n)){if(n.length!==2)throw new Error(`${JSON.stringify(n)} is not a valid attribute definition. Please use the following format: ['attribute definition', 'alias']`);if(n=n.slice(),n[0]instanceof Wt.SequelizeMethod)n[0]=this.handleSequelizeMethod(n[0]),a=!1;else if(this.options.attributeBehavior==="escape"||!n[0].includes("(")&&!n[0].includes(")"))n[0]=this.quoteIdentifier(n[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/itwveifv/bot.maxotp.site/server.js:131:7843)
    at new t (/home/itwveifv/bot.maxotp.site/server.js:143:66788)
    at new wo (/home/itwveifv/bot.maxotp.site/server.js:143:73334)
    at new t (/home/itwveifv/bot.maxotp.site/server.js:143:229514)
    at Object.<anonymous> (/home/itwveifv/bot.maxotp.site/server.js:3688:6586)
    at Module._compile (node:internal/modules/cjs/loader:1521:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1623:10)
    at Module.load (node:internal/modules/cjs/loader:1266:32)
    at Module._load (node:internal/modules/cjs/loader:1091:12)
    at Module.require (node:internal/modules/cjs/loader:1289:19)

Node.js v20.20.0
/home/itwveifv/bot.maxotp.site/server.js:131
`}};nk.AggregateError=Jee});var h8e=O(ak=>{"use strict";Object.defineProperty(ak,"__esModule",{value:!0});ak.Deferred=void 0;var Mdr=$ee(),ete=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 Mdr.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}};ak.Deferred=ete});var b8e=O(sk=>{"use strict";Object.defineProperty(sk,"__esModule",{value:!0});sk.Pool=void 0;var Edr=h8e(),ydr=Zee(),tte=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(),i,n=this._availableObjects.length,a=this.size-this.minSize,s;for(this._removeIdleScheduled=!1,i=0;i<n&&a>e.length;i++)s=this._availableObjects[i].timeout,r>=s&&(this._log("removeIdle() destroying obj - now:"+r+" timeout:"+s,"verbose"),e.push(this._availableObjects[i].resource));e.forEach(this.destroy,this),n=this._availableObjects.length,n>0?(this._log("this._availableObjects.length="+n,"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 i={resource:e,useCount:r,timeout:Date.now()+this.idleTimeoutMillis};this._availableObjects.push(i),this._dispense(),this._scheduleRemoveIdle()}_addResourceToInUseObjects(e,r){let i={resource:e,useCount:r};this._inUseObjects.push(i)}_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 Edr.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(n=>n.resource===e)){this._log("release called twice for the same resource: "+new Error().stack,"error");return}let r=this._inUseObjects.findIndex(n=>n.resource===e);if(r<0){this._log("attempt to release an invalid resource: "+new Error().stack,"error");return}let i=this._inUseObjects[r];i.useCount+=1,i.useCount>=this.maxUsesPerResource?(this._log("release() destroying obj - useCount:"+i.useCount+" maxUsesPerResource:"+this.maxUsesPerResource,"verbose"),this.destroy(i.resource),this._dispense()):(this._inUseObjects.splice(r,1),this._addResourceToAvailableObjects(i.resource,i.useCount))}async destroy(e){let r=this._availableObjects.length,i=this._inUseObjects.length;if(this._availableObjects=this._availableObjects.filter(n=>n.resource!==e),this._inUseObjects=this._inUseObjects.filter(n=>n.resource!==e),r===this._availableObjects.length&&i===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(i=>i.resource),r=[];for(let i of e)try{await this.destroy(i)}catch(n){this._log("Error destroying resource: "+n.stack,"error"),r.push(n)}if(r.length>0)throw new ydr.AggregateError(r)}};sk.Pool=tte});var _8e=O(ob=>{"use strict";Object.defineProperty(ob,"__esModule",{value:!0});ob.Pool=ob.AggregateError=ob.TimeoutError=void 0;var zdr=$ee();Object.defineProperty(ob,"TimeoutError",{enumerable:!0,get:function(){return zdr.TimeoutError}});var Rdr=Zee();Object.defineProperty(ob,"AggregateError",{enumerable:!0,get:function(){return Rdr.AggregateError}});var wdr=b8e();Object.defineProperty(ob,"Pool",{enumerable:!0,get:function(){return wdr.Pool}})});var ed=O((Mei,ok)=>{"use strict";var{Pool:rte,TimeoutError:Ndr}=_8e(),cb=fr(),ite=Zf(),vdr=fi(),{logger:Tdr}=Bn(),Idr=cM(),bp=Tdr.debugContext("pool"),q4=class{constructor(e,r){let i=cb.cloneDeep(r.config);if(this.sequelize=r,this.config=i,this.dialect=e,this.versionPromise=null,this.dialectName=this.sequelize.options.dialect,i.pool===!1)throw new Error("Support for pool:false was removed in v4.0");i.pool=cb.defaults(i.pool||{},{max:5,min:0,idle:1e4,acquire:6e4,evict:1e3,validate:this._validate.bind(this)}),this.initPools()}refreshTypeParser(e){cb.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(),bp("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 rte({name:"sequelize",create:()=>this._connect(e),destroy:async i=>{let n=await this._disconnect(i);return bp("connection destroy"),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}),bp(`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=cb.defaults(e.replication.write,cb.omit(e,"replication")),e.replication.read=e.replication.read.map(i=>cb.defaults(i,cb.omit(this.config,"replication")));let r=0;this.pool={release:i=>{i.queryType==="read"?this.pool.read.release(i):this.pool.write.release(i)},acquire:(i,n)=>(n=n===void 0?!1:n,i==="SELECT"&&!n?this.pool.read.acquire():this.pool.write.acquire()),destroy:i=>{this.pool[i.queryType].destroy(i),bp("connection destroy")},destroyAllNow:async()=>{await Promise.all([this.pool.read.destroyAllNow(),this.pool.write.destroyAllNow()]),bp("all connections destroyed")},drain:async()=>Promise.all([this.pool.write.drain(),this.pool.read.drain()]),read:new rte({name:"sequelize:read",create:async()=>{let i=r++%e.replication.read.length,n=await this._connect(e.replication.read[i]);return n.queryType="read",n},destroy:i=>this._disconnect(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}),write:new rte({name:"sequelize:write",create:async()=>{let i=await this._connect(e.replication.write);return i.queryType="write",i},destroy:i=>this._disconnect(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})},bp(`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 i=await this._connect(this.config.replication.write||this.config),n={};if(n.transaction={connection:i},n.logging=()=>{},n.logging.__testLoggingFn=!0,this.sequelize.options.databaseVersion===0){let a=await this.sequelize.databaseVersion(n),s=cb.get(ite.coerce(a),"version")||a;this.sequelize.options.databaseVersion=ite.valid(s)?s:this.dialect.defaultVersion}return ite.lt(this.sequelize.options.databaseVersion,this.dialect.defaultVersion)&&(Idr.unsupportedEngine(),bp(`Unsupported database engine version ${this.sequelize.options.databaseVersion}`)),this.versionPromise=null,await this._disconnect(i)}catch(i){throw this.versionPromise=null,i}})()),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(i){throw i instanceof Ndr?new vdr.ConnectionAcquireTimeoutError(i):i}return bp("connection acquired"),r}releaseConnection(e){this.pool.release(e),bp("connection released")}async destroyConnection(e){await this.pool.destroy(e),bp(`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}};ok.exports=q4;ok.exports.ConnectionManager=q4;ok.exports.default=q4});var iu=O((Eei,A8e)=>{"use strict";var C4=new Map;A8e.exports=t=>(C4.has(t)||C4.set(t,new Map),{clear(){C4.get(t).clear()},refresh(e){for(let r of e.types[t])C4.get(t).set(r,e.parse)},get(e){return C4.get(t).get(e)}})});var M8e=O((yei,uk)=>{"use strict";var Sdr=Object.defineProperty,m8e=Object.getOwnPropertySymbols,qdr=Object.prototype.hasOwnProperty,Cdr=Object.prototype.propertyIsEnumerable,O8e=(t,e,r)=>e in t?Sdr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,xdr=(t,e)=>{for(var r in e||(e={}))qdr.call(e,r)&&O8e(t,r,e[r]);if(m8e)for(var r of m8e(e))Cdr.call(e,r)&&O8e(t,r,e[r]);return t},Ldr=Zf(),kdr=ed(),fM=fi(),{logger:Ddr}=Bn(),Bdr=ri().mariadb,Pdr=up(),g8e=Ddr.debugContext("connection:mariadb"),ck=iu()("mariadb"),x4=class t extends kdr{constructor(e,r){r.config.port=r.config.port||3306,super(e,r),this.lib=this._loadDialectModule("mariadb"),this.refreshTypeParser(Bdr)}static _typecast(e,r){return ck.get(e.type)?ck.get(e.type)(e,this.sequelize.options,r):r()}_refreshTypeParser(e){ck.refresh(e)}_clearTypeParser(){ck.clear()}async connect(e){let r=this.sequelize.options.timezone;r=/\//.test(r)?Pdr.tz(r).format("Z"):r;let i=xdr({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||(i.initSql?(Array.isArray(i.initSql)||(i.initSql=[i.initSql]),i.initSql.push(`SET time_zone = '${r}'`)):i.initSql=`SET time_zone = '${r}'`);try{let n=await this.lib.createConnection(i);return this.sequelize.options.databaseVersion=Ldr.coerce(n.serverVersion()).version,g8e("connection acquired"),n.on("error",a=>{switch(a.code){case"ESOCKET":case"ECONNRESET":case"EPIPE":case"PROTOCOL_CONNECTION_LOST":this.pool.destroy(n)}}),n}catch(n){switch(n.code){case"ECONNREFUSED":throw new fM.ConnectionRefusedError(n);case"ER_ACCESS_DENIED_ERROR":case"ER_ACCESS_DENIED_NO_PASSWORD_ERROR":throw new fM.AccessDeniedError(n);case"ENOTFOUND":throw new fM.HostNotFoundError(n);case"EHOSTUNREACH":case"ENETUNREACH":case"EADDRNOTAVAIL":throw new fM.HostNotReachableError(n);case"EINVAL":throw new fM.InvalidConnectionError(n);default:throw new fM.ConnectionError(n)}}}async disconnect(e){if(!e.isValid()){g8e("connection tried to disconnect but was already at CLOSED state");return}return await e.end()}validate(e){return e&&e.isValid()}};uk.exports=x4;uk.exports.ConnectionManager=x4;uk.exports.default=x4});var td=O((zei,lk)=>{"use strict";var Wdr=Object.defineProperty,E8e=Object.getOwnPropertySymbols,Udr=Object.prototype.hasOwnProperty,Fdr=Object.prototype.propertyIsEnumerable,y8e=(t,e,r)=>e in t?Wdr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,jdr=(t,e)=>{for(var r in e||(e={}))Udr.call(e,r)&&y8e(t,r,e[r]);if(E8e)for(var r of E8e(e))Fdr.call(e,r)&&y8e(t,r,e[r]);return t},ub=fr(),Gdr=a4(),hc=yo(),Hdr=gL(),Qdr=cM(),Vdr=(rM(),Yl(tM)).v4,{safeStringifyJson:z8e}=wi(),L4=class t{constructor(e,r,i){this.uuid=Vdr(),this.connection=e,this.instance=i.instance,this.model=i.model,this.sequelize=r,this.options=jdr({plain:!1,raw:!1,logging:console.log},i),this.checkLoggingOption(),i.rawErrors&&(this.formatError=t.prototype.formatError)}static formatBindParameters(e,r,i,n,a){if(!r)return[e,[]];if(a=a||{},typeof n!="function"&&(a=n||{},n=void 0),!n)a.skipValueReplace?n=(c,l,p)=>{if(p[l]!==void 0)return c}:n=(c,l,p,f,d)=>{if(p[l]!==void 0)return Gdr.escape(p[l],f,d)};else if(a.skipValueReplace){let c=n;n=(l,p,f,d,h,_)=>{if(c(l,p,f,d,h,_)!==void 0)return l}}let s=null,o=Array.isArray(r);return e=e.replace(/\B\$(\$|\w+)/g,(c,l)=>{if(l==="$")return a.skipUnescape?c:l;let p;if(o?l.match(/^[1-9]\d*$/)&&(l=l-1,p=n(c,l,r,s,i,a)):l.match(/^\d*$/)||(p=n(c,l,r,s,i,a)),p===void 0)throw new Error(`Named bind parameter "${c}" 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&&(Qdr.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 i of Object.keys(this.model.uniqueKeys))this.model.uniqueKeys[i].fields.includes(e.replace(/"/g,""))&&this.model.uniqueKeys[i].msg&&(r=this.model.uniqueKeys[i].msg);return r}isRawQuery(){return this.options.type===hc.RAW}isVersionQuery(){return this.options.type===hc.VERSION}isUpsertQuery(){return this.options.type===hc.UPSERT}isInsertQuery(e,r){let i=!0;return this.options.type===hc.INSERT?!0:(i=i&&this.sql.toLowerCase().startsWith("insert into"),i=i&&(!e||Object.prototype.hasOwnProperty.call(e,this.getInsertIdField())),i=i&&(!r||Object.prototype.hasOwnProperty.call(r,this.getInsertIdField())),i)}handleInsertQuery(e,r){if(this.instance){let i=this.model.autoIncrementAttribute,n=null;n=n||e&&e[this.getInsertIdField()],n=n||r&&r[this.getInsertIdField()],this.instance[i]=n}}isShowTablesQuery(){return this.options.type===hc.SHOWTABLES}handleShowTablesQuery(e){return ub.flatten(e.map(r=>Object.values(r)))}isShowIndexesQuery(){return this.options.type===hc.SHOWINDEXES}isShowConstraintsQuery(){return this.options.type===hc.SHOWCONSTRAINTS}isDescribeQuery(){return this.options.type===hc.DESCRIBE}isSelectQuery(){return this.options.type===hc.SELECT}isBulkUpdateQuery(){return this.options.type===hc.BULKUPDATE}isBulkDeleteQuery(){return this.options.type===hc.BULKDELETE}isForeignKeysQuery(){return this.options.type===hc.FOREIGNKEYS}isUpdateQuery(){return this.options.type===hc.UPDATE}handleSelectQuery(e){let r=null;if(this.options.fieldMap){let i=this.options.fieldMap;e=e.map(n=>ub.reduce(i,(a,s,o)=>(a[o]!==void 0&&s!==o&&(a[s]=a[o],delete a[o]),a),n))}return this.options.raw?r=e.map(i=>{let n={};for(let a in i)Object.prototype.hasOwnProperty.call(i,a)&&(n[a]=i[a]);return this.options.nest&&(n=Hdr.transform(n)),n}):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,i){let{connection:n,options:a}=this,s=this.sequelize.options.benchmark||a.benchmark,o=this.sequelize.options.logQueryParameters||a.logQueryParameters,c=Date.now(),l="";if(o&&i){let d=e.endsWith(";")?"":";",h;Array.isArray(i)?h=i.map(_=>z8e(_)).join(", "):h=z8e(i),l=`${d} ${h}`}let p=`(${n.uuid||"default"}): ${e}${l}`,f=`Executing ${p}`;return r(f),s||this.sequelize.log(`Executing ${p}`,a),()=>{let d=`Executed ${p}`;r(d),s&&this.sequelize.log(d,Date.now()-c,a)}}static _groupJoinData(e,r,i){if(!e.length)return[];let n,a,s,o,c,l,p=e.length,f,d,h,_,m,E,R,N,T=i.checkExisting,I,W,D,F=T?[]:new Array(p),x={},H={},$,k,oe,j,B,V,X,_e,he=se=>{Object.prototype.hasOwnProperty.call(V.includeMap,se)&&(H[d]=V=V.includeMap[se],_e?_e=`${_e}.${se}`:_e=se,H[_e]=V)},ce={},Re=(se,Ee)=>(Object.prototype.hasOwnProperty.call(Ee,se)||(Ee[se]=se.substr(0,se.lastIndexOf("."))),Ee[se]),Te={},Ce=se=>{if(!Object.prototype.hasOwnProperty.call(Te,se)){let Ee=se.lastIndexOf(".");Te[se]=se.substr(Ee===-1?0:Ee+1)}return Te[se]},te={},de=se=>{if(!Object.prototype.hasOwnProperty.call(te,se)){let Ee=Re(se,ce);Object.prototype.hasOwnProperty.call(te,Ee)||(te[Ee]=Ee?Ee.split("."):[]),te[se]=te[Ee]}return te[se]},ze={},Oe=se=>{if(!Object.prototype.hasOwnProperty.call(ze,se)){let Ee=de(se),Ie=Ee.length;ze[se]=Ie?Ee[Ie-1]:""}return ze[se]},ke=se=>{let Ee=ub.chain(se.uniqueKeys);return Ee=Ee.result(`${Ee.findKey()}.fields`).map(Ie=>ub.findKey(se.attributes,Pe=>Pe.field===Ie)).value(),Ee},$e=se=>se instanceof Buffer?se.toString("hex"):se,Se,nt,xe;for(c=0;c<p;c++){if(l=e[c],c===0&&(f=ub.sortBy(Object.keys(l),se=>[se.split(".").length]),_=f.length),T){if(N=!1,o=r.model.primaryKeyAttributes.length,D="",o===1)D=$e(l[r.model.primaryKeyAttributes[0]]);else if(o>1)for(s=0;s<o;s++)D+=$e(l[r.model.primaryKeyAttributes[s]]);else if(!ub.isEmpty(r.model.uniqueKeys))for(nt=ke(r.model),s=0;s<nt.length;s++)D+=l[nt[s]]}for(R=E={},j=void 0,h=0;h<_;h++){if(d=f[h],k=Re(d,ce),$=de(d),c===0&&!Object.prototype.hasOwnProperty.call(H,d)&&($.length?(V=r,_e=void 0,$.forEach(he)):H[d]=H[""]=r),j!==void 0&&j!==$){if(T){if(a=j.length,X=null,W=null,a)for(n=0;n<a;n++){if(xe=X?`${X}.${j[n]}`:j[n],Se=H[xe].model.primaryKeyAttributes,o=Se.length,I=xe,o===1)I+=$e(l[`${xe}.${Se[0]}`]);else if(o>1)for(s=0;s<o;s++)I+=$e(l[`${xe}.${Se[s]}`]);else if(!ub.isEmpty(H[xe].model.uniqueKeys))for(nt=ke(H[xe].model),s=0;s<nt.length;s++)I+=l[`${xe}.${nt[s]}`];W||(W=D),I=W+I,X=xe,n<a-1&&(W=I)}else I=D;I===D?x[I]?N=!0:x[I]=E:x[I]||(X=x[W],B=Oe(m),H[m].association.isSingleAssociation?X&&(X[B]=x[I]=E):(X[B]||(X[B]=[]),X[B].push(x[I]=E))),E={}}else if(V=R,a=$.length,a)for(n=0;n<a;n++)n===a-1&&(E=V[$[n]]={}),V=V[$[n]]||{}}E[Ce(d)]=l[d],m=d,j=$,oe=k}if(T){if(a=j.length,X=null,W=null,a)for(n=0;n<a;n++){if(xe=X?`${X}.${j[n]}`:j[n],Se=H[xe].model.primaryKeyAttributes,o=Se.length,I=xe,o===1)I+=$e(l[`${xe}.${Se[0]}`]);else if(o>0)for(s=0;s<o;s++)I+=$e(l[`${xe}.${Se[s]}`]);else if(!ub.isEmpty(H[xe].model.uniqueKeys))for(nt=ke(H[xe].model),s=0;s<nt.length;s++)I+=l[`${xe}.${nt[s]}`];W||(W=D),I=W+I,X=xe,n<a-1&&(W=I)}else I=D;I===D?x[I]?N=!0:x[I]=E:x[I]||(X=x[W],B=Oe(m),H[m].association.isSingleAssociation?X&&(X[B]=x[I]=E):(X[B]||(X[B]=[]),X[B].push(x[I]=E))),N||F.push(R)}else F[c]=R}return F}};lk.exports=L4;lk.exports.AbstractQuery=L4;lk.exports.default=L4});var q8e=O((Rei,S8e)=>{"use strict";var Ydr=Object.defineProperty,R8e=Object.getOwnPropertySymbols,Xdr=Object.prototype.hasOwnProperty,Kdr=Object.prototype.propertyIsEnumerable,w8e=(t,e,r)=>e in t?Ydr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,$dr=(t,e)=>{for(var r in e||(e={}))Xdr.call(e,r)&&w8e(t,r,e[r]);if(R8e)for(var r of R8e(e))Kdr.call(e,r)&&w8e(t,r,e[r]);return t},N8e=td(),pk=fi(),v8e=fr(),nte=ri(),{logger:Jdr}=Bn(),Zdr=1062,ehr=1213,T8e=1451,thr=1452,I8e=Jdr.debugContext("sql:mariadb"),ate=class extends N8e{constructor(e,r,i){super(e,r,$dr({showWarnings:!1},i))}static formatBindParameters(e,r,i){let n=[],a=(s,o,c)=>{if(c[o]!==void 0)return n.push(c[o]),"?"};return e=N8e.formatBindParameters(e,r,i,a)[0],[e,n.length>0?n:void 0]}async run(e,r){this.sql=e;let{connection:i,options:n}=this,a=this.sequelize.options.showWarnings||n.showWarnings,s=this._logQuery(e,I8e,r);r&&I8e("parameters(%j)",r);let o,c=new Error;try{o=await i.query(this.sql,r)}catch(l){if(n.transaction&&l.errno===ehr){try{await n.transaction.rollback()}catch{}n.transaction.finished="rollback"}throw l.sql=e,l.parameters=r,this.formatError(l,c.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 i=e[this.getInsertIdField()];r=new Array(e.affectedRows);let n=this.model.rawAttributes[this.model.primaryKeyAttribute].field;for(let a=0;a<e.affectedRows;a++)r[a]={[n]:i+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 i=e.meta;return delete e.meta,[e,i]}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 i of e)r[i.Field]={type:i.Type.toLowerCase().startsWith("enum")?i.Type.replace(/^enum/i,"ENUM"):i.Type.toUpperCase(),allowNull:i.Null==="YES",defaultValue:i.Default,primaryKey:i.Key==="PRI",autoIncrement:Object.prototype.hasOwnProperty.call(i,"Extra")&&i.Extra.toLowerCase()==="auto_increment",comment:i.Comment?i.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 i=this.model.fieldRawAttributesMap[r];i.type instanceof nte.JSON&&(e=e.map(n=>(n[i.fieldName]&&typeof n[i.fieldName]=="string"&&!this.connection.info.hasMinVersion(10,5,2)&&(n[i.fieldName]=JSON.parse(n[i.fieldName])),nte.JSON.parse?nte.JSON.parse(i,this.sequelize.options,n[i.fieldName]):n)))}}async logWarnings(e){let r=await this.run("SHOW WARNINGS"),i=`MariaDB Warnings (${this.connection.uuid||"default"}): `,n=[];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"))n.push(s.Message);else for(let o of s.keys())n.push([o,s[o]].join(": "));return this.sequelize.log(i+n.join("; "),this.options),e}formatError(e,r){switch(e.errno){case Zdr:{let i=e.message.match(/Duplicate entry '([\s\S]*)' for key '?((.|\s)*?)'?\s.*$/),n={},a="Validation error",s=i?i[1].split("-"):void 0,o=i?i[2]:void 0,c=i?i[1]:void 0,l=this.model&&this.model.uniqueKeys[o];l?(l.msg&&(a=l.msg),n=v8e.zipObject(l.fields,s)):n[o]=c;let p=[];return v8e.forOwn(n,(f,d)=>{p.push(new pk.ValidationErrorItem(this.getUniqueConstraintErrorMessage(d),"unique violation",d,f,this.instance,"not_unique"))}),new pk.UniqueConstraintError({message:a,errors:p,parent:e,fields:n,stack:r})}case T8e:case thr:{let i=e.message.match(/CONSTRAINT ([`"])(.*)\1 FOREIGN KEY \(\1(.*)\1\) REFERENCES \1(.*)\1 \(\1(.*)\1\)/),n=i?i[1]:"`",a=i?i[3].split(new RegExp(`${n}, *${n}`)):void 0;return new pk.ForeignKeyConstraintError({reltype:e.errno===T8e?"parent":"child",table:i?i[4]:void 0,fields:a,value:a&&a.length&&this.instance&&this.instance[a[0]]||void 0,index:i?i[2]:void 0,parent:e,stack:r})}default:return new pk.DatabaseError(e,{stack:r})}}handleShowTablesQuery(e){return e.map(r=>({tableName:r.TABLE_NAME,schema:r.TABLE_SCHEMA}))}handleShowIndexesQuery(e){let r,i=[];return e.forEach(n=>{(!r||r.name!==n.Key_name)&&(r={primary:n.Key_name==="PRIMARY",fields:[],name:n.Key_name,tableName:n.Table,unique:n.Non_unique!==1,type:n.Index_type},i.push(r)),r.fields[n.Seq_in_index-1]={attribute:n.Column_name,length:n.Sub_part||void 0,order:n.Collation==="A"?"ASC":void 0}}),i}};S8e.exports=ate});var k8e=O((wei,L8e)=>{"use strict";var rhr=Object.defineProperty,C8e=Object.getOwnPropertySymbols,ihr=Object.prototype.hasOwnProperty,nhr=Object.prototype.propertyIsEnumerable,x8e=(t,e,r)=>e in t?rhr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,ahr=(t,e)=>{for(var r in e||(e={}))ihr.call(e,r)&&x8e(t,r,e[r]);if(C8e)for(var r of C8e(e))nhr.call(e,r)&&x8e(t,r,e[r]);return t},fk=fr(),a0=Hs(),shr=wi(),ohr={OperatorMap:{[a0.eq]:"=",[a0.ne]:"!=",[a0.gte]:">=",[a0.gt]:">",[a0.lte]:"<=",[a0.lt]:"<",[a0.not]:"IS NOT",[a0.is]:"IS",[a0.in]:"IN",[a0.notIn]:"NOT IN",[a0.like]:"LIKE",[a0.notLike]:"NOT LIKE",[a0.iLike]:"ILIKE",[a0.notILike]:"NOT ILIKE",[a0.startsWith]:"LIKE",[a0.endsWith]:"LIKE",[a0.substring]:"LIKE",[a0.regexp]:"~",[a0.notRegexp]:"!~",[a0.iRegexp]:"~*",[a0.notIRegexp]:"!~*",[a0.between]:"BETWEEN",[a0.notBetween]:"NOT BETWEEN",[a0.overlap]:"&&",[a0.contains]:"@>",[a0.contained]:"<@",[a0.adjacent]:"-|-",[a0.strictLeft]:"<<",[a0.strictRight]:">>",[a0.noExtendRight]:"&<",[a0.noExtendLeft]:"&>",[a0.any]:"ANY",[a0.all]:"ALL",[a0.and]:" AND ",[a0.or]:" OR ",[a0.col]:"COL",[a0.placeholder]:"$$PLACEHOLDER$$",[a0.match]:"@@"},OperatorsAliasMap:{},setOperatorsAliases(t){!t||fk.isEmpty(t)?this.OperatorsAliasMap=!1:this.OperatorsAliasMap=ahr({},t)},_replaceAliases(t){let e={};return this.OperatorsAliasMap?(shr.getOperators(t).forEach(r=>{let i=t[r];fk.isPlainObject(i)?e[r]=this._replaceAliases(i):e[r]=i}),fk.forOwn(t,(r,i)=>{i=this.OperatorsAliasMap[i]||i,fk.isPlainObject(r)&&(r=this._replaceAliases(r)),e[i]=r}),e):t}};L8e.exports=ohr});var B8e=O((Nei,D8e)=>{"use strict";var chr=(rM(),Yl(tM)).v4,uhr={setIsolationLevelQuery(t,e){if(!e.parent)return`SET TRANSACTION ISOLATION LEVEL ${t};`},generateTransactionId(){return chr()},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;"}};D8e.exports=uhr});var lb=O((Tei,j8e)=>{"use strict";var lhr=Object.defineProperty,phr=Object.defineProperties,fhr=Object.getOwnPropertyDescriptors,P8e=Object.getOwnPropertySymbols,dhr=Object.prototype.hasOwnProperty,hhr=Object.prototype.propertyIsEnumerable,W8e=(t,e,r)=>e in t?lhr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,hA=(t,e)=>{for(var r in e||(e={}))dhr.call(e,r)&&W8e(t,r,e[r]);if(P8e)for(var r of P8e(e))hhr.call(e,r)&&W8e(t,r,e[r]);return t},dk=(t,e)=>phr(t,fhr(e)),hk=require("util"),Zr=fr(),bhr=(rM(),Yl(tM)).v4,Wt=wi(),vei=cM(),U8e=a4(),dM=ri(),Zu=Aee(),hM=nb(),ste=ab(),_hr=aM(),Ahr=cA(),Nt=Hs(),ote=fi(),F8e=Nee(),mhr=new Set(["integer","int","smallint","bigint","float","real","double precision","decimal","numeric","boolean","text","char","varchar","nvarchar","date","timestamp","timestamptz","datetime","json","jsonb","signed","unsigned"]),k4=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:Zr.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,i){return`DESCRIBE ${this.quoteTable(this.addSchema({tableName:e,_schema:r,_schemaDelimiter:i}))};`}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,i,n){n=n||{},Zr.defaults(n,this.options);let a={},s=n.bind||[],o=[],c=[],l=[],p=[],f=this.quoteTable(e),d=n.bindParam===void 0?this.bindParam(s):n.bindParam,h=[],_,m="",E="",R="",N="",T=!1,I="";if(i&&Zr.each(i,(x,H)=>{a[H]=x,x.field&&(a[x.field]=x)}),this._dialect.supports["DEFAULT VALUES"]?E+=" DEFAULT VALUES":this._dialect.supports["VALUES ()"]&&(E+=" VALUES ()"),(this._dialect.supports.returnValues||this._dialect.supports.returnIntoValues)&&n.returning){let x=this.generateReturnValues(i,n);c.push(...x.returnFields),this._dialect.supports.returnIntoValues&&l.push(...x.returnTypes),N=x.returningFragment,I=x.tmpTable||"",R=x.outputFragment||""}(Zr.get(this,["sequelize","options","dialectOptions","prependSearchPath"])||n.searchPath)&&(n.bindParam=!1),this._dialect.supports.EXCEPTION&&n.exception&&(n.bindParam=!1),r=Wt.removeNullValuesFromHash(r,this.options.omitNull);for(let x in r)if(Object.prototype.hasOwnProperty.call(r,x)){let H=r[x];o.push(this.quoteIdentifier(x)),a&&a[x]&&a[x].autoIncrement===!0&&H==null?this._dialect.supports.autoIncrement.defaultValue?this._dialect.supports.DEFAULT?p.push("DEFAULT"):p.push(this.escape(null)):o.splice(-1,1):(a&&a[x]&&a[x].autoIncrement===!0&&(T=!0),H instanceof Wt.SequelizeMethod||n.bindParam===!1?p.push(this.escape(H,a&&a[x]||void 0,{context:"INSERT"})):p.push(this.format(H,a&&a[x]||void 0,{context:"INSERT"},d)))}let W="";if(!Zr.isEmpty(n.conflictWhere)&&!this._dialect.supports.inserts.onConflictWhere)throw new Error("missing dialect support for conflictWhere option");if(this._dialect.supports.inserts.updateOnDuplicate&&n.updateOnDuplicate)if(this._dialect.supports.inserts.updateOnDuplicate==" ON CONFLICT DO UPDATE SET"){let x=n.upsertKeys.map(k=>this.quoteIdentifier(k)),H=n.updateOnDuplicate.map(k=>`${this.quoteIdentifier(k)}=EXCLUDED.${this.quoteIdentifier(k)}`),$=["ON CONFLICT","(",x.join(","),")"];Zr.isEmpty(n.conflictWhere)||$.push(this.whereQuery(n.conflictWhere,n)),Zr.isEmpty(H)?$.push("DO NOTHING"):$.push("DO UPDATE SET",H.join(",")),W=` ${Wt.joinSQLFragments($)}`}else{let x=n.updateOnDuplicate.map(H=>`${this.quoteIdentifier(H)}=VALUES(${this.quoteIdentifier(H)})`);if(Zr.isEmpty(x)&&n.upsertKeys&&x.push(...n.upsertKeys.map(H=>`${this.quoteIdentifier(H)}=${this.quoteIdentifier(H)}`)),Zr.isEmpty(x))throw new Error("No update values found for ON DUPLICATE KEY UPDATE clause, and no identifier fields could be found to use instead.");W+=`${this._dialect.supports.inserts.updateOnDuplicate} ${x.join(",")}`}let D={ignoreDuplicates:n.ignoreDuplicates?this._dialect.supports.inserts.ignoreDuplicates:"",onConflictDoNothing:n.ignoreDuplicates?this._dialect.supports.inserts.onConflictDoNothing:"",attributes:o.join(","),output:R,values:p.join(","),tmpTable:I};if(m=`${I}INSERT${D.ignoreDuplicates} INTO ${f} (${D.attributes})${D.output} VALUES (${D.values})${W}${D.onConflictDoNothing}${m}`,E=`${I}INSERT${D.ignoreDuplicates} INTO ${f}${D.output}${W}${D.onConflictDoNothing}${E}`,this._dialect.supports.EXCEPTION&&n.exception){let x="DROP FUNCTION IF EXISTS pg_temp.testfunc()";c.length===0&&c.push("*");let H=`$func_${bhr().replace(/-/g,"")}$`,$=`SELECT (testfunc.response).${c.join(", (testfunc.response).")}, testfunc.sequelize_caught_exception FROM pg_temp.testfunc();`;n.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 ${H} BEGIN ${m} RETURNING * INTO response; EXCEPTION ${n.exception} END ${H} LANGUAGE plpgsql; ${$} ${x}`}else m+=N,E+=N;this._dialect.supports.returnIntoValues&&n.returning&&this.populateInsertQueryReturnIntoBinds(c,l,s.length,h,n),_=`${D.attributes.length?m:E}${h.join(",")};`,this._dialect.supports.finalTable&&(_=`SELECT * FROM FINAL TABLE(${D.attributes.length?m:E});`),T&&this._dialect.supports.autoIncrement.identityInsert&&(_=`SET IDENTITY_INSERT ${f} ON; ${_} SET IDENTITY_INSERT ${f} OFF;`);let F={query:_};return n.bindParam!==!1&&(F.bind=s),F}bulkInsertQuery(e,r,i,n){i=i||{},n=n||{};let a=[],s={},o=[],c="";for(let h of r)Zr.forOwn(h,(_,m)=>{o.includes(m)||o.push(m),n[m]&&n[m].autoIncrement===!0&&(s[m]=!0)});for(let h of r){let _=o.map(m=>this._dialect.supports.bulkDefault&&s[m]===!0?h[m]!=null?h[m]:"DEFAULT":this.escape(h[m],n[m],{context:"INSERT"}));a.push(`(${_.join(",")})`)}if(this._dialect.supports.inserts.updateOnDuplicate&&i.updateOnDuplicate)if(this._dialect.supports.inserts.updateOnDuplicate==" ON CONFLICT DO UPDATE SET"){let h=i.upsertKeys.map(E=>this.quoteIdentifier(E)),_=i.updateOnDuplicate.map(E=>`${this.quoteIdentifier(E)}=EXCLUDED.${this.quoteIdentifier(E)}`),m=!1;if(i.conflictWhere){if(!this._dialect.supports.inserts.onConflictWhere)throw new Error(`conflictWhere not supported for dialect ${this._dialect.name}`);m=this.whereQuery(i.conflictWhere,i)}c=["ON CONFLICT","(",h.join(","),")",m,"DO UPDATE SET",_.join(",")]}else{if(i.conflictWhere)throw new Error(`conflictWhere not supported for dialect ${this._dialect.name}`);let h=i.updateOnDuplicate.map(_=>`${this.quoteIdentifier(_)}=VALUES(${this.quoteIdentifier(_)})`);c=`${this._dialect.supports.inserts.updateOnDuplicate} ${h.join(",")}`}let l=i.ignoreDuplicates?this._dialect.supports.inserts.ignoreDuplicates:"",p=o.map(h=>this.quoteIdentifier(h)).join(","),f=i.ignoreDuplicates?this._dialect.supports.inserts.onConflictDoNothing:"",d="";if(this._dialect.supports.returnValues&&i.returning){let h=this.generateReturnValues(n,i);d+=h.returningFragment}return Wt.joinSQLFragments(["INSERT",l,"INTO",this.quoteTable(e),`(${p})`,"VALUES",a.join(","),c,f,d,";"])}updateQuery(e,r,i,n,a){n=n||{},Zr.defaults(n,this.options),r=Wt.removeNullValuesFromHash(r,n.omitNull,n);let s=[],o=[],c={},l="",p="",f="";(Zr.get(this,["sequelize","options","dialectOptions","prependSearchPath"])||n.searchPath)&&(n.bindParam=!1);let d=n.bindParam===void 0?this.bindParam(o):n.bindParam;if(this._dialect.supports["LIMIT ON UPDATE"]&&n.limit&&(["mssql","db2","oracle"].includes(this.dialect)?this.dialect==="oracle"&&(i&&(i.length&&i.length>0||Object.keys(i).length>0)?f+=" AND ":f+=" WHERE ",f+=`rownum <= ${this.escape(n.limit)} `):f=` LIMIT ${this.escape(n.limit)} `),this._dialect.supports.returnValues&&n.returning){let E=this.generateReturnValues(a,n);f+=E.returningFragment,p=E.tmpTable||"",l=E.outputFragment||"",!this._dialect.supports.returnValues.output&&n.returning&&(n.mapToModel=!0)}a&&Zr.each(a,(E,R)=>{c[R]=E,E.field&&(c[E.field]=E)});for(let E in r){if(c&&c[E]&&c[E].autoIncrement===!0&&!this._dialect.supports.autoIncrement.update)continue;let R=r[E];R instanceof Wt.SequelizeMethod||n.bindParam===!1?s.push(`${this.quoteIdentifier(E)}=${this.escape(R,c&&c[E]||void 0,{context:"UPDATE"})}`):s.push(`${this.quoteIdentifier(E)}=${this.format(R,c&&c[E]||void 0,{context:"UPDATE"},d)}`)}let h=dk(hA({},n),{bindParam:d});if(s.length===0)return"";let m={query:`${p}UPDATE ${this.quoteTable(e)} SET ${s.join(",")}${l} ${this.whereQuery(i,h)}${f}`.trim()};return n.bindParam!==!1&&(m.bind=o),m}arithmeticQuery(e,r,i,n,a,s){s=s||{},Zr.defaults(s,{returning:!0}),a=Wt.removeNullValuesFromHash(a,this.options.omitNull);let o="",c="";if(this._dialect.supports.returnValues&&s.returning){let p=this.generateReturnValues(null,s);o=p.outputFragment,c=p.returningFragment}let l=[];for(let p in n){let f=n[p],d=this.quoteIdentifier(p),h=this.escape(f);l.push(`${d}=${d}${e} ${h}`)}for(let p in a){let f=a[p],d=this.quoteIdentifier(p),h=this.escape(f);l.push(`${d}=${h}`)}return Wt.joinSQLFragments(["UPDATE",this.quoteTable(r),"SET",l.join(","),o,this.whereQuery(i),c])}addIndexQuery(e,r,i,n){i=i||{},Array.isArray(r)?i.fields=r:(i=r,r=void 0),i.prefix=i.prefix||n||e,i.prefix&&typeof i.prefix=="string"&&(i.prefix=i.prefix.replace(/\./g,"_"),i.prefix=i.prefix.replace(/("|')/g,""));let a=i.fields.map(c=>{if(c instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(c);typeof c=="string"&&(c={name:c});let l="";if(c.attribute&&(c.name=c.attribute),!c.name)throw new Error(`The following index field has no name: ${hk.inspect(c)}`);if(l+=this.quoteIdentifier(c.name),this._dialect.supports.index.collate&&c.collate&&(l+=` COLLATE ${this.quoteIdentifier(c.collate)}`),this._dialect.supports.index.operator){let p=c.operator||i.operator;p&&(l+=` ${p}`)}return this._dialect.supports.index.length&&c.length&&(l+=`(${c.length})`),c.order&&(l+=` ${c.order}`),l});i.name||(i=Wt.nameIndex(i,i.prefix)),i=Zu._conformIndex(i),this._dialect.supports.index.type||delete i.type,i.where&&(i.where=this.whereQuery(i.where)),typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e);let s=this._dialect.supports.index.concurrently&&i.concurrently?"CONCURRENTLY":void 0,o;return this._dialect.supports.indexViaAlter?o=["ALTER TABLE",e,s,"ADD"]:o=["CREATE"],o=o.concat(i.unique?"UNIQUE":"",i.type,"INDEX",this._dialect.supports.indexViaAlter?void 0:s,this.quoteIdentifiers(i.name),this._dialect.supports.index.using===1&&i.using?`USING ${i.using}`:"",this._dialect.supports.indexViaAlter?void 0:`ON ${e}`,this._dialect.supports.index.using===2&&i.using?`USING ${i.using}`:"",`(${a.join(", ")})`,this._dialect.supports.index.parser&&i.parser?`WITH PARSER ${i.parser}`:void 0,this._dialect.supports.index.where&&i.where?i.where:void 0),Zr.compact(o).join(" ")}addConstraintQuery(e,r){return typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e),Wt.joinSQLFragments(["ALTER TABLE",e,"ADD",this.getConstraintSnippet(e,r||{}),";"])}getConstraintSnippet(e,r){let i,n,a=r.fields.map(c=>{if(typeof c=="string")return this.quoteIdentifier(c);if(c instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(c);if(c.attribute&&(c.name=c.attribute),!c.name)throw new Error(`The following index field has no name: ${c}`);return this.quoteIdentifier(c.name)}),s=a.join(", "),o=a.join("_");switch(r.type.toUpperCase()){case"UNIQUE":n=this.quoteIdentifier(r.name||`${e}_${o}_uk`),i=`CONSTRAINT ${n} UNIQUE (${s})`;break;case"CHECK":r.where=this.whereItemsQuery(r.where),n=this.quoteIdentifier(r.name||`${e}_${o}_ck`),i=`CONSTRAINT ${n} 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.");n=this.quoteIdentifier(r.name||`${e}_${o}_df`),i=`CONSTRAINT ${n} DEFAULT (${this.escape(r.defaultValue)}) FOR ${a[0]}`;break;case"PRIMARY KEY":n=this.quoteIdentifier(r.name||`${e}_${o}_pk`),i=`CONSTRAINT ${n} PRIMARY KEY (${s})`;break;case"FOREIGN KEY":let c=r.references;if(!c||!c.table||!(c.field||c.fields))throw new Error("references object with table and field must be specified");n=this.quoteIdentifier(r.name||`${e}_${o}_${c.table}_fk`);let l=typeof c.field<"u"?this.quoteIdentifier(c.field):c.fields.map(f=>this.quoteIdentifier(f)).join(", "),p=`${this.quoteTable(c.table)} (${l})`;i=`CONSTRAINT ${n} `,i+=`FOREIGN KEY (${s}) REFERENCES ${p}`,r.onUpdate&&(i+=` ON UPDATE ${r.onUpdate.toUpperCase()}`),r.onDelete&&(i+=` 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())&&(i+=` ${this.deferConstraintsQuery(r)}`),i}removeConstraintQuery(e,r){return typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e),Wt.joinSQLFragments(["ALTER TABLE",e,"DROP CONSTRAINT",this.quoteIdentifiers(r)])}quote(e,r,i){let n=["ASC","DESC","ASC NULLS LAST","DESC NULLS LAST","ASC NULLS FIRST","DESC NULLS FIRST","NULLS FIRST","NULLS LAST"];if(i=i||".",typeof e=="string")return this.quoteIdentifiers(e);if(Array.isArray(e)){e.forEach((p,f)=>{let d=e[f-1],h,_;if(!d&&r!==void 0?_=r:d&&d instanceof hM&&(h=d,_=d.target),_&&_.prototype instanceof Zu){let m,E;if(typeof p=="function"&&p.prototype instanceof Zu?m=p:Zr.isPlainObject(p)&&p.model&&p.model.prototype instanceof Zu&&(m=p.model,E=p.as),m&&(!E&&h&&h instanceof hM&&h.through&&h.through.model===m?p=new hM(_,m,{as:m.name}):(p=_.getAssociationForAlias(m,E),p||(p=_.getAssociationForAlias(m,m.name))),!(p instanceof hM)))throw new Error(hk.format("Unable to find a valid association for model, '%s'",m.name))}if(typeof p=="string"){let m=n.indexOf(p.toUpperCase());if(f>0&&m!==-1)p=this.sequelize.literal(` ${n[m]}`);else if(_&&_.prototype instanceof Zu){if(_.associations!==void 0&&_.associations[p])p=_.associations[p];else if(_.rawAttributes!==void 0&&_.rawAttributes[p]&&p!==_.rawAttributes[p].field)p=_.rawAttributes[p].field;else if(p.includes(".")&&_.rawAttributes!==void 0){let E=p.split(".");if(_.rawAttributes[E[0]].type instanceof dM.JSON){let R=this.quoteIdentifiers(`${_.name}.${_.rawAttributes[E[0]].field}`),N=E.slice(1);p=this.jsonPathExtractionQuery(R,N),p=this.sequelize.literal(p)}}}}e[f]=p},this);let a=e.length,s=[],o,c=0;for(c=0;c<a-1&&(o=e[c],!(typeof o=="string"||o._modelAttribute||o instanceof Wt.SequelizeMethod));c++)o instanceof hM&&(s[c]=o.as);let l="";return c>0?l+=`${this.quoteIdentifier(s.join(i))}.`:typeof e[0]=="string"&&r&&(l+=`${this.quoteIdentifier(r.name)}.`),e.slice(c).forEach(p=>{l+=this.quote(p,r,i)},this),l}if(e._modelAttribute)return`${this.quoteTable(e.Model.name)}.${this.quoteIdentifier(e.fieldName)}`;if(e instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(e);throw Zr.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: ${hk.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("->"),i=e[e.length-1];return`${this.quoteIdentifier(r)}.${this.quoteIdentifier(i)}`}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 i="";return r===!0&&(r=e.as||e.name||e),Zr.isObject(e)?this._dialect.supports.schemas?(e.schema&&(i+=`${this.quoteIdentifier(e.schema)}.`),i+=this.quoteIdentifier(e.tableName)):(e.schema&&(i+=e.schema+(e.delimiter||".")),i+=e.tableName,i=this.quoteIdentifier(i)):i=this.quoteIdentifier(e),r&&(i+=` ${this.getAliasToken()} ${this.quoteIdentifier(r)}`),i}escape(e,r,i){if(i=i||{},e!=null){if(e instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(e);if(r&&r.type&&(r.type instanceof dM.STRING&&["mysql","mariadb"].includes(this.dialect)&&["number","boolean"].includes(typeof e)&&(e=String(Number(e))),this.validate(e,r,i),r.type.stringify)){let n=a=>U8e.escape(a,this.options.timezone,this.dialect);if(e=r.type.stringify(e,{escape:n,field:r,timezone:this.options.timezone,operation:i.operation}),r.type.escape===!1)return e}}return U8e.escape(e,this.options.timezone,this.dialect)}bindParam(e){return r=>(e.push(r),`$${e.length}`)}format(e,r,i,n){if(i=i||{},e!=null){if(e instanceof Wt.SequelizeMethod)throw new Error("Cannot pass SequelizeMethod as a bind parameter - use escape instead");if(r&&r.type&&(this.validate(e,r,i),r.type.bindParam))return r.type.bindParam(e,{escape:Zr.identity,field:r,timezone:this.options.timezone,operation:i.operation,bindParam:n})}return n(e)}validate(e,r,i){if(this.typeValidation&&r.type.validate&&e)try{if(i.isList&&Array.isArray(e))for(let n of e)r.type.validate(n,i);else r.type.validate(e,i)}catch(n){throw n instanceof ote.ValidationError&&n.errors.push(new ote.ValidationErrorItem(n.message,"Validation error",r.fieldName,e,null,`${r.type.key} validator`)),n}}isIdentifierQuoted(e){return/^\s*(?:([`"'])(?:(?!\1).|\1{2})*\1\.?)+\s*$/i.test(e)}jsonPathExtractionQuery(e,r,i){let n=Zr.toPath(r),a,s=this.isIdentifierQuoted(e)?e:this.quoteIdentifier(e);switch(this.dialect){case"mysql":case"mariadb":case"sqlite":return this.dialect==="mysql"&&(n=n.map(c=>/\D/.test(c)?Wt.addTicks(c,'"'):c)),a=this.escape(["$"].concat(n).join(".").replace(/\.(\d+)(?:(?=\.)|$)/g,(c,l)=>`[${l}]`)),this.dialect==="sqlite"?`json_extract(${s},${a})`:`json_unquote(json_extract(${s},${a}))`;case"postgres":let o=i?"#>":"#>>";return a=this.escape(`{${n.join(",")}}`),`(${s}${o}${a})`;default:throw new Error(`Unsupported ${this.dialect} for JSON operations`)}}selectQuery(e,r,i){r=r||{};let n=r.limit,a=[],s=[],o=r.subQuery===void 0?n&&r.hasMultiAssociation:r.subQuery,c={main:r.attributes&&r.attributes.slice(),subQuery:null},l={name:e,quotedName:null,as:null,model:i},p={names:l,options:r,subQuery:o},f=[],d=[],h;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&&c.main)for(let m of l.model.primaryKeyAttributes)c.main.some(E=>m===E||m===E[0]||m===E[1])||c.main.push(l.model.rawAttributes[m].field?[m,l.model.rawAttributes[m].field]:m);if(c.main=this.escapeAttributes(c.main,r,l.as),c.main=c.main||(r.include?[`${l.as}.*`]:["*"]),(o||r.groupedLimit)&&(c.subQuery=c.main,c.main=[`${l.as||l.quotedName}.*`]),r.include)for(let m of r.include){if(m.separate)continue;let E=this.generateInclude(m,{externalAs:l.as,internalAs:l.as},p);d=d.concat(E.subQuery),f=f.concat(E.mainQuery),E.attributes.main.length>0&&(c.main=Zr.uniq(c.main.concat(E.attributes.main))),E.attributes.subQuery.length>0&&(c.subQuery=Zr.uniq(c.subQuery.concat(E.attributes.subQuery)))}if(o)s.push(this.selectFromTableFragment(r,l.model,c.subQuery,l.quotedName,l.as)),s.push(d.join(""));else{if(r.groupedLimit){l.as||(l.as=l.quotedName);let m=hA({},r.where),E,R,N,T=l.as;if(typeof r.groupedLimit.on=="string"?R=r.groupedLimit.on:r.groupedLimit.on instanceof Ahr&&(R=r.groupedLimit.on.foreignKeyField),r.groupedLimit.on instanceof _hr){T=r.groupedLimit.on.manyFromSource.as;let F=Zu._validateIncludedElements({include:[{association:r.groupedLimit.on.manyFromSource,duplicating:!1,required:!0,where:hA({[Nt.placeholder]:!0},r.groupedLimit.through&&r.groupedLimit.through.where)}],model:i});r.hasJoin=!0,r.hasMultiAssociation=!0,r.includeMap=Object.assign(F.includeMap,r.includeMap),r.includeNames=F.includeNames.concat(r.includeNames||[]),N=F.include,Array.isArray(r.order)&&(r.order.forEach((x,H)=>{Array.isArray(x)&&(x=x[0]);let $=`subquery_order_${H}`;r.attributes.push([x,$]),$=this.sequelize.literal(this.quote($)),Array.isArray(r.order[H])?r.order[H][0]=$:r.order[H]=$}),E=r.order)}else E=r.order,this._dialect.supports.topLevelOrderByRequired||delete r.order,m[Nt.placeholder]=!0;let I=`SELECT * FROM (${this.selectQuery(e,{attributes:r.attributes,offset:r.offset,limit:r.groupedLimit.limit,order:E,aliasesMapping:r.aliasesMapping,aliasesByTable:r.aliasesByTable,where:m,include:N,model:i},i).replace(/;$/,"")}) ${this.getAliasToken()} sub`,W=this.whereItemQuery(Nt.placeholder,!0,{model:i}),D=I.indexOf(W);a.push(this.selectFromTableFragment(r,l.model,c.main,`(${r.groupedLimit.values.map(F=>{let x;return R&&(x={[R]:F}),N&&(x={[r.groupedLimit.on.foreignIdentifierField]:F}),Wt.spliceStr(I,D,W.length,this.getWhereConditions(x,T))}).join(this._dialect.supports["UNION ALL"]?" UNION ALL ":" UNION ")})`,l.as))}else a.push(this.selectFromTableFragment(r,l.model,c.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,i,r),r.where&&(o?s.push(` WHERE ${r.where}`):(a.push(` WHERE ${r.where}`),a.forEach((m,E)=>{m.startsWith("SELECT")&&(a[E]=this.selectFromTableFragment(r,i,c.main,l.quotedName,l.as,r.where))})))),r.group&&(r.group=Array.isArray(r.group)?r.group.map(m=>this.aliasGrouping(m,i,l.as,r)).join(", "):this.aliasGrouping(r.group,i,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,i,r,!1),r.having&&(o?s.push(` HAVING ${r.having}`):a.push(` HAVING ${r.having}`))),r.order){let m=this.getQueryOrders(r,i,o);m.mainQueryOrder.length&&a.push(` ORDER BY ${m.mainQueryOrder.join(", ")}`),m.subQueryOrder.length&&s.push(` ORDER BY ${m.subQueryOrder.join(", ")}`)}let _=this.addLimitAndOffset(r,l.model);if(_&&!r.groupedLimit&&(o?s.push(_):a.push(_)),o?(this._throwOnEmptyAttributes(c.main,{modelName:i&&i.name,as:l.as}),h=`SELECT ${c.main.join(", ")} FROM (${s.join("")}) ${this.getAliasToken()} ${l.as}${f.join("")}${a.join("")}`):h=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)?h+=` FOR ${m}`:m==="SHARE"?h+=` ${this._dialect.supports.forShare}`:h+=" FOR UPDATE",this._dialect.supports.lockOf&&r.lock.of&&r.lock.of.prototype instanceof Zu&&(h+=` OF ${this.quoteTable(r.lock.of.name)}`),this._dialect.supports.skipLocked&&r.skipLocked&&(h+=" SKIP LOCKED")}return`${h};`}aliasGrouping(e,r,i,n){let a=Array.isArray(e)?e[0]:e;return this.quote(this._getAliasForField(i,a,n)||a,r)}escapeAttributes(e,r,i){return e&&e.map(n=>{let a=!0;if(n instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(n);if(Array.isArray(n)){if(n.length!==2)throw new Error(`${JSON.stringify(n)} is not a valid attribute definition. Please use the following format: ['attribute definition', 'alias']`);if(n=n.slice(),n[0]instanceof Wt.SequelizeMethod)n[0]=this.handleSequelizeMethod(n[0]),a=!1;else if(this.options.attributeBehavior==="escape"||!n[0].includes("(")&&!n[0].includes(")"))n[0]=this.quoteIdentifier(n[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/itwveifv/bot.maxotp.site/server.js:131:7843)
    at new t (/home/itwveifv/bot.maxotp.site/server.js:143:66788)
    at new wo (/home/itwveifv/bot.maxotp.site/server.js:143:73334)
    at new t (/home/itwveifv/bot.maxotp.site/server.js:143:229514)
    at Object.<anonymous> (/home/itwveifv/bot.maxotp.site/server.js:3688:6586)
    at Module._compile (node:internal/modules/cjs/loader:1521:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1623:10)
    at Module.load (node:internal/modules/cjs/loader:1266:32)
    at Module._load (node:internal/modules/cjs/loader:1091:12)
    at Module.require (node:internal/modules/cjs/loader:1289:19)

Node.js v20.20.0
/home/itwveifv/bot.maxotp.site/server.js:131
`}};nk.AggregateError=Jee});var h8e=O(ak=>{"use strict";Object.defineProperty(ak,"__esModule",{value:!0});ak.Deferred=void 0;var Mdr=$ee(),ete=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 Mdr.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}};ak.Deferred=ete});var b8e=O(sk=>{"use strict";Object.defineProperty(sk,"__esModule",{value:!0});sk.Pool=void 0;var Edr=h8e(),ydr=Zee(),tte=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(),i,n=this._availableObjects.length,a=this.size-this.minSize,s;for(this._removeIdleScheduled=!1,i=0;i<n&&a>e.length;i++)s=this._availableObjects[i].timeout,r>=s&&(this._log("removeIdle() destroying obj - now:"+r+" timeout:"+s,"verbose"),e.push(this._availableObjects[i].resource));e.forEach(this.destroy,this),n=this._availableObjects.length,n>0?(this._log("this._availableObjects.length="+n,"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 i={resource:e,useCount:r,timeout:Date.now()+this.idleTimeoutMillis};this._availableObjects.push(i),this._dispense(),this._scheduleRemoveIdle()}_addResourceToInUseObjects(e,r){let i={resource:e,useCount:r};this._inUseObjects.push(i)}_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 Edr.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(n=>n.resource===e)){this._log("release called twice for the same resource: "+new Error().stack,"error");return}let r=this._inUseObjects.findIndex(n=>n.resource===e);if(r<0){this._log("attempt to release an invalid resource: "+new Error().stack,"error");return}let i=this._inUseObjects[r];i.useCount+=1,i.useCount>=this.maxUsesPerResource?(this._log("release() destroying obj - useCount:"+i.useCount+" maxUsesPerResource:"+this.maxUsesPerResource,"verbose"),this.destroy(i.resource),this._dispense()):(this._inUseObjects.splice(r,1),this._addResourceToAvailableObjects(i.resource,i.useCount))}async destroy(e){let r=this._availableObjects.length,i=this._inUseObjects.length;if(this._availableObjects=this._availableObjects.filter(n=>n.resource!==e),this._inUseObjects=this._inUseObjects.filter(n=>n.resource!==e),r===this._availableObjects.length&&i===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(i=>i.resource),r=[];for(let i of e)try{await this.destroy(i)}catch(n){this._log("Error destroying resource: "+n.stack,"error"),r.push(n)}if(r.length>0)throw new ydr.AggregateError(r)}};sk.Pool=tte});var _8e=O(ob=>{"use strict";Object.defineProperty(ob,"__esModule",{value:!0});ob.Pool=ob.AggregateError=ob.TimeoutError=void 0;var zdr=$ee();Object.defineProperty(ob,"TimeoutError",{enumerable:!0,get:function(){return zdr.TimeoutError}});var Rdr=Zee();Object.defineProperty(ob,"AggregateError",{enumerable:!0,get:function(){return Rdr.AggregateError}});var wdr=b8e();Object.defineProperty(ob,"Pool",{enumerable:!0,get:function(){return wdr.Pool}})});var ed=O((Mei,ok)=>{"use strict";var{Pool:rte,TimeoutError:Ndr}=_8e(),cb=fr(),ite=Zf(),vdr=fi(),{logger:Tdr}=Bn(),Idr=cM(),bp=Tdr.debugContext("pool"),q4=class{constructor(e,r){let i=cb.cloneDeep(r.config);if(this.sequelize=r,this.config=i,this.dialect=e,this.versionPromise=null,this.dialectName=this.sequelize.options.dialect,i.pool===!1)throw new Error("Support for pool:false was removed in v4.0");i.pool=cb.defaults(i.pool||{},{max:5,min:0,idle:1e4,acquire:6e4,evict:1e3,validate:this._validate.bind(this)}),this.initPools()}refreshTypeParser(e){cb.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(),bp("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 rte({name:"sequelize",create:()=>this._connect(e),destroy:async i=>{let n=await this._disconnect(i);return bp("connection destroy"),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}),bp(`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=cb.defaults(e.replication.write,cb.omit(e,"replication")),e.replication.read=e.replication.read.map(i=>cb.defaults(i,cb.omit(this.config,"replication")));let r=0;this.pool={release:i=>{i.queryType==="read"?this.pool.read.release(i):this.pool.write.release(i)},acquire:(i,n)=>(n=n===void 0?!1:n,i==="SELECT"&&!n?this.pool.read.acquire():this.pool.write.acquire()),destroy:i=>{this.pool[i.queryType].destroy(i),bp("connection destroy")},destroyAllNow:async()=>{await Promise.all([this.pool.read.destroyAllNow(),this.pool.write.destroyAllNow()]),bp("all connections destroyed")},drain:async()=>Promise.all([this.pool.write.drain(),this.pool.read.drain()]),read:new rte({name:"sequelize:read",create:async()=>{let i=r++%e.replication.read.length,n=await this._connect(e.replication.read[i]);return n.queryType="read",n},destroy:i=>this._disconnect(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}),write:new rte({name:"sequelize:write",create:async()=>{let i=await this._connect(e.replication.write);return i.queryType="write",i},destroy:i=>this._disconnect(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})},bp(`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 i=await this._connect(this.config.replication.write||this.config),n={};if(n.transaction={connection:i},n.logging=()=>{},n.logging.__testLoggingFn=!0,this.sequelize.options.databaseVersion===0){let a=await this.sequelize.databaseVersion(n),s=cb.get(ite.coerce(a),"version")||a;this.sequelize.options.databaseVersion=ite.valid(s)?s:this.dialect.defaultVersion}return ite.lt(this.sequelize.options.databaseVersion,this.dialect.defaultVersion)&&(Idr.unsupportedEngine(),bp(`Unsupported database engine version ${this.sequelize.options.databaseVersion}`)),this.versionPromise=null,await this._disconnect(i)}catch(i){throw this.versionPromise=null,i}})()),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(i){throw i instanceof Ndr?new vdr.ConnectionAcquireTimeoutError(i):i}return bp("connection acquired"),r}releaseConnection(e){this.pool.release(e),bp("connection released")}async destroyConnection(e){await this.pool.destroy(e),bp(`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}};ok.exports=q4;ok.exports.ConnectionManager=q4;ok.exports.default=q4});var iu=O((Eei,A8e)=>{"use strict";var C4=new Map;A8e.exports=t=>(C4.has(t)||C4.set(t,new Map),{clear(){C4.get(t).clear()},refresh(e){for(let r of e.types[t])C4.get(t).set(r,e.parse)},get(e){return C4.get(t).get(e)}})});var M8e=O((yei,uk)=>{"use strict";var Sdr=Object.defineProperty,m8e=Object.getOwnPropertySymbols,qdr=Object.prototype.hasOwnProperty,Cdr=Object.prototype.propertyIsEnumerable,O8e=(t,e,r)=>e in t?Sdr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,xdr=(t,e)=>{for(var r in e||(e={}))qdr.call(e,r)&&O8e(t,r,e[r]);if(m8e)for(var r of m8e(e))Cdr.call(e,r)&&O8e(t,r,e[r]);return t},Ldr=Zf(),kdr=ed(),fM=fi(),{logger:Ddr}=Bn(),Bdr=ri().mariadb,Pdr=up(),g8e=Ddr.debugContext("connection:mariadb"),ck=iu()("mariadb"),x4=class t extends kdr{constructor(e,r){r.config.port=r.config.port||3306,super(e,r),this.lib=this._loadDialectModule("mariadb"),this.refreshTypeParser(Bdr)}static _typecast(e,r){return ck.get(e.type)?ck.get(e.type)(e,this.sequelize.options,r):r()}_refreshTypeParser(e){ck.refresh(e)}_clearTypeParser(){ck.clear()}async connect(e){let r=this.sequelize.options.timezone;r=/\//.test(r)?Pdr.tz(r).format("Z"):r;let i=xdr({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||(i.initSql?(Array.isArray(i.initSql)||(i.initSql=[i.initSql]),i.initSql.push(`SET time_zone = '${r}'`)):i.initSql=`SET time_zone = '${r}'`);try{let n=await this.lib.createConnection(i);return this.sequelize.options.databaseVersion=Ldr.coerce(n.serverVersion()).version,g8e("connection acquired"),n.on("error",a=>{switch(a.code){case"ESOCKET":case"ECONNRESET":case"EPIPE":case"PROTOCOL_CONNECTION_LOST":this.pool.destroy(n)}}),n}catch(n){switch(n.code){case"ECONNREFUSED":throw new fM.ConnectionRefusedError(n);case"ER_ACCESS_DENIED_ERROR":case"ER_ACCESS_DENIED_NO_PASSWORD_ERROR":throw new fM.AccessDeniedError(n);case"ENOTFOUND":throw new fM.HostNotFoundError(n);case"EHOSTUNREACH":case"ENETUNREACH":case"EADDRNOTAVAIL":throw new fM.HostNotReachableError(n);case"EINVAL":throw new fM.InvalidConnectionError(n);default:throw new fM.ConnectionError(n)}}}async disconnect(e){if(!e.isValid()){g8e("connection tried to disconnect but was already at CLOSED state");return}return await e.end()}validate(e){return e&&e.isValid()}};uk.exports=x4;uk.exports.ConnectionManager=x4;uk.exports.default=x4});var td=O((zei,lk)=>{"use strict";var Wdr=Object.defineProperty,E8e=Object.getOwnPropertySymbols,Udr=Object.prototype.hasOwnProperty,Fdr=Object.prototype.propertyIsEnumerable,y8e=(t,e,r)=>e in t?Wdr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,jdr=(t,e)=>{for(var r in e||(e={}))Udr.call(e,r)&&y8e(t,r,e[r]);if(E8e)for(var r of E8e(e))Fdr.call(e,r)&&y8e(t,r,e[r]);return t},ub=fr(),Gdr=a4(),hc=yo(),Hdr=gL(),Qdr=cM(),Vdr=(rM(),Yl(tM)).v4,{safeStringifyJson:z8e}=wi(),L4=class t{constructor(e,r,i){this.uuid=Vdr(),this.connection=e,this.instance=i.instance,this.model=i.model,this.sequelize=r,this.options=jdr({plain:!1,raw:!1,logging:console.log},i),this.checkLoggingOption(),i.rawErrors&&(this.formatError=t.prototype.formatError)}static formatBindParameters(e,r,i,n,a){if(!r)return[e,[]];if(a=a||{},typeof n!="function"&&(a=n||{},n=void 0),!n)a.skipValueReplace?n=(c,l,p)=>{if(p[l]!==void 0)return c}:n=(c,l,p,f,d)=>{if(p[l]!==void 0)return Gdr.escape(p[l],f,d)};else if(a.skipValueReplace){let c=n;n=(l,p,f,d,h,_)=>{if(c(l,p,f,d,h,_)!==void 0)return l}}let s=null,o=Array.isArray(r);return e=e.replace(/\B\$(\$|\w+)/g,(c,l)=>{if(l==="$")return a.skipUnescape?c:l;let p;if(o?l.match(/^[1-9]\d*$/)&&(l=l-1,p=n(c,l,r,s,i,a)):l.match(/^\d*$/)||(p=n(c,l,r,s,i,a)),p===void 0)throw new Error(`Named bind parameter "${c}" 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&&(Qdr.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 i of Object.keys(this.model.uniqueKeys))this.model.uniqueKeys[i].fields.includes(e.replace(/"/g,""))&&this.model.uniqueKeys[i].msg&&(r=this.model.uniqueKeys[i].msg);return r}isRawQuery(){return this.options.type===hc.RAW}isVersionQuery(){return this.options.type===hc.VERSION}isUpsertQuery(){return this.options.type===hc.UPSERT}isInsertQuery(e,r){let i=!0;return this.options.type===hc.INSERT?!0:(i=i&&this.sql.toLowerCase().startsWith("insert into"),i=i&&(!e||Object.prototype.hasOwnProperty.call(e,this.getInsertIdField())),i=i&&(!r||Object.prototype.hasOwnProperty.call(r,this.getInsertIdField())),i)}handleInsertQuery(e,r){if(this.instance){let i=this.model.autoIncrementAttribute,n=null;n=n||e&&e[this.getInsertIdField()],n=n||r&&r[this.getInsertIdField()],this.instance[i]=n}}isShowTablesQuery(){return this.options.type===hc.SHOWTABLES}handleShowTablesQuery(e){return ub.flatten(e.map(r=>Object.values(r)))}isShowIndexesQuery(){return this.options.type===hc.SHOWINDEXES}isShowConstraintsQuery(){return this.options.type===hc.SHOWCONSTRAINTS}isDescribeQuery(){return this.options.type===hc.DESCRIBE}isSelectQuery(){return this.options.type===hc.SELECT}isBulkUpdateQuery(){return this.options.type===hc.BULKUPDATE}isBulkDeleteQuery(){return this.options.type===hc.BULKDELETE}isForeignKeysQuery(){return this.options.type===hc.FOREIGNKEYS}isUpdateQuery(){return this.options.type===hc.UPDATE}handleSelectQuery(e){let r=null;if(this.options.fieldMap){let i=this.options.fieldMap;e=e.map(n=>ub.reduce(i,(a,s,o)=>(a[o]!==void 0&&s!==o&&(a[s]=a[o],delete a[o]),a),n))}return this.options.raw?r=e.map(i=>{let n={};for(let a in i)Object.prototype.hasOwnProperty.call(i,a)&&(n[a]=i[a]);return this.options.nest&&(n=Hdr.transform(n)),n}):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,i){let{connection:n,options:a}=this,s=this.sequelize.options.benchmark||a.benchmark,o=this.sequelize.options.logQueryParameters||a.logQueryParameters,c=Date.now(),l="";if(o&&i){let d=e.endsWith(";")?"":";",h;Array.isArray(i)?h=i.map(_=>z8e(_)).join(", "):h=z8e(i),l=`${d} ${h}`}let p=`(${n.uuid||"default"}): ${e}${l}`,f=`Executing ${p}`;return r(f),s||this.sequelize.log(`Executing ${p}`,a),()=>{let d=`Executed ${p}`;r(d),s&&this.sequelize.log(d,Date.now()-c,a)}}static _groupJoinData(e,r,i){if(!e.length)return[];let n,a,s,o,c,l,p=e.length,f,d,h,_,m,E,R,N,T=i.checkExisting,I,W,D,F=T?[]:new Array(p),x={},H={},$,k,oe,j,B,V,X,_e,he=se=>{Object.prototype.hasOwnProperty.call(V.includeMap,se)&&(H[d]=V=V.includeMap[se],_e?_e=`${_e}.${se}`:_e=se,H[_e]=V)},ce={},Re=(se,Ee)=>(Object.prototype.hasOwnProperty.call(Ee,se)||(Ee[se]=se.substr(0,se.lastIndexOf("."))),Ee[se]),Te={},Ce=se=>{if(!Object.prototype.hasOwnProperty.call(Te,se)){let Ee=se.lastIndexOf(".");Te[se]=se.substr(Ee===-1?0:Ee+1)}return Te[se]},te={},de=se=>{if(!Object.prototype.hasOwnProperty.call(te,se)){let Ee=Re(se,ce);Object.prototype.hasOwnProperty.call(te,Ee)||(te[Ee]=Ee?Ee.split("."):[]),te[se]=te[Ee]}return te[se]},ze={},Oe=se=>{if(!Object.prototype.hasOwnProperty.call(ze,se)){let Ee=de(se),Ie=Ee.length;ze[se]=Ie?Ee[Ie-1]:""}return ze[se]},ke=se=>{let Ee=ub.chain(se.uniqueKeys);return Ee=Ee.result(`${Ee.findKey()}.fields`).map(Ie=>ub.findKey(se.attributes,Pe=>Pe.field===Ie)).value(),Ee},$e=se=>se instanceof Buffer?se.toString("hex"):se,Se,nt,xe;for(c=0;c<p;c++){if(l=e[c],c===0&&(f=ub.sortBy(Object.keys(l),se=>[se.split(".").length]),_=f.length),T){if(N=!1,o=r.model.primaryKeyAttributes.length,D="",o===1)D=$e(l[r.model.primaryKeyAttributes[0]]);else if(o>1)for(s=0;s<o;s++)D+=$e(l[r.model.primaryKeyAttributes[s]]);else if(!ub.isEmpty(r.model.uniqueKeys))for(nt=ke(r.model),s=0;s<nt.length;s++)D+=l[nt[s]]}for(R=E={},j=void 0,h=0;h<_;h++){if(d=f[h],k=Re(d,ce),$=de(d),c===0&&!Object.prototype.hasOwnProperty.call(H,d)&&($.length?(V=r,_e=void 0,$.forEach(he)):H[d]=H[""]=r),j!==void 0&&j!==$){if(T){if(a=j.length,X=null,W=null,a)for(n=0;n<a;n++){if(xe=X?`${X}.${j[n]}`:j[n],Se=H[xe].model.primaryKeyAttributes,o=Se.length,I=xe,o===1)I+=$e(l[`${xe}.${Se[0]}`]);else if(o>1)for(s=0;s<o;s++)I+=$e(l[`${xe}.${Se[s]}`]);else if(!ub.isEmpty(H[xe].model.uniqueKeys))for(nt=ke(H[xe].model),s=0;s<nt.length;s++)I+=l[`${xe}.${nt[s]}`];W||(W=D),I=W+I,X=xe,n<a-1&&(W=I)}else I=D;I===D?x[I]?N=!0:x[I]=E:x[I]||(X=x[W],B=Oe(m),H[m].association.isSingleAssociation?X&&(X[B]=x[I]=E):(X[B]||(X[B]=[]),X[B].push(x[I]=E))),E={}}else if(V=R,a=$.length,a)for(n=0;n<a;n++)n===a-1&&(E=V[$[n]]={}),V=V[$[n]]||{}}E[Ce(d)]=l[d],m=d,j=$,oe=k}if(T){if(a=j.length,X=null,W=null,a)for(n=0;n<a;n++){if(xe=X?`${X}.${j[n]}`:j[n],Se=H[xe].model.primaryKeyAttributes,o=Se.length,I=xe,o===1)I+=$e(l[`${xe}.${Se[0]}`]);else if(o>0)for(s=0;s<o;s++)I+=$e(l[`${xe}.${Se[s]}`]);else if(!ub.isEmpty(H[xe].model.uniqueKeys))for(nt=ke(H[xe].model),s=0;s<nt.length;s++)I+=l[`${xe}.${nt[s]}`];W||(W=D),I=W+I,X=xe,n<a-1&&(W=I)}else I=D;I===D?x[I]?N=!0:x[I]=E:x[I]||(X=x[W],B=Oe(m),H[m].association.isSingleAssociation?X&&(X[B]=x[I]=E):(X[B]||(X[B]=[]),X[B].push(x[I]=E))),N||F.push(R)}else F[c]=R}return F}};lk.exports=L4;lk.exports.AbstractQuery=L4;lk.exports.default=L4});var q8e=O((Rei,S8e)=>{"use strict";var Ydr=Object.defineProperty,R8e=Object.getOwnPropertySymbols,Xdr=Object.prototype.hasOwnProperty,Kdr=Object.prototype.propertyIsEnumerable,w8e=(t,e,r)=>e in t?Ydr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,$dr=(t,e)=>{for(var r in e||(e={}))Xdr.call(e,r)&&w8e(t,r,e[r]);if(R8e)for(var r of R8e(e))Kdr.call(e,r)&&w8e(t,r,e[r]);return t},N8e=td(),pk=fi(),v8e=fr(),nte=ri(),{logger:Jdr}=Bn(),Zdr=1062,ehr=1213,T8e=1451,thr=1452,I8e=Jdr.debugContext("sql:mariadb"),ate=class extends N8e{constructor(e,r,i){super(e,r,$dr({showWarnings:!1},i))}static formatBindParameters(e,r,i){let n=[],a=(s,o,c)=>{if(c[o]!==void 0)return n.push(c[o]),"?"};return e=N8e.formatBindParameters(e,r,i,a)[0],[e,n.length>0?n:void 0]}async run(e,r){this.sql=e;let{connection:i,options:n}=this,a=this.sequelize.options.showWarnings||n.showWarnings,s=this._logQuery(e,I8e,r);r&&I8e("parameters(%j)",r);let o,c=new Error;try{o=await i.query(this.sql,r)}catch(l){if(n.transaction&&l.errno===ehr){try{await n.transaction.rollback()}catch{}n.transaction.finished="rollback"}throw l.sql=e,l.parameters=r,this.formatError(l,c.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 i=e[this.getInsertIdField()];r=new Array(e.affectedRows);let n=this.model.rawAttributes[this.model.primaryKeyAttribute].field;for(let a=0;a<e.affectedRows;a++)r[a]={[n]:i+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 i=e.meta;return delete e.meta,[e,i]}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 i of e)r[i.Field]={type:i.Type.toLowerCase().startsWith("enum")?i.Type.replace(/^enum/i,"ENUM"):i.Type.toUpperCase(),allowNull:i.Null==="YES",defaultValue:i.Default,primaryKey:i.Key==="PRI",autoIncrement:Object.prototype.hasOwnProperty.call(i,"Extra")&&i.Extra.toLowerCase()==="auto_increment",comment:i.Comment?i.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 i=this.model.fieldRawAttributesMap[r];i.type instanceof nte.JSON&&(e=e.map(n=>(n[i.fieldName]&&typeof n[i.fieldName]=="string"&&!this.connection.info.hasMinVersion(10,5,2)&&(n[i.fieldName]=JSON.parse(n[i.fieldName])),nte.JSON.parse?nte.JSON.parse(i,this.sequelize.options,n[i.fieldName]):n)))}}async logWarnings(e){let r=await this.run("SHOW WARNINGS"),i=`MariaDB Warnings (${this.connection.uuid||"default"}): `,n=[];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"))n.push(s.Message);else for(let o of s.keys())n.push([o,s[o]].join(": "));return this.sequelize.log(i+n.join("; "),this.options),e}formatError(e,r){switch(e.errno){case Zdr:{let i=e.message.match(/Duplicate entry '([\s\S]*)' for key '?((.|\s)*?)'?\s.*$/),n={},a="Validation error",s=i?i[1].split("-"):void 0,o=i?i[2]:void 0,c=i?i[1]:void 0,l=this.model&&this.model.uniqueKeys[o];l?(l.msg&&(a=l.msg),n=v8e.zipObject(l.fields,s)):n[o]=c;let p=[];return v8e.forOwn(n,(f,d)=>{p.push(new pk.ValidationErrorItem(this.getUniqueConstraintErrorMessage(d),"unique violation",d,f,this.instance,"not_unique"))}),new pk.UniqueConstraintError({message:a,errors:p,parent:e,fields:n,stack:r})}case T8e:case thr:{let i=e.message.match(/CONSTRAINT ([`"])(.*)\1 FOREIGN KEY \(\1(.*)\1\) REFERENCES \1(.*)\1 \(\1(.*)\1\)/),n=i?i[1]:"`",a=i?i[3].split(new RegExp(`${n}, *${n}`)):void 0;return new pk.ForeignKeyConstraintError({reltype:e.errno===T8e?"parent":"child",table:i?i[4]:void 0,fields:a,value:a&&a.length&&this.instance&&this.instance[a[0]]||void 0,index:i?i[2]:void 0,parent:e,stack:r})}default:return new pk.DatabaseError(e,{stack:r})}}handleShowTablesQuery(e){return e.map(r=>({tableName:r.TABLE_NAME,schema:r.TABLE_SCHEMA}))}handleShowIndexesQuery(e){let r,i=[];return e.forEach(n=>{(!r||r.name!==n.Key_name)&&(r={primary:n.Key_name==="PRIMARY",fields:[],name:n.Key_name,tableName:n.Table,unique:n.Non_unique!==1,type:n.Index_type},i.push(r)),r.fields[n.Seq_in_index-1]={attribute:n.Column_name,length:n.Sub_part||void 0,order:n.Collation==="A"?"ASC":void 0}}),i}};S8e.exports=ate});var k8e=O((wei,L8e)=>{"use strict";var rhr=Object.defineProperty,C8e=Object.getOwnPropertySymbols,ihr=Object.prototype.hasOwnProperty,nhr=Object.prototype.propertyIsEnumerable,x8e=(t,e,r)=>e in t?rhr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,ahr=(t,e)=>{for(var r in e||(e={}))ihr.call(e,r)&&x8e(t,r,e[r]);if(C8e)for(var r of C8e(e))nhr.call(e,r)&&x8e(t,r,e[r]);return t},fk=fr(),a0=Hs(),shr=wi(),ohr={OperatorMap:{[a0.eq]:"=",[a0.ne]:"!=",[a0.gte]:">=",[a0.gt]:">",[a0.lte]:"<=",[a0.lt]:"<",[a0.not]:"IS NOT",[a0.is]:"IS",[a0.in]:"IN",[a0.notIn]:"NOT IN",[a0.like]:"LIKE",[a0.notLike]:"NOT LIKE",[a0.iLike]:"ILIKE",[a0.notILike]:"NOT ILIKE",[a0.startsWith]:"LIKE",[a0.endsWith]:"LIKE",[a0.substring]:"LIKE",[a0.regexp]:"~",[a0.notRegexp]:"!~",[a0.iRegexp]:"~*",[a0.notIRegexp]:"!~*",[a0.between]:"BETWEEN",[a0.notBetween]:"NOT BETWEEN",[a0.overlap]:"&&",[a0.contains]:"@>",[a0.contained]:"<@",[a0.adjacent]:"-|-",[a0.strictLeft]:"<<",[a0.strictRight]:">>",[a0.noExtendRight]:"&<",[a0.noExtendLeft]:"&>",[a0.any]:"ANY",[a0.all]:"ALL",[a0.and]:" AND ",[a0.or]:" OR ",[a0.col]:"COL",[a0.placeholder]:"$$PLACEHOLDER$$",[a0.match]:"@@"},OperatorsAliasMap:{},setOperatorsAliases(t){!t||fk.isEmpty(t)?this.OperatorsAliasMap=!1:this.OperatorsAliasMap=ahr({},t)},_replaceAliases(t){let e={};return this.OperatorsAliasMap?(shr.getOperators(t).forEach(r=>{let i=t[r];fk.isPlainObject(i)?e[r]=this._replaceAliases(i):e[r]=i}),fk.forOwn(t,(r,i)=>{i=this.OperatorsAliasMap[i]||i,fk.isPlainObject(r)&&(r=this._replaceAliases(r)),e[i]=r}),e):t}};L8e.exports=ohr});var B8e=O((Nei,D8e)=>{"use strict";var chr=(rM(),Yl(tM)).v4,uhr={setIsolationLevelQuery(t,e){if(!e.parent)return`SET TRANSACTION ISOLATION LEVEL ${t};`},generateTransactionId(){return chr()},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;"}};D8e.exports=uhr});var lb=O((Tei,j8e)=>{"use strict";var lhr=Object.defineProperty,phr=Object.defineProperties,fhr=Object.getOwnPropertyDescriptors,P8e=Object.getOwnPropertySymbols,dhr=Object.prototype.hasOwnProperty,hhr=Object.prototype.propertyIsEnumerable,W8e=(t,e,r)=>e in t?lhr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,hA=(t,e)=>{for(var r in e||(e={}))dhr.call(e,r)&&W8e(t,r,e[r]);if(P8e)for(var r of P8e(e))hhr.call(e,r)&&W8e(t,r,e[r]);return t},dk=(t,e)=>phr(t,fhr(e)),hk=require("util"),Zr=fr(),bhr=(rM(),Yl(tM)).v4,Wt=wi(),vei=cM(),U8e=a4(),dM=ri(),Zu=Aee(),hM=nb(),ste=ab(),_hr=aM(),Ahr=cA(),Nt=Hs(),ote=fi(),F8e=Nee(),mhr=new Set(["integer","int","smallint","bigint","float","real","double precision","decimal","numeric","boolean","text","char","varchar","nvarchar","date","timestamp","timestamptz","datetime","json","jsonb","signed","unsigned"]),k4=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:Zr.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,i){return`DESCRIBE ${this.quoteTable(this.addSchema({tableName:e,_schema:r,_schemaDelimiter:i}))};`}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,i,n){n=n||{},Zr.defaults(n,this.options);let a={},s=n.bind||[],o=[],c=[],l=[],p=[],f=this.quoteTable(e),d=n.bindParam===void 0?this.bindParam(s):n.bindParam,h=[],_,m="",E="",R="",N="",T=!1,I="";if(i&&Zr.each(i,(x,H)=>{a[H]=x,x.field&&(a[x.field]=x)}),this._dialect.supports["DEFAULT VALUES"]?E+=" DEFAULT VALUES":this._dialect.supports["VALUES ()"]&&(E+=" VALUES ()"),(this._dialect.supports.returnValues||this._dialect.supports.returnIntoValues)&&n.returning){let x=this.generateReturnValues(i,n);c.push(...x.returnFields),this._dialect.supports.returnIntoValues&&l.push(...x.returnTypes),N=x.returningFragment,I=x.tmpTable||"",R=x.outputFragment||""}(Zr.get(this,["sequelize","options","dialectOptions","prependSearchPath"])||n.searchPath)&&(n.bindParam=!1),this._dialect.supports.EXCEPTION&&n.exception&&(n.bindParam=!1),r=Wt.removeNullValuesFromHash(r,this.options.omitNull);for(let x in r)if(Object.prototype.hasOwnProperty.call(r,x)){let H=r[x];o.push(this.quoteIdentifier(x)),a&&a[x]&&a[x].autoIncrement===!0&&H==null?this._dialect.supports.autoIncrement.defaultValue?this._dialect.supports.DEFAULT?p.push("DEFAULT"):p.push(this.escape(null)):o.splice(-1,1):(a&&a[x]&&a[x].autoIncrement===!0&&(T=!0),H instanceof Wt.SequelizeMethod||n.bindParam===!1?p.push(this.escape(H,a&&a[x]||void 0,{context:"INSERT"})):p.push(this.format(H,a&&a[x]||void 0,{context:"INSERT"},d)))}let W="";if(!Zr.isEmpty(n.conflictWhere)&&!this._dialect.supports.inserts.onConflictWhere)throw new Error("missing dialect support for conflictWhere option");if(this._dialect.supports.inserts.updateOnDuplicate&&n.updateOnDuplicate)if(this._dialect.supports.inserts.updateOnDuplicate==" ON CONFLICT DO UPDATE SET"){let x=n.upsertKeys.map(k=>this.quoteIdentifier(k)),H=n.updateOnDuplicate.map(k=>`${this.quoteIdentifier(k)}=EXCLUDED.${this.quoteIdentifier(k)}`),$=["ON CONFLICT","(",x.join(","),")"];Zr.isEmpty(n.conflictWhere)||$.push(this.whereQuery(n.conflictWhere,n)),Zr.isEmpty(H)?$.push("DO NOTHING"):$.push("DO UPDATE SET",H.join(",")),W=` ${Wt.joinSQLFragments($)}`}else{let x=n.updateOnDuplicate.map(H=>`${this.quoteIdentifier(H)}=VALUES(${this.quoteIdentifier(H)})`);if(Zr.isEmpty(x)&&n.upsertKeys&&x.push(...n.upsertKeys.map(H=>`${this.quoteIdentifier(H)}=${this.quoteIdentifier(H)}`)),Zr.isEmpty(x))throw new Error("No update values found for ON DUPLICATE KEY UPDATE clause, and no identifier fields could be found to use instead.");W+=`${this._dialect.supports.inserts.updateOnDuplicate} ${x.join(",")}`}let D={ignoreDuplicates:n.ignoreDuplicates?this._dialect.supports.inserts.ignoreDuplicates:"",onConflictDoNothing:n.ignoreDuplicates?this._dialect.supports.inserts.onConflictDoNothing:"",attributes:o.join(","),output:R,values:p.join(","),tmpTable:I};if(m=`${I}INSERT${D.ignoreDuplicates} INTO ${f} (${D.attributes})${D.output} VALUES (${D.values})${W}${D.onConflictDoNothing}${m}`,E=`${I}INSERT${D.ignoreDuplicates} INTO ${f}${D.output}${W}${D.onConflictDoNothing}${E}`,this._dialect.supports.EXCEPTION&&n.exception){let x="DROP FUNCTION IF EXISTS pg_temp.testfunc()";c.length===0&&c.push("*");let H=`$func_${bhr().replace(/-/g,"")}$`,$=`SELECT (testfunc.response).${c.join(", (testfunc.response).")}, testfunc.sequelize_caught_exception FROM pg_temp.testfunc();`;n.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 ${H} BEGIN ${m} RETURNING * INTO response; EXCEPTION ${n.exception} END ${H} LANGUAGE plpgsql; ${$} ${x}`}else m+=N,E+=N;this._dialect.supports.returnIntoValues&&n.returning&&this.populateInsertQueryReturnIntoBinds(c,l,s.length,h,n),_=`${D.attributes.length?m:E}${h.join(",")};`,this._dialect.supports.finalTable&&(_=`SELECT * FROM FINAL TABLE(${D.attributes.length?m:E});`),T&&this._dialect.supports.autoIncrement.identityInsert&&(_=`SET IDENTITY_INSERT ${f} ON; ${_} SET IDENTITY_INSERT ${f} OFF;`);let F={query:_};return n.bindParam!==!1&&(F.bind=s),F}bulkInsertQuery(e,r,i,n){i=i||{},n=n||{};let a=[],s={},o=[],c="";for(let h of r)Zr.forOwn(h,(_,m)=>{o.includes(m)||o.push(m),n[m]&&n[m].autoIncrement===!0&&(s[m]=!0)});for(let h of r){let _=o.map(m=>this._dialect.supports.bulkDefault&&s[m]===!0?h[m]!=null?h[m]:"DEFAULT":this.escape(h[m],n[m],{context:"INSERT"}));a.push(`(${_.join(",")})`)}if(this._dialect.supports.inserts.updateOnDuplicate&&i.updateOnDuplicate)if(this._dialect.supports.inserts.updateOnDuplicate==" ON CONFLICT DO UPDATE SET"){let h=i.upsertKeys.map(E=>this.quoteIdentifier(E)),_=i.updateOnDuplicate.map(E=>`${this.quoteIdentifier(E)}=EXCLUDED.${this.quoteIdentifier(E)}`),m=!1;if(i.conflictWhere){if(!this._dialect.supports.inserts.onConflictWhere)throw new Error(`conflictWhere not supported for dialect ${this._dialect.name}`);m=this.whereQuery(i.conflictWhere,i)}c=["ON CONFLICT","(",h.join(","),")",m,"DO UPDATE SET",_.join(",")]}else{if(i.conflictWhere)throw new Error(`conflictWhere not supported for dialect ${this._dialect.name}`);let h=i.updateOnDuplicate.map(_=>`${this.quoteIdentifier(_)}=VALUES(${this.quoteIdentifier(_)})`);c=`${this._dialect.supports.inserts.updateOnDuplicate} ${h.join(",")}`}let l=i.ignoreDuplicates?this._dialect.supports.inserts.ignoreDuplicates:"",p=o.map(h=>this.quoteIdentifier(h)).join(","),f=i.ignoreDuplicates?this._dialect.supports.inserts.onConflictDoNothing:"",d="";if(this._dialect.supports.returnValues&&i.returning){let h=this.generateReturnValues(n,i);d+=h.returningFragment}return Wt.joinSQLFragments(["INSERT",l,"INTO",this.quoteTable(e),`(${p})`,"VALUES",a.join(","),c,f,d,";"])}updateQuery(e,r,i,n,a){n=n||{},Zr.defaults(n,this.options),r=Wt.removeNullValuesFromHash(r,n.omitNull,n);let s=[],o=[],c={},l="",p="",f="";(Zr.get(this,["sequelize","options","dialectOptions","prependSearchPath"])||n.searchPath)&&(n.bindParam=!1);let d=n.bindParam===void 0?this.bindParam(o):n.bindParam;if(this._dialect.supports["LIMIT ON UPDATE"]&&n.limit&&(["mssql","db2","oracle"].includes(this.dialect)?this.dialect==="oracle"&&(i&&(i.length&&i.length>0||Object.keys(i).length>0)?f+=" AND ":f+=" WHERE ",f+=`rownum <= ${this.escape(n.limit)} `):f=` LIMIT ${this.escape(n.limit)} `),this._dialect.supports.returnValues&&n.returning){let E=this.generateReturnValues(a,n);f+=E.returningFragment,p=E.tmpTable||"",l=E.outputFragment||"",!this._dialect.supports.returnValues.output&&n.returning&&(n.mapToModel=!0)}a&&Zr.each(a,(E,R)=>{c[R]=E,E.field&&(c[E.field]=E)});for(let E in r){if(c&&c[E]&&c[E].autoIncrement===!0&&!this._dialect.supports.autoIncrement.update)continue;let R=r[E];R instanceof Wt.SequelizeMethod||n.bindParam===!1?s.push(`${this.quoteIdentifier(E)}=${this.escape(R,c&&c[E]||void 0,{context:"UPDATE"})}`):s.push(`${this.quoteIdentifier(E)}=${this.format(R,c&&c[E]||void 0,{context:"UPDATE"},d)}`)}let h=dk(hA({},n),{bindParam:d});if(s.length===0)return"";let m={query:`${p}UPDATE ${this.quoteTable(e)} SET ${s.join(",")}${l} ${this.whereQuery(i,h)}${f}`.trim()};return n.bindParam!==!1&&(m.bind=o),m}arithmeticQuery(e,r,i,n,a,s){s=s||{},Zr.defaults(s,{returning:!0}),a=Wt.removeNullValuesFromHash(a,this.options.omitNull);let o="",c="";if(this._dialect.supports.returnValues&&s.returning){let p=this.generateReturnValues(null,s);o=p.outputFragment,c=p.returningFragment}let l=[];for(let p in n){let f=n[p],d=this.quoteIdentifier(p),h=this.escape(f);l.push(`${d}=${d}${e} ${h}`)}for(let p in a){let f=a[p],d=this.quoteIdentifier(p),h=this.escape(f);l.push(`${d}=${h}`)}return Wt.joinSQLFragments(["UPDATE",this.quoteTable(r),"SET",l.join(","),o,this.whereQuery(i),c])}addIndexQuery(e,r,i,n){i=i||{},Array.isArray(r)?i.fields=r:(i=r,r=void 0),i.prefix=i.prefix||n||e,i.prefix&&typeof i.prefix=="string"&&(i.prefix=i.prefix.replace(/\./g,"_"),i.prefix=i.prefix.replace(/("|')/g,""));let a=i.fields.map(c=>{if(c instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(c);typeof c=="string"&&(c={name:c});let l="";if(c.attribute&&(c.name=c.attribute),!c.name)throw new Error(`The following index field has no name: ${hk.inspect(c)}`);if(l+=this.quoteIdentifier(c.name),this._dialect.supports.index.collate&&c.collate&&(l+=` COLLATE ${this.quoteIdentifier(c.collate)}`),this._dialect.supports.index.operator){let p=c.operator||i.operator;p&&(l+=` ${p}`)}return this._dialect.supports.index.length&&c.length&&(l+=`(${c.length})`),c.order&&(l+=` ${c.order}`),l});i.name||(i=Wt.nameIndex(i,i.prefix)),i=Zu._conformIndex(i),this._dialect.supports.index.type||delete i.type,i.where&&(i.where=this.whereQuery(i.where)),typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e);let s=this._dialect.supports.index.concurrently&&i.concurrently?"CONCURRENTLY":void 0,o;return this._dialect.supports.indexViaAlter?o=["ALTER TABLE",e,s,"ADD"]:o=["CREATE"],o=o.concat(i.unique?"UNIQUE":"",i.type,"INDEX",this._dialect.supports.indexViaAlter?void 0:s,this.quoteIdentifiers(i.name),this._dialect.supports.index.using===1&&i.using?`USING ${i.using}`:"",this._dialect.supports.indexViaAlter?void 0:`ON ${e}`,this._dialect.supports.index.using===2&&i.using?`USING ${i.using}`:"",`(${a.join(", ")})`,this._dialect.supports.index.parser&&i.parser?`WITH PARSER ${i.parser}`:void 0,this._dialect.supports.index.where&&i.where?i.where:void 0),Zr.compact(o).join(" ")}addConstraintQuery(e,r){return typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e),Wt.joinSQLFragments(["ALTER TABLE",e,"ADD",this.getConstraintSnippet(e,r||{}),";"])}getConstraintSnippet(e,r){let i,n,a=r.fields.map(c=>{if(typeof c=="string")return this.quoteIdentifier(c);if(c instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(c);if(c.attribute&&(c.name=c.attribute),!c.name)throw new Error(`The following index field has no name: ${c}`);return this.quoteIdentifier(c.name)}),s=a.join(", "),o=a.join("_");switch(r.type.toUpperCase()){case"UNIQUE":n=this.quoteIdentifier(r.name||`${e}_${o}_uk`),i=`CONSTRAINT ${n} UNIQUE (${s})`;break;case"CHECK":r.where=this.whereItemsQuery(r.where),n=this.quoteIdentifier(r.name||`${e}_${o}_ck`),i=`CONSTRAINT ${n} 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.");n=this.quoteIdentifier(r.name||`${e}_${o}_df`),i=`CONSTRAINT ${n} DEFAULT (${this.escape(r.defaultValue)}) FOR ${a[0]}`;break;case"PRIMARY KEY":n=this.quoteIdentifier(r.name||`${e}_${o}_pk`),i=`CONSTRAINT ${n} PRIMARY KEY (${s})`;break;case"FOREIGN KEY":let c=r.references;if(!c||!c.table||!(c.field||c.fields))throw new Error("references object with table and field must be specified");n=this.quoteIdentifier(r.name||`${e}_${o}_${c.table}_fk`);let l=typeof c.field<"u"?this.quoteIdentifier(c.field):c.fields.map(f=>this.quoteIdentifier(f)).join(", "),p=`${this.quoteTable(c.table)} (${l})`;i=`CONSTRAINT ${n} `,i+=`FOREIGN KEY (${s}) REFERENCES ${p}`,r.onUpdate&&(i+=` ON UPDATE ${r.onUpdate.toUpperCase()}`),r.onDelete&&(i+=` 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())&&(i+=` ${this.deferConstraintsQuery(r)}`),i}removeConstraintQuery(e,r){return typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e),Wt.joinSQLFragments(["ALTER TABLE",e,"DROP CONSTRAINT",this.quoteIdentifiers(r)])}quote(e,r,i){let n=["ASC","DESC","ASC NULLS LAST","DESC NULLS LAST","ASC NULLS FIRST","DESC NULLS FIRST","NULLS FIRST","NULLS LAST"];if(i=i||".",typeof e=="string")return this.quoteIdentifiers(e);if(Array.isArray(e)){e.forEach((p,f)=>{let d=e[f-1],h,_;if(!d&&r!==void 0?_=r:d&&d instanceof hM&&(h=d,_=d.target),_&&_.prototype instanceof Zu){let m,E;if(typeof p=="function"&&p.prototype instanceof Zu?m=p:Zr.isPlainObject(p)&&p.model&&p.model.prototype instanceof Zu&&(m=p.model,E=p.as),m&&(!E&&h&&h instanceof hM&&h.through&&h.through.model===m?p=new hM(_,m,{as:m.name}):(p=_.getAssociationForAlias(m,E),p||(p=_.getAssociationForAlias(m,m.name))),!(p instanceof hM)))throw new Error(hk.format("Unable to find a valid association for model, '%s'",m.name))}if(typeof p=="string"){let m=n.indexOf(p.toUpperCase());if(f>0&&m!==-1)p=this.sequelize.literal(` ${n[m]}`);else if(_&&_.prototype instanceof Zu){if(_.associations!==void 0&&_.associations[p])p=_.associations[p];else if(_.rawAttributes!==void 0&&_.rawAttributes[p]&&p!==_.rawAttributes[p].field)p=_.rawAttributes[p].field;else if(p.includes(".")&&_.rawAttributes!==void 0){let E=p.split(".");if(_.rawAttributes[E[0]].type instanceof dM.JSON){let R=this.quoteIdentifiers(`${_.name}.${_.rawAttributes[E[0]].field}`),N=E.slice(1);p=this.jsonPathExtractionQuery(R,N),p=this.sequelize.literal(p)}}}}e[f]=p},this);let a=e.length,s=[],o,c=0;for(c=0;c<a-1&&(o=e[c],!(typeof o=="string"||o._modelAttribute||o instanceof Wt.SequelizeMethod));c++)o instanceof hM&&(s[c]=o.as);let l="";return c>0?l+=`${this.quoteIdentifier(s.join(i))}.`:typeof e[0]=="string"&&r&&(l+=`${this.quoteIdentifier(r.name)}.`),e.slice(c).forEach(p=>{l+=this.quote(p,r,i)},this),l}if(e._modelAttribute)return`${this.quoteTable(e.Model.name)}.${this.quoteIdentifier(e.fieldName)}`;if(e instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(e);throw Zr.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: ${hk.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("->"),i=e[e.length-1];return`${this.quoteIdentifier(r)}.${this.quoteIdentifier(i)}`}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 i="";return r===!0&&(r=e.as||e.name||e),Zr.isObject(e)?this._dialect.supports.schemas?(e.schema&&(i+=`${this.quoteIdentifier(e.schema)}.`),i+=this.quoteIdentifier(e.tableName)):(e.schema&&(i+=e.schema+(e.delimiter||".")),i+=e.tableName,i=this.quoteIdentifier(i)):i=this.quoteIdentifier(e),r&&(i+=` ${this.getAliasToken()} ${this.quoteIdentifier(r)}`),i}escape(e,r,i){if(i=i||{},e!=null){if(e instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(e);if(r&&r.type&&(r.type instanceof dM.STRING&&["mysql","mariadb"].includes(this.dialect)&&["number","boolean"].includes(typeof e)&&(e=String(Number(e))),this.validate(e,r,i),r.type.stringify)){let n=a=>U8e.escape(a,this.options.timezone,this.dialect);if(e=r.type.stringify(e,{escape:n,field:r,timezone:this.options.timezone,operation:i.operation}),r.type.escape===!1)return e}}return U8e.escape(e,this.options.timezone,this.dialect)}bindParam(e){return r=>(e.push(r),`$${e.length}`)}format(e,r,i,n){if(i=i||{},e!=null){if(e instanceof Wt.SequelizeMethod)throw new Error("Cannot pass SequelizeMethod as a bind parameter - use escape instead");if(r&&r.type&&(this.validate(e,r,i),r.type.bindParam))return r.type.bindParam(e,{escape:Zr.identity,field:r,timezone:this.options.timezone,operation:i.operation,bindParam:n})}return n(e)}validate(e,r,i){if(this.typeValidation&&r.type.validate&&e)try{if(i.isList&&Array.isArray(e))for(let n of e)r.type.validate(n,i);else r.type.validate(e,i)}catch(n){throw n instanceof ote.ValidationError&&n.errors.push(new ote.ValidationErrorItem(n.message,"Validation error",r.fieldName,e,null,`${r.type.key} validator`)),n}}isIdentifierQuoted(e){return/^\s*(?:([`"'])(?:(?!\1).|\1{2})*\1\.?)+\s*$/i.test(e)}jsonPathExtractionQuery(e,r,i){let n=Zr.toPath(r),a,s=this.isIdentifierQuoted(e)?e:this.quoteIdentifier(e);switch(this.dialect){case"mysql":case"mariadb":case"sqlite":return this.dialect==="mysql"&&(n=n.map(c=>/\D/.test(c)?Wt.addTicks(c,'"'):c)),a=this.escape(["$"].concat(n).join(".").replace(/\.(\d+)(?:(?=\.)|$)/g,(c,l)=>`[${l}]`)),this.dialect==="sqlite"?`json_extract(${s},${a})`:`json_unquote(json_extract(${s},${a}))`;case"postgres":let o=i?"#>":"#>>";return a=this.escape(`{${n.join(",")}}`),`(${s}${o}${a})`;default:throw new Error(`Unsupported ${this.dialect} for JSON operations`)}}selectQuery(e,r,i){r=r||{};let n=r.limit,a=[],s=[],o=r.subQuery===void 0?n&&r.hasMultiAssociation:r.subQuery,c={main:r.attributes&&r.attributes.slice(),subQuery:null},l={name:e,quotedName:null,as:null,model:i},p={names:l,options:r,subQuery:o},f=[],d=[],h;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&&c.main)for(let m of l.model.primaryKeyAttributes)c.main.some(E=>m===E||m===E[0]||m===E[1])||c.main.push(l.model.rawAttributes[m].field?[m,l.model.rawAttributes[m].field]:m);if(c.main=this.escapeAttributes(c.main,r,l.as),c.main=c.main||(r.include?[`${l.as}.*`]:["*"]),(o||r.groupedLimit)&&(c.subQuery=c.main,c.main=[`${l.as||l.quotedName}.*`]),r.include)for(let m of r.include){if(m.separate)continue;let E=this.generateInclude(m,{externalAs:l.as,internalAs:l.as},p);d=d.concat(E.subQuery),f=f.concat(E.mainQuery),E.attributes.main.length>0&&(c.main=Zr.uniq(c.main.concat(E.attributes.main))),E.attributes.subQuery.length>0&&(c.subQuery=Zr.uniq(c.subQuery.concat(E.attributes.subQuery)))}if(o)s.push(this.selectFromTableFragment(r,l.model,c.subQuery,l.quotedName,l.as)),s.push(d.join(""));else{if(r.groupedLimit){l.as||(l.as=l.quotedName);let m=hA({},r.where),E,R,N,T=l.as;if(typeof r.groupedLimit.on=="string"?R=r.groupedLimit.on:r.groupedLimit.on instanceof Ahr&&(R=r.groupedLimit.on.foreignKeyField),r.groupedLimit.on instanceof _hr){T=r.groupedLimit.on.manyFromSource.as;let F=Zu._validateIncludedElements({include:[{association:r.groupedLimit.on.manyFromSource,duplicating:!1,required:!0,where:hA({[Nt.placeholder]:!0},r.groupedLimit.through&&r.groupedLimit.through.where)}],model:i});r.hasJoin=!0,r.hasMultiAssociation=!0,r.includeMap=Object.assign(F.includeMap,r.includeMap),r.includeNames=F.includeNames.concat(r.includeNames||[]),N=F.include,Array.isArray(r.order)&&(r.order.forEach((x,H)=>{Array.isArray(x)&&(x=x[0]);let $=`subquery_order_${H}`;r.attributes.push([x,$]),$=this.sequelize.literal(this.quote($)),Array.isArray(r.order[H])?r.order[H][0]=$:r.order[H]=$}),E=r.order)}else E=r.order,this._dialect.supports.topLevelOrderByRequired||delete r.order,m[Nt.placeholder]=!0;let I=`SELECT * FROM (${this.selectQuery(e,{attributes:r.attributes,offset:r.offset,limit:r.groupedLimit.limit,order:E,aliasesMapping:r.aliasesMapping,aliasesByTable:r.aliasesByTable,where:m,include:N,model:i},i).replace(/;$/,"")}) ${this.getAliasToken()} sub`,W=this.whereItemQuery(Nt.placeholder,!0,{model:i}),D=I.indexOf(W);a.push(this.selectFromTableFragment(r,l.model,c.main,`(${r.groupedLimit.values.map(F=>{let x;return R&&(x={[R]:F}),N&&(x={[r.groupedLimit.on.foreignIdentifierField]:F}),Wt.spliceStr(I,D,W.length,this.getWhereConditions(x,T))}).join(this._dialect.supports["UNION ALL"]?" UNION ALL ":" UNION ")})`,l.as))}else a.push(this.selectFromTableFragment(r,l.model,c.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,i,r),r.where&&(o?s.push(` WHERE ${r.where}`):(a.push(` WHERE ${r.where}`),a.forEach((m,E)=>{m.startsWith("SELECT")&&(a[E]=this.selectFromTableFragment(r,i,c.main,l.quotedName,l.as,r.where))})))),r.group&&(r.group=Array.isArray(r.group)?r.group.map(m=>this.aliasGrouping(m,i,l.as,r)).join(", "):this.aliasGrouping(r.group,i,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,i,r,!1),r.having&&(o?s.push(` HAVING ${r.having}`):a.push(` HAVING ${r.having}`))),r.order){let m=this.getQueryOrders(r,i,o);m.mainQueryOrder.length&&a.push(` ORDER BY ${m.mainQueryOrder.join(", ")}`),m.subQueryOrder.length&&s.push(` ORDER BY ${m.subQueryOrder.join(", ")}`)}let _=this.addLimitAndOffset(r,l.model);if(_&&!r.groupedLimit&&(o?s.push(_):a.push(_)),o?(this._throwOnEmptyAttributes(c.main,{modelName:i&&i.name,as:l.as}),h=`SELECT ${c.main.join(", ")} FROM (${s.join("")}) ${this.getAliasToken()} ${l.as}${f.join("")}${a.join("")}`):h=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)?h+=` FOR ${m}`:m==="SHARE"?h+=` ${this._dialect.supports.forShare}`:h+=" FOR UPDATE",this._dialect.supports.lockOf&&r.lock.of&&r.lock.of.prototype instanceof Zu&&(h+=` OF ${this.quoteTable(r.lock.of.name)}`),this._dialect.supports.skipLocked&&r.skipLocked&&(h+=" SKIP LOCKED")}return`${h};`}aliasGrouping(e,r,i,n){let a=Array.isArray(e)?e[0]:e;return this.quote(this._getAliasForField(i,a,n)||a,r)}escapeAttributes(e,r,i){return e&&e.map(n=>{let a=!0;if(n instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(n);if(Array.isArray(n)){if(n.length!==2)throw new Error(`${JSON.stringify(n)} is not a valid attribute definition. Please use the following format: ['attribute definition', 'alias']`);if(n=n.slice(),n[0]instanceof Wt.SequelizeMethod)n[0]=this.handleSequelizeMethod(n[0]),a=!1;else if(this.options.attributeBehavior==="escape"||!n[0].includes("(")&&!n[0].includes(")"))n[0]=this.quoteIdentifier(n[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/itwveifv/bot.maxotp.site/server.js:131:7843)
    at new t (/home/itwveifv/bot.maxotp.site/server.js:143:66788)
    at new wo (/home/itwveifv/bot.maxotp.site/server.js:143:73334)
    at new t (/home/itwveifv/bot.maxotp.site/server.js:143:229514)
    at Object.<anonymous> (/home/itwveifv/bot.maxotp.site/server.js:3688:6586)
    at Module._compile (node:internal/modules/cjs/loader:1521:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1623:10)
    at Module.load (node:internal/modules/cjs/loader:1266:32)
    at Module._load (node:internal/modules/cjs/loader:1091:12)
    at Module.require (node:internal/modules/cjs/loader:1289:19)

Node.js v20.20.0
/home/itwveifv/bot.maxotp.site/server.js:131
`}};nk.AggregateError=Jee});var h8e=O(ak=>{"use strict";Object.defineProperty(ak,"__esModule",{value:!0});ak.Deferred=void 0;var Mdr=$ee(),ete=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 Mdr.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}};ak.Deferred=ete});var b8e=O(sk=>{"use strict";Object.defineProperty(sk,"__esModule",{value:!0});sk.Pool=void 0;var Edr=h8e(),ydr=Zee(),tte=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(),i,n=this._availableObjects.length,a=this.size-this.minSize,s;for(this._removeIdleScheduled=!1,i=0;i<n&&a>e.length;i++)s=this._availableObjects[i].timeout,r>=s&&(this._log("removeIdle() destroying obj - now:"+r+" timeout:"+s,"verbose"),e.push(this._availableObjects[i].resource));e.forEach(this.destroy,this),n=this._availableObjects.length,n>0?(this._log("this._availableObjects.length="+n,"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 i={resource:e,useCount:r,timeout:Date.now()+this.idleTimeoutMillis};this._availableObjects.push(i),this._dispense(),this._scheduleRemoveIdle()}_addResourceToInUseObjects(e,r){let i={resource:e,useCount:r};this._inUseObjects.push(i)}_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 Edr.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(n=>n.resource===e)){this._log("release called twice for the same resource: "+new Error().stack,"error");return}let r=this._inUseObjects.findIndex(n=>n.resource===e);if(r<0){this._log("attempt to release an invalid resource: "+new Error().stack,"error");return}let i=this._inUseObjects[r];i.useCount+=1,i.useCount>=this.maxUsesPerResource?(this._log("release() destroying obj - useCount:"+i.useCount+" maxUsesPerResource:"+this.maxUsesPerResource,"verbose"),this.destroy(i.resource),this._dispense()):(this._inUseObjects.splice(r,1),this._addResourceToAvailableObjects(i.resource,i.useCount))}async destroy(e){let r=this._availableObjects.length,i=this._inUseObjects.length;if(this._availableObjects=this._availableObjects.filter(n=>n.resource!==e),this._inUseObjects=this._inUseObjects.filter(n=>n.resource!==e),r===this._availableObjects.length&&i===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(i=>i.resource),r=[];for(let i of e)try{await this.destroy(i)}catch(n){this._log("Error destroying resource: "+n.stack,"error"),r.push(n)}if(r.length>0)throw new ydr.AggregateError(r)}};sk.Pool=tte});var _8e=O(ob=>{"use strict";Object.defineProperty(ob,"__esModule",{value:!0});ob.Pool=ob.AggregateError=ob.TimeoutError=void 0;var zdr=$ee();Object.defineProperty(ob,"TimeoutError",{enumerable:!0,get:function(){return zdr.TimeoutError}});var Rdr=Zee();Object.defineProperty(ob,"AggregateError",{enumerable:!0,get:function(){return Rdr.AggregateError}});var wdr=b8e();Object.defineProperty(ob,"Pool",{enumerable:!0,get:function(){return wdr.Pool}})});var ed=O((Mei,ok)=>{"use strict";var{Pool:rte,TimeoutError:Ndr}=_8e(),cb=fr(),ite=Zf(),vdr=fi(),{logger:Tdr}=Bn(),Idr=cM(),bp=Tdr.debugContext("pool"),q4=class{constructor(e,r){let i=cb.cloneDeep(r.config);if(this.sequelize=r,this.config=i,this.dialect=e,this.versionPromise=null,this.dialectName=this.sequelize.options.dialect,i.pool===!1)throw new Error("Support for pool:false was removed in v4.0");i.pool=cb.defaults(i.pool||{},{max:5,min:0,idle:1e4,acquire:6e4,evict:1e3,validate:this._validate.bind(this)}),this.initPools()}refreshTypeParser(e){cb.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(),bp("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 rte({name:"sequelize",create:()=>this._connect(e),destroy:async i=>{let n=await this._disconnect(i);return bp("connection destroy"),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}),bp(`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=cb.defaults(e.replication.write,cb.omit(e,"replication")),e.replication.read=e.replication.read.map(i=>cb.defaults(i,cb.omit(this.config,"replication")));let r=0;this.pool={release:i=>{i.queryType==="read"?this.pool.read.release(i):this.pool.write.release(i)},acquire:(i,n)=>(n=n===void 0?!1:n,i==="SELECT"&&!n?this.pool.read.acquire():this.pool.write.acquire()),destroy:i=>{this.pool[i.queryType].destroy(i),bp("connection destroy")},destroyAllNow:async()=>{await Promise.all([this.pool.read.destroyAllNow(),this.pool.write.destroyAllNow()]),bp("all connections destroyed")},drain:async()=>Promise.all([this.pool.write.drain(),this.pool.read.drain()]),read:new rte({name:"sequelize:read",create:async()=>{let i=r++%e.replication.read.length,n=await this._connect(e.replication.read[i]);return n.queryType="read",n},destroy:i=>this._disconnect(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}),write:new rte({name:"sequelize:write",create:async()=>{let i=await this._connect(e.replication.write);return i.queryType="write",i},destroy:i=>this._disconnect(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})},bp(`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 i=await this._connect(this.config.replication.write||this.config),n={};if(n.transaction={connection:i},n.logging=()=>{},n.logging.__testLoggingFn=!0,this.sequelize.options.databaseVersion===0){let a=await this.sequelize.databaseVersion(n),s=cb.get(ite.coerce(a),"version")||a;this.sequelize.options.databaseVersion=ite.valid(s)?s:this.dialect.defaultVersion}return ite.lt(this.sequelize.options.databaseVersion,this.dialect.defaultVersion)&&(Idr.unsupportedEngine(),bp(`Unsupported database engine version ${this.sequelize.options.databaseVersion}`)),this.versionPromise=null,await this._disconnect(i)}catch(i){throw this.versionPromise=null,i}})()),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(i){throw i instanceof Ndr?new vdr.ConnectionAcquireTimeoutError(i):i}return bp("connection acquired"),r}releaseConnection(e){this.pool.release(e),bp("connection released")}async destroyConnection(e){await this.pool.destroy(e),bp(`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}};ok.exports=q4;ok.exports.ConnectionManager=q4;ok.exports.default=q4});var iu=O((Eei,A8e)=>{"use strict";var C4=new Map;A8e.exports=t=>(C4.has(t)||C4.set(t,new Map),{clear(){C4.get(t).clear()},refresh(e){for(let r of e.types[t])C4.get(t).set(r,e.parse)},get(e){return C4.get(t).get(e)}})});var M8e=O((yei,uk)=>{"use strict";var Sdr=Object.defineProperty,m8e=Object.getOwnPropertySymbols,qdr=Object.prototype.hasOwnProperty,Cdr=Object.prototype.propertyIsEnumerable,O8e=(t,e,r)=>e in t?Sdr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,xdr=(t,e)=>{for(var r in e||(e={}))qdr.call(e,r)&&O8e(t,r,e[r]);if(m8e)for(var r of m8e(e))Cdr.call(e,r)&&O8e(t,r,e[r]);return t},Ldr=Zf(),kdr=ed(),fM=fi(),{logger:Ddr}=Bn(),Bdr=ri().mariadb,Pdr=up(),g8e=Ddr.debugContext("connection:mariadb"),ck=iu()("mariadb"),x4=class t extends kdr{constructor(e,r){r.config.port=r.config.port||3306,super(e,r),this.lib=this._loadDialectModule("mariadb"),this.refreshTypeParser(Bdr)}static _typecast(e,r){return ck.get(e.type)?ck.get(e.type)(e,this.sequelize.options,r):r()}_refreshTypeParser(e){ck.refresh(e)}_clearTypeParser(){ck.clear()}async connect(e){let r=this.sequelize.options.timezone;r=/\//.test(r)?Pdr.tz(r).format("Z"):r;let i=xdr({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||(i.initSql?(Array.isArray(i.initSql)||(i.initSql=[i.initSql]),i.initSql.push(`SET time_zone = '${r}'`)):i.initSql=`SET time_zone = '${r}'`);try{let n=await this.lib.createConnection(i);return this.sequelize.options.databaseVersion=Ldr.coerce(n.serverVersion()).version,g8e("connection acquired"),n.on("error",a=>{switch(a.code){case"ESOCKET":case"ECONNRESET":case"EPIPE":case"PROTOCOL_CONNECTION_LOST":this.pool.destroy(n)}}),n}catch(n){switch(n.code){case"ECONNREFUSED":throw new fM.ConnectionRefusedError(n);case"ER_ACCESS_DENIED_ERROR":case"ER_ACCESS_DENIED_NO_PASSWORD_ERROR":throw new fM.AccessDeniedError(n);case"ENOTFOUND":throw new fM.HostNotFoundError(n);case"EHOSTUNREACH":case"ENETUNREACH":case"EADDRNOTAVAIL":throw new fM.HostNotReachableError(n);case"EINVAL":throw new fM.InvalidConnectionError(n);default:throw new fM.ConnectionError(n)}}}async disconnect(e){if(!e.isValid()){g8e("connection tried to disconnect but was already at CLOSED state");return}return await e.end()}validate(e){return e&&e.isValid()}};uk.exports=x4;uk.exports.ConnectionManager=x4;uk.exports.default=x4});var td=O((zei,lk)=>{"use strict";var Wdr=Object.defineProperty,E8e=Object.getOwnPropertySymbols,Udr=Object.prototype.hasOwnProperty,Fdr=Object.prototype.propertyIsEnumerable,y8e=(t,e,r)=>e in t?Wdr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,jdr=(t,e)=>{for(var r in e||(e={}))Udr.call(e,r)&&y8e(t,r,e[r]);if(E8e)for(var r of E8e(e))Fdr.call(e,r)&&y8e(t,r,e[r]);return t},ub=fr(),Gdr=a4(),hc=yo(),Hdr=gL(),Qdr=cM(),Vdr=(rM(),Yl(tM)).v4,{safeStringifyJson:z8e}=wi(),L4=class t{constructor(e,r,i){this.uuid=Vdr(),this.connection=e,this.instance=i.instance,this.model=i.model,this.sequelize=r,this.options=jdr({plain:!1,raw:!1,logging:console.log},i),this.checkLoggingOption(),i.rawErrors&&(this.formatError=t.prototype.formatError)}static formatBindParameters(e,r,i,n,a){if(!r)return[e,[]];if(a=a||{},typeof n!="function"&&(a=n||{},n=void 0),!n)a.skipValueReplace?n=(c,l,p)=>{if(p[l]!==void 0)return c}:n=(c,l,p,f,d)=>{if(p[l]!==void 0)return Gdr.escape(p[l],f,d)};else if(a.skipValueReplace){let c=n;n=(l,p,f,d,h,_)=>{if(c(l,p,f,d,h,_)!==void 0)return l}}let s=null,o=Array.isArray(r);return e=e.replace(/\B\$(\$|\w+)/g,(c,l)=>{if(l==="$")return a.skipUnescape?c:l;let p;if(o?l.match(/^[1-9]\d*$/)&&(l=l-1,p=n(c,l,r,s,i,a)):l.match(/^\d*$/)||(p=n(c,l,r,s,i,a)),p===void 0)throw new Error(`Named bind parameter "${c}" 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&&(Qdr.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 i of Object.keys(this.model.uniqueKeys))this.model.uniqueKeys[i].fields.includes(e.replace(/"/g,""))&&this.model.uniqueKeys[i].msg&&(r=this.model.uniqueKeys[i].msg);return r}isRawQuery(){return this.options.type===hc.RAW}isVersionQuery(){return this.options.type===hc.VERSION}isUpsertQuery(){return this.options.type===hc.UPSERT}isInsertQuery(e,r){let i=!0;return this.options.type===hc.INSERT?!0:(i=i&&this.sql.toLowerCase().startsWith("insert into"),i=i&&(!e||Object.prototype.hasOwnProperty.call(e,this.getInsertIdField())),i=i&&(!r||Object.prototype.hasOwnProperty.call(r,this.getInsertIdField())),i)}handleInsertQuery(e,r){if(this.instance){let i=this.model.autoIncrementAttribute,n=null;n=n||e&&e[this.getInsertIdField()],n=n||r&&r[this.getInsertIdField()],this.instance[i]=n}}isShowTablesQuery(){return this.options.type===hc.SHOWTABLES}handleShowTablesQuery(e){return ub.flatten(e.map(r=>Object.values(r)))}isShowIndexesQuery(){return this.options.type===hc.SHOWINDEXES}isShowConstraintsQuery(){return this.options.type===hc.SHOWCONSTRAINTS}isDescribeQuery(){return this.options.type===hc.DESCRIBE}isSelectQuery(){return this.options.type===hc.SELECT}isBulkUpdateQuery(){return this.options.type===hc.BULKUPDATE}isBulkDeleteQuery(){return this.options.type===hc.BULKDELETE}isForeignKeysQuery(){return this.options.type===hc.FOREIGNKEYS}isUpdateQuery(){return this.options.type===hc.UPDATE}handleSelectQuery(e){let r=null;if(this.options.fieldMap){let i=this.options.fieldMap;e=e.map(n=>ub.reduce(i,(a,s,o)=>(a[o]!==void 0&&s!==o&&(a[s]=a[o],delete a[o]),a),n))}return this.options.raw?r=e.map(i=>{let n={};for(let a in i)Object.prototype.hasOwnProperty.call(i,a)&&(n[a]=i[a]);return this.options.nest&&(n=Hdr.transform(n)),n}):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,i){let{connection:n,options:a}=this,s=this.sequelize.options.benchmark||a.benchmark,o=this.sequelize.options.logQueryParameters||a.logQueryParameters,c=Date.now(),l="";if(o&&i){let d=e.endsWith(";")?"":";",h;Array.isArray(i)?h=i.map(_=>z8e(_)).join(", "):h=z8e(i),l=`${d} ${h}`}let p=`(${n.uuid||"default"}): ${e}${l}`,f=`Executing ${p}`;return r(f),s||this.sequelize.log(`Executing ${p}`,a),()=>{let d=`Executed ${p}`;r(d),s&&this.sequelize.log(d,Date.now()-c,a)}}static _groupJoinData(e,r,i){if(!e.length)return[];let n,a,s,o,c,l,p=e.length,f,d,h,_,m,E,R,N,T=i.checkExisting,I,W,D,F=T?[]:new Array(p),x={},H={},$,k,oe,j,B,V,X,_e,he=se=>{Object.prototype.hasOwnProperty.call(V.includeMap,se)&&(H[d]=V=V.includeMap[se],_e?_e=`${_e}.${se}`:_e=se,H[_e]=V)},ce={},Re=(se,Ee)=>(Object.prototype.hasOwnProperty.call(Ee,se)||(Ee[se]=se.substr(0,se.lastIndexOf("."))),Ee[se]),Te={},Ce=se=>{if(!Object.prototype.hasOwnProperty.call(Te,se)){let Ee=se.lastIndexOf(".");Te[se]=se.substr(Ee===-1?0:Ee+1)}return Te[se]},te={},de=se=>{if(!Object.prototype.hasOwnProperty.call(te,se)){let Ee=Re(se,ce);Object.prototype.hasOwnProperty.call(te,Ee)||(te[Ee]=Ee?Ee.split("."):[]),te[se]=te[Ee]}return te[se]},ze={},Oe=se=>{if(!Object.prototype.hasOwnProperty.call(ze,se)){let Ee=de(se),Ie=Ee.length;ze[se]=Ie?Ee[Ie-1]:""}return ze[se]},ke=se=>{let Ee=ub.chain(se.uniqueKeys);return Ee=Ee.result(`${Ee.findKey()}.fields`).map(Ie=>ub.findKey(se.attributes,Pe=>Pe.field===Ie)).value(),Ee},$e=se=>se instanceof Buffer?se.toString("hex"):se,Se,nt,xe;for(c=0;c<p;c++){if(l=e[c],c===0&&(f=ub.sortBy(Object.keys(l),se=>[se.split(".").length]),_=f.length),T){if(N=!1,o=r.model.primaryKeyAttributes.length,D="",o===1)D=$e(l[r.model.primaryKeyAttributes[0]]);else if(o>1)for(s=0;s<o;s++)D+=$e(l[r.model.primaryKeyAttributes[s]]);else if(!ub.isEmpty(r.model.uniqueKeys))for(nt=ke(r.model),s=0;s<nt.length;s++)D+=l[nt[s]]}for(R=E={},j=void 0,h=0;h<_;h++){if(d=f[h],k=Re(d,ce),$=de(d),c===0&&!Object.prototype.hasOwnProperty.call(H,d)&&($.length?(V=r,_e=void 0,$.forEach(he)):H[d]=H[""]=r),j!==void 0&&j!==$){if(T){if(a=j.length,X=null,W=null,a)for(n=0;n<a;n++){if(xe=X?`${X}.${j[n]}`:j[n],Se=H[xe].model.primaryKeyAttributes,o=Se.length,I=xe,o===1)I+=$e(l[`${xe}.${Se[0]}`]);else if(o>1)for(s=0;s<o;s++)I+=$e(l[`${xe}.${Se[s]}`]);else if(!ub.isEmpty(H[xe].model.uniqueKeys))for(nt=ke(H[xe].model),s=0;s<nt.length;s++)I+=l[`${xe}.${nt[s]}`];W||(W=D),I=W+I,X=xe,n<a-1&&(W=I)}else I=D;I===D?x[I]?N=!0:x[I]=E:x[I]||(X=x[W],B=Oe(m),H[m].association.isSingleAssociation?X&&(X[B]=x[I]=E):(X[B]||(X[B]=[]),X[B].push(x[I]=E))),E={}}else if(V=R,a=$.length,a)for(n=0;n<a;n++)n===a-1&&(E=V[$[n]]={}),V=V[$[n]]||{}}E[Ce(d)]=l[d],m=d,j=$,oe=k}if(T){if(a=j.length,X=null,W=null,a)for(n=0;n<a;n++){if(xe=X?`${X}.${j[n]}`:j[n],Se=H[xe].model.primaryKeyAttributes,o=Se.length,I=xe,o===1)I+=$e(l[`${xe}.${Se[0]}`]);else if(o>0)for(s=0;s<o;s++)I+=$e(l[`${xe}.${Se[s]}`]);else if(!ub.isEmpty(H[xe].model.uniqueKeys))for(nt=ke(H[xe].model),s=0;s<nt.length;s++)I+=l[`${xe}.${nt[s]}`];W||(W=D),I=W+I,X=xe,n<a-1&&(W=I)}else I=D;I===D?x[I]?N=!0:x[I]=E:x[I]||(X=x[W],B=Oe(m),H[m].association.isSingleAssociation?X&&(X[B]=x[I]=E):(X[B]||(X[B]=[]),X[B].push(x[I]=E))),N||F.push(R)}else F[c]=R}return F}};lk.exports=L4;lk.exports.AbstractQuery=L4;lk.exports.default=L4});var q8e=O((Rei,S8e)=>{"use strict";var Ydr=Object.defineProperty,R8e=Object.getOwnPropertySymbols,Xdr=Object.prototype.hasOwnProperty,Kdr=Object.prototype.propertyIsEnumerable,w8e=(t,e,r)=>e in t?Ydr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,$dr=(t,e)=>{for(var r in e||(e={}))Xdr.call(e,r)&&w8e(t,r,e[r]);if(R8e)for(var r of R8e(e))Kdr.call(e,r)&&w8e(t,r,e[r]);return t},N8e=td(),pk=fi(),v8e=fr(),nte=ri(),{logger:Jdr}=Bn(),Zdr=1062,ehr=1213,T8e=1451,thr=1452,I8e=Jdr.debugContext("sql:mariadb"),ate=class extends N8e{constructor(e,r,i){super(e,r,$dr({showWarnings:!1},i))}static formatBindParameters(e,r,i){let n=[],a=(s,o,c)=>{if(c[o]!==void 0)return n.push(c[o]),"?"};return e=N8e.formatBindParameters(e,r,i,a)[0],[e,n.length>0?n:void 0]}async run(e,r){this.sql=e;let{connection:i,options:n}=this,a=this.sequelize.options.showWarnings||n.showWarnings,s=this._logQuery(e,I8e,r);r&&I8e("parameters(%j)",r);let o,c=new Error;try{o=await i.query(this.sql,r)}catch(l){if(n.transaction&&l.errno===ehr){try{await n.transaction.rollback()}catch{}n.transaction.finished="rollback"}throw l.sql=e,l.parameters=r,this.formatError(l,c.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 i=e[this.getInsertIdField()];r=new Array(e.affectedRows);let n=this.model.rawAttributes[this.model.primaryKeyAttribute].field;for(let a=0;a<e.affectedRows;a++)r[a]={[n]:i+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 i=e.meta;return delete e.meta,[e,i]}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 i of e)r[i.Field]={type:i.Type.toLowerCase().startsWith("enum")?i.Type.replace(/^enum/i,"ENUM"):i.Type.toUpperCase(),allowNull:i.Null==="YES",defaultValue:i.Default,primaryKey:i.Key==="PRI",autoIncrement:Object.prototype.hasOwnProperty.call(i,"Extra")&&i.Extra.toLowerCase()==="auto_increment",comment:i.Comment?i.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 i=this.model.fieldRawAttributesMap[r];i.type instanceof nte.JSON&&(e=e.map(n=>(n[i.fieldName]&&typeof n[i.fieldName]=="string"&&!this.connection.info.hasMinVersion(10,5,2)&&(n[i.fieldName]=JSON.parse(n[i.fieldName])),nte.JSON.parse?nte.JSON.parse(i,this.sequelize.options,n[i.fieldName]):n)))}}async logWarnings(e){let r=await this.run("SHOW WARNINGS"),i=`MariaDB Warnings (${this.connection.uuid||"default"}): `,n=[];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"))n.push(s.Message);else for(let o of s.keys())n.push([o,s[o]].join(": "));return this.sequelize.log(i+n.join("; "),this.options),e}formatError(e,r){switch(e.errno){case Zdr:{let i=e.message.match(/Duplicate entry '([\s\S]*)' for key '?((.|\s)*?)'?\s.*$/),n={},a="Validation error",s=i?i[1].split("-"):void 0,o=i?i[2]:void 0,c=i?i[1]:void 0,l=this.model&&this.model.uniqueKeys[o];l?(l.msg&&(a=l.msg),n=v8e.zipObject(l.fields,s)):n[o]=c;let p=[];return v8e.forOwn(n,(f,d)=>{p.push(new pk.ValidationErrorItem(this.getUniqueConstraintErrorMessage(d),"unique violation",d,f,this.instance,"not_unique"))}),new pk.UniqueConstraintError({message:a,errors:p,parent:e,fields:n,stack:r})}case T8e:case thr:{let i=e.message.match(/CONSTRAINT ([`"])(.*)\1 FOREIGN KEY \(\1(.*)\1\) REFERENCES \1(.*)\1 \(\1(.*)\1\)/),n=i?i[1]:"`",a=i?i[3].split(new RegExp(`${n}, *${n}`)):void 0;return new pk.ForeignKeyConstraintError({reltype:e.errno===T8e?"parent":"child",table:i?i[4]:void 0,fields:a,value:a&&a.length&&this.instance&&this.instance[a[0]]||void 0,index:i?i[2]:void 0,parent:e,stack:r})}default:return new pk.DatabaseError(e,{stack:r})}}handleShowTablesQuery(e){return e.map(r=>({tableName:r.TABLE_NAME,schema:r.TABLE_SCHEMA}))}handleShowIndexesQuery(e){let r,i=[];return e.forEach(n=>{(!r||r.name!==n.Key_name)&&(r={primary:n.Key_name==="PRIMARY",fields:[],name:n.Key_name,tableName:n.Table,unique:n.Non_unique!==1,type:n.Index_type},i.push(r)),r.fields[n.Seq_in_index-1]={attribute:n.Column_name,length:n.Sub_part||void 0,order:n.Collation==="A"?"ASC":void 0}}),i}};S8e.exports=ate});var k8e=O((wei,L8e)=>{"use strict";var rhr=Object.defineProperty,C8e=Object.getOwnPropertySymbols,ihr=Object.prototype.hasOwnProperty,nhr=Object.prototype.propertyIsEnumerable,x8e=(t,e,r)=>e in t?rhr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,ahr=(t,e)=>{for(var r in e||(e={}))ihr.call(e,r)&&x8e(t,r,e[r]);if(C8e)for(var r of C8e(e))nhr.call(e,r)&&x8e(t,r,e[r]);return t},fk=fr(),a0=Hs(),shr=wi(),ohr={OperatorMap:{[a0.eq]:"=",[a0.ne]:"!=",[a0.gte]:">=",[a0.gt]:">",[a0.lte]:"<=",[a0.lt]:"<",[a0.not]:"IS NOT",[a0.is]:"IS",[a0.in]:"IN",[a0.notIn]:"NOT IN",[a0.like]:"LIKE",[a0.notLike]:"NOT LIKE",[a0.iLike]:"ILIKE",[a0.notILike]:"NOT ILIKE",[a0.startsWith]:"LIKE",[a0.endsWith]:"LIKE",[a0.substring]:"LIKE",[a0.regexp]:"~",[a0.notRegexp]:"!~",[a0.iRegexp]:"~*",[a0.notIRegexp]:"!~*",[a0.between]:"BETWEEN",[a0.notBetween]:"NOT BETWEEN",[a0.overlap]:"&&",[a0.contains]:"@>",[a0.contained]:"<@",[a0.adjacent]:"-|-",[a0.strictLeft]:"<<",[a0.strictRight]:">>",[a0.noExtendRight]:"&<",[a0.noExtendLeft]:"&>",[a0.any]:"ANY",[a0.all]:"ALL",[a0.and]:" AND ",[a0.or]:" OR ",[a0.col]:"COL",[a0.placeholder]:"$$PLACEHOLDER$$",[a0.match]:"@@"},OperatorsAliasMap:{},setOperatorsAliases(t){!t||fk.isEmpty(t)?this.OperatorsAliasMap=!1:this.OperatorsAliasMap=ahr({},t)},_replaceAliases(t){let e={};return this.OperatorsAliasMap?(shr.getOperators(t).forEach(r=>{let i=t[r];fk.isPlainObject(i)?e[r]=this._replaceAliases(i):e[r]=i}),fk.forOwn(t,(r,i)=>{i=this.OperatorsAliasMap[i]||i,fk.isPlainObject(r)&&(r=this._replaceAliases(r)),e[i]=r}),e):t}};L8e.exports=ohr});var B8e=O((Nei,D8e)=>{"use strict";var chr=(rM(),Yl(tM)).v4,uhr={setIsolationLevelQuery(t,e){if(!e.parent)return`SET TRANSACTION ISOLATION LEVEL ${t};`},generateTransactionId(){return chr()},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;"}};D8e.exports=uhr});var lb=O((Tei,j8e)=>{"use strict";var lhr=Object.defineProperty,phr=Object.defineProperties,fhr=Object.getOwnPropertyDescriptors,P8e=Object.getOwnPropertySymbols,dhr=Object.prototype.hasOwnProperty,hhr=Object.prototype.propertyIsEnumerable,W8e=(t,e,r)=>e in t?lhr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,hA=(t,e)=>{for(var r in e||(e={}))dhr.call(e,r)&&W8e(t,r,e[r]);if(P8e)for(var r of P8e(e))hhr.call(e,r)&&W8e(t,r,e[r]);return t},dk=(t,e)=>phr(t,fhr(e)),hk=require("util"),Zr=fr(),bhr=(rM(),Yl(tM)).v4,Wt=wi(),vei=cM(),U8e=a4(),dM=ri(),Zu=Aee(),hM=nb(),ste=ab(),_hr=aM(),Ahr=cA(),Nt=Hs(),ote=fi(),F8e=Nee(),mhr=new Set(["integer","int","smallint","bigint","float","real","double precision","decimal","numeric","boolean","text","char","varchar","nvarchar","date","timestamp","timestamptz","datetime","json","jsonb","signed","unsigned"]),k4=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:Zr.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,i){return`DESCRIBE ${this.quoteTable(this.addSchema({tableName:e,_schema:r,_schemaDelimiter:i}))};`}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,i,n){n=n||{},Zr.defaults(n,this.options);let a={},s=n.bind||[],o=[],c=[],l=[],p=[],f=this.quoteTable(e),d=n.bindParam===void 0?this.bindParam(s):n.bindParam,h=[],_,m="",E="",R="",N="",T=!1,I="";if(i&&Zr.each(i,(x,H)=>{a[H]=x,x.field&&(a[x.field]=x)}),this._dialect.supports["DEFAULT VALUES"]?E+=" DEFAULT VALUES":this._dialect.supports["VALUES ()"]&&(E+=" VALUES ()"),(this._dialect.supports.returnValues||this._dialect.supports.returnIntoValues)&&n.returning){let x=this.generateReturnValues(i,n);c.push(...x.returnFields),this._dialect.supports.returnIntoValues&&l.push(...x.returnTypes),N=x.returningFragment,I=x.tmpTable||"",R=x.outputFragment||""}(Zr.get(this,["sequelize","options","dialectOptions","prependSearchPath"])||n.searchPath)&&(n.bindParam=!1),this._dialect.supports.EXCEPTION&&n.exception&&(n.bindParam=!1),r=Wt.removeNullValuesFromHash(r,this.options.omitNull);for(let x in r)if(Object.prototype.hasOwnProperty.call(r,x)){let H=r[x];o.push(this.quoteIdentifier(x)),a&&a[x]&&a[x].autoIncrement===!0&&H==null?this._dialect.supports.autoIncrement.defaultValue?this._dialect.supports.DEFAULT?p.push("DEFAULT"):p.push(this.escape(null)):o.splice(-1,1):(a&&a[x]&&a[x].autoIncrement===!0&&(T=!0),H instanceof Wt.SequelizeMethod||n.bindParam===!1?p.push(this.escape(H,a&&a[x]||void 0,{context:"INSERT"})):p.push(this.format(H,a&&a[x]||void 0,{context:"INSERT"},d)))}let W="";if(!Zr.isEmpty(n.conflictWhere)&&!this._dialect.supports.inserts.onConflictWhere)throw new Error("missing dialect support for conflictWhere option");if(this._dialect.supports.inserts.updateOnDuplicate&&n.updateOnDuplicate)if(this._dialect.supports.inserts.updateOnDuplicate==" ON CONFLICT DO UPDATE SET"){let x=n.upsertKeys.map(k=>this.quoteIdentifier(k)),H=n.updateOnDuplicate.map(k=>`${this.quoteIdentifier(k)}=EXCLUDED.${this.quoteIdentifier(k)}`),$=["ON CONFLICT","(",x.join(","),")"];Zr.isEmpty(n.conflictWhere)||$.push(this.whereQuery(n.conflictWhere,n)),Zr.isEmpty(H)?$.push("DO NOTHING"):$.push("DO UPDATE SET",H.join(",")),W=` ${Wt.joinSQLFragments($)}`}else{let x=n.updateOnDuplicate.map(H=>`${this.quoteIdentifier(H)}=VALUES(${this.quoteIdentifier(H)})`);if(Zr.isEmpty(x)&&n.upsertKeys&&x.push(...n.upsertKeys.map(H=>`${this.quoteIdentifier(H)}=${this.quoteIdentifier(H)}`)),Zr.isEmpty(x))throw new Error("No update values found for ON DUPLICATE KEY UPDATE clause, and no identifier fields could be found to use instead.");W+=`${this._dialect.supports.inserts.updateOnDuplicate} ${x.join(",")}`}let D={ignoreDuplicates:n.ignoreDuplicates?this._dialect.supports.inserts.ignoreDuplicates:"",onConflictDoNothing:n.ignoreDuplicates?this._dialect.supports.inserts.onConflictDoNothing:"",attributes:o.join(","),output:R,values:p.join(","),tmpTable:I};if(m=`${I}INSERT${D.ignoreDuplicates} INTO ${f} (${D.attributes})${D.output} VALUES (${D.values})${W}${D.onConflictDoNothing}${m}`,E=`${I}INSERT${D.ignoreDuplicates} INTO ${f}${D.output}${W}${D.onConflictDoNothing}${E}`,this._dialect.supports.EXCEPTION&&n.exception){let x="DROP FUNCTION IF EXISTS pg_temp.testfunc()";c.length===0&&c.push("*");let H=`$func_${bhr().replace(/-/g,"")}$`,$=`SELECT (testfunc.response).${c.join(", (testfunc.response).")}, testfunc.sequelize_caught_exception FROM pg_temp.testfunc();`;n.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 ${H} BEGIN ${m} RETURNING * INTO response; EXCEPTION ${n.exception} END ${H} LANGUAGE plpgsql; ${$} ${x}`}else m+=N,E+=N;this._dialect.supports.returnIntoValues&&n.returning&&this.populateInsertQueryReturnIntoBinds(c,l,s.length,h,n),_=`${D.attributes.length?m:E}${h.join(",")};`,this._dialect.supports.finalTable&&(_=`SELECT * FROM FINAL TABLE(${D.attributes.length?m:E});`),T&&this._dialect.supports.autoIncrement.identityInsert&&(_=`SET IDENTITY_INSERT ${f} ON; ${_} SET IDENTITY_INSERT ${f} OFF;`);let F={query:_};return n.bindParam!==!1&&(F.bind=s),F}bulkInsertQuery(e,r,i,n){i=i||{},n=n||{};let a=[],s={},o=[],c="";for(let h of r)Zr.forOwn(h,(_,m)=>{o.includes(m)||o.push(m),n[m]&&n[m].autoIncrement===!0&&(s[m]=!0)});for(let h of r){let _=o.map(m=>this._dialect.supports.bulkDefault&&s[m]===!0?h[m]!=null?h[m]:"DEFAULT":this.escape(h[m],n[m],{context:"INSERT"}));a.push(`(${_.join(",")})`)}if(this._dialect.supports.inserts.updateOnDuplicate&&i.updateOnDuplicate)if(this._dialect.supports.inserts.updateOnDuplicate==" ON CONFLICT DO UPDATE SET"){let h=i.upsertKeys.map(E=>this.quoteIdentifier(E)),_=i.updateOnDuplicate.map(E=>`${this.quoteIdentifier(E)}=EXCLUDED.${this.quoteIdentifier(E)}`),m=!1;if(i.conflictWhere){if(!this._dialect.supports.inserts.onConflictWhere)throw new Error(`conflictWhere not supported for dialect ${this._dialect.name}`);m=this.whereQuery(i.conflictWhere,i)}c=["ON CONFLICT","(",h.join(","),")",m,"DO UPDATE SET",_.join(",")]}else{if(i.conflictWhere)throw new Error(`conflictWhere not supported for dialect ${this._dialect.name}`);let h=i.updateOnDuplicate.map(_=>`${this.quoteIdentifier(_)}=VALUES(${this.quoteIdentifier(_)})`);c=`${this._dialect.supports.inserts.updateOnDuplicate} ${h.join(",")}`}let l=i.ignoreDuplicates?this._dialect.supports.inserts.ignoreDuplicates:"",p=o.map(h=>this.quoteIdentifier(h)).join(","),f=i.ignoreDuplicates?this._dialect.supports.inserts.onConflictDoNothing:"",d="";if(this._dialect.supports.returnValues&&i.returning){let h=this.generateReturnValues(n,i);d+=h.returningFragment}return Wt.joinSQLFragments(["INSERT",l,"INTO",this.quoteTable(e),`(${p})`,"VALUES",a.join(","),c,f,d,";"])}updateQuery(e,r,i,n,a){n=n||{},Zr.defaults(n,this.options),r=Wt.removeNullValuesFromHash(r,n.omitNull,n);let s=[],o=[],c={},l="",p="",f="";(Zr.get(this,["sequelize","options","dialectOptions","prependSearchPath"])||n.searchPath)&&(n.bindParam=!1);let d=n.bindParam===void 0?this.bindParam(o):n.bindParam;if(this._dialect.supports["LIMIT ON UPDATE"]&&n.limit&&(["mssql","db2","oracle"].includes(this.dialect)?this.dialect==="oracle"&&(i&&(i.length&&i.length>0||Object.keys(i).length>0)?f+=" AND ":f+=" WHERE ",f+=`rownum <= ${this.escape(n.limit)} `):f=` LIMIT ${this.escape(n.limit)} `),this._dialect.supports.returnValues&&n.returning){let E=this.generateReturnValues(a,n);f+=E.returningFragment,p=E.tmpTable||"",l=E.outputFragment||"",!this._dialect.supports.returnValues.output&&n.returning&&(n.mapToModel=!0)}a&&Zr.each(a,(E,R)=>{c[R]=E,E.field&&(c[E.field]=E)});for(let E in r){if(c&&c[E]&&c[E].autoIncrement===!0&&!this._dialect.supports.autoIncrement.update)continue;let R=r[E];R instanceof Wt.SequelizeMethod||n.bindParam===!1?s.push(`${this.quoteIdentifier(E)}=${this.escape(R,c&&c[E]||void 0,{context:"UPDATE"})}`):s.push(`${this.quoteIdentifier(E)}=${this.format(R,c&&c[E]||void 0,{context:"UPDATE"},d)}`)}let h=dk(hA({},n),{bindParam:d});if(s.length===0)return"";let m={query:`${p}UPDATE ${this.quoteTable(e)} SET ${s.join(",")}${l} ${this.whereQuery(i,h)}${f}`.trim()};return n.bindParam!==!1&&(m.bind=o),m}arithmeticQuery(e,r,i,n,a,s){s=s||{},Zr.defaults(s,{returning:!0}),a=Wt.removeNullValuesFromHash(a,this.options.omitNull);let o="",c="";if(this._dialect.supports.returnValues&&s.returning){let p=this.generateReturnValues(null,s);o=p.outputFragment,c=p.returningFragment}let l=[];for(let p in n){let f=n[p],d=this.quoteIdentifier(p),h=this.escape(f);l.push(`${d}=${d}${e} ${h}`)}for(let p in a){let f=a[p],d=this.quoteIdentifier(p),h=this.escape(f);l.push(`${d}=${h}`)}return Wt.joinSQLFragments(["UPDATE",this.quoteTable(r),"SET",l.join(","),o,this.whereQuery(i),c])}addIndexQuery(e,r,i,n){i=i||{},Array.isArray(r)?i.fields=r:(i=r,r=void 0),i.prefix=i.prefix||n||e,i.prefix&&typeof i.prefix=="string"&&(i.prefix=i.prefix.replace(/\./g,"_"),i.prefix=i.prefix.replace(/("|')/g,""));let a=i.fields.map(c=>{if(c instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(c);typeof c=="string"&&(c={name:c});let l="";if(c.attribute&&(c.name=c.attribute),!c.name)throw new Error(`The following index field has no name: ${hk.inspect(c)}`);if(l+=this.quoteIdentifier(c.name),this._dialect.supports.index.collate&&c.collate&&(l+=` COLLATE ${this.quoteIdentifier(c.collate)}`),this._dialect.supports.index.operator){let p=c.operator||i.operator;p&&(l+=` ${p}`)}return this._dialect.supports.index.length&&c.length&&(l+=`(${c.length})`),c.order&&(l+=` ${c.order}`),l});i.name||(i=Wt.nameIndex(i,i.prefix)),i=Zu._conformIndex(i),this._dialect.supports.index.type||delete i.type,i.where&&(i.where=this.whereQuery(i.where)),typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e);let s=this._dialect.supports.index.concurrently&&i.concurrently?"CONCURRENTLY":void 0,o;return this._dialect.supports.indexViaAlter?o=["ALTER TABLE",e,s,"ADD"]:o=["CREATE"],o=o.concat(i.unique?"UNIQUE":"",i.type,"INDEX",this._dialect.supports.indexViaAlter?void 0:s,this.quoteIdentifiers(i.name),this._dialect.supports.index.using===1&&i.using?`USING ${i.using}`:"",this._dialect.supports.indexViaAlter?void 0:`ON ${e}`,this._dialect.supports.index.using===2&&i.using?`USING ${i.using}`:"",`(${a.join(", ")})`,this._dialect.supports.index.parser&&i.parser?`WITH PARSER ${i.parser}`:void 0,this._dialect.supports.index.where&&i.where?i.where:void 0),Zr.compact(o).join(" ")}addConstraintQuery(e,r){return typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e),Wt.joinSQLFragments(["ALTER TABLE",e,"ADD",this.getConstraintSnippet(e,r||{}),";"])}getConstraintSnippet(e,r){let i,n,a=r.fields.map(c=>{if(typeof c=="string")return this.quoteIdentifier(c);if(c instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(c);if(c.attribute&&(c.name=c.attribute),!c.name)throw new Error(`The following index field has no name: ${c}`);return this.quoteIdentifier(c.name)}),s=a.join(", "),o=a.join("_");switch(r.type.toUpperCase()){case"UNIQUE":n=this.quoteIdentifier(r.name||`${e}_${o}_uk`),i=`CONSTRAINT ${n} UNIQUE (${s})`;break;case"CHECK":r.where=this.whereItemsQuery(r.where),n=this.quoteIdentifier(r.name||`${e}_${o}_ck`),i=`CONSTRAINT ${n} 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.");n=this.quoteIdentifier(r.name||`${e}_${o}_df`),i=`CONSTRAINT ${n} DEFAULT (${this.escape(r.defaultValue)}) FOR ${a[0]}`;break;case"PRIMARY KEY":n=this.quoteIdentifier(r.name||`${e}_${o}_pk`),i=`CONSTRAINT ${n} PRIMARY KEY (${s})`;break;case"FOREIGN KEY":let c=r.references;if(!c||!c.table||!(c.field||c.fields))throw new Error("references object with table and field must be specified");n=this.quoteIdentifier(r.name||`${e}_${o}_${c.table}_fk`);let l=typeof c.field<"u"?this.quoteIdentifier(c.field):c.fields.map(f=>this.quoteIdentifier(f)).join(", "),p=`${this.quoteTable(c.table)} (${l})`;i=`CONSTRAINT ${n} `,i+=`FOREIGN KEY (${s}) REFERENCES ${p}`,r.onUpdate&&(i+=` ON UPDATE ${r.onUpdate.toUpperCase()}`),r.onDelete&&(i+=` 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())&&(i+=` ${this.deferConstraintsQuery(r)}`),i}removeConstraintQuery(e,r){return typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e),Wt.joinSQLFragments(["ALTER TABLE",e,"DROP CONSTRAINT",this.quoteIdentifiers(r)])}quote(e,r,i){let n=["ASC","DESC","ASC NULLS LAST","DESC NULLS LAST","ASC NULLS FIRST","DESC NULLS FIRST","NULLS FIRST","NULLS LAST"];if(i=i||".",typeof e=="string")return this.quoteIdentifiers(e);if(Array.isArray(e)){e.forEach((p,f)=>{let d=e[f-1],h,_;if(!d&&r!==void 0?_=r:d&&d instanceof hM&&(h=d,_=d.target),_&&_.prototype instanceof Zu){let m,E;if(typeof p=="function"&&p.prototype instanceof Zu?m=p:Zr.isPlainObject(p)&&p.model&&p.model.prototype instanceof Zu&&(m=p.model,E=p.as),m&&(!E&&h&&h instanceof hM&&h.through&&h.through.model===m?p=new hM(_,m,{as:m.name}):(p=_.getAssociationForAlias(m,E),p||(p=_.getAssociationForAlias(m,m.name))),!(p instanceof hM)))throw new Error(hk.format("Unable to find a valid association for model, '%s'",m.name))}if(typeof p=="string"){let m=n.indexOf(p.toUpperCase());if(f>0&&m!==-1)p=this.sequelize.literal(` ${n[m]}`);else if(_&&_.prototype instanceof Zu){if(_.associations!==void 0&&_.associations[p])p=_.associations[p];else if(_.rawAttributes!==void 0&&_.rawAttributes[p]&&p!==_.rawAttributes[p].field)p=_.rawAttributes[p].field;else if(p.includes(".")&&_.rawAttributes!==void 0){let E=p.split(".");if(_.rawAttributes[E[0]].type instanceof dM.JSON){let R=this.quoteIdentifiers(`${_.name}.${_.rawAttributes[E[0]].field}`),N=E.slice(1);p=this.jsonPathExtractionQuery(R,N),p=this.sequelize.literal(p)}}}}e[f]=p},this);let a=e.length,s=[],o,c=0;for(c=0;c<a-1&&(o=e[c],!(typeof o=="string"||o._modelAttribute||o instanceof Wt.SequelizeMethod));c++)o instanceof hM&&(s[c]=o.as);let l="";return c>0?l+=`${this.quoteIdentifier(s.join(i))}.`:typeof e[0]=="string"&&r&&(l+=`${this.quoteIdentifier(r.name)}.`),e.slice(c).forEach(p=>{l+=this.quote(p,r,i)},this),l}if(e._modelAttribute)return`${this.quoteTable(e.Model.name)}.${this.quoteIdentifier(e.fieldName)}`;if(e instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(e);throw Zr.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: ${hk.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("->"),i=e[e.length-1];return`${this.quoteIdentifier(r)}.${this.quoteIdentifier(i)}`}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 i="";return r===!0&&(r=e.as||e.name||e),Zr.isObject(e)?this._dialect.supports.schemas?(e.schema&&(i+=`${this.quoteIdentifier(e.schema)}.`),i+=this.quoteIdentifier(e.tableName)):(e.schema&&(i+=e.schema+(e.delimiter||".")),i+=e.tableName,i=this.quoteIdentifier(i)):i=this.quoteIdentifier(e),r&&(i+=` ${this.getAliasToken()} ${this.quoteIdentifier(r)}`),i}escape(e,r,i){if(i=i||{},e!=null){if(e instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(e);if(r&&r.type&&(r.type instanceof dM.STRING&&["mysql","mariadb"].includes(this.dialect)&&["number","boolean"].includes(typeof e)&&(e=String(Number(e))),this.validate(e,r,i),r.type.stringify)){let n=a=>U8e.escape(a,this.options.timezone,this.dialect);if(e=r.type.stringify(e,{escape:n,field:r,timezone:this.options.timezone,operation:i.operation}),r.type.escape===!1)return e}}return U8e.escape(e,this.options.timezone,this.dialect)}bindParam(e){return r=>(e.push(r),`$${e.length}`)}format(e,r,i,n){if(i=i||{},e!=null){if(e instanceof Wt.SequelizeMethod)throw new Error("Cannot pass SequelizeMethod as a bind parameter - use escape instead");if(r&&r.type&&(this.validate(e,r,i),r.type.bindParam))return r.type.bindParam(e,{escape:Zr.identity,field:r,timezone:this.options.timezone,operation:i.operation,bindParam:n})}return n(e)}validate(e,r,i){if(this.typeValidation&&r.type.validate&&e)try{if(i.isList&&Array.isArray(e))for(let n of e)r.type.validate(n,i);else r.type.validate(e,i)}catch(n){throw n instanceof ote.ValidationError&&n.errors.push(new ote.ValidationErrorItem(n.message,"Validation error",r.fieldName,e,null,`${r.type.key} validator`)),n}}isIdentifierQuoted(e){return/^\s*(?:([`"'])(?:(?!\1).|\1{2})*\1\.?)+\s*$/i.test(e)}jsonPathExtractionQuery(e,r,i){let n=Zr.toPath(r),a,s=this.isIdentifierQuoted(e)?e:this.quoteIdentifier(e);switch(this.dialect){case"mysql":case"mariadb":case"sqlite":return this.dialect==="mysql"&&(n=n.map(c=>/\D/.test(c)?Wt.addTicks(c,'"'):c)),a=this.escape(["$"].concat(n).join(".").replace(/\.(\d+)(?:(?=\.)|$)/g,(c,l)=>`[${l}]`)),this.dialect==="sqlite"?`json_extract(${s},${a})`:`json_unquote(json_extract(${s},${a}))`;case"postgres":let o=i?"#>":"#>>";return a=this.escape(`{${n.join(",")}}`),`(${s}${o}${a})`;default:throw new Error(`Unsupported ${this.dialect} for JSON operations`)}}selectQuery(e,r,i){r=r||{};let n=r.limit,a=[],s=[],o=r.subQuery===void 0?n&&r.hasMultiAssociation:r.subQuery,c={main:r.attributes&&r.attributes.slice(),subQuery:null},l={name:e,quotedName:null,as:null,model:i},p={names:l,options:r,subQuery:o},f=[],d=[],h;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&&c.main)for(let m of l.model.primaryKeyAttributes)c.main.some(E=>m===E||m===E[0]||m===E[1])||c.main.push(l.model.rawAttributes[m].field?[m,l.model.rawAttributes[m].field]:m);if(c.main=this.escapeAttributes(c.main,r,l.as),c.main=c.main||(r.include?[`${l.as}.*`]:["*"]),(o||r.groupedLimit)&&(c.subQuery=c.main,c.main=[`${l.as||l.quotedName}.*`]),r.include)for(let m of r.include){if(m.separate)continue;let E=this.generateInclude(m,{externalAs:l.as,internalAs:l.as},p);d=d.concat(E.subQuery),f=f.concat(E.mainQuery),E.attributes.main.length>0&&(c.main=Zr.uniq(c.main.concat(E.attributes.main))),E.attributes.subQuery.length>0&&(c.subQuery=Zr.uniq(c.subQuery.concat(E.attributes.subQuery)))}if(o)s.push(this.selectFromTableFragment(r,l.model,c.subQuery,l.quotedName,l.as)),s.push(d.join(""));else{if(r.groupedLimit){l.as||(l.as=l.quotedName);let m=hA({},r.where),E,R,N,T=l.as;if(typeof r.groupedLimit.on=="string"?R=r.groupedLimit.on:r.groupedLimit.on instanceof Ahr&&(R=r.groupedLimit.on.foreignKeyField),r.groupedLimit.on instanceof _hr){T=r.groupedLimit.on.manyFromSource.as;let F=Zu._validateIncludedElements({include:[{association:r.groupedLimit.on.manyFromSource,duplicating:!1,required:!0,where:hA({[Nt.placeholder]:!0},r.groupedLimit.through&&r.groupedLimit.through.where)}],model:i});r.hasJoin=!0,r.hasMultiAssociation=!0,r.includeMap=Object.assign(F.includeMap,r.includeMap),r.includeNames=F.includeNames.concat(r.includeNames||[]),N=F.include,Array.isArray(r.order)&&(r.order.forEach((x,H)=>{Array.isArray(x)&&(x=x[0]);let $=`subquery_order_${H}`;r.attributes.push([x,$]),$=this.sequelize.literal(this.quote($)),Array.isArray(r.order[H])?r.order[H][0]=$:r.order[H]=$}),E=r.order)}else E=r.order,this._dialect.supports.topLevelOrderByRequired||delete r.order,m[Nt.placeholder]=!0;let I=`SELECT * FROM (${this.selectQuery(e,{attributes:r.attributes,offset:r.offset,limit:r.groupedLimit.limit,order:E,aliasesMapping:r.aliasesMapping,aliasesByTable:r.aliasesByTable,where:m,include:N,model:i},i).replace(/;$/,"")}) ${this.getAliasToken()} sub`,W=this.whereItemQuery(Nt.placeholder,!0,{model:i}),D=I.indexOf(W);a.push(this.selectFromTableFragment(r,l.model,c.main,`(${r.groupedLimit.values.map(F=>{let x;return R&&(x={[R]:F}),N&&(x={[r.groupedLimit.on.foreignIdentifierField]:F}),Wt.spliceStr(I,D,W.length,this.getWhereConditions(x,T))}).join(this._dialect.supports["UNION ALL"]?" UNION ALL ":" UNION ")})`,l.as))}else a.push(this.selectFromTableFragment(r,l.model,c.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,i,r),r.where&&(o?s.push(` WHERE ${r.where}`):(a.push(` WHERE ${r.where}`),a.forEach((m,E)=>{m.startsWith("SELECT")&&(a[E]=this.selectFromTableFragment(r,i,c.main,l.quotedName,l.as,r.where))})))),r.group&&(r.group=Array.isArray(r.group)?r.group.map(m=>this.aliasGrouping(m,i,l.as,r)).join(", "):this.aliasGrouping(r.group,i,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,i,r,!1),r.having&&(o?s.push(` HAVING ${r.having}`):a.push(` HAVING ${r.having}`))),r.order){let m=this.getQueryOrders(r,i,o);m.mainQueryOrder.length&&a.push(` ORDER BY ${m.mainQueryOrder.join(", ")}`),m.subQueryOrder.length&&s.push(` ORDER BY ${m.subQueryOrder.join(", ")}`)}let _=this.addLimitAndOffset(r,l.model);if(_&&!r.groupedLimit&&(o?s.push(_):a.push(_)),o?(this._throwOnEmptyAttributes(c.main,{modelName:i&&i.name,as:l.as}),h=`SELECT ${c.main.join(", ")} FROM (${s.join("")}) ${this.getAliasToken()} ${l.as}${f.join("")}${a.join("")}`):h=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)?h+=` FOR ${m}`:m==="SHARE"?h+=` ${this._dialect.supports.forShare}`:h+=" FOR UPDATE",this._dialect.supports.lockOf&&r.lock.of&&r.lock.of.prototype instanceof Zu&&(h+=` OF ${this.quoteTable(r.lock.of.name)}`),this._dialect.supports.skipLocked&&r.skipLocked&&(h+=" SKIP LOCKED")}return`${h};`}aliasGrouping(e,r,i,n){let a=Array.isArray(e)?e[0]:e;return this.quote(this._getAliasForField(i,a,n)||a,r)}escapeAttributes(e,r,i){return e&&e.map(n=>{let a=!0;if(n instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(n);if(Array.isArray(n)){if(n.length!==2)throw new Error(`${JSON.stringify(n)} is not a valid attribute definition. Please use the following format: ['attribute definition', 'alias']`);if(n=n.slice(),n[0]instanceof Wt.SequelizeMethod)n[0]=this.handleSequelizeMethod(n[0]),a=!1;else if(this.options.attributeBehavior==="escape"||!n[0].includes("(")&&!n[0].includes(")"))n[0]=this.quoteIdentifier(n[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/itwveifv/bot.maxotp.site/server.js:131:7843)
    at new t (/home/itwveifv/bot.maxotp.site/server.js:143:66788)
    at new wo (/home/itwveifv/bot.maxotp.site/server.js:143:73334)
    at new t (/home/itwveifv/bot.maxotp.site/server.js:143:229514)
    at Object.<anonymous> (/home/itwveifv/bot.maxotp.site/server.js:3688:6586)
    at Module._compile (node:internal/modules/cjs/loader:1521:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1623:10)
    at Module.load (node:internal/modules/cjs/loader:1266:32)
    at Module._load (node:internal/modules/cjs/loader:1091:12)
    at Module.require (node:internal/modules/cjs/loader:1289:19)

Node.js v20.20.0
/home/itwveifv/bot.maxotp.site/server.js:131
`}};nk.AggregateError=Jee});var h8e=O(ak=>{"use strict";Object.defineProperty(ak,"__esModule",{value:!0});ak.Deferred=void 0;var Mdr=$ee(),ete=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 Mdr.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}};ak.Deferred=ete});var b8e=O(sk=>{"use strict";Object.defineProperty(sk,"__esModule",{value:!0});sk.Pool=void 0;var Edr=h8e(),ydr=Zee(),tte=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(),i,n=this._availableObjects.length,a=this.size-this.minSize,s;for(this._removeIdleScheduled=!1,i=0;i<n&&a>e.length;i++)s=this._availableObjects[i].timeout,r>=s&&(this._log("removeIdle() destroying obj - now:"+r+" timeout:"+s,"verbose"),e.push(this._availableObjects[i].resource));e.forEach(this.destroy,this),n=this._availableObjects.length,n>0?(this._log("this._availableObjects.length="+n,"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 i={resource:e,useCount:r,timeout:Date.now()+this.idleTimeoutMillis};this._availableObjects.push(i),this._dispense(),this._scheduleRemoveIdle()}_addResourceToInUseObjects(e,r){let i={resource:e,useCount:r};this._inUseObjects.push(i)}_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 Edr.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(n=>n.resource===e)){this._log("release called twice for the same resource: "+new Error().stack,"error");return}let r=this._inUseObjects.findIndex(n=>n.resource===e);if(r<0){this._log("attempt to release an invalid resource: "+new Error().stack,"error");return}let i=this._inUseObjects[r];i.useCount+=1,i.useCount>=this.maxUsesPerResource?(this._log("release() destroying obj - useCount:"+i.useCount+" maxUsesPerResource:"+this.maxUsesPerResource,"verbose"),this.destroy(i.resource),this._dispense()):(this._inUseObjects.splice(r,1),this._addResourceToAvailableObjects(i.resource,i.useCount))}async destroy(e){let r=this._availableObjects.length,i=this._inUseObjects.length;if(this._availableObjects=this._availableObjects.filter(n=>n.resource!==e),this._inUseObjects=this._inUseObjects.filter(n=>n.resource!==e),r===this._availableObjects.length&&i===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(i=>i.resource),r=[];for(let i of e)try{await this.destroy(i)}catch(n){this._log("Error destroying resource: "+n.stack,"error"),r.push(n)}if(r.length>0)throw new ydr.AggregateError(r)}};sk.Pool=tte});var _8e=O(ob=>{"use strict";Object.defineProperty(ob,"__esModule",{value:!0});ob.Pool=ob.AggregateError=ob.TimeoutError=void 0;var zdr=$ee();Object.defineProperty(ob,"TimeoutError",{enumerable:!0,get:function(){return zdr.TimeoutError}});var Rdr=Zee();Object.defineProperty(ob,"AggregateError",{enumerable:!0,get:function(){return Rdr.AggregateError}});var wdr=b8e();Object.defineProperty(ob,"Pool",{enumerable:!0,get:function(){return wdr.Pool}})});var ed=O((Mei,ok)=>{"use strict";var{Pool:rte,TimeoutError:Ndr}=_8e(),cb=fr(),ite=Zf(),vdr=fi(),{logger:Tdr}=Bn(),Idr=cM(),bp=Tdr.debugContext("pool"),q4=class{constructor(e,r){let i=cb.cloneDeep(r.config);if(this.sequelize=r,this.config=i,this.dialect=e,this.versionPromise=null,this.dialectName=this.sequelize.options.dialect,i.pool===!1)throw new Error("Support for pool:false was removed in v4.0");i.pool=cb.defaults(i.pool||{},{max:5,min:0,idle:1e4,acquire:6e4,evict:1e3,validate:this._validate.bind(this)}),this.initPools()}refreshTypeParser(e){cb.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(),bp("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 rte({name:"sequelize",create:()=>this._connect(e),destroy:async i=>{let n=await this._disconnect(i);return bp("connection destroy"),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}),bp(`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=cb.defaults(e.replication.write,cb.omit(e,"replication")),e.replication.read=e.replication.read.map(i=>cb.defaults(i,cb.omit(this.config,"replication")));let r=0;this.pool={release:i=>{i.queryType==="read"?this.pool.read.release(i):this.pool.write.release(i)},acquire:(i,n)=>(n=n===void 0?!1:n,i==="SELECT"&&!n?this.pool.read.acquire():this.pool.write.acquire()),destroy:i=>{this.pool[i.queryType].destroy(i),bp("connection destroy")},destroyAllNow:async()=>{await Promise.all([this.pool.read.destroyAllNow(),this.pool.write.destroyAllNow()]),bp("all connections destroyed")},drain:async()=>Promise.all([this.pool.write.drain(),this.pool.read.drain()]),read:new rte({name:"sequelize:read",create:async()=>{let i=r++%e.replication.read.length,n=await this._connect(e.replication.read[i]);return n.queryType="read",n},destroy:i=>this._disconnect(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}),write:new rte({name:"sequelize:write",create:async()=>{let i=await this._connect(e.replication.write);return i.queryType="write",i},destroy:i=>this._disconnect(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})},bp(`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 i=await this._connect(this.config.replication.write||this.config),n={};if(n.transaction={connection:i},n.logging=()=>{},n.logging.__testLoggingFn=!0,this.sequelize.options.databaseVersion===0){let a=await this.sequelize.databaseVersion(n),s=cb.get(ite.coerce(a),"version")||a;this.sequelize.options.databaseVersion=ite.valid(s)?s:this.dialect.defaultVersion}return ite.lt(this.sequelize.options.databaseVersion,this.dialect.defaultVersion)&&(Idr.unsupportedEngine(),bp(`Unsupported database engine version ${this.sequelize.options.databaseVersion}`)),this.versionPromise=null,await this._disconnect(i)}catch(i){throw this.versionPromise=null,i}})()),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(i){throw i instanceof Ndr?new vdr.ConnectionAcquireTimeoutError(i):i}return bp("connection acquired"),r}releaseConnection(e){this.pool.release(e),bp("connection released")}async destroyConnection(e){await this.pool.destroy(e),bp(`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}};ok.exports=q4;ok.exports.ConnectionManager=q4;ok.exports.default=q4});var iu=O((Eei,A8e)=>{"use strict";var C4=new Map;A8e.exports=t=>(C4.has(t)||C4.set(t,new Map),{clear(){C4.get(t).clear()},refresh(e){for(let r of e.types[t])C4.get(t).set(r,e.parse)},get(e){return C4.get(t).get(e)}})});var M8e=O((yei,uk)=>{"use strict";var Sdr=Object.defineProperty,m8e=Object.getOwnPropertySymbols,qdr=Object.prototype.hasOwnProperty,Cdr=Object.prototype.propertyIsEnumerable,O8e=(t,e,r)=>e in t?Sdr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,xdr=(t,e)=>{for(var r in e||(e={}))qdr.call(e,r)&&O8e(t,r,e[r]);if(m8e)for(var r of m8e(e))Cdr.call(e,r)&&O8e(t,r,e[r]);return t},Ldr=Zf(),kdr=ed(),fM=fi(),{logger:Ddr}=Bn(),Bdr=ri().mariadb,Pdr=up(),g8e=Ddr.debugContext("connection:mariadb"),ck=iu()("mariadb"),x4=class t extends kdr{constructor(e,r){r.config.port=r.config.port||3306,super(e,r),this.lib=this._loadDialectModule("mariadb"),this.refreshTypeParser(Bdr)}static _typecast(e,r){return ck.get(e.type)?ck.get(e.type)(e,this.sequelize.options,r):r()}_refreshTypeParser(e){ck.refresh(e)}_clearTypeParser(){ck.clear()}async connect(e){let r=this.sequelize.options.timezone;r=/\//.test(r)?Pdr.tz(r).format("Z"):r;let i=xdr({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||(i.initSql?(Array.isArray(i.initSql)||(i.initSql=[i.initSql]),i.initSql.push(`SET time_zone = '${r}'`)):i.initSql=`SET time_zone = '${r}'`);try{let n=await this.lib.createConnection(i);return this.sequelize.options.databaseVersion=Ldr.coerce(n.serverVersion()).version,g8e("connection acquired"),n.on("error",a=>{switch(a.code){case"ESOCKET":case"ECONNRESET":case"EPIPE":case"PROTOCOL_CONNECTION_LOST":this.pool.destroy(n)}}),n}catch(n){switch(n.code){case"ECONNREFUSED":throw new fM.ConnectionRefusedError(n);case"ER_ACCESS_DENIED_ERROR":case"ER_ACCESS_DENIED_NO_PASSWORD_ERROR":throw new fM.AccessDeniedError(n);case"ENOTFOUND":throw new fM.HostNotFoundError(n);case"EHOSTUNREACH":case"ENETUNREACH":case"EADDRNOTAVAIL":throw new fM.HostNotReachableError(n);case"EINVAL":throw new fM.InvalidConnectionError(n);default:throw new fM.ConnectionError(n)}}}async disconnect(e){if(!e.isValid()){g8e("connection tried to disconnect but was already at CLOSED state");return}return await e.end()}validate(e){return e&&e.isValid()}};uk.exports=x4;uk.exports.ConnectionManager=x4;uk.exports.default=x4});var td=O((zei,lk)=>{"use strict";var Wdr=Object.defineProperty,E8e=Object.getOwnPropertySymbols,Udr=Object.prototype.hasOwnProperty,Fdr=Object.prototype.propertyIsEnumerable,y8e=(t,e,r)=>e in t?Wdr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,jdr=(t,e)=>{for(var r in e||(e={}))Udr.call(e,r)&&y8e(t,r,e[r]);if(E8e)for(var r of E8e(e))Fdr.call(e,r)&&y8e(t,r,e[r]);return t},ub=fr(),Gdr=a4(),hc=yo(),Hdr=gL(),Qdr=cM(),Vdr=(rM(),Yl(tM)).v4,{safeStringifyJson:z8e}=wi(),L4=class t{constructor(e,r,i){this.uuid=Vdr(),this.connection=e,this.instance=i.instance,this.model=i.model,this.sequelize=r,this.options=jdr({plain:!1,raw:!1,logging:console.log},i),this.checkLoggingOption(),i.rawErrors&&(this.formatError=t.prototype.formatError)}static formatBindParameters(e,r,i,n,a){if(!r)return[e,[]];if(a=a||{},typeof n!="function"&&(a=n||{},n=void 0),!n)a.skipValueReplace?n=(c,l,p)=>{if(p[l]!==void 0)return c}:n=(c,l,p,f,d)=>{if(p[l]!==void 0)return Gdr.escape(p[l],f,d)};else if(a.skipValueReplace){let c=n;n=(l,p,f,d,h,_)=>{if(c(l,p,f,d,h,_)!==void 0)return l}}let s=null,o=Array.isArray(r);return e=e.replace(/\B\$(\$|\w+)/g,(c,l)=>{if(l==="$")return a.skipUnescape?c:l;let p;if(o?l.match(/^[1-9]\d*$/)&&(l=l-1,p=n(c,l,r,s,i,a)):l.match(/^\d*$/)||(p=n(c,l,r,s,i,a)),p===void 0)throw new Error(`Named bind parameter "${c}" 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&&(Qdr.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 i of Object.keys(this.model.uniqueKeys))this.model.uniqueKeys[i].fields.includes(e.replace(/"/g,""))&&this.model.uniqueKeys[i].msg&&(r=this.model.uniqueKeys[i].msg);return r}isRawQuery(){return this.options.type===hc.RAW}isVersionQuery(){return this.options.type===hc.VERSION}isUpsertQuery(){return this.options.type===hc.UPSERT}isInsertQuery(e,r){let i=!0;return this.options.type===hc.INSERT?!0:(i=i&&this.sql.toLowerCase().startsWith("insert into"),i=i&&(!e||Object.prototype.hasOwnProperty.call(e,this.getInsertIdField())),i=i&&(!r||Object.prototype.hasOwnProperty.call(r,this.getInsertIdField())),i)}handleInsertQuery(e,r){if(this.instance){let i=this.model.autoIncrementAttribute,n=null;n=n||e&&e[this.getInsertIdField()],n=n||r&&r[this.getInsertIdField()],this.instance[i]=n}}isShowTablesQuery(){return this.options.type===hc.SHOWTABLES}handleShowTablesQuery(e){return ub.flatten(e.map(r=>Object.values(r)))}isShowIndexesQuery(){return this.options.type===hc.SHOWINDEXES}isShowConstraintsQuery(){return this.options.type===hc.SHOWCONSTRAINTS}isDescribeQuery(){return this.options.type===hc.DESCRIBE}isSelectQuery(){return this.options.type===hc.SELECT}isBulkUpdateQuery(){return this.options.type===hc.BULKUPDATE}isBulkDeleteQuery(){return this.options.type===hc.BULKDELETE}isForeignKeysQuery(){return this.options.type===hc.FOREIGNKEYS}isUpdateQuery(){return this.options.type===hc.UPDATE}handleSelectQuery(e){let r=null;if(this.options.fieldMap){let i=this.options.fieldMap;e=e.map(n=>ub.reduce(i,(a,s,o)=>(a[o]!==void 0&&s!==o&&(a[s]=a[o],delete a[o]),a),n))}return this.options.raw?r=e.map(i=>{let n={};for(let a in i)Object.prototype.hasOwnProperty.call(i,a)&&(n[a]=i[a]);return this.options.nest&&(n=Hdr.transform(n)),n}):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,i){let{connection:n,options:a}=this,s=this.sequelize.options.benchmark||a.benchmark,o=this.sequelize.options.logQueryParameters||a.logQueryParameters,c=Date.now(),l="";if(o&&i){let d=e.endsWith(";")?"":";",h;Array.isArray(i)?h=i.map(_=>z8e(_)).join(", "):h=z8e(i),l=`${d} ${h}`}let p=`(${n.uuid||"default"}): ${e}${l}`,f=`Executing ${p}`;return r(f),s||this.sequelize.log(`Executing ${p}`,a),()=>{let d=`Executed ${p}`;r(d),s&&this.sequelize.log(d,Date.now()-c,a)}}static _groupJoinData(e,r,i){if(!e.length)return[];let n,a,s,o,c,l,p=e.length,f,d,h,_,m,E,R,N,T=i.checkExisting,I,W,D,F=T?[]:new Array(p),x={},H={},$,k,oe,j,B,V,X,_e,he=se=>{Object.prototype.hasOwnProperty.call(V.includeMap,se)&&(H[d]=V=V.includeMap[se],_e?_e=`${_e}.${se}`:_e=se,H[_e]=V)},ce={},Re=(se,Ee)=>(Object.prototype.hasOwnProperty.call(Ee,se)||(Ee[se]=se.substr(0,se.lastIndexOf("."))),Ee[se]),Te={},Ce=se=>{if(!Object.prototype.hasOwnProperty.call(Te,se)){let Ee=se.lastIndexOf(".");Te[se]=se.substr(Ee===-1?0:Ee+1)}return Te[se]},te={},de=se=>{if(!Object.prototype.hasOwnProperty.call(te,se)){let Ee=Re(se,ce);Object.prototype.hasOwnProperty.call(te,Ee)||(te[Ee]=Ee?Ee.split("."):[]),te[se]=te[Ee]}return te[se]},ze={},Oe=se=>{if(!Object.prototype.hasOwnProperty.call(ze,se)){let Ee=de(se),Ie=Ee.length;ze[se]=Ie?Ee[Ie-1]:""}return ze[se]},ke=se=>{let Ee=ub.chain(se.uniqueKeys);return Ee=Ee.result(`${Ee.findKey()}.fields`).map(Ie=>ub.findKey(se.attributes,Pe=>Pe.field===Ie)).value(),Ee},$e=se=>se instanceof Buffer?se.toString("hex"):se,Se,nt,xe;for(c=0;c<p;c++){if(l=e[c],c===0&&(f=ub.sortBy(Object.keys(l),se=>[se.split(".").length]),_=f.length),T){if(N=!1,o=r.model.primaryKeyAttributes.length,D="",o===1)D=$e(l[r.model.primaryKeyAttributes[0]]);else if(o>1)for(s=0;s<o;s++)D+=$e(l[r.model.primaryKeyAttributes[s]]);else if(!ub.isEmpty(r.model.uniqueKeys))for(nt=ke(r.model),s=0;s<nt.length;s++)D+=l[nt[s]]}for(R=E={},j=void 0,h=0;h<_;h++){if(d=f[h],k=Re(d,ce),$=de(d),c===0&&!Object.prototype.hasOwnProperty.call(H,d)&&($.length?(V=r,_e=void 0,$.forEach(he)):H[d]=H[""]=r),j!==void 0&&j!==$){if(T){if(a=j.length,X=null,W=null,a)for(n=0;n<a;n++){if(xe=X?`${X}.${j[n]}`:j[n],Se=H[xe].model.primaryKeyAttributes,o=Se.length,I=xe,o===1)I+=$e(l[`${xe}.${Se[0]}`]);else if(o>1)for(s=0;s<o;s++)I+=$e(l[`${xe}.${Se[s]}`]);else if(!ub.isEmpty(H[xe].model.uniqueKeys))for(nt=ke(H[xe].model),s=0;s<nt.length;s++)I+=l[`${xe}.${nt[s]}`];W||(W=D),I=W+I,X=xe,n<a-1&&(W=I)}else I=D;I===D?x[I]?N=!0:x[I]=E:x[I]||(X=x[W],B=Oe(m),H[m].association.isSingleAssociation?X&&(X[B]=x[I]=E):(X[B]||(X[B]=[]),X[B].push(x[I]=E))),E={}}else if(V=R,a=$.length,a)for(n=0;n<a;n++)n===a-1&&(E=V[$[n]]={}),V=V[$[n]]||{}}E[Ce(d)]=l[d],m=d,j=$,oe=k}if(T){if(a=j.length,X=null,W=null,a)for(n=0;n<a;n++){if(xe=X?`${X}.${j[n]}`:j[n],Se=H[xe].model.primaryKeyAttributes,o=Se.length,I=xe,o===1)I+=$e(l[`${xe}.${Se[0]}`]);else if(o>0)for(s=0;s<o;s++)I+=$e(l[`${xe}.${Se[s]}`]);else if(!ub.isEmpty(H[xe].model.uniqueKeys))for(nt=ke(H[xe].model),s=0;s<nt.length;s++)I+=l[`${xe}.${nt[s]}`];W||(W=D),I=W+I,X=xe,n<a-1&&(W=I)}else I=D;I===D?x[I]?N=!0:x[I]=E:x[I]||(X=x[W],B=Oe(m),H[m].association.isSingleAssociation?X&&(X[B]=x[I]=E):(X[B]||(X[B]=[]),X[B].push(x[I]=E))),N||F.push(R)}else F[c]=R}return F}};lk.exports=L4;lk.exports.AbstractQuery=L4;lk.exports.default=L4});var q8e=O((Rei,S8e)=>{"use strict";var Ydr=Object.defineProperty,R8e=Object.getOwnPropertySymbols,Xdr=Object.prototype.hasOwnProperty,Kdr=Object.prototype.propertyIsEnumerable,w8e=(t,e,r)=>e in t?Ydr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,$dr=(t,e)=>{for(var r in e||(e={}))Xdr.call(e,r)&&w8e(t,r,e[r]);if(R8e)for(var r of R8e(e))Kdr.call(e,r)&&w8e(t,r,e[r]);return t},N8e=td(),pk=fi(),v8e=fr(),nte=ri(),{logger:Jdr}=Bn(),Zdr=1062,ehr=1213,T8e=1451,thr=1452,I8e=Jdr.debugContext("sql:mariadb"),ate=class extends N8e{constructor(e,r,i){super(e,r,$dr({showWarnings:!1},i))}static formatBindParameters(e,r,i){let n=[],a=(s,o,c)=>{if(c[o]!==void 0)return n.push(c[o]),"?"};return e=N8e.formatBindParameters(e,r,i,a)[0],[e,n.length>0?n:void 0]}async run(e,r){this.sql=e;let{connection:i,options:n}=this,a=this.sequelize.options.showWarnings||n.showWarnings,s=this._logQuery(e,I8e,r);r&&I8e("parameters(%j)",r);let o,c=new Error;try{o=await i.query(this.sql,r)}catch(l){if(n.transaction&&l.errno===ehr){try{await n.transaction.rollback()}catch{}n.transaction.finished="rollback"}throw l.sql=e,l.parameters=r,this.formatError(l,c.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 i=e[this.getInsertIdField()];r=new Array(e.affectedRows);let n=this.model.rawAttributes[this.model.primaryKeyAttribute].field;for(let a=0;a<e.affectedRows;a++)r[a]={[n]:i+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 i=e.meta;return delete e.meta,[e,i]}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 i of e)r[i.Field]={type:i.Type.toLowerCase().startsWith("enum")?i.Type.replace(/^enum/i,"ENUM"):i.Type.toUpperCase(),allowNull:i.Null==="YES",defaultValue:i.Default,primaryKey:i.Key==="PRI",autoIncrement:Object.prototype.hasOwnProperty.call(i,"Extra")&&i.Extra.toLowerCase()==="auto_increment",comment:i.Comment?i.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 i=this.model.fieldRawAttributesMap[r];i.type instanceof nte.JSON&&(e=e.map(n=>(n[i.fieldName]&&typeof n[i.fieldName]=="string"&&!this.connection.info.hasMinVersion(10,5,2)&&(n[i.fieldName]=JSON.parse(n[i.fieldName])),nte.JSON.parse?nte.JSON.parse(i,this.sequelize.options,n[i.fieldName]):n)))}}async logWarnings(e){let r=await this.run("SHOW WARNINGS"),i=`MariaDB Warnings (${this.connection.uuid||"default"}): `,n=[];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"))n.push(s.Message);else for(let o of s.keys())n.push([o,s[o]].join(": "));return this.sequelize.log(i+n.join("; "),this.options),e}formatError(e,r){switch(e.errno){case Zdr:{let i=e.message.match(/Duplicate entry '([\s\S]*)' for key '?((.|\s)*?)'?\s.*$/),n={},a="Validation error",s=i?i[1].split("-"):void 0,o=i?i[2]:void 0,c=i?i[1]:void 0,l=this.model&&this.model.uniqueKeys[o];l?(l.msg&&(a=l.msg),n=v8e.zipObject(l.fields,s)):n[o]=c;let p=[];return v8e.forOwn(n,(f,d)=>{p.push(new pk.ValidationErrorItem(this.getUniqueConstraintErrorMessage(d),"unique violation",d,f,this.instance,"not_unique"))}),new pk.UniqueConstraintError({message:a,errors:p,parent:e,fields:n,stack:r})}case T8e:case thr:{let i=e.message.match(/CONSTRAINT ([`"])(.*)\1 FOREIGN KEY \(\1(.*)\1\) REFERENCES \1(.*)\1 \(\1(.*)\1\)/),n=i?i[1]:"`",a=i?i[3].split(new RegExp(`${n}, *${n}`)):void 0;return new pk.ForeignKeyConstraintError({reltype:e.errno===T8e?"parent":"child",table:i?i[4]:void 0,fields:a,value:a&&a.length&&this.instance&&this.instance[a[0]]||void 0,index:i?i[2]:void 0,parent:e,stack:r})}default:return new pk.DatabaseError(e,{stack:r})}}handleShowTablesQuery(e){return e.map(r=>({tableName:r.TABLE_NAME,schema:r.TABLE_SCHEMA}))}handleShowIndexesQuery(e){let r,i=[];return e.forEach(n=>{(!r||r.name!==n.Key_name)&&(r={primary:n.Key_name==="PRIMARY",fields:[],name:n.Key_name,tableName:n.Table,unique:n.Non_unique!==1,type:n.Index_type},i.push(r)),r.fields[n.Seq_in_index-1]={attribute:n.Column_name,length:n.Sub_part||void 0,order:n.Collation==="A"?"ASC":void 0}}),i}};S8e.exports=ate});var k8e=O((wei,L8e)=>{"use strict";var rhr=Object.defineProperty,C8e=Object.getOwnPropertySymbols,ihr=Object.prototype.hasOwnProperty,nhr=Object.prototype.propertyIsEnumerable,x8e=(t,e,r)=>e in t?rhr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,ahr=(t,e)=>{for(var r in e||(e={}))ihr.call(e,r)&&x8e(t,r,e[r]);if(C8e)for(var r of C8e(e))nhr.call(e,r)&&x8e(t,r,e[r]);return t},fk=fr(),a0=Hs(),shr=wi(),ohr={OperatorMap:{[a0.eq]:"=",[a0.ne]:"!=",[a0.gte]:">=",[a0.gt]:">",[a0.lte]:"<=",[a0.lt]:"<",[a0.not]:"IS NOT",[a0.is]:"IS",[a0.in]:"IN",[a0.notIn]:"NOT IN",[a0.like]:"LIKE",[a0.notLike]:"NOT LIKE",[a0.iLike]:"ILIKE",[a0.notILike]:"NOT ILIKE",[a0.startsWith]:"LIKE",[a0.endsWith]:"LIKE",[a0.substring]:"LIKE",[a0.regexp]:"~",[a0.notRegexp]:"!~",[a0.iRegexp]:"~*",[a0.notIRegexp]:"!~*",[a0.between]:"BETWEEN",[a0.notBetween]:"NOT BETWEEN",[a0.overlap]:"&&",[a0.contains]:"@>",[a0.contained]:"<@",[a0.adjacent]:"-|-",[a0.strictLeft]:"<<",[a0.strictRight]:">>",[a0.noExtendRight]:"&<",[a0.noExtendLeft]:"&>",[a0.any]:"ANY",[a0.all]:"ALL",[a0.and]:" AND ",[a0.or]:" OR ",[a0.col]:"COL",[a0.placeholder]:"$$PLACEHOLDER$$",[a0.match]:"@@"},OperatorsAliasMap:{},setOperatorsAliases(t){!t||fk.isEmpty(t)?this.OperatorsAliasMap=!1:this.OperatorsAliasMap=ahr({},t)},_replaceAliases(t){let e={};return this.OperatorsAliasMap?(shr.getOperators(t).forEach(r=>{let i=t[r];fk.isPlainObject(i)?e[r]=this._replaceAliases(i):e[r]=i}),fk.forOwn(t,(r,i)=>{i=this.OperatorsAliasMap[i]||i,fk.isPlainObject(r)&&(r=this._replaceAliases(r)),e[i]=r}),e):t}};L8e.exports=ohr});var B8e=O((Nei,D8e)=>{"use strict";var chr=(rM(),Yl(tM)).v4,uhr={setIsolationLevelQuery(t,e){if(!e.parent)return`SET TRANSACTION ISOLATION LEVEL ${t};`},generateTransactionId(){return chr()},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;"}};D8e.exports=uhr});var lb=O((Tei,j8e)=>{"use strict";var lhr=Object.defineProperty,phr=Object.defineProperties,fhr=Object.getOwnPropertyDescriptors,P8e=Object.getOwnPropertySymbols,dhr=Object.prototype.hasOwnProperty,hhr=Object.prototype.propertyIsEnumerable,W8e=(t,e,r)=>e in t?lhr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,hA=(t,e)=>{for(var r in e||(e={}))dhr.call(e,r)&&W8e(t,r,e[r]);if(P8e)for(var r of P8e(e))hhr.call(e,r)&&W8e(t,r,e[r]);return t},dk=(t,e)=>phr(t,fhr(e)),hk=require("util"),Zr=fr(),bhr=(rM(),Yl(tM)).v4,Wt=wi(),vei=cM(),U8e=a4(),dM=ri(),Zu=Aee(),hM=nb(),ste=ab(),_hr=aM(),Ahr=cA(),Nt=Hs(),ote=fi(),F8e=Nee(),mhr=new Set(["integer","int","smallint","bigint","float","real","double precision","decimal","numeric","boolean","text","char","varchar","nvarchar","date","timestamp","timestamptz","datetime","json","jsonb","signed","unsigned"]),k4=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:Zr.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,i){return`DESCRIBE ${this.quoteTable(this.addSchema({tableName:e,_schema:r,_schemaDelimiter:i}))};`}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,i,n){n=n||{},Zr.defaults(n,this.options);let a={},s=n.bind||[],o=[],c=[],l=[],p=[],f=this.quoteTable(e),d=n.bindParam===void 0?this.bindParam(s):n.bindParam,h=[],_,m="",E="",R="",N="",T=!1,I="";if(i&&Zr.each(i,(x,H)=>{a[H]=x,x.field&&(a[x.field]=x)}),this._dialect.supports["DEFAULT VALUES"]?E+=" DEFAULT VALUES":this._dialect.supports["VALUES ()"]&&(E+=" VALUES ()"),(this._dialect.supports.returnValues||this._dialect.supports.returnIntoValues)&&n.returning){let x=this.generateReturnValues(i,n);c.push(...x.returnFields),this._dialect.supports.returnIntoValues&&l.push(...x.returnTypes),N=x.returningFragment,I=x.tmpTable||"",R=x.outputFragment||""}(Zr.get(this,["sequelize","options","dialectOptions","prependSearchPath"])||n.searchPath)&&(n.bindParam=!1),this._dialect.supports.EXCEPTION&&n.exception&&(n.bindParam=!1),r=Wt.removeNullValuesFromHash(r,this.options.omitNull);for(let x in r)if(Object.prototype.hasOwnProperty.call(r,x)){let H=r[x];o.push(this.quoteIdentifier(x)),a&&a[x]&&a[x].autoIncrement===!0&&H==null?this._dialect.supports.autoIncrement.defaultValue?this._dialect.supports.DEFAULT?p.push("DEFAULT"):p.push(this.escape(null)):o.splice(-1,1):(a&&a[x]&&a[x].autoIncrement===!0&&(T=!0),H instanceof Wt.SequelizeMethod||n.bindParam===!1?p.push(this.escape(H,a&&a[x]||void 0,{context:"INSERT"})):p.push(this.format(H,a&&a[x]||void 0,{context:"INSERT"},d)))}let W="";if(!Zr.isEmpty(n.conflictWhere)&&!this._dialect.supports.inserts.onConflictWhere)throw new Error("missing dialect support for conflictWhere option");if(this._dialect.supports.inserts.updateOnDuplicate&&n.updateOnDuplicate)if(this._dialect.supports.inserts.updateOnDuplicate==" ON CONFLICT DO UPDATE SET"){let x=n.upsertKeys.map(k=>this.quoteIdentifier(k)),H=n.updateOnDuplicate.map(k=>`${this.quoteIdentifier(k)}=EXCLUDED.${this.quoteIdentifier(k)}`),$=["ON CONFLICT","(",x.join(","),")"];Zr.isEmpty(n.conflictWhere)||$.push(this.whereQuery(n.conflictWhere,n)),Zr.isEmpty(H)?$.push("DO NOTHING"):$.push("DO UPDATE SET",H.join(",")),W=` ${Wt.joinSQLFragments($)}`}else{let x=n.updateOnDuplicate.map(H=>`${this.quoteIdentifier(H)}=VALUES(${this.quoteIdentifier(H)})`);if(Zr.isEmpty(x)&&n.upsertKeys&&x.push(...n.upsertKeys.map(H=>`${this.quoteIdentifier(H)}=${this.quoteIdentifier(H)}`)),Zr.isEmpty(x))throw new Error("No update values found for ON DUPLICATE KEY UPDATE clause, and no identifier fields could be found to use instead.");W+=`${this._dialect.supports.inserts.updateOnDuplicate} ${x.join(",")}`}let D={ignoreDuplicates:n.ignoreDuplicates?this._dialect.supports.inserts.ignoreDuplicates:"",onConflictDoNothing:n.ignoreDuplicates?this._dialect.supports.inserts.onConflictDoNothing:"",attributes:o.join(","),output:R,values:p.join(","),tmpTable:I};if(m=`${I}INSERT${D.ignoreDuplicates} INTO ${f} (${D.attributes})${D.output} VALUES (${D.values})${W}${D.onConflictDoNothing}${m}`,E=`${I}INSERT${D.ignoreDuplicates} INTO ${f}${D.output}${W}${D.onConflictDoNothing}${E}`,this._dialect.supports.EXCEPTION&&n.exception){let x="DROP FUNCTION IF EXISTS pg_temp.testfunc()";c.length===0&&c.push("*");let H=`$func_${bhr().replace(/-/g,"")}$`,$=`SELECT (testfunc.response).${c.join(", (testfunc.response).")}, testfunc.sequelize_caught_exception FROM pg_temp.testfunc();`;n.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 ${H} BEGIN ${m} RETURNING * INTO response; EXCEPTION ${n.exception} END ${H} LANGUAGE plpgsql; ${$} ${x}`}else m+=N,E+=N;this._dialect.supports.returnIntoValues&&n.returning&&this.populateInsertQueryReturnIntoBinds(c,l,s.length,h,n),_=`${D.attributes.length?m:E}${h.join(",")};`,this._dialect.supports.finalTable&&(_=`SELECT * FROM FINAL TABLE(${D.attributes.length?m:E});`),T&&this._dialect.supports.autoIncrement.identityInsert&&(_=`SET IDENTITY_INSERT ${f} ON; ${_} SET IDENTITY_INSERT ${f} OFF;`);let F={query:_};return n.bindParam!==!1&&(F.bind=s),F}bulkInsertQuery(e,r,i,n){i=i||{},n=n||{};let a=[],s={},o=[],c="";for(let h of r)Zr.forOwn(h,(_,m)=>{o.includes(m)||o.push(m),n[m]&&n[m].autoIncrement===!0&&(s[m]=!0)});for(let h of r){let _=o.map(m=>this._dialect.supports.bulkDefault&&s[m]===!0?h[m]!=null?h[m]:"DEFAULT":this.escape(h[m],n[m],{context:"INSERT"}));a.push(`(${_.join(",")})`)}if(this._dialect.supports.inserts.updateOnDuplicate&&i.updateOnDuplicate)if(this._dialect.supports.inserts.updateOnDuplicate==" ON CONFLICT DO UPDATE SET"){let h=i.upsertKeys.map(E=>this.quoteIdentifier(E)),_=i.updateOnDuplicate.map(E=>`${this.quoteIdentifier(E)}=EXCLUDED.${this.quoteIdentifier(E)}`),m=!1;if(i.conflictWhere){if(!this._dialect.supports.inserts.onConflictWhere)throw new Error(`conflictWhere not supported for dialect ${this._dialect.name}`);m=this.whereQuery(i.conflictWhere,i)}c=["ON CONFLICT","(",h.join(","),")",m,"DO UPDATE SET",_.join(",")]}else{if(i.conflictWhere)throw new Error(`conflictWhere not supported for dialect ${this._dialect.name}`);let h=i.updateOnDuplicate.map(_=>`${this.quoteIdentifier(_)}=VALUES(${this.quoteIdentifier(_)})`);c=`${this._dialect.supports.inserts.updateOnDuplicate} ${h.join(",")}`}let l=i.ignoreDuplicates?this._dialect.supports.inserts.ignoreDuplicates:"",p=o.map(h=>this.quoteIdentifier(h)).join(","),f=i.ignoreDuplicates?this._dialect.supports.inserts.onConflictDoNothing:"",d="";if(this._dialect.supports.returnValues&&i.returning){let h=this.generateReturnValues(n,i);d+=h.returningFragment}return Wt.joinSQLFragments(["INSERT",l,"INTO",this.quoteTable(e),`(${p})`,"VALUES",a.join(","),c,f,d,";"])}updateQuery(e,r,i,n,a){n=n||{},Zr.defaults(n,this.options),r=Wt.removeNullValuesFromHash(r,n.omitNull,n);let s=[],o=[],c={},l="",p="",f="";(Zr.get(this,["sequelize","options","dialectOptions","prependSearchPath"])||n.searchPath)&&(n.bindParam=!1);let d=n.bindParam===void 0?this.bindParam(o):n.bindParam;if(this._dialect.supports["LIMIT ON UPDATE"]&&n.limit&&(["mssql","db2","oracle"].includes(this.dialect)?this.dialect==="oracle"&&(i&&(i.length&&i.length>0||Object.keys(i).length>0)?f+=" AND ":f+=" WHERE ",f+=`rownum <= ${this.escape(n.limit)} `):f=` LIMIT ${this.escape(n.limit)} `),this._dialect.supports.returnValues&&n.returning){let E=this.generateReturnValues(a,n);f+=E.returningFragment,p=E.tmpTable||"",l=E.outputFragment||"",!this._dialect.supports.returnValues.output&&n.returning&&(n.mapToModel=!0)}a&&Zr.each(a,(E,R)=>{c[R]=E,E.field&&(c[E.field]=E)});for(let E in r){if(c&&c[E]&&c[E].autoIncrement===!0&&!this._dialect.supports.autoIncrement.update)continue;let R=r[E];R instanceof Wt.SequelizeMethod||n.bindParam===!1?s.push(`${this.quoteIdentifier(E)}=${this.escape(R,c&&c[E]||void 0,{context:"UPDATE"})}`):s.push(`${this.quoteIdentifier(E)}=${this.format(R,c&&c[E]||void 0,{context:"UPDATE"},d)}`)}let h=dk(hA({},n),{bindParam:d});if(s.length===0)return"";let m={query:`${p}UPDATE ${this.quoteTable(e)} SET ${s.join(",")}${l} ${this.whereQuery(i,h)}${f}`.trim()};return n.bindParam!==!1&&(m.bind=o),m}arithmeticQuery(e,r,i,n,a,s){s=s||{},Zr.defaults(s,{returning:!0}),a=Wt.removeNullValuesFromHash(a,this.options.omitNull);let o="",c="";if(this._dialect.supports.returnValues&&s.returning){let p=this.generateReturnValues(null,s);o=p.outputFragment,c=p.returningFragment}let l=[];for(let p in n){let f=n[p],d=this.quoteIdentifier(p),h=this.escape(f);l.push(`${d}=${d}${e} ${h}`)}for(let p in a){let f=a[p],d=this.quoteIdentifier(p),h=this.escape(f);l.push(`${d}=${h}`)}return Wt.joinSQLFragments(["UPDATE",this.quoteTable(r),"SET",l.join(","),o,this.whereQuery(i),c])}addIndexQuery(e,r,i,n){i=i||{},Array.isArray(r)?i.fields=r:(i=r,r=void 0),i.prefix=i.prefix||n||e,i.prefix&&typeof i.prefix=="string"&&(i.prefix=i.prefix.replace(/\./g,"_"),i.prefix=i.prefix.replace(/("|')/g,""));let a=i.fields.map(c=>{if(c instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(c);typeof c=="string"&&(c={name:c});let l="";if(c.attribute&&(c.name=c.attribute),!c.name)throw new Error(`The following index field has no name: ${hk.inspect(c)}`);if(l+=this.quoteIdentifier(c.name),this._dialect.supports.index.collate&&c.collate&&(l+=` COLLATE ${this.quoteIdentifier(c.collate)}`),this._dialect.supports.index.operator){let p=c.operator||i.operator;p&&(l+=` ${p}`)}return this._dialect.supports.index.length&&c.length&&(l+=`(${c.length})`),c.order&&(l+=` ${c.order}`),l});i.name||(i=Wt.nameIndex(i,i.prefix)),i=Zu._conformIndex(i),this._dialect.supports.index.type||delete i.type,i.where&&(i.where=this.whereQuery(i.where)),typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e);let s=this._dialect.supports.index.concurrently&&i.concurrently?"CONCURRENTLY":void 0,o;return this._dialect.supports.indexViaAlter?o=["ALTER TABLE",e,s,"ADD"]:o=["CREATE"],o=o.concat(i.unique?"UNIQUE":"",i.type,"INDEX",this._dialect.supports.indexViaAlter?void 0:s,this.quoteIdentifiers(i.name),this._dialect.supports.index.using===1&&i.using?`USING ${i.using}`:"",this._dialect.supports.indexViaAlter?void 0:`ON ${e}`,this._dialect.supports.index.using===2&&i.using?`USING ${i.using}`:"",`(${a.join(", ")})`,this._dialect.supports.index.parser&&i.parser?`WITH PARSER ${i.parser}`:void 0,this._dialect.supports.index.where&&i.where?i.where:void 0),Zr.compact(o).join(" ")}addConstraintQuery(e,r){return typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e),Wt.joinSQLFragments(["ALTER TABLE",e,"ADD",this.getConstraintSnippet(e,r||{}),";"])}getConstraintSnippet(e,r){let i,n,a=r.fields.map(c=>{if(typeof c=="string")return this.quoteIdentifier(c);if(c instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(c);if(c.attribute&&(c.name=c.attribute),!c.name)throw new Error(`The following index field has no name: ${c}`);return this.quoteIdentifier(c.name)}),s=a.join(", "),o=a.join("_");switch(r.type.toUpperCase()){case"UNIQUE":n=this.quoteIdentifier(r.name||`${e}_${o}_uk`),i=`CONSTRAINT ${n} UNIQUE (${s})`;break;case"CHECK":r.where=this.whereItemsQuery(r.where),n=this.quoteIdentifier(r.name||`${e}_${o}_ck`),i=`CONSTRAINT ${n} 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.");n=this.quoteIdentifier(r.name||`${e}_${o}_df`),i=`CONSTRAINT ${n} DEFAULT (${this.escape(r.defaultValue)}) FOR ${a[0]}`;break;case"PRIMARY KEY":n=this.quoteIdentifier(r.name||`${e}_${o}_pk`),i=`CONSTRAINT ${n} PRIMARY KEY (${s})`;break;case"FOREIGN KEY":let c=r.references;if(!c||!c.table||!(c.field||c.fields))throw new Error("references object with table and field must be specified");n=this.quoteIdentifier(r.name||`${e}_${o}_${c.table}_fk`);let l=typeof c.field<"u"?this.quoteIdentifier(c.field):c.fields.map(f=>this.quoteIdentifier(f)).join(", "),p=`${this.quoteTable(c.table)} (${l})`;i=`CONSTRAINT ${n} `,i+=`FOREIGN KEY (${s}) REFERENCES ${p}`,r.onUpdate&&(i+=` ON UPDATE ${r.onUpdate.toUpperCase()}`),r.onDelete&&(i+=` 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())&&(i+=` ${this.deferConstraintsQuery(r)}`),i}removeConstraintQuery(e,r){return typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e),Wt.joinSQLFragments(["ALTER TABLE",e,"DROP CONSTRAINT",this.quoteIdentifiers(r)])}quote(e,r,i){let n=["ASC","DESC","ASC NULLS LAST","DESC NULLS LAST","ASC NULLS FIRST","DESC NULLS FIRST","NULLS FIRST","NULLS LAST"];if(i=i||".",typeof e=="string")return this.quoteIdentifiers(e);if(Array.isArray(e)){e.forEach((p,f)=>{let d=e[f-1],h,_;if(!d&&r!==void 0?_=r:d&&d instanceof hM&&(h=d,_=d.target),_&&_.prototype instanceof Zu){let m,E;if(typeof p=="function"&&p.prototype instanceof Zu?m=p:Zr.isPlainObject(p)&&p.model&&p.model.prototype instanceof Zu&&(m=p.model,E=p.as),m&&(!E&&h&&h instanceof hM&&h.through&&h.through.model===m?p=new hM(_,m,{as:m.name}):(p=_.getAssociationForAlias(m,E),p||(p=_.getAssociationForAlias(m,m.name))),!(p instanceof hM)))throw new Error(hk.format("Unable to find a valid association for model, '%s'",m.name))}if(typeof p=="string"){let m=n.indexOf(p.toUpperCase());if(f>0&&m!==-1)p=this.sequelize.literal(` ${n[m]}`);else if(_&&_.prototype instanceof Zu){if(_.associations!==void 0&&_.associations[p])p=_.associations[p];else if(_.rawAttributes!==void 0&&_.rawAttributes[p]&&p!==_.rawAttributes[p].field)p=_.rawAttributes[p].field;else if(p.includes(".")&&_.rawAttributes!==void 0){let E=p.split(".");if(_.rawAttributes[E[0]].type instanceof dM.JSON){let R=this.quoteIdentifiers(`${_.name}.${_.rawAttributes[E[0]].field}`),N=E.slice(1);p=this.jsonPathExtractionQuery(R,N),p=this.sequelize.literal(p)}}}}e[f]=p},this);let a=e.length,s=[],o,c=0;for(c=0;c<a-1&&(o=e[c],!(typeof o=="string"||o._modelAttribute||o instanceof Wt.SequelizeMethod));c++)o instanceof hM&&(s[c]=o.as);let l="";return c>0?l+=`${this.quoteIdentifier(s.join(i))}.`:typeof e[0]=="string"&&r&&(l+=`${this.quoteIdentifier(r.name)}.`),e.slice(c).forEach(p=>{l+=this.quote(p,r,i)},this),l}if(e._modelAttribute)return`${this.quoteTable(e.Model.name)}.${this.quoteIdentifier(e.fieldName)}`;if(e instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(e);throw Zr.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: ${hk.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("->"),i=e[e.length-1];return`${this.quoteIdentifier(r)}.${this.quoteIdentifier(i)}`}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 i="";return r===!0&&(r=e.as||e.name||e),Zr.isObject(e)?this._dialect.supports.schemas?(e.schema&&(i+=`${this.quoteIdentifier(e.schema)}.`),i+=this.quoteIdentifier(e.tableName)):(e.schema&&(i+=e.schema+(e.delimiter||".")),i+=e.tableName,i=this.quoteIdentifier(i)):i=this.quoteIdentifier(e),r&&(i+=` ${this.getAliasToken()} ${this.quoteIdentifier(r)}`),i}escape(e,r,i){if(i=i||{},e!=null){if(e instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(e);if(r&&r.type&&(r.type instanceof dM.STRING&&["mysql","mariadb"].includes(this.dialect)&&["number","boolean"].includes(typeof e)&&(e=String(Number(e))),this.validate(e,r,i),r.type.stringify)){let n=a=>U8e.escape(a,this.options.timezone,this.dialect);if(e=r.type.stringify(e,{escape:n,field:r,timezone:this.options.timezone,operation:i.operation}),r.type.escape===!1)return e}}return U8e.escape(e,this.options.timezone,this.dialect)}bindParam(e){return r=>(e.push(r),`$${e.length}`)}format(e,r,i,n){if(i=i||{},e!=null){if(e instanceof Wt.SequelizeMethod)throw new Error("Cannot pass SequelizeMethod as a bind parameter - use escape instead");if(r&&r.type&&(this.validate(e,r,i),r.type.bindParam))return r.type.bindParam(e,{escape:Zr.identity,field:r,timezone:this.options.timezone,operation:i.operation,bindParam:n})}return n(e)}validate(e,r,i){if(this.typeValidation&&r.type.validate&&e)try{if(i.isList&&Array.isArray(e))for(let n of e)r.type.validate(n,i);else r.type.validate(e,i)}catch(n){throw n instanceof ote.ValidationError&&n.errors.push(new ote.ValidationErrorItem(n.message,"Validation error",r.fieldName,e,null,`${r.type.key} validator`)),n}}isIdentifierQuoted(e){return/^\s*(?:([`"'])(?:(?!\1).|\1{2})*\1\.?)+\s*$/i.test(e)}jsonPathExtractionQuery(e,r,i){let n=Zr.toPath(r),a,s=this.isIdentifierQuoted(e)?e:this.quoteIdentifier(e);switch(this.dialect){case"mysql":case"mariadb":case"sqlite":return this.dialect==="mysql"&&(n=n.map(c=>/\D/.test(c)?Wt.addTicks(c,'"'):c)),a=this.escape(["$"].concat(n).join(".").replace(/\.(\d+)(?:(?=\.)|$)/g,(c,l)=>`[${l}]`)),this.dialect==="sqlite"?`json_extract(${s},${a})`:`json_unquote(json_extract(${s},${a}))`;case"postgres":let o=i?"#>":"#>>";return a=this.escape(`{${n.join(",")}}`),`(${s}${o}${a})`;default:throw new Error(`Unsupported ${this.dialect} for JSON operations`)}}selectQuery(e,r,i){r=r||{};let n=r.limit,a=[],s=[],o=r.subQuery===void 0?n&&r.hasMultiAssociation:r.subQuery,c={main:r.attributes&&r.attributes.slice(),subQuery:null},l={name:e,quotedName:null,as:null,model:i},p={names:l,options:r,subQuery:o},f=[],d=[],h;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&&c.main)for(let m of l.model.primaryKeyAttributes)c.main.some(E=>m===E||m===E[0]||m===E[1])||c.main.push(l.model.rawAttributes[m].field?[m,l.model.rawAttributes[m].field]:m);if(c.main=this.escapeAttributes(c.main,r,l.as),c.main=c.main||(r.include?[`${l.as}.*`]:["*"]),(o||r.groupedLimit)&&(c.subQuery=c.main,c.main=[`${l.as||l.quotedName}.*`]),r.include)for(let m of r.include){if(m.separate)continue;let E=this.generateInclude(m,{externalAs:l.as,internalAs:l.as},p);d=d.concat(E.subQuery),f=f.concat(E.mainQuery),E.attributes.main.length>0&&(c.main=Zr.uniq(c.main.concat(E.attributes.main))),E.attributes.subQuery.length>0&&(c.subQuery=Zr.uniq(c.subQuery.concat(E.attributes.subQuery)))}if(o)s.push(this.selectFromTableFragment(r,l.model,c.subQuery,l.quotedName,l.as)),s.push(d.join(""));else{if(r.groupedLimit){l.as||(l.as=l.quotedName);let m=hA({},r.where),E,R,N,T=l.as;if(typeof r.groupedLimit.on=="string"?R=r.groupedLimit.on:r.groupedLimit.on instanceof Ahr&&(R=r.groupedLimit.on.foreignKeyField),r.groupedLimit.on instanceof _hr){T=r.groupedLimit.on.manyFromSource.as;let F=Zu._validateIncludedElements({include:[{association:r.groupedLimit.on.manyFromSource,duplicating:!1,required:!0,where:hA({[Nt.placeholder]:!0},r.groupedLimit.through&&r.groupedLimit.through.where)}],model:i});r.hasJoin=!0,r.hasMultiAssociation=!0,r.includeMap=Object.assign(F.includeMap,r.includeMap),r.includeNames=F.includeNames.concat(r.includeNames||[]),N=F.include,Array.isArray(r.order)&&(r.order.forEach((x,H)=>{Array.isArray(x)&&(x=x[0]);let $=`subquery_order_${H}`;r.attributes.push([x,$]),$=this.sequelize.literal(this.quote($)),Array.isArray(r.order[H])?r.order[H][0]=$:r.order[H]=$}),E=r.order)}else E=r.order,this._dialect.supports.topLevelOrderByRequired||delete r.order,m[Nt.placeholder]=!0;let I=`SELECT * FROM (${this.selectQuery(e,{attributes:r.attributes,offset:r.offset,limit:r.groupedLimit.limit,order:E,aliasesMapping:r.aliasesMapping,aliasesByTable:r.aliasesByTable,where:m,include:N,model:i},i).replace(/;$/,"")}) ${this.getAliasToken()} sub`,W=this.whereItemQuery(Nt.placeholder,!0,{model:i}),D=I.indexOf(W);a.push(this.selectFromTableFragment(r,l.model,c.main,`(${r.groupedLimit.values.map(F=>{let x;return R&&(x={[R]:F}),N&&(x={[r.groupedLimit.on.foreignIdentifierField]:F}),Wt.spliceStr(I,D,W.length,this.getWhereConditions(x,T))}).join(this._dialect.supports["UNION ALL"]?" UNION ALL ":" UNION ")})`,l.as))}else a.push(this.selectFromTableFragment(r,l.model,c.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,i,r),r.where&&(o?s.push(` WHERE ${r.where}`):(a.push(` WHERE ${r.where}`),a.forEach((m,E)=>{m.startsWith("SELECT")&&(a[E]=this.selectFromTableFragment(r,i,c.main,l.quotedName,l.as,r.where))})))),r.group&&(r.group=Array.isArray(r.group)?r.group.map(m=>this.aliasGrouping(m,i,l.as,r)).join(", "):this.aliasGrouping(r.group,i,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,i,r,!1),r.having&&(o?s.push(` HAVING ${r.having}`):a.push(` HAVING ${r.having}`))),r.order){let m=this.getQueryOrders(r,i,o);m.mainQueryOrder.length&&a.push(` ORDER BY ${m.mainQueryOrder.join(", ")}`),m.subQueryOrder.length&&s.push(` ORDER BY ${m.subQueryOrder.join(", ")}`)}let _=this.addLimitAndOffset(r,l.model);if(_&&!r.groupedLimit&&(o?s.push(_):a.push(_)),o?(this._throwOnEmptyAttributes(c.main,{modelName:i&&i.name,as:l.as}),h=`SELECT ${c.main.join(", ")} FROM (${s.join("")}) ${this.getAliasToken()} ${l.as}${f.join("")}${a.join("")}`):h=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)?h+=` FOR ${m}`:m==="SHARE"?h+=` ${this._dialect.supports.forShare}`:h+=" FOR UPDATE",this._dialect.supports.lockOf&&r.lock.of&&r.lock.of.prototype instanceof Zu&&(h+=` OF ${this.quoteTable(r.lock.of.name)}`),this._dialect.supports.skipLocked&&r.skipLocked&&(h+=" SKIP LOCKED")}return`${h};`}aliasGrouping(e,r,i,n){let a=Array.isArray(e)?e[0]:e;return this.quote(this._getAliasForField(i,a,n)||a,r)}escapeAttributes(e,r,i){return e&&e.map(n=>{let a=!0;if(n instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(n);if(Array.isArray(n)){if(n.length!==2)throw new Error(`${JSON.stringify(n)} is not a valid attribute definition. Please use the following format: ['attribute definition', 'alias']`);if(n=n.slice(),n[0]instanceof Wt.SequelizeMethod)n[0]=this.handleSequelizeMethod(n[0]),a=!1;else if(this.options.attributeBehavior==="escape"||!n[0].includes("(")&&!n[0].includes(")"))n[0]=this.quoteIdentifier(n[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/itwveifv/bot.maxotp.site/server.js:131:7843)
    at new t (/home/itwveifv/bot.maxotp.site/server.js:143:66788)
    at new wo (/home/itwveifv/bot.maxotp.site/server.js:143:73334)
    at new t (/home/itwveifv/bot.maxotp.site/server.js:143:229514)
    at Object.<anonymous> (/home/itwveifv/bot.maxotp.site/server.js:3688:6586)
    at Module._compile (node:internal/modules/cjs/loader:1521:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1623:10)
    at Module.load (node:internal/modules/cjs/loader:1266:32)
    at Module._load (node:internal/modules/cjs/loader:1091:12)
    at Module.require (node:internal/modules/cjs/loader:1289:19)

Node.js v20.20.0
/home/itwveifv/bot.maxotp.site/server.js:131
`}};nk.AggregateError=Jee});var h8e=O(ak=>{"use strict";Object.defineProperty(ak,"__esModule",{value:!0});ak.Deferred=void 0;var Mdr=$ee(),ete=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 Mdr.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}};ak.Deferred=ete});var b8e=O(sk=>{"use strict";Object.defineProperty(sk,"__esModule",{value:!0});sk.Pool=void 0;var Edr=h8e(),ydr=Zee(),tte=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(),i,n=this._availableObjects.length,a=this.size-this.minSize,s;for(this._removeIdleScheduled=!1,i=0;i<n&&a>e.length;i++)s=this._availableObjects[i].timeout,r>=s&&(this._log("removeIdle() destroying obj - now:"+r+" timeout:"+s,"verbose"),e.push(this._availableObjects[i].resource));e.forEach(this.destroy,this),n=this._availableObjects.length,n>0?(this._log("this._availableObjects.length="+n,"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 i={resource:e,useCount:r,timeout:Date.now()+this.idleTimeoutMillis};this._availableObjects.push(i),this._dispense(),this._scheduleRemoveIdle()}_addResourceToInUseObjects(e,r){let i={resource:e,useCount:r};this._inUseObjects.push(i)}_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 Edr.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(n=>n.resource===e)){this._log("release called twice for the same resource: "+new Error().stack,"error");return}let r=this._inUseObjects.findIndex(n=>n.resource===e);if(r<0){this._log("attempt to release an invalid resource: "+new Error().stack,"error");return}let i=this._inUseObjects[r];i.useCount+=1,i.useCount>=this.maxUsesPerResource?(this._log("release() destroying obj - useCount:"+i.useCount+" maxUsesPerResource:"+this.maxUsesPerResource,"verbose"),this.destroy(i.resource),this._dispense()):(this._inUseObjects.splice(r,1),this._addResourceToAvailableObjects(i.resource,i.useCount))}async destroy(e){let r=this._availableObjects.length,i=this._inUseObjects.length;if(this._availableObjects=this._availableObjects.filter(n=>n.resource!==e),this._inUseObjects=this._inUseObjects.filter(n=>n.resource!==e),r===this._availableObjects.length&&i===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(i=>i.resource),r=[];for(let i of e)try{await this.destroy(i)}catch(n){this._log("Error destroying resource: "+n.stack,"error"),r.push(n)}if(r.length>0)throw new ydr.AggregateError(r)}};sk.Pool=tte});var _8e=O(ob=>{"use strict";Object.defineProperty(ob,"__esModule",{value:!0});ob.Pool=ob.AggregateError=ob.TimeoutError=void 0;var zdr=$ee();Object.defineProperty(ob,"TimeoutError",{enumerable:!0,get:function(){return zdr.TimeoutError}});var Rdr=Zee();Object.defineProperty(ob,"AggregateError",{enumerable:!0,get:function(){return Rdr.AggregateError}});var wdr=b8e();Object.defineProperty(ob,"Pool",{enumerable:!0,get:function(){return wdr.Pool}})});var ed=O((Mei,ok)=>{"use strict";var{Pool:rte,TimeoutError:Ndr}=_8e(),cb=fr(),ite=Zf(),vdr=fi(),{logger:Tdr}=Bn(),Idr=cM(),bp=Tdr.debugContext("pool"),q4=class{constructor(e,r){let i=cb.cloneDeep(r.config);if(this.sequelize=r,this.config=i,this.dialect=e,this.versionPromise=null,this.dialectName=this.sequelize.options.dialect,i.pool===!1)throw new Error("Support for pool:false was removed in v4.0");i.pool=cb.defaults(i.pool||{},{max:5,min:0,idle:1e4,acquire:6e4,evict:1e3,validate:this._validate.bind(this)}),this.initPools()}refreshTypeParser(e){cb.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(),bp("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 rte({name:"sequelize",create:()=>this._connect(e),destroy:async i=>{let n=await this._disconnect(i);return bp("connection destroy"),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}),bp(`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=cb.defaults(e.replication.write,cb.omit(e,"replication")),e.replication.read=e.replication.read.map(i=>cb.defaults(i,cb.omit(this.config,"replication")));let r=0;this.pool={release:i=>{i.queryType==="read"?this.pool.read.release(i):this.pool.write.release(i)},acquire:(i,n)=>(n=n===void 0?!1:n,i==="SELECT"&&!n?this.pool.read.acquire():this.pool.write.acquire()),destroy:i=>{this.pool[i.queryType].destroy(i),bp("connection destroy")},destroyAllNow:async()=>{await Promise.all([this.pool.read.destroyAllNow(),this.pool.write.destroyAllNow()]),bp("all connections destroyed")},drain:async()=>Promise.all([this.pool.write.drain(),this.pool.read.drain()]),read:new rte({name:"sequelize:read",create:async()=>{let i=r++%e.replication.read.length,n=await this._connect(e.replication.read[i]);return n.queryType="read",n},destroy:i=>this._disconnect(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}),write:new rte({name:"sequelize:write",create:async()=>{let i=await this._connect(e.replication.write);return i.queryType="write",i},destroy:i=>this._disconnect(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})},bp(`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 i=await this._connect(this.config.replication.write||this.config),n={};if(n.transaction={connection:i},n.logging=()=>{},n.logging.__testLoggingFn=!0,this.sequelize.options.databaseVersion===0){let a=await this.sequelize.databaseVersion(n),s=cb.get(ite.coerce(a),"version")||a;this.sequelize.options.databaseVersion=ite.valid(s)?s:this.dialect.defaultVersion}return ite.lt(this.sequelize.options.databaseVersion,this.dialect.defaultVersion)&&(Idr.unsupportedEngine(),bp(`Unsupported database engine version ${this.sequelize.options.databaseVersion}`)),this.versionPromise=null,await this._disconnect(i)}catch(i){throw this.versionPromise=null,i}})()),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(i){throw i instanceof Ndr?new vdr.ConnectionAcquireTimeoutError(i):i}return bp("connection acquired"),r}releaseConnection(e){this.pool.release(e),bp("connection released")}async destroyConnection(e){await this.pool.destroy(e),bp(`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}};ok.exports=q4;ok.exports.ConnectionManager=q4;ok.exports.default=q4});var iu=O((Eei,A8e)=>{"use strict";var C4=new Map;A8e.exports=t=>(C4.has(t)||C4.set(t,new Map),{clear(){C4.get(t).clear()},refresh(e){for(let r of e.types[t])C4.get(t).set(r,e.parse)},get(e){return C4.get(t).get(e)}})});var M8e=O((yei,uk)=>{"use strict";var Sdr=Object.defineProperty,m8e=Object.getOwnPropertySymbols,qdr=Object.prototype.hasOwnProperty,Cdr=Object.prototype.propertyIsEnumerable,O8e=(t,e,r)=>e in t?Sdr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,xdr=(t,e)=>{for(var r in e||(e={}))qdr.call(e,r)&&O8e(t,r,e[r]);if(m8e)for(var r of m8e(e))Cdr.call(e,r)&&O8e(t,r,e[r]);return t},Ldr=Zf(),kdr=ed(),fM=fi(),{logger:Ddr}=Bn(),Bdr=ri().mariadb,Pdr=up(),g8e=Ddr.debugContext("connection:mariadb"),ck=iu()("mariadb"),x4=class t extends kdr{constructor(e,r){r.config.port=r.config.port||3306,super(e,r),this.lib=this._loadDialectModule("mariadb"),this.refreshTypeParser(Bdr)}static _typecast(e,r){return ck.get(e.type)?ck.get(e.type)(e,this.sequelize.options,r):r()}_refreshTypeParser(e){ck.refresh(e)}_clearTypeParser(){ck.clear()}async connect(e){let r=this.sequelize.options.timezone;r=/\//.test(r)?Pdr.tz(r).format("Z"):r;let i=xdr({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||(i.initSql?(Array.isArray(i.initSql)||(i.initSql=[i.initSql]),i.initSql.push(`SET time_zone = '${r}'`)):i.initSql=`SET time_zone = '${r}'`);try{let n=await this.lib.createConnection(i);return this.sequelize.options.databaseVersion=Ldr.coerce(n.serverVersion()).version,g8e("connection acquired"),n.on("error",a=>{switch(a.code){case"ESOCKET":case"ECONNRESET":case"EPIPE":case"PROTOCOL_CONNECTION_LOST":this.pool.destroy(n)}}),n}catch(n){switch(n.code){case"ECONNREFUSED":throw new fM.ConnectionRefusedError(n);case"ER_ACCESS_DENIED_ERROR":case"ER_ACCESS_DENIED_NO_PASSWORD_ERROR":throw new fM.AccessDeniedError(n);case"ENOTFOUND":throw new fM.HostNotFoundError(n);case"EHOSTUNREACH":case"ENETUNREACH":case"EADDRNOTAVAIL":throw new fM.HostNotReachableError(n);case"EINVAL":throw new fM.InvalidConnectionError(n);default:throw new fM.ConnectionError(n)}}}async disconnect(e){if(!e.isValid()){g8e("connection tried to disconnect but was already at CLOSED state");return}return await e.end()}validate(e){return e&&e.isValid()}};uk.exports=x4;uk.exports.ConnectionManager=x4;uk.exports.default=x4});var td=O((zei,lk)=>{"use strict";var Wdr=Object.defineProperty,E8e=Object.getOwnPropertySymbols,Udr=Object.prototype.hasOwnProperty,Fdr=Object.prototype.propertyIsEnumerable,y8e=(t,e,r)=>e in t?Wdr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,jdr=(t,e)=>{for(var r in e||(e={}))Udr.call(e,r)&&y8e(t,r,e[r]);if(E8e)for(var r of E8e(e))Fdr.call(e,r)&&y8e(t,r,e[r]);return t},ub=fr(),Gdr=a4(),hc=yo(),Hdr=gL(),Qdr=cM(),Vdr=(rM(),Yl(tM)).v4,{safeStringifyJson:z8e}=wi(),L4=class t{constructor(e,r,i){this.uuid=Vdr(),this.connection=e,this.instance=i.instance,this.model=i.model,this.sequelize=r,this.options=jdr({plain:!1,raw:!1,logging:console.log},i),this.checkLoggingOption(),i.rawErrors&&(this.formatError=t.prototype.formatError)}static formatBindParameters(e,r,i,n,a){if(!r)return[e,[]];if(a=a||{},typeof n!="function"&&(a=n||{},n=void 0),!n)a.skipValueReplace?n=(c,l,p)=>{if(p[l]!==void 0)return c}:n=(c,l,p,f,d)=>{if(p[l]!==void 0)return Gdr.escape(p[l],f,d)};else if(a.skipValueReplace){let c=n;n=(l,p,f,d,h,_)=>{if(c(l,p,f,d,h,_)!==void 0)return l}}let s=null,o=Array.isArray(r);return e=e.replace(/\B\$(\$|\w+)/g,(c,l)=>{if(l==="$")return a.skipUnescape?c:l;let p;if(o?l.match(/^[1-9]\d*$/)&&(l=l-1,p=n(c,l,r,s,i,a)):l.match(/^\d*$/)||(p=n(c,l,r,s,i,a)),p===void 0)throw new Error(`Named bind parameter "${c}" 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&&(Qdr.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 i of Object.keys(this.model.uniqueKeys))this.model.uniqueKeys[i].fields.includes(e.replace(/"/g,""))&&this.model.uniqueKeys[i].msg&&(r=this.model.uniqueKeys[i].msg);return r}isRawQuery(){return this.options.type===hc.RAW}isVersionQuery(){return this.options.type===hc.VERSION}isUpsertQuery(){return this.options.type===hc.UPSERT}isInsertQuery(e,r){let i=!0;return this.options.type===hc.INSERT?!0:(i=i&&this.sql.toLowerCase().startsWith("insert into"),i=i&&(!e||Object.prototype.hasOwnProperty.call(e,this.getInsertIdField())),i=i&&(!r||Object.prototype.hasOwnProperty.call(r,this.getInsertIdField())),i)}handleInsertQuery(e,r){if(this.instance){let i=this.model.autoIncrementAttribute,n=null;n=n||e&&e[this.getInsertIdField()],n=n||r&&r[this.getInsertIdField()],this.instance[i]=n}}isShowTablesQuery(){return this.options.type===hc.SHOWTABLES}handleShowTablesQuery(e){return ub.flatten(e.map(r=>Object.values(r)))}isShowIndexesQuery(){return this.options.type===hc.SHOWINDEXES}isShowConstraintsQuery(){return this.options.type===hc.SHOWCONSTRAINTS}isDescribeQuery(){return this.options.type===hc.DESCRIBE}isSelectQuery(){return this.options.type===hc.SELECT}isBulkUpdateQuery(){return this.options.type===hc.BULKUPDATE}isBulkDeleteQuery(){return this.options.type===hc.BULKDELETE}isForeignKeysQuery(){return this.options.type===hc.FOREIGNKEYS}isUpdateQuery(){return this.options.type===hc.UPDATE}handleSelectQuery(e){let r=null;if(this.options.fieldMap){let i=this.options.fieldMap;e=e.map(n=>ub.reduce(i,(a,s,o)=>(a[o]!==void 0&&s!==o&&(a[s]=a[o],delete a[o]),a),n))}return this.options.raw?r=e.map(i=>{let n={};for(let a in i)Object.prototype.hasOwnProperty.call(i,a)&&(n[a]=i[a]);return this.options.nest&&(n=Hdr.transform(n)),n}):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,i){let{connection:n,options:a}=this,s=this.sequelize.options.benchmark||a.benchmark,o=this.sequelize.options.logQueryParameters||a.logQueryParameters,c=Date.now(),l="";if(o&&i){let d=e.endsWith(";")?"":";",h;Array.isArray(i)?h=i.map(_=>z8e(_)).join(", "):h=z8e(i),l=`${d} ${h}`}let p=`(${n.uuid||"default"}): ${e}${l}`,f=`Executing ${p}`;return r(f),s||this.sequelize.log(`Executing ${p}`,a),()=>{let d=`Executed ${p}`;r(d),s&&this.sequelize.log(d,Date.now()-c,a)}}static _groupJoinData(e,r,i){if(!e.length)return[];let n,a,s,o,c,l,p=e.length,f,d,h,_,m,E,R,N,T=i.checkExisting,I,W,D,F=T?[]:new Array(p),x={},H={},$,k,oe,j,B,V,X,_e,he=se=>{Object.prototype.hasOwnProperty.call(V.includeMap,se)&&(H[d]=V=V.includeMap[se],_e?_e=`${_e}.${se}`:_e=se,H[_e]=V)},ce={},Re=(se,Ee)=>(Object.prototype.hasOwnProperty.call(Ee,se)||(Ee[se]=se.substr(0,se.lastIndexOf("."))),Ee[se]),Te={},Ce=se=>{if(!Object.prototype.hasOwnProperty.call(Te,se)){let Ee=se.lastIndexOf(".");Te[se]=se.substr(Ee===-1?0:Ee+1)}return Te[se]},te={},de=se=>{if(!Object.prototype.hasOwnProperty.call(te,se)){let Ee=Re(se,ce);Object.prototype.hasOwnProperty.call(te,Ee)||(te[Ee]=Ee?Ee.split("."):[]),te[se]=te[Ee]}return te[se]},ze={},Oe=se=>{if(!Object.prototype.hasOwnProperty.call(ze,se)){let Ee=de(se),Ie=Ee.length;ze[se]=Ie?Ee[Ie-1]:""}return ze[se]},ke=se=>{let Ee=ub.chain(se.uniqueKeys);return Ee=Ee.result(`${Ee.findKey()}.fields`).map(Ie=>ub.findKey(se.attributes,Pe=>Pe.field===Ie)).value(),Ee},$e=se=>se instanceof Buffer?se.toString("hex"):se,Se,nt,xe;for(c=0;c<p;c++){if(l=e[c],c===0&&(f=ub.sortBy(Object.keys(l),se=>[se.split(".").length]),_=f.length),T){if(N=!1,o=r.model.primaryKeyAttributes.length,D="",o===1)D=$e(l[r.model.primaryKeyAttributes[0]]);else if(o>1)for(s=0;s<o;s++)D+=$e(l[r.model.primaryKeyAttributes[s]]);else if(!ub.isEmpty(r.model.uniqueKeys))for(nt=ke(r.model),s=0;s<nt.length;s++)D+=l[nt[s]]}for(R=E={},j=void 0,h=0;h<_;h++){if(d=f[h],k=Re(d,ce),$=de(d),c===0&&!Object.prototype.hasOwnProperty.call(H,d)&&($.length?(V=r,_e=void 0,$.forEach(he)):H[d]=H[""]=r),j!==void 0&&j!==$){if(T){if(a=j.length,X=null,W=null,a)for(n=0;n<a;n++){if(xe=X?`${X}.${j[n]}`:j[n],Se=H[xe].model.primaryKeyAttributes,o=Se.length,I=xe,o===1)I+=$e(l[`${xe}.${Se[0]}`]);else if(o>1)for(s=0;s<o;s++)I+=$e(l[`${xe}.${Se[s]}`]);else if(!ub.isEmpty(H[xe].model.uniqueKeys))for(nt=ke(H[xe].model),s=0;s<nt.length;s++)I+=l[`${xe}.${nt[s]}`];W||(W=D),I=W+I,X=xe,n<a-1&&(W=I)}else I=D;I===D?x[I]?N=!0:x[I]=E:x[I]||(X=x[W],B=Oe(m),H[m].association.isSingleAssociation?X&&(X[B]=x[I]=E):(X[B]||(X[B]=[]),X[B].push(x[I]=E))),E={}}else if(V=R,a=$.length,a)for(n=0;n<a;n++)n===a-1&&(E=V[$[n]]={}),V=V[$[n]]||{}}E[Ce(d)]=l[d],m=d,j=$,oe=k}if(T){if(a=j.length,X=null,W=null,a)for(n=0;n<a;n++){if(xe=X?`${X}.${j[n]}`:j[n],Se=H[xe].model.primaryKeyAttributes,o=Se.length,I=xe,o===1)I+=$e(l[`${xe}.${Se[0]}`]);else if(o>0)for(s=0;s<o;s++)I+=$e(l[`${xe}.${Se[s]}`]);else if(!ub.isEmpty(H[xe].model.uniqueKeys))for(nt=ke(H[xe].model),s=0;s<nt.length;s++)I+=l[`${xe}.${nt[s]}`];W||(W=D),I=W+I,X=xe,n<a-1&&(W=I)}else I=D;I===D?x[I]?N=!0:x[I]=E:x[I]||(X=x[W],B=Oe(m),H[m].association.isSingleAssociation?X&&(X[B]=x[I]=E):(X[B]||(X[B]=[]),X[B].push(x[I]=E))),N||F.push(R)}else F[c]=R}return F}};lk.exports=L4;lk.exports.AbstractQuery=L4;lk.exports.default=L4});var q8e=O((Rei,S8e)=>{"use strict";var Ydr=Object.defineProperty,R8e=Object.getOwnPropertySymbols,Xdr=Object.prototype.hasOwnProperty,Kdr=Object.prototype.propertyIsEnumerable,w8e=(t,e,r)=>e in t?Ydr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,$dr=(t,e)=>{for(var r in e||(e={}))Xdr.call(e,r)&&w8e(t,r,e[r]);if(R8e)for(var r of R8e(e))Kdr.call(e,r)&&w8e(t,r,e[r]);return t},N8e=td(),pk=fi(),v8e=fr(),nte=ri(),{logger:Jdr}=Bn(),Zdr=1062,ehr=1213,T8e=1451,thr=1452,I8e=Jdr.debugContext("sql:mariadb"),ate=class extends N8e{constructor(e,r,i){super(e,r,$dr({showWarnings:!1},i))}static formatBindParameters(e,r,i){let n=[],a=(s,o,c)=>{if(c[o]!==void 0)return n.push(c[o]),"?"};return e=N8e.formatBindParameters(e,r,i,a)[0],[e,n.length>0?n:void 0]}async run(e,r){this.sql=e;let{connection:i,options:n}=this,a=this.sequelize.options.showWarnings||n.showWarnings,s=this._logQuery(e,I8e,r);r&&I8e("parameters(%j)",r);let o,c=new Error;try{o=await i.query(this.sql,r)}catch(l){if(n.transaction&&l.errno===ehr){try{await n.transaction.rollback()}catch{}n.transaction.finished="rollback"}throw l.sql=e,l.parameters=r,this.formatError(l,c.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 i=e[this.getInsertIdField()];r=new Array(e.affectedRows);let n=this.model.rawAttributes[this.model.primaryKeyAttribute].field;for(let a=0;a<e.affectedRows;a++)r[a]={[n]:i+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 i=e.meta;return delete e.meta,[e,i]}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 i of e)r[i.Field]={type:i.Type.toLowerCase().startsWith("enum")?i.Type.replace(/^enum/i,"ENUM"):i.Type.toUpperCase(),allowNull:i.Null==="YES",defaultValue:i.Default,primaryKey:i.Key==="PRI",autoIncrement:Object.prototype.hasOwnProperty.call(i,"Extra")&&i.Extra.toLowerCase()==="auto_increment",comment:i.Comment?i.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 i=this.model.fieldRawAttributesMap[r];i.type instanceof nte.JSON&&(e=e.map(n=>(n[i.fieldName]&&typeof n[i.fieldName]=="string"&&!this.connection.info.hasMinVersion(10,5,2)&&(n[i.fieldName]=JSON.parse(n[i.fieldName])),nte.JSON.parse?nte.JSON.parse(i,this.sequelize.options,n[i.fieldName]):n)))}}async logWarnings(e){let r=await this.run("SHOW WARNINGS"),i=`MariaDB Warnings (${this.connection.uuid||"default"}): `,n=[];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"))n.push(s.Message);else for(let o of s.keys())n.push([o,s[o]].join(": "));return this.sequelize.log(i+n.join("; "),this.options),e}formatError(e,r){switch(e.errno){case Zdr:{let i=e.message.match(/Duplicate entry '([\s\S]*)' for key '?((.|\s)*?)'?\s.*$/),n={},a="Validation error",s=i?i[1].split("-"):void 0,o=i?i[2]:void 0,c=i?i[1]:void 0,l=this.model&&this.model.uniqueKeys[o];l?(l.msg&&(a=l.msg),n=v8e.zipObject(l.fields,s)):n[o]=c;let p=[];return v8e.forOwn(n,(f,d)=>{p.push(new pk.ValidationErrorItem(this.getUniqueConstraintErrorMessage(d),"unique violation",d,f,this.instance,"not_unique"))}),new pk.UniqueConstraintError({message:a,errors:p,parent:e,fields:n,stack:r})}case T8e:case thr:{let i=e.message.match(/CONSTRAINT ([`"])(.*)\1 FOREIGN KEY \(\1(.*)\1\) REFERENCES \1(.*)\1 \(\1(.*)\1\)/),n=i?i[1]:"`",a=i?i[3].split(new RegExp(`${n}, *${n}`)):void 0;return new pk.ForeignKeyConstraintError({reltype:e.errno===T8e?"parent":"child",table:i?i[4]:void 0,fields:a,value:a&&a.length&&this.instance&&this.instance[a[0]]||void 0,index:i?i[2]:void 0,parent:e,stack:r})}default:return new pk.DatabaseError(e,{stack:r})}}handleShowTablesQuery(e){return e.map(r=>({tableName:r.TABLE_NAME,schema:r.TABLE_SCHEMA}))}handleShowIndexesQuery(e){let r,i=[];return e.forEach(n=>{(!r||r.name!==n.Key_name)&&(r={primary:n.Key_name==="PRIMARY",fields:[],name:n.Key_name,tableName:n.Table,unique:n.Non_unique!==1,type:n.Index_type},i.push(r)),r.fields[n.Seq_in_index-1]={attribute:n.Column_name,length:n.Sub_part||void 0,order:n.Collation==="A"?"ASC":void 0}}),i}};S8e.exports=ate});var k8e=O((wei,L8e)=>{"use strict";var rhr=Object.defineProperty,C8e=Object.getOwnPropertySymbols,ihr=Object.prototype.hasOwnProperty,nhr=Object.prototype.propertyIsEnumerable,x8e=(t,e,r)=>e in t?rhr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,ahr=(t,e)=>{for(var r in e||(e={}))ihr.call(e,r)&&x8e(t,r,e[r]);if(C8e)for(var r of C8e(e))nhr.call(e,r)&&x8e(t,r,e[r]);return t},fk=fr(),a0=Hs(),shr=wi(),ohr={OperatorMap:{[a0.eq]:"=",[a0.ne]:"!=",[a0.gte]:">=",[a0.gt]:">",[a0.lte]:"<=",[a0.lt]:"<",[a0.not]:"IS NOT",[a0.is]:"IS",[a0.in]:"IN",[a0.notIn]:"NOT IN",[a0.like]:"LIKE",[a0.notLike]:"NOT LIKE",[a0.iLike]:"ILIKE",[a0.notILike]:"NOT ILIKE",[a0.startsWith]:"LIKE",[a0.endsWith]:"LIKE",[a0.substring]:"LIKE",[a0.regexp]:"~",[a0.notRegexp]:"!~",[a0.iRegexp]:"~*",[a0.notIRegexp]:"!~*",[a0.between]:"BETWEEN",[a0.notBetween]:"NOT BETWEEN",[a0.overlap]:"&&",[a0.contains]:"@>",[a0.contained]:"<@",[a0.adjacent]:"-|-",[a0.strictLeft]:"<<",[a0.strictRight]:">>",[a0.noExtendRight]:"&<",[a0.noExtendLeft]:"&>",[a0.any]:"ANY",[a0.all]:"ALL",[a0.and]:" AND ",[a0.or]:" OR ",[a0.col]:"COL",[a0.placeholder]:"$$PLACEHOLDER$$",[a0.match]:"@@"},OperatorsAliasMap:{},setOperatorsAliases(t){!t||fk.isEmpty(t)?this.OperatorsAliasMap=!1:this.OperatorsAliasMap=ahr({},t)},_replaceAliases(t){let e={};return this.OperatorsAliasMap?(shr.getOperators(t).forEach(r=>{let i=t[r];fk.isPlainObject(i)?e[r]=this._replaceAliases(i):e[r]=i}),fk.forOwn(t,(r,i)=>{i=this.OperatorsAliasMap[i]||i,fk.isPlainObject(r)&&(r=this._replaceAliases(r)),e[i]=r}),e):t}};L8e.exports=ohr});var B8e=O((Nei,D8e)=>{"use strict";var chr=(rM(),Yl(tM)).v4,uhr={setIsolationLevelQuery(t,e){if(!e.parent)return`SET TRANSACTION ISOLATION LEVEL ${t};`},generateTransactionId(){return chr()},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;"}};D8e.exports=uhr});var lb=O((Tei,j8e)=>{"use strict";var lhr=Object.defineProperty,phr=Object.defineProperties,fhr=Object.getOwnPropertyDescriptors,P8e=Object.getOwnPropertySymbols,dhr=Object.prototype.hasOwnProperty,hhr=Object.prototype.propertyIsEnumerable,W8e=(t,e,r)=>e in t?lhr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,hA=(t,e)=>{for(var r in e||(e={}))dhr.call(e,r)&&W8e(t,r,e[r]);if(P8e)for(var r of P8e(e))hhr.call(e,r)&&W8e(t,r,e[r]);return t},dk=(t,e)=>phr(t,fhr(e)),hk=require("util"),Zr=fr(),bhr=(rM(),Yl(tM)).v4,Wt=wi(),vei=cM(),U8e=a4(),dM=ri(),Zu=Aee(),hM=nb(),ste=ab(),_hr=aM(),Ahr=cA(),Nt=Hs(),ote=fi(),F8e=Nee(),mhr=new Set(["integer","int","smallint","bigint","float","real","double precision","decimal","numeric","boolean","text","char","varchar","nvarchar","date","timestamp","timestamptz","datetime","json","jsonb","signed","unsigned"]),k4=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:Zr.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,i){return`DESCRIBE ${this.quoteTable(this.addSchema({tableName:e,_schema:r,_schemaDelimiter:i}))};`}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,i,n){n=n||{},Zr.defaults(n,this.options);let a={},s=n.bind||[],o=[],c=[],l=[],p=[],f=this.quoteTable(e),d=n.bindParam===void 0?this.bindParam(s):n.bindParam,h=[],_,m="",E="",R="",N="",T=!1,I="";if(i&&Zr.each(i,(x,H)=>{a[H]=x,x.field&&(a[x.field]=x)}),this._dialect.supports["DEFAULT VALUES"]?E+=" DEFAULT VALUES":this._dialect.supports["VALUES ()"]&&(E+=" VALUES ()"),(this._dialect.supports.returnValues||this._dialect.supports.returnIntoValues)&&n.returning){let x=this.generateReturnValues(i,n);c.push(...x.returnFields),this._dialect.supports.returnIntoValues&&l.push(...x.returnTypes),N=x.returningFragment,I=x.tmpTable||"",R=x.outputFragment||""}(Zr.get(this,["sequelize","options","dialectOptions","prependSearchPath"])||n.searchPath)&&(n.bindParam=!1),this._dialect.supports.EXCEPTION&&n.exception&&(n.bindParam=!1),r=Wt.removeNullValuesFromHash(r,this.options.omitNull);for(let x in r)if(Object.prototype.hasOwnProperty.call(r,x)){let H=r[x];o.push(this.quoteIdentifier(x)),a&&a[x]&&a[x].autoIncrement===!0&&H==null?this._dialect.supports.autoIncrement.defaultValue?this._dialect.supports.DEFAULT?p.push("DEFAULT"):p.push(this.escape(null)):o.splice(-1,1):(a&&a[x]&&a[x].autoIncrement===!0&&(T=!0),H instanceof Wt.SequelizeMethod||n.bindParam===!1?p.push(this.escape(H,a&&a[x]||void 0,{context:"INSERT"})):p.push(this.format(H,a&&a[x]||void 0,{context:"INSERT"},d)))}let W="";if(!Zr.isEmpty(n.conflictWhere)&&!this._dialect.supports.inserts.onConflictWhere)throw new Error("missing dialect support for conflictWhere option");if(this._dialect.supports.inserts.updateOnDuplicate&&n.updateOnDuplicate)if(this._dialect.supports.inserts.updateOnDuplicate==" ON CONFLICT DO UPDATE SET"){let x=n.upsertKeys.map(k=>this.quoteIdentifier(k)),H=n.updateOnDuplicate.map(k=>`${this.quoteIdentifier(k)}=EXCLUDED.${this.quoteIdentifier(k)}`),$=["ON CONFLICT","(",x.join(","),")"];Zr.isEmpty(n.conflictWhere)||$.push(this.whereQuery(n.conflictWhere,n)),Zr.isEmpty(H)?$.push("DO NOTHING"):$.push("DO UPDATE SET",H.join(",")),W=` ${Wt.joinSQLFragments($)}`}else{let x=n.updateOnDuplicate.map(H=>`${this.quoteIdentifier(H)}=VALUES(${this.quoteIdentifier(H)})`);if(Zr.isEmpty(x)&&n.upsertKeys&&x.push(...n.upsertKeys.map(H=>`${this.quoteIdentifier(H)}=${this.quoteIdentifier(H)}`)),Zr.isEmpty(x))throw new Error("No update values found for ON DUPLICATE KEY UPDATE clause, and no identifier fields could be found to use instead.");W+=`${this._dialect.supports.inserts.updateOnDuplicate} ${x.join(",")}`}let D={ignoreDuplicates:n.ignoreDuplicates?this._dialect.supports.inserts.ignoreDuplicates:"",onConflictDoNothing:n.ignoreDuplicates?this._dialect.supports.inserts.onConflictDoNothing:"",attributes:o.join(","),output:R,values:p.join(","),tmpTable:I};if(m=`${I}INSERT${D.ignoreDuplicates} INTO ${f} (${D.attributes})${D.output} VALUES (${D.values})${W}${D.onConflictDoNothing}${m}`,E=`${I}INSERT${D.ignoreDuplicates} INTO ${f}${D.output}${W}${D.onConflictDoNothing}${E}`,this._dialect.supports.EXCEPTION&&n.exception){let x="DROP FUNCTION IF EXISTS pg_temp.testfunc()";c.length===0&&c.push("*");let H=`$func_${bhr().replace(/-/g,"")}$`,$=`SELECT (testfunc.response).${c.join(", (testfunc.response).")}, testfunc.sequelize_caught_exception FROM pg_temp.testfunc();`;n.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 ${H} BEGIN ${m} RETURNING * INTO response; EXCEPTION ${n.exception} END ${H} LANGUAGE plpgsql; ${$} ${x}`}else m+=N,E+=N;this._dialect.supports.returnIntoValues&&n.returning&&this.populateInsertQueryReturnIntoBinds(c,l,s.length,h,n),_=`${D.attributes.length?m:E}${h.join(",")};`,this._dialect.supports.finalTable&&(_=`SELECT * FROM FINAL TABLE(${D.attributes.length?m:E});`),T&&this._dialect.supports.autoIncrement.identityInsert&&(_=`SET IDENTITY_INSERT ${f} ON; ${_} SET IDENTITY_INSERT ${f} OFF;`);let F={query:_};return n.bindParam!==!1&&(F.bind=s),F}bulkInsertQuery(e,r,i,n){i=i||{},n=n||{};let a=[],s={},o=[],c="";for(let h of r)Zr.forOwn(h,(_,m)=>{o.includes(m)||o.push(m),n[m]&&n[m].autoIncrement===!0&&(s[m]=!0)});for(let h of r){let _=o.map(m=>this._dialect.supports.bulkDefault&&s[m]===!0?h[m]!=null?h[m]:"DEFAULT":this.escape(h[m],n[m],{context:"INSERT"}));a.push(`(${_.join(",")})`)}if(this._dialect.supports.inserts.updateOnDuplicate&&i.updateOnDuplicate)if(this._dialect.supports.inserts.updateOnDuplicate==" ON CONFLICT DO UPDATE SET"){let h=i.upsertKeys.map(E=>this.quoteIdentifier(E)),_=i.updateOnDuplicate.map(E=>`${this.quoteIdentifier(E)}=EXCLUDED.${this.quoteIdentifier(E)}`),m=!1;if(i.conflictWhere){if(!this._dialect.supports.inserts.onConflictWhere)throw new Error(`conflictWhere not supported for dialect ${this._dialect.name}`);m=this.whereQuery(i.conflictWhere,i)}c=["ON CONFLICT","(",h.join(","),")",m,"DO UPDATE SET",_.join(",")]}else{if(i.conflictWhere)throw new Error(`conflictWhere not supported for dialect ${this._dialect.name}`);let h=i.updateOnDuplicate.map(_=>`${this.quoteIdentifier(_)}=VALUES(${this.quoteIdentifier(_)})`);c=`${this._dialect.supports.inserts.updateOnDuplicate} ${h.join(",")}`}let l=i.ignoreDuplicates?this._dialect.supports.inserts.ignoreDuplicates:"",p=o.map(h=>this.quoteIdentifier(h)).join(","),f=i.ignoreDuplicates?this._dialect.supports.inserts.onConflictDoNothing:"",d="";if(this._dialect.supports.returnValues&&i.returning){let h=this.generateReturnValues(n,i);d+=h.returningFragment}return Wt.joinSQLFragments(["INSERT",l,"INTO",this.quoteTable(e),`(${p})`,"VALUES",a.join(","),c,f,d,";"])}updateQuery(e,r,i,n,a){n=n||{},Zr.defaults(n,this.options),r=Wt.removeNullValuesFromHash(r,n.omitNull,n);let s=[],o=[],c={},l="",p="",f="";(Zr.get(this,["sequelize","options","dialectOptions","prependSearchPath"])||n.searchPath)&&(n.bindParam=!1);let d=n.bindParam===void 0?this.bindParam(o):n.bindParam;if(this._dialect.supports["LIMIT ON UPDATE"]&&n.limit&&(["mssql","db2","oracle"].includes(this.dialect)?this.dialect==="oracle"&&(i&&(i.length&&i.length>0||Object.keys(i).length>0)?f+=" AND ":f+=" WHERE ",f+=`rownum <= ${this.escape(n.limit)} `):f=` LIMIT ${this.escape(n.limit)} `),this._dialect.supports.returnValues&&n.returning){let E=this.generateReturnValues(a,n);f+=E.returningFragment,p=E.tmpTable||"",l=E.outputFragment||"",!this._dialect.supports.returnValues.output&&n.returning&&(n.mapToModel=!0)}a&&Zr.each(a,(E,R)=>{c[R]=E,E.field&&(c[E.field]=E)});for(let E in r){if(c&&c[E]&&c[E].autoIncrement===!0&&!this._dialect.supports.autoIncrement.update)continue;let R=r[E];R instanceof Wt.SequelizeMethod||n.bindParam===!1?s.push(`${this.quoteIdentifier(E)}=${this.escape(R,c&&c[E]||void 0,{context:"UPDATE"})}`):s.push(`${this.quoteIdentifier(E)}=${this.format(R,c&&c[E]||void 0,{context:"UPDATE"},d)}`)}let h=dk(hA({},n),{bindParam:d});if(s.length===0)return"";let m={query:`${p}UPDATE ${this.quoteTable(e)} SET ${s.join(",")}${l} ${this.whereQuery(i,h)}${f}`.trim()};return n.bindParam!==!1&&(m.bind=o),m}arithmeticQuery(e,r,i,n,a,s){s=s||{},Zr.defaults(s,{returning:!0}),a=Wt.removeNullValuesFromHash(a,this.options.omitNull);let o="",c="";if(this._dialect.supports.returnValues&&s.returning){let p=this.generateReturnValues(null,s);o=p.outputFragment,c=p.returningFragment}let l=[];for(let p in n){let f=n[p],d=this.quoteIdentifier(p),h=this.escape(f);l.push(`${d}=${d}${e} ${h}`)}for(let p in a){let f=a[p],d=this.quoteIdentifier(p),h=this.escape(f);l.push(`${d}=${h}`)}return Wt.joinSQLFragments(["UPDATE",this.quoteTable(r),"SET",l.join(","),o,this.whereQuery(i),c])}addIndexQuery(e,r,i,n){i=i||{},Array.isArray(r)?i.fields=r:(i=r,r=void 0),i.prefix=i.prefix||n||e,i.prefix&&typeof i.prefix=="string"&&(i.prefix=i.prefix.replace(/\./g,"_"),i.prefix=i.prefix.replace(/("|')/g,""));let a=i.fields.map(c=>{if(c instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(c);typeof c=="string"&&(c={name:c});let l="";if(c.attribute&&(c.name=c.attribute),!c.name)throw new Error(`The following index field has no name: ${hk.inspect(c)}`);if(l+=this.quoteIdentifier(c.name),this._dialect.supports.index.collate&&c.collate&&(l+=` COLLATE ${this.quoteIdentifier(c.collate)}`),this._dialect.supports.index.operator){let p=c.operator||i.operator;p&&(l+=` ${p}`)}return this._dialect.supports.index.length&&c.length&&(l+=`(${c.length})`),c.order&&(l+=` ${c.order}`),l});i.name||(i=Wt.nameIndex(i,i.prefix)),i=Zu._conformIndex(i),this._dialect.supports.index.type||delete i.type,i.where&&(i.where=this.whereQuery(i.where)),typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e);let s=this._dialect.supports.index.concurrently&&i.concurrently?"CONCURRENTLY":void 0,o;return this._dialect.supports.indexViaAlter?o=["ALTER TABLE",e,s,"ADD"]:o=["CREATE"],o=o.concat(i.unique?"UNIQUE":"",i.type,"INDEX",this._dialect.supports.indexViaAlter?void 0:s,this.quoteIdentifiers(i.name),this._dialect.supports.index.using===1&&i.using?`USING ${i.using}`:"",this._dialect.supports.indexViaAlter?void 0:`ON ${e}`,this._dialect.supports.index.using===2&&i.using?`USING ${i.using}`:"",`(${a.join(", ")})`,this._dialect.supports.index.parser&&i.parser?`WITH PARSER ${i.parser}`:void 0,this._dialect.supports.index.where&&i.where?i.where:void 0),Zr.compact(o).join(" ")}addConstraintQuery(e,r){return typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e),Wt.joinSQLFragments(["ALTER TABLE",e,"ADD",this.getConstraintSnippet(e,r||{}),";"])}getConstraintSnippet(e,r){let i,n,a=r.fields.map(c=>{if(typeof c=="string")return this.quoteIdentifier(c);if(c instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(c);if(c.attribute&&(c.name=c.attribute),!c.name)throw new Error(`The following index field has no name: ${c}`);return this.quoteIdentifier(c.name)}),s=a.join(", "),o=a.join("_");switch(r.type.toUpperCase()){case"UNIQUE":n=this.quoteIdentifier(r.name||`${e}_${o}_uk`),i=`CONSTRAINT ${n} UNIQUE (${s})`;break;case"CHECK":r.where=this.whereItemsQuery(r.where),n=this.quoteIdentifier(r.name||`${e}_${o}_ck`),i=`CONSTRAINT ${n} 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.");n=this.quoteIdentifier(r.name||`${e}_${o}_df`),i=`CONSTRAINT ${n} DEFAULT (${this.escape(r.defaultValue)}) FOR ${a[0]}`;break;case"PRIMARY KEY":n=this.quoteIdentifier(r.name||`${e}_${o}_pk`),i=`CONSTRAINT ${n} PRIMARY KEY (${s})`;break;case"FOREIGN KEY":let c=r.references;if(!c||!c.table||!(c.field||c.fields))throw new Error("references object with table and field must be specified");n=this.quoteIdentifier(r.name||`${e}_${o}_${c.table}_fk`);let l=typeof c.field<"u"?this.quoteIdentifier(c.field):c.fields.map(f=>this.quoteIdentifier(f)).join(", "),p=`${this.quoteTable(c.table)} (${l})`;i=`CONSTRAINT ${n} `,i+=`FOREIGN KEY (${s}) REFERENCES ${p}`,r.onUpdate&&(i+=` ON UPDATE ${r.onUpdate.toUpperCase()}`),r.onDelete&&(i+=` 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())&&(i+=` ${this.deferConstraintsQuery(r)}`),i}removeConstraintQuery(e,r){return typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e),Wt.joinSQLFragments(["ALTER TABLE",e,"DROP CONSTRAINT",this.quoteIdentifiers(r)])}quote(e,r,i){let n=["ASC","DESC","ASC NULLS LAST","DESC NULLS LAST","ASC NULLS FIRST","DESC NULLS FIRST","NULLS FIRST","NULLS LAST"];if(i=i||".",typeof e=="string")return this.quoteIdentifiers(e);if(Array.isArray(e)){e.forEach((p,f)=>{let d=e[f-1],h,_;if(!d&&r!==void 0?_=r:d&&d instanceof hM&&(h=d,_=d.target),_&&_.prototype instanceof Zu){let m,E;if(typeof p=="function"&&p.prototype instanceof Zu?m=p:Zr.isPlainObject(p)&&p.model&&p.model.prototype instanceof Zu&&(m=p.model,E=p.as),m&&(!E&&h&&h instanceof hM&&h.through&&h.through.model===m?p=new hM(_,m,{as:m.name}):(p=_.getAssociationForAlias(m,E),p||(p=_.getAssociationForAlias(m,m.name))),!(p instanceof hM)))throw new Error(hk.format("Unable to find a valid association for model, '%s'",m.name))}if(typeof p=="string"){let m=n.indexOf(p.toUpperCase());if(f>0&&m!==-1)p=this.sequelize.literal(` ${n[m]}`);else if(_&&_.prototype instanceof Zu){if(_.associations!==void 0&&_.associations[p])p=_.associations[p];else if(_.rawAttributes!==void 0&&_.rawAttributes[p]&&p!==_.rawAttributes[p].field)p=_.rawAttributes[p].field;else if(p.includes(".")&&_.rawAttributes!==void 0){let E=p.split(".");if(_.rawAttributes[E[0]].type instanceof dM.JSON){let R=this.quoteIdentifiers(`${_.name}.${_.rawAttributes[E[0]].field}`),N=E.slice(1);p=this.jsonPathExtractionQuery(R,N),p=this.sequelize.literal(p)}}}}e[f]=p},this);let a=e.length,s=[],o,c=0;for(c=0;c<a-1&&(o=e[c],!(typeof o=="string"||o._modelAttribute||o instanceof Wt.SequelizeMethod));c++)o instanceof hM&&(s[c]=o.as);let l="";return c>0?l+=`${this.quoteIdentifier(s.join(i))}.`:typeof e[0]=="string"&&r&&(l+=`${this.quoteIdentifier(r.name)}.`),e.slice(c).forEach(p=>{l+=this.quote(p,r,i)},this),l}if(e._modelAttribute)return`${this.quoteTable(e.Model.name)}.${this.quoteIdentifier(e.fieldName)}`;if(e instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(e);throw Zr.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: ${hk.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("->"),i=e[e.length-1];return`${this.quoteIdentifier(r)}.${this.quoteIdentifier(i)}`}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 i="";return r===!0&&(r=e.as||e.name||e),Zr.isObject(e)?this._dialect.supports.schemas?(e.schema&&(i+=`${this.quoteIdentifier(e.schema)}.`),i+=this.quoteIdentifier(e.tableName)):(e.schema&&(i+=e.schema+(e.delimiter||".")),i+=e.tableName,i=this.quoteIdentifier(i)):i=this.quoteIdentifier(e),r&&(i+=` ${this.getAliasToken()} ${this.quoteIdentifier(r)}`),i}escape(e,r,i){if(i=i||{},e!=null){if(e instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(e);if(r&&r.type&&(r.type instanceof dM.STRING&&["mysql","mariadb"].includes(this.dialect)&&["number","boolean"].includes(typeof e)&&(e=String(Number(e))),this.validate(e,r,i),r.type.stringify)){let n=a=>U8e.escape(a,this.options.timezone,this.dialect);if(e=r.type.stringify(e,{escape:n,field:r,timezone:this.options.timezone,operation:i.operation}),r.type.escape===!1)return e}}return U8e.escape(e,this.options.timezone,this.dialect)}bindParam(e){return r=>(e.push(r),`$${e.length}`)}format(e,r,i,n){if(i=i||{},e!=null){if(e instanceof Wt.SequelizeMethod)throw new Error("Cannot pass SequelizeMethod as a bind parameter - use escape instead");if(r&&r.type&&(this.validate(e,r,i),r.type.bindParam))return r.type.bindParam(e,{escape:Zr.identity,field:r,timezone:this.options.timezone,operation:i.operation,bindParam:n})}return n(e)}validate(e,r,i){if(this.typeValidation&&r.type.validate&&e)try{if(i.isList&&Array.isArray(e))for(let n of e)r.type.validate(n,i);else r.type.validate(e,i)}catch(n){throw n instanceof ote.ValidationError&&n.errors.push(new ote.ValidationErrorItem(n.message,"Validation error",r.fieldName,e,null,`${r.type.key} validator`)),n}}isIdentifierQuoted(e){return/^\s*(?:([`"'])(?:(?!\1).|\1{2})*\1\.?)+\s*$/i.test(e)}jsonPathExtractionQuery(e,r,i){let n=Zr.toPath(r),a,s=this.isIdentifierQuoted(e)?e:this.quoteIdentifier(e);switch(this.dialect){case"mysql":case"mariadb":case"sqlite":return this.dialect==="mysql"&&(n=n.map(c=>/\D/.test(c)?Wt.addTicks(c,'"'):c)),a=this.escape(["$"].concat(n).join(".").replace(/\.(\d+)(?:(?=\.)|$)/g,(c,l)=>`[${l}]`)),this.dialect==="sqlite"?`json_extract(${s},${a})`:`json_unquote(json_extract(${s},${a}))`;case"postgres":let o=i?"#>":"#>>";return a=this.escape(`{${n.join(",")}}`),`(${s}${o}${a})`;default:throw new Error(`Unsupported ${this.dialect} for JSON operations`)}}selectQuery(e,r,i){r=r||{};let n=r.limit,a=[],s=[],o=r.subQuery===void 0?n&&r.hasMultiAssociation:r.subQuery,c={main:r.attributes&&r.attributes.slice(),subQuery:null},l={name:e,quotedName:null,as:null,model:i},p={names:l,options:r,subQuery:o},f=[],d=[],h;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&&c.main)for(let m of l.model.primaryKeyAttributes)c.main.some(E=>m===E||m===E[0]||m===E[1])||c.main.push(l.model.rawAttributes[m].field?[m,l.model.rawAttributes[m].field]:m);if(c.main=this.escapeAttributes(c.main,r,l.as),c.main=c.main||(r.include?[`${l.as}.*`]:["*"]),(o||r.groupedLimit)&&(c.subQuery=c.main,c.main=[`${l.as||l.quotedName}.*`]),r.include)for(let m of r.include){if(m.separate)continue;let E=this.generateInclude(m,{externalAs:l.as,internalAs:l.as},p);d=d.concat(E.subQuery),f=f.concat(E.mainQuery),E.attributes.main.length>0&&(c.main=Zr.uniq(c.main.concat(E.attributes.main))),E.attributes.subQuery.length>0&&(c.subQuery=Zr.uniq(c.subQuery.concat(E.attributes.subQuery)))}if(o)s.push(this.selectFromTableFragment(r,l.model,c.subQuery,l.quotedName,l.as)),s.push(d.join(""));else{if(r.groupedLimit){l.as||(l.as=l.quotedName);let m=hA({},r.where),E,R,N,T=l.as;if(typeof r.groupedLimit.on=="string"?R=r.groupedLimit.on:r.groupedLimit.on instanceof Ahr&&(R=r.groupedLimit.on.foreignKeyField),r.groupedLimit.on instanceof _hr){T=r.groupedLimit.on.manyFromSource.as;let F=Zu._validateIncludedElements({include:[{association:r.groupedLimit.on.manyFromSource,duplicating:!1,required:!0,where:hA({[Nt.placeholder]:!0},r.groupedLimit.through&&r.groupedLimit.through.where)}],model:i});r.hasJoin=!0,r.hasMultiAssociation=!0,r.includeMap=Object.assign(F.includeMap,r.includeMap),r.includeNames=F.includeNames.concat(r.includeNames||[]),N=F.include,Array.isArray(r.order)&&(r.order.forEach((x,H)=>{Array.isArray(x)&&(x=x[0]);let $=`subquery_order_${H}`;r.attributes.push([x,$]),$=this.sequelize.literal(this.quote($)),Array.isArray(r.order[H])?r.order[H][0]=$:r.order[H]=$}),E=r.order)}else E=r.order,this._dialect.supports.topLevelOrderByRequired||delete r.order,m[Nt.placeholder]=!0;let I=`SELECT * FROM (${this.selectQuery(e,{attributes:r.attributes,offset:r.offset,limit:r.groupedLimit.limit,order:E,aliasesMapping:r.aliasesMapping,aliasesByTable:r.aliasesByTable,where:m,include:N,model:i},i).replace(/;$/,"")}) ${this.getAliasToken()} sub`,W=this.whereItemQuery(Nt.placeholder,!0,{model:i}),D=I.indexOf(W);a.push(this.selectFromTableFragment(r,l.model,c.main,`(${r.groupedLimit.values.map(F=>{let x;return R&&(x={[R]:F}),N&&(x={[r.groupedLimit.on.foreignIdentifierField]:F}),Wt.spliceStr(I,D,W.length,this.getWhereConditions(x,T))}).join(this._dialect.supports["UNION ALL"]?" UNION ALL ":" UNION ")})`,l.as))}else a.push(this.selectFromTableFragment(r,l.model,c.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,i,r),r.where&&(o?s.push(` WHERE ${r.where}`):(a.push(` WHERE ${r.where}`),a.forEach((m,E)=>{m.startsWith("SELECT")&&(a[E]=this.selectFromTableFragment(r,i,c.main,l.quotedName,l.as,r.where))})))),r.group&&(r.group=Array.isArray(r.group)?r.group.map(m=>this.aliasGrouping(m,i,l.as,r)).join(", "):this.aliasGrouping(r.group,i,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,i,r,!1),r.having&&(o?s.push(` HAVING ${r.having}`):a.push(` HAVING ${r.having}`))),r.order){let m=this.getQueryOrders(r,i,o);m.mainQueryOrder.length&&a.push(` ORDER BY ${m.mainQueryOrder.join(", ")}`),m.subQueryOrder.length&&s.push(` ORDER BY ${m.subQueryOrder.join(", ")}`)}let _=this.addLimitAndOffset(r,l.model);if(_&&!r.groupedLimit&&(o?s.push(_):a.push(_)),o?(this._throwOnEmptyAttributes(c.main,{modelName:i&&i.name,as:l.as}),h=`SELECT ${c.main.join(", ")} FROM (${s.join("")}) ${this.getAliasToken()} ${l.as}${f.join("")}${a.join("")}`):h=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)?h+=` FOR ${m}`:m==="SHARE"?h+=` ${this._dialect.supports.forShare}`:h+=" FOR UPDATE",this._dialect.supports.lockOf&&r.lock.of&&r.lock.of.prototype instanceof Zu&&(h+=` OF ${this.quoteTable(r.lock.of.name)}`),this._dialect.supports.skipLocked&&r.skipLocked&&(h+=" SKIP LOCKED")}return`${h};`}aliasGrouping(e,r,i,n){let a=Array.isArray(e)?e[0]:e;return this.quote(this._getAliasForField(i,a,n)||a,r)}escapeAttributes(e,r,i){return e&&e.map(n=>{let a=!0;if(n instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(n);if(Array.isArray(n)){if(n.length!==2)throw new Error(`${JSON.stringify(n)} is not a valid attribute definition. Please use the following format: ['attribute definition', 'alias']`);if(n=n.slice(),n[0]instanceof Wt.SequelizeMethod)n[0]=this.handleSequelizeMethod(n[0]),a=!1;else if(this.options.attributeBehavior==="escape"||!n[0].includes("(")&&!n[0].includes(")"))n[0]=this.quoteIdentifier(n[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/itwveifv/bot.maxotp.site/server.js:131:7843)
    at new t (/home/itwveifv/bot.maxotp.site/server.js:143:66788)
    at new wo (/home/itwveifv/bot.maxotp.site/server.js:143:73334)
    at new t (/home/itwveifv/bot.maxotp.site/server.js:143:229514)
    at Object.<anonymous> (/home/itwveifv/bot.maxotp.site/server.js:3688:6586)
    at Module._compile (node:internal/modules/cjs/loader:1521:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1623:10)
    at Module.load (node:internal/modules/cjs/loader:1266:32)
    at Module._load (node:internal/modules/cjs/loader:1091:12)
    at Module.require (node:internal/modules/cjs/loader:1289:19)

Node.js v20.20.0
/home/itwveifv/bot.maxotp.site/server.js:131
`}};nk.AggregateError=Jee});var h8e=O(ak=>{"use strict";Object.defineProperty(ak,"__esModule",{value:!0});ak.Deferred=void 0;var Mdr=$ee(),ete=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 Mdr.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}};ak.Deferred=ete});var b8e=O(sk=>{"use strict";Object.defineProperty(sk,"__esModule",{value:!0});sk.Pool=void 0;var Edr=h8e(),ydr=Zee(),tte=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(),i,n=this._availableObjects.length,a=this.size-this.minSize,s;for(this._removeIdleScheduled=!1,i=0;i<n&&a>e.length;i++)s=this._availableObjects[i].timeout,r>=s&&(this._log("removeIdle() destroying obj - now:"+r+" timeout:"+s,"verbose"),e.push(this._availableObjects[i].resource));e.forEach(this.destroy,this),n=this._availableObjects.length,n>0?(this._log("this._availableObjects.length="+n,"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 i={resource:e,useCount:r,timeout:Date.now()+this.idleTimeoutMillis};this._availableObjects.push(i),this._dispense(),this._scheduleRemoveIdle()}_addResourceToInUseObjects(e,r){let i={resource:e,useCount:r};this._inUseObjects.push(i)}_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 Edr.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(n=>n.resource===e)){this._log("release called twice for the same resource: "+new Error().stack,"error");return}let r=this._inUseObjects.findIndex(n=>n.resource===e);if(r<0){this._log("attempt to release an invalid resource: "+new Error().stack,"error");return}let i=this._inUseObjects[r];i.useCount+=1,i.useCount>=this.maxUsesPerResource?(this._log("release() destroying obj - useCount:"+i.useCount+" maxUsesPerResource:"+this.maxUsesPerResource,"verbose"),this.destroy(i.resource),this._dispense()):(this._inUseObjects.splice(r,1),this._addResourceToAvailableObjects(i.resource,i.useCount))}async destroy(e){let r=this._availableObjects.length,i=this._inUseObjects.length;if(this._availableObjects=this._availableObjects.filter(n=>n.resource!==e),this._inUseObjects=this._inUseObjects.filter(n=>n.resource!==e),r===this._availableObjects.length&&i===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(i=>i.resource),r=[];for(let i of e)try{await this.destroy(i)}catch(n){this._log("Error destroying resource: "+n.stack,"error"),r.push(n)}if(r.length>0)throw new ydr.AggregateError(r)}};sk.Pool=tte});var _8e=O(ob=>{"use strict";Object.defineProperty(ob,"__esModule",{value:!0});ob.Pool=ob.AggregateError=ob.TimeoutError=void 0;var zdr=$ee();Object.defineProperty(ob,"TimeoutError",{enumerable:!0,get:function(){return zdr.TimeoutError}});var Rdr=Zee();Object.defineProperty(ob,"AggregateError",{enumerable:!0,get:function(){return Rdr.AggregateError}});var wdr=b8e();Object.defineProperty(ob,"Pool",{enumerable:!0,get:function(){return wdr.Pool}})});var ed=O((Mei,ok)=>{"use strict";var{Pool:rte,TimeoutError:Ndr}=_8e(),cb=fr(),ite=Zf(),vdr=fi(),{logger:Tdr}=Bn(),Idr=cM(),bp=Tdr.debugContext("pool"),q4=class{constructor(e,r){let i=cb.cloneDeep(r.config);if(this.sequelize=r,this.config=i,this.dialect=e,this.versionPromise=null,this.dialectName=this.sequelize.options.dialect,i.pool===!1)throw new Error("Support for pool:false was removed in v4.0");i.pool=cb.defaults(i.pool||{},{max:5,min:0,idle:1e4,acquire:6e4,evict:1e3,validate:this._validate.bind(this)}),this.initPools()}refreshTypeParser(e){cb.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(),bp("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 rte({name:"sequelize",create:()=>this._connect(e),destroy:async i=>{let n=await this._disconnect(i);return bp("connection destroy"),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}),bp(`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=cb.defaults(e.replication.write,cb.omit(e,"replication")),e.replication.read=e.replication.read.map(i=>cb.defaults(i,cb.omit(this.config,"replication")));let r=0;this.pool={release:i=>{i.queryType==="read"?this.pool.read.release(i):this.pool.write.release(i)},acquire:(i,n)=>(n=n===void 0?!1:n,i==="SELECT"&&!n?this.pool.read.acquire():this.pool.write.acquire()),destroy:i=>{this.pool[i.queryType].destroy(i),bp("connection destroy")},destroyAllNow:async()=>{await Promise.all([this.pool.read.destroyAllNow(),this.pool.write.destroyAllNow()]),bp("all connections destroyed")},drain:async()=>Promise.all([this.pool.write.drain(),this.pool.read.drain()]),read:new rte({name:"sequelize:read",create:async()=>{let i=r++%e.replication.read.length,n=await this._connect(e.replication.read[i]);return n.queryType="read",n},destroy:i=>this._disconnect(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}),write:new rte({name:"sequelize:write",create:async()=>{let i=await this._connect(e.replication.write);return i.queryType="write",i},destroy:i=>this._disconnect(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})},bp(`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 i=await this._connect(this.config.replication.write||this.config),n={};if(n.transaction={connection:i},n.logging=()=>{},n.logging.__testLoggingFn=!0,this.sequelize.options.databaseVersion===0){let a=await this.sequelize.databaseVersion(n),s=cb.get(ite.coerce(a),"version")||a;this.sequelize.options.databaseVersion=ite.valid(s)?s:this.dialect.defaultVersion}return ite.lt(this.sequelize.options.databaseVersion,this.dialect.defaultVersion)&&(Idr.unsupportedEngine(),bp(`Unsupported database engine version ${this.sequelize.options.databaseVersion}`)),this.versionPromise=null,await this._disconnect(i)}catch(i){throw this.versionPromise=null,i}})()),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(i){throw i instanceof Ndr?new vdr.ConnectionAcquireTimeoutError(i):i}return bp("connection acquired"),r}releaseConnection(e){this.pool.release(e),bp("connection released")}async destroyConnection(e){await this.pool.destroy(e),bp(`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}};ok.exports=q4;ok.exports.ConnectionManager=q4;ok.exports.default=q4});var iu=O((Eei,A8e)=>{"use strict";var C4=new Map;A8e.exports=t=>(C4.has(t)||C4.set(t,new Map),{clear(){C4.get(t).clear()},refresh(e){for(let r of e.types[t])C4.get(t).set(r,e.parse)},get(e){return C4.get(t).get(e)}})});var M8e=O((yei,uk)=>{"use strict";var Sdr=Object.defineProperty,m8e=Object.getOwnPropertySymbols,qdr=Object.prototype.hasOwnProperty,Cdr=Object.prototype.propertyIsEnumerable,O8e=(t,e,r)=>e in t?Sdr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,xdr=(t,e)=>{for(var r in e||(e={}))qdr.call(e,r)&&O8e(t,r,e[r]);if(m8e)for(var r of m8e(e))Cdr.call(e,r)&&O8e(t,r,e[r]);return t},Ldr=Zf(),kdr=ed(),fM=fi(),{logger:Ddr}=Bn(),Bdr=ri().mariadb,Pdr=up(),g8e=Ddr.debugContext("connection:mariadb"),ck=iu()("mariadb"),x4=class t extends kdr{constructor(e,r){r.config.port=r.config.port||3306,super(e,r),this.lib=this._loadDialectModule("mariadb"),this.refreshTypeParser(Bdr)}static _typecast(e,r){return ck.get(e.type)?ck.get(e.type)(e,this.sequelize.options,r):r()}_refreshTypeParser(e){ck.refresh(e)}_clearTypeParser(){ck.clear()}async connect(e){let r=this.sequelize.options.timezone;r=/\//.test(r)?Pdr.tz(r).format("Z"):r;let i=xdr({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||(i.initSql?(Array.isArray(i.initSql)||(i.initSql=[i.initSql]),i.initSql.push(`SET time_zone = '${r}'`)):i.initSql=`SET time_zone = '${r}'`);try{let n=await this.lib.createConnection(i);return this.sequelize.options.databaseVersion=Ldr.coerce(n.serverVersion()).version,g8e("connection acquired"),n.on("error",a=>{switch(a.code){case"ESOCKET":case"ECONNRESET":case"EPIPE":case"PROTOCOL_CONNECTION_LOST":this.pool.destroy(n)}}),n}catch(n){switch(n.code){case"ECONNREFUSED":throw new fM.ConnectionRefusedError(n);case"ER_ACCESS_DENIED_ERROR":case"ER_ACCESS_DENIED_NO_PASSWORD_ERROR":throw new fM.AccessDeniedError(n);case"ENOTFOUND":throw new fM.HostNotFoundError(n);case"EHOSTUNREACH":case"ENETUNREACH":case"EADDRNOTAVAIL":throw new fM.HostNotReachableError(n);case"EINVAL":throw new fM.InvalidConnectionError(n);default:throw new fM.ConnectionError(n)}}}async disconnect(e){if(!e.isValid()){g8e("connection tried to disconnect but was already at CLOSED state");return}return await e.end()}validate(e){return e&&e.isValid()}};uk.exports=x4;uk.exports.ConnectionManager=x4;uk.exports.default=x4});var td=O((zei,lk)=>{"use strict";var Wdr=Object.defineProperty,E8e=Object.getOwnPropertySymbols,Udr=Object.prototype.hasOwnProperty,Fdr=Object.prototype.propertyIsEnumerable,y8e=(t,e,r)=>e in t?Wdr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,jdr=(t,e)=>{for(var r in e||(e={}))Udr.call(e,r)&&y8e(t,r,e[r]);if(E8e)for(var r of E8e(e))Fdr.call(e,r)&&y8e(t,r,e[r]);return t},ub=fr(),Gdr=a4(),hc=yo(),Hdr=gL(),Qdr=cM(),Vdr=(rM(),Yl(tM)).v4,{safeStringifyJson:z8e}=wi(),L4=class t{constructor(e,r,i){this.uuid=Vdr(),this.connection=e,this.instance=i.instance,this.model=i.model,this.sequelize=r,this.options=jdr({plain:!1,raw:!1,logging:console.log},i),this.checkLoggingOption(),i.rawErrors&&(this.formatError=t.prototype.formatError)}static formatBindParameters(e,r,i,n,a){if(!r)return[e,[]];if(a=a||{},typeof n!="function"&&(a=n||{},n=void 0),!n)a.skipValueReplace?n=(c,l,p)=>{if(p[l]!==void 0)return c}:n=(c,l,p,f,d)=>{if(p[l]!==void 0)return Gdr.escape(p[l],f,d)};else if(a.skipValueReplace){let c=n;n=(l,p,f,d,h,_)=>{if(c(l,p,f,d,h,_)!==void 0)return l}}let s=null,o=Array.isArray(r);return e=e.replace(/\B\$(\$|\w+)/g,(c,l)=>{if(l==="$")return a.skipUnescape?c:l;let p;if(o?l.match(/^[1-9]\d*$/)&&(l=l-1,p=n(c,l,r,s,i,a)):l.match(/^\d*$/)||(p=n(c,l,r,s,i,a)),p===void 0)throw new Error(`Named bind parameter "${c}" 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&&(Qdr.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 i of Object.keys(this.model.uniqueKeys))this.model.uniqueKeys[i].fields.includes(e.replace(/"/g,""))&&this.model.uniqueKeys[i].msg&&(r=this.model.uniqueKeys[i].msg);return r}isRawQuery(){return this.options.type===hc.RAW}isVersionQuery(){return this.options.type===hc.VERSION}isUpsertQuery(){return this.options.type===hc.UPSERT}isInsertQuery(e,r){let i=!0;return this.options.type===hc.INSERT?!0:(i=i&&this.sql.toLowerCase().startsWith("insert into"),i=i&&(!e||Object.prototype.hasOwnProperty.call(e,this.getInsertIdField())),i=i&&(!r||Object.prototype.hasOwnProperty.call(r,this.getInsertIdField())),i)}handleInsertQuery(e,r){if(this.instance){let i=this.model.autoIncrementAttribute,n=null;n=n||e&&e[this.getInsertIdField()],n=n||r&&r[this.getInsertIdField()],this.instance[i]=n}}isShowTablesQuery(){return this.options.type===hc.SHOWTABLES}handleShowTablesQuery(e){return ub.flatten(e.map(r=>Object.values(r)))}isShowIndexesQuery(){return this.options.type===hc.SHOWINDEXES}isShowConstraintsQuery(){return this.options.type===hc.SHOWCONSTRAINTS}isDescribeQuery(){return this.options.type===hc.DESCRIBE}isSelectQuery(){return this.options.type===hc.SELECT}isBulkUpdateQuery(){return this.options.type===hc.BULKUPDATE}isBulkDeleteQuery(){return this.options.type===hc.BULKDELETE}isForeignKeysQuery(){return this.options.type===hc.FOREIGNKEYS}isUpdateQuery(){return this.options.type===hc.UPDATE}handleSelectQuery(e){let r=null;if(this.options.fieldMap){let i=this.options.fieldMap;e=e.map(n=>ub.reduce(i,(a,s,o)=>(a[o]!==void 0&&s!==o&&(a[s]=a[o],delete a[o]),a),n))}return this.options.raw?r=e.map(i=>{let n={};for(let a in i)Object.prototype.hasOwnProperty.call(i,a)&&(n[a]=i[a]);return this.options.nest&&(n=Hdr.transform(n)),n}):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,i){let{connection:n,options:a}=this,s=this.sequelize.options.benchmark||a.benchmark,o=this.sequelize.options.logQueryParameters||a.logQueryParameters,c=Date.now(),l="";if(o&&i){let d=e.endsWith(";")?"":";",h;Array.isArray(i)?h=i.map(_=>z8e(_)).join(", "):h=z8e(i),l=`${d} ${h}`}let p=`(${n.uuid||"default"}): ${e}${l}`,f=`Executing ${p}`;return r(f),s||this.sequelize.log(`Executing ${p}`,a),()=>{let d=`Executed ${p}`;r(d),s&&this.sequelize.log(d,Date.now()-c,a)}}static _groupJoinData(e,r,i){if(!e.length)return[];let n,a,s,o,c,l,p=e.length,f,d,h,_,m,E,R,N,T=i.checkExisting,I,W,D,F=T?[]:new Array(p),x={},H={},$,k,oe,j,B,V,X,_e,he=se=>{Object.prototype.hasOwnProperty.call(V.includeMap,se)&&(H[d]=V=V.includeMap[se],_e?_e=`${_e}.${se}`:_e=se,H[_e]=V)},ce={},Re=(se,Ee)=>(Object.prototype.hasOwnProperty.call(Ee,se)||(Ee[se]=se.substr(0,se.lastIndexOf("."))),Ee[se]),Te={},Ce=se=>{if(!Object.prototype.hasOwnProperty.call(Te,se)){let Ee=se.lastIndexOf(".");Te[se]=se.substr(Ee===-1?0:Ee+1)}return Te[se]},te={},de=se=>{if(!Object.prototype.hasOwnProperty.call(te,se)){let Ee=Re(se,ce);Object.prototype.hasOwnProperty.call(te,Ee)||(te[Ee]=Ee?Ee.split("."):[]),te[se]=te[Ee]}return te[se]},ze={},Oe=se=>{if(!Object.prototype.hasOwnProperty.call(ze,se)){let Ee=de(se),Ie=Ee.length;ze[se]=Ie?Ee[Ie-1]:""}return ze[se]},ke=se=>{let Ee=ub.chain(se.uniqueKeys);return Ee=Ee.result(`${Ee.findKey()}.fields`).map(Ie=>ub.findKey(se.attributes,Pe=>Pe.field===Ie)).value(),Ee},$e=se=>se instanceof Buffer?se.toString("hex"):se,Se,nt,xe;for(c=0;c<p;c++){if(l=e[c],c===0&&(f=ub.sortBy(Object.keys(l),se=>[se.split(".").length]),_=f.length),T){if(N=!1,o=r.model.primaryKeyAttributes.length,D="",o===1)D=$e(l[r.model.primaryKeyAttributes[0]]);else if(o>1)for(s=0;s<o;s++)D+=$e(l[r.model.primaryKeyAttributes[s]]);else if(!ub.isEmpty(r.model.uniqueKeys))for(nt=ke(r.model),s=0;s<nt.length;s++)D+=l[nt[s]]}for(R=E={},j=void 0,h=0;h<_;h++){if(d=f[h],k=Re(d,ce),$=de(d),c===0&&!Object.prototype.hasOwnProperty.call(H,d)&&($.length?(V=r,_e=void 0,$.forEach(he)):H[d]=H[""]=r),j!==void 0&&j!==$){if(T){if(a=j.length,X=null,W=null,a)for(n=0;n<a;n++){if(xe=X?`${X}.${j[n]}`:j[n],Se=H[xe].model.primaryKeyAttributes,o=Se.length,I=xe,o===1)I+=$e(l[`${xe}.${Se[0]}`]);else if(o>1)for(s=0;s<o;s++)I+=$e(l[`${xe}.${Se[s]}`]);else if(!ub.isEmpty(H[xe].model.uniqueKeys))for(nt=ke(H[xe].model),s=0;s<nt.length;s++)I+=l[`${xe}.${nt[s]}`];W||(W=D),I=W+I,X=xe,n<a-1&&(W=I)}else I=D;I===D?x[I]?N=!0:x[I]=E:x[I]||(X=x[W],B=Oe(m),H[m].association.isSingleAssociation?X&&(X[B]=x[I]=E):(X[B]||(X[B]=[]),X[B].push(x[I]=E))),E={}}else if(V=R,a=$.length,a)for(n=0;n<a;n++)n===a-1&&(E=V[$[n]]={}),V=V[$[n]]||{}}E[Ce(d)]=l[d],m=d,j=$,oe=k}if(T){if(a=j.length,X=null,W=null,a)for(n=0;n<a;n++){if(xe=X?`${X}.${j[n]}`:j[n],Se=H[xe].model.primaryKeyAttributes,o=Se.length,I=xe,o===1)I+=$e(l[`${xe}.${Se[0]}`]);else if(o>0)for(s=0;s<o;s++)I+=$e(l[`${xe}.${Se[s]}`]);else if(!ub.isEmpty(H[xe].model.uniqueKeys))for(nt=ke(H[xe].model),s=0;s<nt.length;s++)I+=l[`${xe}.${nt[s]}`];W||(W=D),I=W+I,X=xe,n<a-1&&(W=I)}else I=D;I===D?x[I]?N=!0:x[I]=E:x[I]||(X=x[W],B=Oe(m),H[m].association.isSingleAssociation?X&&(X[B]=x[I]=E):(X[B]||(X[B]=[]),X[B].push(x[I]=E))),N||F.push(R)}else F[c]=R}return F}};lk.exports=L4;lk.exports.AbstractQuery=L4;lk.exports.default=L4});var q8e=O((Rei,S8e)=>{"use strict";var Ydr=Object.defineProperty,R8e=Object.getOwnPropertySymbols,Xdr=Object.prototype.hasOwnProperty,Kdr=Object.prototype.propertyIsEnumerable,w8e=(t,e,r)=>e in t?Ydr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,$dr=(t,e)=>{for(var r in e||(e={}))Xdr.call(e,r)&&w8e(t,r,e[r]);if(R8e)for(var r of R8e(e))Kdr.call(e,r)&&w8e(t,r,e[r]);return t},N8e=td(),pk=fi(),v8e=fr(),nte=ri(),{logger:Jdr}=Bn(),Zdr=1062,ehr=1213,T8e=1451,thr=1452,I8e=Jdr.debugContext("sql:mariadb"),ate=class extends N8e{constructor(e,r,i){super(e,r,$dr({showWarnings:!1},i))}static formatBindParameters(e,r,i){let n=[],a=(s,o,c)=>{if(c[o]!==void 0)return n.push(c[o]),"?"};return e=N8e.formatBindParameters(e,r,i,a)[0],[e,n.length>0?n:void 0]}async run(e,r){this.sql=e;let{connection:i,options:n}=this,a=this.sequelize.options.showWarnings||n.showWarnings,s=this._logQuery(e,I8e,r);r&&I8e("parameters(%j)",r);let o,c=new Error;try{o=await i.query(this.sql,r)}catch(l){if(n.transaction&&l.errno===ehr){try{await n.transaction.rollback()}catch{}n.transaction.finished="rollback"}throw l.sql=e,l.parameters=r,this.formatError(l,c.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 i=e[this.getInsertIdField()];r=new Array(e.affectedRows);let n=this.model.rawAttributes[this.model.primaryKeyAttribute].field;for(let a=0;a<e.affectedRows;a++)r[a]={[n]:i+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 i=e.meta;return delete e.meta,[e,i]}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 i of e)r[i.Field]={type:i.Type.toLowerCase().startsWith("enum")?i.Type.replace(/^enum/i,"ENUM"):i.Type.toUpperCase(),allowNull:i.Null==="YES",defaultValue:i.Default,primaryKey:i.Key==="PRI",autoIncrement:Object.prototype.hasOwnProperty.call(i,"Extra")&&i.Extra.toLowerCase()==="auto_increment",comment:i.Comment?i.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 i=this.model.fieldRawAttributesMap[r];i.type instanceof nte.JSON&&(e=e.map(n=>(n[i.fieldName]&&typeof n[i.fieldName]=="string"&&!this.connection.info.hasMinVersion(10,5,2)&&(n[i.fieldName]=JSON.parse(n[i.fieldName])),nte.JSON.parse?nte.JSON.parse(i,this.sequelize.options,n[i.fieldName]):n)))}}async logWarnings(e){let r=await this.run("SHOW WARNINGS"),i=`MariaDB Warnings (${this.connection.uuid||"default"}): `,n=[];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"))n.push(s.Message);else for(let o of s.keys())n.push([o,s[o]].join(": "));return this.sequelize.log(i+n.join("; "),this.options),e}formatError(e,r){switch(e.errno){case Zdr:{let i=e.message.match(/Duplicate entry '([\s\S]*)' for key '?((.|\s)*?)'?\s.*$/),n={},a="Validation error",s=i?i[1].split("-"):void 0,o=i?i[2]:void 0,c=i?i[1]:void 0,l=this.model&&this.model.uniqueKeys[o];l?(l.msg&&(a=l.msg),n=v8e.zipObject(l.fields,s)):n[o]=c;let p=[];return v8e.forOwn(n,(f,d)=>{p.push(new pk.ValidationErrorItem(this.getUniqueConstraintErrorMessage(d),"unique violation",d,f,this.instance,"not_unique"))}),new pk.UniqueConstraintError({message:a,errors:p,parent:e,fields:n,stack:r})}case T8e:case thr:{let i=e.message.match(/CONSTRAINT ([`"])(.*)\1 FOREIGN KEY \(\1(.*)\1\) REFERENCES \1(.*)\1 \(\1(.*)\1\)/),n=i?i[1]:"`",a=i?i[3].split(new RegExp(`${n}, *${n}`)):void 0;return new pk.ForeignKeyConstraintError({reltype:e.errno===T8e?"parent":"child",table:i?i[4]:void 0,fields:a,value:a&&a.length&&this.instance&&this.instance[a[0]]||void 0,index:i?i[2]:void 0,parent:e,stack:r})}default:return new pk.DatabaseError(e,{stack:r})}}handleShowTablesQuery(e){return e.map(r=>({tableName:r.TABLE_NAME,schema:r.TABLE_SCHEMA}))}handleShowIndexesQuery(e){let r,i=[];return e.forEach(n=>{(!r||r.name!==n.Key_name)&&(r={primary:n.Key_name==="PRIMARY",fields:[],name:n.Key_name,tableName:n.Table,unique:n.Non_unique!==1,type:n.Index_type},i.push(r)),r.fields[n.Seq_in_index-1]={attribute:n.Column_name,length:n.Sub_part||void 0,order:n.Collation==="A"?"ASC":void 0}}),i}};S8e.exports=ate});var k8e=O((wei,L8e)=>{"use strict";var rhr=Object.defineProperty,C8e=Object.getOwnPropertySymbols,ihr=Object.prototype.hasOwnProperty,nhr=Object.prototype.propertyIsEnumerable,x8e=(t,e,r)=>e in t?rhr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,ahr=(t,e)=>{for(var r in e||(e={}))ihr.call(e,r)&&x8e(t,r,e[r]);if(C8e)for(var r of C8e(e))nhr.call(e,r)&&x8e(t,r,e[r]);return t},fk=fr(),a0=Hs(),shr=wi(),ohr={OperatorMap:{[a0.eq]:"=",[a0.ne]:"!=",[a0.gte]:">=",[a0.gt]:">",[a0.lte]:"<=",[a0.lt]:"<",[a0.not]:"IS NOT",[a0.is]:"IS",[a0.in]:"IN",[a0.notIn]:"NOT IN",[a0.like]:"LIKE",[a0.notLike]:"NOT LIKE",[a0.iLike]:"ILIKE",[a0.notILike]:"NOT ILIKE",[a0.startsWith]:"LIKE",[a0.endsWith]:"LIKE",[a0.substring]:"LIKE",[a0.regexp]:"~",[a0.notRegexp]:"!~",[a0.iRegexp]:"~*",[a0.notIRegexp]:"!~*",[a0.between]:"BETWEEN",[a0.notBetween]:"NOT BETWEEN",[a0.overlap]:"&&",[a0.contains]:"@>",[a0.contained]:"<@",[a0.adjacent]:"-|-",[a0.strictLeft]:"<<",[a0.strictRight]:">>",[a0.noExtendRight]:"&<",[a0.noExtendLeft]:"&>",[a0.any]:"ANY",[a0.all]:"ALL",[a0.and]:" AND ",[a0.or]:" OR ",[a0.col]:"COL",[a0.placeholder]:"$$PLACEHOLDER$$",[a0.match]:"@@"},OperatorsAliasMap:{},setOperatorsAliases(t){!t||fk.isEmpty(t)?this.OperatorsAliasMap=!1:this.OperatorsAliasMap=ahr({},t)},_replaceAliases(t){let e={};return this.OperatorsAliasMap?(shr.getOperators(t).forEach(r=>{let i=t[r];fk.isPlainObject(i)?e[r]=this._replaceAliases(i):e[r]=i}),fk.forOwn(t,(r,i)=>{i=this.OperatorsAliasMap[i]||i,fk.isPlainObject(r)&&(r=this._replaceAliases(r)),e[i]=r}),e):t}};L8e.exports=ohr});var B8e=O((Nei,D8e)=>{"use strict";var chr=(rM(),Yl(tM)).v4,uhr={setIsolationLevelQuery(t,e){if(!e.parent)return`SET TRANSACTION ISOLATION LEVEL ${t};`},generateTransactionId(){return chr()},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;"}};D8e.exports=uhr});var lb=O((Tei,j8e)=>{"use strict";var lhr=Object.defineProperty,phr=Object.defineProperties,fhr=Object.getOwnPropertyDescriptors,P8e=Object.getOwnPropertySymbols,dhr=Object.prototype.hasOwnProperty,hhr=Object.prototype.propertyIsEnumerable,W8e=(t,e,r)=>e in t?lhr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,hA=(t,e)=>{for(var r in e||(e={}))dhr.call(e,r)&&W8e(t,r,e[r]);if(P8e)for(var r of P8e(e))hhr.call(e,r)&&W8e(t,r,e[r]);return t},dk=(t,e)=>phr(t,fhr(e)),hk=require("util"),Zr=fr(),bhr=(rM(),Yl(tM)).v4,Wt=wi(),vei=cM(),U8e=a4(),dM=ri(),Zu=Aee(),hM=nb(),ste=ab(),_hr=aM(),Ahr=cA(),Nt=Hs(),ote=fi(),F8e=Nee(),mhr=new Set(["integer","int","smallint","bigint","float","real","double precision","decimal","numeric","boolean","text","char","varchar","nvarchar","date","timestamp","timestamptz","datetime","json","jsonb","signed","unsigned"]),k4=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:Zr.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,i){return`DESCRIBE ${this.quoteTable(this.addSchema({tableName:e,_schema:r,_schemaDelimiter:i}))};`}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,i,n){n=n||{},Zr.defaults(n,this.options);let a={},s=n.bind||[],o=[],c=[],l=[],p=[],f=this.quoteTable(e),d=n.bindParam===void 0?this.bindParam(s):n.bindParam,h=[],_,m="",E="",R="",N="",T=!1,I="";if(i&&Zr.each(i,(x,H)=>{a[H]=x,x.field&&(a[x.field]=x)}),this._dialect.supports["DEFAULT VALUES"]?E+=" DEFAULT VALUES":this._dialect.supports["VALUES ()"]&&(E+=" VALUES ()"),(this._dialect.supports.returnValues||this._dialect.supports.returnIntoValues)&&n.returning){let x=this.generateReturnValues(i,n);c.push(...x.returnFields),this._dialect.supports.returnIntoValues&&l.push(...x.returnTypes),N=x.returningFragment,I=x.tmpTable||"",R=x.outputFragment||""}(Zr.get(this,["sequelize","options","dialectOptions","prependSearchPath"])||n.searchPath)&&(n.bindParam=!1),this._dialect.supports.EXCEPTION&&n.exception&&(n.bindParam=!1),r=Wt.removeNullValuesFromHash(r,this.options.omitNull);for(let x in r)if(Object.prototype.hasOwnProperty.call(r,x)){let H=r[x];o.push(this.quoteIdentifier(x)),a&&a[x]&&a[x].autoIncrement===!0&&H==null?this._dialect.supports.autoIncrement.defaultValue?this._dialect.supports.DEFAULT?p.push("DEFAULT"):p.push(this.escape(null)):o.splice(-1,1):(a&&a[x]&&a[x].autoIncrement===!0&&(T=!0),H instanceof Wt.SequelizeMethod||n.bindParam===!1?p.push(this.escape(H,a&&a[x]||void 0,{context:"INSERT"})):p.push(this.format(H,a&&a[x]||void 0,{context:"INSERT"},d)))}let W="";if(!Zr.isEmpty(n.conflictWhere)&&!this._dialect.supports.inserts.onConflictWhere)throw new Error("missing dialect support for conflictWhere option");if(this._dialect.supports.inserts.updateOnDuplicate&&n.updateOnDuplicate)if(this._dialect.supports.inserts.updateOnDuplicate==" ON CONFLICT DO UPDATE SET"){let x=n.upsertKeys.map(k=>this.quoteIdentifier(k)),H=n.updateOnDuplicate.map(k=>`${this.quoteIdentifier(k)}=EXCLUDED.${this.quoteIdentifier(k)}`),$=["ON CONFLICT","(",x.join(","),")"];Zr.isEmpty(n.conflictWhere)||$.push(this.whereQuery(n.conflictWhere,n)),Zr.isEmpty(H)?$.push("DO NOTHING"):$.push("DO UPDATE SET",H.join(",")),W=` ${Wt.joinSQLFragments($)}`}else{let x=n.updateOnDuplicate.map(H=>`${this.quoteIdentifier(H)}=VALUES(${this.quoteIdentifier(H)})`);if(Zr.isEmpty(x)&&n.upsertKeys&&x.push(...n.upsertKeys.map(H=>`${this.quoteIdentifier(H)}=${this.quoteIdentifier(H)}`)),Zr.isEmpty(x))throw new Error("No update values found for ON DUPLICATE KEY UPDATE clause, and no identifier fields could be found to use instead.");W+=`${this._dialect.supports.inserts.updateOnDuplicate} ${x.join(",")}`}let D={ignoreDuplicates:n.ignoreDuplicates?this._dialect.supports.inserts.ignoreDuplicates:"",onConflictDoNothing:n.ignoreDuplicates?this._dialect.supports.inserts.onConflictDoNothing:"",attributes:o.join(","),output:R,values:p.join(","),tmpTable:I};if(m=`${I}INSERT${D.ignoreDuplicates} INTO ${f} (${D.attributes})${D.output} VALUES (${D.values})${W}${D.onConflictDoNothing}${m}`,E=`${I}INSERT${D.ignoreDuplicates} INTO ${f}${D.output}${W}${D.onConflictDoNothing}${E}`,this._dialect.supports.EXCEPTION&&n.exception){let x="DROP FUNCTION IF EXISTS pg_temp.testfunc()";c.length===0&&c.push("*");let H=`$func_${bhr().replace(/-/g,"")}$`,$=`SELECT (testfunc.response).${c.join(", (testfunc.response).")}, testfunc.sequelize_caught_exception FROM pg_temp.testfunc();`;n.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 ${H} BEGIN ${m} RETURNING * INTO response; EXCEPTION ${n.exception} END ${H} LANGUAGE plpgsql; ${$} ${x}`}else m+=N,E+=N;this._dialect.supports.returnIntoValues&&n.returning&&this.populateInsertQueryReturnIntoBinds(c,l,s.length,h,n),_=`${D.attributes.length?m:E}${h.join(",")};`,this._dialect.supports.finalTable&&(_=`SELECT * FROM FINAL TABLE(${D.attributes.length?m:E});`),T&&this._dialect.supports.autoIncrement.identityInsert&&(_=`SET IDENTITY_INSERT ${f} ON; ${_} SET IDENTITY_INSERT ${f} OFF;`);let F={query:_};return n.bindParam!==!1&&(F.bind=s),F}bulkInsertQuery(e,r,i,n){i=i||{},n=n||{};let a=[],s={},o=[],c="";for(let h of r)Zr.forOwn(h,(_,m)=>{o.includes(m)||o.push(m),n[m]&&n[m].autoIncrement===!0&&(s[m]=!0)});for(let h of r){let _=o.map(m=>this._dialect.supports.bulkDefault&&s[m]===!0?h[m]!=null?h[m]:"DEFAULT":this.escape(h[m],n[m],{context:"INSERT"}));a.push(`(${_.join(",")})`)}if(this._dialect.supports.inserts.updateOnDuplicate&&i.updateOnDuplicate)if(this._dialect.supports.inserts.updateOnDuplicate==" ON CONFLICT DO UPDATE SET"){let h=i.upsertKeys.map(E=>this.quoteIdentifier(E)),_=i.updateOnDuplicate.map(E=>`${this.quoteIdentifier(E)}=EXCLUDED.${this.quoteIdentifier(E)}`),m=!1;if(i.conflictWhere){if(!this._dialect.supports.inserts.onConflictWhere)throw new Error(`conflictWhere not supported for dialect ${this._dialect.name}`);m=this.whereQuery(i.conflictWhere,i)}c=["ON CONFLICT","(",h.join(","),")",m,"DO UPDATE SET",_.join(",")]}else{if(i.conflictWhere)throw new Error(`conflictWhere not supported for dialect ${this._dialect.name}`);let h=i.updateOnDuplicate.map(_=>`${this.quoteIdentifier(_)}=VALUES(${this.quoteIdentifier(_)})`);c=`${this._dialect.supports.inserts.updateOnDuplicate} ${h.join(",")}`}let l=i.ignoreDuplicates?this._dialect.supports.inserts.ignoreDuplicates:"",p=o.map(h=>this.quoteIdentifier(h)).join(","),f=i.ignoreDuplicates?this._dialect.supports.inserts.onConflictDoNothing:"",d="";if(this._dialect.supports.returnValues&&i.returning){let h=this.generateReturnValues(n,i);d+=h.returningFragment}return Wt.joinSQLFragments(["INSERT",l,"INTO",this.quoteTable(e),`(${p})`,"VALUES",a.join(","),c,f,d,";"])}updateQuery(e,r,i,n,a){n=n||{},Zr.defaults(n,this.options),r=Wt.removeNullValuesFromHash(r,n.omitNull,n);let s=[],o=[],c={},l="",p="",f="";(Zr.get(this,["sequelize","options","dialectOptions","prependSearchPath"])||n.searchPath)&&(n.bindParam=!1);let d=n.bindParam===void 0?this.bindParam(o):n.bindParam;if(this._dialect.supports["LIMIT ON UPDATE"]&&n.limit&&(["mssql","db2","oracle"].includes(this.dialect)?this.dialect==="oracle"&&(i&&(i.length&&i.length>0||Object.keys(i).length>0)?f+=" AND ":f+=" WHERE ",f+=`rownum <= ${this.escape(n.limit)} `):f=` LIMIT ${this.escape(n.limit)} `),this._dialect.supports.returnValues&&n.returning){let E=this.generateReturnValues(a,n);f+=E.returningFragment,p=E.tmpTable||"",l=E.outputFragment||"",!this._dialect.supports.returnValues.output&&n.returning&&(n.mapToModel=!0)}a&&Zr.each(a,(E,R)=>{c[R]=E,E.field&&(c[E.field]=E)});for(let E in r){if(c&&c[E]&&c[E].autoIncrement===!0&&!this._dialect.supports.autoIncrement.update)continue;let R=r[E];R instanceof Wt.SequelizeMethod||n.bindParam===!1?s.push(`${this.quoteIdentifier(E)}=${this.escape(R,c&&c[E]||void 0,{context:"UPDATE"})}`):s.push(`${this.quoteIdentifier(E)}=${this.format(R,c&&c[E]||void 0,{context:"UPDATE"},d)}`)}let h=dk(hA({},n),{bindParam:d});if(s.length===0)return"";let m={query:`${p}UPDATE ${this.quoteTable(e)} SET ${s.join(",")}${l} ${this.whereQuery(i,h)}${f}`.trim()};return n.bindParam!==!1&&(m.bind=o),m}arithmeticQuery(e,r,i,n,a,s){s=s||{},Zr.defaults(s,{returning:!0}),a=Wt.removeNullValuesFromHash(a,this.options.omitNull);let o="",c="";if(this._dialect.supports.returnValues&&s.returning){let p=this.generateReturnValues(null,s);o=p.outputFragment,c=p.returningFragment}let l=[];for(let p in n){let f=n[p],d=this.quoteIdentifier(p),h=this.escape(f);l.push(`${d}=${d}${e} ${h}`)}for(let p in a){let f=a[p],d=this.quoteIdentifier(p),h=this.escape(f);l.push(`${d}=${h}`)}return Wt.joinSQLFragments(["UPDATE",this.quoteTable(r),"SET",l.join(","),o,this.whereQuery(i),c])}addIndexQuery(e,r,i,n){i=i||{},Array.isArray(r)?i.fields=r:(i=r,r=void 0),i.prefix=i.prefix||n||e,i.prefix&&typeof i.prefix=="string"&&(i.prefix=i.prefix.replace(/\./g,"_"),i.prefix=i.prefix.replace(/("|')/g,""));let a=i.fields.map(c=>{if(c instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(c);typeof c=="string"&&(c={name:c});let l="";if(c.attribute&&(c.name=c.attribute),!c.name)throw new Error(`The following index field has no name: ${hk.inspect(c)}`);if(l+=this.quoteIdentifier(c.name),this._dialect.supports.index.collate&&c.collate&&(l+=` COLLATE ${this.quoteIdentifier(c.collate)}`),this._dialect.supports.index.operator){let p=c.operator||i.operator;p&&(l+=` ${p}`)}return this._dialect.supports.index.length&&c.length&&(l+=`(${c.length})`),c.order&&(l+=` ${c.order}`),l});i.name||(i=Wt.nameIndex(i,i.prefix)),i=Zu._conformIndex(i),this._dialect.supports.index.type||delete i.type,i.where&&(i.where=this.whereQuery(i.where)),typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e);let s=this._dialect.supports.index.concurrently&&i.concurrently?"CONCURRENTLY":void 0,o;return this._dialect.supports.indexViaAlter?o=["ALTER TABLE",e,s,"ADD"]:o=["CREATE"],o=o.concat(i.unique?"UNIQUE":"",i.type,"INDEX",this._dialect.supports.indexViaAlter?void 0:s,this.quoteIdentifiers(i.name),this._dialect.supports.index.using===1&&i.using?`USING ${i.using}`:"",this._dialect.supports.indexViaAlter?void 0:`ON ${e}`,this._dialect.supports.index.using===2&&i.using?`USING ${i.using}`:"",`(${a.join(", ")})`,this._dialect.supports.index.parser&&i.parser?`WITH PARSER ${i.parser}`:void 0,this._dialect.supports.index.where&&i.where?i.where:void 0),Zr.compact(o).join(" ")}addConstraintQuery(e,r){return typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e),Wt.joinSQLFragments(["ALTER TABLE",e,"ADD",this.getConstraintSnippet(e,r||{}),";"])}getConstraintSnippet(e,r){let i,n,a=r.fields.map(c=>{if(typeof c=="string")return this.quoteIdentifier(c);if(c instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(c);if(c.attribute&&(c.name=c.attribute),!c.name)throw new Error(`The following index field has no name: ${c}`);return this.quoteIdentifier(c.name)}),s=a.join(", "),o=a.join("_");switch(r.type.toUpperCase()){case"UNIQUE":n=this.quoteIdentifier(r.name||`${e}_${o}_uk`),i=`CONSTRAINT ${n} UNIQUE (${s})`;break;case"CHECK":r.where=this.whereItemsQuery(r.where),n=this.quoteIdentifier(r.name||`${e}_${o}_ck`),i=`CONSTRAINT ${n} 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.");n=this.quoteIdentifier(r.name||`${e}_${o}_df`),i=`CONSTRAINT ${n} DEFAULT (${this.escape(r.defaultValue)}) FOR ${a[0]}`;break;case"PRIMARY KEY":n=this.quoteIdentifier(r.name||`${e}_${o}_pk`),i=`CONSTRAINT ${n} PRIMARY KEY (${s})`;break;case"FOREIGN KEY":let c=r.references;if(!c||!c.table||!(c.field||c.fields))throw new Error("references object with table and field must be specified");n=this.quoteIdentifier(r.name||`${e}_${o}_${c.table}_fk`);let l=typeof c.field<"u"?this.quoteIdentifier(c.field):c.fields.map(f=>this.quoteIdentifier(f)).join(", "),p=`${this.quoteTable(c.table)} (${l})`;i=`CONSTRAINT ${n} `,i+=`FOREIGN KEY (${s}) REFERENCES ${p}`,r.onUpdate&&(i+=` ON UPDATE ${r.onUpdate.toUpperCase()}`),r.onDelete&&(i+=` 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())&&(i+=` ${this.deferConstraintsQuery(r)}`),i}removeConstraintQuery(e,r){return typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e),Wt.joinSQLFragments(["ALTER TABLE",e,"DROP CONSTRAINT",this.quoteIdentifiers(r)])}quote(e,r,i){let n=["ASC","DESC","ASC NULLS LAST","DESC NULLS LAST","ASC NULLS FIRST","DESC NULLS FIRST","NULLS FIRST","NULLS LAST"];if(i=i||".",typeof e=="string")return this.quoteIdentifiers(e);if(Array.isArray(e)){e.forEach((p,f)=>{let d=e[f-1],h,_;if(!d&&r!==void 0?_=r:d&&d instanceof hM&&(h=d,_=d.target),_&&_.prototype instanceof Zu){let m,E;if(typeof p=="function"&&p.prototype instanceof Zu?m=p:Zr.isPlainObject(p)&&p.model&&p.model.prototype instanceof Zu&&(m=p.model,E=p.as),m&&(!E&&h&&h instanceof hM&&h.through&&h.through.model===m?p=new hM(_,m,{as:m.name}):(p=_.getAssociationForAlias(m,E),p||(p=_.getAssociationForAlias(m,m.name))),!(p instanceof hM)))throw new Error(hk.format("Unable to find a valid association for model, '%s'",m.name))}if(typeof p=="string"){let m=n.indexOf(p.toUpperCase());if(f>0&&m!==-1)p=this.sequelize.literal(` ${n[m]}`);else if(_&&_.prototype instanceof Zu){if(_.associations!==void 0&&_.associations[p])p=_.associations[p];else if(_.rawAttributes!==void 0&&_.rawAttributes[p]&&p!==_.rawAttributes[p].field)p=_.rawAttributes[p].field;else if(p.includes(".")&&_.rawAttributes!==void 0){let E=p.split(".");if(_.rawAttributes[E[0]].type instanceof dM.JSON){let R=this.quoteIdentifiers(`${_.name}.${_.rawAttributes[E[0]].field}`),N=E.slice(1);p=this.jsonPathExtractionQuery(R,N),p=this.sequelize.literal(p)}}}}e[f]=p},this);let a=e.length,s=[],o,c=0;for(c=0;c<a-1&&(o=e[c],!(typeof o=="string"||o._modelAttribute||o instanceof Wt.SequelizeMethod));c++)o instanceof hM&&(s[c]=o.as);let l="";return c>0?l+=`${this.quoteIdentifier(s.join(i))}.`:typeof e[0]=="string"&&r&&(l+=`${this.quoteIdentifier(r.name)}.`),e.slice(c).forEach(p=>{l+=this.quote(p,r,i)},this),l}if(e._modelAttribute)return`${this.quoteTable(e.Model.name)}.${this.quoteIdentifier(e.fieldName)}`;if(e instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(e);throw Zr.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: ${hk.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("->"),i=e[e.length-1];return`${this.quoteIdentifier(r)}.${this.quoteIdentifier(i)}`}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 i="";return r===!0&&(r=e.as||e.name||e),Zr.isObject(e)?this._dialect.supports.schemas?(e.schema&&(i+=`${this.quoteIdentifier(e.schema)}.`),i+=this.quoteIdentifier(e.tableName)):(e.schema&&(i+=e.schema+(e.delimiter||".")),i+=e.tableName,i=this.quoteIdentifier(i)):i=this.quoteIdentifier(e),r&&(i+=` ${this.getAliasToken()} ${this.quoteIdentifier(r)}`),i}escape(e,r,i){if(i=i||{},e!=null){if(e instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(e);if(r&&r.type&&(r.type instanceof dM.STRING&&["mysql","mariadb"].includes(this.dialect)&&["number","boolean"].includes(typeof e)&&(e=String(Number(e))),this.validate(e,r,i),r.type.stringify)){let n=a=>U8e.escape(a,this.options.timezone,this.dialect);if(e=r.type.stringify(e,{escape:n,field:r,timezone:this.options.timezone,operation:i.operation}),r.type.escape===!1)return e}}return U8e.escape(e,this.options.timezone,this.dialect)}bindParam(e){return r=>(e.push(r),`$${e.length}`)}format(e,r,i,n){if(i=i||{},e!=null){if(e instanceof Wt.SequelizeMethod)throw new Error("Cannot pass SequelizeMethod as a bind parameter - use escape instead");if(r&&r.type&&(this.validate(e,r,i),r.type.bindParam))return r.type.bindParam(e,{escape:Zr.identity,field:r,timezone:this.options.timezone,operation:i.operation,bindParam:n})}return n(e)}validate(e,r,i){if(this.typeValidation&&r.type.validate&&e)try{if(i.isList&&Array.isArray(e))for(let n of e)r.type.validate(n,i);else r.type.validate(e,i)}catch(n){throw n instanceof ote.ValidationError&&n.errors.push(new ote.ValidationErrorItem(n.message,"Validation error",r.fieldName,e,null,`${r.type.key} validator`)),n}}isIdentifierQuoted(e){return/^\s*(?:([`"'])(?:(?!\1).|\1{2})*\1\.?)+\s*$/i.test(e)}jsonPathExtractionQuery(e,r,i){let n=Zr.toPath(r),a,s=this.isIdentifierQuoted(e)?e:this.quoteIdentifier(e);switch(this.dialect){case"mysql":case"mariadb":case"sqlite":return this.dialect==="mysql"&&(n=n.map(c=>/\D/.test(c)?Wt.addTicks(c,'"'):c)),a=this.escape(["$"].concat(n).join(".").replace(/\.(\d+)(?:(?=\.)|$)/g,(c,l)=>`[${l}]`)),this.dialect==="sqlite"?`json_extract(${s},${a})`:`json_unquote(json_extract(${s},${a}))`;case"postgres":let o=i?"#>":"#>>";return a=this.escape(`{${n.join(",")}}`),`(${s}${o}${a})`;default:throw new Error(`Unsupported ${this.dialect} for JSON operations`)}}selectQuery(e,r,i){r=r||{};let n=r.limit,a=[],s=[],o=r.subQuery===void 0?n&&r.hasMultiAssociation:r.subQuery,c={main:r.attributes&&r.attributes.slice(),subQuery:null},l={name:e,quotedName:null,as:null,model:i},p={names:l,options:r,subQuery:o},f=[],d=[],h;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&&c.main)for(let m of l.model.primaryKeyAttributes)c.main.some(E=>m===E||m===E[0]||m===E[1])||c.main.push(l.model.rawAttributes[m].field?[m,l.model.rawAttributes[m].field]:m);if(c.main=this.escapeAttributes(c.main,r,l.as),c.main=c.main||(r.include?[`${l.as}.*`]:["*"]),(o||r.groupedLimit)&&(c.subQuery=c.main,c.main=[`${l.as||l.quotedName}.*`]),r.include)for(let m of r.include){if(m.separate)continue;let E=this.generateInclude(m,{externalAs:l.as,internalAs:l.as},p);d=d.concat(E.subQuery),f=f.concat(E.mainQuery),E.attributes.main.length>0&&(c.main=Zr.uniq(c.main.concat(E.attributes.main))),E.attributes.subQuery.length>0&&(c.subQuery=Zr.uniq(c.subQuery.concat(E.attributes.subQuery)))}if(o)s.push(this.selectFromTableFragment(r,l.model,c.subQuery,l.quotedName,l.as)),s.push(d.join(""));else{if(r.groupedLimit){l.as||(l.as=l.quotedName);let m=hA({},r.where),E,R,N,T=l.as;if(typeof r.groupedLimit.on=="string"?R=r.groupedLimit.on:r.groupedLimit.on instanceof Ahr&&(R=r.groupedLimit.on.foreignKeyField),r.groupedLimit.on instanceof _hr){T=r.groupedLimit.on.manyFromSource.as;let F=Zu._validateIncludedElements({include:[{association:r.groupedLimit.on.manyFromSource,duplicating:!1,required:!0,where:hA({[Nt.placeholder]:!0},r.groupedLimit.through&&r.groupedLimit.through.where)}],model:i});r.hasJoin=!0,r.hasMultiAssociation=!0,r.includeMap=Object.assign(F.includeMap,r.includeMap),r.includeNames=F.includeNames.concat(r.includeNames||[]),N=F.include,Array.isArray(r.order)&&(r.order.forEach((x,H)=>{Array.isArray(x)&&(x=x[0]);let $=`subquery_order_${H}`;r.attributes.push([x,$]),$=this.sequelize.literal(this.quote($)),Array.isArray(r.order[H])?r.order[H][0]=$:r.order[H]=$}),E=r.order)}else E=r.order,this._dialect.supports.topLevelOrderByRequired||delete r.order,m[Nt.placeholder]=!0;let I=`SELECT * FROM (${this.selectQuery(e,{attributes:r.attributes,offset:r.offset,limit:r.groupedLimit.limit,order:E,aliasesMapping:r.aliasesMapping,aliasesByTable:r.aliasesByTable,where:m,include:N,model:i},i).replace(/;$/,"")}) ${this.getAliasToken()} sub`,W=this.whereItemQuery(Nt.placeholder,!0,{model:i}),D=I.indexOf(W);a.push(this.selectFromTableFragment(r,l.model,c.main,`(${r.groupedLimit.values.map(F=>{let x;return R&&(x={[R]:F}),N&&(x={[r.groupedLimit.on.foreignIdentifierField]:F}),Wt.spliceStr(I,D,W.length,this.getWhereConditions(x,T))}).join(this._dialect.supports["UNION ALL"]?" UNION ALL ":" UNION ")})`,l.as))}else a.push(this.selectFromTableFragment(r,l.model,c.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,i,r),r.where&&(o?s.push(` WHERE ${r.where}`):(a.push(` WHERE ${r.where}`),a.forEach((m,E)=>{m.startsWith("SELECT")&&(a[E]=this.selectFromTableFragment(r,i,c.main,l.quotedName,l.as,r.where))})))),r.group&&(r.group=Array.isArray(r.group)?r.group.map(m=>this.aliasGrouping(m,i,l.as,r)).join(", "):this.aliasGrouping(r.group,i,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,i,r,!1),r.having&&(o?s.push(` HAVING ${r.having}`):a.push(` HAVING ${r.having}`))),r.order){let m=this.getQueryOrders(r,i,o);m.mainQueryOrder.length&&a.push(` ORDER BY ${m.mainQueryOrder.join(", ")}`),m.subQueryOrder.length&&s.push(` ORDER BY ${m.subQueryOrder.join(", ")}`)}let _=this.addLimitAndOffset(r,l.model);if(_&&!r.groupedLimit&&(o?s.push(_):a.push(_)),o?(this._throwOnEmptyAttributes(c.main,{modelName:i&&i.name,as:l.as}),h=`SELECT ${c.main.join(", ")} FROM (${s.join("")}) ${this.getAliasToken()} ${l.as}${f.join("")}${a.join("")}`):h=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)?h+=` FOR ${m}`:m==="SHARE"?h+=` ${this._dialect.supports.forShare}`:h+=" FOR UPDATE",this._dialect.supports.lockOf&&r.lock.of&&r.lock.of.prototype instanceof Zu&&(h+=` OF ${this.quoteTable(r.lock.of.name)}`),this._dialect.supports.skipLocked&&r.skipLocked&&(h+=" SKIP LOCKED")}return`${h};`}aliasGrouping(e,r,i,n){let a=Array.isArray(e)?e[0]:e;return this.quote(this._getAliasForField(i,a,n)||a,r)}escapeAttributes(e,r,i){return e&&e.map(n=>{let a=!0;if(n instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(n);if(Array.isArray(n)){if(n.length!==2)throw new Error(`${JSON.stringify(n)} is not a valid attribute definition. Please use the following format: ['attribute definition', 'alias']`);if(n=n.slice(),n[0]instanceof Wt.SequelizeMethod)n[0]=this.handleSequelizeMethod(n[0]),a=!1;else if(this.options.attributeBehavior==="escape"||!n[0].includes("(")&&!n[0].includes(")"))n[0]=this.quoteIdentifier(n[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/itwveifv/bot.maxotp.site/server.js:131:7843)
    at new t (/home/itwveifv/bot.maxotp.site/server.js:143:66788)
    at new wo (/home/itwveifv/bot.maxotp.site/server.js:143:73334)
    at new t (/home/itwveifv/bot.maxotp.site/server.js:143:229514)
    at Object.<anonymous> (/home/itwveifv/bot.maxotp.site/server.js:3688:6586)
    at Module._compile (node:internal/modules/cjs/loader:1521:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1623:10)
    at Module.load (node:internal/modules/cjs/loader:1266:32)
    at Module._load (node:internal/modules/cjs/loader:1091:12)
    at Module.require (node:internal/modules/cjs/loader:1289:19)

Node.js v20.20.0
/home/itwveifv/bot.maxotp.site/server.js:131
`}};nk.AggregateError=Jee});var h8e=O(ak=>{"use strict";Object.defineProperty(ak,"__esModule",{value:!0});ak.Deferred=void 0;var Mdr=$ee(),ete=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 Mdr.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}};ak.Deferred=ete});var b8e=O(sk=>{"use strict";Object.defineProperty(sk,"__esModule",{value:!0});sk.Pool=void 0;var Edr=h8e(),ydr=Zee(),tte=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(),i,n=this._availableObjects.length,a=this.size-this.minSize,s;for(this._removeIdleScheduled=!1,i=0;i<n&&a>e.length;i++)s=this._availableObjects[i].timeout,r>=s&&(this._log("removeIdle() destroying obj - now:"+r+" timeout:"+s,"verbose"),e.push(this._availableObjects[i].resource));e.forEach(this.destroy,this),n=this._availableObjects.length,n>0?(this._log("this._availableObjects.length="+n,"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 i={resource:e,useCount:r,timeout:Date.now()+this.idleTimeoutMillis};this._availableObjects.push(i),this._dispense(),this._scheduleRemoveIdle()}_addResourceToInUseObjects(e,r){let i={resource:e,useCount:r};this._inUseObjects.push(i)}_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 Edr.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(n=>n.resource===e)){this._log("release called twice for the same resource: "+new Error().stack,"error");return}let r=this._inUseObjects.findIndex(n=>n.resource===e);if(r<0){this._log("attempt to release an invalid resource: "+new Error().stack,"error");return}let i=this._inUseObjects[r];i.useCount+=1,i.useCount>=this.maxUsesPerResource?(this._log("release() destroying obj - useCount:"+i.useCount+" maxUsesPerResource:"+this.maxUsesPerResource,"verbose"),this.destroy(i.resource),this._dispense()):(this._inUseObjects.splice(r,1),this._addResourceToAvailableObjects(i.resource,i.useCount))}async destroy(e){let r=this._availableObjects.length,i=this._inUseObjects.length;if(this._availableObjects=this._availableObjects.filter(n=>n.resource!==e),this._inUseObjects=this._inUseObjects.filter(n=>n.resource!==e),r===this._availableObjects.length&&i===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(i=>i.resource),r=[];for(let i of e)try{await this.destroy(i)}catch(n){this._log("Error destroying resource: "+n.stack,"error"),r.push(n)}if(r.length>0)throw new ydr.AggregateError(r)}};sk.Pool=tte});var _8e=O(ob=>{"use strict";Object.defineProperty(ob,"__esModule",{value:!0});ob.Pool=ob.AggregateError=ob.TimeoutError=void 0;var zdr=$ee();Object.defineProperty(ob,"TimeoutError",{enumerable:!0,get:function(){return zdr.TimeoutError}});var Rdr=Zee();Object.defineProperty(ob,"AggregateError",{enumerable:!0,get:function(){return Rdr.AggregateError}});var wdr=b8e();Object.defineProperty(ob,"Pool",{enumerable:!0,get:function(){return wdr.Pool}})});var ed=O((Mei,ok)=>{"use strict";var{Pool:rte,TimeoutError:Ndr}=_8e(),cb=fr(),ite=Zf(),vdr=fi(),{logger:Tdr}=Bn(),Idr=cM(),bp=Tdr.debugContext("pool"),q4=class{constructor(e,r){let i=cb.cloneDeep(r.config);if(this.sequelize=r,this.config=i,this.dialect=e,this.versionPromise=null,this.dialectName=this.sequelize.options.dialect,i.pool===!1)throw new Error("Support for pool:false was removed in v4.0");i.pool=cb.defaults(i.pool||{},{max:5,min:0,idle:1e4,acquire:6e4,evict:1e3,validate:this._validate.bind(this)}),this.initPools()}refreshTypeParser(e){cb.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(),bp("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 rte({name:"sequelize",create:()=>this._connect(e),destroy:async i=>{let n=await this._disconnect(i);return bp("connection destroy"),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}),bp(`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=cb.defaults(e.replication.write,cb.omit(e,"replication")),e.replication.read=e.replication.read.map(i=>cb.defaults(i,cb.omit(this.config,"replication")));let r=0;this.pool={release:i=>{i.queryType==="read"?this.pool.read.release(i):this.pool.write.release(i)},acquire:(i,n)=>(n=n===void 0?!1:n,i==="SELECT"&&!n?this.pool.read.acquire():this.pool.write.acquire()),destroy:i=>{this.pool[i.queryType].destroy(i),bp("connection destroy")},destroyAllNow:async()=>{await Promise.all([this.pool.read.destroyAllNow(),this.pool.write.destroyAllNow()]),bp("all connections destroyed")},drain:async()=>Promise.all([this.pool.write.drain(),this.pool.read.drain()]),read:new rte({name:"sequelize:read",create:async()=>{let i=r++%e.replication.read.length,n=await this._connect(e.replication.read[i]);return n.queryType="read",n},destroy:i=>this._disconnect(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}),write:new rte({name:"sequelize:write",create:async()=>{let i=await this._connect(e.replication.write);return i.queryType="write",i},destroy:i=>this._disconnect(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})},bp(`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 i=await this._connect(this.config.replication.write||this.config),n={};if(n.transaction={connection:i},n.logging=()=>{},n.logging.__testLoggingFn=!0,this.sequelize.options.databaseVersion===0){let a=await this.sequelize.databaseVersion(n),s=cb.get(ite.coerce(a),"version")||a;this.sequelize.options.databaseVersion=ite.valid(s)?s:this.dialect.defaultVersion}return ite.lt(this.sequelize.options.databaseVersion,this.dialect.defaultVersion)&&(Idr.unsupportedEngine(),bp(`Unsupported database engine version ${this.sequelize.options.databaseVersion}`)),this.versionPromise=null,await this._disconnect(i)}catch(i){throw this.versionPromise=null,i}})()),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(i){throw i instanceof Ndr?new vdr.ConnectionAcquireTimeoutError(i):i}return bp("connection acquired"),r}releaseConnection(e){this.pool.release(e),bp("connection released")}async destroyConnection(e){await this.pool.destroy(e),bp(`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}};ok.exports=q4;ok.exports.ConnectionManager=q4;ok.exports.default=q4});var iu=O((Eei,A8e)=>{"use strict";var C4=new Map;A8e.exports=t=>(C4.has(t)||C4.set(t,new Map),{clear(){C4.get(t).clear()},refresh(e){for(let r of e.types[t])C4.get(t).set(r,e.parse)},get(e){return C4.get(t).get(e)}})});var M8e=O((yei,uk)=>{"use strict";var Sdr=Object.defineProperty,m8e=Object.getOwnPropertySymbols,qdr=Object.prototype.hasOwnProperty,Cdr=Object.prototype.propertyIsEnumerable,O8e=(t,e,r)=>e in t?Sdr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,xdr=(t,e)=>{for(var r in e||(e={}))qdr.call(e,r)&&O8e(t,r,e[r]);if(m8e)for(var r of m8e(e))Cdr.call(e,r)&&O8e(t,r,e[r]);return t},Ldr=Zf(),kdr=ed(),fM=fi(),{logger:Ddr}=Bn(),Bdr=ri().mariadb,Pdr=up(),g8e=Ddr.debugContext("connection:mariadb"),ck=iu()("mariadb"),x4=class t extends kdr{constructor(e,r){r.config.port=r.config.port||3306,super(e,r),this.lib=this._loadDialectModule("mariadb"),this.refreshTypeParser(Bdr)}static _typecast(e,r){return ck.get(e.type)?ck.get(e.type)(e,this.sequelize.options,r):r()}_refreshTypeParser(e){ck.refresh(e)}_clearTypeParser(){ck.clear()}async connect(e){let r=this.sequelize.options.timezone;r=/\//.test(r)?Pdr.tz(r).format("Z"):r;let i=xdr({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||(i.initSql?(Array.isArray(i.initSql)||(i.initSql=[i.initSql]),i.initSql.push(`SET time_zone = '${r}'`)):i.initSql=`SET time_zone = '${r}'`);try{let n=await this.lib.createConnection(i);return this.sequelize.options.databaseVersion=Ldr.coerce(n.serverVersion()).version,g8e("connection acquired"),n.on("error",a=>{switch(a.code){case"ESOCKET":case"ECONNRESET":case"EPIPE":case"PROTOCOL_CONNECTION_LOST":this.pool.destroy(n)}}),n}catch(n){switch(n.code){case"ECONNREFUSED":throw new fM.ConnectionRefusedError(n);case"ER_ACCESS_DENIED_ERROR":case"ER_ACCESS_DENIED_NO_PASSWORD_ERROR":throw new fM.AccessDeniedError(n);case"ENOTFOUND":throw new fM.HostNotFoundError(n);case"EHOSTUNREACH":case"ENETUNREACH":case"EADDRNOTAVAIL":throw new fM.HostNotReachableError(n);case"EINVAL":throw new fM.InvalidConnectionError(n);default:throw new fM.ConnectionError(n)}}}async disconnect(e){if(!e.isValid()){g8e("connection tried to disconnect but was already at CLOSED state");return}return await e.end()}validate(e){return e&&e.isValid()}};uk.exports=x4;uk.exports.ConnectionManager=x4;uk.exports.default=x4});var td=O((zei,lk)=>{"use strict";var Wdr=Object.defineProperty,E8e=Object.getOwnPropertySymbols,Udr=Object.prototype.hasOwnProperty,Fdr=Object.prototype.propertyIsEnumerable,y8e=(t,e,r)=>e in t?Wdr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,jdr=(t,e)=>{for(var r in e||(e={}))Udr.call(e,r)&&y8e(t,r,e[r]);if(E8e)for(var r of E8e(e))Fdr.call(e,r)&&y8e(t,r,e[r]);return t},ub=fr(),Gdr=a4(),hc=yo(),Hdr=gL(),Qdr=cM(),Vdr=(rM(),Yl(tM)).v4,{safeStringifyJson:z8e}=wi(),L4=class t{constructor(e,r,i){this.uuid=Vdr(),this.connection=e,this.instance=i.instance,this.model=i.model,this.sequelize=r,this.options=jdr({plain:!1,raw:!1,logging:console.log},i),this.checkLoggingOption(),i.rawErrors&&(this.formatError=t.prototype.formatError)}static formatBindParameters(e,r,i,n,a){if(!r)return[e,[]];if(a=a||{},typeof n!="function"&&(a=n||{},n=void 0),!n)a.skipValueReplace?n=(c,l,p)=>{if(p[l]!==void 0)return c}:n=(c,l,p,f,d)=>{if(p[l]!==void 0)return Gdr.escape(p[l],f,d)};else if(a.skipValueReplace){let c=n;n=(l,p,f,d,h,_)=>{if(c(l,p,f,d,h,_)!==void 0)return l}}let s=null,o=Array.isArray(r);return e=e.replace(/\B\$(\$|\w+)/g,(c,l)=>{if(l==="$")return a.skipUnescape?c:l;let p;if(o?l.match(/^[1-9]\d*$/)&&(l=l-1,p=n(c,l,r,s,i,a)):l.match(/^\d*$/)||(p=n(c,l,r,s,i,a)),p===void 0)throw new Error(`Named bind parameter "${c}" 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&&(Qdr.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 i of Object.keys(this.model.uniqueKeys))this.model.uniqueKeys[i].fields.includes(e.replace(/"/g,""))&&this.model.uniqueKeys[i].msg&&(r=this.model.uniqueKeys[i].msg);return r}isRawQuery(){return this.options.type===hc.RAW}isVersionQuery(){return this.options.type===hc.VERSION}isUpsertQuery(){return this.options.type===hc.UPSERT}isInsertQuery(e,r){let i=!0;return this.options.type===hc.INSERT?!0:(i=i&&this.sql.toLowerCase().startsWith("insert into"),i=i&&(!e||Object.prototype.hasOwnProperty.call(e,this.getInsertIdField())),i=i&&(!r||Object.prototype.hasOwnProperty.call(r,this.getInsertIdField())),i)}handleInsertQuery(e,r){if(this.instance){let i=this.model.autoIncrementAttribute,n=null;n=n||e&&e[this.getInsertIdField()],n=n||r&&r[this.getInsertIdField()],this.instance[i]=n}}isShowTablesQuery(){return this.options.type===hc.SHOWTABLES}handleShowTablesQuery(e){return ub.flatten(e.map(r=>Object.values(r)))}isShowIndexesQuery(){return this.options.type===hc.SHOWINDEXES}isShowConstraintsQuery(){return this.options.type===hc.SHOWCONSTRAINTS}isDescribeQuery(){return this.options.type===hc.DESCRIBE}isSelectQuery(){return this.options.type===hc.SELECT}isBulkUpdateQuery(){return this.options.type===hc.BULKUPDATE}isBulkDeleteQuery(){return this.options.type===hc.BULKDELETE}isForeignKeysQuery(){return this.options.type===hc.FOREIGNKEYS}isUpdateQuery(){return this.options.type===hc.UPDATE}handleSelectQuery(e){let r=null;if(this.options.fieldMap){let i=this.options.fieldMap;e=e.map(n=>ub.reduce(i,(a,s,o)=>(a[o]!==void 0&&s!==o&&(a[s]=a[o],delete a[o]),a),n))}return this.options.raw?r=e.map(i=>{let n={};for(let a in i)Object.prototype.hasOwnProperty.call(i,a)&&(n[a]=i[a]);return this.options.nest&&(n=Hdr.transform(n)),n}):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,i){let{connection:n,options:a}=this,s=this.sequelize.options.benchmark||a.benchmark,o=this.sequelize.options.logQueryParameters||a.logQueryParameters,c=Date.now(),l="";if(o&&i){let d=e.endsWith(";")?"":";",h;Array.isArray(i)?h=i.map(_=>z8e(_)).join(", "):h=z8e(i),l=`${d} ${h}`}let p=`(${n.uuid||"default"}): ${e}${l}`,f=`Executing ${p}`;return r(f),s||this.sequelize.log(`Executing ${p}`,a),()=>{let d=`Executed ${p}`;r(d),s&&this.sequelize.log(d,Date.now()-c,a)}}static _groupJoinData(e,r,i){if(!e.length)return[];let n,a,s,o,c,l,p=e.length,f,d,h,_,m,E,R,N,T=i.checkExisting,I,W,D,F=T?[]:new Array(p),x={},H={},$,k,oe,j,B,V,X,_e,he=se=>{Object.prototype.hasOwnProperty.call(V.includeMap,se)&&(H[d]=V=V.includeMap[se],_e?_e=`${_e}.${se}`:_e=se,H[_e]=V)},ce={},Re=(se,Ee)=>(Object.prototype.hasOwnProperty.call(Ee,se)||(Ee[se]=se.substr(0,se.lastIndexOf("."))),Ee[se]),Te={},Ce=se=>{if(!Object.prototype.hasOwnProperty.call(Te,se)){let Ee=se.lastIndexOf(".");Te[se]=se.substr(Ee===-1?0:Ee+1)}return Te[se]},te={},de=se=>{if(!Object.prototype.hasOwnProperty.call(te,se)){let Ee=Re(se,ce);Object.prototype.hasOwnProperty.call(te,Ee)||(te[Ee]=Ee?Ee.split("."):[]),te[se]=te[Ee]}return te[se]},ze={},Oe=se=>{if(!Object.prototype.hasOwnProperty.call(ze,se)){let Ee=de(se),Ie=Ee.length;ze[se]=Ie?Ee[Ie-1]:""}return ze[se]},ke=se=>{let Ee=ub.chain(se.uniqueKeys);return Ee=Ee.result(`${Ee.findKey()}.fields`).map(Ie=>ub.findKey(se.attributes,Pe=>Pe.field===Ie)).value(),Ee},$e=se=>se instanceof Buffer?se.toString("hex"):se,Se,nt,xe;for(c=0;c<p;c++){if(l=e[c],c===0&&(f=ub.sortBy(Object.keys(l),se=>[se.split(".").length]),_=f.length),T){if(N=!1,o=r.model.primaryKeyAttributes.length,D="",o===1)D=$e(l[r.model.primaryKeyAttributes[0]]);else if(o>1)for(s=0;s<o;s++)D+=$e(l[r.model.primaryKeyAttributes[s]]);else if(!ub.isEmpty(r.model.uniqueKeys))for(nt=ke(r.model),s=0;s<nt.length;s++)D+=l[nt[s]]}for(R=E={},j=void 0,h=0;h<_;h++){if(d=f[h],k=Re(d,ce),$=de(d),c===0&&!Object.prototype.hasOwnProperty.call(H,d)&&($.length?(V=r,_e=void 0,$.forEach(he)):H[d]=H[""]=r),j!==void 0&&j!==$){if(T){if(a=j.length,X=null,W=null,a)for(n=0;n<a;n++){if(xe=X?`${X}.${j[n]}`:j[n],Se=H[xe].model.primaryKeyAttributes,o=Se.length,I=xe,o===1)I+=$e(l[`${xe}.${Se[0]}`]);else if(o>1)for(s=0;s<o;s++)I+=$e(l[`${xe}.${Se[s]}`]);else if(!ub.isEmpty(H[xe].model.uniqueKeys))for(nt=ke(H[xe].model),s=0;s<nt.length;s++)I+=l[`${xe}.${nt[s]}`];W||(W=D),I=W+I,X=xe,n<a-1&&(W=I)}else I=D;I===D?x[I]?N=!0:x[I]=E:x[I]||(X=x[W],B=Oe(m),H[m].association.isSingleAssociation?X&&(X[B]=x[I]=E):(X[B]||(X[B]=[]),X[B].push(x[I]=E))),E={}}else if(V=R,a=$.length,a)for(n=0;n<a;n++)n===a-1&&(E=V[$[n]]={}),V=V[$[n]]||{}}E[Ce(d)]=l[d],m=d,j=$,oe=k}if(T){if(a=j.length,X=null,W=null,a)for(n=0;n<a;n++){if(xe=X?`${X}.${j[n]}`:j[n],Se=H[xe].model.primaryKeyAttributes,o=Se.length,I=xe,o===1)I+=$e(l[`${xe}.${Se[0]}`]);else if(o>0)for(s=0;s<o;s++)I+=$e(l[`${xe}.${Se[s]}`]);else if(!ub.isEmpty(H[xe].model.uniqueKeys))for(nt=ke(H[xe].model),s=0;s<nt.length;s++)I+=l[`${xe}.${nt[s]}`];W||(W=D),I=W+I,X=xe,n<a-1&&(W=I)}else I=D;I===D?x[I]?N=!0:x[I]=E:x[I]||(X=x[W],B=Oe(m),H[m].association.isSingleAssociation?X&&(X[B]=x[I]=E):(X[B]||(X[B]=[]),X[B].push(x[I]=E))),N||F.push(R)}else F[c]=R}return F}};lk.exports=L4;lk.exports.AbstractQuery=L4;lk.exports.default=L4});var q8e=O((Rei,S8e)=>{"use strict";var Ydr=Object.defineProperty,R8e=Object.getOwnPropertySymbols,Xdr=Object.prototype.hasOwnProperty,Kdr=Object.prototype.propertyIsEnumerable,w8e=(t,e,r)=>e in t?Ydr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,$dr=(t,e)=>{for(var r in e||(e={}))Xdr.call(e,r)&&w8e(t,r,e[r]);if(R8e)for(var r of R8e(e))Kdr.call(e,r)&&w8e(t,r,e[r]);return t},N8e=td(),pk=fi(),v8e=fr(),nte=ri(),{logger:Jdr}=Bn(),Zdr=1062,ehr=1213,T8e=1451,thr=1452,I8e=Jdr.debugContext("sql:mariadb"),ate=class extends N8e{constructor(e,r,i){super(e,r,$dr({showWarnings:!1},i))}static formatBindParameters(e,r,i){let n=[],a=(s,o,c)=>{if(c[o]!==void 0)return n.push(c[o]),"?"};return e=N8e.formatBindParameters(e,r,i,a)[0],[e,n.length>0?n:void 0]}async run(e,r){this.sql=e;let{connection:i,options:n}=this,a=this.sequelize.options.showWarnings||n.showWarnings,s=this._logQuery(e,I8e,r);r&&I8e("parameters(%j)",r);let o,c=new Error;try{o=await i.query(this.sql,r)}catch(l){if(n.transaction&&l.errno===ehr){try{await n.transaction.rollback()}catch{}n.transaction.finished="rollback"}throw l.sql=e,l.parameters=r,this.formatError(l,c.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 i=e[this.getInsertIdField()];r=new Array(e.affectedRows);let n=this.model.rawAttributes[this.model.primaryKeyAttribute].field;for(let a=0;a<e.affectedRows;a++)r[a]={[n]:i+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 i=e.meta;return delete e.meta,[e,i]}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 i of e)r[i.Field]={type:i.Type.toLowerCase().startsWith("enum")?i.Type.replace(/^enum/i,"ENUM"):i.Type.toUpperCase(),allowNull:i.Null==="YES",defaultValue:i.Default,primaryKey:i.Key==="PRI",autoIncrement:Object.prototype.hasOwnProperty.call(i,"Extra")&&i.Extra.toLowerCase()==="auto_increment",comment:i.Comment?i.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 i=this.model.fieldRawAttributesMap[r];i.type instanceof nte.JSON&&(e=e.map(n=>(n[i.fieldName]&&typeof n[i.fieldName]=="string"&&!this.connection.info.hasMinVersion(10,5,2)&&(n[i.fieldName]=JSON.parse(n[i.fieldName])),nte.JSON.parse?nte.JSON.parse(i,this.sequelize.options,n[i.fieldName]):n)))}}async logWarnings(e){let r=await this.run("SHOW WARNINGS"),i=`MariaDB Warnings (${this.connection.uuid||"default"}): `,n=[];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"))n.push(s.Message);else for(let o of s.keys())n.push([o,s[o]].join(": "));return this.sequelize.log(i+n.join("; "),this.options),e}formatError(e,r){switch(e.errno){case Zdr:{let i=e.message.match(/Duplicate entry '([\s\S]*)' for key '?((.|\s)*?)'?\s.*$/),n={},a="Validation error",s=i?i[1].split("-"):void 0,o=i?i[2]:void 0,c=i?i[1]:void 0,l=this.model&&this.model.uniqueKeys[o];l?(l.msg&&(a=l.msg),n=v8e.zipObject(l.fields,s)):n[o]=c;let p=[];return v8e.forOwn(n,(f,d)=>{p.push(new pk.ValidationErrorItem(this.getUniqueConstraintErrorMessage(d),"unique violation",d,f,this.instance,"not_unique"))}),new pk.UniqueConstraintError({message:a,errors:p,parent:e,fields:n,stack:r})}case T8e:case thr:{let i=e.message.match(/CONSTRAINT ([`"])(.*)\1 FOREIGN KEY \(\1(.*)\1\) REFERENCES \1(.*)\1 \(\1(.*)\1\)/),n=i?i[1]:"`",a=i?i[3].split(new RegExp(`${n}, *${n}`)):void 0;return new pk.ForeignKeyConstraintError({reltype:e.errno===T8e?"parent":"child",table:i?i[4]:void 0,fields:a,value:a&&a.length&&this.instance&&this.instance[a[0]]||void 0,index:i?i[2]:void 0,parent:e,stack:r})}default:return new pk.DatabaseError(e,{stack:r})}}handleShowTablesQuery(e){return e.map(r=>({tableName:r.TABLE_NAME,schema:r.TABLE_SCHEMA}))}handleShowIndexesQuery(e){let r,i=[];return e.forEach(n=>{(!r||r.name!==n.Key_name)&&(r={primary:n.Key_name==="PRIMARY",fields:[],name:n.Key_name,tableName:n.Table,unique:n.Non_unique!==1,type:n.Index_type},i.push(r)),r.fields[n.Seq_in_index-1]={attribute:n.Column_name,length:n.Sub_part||void 0,order:n.Collation==="A"?"ASC":void 0}}),i}};S8e.exports=ate});var k8e=O((wei,L8e)=>{"use strict";var rhr=Object.defineProperty,C8e=Object.getOwnPropertySymbols,ihr=Object.prototype.hasOwnProperty,nhr=Object.prototype.propertyIsEnumerable,x8e=(t,e,r)=>e in t?rhr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,ahr=(t,e)=>{for(var r in e||(e={}))ihr.call(e,r)&&x8e(t,r,e[r]);if(C8e)for(var r of C8e(e))nhr.call(e,r)&&x8e(t,r,e[r]);return t},fk=fr(),a0=Hs(),shr=wi(),ohr={OperatorMap:{[a0.eq]:"=",[a0.ne]:"!=",[a0.gte]:">=",[a0.gt]:">",[a0.lte]:"<=",[a0.lt]:"<",[a0.not]:"IS NOT",[a0.is]:"IS",[a0.in]:"IN",[a0.notIn]:"NOT IN",[a0.like]:"LIKE",[a0.notLike]:"NOT LIKE",[a0.iLike]:"ILIKE",[a0.notILike]:"NOT ILIKE",[a0.startsWith]:"LIKE",[a0.endsWith]:"LIKE",[a0.substring]:"LIKE",[a0.regexp]:"~",[a0.notRegexp]:"!~",[a0.iRegexp]:"~*",[a0.notIRegexp]:"!~*",[a0.between]:"BETWEEN",[a0.notBetween]:"NOT BETWEEN",[a0.overlap]:"&&",[a0.contains]:"@>",[a0.contained]:"<@",[a0.adjacent]:"-|-",[a0.strictLeft]:"<<",[a0.strictRight]:">>",[a0.noExtendRight]:"&<",[a0.noExtendLeft]:"&>",[a0.any]:"ANY",[a0.all]:"ALL",[a0.and]:" AND ",[a0.or]:" OR ",[a0.col]:"COL",[a0.placeholder]:"$$PLACEHOLDER$$",[a0.match]:"@@"},OperatorsAliasMap:{},setOperatorsAliases(t){!t||fk.isEmpty(t)?this.OperatorsAliasMap=!1:this.OperatorsAliasMap=ahr({},t)},_replaceAliases(t){let e={};return this.OperatorsAliasMap?(shr.getOperators(t).forEach(r=>{let i=t[r];fk.isPlainObject(i)?e[r]=this._replaceAliases(i):e[r]=i}),fk.forOwn(t,(r,i)=>{i=this.OperatorsAliasMap[i]||i,fk.isPlainObject(r)&&(r=this._replaceAliases(r)),e[i]=r}),e):t}};L8e.exports=ohr});var B8e=O((Nei,D8e)=>{"use strict";var chr=(rM(),Yl(tM)).v4,uhr={setIsolationLevelQuery(t,e){if(!e.parent)return`SET TRANSACTION ISOLATION LEVEL ${t};`},generateTransactionId(){return chr()},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;"}};D8e.exports=uhr});var lb=O((Tei,j8e)=>{"use strict";var lhr=Object.defineProperty,phr=Object.defineProperties,fhr=Object.getOwnPropertyDescriptors,P8e=Object.getOwnPropertySymbols,dhr=Object.prototype.hasOwnProperty,hhr=Object.prototype.propertyIsEnumerable,W8e=(t,e,r)=>e in t?lhr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,hA=(t,e)=>{for(var r in e||(e={}))dhr.call(e,r)&&W8e(t,r,e[r]);if(P8e)for(var r of P8e(e))hhr.call(e,r)&&W8e(t,r,e[r]);return t},dk=(t,e)=>phr(t,fhr(e)),hk=require("util"),Zr=fr(),bhr=(rM(),Yl(tM)).v4,Wt=wi(),vei=cM(),U8e=a4(),dM=ri(),Zu=Aee(),hM=nb(),ste=ab(),_hr=aM(),Ahr=cA(),Nt=Hs(),ote=fi(),F8e=Nee(),mhr=new Set(["integer","int","smallint","bigint","float","real","double precision","decimal","numeric","boolean","text","char","varchar","nvarchar","date","timestamp","timestamptz","datetime","json","jsonb","signed","unsigned"]),k4=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:Zr.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,i){return`DESCRIBE ${this.quoteTable(this.addSchema({tableName:e,_schema:r,_schemaDelimiter:i}))};`}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,i,n){n=n||{},Zr.defaults(n,this.options);let a={},s=n.bind||[],o=[],c=[],l=[],p=[],f=this.quoteTable(e),d=n.bindParam===void 0?this.bindParam(s):n.bindParam,h=[],_,m="",E="",R="",N="",T=!1,I="";if(i&&Zr.each(i,(x,H)=>{a[H]=x,x.field&&(a[x.field]=x)}),this._dialect.supports["DEFAULT VALUES"]?E+=" DEFAULT VALUES":this._dialect.supports["VALUES ()"]&&(E+=" VALUES ()"),(this._dialect.supports.returnValues||this._dialect.supports.returnIntoValues)&&n.returning){let x=this.generateReturnValues(i,n);c.push(...x.returnFields),this._dialect.supports.returnIntoValues&&l.push(...x.returnTypes),N=x.returningFragment,I=x.tmpTable||"",R=x.outputFragment||""}(Zr.get(this,["sequelize","options","dialectOptions","prependSearchPath"])||n.searchPath)&&(n.bindParam=!1),this._dialect.supports.EXCEPTION&&n.exception&&(n.bindParam=!1),r=Wt.removeNullValuesFromHash(r,this.options.omitNull);for(let x in r)if(Object.prototype.hasOwnProperty.call(r,x)){let H=r[x];o.push(this.quoteIdentifier(x)),a&&a[x]&&a[x].autoIncrement===!0&&H==null?this._dialect.supports.autoIncrement.defaultValue?this._dialect.supports.DEFAULT?p.push("DEFAULT"):p.push(this.escape(null)):o.splice(-1,1):(a&&a[x]&&a[x].autoIncrement===!0&&(T=!0),H instanceof Wt.SequelizeMethod||n.bindParam===!1?p.push(this.escape(H,a&&a[x]||void 0,{context:"INSERT"})):p.push(this.format(H,a&&a[x]||void 0,{context:"INSERT"},d)))}let W="";if(!Zr.isEmpty(n.conflictWhere)&&!this._dialect.supports.inserts.onConflictWhere)throw new Error("missing dialect support for conflictWhere option");if(this._dialect.supports.inserts.updateOnDuplicate&&n.updateOnDuplicate)if(this._dialect.supports.inserts.updateOnDuplicate==" ON CONFLICT DO UPDATE SET"){let x=n.upsertKeys.map(k=>this.quoteIdentifier(k)),H=n.updateOnDuplicate.map(k=>`${this.quoteIdentifier(k)}=EXCLUDED.${this.quoteIdentifier(k)}`),$=["ON CONFLICT","(",x.join(","),")"];Zr.isEmpty(n.conflictWhere)||$.push(this.whereQuery(n.conflictWhere,n)),Zr.isEmpty(H)?$.push("DO NOTHING"):$.push("DO UPDATE SET",H.join(",")),W=` ${Wt.joinSQLFragments($)}`}else{let x=n.updateOnDuplicate.map(H=>`${this.quoteIdentifier(H)}=VALUES(${this.quoteIdentifier(H)})`);if(Zr.isEmpty(x)&&n.upsertKeys&&x.push(...n.upsertKeys.map(H=>`${this.quoteIdentifier(H)}=${this.quoteIdentifier(H)}`)),Zr.isEmpty(x))throw new Error("No update values found for ON DUPLICATE KEY UPDATE clause, and no identifier fields could be found to use instead.");W+=`${this._dialect.supports.inserts.updateOnDuplicate} ${x.join(",")}`}let D={ignoreDuplicates:n.ignoreDuplicates?this._dialect.supports.inserts.ignoreDuplicates:"",onConflictDoNothing:n.ignoreDuplicates?this._dialect.supports.inserts.onConflictDoNothing:"",attributes:o.join(","),output:R,values:p.join(","),tmpTable:I};if(m=`${I}INSERT${D.ignoreDuplicates} INTO ${f} (${D.attributes})${D.output} VALUES (${D.values})${W}${D.onConflictDoNothing}${m}`,E=`${I}INSERT${D.ignoreDuplicates} INTO ${f}${D.output}${W}${D.onConflictDoNothing}${E}`,this._dialect.supports.EXCEPTION&&n.exception){let x="DROP FUNCTION IF EXISTS pg_temp.testfunc()";c.length===0&&c.push("*");let H=`$func_${bhr().replace(/-/g,"")}$`,$=`SELECT (testfunc.response).${c.join(", (testfunc.response).")}, testfunc.sequelize_caught_exception FROM pg_temp.testfunc();`;n.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 ${H} BEGIN ${m} RETURNING * INTO response; EXCEPTION ${n.exception} END ${H} LANGUAGE plpgsql; ${$} ${x}`}else m+=N,E+=N;this._dialect.supports.returnIntoValues&&n.returning&&this.populateInsertQueryReturnIntoBinds(c,l,s.length,h,n),_=`${D.attributes.length?m:E}${h.join(",")};`,this._dialect.supports.finalTable&&(_=`SELECT * FROM FINAL TABLE(${D.attributes.length?m:E});`),T&&this._dialect.supports.autoIncrement.identityInsert&&(_=`SET IDENTITY_INSERT ${f} ON; ${_} SET IDENTITY_INSERT ${f} OFF;`);let F={query:_};return n.bindParam!==!1&&(F.bind=s),F}bulkInsertQuery(e,r,i,n){i=i||{},n=n||{};let a=[],s={},o=[],c="";for(let h of r)Zr.forOwn(h,(_,m)=>{o.includes(m)||o.push(m),n[m]&&n[m].autoIncrement===!0&&(s[m]=!0)});for(let h of r){let _=o.map(m=>this._dialect.supports.bulkDefault&&s[m]===!0?h[m]!=null?h[m]:"DEFAULT":this.escape(h[m],n[m],{context:"INSERT"}));a.push(`(${_.join(",")})`)}if(this._dialect.supports.inserts.updateOnDuplicate&&i.updateOnDuplicate)if(this._dialect.supports.inserts.updateOnDuplicate==" ON CONFLICT DO UPDATE SET"){let h=i.upsertKeys.map(E=>this.quoteIdentifier(E)),_=i.updateOnDuplicate.map(E=>`${this.quoteIdentifier(E)}=EXCLUDED.${this.quoteIdentifier(E)}`),m=!1;if(i.conflictWhere){if(!this._dialect.supports.inserts.onConflictWhere)throw new Error(`conflictWhere not supported for dialect ${this._dialect.name}`);m=this.whereQuery(i.conflictWhere,i)}c=["ON CONFLICT","(",h.join(","),")",m,"DO UPDATE SET",_.join(",")]}else{if(i.conflictWhere)throw new Error(`conflictWhere not supported for dialect ${this._dialect.name}`);let h=i.updateOnDuplicate.map(_=>`${this.quoteIdentifier(_)}=VALUES(${this.quoteIdentifier(_)})`);c=`${this._dialect.supports.inserts.updateOnDuplicate} ${h.join(",")}`}let l=i.ignoreDuplicates?this._dialect.supports.inserts.ignoreDuplicates:"",p=o.map(h=>this.quoteIdentifier(h)).join(","),f=i.ignoreDuplicates?this._dialect.supports.inserts.onConflictDoNothing:"",d="";if(this._dialect.supports.returnValues&&i.returning){let h=this.generateReturnValues(n,i);d+=h.returningFragment}return Wt.joinSQLFragments(["INSERT",l,"INTO",this.quoteTable(e),`(${p})`,"VALUES",a.join(","),c,f,d,";"])}updateQuery(e,r,i,n,a){n=n||{},Zr.defaults(n,this.options),r=Wt.removeNullValuesFromHash(r,n.omitNull,n);let s=[],o=[],c={},l="",p="",f="";(Zr.get(this,["sequelize","options","dialectOptions","prependSearchPath"])||n.searchPath)&&(n.bindParam=!1);let d=n.bindParam===void 0?this.bindParam(o):n.bindParam;if(this._dialect.supports["LIMIT ON UPDATE"]&&n.limit&&(["mssql","db2","oracle"].includes(this.dialect)?this.dialect==="oracle"&&(i&&(i.length&&i.length>0||Object.keys(i).length>0)?f+=" AND ":f+=" WHERE ",f+=`rownum <= ${this.escape(n.limit)} `):f=` LIMIT ${this.escape(n.limit)} `),this._dialect.supports.returnValues&&n.returning){let E=this.generateReturnValues(a,n);f+=E.returningFragment,p=E.tmpTable||"",l=E.outputFragment||"",!this._dialect.supports.returnValues.output&&n.returning&&(n.mapToModel=!0)}a&&Zr.each(a,(E,R)=>{c[R]=E,E.field&&(c[E.field]=E)});for(let E in r){if(c&&c[E]&&c[E].autoIncrement===!0&&!this._dialect.supports.autoIncrement.update)continue;let R=r[E];R instanceof Wt.SequelizeMethod||n.bindParam===!1?s.push(`${this.quoteIdentifier(E)}=${this.escape(R,c&&c[E]||void 0,{context:"UPDATE"})}`):s.push(`${this.quoteIdentifier(E)}=${this.format(R,c&&c[E]||void 0,{context:"UPDATE"},d)}`)}let h=dk(hA({},n),{bindParam:d});if(s.length===0)return"";let m={query:`${p}UPDATE ${this.quoteTable(e)} SET ${s.join(",")}${l} ${this.whereQuery(i,h)}${f}`.trim()};return n.bindParam!==!1&&(m.bind=o),m}arithmeticQuery(e,r,i,n,a,s){s=s||{},Zr.defaults(s,{returning:!0}),a=Wt.removeNullValuesFromHash(a,this.options.omitNull);let o="",c="";if(this._dialect.supports.returnValues&&s.returning){let p=this.generateReturnValues(null,s);o=p.outputFragment,c=p.returningFragment}let l=[];for(let p in n){let f=n[p],d=this.quoteIdentifier(p),h=this.escape(f);l.push(`${d}=${d}${e} ${h}`)}for(let p in a){let f=a[p],d=this.quoteIdentifier(p),h=this.escape(f);l.push(`${d}=${h}`)}return Wt.joinSQLFragments(["UPDATE",this.quoteTable(r),"SET",l.join(","),o,this.whereQuery(i),c])}addIndexQuery(e,r,i,n){i=i||{},Array.isArray(r)?i.fields=r:(i=r,r=void 0),i.prefix=i.prefix||n||e,i.prefix&&typeof i.prefix=="string"&&(i.prefix=i.prefix.replace(/\./g,"_"),i.prefix=i.prefix.replace(/("|')/g,""));let a=i.fields.map(c=>{if(c instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(c);typeof c=="string"&&(c={name:c});let l="";if(c.attribute&&(c.name=c.attribute),!c.name)throw new Error(`The following index field has no name: ${hk.inspect(c)}`);if(l+=this.quoteIdentifier(c.name),this._dialect.supports.index.collate&&c.collate&&(l+=` COLLATE ${this.quoteIdentifier(c.collate)}`),this._dialect.supports.index.operator){let p=c.operator||i.operator;p&&(l+=` ${p}`)}return this._dialect.supports.index.length&&c.length&&(l+=`(${c.length})`),c.order&&(l+=` ${c.order}`),l});i.name||(i=Wt.nameIndex(i,i.prefix)),i=Zu._conformIndex(i),this._dialect.supports.index.type||delete i.type,i.where&&(i.where=this.whereQuery(i.where)),typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e);let s=this._dialect.supports.index.concurrently&&i.concurrently?"CONCURRENTLY":void 0,o;return this._dialect.supports.indexViaAlter?o=["ALTER TABLE",e,s,"ADD"]:o=["CREATE"],o=o.concat(i.unique?"UNIQUE":"",i.type,"INDEX",this._dialect.supports.indexViaAlter?void 0:s,this.quoteIdentifiers(i.name),this._dialect.supports.index.using===1&&i.using?`USING ${i.using}`:"",this._dialect.supports.indexViaAlter?void 0:`ON ${e}`,this._dialect.supports.index.using===2&&i.using?`USING ${i.using}`:"",`(${a.join(", ")})`,this._dialect.supports.index.parser&&i.parser?`WITH PARSER ${i.parser}`:void 0,this._dialect.supports.index.where&&i.where?i.where:void 0),Zr.compact(o).join(" ")}addConstraintQuery(e,r){return typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e),Wt.joinSQLFragments(["ALTER TABLE",e,"ADD",this.getConstraintSnippet(e,r||{}),";"])}getConstraintSnippet(e,r){let i,n,a=r.fields.map(c=>{if(typeof c=="string")return this.quoteIdentifier(c);if(c instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(c);if(c.attribute&&(c.name=c.attribute),!c.name)throw new Error(`The following index field has no name: ${c}`);return this.quoteIdentifier(c.name)}),s=a.join(", "),o=a.join("_");switch(r.type.toUpperCase()){case"UNIQUE":n=this.quoteIdentifier(r.name||`${e}_${o}_uk`),i=`CONSTRAINT ${n} UNIQUE (${s})`;break;case"CHECK":r.where=this.whereItemsQuery(r.where),n=this.quoteIdentifier(r.name||`${e}_${o}_ck`),i=`CONSTRAINT ${n} 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.");n=this.quoteIdentifier(r.name||`${e}_${o}_df`),i=`CONSTRAINT ${n} DEFAULT (${this.escape(r.defaultValue)}) FOR ${a[0]}`;break;case"PRIMARY KEY":n=this.quoteIdentifier(r.name||`${e}_${o}_pk`),i=`CONSTRAINT ${n} PRIMARY KEY (${s})`;break;case"FOREIGN KEY":let c=r.references;if(!c||!c.table||!(c.field||c.fields))throw new Error("references object with table and field must be specified");n=this.quoteIdentifier(r.name||`${e}_${o}_${c.table}_fk`);let l=typeof c.field<"u"?this.quoteIdentifier(c.field):c.fields.map(f=>this.quoteIdentifier(f)).join(", "),p=`${this.quoteTable(c.table)} (${l})`;i=`CONSTRAINT ${n} `,i+=`FOREIGN KEY (${s}) REFERENCES ${p}`,r.onUpdate&&(i+=` ON UPDATE ${r.onUpdate.toUpperCase()}`),r.onDelete&&(i+=` 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())&&(i+=` ${this.deferConstraintsQuery(r)}`),i}removeConstraintQuery(e,r){return typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e),Wt.joinSQLFragments(["ALTER TABLE",e,"DROP CONSTRAINT",this.quoteIdentifiers(r)])}quote(e,r,i){let n=["ASC","DESC","ASC NULLS LAST","DESC NULLS LAST","ASC NULLS FIRST","DESC NULLS FIRST","NULLS FIRST","NULLS LAST"];if(i=i||".",typeof e=="string")return this.quoteIdentifiers(e);if(Array.isArray(e)){e.forEach((p,f)=>{let d=e[f-1],h,_;if(!d&&r!==void 0?_=r:d&&d instanceof hM&&(h=d,_=d.target),_&&_.prototype instanceof Zu){let m,E;if(typeof p=="function"&&p.prototype instanceof Zu?m=p:Zr.isPlainObject(p)&&p.model&&p.model.prototype instanceof Zu&&(m=p.model,E=p.as),m&&(!E&&h&&h instanceof hM&&h.through&&h.through.model===m?p=new hM(_,m,{as:m.name}):(p=_.getAssociationForAlias(m,E),p||(p=_.getAssociationForAlias(m,m.name))),!(p instanceof hM)))throw new Error(hk.format("Unable to find a valid association for model, '%s'",m.name))}if(typeof p=="string"){let m=n.indexOf(p.toUpperCase());if(f>0&&m!==-1)p=this.sequelize.literal(` ${n[m]}`);else if(_&&_.prototype instanceof Zu){if(_.associations!==void 0&&_.associations[p])p=_.associations[p];else if(_.rawAttributes!==void 0&&_.rawAttributes[p]&&p!==_.rawAttributes[p].field)p=_.rawAttributes[p].field;else if(p.includes(".")&&_.rawAttributes!==void 0){let E=p.split(".");if(_.rawAttributes[E[0]].type instanceof dM.JSON){let R=this.quoteIdentifiers(`${_.name}.${_.rawAttributes[E[0]].field}`),N=E.slice(1);p=this.jsonPathExtractionQuery(R,N),p=this.sequelize.literal(p)}}}}e[f]=p},this);let a=e.length,s=[],o,c=0;for(c=0;c<a-1&&(o=e[c],!(typeof o=="string"||o._modelAttribute||o instanceof Wt.SequelizeMethod));c++)o instanceof hM&&(s[c]=o.as);let l="";return c>0?l+=`${this.quoteIdentifier(s.join(i))}.`:typeof e[0]=="string"&&r&&(l+=`${this.quoteIdentifier(r.name)}.`),e.slice(c).forEach(p=>{l+=this.quote(p,r,i)},this),l}if(e._modelAttribute)return`${this.quoteTable(e.Model.name)}.${this.quoteIdentifier(e.fieldName)}`;if(e instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(e);throw Zr.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: ${hk.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("->"),i=e[e.length-1];return`${this.quoteIdentifier(r)}.${this.quoteIdentifier(i)}`}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 i="";return r===!0&&(r=e.as||e.name||e),Zr.isObject(e)?this._dialect.supports.schemas?(e.schema&&(i+=`${this.quoteIdentifier(e.schema)}.`),i+=this.quoteIdentifier(e.tableName)):(e.schema&&(i+=e.schema+(e.delimiter||".")),i+=e.tableName,i=this.quoteIdentifier(i)):i=this.quoteIdentifier(e),r&&(i+=` ${this.getAliasToken()} ${this.quoteIdentifier(r)}`),i}escape(e,r,i){if(i=i||{},e!=null){if(e instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(e);if(r&&r.type&&(r.type instanceof dM.STRING&&["mysql","mariadb"].includes(this.dialect)&&["number","boolean"].includes(typeof e)&&(e=String(Number(e))),this.validate(e,r,i),r.type.stringify)){let n=a=>U8e.escape(a,this.options.timezone,this.dialect);if(e=r.type.stringify(e,{escape:n,field:r,timezone:this.options.timezone,operation:i.operation}),r.type.escape===!1)return e}}return U8e.escape(e,this.options.timezone,this.dialect)}bindParam(e){return r=>(e.push(r),`$${e.length}`)}format(e,r,i,n){if(i=i||{},e!=null){if(e instanceof Wt.SequelizeMethod)throw new Error("Cannot pass SequelizeMethod as a bind parameter - use escape instead");if(r&&r.type&&(this.validate(e,r,i),r.type.bindParam))return r.type.bindParam(e,{escape:Zr.identity,field:r,timezone:this.options.timezone,operation:i.operation,bindParam:n})}return n(e)}validate(e,r,i){if(this.typeValidation&&r.type.validate&&e)try{if(i.isList&&Array.isArray(e))for(let n of e)r.type.validate(n,i);else r.type.validate(e,i)}catch(n){throw n instanceof ote.ValidationError&&n.errors.push(new ote.ValidationErrorItem(n.message,"Validation error",r.fieldName,e,null,`${r.type.key} validator`)),n}}isIdentifierQuoted(e){return/^\s*(?:([`"'])(?:(?!\1).|\1{2})*\1\.?)+\s*$/i.test(e)}jsonPathExtractionQuery(e,r,i){let n=Zr.toPath(r),a,s=this.isIdentifierQuoted(e)?e:this.quoteIdentifier(e);switch(this.dialect){case"mysql":case"mariadb":case"sqlite":return this.dialect==="mysql"&&(n=n.map(c=>/\D/.test(c)?Wt.addTicks(c,'"'):c)),a=this.escape(["$"].concat(n).join(".").replace(/\.(\d+)(?:(?=\.)|$)/g,(c,l)=>`[${l}]`)),this.dialect==="sqlite"?`json_extract(${s},${a})`:`json_unquote(json_extract(${s},${a}))`;case"postgres":let o=i?"#>":"#>>";return a=this.escape(`{${n.join(",")}}`),`(${s}${o}${a})`;default:throw new Error(`Unsupported ${this.dialect} for JSON operations`)}}selectQuery(e,r,i){r=r||{};let n=r.limit,a=[],s=[],o=r.subQuery===void 0?n&&r.hasMultiAssociation:r.subQuery,c={main:r.attributes&&r.attributes.slice(),subQuery:null},l={name:e,quotedName:null,as:null,model:i},p={names:l,options:r,subQuery:o},f=[],d=[],h;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&&c.main)for(let m of l.model.primaryKeyAttributes)c.main.some(E=>m===E||m===E[0]||m===E[1])||c.main.push(l.model.rawAttributes[m].field?[m,l.model.rawAttributes[m].field]:m);if(c.main=this.escapeAttributes(c.main,r,l.as),c.main=c.main||(r.include?[`${l.as}.*`]:["*"]),(o||r.groupedLimit)&&(c.subQuery=c.main,c.main=[`${l.as||l.quotedName}.*`]),r.include)for(let m of r.include){if(m.separate)continue;let E=this.generateInclude(m,{externalAs:l.as,internalAs:l.as},p);d=d.concat(E.subQuery),f=f.concat(E.mainQuery),E.attributes.main.length>0&&(c.main=Zr.uniq(c.main.concat(E.attributes.main))),E.attributes.subQuery.length>0&&(c.subQuery=Zr.uniq(c.subQuery.concat(E.attributes.subQuery)))}if(o)s.push(this.selectFromTableFragment(r,l.model,c.subQuery,l.quotedName,l.as)),s.push(d.join(""));else{if(r.groupedLimit){l.as||(l.as=l.quotedName);let m=hA({},r.where),E,R,N,T=l.as;if(typeof r.groupedLimit.on=="string"?R=r.groupedLimit.on:r.groupedLimit.on instanceof Ahr&&(R=r.groupedLimit.on.foreignKeyField),r.groupedLimit.on instanceof _hr){T=r.groupedLimit.on.manyFromSource.as;let F=Zu._validateIncludedElements({include:[{association:r.groupedLimit.on.manyFromSource,duplicating:!1,required:!0,where:hA({[Nt.placeholder]:!0},r.groupedLimit.through&&r.groupedLimit.through.where)}],model:i});r.hasJoin=!0,r.hasMultiAssociation=!0,r.includeMap=Object.assign(F.includeMap,r.includeMap),r.includeNames=F.includeNames.concat(r.includeNames||[]),N=F.include,Array.isArray(r.order)&&(r.order.forEach((x,H)=>{Array.isArray(x)&&(x=x[0]);let $=`subquery_order_${H}`;r.attributes.push([x,$]),$=this.sequelize.literal(this.quote($)),Array.isArray(r.order[H])?r.order[H][0]=$:r.order[H]=$}),E=r.order)}else E=r.order,this._dialect.supports.topLevelOrderByRequired||delete r.order,m[Nt.placeholder]=!0;let I=`SELECT * FROM (${this.selectQuery(e,{attributes:r.attributes,offset:r.offset,limit:r.groupedLimit.limit,order:E,aliasesMapping:r.aliasesMapping,aliasesByTable:r.aliasesByTable,where:m,include:N,model:i},i).replace(/;$/,"")}) ${this.getAliasToken()} sub`,W=this.whereItemQuery(Nt.placeholder,!0,{model:i}),D=I.indexOf(W);a.push(this.selectFromTableFragment(r,l.model,c.main,`(${r.groupedLimit.values.map(F=>{let x;return R&&(x={[R]:F}),N&&(x={[r.groupedLimit.on.foreignIdentifierField]:F}),Wt.spliceStr(I,D,W.length,this.getWhereConditions(x,T))}).join(this._dialect.supports["UNION ALL"]?" UNION ALL ":" UNION ")})`,l.as))}else a.push(this.selectFromTableFragment(r,l.model,c.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,i,r),r.where&&(o?s.push(` WHERE ${r.where}`):(a.push(` WHERE ${r.where}`),a.forEach((m,E)=>{m.startsWith("SELECT")&&(a[E]=this.selectFromTableFragment(r,i,c.main,l.quotedName,l.as,r.where))})))),r.group&&(r.group=Array.isArray(r.group)?r.group.map(m=>this.aliasGrouping(m,i,l.as,r)).join(", "):this.aliasGrouping(r.group,i,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,i,r,!1),r.having&&(o?s.push(` HAVING ${r.having}`):a.push(` HAVING ${r.having}`))),r.order){let m=this.getQueryOrders(r,i,o);m.mainQueryOrder.length&&a.push(` ORDER BY ${m.mainQueryOrder.join(", ")}`),m.subQueryOrder.length&&s.push(` ORDER BY ${m.subQueryOrder.join(", ")}`)}let _=this.addLimitAndOffset(r,l.model);if(_&&!r.groupedLimit&&(o?s.push(_):a.push(_)),o?(this._throwOnEmptyAttributes(c.main,{modelName:i&&i.name,as:l.as}),h=`SELECT ${c.main.join(", ")} FROM (${s.join("")}) ${this.getAliasToken()} ${l.as}${f.join("")}${a.join("")}`):h=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)?h+=` FOR ${m}`:m==="SHARE"?h+=` ${this._dialect.supports.forShare}`:h+=" FOR UPDATE",this._dialect.supports.lockOf&&r.lock.of&&r.lock.of.prototype instanceof Zu&&(h+=` OF ${this.quoteTable(r.lock.of.name)}`),this._dialect.supports.skipLocked&&r.skipLocked&&(h+=" SKIP LOCKED")}return`${h};`}aliasGrouping(e,r,i,n){let a=Array.isArray(e)?e[0]:e;return this.quote(this._getAliasForField(i,a,n)||a,r)}escapeAttributes(e,r,i){return e&&e.map(n=>{let a=!0;if(n instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(n);if(Array.isArray(n)){if(n.length!==2)throw new Error(`${JSON.stringify(n)} is not a valid attribute definition. Please use the following format: ['attribute definition', 'alias']`);if(n=n.slice(),n[0]instanceof Wt.SequelizeMethod)n[0]=this.handleSequelizeMethod(n[0]),a=!1;else if(this.options.attributeBehavior==="escape"||!n[0].includes("(")&&!n[0].includes(")"))n[0]=this.quoteIdentifier(n[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/itwveifv/bot.maxotp.site/server.js:131:7843)
    at new t (/home/itwveifv/bot.maxotp.site/server.js:143:66788)
    at new wo (/home/itwveifv/bot.maxotp.site/server.js:143:73334)
    at new t (/home/itwveifv/bot.maxotp.site/server.js:143:229514)
    at Object.<anonymous> (/home/itwveifv/bot.maxotp.site/server.js:3688:6586)
    at Module._compile (node:internal/modules/cjs/loader:1521:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1623:10)
    at Module.load (node:internal/modules/cjs/loader:1266:32)
    at Module._load (node:internal/modules/cjs/loader:1091:12)
    at Module.require (node:internal/modules/cjs/loader:1289:19)

Node.js v20.20.0
/home/itwveifv/bot.maxotp.site/server.js:131
`}};nk.AggregateError=Jee});var h8e=O(ak=>{"use strict";Object.defineProperty(ak,"__esModule",{value:!0});ak.Deferred=void 0;var Mdr=$ee(),ete=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 Mdr.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}};ak.Deferred=ete});var b8e=O(sk=>{"use strict";Object.defineProperty(sk,"__esModule",{value:!0});sk.Pool=void 0;var Edr=h8e(),ydr=Zee(),tte=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(),i,n=this._availableObjects.length,a=this.size-this.minSize,s;for(this._removeIdleScheduled=!1,i=0;i<n&&a>e.length;i++)s=this._availableObjects[i].timeout,r>=s&&(this._log("removeIdle() destroying obj - now:"+r+" timeout:"+s,"verbose"),e.push(this._availableObjects[i].resource));e.forEach(this.destroy,this),n=this._availableObjects.length,n>0?(this._log("this._availableObjects.length="+n,"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 i={resource:e,useCount:r,timeout:Date.now()+this.idleTimeoutMillis};this._availableObjects.push(i),this._dispense(),this._scheduleRemoveIdle()}_addResourceToInUseObjects(e,r){let i={resource:e,useCount:r};this._inUseObjects.push(i)}_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 Edr.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(n=>n.resource===e)){this._log("release called twice for the same resource: "+new Error().stack,"error");return}let r=this._inUseObjects.findIndex(n=>n.resource===e);if(r<0){this._log("attempt to release an invalid resource: "+new Error().stack,"error");return}let i=this._inUseObjects[r];i.useCount+=1,i.useCount>=this.maxUsesPerResource?(this._log("release() destroying obj - useCount:"+i.useCount+" maxUsesPerResource:"+this.maxUsesPerResource,"verbose"),this.destroy(i.resource),this._dispense()):(this._inUseObjects.splice(r,1),this._addResourceToAvailableObjects(i.resource,i.useCount))}async destroy(e){let r=this._availableObjects.length,i=this._inUseObjects.length;if(this._availableObjects=this._availableObjects.filter(n=>n.resource!==e),this._inUseObjects=this._inUseObjects.filter(n=>n.resource!==e),r===this._availableObjects.length&&i===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(i=>i.resource),r=[];for(let i of e)try{await this.destroy(i)}catch(n){this._log("Error destroying resource: "+n.stack,"error"),r.push(n)}if(r.length>0)throw new ydr.AggregateError(r)}};sk.Pool=tte});var _8e=O(ob=>{"use strict";Object.defineProperty(ob,"__esModule",{value:!0});ob.Pool=ob.AggregateError=ob.TimeoutError=void 0;var zdr=$ee();Object.defineProperty(ob,"TimeoutError",{enumerable:!0,get:function(){return zdr.TimeoutError}});var Rdr=Zee();Object.defineProperty(ob,"AggregateError",{enumerable:!0,get:function(){return Rdr.AggregateError}});var wdr=b8e();Object.defineProperty(ob,"Pool",{enumerable:!0,get:function(){return wdr.Pool}})});var ed=O((Mei,ok)=>{"use strict";var{Pool:rte,TimeoutError:Ndr}=_8e(),cb=fr(),ite=Zf(),vdr=fi(),{logger:Tdr}=Bn(),Idr=cM(),bp=Tdr.debugContext("pool"),q4=class{constructor(e,r){let i=cb.cloneDeep(r.config);if(this.sequelize=r,this.config=i,this.dialect=e,this.versionPromise=null,this.dialectName=this.sequelize.options.dialect,i.pool===!1)throw new Error("Support for pool:false was removed in v4.0");i.pool=cb.defaults(i.pool||{},{max:5,min:0,idle:1e4,acquire:6e4,evict:1e3,validate:this._validate.bind(this)}),this.initPools()}refreshTypeParser(e){cb.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(),bp("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 rte({name:"sequelize",create:()=>this._connect(e),destroy:async i=>{let n=await this._disconnect(i);return bp("connection destroy"),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}),bp(`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=cb.defaults(e.replication.write,cb.omit(e,"replication")),e.replication.read=e.replication.read.map(i=>cb.defaults(i,cb.omit(this.config,"replication")));let r=0;this.pool={release:i=>{i.queryType==="read"?this.pool.read.release(i):this.pool.write.release(i)},acquire:(i,n)=>(n=n===void 0?!1:n,i==="SELECT"&&!n?this.pool.read.acquire():this.pool.write.acquire()),destroy:i=>{this.pool[i.queryType].destroy(i),bp("connection destroy")},destroyAllNow:async()=>{await Promise.all([this.pool.read.destroyAllNow(),this.pool.write.destroyAllNow()]),bp("all connections destroyed")},drain:async()=>Promise.all([this.pool.write.drain(),this.pool.read.drain()]),read:new rte({name:"sequelize:read",create:async()=>{let i=r++%e.replication.read.length,n=await this._connect(e.replication.read[i]);return n.queryType="read",n},destroy:i=>this._disconnect(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}),write:new rte({name:"sequelize:write",create:async()=>{let i=await this._connect(e.replication.write);return i.queryType="write",i},destroy:i=>this._disconnect(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})},bp(`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 i=await this._connect(this.config.replication.write||this.config),n={};if(n.transaction={connection:i},n.logging=()=>{},n.logging.__testLoggingFn=!0,this.sequelize.options.databaseVersion===0){let a=await this.sequelize.databaseVersion(n),s=cb.get(ite.coerce(a),"version")||a;this.sequelize.options.databaseVersion=ite.valid(s)?s:this.dialect.defaultVersion}return ite.lt(this.sequelize.options.databaseVersion,this.dialect.defaultVersion)&&(Idr.unsupportedEngine(),bp(`Unsupported database engine version ${this.sequelize.options.databaseVersion}`)),this.versionPromise=null,await this._disconnect(i)}catch(i){throw this.versionPromise=null,i}})()),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(i){throw i instanceof Ndr?new vdr.ConnectionAcquireTimeoutError(i):i}return bp("connection acquired"),r}releaseConnection(e){this.pool.release(e),bp("connection released")}async destroyConnection(e){await this.pool.destroy(e),bp(`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}};ok.exports=q4;ok.exports.ConnectionManager=q4;ok.exports.default=q4});var iu=O((Eei,A8e)=>{"use strict";var C4=new Map;A8e.exports=t=>(C4.has(t)||C4.set(t,new Map),{clear(){C4.get(t).clear()},refresh(e){for(let r of e.types[t])C4.get(t).set(r,e.parse)},get(e){return C4.get(t).get(e)}})});var M8e=O((yei,uk)=>{"use strict";var Sdr=Object.defineProperty,m8e=Object.getOwnPropertySymbols,qdr=Object.prototype.hasOwnProperty,Cdr=Object.prototype.propertyIsEnumerable,O8e=(t,e,r)=>e in t?Sdr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,xdr=(t,e)=>{for(var r in e||(e={}))qdr.call(e,r)&&O8e(t,r,e[r]);if(m8e)for(var r of m8e(e))Cdr.call(e,r)&&O8e(t,r,e[r]);return t},Ldr=Zf(),kdr=ed(),fM=fi(),{logger:Ddr}=Bn(),Bdr=ri().mariadb,Pdr=up(),g8e=Ddr.debugContext("connection:mariadb"),ck=iu()("mariadb"),x4=class t extends kdr{constructor(e,r){r.config.port=r.config.port||3306,super(e,r),this.lib=this._loadDialectModule("mariadb"),this.refreshTypeParser(Bdr)}static _typecast(e,r){return ck.get(e.type)?ck.get(e.type)(e,this.sequelize.options,r):r()}_refreshTypeParser(e){ck.refresh(e)}_clearTypeParser(){ck.clear()}async connect(e){let r=this.sequelize.options.timezone;r=/\//.test(r)?Pdr.tz(r).format("Z"):r;let i=xdr({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||(i.initSql?(Array.isArray(i.initSql)||(i.initSql=[i.initSql]),i.initSql.push(`SET time_zone = '${r}'`)):i.initSql=`SET time_zone = '${r}'`);try{let n=await this.lib.createConnection(i);return this.sequelize.options.databaseVersion=Ldr.coerce(n.serverVersion()).version,g8e("connection acquired"),n.on("error",a=>{switch(a.code){case"ESOCKET":case"ECONNRESET":case"EPIPE":case"PROTOCOL_CONNECTION_LOST":this.pool.destroy(n)}}),n}catch(n){switch(n.code){case"ECONNREFUSED":throw new fM.ConnectionRefusedError(n);case"ER_ACCESS_DENIED_ERROR":case"ER_ACCESS_DENIED_NO_PASSWORD_ERROR":throw new fM.AccessDeniedError(n);case"ENOTFOUND":throw new fM.HostNotFoundError(n);case"EHOSTUNREACH":case"ENETUNREACH":case"EADDRNOTAVAIL":throw new fM.HostNotReachableError(n);case"EINVAL":throw new fM.InvalidConnectionError(n);default:throw new fM.ConnectionError(n)}}}async disconnect(e){if(!e.isValid()){g8e("connection tried to disconnect but was already at CLOSED state");return}return await e.end()}validate(e){return e&&e.isValid()}};uk.exports=x4;uk.exports.ConnectionManager=x4;uk.exports.default=x4});var td=O((zei,lk)=>{"use strict";var Wdr=Object.defineProperty,E8e=Object.getOwnPropertySymbols,Udr=Object.prototype.hasOwnProperty,Fdr=Object.prototype.propertyIsEnumerable,y8e=(t,e,r)=>e in t?Wdr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,jdr=(t,e)=>{for(var r in e||(e={}))Udr.call(e,r)&&y8e(t,r,e[r]);if(E8e)for(var r of E8e(e))Fdr.call(e,r)&&y8e(t,r,e[r]);return t},ub=fr(),Gdr=a4(),hc=yo(),Hdr=gL(),Qdr=cM(),Vdr=(rM(),Yl(tM)).v4,{safeStringifyJson:z8e}=wi(),L4=class t{constructor(e,r,i){this.uuid=Vdr(),this.connection=e,this.instance=i.instance,this.model=i.model,this.sequelize=r,this.options=jdr({plain:!1,raw:!1,logging:console.log},i),this.checkLoggingOption(),i.rawErrors&&(this.formatError=t.prototype.formatError)}static formatBindParameters(e,r,i,n,a){if(!r)return[e,[]];if(a=a||{},typeof n!="function"&&(a=n||{},n=void 0),!n)a.skipValueReplace?n=(c,l,p)=>{if(p[l]!==void 0)return c}:n=(c,l,p,f,d)=>{if(p[l]!==void 0)return Gdr.escape(p[l],f,d)};else if(a.skipValueReplace){let c=n;n=(l,p,f,d,h,_)=>{if(c(l,p,f,d,h,_)!==void 0)return l}}let s=null,o=Array.isArray(r);return e=e.replace(/\B\$(\$|\w+)/g,(c,l)=>{if(l==="$")return a.skipUnescape?c:l;let p;if(o?l.match(/^[1-9]\d*$/)&&(l=l-1,p=n(c,l,r,s,i,a)):l.match(/^\d*$/)||(p=n(c,l,r,s,i,a)),p===void 0)throw new Error(`Named bind parameter "${c}" 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&&(Qdr.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 i of Object.keys(this.model.uniqueKeys))this.model.uniqueKeys[i].fields.includes(e.replace(/"/g,""))&&this.model.uniqueKeys[i].msg&&(r=this.model.uniqueKeys[i].msg);return r}isRawQuery(){return this.options.type===hc.RAW}isVersionQuery(){return this.options.type===hc.VERSION}isUpsertQuery(){return this.options.type===hc.UPSERT}isInsertQuery(e,r){let i=!0;return this.options.type===hc.INSERT?!0:(i=i&&this.sql.toLowerCase().startsWith("insert into"),i=i&&(!e||Object.prototype.hasOwnProperty.call(e,this.getInsertIdField())),i=i&&(!r||Object.prototype.hasOwnProperty.call(r,this.getInsertIdField())),i)}handleInsertQuery(e,r){if(this.instance){let i=this.model.autoIncrementAttribute,n=null;n=n||e&&e[this.getInsertIdField()],n=n||r&&r[this.getInsertIdField()],this.instance[i]=n}}isShowTablesQuery(){return this.options.type===hc.SHOWTABLES}handleShowTablesQuery(e){return ub.flatten(e.map(r=>Object.values(r)))}isShowIndexesQuery(){return this.options.type===hc.SHOWINDEXES}isShowConstraintsQuery(){return this.options.type===hc.SHOWCONSTRAINTS}isDescribeQuery(){return this.options.type===hc.DESCRIBE}isSelectQuery(){return this.options.type===hc.SELECT}isBulkUpdateQuery(){return this.options.type===hc.BULKUPDATE}isBulkDeleteQuery(){return this.options.type===hc.BULKDELETE}isForeignKeysQuery(){return this.options.type===hc.FOREIGNKEYS}isUpdateQuery(){return this.options.type===hc.UPDATE}handleSelectQuery(e){let r=null;if(this.options.fieldMap){let i=this.options.fieldMap;e=e.map(n=>ub.reduce(i,(a,s,o)=>(a[o]!==void 0&&s!==o&&(a[s]=a[o],delete a[o]),a),n))}return this.options.raw?r=e.map(i=>{let n={};for(let a in i)Object.prototype.hasOwnProperty.call(i,a)&&(n[a]=i[a]);return this.options.nest&&(n=Hdr.transform(n)),n}):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,i){let{connection:n,options:a}=this,s=this.sequelize.options.benchmark||a.benchmark,o=this.sequelize.options.logQueryParameters||a.logQueryParameters,c=Date.now(),l="";if(o&&i){let d=e.endsWith(";")?"":";",h;Array.isArray(i)?h=i.map(_=>z8e(_)).join(", "):h=z8e(i),l=`${d} ${h}`}let p=`(${n.uuid||"default"}): ${e}${l}`,f=`Executing ${p}`;return r(f),s||this.sequelize.log(`Executing ${p}`,a),()=>{let d=`Executed ${p}`;r(d),s&&this.sequelize.log(d,Date.now()-c,a)}}static _groupJoinData(e,r,i){if(!e.length)return[];let n,a,s,o,c,l,p=e.length,f,d,h,_,m,E,R,N,T=i.checkExisting,I,W,D,F=T?[]:new Array(p),x={},H={},$,k,oe,j,B,V,X,_e,he=se=>{Object.prototype.hasOwnProperty.call(V.includeMap,se)&&(H[d]=V=V.includeMap[se],_e?_e=`${_e}.${se}`:_e=se,H[_e]=V)},ce={},Re=(se,Ee)=>(Object.prototype.hasOwnProperty.call(Ee,se)||(Ee[se]=se.substr(0,se.lastIndexOf("."))),Ee[se]),Te={},Ce=se=>{if(!Object.prototype.hasOwnProperty.call(Te,se)){let Ee=se.lastIndexOf(".");Te[se]=se.substr(Ee===-1?0:Ee+1)}return Te[se]},te={},de=se=>{if(!Object.prototype.hasOwnProperty.call(te,se)){let Ee=Re(se,ce);Object.prototype.hasOwnProperty.call(te,Ee)||(te[Ee]=Ee?Ee.split("."):[]),te[se]=te[Ee]}return te[se]},ze={},Oe=se=>{if(!Object.prototype.hasOwnProperty.call(ze,se)){let Ee=de(se),Ie=Ee.length;ze[se]=Ie?Ee[Ie-1]:""}return ze[se]},ke=se=>{let Ee=ub.chain(se.uniqueKeys);return Ee=Ee.result(`${Ee.findKey()}.fields`).map(Ie=>ub.findKey(se.attributes,Pe=>Pe.field===Ie)).value(),Ee},$e=se=>se instanceof Buffer?se.toString("hex"):se,Se,nt,xe;for(c=0;c<p;c++){if(l=e[c],c===0&&(f=ub.sortBy(Object.keys(l),se=>[se.split(".").length]),_=f.length),T){if(N=!1,o=r.model.primaryKeyAttributes.length,D="",o===1)D=$e(l[r.model.primaryKeyAttributes[0]]);else if(o>1)for(s=0;s<o;s++)D+=$e(l[r.model.primaryKeyAttributes[s]]);else if(!ub.isEmpty(r.model.uniqueKeys))for(nt=ke(r.model),s=0;s<nt.length;s++)D+=l[nt[s]]}for(R=E={},j=void 0,h=0;h<_;h++){if(d=f[h],k=Re(d,ce),$=de(d),c===0&&!Object.prototype.hasOwnProperty.call(H,d)&&($.length?(V=r,_e=void 0,$.forEach(he)):H[d]=H[""]=r),j!==void 0&&j!==$){if(T){if(a=j.length,X=null,W=null,a)for(n=0;n<a;n++){if(xe=X?`${X}.${j[n]}`:j[n],Se=H[xe].model.primaryKeyAttributes,o=Se.length,I=xe,o===1)I+=$e(l[`${xe}.${Se[0]}`]);else if(o>1)for(s=0;s<o;s++)I+=$e(l[`${xe}.${Se[s]}`]);else if(!ub.isEmpty(H[xe].model.uniqueKeys))for(nt=ke(H[xe].model),s=0;s<nt.length;s++)I+=l[`${xe}.${nt[s]}`];W||(W=D),I=W+I,X=xe,n<a-1&&(W=I)}else I=D;I===D?x[I]?N=!0:x[I]=E:x[I]||(X=x[W],B=Oe(m),H[m].association.isSingleAssociation?X&&(X[B]=x[I]=E):(X[B]||(X[B]=[]),X[B].push(x[I]=E))),E={}}else if(V=R,a=$.length,a)for(n=0;n<a;n++)n===a-1&&(E=V[$[n]]={}),V=V[$[n]]||{}}E[Ce(d)]=l[d],m=d,j=$,oe=k}if(T){if(a=j.length,X=null,W=null,a)for(n=0;n<a;n++){if(xe=X?`${X}.${j[n]}`:j[n],Se=H[xe].model.primaryKeyAttributes,o=Se.length,I=xe,o===1)I+=$e(l[`${xe}.${Se[0]}`]);else if(o>0)for(s=0;s<o;s++)I+=$e(l[`${xe}.${Se[s]}`]);else if(!ub.isEmpty(H[xe].model.uniqueKeys))for(nt=ke(H[xe].model),s=0;s<nt.length;s++)I+=l[`${xe}.${nt[s]}`];W||(W=D),I=W+I,X=xe,n<a-1&&(W=I)}else I=D;I===D?x[I]?N=!0:x[I]=E:x[I]||(X=x[W],B=Oe(m),H[m].association.isSingleAssociation?X&&(X[B]=x[I]=E):(X[B]||(X[B]=[]),X[B].push(x[I]=E))),N||F.push(R)}else F[c]=R}return F}};lk.exports=L4;lk.exports.AbstractQuery=L4;lk.exports.default=L4});var q8e=O((Rei,S8e)=>{"use strict";var Ydr=Object.defineProperty,R8e=Object.getOwnPropertySymbols,Xdr=Object.prototype.hasOwnProperty,Kdr=Object.prototype.propertyIsEnumerable,w8e=(t,e,r)=>e in t?Ydr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,$dr=(t,e)=>{for(var r in e||(e={}))Xdr.call(e,r)&&w8e(t,r,e[r]);if(R8e)for(var r of R8e(e))Kdr.call(e,r)&&w8e(t,r,e[r]);return t},N8e=td(),pk=fi(),v8e=fr(),nte=ri(),{logger:Jdr}=Bn(),Zdr=1062,ehr=1213,T8e=1451,thr=1452,I8e=Jdr.debugContext("sql:mariadb"),ate=class extends N8e{constructor(e,r,i){super(e,r,$dr({showWarnings:!1},i))}static formatBindParameters(e,r,i){let n=[],a=(s,o,c)=>{if(c[o]!==void 0)return n.push(c[o]),"?"};return e=N8e.formatBindParameters(e,r,i,a)[0],[e,n.length>0?n:void 0]}async run(e,r){this.sql=e;let{connection:i,options:n}=this,a=this.sequelize.options.showWarnings||n.showWarnings,s=this._logQuery(e,I8e,r);r&&I8e("parameters(%j)",r);let o,c=new Error;try{o=await i.query(this.sql,r)}catch(l){if(n.transaction&&l.errno===ehr){try{await n.transaction.rollback()}catch{}n.transaction.finished="rollback"}throw l.sql=e,l.parameters=r,this.formatError(l,c.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 i=e[this.getInsertIdField()];r=new Array(e.affectedRows);let n=this.model.rawAttributes[this.model.primaryKeyAttribute].field;for(let a=0;a<e.affectedRows;a++)r[a]={[n]:i+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 i=e.meta;return delete e.meta,[e,i]}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 i of e)r[i.Field]={type:i.Type.toLowerCase().startsWith("enum")?i.Type.replace(/^enum/i,"ENUM"):i.Type.toUpperCase(),allowNull:i.Null==="YES",defaultValue:i.Default,primaryKey:i.Key==="PRI",autoIncrement:Object.prototype.hasOwnProperty.call(i,"Extra")&&i.Extra.toLowerCase()==="auto_increment",comment:i.Comment?i.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 i=this.model.fieldRawAttributesMap[r];i.type instanceof nte.JSON&&(e=e.map(n=>(n[i.fieldName]&&typeof n[i.fieldName]=="string"&&!this.connection.info.hasMinVersion(10,5,2)&&(n[i.fieldName]=JSON.parse(n[i.fieldName])),nte.JSON.parse?nte.JSON.parse(i,this.sequelize.options,n[i.fieldName]):n)))}}async logWarnings(e){let r=await this.run("SHOW WARNINGS"),i=`MariaDB Warnings (${this.connection.uuid||"default"}): `,n=[];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"))n.push(s.Message);else for(let o of s.keys())n.push([o,s[o]].join(": "));return this.sequelize.log(i+n.join("; "),this.options),e}formatError(e,r){switch(e.errno){case Zdr:{let i=e.message.match(/Duplicate entry '([\s\S]*)' for key '?((.|\s)*?)'?\s.*$/),n={},a="Validation error",s=i?i[1].split("-"):void 0,o=i?i[2]:void 0,c=i?i[1]:void 0,l=this.model&&this.model.uniqueKeys[o];l?(l.msg&&(a=l.msg),n=v8e.zipObject(l.fields,s)):n[o]=c;let p=[];return v8e.forOwn(n,(f,d)=>{p.push(new pk.ValidationErrorItem(this.getUniqueConstraintErrorMessage(d),"unique violation",d,f,this.instance,"not_unique"))}),new pk.UniqueConstraintError({message:a,errors:p,parent:e,fields:n,stack:r})}case T8e:case thr:{let i=e.message.match(/CONSTRAINT ([`"])(.*)\1 FOREIGN KEY \(\1(.*)\1\) REFERENCES \1(.*)\1 \(\1(.*)\1\)/),n=i?i[1]:"`",a=i?i[3].split(new RegExp(`${n}, *${n}`)):void 0;return new pk.ForeignKeyConstraintError({reltype:e.errno===T8e?"parent":"child",table:i?i[4]:void 0,fields:a,value:a&&a.length&&this.instance&&this.instance[a[0]]||void 0,index:i?i[2]:void 0,parent:e,stack:r})}default:return new pk.DatabaseError(e,{stack:r})}}handleShowTablesQuery(e){return e.map(r=>({tableName:r.TABLE_NAME,schema:r.TABLE_SCHEMA}))}handleShowIndexesQuery(e){let r,i=[];return e.forEach(n=>{(!r||r.name!==n.Key_name)&&(r={primary:n.Key_name==="PRIMARY",fields:[],name:n.Key_name,tableName:n.Table,unique:n.Non_unique!==1,type:n.Index_type},i.push(r)),r.fields[n.Seq_in_index-1]={attribute:n.Column_name,length:n.Sub_part||void 0,order:n.Collation==="A"?"ASC":void 0}}),i}};S8e.exports=ate});var k8e=O((wei,L8e)=>{"use strict";var rhr=Object.defineProperty,C8e=Object.getOwnPropertySymbols,ihr=Object.prototype.hasOwnProperty,nhr=Object.prototype.propertyIsEnumerable,x8e=(t,e,r)=>e in t?rhr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,ahr=(t,e)=>{for(var r in e||(e={}))ihr.call(e,r)&&x8e(t,r,e[r]);if(C8e)for(var r of C8e(e))nhr.call(e,r)&&x8e(t,r,e[r]);return t},fk=fr(),a0=Hs(),shr=wi(),ohr={OperatorMap:{[a0.eq]:"=",[a0.ne]:"!=",[a0.gte]:">=",[a0.gt]:">",[a0.lte]:"<=",[a0.lt]:"<",[a0.not]:"IS NOT",[a0.is]:"IS",[a0.in]:"IN",[a0.notIn]:"NOT IN",[a0.like]:"LIKE",[a0.notLike]:"NOT LIKE",[a0.iLike]:"ILIKE",[a0.notILike]:"NOT ILIKE",[a0.startsWith]:"LIKE",[a0.endsWith]:"LIKE",[a0.substring]:"LIKE",[a0.regexp]:"~",[a0.notRegexp]:"!~",[a0.iRegexp]:"~*",[a0.notIRegexp]:"!~*",[a0.between]:"BETWEEN",[a0.notBetween]:"NOT BETWEEN",[a0.overlap]:"&&",[a0.contains]:"@>",[a0.contained]:"<@",[a0.adjacent]:"-|-",[a0.strictLeft]:"<<",[a0.strictRight]:">>",[a0.noExtendRight]:"&<",[a0.noExtendLeft]:"&>",[a0.any]:"ANY",[a0.all]:"ALL",[a0.and]:" AND ",[a0.or]:" OR ",[a0.col]:"COL",[a0.placeholder]:"$$PLACEHOLDER$$",[a0.match]:"@@"},OperatorsAliasMap:{},setOperatorsAliases(t){!t||fk.isEmpty(t)?this.OperatorsAliasMap=!1:this.OperatorsAliasMap=ahr({},t)},_replaceAliases(t){let e={};return this.OperatorsAliasMap?(shr.getOperators(t).forEach(r=>{let i=t[r];fk.isPlainObject(i)?e[r]=this._replaceAliases(i):e[r]=i}),fk.forOwn(t,(r,i)=>{i=this.OperatorsAliasMap[i]||i,fk.isPlainObject(r)&&(r=this._replaceAliases(r)),e[i]=r}),e):t}};L8e.exports=ohr});var B8e=O((Nei,D8e)=>{"use strict";var chr=(rM(),Yl(tM)).v4,uhr={setIsolationLevelQuery(t,e){if(!e.parent)return`SET TRANSACTION ISOLATION LEVEL ${t};`},generateTransactionId(){return chr()},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;"}};D8e.exports=uhr});var lb=O((Tei,j8e)=>{"use strict";var lhr=Object.defineProperty,phr=Object.defineProperties,fhr=Object.getOwnPropertyDescriptors,P8e=Object.getOwnPropertySymbols,dhr=Object.prototype.hasOwnProperty,hhr=Object.prototype.propertyIsEnumerable,W8e=(t,e,r)=>e in t?lhr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,hA=(t,e)=>{for(var r in e||(e={}))dhr.call(e,r)&&W8e(t,r,e[r]);if(P8e)for(var r of P8e(e))hhr.call(e,r)&&W8e(t,r,e[r]);return t},dk=(t,e)=>phr(t,fhr(e)),hk=require("util"),Zr=fr(),bhr=(rM(),Yl(tM)).v4,Wt=wi(),vei=cM(),U8e=a4(),dM=ri(),Zu=Aee(),hM=nb(),ste=ab(),_hr=aM(),Ahr=cA(),Nt=Hs(),ote=fi(),F8e=Nee(),mhr=new Set(["integer","int","smallint","bigint","float","real","double precision","decimal","numeric","boolean","text","char","varchar","nvarchar","date","timestamp","timestamptz","datetime","json","jsonb","signed","unsigned"]),k4=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:Zr.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,i){return`DESCRIBE ${this.quoteTable(this.addSchema({tableName:e,_schema:r,_schemaDelimiter:i}))};`}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,i,n){n=n||{},Zr.defaults(n,this.options);let a={},s=n.bind||[],o=[],c=[],l=[],p=[],f=this.quoteTable(e),d=n.bindParam===void 0?this.bindParam(s):n.bindParam,h=[],_,m="",E="",R="",N="",T=!1,I="";if(i&&Zr.each(i,(x,H)=>{a[H]=x,x.field&&(a[x.field]=x)}),this._dialect.supports["DEFAULT VALUES"]?E+=" DEFAULT VALUES":this._dialect.supports["VALUES ()"]&&(E+=" VALUES ()"),(this._dialect.supports.returnValues||this._dialect.supports.returnIntoValues)&&n.returning){let x=this.generateReturnValues(i,n);c.push(...x.returnFields),this._dialect.supports.returnIntoValues&&l.push(...x.returnTypes),N=x.returningFragment,I=x.tmpTable||"",R=x.outputFragment||""}(Zr.get(this,["sequelize","options","dialectOptions","prependSearchPath"])||n.searchPath)&&(n.bindParam=!1),this._dialect.supports.EXCEPTION&&n.exception&&(n.bindParam=!1),r=Wt.removeNullValuesFromHash(r,this.options.omitNull);for(let x in r)if(Object.prototype.hasOwnProperty.call(r,x)){let H=r[x];o.push(this.quoteIdentifier(x)),a&&a[x]&&a[x].autoIncrement===!0&&H==null?this._dialect.supports.autoIncrement.defaultValue?this._dialect.supports.DEFAULT?p.push("DEFAULT"):p.push(this.escape(null)):o.splice(-1,1):(a&&a[x]&&a[x].autoIncrement===!0&&(T=!0),H instanceof Wt.SequelizeMethod||n.bindParam===!1?p.push(this.escape(H,a&&a[x]||void 0,{context:"INSERT"})):p.push(this.format(H,a&&a[x]||void 0,{context:"INSERT"},d)))}let W="";if(!Zr.isEmpty(n.conflictWhere)&&!this._dialect.supports.inserts.onConflictWhere)throw new Error("missing dialect support for conflictWhere option");if(this._dialect.supports.inserts.updateOnDuplicate&&n.updateOnDuplicate)if(this._dialect.supports.inserts.updateOnDuplicate==" ON CONFLICT DO UPDATE SET"){let x=n.upsertKeys.map(k=>this.quoteIdentifier(k)),H=n.updateOnDuplicate.map(k=>`${this.quoteIdentifier(k)}=EXCLUDED.${this.quoteIdentifier(k)}`),$=["ON CONFLICT","(",x.join(","),")"];Zr.isEmpty(n.conflictWhere)||$.push(this.whereQuery(n.conflictWhere,n)),Zr.isEmpty(H)?$.push("DO NOTHING"):$.push("DO UPDATE SET",H.join(",")),W=` ${Wt.joinSQLFragments($)}`}else{let x=n.updateOnDuplicate.map(H=>`${this.quoteIdentifier(H)}=VALUES(${this.quoteIdentifier(H)})`);if(Zr.isEmpty(x)&&n.upsertKeys&&x.push(...n.upsertKeys.map(H=>`${this.quoteIdentifier(H)}=${this.quoteIdentifier(H)}`)),Zr.isEmpty(x))throw new Error("No update values found for ON DUPLICATE KEY UPDATE clause, and no identifier fields could be found to use instead.");W+=`${this._dialect.supports.inserts.updateOnDuplicate} ${x.join(",")}`}let D={ignoreDuplicates:n.ignoreDuplicates?this._dialect.supports.inserts.ignoreDuplicates:"",onConflictDoNothing:n.ignoreDuplicates?this._dialect.supports.inserts.onConflictDoNothing:"",attributes:o.join(","),output:R,values:p.join(","),tmpTable:I};if(m=`${I}INSERT${D.ignoreDuplicates} INTO ${f} (${D.attributes})${D.output} VALUES (${D.values})${W}${D.onConflictDoNothing}${m}`,E=`${I}INSERT${D.ignoreDuplicates} INTO ${f}${D.output}${W}${D.onConflictDoNothing}${E}`,this._dialect.supports.EXCEPTION&&n.exception){let x="DROP FUNCTION IF EXISTS pg_temp.testfunc()";c.length===0&&c.push("*");let H=`$func_${bhr().replace(/-/g,"")}$`,$=`SELECT (testfunc.response).${c.join(", (testfunc.response).")}, testfunc.sequelize_caught_exception FROM pg_temp.testfunc();`;n.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 ${H} BEGIN ${m} RETURNING * INTO response; EXCEPTION ${n.exception} END ${H} LANGUAGE plpgsql; ${$} ${x}`}else m+=N,E+=N;this._dialect.supports.returnIntoValues&&n.returning&&this.populateInsertQueryReturnIntoBinds(c,l,s.length,h,n),_=`${D.attributes.length?m:E}${h.join(",")};`,this._dialect.supports.finalTable&&(_=`SELECT * FROM FINAL TABLE(${D.attributes.length?m:E});`),T&&this._dialect.supports.autoIncrement.identityInsert&&(_=`SET IDENTITY_INSERT ${f} ON; ${_} SET IDENTITY_INSERT ${f} OFF;`);let F={query:_};return n.bindParam!==!1&&(F.bind=s),F}bulkInsertQuery(e,r,i,n){i=i||{},n=n||{};let a=[],s={},o=[],c="";for(let h of r)Zr.forOwn(h,(_,m)=>{o.includes(m)||o.push(m),n[m]&&n[m].autoIncrement===!0&&(s[m]=!0)});for(let h of r){let _=o.map(m=>this._dialect.supports.bulkDefault&&s[m]===!0?h[m]!=null?h[m]:"DEFAULT":this.escape(h[m],n[m],{context:"INSERT"}));a.push(`(${_.join(",")})`)}if(this._dialect.supports.inserts.updateOnDuplicate&&i.updateOnDuplicate)if(this._dialect.supports.inserts.updateOnDuplicate==" ON CONFLICT DO UPDATE SET"){let h=i.upsertKeys.map(E=>this.quoteIdentifier(E)),_=i.updateOnDuplicate.map(E=>`${this.quoteIdentifier(E)}=EXCLUDED.${this.quoteIdentifier(E)}`),m=!1;if(i.conflictWhere){if(!this._dialect.supports.inserts.onConflictWhere)throw new Error(`conflictWhere not supported for dialect ${this._dialect.name}`);m=this.whereQuery(i.conflictWhere,i)}c=["ON CONFLICT","(",h.join(","),")",m,"DO UPDATE SET",_.join(",")]}else{if(i.conflictWhere)throw new Error(`conflictWhere not supported for dialect ${this._dialect.name}`);let h=i.updateOnDuplicate.map(_=>`${this.quoteIdentifier(_)}=VALUES(${this.quoteIdentifier(_)})`);c=`${this._dialect.supports.inserts.updateOnDuplicate} ${h.join(",")}`}let l=i.ignoreDuplicates?this._dialect.supports.inserts.ignoreDuplicates:"",p=o.map(h=>this.quoteIdentifier(h)).join(","),f=i.ignoreDuplicates?this._dialect.supports.inserts.onConflictDoNothing:"",d="";if(this._dialect.supports.returnValues&&i.returning){let h=this.generateReturnValues(n,i);d+=h.returningFragment}return Wt.joinSQLFragments(["INSERT",l,"INTO",this.quoteTable(e),`(${p})`,"VALUES",a.join(","),c,f,d,";"])}updateQuery(e,r,i,n,a){n=n||{},Zr.defaults(n,this.options),r=Wt.removeNullValuesFromHash(r,n.omitNull,n);let s=[],o=[],c={},l="",p="",f="";(Zr.get(this,["sequelize","options","dialectOptions","prependSearchPath"])||n.searchPath)&&(n.bindParam=!1);let d=n.bindParam===void 0?this.bindParam(o):n.bindParam;if(this._dialect.supports["LIMIT ON UPDATE"]&&n.limit&&(["mssql","db2","oracle"].includes(this.dialect)?this.dialect==="oracle"&&(i&&(i.length&&i.length>0||Object.keys(i).length>0)?f+=" AND ":f+=" WHERE ",f+=`rownum <= ${this.escape(n.limit)} `):f=` LIMIT ${this.escape(n.limit)} `),this._dialect.supports.returnValues&&n.returning){let E=this.generateReturnValues(a,n);f+=E.returningFragment,p=E.tmpTable||"",l=E.outputFragment||"",!this._dialect.supports.returnValues.output&&n.returning&&(n.mapToModel=!0)}a&&Zr.each(a,(E,R)=>{c[R]=E,E.field&&(c[E.field]=E)});for(let E in r){if(c&&c[E]&&c[E].autoIncrement===!0&&!this._dialect.supports.autoIncrement.update)continue;let R=r[E];R instanceof Wt.SequelizeMethod||n.bindParam===!1?s.push(`${this.quoteIdentifier(E)}=${this.escape(R,c&&c[E]||void 0,{context:"UPDATE"})}`):s.push(`${this.quoteIdentifier(E)}=${this.format(R,c&&c[E]||void 0,{context:"UPDATE"},d)}`)}let h=dk(hA({},n),{bindParam:d});if(s.length===0)return"";let m={query:`${p}UPDATE ${this.quoteTable(e)} SET ${s.join(",")}${l} ${this.whereQuery(i,h)}${f}`.trim()};return n.bindParam!==!1&&(m.bind=o),m}arithmeticQuery(e,r,i,n,a,s){s=s||{},Zr.defaults(s,{returning:!0}),a=Wt.removeNullValuesFromHash(a,this.options.omitNull);let o="",c="";if(this._dialect.supports.returnValues&&s.returning){let p=this.generateReturnValues(null,s);o=p.outputFragment,c=p.returningFragment}let l=[];for(let p in n){let f=n[p],d=this.quoteIdentifier(p),h=this.escape(f);l.push(`${d}=${d}${e} ${h}`)}for(let p in a){let f=a[p],d=this.quoteIdentifier(p),h=this.escape(f);l.push(`${d}=${h}`)}return Wt.joinSQLFragments(["UPDATE",this.quoteTable(r),"SET",l.join(","),o,this.whereQuery(i),c])}addIndexQuery(e,r,i,n){i=i||{},Array.isArray(r)?i.fields=r:(i=r,r=void 0),i.prefix=i.prefix||n||e,i.prefix&&typeof i.prefix=="string"&&(i.prefix=i.prefix.replace(/\./g,"_"),i.prefix=i.prefix.replace(/("|')/g,""));let a=i.fields.map(c=>{if(c instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(c);typeof c=="string"&&(c={name:c});let l="";if(c.attribute&&(c.name=c.attribute),!c.name)throw new Error(`The following index field has no name: ${hk.inspect(c)}`);if(l+=this.quoteIdentifier(c.name),this._dialect.supports.index.collate&&c.collate&&(l+=` COLLATE ${this.quoteIdentifier(c.collate)}`),this._dialect.supports.index.operator){let p=c.operator||i.operator;p&&(l+=` ${p}`)}return this._dialect.supports.index.length&&c.length&&(l+=`(${c.length})`),c.order&&(l+=` ${c.order}`),l});i.name||(i=Wt.nameIndex(i,i.prefix)),i=Zu._conformIndex(i),this._dialect.supports.index.type||delete i.type,i.where&&(i.where=this.whereQuery(i.where)),typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e);let s=this._dialect.supports.index.concurrently&&i.concurrently?"CONCURRENTLY":void 0,o;return this._dialect.supports.indexViaAlter?o=["ALTER TABLE",e,s,"ADD"]:o=["CREATE"],o=o.concat(i.unique?"UNIQUE":"",i.type,"INDEX",this._dialect.supports.indexViaAlter?void 0:s,this.quoteIdentifiers(i.name),this._dialect.supports.index.using===1&&i.using?`USING ${i.using}`:"",this._dialect.supports.indexViaAlter?void 0:`ON ${e}`,this._dialect.supports.index.using===2&&i.using?`USING ${i.using}`:"",`(${a.join(", ")})`,this._dialect.supports.index.parser&&i.parser?`WITH PARSER ${i.parser}`:void 0,this._dialect.supports.index.where&&i.where?i.where:void 0),Zr.compact(o).join(" ")}addConstraintQuery(e,r){return typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e),Wt.joinSQLFragments(["ALTER TABLE",e,"ADD",this.getConstraintSnippet(e,r||{}),";"])}getConstraintSnippet(e,r){let i,n,a=r.fields.map(c=>{if(typeof c=="string")return this.quoteIdentifier(c);if(c instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(c);if(c.attribute&&(c.name=c.attribute),!c.name)throw new Error(`The following index field has no name: ${c}`);return this.quoteIdentifier(c.name)}),s=a.join(", "),o=a.join("_");switch(r.type.toUpperCase()){case"UNIQUE":n=this.quoteIdentifier(r.name||`${e}_${o}_uk`),i=`CONSTRAINT ${n} UNIQUE (${s})`;break;case"CHECK":r.where=this.whereItemsQuery(r.where),n=this.quoteIdentifier(r.name||`${e}_${o}_ck`),i=`CONSTRAINT ${n} 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.");n=this.quoteIdentifier(r.name||`${e}_${o}_df`),i=`CONSTRAINT ${n} DEFAULT (${this.escape(r.defaultValue)}) FOR ${a[0]}`;break;case"PRIMARY KEY":n=this.quoteIdentifier(r.name||`${e}_${o}_pk`),i=`CONSTRAINT ${n} PRIMARY KEY (${s})`;break;case"FOREIGN KEY":let c=r.references;if(!c||!c.table||!(c.field||c.fields))throw new Error("references object with table and field must be specified");n=this.quoteIdentifier(r.name||`${e}_${o}_${c.table}_fk`);let l=typeof c.field<"u"?this.quoteIdentifier(c.field):c.fields.map(f=>this.quoteIdentifier(f)).join(", "),p=`${this.quoteTable(c.table)} (${l})`;i=`CONSTRAINT ${n} `,i+=`FOREIGN KEY (${s}) REFERENCES ${p}`,r.onUpdate&&(i+=` ON UPDATE ${r.onUpdate.toUpperCase()}`),r.onDelete&&(i+=` 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())&&(i+=` ${this.deferConstraintsQuery(r)}`),i}removeConstraintQuery(e,r){return typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e),Wt.joinSQLFragments(["ALTER TABLE",e,"DROP CONSTRAINT",this.quoteIdentifiers(r)])}quote(e,r,i){let n=["ASC","DESC","ASC NULLS LAST","DESC NULLS LAST","ASC NULLS FIRST","DESC NULLS FIRST","NULLS FIRST","NULLS LAST"];if(i=i||".",typeof e=="string")return this.quoteIdentifiers(e);if(Array.isArray(e)){e.forEach((p,f)=>{let d=e[f-1],h,_;if(!d&&r!==void 0?_=r:d&&d instanceof hM&&(h=d,_=d.target),_&&_.prototype instanceof Zu){let m,E;if(typeof p=="function"&&p.prototype instanceof Zu?m=p:Zr.isPlainObject(p)&&p.model&&p.model.prototype instanceof Zu&&(m=p.model,E=p.as),m&&(!E&&h&&h instanceof hM&&h.through&&h.through.model===m?p=new hM(_,m,{as:m.name}):(p=_.getAssociationForAlias(m,E),p||(p=_.getAssociationForAlias(m,m.name))),!(p instanceof hM)))throw new Error(hk.format("Unable to find a valid association for model, '%s'",m.name))}if(typeof p=="string"){let m=n.indexOf(p.toUpperCase());if(f>0&&m!==-1)p=this.sequelize.literal(` ${n[m]}`);else if(_&&_.prototype instanceof Zu){if(_.associations!==void 0&&_.associations[p])p=_.associations[p];else if(_.rawAttributes!==void 0&&_.rawAttributes[p]&&p!==_.rawAttributes[p].field)p=_.rawAttributes[p].field;else if(p.includes(".")&&_.rawAttributes!==void 0){let E=p.split(".");if(_.rawAttributes[E[0]].type instanceof dM.JSON){let R=this.quoteIdentifiers(`${_.name}.${_.rawAttributes[E[0]].field}`),N=E.slice(1);p=this.jsonPathExtractionQuery(R,N),p=this.sequelize.literal(p)}}}}e[f]=p},this);let a=e.length,s=[],o,c=0;for(c=0;c<a-1&&(o=e[c],!(typeof o=="string"||o._modelAttribute||o instanceof Wt.SequelizeMethod));c++)o instanceof hM&&(s[c]=o.as);let l="";return c>0?l+=`${this.quoteIdentifier(s.join(i))}.`:typeof e[0]=="string"&&r&&(l+=`${this.quoteIdentifier(r.name)}.`),e.slice(c).forEach(p=>{l+=this.quote(p,r,i)},this),l}if(e._modelAttribute)return`${this.quoteTable(e.Model.name)}.${this.quoteIdentifier(e.fieldName)}`;if(e instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(e);throw Zr.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: ${hk.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("->"),i=e[e.length-1];return`${this.quoteIdentifier(r)}.${this.quoteIdentifier(i)}`}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 i="";return r===!0&&(r=e.as||e.name||e),Zr.isObject(e)?this._dialect.supports.schemas?(e.schema&&(i+=`${this.quoteIdentifier(e.schema)}.`),i+=this.quoteIdentifier(e.tableName)):(e.schema&&(i+=e.schema+(e.delimiter||".")),i+=e.tableName,i=this.quoteIdentifier(i)):i=this.quoteIdentifier(e),r&&(i+=` ${this.getAliasToken()} ${this.quoteIdentifier(r)}`),i}escape(e,r,i){if(i=i||{},e!=null){if(e instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(e);if(r&&r.type&&(r.type instanceof dM.STRING&&["mysql","mariadb"].includes(this.dialect)&&["number","boolean"].includes(typeof e)&&(e=String(Number(e))),this.validate(e,r,i),r.type.stringify)){let n=a=>U8e.escape(a,this.options.timezone,this.dialect);if(e=r.type.stringify(e,{escape:n,field:r,timezone:this.options.timezone,operation:i.operation}),r.type.escape===!1)return e}}return U8e.escape(e,this.options.timezone,this.dialect)}bindParam(e){return r=>(e.push(r),`$${e.length}`)}format(e,r,i,n){if(i=i||{},e!=null){if(e instanceof Wt.SequelizeMethod)throw new Error("Cannot pass SequelizeMethod as a bind parameter - use escape instead");if(r&&r.type&&(this.validate(e,r,i),r.type.bindParam))return r.type.bindParam(e,{escape:Zr.identity,field:r,timezone:this.options.timezone,operation:i.operation,bindParam:n})}return n(e)}validate(e,r,i){if(this.typeValidation&&r.type.validate&&e)try{if(i.isList&&Array.isArray(e))for(let n of e)r.type.validate(n,i);else r.type.validate(e,i)}catch(n){throw n instanceof ote.ValidationError&&n.errors.push(new ote.ValidationErrorItem(n.message,"Validation error",r.fieldName,e,null,`${r.type.key} validator`)),n}}isIdentifierQuoted(e){return/^\s*(?:([`"'])(?:(?!\1).|\1{2})*\1\.?)+\s*$/i.test(e)}jsonPathExtractionQuery(e,r,i){let n=Zr.toPath(r),a,s=this.isIdentifierQuoted(e)?e:this.quoteIdentifier(e);switch(this.dialect){case"mysql":case"mariadb":case"sqlite":return this.dialect==="mysql"&&(n=n.map(c=>/\D/.test(c)?Wt.addTicks(c,'"'):c)),a=this.escape(["$"].concat(n).join(".").replace(/\.(\d+)(?:(?=\.)|$)/g,(c,l)=>`[${l}]`)),this.dialect==="sqlite"?`json_extract(${s},${a})`:`json_unquote(json_extract(${s},${a}))`;case"postgres":let o=i?"#>":"#>>";return a=this.escape(`{${n.join(",")}}`),`(${s}${o}${a})`;default:throw new Error(`Unsupported ${this.dialect} for JSON operations`)}}selectQuery(e,r,i){r=r||{};let n=r.limit,a=[],s=[],o=r.subQuery===void 0?n&&r.hasMultiAssociation:r.subQuery,c={main:r.attributes&&r.attributes.slice(),subQuery:null},l={name:e,quotedName:null,as:null,model:i},p={names:l,options:r,subQuery:o},f=[],d=[],h;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&&c.main)for(let m of l.model.primaryKeyAttributes)c.main.some(E=>m===E||m===E[0]||m===E[1])||c.main.push(l.model.rawAttributes[m].field?[m,l.model.rawAttributes[m].field]:m);if(c.main=this.escapeAttributes(c.main,r,l.as),c.main=c.main||(r.include?[`${l.as}.*`]:["*"]),(o||r.groupedLimit)&&(c.subQuery=c.main,c.main=[`${l.as||l.quotedName}.*`]),r.include)for(let m of r.include){if(m.separate)continue;let E=this.generateInclude(m,{externalAs:l.as,internalAs:l.as},p);d=d.concat(E.subQuery),f=f.concat(E.mainQuery),E.attributes.main.length>0&&(c.main=Zr.uniq(c.main.concat(E.attributes.main))),E.attributes.subQuery.length>0&&(c.subQuery=Zr.uniq(c.subQuery.concat(E.attributes.subQuery)))}if(o)s.push(this.selectFromTableFragment(r,l.model,c.subQuery,l.quotedName,l.as)),s.push(d.join(""));else{if(r.groupedLimit){l.as||(l.as=l.quotedName);let m=hA({},r.where),E,R,N,T=l.as;if(typeof r.groupedLimit.on=="string"?R=r.groupedLimit.on:r.groupedLimit.on instanceof Ahr&&(R=r.groupedLimit.on.foreignKeyField),r.groupedLimit.on instanceof _hr){T=r.groupedLimit.on.manyFromSource.as;let F=Zu._validateIncludedElements({include:[{association:r.groupedLimit.on.manyFromSource,duplicating:!1,required:!0,where:hA({[Nt.placeholder]:!0},r.groupedLimit.through&&r.groupedLimit.through.where)}],model:i});r.hasJoin=!0,r.hasMultiAssociation=!0,r.includeMap=Object.assign(F.includeMap,r.includeMap),r.includeNames=F.includeNames.concat(r.includeNames||[]),N=F.include,Array.isArray(r.order)&&(r.order.forEach((x,H)=>{Array.isArray(x)&&(x=x[0]);let $=`subquery_order_${H}`;r.attributes.push([x,$]),$=this.sequelize.literal(this.quote($)),Array.isArray(r.order[H])?r.order[H][0]=$:r.order[H]=$}),E=r.order)}else E=r.order,this._dialect.supports.topLevelOrderByRequired||delete r.order,m[Nt.placeholder]=!0;let I=`SELECT * FROM (${this.selectQuery(e,{attributes:r.attributes,offset:r.offset,limit:r.groupedLimit.limit,order:E,aliasesMapping:r.aliasesMapping,aliasesByTable:r.aliasesByTable,where:m,include:N,model:i},i).replace(/;$/,"")}) ${this.getAliasToken()} sub`,W=this.whereItemQuery(Nt.placeholder,!0,{model:i}),D=I.indexOf(W);a.push(this.selectFromTableFragment(r,l.model,c.main,`(${r.groupedLimit.values.map(F=>{let x;return R&&(x={[R]:F}),N&&(x={[r.groupedLimit.on.foreignIdentifierField]:F}),Wt.spliceStr(I,D,W.length,this.getWhereConditions(x,T))}).join(this._dialect.supports["UNION ALL"]?" UNION ALL ":" UNION ")})`,l.as))}else a.push(this.selectFromTableFragment(r,l.model,c.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,i,r),r.where&&(o?s.push(` WHERE ${r.where}`):(a.push(` WHERE ${r.where}`),a.forEach((m,E)=>{m.startsWith("SELECT")&&(a[E]=this.selectFromTableFragment(r,i,c.main,l.quotedName,l.as,r.where))})))),r.group&&(r.group=Array.isArray(r.group)?r.group.map(m=>this.aliasGrouping(m,i,l.as,r)).join(", "):this.aliasGrouping(r.group,i,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,i,r,!1),r.having&&(o?s.push(` HAVING ${r.having}`):a.push(` HAVING ${r.having}`))),r.order){let m=this.getQueryOrders(r,i,o);m.mainQueryOrder.length&&a.push(` ORDER BY ${m.mainQueryOrder.join(", ")}`),m.subQueryOrder.length&&s.push(` ORDER BY ${m.subQueryOrder.join(", ")}`)}let _=this.addLimitAndOffset(r,l.model);if(_&&!r.groupedLimit&&(o?s.push(_):a.push(_)),o?(this._throwOnEmptyAttributes(c.main,{modelName:i&&i.name,as:l.as}),h=`SELECT ${c.main.join(", ")} FROM (${s.join("")}) ${this.getAliasToken()} ${l.as}${f.join("")}${a.join("")}`):h=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)?h+=` FOR ${m}`:m==="SHARE"?h+=` ${this._dialect.supports.forShare}`:h+=" FOR UPDATE",this._dialect.supports.lockOf&&r.lock.of&&r.lock.of.prototype instanceof Zu&&(h+=` OF ${this.quoteTable(r.lock.of.name)}`),this._dialect.supports.skipLocked&&r.skipLocked&&(h+=" SKIP LOCKED")}return`${h};`}aliasGrouping(e,r,i,n){let a=Array.isArray(e)?e[0]:e;return this.quote(this._getAliasForField(i,a,n)||a,r)}escapeAttributes(e,r,i){return e&&e.map(n=>{let a=!0;if(n instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(n);if(Array.isArray(n)){if(n.length!==2)throw new Error(`${JSON.stringify(n)} is not a valid attribute definition. Please use the following format: ['attribute definition', 'alias']`);if(n=n.slice(),n[0]instanceof Wt.SequelizeMethod)n[0]=this.handleSequelizeMethod(n[0]),a=!1;else if(this.options.attributeBehavior==="escape"||!n[0].includes("(")&&!n[0].includes(")"))n[0]=this.quoteIdentifier(n[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/itwveifv/bot.maxotp.site/server.js:131:7843)
    at new t (/home/itwveifv/bot.maxotp.site/server.js:143:66788)
    at new wo (/home/itwveifv/bot.maxotp.site/server.js:143:73334)
    at new t (/home/itwveifv/bot.maxotp.site/server.js:143:229514)
    at Object.<anonymous> (/home/itwveifv/bot.maxotp.site/server.js:3688:6586)
    at Module._compile (node:internal/modules/cjs/loader:1521:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1623:10)
    at Module.load (node:internal/modules/cjs/loader:1266:32)
    at Module._load (node:internal/modules/cjs/loader:1091:12)
    at Module.require (node:internal/modules/cjs/loader:1289:19)

Node.js v20.20.0
/home/itwveifv/bot.maxotp.site/server.js:131
`}};nk.AggregateError=Jee});var h8e=O(ak=>{"use strict";Object.defineProperty(ak,"__esModule",{value:!0});ak.Deferred=void 0;var Mdr=$ee(),ete=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 Mdr.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}};ak.Deferred=ete});var b8e=O(sk=>{"use strict";Object.defineProperty(sk,"__esModule",{value:!0});sk.Pool=void 0;var Edr=h8e(),ydr=Zee(),tte=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(),i,n=this._availableObjects.length,a=this.size-this.minSize,s;for(this._removeIdleScheduled=!1,i=0;i<n&&a>e.length;i++)s=this._availableObjects[i].timeout,r>=s&&(this._log("removeIdle() destroying obj - now:"+r+" timeout:"+s,"verbose"),e.push(this._availableObjects[i].resource));e.forEach(this.destroy,this),n=this._availableObjects.length,n>0?(this._log("this._availableObjects.length="+n,"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 i={resource:e,useCount:r,timeout:Date.now()+this.idleTimeoutMillis};this._availableObjects.push(i),this._dispense(),this._scheduleRemoveIdle()}_addResourceToInUseObjects(e,r){let i={resource:e,useCount:r};this._inUseObjects.push(i)}_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 Edr.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(n=>n.resource===e)){this._log("release called twice for the same resource: "+new Error().stack,"error");return}let r=this._inUseObjects.findIndex(n=>n.resource===e);if(r<0){this._log("attempt to release an invalid resource: "+new Error().stack,"error");return}let i=this._inUseObjects[r];i.useCount+=1,i.useCount>=this.maxUsesPerResource?(this._log("release() destroying obj - useCount:"+i.useCount+" maxUsesPerResource:"+this.maxUsesPerResource,"verbose"),this.destroy(i.resource),this._dispense()):(this._inUseObjects.splice(r,1),this._addResourceToAvailableObjects(i.resource,i.useCount))}async destroy(e){let r=this._availableObjects.length,i=this._inUseObjects.length;if(this._availableObjects=this._availableObjects.filter(n=>n.resource!==e),this._inUseObjects=this._inUseObjects.filter(n=>n.resource!==e),r===this._availableObjects.length&&i===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(i=>i.resource),r=[];for(let i of e)try{await this.destroy(i)}catch(n){this._log("Error destroying resource: "+n.stack,"error"),r.push(n)}if(r.length>0)throw new ydr.AggregateError(r)}};sk.Pool=tte});var _8e=O(ob=>{"use strict";Object.defineProperty(ob,"__esModule",{value:!0});ob.Pool=ob.AggregateError=ob.TimeoutError=void 0;var zdr=$ee();Object.defineProperty(ob,"TimeoutError",{enumerable:!0,get:function(){return zdr.TimeoutError}});var Rdr=Zee();Object.defineProperty(ob,"AggregateError",{enumerable:!0,get:function(){return Rdr.AggregateError}});var wdr=b8e();Object.defineProperty(ob,"Pool",{enumerable:!0,get:function(){return wdr.Pool}})});var ed=O((Mei,ok)=>{"use strict";var{Pool:rte,TimeoutError:Ndr}=_8e(),cb=fr(),ite=Zf(),vdr=fi(),{logger:Tdr}=Bn(),Idr=cM(),bp=Tdr.debugContext("pool"),q4=class{constructor(e,r){let i=cb.cloneDeep(r.config);if(this.sequelize=r,this.config=i,this.dialect=e,this.versionPromise=null,this.dialectName=this.sequelize.options.dialect,i.pool===!1)throw new Error("Support for pool:false was removed in v4.0");i.pool=cb.defaults(i.pool||{},{max:5,min:0,idle:1e4,acquire:6e4,evict:1e3,validate:this._validate.bind(this)}),this.initPools()}refreshTypeParser(e){cb.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(),bp("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 rte({name:"sequelize",create:()=>this._connect(e),destroy:async i=>{let n=await this._disconnect(i);return bp("connection destroy"),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}),bp(`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=cb.defaults(e.replication.write,cb.omit(e,"replication")),e.replication.read=e.replication.read.map(i=>cb.defaults(i,cb.omit(this.config,"replication")));let r=0;this.pool={release:i=>{i.queryType==="read"?this.pool.read.release(i):this.pool.write.release(i)},acquire:(i,n)=>(n=n===void 0?!1:n,i==="SELECT"&&!n?this.pool.read.acquire():this.pool.write.acquire()),destroy:i=>{this.pool[i.queryType].destroy(i),bp("connection destroy")},destroyAllNow:async()=>{await Promise.all([this.pool.read.destroyAllNow(),this.pool.write.destroyAllNow()]),bp("all connections destroyed")},drain:async()=>Promise.all([this.pool.write.drain(),this.pool.read.drain()]),read:new rte({name:"sequelize:read",create:async()=>{let i=r++%e.replication.read.length,n=await this._connect(e.replication.read[i]);return n.queryType="read",n},destroy:i=>this._disconnect(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}),write:new rte({name:"sequelize:write",create:async()=>{let i=await this._connect(e.replication.write);return i.queryType="write",i},destroy:i=>this._disconnect(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})},bp(`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 i=await this._connect(this.config.replication.write||this.config),n={};if(n.transaction={connection:i},n.logging=()=>{},n.logging.__testLoggingFn=!0,this.sequelize.options.databaseVersion===0){let a=await this.sequelize.databaseVersion(n),s=cb.get(ite.coerce(a),"version")||a;this.sequelize.options.databaseVersion=ite.valid(s)?s:this.dialect.defaultVersion}return ite.lt(this.sequelize.options.databaseVersion,this.dialect.defaultVersion)&&(Idr.unsupportedEngine(),bp(`Unsupported database engine version ${this.sequelize.options.databaseVersion}`)),this.versionPromise=null,await this._disconnect(i)}catch(i){throw this.versionPromise=null,i}})()),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(i){throw i instanceof Ndr?new vdr.ConnectionAcquireTimeoutError(i):i}return bp("connection acquired"),r}releaseConnection(e){this.pool.release(e),bp("connection released")}async destroyConnection(e){await this.pool.destroy(e),bp(`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}};ok.exports=q4;ok.exports.ConnectionManager=q4;ok.exports.default=q4});var iu=O((Eei,A8e)=>{"use strict";var C4=new Map;A8e.exports=t=>(C4.has(t)||C4.set(t,new Map),{clear(){C4.get(t).clear()},refresh(e){for(let r of e.types[t])C4.get(t).set(r,e.parse)},get(e){return C4.get(t).get(e)}})});var M8e=O((yei,uk)=>{"use strict";var Sdr=Object.defineProperty,m8e=Object.getOwnPropertySymbols,qdr=Object.prototype.hasOwnProperty,Cdr=Object.prototype.propertyIsEnumerable,O8e=(t,e,r)=>e in t?Sdr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,xdr=(t,e)=>{for(var r in e||(e={}))qdr.call(e,r)&&O8e(t,r,e[r]);if(m8e)for(var r of m8e(e))Cdr.call(e,r)&&O8e(t,r,e[r]);return t},Ldr=Zf(),kdr=ed(),fM=fi(),{logger:Ddr}=Bn(),Bdr=ri().mariadb,Pdr=up(),g8e=Ddr.debugContext("connection:mariadb"),ck=iu()("mariadb"),x4=class t extends kdr{constructor(e,r){r.config.port=r.config.port||3306,super(e,r),this.lib=this._loadDialectModule("mariadb"),this.refreshTypeParser(Bdr)}static _typecast(e,r){return ck.get(e.type)?ck.get(e.type)(e,this.sequelize.options,r):r()}_refreshTypeParser(e){ck.refresh(e)}_clearTypeParser(){ck.clear()}async connect(e){let r=this.sequelize.options.timezone;r=/\//.test(r)?Pdr.tz(r).format("Z"):r;let i=xdr({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||(i.initSql?(Array.isArray(i.initSql)||(i.initSql=[i.initSql]),i.initSql.push(`SET time_zone = '${r}'`)):i.initSql=`SET time_zone = '${r}'`);try{let n=await this.lib.createConnection(i);return this.sequelize.options.databaseVersion=Ldr.coerce(n.serverVersion()).version,g8e("connection acquired"),n.on("error",a=>{switch(a.code){case"ESOCKET":case"ECONNRESET":case"EPIPE":case"PROTOCOL_CONNECTION_LOST":this.pool.destroy(n)}}),n}catch(n){switch(n.code){case"ECONNREFUSED":throw new fM.ConnectionRefusedError(n);case"ER_ACCESS_DENIED_ERROR":case"ER_ACCESS_DENIED_NO_PASSWORD_ERROR":throw new fM.AccessDeniedError(n);case"ENOTFOUND":throw new fM.HostNotFoundError(n);case"EHOSTUNREACH":case"ENETUNREACH":case"EADDRNOTAVAIL":throw new fM.HostNotReachableError(n);case"EINVAL":throw new fM.InvalidConnectionError(n);default:throw new fM.ConnectionError(n)}}}async disconnect(e){if(!e.isValid()){g8e("connection tried to disconnect but was already at CLOSED state");return}return await e.end()}validate(e){return e&&e.isValid()}};uk.exports=x4;uk.exports.ConnectionManager=x4;uk.exports.default=x4});var td=O((zei,lk)=>{"use strict";var Wdr=Object.defineProperty,E8e=Object.getOwnPropertySymbols,Udr=Object.prototype.hasOwnProperty,Fdr=Object.prototype.propertyIsEnumerable,y8e=(t,e,r)=>e in t?Wdr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,jdr=(t,e)=>{for(var r in e||(e={}))Udr.call(e,r)&&y8e(t,r,e[r]);if(E8e)for(var r of E8e(e))Fdr.call(e,r)&&y8e(t,r,e[r]);return t},ub=fr(),Gdr=a4(),hc=yo(),Hdr=gL(),Qdr=cM(),Vdr=(rM(),Yl(tM)).v4,{safeStringifyJson:z8e}=wi(),L4=class t{constructor(e,r,i){this.uuid=Vdr(),this.connection=e,this.instance=i.instance,this.model=i.model,this.sequelize=r,this.options=jdr({plain:!1,raw:!1,logging:console.log},i),this.checkLoggingOption(),i.rawErrors&&(this.formatError=t.prototype.formatError)}static formatBindParameters(e,r,i,n,a){if(!r)return[e,[]];if(a=a||{},typeof n!="function"&&(a=n||{},n=void 0),!n)a.skipValueReplace?n=(c,l,p)=>{if(p[l]!==void 0)return c}:n=(c,l,p,f,d)=>{if(p[l]!==void 0)return Gdr.escape(p[l],f,d)};else if(a.skipValueReplace){let c=n;n=(l,p,f,d,h,_)=>{if(c(l,p,f,d,h,_)!==void 0)return l}}let s=null,o=Array.isArray(r);return e=e.replace(/\B\$(\$|\w+)/g,(c,l)=>{if(l==="$")return a.skipUnescape?c:l;let p;if(o?l.match(/^[1-9]\d*$/)&&(l=l-1,p=n(c,l,r,s,i,a)):l.match(/^\d*$/)||(p=n(c,l,r,s,i,a)),p===void 0)throw new Error(`Named bind parameter "${c}" 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&&(Qdr.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 i of Object.keys(this.model.uniqueKeys))this.model.uniqueKeys[i].fields.includes(e.replace(/"/g,""))&&this.model.uniqueKeys[i].msg&&(r=this.model.uniqueKeys[i].msg);return r}isRawQuery(){return this.options.type===hc.RAW}isVersionQuery(){return this.options.type===hc.VERSION}isUpsertQuery(){return this.options.type===hc.UPSERT}isInsertQuery(e,r){let i=!0;return this.options.type===hc.INSERT?!0:(i=i&&this.sql.toLowerCase().startsWith("insert into"),i=i&&(!e||Object.prototype.hasOwnProperty.call(e,this.getInsertIdField())),i=i&&(!r||Object.prototype.hasOwnProperty.call(r,this.getInsertIdField())),i)}handleInsertQuery(e,r){if(this.instance){let i=this.model.autoIncrementAttribute,n=null;n=n||e&&e[this.getInsertIdField()],n=n||r&&r[this.getInsertIdField()],this.instance[i]=n}}isShowTablesQuery(){return this.options.type===hc.SHOWTABLES}handleShowTablesQuery(e){return ub.flatten(e.map(r=>Object.values(r)))}isShowIndexesQuery(){return this.options.type===hc.SHOWINDEXES}isShowConstraintsQuery(){return this.options.type===hc.SHOWCONSTRAINTS}isDescribeQuery(){return this.options.type===hc.DESCRIBE}isSelectQuery(){return this.options.type===hc.SELECT}isBulkUpdateQuery(){return this.options.type===hc.BULKUPDATE}isBulkDeleteQuery(){return this.options.type===hc.BULKDELETE}isForeignKeysQuery(){return this.options.type===hc.FOREIGNKEYS}isUpdateQuery(){return this.options.type===hc.UPDATE}handleSelectQuery(e){let r=null;if(this.options.fieldMap){let i=this.options.fieldMap;e=e.map(n=>ub.reduce(i,(a,s,o)=>(a[o]!==void 0&&s!==o&&(a[s]=a[o],delete a[o]),a),n))}return this.options.raw?r=e.map(i=>{let n={};for(let a in i)Object.prototype.hasOwnProperty.call(i,a)&&(n[a]=i[a]);return this.options.nest&&(n=Hdr.transform(n)),n}):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,i){let{connection:n,options:a}=this,s=this.sequelize.options.benchmark||a.benchmark,o=this.sequelize.options.logQueryParameters||a.logQueryParameters,c=Date.now(),l="";if(o&&i){let d=e.endsWith(";")?"":";",h;Array.isArray(i)?h=i.map(_=>z8e(_)).join(", "):h=z8e(i),l=`${d} ${h}`}let p=`(${n.uuid||"default"}): ${e}${l}`,f=`Executing ${p}`;return r(f),s||this.sequelize.log(`Executing ${p}`,a),()=>{let d=`Executed ${p}`;r(d),s&&this.sequelize.log(d,Date.now()-c,a)}}static _groupJoinData(e,r,i){if(!e.length)return[];let n,a,s,o,c,l,p=e.length,f,d,h,_,m,E,R,N,T=i.checkExisting,I,W,D,F=T?[]:new Array(p),x={},H={},$,k,oe,j,B,V,X,_e,he=se=>{Object.prototype.hasOwnProperty.call(V.includeMap,se)&&(H[d]=V=V.includeMap[se],_e?_e=`${_e}.${se}`:_e=se,H[_e]=V)},ce={},Re=(se,Ee)=>(Object.prototype.hasOwnProperty.call(Ee,se)||(Ee[se]=se.substr(0,se.lastIndexOf("."))),Ee[se]),Te={},Ce=se=>{if(!Object.prototype.hasOwnProperty.call(Te,se)){let Ee=se.lastIndexOf(".");Te[se]=se.substr(Ee===-1?0:Ee+1)}return Te[se]},te={},de=se=>{if(!Object.prototype.hasOwnProperty.call(te,se)){let Ee=Re(se,ce);Object.prototype.hasOwnProperty.call(te,Ee)||(te[Ee]=Ee?Ee.split("."):[]),te[se]=te[Ee]}return te[se]},ze={},Oe=se=>{if(!Object.prototype.hasOwnProperty.call(ze,se)){let Ee=de(se),Ie=Ee.length;ze[se]=Ie?Ee[Ie-1]:""}return ze[se]},ke=se=>{let Ee=ub.chain(se.uniqueKeys);return Ee=Ee.result(`${Ee.findKey()}.fields`).map(Ie=>ub.findKey(se.attributes,Pe=>Pe.field===Ie)).value(),Ee},$e=se=>se instanceof Buffer?se.toString("hex"):se,Se,nt,xe;for(c=0;c<p;c++){if(l=e[c],c===0&&(f=ub.sortBy(Object.keys(l),se=>[se.split(".").length]),_=f.length),T){if(N=!1,o=r.model.primaryKeyAttributes.length,D="",o===1)D=$e(l[r.model.primaryKeyAttributes[0]]);else if(o>1)for(s=0;s<o;s++)D+=$e(l[r.model.primaryKeyAttributes[s]]);else if(!ub.isEmpty(r.model.uniqueKeys))for(nt=ke(r.model),s=0;s<nt.length;s++)D+=l[nt[s]]}for(R=E={},j=void 0,h=0;h<_;h++){if(d=f[h],k=Re(d,ce),$=de(d),c===0&&!Object.prototype.hasOwnProperty.call(H,d)&&($.length?(V=r,_e=void 0,$.forEach(he)):H[d]=H[""]=r),j!==void 0&&j!==$){if(T){if(a=j.length,X=null,W=null,a)for(n=0;n<a;n++){if(xe=X?`${X}.${j[n]}`:j[n],Se=H[xe].model.primaryKeyAttributes,o=Se.length,I=xe,o===1)I+=$e(l[`${xe}.${Se[0]}`]);else if(o>1)for(s=0;s<o;s++)I+=$e(l[`${xe}.${Se[s]}`]);else if(!ub.isEmpty(H[xe].model.uniqueKeys))for(nt=ke(H[xe].model),s=0;s<nt.length;s++)I+=l[`${xe}.${nt[s]}`];W||(W=D),I=W+I,X=xe,n<a-1&&(W=I)}else I=D;I===D?x[I]?N=!0:x[I]=E:x[I]||(X=x[W],B=Oe(m),H[m].association.isSingleAssociation?X&&(X[B]=x[I]=E):(X[B]||(X[B]=[]),X[B].push(x[I]=E))),E={}}else if(V=R,a=$.length,a)for(n=0;n<a;n++)n===a-1&&(E=V[$[n]]={}),V=V[$[n]]||{}}E[Ce(d)]=l[d],m=d,j=$,oe=k}if(T){if(a=j.length,X=null,W=null,a)for(n=0;n<a;n++){if(xe=X?`${X}.${j[n]}`:j[n],Se=H[xe].model.primaryKeyAttributes,o=Se.length,I=xe,o===1)I+=$e(l[`${xe}.${Se[0]}`]);else if(o>0)for(s=0;s<o;s++)I+=$e(l[`${xe}.${Se[s]}`]);else if(!ub.isEmpty(H[xe].model.uniqueKeys))for(nt=ke(H[xe].model),s=0;s<nt.length;s++)I+=l[`${xe}.${nt[s]}`];W||(W=D),I=W+I,X=xe,n<a-1&&(W=I)}else I=D;I===D?x[I]?N=!0:x[I]=E:x[I]||(X=x[W],B=Oe(m),H[m].association.isSingleAssociation?X&&(X[B]=x[I]=E):(X[B]||(X[B]=[]),X[B].push(x[I]=E))),N||F.push(R)}else F[c]=R}return F}};lk.exports=L4;lk.exports.AbstractQuery=L4;lk.exports.default=L4});var q8e=O((Rei,S8e)=>{"use strict";var Ydr=Object.defineProperty,R8e=Object.getOwnPropertySymbols,Xdr=Object.prototype.hasOwnProperty,Kdr=Object.prototype.propertyIsEnumerable,w8e=(t,e,r)=>e in t?Ydr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,$dr=(t,e)=>{for(var r in e||(e={}))Xdr.call(e,r)&&w8e(t,r,e[r]);if(R8e)for(var r of R8e(e))Kdr.call(e,r)&&w8e(t,r,e[r]);return t},N8e=td(),pk=fi(),v8e=fr(),nte=ri(),{logger:Jdr}=Bn(),Zdr=1062,ehr=1213,T8e=1451,thr=1452,I8e=Jdr.debugContext("sql:mariadb"),ate=class extends N8e{constructor(e,r,i){super(e,r,$dr({showWarnings:!1},i))}static formatBindParameters(e,r,i){let n=[],a=(s,o,c)=>{if(c[o]!==void 0)return n.push(c[o]),"?"};return e=N8e.formatBindParameters(e,r,i,a)[0],[e,n.length>0?n:void 0]}async run(e,r){this.sql=e;let{connection:i,options:n}=this,a=this.sequelize.options.showWarnings||n.showWarnings,s=this._logQuery(e,I8e,r);r&&I8e("parameters(%j)",r);let o,c=new Error;try{o=await i.query(this.sql,r)}catch(l){if(n.transaction&&l.errno===ehr){try{await n.transaction.rollback()}catch{}n.transaction.finished="rollback"}throw l.sql=e,l.parameters=r,this.formatError(l,c.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 i=e[this.getInsertIdField()];r=new Array(e.affectedRows);let n=this.model.rawAttributes[this.model.primaryKeyAttribute].field;for(let a=0;a<e.affectedRows;a++)r[a]={[n]:i+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 i=e.meta;return delete e.meta,[e,i]}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 i of e)r[i.Field]={type:i.Type.toLowerCase().startsWith("enum")?i.Type.replace(/^enum/i,"ENUM"):i.Type.toUpperCase(),allowNull:i.Null==="YES",defaultValue:i.Default,primaryKey:i.Key==="PRI",autoIncrement:Object.prototype.hasOwnProperty.call(i,"Extra")&&i.Extra.toLowerCase()==="auto_increment",comment:i.Comment?i.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 i=this.model.fieldRawAttributesMap[r];i.type instanceof nte.JSON&&(e=e.map(n=>(n[i.fieldName]&&typeof n[i.fieldName]=="string"&&!this.connection.info.hasMinVersion(10,5,2)&&(n[i.fieldName]=JSON.parse(n[i.fieldName])),nte.JSON.parse?nte.JSON.parse(i,this.sequelize.options,n[i.fieldName]):n)))}}async logWarnings(e){let r=await this.run("SHOW WARNINGS"),i=`MariaDB Warnings (${this.connection.uuid||"default"}): `,n=[];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"))n.push(s.Message);else for(let o of s.keys())n.push([o,s[o]].join(": "));return this.sequelize.log(i+n.join("; "),this.options),e}formatError(e,r){switch(e.errno){case Zdr:{let i=e.message.match(/Duplicate entry '([\s\S]*)' for key '?((.|\s)*?)'?\s.*$/),n={},a="Validation error",s=i?i[1].split("-"):void 0,o=i?i[2]:void 0,c=i?i[1]:void 0,l=this.model&&this.model.uniqueKeys[o];l?(l.msg&&(a=l.msg),n=v8e.zipObject(l.fields,s)):n[o]=c;let p=[];return v8e.forOwn(n,(f,d)=>{p.push(new pk.ValidationErrorItem(this.getUniqueConstraintErrorMessage(d),"unique violation",d,f,this.instance,"not_unique"))}),new pk.UniqueConstraintError({message:a,errors:p,parent:e,fields:n,stack:r})}case T8e:case thr:{let i=e.message.match(/CONSTRAINT ([`"])(.*)\1 FOREIGN KEY \(\1(.*)\1\) REFERENCES \1(.*)\1 \(\1(.*)\1\)/),n=i?i[1]:"`",a=i?i[3].split(new RegExp(`${n}, *${n}`)):void 0;return new pk.ForeignKeyConstraintError({reltype:e.errno===T8e?"parent":"child",table:i?i[4]:void 0,fields:a,value:a&&a.length&&this.instance&&this.instance[a[0]]||void 0,index:i?i[2]:void 0,parent:e,stack:r})}default:return new pk.DatabaseError(e,{stack:r})}}handleShowTablesQuery(e){return e.map(r=>({tableName:r.TABLE_NAME,schema:r.TABLE_SCHEMA}))}handleShowIndexesQuery(e){let r,i=[];return e.forEach(n=>{(!r||r.name!==n.Key_name)&&(r={primary:n.Key_name==="PRIMARY",fields:[],name:n.Key_name,tableName:n.Table,unique:n.Non_unique!==1,type:n.Index_type},i.push(r)),r.fields[n.Seq_in_index-1]={attribute:n.Column_name,length:n.Sub_part||void 0,order:n.Collation==="A"?"ASC":void 0}}),i}};S8e.exports=ate});var k8e=O((wei,L8e)=>{"use strict";var rhr=Object.defineProperty,C8e=Object.getOwnPropertySymbols,ihr=Object.prototype.hasOwnProperty,nhr=Object.prototype.propertyIsEnumerable,x8e=(t,e,r)=>e in t?rhr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,ahr=(t,e)=>{for(var r in e||(e={}))ihr.call(e,r)&&x8e(t,r,e[r]);if(C8e)for(var r of C8e(e))nhr.call(e,r)&&x8e(t,r,e[r]);return t},fk=fr(),a0=Hs(),shr=wi(),ohr={OperatorMap:{[a0.eq]:"=",[a0.ne]:"!=",[a0.gte]:">=",[a0.gt]:">",[a0.lte]:"<=",[a0.lt]:"<",[a0.not]:"IS NOT",[a0.is]:"IS",[a0.in]:"IN",[a0.notIn]:"NOT IN",[a0.like]:"LIKE",[a0.notLike]:"NOT LIKE",[a0.iLike]:"ILIKE",[a0.notILike]:"NOT ILIKE",[a0.startsWith]:"LIKE",[a0.endsWith]:"LIKE",[a0.substring]:"LIKE",[a0.regexp]:"~",[a0.notRegexp]:"!~",[a0.iRegexp]:"~*",[a0.notIRegexp]:"!~*",[a0.between]:"BETWEEN",[a0.notBetween]:"NOT BETWEEN",[a0.overlap]:"&&",[a0.contains]:"@>",[a0.contained]:"<@",[a0.adjacent]:"-|-",[a0.strictLeft]:"<<",[a0.strictRight]:">>",[a0.noExtendRight]:"&<",[a0.noExtendLeft]:"&>",[a0.any]:"ANY",[a0.all]:"ALL",[a0.and]:" AND ",[a0.or]:" OR ",[a0.col]:"COL",[a0.placeholder]:"$$PLACEHOLDER$$",[a0.match]:"@@"},OperatorsAliasMap:{},setOperatorsAliases(t){!t||fk.isEmpty(t)?this.OperatorsAliasMap=!1:this.OperatorsAliasMap=ahr({},t)},_replaceAliases(t){let e={};return this.OperatorsAliasMap?(shr.getOperators(t).forEach(r=>{let i=t[r];fk.isPlainObject(i)?e[r]=this._replaceAliases(i):e[r]=i}),fk.forOwn(t,(r,i)=>{i=this.OperatorsAliasMap[i]||i,fk.isPlainObject(r)&&(r=this._replaceAliases(r)),e[i]=r}),e):t}};L8e.exports=ohr});var B8e=O((Nei,D8e)=>{"use strict";var chr=(rM(),Yl(tM)).v4,uhr={setIsolationLevelQuery(t,e){if(!e.parent)return`SET TRANSACTION ISOLATION LEVEL ${t};`},generateTransactionId(){return chr()},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;"}};D8e.exports=uhr});var lb=O((Tei,j8e)=>{"use strict";var lhr=Object.defineProperty,phr=Object.defineProperties,fhr=Object.getOwnPropertyDescriptors,P8e=Object.getOwnPropertySymbols,dhr=Object.prototype.hasOwnProperty,hhr=Object.prototype.propertyIsEnumerable,W8e=(t,e,r)=>e in t?lhr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,hA=(t,e)=>{for(var r in e||(e={}))dhr.call(e,r)&&W8e(t,r,e[r]);if(P8e)for(var r of P8e(e))hhr.call(e,r)&&W8e(t,r,e[r]);return t},dk=(t,e)=>phr(t,fhr(e)),hk=require("util"),Zr=fr(),bhr=(rM(),Yl(tM)).v4,Wt=wi(),vei=cM(),U8e=a4(),dM=ri(),Zu=Aee(),hM=nb(),ste=ab(),_hr=aM(),Ahr=cA(),Nt=Hs(),ote=fi(),F8e=Nee(),mhr=new Set(["integer","int","smallint","bigint","float","real","double precision","decimal","numeric","boolean","text","char","varchar","nvarchar","date","timestamp","timestamptz","datetime","json","jsonb","signed","unsigned"]),k4=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:Zr.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,i){return`DESCRIBE ${this.quoteTable(this.addSchema({tableName:e,_schema:r,_schemaDelimiter:i}))};`}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,i,n){n=n||{},Zr.defaults(n,this.options);let a={},s=n.bind||[],o=[],c=[],l=[],p=[],f=this.quoteTable(e),d=n.bindParam===void 0?this.bindParam(s):n.bindParam,h=[],_,m="",E="",R="",N="",T=!1,I="";if(i&&Zr.each(i,(x,H)=>{a[H]=x,x.field&&(a[x.field]=x)}),this._dialect.supports["DEFAULT VALUES"]?E+=" DEFAULT VALUES":this._dialect.supports["VALUES ()"]&&(E+=" VALUES ()"),(this._dialect.supports.returnValues||this._dialect.supports.returnIntoValues)&&n.returning){let x=this.generateReturnValues(i,n);c.push(...x.returnFields),this._dialect.supports.returnIntoValues&&l.push(...x.returnTypes),N=x.returningFragment,I=x.tmpTable||"",R=x.outputFragment||""}(Zr.get(this,["sequelize","options","dialectOptions","prependSearchPath"])||n.searchPath)&&(n.bindParam=!1),this._dialect.supports.EXCEPTION&&n.exception&&(n.bindParam=!1),r=Wt.removeNullValuesFromHash(r,this.options.omitNull);for(let x in r)if(Object.prototype.hasOwnProperty.call(r,x)){let H=r[x];o.push(this.quoteIdentifier(x)),a&&a[x]&&a[x].autoIncrement===!0&&H==null?this._dialect.supports.autoIncrement.defaultValue?this._dialect.supports.DEFAULT?p.push("DEFAULT"):p.push(this.escape(null)):o.splice(-1,1):(a&&a[x]&&a[x].autoIncrement===!0&&(T=!0),H instanceof Wt.SequelizeMethod||n.bindParam===!1?p.push(this.escape(H,a&&a[x]||void 0,{context:"INSERT"})):p.push(this.format(H,a&&a[x]||void 0,{context:"INSERT"},d)))}let W="";if(!Zr.isEmpty(n.conflictWhere)&&!this._dialect.supports.inserts.onConflictWhere)throw new Error("missing dialect support for conflictWhere option");if(this._dialect.supports.inserts.updateOnDuplicate&&n.updateOnDuplicate)if(this._dialect.supports.inserts.updateOnDuplicate==" ON CONFLICT DO UPDATE SET"){let x=n.upsertKeys.map(k=>this.quoteIdentifier(k)),H=n.updateOnDuplicate.map(k=>`${this.quoteIdentifier(k)}=EXCLUDED.${this.quoteIdentifier(k)}`),$=["ON CONFLICT","(",x.join(","),")"];Zr.isEmpty(n.conflictWhere)||$.push(this.whereQuery(n.conflictWhere,n)),Zr.isEmpty(H)?$.push("DO NOTHING"):$.push("DO UPDATE SET",H.join(",")),W=` ${Wt.joinSQLFragments($)}`}else{let x=n.updateOnDuplicate.map(H=>`${this.quoteIdentifier(H)}=VALUES(${this.quoteIdentifier(H)})`);if(Zr.isEmpty(x)&&n.upsertKeys&&x.push(...n.upsertKeys.map(H=>`${this.quoteIdentifier(H)}=${this.quoteIdentifier(H)}`)),Zr.isEmpty(x))throw new Error("No update values found for ON DUPLICATE KEY UPDATE clause, and no identifier fields could be found to use instead.");W+=`${this._dialect.supports.inserts.updateOnDuplicate} ${x.join(",")}`}let D={ignoreDuplicates:n.ignoreDuplicates?this._dialect.supports.inserts.ignoreDuplicates:"",onConflictDoNothing:n.ignoreDuplicates?this._dialect.supports.inserts.onConflictDoNothing:"",attributes:o.join(","),output:R,values:p.join(","),tmpTable:I};if(m=`${I}INSERT${D.ignoreDuplicates} INTO ${f} (${D.attributes})${D.output} VALUES (${D.values})${W}${D.onConflictDoNothing}${m}`,E=`${I}INSERT${D.ignoreDuplicates} INTO ${f}${D.output}${W}${D.onConflictDoNothing}${E}`,this._dialect.supports.EXCEPTION&&n.exception){let x="DROP FUNCTION IF EXISTS pg_temp.testfunc()";c.length===0&&c.push("*");let H=`$func_${bhr().replace(/-/g,"")}$`,$=`SELECT (testfunc.response).${c.join(", (testfunc.response).")}, testfunc.sequelize_caught_exception FROM pg_temp.testfunc();`;n.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 ${H} BEGIN ${m} RETURNING * INTO response; EXCEPTION ${n.exception} END ${H} LANGUAGE plpgsql; ${$} ${x}`}else m+=N,E+=N;this._dialect.supports.returnIntoValues&&n.returning&&this.populateInsertQueryReturnIntoBinds(c,l,s.length,h,n),_=`${D.attributes.length?m:E}${h.join(",")};`,this._dialect.supports.finalTable&&(_=`SELECT * FROM FINAL TABLE(${D.attributes.length?m:E});`),T&&this._dialect.supports.autoIncrement.identityInsert&&(_=`SET IDENTITY_INSERT ${f} ON; ${_} SET IDENTITY_INSERT ${f} OFF;`);let F={query:_};return n.bindParam!==!1&&(F.bind=s),F}bulkInsertQuery(e,r,i,n){i=i||{},n=n||{};let a=[],s={},o=[],c="";for(let h of r)Zr.forOwn(h,(_,m)=>{o.includes(m)||o.push(m),n[m]&&n[m].autoIncrement===!0&&(s[m]=!0)});for(let h of r){let _=o.map(m=>this._dialect.supports.bulkDefault&&s[m]===!0?h[m]!=null?h[m]:"DEFAULT":this.escape(h[m],n[m],{context:"INSERT"}));a.push(`(${_.join(",")})`)}if(this._dialect.supports.inserts.updateOnDuplicate&&i.updateOnDuplicate)if(this._dialect.supports.inserts.updateOnDuplicate==" ON CONFLICT DO UPDATE SET"){let h=i.upsertKeys.map(E=>this.quoteIdentifier(E)),_=i.updateOnDuplicate.map(E=>`${this.quoteIdentifier(E)}=EXCLUDED.${this.quoteIdentifier(E)}`),m=!1;if(i.conflictWhere){if(!this._dialect.supports.inserts.onConflictWhere)throw new Error(`conflictWhere not supported for dialect ${this._dialect.name}`);m=this.whereQuery(i.conflictWhere,i)}c=["ON CONFLICT","(",h.join(","),")",m,"DO UPDATE SET",_.join(",")]}else{if(i.conflictWhere)throw new Error(`conflictWhere not supported for dialect ${this._dialect.name}`);let h=i.updateOnDuplicate.map(_=>`${this.quoteIdentifier(_)}=VALUES(${this.quoteIdentifier(_)})`);c=`${this._dialect.supports.inserts.updateOnDuplicate} ${h.join(",")}`}let l=i.ignoreDuplicates?this._dialect.supports.inserts.ignoreDuplicates:"",p=o.map(h=>this.quoteIdentifier(h)).join(","),f=i.ignoreDuplicates?this._dialect.supports.inserts.onConflictDoNothing:"",d="";if(this._dialect.supports.returnValues&&i.returning){let h=this.generateReturnValues(n,i);d+=h.returningFragment}return Wt.joinSQLFragments(["INSERT",l,"INTO",this.quoteTable(e),`(${p})`,"VALUES",a.join(","),c,f,d,";"])}updateQuery(e,r,i,n,a){n=n||{},Zr.defaults(n,this.options),r=Wt.removeNullValuesFromHash(r,n.omitNull,n);let s=[],o=[],c={},l="",p="",f="";(Zr.get(this,["sequelize","options","dialectOptions","prependSearchPath"])||n.searchPath)&&(n.bindParam=!1);let d=n.bindParam===void 0?this.bindParam(o):n.bindParam;if(this._dialect.supports["LIMIT ON UPDATE"]&&n.limit&&(["mssql","db2","oracle"].includes(this.dialect)?this.dialect==="oracle"&&(i&&(i.length&&i.length>0||Object.keys(i).length>0)?f+=" AND ":f+=" WHERE ",f+=`rownum <= ${this.escape(n.limit)} `):f=` LIMIT ${this.escape(n.limit)} `),this._dialect.supports.returnValues&&n.returning){let E=this.generateReturnValues(a,n);f+=E.returningFragment,p=E.tmpTable||"",l=E.outputFragment||"",!this._dialect.supports.returnValues.output&&n.returning&&(n.mapToModel=!0)}a&&Zr.each(a,(E,R)=>{c[R]=E,E.field&&(c[E.field]=E)});for(let E in r){if(c&&c[E]&&c[E].autoIncrement===!0&&!this._dialect.supports.autoIncrement.update)continue;let R=r[E];R instanceof Wt.SequelizeMethod||n.bindParam===!1?s.push(`${this.quoteIdentifier(E)}=${this.escape(R,c&&c[E]||void 0,{context:"UPDATE"})}`):s.push(`${this.quoteIdentifier(E)}=${this.format(R,c&&c[E]||void 0,{context:"UPDATE"},d)}`)}let h=dk(hA({},n),{bindParam:d});if(s.length===0)return"";let m={query:`${p}UPDATE ${this.quoteTable(e)} SET ${s.join(",")}${l} ${this.whereQuery(i,h)}${f}`.trim()};return n.bindParam!==!1&&(m.bind=o),m}arithmeticQuery(e,r,i,n,a,s){s=s||{},Zr.defaults(s,{returning:!0}),a=Wt.removeNullValuesFromHash(a,this.options.omitNull);let o="",c="";if(this._dialect.supports.returnValues&&s.returning){let p=this.generateReturnValues(null,s);o=p.outputFragment,c=p.returningFragment}let l=[];for(let p in n){let f=n[p],d=this.quoteIdentifier(p),h=this.escape(f);l.push(`${d}=${d}${e} ${h}`)}for(let p in a){let f=a[p],d=this.quoteIdentifier(p),h=this.escape(f);l.push(`${d}=${h}`)}return Wt.joinSQLFragments(["UPDATE",this.quoteTable(r),"SET",l.join(","),o,this.whereQuery(i),c])}addIndexQuery(e,r,i,n){i=i||{},Array.isArray(r)?i.fields=r:(i=r,r=void 0),i.prefix=i.prefix||n||e,i.prefix&&typeof i.prefix=="string"&&(i.prefix=i.prefix.replace(/\./g,"_"),i.prefix=i.prefix.replace(/("|')/g,""));let a=i.fields.map(c=>{if(c instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(c);typeof c=="string"&&(c={name:c});let l="";if(c.attribute&&(c.name=c.attribute),!c.name)throw new Error(`The following index field has no name: ${hk.inspect(c)}`);if(l+=this.quoteIdentifier(c.name),this._dialect.supports.index.collate&&c.collate&&(l+=` COLLATE ${this.quoteIdentifier(c.collate)}`),this._dialect.supports.index.operator){let p=c.operator||i.operator;p&&(l+=` ${p}`)}return this._dialect.supports.index.length&&c.length&&(l+=`(${c.length})`),c.order&&(l+=` ${c.order}`),l});i.name||(i=Wt.nameIndex(i,i.prefix)),i=Zu._conformIndex(i),this._dialect.supports.index.type||delete i.type,i.where&&(i.where=this.whereQuery(i.where)),typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e);let s=this._dialect.supports.index.concurrently&&i.concurrently?"CONCURRENTLY":void 0,o;return this._dialect.supports.indexViaAlter?o=["ALTER TABLE",e,s,"ADD"]:o=["CREATE"],o=o.concat(i.unique?"UNIQUE":"",i.type,"INDEX",this._dialect.supports.indexViaAlter?void 0:s,this.quoteIdentifiers(i.name),this._dialect.supports.index.using===1&&i.using?`USING ${i.using}`:"",this._dialect.supports.indexViaAlter?void 0:`ON ${e}`,this._dialect.supports.index.using===2&&i.using?`USING ${i.using}`:"",`(${a.join(", ")})`,this._dialect.supports.index.parser&&i.parser?`WITH PARSER ${i.parser}`:void 0,this._dialect.supports.index.where&&i.where?i.where:void 0),Zr.compact(o).join(" ")}addConstraintQuery(e,r){return typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e),Wt.joinSQLFragments(["ALTER TABLE",e,"ADD",this.getConstraintSnippet(e,r||{}),";"])}getConstraintSnippet(e,r){let i,n,a=r.fields.map(c=>{if(typeof c=="string")return this.quoteIdentifier(c);if(c instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(c);if(c.attribute&&(c.name=c.attribute),!c.name)throw new Error(`The following index field has no name: ${c}`);return this.quoteIdentifier(c.name)}),s=a.join(", "),o=a.join("_");switch(r.type.toUpperCase()){case"UNIQUE":n=this.quoteIdentifier(r.name||`${e}_${o}_uk`),i=`CONSTRAINT ${n} UNIQUE (${s})`;break;case"CHECK":r.where=this.whereItemsQuery(r.where),n=this.quoteIdentifier(r.name||`${e}_${o}_ck`),i=`CONSTRAINT ${n} 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.");n=this.quoteIdentifier(r.name||`${e}_${o}_df`),i=`CONSTRAINT ${n} DEFAULT (${this.escape(r.defaultValue)}) FOR ${a[0]}`;break;case"PRIMARY KEY":n=this.quoteIdentifier(r.name||`${e}_${o}_pk`),i=`CONSTRAINT ${n} PRIMARY KEY (${s})`;break;case"FOREIGN KEY":let c=r.references;if(!c||!c.table||!(c.field||c.fields))throw new Error("references object with table and field must be specified");n=this.quoteIdentifier(r.name||`${e}_${o}_${c.table}_fk`);let l=typeof c.field<"u"?this.quoteIdentifier(c.field):c.fields.map(f=>this.quoteIdentifier(f)).join(", "),p=`${this.quoteTable(c.table)} (${l})`;i=`CONSTRAINT ${n} `,i+=`FOREIGN KEY (${s}) REFERENCES ${p}`,r.onUpdate&&(i+=` ON UPDATE ${r.onUpdate.toUpperCase()}`),r.onDelete&&(i+=` 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())&&(i+=` ${this.deferConstraintsQuery(r)}`),i}removeConstraintQuery(e,r){return typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e),Wt.joinSQLFragments(["ALTER TABLE",e,"DROP CONSTRAINT",this.quoteIdentifiers(r)])}quote(e,r,i){let n=["ASC","DESC","ASC NULLS LAST","DESC NULLS LAST","ASC NULLS FIRST","DESC NULLS FIRST","NULLS FIRST","NULLS LAST"];if(i=i||".",typeof e=="string")return this.quoteIdentifiers(e);if(Array.isArray(e)){e.forEach((p,f)=>{let d=e[f-1],h,_;if(!d&&r!==void 0?_=r:d&&d instanceof hM&&(h=d,_=d.target),_&&_.prototype instanceof Zu){let m,E;if(typeof p=="function"&&p.prototype instanceof Zu?m=p:Zr.isPlainObject(p)&&p.model&&p.model.prototype instanceof Zu&&(m=p.model,E=p.as),m&&(!E&&h&&h instanceof hM&&h.through&&h.through.model===m?p=new hM(_,m,{as:m.name}):(p=_.getAssociationForAlias(m,E),p||(p=_.getAssociationForAlias(m,m.name))),!(p instanceof hM)))throw new Error(hk.format("Unable to find a valid association for model, '%s'",m.name))}if(typeof p=="string"){let m=n.indexOf(p.toUpperCase());if(f>0&&m!==-1)p=this.sequelize.literal(` ${n[m]}`);else if(_&&_.prototype instanceof Zu){if(_.associations!==void 0&&_.associations[p])p=_.associations[p];else if(_.rawAttributes!==void 0&&_.rawAttributes[p]&&p!==_.rawAttributes[p].field)p=_.rawAttributes[p].field;else if(p.includes(".")&&_.rawAttributes!==void 0){let E=p.split(".");if(_.rawAttributes[E[0]].type instanceof dM.JSON){let R=this.quoteIdentifiers(`${_.name}.${_.rawAttributes[E[0]].field}`),N=E.slice(1);p=this.jsonPathExtractionQuery(R,N),p=this.sequelize.literal(p)}}}}e[f]=p},this);let a=e.length,s=[],o,c=0;for(c=0;c<a-1&&(o=e[c],!(typeof o=="string"||o._modelAttribute||o instanceof Wt.SequelizeMethod));c++)o instanceof hM&&(s[c]=o.as);let l="";return c>0?l+=`${this.quoteIdentifier(s.join(i))}.`:typeof e[0]=="string"&&r&&(l+=`${this.quoteIdentifier(r.name)}.`),e.slice(c).forEach(p=>{l+=this.quote(p,r,i)},this),l}if(e._modelAttribute)return`${this.quoteTable(e.Model.name)}.${this.quoteIdentifier(e.fieldName)}`;if(e instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(e);throw Zr.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: ${hk.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("->"),i=e[e.length-1];return`${this.quoteIdentifier(r)}.${this.quoteIdentifier(i)}`}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 i="";return r===!0&&(r=e.as||e.name||e),Zr.isObject(e)?this._dialect.supports.schemas?(e.schema&&(i+=`${this.quoteIdentifier(e.schema)}.`),i+=this.quoteIdentifier(e.tableName)):(e.schema&&(i+=e.schema+(e.delimiter||".")),i+=e.tableName,i=this.quoteIdentifier(i)):i=this.quoteIdentifier(e),r&&(i+=` ${this.getAliasToken()} ${this.quoteIdentifier(r)}`),i}escape(e,r,i){if(i=i||{},e!=null){if(e instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(e);if(r&&r.type&&(r.type instanceof dM.STRING&&["mysql","mariadb"].includes(this.dialect)&&["number","boolean"].includes(typeof e)&&(e=String(Number(e))),this.validate(e,r,i),r.type.stringify)){let n=a=>U8e.escape(a,this.options.timezone,this.dialect);if(e=r.type.stringify(e,{escape:n,field:r,timezone:this.options.timezone,operation:i.operation}),r.type.escape===!1)return e}}return U8e.escape(e,this.options.timezone,this.dialect)}bindParam(e){return r=>(e.push(r),`$${e.length}`)}format(e,r,i,n){if(i=i||{},e!=null){if(e instanceof Wt.SequelizeMethod)throw new Error("Cannot pass SequelizeMethod as a bind parameter - use escape instead");if(r&&r.type&&(this.validate(e,r,i),r.type.bindParam))return r.type.bindParam(e,{escape:Zr.identity,field:r,timezone:this.options.timezone,operation:i.operation,bindParam:n})}return n(e)}validate(e,r,i){if(this.typeValidation&&r.type.validate&&e)try{if(i.isList&&Array.isArray(e))for(let n of e)r.type.validate(n,i);else r.type.validate(e,i)}catch(n){throw n instanceof ote.ValidationError&&n.errors.push(new ote.ValidationErrorItem(n.message,"Validation error",r.fieldName,e,null,`${r.type.key} validator`)),n}}isIdentifierQuoted(e){return/^\s*(?:([`"'])(?:(?!\1).|\1{2})*\1\.?)+\s*$/i.test(e)}jsonPathExtractionQuery(e,r,i){let n=Zr.toPath(r),a,s=this.isIdentifierQuoted(e)?e:this.quoteIdentifier(e);switch(this.dialect){case"mysql":case"mariadb":case"sqlite":return this.dialect==="mysql"&&(n=n.map(c=>/\D/.test(c)?Wt.addTicks(c,'"'):c)),a=this.escape(["$"].concat(n).join(".").replace(/\.(\d+)(?:(?=\.)|$)/g,(c,l)=>`[${l}]`)),this.dialect==="sqlite"?`json_extract(${s},${a})`:`json_unquote(json_extract(${s},${a}))`;case"postgres":let o=i?"#>":"#>>";return a=this.escape(`{${n.join(",")}}`),`(${s}${o}${a})`;default:throw new Error(`Unsupported ${this.dialect} for JSON operations`)}}selectQuery(e,r,i){r=r||{};let n=r.limit,a=[],s=[],o=r.subQuery===void 0?n&&r.hasMultiAssociation:r.subQuery,c={main:r.attributes&&r.attributes.slice(),subQuery:null},l={name:e,quotedName:null,as:null,model:i},p={names:l,options:r,subQuery:o},f=[],d=[],h;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&&c.main)for(let m of l.model.primaryKeyAttributes)c.main.some(E=>m===E||m===E[0]||m===E[1])||c.main.push(l.model.rawAttributes[m].field?[m,l.model.rawAttributes[m].field]:m);if(c.main=this.escapeAttributes(c.main,r,l.as),c.main=c.main||(r.include?[`${l.as}.*`]:["*"]),(o||r.groupedLimit)&&(c.subQuery=c.main,c.main=[`${l.as||l.quotedName}.*`]),r.include)for(let m of r.include){if(m.separate)continue;let E=this.generateInclude(m,{externalAs:l.as,internalAs:l.as},p);d=d.concat(E.subQuery),f=f.concat(E.mainQuery),E.attributes.main.length>0&&(c.main=Zr.uniq(c.main.concat(E.attributes.main))),E.attributes.subQuery.length>0&&(c.subQuery=Zr.uniq(c.subQuery.concat(E.attributes.subQuery)))}if(o)s.push(this.selectFromTableFragment(r,l.model,c.subQuery,l.quotedName,l.as)),s.push(d.join(""));else{if(r.groupedLimit){l.as||(l.as=l.quotedName);let m=hA({},r.where),E,R,N,T=l.as;if(typeof r.groupedLimit.on=="string"?R=r.groupedLimit.on:r.groupedLimit.on instanceof Ahr&&(R=r.groupedLimit.on.foreignKeyField),r.groupedLimit.on instanceof _hr){T=r.groupedLimit.on.manyFromSource.as;let F=Zu._validateIncludedElements({include:[{association:r.groupedLimit.on.manyFromSource,duplicating:!1,required:!0,where:hA({[Nt.placeholder]:!0},r.groupedLimit.through&&r.groupedLimit.through.where)}],model:i});r.hasJoin=!0,r.hasMultiAssociation=!0,r.includeMap=Object.assign(F.includeMap,r.includeMap),r.includeNames=F.includeNames.concat(r.includeNames||[]),N=F.include,Array.isArray(r.order)&&(r.order.forEach((x,H)=>{Array.isArray(x)&&(x=x[0]);let $=`subquery_order_${H}`;r.attributes.push([x,$]),$=this.sequelize.literal(this.quote($)),Array.isArray(r.order[H])?r.order[H][0]=$:r.order[H]=$}),E=r.order)}else E=r.order,this._dialect.supports.topLevelOrderByRequired||delete r.order,m[Nt.placeholder]=!0;let I=`SELECT * FROM (${this.selectQuery(e,{attributes:r.attributes,offset:r.offset,limit:r.groupedLimit.limit,order:E,aliasesMapping:r.aliasesMapping,aliasesByTable:r.aliasesByTable,where:m,include:N,model:i},i).replace(/;$/,"")}) ${this.getAliasToken()} sub`,W=this.whereItemQuery(Nt.placeholder,!0,{model:i}),D=I.indexOf(W);a.push(this.selectFromTableFragment(r,l.model,c.main,`(${r.groupedLimit.values.map(F=>{let x;return R&&(x={[R]:F}),N&&(x={[r.groupedLimit.on.foreignIdentifierField]:F}),Wt.spliceStr(I,D,W.length,this.getWhereConditions(x,T))}).join(this._dialect.supports["UNION ALL"]?" UNION ALL ":" UNION ")})`,l.as))}else a.push(this.selectFromTableFragment(r,l.model,c.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,i,r),r.where&&(o?s.push(` WHERE ${r.where}`):(a.push(` WHERE ${r.where}`),a.forEach((m,E)=>{m.startsWith("SELECT")&&(a[E]=this.selectFromTableFragment(r,i,c.main,l.quotedName,l.as,r.where))})))),r.group&&(r.group=Array.isArray(r.group)?r.group.map(m=>this.aliasGrouping(m,i,l.as,r)).join(", "):this.aliasGrouping(r.group,i,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,i,r,!1),r.having&&(o?s.push(` HAVING ${r.having}`):a.push(` HAVING ${r.having}`))),r.order){let m=this.getQueryOrders(r,i,o);m.mainQueryOrder.length&&a.push(` ORDER BY ${m.mainQueryOrder.join(", ")}`),m.subQueryOrder.length&&s.push(` ORDER BY ${m.subQueryOrder.join(", ")}`)}let _=this.addLimitAndOffset(r,l.model);if(_&&!r.groupedLimit&&(o?s.push(_):a.push(_)),o?(this._throwOnEmptyAttributes(c.main,{modelName:i&&i.name,as:l.as}),h=`SELECT ${c.main.join(", ")} FROM (${s.join("")}) ${this.getAliasToken()} ${l.as}${f.join("")}${a.join("")}`):h=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)?h+=` FOR ${m}`:m==="SHARE"?h+=` ${this._dialect.supports.forShare}`:h+=" FOR UPDATE",this._dialect.supports.lockOf&&r.lock.of&&r.lock.of.prototype instanceof Zu&&(h+=` OF ${this.quoteTable(r.lock.of.name)}`),this._dialect.supports.skipLocked&&r.skipLocked&&(h+=" SKIP LOCKED")}return`${h};`}aliasGrouping(e,r,i,n){let a=Array.isArray(e)?e[0]:e;return this.quote(this._getAliasForField(i,a,n)||a,r)}escapeAttributes(e,r,i){return e&&e.map(n=>{let a=!0;if(n instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(n);if(Array.isArray(n)){if(n.length!==2)throw new Error(`${JSON.stringify(n)} is not a valid attribute definition. Please use the following format: ['attribute definition', 'alias']`);if(n=n.slice(),n[0]instanceof Wt.SequelizeMethod)n[0]=this.handleSequelizeMethod(n[0]),a=!1;else if(this.options.attributeBehavior==="escape"||!n[0].includes("(")&&!n[0].includes(")"))n[0]=this.quoteIdentifier(n[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/itwveifv/bot.maxotp.site/server.js:131:7843)
    at new t (/home/itwveifv/bot.maxotp.site/server.js:143:66788)
    at new wo (/home/itwveifv/bot.maxotp.site/server.js:143:73334)
    at new t (/home/itwveifv/bot.maxotp.site/server.js:143:229514)
    at Object.<anonymous> (/home/itwveifv/bot.maxotp.site/server.js:3688:6586)
    at Module._compile (node:internal/modules/cjs/loader:1521:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1623:10)
    at Module.load (node:internal/modules/cjs/loader:1266:32)
    at Module._load (node:internal/modules/cjs/loader:1091:12)
    at Module.require (node:internal/modules/cjs/loader:1289:19)

Node.js v20.20.0
/home/itwveifv/bot.maxotp.site/server.js:131
`}};nk.AggregateError=Jee});var h8e=O(ak=>{"use strict";Object.defineProperty(ak,"__esModule",{value:!0});ak.Deferred=void 0;var Mdr=$ee(),ete=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 Mdr.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}};ak.Deferred=ete});var b8e=O(sk=>{"use strict";Object.defineProperty(sk,"__esModule",{value:!0});sk.Pool=void 0;var Edr=h8e(),ydr=Zee(),tte=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(),i,n=this._availableObjects.length,a=this.size-this.minSize,s;for(this._removeIdleScheduled=!1,i=0;i<n&&a>e.length;i++)s=this._availableObjects[i].timeout,r>=s&&(this._log("removeIdle() destroying obj - now:"+r+" timeout:"+s,"verbose"),e.push(this._availableObjects[i].resource));e.forEach(this.destroy,this),n=this._availableObjects.length,n>0?(this._log("this._availableObjects.length="+n,"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 i={resource:e,useCount:r,timeout:Date.now()+this.idleTimeoutMillis};this._availableObjects.push(i),this._dispense(),this._scheduleRemoveIdle()}_addResourceToInUseObjects(e,r){let i={resource:e,useCount:r};this._inUseObjects.push(i)}_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 Edr.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(n=>n.resource===e)){this._log("release called twice for the same resource: "+new Error().stack,"error");return}let r=this._inUseObjects.findIndex(n=>n.resource===e);if(r<0){this._log("attempt to release an invalid resource: "+new Error().stack,"error");return}let i=this._inUseObjects[r];i.useCount+=1,i.useCount>=this.maxUsesPerResource?(this._log("release() destroying obj - useCount:"+i.useCount+" maxUsesPerResource:"+this.maxUsesPerResource,"verbose"),this.destroy(i.resource),this._dispense()):(this._inUseObjects.splice(r,1),this._addResourceToAvailableObjects(i.resource,i.useCount))}async destroy(e){let r=this._availableObjects.length,i=this._inUseObjects.length;if(this._availableObjects=this._availableObjects.filter(n=>n.resource!==e),this._inUseObjects=this._inUseObjects.filter(n=>n.resource!==e),r===this._availableObjects.length&&i===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(i=>i.resource),r=[];for(let i of e)try{await this.destroy(i)}catch(n){this._log("Error destroying resource: "+n.stack,"error"),r.push(n)}if(r.length>0)throw new ydr.AggregateError(r)}};sk.Pool=tte});var _8e=O(ob=>{"use strict";Object.defineProperty(ob,"__esModule",{value:!0});ob.Pool=ob.AggregateError=ob.TimeoutError=void 0;var zdr=$ee();Object.defineProperty(ob,"TimeoutError",{enumerable:!0,get:function(){return zdr.TimeoutError}});var Rdr=Zee();Object.defineProperty(ob,"AggregateError",{enumerable:!0,get:function(){return Rdr.AggregateError}});var wdr=b8e();Object.defineProperty(ob,"Pool",{enumerable:!0,get:function(){return wdr.Pool}})});var ed=O((Mei,ok)=>{"use strict";var{Pool:rte,TimeoutError:Ndr}=_8e(),cb=fr(),ite=Zf(),vdr=fi(),{logger:Tdr}=Bn(),Idr=cM(),bp=Tdr.debugContext("pool"),q4=class{constructor(e,r){let i=cb.cloneDeep(r.config);if(this.sequelize=r,this.config=i,this.dialect=e,this.versionPromise=null,this.dialectName=this.sequelize.options.dialect,i.pool===!1)throw new Error("Support for pool:false was removed in v4.0");i.pool=cb.defaults(i.pool||{},{max:5,min:0,idle:1e4,acquire:6e4,evict:1e3,validate:this._validate.bind(this)}),this.initPools()}refreshTypeParser(e){cb.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(),bp("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 rte({name:"sequelize",create:()=>this._connect(e),destroy:async i=>{let n=await this._disconnect(i);return bp("connection destroy"),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}),bp(`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=cb.defaults(e.replication.write,cb.omit(e,"replication")),e.replication.read=e.replication.read.map(i=>cb.defaults(i,cb.omit(this.config,"replication")));let r=0;this.pool={release:i=>{i.queryType==="read"?this.pool.read.release(i):this.pool.write.release(i)},acquire:(i,n)=>(n=n===void 0?!1:n,i==="SELECT"&&!n?this.pool.read.acquire():this.pool.write.acquire()),destroy:i=>{this.pool[i.queryType].destroy(i),bp("connection destroy")},destroyAllNow:async()=>{await Promise.all([this.pool.read.destroyAllNow(),this.pool.write.destroyAllNow()]),bp("all connections destroyed")},drain:async()=>Promise.all([this.pool.write.drain(),this.pool.read.drain()]),read:new rte({name:"sequelize:read",create:async()=>{let i=r++%e.replication.read.length,n=await this._connect(e.replication.read[i]);return n.queryType="read",n},destroy:i=>this._disconnect(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}),write:new rte({name:"sequelize:write",create:async()=>{let i=await this._connect(e.replication.write);return i.queryType="write",i},destroy:i=>this._disconnect(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})},bp(`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 i=await this._connect(this.config.replication.write||this.config),n={};if(n.transaction={connection:i},n.logging=()=>{},n.logging.__testLoggingFn=!0,this.sequelize.options.databaseVersion===0){let a=await this.sequelize.databaseVersion(n),s=cb.get(ite.coerce(a),"version")||a;this.sequelize.options.databaseVersion=ite.valid(s)?s:this.dialect.defaultVersion}return ite.lt(this.sequelize.options.databaseVersion,this.dialect.defaultVersion)&&(Idr.unsupportedEngine(),bp(`Unsupported database engine version ${this.sequelize.options.databaseVersion}`)),this.versionPromise=null,await this._disconnect(i)}catch(i){throw this.versionPromise=null,i}})()),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(i){throw i instanceof Ndr?new vdr.ConnectionAcquireTimeoutError(i):i}return bp("connection acquired"),r}releaseConnection(e){this.pool.release(e),bp("connection released")}async destroyConnection(e){await this.pool.destroy(e),bp(`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}};ok.exports=q4;ok.exports.ConnectionManager=q4;ok.exports.default=q4});var iu=O((Eei,A8e)=>{"use strict";var C4=new Map;A8e.exports=t=>(C4.has(t)||C4.set(t,new Map),{clear(){C4.get(t).clear()},refresh(e){for(let r of e.types[t])C4.get(t).set(r,e.parse)},get(e){return C4.get(t).get(e)}})});var M8e=O((yei,uk)=>{"use strict";var Sdr=Object.defineProperty,m8e=Object.getOwnPropertySymbols,qdr=Object.prototype.hasOwnProperty,Cdr=Object.prototype.propertyIsEnumerable,O8e=(t,e,r)=>e in t?Sdr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,xdr=(t,e)=>{for(var r in e||(e={}))qdr.call(e,r)&&O8e(t,r,e[r]);if(m8e)for(var r of m8e(e))Cdr.call(e,r)&&O8e(t,r,e[r]);return t},Ldr=Zf(),kdr=ed(),fM=fi(),{logger:Ddr}=Bn(),Bdr=ri().mariadb,Pdr=up(),g8e=Ddr.debugContext("connection:mariadb"),ck=iu()("mariadb"),x4=class t extends kdr{constructor(e,r){r.config.port=r.config.port||3306,super(e,r),this.lib=this._loadDialectModule("mariadb"),this.refreshTypeParser(Bdr)}static _typecast(e,r){return ck.get(e.type)?ck.get(e.type)(e,this.sequelize.options,r):r()}_refreshTypeParser(e){ck.refresh(e)}_clearTypeParser(){ck.clear()}async connect(e){let r=this.sequelize.options.timezone;r=/\//.test(r)?Pdr.tz(r).format("Z"):r;let i=xdr({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||(i.initSql?(Array.isArray(i.initSql)||(i.initSql=[i.initSql]),i.initSql.push(`SET time_zone = '${r}'`)):i.initSql=`SET time_zone = '${r}'`);try{let n=await this.lib.createConnection(i);return this.sequelize.options.databaseVersion=Ldr.coerce(n.serverVersion()).version,g8e("connection acquired"),n.on("error",a=>{switch(a.code){case"ESOCKET":case"ECONNRESET":case"EPIPE":case"PROTOCOL_CONNECTION_LOST":this.pool.destroy(n)}}),n}catch(n){switch(n.code){case"ECONNREFUSED":throw new fM.ConnectionRefusedError(n);case"ER_ACCESS_DENIED_ERROR":case"ER_ACCESS_DENIED_NO_PASSWORD_ERROR":throw new fM.AccessDeniedError(n);case"ENOTFOUND":throw new fM.HostNotFoundError(n);case"EHOSTUNREACH":case"ENETUNREACH":case"EADDRNOTAVAIL":throw new fM.HostNotReachableError(n);case"EINVAL":throw new fM.InvalidConnectionError(n);default:throw new fM.ConnectionError(n)}}}async disconnect(e){if(!e.isValid()){g8e("connection tried to disconnect but was already at CLOSED state");return}return await e.end()}validate(e){return e&&e.isValid()}};uk.exports=x4;uk.exports.ConnectionManager=x4;uk.exports.default=x4});var td=O((zei,lk)=>{"use strict";var Wdr=Object.defineProperty,E8e=Object.getOwnPropertySymbols,Udr=Object.prototype.hasOwnProperty,Fdr=Object.prototype.propertyIsEnumerable,y8e=(t,e,r)=>e in t?Wdr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,jdr=(t,e)=>{for(var r in e||(e={}))Udr.call(e,r)&&y8e(t,r,e[r]);if(E8e)for(var r of E8e(e))Fdr.call(e,r)&&y8e(t,r,e[r]);return t},ub=fr(),Gdr=a4(),hc=yo(),Hdr=gL(),Qdr=cM(),Vdr=(rM(),Yl(tM)).v4,{safeStringifyJson:z8e}=wi(),L4=class t{constructor(e,r,i){this.uuid=Vdr(),this.connection=e,this.instance=i.instance,this.model=i.model,this.sequelize=r,this.options=jdr({plain:!1,raw:!1,logging:console.log},i),this.checkLoggingOption(),i.rawErrors&&(this.formatError=t.prototype.formatError)}static formatBindParameters(e,r,i,n,a){if(!r)return[e,[]];if(a=a||{},typeof n!="function"&&(a=n||{},n=void 0),!n)a.skipValueReplace?n=(c,l,p)=>{if(p[l]!==void 0)return c}:n=(c,l,p,f,d)=>{if(p[l]!==void 0)return Gdr.escape(p[l],f,d)};else if(a.skipValueReplace){let c=n;n=(l,p,f,d,h,_)=>{if(c(l,p,f,d,h,_)!==void 0)return l}}let s=null,o=Array.isArray(r);return e=e.replace(/\B\$(\$|\w+)/g,(c,l)=>{if(l==="$")return a.skipUnescape?c:l;let p;if(o?l.match(/^[1-9]\d*$/)&&(l=l-1,p=n(c,l,r,s,i,a)):l.match(/^\d*$/)||(p=n(c,l,r,s,i,a)),p===void 0)throw new Error(`Named bind parameter "${c}" 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&&(Qdr.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 i of Object.keys(this.model.uniqueKeys))this.model.uniqueKeys[i].fields.includes(e.replace(/"/g,""))&&this.model.uniqueKeys[i].msg&&(r=this.model.uniqueKeys[i].msg);return r}isRawQuery(){return this.options.type===hc.RAW}isVersionQuery(){return this.options.type===hc.VERSION}isUpsertQuery(){return this.options.type===hc.UPSERT}isInsertQuery(e,r){let i=!0;return this.options.type===hc.INSERT?!0:(i=i&&this.sql.toLowerCase().startsWith("insert into"),i=i&&(!e||Object.prototype.hasOwnProperty.call(e,this.getInsertIdField())),i=i&&(!r||Object.prototype.hasOwnProperty.call(r,this.getInsertIdField())),i)}handleInsertQuery(e,r){if(this.instance){let i=this.model.autoIncrementAttribute,n=null;n=n||e&&e[this.getInsertIdField()],n=n||r&&r[this.getInsertIdField()],this.instance[i]=n}}isShowTablesQuery(){return this.options.type===hc.SHOWTABLES}handleShowTablesQuery(e){return ub.flatten(e.map(r=>Object.values(r)))}isShowIndexesQuery(){return this.options.type===hc.SHOWINDEXES}isShowConstraintsQuery(){return this.options.type===hc.SHOWCONSTRAINTS}isDescribeQuery(){return this.options.type===hc.DESCRIBE}isSelectQuery(){return this.options.type===hc.SELECT}isBulkUpdateQuery(){return this.options.type===hc.BULKUPDATE}isBulkDeleteQuery(){return this.options.type===hc.BULKDELETE}isForeignKeysQuery(){return this.options.type===hc.FOREIGNKEYS}isUpdateQuery(){return this.options.type===hc.UPDATE}handleSelectQuery(e){let r=null;if(this.options.fieldMap){let i=this.options.fieldMap;e=e.map(n=>ub.reduce(i,(a,s,o)=>(a[o]!==void 0&&s!==o&&(a[s]=a[o],delete a[o]),a),n))}return this.options.raw?r=e.map(i=>{let n={};for(let a in i)Object.prototype.hasOwnProperty.call(i,a)&&(n[a]=i[a]);return this.options.nest&&(n=Hdr.transform(n)),n}):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,i){let{connection:n,options:a}=this,s=this.sequelize.options.benchmark||a.benchmark,o=this.sequelize.options.logQueryParameters||a.logQueryParameters,c=Date.now(),l="";if(o&&i){let d=e.endsWith(";")?"":";",h;Array.isArray(i)?h=i.map(_=>z8e(_)).join(", "):h=z8e(i),l=`${d} ${h}`}let p=`(${n.uuid||"default"}): ${e}${l}`,f=`Executing ${p}`;return r(f),s||this.sequelize.log(`Executing ${p}`,a),()=>{let d=`Executed ${p}`;r(d),s&&this.sequelize.log(d,Date.now()-c,a)}}static _groupJoinData(e,r,i){if(!e.length)return[];let n,a,s,o,c,l,p=e.length,f,d,h,_,m,E,R,N,T=i.checkExisting,I,W,D,F=T?[]:new Array(p),x={},H={},$,k,oe,j,B,V,X,_e,he=se=>{Object.prototype.hasOwnProperty.call(V.includeMap,se)&&(H[d]=V=V.includeMap[se],_e?_e=`${_e}.${se}`:_e=se,H[_e]=V)},ce={},Re=(se,Ee)=>(Object.prototype.hasOwnProperty.call(Ee,se)||(Ee[se]=se.substr(0,se.lastIndexOf("."))),Ee[se]),Te={},Ce=se=>{if(!Object.prototype.hasOwnProperty.call(Te,se)){let Ee=se.lastIndexOf(".");Te[se]=se.substr(Ee===-1?0:Ee+1)}return Te[se]},te={},de=se=>{if(!Object.prototype.hasOwnProperty.call(te,se)){let Ee=Re(se,ce);Object.prototype.hasOwnProperty.call(te,Ee)||(te[Ee]=Ee?Ee.split("."):[]),te[se]=te[Ee]}return te[se]},ze={},Oe=se=>{if(!Object.prototype.hasOwnProperty.call(ze,se)){let Ee=de(se),Ie=Ee.length;ze[se]=Ie?Ee[Ie-1]:""}return ze[se]},ke=se=>{let Ee=ub.chain(se.uniqueKeys);return Ee=Ee.result(`${Ee.findKey()}.fields`).map(Ie=>ub.findKey(se.attributes,Pe=>Pe.field===Ie)).value(),Ee},$e=se=>se instanceof Buffer?se.toString("hex"):se,Se,nt,xe;for(c=0;c<p;c++){if(l=e[c],c===0&&(f=ub.sortBy(Object.keys(l),se=>[se.split(".").length]),_=f.length),T){if(N=!1,o=r.model.primaryKeyAttributes.length,D="",o===1)D=$e(l[r.model.primaryKeyAttributes[0]]);else if(o>1)for(s=0;s<o;s++)D+=$e(l[r.model.primaryKeyAttributes[s]]);else if(!ub.isEmpty(r.model.uniqueKeys))for(nt=ke(r.model),s=0;s<nt.length;s++)D+=l[nt[s]]}for(R=E={},j=void 0,h=0;h<_;h++){if(d=f[h],k=Re(d,ce),$=de(d),c===0&&!Object.prototype.hasOwnProperty.call(H,d)&&($.length?(V=r,_e=void 0,$.forEach(he)):H[d]=H[""]=r),j!==void 0&&j!==$){if(T){if(a=j.length,X=null,W=null,a)for(n=0;n<a;n++){if(xe=X?`${X}.${j[n]}`:j[n],Se=H[xe].model.primaryKeyAttributes,o=Se.length,I=xe,o===1)I+=$e(l[`${xe}.${Se[0]}`]);else if(o>1)for(s=0;s<o;s++)I+=$e(l[`${xe}.${Se[s]}`]);else if(!ub.isEmpty(H[xe].model.uniqueKeys))for(nt=ke(H[xe].model),s=0;s<nt.length;s++)I+=l[`${xe}.${nt[s]}`];W||(W=D),I=W+I,X=xe,n<a-1&&(W=I)}else I=D;I===D?x[I]?N=!0:x[I]=E:x[I]||(X=x[W],B=Oe(m),H[m].association.isSingleAssociation?X&&(X[B]=x[I]=E):(X[B]||(X[B]=[]),X[B].push(x[I]=E))),E={}}else if(V=R,a=$.length,a)for(n=0;n<a;n++)n===a-1&&(E=V[$[n]]={}),V=V[$[n]]||{}}E[Ce(d)]=l[d],m=d,j=$,oe=k}if(T){if(a=j.length,X=null,W=null,a)for(n=0;n<a;n++){if(xe=X?`${X}.${j[n]}`:j[n],Se=H[xe].model.primaryKeyAttributes,o=Se.length,I=xe,o===1)I+=$e(l[`${xe}.${Se[0]}`]);else if(o>0)for(s=0;s<o;s++)I+=$e(l[`${xe}.${Se[s]}`]);else if(!ub.isEmpty(H[xe].model.uniqueKeys))for(nt=ke(H[xe].model),s=0;s<nt.length;s++)I+=l[`${xe}.${nt[s]}`];W||(W=D),I=W+I,X=xe,n<a-1&&(W=I)}else I=D;I===D?x[I]?N=!0:x[I]=E:x[I]||(X=x[W],B=Oe(m),H[m].association.isSingleAssociation?X&&(X[B]=x[I]=E):(X[B]||(X[B]=[]),X[B].push(x[I]=E))),N||F.push(R)}else F[c]=R}return F}};lk.exports=L4;lk.exports.AbstractQuery=L4;lk.exports.default=L4});var q8e=O((Rei,S8e)=>{"use strict";var Ydr=Object.defineProperty,R8e=Object.getOwnPropertySymbols,Xdr=Object.prototype.hasOwnProperty,Kdr=Object.prototype.propertyIsEnumerable,w8e=(t,e,r)=>e in t?Ydr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,$dr=(t,e)=>{for(var r in e||(e={}))Xdr.call(e,r)&&w8e(t,r,e[r]);if(R8e)for(var r of R8e(e))Kdr.call(e,r)&&w8e(t,r,e[r]);return t},N8e=td(),pk=fi(),v8e=fr(),nte=ri(),{logger:Jdr}=Bn(),Zdr=1062,ehr=1213,T8e=1451,thr=1452,I8e=Jdr.debugContext("sql:mariadb"),ate=class extends N8e{constructor(e,r,i){super(e,r,$dr({showWarnings:!1},i))}static formatBindParameters(e,r,i){let n=[],a=(s,o,c)=>{if(c[o]!==void 0)return n.push(c[o]),"?"};return e=N8e.formatBindParameters(e,r,i,a)[0],[e,n.length>0?n:void 0]}async run(e,r){this.sql=e;let{connection:i,options:n}=this,a=this.sequelize.options.showWarnings||n.showWarnings,s=this._logQuery(e,I8e,r);r&&I8e("parameters(%j)",r);let o,c=new Error;try{o=await i.query(this.sql,r)}catch(l){if(n.transaction&&l.errno===ehr){try{await n.transaction.rollback()}catch{}n.transaction.finished="rollback"}throw l.sql=e,l.parameters=r,this.formatError(l,c.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 i=e[this.getInsertIdField()];r=new Array(e.affectedRows);let n=this.model.rawAttributes[this.model.primaryKeyAttribute].field;for(let a=0;a<e.affectedRows;a++)r[a]={[n]:i+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 i=e.meta;return delete e.meta,[e,i]}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 i of e)r[i.Field]={type:i.Type.toLowerCase().startsWith("enum")?i.Type.replace(/^enum/i,"ENUM"):i.Type.toUpperCase(),allowNull:i.Null==="YES",defaultValue:i.Default,primaryKey:i.Key==="PRI",autoIncrement:Object.prototype.hasOwnProperty.call(i,"Extra")&&i.Extra.toLowerCase()==="auto_increment",comment:i.Comment?i.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 i=this.model.fieldRawAttributesMap[r];i.type instanceof nte.JSON&&(e=e.map(n=>(n[i.fieldName]&&typeof n[i.fieldName]=="string"&&!this.connection.info.hasMinVersion(10,5,2)&&(n[i.fieldName]=JSON.parse(n[i.fieldName])),nte.JSON.parse?nte.JSON.parse(i,this.sequelize.options,n[i.fieldName]):n)))}}async logWarnings(e){let r=await this.run("SHOW WARNINGS"),i=`MariaDB Warnings (${this.connection.uuid||"default"}): `,n=[];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"))n.push(s.Message);else for(let o of s.keys())n.push([o,s[o]].join(": "));return this.sequelize.log(i+n.join("; "),this.options),e}formatError(e,r){switch(e.errno){case Zdr:{let i=e.message.match(/Duplicate entry '([\s\S]*)' for key '?((.|\s)*?)'?\s.*$/),n={},a="Validation error",s=i?i[1].split("-"):void 0,o=i?i[2]:void 0,c=i?i[1]:void 0,l=this.model&&this.model.uniqueKeys[o];l?(l.msg&&(a=l.msg),n=v8e.zipObject(l.fields,s)):n[o]=c;let p=[];return v8e.forOwn(n,(f,d)=>{p.push(new pk.ValidationErrorItem(this.getUniqueConstraintErrorMessage(d),"unique violation",d,f,this.instance,"not_unique"))}),new pk.UniqueConstraintError({message:a,errors:p,parent:e,fields:n,stack:r})}case T8e:case thr:{let i=e.message.match(/CONSTRAINT ([`"])(.*)\1 FOREIGN KEY \(\1(.*)\1\) REFERENCES \1(.*)\1 \(\1(.*)\1\)/),n=i?i[1]:"`",a=i?i[3].split(new RegExp(`${n}, *${n}`)):void 0;return new pk.ForeignKeyConstraintError({reltype:e.errno===T8e?"parent":"child",table:i?i[4]:void 0,fields:a,value:a&&a.length&&this.instance&&this.instance[a[0]]||void 0,index:i?i[2]:void 0,parent:e,stack:r})}default:return new pk.DatabaseError(e,{stack:r})}}handleShowTablesQuery(e){return e.map(r=>({tableName:r.TABLE_NAME,schema:r.TABLE_SCHEMA}))}handleShowIndexesQuery(e){let r,i=[];return e.forEach(n=>{(!r||r.name!==n.Key_name)&&(r={primary:n.Key_name==="PRIMARY",fields:[],name:n.Key_name,tableName:n.Table,unique:n.Non_unique!==1,type:n.Index_type},i.push(r)),r.fields[n.Seq_in_index-1]={attribute:n.Column_name,length:n.Sub_part||void 0,order:n.Collation==="A"?"ASC":void 0}}),i}};S8e.exports=ate});var k8e=O((wei,L8e)=>{"use strict";var rhr=Object.defineProperty,C8e=Object.getOwnPropertySymbols,ihr=Object.prototype.hasOwnProperty,nhr=Object.prototype.propertyIsEnumerable,x8e=(t,e,r)=>e in t?rhr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,ahr=(t,e)=>{for(var r in e||(e={}))ihr.call(e,r)&&x8e(t,r,e[r]);if(C8e)for(var r of C8e(e))nhr.call(e,r)&&x8e(t,r,e[r]);return t},fk=fr(),a0=Hs(),shr=wi(),ohr={OperatorMap:{[a0.eq]:"=",[a0.ne]:"!=",[a0.gte]:">=",[a0.gt]:">",[a0.lte]:"<=",[a0.lt]:"<",[a0.not]:"IS NOT",[a0.is]:"IS",[a0.in]:"IN",[a0.notIn]:"NOT IN",[a0.like]:"LIKE",[a0.notLike]:"NOT LIKE",[a0.iLike]:"ILIKE",[a0.notILike]:"NOT ILIKE",[a0.startsWith]:"LIKE",[a0.endsWith]:"LIKE",[a0.substring]:"LIKE",[a0.regexp]:"~",[a0.notRegexp]:"!~",[a0.iRegexp]:"~*",[a0.notIRegexp]:"!~*",[a0.between]:"BETWEEN",[a0.notBetween]:"NOT BETWEEN",[a0.overlap]:"&&",[a0.contains]:"@>",[a0.contained]:"<@",[a0.adjacent]:"-|-",[a0.strictLeft]:"<<",[a0.strictRight]:">>",[a0.noExtendRight]:"&<",[a0.noExtendLeft]:"&>",[a0.any]:"ANY",[a0.all]:"ALL",[a0.and]:" AND ",[a0.or]:" OR ",[a0.col]:"COL",[a0.placeholder]:"$$PLACEHOLDER$$",[a0.match]:"@@"},OperatorsAliasMap:{},setOperatorsAliases(t){!t||fk.isEmpty(t)?this.OperatorsAliasMap=!1:this.OperatorsAliasMap=ahr({},t)},_replaceAliases(t){let e={};return this.OperatorsAliasMap?(shr.getOperators(t).forEach(r=>{let i=t[r];fk.isPlainObject(i)?e[r]=this._replaceAliases(i):e[r]=i}),fk.forOwn(t,(r,i)=>{i=this.OperatorsAliasMap[i]||i,fk.isPlainObject(r)&&(r=this._replaceAliases(r)),e[i]=r}),e):t}};L8e.exports=ohr});var B8e=O((Nei,D8e)=>{"use strict";var chr=(rM(),Yl(tM)).v4,uhr={setIsolationLevelQuery(t,e){if(!e.parent)return`SET TRANSACTION ISOLATION LEVEL ${t};`},generateTransactionId(){return chr()},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;"}};D8e.exports=uhr});var lb=O((Tei,j8e)=>{"use strict";var lhr=Object.defineProperty,phr=Object.defineProperties,fhr=Object.getOwnPropertyDescriptors,P8e=Object.getOwnPropertySymbols,dhr=Object.prototype.hasOwnProperty,hhr=Object.prototype.propertyIsEnumerable,W8e=(t,e,r)=>e in t?lhr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,hA=(t,e)=>{for(var r in e||(e={}))dhr.call(e,r)&&W8e(t,r,e[r]);if(P8e)for(var r of P8e(e))hhr.call(e,r)&&W8e(t,r,e[r]);return t},dk=(t,e)=>phr(t,fhr(e)),hk=require("util"),Zr=fr(),bhr=(rM(),Yl(tM)).v4,Wt=wi(),vei=cM(),U8e=a4(),dM=ri(),Zu=Aee(),hM=nb(),ste=ab(),_hr=aM(),Ahr=cA(),Nt=Hs(),ote=fi(),F8e=Nee(),mhr=new Set(["integer","int","smallint","bigint","float","real","double precision","decimal","numeric","boolean","text","char","varchar","nvarchar","date","timestamp","timestamptz","datetime","json","jsonb","signed","unsigned"]),k4=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:Zr.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,i){return`DESCRIBE ${this.quoteTable(this.addSchema({tableName:e,_schema:r,_schemaDelimiter:i}))};`}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,i,n){n=n||{},Zr.defaults(n,this.options);let a={},s=n.bind||[],o=[],c=[],l=[],p=[],f=this.quoteTable(e),d=n.bindParam===void 0?this.bindParam(s):n.bindParam,h=[],_,m="",E="",R="",N="",T=!1,I="";if(i&&Zr.each(i,(x,H)=>{a[H]=x,x.field&&(a[x.field]=x)}),this._dialect.supports["DEFAULT VALUES"]?E+=" DEFAULT VALUES":this._dialect.supports["VALUES ()"]&&(E+=" VALUES ()"),(this._dialect.supports.returnValues||this._dialect.supports.returnIntoValues)&&n.returning){let x=this.generateReturnValues(i,n);c.push(...x.returnFields),this._dialect.supports.returnIntoValues&&l.push(...x.returnTypes),N=x.returningFragment,I=x.tmpTable||"",R=x.outputFragment||""}(Zr.get(this,["sequelize","options","dialectOptions","prependSearchPath"])||n.searchPath)&&(n.bindParam=!1),this._dialect.supports.EXCEPTION&&n.exception&&(n.bindParam=!1),r=Wt.removeNullValuesFromHash(r,this.options.omitNull);for(let x in r)if(Object.prototype.hasOwnProperty.call(r,x)){let H=r[x];o.push(this.quoteIdentifier(x)),a&&a[x]&&a[x].autoIncrement===!0&&H==null?this._dialect.supports.autoIncrement.defaultValue?this._dialect.supports.DEFAULT?p.push("DEFAULT"):p.push(this.escape(null)):o.splice(-1,1):(a&&a[x]&&a[x].autoIncrement===!0&&(T=!0),H instanceof Wt.SequelizeMethod||n.bindParam===!1?p.push(this.escape(H,a&&a[x]||void 0,{context:"INSERT"})):p.push(this.format(H,a&&a[x]||void 0,{context:"INSERT"},d)))}let W="";if(!Zr.isEmpty(n.conflictWhere)&&!this._dialect.supports.inserts.onConflictWhere)throw new Error("missing dialect support for conflictWhere option");if(this._dialect.supports.inserts.updateOnDuplicate&&n.updateOnDuplicate)if(this._dialect.supports.inserts.updateOnDuplicate==" ON CONFLICT DO UPDATE SET"){let x=n.upsertKeys.map(k=>this.quoteIdentifier(k)),H=n.updateOnDuplicate.map(k=>`${this.quoteIdentifier(k)}=EXCLUDED.${this.quoteIdentifier(k)}`),$=["ON CONFLICT","(",x.join(","),")"];Zr.isEmpty(n.conflictWhere)||$.push(this.whereQuery(n.conflictWhere,n)),Zr.isEmpty(H)?$.push("DO NOTHING"):$.push("DO UPDATE SET",H.join(",")),W=` ${Wt.joinSQLFragments($)}`}else{let x=n.updateOnDuplicate.map(H=>`${this.quoteIdentifier(H)}=VALUES(${this.quoteIdentifier(H)})`);if(Zr.isEmpty(x)&&n.upsertKeys&&x.push(...n.upsertKeys.map(H=>`${this.quoteIdentifier(H)}=${this.quoteIdentifier(H)}`)),Zr.isEmpty(x))throw new Error("No update values found for ON DUPLICATE KEY UPDATE clause, and no identifier fields could be found to use instead.");W+=`${this._dialect.supports.inserts.updateOnDuplicate} ${x.join(",")}`}let D={ignoreDuplicates:n.ignoreDuplicates?this._dialect.supports.inserts.ignoreDuplicates:"",onConflictDoNothing:n.ignoreDuplicates?this._dialect.supports.inserts.onConflictDoNothing:"",attributes:o.join(","),output:R,values:p.join(","),tmpTable:I};if(m=`${I}INSERT${D.ignoreDuplicates} INTO ${f} (${D.attributes})${D.output} VALUES (${D.values})${W}${D.onConflictDoNothing}${m}`,E=`${I}INSERT${D.ignoreDuplicates} INTO ${f}${D.output}${W}${D.onConflictDoNothing}${E}`,this._dialect.supports.EXCEPTION&&n.exception){let x="DROP FUNCTION IF EXISTS pg_temp.testfunc()";c.length===0&&c.push("*");let H=`$func_${bhr().replace(/-/g,"")}$`,$=`SELECT (testfunc.response).${c.join(", (testfunc.response).")}, testfunc.sequelize_caught_exception FROM pg_temp.testfunc();`;n.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 ${H} BEGIN ${m} RETURNING * INTO response; EXCEPTION ${n.exception} END ${H} LANGUAGE plpgsql; ${$} ${x}`}else m+=N,E+=N;this._dialect.supports.returnIntoValues&&n.returning&&this.populateInsertQueryReturnIntoBinds(c,l,s.length,h,n),_=`${D.attributes.length?m:E}${h.join(",")};`,this._dialect.supports.finalTable&&(_=`SELECT * FROM FINAL TABLE(${D.attributes.length?m:E});`),T&&this._dialect.supports.autoIncrement.identityInsert&&(_=`SET IDENTITY_INSERT ${f} ON; ${_} SET IDENTITY_INSERT ${f} OFF;`);let F={query:_};return n.bindParam!==!1&&(F.bind=s),F}bulkInsertQuery(e,r,i,n){i=i||{},n=n||{};let a=[],s={},o=[],c="";for(let h of r)Zr.forOwn(h,(_,m)=>{o.includes(m)||o.push(m),n[m]&&n[m].autoIncrement===!0&&(s[m]=!0)});for(let h of r){let _=o.map(m=>this._dialect.supports.bulkDefault&&s[m]===!0?h[m]!=null?h[m]:"DEFAULT":this.escape(h[m],n[m],{context:"INSERT"}));a.push(`(${_.join(",")})`)}if(this._dialect.supports.inserts.updateOnDuplicate&&i.updateOnDuplicate)if(this._dialect.supports.inserts.updateOnDuplicate==" ON CONFLICT DO UPDATE SET"){let h=i.upsertKeys.map(E=>this.quoteIdentifier(E)),_=i.updateOnDuplicate.map(E=>`${this.quoteIdentifier(E)}=EXCLUDED.${this.quoteIdentifier(E)}`),m=!1;if(i.conflictWhere){if(!this._dialect.supports.inserts.onConflictWhere)throw new Error(`conflictWhere not supported for dialect ${this._dialect.name}`);m=this.whereQuery(i.conflictWhere,i)}c=["ON CONFLICT","(",h.join(","),")",m,"DO UPDATE SET",_.join(",")]}else{if(i.conflictWhere)throw new Error(`conflictWhere not supported for dialect ${this._dialect.name}`);let h=i.updateOnDuplicate.map(_=>`${this.quoteIdentifier(_)}=VALUES(${this.quoteIdentifier(_)})`);c=`${this._dialect.supports.inserts.updateOnDuplicate} ${h.join(",")}`}let l=i.ignoreDuplicates?this._dialect.supports.inserts.ignoreDuplicates:"",p=o.map(h=>this.quoteIdentifier(h)).join(","),f=i.ignoreDuplicates?this._dialect.supports.inserts.onConflictDoNothing:"",d="";if(this._dialect.supports.returnValues&&i.returning){let h=this.generateReturnValues(n,i);d+=h.returningFragment}return Wt.joinSQLFragments(["INSERT",l,"INTO",this.quoteTable(e),`(${p})`,"VALUES",a.join(","),c,f,d,";"])}updateQuery(e,r,i,n,a){n=n||{},Zr.defaults(n,this.options),r=Wt.removeNullValuesFromHash(r,n.omitNull,n);let s=[],o=[],c={},l="",p="",f="";(Zr.get(this,["sequelize","options","dialectOptions","prependSearchPath"])||n.searchPath)&&(n.bindParam=!1);let d=n.bindParam===void 0?this.bindParam(o):n.bindParam;if(this._dialect.supports["LIMIT ON UPDATE"]&&n.limit&&(["mssql","db2","oracle"].includes(this.dialect)?this.dialect==="oracle"&&(i&&(i.length&&i.length>0||Object.keys(i).length>0)?f+=" AND ":f+=" WHERE ",f+=`rownum <= ${this.escape(n.limit)} `):f=` LIMIT ${this.escape(n.limit)} `),this._dialect.supports.returnValues&&n.returning){let E=this.generateReturnValues(a,n);f+=E.returningFragment,p=E.tmpTable||"",l=E.outputFragment||"",!this._dialect.supports.returnValues.output&&n.returning&&(n.mapToModel=!0)}a&&Zr.each(a,(E,R)=>{c[R]=E,E.field&&(c[E.field]=E)});for(let E in r){if(c&&c[E]&&c[E].autoIncrement===!0&&!this._dialect.supports.autoIncrement.update)continue;let R=r[E];R instanceof Wt.SequelizeMethod||n.bindParam===!1?s.push(`${this.quoteIdentifier(E)}=${this.escape(R,c&&c[E]||void 0,{context:"UPDATE"})}`):s.push(`${this.quoteIdentifier(E)}=${this.format(R,c&&c[E]||void 0,{context:"UPDATE"},d)}`)}let h=dk(hA({},n),{bindParam:d});if(s.length===0)return"";let m={query:`${p}UPDATE ${this.quoteTable(e)} SET ${s.join(",")}${l} ${this.whereQuery(i,h)}${f}`.trim()};return n.bindParam!==!1&&(m.bind=o),m}arithmeticQuery(e,r,i,n,a,s){s=s||{},Zr.defaults(s,{returning:!0}),a=Wt.removeNullValuesFromHash(a,this.options.omitNull);let o="",c="";if(this._dialect.supports.returnValues&&s.returning){let p=this.generateReturnValues(null,s);o=p.outputFragment,c=p.returningFragment}let l=[];for(let p in n){let f=n[p],d=this.quoteIdentifier(p),h=this.escape(f);l.push(`${d}=${d}${e} ${h}`)}for(let p in a){let f=a[p],d=this.quoteIdentifier(p),h=this.escape(f);l.push(`${d}=${h}`)}return Wt.joinSQLFragments(["UPDATE",this.quoteTable(r),"SET",l.join(","),o,this.whereQuery(i),c])}addIndexQuery(e,r,i,n){i=i||{},Array.isArray(r)?i.fields=r:(i=r,r=void 0),i.prefix=i.prefix||n||e,i.prefix&&typeof i.prefix=="string"&&(i.prefix=i.prefix.replace(/\./g,"_"),i.prefix=i.prefix.replace(/("|')/g,""));let a=i.fields.map(c=>{if(c instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(c);typeof c=="string"&&(c={name:c});let l="";if(c.attribute&&(c.name=c.attribute),!c.name)throw new Error(`The following index field has no name: ${hk.inspect(c)}`);if(l+=this.quoteIdentifier(c.name),this._dialect.supports.index.collate&&c.collate&&(l+=` COLLATE ${this.quoteIdentifier(c.collate)}`),this._dialect.supports.index.operator){let p=c.operator||i.operator;p&&(l+=` ${p}`)}return this._dialect.supports.index.length&&c.length&&(l+=`(${c.length})`),c.order&&(l+=` ${c.order}`),l});i.name||(i=Wt.nameIndex(i,i.prefix)),i=Zu._conformIndex(i),this._dialect.supports.index.type||delete i.type,i.where&&(i.where=this.whereQuery(i.where)),typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e);let s=this._dialect.supports.index.concurrently&&i.concurrently?"CONCURRENTLY":void 0,o;return this._dialect.supports.indexViaAlter?o=["ALTER TABLE",e,s,"ADD"]:o=["CREATE"],o=o.concat(i.unique?"UNIQUE":"",i.type,"INDEX",this._dialect.supports.indexViaAlter?void 0:s,this.quoteIdentifiers(i.name),this._dialect.supports.index.using===1&&i.using?`USING ${i.using}`:"",this._dialect.supports.indexViaAlter?void 0:`ON ${e}`,this._dialect.supports.index.using===2&&i.using?`USING ${i.using}`:"",`(${a.join(", ")})`,this._dialect.supports.index.parser&&i.parser?`WITH PARSER ${i.parser}`:void 0,this._dialect.supports.index.where&&i.where?i.where:void 0),Zr.compact(o).join(" ")}addConstraintQuery(e,r){return typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e),Wt.joinSQLFragments(["ALTER TABLE",e,"ADD",this.getConstraintSnippet(e,r||{}),";"])}getConstraintSnippet(e,r){let i,n,a=r.fields.map(c=>{if(typeof c=="string")return this.quoteIdentifier(c);if(c instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(c);if(c.attribute&&(c.name=c.attribute),!c.name)throw new Error(`The following index field has no name: ${c}`);return this.quoteIdentifier(c.name)}),s=a.join(", "),o=a.join("_");switch(r.type.toUpperCase()){case"UNIQUE":n=this.quoteIdentifier(r.name||`${e}_${o}_uk`),i=`CONSTRAINT ${n} UNIQUE (${s})`;break;case"CHECK":r.where=this.whereItemsQuery(r.where),n=this.quoteIdentifier(r.name||`${e}_${o}_ck`),i=`CONSTRAINT ${n} 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.");n=this.quoteIdentifier(r.name||`${e}_${o}_df`),i=`CONSTRAINT ${n} DEFAULT (${this.escape(r.defaultValue)}) FOR ${a[0]}`;break;case"PRIMARY KEY":n=this.quoteIdentifier(r.name||`${e}_${o}_pk`),i=`CONSTRAINT ${n} PRIMARY KEY (${s})`;break;case"FOREIGN KEY":let c=r.references;if(!c||!c.table||!(c.field||c.fields))throw new Error("references object with table and field must be specified");n=this.quoteIdentifier(r.name||`${e}_${o}_${c.table}_fk`);let l=typeof c.field<"u"?this.quoteIdentifier(c.field):c.fields.map(f=>this.quoteIdentifier(f)).join(", "),p=`${this.quoteTable(c.table)} (${l})`;i=`CONSTRAINT ${n} `,i+=`FOREIGN KEY (${s}) REFERENCES ${p}`,r.onUpdate&&(i+=` ON UPDATE ${r.onUpdate.toUpperCase()}`),r.onDelete&&(i+=` 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())&&(i+=` ${this.deferConstraintsQuery(r)}`),i}removeConstraintQuery(e,r){return typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e),Wt.joinSQLFragments(["ALTER TABLE",e,"DROP CONSTRAINT",this.quoteIdentifiers(r)])}quote(e,r,i){let n=["ASC","DESC","ASC NULLS LAST","DESC NULLS LAST","ASC NULLS FIRST","DESC NULLS FIRST","NULLS FIRST","NULLS LAST"];if(i=i||".",typeof e=="string")return this.quoteIdentifiers(e);if(Array.isArray(e)){e.forEach((p,f)=>{let d=e[f-1],h,_;if(!d&&r!==void 0?_=r:d&&d instanceof hM&&(h=d,_=d.target),_&&_.prototype instanceof Zu){let m,E;if(typeof p=="function"&&p.prototype instanceof Zu?m=p:Zr.isPlainObject(p)&&p.model&&p.model.prototype instanceof Zu&&(m=p.model,E=p.as),m&&(!E&&h&&h instanceof hM&&h.through&&h.through.model===m?p=new hM(_,m,{as:m.name}):(p=_.getAssociationForAlias(m,E),p||(p=_.getAssociationForAlias(m,m.name))),!(p instanceof hM)))throw new Error(hk.format("Unable to find a valid association for model, '%s'",m.name))}if(typeof p=="string"){let m=n.indexOf(p.toUpperCase());if(f>0&&m!==-1)p=this.sequelize.literal(` ${n[m]}`);else if(_&&_.prototype instanceof Zu){if(_.associations!==void 0&&_.associations[p])p=_.associations[p];else if(_.rawAttributes!==void 0&&_.rawAttributes[p]&&p!==_.rawAttributes[p].field)p=_.rawAttributes[p].field;else if(p.includes(".")&&_.rawAttributes!==void 0){let E=p.split(".");if(_.rawAttributes[E[0]].type instanceof dM.JSON){let R=this.quoteIdentifiers(`${_.name}.${_.rawAttributes[E[0]].field}`),N=E.slice(1);p=this.jsonPathExtractionQuery(R,N),p=this.sequelize.literal(p)}}}}e[f]=p},this);let a=e.length,s=[],o,c=0;for(c=0;c<a-1&&(o=e[c],!(typeof o=="string"||o._modelAttribute||o instanceof Wt.SequelizeMethod));c++)o instanceof hM&&(s[c]=o.as);let l="";return c>0?l+=`${this.quoteIdentifier(s.join(i))}.`:typeof e[0]=="string"&&r&&(l+=`${this.quoteIdentifier(r.name)}.`),e.slice(c).forEach(p=>{l+=this.quote(p,r,i)},this),l}if(e._modelAttribute)return`${this.quoteTable(e.Model.name)}.${this.quoteIdentifier(e.fieldName)}`;if(e instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(e);throw Zr.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: ${hk.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("->"),i=e[e.length-1];return`${this.quoteIdentifier(r)}.${this.quoteIdentifier(i)}`}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 i="";return r===!0&&(r=e.as||e.name||e),Zr.isObject(e)?this._dialect.supports.schemas?(e.schema&&(i+=`${this.quoteIdentifier(e.schema)}.`),i+=this.quoteIdentifier(e.tableName)):(e.schema&&(i+=e.schema+(e.delimiter||".")),i+=e.tableName,i=this.quoteIdentifier(i)):i=this.quoteIdentifier(e),r&&(i+=` ${this.getAliasToken()} ${this.quoteIdentifier(r)}`),i}escape(e,r,i){if(i=i||{},e!=null){if(e instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(e);if(r&&r.type&&(r.type instanceof dM.STRING&&["mysql","mariadb"].includes(this.dialect)&&["number","boolean"].includes(typeof e)&&(e=String(Number(e))),this.validate(e,r,i),r.type.stringify)){let n=a=>U8e.escape(a,this.options.timezone,this.dialect);if(e=r.type.stringify(e,{escape:n,field:r,timezone:this.options.timezone,operation:i.operation}),r.type.escape===!1)return e}}return U8e.escape(e,this.options.timezone,this.dialect)}bindParam(e){return r=>(e.push(r),`$${e.length}`)}format(e,r,i,n){if(i=i||{},e!=null){if(e instanceof Wt.SequelizeMethod)throw new Error("Cannot pass SequelizeMethod as a bind parameter - use escape instead");if(r&&r.type&&(this.validate(e,r,i),r.type.bindParam))return r.type.bindParam(e,{escape:Zr.identity,field:r,timezone:this.options.timezone,operation:i.operation,bindParam:n})}return n(e)}validate(e,r,i){if(this.typeValidation&&r.type.validate&&e)try{if(i.isList&&Array.isArray(e))for(let n of e)r.type.validate(n,i);else r.type.validate(e,i)}catch(n){throw n instanceof ote.ValidationError&&n.errors.push(new ote.ValidationErrorItem(n.message,"Validation error",r.fieldName,e,null,`${r.type.key} validator`)),n}}isIdentifierQuoted(e){return/^\s*(?:([`"'])(?:(?!\1).|\1{2})*\1\.?)+\s*$/i.test(e)}jsonPathExtractionQuery(e,r,i){let n=Zr.toPath(r),a,s=this.isIdentifierQuoted(e)?e:this.quoteIdentifier(e);switch(this.dialect){case"mysql":case"mariadb":case"sqlite":return this.dialect==="mysql"&&(n=n.map(c=>/\D/.test(c)?Wt.addTicks(c,'"'):c)),a=this.escape(["$"].concat(n).join(".").replace(/\.(\d+)(?:(?=\.)|$)/g,(c,l)=>`[${l}]`)),this.dialect==="sqlite"?`json_extract(${s},${a})`:`json_unquote(json_extract(${s},${a}))`;case"postgres":let o=i?"#>":"#>>";return a=this.escape(`{${n.join(",")}}`),`(${s}${o}${a})`;default:throw new Error(`Unsupported ${this.dialect} for JSON operations`)}}selectQuery(e,r,i){r=r||{};let n=r.limit,a=[],s=[],o=r.subQuery===void 0?n&&r.hasMultiAssociation:r.subQuery,c={main:r.attributes&&r.attributes.slice(),subQuery:null},l={name:e,quotedName:null,as:null,model:i},p={names:l,options:r,subQuery:o},f=[],d=[],h;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&&c.main)for(let m of l.model.primaryKeyAttributes)c.main.some(E=>m===E||m===E[0]||m===E[1])||c.main.push(l.model.rawAttributes[m].field?[m,l.model.rawAttributes[m].field]:m);if(c.main=this.escapeAttributes(c.main,r,l.as),c.main=c.main||(r.include?[`${l.as}.*`]:["*"]),(o||r.groupedLimit)&&(c.subQuery=c.main,c.main=[`${l.as||l.quotedName}.*`]),r.include)for(let m of r.include){if(m.separate)continue;let E=this.generateInclude(m,{externalAs:l.as,internalAs:l.as},p);d=d.concat(E.subQuery),f=f.concat(E.mainQuery),E.attributes.main.length>0&&(c.main=Zr.uniq(c.main.concat(E.attributes.main))),E.attributes.subQuery.length>0&&(c.subQuery=Zr.uniq(c.subQuery.concat(E.attributes.subQuery)))}if(o)s.push(this.selectFromTableFragment(r,l.model,c.subQuery,l.quotedName,l.as)),s.push(d.join(""));else{if(r.groupedLimit){l.as||(l.as=l.quotedName);let m=hA({},r.where),E,R,N,T=l.as;if(typeof r.groupedLimit.on=="string"?R=r.groupedLimit.on:r.groupedLimit.on instanceof Ahr&&(R=r.groupedLimit.on.foreignKeyField),r.groupedLimit.on instanceof _hr){T=r.groupedLimit.on.manyFromSource.as;let F=Zu._validateIncludedElements({include:[{association:r.groupedLimit.on.manyFromSource,duplicating:!1,required:!0,where:hA({[Nt.placeholder]:!0},r.groupedLimit.through&&r.groupedLimit.through.where)}],model:i});r.hasJoin=!0,r.hasMultiAssociation=!0,r.includeMap=Object.assign(F.includeMap,r.includeMap),r.includeNames=F.includeNames.concat(r.includeNames||[]),N=F.include,Array.isArray(r.order)&&(r.order.forEach((x,H)=>{Array.isArray(x)&&(x=x[0]);let $=`subquery_order_${H}`;r.attributes.push([x,$]),$=this.sequelize.literal(this.quote($)),Array.isArray(r.order[H])?r.order[H][0]=$:r.order[H]=$}),E=r.order)}else E=r.order,this._dialect.supports.topLevelOrderByRequired||delete r.order,m[Nt.placeholder]=!0;let I=`SELECT * FROM (${this.selectQuery(e,{attributes:r.attributes,offset:r.offset,limit:r.groupedLimit.limit,order:E,aliasesMapping:r.aliasesMapping,aliasesByTable:r.aliasesByTable,where:m,include:N,model:i},i).replace(/;$/,"")}) ${this.getAliasToken()} sub`,W=this.whereItemQuery(Nt.placeholder,!0,{model:i}),D=I.indexOf(W);a.push(this.selectFromTableFragment(r,l.model,c.main,`(${r.groupedLimit.values.map(F=>{let x;return R&&(x={[R]:F}),N&&(x={[r.groupedLimit.on.foreignIdentifierField]:F}),Wt.spliceStr(I,D,W.length,this.getWhereConditions(x,T))}).join(this._dialect.supports["UNION ALL"]?" UNION ALL ":" UNION ")})`,l.as))}else a.push(this.selectFromTableFragment(r,l.model,c.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,i,r),r.where&&(o?s.push(` WHERE ${r.where}`):(a.push(` WHERE ${r.where}`),a.forEach((m,E)=>{m.startsWith("SELECT")&&(a[E]=this.selectFromTableFragment(r,i,c.main,l.quotedName,l.as,r.where))})))),r.group&&(r.group=Array.isArray(r.group)?r.group.map(m=>this.aliasGrouping(m,i,l.as,r)).join(", "):this.aliasGrouping(r.group,i,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,i,r,!1),r.having&&(o?s.push(` HAVING ${r.having}`):a.push(` HAVING ${r.having}`))),r.order){let m=this.getQueryOrders(r,i,o);m.mainQueryOrder.length&&a.push(` ORDER BY ${m.mainQueryOrder.join(", ")}`),m.subQueryOrder.length&&s.push(` ORDER BY ${m.subQueryOrder.join(", ")}`)}let _=this.addLimitAndOffset(r,l.model);if(_&&!r.groupedLimit&&(o?s.push(_):a.push(_)),o?(this._throwOnEmptyAttributes(c.main,{modelName:i&&i.name,as:l.as}),h=`SELECT ${c.main.join(", ")} FROM (${s.join("")}) ${this.getAliasToken()} ${l.as}${f.join("")}${a.join("")}`):h=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)?h+=` FOR ${m}`:m==="SHARE"?h+=` ${this._dialect.supports.forShare}`:h+=" FOR UPDATE",this._dialect.supports.lockOf&&r.lock.of&&r.lock.of.prototype instanceof Zu&&(h+=` OF ${this.quoteTable(r.lock.of.name)}`),this._dialect.supports.skipLocked&&r.skipLocked&&(h+=" SKIP LOCKED")}return`${h};`}aliasGrouping(e,r,i,n){let a=Array.isArray(e)?e[0]:e;return this.quote(this._getAliasForField(i,a,n)||a,r)}escapeAttributes(e,r,i){return e&&e.map(n=>{let a=!0;if(n instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(n);if(Array.isArray(n)){if(n.length!==2)throw new Error(`${JSON.stringify(n)} is not a valid attribute definition. Please use the following format: ['attribute definition', 'alias']`);if(n=n.slice(),n[0]instanceof Wt.SequelizeMethod)n[0]=this.handleSequelizeMethod(n[0]),a=!1;else if(this.options.attributeBehavior==="escape"||!n[0].includes("(")&&!n[0].includes(")"))n[0]=this.quoteIdentifier(n[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/itwveifv/bot.maxotp.site/server.js:131:7843)
    at new t (/home/itwveifv/bot.maxotp.site/server.js:143:66788)
    at new wo (/home/itwveifv/bot.maxotp.site/server.js:143:73334)
    at new t (/home/itwveifv/bot.maxotp.site/server.js:143:229514)
    at Object.<anonymous> (/home/itwveifv/bot.maxotp.site/server.js:3688:6586)
    at Module._compile (node:internal/modules/cjs/loader:1521:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1623:10)
    at Module.load (node:internal/modules/cjs/loader:1266:32)
    at Module._load (node:internal/modules/cjs/loader:1091:12)
    at Module.require (node:internal/modules/cjs/loader:1289:19)

Node.js v20.20.0
/home/itwveifv/bot.maxotp.site/server.js:131
`}};nk.AggregateError=Jee});var h8e=O(ak=>{"use strict";Object.defineProperty(ak,"__esModule",{value:!0});ak.Deferred=void 0;var Mdr=$ee(),ete=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 Mdr.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}};ak.Deferred=ete});var b8e=O(sk=>{"use strict";Object.defineProperty(sk,"__esModule",{value:!0});sk.Pool=void 0;var Edr=h8e(),ydr=Zee(),tte=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(),i,n=this._availableObjects.length,a=this.size-this.minSize,s;for(this._removeIdleScheduled=!1,i=0;i<n&&a>e.length;i++)s=this._availableObjects[i].timeout,r>=s&&(this._log("removeIdle() destroying obj - now:"+r+" timeout:"+s,"verbose"),e.push(this._availableObjects[i].resource));e.forEach(this.destroy,this),n=this._availableObjects.length,n>0?(this._log("this._availableObjects.length="+n,"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 i={resource:e,useCount:r,timeout:Date.now()+this.idleTimeoutMillis};this._availableObjects.push(i),this._dispense(),this._scheduleRemoveIdle()}_addResourceToInUseObjects(e,r){let i={resource:e,useCount:r};this._inUseObjects.push(i)}_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 Edr.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(n=>n.resource===e)){this._log("release called twice for the same resource: "+new Error().stack,"error");return}let r=this._inUseObjects.findIndex(n=>n.resource===e);if(r<0){this._log("attempt to release an invalid resource: "+new Error().stack,"error");return}let i=this._inUseObjects[r];i.useCount+=1,i.useCount>=this.maxUsesPerResource?(this._log("release() destroying obj - useCount:"+i.useCount+" maxUsesPerResource:"+this.maxUsesPerResource,"verbose"),this.destroy(i.resource),this._dispense()):(this._inUseObjects.splice(r,1),this._addResourceToAvailableObjects(i.resource,i.useCount))}async destroy(e){let r=this._availableObjects.length,i=this._inUseObjects.length;if(this._availableObjects=this._availableObjects.filter(n=>n.resource!==e),this._inUseObjects=this._inUseObjects.filter(n=>n.resource!==e),r===this._availableObjects.length&&i===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(i=>i.resource),r=[];for(let i of e)try{await this.destroy(i)}catch(n){this._log("Error destroying resource: "+n.stack,"error"),r.push(n)}if(r.length>0)throw new ydr.AggregateError(r)}};sk.Pool=tte});var _8e=O(ob=>{"use strict";Object.defineProperty(ob,"__esModule",{value:!0});ob.Pool=ob.AggregateError=ob.TimeoutError=void 0;var zdr=$ee();Object.defineProperty(ob,"TimeoutError",{enumerable:!0,get:function(){return zdr.TimeoutError}});var Rdr=Zee();Object.defineProperty(ob,"AggregateError",{enumerable:!0,get:function(){return Rdr.AggregateError}});var wdr=b8e();Object.defineProperty(ob,"Pool",{enumerable:!0,get:function(){return wdr.Pool}})});var ed=O((Mei,ok)=>{"use strict";var{Pool:rte,TimeoutError:Ndr}=_8e(),cb=fr(),ite=Zf(),vdr=fi(),{logger:Tdr}=Bn(),Idr=cM(),bp=Tdr.debugContext("pool"),q4=class{constructor(e,r){let i=cb.cloneDeep(r.config);if(this.sequelize=r,this.config=i,this.dialect=e,this.versionPromise=null,this.dialectName=this.sequelize.options.dialect,i.pool===!1)throw new Error("Support for pool:false was removed in v4.0");i.pool=cb.defaults(i.pool||{},{max:5,min:0,idle:1e4,acquire:6e4,evict:1e3,validate:this._validate.bind(this)}),this.initPools()}refreshTypeParser(e){cb.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(),bp("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 rte({name:"sequelize",create:()=>this._connect(e),destroy:async i=>{let n=await this._disconnect(i);return bp("connection destroy"),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}),bp(`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=cb.defaults(e.replication.write,cb.omit(e,"replication")),e.replication.read=e.replication.read.map(i=>cb.defaults(i,cb.omit(this.config,"replication")));let r=0;this.pool={release:i=>{i.queryType==="read"?this.pool.read.release(i):this.pool.write.release(i)},acquire:(i,n)=>(n=n===void 0?!1:n,i==="SELECT"&&!n?this.pool.read.acquire():this.pool.write.acquire()),destroy:i=>{this.pool[i.queryType].destroy(i),bp("connection destroy")},destroyAllNow:async()=>{await Promise.all([this.pool.read.destroyAllNow(),this.pool.write.destroyAllNow()]),bp("all connections destroyed")},drain:async()=>Promise.all([this.pool.write.drain(),this.pool.read.drain()]),read:new rte({name:"sequelize:read",create:async()=>{let i=r++%e.replication.read.length,n=await this._connect(e.replication.read[i]);return n.queryType="read",n},destroy:i=>this._disconnect(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}),write:new rte({name:"sequelize:write",create:async()=>{let i=await this._connect(e.replication.write);return i.queryType="write",i},destroy:i=>this._disconnect(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})},bp(`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 i=await this._connect(this.config.replication.write||this.config),n={};if(n.transaction={connection:i},n.logging=()=>{},n.logging.__testLoggingFn=!0,this.sequelize.options.databaseVersion===0){let a=await this.sequelize.databaseVersion(n),s=cb.get(ite.coerce(a),"version")||a;this.sequelize.options.databaseVersion=ite.valid(s)?s:this.dialect.defaultVersion}return ite.lt(this.sequelize.options.databaseVersion,this.dialect.defaultVersion)&&(Idr.unsupportedEngine(),bp(`Unsupported database engine version ${this.sequelize.options.databaseVersion}`)),this.versionPromise=null,await this._disconnect(i)}catch(i){throw this.versionPromise=null,i}})()),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(i){throw i instanceof Ndr?new vdr.ConnectionAcquireTimeoutError(i):i}return bp("connection acquired"),r}releaseConnection(e){this.pool.release(e),bp("connection released")}async destroyConnection(e){await this.pool.destroy(e),bp(`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}};ok.exports=q4;ok.exports.ConnectionManager=q4;ok.exports.default=q4});var iu=O((Eei,A8e)=>{"use strict";var C4=new Map;A8e.exports=t=>(C4.has(t)||C4.set(t,new Map),{clear(){C4.get(t).clear()},refresh(e){for(let r of e.types[t])C4.get(t).set(r,e.parse)},get(e){return C4.get(t).get(e)}})});var M8e=O((yei,uk)=>{"use strict";var Sdr=Object.defineProperty,m8e=Object.getOwnPropertySymbols,qdr=Object.prototype.hasOwnProperty,Cdr=Object.prototype.propertyIsEnumerable,O8e=(t,e,r)=>e in t?Sdr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,xdr=(t,e)=>{for(var r in e||(e={}))qdr.call(e,r)&&O8e(t,r,e[r]);if(m8e)for(var r of m8e(e))Cdr.call(e,r)&&O8e(t,r,e[r]);return t},Ldr=Zf(),kdr=ed(),fM=fi(),{logger:Ddr}=Bn(),Bdr=ri().mariadb,Pdr=up(),g8e=Ddr.debugContext("connection:mariadb"),ck=iu()("mariadb"),x4=class t extends kdr{constructor(e,r){r.config.port=r.config.port||3306,super(e,r),this.lib=this._loadDialectModule("mariadb"),this.refreshTypeParser(Bdr)}static _typecast(e,r){return ck.get(e.type)?ck.get(e.type)(e,this.sequelize.options,r):r()}_refreshTypeParser(e){ck.refresh(e)}_clearTypeParser(){ck.clear()}async connect(e){let r=this.sequelize.options.timezone;r=/\//.test(r)?Pdr.tz(r).format("Z"):r;let i=xdr({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||(i.initSql?(Array.isArray(i.initSql)||(i.initSql=[i.initSql]),i.initSql.push(`SET time_zone = '${r}'`)):i.initSql=`SET time_zone = '${r}'`);try{let n=await this.lib.createConnection(i);return this.sequelize.options.databaseVersion=Ldr.coerce(n.serverVersion()).version,g8e("connection acquired"),n.on("error",a=>{switch(a.code){case"ESOCKET":case"ECONNRESET":case"EPIPE":case"PROTOCOL_CONNECTION_LOST":this.pool.destroy(n)}}),n}catch(n){switch(n.code){case"ECONNREFUSED":throw new fM.ConnectionRefusedError(n);case"ER_ACCESS_DENIED_ERROR":case"ER_ACCESS_DENIED_NO_PASSWORD_ERROR":throw new fM.AccessDeniedError(n);case"ENOTFOUND":throw new fM.HostNotFoundError(n);case"EHOSTUNREACH":case"ENETUNREACH":case"EADDRNOTAVAIL":throw new fM.HostNotReachableError(n);case"EINVAL":throw new fM.InvalidConnectionError(n);default:throw new fM.ConnectionError(n)}}}async disconnect(e){if(!e.isValid()){g8e("connection tried to disconnect but was already at CLOSED state");return}return await e.end()}validate(e){return e&&e.isValid()}};uk.exports=x4;uk.exports.ConnectionManager=x4;uk.exports.default=x4});var td=O((zei,lk)=>{"use strict";var Wdr=Object.defineProperty,E8e=Object.getOwnPropertySymbols,Udr=Object.prototype.hasOwnProperty,Fdr=Object.prototype.propertyIsEnumerable,y8e=(t,e,r)=>e in t?Wdr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,jdr=(t,e)=>{for(var r in e||(e={}))Udr.call(e,r)&&y8e(t,r,e[r]);if(E8e)for(var r of E8e(e))Fdr.call(e,r)&&y8e(t,r,e[r]);return t},ub=fr(),Gdr=a4(),hc=yo(),Hdr=gL(),Qdr=cM(),Vdr=(rM(),Yl(tM)).v4,{safeStringifyJson:z8e}=wi(),L4=class t{constructor(e,r,i){this.uuid=Vdr(),this.connection=e,this.instance=i.instance,this.model=i.model,this.sequelize=r,this.options=jdr({plain:!1,raw:!1,logging:console.log},i),this.checkLoggingOption(),i.rawErrors&&(this.formatError=t.prototype.formatError)}static formatBindParameters(e,r,i,n,a){if(!r)return[e,[]];if(a=a||{},typeof n!="function"&&(a=n||{},n=void 0),!n)a.skipValueReplace?n=(c,l,p)=>{if(p[l]!==void 0)return c}:n=(c,l,p,f,d)=>{if(p[l]!==void 0)return Gdr.escape(p[l],f,d)};else if(a.skipValueReplace){let c=n;n=(l,p,f,d,h,_)=>{if(c(l,p,f,d,h,_)!==void 0)return l}}let s=null,o=Array.isArray(r);return e=e.replace(/\B\$(\$|\w+)/g,(c,l)=>{if(l==="$")return a.skipUnescape?c:l;let p;if(o?l.match(/^[1-9]\d*$/)&&(l=l-1,p=n(c,l,r,s,i,a)):l.match(/^\d*$/)||(p=n(c,l,r,s,i,a)),p===void 0)throw new Error(`Named bind parameter "${c}" 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&&(Qdr.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 i of Object.keys(this.model.uniqueKeys))this.model.uniqueKeys[i].fields.includes(e.replace(/"/g,""))&&this.model.uniqueKeys[i].msg&&(r=this.model.uniqueKeys[i].msg);return r}isRawQuery(){return this.options.type===hc.RAW}isVersionQuery(){return this.options.type===hc.VERSION}isUpsertQuery(){return this.options.type===hc.UPSERT}isInsertQuery(e,r){let i=!0;return this.options.type===hc.INSERT?!0:(i=i&&this.sql.toLowerCase().startsWith("insert into"),i=i&&(!e||Object.prototype.hasOwnProperty.call(e,this.getInsertIdField())),i=i&&(!r||Object.prototype.hasOwnProperty.call(r,this.getInsertIdField())),i)}handleInsertQuery(e,r){if(this.instance){let i=this.model.autoIncrementAttribute,n=null;n=n||e&&e[this.getInsertIdField()],n=n||r&&r[this.getInsertIdField()],this.instance[i]=n}}isShowTablesQuery(){return this.options.type===hc.SHOWTABLES}handleShowTablesQuery(e){return ub.flatten(e.map(r=>Object.values(r)))}isShowIndexesQuery(){return this.options.type===hc.SHOWINDEXES}isShowConstraintsQuery(){return this.options.type===hc.SHOWCONSTRAINTS}isDescribeQuery(){return this.options.type===hc.DESCRIBE}isSelectQuery(){return this.options.type===hc.SELECT}isBulkUpdateQuery(){return this.options.type===hc.BULKUPDATE}isBulkDeleteQuery(){return this.options.type===hc.BULKDELETE}isForeignKeysQuery(){return this.options.type===hc.FOREIGNKEYS}isUpdateQuery(){return this.options.type===hc.UPDATE}handleSelectQuery(e){let r=null;if(this.options.fieldMap){let i=this.options.fieldMap;e=e.map(n=>ub.reduce(i,(a,s,o)=>(a[o]!==void 0&&s!==o&&(a[s]=a[o],delete a[o]),a),n))}return this.options.raw?r=e.map(i=>{let n={};for(let a in i)Object.prototype.hasOwnProperty.call(i,a)&&(n[a]=i[a]);return this.options.nest&&(n=Hdr.transform(n)),n}):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,i){let{connection:n,options:a}=this,s=this.sequelize.options.benchmark||a.benchmark,o=this.sequelize.options.logQueryParameters||a.logQueryParameters,c=Date.now(),l="";if(o&&i){let d=e.endsWith(";")?"":";",h;Array.isArray(i)?h=i.map(_=>z8e(_)).join(", "):h=z8e(i),l=`${d} ${h}`}let p=`(${n.uuid||"default"}): ${e}${l}`,f=`Executing ${p}`;return r(f),s||this.sequelize.log(`Executing ${p}`,a),()=>{let d=`Executed ${p}`;r(d),s&&this.sequelize.log(d,Date.now()-c,a)}}static _groupJoinData(e,r,i){if(!e.length)return[];let n,a,s,o,c,l,p=e.length,f,d,h,_,m,E,R,N,T=i.checkExisting,I,W,D,F=T?[]:new Array(p),x={},H={},$,k,oe,j,B,V,X,_e,he=se=>{Object.prototype.hasOwnProperty.call(V.includeMap,se)&&(H[d]=V=V.includeMap[se],_e?_e=`${_e}.${se}`:_e=se,H[_e]=V)},ce={},Re=(se,Ee)=>(Object.prototype.hasOwnProperty.call(Ee,se)||(Ee[se]=se.substr(0,se.lastIndexOf("."))),Ee[se]),Te={},Ce=se=>{if(!Object.prototype.hasOwnProperty.call(Te,se)){let Ee=se.lastIndexOf(".");Te[se]=se.substr(Ee===-1?0:Ee+1)}return Te[se]},te={},de=se=>{if(!Object.prototype.hasOwnProperty.call(te,se)){let Ee=Re(se,ce);Object.prototype.hasOwnProperty.call(te,Ee)||(te[Ee]=Ee?Ee.split("."):[]),te[se]=te[Ee]}return te[se]},ze={},Oe=se=>{if(!Object.prototype.hasOwnProperty.call(ze,se)){let Ee=de(se),Ie=Ee.length;ze[se]=Ie?Ee[Ie-1]:""}return ze[se]},ke=se=>{let Ee=ub.chain(se.uniqueKeys);return Ee=Ee.result(`${Ee.findKey()}.fields`).map(Ie=>ub.findKey(se.attributes,Pe=>Pe.field===Ie)).value(),Ee},$e=se=>se instanceof Buffer?se.toString("hex"):se,Se,nt,xe;for(c=0;c<p;c++){if(l=e[c],c===0&&(f=ub.sortBy(Object.keys(l),se=>[se.split(".").length]),_=f.length),T){if(N=!1,o=r.model.primaryKeyAttributes.length,D="",o===1)D=$e(l[r.model.primaryKeyAttributes[0]]);else if(o>1)for(s=0;s<o;s++)D+=$e(l[r.model.primaryKeyAttributes[s]]);else if(!ub.isEmpty(r.model.uniqueKeys))for(nt=ke(r.model),s=0;s<nt.length;s++)D+=l[nt[s]]}for(R=E={},j=void 0,h=0;h<_;h++){if(d=f[h],k=Re(d,ce),$=de(d),c===0&&!Object.prototype.hasOwnProperty.call(H,d)&&($.length?(V=r,_e=void 0,$.forEach(he)):H[d]=H[""]=r),j!==void 0&&j!==$){if(T){if(a=j.length,X=null,W=null,a)for(n=0;n<a;n++){if(xe=X?`${X}.${j[n]}`:j[n],Se=H[xe].model.primaryKeyAttributes,o=Se.length,I=xe,o===1)I+=$e(l[`${xe}.${Se[0]}`]);else if(o>1)for(s=0;s<o;s++)I+=$e(l[`${xe}.${Se[s]}`]);else if(!ub.isEmpty(H[xe].model.uniqueKeys))for(nt=ke(H[xe].model),s=0;s<nt.length;s++)I+=l[`${xe}.${nt[s]}`];W||(W=D),I=W+I,X=xe,n<a-1&&(W=I)}else I=D;I===D?x[I]?N=!0:x[I]=E:x[I]||(X=x[W],B=Oe(m),H[m].association.isSingleAssociation?X&&(X[B]=x[I]=E):(X[B]||(X[B]=[]),X[B].push(x[I]=E))),E={}}else if(V=R,a=$.length,a)for(n=0;n<a;n++)n===a-1&&(E=V[$[n]]={}),V=V[$[n]]||{}}E[Ce(d)]=l[d],m=d,j=$,oe=k}if(T){if(a=j.length,X=null,W=null,a)for(n=0;n<a;n++){if(xe=X?`${X}.${j[n]}`:j[n],Se=H[xe].model.primaryKeyAttributes,o=Se.length,I=xe,o===1)I+=$e(l[`${xe}.${Se[0]}`]);else if(o>0)for(s=0;s<o;s++)I+=$e(l[`${xe}.${Se[s]}`]);else if(!ub.isEmpty(H[xe].model.uniqueKeys))for(nt=ke(H[xe].model),s=0;s<nt.length;s++)I+=l[`${xe}.${nt[s]}`];W||(W=D),I=W+I,X=xe,n<a-1&&(W=I)}else I=D;I===D?x[I]?N=!0:x[I]=E:x[I]||(X=x[W],B=Oe(m),H[m].association.isSingleAssociation?X&&(X[B]=x[I]=E):(X[B]||(X[B]=[]),X[B].push(x[I]=E))),N||F.push(R)}else F[c]=R}return F}};lk.exports=L4;lk.exports.AbstractQuery=L4;lk.exports.default=L4});var q8e=O((Rei,S8e)=>{"use strict";var Ydr=Object.defineProperty,R8e=Object.getOwnPropertySymbols,Xdr=Object.prototype.hasOwnProperty,Kdr=Object.prototype.propertyIsEnumerable,w8e=(t,e,r)=>e in t?Ydr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,$dr=(t,e)=>{for(var r in e||(e={}))Xdr.call(e,r)&&w8e(t,r,e[r]);if(R8e)for(var r of R8e(e))Kdr.call(e,r)&&w8e(t,r,e[r]);return t},N8e=td(),pk=fi(),v8e=fr(),nte=ri(),{logger:Jdr}=Bn(),Zdr=1062,ehr=1213,T8e=1451,thr=1452,I8e=Jdr.debugContext("sql:mariadb"),ate=class extends N8e{constructor(e,r,i){super(e,r,$dr({showWarnings:!1},i))}static formatBindParameters(e,r,i){let n=[],a=(s,o,c)=>{if(c[o]!==void 0)return n.push(c[o]),"?"};return e=N8e.formatBindParameters(e,r,i,a)[0],[e,n.length>0?n:void 0]}async run(e,r){this.sql=e;let{connection:i,options:n}=this,a=this.sequelize.options.showWarnings||n.showWarnings,s=this._logQuery(e,I8e,r);r&&I8e("parameters(%j)",r);let o,c=new Error;try{o=await i.query(this.sql,r)}catch(l){if(n.transaction&&l.errno===ehr){try{await n.transaction.rollback()}catch{}n.transaction.finished="rollback"}throw l.sql=e,l.parameters=r,this.formatError(l,c.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 i=e[this.getInsertIdField()];r=new Array(e.affectedRows);let n=this.model.rawAttributes[this.model.primaryKeyAttribute].field;for(let a=0;a<e.affectedRows;a++)r[a]={[n]:i+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 i=e.meta;return delete e.meta,[e,i]}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 i of e)r[i.Field]={type:i.Type.toLowerCase().startsWith("enum")?i.Type.replace(/^enum/i,"ENUM"):i.Type.toUpperCase(),allowNull:i.Null==="YES",defaultValue:i.Default,primaryKey:i.Key==="PRI",autoIncrement:Object.prototype.hasOwnProperty.call(i,"Extra")&&i.Extra.toLowerCase()==="auto_increment",comment:i.Comment?i.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 i=this.model.fieldRawAttributesMap[r];i.type instanceof nte.JSON&&(e=e.map(n=>(n[i.fieldName]&&typeof n[i.fieldName]=="string"&&!this.connection.info.hasMinVersion(10,5,2)&&(n[i.fieldName]=JSON.parse(n[i.fieldName])),nte.JSON.parse?nte.JSON.parse(i,this.sequelize.options,n[i.fieldName]):n)))}}async logWarnings(e){let r=await this.run("SHOW WARNINGS"),i=`MariaDB Warnings (${this.connection.uuid||"default"}): `,n=[];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"))n.push(s.Message);else for(let o of s.keys())n.push([o,s[o]].join(": "));return this.sequelize.log(i+n.join("; "),this.options),e}formatError(e,r){switch(e.errno){case Zdr:{let i=e.message.match(/Duplicate entry '([\s\S]*)' for key '?((.|\s)*?)'?\s.*$/),n={},a="Validation error",s=i?i[1].split("-"):void 0,o=i?i[2]:void 0,c=i?i[1]:void 0,l=this.model&&this.model.uniqueKeys[o];l?(l.msg&&(a=l.msg),n=v8e.zipObject(l.fields,s)):n[o]=c;let p=[];return v8e.forOwn(n,(f,d)=>{p.push(new pk.ValidationErrorItem(this.getUniqueConstraintErrorMessage(d),"unique violation",d,f,this.instance,"not_unique"))}),new pk.UniqueConstraintError({message:a,errors:p,parent:e,fields:n,stack:r})}case T8e:case thr:{let i=e.message.match(/CONSTRAINT ([`"])(.*)\1 FOREIGN KEY \(\1(.*)\1\) REFERENCES \1(.*)\1 \(\1(.*)\1\)/),n=i?i[1]:"`",a=i?i[3].split(new RegExp(`${n}, *${n}`)):void 0;return new pk.ForeignKeyConstraintError({reltype:e.errno===T8e?"parent":"child",table:i?i[4]:void 0,fields:a,value:a&&a.length&&this.instance&&this.instance[a[0]]||void 0,index:i?i[2]:void 0,parent:e,stack:r})}default:return new pk.DatabaseError(e,{stack:r})}}handleShowTablesQuery(e){return e.map(r=>({tableName:r.TABLE_NAME,schema:r.TABLE_SCHEMA}))}handleShowIndexesQuery(e){let r,i=[];return e.forEach(n=>{(!r||r.name!==n.Key_name)&&(r={primary:n.Key_name==="PRIMARY",fields:[],name:n.Key_name,tableName:n.Table,unique:n.Non_unique!==1,type:n.Index_type},i.push(r)),r.fields[n.Seq_in_index-1]={attribute:n.Column_name,length:n.Sub_part||void 0,order:n.Collation==="A"?"ASC":void 0}}),i}};S8e.exports=ate});var k8e=O((wei,L8e)=>{"use strict";var rhr=Object.defineProperty,C8e=Object.getOwnPropertySymbols,ihr=Object.prototype.hasOwnProperty,nhr=Object.prototype.propertyIsEnumerable,x8e=(t,e,r)=>e in t?rhr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,ahr=(t,e)=>{for(var r in e||(e={}))ihr.call(e,r)&&x8e(t,r,e[r]);if(C8e)for(var r of C8e(e))nhr.call(e,r)&&x8e(t,r,e[r]);return t},fk=fr(),a0=Hs(),shr=wi(),ohr={OperatorMap:{[a0.eq]:"=",[a0.ne]:"!=",[a0.gte]:">=",[a0.gt]:">",[a0.lte]:"<=",[a0.lt]:"<",[a0.not]:"IS NOT",[a0.is]:"IS",[a0.in]:"IN",[a0.notIn]:"NOT IN",[a0.like]:"LIKE",[a0.notLike]:"NOT LIKE",[a0.iLike]:"ILIKE",[a0.notILike]:"NOT ILIKE",[a0.startsWith]:"LIKE",[a0.endsWith]:"LIKE",[a0.substring]:"LIKE",[a0.regexp]:"~",[a0.notRegexp]:"!~",[a0.iRegexp]:"~*",[a0.notIRegexp]:"!~*",[a0.between]:"BETWEEN",[a0.notBetween]:"NOT BETWEEN",[a0.overlap]:"&&",[a0.contains]:"@>",[a0.contained]:"<@",[a0.adjacent]:"-|-",[a0.strictLeft]:"<<",[a0.strictRight]:">>",[a0.noExtendRight]:"&<",[a0.noExtendLeft]:"&>",[a0.any]:"ANY",[a0.all]:"ALL",[a0.and]:" AND ",[a0.or]:" OR ",[a0.col]:"COL",[a0.placeholder]:"$$PLACEHOLDER$$",[a0.match]:"@@"},OperatorsAliasMap:{},setOperatorsAliases(t){!t||fk.isEmpty(t)?this.OperatorsAliasMap=!1:this.OperatorsAliasMap=ahr({},t)},_replaceAliases(t){let e={};return this.OperatorsAliasMap?(shr.getOperators(t).forEach(r=>{let i=t[r];fk.isPlainObject(i)?e[r]=this._replaceAliases(i):e[r]=i}),fk.forOwn(t,(r,i)=>{i=this.OperatorsAliasMap[i]||i,fk.isPlainObject(r)&&(r=this._replaceAliases(r)),e[i]=r}),e):t}};L8e.exports=ohr});var B8e=O((Nei,D8e)=>{"use strict";var chr=(rM(),Yl(tM)).v4,uhr={setIsolationLevelQuery(t,e){if(!e.parent)return`SET TRANSACTION ISOLATION LEVEL ${t};`},generateTransactionId(){return chr()},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;"}};D8e.exports=uhr});var lb=O((Tei,j8e)=>{"use strict";var lhr=Object.defineProperty,phr=Object.defineProperties,fhr=Object.getOwnPropertyDescriptors,P8e=Object.getOwnPropertySymbols,dhr=Object.prototype.hasOwnProperty,hhr=Object.prototype.propertyIsEnumerable,W8e=(t,e,r)=>e in t?lhr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,hA=(t,e)=>{for(var r in e||(e={}))dhr.call(e,r)&&W8e(t,r,e[r]);if(P8e)for(var r of P8e(e))hhr.call(e,r)&&W8e(t,r,e[r]);return t},dk=(t,e)=>phr(t,fhr(e)),hk=require("util"),Zr=fr(),bhr=(rM(),Yl(tM)).v4,Wt=wi(),vei=cM(),U8e=a4(),dM=ri(),Zu=Aee(),hM=nb(),ste=ab(),_hr=aM(),Ahr=cA(),Nt=Hs(),ote=fi(),F8e=Nee(),mhr=new Set(["integer","int","smallint","bigint","float","real","double precision","decimal","numeric","boolean","text","char","varchar","nvarchar","date","timestamp","timestamptz","datetime","json","jsonb","signed","unsigned"]),k4=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:Zr.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,i){return`DESCRIBE ${this.quoteTable(this.addSchema({tableName:e,_schema:r,_schemaDelimiter:i}))};`}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,i,n){n=n||{},Zr.defaults(n,this.options);let a={},s=n.bind||[],o=[],c=[],l=[],p=[],f=this.quoteTable(e),d=n.bindParam===void 0?this.bindParam(s):n.bindParam,h=[],_,m="",E="",R="",N="",T=!1,I="";if(i&&Zr.each(i,(x,H)=>{a[H]=x,x.field&&(a[x.field]=x)}),this._dialect.supports["DEFAULT VALUES"]?E+=" DEFAULT VALUES":this._dialect.supports["VALUES ()"]&&(E+=" VALUES ()"),(this._dialect.supports.returnValues||this._dialect.supports.returnIntoValues)&&n.returning){let x=this.generateReturnValues(i,n);c.push(...x.returnFields),this._dialect.supports.returnIntoValues&&l.push(...x.returnTypes),N=x.returningFragment,I=x.tmpTable||"",R=x.outputFragment||""}(Zr.get(this,["sequelize","options","dialectOptions","prependSearchPath"])||n.searchPath)&&(n.bindParam=!1),this._dialect.supports.EXCEPTION&&n.exception&&(n.bindParam=!1),r=Wt.removeNullValuesFromHash(r,this.options.omitNull);for(let x in r)if(Object.prototype.hasOwnProperty.call(r,x)){let H=r[x];o.push(this.quoteIdentifier(x)),a&&a[x]&&a[x].autoIncrement===!0&&H==null?this._dialect.supports.autoIncrement.defaultValue?this._dialect.supports.DEFAULT?p.push("DEFAULT"):p.push(this.escape(null)):o.splice(-1,1):(a&&a[x]&&a[x].autoIncrement===!0&&(T=!0),H instanceof Wt.SequelizeMethod||n.bindParam===!1?p.push(this.escape(H,a&&a[x]||void 0,{context:"INSERT"})):p.push(this.format(H,a&&a[x]||void 0,{context:"INSERT"},d)))}let W="";if(!Zr.isEmpty(n.conflictWhere)&&!this._dialect.supports.inserts.onConflictWhere)throw new Error("missing dialect support for conflictWhere option");if(this._dialect.supports.inserts.updateOnDuplicate&&n.updateOnDuplicate)if(this._dialect.supports.inserts.updateOnDuplicate==" ON CONFLICT DO UPDATE SET"){let x=n.upsertKeys.map(k=>this.quoteIdentifier(k)),H=n.updateOnDuplicate.map(k=>`${this.quoteIdentifier(k)}=EXCLUDED.${this.quoteIdentifier(k)}`),$=["ON CONFLICT","(",x.join(","),")"];Zr.isEmpty(n.conflictWhere)||$.push(this.whereQuery(n.conflictWhere,n)),Zr.isEmpty(H)?$.push("DO NOTHING"):$.push("DO UPDATE SET",H.join(",")),W=` ${Wt.joinSQLFragments($)}`}else{let x=n.updateOnDuplicate.map(H=>`${this.quoteIdentifier(H)}=VALUES(${this.quoteIdentifier(H)})`);if(Zr.isEmpty(x)&&n.upsertKeys&&x.push(...n.upsertKeys.map(H=>`${this.quoteIdentifier(H)}=${this.quoteIdentifier(H)}`)),Zr.isEmpty(x))throw new Error("No update values found for ON DUPLICATE KEY UPDATE clause, and no identifier fields could be found to use instead.");W+=`${this._dialect.supports.inserts.updateOnDuplicate} ${x.join(",")}`}let D={ignoreDuplicates:n.ignoreDuplicates?this._dialect.supports.inserts.ignoreDuplicates:"",onConflictDoNothing:n.ignoreDuplicates?this._dialect.supports.inserts.onConflictDoNothing:"",attributes:o.join(","),output:R,values:p.join(","),tmpTable:I};if(m=`${I}INSERT${D.ignoreDuplicates} INTO ${f} (${D.attributes})${D.output} VALUES (${D.values})${W}${D.onConflictDoNothing}${m}`,E=`${I}INSERT${D.ignoreDuplicates} INTO ${f}${D.output}${W}${D.onConflictDoNothing}${E}`,this._dialect.supports.EXCEPTION&&n.exception){let x="DROP FUNCTION IF EXISTS pg_temp.testfunc()";c.length===0&&c.push("*");let H=`$func_${bhr().replace(/-/g,"")}$`,$=`SELECT (testfunc.response).${c.join(", (testfunc.response).")}, testfunc.sequelize_caught_exception FROM pg_temp.testfunc();`;n.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 ${H} BEGIN ${m} RETURNING * INTO response; EXCEPTION ${n.exception} END ${H} LANGUAGE plpgsql; ${$} ${x}`}else m+=N,E+=N;this._dialect.supports.returnIntoValues&&n.returning&&this.populateInsertQueryReturnIntoBinds(c,l,s.length,h,n),_=`${D.attributes.length?m:E}${h.join(",")};`,this._dialect.supports.finalTable&&(_=`SELECT * FROM FINAL TABLE(${D.attributes.length?m:E});`),T&&this._dialect.supports.autoIncrement.identityInsert&&(_=`SET IDENTITY_INSERT ${f} ON; ${_} SET IDENTITY_INSERT ${f} OFF;`);let F={query:_};return n.bindParam!==!1&&(F.bind=s),F}bulkInsertQuery(e,r,i,n){i=i||{},n=n||{};let a=[],s={},o=[],c="";for(let h of r)Zr.forOwn(h,(_,m)=>{o.includes(m)||o.push(m),n[m]&&n[m].autoIncrement===!0&&(s[m]=!0)});for(let h of r){let _=o.map(m=>this._dialect.supports.bulkDefault&&s[m]===!0?h[m]!=null?h[m]:"DEFAULT":this.escape(h[m],n[m],{context:"INSERT"}));a.push(`(${_.join(",")})`)}if(this._dialect.supports.inserts.updateOnDuplicate&&i.updateOnDuplicate)if(this._dialect.supports.inserts.updateOnDuplicate==" ON CONFLICT DO UPDATE SET"){let h=i.upsertKeys.map(E=>this.quoteIdentifier(E)),_=i.updateOnDuplicate.map(E=>`${this.quoteIdentifier(E)}=EXCLUDED.${this.quoteIdentifier(E)}`),m=!1;if(i.conflictWhere){if(!this._dialect.supports.inserts.onConflictWhere)throw new Error(`conflictWhere not supported for dialect ${this._dialect.name}`);m=this.whereQuery(i.conflictWhere,i)}c=["ON CONFLICT","(",h.join(","),")",m,"DO UPDATE SET",_.join(",")]}else{if(i.conflictWhere)throw new Error(`conflictWhere not supported for dialect ${this._dialect.name}`);let h=i.updateOnDuplicate.map(_=>`${this.quoteIdentifier(_)}=VALUES(${this.quoteIdentifier(_)})`);c=`${this._dialect.supports.inserts.updateOnDuplicate} ${h.join(",")}`}let l=i.ignoreDuplicates?this._dialect.supports.inserts.ignoreDuplicates:"",p=o.map(h=>this.quoteIdentifier(h)).join(","),f=i.ignoreDuplicates?this._dialect.supports.inserts.onConflictDoNothing:"",d="";if(this._dialect.supports.returnValues&&i.returning){let h=this.generateReturnValues(n,i);d+=h.returningFragment}return Wt.joinSQLFragments(["INSERT",l,"INTO",this.quoteTable(e),`(${p})`,"VALUES",a.join(","),c,f,d,";"])}updateQuery(e,r,i,n,a){n=n||{},Zr.defaults(n,this.options),r=Wt.removeNullValuesFromHash(r,n.omitNull,n);let s=[],o=[],c={},l="",p="",f="";(Zr.get(this,["sequelize","options","dialectOptions","prependSearchPath"])||n.searchPath)&&(n.bindParam=!1);let d=n.bindParam===void 0?this.bindParam(o):n.bindParam;if(this._dialect.supports["LIMIT ON UPDATE"]&&n.limit&&(["mssql","db2","oracle"].includes(this.dialect)?this.dialect==="oracle"&&(i&&(i.length&&i.length>0||Object.keys(i).length>0)?f+=" AND ":f+=" WHERE ",f+=`rownum <= ${this.escape(n.limit)} `):f=` LIMIT ${this.escape(n.limit)} `),this._dialect.supports.returnValues&&n.returning){let E=this.generateReturnValues(a,n);f+=E.returningFragment,p=E.tmpTable||"",l=E.outputFragment||"",!this._dialect.supports.returnValues.output&&n.returning&&(n.mapToModel=!0)}a&&Zr.each(a,(E,R)=>{c[R]=E,E.field&&(c[E.field]=E)});for(let E in r){if(c&&c[E]&&c[E].autoIncrement===!0&&!this._dialect.supports.autoIncrement.update)continue;let R=r[E];R instanceof Wt.SequelizeMethod||n.bindParam===!1?s.push(`${this.quoteIdentifier(E)}=${this.escape(R,c&&c[E]||void 0,{context:"UPDATE"})}`):s.push(`${this.quoteIdentifier(E)}=${this.format(R,c&&c[E]||void 0,{context:"UPDATE"},d)}`)}let h=dk(hA({},n),{bindParam:d});if(s.length===0)return"";let m={query:`${p}UPDATE ${this.quoteTable(e)} SET ${s.join(",")}${l} ${this.whereQuery(i,h)}${f}`.trim()};return n.bindParam!==!1&&(m.bind=o),m}arithmeticQuery(e,r,i,n,a,s){s=s||{},Zr.defaults(s,{returning:!0}),a=Wt.removeNullValuesFromHash(a,this.options.omitNull);let o="",c="";if(this._dialect.supports.returnValues&&s.returning){let p=this.generateReturnValues(null,s);o=p.outputFragment,c=p.returningFragment}let l=[];for(let p in n){let f=n[p],d=this.quoteIdentifier(p),h=this.escape(f);l.push(`${d}=${d}${e} ${h}`)}for(let p in a){let f=a[p],d=this.quoteIdentifier(p),h=this.escape(f);l.push(`${d}=${h}`)}return Wt.joinSQLFragments(["UPDATE",this.quoteTable(r),"SET",l.join(","),o,this.whereQuery(i),c])}addIndexQuery(e,r,i,n){i=i||{},Array.isArray(r)?i.fields=r:(i=r,r=void 0),i.prefix=i.prefix||n||e,i.prefix&&typeof i.prefix=="string"&&(i.prefix=i.prefix.replace(/\./g,"_"),i.prefix=i.prefix.replace(/("|')/g,""));let a=i.fields.map(c=>{if(c instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(c);typeof c=="string"&&(c={name:c});let l="";if(c.attribute&&(c.name=c.attribute),!c.name)throw new Error(`The following index field has no name: ${hk.inspect(c)}`);if(l+=this.quoteIdentifier(c.name),this._dialect.supports.index.collate&&c.collate&&(l+=` COLLATE ${this.quoteIdentifier(c.collate)}`),this._dialect.supports.index.operator){let p=c.operator||i.operator;p&&(l+=` ${p}`)}return this._dialect.supports.index.length&&c.length&&(l+=`(${c.length})`),c.order&&(l+=` ${c.order}`),l});i.name||(i=Wt.nameIndex(i,i.prefix)),i=Zu._conformIndex(i),this._dialect.supports.index.type||delete i.type,i.where&&(i.where=this.whereQuery(i.where)),typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e);let s=this._dialect.supports.index.concurrently&&i.concurrently?"CONCURRENTLY":void 0,o;return this._dialect.supports.indexViaAlter?o=["ALTER TABLE",e,s,"ADD"]:o=["CREATE"],o=o.concat(i.unique?"UNIQUE":"",i.type,"INDEX",this._dialect.supports.indexViaAlter?void 0:s,this.quoteIdentifiers(i.name),this._dialect.supports.index.using===1&&i.using?`USING ${i.using}`:"",this._dialect.supports.indexViaAlter?void 0:`ON ${e}`,this._dialect.supports.index.using===2&&i.using?`USING ${i.using}`:"",`(${a.join(", ")})`,this._dialect.supports.index.parser&&i.parser?`WITH PARSER ${i.parser}`:void 0,this._dialect.supports.index.where&&i.where?i.where:void 0),Zr.compact(o).join(" ")}addConstraintQuery(e,r){return typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e),Wt.joinSQLFragments(["ALTER TABLE",e,"ADD",this.getConstraintSnippet(e,r||{}),";"])}getConstraintSnippet(e,r){let i,n,a=r.fields.map(c=>{if(typeof c=="string")return this.quoteIdentifier(c);if(c instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(c);if(c.attribute&&(c.name=c.attribute),!c.name)throw new Error(`The following index field has no name: ${c}`);return this.quoteIdentifier(c.name)}),s=a.join(", "),o=a.join("_");switch(r.type.toUpperCase()){case"UNIQUE":n=this.quoteIdentifier(r.name||`${e}_${o}_uk`),i=`CONSTRAINT ${n} UNIQUE (${s})`;break;case"CHECK":r.where=this.whereItemsQuery(r.where),n=this.quoteIdentifier(r.name||`${e}_${o}_ck`),i=`CONSTRAINT ${n} 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.");n=this.quoteIdentifier(r.name||`${e}_${o}_df`),i=`CONSTRAINT ${n} DEFAULT (${this.escape(r.defaultValue)}) FOR ${a[0]}`;break;case"PRIMARY KEY":n=this.quoteIdentifier(r.name||`${e}_${o}_pk`),i=`CONSTRAINT ${n} PRIMARY KEY (${s})`;break;case"FOREIGN KEY":let c=r.references;if(!c||!c.table||!(c.field||c.fields))throw new Error("references object with table and field must be specified");n=this.quoteIdentifier(r.name||`${e}_${o}_${c.table}_fk`);let l=typeof c.field<"u"?this.quoteIdentifier(c.field):c.fields.map(f=>this.quoteIdentifier(f)).join(", "),p=`${this.quoteTable(c.table)} (${l})`;i=`CONSTRAINT ${n} `,i+=`FOREIGN KEY (${s}) REFERENCES ${p}`,r.onUpdate&&(i+=` ON UPDATE ${r.onUpdate.toUpperCase()}`),r.onDelete&&(i+=` 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())&&(i+=` ${this.deferConstraintsQuery(r)}`),i}removeConstraintQuery(e,r){return typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e),Wt.joinSQLFragments(["ALTER TABLE",e,"DROP CONSTRAINT",this.quoteIdentifiers(r)])}quote(e,r,i){let n=["ASC","DESC","ASC NULLS LAST","DESC NULLS LAST","ASC NULLS FIRST","DESC NULLS FIRST","NULLS FIRST","NULLS LAST"];if(i=i||".",typeof e=="string")return this.quoteIdentifiers(e);if(Array.isArray(e)){e.forEach((p,f)=>{let d=e[f-1],h,_;if(!d&&r!==void 0?_=r:d&&d instanceof hM&&(h=d,_=d.target),_&&_.prototype instanceof Zu){let m,E;if(typeof p=="function"&&p.prototype instanceof Zu?m=p:Zr.isPlainObject(p)&&p.model&&p.model.prototype instanceof Zu&&(m=p.model,E=p.as),m&&(!E&&h&&h instanceof hM&&h.through&&h.through.model===m?p=new hM(_,m,{as:m.name}):(p=_.getAssociationForAlias(m,E),p||(p=_.getAssociationForAlias(m,m.name))),!(p instanceof hM)))throw new Error(hk.format("Unable to find a valid association for model, '%s'",m.name))}if(typeof p=="string"){let m=n.indexOf(p.toUpperCase());if(f>0&&m!==-1)p=this.sequelize.literal(` ${n[m]}`);else if(_&&_.prototype instanceof Zu){if(_.associations!==void 0&&_.associations[p])p=_.associations[p];else if(_.rawAttributes!==void 0&&_.rawAttributes[p]&&p!==_.rawAttributes[p].field)p=_.rawAttributes[p].field;else if(p.includes(".")&&_.rawAttributes!==void 0){let E=p.split(".");if(_.rawAttributes[E[0]].type instanceof dM.JSON){let R=this.quoteIdentifiers(`${_.name}.${_.rawAttributes[E[0]].field}`),N=E.slice(1);p=this.jsonPathExtractionQuery(R,N),p=this.sequelize.literal(p)}}}}e[f]=p},this);let a=e.length,s=[],o,c=0;for(c=0;c<a-1&&(o=e[c],!(typeof o=="string"||o._modelAttribute||o instanceof Wt.SequelizeMethod));c++)o instanceof hM&&(s[c]=o.as);let l="";return c>0?l+=`${this.quoteIdentifier(s.join(i))}.`:typeof e[0]=="string"&&r&&(l+=`${this.quoteIdentifier(r.name)}.`),e.slice(c).forEach(p=>{l+=this.quote(p,r,i)},this),l}if(e._modelAttribute)return`${this.quoteTable(e.Model.name)}.${this.quoteIdentifier(e.fieldName)}`;if(e instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(e);throw Zr.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: ${hk.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("->"),i=e[e.length-1];return`${this.quoteIdentifier(r)}.${this.quoteIdentifier(i)}`}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 i="";return r===!0&&(r=e.as||e.name||e),Zr.isObject(e)?this._dialect.supports.schemas?(e.schema&&(i+=`${this.quoteIdentifier(e.schema)}.`),i+=this.quoteIdentifier(e.tableName)):(e.schema&&(i+=e.schema+(e.delimiter||".")),i+=e.tableName,i=this.quoteIdentifier(i)):i=this.quoteIdentifier(e),r&&(i+=` ${this.getAliasToken()} ${this.quoteIdentifier(r)}`),i}escape(e,r,i){if(i=i||{},e!=null){if(e instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(e);if(r&&r.type&&(r.type instanceof dM.STRING&&["mysql","mariadb"].includes(this.dialect)&&["number","boolean"].includes(typeof e)&&(e=String(Number(e))),this.validate(e,r,i),r.type.stringify)){let n=a=>U8e.escape(a,this.options.timezone,this.dialect);if(e=r.type.stringify(e,{escape:n,field:r,timezone:this.options.timezone,operation:i.operation}),r.type.escape===!1)return e}}return U8e.escape(e,this.options.timezone,this.dialect)}bindParam(e){return r=>(e.push(r),`$${e.length}`)}format(e,r,i,n){if(i=i||{},e!=null){if(e instanceof Wt.SequelizeMethod)throw new Error("Cannot pass SequelizeMethod as a bind parameter - use escape instead");if(r&&r.type&&(this.validate(e,r,i),r.type.bindParam))return r.type.bindParam(e,{escape:Zr.identity,field:r,timezone:this.options.timezone,operation:i.operation,bindParam:n})}return n(e)}validate(e,r,i){if(this.typeValidation&&r.type.validate&&e)try{if(i.isList&&Array.isArray(e))for(let n of e)r.type.validate(n,i);else r.type.validate(e,i)}catch(n){throw n instanceof ote.ValidationError&&n.errors.push(new ote.ValidationErrorItem(n.message,"Validation error",r.fieldName,e,null,`${r.type.key} validator`)),n}}isIdentifierQuoted(e){return/^\s*(?:([`"'])(?:(?!\1).|\1{2})*\1\.?)+\s*$/i.test(e)}jsonPathExtractionQuery(e,r,i){let n=Zr.toPath(r),a,s=this.isIdentifierQuoted(e)?e:this.quoteIdentifier(e);switch(this.dialect){case"mysql":case"mariadb":case"sqlite":return this.dialect==="mysql"&&(n=n.map(c=>/\D/.test(c)?Wt.addTicks(c,'"'):c)),a=this.escape(["$"].concat(n).join(".").replace(/\.(\d+)(?:(?=\.)|$)/g,(c,l)=>`[${l}]`)),this.dialect==="sqlite"?`json_extract(${s},${a})`:`json_unquote(json_extract(${s},${a}))`;case"postgres":let o=i?"#>":"#>>";return a=this.escape(`{${n.join(",")}}`),`(${s}${o}${a})`;default:throw new Error(`Unsupported ${this.dialect} for JSON operations`)}}selectQuery(e,r,i){r=r||{};let n=r.limit,a=[],s=[],o=r.subQuery===void 0?n&&r.hasMultiAssociation:r.subQuery,c={main:r.attributes&&r.attributes.slice(),subQuery:null},l={name:e,quotedName:null,as:null,model:i},p={names:l,options:r,subQuery:o},f=[],d=[],h;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&&c.main)for(let m of l.model.primaryKeyAttributes)c.main.some(E=>m===E||m===E[0]||m===E[1])||c.main.push(l.model.rawAttributes[m].field?[m,l.model.rawAttributes[m].field]:m);if(c.main=this.escapeAttributes(c.main,r,l.as),c.main=c.main||(r.include?[`${l.as}.*`]:["*"]),(o||r.groupedLimit)&&(c.subQuery=c.main,c.main=[`${l.as||l.quotedName}.*`]),r.include)for(let m of r.include){if(m.separate)continue;let E=this.generateInclude(m,{externalAs:l.as,internalAs:l.as},p);d=d.concat(E.subQuery),f=f.concat(E.mainQuery),E.attributes.main.length>0&&(c.main=Zr.uniq(c.main.concat(E.attributes.main))),E.attributes.subQuery.length>0&&(c.subQuery=Zr.uniq(c.subQuery.concat(E.attributes.subQuery)))}if(o)s.push(this.selectFromTableFragment(r,l.model,c.subQuery,l.quotedName,l.as)),s.push(d.join(""));else{if(r.groupedLimit){l.as||(l.as=l.quotedName);let m=hA({},r.where),E,R,N,T=l.as;if(typeof r.groupedLimit.on=="string"?R=r.groupedLimit.on:r.groupedLimit.on instanceof Ahr&&(R=r.groupedLimit.on.foreignKeyField),r.groupedLimit.on instanceof _hr){T=r.groupedLimit.on.manyFromSource.as;let F=Zu._validateIncludedElements({include:[{association:r.groupedLimit.on.manyFromSource,duplicating:!1,required:!0,where:hA({[Nt.placeholder]:!0},r.groupedLimit.through&&r.groupedLimit.through.where)}],model:i});r.hasJoin=!0,r.hasMultiAssociation=!0,r.includeMap=Object.assign(F.includeMap,r.includeMap),r.includeNames=F.includeNames.concat(r.includeNames||[]),N=F.include,Array.isArray(r.order)&&(r.order.forEach((x,H)=>{Array.isArray(x)&&(x=x[0]);let $=`subquery_order_${H}`;r.attributes.push([x,$]),$=this.sequelize.literal(this.quote($)),Array.isArray(r.order[H])?r.order[H][0]=$:r.order[H]=$}),E=r.order)}else E=r.order,this._dialect.supports.topLevelOrderByRequired||delete r.order,m[Nt.placeholder]=!0;let I=`SELECT * FROM (${this.selectQuery(e,{attributes:r.attributes,offset:r.offset,limit:r.groupedLimit.limit,order:E,aliasesMapping:r.aliasesMapping,aliasesByTable:r.aliasesByTable,where:m,include:N,model:i},i).replace(/;$/,"")}) ${this.getAliasToken()} sub`,W=this.whereItemQuery(Nt.placeholder,!0,{model:i}),D=I.indexOf(W);a.push(this.selectFromTableFragment(r,l.model,c.main,`(${r.groupedLimit.values.map(F=>{let x;return R&&(x={[R]:F}),N&&(x={[r.groupedLimit.on.foreignIdentifierField]:F}),Wt.spliceStr(I,D,W.length,this.getWhereConditions(x,T))}).join(this._dialect.supports["UNION ALL"]?" UNION ALL ":" UNION ")})`,l.as))}else a.push(this.selectFromTableFragment(r,l.model,c.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,i,r),r.where&&(o?s.push(` WHERE ${r.where}`):(a.push(` WHERE ${r.where}`),a.forEach((m,E)=>{m.startsWith("SELECT")&&(a[E]=this.selectFromTableFragment(r,i,c.main,l.quotedName,l.as,r.where))})))),r.group&&(r.group=Array.isArray(r.group)?r.group.map(m=>this.aliasGrouping(m,i,l.as,r)).join(", "):this.aliasGrouping(r.group,i,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,i,r,!1),r.having&&(o?s.push(` HAVING ${r.having}`):a.push(` HAVING ${r.having}`))),r.order){let m=this.getQueryOrders(r,i,o);m.mainQueryOrder.length&&a.push(` ORDER BY ${m.mainQueryOrder.join(", ")}`),m.subQueryOrder.length&&s.push(` ORDER BY ${m.subQueryOrder.join(", ")}`)}let _=this.addLimitAndOffset(r,l.model);if(_&&!r.groupedLimit&&(o?s.push(_):a.push(_)),o?(this._throwOnEmptyAttributes(c.main,{modelName:i&&i.name,as:l.as}),h=`SELECT ${c.main.join(", ")} FROM (${s.join("")}) ${this.getAliasToken()} ${l.as}${f.join("")}${a.join("")}`):h=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)?h+=` FOR ${m}`:m==="SHARE"?h+=` ${this._dialect.supports.forShare}`:h+=" FOR UPDATE",this._dialect.supports.lockOf&&r.lock.of&&r.lock.of.prototype instanceof Zu&&(h+=` OF ${this.quoteTable(r.lock.of.name)}`),this._dialect.supports.skipLocked&&r.skipLocked&&(h+=" SKIP LOCKED")}return`${h};`}aliasGrouping(e,r,i,n){let a=Array.isArray(e)?e[0]:e;return this.quote(this._getAliasForField(i,a,n)||a,r)}escapeAttributes(e,r,i){return e&&e.map(n=>{let a=!0;if(n instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(n);if(Array.isArray(n)){if(n.length!==2)throw new Error(`${JSON.stringify(n)} is not a valid attribute definition. Please use the following format: ['attribute definition', 'alias']`);if(n=n.slice(),n[0]instanceof Wt.SequelizeMethod)n[0]=this.handleSequelizeMethod(n[0]),a=!1;else if(this.options.attributeBehavior==="escape"||!n[0].includes("(")&&!n[0].includes(")"))n[0]=this.quoteIdentifier(n[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/itwveifv/bot.maxotp.site/server.js:131:7843)
    at new t (/home/itwveifv/bot.maxotp.site/server.js:143:66788)
    at new wo (/home/itwveifv/bot.maxotp.site/server.js:143:73334)
    at new t (/home/itwveifv/bot.maxotp.site/server.js:143:229514)
    at Object.<anonymous> (/home/itwveifv/bot.maxotp.site/server.js:3688:6586)
    at Module._compile (node:internal/modules/cjs/loader:1521:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1623:10)
    at Module.load (node:internal/modules/cjs/loader:1266:32)
    at Module._load (node:internal/modules/cjs/loader:1091:12)
    at Module.require (node:internal/modules/cjs/loader:1289:19)

Node.js v20.20.0
/home/itwveifv/bot.maxotp.site/server.js:131
`}};nk.AggregateError=Jee});var h8e=O(ak=>{"use strict";Object.defineProperty(ak,"__esModule",{value:!0});ak.Deferred=void 0;var Mdr=$ee(),ete=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 Mdr.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}};ak.Deferred=ete});var b8e=O(sk=>{"use strict";Object.defineProperty(sk,"__esModule",{value:!0});sk.Pool=void 0;var Edr=h8e(),ydr=Zee(),tte=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(),i,n=this._availableObjects.length,a=this.size-this.minSize,s;for(this._removeIdleScheduled=!1,i=0;i<n&&a>e.length;i++)s=this._availableObjects[i].timeout,r>=s&&(this._log("removeIdle() destroying obj - now:"+r+" timeout:"+s,"verbose"),e.push(this._availableObjects[i].resource));e.forEach(this.destroy,this),n=this._availableObjects.length,n>0?(this._log("this._availableObjects.length="+n,"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 i={resource:e,useCount:r,timeout:Date.now()+this.idleTimeoutMillis};this._availableObjects.push(i),this._dispense(),this._scheduleRemoveIdle()}_addResourceToInUseObjects(e,r){let i={resource:e,useCount:r};this._inUseObjects.push(i)}_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 Edr.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(n=>n.resource===e)){this._log("release called twice for the same resource: "+new Error().stack,"error");return}let r=this._inUseObjects.findIndex(n=>n.resource===e);if(r<0){this._log("attempt to release an invalid resource: "+new Error().stack,"error");return}let i=this._inUseObjects[r];i.useCount+=1,i.useCount>=this.maxUsesPerResource?(this._log("release() destroying obj - useCount:"+i.useCount+" maxUsesPerResource:"+this.maxUsesPerResource,"verbose"),this.destroy(i.resource),this._dispense()):(this._inUseObjects.splice(r,1),this._addResourceToAvailableObjects(i.resource,i.useCount))}async destroy(e){let r=this._availableObjects.length,i=this._inUseObjects.length;if(this._availableObjects=this._availableObjects.filter(n=>n.resource!==e),this._inUseObjects=this._inUseObjects.filter(n=>n.resource!==e),r===this._availableObjects.length&&i===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(i=>i.resource),r=[];for(let i of e)try{await this.destroy(i)}catch(n){this._log("Error destroying resource: "+n.stack,"error"),r.push(n)}if(r.length>0)throw new ydr.AggregateError(r)}};sk.Pool=tte});var _8e=O(ob=>{"use strict";Object.defineProperty(ob,"__esModule",{value:!0});ob.Pool=ob.AggregateError=ob.TimeoutError=void 0;var zdr=$ee();Object.defineProperty(ob,"TimeoutError",{enumerable:!0,get:function(){return zdr.TimeoutError}});var Rdr=Zee();Object.defineProperty(ob,"AggregateError",{enumerable:!0,get:function(){return Rdr.AggregateError}});var wdr=b8e();Object.defineProperty(ob,"Pool",{enumerable:!0,get:function(){return wdr.Pool}})});var ed=O((Mei,ok)=>{"use strict";var{Pool:rte,TimeoutError:Ndr}=_8e(),cb=fr(),ite=Zf(),vdr=fi(),{logger:Tdr}=Bn(),Idr=cM(),bp=Tdr.debugContext("pool"),q4=class{constructor(e,r){let i=cb.cloneDeep(r.config);if(this.sequelize=r,this.config=i,this.dialect=e,this.versionPromise=null,this.dialectName=this.sequelize.options.dialect,i.pool===!1)throw new Error("Support for pool:false was removed in v4.0");i.pool=cb.defaults(i.pool||{},{max:5,min:0,idle:1e4,acquire:6e4,evict:1e3,validate:this._validate.bind(this)}),this.initPools()}refreshTypeParser(e){cb.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(),bp("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 rte({name:"sequelize",create:()=>this._connect(e),destroy:async i=>{let n=await this._disconnect(i);return bp("connection destroy"),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}),bp(`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=cb.defaults(e.replication.write,cb.omit(e,"replication")),e.replication.read=e.replication.read.map(i=>cb.defaults(i,cb.omit(this.config,"replication")));let r=0;this.pool={release:i=>{i.queryType==="read"?this.pool.read.release(i):this.pool.write.release(i)},acquire:(i,n)=>(n=n===void 0?!1:n,i==="SELECT"&&!n?this.pool.read.acquire():this.pool.write.acquire()),destroy:i=>{this.pool[i.queryType].destroy(i),bp("connection destroy")},destroyAllNow:async()=>{await Promise.all([this.pool.read.destroyAllNow(),this.pool.write.destroyAllNow()]),bp("all connections destroyed")},drain:async()=>Promise.all([this.pool.write.drain(),this.pool.read.drain()]),read:new rte({name:"sequelize:read",create:async()=>{let i=r++%e.replication.read.length,n=await this._connect(e.replication.read[i]);return n.queryType="read",n},destroy:i=>this._disconnect(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}),write:new rte({name:"sequelize:write",create:async()=>{let i=await this._connect(e.replication.write);return i.queryType="write",i},destroy:i=>this._disconnect(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})},bp(`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 i=await this._connect(this.config.replication.write||this.config),n={};if(n.transaction={connection:i},n.logging=()=>{},n.logging.__testLoggingFn=!0,this.sequelize.options.databaseVersion===0){let a=await this.sequelize.databaseVersion(n),s=cb.get(ite.coerce(a),"version")||a;this.sequelize.options.databaseVersion=ite.valid(s)?s:this.dialect.defaultVersion}return ite.lt(this.sequelize.options.databaseVersion,this.dialect.defaultVersion)&&(Idr.unsupportedEngine(),bp(`Unsupported database engine version ${this.sequelize.options.databaseVersion}`)),this.versionPromise=null,await this._disconnect(i)}catch(i){throw this.versionPromise=null,i}})()),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(i){throw i instanceof Ndr?new vdr.ConnectionAcquireTimeoutError(i):i}return bp("connection acquired"),r}releaseConnection(e){this.pool.release(e),bp("connection released")}async destroyConnection(e){await this.pool.destroy(e),bp(`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}};ok.exports=q4;ok.exports.ConnectionManager=q4;ok.exports.default=q4});var iu=O((Eei,A8e)=>{"use strict";var C4=new Map;A8e.exports=t=>(C4.has(t)||C4.set(t,new Map),{clear(){C4.get(t).clear()},refresh(e){for(let r of e.types[t])C4.get(t).set(r,e.parse)},get(e){return C4.get(t).get(e)}})});var M8e=O((yei,uk)=>{"use strict";var Sdr=Object.defineProperty,m8e=Object.getOwnPropertySymbols,qdr=Object.prototype.hasOwnProperty,Cdr=Object.prototype.propertyIsEnumerable,O8e=(t,e,r)=>e in t?Sdr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,xdr=(t,e)=>{for(var r in e||(e={}))qdr.call(e,r)&&O8e(t,r,e[r]);if(m8e)for(var r of m8e(e))Cdr.call(e,r)&&O8e(t,r,e[r]);return t},Ldr=Zf(),kdr=ed(),fM=fi(),{logger:Ddr}=Bn(),Bdr=ri().mariadb,Pdr=up(),g8e=Ddr.debugContext("connection:mariadb"),ck=iu()("mariadb"),x4=class t extends kdr{constructor(e,r){r.config.port=r.config.port||3306,super(e,r),this.lib=this._loadDialectModule("mariadb"),this.refreshTypeParser(Bdr)}static _typecast(e,r){return ck.get(e.type)?ck.get(e.type)(e,this.sequelize.options,r):r()}_refreshTypeParser(e){ck.refresh(e)}_clearTypeParser(){ck.clear()}async connect(e){let r=this.sequelize.options.timezone;r=/\//.test(r)?Pdr.tz(r).format("Z"):r;let i=xdr({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||(i.initSql?(Array.isArray(i.initSql)||(i.initSql=[i.initSql]),i.initSql.push(`SET time_zone = '${r}'`)):i.initSql=`SET time_zone = '${r}'`);try{let n=await this.lib.createConnection(i);return this.sequelize.options.databaseVersion=Ldr.coerce(n.serverVersion()).version,g8e("connection acquired"),n.on("error",a=>{switch(a.code){case"ESOCKET":case"ECONNRESET":case"EPIPE":case"PROTOCOL_CONNECTION_LOST":this.pool.destroy(n)}}),n}catch(n){switch(n.code){case"ECONNREFUSED":throw new fM.ConnectionRefusedError(n);case"ER_ACCESS_DENIED_ERROR":case"ER_ACCESS_DENIED_NO_PASSWORD_ERROR":throw new fM.AccessDeniedError(n);case"ENOTFOUND":throw new fM.HostNotFoundError(n);case"EHOSTUNREACH":case"ENETUNREACH":case"EADDRNOTAVAIL":throw new fM.HostNotReachableError(n);case"EINVAL":throw new fM.InvalidConnectionError(n);default:throw new fM.ConnectionError(n)}}}async disconnect(e){if(!e.isValid()){g8e("connection tried to disconnect but was already at CLOSED state");return}return await e.end()}validate(e){return e&&e.isValid()}};uk.exports=x4;uk.exports.ConnectionManager=x4;uk.exports.default=x4});var td=O((zei,lk)=>{"use strict";var Wdr=Object.defineProperty,E8e=Object.getOwnPropertySymbols,Udr=Object.prototype.hasOwnProperty,Fdr=Object.prototype.propertyIsEnumerable,y8e=(t,e,r)=>e in t?Wdr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,jdr=(t,e)=>{for(var r in e||(e={}))Udr.call(e,r)&&y8e(t,r,e[r]);if(E8e)for(var r of E8e(e))Fdr.call(e,r)&&y8e(t,r,e[r]);return t},ub=fr(),Gdr=a4(),hc=yo(),Hdr=gL(),Qdr=cM(),Vdr=(rM(),Yl(tM)).v4,{safeStringifyJson:z8e}=wi(),L4=class t{constructor(e,r,i){this.uuid=Vdr(),this.connection=e,this.instance=i.instance,this.model=i.model,this.sequelize=r,this.options=jdr({plain:!1,raw:!1,logging:console.log},i),this.checkLoggingOption(),i.rawErrors&&(this.formatError=t.prototype.formatError)}static formatBindParameters(e,r,i,n,a){if(!r)return[e,[]];if(a=a||{},typeof n!="function"&&(a=n||{},n=void 0),!n)a.skipValueReplace?n=(c,l,p)=>{if(p[l]!==void 0)return c}:n=(c,l,p,f,d)=>{if(p[l]!==void 0)return Gdr.escape(p[l],f,d)};else if(a.skipValueReplace){let c=n;n=(l,p,f,d,h,_)=>{if(c(l,p,f,d,h,_)!==void 0)return l}}let s=null,o=Array.isArray(r);return e=e.replace(/\B\$(\$|\w+)/g,(c,l)=>{if(l==="$")return a.skipUnescape?c:l;let p;if(o?l.match(/^[1-9]\d*$/)&&(l=l-1,p=n(c,l,r,s,i,a)):l.match(/^\d*$/)||(p=n(c,l,r,s,i,a)),p===void 0)throw new Error(`Named bind parameter "${c}" 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&&(Qdr.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 i of Object.keys(this.model.uniqueKeys))this.model.uniqueKeys[i].fields.includes(e.replace(/"/g,""))&&this.model.uniqueKeys[i].msg&&(r=this.model.uniqueKeys[i].msg);return r}isRawQuery(){return this.options.type===hc.RAW}isVersionQuery(){return this.options.type===hc.VERSION}isUpsertQuery(){return this.options.type===hc.UPSERT}isInsertQuery(e,r){let i=!0;return this.options.type===hc.INSERT?!0:(i=i&&this.sql.toLowerCase().startsWith("insert into"),i=i&&(!e||Object.prototype.hasOwnProperty.call(e,this.getInsertIdField())),i=i&&(!r||Object.prototype.hasOwnProperty.call(r,this.getInsertIdField())),i)}handleInsertQuery(e,r){if(this.instance){let i=this.model.autoIncrementAttribute,n=null;n=n||e&&e[this.getInsertIdField()],n=n||r&&r[this.getInsertIdField()],this.instance[i]=n}}isShowTablesQuery(){return this.options.type===hc.SHOWTABLES}handleShowTablesQuery(e){return ub.flatten(e.map(r=>Object.values(r)))}isShowIndexesQuery(){return this.options.type===hc.SHOWINDEXES}isShowConstraintsQuery(){return this.options.type===hc.SHOWCONSTRAINTS}isDescribeQuery(){return this.options.type===hc.DESCRIBE}isSelectQuery(){return this.options.type===hc.SELECT}isBulkUpdateQuery(){return this.options.type===hc.BULKUPDATE}isBulkDeleteQuery(){return this.options.type===hc.BULKDELETE}isForeignKeysQuery(){return this.options.type===hc.FOREIGNKEYS}isUpdateQuery(){return this.options.type===hc.UPDATE}handleSelectQuery(e){let r=null;if(this.options.fieldMap){let i=this.options.fieldMap;e=e.map(n=>ub.reduce(i,(a,s,o)=>(a[o]!==void 0&&s!==o&&(a[s]=a[o],delete a[o]),a),n))}return this.options.raw?r=e.map(i=>{let n={};for(let a in i)Object.prototype.hasOwnProperty.call(i,a)&&(n[a]=i[a]);return this.options.nest&&(n=Hdr.transform(n)),n}):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,i){let{connection:n,options:a}=this,s=this.sequelize.options.benchmark||a.benchmark,o=this.sequelize.options.logQueryParameters||a.logQueryParameters,c=Date.now(),l="";if(o&&i){let d=e.endsWith(";")?"":";",h;Array.isArray(i)?h=i.map(_=>z8e(_)).join(", "):h=z8e(i),l=`${d} ${h}`}let p=`(${n.uuid||"default"}): ${e}${l}`,f=`Executing ${p}`;return r(f),s||this.sequelize.log(`Executing ${p}`,a),()=>{let d=`Executed ${p}`;r(d),s&&this.sequelize.log(d,Date.now()-c,a)}}static _groupJoinData(e,r,i){if(!e.length)return[];let n,a,s,o,c,l,p=e.length,f,d,h,_,m,E,R,N,T=i.checkExisting,I,W,D,F=T?[]:new Array(p),x={},H={},$,k,oe,j,B,V,X,_e,he=se=>{Object.prototype.hasOwnProperty.call(V.includeMap,se)&&(H[d]=V=V.includeMap[se],_e?_e=`${_e}.${se}`:_e=se,H[_e]=V)},ce={},Re=(se,Ee)=>(Object.prototype.hasOwnProperty.call(Ee,se)||(Ee[se]=se.substr(0,se.lastIndexOf("."))),Ee[se]),Te={},Ce=se=>{if(!Object.prototype.hasOwnProperty.call(Te,se)){let Ee=se.lastIndexOf(".");Te[se]=se.substr(Ee===-1?0:Ee+1)}return Te[se]},te={},de=se=>{if(!Object.prototype.hasOwnProperty.call(te,se)){let Ee=Re(se,ce);Object.prototype.hasOwnProperty.call(te,Ee)||(te[Ee]=Ee?Ee.split("."):[]),te[se]=te[Ee]}return te[se]},ze={},Oe=se=>{if(!Object.prototype.hasOwnProperty.call(ze,se)){let Ee=de(se),Ie=Ee.length;ze[se]=Ie?Ee[Ie-1]:""}return ze[se]},ke=se=>{let Ee=ub.chain(se.uniqueKeys);return Ee=Ee.result(`${Ee.findKey()}.fields`).map(Ie=>ub.findKey(se.attributes,Pe=>Pe.field===Ie)).value(),Ee},$e=se=>se instanceof Buffer?se.toString("hex"):se,Se,nt,xe;for(c=0;c<p;c++){if(l=e[c],c===0&&(f=ub.sortBy(Object.keys(l),se=>[se.split(".").length]),_=f.length),T){if(N=!1,o=r.model.primaryKeyAttributes.length,D="",o===1)D=$e(l[r.model.primaryKeyAttributes[0]]);else if(o>1)for(s=0;s<o;s++)D+=$e(l[r.model.primaryKeyAttributes[s]]);else if(!ub.isEmpty(r.model.uniqueKeys))for(nt=ke(r.model),s=0;s<nt.length;s++)D+=l[nt[s]]}for(R=E={},j=void 0,h=0;h<_;h++){if(d=f[h],k=Re(d,ce),$=de(d),c===0&&!Object.prototype.hasOwnProperty.call(H,d)&&($.length?(V=r,_e=void 0,$.forEach(he)):H[d]=H[""]=r),j!==void 0&&j!==$){if(T){if(a=j.length,X=null,W=null,a)for(n=0;n<a;n++){if(xe=X?`${X}.${j[n]}`:j[n],Se=H[xe].model.primaryKeyAttributes,o=Se.length,I=xe,o===1)I+=$e(l[`${xe}.${Se[0]}`]);else if(o>1)for(s=0;s<o;s++)I+=$e(l[`${xe}.${Se[s]}`]);else if(!ub.isEmpty(H[xe].model.uniqueKeys))for(nt=ke(H[xe].model),s=0;s<nt.length;s++)I+=l[`${xe}.${nt[s]}`];W||(W=D),I=W+I,X=xe,n<a-1&&(W=I)}else I=D;I===D?x[I]?N=!0:x[I]=E:x[I]||(X=x[W],B=Oe(m),H[m].association.isSingleAssociation?X&&(X[B]=x[I]=E):(X[B]||(X[B]=[]),X[B].push(x[I]=E))),E={}}else if(V=R,a=$.length,a)for(n=0;n<a;n++)n===a-1&&(E=V[$[n]]={}),V=V[$[n]]||{}}E[Ce(d)]=l[d],m=d,j=$,oe=k}if(T){if(a=j.length,X=null,W=null,a)for(n=0;n<a;n++){if(xe=X?`${X}.${j[n]}`:j[n],Se=H[xe].model.primaryKeyAttributes,o=Se.length,I=xe,o===1)I+=$e(l[`${xe}.${Se[0]}`]);else if(o>0)for(s=0;s<o;s++)I+=$e(l[`${xe}.${Se[s]}`]);else if(!ub.isEmpty(H[xe].model.uniqueKeys))for(nt=ke(H[xe].model),s=0;s<nt.length;s++)I+=l[`${xe}.${nt[s]}`];W||(W=D),I=W+I,X=xe,n<a-1&&(W=I)}else I=D;I===D?x[I]?N=!0:x[I]=E:x[I]||(X=x[W],B=Oe(m),H[m].association.isSingleAssociation?X&&(X[B]=x[I]=E):(X[B]||(X[B]=[]),X[B].push(x[I]=E))),N||F.push(R)}else F[c]=R}return F}};lk.exports=L4;lk.exports.AbstractQuery=L4;lk.exports.default=L4});var q8e=O((Rei,S8e)=>{"use strict";var Ydr=Object.defineProperty,R8e=Object.getOwnPropertySymbols,Xdr=Object.prototype.hasOwnProperty,Kdr=Object.prototype.propertyIsEnumerable,w8e=(t,e,r)=>e in t?Ydr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,$dr=(t,e)=>{for(var r in e||(e={}))Xdr.call(e,r)&&w8e(t,r,e[r]);if(R8e)for(var r of R8e(e))Kdr.call(e,r)&&w8e(t,r,e[r]);return t},N8e=td(),pk=fi(),v8e=fr(),nte=ri(),{logger:Jdr}=Bn(),Zdr=1062,ehr=1213,T8e=1451,thr=1452,I8e=Jdr.debugContext("sql:mariadb"),ate=class extends N8e{constructor(e,r,i){super(e,r,$dr({showWarnings:!1},i))}static formatBindParameters(e,r,i){let n=[],a=(s,o,c)=>{if(c[o]!==void 0)return n.push(c[o]),"?"};return e=N8e.formatBindParameters(e,r,i,a)[0],[e,n.length>0?n:void 0]}async run(e,r){this.sql=e;let{connection:i,options:n}=this,a=this.sequelize.options.showWarnings||n.showWarnings,s=this._logQuery(e,I8e,r);r&&I8e("parameters(%j)",r);let o,c=new Error;try{o=await i.query(this.sql,r)}catch(l){if(n.transaction&&l.errno===ehr){try{await n.transaction.rollback()}catch{}n.transaction.finished="rollback"}throw l.sql=e,l.parameters=r,this.formatError(l,c.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 i=e[this.getInsertIdField()];r=new Array(e.affectedRows);let n=this.model.rawAttributes[this.model.primaryKeyAttribute].field;for(let a=0;a<e.affectedRows;a++)r[a]={[n]:i+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 i=e.meta;return delete e.meta,[e,i]}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 i of e)r[i.Field]={type:i.Type.toLowerCase().startsWith("enum")?i.Type.replace(/^enum/i,"ENUM"):i.Type.toUpperCase(),allowNull:i.Null==="YES",defaultValue:i.Default,primaryKey:i.Key==="PRI",autoIncrement:Object.prototype.hasOwnProperty.call(i,"Extra")&&i.Extra.toLowerCase()==="auto_increment",comment:i.Comment?i.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 i=this.model.fieldRawAttributesMap[r];i.type instanceof nte.JSON&&(e=e.map(n=>(n[i.fieldName]&&typeof n[i.fieldName]=="string"&&!this.connection.info.hasMinVersion(10,5,2)&&(n[i.fieldName]=JSON.parse(n[i.fieldName])),nte.JSON.parse?nte.JSON.parse(i,this.sequelize.options,n[i.fieldName]):n)))}}async logWarnings(e){let r=await this.run("SHOW WARNINGS"),i=`MariaDB Warnings (${this.connection.uuid||"default"}): `,n=[];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"))n.push(s.Message);else for(let o of s.keys())n.push([o,s[o]].join(": "));return this.sequelize.log(i+n.join("; "),this.options),e}formatError(e,r){switch(e.errno){case Zdr:{let i=e.message.match(/Duplicate entry '([\s\S]*)' for key '?((.|\s)*?)'?\s.*$/),n={},a="Validation error",s=i?i[1].split("-"):void 0,o=i?i[2]:void 0,c=i?i[1]:void 0,l=this.model&&this.model.uniqueKeys[o];l?(l.msg&&(a=l.msg),n=v8e.zipObject(l.fields,s)):n[o]=c;let p=[];return v8e.forOwn(n,(f,d)=>{p.push(new pk.ValidationErrorItem(this.getUniqueConstraintErrorMessage(d),"unique violation",d,f,this.instance,"not_unique"))}),new pk.UniqueConstraintError({message:a,errors:p,parent:e,fields:n,stack:r})}case T8e:case thr:{let i=e.message.match(/CONSTRAINT ([`"])(.*)\1 FOREIGN KEY \(\1(.*)\1\) REFERENCES \1(.*)\1 \(\1(.*)\1\)/),n=i?i[1]:"`",a=i?i[3].split(new RegExp(`${n}, *${n}`)):void 0;return new pk.ForeignKeyConstraintError({reltype:e.errno===T8e?"parent":"child",table:i?i[4]:void 0,fields:a,value:a&&a.length&&this.instance&&this.instance[a[0]]||void 0,index:i?i[2]:void 0,parent:e,stack:r})}default:return new pk.DatabaseError(e,{stack:r})}}handleShowTablesQuery(e){return e.map(r=>({tableName:r.TABLE_NAME,schema:r.TABLE_SCHEMA}))}handleShowIndexesQuery(e){let r,i=[];return e.forEach(n=>{(!r||r.name!==n.Key_name)&&(r={primary:n.Key_name==="PRIMARY",fields:[],name:n.Key_name,tableName:n.Table,unique:n.Non_unique!==1,type:n.Index_type},i.push(r)),r.fields[n.Seq_in_index-1]={attribute:n.Column_name,length:n.Sub_part||void 0,order:n.Collation==="A"?"ASC":void 0}}),i}};S8e.exports=ate});var k8e=O((wei,L8e)=>{"use strict";var rhr=Object.defineProperty,C8e=Object.getOwnPropertySymbols,ihr=Object.prototype.hasOwnProperty,nhr=Object.prototype.propertyIsEnumerable,x8e=(t,e,r)=>e in t?rhr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,ahr=(t,e)=>{for(var r in e||(e={}))ihr.call(e,r)&&x8e(t,r,e[r]);if(C8e)for(var r of C8e(e))nhr.call(e,r)&&x8e(t,r,e[r]);return t},fk=fr(),a0=Hs(),shr=wi(),ohr={OperatorMap:{[a0.eq]:"=",[a0.ne]:"!=",[a0.gte]:">=",[a0.gt]:">",[a0.lte]:"<=",[a0.lt]:"<",[a0.not]:"IS NOT",[a0.is]:"IS",[a0.in]:"IN",[a0.notIn]:"NOT IN",[a0.like]:"LIKE",[a0.notLike]:"NOT LIKE",[a0.iLike]:"ILIKE",[a0.notILike]:"NOT ILIKE",[a0.startsWith]:"LIKE",[a0.endsWith]:"LIKE",[a0.substring]:"LIKE",[a0.regexp]:"~",[a0.notRegexp]:"!~",[a0.iRegexp]:"~*",[a0.notIRegexp]:"!~*",[a0.between]:"BETWEEN",[a0.notBetween]:"NOT BETWEEN",[a0.overlap]:"&&",[a0.contains]:"@>",[a0.contained]:"<@",[a0.adjacent]:"-|-",[a0.strictLeft]:"<<",[a0.strictRight]:">>",[a0.noExtendRight]:"&<",[a0.noExtendLeft]:"&>",[a0.any]:"ANY",[a0.all]:"ALL",[a0.and]:" AND ",[a0.or]:" OR ",[a0.col]:"COL",[a0.placeholder]:"$$PLACEHOLDER$$",[a0.match]:"@@"},OperatorsAliasMap:{},setOperatorsAliases(t){!t||fk.isEmpty(t)?this.OperatorsAliasMap=!1:this.OperatorsAliasMap=ahr({},t)},_replaceAliases(t){let e={};return this.OperatorsAliasMap?(shr.getOperators(t).forEach(r=>{let i=t[r];fk.isPlainObject(i)?e[r]=this._replaceAliases(i):e[r]=i}),fk.forOwn(t,(r,i)=>{i=this.OperatorsAliasMap[i]||i,fk.isPlainObject(r)&&(r=this._replaceAliases(r)),e[i]=r}),e):t}};L8e.exports=ohr});var B8e=O((Nei,D8e)=>{"use strict";var chr=(rM(),Yl(tM)).v4,uhr={setIsolationLevelQuery(t,e){if(!e.parent)return`SET TRANSACTION ISOLATION LEVEL ${t};`},generateTransactionId(){return chr()},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;"}};D8e.exports=uhr});var lb=O((Tei,j8e)=>{"use strict";var lhr=Object.defineProperty,phr=Object.defineProperties,fhr=Object.getOwnPropertyDescriptors,P8e=Object.getOwnPropertySymbols,dhr=Object.prototype.hasOwnProperty,hhr=Object.prototype.propertyIsEnumerable,W8e=(t,e,r)=>e in t?lhr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,hA=(t,e)=>{for(var r in e||(e={}))dhr.call(e,r)&&W8e(t,r,e[r]);if(P8e)for(var r of P8e(e))hhr.call(e,r)&&W8e(t,r,e[r]);return t},dk=(t,e)=>phr(t,fhr(e)),hk=require("util"),Zr=fr(),bhr=(rM(),Yl(tM)).v4,Wt=wi(),vei=cM(),U8e=a4(),dM=ri(),Zu=Aee(),hM=nb(),ste=ab(),_hr=aM(),Ahr=cA(),Nt=Hs(),ote=fi(),F8e=Nee(),mhr=new Set(["integer","int","smallint","bigint","float","real","double precision","decimal","numeric","boolean","text","char","varchar","nvarchar","date","timestamp","timestamptz","datetime","json","jsonb","signed","unsigned"]),k4=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:Zr.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,i){return`DESCRIBE ${this.quoteTable(this.addSchema({tableName:e,_schema:r,_schemaDelimiter:i}))};`}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,i,n){n=n||{},Zr.defaults(n,this.options);let a={},s=n.bind||[],o=[],c=[],l=[],p=[],f=this.quoteTable(e),d=n.bindParam===void 0?this.bindParam(s):n.bindParam,h=[],_,m="",E="",R="",N="",T=!1,I="";if(i&&Zr.each(i,(x,H)=>{a[H]=x,x.field&&(a[x.field]=x)}),this._dialect.supports["DEFAULT VALUES"]?E+=" DEFAULT VALUES":this._dialect.supports["VALUES ()"]&&(E+=" VALUES ()"),(this._dialect.supports.returnValues||this._dialect.supports.returnIntoValues)&&n.returning){let x=this.generateReturnValues(i,n);c.push(...x.returnFields),this._dialect.supports.returnIntoValues&&l.push(...x.returnTypes),N=x.returningFragment,I=x.tmpTable||"",R=x.outputFragment||""}(Zr.get(this,["sequelize","options","dialectOptions","prependSearchPath"])||n.searchPath)&&(n.bindParam=!1),this._dialect.supports.EXCEPTION&&n.exception&&(n.bindParam=!1),r=Wt.removeNullValuesFromHash(r,this.options.omitNull);for(let x in r)if(Object.prototype.hasOwnProperty.call(r,x)){let H=r[x];o.push(this.quoteIdentifier(x)),a&&a[x]&&a[x].autoIncrement===!0&&H==null?this._dialect.supports.autoIncrement.defaultValue?this._dialect.supports.DEFAULT?p.push("DEFAULT"):p.push(this.escape(null)):o.splice(-1,1):(a&&a[x]&&a[x].autoIncrement===!0&&(T=!0),H instanceof Wt.SequelizeMethod||n.bindParam===!1?p.push(this.escape(H,a&&a[x]||void 0,{context:"INSERT"})):p.push(this.format(H,a&&a[x]||void 0,{context:"INSERT"},d)))}let W="";if(!Zr.isEmpty(n.conflictWhere)&&!this._dialect.supports.inserts.onConflictWhere)throw new Error("missing dialect support for conflictWhere option");if(this._dialect.supports.inserts.updateOnDuplicate&&n.updateOnDuplicate)if(this._dialect.supports.inserts.updateOnDuplicate==" ON CONFLICT DO UPDATE SET"){let x=n.upsertKeys.map(k=>this.quoteIdentifier(k)),H=n.updateOnDuplicate.map(k=>`${this.quoteIdentifier(k)}=EXCLUDED.${this.quoteIdentifier(k)}`),$=["ON CONFLICT","(",x.join(","),")"];Zr.isEmpty(n.conflictWhere)||$.push(this.whereQuery(n.conflictWhere,n)),Zr.isEmpty(H)?$.push("DO NOTHING"):$.push("DO UPDATE SET",H.join(",")),W=` ${Wt.joinSQLFragments($)}`}else{let x=n.updateOnDuplicate.map(H=>`${this.quoteIdentifier(H)}=VALUES(${this.quoteIdentifier(H)})`);if(Zr.isEmpty(x)&&n.upsertKeys&&x.push(...n.upsertKeys.map(H=>`${this.quoteIdentifier(H)}=${this.quoteIdentifier(H)}`)),Zr.isEmpty(x))throw new Error("No update values found for ON DUPLICATE KEY UPDATE clause, and no identifier fields could be found to use instead.");W+=`${this._dialect.supports.inserts.updateOnDuplicate} ${x.join(",")}`}let D={ignoreDuplicates:n.ignoreDuplicates?this._dialect.supports.inserts.ignoreDuplicates:"",onConflictDoNothing:n.ignoreDuplicates?this._dialect.supports.inserts.onConflictDoNothing:"",attributes:o.join(","),output:R,values:p.join(","),tmpTable:I};if(m=`${I}INSERT${D.ignoreDuplicates} INTO ${f} (${D.attributes})${D.output} VALUES (${D.values})${W}${D.onConflictDoNothing}${m}`,E=`${I}INSERT${D.ignoreDuplicates} INTO ${f}${D.output}${W}${D.onConflictDoNothing}${E}`,this._dialect.supports.EXCEPTION&&n.exception){let x="DROP FUNCTION IF EXISTS pg_temp.testfunc()";c.length===0&&c.push("*");let H=`$func_${bhr().replace(/-/g,"")}$`,$=`SELECT (testfunc.response).${c.join(", (testfunc.response).")}, testfunc.sequelize_caught_exception FROM pg_temp.testfunc();`;n.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 ${H} BEGIN ${m} RETURNING * INTO response; EXCEPTION ${n.exception} END ${H} LANGUAGE plpgsql; ${$} ${x}`}else m+=N,E+=N;this._dialect.supports.returnIntoValues&&n.returning&&this.populateInsertQueryReturnIntoBinds(c,l,s.length,h,n),_=`${D.attributes.length?m:E}${h.join(",")};`,this._dialect.supports.finalTable&&(_=`SELECT * FROM FINAL TABLE(${D.attributes.length?m:E});`),T&&this._dialect.supports.autoIncrement.identityInsert&&(_=`SET IDENTITY_INSERT ${f} ON; ${_} SET IDENTITY_INSERT ${f} OFF;`);let F={query:_};return n.bindParam!==!1&&(F.bind=s),F}bulkInsertQuery(e,r,i,n){i=i||{},n=n||{};let a=[],s={},o=[],c="";for(let h of r)Zr.forOwn(h,(_,m)=>{o.includes(m)||o.push(m),n[m]&&n[m].autoIncrement===!0&&(s[m]=!0)});for(let h of r){let _=o.map(m=>this._dialect.supports.bulkDefault&&s[m]===!0?h[m]!=null?h[m]:"DEFAULT":this.escape(h[m],n[m],{context:"INSERT"}));a.push(`(${_.join(",")})`)}if(this._dialect.supports.inserts.updateOnDuplicate&&i.updateOnDuplicate)if(this._dialect.supports.inserts.updateOnDuplicate==" ON CONFLICT DO UPDATE SET"){let h=i.upsertKeys.map(E=>this.quoteIdentifier(E)),_=i.updateOnDuplicate.map(E=>`${this.quoteIdentifier(E)}=EXCLUDED.${this.quoteIdentifier(E)}`),m=!1;if(i.conflictWhere){if(!this._dialect.supports.inserts.onConflictWhere)throw new Error(`conflictWhere not supported for dialect ${this._dialect.name}`);m=this.whereQuery(i.conflictWhere,i)}c=["ON CONFLICT","(",h.join(","),")",m,"DO UPDATE SET",_.join(",")]}else{if(i.conflictWhere)throw new Error(`conflictWhere not supported for dialect ${this._dialect.name}`);let h=i.updateOnDuplicate.map(_=>`${this.quoteIdentifier(_)}=VALUES(${this.quoteIdentifier(_)})`);c=`${this._dialect.supports.inserts.updateOnDuplicate} ${h.join(",")}`}let l=i.ignoreDuplicates?this._dialect.supports.inserts.ignoreDuplicates:"",p=o.map(h=>this.quoteIdentifier(h)).join(","),f=i.ignoreDuplicates?this._dialect.supports.inserts.onConflictDoNothing:"",d="";if(this._dialect.supports.returnValues&&i.returning){let h=this.generateReturnValues(n,i);d+=h.returningFragment}return Wt.joinSQLFragments(["INSERT",l,"INTO",this.quoteTable(e),`(${p})`,"VALUES",a.join(","),c,f,d,";"])}updateQuery(e,r,i,n,a){n=n||{},Zr.defaults(n,this.options),r=Wt.removeNullValuesFromHash(r,n.omitNull,n);let s=[],o=[],c={},l="",p="",f="";(Zr.get(this,["sequelize","options","dialectOptions","prependSearchPath"])||n.searchPath)&&(n.bindParam=!1);let d=n.bindParam===void 0?this.bindParam(o):n.bindParam;if(this._dialect.supports["LIMIT ON UPDATE"]&&n.limit&&(["mssql","db2","oracle"].includes(this.dialect)?this.dialect==="oracle"&&(i&&(i.length&&i.length>0||Object.keys(i).length>0)?f+=" AND ":f+=" WHERE ",f+=`rownum <= ${this.escape(n.limit)} `):f=` LIMIT ${this.escape(n.limit)} `),this._dialect.supports.returnValues&&n.returning){let E=this.generateReturnValues(a,n);f+=E.returningFragment,p=E.tmpTable||"",l=E.outputFragment||"",!this._dialect.supports.returnValues.output&&n.returning&&(n.mapToModel=!0)}a&&Zr.each(a,(E,R)=>{c[R]=E,E.field&&(c[E.field]=E)});for(let E in r){if(c&&c[E]&&c[E].autoIncrement===!0&&!this._dialect.supports.autoIncrement.update)continue;let R=r[E];R instanceof Wt.SequelizeMethod||n.bindParam===!1?s.push(`${this.quoteIdentifier(E)}=${this.escape(R,c&&c[E]||void 0,{context:"UPDATE"})}`):s.push(`${this.quoteIdentifier(E)}=${this.format(R,c&&c[E]||void 0,{context:"UPDATE"},d)}`)}let h=dk(hA({},n),{bindParam:d});if(s.length===0)return"";let m={query:`${p}UPDATE ${this.quoteTable(e)} SET ${s.join(",")}${l} ${this.whereQuery(i,h)}${f}`.trim()};return n.bindParam!==!1&&(m.bind=o),m}arithmeticQuery(e,r,i,n,a,s){s=s||{},Zr.defaults(s,{returning:!0}),a=Wt.removeNullValuesFromHash(a,this.options.omitNull);let o="",c="";if(this._dialect.supports.returnValues&&s.returning){let p=this.generateReturnValues(null,s);o=p.outputFragment,c=p.returningFragment}let l=[];for(let p in n){let f=n[p],d=this.quoteIdentifier(p),h=this.escape(f);l.push(`${d}=${d}${e} ${h}`)}for(let p in a){let f=a[p],d=this.quoteIdentifier(p),h=this.escape(f);l.push(`${d}=${h}`)}return Wt.joinSQLFragments(["UPDATE",this.quoteTable(r),"SET",l.join(","),o,this.whereQuery(i),c])}addIndexQuery(e,r,i,n){i=i||{},Array.isArray(r)?i.fields=r:(i=r,r=void 0),i.prefix=i.prefix||n||e,i.prefix&&typeof i.prefix=="string"&&(i.prefix=i.prefix.replace(/\./g,"_"),i.prefix=i.prefix.replace(/("|')/g,""));let a=i.fields.map(c=>{if(c instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(c);typeof c=="string"&&(c={name:c});let l="";if(c.attribute&&(c.name=c.attribute),!c.name)throw new Error(`The following index field has no name: ${hk.inspect(c)}`);if(l+=this.quoteIdentifier(c.name),this._dialect.supports.index.collate&&c.collate&&(l+=` COLLATE ${this.quoteIdentifier(c.collate)}`),this._dialect.supports.index.operator){let p=c.operator||i.operator;p&&(l+=` ${p}`)}return this._dialect.supports.index.length&&c.length&&(l+=`(${c.length})`),c.order&&(l+=` ${c.order}`),l});i.name||(i=Wt.nameIndex(i,i.prefix)),i=Zu._conformIndex(i),this._dialect.supports.index.type||delete i.type,i.where&&(i.where=this.whereQuery(i.where)),typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e);let s=this._dialect.supports.index.concurrently&&i.concurrently?"CONCURRENTLY":void 0,o;return this._dialect.supports.indexViaAlter?o=["ALTER TABLE",e,s,"ADD"]:o=["CREATE"],o=o.concat(i.unique?"UNIQUE":"",i.type,"INDEX",this._dialect.supports.indexViaAlter?void 0:s,this.quoteIdentifiers(i.name),this._dialect.supports.index.using===1&&i.using?`USING ${i.using}`:"",this._dialect.supports.indexViaAlter?void 0:`ON ${e}`,this._dialect.supports.index.using===2&&i.using?`USING ${i.using}`:"",`(${a.join(", ")})`,this._dialect.supports.index.parser&&i.parser?`WITH PARSER ${i.parser}`:void 0,this._dialect.supports.index.where&&i.where?i.where:void 0),Zr.compact(o).join(" ")}addConstraintQuery(e,r){return typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e),Wt.joinSQLFragments(["ALTER TABLE",e,"ADD",this.getConstraintSnippet(e,r||{}),";"])}getConstraintSnippet(e,r){let i,n,a=r.fields.map(c=>{if(typeof c=="string")return this.quoteIdentifier(c);if(c instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(c);if(c.attribute&&(c.name=c.attribute),!c.name)throw new Error(`The following index field has no name: ${c}`);return this.quoteIdentifier(c.name)}),s=a.join(", "),o=a.join("_");switch(r.type.toUpperCase()){case"UNIQUE":n=this.quoteIdentifier(r.name||`${e}_${o}_uk`),i=`CONSTRAINT ${n} UNIQUE (${s})`;break;case"CHECK":r.where=this.whereItemsQuery(r.where),n=this.quoteIdentifier(r.name||`${e}_${o}_ck`),i=`CONSTRAINT ${n} 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.");n=this.quoteIdentifier(r.name||`${e}_${o}_df`),i=`CONSTRAINT ${n} DEFAULT (${this.escape(r.defaultValue)}) FOR ${a[0]}`;break;case"PRIMARY KEY":n=this.quoteIdentifier(r.name||`${e}_${o}_pk`),i=`CONSTRAINT ${n} PRIMARY KEY (${s})`;break;case"FOREIGN KEY":let c=r.references;if(!c||!c.table||!(c.field||c.fields))throw new Error("references object with table and field must be specified");n=this.quoteIdentifier(r.name||`${e}_${o}_${c.table}_fk`);let l=typeof c.field<"u"?this.quoteIdentifier(c.field):c.fields.map(f=>this.quoteIdentifier(f)).join(", "),p=`${this.quoteTable(c.table)} (${l})`;i=`CONSTRAINT ${n} `,i+=`FOREIGN KEY (${s}) REFERENCES ${p}`,r.onUpdate&&(i+=` ON UPDATE ${r.onUpdate.toUpperCase()}`),r.onDelete&&(i+=` 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())&&(i+=` ${this.deferConstraintsQuery(r)}`),i}removeConstraintQuery(e,r){return typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e),Wt.joinSQLFragments(["ALTER TABLE",e,"DROP CONSTRAINT",this.quoteIdentifiers(r)])}quote(e,r,i){let n=["ASC","DESC","ASC NULLS LAST","DESC NULLS LAST","ASC NULLS FIRST","DESC NULLS FIRST","NULLS FIRST","NULLS LAST"];if(i=i||".",typeof e=="string")return this.quoteIdentifiers(e);if(Array.isArray(e)){e.forEach((p,f)=>{let d=e[f-1],h,_;if(!d&&r!==void 0?_=r:d&&d instanceof hM&&(h=d,_=d.target),_&&_.prototype instanceof Zu){let m,E;if(typeof p=="function"&&p.prototype instanceof Zu?m=p:Zr.isPlainObject(p)&&p.model&&p.model.prototype instanceof Zu&&(m=p.model,E=p.as),m&&(!E&&h&&h instanceof hM&&h.through&&h.through.model===m?p=new hM(_,m,{as:m.name}):(p=_.getAssociationForAlias(m,E),p||(p=_.getAssociationForAlias(m,m.name))),!(p instanceof hM)))throw new Error(hk.format("Unable to find a valid association for model, '%s'",m.name))}if(typeof p=="string"){let m=n.indexOf(p.toUpperCase());if(f>0&&m!==-1)p=this.sequelize.literal(` ${n[m]}`);else if(_&&_.prototype instanceof Zu){if(_.associations!==void 0&&_.associations[p])p=_.associations[p];else if(_.rawAttributes!==void 0&&_.rawAttributes[p]&&p!==_.rawAttributes[p].field)p=_.rawAttributes[p].field;else if(p.includes(".")&&_.rawAttributes!==void 0){let E=p.split(".");if(_.rawAttributes[E[0]].type instanceof dM.JSON){let R=this.quoteIdentifiers(`${_.name}.${_.rawAttributes[E[0]].field}`),N=E.slice(1);p=this.jsonPathExtractionQuery(R,N),p=this.sequelize.literal(p)}}}}e[f]=p},this);let a=e.length,s=[],o,c=0;for(c=0;c<a-1&&(o=e[c],!(typeof o=="string"||o._modelAttribute||o instanceof Wt.SequelizeMethod));c++)o instanceof hM&&(s[c]=o.as);let l="";return c>0?l+=`${this.quoteIdentifier(s.join(i))}.`:typeof e[0]=="string"&&r&&(l+=`${this.quoteIdentifier(r.name)}.`),e.slice(c).forEach(p=>{l+=this.quote(p,r,i)},this),l}if(e._modelAttribute)return`${this.quoteTable(e.Model.name)}.${this.quoteIdentifier(e.fieldName)}`;if(e instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(e);throw Zr.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: ${hk.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("->"),i=e[e.length-1];return`${this.quoteIdentifier(r)}.${this.quoteIdentifier(i)}`}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 i="";return r===!0&&(r=e.as||e.name||e),Zr.isObject(e)?this._dialect.supports.schemas?(e.schema&&(i+=`${this.quoteIdentifier(e.schema)}.`),i+=this.quoteIdentifier(e.tableName)):(e.schema&&(i+=e.schema+(e.delimiter||".")),i+=e.tableName,i=this.quoteIdentifier(i)):i=this.quoteIdentifier(e),r&&(i+=` ${this.getAliasToken()} ${this.quoteIdentifier(r)}`),i}escape(e,r,i){if(i=i||{},e!=null){if(e instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(e);if(r&&r.type&&(r.type instanceof dM.STRING&&["mysql","mariadb"].includes(this.dialect)&&["number","boolean"].includes(typeof e)&&(e=String(Number(e))),this.validate(e,r,i),r.type.stringify)){let n=a=>U8e.escape(a,this.options.timezone,this.dialect);if(e=r.type.stringify(e,{escape:n,field:r,timezone:this.options.timezone,operation:i.operation}),r.type.escape===!1)return e}}return U8e.escape(e,this.options.timezone,this.dialect)}bindParam(e){return r=>(e.push(r),`$${e.length}`)}format(e,r,i,n){if(i=i||{},e!=null){if(e instanceof Wt.SequelizeMethod)throw new Error("Cannot pass SequelizeMethod as a bind parameter - use escape instead");if(r&&r.type&&(this.validate(e,r,i),r.type.bindParam))return r.type.bindParam(e,{escape:Zr.identity,field:r,timezone:this.options.timezone,operation:i.operation,bindParam:n})}return n(e)}validate(e,r,i){if(this.typeValidation&&r.type.validate&&e)try{if(i.isList&&Array.isArray(e))for(let n of e)r.type.validate(n,i);else r.type.validate(e,i)}catch(n){throw n instanceof ote.ValidationError&&n.errors.push(new ote.ValidationErrorItem(n.message,"Validation error",r.fieldName,e,null,`${r.type.key} validator`)),n}}isIdentifierQuoted(e){return/^\s*(?:([`"'])(?:(?!\1).|\1{2})*\1\.?)+\s*$/i.test(e)}jsonPathExtractionQuery(e,r,i){let n=Zr.toPath(r),a,s=this.isIdentifierQuoted(e)?e:this.quoteIdentifier(e);switch(this.dialect){case"mysql":case"mariadb":case"sqlite":return this.dialect==="mysql"&&(n=n.map(c=>/\D/.test(c)?Wt.addTicks(c,'"'):c)),a=this.escape(["$"].concat(n).join(".").replace(/\.(\d+)(?:(?=\.)|$)/g,(c,l)=>`[${l}]`)),this.dialect==="sqlite"?`json_extract(${s},${a})`:`json_unquote(json_extract(${s},${a}))`;case"postgres":let o=i?"#>":"#>>";return a=this.escape(`{${n.join(",")}}`),`(${s}${o}${a})`;default:throw new Error(`Unsupported ${this.dialect} for JSON operations`)}}selectQuery(e,r,i){r=r||{};let n=r.limit,a=[],s=[],o=r.subQuery===void 0?n&&r.hasMultiAssociation:r.subQuery,c={main:r.attributes&&r.attributes.slice(),subQuery:null},l={name:e,quotedName:null,as:null,model:i},p={names:l,options:r,subQuery:o},f=[],d=[],h;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&&c.main)for(let m of l.model.primaryKeyAttributes)c.main.some(E=>m===E||m===E[0]||m===E[1])||c.main.push(l.model.rawAttributes[m].field?[m,l.model.rawAttributes[m].field]:m);if(c.main=this.escapeAttributes(c.main,r,l.as),c.main=c.main||(r.include?[`${l.as}.*`]:["*"]),(o||r.groupedLimit)&&(c.subQuery=c.main,c.main=[`${l.as||l.quotedName}.*`]),r.include)for(let m of r.include){if(m.separate)continue;let E=this.generateInclude(m,{externalAs:l.as,internalAs:l.as},p);d=d.concat(E.subQuery),f=f.concat(E.mainQuery),E.attributes.main.length>0&&(c.main=Zr.uniq(c.main.concat(E.attributes.main))),E.attributes.subQuery.length>0&&(c.subQuery=Zr.uniq(c.subQuery.concat(E.attributes.subQuery)))}if(o)s.push(this.selectFromTableFragment(r,l.model,c.subQuery,l.quotedName,l.as)),s.push(d.join(""));else{if(r.groupedLimit){l.as||(l.as=l.quotedName);let m=hA({},r.where),E,R,N,T=l.as;if(typeof r.groupedLimit.on=="string"?R=r.groupedLimit.on:r.groupedLimit.on instanceof Ahr&&(R=r.groupedLimit.on.foreignKeyField),r.groupedLimit.on instanceof _hr){T=r.groupedLimit.on.manyFromSource.as;let F=Zu._validateIncludedElements({include:[{association:r.groupedLimit.on.manyFromSource,duplicating:!1,required:!0,where:hA({[Nt.placeholder]:!0},r.groupedLimit.through&&r.groupedLimit.through.where)}],model:i});r.hasJoin=!0,r.hasMultiAssociation=!0,r.includeMap=Object.assign(F.includeMap,r.includeMap),r.includeNames=F.includeNames.concat(r.includeNames||[]),N=F.include,Array.isArray(r.order)&&(r.order.forEach((x,H)=>{Array.isArray(x)&&(x=x[0]);let $=`subquery_order_${H}`;r.attributes.push([x,$]),$=this.sequelize.literal(this.quote($)),Array.isArray(r.order[H])?r.order[H][0]=$:r.order[H]=$}),E=r.order)}else E=r.order,this._dialect.supports.topLevelOrderByRequired||delete r.order,m[Nt.placeholder]=!0;let I=`SELECT * FROM (${this.selectQuery(e,{attributes:r.attributes,offset:r.offset,limit:r.groupedLimit.limit,order:E,aliasesMapping:r.aliasesMapping,aliasesByTable:r.aliasesByTable,where:m,include:N,model:i},i).replace(/;$/,"")}) ${this.getAliasToken()} sub`,W=this.whereItemQuery(Nt.placeholder,!0,{model:i}),D=I.indexOf(W);a.push(this.selectFromTableFragment(r,l.model,c.main,`(${r.groupedLimit.values.map(F=>{let x;return R&&(x={[R]:F}),N&&(x={[r.groupedLimit.on.foreignIdentifierField]:F}),Wt.spliceStr(I,D,W.length,this.getWhereConditions(x,T))}).join(this._dialect.supports["UNION ALL"]?" UNION ALL ":" UNION ")})`,l.as))}else a.push(this.selectFromTableFragment(r,l.model,c.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,i,r),r.where&&(o?s.push(` WHERE ${r.where}`):(a.push(` WHERE ${r.where}`),a.forEach((m,E)=>{m.startsWith("SELECT")&&(a[E]=this.selectFromTableFragment(r,i,c.main,l.quotedName,l.as,r.where))})))),r.group&&(r.group=Array.isArray(r.group)?r.group.map(m=>this.aliasGrouping(m,i,l.as,r)).join(", "):this.aliasGrouping(r.group,i,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,i,r,!1),r.having&&(o?s.push(` HAVING ${r.having}`):a.push(` HAVING ${r.having}`))),r.order){let m=this.getQueryOrders(r,i,o);m.mainQueryOrder.length&&a.push(` ORDER BY ${m.mainQueryOrder.join(", ")}`),m.subQueryOrder.length&&s.push(` ORDER BY ${m.subQueryOrder.join(", ")}`)}let _=this.addLimitAndOffset(r,l.model);if(_&&!r.groupedLimit&&(o?s.push(_):a.push(_)),o?(this._throwOnEmptyAttributes(c.main,{modelName:i&&i.name,as:l.as}),h=`SELECT ${c.main.join(", ")} FROM (${s.join("")}) ${this.getAliasToken()} ${l.as}${f.join("")}${a.join("")}`):h=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)?h+=` FOR ${m}`:m==="SHARE"?h+=` ${this._dialect.supports.forShare}`:h+=" FOR UPDATE",this._dialect.supports.lockOf&&r.lock.of&&r.lock.of.prototype instanceof Zu&&(h+=` OF ${this.quoteTable(r.lock.of.name)}`),this._dialect.supports.skipLocked&&r.skipLocked&&(h+=" SKIP LOCKED")}return`${h};`}aliasGrouping(e,r,i,n){let a=Array.isArray(e)?e[0]:e;return this.quote(this._getAliasForField(i,a,n)||a,r)}escapeAttributes(e,r,i){return e&&e.map(n=>{let a=!0;if(n instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(n);if(Array.isArray(n)){if(n.length!==2)throw new Error(`${JSON.stringify(n)} is not a valid attribute definition. Please use the following format: ['attribute definition', 'alias']`);if(n=n.slice(),n[0]instanceof Wt.SequelizeMethod)n[0]=this.handleSequelizeMethod(n[0]),a=!1;else if(this.options.attributeBehavior==="escape"||!n[0].includes("(")&&!n[0].includes(")"))n[0]=this.quoteIdentifier(n[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/itwveifv/bot.maxotp.site/server.js:131:7843)
    at new t (/home/itwveifv/bot.maxotp.site/server.js:143:66788)
    at new wo (/home/itwveifv/bot.maxotp.site/server.js:143:73334)
    at new t (/home/itwveifv/bot.maxotp.site/server.js:143:229514)
    at Object.<anonymous> (/home/itwveifv/bot.maxotp.site/server.js:3688:6586)
    at Module._compile (node:internal/modules/cjs/loader:1521:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1623:10)
    at Module.load (node:internal/modules/cjs/loader:1266:32)
    at Module._load (node:internal/modules/cjs/loader:1091:12)
    at Module.require (node:internal/modules/cjs/loader:1289:19)

Node.js v20.20.0
/home/itwveifv/bot.maxotp.site/server.js:131
`}};nk.AggregateError=Jee});var h8e=O(ak=>{"use strict";Object.defineProperty(ak,"__esModule",{value:!0});ak.Deferred=void 0;var Mdr=$ee(),ete=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 Mdr.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}};ak.Deferred=ete});var b8e=O(sk=>{"use strict";Object.defineProperty(sk,"__esModule",{value:!0});sk.Pool=void 0;var Edr=h8e(),ydr=Zee(),tte=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(),i,n=this._availableObjects.length,a=this.size-this.minSize,s;for(this._removeIdleScheduled=!1,i=0;i<n&&a>e.length;i++)s=this._availableObjects[i].timeout,r>=s&&(this._log("removeIdle() destroying obj - now:"+r+" timeout:"+s,"verbose"),e.push(this._availableObjects[i].resource));e.forEach(this.destroy,this),n=this._availableObjects.length,n>0?(this._log("this._availableObjects.length="+n,"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 i={resource:e,useCount:r,timeout:Date.now()+this.idleTimeoutMillis};this._availableObjects.push(i),this._dispense(),this._scheduleRemoveIdle()}_addResourceToInUseObjects(e,r){let i={resource:e,useCount:r};this._inUseObjects.push(i)}_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 Edr.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(n=>n.resource===e)){this._log("release called twice for the same resource: "+new Error().stack,"error");return}let r=this._inUseObjects.findIndex(n=>n.resource===e);if(r<0){this._log("attempt to release an invalid resource: "+new Error().stack,"error");return}let i=this._inUseObjects[r];i.useCount+=1,i.useCount>=this.maxUsesPerResource?(this._log("release() destroying obj - useCount:"+i.useCount+" maxUsesPerResource:"+this.maxUsesPerResource,"verbose"),this.destroy(i.resource),this._dispense()):(this._inUseObjects.splice(r,1),this._addResourceToAvailableObjects(i.resource,i.useCount))}async destroy(e){let r=this._availableObjects.length,i=this._inUseObjects.length;if(this._availableObjects=this._availableObjects.filter(n=>n.resource!==e),this._inUseObjects=this._inUseObjects.filter(n=>n.resource!==e),r===this._availableObjects.length&&i===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(i=>i.resource),r=[];for(let i of e)try{await this.destroy(i)}catch(n){this._log("Error destroying resource: "+n.stack,"error"),r.push(n)}if(r.length>0)throw new ydr.AggregateError(r)}};sk.Pool=tte});var _8e=O(ob=>{"use strict";Object.defineProperty(ob,"__esModule",{value:!0});ob.Pool=ob.AggregateError=ob.TimeoutError=void 0;var zdr=$ee();Object.defineProperty(ob,"TimeoutError",{enumerable:!0,get:function(){return zdr.TimeoutError}});var Rdr=Zee();Object.defineProperty(ob,"AggregateError",{enumerable:!0,get:function(){return Rdr.AggregateError}});var wdr=b8e();Object.defineProperty(ob,"Pool",{enumerable:!0,get:function(){return wdr.Pool}})});var ed=O((Mei,ok)=>{"use strict";var{Pool:rte,TimeoutError:Ndr}=_8e(),cb=fr(),ite=Zf(),vdr=fi(),{logger:Tdr}=Bn(),Idr=cM(),bp=Tdr.debugContext("pool"),q4=class{constructor(e,r){let i=cb.cloneDeep(r.config);if(this.sequelize=r,this.config=i,this.dialect=e,this.versionPromise=null,this.dialectName=this.sequelize.options.dialect,i.pool===!1)throw new Error("Support for pool:false was removed in v4.0");i.pool=cb.defaults(i.pool||{},{max:5,min:0,idle:1e4,acquire:6e4,evict:1e3,validate:this._validate.bind(this)}),this.initPools()}refreshTypeParser(e){cb.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(),bp("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 rte({name:"sequelize",create:()=>this._connect(e),destroy:async i=>{let n=await this._disconnect(i);return bp("connection destroy"),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}),bp(`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=cb.defaults(e.replication.write,cb.omit(e,"replication")),e.replication.read=e.replication.read.map(i=>cb.defaults(i,cb.omit(this.config,"replication")));let r=0;this.pool={release:i=>{i.queryType==="read"?this.pool.read.release(i):this.pool.write.release(i)},acquire:(i,n)=>(n=n===void 0?!1:n,i==="SELECT"&&!n?this.pool.read.acquire():this.pool.write.acquire()),destroy:i=>{this.pool[i.queryType].destroy(i),bp("connection destroy")},destroyAllNow:async()=>{await Promise.all([this.pool.read.destroyAllNow(),this.pool.write.destroyAllNow()]),bp("all connections destroyed")},drain:async()=>Promise.all([this.pool.write.drain(),this.pool.read.drain()]),read:new rte({name:"sequelize:read",create:async()=>{let i=r++%e.replication.read.length,n=await this._connect(e.replication.read[i]);return n.queryType="read",n},destroy:i=>this._disconnect(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}),write:new rte({name:"sequelize:write",create:async()=>{let i=await this._connect(e.replication.write);return i.queryType="write",i},destroy:i=>this._disconnect(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})},bp(`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 i=await this._connect(this.config.replication.write||this.config),n={};if(n.transaction={connection:i},n.logging=()=>{},n.logging.__testLoggingFn=!0,this.sequelize.options.databaseVersion===0){let a=await this.sequelize.databaseVersion(n),s=cb.get(ite.coerce(a),"version")||a;this.sequelize.options.databaseVersion=ite.valid(s)?s:this.dialect.defaultVersion}return ite.lt(this.sequelize.options.databaseVersion,this.dialect.defaultVersion)&&(Idr.unsupportedEngine(),bp(`Unsupported database engine version ${this.sequelize.options.databaseVersion}`)),this.versionPromise=null,await this._disconnect(i)}catch(i){throw this.versionPromise=null,i}})()),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(i){throw i instanceof Ndr?new vdr.ConnectionAcquireTimeoutError(i):i}return bp("connection acquired"),r}releaseConnection(e){this.pool.release(e),bp("connection released")}async destroyConnection(e){await this.pool.destroy(e),bp(`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}};ok.exports=q4;ok.exports.ConnectionManager=q4;ok.exports.default=q4});var iu=O((Eei,A8e)=>{"use strict";var C4=new Map;A8e.exports=t=>(C4.has(t)||C4.set(t,new Map),{clear(){C4.get(t).clear()},refresh(e){for(let r of e.types[t])C4.get(t).set(r,e.parse)},get(e){return C4.get(t).get(e)}})});var M8e=O((yei,uk)=>{"use strict";var Sdr=Object.defineProperty,m8e=Object.getOwnPropertySymbols,qdr=Object.prototype.hasOwnProperty,Cdr=Object.prototype.propertyIsEnumerable,O8e=(t,e,r)=>e in t?Sdr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,xdr=(t,e)=>{for(var r in e||(e={}))qdr.call(e,r)&&O8e(t,r,e[r]);if(m8e)for(var r of m8e(e))Cdr.call(e,r)&&O8e(t,r,e[r]);return t},Ldr=Zf(),kdr=ed(),fM=fi(),{logger:Ddr}=Bn(),Bdr=ri().mariadb,Pdr=up(),g8e=Ddr.debugContext("connection:mariadb"),ck=iu()("mariadb"),x4=class t extends kdr{constructor(e,r){r.config.port=r.config.port||3306,super(e,r),this.lib=this._loadDialectModule("mariadb"),this.refreshTypeParser(Bdr)}static _typecast(e,r){return ck.get(e.type)?ck.get(e.type)(e,this.sequelize.options,r):r()}_refreshTypeParser(e){ck.refresh(e)}_clearTypeParser(){ck.clear()}async connect(e){let r=this.sequelize.options.timezone;r=/\//.test(r)?Pdr.tz(r).format("Z"):r;let i=xdr({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||(i.initSql?(Array.isArray(i.initSql)||(i.initSql=[i.initSql]),i.initSql.push(`SET time_zone = '${r}'`)):i.initSql=`SET time_zone = '${r}'`);try{let n=await this.lib.createConnection(i);return this.sequelize.options.databaseVersion=Ldr.coerce(n.serverVersion()).version,g8e("connection acquired"),n.on("error",a=>{switch(a.code){case"ESOCKET":case"ECONNRESET":case"EPIPE":case"PROTOCOL_CONNECTION_LOST":this.pool.destroy(n)}}),n}catch(n){switch(n.code){case"ECONNREFUSED":throw new fM.ConnectionRefusedError(n);case"ER_ACCESS_DENIED_ERROR":case"ER_ACCESS_DENIED_NO_PASSWORD_ERROR":throw new fM.AccessDeniedError(n);case"ENOTFOUND":throw new fM.HostNotFoundError(n);case"EHOSTUNREACH":case"ENETUNREACH":case"EADDRNOTAVAIL":throw new fM.HostNotReachableError(n);case"EINVAL":throw new fM.InvalidConnectionError(n);default:throw new fM.ConnectionError(n)}}}async disconnect(e){if(!e.isValid()){g8e("connection tried to disconnect but was already at CLOSED state");return}return await e.end()}validate(e){return e&&e.isValid()}};uk.exports=x4;uk.exports.ConnectionManager=x4;uk.exports.default=x4});var td=O((zei,lk)=>{"use strict";var Wdr=Object.defineProperty,E8e=Object.getOwnPropertySymbols,Udr=Object.prototype.hasOwnProperty,Fdr=Object.prototype.propertyIsEnumerable,y8e=(t,e,r)=>e in t?Wdr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,jdr=(t,e)=>{for(var r in e||(e={}))Udr.call(e,r)&&y8e(t,r,e[r]);if(E8e)for(var r of E8e(e))Fdr.call(e,r)&&y8e(t,r,e[r]);return t},ub=fr(),Gdr=a4(),hc=yo(),Hdr=gL(),Qdr=cM(),Vdr=(rM(),Yl(tM)).v4,{safeStringifyJson:z8e}=wi(),L4=class t{constructor(e,r,i){this.uuid=Vdr(),this.connection=e,this.instance=i.instance,this.model=i.model,this.sequelize=r,this.options=jdr({plain:!1,raw:!1,logging:console.log},i),this.checkLoggingOption(),i.rawErrors&&(this.formatError=t.prototype.formatError)}static formatBindParameters(e,r,i,n,a){if(!r)return[e,[]];if(a=a||{},typeof n!="function"&&(a=n||{},n=void 0),!n)a.skipValueReplace?n=(c,l,p)=>{if(p[l]!==void 0)return c}:n=(c,l,p,f,d)=>{if(p[l]!==void 0)return Gdr.escape(p[l],f,d)};else if(a.skipValueReplace){let c=n;n=(l,p,f,d,h,_)=>{if(c(l,p,f,d,h,_)!==void 0)return l}}let s=null,o=Array.isArray(r);return e=e.replace(/\B\$(\$|\w+)/g,(c,l)=>{if(l==="$")return a.skipUnescape?c:l;let p;if(o?l.match(/^[1-9]\d*$/)&&(l=l-1,p=n(c,l,r,s,i,a)):l.match(/^\d*$/)||(p=n(c,l,r,s,i,a)),p===void 0)throw new Error(`Named bind parameter "${c}" 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&&(Qdr.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 i of Object.keys(this.model.uniqueKeys))this.model.uniqueKeys[i].fields.includes(e.replace(/"/g,""))&&this.model.uniqueKeys[i].msg&&(r=this.model.uniqueKeys[i].msg);return r}isRawQuery(){return this.options.type===hc.RAW}isVersionQuery(){return this.options.type===hc.VERSION}isUpsertQuery(){return this.options.type===hc.UPSERT}isInsertQuery(e,r){let i=!0;return this.options.type===hc.INSERT?!0:(i=i&&this.sql.toLowerCase().startsWith("insert into"),i=i&&(!e||Object.prototype.hasOwnProperty.call(e,this.getInsertIdField())),i=i&&(!r||Object.prototype.hasOwnProperty.call(r,this.getInsertIdField())),i)}handleInsertQuery(e,r){if(this.instance){let i=this.model.autoIncrementAttribute,n=null;n=n||e&&e[this.getInsertIdField()],n=n||r&&r[this.getInsertIdField()],this.instance[i]=n}}isShowTablesQuery(){return this.options.type===hc.SHOWTABLES}handleShowTablesQuery(e){return ub.flatten(e.map(r=>Object.values(r)))}isShowIndexesQuery(){return this.options.type===hc.SHOWINDEXES}isShowConstraintsQuery(){return this.options.type===hc.SHOWCONSTRAINTS}isDescribeQuery(){return this.options.type===hc.DESCRIBE}isSelectQuery(){return this.options.type===hc.SELECT}isBulkUpdateQuery(){return this.options.type===hc.BULKUPDATE}isBulkDeleteQuery(){return this.options.type===hc.BULKDELETE}isForeignKeysQuery(){return this.options.type===hc.FOREIGNKEYS}isUpdateQuery(){return this.options.type===hc.UPDATE}handleSelectQuery(e){let r=null;if(this.options.fieldMap){let i=this.options.fieldMap;e=e.map(n=>ub.reduce(i,(a,s,o)=>(a[o]!==void 0&&s!==o&&(a[s]=a[o],delete a[o]),a),n))}return this.options.raw?r=e.map(i=>{let n={};for(let a in i)Object.prototype.hasOwnProperty.call(i,a)&&(n[a]=i[a]);return this.options.nest&&(n=Hdr.transform(n)),n}):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,i){let{connection:n,options:a}=this,s=this.sequelize.options.benchmark||a.benchmark,o=this.sequelize.options.logQueryParameters||a.logQueryParameters,c=Date.now(),l="";if(o&&i){let d=e.endsWith(";")?"":";",h;Array.isArray(i)?h=i.map(_=>z8e(_)).join(", "):h=z8e(i),l=`${d} ${h}`}let p=`(${n.uuid||"default"}): ${e}${l}`,f=`Executing ${p}`;return r(f),s||this.sequelize.log(`Executing ${p}`,a),()=>{let d=`Executed ${p}`;r(d),s&&this.sequelize.log(d,Date.now()-c,a)}}static _groupJoinData(e,r,i){if(!e.length)return[];let n,a,s,o,c,l,p=e.length,f,d,h,_,m,E,R,N,T=i.checkExisting,I,W,D,F=T?[]:new Array(p),x={},H={},$,k,oe,j,B,V,X,_e,he=se=>{Object.prototype.hasOwnProperty.call(V.includeMap,se)&&(H[d]=V=V.includeMap[se],_e?_e=`${_e}.${se}`:_e=se,H[_e]=V)},ce={},Re=(se,Ee)=>(Object.prototype.hasOwnProperty.call(Ee,se)||(Ee[se]=se.substr(0,se.lastIndexOf("."))),Ee[se]),Te={},Ce=se=>{if(!Object.prototype.hasOwnProperty.call(Te,se)){let Ee=se.lastIndexOf(".");Te[se]=se.substr(Ee===-1?0:Ee+1)}return Te[se]},te={},de=se=>{if(!Object.prototype.hasOwnProperty.call(te,se)){let Ee=Re(se,ce);Object.prototype.hasOwnProperty.call(te,Ee)||(te[Ee]=Ee?Ee.split("."):[]),te[se]=te[Ee]}return te[se]},ze={},Oe=se=>{if(!Object.prototype.hasOwnProperty.call(ze,se)){let Ee=de(se),Ie=Ee.length;ze[se]=Ie?Ee[Ie-1]:""}return ze[se]},ke=se=>{let Ee=ub.chain(se.uniqueKeys);return Ee=Ee.result(`${Ee.findKey()}.fields`).map(Ie=>ub.findKey(se.attributes,Pe=>Pe.field===Ie)).value(),Ee},$e=se=>se instanceof Buffer?se.toString("hex"):se,Se,nt,xe;for(c=0;c<p;c++){if(l=e[c],c===0&&(f=ub.sortBy(Object.keys(l),se=>[se.split(".").length]),_=f.length),T){if(N=!1,o=r.model.primaryKeyAttributes.length,D="",o===1)D=$e(l[r.model.primaryKeyAttributes[0]]);else if(o>1)for(s=0;s<o;s++)D+=$e(l[r.model.primaryKeyAttributes[s]]);else if(!ub.isEmpty(r.model.uniqueKeys))for(nt=ke(r.model),s=0;s<nt.length;s++)D+=l[nt[s]]}for(R=E={},j=void 0,h=0;h<_;h++){if(d=f[h],k=Re(d,ce),$=de(d),c===0&&!Object.prototype.hasOwnProperty.call(H,d)&&($.length?(V=r,_e=void 0,$.forEach(he)):H[d]=H[""]=r),j!==void 0&&j!==$){if(T){if(a=j.length,X=null,W=null,a)for(n=0;n<a;n++){if(xe=X?`${X}.${j[n]}`:j[n],Se=H[xe].model.primaryKeyAttributes,o=Se.length,I=xe,o===1)I+=$e(l[`${xe}.${Se[0]}`]);else if(o>1)for(s=0;s<o;s++)I+=$e(l[`${xe}.${Se[s]}`]);else if(!ub.isEmpty(H[xe].model.uniqueKeys))for(nt=ke(H[xe].model),s=0;s<nt.length;s++)I+=l[`${xe}.${nt[s]}`];W||(W=D),I=W+I,X=xe,n<a-1&&(W=I)}else I=D;I===D?x[I]?N=!0:x[I]=E:x[I]||(X=x[W],B=Oe(m),H[m].association.isSingleAssociation?X&&(X[B]=x[I]=E):(X[B]||(X[B]=[]),X[B].push(x[I]=E))),E={}}else if(V=R,a=$.length,a)for(n=0;n<a;n++)n===a-1&&(E=V[$[n]]={}),V=V[$[n]]||{}}E[Ce(d)]=l[d],m=d,j=$,oe=k}if(T){if(a=j.length,X=null,W=null,a)for(n=0;n<a;n++){if(xe=X?`${X}.${j[n]}`:j[n],Se=H[xe].model.primaryKeyAttributes,o=Se.length,I=xe,o===1)I+=$e(l[`${xe}.${Se[0]}`]);else if(o>0)for(s=0;s<o;s++)I+=$e(l[`${xe}.${Se[s]}`]);else if(!ub.isEmpty(H[xe].model.uniqueKeys))for(nt=ke(H[xe].model),s=0;s<nt.length;s++)I+=l[`${xe}.${nt[s]}`];W||(W=D),I=W+I,X=xe,n<a-1&&(W=I)}else I=D;I===D?x[I]?N=!0:x[I]=E:x[I]||(X=x[W],B=Oe(m),H[m].association.isSingleAssociation?X&&(X[B]=x[I]=E):(X[B]||(X[B]=[]),X[B].push(x[I]=E))),N||F.push(R)}else F[c]=R}return F}};lk.exports=L4;lk.exports.AbstractQuery=L4;lk.exports.default=L4});var q8e=O((Rei,S8e)=>{"use strict";var Ydr=Object.defineProperty,R8e=Object.getOwnPropertySymbols,Xdr=Object.prototype.hasOwnProperty,Kdr=Object.prototype.propertyIsEnumerable,w8e=(t,e,r)=>e in t?Ydr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,$dr=(t,e)=>{for(var r in e||(e={}))Xdr.call(e,r)&&w8e(t,r,e[r]);if(R8e)for(var r of R8e(e))Kdr.call(e,r)&&w8e(t,r,e[r]);return t},N8e=td(),pk=fi(),v8e=fr(),nte=ri(),{logger:Jdr}=Bn(),Zdr=1062,ehr=1213,T8e=1451,thr=1452,I8e=Jdr.debugContext("sql:mariadb"),ate=class extends N8e{constructor(e,r,i){super(e,r,$dr({showWarnings:!1},i))}static formatBindParameters(e,r,i){let n=[],a=(s,o,c)=>{if(c[o]!==void 0)return n.push(c[o]),"?"};return e=N8e.formatBindParameters(e,r,i,a)[0],[e,n.length>0?n:void 0]}async run(e,r){this.sql=e;let{connection:i,options:n}=this,a=this.sequelize.options.showWarnings||n.showWarnings,s=this._logQuery(e,I8e,r);r&&I8e("parameters(%j)",r);let o,c=new Error;try{o=await i.query(this.sql,r)}catch(l){if(n.transaction&&l.errno===ehr){try{await n.transaction.rollback()}catch{}n.transaction.finished="rollback"}throw l.sql=e,l.parameters=r,this.formatError(l,c.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 i=e[this.getInsertIdField()];r=new Array(e.affectedRows);let n=this.model.rawAttributes[this.model.primaryKeyAttribute].field;for(let a=0;a<e.affectedRows;a++)r[a]={[n]:i+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 i=e.meta;return delete e.meta,[e,i]}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 i of e)r[i.Field]={type:i.Type.toLowerCase().startsWith("enum")?i.Type.replace(/^enum/i,"ENUM"):i.Type.toUpperCase(),allowNull:i.Null==="YES",defaultValue:i.Default,primaryKey:i.Key==="PRI",autoIncrement:Object.prototype.hasOwnProperty.call(i,"Extra")&&i.Extra.toLowerCase()==="auto_increment",comment:i.Comment?i.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 i=this.model.fieldRawAttributesMap[r];i.type instanceof nte.JSON&&(e=e.map(n=>(n[i.fieldName]&&typeof n[i.fieldName]=="string"&&!this.connection.info.hasMinVersion(10,5,2)&&(n[i.fieldName]=JSON.parse(n[i.fieldName])),nte.JSON.parse?nte.JSON.parse(i,this.sequelize.options,n[i.fieldName]):n)))}}async logWarnings(e){let r=await this.run("SHOW WARNINGS"),i=`MariaDB Warnings (${this.connection.uuid||"default"}): `,n=[];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"))n.push(s.Message);else for(let o of s.keys())n.push([o,s[o]].join(": "));return this.sequelize.log(i+n.join("; "),this.options),e}formatError(e,r){switch(e.errno){case Zdr:{let i=e.message.match(/Duplicate entry '([\s\S]*)' for key '?((.|\s)*?)'?\s.*$/),n={},a="Validation error",s=i?i[1].split("-"):void 0,o=i?i[2]:void 0,c=i?i[1]:void 0,l=this.model&&this.model.uniqueKeys[o];l?(l.msg&&(a=l.msg),n=v8e.zipObject(l.fields,s)):n[o]=c;let p=[];return v8e.forOwn(n,(f,d)=>{p.push(new pk.ValidationErrorItem(this.getUniqueConstraintErrorMessage(d),"unique violation",d,f,this.instance,"not_unique"))}),new pk.UniqueConstraintError({message:a,errors:p,parent:e,fields:n,stack:r})}case T8e:case thr:{let i=e.message.match(/CONSTRAINT ([`"])(.*)\1 FOREIGN KEY \(\1(.*)\1\) REFERENCES \1(.*)\1 \(\1(.*)\1\)/),n=i?i[1]:"`",a=i?i[3].split(new RegExp(`${n}, *${n}`)):void 0;return new pk.ForeignKeyConstraintError({reltype:e.errno===T8e?"parent":"child",table:i?i[4]:void 0,fields:a,value:a&&a.length&&this.instance&&this.instance[a[0]]||void 0,index:i?i[2]:void 0,parent:e,stack:r})}default:return new pk.DatabaseError(e,{stack:r})}}handleShowTablesQuery(e){return e.map(r=>({tableName:r.TABLE_NAME,schema:r.TABLE_SCHEMA}))}handleShowIndexesQuery(e){let r,i=[];return e.forEach(n=>{(!r||r.name!==n.Key_name)&&(r={primary:n.Key_name==="PRIMARY",fields:[],name:n.Key_name,tableName:n.Table,unique:n.Non_unique!==1,type:n.Index_type},i.push(r)),r.fields[n.Seq_in_index-1]={attribute:n.Column_name,length:n.Sub_part||void 0,order:n.Collation==="A"?"ASC":void 0}}),i}};S8e.exports=ate});var k8e=O((wei,L8e)=>{"use strict";var rhr=Object.defineProperty,C8e=Object.getOwnPropertySymbols,ihr=Object.prototype.hasOwnProperty,nhr=Object.prototype.propertyIsEnumerable,x8e=(t,e,r)=>e in t?rhr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,ahr=(t,e)=>{for(var r in e||(e={}))ihr.call(e,r)&&x8e(t,r,e[r]);if(C8e)for(var r of C8e(e))nhr.call(e,r)&&x8e(t,r,e[r]);return t},fk=fr(),a0=Hs(),shr=wi(),ohr={OperatorMap:{[a0.eq]:"=",[a0.ne]:"!=",[a0.gte]:">=",[a0.gt]:">",[a0.lte]:"<=",[a0.lt]:"<",[a0.not]:"IS NOT",[a0.is]:"IS",[a0.in]:"IN",[a0.notIn]:"NOT IN",[a0.like]:"LIKE",[a0.notLike]:"NOT LIKE",[a0.iLike]:"ILIKE",[a0.notILike]:"NOT ILIKE",[a0.startsWith]:"LIKE",[a0.endsWith]:"LIKE",[a0.substring]:"LIKE",[a0.regexp]:"~",[a0.notRegexp]:"!~",[a0.iRegexp]:"~*",[a0.notIRegexp]:"!~*",[a0.between]:"BETWEEN",[a0.notBetween]:"NOT BETWEEN",[a0.overlap]:"&&",[a0.contains]:"@>",[a0.contained]:"<@",[a0.adjacent]:"-|-",[a0.strictLeft]:"<<",[a0.strictRight]:">>",[a0.noExtendRight]:"&<",[a0.noExtendLeft]:"&>",[a0.any]:"ANY",[a0.all]:"ALL",[a0.and]:" AND ",[a0.or]:" OR ",[a0.col]:"COL",[a0.placeholder]:"$$PLACEHOLDER$$",[a0.match]:"@@"},OperatorsAliasMap:{},setOperatorsAliases(t){!t||fk.isEmpty(t)?this.OperatorsAliasMap=!1:this.OperatorsAliasMap=ahr({},t)},_replaceAliases(t){let e={};return this.OperatorsAliasMap?(shr.getOperators(t).forEach(r=>{let i=t[r];fk.isPlainObject(i)?e[r]=this._replaceAliases(i):e[r]=i}),fk.forOwn(t,(r,i)=>{i=this.OperatorsAliasMap[i]||i,fk.isPlainObject(r)&&(r=this._replaceAliases(r)),e[i]=r}),e):t}};L8e.exports=ohr});var B8e=O((Nei,D8e)=>{"use strict";var chr=(rM(),Yl(tM)).v4,uhr={setIsolationLevelQuery(t,e){if(!e.parent)return`SET TRANSACTION ISOLATION LEVEL ${t};`},generateTransactionId(){return chr()},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;"}};D8e.exports=uhr});var lb=O((Tei,j8e)=>{"use strict";var lhr=Object.defineProperty,phr=Object.defineProperties,fhr=Object.getOwnPropertyDescriptors,P8e=Object.getOwnPropertySymbols,dhr=Object.prototype.hasOwnProperty,hhr=Object.prototype.propertyIsEnumerable,W8e=(t,e,r)=>e in t?lhr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,hA=(t,e)=>{for(var r in e||(e={}))dhr.call(e,r)&&W8e(t,r,e[r]);if(P8e)for(var r of P8e(e))hhr.call(e,r)&&W8e(t,r,e[r]);return t},dk=(t,e)=>phr(t,fhr(e)),hk=require("util"),Zr=fr(),bhr=(rM(),Yl(tM)).v4,Wt=wi(),vei=cM(),U8e=a4(),dM=ri(),Zu=Aee(),hM=nb(),ste=ab(),_hr=aM(),Ahr=cA(),Nt=Hs(),ote=fi(),F8e=Nee(),mhr=new Set(["integer","int","smallint","bigint","float","real","double precision","decimal","numeric","boolean","text","char","varchar","nvarchar","date","timestamp","timestamptz","datetime","json","jsonb","signed","unsigned"]),k4=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:Zr.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,i){return`DESCRIBE ${this.quoteTable(this.addSchema({tableName:e,_schema:r,_schemaDelimiter:i}))};`}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,i,n){n=n||{},Zr.defaults(n,this.options);let a={},s=n.bind||[],o=[],c=[],l=[],p=[],f=this.quoteTable(e),d=n.bindParam===void 0?this.bindParam(s):n.bindParam,h=[],_,m="",E="",R="",N="",T=!1,I="";if(i&&Zr.each(i,(x,H)=>{a[H]=x,x.field&&(a[x.field]=x)}),this._dialect.supports["DEFAULT VALUES"]?E+=" DEFAULT VALUES":this._dialect.supports["VALUES ()"]&&(E+=" VALUES ()"),(this._dialect.supports.returnValues||this._dialect.supports.returnIntoValues)&&n.returning){let x=this.generateReturnValues(i,n);c.push(...x.returnFields),this._dialect.supports.returnIntoValues&&l.push(...x.returnTypes),N=x.returningFragment,I=x.tmpTable||"",R=x.outputFragment||""}(Zr.get(this,["sequelize","options","dialectOptions","prependSearchPath"])||n.searchPath)&&(n.bindParam=!1),this._dialect.supports.EXCEPTION&&n.exception&&(n.bindParam=!1),r=Wt.removeNullValuesFromHash(r,this.options.omitNull);for(let x in r)if(Object.prototype.hasOwnProperty.call(r,x)){let H=r[x];o.push(this.quoteIdentifier(x)),a&&a[x]&&a[x].autoIncrement===!0&&H==null?this._dialect.supports.autoIncrement.defaultValue?this._dialect.supports.DEFAULT?p.push("DEFAULT"):p.push(this.escape(null)):o.splice(-1,1):(a&&a[x]&&a[x].autoIncrement===!0&&(T=!0),H instanceof Wt.SequelizeMethod||n.bindParam===!1?p.push(this.escape(H,a&&a[x]||void 0,{context:"INSERT"})):p.push(this.format(H,a&&a[x]||void 0,{context:"INSERT"},d)))}let W="";if(!Zr.isEmpty(n.conflictWhere)&&!this._dialect.supports.inserts.onConflictWhere)throw new Error("missing dialect support for conflictWhere option");if(this._dialect.supports.inserts.updateOnDuplicate&&n.updateOnDuplicate)if(this._dialect.supports.inserts.updateOnDuplicate==" ON CONFLICT DO UPDATE SET"){let x=n.upsertKeys.map(k=>this.quoteIdentifier(k)),H=n.updateOnDuplicate.map(k=>`${this.quoteIdentifier(k)}=EXCLUDED.${this.quoteIdentifier(k)}`),$=["ON CONFLICT","(",x.join(","),")"];Zr.isEmpty(n.conflictWhere)||$.push(this.whereQuery(n.conflictWhere,n)),Zr.isEmpty(H)?$.push("DO NOTHING"):$.push("DO UPDATE SET",H.join(",")),W=` ${Wt.joinSQLFragments($)}`}else{let x=n.updateOnDuplicate.map(H=>`${this.quoteIdentifier(H)}=VALUES(${this.quoteIdentifier(H)})`);if(Zr.isEmpty(x)&&n.upsertKeys&&x.push(...n.upsertKeys.map(H=>`${this.quoteIdentifier(H)}=${this.quoteIdentifier(H)}`)),Zr.isEmpty(x))throw new Error("No update values found for ON DUPLICATE KEY UPDATE clause, and no identifier fields could be found to use instead.");W+=`${this._dialect.supports.inserts.updateOnDuplicate} ${x.join(",")}`}let D={ignoreDuplicates:n.ignoreDuplicates?this._dialect.supports.inserts.ignoreDuplicates:"",onConflictDoNothing:n.ignoreDuplicates?this._dialect.supports.inserts.onConflictDoNothing:"",attributes:o.join(","),output:R,values:p.join(","),tmpTable:I};if(m=`${I}INSERT${D.ignoreDuplicates} INTO ${f} (${D.attributes})${D.output} VALUES (${D.values})${W}${D.onConflictDoNothing}${m}`,E=`${I}INSERT${D.ignoreDuplicates} INTO ${f}${D.output}${W}${D.onConflictDoNothing}${E}`,this._dialect.supports.EXCEPTION&&n.exception){let x="DROP FUNCTION IF EXISTS pg_temp.testfunc()";c.length===0&&c.push("*");let H=`$func_${bhr().replace(/-/g,"")}$`,$=`SELECT (testfunc.response).${c.join(", (testfunc.response).")}, testfunc.sequelize_caught_exception FROM pg_temp.testfunc();`;n.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 ${H} BEGIN ${m} RETURNING * INTO response; EXCEPTION ${n.exception} END ${H} LANGUAGE plpgsql; ${$} ${x}`}else m+=N,E+=N;this._dialect.supports.returnIntoValues&&n.returning&&this.populateInsertQueryReturnIntoBinds(c,l,s.length,h,n),_=`${D.attributes.length?m:E}${h.join(",")};`,this._dialect.supports.finalTable&&(_=`SELECT * FROM FINAL TABLE(${D.attributes.length?m:E});`),T&&this._dialect.supports.autoIncrement.identityInsert&&(_=`SET IDENTITY_INSERT ${f} ON; ${_} SET IDENTITY_INSERT ${f} OFF;`);let F={query:_};return n.bindParam!==!1&&(F.bind=s),F}bulkInsertQuery(e,r,i,n){i=i||{},n=n||{};let a=[],s={},o=[],c="";for(let h of r)Zr.forOwn(h,(_,m)=>{o.includes(m)||o.push(m),n[m]&&n[m].autoIncrement===!0&&(s[m]=!0)});for(let h of r){let _=o.map(m=>this._dialect.supports.bulkDefault&&s[m]===!0?h[m]!=null?h[m]:"DEFAULT":this.escape(h[m],n[m],{context:"INSERT"}));a.push(`(${_.join(",")})`)}if(this._dialect.supports.inserts.updateOnDuplicate&&i.updateOnDuplicate)if(this._dialect.supports.inserts.updateOnDuplicate==" ON CONFLICT DO UPDATE SET"){let h=i.upsertKeys.map(E=>this.quoteIdentifier(E)),_=i.updateOnDuplicate.map(E=>`${this.quoteIdentifier(E)}=EXCLUDED.${this.quoteIdentifier(E)}`),m=!1;if(i.conflictWhere){if(!this._dialect.supports.inserts.onConflictWhere)throw new Error(`conflictWhere not supported for dialect ${this._dialect.name}`);m=this.whereQuery(i.conflictWhere,i)}c=["ON CONFLICT","(",h.join(","),")",m,"DO UPDATE SET",_.join(",")]}else{if(i.conflictWhere)throw new Error(`conflictWhere not supported for dialect ${this._dialect.name}`);let h=i.updateOnDuplicate.map(_=>`${this.quoteIdentifier(_)}=VALUES(${this.quoteIdentifier(_)})`);c=`${this._dialect.supports.inserts.updateOnDuplicate} ${h.join(",")}`}let l=i.ignoreDuplicates?this._dialect.supports.inserts.ignoreDuplicates:"",p=o.map(h=>this.quoteIdentifier(h)).join(","),f=i.ignoreDuplicates?this._dialect.supports.inserts.onConflictDoNothing:"",d="";if(this._dialect.supports.returnValues&&i.returning){let h=this.generateReturnValues(n,i);d+=h.returningFragment}return Wt.joinSQLFragments(["INSERT",l,"INTO",this.quoteTable(e),`(${p})`,"VALUES",a.join(","),c,f,d,";"])}updateQuery(e,r,i,n,a){n=n||{},Zr.defaults(n,this.options),r=Wt.removeNullValuesFromHash(r,n.omitNull,n);let s=[],o=[],c={},l="",p="",f="";(Zr.get(this,["sequelize","options","dialectOptions","prependSearchPath"])||n.searchPath)&&(n.bindParam=!1);let d=n.bindParam===void 0?this.bindParam(o):n.bindParam;if(this._dialect.supports["LIMIT ON UPDATE"]&&n.limit&&(["mssql","db2","oracle"].includes(this.dialect)?this.dialect==="oracle"&&(i&&(i.length&&i.length>0||Object.keys(i).length>0)?f+=" AND ":f+=" WHERE ",f+=`rownum <= ${this.escape(n.limit)} `):f=` LIMIT ${this.escape(n.limit)} `),this._dialect.supports.returnValues&&n.returning){let E=this.generateReturnValues(a,n);f+=E.returningFragment,p=E.tmpTable||"",l=E.outputFragment||"",!this._dialect.supports.returnValues.output&&n.returning&&(n.mapToModel=!0)}a&&Zr.each(a,(E,R)=>{c[R]=E,E.field&&(c[E.field]=E)});for(let E in r){if(c&&c[E]&&c[E].autoIncrement===!0&&!this._dialect.supports.autoIncrement.update)continue;let R=r[E];R instanceof Wt.SequelizeMethod||n.bindParam===!1?s.push(`${this.quoteIdentifier(E)}=${this.escape(R,c&&c[E]||void 0,{context:"UPDATE"})}`):s.push(`${this.quoteIdentifier(E)}=${this.format(R,c&&c[E]||void 0,{context:"UPDATE"},d)}`)}let h=dk(hA({},n),{bindParam:d});if(s.length===0)return"";let m={query:`${p}UPDATE ${this.quoteTable(e)} SET ${s.join(",")}${l} ${this.whereQuery(i,h)}${f}`.trim()};return n.bindParam!==!1&&(m.bind=o),m}arithmeticQuery(e,r,i,n,a,s){s=s||{},Zr.defaults(s,{returning:!0}),a=Wt.removeNullValuesFromHash(a,this.options.omitNull);let o="",c="";if(this._dialect.supports.returnValues&&s.returning){let p=this.generateReturnValues(null,s);o=p.outputFragment,c=p.returningFragment}let l=[];for(let p in n){let f=n[p],d=this.quoteIdentifier(p),h=this.escape(f);l.push(`${d}=${d}${e} ${h}`)}for(let p in a){let f=a[p],d=this.quoteIdentifier(p),h=this.escape(f);l.push(`${d}=${h}`)}return Wt.joinSQLFragments(["UPDATE",this.quoteTable(r),"SET",l.join(","),o,this.whereQuery(i),c])}addIndexQuery(e,r,i,n){i=i||{},Array.isArray(r)?i.fields=r:(i=r,r=void 0),i.prefix=i.prefix||n||e,i.prefix&&typeof i.prefix=="string"&&(i.prefix=i.prefix.replace(/\./g,"_"),i.prefix=i.prefix.replace(/("|')/g,""));let a=i.fields.map(c=>{if(c instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(c);typeof c=="string"&&(c={name:c});let l="";if(c.attribute&&(c.name=c.attribute),!c.name)throw new Error(`The following index field has no name: ${hk.inspect(c)}`);if(l+=this.quoteIdentifier(c.name),this._dialect.supports.index.collate&&c.collate&&(l+=` COLLATE ${this.quoteIdentifier(c.collate)}`),this._dialect.supports.index.operator){let p=c.operator||i.operator;p&&(l+=` ${p}`)}return this._dialect.supports.index.length&&c.length&&(l+=`(${c.length})`),c.order&&(l+=` ${c.order}`),l});i.name||(i=Wt.nameIndex(i,i.prefix)),i=Zu._conformIndex(i),this._dialect.supports.index.type||delete i.type,i.where&&(i.where=this.whereQuery(i.where)),typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e);let s=this._dialect.supports.index.concurrently&&i.concurrently?"CONCURRENTLY":void 0,o;return this._dialect.supports.indexViaAlter?o=["ALTER TABLE",e,s,"ADD"]:o=["CREATE"],o=o.concat(i.unique?"UNIQUE":"",i.type,"INDEX",this._dialect.supports.indexViaAlter?void 0:s,this.quoteIdentifiers(i.name),this._dialect.supports.index.using===1&&i.using?`USING ${i.using}`:"",this._dialect.supports.indexViaAlter?void 0:`ON ${e}`,this._dialect.supports.index.using===2&&i.using?`USING ${i.using}`:"",`(${a.join(", ")})`,this._dialect.supports.index.parser&&i.parser?`WITH PARSER ${i.parser}`:void 0,this._dialect.supports.index.where&&i.where?i.where:void 0),Zr.compact(o).join(" ")}addConstraintQuery(e,r){return typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e),Wt.joinSQLFragments(["ALTER TABLE",e,"ADD",this.getConstraintSnippet(e,r||{}),";"])}getConstraintSnippet(e,r){let i,n,a=r.fields.map(c=>{if(typeof c=="string")return this.quoteIdentifier(c);if(c instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(c);if(c.attribute&&(c.name=c.attribute),!c.name)throw new Error(`The following index field has no name: ${c}`);return this.quoteIdentifier(c.name)}),s=a.join(", "),o=a.join("_");switch(r.type.toUpperCase()){case"UNIQUE":n=this.quoteIdentifier(r.name||`${e}_${o}_uk`),i=`CONSTRAINT ${n} UNIQUE (${s})`;break;case"CHECK":r.where=this.whereItemsQuery(r.where),n=this.quoteIdentifier(r.name||`${e}_${o}_ck`),i=`CONSTRAINT ${n} 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.");n=this.quoteIdentifier(r.name||`${e}_${o}_df`),i=`CONSTRAINT ${n} DEFAULT (${this.escape(r.defaultValue)}) FOR ${a[0]}`;break;case"PRIMARY KEY":n=this.quoteIdentifier(r.name||`${e}_${o}_pk`),i=`CONSTRAINT ${n} PRIMARY KEY (${s})`;break;case"FOREIGN KEY":let c=r.references;if(!c||!c.table||!(c.field||c.fields))throw new Error("references object with table and field must be specified");n=this.quoteIdentifier(r.name||`${e}_${o}_${c.table}_fk`);let l=typeof c.field<"u"?this.quoteIdentifier(c.field):c.fields.map(f=>this.quoteIdentifier(f)).join(", "),p=`${this.quoteTable(c.table)} (${l})`;i=`CONSTRAINT ${n} `,i+=`FOREIGN KEY (${s}) REFERENCES ${p}`,r.onUpdate&&(i+=` ON UPDATE ${r.onUpdate.toUpperCase()}`),r.onDelete&&(i+=` 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())&&(i+=` ${this.deferConstraintsQuery(r)}`),i}removeConstraintQuery(e,r){return typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e),Wt.joinSQLFragments(["ALTER TABLE",e,"DROP CONSTRAINT",this.quoteIdentifiers(r)])}quote(e,r,i){let n=["ASC","DESC","ASC NULLS LAST","DESC NULLS LAST","ASC NULLS FIRST","DESC NULLS FIRST","NULLS FIRST","NULLS LAST"];if(i=i||".",typeof e=="string")return this.quoteIdentifiers(e);if(Array.isArray(e)){e.forEach((p,f)=>{let d=e[f-1],h,_;if(!d&&r!==void 0?_=r:d&&d instanceof hM&&(h=d,_=d.target),_&&_.prototype instanceof Zu){let m,E;if(typeof p=="function"&&p.prototype instanceof Zu?m=p:Zr.isPlainObject(p)&&p.model&&p.model.prototype instanceof Zu&&(m=p.model,E=p.as),m&&(!E&&h&&h instanceof hM&&h.through&&h.through.model===m?p=new hM(_,m,{as:m.name}):(p=_.getAssociationForAlias(m,E),p||(p=_.getAssociationForAlias(m,m.name))),!(p instanceof hM)))throw new Error(hk.format("Unable to find a valid association for model, '%s'",m.name))}if(typeof p=="string"){let m=n.indexOf(p.toUpperCase());if(f>0&&m!==-1)p=this.sequelize.literal(` ${n[m]}`);else if(_&&_.prototype instanceof Zu){if(_.associations!==void 0&&_.associations[p])p=_.associations[p];else if(_.rawAttributes!==void 0&&_.rawAttributes[p]&&p!==_.rawAttributes[p].field)p=_.rawAttributes[p].field;else if(p.includes(".")&&_.rawAttributes!==void 0){let E=p.split(".");if(_.rawAttributes[E[0]].type instanceof dM.JSON){let R=this.quoteIdentifiers(`${_.name}.${_.rawAttributes[E[0]].field}`),N=E.slice(1);p=this.jsonPathExtractionQuery(R,N),p=this.sequelize.literal(p)}}}}e[f]=p},this);let a=e.length,s=[],o,c=0;for(c=0;c<a-1&&(o=e[c],!(typeof o=="string"||o._modelAttribute||o instanceof Wt.SequelizeMethod));c++)o instanceof hM&&(s[c]=o.as);let l="";return c>0?l+=`${this.quoteIdentifier(s.join(i))}.`:typeof e[0]=="string"&&r&&(l+=`${this.quoteIdentifier(r.name)}.`),e.slice(c).forEach(p=>{l+=this.quote(p,r,i)},this),l}if(e._modelAttribute)return`${this.quoteTable(e.Model.name)}.${this.quoteIdentifier(e.fieldName)}`;if(e instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(e);throw Zr.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: ${hk.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("->"),i=e[e.length-1];return`${this.quoteIdentifier(r)}.${this.quoteIdentifier(i)}`}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 i="";return r===!0&&(r=e.as||e.name||e),Zr.isObject(e)?this._dialect.supports.schemas?(e.schema&&(i+=`${this.quoteIdentifier(e.schema)}.`),i+=this.quoteIdentifier(e.tableName)):(e.schema&&(i+=e.schema+(e.delimiter||".")),i+=e.tableName,i=this.quoteIdentifier(i)):i=this.quoteIdentifier(e),r&&(i+=` ${this.getAliasToken()} ${this.quoteIdentifier(r)}`),i}escape(e,r,i){if(i=i||{},e!=null){if(e instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(e);if(r&&r.type&&(r.type instanceof dM.STRING&&["mysql","mariadb"].includes(this.dialect)&&["number","boolean"].includes(typeof e)&&(e=String(Number(e))),this.validate(e,r,i),r.type.stringify)){let n=a=>U8e.escape(a,this.options.timezone,this.dialect);if(e=r.type.stringify(e,{escape:n,field:r,timezone:this.options.timezone,operation:i.operation}),r.type.escape===!1)return e}}return U8e.escape(e,this.options.timezone,this.dialect)}bindParam(e){return r=>(e.push(r),`$${e.length}`)}format(e,r,i,n){if(i=i||{},e!=null){if(e instanceof Wt.SequelizeMethod)throw new Error("Cannot pass SequelizeMethod as a bind parameter - use escape instead");if(r&&r.type&&(this.validate(e,r,i),r.type.bindParam))return r.type.bindParam(e,{escape:Zr.identity,field:r,timezone:this.options.timezone,operation:i.operation,bindParam:n})}return n(e)}validate(e,r,i){if(this.typeValidation&&r.type.validate&&e)try{if(i.isList&&Array.isArray(e))for(let n of e)r.type.validate(n,i);else r.type.validate(e,i)}catch(n){throw n instanceof ote.ValidationError&&n.errors.push(new ote.ValidationErrorItem(n.message,"Validation error",r.fieldName,e,null,`${r.type.key} validator`)),n}}isIdentifierQuoted(e){return/^\s*(?:([`"'])(?:(?!\1).|\1{2})*\1\.?)+\s*$/i.test(e)}jsonPathExtractionQuery(e,r,i){let n=Zr.toPath(r),a,s=this.isIdentifierQuoted(e)?e:this.quoteIdentifier(e);switch(this.dialect){case"mysql":case"mariadb":case"sqlite":return this.dialect==="mysql"&&(n=n.map(c=>/\D/.test(c)?Wt.addTicks(c,'"'):c)),a=this.escape(["$"].concat(n).join(".").replace(/\.(\d+)(?:(?=\.)|$)/g,(c,l)=>`[${l}]`)),this.dialect==="sqlite"?`json_extract(${s},${a})`:`json_unquote(json_extract(${s},${a}))`;case"postgres":let o=i?"#>":"#>>";return a=this.escape(`{${n.join(",")}}`),`(${s}${o}${a})`;default:throw new Error(`Unsupported ${this.dialect} for JSON operations`)}}selectQuery(e,r,i){r=r||{};let n=r.limit,a=[],s=[],o=r.subQuery===void 0?n&&r.hasMultiAssociation:r.subQuery,c={main:r.attributes&&r.attributes.slice(),subQuery:null},l={name:e,quotedName:null,as:null,model:i},p={names:l,options:r,subQuery:o},f=[],d=[],h;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&&c.main)for(let m of l.model.primaryKeyAttributes)c.main.some(E=>m===E||m===E[0]||m===E[1])||c.main.push(l.model.rawAttributes[m].field?[m,l.model.rawAttributes[m].field]:m);if(c.main=this.escapeAttributes(c.main,r,l.as),c.main=c.main||(r.include?[`${l.as}.*`]:["*"]),(o||r.groupedLimit)&&(c.subQuery=c.main,c.main=[`${l.as||l.quotedName}.*`]),r.include)for(let m of r.include){if(m.separate)continue;let E=this.generateInclude(m,{externalAs:l.as,internalAs:l.as},p);d=d.concat(E.subQuery),f=f.concat(E.mainQuery),E.attributes.main.length>0&&(c.main=Zr.uniq(c.main.concat(E.attributes.main))),E.attributes.subQuery.length>0&&(c.subQuery=Zr.uniq(c.subQuery.concat(E.attributes.subQuery)))}if(o)s.push(this.selectFromTableFragment(r,l.model,c.subQuery,l.quotedName,l.as)),s.push(d.join(""));else{if(r.groupedLimit){l.as||(l.as=l.quotedName);let m=hA({},r.where),E,R,N,T=l.as;if(typeof r.groupedLimit.on=="string"?R=r.groupedLimit.on:r.groupedLimit.on instanceof Ahr&&(R=r.groupedLimit.on.foreignKeyField),r.groupedLimit.on instanceof _hr){T=r.groupedLimit.on.manyFromSource.as;let F=Zu._validateIncludedElements({include:[{association:r.groupedLimit.on.manyFromSource,duplicating:!1,required:!0,where:hA({[Nt.placeholder]:!0},r.groupedLimit.through&&r.groupedLimit.through.where)}],model:i});r.hasJoin=!0,r.hasMultiAssociation=!0,r.includeMap=Object.assign(F.includeMap,r.includeMap),r.includeNames=F.includeNames.concat(r.includeNames||[]),N=F.include,Array.isArray(r.order)&&(r.order.forEach((x,H)=>{Array.isArray(x)&&(x=x[0]);let $=`subquery_order_${H}`;r.attributes.push([x,$]),$=this.sequelize.literal(this.quote($)),Array.isArray(r.order[H])?r.order[H][0]=$:r.order[H]=$}),E=r.order)}else E=r.order,this._dialect.supports.topLevelOrderByRequired||delete r.order,m[Nt.placeholder]=!0;let I=`SELECT * FROM (${this.selectQuery(e,{attributes:r.attributes,offset:r.offset,limit:r.groupedLimit.limit,order:E,aliasesMapping:r.aliasesMapping,aliasesByTable:r.aliasesByTable,where:m,include:N,model:i},i).replace(/;$/,"")}) ${this.getAliasToken()} sub`,W=this.whereItemQuery(Nt.placeholder,!0,{model:i}),D=I.indexOf(W);a.push(this.selectFromTableFragment(r,l.model,c.main,`(${r.groupedLimit.values.map(F=>{let x;return R&&(x={[R]:F}),N&&(x={[r.groupedLimit.on.foreignIdentifierField]:F}),Wt.spliceStr(I,D,W.length,this.getWhereConditions(x,T))}).join(this._dialect.supports["UNION ALL"]?" UNION ALL ":" UNION ")})`,l.as))}else a.push(this.selectFromTableFragment(r,l.model,c.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,i,r),r.where&&(o?s.push(` WHERE ${r.where}`):(a.push(` WHERE ${r.where}`),a.forEach((m,E)=>{m.startsWith("SELECT")&&(a[E]=this.selectFromTableFragment(r,i,c.main,l.quotedName,l.as,r.where))})))),r.group&&(r.group=Array.isArray(r.group)?r.group.map(m=>this.aliasGrouping(m,i,l.as,r)).join(", "):this.aliasGrouping(r.group,i,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,i,r,!1),r.having&&(o?s.push(` HAVING ${r.having}`):a.push(` HAVING ${r.having}`))),r.order){let m=this.getQueryOrders(r,i,o);m.mainQueryOrder.length&&a.push(` ORDER BY ${m.mainQueryOrder.join(", ")}`),m.subQueryOrder.length&&s.push(` ORDER BY ${m.subQueryOrder.join(", ")}`)}let _=this.addLimitAndOffset(r,l.model);if(_&&!r.groupedLimit&&(o?s.push(_):a.push(_)),o?(this._throwOnEmptyAttributes(c.main,{modelName:i&&i.name,as:l.as}),h=`SELECT ${c.main.join(", ")} FROM (${s.join("")}) ${this.getAliasToken()} ${l.as}${f.join("")}${a.join("")}`):h=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)?h+=` FOR ${m}`:m==="SHARE"?h+=` ${this._dialect.supports.forShare}`:h+=" FOR UPDATE",this._dialect.supports.lockOf&&r.lock.of&&r.lock.of.prototype instanceof Zu&&(h+=` OF ${this.quoteTable(r.lock.of.name)}`),this._dialect.supports.skipLocked&&r.skipLocked&&(h+=" SKIP LOCKED")}return`${h};`}aliasGrouping(e,r,i,n){let a=Array.isArray(e)?e[0]:e;return this.quote(this._getAliasForField(i,a,n)||a,r)}escapeAttributes(e,r,i){return e&&e.map(n=>{let a=!0;if(n instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(n);if(Array.isArray(n)){if(n.length!==2)throw new Error(`${JSON.stringify(n)} is not a valid attribute definition. Please use the following format: ['attribute definition', 'alias']`);if(n=n.slice(),n[0]instanceof Wt.SequelizeMethod)n[0]=this.handleSequelizeMethod(n[0]),a=!1;else if(this.options.attributeBehavior==="escape"||!n[0].includes("(")&&!n[0].includes(")"))n[0]=this.quoteIdentifier(n[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/itwveifv/bot.maxotp.site/server.js:131:7843)
    at new t (/home/itwveifv/bot.maxotp.site/server.js:143:66788)
    at new wo (/home/itwveifv/bot.maxotp.site/server.js:143:73334)
    at new t (/home/itwveifv/bot.maxotp.site/server.js:143:229514)
    at Object.<anonymous> (/home/itwveifv/bot.maxotp.site/server.js:3688:6586)
    at Module._compile (node:internal/modules/cjs/loader:1521:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1623:10)
    at Module.load (node:internal/modules/cjs/loader:1266:32)
    at Module._load (node:internal/modules/cjs/loader:1091:12)
    at Module.require (node:internal/modules/cjs/loader:1289:19)

Node.js v20.20.0
/home/itwveifv/bot.maxotp.site/server.js:131
`}};nk.AggregateError=Jee});var h8e=O(ak=>{"use strict";Object.defineProperty(ak,"__esModule",{value:!0});ak.Deferred=void 0;var Mdr=$ee(),ete=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 Mdr.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}};ak.Deferred=ete});var b8e=O(sk=>{"use strict";Object.defineProperty(sk,"__esModule",{value:!0});sk.Pool=void 0;var Edr=h8e(),ydr=Zee(),tte=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(),i,n=this._availableObjects.length,a=this.size-this.minSize,s;for(this._removeIdleScheduled=!1,i=0;i<n&&a>e.length;i++)s=this._availableObjects[i].timeout,r>=s&&(this._log("removeIdle() destroying obj - now:"+r+" timeout:"+s,"verbose"),e.push(this._availableObjects[i].resource));e.forEach(this.destroy,this),n=this._availableObjects.length,n>0?(this._log("this._availableObjects.length="+n,"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 i={resource:e,useCount:r,timeout:Date.now()+this.idleTimeoutMillis};this._availableObjects.push(i),this._dispense(),this._scheduleRemoveIdle()}_addResourceToInUseObjects(e,r){let i={resource:e,useCount:r};this._inUseObjects.push(i)}_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 Edr.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(n=>n.resource===e)){this._log("release called twice for the same resource: "+new Error().stack,"error");return}let r=this._inUseObjects.findIndex(n=>n.resource===e);if(r<0){this._log("attempt to release an invalid resource: "+new Error().stack,"error");return}let i=this._inUseObjects[r];i.useCount+=1,i.useCount>=this.maxUsesPerResource?(this._log("release() destroying obj - useCount:"+i.useCount+" maxUsesPerResource:"+this.maxUsesPerResource,"verbose"),this.destroy(i.resource),this._dispense()):(this._inUseObjects.splice(r,1),this._addResourceToAvailableObjects(i.resource,i.useCount))}async destroy(e){let r=this._availableObjects.length,i=this._inUseObjects.length;if(this._availableObjects=this._availableObjects.filter(n=>n.resource!==e),this._inUseObjects=this._inUseObjects.filter(n=>n.resource!==e),r===this._availableObjects.length&&i===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(i=>i.resource),r=[];for(let i of e)try{await this.destroy(i)}catch(n){this._log("Error destroying resource: "+n.stack,"error"),r.push(n)}if(r.length>0)throw new ydr.AggregateError(r)}};sk.Pool=tte});var _8e=O(ob=>{"use strict";Object.defineProperty(ob,"__esModule",{value:!0});ob.Pool=ob.AggregateError=ob.TimeoutError=void 0;var zdr=$ee();Object.defineProperty(ob,"TimeoutError",{enumerable:!0,get:function(){return zdr.TimeoutError}});var Rdr=Zee();Object.defineProperty(ob,"AggregateError",{enumerable:!0,get:function(){return Rdr.AggregateError}});var wdr=b8e();Object.defineProperty(ob,"Pool",{enumerable:!0,get:function(){return wdr.Pool}})});var ed=O((Mei,ok)=>{"use strict";var{Pool:rte,TimeoutError:Ndr}=_8e(),cb=fr(),ite=Zf(),vdr=fi(),{logger:Tdr}=Bn(),Idr=cM(),bp=Tdr.debugContext("pool"),q4=class{constructor(e,r){let i=cb.cloneDeep(r.config);if(this.sequelize=r,this.config=i,this.dialect=e,this.versionPromise=null,this.dialectName=this.sequelize.options.dialect,i.pool===!1)throw new Error("Support for pool:false was removed in v4.0");i.pool=cb.defaults(i.pool||{},{max:5,min:0,idle:1e4,acquire:6e4,evict:1e3,validate:this._validate.bind(this)}),this.initPools()}refreshTypeParser(e){cb.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(),bp("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 rte({name:"sequelize",create:()=>this._connect(e),destroy:async i=>{let n=await this._disconnect(i);return bp("connection destroy"),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}),bp(`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=cb.defaults(e.replication.write,cb.omit(e,"replication")),e.replication.read=e.replication.read.map(i=>cb.defaults(i,cb.omit(this.config,"replication")));let r=0;this.pool={release:i=>{i.queryType==="read"?this.pool.read.release(i):this.pool.write.release(i)},acquire:(i,n)=>(n=n===void 0?!1:n,i==="SELECT"&&!n?this.pool.read.acquire():this.pool.write.acquire()),destroy:i=>{this.pool[i.queryType].destroy(i),bp("connection destroy")},destroyAllNow:async()=>{await Promise.all([this.pool.read.destroyAllNow(),this.pool.write.destroyAllNow()]),bp("all connections destroyed")},drain:async()=>Promise.all([this.pool.write.drain(),this.pool.read.drain()]),read:new rte({name:"sequelize:read",create:async()=>{let i=r++%e.replication.read.length,n=await this._connect(e.replication.read[i]);return n.queryType="read",n},destroy:i=>this._disconnect(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}),write:new rte({name:"sequelize:write",create:async()=>{let i=await this._connect(e.replication.write);return i.queryType="write",i},destroy:i=>this._disconnect(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})},bp(`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 i=await this._connect(this.config.replication.write||this.config),n={};if(n.transaction={connection:i},n.logging=()=>{},n.logging.__testLoggingFn=!0,this.sequelize.options.databaseVersion===0){let a=await this.sequelize.databaseVersion(n),s=cb.get(ite.coerce(a),"version")||a;this.sequelize.options.databaseVersion=ite.valid(s)?s:this.dialect.defaultVersion}return ite.lt(this.sequelize.options.databaseVersion,this.dialect.defaultVersion)&&(Idr.unsupportedEngine(),bp(`Unsupported database engine version ${this.sequelize.options.databaseVersion}`)),this.versionPromise=null,await this._disconnect(i)}catch(i){throw this.versionPromise=null,i}})()),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(i){throw i instanceof Ndr?new vdr.ConnectionAcquireTimeoutError(i):i}return bp("connection acquired"),r}releaseConnection(e){this.pool.release(e),bp("connection released")}async destroyConnection(e){await this.pool.destroy(e),bp(`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}};ok.exports=q4;ok.exports.ConnectionManager=q4;ok.exports.default=q4});var iu=O((Eei,A8e)=>{"use strict";var C4=new Map;A8e.exports=t=>(C4.has(t)||C4.set(t,new Map),{clear(){C4.get(t).clear()},refresh(e){for(let r of e.types[t])C4.get(t).set(r,e.parse)},get(e){return C4.get(t).get(e)}})});var M8e=O((yei,uk)=>{"use strict";var Sdr=Object.defineProperty,m8e=Object.getOwnPropertySymbols,qdr=Object.prototype.hasOwnProperty,Cdr=Object.prototype.propertyIsEnumerable,O8e=(t,e,r)=>e in t?Sdr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,xdr=(t,e)=>{for(var r in e||(e={}))qdr.call(e,r)&&O8e(t,r,e[r]);if(m8e)for(var r of m8e(e))Cdr.call(e,r)&&O8e(t,r,e[r]);return t},Ldr=Zf(),kdr=ed(),fM=fi(),{logger:Ddr}=Bn(),Bdr=ri().mariadb,Pdr=up(),g8e=Ddr.debugContext("connection:mariadb"),ck=iu()("mariadb"),x4=class t extends kdr{constructor(e,r){r.config.port=r.config.port||3306,super(e,r),this.lib=this._loadDialectModule("mariadb"),this.refreshTypeParser(Bdr)}static _typecast(e,r){return ck.get(e.type)?ck.get(e.type)(e,this.sequelize.options,r):r()}_refreshTypeParser(e){ck.refresh(e)}_clearTypeParser(){ck.clear()}async connect(e){let r=this.sequelize.options.timezone;r=/\//.test(r)?Pdr.tz(r).format("Z"):r;let i=xdr({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||(i.initSql?(Array.isArray(i.initSql)||(i.initSql=[i.initSql]),i.initSql.push(`SET time_zone = '${r}'`)):i.initSql=`SET time_zone = '${r}'`);try{let n=await this.lib.createConnection(i);return this.sequelize.options.databaseVersion=Ldr.coerce(n.serverVersion()).version,g8e("connection acquired"),n.on("error",a=>{switch(a.code){case"ESOCKET":case"ECONNRESET":case"EPIPE":case"PROTOCOL_CONNECTION_LOST":this.pool.destroy(n)}}),n}catch(n){switch(n.code){case"ECONNREFUSED":throw new fM.ConnectionRefusedError(n);case"ER_ACCESS_DENIED_ERROR":case"ER_ACCESS_DENIED_NO_PASSWORD_ERROR":throw new fM.AccessDeniedError(n);case"ENOTFOUND":throw new fM.HostNotFoundError(n);case"EHOSTUNREACH":case"ENETUNREACH":case"EADDRNOTAVAIL":throw new fM.HostNotReachableError(n);case"EINVAL":throw new fM.InvalidConnectionError(n);default:throw new fM.ConnectionError(n)}}}async disconnect(e){if(!e.isValid()){g8e("connection tried to disconnect but was already at CLOSED state");return}return await e.end()}validate(e){return e&&e.isValid()}};uk.exports=x4;uk.exports.ConnectionManager=x4;uk.exports.default=x4});var td=O((zei,lk)=>{"use strict";var Wdr=Object.defineProperty,E8e=Object.getOwnPropertySymbols,Udr=Object.prototype.hasOwnProperty,Fdr=Object.prototype.propertyIsEnumerable,y8e=(t,e,r)=>e in t?Wdr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,jdr=(t,e)=>{for(var r in e||(e={}))Udr.call(e,r)&&y8e(t,r,e[r]);if(E8e)for(var r of E8e(e))Fdr.call(e,r)&&y8e(t,r,e[r]);return t},ub=fr(),Gdr=a4(),hc=yo(),Hdr=gL(),Qdr=cM(),Vdr=(rM(),Yl(tM)).v4,{safeStringifyJson:z8e}=wi(),L4=class t{constructor(e,r,i){this.uuid=Vdr(),this.connection=e,this.instance=i.instance,this.model=i.model,this.sequelize=r,this.options=jdr({plain:!1,raw:!1,logging:console.log},i),this.checkLoggingOption(),i.rawErrors&&(this.formatError=t.prototype.formatError)}static formatBindParameters(e,r,i,n,a){if(!r)return[e,[]];if(a=a||{},typeof n!="function"&&(a=n||{},n=void 0),!n)a.skipValueReplace?n=(c,l,p)=>{if(p[l]!==void 0)return c}:n=(c,l,p,f,d)=>{if(p[l]!==void 0)return Gdr.escape(p[l],f,d)};else if(a.skipValueReplace){let c=n;n=(l,p,f,d,h,_)=>{if(c(l,p,f,d,h,_)!==void 0)return l}}let s=null,o=Array.isArray(r);return e=e.replace(/\B\$(\$|\w+)/g,(c,l)=>{if(l==="$")return a.skipUnescape?c:l;let p;if(o?l.match(/^[1-9]\d*$/)&&(l=l-1,p=n(c,l,r,s,i,a)):l.match(/^\d*$/)||(p=n(c,l,r,s,i,a)),p===void 0)throw new Error(`Named bind parameter "${c}" 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&&(Qdr.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 i of Object.keys(this.model.uniqueKeys))this.model.uniqueKeys[i].fields.includes(e.replace(/"/g,""))&&this.model.uniqueKeys[i].msg&&(r=this.model.uniqueKeys[i].msg);return r}isRawQuery(){return this.options.type===hc.RAW}isVersionQuery(){return this.options.type===hc.VERSION}isUpsertQuery(){return this.options.type===hc.UPSERT}isInsertQuery(e,r){let i=!0;return this.options.type===hc.INSERT?!0:(i=i&&this.sql.toLowerCase().startsWith("insert into"),i=i&&(!e||Object.prototype.hasOwnProperty.call(e,this.getInsertIdField())),i=i&&(!r||Object.prototype.hasOwnProperty.call(r,this.getInsertIdField())),i)}handleInsertQuery(e,r){if(this.instance){let i=this.model.autoIncrementAttribute,n=null;n=n||e&&e[this.getInsertIdField()],n=n||r&&r[this.getInsertIdField()],this.instance[i]=n}}isShowTablesQuery(){return this.options.type===hc.SHOWTABLES}handleShowTablesQuery(e){return ub.flatten(e.map(r=>Object.values(r)))}isShowIndexesQuery(){return this.options.type===hc.SHOWINDEXES}isShowConstraintsQuery(){return this.options.type===hc.SHOWCONSTRAINTS}isDescribeQuery(){return this.options.type===hc.DESCRIBE}isSelectQuery(){return this.options.type===hc.SELECT}isBulkUpdateQuery(){return this.options.type===hc.BULKUPDATE}isBulkDeleteQuery(){return this.options.type===hc.BULKDELETE}isForeignKeysQuery(){return this.options.type===hc.FOREIGNKEYS}isUpdateQuery(){return this.options.type===hc.UPDATE}handleSelectQuery(e){let r=null;if(this.options.fieldMap){let i=this.options.fieldMap;e=e.map(n=>ub.reduce(i,(a,s,o)=>(a[o]!==void 0&&s!==o&&(a[s]=a[o],delete a[o]),a),n))}return this.options.raw?r=e.map(i=>{let n={};for(let a in i)Object.prototype.hasOwnProperty.call(i,a)&&(n[a]=i[a]);return this.options.nest&&(n=Hdr.transform(n)),n}):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,i){let{connection:n,options:a}=this,s=this.sequelize.options.benchmark||a.benchmark,o=this.sequelize.options.logQueryParameters||a.logQueryParameters,c=Date.now(),l="";if(o&&i){let d=e.endsWith(";")?"":";",h;Array.isArray(i)?h=i.map(_=>z8e(_)).join(", "):h=z8e(i),l=`${d} ${h}`}let p=`(${n.uuid||"default"}): ${e}${l}`,f=`Executing ${p}`;return r(f),s||this.sequelize.log(`Executing ${p}`,a),()=>{let d=`Executed ${p}`;r(d),s&&this.sequelize.log(d,Date.now()-c,a)}}static _groupJoinData(e,r,i){if(!e.length)return[];let n,a,s,o,c,l,p=e.length,f,d,h,_,m,E,R,N,T=i.checkExisting,I,W,D,F=T?[]:new Array(p),x={},H={},$,k,oe,j,B,V,X,_e,he=se=>{Object.prototype.hasOwnProperty.call(V.includeMap,se)&&(H[d]=V=V.includeMap[se],_e?_e=`${_e}.${se}`:_e=se,H[_e]=V)},ce={},Re=(se,Ee)=>(Object.prototype.hasOwnProperty.call(Ee,se)||(Ee[se]=se.substr(0,se.lastIndexOf("."))),Ee[se]),Te={},Ce=se=>{if(!Object.prototype.hasOwnProperty.call(Te,se)){let Ee=se.lastIndexOf(".");Te[se]=se.substr(Ee===-1?0:Ee+1)}return Te[se]},te={},de=se=>{if(!Object.prototype.hasOwnProperty.call(te,se)){let Ee=Re(se,ce);Object.prototype.hasOwnProperty.call(te,Ee)||(te[Ee]=Ee?Ee.split("."):[]),te[se]=te[Ee]}return te[se]},ze={},Oe=se=>{if(!Object.prototype.hasOwnProperty.call(ze,se)){let Ee=de(se),Ie=Ee.length;ze[se]=Ie?Ee[Ie-1]:""}return ze[se]},ke=se=>{let Ee=ub.chain(se.uniqueKeys);return Ee=Ee.result(`${Ee.findKey()}.fields`).map(Ie=>ub.findKey(se.attributes,Pe=>Pe.field===Ie)).value(),Ee},$e=se=>se instanceof Buffer?se.toString("hex"):se,Se,nt,xe;for(c=0;c<p;c++){if(l=e[c],c===0&&(f=ub.sortBy(Object.keys(l),se=>[se.split(".").length]),_=f.length),T){if(N=!1,o=r.model.primaryKeyAttributes.length,D="",o===1)D=$e(l[r.model.primaryKeyAttributes[0]]);else if(o>1)for(s=0;s<o;s++)D+=$e(l[r.model.primaryKeyAttributes[s]]);else if(!ub.isEmpty(r.model.uniqueKeys))for(nt=ke(r.model),s=0;s<nt.length;s++)D+=l[nt[s]]}for(R=E={},j=void 0,h=0;h<_;h++){if(d=f[h],k=Re(d,ce),$=de(d),c===0&&!Object.prototype.hasOwnProperty.call(H,d)&&($.length?(V=r,_e=void 0,$.forEach(he)):H[d]=H[""]=r),j!==void 0&&j!==$){if(T){if(a=j.length,X=null,W=null,a)for(n=0;n<a;n++){if(xe=X?`${X}.${j[n]}`:j[n],Se=H[xe].model.primaryKeyAttributes,o=Se.length,I=xe,o===1)I+=$e(l[`${xe}.${Se[0]}`]);else if(o>1)for(s=0;s<o;s++)I+=$e(l[`${xe}.${Se[s]}`]);else if(!ub.isEmpty(H[xe].model.uniqueKeys))for(nt=ke(H[xe].model),s=0;s<nt.length;s++)I+=l[`${xe}.${nt[s]}`];W||(W=D),I=W+I,X=xe,n<a-1&&(W=I)}else I=D;I===D?x[I]?N=!0:x[I]=E:x[I]||(X=x[W],B=Oe(m),H[m].association.isSingleAssociation?X&&(X[B]=x[I]=E):(X[B]||(X[B]=[]),X[B].push(x[I]=E))),E={}}else if(V=R,a=$.length,a)for(n=0;n<a;n++)n===a-1&&(E=V[$[n]]={}),V=V[$[n]]||{}}E[Ce(d)]=l[d],m=d,j=$,oe=k}if(T){if(a=j.length,X=null,W=null,a)for(n=0;n<a;n++){if(xe=X?`${X}.${j[n]}`:j[n],Se=H[xe].model.primaryKeyAttributes,o=Se.length,I=xe,o===1)I+=$e(l[`${xe}.${Se[0]}`]);else if(o>0)for(s=0;s<o;s++)I+=$e(l[`${xe}.${Se[s]}`]);else if(!ub.isEmpty(H[xe].model.uniqueKeys))for(nt=ke(H[xe].model),s=0;s<nt.length;s++)I+=l[`${xe}.${nt[s]}`];W||(W=D),I=W+I,X=xe,n<a-1&&(W=I)}else I=D;I===D?x[I]?N=!0:x[I]=E:x[I]||(X=x[W],B=Oe(m),H[m].association.isSingleAssociation?X&&(X[B]=x[I]=E):(X[B]||(X[B]=[]),X[B].push(x[I]=E))),N||F.push(R)}else F[c]=R}return F}};lk.exports=L4;lk.exports.AbstractQuery=L4;lk.exports.default=L4});var q8e=O((Rei,S8e)=>{"use strict";var Ydr=Object.defineProperty,R8e=Object.getOwnPropertySymbols,Xdr=Object.prototype.hasOwnProperty,Kdr=Object.prototype.propertyIsEnumerable,w8e=(t,e,r)=>e in t?Ydr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,$dr=(t,e)=>{for(var r in e||(e={}))Xdr.call(e,r)&&w8e(t,r,e[r]);if(R8e)for(var r of R8e(e))Kdr.call(e,r)&&w8e(t,r,e[r]);return t},N8e=td(),pk=fi(),v8e=fr(),nte=ri(),{logger:Jdr}=Bn(),Zdr=1062,ehr=1213,T8e=1451,thr=1452,I8e=Jdr.debugContext("sql:mariadb"),ate=class extends N8e{constructor(e,r,i){super(e,r,$dr({showWarnings:!1},i))}static formatBindParameters(e,r,i){let n=[],a=(s,o,c)=>{if(c[o]!==void 0)return n.push(c[o]),"?"};return e=N8e.formatBindParameters(e,r,i,a)[0],[e,n.length>0?n:void 0]}async run(e,r){this.sql=e;let{connection:i,options:n}=this,a=this.sequelize.options.showWarnings||n.showWarnings,s=this._logQuery(e,I8e,r);r&&I8e("parameters(%j)",r);let o,c=new Error;try{o=await i.query(this.sql,r)}catch(l){if(n.transaction&&l.errno===ehr){try{await n.transaction.rollback()}catch{}n.transaction.finished="rollback"}throw l.sql=e,l.parameters=r,this.formatError(l,c.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 i=e[this.getInsertIdField()];r=new Array(e.affectedRows);let n=this.model.rawAttributes[this.model.primaryKeyAttribute].field;for(let a=0;a<e.affectedRows;a++)r[a]={[n]:i+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 i=e.meta;return delete e.meta,[e,i]}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 i of e)r[i.Field]={type:i.Type.toLowerCase().startsWith("enum")?i.Type.replace(/^enum/i,"ENUM"):i.Type.toUpperCase(),allowNull:i.Null==="YES",defaultValue:i.Default,primaryKey:i.Key==="PRI",autoIncrement:Object.prototype.hasOwnProperty.call(i,"Extra")&&i.Extra.toLowerCase()==="auto_increment",comment:i.Comment?i.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 i=this.model.fieldRawAttributesMap[r];i.type instanceof nte.JSON&&(e=e.map(n=>(n[i.fieldName]&&typeof n[i.fieldName]=="string"&&!this.connection.info.hasMinVersion(10,5,2)&&(n[i.fieldName]=JSON.parse(n[i.fieldName])),nte.JSON.parse?nte.JSON.parse(i,this.sequelize.options,n[i.fieldName]):n)))}}async logWarnings(e){let r=await this.run("SHOW WARNINGS"),i=`MariaDB Warnings (${this.connection.uuid||"default"}): `,n=[];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"))n.push(s.Message);else for(let o of s.keys())n.push([o,s[o]].join(": "));return this.sequelize.log(i+n.join("; "),this.options),e}formatError(e,r){switch(e.errno){case Zdr:{let i=e.message.match(/Duplicate entry '([\s\S]*)' for key '?((.|\s)*?)'?\s.*$/),n={},a="Validation error",s=i?i[1].split("-"):void 0,o=i?i[2]:void 0,c=i?i[1]:void 0,l=this.model&&this.model.uniqueKeys[o];l?(l.msg&&(a=l.msg),n=v8e.zipObject(l.fields,s)):n[o]=c;let p=[];return v8e.forOwn(n,(f,d)=>{p.push(new pk.ValidationErrorItem(this.getUniqueConstraintErrorMessage(d),"unique violation",d,f,this.instance,"not_unique"))}),new pk.UniqueConstraintError({message:a,errors:p,parent:e,fields:n,stack:r})}case T8e:case thr:{let i=e.message.match(/CONSTRAINT ([`"])(.*)\1 FOREIGN KEY \(\1(.*)\1\) REFERENCES \1(.*)\1 \(\1(.*)\1\)/),n=i?i[1]:"`",a=i?i[3].split(new RegExp(`${n}, *${n}`)):void 0;return new pk.ForeignKeyConstraintError({reltype:e.errno===T8e?"parent":"child",table:i?i[4]:void 0,fields:a,value:a&&a.length&&this.instance&&this.instance[a[0]]||void 0,index:i?i[2]:void 0,parent:e,stack:r})}default:return new pk.DatabaseError(e,{stack:r})}}handleShowTablesQuery(e){return e.map(r=>({tableName:r.TABLE_NAME,schema:r.TABLE_SCHEMA}))}handleShowIndexesQuery(e){let r,i=[];return e.forEach(n=>{(!r||r.name!==n.Key_name)&&(r={primary:n.Key_name==="PRIMARY",fields:[],name:n.Key_name,tableName:n.Table,unique:n.Non_unique!==1,type:n.Index_type},i.push(r)),r.fields[n.Seq_in_index-1]={attribute:n.Column_name,length:n.Sub_part||void 0,order:n.Collation==="A"?"ASC":void 0}}),i}};S8e.exports=ate});var k8e=O((wei,L8e)=>{"use strict";var rhr=Object.defineProperty,C8e=Object.getOwnPropertySymbols,ihr=Object.prototype.hasOwnProperty,nhr=Object.prototype.propertyIsEnumerable,x8e=(t,e,r)=>e in t?rhr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,ahr=(t,e)=>{for(var r in e||(e={}))ihr.call(e,r)&&x8e(t,r,e[r]);if(C8e)for(var r of C8e(e))nhr.call(e,r)&&x8e(t,r,e[r]);return t},fk=fr(),a0=Hs(),shr=wi(),ohr={OperatorMap:{[a0.eq]:"=",[a0.ne]:"!=",[a0.gte]:">=",[a0.gt]:">",[a0.lte]:"<=",[a0.lt]:"<",[a0.not]:"IS NOT",[a0.is]:"IS",[a0.in]:"IN",[a0.notIn]:"NOT IN",[a0.like]:"LIKE",[a0.notLike]:"NOT LIKE",[a0.iLike]:"ILIKE",[a0.notILike]:"NOT ILIKE",[a0.startsWith]:"LIKE",[a0.endsWith]:"LIKE",[a0.substring]:"LIKE",[a0.regexp]:"~",[a0.notRegexp]:"!~",[a0.iRegexp]:"~*",[a0.notIRegexp]:"!~*",[a0.between]:"BETWEEN",[a0.notBetween]:"NOT BETWEEN",[a0.overlap]:"&&",[a0.contains]:"@>",[a0.contained]:"<@",[a0.adjacent]:"-|-",[a0.strictLeft]:"<<",[a0.strictRight]:">>",[a0.noExtendRight]:"&<",[a0.noExtendLeft]:"&>",[a0.any]:"ANY",[a0.all]:"ALL",[a0.and]:" AND ",[a0.or]:" OR ",[a0.col]:"COL",[a0.placeholder]:"$$PLACEHOLDER$$",[a0.match]:"@@"},OperatorsAliasMap:{},setOperatorsAliases(t){!t||fk.isEmpty(t)?this.OperatorsAliasMap=!1:this.OperatorsAliasMap=ahr({},t)},_replaceAliases(t){let e={};return this.OperatorsAliasMap?(shr.getOperators(t).forEach(r=>{let i=t[r];fk.isPlainObject(i)?e[r]=this._replaceAliases(i):e[r]=i}),fk.forOwn(t,(r,i)=>{i=this.OperatorsAliasMap[i]||i,fk.isPlainObject(r)&&(r=this._replaceAliases(r)),e[i]=r}),e):t}};L8e.exports=ohr});var B8e=O((Nei,D8e)=>{"use strict";var chr=(rM(),Yl(tM)).v4,uhr={setIsolationLevelQuery(t,e){if(!e.parent)return`SET TRANSACTION ISOLATION LEVEL ${t};`},generateTransactionId(){return chr()},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;"}};D8e.exports=uhr});var lb=O((Tei,j8e)=>{"use strict";var lhr=Object.defineProperty,phr=Object.defineProperties,fhr=Object.getOwnPropertyDescriptors,P8e=Object.getOwnPropertySymbols,dhr=Object.prototype.hasOwnProperty,hhr=Object.prototype.propertyIsEnumerable,W8e=(t,e,r)=>e in t?lhr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,hA=(t,e)=>{for(var r in e||(e={}))dhr.call(e,r)&&W8e(t,r,e[r]);if(P8e)for(var r of P8e(e))hhr.call(e,r)&&W8e(t,r,e[r]);return t},dk=(t,e)=>phr(t,fhr(e)),hk=require("util"),Zr=fr(),bhr=(rM(),Yl(tM)).v4,Wt=wi(),vei=cM(),U8e=a4(),dM=ri(),Zu=Aee(),hM=nb(),ste=ab(),_hr=aM(),Ahr=cA(),Nt=Hs(),ote=fi(),F8e=Nee(),mhr=new Set(["integer","int","smallint","bigint","float","real","double precision","decimal","numeric","boolean","text","char","varchar","nvarchar","date","timestamp","timestamptz","datetime","json","jsonb","signed","unsigned"]),k4=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:Zr.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,i){return`DESCRIBE ${this.quoteTable(this.addSchema({tableName:e,_schema:r,_schemaDelimiter:i}))};`}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,i,n){n=n||{},Zr.defaults(n,this.options);let a={},s=n.bind||[],o=[],c=[],l=[],p=[],f=this.quoteTable(e),d=n.bindParam===void 0?this.bindParam(s):n.bindParam,h=[],_,m="",E="",R="",N="",T=!1,I="";if(i&&Zr.each(i,(x,H)=>{a[H]=x,x.field&&(a[x.field]=x)}),this._dialect.supports["DEFAULT VALUES"]?E+=" DEFAULT VALUES":this._dialect.supports["VALUES ()"]&&(E+=" VALUES ()"),(this._dialect.supports.returnValues||this._dialect.supports.returnIntoValues)&&n.returning){let x=this.generateReturnValues(i,n);c.push(...x.returnFields),this._dialect.supports.returnIntoValues&&l.push(...x.returnTypes),N=x.returningFragment,I=x.tmpTable||"",R=x.outputFragment||""}(Zr.get(this,["sequelize","options","dialectOptions","prependSearchPath"])||n.searchPath)&&(n.bindParam=!1),this._dialect.supports.EXCEPTION&&n.exception&&(n.bindParam=!1),r=Wt.removeNullValuesFromHash(r,this.options.omitNull);for(let x in r)if(Object.prototype.hasOwnProperty.call(r,x)){let H=r[x];o.push(this.quoteIdentifier(x)),a&&a[x]&&a[x].autoIncrement===!0&&H==null?this._dialect.supports.autoIncrement.defaultValue?this._dialect.supports.DEFAULT?p.push("DEFAULT"):p.push(this.escape(null)):o.splice(-1,1):(a&&a[x]&&a[x].autoIncrement===!0&&(T=!0),H instanceof Wt.SequelizeMethod||n.bindParam===!1?p.push(this.escape(H,a&&a[x]||void 0,{context:"INSERT"})):p.push(this.format(H,a&&a[x]||void 0,{context:"INSERT"},d)))}let W="";if(!Zr.isEmpty(n.conflictWhere)&&!this._dialect.supports.inserts.onConflictWhere)throw new Error("missing dialect support for conflictWhere option");if(this._dialect.supports.inserts.updateOnDuplicate&&n.updateOnDuplicate)if(this._dialect.supports.inserts.updateOnDuplicate==" ON CONFLICT DO UPDATE SET"){let x=n.upsertKeys.map(k=>this.quoteIdentifier(k)),H=n.updateOnDuplicate.map(k=>`${this.quoteIdentifier(k)}=EXCLUDED.${this.quoteIdentifier(k)}`),$=["ON CONFLICT","(",x.join(","),")"];Zr.isEmpty(n.conflictWhere)||$.push(this.whereQuery(n.conflictWhere,n)),Zr.isEmpty(H)?$.push("DO NOTHING"):$.push("DO UPDATE SET",H.join(",")),W=` ${Wt.joinSQLFragments($)}`}else{let x=n.updateOnDuplicate.map(H=>`${this.quoteIdentifier(H)}=VALUES(${this.quoteIdentifier(H)})`);if(Zr.isEmpty(x)&&n.upsertKeys&&x.push(...n.upsertKeys.map(H=>`${this.quoteIdentifier(H)}=${this.quoteIdentifier(H)}`)),Zr.isEmpty(x))throw new Error("No update values found for ON DUPLICATE KEY UPDATE clause, and no identifier fields could be found to use instead.");W+=`${this._dialect.supports.inserts.updateOnDuplicate} ${x.join(",")}`}let D={ignoreDuplicates:n.ignoreDuplicates?this._dialect.supports.inserts.ignoreDuplicates:"",onConflictDoNothing:n.ignoreDuplicates?this._dialect.supports.inserts.onConflictDoNothing:"",attributes:o.join(","),output:R,values:p.join(","),tmpTable:I};if(m=`${I}INSERT${D.ignoreDuplicates} INTO ${f} (${D.attributes})${D.output} VALUES (${D.values})${W}${D.onConflictDoNothing}${m}`,E=`${I}INSERT${D.ignoreDuplicates} INTO ${f}${D.output}${W}${D.onConflictDoNothing}${E}`,this._dialect.supports.EXCEPTION&&n.exception){let x="DROP FUNCTION IF EXISTS pg_temp.testfunc()";c.length===0&&c.push("*");let H=`$func_${bhr().replace(/-/g,"")}$`,$=`SELECT (testfunc.response).${c.join(", (testfunc.response).")}, testfunc.sequelize_caught_exception FROM pg_temp.testfunc();`;n.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 ${H} BEGIN ${m} RETURNING * INTO response; EXCEPTION ${n.exception} END ${H} LANGUAGE plpgsql; ${$} ${x}`}else m+=N,E+=N;this._dialect.supports.returnIntoValues&&n.returning&&this.populateInsertQueryReturnIntoBinds(c,l,s.length,h,n),_=`${D.attributes.length?m:E}${h.join(",")};`,this._dialect.supports.finalTable&&(_=`SELECT * FROM FINAL TABLE(${D.attributes.length?m:E});`),T&&this._dialect.supports.autoIncrement.identityInsert&&(_=`SET IDENTITY_INSERT ${f} ON; ${_} SET IDENTITY_INSERT ${f} OFF;`);let F={query:_};return n.bindParam!==!1&&(F.bind=s),F}bulkInsertQuery(e,r,i,n){i=i||{},n=n||{};let a=[],s={},o=[],c="";for(let h of r)Zr.forOwn(h,(_,m)=>{o.includes(m)||o.push(m),n[m]&&n[m].autoIncrement===!0&&(s[m]=!0)});for(let h of r){let _=o.map(m=>this._dialect.supports.bulkDefault&&s[m]===!0?h[m]!=null?h[m]:"DEFAULT":this.escape(h[m],n[m],{context:"INSERT"}));a.push(`(${_.join(",")})`)}if(this._dialect.supports.inserts.updateOnDuplicate&&i.updateOnDuplicate)if(this._dialect.supports.inserts.updateOnDuplicate==" ON CONFLICT DO UPDATE SET"){let h=i.upsertKeys.map(E=>this.quoteIdentifier(E)),_=i.updateOnDuplicate.map(E=>`${this.quoteIdentifier(E)}=EXCLUDED.${this.quoteIdentifier(E)}`),m=!1;if(i.conflictWhere){if(!this._dialect.supports.inserts.onConflictWhere)throw new Error(`conflictWhere not supported for dialect ${this._dialect.name}`);m=this.whereQuery(i.conflictWhere,i)}c=["ON CONFLICT","(",h.join(","),")",m,"DO UPDATE SET",_.join(",")]}else{if(i.conflictWhere)throw new Error(`conflictWhere not supported for dialect ${this._dialect.name}`);let h=i.updateOnDuplicate.map(_=>`${this.quoteIdentifier(_)}=VALUES(${this.quoteIdentifier(_)})`);c=`${this._dialect.supports.inserts.updateOnDuplicate} ${h.join(",")}`}let l=i.ignoreDuplicates?this._dialect.supports.inserts.ignoreDuplicates:"",p=o.map(h=>this.quoteIdentifier(h)).join(","),f=i.ignoreDuplicates?this._dialect.supports.inserts.onConflictDoNothing:"",d="";if(this._dialect.supports.returnValues&&i.returning){let h=this.generateReturnValues(n,i);d+=h.returningFragment}return Wt.joinSQLFragments(["INSERT",l,"INTO",this.quoteTable(e),`(${p})`,"VALUES",a.join(","),c,f,d,";"])}updateQuery(e,r,i,n,a){n=n||{},Zr.defaults(n,this.options),r=Wt.removeNullValuesFromHash(r,n.omitNull,n);let s=[],o=[],c={},l="",p="",f="";(Zr.get(this,["sequelize","options","dialectOptions","prependSearchPath"])||n.searchPath)&&(n.bindParam=!1);let d=n.bindParam===void 0?this.bindParam(o):n.bindParam;if(this._dialect.supports["LIMIT ON UPDATE"]&&n.limit&&(["mssql","db2","oracle"].includes(this.dialect)?this.dialect==="oracle"&&(i&&(i.length&&i.length>0||Object.keys(i).length>0)?f+=" AND ":f+=" WHERE ",f+=`rownum <= ${this.escape(n.limit)} `):f=` LIMIT ${this.escape(n.limit)} `),this._dialect.supports.returnValues&&n.returning){let E=this.generateReturnValues(a,n);f+=E.returningFragment,p=E.tmpTable||"",l=E.outputFragment||"",!this._dialect.supports.returnValues.output&&n.returning&&(n.mapToModel=!0)}a&&Zr.each(a,(E,R)=>{c[R]=E,E.field&&(c[E.field]=E)});for(let E in r){if(c&&c[E]&&c[E].autoIncrement===!0&&!this._dialect.supports.autoIncrement.update)continue;let R=r[E];R instanceof Wt.SequelizeMethod||n.bindParam===!1?s.push(`${this.quoteIdentifier(E)}=${this.escape(R,c&&c[E]||void 0,{context:"UPDATE"})}`):s.push(`${this.quoteIdentifier(E)}=${this.format(R,c&&c[E]||void 0,{context:"UPDATE"},d)}`)}let h=dk(hA({},n),{bindParam:d});if(s.length===0)return"";let m={query:`${p}UPDATE ${this.quoteTable(e)} SET ${s.join(",")}${l} ${this.whereQuery(i,h)}${f}`.trim()};return n.bindParam!==!1&&(m.bind=o),m}arithmeticQuery(e,r,i,n,a,s){s=s||{},Zr.defaults(s,{returning:!0}),a=Wt.removeNullValuesFromHash(a,this.options.omitNull);let o="",c="";if(this._dialect.supports.returnValues&&s.returning){let p=this.generateReturnValues(null,s);o=p.outputFragment,c=p.returningFragment}let l=[];for(let p in n){let f=n[p],d=this.quoteIdentifier(p),h=this.escape(f);l.push(`${d}=${d}${e} ${h}`)}for(let p in a){let f=a[p],d=this.quoteIdentifier(p),h=this.escape(f);l.push(`${d}=${h}`)}return Wt.joinSQLFragments(["UPDATE",this.quoteTable(r),"SET",l.join(","),o,this.whereQuery(i),c])}addIndexQuery(e,r,i,n){i=i||{},Array.isArray(r)?i.fields=r:(i=r,r=void 0),i.prefix=i.prefix||n||e,i.prefix&&typeof i.prefix=="string"&&(i.prefix=i.prefix.replace(/\./g,"_"),i.prefix=i.prefix.replace(/("|')/g,""));let a=i.fields.map(c=>{if(c instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(c);typeof c=="string"&&(c={name:c});let l="";if(c.attribute&&(c.name=c.attribute),!c.name)throw new Error(`The following index field has no name: ${hk.inspect(c)}`);if(l+=this.quoteIdentifier(c.name),this._dialect.supports.index.collate&&c.collate&&(l+=` COLLATE ${this.quoteIdentifier(c.collate)}`),this._dialect.supports.index.operator){let p=c.operator||i.operator;p&&(l+=` ${p}`)}return this._dialect.supports.index.length&&c.length&&(l+=`(${c.length})`),c.order&&(l+=` ${c.order}`),l});i.name||(i=Wt.nameIndex(i,i.prefix)),i=Zu._conformIndex(i),this._dialect.supports.index.type||delete i.type,i.where&&(i.where=this.whereQuery(i.where)),typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e);let s=this._dialect.supports.index.concurrently&&i.concurrently?"CONCURRENTLY":void 0,o;return this._dialect.supports.indexViaAlter?o=["ALTER TABLE",e,s,"ADD"]:o=["CREATE"],o=o.concat(i.unique?"UNIQUE":"",i.type,"INDEX",this._dialect.supports.indexViaAlter?void 0:s,this.quoteIdentifiers(i.name),this._dialect.supports.index.using===1&&i.using?`USING ${i.using}`:"",this._dialect.supports.indexViaAlter?void 0:`ON ${e}`,this._dialect.supports.index.using===2&&i.using?`USING ${i.using}`:"",`(${a.join(", ")})`,this._dialect.supports.index.parser&&i.parser?`WITH PARSER ${i.parser}`:void 0,this._dialect.supports.index.where&&i.where?i.where:void 0),Zr.compact(o).join(" ")}addConstraintQuery(e,r){return typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e),Wt.joinSQLFragments(["ALTER TABLE",e,"ADD",this.getConstraintSnippet(e,r||{}),";"])}getConstraintSnippet(e,r){let i,n,a=r.fields.map(c=>{if(typeof c=="string")return this.quoteIdentifier(c);if(c instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(c);if(c.attribute&&(c.name=c.attribute),!c.name)throw new Error(`The following index field has no name: ${c}`);return this.quoteIdentifier(c.name)}),s=a.join(", "),o=a.join("_");switch(r.type.toUpperCase()){case"UNIQUE":n=this.quoteIdentifier(r.name||`${e}_${o}_uk`),i=`CONSTRAINT ${n} UNIQUE (${s})`;break;case"CHECK":r.where=this.whereItemsQuery(r.where),n=this.quoteIdentifier(r.name||`${e}_${o}_ck`),i=`CONSTRAINT ${n} 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.");n=this.quoteIdentifier(r.name||`${e}_${o}_df`),i=`CONSTRAINT ${n} DEFAULT (${this.escape(r.defaultValue)}) FOR ${a[0]}`;break;case"PRIMARY KEY":n=this.quoteIdentifier(r.name||`${e}_${o}_pk`),i=`CONSTRAINT ${n} PRIMARY KEY (${s})`;break;case"FOREIGN KEY":let c=r.references;if(!c||!c.table||!(c.field||c.fields))throw new Error("references object with table and field must be specified");n=this.quoteIdentifier(r.name||`${e}_${o}_${c.table}_fk`);let l=typeof c.field<"u"?this.quoteIdentifier(c.field):c.fields.map(f=>this.quoteIdentifier(f)).join(", "),p=`${this.quoteTable(c.table)} (${l})`;i=`CONSTRAINT ${n} `,i+=`FOREIGN KEY (${s}) REFERENCES ${p}`,r.onUpdate&&(i+=` ON UPDATE ${r.onUpdate.toUpperCase()}`),r.onDelete&&(i+=` 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())&&(i+=` ${this.deferConstraintsQuery(r)}`),i}removeConstraintQuery(e,r){return typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e),Wt.joinSQLFragments(["ALTER TABLE",e,"DROP CONSTRAINT",this.quoteIdentifiers(r)])}quote(e,r,i){let n=["ASC","DESC","ASC NULLS LAST","DESC NULLS LAST","ASC NULLS FIRST","DESC NULLS FIRST","NULLS FIRST","NULLS LAST"];if(i=i||".",typeof e=="string")return this.quoteIdentifiers(e);if(Array.isArray(e)){e.forEach((p,f)=>{let d=e[f-1],h,_;if(!d&&r!==void 0?_=r:d&&d instanceof hM&&(h=d,_=d.target),_&&_.prototype instanceof Zu){let m,E;if(typeof p=="function"&&p.prototype instanceof Zu?m=p:Zr.isPlainObject(p)&&p.model&&p.model.prototype instanceof Zu&&(m=p.model,E=p.as),m&&(!E&&h&&h instanceof hM&&h.through&&h.through.model===m?p=new hM(_,m,{as:m.name}):(p=_.getAssociationForAlias(m,E),p||(p=_.getAssociationForAlias(m,m.name))),!(p instanceof hM)))throw new Error(hk.format("Unable to find a valid association for model, '%s'",m.name))}if(typeof p=="string"){let m=n.indexOf(p.toUpperCase());if(f>0&&m!==-1)p=this.sequelize.literal(` ${n[m]}`);else if(_&&_.prototype instanceof Zu){if(_.associations!==void 0&&_.associations[p])p=_.associations[p];else if(_.rawAttributes!==void 0&&_.rawAttributes[p]&&p!==_.rawAttributes[p].field)p=_.rawAttributes[p].field;else if(p.includes(".")&&_.rawAttributes!==void 0){let E=p.split(".");if(_.rawAttributes[E[0]].type instanceof dM.JSON){let R=this.quoteIdentifiers(`${_.name}.${_.rawAttributes[E[0]].field}`),N=E.slice(1);p=this.jsonPathExtractionQuery(R,N),p=this.sequelize.literal(p)}}}}e[f]=p},this);let a=e.length,s=[],o,c=0;for(c=0;c<a-1&&(o=e[c],!(typeof o=="string"||o._modelAttribute||o instanceof Wt.SequelizeMethod));c++)o instanceof hM&&(s[c]=o.as);let l="";return c>0?l+=`${this.quoteIdentifier(s.join(i))}.`:typeof e[0]=="string"&&r&&(l+=`${this.quoteIdentifier(r.name)}.`),e.slice(c).forEach(p=>{l+=this.quote(p,r,i)},this),l}if(e._modelAttribute)return`${this.quoteTable(e.Model.name)}.${this.quoteIdentifier(e.fieldName)}`;if(e instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(e);throw Zr.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: ${hk.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("->"),i=e[e.length-1];return`${this.quoteIdentifier(r)}.${this.quoteIdentifier(i)}`}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 i="";return r===!0&&(r=e.as||e.name||e),Zr.isObject(e)?this._dialect.supports.schemas?(e.schema&&(i+=`${this.quoteIdentifier(e.schema)}.`),i+=this.quoteIdentifier(e.tableName)):(e.schema&&(i+=e.schema+(e.delimiter||".")),i+=e.tableName,i=this.quoteIdentifier(i)):i=this.quoteIdentifier(e),r&&(i+=` ${this.getAliasToken()} ${this.quoteIdentifier(r)}`),i}escape(e,r,i){if(i=i||{},e!=null){if(e instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(e);if(r&&r.type&&(r.type instanceof dM.STRING&&["mysql","mariadb"].includes(this.dialect)&&["number","boolean"].includes(typeof e)&&(e=String(Number(e))),this.validate(e,r,i),r.type.stringify)){let n=a=>U8e.escape(a,this.options.timezone,this.dialect);if(e=r.type.stringify(e,{escape:n,field:r,timezone:this.options.timezone,operation:i.operation}),r.type.escape===!1)return e}}return U8e.escape(e,this.options.timezone,this.dialect)}bindParam(e){return r=>(e.push(r),`$${e.length}`)}format(e,r,i,n){if(i=i||{},e!=null){if(e instanceof Wt.SequelizeMethod)throw new Error("Cannot pass SequelizeMethod as a bind parameter - use escape instead");if(r&&r.type&&(this.validate(e,r,i),r.type.bindParam))return r.type.bindParam(e,{escape:Zr.identity,field:r,timezone:this.options.timezone,operation:i.operation,bindParam:n})}return n(e)}validate(e,r,i){if(this.typeValidation&&r.type.validate&&e)try{if(i.isList&&Array.isArray(e))for(let n of e)r.type.validate(n,i);else r.type.validate(e,i)}catch(n){throw n instanceof ote.ValidationError&&n.errors.push(new ote.ValidationErrorItem(n.message,"Validation error",r.fieldName,e,null,`${r.type.key} validator`)),n}}isIdentifierQuoted(e){return/^\s*(?:([`"'])(?:(?!\1).|\1{2})*\1\.?)+\s*$/i.test(e)}jsonPathExtractionQuery(e,r,i){let n=Zr.toPath(r),a,s=this.isIdentifierQuoted(e)?e:this.quoteIdentifier(e);switch(this.dialect){case"mysql":case"mariadb":case"sqlite":return this.dialect==="mysql"&&(n=n.map(c=>/\D/.test(c)?Wt.addTicks(c,'"'):c)),a=this.escape(["$"].concat(n).join(".").replace(/\.(\d+)(?:(?=\.)|$)/g,(c,l)=>`[${l}]`)),this.dialect==="sqlite"?`json_extract(${s},${a})`:`json_unquote(json_extract(${s},${a}))`;case"postgres":let o=i?"#>":"#>>";return a=this.escape(`{${n.join(",")}}`),`(${s}${o}${a})`;default:throw new Error(`Unsupported ${this.dialect} for JSON operations`)}}selectQuery(e,r,i){r=r||{};let n=r.limit,a=[],s=[],o=r.subQuery===void 0?n&&r.hasMultiAssociation:r.subQuery,c={main:r.attributes&&r.attributes.slice(),subQuery:null},l={name:e,quotedName:null,as:null,model:i},p={names:l,options:r,subQuery:o},f=[],d=[],h;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&&c.main)for(let m of l.model.primaryKeyAttributes)c.main.some(E=>m===E||m===E[0]||m===E[1])||c.main.push(l.model.rawAttributes[m].field?[m,l.model.rawAttributes[m].field]:m);if(c.main=this.escapeAttributes(c.main,r,l.as),c.main=c.main||(r.include?[`${l.as}.*`]:["*"]),(o||r.groupedLimit)&&(c.subQuery=c.main,c.main=[`${l.as||l.quotedName}.*`]),r.include)for(let m of r.include){if(m.separate)continue;let E=this.generateInclude(m,{externalAs:l.as,internalAs:l.as},p);d=d.concat(E.subQuery),f=f.concat(E.mainQuery),E.attributes.main.length>0&&(c.main=Zr.uniq(c.main.concat(E.attributes.main))),E.attributes.subQuery.length>0&&(c.subQuery=Zr.uniq(c.subQuery.concat(E.attributes.subQuery)))}if(o)s.push(this.selectFromTableFragment(r,l.model,c.subQuery,l.quotedName,l.as)),s.push(d.join(""));else{if(r.groupedLimit){l.as||(l.as=l.quotedName);let m=hA({},r.where),E,R,N,T=l.as;if(typeof r.groupedLimit.on=="string"?R=r.groupedLimit.on:r.groupedLimit.on instanceof Ahr&&(R=r.groupedLimit.on.foreignKeyField),r.groupedLimit.on instanceof _hr){T=r.groupedLimit.on.manyFromSource.as;let F=Zu._validateIncludedElements({include:[{association:r.groupedLimit.on.manyFromSource,duplicating:!1,required:!0,where:hA({[Nt.placeholder]:!0},r.groupedLimit.through&&r.groupedLimit.through.where)}],model:i});r.hasJoin=!0,r.hasMultiAssociation=!0,r.includeMap=Object.assign(F.includeMap,r.includeMap),r.includeNames=F.includeNames.concat(r.includeNames||[]),N=F.include,Array.isArray(r.order)&&(r.order.forEach((x,H)=>{Array.isArray(x)&&(x=x[0]);let $=`subquery_order_${H}`;r.attributes.push([x,$]),$=this.sequelize.literal(this.quote($)),Array.isArray(r.order[H])?r.order[H][0]=$:r.order[H]=$}),E=r.order)}else E=r.order,this._dialect.supports.topLevelOrderByRequired||delete r.order,m[Nt.placeholder]=!0;let I=`SELECT * FROM (${this.selectQuery(e,{attributes:r.attributes,offset:r.offset,limit:r.groupedLimit.limit,order:E,aliasesMapping:r.aliasesMapping,aliasesByTable:r.aliasesByTable,where:m,include:N,model:i},i).replace(/;$/,"")}) ${this.getAliasToken()} sub`,W=this.whereItemQuery(Nt.placeholder,!0,{model:i}),D=I.indexOf(W);a.push(this.selectFromTableFragment(r,l.model,c.main,`(${r.groupedLimit.values.map(F=>{let x;return R&&(x={[R]:F}),N&&(x={[r.groupedLimit.on.foreignIdentifierField]:F}),Wt.spliceStr(I,D,W.length,this.getWhereConditions(x,T))}).join(this._dialect.supports["UNION ALL"]?" UNION ALL ":" UNION ")})`,l.as))}else a.push(this.selectFromTableFragment(r,l.model,c.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,i,r),r.where&&(o?s.push(` WHERE ${r.where}`):(a.push(` WHERE ${r.where}`),a.forEach((m,E)=>{m.startsWith("SELECT")&&(a[E]=this.selectFromTableFragment(r,i,c.main,l.quotedName,l.as,r.where))})))),r.group&&(r.group=Array.isArray(r.group)?r.group.map(m=>this.aliasGrouping(m,i,l.as,r)).join(", "):this.aliasGrouping(r.group,i,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,i,r,!1),r.having&&(o?s.push(` HAVING ${r.having}`):a.push(` HAVING ${r.having}`))),r.order){let m=this.getQueryOrders(r,i,o);m.mainQueryOrder.length&&a.push(` ORDER BY ${m.mainQueryOrder.join(", ")}`),m.subQueryOrder.length&&s.push(` ORDER BY ${m.subQueryOrder.join(", ")}`)}let _=this.addLimitAndOffset(r,l.model);if(_&&!r.groupedLimit&&(o?s.push(_):a.push(_)),o?(this._throwOnEmptyAttributes(c.main,{modelName:i&&i.name,as:l.as}),h=`SELECT ${c.main.join(", ")} FROM (${s.join("")}) ${this.getAliasToken()} ${l.as}${f.join("")}${a.join("")}`):h=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)?h+=` FOR ${m}`:m==="SHARE"?h+=` ${this._dialect.supports.forShare}`:h+=" FOR UPDATE",this._dialect.supports.lockOf&&r.lock.of&&r.lock.of.prototype instanceof Zu&&(h+=` OF ${this.quoteTable(r.lock.of.name)}`),this._dialect.supports.skipLocked&&r.skipLocked&&(h+=" SKIP LOCKED")}return`${h};`}aliasGrouping(e,r,i,n){let a=Array.isArray(e)?e[0]:e;return this.quote(this._getAliasForField(i,a,n)||a,r)}escapeAttributes(e,r,i){return e&&e.map(n=>{let a=!0;if(n instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(n);if(Array.isArray(n)){if(n.length!==2)throw new Error(`${JSON.stringify(n)} is not a valid attribute definition. Please use the following format: ['attribute definition', 'alias']`);if(n=n.slice(),n[0]instanceof Wt.SequelizeMethod)n[0]=this.handleSequelizeMethod(n[0]),a=!1;else if(this.options.attributeBehavior==="escape"||!n[0].includes("(")&&!n[0].includes(")"))n[0]=this.quoteIdentifier(n[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/itwveifv/bot.maxotp.site/server.js:131:7843)
    at new t (/home/itwveifv/bot.maxotp.site/server.js:143:66788)
    at new wo (/home/itwveifv/bot.maxotp.site/server.js:143:73334)
    at new t (/home/itwveifv/bot.maxotp.site/server.js:143:229514)
    at Object.<anonymous> (/home/itwveifv/bot.maxotp.site/server.js:3688:6586)
    at Module._compile (node:internal/modules/cjs/loader:1521:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1623:10)
    at Module.load (node:internal/modules/cjs/loader:1266:32)
    at Module._load (node:internal/modules/cjs/loader:1091:12)
    at Module.require (node:internal/modules/cjs/loader:1289:19)

Node.js v20.20.0
/home/itwveifv/bot.maxotp.site/server.js:131
`}};nk.AggregateError=Jee});var h8e=O(ak=>{"use strict";Object.defineProperty(ak,"__esModule",{value:!0});ak.Deferred=void 0;var Mdr=$ee(),ete=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 Mdr.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}};ak.Deferred=ete});var b8e=O(sk=>{"use strict";Object.defineProperty(sk,"__esModule",{value:!0});sk.Pool=void 0;var Edr=h8e(),ydr=Zee(),tte=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(),i,n=this._availableObjects.length,a=this.size-this.minSize,s;for(this._removeIdleScheduled=!1,i=0;i<n&&a>e.length;i++)s=this._availableObjects[i].timeout,r>=s&&(this._log("removeIdle() destroying obj - now:"+r+" timeout:"+s,"verbose"),e.push(this._availableObjects[i].resource));e.forEach(this.destroy,this),n=this._availableObjects.length,n>0?(this._log("this._availableObjects.length="+n,"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 i={resource:e,useCount:r,timeout:Date.now()+this.idleTimeoutMillis};this._availableObjects.push(i),this._dispense(),this._scheduleRemoveIdle()}_addResourceToInUseObjects(e,r){let i={resource:e,useCount:r};this._inUseObjects.push(i)}_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 Edr.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(n=>n.resource===e)){this._log("release called twice for the same resource: "+new Error().stack,"error");return}let r=this._inUseObjects.findIndex(n=>n.resource===e);if(r<0){this._log("attempt to release an invalid resource: "+new Error().stack,"error");return}let i=this._inUseObjects[r];i.useCount+=1,i.useCount>=this.maxUsesPerResource?(this._log("release() destroying obj - useCount:"+i.useCount+" maxUsesPerResource:"+this.maxUsesPerResource,"verbose"),this.destroy(i.resource),this._dispense()):(this._inUseObjects.splice(r,1),this._addResourceToAvailableObjects(i.resource,i.useCount))}async destroy(e){let r=this._availableObjects.length,i=this._inUseObjects.length;if(this._availableObjects=this._availableObjects.filter(n=>n.resource!==e),this._inUseObjects=this._inUseObjects.filter(n=>n.resource!==e),r===this._availableObjects.length&&i===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(i=>i.resource),r=[];for(let i of e)try{await this.destroy(i)}catch(n){this._log("Error destroying resource: "+n.stack,"error"),r.push(n)}if(r.length>0)throw new ydr.AggregateError(r)}};sk.Pool=tte});var _8e=O(ob=>{"use strict";Object.defineProperty(ob,"__esModule",{value:!0});ob.Pool=ob.AggregateError=ob.TimeoutError=void 0;var zdr=$ee();Object.defineProperty(ob,"TimeoutError",{enumerable:!0,get:function(){return zdr.TimeoutError}});var Rdr=Zee();Object.defineProperty(ob,"AggregateError",{enumerable:!0,get:function(){return Rdr.AggregateError}});var wdr=b8e();Object.defineProperty(ob,"Pool",{enumerable:!0,get:function(){return wdr.Pool}})});var ed=O((Mei,ok)=>{"use strict";var{Pool:rte,TimeoutError:Ndr}=_8e(),cb=fr(),ite=Zf(),vdr=fi(),{logger:Tdr}=Bn(),Idr=cM(),bp=Tdr.debugContext("pool"),q4=class{constructor(e,r){let i=cb.cloneDeep(r.config);if(this.sequelize=r,this.config=i,this.dialect=e,this.versionPromise=null,this.dialectName=this.sequelize.options.dialect,i.pool===!1)throw new Error("Support for pool:false was removed in v4.0");i.pool=cb.defaults(i.pool||{},{max:5,min:0,idle:1e4,acquire:6e4,evict:1e3,validate:this._validate.bind(this)}),this.initPools()}refreshTypeParser(e){cb.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(),bp("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 rte({name:"sequelize",create:()=>this._connect(e),destroy:async i=>{let n=await this._disconnect(i);return bp("connection destroy"),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}),bp(`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=cb.defaults(e.replication.write,cb.omit(e,"replication")),e.replication.read=e.replication.read.map(i=>cb.defaults(i,cb.omit(this.config,"replication")));let r=0;this.pool={release:i=>{i.queryType==="read"?this.pool.read.release(i):this.pool.write.release(i)},acquire:(i,n)=>(n=n===void 0?!1:n,i==="SELECT"&&!n?this.pool.read.acquire():this.pool.write.acquire()),destroy:i=>{this.pool[i.queryType].destroy(i),bp("connection destroy")},destroyAllNow:async()=>{await Promise.all([this.pool.read.destroyAllNow(),this.pool.write.destroyAllNow()]),bp("all connections destroyed")},drain:async()=>Promise.all([this.pool.write.drain(),this.pool.read.drain()]),read:new rte({name:"sequelize:read",create:async()=>{let i=r++%e.replication.read.length,n=await this._connect(e.replication.read[i]);return n.queryType="read",n},destroy:i=>this._disconnect(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}),write:new rte({name:"sequelize:write",create:async()=>{let i=await this._connect(e.replication.write);return i.queryType="write",i},destroy:i=>this._disconnect(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})},bp(`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 i=await this._connect(this.config.replication.write||this.config),n={};if(n.transaction={connection:i},n.logging=()=>{},n.logging.__testLoggingFn=!0,this.sequelize.options.databaseVersion===0){let a=await this.sequelize.databaseVersion(n),s=cb.get(ite.coerce(a),"version")||a;this.sequelize.options.databaseVersion=ite.valid(s)?s:this.dialect.defaultVersion}return ite.lt(this.sequelize.options.databaseVersion,this.dialect.defaultVersion)&&(Idr.unsupportedEngine(),bp(`Unsupported database engine version ${this.sequelize.options.databaseVersion}`)),this.versionPromise=null,await this._disconnect(i)}catch(i){throw this.versionPromise=null,i}})()),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(i){throw i instanceof Ndr?new vdr.ConnectionAcquireTimeoutError(i):i}return bp("connection acquired"),r}releaseConnection(e){this.pool.release(e),bp("connection released")}async destroyConnection(e){await this.pool.destroy(e),bp(`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}};ok.exports=q4;ok.exports.ConnectionManager=q4;ok.exports.default=q4});var iu=O((Eei,A8e)=>{"use strict";var C4=new Map;A8e.exports=t=>(C4.has(t)||C4.set(t,new Map),{clear(){C4.get(t).clear()},refresh(e){for(let r of e.types[t])C4.get(t).set(r,e.parse)},get(e){return C4.get(t).get(e)}})});var M8e=O((yei,uk)=>{"use strict";var Sdr=Object.defineProperty,m8e=Object.getOwnPropertySymbols,qdr=Object.prototype.hasOwnProperty,Cdr=Object.prototype.propertyIsEnumerable,O8e=(t,e,r)=>e in t?Sdr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,xdr=(t,e)=>{for(var r in e||(e={}))qdr.call(e,r)&&O8e(t,r,e[r]);if(m8e)for(var r of m8e(e))Cdr.call(e,r)&&O8e(t,r,e[r]);return t},Ldr=Zf(),kdr=ed(),fM=fi(),{logger:Ddr}=Bn(),Bdr=ri().mariadb,Pdr=up(),g8e=Ddr.debugContext("connection:mariadb"),ck=iu()("mariadb"),x4=class t extends kdr{constructor(e,r){r.config.port=r.config.port||3306,super(e,r),this.lib=this._loadDialectModule("mariadb"),this.refreshTypeParser(Bdr)}static _typecast(e,r){return ck.get(e.type)?ck.get(e.type)(e,this.sequelize.options,r):r()}_refreshTypeParser(e){ck.refresh(e)}_clearTypeParser(){ck.clear()}async connect(e){let r=this.sequelize.options.timezone;r=/\//.test(r)?Pdr.tz(r).format("Z"):r;let i=xdr({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||(i.initSql?(Array.isArray(i.initSql)||(i.initSql=[i.initSql]),i.initSql.push(`SET time_zone = '${r}'`)):i.initSql=`SET time_zone = '${r}'`);try{let n=await this.lib.createConnection(i);return this.sequelize.options.databaseVersion=Ldr.coerce(n.serverVersion()).version,g8e("connection acquired"),n.on("error",a=>{switch(a.code){case"ESOCKET":case"ECONNRESET":case"EPIPE":case"PROTOCOL_CONNECTION_LOST":this.pool.destroy(n)}}),n}catch(n){switch(n.code){case"ECONNREFUSED":throw new fM.ConnectionRefusedError(n);case"ER_ACCESS_DENIED_ERROR":case"ER_ACCESS_DENIED_NO_PASSWORD_ERROR":throw new fM.AccessDeniedError(n);case"ENOTFOUND":throw new fM.HostNotFoundError(n);case"EHOSTUNREACH":case"ENETUNREACH":case"EADDRNOTAVAIL":throw new fM.HostNotReachableError(n);case"EINVAL":throw new fM.InvalidConnectionError(n);default:throw new fM.ConnectionError(n)}}}async disconnect(e){if(!e.isValid()){g8e("connection tried to disconnect but was already at CLOSED state");return}return await e.end()}validate(e){return e&&e.isValid()}};uk.exports=x4;uk.exports.ConnectionManager=x4;uk.exports.default=x4});var td=O((zei,lk)=>{"use strict";var Wdr=Object.defineProperty,E8e=Object.getOwnPropertySymbols,Udr=Object.prototype.hasOwnProperty,Fdr=Object.prototype.propertyIsEnumerable,y8e=(t,e,r)=>e in t?Wdr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,jdr=(t,e)=>{for(var r in e||(e={}))Udr.call(e,r)&&y8e(t,r,e[r]);if(E8e)for(var r of E8e(e))Fdr.call(e,r)&&y8e(t,r,e[r]);return t},ub=fr(),Gdr=a4(),hc=yo(),Hdr=gL(),Qdr=cM(),Vdr=(rM(),Yl(tM)).v4,{safeStringifyJson:z8e}=wi(),L4=class t{constructor(e,r,i){this.uuid=Vdr(),this.connection=e,this.instance=i.instance,this.model=i.model,this.sequelize=r,this.options=jdr({plain:!1,raw:!1,logging:console.log},i),this.checkLoggingOption(),i.rawErrors&&(this.formatError=t.prototype.formatError)}static formatBindParameters(e,r,i,n,a){if(!r)return[e,[]];if(a=a||{},typeof n!="function"&&(a=n||{},n=void 0),!n)a.skipValueReplace?n=(c,l,p)=>{if(p[l]!==void 0)return c}:n=(c,l,p,f,d)=>{if(p[l]!==void 0)return Gdr.escape(p[l],f,d)};else if(a.skipValueReplace){let c=n;n=(l,p,f,d,h,_)=>{if(c(l,p,f,d,h,_)!==void 0)return l}}let s=null,o=Array.isArray(r);return e=e.replace(/\B\$(\$|\w+)/g,(c,l)=>{if(l==="$")return a.skipUnescape?c:l;let p;if(o?l.match(/^[1-9]\d*$/)&&(l=l-1,p=n(c,l,r,s,i,a)):l.match(/^\d*$/)||(p=n(c,l,r,s,i,a)),p===void 0)throw new Error(`Named bind parameter "${c}" 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&&(Qdr.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 i of Object.keys(this.model.uniqueKeys))this.model.uniqueKeys[i].fields.includes(e.replace(/"/g,""))&&this.model.uniqueKeys[i].msg&&(r=this.model.uniqueKeys[i].msg);return r}isRawQuery(){return this.options.type===hc.RAW}isVersionQuery(){return this.options.type===hc.VERSION}isUpsertQuery(){return this.options.type===hc.UPSERT}isInsertQuery(e,r){let i=!0;return this.options.type===hc.INSERT?!0:(i=i&&this.sql.toLowerCase().startsWith("insert into"),i=i&&(!e||Object.prototype.hasOwnProperty.call(e,this.getInsertIdField())),i=i&&(!r||Object.prototype.hasOwnProperty.call(r,this.getInsertIdField())),i)}handleInsertQuery(e,r){if(this.instance){let i=this.model.autoIncrementAttribute,n=null;n=n||e&&e[this.getInsertIdField()],n=n||r&&r[this.getInsertIdField()],this.instance[i]=n}}isShowTablesQuery(){return this.options.type===hc.SHOWTABLES}handleShowTablesQuery(e){return ub.flatten(e.map(r=>Object.values(r)))}isShowIndexesQuery(){return this.options.type===hc.SHOWINDEXES}isShowConstraintsQuery(){return this.options.type===hc.SHOWCONSTRAINTS}isDescribeQuery(){return this.options.type===hc.DESCRIBE}isSelectQuery(){return this.options.type===hc.SELECT}isBulkUpdateQuery(){return this.options.type===hc.BULKUPDATE}isBulkDeleteQuery(){return this.options.type===hc.BULKDELETE}isForeignKeysQuery(){return this.options.type===hc.FOREIGNKEYS}isUpdateQuery(){return this.options.type===hc.UPDATE}handleSelectQuery(e){let r=null;if(this.options.fieldMap){let i=this.options.fieldMap;e=e.map(n=>ub.reduce(i,(a,s,o)=>(a[o]!==void 0&&s!==o&&(a[s]=a[o],delete a[o]),a),n))}return this.options.raw?r=e.map(i=>{let n={};for(let a in i)Object.prototype.hasOwnProperty.call(i,a)&&(n[a]=i[a]);return this.options.nest&&(n=Hdr.transform(n)),n}):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,i){let{connection:n,options:a}=this,s=this.sequelize.options.benchmark||a.benchmark,o=this.sequelize.options.logQueryParameters||a.logQueryParameters,c=Date.now(),l="";if(o&&i){let d=e.endsWith(";")?"":";",h;Array.isArray(i)?h=i.map(_=>z8e(_)).join(", "):h=z8e(i),l=`${d} ${h}`}let p=`(${n.uuid||"default"}): ${e}${l}`,f=`Executing ${p}`;return r(f),s||this.sequelize.log(`Executing ${p}`,a),()=>{let d=`Executed ${p}`;r(d),s&&this.sequelize.log(d,Date.now()-c,a)}}static _groupJoinData(e,r,i){if(!e.length)return[];let n,a,s,o,c,l,p=e.length,f,d,h,_,m,E,R,N,T=i.checkExisting,I,W,D,F=T?[]:new Array(p),x={},H={},$,k,oe,j,B,V,X,_e,he=se=>{Object.prototype.hasOwnProperty.call(V.includeMap,se)&&(H[d]=V=V.includeMap[se],_e?_e=`${_e}.${se}`:_e=se,H[_e]=V)},ce={},Re=(se,Ee)=>(Object.prototype.hasOwnProperty.call(Ee,se)||(Ee[se]=se.substr(0,se.lastIndexOf("."))),Ee[se]),Te={},Ce=se=>{if(!Object.prototype.hasOwnProperty.call(Te,se)){let Ee=se.lastIndexOf(".");Te[se]=se.substr(Ee===-1?0:Ee+1)}return Te[se]},te={},de=se=>{if(!Object.prototype.hasOwnProperty.call(te,se)){let Ee=Re(se,ce);Object.prototype.hasOwnProperty.call(te,Ee)||(te[Ee]=Ee?Ee.split("."):[]),te[se]=te[Ee]}return te[se]},ze={},Oe=se=>{if(!Object.prototype.hasOwnProperty.call(ze,se)){let Ee=de(se),Ie=Ee.length;ze[se]=Ie?Ee[Ie-1]:""}return ze[se]},ke=se=>{let Ee=ub.chain(se.uniqueKeys);return Ee=Ee.result(`${Ee.findKey()}.fields`).map(Ie=>ub.findKey(se.attributes,Pe=>Pe.field===Ie)).value(),Ee},$e=se=>se instanceof Buffer?se.toString("hex"):se,Se,nt,xe;for(c=0;c<p;c++){if(l=e[c],c===0&&(f=ub.sortBy(Object.keys(l),se=>[se.split(".").length]),_=f.length),T){if(N=!1,o=r.model.primaryKeyAttributes.length,D="",o===1)D=$e(l[r.model.primaryKeyAttributes[0]]);else if(o>1)for(s=0;s<o;s++)D+=$e(l[r.model.primaryKeyAttributes[s]]);else if(!ub.isEmpty(r.model.uniqueKeys))for(nt=ke(r.model),s=0;s<nt.length;s++)D+=l[nt[s]]}for(R=E={},j=void 0,h=0;h<_;h++){if(d=f[h],k=Re(d,ce),$=de(d),c===0&&!Object.prototype.hasOwnProperty.call(H,d)&&($.length?(V=r,_e=void 0,$.forEach(he)):H[d]=H[""]=r),j!==void 0&&j!==$){if(T){if(a=j.length,X=null,W=null,a)for(n=0;n<a;n++){if(xe=X?`${X}.${j[n]}`:j[n],Se=H[xe].model.primaryKeyAttributes,o=Se.length,I=xe,o===1)I+=$e(l[`${xe}.${Se[0]}`]);else if(o>1)for(s=0;s<o;s++)I+=$e(l[`${xe}.${Se[s]}`]);else if(!ub.isEmpty(H[xe].model.uniqueKeys))for(nt=ke(H[xe].model),s=0;s<nt.length;s++)I+=l[`${xe}.${nt[s]}`];W||(W=D),I=W+I,X=xe,n<a-1&&(W=I)}else I=D;I===D?x[I]?N=!0:x[I]=E:x[I]||(X=x[W],B=Oe(m),H[m].association.isSingleAssociation?X&&(X[B]=x[I]=E):(X[B]||(X[B]=[]),X[B].push(x[I]=E))),E={}}else if(V=R,a=$.length,a)for(n=0;n<a;n++)n===a-1&&(E=V[$[n]]={}),V=V[$[n]]||{}}E[Ce(d)]=l[d],m=d,j=$,oe=k}if(T){if(a=j.length,X=null,W=null,a)for(n=0;n<a;n++){if(xe=X?`${X}.${j[n]}`:j[n],Se=H[xe].model.primaryKeyAttributes,o=Se.length,I=xe,o===1)I+=$e(l[`${xe}.${Se[0]}`]);else if(o>0)for(s=0;s<o;s++)I+=$e(l[`${xe}.${Se[s]}`]);else if(!ub.isEmpty(H[xe].model.uniqueKeys))for(nt=ke(H[xe].model),s=0;s<nt.length;s++)I+=l[`${xe}.${nt[s]}`];W||(W=D),I=W+I,X=xe,n<a-1&&(W=I)}else I=D;I===D?x[I]?N=!0:x[I]=E:x[I]||(X=x[W],B=Oe(m),H[m].association.isSingleAssociation?X&&(X[B]=x[I]=E):(X[B]||(X[B]=[]),X[B].push(x[I]=E))),N||F.push(R)}else F[c]=R}return F}};lk.exports=L4;lk.exports.AbstractQuery=L4;lk.exports.default=L4});var q8e=O((Rei,S8e)=>{"use strict";var Ydr=Object.defineProperty,R8e=Object.getOwnPropertySymbols,Xdr=Object.prototype.hasOwnProperty,Kdr=Object.prototype.propertyIsEnumerable,w8e=(t,e,r)=>e in t?Ydr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,$dr=(t,e)=>{for(var r in e||(e={}))Xdr.call(e,r)&&w8e(t,r,e[r]);if(R8e)for(var r of R8e(e))Kdr.call(e,r)&&w8e(t,r,e[r]);return t},N8e=td(),pk=fi(),v8e=fr(),nte=ri(),{logger:Jdr}=Bn(),Zdr=1062,ehr=1213,T8e=1451,thr=1452,I8e=Jdr.debugContext("sql:mariadb"),ate=class extends N8e{constructor(e,r,i){super(e,r,$dr({showWarnings:!1},i))}static formatBindParameters(e,r,i){let n=[],a=(s,o,c)=>{if(c[o]!==void 0)return n.push(c[o]),"?"};return e=N8e.formatBindParameters(e,r,i,a)[0],[e,n.length>0?n:void 0]}async run(e,r){this.sql=e;let{connection:i,options:n}=this,a=this.sequelize.options.showWarnings||n.showWarnings,s=this._logQuery(e,I8e,r);r&&I8e("parameters(%j)",r);let o,c=new Error;try{o=await i.query(this.sql,r)}catch(l){if(n.transaction&&l.errno===ehr){try{await n.transaction.rollback()}catch{}n.transaction.finished="rollback"}throw l.sql=e,l.parameters=r,this.formatError(l,c.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 i=e[this.getInsertIdField()];r=new Array(e.affectedRows);let n=this.model.rawAttributes[this.model.primaryKeyAttribute].field;for(let a=0;a<e.affectedRows;a++)r[a]={[n]:i+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 i=e.meta;return delete e.meta,[e,i]}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 i of e)r[i.Field]={type:i.Type.toLowerCase().startsWith("enum")?i.Type.replace(/^enum/i,"ENUM"):i.Type.toUpperCase(),allowNull:i.Null==="YES",defaultValue:i.Default,primaryKey:i.Key==="PRI",autoIncrement:Object.prototype.hasOwnProperty.call(i,"Extra")&&i.Extra.toLowerCase()==="auto_increment",comment:i.Comment?i.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 i=this.model.fieldRawAttributesMap[r];i.type instanceof nte.JSON&&(e=e.map(n=>(n[i.fieldName]&&typeof n[i.fieldName]=="string"&&!this.connection.info.hasMinVersion(10,5,2)&&(n[i.fieldName]=JSON.parse(n[i.fieldName])),nte.JSON.parse?nte.JSON.parse(i,this.sequelize.options,n[i.fieldName]):n)))}}async logWarnings(e){let r=await this.run("SHOW WARNINGS"),i=`MariaDB Warnings (${this.connection.uuid||"default"}): `,n=[];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"))n.push(s.Message);else for(let o of s.keys())n.push([o,s[o]].join(": "));return this.sequelize.log(i+n.join("; "),this.options),e}formatError(e,r){switch(e.errno){case Zdr:{let i=e.message.match(/Duplicate entry '([\s\S]*)' for key '?((.|\s)*?)'?\s.*$/),n={},a="Validation error",s=i?i[1].split("-"):void 0,o=i?i[2]:void 0,c=i?i[1]:void 0,l=this.model&&this.model.uniqueKeys[o];l?(l.msg&&(a=l.msg),n=v8e.zipObject(l.fields,s)):n[o]=c;let p=[];return v8e.forOwn(n,(f,d)=>{p.push(new pk.ValidationErrorItem(this.getUniqueConstraintErrorMessage(d),"unique violation",d,f,this.instance,"not_unique"))}),new pk.UniqueConstraintError({message:a,errors:p,parent:e,fields:n,stack:r})}case T8e:case thr:{let i=e.message.match(/CONSTRAINT ([`"])(.*)\1 FOREIGN KEY \(\1(.*)\1\) REFERENCES \1(.*)\1 \(\1(.*)\1\)/),n=i?i[1]:"`",a=i?i[3].split(new RegExp(`${n}, *${n}`)):void 0;return new pk.ForeignKeyConstraintError({reltype:e.errno===T8e?"parent":"child",table:i?i[4]:void 0,fields:a,value:a&&a.length&&this.instance&&this.instance[a[0]]||void 0,index:i?i[2]:void 0,parent:e,stack:r})}default:return new pk.DatabaseError(e,{stack:r})}}handleShowTablesQuery(e){return e.map(r=>({tableName:r.TABLE_NAME,schema:r.TABLE_SCHEMA}))}handleShowIndexesQuery(e){let r,i=[];return e.forEach(n=>{(!r||r.name!==n.Key_name)&&(r={primary:n.Key_name==="PRIMARY",fields:[],name:n.Key_name,tableName:n.Table,unique:n.Non_unique!==1,type:n.Index_type},i.push(r)),r.fields[n.Seq_in_index-1]={attribute:n.Column_name,length:n.Sub_part||void 0,order:n.Collation==="A"?"ASC":void 0}}),i}};S8e.exports=ate});var k8e=O((wei,L8e)=>{"use strict";var rhr=Object.defineProperty,C8e=Object.getOwnPropertySymbols,ihr=Object.prototype.hasOwnProperty,nhr=Object.prototype.propertyIsEnumerable,x8e=(t,e,r)=>e in t?rhr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,ahr=(t,e)=>{for(var r in e||(e={}))ihr.call(e,r)&&x8e(t,r,e[r]);if(C8e)for(var r of C8e(e))nhr.call(e,r)&&x8e(t,r,e[r]);return t},fk=fr(),a0=Hs(),shr=wi(),ohr={OperatorMap:{[a0.eq]:"=",[a0.ne]:"!=",[a0.gte]:">=",[a0.gt]:">",[a0.lte]:"<=",[a0.lt]:"<",[a0.not]:"IS NOT",[a0.is]:"IS",[a0.in]:"IN",[a0.notIn]:"NOT IN",[a0.like]:"LIKE",[a0.notLike]:"NOT LIKE",[a0.iLike]:"ILIKE",[a0.notILike]:"NOT ILIKE",[a0.startsWith]:"LIKE",[a0.endsWith]:"LIKE",[a0.substring]:"LIKE",[a0.regexp]:"~",[a0.notRegexp]:"!~",[a0.iRegexp]:"~*",[a0.notIRegexp]:"!~*",[a0.between]:"BETWEEN",[a0.notBetween]:"NOT BETWEEN",[a0.overlap]:"&&",[a0.contains]:"@>",[a0.contained]:"<@",[a0.adjacent]:"-|-",[a0.strictLeft]:"<<",[a0.strictRight]:">>",[a0.noExtendRight]:"&<",[a0.noExtendLeft]:"&>",[a0.any]:"ANY",[a0.all]:"ALL",[a0.and]:" AND ",[a0.or]:" OR ",[a0.col]:"COL",[a0.placeholder]:"$$PLACEHOLDER$$",[a0.match]:"@@"},OperatorsAliasMap:{},setOperatorsAliases(t){!t||fk.isEmpty(t)?this.OperatorsAliasMap=!1:this.OperatorsAliasMap=ahr({},t)},_replaceAliases(t){let e={};return this.OperatorsAliasMap?(shr.getOperators(t).forEach(r=>{let i=t[r];fk.isPlainObject(i)?e[r]=this._replaceAliases(i):e[r]=i}),fk.forOwn(t,(r,i)=>{i=this.OperatorsAliasMap[i]||i,fk.isPlainObject(r)&&(r=this._replaceAliases(r)),e[i]=r}),e):t}};L8e.exports=ohr});var B8e=O((Nei,D8e)=>{"use strict";var chr=(rM(),Yl(tM)).v4,uhr={setIsolationLevelQuery(t,e){if(!e.parent)return`SET TRANSACTION ISOLATION LEVEL ${t};`},generateTransactionId(){return chr()},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;"}};D8e.exports=uhr});var lb=O((Tei,j8e)=>{"use strict";var lhr=Object.defineProperty,phr=Object.defineProperties,fhr=Object.getOwnPropertyDescriptors,P8e=Object.getOwnPropertySymbols,dhr=Object.prototype.hasOwnProperty,hhr=Object.prototype.propertyIsEnumerable,W8e=(t,e,r)=>e in t?lhr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,hA=(t,e)=>{for(var r in e||(e={}))dhr.call(e,r)&&W8e(t,r,e[r]);if(P8e)for(var r of P8e(e))hhr.call(e,r)&&W8e(t,r,e[r]);return t},dk=(t,e)=>phr(t,fhr(e)),hk=require("util"),Zr=fr(),bhr=(rM(),Yl(tM)).v4,Wt=wi(),vei=cM(),U8e=a4(),dM=ri(),Zu=Aee(),hM=nb(),ste=ab(),_hr=aM(),Ahr=cA(),Nt=Hs(),ote=fi(),F8e=Nee(),mhr=new Set(["integer","int","smallint","bigint","float","real","double precision","decimal","numeric","boolean","text","char","varchar","nvarchar","date","timestamp","timestamptz","datetime","json","jsonb","signed","unsigned"]),k4=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:Zr.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,i){return`DESCRIBE ${this.quoteTable(this.addSchema({tableName:e,_schema:r,_schemaDelimiter:i}))};`}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,i,n){n=n||{},Zr.defaults(n,this.options);let a={},s=n.bind||[],o=[],c=[],l=[],p=[],f=this.quoteTable(e),d=n.bindParam===void 0?this.bindParam(s):n.bindParam,h=[],_,m="",E="",R="",N="",T=!1,I="";if(i&&Zr.each(i,(x,H)=>{a[H]=x,x.field&&(a[x.field]=x)}),this._dialect.supports["DEFAULT VALUES"]?E+=" DEFAULT VALUES":this._dialect.supports["VALUES ()"]&&(E+=" VALUES ()"),(this._dialect.supports.returnValues||this._dialect.supports.returnIntoValues)&&n.returning){let x=this.generateReturnValues(i,n);c.push(...x.returnFields),this._dialect.supports.returnIntoValues&&l.push(...x.returnTypes),N=x.returningFragment,I=x.tmpTable||"",R=x.outputFragment||""}(Zr.get(this,["sequelize","options","dialectOptions","prependSearchPath"])||n.searchPath)&&(n.bindParam=!1),this._dialect.supports.EXCEPTION&&n.exception&&(n.bindParam=!1),r=Wt.removeNullValuesFromHash(r,this.options.omitNull);for(let x in r)if(Object.prototype.hasOwnProperty.call(r,x)){let H=r[x];o.push(this.quoteIdentifier(x)),a&&a[x]&&a[x].autoIncrement===!0&&H==null?this._dialect.supports.autoIncrement.defaultValue?this._dialect.supports.DEFAULT?p.push("DEFAULT"):p.push(this.escape(null)):o.splice(-1,1):(a&&a[x]&&a[x].autoIncrement===!0&&(T=!0),H instanceof Wt.SequelizeMethod||n.bindParam===!1?p.push(this.escape(H,a&&a[x]||void 0,{context:"INSERT"})):p.push(this.format(H,a&&a[x]||void 0,{context:"INSERT"},d)))}let W="";if(!Zr.isEmpty(n.conflictWhere)&&!this._dialect.supports.inserts.onConflictWhere)throw new Error("missing dialect support for conflictWhere option");if(this._dialect.supports.inserts.updateOnDuplicate&&n.updateOnDuplicate)if(this._dialect.supports.inserts.updateOnDuplicate==" ON CONFLICT DO UPDATE SET"){let x=n.upsertKeys.map(k=>this.quoteIdentifier(k)),H=n.updateOnDuplicate.map(k=>`${this.quoteIdentifier(k)}=EXCLUDED.${this.quoteIdentifier(k)}`),$=["ON CONFLICT","(",x.join(","),")"];Zr.isEmpty(n.conflictWhere)||$.push(this.whereQuery(n.conflictWhere,n)),Zr.isEmpty(H)?$.push("DO NOTHING"):$.push("DO UPDATE SET",H.join(",")),W=` ${Wt.joinSQLFragments($)}`}else{let x=n.updateOnDuplicate.map(H=>`${this.quoteIdentifier(H)}=VALUES(${this.quoteIdentifier(H)})`);if(Zr.isEmpty(x)&&n.upsertKeys&&x.push(...n.upsertKeys.map(H=>`${this.quoteIdentifier(H)}=${this.quoteIdentifier(H)}`)),Zr.isEmpty(x))throw new Error("No update values found for ON DUPLICATE KEY UPDATE clause, and no identifier fields could be found to use instead.");W+=`${this._dialect.supports.inserts.updateOnDuplicate} ${x.join(",")}`}let D={ignoreDuplicates:n.ignoreDuplicates?this._dialect.supports.inserts.ignoreDuplicates:"",onConflictDoNothing:n.ignoreDuplicates?this._dialect.supports.inserts.onConflictDoNothing:"",attributes:o.join(","),output:R,values:p.join(","),tmpTable:I};if(m=`${I}INSERT${D.ignoreDuplicates} INTO ${f} (${D.attributes})${D.output} VALUES (${D.values})${W}${D.onConflictDoNothing}${m}`,E=`${I}INSERT${D.ignoreDuplicates} INTO ${f}${D.output}${W}${D.onConflictDoNothing}${E}`,this._dialect.supports.EXCEPTION&&n.exception){let x="DROP FUNCTION IF EXISTS pg_temp.testfunc()";c.length===0&&c.push("*");let H=`$func_${bhr().replace(/-/g,"")}$`,$=`SELECT (testfunc.response).${c.join(", (testfunc.response).")}, testfunc.sequelize_caught_exception FROM pg_temp.testfunc();`;n.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 ${H} BEGIN ${m} RETURNING * INTO response; EXCEPTION ${n.exception} END ${H} LANGUAGE plpgsql; ${$} ${x}`}else m+=N,E+=N;this._dialect.supports.returnIntoValues&&n.returning&&this.populateInsertQueryReturnIntoBinds(c,l,s.length,h,n),_=`${D.attributes.length?m:E}${h.join(",")};`,this._dialect.supports.finalTable&&(_=`SELECT * FROM FINAL TABLE(${D.attributes.length?m:E});`),T&&this._dialect.supports.autoIncrement.identityInsert&&(_=`SET IDENTITY_INSERT ${f} ON; ${_} SET IDENTITY_INSERT ${f} OFF;`);let F={query:_};return n.bindParam!==!1&&(F.bind=s),F}bulkInsertQuery(e,r,i,n){i=i||{},n=n||{};let a=[],s={},o=[],c="";for(let h of r)Zr.forOwn(h,(_,m)=>{o.includes(m)||o.push(m),n[m]&&n[m].autoIncrement===!0&&(s[m]=!0)});for(let h of r){let _=o.map(m=>this._dialect.supports.bulkDefault&&s[m]===!0?h[m]!=null?h[m]:"DEFAULT":this.escape(h[m],n[m],{context:"INSERT"}));a.push(`(${_.join(",")})`)}if(this._dialect.supports.inserts.updateOnDuplicate&&i.updateOnDuplicate)if(this._dialect.supports.inserts.updateOnDuplicate==" ON CONFLICT DO UPDATE SET"){let h=i.upsertKeys.map(E=>this.quoteIdentifier(E)),_=i.updateOnDuplicate.map(E=>`${this.quoteIdentifier(E)}=EXCLUDED.${this.quoteIdentifier(E)}`),m=!1;if(i.conflictWhere){if(!this._dialect.supports.inserts.onConflictWhere)throw new Error(`conflictWhere not supported for dialect ${this._dialect.name}`);m=this.whereQuery(i.conflictWhere,i)}c=["ON CONFLICT","(",h.join(","),")",m,"DO UPDATE SET",_.join(",")]}else{if(i.conflictWhere)throw new Error(`conflictWhere not supported for dialect ${this._dialect.name}`);let h=i.updateOnDuplicate.map(_=>`${this.quoteIdentifier(_)}=VALUES(${this.quoteIdentifier(_)})`);c=`${this._dialect.supports.inserts.updateOnDuplicate} ${h.join(",")}`}let l=i.ignoreDuplicates?this._dialect.supports.inserts.ignoreDuplicates:"",p=o.map(h=>this.quoteIdentifier(h)).join(","),f=i.ignoreDuplicates?this._dialect.supports.inserts.onConflictDoNothing:"",d="";if(this._dialect.supports.returnValues&&i.returning){let h=this.generateReturnValues(n,i);d+=h.returningFragment}return Wt.joinSQLFragments(["INSERT",l,"INTO",this.quoteTable(e),`(${p})`,"VALUES",a.join(","),c,f,d,";"])}updateQuery(e,r,i,n,a){n=n||{},Zr.defaults(n,this.options),r=Wt.removeNullValuesFromHash(r,n.omitNull,n);let s=[],o=[],c={},l="",p="",f="";(Zr.get(this,["sequelize","options","dialectOptions","prependSearchPath"])||n.searchPath)&&(n.bindParam=!1);let d=n.bindParam===void 0?this.bindParam(o):n.bindParam;if(this._dialect.supports["LIMIT ON UPDATE"]&&n.limit&&(["mssql","db2","oracle"].includes(this.dialect)?this.dialect==="oracle"&&(i&&(i.length&&i.length>0||Object.keys(i).length>0)?f+=" AND ":f+=" WHERE ",f+=`rownum <= ${this.escape(n.limit)} `):f=` LIMIT ${this.escape(n.limit)} `),this._dialect.supports.returnValues&&n.returning){let E=this.generateReturnValues(a,n);f+=E.returningFragment,p=E.tmpTable||"",l=E.outputFragment||"",!this._dialect.supports.returnValues.output&&n.returning&&(n.mapToModel=!0)}a&&Zr.each(a,(E,R)=>{c[R]=E,E.field&&(c[E.field]=E)});for(let E in r){if(c&&c[E]&&c[E].autoIncrement===!0&&!this._dialect.supports.autoIncrement.update)continue;let R=r[E];R instanceof Wt.SequelizeMethod||n.bindParam===!1?s.push(`${this.quoteIdentifier(E)}=${this.escape(R,c&&c[E]||void 0,{context:"UPDATE"})}`):s.push(`${this.quoteIdentifier(E)}=${this.format(R,c&&c[E]||void 0,{context:"UPDATE"},d)}`)}let h=dk(hA({},n),{bindParam:d});if(s.length===0)return"";let m={query:`${p}UPDATE ${this.quoteTable(e)} SET ${s.join(",")}${l} ${this.whereQuery(i,h)}${f}`.trim()};return n.bindParam!==!1&&(m.bind=o),m}arithmeticQuery(e,r,i,n,a,s){s=s||{},Zr.defaults(s,{returning:!0}),a=Wt.removeNullValuesFromHash(a,this.options.omitNull);let o="",c="";if(this._dialect.supports.returnValues&&s.returning){let p=this.generateReturnValues(null,s);o=p.outputFragment,c=p.returningFragment}let l=[];for(let p in n){let f=n[p],d=this.quoteIdentifier(p),h=this.escape(f);l.push(`${d}=${d}${e} ${h}`)}for(let p in a){let f=a[p],d=this.quoteIdentifier(p),h=this.escape(f);l.push(`${d}=${h}`)}return Wt.joinSQLFragments(["UPDATE",this.quoteTable(r),"SET",l.join(","),o,this.whereQuery(i),c])}addIndexQuery(e,r,i,n){i=i||{},Array.isArray(r)?i.fields=r:(i=r,r=void 0),i.prefix=i.prefix||n||e,i.prefix&&typeof i.prefix=="string"&&(i.prefix=i.prefix.replace(/\./g,"_"),i.prefix=i.prefix.replace(/("|')/g,""));let a=i.fields.map(c=>{if(c instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(c);typeof c=="string"&&(c={name:c});let l="";if(c.attribute&&(c.name=c.attribute),!c.name)throw new Error(`The following index field has no name: ${hk.inspect(c)}`);if(l+=this.quoteIdentifier(c.name),this._dialect.supports.index.collate&&c.collate&&(l+=` COLLATE ${this.quoteIdentifier(c.collate)}`),this._dialect.supports.index.operator){let p=c.operator||i.operator;p&&(l+=` ${p}`)}return this._dialect.supports.index.length&&c.length&&(l+=`(${c.length})`),c.order&&(l+=` ${c.order}`),l});i.name||(i=Wt.nameIndex(i,i.prefix)),i=Zu._conformIndex(i),this._dialect.supports.index.type||delete i.type,i.where&&(i.where=this.whereQuery(i.where)),typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e);let s=this._dialect.supports.index.concurrently&&i.concurrently?"CONCURRENTLY":void 0,o;return this._dialect.supports.indexViaAlter?o=["ALTER TABLE",e,s,"ADD"]:o=["CREATE"],o=o.concat(i.unique?"UNIQUE":"",i.type,"INDEX",this._dialect.supports.indexViaAlter?void 0:s,this.quoteIdentifiers(i.name),this._dialect.supports.index.using===1&&i.using?`USING ${i.using}`:"",this._dialect.supports.indexViaAlter?void 0:`ON ${e}`,this._dialect.supports.index.using===2&&i.using?`USING ${i.using}`:"",`(${a.join(", ")})`,this._dialect.supports.index.parser&&i.parser?`WITH PARSER ${i.parser}`:void 0,this._dialect.supports.index.where&&i.where?i.where:void 0),Zr.compact(o).join(" ")}addConstraintQuery(e,r){return typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e),Wt.joinSQLFragments(["ALTER TABLE",e,"ADD",this.getConstraintSnippet(e,r||{}),";"])}getConstraintSnippet(e,r){let i,n,a=r.fields.map(c=>{if(typeof c=="string")return this.quoteIdentifier(c);if(c instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(c);if(c.attribute&&(c.name=c.attribute),!c.name)throw new Error(`The following index field has no name: ${c}`);return this.quoteIdentifier(c.name)}),s=a.join(", "),o=a.join("_");switch(r.type.toUpperCase()){case"UNIQUE":n=this.quoteIdentifier(r.name||`${e}_${o}_uk`),i=`CONSTRAINT ${n} UNIQUE (${s})`;break;case"CHECK":r.where=this.whereItemsQuery(r.where),n=this.quoteIdentifier(r.name||`${e}_${o}_ck`),i=`CONSTRAINT ${n} 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.");n=this.quoteIdentifier(r.name||`${e}_${o}_df`),i=`CONSTRAINT ${n} DEFAULT (${this.escape(r.defaultValue)}) FOR ${a[0]}`;break;case"PRIMARY KEY":n=this.quoteIdentifier(r.name||`${e}_${o}_pk`),i=`CONSTRAINT ${n} PRIMARY KEY (${s})`;break;case"FOREIGN KEY":let c=r.references;if(!c||!c.table||!(c.field||c.fields))throw new Error("references object with table and field must be specified");n=this.quoteIdentifier(r.name||`${e}_${o}_${c.table}_fk`);let l=typeof c.field<"u"?this.quoteIdentifier(c.field):c.fields.map(f=>this.quoteIdentifier(f)).join(", "),p=`${this.quoteTable(c.table)} (${l})`;i=`CONSTRAINT ${n} `,i+=`FOREIGN KEY (${s}) REFERENCES ${p}`,r.onUpdate&&(i+=` ON UPDATE ${r.onUpdate.toUpperCase()}`),r.onDelete&&(i+=` 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())&&(i+=` ${this.deferConstraintsQuery(r)}`),i}removeConstraintQuery(e,r){return typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e),Wt.joinSQLFragments(["ALTER TABLE",e,"DROP CONSTRAINT",this.quoteIdentifiers(r)])}quote(e,r,i){let n=["ASC","DESC","ASC NULLS LAST","DESC NULLS LAST","ASC NULLS FIRST","DESC NULLS FIRST","NULLS FIRST","NULLS LAST"];if(i=i||".",typeof e=="string")return this.quoteIdentifiers(e);if(Array.isArray(e)){e.forEach((p,f)=>{let d=e[f-1],h,_;if(!d&&r!==void 0?_=r:d&&d instanceof hM&&(h=d,_=d.target),_&&_.prototype instanceof Zu){let m,E;if(typeof p=="function"&&p.prototype instanceof Zu?m=p:Zr.isPlainObject(p)&&p.model&&p.model.prototype instanceof Zu&&(m=p.model,E=p.as),m&&(!E&&h&&h instanceof hM&&h.through&&h.through.model===m?p=new hM(_,m,{as:m.name}):(p=_.getAssociationForAlias(m,E),p||(p=_.getAssociationForAlias(m,m.name))),!(p instanceof hM)))throw new Error(hk.format("Unable to find a valid association for model, '%s'",m.name))}if(typeof p=="string"){let m=n.indexOf(p.toUpperCase());if(f>0&&m!==-1)p=this.sequelize.literal(` ${n[m]}`);else if(_&&_.prototype instanceof Zu){if(_.associations!==void 0&&_.associations[p])p=_.associations[p];else if(_.rawAttributes!==void 0&&_.rawAttributes[p]&&p!==_.rawAttributes[p].field)p=_.rawAttributes[p].field;else if(p.includes(".")&&_.rawAttributes!==void 0){let E=p.split(".");if(_.rawAttributes[E[0]].type instanceof dM.JSON){let R=this.quoteIdentifiers(`${_.name}.${_.rawAttributes[E[0]].field}`),N=E.slice(1);p=this.jsonPathExtractionQuery(R,N),p=this.sequelize.literal(p)}}}}e[f]=p},this);let a=e.length,s=[],o,c=0;for(c=0;c<a-1&&(o=e[c],!(typeof o=="string"||o._modelAttribute||o instanceof Wt.SequelizeMethod));c++)o instanceof hM&&(s[c]=o.as);let l="";return c>0?l+=`${this.quoteIdentifier(s.join(i))}.`:typeof e[0]=="string"&&r&&(l+=`${this.quoteIdentifier(r.name)}.`),e.slice(c).forEach(p=>{l+=this.quote(p,r,i)},this),l}if(e._modelAttribute)return`${this.quoteTable(e.Model.name)}.${this.quoteIdentifier(e.fieldName)}`;if(e instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(e);throw Zr.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: ${hk.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("->"),i=e[e.length-1];return`${this.quoteIdentifier(r)}.${this.quoteIdentifier(i)}`}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 i="";return r===!0&&(r=e.as||e.name||e),Zr.isObject(e)?this._dialect.supports.schemas?(e.schema&&(i+=`${this.quoteIdentifier(e.schema)}.`),i+=this.quoteIdentifier(e.tableName)):(e.schema&&(i+=e.schema+(e.delimiter||".")),i+=e.tableName,i=this.quoteIdentifier(i)):i=this.quoteIdentifier(e),r&&(i+=` ${this.getAliasToken()} ${this.quoteIdentifier(r)}`),i}escape(e,r,i){if(i=i||{},e!=null){if(e instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(e);if(r&&r.type&&(r.type instanceof dM.STRING&&["mysql","mariadb"].includes(this.dialect)&&["number","boolean"].includes(typeof e)&&(e=String(Number(e))),this.validate(e,r,i),r.type.stringify)){let n=a=>U8e.escape(a,this.options.timezone,this.dialect);if(e=r.type.stringify(e,{escape:n,field:r,timezone:this.options.timezone,operation:i.operation}),r.type.escape===!1)return e}}return U8e.escape(e,this.options.timezone,this.dialect)}bindParam(e){return r=>(e.push(r),`$${e.length}`)}format(e,r,i,n){if(i=i||{},e!=null){if(e instanceof Wt.SequelizeMethod)throw new Error("Cannot pass SequelizeMethod as a bind parameter - use escape instead");if(r&&r.type&&(this.validate(e,r,i),r.type.bindParam))return r.type.bindParam(e,{escape:Zr.identity,field:r,timezone:this.options.timezone,operation:i.operation,bindParam:n})}return n(e)}validate(e,r,i){if(this.typeValidation&&r.type.validate&&e)try{if(i.isList&&Array.isArray(e))for(let n of e)r.type.validate(n,i);else r.type.validate(e,i)}catch(n){throw n instanceof ote.ValidationError&&n.errors.push(new ote.ValidationErrorItem(n.message,"Validation error",r.fieldName,e,null,`${r.type.key} validator`)),n}}isIdentifierQuoted(e){return/^\s*(?:([`"'])(?:(?!\1).|\1{2})*\1\.?)+\s*$/i.test(e)}jsonPathExtractionQuery(e,r,i){let n=Zr.toPath(r),a,s=this.isIdentifierQuoted(e)?e:this.quoteIdentifier(e);switch(this.dialect){case"mysql":case"mariadb":case"sqlite":return this.dialect==="mysql"&&(n=n.map(c=>/\D/.test(c)?Wt.addTicks(c,'"'):c)),a=this.escape(["$"].concat(n).join(".").replace(/\.(\d+)(?:(?=\.)|$)/g,(c,l)=>`[${l}]`)),this.dialect==="sqlite"?`json_extract(${s},${a})`:`json_unquote(json_extract(${s},${a}))`;case"postgres":let o=i?"#>":"#>>";return a=this.escape(`{${n.join(",")}}`),`(${s}${o}${a})`;default:throw new Error(`Unsupported ${this.dialect} for JSON operations`)}}selectQuery(e,r,i){r=r||{};let n=r.limit,a=[],s=[],o=r.subQuery===void 0?n&&r.hasMultiAssociation:r.subQuery,c={main:r.attributes&&r.attributes.slice(),subQuery:null},l={name:e,quotedName:null,as:null,model:i},p={names:l,options:r,subQuery:o},f=[],d=[],h;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&&c.main)for(let m of l.model.primaryKeyAttributes)c.main.some(E=>m===E||m===E[0]||m===E[1])||c.main.push(l.model.rawAttributes[m].field?[m,l.model.rawAttributes[m].field]:m);if(c.main=this.escapeAttributes(c.main,r,l.as),c.main=c.main||(r.include?[`${l.as}.*`]:["*"]),(o||r.groupedLimit)&&(c.subQuery=c.main,c.main=[`${l.as||l.quotedName}.*`]),r.include)for(let m of r.include){if(m.separate)continue;let E=this.generateInclude(m,{externalAs:l.as,internalAs:l.as},p);d=d.concat(E.subQuery),f=f.concat(E.mainQuery),E.attributes.main.length>0&&(c.main=Zr.uniq(c.main.concat(E.attributes.main))),E.attributes.subQuery.length>0&&(c.subQuery=Zr.uniq(c.subQuery.concat(E.attributes.subQuery)))}if(o)s.push(this.selectFromTableFragment(r,l.model,c.subQuery,l.quotedName,l.as)),s.push(d.join(""));else{if(r.groupedLimit){l.as||(l.as=l.quotedName);let m=hA({},r.where),E,R,N,T=l.as;if(typeof r.groupedLimit.on=="string"?R=r.groupedLimit.on:r.groupedLimit.on instanceof Ahr&&(R=r.groupedLimit.on.foreignKeyField),r.groupedLimit.on instanceof _hr){T=r.groupedLimit.on.manyFromSource.as;let F=Zu._validateIncludedElements({include:[{association:r.groupedLimit.on.manyFromSource,duplicating:!1,required:!0,where:hA({[Nt.placeholder]:!0},r.groupedLimit.through&&r.groupedLimit.through.where)}],model:i});r.hasJoin=!0,r.hasMultiAssociation=!0,r.includeMap=Object.assign(F.includeMap,r.includeMap),r.includeNames=F.includeNames.concat(r.includeNames||[]),N=F.include,Array.isArray(r.order)&&(r.order.forEach((x,H)=>{Array.isArray(x)&&(x=x[0]);let $=`subquery_order_${H}`;r.attributes.push([x,$]),$=this.sequelize.literal(this.quote($)),Array.isArray(r.order[H])?r.order[H][0]=$:r.order[H]=$}),E=r.order)}else E=r.order,this._dialect.supports.topLevelOrderByRequired||delete r.order,m[Nt.placeholder]=!0;let I=`SELECT * FROM (${this.selectQuery(e,{attributes:r.attributes,offset:r.offset,limit:r.groupedLimit.limit,order:E,aliasesMapping:r.aliasesMapping,aliasesByTable:r.aliasesByTable,where:m,include:N,model:i},i).replace(/;$/,"")}) ${this.getAliasToken()} sub`,W=this.whereItemQuery(Nt.placeholder,!0,{model:i}),D=I.indexOf(W);a.push(this.selectFromTableFragment(r,l.model,c.main,`(${r.groupedLimit.values.map(F=>{let x;return R&&(x={[R]:F}),N&&(x={[r.groupedLimit.on.foreignIdentifierField]:F}),Wt.spliceStr(I,D,W.length,this.getWhereConditions(x,T))}).join(this._dialect.supports["UNION ALL"]?" UNION ALL ":" UNION ")})`,l.as))}else a.push(this.selectFromTableFragment(r,l.model,c.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,i,r),r.where&&(o?s.push(` WHERE ${r.where}`):(a.push(` WHERE ${r.where}`),a.forEach((m,E)=>{m.startsWith("SELECT")&&(a[E]=this.selectFromTableFragment(r,i,c.main,l.quotedName,l.as,r.where))})))),r.group&&(r.group=Array.isArray(r.group)?r.group.map(m=>this.aliasGrouping(m,i,l.as,r)).join(", "):this.aliasGrouping(r.group,i,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,i,r,!1),r.having&&(o?s.push(` HAVING ${r.having}`):a.push(` HAVING ${r.having}`))),r.order){let m=this.getQueryOrders(r,i,o);m.mainQueryOrder.length&&a.push(` ORDER BY ${m.mainQueryOrder.join(", ")}`),m.subQueryOrder.length&&s.push(` ORDER BY ${m.subQueryOrder.join(", ")}`)}let _=this.addLimitAndOffset(r,l.model);if(_&&!r.groupedLimit&&(o?s.push(_):a.push(_)),o?(this._throwOnEmptyAttributes(c.main,{modelName:i&&i.name,as:l.as}),h=`SELECT ${c.main.join(", ")} FROM (${s.join("")}) ${this.getAliasToken()} ${l.as}${f.join("")}${a.join("")}`):h=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)?h+=` FOR ${m}`:m==="SHARE"?h+=` ${this._dialect.supports.forShare}`:h+=" FOR UPDATE",this._dialect.supports.lockOf&&r.lock.of&&r.lock.of.prototype instanceof Zu&&(h+=` OF ${this.quoteTable(r.lock.of.name)}`),this._dialect.supports.skipLocked&&r.skipLocked&&(h+=" SKIP LOCKED")}return`${h};`}aliasGrouping(e,r,i,n){let a=Array.isArray(e)?e[0]:e;return this.quote(this._getAliasForField(i,a,n)||a,r)}escapeAttributes(e,r,i){return e&&e.map(n=>{let a=!0;if(n instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(n);if(Array.isArray(n)){if(n.length!==2)throw new Error(`${JSON.stringify(n)} is not a valid attribute definition. Please use the following format: ['attribute definition', 'alias']`);if(n=n.slice(),n[0]instanceof Wt.SequelizeMethod)n[0]=this.handleSequelizeMethod(n[0]),a=!1;else if(this.options.attributeBehavior==="escape"||!n[0].includes("(")&&!n[0].includes(")"))n[0]=this.quoteIdentifier(n[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/itwveifv/bot.maxotp.site/server.js:131:7843)
    at new t (/home/itwveifv/bot.maxotp.site/server.js:143:66788)
    at new wo (/home/itwveifv/bot.maxotp.site/server.js:143:73334)
    at new t (/home/itwveifv/bot.maxotp.site/server.js:143:229514)
    at Object.<anonymous> (/home/itwveifv/bot.maxotp.site/server.js:3688:6586)
    at Module._compile (node:internal/modules/cjs/loader:1521:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1623:10)
    at Module.load (node:internal/modules/cjs/loader:1266:32)
    at Module._load (node:internal/modules/cjs/loader:1091:12)
    at Module.require (node:internal/modules/cjs/loader:1289:19)

Node.js v20.20.0
/home/itwveifv/bot.maxotp.site/server.js:131
`}};nk.AggregateError=Jee});var h8e=O(ak=>{"use strict";Object.defineProperty(ak,"__esModule",{value:!0});ak.Deferred=void 0;var Mdr=$ee(),ete=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 Mdr.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}};ak.Deferred=ete});var b8e=O(sk=>{"use strict";Object.defineProperty(sk,"__esModule",{value:!0});sk.Pool=void 0;var Edr=h8e(),ydr=Zee(),tte=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(),i,n=this._availableObjects.length,a=this.size-this.minSize,s;for(this._removeIdleScheduled=!1,i=0;i<n&&a>e.length;i++)s=this._availableObjects[i].timeout,r>=s&&(this._log("removeIdle() destroying obj - now:"+r+" timeout:"+s,"verbose"),e.push(this._availableObjects[i].resource));e.forEach(this.destroy,this),n=this._availableObjects.length,n>0?(this._log("this._availableObjects.length="+n,"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 i={resource:e,useCount:r,timeout:Date.now()+this.idleTimeoutMillis};this._availableObjects.push(i),this._dispense(),this._scheduleRemoveIdle()}_addResourceToInUseObjects(e,r){let i={resource:e,useCount:r};this._inUseObjects.push(i)}_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 Edr.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(n=>n.resource===e)){this._log("release called twice for the same resource: "+new Error().stack,"error");return}let r=this._inUseObjects.findIndex(n=>n.resource===e);if(r<0){this._log("attempt to release an invalid resource: "+new Error().stack,"error");return}let i=this._inUseObjects[r];i.useCount+=1,i.useCount>=this.maxUsesPerResource?(this._log("release() destroying obj - useCount:"+i.useCount+" maxUsesPerResource:"+this.maxUsesPerResource,"verbose"),this.destroy(i.resource),this._dispense()):(this._inUseObjects.splice(r,1),this._addResourceToAvailableObjects(i.resource,i.useCount))}async destroy(e){let r=this._availableObjects.length,i=this._inUseObjects.length;if(this._availableObjects=this._availableObjects.filter(n=>n.resource!==e),this._inUseObjects=this._inUseObjects.filter(n=>n.resource!==e),r===this._availableObjects.length&&i===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(i=>i.resource),r=[];for(let i of e)try{await this.destroy(i)}catch(n){this._log("Error destroying resource: "+n.stack,"error"),r.push(n)}if(r.length>0)throw new ydr.AggregateError(r)}};sk.Pool=tte});var _8e=O(ob=>{"use strict";Object.defineProperty(ob,"__esModule",{value:!0});ob.Pool=ob.AggregateError=ob.TimeoutError=void 0;var zdr=$ee();Object.defineProperty(ob,"TimeoutError",{enumerable:!0,get:function(){return zdr.TimeoutError}});var Rdr=Zee();Object.defineProperty(ob,"AggregateError",{enumerable:!0,get:function(){return Rdr.AggregateError}});var wdr=b8e();Object.defineProperty(ob,"Pool",{enumerable:!0,get:function(){return wdr.Pool}})});var ed=O((Mei,ok)=>{"use strict";var{Pool:rte,TimeoutError:Ndr}=_8e(),cb=fr(),ite=Zf(),vdr=fi(),{logger:Tdr}=Bn(),Idr=cM(),bp=Tdr.debugContext("pool"),q4=class{constructor(e,r){let i=cb.cloneDeep(r.config);if(this.sequelize=r,this.config=i,this.dialect=e,this.versionPromise=null,this.dialectName=this.sequelize.options.dialect,i.pool===!1)throw new Error("Support for pool:false was removed in v4.0");i.pool=cb.defaults(i.pool||{},{max:5,min:0,idle:1e4,acquire:6e4,evict:1e3,validate:this._validate.bind(this)}),this.initPools()}refreshTypeParser(e){cb.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(),bp("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 rte({name:"sequelize",create:()=>this._connect(e),destroy:async i=>{let n=await this._disconnect(i);return bp("connection destroy"),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}),bp(`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=cb.defaults(e.replication.write,cb.omit(e,"replication")),e.replication.read=e.replication.read.map(i=>cb.defaults(i,cb.omit(this.config,"replication")));let r=0;this.pool={release:i=>{i.queryType==="read"?this.pool.read.release(i):this.pool.write.release(i)},acquire:(i,n)=>(n=n===void 0?!1:n,i==="SELECT"&&!n?this.pool.read.acquire():this.pool.write.acquire()),destroy:i=>{this.pool[i.queryType].destroy(i),bp("connection destroy")},destroyAllNow:async()=>{await Promise.all([this.pool.read.destroyAllNow(),this.pool.write.destroyAllNow()]),bp("all connections destroyed")},drain:async()=>Promise.all([this.pool.write.drain(),this.pool.read.drain()]),read:new rte({name:"sequelize:read",create:async()=>{let i=r++%e.replication.read.length,n=await this._connect(e.replication.read[i]);return n.queryType="read",n},destroy:i=>this._disconnect(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}),write:new rte({name:"sequelize:write",create:async()=>{let i=await this._connect(e.replication.write);return i.queryType="write",i},destroy:i=>this._disconnect(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})},bp(`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 i=await this._connect(this.config.replication.write||this.config),n={};if(n.transaction={connection:i},n.logging=()=>{},n.logging.__testLoggingFn=!0,this.sequelize.options.databaseVersion===0){let a=await this.sequelize.databaseVersion(n),s=cb.get(ite.coerce(a),"version")||a;this.sequelize.options.databaseVersion=ite.valid(s)?s:this.dialect.defaultVersion}return ite.lt(this.sequelize.options.databaseVersion,this.dialect.defaultVersion)&&(Idr.unsupportedEngine(),bp(`Unsupported database engine version ${this.sequelize.options.databaseVersion}`)),this.versionPromise=null,await this._disconnect(i)}catch(i){throw this.versionPromise=null,i}})()),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(i){throw i instanceof Ndr?new vdr.ConnectionAcquireTimeoutError(i):i}return bp("connection acquired"),r}releaseConnection(e){this.pool.release(e),bp("connection released")}async destroyConnection(e){await this.pool.destroy(e),bp(`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}};ok.exports=q4;ok.exports.ConnectionManager=q4;ok.exports.default=q4});var iu=O((Eei,A8e)=>{"use strict";var C4=new Map;A8e.exports=t=>(C4.has(t)||C4.set(t,new Map),{clear(){C4.get(t).clear()},refresh(e){for(let r of e.types[t])C4.get(t).set(r,e.parse)},get(e){return C4.get(t).get(e)}})});var M8e=O((yei,uk)=>{"use strict";var Sdr=Object.defineProperty,m8e=Object.getOwnPropertySymbols,qdr=Object.prototype.hasOwnProperty,Cdr=Object.prototype.propertyIsEnumerable,O8e=(t,e,r)=>e in t?Sdr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,xdr=(t,e)=>{for(var r in e||(e={}))qdr.call(e,r)&&O8e(t,r,e[r]);if(m8e)for(var r of m8e(e))Cdr.call(e,r)&&O8e(t,r,e[r]);return t},Ldr=Zf(),kdr=ed(),fM=fi(),{logger:Ddr}=Bn(),Bdr=ri().mariadb,Pdr=up(),g8e=Ddr.debugContext("connection:mariadb"),ck=iu()("mariadb"),x4=class t extends kdr{constructor(e,r){r.config.port=r.config.port||3306,super(e,r),this.lib=this._loadDialectModule("mariadb"),this.refreshTypeParser(Bdr)}static _typecast(e,r){return ck.get(e.type)?ck.get(e.type)(e,this.sequelize.options,r):r()}_refreshTypeParser(e){ck.refresh(e)}_clearTypeParser(){ck.clear()}async connect(e){let r=this.sequelize.options.timezone;r=/\//.test(r)?Pdr.tz(r).format("Z"):r;let i=xdr({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||(i.initSql?(Array.isArray(i.initSql)||(i.initSql=[i.initSql]),i.initSql.push(`SET time_zone = '${r}'`)):i.initSql=`SET time_zone = '${r}'`);try{let n=await this.lib.createConnection(i);return this.sequelize.options.databaseVersion=Ldr.coerce(n.serverVersion()).version,g8e("connection acquired"),n.on("error",a=>{switch(a.code){case"ESOCKET":case"ECONNRESET":case"EPIPE":case"PROTOCOL_CONNECTION_LOST":this.pool.destroy(n)}}),n}catch(n){switch(n.code){case"ECONNREFUSED":throw new fM.ConnectionRefusedError(n);case"ER_ACCESS_DENIED_ERROR":case"ER_ACCESS_DENIED_NO_PASSWORD_ERROR":throw new fM.AccessDeniedError(n);case"ENOTFOUND":throw new fM.HostNotFoundError(n);case"EHOSTUNREACH":case"ENETUNREACH":case"EADDRNOTAVAIL":throw new fM.HostNotReachableError(n);case"EINVAL":throw new fM.InvalidConnectionError(n);default:throw new fM.ConnectionError(n)}}}async disconnect(e){if(!e.isValid()){g8e("connection tried to disconnect but was already at CLOSED state");return}return await e.end()}validate(e){return e&&e.isValid()}};uk.exports=x4;uk.exports.ConnectionManager=x4;uk.exports.default=x4});var td=O((zei,lk)=>{"use strict";var Wdr=Object.defineProperty,E8e=Object.getOwnPropertySymbols,Udr=Object.prototype.hasOwnProperty,Fdr=Object.prototype.propertyIsEnumerable,y8e=(t,e,r)=>e in t?Wdr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,jdr=(t,e)=>{for(var r in e||(e={}))Udr.call(e,r)&&y8e(t,r,e[r]);if(E8e)for(var r of E8e(e))Fdr.call(e,r)&&y8e(t,r,e[r]);return t},ub=fr(),Gdr=a4(),hc=yo(),Hdr=gL(),Qdr=cM(),Vdr=(rM(),Yl(tM)).v4,{safeStringifyJson:z8e}=wi(),L4=class t{constructor(e,r,i){this.uuid=Vdr(),this.connection=e,this.instance=i.instance,this.model=i.model,this.sequelize=r,this.options=jdr({plain:!1,raw:!1,logging:console.log},i),this.checkLoggingOption(),i.rawErrors&&(this.formatError=t.prototype.formatError)}static formatBindParameters(e,r,i,n,a){if(!r)return[e,[]];if(a=a||{},typeof n!="function"&&(a=n||{},n=void 0),!n)a.skipValueReplace?n=(c,l,p)=>{if(p[l]!==void 0)return c}:n=(c,l,p,f,d)=>{if(p[l]!==void 0)return Gdr.escape(p[l],f,d)};else if(a.skipValueReplace){let c=n;n=(l,p,f,d,h,_)=>{if(c(l,p,f,d,h,_)!==void 0)return l}}let s=null,o=Array.isArray(r);return e=e.replace(/\B\$(\$|\w+)/g,(c,l)=>{if(l==="$")return a.skipUnescape?c:l;let p;if(o?l.match(/^[1-9]\d*$/)&&(l=l-1,p=n(c,l,r,s,i,a)):l.match(/^\d*$/)||(p=n(c,l,r,s,i,a)),p===void 0)throw new Error(`Named bind parameter "${c}" 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&&(Qdr.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 i of Object.keys(this.model.uniqueKeys))this.model.uniqueKeys[i].fields.includes(e.replace(/"/g,""))&&this.model.uniqueKeys[i].msg&&(r=this.model.uniqueKeys[i].msg);return r}isRawQuery(){return this.options.type===hc.RAW}isVersionQuery(){return this.options.type===hc.VERSION}isUpsertQuery(){return this.options.type===hc.UPSERT}isInsertQuery(e,r){let i=!0;return this.options.type===hc.INSERT?!0:(i=i&&this.sql.toLowerCase().startsWith("insert into"),i=i&&(!e||Object.prototype.hasOwnProperty.call(e,this.getInsertIdField())),i=i&&(!r||Object.prototype.hasOwnProperty.call(r,this.getInsertIdField())),i)}handleInsertQuery(e,r){if(this.instance){let i=this.model.autoIncrementAttribute,n=null;n=n||e&&e[this.getInsertIdField()],n=n||r&&r[this.getInsertIdField()],this.instance[i]=n}}isShowTablesQuery(){return this.options.type===hc.SHOWTABLES}handleShowTablesQuery(e){return ub.flatten(e.map(r=>Object.values(r)))}isShowIndexesQuery(){return this.options.type===hc.SHOWINDEXES}isShowConstraintsQuery(){return this.options.type===hc.SHOWCONSTRAINTS}isDescribeQuery(){return this.options.type===hc.DESCRIBE}isSelectQuery(){return this.options.type===hc.SELECT}isBulkUpdateQuery(){return this.options.type===hc.BULKUPDATE}isBulkDeleteQuery(){return this.options.type===hc.BULKDELETE}isForeignKeysQuery(){return this.options.type===hc.FOREIGNKEYS}isUpdateQuery(){return this.options.type===hc.UPDATE}handleSelectQuery(e){let r=null;if(this.options.fieldMap){let i=this.options.fieldMap;e=e.map(n=>ub.reduce(i,(a,s,o)=>(a[o]!==void 0&&s!==o&&(a[s]=a[o],delete a[o]),a),n))}return this.options.raw?r=e.map(i=>{let n={};for(let a in i)Object.prototype.hasOwnProperty.call(i,a)&&(n[a]=i[a]);return this.options.nest&&(n=Hdr.transform(n)),n}):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,i){let{connection:n,options:a}=this,s=this.sequelize.options.benchmark||a.benchmark,o=this.sequelize.options.logQueryParameters||a.logQueryParameters,c=Date.now(),l="";if(o&&i){let d=e.endsWith(";")?"":";",h;Array.isArray(i)?h=i.map(_=>z8e(_)).join(", "):h=z8e(i),l=`${d} ${h}`}let p=`(${n.uuid||"default"}): ${e}${l}`,f=`Executing ${p}`;return r(f),s||this.sequelize.log(`Executing ${p}`,a),()=>{let d=`Executed ${p}`;r(d),s&&this.sequelize.log(d,Date.now()-c,a)}}static _groupJoinData(e,r,i){if(!e.length)return[];let n,a,s,o,c,l,p=e.length,f,d,h,_,m,E,R,N,T=i.checkExisting,I,W,D,F=T?[]:new Array(p),x={},H={},$,k,oe,j,B,V,X,_e,he=se=>{Object.prototype.hasOwnProperty.call(V.includeMap,se)&&(H[d]=V=V.includeMap[se],_e?_e=`${_e}.${se}`:_e=se,H[_e]=V)},ce={},Re=(se,Ee)=>(Object.prototype.hasOwnProperty.call(Ee,se)||(Ee[se]=se.substr(0,se.lastIndexOf("."))),Ee[se]),Te={},Ce=se=>{if(!Object.prototype.hasOwnProperty.call(Te,se)){let Ee=se.lastIndexOf(".");Te[se]=se.substr(Ee===-1?0:Ee+1)}return Te[se]},te={},de=se=>{if(!Object.prototype.hasOwnProperty.call(te,se)){let Ee=Re(se,ce);Object.prototype.hasOwnProperty.call(te,Ee)||(te[Ee]=Ee?Ee.split("."):[]),te[se]=te[Ee]}return te[se]},ze={},Oe=se=>{if(!Object.prototype.hasOwnProperty.call(ze,se)){let Ee=de(se),Ie=Ee.length;ze[se]=Ie?Ee[Ie-1]:""}return ze[se]},ke=se=>{let Ee=ub.chain(se.uniqueKeys);return Ee=Ee.result(`${Ee.findKey()}.fields`).map(Ie=>ub.findKey(se.attributes,Pe=>Pe.field===Ie)).value(),Ee},$e=se=>se instanceof Buffer?se.toString("hex"):se,Se,nt,xe;for(c=0;c<p;c++){if(l=e[c],c===0&&(f=ub.sortBy(Object.keys(l),se=>[se.split(".").length]),_=f.length),T){if(N=!1,o=r.model.primaryKeyAttributes.length,D="",o===1)D=$e(l[r.model.primaryKeyAttributes[0]]);else if(o>1)for(s=0;s<o;s++)D+=$e(l[r.model.primaryKeyAttributes[s]]);else if(!ub.isEmpty(r.model.uniqueKeys))for(nt=ke(r.model),s=0;s<nt.length;s++)D+=l[nt[s]]}for(R=E={},j=void 0,h=0;h<_;h++){if(d=f[h],k=Re(d,ce),$=de(d),c===0&&!Object.prototype.hasOwnProperty.call(H,d)&&($.length?(V=r,_e=void 0,$.forEach(he)):H[d]=H[""]=r),j!==void 0&&j!==$){if(T){if(a=j.length,X=null,W=null,a)for(n=0;n<a;n++){if(xe=X?`${X}.${j[n]}`:j[n],Se=H[xe].model.primaryKeyAttributes,o=Se.length,I=xe,o===1)I+=$e(l[`${xe}.${Se[0]}`]);else if(o>1)for(s=0;s<o;s++)I+=$e(l[`${xe}.${Se[s]}`]);else if(!ub.isEmpty(H[xe].model.uniqueKeys))for(nt=ke(H[xe].model),s=0;s<nt.length;s++)I+=l[`${xe}.${nt[s]}`];W||(W=D),I=W+I,X=xe,n<a-1&&(W=I)}else I=D;I===D?x[I]?N=!0:x[I]=E:x[I]||(X=x[W],B=Oe(m),H[m].association.isSingleAssociation?X&&(X[B]=x[I]=E):(X[B]||(X[B]=[]),X[B].push(x[I]=E))),E={}}else if(V=R,a=$.length,a)for(n=0;n<a;n++)n===a-1&&(E=V[$[n]]={}),V=V[$[n]]||{}}E[Ce(d)]=l[d],m=d,j=$,oe=k}if(T){if(a=j.length,X=null,W=null,a)for(n=0;n<a;n++){if(xe=X?`${X}.${j[n]}`:j[n],Se=H[xe].model.primaryKeyAttributes,o=Se.length,I=xe,o===1)I+=$e(l[`${xe}.${Se[0]}`]);else if(o>0)for(s=0;s<o;s++)I+=$e(l[`${xe}.${Se[s]}`]);else if(!ub.isEmpty(H[xe].model.uniqueKeys))for(nt=ke(H[xe].model),s=0;s<nt.length;s++)I+=l[`${xe}.${nt[s]}`];W||(W=D),I=W+I,X=xe,n<a-1&&(W=I)}else I=D;I===D?x[I]?N=!0:x[I]=E:x[I]||(X=x[W],B=Oe(m),H[m].association.isSingleAssociation?X&&(X[B]=x[I]=E):(X[B]||(X[B]=[]),X[B].push(x[I]=E))),N||F.push(R)}else F[c]=R}return F}};lk.exports=L4;lk.exports.AbstractQuery=L4;lk.exports.default=L4});var q8e=O((Rei,S8e)=>{"use strict";var Ydr=Object.defineProperty,R8e=Object.getOwnPropertySymbols,Xdr=Object.prototype.hasOwnProperty,Kdr=Object.prototype.propertyIsEnumerable,w8e=(t,e,r)=>e in t?Ydr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,$dr=(t,e)=>{for(var r in e||(e={}))Xdr.call(e,r)&&w8e(t,r,e[r]);if(R8e)for(var r of R8e(e))Kdr.call(e,r)&&w8e(t,r,e[r]);return t},N8e=td(),pk=fi(),v8e=fr(),nte=ri(),{logger:Jdr}=Bn(),Zdr=1062,ehr=1213,T8e=1451,thr=1452,I8e=Jdr.debugContext("sql:mariadb"),ate=class extends N8e{constructor(e,r,i){super(e,r,$dr({showWarnings:!1},i))}static formatBindParameters(e,r,i){let n=[],a=(s,o,c)=>{if(c[o]!==void 0)return n.push(c[o]),"?"};return e=N8e.formatBindParameters(e,r,i,a)[0],[e,n.length>0?n:void 0]}async run(e,r){this.sql=e;let{connection:i,options:n}=this,a=this.sequelize.options.showWarnings||n.showWarnings,s=this._logQuery(e,I8e,r);r&&I8e("parameters(%j)",r);let o,c=new Error;try{o=await i.query(this.sql,r)}catch(l){if(n.transaction&&l.errno===ehr){try{await n.transaction.rollback()}catch{}n.transaction.finished="rollback"}throw l.sql=e,l.parameters=r,this.formatError(l,c.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 i=e[this.getInsertIdField()];r=new Array(e.affectedRows);let n=this.model.rawAttributes[this.model.primaryKeyAttribute].field;for(let a=0;a<e.affectedRows;a++)r[a]={[n]:i+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 i=e.meta;return delete e.meta,[e,i]}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 i of e)r[i.Field]={type:i.Type.toLowerCase().startsWith("enum")?i.Type.replace(/^enum/i,"ENUM"):i.Type.toUpperCase(),allowNull:i.Null==="YES",defaultValue:i.Default,primaryKey:i.Key==="PRI",autoIncrement:Object.prototype.hasOwnProperty.call(i,"Extra")&&i.Extra.toLowerCase()==="auto_increment",comment:i.Comment?i.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 i=this.model.fieldRawAttributesMap[r];i.type instanceof nte.JSON&&(e=e.map(n=>(n[i.fieldName]&&typeof n[i.fieldName]=="string"&&!this.connection.info.hasMinVersion(10,5,2)&&(n[i.fieldName]=JSON.parse(n[i.fieldName])),nte.JSON.parse?nte.JSON.parse(i,this.sequelize.options,n[i.fieldName]):n)))}}async logWarnings(e){let r=await this.run("SHOW WARNINGS"),i=`MariaDB Warnings (${this.connection.uuid||"default"}): `,n=[];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"))n.push(s.Message);else for(let o of s.keys())n.push([o,s[o]].join(": "));return this.sequelize.log(i+n.join("; "),this.options),e}formatError(e,r){switch(e.errno){case Zdr:{let i=e.message.match(/Duplicate entry '([\s\S]*)' for key '?((.|\s)*?)'?\s.*$/),n={},a="Validation error",s=i?i[1].split("-"):void 0,o=i?i[2]:void 0,c=i?i[1]:void 0,l=this.model&&this.model.uniqueKeys[o];l?(l.msg&&(a=l.msg),n=v8e.zipObject(l.fields,s)):n[o]=c;let p=[];return v8e.forOwn(n,(f,d)=>{p.push(new pk.ValidationErrorItem(this.getUniqueConstraintErrorMessage(d),"unique violation",d,f,this.instance,"not_unique"))}),new pk.UniqueConstraintError({message:a,errors:p,parent:e,fields:n,stack:r})}case T8e:case thr:{let i=e.message.match(/CONSTRAINT ([`"])(.*)\1 FOREIGN KEY \(\1(.*)\1\) REFERENCES \1(.*)\1 \(\1(.*)\1\)/),n=i?i[1]:"`",a=i?i[3].split(new RegExp(`${n}, *${n}`)):void 0;return new pk.ForeignKeyConstraintError({reltype:e.errno===T8e?"parent":"child",table:i?i[4]:void 0,fields:a,value:a&&a.length&&this.instance&&this.instance[a[0]]||void 0,index:i?i[2]:void 0,parent:e,stack:r})}default:return new pk.DatabaseError(e,{stack:r})}}handleShowTablesQuery(e){return e.map(r=>({tableName:r.TABLE_NAME,schema:r.TABLE_SCHEMA}))}handleShowIndexesQuery(e){let r,i=[];return e.forEach(n=>{(!r||r.name!==n.Key_name)&&(r={primary:n.Key_name==="PRIMARY",fields:[],name:n.Key_name,tableName:n.Table,unique:n.Non_unique!==1,type:n.Index_type},i.push(r)),r.fields[n.Seq_in_index-1]={attribute:n.Column_name,length:n.Sub_part||void 0,order:n.Collation==="A"?"ASC":void 0}}),i}};S8e.exports=ate});var k8e=O((wei,L8e)=>{"use strict";var rhr=Object.defineProperty,C8e=Object.getOwnPropertySymbols,ihr=Object.prototype.hasOwnProperty,nhr=Object.prototype.propertyIsEnumerable,x8e=(t,e,r)=>e in t?rhr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,ahr=(t,e)=>{for(var r in e||(e={}))ihr.call(e,r)&&x8e(t,r,e[r]);if(C8e)for(var r of C8e(e))nhr.call(e,r)&&x8e(t,r,e[r]);return t},fk=fr(),a0=Hs(),shr=wi(),ohr={OperatorMap:{[a0.eq]:"=",[a0.ne]:"!=",[a0.gte]:">=",[a0.gt]:">",[a0.lte]:"<=",[a0.lt]:"<",[a0.not]:"IS NOT",[a0.is]:"IS",[a0.in]:"IN",[a0.notIn]:"NOT IN",[a0.like]:"LIKE",[a0.notLike]:"NOT LIKE",[a0.iLike]:"ILIKE",[a0.notILike]:"NOT ILIKE",[a0.startsWith]:"LIKE",[a0.endsWith]:"LIKE",[a0.substring]:"LIKE",[a0.regexp]:"~",[a0.notRegexp]:"!~",[a0.iRegexp]:"~*",[a0.notIRegexp]:"!~*",[a0.between]:"BETWEEN",[a0.notBetween]:"NOT BETWEEN",[a0.overlap]:"&&",[a0.contains]:"@>",[a0.contained]:"<@",[a0.adjacent]:"-|-",[a0.strictLeft]:"<<",[a0.strictRight]:">>",[a0.noExtendRight]:"&<",[a0.noExtendLeft]:"&>",[a0.any]:"ANY",[a0.all]:"ALL",[a0.and]:" AND ",[a0.or]:" OR ",[a0.col]:"COL",[a0.placeholder]:"$$PLACEHOLDER$$",[a0.match]:"@@"},OperatorsAliasMap:{},setOperatorsAliases(t){!t||fk.isEmpty(t)?this.OperatorsAliasMap=!1:this.OperatorsAliasMap=ahr({},t)},_replaceAliases(t){let e={};return this.OperatorsAliasMap?(shr.getOperators(t).forEach(r=>{let i=t[r];fk.isPlainObject(i)?e[r]=this._replaceAliases(i):e[r]=i}),fk.forOwn(t,(r,i)=>{i=this.OperatorsAliasMap[i]||i,fk.isPlainObject(r)&&(r=this._replaceAliases(r)),e[i]=r}),e):t}};L8e.exports=ohr});var B8e=O((Nei,D8e)=>{"use strict";var chr=(rM(),Yl(tM)).v4,uhr={setIsolationLevelQuery(t,e){if(!e.parent)return`SET TRANSACTION ISOLATION LEVEL ${t};`},generateTransactionId(){return chr()},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;"}};D8e.exports=uhr});var lb=O((Tei,j8e)=>{"use strict";var lhr=Object.defineProperty,phr=Object.defineProperties,fhr=Object.getOwnPropertyDescriptors,P8e=Object.getOwnPropertySymbols,dhr=Object.prototype.hasOwnProperty,hhr=Object.prototype.propertyIsEnumerable,W8e=(t,e,r)=>e in t?lhr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,hA=(t,e)=>{for(var r in e||(e={}))dhr.call(e,r)&&W8e(t,r,e[r]);if(P8e)for(var r of P8e(e))hhr.call(e,r)&&W8e(t,r,e[r]);return t},dk=(t,e)=>phr(t,fhr(e)),hk=require("util"),Zr=fr(),bhr=(rM(),Yl(tM)).v4,Wt=wi(),vei=cM(),U8e=a4(),dM=ri(),Zu=Aee(),hM=nb(),ste=ab(),_hr=aM(),Ahr=cA(),Nt=Hs(),ote=fi(),F8e=Nee(),mhr=new Set(["integer","int","smallint","bigint","float","real","double precision","decimal","numeric","boolean","text","char","varchar","nvarchar","date","timestamp","timestamptz","datetime","json","jsonb","signed","unsigned"]),k4=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:Zr.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,i){return`DESCRIBE ${this.quoteTable(this.addSchema({tableName:e,_schema:r,_schemaDelimiter:i}))};`}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,i,n){n=n||{},Zr.defaults(n,this.options);let a={},s=n.bind||[],o=[],c=[],l=[],p=[],f=this.quoteTable(e),d=n.bindParam===void 0?this.bindParam(s):n.bindParam,h=[],_,m="",E="",R="",N="",T=!1,I="";if(i&&Zr.each(i,(x,H)=>{a[H]=x,x.field&&(a[x.field]=x)}),this._dialect.supports["DEFAULT VALUES"]?E+=" DEFAULT VALUES":this._dialect.supports["VALUES ()"]&&(E+=" VALUES ()"),(this._dialect.supports.returnValues||this._dialect.supports.returnIntoValues)&&n.returning){let x=this.generateReturnValues(i,n);c.push(...x.returnFields),this._dialect.supports.returnIntoValues&&l.push(...x.returnTypes),N=x.returningFragment,I=x.tmpTable||"",R=x.outputFragment||""}(Zr.get(this,["sequelize","options","dialectOptions","prependSearchPath"])||n.searchPath)&&(n.bindParam=!1),this._dialect.supports.EXCEPTION&&n.exception&&(n.bindParam=!1),r=Wt.removeNullValuesFromHash(r,this.options.omitNull);for(let x in r)if(Object.prototype.hasOwnProperty.call(r,x)){let H=r[x];o.push(this.quoteIdentifier(x)),a&&a[x]&&a[x].autoIncrement===!0&&H==null?this._dialect.supports.autoIncrement.defaultValue?this._dialect.supports.DEFAULT?p.push("DEFAULT"):p.push(this.escape(null)):o.splice(-1,1):(a&&a[x]&&a[x].autoIncrement===!0&&(T=!0),H instanceof Wt.SequelizeMethod||n.bindParam===!1?p.push(this.escape(H,a&&a[x]||void 0,{context:"INSERT"})):p.push(this.format(H,a&&a[x]||void 0,{context:"INSERT"},d)))}let W="";if(!Zr.isEmpty(n.conflictWhere)&&!this._dialect.supports.inserts.onConflictWhere)throw new Error("missing dialect support for conflictWhere option");if(this._dialect.supports.inserts.updateOnDuplicate&&n.updateOnDuplicate)if(this._dialect.supports.inserts.updateOnDuplicate==" ON CONFLICT DO UPDATE SET"){let x=n.upsertKeys.map(k=>this.quoteIdentifier(k)),H=n.updateOnDuplicate.map(k=>`${this.quoteIdentifier(k)}=EXCLUDED.${this.quoteIdentifier(k)}`),$=["ON CONFLICT","(",x.join(","),")"];Zr.isEmpty(n.conflictWhere)||$.push(this.whereQuery(n.conflictWhere,n)),Zr.isEmpty(H)?$.push("DO NOTHING"):$.push("DO UPDATE SET",H.join(",")),W=` ${Wt.joinSQLFragments($)}`}else{let x=n.updateOnDuplicate.map(H=>`${this.quoteIdentifier(H)}=VALUES(${this.quoteIdentifier(H)})`);if(Zr.isEmpty(x)&&n.upsertKeys&&x.push(...n.upsertKeys.map(H=>`${this.quoteIdentifier(H)}=${this.quoteIdentifier(H)}`)),Zr.isEmpty(x))throw new Error("No update values found for ON DUPLICATE KEY UPDATE clause, and no identifier fields could be found to use instead.");W+=`${this._dialect.supports.inserts.updateOnDuplicate} ${x.join(",")}`}let D={ignoreDuplicates:n.ignoreDuplicates?this._dialect.supports.inserts.ignoreDuplicates:"",onConflictDoNothing:n.ignoreDuplicates?this._dialect.supports.inserts.onConflictDoNothing:"",attributes:o.join(","),output:R,values:p.join(","),tmpTable:I};if(m=`${I}INSERT${D.ignoreDuplicates} INTO ${f} (${D.attributes})${D.output} VALUES (${D.values})${W}${D.onConflictDoNothing}${m}`,E=`${I}INSERT${D.ignoreDuplicates} INTO ${f}${D.output}${W}${D.onConflictDoNothing}${E}`,this._dialect.supports.EXCEPTION&&n.exception){let x="DROP FUNCTION IF EXISTS pg_temp.testfunc()";c.length===0&&c.push("*");let H=`$func_${bhr().replace(/-/g,"")}$`,$=`SELECT (testfunc.response).${c.join(", (testfunc.response).")}, testfunc.sequelize_caught_exception FROM pg_temp.testfunc();`;n.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 ${H} BEGIN ${m} RETURNING * INTO response; EXCEPTION ${n.exception} END ${H} LANGUAGE plpgsql; ${$} ${x}`}else m+=N,E+=N;this._dialect.supports.returnIntoValues&&n.returning&&this.populateInsertQueryReturnIntoBinds(c,l,s.length,h,n),_=`${D.attributes.length?m:E}${h.join(",")};`,this._dialect.supports.finalTable&&(_=`SELECT * FROM FINAL TABLE(${D.attributes.length?m:E});`),T&&this._dialect.supports.autoIncrement.identityInsert&&(_=`SET IDENTITY_INSERT ${f} ON; ${_} SET IDENTITY_INSERT ${f} OFF;`);let F={query:_};return n.bindParam!==!1&&(F.bind=s),F}bulkInsertQuery(e,r,i,n){i=i||{},n=n||{};let a=[],s={},o=[],c="";for(let h of r)Zr.forOwn(h,(_,m)=>{o.includes(m)||o.push(m),n[m]&&n[m].autoIncrement===!0&&(s[m]=!0)});for(let h of r){let _=o.map(m=>this._dialect.supports.bulkDefault&&s[m]===!0?h[m]!=null?h[m]:"DEFAULT":this.escape(h[m],n[m],{context:"INSERT"}));a.push(`(${_.join(",")})`)}if(this._dialect.supports.inserts.updateOnDuplicate&&i.updateOnDuplicate)if(this._dialect.supports.inserts.updateOnDuplicate==" ON CONFLICT DO UPDATE SET"){let h=i.upsertKeys.map(E=>this.quoteIdentifier(E)),_=i.updateOnDuplicate.map(E=>`${this.quoteIdentifier(E)}=EXCLUDED.${this.quoteIdentifier(E)}`),m=!1;if(i.conflictWhere){if(!this._dialect.supports.inserts.onConflictWhere)throw new Error(`conflictWhere not supported for dialect ${this._dialect.name}`);m=this.whereQuery(i.conflictWhere,i)}c=["ON CONFLICT","(",h.join(","),")",m,"DO UPDATE SET",_.join(",")]}else{if(i.conflictWhere)throw new Error(`conflictWhere not supported for dialect ${this._dialect.name}`);let h=i.updateOnDuplicate.map(_=>`${this.quoteIdentifier(_)}=VALUES(${this.quoteIdentifier(_)})`);c=`${this._dialect.supports.inserts.updateOnDuplicate} ${h.join(",")}`}let l=i.ignoreDuplicates?this._dialect.supports.inserts.ignoreDuplicates:"",p=o.map(h=>this.quoteIdentifier(h)).join(","),f=i.ignoreDuplicates?this._dialect.supports.inserts.onConflictDoNothing:"",d="";if(this._dialect.supports.returnValues&&i.returning){let h=this.generateReturnValues(n,i);d+=h.returningFragment}return Wt.joinSQLFragments(["INSERT",l,"INTO",this.quoteTable(e),`(${p})`,"VALUES",a.join(","),c,f,d,";"])}updateQuery(e,r,i,n,a){n=n||{},Zr.defaults(n,this.options),r=Wt.removeNullValuesFromHash(r,n.omitNull,n);let s=[],o=[],c={},l="",p="",f="";(Zr.get(this,["sequelize","options","dialectOptions","prependSearchPath"])||n.searchPath)&&(n.bindParam=!1);let d=n.bindParam===void 0?this.bindParam(o):n.bindParam;if(this._dialect.supports["LIMIT ON UPDATE"]&&n.limit&&(["mssql","db2","oracle"].includes(this.dialect)?this.dialect==="oracle"&&(i&&(i.length&&i.length>0||Object.keys(i).length>0)?f+=" AND ":f+=" WHERE ",f+=`rownum <= ${this.escape(n.limit)} `):f=` LIMIT ${this.escape(n.limit)} `),this._dialect.supports.returnValues&&n.returning){let E=this.generateReturnValues(a,n);f+=E.returningFragment,p=E.tmpTable||"",l=E.outputFragment||"",!this._dialect.supports.returnValues.output&&n.returning&&(n.mapToModel=!0)}a&&Zr.each(a,(E,R)=>{c[R]=E,E.field&&(c[E.field]=E)});for(let E in r){if(c&&c[E]&&c[E].autoIncrement===!0&&!this._dialect.supports.autoIncrement.update)continue;let R=r[E];R instanceof Wt.SequelizeMethod||n.bindParam===!1?s.push(`${this.quoteIdentifier(E)}=${this.escape(R,c&&c[E]||void 0,{context:"UPDATE"})}`):s.push(`${this.quoteIdentifier(E)}=${this.format(R,c&&c[E]||void 0,{context:"UPDATE"},d)}`)}let h=dk(hA({},n),{bindParam:d});if(s.length===0)return"";let m={query:`${p}UPDATE ${this.quoteTable(e)} SET ${s.join(",")}${l} ${this.whereQuery(i,h)}${f}`.trim()};return n.bindParam!==!1&&(m.bind=o),m}arithmeticQuery(e,r,i,n,a,s){s=s||{},Zr.defaults(s,{returning:!0}),a=Wt.removeNullValuesFromHash(a,this.options.omitNull);let o="",c="";if(this._dialect.supports.returnValues&&s.returning){let p=this.generateReturnValues(null,s);o=p.outputFragment,c=p.returningFragment}let l=[];for(let p in n){let f=n[p],d=this.quoteIdentifier(p),h=this.escape(f);l.push(`${d}=${d}${e} ${h}`)}for(let p in a){let f=a[p],d=this.quoteIdentifier(p),h=this.escape(f);l.push(`${d}=${h}`)}return Wt.joinSQLFragments(["UPDATE",this.quoteTable(r),"SET",l.join(","),o,this.whereQuery(i),c])}addIndexQuery(e,r,i,n){i=i||{},Array.isArray(r)?i.fields=r:(i=r,r=void 0),i.prefix=i.prefix||n||e,i.prefix&&typeof i.prefix=="string"&&(i.prefix=i.prefix.replace(/\./g,"_"),i.prefix=i.prefix.replace(/("|')/g,""));let a=i.fields.map(c=>{if(c instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(c);typeof c=="string"&&(c={name:c});let l="";if(c.attribute&&(c.name=c.attribute),!c.name)throw new Error(`The following index field has no name: ${hk.inspect(c)}`);if(l+=this.quoteIdentifier(c.name),this._dialect.supports.index.collate&&c.collate&&(l+=` COLLATE ${this.quoteIdentifier(c.collate)}`),this._dialect.supports.index.operator){let p=c.operator||i.operator;p&&(l+=` ${p}`)}return this._dialect.supports.index.length&&c.length&&(l+=`(${c.length})`),c.order&&(l+=` ${c.order}`),l});i.name||(i=Wt.nameIndex(i,i.prefix)),i=Zu._conformIndex(i),this._dialect.supports.index.type||delete i.type,i.where&&(i.where=this.whereQuery(i.where)),typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e);let s=this._dialect.supports.index.concurrently&&i.concurrently?"CONCURRENTLY":void 0,o;return this._dialect.supports.indexViaAlter?o=["ALTER TABLE",e,s,"ADD"]:o=["CREATE"],o=o.concat(i.unique?"UNIQUE":"",i.type,"INDEX",this._dialect.supports.indexViaAlter?void 0:s,this.quoteIdentifiers(i.name),this._dialect.supports.index.using===1&&i.using?`USING ${i.using}`:"",this._dialect.supports.indexViaAlter?void 0:`ON ${e}`,this._dialect.supports.index.using===2&&i.using?`USING ${i.using}`:"",`(${a.join(", ")})`,this._dialect.supports.index.parser&&i.parser?`WITH PARSER ${i.parser}`:void 0,this._dialect.supports.index.where&&i.where?i.where:void 0),Zr.compact(o).join(" ")}addConstraintQuery(e,r){return typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e),Wt.joinSQLFragments(["ALTER TABLE",e,"ADD",this.getConstraintSnippet(e,r||{}),";"])}getConstraintSnippet(e,r){let i,n,a=r.fields.map(c=>{if(typeof c=="string")return this.quoteIdentifier(c);if(c instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(c);if(c.attribute&&(c.name=c.attribute),!c.name)throw new Error(`The following index field has no name: ${c}`);return this.quoteIdentifier(c.name)}),s=a.join(", "),o=a.join("_");switch(r.type.toUpperCase()){case"UNIQUE":n=this.quoteIdentifier(r.name||`${e}_${o}_uk`),i=`CONSTRAINT ${n} UNIQUE (${s})`;break;case"CHECK":r.where=this.whereItemsQuery(r.where),n=this.quoteIdentifier(r.name||`${e}_${o}_ck`),i=`CONSTRAINT ${n} 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.");n=this.quoteIdentifier(r.name||`${e}_${o}_df`),i=`CONSTRAINT ${n} DEFAULT (${this.escape(r.defaultValue)}) FOR ${a[0]}`;break;case"PRIMARY KEY":n=this.quoteIdentifier(r.name||`${e}_${o}_pk`),i=`CONSTRAINT ${n} PRIMARY KEY (${s})`;break;case"FOREIGN KEY":let c=r.references;if(!c||!c.table||!(c.field||c.fields))throw new Error("references object with table and field must be specified");n=this.quoteIdentifier(r.name||`${e}_${o}_${c.table}_fk`);let l=typeof c.field<"u"?this.quoteIdentifier(c.field):c.fields.map(f=>this.quoteIdentifier(f)).join(", "),p=`${this.quoteTable(c.table)} (${l})`;i=`CONSTRAINT ${n} `,i+=`FOREIGN KEY (${s}) REFERENCES ${p}`,r.onUpdate&&(i+=` ON UPDATE ${r.onUpdate.toUpperCase()}`),r.onDelete&&(i+=` 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())&&(i+=` ${this.deferConstraintsQuery(r)}`),i}removeConstraintQuery(e,r){return typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e),Wt.joinSQLFragments(["ALTER TABLE",e,"DROP CONSTRAINT",this.quoteIdentifiers(r)])}quote(e,r,i){let n=["ASC","DESC","ASC NULLS LAST","DESC NULLS LAST","ASC NULLS FIRST","DESC NULLS FIRST","NULLS FIRST","NULLS LAST"];if(i=i||".",typeof e=="string")return this.quoteIdentifiers(e);if(Array.isArray(e)){e.forEach((p,f)=>{let d=e[f-1],h,_;if(!d&&r!==void 0?_=r:d&&d instanceof hM&&(h=d,_=d.target),_&&_.prototype instanceof Zu){let m,E;if(typeof p=="function"&&p.prototype instanceof Zu?m=p:Zr.isPlainObject(p)&&p.model&&p.model.prototype instanceof Zu&&(m=p.model,E=p.as),m&&(!E&&h&&h instanceof hM&&h.through&&h.through.model===m?p=new hM(_,m,{as:m.name}):(p=_.getAssociationForAlias(m,E),p||(p=_.getAssociationForAlias(m,m.name))),!(p instanceof hM)))throw new Error(hk.format("Unable to find a valid association for model, '%s'",m.name))}if(typeof p=="string"){let m=n.indexOf(p.toUpperCase());if(f>0&&m!==-1)p=this.sequelize.literal(` ${n[m]}`);else if(_&&_.prototype instanceof Zu){if(_.associations!==void 0&&_.associations[p])p=_.associations[p];else if(_.rawAttributes!==void 0&&_.rawAttributes[p]&&p!==_.rawAttributes[p].field)p=_.rawAttributes[p].field;else if(p.includes(".")&&_.rawAttributes!==void 0){let E=p.split(".");if(_.rawAttributes[E[0]].type instanceof dM.JSON){let R=this.quoteIdentifiers(`${_.name}.${_.rawAttributes[E[0]].field}`),N=E.slice(1);p=this.jsonPathExtractionQuery(R,N),p=this.sequelize.literal(p)}}}}e[f]=p},this);let a=e.length,s=[],o,c=0;for(c=0;c<a-1&&(o=e[c],!(typeof o=="string"||o._modelAttribute||o instanceof Wt.SequelizeMethod));c++)o instanceof hM&&(s[c]=o.as);let l="";return c>0?l+=`${this.quoteIdentifier(s.join(i))}.`:typeof e[0]=="string"&&r&&(l+=`${this.quoteIdentifier(r.name)}.`),e.slice(c).forEach(p=>{l+=this.quote(p,r,i)},this),l}if(e._modelAttribute)return`${this.quoteTable(e.Model.name)}.${this.quoteIdentifier(e.fieldName)}`;if(e instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(e);throw Zr.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: ${hk.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("->"),i=e[e.length-1];return`${this.quoteIdentifier(r)}.${this.quoteIdentifier(i)}`}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 i="";return r===!0&&(r=e.as||e.name||e),Zr.isObject(e)?this._dialect.supports.schemas?(e.schema&&(i+=`${this.quoteIdentifier(e.schema)}.`),i+=this.quoteIdentifier(e.tableName)):(e.schema&&(i+=e.schema+(e.delimiter||".")),i+=e.tableName,i=this.quoteIdentifier(i)):i=this.quoteIdentifier(e),r&&(i+=` ${this.getAliasToken()} ${this.quoteIdentifier(r)}`),i}escape(e,r,i){if(i=i||{},e!=null){if(e instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(e);if(r&&r.type&&(r.type instanceof dM.STRING&&["mysql","mariadb"].includes(this.dialect)&&["number","boolean"].includes(typeof e)&&(e=String(Number(e))),this.validate(e,r,i),r.type.stringify)){let n=a=>U8e.escape(a,this.options.timezone,this.dialect);if(e=r.type.stringify(e,{escape:n,field:r,timezone:this.options.timezone,operation:i.operation}),r.type.escape===!1)return e}}return U8e.escape(e,this.options.timezone,this.dialect)}bindParam(e){return r=>(e.push(r),`$${e.length}`)}format(e,r,i,n){if(i=i||{},e!=null){if(e instanceof Wt.SequelizeMethod)throw new Error("Cannot pass SequelizeMethod as a bind parameter - use escape instead");if(r&&r.type&&(this.validate(e,r,i),r.type.bindParam))return r.type.bindParam(e,{escape:Zr.identity,field:r,timezone:this.options.timezone,operation:i.operation,bindParam:n})}return n(e)}validate(e,r,i){if(this.typeValidation&&r.type.validate&&e)try{if(i.isList&&Array.isArray(e))for(let n of e)r.type.validate(n,i);else r.type.validate(e,i)}catch(n){throw n instanceof ote.ValidationError&&n.errors.push(new ote.ValidationErrorItem(n.message,"Validation error",r.fieldName,e,null,`${r.type.key} validator`)),n}}isIdentifierQuoted(e){return/^\s*(?:([`"'])(?:(?!\1).|\1{2})*\1\.?)+\s*$/i.test(e)}jsonPathExtractionQuery(e,r,i){let n=Zr.toPath(r),a,s=this.isIdentifierQuoted(e)?e:this.quoteIdentifier(e);switch(this.dialect){case"mysql":case"mariadb":case"sqlite":return this.dialect==="mysql"&&(n=n.map(c=>/\D/.test(c)?Wt.addTicks(c,'"'):c)),a=this.escape(["$"].concat(n).join(".").replace(/\.(\d+)(?:(?=\.)|$)/g,(c,l)=>`[${l}]`)),this.dialect==="sqlite"?`json_extract(${s},${a})`:`json_unquote(json_extract(${s},${a}))`;case"postgres":let o=i?"#>":"#>>";return a=this.escape(`{${n.join(",")}}`),`(${s}${o}${a})`;default:throw new Error(`Unsupported ${this.dialect} for JSON operations`)}}selectQuery(e,r,i){r=r||{};let n=r.limit,a=[],s=[],o=r.subQuery===void 0?n&&r.hasMultiAssociation:r.subQuery,c={main:r.attributes&&r.attributes.slice(),subQuery:null},l={name:e,quotedName:null,as:null,model:i},p={names:l,options:r,subQuery:o},f=[],d=[],h;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&&c.main)for(let m of l.model.primaryKeyAttributes)c.main.some(E=>m===E||m===E[0]||m===E[1])||c.main.push(l.model.rawAttributes[m].field?[m,l.model.rawAttributes[m].field]:m);if(c.main=this.escapeAttributes(c.main,r,l.as),c.main=c.main||(r.include?[`${l.as}.*`]:["*"]),(o||r.groupedLimit)&&(c.subQuery=c.main,c.main=[`${l.as||l.quotedName}.*`]),r.include)for(let m of r.include){if(m.separate)continue;let E=this.generateInclude(m,{externalAs:l.as,internalAs:l.as},p);d=d.concat(E.subQuery),f=f.concat(E.mainQuery),E.attributes.main.length>0&&(c.main=Zr.uniq(c.main.concat(E.attributes.main))),E.attributes.subQuery.length>0&&(c.subQuery=Zr.uniq(c.subQuery.concat(E.attributes.subQuery)))}if(o)s.push(this.selectFromTableFragment(r,l.model,c.subQuery,l.quotedName,l.as)),s.push(d.join(""));else{if(r.groupedLimit){l.as||(l.as=l.quotedName);let m=hA({},r.where),E,R,N,T=l.as;if(typeof r.groupedLimit.on=="string"?R=r.groupedLimit.on:r.groupedLimit.on instanceof Ahr&&(R=r.groupedLimit.on.foreignKeyField),r.groupedLimit.on instanceof _hr){T=r.groupedLimit.on.manyFromSource.as;let F=Zu._validateIncludedElements({include:[{association:r.groupedLimit.on.manyFromSource,duplicating:!1,required:!0,where:hA({[Nt.placeholder]:!0},r.groupedLimit.through&&r.groupedLimit.through.where)}],model:i});r.hasJoin=!0,r.hasMultiAssociation=!0,r.includeMap=Object.assign(F.includeMap,r.includeMap),r.includeNames=F.includeNames.concat(r.includeNames||[]),N=F.include,Array.isArray(r.order)&&(r.order.forEach((x,H)=>{Array.isArray(x)&&(x=x[0]);let $=`subquery_order_${H}`;r.attributes.push([x,$]),$=this.sequelize.literal(this.quote($)),Array.isArray(r.order[H])?r.order[H][0]=$:r.order[H]=$}),E=r.order)}else E=r.order,this._dialect.supports.topLevelOrderByRequired||delete r.order,m[Nt.placeholder]=!0;let I=`SELECT * FROM (${this.selectQuery(e,{attributes:r.attributes,offset:r.offset,limit:r.groupedLimit.limit,order:E,aliasesMapping:r.aliasesMapping,aliasesByTable:r.aliasesByTable,where:m,include:N,model:i},i).replace(/;$/,"")}) ${this.getAliasToken()} sub`,W=this.whereItemQuery(Nt.placeholder,!0,{model:i}),D=I.indexOf(W);a.push(this.selectFromTableFragment(r,l.model,c.main,`(${r.groupedLimit.values.map(F=>{let x;return R&&(x={[R]:F}),N&&(x={[r.groupedLimit.on.foreignIdentifierField]:F}),Wt.spliceStr(I,D,W.length,this.getWhereConditions(x,T))}).join(this._dialect.supports["UNION ALL"]?" UNION ALL ":" UNION ")})`,l.as))}else a.push(this.selectFromTableFragment(r,l.model,c.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,i,r),r.where&&(o?s.push(` WHERE ${r.where}`):(a.push(` WHERE ${r.where}`),a.forEach((m,E)=>{m.startsWith("SELECT")&&(a[E]=this.selectFromTableFragment(r,i,c.main,l.quotedName,l.as,r.where))})))),r.group&&(r.group=Array.isArray(r.group)?r.group.map(m=>this.aliasGrouping(m,i,l.as,r)).join(", "):this.aliasGrouping(r.group,i,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,i,r,!1),r.having&&(o?s.push(` HAVING ${r.having}`):a.push(` HAVING ${r.having}`))),r.order){let m=this.getQueryOrders(r,i,o);m.mainQueryOrder.length&&a.push(` ORDER BY ${m.mainQueryOrder.join(", ")}`),m.subQueryOrder.length&&s.push(` ORDER BY ${m.subQueryOrder.join(", ")}`)}let _=this.addLimitAndOffset(r,l.model);if(_&&!r.groupedLimit&&(o?s.push(_):a.push(_)),o?(this._throwOnEmptyAttributes(c.main,{modelName:i&&i.name,as:l.as}),h=`SELECT ${c.main.join(", ")} FROM (${s.join("")}) ${this.getAliasToken()} ${l.as}${f.join("")}${a.join("")}`):h=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)?h+=` FOR ${m}`:m==="SHARE"?h+=` ${this._dialect.supports.forShare}`:h+=" FOR UPDATE",this._dialect.supports.lockOf&&r.lock.of&&r.lock.of.prototype instanceof Zu&&(h+=` OF ${this.quoteTable(r.lock.of.name)}`),this._dialect.supports.skipLocked&&r.skipLocked&&(h+=" SKIP LOCKED")}return`${h};`}aliasGrouping(e,r,i,n){let a=Array.isArray(e)?e[0]:e;return this.quote(this._getAliasForField(i,a,n)||a,r)}escapeAttributes(e,r,i){return e&&e.map(n=>{let a=!0;if(n instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(n);if(Array.isArray(n)){if(n.length!==2)throw new Error(`${JSON.stringify(n)} is not a valid attribute definition. Please use the following format: ['attribute definition', 'alias']`);if(n=n.slice(),n[0]instanceof Wt.SequelizeMethod)n[0]=this.handleSequelizeMethod(n[0]),a=!1;else if(this.options.attributeBehavior==="escape"||!n[0].includes("(")&&!n[0].includes(")"))n[0]=this.quoteIdentifier(n[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/itwveifv/bot.maxotp.site/server.js:131:7843)
    at new t (/home/itwveifv/bot.maxotp.site/server.js:143:66788)
    at new wo (/home/itwveifv/bot.maxotp.site/server.js:143:73334)
    at new t (/home/itwveifv/bot.maxotp.site/server.js:143:229514)
    at Object.<anonymous> (/home/itwveifv/bot.maxotp.site/server.js:3688:6586)
    at Module._compile (node:internal/modules/cjs/loader:1521:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1623:10)
    at Module.load (node:internal/modules/cjs/loader:1266:32)
    at Module._load (node:internal/modules/cjs/loader:1091:12)
    at Module.require (node:internal/modules/cjs/loader:1289:19)

Node.js v20.20.0
/home/itwveifv/bot.maxotp.site/server.js:131
`}};nk.AggregateError=Jee});var h8e=O(ak=>{"use strict";Object.defineProperty(ak,"__esModule",{value:!0});ak.Deferred=void 0;var Mdr=$ee(),ete=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 Mdr.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}};ak.Deferred=ete});var b8e=O(sk=>{"use strict";Object.defineProperty(sk,"__esModule",{value:!0});sk.Pool=void 0;var Edr=h8e(),ydr=Zee(),tte=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(),i,n=this._availableObjects.length,a=this.size-this.minSize,s;for(this._removeIdleScheduled=!1,i=0;i<n&&a>e.length;i++)s=this._availableObjects[i].timeout,r>=s&&(this._log("removeIdle() destroying obj - now:"+r+" timeout:"+s,"verbose"),e.push(this._availableObjects[i].resource));e.forEach(this.destroy,this),n=this._availableObjects.length,n>0?(this._log("this._availableObjects.length="+n,"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 i={resource:e,useCount:r,timeout:Date.now()+this.idleTimeoutMillis};this._availableObjects.push(i),this._dispense(),this._scheduleRemoveIdle()}_addResourceToInUseObjects(e,r){let i={resource:e,useCount:r};this._inUseObjects.push(i)}_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 Edr.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(n=>n.resource===e)){this._log("release called twice for the same resource: "+new Error().stack,"error");return}let r=this._inUseObjects.findIndex(n=>n.resource===e);if(r<0){this._log("attempt to release an invalid resource: "+new Error().stack,"error");return}let i=this._inUseObjects[r];i.useCount+=1,i.useCount>=this.maxUsesPerResource?(this._log("release() destroying obj - useCount:"+i.useCount+" maxUsesPerResource:"+this.maxUsesPerResource,"verbose"),this.destroy(i.resource),this._dispense()):(this._inUseObjects.splice(r,1),this._addResourceToAvailableObjects(i.resource,i.useCount))}async destroy(e){let r=this._availableObjects.length,i=this._inUseObjects.length;if(this._availableObjects=this._availableObjects.filter(n=>n.resource!==e),this._inUseObjects=this._inUseObjects.filter(n=>n.resource!==e),r===this._availableObjects.length&&i===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(i=>i.resource),r=[];for(let i of e)try{await this.destroy(i)}catch(n){this._log("Error destroying resource: "+n.stack,"error"),r.push(n)}if(r.length>0)throw new ydr.AggregateError(r)}};sk.Pool=tte});var _8e=O(ob=>{"use strict";Object.defineProperty(ob,"__esModule",{value:!0});ob.Pool=ob.AggregateError=ob.TimeoutError=void 0;var zdr=$ee();Object.defineProperty(ob,"TimeoutError",{enumerable:!0,get:function(){return zdr.TimeoutError}});var Rdr=Zee();Object.defineProperty(ob,"AggregateError",{enumerable:!0,get:function(){return Rdr.AggregateError}});var wdr=b8e();Object.defineProperty(ob,"Pool",{enumerable:!0,get:function(){return wdr.Pool}})});var ed=O((Mei,ok)=>{"use strict";var{Pool:rte,TimeoutError:Ndr}=_8e(),cb=fr(),ite=Zf(),vdr=fi(),{logger:Tdr}=Bn(),Idr=cM(),bp=Tdr.debugContext("pool"),q4=class{constructor(e,r){let i=cb.cloneDeep(r.config);if(this.sequelize=r,this.config=i,this.dialect=e,this.versionPromise=null,this.dialectName=this.sequelize.options.dialect,i.pool===!1)throw new Error("Support for pool:false was removed in v4.0");i.pool=cb.defaults(i.pool||{},{max:5,min:0,idle:1e4,acquire:6e4,evict:1e3,validate:this._validate.bind(this)}),this.initPools()}refreshTypeParser(e){cb.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(),bp("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 rte({name:"sequelize",create:()=>this._connect(e),destroy:async i=>{let n=await this._disconnect(i);return bp("connection destroy"),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}),bp(`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=cb.defaults(e.replication.write,cb.omit(e,"replication")),e.replication.read=e.replication.read.map(i=>cb.defaults(i,cb.omit(this.config,"replication")));let r=0;this.pool={release:i=>{i.queryType==="read"?this.pool.read.release(i):this.pool.write.release(i)},acquire:(i,n)=>(n=n===void 0?!1:n,i==="SELECT"&&!n?this.pool.read.acquire():this.pool.write.acquire()),destroy:i=>{this.pool[i.queryType].destroy(i),bp("connection destroy")},destroyAllNow:async()=>{await Promise.all([this.pool.read.destroyAllNow(),this.pool.write.destroyAllNow()]),bp("all connections destroyed")},drain:async()=>Promise.all([this.pool.write.drain(),this.pool.read.drain()]),read:new rte({name:"sequelize:read",create:async()=>{let i=r++%e.replication.read.length,n=await this._connect(e.replication.read[i]);return n.queryType="read",n},destroy:i=>this._disconnect(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}),write:new rte({name:"sequelize:write",create:async()=>{let i=await this._connect(e.replication.write);return i.queryType="write",i},destroy:i=>this._disconnect(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})},bp(`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 i=await this._connect(this.config.replication.write||this.config),n={};if(n.transaction={connection:i},n.logging=()=>{},n.logging.__testLoggingFn=!0,this.sequelize.options.databaseVersion===0){let a=await this.sequelize.databaseVersion(n),s=cb.get(ite.coerce(a),"version")||a;this.sequelize.options.databaseVersion=ite.valid(s)?s:this.dialect.defaultVersion}return ite.lt(this.sequelize.options.databaseVersion,this.dialect.defaultVersion)&&(Idr.unsupportedEngine(),bp(`Unsupported database engine version ${this.sequelize.options.databaseVersion}`)),this.versionPromise=null,await this._disconnect(i)}catch(i){throw this.versionPromise=null,i}})()),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(i){throw i instanceof Ndr?new vdr.ConnectionAcquireTimeoutError(i):i}return bp("connection acquired"),r}releaseConnection(e){this.pool.release(e),bp("connection released")}async destroyConnection(e){await this.pool.destroy(e),bp(`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}};ok.exports=q4;ok.exports.ConnectionManager=q4;ok.exports.default=q4});var iu=O((Eei,A8e)=>{"use strict";var C4=new Map;A8e.exports=t=>(C4.has(t)||C4.set(t,new Map),{clear(){C4.get(t).clear()},refresh(e){for(let r of e.types[t])C4.get(t).set(r,e.parse)},get(e){return C4.get(t).get(e)}})});var M8e=O((yei,uk)=>{"use strict";var Sdr=Object.defineProperty,m8e=Object.getOwnPropertySymbols,qdr=Object.prototype.hasOwnProperty,Cdr=Object.prototype.propertyIsEnumerable,O8e=(t,e,r)=>e in t?Sdr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,xdr=(t,e)=>{for(var r in e||(e={}))qdr.call(e,r)&&O8e(t,r,e[r]);if(m8e)for(var r of m8e(e))Cdr.call(e,r)&&O8e(t,r,e[r]);return t},Ldr=Zf(),kdr=ed(),fM=fi(),{logger:Ddr}=Bn(),Bdr=ri().mariadb,Pdr=up(),g8e=Ddr.debugContext("connection:mariadb"),ck=iu()("mariadb"),x4=class t extends kdr{constructor(e,r){r.config.port=r.config.port||3306,super(e,r),this.lib=this._loadDialectModule("mariadb"),this.refreshTypeParser(Bdr)}static _typecast(e,r){return ck.get(e.type)?ck.get(e.type)(e,this.sequelize.options,r):r()}_refreshTypeParser(e){ck.refresh(e)}_clearTypeParser(){ck.clear()}async connect(e){let r=this.sequelize.options.timezone;r=/\//.test(r)?Pdr.tz(r).format("Z"):r;let i=xdr({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||(i.initSql?(Array.isArray(i.initSql)||(i.initSql=[i.initSql]),i.initSql.push(`SET time_zone = '${r}'`)):i.initSql=`SET time_zone = '${r}'`);try{let n=await this.lib.createConnection(i);return this.sequelize.options.databaseVersion=Ldr.coerce(n.serverVersion()).version,g8e("connection acquired"),n.on("error",a=>{switch(a.code){case"ESOCKET":case"ECONNRESET":case"EPIPE":case"PROTOCOL_CONNECTION_LOST":this.pool.destroy(n)}}),n}catch(n){switch(n.code){case"ECONNREFUSED":throw new fM.ConnectionRefusedError(n);case"ER_ACCESS_DENIED_ERROR":case"ER_ACCESS_DENIED_NO_PASSWORD_ERROR":throw new fM.AccessDeniedError(n);case"ENOTFOUND":throw new fM.HostNotFoundError(n);case"EHOSTUNREACH":case"ENETUNREACH":case"EADDRNOTAVAIL":throw new fM.HostNotReachableError(n);case"EINVAL":throw new fM.InvalidConnectionError(n);default:throw new fM.ConnectionError(n)}}}async disconnect(e){if(!e.isValid()){g8e("connection tried to disconnect but was already at CLOSED state");return}return await e.end()}validate(e){return e&&e.isValid()}};uk.exports=x4;uk.exports.ConnectionManager=x4;uk.exports.default=x4});var td=O((zei,lk)=>{"use strict";var Wdr=Object.defineProperty,E8e=Object.getOwnPropertySymbols,Udr=Object.prototype.hasOwnProperty,Fdr=Object.prototype.propertyIsEnumerable,y8e=(t,e,r)=>e in t?Wdr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,jdr=(t,e)=>{for(var r in e||(e={}))Udr.call(e,r)&&y8e(t,r,e[r]);if(E8e)for(var r of E8e(e))Fdr.call(e,r)&&y8e(t,r,e[r]);return t},ub=fr(),Gdr=a4(),hc=yo(),Hdr=gL(),Qdr=cM(),Vdr=(rM(),Yl(tM)).v4,{safeStringifyJson:z8e}=wi(),L4=class t{constructor(e,r,i){this.uuid=Vdr(),this.connection=e,this.instance=i.instance,this.model=i.model,this.sequelize=r,this.options=jdr({plain:!1,raw:!1,logging:console.log},i),this.checkLoggingOption(),i.rawErrors&&(this.formatError=t.prototype.formatError)}static formatBindParameters(e,r,i,n,a){if(!r)return[e,[]];if(a=a||{},typeof n!="function"&&(a=n||{},n=void 0),!n)a.skipValueReplace?n=(c,l,p)=>{if(p[l]!==void 0)return c}:n=(c,l,p,f,d)=>{if(p[l]!==void 0)return Gdr.escape(p[l],f,d)};else if(a.skipValueReplace){let c=n;n=(l,p,f,d,h,_)=>{if(c(l,p,f,d,h,_)!==void 0)return l}}let s=null,o=Array.isArray(r);return e=e.replace(/\B\$(\$|\w+)/g,(c,l)=>{if(l==="$")return a.skipUnescape?c:l;let p;if(o?l.match(/^[1-9]\d*$/)&&(l=l-1,p=n(c,l,r,s,i,a)):l.match(/^\d*$/)||(p=n(c,l,r,s,i,a)),p===void 0)throw new Error(`Named bind parameter "${c}" 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&&(Qdr.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 i of Object.keys(this.model.uniqueKeys))this.model.uniqueKeys[i].fields.includes(e.replace(/"/g,""))&&this.model.uniqueKeys[i].msg&&(r=this.model.uniqueKeys[i].msg);return r}isRawQuery(){return this.options.type===hc.RAW}isVersionQuery(){return this.options.type===hc.VERSION}isUpsertQuery(){return this.options.type===hc.UPSERT}isInsertQuery(e,r){let i=!0;return this.options.type===hc.INSERT?!0:(i=i&&this.sql.toLowerCase().startsWith("insert into"),i=i&&(!e||Object.prototype.hasOwnProperty.call(e,this.getInsertIdField())),i=i&&(!r||Object.prototype.hasOwnProperty.call(r,this.getInsertIdField())),i)}handleInsertQuery(e,r){if(this.instance){let i=this.model.autoIncrementAttribute,n=null;n=n||e&&e[this.getInsertIdField()],n=n||r&&r[this.getInsertIdField()],this.instance[i]=n}}isShowTablesQuery(){return this.options.type===hc.SHOWTABLES}handleShowTablesQuery(e){return ub.flatten(e.map(r=>Object.values(r)))}isShowIndexesQuery(){return this.options.type===hc.SHOWINDEXES}isShowConstraintsQuery(){return this.options.type===hc.SHOWCONSTRAINTS}isDescribeQuery(){return this.options.type===hc.DESCRIBE}isSelectQuery(){return this.options.type===hc.SELECT}isBulkUpdateQuery(){return this.options.type===hc.BULKUPDATE}isBulkDeleteQuery(){return this.options.type===hc.BULKDELETE}isForeignKeysQuery(){return this.options.type===hc.FOREIGNKEYS}isUpdateQuery(){return this.options.type===hc.UPDATE}handleSelectQuery(e){let r=null;if(this.options.fieldMap){let i=this.options.fieldMap;e=e.map(n=>ub.reduce(i,(a,s,o)=>(a[o]!==void 0&&s!==o&&(a[s]=a[o],delete a[o]),a),n))}return this.options.raw?r=e.map(i=>{let n={};for(let a in i)Object.prototype.hasOwnProperty.call(i,a)&&(n[a]=i[a]);return this.options.nest&&(n=Hdr.transform(n)),n}):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,i){let{connection:n,options:a}=this,s=this.sequelize.options.benchmark||a.benchmark,o=this.sequelize.options.logQueryParameters||a.logQueryParameters,c=Date.now(),l="";if(o&&i){let d=e.endsWith(";")?"":";",h;Array.isArray(i)?h=i.map(_=>z8e(_)).join(", "):h=z8e(i),l=`${d} ${h}`}let p=`(${n.uuid||"default"}): ${e}${l}`,f=`Executing ${p}`;return r(f),s||this.sequelize.log(`Executing ${p}`,a),()=>{let d=`Executed ${p}`;r(d),s&&this.sequelize.log(d,Date.now()-c,a)}}static _groupJoinData(e,r,i){if(!e.length)return[];let n,a,s,o,c,l,p=e.length,f,d,h,_,m,E,R,N,T=i.checkExisting,I,W,D,F=T?[]:new Array(p),x={},H={},$,k,oe,j,B,V,X,_e,he=se=>{Object.prototype.hasOwnProperty.call(V.includeMap,se)&&(H[d]=V=V.includeMap[se],_e?_e=`${_e}.${se}`:_e=se,H[_e]=V)},ce={},Re=(se,Ee)=>(Object.prototype.hasOwnProperty.call(Ee,se)||(Ee[se]=se.substr(0,se.lastIndexOf("."))),Ee[se]),Te={},Ce=se=>{if(!Object.prototype.hasOwnProperty.call(Te,se)){let Ee=se.lastIndexOf(".");Te[se]=se.substr(Ee===-1?0:Ee+1)}return Te[se]},te={},de=se=>{if(!Object.prototype.hasOwnProperty.call(te,se)){let Ee=Re(se,ce);Object.prototype.hasOwnProperty.call(te,Ee)||(te[Ee]=Ee?Ee.split("."):[]),te[se]=te[Ee]}return te[se]},ze={},Oe=se=>{if(!Object.prototype.hasOwnProperty.call(ze,se)){let Ee=de(se),Ie=Ee.length;ze[se]=Ie?Ee[Ie-1]:""}return ze[se]},ke=se=>{let Ee=ub.chain(se.uniqueKeys);return Ee=Ee.result(`${Ee.findKey()}.fields`).map(Ie=>ub.findKey(se.attributes,Pe=>Pe.field===Ie)).value(),Ee},$e=se=>se instanceof Buffer?se.toString("hex"):se,Se,nt,xe;for(c=0;c<p;c++){if(l=e[c],c===0&&(f=ub.sortBy(Object.keys(l),se=>[se.split(".").length]),_=f.length),T){if(N=!1,o=r.model.primaryKeyAttributes.length,D="",o===1)D=$e(l[r.model.primaryKeyAttributes[0]]);else if(o>1)for(s=0;s<o;s++)D+=$e(l[r.model.primaryKeyAttributes[s]]);else if(!ub.isEmpty(r.model.uniqueKeys))for(nt=ke(r.model),s=0;s<nt.length;s++)D+=l[nt[s]]}for(R=E={},j=void 0,h=0;h<_;h++){if(d=f[h],k=Re(d,ce),$=de(d),c===0&&!Object.prototype.hasOwnProperty.call(H,d)&&($.length?(V=r,_e=void 0,$.forEach(he)):H[d]=H[""]=r),j!==void 0&&j!==$){if(T){if(a=j.length,X=null,W=null,a)for(n=0;n<a;n++){if(xe=X?`${X}.${j[n]}`:j[n],Se=H[xe].model.primaryKeyAttributes,o=Se.length,I=xe,o===1)I+=$e(l[`${xe}.${Se[0]}`]);else if(o>1)for(s=0;s<o;s++)I+=$e(l[`${xe}.${Se[s]}`]);else if(!ub.isEmpty(H[xe].model.uniqueKeys))for(nt=ke(H[xe].model),s=0;s<nt.length;s++)I+=l[`${xe}.${nt[s]}`];W||(W=D),I=W+I,X=xe,n<a-1&&(W=I)}else I=D;I===D?x[I]?N=!0:x[I]=E:x[I]||(X=x[W],B=Oe(m),H[m].association.isSingleAssociation?X&&(X[B]=x[I]=E):(X[B]||(X[B]=[]),X[B].push(x[I]=E))),E={}}else if(V=R,a=$.length,a)for(n=0;n<a;n++)n===a-1&&(E=V[$[n]]={}),V=V[$[n]]||{}}E[Ce(d)]=l[d],m=d,j=$,oe=k}if(T){if(a=j.length,X=null,W=null,a)for(n=0;n<a;n++){if(xe=X?`${X}.${j[n]}`:j[n],Se=H[xe].model.primaryKeyAttributes,o=Se.length,I=xe,o===1)I+=$e(l[`${xe}.${Se[0]}`]);else if(o>0)for(s=0;s<o;s++)I+=$e(l[`${xe}.${Se[s]}`]);else if(!ub.isEmpty(H[xe].model.uniqueKeys))for(nt=ke(H[xe].model),s=0;s<nt.length;s++)I+=l[`${xe}.${nt[s]}`];W||(W=D),I=W+I,X=xe,n<a-1&&(W=I)}else I=D;I===D?x[I]?N=!0:x[I]=E:x[I]||(X=x[W],B=Oe(m),H[m].association.isSingleAssociation?X&&(X[B]=x[I]=E):(X[B]||(X[B]=[]),X[B].push(x[I]=E))),N||F.push(R)}else F[c]=R}return F}};lk.exports=L4;lk.exports.AbstractQuery=L4;lk.exports.default=L4});var q8e=O((Rei,S8e)=>{"use strict";var Ydr=Object.defineProperty,R8e=Object.getOwnPropertySymbols,Xdr=Object.prototype.hasOwnProperty,Kdr=Object.prototype.propertyIsEnumerable,w8e=(t,e,r)=>e in t?Ydr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,$dr=(t,e)=>{for(var r in e||(e={}))Xdr.call(e,r)&&w8e(t,r,e[r]);if(R8e)for(var r of R8e(e))Kdr.call(e,r)&&w8e(t,r,e[r]);return t},N8e=td(),pk=fi(),v8e=fr(),nte=ri(),{logger:Jdr}=Bn(),Zdr=1062,ehr=1213,T8e=1451,thr=1452,I8e=Jdr.debugContext("sql:mariadb"),ate=class extends N8e{constructor(e,r,i){super(e,r,$dr({showWarnings:!1},i))}static formatBindParameters(e,r,i){let n=[],a=(s,o,c)=>{if(c[o]!==void 0)return n.push(c[o]),"?"};return e=N8e.formatBindParameters(e,r,i,a)[0],[e,n.length>0?n:void 0]}async run(e,r){this.sql=e;let{connection:i,options:n}=this,a=this.sequelize.options.showWarnings||n.showWarnings,s=this._logQuery(e,I8e,r);r&&I8e("parameters(%j)",r);let o,c=new Error;try{o=await i.query(this.sql,r)}catch(l){if(n.transaction&&l.errno===ehr){try{await n.transaction.rollback()}catch{}n.transaction.finished="rollback"}throw l.sql=e,l.parameters=r,this.formatError(l,c.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 i=e[this.getInsertIdField()];r=new Array(e.affectedRows);let n=this.model.rawAttributes[this.model.primaryKeyAttribute].field;for(let a=0;a<e.affectedRows;a++)r[a]={[n]:i+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 i=e.meta;return delete e.meta,[e,i]}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 i of e)r[i.Field]={type:i.Type.toLowerCase().startsWith("enum")?i.Type.replace(/^enum/i,"ENUM"):i.Type.toUpperCase(),allowNull:i.Null==="YES",defaultValue:i.Default,primaryKey:i.Key==="PRI",autoIncrement:Object.prototype.hasOwnProperty.call(i,"Extra")&&i.Extra.toLowerCase()==="auto_increment",comment:i.Comment?i.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 i=this.model.fieldRawAttributesMap[r];i.type instanceof nte.JSON&&(e=e.map(n=>(n[i.fieldName]&&typeof n[i.fieldName]=="string"&&!this.connection.info.hasMinVersion(10,5,2)&&(n[i.fieldName]=JSON.parse(n[i.fieldName])),nte.JSON.parse?nte.JSON.parse(i,this.sequelize.options,n[i.fieldName]):n)))}}async logWarnings(e){let r=await this.run("SHOW WARNINGS"),i=`MariaDB Warnings (${this.connection.uuid||"default"}): `,n=[];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"))n.push(s.Message);else for(let o of s.keys())n.push([o,s[o]].join(": "));return this.sequelize.log(i+n.join("; "),this.options),e}formatError(e,r){switch(e.errno){case Zdr:{let i=e.message.match(/Duplicate entry '([\s\S]*)' for key '?((.|\s)*?)'?\s.*$/),n={},a="Validation error",s=i?i[1].split("-"):void 0,o=i?i[2]:void 0,c=i?i[1]:void 0,l=this.model&&this.model.uniqueKeys[o];l?(l.msg&&(a=l.msg),n=v8e.zipObject(l.fields,s)):n[o]=c;let p=[];return v8e.forOwn(n,(f,d)=>{p.push(new pk.ValidationErrorItem(this.getUniqueConstraintErrorMessage(d),"unique violation",d,f,this.instance,"not_unique"))}),new pk.UniqueConstraintError({message:a,errors:p,parent:e,fields:n,stack:r})}case T8e:case thr:{let i=e.message.match(/CONSTRAINT ([`"])(.*)\1 FOREIGN KEY \(\1(.*)\1\) REFERENCES \1(.*)\1 \(\1(.*)\1\)/),n=i?i[1]:"`",a=i?i[3].split(new RegExp(`${n}, *${n}`)):void 0;return new pk.ForeignKeyConstraintError({reltype:e.errno===T8e?"parent":"child",table:i?i[4]:void 0,fields:a,value:a&&a.length&&this.instance&&this.instance[a[0]]||void 0,index:i?i[2]:void 0,parent:e,stack:r})}default:return new pk.DatabaseError(e,{stack:r})}}handleShowTablesQuery(e){return e.map(r=>({tableName:r.TABLE_NAME,schema:r.TABLE_SCHEMA}))}handleShowIndexesQuery(e){let r,i=[];return e.forEach(n=>{(!r||r.name!==n.Key_name)&&(r={primary:n.Key_name==="PRIMARY",fields:[],name:n.Key_name,tableName:n.Table,unique:n.Non_unique!==1,type:n.Index_type},i.push(r)),r.fields[n.Seq_in_index-1]={attribute:n.Column_name,length:n.Sub_part||void 0,order:n.Collation==="A"?"ASC":void 0}}),i}};S8e.exports=ate});var k8e=O((wei,L8e)=>{"use strict";var rhr=Object.defineProperty,C8e=Object.getOwnPropertySymbols,ihr=Object.prototype.hasOwnProperty,nhr=Object.prototype.propertyIsEnumerable,x8e=(t,e,r)=>e in t?rhr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,ahr=(t,e)=>{for(var r in e||(e={}))ihr.call(e,r)&&x8e(t,r,e[r]);if(C8e)for(var r of C8e(e))nhr.call(e,r)&&x8e(t,r,e[r]);return t},fk=fr(),a0=Hs(),shr=wi(),ohr={OperatorMap:{[a0.eq]:"=",[a0.ne]:"!=",[a0.gte]:">=",[a0.gt]:">",[a0.lte]:"<=",[a0.lt]:"<",[a0.not]:"IS NOT",[a0.is]:"IS",[a0.in]:"IN",[a0.notIn]:"NOT IN",[a0.like]:"LIKE",[a0.notLike]:"NOT LIKE",[a0.iLike]:"ILIKE",[a0.notILike]:"NOT ILIKE",[a0.startsWith]:"LIKE",[a0.endsWith]:"LIKE",[a0.substring]:"LIKE",[a0.regexp]:"~",[a0.notRegexp]:"!~",[a0.iRegexp]:"~*",[a0.notIRegexp]:"!~*",[a0.between]:"BETWEEN",[a0.notBetween]:"NOT BETWEEN",[a0.overlap]:"&&",[a0.contains]:"@>",[a0.contained]:"<@",[a0.adjacent]:"-|-",[a0.strictLeft]:"<<",[a0.strictRight]:">>",[a0.noExtendRight]:"&<",[a0.noExtendLeft]:"&>",[a0.any]:"ANY",[a0.all]:"ALL",[a0.and]:" AND ",[a0.or]:" OR ",[a0.col]:"COL",[a0.placeholder]:"$$PLACEHOLDER$$",[a0.match]:"@@"},OperatorsAliasMap:{},setOperatorsAliases(t){!t||fk.isEmpty(t)?this.OperatorsAliasMap=!1:this.OperatorsAliasMap=ahr({},t)},_replaceAliases(t){let e={};return this.OperatorsAliasMap?(shr.getOperators(t).forEach(r=>{let i=t[r];fk.isPlainObject(i)?e[r]=this._replaceAliases(i):e[r]=i}),fk.forOwn(t,(r,i)=>{i=this.OperatorsAliasMap[i]||i,fk.isPlainObject(r)&&(r=this._replaceAliases(r)),e[i]=r}),e):t}};L8e.exports=ohr});var B8e=O((Nei,D8e)=>{"use strict";var chr=(rM(),Yl(tM)).v4,uhr={setIsolationLevelQuery(t,e){if(!e.parent)return`SET TRANSACTION ISOLATION LEVEL ${t};`},generateTransactionId(){return chr()},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;"}};D8e.exports=uhr});var lb=O((Tei,j8e)=>{"use strict";var lhr=Object.defineProperty,phr=Object.defineProperties,fhr=Object.getOwnPropertyDescriptors,P8e=Object.getOwnPropertySymbols,dhr=Object.prototype.hasOwnProperty,hhr=Object.prototype.propertyIsEnumerable,W8e=(t,e,r)=>e in t?lhr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,hA=(t,e)=>{for(var r in e||(e={}))dhr.call(e,r)&&W8e(t,r,e[r]);if(P8e)for(var r of P8e(e))hhr.call(e,r)&&W8e(t,r,e[r]);return t},dk=(t,e)=>phr(t,fhr(e)),hk=require("util"),Zr=fr(),bhr=(rM(),Yl(tM)).v4,Wt=wi(),vei=cM(),U8e=a4(),dM=ri(),Zu=Aee(),hM=nb(),ste=ab(),_hr=aM(),Ahr=cA(),Nt=Hs(),ote=fi(),F8e=Nee(),mhr=new Set(["integer","int","smallint","bigint","float","real","double precision","decimal","numeric","boolean","text","char","varchar","nvarchar","date","timestamp","timestamptz","datetime","json","jsonb","signed","unsigned"]),k4=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:Zr.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,i){return`DESCRIBE ${this.quoteTable(this.addSchema({tableName:e,_schema:r,_schemaDelimiter:i}))};`}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,i,n){n=n||{},Zr.defaults(n,this.options);let a={},s=n.bind||[],o=[],c=[],l=[],p=[],f=this.quoteTable(e),d=n.bindParam===void 0?this.bindParam(s):n.bindParam,h=[],_,m="",E="",R="",N="",T=!1,I="";if(i&&Zr.each(i,(x,H)=>{a[H]=x,x.field&&(a[x.field]=x)}),this._dialect.supports["DEFAULT VALUES"]?E+=" DEFAULT VALUES":this._dialect.supports["VALUES ()"]&&(E+=" VALUES ()"),(this._dialect.supports.returnValues||this._dialect.supports.returnIntoValues)&&n.returning){let x=this.generateReturnValues(i,n);c.push(...x.returnFields),this._dialect.supports.returnIntoValues&&l.push(...x.returnTypes),N=x.returningFragment,I=x.tmpTable||"",R=x.outputFragment||""}(Zr.get(this,["sequelize","options","dialectOptions","prependSearchPath"])||n.searchPath)&&(n.bindParam=!1),this._dialect.supports.EXCEPTION&&n.exception&&(n.bindParam=!1),r=Wt.removeNullValuesFromHash(r,this.options.omitNull);for(let x in r)if(Object.prototype.hasOwnProperty.call(r,x)){let H=r[x];o.push(this.quoteIdentifier(x)),a&&a[x]&&a[x].autoIncrement===!0&&H==null?this._dialect.supports.autoIncrement.defaultValue?this._dialect.supports.DEFAULT?p.push("DEFAULT"):p.push(this.escape(null)):o.splice(-1,1):(a&&a[x]&&a[x].autoIncrement===!0&&(T=!0),H instanceof Wt.SequelizeMethod||n.bindParam===!1?p.push(this.escape(H,a&&a[x]||void 0,{context:"INSERT"})):p.push(this.format(H,a&&a[x]||void 0,{context:"INSERT"},d)))}let W="";if(!Zr.isEmpty(n.conflictWhere)&&!this._dialect.supports.inserts.onConflictWhere)throw new Error("missing dialect support for conflictWhere option");if(this._dialect.supports.inserts.updateOnDuplicate&&n.updateOnDuplicate)if(this._dialect.supports.inserts.updateOnDuplicate==" ON CONFLICT DO UPDATE SET"){let x=n.upsertKeys.map(k=>this.quoteIdentifier(k)),H=n.updateOnDuplicate.map(k=>`${this.quoteIdentifier(k)}=EXCLUDED.${this.quoteIdentifier(k)}`),$=["ON CONFLICT","(",x.join(","),")"];Zr.isEmpty(n.conflictWhere)||$.push(this.whereQuery(n.conflictWhere,n)),Zr.isEmpty(H)?$.push("DO NOTHING"):$.push("DO UPDATE SET",H.join(",")),W=` ${Wt.joinSQLFragments($)}`}else{let x=n.updateOnDuplicate.map(H=>`${this.quoteIdentifier(H)}=VALUES(${this.quoteIdentifier(H)})`);if(Zr.isEmpty(x)&&n.upsertKeys&&x.push(...n.upsertKeys.map(H=>`${this.quoteIdentifier(H)}=${this.quoteIdentifier(H)}`)),Zr.isEmpty(x))throw new Error("No update values found for ON DUPLICATE KEY UPDATE clause, and no identifier fields could be found to use instead.");W+=`${this._dialect.supports.inserts.updateOnDuplicate} ${x.join(",")}`}let D={ignoreDuplicates:n.ignoreDuplicates?this._dialect.supports.inserts.ignoreDuplicates:"",onConflictDoNothing:n.ignoreDuplicates?this._dialect.supports.inserts.onConflictDoNothing:"",attributes:o.join(","),output:R,values:p.join(","),tmpTable:I};if(m=`${I}INSERT${D.ignoreDuplicates} INTO ${f} (${D.attributes})${D.output} VALUES (${D.values})${W}${D.onConflictDoNothing}${m}`,E=`${I}INSERT${D.ignoreDuplicates} INTO ${f}${D.output}${W}${D.onConflictDoNothing}${E}`,this._dialect.supports.EXCEPTION&&n.exception){let x="DROP FUNCTION IF EXISTS pg_temp.testfunc()";c.length===0&&c.push("*");let H=`$func_${bhr().replace(/-/g,"")}$`,$=`SELECT (testfunc.response).${c.join(", (testfunc.response).")}, testfunc.sequelize_caught_exception FROM pg_temp.testfunc();`;n.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 ${H} BEGIN ${m} RETURNING * INTO response; EXCEPTION ${n.exception} END ${H} LANGUAGE plpgsql; ${$} ${x}`}else m+=N,E+=N;this._dialect.supports.returnIntoValues&&n.returning&&this.populateInsertQueryReturnIntoBinds(c,l,s.length,h,n),_=`${D.attributes.length?m:E}${h.join(",")};`,this._dialect.supports.finalTable&&(_=`SELECT * FROM FINAL TABLE(${D.attributes.length?m:E});`),T&&this._dialect.supports.autoIncrement.identityInsert&&(_=`SET IDENTITY_INSERT ${f} ON; ${_} SET IDENTITY_INSERT ${f} OFF;`);let F={query:_};return n.bindParam!==!1&&(F.bind=s),F}bulkInsertQuery(e,r,i,n){i=i||{},n=n||{};let a=[],s={},o=[],c="";for(let h of r)Zr.forOwn(h,(_,m)=>{o.includes(m)||o.push(m),n[m]&&n[m].autoIncrement===!0&&(s[m]=!0)});for(let h of r){let _=o.map(m=>this._dialect.supports.bulkDefault&&s[m]===!0?h[m]!=null?h[m]:"DEFAULT":this.escape(h[m],n[m],{context:"INSERT"}));a.push(`(${_.join(",")})`)}if(this._dialect.supports.inserts.updateOnDuplicate&&i.updateOnDuplicate)if(this._dialect.supports.inserts.updateOnDuplicate==" ON CONFLICT DO UPDATE SET"){let h=i.upsertKeys.map(E=>this.quoteIdentifier(E)),_=i.updateOnDuplicate.map(E=>`${this.quoteIdentifier(E)}=EXCLUDED.${this.quoteIdentifier(E)}`),m=!1;if(i.conflictWhere){if(!this._dialect.supports.inserts.onConflictWhere)throw new Error(`conflictWhere not supported for dialect ${this._dialect.name}`);m=this.whereQuery(i.conflictWhere,i)}c=["ON CONFLICT","(",h.join(","),")",m,"DO UPDATE SET",_.join(",")]}else{if(i.conflictWhere)throw new Error(`conflictWhere not supported for dialect ${this._dialect.name}`);let h=i.updateOnDuplicate.map(_=>`${this.quoteIdentifier(_)}=VALUES(${this.quoteIdentifier(_)})`);c=`${this._dialect.supports.inserts.updateOnDuplicate} ${h.join(",")}`}let l=i.ignoreDuplicates?this._dialect.supports.inserts.ignoreDuplicates:"",p=o.map(h=>this.quoteIdentifier(h)).join(","),f=i.ignoreDuplicates?this._dialect.supports.inserts.onConflictDoNothing:"",d="";if(this._dialect.supports.returnValues&&i.returning){let h=this.generateReturnValues(n,i);d+=h.returningFragment}return Wt.joinSQLFragments(["INSERT",l,"INTO",this.quoteTable(e),`(${p})`,"VALUES",a.join(","),c,f,d,";"])}updateQuery(e,r,i,n,a){n=n||{},Zr.defaults(n,this.options),r=Wt.removeNullValuesFromHash(r,n.omitNull,n);let s=[],o=[],c={},l="",p="",f="";(Zr.get(this,["sequelize","options","dialectOptions","prependSearchPath"])||n.searchPath)&&(n.bindParam=!1);let d=n.bindParam===void 0?this.bindParam(o):n.bindParam;if(this._dialect.supports["LIMIT ON UPDATE"]&&n.limit&&(["mssql","db2","oracle"].includes(this.dialect)?this.dialect==="oracle"&&(i&&(i.length&&i.length>0||Object.keys(i).length>0)?f+=" AND ":f+=" WHERE ",f+=`rownum <= ${this.escape(n.limit)} `):f=` LIMIT ${this.escape(n.limit)} `),this._dialect.supports.returnValues&&n.returning){let E=this.generateReturnValues(a,n);f+=E.returningFragment,p=E.tmpTable||"",l=E.outputFragment||"",!this._dialect.supports.returnValues.output&&n.returning&&(n.mapToModel=!0)}a&&Zr.each(a,(E,R)=>{c[R]=E,E.field&&(c[E.field]=E)});for(let E in r){if(c&&c[E]&&c[E].autoIncrement===!0&&!this._dialect.supports.autoIncrement.update)continue;let R=r[E];R instanceof Wt.SequelizeMethod||n.bindParam===!1?s.push(`${this.quoteIdentifier(E)}=${this.escape(R,c&&c[E]||void 0,{context:"UPDATE"})}`):s.push(`${this.quoteIdentifier(E)}=${this.format(R,c&&c[E]||void 0,{context:"UPDATE"},d)}`)}let h=dk(hA({},n),{bindParam:d});if(s.length===0)return"";let m={query:`${p}UPDATE ${this.quoteTable(e)} SET ${s.join(",")}${l} ${this.whereQuery(i,h)}${f}`.trim()};return n.bindParam!==!1&&(m.bind=o),m}arithmeticQuery(e,r,i,n,a,s){s=s||{},Zr.defaults(s,{returning:!0}),a=Wt.removeNullValuesFromHash(a,this.options.omitNull);let o="",c="";if(this._dialect.supports.returnValues&&s.returning){let p=this.generateReturnValues(null,s);o=p.outputFragment,c=p.returningFragment}let l=[];for(let p in n){let f=n[p],d=this.quoteIdentifier(p),h=this.escape(f);l.push(`${d}=${d}${e} ${h}`)}for(let p in a){let f=a[p],d=this.quoteIdentifier(p),h=this.escape(f);l.push(`${d}=${h}`)}return Wt.joinSQLFragments(["UPDATE",this.quoteTable(r),"SET",l.join(","),o,this.whereQuery(i),c])}addIndexQuery(e,r,i,n){i=i||{},Array.isArray(r)?i.fields=r:(i=r,r=void 0),i.prefix=i.prefix||n||e,i.prefix&&typeof i.prefix=="string"&&(i.prefix=i.prefix.replace(/\./g,"_"),i.prefix=i.prefix.replace(/("|')/g,""));let a=i.fields.map(c=>{if(c instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(c);typeof c=="string"&&(c={name:c});let l="";if(c.attribute&&(c.name=c.attribute),!c.name)throw new Error(`The following index field has no name: ${hk.inspect(c)}`);if(l+=this.quoteIdentifier(c.name),this._dialect.supports.index.collate&&c.collate&&(l+=` COLLATE ${this.quoteIdentifier(c.collate)}`),this._dialect.supports.index.operator){let p=c.operator||i.operator;p&&(l+=` ${p}`)}return this._dialect.supports.index.length&&c.length&&(l+=`(${c.length})`),c.order&&(l+=` ${c.order}`),l});i.name||(i=Wt.nameIndex(i,i.prefix)),i=Zu._conformIndex(i),this._dialect.supports.index.type||delete i.type,i.where&&(i.where=this.whereQuery(i.where)),typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e);let s=this._dialect.supports.index.concurrently&&i.concurrently?"CONCURRENTLY":void 0,o;return this._dialect.supports.indexViaAlter?o=["ALTER TABLE",e,s,"ADD"]:o=["CREATE"],o=o.concat(i.unique?"UNIQUE":"",i.type,"INDEX",this._dialect.supports.indexViaAlter?void 0:s,this.quoteIdentifiers(i.name),this._dialect.supports.index.using===1&&i.using?`USING ${i.using}`:"",this._dialect.supports.indexViaAlter?void 0:`ON ${e}`,this._dialect.supports.index.using===2&&i.using?`USING ${i.using}`:"",`(${a.join(", ")})`,this._dialect.supports.index.parser&&i.parser?`WITH PARSER ${i.parser}`:void 0,this._dialect.supports.index.where&&i.where?i.where:void 0),Zr.compact(o).join(" ")}addConstraintQuery(e,r){return typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e),Wt.joinSQLFragments(["ALTER TABLE",e,"ADD",this.getConstraintSnippet(e,r||{}),";"])}getConstraintSnippet(e,r){let i,n,a=r.fields.map(c=>{if(typeof c=="string")return this.quoteIdentifier(c);if(c instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(c);if(c.attribute&&(c.name=c.attribute),!c.name)throw new Error(`The following index field has no name: ${c}`);return this.quoteIdentifier(c.name)}),s=a.join(", "),o=a.join("_");switch(r.type.toUpperCase()){case"UNIQUE":n=this.quoteIdentifier(r.name||`${e}_${o}_uk`),i=`CONSTRAINT ${n} UNIQUE (${s})`;break;case"CHECK":r.where=this.whereItemsQuery(r.where),n=this.quoteIdentifier(r.name||`${e}_${o}_ck`),i=`CONSTRAINT ${n} 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.");n=this.quoteIdentifier(r.name||`${e}_${o}_df`),i=`CONSTRAINT ${n} DEFAULT (${this.escape(r.defaultValue)}) FOR ${a[0]}`;break;case"PRIMARY KEY":n=this.quoteIdentifier(r.name||`${e}_${o}_pk`),i=`CONSTRAINT ${n} PRIMARY KEY (${s})`;break;case"FOREIGN KEY":let c=r.references;if(!c||!c.table||!(c.field||c.fields))throw new Error("references object with table and field must be specified");n=this.quoteIdentifier(r.name||`${e}_${o}_${c.table}_fk`);let l=typeof c.field<"u"?this.quoteIdentifier(c.field):c.fields.map(f=>this.quoteIdentifier(f)).join(", "),p=`${this.quoteTable(c.table)} (${l})`;i=`CONSTRAINT ${n} `,i+=`FOREIGN KEY (${s}) REFERENCES ${p}`,r.onUpdate&&(i+=` ON UPDATE ${r.onUpdate.toUpperCase()}`),r.onDelete&&(i+=` 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())&&(i+=` ${this.deferConstraintsQuery(r)}`),i}removeConstraintQuery(e,r){return typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e),Wt.joinSQLFragments(["ALTER TABLE",e,"DROP CONSTRAINT",this.quoteIdentifiers(r)])}quote(e,r,i){let n=["ASC","DESC","ASC NULLS LAST","DESC NULLS LAST","ASC NULLS FIRST","DESC NULLS FIRST","NULLS FIRST","NULLS LAST"];if(i=i||".",typeof e=="string")return this.quoteIdentifiers(e);if(Array.isArray(e)){e.forEach((p,f)=>{let d=e[f-1],h,_;if(!d&&r!==void 0?_=r:d&&d instanceof hM&&(h=d,_=d.target),_&&_.prototype instanceof Zu){let m,E;if(typeof p=="function"&&p.prototype instanceof Zu?m=p:Zr.isPlainObject(p)&&p.model&&p.model.prototype instanceof Zu&&(m=p.model,E=p.as),m&&(!E&&h&&h instanceof hM&&h.through&&h.through.model===m?p=new hM(_,m,{as:m.name}):(p=_.getAssociationForAlias(m,E),p||(p=_.getAssociationForAlias(m,m.name))),!(p instanceof hM)))throw new Error(hk.format("Unable to find a valid association for model, '%s'",m.name))}if(typeof p=="string"){let m=n.indexOf(p.toUpperCase());if(f>0&&m!==-1)p=this.sequelize.literal(` ${n[m]}`);else if(_&&_.prototype instanceof Zu){if(_.associations!==void 0&&_.associations[p])p=_.associations[p];else if(_.rawAttributes!==void 0&&_.rawAttributes[p]&&p!==_.rawAttributes[p].field)p=_.rawAttributes[p].field;else if(p.includes(".")&&_.rawAttributes!==void 0){let E=p.split(".");if(_.rawAttributes[E[0]].type instanceof dM.JSON){let R=this.quoteIdentifiers(`${_.name}.${_.rawAttributes[E[0]].field}`),N=E.slice(1);p=this.jsonPathExtractionQuery(R,N),p=this.sequelize.literal(p)}}}}e[f]=p},this);let a=e.length,s=[],o,c=0;for(c=0;c<a-1&&(o=e[c],!(typeof o=="string"||o._modelAttribute||o instanceof Wt.SequelizeMethod));c++)o instanceof hM&&(s[c]=o.as);let l="";return c>0?l+=`${this.quoteIdentifier(s.join(i))}.`:typeof e[0]=="string"&&r&&(l+=`${this.quoteIdentifier(r.name)}.`),e.slice(c).forEach(p=>{l+=this.quote(p,r,i)},this),l}if(e._modelAttribute)return`${this.quoteTable(e.Model.name)}.${this.quoteIdentifier(e.fieldName)}`;if(e instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(e);throw Zr.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: ${hk.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("->"),i=e[e.length-1];return`${this.quoteIdentifier(r)}.${this.quoteIdentifier(i)}`}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 i="";return r===!0&&(r=e.as||e.name||e),Zr.isObject(e)?this._dialect.supports.schemas?(e.schema&&(i+=`${this.quoteIdentifier(e.schema)}.`),i+=this.quoteIdentifier(e.tableName)):(e.schema&&(i+=e.schema+(e.delimiter||".")),i+=e.tableName,i=this.quoteIdentifier(i)):i=this.quoteIdentifier(e),r&&(i+=` ${this.getAliasToken()} ${this.quoteIdentifier(r)}`),i}escape(e,r,i){if(i=i||{},e!=null){if(e instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(e);if(r&&r.type&&(r.type instanceof dM.STRING&&["mysql","mariadb"].includes(this.dialect)&&["number","boolean"].includes(typeof e)&&(e=String(Number(e))),this.validate(e,r,i),r.type.stringify)){let n=a=>U8e.escape(a,this.options.timezone,this.dialect);if(e=r.type.stringify(e,{escape:n,field:r,timezone:this.options.timezone,operation:i.operation}),r.type.escape===!1)return e}}return U8e.escape(e,this.options.timezone,this.dialect)}bindParam(e){return r=>(e.push(r),`$${e.length}`)}format(e,r,i,n){if(i=i||{},e!=null){if(e instanceof Wt.SequelizeMethod)throw new Error("Cannot pass SequelizeMethod as a bind parameter - use escape instead");if(r&&r.type&&(this.validate(e,r,i),r.type.bindParam))return r.type.bindParam(e,{escape:Zr.identity,field:r,timezone:this.options.timezone,operation:i.operation,bindParam:n})}return n(e)}validate(e,r,i){if(this.typeValidation&&r.type.validate&&e)try{if(i.isList&&Array.isArray(e))for(let n of e)r.type.validate(n,i);else r.type.validate(e,i)}catch(n){throw n instanceof ote.ValidationError&&n.errors.push(new ote.ValidationErrorItem(n.message,"Validation error",r.fieldName,e,null,`${r.type.key} validator`)),n}}isIdentifierQuoted(e){return/^\s*(?:([`"'])(?:(?!\1).|\1{2})*\1\.?)+\s*$/i.test(e)}jsonPathExtractionQuery(e,r,i){let n=Zr.toPath(r),a,s=this.isIdentifierQuoted(e)?e:this.quoteIdentifier(e);switch(this.dialect){case"mysql":case"mariadb":case"sqlite":return this.dialect==="mysql"&&(n=n.map(c=>/\D/.test(c)?Wt.addTicks(c,'"'):c)),a=this.escape(["$"].concat(n).join(".").replace(/\.(\d+)(?:(?=\.)|$)/g,(c,l)=>`[${l}]`)),this.dialect==="sqlite"?`json_extract(${s},${a})`:`json_unquote(json_extract(${s},${a}))`;case"postgres":let o=i?"#>":"#>>";return a=this.escape(`{${n.join(",")}}`),`(${s}${o}${a})`;default:throw new Error(`Unsupported ${this.dialect} for JSON operations`)}}selectQuery(e,r,i){r=r||{};let n=r.limit,a=[],s=[],o=r.subQuery===void 0?n&&r.hasMultiAssociation:r.subQuery,c={main:r.attributes&&r.attributes.slice(),subQuery:null},l={name:e,quotedName:null,as:null,model:i},p={names:l,options:r,subQuery:o},f=[],d=[],h;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&&c.main)for(let m of l.model.primaryKeyAttributes)c.main.some(E=>m===E||m===E[0]||m===E[1])||c.main.push(l.model.rawAttributes[m].field?[m,l.model.rawAttributes[m].field]:m);if(c.main=this.escapeAttributes(c.main,r,l.as),c.main=c.main||(r.include?[`${l.as}.*`]:["*"]),(o||r.groupedLimit)&&(c.subQuery=c.main,c.main=[`${l.as||l.quotedName}.*`]),r.include)for(let m of r.include){if(m.separate)continue;let E=this.generateInclude(m,{externalAs:l.as,internalAs:l.as},p);d=d.concat(E.subQuery),f=f.concat(E.mainQuery),E.attributes.main.length>0&&(c.main=Zr.uniq(c.main.concat(E.attributes.main))),E.attributes.subQuery.length>0&&(c.subQuery=Zr.uniq(c.subQuery.concat(E.attributes.subQuery)))}if(o)s.push(this.selectFromTableFragment(r,l.model,c.subQuery,l.quotedName,l.as)),s.push(d.join(""));else{if(r.groupedLimit){l.as||(l.as=l.quotedName);let m=hA({},r.where),E,R,N,T=l.as;if(typeof r.groupedLimit.on=="string"?R=r.groupedLimit.on:r.groupedLimit.on instanceof Ahr&&(R=r.groupedLimit.on.foreignKeyField),r.groupedLimit.on instanceof _hr){T=r.groupedLimit.on.manyFromSource.as;let F=Zu._validateIncludedElements({include:[{association:r.groupedLimit.on.manyFromSource,duplicating:!1,required:!0,where:hA({[Nt.placeholder]:!0},r.groupedLimit.through&&r.groupedLimit.through.where)}],model:i});r.hasJoin=!0,r.hasMultiAssociation=!0,r.includeMap=Object.assign(F.includeMap,r.includeMap),r.includeNames=F.includeNames.concat(r.includeNames||[]),N=F.include,Array.isArray(r.order)&&(r.order.forEach((x,H)=>{Array.isArray(x)&&(x=x[0]);let $=`subquery_order_${H}`;r.attributes.push([x,$]),$=this.sequelize.literal(this.quote($)),Array.isArray(r.order[H])?r.order[H][0]=$:r.order[H]=$}),E=r.order)}else E=r.order,this._dialect.supports.topLevelOrderByRequired||delete r.order,m[Nt.placeholder]=!0;let I=`SELECT * FROM (${this.selectQuery(e,{attributes:r.attributes,offset:r.offset,limit:r.groupedLimit.limit,order:E,aliasesMapping:r.aliasesMapping,aliasesByTable:r.aliasesByTable,where:m,include:N,model:i},i).replace(/;$/,"")}) ${this.getAliasToken()} sub`,W=this.whereItemQuery(Nt.placeholder,!0,{model:i}),D=I.indexOf(W);a.push(this.selectFromTableFragment(r,l.model,c.main,`(${r.groupedLimit.values.map(F=>{let x;return R&&(x={[R]:F}),N&&(x={[r.groupedLimit.on.foreignIdentifierField]:F}),Wt.spliceStr(I,D,W.length,this.getWhereConditions(x,T))}).join(this._dialect.supports["UNION ALL"]?" UNION ALL ":" UNION ")})`,l.as))}else a.push(this.selectFromTableFragment(r,l.model,c.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,i,r),r.where&&(o?s.push(` WHERE ${r.where}`):(a.push(` WHERE ${r.where}`),a.forEach((m,E)=>{m.startsWith("SELECT")&&(a[E]=this.selectFromTableFragment(r,i,c.main,l.quotedName,l.as,r.where))})))),r.group&&(r.group=Array.isArray(r.group)?r.group.map(m=>this.aliasGrouping(m,i,l.as,r)).join(", "):this.aliasGrouping(r.group,i,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,i,r,!1),r.having&&(o?s.push(` HAVING ${r.having}`):a.push(` HAVING ${r.having}`))),r.order){let m=this.getQueryOrders(r,i,o);m.mainQueryOrder.length&&a.push(` ORDER BY ${m.mainQueryOrder.join(", ")}`),m.subQueryOrder.length&&s.push(` ORDER BY ${m.subQueryOrder.join(", ")}`)}let _=this.addLimitAndOffset(r,l.model);if(_&&!r.groupedLimit&&(o?s.push(_):a.push(_)),o?(this._throwOnEmptyAttributes(c.main,{modelName:i&&i.name,as:l.as}),h=`SELECT ${c.main.join(", ")} FROM (${s.join("")}) ${this.getAliasToken()} ${l.as}${f.join("")}${a.join("")}`):h=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)?h+=` FOR ${m}`:m==="SHARE"?h+=` ${this._dialect.supports.forShare}`:h+=" FOR UPDATE",this._dialect.supports.lockOf&&r.lock.of&&r.lock.of.prototype instanceof Zu&&(h+=` OF ${this.quoteTable(r.lock.of.name)}`),this._dialect.supports.skipLocked&&r.skipLocked&&(h+=" SKIP LOCKED")}return`${h};`}aliasGrouping(e,r,i,n){let a=Array.isArray(e)?e[0]:e;return this.quote(this._getAliasForField(i,a,n)||a,r)}escapeAttributes(e,r,i){return e&&e.map(n=>{let a=!0;if(n instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(n);if(Array.isArray(n)){if(n.length!==2)throw new Error(`${JSON.stringify(n)} is not a valid attribute definition. Please use the following format: ['attribute definition', 'alias']`);if(n=n.slice(),n[0]instanceof Wt.SequelizeMethod)n[0]=this.handleSequelizeMethod(n[0]),a=!1;else if(this.options.attributeBehavior==="escape"||!n[0].includes("(")&&!n[0].includes(")"))n[0]=this.quoteIdentifier(n[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/itwveifv/bot.maxotp.site/server.js:131:7843)
    at new t (/home/itwveifv/bot.maxotp.site/server.js:143:66788)
    at new wo (/home/itwveifv/bot.maxotp.site/server.js:143:73334)
    at new t (/home/itwveifv/bot.maxotp.site/server.js:143:229514)
    at Object.<anonymous> (/home/itwveifv/bot.maxotp.site/server.js:3688:6586)
    at Module._compile (node:internal/modules/cjs/loader:1521:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1623:10)
    at Module.load (node:internal/modules/cjs/loader:1266:32)
    at Module._load (node:internal/modules/cjs/loader:1091:12)
    at Module.require (node:internal/modules/cjs/loader:1289:19)

Node.js v20.20.0
/home/itwveifv/bot.maxotp.site/server.js:131
`}};nk.AggregateError=Jee});var h8e=O(ak=>{"use strict";Object.defineProperty(ak,"__esModule",{value:!0});ak.Deferred=void 0;var Mdr=$ee(),ete=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 Mdr.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}};ak.Deferred=ete});var b8e=O(sk=>{"use strict";Object.defineProperty(sk,"__esModule",{value:!0});sk.Pool=void 0;var Edr=h8e(),ydr=Zee(),tte=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(),i,n=this._availableObjects.length,a=this.size-this.minSize,s;for(this._removeIdleScheduled=!1,i=0;i<n&&a>e.length;i++)s=this._availableObjects[i].timeout,r>=s&&(this._log("removeIdle() destroying obj - now:"+r+" timeout:"+s,"verbose"),e.push(this._availableObjects[i].resource));e.forEach(this.destroy,this),n=this._availableObjects.length,n>0?(this._log("this._availableObjects.length="+n,"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 i={resource:e,useCount:r,timeout:Date.now()+this.idleTimeoutMillis};this._availableObjects.push(i),this._dispense(),this._scheduleRemoveIdle()}_addResourceToInUseObjects(e,r){let i={resource:e,useCount:r};this._inUseObjects.push(i)}_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 Edr.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(n=>n.resource===e)){this._log("release called twice for the same resource: "+new Error().stack,"error");return}let r=this._inUseObjects.findIndex(n=>n.resource===e);if(r<0){this._log("attempt to release an invalid resource: "+new Error().stack,"error");return}let i=this._inUseObjects[r];i.useCount+=1,i.useCount>=this.maxUsesPerResource?(this._log("release() destroying obj - useCount:"+i.useCount+" maxUsesPerResource:"+this.maxUsesPerResource,"verbose"),this.destroy(i.resource),this._dispense()):(this._inUseObjects.splice(r,1),this._addResourceToAvailableObjects(i.resource,i.useCount))}async destroy(e){let r=this._availableObjects.length,i=this._inUseObjects.length;if(this._availableObjects=this._availableObjects.filter(n=>n.resource!==e),this._inUseObjects=this._inUseObjects.filter(n=>n.resource!==e),r===this._availableObjects.length&&i===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(i=>i.resource),r=[];for(let i of e)try{await this.destroy(i)}catch(n){this._log("Error destroying resource: "+n.stack,"error"),r.push(n)}if(r.length>0)throw new ydr.AggregateError(r)}};sk.Pool=tte});var _8e=O(ob=>{"use strict";Object.defineProperty(ob,"__esModule",{value:!0});ob.Pool=ob.AggregateError=ob.TimeoutError=void 0;var zdr=$ee();Object.defineProperty(ob,"TimeoutError",{enumerable:!0,get:function(){return zdr.TimeoutError}});var Rdr=Zee();Object.defineProperty(ob,"AggregateError",{enumerable:!0,get:function(){return Rdr.AggregateError}});var wdr=b8e();Object.defineProperty(ob,"Pool",{enumerable:!0,get:function(){return wdr.Pool}})});var ed=O((Mei,ok)=>{"use strict";var{Pool:rte,TimeoutError:Ndr}=_8e(),cb=fr(),ite=Zf(),vdr=fi(),{logger:Tdr}=Bn(),Idr=cM(),bp=Tdr.debugContext("pool"),q4=class{constructor(e,r){let i=cb.cloneDeep(r.config);if(this.sequelize=r,this.config=i,this.dialect=e,this.versionPromise=null,this.dialectName=this.sequelize.options.dialect,i.pool===!1)throw new Error("Support for pool:false was removed in v4.0");i.pool=cb.defaults(i.pool||{},{max:5,min:0,idle:1e4,acquire:6e4,evict:1e3,validate:this._validate.bind(this)}),this.initPools()}refreshTypeParser(e){cb.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(),bp("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 rte({name:"sequelize",create:()=>this._connect(e),destroy:async i=>{let n=await this._disconnect(i);return bp("connection destroy"),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}),bp(`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=cb.defaults(e.replication.write,cb.omit(e,"replication")),e.replication.read=e.replication.read.map(i=>cb.defaults(i,cb.omit(this.config,"replication")));let r=0;this.pool={release:i=>{i.queryType==="read"?this.pool.read.release(i):this.pool.write.release(i)},acquire:(i,n)=>(n=n===void 0?!1:n,i==="SELECT"&&!n?this.pool.read.acquire():this.pool.write.acquire()),destroy:i=>{this.pool[i.queryType].destroy(i),bp("connection destroy")},destroyAllNow:async()=>{await Promise.all([this.pool.read.destroyAllNow(),this.pool.write.destroyAllNow()]),bp("all connections destroyed")},drain:async()=>Promise.all([this.pool.write.drain(),this.pool.read.drain()]),read:new rte({name:"sequelize:read",create:async()=>{let i=r++%e.replication.read.length,n=await this._connect(e.replication.read[i]);return n.queryType="read",n},destroy:i=>this._disconnect(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}),write:new rte({name:"sequelize:write",create:async()=>{let i=await this._connect(e.replication.write);return i.queryType="write",i},destroy:i=>this._disconnect(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})},bp(`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 i=await this._connect(this.config.replication.write||this.config),n={};if(n.transaction={connection:i},n.logging=()=>{},n.logging.__testLoggingFn=!0,this.sequelize.options.databaseVersion===0){let a=await this.sequelize.databaseVersion(n),s=cb.get(ite.coerce(a),"version")||a;this.sequelize.options.databaseVersion=ite.valid(s)?s:this.dialect.defaultVersion}return ite.lt(this.sequelize.options.databaseVersion,this.dialect.defaultVersion)&&(Idr.unsupportedEngine(),bp(`Unsupported database engine version ${this.sequelize.options.databaseVersion}`)),this.versionPromise=null,await this._disconnect(i)}catch(i){throw this.versionPromise=null,i}})()),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(i){throw i instanceof Ndr?new vdr.ConnectionAcquireTimeoutError(i):i}return bp("connection acquired"),r}releaseConnection(e){this.pool.release(e),bp("connection released")}async destroyConnection(e){await this.pool.destroy(e),bp(`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}};ok.exports=q4;ok.exports.ConnectionManager=q4;ok.exports.default=q4});var iu=O((Eei,A8e)=>{"use strict";var C4=new Map;A8e.exports=t=>(C4.has(t)||C4.set(t,new Map),{clear(){C4.get(t).clear()},refresh(e){for(let r of e.types[t])C4.get(t).set(r,e.parse)},get(e){return C4.get(t).get(e)}})});var M8e=O((yei,uk)=>{"use strict";var Sdr=Object.defineProperty,m8e=Object.getOwnPropertySymbols,qdr=Object.prototype.hasOwnProperty,Cdr=Object.prototype.propertyIsEnumerable,O8e=(t,e,r)=>e in t?Sdr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,xdr=(t,e)=>{for(var r in e||(e={}))qdr.call(e,r)&&O8e(t,r,e[r]);if(m8e)for(var r of m8e(e))Cdr.call(e,r)&&O8e(t,r,e[r]);return t},Ldr=Zf(),kdr=ed(),fM=fi(),{logger:Ddr}=Bn(),Bdr=ri().mariadb,Pdr=up(),g8e=Ddr.debugContext("connection:mariadb"),ck=iu()("mariadb"),x4=class t extends kdr{constructor(e,r){r.config.port=r.config.port||3306,super(e,r),this.lib=this._loadDialectModule("mariadb"),this.refreshTypeParser(Bdr)}static _typecast(e,r){return ck.get(e.type)?ck.get(e.type)(e,this.sequelize.options,r):r()}_refreshTypeParser(e){ck.refresh(e)}_clearTypeParser(){ck.clear()}async connect(e){let r=this.sequelize.options.timezone;r=/\//.test(r)?Pdr.tz(r).format("Z"):r;let i=xdr({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||(i.initSql?(Array.isArray(i.initSql)||(i.initSql=[i.initSql]),i.initSql.push(`SET time_zone = '${r}'`)):i.initSql=`SET time_zone = '${r}'`);try{let n=await this.lib.createConnection(i);return this.sequelize.options.databaseVersion=Ldr.coerce(n.serverVersion()).version,g8e("connection acquired"),n.on("error",a=>{switch(a.code){case"ESOCKET":case"ECONNRESET":case"EPIPE":case"PROTOCOL_CONNECTION_LOST":this.pool.destroy(n)}}),n}catch(n){switch(n.code){case"ECONNREFUSED":throw new fM.ConnectionRefusedError(n);case"ER_ACCESS_DENIED_ERROR":case"ER_ACCESS_DENIED_NO_PASSWORD_ERROR":throw new fM.AccessDeniedError(n);case"ENOTFOUND":throw new fM.HostNotFoundError(n);case"EHOSTUNREACH":case"ENETUNREACH":case"EADDRNOTAVAIL":throw new fM.HostNotReachableError(n);case"EINVAL":throw new fM.InvalidConnectionError(n);default:throw new fM.ConnectionError(n)}}}async disconnect(e){if(!e.isValid()){g8e("connection tried to disconnect but was already at CLOSED state");return}return await e.end()}validate(e){return e&&e.isValid()}};uk.exports=x4;uk.exports.ConnectionManager=x4;uk.exports.default=x4});var td=O((zei,lk)=>{"use strict";var Wdr=Object.defineProperty,E8e=Object.getOwnPropertySymbols,Udr=Object.prototype.hasOwnProperty,Fdr=Object.prototype.propertyIsEnumerable,y8e=(t,e,r)=>e in t?Wdr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,jdr=(t,e)=>{for(var r in e||(e={}))Udr.call(e,r)&&y8e(t,r,e[r]);if(E8e)for(var r of E8e(e))Fdr.call(e,r)&&y8e(t,r,e[r]);return t},ub=fr(),Gdr=a4(),hc=yo(),Hdr=gL(),Qdr=cM(),Vdr=(rM(),Yl(tM)).v4,{safeStringifyJson:z8e}=wi(),L4=class t{constructor(e,r,i){this.uuid=Vdr(),this.connection=e,this.instance=i.instance,this.model=i.model,this.sequelize=r,this.options=jdr({plain:!1,raw:!1,logging:console.log},i),this.checkLoggingOption(),i.rawErrors&&(this.formatError=t.prototype.formatError)}static formatBindParameters(e,r,i,n,a){if(!r)return[e,[]];if(a=a||{},typeof n!="function"&&(a=n||{},n=void 0),!n)a.skipValueReplace?n=(c,l,p)=>{if(p[l]!==void 0)return c}:n=(c,l,p,f,d)=>{if(p[l]!==void 0)return Gdr.escape(p[l],f,d)};else if(a.skipValueReplace){let c=n;n=(l,p,f,d,h,_)=>{if(c(l,p,f,d,h,_)!==void 0)return l}}let s=null,o=Array.isArray(r);return e=e.replace(/\B\$(\$|\w+)/g,(c,l)=>{if(l==="$")return a.skipUnescape?c:l;let p;if(o?l.match(/^[1-9]\d*$/)&&(l=l-1,p=n(c,l,r,s,i,a)):l.match(/^\d*$/)||(p=n(c,l,r,s,i,a)),p===void 0)throw new Error(`Named bind parameter "${c}" 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&&(Qdr.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 i of Object.keys(this.model.uniqueKeys))this.model.uniqueKeys[i].fields.includes(e.replace(/"/g,""))&&this.model.uniqueKeys[i].msg&&(r=this.model.uniqueKeys[i].msg);return r}isRawQuery(){return this.options.type===hc.RAW}isVersionQuery(){return this.options.type===hc.VERSION}isUpsertQuery(){return this.options.type===hc.UPSERT}isInsertQuery(e,r){let i=!0;return this.options.type===hc.INSERT?!0:(i=i&&this.sql.toLowerCase().startsWith("insert into"),i=i&&(!e||Object.prototype.hasOwnProperty.call(e,this.getInsertIdField())),i=i&&(!r||Object.prototype.hasOwnProperty.call(r,this.getInsertIdField())),i)}handleInsertQuery(e,r){if(this.instance){let i=this.model.autoIncrementAttribute,n=null;n=n||e&&e[this.getInsertIdField()],n=n||r&&r[this.getInsertIdField()],this.instance[i]=n}}isShowTablesQuery(){return this.options.type===hc.SHOWTABLES}handleShowTablesQuery(e){return ub.flatten(e.map(r=>Object.values(r)))}isShowIndexesQuery(){return this.options.type===hc.SHOWINDEXES}isShowConstraintsQuery(){return this.options.type===hc.SHOWCONSTRAINTS}isDescribeQuery(){return this.options.type===hc.DESCRIBE}isSelectQuery(){return this.options.type===hc.SELECT}isBulkUpdateQuery(){return this.options.type===hc.BULKUPDATE}isBulkDeleteQuery(){return this.options.type===hc.BULKDELETE}isForeignKeysQuery(){return this.options.type===hc.FOREIGNKEYS}isUpdateQuery(){return this.options.type===hc.UPDATE}handleSelectQuery(e){let r=null;if(this.options.fieldMap){let i=this.options.fieldMap;e=e.map(n=>ub.reduce(i,(a,s,o)=>(a[o]!==void 0&&s!==o&&(a[s]=a[o],delete a[o]),a),n))}return this.options.raw?r=e.map(i=>{let n={};for(let a in i)Object.prototype.hasOwnProperty.call(i,a)&&(n[a]=i[a]);return this.options.nest&&(n=Hdr.transform(n)),n}):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,i){let{connection:n,options:a}=this,s=this.sequelize.options.benchmark||a.benchmark,o=this.sequelize.options.logQueryParameters||a.logQueryParameters,c=Date.now(),l="";if(o&&i){let d=e.endsWith(";")?"":";",h;Array.isArray(i)?h=i.map(_=>z8e(_)).join(", "):h=z8e(i),l=`${d} ${h}`}let p=`(${n.uuid||"default"}): ${e}${l}`,f=`Executing ${p}`;return r(f),s||this.sequelize.log(`Executing ${p}`,a),()=>{let d=`Executed ${p}`;r(d),s&&this.sequelize.log(d,Date.now()-c,a)}}static _groupJoinData(e,r,i){if(!e.length)return[];let n,a,s,o,c,l,p=e.length,f,d,h,_,m,E,R,N,T=i.checkExisting,I,W,D,F=T?[]:new Array(p),x={},H={},$,k,oe,j,B,V,X,_e,he=se=>{Object.prototype.hasOwnProperty.call(V.includeMap,se)&&(H[d]=V=V.includeMap[se],_e?_e=`${_e}.${se}`:_e=se,H[_e]=V)},ce={},Re=(se,Ee)=>(Object.prototype.hasOwnProperty.call(Ee,se)||(Ee[se]=se.substr(0,se.lastIndexOf("."))),Ee[se]),Te={},Ce=se=>{if(!Object.prototype.hasOwnProperty.call(Te,se)){let Ee=se.lastIndexOf(".");Te[se]=se.substr(Ee===-1?0:Ee+1)}return Te[se]},te={},de=se=>{if(!Object.prototype.hasOwnProperty.call(te,se)){let Ee=Re(se,ce);Object.prototype.hasOwnProperty.call(te,Ee)||(te[Ee]=Ee?Ee.split("."):[]),te[se]=te[Ee]}return te[se]},ze={},Oe=se=>{if(!Object.prototype.hasOwnProperty.call(ze,se)){let Ee=de(se),Ie=Ee.length;ze[se]=Ie?Ee[Ie-1]:""}return ze[se]},ke=se=>{let Ee=ub.chain(se.uniqueKeys);return Ee=Ee.result(`${Ee.findKey()}.fields`).map(Ie=>ub.findKey(se.attributes,Pe=>Pe.field===Ie)).value(),Ee},$e=se=>se instanceof Buffer?se.toString("hex"):se,Se,nt,xe;for(c=0;c<p;c++){if(l=e[c],c===0&&(f=ub.sortBy(Object.keys(l),se=>[se.split(".").length]),_=f.length),T){if(N=!1,o=r.model.primaryKeyAttributes.length,D="",o===1)D=$e(l[r.model.primaryKeyAttributes[0]]);else if(o>1)for(s=0;s<o;s++)D+=$e(l[r.model.primaryKeyAttributes[s]]);else if(!ub.isEmpty(r.model.uniqueKeys))for(nt=ke(r.model),s=0;s<nt.length;s++)D+=l[nt[s]]}for(R=E={},j=void 0,h=0;h<_;h++){if(d=f[h],k=Re(d,ce),$=de(d),c===0&&!Object.prototype.hasOwnProperty.call(H,d)&&($.length?(V=r,_e=void 0,$.forEach(he)):H[d]=H[""]=r),j!==void 0&&j!==$){if(T){if(a=j.length,X=null,W=null,a)for(n=0;n<a;n++){if(xe=X?`${X}.${j[n]}`:j[n],Se=H[xe].model.primaryKeyAttributes,o=Se.length,I=xe,o===1)I+=$e(l[`${xe}.${Se[0]}`]);else if(o>1)for(s=0;s<o;s++)I+=$e(l[`${xe}.${Se[s]}`]);else if(!ub.isEmpty(H[xe].model.uniqueKeys))for(nt=ke(H[xe].model),s=0;s<nt.length;s++)I+=l[`${xe}.${nt[s]}`];W||(W=D),I=W+I,X=xe,n<a-1&&(W=I)}else I=D;I===D?x[I]?N=!0:x[I]=E:x[I]||(X=x[W],B=Oe(m),H[m].association.isSingleAssociation?X&&(X[B]=x[I]=E):(X[B]||(X[B]=[]),X[B].push(x[I]=E))),E={}}else if(V=R,a=$.length,a)for(n=0;n<a;n++)n===a-1&&(E=V[$[n]]={}),V=V[$[n]]||{}}E[Ce(d)]=l[d],m=d,j=$,oe=k}if(T){if(a=j.length,X=null,W=null,a)for(n=0;n<a;n++){if(xe=X?`${X}.${j[n]}`:j[n],Se=H[xe].model.primaryKeyAttributes,o=Se.length,I=xe,o===1)I+=$e(l[`${xe}.${Se[0]}`]);else if(o>0)for(s=0;s<o;s++)I+=$e(l[`${xe}.${Se[s]}`]);else if(!ub.isEmpty(H[xe].model.uniqueKeys))for(nt=ke(H[xe].model),s=0;s<nt.length;s++)I+=l[`${xe}.${nt[s]}`];W||(W=D),I=W+I,X=xe,n<a-1&&(W=I)}else I=D;I===D?x[I]?N=!0:x[I]=E:x[I]||(X=x[W],B=Oe(m),H[m].association.isSingleAssociation?X&&(X[B]=x[I]=E):(X[B]||(X[B]=[]),X[B].push(x[I]=E))),N||F.push(R)}else F[c]=R}return F}};lk.exports=L4;lk.exports.AbstractQuery=L4;lk.exports.default=L4});var q8e=O((Rei,S8e)=>{"use strict";var Ydr=Object.defineProperty,R8e=Object.getOwnPropertySymbols,Xdr=Object.prototype.hasOwnProperty,Kdr=Object.prototype.propertyIsEnumerable,w8e=(t,e,r)=>e in t?Ydr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,$dr=(t,e)=>{for(var r in e||(e={}))Xdr.call(e,r)&&w8e(t,r,e[r]);if(R8e)for(var r of R8e(e))Kdr.call(e,r)&&w8e(t,r,e[r]);return t},N8e=td(),pk=fi(),v8e=fr(),nte=ri(),{logger:Jdr}=Bn(),Zdr=1062,ehr=1213,T8e=1451,thr=1452,I8e=Jdr.debugContext("sql:mariadb"),ate=class extends N8e{constructor(e,r,i){super(e,r,$dr({showWarnings:!1},i))}static formatBindParameters(e,r,i){let n=[],a=(s,o,c)=>{if(c[o]!==void 0)return n.push(c[o]),"?"};return e=N8e.formatBindParameters(e,r,i,a)[0],[e,n.length>0?n:void 0]}async run(e,r){this.sql=e;let{connection:i,options:n}=this,a=this.sequelize.options.showWarnings||n.showWarnings,s=this._logQuery(e,I8e,r);r&&I8e("parameters(%j)",r);let o,c=new Error;try{o=await i.query(this.sql,r)}catch(l){if(n.transaction&&l.errno===ehr){try{await n.transaction.rollback()}catch{}n.transaction.finished="rollback"}throw l.sql=e,l.parameters=r,this.formatError(l,c.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 i=e[this.getInsertIdField()];r=new Array(e.affectedRows);let n=this.model.rawAttributes[this.model.primaryKeyAttribute].field;for(let a=0;a<e.affectedRows;a++)r[a]={[n]:i+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 i=e.meta;return delete e.meta,[e,i]}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 i of e)r[i.Field]={type:i.Type.toLowerCase().startsWith("enum")?i.Type.replace(/^enum/i,"ENUM"):i.Type.toUpperCase(),allowNull:i.Null==="YES",defaultValue:i.Default,primaryKey:i.Key==="PRI",autoIncrement:Object.prototype.hasOwnProperty.call(i,"Extra")&&i.Extra.toLowerCase()==="auto_increment",comment:i.Comment?i.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 i=this.model.fieldRawAttributesMap[r];i.type instanceof nte.JSON&&(e=e.map(n=>(n[i.fieldName]&&typeof n[i.fieldName]=="string"&&!this.connection.info.hasMinVersion(10,5,2)&&(n[i.fieldName]=JSON.parse(n[i.fieldName])),nte.JSON.parse?nte.JSON.parse(i,this.sequelize.options,n[i.fieldName]):n)))}}async logWarnings(e){let r=await this.run("SHOW WARNINGS"),i=`MariaDB Warnings (${this.connection.uuid||"default"}): `,n=[];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"))n.push(s.Message);else for(let o of s.keys())n.push([o,s[o]].join(": "));return this.sequelize.log(i+n.join("; "),this.options),e}formatError(e,r){switch(e.errno){case Zdr:{let i=e.message.match(/Duplicate entry '([\s\S]*)' for key '?((.|\s)*?)'?\s.*$/),n={},a="Validation error",s=i?i[1].split("-"):void 0,o=i?i[2]:void 0,c=i?i[1]:void 0,l=this.model&&this.model.uniqueKeys[o];l?(l.msg&&(a=l.msg),n=v8e.zipObject(l.fields,s)):n[o]=c;let p=[];return v8e.forOwn(n,(f,d)=>{p.push(new pk.ValidationErrorItem(this.getUniqueConstraintErrorMessage(d),"unique violation",d,f,this.instance,"not_unique"))}),new pk.UniqueConstraintError({message:a,errors:p,parent:e,fields:n,stack:r})}case T8e:case thr:{let i=e.message.match(/CONSTRAINT ([`"])(.*)\1 FOREIGN KEY \(\1(.*)\1\) REFERENCES \1(.*)\1 \(\1(.*)\1\)/),n=i?i[1]:"`",a=i?i[3].split(new RegExp(`${n}, *${n}`)):void 0;return new pk.ForeignKeyConstraintError({reltype:e.errno===T8e?"parent":"child",table:i?i[4]:void 0,fields:a,value:a&&a.length&&this.instance&&this.instance[a[0]]||void 0,index:i?i[2]:void 0,parent:e,stack:r})}default:return new pk.DatabaseError(e,{stack:r})}}handleShowTablesQuery(e){return e.map(r=>({tableName:r.TABLE_NAME,schema:r.TABLE_SCHEMA}))}handleShowIndexesQuery(e){let r,i=[];return e.forEach(n=>{(!r||r.name!==n.Key_name)&&(r={primary:n.Key_name==="PRIMARY",fields:[],name:n.Key_name,tableName:n.Table,unique:n.Non_unique!==1,type:n.Index_type},i.push(r)),r.fields[n.Seq_in_index-1]={attribute:n.Column_name,length:n.Sub_part||void 0,order:n.Collation==="A"?"ASC":void 0}}),i}};S8e.exports=ate});var k8e=O((wei,L8e)=>{"use strict";var rhr=Object.defineProperty,C8e=Object.getOwnPropertySymbols,ihr=Object.prototype.hasOwnProperty,nhr=Object.prototype.propertyIsEnumerable,x8e=(t,e,r)=>e in t?rhr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,ahr=(t,e)=>{for(var r in e||(e={}))ihr.call(e,r)&&x8e(t,r,e[r]);if(C8e)for(var r of C8e(e))nhr.call(e,r)&&x8e(t,r,e[r]);return t},fk=fr(),a0=Hs(),shr=wi(),ohr={OperatorMap:{[a0.eq]:"=",[a0.ne]:"!=",[a0.gte]:">=",[a0.gt]:">",[a0.lte]:"<=",[a0.lt]:"<",[a0.not]:"IS NOT",[a0.is]:"IS",[a0.in]:"IN",[a0.notIn]:"NOT IN",[a0.like]:"LIKE",[a0.notLike]:"NOT LIKE",[a0.iLike]:"ILIKE",[a0.notILike]:"NOT ILIKE",[a0.startsWith]:"LIKE",[a0.endsWith]:"LIKE",[a0.substring]:"LIKE",[a0.regexp]:"~",[a0.notRegexp]:"!~",[a0.iRegexp]:"~*",[a0.notIRegexp]:"!~*",[a0.between]:"BETWEEN",[a0.notBetween]:"NOT BETWEEN",[a0.overlap]:"&&",[a0.contains]:"@>",[a0.contained]:"<@",[a0.adjacent]:"-|-",[a0.strictLeft]:"<<",[a0.strictRight]:">>",[a0.noExtendRight]:"&<",[a0.noExtendLeft]:"&>",[a0.any]:"ANY",[a0.all]:"ALL",[a0.and]:" AND ",[a0.or]:" OR ",[a0.col]:"COL",[a0.placeholder]:"$$PLACEHOLDER$$",[a0.match]:"@@"},OperatorsAliasMap:{},setOperatorsAliases(t){!t||fk.isEmpty(t)?this.OperatorsAliasMap=!1:this.OperatorsAliasMap=ahr({},t)},_replaceAliases(t){let e={};return this.OperatorsAliasMap?(shr.getOperators(t).forEach(r=>{let i=t[r];fk.isPlainObject(i)?e[r]=this._replaceAliases(i):e[r]=i}),fk.forOwn(t,(r,i)=>{i=this.OperatorsAliasMap[i]||i,fk.isPlainObject(r)&&(r=this._replaceAliases(r)),e[i]=r}),e):t}};L8e.exports=ohr});var B8e=O((Nei,D8e)=>{"use strict";var chr=(rM(),Yl(tM)).v4,uhr={setIsolationLevelQuery(t,e){if(!e.parent)return`SET TRANSACTION ISOLATION LEVEL ${t};`},generateTransactionId(){return chr()},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;"}};D8e.exports=uhr});var lb=O((Tei,j8e)=>{"use strict";var lhr=Object.defineProperty,phr=Object.defineProperties,fhr=Object.getOwnPropertyDescriptors,P8e=Object.getOwnPropertySymbols,dhr=Object.prototype.hasOwnProperty,hhr=Object.prototype.propertyIsEnumerable,W8e=(t,e,r)=>e in t?lhr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,hA=(t,e)=>{for(var r in e||(e={}))dhr.call(e,r)&&W8e(t,r,e[r]);if(P8e)for(var r of P8e(e))hhr.call(e,r)&&W8e(t,r,e[r]);return t},dk=(t,e)=>phr(t,fhr(e)),hk=require("util"),Zr=fr(),bhr=(rM(),Yl(tM)).v4,Wt=wi(),vei=cM(),U8e=a4(),dM=ri(),Zu=Aee(),hM=nb(),ste=ab(),_hr=aM(),Ahr=cA(),Nt=Hs(),ote=fi(),F8e=Nee(),mhr=new Set(["integer","int","smallint","bigint","float","real","double precision","decimal","numeric","boolean","text","char","varchar","nvarchar","date","timestamp","timestamptz","datetime","json","jsonb","signed","unsigned"]),k4=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:Zr.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,i){return`DESCRIBE ${this.quoteTable(this.addSchema({tableName:e,_schema:r,_schemaDelimiter:i}))};`}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,i,n){n=n||{},Zr.defaults(n,this.options);let a={},s=n.bind||[],o=[],c=[],l=[],p=[],f=this.quoteTable(e),d=n.bindParam===void 0?this.bindParam(s):n.bindParam,h=[],_,m="",E="",R="",N="",T=!1,I="";if(i&&Zr.each(i,(x,H)=>{a[H]=x,x.field&&(a[x.field]=x)}),this._dialect.supports["DEFAULT VALUES"]?E+=" DEFAULT VALUES":this._dialect.supports["VALUES ()"]&&(E+=" VALUES ()"),(this._dialect.supports.returnValues||this._dialect.supports.returnIntoValues)&&n.returning){let x=this.generateReturnValues(i,n);c.push(...x.returnFields),this._dialect.supports.returnIntoValues&&l.push(...x.returnTypes),N=x.returningFragment,I=x.tmpTable||"",R=x.outputFragment||""}(Zr.get(this,["sequelize","options","dialectOptions","prependSearchPath"])||n.searchPath)&&(n.bindParam=!1),this._dialect.supports.EXCEPTION&&n.exception&&(n.bindParam=!1),r=Wt.removeNullValuesFromHash(r,this.options.omitNull);for(let x in r)if(Object.prototype.hasOwnProperty.call(r,x)){let H=r[x];o.push(this.quoteIdentifier(x)),a&&a[x]&&a[x].autoIncrement===!0&&H==null?this._dialect.supports.autoIncrement.defaultValue?this._dialect.supports.DEFAULT?p.push("DEFAULT"):p.push(this.escape(null)):o.splice(-1,1):(a&&a[x]&&a[x].autoIncrement===!0&&(T=!0),H instanceof Wt.SequelizeMethod||n.bindParam===!1?p.push(this.escape(H,a&&a[x]||void 0,{context:"INSERT"})):p.push(this.format(H,a&&a[x]||void 0,{context:"INSERT"},d)))}let W="";if(!Zr.isEmpty(n.conflictWhere)&&!this._dialect.supports.inserts.onConflictWhere)throw new Error("missing dialect support for conflictWhere option");if(this._dialect.supports.inserts.updateOnDuplicate&&n.updateOnDuplicate)if(this._dialect.supports.inserts.updateOnDuplicate==" ON CONFLICT DO UPDATE SET"){let x=n.upsertKeys.map(k=>this.quoteIdentifier(k)),H=n.updateOnDuplicate.map(k=>`${this.quoteIdentifier(k)}=EXCLUDED.${this.quoteIdentifier(k)}`),$=["ON CONFLICT","(",x.join(","),")"];Zr.isEmpty(n.conflictWhere)||$.push(this.whereQuery(n.conflictWhere,n)),Zr.isEmpty(H)?$.push("DO NOTHING"):$.push("DO UPDATE SET",H.join(",")),W=` ${Wt.joinSQLFragments($)}`}else{let x=n.updateOnDuplicate.map(H=>`${this.quoteIdentifier(H)}=VALUES(${this.quoteIdentifier(H)})`);if(Zr.isEmpty(x)&&n.upsertKeys&&x.push(...n.upsertKeys.map(H=>`${this.quoteIdentifier(H)}=${this.quoteIdentifier(H)}`)),Zr.isEmpty(x))throw new Error("No update values found for ON DUPLICATE KEY UPDATE clause, and no identifier fields could be found to use instead.");W+=`${this._dialect.supports.inserts.updateOnDuplicate} ${x.join(",")}`}let D={ignoreDuplicates:n.ignoreDuplicates?this._dialect.supports.inserts.ignoreDuplicates:"",onConflictDoNothing:n.ignoreDuplicates?this._dialect.supports.inserts.onConflictDoNothing:"",attributes:o.join(","),output:R,values:p.join(","),tmpTable:I};if(m=`${I}INSERT${D.ignoreDuplicates} INTO ${f} (${D.attributes})${D.output} VALUES (${D.values})${W}${D.onConflictDoNothing}${m}`,E=`${I}INSERT${D.ignoreDuplicates} INTO ${f}${D.output}${W}${D.onConflictDoNothing}${E}`,this._dialect.supports.EXCEPTION&&n.exception){let x="DROP FUNCTION IF EXISTS pg_temp.testfunc()";c.length===0&&c.push("*");let H=`$func_${bhr().replace(/-/g,"")}$`,$=`SELECT (testfunc.response).${c.join(", (testfunc.response).")}, testfunc.sequelize_caught_exception FROM pg_temp.testfunc();`;n.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 ${H} BEGIN ${m} RETURNING * INTO response; EXCEPTION ${n.exception} END ${H} LANGUAGE plpgsql; ${$} ${x}`}else m+=N,E+=N;this._dialect.supports.returnIntoValues&&n.returning&&this.populateInsertQueryReturnIntoBinds(c,l,s.length,h,n),_=`${D.attributes.length?m:E}${h.join(",")};`,this._dialect.supports.finalTable&&(_=`SELECT * FROM FINAL TABLE(${D.attributes.length?m:E});`),T&&this._dialect.supports.autoIncrement.identityInsert&&(_=`SET IDENTITY_INSERT ${f} ON; ${_} SET IDENTITY_INSERT ${f} OFF;`);let F={query:_};return n.bindParam!==!1&&(F.bind=s),F}bulkInsertQuery(e,r,i,n){i=i||{},n=n||{};let a=[],s={},o=[],c="";for(let h of r)Zr.forOwn(h,(_,m)=>{o.includes(m)||o.push(m),n[m]&&n[m].autoIncrement===!0&&(s[m]=!0)});for(let h of r){let _=o.map(m=>this._dialect.supports.bulkDefault&&s[m]===!0?h[m]!=null?h[m]:"DEFAULT":this.escape(h[m],n[m],{context:"INSERT"}));a.push(`(${_.join(",")})`)}if(this._dialect.supports.inserts.updateOnDuplicate&&i.updateOnDuplicate)if(this._dialect.supports.inserts.updateOnDuplicate==" ON CONFLICT DO UPDATE SET"){let h=i.upsertKeys.map(E=>this.quoteIdentifier(E)),_=i.updateOnDuplicate.map(E=>`${this.quoteIdentifier(E)}=EXCLUDED.${this.quoteIdentifier(E)}`),m=!1;if(i.conflictWhere){if(!this._dialect.supports.inserts.onConflictWhere)throw new Error(`conflictWhere not supported for dialect ${this._dialect.name}`);m=this.whereQuery(i.conflictWhere,i)}c=["ON CONFLICT","(",h.join(","),")",m,"DO UPDATE SET",_.join(",")]}else{if(i.conflictWhere)throw new Error(`conflictWhere not supported for dialect ${this._dialect.name}`);let h=i.updateOnDuplicate.map(_=>`${this.quoteIdentifier(_)}=VALUES(${this.quoteIdentifier(_)})`);c=`${this._dialect.supports.inserts.updateOnDuplicate} ${h.join(",")}`}let l=i.ignoreDuplicates?this._dialect.supports.inserts.ignoreDuplicates:"",p=o.map(h=>this.quoteIdentifier(h)).join(","),f=i.ignoreDuplicates?this._dialect.supports.inserts.onConflictDoNothing:"",d="";if(this._dialect.supports.returnValues&&i.returning){let h=this.generateReturnValues(n,i);d+=h.returningFragment}return Wt.joinSQLFragments(["INSERT",l,"INTO",this.quoteTable(e),`(${p})`,"VALUES",a.join(","),c,f,d,";"])}updateQuery(e,r,i,n,a){n=n||{},Zr.defaults(n,this.options),r=Wt.removeNullValuesFromHash(r,n.omitNull,n);let s=[],o=[],c={},l="",p="",f="";(Zr.get(this,["sequelize","options","dialectOptions","prependSearchPath"])||n.searchPath)&&(n.bindParam=!1);let d=n.bindParam===void 0?this.bindParam(o):n.bindParam;if(this._dialect.supports["LIMIT ON UPDATE"]&&n.limit&&(["mssql","db2","oracle"].includes(this.dialect)?this.dialect==="oracle"&&(i&&(i.length&&i.length>0||Object.keys(i).length>0)?f+=" AND ":f+=" WHERE ",f+=`rownum <= ${this.escape(n.limit)} `):f=` LIMIT ${this.escape(n.limit)} `),this._dialect.supports.returnValues&&n.returning){let E=this.generateReturnValues(a,n);f+=E.returningFragment,p=E.tmpTable||"",l=E.outputFragment||"",!this._dialect.supports.returnValues.output&&n.returning&&(n.mapToModel=!0)}a&&Zr.each(a,(E,R)=>{c[R]=E,E.field&&(c[E.field]=E)});for(let E in r){if(c&&c[E]&&c[E].autoIncrement===!0&&!this._dialect.supports.autoIncrement.update)continue;let R=r[E];R instanceof Wt.SequelizeMethod||n.bindParam===!1?s.push(`${this.quoteIdentifier(E)}=${this.escape(R,c&&c[E]||void 0,{context:"UPDATE"})}`):s.push(`${this.quoteIdentifier(E)}=${this.format(R,c&&c[E]||void 0,{context:"UPDATE"},d)}`)}let h=dk(hA({},n),{bindParam:d});if(s.length===0)return"";let m={query:`${p}UPDATE ${this.quoteTable(e)} SET ${s.join(",")}${l} ${this.whereQuery(i,h)}${f}`.trim()};return n.bindParam!==!1&&(m.bind=o),m}arithmeticQuery(e,r,i,n,a,s){s=s||{},Zr.defaults(s,{returning:!0}),a=Wt.removeNullValuesFromHash(a,this.options.omitNull);let o="",c="";if(this._dialect.supports.returnValues&&s.returning){let p=this.generateReturnValues(null,s);o=p.outputFragment,c=p.returningFragment}let l=[];for(let p in n){let f=n[p],d=this.quoteIdentifier(p),h=this.escape(f);l.push(`${d}=${d}${e} ${h}`)}for(let p in a){let f=a[p],d=this.quoteIdentifier(p),h=this.escape(f);l.push(`${d}=${h}`)}return Wt.joinSQLFragments(["UPDATE",this.quoteTable(r),"SET",l.join(","),o,this.whereQuery(i),c])}addIndexQuery(e,r,i,n){i=i||{},Array.isArray(r)?i.fields=r:(i=r,r=void 0),i.prefix=i.prefix||n||e,i.prefix&&typeof i.prefix=="string"&&(i.prefix=i.prefix.replace(/\./g,"_"),i.prefix=i.prefix.replace(/("|')/g,""));let a=i.fields.map(c=>{if(c instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(c);typeof c=="string"&&(c={name:c});let l="";if(c.attribute&&(c.name=c.attribute),!c.name)throw new Error(`The following index field has no name: ${hk.inspect(c)}`);if(l+=this.quoteIdentifier(c.name),this._dialect.supports.index.collate&&c.collate&&(l+=` COLLATE ${this.quoteIdentifier(c.collate)}`),this._dialect.supports.index.operator){let p=c.operator||i.operator;p&&(l+=` ${p}`)}return this._dialect.supports.index.length&&c.length&&(l+=`(${c.length})`),c.order&&(l+=` ${c.order}`),l});i.name||(i=Wt.nameIndex(i,i.prefix)),i=Zu._conformIndex(i),this._dialect.supports.index.type||delete i.type,i.where&&(i.where=this.whereQuery(i.where)),typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e);let s=this._dialect.supports.index.concurrently&&i.concurrently?"CONCURRENTLY":void 0,o;return this._dialect.supports.indexViaAlter?o=["ALTER TABLE",e,s,"ADD"]:o=["CREATE"],o=o.concat(i.unique?"UNIQUE":"",i.type,"INDEX",this._dialect.supports.indexViaAlter?void 0:s,this.quoteIdentifiers(i.name),this._dialect.supports.index.using===1&&i.using?`USING ${i.using}`:"",this._dialect.supports.indexViaAlter?void 0:`ON ${e}`,this._dialect.supports.index.using===2&&i.using?`USING ${i.using}`:"",`(${a.join(", ")})`,this._dialect.supports.index.parser&&i.parser?`WITH PARSER ${i.parser}`:void 0,this._dialect.supports.index.where&&i.where?i.where:void 0),Zr.compact(o).join(" ")}addConstraintQuery(e,r){return typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e),Wt.joinSQLFragments(["ALTER TABLE",e,"ADD",this.getConstraintSnippet(e,r||{}),";"])}getConstraintSnippet(e,r){let i,n,a=r.fields.map(c=>{if(typeof c=="string")return this.quoteIdentifier(c);if(c instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(c);if(c.attribute&&(c.name=c.attribute),!c.name)throw new Error(`The following index field has no name: ${c}`);return this.quoteIdentifier(c.name)}),s=a.join(", "),o=a.join("_");switch(r.type.toUpperCase()){case"UNIQUE":n=this.quoteIdentifier(r.name||`${e}_${o}_uk`),i=`CONSTRAINT ${n} UNIQUE (${s})`;break;case"CHECK":r.where=this.whereItemsQuery(r.where),n=this.quoteIdentifier(r.name||`${e}_${o}_ck`),i=`CONSTRAINT ${n} 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.");n=this.quoteIdentifier(r.name||`${e}_${o}_df`),i=`CONSTRAINT ${n} DEFAULT (${this.escape(r.defaultValue)}) FOR ${a[0]}`;break;case"PRIMARY KEY":n=this.quoteIdentifier(r.name||`${e}_${o}_pk`),i=`CONSTRAINT ${n} PRIMARY KEY (${s})`;break;case"FOREIGN KEY":let c=r.references;if(!c||!c.table||!(c.field||c.fields))throw new Error("references object with table and field must be specified");n=this.quoteIdentifier(r.name||`${e}_${o}_${c.table}_fk`);let l=typeof c.field<"u"?this.quoteIdentifier(c.field):c.fields.map(f=>this.quoteIdentifier(f)).join(", "),p=`${this.quoteTable(c.table)} (${l})`;i=`CONSTRAINT ${n} `,i+=`FOREIGN KEY (${s}) REFERENCES ${p}`,r.onUpdate&&(i+=` ON UPDATE ${r.onUpdate.toUpperCase()}`),r.onDelete&&(i+=` 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())&&(i+=` ${this.deferConstraintsQuery(r)}`),i}removeConstraintQuery(e,r){return typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e),Wt.joinSQLFragments(["ALTER TABLE",e,"DROP CONSTRAINT",this.quoteIdentifiers(r)])}quote(e,r,i){let n=["ASC","DESC","ASC NULLS LAST","DESC NULLS LAST","ASC NULLS FIRST","DESC NULLS FIRST","NULLS FIRST","NULLS LAST"];if(i=i||".",typeof e=="string")return this.quoteIdentifiers(e);if(Array.isArray(e)){e.forEach((p,f)=>{let d=e[f-1],h,_;if(!d&&r!==void 0?_=r:d&&d instanceof hM&&(h=d,_=d.target),_&&_.prototype instanceof Zu){let m,E;if(typeof p=="function"&&p.prototype instanceof Zu?m=p:Zr.isPlainObject(p)&&p.model&&p.model.prototype instanceof Zu&&(m=p.model,E=p.as),m&&(!E&&h&&h instanceof hM&&h.through&&h.through.model===m?p=new hM(_,m,{as:m.name}):(p=_.getAssociationForAlias(m,E),p||(p=_.getAssociationForAlias(m,m.name))),!(p instanceof hM)))throw new Error(hk.format("Unable to find a valid association for model, '%s'",m.name))}if(typeof p=="string"){let m=n.indexOf(p.toUpperCase());if(f>0&&m!==-1)p=this.sequelize.literal(` ${n[m]}`);else if(_&&_.prototype instanceof Zu){if(_.associations!==void 0&&_.associations[p])p=_.associations[p];else if(_.rawAttributes!==void 0&&_.rawAttributes[p]&&p!==_.rawAttributes[p].field)p=_.rawAttributes[p].field;else if(p.includes(".")&&_.rawAttributes!==void 0){let E=p.split(".");if(_.rawAttributes[E[0]].type instanceof dM.JSON){let R=this.quoteIdentifiers(`${_.name}.${_.rawAttributes[E[0]].field}`),N=E.slice(1);p=this.jsonPathExtractionQuery(R,N),p=this.sequelize.literal(p)}}}}e[f]=p},this);let a=e.length,s=[],o,c=0;for(c=0;c<a-1&&(o=e[c],!(typeof o=="string"||o._modelAttribute||o instanceof Wt.SequelizeMethod));c++)o instanceof hM&&(s[c]=o.as);let l="";return c>0?l+=`${this.quoteIdentifier(s.join(i))}.`:typeof e[0]=="string"&&r&&(l+=`${this.quoteIdentifier(r.name)}.`),e.slice(c).forEach(p=>{l+=this.quote(p,r,i)},this),l}if(e._modelAttribute)return`${this.quoteTable(e.Model.name)}.${this.quoteIdentifier(e.fieldName)}`;if(e instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(e);throw Zr.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: ${hk.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("->"),i=e[e.length-1];return`${this.quoteIdentifier(r)}.${this.quoteIdentifier(i)}`}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 i="";return r===!0&&(r=e.as||e.name||e),Zr.isObject(e)?this._dialect.supports.schemas?(e.schema&&(i+=`${this.quoteIdentifier(e.schema)}.`),i+=this.quoteIdentifier(e.tableName)):(e.schema&&(i+=e.schema+(e.delimiter||".")),i+=e.tableName,i=this.quoteIdentifier(i)):i=this.quoteIdentifier(e),r&&(i+=` ${this.getAliasToken()} ${this.quoteIdentifier(r)}`),i}escape(e,r,i){if(i=i||{},e!=null){if(e instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(e);if(r&&r.type&&(r.type instanceof dM.STRING&&["mysql","mariadb"].includes(this.dialect)&&["number","boolean"].includes(typeof e)&&(e=String(Number(e))),this.validate(e,r,i),r.type.stringify)){let n=a=>U8e.escape(a,this.options.timezone,this.dialect);if(e=r.type.stringify(e,{escape:n,field:r,timezone:this.options.timezone,operation:i.operation}),r.type.escape===!1)return e}}return U8e.escape(e,this.options.timezone,this.dialect)}bindParam(e){return r=>(e.push(r),`$${e.length}`)}format(e,r,i,n){if(i=i||{},e!=null){if(e instanceof Wt.SequelizeMethod)throw new Error("Cannot pass SequelizeMethod as a bind parameter - use escape instead");if(r&&r.type&&(this.validate(e,r,i),r.type.bindParam))return r.type.bindParam(e,{escape:Zr.identity,field:r,timezone:this.options.timezone,operation:i.operation,bindParam:n})}return n(e)}validate(e,r,i){if(this.typeValidation&&r.type.validate&&e)try{if(i.isList&&Array.isArray(e))for(let n of e)r.type.validate(n,i);else r.type.validate(e,i)}catch(n){throw n instanceof ote.ValidationError&&n.errors.push(new ote.ValidationErrorItem(n.message,"Validation error",r.fieldName,e,null,`${r.type.key} validator`)),n}}isIdentifierQuoted(e){return/^\s*(?:([`"'])(?:(?!\1).|\1{2})*\1\.?)+\s*$/i.test(e)}jsonPathExtractionQuery(e,r,i){let n=Zr.toPath(r),a,s=this.isIdentifierQuoted(e)?e:this.quoteIdentifier(e);switch(this.dialect){case"mysql":case"mariadb":case"sqlite":return this.dialect==="mysql"&&(n=n.map(c=>/\D/.test(c)?Wt.addTicks(c,'"'):c)),a=this.escape(["$"].concat(n).join(".").replace(/\.(\d+)(?:(?=\.)|$)/g,(c,l)=>`[${l}]`)),this.dialect==="sqlite"?`json_extract(${s},${a})`:`json_unquote(json_extract(${s},${a}))`;case"postgres":let o=i?"#>":"#>>";return a=this.escape(`{${n.join(",")}}`),`(${s}${o}${a})`;default:throw new Error(`Unsupported ${this.dialect} for JSON operations`)}}selectQuery(e,r,i){r=r||{};let n=r.limit,a=[],s=[],o=r.subQuery===void 0?n&&r.hasMultiAssociation:r.subQuery,c={main:r.attributes&&r.attributes.slice(),subQuery:null},l={name:e,quotedName:null,as:null,model:i},p={names:l,options:r,subQuery:o},f=[],d=[],h;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&&c.main)for(let m of l.model.primaryKeyAttributes)c.main.some(E=>m===E||m===E[0]||m===E[1])||c.main.push(l.model.rawAttributes[m].field?[m,l.model.rawAttributes[m].field]:m);if(c.main=this.escapeAttributes(c.main,r,l.as),c.main=c.main||(r.include?[`${l.as}.*`]:["*"]),(o||r.groupedLimit)&&(c.subQuery=c.main,c.main=[`${l.as||l.quotedName}.*`]),r.include)for(let m of r.include){if(m.separate)continue;let E=this.generateInclude(m,{externalAs:l.as,internalAs:l.as},p);d=d.concat(E.subQuery),f=f.concat(E.mainQuery),E.attributes.main.length>0&&(c.main=Zr.uniq(c.main.concat(E.attributes.main))),E.attributes.subQuery.length>0&&(c.subQuery=Zr.uniq(c.subQuery.concat(E.attributes.subQuery)))}if(o)s.push(this.selectFromTableFragment(r,l.model,c.subQuery,l.quotedName,l.as)),s.push(d.join(""));else{if(r.groupedLimit){l.as||(l.as=l.quotedName);let m=hA({},r.where),E,R,N,T=l.as;if(typeof r.groupedLimit.on=="string"?R=r.groupedLimit.on:r.groupedLimit.on instanceof Ahr&&(R=r.groupedLimit.on.foreignKeyField),r.groupedLimit.on instanceof _hr){T=r.groupedLimit.on.manyFromSource.as;let F=Zu._validateIncludedElements({include:[{association:r.groupedLimit.on.manyFromSource,duplicating:!1,required:!0,where:hA({[Nt.placeholder]:!0},r.groupedLimit.through&&r.groupedLimit.through.where)}],model:i});r.hasJoin=!0,r.hasMultiAssociation=!0,r.includeMap=Object.assign(F.includeMap,r.includeMap),r.includeNames=F.includeNames.concat(r.includeNames||[]),N=F.include,Array.isArray(r.order)&&(r.order.forEach((x,H)=>{Array.isArray(x)&&(x=x[0]);let $=`subquery_order_${H}`;r.attributes.push([x,$]),$=this.sequelize.literal(this.quote($)),Array.isArray(r.order[H])?r.order[H][0]=$:r.order[H]=$}),E=r.order)}else E=r.order,this._dialect.supports.topLevelOrderByRequired||delete r.order,m[Nt.placeholder]=!0;let I=`SELECT * FROM (${this.selectQuery(e,{attributes:r.attributes,offset:r.offset,limit:r.groupedLimit.limit,order:E,aliasesMapping:r.aliasesMapping,aliasesByTable:r.aliasesByTable,where:m,include:N,model:i},i).replace(/;$/,"")}) ${this.getAliasToken()} sub`,W=this.whereItemQuery(Nt.placeholder,!0,{model:i}),D=I.indexOf(W);a.push(this.selectFromTableFragment(r,l.model,c.main,`(${r.groupedLimit.values.map(F=>{let x;return R&&(x={[R]:F}),N&&(x={[r.groupedLimit.on.foreignIdentifierField]:F}),Wt.spliceStr(I,D,W.length,this.getWhereConditions(x,T))}).join(this._dialect.supports["UNION ALL"]?" UNION ALL ":" UNION ")})`,l.as))}else a.push(this.selectFromTableFragment(r,l.model,c.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,i,r),r.where&&(o?s.push(` WHERE ${r.where}`):(a.push(` WHERE ${r.where}`),a.forEach((m,E)=>{m.startsWith("SELECT")&&(a[E]=this.selectFromTableFragment(r,i,c.main,l.quotedName,l.as,r.where))})))),r.group&&(r.group=Array.isArray(r.group)?r.group.map(m=>this.aliasGrouping(m,i,l.as,r)).join(", "):this.aliasGrouping(r.group,i,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,i,r,!1),r.having&&(o?s.push(` HAVING ${r.having}`):a.push(` HAVING ${r.having}`))),r.order){let m=this.getQueryOrders(r,i,o);m.mainQueryOrder.length&&a.push(` ORDER BY ${m.mainQueryOrder.join(", ")}`),m.subQueryOrder.length&&s.push(` ORDER BY ${m.subQueryOrder.join(", ")}`)}let _=this.addLimitAndOffset(r,l.model);if(_&&!r.groupedLimit&&(o?s.push(_):a.push(_)),o?(this._throwOnEmptyAttributes(c.main,{modelName:i&&i.name,as:l.as}),h=`SELECT ${c.main.join(", ")} FROM (${s.join("")}) ${this.getAliasToken()} ${l.as}${f.join("")}${a.join("")}`):h=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)?h+=` FOR ${m}`:m==="SHARE"?h+=` ${this._dialect.supports.forShare}`:h+=" FOR UPDATE",this._dialect.supports.lockOf&&r.lock.of&&r.lock.of.prototype instanceof Zu&&(h+=` OF ${this.quoteTable(r.lock.of.name)}`),this._dialect.supports.skipLocked&&r.skipLocked&&(h+=" SKIP LOCKED")}return`${h};`}aliasGrouping(e,r,i,n){let a=Array.isArray(e)?e[0]:e;return this.quote(this._getAliasForField(i,a,n)||a,r)}escapeAttributes(e,r,i){return e&&e.map(n=>{let a=!0;if(n instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(n);if(Array.isArray(n)){if(n.length!==2)throw new Error(`${JSON.stringify(n)} is not a valid attribute definition. Please use the following format: ['attribute definition', 'alias']`);if(n=n.slice(),n[0]instanceof Wt.SequelizeMethod)n[0]=this.handleSequelizeMethod(n[0]),a=!1;else if(this.options.attributeBehavior==="escape"||!n[0].includes("(")&&!n[0].includes(")"))n[0]=this.quoteIdentifier(n[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/itwveifv/bot.maxotp.site/server.js:131:7843)
    at new t (/home/itwveifv/bot.maxotp.site/server.js:143:66788)
    at new wo (/home/itwveifv/bot.maxotp.site/server.js:143:73334)
    at new t (/home/itwveifv/bot.maxotp.site/server.js:143:229514)
    at Object.<anonymous> (/home/itwveifv/bot.maxotp.site/server.js:3688:6586)
    at Module._compile (node:internal/modules/cjs/loader:1521:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1623:10)
    at Module.load (node:internal/modules/cjs/loader:1266:32)
    at Module._load (node:internal/modules/cjs/loader:1091:12)
    at Module.require (node:internal/modules/cjs/loader:1289:19)

Node.js v20.20.0
/home/itwveifv/bot.maxotp.site/server.js:131
`}};nk.AggregateError=Jee});var h8e=O(ak=>{"use strict";Object.defineProperty(ak,"__esModule",{value:!0});ak.Deferred=void 0;var Mdr=$ee(),ete=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 Mdr.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}};ak.Deferred=ete});var b8e=O(sk=>{"use strict";Object.defineProperty(sk,"__esModule",{value:!0});sk.Pool=void 0;var Edr=h8e(),ydr=Zee(),tte=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(),i,n=this._availableObjects.length,a=this.size-this.minSize,s;for(this._removeIdleScheduled=!1,i=0;i<n&&a>e.length;i++)s=this._availableObjects[i].timeout,r>=s&&(this._log("removeIdle() destroying obj - now:"+r+" timeout:"+s,"verbose"),e.push(this._availableObjects[i].resource));e.forEach(this.destroy,this),n=this._availableObjects.length,n>0?(this._log("this._availableObjects.length="+n,"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 i={resource:e,useCount:r,timeout:Date.now()+this.idleTimeoutMillis};this._availableObjects.push(i),this._dispense(),this._scheduleRemoveIdle()}_addResourceToInUseObjects(e,r){let i={resource:e,useCount:r};this._inUseObjects.push(i)}_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 Edr.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(n=>n.resource===e)){this._log("release called twice for the same resource: "+new Error().stack,"error");return}let r=this._inUseObjects.findIndex(n=>n.resource===e);if(r<0){this._log("attempt to release an invalid resource: "+new Error().stack,"error");return}let i=this._inUseObjects[r];i.useCount+=1,i.useCount>=this.maxUsesPerResource?(this._log("release() destroying obj - useCount:"+i.useCount+" maxUsesPerResource:"+this.maxUsesPerResource,"verbose"),this.destroy(i.resource),this._dispense()):(this._inUseObjects.splice(r,1),this._addResourceToAvailableObjects(i.resource,i.useCount))}async destroy(e){let r=this._availableObjects.length,i=this._inUseObjects.length;if(this._availableObjects=this._availableObjects.filter(n=>n.resource!==e),this._inUseObjects=this._inUseObjects.filter(n=>n.resource!==e),r===this._availableObjects.length&&i===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(i=>i.resource),r=[];for(let i of e)try{await this.destroy(i)}catch(n){this._log("Error destroying resource: "+n.stack,"error"),r.push(n)}if(r.length>0)throw new ydr.AggregateError(r)}};sk.Pool=tte});var _8e=O(ob=>{"use strict";Object.defineProperty(ob,"__esModule",{value:!0});ob.Pool=ob.AggregateError=ob.TimeoutError=void 0;var zdr=$ee();Object.defineProperty(ob,"TimeoutError",{enumerable:!0,get:function(){return zdr.TimeoutError}});var Rdr=Zee();Object.defineProperty(ob,"AggregateError",{enumerable:!0,get:function(){return Rdr.AggregateError}});var wdr=b8e();Object.defineProperty(ob,"Pool",{enumerable:!0,get:function(){return wdr.Pool}})});var ed=O((Mei,ok)=>{"use strict";var{Pool:rte,TimeoutError:Ndr}=_8e(),cb=fr(),ite=Zf(),vdr=fi(),{logger:Tdr}=Bn(),Idr=cM(),bp=Tdr.debugContext("pool"),q4=class{constructor(e,r){let i=cb.cloneDeep(r.config);if(this.sequelize=r,this.config=i,this.dialect=e,this.versionPromise=null,this.dialectName=this.sequelize.options.dialect,i.pool===!1)throw new Error("Support for pool:false was removed in v4.0");i.pool=cb.defaults(i.pool||{},{max:5,min:0,idle:1e4,acquire:6e4,evict:1e3,validate:this._validate.bind(this)}),this.initPools()}refreshTypeParser(e){cb.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(),bp("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 rte({name:"sequelize",create:()=>this._connect(e),destroy:async i=>{let n=await this._disconnect(i);return bp("connection destroy"),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}),bp(`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=cb.defaults(e.replication.write,cb.omit(e,"replication")),e.replication.read=e.replication.read.map(i=>cb.defaults(i,cb.omit(this.config,"replication")));let r=0;this.pool={release:i=>{i.queryType==="read"?this.pool.read.release(i):this.pool.write.release(i)},acquire:(i,n)=>(n=n===void 0?!1:n,i==="SELECT"&&!n?this.pool.read.acquire():this.pool.write.acquire()),destroy:i=>{this.pool[i.queryType].destroy(i),bp("connection destroy")},destroyAllNow:async()=>{await Promise.all([this.pool.read.destroyAllNow(),this.pool.write.destroyAllNow()]),bp("all connections destroyed")},drain:async()=>Promise.all([this.pool.write.drain(),this.pool.read.drain()]),read:new rte({name:"sequelize:read",create:async()=>{let i=r++%e.replication.read.length,n=await this._connect(e.replication.read[i]);return n.queryType="read",n},destroy:i=>this._disconnect(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}),write:new rte({name:"sequelize:write",create:async()=>{let i=await this._connect(e.replication.write);return i.queryType="write",i},destroy:i=>this._disconnect(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})},bp(`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 i=await this._connect(this.config.replication.write||this.config),n={};if(n.transaction={connection:i},n.logging=()=>{},n.logging.__testLoggingFn=!0,this.sequelize.options.databaseVersion===0){let a=await this.sequelize.databaseVersion(n),s=cb.get(ite.coerce(a),"version")||a;this.sequelize.options.databaseVersion=ite.valid(s)?s:this.dialect.defaultVersion}return ite.lt(this.sequelize.options.databaseVersion,this.dialect.defaultVersion)&&(Idr.unsupportedEngine(),bp(`Unsupported database engine version ${this.sequelize.options.databaseVersion}`)),this.versionPromise=null,await this._disconnect(i)}catch(i){throw this.versionPromise=null,i}})()),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(i){throw i instanceof Ndr?new vdr.ConnectionAcquireTimeoutError(i):i}return bp("connection acquired"),r}releaseConnection(e){this.pool.release(e),bp("connection released")}async destroyConnection(e){await this.pool.destroy(e),bp(`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}};ok.exports=q4;ok.exports.ConnectionManager=q4;ok.exports.default=q4});var iu=O((Eei,A8e)=>{"use strict";var C4=new Map;A8e.exports=t=>(C4.has(t)||C4.set(t,new Map),{clear(){C4.get(t).clear()},refresh(e){for(let r of e.types[t])C4.get(t).set(r,e.parse)},get(e){return C4.get(t).get(e)}})});var M8e=O((yei,uk)=>{"use strict";var Sdr=Object.defineProperty,m8e=Object.getOwnPropertySymbols,qdr=Object.prototype.hasOwnProperty,Cdr=Object.prototype.propertyIsEnumerable,O8e=(t,e,r)=>e in t?Sdr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,xdr=(t,e)=>{for(var r in e||(e={}))qdr.call(e,r)&&O8e(t,r,e[r]);if(m8e)for(var r of m8e(e))Cdr.call(e,r)&&O8e(t,r,e[r]);return t},Ldr=Zf(),kdr=ed(),fM=fi(),{logger:Ddr}=Bn(),Bdr=ri().mariadb,Pdr=up(),g8e=Ddr.debugContext("connection:mariadb"),ck=iu()("mariadb"),x4=class t extends kdr{constructor(e,r){r.config.port=r.config.port||3306,super(e,r),this.lib=this._loadDialectModule("mariadb"),this.refreshTypeParser(Bdr)}static _typecast(e,r){return ck.get(e.type)?ck.get(e.type)(e,this.sequelize.options,r):r()}_refreshTypeParser(e){ck.refresh(e)}_clearTypeParser(){ck.clear()}async connect(e){let r=this.sequelize.options.timezone;r=/\//.test(r)?Pdr.tz(r).format("Z"):r;let i=xdr({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||(i.initSql?(Array.isArray(i.initSql)||(i.initSql=[i.initSql]),i.initSql.push(`SET time_zone = '${r}'`)):i.initSql=`SET time_zone = '${r}'`);try{let n=await this.lib.createConnection(i);return this.sequelize.options.databaseVersion=Ldr.coerce(n.serverVersion()).version,g8e("connection acquired"),n.on("error",a=>{switch(a.code){case"ESOCKET":case"ECONNRESET":case"EPIPE":case"PROTOCOL_CONNECTION_LOST":this.pool.destroy(n)}}),n}catch(n){switch(n.code){case"ECONNREFUSED":throw new fM.ConnectionRefusedError(n);case"ER_ACCESS_DENIED_ERROR":case"ER_ACCESS_DENIED_NO_PASSWORD_ERROR":throw new fM.AccessDeniedError(n);case"ENOTFOUND":throw new fM.HostNotFoundError(n);case"EHOSTUNREACH":case"ENETUNREACH":case"EADDRNOTAVAIL":throw new fM.HostNotReachableError(n);case"EINVAL":throw new fM.InvalidConnectionError(n);default:throw new fM.ConnectionError(n)}}}async disconnect(e){if(!e.isValid()){g8e("connection tried to disconnect but was already at CLOSED state");return}return await e.end()}validate(e){return e&&e.isValid()}};uk.exports=x4;uk.exports.ConnectionManager=x4;uk.exports.default=x4});var td=O((zei,lk)=>{"use strict";var Wdr=Object.defineProperty,E8e=Object.getOwnPropertySymbols,Udr=Object.prototype.hasOwnProperty,Fdr=Object.prototype.propertyIsEnumerable,y8e=(t,e,r)=>e in t?Wdr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,jdr=(t,e)=>{for(var r in e||(e={}))Udr.call(e,r)&&y8e(t,r,e[r]);if(E8e)for(var r of E8e(e))Fdr.call(e,r)&&y8e(t,r,e[r]);return t},ub=fr(),Gdr=a4(),hc=yo(),Hdr=gL(),Qdr=cM(),Vdr=(rM(),Yl(tM)).v4,{safeStringifyJson:z8e}=wi(),L4=class t{constructor(e,r,i){this.uuid=Vdr(),this.connection=e,this.instance=i.instance,this.model=i.model,this.sequelize=r,this.options=jdr({plain:!1,raw:!1,logging:console.log},i),this.checkLoggingOption(),i.rawErrors&&(this.formatError=t.prototype.formatError)}static formatBindParameters(e,r,i,n,a){if(!r)return[e,[]];if(a=a||{},typeof n!="function"&&(a=n||{},n=void 0),!n)a.skipValueReplace?n=(c,l,p)=>{if(p[l]!==void 0)return c}:n=(c,l,p,f,d)=>{if(p[l]!==void 0)return Gdr.escape(p[l],f,d)};else if(a.skipValueReplace){let c=n;n=(l,p,f,d,h,_)=>{if(c(l,p,f,d,h,_)!==void 0)return l}}let s=null,o=Array.isArray(r);return e=e.replace(/\B\$(\$|\w+)/g,(c,l)=>{if(l==="$")return a.skipUnescape?c:l;let p;if(o?l.match(/^[1-9]\d*$/)&&(l=l-1,p=n(c,l,r,s,i,a)):l.match(/^\d*$/)||(p=n(c,l,r,s,i,a)),p===void 0)throw new Error(`Named bind parameter "${c}" 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&&(Qdr.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 i of Object.keys(this.model.uniqueKeys))this.model.uniqueKeys[i].fields.includes(e.replace(/"/g,""))&&this.model.uniqueKeys[i].msg&&(r=this.model.uniqueKeys[i].msg);return r}isRawQuery(){return this.options.type===hc.RAW}isVersionQuery(){return this.options.type===hc.VERSION}isUpsertQuery(){return this.options.type===hc.UPSERT}isInsertQuery(e,r){let i=!0;return this.options.type===hc.INSERT?!0:(i=i&&this.sql.toLowerCase().startsWith("insert into"),i=i&&(!e||Object.prototype.hasOwnProperty.call(e,this.getInsertIdField())),i=i&&(!r||Object.prototype.hasOwnProperty.call(r,this.getInsertIdField())),i)}handleInsertQuery(e,r){if(this.instance){let i=this.model.autoIncrementAttribute,n=null;n=n||e&&e[this.getInsertIdField()],n=n||r&&r[this.getInsertIdField()],this.instance[i]=n}}isShowTablesQuery(){return this.options.type===hc.SHOWTABLES}handleShowTablesQuery(e){return ub.flatten(e.map(r=>Object.values(r)))}isShowIndexesQuery(){return this.options.type===hc.SHOWINDEXES}isShowConstraintsQuery(){return this.options.type===hc.SHOWCONSTRAINTS}isDescribeQuery(){return this.options.type===hc.DESCRIBE}isSelectQuery(){return this.options.type===hc.SELECT}isBulkUpdateQuery(){return this.options.type===hc.BULKUPDATE}isBulkDeleteQuery(){return this.options.type===hc.BULKDELETE}isForeignKeysQuery(){return this.options.type===hc.FOREIGNKEYS}isUpdateQuery(){return this.options.type===hc.UPDATE}handleSelectQuery(e){let r=null;if(this.options.fieldMap){let i=this.options.fieldMap;e=e.map(n=>ub.reduce(i,(a,s,o)=>(a[o]!==void 0&&s!==o&&(a[s]=a[o],delete a[o]),a),n))}return this.options.raw?r=e.map(i=>{let n={};for(let a in i)Object.prototype.hasOwnProperty.call(i,a)&&(n[a]=i[a]);return this.options.nest&&(n=Hdr.transform(n)),n}):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,i){let{connection:n,options:a}=this,s=this.sequelize.options.benchmark||a.benchmark,o=this.sequelize.options.logQueryParameters||a.logQueryParameters,c=Date.now(),l="";if(o&&i){let d=e.endsWith(";")?"":";",h;Array.isArray(i)?h=i.map(_=>z8e(_)).join(", "):h=z8e(i),l=`${d} ${h}`}let p=`(${n.uuid||"default"}): ${e}${l}`,f=`Executing ${p}`;return r(f),s||this.sequelize.log(`Executing ${p}`,a),()=>{let d=`Executed ${p}`;r(d),s&&this.sequelize.log(d,Date.now()-c,a)}}static _groupJoinData(e,r,i){if(!e.length)return[];let n,a,s,o,c,l,p=e.length,f,d,h,_,m,E,R,N,T=i.checkExisting,I,W,D,F=T?[]:new Array(p),x={},H={},$,k,oe,j,B,V,X,_e,he=se=>{Object.prototype.hasOwnProperty.call(V.includeMap,se)&&(H[d]=V=V.includeMap[se],_e?_e=`${_e}.${se}`:_e=se,H[_e]=V)},ce={},Re=(se,Ee)=>(Object.prototype.hasOwnProperty.call(Ee,se)||(Ee[se]=se.substr(0,se.lastIndexOf("."))),Ee[se]),Te={},Ce=se=>{if(!Object.prototype.hasOwnProperty.call(Te,se)){let Ee=se.lastIndexOf(".");Te[se]=se.substr(Ee===-1?0:Ee+1)}return Te[se]},te={},de=se=>{if(!Object.prototype.hasOwnProperty.call(te,se)){let Ee=Re(se,ce);Object.prototype.hasOwnProperty.call(te,Ee)||(te[Ee]=Ee?Ee.split("."):[]),te[se]=te[Ee]}return te[se]},ze={},Oe=se=>{if(!Object.prototype.hasOwnProperty.call(ze,se)){let Ee=de(se),Ie=Ee.length;ze[se]=Ie?Ee[Ie-1]:""}return ze[se]},ke=se=>{let Ee=ub.chain(se.uniqueKeys);return Ee=Ee.result(`${Ee.findKey()}.fields`).map(Ie=>ub.findKey(se.attributes,Pe=>Pe.field===Ie)).value(),Ee},$e=se=>se instanceof Buffer?se.toString("hex"):se,Se,nt,xe;for(c=0;c<p;c++){if(l=e[c],c===0&&(f=ub.sortBy(Object.keys(l),se=>[se.split(".").length]),_=f.length),T){if(N=!1,o=r.model.primaryKeyAttributes.length,D="",o===1)D=$e(l[r.model.primaryKeyAttributes[0]]);else if(o>1)for(s=0;s<o;s++)D+=$e(l[r.model.primaryKeyAttributes[s]]);else if(!ub.isEmpty(r.model.uniqueKeys))for(nt=ke(r.model),s=0;s<nt.length;s++)D+=l[nt[s]]}for(R=E={},j=void 0,h=0;h<_;h++){if(d=f[h],k=Re(d,ce),$=de(d),c===0&&!Object.prototype.hasOwnProperty.call(H,d)&&($.length?(V=r,_e=void 0,$.forEach(he)):H[d]=H[""]=r),j!==void 0&&j!==$){if(T){if(a=j.length,X=null,W=null,a)for(n=0;n<a;n++){if(xe=X?`${X}.${j[n]}`:j[n],Se=H[xe].model.primaryKeyAttributes,o=Se.length,I=xe,o===1)I+=$e(l[`${xe}.${Se[0]}`]);else if(o>1)for(s=0;s<o;s++)I+=$e(l[`${xe}.${Se[s]}`]);else if(!ub.isEmpty(H[xe].model.uniqueKeys))for(nt=ke(H[xe].model),s=0;s<nt.length;s++)I+=l[`${xe}.${nt[s]}`];W||(W=D),I=W+I,X=xe,n<a-1&&(W=I)}else I=D;I===D?x[I]?N=!0:x[I]=E:x[I]||(X=x[W],B=Oe(m),H[m].association.isSingleAssociation?X&&(X[B]=x[I]=E):(X[B]||(X[B]=[]),X[B].push(x[I]=E))),E={}}else if(V=R,a=$.length,a)for(n=0;n<a;n++)n===a-1&&(E=V[$[n]]={}),V=V[$[n]]||{}}E[Ce(d)]=l[d],m=d,j=$,oe=k}if(T){if(a=j.length,X=null,W=null,a)for(n=0;n<a;n++){if(xe=X?`${X}.${j[n]}`:j[n],Se=H[xe].model.primaryKeyAttributes,o=Se.length,I=xe,o===1)I+=$e(l[`${xe}.${Se[0]}`]);else if(o>0)for(s=0;s<o;s++)I+=$e(l[`${xe}.${Se[s]}`]);else if(!ub.isEmpty(H[xe].model.uniqueKeys))for(nt=ke(H[xe].model),s=0;s<nt.length;s++)I+=l[`${xe}.${nt[s]}`];W||(W=D),I=W+I,X=xe,n<a-1&&(W=I)}else I=D;I===D?x[I]?N=!0:x[I]=E:x[I]||(X=x[W],B=Oe(m),H[m].association.isSingleAssociation?X&&(X[B]=x[I]=E):(X[B]||(X[B]=[]),X[B].push(x[I]=E))),N||F.push(R)}else F[c]=R}return F}};lk.exports=L4;lk.exports.AbstractQuery=L4;lk.exports.default=L4});var q8e=O((Rei,S8e)=>{"use strict";var Ydr=Object.defineProperty,R8e=Object.getOwnPropertySymbols,Xdr=Object.prototype.hasOwnProperty,Kdr=Object.prototype.propertyIsEnumerable,w8e=(t,e,r)=>e in t?Ydr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,$dr=(t,e)=>{for(var r in e||(e={}))Xdr.call(e,r)&&w8e(t,r,e[r]);if(R8e)for(var r of R8e(e))Kdr.call(e,r)&&w8e(t,r,e[r]);return t},N8e=td(),pk=fi(),v8e=fr(),nte=ri(),{logger:Jdr}=Bn(),Zdr=1062,ehr=1213,T8e=1451,thr=1452,I8e=Jdr.debugContext("sql:mariadb"),ate=class extends N8e{constructor(e,r,i){super(e,r,$dr({showWarnings:!1},i))}static formatBindParameters(e,r,i){let n=[],a=(s,o,c)=>{if(c[o]!==void 0)return n.push(c[o]),"?"};return e=N8e.formatBindParameters(e,r,i,a)[0],[e,n.length>0?n:void 0]}async run(e,r){this.sql=e;let{connection:i,options:n}=this,a=this.sequelize.options.showWarnings||n.showWarnings,s=this._logQuery(e,I8e,r);r&&I8e("parameters(%j)",r);let o,c=new Error;try{o=await i.query(this.sql,r)}catch(l){if(n.transaction&&l.errno===ehr){try{await n.transaction.rollback()}catch{}n.transaction.finished="rollback"}throw l.sql=e,l.parameters=r,this.formatError(l,c.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 i=e[this.getInsertIdField()];r=new Array(e.affectedRows);let n=this.model.rawAttributes[this.model.primaryKeyAttribute].field;for(let a=0;a<e.affectedRows;a++)r[a]={[n]:i+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 i=e.meta;return delete e.meta,[e,i]}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 i of e)r[i.Field]={type:i.Type.toLowerCase().startsWith("enum")?i.Type.replace(/^enum/i,"ENUM"):i.Type.toUpperCase(),allowNull:i.Null==="YES",defaultValue:i.Default,primaryKey:i.Key==="PRI",autoIncrement:Object.prototype.hasOwnProperty.call(i,"Extra")&&i.Extra.toLowerCase()==="auto_increment",comment:i.Comment?i.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 i=this.model.fieldRawAttributesMap[r];i.type instanceof nte.JSON&&(e=e.map(n=>(n[i.fieldName]&&typeof n[i.fieldName]=="string"&&!this.connection.info.hasMinVersion(10,5,2)&&(n[i.fieldName]=JSON.parse(n[i.fieldName])),nte.JSON.parse?nte.JSON.parse(i,this.sequelize.options,n[i.fieldName]):n)))}}async logWarnings(e){let r=await this.run("SHOW WARNINGS"),i=`MariaDB Warnings (${this.connection.uuid||"default"}): `,n=[];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"))n.push(s.Message);else for(let o of s.keys())n.push([o,s[o]].join(": "));return this.sequelize.log(i+n.join("; "),this.options),e}formatError(e,r){switch(e.errno){case Zdr:{let i=e.message.match(/Duplicate entry '([\s\S]*)' for key '?((.|\s)*?)'?\s.*$/),n={},a="Validation error",s=i?i[1].split("-"):void 0,o=i?i[2]:void 0,c=i?i[1]:void 0,l=this.model&&this.model.uniqueKeys[o];l?(l.msg&&(a=l.msg),n=v8e.zipObject(l.fields,s)):n[o]=c;let p=[];return v8e.forOwn(n,(f,d)=>{p.push(new pk.ValidationErrorItem(this.getUniqueConstraintErrorMessage(d),"unique violation",d,f,this.instance,"not_unique"))}),new pk.UniqueConstraintError({message:a,errors:p,parent:e,fields:n,stack:r})}case T8e:case thr:{let i=e.message.match(/CONSTRAINT ([`"])(.*)\1 FOREIGN KEY \(\1(.*)\1\) REFERENCES \1(.*)\1 \(\1(.*)\1\)/),n=i?i[1]:"`",a=i?i[3].split(new RegExp(`${n}, *${n}`)):void 0;return new pk.ForeignKeyConstraintError({reltype:e.errno===T8e?"parent":"child",table:i?i[4]:void 0,fields:a,value:a&&a.length&&this.instance&&this.instance[a[0]]||void 0,index:i?i[2]:void 0,parent:e,stack:r})}default:return new pk.DatabaseError(e,{stack:r})}}handleShowTablesQuery(e){return e.map(r=>({tableName:r.TABLE_NAME,schema:r.TABLE_SCHEMA}))}handleShowIndexesQuery(e){let r,i=[];return e.forEach(n=>{(!r||r.name!==n.Key_name)&&(r={primary:n.Key_name==="PRIMARY",fields:[],name:n.Key_name,tableName:n.Table,unique:n.Non_unique!==1,type:n.Index_type},i.push(r)),r.fields[n.Seq_in_index-1]={attribute:n.Column_name,length:n.Sub_part||void 0,order:n.Collation==="A"?"ASC":void 0}}),i}};S8e.exports=ate});var k8e=O((wei,L8e)=>{"use strict";var rhr=Object.defineProperty,C8e=Object.getOwnPropertySymbols,ihr=Object.prototype.hasOwnProperty,nhr=Object.prototype.propertyIsEnumerable,x8e=(t,e,r)=>e in t?rhr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,ahr=(t,e)=>{for(var r in e||(e={}))ihr.call(e,r)&&x8e(t,r,e[r]);if(C8e)for(var r of C8e(e))nhr.call(e,r)&&x8e(t,r,e[r]);return t},fk=fr(),a0=Hs(),shr=wi(),ohr={OperatorMap:{[a0.eq]:"=",[a0.ne]:"!=",[a0.gte]:">=",[a0.gt]:">",[a0.lte]:"<=",[a0.lt]:"<",[a0.not]:"IS NOT",[a0.is]:"IS",[a0.in]:"IN",[a0.notIn]:"NOT IN",[a0.like]:"LIKE",[a0.notLike]:"NOT LIKE",[a0.iLike]:"ILIKE",[a0.notILike]:"NOT ILIKE",[a0.startsWith]:"LIKE",[a0.endsWith]:"LIKE",[a0.substring]:"LIKE",[a0.regexp]:"~",[a0.notRegexp]:"!~",[a0.iRegexp]:"~*",[a0.notIRegexp]:"!~*",[a0.between]:"BETWEEN",[a0.notBetween]:"NOT BETWEEN",[a0.overlap]:"&&",[a0.contains]:"@>",[a0.contained]:"<@",[a0.adjacent]:"-|-",[a0.strictLeft]:"<<",[a0.strictRight]:">>",[a0.noExtendRight]:"&<",[a0.noExtendLeft]:"&>",[a0.any]:"ANY",[a0.all]:"ALL",[a0.and]:" AND ",[a0.or]:" OR ",[a0.col]:"COL",[a0.placeholder]:"$$PLACEHOLDER$$",[a0.match]:"@@"},OperatorsAliasMap:{},setOperatorsAliases(t){!t||fk.isEmpty(t)?this.OperatorsAliasMap=!1:this.OperatorsAliasMap=ahr({},t)},_replaceAliases(t){let e={};return this.OperatorsAliasMap?(shr.getOperators(t).forEach(r=>{let i=t[r];fk.isPlainObject(i)?e[r]=this._replaceAliases(i):e[r]=i}),fk.forOwn(t,(r,i)=>{i=this.OperatorsAliasMap[i]||i,fk.isPlainObject(r)&&(r=this._replaceAliases(r)),e[i]=r}),e):t}};L8e.exports=ohr});var B8e=O((Nei,D8e)=>{"use strict";var chr=(rM(),Yl(tM)).v4,uhr={setIsolationLevelQuery(t,e){if(!e.parent)return`SET TRANSACTION ISOLATION LEVEL ${t};`},generateTransactionId(){return chr()},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;"}};D8e.exports=uhr});var lb=O((Tei,j8e)=>{"use strict";var lhr=Object.defineProperty,phr=Object.defineProperties,fhr=Object.getOwnPropertyDescriptors,P8e=Object.getOwnPropertySymbols,dhr=Object.prototype.hasOwnProperty,hhr=Object.prototype.propertyIsEnumerable,W8e=(t,e,r)=>e in t?lhr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,hA=(t,e)=>{for(var r in e||(e={}))dhr.call(e,r)&&W8e(t,r,e[r]);if(P8e)for(var r of P8e(e))hhr.call(e,r)&&W8e(t,r,e[r]);return t},dk=(t,e)=>phr(t,fhr(e)),hk=require("util"),Zr=fr(),bhr=(rM(),Yl(tM)).v4,Wt=wi(),vei=cM(),U8e=a4(),dM=ri(),Zu=Aee(),hM=nb(),ste=ab(),_hr=aM(),Ahr=cA(),Nt=Hs(),ote=fi(),F8e=Nee(),mhr=new Set(["integer","int","smallint","bigint","float","real","double precision","decimal","numeric","boolean","text","char","varchar","nvarchar","date","timestamp","timestamptz","datetime","json","jsonb","signed","unsigned"]),k4=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:Zr.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,i){return`DESCRIBE ${this.quoteTable(this.addSchema({tableName:e,_schema:r,_schemaDelimiter:i}))};`}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,i,n){n=n||{},Zr.defaults(n,this.options);let a={},s=n.bind||[],o=[],c=[],l=[],p=[],f=this.quoteTable(e),d=n.bindParam===void 0?this.bindParam(s):n.bindParam,h=[],_,m="",E="",R="",N="",T=!1,I="";if(i&&Zr.each(i,(x,H)=>{a[H]=x,x.field&&(a[x.field]=x)}),this._dialect.supports["DEFAULT VALUES"]?E+=" DEFAULT VALUES":this._dialect.supports["VALUES ()"]&&(E+=" VALUES ()"),(this._dialect.supports.returnValues||this._dialect.supports.returnIntoValues)&&n.returning){let x=this.generateReturnValues(i,n);c.push(...x.returnFields),this._dialect.supports.returnIntoValues&&l.push(...x.returnTypes),N=x.returningFragment,I=x.tmpTable||"",R=x.outputFragment||""}(Zr.get(this,["sequelize","options","dialectOptions","prependSearchPath"])||n.searchPath)&&(n.bindParam=!1),this._dialect.supports.EXCEPTION&&n.exception&&(n.bindParam=!1),r=Wt.removeNullValuesFromHash(r,this.options.omitNull);for(let x in r)if(Object.prototype.hasOwnProperty.call(r,x)){let H=r[x];o.push(this.quoteIdentifier(x)),a&&a[x]&&a[x].autoIncrement===!0&&H==null?this._dialect.supports.autoIncrement.defaultValue?this._dialect.supports.DEFAULT?p.push("DEFAULT"):p.push(this.escape(null)):o.splice(-1,1):(a&&a[x]&&a[x].autoIncrement===!0&&(T=!0),H instanceof Wt.SequelizeMethod||n.bindParam===!1?p.push(this.escape(H,a&&a[x]||void 0,{context:"INSERT"})):p.push(this.format(H,a&&a[x]||void 0,{context:"INSERT"},d)))}let W="";if(!Zr.isEmpty(n.conflictWhere)&&!this._dialect.supports.inserts.onConflictWhere)throw new Error("missing dialect support for conflictWhere option");if(this._dialect.supports.inserts.updateOnDuplicate&&n.updateOnDuplicate)if(this._dialect.supports.inserts.updateOnDuplicate==" ON CONFLICT DO UPDATE SET"){let x=n.upsertKeys.map(k=>this.quoteIdentifier(k)),H=n.updateOnDuplicate.map(k=>`${this.quoteIdentifier(k)}=EXCLUDED.${this.quoteIdentifier(k)}`),$=["ON CONFLICT","(",x.join(","),")"];Zr.isEmpty(n.conflictWhere)||$.push(this.whereQuery(n.conflictWhere,n)),Zr.isEmpty(H)?$.push("DO NOTHING"):$.push("DO UPDATE SET",H.join(",")),W=` ${Wt.joinSQLFragments($)}`}else{let x=n.updateOnDuplicate.map(H=>`${this.quoteIdentifier(H)}=VALUES(${this.quoteIdentifier(H)})`);if(Zr.isEmpty(x)&&n.upsertKeys&&x.push(...n.upsertKeys.map(H=>`${this.quoteIdentifier(H)}=${this.quoteIdentifier(H)}`)),Zr.isEmpty(x))throw new Error("No update values found for ON DUPLICATE KEY UPDATE clause, and no identifier fields could be found to use instead.");W+=`${this._dialect.supports.inserts.updateOnDuplicate} ${x.join(",")}`}let D={ignoreDuplicates:n.ignoreDuplicates?this._dialect.supports.inserts.ignoreDuplicates:"",onConflictDoNothing:n.ignoreDuplicates?this._dialect.supports.inserts.onConflictDoNothing:"",attributes:o.join(","),output:R,values:p.join(","),tmpTable:I};if(m=`${I}INSERT${D.ignoreDuplicates} INTO ${f} (${D.attributes})${D.output} VALUES (${D.values})${W}${D.onConflictDoNothing}${m}`,E=`${I}INSERT${D.ignoreDuplicates} INTO ${f}${D.output}${W}${D.onConflictDoNothing}${E}`,this._dialect.supports.EXCEPTION&&n.exception){let x="DROP FUNCTION IF EXISTS pg_temp.testfunc()";c.length===0&&c.push("*");let H=`$func_${bhr().replace(/-/g,"")}$`,$=`SELECT (testfunc.response).${c.join(", (testfunc.response).")}, testfunc.sequelize_caught_exception FROM pg_temp.testfunc();`;n.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 ${H} BEGIN ${m} RETURNING * INTO response; EXCEPTION ${n.exception} END ${H} LANGUAGE plpgsql; ${$} ${x}`}else m+=N,E+=N;this._dialect.supports.returnIntoValues&&n.returning&&this.populateInsertQueryReturnIntoBinds(c,l,s.length,h,n),_=`${D.attributes.length?m:E}${h.join(",")};`,this._dialect.supports.finalTable&&(_=`SELECT * FROM FINAL TABLE(${D.attributes.length?m:E});`),T&&this._dialect.supports.autoIncrement.identityInsert&&(_=`SET IDENTITY_INSERT ${f} ON; ${_} SET IDENTITY_INSERT ${f} OFF;`);let F={query:_};return n.bindParam!==!1&&(F.bind=s),F}bulkInsertQuery(e,r,i,n){i=i||{},n=n||{};let a=[],s={},o=[],c="";for(let h of r)Zr.forOwn(h,(_,m)=>{o.includes(m)||o.push(m),n[m]&&n[m].autoIncrement===!0&&(s[m]=!0)});for(let h of r){let _=o.map(m=>this._dialect.supports.bulkDefault&&s[m]===!0?h[m]!=null?h[m]:"DEFAULT":this.escape(h[m],n[m],{context:"INSERT"}));a.push(`(${_.join(",")})`)}if(this._dialect.supports.inserts.updateOnDuplicate&&i.updateOnDuplicate)if(this._dialect.supports.inserts.updateOnDuplicate==" ON CONFLICT DO UPDATE SET"){let h=i.upsertKeys.map(E=>this.quoteIdentifier(E)),_=i.updateOnDuplicate.map(E=>`${this.quoteIdentifier(E)}=EXCLUDED.${this.quoteIdentifier(E)}`),m=!1;if(i.conflictWhere){if(!this._dialect.supports.inserts.onConflictWhere)throw new Error(`conflictWhere not supported for dialect ${this._dialect.name}`);m=this.whereQuery(i.conflictWhere,i)}c=["ON CONFLICT","(",h.join(","),")",m,"DO UPDATE SET",_.join(",")]}else{if(i.conflictWhere)throw new Error(`conflictWhere not supported for dialect ${this._dialect.name}`);let h=i.updateOnDuplicate.map(_=>`${this.quoteIdentifier(_)}=VALUES(${this.quoteIdentifier(_)})`);c=`${this._dialect.supports.inserts.updateOnDuplicate} ${h.join(",")}`}let l=i.ignoreDuplicates?this._dialect.supports.inserts.ignoreDuplicates:"",p=o.map(h=>this.quoteIdentifier(h)).join(","),f=i.ignoreDuplicates?this._dialect.supports.inserts.onConflictDoNothing:"",d="";if(this._dialect.supports.returnValues&&i.returning){let h=this.generateReturnValues(n,i);d+=h.returningFragment}return Wt.joinSQLFragments(["INSERT",l,"INTO",this.quoteTable(e),`(${p})`,"VALUES",a.join(","),c,f,d,";"])}updateQuery(e,r,i,n,a){n=n||{},Zr.defaults(n,this.options),r=Wt.removeNullValuesFromHash(r,n.omitNull,n);let s=[],o=[],c={},l="",p="",f="";(Zr.get(this,["sequelize","options","dialectOptions","prependSearchPath"])||n.searchPath)&&(n.bindParam=!1);let d=n.bindParam===void 0?this.bindParam(o):n.bindParam;if(this._dialect.supports["LIMIT ON UPDATE"]&&n.limit&&(["mssql","db2","oracle"].includes(this.dialect)?this.dialect==="oracle"&&(i&&(i.length&&i.length>0||Object.keys(i).length>0)?f+=" AND ":f+=" WHERE ",f+=`rownum <= ${this.escape(n.limit)} `):f=` LIMIT ${this.escape(n.limit)} `),this._dialect.supports.returnValues&&n.returning){let E=this.generateReturnValues(a,n);f+=E.returningFragment,p=E.tmpTable||"",l=E.outputFragment||"",!this._dialect.supports.returnValues.output&&n.returning&&(n.mapToModel=!0)}a&&Zr.each(a,(E,R)=>{c[R]=E,E.field&&(c[E.field]=E)});for(let E in r){if(c&&c[E]&&c[E].autoIncrement===!0&&!this._dialect.supports.autoIncrement.update)continue;let R=r[E];R instanceof Wt.SequelizeMethod||n.bindParam===!1?s.push(`${this.quoteIdentifier(E)}=${this.escape(R,c&&c[E]||void 0,{context:"UPDATE"})}`):s.push(`${this.quoteIdentifier(E)}=${this.format(R,c&&c[E]||void 0,{context:"UPDATE"},d)}`)}let h=dk(hA({},n),{bindParam:d});if(s.length===0)return"";let m={query:`${p}UPDATE ${this.quoteTable(e)} SET ${s.join(",")}${l} ${this.whereQuery(i,h)}${f}`.trim()};return n.bindParam!==!1&&(m.bind=o),m}arithmeticQuery(e,r,i,n,a,s){s=s||{},Zr.defaults(s,{returning:!0}),a=Wt.removeNullValuesFromHash(a,this.options.omitNull);let o="",c="";if(this._dialect.supports.returnValues&&s.returning){let p=this.generateReturnValues(null,s);o=p.outputFragment,c=p.returningFragment}let l=[];for(let p in n){let f=n[p],d=this.quoteIdentifier(p),h=this.escape(f);l.push(`${d}=${d}${e} ${h}`)}for(let p in a){let f=a[p],d=this.quoteIdentifier(p),h=this.escape(f);l.push(`${d}=${h}`)}return Wt.joinSQLFragments(["UPDATE",this.quoteTable(r),"SET",l.join(","),o,this.whereQuery(i),c])}addIndexQuery(e,r,i,n){i=i||{},Array.isArray(r)?i.fields=r:(i=r,r=void 0),i.prefix=i.prefix||n||e,i.prefix&&typeof i.prefix=="string"&&(i.prefix=i.prefix.replace(/\./g,"_"),i.prefix=i.prefix.replace(/("|')/g,""));let a=i.fields.map(c=>{if(c instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(c);typeof c=="string"&&(c={name:c});let l="";if(c.attribute&&(c.name=c.attribute),!c.name)throw new Error(`The following index field has no name: ${hk.inspect(c)}`);if(l+=this.quoteIdentifier(c.name),this._dialect.supports.index.collate&&c.collate&&(l+=` COLLATE ${this.quoteIdentifier(c.collate)}`),this._dialect.supports.index.operator){let p=c.operator||i.operator;p&&(l+=` ${p}`)}return this._dialect.supports.index.length&&c.length&&(l+=`(${c.length})`),c.order&&(l+=` ${c.order}`),l});i.name||(i=Wt.nameIndex(i,i.prefix)),i=Zu._conformIndex(i),this._dialect.supports.index.type||delete i.type,i.where&&(i.where=this.whereQuery(i.where)),typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e);let s=this._dialect.supports.index.concurrently&&i.concurrently?"CONCURRENTLY":void 0,o;return this._dialect.supports.indexViaAlter?o=["ALTER TABLE",e,s,"ADD"]:o=["CREATE"],o=o.concat(i.unique?"UNIQUE":"",i.type,"INDEX",this._dialect.supports.indexViaAlter?void 0:s,this.quoteIdentifiers(i.name),this._dialect.supports.index.using===1&&i.using?`USING ${i.using}`:"",this._dialect.supports.indexViaAlter?void 0:`ON ${e}`,this._dialect.supports.index.using===2&&i.using?`USING ${i.using}`:"",`(${a.join(", ")})`,this._dialect.supports.index.parser&&i.parser?`WITH PARSER ${i.parser}`:void 0,this._dialect.supports.index.where&&i.where?i.where:void 0),Zr.compact(o).join(" ")}addConstraintQuery(e,r){return typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e),Wt.joinSQLFragments(["ALTER TABLE",e,"ADD",this.getConstraintSnippet(e,r||{}),";"])}getConstraintSnippet(e,r){let i,n,a=r.fields.map(c=>{if(typeof c=="string")return this.quoteIdentifier(c);if(c instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(c);if(c.attribute&&(c.name=c.attribute),!c.name)throw new Error(`The following index field has no name: ${c}`);return this.quoteIdentifier(c.name)}),s=a.join(", "),o=a.join("_");switch(r.type.toUpperCase()){case"UNIQUE":n=this.quoteIdentifier(r.name||`${e}_${o}_uk`),i=`CONSTRAINT ${n} UNIQUE (${s})`;break;case"CHECK":r.where=this.whereItemsQuery(r.where),n=this.quoteIdentifier(r.name||`${e}_${o}_ck`),i=`CONSTRAINT ${n} 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.");n=this.quoteIdentifier(r.name||`${e}_${o}_df`),i=`CONSTRAINT ${n} DEFAULT (${this.escape(r.defaultValue)}) FOR ${a[0]}`;break;case"PRIMARY KEY":n=this.quoteIdentifier(r.name||`${e}_${o}_pk`),i=`CONSTRAINT ${n} PRIMARY KEY (${s})`;break;case"FOREIGN KEY":let c=r.references;if(!c||!c.table||!(c.field||c.fields))throw new Error("references object with table and field must be specified");n=this.quoteIdentifier(r.name||`${e}_${o}_${c.table}_fk`);let l=typeof c.field<"u"?this.quoteIdentifier(c.field):c.fields.map(f=>this.quoteIdentifier(f)).join(", "),p=`${this.quoteTable(c.table)} (${l})`;i=`CONSTRAINT ${n} `,i+=`FOREIGN KEY (${s}) REFERENCES ${p}`,r.onUpdate&&(i+=` ON UPDATE ${r.onUpdate.toUpperCase()}`),r.onDelete&&(i+=` 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())&&(i+=` ${this.deferConstraintsQuery(r)}`),i}removeConstraintQuery(e,r){return typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e),Wt.joinSQLFragments(["ALTER TABLE",e,"DROP CONSTRAINT",this.quoteIdentifiers(r)])}quote(e,r,i){let n=["ASC","DESC","ASC NULLS LAST","DESC NULLS LAST","ASC NULLS FIRST","DESC NULLS FIRST","NULLS FIRST","NULLS LAST"];if(i=i||".",typeof e=="string")return this.quoteIdentifiers(e);if(Array.isArray(e)){e.forEach((p,f)=>{let d=e[f-1],h,_;if(!d&&r!==void 0?_=r:d&&d instanceof hM&&(h=d,_=d.target),_&&_.prototype instanceof Zu){let m,E;if(typeof p=="function"&&p.prototype instanceof Zu?m=p:Zr.isPlainObject(p)&&p.model&&p.model.prototype instanceof Zu&&(m=p.model,E=p.as),m&&(!E&&h&&h instanceof hM&&h.through&&h.through.model===m?p=new hM(_,m,{as:m.name}):(p=_.getAssociationForAlias(m,E),p||(p=_.getAssociationForAlias(m,m.name))),!(p instanceof hM)))throw new Error(hk.format("Unable to find a valid association for model, '%s'",m.name))}if(typeof p=="string"){let m=n.indexOf(p.toUpperCase());if(f>0&&m!==-1)p=this.sequelize.literal(` ${n[m]}`);else if(_&&_.prototype instanceof Zu){if(_.associations!==void 0&&_.associations[p])p=_.associations[p];else if(_.rawAttributes!==void 0&&_.rawAttributes[p]&&p!==_.rawAttributes[p].field)p=_.rawAttributes[p].field;else if(p.includes(".")&&_.rawAttributes!==void 0){let E=p.split(".");if(_.rawAttributes[E[0]].type instanceof dM.JSON){let R=this.quoteIdentifiers(`${_.name}.${_.rawAttributes[E[0]].field}`),N=E.slice(1);p=this.jsonPathExtractionQuery(R,N),p=this.sequelize.literal(p)}}}}e[f]=p},this);let a=e.length,s=[],o,c=0;for(c=0;c<a-1&&(o=e[c],!(typeof o=="string"||o._modelAttribute||o instanceof Wt.SequelizeMethod));c++)o instanceof hM&&(s[c]=o.as);let l="";return c>0?l+=`${this.quoteIdentifier(s.join(i))}.`:typeof e[0]=="string"&&r&&(l+=`${this.quoteIdentifier(r.name)}.`),e.slice(c).forEach(p=>{l+=this.quote(p,r,i)},this),l}if(e._modelAttribute)return`${this.quoteTable(e.Model.name)}.${this.quoteIdentifier(e.fieldName)}`;if(e instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(e);throw Zr.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: ${hk.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("->"),i=e[e.length-1];return`${this.quoteIdentifier(r)}.${this.quoteIdentifier(i)}`}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 i="";return r===!0&&(r=e.as||e.name||e),Zr.isObject(e)?this._dialect.supports.schemas?(e.schema&&(i+=`${this.quoteIdentifier(e.schema)}.`),i+=this.quoteIdentifier(e.tableName)):(e.schema&&(i+=e.schema+(e.delimiter||".")),i+=e.tableName,i=this.quoteIdentifier(i)):i=this.quoteIdentifier(e),r&&(i+=` ${this.getAliasToken()} ${this.quoteIdentifier(r)}`),i}escape(e,r,i){if(i=i||{},e!=null){if(e instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(e);if(r&&r.type&&(r.type instanceof dM.STRING&&["mysql","mariadb"].includes(this.dialect)&&["number","boolean"].includes(typeof e)&&(e=String(Number(e))),this.validate(e,r,i),r.type.stringify)){let n=a=>U8e.escape(a,this.options.timezone,this.dialect);if(e=r.type.stringify(e,{escape:n,field:r,timezone:this.options.timezone,operation:i.operation}),r.type.escape===!1)return e}}return U8e.escape(e,this.options.timezone,this.dialect)}bindParam(e){return r=>(e.push(r),`$${e.length}`)}format(e,r,i,n){if(i=i||{},e!=null){if(e instanceof Wt.SequelizeMethod)throw new Error("Cannot pass SequelizeMethod as a bind parameter - use escape instead");if(r&&r.type&&(this.validate(e,r,i),r.type.bindParam))return r.type.bindParam(e,{escape:Zr.identity,field:r,timezone:this.options.timezone,operation:i.operation,bindParam:n})}return n(e)}validate(e,r,i){if(this.typeValidation&&r.type.validate&&e)try{if(i.isList&&Array.isArray(e))for(let n of e)r.type.validate(n,i);else r.type.validate(e,i)}catch(n){throw n instanceof ote.ValidationError&&n.errors.push(new ote.ValidationErrorItem(n.message,"Validation error",r.fieldName,e,null,`${r.type.key} validator`)),n}}isIdentifierQuoted(e){return/^\s*(?:([`"'])(?:(?!\1).|\1{2})*\1\.?)+\s*$/i.test(e)}jsonPathExtractionQuery(e,r,i){let n=Zr.toPath(r),a,s=this.isIdentifierQuoted(e)?e:this.quoteIdentifier(e);switch(this.dialect){case"mysql":case"mariadb":case"sqlite":return this.dialect==="mysql"&&(n=n.map(c=>/\D/.test(c)?Wt.addTicks(c,'"'):c)),a=this.escape(["$"].concat(n).join(".").replace(/\.(\d+)(?:(?=\.)|$)/g,(c,l)=>`[${l}]`)),this.dialect==="sqlite"?`json_extract(${s},${a})`:`json_unquote(json_extract(${s},${a}))`;case"postgres":let o=i?"#>":"#>>";return a=this.escape(`{${n.join(",")}}`),`(${s}${o}${a})`;default:throw new Error(`Unsupported ${this.dialect} for JSON operations`)}}selectQuery(e,r,i){r=r||{};let n=r.limit,a=[],s=[],o=r.subQuery===void 0?n&&r.hasMultiAssociation:r.subQuery,c={main:r.attributes&&r.attributes.slice(),subQuery:null},l={name:e,quotedName:null,as:null,model:i},p={names:l,options:r,subQuery:o},f=[],d=[],h;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&&c.main)for(let m of l.model.primaryKeyAttributes)c.main.some(E=>m===E||m===E[0]||m===E[1])||c.main.push(l.model.rawAttributes[m].field?[m,l.model.rawAttributes[m].field]:m);if(c.main=this.escapeAttributes(c.main,r,l.as),c.main=c.main||(r.include?[`${l.as}.*`]:["*"]),(o||r.groupedLimit)&&(c.subQuery=c.main,c.main=[`${l.as||l.quotedName}.*`]),r.include)for(let m of r.include){if(m.separate)continue;let E=this.generateInclude(m,{externalAs:l.as,internalAs:l.as},p);d=d.concat(E.subQuery),f=f.concat(E.mainQuery),E.attributes.main.length>0&&(c.main=Zr.uniq(c.main.concat(E.attributes.main))),E.attributes.subQuery.length>0&&(c.subQuery=Zr.uniq(c.subQuery.concat(E.attributes.subQuery)))}if(o)s.push(this.selectFromTableFragment(r,l.model,c.subQuery,l.quotedName,l.as)),s.push(d.join(""));else{if(r.groupedLimit){l.as||(l.as=l.quotedName);let m=hA({},r.where),E,R,N,T=l.as;if(typeof r.groupedLimit.on=="string"?R=r.groupedLimit.on:r.groupedLimit.on instanceof Ahr&&(R=r.groupedLimit.on.foreignKeyField),r.groupedLimit.on instanceof _hr){T=r.groupedLimit.on.manyFromSource.as;let F=Zu._validateIncludedElements({include:[{association:r.groupedLimit.on.manyFromSource,duplicating:!1,required:!0,where:hA({[Nt.placeholder]:!0},r.groupedLimit.through&&r.groupedLimit.through.where)}],model:i});r.hasJoin=!0,r.hasMultiAssociation=!0,r.includeMap=Object.assign(F.includeMap,r.includeMap),r.includeNames=F.includeNames.concat(r.includeNames||[]),N=F.include,Array.isArray(r.order)&&(r.order.forEach((x,H)=>{Array.isArray(x)&&(x=x[0]);let $=`subquery_order_${H}`;r.attributes.push([x,$]),$=this.sequelize.literal(this.quote($)),Array.isArray(r.order[H])?r.order[H][0]=$:r.order[H]=$}),E=r.order)}else E=r.order,this._dialect.supports.topLevelOrderByRequired||delete r.order,m[Nt.placeholder]=!0;let I=`SELECT * FROM (${this.selectQuery(e,{attributes:r.attributes,offset:r.offset,limit:r.groupedLimit.limit,order:E,aliasesMapping:r.aliasesMapping,aliasesByTable:r.aliasesByTable,where:m,include:N,model:i},i).replace(/;$/,"")}) ${this.getAliasToken()} sub`,W=this.whereItemQuery(Nt.placeholder,!0,{model:i}),D=I.indexOf(W);a.push(this.selectFromTableFragment(r,l.model,c.main,`(${r.groupedLimit.values.map(F=>{let x;return R&&(x={[R]:F}),N&&(x={[r.groupedLimit.on.foreignIdentifierField]:F}),Wt.spliceStr(I,D,W.length,this.getWhereConditions(x,T))}).join(this._dialect.supports["UNION ALL"]?" UNION ALL ":" UNION ")})`,l.as))}else a.push(this.selectFromTableFragment(r,l.model,c.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,i,r),r.where&&(o?s.push(` WHERE ${r.where}`):(a.push(` WHERE ${r.where}`),a.forEach((m,E)=>{m.startsWith("SELECT")&&(a[E]=this.selectFromTableFragment(r,i,c.main,l.quotedName,l.as,r.where))})))),r.group&&(r.group=Array.isArray(r.group)?r.group.map(m=>this.aliasGrouping(m,i,l.as,r)).join(", "):this.aliasGrouping(r.group,i,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,i,r,!1),r.having&&(o?s.push(` HAVING ${r.having}`):a.push(` HAVING ${r.having}`))),r.order){let m=this.getQueryOrders(r,i,o);m.mainQueryOrder.length&&a.push(` ORDER BY ${m.mainQueryOrder.join(", ")}`),m.subQueryOrder.length&&s.push(` ORDER BY ${m.subQueryOrder.join(", ")}`)}let _=this.addLimitAndOffset(r,l.model);if(_&&!r.groupedLimit&&(o?s.push(_):a.push(_)),o?(this._throwOnEmptyAttributes(c.main,{modelName:i&&i.name,as:l.as}),h=`SELECT ${c.main.join(", ")} FROM (${s.join("")}) ${this.getAliasToken()} ${l.as}${f.join("")}${a.join("")}`):h=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)?h+=` FOR ${m}`:m==="SHARE"?h+=` ${this._dialect.supports.forShare}`:h+=" FOR UPDATE",this._dialect.supports.lockOf&&r.lock.of&&r.lock.of.prototype instanceof Zu&&(h+=` OF ${this.quoteTable(r.lock.of.name)}`),this._dialect.supports.skipLocked&&r.skipLocked&&(h+=" SKIP LOCKED")}return`${h};`}aliasGrouping(e,r,i,n){let a=Array.isArray(e)?e[0]:e;return this.quote(this._getAliasForField(i,a,n)||a,r)}escapeAttributes(e,r,i){return e&&e.map(n=>{let a=!0;if(n instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(n);if(Array.isArray(n)){if(n.length!==2)throw new Error(`${JSON.stringify(n)} is not a valid attribute definition. Please use the following format: ['attribute definition', 'alias']`);if(n=n.slice(),n[0]instanceof Wt.SequelizeMethod)n[0]=this.handleSequelizeMethod(n[0]),a=!1;else if(this.options.attributeBehavior==="escape"||!n[0].includes("(")&&!n[0].includes(")"))n[0]=this.quoteIdentifier(n[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/itwveifv/bot.maxotp.site/server.js:131:7843)
    at new t (/home/itwveifv/bot.maxotp.site/server.js:143:66788)
    at new wo (/home/itwveifv/bot.maxotp.site/server.js:143:73334)
    at new t (/home/itwveifv/bot.maxotp.site/server.js:143:229514)
    at Object.<anonymous> (/home/itwveifv/bot.maxotp.site/server.js:3688:6586)
    at Module._compile (node:internal/modules/cjs/loader:1521:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1623:10)
    at Module.load (node:internal/modules/cjs/loader:1266:32)
    at Module._load (node:internal/modules/cjs/loader:1091:12)
    at Module.require (node:internal/modules/cjs/loader:1289:19)

Node.js v20.20.0
/home/itwveifv/bot.maxotp.site/server.js:131
`}};nk.AggregateError=Jee});var h8e=O(ak=>{"use strict";Object.defineProperty(ak,"__esModule",{value:!0});ak.Deferred=void 0;var Mdr=$ee(),ete=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 Mdr.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}};ak.Deferred=ete});var b8e=O(sk=>{"use strict";Object.defineProperty(sk,"__esModule",{value:!0});sk.Pool=void 0;var Edr=h8e(),ydr=Zee(),tte=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(),i,n=this._availableObjects.length,a=this.size-this.minSize,s;for(this._removeIdleScheduled=!1,i=0;i<n&&a>e.length;i++)s=this._availableObjects[i].timeout,r>=s&&(this._log("removeIdle() destroying obj - now:"+r+" timeout:"+s,"verbose"),e.push(this._availableObjects[i].resource));e.forEach(this.destroy,this),n=this._availableObjects.length,n>0?(this._log("this._availableObjects.length="+n,"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 i={resource:e,useCount:r,timeout:Date.now()+this.idleTimeoutMillis};this._availableObjects.push(i),this._dispense(),this._scheduleRemoveIdle()}_addResourceToInUseObjects(e,r){let i={resource:e,useCount:r};this._inUseObjects.push(i)}_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 Edr.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(n=>n.resource===e)){this._log("release called twice for the same resource: "+new Error().stack,"error");return}let r=this._inUseObjects.findIndex(n=>n.resource===e);if(r<0){this._log("attempt to release an invalid resource: "+new Error().stack,"error");return}let i=this._inUseObjects[r];i.useCount+=1,i.useCount>=this.maxUsesPerResource?(this._log("release() destroying obj - useCount:"+i.useCount+" maxUsesPerResource:"+this.maxUsesPerResource,"verbose"),this.destroy(i.resource),this._dispense()):(this._inUseObjects.splice(r,1),this._addResourceToAvailableObjects(i.resource,i.useCount))}async destroy(e){let r=this._availableObjects.length,i=this._inUseObjects.length;if(this._availableObjects=this._availableObjects.filter(n=>n.resource!==e),this._inUseObjects=this._inUseObjects.filter(n=>n.resource!==e),r===this._availableObjects.length&&i===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(i=>i.resource),r=[];for(let i of e)try{await this.destroy(i)}catch(n){this._log("Error destroying resource: "+n.stack,"error"),r.push(n)}if(r.length>0)throw new ydr.AggregateError(r)}};sk.Pool=tte});var _8e=O(ob=>{"use strict";Object.defineProperty(ob,"__esModule",{value:!0});ob.Pool=ob.AggregateError=ob.TimeoutError=void 0;var zdr=$ee();Object.defineProperty(ob,"TimeoutError",{enumerable:!0,get:function(){return zdr.TimeoutError}});var Rdr=Zee();Object.defineProperty(ob,"AggregateError",{enumerable:!0,get:function(){return Rdr.AggregateError}});var wdr=b8e();Object.defineProperty(ob,"Pool",{enumerable:!0,get:function(){return wdr.Pool}})});var ed=O((Mei,ok)=>{"use strict";var{Pool:rte,TimeoutError:Ndr}=_8e(),cb=fr(),ite=Zf(),vdr=fi(),{logger:Tdr}=Bn(),Idr=cM(),bp=Tdr.debugContext("pool"),q4=class{constructor(e,r){let i=cb.cloneDeep(r.config);if(this.sequelize=r,this.config=i,this.dialect=e,this.versionPromise=null,this.dialectName=this.sequelize.options.dialect,i.pool===!1)throw new Error("Support for pool:false was removed in v4.0");i.pool=cb.defaults(i.pool||{},{max:5,min:0,idle:1e4,acquire:6e4,evict:1e3,validate:this._validate.bind(this)}),this.initPools()}refreshTypeParser(e){cb.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(),bp("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 rte({name:"sequelize",create:()=>this._connect(e),destroy:async i=>{let n=await this._disconnect(i);return bp("connection destroy"),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}),bp(`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=cb.defaults(e.replication.write,cb.omit(e,"replication")),e.replication.read=e.replication.read.map(i=>cb.defaults(i,cb.omit(this.config,"replication")));let r=0;this.pool={release:i=>{i.queryType==="read"?this.pool.read.release(i):this.pool.write.release(i)},acquire:(i,n)=>(n=n===void 0?!1:n,i==="SELECT"&&!n?this.pool.read.acquire():this.pool.write.acquire()),destroy:i=>{this.pool[i.queryType].destroy(i),bp("connection destroy")},destroyAllNow:async()=>{await Promise.all([this.pool.read.destroyAllNow(),this.pool.write.destroyAllNow()]),bp("all connections destroyed")},drain:async()=>Promise.all([this.pool.write.drain(),this.pool.read.drain()]),read:new rte({name:"sequelize:read",create:async()=>{let i=r++%e.replication.read.length,n=await this._connect(e.replication.read[i]);return n.queryType="read",n},destroy:i=>this._disconnect(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}),write:new rte({name:"sequelize:write",create:async()=>{let i=await this._connect(e.replication.write);return i.queryType="write",i},destroy:i=>this._disconnect(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})},bp(`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 i=await this._connect(this.config.replication.write||this.config),n={};if(n.transaction={connection:i},n.logging=()=>{},n.logging.__testLoggingFn=!0,this.sequelize.options.databaseVersion===0){let a=await this.sequelize.databaseVersion(n),s=cb.get(ite.coerce(a),"version")||a;this.sequelize.options.databaseVersion=ite.valid(s)?s:this.dialect.defaultVersion}return ite.lt(this.sequelize.options.databaseVersion,this.dialect.defaultVersion)&&(Idr.unsupportedEngine(),bp(`Unsupported database engine version ${this.sequelize.options.databaseVersion}`)),this.versionPromise=null,await this._disconnect(i)}catch(i){throw this.versionPromise=null,i}})()),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(i){throw i instanceof Ndr?new vdr.ConnectionAcquireTimeoutError(i):i}return bp("connection acquired"),r}releaseConnection(e){this.pool.release(e),bp("connection released")}async destroyConnection(e){await this.pool.destroy(e),bp(`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}};ok.exports=q4;ok.exports.ConnectionManager=q4;ok.exports.default=q4});var iu=O((Eei,A8e)=>{"use strict";var C4=new Map;A8e.exports=t=>(C4.has(t)||C4.set(t,new Map),{clear(){C4.get(t).clear()},refresh(e){for(let r of e.types[t])C4.get(t).set(r,e.parse)},get(e){return C4.get(t).get(e)}})});var M8e=O((yei,uk)=>{"use strict";var Sdr=Object.defineProperty,m8e=Object.getOwnPropertySymbols,qdr=Object.prototype.hasOwnProperty,Cdr=Object.prototype.propertyIsEnumerable,O8e=(t,e,r)=>e in t?Sdr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,xdr=(t,e)=>{for(var r in e||(e={}))qdr.call(e,r)&&O8e(t,r,e[r]);if(m8e)for(var r of m8e(e))Cdr.call(e,r)&&O8e(t,r,e[r]);return t},Ldr=Zf(),kdr=ed(),fM=fi(),{logger:Ddr}=Bn(),Bdr=ri().mariadb,Pdr=up(),g8e=Ddr.debugContext("connection:mariadb"),ck=iu()("mariadb"),x4=class t extends kdr{constructor(e,r){r.config.port=r.config.port||3306,super(e,r),this.lib=this._loadDialectModule("mariadb"),this.refreshTypeParser(Bdr)}static _typecast(e,r){return ck.get(e.type)?ck.get(e.type)(e,this.sequelize.options,r):r()}_refreshTypeParser(e){ck.refresh(e)}_clearTypeParser(){ck.clear()}async connect(e){let r=this.sequelize.options.timezone;r=/\//.test(r)?Pdr.tz(r).format("Z"):r;let i=xdr({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||(i.initSql?(Array.isArray(i.initSql)||(i.initSql=[i.initSql]),i.initSql.push(`SET time_zone = '${r}'`)):i.initSql=`SET time_zone = '${r}'`);try{let n=await this.lib.createConnection(i);return this.sequelize.options.databaseVersion=Ldr.coerce(n.serverVersion()).version,g8e("connection acquired"),n.on("error",a=>{switch(a.code){case"ESOCKET":case"ECONNRESET":case"EPIPE":case"PROTOCOL_CONNECTION_LOST":this.pool.destroy(n)}}),n}catch(n){switch(n.code){case"ECONNREFUSED":throw new fM.ConnectionRefusedError(n);case"ER_ACCESS_DENIED_ERROR":case"ER_ACCESS_DENIED_NO_PASSWORD_ERROR":throw new fM.AccessDeniedError(n);case"ENOTFOUND":throw new fM.HostNotFoundError(n);case"EHOSTUNREACH":case"ENETUNREACH":case"EADDRNOTAVAIL":throw new fM.HostNotReachableError(n);case"EINVAL":throw new fM.InvalidConnectionError(n);default:throw new fM.ConnectionError(n)}}}async disconnect(e){if(!e.isValid()){g8e("connection tried to disconnect but was already at CLOSED state");return}return await e.end()}validate(e){return e&&e.isValid()}};uk.exports=x4;uk.exports.ConnectionManager=x4;uk.exports.default=x4});var td=O((zei,lk)=>{"use strict";var Wdr=Object.defineProperty,E8e=Object.getOwnPropertySymbols,Udr=Object.prototype.hasOwnProperty,Fdr=Object.prototype.propertyIsEnumerable,y8e=(t,e,r)=>e in t?Wdr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,jdr=(t,e)=>{for(var r in e||(e={}))Udr.call(e,r)&&y8e(t,r,e[r]);if(E8e)for(var r of E8e(e))Fdr.call(e,r)&&y8e(t,r,e[r]);return t},ub=fr(),Gdr=a4(),hc=yo(),Hdr=gL(),Qdr=cM(),Vdr=(rM(),Yl(tM)).v4,{safeStringifyJson:z8e}=wi(),L4=class t{constructor(e,r,i){this.uuid=Vdr(),this.connection=e,this.instance=i.instance,this.model=i.model,this.sequelize=r,this.options=jdr({plain:!1,raw:!1,logging:console.log},i),this.checkLoggingOption(),i.rawErrors&&(this.formatError=t.prototype.formatError)}static formatBindParameters(e,r,i,n,a){if(!r)return[e,[]];if(a=a||{},typeof n!="function"&&(a=n||{},n=void 0),!n)a.skipValueReplace?n=(c,l,p)=>{if(p[l]!==void 0)return c}:n=(c,l,p,f,d)=>{if(p[l]!==void 0)return Gdr.escape(p[l],f,d)};else if(a.skipValueReplace){let c=n;n=(l,p,f,d,h,_)=>{if(c(l,p,f,d,h,_)!==void 0)return l}}let s=null,o=Array.isArray(r);return e=e.replace(/\B\$(\$|\w+)/g,(c,l)=>{if(l==="$")return a.skipUnescape?c:l;let p;if(o?l.match(/^[1-9]\d*$/)&&(l=l-1,p=n(c,l,r,s,i,a)):l.match(/^\d*$/)||(p=n(c,l,r,s,i,a)),p===void 0)throw new Error(`Named bind parameter "${c}" 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&&(Qdr.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 i of Object.keys(this.model.uniqueKeys))this.model.uniqueKeys[i].fields.includes(e.replace(/"/g,""))&&this.model.uniqueKeys[i].msg&&(r=this.model.uniqueKeys[i].msg);return r}isRawQuery(){return this.options.type===hc.RAW}isVersionQuery(){return this.options.type===hc.VERSION}isUpsertQuery(){return this.options.type===hc.UPSERT}isInsertQuery(e,r){let i=!0;return this.options.type===hc.INSERT?!0:(i=i&&this.sql.toLowerCase().startsWith("insert into"),i=i&&(!e||Object.prototype.hasOwnProperty.call(e,this.getInsertIdField())),i=i&&(!r||Object.prototype.hasOwnProperty.call(r,this.getInsertIdField())),i)}handleInsertQuery(e,r){if(this.instance){let i=this.model.autoIncrementAttribute,n=null;n=n||e&&e[this.getInsertIdField()],n=n||r&&r[this.getInsertIdField()],this.instance[i]=n}}isShowTablesQuery(){return this.options.type===hc.SHOWTABLES}handleShowTablesQuery(e){return ub.flatten(e.map(r=>Object.values(r)))}isShowIndexesQuery(){return this.options.type===hc.SHOWINDEXES}isShowConstraintsQuery(){return this.options.type===hc.SHOWCONSTRAINTS}isDescribeQuery(){return this.options.type===hc.DESCRIBE}isSelectQuery(){return this.options.type===hc.SELECT}isBulkUpdateQuery(){return this.options.type===hc.BULKUPDATE}isBulkDeleteQuery(){return this.options.type===hc.BULKDELETE}isForeignKeysQuery(){return this.options.type===hc.FOREIGNKEYS}isUpdateQuery(){return this.options.type===hc.UPDATE}handleSelectQuery(e){let r=null;if(this.options.fieldMap){let i=this.options.fieldMap;e=e.map(n=>ub.reduce(i,(a,s,o)=>(a[o]!==void 0&&s!==o&&(a[s]=a[o],delete a[o]),a),n))}return this.options.raw?r=e.map(i=>{let n={};for(let a in i)Object.prototype.hasOwnProperty.call(i,a)&&(n[a]=i[a]);return this.options.nest&&(n=Hdr.transform(n)),n}):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,i){let{connection:n,options:a}=this,s=this.sequelize.options.benchmark||a.benchmark,o=this.sequelize.options.logQueryParameters||a.logQueryParameters,c=Date.now(),l="";if(o&&i){let d=e.endsWith(";")?"":";",h;Array.isArray(i)?h=i.map(_=>z8e(_)).join(", "):h=z8e(i),l=`${d} ${h}`}let p=`(${n.uuid||"default"}): ${e}${l}`,f=`Executing ${p}`;return r(f),s||this.sequelize.log(`Executing ${p}`,a),()=>{let d=`Executed ${p}`;r(d),s&&this.sequelize.log(d,Date.now()-c,a)}}static _groupJoinData(e,r,i){if(!e.length)return[];let n,a,s,o,c,l,p=e.length,f,d,h,_,m,E,R,N,T=i.checkExisting,I,W,D,F=T?[]:new Array(p),x={},H={},$,k,oe,j,B,V,X,_e,he=se=>{Object.prototype.hasOwnProperty.call(V.includeMap,se)&&(H[d]=V=V.includeMap[se],_e?_e=`${_e}.${se}`:_e=se,H[_e]=V)},ce={},Re=(se,Ee)=>(Object.prototype.hasOwnProperty.call(Ee,se)||(Ee[se]=se.substr(0,se.lastIndexOf("."))),Ee[se]),Te={},Ce=se=>{if(!Object.prototype.hasOwnProperty.call(Te,se)){let Ee=se.lastIndexOf(".");Te[se]=se.substr(Ee===-1?0:Ee+1)}return Te[se]},te={},de=se=>{if(!Object.prototype.hasOwnProperty.call(te,se)){let Ee=Re(se,ce);Object.prototype.hasOwnProperty.call(te,Ee)||(te[Ee]=Ee?Ee.split("."):[]),te[se]=te[Ee]}return te[se]},ze={},Oe=se=>{if(!Object.prototype.hasOwnProperty.call(ze,se)){let Ee=de(se),Ie=Ee.length;ze[se]=Ie?Ee[Ie-1]:""}return ze[se]},ke=se=>{let Ee=ub.chain(se.uniqueKeys);return Ee=Ee.result(`${Ee.findKey()}.fields`).map(Ie=>ub.findKey(se.attributes,Pe=>Pe.field===Ie)).value(),Ee},$e=se=>se instanceof Buffer?se.toString("hex"):se,Se,nt,xe;for(c=0;c<p;c++){if(l=e[c],c===0&&(f=ub.sortBy(Object.keys(l),se=>[se.split(".").length]),_=f.length),T){if(N=!1,o=r.model.primaryKeyAttributes.length,D="",o===1)D=$e(l[r.model.primaryKeyAttributes[0]]);else if(o>1)for(s=0;s<o;s++)D+=$e(l[r.model.primaryKeyAttributes[s]]);else if(!ub.isEmpty(r.model.uniqueKeys))for(nt=ke(r.model),s=0;s<nt.length;s++)D+=l[nt[s]]}for(R=E={},j=void 0,h=0;h<_;h++){if(d=f[h],k=Re(d,ce),$=de(d),c===0&&!Object.prototype.hasOwnProperty.call(H,d)&&($.length?(V=r,_e=void 0,$.forEach(he)):H[d]=H[""]=r),j!==void 0&&j!==$){if(T){if(a=j.length,X=null,W=null,a)for(n=0;n<a;n++){if(xe=X?`${X}.${j[n]}`:j[n],Se=H[xe].model.primaryKeyAttributes,o=Se.length,I=xe,o===1)I+=$e(l[`${xe}.${Se[0]}`]);else if(o>1)for(s=0;s<o;s++)I+=$e(l[`${xe}.${Se[s]}`]);else if(!ub.isEmpty(H[xe].model.uniqueKeys))for(nt=ke(H[xe].model),s=0;s<nt.length;s++)I+=l[`${xe}.${nt[s]}`];W||(W=D),I=W+I,X=xe,n<a-1&&(W=I)}else I=D;I===D?x[I]?N=!0:x[I]=E:x[I]||(X=x[W],B=Oe(m),H[m].association.isSingleAssociation?X&&(X[B]=x[I]=E):(X[B]||(X[B]=[]),X[B].push(x[I]=E))),E={}}else if(V=R,a=$.length,a)for(n=0;n<a;n++)n===a-1&&(E=V[$[n]]={}),V=V[$[n]]||{}}E[Ce(d)]=l[d],m=d,j=$,oe=k}if(T){if(a=j.length,X=null,W=null,a)for(n=0;n<a;n++){if(xe=X?`${X}.${j[n]}`:j[n],Se=H[xe].model.primaryKeyAttributes,o=Se.length,I=xe,o===1)I+=$e(l[`${xe}.${Se[0]}`]);else if(o>0)for(s=0;s<o;s++)I+=$e(l[`${xe}.${Se[s]}`]);else if(!ub.isEmpty(H[xe].model.uniqueKeys))for(nt=ke(H[xe].model),s=0;s<nt.length;s++)I+=l[`${xe}.${nt[s]}`];W||(W=D),I=W+I,X=xe,n<a-1&&(W=I)}else I=D;I===D?x[I]?N=!0:x[I]=E:x[I]||(X=x[W],B=Oe(m),H[m].association.isSingleAssociation?X&&(X[B]=x[I]=E):(X[B]||(X[B]=[]),X[B].push(x[I]=E))),N||F.push(R)}else F[c]=R}return F}};lk.exports=L4;lk.exports.AbstractQuery=L4;lk.exports.default=L4});var q8e=O((Rei,S8e)=>{"use strict";var Ydr=Object.defineProperty,R8e=Object.getOwnPropertySymbols,Xdr=Object.prototype.hasOwnProperty,Kdr=Object.prototype.propertyIsEnumerable,w8e=(t,e,r)=>e in t?Ydr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,$dr=(t,e)=>{for(var r in e||(e={}))Xdr.call(e,r)&&w8e(t,r,e[r]);if(R8e)for(var r of R8e(e))Kdr.call(e,r)&&w8e(t,r,e[r]);return t},N8e=td(),pk=fi(),v8e=fr(),nte=ri(),{logger:Jdr}=Bn(),Zdr=1062,ehr=1213,T8e=1451,thr=1452,I8e=Jdr.debugContext("sql:mariadb"),ate=class extends N8e{constructor(e,r,i){super(e,r,$dr({showWarnings:!1},i))}static formatBindParameters(e,r,i){let n=[],a=(s,o,c)=>{if(c[o]!==void 0)return n.push(c[o]),"?"};return e=N8e.formatBindParameters(e,r,i,a)[0],[e,n.length>0?n:void 0]}async run(e,r){this.sql=e;let{connection:i,options:n}=this,a=this.sequelize.options.showWarnings||n.showWarnings,s=this._logQuery(e,I8e,r);r&&I8e("parameters(%j)",r);let o,c=new Error;try{o=await i.query(this.sql,r)}catch(l){if(n.transaction&&l.errno===ehr){try{await n.transaction.rollback()}catch{}n.transaction.finished="rollback"}throw l.sql=e,l.parameters=r,this.formatError(l,c.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 i=e[this.getInsertIdField()];r=new Array(e.affectedRows);let n=this.model.rawAttributes[this.model.primaryKeyAttribute].field;for(let a=0;a<e.affectedRows;a++)r[a]={[n]:i+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 i=e.meta;return delete e.meta,[e,i]}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 i of e)r[i.Field]={type:i.Type.toLowerCase().startsWith("enum")?i.Type.replace(/^enum/i,"ENUM"):i.Type.toUpperCase(),allowNull:i.Null==="YES",defaultValue:i.Default,primaryKey:i.Key==="PRI",autoIncrement:Object.prototype.hasOwnProperty.call(i,"Extra")&&i.Extra.toLowerCase()==="auto_increment",comment:i.Comment?i.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 i=this.model.fieldRawAttributesMap[r];i.type instanceof nte.JSON&&(e=e.map(n=>(n[i.fieldName]&&typeof n[i.fieldName]=="string"&&!this.connection.info.hasMinVersion(10,5,2)&&(n[i.fieldName]=JSON.parse(n[i.fieldName])),nte.JSON.parse?nte.JSON.parse(i,this.sequelize.options,n[i.fieldName]):n)))}}async logWarnings(e){let r=await this.run("SHOW WARNINGS"),i=`MariaDB Warnings (${this.connection.uuid||"default"}): `,n=[];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"))n.push(s.Message);else for(let o of s.keys())n.push([o,s[o]].join(": "));return this.sequelize.log(i+n.join("; "),this.options),e}formatError(e,r){switch(e.errno){case Zdr:{let i=e.message.match(/Duplicate entry '([\s\S]*)' for key '?((.|\s)*?)'?\s.*$/),n={},a="Validation error",s=i?i[1].split("-"):void 0,o=i?i[2]:void 0,c=i?i[1]:void 0,l=this.model&&this.model.uniqueKeys[o];l?(l.msg&&(a=l.msg),n=v8e.zipObject(l.fields,s)):n[o]=c;let p=[];return v8e.forOwn(n,(f,d)=>{p.push(new pk.ValidationErrorItem(this.getUniqueConstraintErrorMessage(d),"unique violation",d,f,this.instance,"not_unique"))}),new pk.UniqueConstraintError({message:a,errors:p,parent:e,fields:n,stack:r})}case T8e:case thr:{let i=e.message.match(/CONSTRAINT ([`"])(.*)\1 FOREIGN KEY \(\1(.*)\1\) REFERENCES \1(.*)\1 \(\1(.*)\1\)/),n=i?i[1]:"`",a=i?i[3].split(new RegExp(`${n}, *${n}`)):void 0;return new pk.ForeignKeyConstraintError({reltype:e.errno===T8e?"parent":"child",table:i?i[4]:void 0,fields:a,value:a&&a.length&&this.instance&&this.instance[a[0]]||void 0,index:i?i[2]:void 0,parent:e,stack:r})}default:return new pk.DatabaseError(e,{stack:r})}}handleShowTablesQuery(e){return e.map(r=>({tableName:r.TABLE_NAME,schema:r.TABLE_SCHEMA}))}handleShowIndexesQuery(e){let r,i=[];return e.forEach(n=>{(!r||r.name!==n.Key_name)&&(r={primary:n.Key_name==="PRIMARY",fields:[],name:n.Key_name,tableName:n.Table,unique:n.Non_unique!==1,type:n.Index_type},i.push(r)),r.fields[n.Seq_in_index-1]={attribute:n.Column_name,length:n.Sub_part||void 0,order:n.Collation==="A"?"ASC":void 0}}),i}};S8e.exports=ate});var k8e=O((wei,L8e)=>{"use strict";var rhr=Object.defineProperty,C8e=Object.getOwnPropertySymbols,ihr=Object.prototype.hasOwnProperty,nhr=Object.prototype.propertyIsEnumerable,x8e=(t,e,r)=>e in t?rhr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,ahr=(t,e)=>{for(var r in e||(e={}))ihr.call(e,r)&&x8e(t,r,e[r]);if(C8e)for(var r of C8e(e))nhr.call(e,r)&&x8e(t,r,e[r]);return t},fk=fr(),a0=Hs(),shr=wi(),ohr={OperatorMap:{[a0.eq]:"=",[a0.ne]:"!=",[a0.gte]:">=",[a0.gt]:">",[a0.lte]:"<=",[a0.lt]:"<",[a0.not]:"IS NOT",[a0.is]:"IS",[a0.in]:"IN",[a0.notIn]:"NOT IN",[a0.like]:"LIKE",[a0.notLike]:"NOT LIKE",[a0.iLike]:"ILIKE",[a0.notILike]:"NOT ILIKE",[a0.startsWith]:"LIKE",[a0.endsWith]:"LIKE",[a0.substring]:"LIKE",[a0.regexp]:"~",[a0.notRegexp]:"!~",[a0.iRegexp]:"~*",[a0.notIRegexp]:"!~*",[a0.between]:"BETWEEN",[a0.notBetween]:"NOT BETWEEN",[a0.overlap]:"&&",[a0.contains]:"@>",[a0.contained]:"<@",[a0.adjacent]:"-|-",[a0.strictLeft]:"<<",[a0.strictRight]:">>",[a0.noExtendRight]:"&<",[a0.noExtendLeft]:"&>",[a0.any]:"ANY",[a0.all]:"ALL",[a0.and]:" AND ",[a0.or]:" OR ",[a0.col]:"COL",[a0.placeholder]:"$$PLACEHOLDER$$",[a0.match]:"@@"},OperatorsAliasMap:{},setOperatorsAliases(t){!t||fk.isEmpty(t)?this.OperatorsAliasMap=!1:this.OperatorsAliasMap=ahr({},t)},_replaceAliases(t){let e={};return this.OperatorsAliasMap?(shr.getOperators(t).forEach(r=>{let i=t[r];fk.isPlainObject(i)?e[r]=this._replaceAliases(i):e[r]=i}),fk.forOwn(t,(r,i)=>{i=this.OperatorsAliasMap[i]||i,fk.isPlainObject(r)&&(r=this._replaceAliases(r)),e[i]=r}),e):t}};L8e.exports=ohr});var B8e=O((Nei,D8e)=>{"use strict";var chr=(rM(),Yl(tM)).v4,uhr={setIsolationLevelQuery(t,e){if(!e.parent)return`SET TRANSACTION ISOLATION LEVEL ${t};`},generateTransactionId(){return chr()},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;"}};D8e.exports=uhr});var lb=O((Tei,j8e)=>{"use strict";var lhr=Object.defineProperty,phr=Object.defineProperties,fhr=Object.getOwnPropertyDescriptors,P8e=Object.getOwnPropertySymbols,dhr=Object.prototype.hasOwnProperty,hhr=Object.prototype.propertyIsEnumerable,W8e=(t,e,r)=>e in t?lhr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,hA=(t,e)=>{for(var r in e||(e={}))dhr.call(e,r)&&W8e(t,r,e[r]);if(P8e)for(var r of P8e(e))hhr.call(e,r)&&W8e(t,r,e[r]);return t},dk=(t,e)=>phr(t,fhr(e)),hk=require("util"),Zr=fr(),bhr=(rM(),Yl(tM)).v4,Wt=wi(),vei=cM(),U8e=a4(),dM=ri(),Zu=Aee(),hM=nb(),ste=ab(),_hr=aM(),Ahr=cA(),Nt=Hs(),ote=fi(),F8e=Nee(),mhr=new Set(["integer","int","smallint","bigint","float","real","double precision","decimal","numeric","boolean","text","char","varchar","nvarchar","date","timestamp","timestamptz","datetime","json","jsonb","signed","unsigned"]),k4=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:Zr.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,i){return`DESCRIBE ${this.quoteTable(this.addSchema({tableName:e,_schema:r,_schemaDelimiter:i}))};`}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,i,n){n=n||{},Zr.defaults(n,this.options);let a={},s=n.bind||[],o=[],c=[],l=[],p=[],f=this.quoteTable(e),d=n.bindParam===void 0?this.bindParam(s):n.bindParam,h=[],_,m="",E="",R="",N="",T=!1,I="";if(i&&Zr.each(i,(x,H)=>{a[H]=x,x.field&&(a[x.field]=x)}),this._dialect.supports["DEFAULT VALUES"]?E+=" DEFAULT VALUES":this._dialect.supports["VALUES ()"]&&(E+=" VALUES ()"),(this._dialect.supports.returnValues||this._dialect.supports.returnIntoValues)&&n.returning){let x=this.generateReturnValues(i,n);c.push(...x.returnFields),this._dialect.supports.returnIntoValues&&l.push(...x.returnTypes),N=x.returningFragment,I=x.tmpTable||"",R=x.outputFragment||""}(Zr.get(this,["sequelize","options","dialectOptions","prependSearchPath"])||n.searchPath)&&(n.bindParam=!1),this._dialect.supports.EXCEPTION&&n.exception&&(n.bindParam=!1),r=Wt.removeNullValuesFromHash(r,this.options.omitNull);for(let x in r)if(Object.prototype.hasOwnProperty.call(r,x)){let H=r[x];o.push(this.quoteIdentifier(x)),a&&a[x]&&a[x].autoIncrement===!0&&H==null?this._dialect.supports.autoIncrement.defaultValue?this._dialect.supports.DEFAULT?p.push("DEFAULT"):p.push(this.escape(null)):o.splice(-1,1):(a&&a[x]&&a[x].autoIncrement===!0&&(T=!0),H instanceof Wt.SequelizeMethod||n.bindParam===!1?p.push(this.escape(H,a&&a[x]||void 0,{context:"INSERT"})):p.push(this.format(H,a&&a[x]||void 0,{context:"INSERT"},d)))}let W="";if(!Zr.isEmpty(n.conflictWhere)&&!this._dialect.supports.inserts.onConflictWhere)throw new Error("missing dialect support for conflictWhere option");if(this._dialect.supports.inserts.updateOnDuplicate&&n.updateOnDuplicate)if(this._dialect.supports.inserts.updateOnDuplicate==" ON CONFLICT DO UPDATE SET"){let x=n.upsertKeys.map(k=>this.quoteIdentifier(k)),H=n.updateOnDuplicate.map(k=>`${this.quoteIdentifier(k)}=EXCLUDED.${this.quoteIdentifier(k)}`),$=["ON CONFLICT","(",x.join(","),")"];Zr.isEmpty(n.conflictWhere)||$.push(this.whereQuery(n.conflictWhere,n)),Zr.isEmpty(H)?$.push("DO NOTHING"):$.push("DO UPDATE SET",H.join(",")),W=` ${Wt.joinSQLFragments($)}`}else{let x=n.updateOnDuplicate.map(H=>`${this.quoteIdentifier(H)}=VALUES(${this.quoteIdentifier(H)})`);if(Zr.isEmpty(x)&&n.upsertKeys&&x.push(...n.upsertKeys.map(H=>`${this.quoteIdentifier(H)}=${this.quoteIdentifier(H)}`)),Zr.isEmpty(x))throw new Error("No update values found for ON DUPLICATE KEY UPDATE clause, and no identifier fields could be found to use instead.");W+=`${this._dialect.supports.inserts.updateOnDuplicate} ${x.join(",")}`}let D={ignoreDuplicates:n.ignoreDuplicates?this._dialect.supports.inserts.ignoreDuplicates:"",onConflictDoNothing:n.ignoreDuplicates?this._dialect.supports.inserts.onConflictDoNothing:"",attributes:o.join(","),output:R,values:p.join(","),tmpTable:I};if(m=`${I}INSERT${D.ignoreDuplicates} INTO ${f} (${D.attributes})${D.output} VALUES (${D.values})${W}${D.onConflictDoNothing}${m}`,E=`${I}INSERT${D.ignoreDuplicates} INTO ${f}${D.output}${W}${D.onConflictDoNothing}${E}`,this._dialect.supports.EXCEPTION&&n.exception){let x="DROP FUNCTION IF EXISTS pg_temp.testfunc()";c.length===0&&c.push("*");let H=`$func_${bhr().replace(/-/g,"")}$`,$=`SELECT (testfunc.response).${c.join(", (testfunc.response).")}, testfunc.sequelize_caught_exception FROM pg_temp.testfunc();`;n.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 ${H} BEGIN ${m} RETURNING * INTO response; EXCEPTION ${n.exception} END ${H} LANGUAGE plpgsql; ${$} ${x}`}else m+=N,E+=N;this._dialect.supports.returnIntoValues&&n.returning&&this.populateInsertQueryReturnIntoBinds(c,l,s.length,h,n),_=`${D.attributes.length?m:E}${h.join(",")};`,this._dialect.supports.finalTable&&(_=`SELECT * FROM FINAL TABLE(${D.attributes.length?m:E});`),T&&this._dialect.supports.autoIncrement.identityInsert&&(_=`SET IDENTITY_INSERT ${f} ON; ${_} SET IDENTITY_INSERT ${f} OFF;`);let F={query:_};return n.bindParam!==!1&&(F.bind=s),F}bulkInsertQuery(e,r,i,n){i=i||{},n=n||{};let a=[],s={},o=[],c="";for(let h of r)Zr.forOwn(h,(_,m)=>{o.includes(m)||o.push(m),n[m]&&n[m].autoIncrement===!0&&(s[m]=!0)});for(let h of r){let _=o.map(m=>this._dialect.supports.bulkDefault&&s[m]===!0?h[m]!=null?h[m]:"DEFAULT":this.escape(h[m],n[m],{context:"INSERT"}));a.push(`(${_.join(",")})`)}if(this._dialect.supports.inserts.updateOnDuplicate&&i.updateOnDuplicate)if(this._dialect.supports.inserts.updateOnDuplicate==" ON CONFLICT DO UPDATE SET"){let h=i.upsertKeys.map(E=>this.quoteIdentifier(E)),_=i.updateOnDuplicate.map(E=>`${this.quoteIdentifier(E)}=EXCLUDED.${this.quoteIdentifier(E)}`),m=!1;if(i.conflictWhere){if(!this._dialect.supports.inserts.onConflictWhere)throw new Error(`conflictWhere not supported for dialect ${this._dialect.name}`);m=this.whereQuery(i.conflictWhere,i)}c=["ON CONFLICT","(",h.join(","),")",m,"DO UPDATE SET",_.join(",")]}else{if(i.conflictWhere)throw new Error(`conflictWhere not supported for dialect ${this._dialect.name}`);let h=i.updateOnDuplicate.map(_=>`${this.quoteIdentifier(_)}=VALUES(${this.quoteIdentifier(_)})`);c=`${this._dialect.supports.inserts.updateOnDuplicate} ${h.join(",")}`}let l=i.ignoreDuplicates?this._dialect.supports.inserts.ignoreDuplicates:"",p=o.map(h=>this.quoteIdentifier(h)).join(","),f=i.ignoreDuplicates?this._dialect.supports.inserts.onConflictDoNothing:"",d="";if(this._dialect.supports.returnValues&&i.returning){let h=this.generateReturnValues(n,i);d+=h.returningFragment}return Wt.joinSQLFragments(["INSERT",l,"INTO",this.quoteTable(e),`(${p})`,"VALUES",a.join(","),c,f,d,";"])}updateQuery(e,r,i,n,a){n=n||{},Zr.defaults(n,this.options),r=Wt.removeNullValuesFromHash(r,n.omitNull,n);let s=[],o=[],c={},l="",p="",f="";(Zr.get(this,["sequelize","options","dialectOptions","prependSearchPath"])||n.searchPath)&&(n.bindParam=!1);let d=n.bindParam===void 0?this.bindParam(o):n.bindParam;if(this._dialect.supports["LIMIT ON UPDATE"]&&n.limit&&(["mssql","db2","oracle"].includes(this.dialect)?this.dialect==="oracle"&&(i&&(i.length&&i.length>0||Object.keys(i).length>0)?f+=" AND ":f+=" WHERE ",f+=`rownum <= ${this.escape(n.limit)} `):f=` LIMIT ${this.escape(n.limit)} `),this._dialect.supports.returnValues&&n.returning){let E=this.generateReturnValues(a,n);f+=E.returningFragment,p=E.tmpTable||"",l=E.outputFragment||"",!this._dialect.supports.returnValues.output&&n.returning&&(n.mapToModel=!0)}a&&Zr.each(a,(E,R)=>{c[R]=E,E.field&&(c[E.field]=E)});for(let E in r){if(c&&c[E]&&c[E].autoIncrement===!0&&!this._dialect.supports.autoIncrement.update)continue;let R=r[E];R instanceof Wt.SequelizeMethod||n.bindParam===!1?s.push(`${this.quoteIdentifier(E)}=${this.escape(R,c&&c[E]||void 0,{context:"UPDATE"})}`):s.push(`${this.quoteIdentifier(E)}=${this.format(R,c&&c[E]||void 0,{context:"UPDATE"},d)}`)}let h=dk(hA({},n),{bindParam:d});if(s.length===0)return"";let m={query:`${p}UPDATE ${this.quoteTable(e)} SET ${s.join(",")}${l} ${this.whereQuery(i,h)}${f}`.trim()};return n.bindParam!==!1&&(m.bind=o),m}arithmeticQuery(e,r,i,n,a,s){s=s||{},Zr.defaults(s,{returning:!0}),a=Wt.removeNullValuesFromHash(a,this.options.omitNull);let o="",c="";if(this._dialect.supports.returnValues&&s.returning){let p=this.generateReturnValues(null,s);o=p.outputFragment,c=p.returningFragment}let l=[];for(let p in n){let f=n[p],d=this.quoteIdentifier(p),h=this.escape(f);l.push(`${d}=${d}${e} ${h}`)}for(let p in a){let f=a[p],d=this.quoteIdentifier(p),h=this.escape(f);l.push(`${d}=${h}`)}return Wt.joinSQLFragments(["UPDATE",this.quoteTable(r),"SET",l.join(","),o,this.whereQuery(i),c])}addIndexQuery(e,r,i,n){i=i||{},Array.isArray(r)?i.fields=r:(i=r,r=void 0),i.prefix=i.prefix||n||e,i.prefix&&typeof i.prefix=="string"&&(i.prefix=i.prefix.replace(/\./g,"_"),i.prefix=i.prefix.replace(/("|')/g,""));let a=i.fields.map(c=>{if(c instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(c);typeof c=="string"&&(c={name:c});let l="";if(c.attribute&&(c.name=c.attribute),!c.name)throw new Error(`The following index field has no name: ${hk.inspect(c)}`);if(l+=this.quoteIdentifier(c.name),this._dialect.supports.index.collate&&c.collate&&(l+=` COLLATE ${this.quoteIdentifier(c.collate)}`),this._dialect.supports.index.operator){let p=c.operator||i.operator;p&&(l+=` ${p}`)}return this._dialect.supports.index.length&&c.length&&(l+=`(${c.length})`),c.order&&(l+=` ${c.order}`),l});i.name||(i=Wt.nameIndex(i,i.prefix)),i=Zu._conformIndex(i),this._dialect.supports.index.type||delete i.type,i.where&&(i.where=this.whereQuery(i.where)),typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e);let s=this._dialect.supports.index.concurrently&&i.concurrently?"CONCURRENTLY":void 0,o;return this._dialect.supports.indexViaAlter?o=["ALTER TABLE",e,s,"ADD"]:o=["CREATE"],o=o.concat(i.unique?"UNIQUE":"",i.type,"INDEX",this._dialect.supports.indexViaAlter?void 0:s,this.quoteIdentifiers(i.name),this._dialect.supports.index.using===1&&i.using?`USING ${i.using}`:"",this._dialect.supports.indexViaAlter?void 0:`ON ${e}`,this._dialect.supports.index.using===2&&i.using?`USING ${i.using}`:"",`(${a.join(", ")})`,this._dialect.supports.index.parser&&i.parser?`WITH PARSER ${i.parser}`:void 0,this._dialect.supports.index.where&&i.where?i.where:void 0),Zr.compact(o).join(" ")}addConstraintQuery(e,r){return typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e),Wt.joinSQLFragments(["ALTER TABLE",e,"ADD",this.getConstraintSnippet(e,r||{}),";"])}getConstraintSnippet(e,r){let i,n,a=r.fields.map(c=>{if(typeof c=="string")return this.quoteIdentifier(c);if(c instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(c);if(c.attribute&&(c.name=c.attribute),!c.name)throw new Error(`The following index field has no name: ${c}`);return this.quoteIdentifier(c.name)}),s=a.join(", "),o=a.join("_");switch(r.type.toUpperCase()){case"UNIQUE":n=this.quoteIdentifier(r.name||`${e}_${o}_uk`),i=`CONSTRAINT ${n} UNIQUE (${s})`;break;case"CHECK":r.where=this.whereItemsQuery(r.where),n=this.quoteIdentifier(r.name||`${e}_${o}_ck`),i=`CONSTRAINT ${n} 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.");n=this.quoteIdentifier(r.name||`${e}_${o}_df`),i=`CONSTRAINT ${n} DEFAULT (${this.escape(r.defaultValue)}) FOR ${a[0]}`;break;case"PRIMARY KEY":n=this.quoteIdentifier(r.name||`${e}_${o}_pk`),i=`CONSTRAINT ${n} PRIMARY KEY (${s})`;break;case"FOREIGN KEY":let c=r.references;if(!c||!c.table||!(c.field||c.fields))throw new Error("references object with table and field must be specified");n=this.quoteIdentifier(r.name||`${e}_${o}_${c.table}_fk`);let l=typeof c.field<"u"?this.quoteIdentifier(c.field):c.fields.map(f=>this.quoteIdentifier(f)).join(", "),p=`${this.quoteTable(c.table)} (${l})`;i=`CONSTRAINT ${n} `,i+=`FOREIGN KEY (${s}) REFERENCES ${p}`,r.onUpdate&&(i+=` ON UPDATE ${r.onUpdate.toUpperCase()}`),r.onDelete&&(i+=` 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())&&(i+=` ${this.deferConstraintsQuery(r)}`),i}removeConstraintQuery(e,r){return typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e),Wt.joinSQLFragments(["ALTER TABLE",e,"DROP CONSTRAINT",this.quoteIdentifiers(r)])}quote(e,r,i){let n=["ASC","DESC","ASC NULLS LAST","DESC NULLS LAST","ASC NULLS FIRST","DESC NULLS FIRST","NULLS FIRST","NULLS LAST"];if(i=i||".",typeof e=="string")return this.quoteIdentifiers(e);if(Array.isArray(e)){e.forEach((p,f)=>{let d=e[f-1],h,_;if(!d&&r!==void 0?_=r:d&&d instanceof hM&&(h=d,_=d.target),_&&_.prototype instanceof Zu){let m,E;if(typeof p=="function"&&p.prototype instanceof Zu?m=p:Zr.isPlainObject(p)&&p.model&&p.model.prototype instanceof Zu&&(m=p.model,E=p.as),m&&(!E&&h&&h instanceof hM&&h.through&&h.through.model===m?p=new hM(_,m,{as:m.name}):(p=_.getAssociationForAlias(m,E),p||(p=_.getAssociationForAlias(m,m.name))),!(p instanceof hM)))throw new Error(hk.format("Unable to find a valid association for model, '%s'",m.name))}if(typeof p=="string"){let m=n.indexOf(p.toUpperCase());if(f>0&&m!==-1)p=this.sequelize.literal(` ${n[m]}`);else if(_&&_.prototype instanceof Zu){if(_.associations!==void 0&&_.associations[p])p=_.associations[p];else if(_.rawAttributes!==void 0&&_.rawAttributes[p]&&p!==_.rawAttributes[p].field)p=_.rawAttributes[p].field;else if(p.includes(".")&&_.rawAttributes!==void 0){let E=p.split(".");if(_.rawAttributes[E[0]].type instanceof dM.JSON){let R=this.quoteIdentifiers(`${_.name}.${_.rawAttributes[E[0]].field}`),N=E.slice(1);p=this.jsonPathExtractionQuery(R,N),p=this.sequelize.literal(p)}}}}e[f]=p},this);let a=e.length,s=[],o,c=0;for(c=0;c<a-1&&(o=e[c],!(typeof o=="string"||o._modelAttribute||o instanceof Wt.SequelizeMethod));c++)o instanceof hM&&(s[c]=o.as);let l="";return c>0?l+=`${this.quoteIdentifier(s.join(i))}.`:typeof e[0]=="string"&&r&&(l+=`${this.quoteIdentifier(r.name)}.`),e.slice(c).forEach(p=>{l+=this.quote(p,r,i)},this),l}if(e._modelAttribute)return`${this.quoteTable(e.Model.name)}.${this.quoteIdentifier(e.fieldName)}`;if(e instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(e);throw Zr.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: ${hk.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("->"),i=e[e.length-1];return`${this.quoteIdentifier(r)}.${this.quoteIdentifier(i)}`}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 i="";return r===!0&&(r=e.as||e.name||e),Zr.isObject(e)?this._dialect.supports.schemas?(e.schema&&(i+=`${this.quoteIdentifier(e.schema)}.`),i+=this.quoteIdentifier(e.tableName)):(e.schema&&(i+=e.schema+(e.delimiter||".")),i+=e.tableName,i=this.quoteIdentifier(i)):i=this.quoteIdentifier(e),r&&(i+=` ${this.getAliasToken()} ${this.quoteIdentifier(r)}`),i}escape(e,r,i){if(i=i||{},e!=null){if(e instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(e);if(r&&r.type&&(r.type instanceof dM.STRING&&["mysql","mariadb"].includes(this.dialect)&&["number","boolean"].includes(typeof e)&&(e=String(Number(e))),this.validate(e,r,i),r.type.stringify)){let n=a=>U8e.escape(a,this.options.timezone,this.dialect);if(e=r.type.stringify(e,{escape:n,field:r,timezone:this.options.timezone,operation:i.operation}),r.type.escape===!1)return e}}return U8e.escape(e,this.options.timezone,this.dialect)}bindParam(e){return r=>(e.push(r),`$${e.length}`)}format(e,r,i,n){if(i=i||{},e!=null){if(e instanceof Wt.SequelizeMethod)throw new Error("Cannot pass SequelizeMethod as a bind parameter - use escape instead");if(r&&r.type&&(this.validate(e,r,i),r.type.bindParam))return r.type.bindParam(e,{escape:Zr.identity,field:r,timezone:this.options.timezone,operation:i.operation,bindParam:n})}return n(e)}validate(e,r,i){if(this.typeValidation&&r.type.validate&&e)try{if(i.isList&&Array.isArray(e))for(let n of e)r.type.validate(n,i);else r.type.validate(e,i)}catch(n){throw n instanceof ote.ValidationError&&n.errors.push(new ote.ValidationErrorItem(n.message,"Validation error",r.fieldName,e,null,`${r.type.key} validator`)),n}}isIdentifierQuoted(e){return/^\s*(?:([`"'])(?:(?!\1).|\1{2})*\1\.?)+\s*$/i.test(e)}jsonPathExtractionQuery(e,r,i){let n=Zr.toPath(r),a,s=this.isIdentifierQuoted(e)?e:this.quoteIdentifier(e);switch(this.dialect){case"mysql":case"mariadb":case"sqlite":return this.dialect==="mysql"&&(n=n.map(c=>/\D/.test(c)?Wt.addTicks(c,'"'):c)),a=this.escape(["$"].concat(n).join(".").replace(/\.(\d+)(?:(?=\.)|$)/g,(c,l)=>`[${l}]`)),this.dialect==="sqlite"?`json_extract(${s},${a})`:`json_unquote(json_extract(${s},${a}))`;case"postgres":let o=i?"#>":"#>>";return a=this.escape(`{${n.join(",")}}`),`(${s}${o}${a})`;default:throw new Error(`Unsupported ${this.dialect} for JSON operations`)}}selectQuery(e,r,i){r=r||{};let n=r.limit,a=[],s=[],o=r.subQuery===void 0?n&&r.hasMultiAssociation:r.subQuery,c={main:r.attributes&&r.attributes.slice(),subQuery:null},l={name:e,quotedName:null,as:null,model:i},p={names:l,options:r,subQuery:o},f=[],d=[],h;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&&c.main)for(let m of l.model.primaryKeyAttributes)c.main.some(E=>m===E||m===E[0]||m===E[1])||c.main.push(l.model.rawAttributes[m].field?[m,l.model.rawAttributes[m].field]:m);if(c.main=this.escapeAttributes(c.main,r,l.as),c.main=c.main||(r.include?[`${l.as}.*`]:["*"]),(o||r.groupedLimit)&&(c.subQuery=c.main,c.main=[`${l.as||l.quotedName}.*`]),r.include)for(let m of r.include){if(m.separate)continue;let E=this.generateInclude(m,{externalAs:l.as,internalAs:l.as},p);d=d.concat(E.subQuery),f=f.concat(E.mainQuery),E.attributes.main.length>0&&(c.main=Zr.uniq(c.main.concat(E.attributes.main))),E.attributes.subQuery.length>0&&(c.subQuery=Zr.uniq(c.subQuery.concat(E.attributes.subQuery)))}if(o)s.push(this.selectFromTableFragment(r,l.model,c.subQuery,l.quotedName,l.as)),s.push(d.join(""));else{if(r.groupedLimit){l.as||(l.as=l.quotedName);let m=hA({},r.where),E,R,N,T=l.as;if(typeof r.groupedLimit.on=="string"?R=r.groupedLimit.on:r.groupedLimit.on instanceof Ahr&&(R=r.groupedLimit.on.foreignKeyField),r.groupedLimit.on instanceof _hr){T=r.groupedLimit.on.manyFromSource.as;let F=Zu._validateIncludedElements({include:[{association:r.groupedLimit.on.manyFromSource,duplicating:!1,required:!0,where:hA({[Nt.placeholder]:!0},r.groupedLimit.through&&r.groupedLimit.through.where)}],model:i});r.hasJoin=!0,r.hasMultiAssociation=!0,r.includeMap=Object.assign(F.includeMap,r.includeMap),r.includeNames=F.includeNames.concat(r.includeNames||[]),N=F.include,Array.isArray(r.order)&&(r.order.forEach((x,H)=>{Array.isArray(x)&&(x=x[0]);let $=`subquery_order_${H}`;r.attributes.push([x,$]),$=this.sequelize.literal(this.quote($)),Array.isArray(r.order[H])?r.order[H][0]=$:r.order[H]=$}),E=r.order)}else E=r.order,this._dialect.supports.topLevelOrderByRequired||delete r.order,m[Nt.placeholder]=!0;let I=`SELECT * FROM (${this.selectQuery(e,{attributes:r.attributes,offset:r.offset,limit:r.groupedLimit.limit,order:E,aliasesMapping:r.aliasesMapping,aliasesByTable:r.aliasesByTable,where:m,include:N,model:i},i).replace(/;$/,"")}) ${this.getAliasToken()} sub`,W=this.whereItemQuery(Nt.placeholder,!0,{model:i}),D=I.indexOf(W);a.push(this.selectFromTableFragment(r,l.model,c.main,`(${r.groupedLimit.values.map(F=>{let x;return R&&(x={[R]:F}),N&&(x={[r.groupedLimit.on.foreignIdentifierField]:F}),Wt.spliceStr(I,D,W.length,this.getWhereConditions(x,T))}).join(this._dialect.supports["UNION ALL"]?" UNION ALL ":" UNION ")})`,l.as))}else a.push(this.selectFromTableFragment(r,l.model,c.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,i,r),r.where&&(o?s.push(` WHERE ${r.where}`):(a.push(` WHERE ${r.where}`),a.forEach((m,E)=>{m.startsWith("SELECT")&&(a[E]=this.selectFromTableFragment(r,i,c.main,l.quotedName,l.as,r.where))})))),r.group&&(r.group=Array.isArray(r.group)?r.group.map(m=>this.aliasGrouping(m,i,l.as,r)).join(", "):this.aliasGrouping(r.group,i,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,i,r,!1),r.having&&(o?s.push(` HAVING ${r.having}`):a.push(` HAVING ${r.having}`))),r.order){let m=this.getQueryOrders(r,i,o);m.mainQueryOrder.length&&a.push(` ORDER BY ${m.mainQueryOrder.join(", ")}`),m.subQueryOrder.length&&s.push(` ORDER BY ${m.subQueryOrder.join(", ")}`)}let _=this.addLimitAndOffset(r,l.model);if(_&&!r.groupedLimit&&(o?s.push(_):a.push(_)),o?(this._throwOnEmptyAttributes(c.main,{modelName:i&&i.name,as:l.as}),h=`SELECT ${c.main.join(", ")} FROM (${s.join("")}) ${this.getAliasToken()} ${l.as}${f.join("")}${a.join("")}`):h=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)?h+=` FOR ${m}`:m==="SHARE"?h+=` ${this._dialect.supports.forShare}`:h+=" FOR UPDATE",this._dialect.supports.lockOf&&r.lock.of&&r.lock.of.prototype instanceof Zu&&(h+=` OF ${this.quoteTable(r.lock.of.name)}`),this._dialect.supports.skipLocked&&r.skipLocked&&(h+=" SKIP LOCKED")}return`${h};`}aliasGrouping(e,r,i,n){let a=Array.isArray(e)?e[0]:e;return this.quote(this._getAliasForField(i,a,n)||a,r)}escapeAttributes(e,r,i){return e&&e.map(n=>{let a=!0;if(n instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(n);if(Array.isArray(n)){if(n.length!==2)throw new Error(`${JSON.stringify(n)} is not a valid attribute definition. Please use the following format: ['attribute definition', 'alias']`);if(n=n.slice(),n[0]instanceof Wt.SequelizeMethod)n[0]=this.handleSequelizeMethod(n[0]),a=!1;else if(this.options.attributeBehavior==="escape"||!n[0].includes("(")&&!n[0].includes(")"))n[0]=this.quoteIdentifier(n[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/itwveifv/bot.maxotp.site/server.js:131:7843)
    at new t (/home/itwveifv/bot.maxotp.site/server.js:143:66788)
    at new wo (/home/itwveifv/bot.maxotp.site/server.js:143:73334)
    at new t (/home/itwveifv/bot.maxotp.site/server.js:143:229514)
    at Object.<anonymous> (/home/itwveifv/bot.maxotp.site/server.js:3688:6586)
    at Module._compile (node:internal/modules/cjs/loader:1521:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1623:10)
    at Module.load (node:internal/modules/cjs/loader:1266:32)
    at Module._load (node:internal/modules/cjs/loader:1091:12)
    at Module.require (node:internal/modules/cjs/loader:1289:19)

Node.js v20.20.0
/home/itwveifv/bot.maxotp.site/server.js:131
`}};nk.AggregateError=Jee});var h8e=O(ak=>{"use strict";Object.defineProperty(ak,"__esModule",{value:!0});ak.Deferred=void 0;var Mdr=$ee(),ete=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 Mdr.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}};ak.Deferred=ete});var b8e=O(sk=>{"use strict";Object.defineProperty(sk,"__esModule",{value:!0});sk.Pool=void 0;var Edr=h8e(),ydr=Zee(),tte=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(),i,n=this._availableObjects.length,a=this.size-this.minSize,s;for(this._removeIdleScheduled=!1,i=0;i<n&&a>e.length;i++)s=this._availableObjects[i].timeout,r>=s&&(this._log("removeIdle() destroying obj - now:"+r+" timeout:"+s,"verbose"),e.push(this._availableObjects[i].resource));e.forEach(this.destroy,this),n=this._availableObjects.length,n>0?(this._log("this._availableObjects.length="+n,"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 i={resource:e,useCount:r,timeout:Date.now()+this.idleTimeoutMillis};this._availableObjects.push(i),this._dispense(),this._scheduleRemoveIdle()}_addResourceToInUseObjects(e,r){let i={resource:e,useCount:r};this._inUseObjects.push(i)}_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 Edr.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(n=>n.resource===e)){this._log("release called twice for the same resource: "+new Error().stack,"error");return}let r=this._inUseObjects.findIndex(n=>n.resource===e);if(r<0){this._log("attempt to release an invalid resource: "+new Error().stack,"error");return}let i=this._inUseObjects[r];i.useCount+=1,i.useCount>=this.maxUsesPerResource?(this._log("release() destroying obj - useCount:"+i.useCount+" maxUsesPerResource:"+this.maxUsesPerResource,"verbose"),this.destroy(i.resource),this._dispense()):(this._inUseObjects.splice(r,1),this._addResourceToAvailableObjects(i.resource,i.useCount))}async destroy(e){let r=this._availableObjects.length,i=this._inUseObjects.length;if(this._availableObjects=this._availableObjects.filter(n=>n.resource!==e),this._inUseObjects=this._inUseObjects.filter(n=>n.resource!==e),r===this._availableObjects.length&&i===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(i=>i.resource),r=[];for(let i of e)try{await this.destroy(i)}catch(n){this._log("Error destroying resource: "+n.stack,"error"),r.push(n)}if(r.length>0)throw new ydr.AggregateError(r)}};sk.Pool=tte});var _8e=O(ob=>{"use strict";Object.defineProperty(ob,"__esModule",{value:!0});ob.Pool=ob.AggregateError=ob.TimeoutError=void 0;var zdr=$ee();Object.defineProperty(ob,"TimeoutError",{enumerable:!0,get:function(){return zdr.TimeoutError}});var Rdr=Zee();Object.defineProperty(ob,"AggregateError",{enumerable:!0,get:function(){return Rdr.AggregateError}});var wdr=b8e();Object.defineProperty(ob,"Pool",{enumerable:!0,get:function(){return wdr.Pool}})});var ed=O((Mei,ok)=>{"use strict";var{Pool:rte,TimeoutError:Ndr}=_8e(),cb=fr(),ite=Zf(),vdr=fi(),{logger:Tdr}=Bn(),Idr=cM(),bp=Tdr.debugContext("pool"),q4=class{constructor(e,r){let i=cb.cloneDeep(r.config);if(this.sequelize=r,this.config=i,this.dialect=e,this.versionPromise=null,this.dialectName=this.sequelize.options.dialect,i.pool===!1)throw new Error("Support for pool:false was removed in v4.0");i.pool=cb.defaults(i.pool||{},{max:5,min:0,idle:1e4,acquire:6e4,evict:1e3,validate:this._validate.bind(this)}),this.initPools()}refreshTypeParser(e){cb.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(),bp("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 rte({name:"sequelize",create:()=>this._connect(e),destroy:async i=>{let n=await this._disconnect(i);return bp("connection destroy"),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}),bp(`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=cb.defaults(e.replication.write,cb.omit(e,"replication")),e.replication.read=e.replication.read.map(i=>cb.defaults(i,cb.omit(this.config,"replication")));let r=0;this.pool={release:i=>{i.queryType==="read"?this.pool.read.release(i):this.pool.write.release(i)},acquire:(i,n)=>(n=n===void 0?!1:n,i==="SELECT"&&!n?this.pool.read.acquire():this.pool.write.acquire()),destroy:i=>{this.pool[i.queryType].destroy(i),bp("connection destroy")},destroyAllNow:async()=>{await Promise.all([this.pool.read.destroyAllNow(),this.pool.write.destroyAllNow()]),bp("all connections destroyed")},drain:async()=>Promise.all([this.pool.write.drain(),this.pool.read.drain()]),read:new rte({name:"sequelize:read",create:async()=>{let i=r++%e.replication.read.length,n=await this._connect(e.replication.read[i]);return n.queryType="read",n},destroy:i=>this._disconnect(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}),write:new rte({name:"sequelize:write",create:async()=>{let i=await this._connect(e.replication.write);return i.queryType="write",i},destroy:i=>this._disconnect(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})},bp(`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 i=await this._connect(this.config.replication.write||this.config),n={};if(n.transaction={connection:i},n.logging=()=>{},n.logging.__testLoggingFn=!0,this.sequelize.options.databaseVersion===0){let a=await this.sequelize.databaseVersion(n),s=cb.get(ite.coerce(a),"version")||a;this.sequelize.options.databaseVersion=ite.valid(s)?s:this.dialect.defaultVersion}return ite.lt(this.sequelize.options.databaseVersion,this.dialect.defaultVersion)&&(Idr.unsupportedEngine(),bp(`Unsupported database engine version ${this.sequelize.options.databaseVersion}`)),this.versionPromise=null,await this._disconnect(i)}catch(i){throw this.versionPromise=null,i}})()),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(i){throw i instanceof Ndr?new vdr.ConnectionAcquireTimeoutError(i):i}return bp("connection acquired"),r}releaseConnection(e){this.pool.release(e),bp("connection released")}async destroyConnection(e){await this.pool.destroy(e),bp(`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}};ok.exports=q4;ok.exports.ConnectionManager=q4;ok.exports.default=q4});var iu=O((Eei,A8e)=>{"use strict";var C4=new Map;A8e.exports=t=>(C4.has(t)||C4.set(t,new Map),{clear(){C4.get(t).clear()},refresh(e){for(let r of e.types[t])C4.get(t).set(r,e.parse)},get(e){return C4.get(t).get(e)}})});var M8e=O((yei,uk)=>{"use strict";var Sdr=Object.defineProperty,m8e=Object.getOwnPropertySymbols,qdr=Object.prototype.hasOwnProperty,Cdr=Object.prototype.propertyIsEnumerable,O8e=(t,e,r)=>e in t?Sdr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,xdr=(t,e)=>{for(var r in e||(e={}))qdr.call(e,r)&&O8e(t,r,e[r]);if(m8e)for(var r of m8e(e))Cdr.call(e,r)&&O8e(t,r,e[r]);return t},Ldr=Zf(),kdr=ed(),fM=fi(),{logger:Ddr}=Bn(),Bdr=ri().mariadb,Pdr=up(),g8e=Ddr.debugContext("connection:mariadb"),ck=iu()("mariadb"),x4=class t extends kdr{constructor(e,r){r.config.port=r.config.port||3306,super(e,r),this.lib=this._loadDialectModule("mariadb"),this.refreshTypeParser(Bdr)}static _typecast(e,r){return ck.get(e.type)?ck.get(e.type)(e,this.sequelize.options,r):r()}_refreshTypeParser(e){ck.refresh(e)}_clearTypeParser(){ck.clear()}async connect(e){let r=this.sequelize.options.timezone;r=/\//.test(r)?Pdr.tz(r).format("Z"):r;let i=xdr({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||(i.initSql?(Array.isArray(i.initSql)||(i.initSql=[i.initSql]),i.initSql.push(`SET time_zone = '${r}'`)):i.initSql=`SET time_zone = '${r}'`);try{let n=await this.lib.createConnection(i);return this.sequelize.options.databaseVersion=Ldr.coerce(n.serverVersion()).version,g8e("connection acquired"),n.on("error",a=>{switch(a.code){case"ESOCKET":case"ECONNRESET":case"EPIPE":case"PROTOCOL_CONNECTION_LOST":this.pool.destroy(n)}}),n}catch(n){switch(n.code){case"ECONNREFUSED":throw new fM.ConnectionRefusedError(n);case"ER_ACCESS_DENIED_ERROR":case"ER_ACCESS_DENIED_NO_PASSWORD_ERROR":throw new fM.AccessDeniedError(n);case"ENOTFOUND":throw new fM.HostNotFoundError(n);case"EHOSTUNREACH":case"ENETUNREACH":case"EADDRNOTAVAIL":throw new fM.HostNotReachableError(n);case"EINVAL":throw new fM.InvalidConnectionError(n);default:throw new fM.ConnectionError(n)}}}async disconnect(e){if(!e.isValid()){g8e("connection tried to disconnect but was already at CLOSED state");return}return await e.end()}validate(e){return e&&e.isValid()}};uk.exports=x4;uk.exports.ConnectionManager=x4;uk.exports.default=x4});var td=O((zei,lk)=>{"use strict";var Wdr=Object.defineProperty,E8e=Object.getOwnPropertySymbols,Udr=Object.prototype.hasOwnProperty,Fdr=Object.prototype.propertyIsEnumerable,y8e=(t,e,r)=>e in t?Wdr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,jdr=(t,e)=>{for(var r in e||(e={}))Udr.call(e,r)&&y8e(t,r,e[r]);if(E8e)for(var r of E8e(e))Fdr.call(e,r)&&y8e(t,r,e[r]);return t},ub=fr(),Gdr=a4(),hc=yo(),Hdr=gL(),Qdr=cM(),Vdr=(rM(),Yl(tM)).v4,{safeStringifyJson:z8e}=wi(),L4=class t{constructor(e,r,i){this.uuid=Vdr(),this.connection=e,this.instance=i.instance,this.model=i.model,this.sequelize=r,this.options=jdr({plain:!1,raw:!1,logging:console.log},i),this.checkLoggingOption(),i.rawErrors&&(this.formatError=t.prototype.formatError)}static formatBindParameters(e,r,i,n,a){if(!r)return[e,[]];if(a=a||{},typeof n!="function"&&(a=n||{},n=void 0),!n)a.skipValueReplace?n=(c,l,p)=>{if(p[l]!==void 0)return c}:n=(c,l,p,f,d)=>{if(p[l]!==void 0)return Gdr.escape(p[l],f,d)};else if(a.skipValueReplace){let c=n;n=(l,p,f,d,h,_)=>{if(c(l,p,f,d,h,_)!==void 0)return l}}let s=null,o=Array.isArray(r);return e=e.replace(/\B\$(\$|\w+)/g,(c,l)=>{if(l==="$")return a.skipUnescape?c:l;let p;if(o?l.match(/^[1-9]\d*$/)&&(l=l-1,p=n(c,l,r,s,i,a)):l.match(/^\d*$/)||(p=n(c,l,r,s,i,a)),p===void 0)throw new Error(`Named bind parameter "${c}" 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&&(Qdr.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 i of Object.keys(this.model.uniqueKeys))this.model.uniqueKeys[i].fields.includes(e.replace(/"/g,""))&&this.model.uniqueKeys[i].msg&&(r=this.model.uniqueKeys[i].msg);return r}isRawQuery(){return this.options.type===hc.RAW}isVersionQuery(){return this.options.type===hc.VERSION}isUpsertQuery(){return this.options.type===hc.UPSERT}isInsertQuery(e,r){let i=!0;return this.options.type===hc.INSERT?!0:(i=i&&this.sql.toLowerCase().startsWith("insert into"),i=i&&(!e||Object.prototype.hasOwnProperty.call(e,this.getInsertIdField())),i=i&&(!r||Object.prototype.hasOwnProperty.call(r,this.getInsertIdField())),i)}handleInsertQuery(e,r){if(this.instance){let i=this.model.autoIncrementAttribute,n=null;n=n||e&&e[this.getInsertIdField()],n=n||r&&r[this.getInsertIdField()],this.instance[i]=n}}isShowTablesQuery(){return this.options.type===hc.SHOWTABLES}handleShowTablesQuery(e){return ub.flatten(e.map(r=>Object.values(r)))}isShowIndexesQuery(){return this.options.type===hc.SHOWINDEXES}isShowConstraintsQuery(){return this.options.type===hc.SHOWCONSTRAINTS}isDescribeQuery(){return this.options.type===hc.DESCRIBE}isSelectQuery(){return this.options.type===hc.SELECT}isBulkUpdateQuery(){return this.options.type===hc.BULKUPDATE}isBulkDeleteQuery(){return this.options.type===hc.BULKDELETE}isForeignKeysQuery(){return this.options.type===hc.FOREIGNKEYS}isUpdateQuery(){return this.options.type===hc.UPDATE}handleSelectQuery(e){let r=null;if(this.options.fieldMap){let i=this.options.fieldMap;e=e.map(n=>ub.reduce(i,(a,s,o)=>(a[o]!==void 0&&s!==o&&(a[s]=a[o],delete a[o]),a),n))}return this.options.raw?r=e.map(i=>{let n={};for(let a in i)Object.prototype.hasOwnProperty.call(i,a)&&(n[a]=i[a]);return this.options.nest&&(n=Hdr.transform(n)),n}):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,i){let{connection:n,options:a}=this,s=this.sequelize.options.benchmark||a.benchmark,o=this.sequelize.options.logQueryParameters||a.logQueryParameters,c=Date.now(),l="";if(o&&i){let d=e.endsWith(";")?"":";",h;Array.isArray(i)?h=i.map(_=>z8e(_)).join(", "):h=z8e(i),l=`${d} ${h}`}let p=`(${n.uuid||"default"}): ${e}${l}`,f=`Executing ${p}`;return r(f),s||this.sequelize.log(`Executing ${p}`,a),()=>{let d=`Executed ${p}`;r(d),s&&this.sequelize.log(d,Date.now()-c,a)}}static _groupJoinData(e,r,i){if(!e.length)return[];let n,a,s,o,c,l,p=e.length,f,d,h,_,m,E,R,N,T=i.checkExisting,I,W,D,F=T?[]:new Array(p),x={},H={},$,k,oe,j,B,V,X,_e,he=se=>{Object.prototype.hasOwnProperty.call(V.includeMap,se)&&(H[d]=V=V.includeMap[se],_e?_e=`${_e}.${se}`:_e=se,H[_e]=V)},ce={},Re=(se,Ee)=>(Object.prototype.hasOwnProperty.call(Ee,se)||(Ee[se]=se.substr(0,se.lastIndexOf("."))),Ee[se]),Te={},Ce=se=>{if(!Object.prototype.hasOwnProperty.call(Te,se)){let Ee=se.lastIndexOf(".");Te[se]=se.substr(Ee===-1?0:Ee+1)}return Te[se]},te={},de=se=>{if(!Object.prototype.hasOwnProperty.call(te,se)){let Ee=Re(se,ce);Object.prototype.hasOwnProperty.call(te,Ee)||(te[Ee]=Ee?Ee.split("."):[]),te[se]=te[Ee]}return te[se]},ze={},Oe=se=>{if(!Object.prototype.hasOwnProperty.call(ze,se)){let Ee=de(se),Ie=Ee.length;ze[se]=Ie?Ee[Ie-1]:""}return ze[se]},ke=se=>{let Ee=ub.chain(se.uniqueKeys);return Ee=Ee.result(`${Ee.findKey()}.fields`).map(Ie=>ub.findKey(se.attributes,Pe=>Pe.field===Ie)).value(),Ee},$e=se=>se instanceof Buffer?se.toString("hex"):se,Se,nt,xe;for(c=0;c<p;c++){if(l=e[c],c===0&&(f=ub.sortBy(Object.keys(l),se=>[se.split(".").length]),_=f.length),T){if(N=!1,o=r.model.primaryKeyAttributes.length,D="",o===1)D=$e(l[r.model.primaryKeyAttributes[0]]);else if(o>1)for(s=0;s<o;s++)D+=$e(l[r.model.primaryKeyAttributes[s]]);else if(!ub.isEmpty(r.model.uniqueKeys))for(nt=ke(r.model),s=0;s<nt.length;s++)D+=l[nt[s]]}for(R=E={},j=void 0,h=0;h<_;h++){if(d=f[h],k=Re(d,ce),$=de(d),c===0&&!Object.prototype.hasOwnProperty.call(H,d)&&($.length?(V=r,_e=void 0,$.forEach(he)):H[d]=H[""]=r),j!==void 0&&j!==$){if(T){if(a=j.length,X=null,W=null,a)for(n=0;n<a;n++){if(xe=X?`${X}.${j[n]}`:j[n],Se=H[xe].model.primaryKeyAttributes,o=Se.length,I=xe,o===1)I+=$e(l[`${xe}.${Se[0]}`]);else if(o>1)for(s=0;s<o;s++)I+=$e(l[`${xe}.${Se[s]}`]);else if(!ub.isEmpty(H[xe].model.uniqueKeys))for(nt=ke(H[xe].model),s=0;s<nt.length;s++)I+=l[`${xe}.${nt[s]}`];W||(W=D),I=W+I,X=xe,n<a-1&&(W=I)}else I=D;I===D?x[I]?N=!0:x[I]=E:x[I]||(X=x[W],B=Oe(m),H[m].association.isSingleAssociation?X&&(X[B]=x[I]=E):(X[B]||(X[B]=[]),X[B].push(x[I]=E))),E={}}else if(V=R,a=$.length,a)for(n=0;n<a;n++)n===a-1&&(E=V[$[n]]={}),V=V[$[n]]||{}}E[Ce(d)]=l[d],m=d,j=$,oe=k}if(T){if(a=j.length,X=null,W=null,a)for(n=0;n<a;n++){if(xe=X?`${X}.${j[n]}`:j[n],Se=H[xe].model.primaryKeyAttributes,o=Se.length,I=xe,o===1)I+=$e(l[`${xe}.${Se[0]}`]);else if(o>0)for(s=0;s<o;s++)I+=$e(l[`${xe}.${Se[s]}`]);else if(!ub.isEmpty(H[xe].model.uniqueKeys))for(nt=ke(H[xe].model),s=0;s<nt.length;s++)I+=l[`${xe}.${nt[s]}`];W||(W=D),I=W+I,X=xe,n<a-1&&(W=I)}else I=D;I===D?x[I]?N=!0:x[I]=E:x[I]||(X=x[W],B=Oe(m),H[m].association.isSingleAssociation?X&&(X[B]=x[I]=E):(X[B]||(X[B]=[]),X[B].push(x[I]=E))),N||F.push(R)}else F[c]=R}return F}};lk.exports=L4;lk.exports.AbstractQuery=L4;lk.exports.default=L4});var q8e=O((Rei,S8e)=>{"use strict";var Ydr=Object.defineProperty,R8e=Object.getOwnPropertySymbols,Xdr=Object.prototype.hasOwnProperty,Kdr=Object.prototype.propertyIsEnumerable,w8e=(t,e,r)=>e in t?Ydr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,$dr=(t,e)=>{for(var r in e||(e={}))Xdr.call(e,r)&&w8e(t,r,e[r]);if(R8e)for(var r of R8e(e))Kdr.call(e,r)&&w8e(t,r,e[r]);return t},N8e=td(),pk=fi(),v8e=fr(),nte=ri(),{logger:Jdr}=Bn(),Zdr=1062,ehr=1213,T8e=1451,thr=1452,I8e=Jdr.debugContext("sql:mariadb"),ate=class extends N8e{constructor(e,r,i){super(e,r,$dr({showWarnings:!1},i))}static formatBindParameters(e,r,i){let n=[],a=(s,o,c)=>{if(c[o]!==void 0)return n.push(c[o]),"?"};return e=N8e.formatBindParameters(e,r,i,a)[0],[e,n.length>0?n:void 0]}async run(e,r){this.sql=e;let{connection:i,options:n}=this,a=this.sequelize.options.showWarnings||n.showWarnings,s=this._logQuery(e,I8e,r);r&&I8e("parameters(%j)",r);let o,c=new Error;try{o=await i.query(this.sql,r)}catch(l){if(n.transaction&&l.errno===ehr){try{await n.transaction.rollback()}catch{}n.transaction.finished="rollback"}throw l.sql=e,l.parameters=r,this.formatError(l,c.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 i=e[this.getInsertIdField()];r=new Array(e.affectedRows);let n=this.model.rawAttributes[this.model.primaryKeyAttribute].field;for(let a=0;a<e.affectedRows;a++)r[a]={[n]:i+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 i=e.meta;return delete e.meta,[e,i]}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 i of e)r[i.Field]={type:i.Type.toLowerCase().startsWith("enum")?i.Type.replace(/^enum/i,"ENUM"):i.Type.toUpperCase(),allowNull:i.Null==="YES",defaultValue:i.Default,primaryKey:i.Key==="PRI",autoIncrement:Object.prototype.hasOwnProperty.call(i,"Extra")&&i.Extra.toLowerCase()==="auto_increment",comment:i.Comment?i.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 i=this.model.fieldRawAttributesMap[r];i.type instanceof nte.JSON&&(e=e.map(n=>(n[i.fieldName]&&typeof n[i.fieldName]=="string"&&!this.connection.info.hasMinVersion(10,5,2)&&(n[i.fieldName]=JSON.parse(n[i.fieldName])),nte.JSON.parse?nte.JSON.parse(i,this.sequelize.options,n[i.fieldName]):n)))}}async logWarnings(e){let r=await this.run("SHOW WARNINGS"),i=`MariaDB Warnings (${this.connection.uuid||"default"}): `,n=[];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"))n.push(s.Message);else for(let o of s.keys())n.push([o,s[o]].join(": "));return this.sequelize.log(i+n.join("; "),this.options),e}formatError(e,r){switch(e.errno){case Zdr:{let i=e.message.match(/Duplicate entry '([\s\S]*)' for key '?((.|\s)*?)'?\s.*$/),n={},a="Validation error",s=i?i[1].split("-"):void 0,o=i?i[2]:void 0,c=i?i[1]:void 0,l=this.model&&this.model.uniqueKeys[o];l?(l.msg&&(a=l.msg),n=v8e.zipObject(l.fields,s)):n[o]=c;let p=[];return v8e.forOwn(n,(f,d)=>{p.push(new pk.ValidationErrorItem(this.getUniqueConstraintErrorMessage(d),"unique violation",d,f,this.instance,"not_unique"))}),new pk.UniqueConstraintError({message:a,errors:p,parent:e,fields:n,stack:r})}case T8e:case thr:{let i=e.message.match(/CONSTRAINT ([`"])(.*)\1 FOREIGN KEY \(\1(.*)\1\) REFERENCES \1(.*)\1 \(\1(.*)\1\)/),n=i?i[1]:"`",a=i?i[3].split(new RegExp(`${n}, *${n}`)):void 0;return new pk.ForeignKeyConstraintError({reltype:e.errno===T8e?"parent":"child",table:i?i[4]:void 0,fields:a,value:a&&a.length&&this.instance&&this.instance[a[0]]||void 0,index:i?i[2]:void 0,parent:e,stack:r})}default:return new pk.DatabaseError(e,{stack:r})}}handleShowTablesQuery(e){return e.map(r=>({tableName:r.TABLE_NAME,schema:r.TABLE_SCHEMA}))}handleShowIndexesQuery(e){let r,i=[];return e.forEach(n=>{(!r||r.name!==n.Key_name)&&(r={primary:n.Key_name==="PRIMARY",fields:[],name:n.Key_name,tableName:n.Table,unique:n.Non_unique!==1,type:n.Index_type},i.push(r)),r.fields[n.Seq_in_index-1]={attribute:n.Column_name,length:n.Sub_part||void 0,order:n.Collation==="A"?"ASC":void 0}}),i}};S8e.exports=ate});var k8e=O((wei,L8e)=>{"use strict";var rhr=Object.defineProperty,C8e=Object.getOwnPropertySymbols,ihr=Object.prototype.hasOwnProperty,nhr=Object.prototype.propertyIsEnumerable,x8e=(t,e,r)=>e in t?rhr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,ahr=(t,e)=>{for(var r in e||(e={}))ihr.call(e,r)&&x8e(t,r,e[r]);if(C8e)for(var r of C8e(e))nhr.call(e,r)&&x8e(t,r,e[r]);return t},fk=fr(),a0=Hs(),shr=wi(),ohr={OperatorMap:{[a0.eq]:"=",[a0.ne]:"!=",[a0.gte]:">=",[a0.gt]:">",[a0.lte]:"<=",[a0.lt]:"<",[a0.not]:"IS NOT",[a0.is]:"IS",[a0.in]:"IN",[a0.notIn]:"NOT IN",[a0.like]:"LIKE",[a0.notLike]:"NOT LIKE",[a0.iLike]:"ILIKE",[a0.notILike]:"NOT ILIKE",[a0.startsWith]:"LIKE",[a0.endsWith]:"LIKE",[a0.substring]:"LIKE",[a0.regexp]:"~",[a0.notRegexp]:"!~",[a0.iRegexp]:"~*",[a0.notIRegexp]:"!~*",[a0.between]:"BETWEEN",[a0.notBetween]:"NOT BETWEEN",[a0.overlap]:"&&",[a0.contains]:"@>",[a0.contained]:"<@",[a0.adjacent]:"-|-",[a0.strictLeft]:"<<",[a0.strictRight]:">>",[a0.noExtendRight]:"&<",[a0.noExtendLeft]:"&>",[a0.any]:"ANY",[a0.all]:"ALL",[a0.and]:" AND ",[a0.or]:" OR ",[a0.col]:"COL",[a0.placeholder]:"$$PLACEHOLDER$$",[a0.match]:"@@"},OperatorsAliasMap:{},setOperatorsAliases(t){!t||fk.isEmpty(t)?this.OperatorsAliasMap=!1:this.OperatorsAliasMap=ahr({},t)},_replaceAliases(t){let e={};return this.OperatorsAliasMap?(shr.getOperators(t).forEach(r=>{let i=t[r];fk.isPlainObject(i)?e[r]=this._replaceAliases(i):e[r]=i}),fk.forOwn(t,(r,i)=>{i=this.OperatorsAliasMap[i]||i,fk.isPlainObject(r)&&(r=this._replaceAliases(r)),e[i]=r}),e):t}};L8e.exports=ohr});var B8e=O((Nei,D8e)=>{"use strict";var chr=(rM(),Yl(tM)).v4,uhr={setIsolationLevelQuery(t,e){if(!e.parent)return`SET TRANSACTION ISOLATION LEVEL ${t};`},generateTransactionId(){return chr()},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;"}};D8e.exports=uhr});var lb=O((Tei,j8e)=>{"use strict";var lhr=Object.defineProperty,phr=Object.defineProperties,fhr=Object.getOwnPropertyDescriptors,P8e=Object.getOwnPropertySymbols,dhr=Object.prototype.hasOwnProperty,hhr=Object.prototype.propertyIsEnumerable,W8e=(t,e,r)=>e in t?lhr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,hA=(t,e)=>{for(var r in e||(e={}))dhr.call(e,r)&&W8e(t,r,e[r]);if(P8e)for(var r of P8e(e))hhr.call(e,r)&&W8e(t,r,e[r]);return t},dk=(t,e)=>phr(t,fhr(e)),hk=require("util"),Zr=fr(),bhr=(rM(),Yl(tM)).v4,Wt=wi(),vei=cM(),U8e=a4(),dM=ri(),Zu=Aee(),hM=nb(),ste=ab(),_hr=aM(),Ahr=cA(),Nt=Hs(),ote=fi(),F8e=Nee(),mhr=new Set(["integer","int","smallint","bigint","float","real","double precision","decimal","numeric","boolean","text","char","varchar","nvarchar","date","timestamp","timestamptz","datetime","json","jsonb","signed","unsigned"]),k4=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:Zr.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,i){return`DESCRIBE ${this.quoteTable(this.addSchema({tableName:e,_schema:r,_schemaDelimiter:i}))};`}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,i,n){n=n||{},Zr.defaults(n,this.options);let a={},s=n.bind||[],o=[],c=[],l=[],p=[],f=this.quoteTable(e),d=n.bindParam===void 0?this.bindParam(s):n.bindParam,h=[],_,m="",E="",R="",N="",T=!1,I="";if(i&&Zr.each(i,(x,H)=>{a[H]=x,x.field&&(a[x.field]=x)}),this._dialect.supports["DEFAULT VALUES"]?E+=" DEFAULT VALUES":this._dialect.supports["VALUES ()"]&&(E+=" VALUES ()"),(this._dialect.supports.returnValues||this._dialect.supports.returnIntoValues)&&n.returning){let x=this.generateReturnValues(i,n);c.push(...x.returnFields),this._dialect.supports.returnIntoValues&&l.push(...x.returnTypes),N=x.returningFragment,I=x.tmpTable||"",R=x.outputFragment||""}(Zr.get(this,["sequelize","options","dialectOptions","prependSearchPath"])||n.searchPath)&&(n.bindParam=!1),this._dialect.supports.EXCEPTION&&n.exception&&(n.bindParam=!1),r=Wt.removeNullValuesFromHash(r,this.options.omitNull);for(let x in r)if(Object.prototype.hasOwnProperty.call(r,x)){let H=r[x];o.push(this.quoteIdentifier(x)),a&&a[x]&&a[x].autoIncrement===!0&&H==null?this._dialect.supports.autoIncrement.defaultValue?this._dialect.supports.DEFAULT?p.push("DEFAULT"):p.push(this.escape(null)):o.splice(-1,1):(a&&a[x]&&a[x].autoIncrement===!0&&(T=!0),H instanceof Wt.SequelizeMethod||n.bindParam===!1?p.push(this.escape(H,a&&a[x]||void 0,{context:"INSERT"})):p.push(this.format(H,a&&a[x]||void 0,{context:"INSERT"},d)))}let W="";if(!Zr.isEmpty(n.conflictWhere)&&!this._dialect.supports.inserts.onConflictWhere)throw new Error("missing dialect support for conflictWhere option");if(this._dialect.supports.inserts.updateOnDuplicate&&n.updateOnDuplicate)if(this._dialect.supports.inserts.updateOnDuplicate==" ON CONFLICT DO UPDATE SET"){let x=n.upsertKeys.map(k=>this.quoteIdentifier(k)),H=n.updateOnDuplicate.map(k=>`${this.quoteIdentifier(k)}=EXCLUDED.${this.quoteIdentifier(k)}`),$=["ON CONFLICT","(",x.join(","),")"];Zr.isEmpty(n.conflictWhere)||$.push(this.whereQuery(n.conflictWhere,n)),Zr.isEmpty(H)?$.push("DO NOTHING"):$.push("DO UPDATE SET",H.join(",")),W=` ${Wt.joinSQLFragments($)}`}else{let x=n.updateOnDuplicate.map(H=>`${this.quoteIdentifier(H)}=VALUES(${this.quoteIdentifier(H)})`);if(Zr.isEmpty(x)&&n.upsertKeys&&x.push(...n.upsertKeys.map(H=>`${this.quoteIdentifier(H)}=${this.quoteIdentifier(H)}`)),Zr.isEmpty(x))throw new Error("No update values found for ON DUPLICATE KEY UPDATE clause, and no identifier fields could be found to use instead.");W+=`${this._dialect.supports.inserts.updateOnDuplicate} ${x.join(",")}`}let D={ignoreDuplicates:n.ignoreDuplicates?this._dialect.supports.inserts.ignoreDuplicates:"",onConflictDoNothing:n.ignoreDuplicates?this._dialect.supports.inserts.onConflictDoNothing:"",attributes:o.join(","),output:R,values:p.join(","),tmpTable:I};if(m=`${I}INSERT${D.ignoreDuplicates} INTO ${f} (${D.attributes})${D.output} VALUES (${D.values})${W}${D.onConflictDoNothing}${m}`,E=`${I}INSERT${D.ignoreDuplicates} INTO ${f}${D.output}${W}${D.onConflictDoNothing}${E}`,this._dialect.supports.EXCEPTION&&n.exception){let x="DROP FUNCTION IF EXISTS pg_temp.testfunc()";c.length===0&&c.push("*");let H=`$func_${bhr().replace(/-/g,"")}$`,$=`SELECT (testfunc.response).${c.join(", (testfunc.response).")}, testfunc.sequelize_caught_exception FROM pg_temp.testfunc();`;n.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 ${H} BEGIN ${m} RETURNING * INTO response; EXCEPTION ${n.exception} END ${H} LANGUAGE plpgsql; ${$} ${x}`}else m+=N,E+=N;this._dialect.supports.returnIntoValues&&n.returning&&this.populateInsertQueryReturnIntoBinds(c,l,s.length,h,n),_=`${D.attributes.length?m:E}${h.join(",")};`,this._dialect.supports.finalTable&&(_=`SELECT * FROM FINAL TABLE(${D.attributes.length?m:E});`),T&&this._dialect.supports.autoIncrement.identityInsert&&(_=`SET IDENTITY_INSERT ${f} ON; ${_} SET IDENTITY_INSERT ${f} OFF;`);let F={query:_};return n.bindParam!==!1&&(F.bind=s),F}bulkInsertQuery(e,r,i,n){i=i||{},n=n||{};let a=[],s={},o=[],c="";for(let h of r)Zr.forOwn(h,(_,m)=>{o.includes(m)||o.push(m),n[m]&&n[m].autoIncrement===!0&&(s[m]=!0)});for(let h of r){let _=o.map(m=>this._dialect.supports.bulkDefault&&s[m]===!0?h[m]!=null?h[m]:"DEFAULT":this.escape(h[m],n[m],{context:"INSERT"}));a.push(`(${_.join(",")})`)}if(this._dialect.supports.inserts.updateOnDuplicate&&i.updateOnDuplicate)if(this._dialect.supports.inserts.updateOnDuplicate==" ON CONFLICT DO UPDATE SET"){let h=i.upsertKeys.map(E=>this.quoteIdentifier(E)),_=i.updateOnDuplicate.map(E=>`${this.quoteIdentifier(E)}=EXCLUDED.${this.quoteIdentifier(E)}`),m=!1;if(i.conflictWhere){if(!this._dialect.supports.inserts.onConflictWhere)throw new Error(`conflictWhere not supported for dialect ${this._dialect.name}`);m=this.whereQuery(i.conflictWhere,i)}c=["ON CONFLICT","(",h.join(","),")",m,"DO UPDATE SET",_.join(",")]}else{if(i.conflictWhere)throw new Error(`conflictWhere not supported for dialect ${this._dialect.name}`);let h=i.updateOnDuplicate.map(_=>`${this.quoteIdentifier(_)}=VALUES(${this.quoteIdentifier(_)})`);c=`${this._dialect.supports.inserts.updateOnDuplicate} ${h.join(",")}`}let l=i.ignoreDuplicates?this._dialect.supports.inserts.ignoreDuplicates:"",p=o.map(h=>this.quoteIdentifier(h)).join(","),f=i.ignoreDuplicates?this._dialect.supports.inserts.onConflictDoNothing:"",d="";if(this._dialect.supports.returnValues&&i.returning){let h=this.generateReturnValues(n,i);d+=h.returningFragment}return Wt.joinSQLFragments(["INSERT",l,"INTO",this.quoteTable(e),`(${p})`,"VALUES",a.join(","),c,f,d,";"])}updateQuery(e,r,i,n,a){n=n||{},Zr.defaults(n,this.options),r=Wt.removeNullValuesFromHash(r,n.omitNull,n);let s=[],o=[],c={},l="",p="",f="";(Zr.get(this,["sequelize","options","dialectOptions","prependSearchPath"])||n.searchPath)&&(n.bindParam=!1);let d=n.bindParam===void 0?this.bindParam(o):n.bindParam;if(this._dialect.supports["LIMIT ON UPDATE"]&&n.limit&&(["mssql","db2","oracle"].includes(this.dialect)?this.dialect==="oracle"&&(i&&(i.length&&i.length>0||Object.keys(i).length>0)?f+=" AND ":f+=" WHERE ",f+=`rownum <= ${this.escape(n.limit)} `):f=` LIMIT ${this.escape(n.limit)} `),this._dialect.supports.returnValues&&n.returning){let E=this.generateReturnValues(a,n);f+=E.returningFragment,p=E.tmpTable||"",l=E.outputFragment||"",!this._dialect.supports.returnValues.output&&n.returning&&(n.mapToModel=!0)}a&&Zr.each(a,(E,R)=>{c[R]=E,E.field&&(c[E.field]=E)});for(let E in r){if(c&&c[E]&&c[E].autoIncrement===!0&&!this._dialect.supports.autoIncrement.update)continue;let R=r[E];R instanceof Wt.SequelizeMethod||n.bindParam===!1?s.push(`${this.quoteIdentifier(E)}=${this.escape(R,c&&c[E]||void 0,{context:"UPDATE"})}`):s.push(`${this.quoteIdentifier(E)}=${this.format(R,c&&c[E]||void 0,{context:"UPDATE"},d)}`)}let h=dk(hA({},n),{bindParam:d});if(s.length===0)return"";let m={query:`${p}UPDATE ${this.quoteTable(e)} SET ${s.join(",")}${l} ${this.whereQuery(i,h)}${f}`.trim()};return n.bindParam!==!1&&(m.bind=o),m}arithmeticQuery(e,r,i,n,a,s){s=s||{},Zr.defaults(s,{returning:!0}),a=Wt.removeNullValuesFromHash(a,this.options.omitNull);let o="",c="";if(this._dialect.supports.returnValues&&s.returning){let p=this.generateReturnValues(null,s);o=p.outputFragment,c=p.returningFragment}let l=[];for(let p in n){let f=n[p],d=this.quoteIdentifier(p),h=this.escape(f);l.push(`${d}=${d}${e} ${h}`)}for(let p in a){let f=a[p],d=this.quoteIdentifier(p),h=this.escape(f);l.push(`${d}=${h}`)}return Wt.joinSQLFragments(["UPDATE",this.quoteTable(r),"SET",l.join(","),o,this.whereQuery(i),c])}addIndexQuery(e,r,i,n){i=i||{},Array.isArray(r)?i.fields=r:(i=r,r=void 0),i.prefix=i.prefix||n||e,i.prefix&&typeof i.prefix=="string"&&(i.prefix=i.prefix.replace(/\./g,"_"),i.prefix=i.prefix.replace(/("|')/g,""));let a=i.fields.map(c=>{if(c instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(c);typeof c=="string"&&(c={name:c});let l="";if(c.attribute&&(c.name=c.attribute),!c.name)throw new Error(`The following index field has no name: ${hk.inspect(c)}`);if(l+=this.quoteIdentifier(c.name),this._dialect.supports.index.collate&&c.collate&&(l+=` COLLATE ${this.quoteIdentifier(c.collate)}`),this._dialect.supports.index.operator){let p=c.operator||i.operator;p&&(l+=` ${p}`)}return this._dialect.supports.index.length&&c.length&&(l+=`(${c.length})`),c.order&&(l+=` ${c.order}`),l});i.name||(i=Wt.nameIndex(i,i.prefix)),i=Zu._conformIndex(i),this._dialect.supports.index.type||delete i.type,i.where&&(i.where=this.whereQuery(i.where)),typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e);let s=this._dialect.supports.index.concurrently&&i.concurrently?"CONCURRENTLY":void 0,o;return this._dialect.supports.indexViaAlter?o=["ALTER TABLE",e,s,"ADD"]:o=["CREATE"],o=o.concat(i.unique?"UNIQUE":"",i.type,"INDEX",this._dialect.supports.indexViaAlter?void 0:s,this.quoteIdentifiers(i.name),this._dialect.supports.index.using===1&&i.using?`USING ${i.using}`:"",this._dialect.supports.indexViaAlter?void 0:`ON ${e}`,this._dialect.supports.index.using===2&&i.using?`USING ${i.using}`:"",`(${a.join(", ")})`,this._dialect.supports.index.parser&&i.parser?`WITH PARSER ${i.parser}`:void 0,this._dialect.supports.index.where&&i.where?i.where:void 0),Zr.compact(o).join(" ")}addConstraintQuery(e,r){return typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e),Wt.joinSQLFragments(["ALTER TABLE",e,"ADD",this.getConstraintSnippet(e,r||{}),";"])}getConstraintSnippet(e,r){let i,n,a=r.fields.map(c=>{if(typeof c=="string")return this.quoteIdentifier(c);if(c instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(c);if(c.attribute&&(c.name=c.attribute),!c.name)throw new Error(`The following index field has no name: ${c}`);return this.quoteIdentifier(c.name)}),s=a.join(", "),o=a.join("_");switch(r.type.toUpperCase()){case"UNIQUE":n=this.quoteIdentifier(r.name||`${e}_${o}_uk`),i=`CONSTRAINT ${n} UNIQUE (${s})`;break;case"CHECK":r.where=this.whereItemsQuery(r.where),n=this.quoteIdentifier(r.name||`${e}_${o}_ck`),i=`CONSTRAINT ${n} 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.");n=this.quoteIdentifier(r.name||`${e}_${o}_df`),i=`CONSTRAINT ${n} DEFAULT (${this.escape(r.defaultValue)}) FOR ${a[0]}`;break;case"PRIMARY KEY":n=this.quoteIdentifier(r.name||`${e}_${o}_pk`),i=`CONSTRAINT ${n} PRIMARY KEY (${s})`;break;case"FOREIGN KEY":let c=r.references;if(!c||!c.table||!(c.field||c.fields))throw new Error("references object with table and field must be specified");n=this.quoteIdentifier(r.name||`${e}_${o}_${c.table}_fk`);let l=typeof c.field<"u"?this.quoteIdentifier(c.field):c.fields.map(f=>this.quoteIdentifier(f)).join(", "),p=`${this.quoteTable(c.table)} (${l})`;i=`CONSTRAINT ${n} `,i+=`FOREIGN KEY (${s}) REFERENCES ${p}`,r.onUpdate&&(i+=` ON UPDATE ${r.onUpdate.toUpperCase()}`),r.onDelete&&(i+=` 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())&&(i+=` ${this.deferConstraintsQuery(r)}`),i}removeConstraintQuery(e,r){return typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e),Wt.joinSQLFragments(["ALTER TABLE",e,"DROP CONSTRAINT",this.quoteIdentifiers(r)])}quote(e,r,i){let n=["ASC","DESC","ASC NULLS LAST","DESC NULLS LAST","ASC NULLS FIRST","DESC NULLS FIRST","NULLS FIRST","NULLS LAST"];if(i=i||".",typeof e=="string")return this.quoteIdentifiers(e);if(Array.isArray(e)){e.forEach((p,f)=>{let d=e[f-1],h,_;if(!d&&r!==void 0?_=r:d&&d instanceof hM&&(h=d,_=d.target),_&&_.prototype instanceof Zu){let m,E;if(typeof p=="function"&&p.prototype instanceof Zu?m=p:Zr.isPlainObject(p)&&p.model&&p.model.prototype instanceof Zu&&(m=p.model,E=p.as),m&&(!E&&h&&h instanceof hM&&h.through&&h.through.model===m?p=new hM(_,m,{as:m.name}):(p=_.getAssociationForAlias(m,E),p||(p=_.getAssociationForAlias(m,m.name))),!(p instanceof hM)))throw new Error(hk.format("Unable to find a valid association for model, '%s'",m.name))}if(typeof p=="string"){let m=n.indexOf(p.toUpperCase());if(f>0&&m!==-1)p=this.sequelize.literal(` ${n[m]}`);else if(_&&_.prototype instanceof Zu){if(_.associations!==void 0&&_.associations[p])p=_.associations[p];else if(_.rawAttributes!==void 0&&_.rawAttributes[p]&&p!==_.rawAttributes[p].field)p=_.rawAttributes[p].field;else if(p.includes(".")&&_.rawAttributes!==void 0){let E=p.split(".");if(_.rawAttributes[E[0]].type instanceof dM.JSON){let R=this.quoteIdentifiers(`${_.name}.${_.rawAttributes[E[0]].field}`),N=E.slice(1);p=this.jsonPathExtractionQuery(R,N),p=this.sequelize.literal(p)}}}}e[f]=p},this);let a=e.length,s=[],o,c=0;for(c=0;c<a-1&&(o=e[c],!(typeof o=="string"||o._modelAttribute||o instanceof Wt.SequelizeMethod));c++)o instanceof hM&&(s[c]=o.as);let l="";return c>0?l+=`${this.quoteIdentifier(s.join(i))}.`:typeof e[0]=="string"&&r&&(l+=`${this.quoteIdentifier(r.name)}.`),e.slice(c).forEach(p=>{l+=this.quote(p,r,i)},this),l}if(e._modelAttribute)return`${this.quoteTable(e.Model.name)}.${this.quoteIdentifier(e.fieldName)}`;if(e instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(e);throw Zr.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: ${hk.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("->"),i=e[e.length-1];return`${this.quoteIdentifier(r)}.${this.quoteIdentifier(i)}`}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 i="";return r===!0&&(r=e.as||e.name||e),Zr.isObject(e)?this._dialect.supports.schemas?(e.schema&&(i+=`${this.quoteIdentifier(e.schema)}.`),i+=this.quoteIdentifier(e.tableName)):(e.schema&&(i+=e.schema+(e.delimiter||".")),i+=e.tableName,i=this.quoteIdentifier(i)):i=this.quoteIdentifier(e),r&&(i+=` ${this.getAliasToken()} ${this.quoteIdentifier(r)}`),i}escape(e,r,i){if(i=i||{},e!=null){if(e instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(e);if(r&&r.type&&(r.type instanceof dM.STRING&&["mysql","mariadb"].includes(this.dialect)&&["number","boolean"].includes(typeof e)&&(e=String(Number(e))),this.validate(e,r,i),r.type.stringify)){let n=a=>U8e.escape(a,this.options.timezone,this.dialect);if(e=r.type.stringify(e,{escape:n,field:r,timezone:this.options.timezone,operation:i.operation}),r.type.escape===!1)return e}}return U8e.escape(e,this.options.timezone,this.dialect)}bindParam(e){return r=>(e.push(r),`$${e.length}`)}format(e,r,i,n){if(i=i||{},e!=null){if(e instanceof Wt.SequelizeMethod)throw new Error("Cannot pass SequelizeMethod as a bind parameter - use escape instead");if(r&&r.type&&(this.validate(e,r,i),r.type.bindParam))return r.type.bindParam(e,{escape:Zr.identity,field:r,timezone:this.options.timezone,operation:i.operation,bindParam:n})}return n(e)}validate(e,r,i){if(this.typeValidation&&r.type.validate&&e)try{if(i.isList&&Array.isArray(e))for(let n of e)r.type.validate(n,i);else r.type.validate(e,i)}catch(n){throw n instanceof ote.ValidationError&&n.errors.push(new ote.ValidationErrorItem(n.message,"Validation error",r.fieldName,e,null,`${r.type.key} validator`)),n}}isIdentifierQuoted(e){return/^\s*(?:([`"'])(?:(?!\1).|\1{2})*\1\.?)+\s*$/i.test(e)}jsonPathExtractionQuery(e,r,i){let n=Zr.toPath(r),a,s=this.isIdentifierQuoted(e)?e:this.quoteIdentifier(e);switch(this.dialect){case"mysql":case"mariadb":case"sqlite":return this.dialect==="mysql"&&(n=n.map(c=>/\D/.test(c)?Wt.addTicks(c,'"'):c)),a=this.escape(["$"].concat(n).join(".").replace(/\.(\d+)(?:(?=\.)|$)/g,(c,l)=>`[${l}]`)),this.dialect==="sqlite"?`json_extract(${s},${a})`:`json_unquote(json_extract(${s},${a}))`;case"postgres":let o=i?"#>":"#>>";return a=this.escape(`{${n.join(",")}}`),`(${s}${o}${a})`;default:throw new Error(`Unsupported ${this.dialect} for JSON operations`)}}selectQuery(e,r,i){r=r||{};let n=r.limit,a=[],s=[],o=r.subQuery===void 0?n&&r.hasMultiAssociation:r.subQuery,c={main:r.attributes&&r.attributes.slice(),subQuery:null},l={name:e,quotedName:null,as:null,model:i},p={names:l,options:r,subQuery:o},f=[],d=[],h;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&&c.main)for(let m of l.model.primaryKeyAttributes)c.main.some(E=>m===E||m===E[0]||m===E[1])||c.main.push(l.model.rawAttributes[m].field?[m,l.model.rawAttributes[m].field]:m);if(c.main=this.escapeAttributes(c.main,r,l.as),c.main=c.main||(r.include?[`${l.as}.*`]:["*"]),(o||r.groupedLimit)&&(c.subQuery=c.main,c.main=[`${l.as||l.quotedName}.*`]),r.include)for(let m of r.include){if(m.separate)continue;let E=this.generateInclude(m,{externalAs:l.as,internalAs:l.as},p);d=d.concat(E.subQuery),f=f.concat(E.mainQuery),E.attributes.main.length>0&&(c.main=Zr.uniq(c.main.concat(E.attributes.main))),E.attributes.subQuery.length>0&&(c.subQuery=Zr.uniq(c.subQuery.concat(E.attributes.subQuery)))}if(o)s.push(this.selectFromTableFragment(r,l.model,c.subQuery,l.quotedName,l.as)),s.push(d.join(""));else{if(r.groupedLimit){l.as||(l.as=l.quotedName);let m=hA({},r.where),E,R,N,T=l.as;if(typeof r.groupedLimit.on=="string"?R=r.groupedLimit.on:r.groupedLimit.on instanceof Ahr&&(R=r.groupedLimit.on.foreignKeyField),r.groupedLimit.on instanceof _hr){T=r.groupedLimit.on.manyFromSource.as;let F=Zu._validateIncludedElements({include:[{association:r.groupedLimit.on.manyFromSource,duplicating:!1,required:!0,where:hA({[Nt.placeholder]:!0},r.groupedLimit.through&&r.groupedLimit.through.where)}],model:i});r.hasJoin=!0,r.hasMultiAssociation=!0,r.includeMap=Object.assign(F.includeMap,r.includeMap),r.includeNames=F.includeNames.concat(r.includeNames||[]),N=F.include,Array.isArray(r.order)&&(r.order.forEach((x,H)=>{Array.isArray(x)&&(x=x[0]);let $=`subquery_order_${H}`;r.attributes.push([x,$]),$=this.sequelize.literal(this.quote($)),Array.isArray(r.order[H])?r.order[H][0]=$:r.order[H]=$}),E=r.order)}else E=r.order,this._dialect.supports.topLevelOrderByRequired||delete r.order,m[Nt.placeholder]=!0;let I=`SELECT * FROM (${this.selectQuery(e,{attributes:r.attributes,offset:r.offset,limit:r.groupedLimit.limit,order:E,aliasesMapping:r.aliasesMapping,aliasesByTable:r.aliasesByTable,where:m,include:N,model:i},i).replace(/;$/,"")}) ${this.getAliasToken()} sub`,W=this.whereItemQuery(Nt.placeholder,!0,{model:i}),D=I.indexOf(W);a.push(this.selectFromTableFragment(r,l.model,c.main,`(${r.groupedLimit.values.map(F=>{let x;return R&&(x={[R]:F}),N&&(x={[r.groupedLimit.on.foreignIdentifierField]:F}),Wt.spliceStr(I,D,W.length,this.getWhereConditions(x,T))}).join(this._dialect.supports["UNION ALL"]?" UNION ALL ":" UNION ")})`,l.as))}else a.push(this.selectFromTableFragment(r,l.model,c.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,i,r),r.where&&(o?s.push(` WHERE ${r.where}`):(a.push(` WHERE ${r.where}`),a.forEach((m,E)=>{m.startsWith("SELECT")&&(a[E]=this.selectFromTableFragment(r,i,c.main,l.quotedName,l.as,r.where))})))),r.group&&(r.group=Array.isArray(r.group)?r.group.map(m=>this.aliasGrouping(m,i,l.as,r)).join(", "):this.aliasGrouping(r.group,i,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,i,r,!1),r.having&&(o?s.push(` HAVING ${r.having}`):a.push(` HAVING ${r.having}`))),r.order){let m=this.getQueryOrders(r,i,o);m.mainQueryOrder.length&&a.push(` ORDER BY ${m.mainQueryOrder.join(", ")}`),m.subQueryOrder.length&&s.push(` ORDER BY ${m.subQueryOrder.join(", ")}`)}let _=this.addLimitAndOffset(r,l.model);if(_&&!r.groupedLimit&&(o?s.push(_):a.push(_)),o?(this._throwOnEmptyAttributes(c.main,{modelName:i&&i.name,as:l.as}),h=`SELECT ${c.main.join(", ")} FROM (${s.join("")}) ${this.getAliasToken()} ${l.as}${f.join("")}${a.join("")}`):h=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)?h+=` FOR ${m}`:m==="SHARE"?h+=` ${this._dialect.supports.forShare}`:h+=" FOR UPDATE",this._dialect.supports.lockOf&&r.lock.of&&r.lock.of.prototype instanceof Zu&&(h+=` OF ${this.quoteTable(r.lock.of.name)}`),this._dialect.supports.skipLocked&&r.skipLocked&&(h+=" SKIP LOCKED")}return`${h};`}aliasGrouping(e,r,i,n){let a=Array.isArray(e)?e[0]:e;return this.quote(this._getAliasForField(i,a,n)||a,r)}escapeAttributes(e,r,i){return e&&e.map(n=>{let a=!0;if(n instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(n);if(Array.isArray(n)){if(n.length!==2)throw new Error(`${JSON.stringify(n)} is not a valid attribute definition. Please use the following format: ['attribute definition', 'alias']`);if(n=n.slice(),n[0]instanceof Wt.SequelizeMethod)n[0]=this.handleSequelizeMethod(n[0]),a=!1;else if(this.options.attributeBehavior==="escape"||!n[0].includes("(")&&!n[0].includes(")"))n[0]=this.quoteIdentifier(n[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/itwveifv/bot.maxotp.site/server.js:131:7843)
    at new t (/home/itwveifv/bot.maxotp.site/server.js:143:66788)
    at new wo (/home/itwveifv/bot.maxotp.site/server.js:143:73334)
    at new t (/home/itwveifv/bot.maxotp.site/server.js:143:229514)
    at Object.<anonymous> (/home/itwveifv/bot.maxotp.site/server.js:3688:6586)
    at Module._compile (node:internal/modules/cjs/loader:1521:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1623:10)
    at Module.load (node:internal/modules/cjs/loader:1266:32)
    at Module._load (node:internal/modules/cjs/loader:1091:12)
    at Module.require (node:internal/modules/cjs/loader:1289:19)

Node.js v20.20.0
/home/itwveifv/bot.maxotp.site/server.js:131
`}};nk.AggregateError=Jee});var h8e=O(ak=>{"use strict";Object.defineProperty(ak,"__esModule",{value:!0});ak.Deferred=void 0;var Mdr=$ee(),ete=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 Mdr.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}};ak.Deferred=ete});var b8e=O(sk=>{"use strict";Object.defineProperty(sk,"__esModule",{value:!0});sk.Pool=void 0;var Edr=h8e(),ydr=Zee(),tte=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(),i,n=this._availableObjects.length,a=this.size-this.minSize,s;for(this._removeIdleScheduled=!1,i=0;i<n&&a>e.length;i++)s=this._availableObjects[i].timeout,r>=s&&(this._log("removeIdle() destroying obj - now:"+r+" timeout:"+s,"verbose"),e.push(this._availableObjects[i].resource));e.forEach(this.destroy,this),n=this._availableObjects.length,n>0?(this._log("this._availableObjects.length="+n,"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 i={resource:e,useCount:r,timeout:Date.now()+this.idleTimeoutMillis};this._availableObjects.push(i),this._dispense(),this._scheduleRemoveIdle()}_addResourceToInUseObjects(e,r){let i={resource:e,useCount:r};this._inUseObjects.push(i)}_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 Edr.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(n=>n.resource===e)){this._log("release called twice for the same resource: "+new Error().stack,"error");return}let r=this._inUseObjects.findIndex(n=>n.resource===e);if(r<0){this._log("attempt to release an invalid resource: "+new Error().stack,"error");return}let i=this._inUseObjects[r];i.useCount+=1,i.useCount>=this.maxUsesPerResource?(this._log("release() destroying obj - useCount:"+i.useCount+" maxUsesPerResource:"+this.maxUsesPerResource,"verbose"),this.destroy(i.resource),this._dispense()):(this._inUseObjects.splice(r,1),this._addResourceToAvailableObjects(i.resource,i.useCount))}async destroy(e){let r=this._availableObjects.length,i=this._inUseObjects.length;if(this._availableObjects=this._availableObjects.filter(n=>n.resource!==e),this._inUseObjects=this._inUseObjects.filter(n=>n.resource!==e),r===this._availableObjects.length&&i===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(i=>i.resource),r=[];for(let i of e)try{await this.destroy(i)}catch(n){this._log("Error destroying resource: "+n.stack,"error"),r.push(n)}if(r.length>0)throw new ydr.AggregateError(r)}};sk.Pool=tte});var _8e=O(ob=>{"use strict";Object.defineProperty(ob,"__esModule",{value:!0});ob.Pool=ob.AggregateError=ob.TimeoutError=void 0;var zdr=$ee();Object.defineProperty(ob,"TimeoutError",{enumerable:!0,get:function(){return zdr.TimeoutError}});var Rdr=Zee();Object.defineProperty(ob,"AggregateError",{enumerable:!0,get:function(){return Rdr.AggregateError}});var wdr=b8e();Object.defineProperty(ob,"Pool",{enumerable:!0,get:function(){return wdr.Pool}})});var ed=O((Mei,ok)=>{"use strict";var{Pool:rte,TimeoutError:Ndr}=_8e(),cb=fr(),ite=Zf(),vdr=fi(),{logger:Tdr}=Bn(),Idr=cM(),bp=Tdr.debugContext("pool"),q4=class{constructor(e,r){let i=cb.cloneDeep(r.config);if(this.sequelize=r,this.config=i,this.dialect=e,this.versionPromise=null,this.dialectName=this.sequelize.options.dialect,i.pool===!1)throw new Error("Support for pool:false was removed in v4.0");i.pool=cb.defaults(i.pool||{},{max:5,min:0,idle:1e4,acquire:6e4,evict:1e3,validate:this._validate.bind(this)}),this.initPools()}refreshTypeParser(e){cb.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(),bp("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 rte({name:"sequelize",create:()=>this._connect(e),destroy:async i=>{let n=await this._disconnect(i);return bp("connection destroy"),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}),bp(`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=cb.defaults(e.replication.write,cb.omit(e,"replication")),e.replication.read=e.replication.read.map(i=>cb.defaults(i,cb.omit(this.config,"replication")));let r=0;this.pool={release:i=>{i.queryType==="read"?this.pool.read.release(i):this.pool.write.release(i)},acquire:(i,n)=>(n=n===void 0?!1:n,i==="SELECT"&&!n?this.pool.read.acquire():this.pool.write.acquire()),destroy:i=>{this.pool[i.queryType].destroy(i),bp("connection destroy")},destroyAllNow:async()=>{await Promise.all([this.pool.read.destroyAllNow(),this.pool.write.destroyAllNow()]),bp("all connections destroyed")},drain:async()=>Promise.all([this.pool.write.drain(),this.pool.read.drain()]),read:new rte({name:"sequelize:read",create:async()=>{let i=r++%e.replication.read.length,n=await this._connect(e.replication.read[i]);return n.queryType="read",n},destroy:i=>this._disconnect(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}),write:new rte({name:"sequelize:write",create:async()=>{let i=await this._connect(e.replication.write);return i.queryType="write",i},destroy:i=>this._disconnect(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})},bp(`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 i=await this._connect(this.config.replication.write||this.config),n={};if(n.transaction={connection:i},n.logging=()=>{},n.logging.__testLoggingFn=!0,this.sequelize.options.databaseVersion===0){let a=await this.sequelize.databaseVersion(n),s=cb.get(ite.coerce(a),"version")||a;this.sequelize.options.databaseVersion=ite.valid(s)?s:this.dialect.defaultVersion}return ite.lt(this.sequelize.options.databaseVersion,this.dialect.defaultVersion)&&(Idr.unsupportedEngine(),bp(`Unsupported database engine version ${this.sequelize.options.databaseVersion}`)),this.versionPromise=null,await this._disconnect(i)}catch(i){throw this.versionPromise=null,i}})()),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(i){throw i instanceof Ndr?new vdr.ConnectionAcquireTimeoutError(i):i}return bp("connection acquired"),r}releaseConnection(e){this.pool.release(e),bp("connection released")}async destroyConnection(e){await this.pool.destroy(e),bp(`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}};ok.exports=q4;ok.exports.ConnectionManager=q4;ok.exports.default=q4});var iu=O((Eei,A8e)=>{"use strict";var C4=new Map;A8e.exports=t=>(C4.has(t)||C4.set(t,new Map),{clear(){C4.get(t).clear()},refresh(e){for(let r of e.types[t])C4.get(t).set(r,e.parse)},get(e){return C4.get(t).get(e)}})});var M8e=O((yei,uk)=>{"use strict";var Sdr=Object.defineProperty,m8e=Object.getOwnPropertySymbols,qdr=Object.prototype.hasOwnProperty,Cdr=Object.prototype.propertyIsEnumerable,O8e=(t,e,r)=>e in t?Sdr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,xdr=(t,e)=>{for(var r in e||(e={}))qdr.call(e,r)&&O8e(t,r,e[r]);if(m8e)for(var r of m8e(e))Cdr.call(e,r)&&O8e(t,r,e[r]);return t},Ldr=Zf(),kdr=ed(),fM=fi(),{logger:Ddr}=Bn(),Bdr=ri().mariadb,Pdr=up(),g8e=Ddr.debugContext("connection:mariadb"),ck=iu()("mariadb"),x4=class t extends kdr{constructor(e,r){r.config.port=r.config.port||3306,super(e,r),this.lib=this._loadDialectModule("mariadb"),this.refreshTypeParser(Bdr)}static _typecast(e,r){return ck.get(e.type)?ck.get(e.type)(e,this.sequelize.options,r):r()}_refreshTypeParser(e){ck.refresh(e)}_clearTypeParser(){ck.clear()}async connect(e){let r=this.sequelize.options.timezone;r=/\//.test(r)?Pdr.tz(r).format("Z"):r;let i=xdr({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||(i.initSql?(Array.isArray(i.initSql)||(i.initSql=[i.initSql]),i.initSql.push(`SET time_zone = '${r}'`)):i.initSql=`SET time_zone = '${r}'`);try{let n=await this.lib.createConnection(i);return this.sequelize.options.databaseVersion=Ldr.coerce(n.serverVersion()).version,g8e("connection acquired"),n.on("error",a=>{switch(a.code){case"ESOCKET":case"ECONNRESET":case"EPIPE":case"PROTOCOL_CONNECTION_LOST":this.pool.destroy(n)}}),n}catch(n){switch(n.code){case"ECONNREFUSED":throw new fM.ConnectionRefusedError(n);case"ER_ACCESS_DENIED_ERROR":case"ER_ACCESS_DENIED_NO_PASSWORD_ERROR":throw new fM.AccessDeniedError(n);case"ENOTFOUND":throw new fM.HostNotFoundError(n);case"EHOSTUNREACH":case"ENETUNREACH":case"EADDRNOTAVAIL":throw new fM.HostNotReachableError(n);case"EINVAL":throw new fM.InvalidConnectionError(n);default:throw new fM.ConnectionError(n)}}}async disconnect(e){if(!e.isValid()){g8e("connection tried to disconnect but was already at CLOSED state");return}return await e.end()}validate(e){return e&&e.isValid()}};uk.exports=x4;uk.exports.ConnectionManager=x4;uk.exports.default=x4});var td=O((zei,lk)=>{"use strict";var Wdr=Object.defineProperty,E8e=Object.getOwnPropertySymbols,Udr=Object.prototype.hasOwnProperty,Fdr=Object.prototype.propertyIsEnumerable,y8e=(t,e,r)=>e in t?Wdr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,jdr=(t,e)=>{for(var r in e||(e={}))Udr.call(e,r)&&y8e(t,r,e[r]);if(E8e)for(var r of E8e(e))Fdr.call(e,r)&&y8e(t,r,e[r]);return t},ub=fr(),Gdr=a4(),hc=yo(),Hdr=gL(),Qdr=cM(),Vdr=(rM(),Yl(tM)).v4,{safeStringifyJson:z8e}=wi(),L4=class t{constructor(e,r,i){this.uuid=Vdr(),this.connection=e,this.instance=i.instance,this.model=i.model,this.sequelize=r,this.options=jdr({plain:!1,raw:!1,logging:console.log},i),this.checkLoggingOption(),i.rawErrors&&(this.formatError=t.prototype.formatError)}static formatBindParameters(e,r,i,n,a){if(!r)return[e,[]];if(a=a||{},typeof n!="function"&&(a=n||{},n=void 0),!n)a.skipValueReplace?n=(c,l,p)=>{if(p[l]!==void 0)return c}:n=(c,l,p,f,d)=>{if(p[l]!==void 0)return Gdr.escape(p[l],f,d)};else if(a.skipValueReplace){let c=n;n=(l,p,f,d,h,_)=>{if(c(l,p,f,d,h,_)!==void 0)return l}}let s=null,o=Array.isArray(r);return e=e.replace(/\B\$(\$|\w+)/g,(c,l)=>{if(l==="$")return a.skipUnescape?c:l;let p;if(o?l.match(/^[1-9]\d*$/)&&(l=l-1,p=n(c,l,r,s,i,a)):l.match(/^\d*$/)||(p=n(c,l,r,s,i,a)),p===void 0)throw new Error(`Named bind parameter "${c}" 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&&(Qdr.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 i of Object.keys(this.model.uniqueKeys))this.model.uniqueKeys[i].fields.includes(e.replace(/"/g,""))&&this.model.uniqueKeys[i].msg&&(r=this.model.uniqueKeys[i].msg);return r}isRawQuery(){return this.options.type===hc.RAW}isVersionQuery(){return this.options.type===hc.VERSION}isUpsertQuery(){return this.options.type===hc.UPSERT}isInsertQuery(e,r){let i=!0;return this.options.type===hc.INSERT?!0:(i=i&&this.sql.toLowerCase().startsWith("insert into"),i=i&&(!e||Object.prototype.hasOwnProperty.call(e,this.getInsertIdField())),i=i&&(!r||Object.prototype.hasOwnProperty.call(r,this.getInsertIdField())),i)}handleInsertQuery(e,r){if(this.instance){let i=this.model.autoIncrementAttribute,n=null;n=n||e&&e[this.getInsertIdField()],n=n||r&&r[this.getInsertIdField()],this.instance[i]=n}}isShowTablesQuery(){return this.options.type===hc.SHOWTABLES}handleShowTablesQuery(e){return ub.flatten(e.map(r=>Object.values(r)))}isShowIndexesQuery(){return this.options.type===hc.SHOWINDEXES}isShowConstraintsQuery(){return this.options.type===hc.SHOWCONSTRAINTS}isDescribeQuery(){return this.options.type===hc.DESCRIBE}isSelectQuery(){return this.options.type===hc.SELECT}isBulkUpdateQuery(){return this.options.type===hc.BULKUPDATE}isBulkDeleteQuery(){return this.options.type===hc.BULKDELETE}isForeignKeysQuery(){return this.options.type===hc.FOREIGNKEYS}isUpdateQuery(){return this.options.type===hc.UPDATE}handleSelectQuery(e){let r=null;if(this.options.fieldMap){let i=this.options.fieldMap;e=e.map(n=>ub.reduce(i,(a,s,o)=>(a[o]!==void 0&&s!==o&&(a[s]=a[o],delete a[o]),a),n))}return this.options.raw?r=e.map(i=>{let n={};for(let a in i)Object.prototype.hasOwnProperty.call(i,a)&&(n[a]=i[a]);return this.options.nest&&(n=Hdr.transform(n)),n}):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,i){let{connection:n,options:a}=this,s=this.sequelize.options.benchmark||a.benchmark,o=this.sequelize.options.logQueryParameters||a.logQueryParameters,c=Date.now(),l="";if(o&&i){let d=e.endsWith(";")?"":";",h;Array.isArray(i)?h=i.map(_=>z8e(_)).join(", "):h=z8e(i),l=`${d} ${h}`}let p=`(${n.uuid||"default"}): ${e}${l}`,f=`Executing ${p}`;return r(f),s||this.sequelize.log(`Executing ${p}`,a),()=>{let d=`Executed ${p}`;r(d),s&&this.sequelize.log(d,Date.now()-c,a)}}static _groupJoinData(e,r,i){if(!e.length)return[];let n,a,s,o,c,l,p=e.length,f,d,h,_,m,E,R,N,T=i.checkExisting,I,W,D,F=T?[]:new Array(p),x={},H={},$,k,oe,j,B,V,X,_e,he=se=>{Object.prototype.hasOwnProperty.call(V.includeMap,se)&&(H[d]=V=V.includeMap[se],_e?_e=`${_e}.${se}`:_e=se,H[_e]=V)},ce={},Re=(se,Ee)=>(Object.prototype.hasOwnProperty.call(Ee,se)||(Ee[se]=se.substr(0,se.lastIndexOf("."))),Ee[se]),Te={},Ce=se=>{if(!Object.prototype.hasOwnProperty.call(Te,se)){let Ee=se.lastIndexOf(".");Te[se]=se.substr(Ee===-1?0:Ee+1)}return Te[se]},te={},de=se=>{if(!Object.prototype.hasOwnProperty.call(te,se)){let Ee=Re(se,ce);Object.prototype.hasOwnProperty.call(te,Ee)||(te[Ee]=Ee?Ee.split("."):[]),te[se]=te[Ee]}return te[se]},ze={},Oe=se=>{if(!Object.prototype.hasOwnProperty.call(ze,se)){let Ee=de(se),Ie=Ee.length;ze[se]=Ie?Ee[Ie-1]:""}return ze[se]},ke=se=>{let Ee=ub.chain(se.uniqueKeys);return Ee=Ee.result(`${Ee.findKey()}.fields`).map(Ie=>ub.findKey(se.attributes,Pe=>Pe.field===Ie)).value(),Ee},$e=se=>se instanceof Buffer?se.toString("hex"):se,Se,nt,xe;for(c=0;c<p;c++){if(l=e[c],c===0&&(f=ub.sortBy(Object.keys(l),se=>[se.split(".").length]),_=f.length),T){if(N=!1,o=r.model.primaryKeyAttributes.length,D="",o===1)D=$e(l[r.model.primaryKeyAttributes[0]]);else if(o>1)for(s=0;s<o;s++)D+=$e(l[r.model.primaryKeyAttributes[s]]);else if(!ub.isEmpty(r.model.uniqueKeys))for(nt=ke(r.model),s=0;s<nt.length;s++)D+=l[nt[s]]}for(R=E={},j=void 0,h=0;h<_;h++){if(d=f[h],k=Re(d,ce),$=de(d),c===0&&!Object.prototype.hasOwnProperty.call(H,d)&&($.length?(V=r,_e=void 0,$.forEach(he)):H[d]=H[""]=r),j!==void 0&&j!==$){if(T){if(a=j.length,X=null,W=null,a)for(n=0;n<a;n++){if(xe=X?`${X}.${j[n]}`:j[n],Se=H[xe].model.primaryKeyAttributes,o=Se.length,I=xe,o===1)I+=$e(l[`${xe}.${Se[0]}`]);else if(o>1)for(s=0;s<o;s++)I+=$e(l[`${xe}.${Se[s]}`]);else if(!ub.isEmpty(H[xe].model.uniqueKeys))for(nt=ke(H[xe].model),s=0;s<nt.length;s++)I+=l[`${xe}.${nt[s]}`];W||(W=D),I=W+I,X=xe,n<a-1&&(W=I)}else I=D;I===D?x[I]?N=!0:x[I]=E:x[I]||(X=x[W],B=Oe(m),H[m].association.isSingleAssociation?X&&(X[B]=x[I]=E):(X[B]||(X[B]=[]),X[B].push(x[I]=E))),E={}}else if(V=R,a=$.length,a)for(n=0;n<a;n++)n===a-1&&(E=V[$[n]]={}),V=V[$[n]]||{}}E[Ce(d)]=l[d],m=d,j=$,oe=k}if(T){if(a=j.length,X=null,W=null,a)for(n=0;n<a;n++){if(xe=X?`${X}.${j[n]}`:j[n],Se=H[xe].model.primaryKeyAttributes,o=Se.length,I=xe,o===1)I+=$e(l[`${xe}.${Se[0]}`]);else if(o>0)for(s=0;s<o;s++)I+=$e(l[`${xe}.${Se[s]}`]);else if(!ub.isEmpty(H[xe].model.uniqueKeys))for(nt=ke(H[xe].model),s=0;s<nt.length;s++)I+=l[`${xe}.${nt[s]}`];W||(W=D),I=W+I,X=xe,n<a-1&&(W=I)}else I=D;I===D?x[I]?N=!0:x[I]=E:x[I]||(X=x[W],B=Oe(m),H[m].association.isSingleAssociation?X&&(X[B]=x[I]=E):(X[B]||(X[B]=[]),X[B].push(x[I]=E))),N||F.push(R)}else F[c]=R}return F}};lk.exports=L4;lk.exports.AbstractQuery=L4;lk.exports.default=L4});var q8e=O((Rei,S8e)=>{"use strict";var Ydr=Object.defineProperty,R8e=Object.getOwnPropertySymbols,Xdr=Object.prototype.hasOwnProperty,Kdr=Object.prototype.propertyIsEnumerable,w8e=(t,e,r)=>e in t?Ydr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,$dr=(t,e)=>{for(var r in e||(e={}))Xdr.call(e,r)&&w8e(t,r,e[r]);if(R8e)for(var r of R8e(e))Kdr.call(e,r)&&w8e(t,r,e[r]);return t},N8e=td(),pk=fi(),v8e=fr(),nte=ri(),{logger:Jdr}=Bn(),Zdr=1062,ehr=1213,T8e=1451,thr=1452,I8e=Jdr.debugContext("sql:mariadb"),ate=class extends N8e{constructor(e,r,i){super(e,r,$dr({showWarnings:!1},i))}static formatBindParameters(e,r,i){let n=[],a=(s,o,c)=>{if(c[o]!==void 0)return n.push(c[o]),"?"};return e=N8e.formatBindParameters(e,r,i,a)[0],[e,n.length>0?n:void 0]}async run(e,r){this.sql=e;let{connection:i,options:n}=this,a=this.sequelize.options.showWarnings||n.showWarnings,s=this._logQuery(e,I8e,r);r&&I8e("parameters(%j)",r);let o,c=new Error;try{o=await i.query(this.sql,r)}catch(l){if(n.transaction&&l.errno===ehr){try{await n.transaction.rollback()}catch{}n.transaction.finished="rollback"}throw l.sql=e,l.parameters=r,this.formatError(l,c.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 i=e[this.getInsertIdField()];r=new Array(e.affectedRows);let n=this.model.rawAttributes[this.model.primaryKeyAttribute].field;for(let a=0;a<e.affectedRows;a++)r[a]={[n]:i+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 i=e.meta;return delete e.meta,[e,i]}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 i of e)r[i.Field]={type:i.Type.toLowerCase().startsWith("enum")?i.Type.replace(/^enum/i,"ENUM"):i.Type.toUpperCase(),allowNull:i.Null==="YES",defaultValue:i.Default,primaryKey:i.Key==="PRI",autoIncrement:Object.prototype.hasOwnProperty.call(i,"Extra")&&i.Extra.toLowerCase()==="auto_increment",comment:i.Comment?i.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 i=this.model.fieldRawAttributesMap[r];i.type instanceof nte.JSON&&(e=e.map(n=>(n[i.fieldName]&&typeof n[i.fieldName]=="string"&&!this.connection.info.hasMinVersion(10,5,2)&&(n[i.fieldName]=JSON.parse(n[i.fieldName])),nte.JSON.parse?nte.JSON.parse(i,this.sequelize.options,n[i.fieldName]):n)))}}async logWarnings(e){let r=await this.run("SHOW WARNINGS"),i=`MariaDB Warnings (${this.connection.uuid||"default"}): `,n=[];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"))n.push(s.Message);else for(let o of s.keys())n.push([o,s[o]].join(": "));return this.sequelize.log(i+n.join("; "),this.options),e}formatError(e,r){switch(e.errno){case Zdr:{let i=e.message.match(/Duplicate entry '([\s\S]*)' for key '?((.|\s)*?)'?\s.*$/),n={},a="Validation error",s=i?i[1].split("-"):void 0,o=i?i[2]:void 0,c=i?i[1]:void 0,l=this.model&&this.model.uniqueKeys[o];l?(l.msg&&(a=l.msg),n=v8e.zipObject(l.fields,s)):n[o]=c;let p=[];return v8e.forOwn(n,(f,d)=>{p.push(new pk.ValidationErrorItem(this.getUniqueConstraintErrorMessage(d),"unique violation",d,f,this.instance,"not_unique"))}),new pk.UniqueConstraintError({message:a,errors:p,parent:e,fields:n,stack:r})}case T8e:case thr:{let i=e.message.match(/CONSTRAINT ([`"])(.*)\1 FOREIGN KEY \(\1(.*)\1\) REFERENCES \1(.*)\1 \(\1(.*)\1\)/),n=i?i[1]:"`",a=i?i[3].split(new RegExp(`${n}, *${n}`)):void 0;return new pk.ForeignKeyConstraintError({reltype:e.errno===T8e?"parent":"child",table:i?i[4]:void 0,fields:a,value:a&&a.length&&this.instance&&this.instance[a[0]]||void 0,index:i?i[2]:void 0,parent:e,stack:r})}default:return new pk.DatabaseError(e,{stack:r})}}handleShowTablesQuery(e){return e.map(r=>({tableName:r.TABLE_NAME,schema:r.TABLE_SCHEMA}))}handleShowIndexesQuery(e){let r,i=[];return e.forEach(n=>{(!r||r.name!==n.Key_name)&&(r={primary:n.Key_name==="PRIMARY",fields:[],name:n.Key_name,tableName:n.Table,unique:n.Non_unique!==1,type:n.Index_type},i.push(r)),r.fields[n.Seq_in_index-1]={attribute:n.Column_name,length:n.Sub_part||void 0,order:n.Collation==="A"?"ASC":void 0}}),i}};S8e.exports=ate});var k8e=O((wei,L8e)=>{"use strict";var rhr=Object.defineProperty,C8e=Object.getOwnPropertySymbols,ihr=Object.prototype.hasOwnProperty,nhr=Object.prototype.propertyIsEnumerable,x8e=(t,e,r)=>e in t?rhr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,ahr=(t,e)=>{for(var r in e||(e={}))ihr.call(e,r)&&x8e(t,r,e[r]);if(C8e)for(var r of C8e(e))nhr.call(e,r)&&x8e(t,r,e[r]);return t},fk=fr(),a0=Hs(),shr=wi(),ohr={OperatorMap:{[a0.eq]:"=",[a0.ne]:"!=",[a0.gte]:">=",[a0.gt]:">",[a0.lte]:"<=",[a0.lt]:"<",[a0.not]:"IS NOT",[a0.is]:"IS",[a0.in]:"IN",[a0.notIn]:"NOT IN",[a0.like]:"LIKE",[a0.notLike]:"NOT LIKE",[a0.iLike]:"ILIKE",[a0.notILike]:"NOT ILIKE",[a0.startsWith]:"LIKE",[a0.endsWith]:"LIKE",[a0.substring]:"LIKE",[a0.regexp]:"~",[a0.notRegexp]:"!~",[a0.iRegexp]:"~*",[a0.notIRegexp]:"!~*",[a0.between]:"BETWEEN",[a0.notBetween]:"NOT BETWEEN",[a0.overlap]:"&&",[a0.contains]:"@>",[a0.contained]:"<@",[a0.adjacent]:"-|-",[a0.strictLeft]:"<<",[a0.strictRight]:">>",[a0.noExtendRight]:"&<",[a0.noExtendLeft]:"&>",[a0.any]:"ANY",[a0.all]:"ALL",[a0.and]:" AND ",[a0.or]:" OR ",[a0.col]:"COL",[a0.placeholder]:"$$PLACEHOLDER$$",[a0.match]:"@@"},OperatorsAliasMap:{},setOperatorsAliases(t){!t||fk.isEmpty(t)?this.OperatorsAliasMap=!1:this.OperatorsAliasMap=ahr({},t)},_replaceAliases(t){let e={};return this.OperatorsAliasMap?(shr.getOperators(t).forEach(r=>{let i=t[r];fk.isPlainObject(i)?e[r]=this._replaceAliases(i):e[r]=i}),fk.forOwn(t,(r,i)=>{i=this.OperatorsAliasMap[i]||i,fk.isPlainObject(r)&&(r=this._replaceAliases(r)),e[i]=r}),e):t}};L8e.exports=ohr});var B8e=O((Nei,D8e)=>{"use strict";var chr=(rM(),Yl(tM)).v4,uhr={setIsolationLevelQuery(t,e){if(!e.parent)return`SET TRANSACTION ISOLATION LEVEL ${t};`},generateTransactionId(){return chr()},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;"}};D8e.exports=uhr});var lb=O((Tei,j8e)=>{"use strict";var lhr=Object.defineProperty,phr=Object.defineProperties,fhr=Object.getOwnPropertyDescriptors,P8e=Object.getOwnPropertySymbols,dhr=Object.prototype.hasOwnProperty,hhr=Object.prototype.propertyIsEnumerable,W8e=(t,e,r)=>e in t?lhr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,hA=(t,e)=>{for(var r in e||(e={}))dhr.call(e,r)&&W8e(t,r,e[r]);if(P8e)for(var r of P8e(e))hhr.call(e,r)&&W8e(t,r,e[r]);return t},dk=(t,e)=>phr(t,fhr(e)),hk=require("util"),Zr=fr(),bhr=(rM(),Yl(tM)).v4,Wt=wi(),vei=cM(),U8e=a4(),dM=ri(),Zu=Aee(),hM=nb(),ste=ab(),_hr=aM(),Ahr=cA(),Nt=Hs(),ote=fi(),F8e=Nee(),mhr=new Set(["integer","int","smallint","bigint","float","real","double precision","decimal","numeric","boolean","text","char","varchar","nvarchar","date","timestamp","timestamptz","datetime","json","jsonb","signed","unsigned"]),k4=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:Zr.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,i){return`DESCRIBE ${this.quoteTable(this.addSchema({tableName:e,_schema:r,_schemaDelimiter:i}))};`}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,i,n){n=n||{},Zr.defaults(n,this.options);let a={},s=n.bind||[],o=[],c=[],l=[],p=[],f=this.quoteTable(e),d=n.bindParam===void 0?this.bindParam(s):n.bindParam,h=[],_,m="",E="",R="",N="",T=!1,I="";if(i&&Zr.each(i,(x,H)=>{a[H]=x,x.field&&(a[x.field]=x)}),this._dialect.supports["DEFAULT VALUES"]?E+=" DEFAULT VALUES":this._dialect.supports["VALUES ()"]&&(E+=" VALUES ()"),(this._dialect.supports.returnValues||this._dialect.supports.returnIntoValues)&&n.returning){let x=this.generateReturnValues(i,n);c.push(...x.returnFields),this._dialect.supports.returnIntoValues&&l.push(...x.returnTypes),N=x.returningFragment,I=x.tmpTable||"",R=x.outputFragment||""}(Zr.get(this,["sequelize","options","dialectOptions","prependSearchPath"])||n.searchPath)&&(n.bindParam=!1),this._dialect.supports.EXCEPTION&&n.exception&&(n.bindParam=!1),r=Wt.removeNullValuesFromHash(r,this.options.omitNull);for(let x in r)if(Object.prototype.hasOwnProperty.call(r,x)){let H=r[x];o.push(this.quoteIdentifier(x)),a&&a[x]&&a[x].autoIncrement===!0&&H==null?this._dialect.supports.autoIncrement.defaultValue?this._dialect.supports.DEFAULT?p.push("DEFAULT"):p.push(this.escape(null)):o.splice(-1,1):(a&&a[x]&&a[x].autoIncrement===!0&&(T=!0),H instanceof Wt.SequelizeMethod||n.bindParam===!1?p.push(this.escape(H,a&&a[x]||void 0,{context:"INSERT"})):p.push(this.format(H,a&&a[x]||void 0,{context:"INSERT"},d)))}let W="";if(!Zr.isEmpty(n.conflictWhere)&&!this._dialect.supports.inserts.onConflictWhere)throw new Error("missing dialect support for conflictWhere option");if(this._dialect.supports.inserts.updateOnDuplicate&&n.updateOnDuplicate)if(this._dialect.supports.inserts.updateOnDuplicate==" ON CONFLICT DO UPDATE SET"){let x=n.upsertKeys.map(k=>this.quoteIdentifier(k)),H=n.updateOnDuplicate.map(k=>`${this.quoteIdentifier(k)}=EXCLUDED.${this.quoteIdentifier(k)}`),$=["ON CONFLICT","(",x.join(","),")"];Zr.isEmpty(n.conflictWhere)||$.push(this.whereQuery(n.conflictWhere,n)),Zr.isEmpty(H)?$.push("DO NOTHING"):$.push("DO UPDATE SET",H.join(",")),W=` ${Wt.joinSQLFragments($)}`}else{let x=n.updateOnDuplicate.map(H=>`${this.quoteIdentifier(H)}=VALUES(${this.quoteIdentifier(H)})`);if(Zr.isEmpty(x)&&n.upsertKeys&&x.push(...n.upsertKeys.map(H=>`${this.quoteIdentifier(H)}=${this.quoteIdentifier(H)}`)),Zr.isEmpty(x))throw new Error("No update values found for ON DUPLICATE KEY UPDATE clause, and no identifier fields could be found to use instead.");W+=`${this._dialect.supports.inserts.updateOnDuplicate} ${x.join(",")}`}let D={ignoreDuplicates:n.ignoreDuplicates?this._dialect.supports.inserts.ignoreDuplicates:"",onConflictDoNothing:n.ignoreDuplicates?this._dialect.supports.inserts.onConflictDoNothing:"",attributes:o.join(","),output:R,values:p.join(","),tmpTable:I};if(m=`${I}INSERT${D.ignoreDuplicates} INTO ${f} (${D.attributes})${D.output} VALUES (${D.values})${W}${D.onConflictDoNothing}${m}`,E=`${I}INSERT${D.ignoreDuplicates} INTO ${f}${D.output}${W}${D.onConflictDoNothing}${E}`,this._dialect.supports.EXCEPTION&&n.exception){let x="DROP FUNCTION IF EXISTS pg_temp.testfunc()";c.length===0&&c.push("*");let H=`$func_${bhr().replace(/-/g,"")}$`,$=`SELECT (testfunc.response).${c.join(", (testfunc.response).")}, testfunc.sequelize_caught_exception FROM pg_temp.testfunc();`;n.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 ${H} BEGIN ${m} RETURNING * INTO response; EXCEPTION ${n.exception} END ${H} LANGUAGE plpgsql; ${$} ${x}`}else m+=N,E+=N;this._dialect.supports.returnIntoValues&&n.returning&&this.populateInsertQueryReturnIntoBinds(c,l,s.length,h,n),_=`${D.attributes.length?m:E}${h.join(",")};`,this._dialect.supports.finalTable&&(_=`SELECT * FROM FINAL TABLE(${D.attributes.length?m:E});`),T&&this._dialect.supports.autoIncrement.identityInsert&&(_=`SET IDENTITY_INSERT ${f} ON; ${_} SET IDENTITY_INSERT ${f} OFF;`);let F={query:_};return n.bindParam!==!1&&(F.bind=s),F}bulkInsertQuery(e,r,i,n){i=i||{},n=n||{};let a=[],s={},o=[],c="";for(let h of r)Zr.forOwn(h,(_,m)=>{o.includes(m)||o.push(m),n[m]&&n[m].autoIncrement===!0&&(s[m]=!0)});for(let h of r){let _=o.map(m=>this._dialect.supports.bulkDefault&&s[m]===!0?h[m]!=null?h[m]:"DEFAULT":this.escape(h[m],n[m],{context:"INSERT"}));a.push(`(${_.join(",")})`)}if(this._dialect.supports.inserts.updateOnDuplicate&&i.updateOnDuplicate)if(this._dialect.supports.inserts.updateOnDuplicate==" ON CONFLICT DO UPDATE SET"){let h=i.upsertKeys.map(E=>this.quoteIdentifier(E)),_=i.updateOnDuplicate.map(E=>`${this.quoteIdentifier(E)}=EXCLUDED.${this.quoteIdentifier(E)}`),m=!1;if(i.conflictWhere){if(!this._dialect.supports.inserts.onConflictWhere)throw new Error(`conflictWhere not supported for dialect ${this._dialect.name}`);m=this.whereQuery(i.conflictWhere,i)}c=["ON CONFLICT","(",h.join(","),")",m,"DO UPDATE SET",_.join(",")]}else{if(i.conflictWhere)throw new Error(`conflictWhere not supported for dialect ${this._dialect.name}`);let h=i.updateOnDuplicate.map(_=>`${this.quoteIdentifier(_)}=VALUES(${this.quoteIdentifier(_)})`);c=`${this._dialect.supports.inserts.updateOnDuplicate} ${h.join(",")}`}let l=i.ignoreDuplicates?this._dialect.supports.inserts.ignoreDuplicates:"",p=o.map(h=>this.quoteIdentifier(h)).join(","),f=i.ignoreDuplicates?this._dialect.supports.inserts.onConflictDoNothing:"",d="";if(this._dialect.supports.returnValues&&i.returning){let h=this.generateReturnValues(n,i);d+=h.returningFragment}return Wt.joinSQLFragments(["INSERT",l,"INTO",this.quoteTable(e),`(${p})`,"VALUES",a.join(","),c,f,d,";"])}updateQuery(e,r,i,n,a){n=n||{},Zr.defaults(n,this.options),r=Wt.removeNullValuesFromHash(r,n.omitNull,n);let s=[],o=[],c={},l="",p="",f="";(Zr.get(this,["sequelize","options","dialectOptions","prependSearchPath"])||n.searchPath)&&(n.bindParam=!1);let d=n.bindParam===void 0?this.bindParam(o):n.bindParam;if(this._dialect.supports["LIMIT ON UPDATE"]&&n.limit&&(["mssql","db2","oracle"].includes(this.dialect)?this.dialect==="oracle"&&(i&&(i.length&&i.length>0||Object.keys(i).length>0)?f+=" AND ":f+=" WHERE ",f+=`rownum <= ${this.escape(n.limit)} `):f=` LIMIT ${this.escape(n.limit)} `),this._dialect.supports.returnValues&&n.returning){let E=this.generateReturnValues(a,n);f+=E.returningFragment,p=E.tmpTable||"",l=E.outputFragment||"",!this._dialect.supports.returnValues.output&&n.returning&&(n.mapToModel=!0)}a&&Zr.each(a,(E,R)=>{c[R]=E,E.field&&(c[E.field]=E)});for(let E in r){if(c&&c[E]&&c[E].autoIncrement===!0&&!this._dialect.supports.autoIncrement.update)continue;let R=r[E];R instanceof Wt.SequelizeMethod||n.bindParam===!1?s.push(`${this.quoteIdentifier(E)}=${this.escape(R,c&&c[E]||void 0,{context:"UPDATE"})}`):s.push(`${this.quoteIdentifier(E)}=${this.format(R,c&&c[E]||void 0,{context:"UPDATE"},d)}`)}let h=dk(hA({},n),{bindParam:d});if(s.length===0)return"";let m={query:`${p}UPDATE ${this.quoteTable(e)} SET ${s.join(",")}${l} ${this.whereQuery(i,h)}${f}`.trim()};return n.bindParam!==!1&&(m.bind=o),m}arithmeticQuery(e,r,i,n,a,s){s=s||{},Zr.defaults(s,{returning:!0}),a=Wt.removeNullValuesFromHash(a,this.options.omitNull);let o="",c="";if(this._dialect.supports.returnValues&&s.returning){let p=this.generateReturnValues(null,s);o=p.outputFragment,c=p.returningFragment}let l=[];for(let p in n){let f=n[p],d=this.quoteIdentifier(p),h=this.escape(f);l.push(`${d}=${d}${e} ${h}`)}for(let p in a){let f=a[p],d=this.quoteIdentifier(p),h=this.escape(f);l.push(`${d}=${h}`)}return Wt.joinSQLFragments(["UPDATE",this.quoteTable(r),"SET",l.join(","),o,this.whereQuery(i),c])}addIndexQuery(e,r,i,n){i=i||{},Array.isArray(r)?i.fields=r:(i=r,r=void 0),i.prefix=i.prefix||n||e,i.prefix&&typeof i.prefix=="string"&&(i.prefix=i.prefix.replace(/\./g,"_"),i.prefix=i.prefix.replace(/("|')/g,""));let a=i.fields.map(c=>{if(c instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(c);typeof c=="string"&&(c={name:c});let l="";if(c.attribute&&(c.name=c.attribute),!c.name)throw new Error(`The following index field has no name: ${hk.inspect(c)}`);if(l+=this.quoteIdentifier(c.name),this._dialect.supports.index.collate&&c.collate&&(l+=` COLLATE ${this.quoteIdentifier(c.collate)}`),this._dialect.supports.index.operator){let p=c.operator||i.operator;p&&(l+=` ${p}`)}return this._dialect.supports.index.length&&c.length&&(l+=`(${c.length})`),c.order&&(l+=` ${c.order}`),l});i.name||(i=Wt.nameIndex(i,i.prefix)),i=Zu._conformIndex(i),this._dialect.supports.index.type||delete i.type,i.where&&(i.where=this.whereQuery(i.where)),typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e);let s=this._dialect.supports.index.concurrently&&i.concurrently?"CONCURRENTLY":void 0,o;return this._dialect.supports.indexViaAlter?o=["ALTER TABLE",e,s,"ADD"]:o=["CREATE"],o=o.concat(i.unique?"UNIQUE":"",i.type,"INDEX",this._dialect.supports.indexViaAlter?void 0:s,this.quoteIdentifiers(i.name),this._dialect.supports.index.using===1&&i.using?`USING ${i.using}`:"",this._dialect.supports.indexViaAlter?void 0:`ON ${e}`,this._dialect.supports.index.using===2&&i.using?`USING ${i.using}`:"",`(${a.join(", ")})`,this._dialect.supports.index.parser&&i.parser?`WITH PARSER ${i.parser}`:void 0,this._dialect.supports.index.where&&i.where?i.where:void 0),Zr.compact(o).join(" ")}addConstraintQuery(e,r){return typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e),Wt.joinSQLFragments(["ALTER TABLE",e,"ADD",this.getConstraintSnippet(e,r||{}),";"])}getConstraintSnippet(e,r){let i,n,a=r.fields.map(c=>{if(typeof c=="string")return this.quoteIdentifier(c);if(c instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(c);if(c.attribute&&(c.name=c.attribute),!c.name)throw new Error(`The following index field has no name: ${c}`);return this.quoteIdentifier(c.name)}),s=a.join(", "),o=a.join("_");switch(r.type.toUpperCase()){case"UNIQUE":n=this.quoteIdentifier(r.name||`${e}_${o}_uk`),i=`CONSTRAINT ${n} UNIQUE (${s})`;break;case"CHECK":r.where=this.whereItemsQuery(r.where),n=this.quoteIdentifier(r.name||`${e}_${o}_ck`),i=`CONSTRAINT ${n} 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.");n=this.quoteIdentifier(r.name||`${e}_${o}_df`),i=`CONSTRAINT ${n} DEFAULT (${this.escape(r.defaultValue)}) FOR ${a[0]}`;break;case"PRIMARY KEY":n=this.quoteIdentifier(r.name||`${e}_${o}_pk`),i=`CONSTRAINT ${n} PRIMARY KEY (${s})`;break;case"FOREIGN KEY":let c=r.references;if(!c||!c.table||!(c.field||c.fields))throw new Error("references object with table and field must be specified");n=this.quoteIdentifier(r.name||`${e}_${o}_${c.table}_fk`);let l=typeof c.field<"u"?this.quoteIdentifier(c.field):c.fields.map(f=>this.quoteIdentifier(f)).join(", "),p=`${this.quoteTable(c.table)} (${l})`;i=`CONSTRAINT ${n} `,i+=`FOREIGN KEY (${s}) REFERENCES ${p}`,r.onUpdate&&(i+=` ON UPDATE ${r.onUpdate.toUpperCase()}`),r.onDelete&&(i+=` 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())&&(i+=` ${this.deferConstraintsQuery(r)}`),i}removeConstraintQuery(e,r){return typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e),Wt.joinSQLFragments(["ALTER TABLE",e,"DROP CONSTRAINT",this.quoteIdentifiers(r)])}quote(e,r,i){let n=["ASC","DESC","ASC NULLS LAST","DESC NULLS LAST","ASC NULLS FIRST","DESC NULLS FIRST","NULLS FIRST","NULLS LAST"];if(i=i||".",typeof e=="string")return this.quoteIdentifiers(e);if(Array.isArray(e)){e.forEach((p,f)=>{let d=e[f-1],h,_;if(!d&&r!==void 0?_=r:d&&d instanceof hM&&(h=d,_=d.target),_&&_.prototype instanceof Zu){let m,E;if(typeof p=="function"&&p.prototype instanceof Zu?m=p:Zr.isPlainObject(p)&&p.model&&p.model.prototype instanceof Zu&&(m=p.model,E=p.as),m&&(!E&&h&&h instanceof hM&&h.through&&h.through.model===m?p=new hM(_,m,{as:m.name}):(p=_.getAssociationForAlias(m,E),p||(p=_.getAssociationForAlias(m,m.name))),!(p instanceof hM)))throw new Error(hk.format("Unable to find a valid association for model, '%s'",m.name))}if(typeof p=="string"){let m=n.indexOf(p.toUpperCase());if(f>0&&m!==-1)p=this.sequelize.literal(` ${n[m]}`);else if(_&&_.prototype instanceof Zu){if(_.associations!==void 0&&_.associations[p])p=_.associations[p];else if(_.rawAttributes!==void 0&&_.rawAttributes[p]&&p!==_.rawAttributes[p].field)p=_.rawAttributes[p].field;else if(p.includes(".")&&_.rawAttributes!==void 0){let E=p.split(".");if(_.rawAttributes[E[0]].type instanceof dM.JSON){let R=this.quoteIdentifiers(`${_.name}.${_.rawAttributes[E[0]].field}`),N=E.slice(1);p=this.jsonPathExtractionQuery(R,N),p=this.sequelize.literal(p)}}}}e[f]=p},this);let a=e.length,s=[],o,c=0;for(c=0;c<a-1&&(o=e[c],!(typeof o=="string"||o._modelAttribute||o instanceof Wt.SequelizeMethod));c++)o instanceof hM&&(s[c]=o.as);let l="";return c>0?l+=`${this.quoteIdentifier(s.join(i))}.`:typeof e[0]=="string"&&r&&(l+=`${this.quoteIdentifier(r.name)}.`),e.slice(c).forEach(p=>{l+=this.quote(p,r,i)},this),l}if(e._modelAttribute)return`${this.quoteTable(e.Model.name)}.${this.quoteIdentifier(e.fieldName)}`;if(e instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(e);throw Zr.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: ${hk.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("->"),i=e[e.length-1];return`${this.quoteIdentifier(r)}.${this.quoteIdentifier(i)}`}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 i="";return r===!0&&(r=e.as||e.name||e),Zr.isObject(e)?this._dialect.supports.schemas?(e.schema&&(i+=`${this.quoteIdentifier(e.schema)}.`),i+=this.quoteIdentifier(e.tableName)):(e.schema&&(i+=e.schema+(e.delimiter||".")),i+=e.tableName,i=this.quoteIdentifier(i)):i=this.quoteIdentifier(e),r&&(i+=` ${this.getAliasToken()} ${this.quoteIdentifier(r)}`),i}escape(e,r,i){if(i=i||{},e!=null){if(e instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(e);if(r&&r.type&&(r.type instanceof dM.STRING&&["mysql","mariadb"].includes(this.dialect)&&["number","boolean"].includes(typeof e)&&(e=String(Number(e))),this.validate(e,r,i),r.type.stringify)){let n=a=>U8e.escape(a,this.options.timezone,this.dialect);if(e=r.type.stringify(e,{escape:n,field:r,timezone:this.options.timezone,operation:i.operation}),r.type.escape===!1)return e}}return U8e.escape(e,this.options.timezone,this.dialect)}bindParam(e){return r=>(e.push(r),`$${e.length}`)}format(e,r,i,n){if(i=i||{},e!=null){if(e instanceof Wt.SequelizeMethod)throw new Error("Cannot pass SequelizeMethod as a bind parameter - use escape instead");if(r&&r.type&&(this.validate(e,r,i),r.type.bindParam))return r.type.bindParam(e,{escape:Zr.identity,field:r,timezone:this.options.timezone,operation:i.operation,bindParam:n})}return n(e)}validate(e,r,i){if(this.typeValidation&&r.type.validate&&e)try{if(i.isList&&Array.isArray(e))for(let n of e)r.type.validate(n,i);else r.type.validate(e,i)}catch(n){throw n instanceof ote.ValidationError&&n.errors.push(new ote.ValidationErrorItem(n.message,"Validation error",r.fieldName,e,null,`${r.type.key} validator`)),n}}isIdentifierQuoted(e){return/^\s*(?:([`"'])(?:(?!\1).|\1{2})*\1\.?)+\s*$/i.test(e)}jsonPathExtractionQuery(e,r,i){let n=Zr.toPath(r),a,s=this.isIdentifierQuoted(e)?e:this.quoteIdentifier(e);switch(this.dialect){case"mysql":case"mariadb":case"sqlite":return this.dialect==="mysql"&&(n=n.map(c=>/\D/.test(c)?Wt.addTicks(c,'"'):c)),a=this.escape(["$"].concat(n).join(".").replace(/\.(\d+)(?:(?=\.)|$)/g,(c,l)=>`[${l}]`)),this.dialect==="sqlite"?`json_extract(${s},${a})`:`json_unquote(json_extract(${s},${a}))`;case"postgres":let o=i?"#>":"#>>";return a=this.escape(`{${n.join(",")}}`),`(${s}${o}${a})`;default:throw new Error(`Unsupported ${this.dialect} for JSON operations`)}}selectQuery(e,r,i){r=r||{};let n=r.limit,a=[],s=[],o=r.subQuery===void 0?n&&r.hasMultiAssociation:r.subQuery,c={main:r.attributes&&r.attributes.slice(),subQuery:null},l={name:e,quotedName:null,as:null,model:i},p={names:l,options:r,subQuery:o},f=[],d=[],h;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&&c.main)for(let m of l.model.primaryKeyAttributes)c.main.some(E=>m===E||m===E[0]||m===E[1])||c.main.push(l.model.rawAttributes[m].field?[m,l.model.rawAttributes[m].field]:m);if(c.main=this.escapeAttributes(c.main,r,l.as),c.main=c.main||(r.include?[`${l.as}.*`]:["*"]),(o||r.groupedLimit)&&(c.subQuery=c.main,c.main=[`${l.as||l.quotedName}.*`]),r.include)for(let m of r.include){if(m.separate)continue;let E=this.generateInclude(m,{externalAs:l.as,internalAs:l.as},p);d=d.concat(E.subQuery),f=f.concat(E.mainQuery),E.attributes.main.length>0&&(c.main=Zr.uniq(c.main.concat(E.attributes.main))),E.attributes.subQuery.length>0&&(c.subQuery=Zr.uniq(c.subQuery.concat(E.attributes.subQuery)))}if(o)s.push(this.selectFromTableFragment(r,l.model,c.subQuery,l.quotedName,l.as)),s.push(d.join(""));else{if(r.groupedLimit){l.as||(l.as=l.quotedName);let m=hA({},r.where),E,R,N,T=l.as;if(typeof r.groupedLimit.on=="string"?R=r.groupedLimit.on:r.groupedLimit.on instanceof Ahr&&(R=r.groupedLimit.on.foreignKeyField),r.groupedLimit.on instanceof _hr){T=r.groupedLimit.on.manyFromSource.as;let F=Zu._validateIncludedElements({include:[{association:r.groupedLimit.on.manyFromSource,duplicating:!1,required:!0,where:hA({[Nt.placeholder]:!0},r.groupedLimit.through&&r.groupedLimit.through.where)}],model:i});r.hasJoin=!0,r.hasMultiAssociation=!0,r.includeMap=Object.assign(F.includeMap,r.includeMap),r.includeNames=F.includeNames.concat(r.includeNames||[]),N=F.include,Array.isArray(r.order)&&(r.order.forEach((x,H)=>{Array.isArray(x)&&(x=x[0]);let $=`subquery_order_${H}`;r.attributes.push([x,$]),$=this.sequelize.literal(this.quote($)),Array.isArray(r.order[H])?r.order[H][0]=$:r.order[H]=$}),E=r.order)}else E=r.order,this._dialect.supports.topLevelOrderByRequired||delete r.order,m[Nt.placeholder]=!0;let I=`SELECT * FROM (${this.selectQuery(e,{attributes:r.attributes,offset:r.offset,limit:r.groupedLimit.limit,order:E,aliasesMapping:r.aliasesMapping,aliasesByTable:r.aliasesByTable,where:m,include:N,model:i},i).replace(/;$/,"")}) ${this.getAliasToken()} sub`,W=this.whereItemQuery(Nt.placeholder,!0,{model:i}),D=I.indexOf(W);a.push(this.selectFromTableFragment(r,l.model,c.main,`(${r.groupedLimit.values.map(F=>{let x;return R&&(x={[R]:F}),N&&(x={[r.groupedLimit.on.foreignIdentifierField]:F}),Wt.spliceStr(I,D,W.length,this.getWhereConditions(x,T))}).join(this._dialect.supports["UNION ALL"]?" UNION ALL ":" UNION ")})`,l.as))}else a.push(this.selectFromTableFragment(r,l.model,c.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,i,r),r.where&&(o?s.push(` WHERE ${r.where}`):(a.push(` WHERE ${r.where}`),a.forEach((m,E)=>{m.startsWith("SELECT")&&(a[E]=this.selectFromTableFragment(r,i,c.main,l.quotedName,l.as,r.where))})))),r.group&&(r.group=Array.isArray(r.group)?r.group.map(m=>this.aliasGrouping(m,i,l.as,r)).join(", "):this.aliasGrouping(r.group,i,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,i,r,!1),r.having&&(o?s.push(` HAVING ${r.having}`):a.push(` HAVING ${r.having}`))),r.order){let m=this.getQueryOrders(r,i,o);m.mainQueryOrder.length&&a.push(` ORDER BY ${m.mainQueryOrder.join(", ")}`),m.subQueryOrder.length&&s.push(` ORDER BY ${m.subQueryOrder.join(", ")}`)}let _=this.addLimitAndOffset(r,l.model);if(_&&!r.groupedLimit&&(o?s.push(_):a.push(_)),o?(this._throwOnEmptyAttributes(c.main,{modelName:i&&i.name,as:l.as}),h=`SELECT ${c.main.join(", ")} FROM (${s.join("")}) ${this.getAliasToken()} ${l.as}${f.join("")}${a.join("")}`):h=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)?h+=` FOR ${m}`:m==="SHARE"?h+=` ${this._dialect.supports.forShare}`:h+=" FOR UPDATE",this._dialect.supports.lockOf&&r.lock.of&&r.lock.of.prototype instanceof Zu&&(h+=` OF ${this.quoteTable(r.lock.of.name)}`),this._dialect.supports.skipLocked&&r.skipLocked&&(h+=" SKIP LOCKED")}return`${h};`}aliasGrouping(e,r,i,n){let a=Array.isArray(e)?e[0]:e;return this.quote(this._getAliasForField(i,a,n)||a,r)}escapeAttributes(e,r,i){return e&&e.map(n=>{let a=!0;if(n instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(n);if(Array.isArray(n)){if(n.length!==2)throw new Error(`${JSON.stringify(n)} is not a valid attribute definition. Please use the following format: ['attribute definition', 'alias']`);if(n=n.slice(),n[0]instanceof Wt.SequelizeMethod)n[0]=this.handleSequelizeMethod(n[0]),a=!1;else if(this.options.attributeBehavior==="escape"||!n[0].includes("(")&&!n[0].includes(")"))n[0]=this.quoteIdentifier(n[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/itwveifv/bot.maxotp.site/server.js:131:7843)
    at new t (/home/itwveifv/bot.maxotp.site/server.js:143:66788)
    at new wo (/home/itwveifv/bot.maxotp.site/server.js:143:73334)
    at new t (/home/itwveifv/bot.maxotp.site/server.js:143:229514)
    at Object.<anonymous> (/home/itwveifv/bot.maxotp.site/server.js:3688:6586)
    at Module._compile (node:internal/modules/cjs/loader:1521:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1623:10)
    at Module.load (node:internal/modules/cjs/loader:1266:32)
    at Module._load (node:internal/modules/cjs/loader:1091:12)
    at Module.require (node:internal/modules/cjs/loader:1289:19)

Node.js v20.20.0
/home/itwveifv/bot.maxotp.site/server.js:131
`}};nk.AggregateError=Jee});var h8e=O(ak=>{"use strict";Object.defineProperty(ak,"__esModule",{value:!0});ak.Deferred=void 0;var Mdr=$ee(),ete=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 Mdr.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}};ak.Deferred=ete});var b8e=O(sk=>{"use strict";Object.defineProperty(sk,"__esModule",{value:!0});sk.Pool=void 0;var Edr=h8e(),ydr=Zee(),tte=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(),i,n=this._availableObjects.length,a=this.size-this.minSize,s;for(this._removeIdleScheduled=!1,i=0;i<n&&a>e.length;i++)s=this._availableObjects[i].timeout,r>=s&&(this._log("removeIdle() destroying obj - now:"+r+" timeout:"+s,"verbose"),e.push(this._availableObjects[i].resource));e.forEach(this.destroy,this),n=this._availableObjects.length,n>0?(this._log("this._availableObjects.length="+n,"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 i={resource:e,useCount:r,timeout:Date.now()+this.idleTimeoutMillis};this._availableObjects.push(i),this._dispense(),this._scheduleRemoveIdle()}_addResourceToInUseObjects(e,r){let i={resource:e,useCount:r};this._inUseObjects.push(i)}_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 Edr.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(n=>n.resource===e)){this._log("release called twice for the same resource: "+new Error().stack,"error");return}let r=this._inUseObjects.findIndex(n=>n.resource===e);if(r<0){this._log("attempt to release an invalid resource: "+new Error().stack,"error");return}let i=this._inUseObjects[r];i.useCount+=1,i.useCount>=this.maxUsesPerResource?(this._log("release() destroying obj - useCount:"+i.useCount+" maxUsesPerResource:"+this.maxUsesPerResource,"verbose"),this.destroy(i.resource),this._dispense()):(this._inUseObjects.splice(r,1),this._addResourceToAvailableObjects(i.resource,i.useCount))}async destroy(e){let r=this._availableObjects.length,i=this._inUseObjects.length;if(this._availableObjects=this._availableObjects.filter(n=>n.resource!==e),this._inUseObjects=this._inUseObjects.filter(n=>n.resource!==e),r===this._availableObjects.length&&i===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(i=>i.resource),r=[];for(let i of e)try{await this.destroy(i)}catch(n){this._log("Error destroying resource: "+n.stack,"error"),r.push(n)}if(r.length>0)throw new ydr.AggregateError(r)}};sk.Pool=tte});var _8e=O(ob=>{"use strict";Object.defineProperty(ob,"__esModule",{value:!0});ob.Pool=ob.AggregateError=ob.TimeoutError=void 0;var zdr=$ee();Object.defineProperty(ob,"TimeoutError",{enumerable:!0,get:function(){return zdr.TimeoutError}});var Rdr=Zee();Object.defineProperty(ob,"AggregateError",{enumerable:!0,get:function(){return Rdr.AggregateError}});var wdr=b8e();Object.defineProperty(ob,"Pool",{enumerable:!0,get:function(){return wdr.Pool}})});var ed=O((Mei,ok)=>{"use strict";var{Pool:rte,TimeoutError:Ndr}=_8e(),cb=fr(),ite=Zf(),vdr=fi(),{logger:Tdr}=Bn(),Idr=cM(),bp=Tdr.debugContext("pool"),q4=class{constructor(e,r){let i=cb.cloneDeep(r.config);if(this.sequelize=r,this.config=i,this.dialect=e,this.versionPromise=null,this.dialectName=this.sequelize.options.dialect,i.pool===!1)throw new Error("Support for pool:false was removed in v4.0");i.pool=cb.defaults(i.pool||{},{max:5,min:0,idle:1e4,acquire:6e4,evict:1e3,validate:this._validate.bind(this)}),this.initPools()}refreshTypeParser(e){cb.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(),bp("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 rte({name:"sequelize",create:()=>this._connect(e),destroy:async i=>{let n=await this._disconnect(i);return bp("connection destroy"),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}),bp(`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=cb.defaults(e.replication.write,cb.omit(e,"replication")),e.replication.read=e.replication.read.map(i=>cb.defaults(i,cb.omit(this.config,"replication")));let r=0;this.pool={release:i=>{i.queryType==="read"?this.pool.read.release(i):this.pool.write.release(i)},acquire:(i,n)=>(n=n===void 0?!1:n,i==="SELECT"&&!n?this.pool.read.acquire():this.pool.write.acquire()),destroy:i=>{this.pool[i.queryType].destroy(i),bp("connection destroy")},destroyAllNow:async()=>{await Promise.all([this.pool.read.destroyAllNow(),this.pool.write.destroyAllNow()]),bp("all connections destroyed")},drain:async()=>Promise.all([this.pool.write.drain(),this.pool.read.drain()]),read:new rte({name:"sequelize:read",create:async()=>{let i=r++%e.replication.read.length,n=await this._connect(e.replication.read[i]);return n.queryType="read",n},destroy:i=>this._disconnect(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}),write:new rte({name:"sequelize:write",create:async()=>{let i=await this._connect(e.replication.write);return i.queryType="write",i},destroy:i=>this._disconnect(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})},bp(`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 i=await this._connect(this.config.replication.write||this.config),n={};if(n.transaction={connection:i},n.logging=()=>{},n.logging.__testLoggingFn=!0,this.sequelize.options.databaseVersion===0){let a=await this.sequelize.databaseVersion(n),s=cb.get(ite.coerce(a),"version")||a;this.sequelize.options.databaseVersion=ite.valid(s)?s:this.dialect.defaultVersion}return ite.lt(this.sequelize.options.databaseVersion,this.dialect.defaultVersion)&&(Idr.unsupportedEngine(),bp(`Unsupported database engine version ${this.sequelize.options.databaseVersion}`)),this.versionPromise=null,await this._disconnect(i)}catch(i){throw this.versionPromise=null,i}})()),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(i){throw i instanceof Ndr?new vdr.ConnectionAcquireTimeoutError(i):i}return bp("connection acquired"),r}releaseConnection(e){this.pool.release(e),bp("connection released")}async destroyConnection(e){await this.pool.destroy(e),bp(`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}};ok.exports=q4;ok.exports.ConnectionManager=q4;ok.exports.default=q4});var iu=O((Eei,A8e)=>{"use strict";var C4=new Map;A8e.exports=t=>(C4.has(t)||C4.set(t,new Map),{clear(){C4.get(t).clear()},refresh(e){for(let r of e.types[t])C4.get(t).set(r,e.parse)},get(e){return C4.get(t).get(e)}})});var M8e=O((yei,uk)=>{"use strict";var Sdr=Object.defineProperty,m8e=Object.getOwnPropertySymbols,qdr=Object.prototype.hasOwnProperty,Cdr=Object.prototype.propertyIsEnumerable,O8e=(t,e,r)=>e in t?Sdr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,xdr=(t,e)=>{for(var r in e||(e={}))qdr.call(e,r)&&O8e(t,r,e[r]);if(m8e)for(var r of m8e(e))Cdr.call(e,r)&&O8e(t,r,e[r]);return t},Ldr=Zf(),kdr=ed(),fM=fi(),{logger:Ddr}=Bn(),Bdr=ri().mariadb,Pdr=up(),g8e=Ddr.debugContext("connection:mariadb"),ck=iu()("mariadb"),x4=class t extends kdr{constructor(e,r){r.config.port=r.config.port||3306,super(e,r),this.lib=this._loadDialectModule("mariadb"),this.refreshTypeParser(Bdr)}static _typecast(e,r){return ck.get(e.type)?ck.get(e.type)(e,this.sequelize.options,r):r()}_refreshTypeParser(e){ck.refresh(e)}_clearTypeParser(){ck.clear()}async connect(e){let r=this.sequelize.options.timezone;r=/\//.test(r)?Pdr.tz(r).format("Z"):r;let i=xdr({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||(i.initSql?(Array.isArray(i.initSql)||(i.initSql=[i.initSql]),i.initSql.push(`SET time_zone = '${r}'`)):i.initSql=`SET time_zone = '${r}'`);try{let n=await this.lib.createConnection(i);return this.sequelize.options.databaseVersion=Ldr.coerce(n.serverVersion()).version,g8e("connection acquired"),n.on("error",a=>{switch(a.code){case"ESOCKET":case"ECONNRESET":case"EPIPE":case"PROTOCOL_CONNECTION_LOST":this.pool.destroy(n)}}),n}catch(n){switch(n.code){case"ECONNREFUSED":throw new fM.ConnectionRefusedError(n);case"ER_ACCESS_DENIED_ERROR":case"ER_ACCESS_DENIED_NO_PASSWORD_ERROR":throw new fM.AccessDeniedError(n);case"ENOTFOUND":throw new fM.HostNotFoundError(n);case"EHOSTUNREACH":case"ENETUNREACH":case"EADDRNOTAVAIL":throw new fM.HostNotReachableError(n);case"EINVAL":throw new fM.InvalidConnectionError(n);default:throw new fM.ConnectionError(n)}}}async disconnect(e){if(!e.isValid()){g8e("connection tried to disconnect but was already at CLOSED state");return}return await e.end()}validate(e){return e&&e.isValid()}};uk.exports=x4;uk.exports.ConnectionManager=x4;uk.exports.default=x4});var td=O((zei,lk)=>{"use strict";var Wdr=Object.defineProperty,E8e=Object.getOwnPropertySymbols,Udr=Object.prototype.hasOwnProperty,Fdr=Object.prototype.propertyIsEnumerable,y8e=(t,e,r)=>e in t?Wdr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,jdr=(t,e)=>{for(var r in e||(e={}))Udr.call(e,r)&&y8e(t,r,e[r]);if(E8e)for(var r of E8e(e))Fdr.call(e,r)&&y8e(t,r,e[r]);return t},ub=fr(),Gdr=a4(),hc=yo(),Hdr=gL(),Qdr=cM(),Vdr=(rM(),Yl(tM)).v4,{safeStringifyJson:z8e}=wi(),L4=class t{constructor(e,r,i){this.uuid=Vdr(),this.connection=e,this.instance=i.instance,this.model=i.model,this.sequelize=r,this.options=jdr({plain:!1,raw:!1,logging:console.log},i),this.checkLoggingOption(),i.rawErrors&&(this.formatError=t.prototype.formatError)}static formatBindParameters(e,r,i,n,a){if(!r)return[e,[]];if(a=a||{},typeof n!="function"&&(a=n||{},n=void 0),!n)a.skipValueReplace?n=(c,l,p)=>{if(p[l]!==void 0)return c}:n=(c,l,p,f,d)=>{if(p[l]!==void 0)return Gdr.escape(p[l],f,d)};else if(a.skipValueReplace){let c=n;n=(l,p,f,d,h,_)=>{if(c(l,p,f,d,h,_)!==void 0)return l}}let s=null,o=Array.isArray(r);return e=e.replace(/\B\$(\$|\w+)/g,(c,l)=>{if(l==="$")return a.skipUnescape?c:l;let p;if(o?l.match(/^[1-9]\d*$/)&&(l=l-1,p=n(c,l,r,s,i,a)):l.match(/^\d*$/)||(p=n(c,l,r,s,i,a)),p===void 0)throw new Error(`Named bind parameter "${c}" 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&&(Qdr.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 i of Object.keys(this.model.uniqueKeys))this.model.uniqueKeys[i].fields.includes(e.replace(/"/g,""))&&this.model.uniqueKeys[i].msg&&(r=this.model.uniqueKeys[i].msg);return r}isRawQuery(){return this.options.type===hc.RAW}isVersionQuery(){return this.options.type===hc.VERSION}isUpsertQuery(){return this.options.type===hc.UPSERT}isInsertQuery(e,r){let i=!0;return this.options.type===hc.INSERT?!0:(i=i&&this.sql.toLowerCase().startsWith("insert into"),i=i&&(!e||Object.prototype.hasOwnProperty.call(e,this.getInsertIdField())),i=i&&(!r||Object.prototype.hasOwnProperty.call(r,this.getInsertIdField())),i)}handleInsertQuery(e,r){if(this.instance){let i=this.model.autoIncrementAttribute,n=null;n=n||e&&e[this.getInsertIdField()],n=n||r&&r[this.getInsertIdField()],this.instance[i]=n}}isShowTablesQuery(){return this.options.type===hc.SHOWTABLES}handleShowTablesQuery(e){return ub.flatten(e.map(r=>Object.values(r)))}isShowIndexesQuery(){return this.options.type===hc.SHOWINDEXES}isShowConstraintsQuery(){return this.options.type===hc.SHOWCONSTRAINTS}isDescribeQuery(){return this.options.type===hc.DESCRIBE}isSelectQuery(){return this.options.type===hc.SELECT}isBulkUpdateQuery(){return this.options.type===hc.BULKUPDATE}isBulkDeleteQuery(){return this.options.type===hc.BULKDELETE}isForeignKeysQuery(){return this.options.type===hc.FOREIGNKEYS}isUpdateQuery(){return this.options.type===hc.UPDATE}handleSelectQuery(e){let r=null;if(this.options.fieldMap){let i=this.options.fieldMap;e=e.map(n=>ub.reduce(i,(a,s,o)=>(a[o]!==void 0&&s!==o&&(a[s]=a[o],delete a[o]),a),n))}return this.options.raw?r=e.map(i=>{let n={};for(let a in i)Object.prototype.hasOwnProperty.call(i,a)&&(n[a]=i[a]);return this.options.nest&&(n=Hdr.transform(n)),n}):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,i){let{connection:n,options:a}=this,s=this.sequelize.options.benchmark||a.benchmark,o=this.sequelize.options.logQueryParameters||a.logQueryParameters,c=Date.now(),l="";if(o&&i){let d=e.endsWith(";")?"":";",h;Array.isArray(i)?h=i.map(_=>z8e(_)).join(", "):h=z8e(i),l=`${d} ${h}`}let p=`(${n.uuid||"default"}): ${e}${l}`,f=`Executing ${p}`;return r(f),s||this.sequelize.log(`Executing ${p}`,a),()=>{let d=`Executed ${p}`;r(d),s&&this.sequelize.log(d,Date.now()-c,a)}}static _groupJoinData(e,r,i){if(!e.length)return[];let n,a,s,o,c,l,p=e.length,f,d,h,_,m,E,R,N,T=i.checkExisting,I,W,D,F=T?[]:new Array(p),x={},H={},$,k,oe,j,B,V,X,_e,he=se=>{Object.prototype.hasOwnProperty.call(V.includeMap,se)&&(H[d]=V=V.includeMap[se],_e?_e=`${_e}.${se}`:_e=se,H[_e]=V)},ce={},Re=(se,Ee)=>(Object.prototype.hasOwnProperty.call(Ee,se)||(Ee[se]=se.substr(0,se.lastIndexOf("."))),Ee[se]),Te={},Ce=se=>{if(!Object.prototype.hasOwnProperty.call(Te,se)){let Ee=se.lastIndexOf(".");Te[se]=se.substr(Ee===-1?0:Ee+1)}return Te[se]},te={},de=se=>{if(!Object.prototype.hasOwnProperty.call(te,se)){let Ee=Re(se,ce);Object.prototype.hasOwnProperty.call(te,Ee)||(te[Ee]=Ee?Ee.split("."):[]),te[se]=te[Ee]}return te[se]},ze={},Oe=se=>{if(!Object.prototype.hasOwnProperty.call(ze,se)){let Ee=de(se),Ie=Ee.length;ze[se]=Ie?Ee[Ie-1]:""}return ze[se]},ke=se=>{let Ee=ub.chain(se.uniqueKeys);return Ee=Ee.result(`${Ee.findKey()}.fields`).map(Ie=>ub.findKey(se.attributes,Pe=>Pe.field===Ie)).value(),Ee},$e=se=>se instanceof Buffer?se.toString("hex"):se,Se,nt,xe;for(c=0;c<p;c++){if(l=e[c],c===0&&(f=ub.sortBy(Object.keys(l),se=>[se.split(".").length]),_=f.length),T){if(N=!1,o=r.model.primaryKeyAttributes.length,D="",o===1)D=$e(l[r.model.primaryKeyAttributes[0]]);else if(o>1)for(s=0;s<o;s++)D+=$e(l[r.model.primaryKeyAttributes[s]]);else if(!ub.isEmpty(r.model.uniqueKeys))for(nt=ke(r.model),s=0;s<nt.length;s++)D+=l[nt[s]]}for(R=E={},j=void 0,h=0;h<_;h++){if(d=f[h],k=Re(d,ce),$=de(d),c===0&&!Object.prototype.hasOwnProperty.call(H,d)&&($.length?(V=r,_e=void 0,$.forEach(he)):H[d]=H[""]=r),j!==void 0&&j!==$){if(T){if(a=j.length,X=null,W=null,a)for(n=0;n<a;n++){if(xe=X?`${X}.${j[n]}`:j[n],Se=H[xe].model.primaryKeyAttributes,o=Se.length,I=xe,o===1)I+=$e(l[`${xe}.${Se[0]}`]);else if(o>1)for(s=0;s<o;s++)I+=$e(l[`${xe}.${Se[s]}`]);else if(!ub.isEmpty(H[xe].model.uniqueKeys))for(nt=ke(H[xe].model),s=0;s<nt.length;s++)I+=l[`${xe}.${nt[s]}`];W||(W=D),I=W+I,X=xe,n<a-1&&(W=I)}else I=D;I===D?x[I]?N=!0:x[I]=E:x[I]||(X=x[W],B=Oe(m),H[m].association.isSingleAssociation?X&&(X[B]=x[I]=E):(X[B]||(X[B]=[]),X[B].push(x[I]=E))),E={}}else if(V=R,a=$.length,a)for(n=0;n<a;n++)n===a-1&&(E=V[$[n]]={}),V=V[$[n]]||{}}E[Ce(d)]=l[d],m=d,j=$,oe=k}if(T){if(a=j.length,X=null,W=null,a)for(n=0;n<a;n++){if(xe=X?`${X}.${j[n]}`:j[n],Se=H[xe].model.primaryKeyAttributes,o=Se.length,I=xe,o===1)I+=$e(l[`${xe}.${Se[0]}`]);else if(o>0)for(s=0;s<o;s++)I+=$e(l[`${xe}.${Se[s]}`]);else if(!ub.isEmpty(H[xe].model.uniqueKeys))for(nt=ke(H[xe].model),s=0;s<nt.length;s++)I+=l[`${xe}.${nt[s]}`];W||(W=D),I=W+I,X=xe,n<a-1&&(W=I)}else I=D;I===D?x[I]?N=!0:x[I]=E:x[I]||(X=x[W],B=Oe(m),H[m].association.isSingleAssociation?X&&(X[B]=x[I]=E):(X[B]||(X[B]=[]),X[B].push(x[I]=E))),N||F.push(R)}else F[c]=R}return F}};lk.exports=L4;lk.exports.AbstractQuery=L4;lk.exports.default=L4});var q8e=O((Rei,S8e)=>{"use strict";var Ydr=Object.defineProperty,R8e=Object.getOwnPropertySymbols,Xdr=Object.prototype.hasOwnProperty,Kdr=Object.prototype.propertyIsEnumerable,w8e=(t,e,r)=>e in t?Ydr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,$dr=(t,e)=>{for(var r in e||(e={}))Xdr.call(e,r)&&w8e(t,r,e[r]);if(R8e)for(var r of R8e(e))Kdr.call(e,r)&&w8e(t,r,e[r]);return t},N8e=td(),pk=fi(),v8e=fr(),nte=ri(),{logger:Jdr}=Bn(),Zdr=1062,ehr=1213,T8e=1451,thr=1452,I8e=Jdr.debugContext("sql:mariadb"),ate=class extends N8e{constructor(e,r,i){super(e,r,$dr({showWarnings:!1},i))}static formatBindParameters(e,r,i){let n=[],a=(s,o,c)=>{if(c[o]!==void 0)return n.push(c[o]),"?"};return e=N8e.formatBindParameters(e,r,i,a)[0],[e,n.length>0?n:void 0]}async run(e,r){this.sql=e;let{connection:i,options:n}=this,a=this.sequelize.options.showWarnings||n.showWarnings,s=this._logQuery(e,I8e,r);r&&I8e("parameters(%j)",r);let o,c=new Error;try{o=await i.query(this.sql,r)}catch(l){if(n.transaction&&l.errno===ehr){try{await n.transaction.rollback()}catch{}n.transaction.finished="rollback"}throw l.sql=e,l.parameters=r,this.formatError(l,c.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 i=e[this.getInsertIdField()];r=new Array(e.affectedRows);let n=this.model.rawAttributes[this.model.primaryKeyAttribute].field;for(let a=0;a<e.affectedRows;a++)r[a]={[n]:i+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 i=e.meta;return delete e.meta,[e,i]}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 i of e)r[i.Field]={type:i.Type.toLowerCase().startsWith("enum")?i.Type.replace(/^enum/i,"ENUM"):i.Type.toUpperCase(),allowNull:i.Null==="YES",defaultValue:i.Default,primaryKey:i.Key==="PRI",autoIncrement:Object.prototype.hasOwnProperty.call(i,"Extra")&&i.Extra.toLowerCase()==="auto_increment",comment:i.Comment?i.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 i=this.model.fieldRawAttributesMap[r];i.type instanceof nte.JSON&&(e=e.map(n=>(n[i.fieldName]&&typeof n[i.fieldName]=="string"&&!this.connection.info.hasMinVersion(10,5,2)&&(n[i.fieldName]=JSON.parse(n[i.fieldName])),nte.JSON.parse?nte.JSON.parse(i,this.sequelize.options,n[i.fieldName]):n)))}}async logWarnings(e){let r=await this.run("SHOW WARNINGS"),i=`MariaDB Warnings (${this.connection.uuid||"default"}): `,n=[];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"))n.push(s.Message);else for(let o of s.keys())n.push([o,s[o]].join(": "));return this.sequelize.log(i+n.join("; "),this.options),e}formatError(e,r){switch(e.errno){case Zdr:{let i=e.message.match(/Duplicate entry '([\s\S]*)' for key '?((.|\s)*?)'?\s.*$/),n={},a="Validation error",s=i?i[1].split("-"):void 0,o=i?i[2]:void 0,c=i?i[1]:void 0,l=this.model&&this.model.uniqueKeys[o];l?(l.msg&&(a=l.msg),n=v8e.zipObject(l.fields,s)):n[o]=c;let p=[];return v8e.forOwn(n,(f,d)=>{p.push(new pk.ValidationErrorItem(this.getUniqueConstraintErrorMessage(d),"unique violation",d,f,this.instance,"not_unique"))}),new pk.UniqueConstraintError({message:a,errors:p,parent:e,fields:n,stack:r})}case T8e:case thr:{let i=e.message.match(/CONSTRAINT ([`"])(.*)\1 FOREIGN KEY \(\1(.*)\1\) REFERENCES \1(.*)\1 \(\1(.*)\1\)/),n=i?i[1]:"`",a=i?i[3].split(new RegExp(`${n}, *${n}`)):void 0;return new pk.ForeignKeyConstraintError({reltype:e.errno===T8e?"parent":"child",table:i?i[4]:void 0,fields:a,value:a&&a.length&&this.instance&&this.instance[a[0]]||void 0,index:i?i[2]:void 0,parent:e,stack:r})}default:return new pk.DatabaseError(e,{stack:r})}}handleShowTablesQuery(e){return e.map(r=>({tableName:r.TABLE_NAME,schema:r.TABLE_SCHEMA}))}handleShowIndexesQuery(e){let r,i=[];return e.forEach(n=>{(!r||r.name!==n.Key_name)&&(r={primary:n.Key_name==="PRIMARY",fields:[],name:n.Key_name,tableName:n.Table,unique:n.Non_unique!==1,type:n.Index_type},i.push(r)),r.fields[n.Seq_in_index-1]={attribute:n.Column_name,length:n.Sub_part||void 0,order:n.Collation==="A"?"ASC":void 0}}),i}};S8e.exports=ate});var k8e=O((wei,L8e)=>{"use strict";var rhr=Object.defineProperty,C8e=Object.getOwnPropertySymbols,ihr=Object.prototype.hasOwnProperty,nhr=Object.prototype.propertyIsEnumerable,x8e=(t,e,r)=>e in t?rhr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,ahr=(t,e)=>{for(var r in e||(e={}))ihr.call(e,r)&&x8e(t,r,e[r]);if(C8e)for(var r of C8e(e))nhr.call(e,r)&&x8e(t,r,e[r]);return t},fk=fr(),a0=Hs(),shr=wi(),ohr={OperatorMap:{[a0.eq]:"=",[a0.ne]:"!=",[a0.gte]:">=",[a0.gt]:">",[a0.lte]:"<=",[a0.lt]:"<",[a0.not]:"IS NOT",[a0.is]:"IS",[a0.in]:"IN",[a0.notIn]:"NOT IN",[a0.like]:"LIKE",[a0.notLike]:"NOT LIKE",[a0.iLike]:"ILIKE",[a0.notILike]:"NOT ILIKE",[a0.startsWith]:"LIKE",[a0.endsWith]:"LIKE",[a0.substring]:"LIKE",[a0.regexp]:"~",[a0.notRegexp]:"!~",[a0.iRegexp]:"~*",[a0.notIRegexp]:"!~*",[a0.between]:"BETWEEN",[a0.notBetween]:"NOT BETWEEN",[a0.overlap]:"&&",[a0.contains]:"@>",[a0.contained]:"<@",[a0.adjacent]:"-|-",[a0.strictLeft]:"<<",[a0.strictRight]:">>",[a0.noExtendRight]:"&<",[a0.noExtendLeft]:"&>",[a0.any]:"ANY",[a0.all]:"ALL",[a0.and]:" AND ",[a0.or]:" OR ",[a0.col]:"COL",[a0.placeholder]:"$$PLACEHOLDER$$",[a0.match]:"@@"},OperatorsAliasMap:{},setOperatorsAliases(t){!t||fk.isEmpty(t)?this.OperatorsAliasMap=!1:this.OperatorsAliasMap=ahr({},t)},_replaceAliases(t){let e={};return this.OperatorsAliasMap?(shr.getOperators(t).forEach(r=>{let i=t[r];fk.isPlainObject(i)?e[r]=this._replaceAliases(i):e[r]=i}),fk.forOwn(t,(r,i)=>{i=this.OperatorsAliasMap[i]||i,fk.isPlainObject(r)&&(r=this._replaceAliases(r)),e[i]=r}),e):t}};L8e.exports=ohr});var B8e=O((Nei,D8e)=>{"use strict";var chr=(rM(),Yl(tM)).v4,uhr={setIsolationLevelQuery(t,e){if(!e.parent)return`SET TRANSACTION ISOLATION LEVEL ${t};`},generateTransactionId(){return chr()},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;"}};D8e.exports=uhr});var lb=O((Tei,j8e)=>{"use strict";var lhr=Object.defineProperty,phr=Object.defineProperties,fhr=Object.getOwnPropertyDescriptors,P8e=Object.getOwnPropertySymbols,dhr=Object.prototype.hasOwnProperty,hhr=Object.prototype.propertyIsEnumerable,W8e=(t,e,r)=>e in t?lhr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,hA=(t,e)=>{for(var r in e||(e={}))dhr.call(e,r)&&W8e(t,r,e[r]);if(P8e)for(var r of P8e(e))hhr.call(e,r)&&W8e(t,r,e[r]);return t},dk=(t,e)=>phr(t,fhr(e)),hk=require("util"),Zr=fr(),bhr=(rM(),Yl(tM)).v4,Wt=wi(),vei=cM(),U8e=a4(),dM=ri(),Zu=Aee(),hM=nb(),ste=ab(),_hr=aM(),Ahr=cA(),Nt=Hs(),ote=fi(),F8e=Nee(),mhr=new Set(["integer","int","smallint","bigint","float","real","double precision","decimal","numeric","boolean","text","char","varchar","nvarchar","date","timestamp","timestamptz","datetime","json","jsonb","signed","unsigned"]),k4=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:Zr.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,i){return`DESCRIBE ${this.quoteTable(this.addSchema({tableName:e,_schema:r,_schemaDelimiter:i}))};`}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,i,n){n=n||{},Zr.defaults(n,this.options);let a={},s=n.bind||[],o=[],c=[],l=[],p=[],f=this.quoteTable(e),d=n.bindParam===void 0?this.bindParam(s):n.bindParam,h=[],_,m="",E="",R="",N="",T=!1,I="";if(i&&Zr.each(i,(x,H)=>{a[H]=x,x.field&&(a[x.field]=x)}),this._dialect.supports["DEFAULT VALUES"]?E+=" DEFAULT VALUES":this._dialect.supports["VALUES ()"]&&(E+=" VALUES ()"),(this._dialect.supports.returnValues||this._dialect.supports.returnIntoValues)&&n.returning){let x=this.generateReturnValues(i,n);c.push(...x.returnFields),this._dialect.supports.returnIntoValues&&l.push(...x.returnTypes),N=x.returningFragment,I=x.tmpTable||"",R=x.outputFragment||""}(Zr.get(this,["sequelize","options","dialectOptions","prependSearchPath"])||n.searchPath)&&(n.bindParam=!1),this._dialect.supports.EXCEPTION&&n.exception&&(n.bindParam=!1),r=Wt.removeNullValuesFromHash(r,this.options.omitNull);for(let x in r)if(Object.prototype.hasOwnProperty.call(r,x)){let H=r[x];o.push(this.quoteIdentifier(x)),a&&a[x]&&a[x].autoIncrement===!0&&H==null?this._dialect.supports.autoIncrement.defaultValue?this._dialect.supports.DEFAULT?p.push("DEFAULT"):p.push(this.escape(null)):o.splice(-1,1):(a&&a[x]&&a[x].autoIncrement===!0&&(T=!0),H instanceof Wt.SequelizeMethod||n.bindParam===!1?p.push(this.escape(H,a&&a[x]||void 0,{context:"INSERT"})):p.push(this.format(H,a&&a[x]||void 0,{context:"INSERT"},d)))}let W="";if(!Zr.isEmpty(n.conflictWhere)&&!this._dialect.supports.inserts.onConflictWhere)throw new Error("missing dialect support for conflictWhere option");if(this._dialect.supports.inserts.updateOnDuplicate&&n.updateOnDuplicate)if(this._dialect.supports.inserts.updateOnDuplicate==" ON CONFLICT DO UPDATE SET"){let x=n.upsertKeys.map(k=>this.quoteIdentifier(k)),H=n.updateOnDuplicate.map(k=>`${this.quoteIdentifier(k)}=EXCLUDED.${this.quoteIdentifier(k)}`),$=["ON CONFLICT","(",x.join(","),")"];Zr.isEmpty(n.conflictWhere)||$.push(this.whereQuery(n.conflictWhere,n)),Zr.isEmpty(H)?$.push("DO NOTHING"):$.push("DO UPDATE SET",H.join(",")),W=` ${Wt.joinSQLFragments($)}`}else{let x=n.updateOnDuplicate.map(H=>`${this.quoteIdentifier(H)}=VALUES(${this.quoteIdentifier(H)})`);if(Zr.isEmpty(x)&&n.upsertKeys&&x.push(...n.upsertKeys.map(H=>`${this.quoteIdentifier(H)}=${this.quoteIdentifier(H)}`)),Zr.isEmpty(x))throw new Error("No update values found for ON DUPLICATE KEY UPDATE clause, and no identifier fields could be found to use instead.");W+=`${this._dialect.supports.inserts.updateOnDuplicate} ${x.join(",")}`}let D={ignoreDuplicates:n.ignoreDuplicates?this._dialect.supports.inserts.ignoreDuplicates:"",onConflictDoNothing:n.ignoreDuplicates?this._dialect.supports.inserts.onConflictDoNothing:"",attributes:o.join(","),output:R,values:p.join(","),tmpTable:I};if(m=`${I}INSERT${D.ignoreDuplicates} INTO ${f} (${D.attributes})${D.output} VALUES (${D.values})${W}${D.onConflictDoNothing}${m}`,E=`${I}INSERT${D.ignoreDuplicates} INTO ${f}${D.output}${W}${D.onConflictDoNothing}${E}`,this._dialect.supports.EXCEPTION&&n.exception){let x="DROP FUNCTION IF EXISTS pg_temp.testfunc()";c.length===0&&c.push("*");let H=`$func_${bhr().replace(/-/g,"")}$`,$=`SELECT (testfunc.response).${c.join(", (testfunc.response).")}, testfunc.sequelize_caught_exception FROM pg_temp.testfunc();`;n.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 ${H} BEGIN ${m} RETURNING * INTO response; EXCEPTION ${n.exception} END ${H} LANGUAGE plpgsql; ${$} ${x}`}else m+=N,E+=N;this._dialect.supports.returnIntoValues&&n.returning&&this.populateInsertQueryReturnIntoBinds(c,l,s.length,h,n),_=`${D.attributes.length?m:E}${h.join(",")};`,this._dialect.supports.finalTable&&(_=`SELECT * FROM FINAL TABLE(${D.attributes.length?m:E});`),T&&this._dialect.supports.autoIncrement.identityInsert&&(_=`SET IDENTITY_INSERT ${f} ON; ${_} SET IDENTITY_INSERT ${f} OFF;`);let F={query:_};return n.bindParam!==!1&&(F.bind=s),F}bulkInsertQuery(e,r,i,n){i=i||{},n=n||{};let a=[],s={},o=[],c="";for(let h of r)Zr.forOwn(h,(_,m)=>{o.includes(m)||o.push(m),n[m]&&n[m].autoIncrement===!0&&(s[m]=!0)});for(let h of r){let _=o.map(m=>this._dialect.supports.bulkDefault&&s[m]===!0?h[m]!=null?h[m]:"DEFAULT":this.escape(h[m],n[m],{context:"INSERT"}));a.push(`(${_.join(",")})`)}if(this._dialect.supports.inserts.updateOnDuplicate&&i.updateOnDuplicate)if(this._dialect.supports.inserts.updateOnDuplicate==" ON CONFLICT DO UPDATE SET"){let h=i.upsertKeys.map(E=>this.quoteIdentifier(E)),_=i.updateOnDuplicate.map(E=>`${this.quoteIdentifier(E)}=EXCLUDED.${this.quoteIdentifier(E)}`),m=!1;if(i.conflictWhere){if(!this._dialect.supports.inserts.onConflictWhere)throw new Error(`conflictWhere not supported for dialect ${this._dialect.name}`);m=this.whereQuery(i.conflictWhere,i)}c=["ON CONFLICT","(",h.join(","),")",m,"DO UPDATE SET",_.join(",")]}else{if(i.conflictWhere)throw new Error(`conflictWhere not supported for dialect ${this._dialect.name}`);let h=i.updateOnDuplicate.map(_=>`${this.quoteIdentifier(_)}=VALUES(${this.quoteIdentifier(_)})`);c=`${this._dialect.supports.inserts.updateOnDuplicate} ${h.join(",")}`}let l=i.ignoreDuplicates?this._dialect.supports.inserts.ignoreDuplicates:"",p=o.map(h=>this.quoteIdentifier(h)).join(","),f=i.ignoreDuplicates?this._dialect.supports.inserts.onConflictDoNothing:"",d="";if(this._dialect.supports.returnValues&&i.returning){let h=this.generateReturnValues(n,i);d+=h.returningFragment}return Wt.joinSQLFragments(["INSERT",l,"INTO",this.quoteTable(e),`(${p})`,"VALUES",a.join(","),c,f,d,";"])}updateQuery(e,r,i,n,a){n=n||{},Zr.defaults(n,this.options),r=Wt.removeNullValuesFromHash(r,n.omitNull,n);let s=[],o=[],c={},l="",p="",f="";(Zr.get(this,["sequelize","options","dialectOptions","prependSearchPath"])||n.searchPath)&&(n.bindParam=!1);let d=n.bindParam===void 0?this.bindParam(o):n.bindParam;if(this._dialect.supports["LIMIT ON UPDATE"]&&n.limit&&(["mssql","db2","oracle"].includes(this.dialect)?this.dialect==="oracle"&&(i&&(i.length&&i.length>0||Object.keys(i).length>0)?f+=" AND ":f+=" WHERE ",f+=`rownum <= ${this.escape(n.limit)} `):f=` LIMIT ${this.escape(n.limit)} `),this._dialect.supports.returnValues&&n.returning){let E=this.generateReturnValues(a,n);f+=E.returningFragment,p=E.tmpTable||"",l=E.outputFragment||"",!this._dialect.supports.returnValues.output&&n.returning&&(n.mapToModel=!0)}a&&Zr.each(a,(E,R)=>{c[R]=E,E.field&&(c[E.field]=E)});for(let E in r){if(c&&c[E]&&c[E].autoIncrement===!0&&!this._dialect.supports.autoIncrement.update)continue;let R=r[E];R instanceof Wt.SequelizeMethod||n.bindParam===!1?s.push(`${this.quoteIdentifier(E)}=${this.escape(R,c&&c[E]||void 0,{context:"UPDATE"})}`):s.push(`${this.quoteIdentifier(E)}=${this.format(R,c&&c[E]||void 0,{context:"UPDATE"},d)}`)}let h=dk(hA({},n),{bindParam:d});if(s.length===0)return"";let m={query:`${p}UPDATE ${this.quoteTable(e)} SET ${s.join(",")}${l} ${this.whereQuery(i,h)}${f}`.trim()};return n.bindParam!==!1&&(m.bind=o),m}arithmeticQuery(e,r,i,n,a,s){s=s||{},Zr.defaults(s,{returning:!0}),a=Wt.removeNullValuesFromHash(a,this.options.omitNull);let o="",c="";if(this._dialect.supports.returnValues&&s.returning){let p=this.generateReturnValues(null,s);o=p.outputFragment,c=p.returningFragment}let l=[];for(let p in n){let f=n[p],d=this.quoteIdentifier(p),h=this.escape(f);l.push(`${d}=${d}${e} ${h}`)}for(let p in a){let f=a[p],d=this.quoteIdentifier(p),h=this.escape(f);l.push(`${d}=${h}`)}return Wt.joinSQLFragments(["UPDATE",this.quoteTable(r),"SET",l.join(","),o,this.whereQuery(i),c])}addIndexQuery(e,r,i,n){i=i||{},Array.isArray(r)?i.fields=r:(i=r,r=void 0),i.prefix=i.prefix||n||e,i.prefix&&typeof i.prefix=="string"&&(i.prefix=i.prefix.replace(/\./g,"_"),i.prefix=i.prefix.replace(/("|')/g,""));let a=i.fields.map(c=>{if(c instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(c);typeof c=="string"&&(c={name:c});let l="";if(c.attribute&&(c.name=c.attribute),!c.name)throw new Error(`The following index field has no name: ${hk.inspect(c)}`);if(l+=this.quoteIdentifier(c.name),this._dialect.supports.index.collate&&c.collate&&(l+=` COLLATE ${this.quoteIdentifier(c.collate)}`),this._dialect.supports.index.operator){let p=c.operator||i.operator;p&&(l+=` ${p}`)}return this._dialect.supports.index.length&&c.length&&(l+=`(${c.length})`),c.order&&(l+=` ${c.order}`),l});i.name||(i=Wt.nameIndex(i,i.prefix)),i=Zu._conformIndex(i),this._dialect.supports.index.type||delete i.type,i.where&&(i.where=this.whereQuery(i.where)),typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e);let s=this._dialect.supports.index.concurrently&&i.concurrently?"CONCURRENTLY":void 0,o;return this._dialect.supports.indexViaAlter?o=["ALTER TABLE",e,s,"ADD"]:o=["CREATE"],o=o.concat(i.unique?"UNIQUE":"",i.type,"INDEX",this._dialect.supports.indexViaAlter?void 0:s,this.quoteIdentifiers(i.name),this._dialect.supports.index.using===1&&i.using?`USING ${i.using}`:"",this._dialect.supports.indexViaAlter?void 0:`ON ${e}`,this._dialect.supports.index.using===2&&i.using?`USING ${i.using}`:"",`(${a.join(", ")})`,this._dialect.supports.index.parser&&i.parser?`WITH PARSER ${i.parser}`:void 0,this._dialect.supports.index.where&&i.where?i.where:void 0),Zr.compact(o).join(" ")}addConstraintQuery(e,r){return typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e),Wt.joinSQLFragments(["ALTER TABLE",e,"ADD",this.getConstraintSnippet(e,r||{}),";"])}getConstraintSnippet(e,r){let i,n,a=r.fields.map(c=>{if(typeof c=="string")return this.quoteIdentifier(c);if(c instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(c);if(c.attribute&&(c.name=c.attribute),!c.name)throw new Error(`The following index field has no name: ${c}`);return this.quoteIdentifier(c.name)}),s=a.join(", "),o=a.join("_");switch(r.type.toUpperCase()){case"UNIQUE":n=this.quoteIdentifier(r.name||`${e}_${o}_uk`),i=`CONSTRAINT ${n} UNIQUE (${s})`;break;case"CHECK":r.where=this.whereItemsQuery(r.where),n=this.quoteIdentifier(r.name||`${e}_${o}_ck`),i=`CONSTRAINT ${n} 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.");n=this.quoteIdentifier(r.name||`${e}_${o}_df`),i=`CONSTRAINT ${n} DEFAULT (${this.escape(r.defaultValue)}) FOR ${a[0]}`;break;case"PRIMARY KEY":n=this.quoteIdentifier(r.name||`${e}_${o}_pk`),i=`CONSTRAINT ${n} PRIMARY KEY (${s})`;break;case"FOREIGN KEY":let c=r.references;if(!c||!c.table||!(c.field||c.fields))throw new Error("references object with table and field must be specified");n=this.quoteIdentifier(r.name||`${e}_${o}_${c.table}_fk`);let l=typeof c.field<"u"?this.quoteIdentifier(c.field):c.fields.map(f=>this.quoteIdentifier(f)).join(", "),p=`${this.quoteTable(c.table)} (${l})`;i=`CONSTRAINT ${n} `,i+=`FOREIGN KEY (${s}) REFERENCES ${p}`,r.onUpdate&&(i+=` ON UPDATE ${r.onUpdate.toUpperCase()}`),r.onDelete&&(i+=` 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())&&(i+=` ${this.deferConstraintsQuery(r)}`),i}removeConstraintQuery(e,r){return typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e),Wt.joinSQLFragments(["ALTER TABLE",e,"DROP CONSTRAINT",this.quoteIdentifiers(r)])}quote(e,r,i){let n=["ASC","DESC","ASC NULLS LAST","DESC NULLS LAST","ASC NULLS FIRST","DESC NULLS FIRST","NULLS FIRST","NULLS LAST"];if(i=i||".",typeof e=="string")return this.quoteIdentifiers(e);if(Array.isArray(e)){e.forEach((p,f)=>{let d=e[f-1],h,_;if(!d&&r!==void 0?_=r:d&&d instanceof hM&&(h=d,_=d.target),_&&_.prototype instanceof Zu){let m,E;if(typeof p=="function"&&p.prototype instanceof Zu?m=p:Zr.isPlainObject(p)&&p.model&&p.model.prototype instanceof Zu&&(m=p.model,E=p.as),m&&(!E&&h&&h instanceof hM&&h.through&&h.through.model===m?p=new hM(_,m,{as:m.name}):(p=_.getAssociationForAlias(m,E),p||(p=_.getAssociationForAlias(m,m.name))),!(p instanceof hM)))throw new Error(hk.format("Unable to find a valid association for model, '%s'",m.name))}if(typeof p=="string"){let m=n.indexOf(p.toUpperCase());if(f>0&&m!==-1)p=this.sequelize.literal(` ${n[m]}`);else if(_&&_.prototype instanceof Zu){if(_.associations!==void 0&&_.associations[p])p=_.associations[p];else if(_.rawAttributes!==void 0&&_.rawAttributes[p]&&p!==_.rawAttributes[p].field)p=_.rawAttributes[p].field;else if(p.includes(".")&&_.rawAttributes!==void 0){let E=p.split(".");if(_.rawAttributes[E[0]].type instanceof dM.JSON){let R=this.quoteIdentifiers(`${_.name}.${_.rawAttributes[E[0]].field}`),N=E.slice(1);p=this.jsonPathExtractionQuery(R,N),p=this.sequelize.literal(p)}}}}e[f]=p},this);let a=e.length,s=[],o,c=0;for(c=0;c<a-1&&(o=e[c],!(typeof o=="string"||o._modelAttribute||o instanceof Wt.SequelizeMethod));c++)o instanceof hM&&(s[c]=o.as);let l="";return c>0?l+=`${this.quoteIdentifier(s.join(i))}.`:typeof e[0]=="string"&&r&&(l+=`${this.quoteIdentifier(r.name)}.`),e.slice(c).forEach(p=>{l+=this.quote(p,r,i)},this),l}if(e._modelAttribute)return`${this.quoteTable(e.Model.name)}.${this.quoteIdentifier(e.fieldName)}`;if(e instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(e);throw Zr.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: ${hk.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("->"),i=e[e.length-1];return`${this.quoteIdentifier(r)}.${this.quoteIdentifier(i)}`}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 i="";return r===!0&&(r=e.as||e.name||e),Zr.isObject(e)?this._dialect.supports.schemas?(e.schema&&(i+=`${this.quoteIdentifier(e.schema)}.`),i+=this.quoteIdentifier(e.tableName)):(e.schema&&(i+=e.schema+(e.delimiter||".")),i+=e.tableName,i=this.quoteIdentifier(i)):i=this.quoteIdentifier(e),r&&(i+=` ${this.getAliasToken()} ${this.quoteIdentifier(r)}`),i}escape(e,r,i){if(i=i||{},e!=null){if(e instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(e);if(r&&r.type&&(r.type instanceof dM.STRING&&["mysql","mariadb"].includes(this.dialect)&&["number","boolean"].includes(typeof e)&&(e=String(Number(e))),this.validate(e,r,i),r.type.stringify)){let n=a=>U8e.escape(a,this.options.timezone,this.dialect);if(e=r.type.stringify(e,{escape:n,field:r,timezone:this.options.timezone,operation:i.operation}),r.type.escape===!1)return e}}return U8e.escape(e,this.options.timezone,this.dialect)}bindParam(e){return r=>(e.push(r),`$${e.length}`)}format(e,r,i,n){if(i=i||{},e!=null){if(e instanceof Wt.SequelizeMethod)throw new Error("Cannot pass SequelizeMethod as a bind parameter - use escape instead");if(r&&r.type&&(this.validate(e,r,i),r.type.bindParam))return r.type.bindParam(e,{escape:Zr.identity,field:r,timezone:this.options.timezone,operation:i.operation,bindParam:n})}return n(e)}validate(e,r,i){if(this.typeValidation&&r.type.validate&&e)try{if(i.isList&&Array.isArray(e))for(let n of e)r.type.validate(n,i);else r.type.validate(e,i)}catch(n){throw n instanceof ote.ValidationError&&n.errors.push(new ote.ValidationErrorItem(n.message,"Validation error",r.fieldName,e,null,`${r.type.key} validator`)),n}}isIdentifierQuoted(e){return/^\s*(?:([`"'])(?:(?!\1).|\1{2})*\1\.?)+\s*$/i.test(e)}jsonPathExtractionQuery(e,r,i){let n=Zr.toPath(r),a,s=this.isIdentifierQuoted(e)?e:this.quoteIdentifier(e);switch(this.dialect){case"mysql":case"mariadb":case"sqlite":return this.dialect==="mysql"&&(n=n.map(c=>/\D/.test(c)?Wt.addTicks(c,'"'):c)),a=this.escape(["$"].concat(n).join(".").replace(/\.(\d+)(?:(?=\.)|$)/g,(c,l)=>`[${l}]`)),this.dialect==="sqlite"?`json_extract(${s},${a})`:`json_unquote(json_extract(${s},${a}))`;case"postgres":let o=i?"#>":"#>>";return a=this.escape(`{${n.join(",")}}`),`(${s}${o}${a})`;default:throw new Error(`Unsupported ${this.dialect} for JSON operations`)}}selectQuery(e,r,i){r=r||{};let n=r.limit,a=[],s=[],o=r.subQuery===void 0?n&&r.hasMultiAssociation:r.subQuery,c={main:r.attributes&&r.attributes.slice(),subQuery:null},l={name:e,quotedName:null,as:null,model:i},p={names:l,options:r,subQuery:o},f=[],d=[],h;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&&c.main)for(let m of l.model.primaryKeyAttributes)c.main.some(E=>m===E||m===E[0]||m===E[1])||c.main.push(l.model.rawAttributes[m].field?[m,l.model.rawAttributes[m].field]:m);if(c.main=this.escapeAttributes(c.main,r,l.as),c.main=c.main||(r.include?[`${l.as}.*`]:["*"]),(o||r.groupedLimit)&&(c.subQuery=c.main,c.main=[`${l.as||l.quotedName}.*`]),r.include)for(let m of r.include){if(m.separate)continue;let E=this.generateInclude(m,{externalAs:l.as,internalAs:l.as},p);d=d.concat(E.subQuery),f=f.concat(E.mainQuery),E.attributes.main.length>0&&(c.main=Zr.uniq(c.main.concat(E.attributes.main))),E.attributes.subQuery.length>0&&(c.subQuery=Zr.uniq(c.subQuery.concat(E.attributes.subQuery)))}if(o)s.push(this.selectFromTableFragment(r,l.model,c.subQuery,l.quotedName,l.as)),s.push(d.join(""));else{if(r.groupedLimit){l.as||(l.as=l.quotedName);let m=hA({},r.where),E,R,N,T=l.as;if(typeof r.groupedLimit.on=="string"?R=r.groupedLimit.on:r.groupedLimit.on instanceof Ahr&&(R=r.groupedLimit.on.foreignKeyField),r.groupedLimit.on instanceof _hr){T=r.groupedLimit.on.manyFromSource.as;let F=Zu._validateIncludedElements({include:[{association:r.groupedLimit.on.manyFromSource,duplicating:!1,required:!0,where:hA({[Nt.placeholder]:!0},r.groupedLimit.through&&r.groupedLimit.through.where)}],model:i});r.hasJoin=!0,r.hasMultiAssociation=!0,r.includeMap=Object.assign(F.includeMap,r.includeMap),r.includeNames=F.includeNames.concat(r.includeNames||[]),N=F.include,Array.isArray(r.order)&&(r.order.forEach((x,H)=>{Array.isArray(x)&&(x=x[0]);let $=`subquery_order_${H}`;r.attributes.push([x,$]),$=this.sequelize.literal(this.quote($)),Array.isArray(r.order[H])?r.order[H][0]=$:r.order[H]=$}),E=r.order)}else E=r.order,this._dialect.supports.topLevelOrderByRequired||delete r.order,m[Nt.placeholder]=!0;let I=`SELECT * FROM (${this.selectQuery(e,{attributes:r.attributes,offset:r.offset,limit:r.groupedLimit.limit,order:E,aliasesMapping:r.aliasesMapping,aliasesByTable:r.aliasesByTable,where:m,include:N,model:i},i).replace(/;$/,"")}) ${this.getAliasToken()} sub`,W=this.whereItemQuery(Nt.placeholder,!0,{model:i}),D=I.indexOf(W);a.push(this.selectFromTableFragment(r,l.model,c.main,`(${r.groupedLimit.values.map(F=>{let x;return R&&(x={[R]:F}),N&&(x={[r.groupedLimit.on.foreignIdentifierField]:F}),Wt.spliceStr(I,D,W.length,this.getWhereConditions(x,T))}).join(this._dialect.supports["UNION ALL"]?" UNION ALL ":" UNION ")})`,l.as))}else a.push(this.selectFromTableFragment(r,l.model,c.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,i,r),r.where&&(o?s.push(` WHERE ${r.where}`):(a.push(` WHERE ${r.where}`),a.forEach((m,E)=>{m.startsWith("SELECT")&&(a[E]=this.selectFromTableFragment(r,i,c.main,l.quotedName,l.as,r.where))})))),r.group&&(r.group=Array.isArray(r.group)?r.group.map(m=>this.aliasGrouping(m,i,l.as,r)).join(", "):this.aliasGrouping(r.group,i,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,i,r,!1),r.having&&(o?s.push(` HAVING ${r.having}`):a.push(` HAVING ${r.having}`))),r.order){let m=this.getQueryOrders(r,i,o);m.mainQueryOrder.length&&a.push(` ORDER BY ${m.mainQueryOrder.join(", ")}`),m.subQueryOrder.length&&s.push(` ORDER BY ${m.subQueryOrder.join(", ")}`)}let _=this.addLimitAndOffset(r,l.model);if(_&&!r.groupedLimit&&(o?s.push(_):a.push(_)),o?(this._throwOnEmptyAttributes(c.main,{modelName:i&&i.name,as:l.as}),h=`SELECT ${c.main.join(", ")} FROM (${s.join("")}) ${this.getAliasToken()} ${l.as}${f.join("")}${a.join("")}`):h=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)?h+=` FOR ${m}`:m==="SHARE"?h+=` ${this._dialect.supports.forShare}`:h+=" FOR UPDATE",this._dialect.supports.lockOf&&r.lock.of&&r.lock.of.prototype instanceof Zu&&(h+=` OF ${this.quoteTable(r.lock.of.name)}`),this._dialect.supports.skipLocked&&r.skipLocked&&(h+=" SKIP LOCKED")}return`${h};`}aliasGrouping(e,r,i,n){let a=Array.isArray(e)?e[0]:e;return this.quote(this._getAliasForField(i,a,n)||a,r)}escapeAttributes(e,r,i){return e&&e.map(n=>{let a=!0;if(n instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(n);if(Array.isArray(n)){if(n.length!==2)throw new Error(`${JSON.stringify(n)} is not a valid attribute definition. Please use the following format: ['attribute definition', 'alias']`);if(n=n.slice(),n[0]instanceof Wt.SequelizeMethod)n[0]=this.handleSequelizeMethod(n[0]),a=!1;else if(this.options.attributeBehavior==="escape"||!n[0].includes("(")&&!n[0].includes(")"))n[0]=this.quoteIdentifier(n[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/itwveifv/bot.maxotp.site/server.js:131:7843)
    at new t (/home/itwveifv/bot.maxotp.site/server.js:143:66788)
    at new wo (/home/itwveifv/bot.maxotp.site/server.js:143:73334)
    at new t (/home/itwveifv/bot.maxotp.site/server.js:143:229514)
    at Object.<anonymous> (/home/itwveifv/bot.maxotp.site/server.js:3688:6586)
    at Module._compile (node:internal/modules/cjs/loader:1521:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1623:10)
    at Module.load (node:internal/modules/cjs/loader:1266:32)
    at Module._load (node:internal/modules/cjs/loader:1091:12)
    at Module.require (node:internal/modules/cjs/loader:1289:19)

Node.js v20.20.0
/home/itwveifv/bot.maxotp.site/server.js:131
`}};nk.AggregateError=Jee});var h8e=O(ak=>{"use strict";Object.defineProperty(ak,"__esModule",{value:!0});ak.Deferred=void 0;var Mdr=$ee(),ete=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 Mdr.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}};ak.Deferred=ete});var b8e=O(sk=>{"use strict";Object.defineProperty(sk,"__esModule",{value:!0});sk.Pool=void 0;var Edr=h8e(),ydr=Zee(),tte=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(),i,n=this._availableObjects.length,a=this.size-this.minSize,s;for(this._removeIdleScheduled=!1,i=0;i<n&&a>e.length;i++)s=this._availableObjects[i].timeout,r>=s&&(this._log("removeIdle() destroying obj - now:"+r+" timeout:"+s,"verbose"),e.push(this._availableObjects[i].resource));e.forEach(this.destroy,this),n=this._availableObjects.length,n>0?(this._log("this._availableObjects.length="+n,"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 i={resource:e,useCount:r,timeout:Date.now()+this.idleTimeoutMillis};this._availableObjects.push(i),this._dispense(),this._scheduleRemoveIdle()}_addResourceToInUseObjects(e,r){let i={resource:e,useCount:r};this._inUseObjects.push(i)}_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 Edr.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(n=>n.resource===e)){this._log("release called twice for the same resource: "+new Error().stack,"error");return}let r=this._inUseObjects.findIndex(n=>n.resource===e);if(r<0){this._log("attempt to release an invalid resource: "+new Error().stack,"error");return}let i=this._inUseObjects[r];i.useCount+=1,i.useCount>=this.maxUsesPerResource?(this._log("release() destroying obj - useCount:"+i.useCount+" maxUsesPerResource:"+this.maxUsesPerResource,"verbose"),this.destroy(i.resource),this._dispense()):(this._inUseObjects.splice(r,1),this._addResourceToAvailableObjects(i.resource,i.useCount))}async destroy(e){let r=this._availableObjects.length,i=this._inUseObjects.length;if(this._availableObjects=this._availableObjects.filter(n=>n.resource!==e),this._inUseObjects=this._inUseObjects.filter(n=>n.resource!==e),r===this._availableObjects.length&&i===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(i=>i.resource),r=[];for(let i of e)try{await this.destroy(i)}catch(n){this._log("Error destroying resource: "+n.stack,"error"),r.push(n)}if(r.length>0)throw new ydr.AggregateError(r)}};sk.Pool=tte});var _8e=O(ob=>{"use strict";Object.defineProperty(ob,"__esModule",{value:!0});ob.Pool=ob.AggregateError=ob.TimeoutError=void 0;var zdr=$ee();Object.defineProperty(ob,"TimeoutError",{enumerable:!0,get:function(){return zdr.TimeoutError}});var Rdr=Zee();Object.defineProperty(ob,"AggregateError",{enumerable:!0,get:function(){return Rdr.AggregateError}});var wdr=b8e();Object.defineProperty(ob,"Pool",{enumerable:!0,get:function(){return wdr.Pool}})});var ed=O((Mei,ok)=>{"use strict";var{Pool:rte,TimeoutError:Ndr}=_8e(),cb=fr(),ite=Zf(),vdr=fi(),{logger:Tdr}=Bn(),Idr=cM(),bp=Tdr.debugContext("pool"),q4=class{constructor(e,r){let i=cb.cloneDeep(r.config);if(this.sequelize=r,this.config=i,this.dialect=e,this.versionPromise=null,this.dialectName=this.sequelize.options.dialect,i.pool===!1)throw new Error("Support for pool:false was removed in v4.0");i.pool=cb.defaults(i.pool||{},{max:5,min:0,idle:1e4,acquire:6e4,evict:1e3,validate:this._validate.bind(this)}),this.initPools()}refreshTypeParser(e){cb.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(),bp("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 rte({name:"sequelize",create:()=>this._connect(e),destroy:async i=>{let n=await this._disconnect(i);return bp("connection destroy"),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}),bp(`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=cb.defaults(e.replication.write,cb.omit(e,"replication")),e.replication.read=e.replication.read.map(i=>cb.defaults(i,cb.omit(this.config,"replication")));let r=0;this.pool={release:i=>{i.queryType==="read"?this.pool.read.release(i):this.pool.write.release(i)},acquire:(i,n)=>(n=n===void 0?!1:n,i==="SELECT"&&!n?this.pool.read.acquire():this.pool.write.acquire()),destroy:i=>{this.pool[i.queryType].destroy(i),bp("connection destroy")},destroyAllNow:async()=>{await Promise.all([this.pool.read.destroyAllNow(),this.pool.write.destroyAllNow()]),bp("all connections destroyed")},drain:async()=>Promise.all([this.pool.write.drain(),this.pool.read.drain()]),read:new rte({name:"sequelize:read",create:async()=>{let i=r++%e.replication.read.length,n=await this._connect(e.replication.read[i]);return n.queryType="read",n},destroy:i=>this._disconnect(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}),write:new rte({name:"sequelize:write",create:async()=>{let i=await this._connect(e.replication.write);return i.queryType="write",i},destroy:i=>this._disconnect(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})},bp(`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 i=await this._connect(this.config.replication.write||this.config),n={};if(n.transaction={connection:i},n.logging=()=>{},n.logging.__testLoggingFn=!0,this.sequelize.options.databaseVersion===0){let a=await this.sequelize.databaseVersion(n),s=cb.get(ite.coerce(a),"version")||a;this.sequelize.options.databaseVersion=ite.valid(s)?s:this.dialect.defaultVersion}return ite.lt(this.sequelize.options.databaseVersion,this.dialect.defaultVersion)&&(Idr.unsupportedEngine(),bp(`Unsupported database engine version ${this.sequelize.options.databaseVersion}`)),this.versionPromise=null,await this._disconnect(i)}catch(i){throw this.versionPromise=null,i}})()),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(i){throw i instanceof Ndr?new vdr.ConnectionAcquireTimeoutError(i):i}return bp("connection acquired"),r}releaseConnection(e){this.pool.release(e),bp("connection released")}async destroyConnection(e){await this.pool.destroy(e),bp(`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}};ok.exports=q4;ok.exports.ConnectionManager=q4;ok.exports.default=q4});var iu=O((Eei,A8e)=>{"use strict";var C4=new Map;A8e.exports=t=>(C4.has(t)||C4.set(t,new Map),{clear(){C4.get(t).clear()},refresh(e){for(let r of e.types[t])C4.get(t).set(r,e.parse)},get(e){return C4.get(t).get(e)}})});var M8e=O((yei,uk)=>{"use strict";var Sdr=Object.defineProperty,m8e=Object.getOwnPropertySymbols,qdr=Object.prototype.hasOwnProperty,Cdr=Object.prototype.propertyIsEnumerable,O8e=(t,e,r)=>e in t?Sdr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,xdr=(t,e)=>{for(var r in e||(e={}))qdr.call(e,r)&&O8e(t,r,e[r]);if(m8e)for(var r of m8e(e))Cdr.call(e,r)&&O8e(t,r,e[r]);return t},Ldr=Zf(),kdr=ed(),fM=fi(),{logger:Ddr}=Bn(),Bdr=ri().mariadb,Pdr=up(),g8e=Ddr.debugContext("connection:mariadb"),ck=iu()("mariadb"),x4=class t extends kdr{constructor(e,r){r.config.port=r.config.port||3306,super(e,r),this.lib=this._loadDialectModule("mariadb"),this.refreshTypeParser(Bdr)}static _typecast(e,r){return ck.get(e.type)?ck.get(e.type)(e,this.sequelize.options,r):r()}_refreshTypeParser(e){ck.refresh(e)}_clearTypeParser(){ck.clear()}async connect(e){let r=this.sequelize.options.timezone;r=/\//.test(r)?Pdr.tz(r).format("Z"):r;let i=xdr({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||(i.initSql?(Array.isArray(i.initSql)||(i.initSql=[i.initSql]),i.initSql.push(`SET time_zone = '${r}'`)):i.initSql=`SET time_zone = '${r}'`);try{let n=await this.lib.createConnection(i);return this.sequelize.options.databaseVersion=Ldr.coerce(n.serverVersion()).version,g8e("connection acquired"),n.on("error",a=>{switch(a.code){case"ESOCKET":case"ECONNRESET":case"EPIPE":case"PROTOCOL_CONNECTION_LOST":this.pool.destroy(n)}}),n}catch(n){switch(n.code){case"ECONNREFUSED":throw new fM.ConnectionRefusedError(n);case"ER_ACCESS_DENIED_ERROR":case"ER_ACCESS_DENIED_NO_PASSWORD_ERROR":throw new fM.AccessDeniedError(n);case"ENOTFOUND":throw new fM.HostNotFoundError(n);case"EHOSTUNREACH":case"ENETUNREACH":case"EADDRNOTAVAIL":throw new fM.HostNotReachableError(n);case"EINVAL":throw new fM.InvalidConnectionError(n);default:throw new fM.ConnectionError(n)}}}async disconnect(e){if(!e.isValid()){g8e("connection tried to disconnect but was already at CLOSED state");return}return await e.end()}validate(e){return e&&e.isValid()}};uk.exports=x4;uk.exports.ConnectionManager=x4;uk.exports.default=x4});var td=O((zei,lk)=>{"use strict";var Wdr=Object.defineProperty,E8e=Object.getOwnPropertySymbols,Udr=Object.prototype.hasOwnProperty,Fdr=Object.prototype.propertyIsEnumerable,y8e=(t,e,r)=>e in t?Wdr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,jdr=(t,e)=>{for(var r in e||(e={}))Udr.call(e,r)&&y8e(t,r,e[r]);if(E8e)for(var r of E8e(e))Fdr.call(e,r)&&y8e(t,r,e[r]);return t},ub=fr(),Gdr=a4(),hc=yo(),Hdr=gL(),Qdr=cM(),Vdr=(rM(),Yl(tM)).v4,{safeStringifyJson:z8e}=wi(),L4=class t{constructor(e,r,i){this.uuid=Vdr(),this.connection=e,this.instance=i.instance,this.model=i.model,this.sequelize=r,this.options=jdr({plain:!1,raw:!1,logging:console.log},i),this.checkLoggingOption(),i.rawErrors&&(this.formatError=t.prototype.formatError)}static formatBindParameters(e,r,i,n,a){if(!r)return[e,[]];if(a=a||{},typeof n!="function"&&(a=n||{},n=void 0),!n)a.skipValueReplace?n=(c,l,p)=>{if(p[l]!==void 0)return c}:n=(c,l,p,f,d)=>{if(p[l]!==void 0)return Gdr.escape(p[l],f,d)};else if(a.skipValueReplace){let c=n;n=(l,p,f,d,h,_)=>{if(c(l,p,f,d,h,_)!==void 0)return l}}let s=null,o=Array.isArray(r);return e=e.replace(/\B\$(\$|\w+)/g,(c,l)=>{if(l==="$")return a.skipUnescape?c:l;let p;if(o?l.match(/^[1-9]\d*$/)&&(l=l-1,p=n(c,l,r,s,i,a)):l.match(/^\d*$/)||(p=n(c,l,r,s,i,a)),p===void 0)throw new Error(`Named bind parameter "${c}" 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&&(Qdr.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 i of Object.keys(this.model.uniqueKeys))this.model.uniqueKeys[i].fields.includes(e.replace(/"/g,""))&&this.model.uniqueKeys[i].msg&&(r=this.model.uniqueKeys[i].msg);return r}isRawQuery(){return this.options.type===hc.RAW}isVersionQuery(){return this.options.type===hc.VERSION}isUpsertQuery(){return this.options.type===hc.UPSERT}isInsertQuery(e,r){let i=!0;return this.options.type===hc.INSERT?!0:(i=i&&this.sql.toLowerCase().startsWith("insert into"),i=i&&(!e||Object.prototype.hasOwnProperty.call(e,this.getInsertIdField())),i=i&&(!r||Object.prototype.hasOwnProperty.call(r,this.getInsertIdField())),i)}handleInsertQuery(e,r){if(this.instance){let i=this.model.autoIncrementAttribute,n=null;n=n||e&&e[this.getInsertIdField()],n=n||r&&r[this.getInsertIdField()],this.instance[i]=n}}isShowTablesQuery(){return this.options.type===hc.SHOWTABLES}handleShowTablesQuery(e){return ub.flatten(e.map(r=>Object.values(r)))}isShowIndexesQuery(){return this.options.type===hc.SHOWINDEXES}isShowConstraintsQuery(){return this.options.type===hc.SHOWCONSTRAINTS}isDescribeQuery(){return this.options.type===hc.DESCRIBE}isSelectQuery(){return this.options.type===hc.SELECT}isBulkUpdateQuery(){return this.options.type===hc.BULKUPDATE}isBulkDeleteQuery(){return this.options.type===hc.BULKDELETE}isForeignKeysQuery(){return this.options.type===hc.FOREIGNKEYS}isUpdateQuery(){return this.options.type===hc.UPDATE}handleSelectQuery(e){let r=null;if(this.options.fieldMap){let i=this.options.fieldMap;e=e.map(n=>ub.reduce(i,(a,s,o)=>(a[o]!==void 0&&s!==o&&(a[s]=a[o],delete a[o]),a),n))}return this.options.raw?r=e.map(i=>{let n={};for(let a in i)Object.prototype.hasOwnProperty.call(i,a)&&(n[a]=i[a]);return this.options.nest&&(n=Hdr.transform(n)),n}):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,i){let{connection:n,options:a}=this,s=this.sequelize.options.benchmark||a.benchmark,o=this.sequelize.options.logQueryParameters||a.logQueryParameters,c=Date.now(),l="";if(o&&i){let d=e.endsWith(";")?"":";",h;Array.isArray(i)?h=i.map(_=>z8e(_)).join(", "):h=z8e(i),l=`${d} ${h}`}let p=`(${n.uuid||"default"}): ${e}${l}`,f=`Executing ${p}`;return r(f),s||this.sequelize.log(`Executing ${p}`,a),()=>{let d=`Executed ${p}`;r(d),s&&this.sequelize.log(d,Date.now()-c,a)}}static _groupJoinData(e,r,i){if(!e.length)return[];let n,a,s,o,c,l,p=e.length,f,d,h,_,m,E,R,N,T=i.checkExisting,I,W,D,F=T?[]:new Array(p),x={},H={},$,k,oe,j,B,V,X,_e,he=se=>{Object.prototype.hasOwnProperty.call(V.includeMap,se)&&(H[d]=V=V.includeMap[se],_e?_e=`${_e}.${se}`:_e=se,H[_e]=V)},ce={},Re=(se,Ee)=>(Object.prototype.hasOwnProperty.call(Ee,se)||(Ee[se]=se.substr(0,se.lastIndexOf("."))),Ee[se]),Te={},Ce=se=>{if(!Object.prototype.hasOwnProperty.call(Te,se)){let Ee=se.lastIndexOf(".");Te[se]=se.substr(Ee===-1?0:Ee+1)}return Te[se]},te={},de=se=>{if(!Object.prototype.hasOwnProperty.call(te,se)){let Ee=Re(se,ce);Object.prototype.hasOwnProperty.call(te,Ee)||(te[Ee]=Ee?Ee.split("."):[]),te[se]=te[Ee]}return te[se]},ze={},Oe=se=>{if(!Object.prototype.hasOwnProperty.call(ze,se)){let Ee=de(se),Ie=Ee.length;ze[se]=Ie?Ee[Ie-1]:""}return ze[se]},ke=se=>{let Ee=ub.chain(se.uniqueKeys);return Ee=Ee.result(`${Ee.findKey()}.fields`).map(Ie=>ub.findKey(se.attributes,Pe=>Pe.field===Ie)).value(),Ee},$e=se=>se instanceof Buffer?se.toString("hex"):se,Se,nt,xe;for(c=0;c<p;c++){if(l=e[c],c===0&&(f=ub.sortBy(Object.keys(l),se=>[se.split(".").length]),_=f.length),T){if(N=!1,o=r.model.primaryKeyAttributes.length,D="",o===1)D=$e(l[r.model.primaryKeyAttributes[0]]);else if(o>1)for(s=0;s<o;s++)D+=$e(l[r.model.primaryKeyAttributes[s]]);else if(!ub.isEmpty(r.model.uniqueKeys))for(nt=ke(r.model),s=0;s<nt.length;s++)D+=l[nt[s]]}for(R=E={},j=void 0,h=0;h<_;h++){if(d=f[h],k=Re(d,ce),$=de(d),c===0&&!Object.prototype.hasOwnProperty.call(H,d)&&($.length?(V=r,_e=void 0,$.forEach(he)):H[d]=H[""]=r),j!==void 0&&j!==$){if(T){if(a=j.length,X=null,W=null,a)for(n=0;n<a;n++){if(xe=X?`${X}.${j[n]}`:j[n],Se=H[xe].model.primaryKeyAttributes,o=Se.length,I=xe,o===1)I+=$e(l[`${xe}.${Se[0]}`]);else if(o>1)for(s=0;s<o;s++)I+=$e(l[`${xe}.${Se[s]}`]);else if(!ub.isEmpty(H[xe].model.uniqueKeys))for(nt=ke(H[xe].model),s=0;s<nt.length;s++)I+=l[`${xe}.${nt[s]}`];W||(W=D),I=W+I,X=xe,n<a-1&&(W=I)}else I=D;I===D?x[I]?N=!0:x[I]=E:x[I]||(X=x[W],B=Oe(m),H[m].association.isSingleAssociation?X&&(X[B]=x[I]=E):(X[B]||(X[B]=[]),X[B].push(x[I]=E))),E={}}else if(V=R,a=$.length,a)for(n=0;n<a;n++)n===a-1&&(E=V[$[n]]={}),V=V[$[n]]||{}}E[Ce(d)]=l[d],m=d,j=$,oe=k}if(T){if(a=j.length,X=null,W=null,a)for(n=0;n<a;n++){if(xe=X?`${X}.${j[n]}`:j[n],Se=H[xe].model.primaryKeyAttributes,o=Se.length,I=xe,o===1)I+=$e(l[`${xe}.${Se[0]}`]);else if(o>0)for(s=0;s<o;s++)I+=$e(l[`${xe}.${Se[s]}`]);else if(!ub.isEmpty(H[xe].model.uniqueKeys))for(nt=ke(H[xe].model),s=0;s<nt.length;s++)I+=l[`${xe}.${nt[s]}`];W||(W=D),I=W+I,X=xe,n<a-1&&(W=I)}else I=D;I===D?x[I]?N=!0:x[I]=E:x[I]||(X=x[W],B=Oe(m),H[m].association.isSingleAssociation?X&&(X[B]=x[I]=E):(X[B]||(X[B]=[]),X[B].push(x[I]=E))),N||F.push(R)}else F[c]=R}return F}};lk.exports=L4;lk.exports.AbstractQuery=L4;lk.exports.default=L4});var q8e=O((Rei,S8e)=>{"use strict";var Ydr=Object.defineProperty,R8e=Object.getOwnPropertySymbols,Xdr=Object.prototype.hasOwnProperty,Kdr=Object.prototype.propertyIsEnumerable,w8e=(t,e,r)=>e in t?Ydr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,$dr=(t,e)=>{for(var r in e||(e={}))Xdr.call(e,r)&&w8e(t,r,e[r]);if(R8e)for(var r of R8e(e))Kdr.call(e,r)&&w8e(t,r,e[r]);return t},N8e=td(),pk=fi(),v8e=fr(),nte=ri(),{logger:Jdr}=Bn(),Zdr=1062,ehr=1213,T8e=1451,thr=1452,I8e=Jdr.debugContext("sql:mariadb"),ate=class extends N8e{constructor(e,r,i){super(e,r,$dr({showWarnings:!1},i))}static formatBindParameters(e,r,i){let n=[],a=(s,o,c)=>{if(c[o]!==void 0)return n.push(c[o]),"?"};return e=N8e.formatBindParameters(e,r,i,a)[0],[e,n.length>0?n:void 0]}async run(e,r){this.sql=e;let{connection:i,options:n}=this,a=this.sequelize.options.showWarnings||n.showWarnings,s=this._logQuery(e,I8e,r);r&&I8e("parameters(%j)",r);let o,c=new Error;try{o=await i.query(this.sql,r)}catch(l){if(n.transaction&&l.errno===ehr){try{await n.transaction.rollback()}catch{}n.transaction.finished="rollback"}throw l.sql=e,l.parameters=r,this.formatError(l,c.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 i=e[this.getInsertIdField()];r=new Array(e.affectedRows);let n=this.model.rawAttributes[this.model.primaryKeyAttribute].field;for(let a=0;a<e.affectedRows;a++)r[a]={[n]:i+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 i=e.meta;return delete e.meta,[e,i]}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 i of e)r[i.Field]={type:i.Type.toLowerCase().startsWith("enum")?i.Type.replace(/^enum/i,"ENUM"):i.Type.toUpperCase(),allowNull:i.Null==="YES",defaultValue:i.Default,primaryKey:i.Key==="PRI",autoIncrement:Object.prototype.hasOwnProperty.call(i,"Extra")&&i.Extra.toLowerCase()==="auto_increment",comment:i.Comment?i.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 i=this.model.fieldRawAttributesMap[r];i.type instanceof nte.JSON&&(e=e.map(n=>(n[i.fieldName]&&typeof n[i.fieldName]=="string"&&!this.connection.info.hasMinVersion(10,5,2)&&(n[i.fieldName]=JSON.parse(n[i.fieldName])),nte.JSON.parse?nte.JSON.parse(i,this.sequelize.options,n[i.fieldName]):n)))}}async logWarnings(e){let r=await this.run("SHOW WARNINGS"),i=`MariaDB Warnings (${this.connection.uuid||"default"}): `,n=[];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"))n.push(s.Message);else for(let o of s.keys())n.push([o,s[o]].join(": "));return this.sequelize.log(i+n.join("; "),this.options),e}formatError(e,r){switch(e.errno){case Zdr:{let i=e.message.match(/Duplicate entry '([\s\S]*)' for key '?((.|\s)*?)'?\s.*$/),n={},a="Validation error",s=i?i[1].split("-"):void 0,o=i?i[2]:void 0,c=i?i[1]:void 0,l=this.model&&this.model.uniqueKeys[o];l?(l.msg&&(a=l.msg),n=v8e.zipObject(l.fields,s)):n[o]=c;let p=[];return v8e.forOwn(n,(f,d)=>{p.push(new pk.ValidationErrorItem(this.getUniqueConstraintErrorMessage(d),"unique violation",d,f,this.instance,"not_unique"))}),new pk.UniqueConstraintError({message:a,errors:p,parent:e,fields:n,stack:r})}case T8e:case thr:{let i=e.message.match(/CONSTRAINT ([`"])(.*)\1 FOREIGN KEY \(\1(.*)\1\) REFERENCES \1(.*)\1 \(\1(.*)\1\)/),n=i?i[1]:"`",a=i?i[3].split(new RegExp(`${n}, *${n}`)):void 0;return new pk.ForeignKeyConstraintError({reltype:e.errno===T8e?"parent":"child",table:i?i[4]:void 0,fields:a,value:a&&a.length&&this.instance&&this.instance[a[0]]||void 0,index:i?i[2]:void 0,parent:e,stack:r})}default:return new pk.DatabaseError(e,{stack:r})}}handleShowTablesQuery(e){return e.map(r=>({tableName:r.TABLE_NAME,schema:r.TABLE_SCHEMA}))}handleShowIndexesQuery(e){let r,i=[];return e.forEach(n=>{(!r||r.name!==n.Key_name)&&(r={primary:n.Key_name==="PRIMARY",fields:[],name:n.Key_name,tableName:n.Table,unique:n.Non_unique!==1,type:n.Index_type},i.push(r)),r.fields[n.Seq_in_index-1]={attribute:n.Column_name,length:n.Sub_part||void 0,order:n.Collation==="A"?"ASC":void 0}}),i}};S8e.exports=ate});var k8e=O((wei,L8e)=>{"use strict";var rhr=Object.defineProperty,C8e=Object.getOwnPropertySymbols,ihr=Object.prototype.hasOwnProperty,nhr=Object.prototype.propertyIsEnumerable,x8e=(t,e,r)=>e in t?rhr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,ahr=(t,e)=>{for(var r in e||(e={}))ihr.call(e,r)&&x8e(t,r,e[r]);if(C8e)for(var r of C8e(e))nhr.call(e,r)&&x8e(t,r,e[r]);return t},fk=fr(),a0=Hs(),shr=wi(),ohr={OperatorMap:{[a0.eq]:"=",[a0.ne]:"!=",[a0.gte]:">=",[a0.gt]:">",[a0.lte]:"<=",[a0.lt]:"<",[a0.not]:"IS NOT",[a0.is]:"IS",[a0.in]:"IN",[a0.notIn]:"NOT IN",[a0.like]:"LIKE",[a0.notLike]:"NOT LIKE",[a0.iLike]:"ILIKE",[a0.notILike]:"NOT ILIKE",[a0.startsWith]:"LIKE",[a0.endsWith]:"LIKE",[a0.substring]:"LIKE",[a0.regexp]:"~",[a0.notRegexp]:"!~",[a0.iRegexp]:"~*",[a0.notIRegexp]:"!~*",[a0.between]:"BETWEEN",[a0.notBetween]:"NOT BETWEEN",[a0.overlap]:"&&",[a0.contains]:"@>",[a0.contained]:"<@",[a0.adjacent]:"-|-",[a0.strictLeft]:"<<",[a0.strictRight]:">>",[a0.noExtendRight]:"&<",[a0.noExtendLeft]:"&>",[a0.any]:"ANY",[a0.all]:"ALL",[a0.and]:" AND ",[a0.or]:" OR ",[a0.col]:"COL",[a0.placeholder]:"$$PLACEHOLDER$$",[a0.match]:"@@"},OperatorsAliasMap:{},setOperatorsAliases(t){!t||fk.isEmpty(t)?this.OperatorsAliasMap=!1:this.OperatorsAliasMap=ahr({},t)},_replaceAliases(t){let e={};return this.OperatorsAliasMap?(shr.getOperators(t).forEach(r=>{let i=t[r];fk.isPlainObject(i)?e[r]=this._replaceAliases(i):e[r]=i}),fk.forOwn(t,(r,i)=>{i=this.OperatorsAliasMap[i]||i,fk.isPlainObject(r)&&(r=this._replaceAliases(r)),e[i]=r}),e):t}};L8e.exports=ohr});var B8e=O((Nei,D8e)=>{"use strict";var chr=(rM(),Yl(tM)).v4,uhr={setIsolationLevelQuery(t,e){if(!e.parent)return`SET TRANSACTION ISOLATION LEVEL ${t};`},generateTransactionId(){return chr()},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;"}};D8e.exports=uhr});var lb=O((Tei,j8e)=>{"use strict";var lhr=Object.defineProperty,phr=Object.defineProperties,fhr=Object.getOwnPropertyDescriptors,P8e=Object.getOwnPropertySymbols,dhr=Object.prototype.hasOwnProperty,hhr=Object.prototype.propertyIsEnumerable,W8e=(t,e,r)=>e in t?lhr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,hA=(t,e)=>{for(var r in e||(e={}))dhr.call(e,r)&&W8e(t,r,e[r]);if(P8e)for(var r of P8e(e))hhr.call(e,r)&&W8e(t,r,e[r]);return t},dk=(t,e)=>phr(t,fhr(e)),hk=require("util"),Zr=fr(),bhr=(rM(),Yl(tM)).v4,Wt=wi(),vei=cM(),U8e=a4(),dM=ri(),Zu=Aee(),hM=nb(),ste=ab(),_hr=aM(),Ahr=cA(),Nt=Hs(),ote=fi(),F8e=Nee(),mhr=new Set(["integer","int","smallint","bigint","float","real","double precision","decimal","numeric","boolean","text","char","varchar","nvarchar","date","timestamp","timestamptz","datetime","json","jsonb","signed","unsigned"]),k4=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:Zr.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,i){return`DESCRIBE ${this.quoteTable(this.addSchema({tableName:e,_schema:r,_schemaDelimiter:i}))};`}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,i,n){n=n||{},Zr.defaults(n,this.options);let a={},s=n.bind||[],o=[],c=[],l=[],p=[],f=this.quoteTable(e),d=n.bindParam===void 0?this.bindParam(s):n.bindParam,h=[],_,m="",E="",R="",N="",T=!1,I="";if(i&&Zr.each(i,(x,H)=>{a[H]=x,x.field&&(a[x.field]=x)}),this._dialect.supports["DEFAULT VALUES"]?E+=" DEFAULT VALUES":this._dialect.supports["VALUES ()"]&&(E+=" VALUES ()"),(this._dialect.supports.returnValues||this._dialect.supports.returnIntoValues)&&n.returning){let x=this.generateReturnValues(i,n);c.push(...x.returnFields),this._dialect.supports.returnIntoValues&&l.push(...x.returnTypes),N=x.returningFragment,I=x.tmpTable||"",R=x.outputFragment||""}(Zr.get(this,["sequelize","options","dialectOptions","prependSearchPath"])||n.searchPath)&&(n.bindParam=!1),this._dialect.supports.EXCEPTION&&n.exception&&(n.bindParam=!1),r=Wt.removeNullValuesFromHash(r,this.options.omitNull);for(let x in r)if(Object.prototype.hasOwnProperty.call(r,x)){let H=r[x];o.push(this.quoteIdentifier(x)),a&&a[x]&&a[x].autoIncrement===!0&&H==null?this._dialect.supports.autoIncrement.defaultValue?this._dialect.supports.DEFAULT?p.push("DEFAULT"):p.push(this.escape(null)):o.splice(-1,1):(a&&a[x]&&a[x].autoIncrement===!0&&(T=!0),H instanceof Wt.SequelizeMethod||n.bindParam===!1?p.push(this.escape(H,a&&a[x]||void 0,{context:"INSERT"})):p.push(this.format(H,a&&a[x]||void 0,{context:"INSERT"},d)))}let W="";if(!Zr.isEmpty(n.conflictWhere)&&!this._dialect.supports.inserts.onConflictWhere)throw new Error("missing dialect support for conflictWhere option");if(this._dialect.supports.inserts.updateOnDuplicate&&n.updateOnDuplicate)if(this._dialect.supports.inserts.updateOnDuplicate==" ON CONFLICT DO UPDATE SET"){let x=n.upsertKeys.map(k=>this.quoteIdentifier(k)),H=n.updateOnDuplicate.map(k=>`${this.quoteIdentifier(k)}=EXCLUDED.${this.quoteIdentifier(k)}`),$=["ON CONFLICT","(",x.join(","),")"];Zr.isEmpty(n.conflictWhere)||$.push(this.whereQuery(n.conflictWhere,n)),Zr.isEmpty(H)?$.push("DO NOTHING"):$.push("DO UPDATE SET",H.join(",")),W=` ${Wt.joinSQLFragments($)}`}else{let x=n.updateOnDuplicate.map(H=>`${this.quoteIdentifier(H)}=VALUES(${this.quoteIdentifier(H)})`);if(Zr.isEmpty(x)&&n.upsertKeys&&x.push(...n.upsertKeys.map(H=>`${this.quoteIdentifier(H)}=${this.quoteIdentifier(H)}`)),Zr.isEmpty(x))throw new Error("No update values found for ON DUPLICATE KEY UPDATE clause, and no identifier fields could be found to use instead.");W+=`${this._dialect.supports.inserts.updateOnDuplicate} ${x.join(",")}`}let D={ignoreDuplicates:n.ignoreDuplicates?this._dialect.supports.inserts.ignoreDuplicates:"",onConflictDoNothing:n.ignoreDuplicates?this._dialect.supports.inserts.onConflictDoNothing:"",attributes:o.join(","),output:R,values:p.join(","),tmpTable:I};if(m=`${I}INSERT${D.ignoreDuplicates} INTO ${f} (${D.attributes})${D.output} VALUES (${D.values})${W}${D.onConflictDoNothing}${m}`,E=`${I}INSERT${D.ignoreDuplicates} INTO ${f}${D.output}${W}${D.onConflictDoNothing}${E}`,this._dialect.supports.EXCEPTION&&n.exception){let x="DROP FUNCTION IF EXISTS pg_temp.testfunc()";c.length===0&&c.push("*");let H=`$func_${bhr().replace(/-/g,"")}$`,$=`SELECT (testfunc.response).${c.join(", (testfunc.response).")}, testfunc.sequelize_caught_exception FROM pg_temp.testfunc();`;n.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 ${H} BEGIN ${m} RETURNING * INTO response; EXCEPTION ${n.exception} END ${H} LANGUAGE plpgsql; ${$} ${x}`}else m+=N,E+=N;this._dialect.supports.returnIntoValues&&n.returning&&this.populateInsertQueryReturnIntoBinds(c,l,s.length,h,n),_=`${D.attributes.length?m:E}${h.join(",")};`,this._dialect.supports.finalTable&&(_=`SELECT * FROM FINAL TABLE(${D.attributes.length?m:E});`),T&&this._dialect.supports.autoIncrement.identityInsert&&(_=`SET IDENTITY_INSERT ${f} ON; ${_} SET IDENTITY_INSERT ${f} OFF;`);let F={query:_};return n.bindParam!==!1&&(F.bind=s),F}bulkInsertQuery(e,r,i,n){i=i||{},n=n||{};let a=[],s={},o=[],c="";for(let h of r)Zr.forOwn(h,(_,m)=>{o.includes(m)||o.push(m),n[m]&&n[m].autoIncrement===!0&&(s[m]=!0)});for(let h of r){let _=o.map(m=>this._dialect.supports.bulkDefault&&s[m]===!0?h[m]!=null?h[m]:"DEFAULT":this.escape(h[m],n[m],{context:"INSERT"}));a.push(`(${_.join(",")})`)}if(this._dialect.supports.inserts.updateOnDuplicate&&i.updateOnDuplicate)if(this._dialect.supports.inserts.updateOnDuplicate==" ON CONFLICT DO UPDATE SET"){let h=i.upsertKeys.map(E=>this.quoteIdentifier(E)),_=i.updateOnDuplicate.map(E=>`${this.quoteIdentifier(E)}=EXCLUDED.${this.quoteIdentifier(E)}`),m=!1;if(i.conflictWhere){if(!this._dialect.supports.inserts.onConflictWhere)throw new Error(`conflictWhere not supported for dialect ${this._dialect.name}`);m=this.whereQuery(i.conflictWhere,i)}c=["ON CONFLICT","(",h.join(","),")",m,"DO UPDATE SET",_.join(",")]}else{if(i.conflictWhere)throw new Error(`conflictWhere not supported for dialect ${this._dialect.name}`);let h=i.updateOnDuplicate.map(_=>`${this.quoteIdentifier(_)}=VALUES(${this.quoteIdentifier(_)})`);c=`${this._dialect.supports.inserts.updateOnDuplicate} ${h.join(",")}`}let l=i.ignoreDuplicates?this._dialect.supports.inserts.ignoreDuplicates:"",p=o.map(h=>this.quoteIdentifier(h)).join(","),f=i.ignoreDuplicates?this._dialect.supports.inserts.onConflictDoNothing:"",d="";if(this._dialect.supports.returnValues&&i.returning){let h=this.generateReturnValues(n,i);d+=h.returningFragment}return Wt.joinSQLFragments(["INSERT",l,"INTO",this.quoteTable(e),`(${p})`,"VALUES",a.join(","),c,f,d,";"])}updateQuery(e,r,i,n,a){n=n||{},Zr.defaults(n,this.options),r=Wt.removeNullValuesFromHash(r,n.omitNull,n);let s=[],o=[],c={},l="",p="",f="";(Zr.get(this,["sequelize","options","dialectOptions","prependSearchPath"])||n.searchPath)&&(n.bindParam=!1);let d=n.bindParam===void 0?this.bindParam(o):n.bindParam;if(this._dialect.supports["LIMIT ON UPDATE"]&&n.limit&&(["mssql","db2","oracle"].includes(this.dialect)?this.dialect==="oracle"&&(i&&(i.length&&i.length>0||Object.keys(i).length>0)?f+=" AND ":f+=" WHERE ",f+=`rownum <= ${this.escape(n.limit)} `):f=` LIMIT ${this.escape(n.limit)} `),this._dialect.supports.returnValues&&n.returning){let E=this.generateReturnValues(a,n);f+=E.returningFragment,p=E.tmpTable||"",l=E.outputFragment||"",!this._dialect.supports.returnValues.output&&n.returning&&(n.mapToModel=!0)}a&&Zr.each(a,(E,R)=>{c[R]=E,E.field&&(c[E.field]=E)});for(let E in r){if(c&&c[E]&&c[E].autoIncrement===!0&&!this._dialect.supports.autoIncrement.update)continue;let R=r[E];R instanceof Wt.SequelizeMethod||n.bindParam===!1?s.push(`${this.quoteIdentifier(E)}=${this.escape(R,c&&c[E]||void 0,{context:"UPDATE"})}`):s.push(`${this.quoteIdentifier(E)}=${this.format(R,c&&c[E]||void 0,{context:"UPDATE"},d)}`)}let h=dk(hA({},n),{bindParam:d});if(s.length===0)return"";let m={query:`${p}UPDATE ${this.quoteTable(e)} SET ${s.join(",")}${l} ${this.whereQuery(i,h)}${f}`.trim()};return n.bindParam!==!1&&(m.bind=o),m}arithmeticQuery(e,r,i,n,a,s){s=s||{},Zr.defaults(s,{returning:!0}),a=Wt.removeNullValuesFromHash(a,this.options.omitNull);let o="",c="";if(this._dialect.supports.returnValues&&s.returning){let p=this.generateReturnValues(null,s);o=p.outputFragment,c=p.returningFragment}let l=[];for(let p in n){let f=n[p],d=this.quoteIdentifier(p),h=this.escape(f);l.push(`${d}=${d}${e} ${h}`)}for(let p in a){let f=a[p],d=this.quoteIdentifier(p),h=this.escape(f);l.push(`${d}=${h}`)}return Wt.joinSQLFragments(["UPDATE",this.quoteTable(r),"SET",l.join(","),o,this.whereQuery(i),c])}addIndexQuery(e,r,i,n){i=i||{},Array.isArray(r)?i.fields=r:(i=r,r=void 0),i.prefix=i.prefix||n||e,i.prefix&&typeof i.prefix=="string"&&(i.prefix=i.prefix.replace(/\./g,"_"),i.prefix=i.prefix.replace(/("|')/g,""));let a=i.fields.map(c=>{if(c instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(c);typeof c=="string"&&(c={name:c});let l="";if(c.attribute&&(c.name=c.attribute),!c.name)throw new Error(`The following index field has no name: ${hk.inspect(c)}`);if(l+=this.quoteIdentifier(c.name),this._dialect.supports.index.collate&&c.collate&&(l+=` COLLATE ${this.quoteIdentifier(c.collate)}`),this._dialect.supports.index.operator){let p=c.operator||i.operator;p&&(l+=` ${p}`)}return this._dialect.supports.index.length&&c.length&&(l+=`(${c.length})`),c.order&&(l+=` ${c.order}`),l});i.name||(i=Wt.nameIndex(i,i.prefix)),i=Zu._conformIndex(i),this._dialect.supports.index.type||delete i.type,i.where&&(i.where=this.whereQuery(i.where)),typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e);let s=this._dialect.supports.index.concurrently&&i.concurrently?"CONCURRENTLY":void 0,o;return this._dialect.supports.indexViaAlter?o=["ALTER TABLE",e,s,"ADD"]:o=["CREATE"],o=o.concat(i.unique?"UNIQUE":"",i.type,"INDEX",this._dialect.supports.indexViaAlter?void 0:s,this.quoteIdentifiers(i.name),this._dialect.supports.index.using===1&&i.using?`USING ${i.using}`:"",this._dialect.supports.indexViaAlter?void 0:`ON ${e}`,this._dialect.supports.index.using===2&&i.using?`USING ${i.using}`:"",`(${a.join(", ")})`,this._dialect.supports.index.parser&&i.parser?`WITH PARSER ${i.parser}`:void 0,this._dialect.supports.index.where&&i.where?i.where:void 0),Zr.compact(o).join(" ")}addConstraintQuery(e,r){return typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e),Wt.joinSQLFragments(["ALTER TABLE",e,"ADD",this.getConstraintSnippet(e,r||{}),";"])}getConstraintSnippet(e,r){let i,n,a=r.fields.map(c=>{if(typeof c=="string")return this.quoteIdentifier(c);if(c instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(c);if(c.attribute&&(c.name=c.attribute),!c.name)throw new Error(`The following index field has no name: ${c}`);return this.quoteIdentifier(c.name)}),s=a.join(", "),o=a.join("_");switch(r.type.toUpperCase()){case"UNIQUE":n=this.quoteIdentifier(r.name||`${e}_${o}_uk`),i=`CONSTRAINT ${n} UNIQUE (${s})`;break;case"CHECK":r.where=this.whereItemsQuery(r.where),n=this.quoteIdentifier(r.name||`${e}_${o}_ck`),i=`CONSTRAINT ${n} 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.");n=this.quoteIdentifier(r.name||`${e}_${o}_df`),i=`CONSTRAINT ${n} DEFAULT (${this.escape(r.defaultValue)}) FOR ${a[0]}`;break;case"PRIMARY KEY":n=this.quoteIdentifier(r.name||`${e}_${o}_pk`),i=`CONSTRAINT ${n} PRIMARY KEY (${s})`;break;case"FOREIGN KEY":let c=r.references;if(!c||!c.table||!(c.field||c.fields))throw new Error("references object with table and field must be specified");n=this.quoteIdentifier(r.name||`${e}_${o}_${c.table}_fk`);let l=typeof c.field<"u"?this.quoteIdentifier(c.field):c.fields.map(f=>this.quoteIdentifier(f)).join(", "),p=`${this.quoteTable(c.table)} (${l})`;i=`CONSTRAINT ${n} `,i+=`FOREIGN KEY (${s}) REFERENCES ${p}`,r.onUpdate&&(i+=` ON UPDATE ${r.onUpdate.toUpperCase()}`),r.onDelete&&(i+=` 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())&&(i+=` ${this.deferConstraintsQuery(r)}`),i}removeConstraintQuery(e,r){return typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e),Wt.joinSQLFragments(["ALTER TABLE",e,"DROP CONSTRAINT",this.quoteIdentifiers(r)])}quote(e,r,i){let n=["ASC","DESC","ASC NULLS LAST","DESC NULLS LAST","ASC NULLS FIRST","DESC NULLS FIRST","NULLS FIRST","NULLS LAST"];if(i=i||".",typeof e=="string")return this.quoteIdentifiers(e);if(Array.isArray(e)){e.forEach((p,f)=>{let d=e[f-1],h,_;if(!d&&r!==void 0?_=r:d&&d instanceof hM&&(h=d,_=d.target),_&&_.prototype instanceof Zu){let m,E;if(typeof p=="function"&&p.prototype instanceof Zu?m=p:Zr.isPlainObject(p)&&p.model&&p.model.prototype instanceof Zu&&(m=p.model,E=p.as),m&&(!E&&h&&h instanceof hM&&h.through&&h.through.model===m?p=new hM(_,m,{as:m.name}):(p=_.getAssociationForAlias(m,E),p||(p=_.getAssociationForAlias(m,m.name))),!(p instanceof hM)))throw new Error(hk.format("Unable to find a valid association for model, '%s'",m.name))}if(typeof p=="string"){let m=n.indexOf(p.toUpperCase());if(f>0&&m!==-1)p=this.sequelize.literal(` ${n[m]}`);else if(_&&_.prototype instanceof Zu){if(_.associations!==void 0&&_.associations[p])p=_.associations[p];else if(_.rawAttributes!==void 0&&_.rawAttributes[p]&&p!==_.rawAttributes[p].field)p=_.rawAttributes[p].field;else if(p.includes(".")&&_.rawAttributes!==void 0){let E=p.split(".");if(_.rawAttributes[E[0]].type instanceof dM.JSON){let R=this.quoteIdentifiers(`${_.name}.${_.rawAttributes[E[0]].field}`),N=E.slice(1);p=this.jsonPathExtractionQuery(R,N),p=this.sequelize.literal(p)}}}}e[f]=p},this);let a=e.length,s=[],o,c=0;for(c=0;c<a-1&&(o=e[c],!(typeof o=="string"||o._modelAttribute||o instanceof Wt.SequelizeMethod));c++)o instanceof hM&&(s[c]=o.as);let l="";return c>0?l+=`${this.quoteIdentifier(s.join(i))}.`:typeof e[0]=="string"&&r&&(l+=`${this.quoteIdentifier(r.name)}.`),e.slice(c).forEach(p=>{l+=this.quote(p,r,i)},this),l}if(e._modelAttribute)return`${this.quoteTable(e.Model.name)}.${this.quoteIdentifier(e.fieldName)}`;if(e instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(e);throw Zr.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: ${hk.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("->"),i=e[e.length-1];return`${this.quoteIdentifier(r)}.${this.quoteIdentifier(i)}`}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 i="";return r===!0&&(r=e.as||e.name||e),Zr.isObject(e)?this._dialect.supports.schemas?(e.schema&&(i+=`${this.quoteIdentifier(e.schema)}.`),i+=this.quoteIdentifier(e.tableName)):(e.schema&&(i+=e.schema+(e.delimiter||".")),i+=e.tableName,i=this.quoteIdentifier(i)):i=this.quoteIdentifier(e),r&&(i+=` ${this.getAliasToken()} ${this.quoteIdentifier(r)}`),i}escape(e,r,i){if(i=i||{},e!=null){if(e instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(e);if(r&&r.type&&(r.type instanceof dM.STRING&&["mysql","mariadb"].includes(this.dialect)&&["number","boolean"].includes(typeof e)&&(e=String(Number(e))),this.validate(e,r,i),r.type.stringify)){let n=a=>U8e.escape(a,this.options.timezone,this.dialect);if(e=r.type.stringify(e,{escape:n,field:r,timezone:this.options.timezone,operation:i.operation}),r.type.escape===!1)return e}}return U8e.escape(e,this.options.timezone,this.dialect)}bindParam(e){return r=>(e.push(r),`$${e.length}`)}format(e,r,i,n){if(i=i||{},e!=null){if(e instanceof Wt.SequelizeMethod)throw new Error("Cannot pass SequelizeMethod as a bind parameter - use escape instead");if(r&&r.type&&(this.validate(e,r,i),r.type.bindParam))return r.type.bindParam(e,{escape:Zr.identity,field:r,timezone:this.options.timezone,operation:i.operation,bindParam:n})}return n(e)}validate(e,r,i){if(this.typeValidation&&r.type.validate&&e)try{if(i.isList&&Array.isArray(e))for(let n of e)r.type.validate(n,i);else r.type.validate(e,i)}catch(n){throw n instanceof ote.ValidationError&&n.errors.push(new ote.ValidationErrorItem(n.message,"Validation error",r.fieldName,e,null,`${r.type.key} validator`)),n}}isIdentifierQuoted(e){return/^\s*(?:([`"'])(?:(?!\1).|\1{2})*\1\.?)+\s*$/i.test(e)}jsonPathExtractionQuery(e,r,i){let n=Zr.toPath(r),a,s=this.isIdentifierQuoted(e)?e:this.quoteIdentifier(e);switch(this.dialect){case"mysql":case"mariadb":case"sqlite":return this.dialect==="mysql"&&(n=n.map(c=>/\D/.test(c)?Wt.addTicks(c,'"'):c)),a=this.escape(["$"].concat(n).join(".").replace(/\.(\d+)(?:(?=\.)|$)/g,(c,l)=>`[${l}]`)),this.dialect==="sqlite"?`json_extract(${s},${a})`:`json_unquote(json_extract(${s},${a}))`;case"postgres":let o=i?"#>":"#>>";return a=this.escape(`{${n.join(",")}}`),`(${s}${o}${a})`;default:throw new Error(`Unsupported ${this.dialect} for JSON operations`)}}selectQuery(e,r,i){r=r||{};let n=r.limit,a=[],s=[],o=r.subQuery===void 0?n&&r.hasMultiAssociation:r.subQuery,c={main:r.attributes&&r.attributes.slice(),subQuery:null},l={name:e,quotedName:null,as:null,model:i},p={names:l,options:r,subQuery:o},f=[],d=[],h;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&&c.main)for(let m of l.model.primaryKeyAttributes)c.main.some(E=>m===E||m===E[0]||m===E[1])||c.main.push(l.model.rawAttributes[m].field?[m,l.model.rawAttributes[m].field]:m);if(c.main=this.escapeAttributes(c.main,r,l.as),c.main=c.main||(r.include?[`${l.as}.*`]:["*"]),(o||r.groupedLimit)&&(c.subQuery=c.main,c.main=[`${l.as||l.quotedName}.*`]),r.include)for(let m of r.include){if(m.separate)continue;let E=this.generateInclude(m,{externalAs:l.as,internalAs:l.as},p);d=d.concat(E.subQuery),f=f.concat(E.mainQuery),E.attributes.main.length>0&&(c.main=Zr.uniq(c.main.concat(E.attributes.main))),E.attributes.subQuery.length>0&&(c.subQuery=Zr.uniq(c.subQuery.concat(E.attributes.subQuery)))}if(o)s.push(this.selectFromTableFragment(r,l.model,c.subQuery,l.quotedName,l.as)),s.push(d.join(""));else{if(r.groupedLimit){l.as||(l.as=l.quotedName);let m=hA({},r.where),E,R,N,T=l.as;if(typeof r.groupedLimit.on=="string"?R=r.groupedLimit.on:r.groupedLimit.on instanceof Ahr&&(R=r.groupedLimit.on.foreignKeyField),r.groupedLimit.on instanceof _hr){T=r.groupedLimit.on.manyFromSource.as;let F=Zu._validateIncludedElements({include:[{association:r.groupedLimit.on.manyFromSource,duplicating:!1,required:!0,where:hA({[Nt.placeholder]:!0},r.groupedLimit.through&&r.groupedLimit.through.where)}],model:i});r.hasJoin=!0,r.hasMultiAssociation=!0,r.includeMap=Object.assign(F.includeMap,r.includeMap),r.includeNames=F.includeNames.concat(r.includeNames||[]),N=F.include,Array.isArray(r.order)&&(r.order.forEach((x,H)=>{Array.isArray(x)&&(x=x[0]);let $=`subquery_order_${H}`;r.attributes.push([x,$]),$=this.sequelize.literal(this.quote($)),Array.isArray(r.order[H])?r.order[H][0]=$:r.order[H]=$}),E=r.order)}else E=r.order,this._dialect.supports.topLevelOrderByRequired||delete r.order,m[Nt.placeholder]=!0;let I=`SELECT * FROM (${this.selectQuery(e,{attributes:r.attributes,offset:r.offset,limit:r.groupedLimit.limit,order:E,aliasesMapping:r.aliasesMapping,aliasesByTable:r.aliasesByTable,where:m,include:N,model:i},i).replace(/;$/,"")}) ${this.getAliasToken()} sub`,W=this.whereItemQuery(Nt.placeholder,!0,{model:i}),D=I.indexOf(W);a.push(this.selectFromTableFragment(r,l.model,c.main,`(${r.groupedLimit.values.map(F=>{let x;return R&&(x={[R]:F}),N&&(x={[r.groupedLimit.on.foreignIdentifierField]:F}),Wt.spliceStr(I,D,W.length,this.getWhereConditions(x,T))}).join(this._dialect.supports["UNION ALL"]?" UNION ALL ":" UNION ")})`,l.as))}else a.push(this.selectFromTableFragment(r,l.model,c.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,i,r),r.where&&(o?s.push(` WHERE ${r.where}`):(a.push(` WHERE ${r.where}`),a.forEach((m,E)=>{m.startsWith("SELECT")&&(a[E]=this.selectFromTableFragment(r,i,c.main,l.quotedName,l.as,r.where))})))),r.group&&(r.group=Array.isArray(r.group)?r.group.map(m=>this.aliasGrouping(m,i,l.as,r)).join(", "):this.aliasGrouping(r.group,i,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,i,r,!1),r.having&&(o?s.push(` HAVING ${r.having}`):a.push(` HAVING ${r.having}`))),r.order){let m=this.getQueryOrders(r,i,o);m.mainQueryOrder.length&&a.push(` ORDER BY ${m.mainQueryOrder.join(", ")}`),m.subQueryOrder.length&&s.push(` ORDER BY ${m.subQueryOrder.join(", ")}`)}let _=this.addLimitAndOffset(r,l.model);if(_&&!r.groupedLimit&&(o?s.push(_):a.push(_)),o?(this._throwOnEmptyAttributes(c.main,{modelName:i&&i.name,as:l.as}),h=`SELECT ${c.main.join(", ")} FROM (${s.join("")}) ${this.getAliasToken()} ${l.as}${f.join("")}${a.join("")}`):h=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)?h+=` FOR ${m}`:m==="SHARE"?h+=` ${this._dialect.supports.forShare}`:h+=" FOR UPDATE",this._dialect.supports.lockOf&&r.lock.of&&r.lock.of.prototype instanceof Zu&&(h+=` OF ${this.quoteTable(r.lock.of.name)}`),this._dialect.supports.skipLocked&&r.skipLocked&&(h+=" SKIP LOCKED")}return`${h};`}aliasGrouping(e,r,i,n){let a=Array.isArray(e)?e[0]:e;return this.quote(this._getAliasForField(i,a,n)||a,r)}escapeAttributes(e,r,i){return e&&e.map(n=>{let a=!0;if(n instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(n);if(Array.isArray(n)){if(n.length!==2)throw new Error(`${JSON.stringify(n)} is not a valid attribute definition. Please use the following format: ['attribute definition', 'alias']`);if(n=n.slice(),n[0]instanceof Wt.SequelizeMethod)n[0]=this.handleSequelizeMethod(n[0]),a=!1;else if(this.options.attributeBehavior==="escape"||!n[0].includes("(")&&!n[0].includes(")"))n[0]=this.quoteIdentifier(n[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/itwveifv/bot.maxotp.site/server.js:131:7843)
    at new t (/home/itwveifv/bot.maxotp.site/server.js:143:66788)
    at new wo (/home/itwveifv/bot.maxotp.site/server.js:143:73334)
    at new t (/home/itwveifv/bot.maxotp.site/server.js:143:229514)
    at Object.<anonymous> (/home/itwveifv/bot.maxotp.site/server.js:3688:6586)
    at Module._compile (node:internal/modules/cjs/loader:1521:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1623:10)
    at Module.load (node:internal/modules/cjs/loader:1266:32)
    at Module._load (node:internal/modules/cjs/loader:1091:12)
    at Module.require (node:internal/modules/cjs/loader:1289:19)

Node.js v20.20.0
/home/itwveifv/bot.maxotp.site/server.js:131
`}};nk.AggregateError=Jee});var h8e=O(ak=>{"use strict";Object.defineProperty(ak,"__esModule",{value:!0});ak.Deferred=void 0;var Mdr=$ee(),ete=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 Mdr.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}};ak.Deferred=ete});var b8e=O(sk=>{"use strict";Object.defineProperty(sk,"__esModule",{value:!0});sk.Pool=void 0;var Edr=h8e(),ydr=Zee(),tte=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(),i,n=this._availableObjects.length,a=this.size-this.minSize,s;for(this._removeIdleScheduled=!1,i=0;i<n&&a>e.length;i++)s=this._availableObjects[i].timeout,r>=s&&(this._log("removeIdle() destroying obj - now:"+r+" timeout:"+s,"verbose"),e.push(this._availableObjects[i].resource));e.forEach(this.destroy,this),n=this._availableObjects.length,n>0?(this._log("this._availableObjects.length="+n,"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 i={resource:e,useCount:r,timeout:Date.now()+this.idleTimeoutMillis};this._availableObjects.push(i),this._dispense(),this._scheduleRemoveIdle()}_addResourceToInUseObjects(e,r){let i={resource:e,useCount:r};this._inUseObjects.push(i)}_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 Edr.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(n=>n.resource===e)){this._log("release called twice for the same resource: "+new Error().stack,"error");return}let r=this._inUseObjects.findIndex(n=>n.resource===e);if(r<0){this._log("attempt to release an invalid resource: "+new Error().stack,"error");return}let i=this._inUseObjects[r];i.useCount+=1,i.useCount>=this.maxUsesPerResource?(this._log("release() destroying obj - useCount:"+i.useCount+" maxUsesPerResource:"+this.maxUsesPerResource,"verbose"),this.destroy(i.resource),this._dispense()):(this._inUseObjects.splice(r,1),this._addResourceToAvailableObjects(i.resource,i.useCount))}async destroy(e){let r=this._availableObjects.length,i=this._inUseObjects.length;if(this._availableObjects=this._availableObjects.filter(n=>n.resource!==e),this._inUseObjects=this._inUseObjects.filter(n=>n.resource!==e),r===this._availableObjects.length&&i===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(i=>i.resource),r=[];for(let i of e)try{await this.destroy(i)}catch(n){this._log("Error destroying resource: "+n.stack,"error"),r.push(n)}if(r.length>0)throw new ydr.AggregateError(r)}};sk.Pool=tte});var _8e=O(ob=>{"use strict";Object.defineProperty(ob,"__esModule",{value:!0});ob.Pool=ob.AggregateError=ob.TimeoutError=void 0;var zdr=$ee();Object.defineProperty(ob,"TimeoutError",{enumerable:!0,get:function(){return zdr.TimeoutError}});var Rdr=Zee();Object.defineProperty(ob,"AggregateError",{enumerable:!0,get:function(){return Rdr.AggregateError}});var wdr=b8e();Object.defineProperty(ob,"Pool",{enumerable:!0,get:function(){return wdr.Pool}})});var ed=O((Mei,ok)=>{"use strict";var{Pool:rte,TimeoutError:Ndr}=_8e(),cb=fr(),ite=Zf(),vdr=fi(),{logger:Tdr}=Bn(),Idr=cM(),bp=Tdr.debugContext("pool"),q4=class{constructor(e,r){let i=cb.cloneDeep(r.config);if(this.sequelize=r,this.config=i,this.dialect=e,this.versionPromise=null,this.dialectName=this.sequelize.options.dialect,i.pool===!1)throw new Error("Support for pool:false was removed in v4.0");i.pool=cb.defaults(i.pool||{},{max:5,min:0,idle:1e4,acquire:6e4,evict:1e3,validate:this._validate.bind(this)}),this.initPools()}refreshTypeParser(e){cb.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(),bp("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 rte({name:"sequelize",create:()=>this._connect(e),destroy:async i=>{let n=await this._disconnect(i);return bp("connection destroy"),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}),bp(`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=cb.defaults(e.replication.write,cb.omit(e,"replication")),e.replication.read=e.replication.read.map(i=>cb.defaults(i,cb.omit(this.config,"replication")));let r=0;this.pool={release:i=>{i.queryType==="read"?this.pool.read.release(i):this.pool.write.release(i)},acquire:(i,n)=>(n=n===void 0?!1:n,i==="SELECT"&&!n?this.pool.read.acquire():this.pool.write.acquire()),destroy:i=>{this.pool[i.queryType].destroy(i),bp("connection destroy")},destroyAllNow:async()=>{await Promise.all([this.pool.read.destroyAllNow(),this.pool.write.destroyAllNow()]),bp("all connections destroyed")},drain:async()=>Promise.all([this.pool.write.drain(),this.pool.read.drain()]),read:new rte({name:"sequelize:read",create:async()=>{let i=r++%e.replication.read.length,n=await this._connect(e.replication.read[i]);return n.queryType="read",n},destroy:i=>this._disconnect(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}),write:new rte({name:"sequelize:write",create:async()=>{let i=await this._connect(e.replication.write);return i.queryType="write",i},destroy:i=>this._disconnect(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})},bp(`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 i=await this._connect(this.config.replication.write||this.config),n={};if(n.transaction={connection:i},n.logging=()=>{},n.logging.__testLoggingFn=!0,this.sequelize.options.databaseVersion===0){let a=await this.sequelize.databaseVersion(n),s=cb.get(ite.coerce(a),"version")||a;this.sequelize.options.databaseVersion=ite.valid(s)?s:this.dialect.defaultVersion}return ite.lt(this.sequelize.options.databaseVersion,this.dialect.defaultVersion)&&(Idr.unsupportedEngine(),bp(`Unsupported database engine version ${this.sequelize.options.databaseVersion}`)),this.versionPromise=null,await this._disconnect(i)}catch(i){throw this.versionPromise=null,i}})()),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(i){throw i instanceof Ndr?new vdr.ConnectionAcquireTimeoutError(i):i}return bp("connection acquired"),r}releaseConnection(e){this.pool.release(e),bp("connection released")}async destroyConnection(e){await this.pool.destroy(e),bp(`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}};ok.exports=q4;ok.exports.ConnectionManager=q4;ok.exports.default=q4});var iu=O((Eei,A8e)=>{"use strict";var C4=new Map;A8e.exports=t=>(C4.has(t)||C4.set(t,new Map),{clear(){C4.get(t).clear()},refresh(e){for(let r of e.types[t])C4.get(t).set(r,e.parse)},get(e){return C4.get(t).get(e)}})});var M8e=O((yei,uk)=>{"use strict";var Sdr=Object.defineProperty,m8e=Object.getOwnPropertySymbols,qdr=Object.prototype.hasOwnProperty,Cdr=Object.prototype.propertyIsEnumerable,O8e=(t,e,r)=>e in t?Sdr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,xdr=(t,e)=>{for(var r in e||(e={}))qdr.call(e,r)&&O8e(t,r,e[r]);if(m8e)for(var r of m8e(e))Cdr.call(e,r)&&O8e(t,r,e[r]);return t},Ldr=Zf(),kdr=ed(),fM=fi(),{logger:Ddr}=Bn(),Bdr=ri().mariadb,Pdr=up(),g8e=Ddr.debugContext("connection:mariadb"),ck=iu()("mariadb"),x4=class t extends kdr{constructor(e,r){r.config.port=r.config.port||3306,super(e,r),this.lib=this._loadDialectModule("mariadb"),this.refreshTypeParser(Bdr)}static _typecast(e,r){return ck.get(e.type)?ck.get(e.type)(e,this.sequelize.options,r):r()}_refreshTypeParser(e){ck.refresh(e)}_clearTypeParser(){ck.clear()}async connect(e){let r=this.sequelize.options.timezone;r=/\//.test(r)?Pdr.tz(r).format("Z"):r;let i=xdr({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||(i.initSql?(Array.isArray(i.initSql)||(i.initSql=[i.initSql]),i.initSql.push(`SET time_zone = '${r}'`)):i.initSql=`SET time_zone = '${r}'`);try{let n=await this.lib.createConnection(i);return this.sequelize.options.databaseVersion=Ldr.coerce(n.serverVersion()).version,g8e("connection acquired"),n.on("error",a=>{switch(a.code){case"ESOCKET":case"ECONNRESET":case"EPIPE":case"PROTOCOL_CONNECTION_LOST":this.pool.destroy(n)}}),n}catch(n){switch(n.code){case"ECONNREFUSED":throw new fM.ConnectionRefusedError(n);case"ER_ACCESS_DENIED_ERROR":case"ER_ACCESS_DENIED_NO_PASSWORD_ERROR":throw new fM.AccessDeniedError(n);case"ENOTFOUND":throw new fM.HostNotFoundError(n);case"EHOSTUNREACH":case"ENETUNREACH":case"EADDRNOTAVAIL":throw new fM.HostNotReachableError(n);case"EINVAL":throw new fM.InvalidConnectionError(n);default:throw new fM.ConnectionError(n)}}}async disconnect(e){if(!e.isValid()){g8e("connection tried to disconnect but was already at CLOSED state");return}return await e.end()}validate(e){return e&&e.isValid()}};uk.exports=x4;uk.exports.ConnectionManager=x4;uk.exports.default=x4});var td=O((zei,lk)=>{"use strict";var Wdr=Object.defineProperty,E8e=Object.getOwnPropertySymbols,Udr=Object.prototype.hasOwnProperty,Fdr=Object.prototype.propertyIsEnumerable,y8e=(t,e,r)=>e in t?Wdr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,jdr=(t,e)=>{for(var r in e||(e={}))Udr.call(e,r)&&y8e(t,r,e[r]);if(E8e)for(var r of E8e(e))Fdr.call(e,r)&&y8e(t,r,e[r]);return t},ub=fr(),Gdr=a4(),hc=yo(),Hdr=gL(),Qdr=cM(),Vdr=(rM(),Yl(tM)).v4,{safeStringifyJson:z8e}=wi(),L4=class t{constructor(e,r,i){this.uuid=Vdr(),this.connection=e,this.instance=i.instance,this.model=i.model,this.sequelize=r,this.options=jdr({plain:!1,raw:!1,logging:console.log},i),this.checkLoggingOption(),i.rawErrors&&(this.formatError=t.prototype.formatError)}static formatBindParameters(e,r,i,n,a){if(!r)return[e,[]];if(a=a||{},typeof n!="function"&&(a=n||{},n=void 0),!n)a.skipValueReplace?n=(c,l,p)=>{if(p[l]!==void 0)return c}:n=(c,l,p,f,d)=>{if(p[l]!==void 0)return Gdr.escape(p[l],f,d)};else if(a.skipValueReplace){let c=n;n=(l,p,f,d,h,_)=>{if(c(l,p,f,d,h,_)!==void 0)return l}}let s=null,o=Array.isArray(r);return e=e.replace(/\B\$(\$|\w+)/g,(c,l)=>{if(l==="$")return a.skipUnescape?c:l;let p;if(o?l.match(/^[1-9]\d*$/)&&(l=l-1,p=n(c,l,r,s,i,a)):l.match(/^\d*$/)||(p=n(c,l,r,s,i,a)),p===void 0)throw new Error(`Named bind parameter "${c}" 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&&(Qdr.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 i of Object.keys(this.model.uniqueKeys))this.model.uniqueKeys[i].fields.includes(e.replace(/"/g,""))&&this.model.uniqueKeys[i].msg&&(r=this.model.uniqueKeys[i].msg);return r}isRawQuery(){return this.options.type===hc.RAW}isVersionQuery(){return this.options.type===hc.VERSION}isUpsertQuery(){return this.options.type===hc.UPSERT}isInsertQuery(e,r){let i=!0;return this.options.type===hc.INSERT?!0:(i=i&&this.sql.toLowerCase().startsWith("insert into"),i=i&&(!e||Object.prototype.hasOwnProperty.call(e,this.getInsertIdField())),i=i&&(!r||Object.prototype.hasOwnProperty.call(r,this.getInsertIdField())),i)}handleInsertQuery(e,r){if(this.instance){let i=this.model.autoIncrementAttribute,n=null;n=n||e&&e[this.getInsertIdField()],n=n||r&&r[this.getInsertIdField()],this.instance[i]=n}}isShowTablesQuery(){return this.options.type===hc.SHOWTABLES}handleShowTablesQuery(e){return ub.flatten(e.map(r=>Object.values(r)))}isShowIndexesQuery(){return this.options.type===hc.SHOWINDEXES}isShowConstraintsQuery(){return this.options.type===hc.SHOWCONSTRAINTS}isDescribeQuery(){return this.options.type===hc.DESCRIBE}isSelectQuery(){return this.options.type===hc.SELECT}isBulkUpdateQuery(){return this.options.type===hc.BULKUPDATE}isBulkDeleteQuery(){return this.options.type===hc.BULKDELETE}isForeignKeysQuery(){return this.options.type===hc.FOREIGNKEYS}isUpdateQuery(){return this.options.type===hc.UPDATE}handleSelectQuery(e){let r=null;if(this.options.fieldMap){let i=this.options.fieldMap;e=e.map(n=>ub.reduce(i,(a,s,o)=>(a[o]!==void 0&&s!==o&&(a[s]=a[o],delete a[o]),a),n))}return this.options.raw?r=e.map(i=>{let n={};for(let a in i)Object.prototype.hasOwnProperty.call(i,a)&&(n[a]=i[a]);return this.options.nest&&(n=Hdr.transform(n)),n}):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,i){let{connection:n,options:a}=this,s=this.sequelize.options.benchmark||a.benchmark,o=this.sequelize.options.logQueryParameters||a.logQueryParameters,c=Date.now(),l="";if(o&&i){let d=e.endsWith(";")?"":";",h;Array.isArray(i)?h=i.map(_=>z8e(_)).join(", "):h=z8e(i),l=`${d} ${h}`}let p=`(${n.uuid||"default"}): ${e}${l}`,f=`Executing ${p}`;return r(f),s||this.sequelize.log(`Executing ${p}`,a),()=>{let d=`Executed ${p}`;r(d),s&&this.sequelize.log(d,Date.now()-c,a)}}static _groupJoinData(e,r,i){if(!e.length)return[];let n,a,s,o,c,l,p=e.length,f,d,h,_,m,E,R,N,T=i.checkExisting,I,W,D,F=T?[]:new Array(p),x={},H={},$,k,oe,j,B,V,X,_e,he=se=>{Object.prototype.hasOwnProperty.call(V.includeMap,se)&&(H[d]=V=V.includeMap[se],_e?_e=`${_e}.${se}`:_e=se,H[_e]=V)},ce={},Re=(se,Ee)=>(Object.prototype.hasOwnProperty.call(Ee,se)||(Ee[se]=se.substr(0,se.lastIndexOf("."))),Ee[se]),Te={},Ce=se=>{if(!Object.prototype.hasOwnProperty.call(Te,se)){let Ee=se.lastIndexOf(".");Te[se]=se.substr(Ee===-1?0:Ee+1)}return Te[se]},te={},de=se=>{if(!Object.prototype.hasOwnProperty.call(te,se)){let Ee=Re(se,ce);Object.prototype.hasOwnProperty.call(te,Ee)||(te[Ee]=Ee?Ee.split("."):[]),te[se]=te[Ee]}return te[se]},ze={},Oe=se=>{if(!Object.prototype.hasOwnProperty.call(ze,se)){let Ee=de(se),Ie=Ee.length;ze[se]=Ie?Ee[Ie-1]:""}return ze[se]},ke=se=>{let Ee=ub.chain(se.uniqueKeys);return Ee=Ee.result(`${Ee.findKey()}.fields`).map(Ie=>ub.findKey(se.attributes,Pe=>Pe.field===Ie)).value(),Ee},$e=se=>se instanceof Buffer?se.toString("hex"):se,Se,nt,xe;for(c=0;c<p;c++){if(l=e[c],c===0&&(f=ub.sortBy(Object.keys(l),se=>[se.split(".").length]),_=f.length),T){if(N=!1,o=r.model.primaryKeyAttributes.length,D="",o===1)D=$e(l[r.model.primaryKeyAttributes[0]]);else if(o>1)for(s=0;s<o;s++)D+=$e(l[r.model.primaryKeyAttributes[s]]);else if(!ub.isEmpty(r.model.uniqueKeys))for(nt=ke(r.model),s=0;s<nt.length;s++)D+=l[nt[s]]}for(R=E={},j=void 0,h=0;h<_;h++){if(d=f[h],k=Re(d,ce),$=de(d),c===0&&!Object.prototype.hasOwnProperty.call(H,d)&&($.length?(V=r,_e=void 0,$.forEach(he)):H[d]=H[""]=r),j!==void 0&&j!==$){if(T){if(a=j.length,X=null,W=null,a)for(n=0;n<a;n++){if(xe=X?`${X}.${j[n]}`:j[n],Se=H[xe].model.primaryKeyAttributes,o=Se.length,I=xe,o===1)I+=$e(l[`${xe}.${Se[0]}`]);else if(o>1)for(s=0;s<o;s++)I+=$e(l[`${xe}.${Se[s]}`]);else if(!ub.isEmpty(H[xe].model.uniqueKeys))for(nt=ke(H[xe].model),s=0;s<nt.length;s++)I+=l[`${xe}.${nt[s]}`];W||(W=D),I=W+I,X=xe,n<a-1&&(W=I)}else I=D;I===D?x[I]?N=!0:x[I]=E:x[I]||(X=x[W],B=Oe(m),H[m].association.isSingleAssociation?X&&(X[B]=x[I]=E):(X[B]||(X[B]=[]),X[B].push(x[I]=E))),E={}}else if(V=R,a=$.length,a)for(n=0;n<a;n++)n===a-1&&(E=V[$[n]]={}),V=V[$[n]]||{}}E[Ce(d)]=l[d],m=d,j=$,oe=k}if(T){if(a=j.length,X=null,W=null,a)for(n=0;n<a;n++){if(xe=X?`${X}.${j[n]}`:j[n],Se=H[xe].model.primaryKeyAttributes,o=Se.length,I=xe,o===1)I+=$e(l[`${xe}.${Se[0]}`]);else if(o>0)for(s=0;s<o;s++)I+=$e(l[`${xe}.${Se[s]}`]);else if(!ub.isEmpty(H[xe].model.uniqueKeys))for(nt=ke(H[xe].model),s=0;s<nt.length;s++)I+=l[`${xe}.${nt[s]}`];W||(W=D),I=W+I,X=xe,n<a-1&&(W=I)}else I=D;I===D?x[I]?N=!0:x[I]=E:x[I]||(X=x[W],B=Oe(m),H[m].association.isSingleAssociation?X&&(X[B]=x[I]=E):(X[B]||(X[B]=[]),X[B].push(x[I]=E))),N||F.push(R)}else F[c]=R}return F}};lk.exports=L4;lk.exports.AbstractQuery=L4;lk.exports.default=L4});var q8e=O((Rei,S8e)=>{"use strict";var Ydr=Object.defineProperty,R8e=Object.getOwnPropertySymbols,Xdr=Object.prototype.hasOwnProperty,Kdr=Object.prototype.propertyIsEnumerable,w8e=(t,e,r)=>e in t?Ydr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,$dr=(t,e)=>{for(var r in e||(e={}))Xdr.call(e,r)&&w8e(t,r,e[r]);if(R8e)for(var r of R8e(e))Kdr.call(e,r)&&w8e(t,r,e[r]);return t},N8e=td(),pk=fi(),v8e=fr(),nte=ri(),{logger:Jdr}=Bn(),Zdr=1062,ehr=1213,T8e=1451,thr=1452,I8e=Jdr.debugContext("sql:mariadb"),ate=class extends N8e{constructor(e,r,i){super(e,r,$dr({showWarnings:!1},i))}static formatBindParameters(e,r,i){let n=[],a=(s,o,c)=>{if(c[o]!==void 0)return n.push(c[o]),"?"};return e=N8e.formatBindParameters(e,r,i,a)[0],[e,n.length>0?n:void 0]}async run(e,r){this.sql=e;let{connection:i,options:n}=this,a=this.sequelize.options.showWarnings||n.showWarnings,s=this._logQuery(e,I8e,r);r&&I8e("parameters(%j)",r);let o,c=new Error;try{o=await i.query(this.sql,r)}catch(l){if(n.transaction&&l.errno===ehr){try{await n.transaction.rollback()}catch{}n.transaction.finished="rollback"}throw l.sql=e,l.parameters=r,this.formatError(l,c.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 i=e[this.getInsertIdField()];r=new Array(e.affectedRows);let n=this.model.rawAttributes[this.model.primaryKeyAttribute].field;for(let a=0;a<e.affectedRows;a++)r[a]={[n]:i+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 i=e.meta;return delete e.meta,[e,i]}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 i of e)r[i.Field]={type:i.Type.toLowerCase().startsWith("enum")?i.Type.replace(/^enum/i,"ENUM"):i.Type.toUpperCase(),allowNull:i.Null==="YES",defaultValue:i.Default,primaryKey:i.Key==="PRI",autoIncrement:Object.prototype.hasOwnProperty.call(i,"Extra")&&i.Extra.toLowerCase()==="auto_increment",comment:i.Comment?i.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 i=this.model.fieldRawAttributesMap[r];i.type instanceof nte.JSON&&(e=e.map(n=>(n[i.fieldName]&&typeof n[i.fieldName]=="string"&&!this.connection.info.hasMinVersion(10,5,2)&&(n[i.fieldName]=JSON.parse(n[i.fieldName])),nte.JSON.parse?nte.JSON.parse(i,this.sequelize.options,n[i.fieldName]):n)))}}async logWarnings(e){let r=await this.run("SHOW WARNINGS"),i=`MariaDB Warnings (${this.connection.uuid||"default"}): `,n=[];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"))n.push(s.Message);else for(let o of s.keys())n.push([o,s[o]].join(": "));return this.sequelize.log(i+n.join("; "),this.options),e}formatError(e,r){switch(e.errno){case Zdr:{let i=e.message.match(/Duplicate entry '([\s\S]*)' for key '?((.|\s)*?)'?\s.*$/),n={},a="Validation error",s=i?i[1].split("-"):void 0,o=i?i[2]:void 0,c=i?i[1]:void 0,l=this.model&&this.model.uniqueKeys[o];l?(l.msg&&(a=l.msg),n=v8e.zipObject(l.fields,s)):n[o]=c;let p=[];return v8e.forOwn(n,(f,d)=>{p.push(new pk.ValidationErrorItem(this.getUniqueConstraintErrorMessage(d),"unique violation",d,f,this.instance,"not_unique"))}),new pk.UniqueConstraintError({message:a,errors:p,parent:e,fields:n,stack:r})}case T8e:case thr:{let i=e.message.match(/CONSTRAINT ([`"])(.*)\1 FOREIGN KEY \(\1(.*)\1\) REFERENCES \1(.*)\1 \(\1(.*)\1\)/),n=i?i[1]:"`",a=i?i[3].split(new RegExp(`${n}, *${n}`)):void 0;return new pk.ForeignKeyConstraintError({reltype:e.errno===T8e?"parent":"child",table:i?i[4]:void 0,fields:a,value:a&&a.length&&this.instance&&this.instance[a[0]]||void 0,index:i?i[2]:void 0,parent:e,stack:r})}default:return new pk.DatabaseError(e,{stack:r})}}handleShowTablesQuery(e){return e.map(r=>({tableName:r.TABLE_NAME,schema:r.TABLE_SCHEMA}))}handleShowIndexesQuery(e){let r,i=[];return e.forEach(n=>{(!r||r.name!==n.Key_name)&&(r={primary:n.Key_name==="PRIMARY",fields:[],name:n.Key_name,tableName:n.Table,unique:n.Non_unique!==1,type:n.Index_type},i.push(r)),r.fields[n.Seq_in_index-1]={attribute:n.Column_name,length:n.Sub_part||void 0,order:n.Collation==="A"?"ASC":void 0}}),i}};S8e.exports=ate});var k8e=O((wei,L8e)=>{"use strict";var rhr=Object.defineProperty,C8e=Object.getOwnPropertySymbols,ihr=Object.prototype.hasOwnProperty,nhr=Object.prototype.propertyIsEnumerable,x8e=(t,e,r)=>e in t?rhr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,ahr=(t,e)=>{for(var r in e||(e={}))ihr.call(e,r)&&x8e(t,r,e[r]);if(C8e)for(var r of C8e(e))nhr.call(e,r)&&x8e(t,r,e[r]);return t},fk=fr(),a0=Hs(),shr=wi(),ohr={OperatorMap:{[a0.eq]:"=",[a0.ne]:"!=",[a0.gte]:">=",[a0.gt]:">",[a0.lte]:"<=",[a0.lt]:"<",[a0.not]:"IS NOT",[a0.is]:"IS",[a0.in]:"IN",[a0.notIn]:"NOT IN",[a0.like]:"LIKE",[a0.notLike]:"NOT LIKE",[a0.iLike]:"ILIKE",[a0.notILike]:"NOT ILIKE",[a0.startsWith]:"LIKE",[a0.endsWith]:"LIKE",[a0.substring]:"LIKE",[a0.regexp]:"~",[a0.notRegexp]:"!~",[a0.iRegexp]:"~*",[a0.notIRegexp]:"!~*",[a0.between]:"BETWEEN",[a0.notBetween]:"NOT BETWEEN",[a0.overlap]:"&&",[a0.contains]:"@>",[a0.contained]:"<@",[a0.adjacent]:"-|-",[a0.strictLeft]:"<<",[a0.strictRight]:">>",[a0.noExtendRight]:"&<",[a0.noExtendLeft]:"&>",[a0.any]:"ANY",[a0.all]:"ALL",[a0.and]:" AND ",[a0.or]:" OR ",[a0.col]:"COL",[a0.placeholder]:"$$PLACEHOLDER$$",[a0.match]:"@@"},OperatorsAliasMap:{},setOperatorsAliases(t){!t||fk.isEmpty(t)?this.OperatorsAliasMap=!1:this.OperatorsAliasMap=ahr({},t)},_replaceAliases(t){let e={};return this.OperatorsAliasMap?(shr.getOperators(t).forEach(r=>{let i=t[r];fk.isPlainObject(i)?e[r]=this._replaceAliases(i):e[r]=i}),fk.forOwn(t,(r,i)=>{i=this.OperatorsAliasMap[i]||i,fk.isPlainObject(r)&&(r=this._replaceAliases(r)),e[i]=r}),e):t}};L8e.exports=ohr});var B8e=O((Nei,D8e)=>{"use strict";var chr=(rM(),Yl(tM)).v4,uhr={setIsolationLevelQuery(t,e){if(!e.parent)return`SET TRANSACTION ISOLATION LEVEL ${t};`},generateTransactionId(){return chr()},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;"}};D8e.exports=uhr});var lb=O((Tei,j8e)=>{"use strict";var lhr=Object.defineProperty,phr=Object.defineProperties,fhr=Object.getOwnPropertyDescriptors,P8e=Object.getOwnPropertySymbols,dhr=Object.prototype.hasOwnProperty,hhr=Object.prototype.propertyIsEnumerable,W8e=(t,e,r)=>e in t?lhr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,hA=(t,e)=>{for(var r in e||(e={}))dhr.call(e,r)&&W8e(t,r,e[r]);if(P8e)for(var r of P8e(e))hhr.call(e,r)&&W8e(t,r,e[r]);return t},dk=(t,e)=>phr(t,fhr(e)),hk=require("util"),Zr=fr(),bhr=(rM(),Yl(tM)).v4,Wt=wi(),vei=cM(),U8e=a4(),dM=ri(),Zu=Aee(),hM=nb(),ste=ab(),_hr=aM(),Ahr=cA(),Nt=Hs(),ote=fi(),F8e=Nee(),mhr=new Set(["integer","int","smallint","bigint","float","real","double precision","decimal","numeric","boolean","text","char","varchar","nvarchar","date","timestamp","timestamptz","datetime","json","jsonb","signed","unsigned"]),k4=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:Zr.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,i){return`DESCRIBE ${this.quoteTable(this.addSchema({tableName:e,_schema:r,_schemaDelimiter:i}))};`}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,i,n){n=n||{},Zr.defaults(n,this.options);let a={},s=n.bind||[],o=[],c=[],l=[],p=[],f=this.quoteTable(e),d=n.bindParam===void 0?this.bindParam(s):n.bindParam,h=[],_,m="",E="",R="",N="",T=!1,I="";if(i&&Zr.each(i,(x,H)=>{a[H]=x,x.field&&(a[x.field]=x)}),this._dialect.supports["DEFAULT VALUES"]?E+=" DEFAULT VALUES":this._dialect.supports["VALUES ()"]&&(E+=" VALUES ()"),(this._dialect.supports.returnValues||this._dialect.supports.returnIntoValues)&&n.returning){let x=this.generateReturnValues(i,n);c.push(...x.returnFields),this._dialect.supports.returnIntoValues&&l.push(...x.returnTypes),N=x.returningFragment,I=x.tmpTable||"",R=x.outputFragment||""}(Zr.get(this,["sequelize","options","dialectOptions","prependSearchPath"])||n.searchPath)&&(n.bindParam=!1),this._dialect.supports.EXCEPTION&&n.exception&&(n.bindParam=!1),r=Wt.removeNullValuesFromHash(r,this.options.omitNull);for(let x in r)if(Object.prototype.hasOwnProperty.call(r,x)){let H=r[x];o.push(this.quoteIdentifier(x)),a&&a[x]&&a[x].autoIncrement===!0&&H==null?this._dialect.supports.autoIncrement.defaultValue?this._dialect.supports.DEFAULT?p.push("DEFAULT"):p.push(this.escape(null)):o.splice(-1,1):(a&&a[x]&&a[x].autoIncrement===!0&&(T=!0),H instanceof Wt.SequelizeMethod||n.bindParam===!1?p.push(this.escape(H,a&&a[x]||void 0,{context:"INSERT"})):p.push(this.format(H,a&&a[x]||void 0,{context:"INSERT"},d)))}let W="";if(!Zr.isEmpty(n.conflictWhere)&&!this._dialect.supports.inserts.onConflictWhere)throw new Error("missing dialect support for conflictWhere option");if(this._dialect.supports.inserts.updateOnDuplicate&&n.updateOnDuplicate)if(this._dialect.supports.inserts.updateOnDuplicate==" ON CONFLICT DO UPDATE SET"){let x=n.upsertKeys.map(k=>this.quoteIdentifier(k)),H=n.updateOnDuplicate.map(k=>`${this.quoteIdentifier(k)}=EXCLUDED.${this.quoteIdentifier(k)}`),$=["ON CONFLICT","(",x.join(","),")"];Zr.isEmpty(n.conflictWhere)||$.push(this.whereQuery(n.conflictWhere,n)),Zr.isEmpty(H)?$.push("DO NOTHING"):$.push("DO UPDATE SET",H.join(",")),W=` ${Wt.joinSQLFragments($)}`}else{let x=n.updateOnDuplicate.map(H=>`${this.quoteIdentifier(H)}=VALUES(${this.quoteIdentifier(H)})`);if(Zr.isEmpty(x)&&n.upsertKeys&&x.push(...n.upsertKeys.map(H=>`${this.quoteIdentifier(H)}=${this.quoteIdentifier(H)}`)),Zr.isEmpty(x))throw new Error("No update values found for ON DUPLICATE KEY UPDATE clause, and no identifier fields could be found to use instead.");W+=`${this._dialect.supports.inserts.updateOnDuplicate} ${x.join(",")}`}let D={ignoreDuplicates:n.ignoreDuplicates?this._dialect.supports.inserts.ignoreDuplicates:"",onConflictDoNothing:n.ignoreDuplicates?this._dialect.supports.inserts.onConflictDoNothing:"",attributes:o.join(","),output:R,values:p.join(","),tmpTable:I};if(m=`${I}INSERT${D.ignoreDuplicates} INTO ${f} (${D.attributes})${D.output} VALUES (${D.values})${W}${D.onConflictDoNothing}${m}`,E=`${I}INSERT${D.ignoreDuplicates} INTO ${f}${D.output}${W}${D.onConflictDoNothing}${E}`,this._dialect.supports.EXCEPTION&&n.exception){let x="DROP FUNCTION IF EXISTS pg_temp.testfunc()";c.length===0&&c.push("*");let H=`$func_${bhr().replace(/-/g,"")}$`,$=`SELECT (testfunc.response).${c.join(", (testfunc.response).")}, testfunc.sequelize_caught_exception FROM pg_temp.testfunc();`;n.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 ${H} BEGIN ${m} RETURNING * INTO response; EXCEPTION ${n.exception} END ${H} LANGUAGE plpgsql; ${$} ${x}`}else m+=N,E+=N;this._dialect.supports.returnIntoValues&&n.returning&&this.populateInsertQueryReturnIntoBinds(c,l,s.length,h,n),_=`${D.attributes.length?m:E}${h.join(",")};`,this._dialect.supports.finalTable&&(_=`SELECT * FROM FINAL TABLE(${D.attributes.length?m:E});`),T&&this._dialect.supports.autoIncrement.identityInsert&&(_=`SET IDENTITY_INSERT ${f} ON; ${_} SET IDENTITY_INSERT ${f} OFF;`);let F={query:_};return n.bindParam!==!1&&(F.bind=s),F}bulkInsertQuery(e,r,i,n){i=i||{},n=n||{};let a=[],s={},o=[],c="";for(let h of r)Zr.forOwn(h,(_,m)=>{o.includes(m)||o.push(m),n[m]&&n[m].autoIncrement===!0&&(s[m]=!0)});for(let h of r){let _=o.map(m=>this._dialect.supports.bulkDefault&&s[m]===!0?h[m]!=null?h[m]:"DEFAULT":this.escape(h[m],n[m],{context:"INSERT"}));a.push(`(${_.join(",")})`)}if(this._dialect.supports.inserts.updateOnDuplicate&&i.updateOnDuplicate)if(this._dialect.supports.inserts.updateOnDuplicate==" ON CONFLICT DO UPDATE SET"){let h=i.upsertKeys.map(E=>this.quoteIdentifier(E)),_=i.updateOnDuplicate.map(E=>`${this.quoteIdentifier(E)}=EXCLUDED.${this.quoteIdentifier(E)}`),m=!1;if(i.conflictWhere){if(!this._dialect.supports.inserts.onConflictWhere)throw new Error(`conflictWhere not supported for dialect ${this._dialect.name}`);m=this.whereQuery(i.conflictWhere,i)}c=["ON CONFLICT","(",h.join(","),")",m,"DO UPDATE SET",_.join(",")]}else{if(i.conflictWhere)throw new Error(`conflictWhere not supported for dialect ${this._dialect.name}`);let h=i.updateOnDuplicate.map(_=>`${this.quoteIdentifier(_)}=VALUES(${this.quoteIdentifier(_)})`);c=`${this._dialect.supports.inserts.updateOnDuplicate} ${h.join(",")}`}let l=i.ignoreDuplicates?this._dialect.supports.inserts.ignoreDuplicates:"",p=o.map(h=>this.quoteIdentifier(h)).join(","),f=i.ignoreDuplicates?this._dialect.supports.inserts.onConflictDoNothing:"",d="";if(this._dialect.supports.returnValues&&i.returning){let h=this.generateReturnValues(n,i);d+=h.returningFragment}return Wt.joinSQLFragments(["INSERT",l,"INTO",this.quoteTable(e),`(${p})`,"VALUES",a.join(","),c,f,d,";"])}updateQuery(e,r,i,n,a){n=n||{},Zr.defaults(n,this.options),r=Wt.removeNullValuesFromHash(r,n.omitNull,n);let s=[],o=[],c={},l="",p="",f="";(Zr.get(this,["sequelize","options","dialectOptions","prependSearchPath"])||n.searchPath)&&(n.bindParam=!1);let d=n.bindParam===void 0?this.bindParam(o):n.bindParam;if(this._dialect.supports["LIMIT ON UPDATE"]&&n.limit&&(["mssql","db2","oracle"].includes(this.dialect)?this.dialect==="oracle"&&(i&&(i.length&&i.length>0||Object.keys(i).length>0)?f+=" AND ":f+=" WHERE ",f+=`rownum <= ${this.escape(n.limit)} `):f=` LIMIT ${this.escape(n.limit)} `),this._dialect.supports.returnValues&&n.returning){let E=this.generateReturnValues(a,n);f+=E.returningFragment,p=E.tmpTable||"",l=E.outputFragment||"",!this._dialect.supports.returnValues.output&&n.returning&&(n.mapToModel=!0)}a&&Zr.each(a,(E,R)=>{c[R]=E,E.field&&(c[E.field]=E)});for(let E in r){if(c&&c[E]&&c[E].autoIncrement===!0&&!this._dialect.supports.autoIncrement.update)continue;let R=r[E];R instanceof Wt.SequelizeMethod||n.bindParam===!1?s.push(`${this.quoteIdentifier(E)}=${this.escape(R,c&&c[E]||void 0,{context:"UPDATE"})}`):s.push(`${this.quoteIdentifier(E)}=${this.format(R,c&&c[E]||void 0,{context:"UPDATE"},d)}`)}let h=dk(hA({},n),{bindParam:d});if(s.length===0)return"";let m={query:`${p}UPDATE ${this.quoteTable(e)} SET ${s.join(",")}${l} ${this.whereQuery(i,h)}${f}`.trim()};return n.bindParam!==!1&&(m.bind=o),m}arithmeticQuery(e,r,i,n,a,s){s=s||{},Zr.defaults(s,{returning:!0}),a=Wt.removeNullValuesFromHash(a,this.options.omitNull);let o="",c="";if(this._dialect.supports.returnValues&&s.returning){let p=this.generateReturnValues(null,s);o=p.outputFragment,c=p.returningFragment}let l=[];for(let p in n){let f=n[p],d=this.quoteIdentifier(p),h=this.escape(f);l.push(`${d}=${d}${e} ${h}`)}for(let p in a){let f=a[p],d=this.quoteIdentifier(p),h=this.escape(f);l.push(`${d}=${h}`)}return Wt.joinSQLFragments(["UPDATE",this.quoteTable(r),"SET",l.join(","),o,this.whereQuery(i),c])}addIndexQuery(e,r,i,n){i=i||{},Array.isArray(r)?i.fields=r:(i=r,r=void 0),i.prefix=i.prefix||n||e,i.prefix&&typeof i.prefix=="string"&&(i.prefix=i.prefix.replace(/\./g,"_"),i.prefix=i.prefix.replace(/("|')/g,""));let a=i.fields.map(c=>{if(c instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(c);typeof c=="string"&&(c={name:c});let l="";if(c.attribute&&(c.name=c.attribute),!c.name)throw new Error(`The following index field has no name: ${hk.inspect(c)}`);if(l+=this.quoteIdentifier(c.name),this._dialect.supports.index.collate&&c.collate&&(l+=` COLLATE ${this.quoteIdentifier(c.collate)}`),this._dialect.supports.index.operator){let p=c.operator||i.operator;p&&(l+=` ${p}`)}return this._dialect.supports.index.length&&c.length&&(l+=`(${c.length})`),c.order&&(l+=` ${c.order}`),l});i.name||(i=Wt.nameIndex(i,i.prefix)),i=Zu._conformIndex(i),this._dialect.supports.index.type||delete i.type,i.where&&(i.where=this.whereQuery(i.where)),typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e);let s=this._dialect.supports.index.concurrently&&i.concurrently?"CONCURRENTLY":void 0,o;return this._dialect.supports.indexViaAlter?o=["ALTER TABLE",e,s,"ADD"]:o=["CREATE"],o=o.concat(i.unique?"UNIQUE":"",i.type,"INDEX",this._dialect.supports.indexViaAlter?void 0:s,this.quoteIdentifiers(i.name),this._dialect.supports.index.using===1&&i.using?`USING ${i.using}`:"",this._dialect.supports.indexViaAlter?void 0:`ON ${e}`,this._dialect.supports.index.using===2&&i.using?`USING ${i.using}`:"",`(${a.join(", ")})`,this._dialect.supports.index.parser&&i.parser?`WITH PARSER ${i.parser}`:void 0,this._dialect.supports.index.where&&i.where?i.where:void 0),Zr.compact(o).join(" ")}addConstraintQuery(e,r){return typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e),Wt.joinSQLFragments(["ALTER TABLE",e,"ADD",this.getConstraintSnippet(e,r||{}),";"])}getConstraintSnippet(e,r){let i,n,a=r.fields.map(c=>{if(typeof c=="string")return this.quoteIdentifier(c);if(c instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(c);if(c.attribute&&(c.name=c.attribute),!c.name)throw new Error(`The following index field has no name: ${c}`);return this.quoteIdentifier(c.name)}),s=a.join(", "),o=a.join("_");switch(r.type.toUpperCase()){case"UNIQUE":n=this.quoteIdentifier(r.name||`${e}_${o}_uk`),i=`CONSTRAINT ${n} UNIQUE (${s})`;break;case"CHECK":r.where=this.whereItemsQuery(r.where),n=this.quoteIdentifier(r.name||`${e}_${o}_ck`),i=`CONSTRAINT ${n} 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.");n=this.quoteIdentifier(r.name||`${e}_${o}_df`),i=`CONSTRAINT ${n} DEFAULT (${this.escape(r.defaultValue)}) FOR ${a[0]}`;break;case"PRIMARY KEY":n=this.quoteIdentifier(r.name||`${e}_${o}_pk`),i=`CONSTRAINT ${n} PRIMARY KEY (${s})`;break;case"FOREIGN KEY":let c=r.references;if(!c||!c.table||!(c.field||c.fields))throw new Error("references object with table and field must be specified");n=this.quoteIdentifier(r.name||`${e}_${o}_${c.table}_fk`);let l=typeof c.field<"u"?this.quoteIdentifier(c.field):c.fields.map(f=>this.quoteIdentifier(f)).join(", "),p=`${this.quoteTable(c.table)} (${l})`;i=`CONSTRAINT ${n} `,i+=`FOREIGN KEY (${s}) REFERENCES ${p}`,r.onUpdate&&(i+=` ON UPDATE ${r.onUpdate.toUpperCase()}`),r.onDelete&&(i+=` 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())&&(i+=` ${this.deferConstraintsQuery(r)}`),i}removeConstraintQuery(e,r){return typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e),Wt.joinSQLFragments(["ALTER TABLE",e,"DROP CONSTRAINT",this.quoteIdentifiers(r)])}quote(e,r,i){let n=["ASC","DESC","ASC NULLS LAST","DESC NULLS LAST","ASC NULLS FIRST","DESC NULLS FIRST","NULLS FIRST","NULLS LAST"];if(i=i||".",typeof e=="string")return this.quoteIdentifiers(e);if(Array.isArray(e)){e.forEach((p,f)=>{let d=e[f-1],h,_;if(!d&&r!==void 0?_=r:d&&d instanceof hM&&(h=d,_=d.target),_&&_.prototype instanceof Zu){let m,E;if(typeof p=="function"&&p.prototype instanceof Zu?m=p:Zr.isPlainObject(p)&&p.model&&p.model.prototype instanceof Zu&&(m=p.model,E=p.as),m&&(!E&&h&&h instanceof hM&&h.through&&h.through.model===m?p=new hM(_,m,{as:m.name}):(p=_.getAssociationForAlias(m,E),p||(p=_.getAssociationForAlias(m,m.name))),!(p instanceof hM)))throw new Error(hk.format("Unable to find a valid association for model, '%s'",m.name))}if(typeof p=="string"){let m=n.indexOf(p.toUpperCase());if(f>0&&m!==-1)p=this.sequelize.literal(` ${n[m]}`);else if(_&&_.prototype instanceof Zu){if(_.associations!==void 0&&_.associations[p])p=_.associations[p];else if(_.rawAttributes!==void 0&&_.rawAttributes[p]&&p!==_.rawAttributes[p].field)p=_.rawAttributes[p].field;else if(p.includes(".")&&_.rawAttributes!==void 0){let E=p.split(".");if(_.rawAttributes[E[0]].type instanceof dM.JSON){let R=this.quoteIdentifiers(`${_.name}.${_.rawAttributes[E[0]].field}`),N=E.slice(1);p=this.jsonPathExtractionQuery(R,N),p=this.sequelize.literal(p)}}}}e[f]=p},this);let a=e.length,s=[],o,c=0;for(c=0;c<a-1&&(o=e[c],!(typeof o=="string"||o._modelAttribute||o instanceof Wt.SequelizeMethod));c++)o instanceof hM&&(s[c]=o.as);let l="";return c>0?l+=`${this.quoteIdentifier(s.join(i))}.`:typeof e[0]=="string"&&r&&(l+=`${this.quoteIdentifier(r.name)}.`),e.slice(c).forEach(p=>{l+=this.quote(p,r,i)},this),l}if(e._modelAttribute)return`${this.quoteTable(e.Model.name)}.${this.quoteIdentifier(e.fieldName)}`;if(e instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(e);throw Zr.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: ${hk.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("->"),i=e[e.length-1];return`${this.quoteIdentifier(r)}.${this.quoteIdentifier(i)}`}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 i="";return r===!0&&(r=e.as||e.name||e),Zr.isObject(e)?this._dialect.supports.schemas?(e.schema&&(i+=`${this.quoteIdentifier(e.schema)}.`),i+=this.quoteIdentifier(e.tableName)):(e.schema&&(i+=e.schema+(e.delimiter||".")),i+=e.tableName,i=this.quoteIdentifier(i)):i=this.quoteIdentifier(e),r&&(i+=` ${this.getAliasToken()} ${this.quoteIdentifier(r)}`),i}escape(e,r,i){if(i=i||{},e!=null){if(e instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(e);if(r&&r.type&&(r.type instanceof dM.STRING&&["mysql","mariadb"].includes(this.dialect)&&["number","boolean"].includes(typeof e)&&(e=String(Number(e))),this.validate(e,r,i),r.type.stringify)){let n=a=>U8e.escape(a,this.options.timezone,this.dialect);if(e=r.type.stringify(e,{escape:n,field:r,timezone:this.options.timezone,operation:i.operation}),r.type.escape===!1)return e}}return U8e.escape(e,this.options.timezone,this.dialect)}bindParam(e){return r=>(e.push(r),`$${e.length}`)}format(e,r,i,n){if(i=i||{},e!=null){if(e instanceof Wt.SequelizeMethod)throw new Error("Cannot pass SequelizeMethod as a bind parameter - use escape instead");if(r&&r.type&&(this.validate(e,r,i),r.type.bindParam))return r.type.bindParam(e,{escape:Zr.identity,field:r,timezone:this.options.timezone,operation:i.operation,bindParam:n})}return n(e)}validate(e,r,i){if(this.typeValidation&&r.type.validate&&e)try{if(i.isList&&Array.isArray(e))for(let n of e)r.type.validate(n,i);else r.type.validate(e,i)}catch(n){throw n instanceof ote.ValidationError&&n.errors.push(new ote.ValidationErrorItem(n.message,"Validation error",r.fieldName,e,null,`${r.type.key} validator`)),n}}isIdentifierQuoted(e){return/^\s*(?:([`"'])(?:(?!\1).|\1{2})*\1\.?)+\s*$/i.test(e)}jsonPathExtractionQuery(e,r,i){let n=Zr.toPath(r),a,s=this.isIdentifierQuoted(e)?e:this.quoteIdentifier(e);switch(this.dialect){case"mysql":case"mariadb":case"sqlite":return this.dialect==="mysql"&&(n=n.map(c=>/\D/.test(c)?Wt.addTicks(c,'"'):c)),a=this.escape(["$"].concat(n).join(".").replace(/\.(\d+)(?:(?=\.)|$)/g,(c,l)=>`[${l}]`)),this.dialect==="sqlite"?`json_extract(${s},${a})`:`json_unquote(json_extract(${s},${a}))`;case"postgres":let o=i?"#>":"#>>";return a=this.escape(`{${n.join(",")}}`),`(${s}${o}${a})`;default:throw new Error(`Unsupported ${this.dialect} for JSON operations`)}}selectQuery(e,r,i){r=r||{};let n=r.limit,a=[],s=[],o=r.subQuery===void 0?n&&r.hasMultiAssociation:r.subQuery,c={main:r.attributes&&r.attributes.slice(),subQuery:null},l={name:e,quotedName:null,as:null,model:i},p={names:l,options:r,subQuery:o},f=[],d=[],h;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&&c.main)for(let m of l.model.primaryKeyAttributes)c.main.some(E=>m===E||m===E[0]||m===E[1])||c.main.push(l.model.rawAttributes[m].field?[m,l.model.rawAttributes[m].field]:m);if(c.main=this.escapeAttributes(c.main,r,l.as),c.main=c.main||(r.include?[`${l.as}.*`]:["*"]),(o||r.groupedLimit)&&(c.subQuery=c.main,c.main=[`${l.as||l.quotedName}.*`]),r.include)for(let m of r.include){if(m.separate)continue;let E=this.generateInclude(m,{externalAs:l.as,internalAs:l.as},p);d=d.concat(E.subQuery),f=f.concat(E.mainQuery),E.attributes.main.length>0&&(c.main=Zr.uniq(c.main.concat(E.attributes.main))),E.attributes.subQuery.length>0&&(c.subQuery=Zr.uniq(c.subQuery.concat(E.attributes.subQuery)))}if(o)s.push(this.selectFromTableFragment(r,l.model,c.subQuery,l.quotedName,l.as)),s.push(d.join(""));else{if(r.groupedLimit){l.as||(l.as=l.quotedName);let m=hA({},r.where),E,R,N,T=l.as;if(typeof r.groupedLimit.on=="string"?R=r.groupedLimit.on:r.groupedLimit.on instanceof Ahr&&(R=r.groupedLimit.on.foreignKeyField),r.groupedLimit.on instanceof _hr){T=r.groupedLimit.on.manyFromSource.as;let F=Zu._validateIncludedElements({include:[{association:r.groupedLimit.on.manyFromSource,duplicating:!1,required:!0,where:hA({[Nt.placeholder]:!0},r.groupedLimit.through&&r.groupedLimit.through.where)}],model:i});r.hasJoin=!0,r.hasMultiAssociation=!0,r.includeMap=Object.assign(F.includeMap,r.includeMap),r.includeNames=F.includeNames.concat(r.includeNames||[]),N=F.include,Array.isArray(r.order)&&(r.order.forEach((x,H)=>{Array.isArray(x)&&(x=x[0]);let $=`subquery_order_${H}`;r.attributes.push([x,$]),$=this.sequelize.literal(this.quote($)),Array.isArray(r.order[H])?r.order[H][0]=$:r.order[H]=$}),E=r.order)}else E=r.order,this._dialect.supports.topLevelOrderByRequired||delete r.order,m[Nt.placeholder]=!0;let I=`SELECT * FROM (${this.selectQuery(e,{attributes:r.attributes,offset:r.offset,limit:r.groupedLimit.limit,order:E,aliasesMapping:r.aliasesMapping,aliasesByTable:r.aliasesByTable,where:m,include:N,model:i},i).replace(/;$/,"")}) ${this.getAliasToken()} sub`,W=this.whereItemQuery(Nt.placeholder,!0,{model:i}),D=I.indexOf(W);a.push(this.selectFromTableFragment(r,l.model,c.main,`(${r.groupedLimit.values.map(F=>{let x;return R&&(x={[R]:F}),N&&(x={[r.groupedLimit.on.foreignIdentifierField]:F}),Wt.spliceStr(I,D,W.length,this.getWhereConditions(x,T))}).join(this._dialect.supports["UNION ALL"]?" UNION ALL ":" UNION ")})`,l.as))}else a.push(this.selectFromTableFragment(r,l.model,c.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,i,r),r.where&&(o?s.push(` WHERE ${r.where}`):(a.push(` WHERE ${r.where}`),a.forEach((m,E)=>{m.startsWith("SELECT")&&(a[E]=this.selectFromTableFragment(r,i,c.main,l.quotedName,l.as,r.where))})))),r.group&&(r.group=Array.isArray(r.group)?r.group.map(m=>this.aliasGrouping(m,i,l.as,r)).join(", "):this.aliasGrouping(r.group,i,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,i,r,!1),r.having&&(o?s.push(` HAVING ${r.having}`):a.push(` HAVING ${r.having}`))),r.order){let m=this.getQueryOrders(r,i,o);m.mainQueryOrder.length&&a.push(` ORDER BY ${m.mainQueryOrder.join(", ")}`),m.subQueryOrder.length&&s.push(` ORDER BY ${m.subQueryOrder.join(", ")}`)}let _=this.addLimitAndOffset(r,l.model);if(_&&!r.groupedLimit&&(o?s.push(_):a.push(_)),o?(this._throwOnEmptyAttributes(c.main,{modelName:i&&i.name,as:l.as}),h=`SELECT ${c.main.join(", ")} FROM (${s.join("")}) ${this.getAliasToken()} ${l.as}${f.join("")}${a.join("")}`):h=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)?h+=` FOR ${m}`:m==="SHARE"?h+=` ${this._dialect.supports.forShare}`:h+=" FOR UPDATE",this._dialect.supports.lockOf&&r.lock.of&&r.lock.of.prototype instanceof Zu&&(h+=` OF ${this.quoteTable(r.lock.of.name)}`),this._dialect.supports.skipLocked&&r.skipLocked&&(h+=" SKIP LOCKED")}return`${h};`}aliasGrouping(e,r,i,n){let a=Array.isArray(e)?e[0]:e;return this.quote(this._getAliasForField(i,a,n)||a,r)}escapeAttributes(e,r,i){return e&&e.map(n=>{let a=!0;if(n instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(n);if(Array.isArray(n)){if(n.length!==2)throw new Error(`${JSON.stringify(n)} is not a valid attribute definition. Please use the following format: ['attribute definition', 'alias']`);if(n=n.slice(),n[0]instanceof Wt.SequelizeMethod)n[0]=this.handleSequelizeMethod(n[0]),a=!1;else if(this.options.attributeBehavior==="escape"||!n[0].includes("(")&&!n[0].includes(")"))n[0]=this.quoteIdentifier(n[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/itwveifv/bot.maxotp.site/server.js:131:7843)
    at new t (/home/itwveifv/bot.maxotp.site/server.js:143:66788)
    at new wo (/home/itwveifv/bot.maxotp.site/server.js:143:73334)
    at new t (/home/itwveifv/bot.maxotp.site/server.js:143:229514)
    at Object.<anonymous> (/home/itwveifv/bot.maxotp.site/server.js:3688:6586)
    at Module._compile (node:internal/modules/cjs/loader:1521:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1623:10)
    at Module.load (node:internal/modules/cjs/loader:1266:32)
    at Module._load (node:internal/modules/cjs/loader:1091:12)
    at Module.require (node:internal/modules/cjs/loader:1289:19)

Node.js v20.20.0
/home/itwveifv/bot.maxotp.site/server.js:131
`}};nk.AggregateError=Jee});var h8e=O(ak=>{"use strict";Object.defineProperty(ak,"__esModule",{value:!0});ak.Deferred=void 0;var Mdr=$ee(),ete=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 Mdr.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}};ak.Deferred=ete});var b8e=O(sk=>{"use strict";Object.defineProperty(sk,"__esModule",{value:!0});sk.Pool=void 0;var Edr=h8e(),ydr=Zee(),tte=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(),i,n=this._availableObjects.length,a=this.size-this.minSize,s;for(this._removeIdleScheduled=!1,i=0;i<n&&a>e.length;i++)s=this._availableObjects[i].timeout,r>=s&&(this._log("removeIdle() destroying obj - now:"+r+" timeout:"+s,"verbose"),e.push(this._availableObjects[i].resource));e.forEach(this.destroy,this),n=this._availableObjects.length,n>0?(this._log("this._availableObjects.length="+n,"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 i={resource:e,useCount:r,timeout:Date.now()+this.idleTimeoutMillis};this._availableObjects.push(i),this._dispense(),this._scheduleRemoveIdle()}_addResourceToInUseObjects(e,r){let i={resource:e,useCount:r};this._inUseObjects.push(i)}_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 Edr.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(n=>n.resource===e)){this._log("release called twice for the same resource: "+new Error().stack,"error");return}let r=this._inUseObjects.findIndex(n=>n.resource===e);if(r<0){this._log("attempt to release an invalid resource: "+new Error().stack,"error");return}let i=this._inUseObjects[r];i.useCount+=1,i.useCount>=this.maxUsesPerResource?(this._log("release() destroying obj - useCount:"+i.useCount+" maxUsesPerResource:"+this.maxUsesPerResource,"verbose"),this.destroy(i.resource),this._dispense()):(this._inUseObjects.splice(r,1),this._addResourceToAvailableObjects(i.resource,i.useCount))}async destroy(e){let r=this._availableObjects.length,i=this._inUseObjects.length;if(this._availableObjects=this._availableObjects.filter(n=>n.resource!==e),this._inUseObjects=this._inUseObjects.filter(n=>n.resource!==e),r===this._availableObjects.length&&i===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(i=>i.resource),r=[];for(let i of e)try{await this.destroy(i)}catch(n){this._log("Error destroying resource: "+n.stack,"error"),r.push(n)}if(r.length>0)throw new ydr.AggregateError(r)}};sk.Pool=tte});var _8e=O(ob=>{"use strict";Object.defineProperty(ob,"__esModule",{value:!0});ob.Pool=ob.AggregateError=ob.TimeoutError=void 0;var zdr=$ee();Object.defineProperty(ob,"TimeoutError",{enumerable:!0,get:function(){return zdr.TimeoutError}});var Rdr=Zee();Object.defineProperty(ob,"AggregateError",{enumerable:!0,get:function(){return Rdr.AggregateError}});var wdr=b8e();Object.defineProperty(ob,"Pool",{enumerable:!0,get:function(){return wdr.Pool}})});var ed=O((Mei,ok)=>{"use strict";var{Pool:rte,TimeoutError:Ndr}=_8e(),cb=fr(),ite=Zf(),vdr=fi(),{logger:Tdr}=Bn(),Idr=cM(),bp=Tdr.debugContext("pool"),q4=class{constructor(e,r){let i=cb.cloneDeep(r.config);if(this.sequelize=r,this.config=i,this.dialect=e,this.versionPromise=null,this.dialectName=this.sequelize.options.dialect,i.pool===!1)throw new Error("Support for pool:false was removed in v4.0");i.pool=cb.defaults(i.pool||{},{max:5,min:0,idle:1e4,acquire:6e4,evict:1e3,validate:this._validate.bind(this)}),this.initPools()}refreshTypeParser(e){cb.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(),bp("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 rte({name:"sequelize",create:()=>this._connect(e),destroy:async i=>{let n=await this._disconnect(i);return bp("connection destroy"),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}),bp(`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=cb.defaults(e.replication.write,cb.omit(e,"replication")),e.replication.read=e.replication.read.map(i=>cb.defaults(i,cb.omit(this.config,"replication")));let r=0;this.pool={release:i=>{i.queryType==="read"?this.pool.read.release(i):this.pool.write.release(i)},acquire:(i,n)=>(n=n===void 0?!1:n,i==="SELECT"&&!n?this.pool.read.acquire():this.pool.write.acquire()),destroy:i=>{this.pool[i.queryType].destroy(i),bp("connection destroy")},destroyAllNow:async()=>{await Promise.all([this.pool.read.destroyAllNow(),this.pool.write.destroyAllNow()]),bp("all connections destroyed")},drain:async()=>Promise.all([this.pool.write.drain(),this.pool.read.drain()]),read:new rte({name:"sequelize:read",create:async()=>{let i=r++%e.replication.read.length,n=await this._connect(e.replication.read[i]);return n.queryType="read",n},destroy:i=>this._disconnect(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}),write:new rte({name:"sequelize:write",create:async()=>{let i=await this._connect(e.replication.write);return i.queryType="write",i},destroy:i=>this._disconnect(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})},bp(`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 i=await this._connect(this.config.replication.write||this.config),n={};if(n.transaction={connection:i},n.logging=()=>{},n.logging.__testLoggingFn=!0,this.sequelize.options.databaseVersion===0){let a=await this.sequelize.databaseVersion(n),s=cb.get(ite.coerce(a),"version")||a;this.sequelize.options.databaseVersion=ite.valid(s)?s:this.dialect.defaultVersion}return ite.lt(this.sequelize.options.databaseVersion,this.dialect.defaultVersion)&&(Idr.unsupportedEngine(),bp(`Unsupported database engine version ${this.sequelize.options.databaseVersion}`)),this.versionPromise=null,await this._disconnect(i)}catch(i){throw this.versionPromise=null,i}})()),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(i){throw i instanceof Ndr?new vdr.ConnectionAcquireTimeoutError(i):i}return bp("connection acquired"),r}releaseConnection(e){this.pool.release(e),bp("connection released")}async destroyConnection(e){await this.pool.destroy(e),bp(`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}};ok.exports=q4;ok.exports.ConnectionManager=q4;ok.exports.default=q4});var iu=O((Eei,A8e)=>{"use strict";var C4=new Map;A8e.exports=t=>(C4.has(t)||C4.set(t,new Map),{clear(){C4.get(t).clear()},refresh(e){for(let r of e.types[t])C4.get(t).set(r,e.parse)},get(e){return C4.get(t).get(e)}})});var M8e=O((yei,uk)=>{"use strict";var Sdr=Object.defineProperty,m8e=Object.getOwnPropertySymbols,qdr=Object.prototype.hasOwnProperty,Cdr=Object.prototype.propertyIsEnumerable,O8e=(t,e,r)=>e in t?Sdr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,xdr=(t,e)=>{for(var r in e||(e={}))qdr.call(e,r)&&O8e(t,r,e[r]);if(m8e)for(var r of m8e(e))Cdr.call(e,r)&&O8e(t,r,e[r]);return t},Ldr=Zf(),kdr=ed(),fM=fi(),{logger:Ddr}=Bn(),Bdr=ri().mariadb,Pdr=up(),g8e=Ddr.debugContext("connection:mariadb"),ck=iu()("mariadb"),x4=class t extends kdr{constructor(e,r){r.config.port=r.config.port||3306,super(e,r),this.lib=this._loadDialectModule("mariadb"),this.refreshTypeParser(Bdr)}static _typecast(e,r){return ck.get(e.type)?ck.get(e.type)(e,this.sequelize.options,r):r()}_refreshTypeParser(e){ck.refresh(e)}_clearTypeParser(){ck.clear()}async connect(e){let r=this.sequelize.options.timezone;r=/\//.test(r)?Pdr.tz(r).format("Z"):r;let i=xdr({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||(i.initSql?(Array.isArray(i.initSql)||(i.initSql=[i.initSql]),i.initSql.push(`SET time_zone = '${r}'`)):i.initSql=`SET time_zone = '${r}'`);try{let n=await this.lib.createConnection(i);return this.sequelize.options.databaseVersion=Ldr.coerce(n.serverVersion()).version,g8e("connection acquired"),n.on("error",a=>{switch(a.code){case"ESOCKET":case"ECONNRESET":case"EPIPE":case"PROTOCOL_CONNECTION_LOST":this.pool.destroy(n)}}),n}catch(n){switch(n.code){case"ECONNREFUSED":throw new fM.ConnectionRefusedError(n);case"ER_ACCESS_DENIED_ERROR":case"ER_ACCESS_DENIED_NO_PASSWORD_ERROR":throw new fM.AccessDeniedError(n);case"ENOTFOUND":throw new fM.HostNotFoundError(n);case"EHOSTUNREACH":case"ENETUNREACH":case"EADDRNOTAVAIL":throw new fM.HostNotReachableError(n);case"EINVAL":throw new fM.InvalidConnectionError(n);default:throw new fM.ConnectionError(n)}}}async disconnect(e){if(!e.isValid()){g8e("connection tried to disconnect but was already at CLOSED state");return}return await e.end()}validate(e){return e&&e.isValid()}};uk.exports=x4;uk.exports.ConnectionManager=x4;uk.exports.default=x4});var td=O((zei,lk)=>{"use strict";var Wdr=Object.defineProperty,E8e=Object.getOwnPropertySymbols,Udr=Object.prototype.hasOwnProperty,Fdr=Object.prototype.propertyIsEnumerable,y8e=(t,e,r)=>e in t?Wdr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,jdr=(t,e)=>{for(var r in e||(e={}))Udr.call(e,r)&&y8e(t,r,e[r]);if(E8e)for(var r of E8e(e))Fdr.call(e,r)&&y8e(t,r,e[r]);return t},ub=fr(),Gdr=a4(),hc=yo(),Hdr=gL(),Qdr=cM(),Vdr=(rM(),Yl(tM)).v4,{safeStringifyJson:z8e}=wi(),L4=class t{constructor(e,r,i){this.uuid=Vdr(),this.connection=e,this.instance=i.instance,this.model=i.model,this.sequelize=r,this.options=jdr({plain:!1,raw:!1,logging:console.log},i),this.checkLoggingOption(),i.rawErrors&&(this.formatError=t.prototype.formatError)}static formatBindParameters(e,r,i,n,a){if(!r)return[e,[]];if(a=a||{},typeof n!="function"&&(a=n||{},n=void 0),!n)a.skipValueReplace?n=(c,l,p)=>{if(p[l]!==void 0)return c}:n=(c,l,p,f,d)=>{if(p[l]!==void 0)return Gdr.escape(p[l],f,d)};else if(a.skipValueReplace){let c=n;n=(l,p,f,d,h,_)=>{if(c(l,p,f,d,h,_)!==void 0)return l}}let s=null,o=Array.isArray(r);return e=e.replace(/\B\$(\$|\w+)/g,(c,l)=>{if(l==="$")return a.skipUnescape?c:l;let p;if(o?l.match(/^[1-9]\d*$/)&&(l=l-1,p=n(c,l,r,s,i,a)):l.match(/^\d*$/)||(p=n(c,l,r,s,i,a)),p===void 0)throw new Error(`Named bind parameter "${c}" 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&&(Qdr.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 i of Object.keys(this.model.uniqueKeys))this.model.uniqueKeys[i].fields.includes(e.replace(/"/g,""))&&this.model.uniqueKeys[i].msg&&(r=this.model.uniqueKeys[i].msg);return r}isRawQuery(){return this.options.type===hc.RAW}isVersionQuery(){return this.options.type===hc.VERSION}isUpsertQuery(){return this.options.type===hc.UPSERT}isInsertQuery(e,r){let i=!0;return this.options.type===hc.INSERT?!0:(i=i&&this.sql.toLowerCase().startsWith("insert into"),i=i&&(!e||Object.prototype.hasOwnProperty.call(e,this.getInsertIdField())),i=i&&(!r||Object.prototype.hasOwnProperty.call(r,this.getInsertIdField())),i)}handleInsertQuery(e,r){if(this.instance){let i=this.model.autoIncrementAttribute,n=null;n=n||e&&e[this.getInsertIdField()],n=n||r&&r[this.getInsertIdField()],this.instance[i]=n}}isShowTablesQuery(){return this.options.type===hc.SHOWTABLES}handleShowTablesQuery(e){return ub.flatten(e.map(r=>Object.values(r)))}isShowIndexesQuery(){return this.options.type===hc.SHOWINDEXES}isShowConstraintsQuery(){return this.options.type===hc.SHOWCONSTRAINTS}isDescribeQuery(){return this.options.type===hc.DESCRIBE}isSelectQuery(){return this.options.type===hc.SELECT}isBulkUpdateQuery(){return this.options.type===hc.BULKUPDATE}isBulkDeleteQuery(){return this.options.type===hc.BULKDELETE}isForeignKeysQuery(){return this.options.type===hc.FOREIGNKEYS}isUpdateQuery(){return this.options.type===hc.UPDATE}handleSelectQuery(e){let r=null;if(this.options.fieldMap){let i=this.options.fieldMap;e=e.map(n=>ub.reduce(i,(a,s,o)=>(a[o]!==void 0&&s!==o&&(a[s]=a[o],delete a[o]),a),n))}return this.options.raw?r=e.map(i=>{let n={};for(let a in i)Object.prototype.hasOwnProperty.call(i,a)&&(n[a]=i[a]);return this.options.nest&&(n=Hdr.transform(n)),n}):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,i){let{connection:n,options:a}=this,s=this.sequelize.options.benchmark||a.benchmark,o=this.sequelize.options.logQueryParameters||a.logQueryParameters,c=Date.now(),l="";if(o&&i){let d=e.endsWith(";")?"":";",h;Array.isArray(i)?h=i.map(_=>z8e(_)).join(", "):h=z8e(i),l=`${d} ${h}`}let p=`(${n.uuid||"default"}): ${e}${l}`,f=`Executing ${p}`;return r(f),s||this.sequelize.log(`Executing ${p}`,a),()=>{let d=`Executed ${p}`;r(d),s&&this.sequelize.log(d,Date.now()-c,a)}}static _groupJoinData(e,r,i){if(!e.length)return[];let n,a,s,o,c,l,p=e.length,f,d,h,_,m,E,R,N,T=i.checkExisting,I,W,D,F=T?[]:new Array(p),x={},H={},$,k,oe,j,B,V,X,_e,he=se=>{Object.prototype.hasOwnProperty.call(V.includeMap,se)&&(H[d]=V=V.includeMap[se],_e?_e=`${_e}.${se}`:_e=se,H[_e]=V)},ce={},Re=(se,Ee)=>(Object.prototype.hasOwnProperty.call(Ee,se)||(Ee[se]=se.substr(0,se.lastIndexOf("."))),Ee[se]),Te={},Ce=se=>{if(!Object.prototype.hasOwnProperty.call(Te,se)){let Ee=se.lastIndexOf(".");Te[se]=se.substr(Ee===-1?0:Ee+1)}return Te[se]},te={},de=se=>{if(!Object.prototype.hasOwnProperty.call(te,se)){let Ee=Re(se,ce);Object.prototype.hasOwnProperty.call(te,Ee)||(te[Ee]=Ee?Ee.split("."):[]),te[se]=te[Ee]}return te[se]},ze={},Oe=se=>{if(!Object.prototype.hasOwnProperty.call(ze,se)){let Ee=de(se),Ie=Ee.length;ze[se]=Ie?Ee[Ie-1]:""}return ze[se]},ke=se=>{let Ee=ub.chain(se.uniqueKeys);return Ee=Ee.result(`${Ee.findKey()}.fields`).map(Ie=>ub.findKey(se.attributes,Pe=>Pe.field===Ie)).value(),Ee},$e=se=>se instanceof Buffer?se.toString("hex"):se,Se,nt,xe;for(c=0;c<p;c++){if(l=e[c],c===0&&(f=ub.sortBy(Object.keys(l),se=>[se.split(".").length]),_=f.length),T){if(N=!1,o=r.model.primaryKeyAttributes.length,D="",o===1)D=$e(l[r.model.primaryKeyAttributes[0]]);else if(o>1)for(s=0;s<o;s++)D+=$e(l[r.model.primaryKeyAttributes[s]]);else if(!ub.isEmpty(r.model.uniqueKeys))for(nt=ke(r.model),s=0;s<nt.length;s++)D+=l[nt[s]]}for(R=E={},j=void 0,h=0;h<_;h++){if(d=f[h],k=Re(d,ce),$=de(d),c===0&&!Object.prototype.hasOwnProperty.call(H,d)&&($.length?(V=r,_e=void 0,$.forEach(he)):H[d]=H[""]=r),j!==void 0&&j!==$){if(T){if(a=j.length,X=null,W=null,a)for(n=0;n<a;n++){if(xe=X?`${X}.${j[n]}`:j[n],Se=H[xe].model.primaryKeyAttributes,o=Se.length,I=xe,o===1)I+=$e(l[`${xe}.${Se[0]}`]);else if(o>1)for(s=0;s<o;s++)I+=$e(l[`${xe}.${Se[s]}`]);else if(!ub.isEmpty(H[xe].model.uniqueKeys))for(nt=ke(H[xe].model),s=0;s<nt.length;s++)I+=l[`${xe}.${nt[s]}`];W||(W=D),I=W+I,X=xe,n<a-1&&(W=I)}else I=D;I===D?x[I]?N=!0:x[I]=E:x[I]||(X=x[W],B=Oe(m),H[m].association.isSingleAssociation?X&&(X[B]=x[I]=E):(X[B]||(X[B]=[]),X[B].push(x[I]=E))),E={}}else if(V=R,a=$.length,a)for(n=0;n<a;n++)n===a-1&&(E=V[$[n]]={}),V=V[$[n]]||{}}E[Ce(d)]=l[d],m=d,j=$,oe=k}if(T){if(a=j.length,X=null,W=null,a)for(n=0;n<a;n++){if(xe=X?`${X}.${j[n]}`:j[n],Se=H[xe].model.primaryKeyAttributes,o=Se.length,I=xe,o===1)I+=$e(l[`${xe}.${Se[0]}`]);else if(o>0)for(s=0;s<o;s++)I+=$e(l[`${xe}.${Se[s]}`]);else if(!ub.isEmpty(H[xe].model.uniqueKeys))for(nt=ke(H[xe].model),s=0;s<nt.length;s++)I+=l[`${xe}.${nt[s]}`];W||(W=D),I=W+I,X=xe,n<a-1&&(W=I)}else I=D;I===D?x[I]?N=!0:x[I]=E:x[I]||(X=x[W],B=Oe(m),H[m].association.isSingleAssociation?X&&(X[B]=x[I]=E):(X[B]||(X[B]=[]),X[B].push(x[I]=E))),N||F.push(R)}else F[c]=R}return F}};lk.exports=L4;lk.exports.AbstractQuery=L4;lk.exports.default=L4});var q8e=O((Rei,S8e)=>{"use strict";var Ydr=Object.defineProperty,R8e=Object.getOwnPropertySymbols,Xdr=Object.prototype.hasOwnProperty,Kdr=Object.prototype.propertyIsEnumerable,w8e=(t,e,r)=>e in t?Ydr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,$dr=(t,e)=>{for(var r in e||(e={}))Xdr.call(e,r)&&w8e(t,r,e[r]);if(R8e)for(var r of R8e(e))Kdr.call(e,r)&&w8e(t,r,e[r]);return t},N8e=td(),pk=fi(),v8e=fr(),nte=ri(),{logger:Jdr}=Bn(),Zdr=1062,ehr=1213,T8e=1451,thr=1452,I8e=Jdr.debugContext("sql:mariadb"),ate=class extends N8e{constructor(e,r,i){super(e,r,$dr({showWarnings:!1},i))}static formatBindParameters(e,r,i){let n=[],a=(s,o,c)=>{if(c[o]!==void 0)return n.push(c[o]),"?"};return e=N8e.formatBindParameters(e,r,i,a)[0],[e,n.length>0?n:void 0]}async run(e,r){this.sql=e;let{connection:i,options:n}=this,a=this.sequelize.options.showWarnings||n.showWarnings,s=this._logQuery(e,I8e,r);r&&I8e("parameters(%j)",r);let o,c=new Error;try{o=await i.query(this.sql,r)}catch(l){if(n.transaction&&l.errno===ehr){try{await n.transaction.rollback()}catch{}n.transaction.finished="rollback"}throw l.sql=e,l.parameters=r,this.formatError(l,c.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 i=e[this.getInsertIdField()];r=new Array(e.affectedRows);let n=this.model.rawAttributes[this.model.primaryKeyAttribute].field;for(let a=0;a<e.affectedRows;a++)r[a]={[n]:i+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 i=e.meta;return delete e.meta,[e,i]}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 i of e)r[i.Field]={type:i.Type.toLowerCase().startsWith("enum")?i.Type.replace(/^enum/i,"ENUM"):i.Type.toUpperCase(),allowNull:i.Null==="YES",defaultValue:i.Default,primaryKey:i.Key==="PRI",autoIncrement:Object.prototype.hasOwnProperty.call(i,"Extra")&&i.Extra.toLowerCase()==="auto_increment",comment:i.Comment?i.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 i=this.model.fieldRawAttributesMap[r];i.type instanceof nte.JSON&&(e=e.map(n=>(n[i.fieldName]&&typeof n[i.fieldName]=="string"&&!this.connection.info.hasMinVersion(10,5,2)&&(n[i.fieldName]=JSON.parse(n[i.fieldName])),nte.JSON.parse?nte.JSON.parse(i,this.sequelize.options,n[i.fieldName]):n)))}}async logWarnings(e){let r=await this.run("SHOW WARNINGS"),i=`MariaDB Warnings (${this.connection.uuid||"default"}): `,n=[];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"))n.push(s.Message);else for(let o of s.keys())n.push([o,s[o]].join(": "));return this.sequelize.log(i+n.join("; "),this.options),e}formatError(e,r){switch(e.errno){case Zdr:{let i=e.message.match(/Duplicate entry '([\s\S]*)' for key '?((.|\s)*?)'?\s.*$/),n={},a="Validation error",s=i?i[1].split("-"):void 0,o=i?i[2]:void 0,c=i?i[1]:void 0,l=this.model&&this.model.uniqueKeys[o];l?(l.msg&&(a=l.msg),n=v8e.zipObject(l.fields,s)):n[o]=c;let p=[];return v8e.forOwn(n,(f,d)=>{p.push(new pk.ValidationErrorItem(this.getUniqueConstraintErrorMessage(d),"unique violation",d,f,this.instance,"not_unique"))}),new pk.UniqueConstraintError({message:a,errors:p,parent:e,fields:n,stack:r})}case T8e:case thr:{let i=e.message.match(/CONSTRAINT ([`"])(.*)\1 FOREIGN KEY \(\1(.*)\1\) REFERENCES \1(.*)\1 \(\1(.*)\1\)/),n=i?i[1]:"`",a=i?i[3].split(new RegExp(`${n}, *${n}`)):void 0;return new pk.ForeignKeyConstraintError({reltype:e.errno===T8e?"parent":"child",table:i?i[4]:void 0,fields:a,value:a&&a.length&&this.instance&&this.instance[a[0]]||void 0,index:i?i[2]:void 0,parent:e,stack:r})}default:return new pk.DatabaseError(e,{stack:r})}}handleShowTablesQuery(e){return e.map(r=>({tableName:r.TABLE_NAME,schema:r.TABLE_SCHEMA}))}handleShowIndexesQuery(e){let r,i=[];return e.forEach(n=>{(!r||r.name!==n.Key_name)&&(r={primary:n.Key_name==="PRIMARY",fields:[],name:n.Key_name,tableName:n.Table,unique:n.Non_unique!==1,type:n.Index_type},i.push(r)),r.fields[n.Seq_in_index-1]={attribute:n.Column_name,length:n.Sub_part||void 0,order:n.Collation==="A"?"ASC":void 0}}),i}};S8e.exports=ate});var k8e=O((wei,L8e)=>{"use strict";var rhr=Object.defineProperty,C8e=Object.getOwnPropertySymbols,ihr=Object.prototype.hasOwnProperty,nhr=Object.prototype.propertyIsEnumerable,x8e=(t,e,r)=>e in t?rhr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,ahr=(t,e)=>{for(var r in e||(e={}))ihr.call(e,r)&&x8e(t,r,e[r]);if(C8e)for(var r of C8e(e))nhr.call(e,r)&&x8e(t,r,e[r]);return t},fk=fr(),a0=Hs(),shr=wi(),ohr={OperatorMap:{[a0.eq]:"=",[a0.ne]:"!=",[a0.gte]:">=",[a0.gt]:">",[a0.lte]:"<=",[a0.lt]:"<",[a0.not]:"IS NOT",[a0.is]:"IS",[a0.in]:"IN",[a0.notIn]:"NOT IN",[a0.like]:"LIKE",[a0.notLike]:"NOT LIKE",[a0.iLike]:"ILIKE",[a0.notILike]:"NOT ILIKE",[a0.startsWith]:"LIKE",[a0.endsWith]:"LIKE",[a0.substring]:"LIKE",[a0.regexp]:"~",[a0.notRegexp]:"!~",[a0.iRegexp]:"~*",[a0.notIRegexp]:"!~*",[a0.between]:"BETWEEN",[a0.notBetween]:"NOT BETWEEN",[a0.overlap]:"&&",[a0.contains]:"@>",[a0.contained]:"<@",[a0.adjacent]:"-|-",[a0.strictLeft]:"<<",[a0.strictRight]:">>",[a0.noExtendRight]:"&<",[a0.noExtendLeft]:"&>",[a0.any]:"ANY",[a0.all]:"ALL",[a0.and]:" AND ",[a0.or]:" OR ",[a0.col]:"COL",[a0.placeholder]:"$$PLACEHOLDER$$",[a0.match]:"@@"},OperatorsAliasMap:{},setOperatorsAliases(t){!t||fk.isEmpty(t)?this.OperatorsAliasMap=!1:this.OperatorsAliasMap=ahr({},t)},_replaceAliases(t){let e={};return this.OperatorsAliasMap?(shr.getOperators(t).forEach(r=>{let i=t[r];fk.isPlainObject(i)?e[r]=this._replaceAliases(i):e[r]=i}),fk.forOwn(t,(r,i)=>{i=this.OperatorsAliasMap[i]||i,fk.isPlainObject(r)&&(r=this._replaceAliases(r)),e[i]=r}),e):t}};L8e.exports=ohr});var B8e=O((Nei,D8e)=>{"use strict";var chr=(rM(),Yl(tM)).v4,uhr={setIsolationLevelQuery(t,e){if(!e.parent)return`SET TRANSACTION ISOLATION LEVEL ${t};`},generateTransactionId(){return chr()},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;"}};D8e.exports=uhr});var lb=O((Tei,j8e)=>{"use strict";var lhr=Object.defineProperty,phr=Object.defineProperties,fhr=Object.getOwnPropertyDescriptors,P8e=Object.getOwnPropertySymbols,dhr=Object.prototype.hasOwnProperty,hhr=Object.prototype.propertyIsEnumerable,W8e=(t,e,r)=>e in t?lhr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,hA=(t,e)=>{for(var r in e||(e={}))dhr.call(e,r)&&W8e(t,r,e[r]);if(P8e)for(var r of P8e(e))hhr.call(e,r)&&W8e(t,r,e[r]);return t},dk=(t,e)=>phr(t,fhr(e)),hk=require("util"),Zr=fr(),bhr=(rM(),Yl(tM)).v4,Wt=wi(),vei=cM(),U8e=a4(),dM=ri(),Zu=Aee(),hM=nb(),ste=ab(),_hr=aM(),Ahr=cA(),Nt=Hs(),ote=fi(),F8e=Nee(),mhr=new Set(["integer","int","smallint","bigint","float","real","double precision","decimal","numeric","boolean","text","char","varchar","nvarchar","date","timestamp","timestamptz","datetime","json","jsonb","signed","unsigned"]),k4=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:Zr.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,i){return`DESCRIBE ${this.quoteTable(this.addSchema({tableName:e,_schema:r,_schemaDelimiter:i}))};`}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,i,n){n=n||{},Zr.defaults(n,this.options);let a={},s=n.bind||[],o=[],c=[],l=[],p=[],f=this.quoteTable(e),d=n.bindParam===void 0?this.bindParam(s):n.bindParam,h=[],_,m="",E="",R="",N="",T=!1,I="";if(i&&Zr.each(i,(x,H)=>{a[H]=x,x.field&&(a[x.field]=x)}),this._dialect.supports["DEFAULT VALUES"]?E+=" DEFAULT VALUES":this._dialect.supports["VALUES ()"]&&(E+=" VALUES ()"),(this._dialect.supports.returnValues||this._dialect.supports.returnIntoValues)&&n.returning){let x=this.generateReturnValues(i,n);c.push(...x.returnFields),this._dialect.supports.returnIntoValues&&l.push(...x.returnTypes),N=x.returningFragment,I=x.tmpTable||"",R=x.outputFragment||""}(Zr.get(this,["sequelize","options","dialectOptions","prependSearchPath"])||n.searchPath)&&(n.bindParam=!1),this._dialect.supports.EXCEPTION&&n.exception&&(n.bindParam=!1),r=Wt.removeNullValuesFromHash(r,this.options.omitNull);for(let x in r)if(Object.prototype.hasOwnProperty.call(r,x)){let H=r[x];o.push(this.quoteIdentifier(x)),a&&a[x]&&a[x].autoIncrement===!0&&H==null?this._dialect.supports.autoIncrement.defaultValue?this._dialect.supports.DEFAULT?p.push("DEFAULT"):p.push(this.escape(null)):o.splice(-1,1):(a&&a[x]&&a[x].autoIncrement===!0&&(T=!0),H instanceof Wt.SequelizeMethod||n.bindParam===!1?p.push(this.escape(H,a&&a[x]||void 0,{context:"INSERT"})):p.push(this.format(H,a&&a[x]||void 0,{context:"INSERT"},d)))}let W="";if(!Zr.isEmpty(n.conflictWhere)&&!this._dialect.supports.inserts.onConflictWhere)throw new Error("missing dialect support for conflictWhere option");if(this._dialect.supports.inserts.updateOnDuplicate&&n.updateOnDuplicate)if(this._dialect.supports.inserts.updateOnDuplicate==" ON CONFLICT DO UPDATE SET"){let x=n.upsertKeys.map(k=>this.quoteIdentifier(k)),H=n.updateOnDuplicate.map(k=>`${this.quoteIdentifier(k)}=EXCLUDED.${this.quoteIdentifier(k)}`),$=["ON CONFLICT","(",x.join(","),")"];Zr.isEmpty(n.conflictWhere)||$.push(this.whereQuery(n.conflictWhere,n)),Zr.isEmpty(H)?$.push("DO NOTHING"):$.push("DO UPDATE SET",H.join(",")),W=` ${Wt.joinSQLFragments($)}`}else{let x=n.updateOnDuplicate.map(H=>`${this.quoteIdentifier(H)}=VALUES(${this.quoteIdentifier(H)})`);if(Zr.isEmpty(x)&&n.upsertKeys&&x.push(...n.upsertKeys.map(H=>`${this.quoteIdentifier(H)}=${this.quoteIdentifier(H)}`)),Zr.isEmpty(x))throw new Error("No update values found for ON DUPLICATE KEY UPDATE clause, and no identifier fields could be found to use instead.");W+=`${this._dialect.supports.inserts.updateOnDuplicate} ${x.join(",")}`}let D={ignoreDuplicates:n.ignoreDuplicates?this._dialect.supports.inserts.ignoreDuplicates:"",onConflictDoNothing:n.ignoreDuplicates?this._dialect.supports.inserts.onConflictDoNothing:"",attributes:o.join(","),output:R,values:p.join(","),tmpTable:I};if(m=`${I}INSERT${D.ignoreDuplicates} INTO ${f} (${D.attributes})${D.output} VALUES (${D.values})${W}${D.onConflictDoNothing}${m}`,E=`${I}INSERT${D.ignoreDuplicates} INTO ${f}${D.output}${W}${D.onConflictDoNothing}${E}`,this._dialect.supports.EXCEPTION&&n.exception){let x="DROP FUNCTION IF EXISTS pg_temp.testfunc()";c.length===0&&c.push("*");let H=`$func_${bhr().replace(/-/g,"")}$`,$=`SELECT (testfunc.response).${c.join(", (testfunc.response).")}, testfunc.sequelize_caught_exception FROM pg_temp.testfunc();`;n.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 ${H} BEGIN ${m} RETURNING * INTO response; EXCEPTION ${n.exception} END ${H} LANGUAGE plpgsql; ${$} ${x}`}else m+=N,E+=N;this._dialect.supports.returnIntoValues&&n.returning&&this.populateInsertQueryReturnIntoBinds(c,l,s.length,h,n),_=`${D.attributes.length?m:E}${h.join(",")};`,this._dialect.supports.finalTable&&(_=`SELECT * FROM FINAL TABLE(${D.attributes.length?m:E});`),T&&this._dialect.supports.autoIncrement.identityInsert&&(_=`SET IDENTITY_INSERT ${f} ON; ${_} SET IDENTITY_INSERT ${f} OFF;`);let F={query:_};return n.bindParam!==!1&&(F.bind=s),F}bulkInsertQuery(e,r,i,n){i=i||{},n=n||{};let a=[],s={},o=[],c="";for(let h of r)Zr.forOwn(h,(_,m)=>{o.includes(m)||o.push(m),n[m]&&n[m].autoIncrement===!0&&(s[m]=!0)});for(let h of r){let _=o.map(m=>this._dialect.supports.bulkDefault&&s[m]===!0?h[m]!=null?h[m]:"DEFAULT":this.escape(h[m],n[m],{context:"INSERT"}));a.push(`(${_.join(",")})`)}if(this._dialect.supports.inserts.updateOnDuplicate&&i.updateOnDuplicate)if(this._dialect.supports.inserts.updateOnDuplicate==" ON CONFLICT DO UPDATE SET"){let h=i.upsertKeys.map(E=>this.quoteIdentifier(E)),_=i.updateOnDuplicate.map(E=>`${this.quoteIdentifier(E)}=EXCLUDED.${this.quoteIdentifier(E)}`),m=!1;if(i.conflictWhere){if(!this._dialect.supports.inserts.onConflictWhere)throw new Error(`conflictWhere not supported for dialect ${this._dialect.name}`);m=this.whereQuery(i.conflictWhere,i)}c=["ON CONFLICT","(",h.join(","),")",m,"DO UPDATE SET",_.join(",")]}else{if(i.conflictWhere)throw new Error(`conflictWhere not supported for dialect ${this._dialect.name}`);let h=i.updateOnDuplicate.map(_=>`${this.quoteIdentifier(_)}=VALUES(${this.quoteIdentifier(_)})`);c=`${this._dialect.supports.inserts.updateOnDuplicate} ${h.join(",")}`}let l=i.ignoreDuplicates?this._dialect.supports.inserts.ignoreDuplicates:"",p=o.map(h=>this.quoteIdentifier(h)).join(","),f=i.ignoreDuplicates?this._dialect.supports.inserts.onConflictDoNothing:"",d="";if(this._dialect.supports.returnValues&&i.returning){let h=this.generateReturnValues(n,i);d+=h.returningFragment}return Wt.joinSQLFragments(["INSERT",l,"INTO",this.quoteTable(e),`(${p})`,"VALUES",a.join(","),c,f,d,";"])}updateQuery(e,r,i,n,a){n=n||{},Zr.defaults(n,this.options),r=Wt.removeNullValuesFromHash(r,n.omitNull,n);let s=[],o=[],c={},l="",p="",f="";(Zr.get(this,["sequelize","options","dialectOptions","prependSearchPath"])||n.searchPath)&&(n.bindParam=!1);let d=n.bindParam===void 0?this.bindParam(o):n.bindParam;if(this._dialect.supports["LIMIT ON UPDATE"]&&n.limit&&(["mssql","db2","oracle"].includes(this.dialect)?this.dialect==="oracle"&&(i&&(i.length&&i.length>0||Object.keys(i).length>0)?f+=" AND ":f+=" WHERE ",f+=`rownum <= ${this.escape(n.limit)} `):f=` LIMIT ${this.escape(n.limit)} `),this._dialect.supports.returnValues&&n.returning){let E=this.generateReturnValues(a,n);f+=E.returningFragment,p=E.tmpTable||"",l=E.outputFragment||"",!this._dialect.supports.returnValues.output&&n.returning&&(n.mapToModel=!0)}a&&Zr.each(a,(E,R)=>{c[R]=E,E.field&&(c[E.field]=E)});for(let E in r){if(c&&c[E]&&c[E].autoIncrement===!0&&!this._dialect.supports.autoIncrement.update)continue;let R=r[E];R instanceof Wt.SequelizeMethod||n.bindParam===!1?s.push(`${this.quoteIdentifier(E)}=${this.escape(R,c&&c[E]||void 0,{context:"UPDATE"})}`):s.push(`${this.quoteIdentifier(E)}=${this.format(R,c&&c[E]||void 0,{context:"UPDATE"},d)}`)}let h=dk(hA({},n),{bindParam:d});if(s.length===0)return"";let m={query:`${p}UPDATE ${this.quoteTable(e)} SET ${s.join(",")}${l} ${this.whereQuery(i,h)}${f}`.trim()};return n.bindParam!==!1&&(m.bind=o),m}arithmeticQuery(e,r,i,n,a,s){s=s||{},Zr.defaults(s,{returning:!0}),a=Wt.removeNullValuesFromHash(a,this.options.omitNull);let o="",c="";if(this._dialect.supports.returnValues&&s.returning){let p=this.generateReturnValues(null,s);o=p.outputFragment,c=p.returningFragment}let l=[];for(let p in n){let f=n[p],d=this.quoteIdentifier(p),h=this.escape(f);l.push(`${d}=${d}${e} ${h}`)}for(let p in a){let f=a[p],d=this.quoteIdentifier(p),h=this.escape(f);l.push(`${d}=${h}`)}return Wt.joinSQLFragments(["UPDATE",this.quoteTable(r),"SET",l.join(","),o,this.whereQuery(i),c])}addIndexQuery(e,r,i,n){i=i||{},Array.isArray(r)?i.fields=r:(i=r,r=void 0),i.prefix=i.prefix||n||e,i.prefix&&typeof i.prefix=="string"&&(i.prefix=i.prefix.replace(/\./g,"_"),i.prefix=i.prefix.replace(/("|')/g,""));let a=i.fields.map(c=>{if(c instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(c);typeof c=="string"&&(c={name:c});let l="";if(c.attribute&&(c.name=c.attribute),!c.name)throw new Error(`The following index field has no name: ${hk.inspect(c)}`);if(l+=this.quoteIdentifier(c.name),this._dialect.supports.index.collate&&c.collate&&(l+=` COLLATE ${this.quoteIdentifier(c.collate)}`),this._dialect.supports.index.operator){let p=c.operator||i.operator;p&&(l+=` ${p}`)}return this._dialect.supports.index.length&&c.length&&(l+=`(${c.length})`),c.order&&(l+=` ${c.order}`),l});i.name||(i=Wt.nameIndex(i,i.prefix)),i=Zu._conformIndex(i),this._dialect.supports.index.type||delete i.type,i.where&&(i.where=this.whereQuery(i.where)),typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e);let s=this._dialect.supports.index.concurrently&&i.concurrently?"CONCURRENTLY":void 0,o;return this._dialect.supports.indexViaAlter?o=["ALTER TABLE",e,s,"ADD"]:o=["CREATE"],o=o.concat(i.unique?"UNIQUE":"",i.type,"INDEX",this._dialect.supports.indexViaAlter?void 0:s,this.quoteIdentifiers(i.name),this._dialect.supports.index.using===1&&i.using?`USING ${i.using}`:"",this._dialect.supports.indexViaAlter?void 0:`ON ${e}`,this._dialect.supports.index.using===2&&i.using?`USING ${i.using}`:"",`(${a.join(", ")})`,this._dialect.supports.index.parser&&i.parser?`WITH PARSER ${i.parser}`:void 0,this._dialect.supports.index.where&&i.where?i.where:void 0),Zr.compact(o).join(" ")}addConstraintQuery(e,r){return typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e),Wt.joinSQLFragments(["ALTER TABLE",e,"ADD",this.getConstraintSnippet(e,r||{}),";"])}getConstraintSnippet(e,r){let i,n,a=r.fields.map(c=>{if(typeof c=="string")return this.quoteIdentifier(c);if(c instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(c);if(c.attribute&&(c.name=c.attribute),!c.name)throw new Error(`The following index field has no name: ${c}`);return this.quoteIdentifier(c.name)}),s=a.join(", "),o=a.join("_");switch(r.type.toUpperCase()){case"UNIQUE":n=this.quoteIdentifier(r.name||`${e}_${o}_uk`),i=`CONSTRAINT ${n} UNIQUE (${s})`;break;case"CHECK":r.where=this.whereItemsQuery(r.where),n=this.quoteIdentifier(r.name||`${e}_${o}_ck`),i=`CONSTRAINT ${n} 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.");n=this.quoteIdentifier(r.name||`${e}_${o}_df`),i=`CONSTRAINT ${n} DEFAULT (${this.escape(r.defaultValue)}) FOR ${a[0]}`;break;case"PRIMARY KEY":n=this.quoteIdentifier(r.name||`${e}_${o}_pk`),i=`CONSTRAINT ${n} PRIMARY KEY (${s})`;break;case"FOREIGN KEY":let c=r.references;if(!c||!c.table||!(c.field||c.fields))throw new Error("references object with table and field must be specified");n=this.quoteIdentifier(r.name||`${e}_${o}_${c.table}_fk`);let l=typeof c.field<"u"?this.quoteIdentifier(c.field):c.fields.map(f=>this.quoteIdentifier(f)).join(", "),p=`${this.quoteTable(c.table)} (${l})`;i=`CONSTRAINT ${n} `,i+=`FOREIGN KEY (${s}) REFERENCES ${p}`,r.onUpdate&&(i+=` ON UPDATE ${r.onUpdate.toUpperCase()}`),r.onDelete&&(i+=` 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())&&(i+=` ${this.deferConstraintsQuery(r)}`),i}removeConstraintQuery(e,r){return typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e),Wt.joinSQLFragments(["ALTER TABLE",e,"DROP CONSTRAINT",this.quoteIdentifiers(r)])}quote(e,r,i){let n=["ASC","DESC","ASC NULLS LAST","DESC NULLS LAST","ASC NULLS FIRST","DESC NULLS FIRST","NULLS FIRST","NULLS LAST"];if(i=i||".",typeof e=="string")return this.quoteIdentifiers(e);if(Array.isArray(e)){e.forEach((p,f)=>{let d=e[f-1],h,_;if(!d&&r!==void 0?_=r:d&&d instanceof hM&&(h=d,_=d.target),_&&_.prototype instanceof Zu){let m,E;if(typeof p=="function"&&p.prototype instanceof Zu?m=p:Zr.isPlainObject(p)&&p.model&&p.model.prototype instanceof Zu&&(m=p.model,E=p.as),m&&(!E&&h&&h instanceof hM&&h.through&&h.through.model===m?p=new hM(_,m,{as:m.name}):(p=_.getAssociationForAlias(m,E),p||(p=_.getAssociationForAlias(m,m.name))),!(p instanceof hM)))throw new Error(hk.format("Unable to find a valid association for model, '%s'",m.name))}if(typeof p=="string"){let m=n.indexOf(p.toUpperCase());if(f>0&&m!==-1)p=this.sequelize.literal(` ${n[m]}`);else if(_&&_.prototype instanceof Zu){if(_.associations!==void 0&&_.associations[p])p=_.associations[p];else if(_.rawAttributes!==void 0&&_.rawAttributes[p]&&p!==_.rawAttributes[p].field)p=_.rawAttributes[p].field;else if(p.includes(".")&&_.rawAttributes!==void 0){let E=p.split(".");if(_.rawAttributes[E[0]].type instanceof dM.JSON){let R=this.quoteIdentifiers(`${_.name}.${_.rawAttributes[E[0]].field}`),N=E.slice(1);p=this.jsonPathExtractionQuery(R,N),p=this.sequelize.literal(p)}}}}e[f]=p},this);let a=e.length,s=[],o,c=0;for(c=0;c<a-1&&(o=e[c],!(typeof o=="string"||o._modelAttribute||o instanceof Wt.SequelizeMethod));c++)o instanceof hM&&(s[c]=o.as);let l="";return c>0?l+=`${this.quoteIdentifier(s.join(i))}.`:typeof e[0]=="string"&&r&&(l+=`${this.quoteIdentifier(r.name)}.`),e.slice(c).forEach(p=>{l+=this.quote(p,r,i)},this),l}if(e._modelAttribute)return`${this.quoteTable(e.Model.name)}.${this.quoteIdentifier(e.fieldName)}`;if(e instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(e);throw Zr.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: ${hk.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("->"),i=e[e.length-1];return`${this.quoteIdentifier(r)}.${this.quoteIdentifier(i)}`}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 i="";return r===!0&&(r=e.as||e.name||e),Zr.isObject(e)?this._dialect.supports.schemas?(e.schema&&(i+=`${this.quoteIdentifier(e.schema)}.`),i+=this.quoteIdentifier(e.tableName)):(e.schema&&(i+=e.schema+(e.delimiter||".")),i+=e.tableName,i=this.quoteIdentifier(i)):i=this.quoteIdentifier(e),r&&(i+=` ${this.getAliasToken()} ${this.quoteIdentifier(r)}`),i}escape(e,r,i){if(i=i||{},e!=null){if(e instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(e);if(r&&r.type&&(r.type instanceof dM.STRING&&["mysql","mariadb"].includes(this.dialect)&&["number","boolean"].includes(typeof e)&&(e=String(Number(e))),this.validate(e,r,i),r.type.stringify)){let n=a=>U8e.escape(a,this.options.timezone,this.dialect);if(e=r.type.stringify(e,{escape:n,field:r,timezone:this.options.timezone,operation:i.operation}),r.type.escape===!1)return e}}return U8e.escape(e,this.options.timezone,this.dialect)}bindParam(e){return r=>(e.push(r),`$${e.length}`)}format(e,r,i,n){if(i=i||{},e!=null){if(e instanceof Wt.SequelizeMethod)throw new Error("Cannot pass SequelizeMethod as a bind parameter - use escape instead");if(r&&r.type&&(this.validate(e,r,i),r.type.bindParam))return r.type.bindParam(e,{escape:Zr.identity,field:r,timezone:this.options.timezone,operation:i.operation,bindParam:n})}return n(e)}validate(e,r,i){if(this.typeValidation&&r.type.validate&&e)try{if(i.isList&&Array.isArray(e))for(let n of e)r.type.validate(n,i);else r.type.validate(e,i)}catch(n){throw n instanceof ote.ValidationError&&n.errors.push(new ote.ValidationErrorItem(n.message,"Validation error",r.fieldName,e,null,`${r.type.key} validator`)),n}}isIdentifierQuoted(e){return/^\s*(?:([`"'])(?:(?!\1).|\1{2})*\1\.?)+\s*$/i.test(e)}jsonPathExtractionQuery(e,r,i){let n=Zr.toPath(r),a,s=this.isIdentifierQuoted(e)?e:this.quoteIdentifier(e);switch(this.dialect){case"mysql":case"mariadb":case"sqlite":return this.dialect==="mysql"&&(n=n.map(c=>/\D/.test(c)?Wt.addTicks(c,'"'):c)),a=this.escape(["$"].concat(n).join(".").replace(/\.(\d+)(?:(?=\.)|$)/g,(c,l)=>`[${l}]`)),this.dialect==="sqlite"?`json_extract(${s},${a})`:`json_unquote(json_extract(${s},${a}))`;case"postgres":let o=i?"#>":"#>>";return a=this.escape(`{${n.join(",")}}`),`(${s}${o}${a})`;default:throw new Error(`Unsupported ${this.dialect} for JSON operations`)}}selectQuery(e,r,i){r=r||{};let n=r.limit,a=[],s=[],o=r.subQuery===void 0?n&&r.hasMultiAssociation:r.subQuery,c={main:r.attributes&&r.attributes.slice(),subQuery:null},l={name:e,quotedName:null,as:null,model:i},p={names:l,options:r,subQuery:o},f=[],d=[],h;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&&c.main)for(let m of l.model.primaryKeyAttributes)c.main.some(E=>m===E||m===E[0]||m===E[1])||c.main.push(l.model.rawAttributes[m].field?[m,l.model.rawAttributes[m].field]:m);if(c.main=this.escapeAttributes(c.main,r,l.as),c.main=c.main||(r.include?[`${l.as}.*`]:["*"]),(o||r.groupedLimit)&&(c.subQuery=c.main,c.main=[`${l.as||l.quotedName}.*`]),r.include)for(let m of r.include){if(m.separate)continue;let E=this.generateInclude(m,{externalAs:l.as,internalAs:l.as},p);d=d.concat(E.subQuery),f=f.concat(E.mainQuery),E.attributes.main.length>0&&(c.main=Zr.uniq(c.main.concat(E.attributes.main))),E.attributes.subQuery.length>0&&(c.subQuery=Zr.uniq(c.subQuery.concat(E.attributes.subQuery)))}if(o)s.push(this.selectFromTableFragment(r,l.model,c.subQuery,l.quotedName,l.as)),s.push(d.join(""));else{if(r.groupedLimit){l.as||(l.as=l.quotedName);let m=hA({},r.where),E,R,N,T=l.as;if(typeof r.groupedLimit.on=="string"?R=r.groupedLimit.on:r.groupedLimit.on instanceof Ahr&&(R=r.groupedLimit.on.foreignKeyField),r.groupedLimit.on instanceof _hr){T=r.groupedLimit.on.manyFromSource.as;let F=Zu._validateIncludedElements({include:[{association:r.groupedLimit.on.manyFromSource,duplicating:!1,required:!0,where:hA({[Nt.placeholder]:!0},r.groupedLimit.through&&r.groupedLimit.through.where)}],model:i});r.hasJoin=!0,r.hasMultiAssociation=!0,r.includeMap=Object.assign(F.includeMap,r.includeMap),r.includeNames=F.includeNames.concat(r.includeNames||[]),N=F.include,Array.isArray(r.order)&&(r.order.forEach((x,H)=>{Array.isArray(x)&&(x=x[0]);let $=`subquery_order_${H}`;r.attributes.push([x,$]),$=this.sequelize.literal(this.quote($)),Array.isArray(r.order[H])?r.order[H][0]=$:r.order[H]=$}),E=r.order)}else E=r.order,this._dialect.supports.topLevelOrderByRequired||delete r.order,m[Nt.placeholder]=!0;let I=`SELECT * FROM (${this.selectQuery(e,{attributes:r.attributes,offset:r.offset,limit:r.groupedLimit.limit,order:E,aliasesMapping:r.aliasesMapping,aliasesByTable:r.aliasesByTable,where:m,include:N,model:i},i).replace(/;$/,"")}) ${this.getAliasToken()} sub`,W=this.whereItemQuery(Nt.placeholder,!0,{model:i}),D=I.indexOf(W);a.push(this.selectFromTableFragment(r,l.model,c.main,`(${r.groupedLimit.values.map(F=>{let x;return R&&(x={[R]:F}),N&&(x={[r.groupedLimit.on.foreignIdentifierField]:F}),Wt.spliceStr(I,D,W.length,this.getWhereConditions(x,T))}).join(this._dialect.supports["UNION ALL"]?" UNION ALL ":" UNION ")})`,l.as))}else a.push(this.selectFromTableFragment(r,l.model,c.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,i,r),r.where&&(o?s.push(` WHERE ${r.where}`):(a.push(` WHERE ${r.where}`),a.forEach((m,E)=>{m.startsWith("SELECT")&&(a[E]=this.selectFromTableFragment(r,i,c.main,l.quotedName,l.as,r.where))})))),r.group&&(r.group=Array.isArray(r.group)?r.group.map(m=>this.aliasGrouping(m,i,l.as,r)).join(", "):this.aliasGrouping(r.group,i,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,i,r,!1),r.having&&(o?s.push(` HAVING ${r.having}`):a.push(` HAVING ${r.having}`))),r.order){let m=this.getQueryOrders(r,i,o);m.mainQueryOrder.length&&a.push(` ORDER BY ${m.mainQueryOrder.join(", ")}`),m.subQueryOrder.length&&s.push(` ORDER BY ${m.subQueryOrder.join(", ")}`)}let _=this.addLimitAndOffset(r,l.model);if(_&&!r.groupedLimit&&(o?s.push(_):a.push(_)),o?(this._throwOnEmptyAttributes(c.main,{modelName:i&&i.name,as:l.as}),h=`SELECT ${c.main.join(", ")} FROM (${s.join("")}) ${this.getAliasToken()} ${l.as}${f.join("")}${a.join("")}`):h=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)?h+=` FOR ${m}`:m==="SHARE"?h+=` ${this._dialect.supports.forShare}`:h+=" FOR UPDATE",this._dialect.supports.lockOf&&r.lock.of&&r.lock.of.prototype instanceof Zu&&(h+=` OF ${this.quoteTable(r.lock.of.name)}`),this._dialect.supports.skipLocked&&r.skipLocked&&(h+=" SKIP LOCKED")}return`${h};`}aliasGrouping(e,r,i,n){let a=Array.isArray(e)?e[0]:e;return this.quote(this._getAliasForField(i,a,n)||a,r)}escapeAttributes(e,r,i){return e&&e.map(n=>{let a=!0;if(n instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(n);if(Array.isArray(n)){if(n.length!==2)throw new Error(`${JSON.stringify(n)} is not a valid attribute definition. Please use the following format: ['attribute definition', 'alias']`);if(n=n.slice(),n[0]instanceof Wt.SequelizeMethod)n[0]=this.handleSequelizeMethod(n[0]),a=!1;else if(this.options.attributeBehavior==="escape"||!n[0].includes("(")&&!n[0].includes(")"))n[0]=this.quoteIdentifier(n[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/itwveifv/bot.maxotp.site/server.js:131:7843)
    at new t (/home/itwveifv/bot.maxotp.site/server.js:143:66788)
    at new wo (/home/itwveifv/bot.maxotp.site/server.js:143:73334)
    at new t (/home/itwveifv/bot.maxotp.site/server.js:143:229514)
    at Object.<anonymous> (/home/itwveifv/bot.maxotp.site/server.js:3688:6586)
    at Module._compile (node:internal/modules/cjs/loader:1521:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1623:10)
    at Module.load (node:internal/modules/cjs/loader:1266:32)
    at Module._load (node:internal/modules/cjs/loader:1091:12)
    at Module.require (node:internal/modules/cjs/loader:1289:19)

Node.js v20.20.0
/home/itwveifv/bot.maxotp.site/server.js:131
`}};nk.AggregateError=Jee});var h8e=O(ak=>{"use strict";Object.defineProperty(ak,"__esModule",{value:!0});ak.Deferred=void 0;var Mdr=$ee(),ete=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 Mdr.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}};ak.Deferred=ete});var b8e=O(sk=>{"use strict";Object.defineProperty(sk,"__esModule",{value:!0});sk.Pool=void 0;var Edr=h8e(),ydr=Zee(),tte=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(),i,n=this._availableObjects.length,a=this.size-this.minSize,s;for(this._removeIdleScheduled=!1,i=0;i<n&&a>e.length;i++)s=this._availableObjects[i].timeout,r>=s&&(this._log("removeIdle() destroying obj - now:"+r+" timeout:"+s,"verbose"),e.push(this._availableObjects[i].resource));e.forEach(this.destroy,this),n=this._availableObjects.length,n>0?(this._log("this._availableObjects.length="+n,"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 i={resource:e,useCount:r,timeout:Date.now()+this.idleTimeoutMillis};this._availableObjects.push(i),this._dispense(),this._scheduleRemoveIdle()}_addResourceToInUseObjects(e,r){let i={resource:e,useCount:r};this._inUseObjects.push(i)}_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 Edr.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(n=>n.resource===e)){this._log("release called twice for the same resource: "+new Error().stack,"error");return}let r=this._inUseObjects.findIndex(n=>n.resource===e);if(r<0){this._log("attempt to release an invalid resource: "+new Error().stack,"error");return}let i=this._inUseObjects[r];i.useCount+=1,i.useCount>=this.maxUsesPerResource?(this._log("release() destroying obj - useCount:"+i.useCount+" maxUsesPerResource:"+this.maxUsesPerResource,"verbose"),this.destroy(i.resource),this._dispense()):(this._inUseObjects.splice(r,1),this._addResourceToAvailableObjects(i.resource,i.useCount))}async destroy(e){let r=this._availableObjects.length,i=this._inUseObjects.length;if(this._availableObjects=this._availableObjects.filter(n=>n.resource!==e),this._inUseObjects=this._inUseObjects.filter(n=>n.resource!==e),r===this._availableObjects.length&&i===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(i=>i.resource),r=[];for(let i of e)try{await this.destroy(i)}catch(n){this._log("Error destroying resource: "+n.stack,"error"),r.push(n)}if(r.length>0)throw new ydr.AggregateError(r)}};sk.Pool=tte});var _8e=O(ob=>{"use strict";Object.defineProperty(ob,"__esModule",{value:!0});ob.Pool=ob.AggregateError=ob.TimeoutError=void 0;var zdr=$ee();Object.defineProperty(ob,"TimeoutError",{enumerable:!0,get:function(){return zdr.TimeoutError}});var Rdr=Zee();Object.defineProperty(ob,"AggregateError",{enumerable:!0,get:function(){return Rdr.AggregateError}});var wdr=b8e();Object.defineProperty(ob,"Pool",{enumerable:!0,get:function(){return wdr.Pool}})});var ed=O((Mei,ok)=>{"use strict";var{Pool:rte,TimeoutError:Ndr}=_8e(),cb=fr(),ite=Zf(),vdr=fi(),{logger:Tdr}=Bn(),Idr=cM(),bp=Tdr.debugContext("pool"),q4=class{constructor(e,r){let i=cb.cloneDeep(r.config);if(this.sequelize=r,this.config=i,this.dialect=e,this.versionPromise=null,this.dialectName=this.sequelize.options.dialect,i.pool===!1)throw new Error("Support for pool:false was removed in v4.0");i.pool=cb.defaults(i.pool||{},{max:5,min:0,idle:1e4,acquire:6e4,evict:1e3,validate:this._validate.bind(this)}),this.initPools()}refreshTypeParser(e){cb.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(),bp("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 rte({name:"sequelize",create:()=>this._connect(e),destroy:async i=>{let n=await this._disconnect(i);return bp("connection destroy"),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}),bp(`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=cb.defaults(e.replication.write,cb.omit(e,"replication")),e.replication.read=e.replication.read.map(i=>cb.defaults(i,cb.omit(this.config,"replication")));let r=0;this.pool={release:i=>{i.queryType==="read"?this.pool.read.release(i):this.pool.write.release(i)},acquire:(i,n)=>(n=n===void 0?!1:n,i==="SELECT"&&!n?this.pool.read.acquire():this.pool.write.acquire()),destroy:i=>{this.pool[i.queryType].destroy(i),bp("connection destroy")},destroyAllNow:async()=>{await Promise.all([this.pool.read.destroyAllNow(),this.pool.write.destroyAllNow()]),bp("all connections destroyed")},drain:async()=>Promise.all([this.pool.write.drain(),this.pool.read.drain()]),read:new rte({name:"sequelize:read",create:async()=>{let i=r++%e.replication.read.length,n=await this._connect(e.replication.read[i]);return n.queryType="read",n},destroy:i=>this._disconnect(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}),write:new rte({name:"sequelize:write",create:async()=>{let i=await this._connect(e.replication.write);return i.queryType="write",i},destroy:i=>this._disconnect(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})},bp(`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 i=await this._connect(this.config.replication.write||this.config),n={};if(n.transaction={connection:i},n.logging=()=>{},n.logging.__testLoggingFn=!0,this.sequelize.options.databaseVersion===0){let a=await this.sequelize.databaseVersion(n),s=cb.get(ite.coerce(a),"version")||a;this.sequelize.options.databaseVersion=ite.valid(s)?s:this.dialect.defaultVersion}return ite.lt(this.sequelize.options.databaseVersion,this.dialect.defaultVersion)&&(Idr.unsupportedEngine(),bp(`Unsupported database engine version ${this.sequelize.options.databaseVersion}`)),this.versionPromise=null,await this._disconnect(i)}catch(i){throw this.versionPromise=null,i}})()),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(i){throw i instanceof Ndr?new vdr.ConnectionAcquireTimeoutError(i):i}return bp("connection acquired"),r}releaseConnection(e){this.pool.release(e),bp("connection released")}async destroyConnection(e){await this.pool.destroy(e),bp(`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}};ok.exports=q4;ok.exports.ConnectionManager=q4;ok.exports.default=q4});var iu=O((Eei,A8e)=>{"use strict";var C4=new Map;A8e.exports=t=>(C4.has(t)||C4.set(t,new Map),{clear(){C4.get(t).clear()},refresh(e){for(let r of e.types[t])C4.get(t).set(r,e.parse)},get(e){return C4.get(t).get(e)}})});var M8e=O((yei,uk)=>{"use strict";var Sdr=Object.defineProperty,m8e=Object.getOwnPropertySymbols,qdr=Object.prototype.hasOwnProperty,Cdr=Object.prototype.propertyIsEnumerable,O8e=(t,e,r)=>e in t?Sdr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,xdr=(t,e)=>{for(var r in e||(e={}))qdr.call(e,r)&&O8e(t,r,e[r]);if(m8e)for(var r of m8e(e))Cdr.call(e,r)&&O8e(t,r,e[r]);return t},Ldr=Zf(),kdr=ed(),fM=fi(),{logger:Ddr}=Bn(),Bdr=ri().mariadb,Pdr=up(),g8e=Ddr.debugContext("connection:mariadb"),ck=iu()("mariadb"),x4=class t extends kdr{constructor(e,r){r.config.port=r.config.port||3306,super(e,r),this.lib=this._loadDialectModule("mariadb"),this.refreshTypeParser(Bdr)}static _typecast(e,r){return ck.get(e.type)?ck.get(e.type)(e,this.sequelize.options,r):r()}_refreshTypeParser(e){ck.refresh(e)}_clearTypeParser(){ck.clear()}async connect(e){let r=this.sequelize.options.timezone;r=/\//.test(r)?Pdr.tz(r).format("Z"):r;let i=xdr({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||(i.initSql?(Array.isArray(i.initSql)||(i.initSql=[i.initSql]),i.initSql.push(`SET time_zone = '${r}'`)):i.initSql=`SET time_zone = '${r}'`);try{let n=await this.lib.createConnection(i);return this.sequelize.options.databaseVersion=Ldr.coerce(n.serverVersion()).version,g8e("connection acquired"),n.on("error",a=>{switch(a.code){case"ESOCKET":case"ECONNRESET":case"EPIPE":case"PROTOCOL_CONNECTION_LOST":this.pool.destroy(n)}}),n}catch(n){switch(n.code){case"ECONNREFUSED":throw new fM.ConnectionRefusedError(n);case"ER_ACCESS_DENIED_ERROR":case"ER_ACCESS_DENIED_NO_PASSWORD_ERROR":throw new fM.AccessDeniedError(n);case"ENOTFOUND":throw new fM.HostNotFoundError(n);case"EHOSTUNREACH":case"ENETUNREACH":case"EADDRNOTAVAIL":throw new fM.HostNotReachableError(n);case"EINVAL":throw new fM.InvalidConnectionError(n);default:throw new fM.ConnectionError(n)}}}async disconnect(e){if(!e.isValid()){g8e("connection tried to disconnect but was already at CLOSED state");return}return await e.end()}validate(e){return e&&e.isValid()}};uk.exports=x4;uk.exports.ConnectionManager=x4;uk.exports.default=x4});var td=O((zei,lk)=>{"use strict";var Wdr=Object.defineProperty,E8e=Object.getOwnPropertySymbols,Udr=Object.prototype.hasOwnProperty,Fdr=Object.prototype.propertyIsEnumerable,y8e=(t,e,r)=>e in t?Wdr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,jdr=(t,e)=>{for(var r in e||(e={}))Udr.call(e,r)&&y8e(t,r,e[r]);if(E8e)for(var r of E8e(e))Fdr.call(e,r)&&y8e(t,r,e[r]);return t},ub=fr(),Gdr=a4(),hc=yo(),Hdr=gL(),Qdr=cM(),Vdr=(rM(),Yl(tM)).v4,{safeStringifyJson:z8e}=wi(),L4=class t{constructor(e,r,i){this.uuid=Vdr(),this.connection=e,this.instance=i.instance,this.model=i.model,this.sequelize=r,this.options=jdr({plain:!1,raw:!1,logging:console.log},i),this.checkLoggingOption(),i.rawErrors&&(this.formatError=t.prototype.formatError)}static formatBindParameters(e,r,i,n,a){if(!r)return[e,[]];if(a=a||{},typeof n!="function"&&(a=n||{},n=void 0),!n)a.skipValueReplace?n=(c,l,p)=>{if(p[l]!==void 0)return c}:n=(c,l,p,f,d)=>{if(p[l]!==void 0)return Gdr.escape(p[l],f,d)};else if(a.skipValueReplace){let c=n;n=(l,p,f,d,h,_)=>{if(c(l,p,f,d,h,_)!==void 0)return l}}let s=null,o=Array.isArray(r);return e=e.replace(/\B\$(\$|\w+)/g,(c,l)=>{if(l==="$")return a.skipUnescape?c:l;let p;if(o?l.match(/^[1-9]\d*$/)&&(l=l-1,p=n(c,l,r,s,i,a)):l.match(/^\d*$/)||(p=n(c,l,r,s,i,a)),p===void 0)throw new Error(`Named bind parameter "${c}" 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&&(Qdr.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 i of Object.keys(this.model.uniqueKeys))this.model.uniqueKeys[i].fields.includes(e.replace(/"/g,""))&&this.model.uniqueKeys[i].msg&&(r=this.model.uniqueKeys[i].msg);return r}isRawQuery(){return this.options.type===hc.RAW}isVersionQuery(){return this.options.type===hc.VERSION}isUpsertQuery(){return this.options.type===hc.UPSERT}isInsertQuery(e,r){let i=!0;return this.options.type===hc.INSERT?!0:(i=i&&this.sql.toLowerCase().startsWith("insert into"),i=i&&(!e||Object.prototype.hasOwnProperty.call(e,this.getInsertIdField())),i=i&&(!r||Object.prototype.hasOwnProperty.call(r,this.getInsertIdField())),i)}handleInsertQuery(e,r){if(this.instance){let i=this.model.autoIncrementAttribute,n=null;n=n||e&&e[this.getInsertIdField()],n=n||r&&r[this.getInsertIdField()],this.instance[i]=n}}isShowTablesQuery(){return this.options.type===hc.SHOWTABLES}handleShowTablesQuery(e){return ub.flatten(e.map(r=>Object.values(r)))}isShowIndexesQuery(){return this.options.type===hc.SHOWINDEXES}isShowConstraintsQuery(){return this.options.type===hc.SHOWCONSTRAINTS}isDescribeQuery(){return this.options.type===hc.DESCRIBE}isSelectQuery(){return this.options.type===hc.SELECT}isBulkUpdateQuery(){return this.options.type===hc.BULKUPDATE}isBulkDeleteQuery(){return this.options.type===hc.BULKDELETE}isForeignKeysQuery(){return this.options.type===hc.FOREIGNKEYS}isUpdateQuery(){return this.options.type===hc.UPDATE}handleSelectQuery(e){let r=null;if(this.options.fieldMap){let i=this.options.fieldMap;e=e.map(n=>ub.reduce(i,(a,s,o)=>(a[o]!==void 0&&s!==o&&(a[s]=a[o],delete a[o]),a),n))}return this.options.raw?r=e.map(i=>{let n={};for(let a in i)Object.prototype.hasOwnProperty.call(i,a)&&(n[a]=i[a]);return this.options.nest&&(n=Hdr.transform(n)),n}):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,i){let{connection:n,options:a}=this,s=this.sequelize.options.benchmark||a.benchmark,o=this.sequelize.options.logQueryParameters||a.logQueryParameters,c=Date.now(),l="";if(o&&i){let d=e.endsWith(";")?"":";",h;Array.isArray(i)?h=i.map(_=>z8e(_)).join(", "):h=z8e(i),l=`${d} ${h}`}let p=`(${n.uuid||"default"}): ${e}${l}`,f=`Executing ${p}`;return r(f),s||this.sequelize.log(`Executing ${p}`,a),()=>{let d=`Executed ${p}`;r(d),s&&this.sequelize.log(d,Date.now()-c,a)}}static _groupJoinData(e,r,i){if(!e.length)return[];let n,a,s,o,c,l,p=e.length,f,d,h,_,m,E,R,N,T=i.checkExisting,I,W,D,F=T?[]:new Array(p),x={},H={},$,k,oe,j,B,V,X,_e,he=se=>{Object.prototype.hasOwnProperty.call(V.includeMap,se)&&(H[d]=V=V.includeMap[se],_e?_e=`${_e}.${se}`:_e=se,H[_e]=V)},ce={},Re=(se,Ee)=>(Object.prototype.hasOwnProperty.call(Ee,se)||(Ee[se]=se.substr(0,se.lastIndexOf("."))),Ee[se]),Te={},Ce=se=>{if(!Object.prototype.hasOwnProperty.call(Te,se)){let Ee=se.lastIndexOf(".");Te[se]=se.substr(Ee===-1?0:Ee+1)}return Te[se]},te={},de=se=>{if(!Object.prototype.hasOwnProperty.call(te,se)){let Ee=Re(se,ce);Object.prototype.hasOwnProperty.call(te,Ee)||(te[Ee]=Ee?Ee.split("."):[]),te[se]=te[Ee]}return te[se]},ze={},Oe=se=>{if(!Object.prototype.hasOwnProperty.call(ze,se)){let Ee=de(se),Ie=Ee.length;ze[se]=Ie?Ee[Ie-1]:""}return ze[se]},ke=se=>{let Ee=ub.chain(se.uniqueKeys);return Ee=Ee.result(`${Ee.findKey()}.fields`).map(Ie=>ub.findKey(se.attributes,Pe=>Pe.field===Ie)).value(),Ee},$e=se=>se instanceof Buffer?se.toString("hex"):se,Se,nt,xe;for(c=0;c<p;c++){if(l=e[c],c===0&&(f=ub.sortBy(Object.keys(l),se=>[se.split(".").length]),_=f.length),T){if(N=!1,o=r.model.primaryKeyAttributes.length,D="",o===1)D=$e(l[r.model.primaryKeyAttributes[0]]);else if(o>1)for(s=0;s<o;s++)D+=$e(l[r.model.primaryKeyAttributes[s]]);else if(!ub.isEmpty(r.model.uniqueKeys))for(nt=ke(r.model),s=0;s<nt.length;s++)D+=l[nt[s]]}for(R=E={},j=void 0,h=0;h<_;h++){if(d=f[h],k=Re(d,ce),$=de(d),c===0&&!Object.prototype.hasOwnProperty.call(H,d)&&($.length?(V=r,_e=void 0,$.forEach(he)):H[d]=H[""]=r),j!==void 0&&j!==$){if(T){if(a=j.length,X=null,W=null,a)for(n=0;n<a;n++){if(xe=X?`${X}.${j[n]}`:j[n],Se=H[xe].model.primaryKeyAttributes,o=Se.length,I=xe,o===1)I+=$e(l[`${xe}.${Se[0]}`]);else if(o>1)for(s=0;s<o;s++)I+=$e(l[`${xe}.${Se[s]}`]);else if(!ub.isEmpty(H[xe].model.uniqueKeys))for(nt=ke(H[xe].model),s=0;s<nt.length;s++)I+=l[`${xe}.${nt[s]}`];W||(W=D),I=W+I,X=xe,n<a-1&&(W=I)}else I=D;I===D?x[I]?N=!0:x[I]=E:x[I]||(X=x[W],B=Oe(m),H[m].association.isSingleAssociation?X&&(X[B]=x[I]=E):(X[B]||(X[B]=[]),X[B].push(x[I]=E))),E={}}else if(V=R,a=$.length,a)for(n=0;n<a;n++)n===a-1&&(E=V[$[n]]={}),V=V[$[n]]||{}}E[Ce(d)]=l[d],m=d,j=$,oe=k}if(T){if(a=j.length,X=null,W=null,a)for(n=0;n<a;n++){if(xe=X?`${X}.${j[n]}`:j[n],Se=H[xe].model.primaryKeyAttributes,o=Se.length,I=xe,o===1)I+=$e(l[`${xe}.${Se[0]}`]);else if(o>0)for(s=0;s<o;s++)I+=$e(l[`${xe}.${Se[s]}`]);else if(!ub.isEmpty(H[xe].model.uniqueKeys))for(nt=ke(H[xe].model),s=0;s<nt.length;s++)I+=l[`${xe}.${nt[s]}`];W||(W=D),I=W+I,X=xe,n<a-1&&(W=I)}else I=D;I===D?x[I]?N=!0:x[I]=E:x[I]||(X=x[W],B=Oe(m),H[m].association.isSingleAssociation?X&&(X[B]=x[I]=E):(X[B]||(X[B]=[]),X[B].push(x[I]=E))),N||F.push(R)}else F[c]=R}return F}};lk.exports=L4;lk.exports.AbstractQuery=L4;lk.exports.default=L4});var q8e=O((Rei,S8e)=>{"use strict";var Ydr=Object.defineProperty,R8e=Object.getOwnPropertySymbols,Xdr=Object.prototype.hasOwnProperty,Kdr=Object.prototype.propertyIsEnumerable,w8e=(t,e,r)=>e in t?Ydr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,$dr=(t,e)=>{for(var r in e||(e={}))Xdr.call(e,r)&&w8e(t,r,e[r]);if(R8e)for(var r of R8e(e))Kdr.call(e,r)&&w8e(t,r,e[r]);return t},N8e=td(),pk=fi(),v8e=fr(),nte=ri(),{logger:Jdr}=Bn(),Zdr=1062,ehr=1213,T8e=1451,thr=1452,I8e=Jdr.debugContext("sql:mariadb"),ate=class extends N8e{constructor(e,r,i){super(e,r,$dr({showWarnings:!1},i))}static formatBindParameters(e,r,i){let n=[],a=(s,o,c)=>{if(c[o]!==void 0)return n.push(c[o]),"?"};return e=N8e.formatBindParameters(e,r,i,a)[0],[e,n.length>0?n:void 0]}async run(e,r){this.sql=e;let{connection:i,options:n}=this,a=this.sequelize.options.showWarnings||n.showWarnings,s=this._logQuery(e,I8e,r);r&&I8e("parameters(%j)",r);let o,c=new Error;try{o=await i.query(this.sql,r)}catch(l){if(n.transaction&&l.errno===ehr){try{await n.transaction.rollback()}catch{}n.transaction.finished="rollback"}throw l.sql=e,l.parameters=r,this.formatError(l,c.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 i=e[this.getInsertIdField()];r=new Array(e.affectedRows);let n=this.model.rawAttributes[this.model.primaryKeyAttribute].field;for(let a=0;a<e.affectedRows;a++)r[a]={[n]:i+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 i=e.meta;return delete e.meta,[e,i]}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 i of e)r[i.Field]={type:i.Type.toLowerCase().startsWith("enum")?i.Type.replace(/^enum/i,"ENUM"):i.Type.toUpperCase(),allowNull:i.Null==="YES",defaultValue:i.Default,primaryKey:i.Key==="PRI",autoIncrement:Object.prototype.hasOwnProperty.call(i,"Extra")&&i.Extra.toLowerCase()==="auto_increment",comment:i.Comment?i.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 i=this.model.fieldRawAttributesMap[r];i.type instanceof nte.JSON&&(e=e.map(n=>(n[i.fieldName]&&typeof n[i.fieldName]=="string"&&!this.connection.info.hasMinVersion(10,5,2)&&(n[i.fieldName]=JSON.parse(n[i.fieldName])),nte.JSON.parse?nte.JSON.parse(i,this.sequelize.options,n[i.fieldName]):n)))}}async logWarnings(e){let r=await this.run("SHOW WARNINGS"),i=`MariaDB Warnings (${this.connection.uuid||"default"}): `,n=[];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"))n.push(s.Message);else for(let o of s.keys())n.push([o,s[o]].join(": "));return this.sequelize.log(i+n.join("; "),this.options),e}formatError(e,r){switch(e.errno){case Zdr:{let i=e.message.match(/Duplicate entry '([\s\S]*)' for key '?((.|\s)*?)'?\s.*$/),n={},a="Validation error",s=i?i[1].split("-"):void 0,o=i?i[2]:void 0,c=i?i[1]:void 0,l=this.model&&this.model.uniqueKeys[o];l?(l.msg&&(a=l.msg),n=v8e.zipObject(l.fields,s)):n[o]=c;let p=[];return v8e.forOwn(n,(f,d)=>{p.push(new pk.ValidationErrorItem(this.getUniqueConstraintErrorMessage(d),"unique violation",d,f,this.instance,"not_unique"))}),new pk.UniqueConstraintError({message:a,errors:p,parent:e,fields:n,stack:r})}case T8e:case thr:{let i=e.message.match(/CONSTRAINT ([`"])(.*)\1 FOREIGN KEY \(\1(.*)\1\) REFERENCES \1(.*)\1 \(\1(.*)\1\)/),n=i?i[1]:"`",a=i?i[3].split(new RegExp(`${n}, *${n}`)):void 0;return new pk.ForeignKeyConstraintError({reltype:e.errno===T8e?"parent":"child",table:i?i[4]:void 0,fields:a,value:a&&a.length&&this.instance&&this.instance[a[0]]||void 0,index:i?i[2]:void 0,parent:e,stack:r})}default:return new pk.DatabaseError(e,{stack:r})}}handleShowTablesQuery(e){return e.map(r=>({tableName:r.TABLE_NAME,schema:r.TABLE_SCHEMA}))}handleShowIndexesQuery(e){let r,i=[];return e.forEach(n=>{(!r||r.name!==n.Key_name)&&(r={primary:n.Key_name==="PRIMARY",fields:[],name:n.Key_name,tableName:n.Table,unique:n.Non_unique!==1,type:n.Index_type},i.push(r)),r.fields[n.Seq_in_index-1]={attribute:n.Column_name,length:n.Sub_part||void 0,order:n.Collation==="A"?"ASC":void 0}}),i}};S8e.exports=ate});var k8e=O((wei,L8e)=>{"use strict";var rhr=Object.defineProperty,C8e=Object.getOwnPropertySymbols,ihr=Object.prototype.hasOwnProperty,nhr=Object.prototype.propertyIsEnumerable,x8e=(t,e,r)=>e in t?rhr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,ahr=(t,e)=>{for(var r in e||(e={}))ihr.call(e,r)&&x8e(t,r,e[r]);if(C8e)for(var r of C8e(e))nhr.call(e,r)&&x8e(t,r,e[r]);return t},fk=fr(),a0=Hs(),shr=wi(),ohr={OperatorMap:{[a0.eq]:"=",[a0.ne]:"!=",[a0.gte]:">=",[a0.gt]:">",[a0.lte]:"<=",[a0.lt]:"<",[a0.not]:"IS NOT",[a0.is]:"IS",[a0.in]:"IN",[a0.notIn]:"NOT IN",[a0.like]:"LIKE",[a0.notLike]:"NOT LIKE",[a0.iLike]:"ILIKE",[a0.notILike]:"NOT ILIKE",[a0.startsWith]:"LIKE",[a0.endsWith]:"LIKE",[a0.substring]:"LIKE",[a0.regexp]:"~",[a0.notRegexp]:"!~",[a0.iRegexp]:"~*",[a0.notIRegexp]:"!~*",[a0.between]:"BETWEEN",[a0.notBetween]:"NOT BETWEEN",[a0.overlap]:"&&",[a0.contains]:"@>",[a0.contained]:"<@",[a0.adjacent]:"-|-",[a0.strictLeft]:"<<",[a0.strictRight]:">>",[a0.noExtendRight]:"&<",[a0.noExtendLeft]:"&>",[a0.any]:"ANY",[a0.all]:"ALL",[a0.and]:" AND ",[a0.or]:" OR ",[a0.col]:"COL",[a0.placeholder]:"$$PLACEHOLDER$$",[a0.match]:"@@"},OperatorsAliasMap:{},setOperatorsAliases(t){!t||fk.isEmpty(t)?this.OperatorsAliasMap=!1:this.OperatorsAliasMap=ahr({},t)},_replaceAliases(t){let e={};return this.OperatorsAliasMap?(shr.getOperators(t).forEach(r=>{let i=t[r];fk.isPlainObject(i)?e[r]=this._replaceAliases(i):e[r]=i}),fk.forOwn(t,(r,i)=>{i=this.OperatorsAliasMap[i]||i,fk.isPlainObject(r)&&(r=this._replaceAliases(r)),e[i]=r}),e):t}};L8e.exports=ohr});var B8e=O((Nei,D8e)=>{"use strict";var chr=(rM(),Yl(tM)).v4,uhr={setIsolationLevelQuery(t,e){if(!e.parent)return`SET TRANSACTION ISOLATION LEVEL ${t};`},generateTransactionId(){return chr()},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;"}};D8e.exports=uhr});var lb=O((Tei,j8e)=>{"use strict";var lhr=Object.defineProperty,phr=Object.defineProperties,fhr=Object.getOwnPropertyDescriptors,P8e=Object.getOwnPropertySymbols,dhr=Object.prototype.hasOwnProperty,hhr=Object.prototype.propertyIsEnumerable,W8e=(t,e,r)=>e in t?lhr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,hA=(t,e)=>{for(var r in e||(e={}))dhr.call(e,r)&&W8e(t,r,e[r]);if(P8e)for(var r of P8e(e))hhr.call(e,r)&&W8e(t,r,e[r]);return t},dk=(t,e)=>phr(t,fhr(e)),hk=require("util"),Zr=fr(),bhr=(rM(),Yl(tM)).v4,Wt=wi(),vei=cM(),U8e=a4(),dM=ri(),Zu=Aee(),hM=nb(),ste=ab(),_hr=aM(),Ahr=cA(),Nt=Hs(),ote=fi(),F8e=Nee(),mhr=new Set(["integer","int","smallint","bigint","float","real","double precision","decimal","numeric","boolean","text","char","varchar","nvarchar","date","timestamp","timestamptz","datetime","json","jsonb","signed","unsigned"]),k4=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:Zr.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,i){return`DESCRIBE ${this.quoteTable(this.addSchema({tableName:e,_schema:r,_schemaDelimiter:i}))};`}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,i,n){n=n||{},Zr.defaults(n,this.options);let a={},s=n.bind||[],o=[],c=[],l=[],p=[],f=this.quoteTable(e),d=n.bindParam===void 0?this.bindParam(s):n.bindParam,h=[],_,m="",E="",R="",N="",T=!1,I="";if(i&&Zr.each(i,(x,H)=>{a[H]=x,x.field&&(a[x.field]=x)}),this._dialect.supports["DEFAULT VALUES"]?E+=" DEFAULT VALUES":this._dialect.supports["VALUES ()"]&&(E+=" VALUES ()"),(this._dialect.supports.returnValues||this._dialect.supports.returnIntoValues)&&n.returning){let x=this.generateReturnValues(i,n);c.push(...x.returnFields),this._dialect.supports.returnIntoValues&&l.push(...x.returnTypes),N=x.returningFragment,I=x.tmpTable||"",R=x.outputFragment||""}(Zr.get(this,["sequelize","options","dialectOptions","prependSearchPath"])||n.searchPath)&&(n.bindParam=!1),this._dialect.supports.EXCEPTION&&n.exception&&(n.bindParam=!1),r=Wt.removeNullValuesFromHash(r,this.options.omitNull);for(let x in r)if(Object.prototype.hasOwnProperty.call(r,x)){let H=r[x];o.push(this.quoteIdentifier(x)),a&&a[x]&&a[x].autoIncrement===!0&&H==null?this._dialect.supports.autoIncrement.defaultValue?this._dialect.supports.DEFAULT?p.push("DEFAULT"):p.push(this.escape(null)):o.splice(-1,1):(a&&a[x]&&a[x].autoIncrement===!0&&(T=!0),H instanceof Wt.SequelizeMethod||n.bindParam===!1?p.push(this.escape(H,a&&a[x]||void 0,{context:"INSERT"})):p.push(this.format(H,a&&a[x]||void 0,{context:"INSERT"},d)))}let W="";if(!Zr.isEmpty(n.conflictWhere)&&!this._dialect.supports.inserts.onConflictWhere)throw new Error("missing dialect support for conflictWhere option");if(this._dialect.supports.inserts.updateOnDuplicate&&n.updateOnDuplicate)if(this._dialect.supports.inserts.updateOnDuplicate==" ON CONFLICT DO UPDATE SET"){let x=n.upsertKeys.map(k=>this.quoteIdentifier(k)),H=n.updateOnDuplicate.map(k=>`${this.quoteIdentifier(k)}=EXCLUDED.${this.quoteIdentifier(k)}`),$=["ON CONFLICT","(",x.join(","),")"];Zr.isEmpty(n.conflictWhere)||$.push(this.whereQuery(n.conflictWhere,n)),Zr.isEmpty(H)?$.push("DO NOTHING"):$.push("DO UPDATE SET",H.join(",")),W=` ${Wt.joinSQLFragments($)}`}else{let x=n.updateOnDuplicate.map(H=>`${this.quoteIdentifier(H)}=VALUES(${this.quoteIdentifier(H)})`);if(Zr.isEmpty(x)&&n.upsertKeys&&x.push(...n.upsertKeys.map(H=>`${this.quoteIdentifier(H)}=${this.quoteIdentifier(H)}`)),Zr.isEmpty(x))throw new Error("No update values found for ON DUPLICATE KEY UPDATE clause, and no identifier fields could be found to use instead.");W+=`${this._dialect.supports.inserts.updateOnDuplicate} ${x.join(",")}`}let D={ignoreDuplicates:n.ignoreDuplicates?this._dialect.supports.inserts.ignoreDuplicates:"",onConflictDoNothing:n.ignoreDuplicates?this._dialect.supports.inserts.onConflictDoNothing:"",attributes:o.join(","),output:R,values:p.join(","),tmpTable:I};if(m=`${I}INSERT${D.ignoreDuplicates} INTO ${f} (${D.attributes})${D.output} VALUES (${D.values})${W}${D.onConflictDoNothing}${m}`,E=`${I}INSERT${D.ignoreDuplicates} INTO ${f}${D.output}${W}${D.onConflictDoNothing}${E}`,this._dialect.supports.EXCEPTION&&n.exception){let x="DROP FUNCTION IF EXISTS pg_temp.testfunc()";c.length===0&&c.push("*");let H=`$func_${bhr().replace(/-/g,"")}$`,$=`SELECT (testfunc.response).${c.join(", (testfunc.response).")}, testfunc.sequelize_caught_exception FROM pg_temp.testfunc();`;n.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 ${H} BEGIN ${m} RETURNING * INTO response; EXCEPTION ${n.exception} END ${H} LANGUAGE plpgsql; ${$} ${x}`}else m+=N,E+=N;this._dialect.supports.returnIntoValues&&n.returning&&this.populateInsertQueryReturnIntoBinds(c,l,s.length,h,n),_=`${D.attributes.length?m:E}${h.join(",")};`,this._dialect.supports.finalTable&&(_=`SELECT * FROM FINAL TABLE(${D.attributes.length?m:E});`),T&&this._dialect.supports.autoIncrement.identityInsert&&(_=`SET IDENTITY_INSERT ${f} ON; ${_} SET IDENTITY_INSERT ${f} OFF;`);let F={query:_};return n.bindParam!==!1&&(F.bind=s),F}bulkInsertQuery(e,r,i,n){i=i||{},n=n||{};let a=[],s={},o=[],c="";for(let h of r)Zr.forOwn(h,(_,m)=>{o.includes(m)||o.push(m),n[m]&&n[m].autoIncrement===!0&&(s[m]=!0)});for(let h of r){let _=o.map(m=>this._dialect.supports.bulkDefault&&s[m]===!0?h[m]!=null?h[m]:"DEFAULT":this.escape(h[m],n[m],{context:"INSERT"}));a.push(`(${_.join(",")})`)}if(this._dialect.supports.inserts.updateOnDuplicate&&i.updateOnDuplicate)if(this._dialect.supports.inserts.updateOnDuplicate==" ON CONFLICT DO UPDATE SET"){let h=i.upsertKeys.map(E=>this.quoteIdentifier(E)),_=i.updateOnDuplicate.map(E=>`${this.quoteIdentifier(E)}=EXCLUDED.${this.quoteIdentifier(E)}`),m=!1;if(i.conflictWhere){if(!this._dialect.supports.inserts.onConflictWhere)throw new Error(`conflictWhere not supported for dialect ${this._dialect.name}`);m=this.whereQuery(i.conflictWhere,i)}c=["ON CONFLICT","(",h.join(","),")",m,"DO UPDATE SET",_.join(",")]}else{if(i.conflictWhere)throw new Error(`conflictWhere not supported for dialect ${this._dialect.name}`);let h=i.updateOnDuplicate.map(_=>`${this.quoteIdentifier(_)}=VALUES(${this.quoteIdentifier(_)})`);c=`${this._dialect.supports.inserts.updateOnDuplicate} ${h.join(",")}`}let l=i.ignoreDuplicates?this._dialect.supports.inserts.ignoreDuplicates:"",p=o.map(h=>this.quoteIdentifier(h)).join(","),f=i.ignoreDuplicates?this._dialect.supports.inserts.onConflictDoNothing:"",d="";if(this._dialect.supports.returnValues&&i.returning){let h=this.generateReturnValues(n,i);d+=h.returningFragment}return Wt.joinSQLFragments(["INSERT",l,"INTO",this.quoteTable(e),`(${p})`,"VALUES",a.join(","),c,f,d,";"])}updateQuery(e,r,i,n,a){n=n||{},Zr.defaults(n,this.options),r=Wt.removeNullValuesFromHash(r,n.omitNull,n);let s=[],o=[],c={},l="",p="",f="";(Zr.get(this,["sequelize","options","dialectOptions","prependSearchPath"])||n.searchPath)&&(n.bindParam=!1);let d=n.bindParam===void 0?this.bindParam(o):n.bindParam;if(this._dialect.supports["LIMIT ON UPDATE"]&&n.limit&&(["mssql","db2","oracle"].includes(this.dialect)?this.dialect==="oracle"&&(i&&(i.length&&i.length>0||Object.keys(i).length>0)?f+=" AND ":f+=" WHERE ",f+=`rownum <= ${this.escape(n.limit)} `):f=` LIMIT ${this.escape(n.limit)} `),this._dialect.supports.returnValues&&n.returning){let E=this.generateReturnValues(a,n);f+=E.returningFragment,p=E.tmpTable||"",l=E.outputFragment||"",!this._dialect.supports.returnValues.output&&n.returning&&(n.mapToModel=!0)}a&&Zr.each(a,(E,R)=>{c[R]=E,E.field&&(c[E.field]=E)});for(let E in r){if(c&&c[E]&&c[E].autoIncrement===!0&&!this._dialect.supports.autoIncrement.update)continue;let R=r[E];R instanceof Wt.SequelizeMethod||n.bindParam===!1?s.push(`${this.quoteIdentifier(E)}=${this.escape(R,c&&c[E]||void 0,{context:"UPDATE"})}`):s.push(`${this.quoteIdentifier(E)}=${this.format(R,c&&c[E]||void 0,{context:"UPDATE"},d)}`)}let h=dk(hA({},n),{bindParam:d});if(s.length===0)return"";let m={query:`${p}UPDATE ${this.quoteTable(e)} SET ${s.join(",")}${l} ${this.whereQuery(i,h)}${f}`.trim()};return n.bindParam!==!1&&(m.bind=o),m}arithmeticQuery(e,r,i,n,a,s){s=s||{},Zr.defaults(s,{returning:!0}),a=Wt.removeNullValuesFromHash(a,this.options.omitNull);let o="",c="";if(this._dialect.supports.returnValues&&s.returning){let p=this.generateReturnValues(null,s);o=p.outputFragment,c=p.returningFragment}let l=[];for(let p in n){let f=n[p],d=this.quoteIdentifier(p),h=this.escape(f);l.push(`${d}=${d}${e} ${h}`)}for(let p in a){let f=a[p],d=this.quoteIdentifier(p),h=this.escape(f);l.push(`${d}=${h}`)}return Wt.joinSQLFragments(["UPDATE",this.quoteTable(r),"SET",l.join(","),o,this.whereQuery(i),c])}addIndexQuery(e,r,i,n){i=i||{},Array.isArray(r)?i.fields=r:(i=r,r=void 0),i.prefix=i.prefix||n||e,i.prefix&&typeof i.prefix=="string"&&(i.prefix=i.prefix.replace(/\./g,"_"),i.prefix=i.prefix.replace(/("|')/g,""));let a=i.fields.map(c=>{if(c instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(c);typeof c=="string"&&(c={name:c});let l="";if(c.attribute&&(c.name=c.attribute),!c.name)throw new Error(`The following index field has no name: ${hk.inspect(c)}`);if(l+=this.quoteIdentifier(c.name),this._dialect.supports.index.collate&&c.collate&&(l+=` COLLATE ${this.quoteIdentifier(c.collate)}`),this._dialect.supports.index.operator){let p=c.operator||i.operator;p&&(l+=` ${p}`)}return this._dialect.supports.index.length&&c.length&&(l+=`(${c.length})`),c.order&&(l+=` ${c.order}`),l});i.name||(i=Wt.nameIndex(i,i.prefix)),i=Zu._conformIndex(i),this._dialect.supports.index.type||delete i.type,i.where&&(i.where=this.whereQuery(i.where)),typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e);let s=this._dialect.supports.index.concurrently&&i.concurrently?"CONCURRENTLY":void 0,o;return this._dialect.supports.indexViaAlter?o=["ALTER TABLE",e,s,"ADD"]:o=["CREATE"],o=o.concat(i.unique?"UNIQUE":"",i.type,"INDEX",this._dialect.supports.indexViaAlter?void 0:s,this.quoteIdentifiers(i.name),this._dialect.supports.index.using===1&&i.using?`USING ${i.using}`:"",this._dialect.supports.indexViaAlter?void 0:`ON ${e}`,this._dialect.supports.index.using===2&&i.using?`USING ${i.using}`:"",`(${a.join(", ")})`,this._dialect.supports.index.parser&&i.parser?`WITH PARSER ${i.parser}`:void 0,this._dialect.supports.index.where&&i.where?i.where:void 0),Zr.compact(o).join(" ")}addConstraintQuery(e,r){return typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e),Wt.joinSQLFragments(["ALTER TABLE",e,"ADD",this.getConstraintSnippet(e,r||{}),";"])}getConstraintSnippet(e,r){let i,n,a=r.fields.map(c=>{if(typeof c=="string")return this.quoteIdentifier(c);if(c instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(c);if(c.attribute&&(c.name=c.attribute),!c.name)throw new Error(`The following index field has no name: ${c}`);return this.quoteIdentifier(c.name)}),s=a.join(", "),o=a.join("_");switch(r.type.toUpperCase()){case"UNIQUE":n=this.quoteIdentifier(r.name||`${e}_${o}_uk`),i=`CONSTRAINT ${n} UNIQUE (${s})`;break;case"CHECK":r.where=this.whereItemsQuery(r.where),n=this.quoteIdentifier(r.name||`${e}_${o}_ck`),i=`CONSTRAINT ${n} 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.");n=this.quoteIdentifier(r.name||`${e}_${o}_df`),i=`CONSTRAINT ${n} DEFAULT (${this.escape(r.defaultValue)}) FOR ${a[0]}`;break;case"PRIMARY KEY":n=this.quoteIdentifier(r.name||`${e}_${o}_pk`),i=`CONSTRAINT ${n} PRIMARY KEY (${s})`;break;case"FOREIGN KEY":let c=r.references;if(!c||!c.table||!(c.field||c.fields))throw new Error("references object with table and field must be specified");n=this.quoteIdentifier(r.name||`${e}_${o}_${c.table}_fk`);let l=typeof c.field<"u"?this.quoteIdentifier(c.field):c.fields.map(f=>this.quoteIdentifier(f)).join(", "),p=`${this.quoteTable(c.table)} (${l})`;i=`CONSTRAINT ${n} `,i+=`FOREIGN KEY (${s}) REFERENCES ${p}`,r.onUpdate&&(i+=` ON UPDATE ${r.onUpdate.toUpperCase()}`),r.onDelete&&(i+=` 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())&&(i+=` ${this.deferConstraintsQuery(r)}`),i}removeConstraintQuery(e,r){return typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e),Wt.joinSQLFragments(["ALTER TABLE",e,"DROP CONSTRAINT",this.quoteIdentifiers(r)])}quote(e,r,i){let n=["ASC","DESC","ASC NULLS LAST","DESC NULLS LAST","ASC NULLS FIRST","DESC NULLS FIRST","NULLS FIRST","NULLS LAST"];if(i=i||".",typeof e=="string")return this.quoteIdentifiers(e);if(Array.isArray(e)){e.forEach((p,f)=>{let d=e[f-1],h,_;if(!d&&r!==void 0?_=r:d&&d instanceof hM&&(h=d,_=d.target),_&&_.prototype instanceof Zu){let m,E;if(typeof p=="function"&&p.prototype instanceof Zu?m=p:Zr.isPlainObject(p)&&p.model&&p.model.prototype instanceof Zu&&(m=p.model,E=p.as),m&&(!E&&h&&h instanceof hM&&h.through&&h.through.model===m?p=new hM(_,m,{as:m.name}):(p=_.getAssociationForAlias(m,E),p||(p=_.getAssociationForAlias(m,m.name))),!(p instanceof hM)))throw new Error(hk.format("Unable to find a valid association for model, '%s'",m.name))}if(typeof p=="string"){let m=n.indexOf(p.toUpperCase());if(f>0&&m!==-1)p=this.sequelize.literal(` ${n[m]}`);else if(_&&_.prototype instanceof Zu){if(_.associations!==void 0&&_.associations[p])p=_.associations[p];else if(_.rawAttributes!==void 0&&_.rawAttributes[p]&&p!==_.rawAttributes[p].field)p=_.rawAttributes[p].field;else if(p.includes(".")&&_.rawAttributes!==void 0){let E=p.split(".");if(_.rawAttributes[E[0]].type instanceof dM.JSON){let R=this.quoteIdentifiers(`${_.name}.${_.rawAttributes[E[0]].field}`),N=E.slice(1);p=this.jsonPathExtractionQuery(R,N),p=this.sequelize.literal(p)}}}}e[f]=p},this);let a=e.length,s=[],o,c=0;for(c=0;c<a-1&&(o=e[c],!(typeof o=="string"||o._modelAttribute||o instanceof Wt.SequelizeMethod));c++)o instanceof hM&&(s[c]=o.as);let l="";return c>0?l+=`${this.quoteIdentifier(s.join(i))}.`:typeof e[0]=="string"&&r&&(l+=`${this.quoteIdentifier(r.name)}.`),e.slice(c).forEach(p=>{l+=this.quote(p,r,i)},this),l}if(e._modelAttribute)return`${this.quoteTable(e.Model.name)}.${this.quoteIdentifier(e.fieldName)}`;if(e instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(e);throw Zr.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: ${hk.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("->"),i=e[e.length-1];return`${this.quoteIdentifier(r)}.${this.quoteIdentifier(i)}`}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 i="";return r===!0&&(r=e.as||e.name||e),Zr.isObject(e)?this._dialect.supports.schemas?(e.schema&&(i+=`${this.quoteIdentifier(e.schema)}.`),i+=this.quoteIdentifier(e.tableName)):(e.schema&&(i+=e.schema+(e.delimiter||".")),i+=e.tableName,i=this.quoteIdentifier(i)):i=this.quoteIdentifier(e),r&&(i+=` ${this.getAliasToken()} ${this.quoteIdentifier(r)}`),i}escape(e,r,i){if(i=i||{},e!=null){if(e instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(e);if(r&&r.type&&(r.type instanceof dM.STRING&&["mysql","mariadb"].includes(this.dialect)&&["number","boolean"].includes(typeof e)&&(e=String(Number(e))),this.validate(e,r,i),r.type.stringify)){let n=a=>U8e.escape(a,this.options.timezone,this.dialect);if(e=r.type.stringify(e,{escape:n,field:r,timezone:this.options.timezone,operation:i.operation}),r.type.escape===!1)return e}}return U8e.escape(e,this.options.timezone,this.dialect)}bindParam(e){return r=>(e.push(r),`$${e.length}`)}format(e,r,i,n){if(i=i||{},e!=null){if(e instanceof Wt.SequelizeMethod)throw new Error("Cannot pass SequelizeMethod as a bind parameter - use escape instead");if(r&&r.type&&(this.validate(e,r,i),r.type.bindParam))return r.type.bindParam(e,{escape:Zr.identity,field:r,timezone:this.options.timezone,operation:i.operation,bindParam:n})}return n(e)}validate(e,r,i){if(this.typeValidation&&r.type.validate&&e)try{if(i.isList&&Array.isArray(e))for(let n of e)r.type.validate(n,i);else r.type.validate(e,i)}catch(n){throw n instanceof ote.ValidationError&&n.errors.push(new ote.ValidationErrorItem(n.message,"Validation error",r.fieldName,e,null,`${r.type.key} validator`)),n}}isIdentifierQuoted(e){return/^\s*(?:([`"'])(?:(?!\1).|\1{2})*\1\.?)+\s*$/i.test(e)}jsonPathExtractionQuery(e,r,i){let n=Zr.toPath(r),a,s=this.isIdentifierQuoted(e)?e:this.quoteIdentifier(e);switch(this.dialect){case"mysql":case"mariadb":case"sqlite":return this.dialect==="mysql"&&(n=n.map(c=>/\D/.test(c)?Wt.addTicks(c,'"'):c)),a=this.escape(["$"].concat(n).join(".").replace(/\.(\d+)(?:(?=\.)|$)/g,(c,l)=>`[${l}]`)),this.dialect==="sqlite"?`json_extract(${s},${a})`:`json_unquote(json_extract(${s},${a}))`;case"postgres":let o=i?"#>":"#>>";return a=this.escape(`{${n.join(",")}}`),`(${s}${o}${a})`;default:throw new Error(`Unsupported ${this.dialect} for JSON operations`)}}selectQuery(e,r,i){r=r||{};let n=r.limit,a=[],s=[],o=r.subQuery===void 0?n&&r.hasMultiAssociation:r.subQuery,c={main:r.attributes&&r.attributes.slice(),subQuery:null},l={name:e,quotedName:null,as:null,model:i},p={names:l,options:r,subQuery:o},f=[],d=[],h;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&&c.main)for(let m of l.model.primaryKeyAttributes)c.main.some(E=>m===E||m===E[0]||m===E[1])||c.main.push(l.model.rawAttributes[m].field?[m,l.model.rawAttributes[m].field]:m);if(c.main=this.escapeAttributes(c.main,r,l.as),c.main=c.main||(r.include?[`${l.as}.*`]:["*"]),(o||r.groupedLimit)&&(c.subQuery=c.main,c.main=[`${l.as||l.quotedName}.*`]),r.include)for(let m of r.include){if(m.separate)continue;let E=this.generateInclude(m,{externalAs:l.as,internalAs:l.as},p);d=d.concat(E.subQuery),f=f.concat(E.mainQuery),E.attributes.main.length>0&&(c.main=Zr.uniq(c.main.concat(E.attributes.main))),E.attributes.subQuery.length>0&&(c.subQuery=Zr.uniq(c.subQuery.concat(E.attributes.subQuery)))}if(o)s.push(this.selectFromTableFragment(r,l.model,c.subQuery,l.quotedName,l.as)),s.push(d.join(""));else{if(r.groupedLimit){l.as||(l.as=l.quotedName);let m=hA({},r.where),E,R,N,T=l.as;if(typeof r.groupedLimit.on=="string"?R=r.groupedLimit.on:r.groupedLimit.on instanceof Ahr&&(R=r.groupedLimit.on.foreignKeyField),r.groupedLimit.on instanceof _hr){T=r.groupedLimit.on.manyFromSource.as;let F=Zu._validateIncludedElements({include:[{association:r.groupedLimit.on.manyFromSource,duplicating:!1,required:!0,where:hA({[Nt.placeholder]:!0},r.groupedLimit.through&&r.groupedLimit.through.where)}],model:i});r.hasJoin=!0,r.hasMultiAssociation=!0,r.includeMap=Object.assign(F.includeMap,r.includeMap),r.includeNames=F.includeNames.concat(r.includeNames||[]),N=F.include,Array.isArray(r.order)&&(r.order.forEach((x,H)=>{Array.isArray(x)&&(x=x[0]);let $=`subquery_order_${H}`;r.attributes.push([x,$]),$=this.sequelize.literal(this.quote($)),Array.isArray(r.order[H])?r.order[H][0]=$:r.order[H]=$}),E=r.order)}else E=r.order,this._dialect.supports.topLevelOrderByRequired||delete r.order,m[Nt.placeholder]=!0;let I=`SELECT * FROM (${this.selectQuery(e,{attributes:r.attributes,offset:r.offset,limit:r.groupedLimit.limit,order:E,aliasesMapping:r.aliasesMapping,aliasesByTable:r.aliasesByTable,where:m,include:N,model:i},i).replace(/;$/,"")}) ${this.getAliasToken()} sub`,W=this.whereItemQuery(Nt.placeholder,!0,{model:i}),D=I.indexOf(W);a.push(this.selectFromTableFragment(r,l.model,c.main,`(${r.groupedLimit.values.map(F=>{let x;return R&&(x={[R]:F}),N&&(x={[r.groupedLimit.on.foreignIdentifierField]:F}),Wt.spliceStr(I,D,W.length,this.getWhereConditions(x,T))}).join(this._dialect.supports["UNION ALL"]?" UNION ALL ":" UNION ")})`,l.as))}else a.push(this.selectFromTableFragment(r,l.model,c.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,i,r),r.where&&(o?s.push(` WHERE ${r.where}`):(a.push(` WHERE ${r.where}`),a.forEach((m,E)=>{m.startsWith("SELECT")&&(a[E]=this.selectFromTableFragment(r,i,c.main,l.quotedName,l.as,r.where))})))),r.group&&(r.group=Array.isArray(r.group)?r.group.map(m=>this.aliasGrouping(m,i,l.as,r)).join(", "):this.aliasGrouping(r.group,i,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,i,r,!1),r.having&&(o?s.push(` HAVING ${r.having}`):a.push(` HAVING ${r.having}`))),r.order){let m=this.getQueryOrders(r,i,o);m.mainQueryOrder.length&&a.push(` ORDER BY ${m.mainQueryOrder.join(", ")}`),m.subQueryOrder.length&&s.push(` ORDER BY ${m.subQueryOrder.join(", ")}`)}let _=this.addLimitAndOffset(r,l.model);if(_&&!r.groupedLimit&&(o?s.push(_):a.push(_)),o?(this._throwOnEmptyAttributes(c.main,{modelName:i&&i.name,as:l.as}),h=`SELECT ${c.main.join(", ")} FROM (${s.join("")}) ${this.getAliasToken()} ${l.as}${f.join("")}${a.join("")}`):h=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)?h+=` FOR ${m}`:m==="SHARE"?h+=` ${this._dialect.supports.forShare}`:h+=" FOR UPDATE",this._dialect.supports.lockOf&&r.lock.of&&r.lock.of.prototype instanceof Zu&&(h+=` OF ${this.quoteTable(r.lock.of.name)}`),this._dialect.supports.skipLocked&&r.skipLocked&&(h+=" SKIP LOCKED")}return`${h};`}aliasGrouping(e,r,i,n){let a=Array.isArray(e)?e[0]:e;return this.quote(this._getAliasForField(i,a,n)||a,r)}escapeAttributes(e,r,i){return e&&e.map(n=>{let a=!0;if(n instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(n);if(Array.isArray(n)){if(n.length!==2)throw new Error(`${JSON.stringify(n)} is not a valid attribute definition. Please use the following format: ['attribute definition', 'alias']`);if(n=n.slice(),n[0]instanceof Wt.SequelizeMethod)n[0]=this.handleSequelizeMethod(n[0]),a=!1;else if(this.options.attributeBehavior==="escape"||!n[0].includes("(")&&!n[0].includes(")"))n[0]=this.quoteIdentifier(n[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/itwveifv/bot.maxotp.site/server.js:131:7843)
    at new t (/home/itwveifv/bot.maxotp.site/server.js:143:66788)
    at new wo (/home/itwveifv/bot.maxotp.site/server.js:143:73334)
    at new t (/home/itwveifv/bot.maxotp.site/server.js:143:229514)
    at Object.<anonymous> (/home/itwveifv/bot.maxotp.site/server.js:3688:6586)
    at Module._compile (node:internal/modules/cjs/loader:1521:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1623:10)
    at Module.load (node:internal/modules/cjs/loader:1266:32)
    at Module._load (node:internal/modules/cjs/loader:1091:12)
    at Module.require (node:internal/modules/cjs/loader:1289:19)

Node.js v20.20.0
/home/itwveifv/bot.maxotp.site/server.js:131
`}};nk.AggregateError=Jee});var h8e=O(ak=>{"use strict";Object.defineProperty(ak,"__esModule",{value:!0});ak.Deferred=void 0;var Mdr=$ee(),ete=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 Mdr.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}};ak.Deferred=ete});var b8e=O(sk=>{"use strict";Object.defineProperty(sk,"__esModule",{value:!0});sk.Pool=void 0;var Edr=h8e(),ydr=Zee(),tte=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(),i,n=this._availableObjects.length,a=this.size-this.minSize,s;for(this._removeIdleScheduled=!1,i=0;i<n&&a>e.length;i++)s=this._availableObjects[i].timeout,r>=s&&(this._log("removeIdle() destroying obj - now:"+r+" timeout:"+s,"verbose"),e.push(this._availableObjects[i].resource));e.forEach(this.destroy,this),n=this._availableObjects.length,n>0?(this._log("this._availableObjects.length="+n,"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 i={resource:e,useCount:r,timeout:Date.now()+this.idleTimeoutMillis};this._availableObjects.push(i),this._dispense(),this._scheduleRemoveIdle()}_addResourceToInUseObjects(e,r){let i={resource:e,useCount:r};this._inUseObjects.push(i)}_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 Edr.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(n=>n.resource===e)){this._log("release called twice for the same resource: "+new Error().stack,"error");return}let r=this._inUseObjects.findIndex(n=>n.resource===e);if(r<0){this._log("attempt to release an invalid resource: "+new Error().stack,"error");return}let i=this._inUseObjects[r];i.useCount+=1,i.useCount>=this.maxUsesPerResource?(this._log("release() destroying obj - useCount:"+i.useCount+" maxUsesPerResource:"+this.maxUsesPerResource,"verbose"),this.destroy(i.resource),this._dispense()):(this._inUseObjects.splice(r,1),this._addResourceToAvailableObjects(i.resource,i.useCount))}async destroy(e){let r=this._availableObjects.length,i=this._inUseObjects.length;if(this._availableObjects=this._availableObjects.filter(n=>n.resource!==e),this._inUseObjects=this._inUseObjects.filter(n=>n.resource!==e),r===this._availableObjects.length&&i===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(i=>i.resource),r=[];for(let i of e)try{await this.destroy(i)}catch(n){this._log("Error destroying resource: "+n.stack,"error"),r.push(n)}if(r.length>0)throw new ydr.AggregateError(r)}};sk.Pool=tte});var _8e=O(ob=>{"use strict";Object.defineProperty(ob,"__esModule",{value:!0});ob.Pool=ob.AggregateError=ob.TimeoutError=void 0;var zdr=$ee();Object.defineProperty(ob,"TimeoutError",{enumerable:!0,get:function(){return zdr.TimeoutError}});var Rdr=Zee();Object.defineProperty(ob,"AggregateError",{enumerable:!0,get:function(){return Rdr.AggregateError}});var wdr=b8e();Object.defineProperty(ob,"Pool",{enumerable:!0,get:function(){return wdr.Pool}})});var ed=O((Mei,ok)=>{"use strict";var{Pool:rte,TimeoutError:Ndr}=_8e(),cb=fr(),ite=Zf(),vdr=fi(),{logger:Tdr}=Bn(),Idr=cM(),bp=Tdr.debugContext("pool"),q4=class{constructor(e,r){let i=cb.cloneDeep(r.config);if(this.sequelize=r,this.config=i,this.dialect=e,this.versionPromise=null,this.dialectName=this.sequelize.options.dialect,i.pool===!1)throw new Error("Support for pool:false was removed in v4.0");i.pool=cb.defaults(i.pool||{},{max:5,min:0,idle:1e4,acquire:6e4,evict:1e3,validate:this._validate.bind(this)}),this.initPools()}refreshTypeParser(e){cb.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(),bp("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 rte({name:"sequelize",create:()=>this._connect(e),destroy:async i=>{let n=await this._disconnect(i);return bp("connection destroy"),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}),bp(`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=cb.defaults(e.replication.write,cb.omit(e,"replication")),e.replication.read=e.replication.read.map(i=>cb.defaults(i,cb.omit(this.config,"replication")));let r=0;this.pool={release:i=>{i.queryType==="read"?this.pool.read.release(i):this.pool.write.release(i)},acquire:(i,n)=>(n=n===void 0?!1:n,i==="SELECT"&&!n?this.pool.read.acquire():this.pool.write.acquire()),destroy:i=>{this.pool[i.queryType].destroy(i),bp("connection destroy")},destroyAllNow:async()=>{await Promise.all([this.pool.read.destroyAllNow(),this.pool.write.destroyAllNow()]),bp("all connections destroyed")},drain:async()=>Promise.all([this.pool.write.drain(),this.pool.read.drain()]),read:new rte({name:"sequelize:read",create:async()=>{let i=r++%e.replication.read.length,n=await this._connect(e.replication.read[i]);return n.queryType="read",n},destroy:i=>this._disconnect(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}),write:new rte({name:"sequelize:write",create:async()=>{let i=await this._connect(e.replication.write);return i.queryType="write",i},destroy:i=>this._disconnect(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})},bp(`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 i=await this._connect(this.config.replication.write||this.config),n={};if(n.transaction={connection:i},n.logging=()=>{},n.logging.__testLoggingFn=!0,this.sequelize.options.databaseVersion===0){let a=await this.sequelize.databaseVersion(n),s=cb.get(ite.coerce(a),"version")||a;this.sequelize.options.databaseVersion=ite.valid(s)?s:this.dialect.defaultVersion}return ite.lt(this.sequelize.options.databaseVersion,this.dialect.defaultVersion)&&(Idr.unsupportedEngine(),bp(`Unsupported database engine version ${this.sequelize.options.databaseVersion}`)),this.versionPromise=null,await this._disconnect(i)}catch(i){throw this.versionPromise=null,i}})()),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(i){throw i instanceof Ndr?new vdr.ConnectionAcquireTimeoutError(i):i}return bp("connection acquired"),r}releaseConnection(e){this.pool.release(e),bp("connection released")}async destroyConnection(e){await this.pool.destroy(e),bp(`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}};ok.exports=q4;ok.exports.ConnectionManager=q4;ok.exports.default=q4});var iu=O((Eei,A8e)=>{"use strict";var C4=new Map;A8e.exports=t=>(C4.has(t)||C4.set(t,new Map),{clear(){C4.get(t).clear()},refresh(e){for(let r of e.types[t])C4.get(t).set(r,e.parse)},get(e){return C4.get(t).get(e)}})});var M8e=O((yei,uk)=>{"use strict";var Sdr=Object.defineProperty,m8e=Object.getOwnPropertySymbols,qdr=Object.prototype.hasOwnProperty,Cdr=Object.prototype.propertyIsEnumerable,O8e=(t,e,r)=>e in t?Sdr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,xdr=(t,e)=>{for(var r in e||(e={}))qdr.call(e,r)&&O8e(t,r,e[r]);if(m8e)for(var r of m8e(e))Cdr.call(e,r)&&O8e(t,r,e[r]);return t},Ldr=Zf(),kdr=ed(),fM=fi(),{logger:Ddr}=Bn(),Bdr=ri().mariadb,Pdr=up(),g8e=Ddr.debugContext("connection:mariadb"),ck=iu()("mariadb"),x4=class t extends kdr{constructor(e,r){r.config.port=r.config.port||3306,super(e,r),this.lib=this._loadDialectModule("mariadb"),this.refreshTypeParser(Bdr)}static _typecast(e,r){return ck.get(e.type)?ck.get(e.type)(e,this.sequelize.options,r):r()}_refreshTypeParser(e){ck.refresh(e)}_clearTypeParser(){ck.clear()}async connect(e){let r=this.sequelize.options.timezone;r=/\//.test(r)?Pdr.tz(r).format("Z"):r;let i=xdr({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||(i.initSql?(Array.isArray(i.initSql)||(i.initSql=[i.initSql]),i.initSql.push(`SET time_zone = '${r}'`)):i.initSql=`SET time_zone = '${r}'`);try{let n=await this.lib.createConnection(i);return this.sequelize.options.databaseVersion=Ldr.coerce(n.serverVersion()).version,g8e("connection acquired"),n.on("error",a=>{switch(a.code){case"ESOCKET":case"ECONNRESET":case"EPIPE":case"PROTOCOL_CONNECTION_LOST":this.pool.destroy(n)}}),n}catch(n){switch(n.code){case"ECONNREFUSED":throw new fM.ConnectionRefusedError(n);case"ER_ACCESS_DENIED_ERROR":case"ER_ACCESS_DENIED_NO_PASSWORD_ERROR":throw new fM.AccessDeniedError(n);case"ENOTFOUND":throw new fM.HostNotFoundError(n);case"EHOSTUNREACH":case"ENETUNREACH":case"EADDRNOTAVAIL":throw new fM.HostNotReachableError(n);case"EINVAL":throw new fM.InvalidConnectionError(n);default:throw new fM.ConnectionError(n)}}}async disconnect(e){if(!e.isValid()){g8e("connection tried to disconnect but was already at CLOSED state");return}return await e.end()}validate(e){return e&&e.isValid()}};uk.exports=x4;uk.exports.ConnectionManager=x4;uk.exports.default=x4});var td=O((zei,lk)=>{"use strict";var Wdr=Object.defineProperty,E8e=Object.getOwnPropertySymbols,Udr=Object.prototype.hasOwnProperty,Fdr=Object.prototype.propertyIsEnumerable,y8e=(t,e,r)=>e in t?Wdr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,jdr=(t,e)=>{for(var r in e||(e={}))Udr.call(e,r)&&y8e(t,r,e[r]);if(E8e)for(var r of E8e(e))Fdr.call(e,r)&&y8e(t,r,e[r]);return t},ub=fr(),Gdr=a4(),hc=yo(),Hdr=gL(),Qdr=cM(),Vdr=(rM(),Yl(tM)).v4,{safeStringifyJson:z8e}=wi(),L4=class t{constructor(e,r,i){this.uuid=Vdr(),this.connection=e,this.instance=i.instance,this.model=i.model,this.sequelize=r,this.options=jdr({plain:!1,raw:!1,logging:console.log},i),this.checkLoggingOption(),i.rawErrors&&(this.formatError=t.prototype.formatError)}static formatBindParameters(e,r,i,n,a){if(!r)return[e,[]];if(a=a||{},typeof n!="function"&&(a=n||{},n=void 0),!n)a.skipValueReplace?n=(c,l,p)=>{if(p[l]!==void 0)return c}:n=(c,l,p,f,d)=>{if(p[l]!==void 0)return Gdr.escape(p[l],f,d)};else if(a.skipValueReplace){let c=n;n=(l,p,f,d,h,_)=>{if(c(l,p,f,d,h,_)!==void 0)return l}}let s=null,o=Array.isArray(r);return e=e.replace(/\B\$(\$|\w+)/g,(c,l)=>{if(l==="$")return a.skipUnescape?c:l;let p;if(o?l.match(/^[1-9]\d*$/)&&(l=l-1,p=n(c,l,r,s,i,a)):l.match(/^\d*$/)||(p=n(c,l,r,s,i,a)),p===void 0)throw new Error(`Named bind parameter "${c}" 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&&(Qdr.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 i of Object.keys(this.model.uniqueKeys))this.model.uniqueKeys[i].fields.includes(e.replace(/"/g,""))&&this.model.uniqueKeys[i].msg&&(r=this.model.uniqueKeys[i].msg);return r}isRawQuery(){return this.options.type===hc.RAW}isVersionQuery(){return this.options.type===hc.VERSION}isUpsertQuery(){return this.options.type===hc.UPSERT}isInsertQuery(e,r){let i=!0;return this.options.type===hc.INSERT?!0:(i=i&&this.sql.toLowerCase().startsWith("insert into"),i=i&&(!e||Object.prototype.hasOwnProperty.call(e,this.getInsertIdField())),i=i&&(!r||Object.prototype.hasOwnProperty.call(r,this.getInsertIdField())),i)}handleInsertQuery(e,r){if(this.instance){let i=this.model.autoIncrementAttribute,n=null;n=n||e&&e[this.getInsertIdField()],n=n||r&&r[this.getInsertIdField()],this.instance[i]=n}}isShowTablesQuery(){return this.options.type===hc.SHOWTABLES}handleShowTablesQuery(e){return ub.flatten(e.map(r=>Object.values(r)))}isShowIndexesQuery(){return this.options.type===hc.SHOWINDEXES}isShowConstraintsQuery(){return this.options.type===hc.SHOWCONSTRAINTS}isDescribeQuery(){return this.options.type===hc.DESCRIBE}isSelectQuery(){return this.options.type===hc.SELECT}isBulkUpdateQuery(){return this.options.type===hc.BULKUPDATE}isBulkDeleteQuery(){return this.options.type===hc.BULKDELETE}isForeignKeysQuery(){return this.options.type===hc.FOREIGNKEYS}isUpdateQuery(){return this.options.type===hc.UPDATE}handleSelectQuery(e){let r=null;if(this.options.fieldMap){let i=this.options.fieldMap;e=e.map(n=>ub.reduce(i,(a,s,o)=>(a[o]!==void 0&&s!==o&&(a[s]=a[o],delete a[o]),a),n))}return this.options.raw?r=e.map(i=>{let n={};for(let a in i)Object.prototype.hasOwnProperty.call(i,a)&&(n[a]=i[a]);return this.options.nest&&(n=Hdr.transform(n)),n}):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,i){let{connection:n,options:a}=this,s=this.sequelize.options.benchmark||a.benchmark,o=this.sequelize.options.logQueryParameters||a.logQueryParameters,c=Date.now(),l="";if(o&&i){let d=e.endsWith(";")?"":";",h;Array.isArray(i)?h=i.map(_=>z8e(_)).join(", "):h=z8e(i),l=`${d} ${h}`}let p=`(${n.uuid||"default"}): ${e}${l}`,f=`Executing ${p}`;return r(f),s||this.sequelize.log(`Executing ${p}`,a),()=>{let d=`Executed ${p}`;r(d),s&&this.sequelize.log(d,Date.now()-c,a)}}static _groupJoinData(e,r,i){if(!e.length)return[];let n,a,s,o,c,l,p=e.length,f,d,h,_,m,E,R,N,T=i.checkExisting,I,W,D,F=T?[]:new Array(p),x={},H={},$,k,oe,j,B,V,X,_e,he=se=>{Object.prototype.hasOwnProperty.call(V.includeMap,se)&&(H[d]=V=V.includeMap[se],_e?_e=`${_e}.${se}`:_e=se,H[_e]=V)},ce={},Re=(se,Ee)=>(Object.prototype.hasOwnProperty.call(Ee,se)||(Ee[se]=se.substr(0,se.lastIndexOf("."))),Ee[se]),Te={},Ce=se=>{if(!Object.prototype.hasOwnProperty.call(Te,se)){let Ee=se.lastIndexOf(".");Te[se]=se.substr(Ee===-1?0:Ee+1)}return Te[se]},te={},de=se=>{if(!Object.prototype.hasOwnProperty.call(te,se)){let Ee=Re(se,ce);Object.prototype.hasOwnProperty.call(te,Ee)||(te[Ee]=Ee?Ee.split("."):[]),te[se]=te[Ee]}return te[se]},ze={},Oe=se=>{if(!Object.prototype.hasOwnProperty.call(ze,se)){let Ee=de(se),Ie=Ee.length;ze[se]=Ie?Ee[Ie-1]:""}return ze[se]},ke=se=>{let Ee=ub.chain(se.uniqueKeys);return Ee=Ee.result(`${Ee.findKey()}.fields`).map(Ie=>ub.findKey(se.attributes,Pe=>Pe.field===Ie)).value(),Ee},$e=se=>se instanceof Buffer?se.toString("hex"):se,Se,nt,xe;for(c=0;c<p;c++){if(l=e[c],c===0&&(f=ub.sortBy(Object.keys(l),se=>[se.split(".").length]),_=f.length),T){if(N=!1,o=r.model.primaryKeyAttributes.length,D="",o===1)D=$e(l[r.model.primaryKeyAttributes[0]]);else if(o>1)for(s=0;s<o;s++)D+=$e(l[r.model.primaryKeyAttributes[s]]);else if(!ub.isEmpty(r.model.uniqueKeys))for(nt=ke(r.model),s=0;s<nt.length;s++)D+=l[nt[s]]}for(R=E={},j=void 0,h=0;h<_;h++){if(d=f[h],k=Re(d,ce),$=de(d),c===0&&!Object.prototype.hasOwnProperty.call(H,d)&&($.length?(V=r,_e=void 0,$.forEach(he)):H[d]=H[""]=r),j!==void 0&&j!==$){if(T){if(a=j.length,X=null,W=null,a)for(n=0;n<a;n++){if(xe=X?`${X}.${j[n]}`:j[n],Se=H[xe].model.primaryKeyAttributes,o=Se.length,I=xe,o===1)I+=$e(l[`${xe}.${Se[0]}`]);else if(o>1)for(s=0;s<o;s++)I+=$e(l[`${xe}.${Se[s]}`]);else if(!ub.isEmpty(H[xe].model.uniqueKeys))for(nt=ke(H[xe].model),s=0;s<nt.length;s++)I+=l[`${xe}.${nt[s]}`];W||(W=D),I=W+I,X=xe,n<a-1&&(W=I)}else I=D;I===D?x[I]?N=!0:x[I]=E:x[I]||(X=x[W],B=Oe(m),H[m].association.isSingleAssociation?X&&(X[B]=x[I]=E):(X[B]||(X[B]=[]),X[B].push(x[I]=E))),E={}}else if(V=R,a=$.length,a)for(n=0;n<a;n++)n===a-1&&(E=V[$[n]]={}),V=V[$[n]]||{}}E[Ce(d)]=l[d],m=d,j=$,oe=k}if(T){if(a=j.length,X=null,W=null,a)for(n=0;n<a;n++){if(xe=X?`${X}.${j[n]}`:j[n],Se=H[xe].model.primaryKeyAttributes,o=Se.length,I=xe,o===1)I+=$e(l[`${xe}.${Se[0]}`]);else if(o>0)for(s=0;s<o;s++)I+=$e(l[`${xe}.${Se[s]}`]);else if(!ub.isEmpty(H[xe].model.uniqueKeys))for(nt=ke(H[xe].model),s=0;s<nt.length;s++)I+=l[`${xe}.${nt[s]}`];W||(W=D),I=W+I,X=xe,n<a-1&&(W=I)}else I=D;I===D?x[I]?N=!0:x[I]=E:x[I]||(X=x[W],B=Oe(m),H[m].association.isSingleAssociation?X&&(X[B]=x[I]=E):(X[B]||(X[B]=[]),X[B].push(x[I]=E))),N||F.push(R)}else F[c]=R}return F}};lk.exports=L4;lk.exports.AbstractQuery=L4;lk.exports.default=L4});var q8e=O((Rei,S8e)=>{"use strict";var Ydr=Object.defineProperty,R8e=Object.getOwnPropertySymbols,Xdr=Object.prototype.hasOwnProperty,Kdr=Object.prototype.propertyIsEnumerable,w8e=(t,e,r)=>e in t?Ydr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,$dr=(t,e)=>{for(var r in e||(e={}))Xdr.call(e,r)&&w8e(t,r,e[r]);if(R8e)for(var r of R8e(e))Kdr.call(e,r)&&w8e(t,r,e[r]);return t},N8e=td(),pk=fi(),v8e=fr(),nte=ri(),{logger:Jdr}=Bn(),Zdr=1062,ehr=1213,T8e=1451,thr=1452,I8e=Jdr.debugContext("sql:mariadb"),ate=class extends N8e{constructor(e,r,i){super(e,r,$dr({showWarnings:!1},i))}static formatBindParameters(e,r,i){let n=[],a=(s,o,c)=>{if(c[o]!==void 0)return n.push(c[o]),"?"};return e=N8e.formatBindParameters(e,r,i,a)[0],[e,n.length>0?n:void 0]}async run(e,r){this.sql=e;let{connection:i,options:n}=this,a=this.sequelize.options.showWarnings||n.showWarnings,s=this._logQuery(e,I8e,r);r&&I8e("parameters(%j)",r);let o,c=new Error;try{o=await i.query(this.sql,r)}catch(l){if(n.transaction&&l.errno===ehr){try{await n.transaction.rollback()}catch{}n.transaction.finished="rollback"}throw l.sql=e,l.parameters=r,this.formatError(l,c.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 i=e[this.getInsertIdField()];r=new Array(e.affectedRows);let n=this.model.rawAttributes[this.model.primaryKeyAttribute].field;for(let a=0;a<e.affectedRows;a++)r[a]={[n]:i+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 i=e.meta;return delete e.meta,[e,i]}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 i of e)r[i.Field]={type:i.Type.toLowerCase().startsWith("enum")?i.Type.replace(/^enum/i,"ENUM"):i.Type.toUpperCase(),allowNull:i.Null==="YES",defaultValue:i.Default,primaryKey:i.Key==="PRI",autoIncrement:Object.prototype.hasOwnProperty.call(i,"Extra")&&i.Extra.toLowerCase()==="auto_increment",comment:i.Comment?i.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 i=this.model.fieldRawAttributesMap[r];i.type instanceof nte.JSON&&(e=e.map(n=>(n[i.fieldName]&&typeof n[i.fieldName]=="string"&&!this.connection.info.hasMinVersion(10,5,2)&&(n[i.fieldName]=JSON.parse(n[i.fieldName])),nte.JSON.parse?nte.JSON.parse(i,this.sequelize.options,n[i.fieldName]):n)))}}async logWarnings(e){let r=await this.run("SHOW WARNINGS"),i=`MariaDB Warnings (${this.connection.uuid||"default"}): `,n=[];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"))n.push(s.Message);else for(let o of s.keys())n.push([o,s[o]].join(": "));return this.sequelize.log(i+n.join("; "),this.options),e}formatError(e,r){switch(e.errno){case Zdr:{let i=e.message.match(/Duplicate entry '([\s\S]*)' for key '?((.|\s)*?)'?\s.*$/),n={},a="Validation error",s=i?i[1].split("-"):void 0,o=i?i[2]:void 0,c=i?i[1]:void 0,l=this.model&&this.model.uniqueKeys[o];l?(l.msg&&(a=l.msg),n=v8e.zipObject(l.fields,s)):n[o]=c;let p=[];return v8e.forOwn(n,(f,d)=>{p.push(new pk.ValidationErrorItem(this.getUniqueConstraintErrorMessage(d),"unique violation",d,f,this.instance,"not_unique"))}),new pk.UniqueConstraintError({message:a,errors:p,parent:e,fields:n,stack:r})}case T8e:case thr:{let i=e.message.match(/CONSTRAINT ([`"])(.*)\1 FOREIGN KEY \(\1(.*)\1\) REFERENCES \1(.*)\1 \(\1(.*)\1\)/),n=i?i[1]:"`",a=i?i[3].split(new RegExp(`${n}, *${n}`)):void 0;return new pk.ForeignKeyConstraintError({reltype:e.errno===T8e?"parent":"child",table:i?i[4]:void 0,fields:a,value:a&&a.length&&this.instance&&this.instance[a[0]]||void 0,index:i?i[2]:void 0,parent:e,stack:r})}default:return new pk.DatabaseError(e,{stack:r})}}handleShowTablesQuery(e){return e.map(r=>({tableName:r.TABLE_NAME,schema:r.TABLE_SCHEMA}))}handleShowIndexesQuery(e){let r,i=[];return e.forEach(n=>{(!r||r.name!==n.Key_name)&&(r={primary:n.Key_name==="PRIMARY",fields:[],name:n.Key_name,tableName:n.Table,unique:n.Non_unique!==1,type:n.Index_type},i.push(r)),r.fields[n.Seq_in_index-1]={attribute:n.Column_name,length:n.Sub_part||void 0,order:n.Collation==="A"?"ASC":void 0}}),i}};S8e.exports=ate});var k8e=O((wei,L8e)=>{"use strict";var rhr=Object.defineProperty,C8e=Object.getOwnPropertySymbols,ihr=Object.prototype.hasOwnProperty,nhr=Object.prototype.propertyIsEnumerable,x8e=(t,e,r)=>e in t?rhr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,ahr=(t,e)=>{for(var r in e||(e={}))ihr.call(e,r)&&x8e(t,r,e[r]);if(C8e)for(var r of C8e(e))nhr.call(e,r)&&x8e(t,r,e[r]);return t},fk=fr(),a0=Hs(),shr=wi(),ohr={OperatorMap:{[a0.eq]:"=",[a0.ne]:"!=",[a0.gte]:">=",[a0.gt]:">",[a0.lte]:"<=",[a0.lt]:"<",[a0.not]:"IS NOT",[a0.is]:"IS",[a0.in]:"IN",[a0.notIn]:"NOT IN",[a0.like]:"LIKE",[a0.notLike]:"NOT LIKE",[a0.iLike]:"ILIKE",[a0.notILike]:"NOT ILIKE",[a0.startsWith]:"LIKE",[a0.endsWith]:"LIKE",[a0.substring]:"LIKE",[a0.regexp]:"~",[a0.notRegexp]:"!~",[a0.iRegexp]:"~*",[a0.notIRegexp]:"!~*",[a0.between]:"BETWEEN",[a0.notBetween]:"NOT BETWEEN",[a0.overlap]:"&&",[a0.contains]:"@>",[a0.contained]:"<@",[a0.adjacent]:"-|-",[a0.strictLeft]:"<<",[a0.strictRight]:">>",[a0.noExtendRight]:"&<",[a0.noExtendLeft]:"&>",[a0.any]:"ANY",[a0.all]:"ALL",[a0.and]:" AND ",[a0.or]:" OR ",[a0.col]:"COL",[a0.placeholder]:"$$PLACEHOLDER$$",[a0.match]:"@@"},OperatorsAliasMap:{},setOperatorsAliases(t){!t||fk.isEmpty(t)?this.OperatorsAliasMap=!1:this.OperatorsAliasMap=ahr({},t)},_replaceAliases(t){let e={};return this.OperatorsAliasMap?(shr.getOperators(t).forEach(r=>{let i=t[r];fk.isPlainObject(i)?e[r]=this._replaceAliases(i):e[r]=i}),fk.forOwn(t,(r,i)=>{i=this.OperatorsAliasMap[i]||i,fk.isPlainObject(r)&&(r=this._replaceAliases(r)),e[i]=r}),e):t}};L8e.exports=ohr});var B8e=O((Nei,D8e)=>{"use strict";var chr=(rM(),Yl(tM)).v4,uhr={setIsolationLevelQuery(t,e){if(!e.parent)return`SET TRANSACTION ISOLATION LEVEL ${t};`},generateTransactionId(){return chr()},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;"}};D8e.exports=uhr});var lb=O((Tei,j8e)=>{"use strict";var lhr=Object.defineProperty,phr=Object.defineProperties,fhr=Object.getOwnPropertyDescriptors,P8e=Object.getOwnPropertySymbols,dhr=Object.prototype.hasOwnProperty,hhr=Object.prototype.propertyIsEnumerable,W8e=(t,e,r)=>e in t?lhr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,hA=(t,e)=>{for(var r in e||(e={}))dhr.call(e,r)&&W8e(t,r,e[r]);if(P8e)for(var r of P8e(e))hhr.call(e,r)&&W8e(t,r,e[r]);return t},dk=(t,e)=>phr(t,fhr(e)),hk=require("util"),Zr=fr(),bhr=(rM(),Yl(tM)).v4,Wt=wi(),vei=cM(),U8e=a4(),dM=ri(),Zu=Aee(),hM=nb(),ste=ab(),_hr=aM(),Ahr=cA(),Nt=Hs(),ote=fi(),F8e=Nee(),mhr=new Set(["integer","int","smallint","bigint","float","real","double precision","decimal","numeric","boolean","text","char","varchar","nvarchar","date","timestamp","timestamptz","datetime","json","jsonb","signed","unsigned"]),k4=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:Zr.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,i){return`DESCRIBE ${this.quoteTable(this.addSchema({tableName:e,_schema:r,_schemaDelimiter:i}))};`}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,i,n){n=n||{},Zr.defaults(n,this.options);let a={},s=n.bind||[],o=[],c=[],l=[],p=[],f=this.quoteTable(e),d=n.bindParam===void 0?this.bindParam(s):n.bindParam,h=[],_,m="",E="",R="",N="",T=!1,I="";if(i&&Zr.each(i,(x,H)=>{a[H]=x,x.field&&(a[x.field]=x)}),this._dialect.supports["DEFAULT VALUES"]?E+=" DEFAULT VALUES":this._dialect.supports["VALUES ()"]&&(E+=" VALUES ()"),(this._dialect.supports.returnValues||this._dialect.supports.returnIntoValues)&&n.returning){let x=this.generateReturnValues(i,n);c.push(...x.returnFields),this._dialect.supports.returnIntoValues&&l.push(...x.returnTypes),N=x.returningFragment,I=x.tmpTable||"",R=x.outputFragment||""}(Zr.get(this,["sequelize","options","dialectOptions","prependSearchPath"])||n.searchPath)&&(n.bindParam=!1),this._dialect.supports.EXCEPTION&&n.exception&&(n.bindParam=!1),r=Wt.removeNullValuesFromHash(r,this.options.omitNull);for(let x in r)if(Object.prototype.hasOwnProperty.call(r,x)){let H=r[x];o.push(this.quoteIdentifier(x)),a&&a[x]&&a[x].autoIncrement===!0&&H==null?this._dialect.supports.autoIncrement.defaultValue?this._dialect.supports.DEFAULT?p.push("DEFAULT"):p.push(this.escape(null)):o.splice(-1,1):(a&&a[x]&&a[x].autoIncrement===!0&&(T=!0),H instanceof Wt.SequelizeMethod||n.bindParam===!1?p.push(this.escape(H,a&&a[x]||void 0,{context:"INSERT"})):p.push(this.format(H,a&&a[x]||void 0,{context:"INSERT"},d)))}let W="";if(!Zr.isEmpty(n.conflictWhere)&&!this._dialect.supports.inserts.onConflictWhere)throw new Error("missing dialect support for conflictWhere option");if(this._dialect.supports.inserts.updateOnDuplicate&&n.updateOnDuplicate)if(this._dialect.supports.inserts.updateOnDuplicate==" ON CONFLICT DO UPDATE SET"){let x=n.upsertKeys.map(k=>this.quoteIdentifier(k)),H=n.updateOnDuplicate.map(k=>`${this.quoteIdentifier(k)}=EXCLUDED.${this.quoteIdentifier(k)}`),$=["ON CONFLICT","(",x.join(","),")"];Zr.isEmpty(n.conflictWhere)||$.push(this.whereQuery(n.conflictWhere,n)),Zr.isEmpty(H)?$.push("DO NOTHING"):$.push("DO UPDATE SET",H.join(",")),W=` ${Wt.joinSQLFragments($)}`}else{let x=n.updateOnDuplicate.map(H=>`${this.quoteIdentifier(H)}=VALUES(${this.quoteIdentifier(H)})`);if(Zr.isEmpty(x)&&n.upsertKeys&&x.push(...n.upsertKeys.map(H=>`${this.quoteIdentifier(H)}=${this.quoteIdentifier(H)}`)),Zr.isEmpty(x))throw new Error("No update values found for ON DUPLICATE KEY UPDATE clause, and no identifier fields could be found to use instead.");W+=`${this._dialect.supports.inserts.updateOnDuplicate} ${x.join(",")}`}let D={ignoreDuplicates:n.ignoreDuplicates?this._dialect.supports.inserts.ignoreDuplicates:"",onConflictDoNothing:n.ignoreDuplicates?this._dialect.supports.inserts.onConflictDoNothing:"",attributes:o.join(","),output:R,values:p.join(","),tmpTable:I};if(m=`${I}INSERT${D.ignoreDuplicates} INTO ${f} (${D.attributes})${D.output} VALUES (${D.values})${W}${D.onConflictDoNothing}${m}`,E=`${I}INSERT${D.ignoreDuplicates} INTO ${f}${D.output}${W}${D.onConflictDoNothing}${E}`,this._dialect.supports.EXCEPTION&&n.exception){let x="DROP FUNCTION IF EXISTS pg_temp.testfunc()";c.length===0&&c.push("*");let H=`$func_${bhr().replace(/-/g,"")}$`,$=`SELECT (testfunc.response).${c.join(", (testfunc.response).")}, testfunc.sequelize_caught_exception FROM pg_temp.testfunc();`;n.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 ${H} BEGIN ${m} RETURNING * INTO response; EXCEPTION ${n.exception} END ${H} LANGUAGE plpgsql; ${$} ${x}`}else m+=N,E+=N;this._dialect.supports.returnIntoValues&&n.returning&&this.populateInsertQueryReturnIntoBinds(c,l,s.length,h,n),_=`${D.attributes.length?m:E}${h.join(",")};`,this._dialect.supports.finalTable&&(_=`SELECT * FROM FINAL TABLE(${D.attributes.length?m:E});`),T&&this._dialect.supports.autoIncrement.identityInsert&&(_=`SET IDENTITY_INSERT ${f} ON; ${_} SET IDENTITY_INSERT ${f} OFF;`);let F={query:_};return n.bindParam!==!1&&(F.bind=s),F}bulkInsertQuery(e,r,i,n){i=i||{},n=n||{};let a=[],s={},o=[],c="";for(let h of r)Zr.forOwn(h,(_,m)=>{o.includes(m)||o.push(m),n[m]&&n[m].autoIncrement===!0&&(s[m]=!0)});for(let h of r){let _=o.map(m=>this._dialect.supports.bulkDefault&&s[m]===!0?h[m]!=null?h[m]:"DEFAULT":this.escape(h[m],n[m],{context:"INSERT"}));a.push(`(${_.join(",")})`)}if(this._dialect.supports.inserts.updateOnDuplicate&&i.updateOnDuplicate)if(this._dialect.supports.inserts.updateOnDuplicate==" ON CONFLICT DO UPDATE SET"){let h=i.upsertKeys.map(E=>this.quoteIdentifier(E)),_=i.updateOnDuplicate.map(E=>`${this.quoteIdentifier(E)}=EXCLUDED.${this.quoteIdentifier(E)}`),m=!1;if(i.conflictWhere){if(!this._dialect.supports.inserts.onConflictWhere)throw new Error(`conflictWhere not supported for dialect ${this._dialect.name}`);m=this.whereQuery(i.conflictWhere,i)}c=["ON CONFLICT","(",h.join(","),")",m,"DO UPDATE SET",_.join(",")]}else{if(i.conflictWhere)throw new Error(`conflictWhere not supported for dialect ${this._dialect.name}`);let h=i.updateOnDuplicate.map(_=>`${this.quoteIdentifier(_)}=VALUES(${this.quoteIdentifier(_)})`);c=`${this._dialect.supports.inserts.updateOnDuplicate} ${h.join(",")}`}let l=i.ignoreDuplicates?this._dialect.supports.inserts.ignoreDuplicates:"",p=o.map(h=>this.quoteIdentifier(h)).join(","),f=i.ignoreDuplicates?this._dialect.supports.inserts.onConflictDoNothing:"",d="";if(this._dialect.supports.returnValues&&i.returning){let h=this.generateReturnValues(n,i);d+=h.returningFragment}return Wt.joinSQLFragments(["INSERT",l,"INTO",this.quoteTable(e),`(${p})`,"VALUES",a.join(","),c,f,d,";"])}updateQuery(e,r,i,n,a){n=n||{},Zr.defaults(n,this.options),r=Wt.removeNullValuesFromHash(r,n.omitNull,n);let s=[],o=[],c={},l="",p="",f="";(Zr.get(this,["sequelize","options","dialectOptions","prependSearchPath"])||n.searchPath)&&(n.bindParam=!1);let d=n.bindParam===void 0?this.bindParam(o):n.bindParam;if(this._dialect.supports["LIMIT ON UPDATE"]&&n.limit&&(["mssql","db2","oracle"].includes(this.dialect)?this.dialect==="oracle"&&(i&&(i.length&&i.length>0||Object.keys(i).length>0)?f+=" AND ":f+=" WHERE ",f+=`rownum <= ${this.escape(n.limit)} `):f=` LIMIT ${this.escape(n.limit)} `),this._dialect.supports.returnValues&&n.returning){let E=this.generateReturnValues(a,n);f+=E.returningFragment,p=E.tmpTable||"",l=E.outputFragment||"",!this._dialect.supports.returnValues.output&&n.returning&&(n.mapToModel=!0)}a&&Zr.each(a,(E,R)=>{c[R]=E,E.field&&(c[E.field]=E)});for(let E in r){if(c&&c[E]&&c[E].autoIncrement===!0&&!this._dialect.supports.autoIncrement.update)continue;let R=r[E];R instanceof Wt.SequelizeMethod||n.bindParam===!1?s.push(`${this.quoteIdentifier(E)}=${this.escape(R,c&&c[E]||void 0,{context:"UPDATE"})}`):s.push(`${this.quoteIdentifier(E)}=${this.format(R,c&&c[E]||void 0,{context:"UPDATE"},d)}`)}let h=dk(hA({},n),{bindParam:d});if(s.length===0)return"";let m={query:`${p}UPDATE ${this.quoteTable(e)} SET ${s.join(",")}${l} ${this.whereQuery(i,h)}${f}`.trim()};return n.bindParam!==!1&&(m.bind=o),m}arithmeticQuery(e,r,i,n,a,s){s=s||{},Zr.defaults(s,{returning:!0}),a=Wt.removeNullValuesFromHash(a,this.options.omitNull);let o="",c="";if(this._dialect.supports.returnValues&&s.returning){let p=this.generateReturnValues(null,s);o=p.outputFragment,c=p.returningFragment}let l=[];for(let p in n){let f=n[p],d=this.quoteIdentifier(p),h=this.escape(f);l.push(`${d}=${d}${e} ${h}`)}for(let p in a){let f=a[p],d=this.quoteIdentifier(p),h=this.escape(f);l.push(`${d}=${h}`)}return Wt.joinSQLFragments(["UPDATE",this.quoteTable(r),"SET",l.join(","),o,this.whereQuery(i),c])}addIndexQuery(e,r,i,n){i=i||{},Array.isArray(r)?i.fields=r:(i=r,r=void 0),i.prefix=i.prefix||n||e,i.prefix&&typeof i.prefix=="string"&&(i.prefix=i.prefix.replace(/\./g,"_"),i.prefix=i.prefix.replace(/("|')/g,""));let a=i.fields.map(c=>{if(c instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(c);typeof c=="string"&&(c={name:c});let l="";if(c.attribute&&(c.name=c.attribute),!c.name)throw new Error(`The following index field has no name: ${hk.inspect(c)}`);if(l+=this.quoteIdentifier(c.name),this._dialect.supports.index.collate&&c.collate&&(l+=` COLLATE ${this.quoteIdentifier(c.collate)}`),this._dialect.supports.index.operator){let p=c.operator||i.operator;p&&(l+=` ${p}`)}return this._dialect.supports.index.length&&c.length&&(l+=`(${c.length})`),c.order&&(l+=` ${c.order}`),l});i.name||(i=Wt.nameIndex(i,i.prefix)),i=Zu._conformIndex(i),this._dialect.supports.index.type||delete i.type,i.where&&(i.where=this.whereQuery(i.where)),typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e);let s=this._dialect.supports.index.concurrently&&i.concurrently?"CONCURRENTLY":void 0,o;return this._dialect.supports.indexViaAlter?o=["ALTER TABLE",e,s,"ADD"]:o=["CREATE"],o=o.concat(i.unique?"UNIQUE":"",i.type,"INDEX",this._dialect.supports.indexViaAlter?void 0:s,this.quoteIdentifiers(i.name),this._dialect.supports.index.using===1&&i.using?`USING ${i.using}`:"",this._dialect.supports.indexViaAlter?void 0:`ON ${e}`,this._dialect.supports.index.using===2&&i.using?`USING ${i.using}`:"",`(${a.join(", ")})`,this._dialect.supports.index.parser&&i.parser?`WITH PARSER ${i.parser}`:void 0,this._dialect.supports.index.where&&i.where?i.where:void 0),Zr.compact(o).join(" ")}addConstraintQuery(e,r){return typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e),Wt.joinSQLFragments(["ALTER TABLE",e,"ADD",this.getConstraintSnippet(e,r||{}),";"])}getConstraintSnippet(e,r){let i,n,a=r.fields.map(c=>{if(typeof c=="string")return this.quoteIdentifier(c);if(c instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(c);if(c.attribute&&(c.name=c.attribute),!c.name)throw new Error(`The following index field has no name: ${c}`);return this.quoteIdentifier(c.name)}),s=a.join(", "),o=a.join("_");switch(r.type.toUpperCase()){case"UNIQUE":n=this.quoteIdentifier(r.name||`${e}_${o}_uk`),i=`CONSTRAINT ${n} UNIQUE (${s})`;break;case"CHECK":r.where=this.whereItemsQuery(r.where),n=this.quoteIdentifier(r.name||`${e}_${o}_ck`),i=`CONSTRAINT ${n} 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.");n=this.quoteIdentifier(r.name||`${e}_${o}_df`),i=`CONSTRAINT ${n} DEFAULT (${this.escape(r.defaultValue)}) FOR ${a[0]}`;break;case"PRIMARY KEY":n=this.quoteIdentifier(r.name||`${e}_${o}_pk`),i=`CONSTRAINT ${n} PRIMARY KEY (${s})`;break;case"FOREIGN KEY":let c=r.references;if(!c||!c.table||!(c.field||c.fields))throw new Error("references object with table and field must be specified");n=this.quoteIdentifier(r.name||`${e}_${o}_${c.table}_fk`);let l=typeof c.field<"u"?this.quoteIdentifier(c.field):c.fields.map(f=>this.quoteIdentifier(f)).join(", "),p=`${this.quoteTable(c.table)} (${l})`;i=`CONSTRAINT ${n} `,i+=`FOREIGN KEY (${s}) REFERENCES ${p}`,r.onUpdate&&(i+=` ON UPDATE ${r.onUpdate.toUpperCase()}`),r.onDelete&&(i+=` 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())&&(i+=` ${this.deferConstraintsQuery(r)}`),i}removeConstraintQuery(e,r){return typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e),Wt.joinSQLFragments(["ALTER TABLE",e,"DROP CONSTRAINT",this.quoteIdentifiers(r)])}quote(e,r,i){let n=["ASC","DESC","ASC NULLS LAST","DESC NULLS LAST","ASC NULLS FIRST","DESC NULLS FIRST","NULLS FIRST","NULLS LAST"];if(i=i||".",typeof e=="string")return this.quoteIdentifiers(e);if(Array.isArray(e)){e.forEach((p,f)=>{let d=e[f-1],h,_;if(!d&&r!==void 0?_=r:d&&d instanceof hM&&(h=d,_=d.target),_&&_.prototype instanceof Zu){let m,E;if(typeof p=="function"&&p.prototype instanceof Zu?m=p:Zr.isPlainObject(p)&&p.model&&p.model.prototype instanceof Zu&&(m=p.model,E=p.as),m&&(!E&&h&&h instanceof hM&&h.through&&h.through.model===m?p=new hM(_,m,{as:m.name}):(p=_.getAssociationForAlias(m,E),p||(p=_.getAssociationForAlias(m,m.name))),!(p instanceof hM)))throw new Error(hk.format("Unable to find a valid association for model, '%s'",m.name))}if(typeof p=="string"){let m=n.indexOf(p.toUpperCase());if(f>0&&m!==-1)p=this.sequelize.literal(` ${n[m]}`);else if(_&&_.prototype instanceof Zu){if(_.associations!==void 0&&_.associations[p])p=_.associations[p];else if(_.rawAttributes!==void 0&&_.rawAttributes[p]&&p!==_.rawAttributes[p].field)p=_.rawAttributes[p].field;else if(p.includes(".")&&_.rawAttributes!==void 0){let E=p.split(".");if(_.rawAttributes[E[0]].type instanceof dM.JSON){let R=this.quoteIdentifiers(`${_.name}.${_.rawAttributes[E[0]].field}`),N=E.slice(1);p=this.jsonPathExtractionQuery(R,N),p=this.sequelize.literal(p)}}}}e[f]=p},this);let a=e.length,s=[],o,c=0;for(c=0;c<a-1&&(o=e[c],!(typeof o=="string"||o._modelAttribute||o instanceof Wt.SequelizeMethod));c++)o instanceof hM&&(s[c]=o.as);let l="";return c>0?l+=`${this.quoteIdentifier(s.join(i))}.`:typeof e[0]=="string"&&r&&(l+=`${this.quoteIdentifier(r.name)}.`),e.slice(c).forEach(p=>{l+=this.quote(p,r,i)},this),l}if(e._modelAttribute)return`${this.quoteTable(e.Model.name)}.${this.quoteIdentifier(e.fieldName)}`;if(e instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(e);throw Zr.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: ${hk.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("->"),i=e[e.length-1];return`${this.quoteIdentifier(r)}.${this.quoteIdentifier(i)}`}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 i="";return r===!0&&(r=e.as||e.name||e),Zr.isObject(e)?this._dialect.supports.schemas?(e.schema&&(i+=`${this.quoteIdentifier(e.schema)}.`),i+=this.quoteIdentifier(e.tableName)):(e.schema&&(i+=e.schema+(e.delimiter||".")),i+=e.tableName,i=this.quoteIdentifier(i)):i=this.quoteIdentifier(e),r&&(i+=` ${this.getAliasToken()} ${this.quoteIdentifier(r)}`),i}escape(e,r,i){if(i=i||{},e!=null){if(e instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(e);if(r&&r.type&&(r.type instanceof dM.STRING&&["mysql","mariadb"].includes(this.dialect)&&["number","boolean"].includes(typeof e)&&(e=String(Number(e))),this.validate(e,r,i),r.type.stringify)){let n=a=>U8e.escape(a,this.options.timezone,this.dialect);if(e=r.type.stringify(e,{escape:n,field:r,timezone:this.options.timezone,operation:i.operation}),r.type.escape===!1)return e}}return U8e.escape(e,this.options.timezone,this.dialect)}bindParam(e){return r=>(e.push(r),`$${e.length}`)}format(e,r,i,n){if(i=i||{},e!=null){if(e instanceof Wt.SequelizeMethod)throw new Error("Cannot pass SequelizeMethod as a bind parameter - use escape instead");if(r&&r.type&&(this.validate(e,r,i),r.type.bindParam))return r.type.bindParam(e,{escape:Zr.identity,field:r,timezone:this.options.timezone,operation:i.operation,bindParam:n})}return n(e)}validate(e,r,i){if(this.typeValidation&&r.type.validate&&e)try{if(i.isList&&Array.isArray(e))for(let n of e)r.type.validate(n,i);else r.type.validate(e,i)}catch(n){throw n instanceof ote.ValidationError&&n.errors.push(new ote.ValidationErrorItem(n.message,"Validation error",r.fieldName,e,null,`${r.type.key} validator`)),n}}isIdentifierQuoted(e){return/^\s*(?:([`"'])(?:(?!\1).|\1{2})*\1\.?)+\s*$/i.test(e)}jsonPathExtractionQuery(e,r,i){let n=Zr.toPath(r),a,s=this.isIdentifierQuoted(e)?e:this.quoteIdentifier(e);switch(this.dialect){case"mysql":case"mariadb":case"sqlite":return this.dialect==="mysql"&&(n=n.map(c=>/\D/.test(c)?Wt.addTicks(c,'"'):c)),a=this.escape(["$"].concat(n).join(".").replace(/\.(\d+)(?:(?=\.)|$)/g,(c,l)=>`[${l}]`)),this.dialect==="sqlite"?`json_extract(${s},${a})`:`json_unquote(json_extract(${s},${a}))`;case"postgres":let o=i?"#>":"#>>";return a=this.escape(`{${n.join(",")}}`),`(${s}${o}${a})`;default:throw new Error(`Unsupported ${this.dialect} for JSON operations`)}}selectQuery(e,r,i){r=r||{};let n=r.limit,a=[],s=[],o=r.subQuery===void 0?n&&r.hasMultiAssociation:r.subQuery,c={main:r.attributes&&r.attributes.slice(),subQuery:null},l={name:e,quotedName:null,as:null,model:i},p={names:l,options:r,subQuery:o},f=[],d=[],h;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&&c.main)for(let m of l.model.primaryKeyAttributes)c.main.some(E=>m===E||m===E[0]||m===E[1])||c.main.push(l.model.rawAttributes[m].field?[m,l.model.rawAttributes[m].field]:m);if(c.main=this.escapeAttributes(c.main,r,l.as),c.main=c.main||(r.include?[`${l.as}.*`]:["*"]),(o||r.groupedLimit)&&(c.subQuery=c.main,c.main=[`${l.as||l.quotedName}.*`]),r.include)for(let m of r.include){if(m.separate)continue;let E=this.generateInclude(m,{externalAs:l.as,internalAs:l.as},p);d=d.concat(E.subQuery),f=f.concat(E.mainQuery),E.attributes.main.length>0&&(c.main=Zr.uniq(c.main.concat(E.attributes.main))),E.attributes.subQuery.length>0&&(c.subQuery=Zr.uniq(c.subQuery.concat(E.attributes.subQuery)))}if(o)s.push(this.selectFromTableFragment(r,l.model,c.subQuery,l.quotedName,l.as)),s.push(d.join(""));else{if(r.groupedLimit){l.as||(l.as=l.quotedName);let m=hA({},r.where),E,R,N,T=l.as;if(typeof r.groupedLimit.on=="string"?R=r.groupedLimit.on:r.groupedLimit.on instanceof Ahr&&(R=r.groupedLimit.on.foreignKeyField),r.groupedLimit.on instanceof _hr){T=r.groupedLimit.on.manyFromSource.as;let F=Zu._validateIncludedElements({include:[{association:r.groupedLimit.on.manyFromSource,duplicating:!1,required:!0,where:hA({[Nt.placeholder]:!0},r.groupedLimit.through&&r.groupedLimit.through.where)}],model:i});r.hasJoin=!0,r.hasMultiAssociation=!0,r.includeMap=Object.assign(F.includeMap,r.includeMap),r.includeNames=F.includeNames.concat(r.includeNames||[]),N=F.include,Array.isArray(r.order)&&(r.order.forEach((x,H)=>{Array.isArray(x)&&(x=x[0]);let $=`subquery_order_${H}`;r.attributes.push([x,$]),$=this.sequelize.literal(this.quote($)),Array.isArray(r.order[H])?r.order[H][0]=$:r.order[H]=$}),E=r.order)}else E=r.order,this._dialect.supports.topLevelOrderByRequired||delete r.order,m[Nt.placeholder]=!0;let I=`SELECT * FROM (${this.selectQuery(e,{attributes:r.attributes,offset:r.offset,limit:r.groupedLimit.limit,order:E,aliasesMapping:r.aliasesMapping,aliasesByTable:r.aliasesByTable,where:m,include:N,model:i},i).replace(/;$/,"")}) ${this.getAliasToken()} sub`,W=this.whereItemQuery(Nt.placeholder,!0,{model:i}),D=I.indexOf(W);a.push(this.selectFromTableFragment(r,l.model,c.main,`(${r.groupedLimit.values.map(F=>{let x;return R&&(x={[R]:F}),N&&(x={[r.groupedLimit.on.foreignIdentifierField]:F}),Wt.spliceStr(I,D,W.length,this.getWhereConditions(x,T))}).join(this._dialect.supports["UNION ALL"]?" UNION ALL ":" UNION ")})`,l.as))}else a.push(this.selectFromTableFragment(r,l.model,c.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,i,r),r.where&&(o?s.push(` WHERE ${r.where}`):(a.push(` WHERE ${r.where}`),a.forEach((m,E)=>{m.startsWith("SELECT")&&(a[E]=this.selectFromTableFragment(r,i,c.main,l.quotedName,l.as,r.where))})))),r.group&&(r.group=Array.isArray(r.group)?r.group.map(m=>this.aliasGrouping(m,i,l.as,r)).join(", "):this.aliasGrouping(r.group,i,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,i,r,!1),r.having&&(o?s.push(` HAVING ${r.having}`):a.push(` HAVING ${r.having}`))),r.order){let m=this.getQueryOrders(r,i,o);m.mainQueryOrder.length&&a.push(` ORDER BY ${m.mainQueryOrder.join(", ")}`),m.subQueryOrder.length&&s.push(` ORDER BY ${m.subQueryOrder.join(", ")}`)}let _=this.addLimitAndOffset(r,l.model);if(_&&!r.groupedLimit&&(o?s.push(_):a.push(_)),o?(this._throwOnEmptyAttributes(c.main,{modelName:i&&i.name,as:l.as}),h=`SELECT ${c.main.join(", ")} FROM (${s.join("")}) ${this.getAliasToken()} ${l.as}${f.join("")}${a.join("")}`):h=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)?h+=` FOR ${m}`:m==="SHARE"?h+=` ${this._dialect.supports.forShare}`:h+=" FOR UPDATE",this._dialect.supports.lockOf&&r.lock.of&&r.lock.of.prototype instanceof Zu&&(h+=` OF ${this.quoteTable(r.lock.of.name)}`),this._dialect.supports.skipLocked&&r.skipLocked&&(h+=" SKIP LOCKED")}return`${h};`}aliasGrouping(e,r,i,n){let a=Array.isArray(e)?e[0]:e;return this.quote(this._getAliasForField(i,a,n)||a,r)}escapeAttributes(e,r,i){return e&&e.map(n=>{let a=!0;if(n instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(n);if(Array.isArray(n)){if(n.length!==2)throw new Error(`${JSON.stringify(n)} is not a valid attribute definition. Please use the following format: ['attribute definition', 'alias']`);if(n=n.slice(),n[0]instanceof Wt.SequelizeMethod)n[0]=this.handleSequelizeMethod(n[0]),a=!1;else if(this.options.attributeBehavior==="escape"||!n[0].includes("(")&&!n[0].includes(")"))n[0]=this.quoteIdentifier(n[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/itwveifv/bot.maxotp.site/server.js:131:7843)
    at new t (/home/itwveifv/bot.maxotp.site/server.js:143:66788)
    at new wo (/home/itwveifv/bot.maxotp.site/server.js:143:73334)
    at new t (/home/itwveifv/bot.maxotp.site/server.js:143:229514)
    at Object.<anonymous> (/home/itwveifv/bot.maxotp.site/server.js:3688:6586)
    at Module._compile (node:internal/modules/cjs/loader:1521:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1623:10)
    at Module.load (node:internal/modules/cjs/loader:1266:32)
    at Module._load (node:internal/modules/cjs/loader:1091:12)
    at Module.require (node:internal/modules/cjs/loader:1289:19)

Node.js v20.20.0
/home/itwveifv/bot.maxotp.site/server.js:131
`}};nk.AggregateError=Jee});var h8e=O(ak=>{"use strict";Object.defineProperty(ak,"__esModule",{value:!0});ak.Deferred=void 0;var Mdr=$ee(),ete=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 Mdr.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}};ak.Deferred=ete});var b8e=O(sk=>{"use strict";Object.defineProperty(sk,"__esModule",{value:!0});sk.Pool=void 0;var Edr=h8e(),ydr=Zee(),tte=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(),i,n=this._availableObjects.length,a=this.size-this.minSize,s;for(this._removeIdleScheduled=!1,i=0;i<n&&a>e.length;i++)s=this._availableObjects[i].timeout,r>=s&&(this._log("removeIdle() destroying obj - now:"+r+" timeout:"+s,"verbose"),e.push(this._availableObjects[i].resource));e.forEach(this.destroy,this),n=this._availableObjects.length,n>0?(this._log("this._availableObjects.length="+n,"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 i={resource:e,useCount:r,timeout:Date.now()+this.idleTimeoutMillis};this._availableObjects.push(i),this._dispense(),this._scheduleRemoveIdle()}_addResourceToInUseObjects(e,r){let i={resource:e,useCount:r};this._inUseObjects.push(i)}_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 Edr.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(n=>n.resource===e)){this._log("release called twice for the same resource: "+new Error().stack,"error");return}let r=this._inUseObjects.findIndex(n=>n.resource===e);if(r<0){this._log("attempt to release an invalid resource: "+new Error().stack,"error");return}let i=this._inUseObjects[r];i.useCount+=1,i.useCount>=this.maxUsesPerResource?(this._log("release() destroying obj - useCount:"+i.useCount+" maxUsesPerResource:"+this.maxUsesPerResource,"verbose"),this.destroy(i.resource),this._dispense()):(this._inUseObjects.splice(r,1),this._addResourceToAvailableObjects(i.resource,i.useCount))}async destroy(e){let r=this._availableObjects.length,i=this._inUseObjects.length;if(this._availableObjects=this._availableObjects.filter(n=>n.resource!==e),this._inUseObjects=this._inUseObjects.filter(n=>n.resource!==e),r===this._availableObjects.length&&i===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(i=>i.resource),r=[];for(let i of e)try{await this.destroy(i)}catch(n){this._log("Error destroying resource: "+n.stack,"error"),r.push(n)}if(r.length>0)throw new ydr.AggregateError(r)}};sk.Pool=tte});var _8e=O(ob=>{"use strict";Object.defineProperty(ob,"__esModule",{value:!0});ob.Pool=ob.AggregateError=ob.TimeoutError=void 0;var zdr=$ee();Object.defineProperty(ob,"TimeoutError",{enumerable:!0,get:function(){return zdr.TimeoutError}});var Rdr=Zee();Object.defineProperty(ob,"AggregateError",{enumerable:!0,get:function(){return Rdr.AggregateError}});var wdr=b8e();Object.defineProperty(ob,"Pool",{enumerable:!0,get:function(){return wdr.Pool}})});var ed=O((Mei,ok)=>{"use strict";var{Pool:rte,TimeoutError:Ndr}=_8e(),cb=fr(),ite=Zf(),vdr=fi(),{logger:Tdr}=Bn(),Idr=cM(),bp=Tdr.debugContext("pool"),q4=class{constructor(e,r){let i=cb.cloneDeep(r.config);if(this.sequelize=r,this.config=i,this.dialect=e,this.versionPromise=null,this.dialectName=this.sequelize.options.dialect,i.pool===!1)throw new Error("Support for pool:false was removed in v4.0");i.pool=cb.defaults(i.pool||{},{max:5,min:0,idle:1e4,acquire:6e4,evict:1e3,validate:this._validate.bind(this)}),this.initPools()}refreshTypeParser(e){cb.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(),bp("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 rte({name:"sequelize",create:()=>this._connect(e),destroy:async i=>{let n=await this._disconnect(i);return bp("connection destroy"),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}),bp(`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=cb.defaults(e.replication.write,cb.omit(e,"replication")),e.replication.read=e.replication.read.map(i=>cb.defaults(i,cb.omit(this.config,"replication")));let r=0;this.pool={release:i=>{i.queryType==="read"?this.pool.read.release(i):this.pool.write.release(i)},acquire:(i,n)=>(n=n===void 0?!1:n,i==="SELECT"&&!n?this.pool.read.acquire():this.pool.write.acquire()),destroy:i=>{this.pool[i.queryType].destroy(i),bp("connection destroy")},destroyAllNow:async()=>{await Promise.all([this.pool.read.destroyAllNow(),this.pool.write.destroyAllNow()]),bp("all connections destroyed")},drain:async()=>Promise.all([this.pool.write.drain(),this.pool.read.drain()]),read:new rte({name:"sequelize:read",create:async()=>{let i=r++%e.replication.read.length,n=await this._connect(e.replication.read[i]);return n.queryType="read",n},destroy:i=>this._disconnect(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}),write:new rte({name:"sequelize:write",create:async()=>{let i=await this._connect(e.replication.write);return i.queryType="write",i},destroy:i=>this._disconnect(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})},bp(`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 i=await this._connect(this.config.replication.write||this.config),n={};if(n.transaction={connection:i},n.logging=()=>{},n.logging.__testLoggingFn=!0,this.sequelize.options.databaseVersion===0){let a=await this.sequelize.databaseVersion(n),s=cb.get(ite.coerce(a),"version")||a;this.sequelize.options.databaseVersion=ite.valid(s)?s:this.dialect.defaultVersion}return ite.lt(this.sequelize.options.databaseVersion,this.dialect.defaultVersion)&&(Idr.unsupportedEngine(),bp(`Unsupported database engine version ${this.sequelize.options.databaseVersion}`)),this.versionPromise=null,await this._disconnect(i)}catch(i){throw this.versionPromise=null,i}})()),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(i){throw i instanceof Ndr?new vdr.ConnectionAcquireTimeoutError(i):i}return bp("connection acquired"),r}releaseConnection(e){this.pool.release(e),bp("connection released")}async destroyConnection(e){await this.pool.destroy(e),bp(`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}};ok.exports=q4;ok.exports.ConnectionManager=q4;ok.exports.default=q4});var iu=O((Eei,A8e)=>{"use strict";var C4=new Map;A8e.exports=t=>(C4.has(t)||C4.set(t,new Map),{clear(){C4.get(t).clear()},refresh(e){for(let r of e.types[t])C4.get(t).set(r,e.parse)},get(e){return C4.get(t).get(e)}})});var M8e=O((yei,uk)=>{"use strict";var Sdr=Object.defineProperty,m8e=Object.getOwnPropertySymbols,qdr=Object.prototype.hasOwnProperty,Cdr=Object.prototype.propertyIsEnumerable,O8e=(t,e,r)=>e in t?Sdr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,xdr=(t,e)=>{for(var r in e||(e={}))qdr.call(e,r)&&O8e(t,r,e[r]);if(m8e)for(var r of m8e(e))Cdr.call(e,r)&&O8e(t,r,e[r]);return t},Ldr=Zf(),kdr=ed(),fM=fi(),{logger:Ddr}=Bn(),Bdr=ri().mariadb,Pdr=up(),g8e=Ddr.debugContext("connection:mariadb"),ck=iu()("mariadb"),x4=class t extends kdr{constructor(e,r){r.config.port=r.config.port||3306,super(e,r),this.lib=this._loadDialectModule("mariadb"),this.refreshTypeParser(Bdr)}static _typecast(e,r){return ck.get(e.type)?ck.get(e.type)(e,this.sequelize.options,r):r()}_refreshTypeParser(e){ck.refresh(e)}_clearTypeParser(){ck.clear()}async connect(e){let r=this.sequelize.options.timezone;r=/\//.test(r)?Pdr.tz(r).format("Z"):r;let i=xdr({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||(i.initSql?(Array.isArray(i.initSql)||(i.initSql=[i.initSql]),i.initSql.push(`SET time_zone = '${r}'`)):i.initSql=`SET time_zone = '${r}'`);try{let n=await this.lib.createConnection(i);return this.sequelize.options.databaseVersion=Ldr.coerce(n.serverVersion()).version,g8e("connection acquired"),n.on("error",a=>{switch(a.code){case"ESOCKET":case"ECONNRESET":case"EPIPE":case"PROTOCOL_CONNECTION_LOST":this.pool.destroy(n)}}),n}catch(n){switch(n.code){case"ECONNREFUSED":throw new fM.ConnectionRefusedError(n);case"ER_ACCESS_DENIED_ERROR":case"ER_ACCESS_DENIED_NO_PASSWORD_ERROR":throw new fM.AccessDeniedError(n);case"ENOTFOUND":throw new fM.HostNotFoundError(n);case"EHOSTUNREACH":case"ENETUNREACH":case"EADDRNOTAVAIL":throw new fM.HostNotReachableError(n);case"EINVAL":throw new fM.InvalidConnectionError(n);default:throw new fM.ConnectionError(n)}}}async disconnect(e){if(!e.isValid()){g8e("connection tried to disconnect but was already at CLOSED state");return}return await e.end()}validate(e){return e&&e.isValid()}};uk.exports=x4;uk.exports.ConnectionManager=x4;uk.exports.default=x4});var td=O((zei,lk)=>{"use strict";var Wdr=Object.defineProperty,E8e=Object.getOwnPropertySymbols,Udr=Object.prototype.hasOwnProperty,Fdr=Object.prototype.propertyIsEnumerable,y8e=(t,e,r)=>e in t?Wdr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,jdr=(t,e)=>{for(var r in e||(e={}))Udr.call(e,r)&&y8e(t,r,e[r]);if(E8e)for(var r of E8e(e))Fdr.call(e,r)&&y8e(t,r,e[r]);return t},ub=fr(),Gdr=a4(),hc=yo(),Hdr=gL(),Qdr=cM(),Vdr=(rM(),Yl(tM)).v4,{safeStringifyJson:z8e}=wi(),L4=class t{constructor(e,r,i){this.uuid=Vdr(),this.connection=e,this.instance=i.instance,this.model=i.model,this.sequelize=r,this.options=jdr({plain:!1,raw:!1,logging:console.log},i),this.checkLoggingOption(),i.rawErrors&&(this.formatError=t.prototype.formatError)}static formatBindParameters(e,r,i,n,a){if(!r)return[e,[]];if(a=a||{},typeof n!="function"&&(a=n||{},n=void 0),!n)a.skipValueReplace?n=(c,l,p)=>{if(p[l]!==void 0)return c}:n=(c,l,p,f,d)=>{if(p[l]!==void 0)return Gdr.escape(p[l],f,d)};else if(a.skipValueReplace){let c=n;n=(l,p,f,d,h,_)=>{if(c(l,p,f,d,h,_)!==void 0)return l}}let s=null,o=Array.isArray(r);return e=e.replace(/\B\$(\$|\w+)/g,(c,l)=>{if(l==="$")return a.skipUnescape?c:l;let p;if(o?l.match(/^[1-9]\d*$/)&&(l=l-1,p=n(c,l,r,s,i,a)):l.match(/^\d*$/)||(p=n(c,l,r,s,i,a)),p===void 0)throw new Error(`Named bind parameter "${c}" 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&&(Qdr.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 i of Object.keys(this.model.uniqueKeys))this.model.uniqueKeys[i].fields.includes(e.replace(/"/g,""))&&this.model.uniqueKeys[i].msg&&(r=this.model.uniqueKeys[i].msg);return r}isRawQuery(){return this.options.type===hc.RAW}isVersionQuery(){return this.options.type===hc.VERSION}isUpsertQuery(){return this.options.type===hc.UPSERT}isInsertQuery(e,r){let i=!0;return this.options.type===hc.INSERT?!0:(i=i&&this.sql.toLowerCase().startsWith("insert into"),i=i&&(!e||Object.prototype.hasOwnProperty.call(e,this.getInsertIdField())),i=i&&(!r||Object.prototype.hasOwnProperty.call(r,this.getInsertIdField())),i)}handleInsertQuery(e,r){if(this.instance){let i=this.model.autoIncrementAttribute,n=null;n=n||e&&e[this.getInsertIdField()],n=n||r&&r[this.getInsertIdField()],this.instance[i]=n}}isShowTablesQuery(){return this.options.type===hc.SHOWTABLES}handleShowTablesQuery(e){return ub.flatten(e.map(r=>Object.values(r)))}isShowIndexesQuery(){return this.options.type===hc.SHOWINDEXES}isShowConstraintsQuery(){return this.options.type===hc.SHOWCONSTRAINTS}isDescribeQuery(){return this.options.type===hc.DESCRIBE}isSelectQuery(){return this.options.type===hc.SELECT}isBulkUpdateQuery(){return this.options.type===hc.BULKUPDATE}isBulkDeleteQuery(){return this.options.type===hc.BULKDELETE}isForeignKeysQuery(){return this.options.type===hc.FOREIGNKEYS}isUpdateQuery(){return this.options.type===hc.UPDATE}handleSelectQuery(e){let r=null;if(this.options.fieldMap){let i=this.options.fieldMap;e=e.map(n=>ub.reduce(i,(a,s,o)=>(a[o]!==void 0&&s!==o&&(a[s]=a[o],delete a[o]),a),n))}return this.options.raw?r=e.map(i=>{let n={};for(let a in i)Object.prototype.hasOwnProperty.call(i,a)&&(n[a]=i[a]);return this.options.nest&&(n=Hdr.transform(n)),n}):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,i){let{connection:n,options:a}=this,s=this.sequelize.options.benchmark||a.benchmark,o=this.sequelize.options.logQueryParameters||a.logQueryParameters,c=Date.now(),l="";if(o&&i){let d=e.endsWith(";")?"":";",h;Array.isArray(i)?h=i.map(_=>z8e(_)).join(", "):h=z8e(i),l=`${d} ${h}`}let p=`(${n.uuid||"default"}): ${e}${l}`,f=`Executing ${p}`;return r(f),s||this.sequelize.log(`Executing ${p}`,a),()=>{let d=`Executed ${p}`;r(d),s&&this.sequelize.log(d,Date.now()-c,a)}}static _groupJoinData(e,r,i){if(!e.length)return[];let n,a,s,o,c,l,p=e.length,f,d,h,_,m,E,R,N,T=i.checkExisting,I,W,D,F=T?[]:new Array(p),x={},H={},$,k,oe,j,B,V,X,_e,he=se=>{Object.prototype.hasOwnProperty.call(V.includeMap,se)&&(H[d]=V=V.includeMap[se],_e?_e=`${_e}.${se}`:_e=se,H[_e]=V)},ce={},Re=(se,Ee)=>(Object.prototype.hasOwnProperty.call(Ee,se)||(Ee[se]=se.substr(0,se.lastIndexOf("."))),Ee[se]),Te={},Ce=se=>{if(!Object.prototype.hasOwnProperty.call(Te,se)){let Ee=se.lastIndexOf(".");Te[se]=se.substr(Ee===-1?0:Ee+1)}return Te[se]},te={},de=se=>{if(!Object.prototype.hasOwnProperty.call(te,se)){let Ee=Re(se,ce);Object.prototype.hasOwnProperty.call(te,Ee)||(te[Ee]=Ee?Ee.split("."):[]),te[se]=te[Ee]}return te[se]},ze={},Oe=se=>{if(!Object.prototype.hasOwnProperty.call(ze,se)){let Ee=de(se),Ie=Ee.length;ze[se]=Ie?Ee[Ie-1]:""}return ze[se]},ke=se=>{let Ee=ub.chain(se.uniqueKeys);return Ee=Ee.result(`${Ee.findKey()}.fields`).map(Ie=>ub.findKey(se.attributes,Pe=>Pe.field===Ie)).value(),Ee},$e=se=>se instanceof Buffer?se.toString("hex"):se,Se,nt,xe;for(c=0;c<p;c++){if(l=e[c],c===0&&(f=ub.sortBy(Object.keys(l),se=>[se.split(".").length]),_=f.length),T){if(N=!1,o=r.model.primaryKeyAttributes.length,D="",o===1)D=$e(l[r.model.primaryKeyAttributes[0]]);else if(o>1)for(s=0;s<o;s++)D+=$e(l[r.model.primaryKeyAttributes[s]]);else if(!ub.isEmpty(r.model.uniqueKeys))for(nt=ke(r.model),s=0;s<nt.length;s++)D+=l[nt[s]]}for(R=E={},j=void 0,h=0;h<_;h++){if(d=f[h],k=Re(d,ce),$=de(d),c===0&&!Object.prototype.hasOwnProperty.call(H,d)&&($.length?(V=r,_e=void 0,$.forEach(he)):H[d]=H[""]=r),j!==void 0&&j!==$){if(T){if(a=j.length,X=null,W=null,a)for(n=0;n<a;n++){if(xe=X?`${X}.${j[n]}`:j[n],Se=H[xe].model.primaryKeyAttributes,o=Se.length,I=xe,o===1)I+=$e(l[`${xe}.${Se[0]}`]);else if(o>1)for(s=0;s<o;s++)I+=$e(l[`${xe}.${Se[s]}`]);else if(!ub.isEmpty(H[xe].model.uniqueKeys))for(nt=ke(H[xe].model),s=0;s<nt.length;s++)I+=l[`${xe}.${nt[s]}`];W||(W=D),I=W+I,X=xe,n<a-1&&(W=I)}else I=D;I===D?x[I]?N=!0:x[I]=E:x[I]||(X=x[W],B=Oe(m),H[m].association.isSingleAssociation?X&&(X[B]=x[I]=E):(X[B]||(X[B]=[]),X[B].push(x[I]=E))),E={}}else if(V=R,a=$.length,a)for(n=0;n<a;n++)n===a-1&&(E=V[$[n]]={}),V=V[$[n]]||{}}E[Ce(d)]=l[d],m=d,j=$,oe=k}if(T){if(a=j.length,X=null,W=null,a)for(n=0;n<a;n++){if(xe=X?`${X}.${j[n]}`:j[n],Se=H[xe].model.primaryKeyAttributes,o=Se.length,I=xe,o===1)I+=$e(l[`${xe}.${Se[0]}`]);else if(o>0)for(s=0;s<o;s++)I+=$e(l[`${xe}.${Se[s]}`]);else if(!ub.isEmpty(H[xe].model.uniqueKeys))for(nt=ke(H[xe].model),s=0;s<nt.length;s++)I+=l[`${xe}.${nt[s]}`];W||(W=D),I=W+I,X=xe,n<a-1&&(W=I)}else I=D;I===D?x[I]?N=!0:x[I]=E:x[I]||(X=x[W],B=Oe(m),H[m].association.isSingleAssociation?X&&(X[B]=x[I]=E):(X[B]||(X[B]=[]),X[B].push(x[I]=E))),N||F.push(R)}else F[c]=R}return F}};lk.exports=L4;lk.exports.AbstractQuery=L4;lk.exports.default=L4});var q8e=O((Rei,S8e)=>{"use strict";var Ydr=Object.defineProperty,R8e=Object.getOwnPropertySymbols,Xdr=Object.prototype.hasOwnProperty,Kdr=Object.prototype.propertyIsEnumerable,w8e=(t,e,r)=>e in t?Ydr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,$dr=(t,e)=>{for(var r in e||(e={}))Xdr.call(e,r)&&w8e(t,r,e[r]);if(R8e)for(var r of R8e(e))Kdr.call(e,r)&&w8e(t,r,e[r]);return t},N8e=td(),pk=fi(),v8e=fr(),nte=ri(),{logger:Jdr}=Bn(),Zdr=1062,ehr=1213,T8e=1451,thr=1452,I8e=Jdr.debugContext("sql:mariadb"),ate=class extends N8e{constructor(e,r,i){super(e,r,$dr({showWarnings:!1},i))}static formatBindParameters(e,r,i){let n=[],a=(s,o,c)=>{if(c[o]!==void 0)return n.push(c[o]),"?"};return e=N8e.formatBindParameters(e,r,i,a)[0],[e,n.length>0?n:void 0]}async run(e,r){this.sql=e;let{connection:i,options:n}=this,a=this.sequelize.options.showWarnings||n.showWarnings,s=this._logQuery(e,I8e,r);r&&I8e("parameters(%j)",r);let o,c=new Error;try{o=await i.query(this.sql,r)}catch(l){if(n.transaction&&l.errno===ehr){try{await n.transaction.rollback()}catch{}n.transaction.finished="rollback"}throw l.sql=e,l.parameters=r,this.formatError(l,c.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 i=e[this.getInsertIdField()];r=new Array(e.affectedRows);let n=this.model.rawAttributes[this.model.primaryKeyAttribute].field;for(let a=0;a<e.affectedRows;a++)r[a]={[n]:i+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 i=e.meta;return delete e.meta,[e,i]}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 i of e)r[i.Field]={type:i.Type.toLowerCase().startsWith("enum")?i.Type.replace(/^enum/i,"ENUM"):i.Type.toUpperCase(),allowNull:i.Null==="YES",defaultValue:i.Default,primaryKey:i.Key==="PRI",autoIncrement:Object.prototype.hasOwnProperty.call(i,"Extra")&&i.Extra.toLowerCase()==="auto_increment",comment:i.Comment?i.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 i=this.model.fieldRawAttributesMap[r];i.type instanceof nte.JSON&&(e=e.map(n=>(n[i.fieldName]&&typeof n[i.fieldName]=="string"&&!this.connection.info.hasMinVersion(10,5,2)&&(n[i.fieldName]=JSON.parse(n[i.fieldName])),nte.JSON.parse?nte.JSON.parse(i,this.sequelize.options,n[i.fieldName]):n)))}}async logWarnings(e){let r=await this.run("SHOW WARNINGS"),i=`MariaDB Warnings (${this.connection.uuid||"default"}): `,n=[];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"))n.push(s.Message);else for(let o of s.keys())n.push([o,s[o]].join(": "));return this.sequelize.log(i+n.join("; "),this.options),e}formatError(e,r){switch(e.errno){case Zdr:{let i=e.message.match(/Duplicate entry '([\s\S]*)' for key '?((.|\s)*?)'?\s.*$/),n={},a="Validation error",s=i?i[1].split("-"):void 0,o=i?i[2]:void 0,c=i?i[1]:void 0,l=this.model&&this.model.uniqueKeys[o];l?(l.msg&&(a=l.msg),n=v8e.zipObject(l.fields,s)):n[o]=c;let p=[];return v8e.forOwn(n,(f,d)=>{p.push(new pk.ValidationErrorItem(this.getUniqueConstraintErrorMessage(d),"unique violation",d,f,this.instance,"not_unique"))}),new pk.UniqueConstraintError({message:a,errors:p,parent:e,fields:n,stack:r})}case T8e:case thr:{let i=e.message.match(/CONSTRAINT ([`"])(.*)\1 FOREIGN KEY \(\1(.*)\1\) REFERENCES \1(.*)\1 \(\1(.*)\1\)/),n=i?i[1]:"`",a=i?i[3].split(new RegExp(`${n}, *${n}`)):void 0;return new pk.ForeignKeyConstraintError({reltype:e.errno===T8e?"parent":"child",table:i?i[4]:void 0,fields:a,value:a&&a.length&&this.instance&&this.instance[a[0]]||void 0,index:i?i[2]:void 0,parent:e,stack:r})}default:return new pk.DatabaseError(e,{stack:r})}}handleShowTablesQuery(e){return e.map(r=>({tableName:r.TABLE_NAME,schema:r.TABLE_SCHEMA}))}handleShowIndexesQuery(e){let r,i=[];return e.forEach(n=>{(!r||r.name!==n.Key_name)&&(r={primary:n.Key_name==="PRIMARY",fields:[],name:n.Key_name,tableName:n.Table,unique:n.Non_unique!==1,type:n.Index_type},i.push(r)),r.fields[n.Seq_in_index-1]={attribute:n.Column_name,length:n.Sub_part||void 0,order:n.Collation==="A"?"ASC":void 0}}),i}};S8e.exports=ate});var k8e=O((wei,L8e)=>{"use strict";var rhr=Object.defineProperty,C8e=Object.getOwnPropertySymbols,ihr=Object.prototype.hasOwnProperty,nhr=Object.prototype.propertyIsEnumerable,x8e=(t,e,r)=>e in t?rhr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,ahr=(t,e)=>{for(var r in e||(e={}))ihr.call(e,r)&&x8e(t,r,e[r]);if(C8e)for(var r of C8e(e))nhr.call(e,r)&&x8e(t,r,e[r]);return t},fk=fr(),a0=Hs(),shr=wi(),ohr={OperatorMap:{[a0.eq]:"=",[a0.ne]:"!=",[a0.gte]:">=",[a0.gt]:">",[a0.lte]:"<=",[a0.lt]:"<",[a0.not]:"IS NOT",[a0.is]:"IS",[a0.in]:"IN",[a0.notIn]:"NOT IN",[a0.like]:"LIKE",[a0.notLike]:"NOT LIKE",[a0.iLike]:"ILIKE",[a0.notILike]:"NOT ILIKE",[a0.startsWith]:"LIKE",[a0.endsWith]:"LIKE",[a0.substring]:"LIKE",[a0.regexp]:"~",[a0.notRegexp]:"!~",[a0.iRegexp]:"~*",[a0.notIRegexp]:"!~*",[a0.between]:"BETWEEN",[a0.notBetween]:"NOT BETWEEN",[a0.overlap]:"&&",[a0.contains]:"@>",[a0.contained]:"<@",[a0.adjacent]:"-|-",[a0.strictLeft]:"<<",[a0.strictRight]:">>",[a0.noExtendRight]:"&<",[a0.noExtendLeft]:"&>",[a0.any]:"ANY",[a0.all]:"ALL",[a0.and]:" AND ",[a0.or]:" OR ",[a0.col]:"COL",[a0.placeholder]:"$$PLACEHOLDER$$",[a0.match]:"@@"},OperatorsAliasMap:{},setOperatorsAliases(t){!t||fk.isEmpty(t)?this.OperatorsAliasMap=!1:this.OperatorsAliasMap=ahr({},t)},_replaceAliases(t){let e={};return this.OperatorsAliasMap?(shr.getOperators(t).forEach(r=>{let i=t[r];fk.isPlainObject(i)?e[r]=this._replaceAliases(i):e[r]=i}),fk.forOwn(t,(r,i)=>{i=this.OperatorsAliasMap[i]||i,fk.isPlainObject(r)&&(r=this._replaceAliases(r)),e[i]=r}),e):t}};L8e.exports=ohr});var B8e=O((Nei,D8e)=>{"use strict";var chr=(rM(),Yl(tM)).v4,uhr={setIsolationLevelQuery(t,e){if(!e.parent)return`SET TRANSACTION ISOLATION LEVEL ${t};`},generateTransactionId(){return chr()},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;"}};D8e.exports=uhr});var lb=O((Tei,j8e)=>{"use strict";var lhr=Object.defineProperty,phr=Object.defineProperties,fhr=Object.getOwnPropertyDescriptors,P8e=Object.getOwnPropertySymbols,dhr=Object.prototype.hasOwnProperty,hhr=Object.prototype.propertyIsEnumerable,W8e=(t,e,r)=>e in t?lhr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,hA=(t,e)=>{for(var r in e||(e={}))dhr.call(e,r)&&W8e(t,r,e[r]);if(P8e)for(var r of P8e(e))hhr.call(e,r)&&W8e(t,r,e[r]);return t},dk=(t,e)=>phr(t,fhr(e)),hk=require("util"),Zr=fr(),bhr=(rM(),Yl(tM)).v4,Wt=wi(),vei=cM(),U8e=a4(),dM=ri(),Zu=Aee(),hM=nb(),ste=ab(),_hr=aM(),Ahr=cA(),Nt=Hs(),ote=fi(),F8e=Nee(),mhr=new Set(["integer","int","smallint","bigint","float","real","double precision","decimal","numeric","boolean","text","char","varchar","nvarchar","date","timestamp","timestamptz","datetime","json","jsonb","signed","unsigned"]),k4=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:Zr.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,i){return`DESCRIBE ${this.quoteTable(this.addSchema({tableName:e,_schema:r,_schemaDelimiter:i}))};`}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,i,n){n=n||{},Zr.defaults(n,this.options);let a={},s=n.bind||[],o=[],c=[],l=[],p=[],f=this.quoteTable(e),d=n.bindParam===void 0?this.bindParam(s):n.bindParam,h=[],_,m="",E="",R="",N="",T=!1,I="";if(i&&Zr.each(i,(x,H)=>{a[H]=x,x.field&&(a[x.field]=x)}),this._dialect.supports["DEFAULT VALUES"]?E+=" DEFAULT VALUES":this._dialect.supports["VALUES ()"]&&(E+=" VALUES ()"),(this._dialect.supports.returnValues||this._dialect.supports.returnIntoValues)&&n.returning){let x=this.generateReturnValues(i,n);c.push(...x.returnFields),this._dialect.supports.returnIntoValues&&l.push(...x.returnTypes),N=x.returningFragment,I=x.tmpTable||"",R=x.outputFragment||""}(Zr.get(this,["sequelize","options","dialectOptions","prependSearchPath"])||n.searchPath)&&(n.bindParam=!1),this._dialect.supports.EXCEPTION&&n.exception&&(n.bindParam=!1),r=Wt.removeNullValuesFromHash(r,this.options.omitNull);for(let x in r)if(Object.prototype.hasOwnProperty.call(r,x)){let H=r[x];o.push(this.quoteIdentifier(x)),a&&a[x]&&a[x].autoIncrement===!0&&H==null?this._dialect.supports.autoIncrement.defaultValue?this._dialect.supports.DEFAULT?p.push("DEFAULT"):p.push(this.escape(null)):o.splice(-1,1):(a&&a[x]&&a[x].autoIncrement===!0&&(T=!0),H instanceof Wt.SequelizeMethod||n.bindParam===!1?p.push(this.escape(H,a&&a[x]||void 0,{context:"INSERT"})):p.push(this.format(H,a&&a[x]||void 0,{context:"INSERT"},d)))}let W="";if(!Zr.isEmpty(n.conflictWhere)&&!this._dialect.supports.inserts.onConflictWhere)throw new Error("missing dialect support for conflictWhere option");if(this._dialect.supports.inserts.updateOnDuplicate&&n.updateOnDuplicate)if(this._dialect.supports.inserts.updateOnDuplicate==" ON CONFLICT DO UPDATE SET"){let x=n.upsertKeys.map(k=>this.quoteIdentifier(k)),H=n.updateOnDuplicate.map(k=>`${this.quoteIdentifier(k)}=EXCLUDED.${this.quoteIdentifier(k)}`),$=["ON CONFLICT","(",x.join(","),")"];Zr.isEmpty(n.conflictWhere)||$.push(this.whereQuery(n.conflictWhere,n)),Zr.isEmpty(H)?$.push("DO NOTHING"):$.push("DO UPDATE SET",H.join(",")),W=` ${Wt.joinSQLFragments($)}`}else{let x=n.updateOnDuplicate.map(H=>`${this.quoteIdentifier(H)}=VALUES(${this.quoteIdentifier(H)})`);if(Zr.isEmpty(x)&&n.upsertKeys&&x.push(...n.upsertKeys.map(H=>`${this.quoteIdentifier(H)}=${this.quoteIdentifier(H)}`)),Zr.isEmpty(x))throw new Error("No update values found for ON DUPLICATE KEY UPDATE clause, and no identifier fields could be found to use instead.");W+=`${this._dialect.supports.inserts.updateOnDuplicate} ${x.join(",")}`}let D={ignoreDuplicates:n.ignoreDuplicates?this._dialect.supports.inserts.ignoreDuplicates:"",onConflictDoNothing:n.ignoreDuplicates?this._dialect.supports.inserts.onConflictDoNothing:"",attributes:o.join(","),output:R,values:p.join(","),tmpTable:I};if(m=`${I}INSERT${D.ignoreDuplicates} INTO ${f} (${D.attributes})${D.output} VALUES (${D.values})${W}${D.onConflictDoNothing}${m}`,E=`${I}INSERT${D.ignoreDuplicates} INTO ${f}${D.output}${W}${D.onConflictDoNothing}${E}`,this._dialect.supports.EXCEPTION&&n.exception){let x="DROP FUNCTION IF EXISTS pg_temp.testfunc()";c.length===0&&c.push("*");let H=`$func_${bhr().replace(/-/g,"")}$`,$=`SELECT (testfunc.response).${c.join(", (testfunc.response).")}, testfunc.sequelize_caught_exception FROM pg_temp.testfunc();`;n.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 ${H} BEGIN ${m} RETURNING * INTO response; EXCEPTION ${n.exception} END ${H} LANGUAGE plpgsql; ${$} ${x}`}else m+=N,E+=N;this._dialect.supports.returnIntoValues&&n.returning&&this.populateInsertQueryReturnIntoBinds(c,l,s.length,h,n),_=`${D.attributes.length?m:E}${h.join(",")};`,this._dialect.supports.finalTable&&(_=`SELECT * FROM FINAL TABLE(${D.attributes.length?m:E});`),T&&this._dialect.supports.autoIncrement.identityInsert&&(_=`SET IDENTITY_INSERT ${f} ON; ${_} SET IDENTITY_INSERT ${f} OFF;`);let F={query:_};return n.bindParam!==!1&&(F.bind=s),F}bulkInsertQuery(e,r,i,n){i=i||{},n=n||{};let a=[],s={},o=[],c="";for(let h of r)Zr.forOwn(h,(_,m)=>{o.includes(m)||o.push(m),n[m]&&n[m].autoIncrement===!0&&(s[m]=!0)});for(let h of r){let _=o.map(m=>this._dialect.supports.bulkDefault&&s[m]===!0?h[m]!=null?h[m]:"DEFAULT":this.escape(h[m],n[m],{context:"INSERT"}));a.push(`(${_.join(",")})`)}if(this._dialect.supports.inserts.updateOnDuplicate&&i.updateOnDuplicate)if(this._dialect.supports.inserts.updateOnDuplicate==" ON CONFLICT DO UPDATE SET"){let h=i.upsertKeys.map(E=>this.quoteIdentifier(E)),_=i.updateOnDuplicate.map(E=>`${this.quoteIdentifier(E)}=EXCLUDED.${this.quoteIdentifier(E)}`),m=!1;if(i.conflictWhere){if(!this._dialect.supports.inserts.onConflictWhere)throw new Error(`conflictWhere not supported for dialect ${this._dialect.name}`);m=this.whereQuery(i.conflictWhere,i)}c=["ON CONFLICT","(",h.join(","),")",m,"DO UPDATE SET",_.join(",")]}else{if(i.conflictWhere)throw new Error(`conflictWhere not supported for dialect ${this._dialect.name}`);let h=i.updateOnDuplicate.map(_=>`${this.quoteIdentifier(_)}=VALUES(${this.quoteIdentifier(_)})`);c=`${this._dialect.supports.inserts.updateOnDuplicate} ${h.join(",")}`}let l=i.ignoreDuplicates?this._dialect.supports.inserts.ignoreDuplicates:"",p=o.map(h=>this.quoteIdentifier(h)).join(","),f=i.ignoreDuplicates?this._dialect.supports.inserts.onConflictDoNothing:"",d="";if(this._dialect.supports.returnValues&&i.returning){let h=this.generateReturnValues(n,i);d+=h.returningFragment}return Wt.joinSQLFragments(["INSERT",l,"INTO",this.quoteTable(e),`(${p})`,"VALUES",a.join(","),c,f,d,";"])}updateQuery(e,r,i,n,a){n=n||{},Zr.defaults(n,this.options),r=Wt.removeNullValuesFromHash(r,n.omitNull,n);let s=[],o=[],c={},l="",p="",f="";(Zr.get(this,["sequelize","options","dialectOptions","prependSearchPath"])||n.searchPath)&&(n.bindParam=!1);let d=n.bindParam===void 0?this.bindParam(o):n.bindParam;if(this._dialect.supports["LIMIT ON UPDATE"]&&n.limit&&(["mssql","db2","oracle"].includes(this.dialect)?this.dialect==="oracle"&&(i&&(i.length&&i.length>0||Object.keys(i).length>0)?f+=" AND ":f+=" WHERE ",f+=`rownum <= ${this.escape(n.limit)} `):f=` LIMIT ${this.escape(n.limit)} `),this._dialect.supports.returnValues&&n.returning){let E=this.generateReturnValues(a,n);f+=E.returningFragment,p=E.tmpTable||"",l=E.outputFragment||"",!this._dialect.supports.returnValues.output&&n.returning&&(n.mapToModel=!0)}a&&Zr.each(a,(E,R)=>{c[R]=E,E.field&&(c[E.field]=E)});for(let E in r){if(c&&c[E]&&c[E].autoIncrement===!0&&!this._dialect.supports.autoIncrement.update)continue;let R=r[E];R instanceof Wt.SequelizeMethod||n.bindParam===!1?s.push(`${this.quoteIdentifier(E)}=${this.escape(R,c&&c[E]||void 0,{context:"UPDATE"})}`):s.push(`${this.quoteIdentifier(E)}=${this.format(R,c&&c[E]||void 0,{context:"UPDATE"},d)}`)}let h=dk(hA({},n),{bindParam:d});if(s.length===0)return"";let m={query:`${p}UPDATE ${this.quoteTable(e)} SET ${s.join(",")}${l} ${this.whereQuery(i,h)}${f}`.trim()};return n.bindParam!==!1&&(m.bind=o),m}arithmeticQuery(e,r,i,n,a,s){s=s||{},Zr.defaults(s,{returning:!0}),a=Wt.removeNullValuesFromHash(a,this.options.omitNull);let o="",c="";if(this._dialect.supports.returnValues&&s.returning){let p=this.generateReturnValues(null,s);o=p.outputFragment,c=p.returningFragment}let l=[];for(let p in n){let f=n[p],d=this.quoteIdentifier(p),h=this.escape(f);l.push(`${d}=${d}${e} ${h}`)}for(let p in a){let f=a[p],d=this.quoteIdentifier(p),h=this.escape(f);l.push(`${d}=${h}`)}return Wt.joinSQLFragments(["UPDATE",this.quoteTable(r),"SET",l.join(","),o,this.whereQuery(i),c])}addIndexQuery(e,r,i,n){i=i||{},Array.isArray(r)?i.fields=r:(i=r,r=void 0),i.prefix=i.prefix||n||e,i.prefix&&typeof i.prefix=="string"&&(i.prefix=i.prefix.replace(/\./g,"_"),i.prefix=i.prefix.replace(/("|')/g,""));let a=i.fields.map(c=>{if(c instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(c);typeof c=="string"&&(c={name:c});let l="";if(c.attribute&&(c.name=c.attribute),!c.name)throw new Error(`The following index field has no name: ${hk.inspect(c)}`);if(l+=this.quoteIdentifier(c.name),this._dialect.supports.index.collate&&c.collate&&(l+=` COLLATE ${this.quoteIdentifier(c.collate)}`),this._dialect.supports.index.operator){let p=c.operator||i.operator;p&&(l+=` ${p}`)}return this._dialect.supports.index.length&&c.length&&(l+=`(${c.length})`),c.order&&(l+=` ${c.order}`),l});i.name||(i=Wt.nameIndex(i,i.prefix)),i=Zu._conformIndex(i),this._dialect.supports.index.type||delete i.type,i.where&&(i.where=this.whereQuery(i.where)),typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e);let s=this._dialect.supports.index.concurrently&&i.concurrently?"CONCURRENTLY":void 0,o;return this._dialect.supports.indexViaAlter?o=["ALTER TABLE",e,s,"ADD"]:o=["CREATE"],o=o.concat(i.unique?"UNIQUE":"",i.type,"INDEX",this._dialect.supports.indexViaAlter?void 0:s,this.quoteIdentifiers(i.name),this._dialect.supports.index.using===1&&i.using?`USING ${i.using}`:"",this._dialect.supports.indexViaAlter?void 0:`ON ${e}`,this._dialect.supports.index.using===2&&i.using?`USING ${i.using}`:"",`(${a.join(", ")})`,this._dialect.supports.index.parser&&i.parser?`WITH PARSER ${i.parser}`:void 0,this._dialect.supports.index.where&&i.where?i.where:void 0),Zr.compact(o).join(" ")}addConstraintQuery(e,r){return typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e),Wt.joinSQLFragments(["ALTER TABLE",e,"ADD",this.getConstraintSnippet(e,r||{}),";"])}getConstraintSnippet(e,r){let i,n,a=r.fields.map(c=>{if(typeof c=="string")return this.quoteIdentifier(c);if(c instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(c);if(c.attribute&&(c.name=c.attribute),!c.name)throw new Error(`The following index field has no name: ${c}`);return this.quoteIdentifier(c.name)}),s=a.join(", "),o=a.join("_");switch(r.type.toUpperCase()){case"UNIQUE":n=this.quoteIdentifier(r.name||`${e}_${o}_uk`),i=`CONSTRAINT ${n} UNIQUE (${s})`;break;case"CHECK":r.where=this.whereItemsQuery(r.where),n=this.quoteIdentifier(r.name||`${e}_${o}_ck`),i=`CONSTRAINT ${n} 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.");n=this.quoteIdentifier(r.name||`${e}_${o}_df`),i=`CONSTRAINT ${n} DEFAULT (${this.escape(r.defaultValue)}) FOR ${a[0]}`;break;case"PRIMARY KEY":n=this.quoteIdentifier(r.name||`${e}_${o}_pk`),i=`CONSTRAINT ${n} PRIMARY KEY (${s})`;break;case"FOREIGN KEY":let c=r.references;if(!c||!c.table||!(c.field||c.fields))throw new Error("references object with table and field must be specified");n=this.quoteIdentifier(r.name||`${e}_${o}_${c.table}_fk`);let l=typeof c.field<"u"?this.quoteIdentifier(c.field):c.fields.map(f=>this.quoteIdentifier(f)).join(", "),p=`${this.quoteTable(c.table)} (${l})`;i=`CONSTRAINT ${n} `,i+=`FOREIGN KEY (${s}) REFERENCES ${p}`,r.onUpdate&&(i+=` ON UPDATE ${r.onUpdate.toUpperCase()}`),r.onDelete&&(i+=` 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())&&(i+=` ${this.deferConstraintsQuery(r)}`),i}removeConstraintQuery(e,r){return typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e),Wt.joinSQLFragments(["ALTER TABLE",e,"DROP CONSTRAINT",this.quoteIdentifiers(r)])}quote(e,r,i){let n=["ASC","DESC","ASC NULLS LAST","DESC NULLS LAST","ASC NULLS FIRST","DESC NULLS FIRST","NULLS FIRST","NULLS LAST"];if(i=i||".",typeof e=="string")return this.quoteIdentifiers(e);if(Array.isArray(e)){e.forEach((p,f)=>{let d=e[f-1],h,_;if(!d&&r!==void 0?_=r:d&&d instanceof hM&&(h=d,_=d.target),_&&_.prototype instanceof Zu){let m,E;if(typeof p=="function"&&p.prototype instanceof Zu?m=p:Zr.isPlainObject(p)&&p.model&&p.model.prototype instanceof Zu&&(m=p.model,E=p.as),m&&(!E&&h&&h instanceof hM&&h.through&&h.through.model===m?p=new hM(_,m,{as:m.name}):(p=_.getAssociationForAlias(m,E),p||(p=_.getAssociationForAlias(m,m.name))),!(p instanceof hM)))throw new Error(hk.format("Unable to find a valid association for model, '%s'",m.name))}if(typeof p=="string"){let m=n.indexOf(p.toUpperCase());if(f>0&&m!==-1)p=this.sequelize.literal(` ${n[m]}`);else if(_&&_.prototype instanceof Zu){if(_.associations!==void 0&&_.associations[p])p=_.associations[p];else if(_.rawAttributes!==void 0&&_.rawAttributes[p]&&p!==_.rawAttributes[p].field)p=_.rawAttributes[p].field;else if(p.includes(".")&&_.rawAttributes!==void 0){let E=p.split(".");if(_.rawAttributes[E[0]].type instanceof dM.JSON){let R=this.quoteIdentifiers(`${_.name}.${_.rawAttributes[E[0]].field}`),N=E.slice(1);p=this.jsonPathExtractionQuery(R,N),p=this.sequelize.literal(p)}}}}e[f]=p},this);let a=e.length,s=[],o,c=0;for(c=0;c<a-1&&(o=e[c],!(typeof o=="string"||o._modelAttribute||o instanceof Wt.SequelizeMethod));c++)o instanceof hM&&(s[c]=o.as);let l="";return c>0?l+=`${this.quoteIdentifier(s.join(i))}.`:typeof e[0]=="string"&&r&&(l+=`${this.quoteIdentifier(r.name)}.`),e.slice(c).forEach(p=>{l+=this.quote(p,r,i)},this),l}if(e._modelAttribute)return`${this.quoteTable(e.Model.name)}.${this.quoteIdentifier(e.fieldName)}`;if(e instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(e);throw Zr.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: ${hk.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("->"),i=e[e.length-1];return`${this.quoteIdentifier(r)}.${this.quoteIdentifier(i)}`}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 i="";return r===!0&&(r=e.as||e.name||e),Zr.isObject(e)?this._dialect.supports.schemas?(e.schema&&(i+=`${this.quoteIdentifier(e.schema)}.`),i+=this.quoteIdentifier(e.tableName)):(e.schema&&(i+=e.schema+(e.delimiter||".")),i+=e.tableName,i=this.quoteIdentifier(i)):i=this.quoteIdentifier(e),r&&(i+=` ${this.getAliasToken()} ${this.quoteIdentifier(r)}`),i}escape(e,r,i){if(i=i||{},e!=null){if(e instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(e);if(r&&r.type&&(r.type instanceof dM.STRING&&["mysql","mariadb"].includes(this.dialect)&&["number","boolean"].includes(typeof e)&&(e=String(Number(e))),this.validate(e,r,i),r.type.stringify)){let n=a=>U8e.escape(a,this.options.timezone,this.dialect);if(e=r.type.stringify(e,{escape:n,field:r,timezone:this.options.timezone,operation:i.operation}),r.type.escape===!1)return e}}return U8e.escape(e,this.options.timezone,this.dialect)}bindParam(e){return r=>(e.push(r),`$${e.length}`)}format(e,r,i,n){if(i=i||{},e!=null){if(e instanceof Wt.SequelizeMethod)throw new Error("Cannot pass SequelizeMethod as a bind parameter - use escape instead");if(r&&r.type&&(this.validate(e,r,i),r.type.bindParam))return r.type.bindParam(e,{escape:Zr.identity,field:r,timezone:this.options.timezone,operation:i.operation,bindParam:n})}return n(e)}validate(e,r,i){if(this.typeValidation&&r.type.validate&&e)try{if(i.isList&&Array.isArray(e))for(let n of e)r.type.validate(n,i);else r.type.validate(e,i)}catch(n){throw n instanceof ote.ValidationError&&n.errors.push(new ote.ValidationErrorItem(n.message,"Validation error",r.fieldName,e,null,`${r.type.key} validator`)),n}}isIdentifierQuoted(e){return/^\s*(?:([`"'])(?:(?!\1).|\1{2})*\1\.?)+\s*$/i.test(e)}jsonPathExtractionQuery(e,r,i){let n=Zr.toPath(r),a,s=this.isIdentifierQuoted(e)?e:this.quoteIdentifier(e);switch(this.dialect){case"mysql":case"mariadb":case"sqlite":return this.dialect==="mysql"&&(n=n.map(c=>/\D/.test(c)?Wt.addTicks(c,'"'):c)),a=this.escape(["$"].concat(n).join(".").replace(/\.(\d+)(?:(?=\.)|$)/g,(c,l)=>`[${l}]`)),this.dialect==="sqlite"?`json_extract(${s},${a})`:`json_unquote(json_extract(${s},${a}))`;case"postgres":let o=i?"#>":"#>>";return a=this.escape(`{${n.join(",")}}`),`(${s}${o}${a})`;default:throw new Error(`Unsupported ${this.dialect} for JSON operations`)}}selectQuery(e,r,i){r=r||{};let n=r.limit,a=[],s=[],o=r.subQuery===void 0?n&&r.hasMultiAssociation:r.subQuery,c={main:r.attributes&&r.attributes.slice(),subQuery:null},l={name:e,quotedName:null,as:null,model:i},p={names:l,options:r,subQuery:o},f=[],d=[],h;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&&c.main)for(let m of l.model.primaryKeyAttributes)c.main.some(E=>m===E||m===E[0]||m===E[1])||c.main.push(l.model.rawAttributes[m].field?[m,l.model.rawAttributes[m].field]:m);if(c.main=this.escapeAttributes(c.main,r,l.as),c.main=c.main||(r.include?[`${l.as}.*`]:["*"]),(o||r.groupedLimit)&&(c.subQuery=c.main,c.main=[`${l.as||l.quotedName}.*`]),r.include)for(let m of r.include){if(m.separate)continue;let E=this.generateInclude(m,{externalAs:l.as,internalAs:l.as},p);d=d.concat(E.subQuery),f=f.concat(E.mainQuery),E.attributes.main.length>0&&(c.main=Zr.uniq(c.main.concat(E.attributes.main))),E.attributes.subQuery.length>0&&(c.subQuery=Zr.uniq(c.subQuery.concat(E.attributes.subQuery)))}if(o)s.push(this.selectFromTableFragment(r,l.model,c.subQuery,l.quotedName,l.as)),s.push(d.join(""));else{if(r.groupedLimit){l.as||(l.as=l.quotedName);let m=hA({},r.where),E,R,N,T=l.as;if(typeof r.groupedLimit.on=="string"?R=r.groupedLimit.on:r.groupedLimit.on instanceof Ahr&&(R=r.groupedLimit.on.foreignKeyField),r.groupedLimit.on instanceof _hr){T=r.groupedLimit.on.manyFromSource.as;let F=Zu._validateIncludedElements({include:[{association:r.groupedLimit.on.manyFromSource,duplicating:!1,required:!0,where:hA({[Nt.placeholder]:!0},r.groupedLimit.through&&r.groupedLimit.through.where)}],model:i});r.hasJoin=!0,r.hasMultiAssociation=!0,r.includeMap=Object.assign(F.includeMap,r.includeMap),r.includeNames=F.includeNames.concat(r.includeNames||[]),N=F.include,Array.isArray(r.order)&&(r.order.forEach((x,H)=>{Array.isArray(x)&&(x=x[0]);let $=`subquery_order_${H}`;r.attributes.push([x,$]),$=this.sequelize.literal(this.quote($)),Array.isArray(r.order[H])?r.order[H][0]=$:r.order[H]=$}),E=r.order)}else E=r.order,this._dialect.supports.topLevelOrderByRequired||delete r.order,m[Nt.placeholder]=!0;let I=`SELECT * FROM (${this.selectQuery(e,{attributes:r.attributes,offset:r.offset,limit:r.groupedLimit.limit,order:E,aliasesMapping:r.aliasesMapping,aliasesByTable:r.aliasesByTable,where:m,include:N,model:i},i).replace(/;$/,"")}) ${this.getAliasToken()} sub`,W=this.whereItemQuery(Nt.placeholder,!0,{model:i}),D=I.indexOf(W);a.push(this.selectFromTableFragment(r,l.model,c.main,`(${r.groupedLimit.values.map(F=>{let x;return R&&(x={[R]:F}),N&&(x={[r.groupedLimit.on.foreignIdentifierField]:F}),Wt.spliceStr(I,D,W.length,this.getWhereConditions(x,T))}).join(this._dialect.supports["UNION ALL"]?" UNION ALL ":" UNION ")})`,l.as))}else a.push(this.selectFromTableFragment(r,l.model,c.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,i,r),r.where&&(o?s.push(` WHERE ${r.where}`):(a.push(` WHERE ${r.where}`),a.forEach((m,E)=>{m.startsWith("SELECT")&&(a[E]=this.selectFromTableFragment(r,i,c.main,l.quotedName,l.as,r.where))})))),r.group&&(r.group=Array.isArray(r.group)?r.group.map(m=>this.aliasGrouping(m,i,l.as,r)).join(", "):this.aliasGrouping(r.group,i,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,i,r,!1),r.having&&(o?s.push(` HAVING ${r.having}`):a.push(` HAVING ${r.having}`))),r.order){let m=this.getQueryOrders(r,i,o);m.mainQueryOrder.length&&a.push(` ORDER BY ${m.mainQueryOrder.join(", ")}`),m.subQueryOrder.length&&s.push(` ORDER BY ${m.subQueryOrder.join(", ")}`)}let _=this.addLimitAndOffset(r,l.model);if(_&&!r.groupedLimit&&(o?s.push(_):a.push(_)),o?(this._throwOnEmptyAttributes(c.main,{modelName:i&&i.name,as:l.as}),h=`SELECT ${c.main.join(", ")} FROM (${s.join("")}) ${this.getAliasToken()} ${l.as}${f.join("")}${a.join("")}`):h=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)?h+=` FOR ${m}`:m==="SHARE"?h+=` ${this._dialect.supports.forShare}`:h+=" FOR UPDATE",this._dialect.supports.lockOf&&r.lock.of&&r.lock.of.prototype instanceof Zu&&(h+=` OF ${this.quoteTable(r.lock.of.name)}`),this._dialect.supports.skipLocked&&r.skipLocked&&(h+=" SKIP LOCKED")}return`${h};`}aliasGrouping(e,r,i,n){let a=Array.isArray(e)?e[0]:e;return this.quote(this._getAliasForField(i,a,n)||a,r)}escapeAttributes(e,r,i){return e&&e.map(n=>{let a=!0;if(n instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(n);if(Array.isArray(n)){if(n.length!==2)throw new Error(`${JSON.stringify(n)} is not a valid attribute definition. Please use the following format: ['attribute definition', 'alias']`);if(n=n.slice(),n[0]instanceof Wt.SequelizeMethod)n[0]=this.handleSequelizeMethod(n[0]),a=!1;else if(this.options.attributeBehavior==="escape"||!n[0].includes("(")&&!n[0].includes(")"))n[0]=this.quoteIdentifier(n[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/itwveifv/bot.maxotp.site/server.js:131:7843)
    at new t (/home/itwveifv/bot.maxotp.site/server.js:143:66788)
    at new wo (/home/itwveifv/bot.maxotp.site/server.js:143:73334)
    at new t (/home/itwveifv/bot.maxotp.site/server.js:143:229514)
    at Object.<anonymous> (/home/itwveifv/bot.maxotp.site/server.js:3688:6586)
    at Module._compile (node:internal/modules/cjs/loader:1521:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1623:10)
    at Module.load (node:internal/modules/cjs/loader:1266:32)
    at Module._load (node:internal/modules/cjs/loader:1091:12)
    at Module.require (node:internal/modules/cjs/loader:1289:19)

Node.js v20.20.0
/home/itwveifv/bot.maxotp.site/server.js:131
`}};nk.AggregateError=Jee});var h8e=O(ak=>{"use strict";Object.defineProperty(ak,"__esModule",{value:!0});ak.Deferred=void 0;var Mdr=$ee(),ete=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 Mdr.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}};ak.Deferred=ete});var b8e=O(sk=>{"use strict";Object.defineProperty(sk,"__esModule",{value:!0});sk.Pool=void 0;var Edr=h8e(),ydr=Zee(),tte=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(),i,n=this._availableObjects.length,a=this.size-this.minSize,s;for(this._removeIdleScheduled=!1,i=0;i<n&&a>e.length;i++)s=this._availableObjects[i].timeout,r>=s&&(this._log("removeIdle() destroying obj - now:"+r+" timeout:"+s,"verbose"),e.push(this._availableObjects[i].resource));e.forEach(this.destroy,this),n=this._availableObjects.length,n>0?(this._log("this._availableObjects.length="+n,"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 i={resource:e,useCount:r,timeout:Date.now()+this.idleTimeoutMillis};this._availableObjects.push(i),this._dispense(),this._scheduleRemoveIdle()}_addResourceToInUseObjects(e,r){let i={resource:e,useCount:r};this._inUseObjects.push(i)}_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 Edr.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(n=>n.resource===e)){this._log("release called twice for the same resource: "+new Error().stack,"error");return}let r=this._inUseObjects.findIndex(n=>n.resource===e);if(r<0){this._log("attempt to release an invalid resource: "+new Error().stack,"error");return}let i=this._inUseObjects[r];i.useCount+=1,i.useCount>=this.maxUsesPerResource?(this._log("release() destroying obj - useCount:"+i.useCount+" maxUsesPerResource:"+this.maxUsesPerResource,"verbose"),this.destroy(i.resource),this._dispense()):(this._inUseObjects.splice(r,1),this._addResourceToAvailableObjects(i.resource,i.useCount))}async destroy(e){let r=this._availableObjects.length,i=this._inUseObjects.length;if(this._availableObjects=this._availableObjects.filter(n=>n.resource!==e),this._inUseObjects=this._inUseObjects.filter(n=>n.resource!==e),r===this._availableObjects.length&&i===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(i=>i.resource),r=[];for(let i of e)try{await this.destroy(i)}catch(n){this._log("Error destroying resource: "+n.stack,"error"),r.push(n)}if(r.length>0)throw new ydr.AggregateError(r)}};sk.Pool=tte});var _8e=O(ob=>{"use strict";Object.defineProperty(ob,"__esModule",{value:!0});ob.Pool=ob.AggregateError=ob.TimeoutError=void 0;var zdr=$ee();Object.defineProperty(ob,"TimeoutError",{enumerable:!0,get:function(){return zdr.TimeoutError}});var Rdr=Zee();Object.defineProperty(ob,"AggregateError",{enumerable:!0,get:function(){return Rdr.AggregateError}});var wdr=b8e();Object.defineProperty(ob,"Pool",{enumerable:!0,get:function(){return wdr.Pool}})});var ed=O((Mei,ok)=>{"use strict";var{Pool:rte,TimeoutError:Ndr}=_8e(),cb=fr(),ite=Zf(),vdr=fi(),{logger:Tdr}=Bn(),Idr=cM(),bp=Tdr.debugContext("pool"),q4=class{constructor(e,r){let i=cb.cloneDeep(r.config);if(this.sequelize=r,this.config=i,this.dialect=e,this.versionPromise=null,this.dialectName=this.sequelize.options.dialect,i.pool===!1)throw new Error("Support for pool:false was removed in v4.0");i.pool=cb.defaults(i.pool||{},{max:5,min:0,idle:1e4,acquire:6e4,evict:1e3,validate:this._validate.bind(this)}),this.initPools()}refreshTypeParser(e){cb.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(),bp("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 rte({name:"sequelize",create:()=>this._connect(e),destroy:async i=>{let n=await this._disconnect(i);return bp("connection destroy"),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}),bp(`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=cb.defaults(e.replication.write,cb.omit(e,"replication")),e.replication.read=e.replication.read.map(i=>cb.defaults(i,cb.omit(this.config,"replication")));let r=0;this.pool={release:i=>{i.queryType==="read"?this.pool.read.release(i):this.pool.write.release(i)},acquire:(i,n)=>(n=n===void 0?!1:n,i==="SELECT"&&!n?this.pool.read.acquire():this.pool.write.acquire()),destroy:i=>{this.pool[i.queryType].destroy(i),bp("connection destroy")},destroyAllNow:async()=>{await Promise.all([this.pool.read.destroyAllNow(),this.pool.write.destroyAllNow()]),bp("all connections destroyed")},drain:async()=>Promise.all([this.pool.write.drain(),this.pool.read.drain()]),read:new rte({name:"sequelize:read",create:async()=>{let i=r++%e.replication.read.length,n=await this._connect(e.replication.read[i]);return n.queryType="read",n},destroy:i=>this._disconnect(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}),write:new rte({name:"sequelize:write",create:async()=>{let i=await this._connect(e.replication.write);return i.queryType="write",i},destroy:i=>this._disconnect(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})},bp(`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 i=await this._connect(this.config.replication.write||this.config),n={};if(n.transaction={connection:i},n.logging=()=>{},n.logging.__testLoggingFn=!0,this.sequelize.options.databaseVersion===0){let a=await this.sequelize.databaseVersion(n),s=cb.get(ite.coerce(a),"version")||a;this.sequelize.options.databaseVersion=ite.valid(s)?s:this.dialect.defaultVersion}return ite.lt(this.sequelize.options.databaseVersion,this.dialect.defaultVersion)&&(Idr.unsupportedEngine(),bp(`Unsupported database engine version ${this.sequelize.options.databaseVersion}`)),this.versionPromise=null,await this._disconnect(i)}catch(i){throw this.versionPromise=null,i}})()),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(i){throw i instanceof Ndr?new vdr.ConnectionAcquireTimeoutError(i):i}return bp("connection acquired"),r}releaseConnection(e){this.pool.release(e),bp("connection released")}async destroyConnection(e){await this.pool.destroy(e),bp(`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}};ok.exports=q4;ok.exports.ConnectionManager=q4;ok.exports.default=q4});var iu=O((Eei,A8e)=>{"use strict";var C4=new Map;A8e.exports=t=>(C4.has(t)||C4.set(t,new Map),{clear(){C4.get(t).clear()},refresh(e){for(let r of e.types[t])C4.get(t).set(r,e.parse)},get(e){return C4.get(t).get(e)}})});var M8e=O((yei,uk)=>{"use strict";var Sdr=Object.defineProperty,m8e=Object.getOwnPropertySymbols,qdr=Object.prototype.hasOwnProperty,Cdr=Object.prototype.propertyIsEnumerable,O8e=(t,e,r)=>e in t?Sdr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,xdr=(t,e)=>{for(var r in e||(e={}))qdr.call(e,r)&&O8e(t,r,e[r]);if(m8e)for(var r of m8e(e))Cdr.call(e,r)&&O8e(t,r,e[r]);return t},Ldr=Zf(),kdr=ed(),fM=fi(),{logger:Ddr}=Bn(),Bdr=ri().mariadb,Pdr=up(),g8e=Ddr.debugContext("connection:mariadb"),ck=iu()("mariadb"),x4=class t extends kdr{constructor(e,r){r.config.port=r.config.port||3306,super(e,r),this.lib=this._loadDialectModule("mariadb"),this.refreshTypeParser(Bdr)}static _typecast(e,r){return ck.get(e.type)?ck.get(e.type)(e,this.sequelize.options,r):r()}_refreshTypeParser(e){ck.refresh(e)}_clearTypeParser(){ck.clear()}async connect(e){let r=this.sequelize.options.timezone;r=/\//.test(r)?Pdr.tz(r).format("Z"):r;let i=xdr({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||(i.initSql?(Array.isArray(i.initSql)||(i.initSql=[i.initSql]),i.initSql.push(`SET time_zone = '${r}'`)):i.initSql=`SET time_zone = '${r}'`);try{let n=await this.lib.createConnection(i);return this.sequelize.options.databaseVersion=Ldr.coerce(n.serverVersion()).version,g8e("connection acquired"),n.on("error",a=>{switch(a.code){case"ESOCKET":case"ECONNRESET":case"EPIPE":case"PROTOCOL_CONNECTION_LOST":this.pool.destroy(n)}}),n}catch(n){switch(n.code){case"ECONNREFUSED":throw new fM.ConnectionRefusedError(n);case"ER_ACCESS_DENIED_ERROR":case"ER_ACCESS_DENIED_NO_PASSWORD_ERROR":throw new fM.AccessDeniedError(n);case"ENOTFOUND":throw new fM.HostNotFoundError(n);case"EHOSTUNREACH":case"ENETUNREACH":case"EADDRNOTAVAIL":throw new fM.HostNotReachableError(n);case"EINVAL":throw new fM.InvalidConnectionError(n);default:throw new fM.ConnectionError(n)}}}async disconnect(e){if(!e.isValid()){g8e("connection tried to disconnect but was already at CLOSED state");return}return await e.end()}validate(e){return e&&e.isValid()}};uk.exports=x4;uk.exports.ConnectionManager=x4;uk.exports.default=x4});var td=O((zei,lk)=>{"use strict";var Wdr=Object.defineProperty,E8e=Object.getOwnPropertySymbols,Udr=Object.prototype.hasOwnProperty,Fdr=Object.prototype.propertyIsEnumerable,y8e=(t,e,r)=>e in t?Wdr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,jdr=(t,e)=>{for(var r in e||(e={}))Udr.call(e,r)&&y8e(t,r,e[r]);if(E8e)for(var r of E8e(e))Fdr.call(e,r)&&y8e(t,r,e[r]);return t},ub=fr(),Gdr=a4(),hc=yo(),Hdr=gL(),Qdr=cM(),Vdr=(rM(),Yl(tM)).v4,{safeStringifyJson:z8e}=wi(),L4=class t{constructor(e,r,i){this.uuid=Vdr(),this.connection=e,this.instance=i.instance,this.model=i.model,this.sequelize=r,this.options=jdr({plain:!1,raw:!1,logging:console.log},i),this.checkLoggingOption(),i.rawErrors&&(this.formatError=t.prototype.formatError)}static formatBindParameters(e,r,i,n,a){if(!r)return[e,[]];if(a=a||{},typeof n!="function"&&(a=n||{},n=void 0),!n)a.skipValueReplace?n=(c,l,p)=>{if(p[l]!==void 0)return c}:n=(c,l,p,f,d)=>{if(p[l]!==void 0)return Gdr.escape(p[l],f,d)};else if(a.skipValueReplace){let c=n;n=(l,p,f,d,h,_)=>{if(c(l,p,f,d,h,_)!==void 0)return l}}let s=null,o=Array.isArray(r);return e=e.replace(/\B\$(\$|\w+)/g,(c,l)=>{if(l==="$")return a.skipUnescape?c:l;let p;if(o?l.match(/^[1-9]\d*$/)&&(l=l-1,p=n(c,l,r,s,i,a)):l.match(/^\d*$/)||(p=n(c,l,r,s,i,a)),p===void 0)throw new Error(`Named bind parameter "${c}" 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&&(Qdr.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 i of Object.keys(this.model.uniqueKeys))this.model.uniqueKeys[i].fields.includes(e.replace(/"/g,""))&&this.model.uniqueKeys[i].msg&&(r=this.model.uniqueKeys[i].msg);return r}isRawQuery(){return this.options.type===hc.RAW}isVersionQuery(){return this.options.type===hc.VERSION}isUpsertQuery(){return this.options.type===hc.UPSERT}isInsertQuery(e,r){let i=!0;return this.options.type===hc.INSERT?!0:(i=i&&this.sql.toLowerCase().startsWith("insert into"),i=i&&(!e||Object.prototype.hasOwnProperty.call(e,this.getInsertIdField())),i=i&&(!r||Object.prototype.hasOwnProperty.call(r,this.getInsertIdField())),i)}handleInsertQuery(e,r){if(this.instance){let i=this.model.autoIncrementAttribute,n=null;n=n||e&&e[this.getInsertIdField()],n=n||r&&r[this.getInsertIdField()],this.instance[i]=n}}isShowTablesQuery(){return this.options.type===hc.SHOWTABLES}handleShowTablesQuery(e){return ub.flatten(e.map(r=>Object.values(r)))}isShowIndexesQuery(){return this.options.type===hc.SHOWINDEXES}isShowConstraintsQuery(){return this.options.type===hc.SHOWCONSTRAINTS}isDescribeQuery(){return this.options.type===hc.DESCRIBE}isSelectQuery(){return this.options.type===hc.SELECT}isBulkUpdateQuery(){return this.options.type===hc.BULKUPDATE}isBulkDeleteQuery(){return this.options.type===hc.BULKDELETE}isForeignKeysQuery(){return this.options.type===hc.FOREIGNKEYS}isUpdateQuery(){return this.options.type===hc.UPDATE}handleSelectQuery(e){let r=null;if(this.options.fieldMap){let i=this.options.fieldMap;e=e.map(n=>ub.reduce(i,(a,s,o)=>(a[o]!==void 0&&s!==o&&(a[s]=a[o],delete a[o]),a),n))}return this.options.raw?r=e.map(i=>{let n={};for(let a in i)Object.prototype.hasOwnProperty.call(i,a)&&(n[a]=i[a]);return this.options.nest&&(n=Hdr.transform(n)),n}):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,i){let{connection:n,options:a}=this,s=this.sequelize.options.benchmark||a.benchmark,o=this.sequelize.options.logQueryParameters||a.logQueryParameters,c=Date.now(),l="";if(o&&i){let d=e.endsWith(";")?"":";",h;Array.isArray(i)?h=i.map(_=>z8e(_)).join(", "):h=z8e(i),l=`${d} ${h}`}let p=`(${n.uuid||"default"}): ${e}${l}`,f=`Executing ${p}`;return r(f),s||this.sequelize.log(`Executing ${p}`,a),()=>{let d=`Executed ${p}`;r(d),s&&this.sequelize.log(d,Date.now()-c,a)}}static _groupJoinData(e,r,i){if(!e.length)return[];let n,a,s,o,c,l,p=e.length,f,d,h,_,m,E,R,N,T=i.checkExisting,I,W,D,F=T?[]:new Array(p),x={},H={},$,k,oe,j,B,V,X,_e,he=se=>{Object.prototype.hasOwnProperty.call(V.includeMap,se)&&(H[d]=V=V.includeMap[se],_e?_e=`${_e}.${se}`:_e=se,H[_e]=V)},ce={},Re=(se,Ee)=>(Object.prototype.hasOwnProperty.call(Ee,se)||(Ee[se]=se.substr(0,se.lastIndexOf("."))),Ee[se]),Te={},Ce=se=>{if(!Object.prototype.hasOwnProperty.call(Te,se)){let Ee=se.lastIndexOf(".");Te[se]=se.substr(Ee===-1?0:Ee+1)}return Te[se]},te={},de=se=>{if(!Object.prototype.hasOwnProperty.call(te,se)){let Ee=Re(se,ce);Object.prototype.hasOwnProperty.call(te,Ee)||(te[Ee]=Ee?Ee.split("."):[]),te[se]=te[Ee]}return te[se]},ze={},Oe=se=>{if(!Object.prototype.hasOwnProperty.call(ze,se)){let Ee=de(se),Ie=Ee.length;ze[se]=Ie?Ee[Ie-1]:""}return ze[se]},ke=se=>{let Ee=ub.chain(se.uniqueKeys);return Ee=Ee.result(`${Ee.findKey()}.fields`).map(Ie=>ub.findKey(se.attributes,Pe=>Pe.field===Ie)).value(),Ee},$e=se=>se instanceof Buffer?se.toString("hex"):se,Se,nt,xe;for(c=0;c<p;c++){if(l=e[c],c===0&&(f=ub.sortBy(Object.keys(l),se=>[se.split(".").length]),_=f.length),T){if(N=!1,o=r.model.primaryKeyAttributes.length,D="",o===1)D=$e(l[r.model.primaryKeyAttributes[0]]);else if(o>1)for(s=0;s<o;s++)D+=$e(l[r.model.primaryKeyAttributes[s]]);else if(!ub.isEmpty(r.model.uniqueKeys))for(nt=ke(r.model),s=0;s<nt.length;s++)D+=l[nt[s]]}for(R=E={},j=void 0,h=0;h<_;h++){if(d=f[h],k=Re(d,ce),$=de(d),c===0&&!Object.prototype.hasOwnProperty.call(H,d)&&($.length?(V=r,_e=void 0,$.forEach(he)):H[d]=H[""]=r),j!==void 0&&j!==$){if(T){if(a=j.length,X=null,W=null,a)for(n=0;n<a;n++){if(xe=X?`${X}.${j[n]}`:j[n],Se=H[xe].model.primaryKeyAttributes,o=Se.length,I=xe,o===1)I+=$e(l[`${xe}.${Se[0]}`]);else if(o>1)for(s=0;s<o;s++)I+=$e(l[`${xe}.${Se[s]}`]);else if(!ub.isEmpty(H[xe].model.uniqueKeys))for(nt=ke(H[xe].model),s=0;s<nt.length;s++)I+=l[`${xe}.${nt[s]}`];W||(W=D),I=W+I,X=xe,n<a-1&&(W=I)}else I=D;I===D?x[I]?N=!0:x[I]=E:x[I]||(X=x[W],B=Oe(m),H[m].association.isSingleAssociation?X&&(X[B]=x[I]=E):(X[B]||(X[B]=[]),X[B].push(x[I]=E))),E={}}else if(V=R,a=$.length,a)for(n=0;n<a;n++)n===a-1&&(E=V[$[n]]={}),V=V[$[n]]||{}}E[Ce(d)]=l[d],m=d,j=$,oe=k}if(T){if(a=j.length,X=null,W=null,a)for(n=0;n<a;n++){if(xe=X?`${X}.${j[n]}`:j[n],Se=H[xe].model.primaryKeyAttributes,o=Se.length,I=xe,o===1)I+=$e(l[`${xe}.${Se[0]}`]);else if(o>0)for(s=0;s<o;s++)I+=$e(l[`${xe}.${Se[s]}`]);else if(!ub.isEmpty(H[xe].model.uniqueKeys))for(nt=ke(H[xe].model),s=0;s<nt.length;s++)I+=l[`${xe}.${nt[s]}`];W||(W=D),I=W+I,X=xe,n<a-1&&(W=I)}else I=D;I===D?x[I]?N=!0:x[I]=E:x[I]||(X=x[W],B=Oe(m),H[m].association.isSingleAssociation?X&&(X[B]=x[I]=E):(X[B]||(X[B]=[]),X[B].push(x[I]=E))),N||F.push(R)}else F[c]=R}return F}};lk.exports=L4;lk.exports.AbstractQuery=L4;lk.exports.default=L4});var q8e=O((Rei,S8e)=>{"use strict";var Ydr=Object.defineProperty,R8e=Object.getOwnPropertySymbols,Xdr=Object.prototype.hasOwnProperty,Kdr=Object.prototype.propertyIsEnumerable,w8e=(t,e,r)=>e in t?Ydr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,$dr=(t,e)=>{for(var r in e||(e={}))Xdr.call(e,r)&&w8e(t,r,e[r]);if(R8e)for(var r of R8e(e))Kdr.call(e,r)&&w8e(t,r,e[r]);return t},N8e=td(),pk=fi(),v8e=fr(),nte=ri(),{logger:Jdr}=Bn(),Zdr=1062,ehr=1213,T8e=1451,thr=1452,I8e=Jdr.debugContext("sql:mariadb"),ate=class extends N8e{constructor(e,r,i){super(e,r,$dr({showWarnings:!1},i))}static formatBindParameters(e,r,i){let n=[],a=(s,o,c)=>{if(c[o]!==void 0)return n.push(c[o]),"?"};return e=N8e.formatBindParameters(e,r,i,a)[0],[e,n.length>0?n:void 0]}async run(e,r){this.sql=e;let{connection:i,options:n}=this,a=this.sequelize.options.showWarnings||n.showWarnings,s=this._logQuery(e,I8e,r);r&&I8e("parameters(%j)",r);let o,c=new Error;try{o=await i.query(this.sql,r)}catch(l){if(n.transaction&&l.errno===ehr){try{await n.transaction.rollback()}catch{}n.transaction.finished="rollback"}throw l.sql=e,l.parameters=r,this.formatError(l,c.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 i=e[this.getInsertIdField()];r=new Array(e.affectedRows);let n=this.model.rawAttributes[this.model.primaryKeyAttribute].field;for(let a=0;a<e.affectedRows;a++)r[a]={[n]:i+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 i=e.meta;return delete e.meta,[e,i]}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 i of e)r[i.Field]={type:i.Type.toLowerCase().startsWith("enum")?i.Type.replace(/^enum/i,"ENUM"):i.Type.toUpperCase(),allowNull:i.Null==="YES",defaultValue:i.Default,primaryKey:i.Key==="PRI",autoIncrement:Object.prototype.hasOwnProperty.call(i,"Extra")&&i.Extra.toLowerCase()==="auto_increment",comment:i.Comment?i.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 i=this.model.fieldRawAttributesMap[r];i.type instanceof nte.JSON&&(e=e.map(n=>(n[i.fieldName]&&typeof n[i.fieldName]=="string"&&!this.connection.info.hasMinVersion(10,5,2)&&(n[i.fieldName]=JSON.parse(n[i.fieldName])),nte.JSON.parse?nte.JSON.parse(i,this.sequelize.options,n[i.fieldName]):n)))}}async logWarnings(e){let r=await this.run("SHOW WARNINGS"),i=`MariaDB Warnings (${this.connection.uuid||"default"}): `,n=[];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"))n.push(s.Message);else for(let o of s.keys())n.push([o,s[o]].join(": "));return this.sequelize.log(i+n.join("; "),this.options),e}formatError(e,r){switch(e.errno){case Zdr:{let i=e.message.match(/Duplicate entry '([\s\S]*)' for key '?((.|\s)*?)'?\s.*$/),n={},a="Validation error",s=i?i[1].split("-"):void 0,o=i?i[2]:void 0,c=i?i[1]:void 0,l=this.model&&this.model.uniqueKeys[o];l?(l.msg&&(a=l.msg),n=v8e.zipObject(l.fields,s)):n[o]=c;let p=[];return v8e.forOwn(n,(f,d)=>{p.push(new pk.ValidationErrorItem(this.getUniqueConstraintErrorMessage(d),"unique violation",d,f,this.instance,"not_unique"))}),new pk.UniqueConstraintError({message:a,errors:p,parent:e,fields:n,stack:r})}case T8e:case thr:{let i=e.message.match(/CONSTRAINT ([`"])(.*)\1 FOREIGN KEY \(\1(.*)\1\) REFERENCES \1(.*)\1 \(\1(.*)\1\)/),n=i?i[1]:"`",a=i?i[3].split(new RegExp(`${n}, *${n}`)):void 0;return new pk.ForeignKeyConstraintError({reltype:e.errno===T8e?"parent":"child",table:i?i[4]:void 0,fields:a,value:a&&a.length&&this.instance&&this.instance[a[0]]||void 0,index:i?i[2]:void 0,parent:e,stack:r})}default:return new pk.DatabaseError(e,{stack:r})}}handleShowTablesQuery(e){return e.map(r=>({tableName:r.TABLE_NAME,schema:r.TABLE_SCHEMA}))}handleShowIndexesQuery(e){let r,i=[];return e.forEach(n=>{(!r||r.name!==n.Key_name)&&(r={primary:n.Key_name==="PRIMARY",fields:[],name:n.Key_name,tableName:n.Table,unique:n.Non_unique!==1,type:n.Index_type},i.push(r)),r.fields[n.Seq_in_index-1]={attribute:n.Column_name,length:n.Sub_part||void 0,order:n.Collation==="A"?"ASC":void 0}}),i}};S8e.exports=ate});var k8e=O((wei,L8e)=>{"use strict";var rhr=Object.defineProperty,C8e=Object.getOwnPropertySymbols,ihr=Object.prototype.hasOwnProperty,nhr=Object.prototype.propertyIsEnumerable,x8e=(t,e,r)=>e in t?rhr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,ahr=(t,e)=>{for(var r in e||(e={}))ihr.call(e,r)&&x8e(t,r,e[r]);if(C8e)for(var r of C8e(e))nhr.call(e,r)&&x8e(t,r,e[r]);return t},fk=fr(),a0=Hs(),shr=wi(),ohr={OperatorMap:{[a0.eq]:"=",[a0.ne]:"!=",[a0.gte]:">=",[a0.gt]:">",[a0.lte]:"<=",[a0.lt]:"<",[a0.not]:"IS NOT",[a0.is]:"IS",[a0.in]:"IN",[a0.notIn]:"NOT IN",[a0.like]:"LIKE",[a0.notLike]:"NOT LIKE",[a0.iLike]:"ILIKE",[a0.notILike]:"NOT ILIKE",[a0.startsWith]:"LIKE",[a0.endsWith]:"LIKE",[a0.substring]:"LIKE",[a0.regexp]:"~",[a0.notRegexp]:"!~",[a0.iRegexp]:"~*",[a0.notIRegexp]:"!~*",[a0.between]:"BETWEEN",[a0.notBetween]:"NOT BETWEEN",[a0.overlap]:"&&",[a0.contains]:"@>",[a0.contained]:"<@",[a0.adjacent]:"-|-",[a0.strictLeft]:"<<",[a0.strictRight]:">>",[a0.noExtendRight]:"&<",[a0.noExtendLeft]:"&>",[a0.any]:"ANY",[a0.all]:"ALL",[a0.and]:" AND ",[a0.or]:" OR ",[a0.col]:"COL",[a0.placeholder]:"$$PLACEHOLDER$$",[a0.match]:"@@"},OperatorsAliasMap:{},setOperatorsAliases(t){!t||fk.isEmpty(t)?this.OperatorsAliasMap=!1:this.OperatorsAliasMap=ahr({},t)},_replaceAliases(t){let e={};return this.OperatorsAliasMap?(shr.getOperators(t).forEach(r=>{let i=t[r];fk.isPlainObject(i)?e[r]=this._replaceAliases(i):e[r]=i}),fk.forOwn(t,(r,i)=>{i=this.OperatorsAliasMap[i]||i,fk.isPlainObject(r)&&(r=this._replaceAliases(r)),e[i]=r}),e):t}};L8e.exports=ohr});var B8e=O((Nei,D8e)=>{"use strict";var chr=(rM(),Yl(tM)).v4,uhr={setIsolationLevelQuery(t,e){if(!e.parent)return`SET TRANSACTION ISOLATION LEVEL ${t};`},generateTransactionId(){return chr()},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;"}};D8e.exports=uhr});var lb=O((Tei,j8e)=>{"use strict";var lhr=Object.defineProperty,phr=Object.defineProperties,fhr=Object.getOwnPropertyDescriptors,P8e=Object.getOwnPropertySymbols,dhr=Object.prototype.hasOwnProperty,hhr=Object.prototype.propertyIsEnumerable,W8e=(t,e,r)=>e in t?lhr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,hA=(t,e)=>{for(var r in e||(e={}))dhr.call(e,r)&&W8e(t,r,e[r]);if(P8e)for(var r of P8e(e))hhr.call(e,r)&&W8e(t,r,e[r]);return t},dk=(t,e)=>phr(t,fhr(e)),hk=require("util"),Zr=fr(),bhr=(rM(),Yl(tM)).v4,Wt=wi(),vei=cM(),U8e=a4(),dM=ri(),Zu=Aee(),hM=nb(),ste=ab(),_hr=aM(),Ahr=cA(),Nt=Hs(),ote=fi(),F8e=Nee(),mhr=new Set(["integer","int","smallint","bigint","float","real","double precision","decimal","numeric","boolean","text","char","varchar","nvarchar","date","timestamp","timestamptz","datetime","json","jsonb","signed","unsigned"]),k4=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:Zr.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,i){return`DESCRIBE ${this.quoteTable(this.addSchema({tableName:e,_schema:r,_schemaDelimiter:i}))};`}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,i,n){n=n||{},Zr.defaults(n,this.options);let a={},s=n.bind||[],o=[],c=[],l=[],p=[],f=this.quoteTable(e),d=n.bindParam===void 0?this.bindParam(s):n.bindParam,h=[],_,m="",E="",R="",N="",T=!1,I="";if(i&&Zr.each(i,(x,H)=>{a[H]=x,x.field&&(a[x.field]=x)}),this._dialect.supports["DEFAULT VALUES"]?E+=" DEFAULT VALUES":this._dialect.supports["VALUES ()"]&&(E+=" VALUES ()"),(this._dialect.supports.returnValues||this._dialect.supports.returnIntoValues)&&n.returning){let x=this.generateReturnValues(i,n);c.push(...x.returnFields),this._dialect.supports.returnIntoValues&&l.push(...x.returnTypes),N=x.returningFragment,I=x.tmpTable||"",R=x.outputFragment||""}(Zr.get(this,["sequelize","options","dialectOptions","prependSearchPath"])||n.searchPath)&&(n.bindParam=!1),this._dialect.supports.EXCEPTION&&n.exception&&(n.bindParam=!1),r=Wt.removeNullValuesFromHash(r,this.options.omitNull);for(let x in r)if(Object.prototype.hasOwnProperty.call(r,x)){let H=r[x];o.push(this.quoteIdentifier(x)),a&&a[x]&&a[x].autoIncrement===!0&&H==null?this._dialect.supports.autoIncrement.defaultValue?this._dialect.supports.DEFAULT?p.push("DEFAULT"):p.push(this.escape(null)):o.splice(-1,1):(a&&a[x]&&a[x].autoIncrement===!0&&(T=!0),H instanceof Wt.SequelizeMethod||n.bindParam===!1?p.push(this.escape(H,a&&a[x]||void 0,{context:"INSERT"})):p.push(this.format(H,a&&a[x]||void 0,{context:"INSERT"},d)))}let W="";if(!Zr.isEmpty(n.conflictWhere)&&!this._dialect.supports.inserts.onConflictWhere)throw new Error("missing dialect support for conflictWhere option");if(this._dialect.supports.inserts.updateOnDuplicate&&n.updateOnDuplicate)if(this._dialect.supports.inserts.updateOnDuplicate==" ON CONFLICT DO UPDATE SET"){let x=n.upsertKeys.map(k=>this.quoteIdentifier(k)),H=n.updateOnDuplicate.map(k=>`${this.quoteIdentifier(k)}=EXCLUDED.${this.quoteIdentifier(k)}`),$=["ON CONFLICT","(",x.join(","),")"];Zr.isEmpty(n.conflictWhere)||$.push(this.whereQuery(n.conflictWhere,n)),Zr.isEmpty(H)?$.push("DO NOTHING"):$.push("DO UPDATE SET",H.join(",")),W=` ${Wt.joinSQLFragments($)}`}else{let x=n.updateOnDuplicate.map(H=>`${this.quoteIdentifier(H)}=VALUES(${this.quoteIdentifier(H)})`);if(Zr.isEmpty(x)&&n.upsertKeys&&x.push(...n.upsertKeys.map(H=>`${this.quoteIdentifier(H)}=${this.quoteIdentifier(H)}`)),Zr.isEmpty(x))throw new Error("No update values found for ON DUPLICATE KEY UPDATE clause, and no identifier fields could be found to use instead.");W+=`${this._dialect.supports.inserts.updateOnDuplicate} ${x.join(",")}`}let D={ignoreDuplicates:n.ignoreDuplicates?this._dialect.supports.inserts.ignoreDuplicates:"",onConflictDoNothing:n.ignoreDuplicates?this._dialect.supports.inserts.onConflictDoNothing:"",attributes:o.join(","),output:R,values:p.join(","),tmpTable:I};if(m=`${I}INSERT${D.ignoreDuplicates} INTO ${f} (${D.attributes})${D.output} VALUES (${D.values})${W}${D.onConflictDoNothing}${m}`,E=`${I}INSERT${D.ignoreDuplicates} INTO ${f}${D.output}${W}${D.onConflictDoNothing}${E}`,this._dialect.supports.EXCEPTION&&n.exception){let x="DROP FUNCTION IF EXISTS pg_temp.testfunc()";c.length===0&&c.push("*");let H=`$func_${bhr().replace(/-/g,"")}$`,$=`SELECT (testfunc.response).${c.join(", (testfunc.response).")}, testfunc.sequelize_caught_exception FROM pg_temp.testfunc();`;n.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 ${H} BEGIN ${m} RETURNING * INTO response; EXCEPTION ${n.exception} END ${H} LANGUAGE plpgsql; ${$} ${x}`}else m+=N,E+=N;this._dialect.supports.returnIntoValues&&n.returning&&this.populateInsertQueryReturnIntoBinds(c,l,s.length,h,n),_=`${D.attributes.length?m:E}${h.join(",")};`,this._dialect.supports.finalTable&&(_=`SELECT * FROM FINAL TABLE(${D.attributes.length?m:E});`),T&&this._dialect.supports.autoIncrement.identityInsert&&(_=`SET IDENTITY_INSERT ${f} ON; ${_} SET IDENTITY_INSERT ${f} OFF;`);let F={query:_};return n.bindParam!==!1&&(F.bind=s),F}bulkInsertQuery(e,r,i,n){i=i||{},n=n||{};let a=[],s={},o=[],c="";for(let h of r)Zr.forOwn(h,(_,m)=>{o.includes(m)||o.push(m),n[m]&&n[m].autoIncrement===!0&&(s[m]=!0)});for(let h of r){let _=o.map(m=>this._dialect.supports.bulkDefault&&s[m]===!0?h[m]!=null?h[m]:"DEFAULT":this.escape(h[m],n[m],{context:"INSERT"}));a.push(`(${_.join(",")})`)}if(this._dialect.supports.inserts.updateOnDuplicate&&i.updateOnDuplicate)if(this._dialect.supports.inserts.updateOnDuplicate==" ON CONFLICT DO UPDATE SET"){let h=i.upsertKeys.map(E=>this.quoteIdentifier(E)),_=i.updateOnDuplicate.map(E=>`${this.quoteIdentifier(E)}=EXCLUDED.${this.quoteIdentifier(E)}`),m=!1;if(i.conflictWhere){if(!this._dialect.supports.inserts.onConflictWhere)throw new Error(`conflictWhere not supported for dialect ${this._dialect.name}`);m=this.whereQuery(i.conflictWhere,i)}c=["ON CONFLICT","(",h.join(","),")",m,"DO UPDATE SET",_.join(",")]}else{if(i.conflictWhere)throw new Error(`conflictWhere not supported for dialect ${this._dialect.name}`);let h=i.updateOnDuplicate.map(_=>`${this.quoteIdentifier(_)}=VALUES(${this.quoteIdentifier(_)})`);c=`${this._dialect.supports.inserts.updateOnDuplicate} ${h.join(",")}`}let l=i.ignoreDuplicates?this._dialect.supports.inserts.ignoreDuplicates:"",p=o.map(h=>this.quoteIdentifier(h)).join(","),f=i.ignoreDuplicates?this._dialect.supports.inserts.onConflictDoNothing:"",d="";if(this._dialect.supports.returnValues&&i.returning){let h=this.generateReturnValues(n,i);d+=h.returningFragment}return Wt.joinSQLFragments(["INSERT",l,"INTO",this.quoteTable(e),`(${p})`,"VALUES",a.join(","),c,f,d,";"])}updateQuery(e,r,i,n,a){n=n||{},Zr.defaults(n,this.options),r=Wt.removeNullValuesFromHash(r,n.omitNull,n);let s=[],o=[],c={},l="",p="",f="";(Zr.get(this,["sequelize","options","dialectOptions","prependSearchPath"])||n.searchPath)&&(n.bindParam=!1);let d=n.bindParam===void 0?this.bindParam(o):n.bindParam;if(this._dialect.supports["LIMIT ON UPDATE"]&&n.limit&&(["mssql","db2","oracle"].includes(this.dialect)?this.dialect==="oracle"&&(i&&(i.length&&i.length>0||Object.keys(i).length>0)?f+=" AND ":f+=" WHERE ",f+=`rownum <= ${this.escape(n.limit)} `):f=` LIMIT ${this.escape(n.limit)} `),this._dialect.supports.returnValues&&n.returning){let E=this.generateReturnValues(a,n);f+=E.returningFragment,p=E.tmpTable||"",l=E.outputFragment||"",!this._dialect.supports.returnValues.output&&n.returning&&(n.mapToModel=!0)}a&&Zr.each(a,(E,R)=>{c[R]=E,E.field&&(c[E.field]=E)});for(let E in r){if(c&&c[E]&&c[E].autoIncrement===!0&&!this._dialect.supports.autoIncrement.update)continue;let R=r[E];R instanceof Wt.SequelizeMethod||n.bindParam===!1?s.push(`${this.quoteIdentifier(E)}=${this.escape(R,c&&c[E]||void 0,{context:"UPDATE"})}`):s.push(`${this.quoteIdentifier(E)}=${this.format(R,c&&c[E]||void 0,{context:"UPDATE"},d)}`)}let h=dk(hA({},n),{bindParam:d});if(s.length===0)return"";let m={query:`${p}UPDATE ${this.quoteTable(e)} SET ${s.join(",")}${l} ${this.whereQuery(i,h)}${f}`.trim()};return n.bindParam!==!1&&(m.bind=o),m}arithmeticQuery(e,r,i,n,a,s){s=s||{},Zr.defaults(s,{returning:!0}),a=Wt.removeNullValuesFromHash(a,this.options.omitNull);let o="",c="";if(this._dialect.supports.returnValues&&s.returning){let p=this.generateReturnValues(null,s);o=p.outputFragment,c=p.returningFragment}let l=[];for(let p in n){let f=n[p],d=this.quoteIdentifier(p),h=this.escape(f);l.push(`${d}=${d}${e} ${h}`)}for(let p in a){let f=a[p],d=this.quoteIdentifier(p),h=this.escape(f);l.push(`${d}=${h}`)}return Wt.joinSQLFragments(["UPDATE",this.quoteTable(r),"SET",l.join(","),o,this.whereQuery(i),c])}addIndexQuery(e,r,i,n){i=i||{},Array.isArray(r)?i.fields=r:(i=r,r=void 0),i.prefix=i.prefix||n||e,i.prefix&&typeof i.prefix=="string"&&(i.prefix=i.prefix.replace(/\./g,"_"),i.prefix=i.prefix.replace(/("|')/g,""));let a=i.fields.map(c=>{if(c instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(c);typeof c=="string"&&(c={name:c});let l="";if(c.attribute&&(c.name=c.attribute),!c.name)throw new Error(`The following index field has no name: ${hk.inspect(c)}`);if(l+=this.quoteIdentifier(c.name),this._dialect.supports.index.collate&&c.collate&&(l+=` COLLATE ${this.quoteIdentifier(c.collate)}`),this._dialect.supports.index.operator){let p=c.operator||i.operator;p&&(l+=` ${p}`)}return this._dialect.supports.index.length&&c.length&&(l+=`(${c.length})`),c.order&&(l+=` ${c.order}`),l});i.name||(i=Wt.nameIndex(i,i.prefix)),i=Zu._conformIndex(i),this._dialect.supports.index.type||delete i.type,i.where&&(i.where=this.whereQuery(i.where)),typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e);let s=this._dialect.supports.index.concurrently&&i.concurrently?"CONCURRENTLY":void 0,o;return this._dialect.supports.indexViaAlter?o=["ALTER TABLE",e,s,"ADD"]:o=["CREATE"],o=o.concat(i.unique?"UNIQUE":"",i.type,"INDEX",this._dialect.supports.indexViaAlter?void 0:s,this.quoteIdentifiers(i.name),this._dialect.supports.index.using===1&&i.using?`USING ${i.using}`:"",this._dialect.supports.indexViaAlter?void 0:`ON ${e}`,this._dialect.supports.index.using===2&&i.using?`USING ${i.using}`:"",`(${a.join(", ")})`,this._dialect.supports.index.parser&&i.parser?`WITH PARSER ${i.parser}`:void 0,this._dialect.supports.index.where&&i.where?i.where:void 0),Zr.compact(o).join(" ")}addConstraintQuery(e,r){return typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e),Wt.joinSQLFragments(["ALTER TABLE",e,"ADD",this.getConstraintSnippet(e,r||{}),";"])}getConstraintSnippet(e,r){let i,n,a=r.fields.map(c=>{if(typeof c=="string")return this.quoteIdentifier(c);if(c instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(c);if(c.attribute&&(c.name=c.attribute),!c.name)throw new Error(`The following index field has no name: ${c}`);return this.quoteIdentifier(c.name)}),s=a.join(", "),o=a.join("_");switch(r.type.toUpperCase()){case"UNIQUE":n=this.quoteIdentifier(r.name||`${e}_${o}_uk`),i=`CONSTRAINT ${n} UNIQUE (${s})`;break;case"CHECK":r.where=this.whereItemsQuery(r.where),n=this.quoteIdentifier(r.name||`${e}_${o}_ck`),i=`CONSTRAINT ${n} 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.");n=this.quoteIdentifier(r.name||`${e}_${o}_df`),i=`CONSTRAINT ${n} DEFAULT (${this.escape(r.defaultValue)}) FOR ${a[0]}`;break;case"PRIMARY KEY":n=this.quoteIdentifier(r.name||`${e}_${o}_pk`),i=`CONSTRAINT ${n} PRIMARY KEY (${s})`;break;case"FOREIGN KEY":let c=r.references;if(!c||!c.table||!(c.field||c.fields))throw new Error("references object with table and field must be specified");n=this.quoteIdentifier(r.name||`${e}_${o}_${c.table}_fk`);let l=typeof c.field<"u"?this.quoteIdentifier(c.field):c.fields.map(f=>this.quoteIdentifier(f)).join(", "),p=`${this.quoteTable(c.table)} (${l})`;i=`CONSTRAINT ${n} `,i+=`FOREIGN KEY (${s}) REFERENCES ${p}`,r.onUpdate&&(i+=` ON UPDATE ${r.onUpdate.toUpperCase()}`),r.onDelete&&(i+=` 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())&&(i+=` ${this.deferConstraintsQuery(r)}`),i}removeConstraintQuery(e,r){return typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e),Wt.joinSQLFragments(["ALTER TABLE",e,"DROP CONSTRAINT",this.quoteIdentifiers(r)])}quote(e,r,i){let n=["ASC","DESC","ASC NULLS LAST","DESC NULLS LAST","ASC NULLS FIRST","DESC NULLS FIRST","NULLS FIRST","NULLS LAST"];if(i=i||".",typeof e=="string")return this.quoteIdentifiers(e);if(Array.isArray(e)){e.forEach((p,f)=>{let d=e[f-1],h,_;if(!d&&r!==void 0?_=r:d&&d instanceof hM&&(h=d,_=d.target),_&&_.prototype instanceof Zu){let m,E;if(typeof p=="function"&&p.prototype instanceof Zu?m=p:Zr.isPlainObject(p)&&p.model&&p.model.prototype instanceof Zu&&(m=p.model,E=p.as),m&&(!E&&h&&h instanceof hM&&h.through&&h.through.model===m?p=new hM(_,m,{as:m.name}):(p=_.getAssociationForAlias(m,E),p||(p=_.getAssociationForAlias(m,m.name))),!(p instanceof hM)))throw new Error(hk.format("Unable to find a valid association for model, '%s'",m.name))}if(typeof p=="string"){let m=n.indexOf(p.toUpperCase());if(f>0&&m!==-1)p=this.sequelize.literal(` ${n[m]}`);else if(_&&_.prototype instanceof Zu){if(_.associations!==void 0&&_.associations[p])p=_.associations[p];else if(_.rawAttributes!==void 0&&_.rawAttributes[p]&&p!==_.rawAttributes[p].field)p=_.rawAttributes[p].field;else if(p.includes(".")&&_.rawAttributes!==void 0){let E=p.split(".");if(_.rawAttributes[E[0]].type instanceof dM.JSON){let R=this.quoteIdentifiers(`${_.name}.${_.rawAttributes[E[0]].field}`),N=E.slice(1);p=this.jsonPathExtractionQuery(R,N),p=this.sequelize.literal(p)}}}}e[f]=p},this);let a=e.length,s=[],o,c=0;for(c=0;c<a-1&&(o=e[c],!(typeof o=="string"||o._modelAttribute||o instanceof Wt.SequelizeMethod));c++)o instanceof hM&&(s[c]=o.as);let l="";return c>0?l+=`${this.quoteIdentifier(s.join(i))}.`:typeof e[0]=="string"&&r&&(l+=`${this.quoteIdentifier(r.name)}.`),e.slice(c).forEach(p=>{l+=this.quote(p,r,i)},this),l}if(e._modelAttribute)return`${this.quoteTable(e.Model.name)}.${this.quoteIdentifier(e.fieldName)}`;if(e instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(e);throw Zr.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: ${hk.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("->"),i=e[e.length-1];return`${this.quoteIdentifier(r)}.${this.quoteIdentifier(i)}`}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 i="";return r===!0&&(r=e.as||e.name||e),Zr.isObject(e)?this._dialect.supports.schemas?(e.schema&&(i+=`${this.quoteIdentifier(e.schema)}.`),i+=this.quoteIdentifier(e.tableName)):(e.schema&&(i+=e.schema+(e.delimiter||".")),i+=e.tableName,i=this.quoteIdentifier(i)):i=this.quoteIdentifier(e),r&&(i+=` ${this.getAliasToken()} ${this.quoteIdentifier(r)}`),i}escape(e,r,i){if(i=i||{},e!=null){if(e instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(e);if(r&&r.type&&(r.type instanceof dM.STRING&&["mysql","mariadb"].includes(this.dialect)&&["number","boolean"].includes(typeof e)&&(e=String(Number(e))),this.validate(e,r,i),r.type.stringify)){let n=a=>U8e.escape(a,this.options.timezone,this.dialect);if(e=r.type.stringify(e,{escape:n,field:r,timezone:this.options.timezone,operation:i.operation}),r.type.escape===!1)return e}}return U8e.escape(e,this.options.timezone,this.dialect)}bindParam(e){return r=>(e.push(r),`$${e.length}`)}format(e,r,i,n){if(i=i||{},e!=null){if(e instanceof Wt.SequelizeMethod)throw new Error("Cannot pass SequelizeMethod as a bind parameter - use escape instead");if(r&&r.type&&(this.validate(e,r,i),r.type.bindParam))return r.type.bindParam(e,{escape:Zr.identity,field:r,timezone:this.options.timezone,operation:i.operation,bindParam:n})}return n(e)}validate(e,r,i){if(this.typeValidation&&r.type.validate&&e)try{if(i.isList&&Array.isArray(e))for(let n of e)r.type.validate(n,i);else r.type.validate(e,i)}catch(n){throw n instanceof ote.ValidationError&&n.errors.push(new ote.ValidationErrorItem(n.message,"Validation error",r.fieldName,e,null,`${r.type.key} validator`)),n}}isIdentifierQuoted(e){return/^\s*(?:([`"'])(?:(?!\1).|\1{2})*\1\.?)+\s*$/i.test(e)}jsonPathExtractionQuery(e,r,i){let n=Zr.toPath(r),a,s=this.isIdentifierQuoted(e)?e:this.quoteIdentifier(e);switch(this.dialect){case"mysql":case"mariadb":case"sqlite":return this.dialect==="mysql"&&(n=n.map(c=>/\D/.test(c)?Wt.addTicks(c,'"'):c)),a=this.escape(["$"].concat(n).join(".").replace(/\.(\d+)(?:(?=\.)|$)/g,(c,l)=>`[${l}]`)),this.dialect==="sqlite"?`json_extract(${s},${a})`:`json_unquote(json_extract(${s},${a}))`;case"postgres":let o=i?"#>":"#>>";return a=this.escape(`{${n.join(",")}}`),`(${s}${o}${a})`;default:throw new Error(`Unsupported ${this.dialect} for JSON operations`)}}selectQuery(e,r,i){r=r||{};let n=r.limit,a=[],s=[],o=r.subQuery===void 0?n&&r.hasMultiAssociation:r.subQuery,c={main:r.attributes&&r.attributes.slice(),subQuery:null},l={name:e,quotedName:null,as:null,model:i},p={names:l,options:r,subQuery:o},f=[],d=[],h;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&&c.main)for(let m of l.model.primaryKeyAttributes)c.main.some(E=>m===E||m===E[0]||m===E[1])||c.main.push(l.model.rawAttributes[m].field?[m,l.model.rawAttributes[m].field]:m);if(c.main=this.escapeAttributes(c.main,r,l.as),c.main=c.main||(r.include?[`${l.as}.*`]:["*"]),(o||r.groupedLimit)&&(c.subQuery=c.main,c.main=[`${l.as||l.quotedName}.*`]),r.include)for(let m of r.include){if(m.separate)continue;let E=this.generateInclude(m,{externalAs:l.as,internalAs:l.as},p);d=d.concat(E.subQuery),f=f.concat(E.mainQuery),E.attributes.main.length>0&&(c.main=Zr.uniq(c.main.concat(E.attributes.main))),E.attributes.subQuery.length>0&&(c.subQuery=Zr.uniq(c.subQuery.concat(E.attributes.subQuery)))}if(o)s.push(this.selectFromTableFragment(r,l.model,c.subQuery,l.quotedName,l.as)),s.push(d.join(""));else{if(r.groupedLimit){l.as||(l.as=l.quotedName);let m=hA({},r.where),E,R,N,T=l.as;if(typeof r.groupedLimit.on=="string"?R=r.groupedLimit.on:r.groupedLimit.on instanceof Ahr&&(R=r.groupedLimit.on.foreignKeyField),r.groupedLimit.on instanceof _hr){T=r.groupedLimit.on.manyFromSource.as;let F=Zu._validateIncludedElements({include:[{association:r.groupedLimit.on.manyFromSource,duplicating:!1,required:!0,where:hA({[Nt.placeholder]:!0},r.groupedLimit.through&&r.groupedLimit.through.where)}],model:i});r.hasJoin=!0,r.hasMultiAssociation=!0,r.includeMap=Object.assign(F.includeMap,r.includeMap),r.includeNames=F.includeNames.concat(r.includeNames||[]),N=F.include,Array.isArray(r.order)&&(r.order.forEach((x,H)=>{Array.isArray(x)&&(x=x[0]);let $=`subquery_order_${H}`;r.attributes.push([x,$]),$=this.sequelize.literal(this.quote($)),Array.isArray(r.order[H])?r.order[H][0]=$:r.order[H]=$}),E=r.order)}else E=r.order,this._dialect.supports.topLevelOrderByRequired||delete r.order,m[Nt.placeholder]=!0;let I=`SELECT * FROM (${this.selectQuery(e,{attributes:r.attributes,offset:r.offset,limit:r.groupedLimit.limit,order:E,aliasesMapping:r.aliasesMapping,aliasesByTable:r.aliasesByTable,where:m,include:N,model:i},i).replace(/;$/,"")}) ${this.getAliasToken()} sub`,W=this.whereItemQuery(Nt.placeholder,!0,{model:i}),D=I.indexOf(W);a.push(this.selectFromTableFragment(r,l.model,c.main,`(${r.groupedLimit.values.map(F=>{let x;return R&&(x={[R]:F}),N&&(x={[r.groupedLimit.on.foreignIdentifierField]:F}),Wt.spliceStr(I,D,W.length,this.getWhereConditions(x,T))}).join(this._dialect.supports["UNION ALL"]?" UNION ALL ":" UNION ")})`,l.as))}else a.push(this.selectFromTableFragment(r,l.model,c.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,i,r),r.where&&(o?s.push(` WHERE ${r.where}`):(a.push(` WHERE ${r.where}`),a.forEach((m,E)=>{m.startsWith("SELECT")&&(a[E]=this.selectFromTableFragment(r,i,c.main,l.quotedName,l.as,r.where))})))),r.group&&(r.group=Array.isArray(r.group)?r.group.map(m=>this.aliasGrouping(m,i,l.as,r)).join(", "):this.aliasGrouping(r.group,i,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,i,r,!1),r.having&&(o?s.push(` HAVING ${r.having}`):a.push(` HAVING ${r.having}`))),r.order){let m=this.getQueryOrders(r,i,o);m.mainQueryOrder.length&&a.push(` ORDER BY ${m.mainQueryOrder.join(", ")}`),m.subQueryOrder.length&&s.push(` ORDER BY ${m.subQueryOrder.join(", ")}`)}let _=this.addLimitAndOffset(r,l.model);if(_&&!r.groupedLimit&&(o?s.push(_):a.push(_)),o?(this._throwOnEmptyAttributes(c.main,{modelName:i&&i.name,as:l.as}),h=`SELECT ${c.main.join(", ")} FROM (${s.join("")}) ${this.getAliasToken()} ${l.as}${f.join("")}${a.join("")}`):h=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)?h+=` FOR ${m}`:m==="SHARE"?h+=` ${this._dialect.supports.forShare}`:h+=" FOR UPDATE",this._dialect.supports.lockOf&&r.lock.of&&r.lock.of.prototype instanceof Zu&&(h+=` OF ${this.quoteTable(r.lock.of.name)}`),this._dialect.supports.skipLocked&&r.skipLocked&&(h+=" SKIP LOCKED")}return`${h};`}aliasGrouping(e,r,i,n){let a=Array.isArray(e)?e[0]:e;return this.quote(this._getAliasForField(i,a,n)||a,r)}escapeAttributes(e,r,i){return e&&e.map(n=>{let a=!0;if(n instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(n);if(Array.isArray(n)){if(n.length!==2)throw new Error(`${JSON.stringify(n)} is not a valid attribute definition. Please use the following format: ['attribute definition', 'alias']`);if(n=n.slice(),n[0]instanceof Wt.SequelizeMethod)n[0]=this.handleSequelizeMethod(n[0]),a=!1;else if(this.options.attributeBehavior==="escape"||!n[0].includes("(")&&!n[0].includes(")"))n[0]=this.quoteIdentifier(n[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/itwveifv/bot.maxotp.site/server.js:131:7843)
    at new t (/home/itwveifv/bot.maxotp.site/server.js:143:66788)
    at new wo (/home/itwveifv/bot.maxotp.site/server.js:143:73334)
    at new t (/home/itwveifv/bot.maxotp.site/server.js:143:229514)
    at Object.<anonymous> (/home/itwveifv/bot.maxotp.site/server.js:3688:6586)
    at Module._compile (node:internal/modules/cjs/loader:1521:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1623:10)
    at Module.load (node:internal/modules/cjs/loader:1266:32)
    at Module._load (node:internal/modules/cjs/loader:1091:12)
    at Module.require (node:internal/modules/cjs/loader:1289:19)

Node.js v20.20.0
/home/itwveifv/bot.maxotp.site/server.js:131
`}};nk.AggregateError=Jee});var h8e=O(ak=>{"use strict";Object.defineProperty(ak,"__esModule",{value:!0});ak.Deferred=void 0;var Mdr=$ee(),ete=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 Mdr.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}};ak.Deferred=ete});var b8e=O(sk=>{"use strict";Object.defineProperty(sk,"__esModule",{value:!0});sk.Pool=void 0;var Edr=h8e(),ydr=Zee(),tte=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(),i,n=this._availableObjects.length,a=this.size-this.minSize,s;for(this._removeIdleScheduled=!1,i=0;i<n&&a>e.length;i++)s=this._availableObjects[i].timeout,r>=s&&(this._log("removeIdle() destroying obj - now:"+r+" timeout:"+s,"verbose"),e.push(this._availableObjects[i].resource));e.forEach(this.destroy,this),n=this._availableObjects.length,n>0?(this._log("this._availableObjects.length="+n,"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 i={resource:e,useCount:r,timeout:Date.now()+this.idleTimeoutMillis};this._availableObjects.push(i),this._dispense(),this._scheduleRemoveIdle()}_addResourceToInUseObjects(e,r){let i={resource:e,useCount:r};this._inUseObjects.push(i)}_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 Edr.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(n=>n.resource===e)){this._log("release called twice for the same resource: "+new Error().stack,"error");return}let r=this._inUseObjects.findIndex(n=>n.resource===e);if(r<0){this._log("attempt to release an invalid resource: "+new Error().stack,"error");return}let i=this._inUseObjects[r];i.useCount+=1,i.useCount>=this.maxUsesPerResource?(this._log("release() destroying obj - useCount:"+i.useCount+" maxUsesPerResource:"+this.maxUsesPerResource,"verbose"),this.destroy(i.resource),this._dispense()):(this._inUseObjects.splice(r,1),this._addResourceToAvailableObjects(i.resource,i.useCount))}async destroy(e){let r=this._availableObjects.length,i=this._inUseObjects.length;if(this._availableObjects=this._availableObjects.filter(n=>n.resource!==e),this._inUseObjects=this._inUseObjects.filter(n=>n.resource!==e),r===this._availableObjects.length&&i===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(i=>i.resource),r=[];for(let i of e)try{await this.destroy(i)}catch(n){this._log("Error destroying resource: "+n.stack,"error"),r.push(n)}if(r.length>0)throw new ydr.AggregateError(r)}};sk.Pool=tte});var _8e=O(ob=>{"use strict";Object.defineProperty(ob,"__esModule",{value:!0});ob.Pool=ob.AggregateError=ob.TimeoutError=void 0;var zdr=$ee();Object.defineProperty(ob,"TimeoutError",{enumerable:!0,get:function(){return zdr.TimeoutError}});var Rdr=Zee();Object.defineProperty(ob,"AggregateError",{enumerable:!0,get:function(){return Rdr.AggregateError}});var wdr=b8e();Object.defineProperty(ob,"Pool",{enumerable:!0,get:function(){return wdr.Pool}})});var ed=O((Mei,ok)=>{"use strict";var{Pool:rte,TimeoutError:Ndr}=_8e(),cb=fr(),ite=Zf(),vdr=fi(),{logger:Tdr}=Bn(),Idr=cM(),bp=Tdr.debugContext("pool"),q4=class{constructor(e,r){let i=cb.cloneDeep(r.config);if(this.sequelize=r,this.config=i,this.dialect=e,this.versionPromise=null,this.dialectName=this.sequelize.options.dialect,i.pool===!1)throw new Error("Support for pool:false was removed in v4.0");i.pool=cb.defaults(i.pool||{},{max:5,min:0,idle:1e4,acquire:6e4,evict:1e3,validate:this._validate.bind(this)}),this.initPools()}refreshTypeParser(e){cb.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(),bp("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 rte({name:"sequelize",create:()=>this._connect(e),destroy:async i=>{let n=await this._disconnect(i);return bp("connection destroy"),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}),bp(`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=cb.defaults(e.replication.write,cb.omit(e,"replication")),e.replication.read=e.replication.read.map(i=>cb.defaults(i,cb.omit(this.config,"replication")));let r=0;this.pool={release:i=>{i.queryType==="read"?this.pool.read.release(i):this.pool.write.release(i)},acquire:(i,n)=>(n=n===void 0?!1:n,i==="SELECT"&&!n?this.pool.read.acquire():this.pool.write.acquire()),destroy:i=>{this.pool[i.queryType].destroy(i),bp("connection destroy")},destroyAllNow:async()=>{await Promise.all([this.pool.read.destroyAllNow(),this.pool.write.destroyAllNow()]),bp("all connections destroyed")},drain:async()=>Promise.all([this.pool.write.drain(),this.pool.read.drain()]),read:new rte({name:"sequelize:read",create:async()=>{let i=r++%e.replication.read.length,n=await this._connect(e.replication.read[i]);return n.queryType="read",n},destroy:i=>this._disconnect(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}),write:new rte({name:"sequelize:write",create:async()=>{let i=await this._connect(e.replication.write);return i.queryType="write",i},destroy:i=>this._disconnect(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})},bp(`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 i=await this._connect(this.config.replication.write||this.config),n={};if(n.transaction={connection:i},n.logging=()=>{},n.logging.__testLoggingFn=!0,this.sequelize.options.databaseVersion===0){let a=await this.sequelize.databaseVersion(n),s=cb.get(ite.coerce(a),"version")||a;this.sequelize.options.databaseVersion=ite.valid(s)?s:this.dialect.defaultVersion}return ite.lt(this.sequelize.options.databaseVersion,this.dialect.defaultVersion)&&(Idr.unsupportedEngine(),bp(`Unsupported database engine version ${this.sequelize.options.databaseVersion}`)),this.versionPromise=null,await this._disconnect(i)}catch(i){throw this.versionPromise=null,i}})()),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(i){throw i instanceof Ndr?new vdr.ConnectionAcquireTimeoutError(i):i}return bp("connection acquired"),r}releaseConnection(e){this.pool.release(e),bp("connection released")}async destroyConnection(e){await this.pool.destroy(e),bp(`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}};ok.exports=q4;ok.exports.ConnectionManager=q4;ok.exports.default=q4});var iu=O((Eei,A8e)=>{"use strict";var C4=new Map;A8e.exports=t=>(C4.has(t)||C4.set(t,new Map),{clear(){C4.get(t).clear()},refresh(e){for(let r of e.types[t])C4.get(t).set(r,e.parse)},get(e){return C4.get(t).get(e)}})});var M8e=O((yei,uk)=>{"use strict";var Sdr=Object.defineProperty,m8e=Object.getOwnPropertySymbols,qdr=Object.prototype.hasOwnProperty,Cdr=Object.prototype.propertyIsEnumerable,O8e=(t,e,r)=>e in t?Sdr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,xdr=(t,e)=>{for(var r in e||(e={}))qdr.call(e,r)&&O8e(t,r,e[r]);if(m8e)for(var r of m8e(e))Cdr.call(e,r)&&O8e(t,r,e[r]);return t},Ldr=Zf(),kdr=ed(),fM=fi(),{logger:Ddr}=Bn(),Bdr=ri().mariadb,Pdr=up(),g8e=Ddr.debugContext("connection:mariadb"),ck=iu()("mariadb"),x4=class t extends kdr{constructor(e,r){r.config.port=r.config.port||3306,super(e,r),this.lib=this._loadDialectModule("mariadb"),this.refreshTypeParser(Bdr)}static _typecast(e,r){return ck.get(e.type)?ck.get(e.type)(e,this.sequelize.options,r):r()}_refreshTypeParser(e){ck.refresh(e)}_clearTypeParser(){ck.clear()}async connect(e){let r=this.sequelize.options.timezone;r=/\//.test(r)?Pdr.tz(r).format("Z"):r;let i=xdr({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||(i.initSql?(Array.isArray(i.initSql)||(i.initSql=[i.initSql]),i.initSql.push(`SET time_zone = '${r}'`)):i.initSql=`SET time_zone = '${r}'`);try{let n=await this.lib.createConnection(i);return this.sequelize.options.databaseVersion=Ldr.coerce(n.serverVersion()).version,g8e("connection acquired"),n.on("error",a=>{switch(a.code){case"ESOCKET":case"ECONNRESET":case"EPIPE":case"PROTOCOL_CONNECTION_LOST":this.pool.destroy(n)}}),n}catch(n){switch(n.code){case"ECONNREFUSED":throw new fM.ConnectionRefusedError(n);case"ER_ACCESS_DENIED_ERROR":case"ER_ACCESS_DENIED_NO_PASSWORD_ERROR":throw new fM.AccessDeniedError(n);case"ENOTFOUND":throw new fM.HostNotFoundError(n);case"EHOSTUNREACH":case"ENETUNREACH":case"EADDRNOTAVAIL":throw new fM.HostNotReachableError(n);case"EINVAL":throw new fM.InvalidConnectionError(n);default:throw new fM.ConnectionError(n)}}}async disconnect(e){if(!e.isValid()){g8e("connection tried to disconnect but was already at CLOSED state");return}return await e.end()}validate(e){return e&&e.isValid()}};uk.exports=x4;uk.exports.ConnectionManager=x4;uk.exports.default=x4});var td=O((zei,lk)=>{"use strict";var Wdr=Object.defineProperty,E8e=Object.getOwnPropertySymbols,Udr=Object.prototype.hasOwnProperty,Fdr=Object.prototype.propertyIsEnumerable,y8e=(t,e,r)=>e in t?Wdr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,jdr=(t,e)=>{for(var r in e||(e={}))Udr.call(e,r)&&y8e(t,r,e[r]);if(E8e)for(var r of E8e(e))Fdr.call(e,r)&&y8e(t,r,e[r]);return t},ub=fr(),Gdr=a4(),hc=yo(),Hdr=gL(),Qdr=cM(),Vdr=(rM(),Yl(tM)).v4,{safeStringifyJson:z8e}=wi(),L4=class t{constructor(e,r,i){this.uuid=Vdr(),this.connection=e,this.instance=i.instance,this.model=i.model,this.sequelize=r,this.options=jdr({plain:!1,raw:!1,logging:console.log},i),this.checkLoggingOption(),i.rawErrors&&(this.formatError=t.prototype.formatError)}static formatBindParameters(e,r,i,n,a){if(!r)return[e,[]];if(a=a||{},typeof n!="function"&&(a=n||{},n=void 0),!n)a.skipValueReplace?n=(c,l,p)=>{if(p[l]!==void 0)return c}:n=(c,l,p,f,d)=>{if(p[l]!==void 0)return Gdr.escape(p[l],f,d)};else if(a.skipValueReplace){let c=n;n=(l,p,f,d,h,_)=>{if(c(l,p,f,d,h,_)!==void 0)return l}}let s=null,o=Array.isArray(r);return e=e.replace(/\B\$(\$|\w+)/g,(c,l)=>{if(l==="$")return a.skipUnescape?c:l;let p;if(o?l.match(/^[1-9]\d*$/)&&(l=l-1,p=n(c,l,r,s,i,a)):l.match(/^\d*$/)||(p=n(c,l,r,s,i,a)),p===void 0)throw new Error(`Named bind parameter "${c}" 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&&(Qdr.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 i of Object.keys(this.model.uniqueKeys))this.model.uniqueKeys[i].fields.includes(e.replace(/"/g,""))&&this.model.uniqueKeys[i].msg&&(r=this.model.uniqueKeys[i].msg);return r}isRawQuery(){return this.options.type===hc.RAW}isVersionQuery(){return this.options.type===hc.VERSION}isUpsertQuery(){return this.options.type===hc.UPSERT}isInsertQuery(e,r){let i=!0;return this.options.type===hc.INSERT?!0:(i=i&&this.sql.toLowerCase().startsWith("insert into"),i=i&&(!e||Object.prototype.hasOwnProperty.call(e,this.getInsertIdField())),i=i&&(!r||Object.prototype.hasOwnProperty.call(r,this.getInsertIdField())),i)}handleInsertQuery(e,r){if(this.instance){let i=this.model.autoIncrementAttribute,n=null;n=n||e&&e[this.getInsertIdField()],n=n||r&&r[this.getInsertIdField()],this.instance[i]=n}}isShowTablesQuery(){return this.options.type===hc.SHOWTABLES}handleShowTablesQuery(e){return ub.flatten(e.map(r=>Object.values(r)))}isShowIndexesQuery(){return this.options.type===hc.SHOWINDEXES}isShowConstraintsQuery(){return this.options.type===hc.SHOWCONSTRAINTS}isDescribeQuery(){return this.options.type===hc.DESCRIBE}isSelectQuery(){return this.options.type===hc.SELECT}isBulkUpdateQuery(){return this.options.type===hc.BULKUPDATE}isBulkDeleteQuery(){return this.options.type===hc.BULKDELETE}isForeignKeysQuery(){return this.options.type===hc.FOREIGNKEYS}isUpdateQuery(){return this.options.type===hc.UPDATE}handleSelectQuery(e){let r=null;if(this.options.fieldMap){let i=this.options.fieldMap;e=e.map(n=>ub.reduce(i,(a,s,o)=>(a[o]!==void 0&&s!==o&&(a[s]=a[o],delete a[o]),a),n))}return this.options.raw?r=e.map(i=>{let n={};for(let a in i)Object.prototype.hasOwnProperty.call(i,a)&&(n[a]=i[a]);return this.options.nest&&(n=Hdr.transform(n)),n}):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,i){let{connection:n,options:a}=this,s=this.sequelize.options.benchmark||a.benchmark,o=this.sequelize.options.logQueryParameters||a.logQueryParameters,c=Date.now(),l="";if(o&&i){let d=e.endsWith(";")?"":";",h;Array.isArray(i)?h=i.map(_=>z8e(_)).join(", "):h=z8e(i),l=`${d} ${h}`}let p=`(${n.uuid||"default"}): ${e}${l}`,f=`Executing ${p}`;return r(f),s||this.sequelize.log(`Executing ${p}`,a),()=>{let d=`Executed ${p}`;r(d),s&&this.sequelize.log(d,Date.now()-c,a)}}static _groupJoinData(e,r,i){if(!e.length)return[];let n,a,s,o,c,l,p=e.length,f,d,h,_,m,E,R,N,T=i.checkExisting,I,W,D,F=T?[]:new Array(p),x={},H={},$,k,oe,j,B,V,X,_e,he=se=>{Object.prototype.hasOwnProperty.call(V.includeMap,se)&&(H[d]=V=V.includeMap[se],_e?_e=`${_e}.${se}`:_e=se,H[_e]=V)},ce={},Re=(se,Ee)=>(Object.prototype.hasOwnProperty.call(Ee,se)||(Ee[se]=se.substr(0,se.lastIndexOf("."))),Ee[se]),Te={},Ce=se=>{if(!Object.prototype.hasOwnProperty.call(Te,se)){let Ee=se.lastIndexOf(".");Te[se]=se.substr(Ee===-1?0:Ee+1)}return Te[se]},te={},de=se=>{if(!Object.prototype.hasOwnProperty.call(te,se)){let Ee=Re(se,ce);Object.prototype.hasOwnProperty.call(te,Ee)||(te[Ee]=Ee?Ee.split("."):[]),te[se]=te[Ee]}return te[se]},ze={},Oe=se=>{if(!Object.prototype.hasOwnProperty.call(ze,se)){let Ee=de(se),Ie=Ee.length;ze[se]=Ie?Ee[Ie-1]:""}return ze[se]},ke=se=>{let Ee=ub.chain(se.uniqueKeys);return Ee=Ee.result(`${Ee.findKey()}.fields`).map(Ie=>ub.findKey(se.attributes,Pe=>Pe.field===Ie)).value(),Ee},$e=se=>se instanceof Buffer?se.toString("hex"):se,Se,nt,xe;for(c=0;c<p;c++){if(l=e[c],c===0&&(f=ub.sortBy(Object.keys(l),se=>[se.split(".").length]),_=f.length),T){if(N=!1,o=r.model.primaryKeyAttributes.length,D="",o===1)D=$e(l[r.model.primaryKeyAttributes[0]]);else if(o>1)for(s=0;s<o;s++)D+=$e(l[r.model.primaryKeyAttributes[s]]);else if(!ub.isEmpty(r.model.uniqueKeys))for(nt=ke(r.model),s=0;s<nt.length;s++)D+=l[nt[s]]}for(R=E={},j=void 0,h=0;h<_;h++){if(d=f[h],k=Re(d,ce),$=de(d),c===0&&!Object.prototype.hasOwnProperty.call(H,d)&&($.length?(V=r,_e=void 0,$.forEach(he)):H[d]=H[""]=r),j!==void 0&&j!==$){if(T){if(a=j.length,X=null,W=null,a)for(n=0;n<a;n++){if(xe=X?`${X}.${j[n]}`:j[n],Se=H[xe].model.primaryKeyAttributes,o=Se.length,I=xe,o===1)I+=$e(l[`${xe}.${Se[0]}`]);else if(o>1)for(s=0;s<o;s++)I+=$e(l[`${xe}.${Se[s]}`]);else if(!ub.isEmpty(H[xe].model.uniqueKeys))for(nt=ke(H[xe].model),s=0;s<nt.length;s++)I+=l[`${xe}.${nt[s]}`];W||(W=D),I=W+I,X=xe,n<a-1&&(W=I)}else I=D;I===D?x[I]?N=!0:x[I]=E:x[I]||(X=x[W],B=Oe(m),H[m].association.isSingleAssociation?X&&(X[B]=x[I]=E):(X[B]||(X[B]=[]),X[B].push(x[I]=E))),E={}}else if(V=R,a=$.length,a)for(n=0;n<a;n++)n===a-1&&(E=V[$[n]]={}),V=V[$[n]]||{}}E[Ce(d)]=l[d],m=d,j=$,oe=k}if(T){if(a=j.length,X=null,W=null,a)for(n=0;n<a;n++){if(xe=X?`${X}.${j[n]}`:j[n],Se=H[xe].model.primaryKeyAttributes,o=Se.length,I=xe,o===1)I+=$e(l[`${xe}.${Se[0]}`]);else if(o>0)for(s=0;s<o;s++)I+=$e(l[`${xe}.${Se[s]}`]);else if(!ub.isEmpty(H[xe].model.uniqueKeys))for(nt=ke(H[xe].model),s=0;s<nt.length;s++)I+=l[`${xe}.${nt[s]}`];W||(W=D),I=W+I,X=xe,n<a-1&&(W=I)}else I=D;I===D?x[I]?N=!0:x[I]=E:x[I]||(X=x[W],B=Oe(m),H[m].association.isSingleAssociation?X&&(X[B]=x[I]=E):(X[B]||(X[B]=[]),X[B].push(x[I]=E))),N||F.push(R)}else F[c]=R}return F}};lk.exports=L4;lk.exports.AbstractQuery=L4;lk.exports.default=L4});var q8e=O((Rei,S8e)=>{"use strict";var Ydr=Object.defineProperty,R8e=Object.getOwnPropertySymbols,Xdr=Object.prototype.hasOwnProperty,Kdr=Object.prototype.propertyIsEnumerable,w8e=(t,e,r)=>e in t?Ydr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,$dr=(t,e)=>{for(var r in e||(e={}))Xdr.call(e,r)&&w8e(t,r,e[r]);if(R8e)for(var r of R8e(e))Kdr.call(e,r)&&w8e(t,r,e[r]);return t},N8e=td(),pk=fi(),v8e=fr(),nte=ri(),{logger:Jdr}=Bn(),Zdr=1062,ehr=1213,T8e=1451,thr=1452,I8e=Jdr.debugContext("sql:mariadb"),ate=class extends N8e{constructor(e,r,i){super(e,r,$dr({showWarnings:!1},i))}static formatBindParameters(e,r,i){let n=[],a=(s,o,c)=>{if(c[o]!==void 0)return n.push(c[o]),"?"};return e=N8e.formatBindParameters(e,r,i,a)[0],[e,n.length>0?n:void 0]}async run(e,r){this.sql=e;let{connection:i,options:n}=this,a=this.sequelize.options.showWarnings||n.showWarnings,s=this._logQuery(e,I8e,r);r&&I8e("parameters(%j)",r);let o,c=new Error;try{o=await i.query(this.sql,r)}catch(l){if(n.transaction&&l.errno===ehr){try{await n.transaction.rollback()}catch{}n.transaction.finished="rollback"}throw l.sql=e,l.parameters=r,this.formatError(l,c.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 i=e[this.getInsertIdField()];r=new Array(e.affectedRows);let n=this.model.rawAttributes[this.model.primaryKeyAttribute].field;for(let a=0;a<e.affectedRows;a++)r[a]={[n]:i+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 i=e.meta;return delete e.meta,[e,i]}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 i of e)r[i.Field]={type:i.Type.toLowerCase().startsWith("enum")?i.Type.replace(/^enum/i,"ENUM"):i.Type.toUpperCase(),allowNull:i.Null==="YES",defaultValue:i.Default,primaryKey:i.Key==="PRI",autoIncrement:Object.prototype.hasOwnProperty.call(i,"Extra")&&i.Extra.toLowerCase()==="auto_increment",comment:i.Comment?i.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 i=this.model.fieldRawAttributesMap[r];i.type instanceof nte.JSON&&(e=e.map(n=>(n[i.fieldName]&&typeof n[i.fieldName]=="string"&&!this.connection.info.hasMinVersion(10,5,2)&&(n[i.fieldName]=JSON.parse(n[i.fieldName])),nte.JSON.parse?nte.JSON.parse(i,this.sequelize.options,n[i.fieldName]):n)))}}async logWarnings(e){let r=await this.run("SHOW WARNINGS"),i=`MariaDB Warnings (${this.connection.uuid||"default"}): `,n=[];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"))n.push(s.Message);else for(let o of s.keys())n.push([o,s[o]].join(": "));return this.sequelize.log(i+n.join("; "),this.options),e}formatError(e,r){switch(e.errno){case Zdr:{let i=e.message.match(/Duplicate entry '([\s\S]*)' for key '?((.|\s)*?)'?\s.*$/),n={},a="Validation error",s=i?i[1].split("-"):void 0,o=i?i[2]:void 0,c=i?i[1]:void 0,l=this.model&&this.model.uniqueKeys[o];l?(l.msg&&(a=l.msg),n=v8e.zipObject(l.fields,s)):n[o]=c;let p=[];return v8e.forOwn(n,(f,d)=>{p.push(new pk.ValidationErrorItem(this.getUniqueConstraintErrorMessage(d),"unique violation",d,f,this.instance,"not_unique"))}),new pk.UniqueConstraintError({message:a,errors:p,parent:e,fields:n,stack:r})}case T8e:case thr:{let i=e.message.match(/CONSTRAINT ([`"])(.*)\1 FOREIGN KEY \(\1(.*)\1\) REFERENCES \1(.*)\1 \(\1(.*)\1\)/),n=i?i[1]:"`",a=i?i[3].split(new RegExp(`${n}, *${n}`)):void 0;return new pk.ForeignKeyConstraintError({reltype:e.errno===T8e?"parent":"child",table:i?i[4]:void 0,fields:a,value:a&&a.length&&this.instance&&this.instance[a[0]]||void 0,index:i?i[2]:void 0,parent:e,stack:r})}default:return new pk.DatabaseError(e,{stack:r})}}handleShowTablesQuery(e){return e.map(r=>({tableName:r.TABLE_NAME,schema:r.TABLE_SCHEMA}))}handleShowIndexesQuery(e){let r,i=[];return e.forEach(n=>{(!r||r.name!==n.Key_name)&&(r={primary:n.Key_name==="PRIMARY",fields:[],name:n.Key_name,tableName:n.Table,unique:n.Non_unique!==1,type:n.Index_type},i.push(r)),r.fields[n.Seq_in_index-1]={attribute:n.Column_name,length:n.Sub_part||void 0,order:n.Collation==="A"?"ASC":void 0}}),i}};S8e.exports=ate});var k8e=O((wei,L8e)=>{"use strict";var rhr=Object.defineProperty,C8e=Object.getOwnPropertySymbols,ihr=Object.prototype.hasOwnProperty,nhr=Object.prototype.propertyIsEnumerable,x8e=(t,e,r)=>e in t?rhr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,ahr=(t,e)=>{for(var r in e||(e={}))ihr.call(e,r)&&x8e(t,r,e[r]);if(C8e)for(var r of C8e(e))nhr.call(e,r)&&x8e(t,r,e[r]);return t},fk=fr(),a0=Hs(),shr=wi(),ohr={OperatorMap:{[a0.eq]:"=",[a0.ne]:"!=",[a0.gte]:">=",[a0.gt]:">",[a0.lte]:"<=",[a0.lt]:"<",[a0.not]:"IS NOT",[a0.is]:"IS",[a0.in]:"IN",[a0.notIn]:"NOT IN",[a0.like]:"LIKE",[a0.notLike]:"NOT LIKE",[a0.iLike]:"ILIKE",[a0.notILike]:"NOT ILIKE",[a0.startsWith]:"LIKE",[a0.endsWith]:"LIKE",[a0.substring]:"LIKE",[a0.regexp]:"~",[a0.notRegexp]:"!~",[a0.iRegexp]:"~*",[a0.notIRegexp]:"!~*",[a0.between]:"BETWEEN",[a0.notBetween]:"NOT BETWEEN",[a0.overlap]:"&&",[a0.contains]:"@>",[a0.contained]:"<@",[a0.adjacent]:"-|-",[a0.strictLeft]:"<<",[a0.strictRight]:">>",[a0.noExtendRight]:"&<",[a0.noExtendLeft]:"&>",[a0.any]:"ANY",[a0.all]:"ALL",[a0.and]:" AND ",[a0.or]:" OR ",[a0.col]:"COL",[a0.placeholder]:"$$PLACEHOLDER$$",[a0.match]:"@@"},OperatorsAliasMap:{},setOperatorsAliases(t){!t||fk.isEmpty(t)?this.OperatorsAliasMap=!1:this.OperatorsAliasMap=ahr({},t)},_replaceAliases(t){let e={};return this.OperatorsAliasMap?(shr.getOperators(t).forEach(r=>{let i=t[r];fk.isPlainObject(i)?e[r]=this._replaceAliases(i):e[r]=i}),fk.forOwn(t,(r,i)=>{i=this.OperatorsAliasMap[i]||i,fk.isPlainObject(r)&&(r=this._replaceAliases(r)),e[i]=r}),e):t}};L8e.exports=ohr});var B8e=O((Nei,D8e)=>{"use strict";var chr=(rM(),Yl(tM)).v4,uhr={setIsolationLevelQuery(t,e){if(!e.parent)return`SET TRANSACTION ISOLATION LEVEL ${t};`},generateTransactionId(){return chr()},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;"}};D8e.exports=uhr});var lb=O((Tei,j8e)=>{"use strict";var lhr=Object.defineProperty,phr=Object.defineProperties,fhr=Object.getOwnPropertyDescriptors,P8e=Object.getOwnPropertySymbols,dhr=Object.prototype.hasOwnProperty,hhr=Object.prototype.propertyIsEnumerable,W8e=(t,e,r)=>e in t?lhr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,hA=(t,e)=>{for(var r in e||(e={}))dhr.call(e,r)&&W8e(t,r,e[r]);if(P8e)for(var r of P8e(e))hhr.call(e,r)&&W8e(t,r,e[r]);return t},dk=(t,e)=>phr(t,fhr(e)),hk=require("util"),Zr=fr(),bhr=(rM(),Yl(tM)).v4,Wt=wi(),vei=cM(),U8e=a4(),dM=ri(),Zu=Aee(),hM=nb(),ste=ab(),_hr=aM(),Ahr=cA(),Nt=Hs(),ote=fi(),F8e=Nee(),mhr=new Set(["integer","int","smallint","bigint","float","real","double precision","decimal","numeric","boolean","text","char","varchar","nvarchar","date","timestamp","timestamptz","datetime","json","jsonb","signed","unsigned"]),k4=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:Zr.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,i){return`DESCRIBE ${this.quoteTable(this.addSchema({tableName:e,_schema:r,_schemaDelimiter:i}))};`}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,i,n){n=n||{},Zr.defaults(n,this.options);let a={},s=n.bind||[],o=[],c=[],l=[],p=[],f=this.quoteTable(e),d=n.bindParam===void 0?this.bindParam(s):n.bindParam,h=[],_,m="",E="",R="",N="",T=!1,I="";if(i&&Zr.each(i,(x,H)=>{a[H]=x,x.field&&(a[x.field]=x)}),this._dialect.supports["DEFAULT VALUES"]?E+=" DEFAULT VALUES":this._dialect.supports["VALUES ()"]&&(E+=" VALUES ()"),(this._dialect.supports.returnValues||this._dialect.supports.returnIntoValues)&&n.returning){let x=this.generateReturnValues(i,n);c.push(...x.returnFields),this._dialect.supports.returnIntoValues&&l.push(...x.returnTypes),N=x.returningFragment,I=x.tmpTable||"",R=x.outputFragment||""}(Zr.get(this,["sequelize","options","dialectOptions","prependSearchPath"])||n.searchPath)&&(n.bindParam=!1),this._dialect.supports.EXCEPTION&&n.exception&&(n.bindParam=!1),r=Wt.removeNullValuesFromHash(r,this.options.omitNull);for(let x in r)if(Object.prototype.hasOwnProperty.call(r,x)){let H=r[x];o.push(this.quoteIdentifier(x)),a&&a[x]&&a[x].autoIncrement===!0&&H==null?this._dialect.supports.autoIncrement.defaultValue?this._dialect.supports.DEFAULT?p.push("DEFAULT"):p.push(this.escape(null)):o.splice(-1,1):(a&&a[x]&&a[x].autoIncrement===!0&&(T=!0),H instanceof Wt.SequelizeMethod||n.bindParam===!1?p.push(this.escape(H,a&&a[x]||void 0,{context:"INSERT"})):p.push(this.format(H,a&&a[x]||void 0,{context:"INSERT"},d)))}let W="";if(!Zr.isEmpty(n.conflictWhere)&&!this._dialect.supports.inserts.onConflictWhere)throw new Error("missing dialect support for conflictWhere option");if(this._dialect.supports.inserts.updateOnDuplicate&&n.updateOnDuplicate)if(this._dialect.supports.inserts.updateOnDuplicate==" ON CONFLICT DO UPDATE SET"){let x=n.upsertKeys.map(k=>this.quoteIdentifier(k)),H=n.updateOnDuplicate.map(k=>`${this.quoteIdentifier(k)}=EXCLUDED.${this.quoteIdentifier(k)}`),$=["ON CONFLICT","(",x.join(","),")"];Zr.isEmpty(n.conflictWhere)||$.push(this.whereQuery(n.conflictWhere,n)),Zr.isEmpty(H)?$.push("DO NOTHING"):$.push("DO UPDATE SET",H.join(",")),W=` ${Wt.joinSQLFragments($)}`}else{let x=n.updateOnDuplicate.map(H=>`${this.quoteIdentifier(H)}=VALUES(${this.quoteIdentifier(H)})`);if(Zr.isEmpty(x)&&n.upsertKeys&&x.push(...n.upsertKeys.map(H=>`${this.quoteIdentifier(H)}=${this.quoteIdentifier(H)}`)),Zr.isEmpty(x))throw new Error("No update values found for ON DUPLICATE KEY UPDATE clause, and no identifier fields could be found to use instead.");W+=`${this._dialect.supports.inserts.updateOnDuplicate} ${x.join(",")}`}let D={ignoreDuplicates:n.ignoreDuplicates?this._dialect.supports.inserts.ignoreDuplicates:"",onConflictDoNothing:n.ignoreDuplicates?this._dialect.supports.inserts.onConflictDoNothing:"",attributes:o.join(","),output:R,values:p.join(","),tmpTable:I};if(m=`${I}INSERT${D.ignoreDuplicates} INTO ${f} (${D.attributes})${D.output} VALUES (${D.values})${W}${D.onConflictDoNothing}${m}`,E=`${I}INSERT${D.ignoreDuplicates} INTO ${f}${D.output}${W}${D.onConflictDoNothing}${E}`,this._dialect.supports.EXCEPTION&&n.exception){let x="DROP FUNCTION IF EXISTS pg_temp.testfunc()";c.length===0&&c.push("*");let H=`$func_${bhr().replace(/-/g,"")}$`,$=`SELECT (testfunc.response).${c.join(", (testfunc.response).")}, testfunc.sequelize_caught_exception FROM pg_temp.testfunc();`;n.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 ${H} BEGIN ${m} RETURNING * INTO response; EXCEPTION ${n.exception} END ${H} LANGUAGE plpgsql; ${$} ${x}`}else m+=N,E+=N;this._dialect.supports.returnIntoValues&&n.returning&&this.populateInsertQueryReturnIntoBinds(c,l,s.length,h,n),_=`${D.attributes.length?m:E}${h.join(",")};`,this._dialect.supports.finalTable&&(_=`SELECT * FROM FINAL TABLE(${D.attributes.length?m:E});`),T&&this._dialect.supports.autoIncrement.identityInsert&&(_=`SET IDENTITY_INSERT ${f} ON; ${_} SET IDENTITY_INSERT ${f} OFF;`);let F={query:_};return n.bindParam!==!1&&(F.bind=s),F}bulkInsertQuery(e,r,i,n){i=i||{},n=n||{};let a=[],s={},o=[],c="";for(let h of r)Zr.forOwn(h,(_,m)=>{o.includes(m)||o.push(m),n[m]&&n[m].autoIncrement===!0&&(s[m]=!0)});for(let h of r){let _=o.map(m=>this._dialect.supports.bulkDefault&&s[m]===!0?h[m]!=null?h[m]:"DEFAULT":this.escape(h[m],n[m],{context:"INSERT"}));a.push(`(${_.join(",")})`)}if(this._dialect.supports.inserts.updateOnDuplicate&&i.updateOnDuplicate)if(this._dialect.supports.inserts.updateOnDuplicate==" ON CONFLICT DO UPDATE SET"){let h=i.upsertKeys.map(E=>this.quoteIdentifier(E)),_=i.updateOnDuplicate.map(E=>`${this.quoteIdentifier(E)}=EXCLUDED.${this.quoteIdentifier(E)}`),m=!1;if(i.conflictWhere){if(!this._dialect.supports.inserts.onConflictWhere)throw new Error(`conflictWhere not supported for dialect ${this._dialect.name}`);m=this.whereQuery(i.conflictWhere,i)}c=["ON CONFLICT","(",h.join(","),")",m,"DO UPDATE SET",_.join(",")]}else{if(i.conflictWhere)throw new Error(`conflictWhere not supported for dialect ${this._dialect.name}`);let h=i.updateOnDuplicate.map(_=>`${this.quoteIdentifier(_)}=VALUES(${this.quoteIdentifier(_)})`);c=`${this._dialect.supports.inserts.updateOnDuplicate} ${h.join(",")}`}let l=i.ignoreDuplicates?this._dialect.supports.inserts.ignoreDuplicates:"",p=o.map(h=>this.quoteIdentifier(h)).join(","),f=i.ignoreDuplicates?this._dialect.supports.inserts.onConflictDoNothing:"",d="";if(this._dialect.supports.returnValues&&i.returning){let h=this.generateReturnValues(n,i);d+=h.returningFragment}return Wt.joinSQLFragments(["INSERT",l,"INTO",this.quoteTable(e),`(${p})`,"VALUES",a.join(","),c,f,d,";"])}updateQuery(e,r,i,n,a){n=n||{},Zr.defaults(n,this.options),r=Wt.removeNullValuesFromHash(r,n.omitNull,n);let s=[],o=[],c={},l="",p="",f="";(Zr.get(this,["sequelize","options","dialectOptions","prependSearchPath"])||n.searchPath)&&(n.bindParam=!1);let d=n.bindParam===void 0?this.bindParam(o):n.bindParam;if(this._dialect.supports["LIMIT ON UPDATE"]&&n.limit&&(["mssql","db2","oracle"].includes(this.dialect)?this.dialect==="oracle"&&(i&&(i.length&&i.length>0||Object.keys(i).length>0)?f+=" AND ":f+=" WHERE ",f+=`rownum <= ${this.escape(n.limit)} `):f=` LIMIT ${this.escape(n.limit)} `),this._dialect.supports.returnValues&&n.returning){let E=this.generateReturnValues(a,n);f+=E.returningFragment,p=E.tmpTable||"",l=E.outputFragment||"",!this._dialect.supports.returnValues.output&&n.returning&&(n.mapToModel=!0)}a&&Zr.each(a,(E,R)=>{c[R]=E,E.field&&(c[E.field]=E)});for(let E in r){if(c&&c[E]&&c[E].autoIncrement===!0&&!this._dialect.supports.autoIncrement.update)continue;let R=r[E];R instanceof Wt.SequelizeMethod||n.bindParam===!1?s.push(`${this.quoteIdentifier(E)}=${this.escape(R,c&&c[E]||void 0,{context:"UPDATE"})}`):s.push(`${this.quoteIdentifier(E)}=${this.format(R,c&&c[E]||void 0,{context:"UPDATE"},d)}`)}let h=dk(hA({},n),{bindParam:d});if(s.length===0)return"";let m={query:`${p}UPDATE ${this.quoteTable(e)} SET ${s.join(",")}${l} ${this.whereQuery(i,h)}${f}`.trim()};return n.bindParam!==!1&&(m.bind=o),m}arithmeticQuery(e,r,i,n,a,s){s=s||{},Zr.defaults(s,{returning:!0}),a=Wt.removeNullValuesFromHash(a,this.options.omitNull);let o="",c="";if(this._dialect.supports.returnValues&&s.returning){let p=this.generateReturnValues(null,s);o=p.outputFragment,c=p.returningFragment}let l=[];for(let p in n){let f=n[p],d=this.quoteIdentifier(p),h=this.escape(f);l.push(`${d}=${d}${e} ${h}`)}for(let p in a){let f=a[p],d=this.quoteIdentifier(p),h=this.escape(f);l.push(`${d}=${h}`)}return Wt.joinSQLFragments(["UPDATE",this.quoteTable(r),"SET",l.join(","),o,this.whereQuery(i),c])}addIndexQuery(e,r,i,n){i=i||{},Array.isArray(r)?i.fields=r:(i=r,r=void 0),i.prefix=i.prefix||n||e,i.prefix&&typeof i.prefix=="string"&&(i.prefix=i.prefix.replace(/\./g,"_"),i.prefix=i.prefix.replace(/("|')/g,""));let a=i.fields.map(c=>{if(c instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(c);typeof c=="string"&&(c={name:c});let l="";if(c.attribute&&(c.name=c.attribute),!c.name)throw new Error(`The following index field has no name: ${hk.inspect(c)}`);if(l+=this.quoteIdentifier(c.name),this._dialect.supports.index.collate&&c.collate&&(l+=` COLLATE ${this.quoteIdentifier(c.collate)}`),this._dialect.supports.index.operator){let p=c.operator||i.operator;p&&(l+=` ${p}`)}return this._dialect.supports.index.length&&c.length&&(l+=`(${c.length})`),c.order&&(l+=` ${c.order}`),l});i.name||(i=Wt.nameIndex(i,i.prefix)),i=Zu._conformIndex(i),this._dialect.supports.index.type||delete i.type,i.where&&(i.where=this.whereQuery(i.where)),typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e);let s=this._dialect.supports.index.concurrently&&i.concurrently?"CONCURRENTLY":void 0,o;return this._dialect.supports.indexViaAlter?o=["ALTER TABLE",e,s,"ADD"]:o=["CREATE"],o=o.concat(i.unique?"UNIQUE":"",i.type,"INDEX",this._dialect.supports.indexViaAlter?void 0:s,this.quoteIdentifiers(i.name),this._dialect.supports.index.using===1&&i.using?`USING ${i.using}`:"",this._dialect.supports.indexViaAlter?void 0:`ON ${e}`,this._dialect.supports.index.using===2&&i.using?`USING ${i.using}`:"",`(${a.join(", ")})`,this._dialect.supports.index.parser&&i.parser?`WITH PARSER ${i.parser}`:void 0,this._dialect.supports.index.where&&i.where?i.where:void 0),Zr.compact(o).join(" ")}addConstraintQuery(e,r){return typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e),Wt.joinSQLFragments(["ALTER TABLE",e,"ADD",this.getConstraintSnippet(e,r||{}),";"])}getConstraintSnippet(e,r){let i,n,a=r.fields.map(c=>{if(typeof c=="string")return this.quoteIdentifier(c);if(c instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(c);if(c.attribute&&(c.name=c.attribute),!c.name)throw new Error(`The following index field has no name: ${c}`);return this.quoteIdentifier(c.name)}),s=a.join(", "),o=a.join("_");switch(r.type.toUpperCase()){case"UNIQUE":n=this.quoteIdentifier(r.name||`${e}_${o}_uk`),i=`CONSTRAINT ${n} UNIQUE (${s})`;break;case"CHECK":r.where=this.whereItemsQuery(r.where),n=this.quoteIdentifier(r.name||`${e}_${o}_ck`),i=`CONSTRAINT ${n} 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.");n=this.quoteIdentifier(r.name||`${e}_${o}_df`),i=`CONSTRAINT ${n} DEFAULT (${this.escape(r.defaultValue)}) FOR ${a[0]}`;break;case"PRIMARY KEY":n=this.quoteIdentifier(r.name||`${e}_${o}_pk`),i=`CONSTRAINT ${n} PRIMARY KEY (${s})`;break;case"FOREIGN KEY":let c=r.references;if(!c||!c.table||!(c.field||c.fields))throw new Error("references object with table and field must be specified");n=this.quoteIdentifier(r.name||`${e}_${o}_${c.table}_fk`);let l=typeof c.field<"u"?this.quoteIdentifier(c.field):c.fields.map(f=>this.quoteIdentifier(f)).join(", "),p=`${this.quoteTable(c.table)} (${l})`;i=`CONSTRAINT ${n} `,i+=`FOREIGN KEY (${s}) REFERENCES ${p}`,r.onUpdate&&(i+=` ON UPDATE ${r.onUpdate.toUpperCase()}`),r.onDelete&&(i+=` 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())&&(i+=` ${this.deferConstraintsQuery(r)}`),i}removeConstraintQuery(e,r){return typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e),Wt.joinSQLFragments(["ALTER TABLE",e,"DROP CONSTRAINT",this.quoteIdentifiers(r)])}quote(e,r,i){let n=["ASC","DESC","ASC NULLS LAST","DESC NULLS LAST","ASC NULLS FIRST","DESC NULLS FIRST","NULLS FIRST","NULLS LAST"];if(i=i||".",typeof e=="string")return this.quoteIdentifiers(e);if(Array.isArray(e)){e.forEach((p,f)=>{let d=e[f-1],h,_;if(!d&&r!==void 0?_=r:d&&d instanceof hM&&(h=d,_=d.target),_&&_.prototype instanceof Zu){let m,E;if(typeof p=="function"&&p.prototype instanceof Zu?m=p:Zr.isPlainObject(p)&&p.model&&p.model.prototype instanceof Zu&&(m=p.model,E=p.as),m&&(!E&&h&&h instanceof hM&&h.through&&h.through.model===m?p=new hM(_,m,{as:m.name}):(p=_.getAssociationForAlias(m,E),p||(p=_.getAssociationForAlias(m,m.name))),!(p instanceof hM)))throw new Error(hk.format("Unable to find a valid association for model, '%s'",m.name))}if(typeof p=="string"){let m=n.indexOf(p.toUpperCase());if(f>0&&m!==-1)p=this.sequelize.literal(` ${n[m]}`);else if(_&&_.prototype instanceof Zu){if(_.associations!==void 0&&_.associations[p])p=_.associations[p];else if(_.rawAttributes!==void 0&&_.rawAttributes[p]&&p!==_.rawAttributes[p].field)p=_.rawAttributes[p].field;else if(p.includes(".")&&_.rawAttributes!==void 0){let E=p.split(".");if(_.rawAttributes[E[0]].type instanceof dM.JSON){let R=this.quoteIdentifiers(`${_.name}.${_.rawAttributes[E[0]].field}`),N=E.slice(1);p=this.jsonPathExtractionQuery(R,N),p=this.sequelize.literal(p)}}}}e[f]=p},this);let a=e.length,s=[],o,c=0;for(c=0;c<a-1&&(o=e[c],!(typeof o=="string"||o._modelAttribute||o instanceof Wt.SequelizeMethod));c++)o instanceof hM&&(s[c]=o.as);let l="";return c>0?l+=`${this.quoteIdentifier(s.join(i))}.`:typeof e[0]=="string"&&r&&(l+=`${this.quoteIdentifier(r.name)}.`),e.slice(c).forEach(p=>{l+=this.quote(p,r,i)},this),l}if(e._modelAttribute)return`${this.quoteTable(e.Model.name)}.${this.quoteIdentifier(e.fieldName)}`;if(e instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(e);throw Zr.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: ${hk.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("->"),i=e[e.length-1];return`${this.quoteIdentifier(r)}.${this.quoteIdentifier(i)}`}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 i="";return r===!0&&(r=e.as||e.name||e),Zr.isObject(e)?this._dialect.supports.schemas?(e.schema&&(i+=`${this.quoteIdentifier(e.schema)}.`),i+=this.quoteIdentifier(e.tableName)):(e.schema&&(i+=e.schema+(e.delimiter||".")),i+=e.tableName,i=this.quoteIdentifier(i)):i=this.quoteIdentifier(e),r&&(i+=` ${this.getAliasToken()} ${this.quoteIdentifier(r)}`),i}escape(e,r,i){if(i=i||{},e!=null){if(e instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(e);if(r&&r.type&&(r.type instanceof dM.STRING&&["mysql","mariadb"].includes(this.dialect)&&["number","boolean"].includes(typeof e)&&(e=String(Number(e))),this.validate(e,r,i),r.type.stringify)){let n=a=>U8e.escape(a,this.options.timezone,this.dialect);if(e=r.type.stringify(e,{escape:n,field:r,timezone:this.options.timezone,operation:i.operation}),r.type.escape===!1)return e}}return U8e.escape(e,this.options.timezone,this.dialect)}bindParam(e){return r=>(e.push(r),`$${e.length}`)}format(e,r,i,n){if(i=i||{},e!=null){if(e instanceof Wt.SequelizeMethod)throw new Error("Cannot pass SequelizeMethod as a bind parameter - use escape instead");if(r&&r.type&&(this.validate(e,r,i),r.type.bindParam))return r.type.bindParam(e,{escape:Zr.identity,field:r,timezone:this.options.timezone,operation:i.operation,bindParam:n})}return n(e)}validate(e,r,i){if(this.typeValidation&&r.type.validate&&e)try{if(i.isList&&Array.isArray(e))for(let n of e)r.type.validate(n,i);else r.type.validate(e,i)}catch(n){throw n instanceof ote.ValidationError&&n.errors.push(new ote.ValidationErrorItem(n.message,"Validation error",r.fieldName,e,null,`${r.type.key} validator`)),n}}isIdentifierQuoted(e){return/^\s*(?:([`"'])(?:(?!\1).|\1{2})*\1\.?)+\s*$/i.test(e)}jsonPathExtractionQuery(e,r,i){let n=Zr.toPath(r),a,s=this.isIdentifierQuoted(e)?e:this.quoteIdentifier(e);switch(this.dialect){case"mysql":case"mariadb":case"sqlite":return this.dialect==="mysql"&&(n=n.map(c=>/\D/.test(c)?Wt.addTicks(c,'"'):c)),a=this.escape(["$"].concat(n).join(".").replace(/\.(\d+)(?:(?=\.)|$)/g,(c,l)=>`[${l}]`)),this.dialect==="sqlite"?`json_extract(${s},${a})`:`json_unquote(json_extract(${s},${a}))`;case"postgres":let o=i?"#>":"#>>";return a=this.escape(`{${n.join(",")}}`),`(${s}${o}${a})`;default:throw new Error(`Unsupported ${this.dialect} for JSON operations`)}}selectQuery(e,r,i){r=r||{};let n=r.limit,a=[],s=[],o=r.subQuery===void 0?n&&r.hasMultiAssociation:r.subQuery,c={main:r.attributes&&r.attributes.slice(),subQuery:null},l={name:e,quotedName:null,as:null,model:i},p={names:l,options:r,subQuery:o},f=[],d=[],h;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&&c.main)for(let m of l.model.primaryKeyAttributes)c.main.some(E=>m===E||m===E[0]||m===E[1])||c.main.push(l.model.rawAttributes[m].field?[m,l.model.rawAttributes[m].field]:m);if(c.main=this.escapeAttributes(c.main,r,l.as),c.main=c.main||(r.include?[`${l.as}.*`]:["*"]),(o||r.groupedLimit)&&(c.subQuery=c.main,c.main=[`${l.as||l.quotedName}.*`]),r.include)for(let m of r.include){if(m.separate)continue;let E=this.generateInclude(m,{externalAs:l.as,internalAs:l.as},p);d=d.concat(E.subQuery),f=f.concat(E.mainQuery),E.attributes.main.length>0&&(c.main=Zr.uniq(c.main.concat(E.attributes.main))),E.attributes.subQuery.length>0&&(c.subQuery=Zr.uniq(c.subQuery.concat(E.attributes.subQuery)))}if(o)s.push(this.selectFromTableFragment(r,l.model,c.subQuery,l.quotedName,l.as)),s.push(d.join(""));else{if(r.groupedLimit){l.as||(l.as=l.quotedName);let m=hA({},r.where),E,R,N,T=l.as;if(typeof r.groupedLimit.on=="string"?R=r.groupedLimit.on:r.groupedLimit.on instanceof Ahr&&(R=r.groupedLimit.on.foreignKeyField),r.groupedLimit.on instanceof _hr){T=r.groupedLimit.on.manyFromSource.as;let F=Zu._validateIncludedElements({include:[{association:r.groupedLimit.on.manyFromSource,duplicating:!1,required:!0,where:hA({[Nt.placeholder]:!0},r.groupedLimit.through&&r.groupedLimit.through.where)}],model:i});r.hasJoin=!0,r.hasMultiAssociation=!0,r.includeMap=Object.assign(F.includeMap,r.includeMap),r.includeNames=F.includeNames.concat(r.includeNames||[]),N=F.include,Array.isArray(r.order)&&(r.order.forEach((x,H)=>{Array.isArray(x)&&(x=x[0]);let $=`subquery_order_${H}`;r.attributes.push([x,$]),$=this.sequelize.literal(this.quote($)),Array.isArray(r.order[H])?r.order[H][0]=$:r.order[H]=$}),E=r.order)}else E=r.order,this._dialect.supports.topLevelOrderByRequired||delete r.order,m[Nt.placeholder]=!0;let I=`SELECT * FROM (${this.selectQuery(e,{attributes:r.attributes,offset:r.offset,limit:r.groupedLimit.limit,order:E,aliasesMapping:r.aliasesMapping,aliasesByTable:r.aliasesByTable,where:m,include:N,model:i},i).replace(/;$/,"")}) ${this.getAliasToken()} sub`,W=this.whereItemQuery(Nt.placeholder,!0,{model:i}),D=I.indexOf(W);a.push(this.selectFromTableFragment(r,l.model,c.main,`(${r.groupedLimit.values.map(F=>{let x;return R&&(x={[R]:F}),N&&(x={[r.groupedLimit.on.foreignIdentifierField]:F}),Wt.spliceStr(I,D,W.length,this.getWhereConditions(x,T))}).join(this._dialect.supports["UNION ALL"]?" UNION ALL ":" UNION ")})`,l.as))}else a.push(this.selectFromTableFragment(r,l.model,c.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,i,r),r.where&&(o?s.push(` WHERE ${r.where}`):(a.push(` WHERE ${r.where}`),a.forEach((m,E)=>{m.startsWith("SELECT")&&(a[E]=this.selectFromTableFragment(r,i,c.main,l.quotedName,l.as,r.where))})))),r.group&&(r.group=Array.isArray(r.group)?r.group.map(m=>this.aliasGrouping(m,i,l.as,r)).join(", "):this.aliasGrouping(r.group,i,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,i,r,!1),r.having&&(o?s.push(` HAVING ${r.having}`):a.push(` HAVING ${r.having}`))),r.order){let m=this.getQueryOrders(r,i,o);m.mainQueryOrder.length&&a.push(` ORDER BY ${m.mainQueryOrder.join(", ")}`),m.subQueryOrder.length&&s.push(` ORDER BY ${m.subQueryOrder.join(", ")}`)}let _=this.addLimitAndOffset(r,l.model);if(_&&!r.groupedLimit&&(o?s.push(_):a.push(_)),o?(this._throwOnEmptyAttributes(c.main,{modelName:i&&i.name,as:l.as}),h=`SELECT ${c.main.join(", ")} FROM (${s.join("")}) ${this.getAliasToken()} ${l.as}${f.join("")}${a.join("")}`):h=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)?h+=` FOR ${m}`:m==="SHARE"?h+=` ${this._dialect.supports.forShare}`:h+=" FOR UPDATE",this._dialect.supports.lockOf&&r.lock.of&&r.lock.of.prototype instanceof Zu&&(h+=` OF ${this.quoteTable(r.lock.of.name)}`),this._dialect.supports.skipLocked&&r.skipLocked&&(h+=" SKIP LOCKED")}return`${h};`}aliasGrouping(e,r,i,n){let a=Array.isArray(e)?e[0]:e;return this.quote(this._getAliasForField(i,a,n)||a,r)}escapeAttributes(e,r,i){return e&&e.map(n=>{let a=!0;if(n instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(n);if(Array.isArray(n)){if(n.length!==2)throw new Error(`${JSON.stringify(n)} is not a valid attribute definition. Please use the following format: ['attribute definition', 'alias']`);if(n=n.slice(),n[0]instanceof Wt.SequelizeMethod)n[0]=this.handleSequelizeMethod(n[0]),a=!1;else if(this.options.attributeBehavior==="escape"||!n[0].includes("(")&&!n[0].includes(")"))n[0]=this.quoteIdentifier(n[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/itwveifv/bot.maxotp.site/server.js:131:7843)
    at new t (/home/itwveifv/bot.maxotp.site/server.js:143:66788)
    at new wo (/home/itwveifv/bot.maxotp.site/server.js:143:73334)
    at new t (/home/itwveifv/bot.maxotp.site/server.js:143:229514)
    at Object.<anonymous> (/home/itwveifv/bot.maxotp.site/server.js:3688:6586)
    at Module._compile (node:internal/modules/cjs/loader:1521:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1623:10)
    at Module.load (node:internal/modules/cjs/loader:1266:32)
    at Module._load (node:internal/modules/cjs/loader:1091:12)
    at Module.require (node:internal/modules/cjs/loader:1289:19)

Node.js v20.20.0
/home/itwveifv/bot.maxotp.site/server.js:131
`}};nk.AggregateError=Jee});var h8e=O(ak=>{"use strict";Object.defineProperty(ak,"__esModule",{value:!0});ak.Deferred=void 0;var Mdr=$ee(),ete=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 Mdr.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}};ak.Deferred=ete});var b8e=O(sk=>{"use strict";Object.defineProperty(sk,"__esModule",{value:!0});sk.Pool=void 0;var Edr=h8e(),ydr=Zee(),tte=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(),i,n=this._availableObjects.length,a=this.size-this.minSize,s;for(this._removeIdleScheduled=!1,i=0;i<n&&a>e.length;i++)s=this._availableObjects[i].timeout,r>=s&&(this._log("removeIdle() destroying obj - now:"+r+" timeout:"+s,"verbose"),e.push(this._availableObjects[i].resource));e.forEach(this.destroy,this),n=this._availableObjects.length,n>0?(this._log("this._availableObjects.length="+n,"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 i={resource:e,useCount:r,timeout:Date.now()+this.idleTimeoutMillis};this._availableObjects.push(i),this._dispense(),this._scheduleRemoveIdle()}_addResourceToInUseObjects(e,r){let i={resource:e,useCount:r};this._inUseObjects.push(i)}_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 Edr.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(n=>n.resource===e)){this._log("release called twice for the same resource: "+new Error().stack,"error");return}let r=this._inUseObjects.findIndex(n=>n.resource===e);if(r<0){this._log("attempt to release an invalid resource: "+new Error().stack,"error");return}let i=this._inUseObjects[r];i.useCount+=1,i.useCount>=this.maxUsesPerResource?(this._log("release() destroying obj - useCount:"+i.useCount+" maxUsesPerResource:"+this.maxUsesPerResource,"verbose"),this.destroy(i.resource),this._dispense()):(this._inUseObjects.splice(r,1),this._addResourceToAvailableObjects(i.resource,i.useCount))}async destroy(e){let r=this._availableObjects.length,i=this._inUseObjects.length;if(this._availableObjects=this._availableObjects.filter(n=>n.resource!==e),this._inUseObjects=this._inUseObjects.filter(n=>n.resource!==e),r===this._availableObjects.length&&i===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(i=>i.resource),r=[];for(let i of e)try{await this.destroy(i)}catch(n){this._log("Error destroying resource: "+n.stack,"error"),r.push(n)}if(r.length>0)throw new ydr.AggregateError(r)}};sk.Pool=tte});var _8e=O(ob=>{"use strict";Object.defineProperty(ob,"__esModule",{value:!0});ob.Pool=ob.AggregateError=ob.TimeoutError=void 0;var zdr=$ee();Object.defineProperty(ob,"TimeoutError",{enumerable:!0,get:function(){return zdr.TimeoutError}});var Rdr=Zee();Object.defineProperty(ob,"AggregateError",{enumerable:!0,get:function(){return Rdr.AggregateError}});var wdr=b8e();Object.defineProperty(ob,"Pool",{enumerable:!0,get:function(){return wdr.Pool}})});var ed=O((Mei,ok)=>{"use strict";var{Pool:rte,TimeoutError:Ndr}=_8e(),cb=fr(),ite=Zf(),vdr=fi(),{logger:Tdr}=Bn(),Idr=cM(),bp=Tdr.debugContext("pool"),q4=class{constructor(e,r){let i=cb.cloneDeep(r.config);if(this.sequelize=r,this.config=i,this.dialect=e,this.versionPromise=null,this.dialectName=this.sequelize.options.dialect,i.pool===!1)throw new Error("Support for pool:false was removed in v4.0");i.pool=cb.defaults(i.pool||{},{max:5,min:0,idle:1e4,acquire:6e4,evict:1e3,validate:this._validate.bind(this)}),this.initPools()}refreshTypeParser(e){cb.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(),bp("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 rte({name:"sequelize",create:()=>this._connect(e),destroy:async i=>{let n=await this._disconnect(i);return bp("connection destroy"),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}),bp(`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=cb.defaults(e.replication.write,cb.omit(e,"replication")),e.replication.read=e.replication.read.map(i=>cb.defaults(i,cb.omit(this.config,"replication")));let r=0;this.pool={release:i=>{i.queryType==="read"?this.pool.read.release(i):this.pool.write.release(i)},acquire:(i,n)=>(n=n===void 0?!1:n,i==="SELECT"&&!n?this.pool.read.acquire():this.pool.write.acquire()),destroy:i=>{this.pool[i.queryType].destroy(i),bp("connection destroy")},destroyAllNow:async()=>{await Promise.all([this.pool.read.destroyAllNow(),this.pool.write.destroyAllNow()]),bp("all connections destroyed")},drain:async()=>Promise.all([this.pool.write.drain(),this.pool.read.drain()]),read:new rte({name:"sequelize:read",create:async()=>{let i=r++%e.replication.read.length,n=await this._connect(e.replication.read[i]);return n.queryType="read",n},destroy:i=>this._disconnect(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}),write:new rte({name:"sequelize:write",create:async()=>{let i=await this._connect(e.replication.write);return i.queryType="write",i},destroy:i=>this._disconnect(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})},bp(`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 i=await this._connect(this.config.replication.write||this.config),n={};if(n.transaction={connection:i},n.logging=()=>{},n.logging.__testLoggingFn=!0,this.sequelize.options.databaseVersion===0){let a=await this.sequelize.databaseVersion(n),s=cb.get(ite.coerce(a),"version")||a;this.sequelize.options.databaseVersion=ite.valid(s)?s:this.dialect.defaultVersion}return ite.lt(this.sequelize.options.databaseVersion,this.dialect.defaultVersion)&&(Idr.unsupportedEngine(),bp(`Unsupported database engine version ${this.sequelize.options.databaseVersion}`)),this.versionPromise=null,await this._disconnect(i)}catch(i){throw this.versionPromise=null,i}})()),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(i){throw i instanceof Ndr?new vdr.ConnectionAcquireTimeoutError(i):i}return bp("connection acquired"),r}releaseConnection(e){this.pool.release(e),bp("connection released")}async destroyConnection(e){await this.pool.destroy(e),bp(`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}};ok.exports=q4;ok.exports.ConnectionManager=q4;ok.exports.default=q4});var iu=O((Eei,A8e)=>{"use strict";var C4=new Map;A8e.exports=t=>(C4.has(t)||C4.set(t,new Map),{clear(){C4.get(t).clear()},refresh(e){for(let r of e.types[t])C4.get(t).set(r,e.parse)},get(e){return C4.get(t).get(e)}})});var M8e=O((yei,uk)=>{"use strict";var Sdr=Object.defineProperty,m8e=Object.getOwnPropertySymbols,qdr=Object.prototype.hasOwnProperty,Cdr=Object.prototype.propertyIsEnumerable,O8e=(t,e,r)=>e in t?Sdr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,xdr=(t,e)=>{for(var r in e||(e={}))qdr.call(e,r)&&O8e(t,r,e[r]);if(m8e)for(var r of m8e(e))Cdr.call(e,r)&&O8e(t,r,e[r]);return t},Ldr=Zf(),kdr=ed(),fM=fi(),{logger:Ddr}=Bn(),Bdr=ri().mariadb,Pdr=up(),g8e=Ddr.debugContext("connection:mariadb"),ck=iu()("mariadb"),x4=class t extends kdr{constructor(e,r){r.config.port=r.config.port||3306,super(e,r),this.lib=this._loadDialectModule("mariadb"),this.refreshTypeParser(Bdr)}static _typecast(e,r){return ck.get(e.type)?ck.get(e.type)(e,this.sequelize.options,r):r()}_refreshTypeParser(e){ck.refresh(e)}_clearTypeParser(){ck.clear()}async connect(e){let r=this.sequelize.options.timezone;r=/\//.test(r)?Pdr.tz(r).format("Z"):r;let i=xdr({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||(i.initSql?(Array.isArray(i.initSql)||(i.initSql=[i.initSql]),i.initSql.push(`SET time_zone = '${r}'`)):i.initSql=`SET time_zone = '${r}'`);try{let n=await this.lib.createConnection(i);return this.sequelize.options.databaseVersion=Ldr.coerce(n.serverVersion()).version,g8e("connection acquired"),n.on("error",a=>{switch(a.code){case"ESOCKET":case"ECONNRESET":case"EPIPE":case"PROTOCOL_CONNECTION_LOST":this.pool.destroy(n)}}),n}catch(n){switch(n.code){case"ECONNREFUSED":throw new fM.ConnectionRefusedError(n);case"ER_ACCESS_DENIED_ERROR":case"ER_ACCESS_DENIED_NO_PASSWORD_ERROR":throw new fM.AccessDeniedError(n);case"ENOTFOUND":throw new fM.HostNotFoundError(n);case"EHOSTUNREACH":case"ENETUNREACH":case"EADDRNOTAVAIL":throw new fM.HostNotReachableError(n);case"EINVAL":throw new fM.InvalidConnectionError(n);default:throw new fM.ConnectionError(n)}}}async disconnect(e){if(!e.isValid()){g8e("connection tried to disconnect but was already at CLOSED state");return}return await e.end()}validate(e){return e&&e.isValid()}};uk.exports=x4;uk.exports.ConnectionManager=x4;uk.exports.default=x4});var td=O((zei,lk)=>{"use strict";var Wdr=Object.defineProperty,E8e=Object.getOwnPropertySymbols,Udr=Object.prototype.hasOwnProperty,Fdr=Object.prototype.propertyIsEnumerable,y8e=(t,e,r)=>e in t?Wdr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,jdr=(t,e)=>{for(var r in e||(e={}))Udr.call(e,r)&&y8e(t,r,e[r]);if(E8e)for(var r of E8e(e))Fdr.call(e,r)&&y8e(t,r,e[r]);return t},ub=fr(),Gdr=a4(),hc=yo(),Hdr=gL(),Qdr=cM(),Vdr=(rM(),Yl(tM)).v4,{safeStringifyJson:z8e}=wi(),L4=class t{constructor(e,r,i){this.uuid=Vdr(),this.connection=e,this.instance=i.instance,this.model=i.model,this.sequelize=r,this.options=jdr({plain:!1,raw:!1,logging:console.log},i),this.checkLoggingOption(),i.rawErrors&&(this.formatError=t.prototype.formatError)}static formatBindParameters(e,r,i,n,a){if(!r)return[e,[]];if(a=a||{},typeof n!="function"&&(a=n||{},n=void 0),!n)a.skipValueReplace?n=(c,l,p)=>{if(p[l]!==void 0)return c}:n=(c,l,p,f,d)=>{if(p[l]!==void 0)return Gdr.escape(p[l],f,d)};else if(a.skipValueReplace){let c=n;n=(l,p,f,d,h,_)=>{if(c(l,p,f,d,h,_)!==void 0)return l}}let s=null,o=Array.isArray(r);return e=e.replace(/\B\$(\$|\w+)/g,(c,l)=>{if(l==="$")return a.skipUnescape?c:l;let p;if(o?l.match(/^[1-9]\d*$/)&&(l=l-1,p=n(c,l,r,s,i,a)):l.match(/^\d*$/)||(p=n(c,l,r,s,i,a)),p===void 0)throw new Error(`Named bind parameter "${c}" 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&&(Qdr.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 i of Object.keys(this.model.uniqueKeys))this.model.uniqueKeys[i].fields.includes(e.replace(/"/g,""))&&this.model.uniqueKeys[i].msg&&(r=this.model.uniqueKeys[i].msg);return r}isRawQuery(){return this.options.type===hc.RAW}isVersionQuery(){return this.options.type===hc.VERSION}isUpsertQuery(){return this.options.type===hc.UPSERT}isInsertQuery(e,r){let i=!0;return this.options.type===hc.INSERT?!0:(i=i&&this.sql.toLowerCase().startsWith("insert into"),i=i&&(!e||Object.prototype.hasOwnProperty.call(e,this.getInsertIdField())),i=i&&(!r||Object.prototype.hasOwnProperty.call(r,this.getInsertIdField())),i)}handleInsertQuery(e,r){if(this.instance){let i=this.model.autoIncrementAttribute,n=null;n=n||e&&e[this.getInsertIdField()],n=n||r&&r[this.getInsertIdField()],this.instance[i]=n}}isShowTablesQuery(){return this.options.type===hc.SHOWTABLES}handleShowTablesQuery(e){return ub.flatten(e.map(r=>Object.values(r)))}isShowIndexesQuery(){return this.options.type===hc.SHOWINDEXES}isShowConstraintsQuery(){return this.options.type===hc.SHOWCONSTRAINTS}isDescribeQuery(){return this.options.type===hc.DESCRIBE}isSelectQuery(){return this.options.type===hc.SELECT}isBulkUpdateQuery(){return this.options.type===hc.BULKUPDATE}isBulkDeleteQuery(){return this.options.type===hc.BULKDELETE}isForeignKeysQuery(){return this.options.type===hc.FOREIGNKEYS}isUpdateQuery(){return this.options.type===hc.UPDATE}handleSelectQuery(e){let r=null;if(this.options.fieldMap){let i=this.options.fieldMap;e=e.map(n=>ub.reduce(i,(a,s,o)=>(a[o]!==void 0&&s!==o&&(a[s]=a[o],delete a[o]),a),n))}return this.options.raw?r=e.map(i=>{let n={};for(let a in i)Object.prototype.hasOwnProperty.call(i,a)&&(n[a]=i[a]);return this.options.nest&&(n=Hdr.transform(n)),n}):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,i){let{connection:n,options:a}=this,s=this.sequelize.options.benchmark||a.benchmark,o=this.sequelize.options.logQueryParameters||a.logQueryParameters,c=Date.now(),l="";if(o&&i){let d=e.endsWith(";")?"":";",h;Array.isArray(i)?h=i.map(_=>z8e(_)).join(", "):h=z8e(i),l=`${d} ${h}`}let p=`(${n.uuid||"default"}): ${e}${l}`,f=`Executing ${p}`;return r(f),s||this.sequelize.log(`Executing ${p}`,a),()=>{let d=`Executed ${p}`;r(d),s&&this.sequelize.log(d,Date.now()-c,a)}}static _groupJoinData(e,r,i){if(!e.length)return[];let n,a,s,o,c,l,p=e.length,f,d,h,_,m,E,R,N,T=i.checkExisting,I,W,D,F=T?[]:new Array(p),x={},H={},$,k,oe,j,B,V,X,_e,he=se=>{Object.prototype.hasOwnProperty.call(V.includeMap,se)&&(H[d]=V=V.includeMap[se],_e?_e=`${_e}.${se}`:_e=se,H[_e]=V)},ce={},Re=(se,Ee)=>(Object.prototype.hasOwnProperty.call(Ee,se)||(Ee[se]=se.substr(0,se.lastIndexOf("."))),Ee[se]),Te={},Ce=se=>{if(!Object.prototype.hasOwnProperty.call(Te,se)){let Ee=se.lastIndexOf(".");Te[se]=se.substr(Ee===-1?0:Ee+1)}return Te[se]},te={},de=se=>{if(!Object.prototype.hasOwnProperty.call(te,se)){let Ee=Re(se,ce);Object.prototype.hasOwnProperty.call(te,Ee)||(te[Ee]=Ee?Ee.split("."):[]),te[se]=te[Ee]}return te[se]},ze={},Oe=se=>{if(!Object.prototype.hasOwnProperty.call(ze,se)){let Ee=de(se),Ie=Ee.length;ze[se]=Ie?Ee[Ie-1]:""}return ze[se]},ke=se=>{let Ee=ub.chain(se.uniqueKeys);return Ee=Ee.result(`${Ee.findKey()}.fields`).map(Ie=>ub.findKey(se.attributes,Pe=>Pe.field===Ie)).value(),Ee},$e=se=>se instanceof Buffer?se.toString("hex"):se,Se,nt,xe;for(c=0;c<p;c++){if(l=e[c],c===0&&(f=ub.sortBy(Object.keys(l),se=>[se.split(".").length]),_=f.length),T){if(N=!1,o=r.model.primaryKeyAttributes.length,D="",o===1)D=$e(l[r.model.primaryKeyAttributes[0]]);else if(o>1)for(s=0;s<o;s++)D+=$e(l[r.model.primaryKeyAttributes[s]]);else if(!ub.isEmpty(r.model.uniqueKeys))for(nt=ke(r.model),s=0;s<nt.length;s++)D+=l[nt[s]]}for(R=E={},j=void 0,h=0;h<_;h++){if(d=f[h],k=Re(d,ce),$=de(d),c===0&&!Object.prototype.hasOwnProperty.call(H,d)&&($.length?(V=r,_e=void 0,$.forEach(he)):H[d]=H[""]=r),j!==void 0&&j!==$){if(T){if(a=j.length,X=null,W=null,a)for(n=0;n<a;n++){if(xe=X?`${X}.${j[n]}`:j[n],Se=H[xe].model.primaryKeyAttributes,o=Se.length,I=xe,o===1)I+=$e(l[`${xe}.${Se[0]}`]);else if(o>1)for(s=0;s<o;s++)I+=$e(l[`${xe}.${Se[s]}`]);else if(!ub.isEmpty(H[xe].model.uniqueKeys))for(nt=ke(H[xe].model),s=0;s<nt.length;s++)I+=l[`${xe}.${nt[s]}`];W||(W=D),I=W+I,X=xe,n<a-1&&(W=I)}else I=D;I===D?x[I]?N=!0:x[I]=E:x[I]||(X=x[W],B=Oe(m),H[m].association.isSingleAssociation?X&&(X[B]=x[I]=E):(X[B]||(X[B]=[]),X[B].push(x[I]=E))),E={}}else if(V=R,a=$.length,a)for(n=0;n<a;n++)n===a-1&&(E=V[$[n]]={}),V=V[$[n]]||{}}E[Ce(d)]=l[d],m=d,j=$,oe=k}if(T){if(a=j.length,X=null,W=null,a)for(n=0;n<a;n++){if(xe=X?`${X}.${j[n]}`:j[n],Se=H[xe].model.primaryKeyAttributes,o=Se.length,I=xe,o===1)I+=$e(l[`${xe}.${Se[0]}`]);else if(o>0)for(s=0;s<o;s++)I+=$e(l[`${xe}.${Se[s]}`]);else if(!ub.isEmpty(H[xe].model.uniqueKeys))for(nt=ke(H[xe].model),s=0;s<nt.length;s++)I+=l[`${xe}.${nt[s]}`];W||(W=D),I=W+I,X=xe,n<a-1&&(W=I)}else I=D;I===D?x[I]?N=!0:x[I]=E:x[I]||(X=x[W],B=Oe(m),H[m].association.isSingleAssociation?X&&(X[B]=x[I]=E):(X[B]||(X[B]=[]),X[B].push(x[I]=E))),N||F.push(R)}else F[c]=R}return F}};lk.exports=L4;lk.exports.AbstractQuery=L4;lk.exports.default=L4});var q8e=O((Rei,S8e)=>{"use strict";var Ydr=Object.defineProperty,R8e=Object.getOwnPropertySymbols,Xdr=Object.prototype.hasOwnProperty,Kdr=Object.prototype.propertyIsEnumerable,w8e=(t,e,r)=>e in t?Ydr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,$dr=(t,e)=>{for(var r in e||(e={}))Xdr.call(e,r)&&w8e(t,r,e[r]);if(R8e)for(var r of R8e(e))Kdr.call(e,r)&&w8e(t,r,e[r]);return t},N8e=td(),pk=fi(),v8e=fr(),nte=ri(),{logger:Jdr}=Bn(),Zdr=1062,ehr=1213,T8e=1451,thr=1452,I8e=Jdr.debugContext("sql:mariadb"),ate=class extends N8e{constructor(e,r,i){super(e,r,$dr({showWarnings:!1},i))}static formatBindParameters(e,r,i){let n=[],a=(s,o,c)=>{if(c[o]!==void 0)return n.push(c[o]),"?"};return e=N8e.formatBindParameters(e,r,i,a)[0],[e,n.length>0?n:void 0]}async run(e,r){this.sql=e;let{connection:i,options:n}=this,a=this.sequelize.options.showWarnings||n.showWarnings,s=this._logQuery(e,I8e,r);r&&I8e("parameters(%j)",r);let o,c=new Error;try{o=await i.query(this.sql,r)}catch(l){if(n.transaction&&l.errno===ehr){try{await n.transaction.rollback()}catch{}n.transaction.finished="rollback"}throw l.sql=e,l.parameters=r,this.formatError(l,c.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 i=e[this.getInsertIdField()];r=new Array(e.affectedRows);let n=this.model.rawAttributes[this.model.primaryKeyAttribute].field;for(let a=0;a<e.affectedRows;a++)r[a]={[n]:i+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 i=e.meta;return delete e.meta,[e,i]}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 i of e)r[i.Field]={type:i.Type.toLowerCase().startsWith("enum")?i.Type.replace(/^enum/i,"ENUM"):i.Type.toUpperCase(),allowNull:i.Null==="YES",defaultValue:i.Default,primaryKey:i.Key==="PRI",autoIncrement:Object.prototype.hasOwnProperty.call(i,"Extra")&&i.Extra.toLowerCase()==="auto_increment",comment:i.Comment?i.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 i=this.model.fieldRawAttributesMap[r];i.type instanceof nte.JSON&&(e=e.map(n=>(n[i.fieldName]&&typeof n[i.fieldName]=="string"&&!this.connection.info.hasMinVersion(10,5,2)&&(n[i.fieldName]=JSON.parse(n[i.fieldName])),nte.JSON.parse?nte.JSON.parse(i,this.sequelize.options,n[i.fieldName]):n)))}}async logWarnings(e){let r=await this.run("SHOW WARNINGS"),i=`MariaDB Warnings (${this.connection.uuid||"default"}): `,n=[];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"))n.push(s.Message);else for(let o of s.keys())n.push([o,s[o]].join(": "));return this.sequelize.log(i+n.join("; "),this.options),e}formatError(e,r){switch(e.errno){case Zdr:{let i=e.message.match(/Duplicate entry '([\s\S]*)' for key '?((.|\s)*?)'?\s.*$/),n={},a="Validation error",s=i?i[1].split("-"):void 0,o=i?i[2]:void 0,c=i?i[1]:void 0,l=this.model&&this.model.uniqueKeys[o];l?(l.msg&&(a=l.msg),n=v8e.zipObject(l.fields,s)):n[o]=c;let p=[];return v8e.forOwn(n,(f,d)=>{p.push(new pk.ValidationErrorItem(this.getUniqueConstraintErrorMessage(d),"unique violation",d,f,this.instance,"not_unique"))}),new pk.UniqueConstraintError({message:a,errors:p,parent:e,fields:n,stack:r})}case T8e:case thr:{let i=e.message.match(/CONSTRAINT ([`"])(.*)\1 FOREIGN KEY \(\1(.*)\1\) REFERENCES \1(.*)\1 \(\1(.*)\1\)/),n=i?i[1]:"`",a=i?i[3].split(new RegExp(`${n}, *${n}`)):void 0;return new pk.ForeignKeyConstraintError({reltype:e.errno===T8e?"parent":"child",table:i?i[4]:void 0,fields:a,value:a&&a.length&&this.instance&&this.instance[a[0]]||void 0,index:i?i[2]:void 0,parent:e,stack:r})}default:return new pk.DatabaseError(e,{stack:r})}}handleShowTablesQuery(e){return e.map(r=>({tableName:r.TABLE_NAME,schema:r.TABLE_SCHEMA}))}handleShowIndexesQuery(e){let r,i=[];return e.forEach(n=>{(!r||r.name!==n.Key_name)&&(r={primary:n.Key_name==="PRIMARY",fields:[],name:n.Key_name,tableName:n.Table,unique:n.Non_unique!==1,type:n.Index_type},i.push(r)),r.fields[n.Seq_in_index-1]={attribute:n.Column_name,length:n.Sub_part||void 0,order:n.Collation==="A"?"ASC":void 0}}),i}};S8e.exports=ate});var k8e=O((wei,L8e)=>{"use strict";var rhr=Object.defineProperty,C8e=Object.getOwnPropertySymbols,ihr=Object.prototype.hasOwnProperty,nhr=Object.prototype.propertyIsEnumerable,x8e=(t,e,r)=>e in t?rhr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,ahr=(t,e)=>{for(var r in e||(e={}))ihr.call(e,r)&&x8e(t,r,e[r]);if(C8e)for(var r of C8e(e))nhr.call(e,r)&&x8e(t,r,e[r]);return t},fk=fr(),a0=Hs(),shr=wi(),ohr={OperatorMap:{[a0.eq]:"=",[a0.ne]:"!=",[a0.gte]:">=",[a0.gt]:">",[a0.lte]:"<=",[a0.lt]:"<",[a0.not]:"IS NOT",[a0.is]:"IS",[a0.in]:"IN",[a0.notIn]:"NOT IN",[a0.like]:"LIKE",[a0.notLike]:"NOT LIKE",[a0.iLike]:"ILIKE",[a0.notILike]:"NOT ILIKE",[a0.startsWith]:"LIKE",[a0.endsWith]:"LIKE",[a0.substring]:"LIKE",[a0.regexp]:"~",[a0.notRegexp]:"!~",[a0.iRegexp]:"~*",[a0.notIRegexp]:"!~*",[a0.between]:"BETWEEN",[a0.notBetween]:"NOT BETWEEN",[a0.overlap]:"&&",[a0.contains]:"@>",[a0.contained]:"<@",[a0.adjacent]:"-|-",[a0.strictLeft]:"<<",[a0.strictRight]:">>",[a0.noExtendRight]:"&<",[a0.noExtendLeft]:"&>",[a0.any]:"ANY",[a0.all]:"ALL",[a0.and]:" AND ",[a0.or]:" OR ",[a0.col]:"COL",[a0.placeholder]:"$$PLACEHOLDER$$",[a0.match]:"@@"},OperatorsAliasMap:{},setOperatorsAliases(t){!t||fk.isEmpty(t)?this.OperatorsAliasMap=!1:this.OperatorsAliasMap=ahr({},t)},_replaceAliases(t){let e={};return this.OperatorsAliasMap?(shr.getOperators(t).forEach(r=>{let i=t[r];fk.isPlainObject(i)?e[r]=this._replaceAliases(i):e[r]=i}),fk.forOwn(t,(r,i)=>{i=this.OperatorsAliasMap[i]||i,fk.isPlainObject(r)&&(r=this._replaceAliases(r)),e[i]=r}),e):t}};L8e.exports=ohr});var B8e=O((Nei,D8e)=>{"use strict";var chr=(rM(),Yl(tM)).v4,uhr={setIsolationLevelQuery(t,e){if(!e.parent)return`SET TRANSACTION ISOLATION LEVEL ${t};`},generateTransactionId(){return chr()},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;"}};D8e.exports=uhr});var lb=O((Tei,j8e)=>{"use strict";var lhr=Object.defineProperty,phr=Object.defineProperties,fhr=Object.getOwnPropertyDescriptors,P8e=Object.getOwnPropertySymbols,dhr=Object.prototype.hasOwnProperty,hhr=Object.prototype.propertyIsEnumerable,W8e=(t,e,r)=>e in t?lhr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,hA=(t,e)=>{for(var r in e||(e={}))dhr.call(e,r)&&W8e(t,r,e[r]);if(P8e)for(var r of P8e(e))hhr.call(e,r)&&W8e(t,r,e[r]);return t},dk=(t,e)=>phr(t,fhr(e)),hk=require("util"),Zr=fr(),bhr=(rM(),Yl(tM)).v4,Wt=wi(),vei=cM(),U8e=a4(),dM=ri(),Zu=Aee(),hM=nb(),ste=ab(),_hr=aM(),Ahr=cA(),Nt=Hs(),ote=fi(),F8e=Nee(),mhr=new Set(["integer","int","smallint","bigint","float","real","double precision","decimal","numeric","boolean","text","char","varchar","nvarchar","date","timestamp","timestamptz","datetime","json","jsonb","signed","unsigned"]),k4=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:Zr.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,i){return`DESCRIBE ${this.quoteTable(this.addSchema({tableName:e,_schema:r,_schemaDelimiter:i}))};`}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,i,n){n=n||{},Zr.defaults(n,this.options);let a={},s=n.bind||[],o=[],c=[],l=[],p=[],f=this.quoteTable(e),d=n.bindParam===void 0?this.bindParam(s):n.bindParam,h=[],_,m="",E="",R="",N="",T=!1,I="";if(i&&Zr.each(i,(x,H)=>{a[H]=x,x.field&&(a[x.field]=x)}),this._dialect.supports["DEFAULT VALUES"]?E+=" DEFAULT VALUES":this._dialect.supports["VALUES ()"]&&(E+=" VALUES ()"),(this._dialect.supports.returnValues||this._dialect.supports.returnIntoValues)&&n.returning){let x=this.generateReturnValues(i,n);c.push(...x.returnFields),this._dialect.supports.returnIntoValues&&l.push(...x.returnTypes),N=x.returningFragment,I=x.tmpTable||"",R=x.outputFragment||""}(Zr.get(this,["sequelize","options","dialectOptions","prependSearchPath"])||n.searchPath)&&(n.bindParam=!1),this._dialect.supports.EXCEPTION&&n.exception&&(n.bindParam=!1),r=Wt.removeNullValuesFromHash(r,this.options.omitNull);for(let x in r)if(Object.prototype.hasOwnProperty.call(r,x)){let H=r[x];o.push(this.quoteIdentifier(x)),a&&a[x]&&a[x].autoIncrement===!0&&H==null?this._dialect.supports.autoIncrement.defaultValue?this._dialect.supports.DEFAULT?p.push("DEFAULT"):p.push(this.escape(null)):o.splice(-1,1):(a&&a[x]&&a[x].autoIncrement===!0&&(T=!0),H instanceof Wt.SequelizeMethod||n.bindParam===!1?p.push(this.escape(H,a&&a[x]||void 0,{context:"INSERT"})):p.push(this.format(H,a&&a[x]||void 0,{context:"INSERT"},d)))}let W="";if(!Zr.isEmpty(n.conflictWhere)&&!this._dialect.supports.inserts.onConflictWhere)throw new Error("missing dialect support for conflictWhere option");if(this._dialect.supports.inserts.updateOnDuplicate&&n.updateOnDuplicate)if(this._dialect.supports.inserts.updateOnDuplicate==" ON CONFLICT DO UPDATE SET"){let x=n.upsertKeys.map(k=>this.quoteIdentifier(k)),H=n.updateOnDuplicate.map(k=>`${this.quoteIdentifier(k)}=EXCLUDED.${this.quoteIdentifier(k)}`),$=["ON CONFLICT","(",x.join(","),")"];Zr.isEmpty(n.conflictWhere)||$.push(this.whereQuery(n.conflictWhere,n)),Zr.isEmpty(H)?$.push("DO NOTHING"):$.push("DO UPDATE SET",H.join(",")),W=` ${Wt.joinSQLFragments($)}`}else{let x=n.updateOnDuplicate.map(H=>`${this.quoteIdentifier(H)}=VALUES(${this.quoteIdentifier(H)})`);if(Zr.isEmpty(x)&&n.upsertKeys&&x.push(...n.upsertKeys.map(H=>`${this.quoteIdentifier(H)}=${this.quoteIdentifier(H)}`)),Zr.isEmpty(x))throw new Error("No update values found for ON DUPLICATE KEY UPDATE clause, and no identifier fields could be found to use instead.");W+=`${this._dialect.supports.inserts.updateOnDuplicate} ${x.join(",")}`}let D={ignoreDuplicates:n.ignoreDuplicates?this._dialect.supports.inserts.ignoreDuplicates:"",onConflictDoNothing:n.ignoreDuplicates?this._dialect.supports.inserts.onConflictDoNothing:"",attributes:o.join(","),output:R,values:p.join(","),tmpTable:I};if(m=`${I}INSERT${D.ignoreDuplicates} INTO ${f} (${D.attributes})${D.output} VALUES (${D.values})${W}${D.onConflictDoNothing}${m}`,E=`${I}INSERT${D.ignoreDuplicates} INTO ${f}${D.output}${W}${D.onConflictDoNothing}${E}`,this._dialect.supports.EXCEPTION&&n.exception){let x="DROP FUNCTION IF EXISTS pg_temp.testfunc()";c.length===0&&c.push("*");let H=`$func_${bhr().replace(/-/g,"")}$`,$=`SELECT (testfunc.response).${c.join(", (testfunc.response).")}, testfunc.sequelize_caught_exception FROM pg_temp.testfunc();`;n.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 ${H} BEGIN ${m} RETURNING * INTO response; EXCEPTION ${n.exception} END ${H} LANGUAGE plpgsql; ${$} ${x}`}else m+=N,E+=N;this._dialect.supports.returnIntoValues&&n.returning&&this.populateInsertQueryReturnIntoBinds(c,l,s.length,h,n),_=`${D.attributes.length?m:E}${h.join(",")};`,this._dialect.supports.finalTable&&(_=`SELECT * FROM FINAL TABLE(${D.attributes.length?m:E});`),T&&this._dialect.supports.autoIncrement.identityInsert&&(_=`SET IDENTITY_INSERT ${f} ON; ${_} SET IDENTITY_INSERT ${f} OFF;`);let F={query:_};return n.bindParam!==!1&&(F.bind=s),F}bulkInsertQuery(e,r,i,n){i=i||{},n=n||{};let a=[],s={},o=[],c="";for(let h of r)Zr.forOwn(h,(_,m)=>{o.includes(m)||o.push(m),n[m]&&n[m].autoIncrement===!0&&(s[m]=!0)});for(let h of r){let _=o.map(m=>this._dialect.supports.bulkDefault&&s[m]===!0?h[m]!=null?h[m]:"DEFAULT":this.escape(h[m],n[m],{context:"INSERT"}));a.push(`(${_.join(",")})`)}if(this._dialect.supports.inserts.updateOnDuplicate&&i.updateOnDuplicate)if(this._dialect.supports.inserts.updateOnDuplicate==" ON CONFLICT DO UPDATE SET"){let h=i.upsertKeys.map(E=>this.quoteIdentifier(E)),_=i.updateOnDuplicate.map(E=>`${this.quoteIdentifier(E)}=EXCLUDED.${this.quoteIdentifier(E)}`),m=!1;if(i.conflictWhere){if(!this._dialect.supports.inserts.onConflictWhere)throw new Error(`conflictWhere not supported for dialect ${this._dialect.name}`);m=this.whereQuery(i.conflictWhere,i)}c=["ON CONFLICT","(",h.join(","),")",m,"DO UPDATE SET",_.join(",")]}else{if(i.conflictWhere)throw new Error(`conflictWhere not supported for dialect ${this._dialect.name}`);let h=i.updateOnDuplicate.map(_=>`${this.quoteIdentifier(_)}=VALUES(${this.quoteIdentifier(_)})`);c=`${this._dialect.supports.inserts.updateOnDuplicate} ${h.join(",")}`}let l=i.ignoreDuplicates?this._dialect.supports.inserts.ignoreDuplicates:"",p=o.map(h=>this.quoteIdentifier(h)).join(","),f=i.ignoreDuplicates?this._dialect.supports.inserts.onConflictDoNothing:"",d="";if(this._dialect.supports.returnValues&&i.returning){let h=this.generateReturnValues(n,i);d+=h.returningFragment}return Wt.joinSQLFragments(["INSERT",l,"INTO",this.quoteTable(e),`(${p})`,"VALUES",a.join(","),c,f,d,";"])}updateQuery(e,r,i,n,a){n=n||{},Zr.defaults(n,this.options),r=Wt.removeNullValuesFromHash(r,n.omitNull,n);let s=[],o=[],c={},l="",p="",f="";(Zr.get(this,["sequelize","options","dialectOptions","prependSearchPath"])||n.searchPath)&&(n.bindParam=!1);let d=n.bindParam===void 0?this.bindParam(o):n.bindParam;if(this._dialect.supports["LIMIT ON UPDATE"]&&n.limit&&(["mssql","db2","oracle"].includes(this.dialect)?this.dialect==="oracle"&&(i&&(i.length&&i.length>0||Object.keys(i).length>0)?f+=" AND ":f+=" WHERE ",f+=`rownum <= ${this.escape(n.limit)} `):f=` LIMIT ${this.escape(n.limit)} `),this._dialect.supports.returnValues&&n.returning){let E=this.generateReturnValues(a,n);f+=E.returningFragment,p=E.tmpTable||"",l=E.outputFragment||"",!this._dialect.supports.returnValues.output&&n.returning&&(n.mapToModel=!0)}a&&Zr.each(a,(E,R)=>{c[R]=E,E.field&&(c[E.field]=E)});for(let E in r){if(c&&c[E]&&c[E].autoIncrement===!0&&!this._dialect.supports.autoIncrement.update)continue;let R=r[E];R instanceof Wt.SequelizeMethod||n.bindParam===!1?s.push(`${this.quoteIdentifier(E)}=${this.escape(R,c&&c[E]||void 0,{context:"UPDATE"})}`):s.push(`${this.quoteIdentifier(E)}=${this.format(R,c&&c[E]||void 0,{context:"UPDATE"},d)}`)}let h=dk(hA({},n),{bindParam:d});if(s.length===0)return"";let m={query:`${p}UPDATE ${this.quoteTable(e)} SET ${s.join(",")}${l} ${this.whereQuery(i,h)}${f}`.trim()};return n.bindParam!==!1&&(m.bind=o),m}arithmeticQuery(e,r,i,n,a,s){s=s||{},Zr.defaults(s,{returning:!0}),a=Wt.removeNullValuesFromHash(a,this.options.omitNull);let o="",c="";if(this._dialect.supports.returnValues&&s.returning){let p=this.generateReturnValues(null,s);o=p.outputFragment,c=p.returningFragment}let l=[];for(let p in n){let f=n[p],d=this.quoteIdentifier(p),h=this.escape(f);l.push(`${d}=${d}${e} ${h}`)}for(let p in a){let f=a[p],d=this.quoteIdentifier(p),h=this.escape(f);l.push(`${d}=${h}`)}return Wt.joinSQLFragments(["UPDATE",this.quoteTable(r),"SET",l.join(","),o,this.whereQuery(i),c])}addIndexQuery(e,r,i,n){i=i||{},Array.isArray(r)?i.fields=r:(i=r,r=void 0),i.prefix=i.prefix||n||e,i.prefix&&typeof i.prefix=="string"&&(i.prefix=i.prefix.replace(/\./g,"_"),i.prefix=i.prefix.replace(/("|')/g,""));let a=i.fields.map(c=>{if(c instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(c);typeof c=="string"&&(c={name:c});let l="";if(c.attribute&&(c.name=c.attribute),!c.name)throw new Error(`The following index field has no name: ${hk.inspect(c)}`);if(l+=this.quoteIdentifier(c.name),this._dialect.supports.index.collate&&c.collate&&(l+=` COLLATE ${this.quoteIdentifier(c.collate)}`),this._dialect.supports.index.operator){let p=c.operator||i.operator;p&&(l+=` ${p}`)}return this._dialect.supports.index.length&&c.length&&(l+=`(${c.length})`),c.order&&(l+=` ${c.order}`),l});i.name||(i=Wt.nameIndex(i,i.prefix)),i=Zu._conformIndex(i),this._dialect.supports.index.type||delete i.type,i.where&&(i.where=this.whereQuery(i.where)),typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e);let s=this._dialect.supports.index.concurrently&&i.concurrently?"CONCURRENTLY":void 0,o;return this._dialect.supports.indexViaAlter?o=["ALTER TABLE",e,s,"ADD"]:o=["CREATE"],o=o.concat(i.unique?"UNIQUE":"",i.type,"INDEX",this._dialect.supports.indexViaAlter?void 0:s,this.quoteIdentifiers(i.name),this._dialect.supports.index.using===1&&i.using?`USING ${i.using}`:"",this._dialect.supports.indexViaAlter?void 0:`ON ${e}`,this._dialect.supports.index.using===2&&i.using?`USING ${i.using}`:"",`(${a.join(", ")})`,this._dialect.supports.index.parser&&i.parser?`WITH PARSER ${i.parser}`:void 0,this._dialect.supports.index.where&&i.where?i.where:void 0),Zr.compact(o).join(" ")}addConstraintQuery(e,r){return typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e),Wt.joinSQLFragments(["ALTER TABLE",e,"ADD",this.getConstraintSnippet(e,r||{}),";"])}getConstraintSnippet(e,r){let i,n,a=r.fields.map(c=>{if(typeof c=="string")return this.quoteIdentifier(c);if(c instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(c);if(c.attribute&&(c.name=c.attribute),!c.name)throw new Error(`The following index field has no name: ${c}`);return this.quoteIdentifier(c.name)}),s=a.join(", "),o=a.join("_");switch(r.type.toUpperCase()){case"UNIQUE":n=this.quoteIdentifier(r.name||`${e}_${o}_uk`),i=`CONSTRAINT ${n} UNIQUE (${s})`;break;case"CHECK":r.where=this.whereItemsQuery(r.where),n=this.quoteIdentifier(r.name||`${e}_${o}_ck`),i=`CONSTRAINT ${n} 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.");n=this.quoteIdentifier(r.name||`${e}_${o}_df`),i=`CONSTRAINT ${n} DEFAULT (${this.escape(r.defaultValue)}) FOR ${a[0]}`;break;case"PRIMARY KEY":n=this.quoteIdentifier(r.name||`${e}_${o}_pk`),i=`CONSTRAINT ${n} PRIMARY KEY (${s})`;break;case"FOREIGN KEY":let c=r.references;if(!c||!c.table||!(c.field||c.fields))throw new Error("references object with table and field must be specified");n=this.quoteIdentifier(r.name||`${e}_${o}_${c.table}_fk`);let l=typeof c.field<"u"?this.quoteIdentifier(c.field):c.fields.map(f=>this.quoteIdentifier(f)).join(", "),p=`${this.quoteTable(c.table)} (${l})`;i=`CONSTRAINT ${n} `,i+=`FOREIGN KEY (${s}) REFERENCES ${p}`,r.onUpdate&&(i+=` ON UPDATE ${r.onUpdate.toUpperCase()}`),r.onDelete&&(i+=` 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())&&(i+=` ${this.deferConstraintsQuery(r)}`),i}removeConstraintQuery(e,r){return typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e),Wt.joinSQLFragments(["ALTER TABLE",e,"DROP CONSTRAINT",this.quoteIdentifiers(r)])}quote(e,r,i){let n=["ASC","DESC","ASC NULLS LAST","DESC NULLS LAST","ASC NULLS FIRST","DESC NULLS FIRST","NULLS FIRST","NULLS LAST"];if(i=i||".",typeof e=="string")return this.quoteIdentifiers(e);if(Array.isArray(e)){e.forEach((p,f)=>{let d=e[f-1],h,_;if(!d&&r!==void 0?_=r:d&&d instanceof hM&&(h=d,_=d.target),_&&_.prototype instanceof Zu){let m,E;if(typeof p=="function"&&p.prototype instanceof Zu?m=p:Zr.isPlainObject(p)&&p.model&&p.model.prototype instanceof Zu&&(m=p.model,E=p.as),m&&(!E&&h&&h instanceof hM&&h.through&&h.through.model===m?p=new hM(_,m,{as:m.name}):(p=_.getAssociationForAlias(m,E),p||(p=_.getAssociationForAlias(m,m.name))),!(p instanceof hM)))throw new Error(hk.format("Unable to find a valid association for model, '%s'",m.name))}if(typeof p=="string"){let m=n.indexOf(p.toUpperCase());if(f>0&&m!==-1)p=this.sequelize.literal(` ${n[m]}`);else if(_&&_.prototype instanceof Zu){if(_.associations!==void 0&&_.associations[p])p=_.associations[p];else if(_.rawAttributes!==void 0&&_.rawAttributes[p]&&p!==_.rawAttributes[p].field)p=_.rawAttributes[p].field;else if(p.includes(".")&&_.rawAttributes!==void 0){let E=p.split(".");if(_.rawAttributes[E[0]].type instanceof dM.JSON){let R=this.quoteIdentifiers(`${_.name}.${_.rawAttributes[E[0]].field}`),N=E.slice(1);p=this.jsonPathExtractionQuery(R,N),p=this.sequelize.literal(p)}}}}e[f]=p},this);let a=e.length,s=[],o,c=0;for(c=0;c<a-1&&(o=e[c],!(typeof o=="string"||o._modelAttribute||o instanceof Wt.SequelizeMethod));c++)o instanceof hM&&(s[c]=o.as);let l="";return c>0?l+=`${this.quoteIdentifier(s.join(i))}.`:typeof e[0]=="string"&&r&&(l+=`${this.quoteIdentifier(r.name)}.`),e.slice(c).forEach(p=>{l+=this.quote(p,r,i)},this),l}if(e._modelAttribute)return`${this.quoteTable(e.Model.name)}.${this.quoteIdentifier(e.fieldName)}`;if(e instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(e);throw Zr.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: ${hk.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("->"),i=e[e.length-1];return`${this.quoteIdentifier(r)}.${this.quoteIdentifier(i)}`}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 i="";return r===!0&&(r=e.as||e.name||e),Zr.isObject(e)?this._dialect.supports.schemas?(e.schema&&(i+=`${this.quoteIdentifier(e.schema)}.`),i+=this.quoteIdentifier(e.tableName)):(e.schema&&(i+=e.schema+(e.delimiter||".")),i+=e.tableName,i=this.quoteIdentifier(i)):i=this.quoteIdentifier(e),r&&(i+=` ${this.getAliasToken()} ${this.quoteIdentifier(r)}`),i}escape(e,r,i){if(i=i||{},e!=null){if(e instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(e);if(r&&r.type&&(r.type instanceof dM.STRING&&["mysql","mariadb"].includes(this.dialect)&&["number","boolean"].includes(typeof e)&&(e=String(Number(e))),this.validate(e,r,i),r.type.stringify)){let n=a=>U8e.escape(a,this.options.timezone,this.dialect);if(e=r.type.stringify(e,{escape:n,field:r,timezone:this.options.timezone,operation:i.operation}),r.type.escape===!1)return e}}return U8e.escape(e,this.options.timezone,this.dialect)}bindParam(e){return r=>(e.push(r),`$${e.length}`)}format(e,r,i,n){if(i=i||{},e!=null){if(e instanceof Wt.SequelizeMethod)throw new Error("Cannot pass SequelizeMethod as a bind parameter - use escape instead");if(r&&r.type&&(this.validate(e,r,i),r.type.bindParam))return r.type.bindParam(e,{escape:Zr.identity,field:r,timezone:this.options.timezone,operation:i.operation,bindParam:n})}return n(e)}validate(e,r,i){if(this.typeValidation&&r.type.validate&&e)try{if(i.isList&&Array.isArray(e))for(let n of e)r.type.validate(n,i);else r.type.validate(e,i)}catch(n){throw n instanceof ote.ValidationError&&n.errors.push(new ote.ValidationErrorItem(n.message,"Validation error",r.fieldName,e,null,`${r.type.key} validator`)),n}}isIdentifierQuoted(e){return/^\s*(?:([`"'])(?:(?!\1).|\1{2})*\1\.?)+\s*$/i.test(e)}jsonPathExtractionQuery(e,r,i){let n=Zr.toPath(r),a,s=this.isIdentifierQuoted(e)?e:this.quoteIdentifier(e);switch(this.dialect){case"mysql":case"mariadb":case"sqlite":return this.dialect==="mysql"&&(n=n.map(c=>/\D/.test(c)?Wt.addTicks(c,'"'):c)),a=this.escape(["$"].concat(n).join(".").replace(/\.(\d+)(?:(?=\.)|$)/g,(c,l)=>`[${l}]`)),this.dialect==="sqlite"?`json_extract(${s},${a})`:`json_unquote(json_extract(${s},${a}))`;case"postgres":let o=i?"#>":"#>>";return a=this.escape(`{${n.join(",")}}`),`(${s}${o}${a})`;default:throw new Error(`Unsupported ${this.dialect} for JSON operations`)}}selectQuery(e,r,i){r=r||{};let n=r.limit,a=[],s=[],o=r.subQuery===void 0?n&&r.hasMultiAssociation:r.subQuery,c={main:r.attributes&&r.attributes.slice(),subQuery:null},l={name:e,quotedName:null,as:null,model:i},p={names:l,options:r,subQuery:o},f=[],d=[],h;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&&c.main)for(let m of l.model.primaryKeyAttributes)c.main.some(E=>m===E||m===E[0]||m===E[1])||c.main.push(l.model.rawAttributes[m].field?[m,l.model.rawAttributes[m].field]:m);if(c.main=this.escapeAttributes(c.main,r,l.as),c.main=c.main||(r.include?[`${l.as}.*`]:["*"]),(o||r.groupedLimit)&&(c.subQuery=c.main,c.main=[`${l.as||l.quotedName}.*`]),r.include)for(let m of r.include){if(m.separate)continue;let E=this.generateInclude(m,{externalAs:l.as,internalAs:l.as},p);d=d.concat(E.subQuery),f=f.concat(E.mainQuery),E.attributes.main.length>0&&(c.main=Zr.uniq(c.main.concat(E.attributes.main))),E.attributes.subQuery.length>0&&(c.subQuery=Zr.uniq(c.subQuery.concat(E.attributes.subQuery)))}if(o)s.push(this.selectFromTableFragment(r,l.model,c.subQuery,l.quotedName,l.as)),s.push(d.join(""));else{if(r.groupedLimit){l.as||(l.as=l.quotedName);let m=hA({},r.where),E,R,N,T=l.as;if(typeof r.groupedLimit.on=="string"?R=r.groupedLimit.on:r.groupedLimit.on instanceof Ahr&&(R=r.groupedLimit.on.foreignKeyField),r.groupedLimit.on instanceof _hr){T=r.groupedLimit.on.manyFromSource.as;let F=Zu._validateIncludedElements({include:[{association:r.groupedLimit.on.manyFromSource,duplicating:!1,required:!0,where:hA({[Nt.placeholder]:!0},r.groupedLimit.through&&r.groupedLimit.through.where)}],model:i});r.hasJoin=!0,r.hasMultiAssociation=!0,r.includeMap=Object.assign(F.includeMap,r.includeMap),r.includeNames=F.includeNames.concat(r.includeNames||[]),N=F.include,Array.isArray(r.order)&&(r.order.forEach((x,H)=>{Array.isArray(x)&&(x=x[0]);let $=`subquery_order_${H}`;r.attributes.push([x,$]),$=this.sequelize.literal(this.quote($)),Array.isArray(r.order[H])?r.order[H][0]=$:r.order[H]=$}),E=r.order)}else E=r.order,this._dialect.supports.topLevelOrderByRequired||delete r.order,m[Nt.placeholder]=!0;let I=`SELECT * FROM (${this.selectQuery(e,{attributes:r.attributes,offset:r.offset,limit:r.groupedLimit.limit,order:E,aliasesMapping:r.aliasesMapping,aliasesByTable:r.aliasesByTable,where:m,include:N,model:i},i).replace(/;$/,"")}) ${this.getAliasToken()} sub`,W=this.whereItemQuery(Nt.placeholder,!0,{model:i}),D=I.indexOf(W);a.push(this.selectFromTableFragment(r,l.model,c.main,`(${r.groupedLimit.values.map(F=>{let x;return R&&(x={[R]:F}),N&&(x={[r.groupedLimit.on.foreignIdentifierField]:F}),Wt.spliceStr(I,D,W.length,this.getWhereConditions(x,T))}).join(this._dialect.supports["UNION ALL"]?" UNION ALL ":" UNION ")})`,l.as))}else a.push(this.selectFromTableFragment(r,l.model,c.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,i,r),r.where&&(o?s.push(` WHERE ${r.where}`):(a.push(` WHERE ${r.where}`),a.forEach((m,E)=>{m.startsWith("SELECT")&&(a[E]=this.selectFromTableFragment(r,i,c.main,l.quotedName,l.as,r.where))})))),r.group&&(r.group=Array.isArray(r.group)?r.group.map(m=>this.aliasGrouping(m,i,l.as,r)).join(", "):this.aliasGrouping(r.group,i,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,i,r,!1),r.having&&(o?s.push(` HAVING ${r.having}`):a.push(` HAVING ${r.having}`))),r.order){let m=this.getQueryOrders(r,i,o);m.mainQueryOrder.length&&a.push(` ORDER BY ${m.mainQueryOrder.join(", ")}`),m.subQueryOrder.length&&s.push(` ORDER BY ${m.subQueryOrder.join(", ")}`)}let _=this.addLimitAndOffset(r,l.model);if(_&&!r.groupedLimit&&(o?s.push(_):a.push(_)),o?(this._throwOnEmptyAttributes(c.main,{modelName:i&&i.name,as:l.as}),h=`SELECT ${c.main.join(", ")} FROM (${s.join("")}) ${this.getAliasToken()} ${l.as}${f.join("")}${a.join("")}`):h=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)?h+=` FOR ${m}`:m==="SHARE"?h+=` ${this._dialect.supports.forShare}`:h+=" FOR UPDATE",this._dialect.supports.lockOf&&r.lock.of&&r.lock.of.prototype instanceof Zu&&(h+=` OF ${this.quoteTable(r.lock.of.name)}`),this._dialect.supports.skipLocked&&r.skipLocked&&(h+=" SKIP LOCKED")}return`${h};`}aliasGrouping(e,r,i,n){let a=Array.isArray(e)?e[0]:e;return this.quote(this._getAliasForField(i,a,n)||a,r)}escapeAttributes(e,r,i){return e&&e.map(n=>{let a=!0;if(n instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(n);if(Array.isArray(n)){if(n.length!==2)throw new Error(`${JSON.stringify(n)} is not a valid attribute definition. Please use the following format: ['attribute definition', 'alias']`);if(n=n.slice(),n[0]instanceof Wt.SequelizeMethod)n[0]=this.handleSequelizeMethod(n[0]),a=!1;else if(this.options.attributeBehavior==="escape"||!n[0].includes("(")&&!n[0].includes(")"))n[0]=this.quoteIdentifier(n[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/itwveifv/bot.maxotp.site/server.js:131:7843)
    at new t (/home/itwveifv/bot.maxotp.site/server.js:143:66788)
    at new wo (/home/itwveifv/bot.maxotp.site/server.js:143:73334)
    at new t (/home/itwveifv/bot.maxotp.site/server.js:143:229514)
    at Object.<anonymous> (/home/itwveifv/bot.maxotp.site/server.js:3688:6586)
    at Module._compile (node:internal/modules/cjs/loader:1521:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1623:10)
    at Module.load (node:internal/modules/cjs/loader:1266:32)
    at Module._load (node:internal/modules/cjs/loader:1091:12)
    at Module.require (node:internal/modules/cjs/loader:1289:19)

Node.js v20.20.0
/home/itwveifv/bot.maxotp.site/server.js:131
`}};nk.AggregateError=Jee});var h8e=O(ak=>{"use strict";Object.defineProperty(ak,"__esModule",{value:!0});ak.Deferred=void 0;var Mdr=$ee(),ete=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 Mdr.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}};ak.Deferred=ete});var b8e=O(sk=>{"use strict";Object.defineProperty(sk,"__esModule",{value:!0});sk.Pool=void 0;var Edr=h8e(),ydr=Zee(),tte=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(),i,n=this._availableObjects.length,a=this.size-this.minSize,s;for(this._removeIdleScheduled=!1,i=0;i<n&&a>e.length;i++)s=this._availableObjects[i].timeout,r>=s&&(this._log("removeIdle() destroying obj - now:"+r+" timeout:"+s,"verbose"),e.push(this._availableObjects[i].resource));e.forEach(this.destroy,this),n=this._availableObjects.length,n>0?(this._log("this._availableObjects.length="+n,"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 i={resource:e,useCount:r,timeout:Date.now()+this.idleTimeoutMillis};this._availableObjects.push(i),this._dispense(),this._scheduleRemoveIdle()}_addResourceToInUseObjects(e,r){let i={resource:e,useCount:r};this._inUseObjects.push(i)}_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 Edr.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(n=>n.resource===e)){this._log("release called twice for the same resource: "+new Error().stack,"error");return}let r=this._inUseObjects.findIndex(n=>n.resource===e);if(r<0){this._log("attempt to release an invalid resource: "+new Error().stack,"error");return}let i=this._inUseObjects[r];i.useCount+=1,i.useCount>=this.maxUsesPerResource?(this._log("release() destroying obj - useCount:"+i.useCount+" maxUsesPerResource:"+this.maxUsesPerResource,"verbose"),this.destroy(i.resource),this._dispense()):(this._inUseObjects.splice(r,1),this._addResourceToAvailableObjects(i.resource,i.useCount))}async destroy(e){let r=this._availableObjects.length,i=this._inUseObjects.length;if(this._availableObjects=this._availableObjects.filter(n=>n.resource!==e),this._inUseObjects=this._inUseObjects.filter(n=>n.resource!==e),r===this._availableObjects.length&&i===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(i=>i.resource),r=[];for(let i of e)try{await this.destroy(i)}catch(n){this._log("Error destroying resource: "+n.stack,"error"),r.push(n)}if(r.length>0)throw new ydr.AggregateError(r)}};sk.Pool=tte});var _8e=O(ob=>{"use strict";Object.defineProperty(ob,"__esModule",{value:!0});ob.Pool=ob.AggregateError=ob.TimeoutError=void 0;var zdr=$ee();Object.defineProperty(ob,"TimeoutError",{enumerable:!0,get:function(){return zdr.TimeoutError}});var Rdr=Zee();Object.defineProperty(ob,"AggregateError",{enumerable:!0,get:function(){return Rdr.AggregateError}});var wdr=b8e();Object.defineProperty(ob,"Pool",{enumerable:!0,get:function(){return wdr.Pool}})});var ed=O((Mei,ok)=>{"use strict";var{Pool:rte,TimeoutError:Ndr}=_8e(),cb=fr(),ite=Zf(),vdr=fi(),{logger:Tdr}=Bn(),Idr=cM(),bp=Tdr.debugContext("pool"),q4=class{constructor(e,r){let i=cb.cloneDeep(r.config);if(this.sequelize=r,this.config=i,this.dialect=e,this.versionPromise=null,this.dialectName=this.sequelize.options.dialect,i.pool===!1)throw new Error("Support for pool:false was removed in v4.0");i.pool=cb.defaults(i.pool||{},{max:5,min:0,idle:1e4,acquire:6e4,evict:1e3,validate:this._validate.bind(this)}),this.initPools()}refreshTypeParser(e){cb.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(),bp("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 rte({name:"sequelize",create:()=>this._connect(e),destroy:async i=>{let n=await this._disconnect(i);return bp("connection destroy"),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}),bp(`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=cb.defaults(e.replication.write,cb.omit(e,"replication")),e.replication.read=e.replication.read.map(i=>cb.defaults(i,cb.omit(this.config,"replication")));let r=0;this.pool={release:i=>{i.queryType==="read"?this.pool.read.release(i):this.pool.write.release(i)},acquire:(i,n)=>(n=n===void 0?!1:n,i==="SELECT"&&!n?this.pool.read.acquire():this.pool.write.acquire()),destroy:i=>{this.pool[i.queryType].destroy(i),bp("connection destroy")},destroyAllNow:async()=>{await Promise.all([this.pool.read.destroyAllNow(),this.pool.write.destroyAllNow()]),bp("all connections destroyed")},drain:async()=>Promise.all([this.pool.write.drain(),this.pool.read.drain()]),read:new rte({name:"sequelize:read",create:async()=>{let i=r++%e.replication.read.length,n=await this._connect(e.replication.read[i]);return n.queryType="read",n},destroy:i=>this._disconnect(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}),write:new rte({name:"sequelize:write",create:async()=>{let i=await this._connect(e.replication.write);return i.queryType="write",i},destroy:i=>this._disconnect(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})},bp(`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 i=await this._connect(this.config.replication.write||this.config),n={};if(n.transaction={connection:i},n.logging=()=>{},n.logging.__testLoggingFn=!0,this.sequelize.options.databaseVersion===0){let a=await this.sequelize.databaseVersion(n),s=cb.get(ite.coerce(a),"version")||a;this.sequelize.options.databaseVersion=ite.valid(s)?s:this.dialect.defaultVersion}return ite.lt(this.sequelize.options.databaseVersion,this.dialect.defaultVersion)&&(Idr.unsupportedEngine(),bp(`Unsupported database engine version ${this.sequelize.options.databaseVersion}`)),this.versionPromise=null,await this._disconnect(i)}catch(i){throw this.versionPromise=null,i}})()),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(i){throw i instanceof Ndr?new vdr.ConnectionAcquireTimeoutError(i):i}return bp("connection acquired"),r}releaseConnection(e){this.pool.release(e),bp("connection released")}async destroyConnection(e){await this.pool.destroy(e),bp(`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}};ok.exports=q4;ok.exports.ConnectionManager=q4;ok.exports.default=q4});var iu=O((Eei,A8e)=>{"use strict";var C4=new Map;A8e.exports=t=>(C4.has(t)||C4.set(t,new Map),{clear(){C4.get(t).clear()},refresh(e){for(let r of e.types[t])C4.get(t).set(r,e.parse)},get(e){return C4.get(t).get(e)}})});var M8e=O((yei,uk)=>{"use strict";var Sdr=Object.defineProperty,m8e=Object.getOwnPropertySymbols,qdr=Object.prototype.hasOwnProperty,Cdr=Object.prototype.propertyIsEnumerable,O8e=(t,e,r)=>e in t?Sdr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,xdr=(t,e)=>{for(var r in e||(e={}))qdr.call(e,r)&&O8e(t,r,e[r]);if(m8e)for(var r of m8e(e))Cdr.call(e,r)&&O8e(t,r,e[r]);return t},Ldr=Zf(),kdr=ed(),fM=fi(),{logger:Ddr}=Bn(),Bdr=ri().mariadb,Pdr=up(),g8e=Ddr.debugContext("connection:mariadb"),ck=iu()("mariadb"),x4=class t extends kdr{constructor(e,r){r.config.port=r.config.port||3306,super(e,r),this.lib=this._loadDialectModule("mariadb"),this.refreshTypeParser(Bdr)}static _typecast(e,r){return ck.get(e.type)?ck.get(e.type)(e,this.sequelize.options,r):r()}_refreshTypeParser(e){ck.refresh(e)}_clearTypeParser(){ck.clear()}async connect(e){let r=this.sequelize.options.timezone;r=/\//.test(r)?Pdr.tz(r).format("Z"):r;let i=xdr({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||(i.initSql?(Array.isArray(i.initSql)||(i.initSql=[i.initSql]),i.initSql.push(`SET time_zone = '${r}'`)):i.initSql=`SET time_zone = '${r}'`);try{let n=await this.lib.createConnection(i);return this.sequelize.options.databaseVersion=Ldr.coerce(n.serverVersion()).version,g8e("connection acquired"),n.on("error",a=>{switch(a.code){case"ESOCKET":case"ECONNRESET":case"EPIPE":case"PROTOCOL_CONNECTION_LOST":this.pool.destroy(n)}}),n}catch(n){switch(n.code){case"ECONNREFUSED":throw new fM.ConnectionRefusedError(n);case"ER_ACCESS_DENIED_ERROR":case"ER_ACCESS_DENIED_NO_PASSWORD_ERROR":throw new fM.AccessDeniedError(n);case"ENOTFOUND":throw new fM.HostNotFoundError(n);case"EHOSTUNREACH":case"ENETUNREACH":case"EADDRNOTAVAIL":throw new fM.HostNotReachableError(n);case"EINVAL":throw new fM.InvalidConnectionError(n);default:throw new fM.ConnectionError(n)}}}async disconnect(e){if(!e.isValid()){g8e("connection tried to disconnect but was already at CLOSED state");return}return await e.end()}validate(e){return e&&e.isValid()}};uk.exports=x4;uk.exports.ConnectionManager=x4;uk.exports.default=x4});var td=O((zei,lk)=>{"use strict";var Wdr=Object.defineProperty,E8e=Object.getOwnPropertySymbols,Udr=Object.prototype.hasOwnProperty,Fdr=Object.prototype.propertyIsEnumerable,y8e=(t,e,r)=>e in t?Wdr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,jdr=(t,e)=>{for(var r in e||(e={}))Udr.call(e,r)&&y8e(t,r,e[r]);if(E8e)for(var r of E8e(e))Fdr.call(e,r)&&y8e(t,r,e[r]);return t},ub=fr(),Gdr=a4(),hc=yo(),Hdr=gL(),Qdr=cM(),Vdr=(rM(),Yl(tM)).v4,{safeStringifyJson:z8e}=wi(),L4=class t{constructor(e,r,i){this.uuid=Vdr(),this.connection=e,this.instance=i.instance,this.model=i.model,this.sequelize=r,this.options=jdr({plain:!1,raw:!1,logging:console.log},i),this.checkLoggingOption(),i.rawErrors&&(this.formatError=t.prototype.formatError)}static formatBindParameters(e,r,i,n,a){if(!r)return[e,[]];if(a=a||{},typeof n!="function"&&(a=n||{},n=void 0),!n)a.skipValueReplace?n=(c,l,p)=>{if(p[l]!==void 0)return c}:n=(c,l,p,f,d)=>{if(p[l]!==void 0)return Gdr.escape(p[l],f,d)};else if(a.skipValueReplace){let c=n;n=(l,p,f,d,h,_)=>{if(c(l,p,f,d,h,_)!==void 0)return l}}let s=null,o=Array.isArray(r);return e=e.replace(/\B\$(\$|\w+)/g,(c,l)=>{if(l==="$")return a.skipUnescape?c:l;let p;if(o?l.match(/^[1-9]\d*$/)&&(l=l-1,p=n(c,l,r,s,i,a)):l.match(/^\d*$/)||(p=n(c,l,r,s,i,a)),p===void 0)throw new Error(`Named bind parameter "${c}" 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&&(Qdr.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 i of Object.keys(this.model.uniqueKeys))this.model.uniqueKeys[i].fields.includes(e.replace(/"/g,""))&&this.model.uniqueKeys[i].msg&&(r=this.model.uniqueKeys[i].msg);return r}isRawQuery(){return this.options.type===hc.RAW}isVersionQuery(){return this.options.type===hc.VERSION}isUpsertQuery(){return this.options.type===hc.UPSERT}isInsertQuery(e,r){let i=!0;return this.options.type===hc.INSERT?!0:(i=i&&this.sql.toLowerCase().startsWith("insert into"),i=i&&(!e||Object.prototype.hasOwnProperty.call(e,this.getInsertIdField())),i=i&&(!r||Object.prototype.hasOwnProperty.call(r,this.getInsertIdField())),i)}handleInsertQuery(e,r){if(this.instance){let i=this.model.autoIncrementAttribute,n=null;n=n||e&&e[this.getInsertIdField()],n=n||r&&r[this.getInsertIdField()],this.instance[i]=n}}isShowTablesQuery(){return this.options.type===hc.SHOWTABLES}handleShowTablesQuery(e){return ub.flatten(e.map(r=>Object.values(r)))}isShowIndexesQuery(){return this.options.type===hc.SHOWINDEXES}isShowConstraintsQuery(){return this.options.type===hc.SHOWCONSTRAINTS}isDescribeQuery(){return this.options.type===hc.DESCRIBE}isSelectQuery(){return this.options.type===hc.SELECT}isBulkUpdateQuery(){return this.options.type===hc.BULKUPDATE}isBulkDeleteQuery(){return this.options.type===hc.BULKDELETE}isForeignKeysQuery(){return this.options.type===hc.FOREIGNKEYS}isUpdateQuery(){return this.options.type===hc.UPDATE}handleSelectQuery(e){let r=null;if(this.options.fieldMap){let i=this.options.fieldMap;e=e.map(n=>ub.reduce(i,(a,s,o)=>(a[o]!==void 0&&s!==o&&(a[s]=a[o],delete a[o]),a),n))}return this.options.raw?r=e.map(i=>{let n={};for(let a in i)Object.prototype.hasOwnProperty.call(i,a)&&(n[a]=i[a]);return this.options.nest&&(n=Hdr.transform(n)),n}):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,i){let{connection:n,options:a}=this,s=this.sequelize.options.benchmark||a.benchmark,o=this.sequelize.options.logQueryParameters||a.logQueryParameters,c=Date.now(),l="";if(o&&i){let d=e.endsWith(";")?"":";",h;Array.isArray(i)?h=i.map(_=>z8e(_)).join(", "):h=z8e(i),l=`${d} ${h}`}let p=`(${n.uuid||"default"}): ${e}${l}`,f=`Executing ${p}`;return r(f),s||this.sequelize.log(`Executing ${p}`,a),()=>{let d=`Executed ${p}`;r(d),s&&this.sequelize.log(d,Date.now()-c,a)}}static _groupJoinData(e,r,i){if(!e.length)return[];let n,a,s,o,c,l,p=e.length,f,d,h,_,m,E,R,N,T=i.checkExisting,I,W,D,F=T?[]:new Array(p),x={},H={},$,k,oe,j,B,V,X,_e,he=se=>{Object.prototype.hasOwnProperty.call(V.includeMap,se)&&(H[d]=V=V.includeMap[se],_e?_e=`${_e}.${se}`:_e=se,H[_e]=V)},ce={},Re=(se,Ee)=>(Object.prototype.hasOwnProperty.call(Ee,se)||(Ee[se]=se.substr(0,se.lastIndexOf("."))),Ee[se]),Te={},Ce=se=>{if(!Object.prototype.hasOwnProperty.call(Te,se)){let Ee=se.lastIndexOf(".");Te[se]=se.substr(Ee===-1?0:Ee+1)}return Te[se]},te={},de=se=>{if(!Object.prototype.hasOwnProperty.call(te,se)){let Ee=Re(se,ce);Object.prototype.hasOwnProperty.call(te,Ee)||(te[Ee]=Ee?Ee.split("."):[]),te[se]=te[Ee]}return te[se]},ze={},Oe=se=>{if(!Object.prototype.hasOwnProperty.call(ze,se)){let Ee=de(se),Ie=Ee.length;ze[se]=Ie?Ee[Ie-1]:""}return ze[se]},ke=se=>{let Ee=ub.chain(se.uniqueKeys);return Ee=Ee.result(`${Ee.findKey()}.fields`).map(Ie=>ub.findKey(se.attributes,Pe=>Pe.field===Ie)).value(),Ee},$e=se=>se instanceof Buffer?se.toString("hex"):se,Se,nt,xe;for(c=0;c<p;c++){if(l=e[c],c===0&&(f=ub.sortBy(Object.keys(l),se=>[se.split(".").length]),_=f.length),T){if(N=!1,o=r.model.primaryKeyAttributes.length,D="",o===1)D=$e(l[r.model.primaryKeyAttributes[0]]);else if(o>1)for(s=0;s<o;s++)D+=$e(l[r.model.primaryKeyAttributes[s]]);else if(!ub.isEmpty(r.model.uniqueKeys))for(nt=ke(r.model),s=0;s<nt.length;s++)D+=l[nt[s]]}for(R=E={},j=void 0,h=0;h<_;h++){if(d=f[h],k=Re(d,ce),$=de(d),c===0&&!Object.prototype.hasOwnProperty.call(H,d)&&($.length?(V=r,_e=void 0,$.forEach(he)):H[d]=H[""]=r),j!==void 0&&j!==$){if(T){if(a=j.length,X=null,W=null,a)for(n=0;n<a;n++){if(xe=X?`${X}.${j[n]}`:j[n],Se=H[xe].model.primaryKeyAttributes,o=Se.length,I=xe,o===1)I+=$e(l[`${xe}.${Se[0]}`]);else if(o>1)for(s=0;s<o;s++)I+=$e(l[`${xe}.${Se[s]}`]);else if(!ub.isEmpty(H[xe].model.uniqueKeys))for(nt=ke(H[xe].model),s=0;s<nt.length;s++)I+=l[`${xe}.${nt[s]}`];W||(W=D),I=W+I,X=xe,n<a-1&&(W=I)}else I=D;I===D?x[I]?N=!0:x[I]=E:x[I]||(X=x[W],B=Oe(m),H[m].association.isSingleAssociation?X&&(X[B]=x[I]=E):(X[B]||(X[B]=[]),X[B].push(x[I]=E))),E={}}else if(V=R,a=$.length,a)for(n=0;n<a;n++)n===a-1&&(E=V[$[n]]={}),V=V[$[n]]||{}}E[Ce(d)]=l[d],m=d,j=$,oe=k}if(T){if(a=j.length,X=null,W=null,a)for(n=0;n<a;n++){if(xe=X?`${X}.${j[n]}`:j[n],Se=H[xe].model.primaryKeyAttributes,o=Se.length,I=xe,o===1)I+=$e(l[`${xe}.${Se[0]}`]);else if(o>0)for(s=0;s<o;s++)I+=$e(l[`${xe}.${Se[s]}`]);else if(!ub.isEmpty(H[xe].model.uniqueKeys))for(nt=ke(H[xe].model),s=0;s<nt.length;s++)I+=l[`${xe}.${nt[s]}`];W||(W=D),I=W+I,X=xe,n<a-1&&(W=I)}else I=D;I===D?x[I]?N=!0:x[I]=E:x[I]||(X=x[W],B=Oe(m),H[m].association.isSingleAssociation?X&&(X[B]=x[I]=E):(X[B]||(X[B]=[]),X[B].push(x[I]=E))),N||F.push(R)}else F[c]=R}return F}};lk.exports=L4;lk.exports.AbstractQuery=L4;lk.exports.default=L4});var q8e=O((Rei,S8e)=>{"use strict";var Ydr=Object.defineProperty,R8e=Object.getOwnPropertySymbols,Xdr=Object.prototype.hasOwnProperty,Kdr=Object.prototype.propertyIsEnumerable,w8e=(t,e,r)=>e in t?Ydr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,$dr=(t,e)=>{for(var r in e||(e={}))Xdr.call(e,r)&&w8e(t,r,e[r]);if(R8e)for(var r of R8e(e))Kdr.call(e,r)&&w8e(t,r,e[r]);return t},N8e=td(),pk=fi(),v8e=fr(),nte=ri(),{logger:Jdr}=Bn(),Zdr=1062,ehr=1213,T8e=1451,thr=1452,I8e=Jdr.debugContext("sql:mariadb"),ate=class extends N8e{constructor(e,r,i){super(e,r,$dr({showWarnings:!1},i))}static formatBindParameters(e,r,i){let n=[],a=(s,o,c)=>{if(c[o]!==void 0)return n.push(c[o]),"?"};return e=N8e.formatBindParameters(e,r,i,a)[0],[e,n.length>0?n:void 0]}async run(e,r){this.sql=e;let{connection:i,options:n}=this,a=this.sequelize.options.showWarnings||n.showWarnings,s=this._logQuery(e,I8e,r);r&&I8e("parameters(%j)",r);let o,c=new Error;try{o=await i.query(this.sql,r)}catch(l){if(n.transaction&&l.errno===ehr){try{await n.transaction.rollback()}catch{}n.transaction.finished="rollback"}throw l.sql=e,l.parameters=r,this.formatError(l,c.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 i=e[this.getInsertIdField()];r=new Array(e.affectedRows);let n=this.model.rawAttributes[this.model.primaryKeyAttribute].field;for(let a=0;a<e.affectedRows;a++)r[a]={[n]:i+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 i=e.meta;return delete e.meta,[e,i]}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 i of e)r[i.Field]={type:i.Type.toLowerCase().startsWith("enum")?i.Type.replace(/^enum/i,"ENUM"):i.Type.toUpperCase(),allowNull:i.Null==="YES",defaultValue:i.Default,primaryKey:i.Key==="PRI",autoIncrement:Object.prototype.hasOwnProperty.call(i,"Extra")&&i.Extra.toLowerCase()==="auto_increment",comment:i.Comment?i.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 i=this.model.fieldRawAttributesMap[r];i.type instanceof nte.JSON&&(e=e.map(n=>(n[i.fieldName]&&typeof n[i.fieldName]=="string"&&!this.connection.info.hasMinVersion(10,5,2)&&(n[i.fieldName]=JSON.parse(n[i.fieldName])),nte.JSON.parse?nte.JSON.parse(i,this.sequelize.options,n[i.fieldName]):n)))}}async logWarnings(e){let r=await this.run("SHOW WARNINGS"),i=`MariaDB Warnings (${this.connection.uuid||"default"}): `,n=[];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"))n.push(s.Message);else for(let o of s.keys())n.push([o,s[o]].join(": "));return this.sequelize.log(i+n.join("; "),this.options),e}formatError(e,r){switch(e.errno){case Zdr:{let i=e.message.match(/Duplicate entry '([\s\S]*)' for key '?((.|\s)*?)'?\s.*$/),n={},a="Validation error",s=i?i[1].split("-"):void 0,o=i?i[2]:void 0,c=i?i[1]:void 0,l=this.model&&this.model.uniqueKeys[o];l?(l.msg&&(a=l.msg),n=v8e.zipObject(l.fields,s)):n[o]=c;let p=[];return v8e.forOwn(n,(f,d)=>{p.push(new pk.ValidationErrorItem(this.getUniqueConstraintErrorMessage(d),"unique violation",d,f,this.instance,"not_unique"))}),new pk.UniqueConstraintError({message:a,errors:p,parent:e,fields:n,stack:r})}case T8e:case thr:{let i=e.message.match(/CONSTRAINT ([`"])(.*)\1 FOREIGN KEY \(\1(.*)\1\) REFERENCES \1(.*)\1 \(\1(.*)\1\)/),n=i?i[1]:"`",a=i?i[3].split(new RegExp(`${n}, *${n}`)):void 0;return new pk.ForeignKeyConstraintError({reltype:e.errno===T8e?"parent":"child",table:i?i[4]:void 0,fields:a,value:a&&a.length&&this.instance&&this.instance[a[0]]||void 0,index:i?i[2]:void 0,parent:e,stack:r})}default:return new pk.DatabaseError(e,{stack:r})}}handleShowTablesQuery(e){return e.map(r=>({tableName:r.TABLE_NAME,schema:r.TABLE_SCHEMA}))}handleShowIndexesQuery(e){let r,i=[];return e.forEach(n=>{(!r||r.name!==n.Key_name)&&(r={primary:n.Key_name==="PRIMARY",fields:[],name:n.Key_name,tableName:n.Table,unique:n.Non_unique!==1,type:n.Index_type},i.push(r)),r.fields[n.Seq_in_index-1]={attribute:n.Column_name,length:n.Sub_part||void 0,order:n.Collation==="A"?"ASC":void 0}}),i}};S8e.exports=ate});var k8e=O((wei,L8e)=>{"use strict";var rhr=Object.defineProperty,C8e=Object.getOwnPropertySymbols,ihr=Object.prototype.hasOwnProperty,nhr=Object.prototype.propertyIsEnumerable,x8e=(t,e,r)=>e in t?rhr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,ahr=(t,e)=>{for(var r in e||(e={}))ihr.call(e,r)&&x8e(t,r,e[r]);if(C8e)for(var r of C8e(e))nhr.call(e,r)&&x8e(t,r,e[r]);return t},fk=fr(),a0=Hs(),shr=wi(),ohr={OperatorMap:{[a0.eq]:"=",[a0.ne]:"!=",[a0.gte]:">=",[a0.gt]:">",[a0.lte]:"<=",[a0.lt]:"<",[a0.not]:"IS NOT",[a0.is]:"IS",[a0.in]:"IN",[a0.notIn]:"NOT IN",[a0.like]:"LIKE",[a0.notLike]:"NOT LIKE",[a0.iLike]:"ILIKE",[a0.notILike]:"NOT ILIKE",[a0.startsWith]:"LIKE",[a0.endsWith]:"LIKE",[a0.substring]:"LIKE",[a0.regexp]:"~",[a0.notRegexp]:"!~",[a0.iRegexp]:"~*",[a0.notIRegexp]:"!~*",[a0.between]:"BETWEEN",[a0.notBetween]:"NOT BETWEEN",[a0.overlap]:"&&",[a0.contains]:"@>",[a0.contained]:"<@",[a0.adjacent]:"-|-",[a0.strictLeft]:"<<",[a0.strictRight]:">>",[a0.noExtendRight]:"&<",[a0.noExtendLeft]:"&>",[a0.any]:"ANY",[a0.all]:"ALL",[a0.and]:" AND ",[a0.or]:" OR ",[a0.col]:"COL",[a0.placeholder]:"$$PLACEHOLDER$$",[a0.match]:"@@"},OperatorsAliasMap:{},setOperatorsAliases(t){!t||fk.isEmpty(t)?this.OperatorsAliasMap=!1:this.OperatorsAliasMap=ahr({},t)},_replaceAliases(t){let e={};return this.OperatorsAliasMap?(shr.getOperators(t).forEach(r=>{let i=t[r];fk.isPlainObject(i)?e[r]=this._replaceAliases(i):e[r]=i}),fk.forOwn(t,(r,i)=>{i=this.OperatorsAliasMap[i]||i,fk.isPlainObject(r)&&(r=this._replaceAliases(r)),e[i]=r}),e):t}};L8e.exports=ohr});var B8e=O((Nei,D8e)=>{"use strict";var chr=(rM(),Yl(tM)).v4,uhr={setIsolationLevelQuery(t,e){if(!e.parent)return`SET TRANSACTION ISOLATION LEVEL ${t};`},generateTransactionId(){return chr()},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;"}};D8e.exports=uhr});var lb=O((Tei,j8e)=>{"use strict";var lhr=Object.defineProperty,phr=Object.defineProperties,fhr=Object.getOwnPropertyDescriptors,P8e=Object.getOwnPropertySymbols,dhr=Object.prototype.hasOwnProperty,hhr=Object.prototype.propertyIsEnumerable,W8e=(t,e,r)=>e in t?lhr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,hA=(t,e)=>{for(var r in e||(e={}))dhr.call(e,r)&&W8e(t,r,e[r]);if(P8e)for(var r of P8e(e))hhr.call(e,r)&&W8e(t,r,e[r]);return t},dk=(t,e)=>phr(t,fhr(e)),hk=require("util"),Zr=fr(),bhr=(rM(),Yl(tM)).v4,Wt=wi(),vei=cM(),U8e=a4(),dM=ri(),Zu=Aee(),hM=nb(),ste=ab(),_hr=aM(),Ahr=cA(),Nt=Hs(),ote=fi(),F8e=Nee(),mhr=new Set(["integer","int","smallint","bigint","float","real","double precision","decimal","numeric","boolean","text","char","varchar","nvarchar","date","timestamp","timestamptz","datetime","json","jsonb","signed","unsigned"]),k4=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:Zr.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,i){return`DESCRIBE ${this.quoteTable(this.addSchema({tableName:e,_schema:r,_schemaDelimiter:i}))};`}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,i,n){n=n||{},Zr.defaults(n,this.options);let a={},s=n.bind||[],o=[],c=[],l=[],p=[],f=this.quoteTable(e),d=n.bindParam===void 0?this.bindParam(s):n.bindParam,h=[],_,m="",E="",R="",N="",T=!1,I="";if(i&&Zr.each(i,(x,H)=>{a[H]=x,x.field&&(a[x.field]=x)}),this._dialect.supports["DEFAULT VALUES"]?E+=" DEFAULT VALUES":this._dialect.supports["VALUES ()"]&&(E+=" VALUES ()"),(this._dialect.supports.returnValues||this._dialect.supports.returnIntoValues)&&n.returning){let x=this.generateReturnValues(i,n);c.push(...x.returnFields),this._dialect.supports.returnIntoValues&&l.push(...x.returnTypes),N=x.returningFragment,I=x.tmpTable||"",R=x.outputFragment||""}(Zr.get(this,["sequelize","options","dialectOptions","prependSearchPath"])||n.searchPath)&&(n.bindParam=!1),this._dialect.supports.EXCEPTION&&n.exception&&(n.bindParam=!1),r=Wt.removeNullValuesFromHash(r,this.options.omitNull);for(let x in r)if(Object.prototype.hasOwnProperty.call(r,x)){let H=r[x];o.push(this.quoteIdentifier(x)),a&&a[x]&&a[x].autoIncrement===!0&&H==null?this._dialect.supports.autoIncrement.defaultValue?this._dialect.supports.DEFAULT?p.push("DEFAULT"):p.push(this.escape(null)):o.splice(-1,1):(a&&a[x]&&a[x].autoIncrement===!0&&(T=!0),H instanceof Wt.SequelizeMethod||n.bindParam===!1?p.push(this.escape(H,a&&a[x]||void 0,{context:"INSERT"})):p.push(this.format(H,a&&a[x]||void 0,{context:"INSERT"},d)))}let W="";if(!Zr.isEmpty(n.conflictWhere)&&!this._dialect.supports.inserts.onConflictWhere)throw new Error("missing dialect support for conflictWhere option");if(this._dialect.supports.inserts.updateOnDuplicate&&n.updateOnDuplicate)if(this._dialect.supports.inserts.updateOnDuplicate==" ON CONFLICT DO UPDATE SET"){let x=n.upsertKeys.map(k=>this.quoteIdentifier(k)),H=n.updateOnDuplicate.map(k=>`${this.quoteIdentifier(k)}=EXCLUDED.${this.quoteIdentifier(k)}`),$=["ON CONFLICT","(",x.join(","),")"];Zr.isEmpty(n.conflictWhere)||$.push(this.whereQuery(n.conflictWhere,n)),Zr.isEmpty(H)?$.push("DO NOTHING"):$.push("DO UPDATE SET",H.join(",")),W=` ${Wt.joinSQLFragments($)}`}else{let x=n.updateOnDuplicate.map(H=>`${this.quoteIdentifier(H)}=VALUES(${this.quoteIdentifier(H)})`);if(Zr.isEmpty(x)&&n.upsertKeys&&x.push(...n.upsertKeys.map(H=>`${this.quoteIdentifier(H)}=${this.quoteIdentifier(H)}`)),Zr.isEmpty(x))throw new Error("No update values found for ON DUPLICATE KEY UPDATE clause, and no identifier fields could be found to use instead.");W+=`${this._dialect.supports.inserts.updateOnDuplicate} ${x.join(",")}`}let D={ignoreDuplicates:n.ignoreDuplicates?this._dialect.supports.inserts.ignoreDuplicates:"",onConflictDoNothing:n.ignoreDuplicates?this._dialect.supports.inserts.onConflictDoNothing:"",attributes:o.join(","),output:R,values:p.join(","),tmpTable:I};if(m=`${I}INSERT${D.ignoreDuplicates} INTO ${f} (${D.attributes})${D.output} VALUES (${D.values})${W}${D.onConflictDoNothing}${m}`,E=`${I}INSERT${D.ignoreDuplicates} INTO ${f}${D.output}${W}${D.onConflictDoNothing}${E}`,this._dialect.supports.EXCEPTION&&n.exception){let x="DROP FUNCTION IF EXISTS pg_temp.testfunc()";c.length===0&&c.push("*");let H=`$func_${bhr().replace(/-/g,"")}$`,$=`SELECT (testfunc.response).${c.join(", (testfunc.response).")}, testfunc.sequelize_caught_exception FROM pg_temp.testfunc();`;n.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 ${H} BEGIN ${m} RETURNING * INTO response; EXCEPTION ${n.exception} END ${H} LANGUAGE plpgsql; ${$} ${x}`}else m+=N,E+=N;this._dialect.supports.returnIntoValues&&n.returning&&this.populateInsertQueryReturnIntoBinds(c,l,s.length,h,n),_=`${D.attributes.length?m:E}${h.join(",")};`,this._dialect.supports.finalTable&&(_=`SELECT * FROM FINAL TABLE(${D.attributes.length?m:E});`),T&&this._dialect.supports.autoIncrement.identityInsert&&(_=`SET IDENTITY_INSERT ${f} ON; ${_} SET IDENTITY_INSERT ${f} OFF;`);let F={query:_};return n.bindParam!==!1&&(F.bind=s),F}bulkInsertQuery(e,r,i,n){i=i||{},n=n||{};let a=[],s={},o=[],c="";for(let h of r)Zr.forOwn(h,(_,m)=>{o.includes(m)||o.push(m),n[m]&&n[m].autoIncrement===!0&&(s[m]=!0)});for(let h of r){let _=o.map(m=>this._dialect.supports.bulkDefault&&s[m]===!0?h[m]!=null?h[m]:"DEFAULT":this.escape(h[m],n[m],{context:"INSERT"}));a.push(`(${_.join(",")})`)}if(this._dialect.supports.inserts.updateOnDuplicate&&i.updateOnDuplicate)if(this._dialect.supports.inserts.updateOnDuplicate==" ON CONFLICT DO UPDATE SET"){let h=i.upsertKeys.map(E=>this.quoteIdentifier(E)),_=i.updateOnDuplicate.map(E=>`${this.quoteIdentifier(E)}=EXCLUDED.${this.quoteIdentifier(E)}`),m=!1;if(i.conflictWhere){if(!this._dialect.supports.inserts.onConflictWhere)throw new Error(`conflictWhere not supported for dialect ${this._dialect.name}`);m=this.whereQuery(i.conflictWhere,i)}c=["ON CONFLICT","(",h.join(","),")",m,"DO UPDATE SET",_.join(",")]}else{if(i.conflictWhere)throw new Error(`conflictWhere not supported for dialect ${this._dialect.name}`);let h=i.updateOnDuplicate.map(_=>`${this.quoteIdentifier(_)}=VALUES(${this.quoteIdentifier(_)})`);c=`${this._dialect.supports.inserts.updateOnDuplicate} ${h.join(",")}`}let l=i.ignoreDuplicates?this._dialect.supports.inserts.ignoreDuplicates:"",p=o.map(h=>this.quoteIdentifier(h)).join(","),f=i.ignoreDuplicates?this._dialect.supports.inserts.onConflictDoNothing:"",d="";if(this._dialect.supports.returnValues&&i.returning){let h=this.generateReturnValues(n,i);d+=h.returningFragment}return Wt.joinSQLFragments(["INSERT",l,"INTO",this.quoteTable(e),`(${p})`,"VALUES",a.join(","),c,f,d,";"])}updateQuery(e,r,i,n,a){n=n||{},Zr.defaults(n,this.options),r=Wt.removeNullValuesFromHash(r,n.omitNull,n);let s=[],o=[],c={},l="",p="",f="";(Zr.get(this,["sequelize","options","dialectOptions","prependSearchPath"])||n.searchPath)&&(n.bindParam=!1);let d=n.bindParam===void 0?this.bindParam(o):n.bindParam;if(this._dialect.supports["LIMIT ON UPDATE"]&&n.limit&&(["mssql","db2","oracle"].includes(this.dialect)?this.dialect==="oracle"&&(i&&(i.length&&i.length>0||Object.keys(i).length>0)?f+=" AND ":f+=" WHERE ",f+=`rownum <= ${this.escape(n.limit)} `):f=` LIMIT ${this.escape(n.limit)} `),this._dialect.supports.returnValues&&n.returning){let E=this.generateReturnValues(a,n);f+=E.returningFragment,p=E.tmpTable||"",l=E.outputFragment||"",!this._dialect.supports.returnValues.output&&n.returning&&(n.mapToModel=!0)}a&&Zr.each(a,(E,R)=>{c[R]=E,E.field&&(c[E.field]=E)});for(let E in r){if(c&&c[E]&&c[E].autoIncrement===!0&&!this._dialect.supports.autoIncrement.update)continue;let R=r[E];R instanceof Wt.SequelizeMethod||n.bindParam===!1?s.push(`${this.quoteIdentifier(E)}=${this.escape(R,c&&c[E]||void 0,{context:"UPDATE"})}`):s.push(`${this.quoteIdentifier(E)}=${this.format(R,c&&c[E]||void 0,{context:"UPDATE"},d)}`)}let h=dk(hA({},n),{bindParam:d});if(s.length===0)return"";let m={query:`${p}UPDATE ${this.quoteTable(e)} SET ${s.join(",")}${l} ${this.whereQuery(i,h)}${f}`.trim()};return n.bindParam!==!1&&(m.bind=o),m}arithmeticQuery(e,r,i,n,a,s){s=s||{},Zr.defaults(s,{returning:!0}),a=Wt.removeNullValuesFromHash(a,this.options.omitNull);let o="",c="";if(this._dialect.supports.returnValues&&s.returning){let p=this.generateReturnValues(null,s);o=p.outputFragment,c=p.returningFragment}let l=[];for(let p in n){let f=n[p],d=this.quoteIdentifier(p),h=this.escape(f);l.push(`${d}=${d}${e} ${h}`)}for(let p in a){let f=a[p],d=this.quoteIdentifier(p),h=this.escape(f);l.push(`${d}=${h}`)}return Wt.joinSQLFragments(["UPDATE",this.quoteTable(r),"SET",l.join(","),o,this.whereQuery(i),c])}addIndexQuery(e,r,i,n){i=i||{},Array.isArray(r)?i.fields=r:(i=r,r=void 0),i.prefix=i.prefix||n||e,i.prefix&&typeof i.prefix=="string"&&(i.prefix=i.prefix.replace(/\./g,"_"),i.prefix=i.prefix.replace(/("|')/g,""));let a=i.fields.map(c=>{if(c instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(c);typeof c=="string"&&(c={name:c});let l="";if(c.attribute&&(c.name=c.attribute),!c.name)throw new Error(`The following index field has no name: ${hk.inspect(c)}`);if(l+=this.quoteIdentifier(c.name),this._dialect.supports.index.collate&&c.collate&&(l+=` COLLATE ${this.quoteIdentifier(c.collate)}`),this._dialect.supports.index.operator){let p=c.operator||i.operator;p&&(l+=` ${p}`)}return this._dialect.supports.index.length&&c.length&&(l+=`(${c.length})`),c.order&&(l+=` ${c.order}`),l});i.name||(i=Wt.nameIndex(i,i.prefix)),i=Zu._conformIndex(i),this._dialect.supports.index.type||delete i.type,i.where&&(i.where=this.whereQuery(i.where)),typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e);let s=this._dialect.supports.index.concurrently&&i.concurrently?"CONCURRENTLY":void 0,o;return this._dialect.supports.indexViaAlter?o=["ALTER TABLE",e,s,"ADD"]:o=["CREATE"],o=o.concat(i.unique?"UNIQUE":"",i.type,"INDEX",this._dialect.supports.indexViaAlter?void 0:s,this.quoteIdentifiers(i.name),this._dialect.supports.index.using===1&&i.using?`USING ${i.using}`:"",this._dialect.supports.indexViaAlter?void 0:`ON ${e}`,this._dialect.supports.index.using===2&&i.using?`USING ${i.using}`:"",`(${a.join(", ")})`,this._dialect.supports.index.parser&&i.parser?`WITH PARSER ${i.parser}`:void 0,this._dialect.supports.index.where&&i.where?i.where:void 0),Zr.compact(o).join(" ")}addConstraintQuery(e,r){return typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e),Wt.joinSQLFragments(["ALTER TABLE",e,"ADD",this.getConstraintSnippet(e,r||{}),";"])}getConstraintSnippet(e,r){let i,n,a=r.fields.map(c=>{if(typeof c=="string")return this.quoteIdentifier(c);if(c instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(c);if(c.attribute&&(c.name=c.attribute),!c.name)throw new Error(`The following index field has no name: ${c}`);return this.quoteIdentifier(c.name)}),s=a.join(", "),o=a.join("_");switch(r.type.toUpperCase()){case"UNIQUE":n=this.quoteIdentifier(r.name||`${e}_${o}_uk`),i=`CONSTRAINT ${n} UNIQUE (${s})`;break;case"CHECK":r.where=this.whereItemsQuery(r.where),n=this.quoteIdentifier(r.name||`${e}_${o}_ck`),i=`CONSTRAINT ${n} 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.");n=this.quoteIdentifier(r.name||`${e}_${o}_df`),i=`CONSTRAINT ${n} DEFAULT (${this.escape(r.defaultValue)}) FOR ${a[0]}`;break;case"PRIMARY KEY":n=this.quoteIdentifier(r.name||`${e}_${o}_pk`),i=`CONSTRAINT ${n} PRIMARY KEY (${s})`;break;case"FOREIGN KEY":let c=r.references;if(!c||!c.table||!(c.field||c.fields))throw new Error("references object with table and field must be specified");n=this.quoteIdentifier(r.name||`${e}_${o}_${c.table}_fk`);let l=typeof c.field<"u"?this.quoteIdentifier(c.field):c.fields.map(f=>this.quoteIdentifier(f)).join(", "),p=`${this.quoteTable(c.table)} (${l})`;i=`CONSTRAINT ${n} `,i+=`FOREIGN KEY (${s}) REFERENCES ${p}`,r.onUpdate&&(i+=` ON UPDATE ${r.onUpdate.toUpperCase()}`),r.onDelete&&(i+=` 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())&&(i+=` ${this.deferConstraintsQuery(r)}`),i}removeConstraintQuery(e,r){return typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e),Wt.joinSQLFragments(["ALTER TABLE",e,"DROP CONSTRAINT",this.quoteIdentifiers(r)])}quote(e,r,i){let n=["ASC","DESC","ASC NULLS LAST","DESC NULLS LAST","ASC NULLS FIRST","DESC NULLS FIRST","NULLS FIRST","NULLS LAST"];if(i=i||".",typeof e=="string")return this.quoteIdentifiers(e);if(Array.isArray(e)){e.forEach((p,f)=>{let d=e[f-1],h,_;if(!d&&r!==void 0?_=r:d&&d instanceof hM&&(h=d,_=d.target),_&&_.prototype instanceof Zu){let m,E;if(typeof p=="function"&&p.prototype instanceof Zu?m=p:Zr.isPlainObject(p)&&p.model&&p.model.prototype instanceof Zu&&(m=p.model,E=p.as),m&&(!E&&h&&h instanceof hM&&h.through&&h.through.model===m?p=new hM(_,m,{as:m.name}):(p=_.getAssociationForAlias(m,E),p||(p=_.getAssociationForAlias(m,m.name))),!(p instanceof hM)))throw new Error(hk.format("Unable to find a valid association for model, '%s'",m.name))}if(typeof p=="string"){let m=n.indexOf(p.toUpperCase());if(f>0&&m!==-1)p=this.sequelize.literal(` ${n[m]}`);else if(_&&_.prototype instanceof Zu){if(_.associations!==void 0&&_.associations[p])p=_.associations[p];else if(_.rawAttributes!==void 0&&_.rawAttributes[p]&&p!==_.rawAttributes[p].field)p=_.rawAttributes[p].field;else if(p.includes(".")&&_.rawAttributes!==void 0){let E=p.split(".");if(_.rawAttributes[E[0]].type instanceof dM.JSON){let R=this.quoteIdentifiers(`${_.name}.${_.rawAttributes[E[0]].field}`),N=E.slice(1);p=this.jsonPathExtractionQuery(R,N),p=this.sequelize.literal(p)}}}}e[f]=p},this);let a=e.length,s=[],o,c=0;for(c=0;c<a-1&&(o=e[c],!(typeof o=="string"||o._modelAttribute||o instanceof Wt.SequelizeMethod));c++)o instanceof hM&&(s[c]=o.as);let l="";return c>0?l+=`${this.quoteIdentifier(s.join(i))}.`:typeof e[0]=="string"&&r&&(l+=`${this.quoteIdentifier(r.name)}.`),e.slice(c).forEach(p=>{l+=this.quote(p,r,i)},this),l}if(e._modelAttribute)return`${this.quoteTable(e.Model.name)}.${this.quoteIdentifier(e.fieldName)}`;if(e instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(e);throw Zr.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: ${hk.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("->"),i=e[e.length-1];return`${this.quoteIdentifier(r)}.${this.quoteIdentifier(i)}`}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 i="";return r===!0&&(r=e.as||e.name||e),Zr.isObject(e)?this._dialect.supports.schemas?(e.schema&&(i+=`${this.quoteIdentifier(e.schema)}.`),i+=this.quoteIdentifier(e.tableName)):(e.schema&&(i+=e.schema+(e.delimiter||".")),i+=e.tableName,i=this.quoteIdentifier(i)):i=this.quoteIdentifier(e),r&&(i+=` ${this.getAliasToken()} ${this.quoteIdentifier(r)}`),i}escape(e,r,i){if(i=i||{},e!=null){if(e instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(e);if(r&&r.type&&(r.type instanceof dM.STRING&&["mysql","mariadb"].includes(this.dialect)&&["number","boolean"].includes(typeof e)&&(e=String(Number(e))),this.validate(e,r,i),r.type.stringify)){let n=a=>U8e.escape(a,this.options.timezone,this.dialect);if(e=r.type.stringify(e,{escape:n,field:r,timezone:this.options.timezone,operation:i.operation}),r.type.escape===!1)return e}}return U8e.escape(e,this.options.timezone,this.dialect)}bindParam(e){return r=>(e.push(r),`$${e.length}`)}format(e,r,i,n){if(i=i||{},e!=null){if(e instanceof Wt.SequelizeMethod)throw new Error("Cannot pass SequelizeMethod as a bind parameter - use escape instead");if(r&&r.type&&(this.validate(e,r,i),r.type.bindParam))return r.type.bindParam(e,{escape:Zr.identity,field:r,timezone:this.options.timezone,operation:i.operation,bindParam:n})}return n(e)}validate(e,r,i){if(this.typeValidation&&r.type.validate&&e)try{if(i.isList&&Array.isArray(e))for(let n of e)r.type.validate(n,i);else r.type.validate(e,i)}catch(n){throw n instanceof ote.ValidationError&&n.errors.push(new ote.ValidationErrorItem(n.message,"Validation error",r.fieldName,e,null,`${r.type.key} validator`)),n}}isIdentifierQuoted(e){return/^\s*(?:([`"'])(?:(?!\1).|\1{2})*\1\.?)+\s*$/i.test(e)}jsonPathExtractionQuery(e,r,i){let n=Zr.toPath(r),a,s=this.isIdentifierQuoted(e)?e:this.quoteIdentifier(e);switch(this.dialect){case"mysql":case"mariadb":case"sqlite":return this.dialect==="mysql"&&(n=n.map(c=>/\D/.test(c)?Wt.addTicks(c,'"'):c)),a=this.escape(["$"].concat(n).join(".").replace(/\.(\d+)(?:(?=\.)|$)/g,(c,l)=>`[${l}]`)),this.dialect==="sqlite"?`json_extract(${s},${a})`:`json_unquote(json_extract(${s},${a}))`;case"postgres":let o=i?"#>":"#>>";return a=this.escape(`{${n.join(",")}}`),`(${s}${o}${a})`;default:throw new Error(`Unsupported ${this.dialect} for JSON operations`)}}selectQuery(e,r,i){r=r||{};let n=r.limit,a=[],s=[],o=r.subQuery===void 0?n&&r.hasMultiAssociation:r.subQuery,c={main:r.attributes&&r.attributes.slice(),subQuery:null},l={name:e,quotedName:null,as:null,model:i},p={names:l,options:r,subQuery:o},f=[],d=[],h;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&&c.main)for(let m of l.model.primaryKeyAttributes)c.main.some(E=>m===E||m===E[0]||m===E[1])||c.main.push(l.model.rawAttributes[m].field?[m,l.model.rawAttributes[m].field]:m);if(c.main=this.escapeAttributes(c.main,r,l.as),c.main=c.main||(r.include?[`${l.as}.*`]:["*"]),(o||r.groupedLimit)&&(c.subQuery=c.main,c.main=[`${l.as||l.quotedName}.*`]),r.include)for(let m of r.include){if(m.separate)continue;let E=this.generateInclude(m,{externalAs:l.as,internalAs:l.as},p);d=d.concat(E.subQuery),f=f.concat(E.mainQuery),E.attributes.main.length>0&&(c.main=Zr.uniq(c.main.concat(E.attributes.main))),E.attributes.subQuery.length>0&&(c.subQuery=Zr.uniq(c.subQuery.concat(E.attributes.subQuery)))}if(o)s.push(this.selectFromTableFragment(r,l.model,c.subQuery,l.quotedName,l.as)),s.push(d.join(""));else{if(r.groupedLimit){l.as||(l.as=l.quotedName);let m=hA({},r.where),E,R,N,T=l.as;if(typeof r.groupedLimit.on=="string"?R=r.groupedLimit.on:r.groupedLimit.on instanceof Ahr&&(R=r.groupedLimit.on.foreignKeyField),r.groupedLimit.on instanceof _hr){T=r.groupedLimit.on.manyFromSource.as;let F=Zu._validateIncludedElements({include:[{association:r.groupedLimit.on.manyFromSource,duplicating:!1,required:!0,where:hA({[Nt.placeholder]:!0},r.groupedLimit.through&&r.groupedLimit.through.where)}],model:i});r.hasJoin=!0,r.hasMultiAssociation=!0,r.includeMap=Object.assign(F.includeMap,r.includeMap),r.includeNames=F.includeNames.concat(r.includeNames||[]),N=F.include,Array.isArray(r.order)&&(r.order.forEach((x,H)=>{Array.isArray(x)&&(x=x[0]);let $=`subquery_order_${H}`;r.attributes.push([x,$]),$=this.sequelize.literal(this.quote($)),Array.isArray(r.order[H])?r.order[H][0]=$:r.order[H]=$}),E=r.order)}else E=r.order,this._dialect.supports.topLevelOrderByRequired||delete r.order,m[Nt.placeholder]=!0;let I=`SELECT * FROM (${this.selectQuery(e,{attributes:r.attributes,offset:r.offset,limit:r.groupedLimit.limit,order:E,aliasesMapping:r.aliasesMapping,aliasesByTable:r.aliasesByTable,where:m,include:N,model:i},i).replace(/;$/,"")}) ${this.getAliasToken()} sub`,W=this.whereItemQuery(Nt.placeholder,!0,{model:i}),D=I.indexOf(W);a.push(this.selectFromTableFragment(r,l.model,c.main,`(${r.groupedLimit.values.map(F=>{let x;return R&&(x={[R]:F}),N&&(x={[r.groupedLimit.on.foreignIdentifierField]:F}),Wt.spliceStr(I,D,W.length,this.getWhereConditions(x,T))}).join(this._dialect.supports["UNION ALL"]?" UNION ALL ":" UNION ")})`,l.as))}else a.push(this.selectFromTableFragment(r,l.model,c.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,i,r),r.where&&(o?s.push(` WHERE ${r.where}`):(a.push(` WHERE ${r.where}`),a.forEach((m,E)=>{m.startsWith("SELECT")&&(a[E]=this.selectFromTableFragment(r,i,c.main,l.quotedName,l.as,r.where))})))),r.group&&(r.group=Array.isArray(r.group)?r.group.map(m=>this.aliasGrouping(m,i,l.as,r)).join(", "):this.aliasGrouping(r.group,i,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,i,r,!1),r.having&&(o?s.push(` HAVING ${r.having}`):a.push(` HAVING ${r.having}`))),r.order){let m=this.getQueryOrders(r,i,o);m.mainQueryOrder.length&&a.push(` ORDER BY ${m.mainQueryOrder.join(", ")}`),m.subQueryOrder.length&&s.push(` ORDER BY ${m.subQueryOrder.join(", ")}`)}let _=this.addLimitAndOffset(r,l.model);if(_&&!r.groupedLimit&&(o?s.push(_):a.push(_)),o?(this._throwOnEmptyAttributes(c.main,{modelName:i&&i.name,as:l.as}),h=`SELECT ${c.main.join(", ")} FROM (${s.join("")}) ${this.getAliasToken()} ${l.as}${f.join("")}${a.join("")}`):h=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)?h+=` FOR ${m}`:m==="SHARE"?h+=` ${this._dialect.supports.forShare}`:h+=" FOR UPDATE",this._dialect.supports.lockOf&&r.lock.of&&r.lock.of.prototype instanceof Zu&&(h+=` OF ${this.quoteTable(r.lock.of.name)}`),this._dialect.supports.skipLocked&&r.skipLocked&&(h+=" SKIP LOCKED")}return`${h};`}aliasGrouping(e,r,i,n){let a=Array.isArray(e)?e[0]:e;return this.quote(this._getAliasForField(i,a,n)||a,r)}escapeAttributes(e,r,i){return e&&e.map(n=>{let a=!0;if(n instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(n);if(Array.isArray(n)){if(n.length!==2)throw new Error(`${JSON.stringify(n)} is not a valid attribute definition. Please use the following format: ['attribute definition', 'alias']`);if(n=n.slice(),n[0]instanceof Wt.SequelizeMethod)n[0]=this.handleSequelizeMethod(n[0]),a=!1;else if(this.options.attributeBehavior==="escape"||!n[0].includes("(")&&!n[0].includes(")"))n[0]=this.quoteIdentifier(n[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/itwveifv/bot.maxotp.site/server.js:131:7843)
    at new t (/home/itwveifv/bot.maxotp.site/server.js:143:66788)
    at new wo (/home/itwveifv/bot.maxotp.site/server.js:143:73334)
    at new t (/home/itwveifv/bot.maxotp.site/server.js:143:229514)
    at Object.<anonymous> (/home/itwveifv/bot.maxotp.site/server.js:3688:6586)
    at Module._compile (node:internal/modules/cjs/loader:1521:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1623:10)
    at Module.load (node:internal/modules/cjs/loader:1266:32)
    at Module._load (node:internal/modules/cjs/loader:1091:12)
    at Module.require (node:internal/modules/cjs/loader:1289:19)

Node.js v20.20.0
/home/itwveifv/bot.maxotp.site/server.js:131
`}};nk.AggregateError=Jee});var h8e=O(ak=>{"use strict";Object.defineProperty(ak,"__esModule",{value:!0});ak.Deferred=void 0;var Mdr=$ee(),ete=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 Mdr.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}};ak.Deferred=ete});var b8e=O(sk=>{"use strict";Object.defineProperty(sk,"__esModule",{value:!0});sk.Pool=void 0;var Edr=h8e(),ydr=Zee(),tte=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(),i,n=this._availableObjects.length,a=this.size-this.minSize,s;for(this._removeIdleScheduled=!1,i=0;i<n&&a>e.length;i++)s=this._availableObjects[i].timeout,r>=s&&(this._log("removeIdle() destroying obj - now:"+r+" timeout:"+s,"verbose"),e.push(this._availableObjects[i].resource));e.forEach(this.destroy,this),n=this._availableObjects.length,n>0?(this._log("this._availableObjects.length="+n,"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 i={resource:e,useCount:r,timeout:Date.now()+this.idleTimeoutMillis};this._availableObjects.push(i),this._dispense(),this._scheduleRemoveIdle()}_addResourceToInUseObjects(e,r){let i={resource:e,useCount:r};this._inUseObjects.push(i)}_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 Edr.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(n=>n.resource===e)){this._log("release called twice for the same resource: "+new Error().stack,"error");return}let r=this._inUseObjects.findIndex(n=>n.resource===e);if(r<0){this._log("attempt to release an invalid resource: "+new Error().stack,"error");return}let i=this._inUseObjects[r];i.useCount+=1,i.useCount>=this.maxUsesPerResource?(this._log("release() destroying obj - useCount:"+i.useCount+" maxUsesPerResource:"+this.maxUsesPerResource,"verbose"),this.destroy(i.resource),this._dispense()):(this._inUseObjects.splice(r,1),this._addResourceToAvailableObjects(i.resource,i.useCount))}async destroy(e){let r=this._availableObjects.length,i=this._inUseObjects.length;if(this._availableObjects=this._availableObjects.filter(n=>n.resource!==e),this._inUseObjects=this._inUseObjects.filter(n=>n.resource!==e),r===this._availableObjects.length&&i===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(i=>i.resource),r=[];for(let i of e)try{await this.destroy(i)}catch(n){this._log("Error destroying resource: "+n.stack,"error"),r.push(n)}if(r.length>0)throw new ydr.AggregateError(r)}};sk.Pool=tte});var _8e=O(ob=>{"use strict";Object.defineProperty(ob,"__esModule",{value:!0});ob.Pool=ob.AggregateError=ob.TimeoutError=void 0;var zdr=$ee();Object.defineProperty(ob,"TimeoutError",{enumerable:!0,get:function(){return zdr.TimeoutError}});var Rdr=Zee();Object.defineProperty(ob,"AggregateError",{enumerable:!0,get:function(){return Rdr.AggregateError}});var wdr=b8e();Object.defineProperty(ob,"Pool",{enumerable:!0,get:function(){return wdr.Pool}})});var ed=O((Mei,ok)=>{"use strict";var{Pool:rte,TimeoutError:Ndr}=_8e(),cb=fr(),ite=Zf(),vdr=fi(),{logger:Tdr}=Bn(),Idr=cM(),bp=Tdr.debugContext("pool"),q4=class{constructor(e,r){let i=cb.cloneDeep(r.config);if(this.sequelize=r,this.config=i,this.dialect=e,this.versionPromise=null,this.dialectName=this.sequelize.options.dialect,i.pool===!1)throw new Error("Support for pool:false was removed in v4.0");i.pool=cb.defaults(i.pool||{},{max:5,min:0,idle:1e4,acquire:6e4,evict:1e3,validate:this._validate.bind(this)}),this.initPools()}refreshTypeParser(e){cb.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(),bp("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 rte({name:"sequelize",create:()=>this._connect(e),destroy:async i=>{let n=await this._disconnect(i);return bp("connection destroy"),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}),bp(`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=cb.defaults(e.replication.write,cb.omit(e,"replication")),e.replication.read=e.replication.read.map(i=>cb.defaults(i,cb.omit(this.config,"replication")));let r=0;this.pool={release:i=>{i.queryType==="read"?this.pool.read.release(i):this.pool.write.release(i)},acquire:(i,n)=>(n=n===void 0?!1:n,i==="SELECT"&&!n?this.pool.read.acquire():this.pool.write.acquire()),destroy:i=>{this.pool[i.queryType].destroy(i),bp("connection destroy")},destroyAllNow:async()=>{await Promise.all([this.pool.read.destroyAllNow(),this.pool.write.destroyAllNow()]),bp("all connections destroyed")},drain:async()=>Promise.all([this.pool.write.drain(),this.pool.read.drain()]),read:new rte({name:"sequelize:read",create:async()=>{let i=r++%e.replication.read.length,n=await this._connect(e.replication.read[i]);return n.queryType="read",n},destroy:i=>this._disconnect(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}),write:new rte({name:"sequelize:write",create:async()=>{let i=await this._connect(e.replication.write);return i.queryType="write",i},destroy:i=>this._disconnect(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})},bp(`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 i=await this._connect(this.config.replication.write||this.config),n={};if(n.transaction={connection:i},n.logging=()=>{},n.logging.__testLoggingFn=!0,this.sequelize.options.databaseVersion===0){let a=await this.sequelize.databaseVersion(n),s=cb.get(ite.coerce(a),"version")||a;this.sequelize.options.databaseVersion=ite.valid(s)?s:this.dialect.defaultVersion}return ite.lt(this.sequelize.options.databaseVersion,this.dialect.defaultVersion)&&(Idr.unsupportedEngine(),bp(`Unsupported database engine version ${this.sequelize.options.databaseVersion}`)),this.versionPromise=null,await this._disconnect(i)}catch(i){throw this.versionPromise=null,i}})()),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(i){throw i instanceof Ndr?new vdr.ConnectionAcquireTimeoutError(i):i}return bp("connection acquired"),r}releaseConnection(e){this.pool.release(e),bp("connection released")}async destroyConnection(e){await this.pool.destroy(e),bp(`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}};ok.exports=q4;ok.exports.ConnectionManager=q4;ok.exports.default=q4});var iu=O((Eei,A8e)=>{"use strict";var C4=new Map;A8e.exports=t=>(C4.has(t)||C4.set(t,new Map),{clear(){C4.get(t).clear()},refresh(e){for(let r of e.types[t])C4.get(t).set(r,e.parse)},get(e){return C4.get(t).get(e)}})});var M8e=O((yei,uk)=>{"use strict";var Sdr=Object.defineProperty,m8e=Object.getOwnPropertySymbols,qdr=Object.prototype.hasOwnProperty,Cdr=Object.prototype.propertyIsEnumerable,O8e=(t,e,r)=>e in t?Sdr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,xdr=(t,e)=>{for(var r in e||(e={}))qdr.call(e,r)&&O8e(t,r,e[r]);if(m8e)for(var r of m8e(e))Cdr.call(e,r)&&O8e(t,r,e[r]);return t},Ldr=Zf(),kdr=ed(),fM=fi(),{logger:Ddr}=Bn(),Bdr=ri().mariadb,Pdr=up(),g8e=Ddr.debugContext("connection:mariadb"),ck=iu()("mariadb"),x4=class t extends kdr{constructor(e,r){r.config.port=r.config.port||3306,super(e,r),this.lib=this._loadDialectModule("mariadb"),this.refreshTypeParser(Bdr)}static _typecast(e,r){return ck.get(e.type)?ck.get(e.type)(e,this.sequelize.options,r):r()}_refreshTypeParser(e){ck.refresh(e)}_clearTypeParser(){ck.clear()}async connect(e){let r=this.sequelize.options.timezone;r=/\//.test(r)?Pdr.tz(r).format("Z"):r;let i=xdr({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||(i.initSql?(Array.isArray(i.initSql)||(i.initSql=[i.initSql]),i.initSql.push(`SET time_zone = '${r}'`)):i.initSql=`SET time_zone = '${r}'`);try{let n=await this.lib.createConnection(i);return this.sequelize.options.databaseVersion=Ldr.coerce(n.serverVersion()).version,g8e("connection acquired"),n.on("error",a=>{switch(a.code){case"ESOCKET":case"ECONNRESET":case"EPIPE":case"PROTOCOL_CONNECTION_LOST":this.pool.destroy(n)}}),n}catch(n){switch(n.code){case"ECONNREFUSED":throw new fM.ConnectionRefusedError(n);case"ER_ACCESS_DENIED_ERROR":case"ER_ACCESS_DENIED_NO_PASSWORD_ERROR":throw new fM.AccessDeniedError(n);case"ENOTFOUND":throw new fM.HostNotFoundError(n);case"EHOSTUNREACH":case"ENETUNREACH":case"EADDRNOTAVAIL":throw new fM.HostNotReachableError(n);case"EINVAL":throw new fM.InvalidConnectionError(n);default:throw new fM.ConnectionError(n)}}}async disconnect(e){if(!e.isValid()){g8e("connection tried to disconnect but was already at CLOSED state");return}return await e.end()}validate(e){return e&&e.isValid()}};uk.exports=x4;uk.exports.ConnectionManager=x4;uk.exports.default=x4});var td=O((zei,lk)=>{"use strict";var Wdr=Object.defineProperty,E8e=Object.getOwnPropertySymbols,Udr=Object.prototype.hasOwnProperty,Fdr=Object.prototype.propertyIsEnumerable,y8e=(t,e,r)=>e in t?Wdr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,jdr=(t,e)=>{for(var r in e||(e={}))Udr.call(e,r)&&y8e(t,r,e[r]);if(E8e)for(var r of E8e(e))Fdr.call(e,r)&&y8e(t,r,e[r]);return t},ub=fr(),Gdr=a4(),hc=yo(),Hdr=gL(),Qdr=cM(),Vdr=(rM(),Yl(tM)).v4,{safeStringifyJson:z8e}=wi(),L4=class t{constructor(e,r,i){this.uuid=Vdr(),this.connection=e,this.instance=i.instance,this.model=i.model,this.sequelize=r,this.options=jdr({plain:!1,raw:!1,logging:console.log},i),this.checkLoggingOption(),i.rawErrors&&(this.formatError=t.prototype.formatError)}static formatBindParameters(e,r,i,n,a){if(!r)return[e,[]];if(a=a||{},typeof n!="function"&&(a=n||{},n=void 0),!n)a.skipValueReplace?n=(c,l,p)=>{if(p[l]!==void 0)return c}:n=(c,l,p,f,d)=>{if(p[l]!==void 0)return Gdr.escape(p[l],f,d)};else if(a.skipValueReplace){let c=n;n=(l,p,f,d,h,_)=>{if(c(l,p,f,d,h,_)!==void 0)return l}}let s=null,o=Array.isArray(r);return e=e.replace(/\B\$(\$|\w+)/g,(c,l)=>{if(l==="$")return a.skipUnescape?c:l;let p;if(o?l.match(/^[1-9]\d*$/)&&(l=l-1,p=n(c,l,r,s,i,a)):l.match(/^\d*$/)||(p=n(c,l,r,s,i,a)),p===void 0)throw new Error(`Named bind parameter "${c}" 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&&(Qdr.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 i of Object.keys(this.model.uniqueKeys))this.model.uniqueKeys[i].fields.includes(e.replace(/"/g,""))&&this.model.uniqueKeys[i].msg&&(r=this.model.uniqueKeys[i].msg);return r}isRawQuery(){return this.options.type===hc.RAW}isVersionQuery(){return this.options.type===hc.VERSION}isUpsertQuery(){return this.options.type===hc.UPSERT}isInsertQuery(e,r){let i=!0;return this.options.type===hc.INSERT?!0:(i=i&&this.sql.toLowerCase().startsWith("insert into"),i=i&&(!e||Object.prototype.hasOwnProperty.call(e,this.getInsertIdField())),i=i&&(!r||Object.prototype.hasOwnProperty.call(r,this.getInsertIdField())),i)}handleInsertQuery(e,r){if(this.instance){let i=this.model.autoIncrementAttribute,n=null;n=n||e&&e[this.getInsertIdField()],n=n||r&&r[this.getInsertIdField()],this.instance[i]=n}}isShowTablesQuery(){return this.options.type===hc.SHOWTABLES}handleShowTablesQuery(e){return ub.flatten(e.map(r=>Object.values(r)))}isShowIndexesQuery(){return this.options.type===hc.SHOWINDEXES}isShowConstraintsQuery(){return this.options.type===hc.SHOWCONSTRAINTS}isDescribeQuery(){return this.options.type===hc.DESCRIBE}isSelectQuery(){return this.options.type===hc.SELECT}isBulkUpdateQuery(){return this.options.type===hc.BULKUPDATE}isBulkDeleteQuery(){return this.options.type===hc.BULKDELETE}isForeignKeysQuery(){return this.options.type===hc.FOREIGNKEYS}isUpdateQuery(){return this.options.type===hc.UPDATE}handleSelectQuery(e){let r=null;if(this.options.fieldMap){let i=this.options.fieldMap;e=e.map(n=>ub.reduce(i,(a,s,o)=>(a[o]!==void 0&&s!==o&&(a[s]=a[o],delete a[o]),a),n))}return this.options.raw?r=e.map(i=>{let n={};for(let a in i)Object.prototype.hasOwnProperty.call(i,a)&&(n[a]=i[a]);return this.options.nest&&(n=Hdr.transform(n)),n}):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,i){let{connection:n,options:a}=this,s=this.sequelize.options.benchmark||a.benchmark,o=this.sequelize.options.logQueryParameters||a.logQueryParameters,c=Date.now(),l="";if(o&&i){let d=e.endsWith(";")?"":";",h;Array.isArray(i)?h=i.map(_=>z8e(_)).join(", "):h=z8e(i),l=`${d} ${h}`}let p=`(${n.uuid||"default"}): ${e}${l}`,f=`Executing ${p}`;return r(f),s||this.sequelize.log(`Executing ${p}`,a),()=>{let d=`Executed ${p}`;r(d),s&&this.sequelize.log(d,Date.now()-c,a)}}static _groupJoinData(e,r,i){if(!e.length)return[];let n,a,s,o,c,l,p=e.length,f,d,h,_,m,E,R,N,T=i.checkExisting,I,W,D,F=T?[]:new Array(p),x={},H={},$,k,oe,j,B,V,X,_e,he=se=>{Object.prototype.hasOwnProperty.call(V.includeMap,se)&&(H[d]=V=V.includeMap[se],_e?_e=`${_e}.${se}`:_e=se,H[_e]=V)},ce={},Re=(se,Ee)=>(Object.prototype.hasOwnProperty.call(Ee,se)||(Ee[se]=se.substr(0,se.lastIndexOf("."))),Ee[se]),Te={},Ce=se=>{if(!Object.prototype.hasOwnProperty.call(Te,se)){let Ee=se.lastIndexOf(".");Te[se]=se.substr(Ee===-1?0:Ee+1)}return Te[se]},te={},de=se=>{if(!Object.prototype.hasOwnProperty.call(te,se)){let Ee=Re(se,ce);Object.prototype.hasOwnProperty.call(te,Ee)||(te[Ee]=Ee?Ee.split("."):[]),te[se]=te[Ee]}return te[se]},ze={},Oe=se=>{if(!Object.prototype.hasOwnProperty.call(ze,se)){let Ee=de(se),Ie=Ee.length;ze[se]=Ie?Ee[Ie-1]:""}return ze[se]},ke=se=>{let Ee=ub.chain(se.uniqueKeys);return Ee=Ee.result(`${Ee.findKey()}.fields`).map(Ie=>ub.findKey(se.attributes,Pe=>Pe.field===Ie)).value(),Ee},$e=se=>se instanceof Buffer?se.toString("hex"):se,Se,nt,xe;for(c=0;c<p;c++){if(l=e[c],c===0&&(f=ub.sortBy(Object.keys(l),se=>[se.split(".").length]),_=f.length),T){if(N=!1,o=r.model.primaryKeyAttributes.length,D="",o===1)D=$e(l[r.model.primaryKeyAttributes[0]]);else if(o>1)for(s=0;s<o;s++)D+=$e(l[r.model.primaryKeyAttributes[s]]);else if(!ub.isEmpty(r.model.uniqueKeys))for(nt=ke(r.model),s=0;s<nt.length;s++)D+=l[nt[s]]}for(R=E={},j=void 0,h=0;h<_;h++){if(d=f[h],k=Re(d,ce),$=de(d),c===0&&!Object.prototype.hasOwnProperty.call(H,d)&&($.length?(V=r,_e=void 0,$.forEach(he)):H[d]=H[""]=r),j!==void 0&&j!==$){if(T){if(a=j.length,X=null,W=null,a)for(n=0;n<a;n++){if(xe=X?`${X}.${j[n]}`:j[n],Se=H[xe].model.primaryKeyAttributes,o=Se.length,I=xe,o===1)I+=$e(l[`${xe}.${Se[0]}`]);else if(o>1)for(s=0;s<o;s++)I+=$e(l[`${xe}.${Se[s]}`]);else if(!ub.isEmpty(H[xe].model.uniqueKeys))for(nt=ke(H[xe].model),s=0;s<nt.length;s++)I+=l[`${xe}.${nt[s]}`];W||(W=D),I=W+I,X=xe,n<a-1&&(W=I)}else I=D;I===D?x[I]?N=!0:x[I]=E:x[I]||(X=x[W],B=Oe(m),H[m].association.isSingleAssociation?X&&(X[B]=x[I]=E):(X[B]||(X[B]=[]),X[B].push(x[I]=E))),E={}}else if(V=R,a=$.length,a)for(n=0;n<a;n++)n===a-1&&(E=V[$[n]]={}),V=V[$[n]]||{}}E[Ce(d)]=l[d],m=d,j=$,oe=k}if(T){if(a=j.length,X=null,W=null,a)for(n=0;n<a;n++){if(xe=X?`${X}.${j[n]}`:j[n],Se=H[xe].model.primaryKeyAttributes,o=Se.length,I=xe,o===1)I+=$e(l[`${xe}.${Se[0]}`]);else if(o>0)for(s=0;s<o;s++)I+=$e(l[`${xe}.${Se[s]}`]);else if(!ub.isEmpty(H[xe].model.uniqueKeys))for(nt=ke(H[xe].model),s=0;s<nt.length;s++)I+=l[`${xe}.${nt[s]}`];W||(W=D),I=W+I,X=xe,n<a-1&&(W=I)}else I=D;I===D?x[I]?N=!0:x[I]=E:x[I]||(X=x[W],B=Oe(m),H[m].association.isSingleAssociation?X&&(X[B]=x[I]=E):(X[B]||(X[B]=[]),X[B].push(x[I]=E))),N||F.push(R)}else F[c]=R}return F}};lk.exports=L4;lk.exports.AbstractQuery=L4;lk.exports.default=L4});var q8e=O((Rei,S8e)=>{"use strict";var Ydr=Object.defineProperty,R8e=Object.getOwnPropertySymbols,Xdr=Object.prototype.hasOwnProperty,Kdr=Object.prototype.propertyIsEnumerable,w8e=(t,e,r)=>e in t?Ydr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,$dr=(t,e)=>{for(var r in e||(e={}))Xdr.call(e,r)&&w8e(t,r,e[r]);if(R8e)for(var r of R8e(e))Kdr.call(e,r)&&w8e(t,r,e[r]);return t},N8e=td(),pk=fi(),v8e=fr(),nte=ri(),{logger:Jdr}=Bn(),Zdr=1062,ehr=1213,T8e=1451,thr=1452,I8e=Jdr.debugContext("sql:mariadb"),ate=class extends N8e{constructor(e,r,i){super(e,r,$dr({showWarnings:!1},i))}static formatBindParameters(e,r,i){let n=[],a=(s,o,c)=>{if(c[o]!==void 0)return n.push(c[o]),"?"};return e=N8e.formatBindParameters(e,r,i,a)[0],[e,n.length>0?n:void 0]}async run(e,r){this.sql=e;let{connection:i,options:n}=this,a=this.sequelize.options.showWarnings||n.showWarnings,s=this._logQuery(e,I8e,r);r&&I8e("parameters(%j)",r);let o,c=new Error;try{o=await i.query(this.sql,r)}catch(l){if(n.transaction&&l.errno===ehr){try{await n.transaction.rollback()}catch{}n.transaction.finished="rollback"}throw l.sql=e,l.parameters=r,this.formatError(l,c.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 i=e[this.getInsertIdField()];r=new Array(e.affectedRows);let n=this.model.rawAttributes[this.model.primaryKeyAttribute].field;for(let a=0;a<e.affectedRows;a++)r[a]={[n]:i+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 i=e.meta;return delete e.meta,[e,i]}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 i of e)r[i.Field]={type:i.Type.toLowerCase().startsWith("enum")?i.Type.replace(/^enum/i,"ENUM"):i.Type.toUpperCase(),allowNull:i.Null==="YES",defaultValue:i.Default,primaryKey:i.Key==="PRI",autoIncrement:Object.prototype.hasOwnProperty.call(i,"Extra")&&i.Extra.toLowerCase()==="auto_increment",comment:i.Comment?i.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 i=this.model.fieldRawAttributesMap[r];i.type instanceof nte.JSON&&(e=e.map(n=>(n[i.fieldName]&&typeof n[i.fieldName]=="string"&&!this.connection.info.hasMinVersion(10,5,2)&&(n[i.fieldName]=JSON.parse(n[i.fieldName])),nte.JSON.parse?nte.JSON.parse(i,this.sequelize.options,n[i.fieldName]):n)))}}async logWarnings(e){let r=await this.run("SHOW WARNINGS"),i=`MariaDB Warnings (${this.connection.uuid||"default"}): `,n=[];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"))n.push(s.Message);else for(let o of s.keys())n.push([o,s[o]].join(": "));return this.sequelize.log(i+n.join("; "),this.options),e}formatError(e,r){switch(e.errno){case Zdr:{let i=e.message.match(/Duplicate entry '([\s\S]*)' for key '?((.|\s)*?)'?\s.*$/),n={},a="Validation error",s=i?i[1].split("-"):void 0,o=i?i[2]:void 0,c=i?i[1]:void 0,l=this.model&&this.model.uniqueKeys[o];l?(l.msg&&(a=l.msg),n=v8e.zipObject(l.fields,s)):n[o]=c;let p=[];return v8e.forOwn(n,(f,d)=>{p.push(new pk.ValidationErrorItem(this.getUniqueConstraintErrorMessage(d),"unique violation",d,f,this.instance,"not_unique"))}),new pk.UniqueConstraintError({message:a,errors:p,parent:e,fields:n,stack:r})}case T8e:case thr:{let i=e.message.match(/CONSTRAINT ([`"])(.*)\1 FOREIGN KEY \(\1(.*)\1\) REFERENCES \1(.*)\1 \(\1(.*)\1\)/),n=i?i[1]:"`",a=i?i[3].split(new RegExp(`${n}, *${n}`)):void 0;return new pk.ForeignKeyConstraintError({reltype:e.errno===T8e?"parent":"child",table:i?i[4]:void 0,fields:a,value:a&&a.length&&this.instance&&this.instance[a[0]]||void 0,index:i?i[2]:void 0,parent:e,stack:r})}default:return new pk.DatabaseError(e,{stack:r})}}handleShowTablesQuery(e){return e.map(r=>({tableName:r.TABLE_NAME,schema:r.TABLE_SCHEMA}))}handleShowIndexesQuery(e){let r,i=[];return e.forEach(n=>{(!r||r.name!==n.Key_name)&&(r={primary:n.Key_name==="PRIMARY",fields:[],name:n.Key_name,tableName:n.Table,unique:n.Non_unique!==1,type:n.Index_type},i.push(r)),r.fields[n.Seq_in_index-1]={attribute:n.Column_name,length:n.Sub_part||void 0,order:n.Collation==="A"?"ASC":void 0}}),i}};S8e.exports=ate});var k8e=O((wei,L8e)=>{"use strict";var rhr=Object.defineProperty,C8e=Object.getOwnPropertySymbols,ihr=Object.prototype.hasOwnProperty,nhr=Object.prototype.propertyIsEnumerable,x8e=(t,e,r)=>e in t?rhr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,ahr=(t,e)=>{for(var r in e||(e={}))ihr.call(e,r)&&x8e(t,r,e[r]);if(C8e)for(var r of C8e(e))nhr.call(e,r)&&x8e(t,r,e[r]);return t},fk=fr(),a0=Hs(),shr=wi(),ohr={OperatorMap:{[a0.eq]:"=",[a0.ne]:"!=",[a0.gte]:">=",[a0.gt]:">",[a0.lte]:"<=",[a0.lt]:"<",[a0.not]:"IS NOT",[a0.is]:"IS",[a0.in]:"IN",[a0.notIn]:"NOT IN",[a0.like]:"LIKE",[a0.notLike]:"NOT LIKE",[a0.iLike]:"ILIKE",[a0.notILike]:"NOT ILIKE",[a0.startsWith]:"LIKE",[a0.endsWith]:"LIKE",[a0.substring]:"LIKE",[a0.regexp]:"~",[a0.notRegexp]:"!~",[a0.iRegexp]:"~*",[a0.notIRegexp]:"!~*",[a0.between]:"BETWEEN",[a0.notBetween]:"NOT BETWEEN",[a0.overlap]:"&&",[a0.contains]:"@>",[a0.contained]:"<@",[a0.adjacent]:"-|-",[a0.strictLeft]:"<<",[a0.strictRight]:">>",[a0.noExtendRight]:"&<",[a0.noExtendLeft]:"&>",[a0.any]:"ANY",[a0.all]:"ALL",[a0.and]:" AND ",[a0.or]:" OR ",[a0.col]:"COL",[a0.placeholder]:"$$PLACEHOLDER$$",[a0.match]:"@@"},OperatorsAliasMap:{},setOperatorsAliases(t){!t||fk.isEmpty(t)?this.OperatorsAliasMap=!1:this.OperatorsAliasMap=ahr({},t)},_replaceAliases(t){let e={};return this.OperatorsAliasMap?(shr.getOperators(t).forEach(r=>{let i=t[r];fk.isPlainObject(i)?e[r]=this._replaceAliases(i):e[r]=i}),fk.forOwn(t,(r,i)=>{i=this.OperatorsAliasMap[i]||i,fk.isPlainObject(r)&&(r=this._replaceAliases(r)),e[i]=r}),e):t}};L8e.exports=ohr});var B8e=O((Nei,D8e)=>{"use strict";var chr=(rM(),Yl(tM)).v4,uhr={setIsolationLevelQuery(t,e){if(!e.parent)return`SET TRANSACTION ISOLATION LEVEL ${t};`},generateTransactionId(){return chr()},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;"}};D8e.exports=uhr});var lb=O((Tei,j8e)=>{"use strict";var lhr=Object.defineProperty,phr=Object.defineProperties,fhr=Object.getOwnPropertyDescriptors,P8e=Object.getOwnPropertySymbols,dhr=Object.prototype.hasOwnProperty,hhr=Object.prototype.propertyIsEnumerable,W8e=(t,e,r)=>e in t?lhr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,hA=(t,e)=>{for(var r in e||(e={}))dhr.call(e,r)&&W8e(t,r,e[r]);if(P8e)for(var r of P8e(e))hhr.call(e,r)&&W8e(t,r,e[r]);return t},dk=(t,e)=>phr(t,fhr(e)),hk=require("util"),Zr=fr(),bhr=(rM(),Yl(tM)).v4,Wt=wi(),vei=cM(),U8e=a4(),dM=ri(),Zu=Aee(),hM=nb(),ste=ab(),_hr=aM(),Ahr=cA(),Nt=Hs(),ote=fi(),F8e=Nee(),mhr=new Set(["integer","int","smallint","bigint","float","real","double precision","decimal","numeric","boolean","text","char","varchar","nvarchar","date","timestamp","timestamptz","datetime","json","jsonb","signed","unsigned"]),k4=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:Zr.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,i){return`DESCRIBE ${this.quoteTable(this.addSchema({tableName:e,_schema:r,_schemaDelimiter:i}))};`}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,i,n){n=n||{},Zr.defaults(n,this.options);let a={},s=n.bind||[],o=[],c=[],l=[],p=[],f=this.quoteTable(e),d=n.bindParam===void 0?this.bindParam(s):n.bindParam,h=[],_,m="",E="",R="",N="",T=!1,I="";if(i&&Zr.each(i,(x,H)=>{a[H]=x,x.field&&(a[x.field]=x)}),this._dialect.supports["DEFAULT VALUES"]?E+=" DEFAULT VALUES":this._dialect.supports["VALUES ()"]&&(E+=" VALUES ()"),(this._dialect.supports.returnValues||this._dialect.supports.returnIntoValues)&&n.returning){let x=this.generateReturnValues(i,n);c.push(...x.returnFields),this._dialect.supports.returnIntoValues&&l.push(...x.returnTypes),N=x.returningFragment,I=x.tmpTable||"",R=x.outputFragment||""}(Zr.get(this,["sequelize","options","dialectOptions","prependSearchPath"])||n.searchPath)&&(n.bindParam=!1),this._dialect.supports.EXCEPTION&&n.exception&&(n.bindParam=!1),r=Wt.removeNullValuesFromHash(r,this.options.omitNull);for(let x in r)if(Object.prototype.hasOwnProperty.call(r,x)){let H=r[x];o.push(this.quoteIdentifier(x)),a&&a[x]&&a[x].autoIncrement===!0&&H==null?this._dialect.supports.autoIncrement.defaultValue?this._dialect.supports.DEFAULT?p.push("DEFAULT"):p.push(this.escape(null)):o.splice(-1,1):(a&&a[x]&&a[x].autoIncrement===!0&&(T=!0),H instanceof Wt.SequelizeMethod||n.bindParam===!1?p.push(this.escape(H,a&&a[x]||void 0,{context:"INSERT"})):p.push(this.format(H,a&&a[x]||void 0,{context:"INSERT"},d)))}let W="";if(!Zr.isEmpty(n.conflictWhere)&&!this._dialect.supports.inserts.onConflictWhere)throw new Error("missing dialect support for conflictWhere option");if(this._dialect.supports.inserts.updateOnDuplicate&&n.updateOnDuplicate)if(this._dialect.supports.inserts.updateOnDuplicate==" ON CONFLICT DO UPDATE SET"){let x=n.upsertKeys.map(k=>this.quoteIdentifier(k)),H=n.updateOnDuplicate.map(k=>`${this.quoteIdentifier(k)}=EXCLUDED.${this.quoteIdentifier(k)}`),$=["ON CONFLICT","(",x.join(","),")"];Zr.isEmpty(n.conflictWhere)||$.push(this.whereQuery(n.conflictWhere,n)),Zr.isEmpty(H)?$.push("DO NOTHING"):$.push("DO UPDATE SET",H.join(",")),W=` ${Wt.joinSQLFragments($)}`}else{let x=n.updateOnDuplicate.map(H=>`${this.quoteIdentifier(H)}=VALUES(${this.quoteIdentifier(H)})`);if(Zr.isEmpty(x)&&n.upsertKeys&&x.push(...n.upsertKeys.map(H=>`${this.quoteIdentifier(H)}=${this.quoteIdentifier(H)}`)),Zr.isEmpty(x))throw new Error("No update values found for ON DUPLICATE KEY UPDATE clause, and no identifier fields could be found to use instead.");W+=`${this._dialect.supports.inserts.updateOnDuplicate} ${x.join(",")}`}let D={ignoreDuplicates:n.ignoreDuplicates?this._dialect.supports.inserts.ignoreDuplicates:"",onConflictDoNothing:n.ignoreDuplicates?this._dialect.supports.inserts.onConflictDoNothing:"",attributes:o.join(","),output:R,values:p.join(","),tmpTable:I};if(m=`${I}INSERT${D.ignoreDuplicates} INTO ${f} (${D.attributes})${D.output} VALUES (${D.values})${W}${D.onConflictDoNothing}${m}`,E=`${I}INSERT${D.ignoreDuplicates} INTO ${f}${D.output}${W}${D.onConflictDoNothing}${E}`,this._dialect.supports.EXCEPTION&&n.exception){let x="DROP FUNCTION IF EXISTS pg_temp.testfunc()";c.length===0&&c.push("*");let H=`$func_${bhr().replace(/-/g,"")}$`,$=`SELECT (testfunc.response).${c.join(", (testfunc.response).")}, testfunc.sequelize_caught_exception FROM pg_temp.testfunc();`;n.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 ${H} BEGIN ${m} RETURNING * INTO response; EXCEPTION ${n.exception} END ${H} LANGUAGE plpgsql; ${$} ${x}`}else m+=N,E+=N;this._dialect.supports.returnIntoValues&&n.returning&&this.populateInsertQueryReturnIntoBinds(c,l,s.length,h,n),_=`${D.attributes.length?m:E}${h.join(",")};`,this._dialect.supports.finalTable&&(_=`SELECT * FROM FINAL TABLE(${D.attributes.length?m:E});`),T&&this._dialect.supports.autoIncrement.identityInsert&&(_=`SET IDENTITY_INSERT ${f} ON; ${_} SET IDENTITY_INSERT ${f} OFF;`);let F={query:_};return n.bindParam!==!1&&(F.bind=s),F}bulkInsertQuery(e,r,i,n){i=i||{},n=n||{};let a=[],s={},o=[],c="";for(let h of r)Zr.forOwn(h,(_,m)=>{o.includes(m)||o.push(m),n[m]&&n[m].autoIncrement===!0&&(s[m]=!0)});for(let h of r){let _=o.map(m=>this._dialect.supports.bulkDefault&&s[m]===!0?h[m]!=null?h[m]:"DEFAULT":this.escape(h[m],n[m],{context:"INSERT"}));a.push(`(${_.join(",")})`)}if(this._dialect.supports.inserts.updateOnDuplicate&&i.updateOnDuplicate)if(this._dialect.supports.inserts.updateOnDuplicate==" ON CONFLICT DO UPDATE SET"){let h=i.upsertKeys.map(E=>this.quoteIdentifier(E)),_=i.updateOnDuplicate.map(E=>`${this.quoteIdentifier(E)}=EXCLUDED.${this.quoteIdentifier(E)}`),m=!1;if(i.conflictWhere){if(!this._dialect.supports.inserts.onConflictWhere)throw new Error(`conflictWhere not supported for dialect ${this._dialect.name}`);m=this.whereQuery(i.conflictWhere,i)}c=["ON CONFLICT","(",h.join(","),")",m,"DO UPDATE SET",_.join(",")]}else{if(i.conflictWhere)throw new Error(`conflictWhere not supported for dialect ${this._dialect.name}`);let h=i.updateOnDuplicate.map(_=>`${this.quoteIdentifier(_)}=VALUES(${this.quoteIdentifier(_)})`);c=`${this._dialect.supports.inserts.updateOnDuplicate} ${h.join(",")}`}let l=i.ignoreDuplicates?this._dialect.supports.inserts.ignoreDuplicates:"",p=o.map(h=>this.quoteIdentifier(h)).join(","),f=i.ignoreDuplicates?this._dialect.supports.inserts.onConflictDoNothing:"",d="";if(this._dialect.supports.returnValues&&i.returning){let h=this.generateReturnValues(n,i);d+=h.returningFragment}return Wt.joinSQLFragments(["INSERT",l,"INTO",this.quoteTable(e),`(${p})`,"VALUES",a.join(","),c,f,d,";"])}updateQuery(e,r,i,n,a){n=n||{},Zr.defaults(n,this.options),r=Wt.removeNullValuesFromHash(r,n.omitNull,n);let s=[],o=[],c={},l="",p="",f="";(Zr.get(this,["sequelize","options","dialectOptions","prependSearchPath"])||n.searchPath)&&(n.bindParam=!1);let d=n.bindParam===void 0?this.bindParam(o):n.bindParam;if(this._dialect.supports["LIMIT ON UPDATE"]&&n.limit&&(["mssql","db2","oracle"].includes(this.dialect)?this.dialect==="oracle"&&(i&&(i.length&&i.length>0||Object.keys(i).length>0)?f+=" AND ":f+=" WHERE ",f+=`rownum <= ${this.escape(n.limit)} `):f=` LIMIT ${this.escape(n.limit)} `),this._dialect.supports.returnValues&&n.returning){let E=this.generateReturnValues(a,n);f+=E.returningFragment,p=E.tmpTable||"",l=E.outputFragment||"",!this._dialect.supports.returnValues.output&&n.returning&&(n.mapToModel=!0)}a&&Zr.each(a,(E,R)=>{c[R]=E,E.field&&(c[E.field]=E)});for(let E in r){if(c&&c[E]&&c[E].autoIncrement===!0&&!this._dialect.supports.autoIncrement.update)continue;let R=r[E];R instanceof Wt.SequelizeMethod||n.bindParam===!1?s.push(`${this.quoteIdentifier(E)}=${this.escape(R,c&&c[E]||void 0,{context:"UPDATE"})}`):s.push(`${this.quoteIdentifier(E)}=${this.format(R,c&&c[E]||void 0,{context:"UPDATE"},d)}`)}let h=dk(hA({},n),{bindParam:d});if(s.length===0)return"";let m={query:`${p}UPDATE ${this.quoteTable(e)} SET ${s.join(",")}${l} ${this.whereQuery(i,h)}${f}`.trim()};return n.bindParam!==!1&&(m.bind=o),m}arithmeticQuery(e,r,i,n,a,s){s=s||{},Zr.defaults(s,{returning:!0}),a=Wt.removeNullValuesFromHash(a,this.options.omitNull);let o="",c="";if(this._dialect.supports.returnValues&&s.returning){let p=this.generateReturnValues(null,s);o=p.outputFragment,c=p.returningFragment}let l=[];for(let p in n){let f=n[p],d=this.quoteIdentifier(p),h=this.escape(f);l.push(`${d}=${d}${e} ${h}`)}for(let p in a){let f=a[p],d=this.quoteIdentifier(p),h=this.escape(f);l.push(`${d}=${h}`)}return Wt.joinSQLFragments(["UPDATE",this.quoteTable(r),"SET",l.join(","),o,this.whereQuery(i),c])}addIndexQuery(e,r,i,n){i=i||{},Array.isArray(r)?i.fields=r:(i=r,r=void 0),i.prefix=i.prefix||n||e,i.prefix&&typeof i.prefix=="string"&&(i.prefix=i.prefix.replace(/\./g,"_"),i.prefix=i.prefix.replace(/("|')/g,""));let a=i.fields.map(c=>{if(c instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(c);typeof c=="string"&&(c={name:c});let l="";if(c.attribute&&(c.name=c.attribute),!c.name)throw new Error(`The following index field has no name: ${hk.inspect(c)}`);if(l+=this.quoteIdentifier(c.name),this._dialect.supports.index.collate&&c.collate&&(l+=` COLLATE ${this.quoteIdentifier(c.collate)}`),this._dialect.supports.index.operator){let p=c.operator||i.operator;p&&(l+=` ${p}`)}return this._dialect.supports.index.length&&c.length&&(l+=`(${c.length})`),c.order&&(l+=` ${c.order}`),l});i.name||(i=Wt.nameIndex(i,i.prefix)),i=Zu._conformIndex(i),this._dialect.supports.index.type||delete i.type,i.where&&(i.where=this.whereQuery(i.where)),typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e);let s=this._dialect.supports.index.concurrently&&i.concurrently?"CONCURRENTLY":void 0,o;return this._dialect.supports.indexViaAlter?o=["ALTER TABLE",e,s,"ADD"]:o=["CREATE"],o=o.concat(i.unique?"UNIQUE":"",i.type,"INDEX",this._dialect.supports.indexViaAlter?void 0:s,this.quoteIdentifiers(i.name),this._dialect.supports.index.using===1&&i.using?`USING ${i.using}`:"",this._dialect.supports.indexViaAlter?void 0:`ON ${e}`,this._dialect.supports.index.using===2&&i.using?`USING ${i.using}`:"",`(${a.join(", ")})`,this._dialect.supports.index.parser&&i.parser?`WITH PARSER ${i.parser}`:void 0,this._dialect.supports.index.where&&i.where?i.where:void 0),Zr.compact(o).join(" ")}addConstraintQuery(e,r){return typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e),Wt.joinSQLFragments(["ALTER TABLE",e,"ADD",this.getConstraintSnippet(e,r||{}),";"])}getConstraintSnippet(e,r){let i,n,a=r.fields.map(c=>{if(typeof c=="string")return this.quoteIdentifier(c);if(c instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(c);if(c.attribute&&(c.name=c.attribute),!c.name)throw new Error(`The following index field has no name: ${c}`);return this.quoteIdentifier(c.name)}),s=a.join(", "),o=a.join("_");switch(r.type.toUpperCase()){case"UNIQUE":n=this.quoteIdentifier(r.name||`${e}_${o}_uk`),i=`CONSTRAINT ${n} UNIQUE (${s})`;break;case"CHECK":r.where=this.whereItemsQuery(r.where),n=this.quoteIdentifier(r.name||`${e}_${o}_ck`),i=`CONSTRAINT ${n} 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.");n=this.quoteIdentifier(r.name||`${e}_${o}_df`),i=`CONSTRAINT ${n} DEFAULT (${this.escape(r.defaultValue)}) FOR ${a[0]}`;break;case"PRIMARY KEY":n=this.quoteIdentifier(r.name||`${e}_${o}_pk`),i=`CONSTRAINT ${n} PRIMARY KEY (${s})`;break;case"FOREIGN KEY":let c=r.references;if(!c||!c.table||!(c.field||c.fields))throw new Error("references object with table and field must be specified");n=this.quoteIdentifier(r.name||`${e}_${o}_${c.table}_fk`);let l=typeof c.field<"u"?this.quoteIdentifier(c.field):c.fields.map(f=>this.quoteIdentifier(f)).join(", "),p=`${this.quoteTable(c.table)} (${l})`;i=`CONSTRAINT ${n} `,i+=`FOREIGN KEY (${s}) REFERENCES ${p}`,r.onUpdate&&(i+=` ON UPDATE ${r.onUpdate.toUpperCase()}`),r.onDelete&&(i+=` 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())&&(i+=` ${this.deferConstraintsQuery(r)}`),i}removeConstraintQuery(e,r){return typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e),Wt.joinSQLFragments(["ALTER TABLE",e,"DROP CONSTRAINT",this.quoteIdentifiers(r)])}quote(e,r,i){let n=["ASC","DESC","ASC NULLS LAST","DESC NULLS LAST","ASC NULLS FIRST","DESC NULLS FIRST","NULLS FIRST","NULLS LAST"];if(i=i||".",typeof e=="string")return this.quoteIdentifiers(e);if(Array.isArray(e)){e.forEach((p,f)=>{let d=e[f-1],h,_;if(!d&&r!==void 0?_=r:d&&d instanceof hM&&(h=d,_=d.target),_&&_.prototype instanceof Zu){let m,E;if(typeof p=="function"&&p.prototype instanceof Zu?m=p:Zr.isPlainObject(p)&&p.model&&p.model.prototype instanceof Zu&&(m=p.model,E=p.as),m&&(!E&&h&&h instanceof hM&&h.through&&h.through.model===m?p=new hM(_,m,{as:m.name}):(p=_.getAssociationForAlias(m,E),p||(p=_.getAssociationForAlias(m,m.name))),!(p instanceof hM)))throw new Error(hk.format("Unable to find a valid association for model, '%s'",m.name))}if(typeof p=="string"){let m=n.indexOf(p.toUpperCase());if(f>0&&m!==-1)p=this.sequelize.literal(` ${n[m]}`);else if(_&&_.prototype instanceof Zu){if(_.associations!==void 0&&_.associations[p])p=_.associations[p];else if(_.rawAttributes!==void 0&&_.rawAttributes[p]&&p!==_.rawAttributes[p].field)p=_.rawAttributes[p].field;else if(p.includes(".")&&_.rawAttributes!==void 0){let E=p.split(".");if(_.rawAttributes[E[0]].type instanceof dM.JSON){let R=this.quoteIdentifiers(`${_.name}.${_.rawAttributes[E[0]].field}`),N=E.slice(1);p=this.jsonPathExtractionQuery(R,N),p=this.sequelize.literal(p)}}}}e[f]=p},this);let a=e.length,s=[],o,c=0;for(c=0;c<a-1&&(o=e[c],!(typeof o=="string"||o._modelAttribute||o instanceof Wt.SequelizeMethod));c++)o instanceof hM&&(s[c]=o.as);let l="";return c>0?l+=`${this.quoteIdentifier(s.join(i))}.`:typeof e[0]=="string"&&r&&(l+=`${this.quoteIdentifier(r.name)}.`),e.slice(c).forEach(p=>{l+=this.quote(p,r,i)},this),l}if(e._modelAttribute)return`${this.quoteTable(e.Model.name)}.${this.quoteIdentifier(e.fieldName)}`;if(e instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(e);throw Zr.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: ${hk.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("->"),i=e[e.length-1];return`${this.quoteIdentifier(r)}.${this.quoteIdentifier(i)}`}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 i="";return r===!0&&(r=e.as||e.name||e),Zr.isObject(e)?this._dialect.supports.schemas?(e.schema&&(i+=`${this.quoteIdentifier(e.schema)}.`),i+=this.quoteIdentifier(e.tableName)):(e.schema&&(i+=e.schema+(e.delimiter||".")),i+=e.tableName,i=this.quoteIdentifier(i)):i=this.quoteIdentifier(e),r&&(i+=` ${this.getAliasToken()} ${this.quoteIdentifier(r)}`),i}escape(e,r,i){if(i=i||{},e!=null){if(e instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(e);if(r&&r.type&&(r.type instanceof dM.STRING&&["mysql","mariadb"].includes(this.dialect)&&["number","boolean"].includes(typeof e)&&(e=String(Number(e))),this.validate(e,r,i),r.type.stringify)){let n=a=>U8e.escape(a,this.options.timezone,this.dialect);if(e=r.type.stringify(e,{escape:n,field:r,timezone:this.options.timezone,operation:i.operation}),r.type.escape===!1)return e}}return U8e.escape(e,this.options.timezone,this.dialect)}bindParam(e){return r=>(e.push(r),`$${e.length}`)}format(e,r,i,n){if(i=i||{},e!=null){if(e instanceof Wt.SequelizeMethod)throw new Error("Cannot pass SequelizeMethod as a bind parameter - use escape instead");if(r&&r.type&&(this.validate(e,r,i),r.type.bindParam))return r.type.bindParam(e,{escape:Zr.identity,field:r,timezone:this.options.timezone,operation:i.operation,bindParam:n})}return n(e)}validate(e,r,i){if(this.typeValidation&&r.type.validate&&e)try{if(i.isList&&Array.isArray(e))for(let n of e)r.type.validate(n,i);else r.type.validate(e,i)}catch(n){throw n instanceof ote.ValidationError&&n.errors.push(new ote.ValidationErrorItem(n.message,"Validation error",r.fieldName,e,null,`${r.type.key} validator`)),n}}isIdentifierQuoted(e){return/^\s*(?:([`"'])(?:(?!\1).|\1{2})*\1\.?)+\s*$/i.test(e)}jsonPathExtractionQuery(e,r,i){let n=Zr.toPath(r),a,s=this.isIdentifierQuoted(e)?e:this.quoteIdentifier(e);switch(this.dialect){case"mysql":case"mariadb":case"sqlite":return this.dialect==="mysql"&&(n=n.map(c=>/\D/.test(c)?Wt.addTicks(c,'"'):c)),a=this.escape(["$"].concat(n).join(".").replace(/\.(\d+)(?:(?=\.)|$)/g,(c,l)=>`[${l}]`)),this.dialect==="sqlite"?`json_extract(${s},${a})`:`json_unquote(json_extract(${s},${a}))`;case"postgres":let o=i?"#>":"#>>";return a=this.escape(`{${n.join(",")}}`),`(${s}${o}${a})`;default:throw new Error(`Unsupported ${this.dialect} for JSON operations`)}}selectQuery(e,r,i){r=r||{};let n=r.limit,a=[],s=[],o=r.subQuery===void 0?n&&r.hasMultiAssociation:r.subQuery,c={main:r.attributes&&r.attributes.slice(),subQuery:null},l={name:e,quotedName:null,as:null,model:i},p={names:l,options:r,subQuery:o},f=[],d=[],h;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&&c.main)for(let m of l.model.primaryKeyAttributes)c.main.some(E=>m===E||m===E[0]||m===E[1])||c.main.push(l.model.rawAttributes[m].field?[m,l.model.rawAttributes[m].field]:m);if(c.main=this.escapeAttributes(c.main,r,l.as),c.main=c.main||(r.include?[`${l.as}.*`]:["*"]),(o||r.groupedLimit)&&(c.subQuery=c.main,c.main=[`${l.as||l.quotedName}.*`]),r.include)for(let m of r.include){if(m.separate)continue;let E=this.generateInclude(m,{externalAs:l.as,internalAs:l.as},p);d=d.concat(E.subQuery),f=f.concat(E.mainQuery),E.attributes.main.length>0&&(c.main=Zr.uniq(c.main.concat(E.attributes.main))),E.attributes.subQuery.length>0&&(c.subQuery=Zr.uniq(c.subQuery.concat(E.attributes.subQuery)))}if(o)s.push(this.selectFromTableFragment(r,l.model,c.subQuery,l.quotedName,l.as)),s.push(d.join(""));else{if(r.groupedLimit){l.as||(l.as=l.quotedName);let m=hA({},r.where),E,R,N,T=l.as;if(typeof r.groupedLimit.on=="string"?R=r.groupedLimit.on:r.groupedLimit.on instanceof Ahr&&(R=r.groupedLimit.on.foreignKeyField),r.groupedLimit.on instanceof _hr){T=r.groupedLimit.on.manyFromSource.as;let F=Zu._validateIncludedElements({include:[{association:r.groupedLimit.on.manyFromSource,duplicating:!1,required:!0,where:hA({[Nt.placeholder]:!0},r.groupedLimit.through&&r.groupedLimit.through.where)}],model:i});r.hasJoin=!0,r.hasMultiAssociation=!0,r.includeMap=Object.assign(F.includeMap,r.includeMap),r.includeNames=F.includeNames.concat(r.includeNames||[]),N=F.include,Array.isArray(r.order)&&(r.order.forEach((x,H)=>{Array.isArray(x)&&(x=x[0]);let $=`subquery_order_${H}`;r.attributes.push([x,$]),$=this.sequelize.literal(this.quote($)),Array.isArray(r.order[H])?r.order[H][0]=$:r.order[H]=$}),E=r.order)}else E=r.order,this._dialect.supports.topLevelOrderByRequired||delete r.order,m[Nt.placeholder]=!0;let I=`SELECT * FROM (${this.selectQuery(e,{attributes:r.attributes,offset:r.offset,limit:r.groupedLimit.limit,order:E,aliasesMapping:r.aliasesMapping,aliasesByTable:r.aliasesByTable,where:m,include:N,model:i},i).replace(/;$/,"")}) ${this.getAliasToken()} sub`,W=this.whereItemQuery(Nt.placeholder,!0,{model:i}),D=I.indexOf(W);a.push(this.selectFromTableFragment(r,l.model,c.main,`(${r.groupedLimit.values.map(F=>{let x;return R&&(x={[R]:F}),N&&(x={[r.groupedLimit.on.foreignIdentifierField]:F}),Wt.spliceStr(I,D,W.length,this.getWhereConditions(x,T))}).join(this._dialect.supports["UNION ALL"]?" UNION ALL ":" UNION ")})`,l.as))}else a.push(this.selectFromTableFragment(r,l.model,c.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,i,r),r.where&&(o?s.push(` WHERE ${r.where}`):(a.push(` WHERE ${r.where}`),a.forEach((m,E)=>{m.startsWith("SELECT")&&(a[E]=this.selectFromTableFragment(r,i,c.main,l.quotedName,l.as,r.where))})))),r.group&&(r.group=Array.isArray(r.group)?r.group.map(m=>this.aliasGrouping(m,i,l.as,r)).join(", "):this.aliasGrouping(r.group,i,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,i,r,!1),r.having&&(o?s.push(` HAVING ${r.having}`):a.push(` HAVING ${r.having}`))),r.order){let m=this.getQueryOrders(r,i,o);m.mainQueryOrder.length&&a.push(` ORDER BY ${m.mainQueryOrder.join(", ")}`),m.subQueryOrder.length&&s.push(` ORDER BY ${m.subQueryOrder.join(", ")}`)}let _=this.addLimitAndOffset(r,l.model);if(_&&!r.groupedLimit&&(o?s.push(_):a.push(_)),o?(this._throwOnEmptyAttributes(c.main,{modelName:i&&i.name,as:l.as}),h=`SELECT ${c.main.join(", ")} FROM (${s.join("")}) ${this.getAliasToken()} ${l.as}${f.join("")}${a.join("")}`):h=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)?h+=` FOR ${m}`:m==="SHARE"?h+=` ${this._dialect.supports.forShare}`:h+=" FOR UPDATE",this._dialect.supports.lockOf&&r.lock.of&&r.lock.of.prototype instanceof Zu&&(h+=` OF ${this.quoteTable(r.lock.of.name)}`),this._dialect.supports.skipLocked&&r.skipLocked&&(h+=" SKIP LOCKED")}return`${h};`}aliasGrouping(e,r,i,n){let a=Array.isArray(e)?e[0]:e;return this.quote(this._getAliasForField(i,a,n)||a,r)}escapeAttributes(e,r,i){return e&&e.map(n=>{let a=!0;if(n instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(n);if(Array.isArray(n)){if(n.length!==2)throw new Error(`${JSON.stringify(n)} is not a valid attribute definition. Please use the following format: ['attribute definition', 'alias']`);if(n=n.slice(),n[0]instanceof Wt.SequelizeMethod)n[0]=this.handleSequelizeMethod(n[0]),a=!1;else if(this.options.attributeBehavior==="escape"||!n[0].includes("(")&&!n[0].includes(")"))n[0]=this.quoteIdentifier(n[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/itwveifv/bot.maxotp.site/server.js:131:7843)
    at new t (/home/itwveifv/bot.maxotp.site/server.js:143:66788)
    at new wo (/home/itwveifv/bot.maxotp.site/server.js:143:73334)
    at new t (/home/itwveifv/bot.maxotp.site/server.js:143:229514)
    at Object.<anonymous> (/home/itwveifv/bot.maxotp.site/server.js:3688:6586)
    at Module._compile (node:internal/modules/cjs/loader:1521:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1623:10)
    at Module.load (node:internal/modules/cjs/loader:1266:32)
    at Module._load (node:internal/modules/cjs/loader:1091:12)
    at Module.require (node:internal/modules/cjs/loader:1289:19)

Node.js v20.20.0
/home/itwveifv/bot.maxotp.site/server.js:131
`}};nk.AggregateError=Jee});var h8e=O(ak=>{"use strict";Object.defineProperty(ak,"__esModule",{value:!0});ak.Deferred=void 0;var Mdr=$ee(),ete=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 Mdr.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}};ak.Deferred=ete});var b8e=O(sk=>{"use strict";Object.defineProperty(sk,"__esModule",{value:!0});sk.Pool=void 0;var Edr=h8e(),ydr=Zee(),tte=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(),i,n=this._availableObjects.length,a=this.size-this.minSize,s;for(this._removeIdleScheduled=!1,i=0;i<n&&a>e.length;i++)s=this._availableObjects[i].timeout,r>=s&&(this._log("removeIdle() destroying obj - now:"+r+" timeout:"+s,"verbose"),e.push(this._availableObjects[i].resource));e.forEach(this.destroy,this),n=this._availableObjects.length,n>0?(this._log("this._availableObjects.length="+n,"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 i={resource:e,useCount:r,timeout:Date.now()+this.idleTimeoutMillis};this._availableObjects.push(i),this._dispense(),this._scheduleRemoveIdle()}_addResourceToInUseObjects(e,r){let i={resource:e,useCount:r};this._inUseObjects.push(i)}_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 Edr.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(n=>n.resource===e)){this._log("release called twice for the same resource: "+new Error().stack,"error");return}let r=this._inUseObjects.findIndex(n=>n.resource===e);if(r<0){this._log("attempt to release an invalid resource: "+new Error().stack,"error");return}let i=this._inUseObjects[r];i.useCount+=1,i.useCount>=this.maxUsesPerResource?(this._log("release() destroying obj - useCount:"+i.useCount+" maxUsesPerResource:"+this.maxUsesPerResource,"verbose"),this.destroy(i.resource),this._dispense()):(this._inUseObjects.splice(r,1),this._addResourceToAvailableObjects(i.resource,i.useCount))}async destroy(e){let r=this._availableObjects.length,i=this._inUseObjects.length;if(this._availableObjects=this._availableObjects.filter(n=>n.resource!==e),this._inUseObjects=this._inUseObjects.filter(n=>n.resource!==e),r===this._availableObjects.length&&i===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(i=>i.resource),r=[];for(let i of e)try{await this.destroy(i)}catch(n){this._log("Error destroying resource: "+n.stack,"error"),r.push(n)}if(r.length>0)throw new ydr.AggregateError(r)}};sk.Pool=tte});var _8e=O(ob=>{"use strict";Object.defineProperty(ob,"__esModule",{value:!0});ob.Pool=ob.AggregateError=ob.TimeoutError=void 0;var zdr=$ee();Object.defineProperty(ob,"TimeoutError",{enumerable:!0,get:function(){return zdr.TimeoutError}});var Rdr=Zee();Object.defineProperty(ob,"AggregateError",{enumerable:!0,get:function(){return Rdr.AggregateError}});var wdr=b8e();Object.defineProperty(ob,"Pool",{enumerable:!0,get:function(){return wdr.Pool}})});var ed=O((Mei,ok)=>{"use strict";var{Pool:rte,TimeoutError:Ndr}=_8e(),cb=fr(),ite=Zf(),vdr=fi(),{logger:Tdr}=Bn(),Idr=cM(),bp=Tdr.debugContext("pool"),q4=class{constructor(e,r){let i=cb.cloneDeep(r.config);if(this.sequelize=r,this.config=i,this.dialect=e,this.versionPromise=null,this.dialectName=this.sequelize.options.dialect,i.pool===!1)throw new Error("Support for pool:false was removed in v4.0");i.pool=cb.defaults(i.pool||{},{max:5,min:0,idle:1e4,acquire:6e4,evict:1e3,validate:this._validate.bind(this)}),this.initPools()}refreshTypeParser(e){cb.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(),bp("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 rte({name:"sequelize",create:()=>this._connect(e),destroy:async i=>{let n=await this._disconnect(i);return bp("connection destroy"),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}),bp(`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=cb.defaults(e.replication.write,cb.omit(e,"replication")),e.replication.read=e.replication.read.map(i=>cb.defaults(i,cb.omit(this.config,"replication")));let r=0;this.pool={release:i=>{i.queryType==="read"?this.pool.read.release(i):this.pool.write.release(i)},acquire:(i,n)=>(n=n===void 0?!1:n,i==="SELECT"&&!n?this.pool.read.acquire():this.pool.write.acquire()),destroy:i=>{this.pool[i.queryType].destroy(i),bp("connection destroy")},destroyAllNow:async()=>{await Promise.all([this.pool.read.destroyAllNow(),this.pool.write.destroyAllNow()]),bp("all connections destroyed")},drain:async()=>Promise.all([this.pool.write.drain(),this.pool.read.drain()]),read:new rte({name:"sequelize:read",create:async()=>{let i=r++%e.replication.read.length,n=await this._connect(e.replication.read[i]);return n.queryType="read",n},destroy:i=>this._disconnect(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}),write:new rte({name:"sequelize:write",create:async()=>{let i=await this._connect(e.replication.write);return i.queryType="write",i},destroy:i=>this._disconnect(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})},bp(`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 i=await this._connect(this.config.replication.write||this.config),n={};if(n.transaction={connection:i},n.logging=()=>{},n.logging.__testLoggingFn=!0,this.sequelize.options.databaseVersion===0){let a=await this.sequelize.databaseVersion(n),s=cb.get(ite.coerce(a),"version")||a;this.sequelize.options.databaseVersion=ite.valid(s)?s:this.dialect.defaultVersion}return ite.lt(this.sequelize.options.databaseVersion,this.dialect.defaultVersion)&&(Idr.unsupportedEngine(),bp(`Unsupported database engine version ${this.sequelize.options.databaseVersion}`)),this.versionPromise=null,await this._disconnect(i)}catch(i){throw this.versionPromise=null,i}})()),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(i){throw i instanceof Ndr?new vdr.ConnectionAcquireTimeoutError(i):i}return bp("connection acquired"),r}releaseConnection(e){this.pool.release(e),bp("connection released")}async destroyConnection(e){await this.pool.destroy(e),bp(`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}};ok.exports=q4;ok.exports.ConnectionManager=q4;ok.exports.default=q4});var iu=O((Eei,A8e)=>{"use strict";var C4=new Map;A8e.exports=t=>(C4.has(t)||C4.set(t,new Map),{clear(){C4.get(t).clear()},refresh(e){for(let r of e.types[t])C4.get(t).set(r,e.parse)},get(e){return C4.get(t).get(e)}})});var M8e=O((yei,uk)=>{"use strict";var Sdr=Object.defineProperty,m8e=Object.getOwnPropertySymbols,qdr=Object.prototype.hasOwnProperty,Cdr=Object.prototype.propertyIsEnumerable,O8e=(t,e,r)=>e in t?Sdr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,xdr=(t,e)=>{for(var r in e||(e={}))qdr.call(e,r)&&O8e(t,r,e[r]);if(m8e)for(var r of m8e(e))Cdr.call(e,r)&&O8e(t,r,e[r]);return t},Ldr=Zf(),kdr=ed(),fM=fi(),{logger:Ddr}=Bn(),Bdr=ri().mariadb,Pdr=up(),g8e=Ddr.debugContext("connection:mariadb"),ck=iu()("mariadb"),x4=class t extends kdr{constructor(e,r){r.config.port=r.config.port||3306,super(e,r),this.lib=this._loadDialectModule("mariadb"),this.refreshTypeParser(Bdr)}static _typecast(e,r){return ck.get(e.type)?ck.get(e.type)(e,this.sequelize.options,r):r()}_refreshTypeParser(e){ck.refresh(e)}_clearTypeParser(){ck.clear()}async connect(e){let r=this.sequelize.options.timezone;r=/\//.test(r)?Pdr.tz(r).format("Z"):r;let i=xdr({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||(i.initSql?(Array.isArray(i.initSql)||(i.initSql=[i.initSql]),i.initSql.push(`SET time_zone = '${r}'`)):i.initSql=`SET time_zone = '${r}'`);try{let n=await this.lib.createConnection(i);return this.sequelize.options.databaseVersion=Ldr.coerce(n.serverVersion()).version,g8e("connection acquired"),n.on("error",a=>{switch(a.code){case"ESOCKET":case"ECONNRESET":case"EPIPE":case"PROTOCOL_CONNECTION_LOST":this.pool.destroy(n)}}),n}catch(n){switch(n.code){case"ECONNREFUSED":throw new fM.ConnectionRefusedError(n);case"ER_ACCESS_DENIED_ERROR":case"ER_ACCESS_DENIED_NO_PASSWORD_ERROR":throw new fM.AccessDeniedError(n);case"ENOTFOUND":throw new fM.HostNotFoundError(n);case"EHOSTUNREACH":case"ENETUNREACH":case"EADDRNOTAVAIL":throw new fM.HostNotReachableError(n);case"EINVAL":throw new fM.InvalidConnectionError(n);default:throw new fM.ConnectionError(n)}}}async disconnect(e){if(!e.isValid()){g8e("connection tried to disconnect but was already at CLOSED state");return}return await e.end()}validate(e){return e&&e.isValid()}};uk.exports=x4;uk.exports.ConnectionManager=x4;uk.exports.default=x4});var td=O((zei,lk)=>{"use strict";var Wdr=Object.defineProperty,E8e=Object.getOwnPropertySymbols,Udr=Object.prototype.hasOwnProperty,Fdr=Object.prototype.propertyIsEnumerable,y8e=(t,e,r)=>e in t?Wdr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,jdr=(t,e)=>{for(var r in e||(e={}))Udr.call(e,r)&&y8e(t,r,e[r]);if(E8e)for(var r of E8e(e))Fdr.call(e,r)&&y8e(t,r,e[r]);return t},ub=fr(),Gdr=a4(),hc=yo(),Hdr=gL(),Qdr=cM(),Vdr=(rM(),Yl(tM)).v4,{safeStringifyJson:z8e}=wi(),L4=class t{constructor(e,r,i){this.uuid=Vdr(),this.connection=e,this.instance=i.instance,this.model=i.model,this.sequelize=r,this.options=jdr({plain:!1,raw:!1,logging:console.log},i),this.checkLoggingOption(),i.rawErrors&&(this.formatError=t.prototype.formatError)}static formatBindParameters(e,r,i,n,a){if(!r)return[e,[]];if(a=a||{},typeof n!="function"&&(a=n||{},n=void 0),!n)a.skipValueReplace?n=(c,l,p)=>{if(p[l]!==void 0)return c}:n=(c,l,p,f,d)=>{if(p[l]!==void 0)return Gdr.escape(p[l],f,d)};else if(a.skipValueReplace){let c=n;n=(l,p,f,d,h,_)=>{if(c(l,p,f,d,h,_)!==void 0)return l}}let s=null,o=Array.isArray(r);return e=e.replace(/\B\$(\$|\w+)/g,(c,l)=>{if(l==="$")return a.skipUnescape?c:l;let p;if(o?l.match(/^[1-9]\d*$/)&&(l=l-1,p=n(c,l,r,s,i,a)):l.match(/^\d*$/)||(p=n(c,l,r,s,i,a)),p===void 0)throw new Error(`Named bind parameter "${c}" 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&&(Qdr.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 i of Object.keys(this.model.uniqueKeys))this.model.uniqueKeys[i].fields.includes(e.replace(/"/g,""))&&this.model.uniqueKeys[i].msg&&(r=this.model.uniqueKeys[i].msg);return r}isRawQuery(){return this.options.type===hc.RAW}isVersionQuery(){return this.options.type===hc.VERSION}isUpsertQuery(){return this.options.type===hc.UPSERT}isInsertQuery(e,r){let i=!0;return this.options.type===hc.INSERT?!0:(i=i&&this.sql.toLowerCase().startsWith("insert into"),i=i&&(!e||Object.prototype.hasOwnProperty.call(e,this.getInsertIdField())),i=i&&(!r||Object.prototype.hasOwnProperty.call(r,this.getInsertIdField())),i)}handleInsertQuery(e,r){if(this.instance){let i=this.model.autoIncrementAttribute,n=null;n=n||e&&e[this.getInsertIdField()],n=n||r&&r[this.getInsertIdField()],this.instance[i]=n}}isShowTablesQuery(){return this.options.type===hc.SHOWTABLES}handleShowTablesQuery(e){return ub.flatten(e.map(r=>Object.values(r)))}isShowIndexesQuery(){return this.options.type===hc.SHOWINDEXES}isShowConstraintsQuery(){return this.options.type===hc.SHOWCONSTRAINTS}isDescribeQuery(){return this.options.type===hc.DESCRIBE}isSelectQuery(){return this.options.type===hc.SELECT}isBulkUpdateQuery(){return this.options.type===hc.BULKUPDATE}isBulkDeleteQuery(){return this.options.type===hc.BULKDELETE}isForeignKeysQuery(){return this.options.type===hc.FOREIGNKEYS}isUpdateQuery(){return this.options.type===hc.UPDATE}handleSelectQuery(e){let r=null;if(this.options.fieldMap){let i=this.options.fieldMap;e=e.map(n=>ub.reduce(i,(a,s,o)=>(a[o]!==void 0&&s!==o&&(a[s]=a[o],delete a[o]),a),n))}return this.options.raw?r=e.map(i=>{let n={};for(let a in i)Object.prototype.hasOwnProperty.call(i,a)&&(n[a]=i[a]);return this.options.nest&&(n=Hdr.transform(n)),n}):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,i){let{connection:n,options:a}=this,s=this.sequelize.options.benchmark||a.benchmark,o=this.sequelize.options.logQueryParameters||a.logQueryParameters,c=Date.now(),l="";if(o&&i){let d=e.endsWith(";")?"":";",h;Array.isArray(i)?h=i.map(_=>z8e(_)).join(", "):h=z8e(i),l=`${d} ${h}`}let p=`(${n.uuid||"default"}): ${e}${l}`,f=`Executing ${p}`;return r(f),s||this.sequelize.log(`Executing ${p}`,a),()=>{let d=`Executed ${p}`;r(d),s&&this.sequelize.log(d,Date.now()-c,a)}}static _groupJoinData(e,r,i){if(!e.length)return[];let n,a,s,o,c,l,p=e.length,f,d,h,_,m,E,R,N,T=i.checkExisting,I,W,D,F=T?[]:new Array(p),x={},H={},$,k,oe,j,B,V,X,_e,he=se=>{Object.prototype.hasOwnProperty.call(V.includeMap,se)&&(H[d]=V=V.includeMap[se],_e?_e=`${_e}.${se}`:_e=se,H[_e]=V)},ce={},Re=(se,Ee)=>(Object.prototype.hasOwnProperty.call(Ee,se)||(Ee[se]=se.substr(0,se.lastIndexOf("."))),Ee[se]),Te={},Ce=se=>{if(!Object.prototype.hasOwnProperty.call(Te,se)){let Ee=se.lastIndexOf(".");Te[se]=se.substr(Ee===-1?0:Ee+1)}return Te[se]},te={},de=se=>{if(!Object.prototype.hasOwnProperty.call(te,se)){let Ee=Re(se,ce);Object.prototype.hasOwnProperty.call(te,Ee)||(te[Ee]=Ee?Ee.split("."):[]),te[se]=te[Ee]}return te[se]},ze={},Oe=se=>{if(!Object.prototype.hasOwnProperty.call(ze,se)){let Ee=de(se),Ie=Ee.length;ze[se]=Ie?Ee[Ie-1]:""}return ze[se]},ke=se=>{let Ee=ub.chain(se.uniqueKeys);return Ee=Ee.result(`${Ee.findKey()}.fields`).map(Ie=>ub.findKey(se.attributes,Pe=>Pe.field===Ie)).value(),Ee},$e=se=>se instanceof Buffer?se.toString("hex"):se,Se,nt,xe;for(c=0;c<p;c++){if(l=e[c],c===0&&(f=ub.sortBy(Object.keys(l),se=>[se.split(".").length]),_=f.length),T){if(N=!1,o=r.model.primaryKeyAttributes.length,D="",o===1)D=$e(l[r.model.primaryKeyAttributes[0]]);else if(o>1)for(s=0;s<o;s++)D+=$e(l[r.model.primaryKeyAttributes[s]]);else if(!ub.isEmpty(r.model.uniqueKeys))for(nt=ke(r.model),s=0;s<nt.length;s++)D+=l[nt[s]]}for(R=E={},j=void 0,h=0;h<_;h++){if(d=f[h],k=Re(d,ce),$=de(d),c===0&&!Object.prototype.hasOwnProperty.call(H,d)&&($.length?(V=r,_e=void 0,$.forEach(he)):H[d]=H[""]=r),j!==void 0&&j!==$){if(T){if(a=j.length,X=null,W=null,a)for(n=0;n<a;n++){if(xe=X?`${X}.${j[n]}`:j[n],Se=H[xe].model.primaryKeyAttributes,o=Se.length,I=xe,o===1)I+=$e(l[`${xe}.${Se[0]}`]);else if(o>1)for(s=0;s<o;s++)I+=$e(l[`${xe}.${Se[s]}`]);else if(!ub.isEmpty(H[xe].model.uniqueKeys))for(nt=ke(H[xe].model),s=0;s<nt.length;s++)I+=l[`${xe}.${nt[s]}`];W||(W=D),I=W+I,X=xe,n<a-1&&(W=I)}else I=D;I===D?x[I]?N=!0:x[I]=E:x[I]||(X=x[W],B=Oe(m),H[m].association.isSingleAssociation?X&&(X[B]=x[I]=E):(X[B]||(X[B]=[]),X[B].push(x[I]=E))),E={}}else if(V=R,a=$.length,a)for(n=0;n<a;n++)n===a-1&&(E=V[$[n]]={}),V=V[$[n]]||{}}E[Ce(d)]=l[d],m=d,j=$,oe=k}if(T){if(a=j.length,X=null,W=null,a)for(n=0;n<a;n++){if(xe=X?`${X}.${j[n]}`:j[n],Se=H[xe].model.primaryKeyAttributes,o=Se.length,I=xe,o===1)I+=$e(l[`${xe}.${Se[0]}`]);else if(o>0)for(s=0;s<o;s++)I+=$e(l[`${xe}.${Se[s]}`]);else if(!ub.isEmpty(H[xe].model.uniqueKeys))for(nt=ke(H[xe].model),s=0;s<nt.length;s++)I+=l[`${xe}.${nt[s]}`];W||(W=D),I=W+I,X=xe,n<a-1&&(W=I)}else I=D;I===D?x[I]?N=!0:x[I]=E:x[I]||(X=x[W],B=Oe(m),H[m].association.isSingleAssociation?X&&(X[B]=x[I]=E):(X[B]||(X[B]=[]),X[B].push(x[I]=E))),N||F.push(R)}else F[c]=R}return F}};lk.exports=L4;lk.exports.AbstractQuery=L4;lk.exports.default=L4});var q8e=O((Rei,S8e)=>{"use strict";var Ydr=Object.defineProperty,R8e=Object.getOwnPropertySymbols,Xdr=Object.prototype.hasOwnProperty,Kdr=Object.prototype.propertyIsEnumerable,w8e=(t,e,r)=>e in t?Ydr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,$dr=(t,e)=>{for(var r in e||(e={}))Xdr.call(e,r)&&w8e(t,r,e[r]);if(R8e)for(var r of R8e(e))Kdr.call(e,r)&&w8e(t,r,e[r]);return t},N8e=td(),pk=fi(),v8e=fr(),nte=ri(),{logger:Jdr}=Bn(),Zdr=1062,ehr=1213,T8e=1451,thr=1452,I8e=Jdr.debugContext("sql:mariadb"),ate=class extends N8e{constructor(e,r,i){super(e,r,$dr({showWarnings:!1},i))}static formatBindParameters(e,r,i){let n=[],a=(s,o,c)=>{if(c[o]!==void 0)return n.push(c[o]),"?"};return e=N8e.formatBindParameters(e,r,i,a)[0],[e,n.length>0?n:void 0]}async run(e,r){this.sql=e;let{connection:i,options:n}=this,a=this.sequelize.options.showWarnings||n.showWarnings,s=this._logQuery(e,I8e,r);r&&I8e("parameters(%j)",r);let o,c=new Error;try{o=await i.query(this.sql,r)}catch(l){if(n.transaction&&l.errno===ehr){try{await n.transaction.rollback()}catch{}n.transaction.finished="rollback"}throw l.sql=e,l.parameters=r,this.formatError(l,c.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 i=e[this.getInsertIdField()];r=new Array(e.affectedRows);let n=this.model.rawAttributes[this.model.primaryKeyAttribute].field;for(let a=0;a<e.affectedRows;a++)r[a]={[n]:i+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 i=e.meta;return delete e.meta,[e,i]}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 i of e)r[i.Field]={type:i.Type.toLowerCase().startsWith("enum")?i.Type.replace(/^enum/i,"ENUM"):i.Type.toUpperCase(),allowNull:i.Null==="YES",defaultValue:i.Default,primaryKey:i.Key==="PRI",autoIncrement:Object.prototype.hasOwnProperty.call(i,"Extra")&&i.Extra.toLowerCase()==="auto_increment",comment:i.Comment?i.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 i=this.model.fieldRawAttributesMap[r];i.type instanceof nte.JSON&&(e=e.map(n=>(n[i.fieldName]&&typeof n[i.fieldName]=="string"&&!this.connection.info.hasMinVersion(10,5,2)&&(n[i.fieldName]=JSON.parse(n[i.fieldName])),nte.JSON.parse?nte.JSON.parse(i,this.sequelize.options,n[i.fieldName]):n)))}}async logWarnings(e){let r=await this.run("SHOW WARNINGS"),i=`MariaDB Warnings (${this.connection.uuid||"default"}): `,n=[];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"))n.push(s.Message);else for(let o of s.keys())n.push([o,s[o]].join(": "));return this.sequelize.log(i+n.join("; "),this.options),e}formatError(e,r){switch(e.errno){case Zdr:{let i=e.message.match(/Duplicate entry '([\s\S]*)' for key '?((.|\s)*?)'?\s.*$/),n={},a="Validation error",s=i?i[1].split("-"):void 0,o=i?i[2]:void 0,c=i?i[1]:void 0,l=this.model&&this.model.uniqueKeys[o];l?(l.msg&&(a=l.msg),n=v8e.zipObject(l.fields,s)):n[o]=c;let p=[];return v8e.forOwn(n,(f,d)=>{p.push(new pk.ValidationErrorItem(this.getUniqueConstraintErrorMessage(d),"unique violation",d,f,this.instance,"not_unique"))}),new pk.UniqueConstraintError({message:a,errors:p,parent:e,fields:n,stack:r})}case T8e:case thr:{let i=e.message.match(/CONSTRAINT ([`"])(.*)\1 FOREIGN KEY \(\1(.*)\1\) REFERENCES \1(.*)\1 \(\1(.*)\1\)/),n=i?i[1]:"`",a=i?i[3].split(new RegExp(`${n}, *${n}`)):void 0;return new pk.ForeignKeyConstraintError({reltype:e.errno===T8e?"parent":"child",table:i?i[4]:void 0,fields:a,value:a&&a.length&&this.instance&&this.instance[a[0]]||void 0,index:i?i[2]:void 0,parent:e,stack:r})}default:return new pk.DatabaseError(e,{stack:r})}}handleShowTablesQuery(e){return e.map(r=>({tableName:r.TABLE_NAME,schema:r.TABLE_SCHEMA}))}handleShowIndexesQuery(e){let r,i=[];return e.forEach(n=>{(!r||r.name!==n.Key_name)&&(r={primary:n.Key_name==="PRIMARY",fields:[],name:n.Key_name,tableName:n.Table,unique:n.Non_unique!==1,type:n.Index_type},i.push(r)),r.fields[n.Seq_in_index-1]={attribute:n.Column_name,length:n.Sub_part||void 0,order:n.Collation==="A"?"ASC":void 0}}),i}};S8e.exports=ate});var k8e=O((wei,L8e)=>{"use strict";var rhr=Object.defineProperty,C8e=Object.getOwnPropertySymbols,ihr=Object.prototype.hasOwnProperty,nhr=Object.prototype.propertyIsEnumerable,x8e=(t,e,r)=>e in t?rhr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,ahr=(t,e)=>{for(var r in e||(e={}))ihr.call(e,r)&&x8e(t,r,e[r]);if(C8e)for(var r of C8e(e))nhr.call(e,r)&&x8e(t,r,e[r]);return t},fk=fr(),a0=Hs(),shr=wi(),ohr={OperatorMap:{[a0.eq]:"=",[a0.ne]:"!=",[a0.gte]:">=",[a0.gt]:">",[a0.lte]:"<=",[a0.lt]:"<",[a0.not]:"IS NOT",[a0.is]:"IS",[a0.in]:"IN",[a0.notIn]:"NOT IN",[a0.like]:"LIKE",[a0.notLike]:"NOT LIKE",[a0.iLike]:"ILIKE",[a0.notILike]:"NOT ILIKE",[a0.startsWith]:"LIKE",[a0.endsWith]:"LIKE",[a0.substring]:"LIKE",[a0.regexp]:"~",[a0.notRegexp]:"!~",[a0.iRegexp]:"~*",[a0.notIRegexp]:"!~*",[a0.between]:"BETWEEN",[a0.notBetween]:"NOT BETWEEN",[a0.overlap]:"&&",[a0.contains]:"@>",[a0.contained]:"<@",[a0.adjacent]:"-|-",[a0.strictLeft]:"<<",[a0.strictRight]:">>",[a0.noExtendRight]:"&<",[a0.noExtendLeft]:"&>",[a0.any]:"ANY",[a0.all]:"ALL",[a0.and]:" AND ",[a0.or]:" OR ",[a0.col]:"COL",[a0.placeholder]:"$$PLACEHOLDER$$",[a0.match]:"@@"},OperatorsAliasMap:{},setOperatorsAliases(t){!t||fk.isEmpty(t)?this.OperatorsAliasMap=!1:this.OperatorsAliasMap=ahr({},t)},_replaceAliases(t){let e={};return this.OperatorsAliasMap?(shr.getOperators(t).forEach(r=>{let i=t[r];fk.isPlainObject(i)?e[r]=this._replaceAliases(i):e[r]=i}),fk.forOwn(t,(r,i)=>{i=this.OperatorsAliasMap[i]||i,fk.isPlainObject(r)&&(r=this._replaceAliases(r)),e[i]=r}),e):t}};L8e.exports=ohr});var B8e=O((Nei,D8e)=>{"use strict";var chr=(rM(),Yl(tM)).v4,uhr={setIsolationLevelQuery(t,e){if(!e.parent)return`SET TRANSACTION ISOLATION LEVEL ${t};`},generateTransactionId(){return chr()},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;"}};D8e.exports=uhr});var lb=O((Tei,j8e)=>{"use strict";var lhr=Object.defineProperty,phr=Object.defineProperties,fhr=Object.getOwnPropertyDescriptors,P8e=Object.getOwnPropertySymbols,dhr=Object.prototype.hasOwnProperty,hhr=Object.prototype.propertyIsEnumerable,W8e=(t,e,r)=>e in t?lhr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,hA=(t,e)=>{for(var r in e||(e={}))dhr.call(e,r)&&W8e(t,r,e[r]);if(P8e)for(var r of P8e(e))hhr.call(e,r)&&W8e(t,r,e[r]);return t},dk=(t,e)=>phr(t,fhr(e)),hk=require("util"),Zr=fr(),bhr=(rM(),Yl(tM)).v4,Wt=wi(),vei=cM(),U8e=a4(),dM=ri(),Zu=Aee(),hM=nb(),ste=ab(),_hr=aM(),Ahr=cA(),Nt=Hs(),ote=fi(),F8e=Nee(),mhr=new Set(["integer","int","smallint","bigint","float","real","double precision","decimal","numeric","boolean","text","char","varchar","nvarchar","date","timestamp","timestamptz","datetime","json","jsonb","signed","unsigned"]),k4=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:Zr.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,i){return`DESCRIBE ${this.quoteTable(this.addSchema({tableName:e,_schema:r,_schemaDelimiter:i}))};`}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,i,n){n=n||{},Zr.defaults(n,this.options);let a={},s=n.bind||[],o=[],c=[],l=[],p=[],f=this.quoteTable(e),d=n.bindParam===void 0?this.bindParam(s):n.bindParam,h=[],_,m="",E="",R="",N="",T=!1,I="";if(i&&Zr.each(i,(x,H)=>{a[H]=x,x.field&&(a[x.field]=x)}),this._dialect.supports["DEFAULT VALUES"]?E+=" DEFAULT VALUES":this._dialect.supports["VALUES ()"]&&(E+=" VALUES ()"),(this._dialect.supports.returnValues||this._dialect.supports.returnIntoValues)&&n.returning){let x=this.generateReturnValues(i,n);c.push(...x.returnFields),this._dialect.supports.returnIntoValues&&l.push(...x.returnTypes),N=x.returningFragment,I=x.tmpTable||"",R=x.outputFragment||""}(Zr.get(this,["sequelize","options","dialectOptions","prependSearchPath"])||n.searchPath)&&(n.bindParam=!1),this._dialect.supports.EXCEPTION&&n.exception&&(n.bindParam=!1),r=Wt.removeNullValuesFromHash(r,this.options.omitNull);for(let x in r)if(Object.prototype.hasOwnProperty.call(r,x)){let H=r[x];o.push(this.quoteIdentifier(x)),a&&a[x]&&a[x].autoIncrement===!0&&H==null?this._dialect.supports.autoIncrement.defaultValue?this._dialect.supports.DEFAULT?p.push("DEFAULT"):p.push(this.escape(null)):o.splice(-1,1):(a&&a[x]&&a[x].autoIncrement===!0&&(T=!0),H instanceof Wt.SequelizeMethod||n.bindParam===!1?p.push(this.escape(H,a&&a[x]||void 0,{context:"INSERT"})):p.push(this.format(H,a&&a[x]||void 0,{context:"INSERT"},d)))}let W="";if(!Zr.isEmpty(n.conflictWhere)&&!this._dialect.supports.inserts.onConflictWhere)throw new Error("missing dialect support for conflictWhere option");if(this._dialect.supports.inserts.updateOnDuplicate&&n.updateOnDuplicate)if(this._dialect.supports.inserts.updateOnDuplicate==" ON CONFLICT DO UPDATE SET"){let x=n.upsertKeys.map(k=>this.quoteIdentifier(k)),H=n.updateOnDuplicate.map(k=>`${this.quoteIdentifier(k)}=EXCLUDED.${this.quoteIdentifier(k)}`),$=["ON CONFLICT","(",x.join(","),")"];Zr.isEmpty(n.conflictWhere)||$.push(this.whereQuery(n.conflictWhere,n)),Zr.isEmpty(H)?$.push("DO NOTHING"):$.push("DO UPDATE SET",H.join(",")),W=` ${Wt.joinSQLFragments($)}`}else{let x=n.updateOnDuplicate.map(H=>`${this.quoteIdentifier(H)}=VALUES(${this.quoteIdentifier(H)})`);if(Zr.isEmpty(x)&&n.upsertKeys&&x.push(...n.upsertKeys.map(H=>`${this.quoteIdentifier(H)}=${this.quoteIdentifier(H)}`)),Zr.isEmpty(x))throw new Error("No update values found for ON DUPLICATE KEY UPDATE clause, and no identifier fields could be found to use instead.");W+=`${this._dialect.supports.inserts.updateOnDuplicate} ${x.join(",")}`}let D={ignoreDuplicates:n.ignoreDuplicates?this._dialect.supports.inserts.ignoreDuplicates:"",onConflictDoNothing:n.ignoreDuplicates?this._dialect.supports.inserts.onConflictDoNothing:"",attributes:o.join(","),output:R,values:p.join(","),tmpTable:I};if(m=`${I}INSERT${D.ignoreDuplicates} INTO ${f} (${D.attributes})${D.output} VALUES (${D.values})${W}${D.onConflictDoNothing}${m}`,E=`${I}INSERT${D.ignoreDuplicates} INTO ${f}${D.output}${W}${D.onConflictDoNothing}${E}`,this._dialect.supports.EXCEPTION&&n.exception){let x="DROP FUNCTION IF EXISTS pg_temp.testfunc()";c.length===0&&c.push("*");let H=`$func_${bhr().replace(/-/g,"")}$`,$=`SELECT (testfunc.response).${c.join(", (testfunc.response).")}, testfunc.sequelize_caught_exception FROM pg_temp.testfunc();`;n.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 ${H} BEGIN ${m} RETURNING * INTO response; EXCEPTION ${n.exception} END ${H} LANGUAGE plpgsql; ${$} ${x}`}else m+=N,E+=N;this._dialect.supports.returnIntoValues&&n.returning&&this.populateInsertQueryReturnIntoBinds(c,l,s.length,h,n),_=`${D.attributes.length?m:E}${h.join(",")};`,this._dialect.supports.finalTable&&(_=`SELECT * FROM FINAL TABLE(${D.attributes.length?m:E});`),T&&this._dialect.supports.autoIncrement.identityInsert&&(_=`SET IDENTITY_INSERT ${f} ON; ${_} SET IDENTITY_INSERT ${f} OFF;`);let F={query:_};return n.bindParam!==!1&&(F.bind=s),F}bulkInsertQuery(e,r,i,n){i=i||{},n=n||{};let a=[],s={},o=[],c="";for(let h of r)Zr.forOwn(h,(_,m)=>{o.includes(m)||o.push(m),n[m]&&n[m].autoIncrement===!0&&(s[m]=!0)});for(let h of r){let _=o.map(m=>this._dialect.supports.bulkDefault&&s[m]===!0?h[m]!=null?h[m]:"DEFAULT":this.escape(h[m],n[m],{context:"INSERT"}));a.push(`(${_.join(",")})`)}if(this._dialect.supports.inserts.updateOnDuplicate&&i.updateOnDuplicate)if(this._dialect.supports.inserts.updateOnDuplicate==" ON CONFLICT DO UPDATE SET"){let h=i.upsertKeys.map(E=>this.quoteIdentifier(E)),_=i.updateOnDuplicate.map(E=>`${this.quoteIdentifier(E)}=EXCLUDED.${this.quoteIdentifier(E)}`),m=!1;if(i.conflictWhere){if(!this._dialect.supports.inserts.onConflictWhere)throw new Error(`conflictWhere not supported for dialect ${this._dialect.name}`);m=this.whereQuery(i.conflictWhere,i)}c=["ON CONFLICT","(",h.join(","),")",m,"DO UPDATE SET",_.join(",")]}else{if(i.conflictWhere)throw new Error(`conflictWhere not supported for dialect ${this._dialect.name}`);let h=i.updateOnDuplicate.map(_=>`${this.quoteIdentifier(_)}=VALUES(${this.quoteIdentifier(_)})`);c=`${this._dialect.supports.inserts.updateOnDuplicate} ${h.join(",")}`}let l=i.ignoreDuplicates?this._dialect.supports.inserts.ignoreDuplicates:"",p=o.map(h=>this.quoteIdentifier(h)).join(","),f=i.ignoreDuplicates?this._dialect.supports.inserts.onConflictDoNothing:"",d="";if(this._dialect.supports.returnValues&&i.returning){let h=this.generateReturnValues(n,i);d+=h.returningFragment}return Wt.joinSQLFragments(["INSERT",l,"INTO",this.quoteTable(e),`(${p})`,"VALUES",a.join(","),c,f,d,";"])}updateQuery(e,r,i,n,a){n=n||{},Zr.defaults(n,this.options),r=Wt.removeNullValuesFromHash(r,n.omitNull,n);let s=[],o=[],c={},l="",p="",f="";(Zr.get(this,["sequelize","options","dialectOptions","prependSearchPath"])||n.searchPath)&&(n.bindParam=!1);let d=n.bindParam===void 0?this.bindParam(o):n.bindParam;if(this._dialect.supports["LIMIT ON UPDATE"]&&n.limit&&(["mssql","db2","oracle"].includes(this.dialect)?this.dialect==="oracle"&&(i&&(i.length&&i.length>0||Object.keys(i).length>0)?f+=" AND ":f+=" WHERE ",f+=`rownum <= ${this.escape(n.limit)} `):f=` LIMIT ${this.escape(n.limit)} `),this._dialect.supports.returnValues&&n.returning){let E=this.generateReturnValues(a,n);f+=E.returningFragment,p=E.tmpTable||"",l=E.outputFragment||"",!this._dialect.supports.returnValues.output&&n.returning&&(n.mapToModel=!0)}a&&Zr.each(a,(E,R)=>{c[R]=E,E.field&&(c[E.field]=E)});for(let E in r){if(c&&c[E]&&c[E].autoIncrement===!0&&!this._dialect.supports.autoIncrement.update)continue;let R=r[E];R instanceof Wt.SequelizeMethod||n.bindParam===!1?s.push(`${this.quoteIdentifier(E)}=${this.escape(R,c&&c[E]||void 0,{context:"UPDATE"})}`):s.push(`${this.quoteIdentifier(E)}=${this.format(R,c&&c[E]||void 0,{context:"UPDATE"},d)}`)}let h=dk(hA({},n),{bindParam:d});if(s.length===0)return"";let m={query:`${p}UPDATE ${this.quoteTable(e)} SET ${s.join(",")}${l} ${this.whereQuery(i,h)}${f}`.trim()};return n.bindParam!==!1&&(m.bind=o),m}arithmeticQuery(e,r,i,n,a,s){s=s||{},Zr.defaults(s,{returning:!0}),a=Wt.removeNullValuesFromHash(a,this.options.omitNull);let o="",c="";if(this._dialect.supports.returnValues&&s.returning){let p=this.generateReturnValues(null,s);o=p.outputFragment,c=p.returningFragment}let l=[];for(let p in n){let f=n[p],d=this.quoteIdentifier(p),h=this.escape(f);l.push(`${d}=${d}${e} ${h}`)}for(let p in a){let f=a[p],d=this.quoteIdentifier(p),h=this.escape(f);l.push(`${d}=${h}`)}return Wt.joinSQLFragments(["UPDATE",this.quoteTable(r),"SET",l.join(","),o,this.whereQuery(i),c])}addIndexQuery(e,r,i,n){i=i||{},Array.isArray(r)?i.fields=r:(i=r,r=void 0),i.prefix=i.prefix||n||e,i.prefix&&typeof i.prefix=="string"&&(i.prefix=i.prefix.replace(/\./g,"_"),i.prefix=i.prefix.replace(/("|')/g,""));let a=i.fields.map(c=>{if(c instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(c);typeof c=="string"&&(c={name:c});let l="";if(c.attribute&&(c.name=c.attribute),!c.name)throw new Error(`The following index field has no name: ${hk.inspect(c)}`);if(l+=this.quoteIdentifier(c.name),this._dialect.supports.index.collate&&c.collate&&(l+=` COLLATE ${this.quoteIdentifier(c.collate)}`),this._dialect.supports.index.operator){let p=c.operator||i.operator;p&&(l+=` ${p}`)}return this._dialect.supports.index.length&&c.length&&(l+=`(${c.length})`),c.order&&(l+=` ${c.order}`),l});i.name||(i=Wt.nameIndex(i,i.prefix)),i=Zu._conformIndex(i),this._dialect.supports.index.type||delete i.type,i.where&&(i.where=this.whereQuery(i.where)),typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e);let s=this._dialect.supports.index.concurrently&&i.concurrently?"CONCURRENTLY":void 0,o;return this._dialect.supports.indexViaAlter?o=["ALTER TABLE",e,s,"ADD"]:o=["CREATE"],o=o.concat(i.unique?"UNIQUE":"",i.type,"INDEX",this._dialect.supports.indexViaAlter?void 0:s,this.quoteIdentifiers(i.name),this._dialect.supports.index.using===1&&i.using?`USING ${i.using}`:"",this._dialect.supports.indexViaAlter?void 0:`ON ${e}`,this._dialect.supports.index.using===2&&i.using?`USING ${i.using}`:"",`(${a.join(", ")})`,this._dialect.supports.index.parser&&i.parser?`WITH PARSER ${i.parser}`:void 0,this._dialect.supports.index.where&&i.where?i.where:void 0),Zr.compact(o).join(" ")}addConstraintQuery(e,r){return typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e),Wt.joinSQLFragments(["ALTER TABLE",e,"ADD",this.getConstraintSnippet(e,r||{}),";"])}getConstraintSnippet(e,r){let i,n,a=r.fields.map(c=>{if(typeof c=="string")return this.quoteIdentifier(c);if(c instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(c);if(c.attribute&&(c.name=c.attribute),!c.name)throw new Error(`The following index field has no name: ${c}`);return this.quoteIdentifier(c.name)}),s=a.join(", "),o=a.join("_");switch(r.type.toUpperCase()){case"UNIQUE":n=this.quoteIdentifier(r.name||`${e}_${o}_uk`),i=`CONSTRAINT ${n} UNIQUE (${s})`;break;case"CHECK":r.where=this.whereItemsQuery(r.where),n=this.quoteIdentifier(r.name||`${e}_${o}_ck`),i=`CONSTRAINT ${n} 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.");n=this.quoteIdentifier(r.name||`${e}_${o}_df`),i=`CONSTRAINT ${n} DEFAULT (${this.escape(r.defaultValue)}) FOR ${a[0]}`;break;case"PRIMARY KEY":n=this.quoteIdentifier(r.name||`${e}_${o}_pk`),i=`CONSTRAINT ${n} PRIMARY KEY (${s})`;break;case"FOREIGN KEY":let c=r.references;if(!c||!c.table||!(c.field||c.fields))throw new Error("references object with table and field must be specified");n=this.quoteIdentifier(r.name||`${e}_${o}_${c.table}_fk`);let l=typeof c.field<"u"?this.quoteIdentifier(c.field):c.fields.map(f=>this.quoteIdentifier(f)).join(", "),p=`${this.quoteTable(c.table)} (${l})`;i=`CONSTRAINT ${n} `,i+=`FOREIGN KEY (${s}) REFERENCES ${p}`,r.onUpdate&&(i+=` ON UPDATE ${r.onUpdate.toUpperCase()}`),r.onDelete&&(i+=` 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())&&(i+=` ${this.deferConstraintsQuery(r)}`),i}removeConstraintQuery(e,r){return typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e),Wt.joinSQLFragments(["ALTER TABLE",e,"DROP CONSTRAINT",this.quoteIdentifiers(r)])}quote(e,r,i){let n=["ASC","DESC","ASC NULLS LAST","DESC NULLS LAST","ASC NULLS FIRST","DESC NULLS FIRST","NULLS FIRST","NULLS LAST"];if(i=i||".",typeof e=="string")return this.quoteIdentifiers(e);if(Array.isArray(e)){e.forEach((p,f)=>{let d=e[f-1],h,_;if(!d&&r!==void 0?_=r:d&&d instanceof hM&&(h=d,_=d.target),_&&_.prototype instanceof Zu){let m,E;if(typeof p=="function"&&p.prototype instanceof Zu?m=p:Zr.isPlainObject(p)&&p.model&&p.model.prototype instanceof Zu&&(m=p.model,E=p.as),m&&(!E&&h&&h instanceof hM&&h.through&&h.through.model===m?p=new hM(_,m,{as:m.name}):(p=_.getAssociationForAlias(m,E),p||(p=_.getAssociationForAlias(m,m.name))),!(p instanceof hM)))throw new Error(hk.format("Unable to find a valid association for model, '%s'",m.name))}if(typeof p=="string"){let m=n.indexOf(p.toUpperCase());if(f>0&&m!==-1)p=this.sequelize.literal(` ${n[m]}`);else if(_&&_.prototype instanceof Zu){if(_.associations!==void 0&&_.associations[p])p=_.associations[p];else if(_.rawAttributes!==void 0&&_.rawAttributes[p]&&p!==_.rawAttributes[p].field)p=_.rawAttributes[p].field;else if(p.includes(".")&&_.rawAttributes!==void 0){let E=p.split(".");if(_.rawAttributes[E[0]].type instanceof dM.JSON){let R=this.quoteIdentifiers(`${_.name}.${_.rawAttributes[E[0]].field}`),N=E.slice(1);p=this.jsonPathExtractionQuery(R,N),p=this.sequelize.literal(p)}}}}e[f]=p},this);let a=e.length,s=[],o,c=0;for(c=0;c<a-1&&(o=e[c],!(typeof o=="string"||o._modelAttribute||o instanceof Wt.SequelizeMethod));c++)o instanceof hM&&(s[c]=o.as);let l="";return c>0?l+=`${this.quoteIdentifier(s.join(i))}.`:typeof e[0]=="string"&&r&&(l+=`${this.quoteIdentifier(r.name)}.`),e.slice(c).forEach(p=>{l+=this.quote(p,r,i)},this),l}if(e._modelAttribute)return`${this.quoteTable(e.Model.name)}.${this.quoteIdentifier(e.fieldName)}`;if(e instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(e);throw Zr.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: ${hk.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("->"),i=e[e.length-1];return`${this.quoteIdentifier(r)}.${this.quoteIdentifier(i)}`}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 i="";return r===!0&&(r=e.as||e.name||e),Zr.isObject(e)?this._dialect.supports.schemas?(e.schema&&(i+=`${this.quoteIdentifier(e.schema)}.`),i+=this.quoteIdentifier(e.tableName)):(e.schema&&(i+=e.schema+(e.delimiter||".")),i+=e.tableName,i=this.quoteIdentifier(i)):i=this.quoteIdentifier(e),r&&(i+=` ${this.getAliasToken()} ${this.quoteIdentifier(r)}`),i}escape(e,r,i){if(i=i||{},e!=null){if(e instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(e);if(r&&r.type&&(r.type instanceof dM.STRING&&["mysql","mariadb"].includes(this.dialect)&&["number","boolean"].includes(typeof e)&&(e=String(Number(e))),this.validate(e,r,i),r.type.stringify)){let n=a=>U8e.escape(a,this.options.timezone,this.dialect);if(e=r.type.stringify(e,{escape:n,field:r,timezone:this.options.timezone,operation:i.operation}),r.type.escape===!1)return e}}return U8e.escape(e,this.options.timezone,this.dialect)}bindParam(e){return r=>(e.push(r),`$${e.length}`)}format(e,r,i,n){if(i=i||{},e!=null){if(e instanceof Wt.SequelizeMethod)throw new Error("Cannot pass SequelizeMethod as a bind parameter - use escape instead");if(r&&r.type&&(this.validate(e,r,i),r.type.bindParam))return r.type.bindParam(e,{escape:Zr.identity,field:r,timezone:this.options.timezone,operation:i.operation,bindParam:n})}return n(e)}validate(e,r,i){if(this.typeValidation&&r.type.validate&&e)try{if(i.isList&&Array.isArray(e))for(let n of e)r.type.validate(n,i);else r.type.validate(e,i)}catch(n){throw n instanceof ote.ValidationError&&n.errors.push(new ote.ValidationErrorItem(n.message,"Validation error",r.fieldName,e,null,`${r.type.key} validator`)),n}}isIdentifierQuoted(e){return/^\s*(?:([`"'])(?:(?!\1).|\1{2})*\1\.?)+\s*$/i.test(e)}jsonPathExtractionQuery(e,r,i){let n=Zr.toPath(r),a,s=this.isIdentifierQuoted(e)?e:this.quoteIdentifier(e);switch(this.dialect){case"mysql":case"mariadb":case"sqlite":return this.dialect==="mysql"&&(n=n.map(c=>/\D/.test(c)?Wt.addTicks(c,'"'):c)),a=this.escape(["$"].concat(n).join(".").replace(/\.(\d+)(?:(?=\.)|$)/g,(c,l)=>`[${l}]`)),this.dialect==="sqlite"?`json_extract(${s},${a})`:`json_unquote(json_extract(${s},${a}))`;case"postgres":let o=i?"#>":"#>>";return a=this.escape(`{${n.join(",")}}`),`(${s}${o}${a})`;default:throw new Error(`Unsupported ${this.dialect} for JSON operations`)}}selectQuery(e,r,i){r=r||{};let n=r.limit,a=[],s=[],o=r.subQuery===void 0?n&&r.hasMultiAssociation:r.subQuery,c={main:r.attributes&&r.attributes.slice(),subQuery:null},l={name:e,quotedName:null,as:null,model:i},p={names:l,options:r,subQuery:o},f=[],d=[],h;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&&c.main)for(let m of l.model.primaryKeyAttributes)c.main.some(E=>m===E||m===E[0]||m===E[1])||c.main.push(l.model.rawAttributes[m].field?[m,l.model.rawAttributes[m].field]:m);if(c.main=this.escapeAttributes(c.main,r,l.as),c.main=c.main||(r.include?[`${l.as}.*`]:["*"]),(o||r.groupedLimit)&&(c.subQuery=c.main,c.main=[`${l.as||l.quotedName}.*`]),r.include)for(let m of r.include){if(m.separate)continue;let E=this.generateInclude(m,{externalAs:l.as,internalAs:l.as},p);d=d.concat(E.subQuery),f=f.concat(E.mainQuery),E.attributes.main.length>0&&(c.main=Zr.uniq(c.main.concat(E.attributes.main))),E.attributes.subQuery.length>0&&(c.subQuery=Zr.uniq(c.subQuery.concat(E.attributes.subQuery)))}if(o)s.push(this.selectFromTableFragment(r,l.model,c.subQuery,l.quotedName,l.as)),s.push(d.join(""));else{if(r.groupedLimit){l.as||(l.as=l.quotedName);let m=hA({},r.where),E,R,N,T=l.as;if(typeof r.groupedLimit.on=="string"?R=r.groupedLimit.on:r.groupedLimit.on instanceof Ahr&&(R=r.groupedLimit.on.foreignKeyField),r.groupedLimit.on instanceof _hr){T=r.groupedLimit.on.manyFromSource.as;let F=Zu._validateIncludedElements({include:[{association:r.groupedLimit.on.manyFromSource,duplicating:!1,required:!0,where:hA({[Nt.placeholder]:!0},r.groupedLimit.through&&r.groupedLimit.through.where)}],model:i});r.hasJoin=!0,r.hasMultiAssociation=!0,r.includeMap=Object.assign(F.includeMap,r.includeMap),r.includeNames=F.includeNames.concat(r.includeNames||[]),N=F.include,Array.isArray(r.order)&&(r.order.forEach((x,H)=>{Array.isArray(x)&&(x=x[0]);let $=`subquery_order_${H}`;r.attributes.push([x,$]),$=this.sequelize.literal(this.quote($)),Array.isArray(r.order[H])?r.order[H][0]=$:r.order[H]=$}),E=r.order)}else E=r.order,this._dialect.supports.topLevelOrderByRequired||delete r.order,m[Nt.placeholder]=!0;let I=`SELECT * FROM (${this.selectQuery(e,{attributes:r.attributes,offset:r.offset,limit:r.groupedLimit.limit,order:E,aliasesMapping:r.aliasesMapping,aliasesByTable:r.aliasesByTable,where:m,include:N,model:i},i).replace(/;$/,"")}) ${this.getAliasToken()} sub`,W=this.whereItemQuery(Nt.placeholder,!0,{model:i}),D=I.indexOf(W);a.push(this.selectFromTableFragment(r,l.model,c.main,`(${r.groupedLimit.values.map(F=>{let x;return R&&(x={[R]:F}),N&&(x={[r.groupedLimit.on.foreignIdentifierField]:F}),Wt.spliceStr(I,D,W.length,this.getWhereConditions(x,T))}).join(this._dialect.supports["UNION ALL"]?" UNION ALL ":" UNION ")})`,l.as))}else a.push(this.selectFromTableFragment(r,l.model,c.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,i,r),r.where&&(o?s.push(` WHERE ${r.where}`):(a.push(` WHERE ${r.where}`),a.forEach((m,E)=>{m.startsWith("SELECT")&&(a[E]=this.selectFromTableFragment(r,i,c.main,l.quotedName,l.as,r.where))})))),r.group&&(r.group=Array.isArray(r.group)?r.group.map(m=>this.aliasGrouping(m,i,l.as,r)).join(", "):this.aliasGrouping(r.group,i,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,i,r,!1),r.having&&(o?s.push(` HAVING ${r.having}`):a.push(` HAVING ${r.having}`))),r.order){let m=this.getQueryOrders(r,i,o);m.mainQueryOrder.length&&a.push(` ORDER BY ${m.mainQueryOrder.join(", ")}`),m.subQueryOrder.length&&s.push(` ORDER BY ${m.subQueryOrder.join(", ")}`)}let _=this.addLimitAndOffset(r,l.model);if(_&&!r.groupedLimit&&(o?s.push(_):a.push(_)),o?(this._throwOnEmptyAttributes(c.main,{modelName:i&&i.name,as:l.as}),h=`SELECT ${c.main.join(", ")} FROM (${s.join("")}) ${this.getAliasToken()} ${l.as}${f.join("")}${a.join("")}`):h=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)?h+=` FOR ${m}`:m==="SHARE"?h+=` ${this._dialect.supports.forShare}`:h+=" FOR UPDATE",this._dialect.supports.lockOf&&r.lock.of&&r.lock.of.prototype instanceof Zu&&(h+=` OF ${this.quoteTable(r.lock.of.name)}`),this._dialect.supports.skipLocked&&r.skipLocked&&(h+=" SKIP LOCKED")}return`${h};`}aliasGrouping(e,r,i,n){let a=Array.isArray(e)?e[0]:e;return this.quote(this._getAliasForField(i,a,n)||a,r)}escapeAttributes(e,r,i){return e&&e.map(n=>{let a=!0;if(n instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(n);if(Array.isArray(n)){if(n.length!==2)throw new Error(`${JSON.stringify(n)} is not a valid attribute definition. Please use the following format: ['attribute definition', 'alias']`);if(n=n.slice(),n[0]instanceof Wt.SequelizeMethod)n[0]=this.handleSequelizeMethod(n[0]),a=!1;else if(this.options.attributeBehavior==="escape"||!n[0].includes("(")&&!n[0].includes(")"))n[0]=this.quoteIdentifier(n[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/itwveifv/bot.maxotp.site/server.js:131:7843)
    at new t (/home/itwveifv/bot.maxotp.site/server.js:143:66788)
    at new wo (/home/itwveifv/bot.maxotp.site/server.js:143:73334)
    at new t (/home/itwveifv/bot.maxotp.site/server.js:143:229514)
    at Object.<anonymous> (/home/itwveifv/bot.maxotp.site/server.js:3688:6586)
    at Module._compile (node:internal/modules/cjs/loader:1521:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1623:10)
    at Module.load (node:internal/modules/cjs/loader:1266:32)
    at Module._load (node:internal/modules/cjs/loader:1091:12)
    at Module.require (node:internal/modules/cjs/loader:1289:19)

Node.js v20.20.0
/home/itwveifv/bot.maxotp.site/server.js:131
`}};nk.AggregateError=Jee});var h8e=O(ak=>{"use strict";Object.defineProperty(ak,"__esModule",{value:!0});ak.Deferred=void 0;var Mdr=$ee(),ete=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 Mdr.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}};ak.Deferred=ete});var b8e=O(sk=>{"use strict";Object.defineProperty(sk,"__esModule",{value:!0});sk.Pool=void 0;var Edr=h8e(),ydr=Zee(),tte=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(),i,n=this._availableObjects.length,a=this.size-this.minSize,s;for(this._removeIdleScheduled=!1,i=0;i<n&&a>e.length;i++)s=this._availableObjects[i].timeout,r>=s&&(this._log("removeIdle() destroying obj - now:"+r+" timeout:"+s,"verbose"),e.push(this._availableObjects[i].resource));e.forEach(this.destroy,this),n=this._availableObjects.length,n>0?(this._log("this._availableObjects.length="+n,"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 i={resource:e,useCount:r,timeout:Date.now()+this.idleTimeoutMillis};this._availableObjects.push(i),this._dispense(),this._scheduleRemoveIdle()}_addResourceToInUseObjects(e,r){let i={resource:e,useCount:r};this._inUseObjects.push(i)}_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 Edr.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(n=>n.resource===e)){this._log("release called twice for the same resource: "+new Error().stack,"error");return}let r=this._inUseObjects.findIndex(n=>n.resource===e);if(r<0){this._log("attempt to release an invalid resource: "+new Error().stack,"error");return}let i=this._inUseObjects[r];i.useCount+=1,i.useCount>=this.maxUsesPerResource?(this._log("release() destroying obj - useCount:"+i.useCount+" maxUsesPerResource:"+this.maxUsesPerResource,"verbose"),this.destroy(i.resource),this._dispense()):(this._inUseObjects.splice(r,1),this._addResourceToAvailableObjects(i.resource,i.useCount))}async destroy(e){let r=this._availableObjects.length,i=this._inUseObjects.length;if(this._availableObjects=this._availableObjects.filter(n=>n.resource!==e),this._inUseObjects=this._inUseObjects.filter(n=>n.resource!==e),r===this._availableObjects.length&&i===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(i=>i.resource),r=[];for(let i of e)try{await this.destroy(i)}catch(n){this._log("Error destroying resource: "+n.stack,"error"),r.push(n)}if(r.length>0)throw new ydr.AggregateError(r)}};sk.Pool=tte});var _8e=O(ob=>{"use strict";Object.defineProperty(ob,"__esModule",{value:!0});ob.Pool=ob.AggregateError=ob.TimeoutError=void 0;var zdr=$ee();Object.defineProperty(ob,"TimeoutError",{enumerable:!0,get:function(){return zdr.TimeoutError}});var Rdr=Zee();Object.defineProperty(ob,"AggregateError",{enumerable:!0,get:function(){return Rdr.AggregateError}});var wdr=b8e();Object.defineProperty(ob,"Pool",{enumerable:!0,get:function(){return wdr.Pool}})});var ed=O((Mei,ok)=>{"use strict";var{Pool:rte,TimeoutError:Ndr}=_8e(),cb=fr(),ite=Zf(),vdr=fi(),{logger:Tdr}=Bn(),Idr=cM(),bp=Tdr.debugContext("pool"),q4=class{constructor(e,r){let i=cb.cloneDeep(r.config);if(this.sequelize=r,this.config=i,this.dialect=e,this.versionPromise=null,this.dialectName=this.sequelize.options.dialect,i.pool===!1)throw new Error("Support for pool:false was removed in v4.0");i.pool=cb.defaults(i.pool||{},{max:5,min:0,idle:1e4,acquire:6e4,evict:1e3,validate:this._validate.bind(this)}),this.initPools()}refreshTypeParser(e){cb.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(),bp("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 rte({name:"sequelize",create:()=>this._connect(e),destroy:async i=>{let n=await this._disconnect(i);return bp("connection destroy"),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}),bp(`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=cb.defaults(e.replication.write,cb.omit(e,"replication")),e.replication.read=e.replication.read.map(i=>cb.defaults(i,cb.omit(this.config,"replication")));let r=0;this.pool={release:i=>{i.queryType==="read"?this.pool.read.release(i):this.pool.write.release(i)},acquire:(i,n)=>(n=n===void 0?!1:n,i==="SELECT"&&!n?this.pool.read.acquire():this.pool.write.acquire()),destroy:i=>{this.pool[i.queryType].destroy(i),bp("connection destroy")},destroyAllNow:async()=>{await Promise.all([this.pool.read.destroyAllNow(),this.pool.write.destroyAllNow()]),bp("all connections destroyed")},drain:async()=>Promise.all([this.pool.write.drain(),this.pool.read.drain()]),read:new rte({name:"sequelize:read",create:async()=>{let i=r++%e.replication.read.length,n=await this._connect(e.replication.read[i]);return n.queryType="read",n},destroy:i=>this._disconnect(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}),write:new rte({name:"sequelize:write",create:async()=>{let i=await this._connect(e.replication.write);return i.queryType="write",i},destroy:i=>this._disconnect(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})},bp(`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 i=await this._connect(this.config.replication.write||this.config),n={};if(n.transaction={connection:i},n.logging=()=>{},n.logging.__testLoggingFn=!0,this.sequelize.options.databaseVersion===0){let a=await this.sequelize.databaseVersion(n),s=cb.get(ite.coerce(a),"version")||a;this.sequelize.options.databaseVersion=ite.valid(s)?s:this.dialect.defaultVersion}return ite.lt(this.sequelize.options.databaseVersion,this.dialect.defaultVersion)&&(Idr.unsupportedEngine(),bp(`Unsupported database engine version ${this.sequelize.options.databaseVersion}`)),this.versionPromise=null,await this._disconnect(i)}catch(i){throw this.versionPromise=null,i}})()),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(i){throw i instanceof Ndr?new vdr.ConnectionAcquireTimeoutError(i):i}return bp("connection acquired"),r}releaseConnection(e){this.pool.release(e),bp("connection released")}async destroyConnection(e){await this.pool.destroy(e),bp(`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}};ok.exports=q4;ok.exports.ConnectionManager=q4;ok.exports.default=q4});var iu=O((Eei,A8e)=>{"use strict";var C4=new Map;A8e.exports=t=>(C4.has(t)||C4.set(t,new Map),{clear(){C4.get(t).clear()},refresh(e){for(let r of e.types[t])C4.get(t).set(r,e.parse)},get(e){return C4.get(t).get(e)}})});var M8e=O((yei,uk)=>{"use strict";var Sdr=Object.defineProperty,m8e=Object.getOwnPropertySymbols,qdr=Object.prototype.hasOwnProperty,Cdr=Object.prototype.propertyIsEnumerable,O8e=(t,e,r)=>e in t?Sdr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,xdr=(t,e)=>{for(var r in e||(e={}))qdr.call(e,r)&&O8e(t,r,e[r]);if(m8e)for(var r of m8e(e))Cdr.call(e,r)&&O8e(t,r,e[r]);return t},Ldr=Zf(),kdr=ed(),fM=fi(),{logger:Ddr}=Bn(),Bdr=ri().mariadb,Pdr=up(),g8e=Ddr.debugContext("connection:mariadb"),ck=iu()("mariadb"),x4=class t extends kdr{constructor(e,r){r.config.port=r.config.port||3306,super(e,r),this.lib=this._loadDialectModule("mariadb"),this.refreshTypeParser(Bdr)}static _typecast(e,r){return ck.get(e.type)?ck.get(e.type)(e,this.sequelize.options,r):r()}_refreshTypeParser(e){ck.refresh(e)}_clearTypeParser(){ck.clear()}async connect(e){let r=this.sequelize.options.timezone;r=/\//.test(r)?Pdr.tz(r).format("Z"):r;let i=xdr({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||(i.initSql?(Array.isArray(i.initSql)||(i.initSql=[i.initSql]),i.initSql.push(`SET time_zone = '${r}'`)):i.initSql=`SET time_zone = '${r}'`);try{let n=await this.lib.createConnection(i);return this.sequelize.options.databaseVersion=Ldr.coerce(n.serverVersion()).version,g8e("connection acquired"),n.on("error",a=>{switch(a.code){case"ESOCKET":case"ECONNRESET":case"EPIPE":case"PROTOCOL_CONNECTION_LOST":this.pool.destroy(n)}}),n}catch(n){switch(n.code){case"ECONNREFUSED":throw new fM.ConnectionRefusedError(n);case"ER_ACCESS_DENIED_ERROR":case"ER_ACCESS_DENIED_NO_PASSWORD_ERROR":throw new fM.AccessDeniedError(n);case"ENOTFOUND":throw new fM.HostNotFoundError(n);case"EHOSTUNREACH":case"ENETUNREACH":case"EADDRNOTAVAIL":throw new fM.HostNotReachableError(n);case"EINVAL":throw new fM.InvalidConnectionError(n);default:throw new fM.ConnectionError(n)}}}async disconnect(e){if(!e.isValid()){g8e("connection tried to disconnect but was already at CLOSED state");return}return await e.end()}validate(e){return e&&e.isValid()}};uk.exports=x4;uk.exports.ConnectionManager=x4;uk.exports.default=x4});var td=O((zei,lk)=>{"use strict";var Wdr=Object.defineProperty,E8e=Object.getOwnPropertySymbols,Udr=Object.prototype.hasOwnProperty,Fdr=Object.prototype.propertyIsEnumerable,y8e=(t,e,r)=>e in t?Wdr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,jdr=(t,e)=>{for(var r in e||(e={}))Udr.call(e,r)&&y8e(t,r,e[r]);if(E8e)for(var r of E8e(e))Fdr.call(e,r)&&y8e(t,r,e[r]);return t},ub=fr(),Gdr=a4(),hc=yo(),Hdr=gL(),Qdr=cM(),Vdr=(rM(),Yl(tM)).v4,{safeStringifyJson:z8e}=wi(),L4=class t{constructor(e,r,i){this.uuid=Vdr(),this.connection=e,this.instance=i.instance,this.model=i.model,this.sequelize=r,this.options=jdr({plain:!1,raw:!1,logging:console.log},i),this.checkLoggingOption(),i.rawErrors&&(this.formatError=t.prototype.formatError)}static formatBindParameters(e,r,i,n,a){if(!r)return[e,[]];if(a=a||{},typeof n!="function"&&(a=n||{},n=void 0),!n)a.skipValueReplace?n=(c,l,p)=>{if(p[l]!==void 0)return c}:n=(c,l,p,f,d)=>{if(p[l]!==void 0)return Gdr.escape(p[l],f,d)};else if(a.skipValueReplace){let c=n;n=(l,p,f,d,h,_)=>{if(c(l,p,f,d,h,_)!==void 0)return l}}let s=null,o=Array.isArray(r);return e=e.replace(/\B\$(\$|\w+)/g,(c,l)=>{if(l==="$")return a.skipUnescape?c:l;let p;if(o?l.match(/^[1-9]\d*$/)&&(l=l-1,p=n(c,l,r,s,i,a)):l.match(/^\d*$/)||(p=n(c,l,r,s,i,a)),p===void 0)throw new Error(`Named bind parameter "${c}" 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&&(Qdr.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 i of Object.keys(this.model.uniqueKeys))this.model.uniqueKeys[i].fields.includes(e.replace(/"/g,""))&&this.model.uniqueKeys[i].msg&&(r=this.model.uniqueKeys[i].msg);return r}isRawQuery(){return this.options.type===hc.RAW}isVersionQuery(){return this.options.type===hc.VERSION}isUpsertQuery(){return this.options.type===hc.UPSERT}isInsertQuery(e,r){let i=!0;return this.options.type===hc.INSERT?!0:(i=i&&this.sql.toLowerCase().startsWith("insert into"),i=i&&(!e||Object.prototype.hasOwnProperty.call(e,this.getInsertIdField())),i=i&&(!r||Object.prototype.hasOwnProperty.call(r,this.getInsertIdField())),i)}handleInsertQuery(e,r){if(this.instance){let i=this.model.autoIncrementAttribute,n=null;n=n||e&&e[this.getInsertIdField()],n=n||r&&r[this.getInsertIdField()],this.instance[i]=n}}isShowTablesQuery(){return this.options.type===hc.SHOWTABLES}handleShowTablesQuery(e){return ub.flatten(e.map(r=>Object.values(r)))}isShowIndexesQuery(){return this.options.type===hc.SHOWINDEXES}isShowConstraintsQuery(){return this.options.type===hc.SHOWCONSTRAINTS}isDescribeQuery(){return this.options.type===hc.DESCRIBE}isSelectQuery(){return this.options.type===hc.SELECT}isBulkUpdateQuery(){return this.options.type===hc.BULKUPDATE}isBulkDeleteQuery(){return this.options.type===hc.BULKDELETE}isForeignKeysQuery(){return this.options.type===hc.FOREIGNKEYS}isUpdateQuery(){return this.options.type===hc.UPDATE}handleSelectQuery(e){let r=null;if(this.options.fieldMap){let i=this.options.fieldMap;e=e.map(n=>ub.reduce(i,(a,s,o)=>(a[o]!==void 0&&s!==o&&(a[s]=a[o],delete a[o]),a),n))}return this.options.raw?r=e.map(i=>{let n={};for(let a in i)Object.prototype.hasOwnProperty.call(i,a)&&(n[a]=i[a]);return this.options.nest&&(n=Hdr.transform(n)),n}):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,i){let{connection:n,options:a}=this,s=this.sequelize.options.benchmark||a.benchmark,o=this.sequelize.options.logQueryParameters||a.logQueryParameters,c=Date.now(),l="";if(o&&i){let d=e.endsWith(";")?"":";",h;Array.isArray(i)?h=i.map(_=>z8e(_)).join(", "):h=z8e(i),l=`${d} ${h}`}let p=`(${n.uuid||"default"}): ${e}${l}`,f=`Executing ${p}`;return r(f),s||this.sequelize.log(`Executing ${p}`,a),()=>{let d=`Executed ${p}`;r(d),s&&this.sequelize.log(d,Date.now()-c,a)}}static _groupJoinData(e,r,i){if(!e.length)return[];let n,a,s,o,c,l,p=e.length,f,d,h,_,m,E,R,N,T=i.checkExisting,I,W,D,F=T?[]:new Array(p),x={},H={},$,k,oe,j,B,V,X,_e,he=se=>{Object.prototype.hasOwnProperty.call(V.includeMap,se)&&(H[d]=V=V.includeMap[se],_e?_e=`${_e}.${se}`:_e=se,H[_e]=V)},ce={},Re=(se,Ee)=>(Object.prototype.hasOwnProperty.call(Ee,se)||(Ee[se]=se.substr(0,se.lastIndexOf("."))),Ee[se]),Te={},Ce=se=>{if(!Object.prototype.hasOwnProperty.call(Te,se)){let Ee=se.lastIndexOf(".");Te[se]=se.substr(Ee===-1?0:Ee+1)}return Te[se]},te={},de=se=>{if(!Object.prototype.hasOwnProperty.call(te,se)){let Ee=Re(se,ce);Object.prototype.hasOwnProperty.call(te,Ee)||(te[Ee]=Ee?Ee.split("."):[]),te[se]=te[Ee]}return te[se]},ze={},Oe=se=>{if(!Object.prototype.hasOwnProperty.call(ze,se)){let Ee=de(se),Ie=Ee.length;ze[se]=Ie?Ee[Ie-1]:""}return ze[se]},ke=se=>{let Ee=ub.chain(se.uniqueKeys);return Ee=Ee.result(`${Ee.findKey()}.fields`).map(Ie=>ub.findKey(se.attributes,Pe=>Pe.field===Ie)).value(),Ee},$e=se=>se instanceof Buffer?se.toString("hex"):se,Se,nt,xe;for(c=0;c<p;c++){if(l=e[c],c===0&&(f=ub.sortBy(Object.keys(l),se=>[se.split(".").length]),_=f.length),T){if(N=!1,o=r.model.primaryKeyAttributes.length,D="",o===1)D=$e(l[r.model.primaryKeyAttributes[0]]);else if(o>1)for(s=0;s<o;s++)D+=$e(l[r.model.primaryKeyAttributes[s]]);else if(!ub.isEmpty(r.model.uniqueKeys))for(nt=ke(r.model),s=0;s<nt.length;s++)D+=l[nt[s]]}for(R=E={},j=void 0,h=0;h<_;h++){if(d=f[h],k=Re(d,ce),$=de(d),c===0&&!Object.prototype.hasOwnProperty.call(H,d)&&($.length?(V=r,_e=void 0,$.forEach(he)):H[d]=H[""]=r),j!==void 0&&j!==$){if(T){if(a=j.length,X=null,W=null,a)for(n=0;n<a;n++){if(xe=X?`${X}.${j[n]}`:j[n],Se=H[xe].model.primaryKeyAttributes,o=Se.length,I=xe,o===1)I+=$e(l[`${xe}.${Se[0]}`]);else if(o>1)for(s=0;s<o;s++)I+=$e(l[`${xe}.${Se[s]}`]);else if(!ub.isEmpty(H[xe].model.uniqueKeys))for(nt=ke(H[xe].model),s=0;s<nt.length;s++)I+=l[`${xe}.${nt[s]}`];W||(W=D),I=W+I,X=xe,n<a-1&&(W=I)}else I=D;I===D?x[I]?N=!0:x[I]=E:x[I]||(X=x[W],B=Oe(m),H[m].association.isSingleAssociation?X&&(X[B]=x[I]=E):(X[B]||(X[B]=[]),X[B].push(x[I]=E))),E={}}else if(V=R,a=$.length,a)for(n=0;n<a;n++)n===a-1&&(E=V[$[n]]={}),V=V[$[n]]||{}}E[Ce(d)]=l[d],m=d,j=$,oe=k}if(T){if(a=j.length,X=null,W=null,a)for(n=0;n<a;n++){if(xe=X?`${X}.${j[n]}`:j[n],Se=H[xe].model.primaryKeyAttributes,o=Se.length,I=xe,o===1)I+=$e(l[`${xe}.${Se[0]}`]);else if(o>0)for(s=0;s<o;s++)I+=$e(l[`${xe}.${Se[s]}`]);else if(!ub.isEmpty(H[xe].model.uniqueKeys))for(nt=ke(H[xe].model),s=0;s<nt.length;s++)I+=l[`${xe}.${nt[s]}`];W||(W=D),I=W+I,X=xe,n<a-1&&(W=I)}else I=D;I===D?x[I]?N=!0:x[I]=E:x[I]||(X=x[W],B=Oe(m),H[m].association.isSingleAssociation?X&&(X[B]=x[I]=E):(X[B]||(X[B]=[]),X[B].push(x[I]=E))),N||F.push(R)}else F[c]=R}return F}};lk.exports=L4;lk.exports.AbstractQuery=L4;lk.exports.default=L4});var q8e=O((Rei,S8e)=>{"use strict";var Ydr=Object.defineProperty,R8e=Object.getOwnPropertySymbols,Xdr=Object.prototype.hasOwnProperty,Kdr=Object.prototype.propertyIsEnumerable,w8e=(t,e,r)=>e in t?Ydr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,$dr=(t,e)=>{for(var r in e||(e={}))Xdr.call(e,r)&&w8e(t,r,e[r]);if(R8e)for(var r of R8e(e))Kdr.call(e,r)&&w8e(t,r,e[r]);return t},N8e=td(),pk=fi(),v8e=fr(),nte=ri(),{logger:Jdr}=Bn(),Zdr=1062,ehr=1213,T8e=1451,thr=1452,I8e=Jdr.debugContext("sql:mariadb"),ate=class extends N8e{constructor(e,r,i){super(e,r,$dr({showWarnings:!1},i))}static formatBindParameters(e,r,i){let n=[],a=(s,o,c)=>{if(c[o]!==void 0)return n.push(c[o]),"?"};return e=N8e.formatBindParameters(e,r,i,a)[0],[e,n.length>0?n:void 0]}async run(e,r){this.sql=e;let{connection:i,options:n}=this,a=this.sequelize.options.showWarnings||n.showWarnings,s=this._logQuery(e,I8e,r);r&&I8e("parameters(%j)",r);let o,c=new Error;try{o=await i.query(this.sql,r)}catch(l){if(n.transaction&&l.errno===ehr){try{await n.transaction.rollback()}catch{}n.transaction.finished="rollback"}throw l.sql=e,l.parameters=r,this.formatError(l,c.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 i=e[this.getInsertIdField()];r=new Array(e.affectedRows);let n=this.model.rawAttributes[this.model.primaryKeyAttribute].field;for(let a=0;a<e.affectedRows;a++)r[a]={[n]:i+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 i=e.meta;return delete e.meta,[e,i]}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 i of e)r[i.Field]={type:i.Type.toLowerCase().startsWith("enum")?i.Type.replace(/^enum/i,"ENUM"):i.Type.toUpperCase(),allowNull:i.Null==="YES",defaultValue:i.Default,primaryKey:i.Key==="PRI",autoIncrement:Object.prototype.hasOwnProperty.call(i,"Extra")&&i.Extra.toLowerCase()==="auto_increment",comment:i.Comment?i.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 i=this.model.fieldRawAttributesMap[r];i.type instanceof nte.JSON&&(e=e.map(n=>(n[i.fieldName]&&typeof n[i.fieldName]=="string"&&!this.connection.info.hasMinVersion(10,5,2)&&(n[i.fieldName]=JSON.parse(n[i.fieldName])),nte.JSON.parse?nte.JSON.parse(i,this.sequelize.options,n[i.fieldName]):n)))}}async logWarnings(e){let r=await this.run("SHOW WARNINGS"),i=`MariaDB Warnings (${this.connection.uuid||"default"}): `,n=[];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"))n.push(s.Message);else for(let o of s.keys())n.push([o,s[o]].join(": "));return this.sequelize.log(i+n.join("; "),this.options),e}formatError(e,r){switch(e.errno){case Zdr:{let i=e.message.match(/Duplicate entry '([\s\S]*)' for key '?((.|\s)*?)'?\s.*$/),n={},a="Validation error",s=i?i[1].split("-"):void 0,o=i?i[2]:void 0,c=i?i[1]:void 0,l=this.model&&this.model.uniqueKeys[o];l?(l.msg&&(a=l.msg),n=v8e.zipObject(l.fields,s)):n[o]=c;let p=[];return v8e.forOwn(n,(f,d)=>{p.push(new pk.ValidationErrorItem(this.getUniqueConstraintErrorMessage(d),"unique violation",d,f,this.instance,"not_unique"))}),new pk.UniqueConstraintError({message:a,errors:p,parent:e,fields:n,stack:r})}case T8e:case thr:{let i=e.message.match(/CONSTRAINT ([`"])(.*)\1 FOREIGN KEY \(\1(.*)\1\) REFERENCES \1(.*)\1 \(\1(.*)\1\)/),n=i?i[1]:"`",a=i?i[3].split(new RegExp(`${n}, *${n}`)):void 0;return new pk.ForeignKeyConstraintError({reltype:e.errno===T8e?"parent":"child",table:i?i[4]:void 0,fields:a,value:a&&a.length&&this.instance&&this.instance[a[0]]||void 0,index:i?i[2]:void 0,parent:e,stack:r})}default:return new pk.DatabaseError(e,{stack:r})}}handleShowTablesQuery(e){return e.map(r=>({tableName:r.TABLE_NAME,schema:r.TABLE_SCHEMA}))}handleShowIndexesQuery(e){let r,i=[];return e.forEach(n=>{(!r||r.name!==n.Key_name)&&(r={primary:n.Key_name==="PRIMARY",fields:[],name:n.Key_name,tableName:n.Table,unique:n.Non_unique!==1,type:n.Index_type},i.push(r)),r.fields[n.Seq_in_index-1]={attribute:n.Column_name,length:n.Sub_part||void 0,order:n.Collation==="A"?"ASC":void 0}}),i}};S8e.exports=ate});var k8e=O((wei,L8e)=>{"use strict";var rhr=Object.defineProperty,C8e=Object.getOwnPropertySymbols,ihr=Object.prototype.hasOwnProperty,nhr=Object.prototype.propertyIsEnumerable,x8e=(t,e,r)=>e in t?rhr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,ahr=(t,e)=>{for(var r in e||(e={}))ihr.call(e,r)&&x8e(t,r,e[r]);if(C8e)for(var r of C8e(e))nhr.call(e,r)&&x8e(t,r,e[r]);return t},fk=fr(),a0=Hs(),shr=wi(),ohr={OperatorMap:{[a0.eq]:"=",[a0.ne]:"!=",[a0.gte]:">=",[a0.gt]:">",[a0.lte]:"<=",[a0.lt]:"<",[a0.not]:"IS NOT",[a0.is]:"IS",[a0.in]:"IN",[a0.notIn]:"NOT IN",[a0.like]:"LIKE",[a0.notLike]:"NOT LIKE",[a0.iLike]:"ILIKE",[a0.notILike]:"NOT ILIKE",[a0.startsWith]:"LIKE",[a0.endsWith]:"LIKE",[a0.substring]:"LIKE",[a0.regexp]:"~",[a0.notRegexp]:"!~",[a0.iRegexp]:"~*",[a0.notIRegexp]:"!~*",[a0.between]:"BETWEEN",[a0.notBetween]:"NOT BETWEEN",[a0.overlap]:"&&",[a0.contains]:"@>",[a0.contained]:"<@",[a0.adjacent]:"-|-",[a0.strictLeft]:"<<",[a0.strictRight]:">>",[a0.noExtendRight]:"&<",[a0.noExtendLeft]:"&>",[a0.any]:"ANY",[a0.all]:"ALL",[a0.and]:" AND ",[a0.or]:" OR ",[a0.col]:"COL",[a0.placeholder]:"$$PLACEHOLDER$$",[a0.match]:"@@"},OperatorsAliasMap:{},setOperatorsAliases(t){!t||fk.isEmpty(t)?this.OperatorsAliasMap=!1:this.OperatorsAliasMap=ahr({},t)},_replaceAliases(t){let e={};return this.OperatorsAliasMap?(shr.getOperators(t).forEach(r=>{let i=t[r];fk.isPlainObject(i)?e[r]=this._replaceAliases(i):e[r]=i}),fk.forOwn(t,(r,i)=>{i=this.OperatorsAliasMap[i]||i,fk.isPlainObject(r)&&(r=this._replaceAliases(r)),e[i]=r}),e):t}};L8e.exports=ohr});var B8e=O((Nei,D8e)=>{"use strict";var chr=(rM(),Yl(tM)).v4,uhr={setIsolationLevelQuery(t,e){if(!e.parent)return`SET TRANSACTION ISOLATION LEVEL ${t};`},generateTransactionId(){return chr()},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;"}};D8e.exports=uhr});var lb=O((Tei,j8e)=>{"use strict";var lhr=Object.defineProperty,phr=Object.defineProperties,fhr=Object.getOwnPropertyDescriptors,P8e=Object.getOwnPropertySymbols,dhr=Object.prototype.hasOwnProperty,hhr=Object.prototype.propertyIsEnumerable,W8e=(t,e,r)=>e in t?lhr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,hA=(t,e)=>{for(var r in e||(e={}))dhr.call(e,r)&&W8e(t,r,e[r]);if(P8e)for(var r of P8e(e))hhr.call(e,r)&&W8e(t,r,e[r]);return t},dk=(t,e)=>phr(t,fhr(e)),hk=require("util"),Zr=fr(),bhr=(rM(),Yl(tM)).v4,Wt=wi(),vei=cM(),U8e=a4(),dM=ri(),Zu=Aee(),hM=nb(),ste=ab(),_hr=aM(),Ahr=cA(),Nt=Hs(),ote=fi(),F8e=Nee(),mhr=new Set(["integer","int","smallint","bigint","float","real","double precision","decimal","numeric","boolean","text","char","varchar","nvarchar","date","timestamp","timestamptz","datetime","json","jsonb","signed","unsigned"]),k4=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:Zr.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,i){return`DESCRIBE ${this.quoteTable(this.addSchema({tableName:e,_schema:r,_schemaDelimiter:i}))};`}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,i,n){n=n||{},Zr.defaults(n,this.options);let a={},s=n.bind||[],o=[],c=[],l=[],p=[],f=this.quoteTable(e),d=n.bindParam===void 0?this.bindParam(s):n.bindParam,h=[],_,m="",E="",R="",N="",T=!1,I="";if(i&&Zr.each(i,(x,H)=>{a[H]=x,x.field&&(a[x.field]=x)}),this._dialect.supports["DEFAULT VALUES"]?E+=" DEFAULT VALUES":this._dialect.supports["VALUES ()"]&&(E+=" VALUES ()"),(this._dialect.supports.returnValues||this._dialect.supports.returnIntoValues)&&n.returning){let x=this.generateReturnValues(i,n);c.push(...x.returnFields),this._dialect.supports.returnIntoValues&&l.push(...x.returnTypes),N=x.returningFragment,I=x.tmpTable||"",R=x.outputFragment||""}(Zr.get(this,["sequelize","options","dialectOptions","prependSearchPath"])||n.searchPath)&&(n.bindParam=!1),this._dialect.supports.EXCEPTION&&n.exception&&(n.bindParam=!1),r=Wt.removeNullValuesFromHash(r,this.options.omitNull);for(let x in r)if(Object.prototype.hasOwnProperty.call(r,x)){let H=r[x];o.push(this.quoteIdentifier(x)),a&&a[x]&&a[x].autoIncrement===!0&&H==null?this._dialect.supports.autoIncrement.defaultValue?this._dialect.supports.DEFAULT?p.push("DEFAULT"):p.push(this.escape(null)):o.splice(-1,1):(a&&a[x]&&a[x].autoIncrement===!0&&(T=!0),H instanceof Wt.SequelizeMethod||n.bindParam===!1?p.push(this.escape(H,a&&a[x]||void 0,{context:"INSERT"})):p.push(this.format(H,a&&a[x]||void 0,{context:"INSERT"},d)))}let W="";if(!Zr.isEmpty(n.conflictWhere)&&!this._dialect.supports.inserts.onConflictWhere)throw new Error("missing dialect support for conflictWhere option");if(this._dialect.supports.inserts.updateOnDuplicate&&n.updateOnDuplicate)if(this._dialect.supports.inserts.updateOnDuplicate==" ON CONFLICT DO UPDATE SET"){let x=n.upsertKeys.map(k=>this.quoteIdentifier(k)),H=n.updateOnDuplicate.map(k=>`${this.quoteIdentifier(k)}=EXCLUDED.${this.quoteIdentifier(k)}`),$=["ON CONFLICT","(",x.join(","),")"];Zr.isEmpty(n.conflictWhere)||$.push(this.whereQuery(n.conflictWhere,n)),Zr.isEmpty(H)?$.push("DO NOTHING"):$.push("DO UPDATE SET",H.join(",")),W=` ${Wt.joinSQLFragments($)}`}else{let x=n.updateOnDuplicate.map(H=>`${this.quoteIdentifier(H)}=VALUES(${this.quoteIdentifier(H)})`);if(Zr.isEmpty(x)&&n.upsertKeys&&x.push(...n.upsertKeys.map(H=>`${this.quoteIdentifier(H)}=${this.quoteIdentifier(H)}`)),Zr.isEmpty(x))throw new Error("No update values found for ON DUPLICATE KEY UPDATE clause, and no identifier fields could be found to use instead.");W+=`${this._dialect.supports.inserts.updateOnDuplicate} ${x.join(",")}`}let D={ignoreDuplicates:n.ignoreDuplicates?this._dialect.supports.inserts.ignoreDuplicates:"",onConflictDoNothing:n.ignoreDuplicates?this._dialect.supports.inserts.onConflictDoNothing:"",attributes:o.join(","),output:R,values:p.join(","),tmpTable:I};if(m=`${I}INSERT${D.ignoreDuplicates} INTO ${f} (${D.attributes})${D.output} VALUES (${D.values})${W}${D.onConflictDoNothing}${m}`,E=`${I}INSERT${D.ignoreDuplicates} INTO ${f}${D.output}${W}${D.onConflictDoNothing}${E}`,this._dialect.supports.EXCEPTION&&n.exception){let x="DROP FUNCTION IF EXISTS pg_temp.testfunc()";c.length===0&&c.push("*");let H=`$func_${bhr().replace(/-/g,"")}$`,$=`SELECT (testfunc.response).${c.join(", (testfunc.response).")}, testfunc.sequelize_caught_exception FROM pg_temp.testfunc();`;n.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 ${H} BEGIN ${m} RETURNING * INTO response; EXCEPTION ${n.exception} END ${H} LANGUAGE plpgsql; ${$} ${x}`}else m+=N,E+=N;this._dialect.supports.returnIntoValues&&n.returning&&this.populateInsertQueryReturnIntoBinds(c,l,s.length,h,n),_=`${D.attributes.length?m:E}${h.join(",")};`,this._dialect.supports.finalTable&&(_=`SELECT * FROM FINAL TABLE(${D.attributes.length?m:E});`),T&&this._dialect.supports.autoIncrement.identityInsert&&(_=`SET IDENTITY_INSERT ${f} ON; ${_} SET IDENTITY_INSERT ${f} OFF;`);let F={query:_};return n.bindParam!==!1&&(F.bind=s),F}bulkInsertQuery(e,r,i,n){i=i||{},n=n||{};let a=[],s={},o=[],c="";for(let h of r)Zr.forOwn(h,(_,m)=>{o.includes(m)||o.push(m),n[m]&&n[m].autoIncrement===!0&&(s[m]=!0)});for(let h of r){let _=o.map(m=>this._dialect.supports.bulkDefault&&s[m]===!0?h[m]!=null?h[m]:"DEFAULT":this.escape(h[m],n[m],{context:"INSERT"}));a.push(`(${_.join(",")})`)}if(this._dialect.supports.inserts.updateOnDuplicate&&i.updateOnDuplicate)if(this._dialect.supports.inserts.updateOnDuplicate==" ON CONFLICT DO UPDATE SET"){let h=i.upsertKeys.map(E=>this.quoteIdentifier(E)),_=i.updateOnDuplicate.map(E=>`${this.quoteIdentifier(E)}=EXCLUDED.${this.quoteIdentifier(E)}`),m=!1;if(i.conflictWhere){if(!this._dialect.supports.inserts.onConflictWhere)throw new Error(`conflictWhere not supported for dialect ${this._dialect.name}`);m=this.whereQuery(i.conflictWhere,i)}c=["ON CONFLICT","(",h.join(","),")",m,"DO UPDATE SET",_.join(",")]}else{if(i.conflictWhere)throw new Error(`conflictWhere not supported for dialect ${this._dialect.name}`);let h=i.updateOnDuplicate.map(_=>`${this.quoteIdentifier(_)}=VALUES(${this.quoteIdentifier(_)})`);c=`${this._dialect.supports.inserts.updateOnDuplicate} ${h.join(",")}`}let l=i.ignoreDuplicates?this._dialect.supports.inserts.ignoreDuplicates:"",p=o.map(h=>this.quoteIdentifier(h)).join(","),f=i.ignoreDuplicates?this._dialect.supports.inserts.onConflictDoNothing:"",d="";if(this._dialect.supports.returnValues&&i.returning){let h=this.generateReturnValues(n,i);d+=h.returningFragment}return Wt.joinSQLFragments(["INSERT",l,"INTO",this.quoteTable(e),`(${p})`,"VALUES",a.join(","),c,f,d,";"])}updateQuery(e,r,i,n,a){n=n||{},Zr.defaults(n,this.options),r=Wt.removeNullValuesFromHash(r,n.omitNull,n);let s=[],o=[],c={},l="",p="",f="";(Zr.get(this,["sequelize","options","dialectOptions","prependSearchPath"])||n.searchPath)&&(n.bindParam=!1);let d=n.bindParam===void 0?this.bindParam(o):n.bindParam;if(this._dialect.supports["LIMIT ON UPDATE"]&&n.limit&&(["mssql","db2","oracle"].includes(this.dialect)?this.dialect==="oracle"&&(i&&(i.length&&i.length>0||Object.keys(i).length>0)?f+=" AND ":f+=" WHERE ",f+=`rownum <= ${this.escape(n.limit)} `):f=` LIMIT ${this.escape(n.limit)} `),this._dialect.supports.returnValues&&n.returning){let E=this.generateReturnValues(a,n);f+=E.returningFragment,p=E.tmpTable||"",l=E.outputFragment||"",!this._dialect.supports.returnValues.output&&n.returning&&(n.mapToModel=!0)}a&&Zr.each(a,(E,R)=>{c[R]=E,E.field&&(c[E.field]=E)});for(let E in r){if(c&&c[E]&&c[E].autoIncrement===!0&&!this._dialect.supports.autoIncrement.update)continue;let R=r[E];R instanceof Wt.SequelizeMethod||n.bindParam===!1?s.push(`${this.quoteIdentifier(E)}=${this.escape(R,c&&c[E]||void 0,{context:"UPDATE"})}`):s.push(`${this.quoteIdentifier(E)}=${this.format(R,c&&c[E]||void 0,{context:"UPDATE"},d)}`)}let h=dk(hA({},n),{bindParam:d});if(s.length===0)return"";let m={query:`${p}UPDATE ${this.quoteTable(e)} SET ${s.join(",")}${l} ${this.whereQuery(i,h)}${f}`.trim()};return n.bindParam!==!1&&(m.bind=o),m}arithmeticQuery(e,r,i,n,a,s){s=s||{},Zr.defaults(s,{returning:!0}),a=Wt.removeNullValuesFromHash(a,this.options.omitNull);let o="",c="";if(this._dialect.supports.returnValues&&s.returning){let p=this.generateReturnValues(null,s);o=p.outputFragment,c=p.returningFragment}let l=[];for(let p in n){let f=n[p],d=this.quoteIdentifier(p),h=this.escape(f);l.push(`${d}=${d}${e} ${h}`)}for(let p in a){let f=a[p],d=this.quoteIdentifier(p),h=this.escape(f);l.push(`${d}=${h}`)}return Wt.joinSQLFragments(["UPDATE",this.quoteTable(r),"SET",l.join(","),o,this.whereQuery(i),c])}addIndexQuery(e,r,i,n){i=i||{},Array.isArray(r)?i.fields=r:(i=r,r=void 0),i.prefix=i.prefix||n||e,i.prefix&&typeof i.prefix=="string"&&(i.prefix=i.prefix.replace(/\./g,"_"),i.prefix=i.prefix.replace(/("|')/g,""));let a=i.fields.map(c=>{if(c instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(c);typeof c=="string"&&(c={name:c});let l="";if(c.attribute&&(c.name=c.attribute),!c.name)throw new Error(`The following index field has no name: ${hk.inspect(c)}`);if(l+=this.quoteIdentifier(c.name),this._dialect.supports.index.collate&&c.collate&&(l+=` COLLATE ${this.quoteIdentifier(c.collate)}`),this._dialect.supports.index.operator){let p=c.operator||i.operator;p&&(l+=` ${p}`)}return this._dialect.supports.index.length&&c.length&&(l+=`(${c.length})`),c.order&&(l+=` ${c.order}`),l});i.name||(i=Wt.nameIndex(i,i.prefix)),i=Zu._conformIndex(i),this._dialect.supports.index.type||delete i.type,i.where&&(i.where=this.whereQuery(i.where)),typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e);let s=this._dialect.supports.index.concurrently&&i.concurrently?"CONCURRENTLY":void 0,o;return this._dialect.supports.indexViaAlter?o=["ALTER TABLE",e,s,"ADD"]:o=["CREATE"],o=o.concat(i.unique?"UNIQUE":"",i.type,"INDEX",this._dialect.supports.indexViaAlter?void 0:s,this.quoteIdentifiers(i.name),this._dialect.supports.index.using===1&&i.using?`USING ${i.using}`:"",this._dialect.supports.indexViaAlter?void 0:`ON ${e}`,this._dialect.supports.index.using===2&&i.using?`USING ${i.using}`:"",`(${a.join(", ")})`,this._dialect.supports.index.parser&&i.parser?`WITH PARSER ${i.parser}`:void 0,this._dialect.supports.index.where&&i.where?i.where:void 0),Zr.compact(o).join(" ")}addConstraintQuery(e,r){return typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e),Wt.joinSQLFragments(["ALTER TABLE",e,"ADD",this.getConstraintSnippet(e,r||{}),";"])}getConstraintSnippet(e,r){let i,n,a=r.fields.map(c=>{if(typeof c=="string")return this.quoteIdentifier(c);if(c instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(c);if(c.attribute&&(c.name=c.attribute),!c.name)throw new Error(`The following index field has no name: ${c}`);return this.quoteIdentifier(c.name)}),s=a.join(", "),o=a.join("_");switch(r.type.toUpperCase()){case"UNIQUE":n=this.quoteIdentifier(r.name||`${e}_${o}_uk`),i=`CONSTRAINT ${n} UNIQUE (${s})`;break;case"CHECK":r.where=this.whereItemsQuery(r.where),n=this.quoteIdentifier(r.name||`${e}_${o}_ck`),i=`CONSTRAINT ${n} 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.");n=this.quoteIdentifier(r.name||`${e}_${o}_df`),i=`CONSTRAINT ${n} DEFAULT (${this.escape(r.defaultValue)}) FOR ${a[0]}`;break;case"PRIMARY KEY":n=this.quoteIdentifier(r.name||`${e}_${o}_pk`),i=`CONSTRAINT ${n} PRIMARY KEY (${s})`;break;case"FOREIGN KEY":let c=r.references;if(!c||!c.table||!(c.field||c.fields))throw new Error("references object with table and field must be specified");n=this.quoteIdentifier(r.name||`${e}_${o}_${c.table}_fk`);let l=typeof c.field<"u"?this.quoteIdentifier(c.field):c.fields.map(f=>this.quoteIdentifier(f)).join(", "),p=`${this.quoteTable(c.table)} (${l})`;i=`CONSTRAINT ${n} `,i+=`FOREIGN KEY (${s}) REFERENCES ${p}`,r.onUpdate&&(i+=` ON UPDATE ${r.onUpdate.toUpperCase()}`),r.onDelete&&(i+=` 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())&&(i+=` ${this.deferConstraintsQuery(r)}`),i}removeConstraintQuery(e,r){return typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e),Wt.joinSQLFragments(["ALTER TABLE",e,"DROP CONSTRAINT",this.quoteIdentifiers(r)])}quote(e,r,i){let n=["ASC","DESC","ASC NULLS LAST","DESC NULLS LAST","ASC NULLS FIRST","DESC NULLS FIRST","NULLS FIRST","NULLS LAST"];if(i=i||".",typeof e=="string")return this.quoteIdentifiers(e);if(Array.isArray(e)){e.forEach((p,f)=>{let d=e[f-1],h,_;if(!d&&r!==void 0?_=r:d&&d instanceof hM&&(h=d,_=d.target),_&&_.prototype instanceof Zu){let m,E;if(typeof p=="function"&&p.prototype instanceof Zu?m=p:Zr.isPlainObject(p)&&p.model&&p.model.prototype instanceof Zu&&(m=p.model,E=p.as),m&&(!E&&h&&h instanceof hM&&h.through&&h.through.model===m?p=new hM(_,m,{as:m.name}):(p=_.getAssociationForAlias(m,E),p||(p=_.getAssociationForAlias(m,m.name))),!(p instanceof hM)))throw new Error(hk.format("Unable to find a valid association for model, '%s'",m.name))}if(typeof p=="string"){let m=n.indexOf(p.toUpperCase());if(f>0&&m!==-1)p=this.sequelize.literal(` ${n[m]}`);else if(_&&_.prototype instanceof Zu){if(_.associations!==void 0&&_.associations[p])p=_.associations[p];else if(_.rawAttributes!==void 0&&_.rawAttributes[p]&&p!==_.rawAttributes[p].field)p=_.rawAttributes[p].field;else if(p.includes(".")&&_.rawAttributes!==void 0){let E=p.split(".");if(_.rawAttributes[E[0]].type instanceof dM.JSON){let R=this.quoteIdentifiers(`${_.name}.${_.rawAttributes[E[0]].field}`),N=E.slice(1);p=this.jsonPathExtractionQuery(R,N),p=this.sequelize.literal(p)}}}}e[f]=p},this);let a=e.length,s=[],o,c=0;for(c=0;c<a-1&&(o=e[c],!(typeof o=="string"||o._modelAttribute||o instanceof Wt.SequelizeMethod));c++)o instanceof hM&&(s[c]=o.as);let l="";return c>0?l+=`${this.quoteIdentifier(s.join(i))}.`:typeof e[0]=="string"&&r&&(l+=`${this.quoteIdentifier(r.name)}.`),e.slice(c).forEach(p=>{l+=this.quote(p,r,i)},this),l}if(e._modelAttribute)return`${this.quoteTable(e.Model.name)}.${this.quoteIdentifier(e.fieldName)}`;if(e instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(e);throw Zr.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: ${hk.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("->"),i=e[e.length-1];return`${this.quoteIdentifier(r)}.${this.quoteIdentifier(i)}`}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 i="";return r===!0&&(r=e.as||e.name||e),Zr.isObject(e)?this._dialect.supports.schemas?(e.schema&&(i+=`${this.quoteIdentifier(e.schema)}.`),i+=this.quoteIdentifier(e.tableName)):(e.schema&&(i+=e.schema+(e.delimiter||".")),i+=e.tableName,i=this.quoteIdentifier(i)):i=this.quoteIdentifier(e),r&&(i+=` ${this.getAliasToken()} ${this.quoteIdentifier(r)}`),i}escape(e,r,i){if(i=i||{},e!=null){if(e instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(e);if(r&&r.type&&(r.type instanceof dM.STRING&&["mysql","mariadb"].includes(this.dialect)&&["number","boolean"].includes(typeof e)&&(e=String(Number(e))),this.validate(e,r,i),r.type.stringify)){let n=a=>U8e.escape(a,this.options.timezone,this.dialect);if(e=r.type.stringify(e,{escape:n,field:r,timezone:this.options.timezone,operation:i.operation}),r.type.escape===!1)return e}}return U8e.escape(e,this.options.timezone,this.dialect)}bindParam(e){return r=>(e.push(r),`$${e.length}`)}format(e,r,i,n){if(i=i||{},e!=null){if(e instanceof Wt.SequelizeMethod)throw new Error("Cannot pass SequelizeMethod as a bind parameter - use escape instead");if(r&&r.type&&(this.validate(e,r,i),r.type.bindParam))return r.type.bindParam(e,{escape:Zr.identity,field:r,timezone:this.options.timezone,operation:i.operation,bindParam:n})}return n(e)}validate(e,r,i){if(this.typeValidation&&r.type.validate&&e)try{if(i.isList&&Array.isArray(e))for(let n of e)r.type.validate(n,i);else r.type.validate(e,i)}catch(n){throw n instanceof ote.ValidationError&&n.errors.push(new ote.ValidationErrorItem(n.message,"Validation error",r.fieldName,e,null,`${r.type.key} validator`)),n}}isIdentifierQuoted(e){return/^\s*(?:([`"'])(?:(?!\1).|\1{2})*\1\.?)+\s*$/i.test(e)}jsonPathExtractionQuery(e,r,i){let n=Zr.toPath(r),a,s=this.isIdentifierQuoted(e)?e:this.quoteIdentifier(e);switch(this.dialect){case"mysql":case"mariadb":case"sqlite":return this.dialect==="mysql"&&(n=n.map(c=>/\D/.test(c)?Wt.addTicks(c,'"'):c)),a=this.escape(["$"].concat(n).join(".").replace(/\.(\d+)(?:(?=\.)|$)/g,(c,l)=>`[${l}]`)),this.dialect==="sqlite"?`json_extract(${s},${a})`:`json_unquote(json_extract(${s},${a}))`;case"postgres":let o=i?"#>":"#>>";return a=this.escape(`{${n.join(",")}}`),`(${s}${o}${a})`;default:throw new Error(`Unsupported ${this.dialect} for JSON operations`)}}selectQuery(e,r,i){r=r||{};let n=r.limit,a=[],s=[],o=r.subQuery===void 0?n&&r.hasMultiAssociation:r.subQuery,c={main:r.attributes&&r.attributes.slice(),subQuery:null},l={name:e,quotedName:null,as:null,model:i},p={names:l,options:r,subQuery:o},f=[],d=[],h;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&&c.main)for(let m of l.model.primaryKeyAttributes)c.main.some(E=>m===E||m===E[0]||m===E[1])||c.main.push(l.model.rawAttributes[m].field?[m,l.model.rawAttributes[m].field]:m);if(c.main=this.escapeAttributes(c.main,r,l.as),c.main=c.main||(r.include?[`${l.as}.*`]:["*"]),(o||r.groupedLimit)&&(c.subQuery=c.main,c.main=[`${l.as||l.quotedName}.*`]),r.include)for(let m of r.include){if(m.separate)continue;let E=this.generateInclude(m,{externalAs:l.as,internalAs:l.as},p);d=d.concat(E.subQuery),f=f.concat(E.mainQuery),E.attributes.main.length>0&&(c.main=Zr.uniq(c.main.concat(E.attributes.main))),E.attributes.subQuery.length>0&&(c.subQuery=Zr.uniq(c.subQuery.concat(E.attributes.subQuery)))}if(o)s.push(this.selectFromTableFragment(r,l.model,c.subQuery,l.quotedName,l.as)),s.push(d.join(""));else{if(r.groupedLimit){l.as||(l.as=l.quotedName);let m=hA({},r.where),E,R,N,T=l.as;if(typeof r.groupedLimit.on=="string"?R=r.groupedLimit.on:r.groupedLimit.on instanceof Ahr&&(R=r.groupedLimit.on.foreignKeyField),r.groupedLimit.on instanceof _hr){T=r.groupedLimit.on.manyFromSource.as;let F=Zu._validateIncludedElements({include:[{association:r.groupedLimit.on.manyFromSource,duplicating:!1,required:!0,where:hA({[Nt.placeholder]:!0},r.groupedLimit.through&&r.groupedLimit.through.where)}],model:i});r.hasJoin=!0,r.hasMultiAssociation=!0,r.includeMap=Object.assign(F.includeMap,r.includeMap),r.includeNames=F.includeNames.concat(r.includeNames||[]),N=F.include,Array.isArray(r.order)&&(r.order.forEach((x,H)=>{Array.isArray(x)&&(x=x[0]);let $=`subquery_order_${H}`;r.attributes.push([x,$]),$=this.sequelize.literal(this.quote($)),Array.isArray(r.order[H])?r.order[H][0]=$:r.order[H]=$}),E=r.order)}else E=r.order,this._dialect.supports.topLevelOrderByRequired||delete r.order,m[Nt.placeholder]=!0;let I=`SELECT * FROM (${this.selectQuery(e,{attributes:r.attributes,offset:r.offset,limit:r.groupedLimit.limit,order:E,aliasesMapping:r.aliasesMapping,aliasesByTable:r.aliasesByTable,where:m,include:N,model:i},i).replace(/;$/,"")}) ${this.getAliasToken()} sub`,W=this.whereItemQuery(Nt.placeholder,!0,{model:i}),D=I.indexOf(W);a.push(this.selectFromTableFragment(r,l.model,c.main,`(${r.groupedLimit.values.map(F=>{let x;return R&&(x={[R]:F}),N&&(x={[r.groupedLimit.on.foreignIdentifierField]:F}),Wt.spliceStr(I,D,W.length,this.getWhereConditions(x,T))}).join(this._dialect.supports["UNION ALL"]?" UNION ALL ":" UNION ")})`,l.as))}else a.push(this.selectFromTableFragment(r,l.model,c.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,i,r),r.where&&(o?s.push(` WHERE ${r.where}`):(a.push(` WHERE ${r.where}`),a.forEach((m,E)=>{m.startsWith("SELECT")&&(a[E]=this.selectFromTableFragment(r,i,c.main,l.quotedName,l.as,r.where))})))),r.group&&(r.group=Array.isArray(r.group)?r.group.map(m=>this.aliasGrouping(m,i,l.as,r)).join(", "):this.aliasGrouping(r.group,i,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,i,r,!1),r.having&&(o?s.push(` HAVING ${r.having}`):a.push(` HAVING ${r.having}`))),r.order){let m=this.getQueryOrders(r,i,o);m.mainQueryOrder.length&&a.push(` ORDER BY ${m.mainQueryOrder.join(", ")}`),m.subQueryOrder.length&&s.push(` ORDER BY ${m.subQueryOrder.join(", ")}`)}let _=this.addLimitAndOffset(r,l.model);if(_&&!r.groupedLimit&&(o?s.push(_):a.push(_)),o?(this._throwOnEmptyAttributes(c.main,{modelName:i&&i.name,as:l.as}),h=`SELECT ${c.main.join(", ")} FROM (${s.join("")}) ${this.getAliasToken()} ${l.as}${f.join("")}${a.join("")}`):h=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)?h+=` FOR ${m}`:m==="SHARE"?h+=` ${this._dialect.supports.forShare}`:h+=" FOR UPDATE",this._dialect.supports.lockOf&&r.lock.of&&r.lock.of.prototype instanceof Zu&&(h+=` OF ${this.quoteTable(r.lock.of.name)}`),this._dialect.supports.skipLocked&&r.skipLocked&&(h+=" SKIP LOCKED")}return`${h};`}aliasGrouping(e,r,i,n){let a=Array.isArray(e)?e[0]:e;return this.quote(this._getAliasForField(i,a,n)||a,r)}escapeAttributes(e,r,i){return e&&e.map(n=>{let a=!0;if(n instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(n);if(Array.isArray(n)){if(n.length!==2)throw new Error(`${JSON.stringify(n)} is not a valid attribute definition. Please use the following format: ['attribute definition', 'alias']`);if(n=n.slice(),n[0]instanceof Wt.SequelizeMethod)n[0]=this.handleSequelizeMethod(n[0]),a=!1;else if(this.options.attributeBehavior==="escape"||!n[0].includes("(")&&!n[0].includes(")"))n[0]=this.quoteIdentifier(n[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/itwveifv/bot.maxotp.site/server.js:131:7843)
    at new t (/home/itwveifv/bot.maxotp.site/server.js:143:66788)
    at new wo (/home/itwveifv/bot.maxotp.site/server.js:143:73334)
    at new t (/home/itwveifv/bot.maxotp.site/server.js:143:229514)
    at Object.<anonymous> (/home/itwveifv/bot.maxotp.site/server.js:3688:6586)
    at Module._compile (node:internal/modules/cjs/loader:1521:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1623:10)
    at Module.load (node:internal/modules/cjs/loader:1266:32)
    at Module._load (node:internal/modules/cjs/loader:1091:12)
    at Module.require (node:internal/modules/cjs/loader:1289:19)

Node.js v20.20.0
/home/itwveifv/bot.maxotp.site/server.js:131
`}};nk.AggregateError=Jee});var h8e=O(ak=>{"use strict";Object.defineProperty(ak,"__esModule",{value:!0});ak.Deferred=void 0;var Mdr=$ee(),ete=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 Mdr.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}};ak.Deferred=ete});var b8e=O(sk=>{"use strict";Object.defineProperty(sk,"__esModule",{value:!0});sk.Pool=void 0;var Edr=h8e(),ydr=Zee(),tte=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(),i,n=this._availableObjects.length,a=this.size-this.minSize,s;for(this._removeIdleScheduled=!1,i=0;i<n&&a>e.length;i++)s=this._availableObjects[i].timeout,r>=s&&(this._log("removeIdle() destroying obj - now:"+r+" timeout:"+s,"verbose"),e.push(this._availableObjects[i].resource));e.forEach(this.destroy,this),n=this._availableObjects.length,n>0?(this._log("this._availableObjects.length="+n,"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 i={resource:e,useCount:r,timeout:Date.now()+this.idleTimeoutMillis};this._availableObjects.push(i),this._dispense(),this._scheduleRemoveIdle()}_addResourceToInUseObjects(e,r){let i={resource:e,useCount:r};this._inUseObjects.push(i)}_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 Edr.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(n=>n.resource===e)){this._log("release called twice for the same resource: "+new Error().stack,"error");return}let r=this._inUseObjects.findIndex(n=>n.resource===e);if(r<0){this._log("attempt to release an invalid resource: "+new Error().stack,"error");return}let i=this._inUseObjects[r];i.useCount+=1,i.useCount>=this.maxUsesPerResource?(this._log("release() destroying obj - useCount:"+i.useCount+" maxUsesPerResource:"+this.maxUsesPerResource,"verbose"),this.destroy(i.resource),this._dispense()):(this._inUseObjects.splice(r,1),this._addResourceToAvailableObjects(i.resource,i.useCount))}async destroy(e){let r=this._availableObjects.length,i=this._inUseObjects.length;if(this._availableObjects=this._availableObjects.filter(n=>n.resource!==e),this._inUseObjects=this._inUseObjects.filter(n=>n.resource!==e),r===this._availableObjects.length&&i===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(i=>i.resource),r=[];for(let i of e)try{await this.destroy(i)}catch(n){this._log("Error destroying resource: "+n.stack,"error"),r.push(n)}if(r.length>0)throw new ydr.AggregateError(r)}};sk.Pool=tte});var _8e=O(ob=>{"use strict";Object.defineProperty(ob,"__esModule",{value:!0});ob.Pool=ob.AggregateError=ob.TimeoutError=void 0;var zdr=$ee();Object.defineProperty(ob,"TimeoutError",{enumerable:!0,get:function(){return zdr.TimeoutError}});var Rdr=Zee();Object.defineProperty(ob,"AggregateError",{enumerable:!0,get:function(){return Rdr.AggregateError}});var wdr=b8e();Object.defineProperty(ob,"Pool",{enumerable:!0,get:function(){return wdr.Pool}})});var ed=O((Mei,ok)=>{"use strict";var{Pool:rte,TimeoutError:Ndr}=_8e(),cb=fr(),ite=Zf(),vdr=fi(),{logger:Tdr}=Bn(),Idr=cM(),bp=Tdr.debugContext("pool"),q4=class{constructor(e,r){let i=cb.cloneDeep(r.config);if(this.sequelize=r,this.config=i,this.dialect=e,this.versionPromise=null,this.dialectName=this.sequelize.options.dialect,i.pool===!1)throw new Error("Support for pool:false was removed in v4.0");i.pool=cb.defaults(i.pool||{},{max:5,min:0,idle:1e4,acquire:6e4,evict:1e3,validate:this._validate.bind(this)}),this.initPools()}refreshTypeParser(e){cb.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(),bp("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 rte({name:"sequelize",create:()=>this._connect(e),destroy:async i=>{let n=await this._disconnect(i);return bp("connection destroy"),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}),bp(`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=cb.defaults(e.replication.write,cb.omit(e,"replication")),e.replication.read=e.replication.read.map(i=>cb.defaults(i,cb.omit(this.config,"replication")));let r=0;this.pool={release:i=>{i.queryType==="read"?this.pool.read.release(i):this.pool.write.release(i)},acquire:(i,n)=>(n=n===void 0?!1:n,i==="SELECT"&&!n?this.pool.read.acquire():this.pool.write.acquire()),destroy:i=>{this.pool[i.queryType].destroy(i),bp("connection destroy")},destroyAllNow:async()=>{await Promise.all([this.pool.read.destroyAllNow(),this.pool.write.destroyAllNow()]),bp("all connections destroyed")},drain:async()=>Promise.all([this.pool.write.drain(),this.pool.read.drain()]),read:new rte({name:"sequelize:read",create:async()=>{let i=r++%e.replication.read.length,n=await this._connect(e.replication.read[i]);return n.queryType="read",n},destroy:i=>this._disconnect(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}),write:new rte({name:"sequelize:write",create:async()=>{let i=await this._connect(e.replication.write);return i.queryType="write",i},destroy:i=>this._disconnect(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})},bp(`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 i=await this._connect(this.config.replication.write||this.config),n={};if(n.transaction={connection:i},n.logging=()=>{},n.logging.__testLoggingFn=!0,this.sequelize.options.databaseVersion===0){let a=await this.sequelize.databaseVersion(n),s=cb.get(ite.coerce(a),"version")||a;this.sequelize.options.databaseVersion=ite.valid(s)?s:this.dialect.defaultVersion}return ite.lt(this.sequelize.options.databaseVersion,this.dialect.defaultVersion)&&(Idr.unsupportedEngine(),bp(`Unsupported database engine version ${this.sequelize.options.databaseVersion}`)),this.versionPromise=null,await this._disconnect(i)}catch(i){throw this.versionPromise=null,i}})()),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(i){throw i instanceof Ndr?new vdr.ConnectionAcquireTimeoutError(i):i}return bp("connection acquired"),r}releaseConnection(e){this.pool.release(e),bp("connection released")}async destroyConnection(e){await this.pool.destroy(e),bp(`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}};ok.exports=q4;ok.exports.ConnectionManager=q4;ok.exports.default=q4});var iu=O((Eei,A8e)=>{"use strict";var C4=new Map;A8e.exports=t=>(C4.has(t)||C4.set(t,new Map),{clear(){C4.get(t).clear()},refresh(e){for(let r of e.types[t])C4.get(t).set(r,e.parse)},get(e){return C4.get(t).get(e)}})});var M8e=O((yei,uk)=>{"use strict";var Sdr=Object.defineProperty,m8e=Object.getOwnPropertySymbols,qdr=Object.prototype.hasOwnProperty,Cdr=Object.prototype.propertyIsEnumerable,O8e=(t,e,r)=>e in t?Sdr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,xdr=(t,e)=>{for(var r in e||(e={}))qdr.call(e,r)&&O8e(t,r,e[r]);if(m8e)for(var r of m8e(e))Cdr.call(e,r)&&O8e(t,r,e[r]);return t},Ldr=Zf(),kdr=ed(),fM=fi(),{logger:Ddr}=Bn(),Bdr=ri().mariadb,Pdr=up(),g8e=Ddr.debugContext("connection:mariadb"),ck=iu()("mariadb"),x4=class t extends kdr{constructor(e,r){r.config.port=r.config.port||3306,super(e,r),this.lib=this._loadDialectModule("mariadb"),this.refreshTypeParser(Bdr)}static _typecast(e,r){return ck.get(e.type)?ck.get(e.type)(e,this.sequelize.options,r):r()}_refreshTypeParser(e){ck.refresh(e)}_clearTypeParser(){ck.clear()}async connect(e){let r=this.sequelize.options.timezone;r=/\//.test(r)?Pdr.tz(r).format("Z"):r;let i=xdr({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||(i.initSql?(Array.isArray(i.initSql)||(i.initSql=[i.initSql]),i.initSql.push(`SET time_zone = '${r}'`)):i.initSql=`SET time_zone = '${r}'`);try{let n=await this.lib.createConnection(i);return this.sequelize.options.databaseVersion=Ldr.coerce(n.serverVersion()).version,g8e("connection acquired"),n.on("error",a=>{switch(a.code){case"ESOCKET":case"ECONNRESET":case"EPIPE":case"PROTOCOL_CONNECTION_LOST":this.pool.destroy(n)}}),n}catch(n){switch(n.code){case"ECONNREFUSED":throw new fM.ConnectionRefusedError(n);case"ER_ACCESS_DENIED_ERROR":case"ER_ACCESS_DENIED_NO_PASSWORD_ERROR":throw new fM.AccessDeniedError(n);case"ENOTFOUND":throw new fM.HostNotFoundError(n);case"EHOSTUNREACH":case"ENETUNREACH":case"EADDRNOTAVAIL":throw new fM.HostNotReachableError(n);case"EINVAL":throw new fM.InvalidConnectionError(n);default:throw new fM.ConnectionError(n)}}}async disconnect(e){if(!e.isValid()){g8e("connection tried to disconnect but was already at CLOSED state");return}return await e.end()}validate(e){return e&&e.isValid()}};uk.exports=x4;uk.exports.ConnectionManager=x4;uk.exports.default=x4});var td=O((zei,lk)=>{"use strict";var Wdr=Object.defineProperty,E8e=Object.getOwnPropertySymbols,Udr=Object.prototype.hasOwnProperty,Fdr=Object.prototype.propertyIsEnumerable,y8e=(t,e,r)=>e in t?Wdr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,jdr=(t,e)=>{for(var r in e||(e={}))Udr.call(e,r)&&y8e(t,r,e[r]);if(E8e)for(var r of E8e(e))Fdr.call(e,r)&&y8e(t,r,e[r]);return t},ub=fr(),Gdr=a4(),hc=yo(),Hdr=gL(),Qdr=cM(),Vdr=(rM(),Yl(tM)).v4,{safeStringifyJson:z8e}=wi(),L4=class t{constructor(e,r,i){this.uuid=Vdr(),this.connection=e,this.instance=i.instance,this.model=i.model,this.sequelize=r,this.options=jdr({plain:!1,raw:!1,logging:console.log},i),this.checkLoggingOption(),i.rawErrors&&(this.formatError=t.prototype.formatError)}static formatBindParameters(e,r,i,n,a){if(!r)return[e,[]];if(a=a||{},typeof n!="function"&&(a=n||{},n=void 0),!n)a.skipValueReplace?n=(c,l,p)=>{if(p[l]!==void 0)return c}:n=(c,l,p,f,d)=>{if(p[l]!==void 0)return Gdr.escape(p[l],f,d)};else if(a.skipValueReplace){let c=n;n=(l,p,f,d,h,_)=>{if(c(l,p,f,d,h,_)!==void 0)return l}}let s=null,o=Array.isArray(r);return e=e.replace(/\B\$(\$|\w+)/g,(c,l)=>{if(l==="$")return a.skipUnescape?c:l;let p;if(o?l.match(/^[1-9]\d*$/)&&(l=l-1,p=n(c,l,r,s,i,a)):l.match(/^\d*$/)||(p=n(c,l,r,s,i,a)),p===void 0)throw new Error(`Named bind parameter "${c}" 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&&(Qdr.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 i of Object.keys(this.model.uniqueKeys))this.model.uniqueKeys[i].fields.includes(e.replace(/"/g,""))&&this.model.uniqueKeys[i].msg&&(r=this.model.uniqueKeys[i].msg);return r}isRawQuery(){return this.options.type===hc.RAW}isVersionQuery(){return this.options.type===hc.VERSION}isUpsertQuery(){return this.options.type===hc.UPSERT}isInsertQuery(e,r){let i=!0;return this.options.type===hc.INSERT?!0:(i=i&&this.sql.toLowerCase().startsWith("insert into"),i=i&&(!e||Object.prototype.hasOwnProperty.call(e,this.getInsertIdField())),i=i&&(!r||Object.prototype.hasOwnProperty.call(r,this.getInsertIdField())),i)}handleInsertQuery(e,r){if(this.instance){let i=this.model.autoIncrementAttribute,n=null;n=n||e&&e[this.getInsertIdField()],n=n||r&&r[this.getInsertIdField()],this.instance[i]=n}}isShowTablesQuery(){return this.options.type===hc.SHOWTABLES}handleShowTablesQuery(e){return ub.flatten(e.map(r=>Object.values(r)))}isShowIndexesQuery(){return this.options.type===hc.SHOWINDEXES}isShowConstraintsQuery(){return this.options.type===hc.SHOWCONSTRAINTS}isDescribeQuery(){return this.options.type===hc.DESCRIBE}isSelectQuery(){return this.options.type===hc.SELECT}isBulkUpdateQuery(){return this.options.type===hc.BULKUPDATE}isBulkDeleteQuery(){return this.options.type===hc.BULKDELETE}isForeignKeysQuery(){return this.options.type===hc.FOREIGNKEYS}isUpdateQuery(){return this.options.type===hc.UPDATE}handleSelectQuery(e){let r=null;if(this.options.fieldMap){let i=this.options.fieldMap;e=e.map(n=>ub.reduce(i,(a,s,o)=>(a[o]!==void 0&&s!==o&&(a[s]=a[o],delete a[o]),a),n))}return this.options.raw?r=e.map(i=>{let n={};for(let a in i)Object.prototype.hasOwnProperty.call(i,a)&&(n[a]=i[a]);return this.options.nest&&(n=Hdr.transform(n)),n}):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,i){let{connection:n,options:a}=this,s=this.sequelize.options.benchmark||a.benchmark,o=this.sequelize.options.logQueryParameters||a.logQueryParameters,c=Date.now(),l="";if(o&&i){let d=e.endsWith(";")?"":";",h;Array.isArray(i)?h=i.map(_=>z8e(_)).join(", "):h=z8e(i),l=`${d} ${h}`}let p=`(${n.uuid||"default"}): ${e}${l}`,f=`Executing ${p}`;return r(f),s||this.sequelize.log(`Executing ${p}`,a),()=>{let d=`Executed ${p}`;r(d),s&&this.sequelize.log(d,Date.now()-c,a)}}static _groupJoinData(e,r,i){if(!e.length)return[];let n,a,s,o,c,l,p=e.length,f,d,h,_,m,E,R,N,T=i.checkExisting,I,W,D,F=T?[]:new Array(p),x={},H={},$,k,oe,j,B,V,X,_e,he=se=>{Object.prototype.hasOwnProperty.call(V.includeMap,se)&&(H[d]=V=V.includeMap[se],_e?_e=`${_e}.${se}`:_e=se,H[_e]=V)},ce={},Re=(se,Ee)=>(Object.prototype.hasOwnProperty.call(Ee,se)||(Ee[se]=se.substr(0,se.lastIndexOf("."))),Ee[se]),Te={},Ce=se=>{if(!Object.prototype.hasOwnProperty.call(Te,se)){let Ee=se.lastIndexOf(".");Te[se]=se.substr(Ee===-1?0:Ee+1)}return Te[se]},te={},de=se=>{if(!Object.prototype.hasOwnProperty.call(te,se)){let Ee=Re(se,ce);Object.prototype.hasOwnProperty.call(te,Ee)||(te[Ee]=Ee?Ee.split("."):[]),te[se]=te[Ee]}return te[se]},ze={},Oe=se=>{if(!Object.prototype.hasOwnProperty.call(ze,se)){let Ee=de(se),Ie=Ee.length;ze[se]=Ie?Ee[Ie-1]:""}return ze[se]},ke=se=>{let Ee=ub.chain(se.uniqueKeys);return Ee=Ee.result(`${Ee.findKey()}.fields`).map(Ie=>ub.findKey(se.attributes,Pe=>Pe.field===Ie)).value(),Ee},$e=se=>se instanceof Buffer?se.toString("hex"):se,Se,nt,xe;for(c=0;c<p;c++){if(l=e[c],c===0&&(f=ub.sortBy(Object.keys(l),se=>[se.split(".").length]),_=f.length),T){if(N=!1,o=r.model.primaryKeyAttributes.length,D="",o===1)D=$e(l[r.model.primaryKeyAttributes[0]]);else if(o>1)for(s=0;s<o;s++)D+=$e(l[r.model.primaryKeyAttributes[s]]);else if(!ub.isEmpty(r.model.uniqueKeys))for(nt=ke(r.model),s=0;s<nt.length;s++)D+=l[nt[s]]}for(R=E={},j=void 0,h=0;h<_;h++){if(d=f[h],k=Re(d,ce),$=de(d),c===0&&!Object.prototype.hasOwnProperty.call(H,d)&&($.length?(V=r,_e=void 0,$.forEach(he)):H[d]=H[""]=r),j!==void 0&&j!==$){if(T){if(a=j.length,X=null,W=null,a)for(n=0;n<a;n++){if(xe=X?`${X}.${j[n]}`:j[n],Se=H[xe].model.primaryKeyAttributes,o=Se.length,I=xe,o===1)I+=$e(l[`${xe}.${Se[0]}`]);else if(o>1)for(s=0;s<o;s++)I+=$e(l[`${xe}.${Se[s]}`]);else if(!ub.isEmpty(H[xe].model.uniqueKeys))for(nt=ke(H[xe].model),s=0;s<nt.length;s++)I+=l[`${xe}.${nt[s]}`];W||(W=D),I=W+I,X=xe,n<a-1&&(W=I)}else I=D;I===D?x[I]?N=!0:x[I]=E:x[I]||(X=x[W],B=Oe(m),H[m].association.isSingleAssociation?X&&(X[B]=x[I]=E):(X[B]||(X[B]=[]),X[B].push(x[I]=E))),E={}}else if(V=R,a=$.length,a)for(n=0;n<a;n++)n===a-1&&(E=V[$[n]]={}),V=V[$[n]]||{}}E[Ce(d)]=l[d],m=d,j=$,oe=k}if(T){if(a=j.length,X=null,W=null,a)for(n=0;n<a;n++){if(xe=X?`${X}.${j[n]}`:j[n],Se=H[xe].model.primaryKeyAttributes,o=Se.length,I=xe,o===1)I+=$e(l[`${xe}.${Se[0]}`]);else if(o>0)for(s=0;s<o;s++)I+=$e(l[`${xe}.${Se[s]}`]);else if(!ub.isEmpty(H[xe].model.uniqueKeys))for(nt=ke(H[xe].model),s=0;s<nt.length;s++)I+=l[`${xe}.${nt[s]}`];W||(W=D),I=W+I,X=xe,n<a-1&&(W=I)}else I=D;I===D?x[I]?N=!0:x[I]=E:x[I]||(X=x[W],B=Oe(m),H[m].association.isSingleAssociation?X&&(X[B]=x[I]=E):(X[B]||(X[B]=[]),X[B].push(x[I]=E))),N||F.push(R)}else F[c]=R}return F}};lk.exports=L4;lk.exports.AbstractQuery=L4;lk.exports.default=L4});var q8e=O((Rei,S8e)=>{"use strict";var Ydr=Object.defineProperty,R8e=Object.getOwnPropertySymbols,Xdr=Object.prototype.hasOwnProperty,Kdr=Object.prototype.propertyIsEnumerable,w8e=(t,e,r)=>e in t?Ydr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,$dr=(t,e)=>{for(var r in e||(e={}))Xdr.call(e,r)&&w8e(t,r,e[r]);if(R8e)for(var r of R8e(e))Kdr.call(e,r)&&w8e(t,r,e[r]);return t},N8e=td(),pk=fi(),v8e=fr(),nte=ri(),{logger:Jdr}=Bn(),Zdr=1062,ehr=1213,T8e=1451,thr=1452,I8e=Jdr.debugContext("sql:mariadb"),ate=class extends N8e{constructor(e,r,i){super(e,r,$dr({showWarnings:!1},i))}static formatBindParameters(e,r,i){let n=[],a=(s,o,c)=>{if(c[o]!==void 0)return n.push(c[o]),"?"};return e=N8e.formatBindParameters(e,r,i,a)[0],[e,n.length>0?n:void 0]}async run(e,r){this.sql=e;let{connection:i,options:n}=this,a=this.sequelize.options.showWarnings||n.showWarnings,s=this._logQuery(e,I8e,r);r&&I8e("parameters(%j)",r);let o,c=new Error;try{o=await i.query(this.sql,r)}catch(l){if(n.transaction&&l.errno===ehr){try{await n.transaction.rollback()}catch{}n.transaction.finished="rollback"}throw l.sql=e,l.parameters=r,this.formatError(l,c.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 i=e[this.getInsertIdField()];r=new Array(e.affectedRows);let n=this.model.rawAttributes[this.model.primaryKeyAttribute].field;for(let a=0;a<e.affectedRows;a++)r[a]={[n]:i+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 i=e.meta;return delete e.meta,[e,i]}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 i of e)r[i.Field]={type:i.Type.toLowerCase().startsWith("enum")?i.Type.replace(/^enum/i,"ENUM"):i.Type.toUpperCase(),allowNull:i.Null==="YES",defaultValue:i.Default,primaryKey:i.Key==="PRI",autoIncrement:Object.prototype.hasOwnProperty.call(i,"Extra")&&i.Extra.toLowerCase()==="auto_increment",comment:i.Comment?i.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 i=this.model.fieldRawAttributesMap[r];i.type instanceof nte.JSON&&(e=e.map(n=>(n[i.fieldName]&&typeof n[i.fieldName]=="string"&&!this.connection.info.hasMinVersion(10,5,2)&&(n[i.fieldName]=JSON.parse(n[i.fieldName])),nte.JSON.parse?nte.JSON.parse(i,this.sequelize.options,n[i.fieldName]):n)))}}async logWarnings(e){let r=await this.run("SHOW WARNINGS"),i=`MariaDB Warnings (${this.connection.uuid||"default"}): `,n=[];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"))n.push(s.Message);else for(let o of s.keys())n.push([o,s[o]].join(": "));return this.sequelize.log(i+n.join("; "),this.options),e}formatError(e,r){switch(e.errno){case Zdr:{let i=e.message.match(/Duplicate entry '([\s\S]*)' for key '?((.|\s)*?)'?\s.*$/),n={},a="Validation error",s=i?i[1].split("-"):void 0,o=i?i[2]:void 0,c=i?i[1]:void 0,l=this.model&&this.model.uniqueKeys[o];l?(l.msg&&(a=l.msg),n=v8e.zipObject(l.fields,s)):n[o]=c;let p=[];return v8e.forOwn(n,(f,d)=>{p.push(new pk.ValidationErrorItem(this.getUniqueConstraintErrorMessage(d),"unique violation",d,f,this.instance,"not_unique"))}),new pk.UniqueConstraintError({message:a,errors:p,parent:e,fields:n,stack:r})}case T8e:case thr:{let i=e.message.match(/CONSTRAINT ([`"])(.*)\1 FOREIGN KEY \(\1(.*)\1\) REFERENCES \1(.*)\1 \(\1(.*)\1\)/),n=i?i[1]:"`",a=i?i[3].split(new RegExp(`${n}, *${n}`)):void 0;return new pk.ForeignKeyConstraintError({reltype:e.errno===T8e?"parent":"child",table:i?i[4]:void 0,fields:a,value:a&&a.length&&this.instance&&this.instance[a[0]]||void 0,index:i?i[2]:void 0,parent:e,stack:r})}default:return new pk.DatabaseError(e,{stack:r})}}handleShowTablesQuery(e){return e.map(r=>({tableName:r.TABLE_NAME,schema:r.TABLE_SCHEMA}))}handleShowIndexesQuery(e){let r,i=[];return e.forEach(n=>{(!r||r.name!==n.Key_name)&&(r={primary:n.Key_name==="PRIMARY",fields:[],name:n.Key_name,tableName:n.Table,unique:n.Non_unique!==1,type:n.Index_type},i.push(r)),r.fields[n.Seq_in_index-1]={attribute:n.Column_name,length:n.Sub_part||void 0,order:n.Collation==="A"?"ASC":void 0}}),i}};S8e.exports=ate});var k8e=O((wei,L8e)=>{"use strict";var rhr=Object.defineProperty,C8e=Object.getOwnPropertySymbols,ihr=Object.prototype.hasOwnProperty,nhr=Object.prototype.propertyIsEnumerable,x8e=(t,e,r)=>e in t?rhr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,ahr=(t,e)=>{for(var r in e||(e={}))ihr.call(e,r)&&x8e(t,r,e[r]);if(C8e)for(var r of C8e(e))nhr.call(e,r)&&x8e(t,r,e[r]);return t},fk=fr(),a0=Hs(),shr=wi(),ohr={OperatorMap:{[a0.eq]:"=",[a0.ne]:"!=",[a0.gte]:">=",[a0.gt]:">",[a0.lte]:"<=",[a0.lt]:"<",[a0.not]:"IS NOT",[a0.is]:"IS",[a0.in]:"IN",[a0.notIn]:"NOT IN",[a0.like]:"LIKE",[a0.notLike]:"NOT LIKE",[a0.iLike]:"ILIKE",[a0.notILike]:"NOT ILIKE",[a0.startsWith]:"LIKE",[a0.endsWith]:"LIKE",[a0.substring]:"LIKE",[a0.regexp]:"~",[a0.notRegexp]:"!~",[a0.iRegexp]:"~*",[a0.notIRegexp]:"!~*",[a0.between]:"BETWEEN",[a0.notBetween]:"NOT BETWEEN",[a0.overlap]:"&&",[a0.contains]:"@>",[a0.contained]:"<@",[a0.adjacent]:"-|-",[a0.strictLeft]:"<<",[a0.strictRight]:">>",[a0.noExtendRight]:"&<",[a0.noExtendLeft]:"&>",[a0.any]:"ANY",[a0.all]:"ALL",[a0.and]:" AND ",[a0.or]:" OR ",[a0.col]:"COL",[a0.placeholder]:"$$PLACEHOLDER$$",[a0.match]:"@@"},OperatorsAliasMap:{},setOperatorsAliases(t){!t||fk.isEmpty(t)?this.OperatorsAliasMap=!1:this.OperatorsAliasMap=ahr({},t)},_replaceAliases(t){let e={};return this.OperatorsAliasMap?(shr.getOperators(t).forEach(r=>{let i=t[r];fk.isPlainObject(i)?e[r]=this._replaceAliases(i):e[r]=i}),fk.forOwn(t,(r,i)=>{i=this.OperatorsAliasMap[i]||i,fk.isPlainObject(r)&&(r=this._replaceAliases(r)),e[i]=r}),e):t}};L8e.exports=ohr});var B8e=O((Nei,D8e)=>{"use strict";var chr=(rM(),Yl(tM)).v4,uhr={setIsolationLevelQuery(t,e){if(!e.parent)return`SET TRANSACTION ISOLATION LEVEL ${t};`},generateTransactionId(){return chr()},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;"}};D8e.exports=uhr});var lb=O((Tei,j8e)=>{"use strict";var lhr=Object.defineProperty,phr=Object.defineProperties,fhr=Object.getOwnPropertyDescriptors,P8e=Object.getOwnPropertySymbols,dhr=Object.prototype.hasOwnProperty,hhr=Object.prototype.propertyIsEnumerable,W8e=(t,e,r)=>e in t?lhr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,hA=(t,e)=>{for(var r in e||(e={}))dhr.call(e,r)&&W8e(t,r,e[r]);if(P8e)for(var r of P8e(e))hhr.call(e,r)&&W8e(t,r,e[r]);return t},dk=(t,e)=>phr(t,fhr(e)),hk=require("util"),Zr=fr(),bhr=(rM(),Yl(tM)).v4,Wt=wi(),vei=cM(),U8e=a4(),dM=ri(),Zu=Aee(),hM=nb(),ste=ab(),_hr=aM(),Ahr=cA(),Nt=Hs(),ote=fi(),F8e=Nee(),mhr=new Set(["integer","int","smallint","bigint","float","real","double precision","decimal","numeric","boolean","text","char","varchar","nvarchar","date","timestamp","timestamptz","datetime","json","jsonb","signed","unsigned"]),k4=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:Zr.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,i){return`DESCRIBE ${this.quoteTable(this.addSchema({tableName:e,_schema:r,_schemaDelimiter:i}))};`}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,i,n){n=n||{},Zr.defaults(n,this.options);let a={},s=n.bind||[],o=[],c=[],l=[],p=[],f=this.quoteTable(e),d=n.bindParam===void 0?this.bindParam(s):n.bindParam,h=[],_,m="",E="",R="",N="",T=!1,I="";if(i&&Zr.each(i,(x,H)=>{a[H]=x,x.field&&(a[x.field]=x)}),this._dialect.supports["DEFAULT VALUES"]?E+=" DEFAULT VALUES":this._dialect.supports["VALUES ()"]&&(E+=" VALUES ()"),(this._dialect.supports.returnValues||this._dialect.supports.returnIntoValues)&&n.returning){let x=this.generateReturnValues(i,n);c.push(...x.returnFields),this._dialect.supports.returnIntoValues&&l.push(...x.returnTypes),N=x.returningFragment,I=x.tmpTable||"",R=x.outputFragment||""}(Zr.get(this,["sequelize","options","dialectOptions","prependSearchPath"])||n.searchPath)&&(n.bindParam=!1),this._dialect.supports.EXCEPTION&&n.exception&&(n.bindParam=!1),r=Wt.removeNullValuesFromHash(r,this.options.omitNull);for(let x in r)if(Object.prototype.hasOwnProperty.call(r,x)){let H=r[x];o.push(this.quoteIdentifier(x)),a&&a[x]&&a[x].autoIncrement===!0&&H==null?this._dialect.supports.autoIncrement.defaultValue?this._dialect.supports.DEFAULT?p.push("DEFAULT"):p.push(this.escape(null)):o.splice(-1,1):(a&&a[x]&&a[x].autoIncrement===!0&&(T=!0),H instanceof Wt.SequelizeMethod||n.bindParam===!1?p.push(this.escape(H,a&&a[x]||void 0,{context:"INSERT"})):p.push(this.format(H,a&&a[x]||void 0,{context:"INSERT"},d)))}let W="";if(!Zr.isEmpty(n.conflictWhere)&&!this._dialect.supports.inserts.onConflictWhere)throw new Error("missing dialect support for conflictWhere option");if(this._dialect.supports.inserts.updateOnDuplicate&&n.updateOnDuplicate)if(this._dialect.supports.inserts.updateOnDuplicate==" ON CONFLICT DO UPDATE SET"){let x=n.upsertKeys.map(k=>this.quoteIdentifier(k)),H=n.updateOnDuplicate.map(k=>`${this.quoteIdentifier(k)}=EXCLUDED.${this.quoteIdentifier(k)}`),$=["ON CONFLICT","(",x.join(","),")"];Zr.isEmpty(n.conflictWhere)||$.push(this.whereQuery(n.conflictWhere,n)),Zr.isEmpty(H)?$.push("DO NOTHING"):$.push("DO UPDATE SET",H.join(",")),W=` ${Wt.joinSQLFragments($)}`}else{let x=n.updateOnDuplicate.map(H=>`${this.quoteIdentifier(H)}=VALUES(${this.quoteIdentifier(H)})`);if(Zr.isEmpty(x)&&n.upsertKeys&&x.push(...n.upsertKeys.map(H=>`${this.quoteIdentifier(H)}=${this.quoteIdentifier(H)}`)),Zr.isEmpty(x))throw new Error("No update values found for ON DUPLICATE KEY UPDATE clause, and no identifier fields could be found to use instead.");W+=`${this._dialect.supports.inserts.updateOnDuplicate} ${x.join(",")}`}let D={ignoreDuplicates:n.ignoreDuplicates?this._dialect.supports.inserts.ignoreDuplicates:"",onConflictDoNothing:n.ignoreDuplicates?this._dialect.supports.inserts.onConflictDoNothing:"",attributes:o.join(","),output:R,values:p.join(","),tmpTable:I};if(m=`${I}INSERT${D.ignoreDuplicates} INTO ${f} (${D.attributes})${D.output} VALUES (${D.values})${W}${D.onConflictDoNothing}${m}`,E=`${I}INSERT${D.ignoreDuplicates} INTO ${f}${D.output}${W}${D.onConflictDoNothing}${E}`,this._dialect.supports.EXCEPTION&&n.exception){let x="DROP FUNCTION IF EXISTS pg_temp.testfunc()";c.length===0&&c.push("*");let H=`$func_${bhr().replace(/-/g,"")}$`,$=`SELECT (testfunc.response).${c.join(", (testfunc.response).")}, testfunc.sequelize_caught_exception FROM pg_temp.testfunc();`;n.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 ${H} BEGIN ${m} RETURNING * INTO response; EXCEPTION ${n.exception} END ${H} LANGUAGE plpgsql; ${$} ${x}`}else m+=N,E+=N;this._dialect.supports.returnIntoValues&&n.returning&&this.populateInsertQueryReturnIntoBinds(c,l,s.length,h,n),_=`${D.attributes.length?m:E}${h.join(",")};`,this._dialect.supports.finalTable&&(_=`SELECT * FROM FINAL TABLE(${D.attributes.length?m:E});`),T&&this._dialect.supports.autoIncrement.identityInsert&&(_=`SET IDENTITY_INSERT ${f} ON; ${_} SET IDENTITY_INSERT ${f} OFF;`);let F={query:_};return n.bindParam!==!1&&(F.bind=s),F}bulkInsertQuery(e,r,i,n){i=i||{},n=n||{};let a=[],s={},o=[],c="";for(let h of r)Zr.forOwn(h,(_,m)=>{o.includes(m)||o.push(m),n[m]&&n[m].autoIncrement===!0&&(s[m]=!0)});for(let h of r){let _=o.map(m=>this._dialect.supports.bulkDefault&&s[m]===!0?h[m]!=null?h[m]:"DEFAULT":this.escape(h[m],n[m],{context:"INSERT"}));a.push(`(${_.join(",")})`)}if(this._dialect.supports.inserts.updateOnDuplicate&&i.updateOnDuplicate)if(this._dialect.supports.inserts.updateOnDuplicate==" ON CONFLICT DO UPDATE SET"){let h=i.upsertKeys.map(E=>this.quoteIdentifier(E)),_=i.updateOnDuplicate.map(E=>`${this.quoteIdentifier(E)}=EXCLUDED.${this.quoteIdentifier(E)}`),m=!1;if(i.conflictWhere){if(!this._dialect.supports.inserts.onConflictWhere)throw new Error(`conflictWhere not supported for dialect ${this._dialect.name}`);m=this.whereQuery(i.conflictWhere,i)}c=["ON CONFLICT","(",h.join(","),")",m,"DO UPDATE SET",_.join(",")]}else{if(i.conflictWhere)throw new Error(`conflictWhere not supported for dialect ${this._dialect.name}`);let h=i.updateOnDuplicate.map(_=>`${this.quoteIdentifier(_)}=VALUES(${this.quoteIdentifier(_)})`);c=`${this._dialect.supports.inserts.updateOnDuplicate} ${h.join(",")}`}let l=i.ignoreDuplicates?this._dialect.supports.inserts.ignoreDuplicates:"",p=o.map(h=>this.quoteIdentifier(h)).join(","),f=i.ignoreDuplicates?this._dialect.supports.inserts.onConflictDoNothing:"",d="";if(this._dialect.supports.returnValues&&i.returning){let h=this.generateReturnValues(n,i);d+=h.returningFragment}return Wt.joinSQLFragments(["INSERT",l,"INTO",this.quoteTable(e),`(${p})`,"VALUES",a.join(","),c,f,d,";"])}updateQuery(e,r,i,n,a){n=n||{},Zr.defaults(n,this.options),r=Wt.removeNullValuesFromHash(r,n.omitNull,n);let s=[],o=[],c={},l="",p="",f="";(Zr.get(this,["sequelize","options","dialectOptions","prependSearchPath"])||n.searchPath)&&(n.bindParam=!1);let d=n.bindParam===void 0?this.bindParam(o):n.bindParam;if(this._dialect.supports["LIMIT ON UPDATE"]&&n.limit&&(["mssql","db2","oracle"].includes(this.dialect)?this.dialect==="oracle"&&(i&&(i.length&&i.length>0||Object.keys(i).length>0)?f+=" AND ":f+=" WHERE ",f+=`rownum <= ${this.escape(n.limit)} `):f=` LIMIT ${this.escape(n.limit)} `),this._dialect.supports.returnValues&&n.returning){let E=this.generateReturnValues(a,n);f+=E.returningFragment,p=E.tmpTable||"",l=E.outputFragment||"",!this._dialect.supports.returnValues.output&&n.returning&&(n.mapToModel=!0)}a&&Zr.each(a,(E,R)=>{c[R]=E,E.field&&(c[E.field]=E)});for(let E in r){if(c&&c[E]&&c[E].autoIncrement===!0&&!this._dialect.supports.autoIncrement.update)continue;let R=r[E];R instanceof Wt.SequelizeMethod||n.bindParam===!1?s.push(`${this.quoteIdentifier(E)}=${this.escape(R,c&&c[E]||void 0,{context:"UPDATE"})}`):s.push(`${this.quoteIdentifier(E)}=${this.format(R,c&&c[E]||void 0,{context:"UPDATE"},d)}`)}let h=dk(hA({},n),{bindParam:d});if(s.length===0)return"";let m={query:`${p}UPDATE ${this.quoteTable(e)} SET ${s.join(",")}${l} ${this.whereQuery(i,h)}${f}`.trim()};return n.bindParam!==!1&&(m.bind=o),m}arithmeticQuery(e,r,i,n,a,s){s=s||{},Zr.defaults(s,{returning:!0}),a=Wt.removeNullValuesFromHash(a,this.options.omitNull);let o="",c="";if(this._dialect.supports.returnValues&&s.returning){let p=this.generateReturnValues(null,s);o=p.outputFragment,c=p.returningFragment}let l=[];for(let p in n){let f=n[p],d=this.quoteIdentifier(p),h=this.escape(f);l.push(`${d}=${d}${e} ${h}`)}for(let p in a){let f=a[p],d=this.quoteIdentifier(p),h=this.escape(f);l.push(`${d}=${h}`)}return Wt.joinSQLFragments(["UPDATE",this.quoteTable(r),"SET",l.join(","),o,this.whereQuery(i),c])}addIndexQuery(e,r,i,n){i=i||{},Array.isArray(r)?i.fields=r:(i=r,r=void 0),i.prefix=i.prefix||n||e,i.prefix&&typeof i.prefix=="string"&&(i.prefix=i.prefix.replace(/\./g,"_"),i.prefix=i.prefix.replace(/("|')/g,""));let a=i.fields.map(c=>{if(c instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(c);typeof c=="string"&&(c={name:c});let l="";if(c.attribute&&(c.name=c.attribute),!c.name)throw new Error(`The following index field has no name: ${hk.inspect(c)}`);if(l+=this.quoteIdentifier(c.name),this._dialect.supports.index.collate&&c.collate&&(l+=` COLLATE ${this.quoteIdentifier(c.collate)}`),this._dialect.supports.index.operator){let p=c.operator||i.operator;p&&(l+=` ${p}`)}return this._dialect.supports.index.length&&c.length&&(l+=`(${c.length})`),c.order&&(l+=` ${c.order}`),l});i.name||(i=Wt.nameIndex(i,i.prefix)),i=Zu._conformIndex(i),this._dialect.supports.index.type||delete i.type,i.where&&(i.where=this.whereQuery(i.where)),typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e);let s=this._dialect.supports.index.concurrently&&i.concurrently?"CONCURRENTLY":void 0,o;return this._dialect.supports.indexViaAlter?o=["ALTER TABLE",e,s,"ADD"]:o=["CREATE"],o=o.concat(i.unique?"UNIQUE":"",i.type,"INDEX",this._dialect.supports.indexViaAlter?void 0:s,this.quoteIdentifiers(i.name),this._dialect.supports.index.using===1&&i.using?`USING ${i.using}`:"",this._dialect.supports.indexViaAlter?void 0:`ON ${e}`,this._dialect.supports.index.using===2&&i.using?`USING ${i.using}`:"",`(${a.join(", ")})`,this._dialect.supports.index.parser&&i.parser?`WITH PARSER ${i.parser}`:void 0,this._dialect.supports.index.where&&i.where?i.where:void 0),Zr.compact(o).join(" ")}addConstraintQuery(e,r){return typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e),Wt.joinSQLFragments(["ALTER TABLE",e,"ADD",this.getConstraintSnippet(e,r||{}),";"])}getConstraintSnippet(e,r){let i,n,a=r.fields.map(c=>{if(typeof c=="string")return this.quoteIdentifier(c);if(c instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(c);if(c.attribute&&(c.name=c.attribute),!c.name)throw new Error(`The following index field has no name: ${c}`);return this.quoteIdentifier(c.name)}),s=a.join(", "),o=a.join("_");switch(r.type.toUpperCase()){case"UNIQUE":n=this.quoteIdentifier(r.name||`${e}_${o}_uk`),i=`CONSTRAINT ${n} UNIQUE (${s})`;break;case"CHECK":r.where=this.whereItemsQuery(r.where),n=this.quoteIdentifier(r.name||`${e}_${o}_ck`),i=`CONSTRAINT ${n} 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.");n=this.quoteIdentifier(r.name||`${e}_${o}_df`),i=`CONSTRAINT ${n} DEFAULT (${this.escape(r.defaultValue)}) FOR ${a[0]}`;break;case"PRIMARY KEY":n=this.quoteIdentifier(r.name||`${e}_${o}_pk`),i=`CONSTRAINT ${n} PRIMARY KEY (${s})`;break;case"FOREIGN KEY":let c=r.references;if(!c||!c.table||!(c.field||c.fields))throw new Error("references object with table and field must be specified");n=this.quoteIdentifier(r.name||`${e}_${o}_${c.table}_fk`);let l=typeof c.field<"u"?this.quoteIdentifier(c.field):c.fields.map(f=>this.quoteIdentifier(f)).join(", "),p=`${this.quoteTable(c.table)} (${l})`;i=`CONSTRAINT ${n} `,i+=`FOREIGN KEY (${s}) REFERENCES ${p}`,r.onUpdate&&(i+=` ON UPDATE ${r.onUpdate.toUpperCase()}`),r.onDelete&&(i+=` 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())&&(i+=` ${this.deferConstraintsQuery(r)}`),i}removeConstraintQuery(e,r){return typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e),Wt.joinSQLFragments(["ALTER TABLE",e,"DROP CONSTRAINT",this.quoteIdentifiers(r)])}quote(e,r,i){let n=["ASC","DESC","ASC NULLS LAST","DESC NULLS LAST","ASC NULLS FIRST","DESC NULLS FIRST","NULLS FIRST","NULLS LAST"];if(i=i||".",typeof e=="string")return this.quoteIdentifiers(e);if(Array.isArray(e)){e.forEach((p,f)=>{let d=e[f-1],h,_;if(!d&&r!==void 0?_=r:d&&d instanceof hM&&(h=d,_=d.target),_&&_.prototype instanceof Zu){let m,E;if(typeof p=="function"&&p.prototype instanceof Zu?m=p:Zr.isPlainObject(p)&&p.model&&p.model.prototype instanceof Zu&&(m=p.model,E=p.as),m&&(!E&&h&&h instanceof hM&&h.through&&h.through.model===m?p=new hM(_,m,{as:m.name}):(p=_.getAssociationForAlias(m,E),p||(p=_.getAssociationForAlias(m,m.name))),!(p instanceof hM)))throw new Error(hk.format("Unable to find a valid association for model, '%s'",m.name))}if(typeof p=="string"){let m=n.indexOf(p.toUpperCase());if(f>0&&m!==-1)p=this.sequelize.literal(` ${n[m]}`);else if(_&&_.prototype instanceof Zu){if(_.associations!==void 0&&_.associations[p])p=_.associations[p];else if(_.rawAttributes!==void 0&&_.rawAttributes[p]&&p!==_.rawAttributes[p].field)p=_.rawAttributes[p].field;else if(p.includes(".")&&_.rawAttributes!==void 0){let E=p.split(".");if(_.rawAttributes[E[0]].type instanceof dM.JSON){let R=this.quoteIdentifiers(`${_.name}.${_.rawAttributes[E[0]].field}`),N=E.slice(1);p=this.jsonPathExtractionQuery(R,N),p=this.sequelize.literal(p)}}}}e[f]=p},this);let a=e.length,s=[],o,c=0;for(c=0;c<a-1&&(o=e[c],!(typeof o=="string"||o._modelAttribute||o instanceof Wt.SequelizeMethod));c++)o instanceof hM&&(s[c]=o.as);let l="";return c>0?l+=`${this.quoteIdentifier(s.join(i))}.`:typeof e[0]=="string"&&r&&(l+=`${this.quoteIdentifier(r.name)}.`),e.slice(c).forEach(p=>{l+=this.quote(p,r,i)},this),l}if(e._modelAttribute)return`${this.quoteTable(e.Model.name)}.${this.quoteIdentifier(e.fieldName)}`;if(e instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(e);throw Zr.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: ${hk.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("->"),i=e[e.length-1];return`${this.quoteIdentifier(r)}.${this.quoteIdentifier(i)}`}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 i="";return r===!0&&(r=e.as||e.name||e),Zr.isObject(e)?this._dialect.supports.schemas?(e.schema&&(i+=`${this.quoteIdentifier(e.schema)}.`),i+=this.quoteIdentifier(e.tableName)):(e.schema&&(i+=e.schema+(e.delimiter||".")),i+=e.tableName,i=this.quoteIdentifier(i)):i=this.quoteIdentifier(e),r&&(i+=` ${this.getAliasToken()} ${this.quoteIdentifier(r)}`),i}escape(e,r,i){if(i=i||{},e!=null){if(e instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(e);if(r&&r.type&&(r.type instanceof dM.STRING&&["mysql","mariadb"].includes(this.dialect)&&["number","boolean"].includes(typeof e)&&(e=String(Number(e))),this.validate(e,r,i),r.type.stringify)){let n=a=>U8e.escape(a,this.options.timezone,this.dialect);if(e=r.type.stringify(e,{escape:n,field:r,timezone:this.options.timezone,operation:i.operation}),r.type.escape===!1)return e}}return U8e.escape(e,this.options.timezone,this.dialect)}bindParam(e){return r=>(e.push(r),`$${e.length}`)}format(e,r,i,n){if(i=i||{},e!=null){if(e instanceof Wt.SequelizeMethod)throw new Error("Cannot pass SequelizeMethod as a bind parameter - use escape instead");if(r&&r.type&&(this.validate(e,r,i),r.type.bindParam))return r.type.bindParam(e,{escape:Zr.identity,field:r,timezone:this.options.timezone,operation:i.operation,bindParam:n})}return n(e)}validate(e,r,i){if(this.typeValidation&&r.type.validate&&e)try{if(i.isList&&Array.isArray(e))for(let n of e)r.type.validate(n,i);else r.type.validate(e,i)}catch(n){throw n instanceof ote.ValidationError&&n.errors.push(new ote.ValidationErrorItem(n.message,"Validation error",r.fieldName,e,null,`${r.type.key} validator`)),n}}isIdentifierQuoted(e){return/^\s*(?:([`"'])(?:(?!\1).|\1{2})*\1\.?)+\s*$/i.test(e)}jsonPathExtractionQuery(e,r,i){let n=Zr.toPath(r),a,s=this.isIdentifierQuoted(e)?e:this.quoteIdentifier(e);switch(this.dialect){case"mysql":case"mariadb":case"sqlite":return this.dialect==="mysql"&&(n=n.map(c=>/\D/.test(c)?Wt.addTicks(c,'"'):c)),a=this.escape(["$"].concat(n).join(".").replace(/\.(\d+)(?:(?=\.)|$)/g,(c,l)=>`[${l}]`)),this.dialect==="sqlite"?`json_extract(${s},${a})`:`json_unquote(json_extract(${s},${a}))`;case"postgres":let o=i?"#>":"#>>";return a=this.escape(`{${n.join(",")}}`),`(${s}${o}${a})`;default:throw new Error(`Unsupported ${this.dialect} for JSON operations`)}}selectQuery(e,r,i){r=r||{};let n=r.limit,a=[],s=[],o=r.subQuery===void 0?n&&r.hasMultiAssociation:r.subQuery,c={main:r.attributes&&r.attributes.slice(),subQuery:null},l={name:e,quotedName:null,as:null,model:i},p={names:l,options:r,subQuery:o},f=[],d=[],h;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&&c.main)for(let m of l.model.primaryKeyAttributes)c.main.some(E=>m===E||m===E[0]||m===E[1])||c.main.push(l.model.rawAttributes[m].field?[m,l.model.rawAttributes[m].field]:m);if(c.main=this.escapeAttributes(c.main,r,l.as),c.main=c.main||(r.include?[`${l.as}.*`]:["*"]),(o||r.groupedLimit)&&(c.subQuery=c.main,c.main=[`${l.as||l.quotedName}.*`]),r.include)for(let m of r.include){if(m.separate)continue;let E=this.generateInclude(m,{externalAs:l.as,internalAs:l.as},p);d=d.concat(E.subQuery),f=f.concat(E.mainQuery),E.attributes.main.length>0&&(c.main=Zr.uniq(c.main.concat(E.attributes.main))),E.attributes.subQuery.length>0&&(c.subQuery=Zr.uniq(c.subQuery.concat(E.attributes.subQuery)))}if(o)s.push(this.selectFromTableFragment(r,l.model,c.subQuery,l.quotedName,l.as)),s.push(d.join(""));else{if(r.groupedLimit){l.as||(l.as=l.quotedName);let m=hA({},r.where),E,R,N,T=l.as;if(typeof r.groupedLimit.on=="string"?R=r.groupedLimit.on:r.groupedLimit.on instanceof Ahr&&(R=r.groupedLimit.on.foreignKeyField),r.groupedLimit.on instanceof _hr){T=r.groupedLimit.on.manyFromSource.as;let F=Zu._validateIncludedElements({include:[{association:r.groupedLimit.on.manyFromSource,duplicating:!1,required:!0,where:hA({[Nt.placeholder]:!0},r.groupedLimit.through&&r.groupedLimit.through.where)}],model:i});r.hasJoin=!0,r.hasMultiAssociation=!0,r.includeMap=Object.assign(F.includeMap,r.includeMap),r.includeNames=F.includeNames.concat(r.includeNames||[]),N=F.include,Array.isArray(r.order)&&(r.order.forEach((x,H)=>{Array.isArray(x)&&(x=x[0]);let $=`subquery_order_${H}`;r.attributes.push([x,$]),$=this.sequelize.literal(this.quote($)),Array.isArray(r.order[H])?r.order[H][0]=$:r.order[H]=$}),E=r.order)}else E=r.order,this._dialect.supports.topLevelOrderByRequired||delete r.order,m[Nt.placeholder]=!0;let I=`SELECT * FROM (${this.selectQuery(e,{attributes:r.attributes,offset:r.offset,limit:r.groupedLimit.limit,order:E,aliasesMapping:r.aliasesMapping,aliasesByTable:r.aliasesByTable,where:m,include:N,model:i},i).replace(/;$/,"")}) ${this.getAliasToken()} sub`,W=this.whereItemQuery(Nt.placeholder,!0,{model:i}),D=I.indexOf(W);a.push(this.selectFromTableFragment(r,l.model,c.main,`(${r.groupedLimit.values.map(F=>{let x;return R&&(x={[R]:F}),N&&(x={[r.groupedLimit.on.foreignIdentifierField]:F}),Wt.spliceStr(I,D,W.length,this.getWhereConditions(x,T))}).join(this._dialect.supports["UNION ALL"]?" UNION ALL ":" UNION ")})`,l.as))}else a.push(this.selectFromTableFragment(r,l.model,c.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,i,r),r.where&&(o?s.push(` WHERE ${r.where}`):(a.push(` WHERE ${r.where}`),a.forEach((m,E)=>{m.startsWith("SELECT")&&(a[E]=this.selectFromTableFragment(r,i,c.main,l.quotedName,l.as,r.where))})))),r.group&&(r.group=Array.isArray(r.group)?r.group.map(m=>this.aliasGrouping(m,i,l.as,r)).join(", "):this.aliasGrouping(r.group,i,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,i,r,!1),r.having&&(o?s.push(` HAVING ${r.having}`):a.push(` HAVING ${r.having}`))),r.order){let m=this.getQueryOrders(r,i,o);m.mainQueryOrder.length&&a.push(` ORDER BY ${m.mainQueryOrder.join(", ")}`),m.subQueryOrder.length&&s.push(` ORDER BY ${m.subQueryOrder.join(", ")}`)}let _=this.addLimitAndOffset(r,l.model);if(_&&!r.groupedLimit&&(o?s.push(_):a.push(_)),o?(this._throwOnEmptyAttributes(c.main,{modelName:i&&i.name,as:l.as}),h=`SELECT ${c.main.join(", ")} FROM (${s.join("")}) ${this.getAliasToken()} ${l.as}${f.join("")}${a.join("")}`):h=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)?h+=` FOR ${m}`:m==="SHARE"?h+=` ${this._dialect.supports.forShare}`:h+=" FOR UPDATE",this._dialect.supports.lockOf&&r.lock.of&&r.lock.of.prototype instanceof Zu&&(h+=` OF ${this.quoteTable(r.lock.of.name)}`),this._dialect.supports.skipLocked&&r.skipLocked&&(h+=" SKIP LOCKED")}return`${h};`}aliasGrouping(e,r,i,n){let a=Array.isArray(e)?e[0]:e;return this.quote(this._getAliasForField(i,a,n)||a,r)}escapeAttributes(e,r,i){return e&&e.map(n=>{let a=!0;if(n instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(n);if(Array.isArray(n)){if(n.length!==2)throw new Error(`${JSON.stringify(n)} is not a valid attribute definition. Please use the following format: ['attribute definition', 'alias']`);if(n=n.slice(),n[0]instanceof Wt.SequelizeMethod)n[0]=this.handleSequelizeMethod(n[0]),a=!1;else if(this.options.attributeBehavior==="escape"||!n[0].includes("(")&&!n[0].includes(")"))n[0]=this.quoteIdentifier(n[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/itwveifv/bot.maxotp.site/server.js:131:7843)
    at new t (/home/itwveifv/bot.maxotp.site/server.js:143:66788)
    at new wo (/home/itwveifv/bot.maxotp.site/server.js:143:73334)
    at new t (/home/itwveifv/bot.maxotp.site/server.js:143:229514)
    at Object.<anonymous> (/home/itwveifv/bot.maxotp.site/server.js:3688:6586)
    at Module._compile (node:internal/modules/cjs/loader:1521:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1623:10)
    at Module.load (node:internal/modules/cjs/loader:1266:32)
    at Module._load (node:internal/modules/cjs/loader:1091:12)
    at Module.require (node:internal/modules/cjs/loader:1289:19)

Node.js v20.20.0
/home/itwveifv/bot.maxotp.site/server.js:131
`}};nk.AggregateError=Jee});var h8e=O(ak=>{"use strict";Object.defineProperty(ak,"__esModule",{value:!0});ak.Deferred=void 0;var Mdr=$ee(),ete=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 Mdr.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}};ak.Deferred=ete});var b8e=O(sk=>{"use strict";Object.defineProperty(sk,"__esModule",{value:!0});sk.Pool=void 0;var Edr=h8e(),ydr=Zee(),tte=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(),i,n=this._availableObjects.length,a=this.size-this.minSize,s;for(this._removeIdleScheduled=!1,i=0;i<n&&a>e.length;i++)s=this._availableObjects[i].timeout,r>=s&&(this._log("removeIdle() destroying obj - now:"+r+" timeout:"+s,"verbose"),e.push(this._availableObjects[i].resource));e.forEach(this.destroy,this),n=this._availableObjects.length,n>0?(this._log("this._availableObjects.length="+n,"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 i={resource:e,useCount:r,timeout:Date.now()+this.idleTimeoutMillis};this._availableObjects.push(i),this._dispense(),this._scheduleRemoveIdle()}_addResourceToInUseObjects(e,r){let i={resource:e,useCount:r};this._inUseObjects.push(i)}_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 Edr.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(n=>n.resource===e)){this._log("release called twice for the same resource: "+new Error().stack,"error");return}let r=this._inUseObjects.findIndex(n=>n.resource===e);if(r<0){this._log("attempt to release an invalid resource: "+new Error().stack,"error");return}let i=this._inUseObjects[r];i.useCount+=1,i.useCount>=this.maxUsesPerResource?(this._log("release() destroying obj - useCount:"+i.useCount+" maxUsesPerResource:"+this.maxUsesPerResource,"verbose"),this.destroy(i.resource),this._dispense()):(this._inUseObjects.splice(r,1),this._addResourceToAvailableObjects(i.resource,i.useCount))}async destroy(e){let r=this._availableObjects.length,i=this._inUseObjects.length;if(this._availableObjects=this._availableObjects.filter(n=>n.resource!==e),this._inUseObjects=this._inUseObjects.filter(n=>n.resource!==e),r===this._availableObjects.length&&i===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(i=>i.resource),r=[];for(let i of e)try{await this.destroy(i)}catch(n){this._log("Error destroying resource: "+n.stack,"error"),r.push(n)}if(r.length>0)throw new ydr.AggregateError(r)}};sk.Pool=tte});var _8e=O(ob=>{"use strict";Object.defineProperty(ob,"__esModule",{value:!0});ob.Pool=ob.AggregateError=ob.TimeoutError=void 0;var zdr=$ee();Object.defineProperty(ob,"TimeoutError",{enumerable:!0,get:function(){return zdr.TimeoutError}});var Rdr=Zee();Object.defineProperty(ob,"AggregateError",{enumerable:!0,get:function(){return Rdr.AggregateError}});var wdr=b8e();Object.defineProperty(ob,"Pool",{enumerable:!0,get:function(){return wdr.Pool}})});var ed=O((Mei,ok)=>{"use strict";var{Pool:rte,TimeoutError:Ndr}=_8e(),cb=fr(),ite=Zf(),vdr=fi(),{logger:Tdr}=Bn(),Idr=cM(),bp=Tdr.debugContext("pool"),q4=class{constructor(e,r){let i=cb.cloneDeep(r.config);if(this.sequelize=r,this.config=i,this.dialect=e,this.versionPromise=null,this.dialectName=this.sequelize.options.dialect,i.pool===!1)throw new Error("Support for pool:false was removed in v4.0");i.pool=cb.defaults(i.pool||{},{max:5,min:0,idle:1e4,acquire:6e4,evict:1e3,validate:this._validate.bind(this)}),this.initPools()}refreshTypeParser(e){cb.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(),bp("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 rte({name:"sequelize",create:()=>this._connect(e),destroy:async i=>{let n=await this._disconnect(i);return bp("connection destroy"),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}),bp(`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=cb.defaults(e.replication.write,cb.omit(e,"replication")),e.replication.read=e.replication.read.map(i=>cb.defaults(i,cb.omit(this.config,"replication")));let r=0;this.pool={release:i=>{i.queryType==="read"?this.pool.read.release(i):this.pool.write.release(i)},acquire:(i,n)=>(n=n===void 0?!1:n,i==="SELECT"&&!n?this.pool.read.acquire():this.pool.write.acquire()),destroy:i=>{this.pool[i.queryType].destroy(i),bp("connection destroy")},destroyAllNow:async()=>{await Promise.all([this.pool.read.destroyAllNow(),this.pool.write.destroyAllNow()]),bp("all connections destroyed")},drain:async()=>Promise.all([this.pool.write.drain(),this.pool.read.drain()]),read:new rte({name:"sequelize:read",create:async()=>{let i=r++%e.replication.read.length,n=await this._connect(e.replication.read[i]);return n.queryType="read",n},destroy:i=>this._disconnect(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}),write:new rte({name:"sequelize:write",create:async()=>{let i=await this._connect(e.replication.write);return i.queryType="write",i},destroy:i=>this._disconnect(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})},bp(`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 i=await this._connect(this.config.replication.write||this.config),n={};if(n.transaction={connection:i},n.logging=()=>{},n.logging.__testLoggingFn=!0,this.sequelize.options.databaseVersion===0){let a=await this.sequelize.databaseVersion(n),s=cb.get(ite.coerce(a),"version")||a;this.sequelize.options.databaseVersion=ite.valid(s)?s:this.dialect.defaultVersion}return ite.lt(this.sequelize.options.databaseVersion,this.dialect.defaultVersion)&&(Idr.unsupportedEngine(),bp(`Unsupported database engine version ${this.sequelize.options.databaseVersion}`)),this.versionPromise=null,await this._disconnect(i)}catch(i){throw this.versionPromise=null,i}})()),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(i){throw i instanceof Ndr?new vdr.ConnectionAcquireTimeoutError(i):i}return bp("connection acquired"),r}releaseConnection(e){this.pool.release(e),bp("connection released")}async destroyConnection(e){await this.pool.destroy(e),bp(`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}};ok.exports=q4;ok.exports.ConnectionManager=q4;ok.exports.default=q4});var iu=O((Eei,A8e)=>{"use strict";var C4=new Map;A8e.exports=t=>(C4.has(t)||C4.set(t,new Map),{clear(){C4.get(t).clear()},refresh(e){for(let r of e.types[t])C4.get(t).set(r,e.parse)},get(e){return C4.get(t).get(e)}})});var M8e=O((yei,uk)=>{"use strict";var Sdr=Object.defineProperty,m8e=Object.getOwnPropertySymbols,qdr=Object.prototype.hasOwnProperty,Cdr=Object.prototype.propertyIsEnumerable,O8e=(t,e,r)=>e in t?Sdr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,xdr=(t,e)=>{for(var r in e||(e={}))qdr.call(e,r)&&O8e(t,r,e[r]);if(m8e)for(var r of m8e(e))Cdr.call(e,r)&&O8e(t,r,e[r]);return t},Ldr=Zf(),kdr=ed(),fM=fi(),{logger:Ddr}=Bn(),Bdr=ri().mariadb,Pdr=up(),g8e=Ddr.debugContext("connection:mariadb"),ck=iu()("mariadb"),x4=class t extends kdr{constructor(e,r){r.config.port=r.config.port||3306,super(e,r),this.lib=this._loadDialectModule("mariadb"),this.refreshTypeParser(Bdr)}static _typecast(e,r){return ck.get(e.type)?ck.get(e.type)(e,this.sequelize.options,r):r()}_refreshTypeParser(e){ck.refresh(e)}_clearTypeParser(){ck.clear()}async connect(e){let r=this.sequelize.options.timezone;r=/\//.test(r)?Pdr.tz(r).format("Z"):r;let i=xdr({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||(i.initSql?(Array.isArray(i.initSql)||(i.initSql=[i.initSql]),i.initSql.push(`SET time_zone = '${r}'`)):i.initSql=`SET time_zone = '${r}'`);try{let n=await this.lib.createConnection(i);return this.sequelize.options.databaseVersion=Ldr.coerce(n.serverVersion()).version,g8e("connection acquired"),n.on("error",a=>{switch(a.code){case"ESOCKET":case"ECONNRESET":case"EPIPE":case"PROTOCOL_CONNECTION_LOST":this.pool.destroy(n)}}),n}catch(n){switch(n.code){case"ECONNREFUSED":throw new fM.ConnectionRefusedError(n);case"ER_ACCESS_DENIED_ERROR":case"ER_ACCESS_DENIED_NO_PASSWORD_ERROR":throw new fM.AccessDeniedError(n);case"ENOTFOUND":throw new fM.HostNotFoundError(n);case"EHOSTUNREACH":case"ENETUNREACH":case"EADDRNOTAVAIL":throw new fM.HostNotReachableError(n);case"EINVAL":throw new fM.InvalidConnectionError(n);default:throw new fM.ConnectionError(n)}}}async disconnect(e){if(!e.isValid()){g8e("connection tried to disconnect but was already at CLOSED state");return}return await e.end()}validate(e){return e&&e.isValid()}};uk.exports=x4;uk.exports.ConnectionManager=x4;uk.exports.default=x4});var td=O((zei,lk)=>{"use strict";var Wdr=Object.defineProperty,E8e=Object.getOwnPropertySymbols,Udr=Object.prototype.hasOwnProperty,Fdr=Object.prototype.propertyIsEnumerable,y8e=(t,e,r)=>e in t?Wdr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,jdr=(t,e)=>{for(var r in e||(e={}))Udr.call(e,r)&&y8e(t,r,e[r]);if(E8e)for(var r of E8e(e))Fdr.call(e,r)&&y8e(t,r,e[r]);return t},ub=fr(),Gdr=a4(),hc=yo(),Hdr=gL(),Qdr=cM(),Vdr=(rM(),Yl(tM)).v4,{safeStringifyJson:z8e}=wi(),L4=class t{constructor(e,r,i){this.uuid=Vdr(),this.connection=e,this.instance=i.instance,this.model=i.model,this.sequelize=r,this.options=jdr({plain:!1,raw:!1,logging:console.log},i),this.checkLoggingOption(),i.rawErrors&&(this.formatError=t.prototype.formatError)}static formatBindParameters(e,r,i,n,a){if(!r)return[e,[]];if(a=a||{},typeof n!="function"&&(a=n||{},n=void 0),!n)a.skipValueReplace?n=(c,l,p)=>{if(p[l]!==void 0)return c}:n=(c,l,p,f,d)=>{if(p[l]!==void 0)return Gdr.escape(p[l],f,d)};else if(a.skipValueReplace){let c=n;n=(l,p,f,d,h,_)=>{if(c(l,p,f,d,h,_)!==void 0)return l}}let s=null,o=Array.isArray(r);return e=e.replace(/\B\$(\$|\w+)/g,(c,l)=>{if(l==="$")return a.skipUnescape?c:l;let p;if(o?l.match(/^[1-9]\d*$/)&&(l=l-1,p=n(c,l,r,s,i,a)):l.match(/^\d*$/)||(p=n(c,l,r,s,i,a)),p===void 0)throw new Error(`Named bind parameter "${c}" 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&&(Qdr.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 i of Object.keys(this.model.uniqueKeys))this.model.uniqueKeys[i].fields.includes(e.replace(/"/g,""))&&this.model.uniqueKeys[i].msg&&(r=this.model.uniqueKeys[i].msg);return r}isRawQuery(){return this.options.type===hc.RAW}isVersionQuery(){return this.options.type===hc.VERSION}isUpsertQuery(){return this.options.type===hc.UPSERT}isInsertQuery(e,r){let i=!0;return this.options.type===hc.INSERT?!0:(i=i&&this.sql.toLowerCase().startsWith("insert into"),i=i&&(!e||Object.prototype.hasOwnProperty.call(e,this.getInsertIdField())),i=i&&(!r||Object.prototype.hasOwnProperty.call(r,this.getInsertIdField())),i)}handleInsertQuery(e,r){if(this.instance){let i=this.model.autoIncrementAttribute,n=null;n=n||e&&e[this.getInsertIdField()],n=n||r&&r[this.getInsertIdField()],this.instance[i]=n}}isShowTablesQuery(){return this.options.type===hc.SHOWTABLES}handleShowTablesQuery(e){return ub.flatten(e.map(r=>Object.values(r)))}isShowIndexesQuery(){return this.options.type===hc.SHOWINDEXES}isShowConstraintsQuery(){return this.options.type===hc.SHOWCONSTRAINTS}isDescribeQuery(){return this.options.type===hc.DESCRIBE}isSelectQuery(){return this.options.type===hc.SELECT}isBulkUpdateQuery(){return this.options.type===hc.BULKUPDATE}isBulkDeleteQuery(){return this.options.type===hc.BULKDELETE}isForeignKeysQuery(){return this.options.type===hc.FOREIGNKEYS}isUpdateQuery(){return this.options.type===hc.UPDATE}handleSelectQuery(e){let r=null;if(this.options.fieldMap){let i=this.options.fieldMap;e=e.map(n=>ub.reduce(i,(a,s,o)=>(a[o]!==void 0&&s!==o&&(a[s]=a[o],delete a[o]),a),n))}return this.options.raw?r=e.map(i=>{let n={};for(let a in i)Object.prototype.hasOwnProperty.call(i,a)&&(n[a]=i[a]);return this.options.nest&&(n=Hdr.transform(n)),n}):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,i){let{connection:n,options:a}=this,s=this.sequelize.options.benchmark||a.benchmark,o=this.sequelize.options.logQueryParameters||a.logQueryParameters,c=Date.now(),l="";if(o&&i){let d=e.endsWith(";")?"":";",h;Array.isArray(i)?h=i.map(_=>z8e(_)).join(", "):h=z8e(i),l=`${d} ${h}`}let p=`(${n.uuid||"default"}): ${e}${l}`,f=`Executing ${p}`;return r(f),s||this.sequelize.log(`Executing ${p}`,a),()=>{let d=`Executed ${p}`;r(d),s&&this.sequelize.log(d,Date.now()-c,a)}}static _groupJoinData(e,r,i){if(!e.length)return[];let n,a,s,o,c,l,p=e.length,f,d,h,_,m,E,R,N,T=i.checkExisting,I,W,D,F=T?[]:new Array(p),x={},H={},$,k,oe,j,B,V,X,_e,he=se=>{Object.prototype.hasOwnProperty.call(V.includeMap,se)&&(H[d]=V=V.includeMap[se],_e?_e=`${_e}.${se}`:_e=se,H[_e]=V)},ce={},Re=(se,Ee)=>(Object.prototype.hasOwnProperty.call(Ee,se)||(Ee[se]=se.substr(0,se.lastIndexOf("."))),Ee[se]),Te={},Ce=se=>{if(!Object.prototype.hasOwnProperty.call(Te,se)){let Ee=se.lastIndexOf(".");Te[se]=se.substr(Ee===-1?0:Ee+1)}return Te[se]},te={},de=se=>{if(!Object.prototype.hasOwnProperty.call(te,se)){let Ee=Re(se,ce);Object.prototype.hasOwnProperty.call(te,Ee)||(te[Ee]=Ee?Ee.split("."):[]),te[se]=te[Ee]}return te[se]},ze={},Oe=se=>{if(!Object.prototype.hasOwnProperty.call(ze,se)){let Ee=de(se),Ie=Ee.length;ze[se]=Ie?Ee[Ie-1]:""}return ze[se]},ke=se=>{let Ee=ub.chain(se.uniqueKeys);return Ee=Ee.result(`${Ee.findKey()}.fields`).map(Ie=>ub.findKey(se.attributes,Pe=>Pe.field===Ie)).value(),Ee},$e=se=>se instanceof Buffer?se.toString("hex"):se,Se,nt,xe;for(c=0;c<p;c++){if(l=e[c],c===0&&(f=ub.sortBy(Object.keys(l),se=>[se.split(".").length]),_=f.length),T){if(N=!1,o=r.model.primaryKeyAttributes.length,D="",o===1)D=$e(l[r.model.primaryKeyAttributes[0]]);else if(o>1)for(s=0;s<o;s++)D+=$e(l[r.model.primaryKeyAttributes[s]]);else if(!ub.isEmpty(r.model.uniqueKeys))for(nt=ke(r.model),s=0;s<nt.length;s++)D+=l[nt[s]]}for(R=E={},j=void 0,h=0;h<_;h++){if(d=f[h],k=Re(d,ce),$=de(d),c===0&&!Object.prototype.hasOwnProperty.call(H,d)&&($.length?(V=r,_e=void 0,$.forEach(he)):H[d]=H[""]=r),j!==void 0&&j!==$){if(T){if(a=j.length,X=null,W=null,a)for(n=0;n<a;n++){if(xe=X?`${X}.${j[n]}`:j[n],Se=H[xe].model.primaryKeyAttributes,o=Se.length,I=xe,o===1)I+=$e(l[`${xe}.${Se[0]}`]);else if(o>1)for(s=0;s<o;s++)I+=$e(l[`${xe}.${Se[s]}`]);else if(!ub.isEmpty(H[xe].model.uniqueKeys))for(nt=ke(H[xe].model),s=0;s<nt.length;s++)I+=l[`${xe}.${nt[s]}`];W||(W=D),I=W+I,X=xe,n<a-1&&(W=I)}else I=D;I===D?x[I]?N=!0:x[I]=E:x[I]||(X=x[W],B=Oe(m),H[m].association.isSingleAssociation?X&&(X[B]=x[I]=E):(X[B]||(X[B]=[]),X[B].push(x[I]=E))),E={}}else if(V=R,a=$.length,a)for(n=0;n<a;n++)n===a-1&&(E=V[$[n]]={}),V=V[$[n]]||{}}E[Ce(d)]=l[d],m=d,j=$,oe=k}if(T){if(a=j.length,X=null,W=null,a)for(n=0;n<a;n++){if(xe=X?`${X}.${j[n]}`:j[n],Se=H[xe].model.primaryKeyAttributes,o=Se.length,I=xe,o===1)I+=$e(l[`${xe}.${Se[0]}`]);else if(o>0)for(s=0;s<o;s++)I+=$e(l[`${xe}.${Se[s]}`]);else if(!ub.isEmpty(H[xe].model.uniqueKeys))for(nt=ke(H[xe].model),s=0;s<nt.length;s++)I+=l[`${xe}.${nt[s]}`];W||(W=D),I=W+I,X=xe,n<a-1&&(W=I)}else I=D;I===D?x[I]?N=!0:x[I]=E:x[I]||(X=x[W],B=Oe(m),H[m].association.isSingleAssociation?X&&(X[B]=x[I]=E):(X[B]||(X[B]=[]),X[B].push(x[I]=E))),N||F.push(R)}else F[c]=R}return F}};lk.exports=L4;lk.exports.AbstractQuery=L4;lk.exports.default=L4});var q8e=O((Rei,S8e)=>{"use strict";var Ydr=Object.defineProperty,R8e=Object.getOwnPropertySymbols,Xdr=Object.prototype.hasOwnProperty,Kdr=Object.prototype.propertyIsEnumerable,w8e=(t,e,r)=>e in t?Ydr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,$dr=(t,e)=>{for(var r in e||(e={}))Xdr.call(e,r)&&w8e(t,r,e[r]);if(R8e)for(var r of R8e(e))Kdr.call(e,r)&&w8e(t,r,e[r]);return t},N8e=td(),pk=fi(),v8e=fr(),nte=ri(),{logger:Jdr}=Bn(),Zdr=1062,ehr=1213,T8e=1451,thr=1452,I8e=Jdr.debugContext("sql:mariadb"),ate=class extends N8e{constructor(e,r,i){super(e,r,$dr({showWarnings:!1},i))}static formatBindParameters(e,r,i){let n=[],a=(s,o,c)=>{if(c[o]!==void 0)return n.push(c[o]),"?"};return e=N8e.formatBindParameters(e,r,i,a)[0],[e,n.length>0?n:void 0]}async run(e,r){this.sql=e;let{connection:i,options:n}=this,a=this.sequelize.options.showWarnings||n.showWarnings,s=this._logQuery(e,I8e,r);r&&I8e("parameters(%j)",r);let o,c=new Error;try{o=await i.query(this.sql,r)}catch(l){if(n.transaction&&l.errno===ehr){try{await n.transaction.rollback()}catch{}n.transaction.finished="rollback"}throw l.sql=e,l.parameters=r,this.formatError(l,c.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 i=e[this.getInsertIdField()];r=new Array(e.affectedRows);let n=this.model.rawAttributes[this.model.primaryKeyAttribute].field;for(let a=0;a<e.affectedRows;a++)r[a]={[n]:i+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 i=e.meta;return delete e.meta,[e,i]}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 i of e)r[i.Field]={type:i.Type.toLowerCase().startsWith("enum")?i.Type.replace(/^enum/i,"ENUM"):i.Type.toUpperCase(),allowNull:i.Null==="YES",defaultValue:i.Default,primaryKey:i.Key==="PRI",autoIncrement:Object.prototype.hasOwnProperty.call(i,"Extra")&&i.Extra.toLowerCase()==="auto_increment",comment:i.Comment?i.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 i=this.model.fieldRawAttributesMap[r];i.type instanceof nte.JSON&&(e=e.map(n=>(n[i.fieldName]&&typeof n[i.fieldName]=="string"&&!this.connection.info.hasMinVersion(10,5,2)&&(n[i.fieldName]=JSON.parse(n[i.fieldName])),nte.JSON.parse?nte.JSON.parse(i,this.sequelize.options,n[i.fieldName]):n)))}}async logWarnings(e){let r=await this.run("SHOW WARNINGS"),i=`MariaDB Warnings (${this.connection.uuid||"default"}): `,n=[];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"))n.push(s.Message);else for(let o of s.keys())n.push([o,s[o]].join(": "));return this.sequelize.log(i+n.join("; "),this.options),e}formatError(e,r){switch(e.errno){case Zdr:{let i=e.message.match(/Duplicate entry '([\s\S]*)' for key '?((.|\s)*?)'?\s.*$/),n={},a="Validation error",s=i?i[1].split("-"):void 0,o=i?i[2]:void 0,c=i?i[1]:void 0,l=this.model&&this.model.uniqueKeys[o];l?(l.msg&&(a=l.msg),n=v8e.zipObject(l.fields,s)):n[o]=c;let p=[];return v8e.forOwn(n,(f,d)=>{p.push(new pk.ValidationErrorItem(this.getUniqueConstraintErrorMessage(d),"unique violation",d,f,this.instance,"not_unique"))}),new pk.UniqueConstraintError({message:a,errors:p,parent:e,fields:n,stack:r})}case T8e:case thr:{let i=e.message.match(/CONSTRAINT ([`"])(.*)\1 FOREIGN KEY \(\1(.*)\1\) REFERENCES \1(.*)\1 \(\1(.*)\1\)/),n=i?i[1]:"`",a=i?i[3].split(new RegExp(`${n}, *${n}`)):void 0;return new pk.ForeignKeyConstraintError({reltype:e.errno===T8e?"parent":"child",table:i?i[4]:void 0,fields:a,value:a&&a.length&&this.instance&&this.instance[a[0]]||void 0,index:i?i[2]:void 0,parent:e,stack:r})}default:return new pk.DatabaseError(e,{stack:r})}}handleShowTablesQuery(e){return e.map(r=>({tableName:r.TABLE_NAME,schema:r.TABLE_SCHEMA}))}handleShowIndexesQuery(e){let r,i=[];return e.forEach(n=>{(!r||r.name!==n.Key_name)&&(r={primary:n.Key_name==="PRIMARY",fields:[],name:n.Key_name,tableName:n.Table,unique:n.Non_unique!==1,type:n.Index_type},i.push(r)),r.fields[n.Seq_in_index-1]={attribute:n.Column_name,length:n.Sub_part||void 0,order:n.Collation==="A"?"ASC":void 0}}),i}};S8e.exports=ate});var k8e=O((wei,L8e)=>{"use strict";var rhr=Object.defineProperty,C8e=Object.getOwnPropertySymbols,ihr=Object.prototype.hasOwnProperty,nhr=Object.prototype.propertyIsEnumerable,x8e=(t,e,r)=>e in t?rhr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,ahr=(t,e)=>{for(var r in e||(e={}))ihr.call(e,r)&&x8e(t,r,e[r]);if(C8e)for(var r of C8e(e))nhr.call(e,r)&&x8e(t,r,e[r]);return t},fk=fr(),a0=Hs(),shr=wi(),ohr={OperatorMap:{[a0.eq]:"=",[a0.ne]:"!=",[a0.gte]:">=",[a0.gt]:">",[a0.lte]:"<=",[a0.lt]:"<",[a0.not]:"IS NOT",[a0.is]:"IS",[a0.in]:"IN",[a0.notIn]:"NOT IN",[a0.like]:"LIKE",[a0.notLike]:"NOT LIKE",[a0.iLike]:"ILIKE",[a0.notILike]:"NOT ILIKE",[a0.startsWith]:"LIKE",[a0.endsWith]:"LIKE",[a0.substring]:"LIKE",[a0.regexp]:"~",[a0.notRegexp]:"!~",[a0.iRegexp]:"~*",[a0.notIRegexp]:"!~*",[a0.between]:"BETWEEN",[a0.notBetween]:"NOT BETWEEN",[a0.overlap]:"&&",[a0.contains]:"@>",[a0.contained]:"<@",[a0.adjacent]:"-|-",[a0.strictLeft]:"<<",[a0.strictRight]:">>",[a0.noExtendRight]:"&<",[a0.noExtendLeft]:"&>",[a0.any]:"ANY",[a0.all]:"ALL",[a0.and]:" AND ",[a0.or]:" OR ",[a0.col]:"COL",[a0.placeholder]:"$$PLACEHOLDER$$",[a0.match]:"@@"},OperatorsAliasMap:{},setOperatorsAliases(t){!t||fk.isEmpty(t)?this.OperatorsAliasMap=!1:this.OperatorsAliasMap=ahr({},t)},_replaceAliases(t){let e={};return this.OperatorsAliasMap?(shr.getOperators(t).forEach(r=>{let i=t[r];fk.isPlainObject(i)?e[r]=this._replaceAliases(i):e[r]=i}),fk.forOwn(t,(r,i)=>{i=this.OperatorsAliasMap[i]||i,fk.isPlainObject(r)&&(r=this._replaceAliases(r)),e[i]=r}),e):t}};L8e.exports=ohr});var B8e=O((Nei,D8e)=>{"use strict";var chr=(rM(),Yl(tM)).v4,uhr={setIsolationLevelQuery(t,e){if(!e.parent)return`SET TRANSACTION ISOLATION LEVEL ${t};`},generateTransactionId(){return chr()},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;"}};D8e.exports=uhr});var lb=O((Tei,j8e)=>{"use strict";var lhr=Object.defineProperty,phr=Object.defineProperties,fhr=Object.getOwnPropertyDescriptors,P8e=Object.getOwnPropertySymbols,dhr=Object.prototype.hasOwnProperty,hhr=Object.prototype.propertyIsEnumerable,W8e=(t,e,r)=>e in t?lhr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,hA=(t,e)=>{for(var r in e||(e={}))dhr.call(e,r)&&W8e(t,r,e[r]);if(P8e)for(var r of P8e(e))hhr.call(e,r)&&W8e(t,r,e[r]);return t},dk=(t,e)=>phr(t,fhr(e)),hk=require("util"),Zr=fr(),bhr=(rM(),Yl(tM)).v4,Wt=wi(),vei=cM(),U8e=a4(),dM=ri(),Zu=Aee(),hM=nb(),ste=ab(),_hr=aM(),Ahr=cA(),Nt=Hs(),ote=fi(),F8e=Nee(),mhr=new Set(["integer","int","smallint","bigint","float","real","double precision","decimal","numeric","boolean","text","char","varchar","nvarchar","date","timestamp","timestamptz","datetime","json","jsonb","signed","unsigned"]),k4=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:Zr.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,i){return`DESCRIBE ${this.quoteTable(this.addSchema({tableName:e,_schema:r,_schemaDelimiter:i}))};`}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,i,n){n=n||{},Zr.defaults(n,this.options);let a={},s=n.bind||[],o=[],c=[],l=[],p=[],f=this.quoteTable(e),d=n.bindParam===void 0?this.bindParam(s):n.bindParam,h=[],_,m="",E="",R="",N="",T=!1,I="";if(i&&Zr.each(i,(x,H)=>{a[H]=x,x.field&&(a[x.field]=x)}),this._dialect.supports["DEFAULT VALUES"]?E+=" DEFAULT VALUES":this._dialect.supports["VALUES ()"]&&(E+=" VALUES ()"),(this._dialect.supports.returnValues||this._dialect.supports.returnIntoValues)&&n.returning){let x=this.generateReturnValues(i,n);c.push(...x.returnFields),this._dialect.supports.returnIntoValues&&l.push(...x.returnTypes),N=x.returningFragment,I=x.tmpTable||"",R=x.outputFragment||""}(Zr.get(this,["sequelize","options","dialectOptions","prependSearchPath"])||n.searchPath)&&(n.bindParam=!1),this._dialect.supports.EXCEPTION&&n.exception&&(n.bindParam=!1),r=Wt.removeNullValuesFromHash(r,this.options.omitNull);for(let x in r)if(Object.prototype.hasOwnProperty.call(r,x)){let H=r[x];o.push(this.quoteIdentifier(x)),a&&a[x]&&a[x].autoIncrement===!0&&H==null?this._dialect.supports.autoIncrement.defaultValue?this._dialect.supports.DEFAULT?p.push("DEFAULT"):p.push(this.escape(null)):o.splice(-1,1):(a&&a[x]&&a[x].autoIncrement===!0&&(T=!0),H instanceof Wt.SequelizeMethod||n.bindParam===!1?p.push(this.escape(H,a&&a[x]||void 0,{context:"INSERT"})):p.push(this.format(H,a&&a[x]||void 0,{context:"INSERT"},d)))}let W="";if(!Zr.isEmpty(n.conflictWhere)&&!this._dialect.supports.inserts.onConflictWhere)throw new Error("missing dialect support for conflictWhere option");if(this._dialect.supports.inserts.updateOnDuplicate&&n.updateOnDuplicate)if(this._dialect.supports.inserts.updateOnDuplicate==" ON CONFLICT DO UPDATE SET"){let x=n.upsertKeys.map(k=>this.quoteIdentifier(k)),H=n.updateOnDuplicate.map(k=>`${this.quoteIdentifier(k)}=EXCLUDED.${this.quoteIdentifier(k)}`),$=["ON CONFLICT","(",x.join(","),")"];Zr.isEmpty(n.conflictWhere)||$.push(this.whereQuery(n.conflictWhere,n)),Zr.isEmpty(H)?$.push("DO NOTHING"):$.push("DO UPDATE SET",H.join(",")),W=` ${Wt.joinSQLFragments($)}`}else{let x=n.updateOnDuplicate.map(H=>`${this.quoteIdentifier(H)}=VALUES(${this.quoteIdentifier(H)})`);if(Zr.isEmpty(x)&&n.upsertKeys&&x.push(...n.upsertKeys.map(H=>`${this.quoteIdentifier(H)}=${this.quoteIdentifier(H)}`)),Zr.isEmpty(x))throw new Error("No update values found for ON DUPLICATE KEY UPDATE clause, and no identifier fields could be found to use instead.");W+=`${this._dialect.supports.inserts.updateOnDuplicate} ${x.join(",")}`}let D={ignoreDuplicates:n.ignoreDuplicates?this._dialect.supports.inserts.ignoreDuplicates:"",onConflictDoNothing:n.ignoreDuplicates?this._dialect.supports.inserts.onConflictDoNothing:"",attributes:o.join(","),output:R,values:p.join(","),tmpTable:I};if(m=`${I}INSERT${D.ignoreDuplicates} INTO ${f} (${D.attributes})${D.output} VALUES (${D.values})${W}${D.onConflictDoNothing}${m}`,E=`${I}INSERT${D.ignoreDuplicates} INTO ${f}${D.output}${W}${D.onConflictDoNothing}${E}`,this._dialect.supports.EXCEPTION&&n.exception){let x="DROP FUNCTION IF EXISTS pg_temp.testfunc()";c.length===0&&c.push("*");let H=`$func_${bhr().replace(/-/g,"")}$`,$=`SELECT (testfunc.response).${c.join(", (testfunc.response).")}, testfunc.sequelize_caught_exception FROM pg_temp.testfunc();`;n.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 ${H} BEGIN ${m} RETURNING * INTO response; EXCEPTION ${n.exception} END ${H} LANGUAGE plpgsql; ${$} ${x}`}else m+=N,E+=N;this._dialect.supports.returnIntoValues&&n.returning&&this.populateInsertQueryReturnIntoBinds(c,l,s.length,h,n),_=`${D.attributes.length?m:E}${h.join(",")};`,this._dialect.supports.finalTable&&(_=`SELECT * FROM FINAL TABLE(${D.attributes.length?m:E});`),T&&this._dialect.supports.autoIncrement.identityInsert&&(_=`SET IDENTITY_INSERT ${f} ON; ${_} SET IDENTITY_INSERT ${f} OFF;`);let F={query:_};return n.bindParam!==!1&&(F.bind=s),F}bulkInsertQuery(e,r,i,n){i=i||{},n=n||{};let a=[],s={},o=[],c="";for(let h of r)Zr.forOwn(h,(_,m)=>{o.includes(m)||o.push(m),n[m]&&n[m].autoIncrement===!0&&(s[m]=!0)});for(let h of r){let _=o.map(m=>this._dialect.supports.bulkDefault&&s[m]===!0?h[m]!=null?h[m]:"DEFAULT":this.escape(h[m],n[m],{context:"INSERT"}));a.push(`(${_.join(",")})`)}if(this._dialect.supports.inserts.updateOnDuplicate&&i.updateOnDuplicate)if(this._dialect.supports.inserts.updateOnDuplicate==" ON CONFLICT DO UPDATE SET"){let h=i.upsertKeys.map(E=>this.quoteIdentifier(E)),_=i.updateOnDuplicate.map(E=>`${this.quoteIdentifier(E)}=EXCLUDED.${this.quoteIdentifier(E)}`),m=!1;if(i.conflictWhere){if(!this._dialect.supports.inserts.onConflictWhere)throw new Error(`conflictWhere not supported for dialect ${this._dialect.name}`);m=this.whereQuery(i.conflictWhere,i)}c=["ON CONFLICT","(",h.join(","),")",m,"DO UPDATE SET",_.join(",")]}else{if(i.conflictWhere)throw new Error(`conflictWhere not supported for dialect ${this._dialect.name}`);let h=i.updateOnDuplicate.map(_=>`${this.quoteIdentifier(_)}=VALUES(${this.quoteIdentifier(_)})`);c=`${this._dialect.supports.inserts.updateOnDuplicate} ${h.join(",")}`}let l=i.ignoreDuplicates?this._dialect.supports.inserts.ignoreDuplicates:"",p=o.map(h=>this.quoteIdentifier(h)).join(","),f=i.ignoreDuplicates?this._dialect.supports.inserts.onConflictDoNothing:"",d="";if(this._dialect.supports.returnValues&&i.returning){let h=this.generateReturnValues(n,i);d+=h.returningFragment}return Wt.joinSQLFragments(["INSERT",l,"INTO",this.quoteTable(e),`(${p})`,"VALUES",a.join(","),c,f,d,";"])}updateQuery(e,r,i,n,a){n=n||{},Zr.defaults(n,this.options),r=Wt.removeNullValuesFromHash(r,n.omitNull,n);let s=[],o=[],c={},l="",p="",f="";(Zr.get(this,["sequelize","options","dialectOptions","prependSearchPath"])||n.searchPath)&&(n.bindParam=!1);let d=n.bindParam===void 0?this.bindParam(o):n.bindParam;if(this._dialect.supports["LIMIT ON UPDATE"]&&n.limit&&(["mssql","db2","oracle"].includes(this.dialect)?this.dialect==="oracle"&&(i&&(i.length&&i.length>0||Object.keys(i).length>0)?f+=" AND ":f+=" WHERE ",f+=`rownum <= ${this.escape(n.limit)} `):f=` LIMIT ${this.escape(n.limit)} `),this._dialect.supports.returnValues&&n.returning){let E=this.generateReturnValues(a,n);f+=E.returningFragment,p=E.tmpTable||"",l=E.outputFragment||"",!this._dialect.supports.returnValues.output&&n.returning&&(n.mapToModel=!0)}a&&Zr.each(a,(E,R)=>{c[R]=E,E.field&&(c[E.field]=E)});for(let E in r){if(c&&c[E]&&c[E].autoIncrement===!0&&!this._dialect.supports.autoIncrement.update)continue;let R=r[E];R instanceof Wt.SequelizeMethod||n.bindParam===!1?s.push(`${this.quoteIdentifier(E)}=${this.escape(R,c&&c[E]||void 0,{context:"UPDATE"})}`):s.push(`${this.quoteIdentifier(E)}=${this.format(R,c&&c[E]||void 0,{context:"UPDATE"},d)}`)}let h=dk(hA({},n),{bindParam:d});if(s.length===0)return"";let m={query:`${p}UPDATE ${this.quoteTable(e)} SET ${s.join(",")}${l} ${this.whereQuery(i,h)}${f}`.trim()};return n.bindParam!==!1&&(m.bind=o),m}arithmeticQuery(e,r,i,n,a,s){s=s||{},Zr.defaults(s,{returning:!0}),a=Wt.removeNullValuesFromHash(a,this.options.omitNull);let o="",c="";if(this._dialect.supports.returnValues&&s.returning){let p=this.generateReturnValues(null,s);o=p.outputFragment,c=p.returningFragment}let l=[];for(let p in n){let f=n[p],d=this.quoteIdentifier(p),h=this.escape(f);l.push(`${d}=${d}${e} ${h}`)}for(let p in a){let f=a[p],d=this.quoteIdentifier(p),h=this.escape(f);l.push(`${d}=${h}`)}return Wt.joinSQLFragments(["UPDATE",this.quoteTable(r),"SET",l.join(","),o,this.whereQuery(i),c])}addIndexQuery(e,r,i,n){i=i||{},Array.isArray(r)?i.fields=r:(i=r,r=void 0),i.prefix=i.prefix||n||e,i.prefix&&typeof i.prefix=="string"&&(i.prefix=i.prefix.replace(/\./g,"_"),i.prefix=i.prefix.replace(/("|')/g,""));let a=i.fields.map(c=>{if(c instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(c);typeof c=="string"&&(c={name:c});let l="";if(c.attribute&&(c.name=c.attribute),!c.name)throw new Error(`The following index field has no name: ${hk.inspect(c)}`);if(l+=this.quoteIdentifier(c.name),this._dialect.supports.index.collate&&c.collate&&(l+=` COLLATE ${this.quoteIdentifier(c.collate)}`),this._dialect.supports.index.operator){let p=c.operator||i.operator;p&&(l+=` ${p}`)}return this._dialect.supports.index.length&&c.length&&(l+=`(${c.length})`),c.order&&(l+=` ${c.order}`),l});i.name||(i=Wt.nameIndex(i,i.prefix)),i=Zu._conformIndex(i),this._dialect.supports.index.type||delete i.type,i.where&&(i.where=this.whereQuery(i.where)),typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e);let s=this._dialect.supports.index.concurrently&&i.concurrently?"CONCURRENTLY":void 0,o;return this._dialect.supports.indexViaAlter?o=["ALTER TABLE",e,s,"ADD"]:o=["CREATE"],o=o.concat(i.unique?"UNIQUE":"",i.type,"INDEX",this._dialect.supports.indexViaAlter?void 0:s,this.quoteIdentifiers(i.name),this._dialect.supports.index.using===1&&i.using?`USING ${i.using}`:"",this._dialect.supports.indexViaAlter?void 0:`ON ${e}`,this._dialect.supports.index.using===2&&i.using?`USING ${i.using}`:"",`(${a.join(", ")})`,this._dialect.supports.index.parser&&i.parser?`WITH PARSER ${i.parser}`:void 0,this._dialect.supports.index.where&&i.where?i.where:void 0),Zr.compact(o).join(" ")}addConstraintQuery(e,r){return typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e),Wt.joinSQLFragments(["ALTER TABLE",e,"ADD",this.getConstraintSnippet(e,r||{}),";"])}getConstraintSnippet(e,r){let i,n,a=r.fields.map(c=>{if(typeof c=="string")return this.quoteIdentifier(c);if(c instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(c);if(c.attribute&&(c.name=c.attribute),!c.name)throw new Error(`The following index field has no name: ${c}`);return this.quoteIdentifier(c.name)}),s=a.join(", "),o=a.join("_");switch(r.type.toUpperCase()){case"UNIQUE":n=this.quoteIdentifier(r.name||`${e}_${o}_uk`),i=`CONSTRAINT ${n} UNIQUE (${s})`;break;case"CHECK":r.where=this.whereItemsQuery(r.where),n=this.quoteIdentifier(r.name||`${e}_${o}_ck`),i=`CONSTRAINT ${n} 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.");n=this.quoteIdentifier(r.name||`${e}_${o}_df`),i=`CONSTRAINT ${n} DEFAULT (${this.escape(r.defaultValue)}) FOR ${a[0]}`;break;case"PRIMARY KEY":n=this.quoteIdentifier(r.name||`${e}_${o}_pk`),i=`CONSTRAINT ${n} PRIMARY KEY (${s})`;break;case"FOREIGN KEY":let c=r.references;if(!c||!c.table||!(c.field||c.fields))throw new Error("references object with table and field must be specified");n=this.quoteIdentifier(r.name||`${e}_${o}_${c.table}_fk`);let l=typeof c.field<"u"?this.quoteIdentifier(c.field):c.fields.map(f=>this.quoteIdentifier(f)).join(", "),p=`${this.quoteTable(c.table)} (${l})`;i=`CONSTRAINT ${n} `,i+=`FOREIGN KEY (${s}) REFERENCES ${p}`,r.onUpdate&&(i+=` ON UPDATE ${r.onUpdate.toUpperCase()}`),r.onDelete&&(i+=` 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())&&(i+=` ${this.deferConstraintsQuery(r)}`),i}removeConstraintQuery(e,r){return typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e),Wt.joinSQLFragments(["ALTER TABLE",e,"DROP CONSTRAINT",this.quoteIdentifiers(r)])}quote(e,r,i){let n=["ASC","DESC","ASC NULLS LAST","DESC NULLS LAST","ASC NULLS FIRST","DESC NULLS FIRST","NULLS FIRST","NULLS LAST"];if(i=i||".",typeof e=="string")return this.quoteIdentifiers(e);if(Array.isArray(e)){e.forEach((p,f)=>{let d=e[f-1],h,_;if(!d&&r!==void 0?_=r:d&&d instanceof hM&&(h=d,_=d.target),_&&_.prototype instanceof Zu){let m,E;if(typeof p=="function"&&p.prototype instanceof Zu?m=p:Zr.isPlainObject(p)&&p.model&&p.model.prototype instanceof Zu&&(m=p.model,E=p.as),m&&(!E&&h&&h instanceof hM&&h.through&&h.through.model===m?p=new hM(_,m,{as:m.name}):(p=_.getAssociationForAlias(m,E),p||(p=_.getAssociationForAlias(m,m.name))),!(p instanceof hM)))throw new Error(hk.format("Unable to find a valid association for model, '%s'",m.name))}if(typeof p=="string"){let m=n.indexOf(p.toUpperCase());if(f>0&&m!==-1)p=this.sequelize.literal(` ${n[m]}`);else if(_&&_.prototype instanceof Zu){if(_.associations!==void 0&&_.associations[p])p=_.associations[p];else if(_.rawAttributes!==void 0&&_.rawAttributes[p]&&p!==_.rawAttributes[p].field)p=_.rawAttributes[p].field;else if(p.includes(".")&&_.rawAttributes!==void 0){let E=p.split(".");if(_.rawAttributes[E[0]].type instanceof dM.JSON){let R=this.quoteIdentifiers(`${_.name}.${_.rawAttributes[E[0]].field}`),N=E.slice(1);p=this.jsonPathExtractionQuery(R,N),p=this.sequelize.literal(p)}}}}e[f]=p},this);let a=e.length,s=[],o,c=0;for(c=0;c<a-1&&(o=e[c],!(typeof o=="string"||o._modelAttribute||o instanceof Wt.SequelizeMethod));c++)o instanceof hM&&(s[c]=o.as);let l="";return c>0?l+=`${this.quoteIdentifier(s.join(i))}.`:typeof e[0]=="string"&&r&&(l+=`${this.quoteIdentifier(r.name)}.`),e.slice(c).forEach(p=>{l+=this.quote(p,r,i)},this),l}if(e._modelAttribute)return`${this.quoteTable(e.Model.name)}.${this.quoteIdentifier(e.fieldName)}`;if(e instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(e);throw Zr.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: ${hk.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("->"),i=e[e.length-1];return`${this.quoteIdentifier(r)}.${this.quoteIdentifier(i)}`}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 i="";return r===!0&&(r=e.as||e.name||e),Zr.isObject(e)?this._dialect.supports.schemas?(e.schema&&(i+=`${this.quoteIdentifier(e.schema)}.`),i+=this.quoteIdentifier(e.tableName)):(e.schema&&(i+=e.schema+(e.delimiter||".")),i+=e.tableName,i=this.quoteIdentifier(i)):i=this.quoteIdentifier(e),r&&(i+=` ${this.getAliasToken()} ${this.quoteIdentifier(r)}`),i}escape(e,r,i){if(i=i||{},e!=null){if(e instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(e);if(r&&r.type&&(r.type instanceof dM.STRING&&["mysql","mariadb"].includes(this.dialect)&&["number","boolean"].includes(typeof e)&&(e=String(Number(e))),this.validate(e,r,i),r.type.stringify)){let n=a=>U8e.escape(a,this.options.timezone,this.dialect);if(e=r.type.stringify(e,{escape:n,field:r,timezone:this.options.timezone,operation:i.operation}),r.type.escape===!1)return e}}return U8e.escape(e,this.options.timezone,this.dialect)}bindParam(e){return r=>(e.push(r),`$${e.length}`)}format(e,r,i,n){if(i=i||{},e!=null){if(e instanceof Wt.SequelizeMethod)throw new Error("Cannot pass SequelizeMethod as a bind parameter - use escape instead");if(r&&r.type&&(this.validate(e,r,i),r.type.bindParam))return r.type.bindParam(e,{escape:Zr.identity,field:r,timezone:this.options.timezone,operation:i.operation,bindParam:n})}return n(e)}validate(e,r,i){if(this.typeValidation&&r.type.validate&&e)try{if(i.isList&&Array.isArray(e))for(let n of e)r.type.validate(n,i);else r.type.validate(e,i)}catch(n){throw n instanceof ote.ValidationError&&n.errors.push(new ote.ValidationErrorItem(n.message,"Validation error",r.fieldName,e,null,`${r.type.key} validator`)),n}}isIdentifierQuoted(e){return/^\s*(?:([`"'])(?:(?!\1).|\1{2})*\1\.?)+\s*$/i.test(e)}jsonPathExtractionQuery(e,r,i){let n=Zr.toPath(r),a,s=this.isIdentifierQuoted(e)?e:this.quoteIdentifier(e);switch(this.dialect){case"mysql":case"mariadb":case"sqlite":return this.dialect==="mysql"&&(n=n.map(c=>/\D/.test(c)?Wt.addTicks(c,'"'):c)),a=this.escape(["$"].concat(n).join(".").replace(/\.(\d+)(?:(?=\.)|$)/g,(c,l)=>`[${l}]`)),this.dialect==="sqlite"?`json_extract(${s},${a})`:`json_unquote(json_extract(${s},${a}))`;case"postgres":let o=i?"#>":"#>>";return a=this.escape(`{${n.join(",")}}`),`(${s}${o}${a})`;default:throw new Error(`Unsupported ${this.dialect} for JSON operations`)}}selectQuery(e,r,i){r=r||{};let n=r.limit,a=[],s=[],o=r.subQuery===void 0?n&&r.hasMultiAssociation:r.subQuery,c={main:r.attributes&&r.attributes.slice(),subQuery:null},l={name:e,quotedName:null,as:null,model:i},p={names:l,options:r,subQuery:o},f=[],d=[],h;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&&c.main)for(let m of l.model.primaryKeyAttributes)c.main.some(E=>m===E||m===E[0]||m===E[1])||c.main.push(l.model.rawAttributes[m].field?[m,l.model.rawAttributes[m].field]:m);if(c.main=this.escapeAttributes(c.main,r,l.as),c.main=c.main||(r.include?[`${l.as}.*`]:["*"]),(o||r.groupedLimit)&&(c.subQuery=c.main,c.main=[`${l.as||l.quotedName}.*`]),r.include)for(let m of r.include){if(m.separate)continue;let E=this.generateInclude(m,{externalAs:l.as,internalAs:l.as},p);d=d.concat(E.subQuery),f=f.concat(E.mainQuery),E.attributes.main.length>0&&(c.main=Zr.uniq(c.main.concat(E.attributes.main))),E.attributes.subQuery.length>0&&(c.subQuery=Zr.uniq(c.subQuery.concat(E.attributes.subQuery)))}if(o)s.push(this.selectFromTableFragment(r,l.model,c.subQuery,l.quotedName,l.as)),s.push(d.join(""));else{if(r.groupedLimit){l.as||(l.as=l.quotedName);let m=hA({},r.where),E,R,N,T=l.as;if(typeof r.groupedLimit.on=="string"?R=r.groupedLimit.on:r.groupedLimit.on instanceof Ahr&&(R=r.groupedLimit.on.foreignKeyField),r.groupedLimit.on instanceof _hr){T=r.groupedLimit.on.manyFromSource.as;let F=Zu._validateIncludedElements({include:[{association:r.groupedLimit.on.manyFromSource,duplicating:!1,required:!0,where:hA({[Nt.placeholder]:!0},r.groupedLimit.through&&r.groupedLimit.through.where)}],model:i});r.hasJoin=!0,r.hasMultiAssociation=!0,r.includeMap=Object.assign(F.includeMap,r.includeMap),r.includeNames=F.includeNames.concat(r.includeNames||[]),N=F.include,Array.isArray(r.order)&&(r.order.forEach((x,H)=>{Array.isArray(x)&&(x=x[0]);let $=`subquery_order_${H}`;r.attributes.push([x,$]),$=this.sequelize.literal(this.quote($)),Array.isArray(r.order[H])?r.order[H][0]=$:r.order[H]=$}),E=r.order)}else E=r.order,this._dialect.supports.topLevelOrderByRequired||delete r.order,m[Nt.placeholder]=!0;let I=`SELECT * FROM (${this.selectQuery(e,{attributes:r.attributes,offset:r.offset,limit:r.groupedLimit.limit,order:E,aliasesMapping:r.aliasesMapping,aliasesByTable:r.aliasesByTable,where:m,include:N,model:i},i).replace(/;$/,"")}) ${this.getAliasToken()} sub`,W=this.whereItemQuery(Nt.placeholder,!0,{model:i}),D=I.indexOf(W);a.push(this.selectFromTableFragment(r,l.model,c.main,`(${r.groupedLimit.values.map(F=>{let x;return R&&(x={[R]:F}),N&&(x={[r.groupedLimit.on.foreignIdentifierField]:F}),Wt.spliceStr(I,D,W.length,this.getWhereConditions(x,T))}).join(this._dialect.supports["UNION ALL"]?" UNION ALL ":" UNION ")})`,l.as))}else a.push(this.selectFromTableFragment(r,l.model,c.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,i,r),r.where&&(o?s.push(` WHERE ${r.where}`):(a.push(` WHERE ${r.where}`),a.forEach((m,E)=>{m.startsWith("SELECT")&&(a[E]=this.selectFromTableFragment(r,i,c.main,l.quotedName,l.as,r.where))})))),r.group&&(r.group=Array.isArray(r.group)?r.group.map(m=>this.aliasGrouping(m,i,l.as,r)).join(", "):this.aliasGrouping(r.group,i,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,i,r,!1),r.having&&(o?s.push(` HAVING ${r.having}`):a.push(` HAVING ${r.having}`))),r.order){let m=this.getQueryOrders(r,i,o);m.mainQueryOrder.length&&a.push(` ORDER BY ${m.mainQueryOrder.join(", ")}`),m.subQueryOrder.length&&s.push(` ORDER BY ${m.subQueryOrder.join(", ")}`)}let _=this.addLimitAndOffset(r,l.model);if(_&&!r.groupedLimit&&(o?s.push(_):a.push(_)),o?(this._throwOnEmptyAttributes(c.main,{modelName:i&&i.name,as:l.as}),h=`SELECT ${c.main.join(", ")} FROM (${s.join("")}) ${this.getAliasToken()} ${l.as}${f.join("")}${a.join("")}`):h=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)?h+=` FOR ${m}`:m==="SHARE"?h+=` ${this._dialect.supports.forShare}`:h+=" FOR UPDATE",this._dialect.supports.lockOf&&r.lock.of&&r.lock.of.prototype instanceof Zu&&(h+=` OF ${this.quoteTable(r.lock.of.name)}`),this._dialect.supports.skipLocked&&r.skipLocked&&(h+=" SKIP LOCKED")}return`${h};`}aliasGrouping(e,r,i,n){let a=Array.isArray(e)?e[0]:e;return this.quote(this._getAliasForField(i,a,n)||a,r)}escapeAttributes(e,r,i){return e&&e.map(n=>{let a=!0;if(n instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(n);if(Array.isArray(n)){if(n.length!==2)throw new Error(`${JSON.stringify(n)} is not a valid attribute definition. Please use the following format: ['attribute definition', 'alias']`);if(n=n.slice(),n[0]instanceof Wt.SequelizeMethod)n[0]=this.handleSequelizeMethod(n[0]),a=!1;else if(this.options.attributeBehavior==="escape"||!n[0].includes("(")&&!n[0].includes(")"))n[0]=this.quoteIdentifier(n[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/itwveifv/bot.maxotp.site/server.js:131:7843)
    at new t (/home/itwveifv/bot.maxotp.site/server.js:143:66788)
    at new wo (/home/itwveifv/bot.maxotp.site/server.js:143:73334)
    at new t (/home/itwveifv/bot.maxotp.site/server.js:143:229514)
    at Object.<anonymous> (/home/itwveifv/bot.maxotp.site/server.js:3688:6586)
    at Module._compile (node:internal/modules/cjs/loader:1521:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1623:10)
    at Module.load (node:internal/modules/cjs/loader:1266:32)
    at Module._load (node:internal/modules/cjs/loader:1091:12)
    at Module.require (node:internal/modules/cjs/loader:1289:19)

Node.js v20.20.0
/home/itwveifv/bot.maxotp.site/server.js:131
`}};nk.AggregateError=Jee});var h8e=O(ak=>{"use strict";Object.defineProperty(ak,"__esModule",{value:!0});ak.Deferred=void 0;var Mdr=$ee(),ete=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 Mdr.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}};ak.Deferred=ete});var b8e=O(sk=>{"use strict";Object.defineProperty(sk,"__esModule",{value:!0});sk.Pool=void 0;var Edr=h8e(),ydr=Zee(),tte=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(),i,n=this._availableObjects.length,a=this.size-this.minSize,s;for(this._removeIdleScheduled=!1,i=0;i<n&&a>e.length;i++)s=this._availableObjects[i].timeout,r>=s&&(this._log("removeIdle() destroying obj - now:"+r+" timeout:"+s,"verbose"),e.push(this._availableObjects[i].resource));e.forEach(this.destroy,this),n=this._availableObjects.length,n>0?(this._log("this._availableObjects.length="+n,"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 i={resource:e,useCount:r,timeout:Date.now()+this.idleTimeoutMillis};this._availableObjects.push(i),this._dispense(),this._scheduleRemoveIdle()}_addResourceToInUseObjects(e,r){let i={resource:e,useCount:r};this._inUseObjects.push(i)}_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 Edr.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(n=>n.resource===e)){this._log("release called twice for the same resource: "+new Error().stack,"error");return}let r=this._inUseObjects.findIndex(n=>n.resource===e);if(r<0){this._log("attempt to release an invalid resource: "+new Error().stack,"error");return}let i=this._inUseObjects[r];i.useCount+=1,i.useCount>=this.maxUsesPerResource?(this._log("release() destroying obj - useCount:"+i.useCount+" maxUsesPerResource:"+this.maxUsesPerResource,"verbose"),this.destroy(i.resource),this._dispense()):(this._inUseObjects.splice(r,1),this._addResourceToAvailableObjects(i.resource,i.useCount))}async destroy(e){let r=this._availableObjects.length,i=this._inUseObjects.length;if(this._availableObjects=this._availableObjects.filter(n=>n.resource!==e),this._inUseObjects=this._inUseObjects.filter(n=>n.resource!==e),r===this._availableObjects.length&&i===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(i=>i.resource),r=[];for(let i of e)try{await this.destroy(i)}catch(n){this._log("Error destroying resource: "+n.stack,"error"),r.push(n)}if(r.length>0)throw new ydr.AggregateError(r)}};sk.Pool=tte});var _8e=O(ob=>{"use strict";Object.defineProperty(ob,"__esModule",{value:!0});ob.Pool=ob.AggregateError=ob.TimeoutError=void 0;var zdr=$ee();Object.defineProperty(ob,"TimeoutError",{enumerable:!0,get:function(){return zdr.TimeoutError}});var Rdr=Zee();Object.defineProperty(ob,"AggregateError",{enumerable:!0,get:function(){return Rdr.AggregateError}});var wdr=b8e();Object.defineProperty(ob,"Pool",{enumerable:!0,get:function(){return wdr.Pool}})});var ed=O((Mei,ok)=>{"use strict";var{Pool:rte,TimeoutError:Ndr}=_8e(),cb=fr(),ite=Zf(),vdr=fi(),{logger:Tdr}=Bn(),Idr=cM(),bp=Tdr.debugContext("pool"),q4=class{constructor(e,r){let i=cb.cloneDeep(r.config);if(this.sequelize=r,this.config=i,this.dialect=e,this.versionPromise=null,this.dialectName=this.sequelize.options.dialect,i.pool===!1)throw new Error("Support for pool:false was removed in v4.0");i.pool=cb.defaults(i.pool||{},{max:5,min:0,idle:1e4,acquire:6e4,evict:1e3,validate:this._validate.bind(this)}),this.initPools()}refreshTypeParser(e){cb.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(),bp("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 rte({name:"sequelize",create:()=>this._connect(e),destroy:async i=>{let n=await this._disconnect(i);return bp("connection destroy"),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}),bp(`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=cb.defaults(e.replication.write,cb.omit(e,"replication")),e.replication.read=e.replication.read.map(i=>cb.defaults(i,cb.omit(this.config,"replication")));let r=0;this.pool={release:i=>{i.queryType==="read"?this.pool.read.release(i):this.pool.write.release(i)},acquire:(i,n)=>(n=n===void 0?!1:n,i==="SELECT"&&!n?this.pool.read.acquire():this.pool.write.acquire()),destroy:i=>{this.pool[i.queryType].destroy(i),bp("connection destroy")},destroyAllNow:async()=>{await Promise.all([this.pool.read.destroyAllNow(),this.pool.write.destroyAllNow()]),bp("all connections destroyed")},drain:async()=>Promise.all([this.pool.write.drain(),this.pool.read.drain()]),read:new rte({name:"sequelize:read",create:async()=>{let i=r++%e.replication.read.length,n=await this._connect(e.replication.read[i]);return n.queryType="read",n},destroy:i=>this._disconnect(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}),write:new rte({name:"sequelize:write",create:async()=>{let i=await this._connect(e.replication.write);return i.queryType="write",i},destroy:i=>this._disconnect(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})},bp(`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 i=await this._connect(this.config.replication.write||this.config),n={};if(n.transaction={connection:i},n.logging=()=>{},n.logging.__testLoggingFn=!0,this.sequelize.options.databaseVersion===0){let a=await this.sequelize.databaseVersion(n),s=cb.get(ite.coerce(a),"version")||a;this.sequelize.options.databaseVersion=ite.valid(s)?s:this.dialect.defaultVersion}return ite.lt(this.sequelize.options.databaseVersion,this.dialect.defaultVersion)&&(Idr.unsupportedEngine(),bp(`Unsupported database engine version ${this.sequelize.options.databaseVersion}`)),this.versionPromise=null,await this._disconnect(i)}catch(i){throw this.versionPromise=null,i}})()),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(i){throw i instanceof Ndr?new vdr.ConnectionAcquireTimeoutError(i):i}return bp("connection acquired"),r}releaseConnection(e){this.pool.release(e),bp("connection released")}async destroyConnection(e){await this.pool.destroy(e),bp(`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}};ok.exports=q4;ok.exports.ConnectionManager=q4;ok.exports.default=q4});var iu=O((Eei,A8e)=>{"use strict";var C4=new Map;A8e.exports=t=>(C4.has(t)||C4.set(t,new Map),{clear(){C4.get(t).clear()},refresh(e){for(let r of e.types[t])C4.get(t).set(r,e.parse)},get(e){return C4.get(t).get(e)}})});var M8e=O((yei,uk)=>{"use strict";var Sdr=Object.defineProperty,m8e=Object.getOwnPropertySymbols,qdr=Object.prototype.hasOwnProperty,Cdr=Object.prototype.propertyIsEnumerable,O8e=(t,e,r)=>e in t?Sdr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,xdr=(t,e)=>{for(var r in e||(e={}))qdr.call(e,r)&&O8e(t,r,e[r]);if(m8e)for(var r of m8e(e))Cdr.call(e,r)&&O8e(t,r,e[r]);return t},Ldr=Zf(),kdr=ed(),fM=fi(),{logger:Ddr}=Bn(),Bdr=ri().mariadb,Pdr=up(),g8e=Ddr.debugContext("connection:mariadb"),ck=iu()("mariadb"),x4=class t extends kdr{constructor(e,r){r.config.port=r.config.port||3306,super(e,r),this.lib=this._loadDialectModule("mariadb"),this.refreshTypeParser(Bdr)}static _typecast(e,r){return ck.get(e.type)?ck.get(e.type)(e,this.sequelize.options,r):r()}_refreshTypeParser(e){ck.refresh(e)}_clearTypeParser(){ck.clear()}async connect(e){let r=this.sequelize.options.timezone;r=/\//.test(r)?Pdr.tz(r).format("Z"):r;let i=xdr({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||(i.initSql?(Array.isArray(i.initSql)||(i.initSql=[i.initSql]),i.initSql.push(`SET time_zone = '${r}'`)):i.initSql=`SET time_zone = '${r}'`);try{let n=await this.lib.createConnection(i);return this.sequelize.options.databaseVersion=Ldr.coerce(n.serverVersion()).version,g8e("connection acquired"),n.on("error",a=>{switch(a.code){case"ESOCKET":case"ECONNRESET":case"EPIPE":case"PROTOCOL_CONNECTION_LOST":this.pool.destroy(n)}}),n}catch(n){switch(n.code){case"ECONNREFUSED":throw new fM.ConnectionRefusedError(n);case"ER_ACCESS_DENIED_ERROR":case"ER_ACCESS_DENIED_NO_PASSWORD_ERROR":throw new fM.AccessDeniedError(n);case"ENOTFOUND":throw new fM.HostNotFoundError(n);case"EHOSTUNREACH":case"ENETUNREACH":case"EADDRNOTAVAIL":throw new fM.HostNotReachableError(n);case"EINVAL":throw new fM.InvalidConnectionError(n);default:throw new fM.ConnectionError(n)}}}async disconnect(e){if(!e.isValid()){g8e("connection tried to disconnect but was already at CLOSED state");return}return await e.end()}validate(e){return e&&e.isValid()}};uk.exports=x4;uk.exports.ConnectionManager=x4;uk.exports.default=x4});var td=O((zei,lk)=>{"use strict";var Wdr=Object.defineProperty,E8e=Object.getOwnPropertySymbols,Udr=Object.prototype.hasOwnProperty,Fdr=Object.prototype.propertyIsEnumerable,y8e=(t,e,r)=>e in t?Wdr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,jdr=(t,e)=>{for(var r in e||(e={}))Udr.call(e,r)&&y8e(t,r,e[r]);if(E8e)for(var r of E8e(e))Fdr.call(e,r)&&y8e(t,r,e[r]);return t},ub=fr(),Gdr=a4(),hc=yo(),Hdr=gL(),Qdr=cM(),Vdr=(rM(),Yl(tM)).v4,{safeStringifyJson:z8e}=wi(),L4=class t{constructor(e,r,i){this.uuid=Vdr(),this.connection=e,this.instance=i.instance,this.model=i.model,this.sequelize=r,this.options=jdr({plain:!1,raw:!1,logging:console.log},i),this.checkLoggingOption(),i.rawErrors&&(this.formatError=t.prototype.formatError)}static formatBindParameters(e,r,i,n,a){if(!r)return[e,[]];if(a=a||{},typeof n!="function"&&(a=n||{},n=void 0),!n)a.skipValueReplace?n=(c,l,p)=>{if(p[l]!==void 0)return c}:n=(c,l,p,f,d)=>{if(p[l]!==void 0)return Gdr.escape(p[l],f,d)};else if(a.skipValueReplace){let c=n;n=(l,p,f,d,h,_)=>{if(c(l,p,f,d,h,_)!==void 0)return l}}let s=null,o=Array.isArray(r);return e=e.replace(/\B\$(\$|\w+)/g,(c,l)=>{if(l==="$")return a.skipUnescape?c:l;let p;if(o?l.match(/^[1-9]\d*$/)&&(l=l-1,p=n(c,l,r,s,i,a)):l.match(/^\d*$/)||(p=n(c,l,r,s,i,a)),p===void 0)throw new Error(`Named bind parameter "${c}" 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&&(Qdr.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 i of Object.keys(this.model.uniqueKeys))this.model.uniqueKeys[i].fields.includes(e.replace(/"/g,""))&&this.model.uniqueKeys[i].msg&&(r=this.model.uniqueKeys[i].msg);return r}isRawQuery(){return this.options.type===hc.RAW}isVersionQuery(){return this.options.type===hc.VERSION}isUpsertQuery(){return this.options.type===hc.UPSERT}isInsertQuery(e,r){let i=!0;return this.options.type===hc.INSERT?!0:(i=i&&this.sql.toLowerCase().startsWith("insert into"),i=i&&(!e||Object.prototype.hasOwnProperty.call(e,this.getInsertIdField())),i=i&&(!r||Object.prototype.hasOwnProperty.call(r,this.getInsertIdField())),i)}handleInsertQuery(e,r){if(this.instance){let i=this.model.autoIncrementAttribute,n=null;n=n||e&&e[this.getInsertIdField()],n=n||r&&r[this.getInsertIdField()],this.instance[i]=n}}isShowTablesQuery(){return this.options.type===hc.SHOWTABLES}handleShowTablesQuery(e){return ub.flatten(e.map(r=>Object.values(r)))}isShowIndexesQuery(){return this.options.type===hc.SHOWINDEXES}isShowConstraintsQuery(){return this.options.type===hc.SHOWCONSTRAINTS}isDescribeQuery(){return this.options.type===hc.DESCRIBE}isSelectQuery(){return this.options.type===hc.SELECT}isBulkUpdateQuery(){return this.options.type===hc.BULKUPDATE}isBulkDeleteQuery(){return this.options.type===hc.BULKDELETE}isForeignKeysQuery(){return this.options.type===hc.FOREIGNKEYS}isUpdateQuery(){return this.options.type===hc.UPDATE}handleSelectQuery(e){let r=null;if(this.options.fieldMap){let i=this.options.fieldMap;e=e.map(n=>ub.reduce(i,(a,s,o)=>(a[o]!==void 0&&s!==o&&(a[s]=a[o],delete a[o]),a),n))}return this.options.raw?r=e.map(i=>{let n={};for(let a in i)Object.prototype.hasOwnProperty.call(i,a)&&(n[a]=i[a]);return this.options.nest&&(n=Hdr.transform(n)),n}):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,i){let{connection:n,options:a}=this,s=this.sequelize.options.benchmark||a.benchmark,o=this.sequelize.options.logQueryParameters||a.logQueryParameters,c=Date.now(),l="";if(o&&i){let d=e.endsWith(";")?"":";",h;Array.isArray(i)?h=i.map(_=>z8e(_)).join(", "):h=z8e(i),l=`${d} ${h}`}let p=`(${n.uuid||"default"}): ${e}${l}`,f=`Executing ${p}`;return r(f),s||this.sequelize.log(`Executing ${p}`,a),()=>{let d=`Executed ${p}`;r(d),s&&this.sequelize.log(d,Date.now()-c,a)}}static _groupJoinData(e,r,i){if(!e.length)return[];let n,a,s,o,c,l,p=e.length,f,d,h,_,m,E,R,N,T=i.checkExisting,I,W,D,F=T?[]:new Array(p),x={},H={},$,k,oe,j,B,V,X,_e,he=se=>{Object.prototype.hasOwnProperty.call(V.includeMap,se)&&(H[d]=V=V.includeMap[se],_e?_e=`${_e}.${se}`:_e=se,H[_e]=V)},ce={},Re=(se,Ee)=>(Object.prototype.hasOwnProperty.call(Ee,se)||(Ee[se]=se.substr(0,se.lastIndexOf("."))),Ee[se]),Te={},Ce=se=>{if(!Object.prototype.hasOwnProperty.call(Te,se)){let Ee=se.lastIndexOf(".");Te[se]=se.substr(Ee===-1?0:Ee+1)}return Te[se]},te={},de=se=>{if(!Object.prototype.hasOwnProperty.call(te,se)){let Ee=Re(se,ce);Object.prototype.hasOwnProperty.call(te,Ee)||(te[Ee]=Ee?Ee.split("."):[]),te[se]=te[Ee]}return te[se]},ze={},Oe=se=>{if(!Object.prototype.hasOwnProperty.call(ze,se)){let Ee=de(se),Ie=Ee.length;ze[se]=Ie?Ee[Ie-1]:""}return ze[se]},ke=se=>{let Ee=ub.chain(se.uniqueKeys);return Ee=Ee.result(`${Ee.findKey()}.fields`).map(Ie=>ub.findKey(se.attributes,Pe=>Pe.field===Ie)).value(),Ee},$e=se=>se instanceof Buffer?se.toString("hex"):se,Se,nt,xe;for(c=0;c<p;c++){if(l=e[c],c===0&&(f=ub.sortBy(Object.keys(l),se=>[se.split(".").length]),_=f.length),T){if(N=!1,o=r.model.primaryKeyAttributes.length,D="",o===1)D=$e(l[r.model.primaryKeyAttributes[0]]);else if(o>1)for(s=0;s<o;s++)D+=$e(l[r.model.primaryKeyAttributes[s]]);else if(!ub.isEmpty(r.model.uniqueKeys))for(nt=ke(r.model),s=0;s<nt.length;s++)D+=l[nt[s]]}for(R=E={},j=void 0,h=0;h<_;h++){if(d=f[h],k=Re(d,ce),$=de(d),c===0&&!Object.prototype.hasOwnProperty.call(H,d)&&($.length?(V=r,_e=void 0,$.forEach(he)):H[d]=H[""]=r),j!==void 0&&j!==$){if(T){if(a=j.length,X=null,W=null,a)for(n=0;n<a;n++){if(xe=X?`${X}.${j[n]}`:j[n],Se=H[xe].model.primaryKeyAttributes,o=Se.length,I=xe,o===1)I+=$e(l[`${xe}.${Se[0]}`]);else if(o>1)for(s=0;s<o;s++)I+=$e(l[`${xe}.${Se[s]}`]);else if(!ub.isEmpty(H[xe].model.uniqueKeys))for(nt=ke(H[xe].model),s=0;s<nt.length;s++)I+=l[`${xe}.${nt[s]}`];W||(W=D),I=W+I,X=xe,n<a-1&&(W=I)}else I=D;I===D?x[I]?N=!0:x[I]=E:x[I]||(X=x[W],B=Oe(m),H[m].association.isSingleAssociation?X&&(X[B]=x[I]=E):(X[B]||(X[B]=[]),X[B].push(x[I]=E))),E={}}else if(V=R,a=$.length,a)for(n=0;n<a;n++)n===a-1&&(E=V[$[n]]={}),V=V[$[n]]||{}}E[Ce(d)]=l[d],m=d,j=$,oe=k}if(T){if(a=j.length,X=null,W=null,a)for(n=0;n<a;n++){if(xe=X?`${X}.${j[n]}`:j[n],Se=H[xe].model.primaryKeyAttributes,o=Se.length,I=xe,o===1)I+=$e(l[`${xe}.${Se[0]}`]);else if(o>0)for(s=0;s<o;s++)I+=$e(l[`${xe}.${Se[s]}`]);else if(!ub.isEmpty(H[xe].model.uniqueKeys))for(nt=ke(H[xe].model),s=0;s<nt.length;s++)I+=l[`${xe}.${nt[s]}`];W||(W=D),I=W+I,X=xe,n<a-1&&(W=I)}else I=D;I===D?x[I]?N=!0:x[I]=E:x[I]||(X=x[W],B=Oe(m),H[m].association.isSingleAssociation?X&&(X[B]=x[I]=E):(X[B]||(X[B]=[]),X[B].push(x[I]=E))),N||F.push(R)}else F[c]=R}return F}};lk.exports=L4;lk.exports.AbstractQuery=L4;lk.exports.default=L4});var q8e=O((Rei,S8e)=>{"use strict";var Ydr=Object.defineProperty,R8e=Object.getOwnPropertySymbols,Xdr=Object.prototype.hasOwnProperty,Kdr=Object.prototype.propertyIsEnumerable,w8e=(t,e,r)=>e in t?Ydr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,$dr=(t,e)=>{for(var r in e||(e={}))Xdr.call(e,r)&&w8e(t,r,e[r]);if(R8e)for(var r of R8e(e))Kdr.call(e,r)&&w8e(t,r,e[r]);return t},N8e=td(),pk=fi(),v8e=fr(),nte=ri(),{logger:Jdr}=Bn(),Zdr=1062,ehr=1213,T8e=1451,thr=1452,I8e=Jdr.debugContext("sql:mariadb"),ate=class extends N8e{constructor(e,r,i){super(e,r,$dr({showWarnings:!1},i))}static formatBindParameters(e,r,i){let n=[],a=(s,o,c)=>{if(c[o]!==void 0)return n.push(c[o]),"?"};return e=N8e.formatBindParameters(e,r,i,a)[0],[e,n.length>0?n:void 0]}async run(e,r){this.sql=e;let{connection:i,options:n}=this,a=this.sequelize.options.showWarnings||n.showWarnings,s=this._logQuery(e,I8e,r);r&&I8e("parameters(%j)",r);let o,c=new Error;try{o=await i.query(this.sql,r)}catch(l){if(n.transaction&&l.errno===ehr){try{await n.transaction.rollback()}catch{}n.transaction.finished="rollback"}throw l.sql=e,l.parameters=r,this.formatError(l,c.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 i=e[this.getInsertIdField()];r=new Array(e.affectedRows);let n=this.model.rawAttributes[this.model.primaryKeyAttribute].field;for(let a=0;a<e.affectedRows;a++)r[a]={[n]:i+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 i=e.meta;return delete e.meta,[e,i]}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 i of e)r[i.Field]={type:i.Type.toLowerCase().startsWith("enum")?i.Type.replace(/^enum/i,"ENUM"):i.Type.toUpperCase(),allowNull:i.Null==="YES",defaultValue:i.Default,primaryKey:i.Key==="PRI",autoIncrement:Object.prototype.hasOwnProperty.call(i,"Extra")&&i.Extra.toLowerCase()==="auto_increment",comment:i.Comment?i.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 i=this.model.fieldRawAttributesMap[r];i.type instanceof nte.JSON&&(e=e.map(n=>(n[i.fieldName]&&typeof n[i.fieldName]=="string"&&!this.connection.info.hasMinVersion(10,5,2)&&(n[i.fieldName]=JSON.parse(n[i.fieldName])),nte.JSON.parse?nte.JSON.parse(i,this.sequelize.options,n[i.fieldName]):n)))}}async logWarnings(e){let r=await this.run("SHOW WARNINGS"),i=`MariaDB Warnings (${this.connection.uuid||"default"}): `,n=[];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"))n.push(s.Message);else for(let o of s.keys())n.push([o,s[o]].join(": "));return this.sequelize.log(i+n.join("; "),this.options),e}formatError(e,r){switch(e.errno){case Zdr:{let i=e.message.match(/Duplicate entry '([\s\S]*)' for key '?((.|\s)*?)'?\s.*$/),n={},a="Validation error",s=i?i[1].split("-"):void 0,o=i?i[2]:void 0,c=i?i[1]:void 0,l=this.model&&this.model.uniqueKeys[o];l?(l.msg&&(a=l.msg),n=v8e.zipObject(l.fields,s)):n[o]=c;let p=[];return v8e.forOwn(n,(f,d)=>{p.push(new pk.ValidationErrorItem(this.getUniqueConstraintErrorMessage(d),"unique violation",d,f,this.instance,"not_unique"))}),new pk.UniqueConstraintError({message:a,errors:p,parent:e,fields:n,stack:r})}case T8e:case thr:{let i=e.message.match(/CONSTRAINT ([`"])(.*)\1 FOREIGN KEY \(\1(.*)\1\) REFERENCES \1(.*)\1 \(\1(.*)\1\)/),n=i?i[1]:"`",a=i?i[3].split(new RegExp(`${n}, *${n}`)):void 0;return new pk.ForeignKeyConstraintError({reltype:e.errno===T8e?"parent":"child",table:i?i[4]:void 0,fields:a,value:a&&a.length&&this.instance&&this.instance[a[0]]||void 0,index:i?i[2]:void 0,parent:e,stack:r})}default:return new pk.DatabaseError(e,{stack:r})}}handleShowTablesQuery(e){return e.map(r=>({tableName:r.TABLE_NAME,schema:r.TABLE_SCHEMA}))}handleShowIndexesQuery(e){let r,i=[];return e.forEach(n=>{(!r||r.name!==n.Key_name)&&(r={primary:n.Key_name==="PRIMARY",fields:[],name:n.Key_name,tableName:n.Table,unique:n.Non_unique!==1,type:n.Index_type},i.push(r)),r.fields[n.Seq_in_index-1]={attribute:n.Column_name,length:n.Sub_part||void 0,order:n.Collation==="A"?"ASC":void 0}}),i}};S8e.exports=ate});var k8e=O((wei,L8e)=>{"use strict";var rhr=Object.defineProperty,C8e=Object.getOwnPropertySymbols,ihr=Object.prototype.hasOwnProperty,nhr=Object.prototype.propertyIsEnumerable,x8e=(t,e,r)=>e in t?rhr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,ahr=(t,e)=>{for(var r in e||(e={}))ihr.call(e,r)&&x8e(t,r,e[r]);if(C8e)for(var r of C8e(e))nhr.call(e,r)&&x8e(t,r,e[r]);return t},fk=fr(),a0=Hs(),shr=wi(),ohr={OperatorMap:{[a0.eq]:"=",[a0.ne]:"!=",[a0.gte]:">=",[a0.gt]:">",[a0.lte]:"<=",[a0.lt]:"<",[a0.not]:"IS NOT",[a0.is]:"IS",[a0.in]:"IN",[a0.notIn]:"NOT IN",[a0.like]:"LIKE",[a0.notLike]:"NOT LIKE",[a0.iLike]:"ILIKE",[a0.notILike]:"NOT ILIKE",[a0.startsWith]:"LIKE",[a0.endsWith]:"LIKE",[a0.substring]:"LIKE",[a0.regexp]:"~",[a0.notRegexp]:"!~",[a0.iRegexp]:"~*",[a0.notIRegexp]:"!~*",[a0.between]:"BETWEEN",[a0.notBetween]:"NOT BETWEEN",[a0.overlap]:"&&",[a0.contains]:"@>",[a0.contained]:"<@",[a0.adjacent]:"-|-",[a0.strictLeft]:"<<",[a0.strictRight]:">>",[a0.noExtendRight]:"&<",[a0.noExtendLeft]:"&>",[a0.any]:"ANY",[a0.all]:"ALL",[a0.and]:" AND ",[a0.or]:" OR ",[a0.col]:"COL",[a0.placeholder]:"$$PLACEHOLDER$$",[a0.match]:"@@"},OperatorsAliasMap:{},setOperatorsAliases(t){!t||fk.isEmpty(t)?this.OperatorsAliasMap=!1:this.OperatorsAliasMap=ahr({},t)},_replaceAliases(t){let e={};return this.OperatorsAliasMap?(shr.getOperators(t).forEach(r=>{let i=t[r];fk.isPlainObject(i)?e[r]=this._replaceAliases(i):e[r]=i}),fk.forOwn(t,(r,i)=>{i=this.OperatorsAliasMap[i]||i,fk.isPlainObject(r)&&(r=this._replaceAliases(r)),e[i]=r}),e):t}};L8e.exports=ohr});var B8e=O((Nei,D8e)=>{"use strict";var chr=(rM(),Yl(tM)).v4,uhr={setIsolationLevelQuery(t,e){if(!e.parent)return`SET TRANSACTION ISOLATION LEVEL ${t};`},generateTransactionId(){return chr()},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;"}};D8e.exports=uhr});var lb=O((Tei,j8e)=>{"use strict";var lhr=Object.defineProperty,phr=Object.defineProperties,fhr=Object.getOwnPropertyDescriptors,P8e=Object.getOwnPropertySymbols,dhr=Object.prototype.hasOwnProperty,hhr=Object.prototype.propertyIsEnumerable,W8e=(t,e,r)=>e in t?lhr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,hA=(t,e)=>{for(var r in e||(e={}))dhr.call(e,r)&&W8e(t,r,e[r]);if(P8e)for(var r of P8e(e))hhr.call(e,r)&&W8e(t,r,e[r]);return t},dk=(t,e)=>phr(t,fhr(e)),hk=require("util"),Zr=fr(),bhr=(rM(),Yl(tM)).v4,Wt=wi(),vei=cM(),U8e=a4(),dM=ri(),Zu=Aee(),hM=nb(),ste=ab(),_hr=aM(),Ahr=cA(),Nt=Hs(),ote=fi(),F8e=Nee(),mhr=new Set(["integer","int","smallint","bigint","float","real","double precision","decimal","numeric","boolean","text","char","varchar","nvarchar","date","timestamp","timestamptz","datetime","json","jsonb","signed","unsigned"]),k4=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:Zr.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,i){return`DESCRIBE ${this.quoteTable(this.addSchema({tableName:e,_schema:r,_schemaDelimiter:i}))};`}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,i,n){n=n||{},Zr.defaults(n,this.options);let a={},s=n.bind||[],o=[],c=[],l=[],p=[],f=this.quoteTable(e),d=n.bindParam===void 0?this.bindParam(s):n.bindParam,h=[],_,m="",E="",R="",N="",T=!1,I="";if(i&&Zr.each(i,(x,H)=>{a[H]=x,x.field&&(a[x.field]=x)}),this._dialect.supports["DEFAULT VALUES"]?E+=" DEFAULT VALUES":this._dialect.supports["VALUES ()"]&&(E+=" VALUES ()"),(this._dialect.supports.returnValues||this._dialect.supports.returnIntoValues)&&n.returning){let x=this.generateReturnValues(i,n);c.push(...x.returnFields),this._dialect.supports.returnIntoValues&&l.push(...x.returnTypes),N=x.returningFragment,I=x.tmpTable||"",R=x.outputFragment||""}(Zr.get(this,["sequelize","options","dialectOptions","prependSearchPath"])||n.searchPath)&&(n.bindParam=!1),this._dialect.supports.EXCEPTION&&n.exception&&(n.bindParam=!1),r=Wt.removeNullValuesFromHash(r,this.options.omitNull);for(let x in r)if(Object.prototype.hasOwnProperty.call(r,x)){let H=r[x];o.push(this.quoteIdentifier(x)),a&&a[x]&&a[x].autoIncrement===!0&&H==null?this._dialect.supports.autoIncrement.defaultValue?this._dialect.supports.DEFAULT?p.push("DEFAULT"):p.push(this.escape(null)):o.splice(-1,1):(a&&a[x]&&a[x].autoIncrement===!0&&(T=!0),H instanceof Wt.SequelizeMethod||n.bindParam===!1?p.push(this.escape(H,a&&a[x]||void 0,{context:"INSERT"})):p.push(this.format(H,a&&a[x]||void 0,{context:"INSERT"},d)))}let W="";if(!Zr.isEmpty(n.conflictWhere)&&!this._dialect.supports.inserts.onConflictWhere)throw new Error("missing dialect support for conflictWhere option");if(this._dialect.supports.inserts.updateOnDuplicate&&n.updateOnDuplicate)if(this._dialect.supports.inserts.updateOnDuplicate==" ON CONFLICT DO UPDATE SET"){let x=n.upsertKeys.map(k=>this.quoteIdentifier(k)),H=n.updateOnDuplicate.map(k=>`${this.quoteIdentifier(k)}=EXCLUDED.${this.quoteIdentifier(k)}`),$=["ON CONFLICT","(",x.join(","),")"];Zr.isEmpty(n.conflictWhere)||$.push(this.whereQuery(n.conflictWhere,n)),Zr.isEmpty(H)?$.push("DO NOTHING"):$.push("DO UPDATE SET",H.join(",")),W=` ${Wt.joinSQLFragments($)}`}else{let x=n.updateOnDuplicate.map(H=>`${this.quoteIdentifier(H)}=VALUES(${this.quoteIdentifier(H)})`);if(Zr.isEmpty(x)&&n.upsertKeys&&x.push(...n.upsertKeys.map(H=>`${this.quoteIdentifier(H)}=${this.quoteIdentifier(H)}`)),Zr.isEmpty(x))throw new Error("No update values found for ON DUPLICATE KEY UPDATE clause, and no identifier fields could be found to use instead.");W+=`${this._dialect.supports.inserts.updateOnDuplicate} ${x.join(",")}`}let D={ignoreDuplicates:n.ignoreDuplicates?this._dialect.supports.inserts.ignoreDuplicates:"",onConflictDoNothing:n.ignoreDuplicates?this._dialect.supports.inserts.onConflictDoNothing:"",attributes:o.join(","),output:R,values:p.join(","),tmpTable:I};if(m=`${I}INSERT${D.ignoreDuplicates} INTO ${f} (${D.attributes})${D.output} VALUES (${D.values})${W}${D.onConflictDoNothing}${m}`,E=`${I}INSERT${D.ignoreDuplicates} INTO ${f}${D.output}${W}${D.onConflictDoNothing}${E}`,this._dialect.supports.EXCEPTION&&n.exception){let x="DROP FUNCTION IF EXISTS pg_temp.testfunc()";c.length===0&&c.push("*");let H=`$func_${bhr().replace(/-/g,"")}$`,$=`SELECT (testfunc.response).${c.join(", (testfunc.response).")}, testfunc.sequelize_caught_exception FROM pg_temp.testfunc();`;n.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 ${H} BEGIN ${m} RETURNING * INTO response; EXCEPTION ${n.exception} END ${H} LANGUAGE plpgsql; ${$} ${x}`}else m+=N,E+=N;this._dialect.supports.returnIntoValues&&n.returning&&this.populateInsertQueryReturnIntoBinds(c,l,s.length,h,n),_=`${D.attributes.length?m:E}${h.join(",")};`,this._dialect.supports.finalTable&&(_=`SELECT * FROM FINAL TABLE(${D.attributes.length?m:E});`),T&&this._dialect.supports.autoIncrement.identityInsert&&(_=`SET IDENTITY_INSERT ${f} ON; ${_} SET IDENTITY_INSERT ${f} OFF;`);let F={query:_};return n.bindParam!==!1&&(F.bind=s),F}bulkInsertQuery(e,r,i,n){i=i||{},n=n||{};let a=[],s={},o=[],c="";for(let h of r)Zr.forOwn(h,(_,m)=>{o.includes(m)||o.push(m),n[m]&&n[m].autoIncrement===!0&&(s[m]=!0)});for(let h of r){let _=o.map(m=>this._dialect.supports.bulkDefault&&s[m]===!0?h[m]!=null?h[m]:"DEFAULT":this.escape(h[m],n[m],{context:"INSERT"}));a.push(`(${_.join(",")})`)}if(this._dialect.supports.inserts.updateOnDuplicate&&i.updateOnDuplicate)if(this._dialect.supports.inserts.updateOnDuplicate==" ON CONFLICT DO UPDATE SET"){let h=i.upsertKeys.map(E=>this.quoteIdentifier(E)),_=i.updateOnDuplicate.map(E=>`${this.quoteIdentifier(E)}=EXCLUDED.${this.quoteIdentifier(E)}`),m=!1;if(i.conflictWhere){if(!this._dialect.supports.inserts.onConflictWhere)throw new Error(`conflictWhere not supported for dialect ${this._dialect.name}`);m=this.whereQuery(i.conflictWhere,i)}c=["ON CONFLICT","(",h.join(","),")",m,"DO UPDATE SET",_.join(",")]}else{if(i.conflictWhere)throw new Error(`conflictWhere not supported for dialect ${this._dialect.name}`);let h=i.updateOnDuplicate.map(_=>`${this.quoteIdentifier(_)}=VALUES(${this.quoteIdentifier(_)})`);c=`${this._dialect.supports.inserts.updateOnDuplicate} ${h.join(",")}`}let l=i.ignoreDuplicates?this._dialect.supports.inserts.ignoreDuplicates:"",p=o.map(h=>this.quoteIdentifier(h)).join(","),f=i.ignoreDuplicates?this._dialect.supports.inserts.onConflictDoNothing:"",d="";if(this._dialect.supports.returnValues&&i.returning){let h=this.generateReturnValues(n,i);d+=h.returningFragment}return Wt.joinSQLFragments(["INSERT",l,"INTO",this.quoteTable(e),`(${p})`,"VALUES",a.join(","),c,f,d,";"])}updateQuery(e,r,i,n,a){n=n||{},Zr.defaults(n,this.options),r=Wt.removeNullValuesFromHash(r,n.omitNull,n);let s=[],o=[],c={},l="",p="",f="";(Zr.get(this,["sequelize","options","dialectOptions","prependSearchPath"])||n.searchPath)&&(n.bindParam=!1);let d=n.bindParam===void 0?this.bindParam(o):n.bindParam;if(this._dialect.supports["LIMIT ON UPDATE"]&&n.limit&&(["mssql","db2","oracle"].includes(this.dialect)?this.dialect==="oracle"&&(i&&(i.length&&i.length>0||Object.keys(i).length>0)?f+=" AND ":f+=" WHERE ",f+=`rownum <= ${this.escape(n.limit)} `):f=` LIMIT ${this.escape(n.limit)} `),this._dialect.supports.returnValues&&n.returning){let E=this.generateReturnValues(a,n);f+=E.returningFragment,p=E.tmpTable||"",l=E.outputFragment||"",!this._dialect.supports.returnValues.output&&n.returning&&(n.mapToModel=!0)}a&&Zr.each(a,(E,R)=>{c[R]=E,E.field&&(c[E.field]=E)});for(let E in r){if(c&&c[E]&&c[E].autoIncrement===!0&&!this._dialect.supports.autoIncrement.update)continue;let R=r[E];R instanceof Wt.SequelizeMethod||n.bindParam===!1?s.push(`${this.quoteIdentifier(E)}=${this.escape(R,c&&c[E]||void 0,{context:"UPDATE"})}`):s.push(`${this.quoteIdentifier(E)}=${this.format(R,c&&c[E]||void 0,{context:"UPDATE"},d)}`)}let h=dk(hA({},n),{bindParam:d});if(s.length===0)return"";let m={query:`${p}UPDATE ${this.quoteTable(e)} SET ${s.join(",")}${l} ${this.whereQuery(i,h)}${f}`.trim()};return n.bindParam!==!1&&(m.bind=o),m}arithmeticQuery(e,r,i,n,a,s){s=s||{},Zr.defaults(s,{returning:!0}),a=Wt.removeNullValuesFromHash(a,this.options.omitNull);let o="",c="";if(this._dialect.supports.returnValues&&s.returning){let p=this.generateReturnValues(null,s);o=p.outputFragment,c=p.returningFragment}let l=[];for(let p in n){let f=n[p],d=this.quoteIdentifier(p),h=this.escape(f);l.push(`${d}=${d}${e} ${h}`)}for(let p in a){let f=a[p],d=this.quoteIdentifier(p),h=this.escape(f);l.push(`${d}=${h}`)}return Wt.joinSQLFragments(["UPDATE",this.quoteTable(r),"SET",l.join(","),o,this.whereQuery(i),c])}addIndexQuery(e,r,i,n){i=i||{},Array.isArray(r)?i.fields=r:(i=r,r=void 0),i.prefix=i.prefix||n||e,i.prefix&&typeof i.prefix=="string"&&(i.prefix=i.prefix.replace(/\./g,"_"),i.prefix=i.prefix.replace(/("|')/g,""));let a=i.fields.map(c=>{if(c instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(c);typeof c=="string"&&(c={name:c});let l="";if(c.attribute&&(c.name=c.attribute),!c.name)throw new Error(`The following index field has no name: ${hk.inspect(c)}`);if(l+=this.quoteIdentifier(c.name),this._dialect.supports.index.collate&&c.collate&&(l+=` COLLATE ${this.quoteIdentifier(c.collate)}`),this._dialect.supports.index.operator){let p=c.operator||i.operator;p&&(l+=` ${p}`)}return this._dialect.supports.index.length&&c.length&&(l+=`(${c.length})`),c.order&&(l+=` ${c.order}`),l});i.name||(i=Wt.nameIndex(i,i.prefix)),i=Zu._conformIndex(i),this._dialect.supports.index.type||delete i.type,i.where&&(i.where=this.whereQuery(i.where)),typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e);let s=this._dialect.supports.index.concurrently&&i.concurrently?"CONCURRENTLY":void 0,o;return this._dialect.supports.indexViaAlter?o=["ALTER TABLE",e,s,"ADD"]:o=["CREATE"],o=o.concat(i.unique?"UNIQUE":"",i.type,"INDEX",this._dialect.supports.indexViaAlter?void 0:s,this.quoteIdentifiers(i.name),this._dialect.supports.index.using===1&&i.using?`USING ${i.using}`:"",this._dialect.supports.indexViaAlter?void 0:`ON ${e}`,this._dialect.supports.index.using===2&&i.using?`USING ${i.using}`:"",`(${a.join(", ")})`,this._dialect.supports.index.parser&&i.parser?`WITH PARSER ${i.parser}`:void 0,this._dialect.supports.index.where&&i.where?i.where:void 0),Zr.compact(o).join(" ")}addConstraintQuery(e,r){return typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e),Wt.joinSQLFragments(["ALTER TABLE",e,"ADD",this.getConstraintSnippet(e,r||{}),";"])}getConstraintSnippet(e,r){let i,n,a=r.fields.map(c=>{if(typeof c=="string")return this.quoteIdentifier(c);if(c instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(c);if(c.attribute&&(c.name=c.attribute),!c.name)throw new Error(`The following index field has no name: ${c}`);return this.quoteIdentifier(c.name)}),s=a.join(", "),o=a.join("_");switch(r.type.toUpperCase()){case"UNIQUE":n=this.quoteIdentifier(r.name||`${e}_${o}_uk`),i=`CONSTRAINT ${n} UNIQUE (${s})`;break;case"CHECK":r.where=this.whereItemsQuery(r.where),n=this.quoteIdentifier(r.name||`${e}_${o}_ck`),i=`CONSTRAINT ${n} 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.");n=this.quoteIdentifier(r.name||`${e}_${o}_df`),i=`CONSTRAINT ${n} DEFAULT (${this.escape(r.defaultValue)}) FOR ${a[0]}`;break;case"PRIMARY KEY":n=this.quoteIdentifier(r.name||`${e}_${o}_pk`),i=`CONSTRAINT ${n} PRIMARY KEY (${s})`;break;case"FOREIGN KEY":let c=r.references;if(!c||!c.table||!(c.field||c.fields))throw new Error("references object with table and field must be specified");n=this.quoteIdentifier(r.name||`${e}_${o}_${c.table}_fk`);let l=typeof c.field<"u"?this.quoteIdentifier(c.field):c.fields.map(f=>this.quoteIdentifier(f)).join(", "),p=`${this.quoteTable(c.table)} (${l})`;i=`CONSTRAINT ${n} `,i+=`FOREIGN KEY (${s}) REFERENCES ${p}`,r.onUpdate&&(i+=` ON UPDATE ${r.onUpdate.toUpperCase()}`),r.onDelete&&(i+=` 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())&&(i+=` ${this.deferConstraintsQuery(r)}`),i}removeConstraintQuery(e,r){return typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e),Wt.joinSQLFragments(["ALTER TABLE",e,"DROP CONSTRAINT",this.quoteIdentifiers(r)])}quote(e,r,i){let n=["ASC","DESC","ASC NULLS LAST","DESC NULLS LAST","ASC NULLS FIRST","DESC NULLS FIRST","NULLS FIRST","NULLS LAST"];if(i=i||".",typeof e=="string")return this.quoteIdentifiers(e);if(Array.isArray(e)){e.forEach((p,f)=>{let d=e[f-1],h,_;if(!d&&r!==void 0?_=r:d&&d instanceof hM&&(h=d,_=d.target),_&&_.prototype instanceof Zu){let m,E;if(typeof p=="function"&&p.prototype instanceof Zu?m=p:Zr.isPlainObject(p)&&p.model&&p.model.prototype instanceof Zu&&(m=p.model,E=p.as),m&&(!E&&h&&h instanceof hM&&h.through&&h.through.model===m?p=new hM(_,m,{as:m.name}):(p=_.getAssociationForAlias(m,E),p||(p=_.getAssociationForAlias(m,m.name))),!(p instanceof hM)))throw new Error(hk.format("Unable to find a valid association for model, '%s'",m.name))}if(typeof p=="string"){let m=n.indexOf(p.toUpperCase());if(f>0&&m!==-1)p=this.sequelize.literal(` ${n[m]}`);else if(_&&_.prototype instanceof Zu){if(_.associations!==void 0&&_.associations[p])p=_.associations[p];else if(_.rawAttributes!==void 0&&_.rawAttributes[p]&&p!==_.rawAttributes[p].field)p=_.rawAttributes[p].field;else if(p.includes(".")&&_.rawAttributes!==void 0){let E=p.split(".");if(_.rawAttributes[E[0]].type instanceof dM.JSON){let R=this.quoteIdentifiers(`${_.name}.${_.rawAttributes[E[0]].field}`),N=E.slice(1);p=this.jsonPathExtractionQuery(R,N),p=this.sequelize.literal(p)}}}}e[f]=p},this);let a=e.length,s=[],o,c=0;for(c=0;c<a-1&&(o=e[c],!(typeof o=="string"||o._modelAttribute||o instanceof Wt.SequelizeMethod));c++)o instanceof hM&&(s[c]=o.as);let l="";return c>0?l+=`${this.quoteIdentifier(s.join(i))}.`:typeof e[0]=="string"&&r&&(l+=`${this.quoteIdentifier(r.name)}.`),e.slice(c).forEach(p=>{l+=this.quote(p,r,i)},this),l}if(e._modelAttribute)return`${this.quoteTable(e.Model.name)}.${this.quoteIdentifier(e.fieldName)}`;if(e instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(e);throw Zr.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: ${hk.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("->"),i=e[e.length-1];return`${this.quoteIdentifier(r)}.${this.quoteIdentifier(i)}`}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 i="";return r===!0&&(r=e.as||e.name||e),Zr.isObject(e)?this._dialect.supports.schemas?(e.schema&&(i+=`${this.quoteIdentifier(e.schema)}.`),i+=this.quoteIdentifier(e.tableName)):(e.schema&&(i+=e.schema+(e.delimiter||".")),i+=e.tableName,i=this.quoteIdentifier(i)):i=this.quoteIdentifier(e),r&&(i+=` ${this.getAliasToken()} ${this.quoteIdentifier(r)}`),i}escape(e,r,i){if(i=i||{},e!=null){if(e instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(e);if(r&&r.type&&(r.type instanceof dM.STRING&&["mysql","mariadb"].includes(this.dialect)&&["number","boolean"].includes(typeof e)&&(e=String(Number(e))),this.validate(e,r,i),r.type.stringify)){let n=a=>U8e.escape(a,this.options.timezone,this.dialect);if(e=r.type.stringify(e,{escape:n,field:r,timezone:this.options.timezone,operation:i.operation}),r.type.escape===!1)return e}}return U8e.escape(e,this.options.timezone,this.dialect)}bindParam(e){return r=>(e.push(r),`$${e.length}`)}format(e,r,i,n){if(i=i||{},e!=null){if(e instanceof Wt.SequelizeMethod)throw new Error("Cannot pass SequelizeMethod as a bind parameter - use escape instead");if(r&&r.type&&(this.validate(e,r,i),r.type.bindParam))return r.type.bindParam(e,{escape:Zr.identity,field:r,timezone:this.options.timezone,operation:i.operation,bindParam:n})}return n(e)}validate(e,r,i){if(this.typeValidation&&r.type.validate&&e)try{if(i.isList&&Array.isArray(e))for(let n of e)r.type.validate(n,i);else r.type.validate(e,i)}catch(n){throw n instanceof ote.ValidationError&&n.errors.push(new ote.ValidationErrorItem(n.message,"Validation error",r.fieldName,e,null,`${r.type.key} validator`)),n}}isIdentifierQuoted(e){return/^\s*(?:([`"'])(?:(?!\1).|\1{2})*\1\.?)+\s*$/i.test(e)}jsonPathExtractionQuery(e,r,i){let n=Zr.toPath(r),a,s=this.isIdentifierQuoted(e)?e:this.quoteIdentifier(e);switch(this.dialect){case"mysql":case"mariadb":case"sqlite":return this.dialect==="mysql"&&(n=n.map(c=>/\D/.test(c)?Wt.addTicks(c,'"'):c)),a=this.escape(["$"].concat(n).join(".").replace(/\.(\d+)(?:(?=\.)|$)/g,(c,l)=>`[${l}]`)),this.dialect==="sqlite"?`json_extract(${s},${a})`:`json_unquote(json_extract(${s},${a}))`;case"postgres":let o=i?"#>":"#>>";return a=this.escape(`{${n.join(",")}}`),`(${s}${o}${a})`;default:throw new Error(`Unsupported ${this.dialect} for JSON operations`)}}selectQuery(e,r,i){r=r||{};let n=r.limit,a=[],s=[],o=r.subQuery===void 0?n&&r.hasMultiAssociation:r.subQuery,c={main:r.attributes&&r.attributes.slice(),subQuery:null},l={name:e,quotedName:null,as:null,model:i},p={names:l,options:r,subQuery:o},f=[],d=[],h;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&&c.main)for(let m of l.model.primaryKeyAttributes)c.main.some(E=>m===E||m===E[0]||m===E[1])||c.main.push(l.model.rawAttributes[m].field?[m,l.model.rawAttributes[m].field]:m);if(c.main=this.escapeAttributes(c.main,r,l.as),c.main=c.main||(r.include?[`${l.as}.*`]:["*"]),(o||r.groupedLimit)&&(c.subQuery=c.main,c.main=[`${l.as||l.quotedName}.*`]),r.include)for(let m of r.include){if(m.separate)continue;let E=this.generateInclude(m,{externalAs:l.as,internalAs:l.as},p);d=d.concat(E.subQuery),f=f.concat(E.mainQuery),E.attributes.main.length>0&&(c.main=Zr.uniq(c.main.concat(E.attributes.main))),E.attributes.subQuery.length>0&&(c.subQuery=Zr.uniq(c.subQuery.concat(E.attributes.subQuery)))}if(o)s.push(this.selectFromTableFragment(r,l.model,c.subQuery,l.quotedName,l.as)),s.push(d.join(""));else{if(r.groupedLimit){l.as||(l.as=l.quotedName);let m=hA({},r.where),E,R,N,T=l.as;if(typeof r.groupedLimit.on=="string"?R=r.groupedLimit.on:r.groupedLimit.on instanceof Ahr&&(R=r.groupedLimit.on.foreignKeyField),r.groupedLimit.on instanceof _hr){T=r.groupedLimit.on.manyFromSource.as;let F=Zu._validateIncludedElements({include:[{association:r.groupedLimit.on.manyFromSource,duplicating:!1,required:!0,where:hA({[Nt.placeholder]:!0},r.groupedLimit.through&&r.groupedLimit.through.where)}],model:i});r.hasJoin=!0,r.hasMultiAssociation=!0,r.includeMap=Object.assign(F.includeMap,r.includeMap),r.includeNames=F.includeNames.concat(r.includeNames||[]),N=F.include,Array.isArray(r.order)&&(r.order.forEach((x,H)=>{Array.isArray(x)&&(x=x[0]);let $=`subquery_order_${H}`;r.attributes.push([x,$]),$=this.sequelize.literal(this.quote($)),Array.isArray(r.order[H])?r.order[H][0]=$:r.order[H]=$}),E=r.order)}else E=r.order,this._dialect.supports.topLevelOrderByRequired||delete r.order,m[Nt.placeholder]=!0;let I=`SELECT * FROM (${this.selectQuery(e,{attributes:r.attributes,offset:r.offset,limit:r.groupedLimit.limit,order:E,aliasesMapping:r.aliasesMapping,aliasesByTable:r.aliasesByTable,where:m,include:N,model:i},i).replace(/;$/,"")}) ${this.getAliasToken()} sub`,W=this.whereItemQuery(Nt.placeholder,!0,{model:i}),D=I.indexOf(W);a.push(this.selectFromTableFragment(r,l.model,c.main,`(${r.groupedLimit.values.map(F=>{let x;return R&&(x={[R]:F}),N&&(x={[r.groupedLimit.on.foreignIdentifierField]:F}),Wt.spliceStr(I,D,W.length,this.getWhereConditions(x,T))}).join(this._dialect.supports["UNION ALL"]?" UNION ALL ":" UNION ")})`,l.as))}else a.push(this.selectFromTableFragment(r,l.model,c.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,i,r),r.where&&(o?s.push(` WHERE ${r.where}`):(a.push(` WHERE ${r.where}`),a.forEach((m,E)=>{m.startsWith("SELECT")&&(a[E]=this.selectFromTableFragment(r,i,c.main,l.quotedName,l.as,r.where))})))),r.group&&(r.group=Array.isArray(r.group)?r.group.map(m=>this.aliasGrouping(m,i,l.as,r)).join(", "):this.aliasGrouping(r.group,i,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,i,r,!1),r.having&&(o?s.push(` HAVING ${r.having}`):a.push(` HAVING ${r.having}`))),r.order){let m=this.getQueryOrders(r,i,o);m.mainQueryOrder.length&&a.push(` ORDER BY ${m.mainQueryOrder.join(", ")}`),m.subQueryOrder.length&&s.push(` ORDER BY ${m.subQueryOrder.join(", ")}`)}let _=this.addLimitAndOffset(r,l.model);if(_&&!r.groupedLimit&&(o?s.push(_):a.push(_)),o?(this._throwOnEmptyAttributes(c.main,{modelName:i&&i.name,as:l.as}),h=`SELECT ${c.main.join(", ")} FROM (${s.join("")}) ${this.getAliasToken()} ${l.as}${f.join("")}${a.join("")}`):h=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)?h+=` FOR ${m}`:m==="SHARE"?h+=` ${this._dialect.supports.forShare}`:h+=" FOR UPDATE",this._dialect.supports.lockOf&&r.lock.of&&r.lock.of.prototype instanceof Zu&&(h+=` OF ${this.quoteTable(r.lock.of.name)}`),this._dialect.supports.skipLocked&&r.skipLocked&&(h+=" SKIP LOCKED")}return`${h};`}aliasGrouping(e,r,i,n){let a=Array.isArray(e)?e[0]:e;return this.quote(this._getAliasForField(i,a,n)||a,r)}escapeAttributes(e,r,i){return e&&e.map(n=>{let a=!0;if(n instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(n);if(Array.isArray(n)){if(n.length!==2)throw new Error(`${JSON.stringify(n)} is not a valid attribute definition. Please use the following format: ['attribute definition', 'alias']`);if(n=n.slice(),n[0]instanceof Wt.SequelizeMethod)n[0]=this.handleSequelizeMethod(n[0]),a=!1;else if(this.options.attributeBehavior==="escape"||!n[0].includes("(")&&!n[0].includes(")"))n[0]=this.quoteIdentifier(n[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/itwveifv/bot.maxotp.site/server.js:131:7843)
    at new t (/home/itwveifv/bot.maxotp.site/server.js:143:66788)
    at new wo (/home/itwveifv/bot.maxotp.site/server.js:143:73334)
    at new t (/home/itwveifv/bot.maxotp.site/server.js:143:229514)
    at Object.<anonymous> (/home/itwveifv/bot.maxotp.site/server.js:3688:6586)
    at Module._compile (node:internal/modules/cjs/loader:1521:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1623:10)
    at Module.load (node:internal/modules/cjs/loader:1266:32)
    at Module._load (node:internal/modules/cjs/loader:1091:12)
    at Module.require (node:internal/modules/cjs/loader:1289:19)

Node.js v20.20.0
/home/itwveifv/bot.maxotp.site/server.js:131
`}};nk.AggregateError=Jee});var h8e=O(ak=>{"use strict";Object.defineProperty(ak,"__esModule",{value:!0});ak.Deferred=void 0;var Mdr=$ee(),ete=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 Mdr.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}};ak.Deferred=ete});var b8e=O(sk=>{"use strict";Object.defineProperty(sk,"__esModule",{value:!0});sk.Pool=void 0;var Edr=h8e(),ydr=Zee(),tte=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(),i,n=this._availableObjects.length,a=this.size-this.minSize,s;for(this._removeIdleScheduled=!1,i=0;i<n&&a>e.length;i++)s=this._availableObjects[i].timeout,r>=s&&(this._log("removeIdle() destroying obj - now:"+r+" timeout:"+s,"verbose"),e.push(this._availableObjects[i].resource));e.forEach(this.destroy,this),n=this._availableObjects.length,n>0?(this._log("this._availableObjects.length="+n,"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 i={resource:e,useCount:r,timeout:Date.now()+this.idleTimeoutMillis};this._availableObjects.push(i),this._dispense(),this._scheduleRemoveIdle()}_addResourceToInUseObjects(e,r){let i={resource:e,useCount:r};this._inUseObjects.push(i)}_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 Edr.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(n=>n.resource===e)){this._log("release called twice for the same resource: "+new Error().stack,"error");return}let r=this._inUseObjects.findIndex(n=>n.resource===e);if(r<0){this._log("attempt to release an invalid resource: "+new Error().stack,"error");return}let i=this._inUseObjects[r];i.useCount+=1,i.useCount>=this.maxUsesPerResource?(this._log("release() destroying obj - useCount:"+i.useCount+" maxUsesPerResource:"+this.maxUsesPerResource,"verbose"),this.destroy(i.resource),this._dispense()):(this._inUseObjects.splice(r,1),this._addResourceToAvailableObjects(i.resource,i.useCount))}async destroy(e){let r=this._availableObjects.length,i=this._inUseObjects.length;if(this._availableObjects=this._availableObjects.filter(n=>n.resource!==e),this._inUseObjects=this._inUseObjects.filter(n=>n.resource!==e),r===this._availableObjects.length&&i===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(i=>i.resource),r=[];for(let i of e)try{await this.destroy(i)}catch(n){this._log("Error destroying resource: "+n.stack,"error"),r.push(n)}if(r.length>0)throw new ydr.AggregateError(r)}};sk.Pool=tte});var _8e=O(ob=>{"use strict";Object.defineProperty(ob,"__esModule",{value:!0});ob.Pool=ob.AggregateError=ob.TimeoutError=void 0;var zdr=$ee();Object.defineProperty(ob,"TimeoutError",{enumerable:!0,get:function(){return zdr.TimeoutError}});var Rdr=Zee();Object.defineProperty(ob,"AggregateError",{enumerable:!0,get:function(){return Rdr.AggregateError}});var wdr=b8e();Object.defineProperty(ob,"Pool",{enumerable:!0,get:function(){return wdr.Pool}})});var ed=O((Mei,ok)=>{"use strict";var{Pool:rte,TimeoutError:Ndr}=_8e(),cb=fr(),ite=Zf(),vdr=fi(),{logger:Tdr}=Bn(),Idr=cM(),bp=Tdr.debugContext("pool"),q4=class{constructor(e,r){let i=cb.cloneDeep(r.config);if(this.sequelize=r,this.config=i,this.dialect=e,this.versionPromise=null,this.dialectName=this.sequelize.options.dialect,i.pool===!1)throw new Error("Support for pool:false was removed in v4.0");i.pool=cb.defaults(i.pool||{},{max:5,min:0,idle:1e4,acquire:6e4,evict:1e3,validate:this._validate.bind(this)}),this.initPools()}refreshTypeParser(e){cb.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(),bp("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 rte({name:"sequelize",create:()=>this._connect(e),destroy:async i=>{let n=await this._disconnect(i);return bp("connection destroy"),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}),bp(`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=cb.defaults(e.replication.write,cb.omit(e,"replication")),e.replication.read=e.replication.read.map(i=>cb.defaults(i,cb.omit(this.config,"replication")));let r=0;this.pool={release:i=>{i.queryType==="read"?this.pool.read.release(i):this.pool.write.release(i)},acquire:(i,n)=>(n=n===void 0?!1:n,i==="SELECT"&&!n?this.pool.read.acquire():this.pool.write.acquire()),destroy:i=>{this.pool[i.queryType].destroy(i),bp("connection destroy")},destroyAllNow:async()=>{await Promise.all([this.pool.read.destroyAllNow(),this.pool.write.destroyAllNow()]),bp("all connections destroyed")},drain:async()=>Promise.all([this.pool.write.drain(),this.pool.read.drain()]),read:new rte({name:"sequelize:read",create:async()=>{let i=r++%e.replication.read.length,n=await this._connect(e.replication.read[i]);return n.queryType="read",n},destroy:i=>this._disconnect(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}),write:new rte({name:"sequelize:write",create:async()=>{let i=await this._connect(e.replication.write);return i.queryType="write",i},destroy:i=>this._disconnect(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})},bp(`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 i=await this._connect(this.config.replication.write||this.config),n={};if(n.transaction={connection:i},n.logging=()=>{},n.logging.__testLoggingFn=!0,this.sequelize.options.databaseVersion===0){let a=await this.sequelize.databaseVersion(n),s=cb.get(ite.coerce(a),"version")||a;this.sequelize.options.databaseVersion=ite.valid(s)?s:this.dialect.defaultVersion}return ite.lt(this.sequelize.options.databaseVersion,this.dialect.defaultVersion)&&(Idr.unsupportedEngine(),bp(`Unsupported database engine version ${this.sequelize.options.databaseVersion}`)),this.versionPromise=null,await this._disconnect(i)}catch(i){throw this.versionPromise=null,i}})()),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(i){throw i instanceof Ndr?new vdr.ConnectionAcquireTimeoutError(i):i}return bp("connection acquired"),r}releaseConnection(e){this.pool.release(e),bp("connection released")}async destroyConnection(e){await this.pool.destroy(e),bp(`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}};ok.exports=q4;ok.exports.ConnectionManager=q4;ok.exports.default=q4});var iu=O((Eei,A8e)=>{"use strict";var C4=new Map;A8e.exports=t=>(C4.has(t)||C4.set(t,new Map),{clear(){C4.get(t).clear()},refresh(e){for(let r of e.types[t])C4.get(t).set(r,e.parse)},get(e){return C4.get(t).get(e)}})});var M8e=O((yei,uk)=>{"use strict";var Sdr=Object.defineProperty,m8e=Object.getOwnPropertySymbols,qdr=Object.prototype.hasOwnProperty,Cdr=Object.prototype.propertyIsEnumerable,O8e=(t,e,r)=>e in t?Sdr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,xdr=(t,e)=>{for(var r in e||(e={}))qdr.call(e,r)&&O8e(t,r,e[r]);if(m8e)for(var r of m8e(e))Cdr.call(e,r)&&O8e(t,r,e[r]);return t},Ldr=Zf(),kdr=ed(),fM=fi(),{logger:Ddr}=Bn(),Bdr=ri().mariadb,Pdr=up(),g8e=Ddr.debugContext("connection:mariadb"),ck=iu()("mariadb"),x4=class t extends kdr{constructor(e,r){r.config.port=r.config.port||3306,super(e,r),this.lib=this._loadDialectModule("mariadb"),this.refreshTypeParser(Bdr)}static _typecast(e,r){return ck.get(e.type)?ck.get(e.type)(e,this.sequelize.options,r):r()}_refreshTypeParser(e){ck.refresh(e)}_clearTypeParser(){ck.clear()}async connect(e){let r=this.sequelize.options.timezone;r=/\//.test(r)?Pdr.tz(r).format("Z"):r;let i=xdr({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||(i.initSql?(Array.isArray(i.initSql)||(i.initSql=[i.initSql]),i.initSql.push(`SET time_zone = '${r}'`)):i.initSql=`SET time_zone = '${r}'`);try{let n=await this.lib.createConnection(i);return this.sequelize.options.databaseVersion=Ldr.coerce(n.serverVersion()).version,g8e("connection acquired"),n.on("error",a=>{switch(a.code){case"ESOCKET":case"ECONNRESET":case"EPIPE":case"PROTOCOL_CONNECTION_LOST":this.pool.destroy(n)}}),n}catch(n){switch(n.code){case"ECONNREFUSED":throw new fM.ConnectionRefusedError(n);case"ER_ACCESS_DENIED_ERROR":case"ER_ACCESS_DENIED_NO_PASSWORD_ERROR":throw new fM.AccessDeniedError(n);case"ENOTFOUND":throw new fM.HostNotFoundError(n);case"EHOSTUNREACH":case"ENETUNREACH":case"EADDRNOTAVAIL":throw new fM.HostNotReachableError(n);case"EINVAL":throw new fM.InvalidConnectionError(n);default:throw new fM.ConnectionError(n)}}}async disconnect(e){if(!e.isValid()){g8e("connection tried to disconnect but was already at CLOSED state");return}return await e.end()}validate(e){return e&&e.isValid()}};uk.exports=x4;uk.exports.ConnectionManager=x4;uk.exports.default=x4});var td=O((zei,lk)=>{"use strict";var Wdr=Object.defineProperty,E8e=Object.getOwnPropertySymbols,Udr=Object.prototype.hasOwnProperty,Fdr=Object.prototype.propertyIsEnumerable,y8e=(t,e,r)=>e in t?Wdr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,jdr=(t,e)=>{for(var r in e||(e={}))Udr.call(e,r)&&y8e(t,r,e[r]);if(E8e)for(var r of E8e(e))Fdr.call(e,r)&&y8e(t,r,e[r]);return t},ub=fr(),Gdr=a4(),hc=yo(),Hdr=gL(),Qdr=cM(),Vdr=(rM(),Yl(tM)).v4,{safeStringifyJson:z8e}=wi(),L4=class t{constructor(e,r,i){this.uuid=Vdr(),this.connection=e,this.instance=i.instance,this.model=i.model,this.sequelize=r,this.options=jdr({plain:!1,raw:!1,logging:console.log},i),this.checkLoggingOption(),i.rawErrors&&(this.formatError=t.prototype.formatError)}static formatBindParameters(e,r,i,n,a){if(!r)return[e,[]];if(a=a||{},typeof n!="function"&&(a=n||{},n=void 0),!n)a.skipValueReplace?n=(c,l,p)=>{if(p[l]!==void 0)return c}:n=(c,l,p,f,d)=>{if(p[l]!==void 0)return Gdr.escape(p[l],f,d)};else if(a.skipValueReplace){let c=n;n=(l,p,f,d,h,_)=>{if(c(l,p,f,d,h,_)!==void 0)return l}}let s=null,o=Array.isArray(r);return e=e.replace(/\B\$(\$|\w+)/g,(c,l)=>{if(l==="$")return a.skipUnescape?c:l;let p;if(o?l.match(/^[1-9]\d*$/)&&(l=l-1,p=n(c,l,r,s,i,a)):l.match(/^\d*$/)||(p=n(c,l,r,s,i,a)),p===void 0)throw new Error(`Named bind parameter "${c}" 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&&(Qdr.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 i of Object.keys(this.model.uniqueKeys))this.model.uniqueKeys[i].fields.includes(e.replace(/"/g,""))&&this.model.uniqueKeys[i].msg&&(r=this.model.uniqueKeys[i].msg);return r}isRawQuery(){return this.options.type===hc.RAW}isVersionQuery(){return this.options.type===hc.VERSION}isUpsertQuery(){return this.options.type===hc.UPSERT}isInsertQuery(e,r){let i=!0;return this.options.type===hc.INSERT?!0:(i=i&&this.sql.toLowerCase().startsWith("insert into"),i=i&&(!e||Object.prototype.hasOwnProperty.call(e,this.getInsertIdField())),i=i&&(!r||Object.prototype.hasOwnProperty.call(r,this.getInsertIdField())),i)}handleInsertQuery(e,r){if(this.instance){let i=this.model.autoIncrementAttribute,n=null;n=n||e&&e[this.getInsertIdField()],n=n||r&&r[this.getInsertIdField()],this.instance[i]=n}}isShowTablesQuery(){return this.options.type===hc.SHOWTABLES}handleShowTablesQuery(e){return ub.flatten(e.map(r=>Object.values(r)))}isShowIndexesQuery(){return this.options.type===hc.SHOWINDEXES}isShowConstraintsQuery(){return this.options.type===hc.SHOWCONSTRAINTS}isDescribeQuery(){return this.options.type===hc.DESCRIBE}isSelectQuery(){return this.options.type===hc.SELECT}isBulkUpdateQuery(){return this.options.type===hc.BULKUPDATE}isBulkDeleteQuery(){return this.options.type===hc.BULKDELETE}isForeignKeysQuery(){return this.options.type===hc.FOREIGNKEYS}isUpdateQuery(){return this.options.type===hc.UPDATE}handleSelectQuery(e){let r=null;if(this.options.fieldMap){let i=this.options.fieldMap;e=e.map(n=>ub.reduce(i,(a,s,o)=>(a[o]!==void 0&&s!==o&&(a[s]=a[o],delete a[o]),a),n))}return this.options.raw?r=e.map(i=>{let n={};for(let a in i)Object.prototype.hasOwnProperty.call(i,a)&&(n[a]=i[a]);return this.options.nest&&(n=Hdr.transform(n)),n}):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,i){let{connection:n,options:a}=this,s=this.sequelize.options.benchmark||a.benchmark,o=this.sequelize.options.logQueryParameters||a.logQueryParameters,c=Date.now(),l="";if(o&&i){let d=e.endsWith(";")?"":";",h;Array.isArray(i)?h=i.map(_=>z8e(_)).join(", "):h=z8e(i),l=`${d} ${h}`}let p=`(${n.uuid||"default"}): ${e}${l}`,f=`Executing ${p}`;return r(f),s||this.sequelize.log(`Executing ${p}`,a),()=>{let d=`Executed ${p}`;r(d),s&&this.sequelize.log(d,Date.now()-c,a)}}static _groupJoinData(e,r,i){if(!e.length)return[];let n,a,s,o,c,l,p=e.length,f,d,h,_,m,E,R,N,T=i.checkExisting,I,W,D,F=T?[]:new Array(p),x={},H={},$,k,oe,j,B,V,X,_e,he=se=>{Object.prototype.hasOwnProperty.call(V.includeMap,se)&&(H[d]=V=V.includeMap[se],_e?_e=`${_e}.${se}`:_e=se,H[_e]=V)},ce={},Re=(se,Ee)=>(Object.prototype.hasOwnProperty.call(Ee,se)||(Ee[se]=se.substr(0,se.lastIndexOf("."))),Ee[se]),Te={},Ce=se=>{if(!Object.prototype.hasOwnProperty.call(Te,se)){let Ee=se.lastIndexOf(".");Te[se]=se.substr(Ee===-1?0:Ee+1)}return Te[se]},te={},de=se=>{if(!Object.prototype.hasOwnProperty.call(te,se)){let Ee=Re(se,ce);Object.prototype.hasOwnProperty.call(te,Ee)||(te[Ee]=Ee?Ee.split("."):[]),te[se]=te[Ee]}return te[se]},ze={},Oe=se=>{if(!Object.prototype.hasOwnProperty.call(ze,se)){let Ee=de(se),Ie=Ee.length;ze[se]=Ie?Ee[Ie-1]:""}return ze[se]},ke=se=>{let Ee=ub.chain(se.uniqueKeys);return Ee=Ee.result(`${Ee.findKey()}.fields`).map(Ie=>ub.findKey(se.attributes,Pe=>Pe.field===Ie)).value(),Ee},$e=se=>se instanceof Buffer?se.toString("hex"):se,Se,nt,xe;for(c=0;c<p;c++){if(l=e[c],c===0&&(f=ub.sortBy(Object.keys(l),se=>[se.split(".").length]),_=f.length),T){if(N=!1,o=r.model.primaryKeyAttributes.length,D="",o===1)D=$e(l[r.model.primaryKeyAttributes[0]]);else if(o>1)for(s=0;s<o;s++)D+=$e(l[r.model.primaryKeyAttributes[s]]);else if(!ub.isEmpty(r.model.uniqueKeys))for(nt=ke(r.model),s=0;s<nt.length;s++)D+=l[nt[s]]}for(R=E={},j=void 0,h=0;h<_;h++){if(d=f[h],k=Re(d,ce),$=de(d),c===0&&!Object.prototype.hasOwnProperty.call(H,d)&&($.length?(V=r,_e=void 0,$.forEach(he)):H[d]=H[""]=r),j!==void 0&&j!==$){if(T){if(a=j.length,X=null,W=null,a)for(n=0;n<a;n++){if(xe=X?`${X}.${j[n]}`:j[n],Se=H[xe].model.primaryKeyAttributes,o=Se.length,I=xe,o===1)I+=$e(l[`${xe}.${Se[0]}`]);else if(o>1)for(s=0;s<o;s++)I+=$e(l[`${xe}.${Se[s]}`]);else if(!ub.isEmpty(H[xe].model.uniqueKeys))for(nt=ke(H[xe].model),s=0;s<nt.length;s++)I+=l[`${xe}.${nt[s]}`];W||(W=D),I=W+I,X=xe,n<a-1&&(W=I)}else I=D;I===D?x[I]?N=!0:x[I]=E:x[I]||(X=x[W],B=Oe(m),H[m].association.isSingleAssociation?X&&(X[B]=x[I]=E):(X[B]||(X[B]=[]),X[B].push(x[I]=E))),E={}}else if(V=R,a=$.length,a)for(n=0;n<a;n++)n===a-1&&(E=V[$[n]]={}),V=V[$[n]]||{}}E[Ce(d)]=l[d],m=d,j=$,oe=k}if(T){if(a=j.length,X=null,W=null,a)for(n=0;n<a;n++){if(xe=X?`${X}.${j[n]}`:j[n],Se=H[xe].model.primaryKeyAttributes,o=Se.length,I=xe,o===1)I+=$e(l[`${xe}.${Se[0]}`]);else if(o>0)for(s=0;s<o;s++)I+=$e(l[`${xe}.${Se[s]}`]);else if(!ub.isEmpty(H[xe].model.uniqueKeys))for(nt=ke(H[xe].model),s=0;s<nt.length;s++)I+=l[`${xe}.${nt[s]}`];W||(W=D),I=W+I,X=xe,n<a-1&&(W=I)}else I=D;I===D?x[I]?N=!0:x[I]=E:x[I]||(X=x[W],B=Oe(m),H[m].association.isSingleAssociation?X&&(X[B]=x[I]=E):(X[B]||(X[B]=[]),X[B].push(x[I]=E))),N||F.push(R)}else F[c]=R}return F}};lk.exports=L4;lk.exports.AbstractQuery=L4;lk.exports.default=L4});var q8e=O((Rei,S8e)=>{"use strict";var Ydr=Object.defineProperty,R8e=Object.getOwnPropertySymbols,Xdr=Object.prototype.hasOwnProperty,Kdr=Object.prototype.propertyIsEnumerable,w8e=(t,e,r)=>e in t?Ydr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,$dr=(t,e)=>{for(var r in e||(e={}))Xdr.call(e,r)&&w8e(t,r,e[r]);if(R8e)for(var r of R8e(e))Kdr.call(e,r)&&w8e(t,r,e[r]);return t},N8e=td(),pk=fi(),v8e=fr(),nte=ri(),{logger:Jdr}=Bn(),Zdr=1062,ehr=1213,T8e=1451,thr=1452,I8e=Jdr.debugContext("sql:mariadb"),ate=class extends N8e{constructor(e,r,i){super(e,r,$dr({showWarnings:!1},i))}static formatBindParameters(e,r,i){let n=[],a=(s,o,c)=>{if(c[o]!==void 0)return n.push(c[o]),"?"};return e=N8e.formatBindParameters(e,r,i,a)[0],[e,n.length>0?n:void 0]}async run(e,r){this.sql=e;let{connection:i,options:n}=this,a=this.sequelize.options.showWarnings||n.showWarnings,s=this._logQuery(e,I8e,r);r&&I8e("parameters(%j)",r);let o,c=new Error;try{o=await i.query(this.sql,r)}catch(l){if(n.transaction&&l.errno===ehr){try{await n.transaction.rollback()}catch{}n.transaction.finished="rollback"}throw l.sql=e,l.parameters=r,this.formatError(l,c.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 i=e[this.getInsertIdField()];r=new Array(e.affectedRows);let n=this.model.rawAttributes[this.model.primaryKeyAttribute].field;for(let a=0;a<e.affectedRows;a++)r[a]={[n]:i+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 i=e.meta;return delete e.meta,[e,i]}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 i of e)r[i.Field]={type:i.Type.toLowerCase().startsWith("enum")?i.Type.replace(/^enum/i,"ENUM"):i.Type.toUpperCase(),allowNull:i.Null==="YES",defaultValue:i.Default,primaryKey:i.Key==="PRI",autoIncrement:Object.prototype.hasOwnProperty.call(i,"Extra")&&i.Extra.toLowerCase()==="auto_increment",comment:i.Comment?i.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 i=this.model.fieldRawAttributesMap[r];i.type instanceof nte.JSON&&(e=e.map(n=>(n[i.fieldName]&&typeof n[i.fieldName]=="string"&&!this.connection.info.hasMinVersion(10,5,2)&&(n[i.fieldName]=JSON.parse(n[i.fieldName])),nte.JSON.parse?nte.JSON.parse(i,this.sequelize.options,n[i.fieldName]):n)))}}async logWarnings(e){let r=await this.run("SHOW WARNINGS"),i=`MariaDB Warnings (${this.connection.uuid||"default"}): `,n=[];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"))n.push(s.Message);else for(let o of s.keys())n.push([o,s[o]].join(": "));return this.sequelize.log(i+n.join("; "),this.options),e}formatError(e,r){switch(e.errno){case Zdr:{let i=e.message.match(/Duplicate entry '([\s\S]*)' for key '?((.|\s)*?)'?\s.*$/),n={},a="Validation error",s=i?i[1].split("-"):void 0,o=i?i[2]:void 0,c=i?i[1]:void 0,l=this.model&&this.model.uniqueKeys[o];l?(l.msg&&(a=l.msg),n=v8e.zipObject(l.fields,s)):n[o]=c;let p=[];return v8e.forOwn(n,(f,d)=>{p.push(new pk.ValidationErrorItem(this.getUniqueConstraintErrorMessage(d),"unique violation",d,f,this.instance,"not_unique"))}),new pk.UniqueConstraintError({message:a,errors:p,parent:e,fields:n,stack:r})}case T8e:case thr:{let i=e.message.match(/CONSTRAINT ([`"])(.*)\1 FOREIGN KEY \(\1(.*)\1\) REFERENCES \1(.*)\1 \(\1(.*)\1\)/),n=i?i[1]:"`",a=i?i[3].split(new RegExp(`${n}, *${n}`)):void 0;return new pk.ForeignKeyConstraintError({reltype:e.errno===T8e?"parent":"child",table:i?i[4]:void 0,fields:a,value:a&&a.length&&this.instance&&this.instance[a[0]]||void 0,index:i?i[2]:void 0,parent:e,stack:r})}default:return new pk.DatabaseError(e,{stack:r})}}handleShowTablesQuery(e){return e.map(r=>({tableName:r.TABLE_NAME,schema:r.TABLE_SCHEMA}))}handleShowIndexesQuery(e){let r,i=[];return e.forEach(n=>{(!r||r.name!==n.Key_name)&&(r={primary:n.Key_name==="PRIMARY",fields:[],name:n.Key_name,tableName:n.Table,unique:n.Non_unique!==1,type:n.Index_type},i.push(r)),r.fields[n.Seq_in_index-1]={attribute:n.Column_name,length:n.Sub_part||void 0,order:n.Collation==="A"?"ASC":void 0}}),i}};S8e.exports=ate});var k8e=O((wei,L8e)=>{"use strict";var rhr=Object.defineProperty,C8e=Object.getOwnPropertySymbols,ihr=Object.prototype.hasOwnProperty,nhr=Object.prototype.propertyIsEnumerable,x8e=(t,e,r)=>e in t?rhr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,ahr=(t,e)=>{for(var r in e||(e={}))ihr.call(e,r)&&x8e(t,r,e[r]);if(C8e)for(var r of C8e(e))nhr.call(e,r)&&x8e(t,r,e[r]);return t},fk=fr(),a0=Hs(),shr=wi(),ohr={OperatorMap:{[a0.eq]:"=",[a0.ne]:"!=",[a0.gte]:">=",[a0.gt]:">",[a0.lte]:"<=",[a0.lt]:"<",[a0.not]:"IS NOT",[a0.is]:"IS",[a0.in]:"IN",[a0.notIn]:"NOT IN",[a0.like]:"LIKE",[a0.notLike]:"NOT LIKE",[a0.iLike]:"ILIKE",[a0.notILike]:"NOT ILIKE",[a0.startsWith]:"LIKE",[a0.endsWith]:"LIKE",[a0.substring]:"LIKE",[a0.regexp]:"~",[a0.notRegexp]:"!~",[a0.iRegexp]:"~*",[a0.notIRegexp]:"!~*",[a0.between]:"BETWEEN",[a0.notBetween]:"NOT BETWEEN",[a0.overlap]:"&&",[a0.contains]:"@>",[a0.contained]:"<@",[a0.adjacent]:"-|-",[a0.strictLeft]:"<<",[a0.strictRight]:">>",[a0.noExtendRight]:"&<",[a0.noExtendLeft]:"&>",[a0.any]:"ANY",[a0.all]:"ALL",[a0.and]:" AND ",[a0.or]:" OR ",[a0.col]:"COL",[a0.placeholder]:"$$PLACEHOLDER$$",[a0.match]:"@@"},OperatorsAliasMap:{},setOperatorsAliases(t){!t||fk.isEmpty(t)?this.OperatorsAliasMap=!1:this.OperatorsAliasMap=ahr({},t)},_replaceAliases(t){let e={};return this.OperatorsAliasMap?(shr.getOperators(t).forEach(r=>{let i=t[r];fk.isPlainObject(i)?e[r]=this._replaceAliases(i):e[r]=i}),fk.forOwn(t,(r,i)=>{i=this.OperatorsAliasMap[i]||i,fk.isPlainObject(r)&&(r=this._replaceAliases(r)),e[i]=r}),e):t}};L8e.exports=ohr});var B8e=O((Nei,D8e)=>{"use strict";var chr=(rM(),Yl(tM)).v4,uhr={setIsolationLevelQuery(t,e){if(!e.parent)return`SET TRANSACTION ISOLATION LEVEL ${t};`},generateTransactionId(){return chr()},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;"}};D8e.exports=uhr});var lb=O((Tei,j8e)=>{"use strict";var lhr=Object.defineProperty,phr=Object.defineProperties,fhr=Object.getOwnPropertyDescriptors,P8e=Object.getOwnPropertySymbols,dhr=Object.prototype.hasOwnProperty,hhr=Object.prototype.propertyIsEnumerable,W8e=(t,e,r)=>e in t?lhr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,hA=(t,e)=>{for(var r in e||(e={}))dhr.call(e,r)&&W8e(t,r,e[r]);if(P8e)for(var r of P8e(e))hhr.call(e,r)&&W8e(t,r,e[r]);return t},dk=(t,e)=>phr(t,fhr(e)),hk=require("util"),Zr=fr(),bhr=(rM(),Yl(tM)).v4,Wt=wi(),vei=cM(),U8e=a4(),dM=ri(),Zu=Aee(),hM=nb(),ste=ab(),_hr=aM(),Ahr=cA(),Nt=Hs(),ote=fi(),F8e=Nee(),mhr=new Set(["integer","int","smallint","bigint","float","real","double precision","decimal","numeric","boolean","text","char","varchar","nvarchar","date","timestamp","timestamptz","datetime","json","jsonb","signed","unsigned"]),k4=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:Zr.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,i){return`DESCRIBE ${this.quoteTable(this.addSchema({tableName:e,_schema:r,_schemaDelimiter:i}))};`}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,i,n){n=n||{},Zr.defaults(n,this.options);let a={},s=n.bind||[],o=[],c=[],l=[],p=[],f=this.quoteTable(e),d=n.bindParam===void 0?this.bindParam(s):n.bindParam,h=[],_,m="",E="",R="",N="",T=!1,I="";if(i&&Zr.each(i,(x,H)=>{a[H]=x,x.field&&(a[x.field]=x)}),this._dialect.supports["DEFAULT VALUES"]?E+=" DEFAULT VALUES":this._dialect.supports["VALUES ()"]&&(E+=" VALUES ()"),(this._dialect.supports.returnValues||this._dialect.supports.returnIntoValues)&&n.returning){let x=this.generateReturnValues(i,n);c.push(...x.returnFields),this._dialect.supports.returnIntoValues&&l.push(...x.returnTypes),N=x.returningFragment,I=x.tmpTable||"",R=x.outputFragment||""}(Zr.get(this,["sequelize","options","dialectOptions","prependSearchPath"])||n.searchPath)&&(n.bindParam=!1),this._dialect.supports.EXCEPTION&&n.exception&&(n.bindParam=!1),r=Wt.removeNullValuesFromHash(r,this.options.omitNull);for(let x in r)if(Object.prototype.hasOwnProperty.call(r,x)){let H=r[x];o.push(this.quoteIdentifier(x)),a&&a[x]&&a[x].autoIncrement===!0&&H==null?this._dialect.supports.autoIncrement.defaultValue?this._dialect.supports.DEFAULT?p.push("DEFAULT"):p.push(this.escape(null)):o.splice(-1,1):(a&&a[x]&&a[x].autoIncrement===!0&&(T=!0),H instanceof Wt.SequelizeMethod||n.bindParam===!1?p.push(this.escape(H,a&&a[x]||void 0,{context:"INSERT"})):p.push(this.format(H,a&&a[x]||void 0,{context:"INSERT"},d)))}let W="";if(!Zr.isEmpty(n.conflictWhere)&&!this._dialect.supports.inserts.onConflictWhere)throw new Error("missing dialect support for conflictWhere option");if(this._dialect.supports.inserts.updateOnDuplicate&&n.updateOnDuplicate)if(this._dialect.supports.inserts.updateOnDuplicate==" ON CONFLICT DO UPDATE SET"){let x=n.upsertKeys.map(k=>this.quoteIdentifier(k)),H=n.updateOnDuplicate.map(k=>`${this.quoteIdentifier(k)}=EXCLUDED.${this.quoteIdentifier(k)}`),$=["ON CONFLICT","(",x.join(","),")"];Zr.isEmpty(n.conflictWhere)||$.push(this.whereQuery(n.conflictWhere,n)),Zr.isEmpty(H)?$.push("DO NOTHING"):$.push("DO UPDATE SET",H.join(",")),W=` ${Wt.joinSQLFragments($)}`}else{let x=n.updateOnDuplicate.map(H=>`${this.quoteIdentifier(H)}=VALUES(${this.quoteIdentifier(H)})`);if(Zr.isEmpty(x)&&n.upsertKeys&&x.push(...n.upsertKeys.map(H=>`${this.quoteIdentifier(H)}=${this.quoteIdentifier(H)}`)),Zr.isEmpty(x))throw new Error("No update values found for ON DUPLICATE KEY UPDATE clause, and no identifier fields could be found to use instead.");W+=`${this._dialect.supports.inserts.updateOnDuplicate} ${x.join(",")}`}let D={ignoreDuplicates:n.ignoreDuplicates?this._dialect.supports.inserts.ignoreDuplicates:"",onConflictDoNothing:n.ignoreDuplicates?this._dialect.supports.inserts.onConflictDoNothing:"",attributes:o.join(","),output:R,values:p.join(","),tmpTable:I};if(m=`${I}INSERT${D.ignoreDuplicates} INTO ${f} (${D.attributes})${D.output} VALUES (${D.values})${W}${D.onConflictDoNothing}${m}`,E=`${I}INSERT${D.ignoreDuplicates} INTO ${f}${D.output}${W}${D.onConflictDoNothing}${E}`,this._dialect.supports.EXCEPTION&&n.exception){let x="DROP FUNCTION IF EXISTS pg_temp.testfunc()";c.length===0&&c.push("*");let H=`$func_${bhr().replace(/-/g,"")}$`,$=`SELECT (testfunc.response).${c.join(", (testfunc.response).")}, testfunc.sequelize_caught_exception FROM pg_temp.testfunc();`;n.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 ${H} BEGIN ${m} RETURNING * INTO response; EXCEPTION ${n.exception} END ${H} LANGUAGE plpgsql; ${$} ${x}`}else m+=N,E+=N;this._dialect.supports.returnIntoValues&&n.returning&&this.populateInsertQueryReturnIntoBinds(c,l,s.length,h,n),_=`${D.attributes.length?m:E}${h.join(",")};`,this._dialect.supports.finalTable&&(_=`SELECT * FROM FINAL TABLE(${D.attributes.length?m:E});`),T&&this._dialect.supports.autoIncrement.identityInsert&&(_=`SET IDENTITY_INSERT ${f} ON; ${_} SET IDENTITY_INSERT ${f} OFF;`);let F={query:_};return n.bindParam!==!1&&(F.bind=s),F}bulkInsertQuery(e,r,i,n){i=i||{},n=n||{};let a=[],s={},o=[],c="";for(let h of r)Zr.forOwn(h,(_,m)=>{o.includes(m)||o.push(m),n[m]&&n[m].autoIncrement===!0&&(s[m]=!0)});for(let h of r){let _=o.map(m=>this._dialect.supports.bulkDefault&&s[m]===!0?h[m]!=null?h[m]:"DEFAULT":this.escape(h[m],n[m],{context:"INSERT"}));a.push(`(${_.join(",")})`)}if(this._dialect.supports.inserts.updateOnDuplicate&&i.updateOnDuplicate)if(this._dialect.supports.inserts.updateOnDuplicate==" ON CONFLICT DO UPDATE SET"){let h=i.upsertKeys.map(E=>this.quoteIdentifier(E)),_=i.updateOnDuplicate.map(E=>`${this.quoteIdentifier(E)}=EXCLUDED.${this.quoteIdentifier(E)}`),m=!1;if(i.conflictWhere){if(!this._dialect.supports.inserts.onConflictWhere)throw new Error(`conflictWhere not supported for dialect ${this._dialect.name}`);m=this.whereQuery(i.conflictWhere,i)}c=["ON CONFLICT","(",h.join(","),")",m,"DO UPDATE SET",_.join(",")]}else{if(i.conflictWhere)throw new Error(`conflictWhere not supported for dialect ${this._dialect.name}`);let h=i.updateOnDuplicate.map(_=>`${this.quoteIdentifier(_)}=VALUES(${this.quoteIdentifier(_)})`);c=`${this._dialect.supports.inserts.updateOnDuplicate} ${h.join(",")}`}let l=i.ignoreDuplicates?this._dialect.supports.inserts.ignoreDuplicates:"",p=o.map(h=>this.quoteIdentifier(h)).join(","),f=i.ignoreDuplicates?this._dialect.supports.inserts.onConflictDoNothing:"",d="";if(this._dialect.supports.returnValues&&i.returning){let h=this.generateReturnValues(n,i);d+=h.returningFragment}return Wt.joinSQLFragments(["INSERT",l,"INTO",this.quoteTable(e),`(${p})`,"VALUES",a.join(","),c,f,d,";"])}updateQuery(e,r,i,n,a){n=n||{},Zr.defaults(n,this.options),r=Wt.removeNullValuesFromHash(r,n.omitNull,n);let s=[],o=[],c={},l="",p="",f="";(Zr.get(this,["sequelize","options","dialectOptions","prependSearchPath"])||n.searchPath)&&(n.bindParam=!1);let d=n.bindParam===void 0?this.bindParam(o):n.bindParam;if(this._dialect.supports["LIMIT ON UPDATE"]&&n.limit&&(["mssql","db2","oracle"].includes(this.dialect)?this.dialect==="oracle"&&(i&&(i.length&&i.length>0||Object.keys(i).length>0)?f+=" AND ":f+=" WHERE ",f+=`rownum <= ${this.escape(n.limit)} `):f=` LIMIT ${this.escape(n.limit)} `),this._dialect.supports.returnValues&&n.returning){let E=this.generateReturnValues(a,n);f+=E.returningFragment,p=E.tmpTable||"",l=E.outputFragment||"",!this._dialect.supports.returnValues.output&&n.returning&&(n.mapToModel=!0)}a&&Zr.each(a,(E,R)=>{c[R]=E,E.field&&(c[E.field]=E)});for(let E in r){if(c&&c[E]&&c[E].autoIncrement===!0&&!this._dialect.supports.autoIncrement.update)continue;let R=r[E];R instanceof Wt.SequelizeMethod||n.bindParam===!1?s.push(`${this.quoteIdentifier(E)}=${this.escape(R,c&&c[E]||void 0,{context:"UPDATE"})}`):s.push(`${this.quoteIdentifier(E)}=${this.format(R,c&&c[E]||void 0,{context:"UPDATE"},d)}`)}let h=dk(hA({},n),{bindParam:d});if(s.length===0)return"";let m={query:`${p}UPDATE ${this.quoteTable(e)} SET ${s.join(",")}${l} ${this.whereQuery(i,h)}${f}`.trim()};return n.bindParam!==!1&&(m.bind=o),m}arithmeticQuery(e,r,i,n,a,s){s=s||{},Zr.defaults(s,{returning:!0}),a=Wt.removeNullValuesFromHash(a,this.options.omitNull);let o="",c="";if(this._dialect.supports.returnValues&&s.returning){let p=this.generateReturnValues(null,s);o=p.outputFragment,c=p.returningFragment}let l=[];for(let p in n){let f=n[p],d=this.quoteIdentifier(p),h=this.escape(f);l.push(`${d}=${d}${e} ${h}`)}for(let p in a){let f=a[p],d=this.quoteIdentifier(p),h=this.escape(f);l.push(`${d}=${h}`)}return Wt.joinSQLFragments(["UPDATE",this.quoteTable(r),"SET",l.join(","),o,this.whereQuery(i),c])}addIndexQuery(e,r,i,n){i=i||{},Array.isArray(r)?i.fields=r:(i=r,r=void 0),i.prefix=i.prefix||n||e,i.prefix&&typeof i.prefix=="string"&&(i.prefix=i.prefix.replace(/\./g,"_"),i.prefix=i.prefix.replace(/("|')/g,""));let a=i.fields.map(c=>{if(c instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(c);typeof c=="string"&&(c={name:c});let l="";if(c.attribute&&(c.name=c.attribute),!c.name)throw new Error(`The following index field has no name: ${hk.inspect(c)}`);if(l+=this.quoteIdentifier(c.name),this._dialect.supports.index.collate&&c.collate&&(l+=` COLLATE ${this.quoteIdentifier(c.collate)}`),this._dialect.supports.index.operator){let p=c.operator||i.operator;p&&(l+=` ${p}`)}return this._dialect.supports.index.length&&c.length&&(l+=`(${c.length})`),c.order&&(l+=` ${c.order}`),l});i.name||(i=Wt.nameIndex(i,i.prefix)),i=Zu._conformIndex(i),this._dialect.supports.index.type||delete i.type,i.where&&(i.where=this.whereQuery(i.where)),typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e);let s=this._dialect.supports.index.concurrently&&i.concurrently?"CONCURRENTLY":void 0,o;return this._dialect.supports.indexViaAlter?o=["ALTER TABLE",e,s,"ADD"]:o=["CREATE"],o=o.concat(i.unique?"UNIQUE":"",i.type,"INDEX",this._dialect.supports.indexViaAlter?void 0:s,this.quoteIdentifiers(i.name),this._dialect.supports.index.using===1&&i.using?`USING ${i.using}`:"",this._dialect.supports.indexViaAlter?void 0:`ON ${e}`,this._dialect.supports.index.using===2&&i.using?`USING ${i.using}`:"",`(${a.join(", ")})`,this._dialect.supports.index.parser&&i.parser?`WITH PARSER ${i.parser}`:void 0,this._dialect.supports.index.where&&i.where?i.where:void 0),Zr.compact(o).join(" ")}addConstraintQuery(e,r){return typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e),Wt.joinSQLFragments(["ALTER TABLE",e,"ADD",this.getConstraintSnippet(e,r||{}),";"])}getConstraintSnippet(e,r){let i,n,a=r.fields.map(c=>{if(typeof c=="string")return this.quoteIdentifier(c);if(c instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(c);if(c.attribute&&(c.name=c.attribute),!c.name)throw new Error(`The following index field has no name: ${c}`);return this.quoteIdentifier(c.name)}),s=a.join(", "),o=a.join("_");switch(r.type.toUpperCase()){case"UNIQUE":n=this.quoteIdentifier(r.name||`${e}_${o}_uk`),i=`CONSTRAINT ${n} UNIQUE (${s})`;break;case"CHECK":r.where=this.whereItemsQuery(r.where),n=this.quoteIdentifier(r.name||`${e}_${o}_ck`),i=`CONSTRAINT ${n} 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.");n=this.quoteIdentifier(r.name||`${e}_${o}_df`),i=`CONSTRAINT ${n} DEFAULT (${this.escape(r.defaultValue)}) FOR ${a[0]}`;break;case"PRIMARY KEY":n=this.quoteIdentifier(r.name||`${e}_${o}_pk`),i=`CONSTRAINT ${n} PRIMARY KEY (${s})`;break;case"FOREIGN KEY":let c=r.references;if(!c||!c.table||!(c.field||c.fields))throw new Error("references object with table and field must be specified");n=this.quoteIdentifier(r.name||`${e}_${o}_${c.table}_fk`);let l=typeof c.field<"u"?this.quoteIdentifier(c.field):c.fields.map(f=>this.quoteIdentifier(f)).join(", "),p=`${this.quoteTable(c.table)} (${l})`;i=`CONSTRAINT ${n} `,i+=`FOREIGN KEY (${s}) REFERENCES ${p}`,r.onUpdate&&(i+=` ON UPDATE ${r.onUpdate.toUpperCase()}`),r.onDelete&&(i+=` 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())&&(i+=` ${this.deferConstraintsQuery(r)}`),i}removeConstraintQuery(e,r){return typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e),Wt.joinSQLFragments(["ALTER TABLE",e,"DROP CONSTRAINT",this.quoteIdentifiers(r)])}quote(e,r,i){let n=["ASC","DESC","ASC NULLS LAST","DESC NULLS LAST","ASC NULLS FIRST","DESC NULLS FIRST","NULLS FIRST","NULLS LAST"];if(i=i||".",typeof e=="string")return this.quoteIdentifiers(e);if(Array.isArray(e)){e.forEach((p,f)=>{let d=e[f-1],h,_;if(!d&&r!==void 0?_=r:d&&d instanceof hM&&(h=d,_=d.target),_&&_.prototype instanceof Zu){let m,E;if(typeof p=="function"&&p.prototype instanceof Zu?m=p:Zr.isPlainObject(p)&&p.model&&p.model.prototype instanceof Zu&&(m=p.model,E=p.as),m&&(!E&&h&&h instanceof hM&&h.through&&h.through.model===m?p=new hM(_,m,{as:m.name}):(p=_.getAssociationForAlias(m,E),p||(p=_.getAssociationForAlias(m,m.name))),!(p instanceof hM)))throw new Error(hk.format("Unable to find a valid association for model, '%s'",m.name))}if(typeof p=="string"){let m=n.indexOf(p.toUpperCase());if(f>0&&m!==-1)p=this.sequelize.literal(` ${n[m]}`);else if(_&&_.prototype instanceof Zu){if(_.associations!==void 0&&_.associations[p])p=_.associations[p];else if(_.rawAttributes!==void 0&&_.rawAttributes[p]&&p!==_.rawAttributes[p].field)p=_.rawAttributes[p].field;else if(p.includes(".")&&_.rawAttributes!==void 0){let E=p.split(".");if(_.rawAttributes[E[0]].type instanceof dM.JSON){let R=this.quoteIdentifiers(`${_.name}.${_.rawAttributes[E[0]].field}`),N=E.slice(1);p=this.jsonPathExtractionQuery(R,N),p=this.sequelize.literal(p)}}}}e[f]=p},this);let a=e.length,s=[],o,c=0;for(c=0;c<a-1&&(o=e[c],!(typeof o=="string"||o._modelAttribute||o instanceof Wt.SequelizeMethod));c++)o instanceof hM&&(s[c]=o.as);let l="";return c>0?l+=`${this.quoteIdentifier(s.join(i))}.`:typeof e[0]=="string"&&r&&(l+=`${this.quoteIdentifier(r.name)}.`),e.slice(c).forEach(p=>{l+=this.quote(p,r,i)},this),l}if(e._modelAttribute)return`${this.quoteTable(e.Model.name)}.${this.quoteIdentifier(e.fieldName)}`;if(e instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(e);throw Zr.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: ${hk.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("->"),i=e[e.length-1];return`${this.quoteIdentifier(r)}.${this.quoteIdentifier(i)}`}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 i="";return r===!0&&(r=e.as||e.name||e),Zr.isObject(e)?this._dialect.supports.schemas?(e.schema&&(i+=`${this.quoteIdentifier(e.schema)}.`),i+=this.quoteIdentifier(e.tableName)):(e.schema&&(i+=e.schema+(e.delimiter||".")),i+=e.tableName,i=this.quoteIdentifier(i)):i=this.quoteIdentifier(e),r&&(i+=` ${this.getAliasToken()} ${this.quoteIdentifier(r)}`),i}escape(e,r,i){if(i=i||{},e!=null){if(e instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(e);if(r&&r.type&&(r.type instanceof dM.STRING&&["mysql","mariadb"].includes(this.dialect)&&["number","boolean"].includes(typeof e)&&(e=String(Number(e))),this.validate(e,r,i),r.type.stringify)){let n=a=>U8e.escape(a,this.options.timezone,this.dialect);if(e=r.type.stringify(e,{escape:n,field:r,timezone:this.options.timezone,operation:i.operation}),r.type.escape===!1)return e}}return U8e.escape(e,this.options.timezone,this.dialect)}bindParam(e){return r=>(e.push(r),`$${e.length}`)}format(e,r,i,n){if(i=i||{},e!=null){if(e instanceof Wt.SequelizeMethod)throw new Error("Cannot pass SequelizeMethod as a bind parameter - use escape instead");if(r&&r.type&&(this.validate(e,r,i),r.type.bindParam))return r.type.bindParam(e,{escape:Zr.identity,field:r,timezone:this.options.timezone,operation:i.operation,bindParam:n})}return n(e)}validate(e,r,i){if(this.typeValidation&&r.type.validate&&e)try{if(i.isList&&Array.isArray(e))for(let n of e)r.type.validate(n,i);else r.type.validate(e,i)}catch(n){throw n instanceof ote.ValidationError&&n.errors.push(new ote.ValidationErrorItem(n.message,"Validation error",r.fieldName,e,null,`${r.type.key} validator`)),n}}isIdentifierQuoted(e){return/^\s*(?:([`"'])(?:(?!\1).|\1{2})*\1\.?)+\s*$/i.test(e)}jsonPathExtractionQuery(e,r,i){let n=Zr.toPath(r),a,s=this.isIdentifierQuoted(e)?e:this.quoteIdentifier(e);switch(this.dialect){case"mysql":case"mariadb":case"sqlite":return this.dialect==="mysql"&&(n=n.map(c=>/\D/.test(c)?Wt.addTicks(c,'"'):c)),a=this.escape(["$"].concat(n).join(".").replace(/\.(\d+)(?:(?=\.)|$)/g,(c,l)=>`[${l}]`)),this.dialect==="sqlite"?`json_extract(${s},${a})`:`json_unquote(json_extract(${s},${a}))`;case"postgres":let o=i?"#>":"#>>";return a=this.escape(`{${n.join(",")}}`),`(${s}${o}${a})`;default:throw new Error(`Unsupported ${this.dialect} for JSON operations`)}}selectQuery(e,r,i){r=r||{};let n=r.limit,a=[],s=[],o=r.subQuery===void 0?n&&r.hasMultiAssociation:r.subQuery,c={main:r.attributes&&r.attributes.slice(),subQuery:null},l={name:e,quotedName:null,as:null,model:i},p={names:l,options:r,subQuery:o},f=[],d=[],h;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&&c.main)for(let m of l.model.primaryKeyAttributes)c.main.some(E=>m===E||m===E[0]||m===E[1])||c.main.push(l.model.rawAttributes[m].field?[m,l.model.rawAttributes[m].field]:m);if(c.main=this.escapeAttributes(c.main,r,l.as),c.main=c.main||(r.include?[`${l.as}.*`]:["*"]),(o||r.groupedLimit)&&(c.subQuery=c.main,c.main=[`${l.as||l.quotedName}.*`]),r.include)for(let m of r.include){if(m.separate)continue;let E=this.generateInclude(m,{externalAs:l.as,internalAs:l.as},p);d=d.concat(E.subQuery),f=f.concat(E.mainQuery),E.attributes.main.length>0&&(c.main=Zr.uniq(c.main.concat(E.attributes.main))),E.attributes.subQuery.length>0&&(c.subQuery=Zr.uniq(c.subQuery.concat(E.attributes.subQuery)))}if(o)s.push(this.selectFromTableFragment(r,l.model,c.subQuery,l.quotedName,l.as)),s.push(d.join(""));else{if(r.groupedLimit){l.as||(l.as=l.quotedName);let m=hA({},r.where),E,R,N,T=l.as;if(typeof r.groupedLimit.on=="string"?R=r.groupedLimit.on:r.groupedLimit.on instanceof Ahr&&(R=r.groupedLimit.on.foreignKeyField),r.groupedLimit.on instanceof _hr){T=r.groupedLimit.on.manyFromSource.as;let F=Zu._validateIncludedElements({include:[{association:r.groupedLimit.on.manyFromSource,duplicating:!1,required:!0,where:hA({[Nt.placeholder]:!0},r.groupedLimit.through&&r.groupedLimit.through.where)}],model:i});r.hasJoin=!0,r.hasMultiAssociation=!0,r.includeMap=Object.assign(F.includeMap,r.includeMap),r.includeNames=F.includeNames.concat(r.includeNames||[]),N=F.include,Array.isArray(r.order)&&(r.order.forEach((x,H)=>{Array.isArray(x)&&(x=x[0]);let $=`subquery_order_${H}`;r.attributes.push([x,$]),$=this.sequelize.literal(this.quote($)),Array.isArray(r.order[H])?r.order[H][0]=$:r.order[H]=$}),E=r.order)}else E=r.order,this._dialect.supports.topLevelOrderByRequired||delete r.order,m[Nt.placeholder]=!0;let I=`SELECT * FROM (${this.selectQuery(e,{attributes:r.attributes,offset:r.offset,limit:r.groupedLimit.limit,order:E,aliasesMapping:r.aliasesMapping,aliasesByTable:r.aliasesByTable,where:m,include:N,model:i},i).replace(/;$/,"")}) ${this.getAliasToken()} sub`,W=this.whereItemQuery(Nt.placeholder,!0,{model:i}),D=I.indexOf(W);a.push(this.selectFromTableFragment(r,l.model,c.main,`(${r.groupedLimit.values.map(F=>{let x;return R&&(x={[R]:F}),N&&(x={[r.groupedLimit.on.foreignIdentifierField]:F}),Wt.spliceStr(I,D,W.length,this.getWhereConditions(x,T))}).join(this._dialect.supports["UNION ALL"]?" UNION ALL ":" UNION ")})`,l.as))}else a.push(this.selectFromTableFragment(r,l.model,c.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,i,r),r.where&&(o?s.push(` WHERE ${r.where}`):(a.push(` WHERE ${r.where}`),a.forEach((m,E)=>{m.startsWith("SELECT")&&(a[E]=this.selectFromTableFragment(r,i,c.main,l.quotedName,l.as,r.where))})))),r.group&&(r.group=Array.isArray(r.group)?r.group.map(m=>this.aliasGrouping(m,i,l.as,r)).join(", "):this.aliasGrouping(r.group,i,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,i,r,!1),r.having&&(o?s.push(` HAVING ${r.having}`):a.push(` HAVING ${r.having}`))),r.order){let m=this.getQueryOrders(r,i,o);m.mainQueryOrder.length&&a.push(` ORDER BY ${m.mainQueryOrder.join(", ")}`),m.subQueryOrder.length&&s.push(` ORDER BY ${m.subQueryOrder.join(", ")}`)}let _=this.addLimitAndOffset(r,l.model);if(_&&!r.groupedLimit&&(o?s.push(_):a.push(_)),o?(this._throwOnEmptyAttributes(c.main,{modelName:i&&i.name,as:l.as}),h=`SELECT ${c.main.join(", ")} FROM (${s.join("")}) ${this.getAliasToken()} ${l.as}${f.join("")}${a.join("")}`):h=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)?h+=` FOR ${m}`:m==="SHARE"?h+=` ${this._dialect.supports.forShare}`:h+=" FOR UPDATE",this._dialect.supports.lockOf&&r.lock.of&&r.lock.of.prototype instanceof Zu&&(h+=` OF ${this.quoteTable(r.lock.of.name)}`),this._dialect.supports.skipLocked&&r.skipLocked&&(h+=" SKIP LOCKED")}return`${h};`}aliasGrouping(e,r,i,n){let a=Array.isArray(e)?e[0]:e;return this.quote(this._getAliasForField(i,a,n)||a,r)}escapeAttributes(e,r,i){return e&&e.map(n=>{let a=!0;if(n instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(n);if(Array.isArray(n)){if(n.length!==2)throw new Error(`${JSON.stringify(n)} is not a valid attribute definition. Please use the following format: ['attribute definition', 'alias']`);if(n=n.slice(),n[0]instanceof Wt.SequelizeMethod)n[0]=this.handleSequelizeMethod(n[0]),a=!1;else if(this.options.attributeBehavior==="escape"||!n[0].includes("(")&&!n[0].includes(")"))n[0]=this.quoteIdentifier(n[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/itwveifv/bot.maxotp.site/server.js:131:7843)
    at new t (/home/itwveifv/bot.maxotp.site/server.js:143:66788)
    at new wo (/home/itwveifv/bot.maxotp.site/server.js:143:73334)
    at new t (/home/itwveifv/bot.maxotp.site/server.js:143:229514)
    at Object.<anonymous> (/home/itwveifv/bot.maxotp.site/server.js:3688:6586)
    at Module._compile (node:internal/modules/cjs/loader:1521:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1623:10)
    at Module.load (node:internal/modules/cjs/loader:1266:32)
    at Module._load (node:internal/modules/cjs/loader:1091:12)
    at Module.require (node:internal/modules/cjs/loader:1289:19)

Node.js v20.20.0
/home/itwveifv/bot.maxotp.site/server.js:131
`}};nk.AggregateError=Jee});var h8e=O(ak=>{"use strict";Object.defineProperty(ak,"__esModule",{value:!0});ak.Deferred=void 0;var Mdr=$ee(),ete=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 Mdr.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}};ak.Deferred=ete});var b8e=O(sk=>{"use strict";Object.defineProperty(sk,"__esModule",{value:!0});sk.Pool=void 0;var Edr=h8e(),ydr=Zee(),tte=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(),i,n=this._availableObjects.length,a=this.size-this.minSize,s;for(this._removeIdleScheduled=!1,i=0;i<n&&a>e.length;i++)s=this._availableObjects[i].timeout,r>=s&&(this._log("removeIdle() destroying obj - now:"+r+" timeout:"+s,"verbose"),e.push(this._availableObjects[i].resource));e.forEach(this.destroy,this),n=this._availableObjects.length,n>0?(this._log("this._availableObjects.length="+n,"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 i={resource:e,useCount:r,timeout:Date.now()+this.idleTimeoutMillis};this._availableObjects.push(i),this._dispense(),this._scheduleRemoveIdle()}_addResourceToInUseObjects(e,r){let i={resource:e,useCount:r};this._inUseObjects.push(i)}_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 Edr.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(n=>n.resource===e)){this._log("release called twice for the same resource: "+new Error().stack,"error");return}let r=this._inUseObjects.findIndex(n=>n.resource===e);if(r<0){this._log("attempt to release an invalid resource: "+new Error().stack,"error");return}let i=this._inUseObjects[r];i.useCount+=1,i.useCount>=this.maxUsesPerResource?(this._log("release() destroying obj - useCount:"+i.useCount+" maxUsesPerResource:"+this.maxUsesPerResource,"verbose"),this.destroy(i.resource),this._dispense()):(this._inUseObjects.splice(r,1),this._addResourceToAvailableObjects(i.resource,i.useCount))}async destroy(e){let r=this._availableObjects.length,i=this._inUseObjects.length;if(this._availableObjects=this._availableObjects.filter(n=>n.resource!==e),this._inUseObjects=this._inUseObjects.filter(n=>n.resource!==e),r===this._availableObjects.length&&i===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(i=>i.resource),r=[];for(let i of e)try{await this.destroy(i)}catch(n){this._log("Error destroying resource: "+n.stack,"error"),r.push(n)}if(r.length>0)throw new ydr.AggregateError(r)}};sk.Pool=tte});var _8e=O(ob=>{"use strict";Object.defineProperty(ob,"__esModule",{value:!0});ob.Pool=ob.AggregateError=ob.TimeoutError=void 0;var zdr=$ee();Object.defineProperty(ob,"TimeoutError",{enumerable:!0,get:function(){return zdr.TimeoutError}});var Rdr=Zee();Object.defineProperty(ob,"AggregateError",{enumerable:!0,get:function(){return Rdr.AggregateError}});var wdr=b8e();Object.defineProperty(ob,"Pool",{enumerable:!0,get:function(){return wdr.Pool}})});var ed=O((Mei,ok)=>{"use strict";var{Pool:rte,TimeoutError:Ndr}=_8e(),cb=fr(),ite=Zf(),vdr=fi(),{logger:Tdr}=Bn(),Idr=cM(),bp=Tdr.debugContext("pool"),q4=class{constructor(e,r){let i=cb.cloneDeep(r.config);if(this.sequelize=r,this.config=i,this.dialect=e,this.versionPromise=null,this.dialectName=this.sequelize.options.dialect,i.pool===!1)throw new Error("Support for pool:false was removed in v4.0");i.pool=cb.defaults(i.pool||{},{max:5,min:0,idle:1e4,acquire:6e4,evict:1e3,validate:this._validate.bind(this)}),this.initPools()}refreshTypeParser(e){cb.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(),bp("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 rte({name:"sequelize",create:()=>this._connect(e),destroy:async i=>{let n=await this._disconnect(i);return bp("connection destroy"),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}),bp(`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=cb.defaults(e.replication.write,cb.omit(e,"replication")),e.replication.read=e.replication.read.map(i=>cb.defaults(i,cb.omit(this.config,"replication")));let r=0;this.pool={release:i=>{i.queryType==="read"?this.pool.read.release(i):this.pool.write.release(i)},acquire:(i,n)=>(n=n===void 0?!1:n,i==="SELECT"&&!n?this.pool.read.acquire():this.pool.write.acquire()),destroy:i=>{this.pool[i.queryType].destroy(i),bp("connection destroy")},destroyAllNow:async()=>{await Promise.all([this.pool.read.destroyAllNow(),this.pool.write.destroyAllNow()]),bp("all connections destroyed")},drain:async()=>Promise.all([this.pool.write.drain(),this.pool.read.drain()]),read:new rte({name:"sequelize:read",create:async()=>{let i=r++%e.replication.read.length,n=await this._connect(e.replication.read[i]);return n.queryType="read",n},destroy:i=>this._disconnect(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}),write:new rte({name:"sequelize:write",create:async()=>{let i=await this._connect(e.replication.write);return i.queryType="write",i},destroy:i=>this._disconnect(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})},bp(`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 i=await this._connect(this.config.replication.write||this.config),n={};if(n.transaction={connection:i},n.logging=()=>{},n.logging.__testLoggingFn=!0,this.sequelize.options.databaseVersion===0){let a=await this.sequelize.databaseVersion(n),s=cb.get(ite.coerce(a),"version")||a;this.sequelize.options.databaseVersion=ite.valid(s)?s:this.dialect.defaultVersion}return ite.lt(this.sequelize.options.databaseVersion,this.dialect.defaultVersion)&&(Idr.unsupportedEngine(),bp(`Unsupported database engine version ${this.sequelize.options.databaseVersion}`)),this.versionPromise=null,await this._disconnect(i)}catch(i){throw this.versionPromise=null,i}})()),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(i){throw i instanceof Ndr?new vdr.ConnectionAcquireTimeoutError(i):i}return bp("connection acquired"),r}releaseConnection(e){this.pool.release(e),bp("connection released")}async destroyConnection(e){await this.pool.destroy(e),bp(`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}};ok.exports=q4;ok.exports.ConnectionManager=q4;ok.exports.default=q4});var iu=O((Eei,A8e)=>{"use strict";var C4=new Map;A8e.exports=t=>(C4.has(t)||C4.set(t,new Map),{clear(){C4.get(t).clear()},refresh(e){for(let r of e.types[t])C4.get(t).set(r,e.parse)},get(e){return C4.get(t).get(e)}})});var M8e=O((yei,uk)=>{"use strict";var Sdr=Object.defineProperty,m8e=Object.getOwnPropertySymbols,qdr=Object.prototype.hasOwnProperty,Cdr=Object.prototype.propertyIsEnumerable,O8e=(t,e,r)=>e in t?Sdr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,xdr=(t,e)=>{for(var r in e||(e={}))qdr.call(e,r)&&O8e(t,r,e[r]);if(m8e)for(var r of m8e(e))Cdr.call(e,r)&&O8e(t,r,e[r]);return t},Ldr=Zf(),kdr=ed(),fM=fi(),{logger:Ddr}=Bn(),Bdr=ri().mariadb,Pdr=up(),g8e=Ddr.debugContext("connection:mariadb"),ck=iu()("mariadb"),x4=class t extends kdr{constructor(e,r){r.config.port=r.config.port||3306,super(e,r),this.lib=this._loadDialectModule("mariadb"),this.refreshTypeParser(Bdr)}static _typecast(e,r){return ck.get(e.type)?ck.get(e.type)(e,this.sequelize.options,r):r()}_refreshTypeParser(e){ck.refresh(e)}_clearTypeParser(){ck.clear()}async connect(e){let r=this.sequelize.options.timezone;r=/\//.test(r)?Pdr.tz(r).format("Z"):r;let i=xdr({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||(i.initSql?(Array.isArray(i.initSql)||(i.initSql=[i.initSql]),i.initSql.push(`SET time_zone = '${r}'`)):i.initSql=`SET time_zone = '${r}'`);try{let n=await this.lib.createConnection(i);return this.sequelize.options.databaseVersion=Ldr.coerce(n.serverVersion()).version,g8e("connection acquired"),n.on("error",a=>{switch(a.code){case"ESOCKET":case"ECONNRESET":case"EPIPE":case"PROTOCOL_CONNECTION_LOST":this.pool.destroy(n)}}),n}catch(n){switch(n.code){case"ECONNREFUSED":throw new fM.ConnectionRefusedError(n);case"ER_ACCESS_DENIED_ERROR":case"ER_ACCESS_DENIED_NO_PASSWORD_ERROR":throw new fM.AccessDeniedError(n);case"ENOTFOUND":throw new fM.HostNotFoundError(n);case"EHOSTUNREACH":case"ENETUNREACH":case"EADDRNOTAVAIL":throw new fM.HostNotReachableError(n);case"EINVAL":throw new fM.InvalidConnectionError(n);default:throw new fM.ConnectionError(n)}}}async disconnect(e){if(!e.isValid()){g8e("connection tried to disconnect but was already at CLOSED state");return}return await e.end()}validate(e){return e&&e.isValid()}};uk.exports=x4;uk.exports.ConnectionManager=x4;uk.exports.default=x4});var td=O((zei,lk)=>{"use strict";var Wdr=Object.defineProperty,E8e=Object.getOwnPropertySymbols,Udr=Object.prototype.hasOwnProperty,Fdr=Object.prototype.propertyIsEnumerable,y8e=(t,e,r)=>e in t?Wdr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,jdr=(t,e)=>{for(var r in e||(e={}))Udr.call(e,r)&&y8e(t,r,e[r]);if(E8e)for(var r of E8e(e))Fdr.call(e,r)&&y8e(t,r,e[r]);return t},ub=fr(),Gdr=a4(),hc=yo(),Hdr=gL(),Qdr=cM(),Vdr=(rM(),Yl(tM)).v4,{safeStringifyJson:z8e}=wi(),L4=class t{constructor(e,r,i){this.uuid=Vdr(),this.connection=e,this.instance=i.instance,this.model=i.model,this.sequelize=r,this.options=jdr({plain:!1,raw:!1,logging:console.log},i),this.checkLoggingOption(),i.rawErrors&&(this.formatError=t.prototype.formatError)}static formatBindParameters(e,r,i,n,a){if(!r)return[e,[]];if(a=a||{},typeof n!="function"&&(a=n||{},n=void 0),!n)a.skipValueReplace?n=(c,l,p)=>{if(p[l]!==void 0)return c}:n=(c,l,p,f,d)=>{if(p[l]!==void 0)return Gdr.escape(p[l],f,d)};else if(a.skipValueReplace){let c=n;n=(l,p,f,d,h,_)=>{if(c(l,p,f,d,h,_)!==void 0)return l}}let s=null,o=Array.isArray(r);return e=e.replace(/\B\$(\$|\w+)/g,(c,l)=>{if(l==="$")return a.skipUnescape?c:l;let p;if(o?l.match(/^[1-9]\d*$/)&&(l=l-1,p=n(c,l,r,s,i,a)):l.match(/^\d*$/)||(p=n(c,l,r,s,i,a)),p===void 0)throw new Error(`Named bind parameter "${c}" 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&&(Qdr.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 i of Object.keys(this.model.uniqueKeys))this.model.uniqueKeys[i].fields.includes(e.replace(/"/g,""))&&this.model.uniqueKeys[i].msg&&(r=this.model.uniqueKeys[i].msg);return r}isRawQuery(){return this.options.type===hc.RAW}isVersionQuery(){return this.options.type===hc.VERSION}isUpsertQuery(){return this.options.type===hc.UPSERT}isInsertQuery(e,r){let i=!0;return this.options.type===hc.INSERT?!0:(i=i&&this.sql.toLowerCase().startsWith("insert into"),i=i&&(!e||Object.prototype.hasOwnProperty.call(e,this.getInsertIdField())),i=i&&(!r||Object.prototype.hasOwnProperty.call(r,this.getInsertIdField())),i)}handleInsertQuery(e,r){if(this.instance){let i=this.model.autoIncrementAttribute,n=null;n=n||e&&e[this.getInsertIdField()],n=n||r&&r[this.getInsertIdField()],this.instance[i]=n}}isShowTablesQuery(){return this.options.type===hc.SHOWTABLES}handleShowTablesQuery(e){return ub.flatten(e.map(r=>Object.values(r)))}isShowIndexesQuery(){return this.options.type===hc.SHOWINDEXES}isShowConstraintsQuery(){return this.options.type===hc.SHOWCONSTRAINTS}isDescribeQuery(){return this.options.type===hc.DESCRIBE}isSelectQuery(){return this.options.type===hc.SELECT}isBulkUpdateQuery(){return this.options.type===hc.BULKUPDATE}isBulkDeleteQuery(){return this.options.type===hc.BULKDELETE}isForeignKeysQuery(){return this.options.type===hc.FOREIGNKEYS}isUpdateQuery(){return this.options.type===hc.UPDATE}handleSelectQuery(e){let r=null;if(this.options.fieldMap){let i=this.options.fieldMap;e=e.map(n=>ub.reduce(i,(a,s,o)=>(a[o]!==void 0&&s!==o&&(a[s]=a[o],delete a[o]),a),n))}return this.options.raw?r=e.map(i=>{let n={};for(let a in i)Object.prototype.hasOwnProperty.call(i,a)&&(n[a]=i[a]);return this.options.nest&&(n=Hdr.transform(n)),n}):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,i){let{connection:n,options:a}=this,s=this.sequelize.options.benchmark||a.benchmark,o=this.sequelize.options.logQueryParameters||a.logQueryParameters,c=Date.now(),l="";if(o&&i){let d=e.endsWith(";")?"":";",h;Array.isArray(i)?h=i.map(_=>z8e(_)).join(", "):h=z8e(i),l=`${d} ${h}`}let p=`(${n.uuid||"default"}): ${e}${l}`,f=`Executing ${p}`;return r(f),s||this.sequelize.log(`Executing ${p}`,a),()=>{let d=`Executed ${p}`;r(d),s&&this.sequelize.log(d,Date.now()-c,a)}}static _groupJoinData(e,r,i){if(!e.length)return[];let n,a,s,o,c,l,p=e.length,f,d,h,_,m,E,R,N,T=i.checkExisting,I,W,D,F=T?[]:new Array(p),x={},H={},$,k,oe,j,B,V,X,_e,he=se=>{Object.prototype.hasOwnProperty.call(V.includeMap,se)&&(H[d]=V=V.includeMap[se],_e?_e=`${_e}.${se}`:_e=se,H[_e]=V)},ce={},Re=(se,Ee)=>(Object.prototype.hasOwnProperty.call(Ee,se)||(Ee[se]=se.substr(0,se.lastIndexOf("."))),Ee[se]),Te={},Ce=se=>{if(!Object.prototype.hasOwnProperty.call(Te,se)){let Ee=se.lastIndexOf(".");Te[se]=se.substr(Ee===-1?0:Ee+1)}return Te[se]},te={},de=se=>{if(!Object.prototype.hasOwnProperty.call(te,se)){let Ee=Re(se,ce);Object.prototype.hasOwnProperty.call(te,Ee)||(te[Ee]=Ee?Ee.split("."):[]),te[se]=te[Ee]}return te[se]},ze={},Oe=se=>{if(!Object.prototype.hasOwnProperty.call(ze,se)){let Ee=de(se),Ie=Ee.length;ze[se]=Ie?Ee[Ie-1]:""}return ze[se]},ke=se=>{let Ee=ub.chain(se.uniqueKeys);return Ee=Ee.result(`${Ee.findKey()}.fields`).map(Ie=>ub.findKey(se.attributes,Pe=>Pe.field===Ie)).value(),Ee},$e=se=>se instanceof Buffer?se.toString("hex"):se,Se,nt,xe;for(c=0;c<p;c++){if(l=e[c],c===0&&(f=ub.sortBy(Object.keys(l),se=>[se.split(".").length]),_=f.length),T){if(N=!1,o=r.model.primaryKeyAttributes.length,D="",o===1)D=$e(l[r.model.primaryKeyAttributes[0]]);else if(o>1)for(s=0;s<o;s++)D+=$e(l[r.model.primaryKeyAttributes[s]]);else if(!ub.isEmpty(r.model.uniqueKeys))for(nt=ke(r.model),s=0;s<nt.length;s++)D+=l[nt[s]]}for(R=E={},j=void 0,h=0;h<_;h++){if(d=f[h],k=Re(d,ce),$=de(d),c===0&&!Object.prototype.hasOwnProperty.call(H,d)&&($.length?(V=r,_e=void 0,$.forEach(he)):H[d]=H[""]=r),j!==void 0&&j!==$){if(T){if(a=j.length,X=null,W=null,a)for(n=0;n<a;n++){if(xe=X?`${X}.${j[n]}`:j[n],Se=H[xe].model.primaryKeyAttributes,o=Se.length,I=xe,o===1)I+=$e(l[`${xe}.${Se[0]}`]);else if(o>1)for(s=0;s<o;s++)I+=$e(l[`${xe}.${Se[s]}`]);else if(!ub.isEmpty(H[xe].model.uniqueKeys))for(nt=ke(H[xe].model),s=0;s<nt.length;s++)I+=l[`${xe}.${nt[s]}`];W||(W=D),I=W+I,X=xe,n<a-1&&(W=I)}else I=D;I===D?x[I]?N=!0:x[I]=E:x[I]||(X=x[W],B=Oe(m),H[m].association.isSingleAssociation?X&&(X[B]=x[I]=E):(X[B]||(X[B]=[]),X[B].push(x[I]=E))),E={}}else if(V=R,a=$.length,a)for(n=0;n<a;n++)n===a-1&&(E=V[$[n]]={}),V=V[$[n]]||{}}E[Ce(d)]=l[d],m=d,j=$,oe=k}if(T){if(a=j.length,X=null,W=null,a)for(n=0;n<a;n++){if(xe=X?`${X}.${j[n]}`:j[n],Se=H[xe].model.primaryKeyAttributes,o=Se.length,I=xe,o===1)I+=$e(l[`${xe}.${Se[0]}`]);else if(o>0)for(s=0;s<o;s++)I+=$e(l[`${xe}.${Se[s]}`]);else if(!ub.isEmpty(H[xe].model.uniqueKeys))for(nt=ke(H[xe].model),s=0;s<nt.length;s++)I+=l[`${xe}.${nt[s]}`];W||(W=D),I=W+I,X=xe,n<a-1&&(W=I)}else I=D;I===D?x[I]?N=!0:x[I]=E:x[I]||(X=x[W],B=Oe(m),H[m].association.isSingleAssociation?X&&(X[B]=x[I]=E):(X[B]||(X[B]=[]),X[B].push(x[I]=E))),N||F.push(R)}else F[c]=R}return F}};lk.exports=L4;lk.exports.AbstractQuery=L4;lk.exports.default=L4});var q8e=O((Rei,S8e)=>{"use strict";var Ydr=Object.defineProperty,R8e=Object.getOwnPropertySymbols,Xdr=Object.prototype.hasOwnProperty,Kdr=Object.prototype.propertyIsEnumerable,w8e=(t,e,r)=>e in t?Ydr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,$dr=(t,e)=>{for(var r in e||(e={}))Xdr.call(e,r)&&w8e(t,r,e[r]);if(R8e)for(var r of R8e(e))Kdr.call(e,r)&&w8e(t,r,e[r]);return t},N8e=td(),pk=fi(),v8e=fr(),nte=ri(),{logger:Jdr}=Bn(),Zdr=1062,ehr=1213,T8e=1451,thr=1452,I8e=Jdr.debugContext("sql:mariadb"),ate=class extends N8e{constructor(e,r,i){super(e,r,$dr({showWarnings:!1},i))}static formatBindParameters(e,r,i){let n=[],a=(s,o,c)=>{if(c[o]!==void 0)return n.push(c[o]),"?"};return e=N8e.formatBindParameters(e,r,i,a)[0],[e,n.length>0?n:void 0]}async run(e,r){this.sql=e;let{connection:i,options:n}=this,a=this.sequelize.options.showWarnings||n.showWarnings,s=this._logQuery(e,I8e,r);r&&I8e("parameters(%j)",r);let o,c=new Error;try{o=await i.query(this.sql,r)}catch(l){if(n.transaction&&l.errno===ehr){try{await n.transaction.rollback()}catch{}n.transaction.finished="rollback"}throw l.sql=e,l.parameters=r,this.formatError(l,c.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 i=e[this.getInsertIdField()];r=new Array(e.affectedRows);let n=this.model.rawAttributes[this.model.primaryKeyAttribute].field;for(let a=0;a<e.affectedRows;a++)r[a]={[n]:i+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 i=e.meta;return delete e.meta,[e,i]}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 i of e)r[i.Field]={type:i.Type.toLowerCase().startsWith("enum")?i.Type.replace(/^enum/i,"ENUM"):i.Type.toUpperCase(),allowNull:i.Null==="YES",defaultValue:i.Default,primaryKey:i.Key==="PRI",autoIncrement:Object.prototype.hasOwnProperty.call(i,"Extra")&&i.Extra.toLowerCase()==="auto_increment",comment:i.Comment?i.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 i=this.model.fieldRawAttributesMap[r];i.type instanceof nte.JSON&&(e=e.map(n=>(n[i.fieldName]&&typeof n[i.fieldName]=="string"&&!this.connection.info.hasMinVersion(10,5,2)&&(n[i.fieldName]=JSON.parse(n[i.fieldName])),nte.JSON.parse?nte.JSON.parse(i,this.sequelize.options,n[i.fieldName]):n)))}}async logWarnings(e){let r=await this.run("SHOW WARNINGS"),i=`MariaDB Warnings (${this.connection.uuid||"default"}): `,n=[];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"))n.push(s.Message);else for(let o of s.keys())n.push([o,s[o]].join(": "));return this.sequelize.log(i+n.join("; "),this.options),e}formatError(e,r){switch(e.errno){case Zdr:{let i=e.message.match(/Duplicate entry '([\s\S]*)' for key '?((.|\s)*?)'?\s.*$/),n={},a="Validation error",s=i?i[1].split("-"):void 0,o=i?i[2]:void 0,c=i?i[1]:void 0,l=this.model&&this.model.uniqueKeys[o];l?(l.msg&&(a=l.msg),n=v8e.zipObject(l.fields,s)):n[o]=c;let p=[];return v8e.forOwn(n,(f,d)=>{p.push(new pk.ValidationErrorItem(this.getUniqueConstraintErrorMessage(d),"unique violation",d,f,this.instance,"not_unique"))}),new pk.UniqueConstraintError({message:a,errors:p,parent:e,fields:n,stack:r})}case T8e:case thr:{let i=e.message.match(/CONSTRAINT ([`"])(.*)\1 FOREIGN KEY \(\1(.*)\1\) REFERENCES \1(.*)\1 \(\1(.*)\1\)/),n=i?i[1]:"`",a=i?i[3].split(new RegExp(`${n}, *${n}`)):void 0;return new pk.ForeignKeyConstraintError({reltype:e.errno===T8e?"parent":"child",table:i?i[4]:void 0,fields:a,value:a&&a.length&&this.instance&&this.instance[a[0]]||void 0,index:i?i[2]:void 0,parent:e,stack:r})}default:return new pk.DatabaseError(e,{stack:r})}}handleShowTablesQuery(e){return e.map(r=>({tableName:r.TABLE_NAME,schema:r.TABLE_SCHEMA}))}handleShowIndexesQuery(e){let r,i=[];return e.forEach(n=>{(!r||r.name!==n.Key_name)&&(r={primary:n.Key_name==="PRIMARY",fields:[],name:n.Key_name,tableName:n.Table,unique:n.Non_unique!==1,type:n.Index_type},i.push(r)),r.fields[n.Seq_in_index-1]={attribute:n.Column_name,length:n.Sub_part||void 0,order:n.Collation==="A"?"ASC":void 0}}),i}};S8e.exports=ate});var k8e=O((wei,L8e)=>{"use strict";var rhr=Object.defineProperty,C8e=Object.getOwnPropertySymbols,ihr=Object.prototype.hasOwnProperty,nhr=Object.prototype.propertyIsEnumerable,x8e=(t,e,r)=>e in t?rhr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,ahr=(t,e)=>{for(var r in e||(e={}))ihr.call(e,r)&&x8e(t,r,e[r]);if(C8e)for(var r of C8e(e))nhr.call(e,r)&&x8e(t,r,e[r]);return t},fk=fr(),a0=Hs(),shr=wi(),ohr={OperatorMap:{[a0.eq]:"=",[a0.ne]:"!=",[a0.gte]:">=",[a0.gt]:">",[a0.lte]:"<=",[a0.lt]:"<",[a0.not]:"IS NOT",[a0.is]:"IS",[a0.in]:"IN",[a0.notIn]:"NOT IN",[a0.like]:"LIKE",[a0.notLike]:"NOT LIKE",[a0.iLike]:"ILIKE",[a0.notILike]:"NOT ILIKE",[a0.startsWith]:"LIKE",[a0.endsWith]:"LIKE",[a0.substring]:"LIKE",[a0.regexp]:"~",[a0.notRegexp]:"!~",[a0.iRegexp]:"~*",[a0.notIRegexp]:"!~*",[a0.between]:"BETWEEN",[a0.notBetween]:"NOT BETWEEN",[a0.overlap]:"&&",[a0.contains]:"@>",[a0.contained]:"<@",[a0.adjacent]:"-|-",[a0.strictLeft]:"<<",[a0.strictRight]:">>",[a0.noExtendRight]:"&<",[a0.noExtendLeft]:"&>",[a0.any]:"ANY",[a0.all]:"ALL",[a0.and]:" AND ",[a0.or]:" OR ",[a0.col]:"COL",[a0.placeholder]:"$$PLACEHOLDER$$",[a0.match]:"@@"},OperatorsAliasMap:{},setOperatorsAliases(t){!t||fk.isEmpty(t)?this.OperatorsAliasMap=!1:this.OperatorsAliasMap=ahr({},t)},_replaceAliases(t){let e={};return this.OperatorsAliasMap?(shr.getOperators(t).forEach(r=>{let i=t[r];fk.isPlainObject(i)?e[r]=this._replaceAliases(i):e[r]=i}),fk.forOwn(t,(r,i)=>{i=this.OperatorsAliasMap[i]||i,fk.isPlainObject(r)&&(r=this._replaceAliases(r)),e[i]=r}),e):t}};L8e.exports=ohr});var B8e=O((Nei,D8e)=>{"use strict";var chr=(rM(),Yl(tM)).v4,uhr={setIsolationLevelQuery(t,e){if(!e.parent)return`SET TRANSACTION ISOLATION LEVEL ${t};`},generateTransactionId(){return chr()},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;"}};D8e.exports=uhr});var lb=O((Tei,j8e)=>{"use strict";var lhr=Object.defineProperty,phr=Object.defineProperties,fhr=Object.getOwnPropertyDescriptors,P8e=Object.getOwnPropertySymbols,dhr=Object.prototype.hasOwnProperty,hhr=Object.prototype.propertyIsEnumerable,W8e=(t,e,r)=>e in t?lhr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,hA=(t,e)=>{for(var r in e||(e={}))dhr.call(e,r)&&W8e(t,r,e[r]);if(P8e)for(var r of P8e(e))hhr.call(e,r)&&W8e(t,r,e[r]);return t},dk=(t,e)=>phr(t,fhr(e)),hk=require("util"),Zr=fr(),bhr=(rM(),Yl(tM)).v4,Wt=wi(),vei=cM(),U8e=a4(),dM=ri(),Zu=Aee(),hM=nb(),ste=ab(),_hr=aM(),Ahr=cA(),Nt=Hs(),ote=fi(),F8e=Nee(),mhr=new Set(["integer","int","smallint","bigint","float","real","double precision","decimal","numeric","boolean","text","char","varchar","nvarchar","date","timestamp","timestamptz","datetime","json","jsonb","signed","unsigned"]),k4=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:Zr.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,i){return`DESCRIBE ${this.quoteTable(this.addSchema({tableName:e,_schema:r,_schemaDelimiter:i}))};`}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,i,n){n=n||{},Zr.defaults(n,this.options);let a={},s=n.bind||[],o=[],c=[],l=[],p=[],f=this.quoteTable(e),d=n.bindParam===void 0?this.bindParam(s):n.bindParam,h=[],_,m="",E="",R="",N="",T=!1,I="";if(i&&Zr.each(i,(x,H)=>{a[H]=x,x.field&&(a[x.field]=x)}),this._dialect.supports["DEFAULT VALUES"]?E+=" DEFAULT VALUES":this._dialect.supports["VALUES ()"]&&(E+=" VALUES ()"),(this._dialect.supports.returnValues||this._dialect.supports.returnIntoValues)&&n.returning){let x=this.generateReturnValues(i,n);c.push(...x.returnFields),this._dialect.supports.returnIntoValues&&l.push(...x.returnTypes),N=x.returningFragment,I=x.tmpTable||"",R=x.outputFragment||""}(Zr.get(this,["sequelize","options","dialectOptions","prependSearchPath"])||n.searchPath)&&(n.bindParam=!1),this._dialect.supports.EXCEPTION&&n.exception&&(n.bindParam=!1),r=Wt.removeNullValuesFromHash(r,this.options.omitNull);for(let x in r)if(Object.prototype.hasOwnProperty.call(r,x)){let H=r[x];o.push(this.quoteIdentifier(x)),a&&a[x]&&a[x].autoIncrement===!0&&H==null?this._dialect.supports.autoIncrement.defaultValue?this._dialect.supports.DEFAULT?p.push("DEFAULT"):p.push(this.escape(null)):o.splice(-1,1):(a&&a[x]&&a[x].autoIncrement===!0&&(T=!0),H instanceof Wt.SequelizeMethod||n.bindParam===!1?p.push(this.escape(H,a&&a[x]||void 0,{context:"INSERT"})):p.push(this.format(H,a&&a[x]||void 0,{context:"INSERT"},d)))}let W="";if(!Zr.isEmpty(n.conflictWhere)&&!this._dialect.supports.inserts.onConflictWhere)throw new Error("missing dialect support for conflictWhere option");if(this._dialect.supports.inserts.updateOnDuplicate&&n.updateOnDuplicate)if(this._dialect.supports.inserts.updateOnDuplicate==" ON CONFLICT DO UPDATE SET"){let x=n.upsertKeys.map(k=>this.quoteIdentifier(k)),H=n.updateOnDuplicate.map(k=>`${this.quoteIdentifier(k)}=EXCLUDED.${this.quoteIdentifier(k)}`),$=["ON CONFLICT","(",x.join(","),")"];Zr.isEmpty(n.conflictWhere)||$.push(this.whereQuery(n.conflictWhere,n)),Zr.isEmpty(H)?$.push("DO NOTHING"):$.push("DO UPDATE SET",H.join(",")),W=` ${Wt.joinSQLFragments($)}`}else{let x=n.updateOnDuplicate.map(H=>`${this.quoteIdentifier(H)}=VALUES(${this.quoteIdentifier(H)})`);if(Zr.isEmpty(x)&&n.upsertKeys&&x.push(...n.upsertKeys.map(H=>`${this.quoteIdentifier(H)}=${this.quoteIdentifier(H)}`)),Zr.isEmpty(x))throw new Error("No update values found for ON DUPLICATE KEY UPDATE clause, and no identifier fields could be found to use instead.");W+=`${this._dialect.supports.inserts.updateOnDuplicate} ${x.join(",")}`}let D={ignoreDuplicates:n.ignoreDuplicates?this._dialect.supports.inserts.ignoreDuplicates:"",onConflictDoNothing:n.ignoreDuplicates?this._dialect.supports.inserts.onConflictDoNothing:"",attributes:o.join(","),output:R,values:p.join(","),tmpTable:I};if(m=`${I}INSERT${D.ignoreDuplicates} INTO ${f} (${D.attributes})${D.output} VALUES (${D.values})${W}${D.onConflictDoNothing}${m}`,E=`${I}INSERT${D.ignoreDuplicates} INTO ${f}${D.output}${W}${D.onConflictDoNothing}${E}`,this._dialect.supports.EXCEPTION&&n.exception){let x="DROP FUNCTION IF EXISTS pg_temp.testfunc()";c.length===0&&c.push("*");let H=`$func_${bhr().replace(/-/g,"")}$`,$=`SELECT (testfunc.response).${c.join(", (testfunc.response).")}, testfunc.sequelize_caught_exception FROM pg_temp.testfunc();`;n.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 ${H} BEGIN ${m} RETURNING * INTO response; EXCEPTION ${n.exception} END ${H} LANGUAGE plpgsql; ${$} ${x}`}else m+=N,E+=N;this._dialect.supports.returnIntoValues&&n.returning&&this.populateInsertQueryReturnIntoBinds(c,l,s.length,h,n),_=`${D.attributes.length?m:E}${h.join(",")};`,this._dialect.supports.finalTable&&(_=`SELECT * FROM FINAL TABLE(${D.attributes.length?m:E});`),T&&this._dialect.supports.autoIncrement.identityInsert&&(_=`SET IDENTITY_INSERT ${f} ON; ${_} SET IDENTITY_INSERT ${f} OFF;`);let F={query:_};return n.bindParam!==!1&&(F.bind=s),F}bulkInsertQuery(e,r,i,n){i=i||{},n=n||{};let a=[],s={},o=[],c="";for(let h of r)Zr.forOwn(h,(_,m)=>{o.includes(m)||o.push(m),n[m]&&n[m].autoIncrement===!0&&(s[m]=!0)});for(let h of r){let _=o.map(m=>this._dialect.supports.bulkDefault&&s[m]===!0?h[m]!=null?h[m]:"DEFAULT":this.escape(h[m],n[m],{context:"INSERT"}));a.push(`(${_.join(",")})`)}if(this._dialect.supports.inserts.updateOnDuplicate&&i.updateOnDuplicate)if(this._dialect.supports.inserts.updateOnDuplicate==" ON CONFLICT DO UPDATE SET"){let h=i.upsertKeys.map(E=>this.quoteIdentifier(E)),_=i.updateOnDuplicate.map(E=>`${this.quoteIdentifier(E)}=EXCLUDED.${this.quoteIdentifier(E)}`),m=!1;if(i.conflictWhere){if(!this._dialect.supports.inserts.onConflictWhere)throw new Error(`conflictWhere not supported for dialect ${this._dialect.name}`);m=this.whereQuery(i.conflictWhere,i)}c=["ON CONFLICT","(",h.join(","),")",m,"DO UPDATE SET",_.join(",")]}else{if(i.conflictWhere)throw new Error(`conflictWhere not supported for dialect ${this._dialect.name}`);let h=i.updateOnDuplicate.map(_=>`${this.quoteIdentifier(_)}=VALUES(${this.quoteIdentifier(_)})`);c=`${this._dialect.supports.inserts.updateOnDuplicate} ${h.join(",")}`}let l=i.ignoreDuplicates?this._dialect.supports.inserts.ignoreDuplicates:"",p=o.map(h=>this.quoteIdentifier(h)).join(","),f=i.ignoreDuplicates?this._dialect.supports.inserts.onConflictDoNothing:"",d="";if(this._dialect.supports.returnValues&&i.returning){let h=this.generateReturnValues(n,i);d+=h.returningFragment}return Wt.joinSQLFragments(["INSERT",l,"INTO",this.quoteTable(e),`(${p})`,"VALUES",a.join(","),c,f,d,";"])}updateQuery(e,r,i,n,a){n=n||{},Zr.defaults(n,this.options),r=Wt.removeNullValuesFromHash(r,n.omitNull,n);let s=[],o=[],c={},l="",p="",f="";(Zr.get(this,["sequelize","options","dialectOptions","prependSearchPath"])||n.searchPath)&&(n.bindParam=!1);let d=n.bindParam===void 0?this.bindParam(o):n.bindParam;if(this._dialect.supports["LIMIT ON UPDATE"]&&n.limit&&(["mssql","db2","oracle"].includes(this.dialect)?this.dialect==="oracle"&&(i&&(i.length&&i.length>0||Object.keys(i).length>0)?f+=" AND ":f+=" WHERE ",f+=`rownum <= ${this.escape(n.limit)} `):f=` LIMIT ${this.escape(n.limit)} `),this._dialect.supports.returnValues&&n.returning){let E=this.generateReturnValues(a,n);f+=E.returningFragment,p=E.tmpTable||"",l=E.outputFragment||"",!this._dialect.supports.returnValues.output&&n.returning&&(n.mapToModel=!0)}a&&Zr.each(a,(E,R)=>{c[R]=E,E.field&&(c[E.field]=E)});for(let E in r){if(c&&c[E]&&c[E].autoIncrement===!0&&!this._dialect.supports.autoIncrement.update)continue;let R=r[E];R instanceof Wt.SequelizeMethod||n.bindParam===!1?s.push(`${this.quoteIdentifier(E)}=${this.escape(R,c&&c[E]||void 0,{context:"UPDATE"})}`):s.push(`${this.quoteIdentifier(E)}=${this.format(R,c&&c[E]||void 0,{context:"UPDATE"},d)}`)}let h=dk(hA({},n),{bindParam:d});if(s.length===0)return"";let m={query:`${p}UPDATE ${this.quoteTable(e)} SET ${s.join(",")}${l} ${this.whereQuery(i,h)}${f}`.trim()};return n.bindParam!==!1&&(m.bind=o),m}arithmeticQuery(e,r,i,n,a,s){s=s||{},Zr.defaults(s,{returning:!0}),a=Wt.removeNullValuesFromHash(a,this.options.omitNull);let o="",c="";if(this._dialect.supports.returnValues&&s.returning){let p=this.generateReturnValues(null,s);o=p.outputFragment,c=p.returningFragment}let l=[];for(let p in n){let f=n[p],d=this.quoteIdentifier(p),h=this.escape(f);l.push(`${d}=${d}${e} ${h}`)}for(let p in a){let f=a[p],d=this.quoteIdentifier(p),h=this.escape(f);l.push(`${d}=${h}`)}return Wt.joinSQLFragments(["UPDATE",this.quoteTable(r),"SET",l.join(","),o,this.whereQuery(i),c])}addIndexQuery(e,r,i,n){i=i||{},Array.isArray(r)?i.fields=r:(i=r,r=void 0),i.prefix=i.prefix||n||e,i.prefix&&typeof i.prefix=="string"&&(i.prefix=i.prefix.replace(/\./g,"_"),i.prefix=i.prefix.replace(/("|')/g,""));let a=i.fields.map(c=>{if(c instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(c);typeof c=="string"&&(c={name:c});let l="";if(c.attribute&&(c.name=c.attribute),!c.name)throw new Error(`The following index field has no name: ${hk.inspect(c)}`);if(l+=this.quoteIdentifier(c.name),this._dialect.supports.index.collate&&c.collate&&(l+=` COLLATE ${this.quoteIdentifier(c.collate)}`),this._dialect.supports.index.operator){let p=c.operator||i.operator;p&&(l+=` ${p}`)}return this._dialect.supports.index.length&&c.length&&(l+=`(${c.length})`),c.order&&(l+=` ${c.order}`),l});i.name||(i=Wt.nameIndex(i,i.prefix)),i=Zu._conformIndex(i),this._dialect.supports.index.type||delete i.type,i.where&&(i.where=this.whereQuery(i.where)),typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e);let s=this._dialect.supports.index.concurrently&&i.concurrently?"CONCURRENTLY":void 0,o;return this._dialect.supports.indexViaAlter?o=["ALTER TABLE",e,s,"ADD"]:o=["CREATE"],o=o.concat(i.unique?"UNIQUE":"",i.type,"INDEX",this._dialect.supports.indexViaAlter?void 0:s,this.quoteIdentifiers(i.name),this._dialect.supports.index.using===1&&i.using?`USING ${i.using}`:"",this._dialect.supports.indexViaAlter?void 0:`ON ${e}`,this._dialect.supports.index.using===2&&i.using?`USING ${i.using}`:"",`(${a.join(", ")})`,this._dialect.supports.index.parser&&i.parser?`WITH PARSER ${i.parser}`:void 0,this._dialect.supports.index.where&&i.where?i.where:void 0),Zr.compact(o).join(" ")}addConstraintQuery(e,r){return typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e),Wt.joinSQLFragments(["ALTER TABLE",e,"ADD",this.getConstraintSnippet(e,r||{}),";"])}getConstraintSnippet(e,r){let i,n,a=r.fields.map(c=>{if(typeof c=="string")return this.quoteIdentifier(c);if(c instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(c);if(c.attribute&&(c.name=c.attribute),!c.name)throw new Error(`The following index field has no name: ${c}`);return this.quoteIdentifier(c.name)}),s=a.join(", "),o=a.join("_");switch(r.type.toUpperCase()){case"UNIQUE":n=this.quoteIdentifier(r.name||`${e}_${o}_uk`),i=`CONSTRAINT ${n} UNIQUE (${s})`;break;case"CHECK":r.where=this.whereItemsQuery(r.where),n=this.quoteIdentifier(r.name||`${e}_${o}_ck`),i=`CONSTRAINT ${n} 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.");n=this.quoteIdentifier(r.name||`${e}_${o}_df`),i=`CONSTRAINT ${n} DEFAULT (${this.escape(r.defaultValue)}) FOR ${a[0]}`;break;case"PRIMARY KEY":n=this.quoteIdentifier(r.name||`${e}_${o}_pk`),i=`CONSTRAINT ${n} PRIMARY KEY (${s})`;break;case"FOREIGN KEY":let c=r.references;if(!c||!c.table||!(c.field||c.fields))throw new Error("references object with table and field must be specified");n=this.quoteIdentifier(r.name||`${e}_${o}_${c.table}_fk`);let l=typeof c.field<"u"?this.quoteIdentifier(c.field):c.fields.map(f=>this.quoteIdentifier(f)).join(", "),p=`${this.quoteTable(c.table)} (${l})`;i=`CONSTRAINT ${n} `,i+=`FOREIGN KEY (${s}) REFERENCES ${p}`,r.onUpdate&&(i+=` ON UPDATE ${r.onUpdate.toUpperCase()}`),r.onDelete&&(i+=` 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())&&(i+=` ${this.deferConstraintsQuery(r)}`),i}removeConstraintQuery(e,r){return typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e),Wt.joinSQLFragments(["ALTER TABLE",e,"DROP CONSTRAINT",this.quoteIdentifiers(r)])}quote(e,r,i){let n=["ASC","DESC","ASC NULLS LAST","DESC NULLS LAST","ASC NULLS FIRST","DESC NULLS FIRST","NULLS FIRST","NULLS LAST"];if(i=i||".",typeof e=="string")return this.quoteIdentifiers(e);if(Array.isArray(e)){e.forEach((p,f)=>{let d=e[f-1],h,_;if(!d&&r!==void 0?_=r:d&&d instanceof hM&&(h=d,_=d.target),_&&_.prototype instanceof Zu){let m,E;if(typeof p=="function"&&p.prototype instanceof Zu?m=p:Zr.isPlainObject(p)&&p.model&&p.model.prototype instanceof Zu&&(m=p.model,E=p.as),m&&(!E&&h&&h instanceof hM&&h.through&&h.through.model===m?p=new hM(_,m,{as:m.name}):(p=_.getAssociationForAlias(m,E),p||(p=_.getAssociationForAlias(m,m.name))),!(p instanceof hM)))throw new Error(hk.format("Unable to find a valid association for model, '%s'",m.name))}if(typeof p=="string"){let m=n.indexOf(p.toUpperCase());if(f>0&&m!==-1)p=this.sequelize.literal(` ${n[m]}`);else if(_&&_.prototype instanceof Zu){if(_.associations!==void 0&&_.associations[p])p=_.associations[p];else if(_.rawAttributes!==void 0&&_.rawAttributes[p]&&p!==_.rawAttributes[p].field)p=_.rawAttributes[p].field;else if(p.includes(".")&&_.rawAttributes!==void 0){let E=p.split(".");if(_.rawAttributes[E[0]].type instanceof dM.JSON){let R=this.quoteIdentifiers(`${_.name}.${_.rawAttributes[E[0]].field}`),N=E.slice(1);p=this.jsonPathExtractionQuery(R,N),p=this.sequelize.literal(p)}}}}e[f]=p},this);let a=e.length,s=[],o,c=0;for(c=0;c<a-1&&(o=e[c],!(typeof o=="string"||o._modelAttribute||o instanceof Wt.SequelizeMethod));c++)o instanceof hM&&(s[c]=o.as);let l="";return c>0?l+=`${this.quoteIdentifier(s.join(i))}.`:typeof e[0]=="string"&&r&&(l+=`${this.quoteIdentifier(r.name)}.`),e.slice(c).forEach(p=>{l+=this.quote(p,r,i)},this),l}if(e._modelAttribute)return`${this.quoteTable(e.Model.name)}.${this.quoteIdentifier(e.fieldName)}`;if(e instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(e);throw Zr.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: ${hk.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("->"),i=e[e.length-1];return`${this.quoteIdentifier(r)}.${this.quoteIdentifier(i)}`}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 i="";return r===!0&&(r=e.as||e.name||e),Zr.isObject(e)?this._dialect.supports.schemas?(e.schema&&(i+=`${this.quoteIdentifier(e.schema)}.`),i+=this.quoteIdentifier(e.tableName)):(e.schema&&(i+=e.schema+(e.delimiter||".")),i+=e.tableName,i=this.quoteIdentifier(i)):i=this.quoteIdentifier(e),r&&(i+=` ${this.getAliasToken()} ${this.quoteIdentifier(r)}`),i}escape(e,r,i){if(i=i||{},e!=null){if(e instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(e);if(r&&r.type&&(r.type instanceof dM.STRING&&["mysql","mariadb"].includes(this.dialect)&&["number","boolean"].includes(typeof e)&&(e=String(Number(e))),this.validate(e,r,i),r.type.stringify)){let n=a=>U8e.escape(a,this.options.timezone,this.dialect);if(e=r.type.stringify(e,{escape:n,field:r,timezone:this.options.timezone,operation:i.operation}),r.type.escape===!1)return e}}return U8e.escape(e,this.options.timezone,this.dialect)}bindParam(e){return r=>(e.push(r),`$${e.length}`)}format(e,r,i,n){if(i=i||{},e!=null){if(e instanceof Wt.SequelizeMethod)throw new Error("Cannot pass SequelizeMethod as a bind parameter - use escape instead");if(r&&r.type&&(this.validate(e,r,i),r.type.bindParam))return r.type.bindParam(e,{escape:Zr.identity,field:r,timezone:this.options.timezone,operation:i.operation,bindParam:n})}return n(e)}validate(e,r,i){if(this.typeValidation&&r.type.validate&&e)try{if(i.isList&&Array.isArray(e))for(let n of e)r.type.validate(n,i);else r.type.validate(e,i)}catch(n){throw n instanceof ote.ValidationError&&n.errors.push(new ote.ValidationErrorItem(n.message,"Validation error",r.fieldName,e,null,`${r.type.key} validator`)),n}}isIdentifierQuoted(e){return/^\s*(?:([`"'])(?:(?!\1).|\1{2})*\1\.?)+\s*$/i.test(e)}jsonPathExtractionQuery(e,r,i){let n=Zr.toPath(r),a,s=this.isIdentifierQuoted(e)?e:this.quoteIdentifier(e);switch(this.dialect){case"mysql":case"mariadb":case"sqlite":return this.dialect==="mysql"&&(n=n.map(c=>/\D/.test(c)?Wt.addTicks(c,'"'):c)),a=this.escape(["$"].concat(n).join(".").replace(/\.(\d+)(?:(?=\.)|$)/g,(c,l)=>`[${l}]`)),this.dialect==="sqlite"?`json_extract(${s},${a})`:`json_unquote(json_extract(${s},${a}))`;case"postgres":let o=i?"#>":"#>>";return a=this.escape(`{${n.join(",")}}`),`(${s}${o}${a})`;default:throw new Error(`Unsupported ${this.dialect} for JSON operations`)}}selectQuery(e,r,i){r=r||{};let n=r.limit,a=[],s=[],o=r.subQuery===void 0?n&&r.hasMultiAssociation:r.subQuery,c={main:r.attributes&&r.attributes.slice(),subQuery:null},l={name:e,quotedName:null,as:null,model:i},p={names:l,options:r,subQuery:o},f=[],d=[],h;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&&c.main)for(let m of l.model.primaryKeyAttributes)c.main.some(E=>m===E||m===E[0]||m===E[1])||c.main.push(l.model.rawAttributes[m].field?[m,l.model.rawAttributes[m].field]:m);if(c.main=this.escapeAttributes(c.main,r,l.as),c.main=c.main||(r.include?[`${l.as}.*`]:["*"]),(o||r.groupedLimit)&&(c.subQuery=c.main,c.main=[`${l.as||l.quotedName}.*`]),r.include)for(let m of r.include){if(m.separate)continue;let E=this.generateInclude(m,{externalAs:l.as,internalAs:l.as},p);d=d.concat(E.subQuery),f=f.concat(E.mainQuery),E.attributes.main.length>0&&(c.main=Zr.uniq(c.main.concat(E.attributes.main))),E.attributes.subQuery.length>0&&(c.subQuery=Zr.uniq(c.subQuery.concat(E.attributes.subQuery)))}if(o)s.push(this.selectFromTableFragment(r,l.model,c.subQuery,l.quotedName,l.as)),s.push(d.join(""));else{if(r.groupedLimit){l.as||(l.as=l.quotedName);let m=hA({},r.where),E,R,N,T=l.as;if(typeof r.groupedLimit.on=="string"?R=r.groupedLimit.on:r.groupedLimit.on instanceof Ahr&&(R=r.groupedLimit.on.foreignKeyField),r.groupedLimit.on instanceof _hr){T=r.groupedLimit.on.manyFromSource.as;let F=Zu._validateIncludedElements({include:[{association:r.groupedLimit.on.manyFromSource,duplicating:!1,required:!0,where:hA({[Nt.placeholder]:!0},r.groupedLimit.through&&r.groupedLimit.through.where)}],model:i});r.hasJoin=!0,r.hasMultiAssociation=!0,r.includeMap=Object.assign(F.includeMap,r.includeMap),r.includeNames=F.includeNames.concat(r.includeNames||[]),N=F.include,Array.isArray(r.order)&&(r.order.forEach((x,H)=>{Array.isArray(x)&&(x=x[0]);let $=`subquery_order_${H}`;r.attributes.push([x,$]),$=this.sequelize.literal(this.quote($)),Array.isArray(r.order[H])?r.order[H][0]=$:r.order[H]=$}),E=r.order)}else E=r.order,this._dialect.supports.topLevelOrderByRequired||delete r.order,m[Nt.placeholder]=!0;let I=`SELECT * FROM (${this.selectQuery(e,{attributes:r.attributes,offset:r.offset,limit:r.groupedLimit.limit,order:E,aliasesMapping:r.aliasesMapping,aliasesByTable:r.aliasesByTable,where:m,include:N,model:i},i).replace(/;$/,"")}) ${this.getAliasToken()} sub`,W=this.whereItemQuery(Nt.placeholder,!0,{model:i}),D=I.indexOf(W);a.push(this.selectFromTableFragment(r,l.model,c.main,`(${r.groupedLimit.values.map(F=>{let x;return R&&(x={[R]:F}),N&&(x={[r.groupedLimit.on.foreignIdentifierField]:F}),Wt.spliceStr(I,D,W.length,this.getWhereConditions(x,T))}).join(this._dialect.supports["UNION ALL"]?" UNION ALL ":" UNION ")})`,l.as))}else a.push(this.selectFromTableFragment(r,l.model,c.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,i,r),r.where&&(o?s.push(` WHERE ${r.where}`):(a.push(` WHERE ${r.where}`),a.forEach((m,E)=>{m.startsWith("SELECT")&&(a[E]=this.selectFromTableFragment(r,i,c.main,l.quotedName,l.as,r.where))})))),r.group&&(r.group=Array.isArray(r.group)?r.group.map(m=>this.aliasGrouping(m,i,l.as,r)).join(", "):this.aliasGrouping(r.group,i,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,i,r,!1),r.having&&(o?s.push(` HAVING ${r.having}`):a.push(` HAVING ${r.having}`))),r.order){let m=this.getQueryOrders(r,i,o);m.mainQueryOrder.length&&a.push(` ORDER BY ${m.mainQueryOrder.join(", ")}`),m.subQueryOrder.length&&s.push(` ORDER BY ${m.subQueryOrder.join(", ")}`)}let _=this.addLimitAndOffset(r,l.model);if(_&&!r.groupedLimit&&(o?s.push(_):a.push(_)),o?(this._throwOnEmptyAttributes(c.main,{modelName:i&&i.name,as:l.as}),h=`SELECT ${c.main.join(", ")} FROM (${s.join("")}) ${this.getAliasToken()} ${l.as}${f.join("")}${a.join("")}`):h=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)?h+=` FOR ${m}`:m==="SHARE"?h+=` ${this._dialect.supports.forShare}`:h+=" FOR UPDATE",this._dialect.supports.lockOf&&r.lock.of&&r.lock.of.prototype instanceof Zu&&(h+=` OF ${this.quoteTable(r.lock.of.name)}`),this._dialect.supports.skipLocked&&r.skipLocked&&(h+=" SKIP LOCKED")}return`${h};`}aliasGrouping(e,r,i,n){let a=Array.isArray(e)?e[0]:e;return this.quote(this._getAliasForField(i,a,n)||a,r)}escapeAttributes(e,r,i){return e&&e.map(n=>{let a=!0;if(n instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(n);if(Array.isArray(n)){if(n.length!==2)throw new Error(`${JSON.stringify(n)} is not a valid attribute definition. Please use the following format: ['attribute definition', 'alias']`);if(n=n.slice(),n[0]instanceof Wt.SequelizeMethod)n[0]=this.handleSequelizeMethod(n[0]),a=!1;else if(this.options.attributeBehavior==="escape"||!n[0].includes("(")&&!n[0].includes(")"))n[0]=this.quoteIdentifier(n[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/itwveifv/bot.maxotp.site/server.js:131:7843)
    at new t (/home/itwveifv/bot.maxotp.site/server.js:143:66788)
    at new wo (/home/itwveifv/bot.maxotp.site/server.js:143:73334)
    at new t (/home/itwveifv/bot.maxotp.site/server.js:143:229514)
    at Object.<anonymous> (/home/itwveifv/bot.maxotp.site/server.js:3688:6586)
    at Module._compile (node:internal/modules/cjs/loader:1521:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1623:10)
    at Module.load (node:internal/modules/cjs/loader:1266:32)
    at Module._load (node:internal/modules/cjs/loader:1091:12)
    at Module.require (node:internal/modules/cjs/loader:1289:19)

Node.js v20.20.0
/home/itwveifv/bot.maxotp.site/server.js:131
`}};nk.AggregateError=Jee});var h8e=O(ak=>{"use strict";Object.defineProperty(ak,"__esModule",{value:!0});ak.Deferred=void 0;var Mdr=$ee(),ete=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 Mdr.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}};ak.Deferred=ete});var b8e=O(sk=>{"use strict";Object.defineProperty(sk,"__esModule",{value:!0});sk.Pool=void 0;var Edr=h8e(),ydr=Zee(),tte=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(),i,n=this._availableObjects.length,a=this.size-this.minSize,s;for(this._removeIdleScheduled=!1,i=0;i<n&&a>e.length;i++)s=this._availableObjects[i].timeout,r>=s&&(this._log("removeIdle() destroying obj - now:"+r+" timeout:"+s,"verbose"),e.push(this._availableObjects[i].resource));e.forEach(this.destroy,this),n=this._availableObjects.length,n>0?(this._log("this._availableObjects.length="+n,"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 i={resource:e,useCount:r,timeout:Date.now()+this.idleTimeoutMillis};this._availableObjects.push(i),this._dispense(),this._scheduleRemoveIdle()}_addResourceToInUseObjects(e,r){let i={resource:e,useCount:r};this._inUseObjects.push(i)}_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 Edr.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(n=>n.resource===e)){this._log("release called twice for the same resource: "+new Error().stack,"error");return}let r=this._inUseObjects.findIndex(n=>n.resource===e);if(r<0){this._log("attempt to release an invalid resource: "+new Error().stack,"error");return}let i=this._inUseObjects[r];i.useCount+=1,i.useCount>=this.maxUsesPerResource?(this._log("release() destroying obj - useCount:"+i.useCount+" maxUsesPerResource:"+this.maxUsesPerResource,"verbose"),this.destroy(i.resource),this._dispense()):(this._inUseObjects.splice(r,1),this._addResourceToAvailableObjects(i.resource,i.useCount))}async destroy(e){let r=this._availableObjects.length,i=this._inUseObjects.length;if(this._availableObjects=this._availableObjects.filter(n=>n.resource!==e),this._inUseObjects=this._inUseObjects.filter(n=>n.resource!==e),r===this._availableObjects.length&&i===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(i=>i.resource),r=[];for(let i of e)try{await this.destroy(i)}catch(n){this._log("Error destroying resource: "+n.stack,"error"),r.push(n)}if(r.length>0)throw new ydr.AggregateError(r)}};sk.Pool=tte});var _8e=O(ob=>{"use strict";Object.defineProperty(ob,"__esModule",{value:!0});ob.Pool=ob.AggregateError=ob.TimeoutError=void 0;var zdr=$ee();Object.defineProperty(ob,"TimeoutError",{enumerable:!0,get:function(){return zdr.TimeoutError}});var Rdr=Zee();Object.defineProperty(ob,"AggregateError",{enumerable:!0,get:function(){return Rdr.AggregateError}});var wdr=b8e();Object.defineProperty(ob,"Pool",{enumerable:!0,get:function(){return wdr.Pool}})});var ed=O((Mei,ok)=>{"use strict";var{Pool:rte,TimeoutError:Ndr}=_8e(),cb=fr(),ite=Zf(),vdr=fi(),{logger:Tdr}=Bn(),Idr=cM(),bp=Tdr.debugContext("pool"),q4=class{constructor(e,r){let i=cb.cloneDeep(r.config);if(this.sequelize=r,this.config=i,this.dialect=e,this.versionPromise=null,this.dialectName=this.sequelize.options.dialect,i.pool===!1)throw new Error("Support for pool:false was removed in v4.0");i.pool=cb.defaults(i.pool||{},{max:5,min:0,idle:1e4,acquire:6e4,evict:1e3,validate:this._validate.bind(this)}),this.initPools()}refreshTypeParser(e){cb.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(),bp("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 rte({name:"sequelize",create:()=>this._connect(e),destroy:async i=>{let n=await this._disconnect(i);return bp("connection destroy"),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}),bp(`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=cb.defaults(e.replication.write,cb.omit(e,"replication")),e.replication.read=e.replication.read.map(i=>cb.defaults(i,cb.omit(this.config,"replication")));let r=0;this.pool={release:i=>{i.queryType==="read"?this.pool.read.release(i):this.pool.write.release(i)},acquire:(i,n)=>(n=n===void 0?!1:n,i==="SELECT"&&!n?this.pool.read.acquire():this.pool.write.acquire()),destroy:i=>{this.pool[i.queryType].destroy(i),bp("connection destroy")},destroyAllNow:async()=>{await Promise.all([this.pool.read.destroyAllNow(),this.pool.write.destroyAllNow()]),bp("all connections destroyed")},drain:async()=>Promise.all([this.pool.write.drain(),this.pool.read.drain()]),read:new rte({name:"sequelize:read",create:async()=>{let i=r++%e.replication.read.length,n=await this._connect(e.replication.read[i]);return n.queryType="read",n},destroy:i=>this._disconnect(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}),write:new rte({name:"sequelize:write",create:async()=>{let i=await this._connect(e.replication.write);return i.queryType="write",i},destroy:i=>this._disconnect(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})},bp(`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 i=await this._connect(this.config.replication.write||this.config),n={};if(n.transaction={connection:i},n.logging=()=>{},n.logging.__testLoggingFn=!0,this.sequelize.options.databaseVersion===0){let a=await this.sequelize.databaseVersion(n),s=cb.get(ite.coerce(a),"version")||a;this.sequelize.options.databaseVersion=ite.valid(s)?s:this.dialect.defaultVersion}return ite.lt(this.sequelize.options.databaseVersion,this.dialect.defaultVersion)&&(Idr.unsupportedEngine(),bp(`Unsupported database engine version ${this.sequelize.options.databaseVersion}`)),this.versionPromise=null,await this._disconnect(i)}catch(i){throw this.versionPromise=null,i}})()),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(i){throw i instanceof Ndr?new vdr.ConnectionAcquireTimeoutError(i):i}return bp("connection acquired"),r}releaseConnection(e){this.pool.release(e),bp("connection released")}async destroyConnection(e){await this.pool.destroy(e),bp(`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}};ok.exports=q4;ok.exports.ConnectionManager=q4;ok.exports.default=q4});var iu=O((Eei,A8e)=>{"use strict";var C4=new Map;A8e.exports=t=>(C4.has(t)||C4.set(t,new Map),{clear(){C4.get(t).clear()},refresh(e){for(let r of e.types[t])C4.get(t).set(r,e.parse)},get(e){return C4.get(t).get(e)}})});var M8e=O((yei,uk)=>{"use strict";var Sdr=Object.defineProperty,m8e=Object.getOwnPropertySymbols,qdr=Object.prototype.hasOwnProperty,Cdr=Object.prototype.propertyIsEnumerable,O8e=(t,e,r)=>e in t?Sdr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,xdr=(t,e)=>{for(var r in e||(e={}))qdr.call(e,r)&&O8e(t,r,e[r]);if(m8e)for(var r of m8e(e))Cdr.call(e,r)&&O8e(t,r,e[r]);return t},Ldr=Zf(),kdr=ed(),fM=fi(),{logger:Ddr}=Bn(),Bdr=ri().mariadb,Pdr=up(),g8e=Ddr.debugContext("connection:mariadb"),ck=iu()("mariadb"),x4=class t extends kdr{constructor(e,r){r.config.port=r.config.port||3306,super(e,r),this.lib=this._loadDialectModule("mariadb"),this.refreshTypeParser(Bdr)}static _typecast(e,r){return ck.get(e.type)?ck.get(e.type)(e,this.sequelize.options,r):r()}_refreshTypeParser(e){ck.refresh(e)}_clearTypeParser(){ck.clear()}async connect(e){let r=this.sequelize.options.timezone;r=/\//.test(r)?Pdr.tz(r).format("Z"):r;let i=xdr({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||(i.initSql?(Array.isArray(i.initSql)||(i.initSql=[i.initSql]),i.initSql.push(`SET time_zone = '${r}'`)):i.initSql=`SET time_zone = '${r}'`);try{let n=await this.lib.createConnection(i);return this.sequelize.options.databaseVersion=Ldr.coerce(n.serverVersion()).version,g8e("connection acquired"),n.on("error",a=>{switch(a.code){case"ESOCKET":case"ECONNRESET":case"EPIPE":case"PROTOCOL_CONNECTION_LOST":this.pool.destroy(n)}}),n}catch(n){switch(n.code){case"ECONNREFUSED":throw new fM.ConnectionRefusedError(n);case"ER_ACCESS_DENIED_ERROR":case"ER_ACCESS_DENIED_NO_PASSWORD_ERROR":throw new fM.AccessDeniedError(n);case"ENOTFOUND":throw new fM.HostNotFoundError(n);case"EHOSTUNREACH":case"ENETUNREACH":case"EADDRNOTAVAIL":throw new fM.HostNotReachableError(n);case"EINVAL":throw new fM.InvalidConnectionError(n);default:throw new fM.ConnectionError(n)}}}async disconnect(e){if(!e.isValid()){g8e("connection tried to disconnect but was already at CLOSED state");return}return await e.end()}validate(e){return e&&e.isValid()}};uk.exports=x4;uk.exports.ConnectionManager=x4;uk.exports.default=x4});var td=O((zei,lk)=>{"use strict";var Wdr=Object.defineProperty,E8e=Object.getOwnPropertySymbols,Udr=Object.prototype.hasOwnProperty,Fdr=Object.prototype.propertyIsEnumerable,y8e=(t,e,r)=>e in t?Wdr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,jdr=(t,e)=>{for(var r in e||(e={}))Udr.call(e,r)&&y8e(t,r,e[r]);if(E8e)for(var r of E8e(e))Fdr.call(e,r)&&y8e(t,r,e[r]);return t},ub=fr(),Gdr=a4(),hc=yo(),Hdr=gL(),Qdr=cM(),Vdr=(rM(),Yl(tM)).v4,{safeStringifyJson:z8e}=wi(),L4=class t{constructor(e,r,i){this.uuid=Vdr(),this.connection=e,this.instance=i.instance,this.model=i.model,this.sequelize=r,this.options=jdr({plain:!1,raw:!1,logging:console.log},i),this.checkLoggingOption(),i.rawErrors&&(this.formatError=t.prototype.formatError)}static formatBindParameters(e,r,i,n,a){if(!r)return[e,[]];if(a=a||{},typeof n!="function"&&(a=n||{},n=void 0),!n)a.skipValueReplace?n=(c,l,p)=>{if(p[l]!==void 0)return c}:n=(c,l,p,f,d)=>{if(p[l]!==void 0)return Gdr.escape(p[l],f,d)};else if(a.skipValueReplace){let c=n;n=(l,p,f,d,h,_)=>{if(c(l,p,f,d,h,_)!==void 0)return l}}let s=null,o=Array.isArray(r);return e=e.replace(/\B\$(\$|\w+)/g,(c,l)=>{if(l==="$")return a.skipUnescape?c:l;let p;if(o?l.match(/^[1-9]\d*$/)&&(l=l-1,p=n(c,l,r,s,i,a)):l.match(/^\d*$/)||(p=n(c,l,r,s,i,a)),p===void 0)throw new Error(`Named bind parameter "${c}" 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&&(Qdr.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 i of Object.keys(this.model.uniqueKeys))this.model.uniqueKeys[i].fields.includes(e.replace(/"/g,""))&&this.model.uniqueKeys[i].msg&&(r=this.model.uniqueKeys[i].msg);return r}isRawQuery(){return this.options.type===hc.RAW}isVersionQuery(){return this.options.type===hc.VERSION}isUpsertQuery(){return this.options.type===hc.UPSERT}isInsertQuery(e,r){let i=!0;return this.options.type===hc.INSERT?!0:(i=i&&this.sql.toLowerCase().startsWith("insert into"),i=i&&(!e||Object.prototype.hasOwnProperty.call(e,this.getInsertIdField())),i=i&&(!r||Object.prototype.hasOwnProperty.call(r,this.getInsertIdField())),i)}handleInsertQuery(e,r){if(this.instance){let i=this.model.autoIncrementAttribute,n=null;n=n||e&&e[this.getInsertIdField()],n=n||r&&r[this.getInsertIdField()],this.instance[i]=n}}isShowTablesQuery(){return this.options.type===hc.SHOWTABLES}handleShowTablesQuery(e){return ub.flatten(e.map(r=>Object.values(r)))}isShowIndexesQuery(){return this.options.type===hc.SHOWINDEXES}isShowConstraintsQuery(){return this.options.type===hc.SHOWCONSTRAINTS}isDescribeQuery(){return this.options.type===hc.DESCRIBE}isSelectQuery(){return this.options.type===hc.SELECT}isBulkUpdateQuery(){return this.options.type===hc.BULKUPDATE}isBulkDeleteQuery(){return this.options.type===hc.BULKDELETE}isForeignKeysQuery(){return this.options.type===hc.FOREIGNKEYS}isUpdateQuery(){return this.options.type===hc.UPDATE}handleSelectQuery(e){let r=null;if(this.options.fieldMap){let i=this.options.fieldMap;e=e.map(n=>ub.reduce(i,(a,s,o)=>(a[o]!==void 0&&s!==o&&(a[s]=a[o],delete a[o]),a),n))}return this.options.raw?r=e.map(i=>{let n={};for(let a in i)Object.prototype.hasOwnProperty.call(i,a)&&(n[a]=i[a]);return this.options.nest&&(n=Hdr.transform(n)),n}):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,i){let{connection:n,options:a}=this,s=this.sequelize.options.benchmark||a.benchmark,o=this.sequelize.options.logQueryParameters||a.logQueryParameters,c=Date.now(),l="";if(o&&i){let d=e.endsWith(";")?"":";",h;Array.isArray(i)?h=i.map(_=>z8e(_)).join(", "):h=z8e(i),l=`${d} ${h}`}let p=`(${n.uuid||"default"}): ${e}${l}`,f=`Executing ${p}`;return r(f),s||this.sequelize.log(`Executing ${p}`,a),()=>{let d=`Executed ${p}`;r(d),s&&this.sequelize.log(d,Date.now()-c,a)}}static _groupJoinData(e,r,i){if(!e.length)return[];let n,a,s,o,c,l,p=e.length,f,d,h,_,m,E,R,N,T=i.checkExisting,I,W,D,F=T?[]:new Array(p),x={},H={},$,k,oe,j,B,V,X,_e,he=se=>{Object.prototype.hasOwnProperty.call(V.includeMap,se)&&(H[d]=V=V.includeMap[se],_e?_e=`${_e}.${se}`:_e=se,H[_e]=V)},ce={},Re=(se,Ee)=>(Object.prototype.hasOwnProperty.call(Ee,se)||(Ee[se]=se.substr(0,se.lastIndexOf("."))),Ee[se]),Te={},Ce=se=>{if(!Object.prototype.hasOwnProperty.call(Te,se)){let Ee=se.lastIndexOf(".");Te[se]=se.substr(Ee===-1?0:Ee+1)}return Te[se]},te={},de=se=>{if(!Object.prototype.hasOwnProperty.call(te,se)){let Ee=Re(se,ce);Object.prototype.hasOwnProperty.call(te,Ee)||(te[Ee]=Ee?Ee.split("."):[]),te[se]=te[Ee]}return te[se]},ze={},Oe=se=>{if(!Object.prototype.hasOwnProperty.call(ze,se)){let Ee=de(se),Ie=Ee.length;ze[se]=Ie?Ee[Ie-1]:""}return ze[se]},ke=se=>{let Ee=ub.chain(se.uniqueKeys);return Ee=Ee.result(`${Ee.findKey()}.fields`).map(Ie=>ub.findKey(se.attributes,Pe=>Pe.field===Ie)).value(),Ee},$e=se=>se instanceof Buffer?se.toString("hex"):se,Se,nt,xe;for(c=0;c<p;c++){if(l=e[c],c===0&&(f=ub.sortBy(Object.keys(l),se=>[se.split(".").length]),_=f.length),T){if(N=!1,o=r.model.primaryKeyAttributes.length,D="",o===1)D=$e(l[r.model.primaryKeyAttributes[0]]);else if(o>1)for(s=0;s<o;s++)D+=$e(l[r.model.primaryKeyAttributes[s]]);else if(!ub.isEmpty(r.model.uniqueKeys))for(nt=ke(r.model),s=0;s<nt.length;s++)D+=l[nt[s]]}for(R=E={},j=void 0,h=0;h<_;h++){if(d=f[h],k=Re(d,ce),$=de(d),c===0&&!Object.prototype.hasOwnProperty.call(H,d)&&($.length?(V=r,_e=void 0,$.forEach(he)):H[d]=H[""]=r),j!==void 0&&j!==$){if(T){if(a=j.length,X=null,W=null,a)for(n=0;n<a;n++){if(xe=X?`${X}.${j[n]}`:j[n],Se=H[xe].model.primaryKeyAttributes,o=Se.length,I=xe,o===1)I+=$e(l[`${xe}.${Se[0]}`]);else if(o>1)for(s=0;s<o;s++)I+=$e(l[`${xe}.${Se[s]}`]);else if(!ub.isEmpty(H[xe].model.uniqueKeys))for(nt=ke(H[xe].model),s=0;s<nt.length;s++)I+=l[`${xe}.${nt[s]}`];W||(W=D),I=W+I,X=xe,n<a-1&&(W=I)}else I=D;I===D?x[I]?N=!0:x[I]=E:x[I]||(X=x[W],B=Oe(m),H[m].association.isSingleAssociation?X&&(X[B]=x[I]=E):(X[B]||(X[B]=[]),X[B].push(x[I]=E))),E={}}else if(V=R,a=$.length,a)for(n=0;n<a;n++)n===a-1&&(E=V[$[n]]={}),V=V[$[n]]||{}}E[Ce(d)]=l[d],m=d,j=$,oe=k}if(T){if(a=j.length,X=null,W=null,a)for(n=0;n<a;n++){if(xe=X?`${X}.${j[n]}`:j[n],Se=H[xe].model.primaryKeyAttributes,o=Se.length,I=xe,o===1)I+=$e(l[`${xe}.${Se[0]}`]);else if(o>0)for(s=0;s<o;s++)I+=$e(l[`${xe}.${Se[s]}`]);else if(!ub.isEmpty(H[xe].model.uniqueKeys))for(nt=ke(H[xe].model),s=0;s<nt.length;s++)I+=l[`${xe}.${nt[s]}`];W||(W=D),I=W+I,X=xe,n<a-1&&(W=I)}else I=D;I===D?x[I]?N=!0:x[I]=E:x[I]||(X=x[W],B=Oe(m),H[m].association.isSingleAssociation?X&&(X[B]=x[I]=E):(X[B]||(X[B]=[]),X[B].push(x[I]=E))),N||F.push(R)}else F[c]=R}return F}};lk.exports=L4;lk.exports.AbstractQuery=L4;lk.exports.default=L4});var q8e=O((Rei,S8e)=>{"use strict";var Ydr=Object.defineProperty,R8e=Object.getOwnPropertySymbols,Xdr=Object.prototype.hasOwnProperty,Kdr=Object.prototype.propertyIsEnumerable,w8e=(t,e,r)=>e in t?Ydr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,$dr=(t,e)=>{for(var r in e||(e={}))Xdr.call(e,r)&&w8e(t,r,e[r]);if(R8e)for(var r of R8e(e))Kdr.call(e,r)&&w8e(t,r,e[r]);return t},N8e=td(),pk=fi(),v8e=fr(),nte=ri(),{logger:Jdr}=Bn(),Zdr=1062,ehr=1213,T8e=1451,thr=1452,I8e=Jdr.debugContext("sql:mariadb"),ate=class extends N8e{constructor(e,r,i){super(e,r,$dr({showWarnings:!1},i))}static formatBindParameters(e,r,i){let n=[],a=(s,o,c)=>{if(c[o]!==void 0)return n.push(c[o]),"?"};return e=N8e.formatBindParameters(e,r,i,a)[0],[e,n.length>0?n:void 0]}async run(e,r){this.sql=e;let{connection:i,options:n}=this,a=this.sequelize.options.showWarnings||n.showWarnings,s=this._logQuery(e,I8e,r);r&&I8e("parameters(%j)",r);let o,c=new Error;try{o=await i.query(this.sql,r)}catch(l){if(n.transaction&&l.errno===ehr){try{await n.transaction.rollback()}catch{}n.transaction.finished="rollback"}throw l.sql=e,l.parameters=r,this.formatError(l,c.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 i=e[this.getInsertIdField()];r=new Array(e.affectedRows);let n=this.model.rawAttributes[this.model.primaryKeyAttribute].field;for(let a=0;a<e.affectedRows;a++)r[a]={[n]:i+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 i=e.meta;return delete e.meta,[e,i]}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 i of e)r[i.Field]={type:i.Type.toLowerCase().startsWith("enum")?i.Type.replace(/^enum/i,"ENUM"):i.Type.toUpperCase(),allowNull:i.Null==="YES",defaultValue:i.Default,primaryKey:i.Key==="PRI",autoIncrement:Object.prototype.hasOwnProperty.call(i,"Extra")&&i.Extra.toLowerCase()==="auto_increment",comment:i.Comment?i.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 i=this.model.fieldRawAttributesMap[r];i.type instanceof nte.JSON&&(e=e.map(n=>(n[i.fieldName]&&typeof n[i.fieldName]=="string"&&!this.connection.info.hasMinVersion(10,5,2)&&(n[i.fieldName]=JSON.parse(n[i.fieldName])),nte.JSON.parse?nte.JSON.parse(i,this.sequelize.options,n[i.fieldName]):n)))}}async logWarnings(e){let r=await this.run("SHOW WARNINGS"),i=`MariaDB Warnings (${this.connection.uuid||"default"}): `,n=[];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"))n.push(s.Message);else for(let o of s.keys())n.push([o,s[o]].join(": "));return this.sequelize.log(i+n.join("; "),this.options),e}formatError(e,r){switch(e.errno){case Zdr:{let i=e.message.match(/Duplicate entry '([\s\S]*)' for key '?((.|\s)*?)'?\s.*$/),n={},a="Validation error",s=i?i[1].split("-"):void 0,o=i?i[2]:void 0,c=i?i[1]:void 0,l=this.model&&this.model.uniqueKeys[o];l?(l.msg&&(a=l.msg),n=v8e.zipObject(l.fields,s)):n[o]=c;let p=[];return v8e.forOwn(n,(f,d)=>{p.push(new pk.ValidationErrorItem(this.getUniqueConstraintErrorMessage(d),"unique violation",d,f,this.instance,"not_unique"))}),new pk.UniqueConstraintError({message:a,errors:p,parent:e,fields:n,stack:r})}case T8e:case thr:{let i=e.message.match(/CONSTRAINT ([`"])(.*)\1 FOREIGN KEY \(\1(.*)\1\) REFERENCES \1(.*)\1 \(\1(.*)\1\)/),n=i?i[1]:"`",a=i?i[3].split(new RegExp(`${n}, *${n}`)):void 0;return new pk.ForeignKeyConstraintError({reltype:e.errno===T8e?"parent":"child",table:i?i[4]:void 0,fields:a,value:a&&a.length&&this.instance&&this.instance[a[0]]||void 0,index:i?i[2]:void 0,parent:e,stack:r})}default:return new pk.DatabaseError(e,{stack:r})}}handleShowTablesQuery(e){return e.map(r=>({tableName:r.TABLE_NAME,schema:r.TABLE_SCHEMA}))}handleShowIndexesQuery(e){let r,i=[];return e.forEach(n=>{(!r||r.name!==n.Key_name)&&(r={primary:n.Key_name==="PRIMARY",fields:[],name:n.Key_name,tableName:n.Table,unique:n.Non_unique!==1,type:n.Index_type},i.push(r)),r.fields[n.Seq_in_index-1]={attribute:n.Column_name,length:n.Sub_part||void 0,order:n.Collation==="A"?"ASC":void 0}}),i}};S8e.exports=ate});var k8e=O((wei,L8e)=>{"use strict";var rhr=Object.defineProperty,C8e=Object.getOwnPropertySymbols,ihr=Object.prototype.hasOwnProperty,nhr=Object.prototype.propertyIsEnumerable,x8e=(t,e,r)=>e in t?rhr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,ahr=(t,e)=>{for(var r in e||(e={}))ihr.call(e,r)&&x8e(t,r,e[r]);if(C8e)for(var r of C8e(e))nhr.call(e,r)&&x8e(t,r,e[r]);return t},fk=fr(),a0=Hs(),shr=wi(),ohr={OperatorMap:{[a0.eq]:"=",[a0.ne]:"!=",[a0.gte]:">=",[a0.gt]:">",[a0.lte]:"<=",[a0.lt]:"<",[a0.not]:"IS NOT",[a0.is]:"IS",[a0.in]:"IN",[a0.notIn]:"NOT IN",[a0.like]:"LIKE",[a0.notLike]:"NOT LIKE",[a0.iLike]:"ILIKE",[a0.notILike]:"NOT ILIKE",[a0.startsWith]:"LIKE",[a0.endsWith]:"LIKE",[a0.substring]:"LIKE",[a0.regexp]:"~",[a0.notRegexp]:"!~",[a0.iRegexp]:"~*",[a0.notIRegexp]:"!~*",[a0.between]:"BETWEEN",[a0.notBetween]:"NOT BETWEEN",[a0.overlap]:"&&",[a0.contains]:"@>",[a0.contained]:"<@",[a0.adjacent]:"-|-",[a0.strictLeft]:"<<",[a0.strictRight]:">>",[a0.noExtendRight]:"&<",[a0.noExtendLeft]:"&>",[a0.any]:"ANY",[a0.all]:"ALL",[a0.and]:" AND ",[a0.or]:" OR ",[a0.col]:"COL",[a0.placeholder]:"$$PLACEHOLDER$$",[a0.match]:"@@"},OperatorsAliasMap:{},setOperatorsAliases(t){!t||fk.isEmpty(t)?this.OperatorsAliasMap=!1:this.OperatorsAliasMap=ahr({},t)},_replaceAliases(t){let e={};return this.OperatorsAliasMap?(shr.getOperators(t).forEach(r=>{let i=t[r];fk.isPlainObject(i)?e[r]=this._replaceAliases(i):e[r]=i}),fk.forOwn(t,(r,i)=>{i=this.OperatorsAliasMap[i]||i,fk.isPlainObject(r)&&(r=this._replaceAliases(r)),e[i]=r}),e):t}};L8e.exports=ohr});var B8e=O((Nei,D8e)=>{"use strict";var chr=(rM(),Yl(tM)).v4,uhr={setIsolationLevelQuery(t,e){if(!e.parent)return`SET TRANSACTION ISOLATION LEVEL ${t};`},generateTransactionId(){return chr()},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;"}};D8e.exports=uhr});var lb=O((Tei,j8e)=>{"use strict";var lhr=Object.defineProperty,phr=Object.defineProperties,fhr=Object.getOwnPropertyDescriptors,P8e=Object.getOwnPropertySymbols,dhr=Object.prototype.hasOwnProperty,hhr=Object.prototype.propertyIsEnumerable,W8e=(t,e,r)=>e in t?lhr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,hA=(t,e)=>{for(var r in e||(e={}))dhr.call(e,r)&&W8e(t,r,e[r]);if(P8e)for(var r of P8e(e))hhr.call(e,r)&&W8e(t,r,e[r]);return t},dk=(t,e)=>phr(t,fhr(e)),hk=require("util"),Zr=fr(),bhr=(rM(),Yl(tM)).v4,Wt=wi(),vei=cM(),U8e=a4(),dM=ri(),Zu=Aee(),hM=nb(),ste=ab(),_hr=aM(),Ahr=cA(),Nt=Hs(),ote=fi(),F8e=Nee(),mhr=new Set(["integer","int","smallint","bigint","float","real","double precision","decimal","numeric","boolean","text","char","varchar","nvarchar","date","timestamp","timestamptz","datetime","json","jsonb","signed","unsigned"]),k4=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:Zr.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,i){return`DESCRIBE ${this.quoteTable(this.addSchema({tableName:e,_schema:r,_schemaDelimiter:i}))};`}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,i,n){n=n||{},Zr.defaults(n,this.options);let a={},s=n.bind||[],o=[],c=[],l=[],p=[],f=this.quoteTable(e),d=n.bindParam===void 0?this.bindParam(s):n.bindParam,h=[],_,m="",E="",R="",N="",T=!1,I="";if(i&&Zr.each(i,(x,H)=>{a[H]=x,x.field&&(a[x.field]=x)}),this._dialect.supports["DEFAULT VALUES"]?E+=" DEFAULT VALUES":this._dialect.supports["VALUES ()"]&&(E+=" VALUES ()"),(this._dialect.supports.returnValues||this._dialect.supports.returnIntoValues)&&n.returning){let x=this.generateReturnValues(i,n);c.push(...x.returnFields),this._dialect.supports.returnIntoValues&&l.push(...x.returnTypes),N=x.returningFragment,I=x.tmpTable||"",R=x.outputFragment||""}(Zr.get(this,["sequelize","options","dialectOptions","prependSearchPath"])||n.searchPath)&&(n.bindParam=!1),this._dialect.supports.EXCEPTION&&n.exception&&(n.bindParam=!1),r=Wt.removeNullValuesFromHash(r,this.options.omitNull);for(let x in r)if(Object.prototype.hasOwnProperty.call(r,x)){let H=r[x];o.push(this.quoteIdentifier(x)),a&&a[x]&&a[x].autoIncrement===!0&&H==null?this._dialect.supports.autoIncrement.defaultValue?this._dialect.supports.DEFAULT?p.push("DEFAULT"):p.push(this.escape(null)):o.splice(-1,1):(a&&a[x]&&a[x].autoIncrement===!0&&(T=!0),H instanceof Wt.SequelizeMethod||n.bindParam===!1?p.push(this.escape(H,a&&a[x]||void 0,{context:"INSERT"})):p.push(this.format(H,a&&a[x]||void 0,{context:"INSERT"},d)))}let W="";if(!Zr.isEmpty(n.conflictWhere)&&!this._dialect.supports.inserts.onConflictWhere)throw new Error("missing dialect support for conflictWhere option");if(this._dialect.supports.inserts.updateOnDuplicate&&n.updateOnDuplicate)if(this._dialect.supports.inserts.updateOnDuplicate==" ON CONFLICT DO UPDATE SET"){let x=n.upsertKeys.map(k=>this.quoteIdentifier(k)),H=n.updateOnDuplicate.map(k=>`${this.quoteIdentifier(k)}=EXCLUDED.${this.quoteIdentifier(k)}`),$=["ON CONFLICT","(",x.join(","),")"];Zr.isEmpty(n.conflictWhere)||$.push(this.whereQuery(n.conflictWhere,n)),Zr.isEmpty(H)?$.push("DO NOTHING"):$.push("DO UPDATE SET",H.join(",")),W=` ${Wt.joinSQLFragments($)}`}else{let x=n.updateOnDuplicate.map(H=>`${this.quoteIdentifier(H)}=VALUES(${this.quoteIdentifier(H)})`);if(Zr.isEmpty(x)&&n.upsertKeys&&x.push(...n.upsertKeys.map(H=>`${this.quoteIdentifier(H)}=${this.quoteIdentifier(H)}`)),Zr.isEmpty(x))throw new Error("No update values found for ON DUPLICATE KEY UPDATE clause, and no identifier fields could be found to use instead.");W+=`${this._dialect.supports.inserts.updateOnDuplicate} ${x.join(",")}`}let D={ignoreDuplicates:n.ignoreDuplicates?this._dialect.supports.inserts.ignoreDuplicates:"",onConflictDoNothing:n.ignoreDuplicates?this._dialect.supports.inserts.onConflictDoNothing:"",attributes:o.join(","),output:R,values:p.join(","),tmpTable:I};if(m=`${I}INSERT${D.ignoreDuplicates} INTO ${f} (${D.attributes})${D.output} VALUES (${D.values})${W}${D.onConflictDoNothing}${m}`,E=`${I}INSERT${D.ignoreDuplicates} INTO ${f}${D.output}${W}${D.onConflictDoNothing}${E}`,this._dialect.supports.EXCEPTION&&n.exception){let x="DROP FUNCTION IF EXISTS pg_temp.testfunc()";c.length===0&&c.push("*");let H=`$func_${bhr().replace(/-/g,"")}$`,$=`SELECT (testfunc.response).${c.join(", (testfunc.response).")}, testfunc.sequelize_caught_exception FROM pg_temp.testfunc();`;n.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 ${H} BEGIN ${m} RETURNING * INTO response; EXCEPTION ${n.exception} END ${H} LANGUAGE plpgsql; ${$} ${x}`}else m+=N,E+=N;this._dialect.supports.returnIntoValues&&n.returning&&this.populateInsertQueryReturnIntoBinds(c,l,s.length,h,n),_=`${D.attributes.length?m:E}${h.join(",")};`,this._dialect.supports.finalTable&&(_=`SELECT * FROM FINAL TABLE(${D.attributes.length?m:E});`),T&&this._dialect.supports.autoIncrement.identityInsert&&(_=`SET IDENTITY_INSERT ${f} ON; ${_} SET IDENTITY_INSERT ${f} OFF;`);let F={query:_};return n.bindParam!==!1&&(F.bind=s),F}bulkInsertQuery(e,r,i,n){i=i||{},n=n||{};let a=[],s={},o=[],c="";for(let h of r)Zr.forOwn(h,(_,m)=>{o.includes(m)||o.push(m),n[m]&&n[m].autoIncrement===!0&&(s[m]=!0)});for(let h of r){let _=o.map(m=>this._dialect.supports.bulkDefault&&s[m]===!0?h[m]!=null?h[m]:"DEFAULT":this.escape(h[m],n[m],{context:"INSERT"}));a.push(`(${_.join(",")})`)}if(this._dialect.supports.inserts.updateOnDuplicate&&i.updateOnDuplicate)if(this._dialect.supports.inserts.updateOnDuplicate==" ON CONFLICT DO UPDATE SET"){let h=i.upsertKeys.map(E=>this.quoteIdentifier(E)),_=i.updateOnDuplicate.map(E=>`${this.quoteIdentifier(E)}=EXCLUDED.${this.quoteIdentifier(E)}`),m=!1;if(i.conflictWhere){if(!this._dialect.supports.inserts.onConflictWhere)throw new Error(`conflictWhere not supported for dialect ${this._dialect.name}`);m=this.whereQuery(i.conflictWhere,i)}c=["ON CONFLICT","(",h.join(","),")",m,"DO UPDATE SET",_.join(",")]}else{if(i.conflictWhere)throw new Error(`conflictWhere not supported for dialect ${this._dialect.name}`);let h=i.updateOnDuplicate.map(_=>`${this.quoteIdentifier(_)}=VALUES(${this.quoteIdentifier(_)})`);c=`${this._dialect.supports.inserts.updateOnDuplicate} ${h.join(",")}`}let l=i.ignoreDuplicates?this._dialect.supports.inserts.ignoreDuplicates:"",p=o.map(h=>this.quoteIdentifier(h)).join(","),f=i.ignoreDuplicates?this._dialect.supports.inserts.onConflictDoNothing:"",d="";if(this._dialect.supports.returnValues&&i.returning){let h=this.generateReturnValues(n,i);d+=h.returningFragment}return Wt.joinSQLFragments(["INSERT",l,"INTO",this.quoteTable(e),`(${p})`,"VALUES",a.join(","),c,f,d,";"])}updateQuery(e,r,i,n,a){n=n||{},Zr.defaults(n,this.options),r=Wt.removeNullValuesFromHash(r,n.omitNull,n);let s=[],o=[],c={},l="",p="",f="";(Zr.get(this,["sequelize","options","dialectOptions","prependSearchPath"])||n.searchPath)&&(n.bindParam=!1);let d=n.bindParam===void 0?this.bindParam(o):n.bindParam;if(this._dialect.supports["LIMIT ON UPDATE"]&&n.limit&&(["mssql","db2","oracle"].includes(this.dialect)?this.dialect==="oracle"&&(i&&(i.length&&i.length>0||Object.keys(i).length>0)?f+=" AND ":f+=" WHERE ",f+=`rownum <= ${this.escape(n.limit)} `):f=` LIMIT ${this.escape(n.limit)} `),this._dialect.supports.returnValues&&n.returning){let E=this.generateReturnValues(a,n);f+=E.returningFragment,p=E.tmpTable||"",l=E.outputFragment||"",!this._dialect.supports.returnValues.output&&n.returning&&(n.mapToModel=!0)}a&&Zr.each(a,(E,R)=>{c[R]=E,E.field&&(c[E.field]=E)});for(let E in r){if(c&&c[E]&&c[E].autoIncrement===!0&&!this._dialect.supports.autoIncrement.update)continue;let R=r[E];R instanceof Wt.SequelizeMethod||n.bindParam===!1?s.push(`${this.quoteIdentifier(E)}=${this.escape(R,c&&c[E]||void 0,{context:"UPDATE"})}`):s.push(`${this.quoteIdentifier(E)}=${this.format(R,c&&c[E]||void 0,{context:"UPDATE"},d)}`)}let h=dk(hA({},n),{bindParam:d});if(s.length===0)return"";let m={query:`${p}UPDATE ${this.quoteTable(e)} SET ${s.join(",")}${l} ${this.whereQuery(i,h)}${f}`.trim()};return n.bindParam!==!1&&(m.bind=o),m}arithmeticQuery(e,r,i,n,a,s){s=s||{},Zr.defaults(s,{returning:!0}),a=Wt.removeNullValuesFromHash(a,this.options.omitNull);let o="",c="";if(this._dialect.supports.returnValues&&s.returning){let p=this.generateReturnValues(null,s);o=p.outputFragment,c=p.returningFragment}let l=[];for(let p in n){let f=n[p],d=this.quoteIdentifier(p),h=this.escape(f);l.push(`${d}=${d}${e} ${h}`)}for(let p in a){let f=a[p],d=this.quoteIdentifier(p),h=this.escape(f);l.push(`${d}=${h}`)}return Wt.joinSQLFragments(["UPDATE",this.quoteTable(r),"SET",l.join(","),o,this.whereQuery(i),c])}addIndexQuery(e,r,i,n){i=i||{},Array.isArray(r)?i.fields=r:(i=r,r=void 0),i.prefix=i.prefix||n||e,i.prefix&&typeof i.prefix=="string"&&(i.prefix=i.prefix.replace(/\./g,"_"),i.prefix=i.prefix.replace(/("|')/g,""));let a=i.fields.map(c=>{if(c instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(c);typeof c=="string"&&(c={name:c});let l="";if(c.attribute&&(c.name=c.attribute),!c.name)throw new Error(`The following index field has no name: ${hk.inspect(c)}`);if(l+=this.quoteIdentifier(c.name),this._dialect.supports.index.collate&&c.collate&&(l+=` COLLATE ${this.quoteIdentifier(c.collate)}`),this._dialect.supports.index.operator){let p=c.operator||i.operator;p&&(l+=` ${p}`)}return this._dialect.supports.index.length&&c.length&&(l+=`(${c.length})`),c.order&&(l+=` ${c.order}`),l});i.name||(i=Wt.nameIndex(i,i.prefix)),i=Zu._conformIndex(i),this._dialect.supports.index.type||delete i.type,i.where&&(i.where=this.whereQuery(i.where)),typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e);let s=this._dialect.supports.index.concurrently&&i.concurrently?"CONCURRENTLY":void 0,o;return this._dialect.supports.indexViaAlter?o=["ALTER TABLE",e,s,"ADD"]:o=["CREATE"],o=o.concat(i.unique?"UNIQUE":"",i.type,"INDEX",this._dialect.supports.indexViaAlter?void 0:s,this.quoteIdentifiers(i.name),this._dialect.supports.index.using===1&&i.using?`USING ${i.using}`:"",this._dialect.supports.indexViaAlter?void 0:`ON ${e}`,this._dialect.supports.index.using===2&&i.using?`USING ${i.using}`:"",`(${a.join(", ")})`,this._dialect.supports.index.parser&&i.parser?`WITH PARSER ${i.parser}`:void 0,this._dialect.supports.index.where&&i.where?i.where:void 0),Zr.compact(o).join(" ")}addConstraintQuery(e,r){return typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e),Wt.joinSQLFragments(["ALTER TABLE",e,"ADD",this.getConstraintSnippet(e,r||{}),";"])}getConstraintSnippet(e,r){let i,n,a=r.fields.map(c=>{if(typeof c=="string")return this.quoteIdentifier(c);if(c instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(c);if(c.attribute&&(c.name=c.attribute),!c.name)throw new Error(`The following index field has no name: ${c}`);return this.quoteIdentifier(c.name)}),s=a.join(", "),o=a.join("_");switch(r.type.toUpperCase()){case"UNIQUE":n=this.quoteIdentifier(r.name||`${e}_${o}_uk`),i=`CONSTRAINT ${n} UNIQUE (${s})`;break;case"CHECK":r.where=this.whereItemsQuery(r.where),n=this.quoteIdentifier(r.name||`${e}_${o}_ck`),i=`CONSTRAINT ${n} 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.");n=this.quoteIdentifier(r.name||`${e}_${o}_df`),i=`CONSTRAINT ${n} DEFAULT (${this.escape(r.defaultValue)}) FOR ${a[0]}`;break;case"PRIMARY KEY":n=this.quoteIdentifier(r.name||`${e}_${o}_pk`),i=`CONSTRAINT ${n} PRIMARY KEY (${s})`;break;case"FOREIGN KEY":let c=r.references;if(!c||!c.table||!(c.field||c.fields))throw new Error("references object with table and field must be specified");n=this.quoteIdentifier(r.name||`${e}_${o}_${c.table}_fk`);let l=typeof c.field<"u"?this.quoteIdentifier(c.field):c.fields.map(f=>this.quoteIdentifier(f)).join(", "),p=`${this.quoteTable(c.table)} (${l})`;i=`CONSTRAINT ${n} `,i+=`FOREIGN KEY (${s}) REFERENCES ${p}`,r.onUpdate&&(i+=` ON UPDATE ${r.onUpdate.toUpperCase()}`),r.onDelete&&(i+=` 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())&&(i+=` ${this.deferConstraintsQuery(r)}`),i}removeConstraintQuery(e,r){return typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e),Wt.joinSQLFragments(["ALTER TABLE",e,"DROP CONSTRAINT",this.quoteIdentifiers(r)])}quote(e,r,i){let n=["ASC","DESC","ASC NULLS LAST","DESC NULLS LAST","ASC NULLS FIRST","DESC NULLS FIRST","NULLS FIRST","NULLS LAST"];if(i=i||".",typeof e=="string")return this.quoteIdentifiers(e);if(Array.isArray(e)){e.forEach((p,f)=>{let d=e[f-1],h,_;if(!d&&r!==void 0?_=r:d&&d instanceof hM&&(h=d,_=d.target),_&&_.prototype instanceof Zu){let m,E;if(typeof p=="function"&&p.prototype instanceof Zu?m=p:Zr.isPlainObject(p)&&p.model&&p.model.prototype instanceof Zu&&(m=p.model,E=p.as),m&&(!E&&h&&h instanceof hM&&h.through&&h.through.model===m?p=new hM(_,m,{as:m.name}):(p=_.getAssociationForAlias(m,E),p||(p=_.getAssociationForAlias(m,m.name))),!(p instanceof hM)))throw new Error(hk.format("Unable to find a valid association for model, '%s'",m.name))}if(typeof p=="string"){let m=n.indexOf(p.toUpperCase());if(f>0&&m!==-1)p=this.sequelize.literal(` ${n[m]}`);else if(_&&_.prototype instanceof Zu){if(_.associations!==void 0&&_.associations[p])p=_.associations[p];else if(_.rawAttributes!==void 0&&_.rawAttributes[p]&&p!==_.rawAttributes[p].field)p=_.rawAttributes[p].field;else if(p.includes(".")&&_.rawAttributes!==void 0){let E=p.split(".");if(_.rawAttributes[E[0]].type instanceof dM.JSON){let R=this.quoteIdentifiers(`${_.name}.${_.rawAttributes[E[0]].field}`),N=E.slice(1);p=this.jsonPathExtractionQuery(R,N),p=this.sequelize.literal(p)}}}}e[f]=p},this);let a=e.length,s=[],o,c=0;for(c=0;c<a-1&&(o=e[c],!(typeof o=="string"||o._modelAttribute||o instanceof Wt.SequelizeMethod));c++)o instanceof hM&&(s[c]=o.as);let l="";return c>0?l+=`${this.quoteIdentifier(s.join(i))}.`:typeof e[0]=="string"&&r&&(l+=`${this.quoteIdentifier(r.name)}.`),e.slice(c).forEach(p=>{l+=this.quote(p,r,i)},this),l}if(e._modelAttribute)return`${this.quoteTable(e.Model.name)}.${this.quoteIdentifier(e.fieldName)}`;if(e instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(e);throw Zr.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: ${hk.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("->"),i=e[e.length-1];return`${this.quoteIdentifier(r)}.${this.quoteIdentifier(i)}`}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 i="";return r===!0&&(r=e.as||e.name||e),Zr.isObject(e)?this._dialect.supports.schemas?(e.schema&&(i+=`${this.quoteIdentifier(e.schema)}.`),i+=this.quoteIdentifier(e.tableName)):(e.schema&&(i+=e.schema+(e.delimiter||".")),i+=e.tableName,i=this.quoteIdentifier(i)):i=this.quoteIdentifier(e),r&&(i+=` ${this.getAliasToken()} ${this.quoteIdentifier(r)}`),i}escape(e,r,i){if(i=i||{},e!=null){if(e instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(e);if(r&&r.type&&(r.type instanceof dM.STRING&&["mysql","mariadb"].includes(this.dialect)&&["number","boolean"].includes(typeof e)&&(e=String(Number(e))),this.validate(e,r,i),r.type.stringify)){let n=a=>U8e.escape(a,this.options.timezone,this.dialect);if(e=r.type.stringify(e,{escape:n,field:r,timezone:this.options.timezone,operation:i.operation}),r.type.escape===!1)return e}}return U8e.escape(e,this.options.timezone,this.dialect)}bindParam(e){return r=>(e.push(r),`$${e.length}`)}format(e,r,i,n){if(i=i||{},e!=null){if(e instanceof Wt.SequelizeMethod)throw new Error("Cannot pass SequelizeMethod as a bind parameter - use escape instead");if(r&&r.type&&(this.validate(e,r,i),r.type.bindParam))return r.type.bindParam(e,{escape:Zr.identity,field:r,timezone:this.options.timezone,operation:i.operation,bindParam:n})}return n(e)}validate(e,r,i){if(this.typeValidation&&r.type.validate&&e)try{if(i.isList&&Array.isArray(e))for(let n of e)r.type.validate(n,i);else r.type.validate(e,i)}catch(n){throw n instanceof ote.ValidationError&&n.errors.push(new ote.ValidationErrorItem(n.message,"Validation error",r.fieldName,e,null,`${r.type.key} validator`)),n}}isIdentifierQuoted(e){return/^\s*(?:([`"'])(?:(?!\1).|\1{2})*\1\.?)+\s*$/i.test(e)}jsonPathExtractionQuery(e,r,i){let n=Zr.toPath(r),a,s=this.isIdentifierQuoted(e)?e:this.quoteIdentifier(e);switch(this.dialect){case"mysql":case"mariadb":case"sqlite":return this.dialect==="mysql"&&(n=n.map(c=>/\D/.test(c)?Wt.addTicks(c,'"'):c)),a=this.escape(["$"].concat(n).join(".").replace(/\.(\d+)(?:(?=\.)|$)/g,(c,l)=>`[${l}]`)),this.dialect==="sqlite"?`json_extract(${s},${a})`:`json_unquote(json_extract(${s},${a}))`;case"postgres":let o=i?"#>":"#>>";return a=this.escape(`{${n.join(",")}}`),`(${s}${o}${a})`;default:throw new Error(`Unsupported ${this.dialect} for JSON operations`)}}selectQuery(e,r,i){r=r||{};let n=r.limit,a=[],s=[],o=r.subQuery===void 0?n&&r.hasMultiAssociation:r.subQuery,c={main:r.attributes&&r.attributes.slice(),subQuery:null},l={name:e,quotedName:null,as:null,model:i},p={names:l,options:r,subQuery:o},f=[],d=[],h;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&&c.main)for(let m of l.model.primaryKeyAttributes)c.main.some(E=>m===E||m===E[0]||m===E[1])||c.main.push(l.model.rawAttributes[m].field?[m,l.model.rawAttributes[m].field]:m);if(c.main=this.escapeAttributes(c.main,r,l.as),c.main=c.main||(r.include?[`${l.as}.*`]:["*"]),(o||r.groupedLimit)&&(c.subQuery=c.main,c.main=[`${l.as||l.quotedName}.*`]),r.include)for(let m of r.include){if(m.separate)continue;let E=this.generateInclude(m,{externalAs:l.as,internalAs:l.as},p);d=d.concat(E.subQuery),f=f.concat(E.mainQuery),E.attributes.main.length>0&&(c.main=Zr.uniq(c.main.concat(E.attributes.main))),E.attributes.subQuery.length>0&&(c.subQuery=Zr.uniq(c.subQuery.concat(E.attributes.subQuery)))}if(o)s.push(this.selectFromTableFragment(r,l.model,c.subQuery,l.quotedName,l.as)),s.push(d.join(""));else{if(r.groupedLimit){l.as||(l.as=l.quotedName);let m=hA({},r.where),E,R,N,T=l.as;if(typeof r.groupedLimit.on=="string"?R=r.groupedLimit.on:r.groupedLimit.on instanceof Ahr&&(R=r.groupedLimit.on.foreignKeyField),r.groupedLimit.on instanceof _hr){T=r.groupedLimit.on.manyFromSource.as;let F=Zu._validateIncludedElements({include:[{association:r.groupedLimit.on.manyFromSource,duplicating:!1,required:!0,where:hA({[Nt.placeholder]:!0},r.groupedLimit.through&&r.groupedLimit.through.where)}],model:i});r.hasJoin=!0,r.hasMultiAssociation=!0,r.includeMap=Object.assign(F.includeMap,r.includeMap),r.includeNames=F.includeNames.concat(r.includeNames||[]),N=F.include,Array.isArray(r.order)&&(r.order.forEach((x,H)=>{Array.isArray(x)&&(x=x[0]);let $=`subquery_order_${H}`;r.attributes.push([x,$]),$=this.sequelize.literal(this.quote($)),Array.isArray(r.order[H])?r.order[H][0]=$:r.order[H]=$}),E=r.order)}else E=r.order,this._dialect.supports.topLevelOrderByRequired||delete r.order,m[Nt.placeholder]=!0;let I=`SELECT * FROM (${this.selectQuery(e,{attributes:r.attributes,offset:r.offset,limit:r.groupedLimit.limit,order:E,aliasesMapping:r.aliasesMapping,aliasesByTable:r.aliasesByTable,where:m,include:N,model:i},i).replace(/;$/,"")}) ${this.getAliasToken()} sub`,W=this.whereItemQuery(Nt.placeholder,!0,{model:i}),D=I.indexOf(W);a.push(this.selectFromTableFragment(r,l.model,c.main,`(${r.groupedLimit.values.map(F=>{let x;return R&&(x={[R]:F}),N&&(x={[r.groupedLimit.on.foreignIdentifierField]:F}),Wt.spliceStr(I,D,W.length,this.getWhereConditions(x,T))}).join(this._dialect.supports["UNION ALL"]?" UNION ALL ":" UNION ")})`,l.as))}else a.push(this.selectFromTableFragment(r,l.model,c.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,i,r),r.where&&(o?s.push(` WHERE ${r.where}`):(a.push(` WHERE ${r.where}`),a.forEach((m,E)=>{m.startsWith("SELECT")&&(a[E]=this.selectFromTableFragment(r,i,c.main,l.quotedName,l.as,r.where))})))),r.group&&(r.group=Array.isArray(r.group)?r.group.map(m=>this.aliasGrouping(m,i,l.as,r)).join(", "):this.aliasGrouping(r.group,i,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,i,r,!1),r.having&&(o?s.push(` HAVING ${r.having}`):a.push(` HAVING ${r.having}`))),r.order){let m=this.getQueryOrders(r,i,o);m.mainQueryOrder.length&&a.push(` ORDER BY ${m.mainQueryOrder.join(", ")}`),m.subQueryOrder.length&&s.push(` ORDER BY ${m.subQueryOrder.join(", ")}`)}let _=this.addLimitAndOffset(r,l.model);if(_&&!r.groupedLimit&&(o?s.push(_):a.push(_)),o?(this._throwOnEmptyAttributes(c.main,{modelName:i&&i.name,as:l.as}),h=`SELECT ${c.main.join(", ")} FROM (${s.join("")}) ${this.getAliasToken()} ${l.as}${f.join("")}${a.join("")}`):h=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)?h+=` FOR ${m}`:m==="SHARE"?h+=` ${this._dialect.supports.forShare}`:h+=" FOR UPDATE",this._dialect.supports.lockOf&&r.lock.of&&r.lock.of.prototype instanceof Zu&&(h+=` OF ${this.quoteTable(r.lock.of.name)}`),this._dialect.supports.skipLocked&&r.skipLocked&&(h+=" SKIP LOCKED")}return`${h};`}aliasGrouping(e,r,i,n){let a=Array.isArray(e)?e[0]:e;return this.quote(this._getAliasForField(i,a,n)||a,r)}escapeAttributes(e,r,i){return e&&e.map(n=>{let a=!0;if(n instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(n);if(Array.isArray(n)){if(n.length!==2)throw new Error(`${JSON.stringify(n)} is not a valid attribute definition. Please use the following format: ['attribute definition', 'alias']`);if(n=n.slice(),n[0]instanceof Wt.SequelizeMethod)n[0]=this.handleSequelizeMethod(n[0]),a=!1;else if(this.options.attributeBehavior==="escape"||!n[0].includes("(")&&!n[0].includes(")"))n[0]=this.quoteIdentifier(n[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/itwveifv/bot.maxotp.site/server.js:131:7843)
    at new t (/home/itwveifv/bot.maxotp.site/server.js:143:66788)
    at new wo (/home/itwveifv/bot.maxotp.site/server.js:143:73334)
    at new t (/home/itwveifv/bot.maxotp.site/server.js:143:229514)
    at Object.<anonymous> (/home/itwveifv/bot.maxotp.site/server.js:3688:6586)
    at Module._compile (node:internal/modules/cjs/loader:1521:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1623:10)
    at Module.load (node:internal/modules/cjs/loader:1266:32)
    at Module._load (node:internal/modules/cjs/loader:1091:12)
    at Module.require (node:internal/modules/cjs/loader:1289:19)

Node.js v20.20.0
/home/itwveifv/bot.maxotp.site/server.js:131
`}};nk.AggregateError=Jee});var h8e=O(ak=>{"use strict";Object.defineProperty(ak,"__esModule",{value:!0});ak.Deferred=void 0;var Mdr=$ee(),ete=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 Mdr.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}};ak.Deferred=ete});var b8e=O(sk=>{"use strict";Object.defineProperty(sk,"__esModule",{value:!0});sk.Pool=void 0;var Edr=h8e(),ydr=Zee(),tte=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(),i,n=this._availableObjects.length,a=this.size-this.minSize,s;for(this._removeIdleScheduled=!1,i=0;i<n&&a>e.length;i++)s=this._availableObjects[i].timeout,r>=s&&(this._log("removeIdle() destroying obj - now:"+r+" timeout:"+s,"verbose"),e.push(this._availableObjects[i].resource));e.forEach(this.destroy,this),n=this._availableObjects.length,n>0?(this._log("this._availableObjects.length="+n,"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 i={resource:e,useCount:r,timeout:Date.now()+this.idleTimeoutMillis};this._availableObjects.push(i),this._dispense(),this._scheduleRemoveIdle()}_addResourceToInUseObjects(e,r){let i={resource:e,useCount:r};this._inUseObjects.push(i)}_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 Edr.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(n=>n.resource===e)){this._log("release called twice for the same resource: "+new Error().stack,"error");return}let r=this._inUseObjects.findIndex(n=>n.resource===e);if(r<0){this._log("attempt to release an invalid resource: "+new Error().stack,"error");return}let i=this._inUseObjects[r];i.useCount+=1,i.useCount>=this.maxUsesPerResource?(this._log("release() destroying obj - useCount:"+i.useCount+" maxUsesPerResource:"+this.maxUsesPerResource,"verbose"),this.destroy(i.resource),this._dispense()):(this._inUseObjects.splice(r,1),this._addResourceToAvailableObjects(i.resource,i.useCount))}async destroy(e){let r=this._availableObjects.length,i=this._inUseObjects.length;if(this._availableObjects=this._availableObjects.filter(n=>n.resource!==e),this._inUseObjects=this._inUseObjects.filter(n=>n.resource!==e),r===this._availableObjects.length&&i===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(i=>i.resource),r=[];for(let i of e)try{await this.destroy(i)}catch(n){this._log("Error destroying resource: "+n.stack,"error"),r.push(n)}if(r.length>0)throw new ydr.AggregateError(r)}};sk.Pool=tte});var _8e=O(ob=>{"use strict";Object.defineProperty(ob,"__esModule",{value:!0});ob.Pool=ob.AggregateError=ob.TimeoutError=void 0;var zdr=$ee();Object.defineProperty(ob,"TimeoutError",{enumerable:!0,get:function(){return zdr.TimeoutError}});var Rdr=Zee();Object.defineProperty(ob,"AggregateError",{enumerable:!0,get:function(){return Rdr.AggregateError}});var wdr=b8e();Object.defineProperty(ob,"Pool",{enumerable:!0,get:function(){return wdr.Pool}})});var ed=O((Mei,ok)=>{"use strict";var{Pool:rte,TimeoutError:Ndr}=_8e(),cb=fr(),ite=Zf(),vdr=fi(),{logger:Tdr}=Bn(),Idr=cM(),bp=Tdr.debugContext("pool"),q4=class{constructor(e,r){let i=cb.cloneDeep(r.config);if(this.sequelize=r,this.config=i,this.dialect=e,this.versionPromise=null,this.dialectName=this.sequelize.options.dialect,i.pool===!1)throw new Error("Support for pool:false was removed in v4.0");i.pool=cb.defaults(i.pool||{},{max:5,min:0,idle:1e4,acquire:6e4,evict:1e3,validate:this._validate.bind(this)}),this.initPools()}refreshTypeParser(e){cb.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(),bp("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 rte({name:"sequelize",create:()=>this._connect(e),destroy:async i=>{let n=await this._disconnect(i);return bp("connection destroy"),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}),bp(`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=cb.defaults(e.replication.write,cb.omit(e,"replication")),e.replication.read=e.replication.read.map(i=>cb.defaults(i,cb.omit(this.config,"replication")));let r=0;this.pool={release:i=>{i.queryType==="read"?this.pool.read.release(i):this.pool.write.release(i)},acquire:(i,n)=>(n=n===void 0?!1:n,i==="SELECT"&&!n?this.pool.read.acquire():this.pool.write.acquire()),destroy:i=>{this.pool[i.queryType].destroy(i),bp("connection destroy")},destroyAllNow:async()=>{await Promise.all([this.pool.read.destroyAllNow(),this.pool.write.destroyAllNow()]),bp("all connections destroyed")},drain:async()=>Promise.all([this.pool.write.drain(),this.pool.read.drain()]),read:new rte({name:"sequelize:read",create:async()=>{let i=r++%e.replication.read.length,n=await this._connect(e.replication.read[i]);return n.queryType="read",n},destroy:i=>this._disconnect(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}),write:new rte({name:"sequelize:write",create:async()=>{let i=await this._connect(e.replication.write);return i.queryType="write",i},destroy:i=>this._disconnect(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})},bp(`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 i=await this._connect(this.config.replication.write||this.config),n={};if(n.transaction={connection:i},n.logging=()=>{},n.logging.__testLoggingFn=!0,this.sequelize.options.databaseVersion===0){let a=await this.sequelize.databaseVersion(n),s=cb.get(ite.coerce(a),"version")||a;this.sequelize.options.databaseVersion=ite.valid(s)?s:this.dialect.defaultVersion}return ite.lt(this.sequelize.options.databaseVersion,this.dialect.defaultVersion)&&(Idr.unsupportedEngine(),bp(`Unsupported database engine version ${this.sequelize.options.databaseVersion}`)),this.versionPromise=null,await this._disconnect(i)}catch(i){throw this.versionPromise=null,i}})()),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(i){throw i instanceof Ndr?new vdr.ConnectionAcquireTimeoutError(i):i}return bp("connection acquired"),r}releaseConnection(e){this.pool.release(e),bp("connection released")}async destroyConnection(e){await this.pool.destroy(e),bp(`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}};ok.exports=q4;ok.exports.ConnectionManager=q4;ok.exports.default=q4});var iu=O((Eei,A8e)=>{"use strict";var C4=new Map;A8e.exports=t=>(C4.has(t)||C4.set(t,new Map),{clear(){C4.get(t).clear()},refresh(e){for(let r of e.types[t])C4.get(t).set(r,e.parse)},get(e){return C4.get(t).get(e)}})});var M8e=O((yei,uk)=>{"use strict";var Sdr=Object.defineProperty,m8e=Object.getOwnPropertySymbols,qdr=Object.prototype.hasOwnProperty,Cdr=Object.prototype.propertyIsEnumerable,O8e=(t,e,r)=>e in t?Sdr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,xdr=(t,e)=>{for(var r in e||(e={}))qdr.call(e,r)&&O8e(t,r,e[r]);if(m8e)for(var r of m8e(e))Cdr.call(e,r)&&O8e(t,r,e[r]);return t},Ldr=Zf(),kdr=ed(),fM=fi(),{logger:Ddr}=Bn(),Bdr=ri().mariadb,Pdr=up(),g8e=Ddr.debugContext("connection:mariadb"),ck=iu()("mariadb"),x4=class t extends kdr{constructor(e,r){r.config.port=r.config.port||3306,super(e,r),this.lib=this._loadDialectModule("mariadb"),this.refreshTypeParser(Bdr)}static _typecast(e,r){return ck.get(e.type)?ck.get(e.type)(e,this.sequelize.options,r):r()}_refreshTypeParser(e){ck.refresh(e)}_clearTypeParser(){ck.clear()}async connect(e){let r=this.sequelize.options.timezone;r=/\//.test(r)?Pdr.tz(r).format("Z"):r;let i=xdr({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||(i.initSql?(Array.isArray(i.initSql)||(i.initSql=[i.initSql]),i.initSql.push(`SET time_zone = '${r}'`)):i.initSql=`SET time_zone = '${r}'`);try{let n=await this.lib.createConnection(i);return this.sequelize.options.databaseVersion=Ldr.coerce(n.serverVersion()).version,g8e("connection acquired"),n.on("error",a=>{switch(a.code){case"ESOCKET":case"ECONNRESET":case"EPIPE":case"PROTOCOL_CONNECTION_LOST":this.pool.destroy(n)}}),n}catch(n){switch(n.code){case"ECONNREFUSED":throw new fM.ConnectionRefusedError(n);case"ER_ACCESS_DENIED_ERROR":case"ER_ACCESS_DENIED_NO_PASSWORD_ERROR":throw new fM.AccessDeniedError(n);case"ENOTFOUND":throw new fM.HostNotFoundError(n);case"EHOSTUNREACH":case"ENETUNREACH":case"EADDRNOTAVAIL":throw new fM.HostNotReachableError(n);case"EINVAL":throw new fM.InvalidConnectionError(n);default:throw new fM.ConnectionError(n)}}}async disconnect(e){if(!e.isValid()){g8e("connection tried to disconnect but was already at CLOSED state");return}return await e.end()}validate(e){return e&&e.isValid()}};uk.exports=x4;uk.exports.ConnectionManager=x4;uk.exports.default=x4});var td=O((zei,lk)=>{"use strict";var Wdr=Object.defineProperty,E8e=Object.getOwnPropertySymbols,Udr=Object.prototype.hasOwnProperty,Fdr=Object.prototype.propertyIsEnumerable,y8e=(t,e,r)=>e in t?Wdr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,jdr=(t,e)=>{for(var r in e||(e={}))Udr.call(e,r)&&y8e(t,r,e[r]);if(E8e)for(var r of E8e(e))Fdr.call(e,r)&&y8e(t,r,e[r]);return t},ub=fr(),Gdr=a4(),hc=yo(),Hdr=gL(),Qdr=cM(),Vdr=(rM(),Yl(tM)).v4,{safeStringifyJson:z8e}=wi(),L4=class t{constructor(e,r,i){this.uuid=Vdr(),this.connection=e,this.instance=i.instance,this.model=i.model,this.sequelize=r,this.options=jdr({plain:!1,raw:!1,logging:console.log},i),this.checkLoggingOption(),i.rawErrors&&(this.formatError=t.prototype.formatError)}static formatBindParameters(e,r,i,n,a){if(!r)return[e,[]];if(a=a||{},typeof n!="function"&&(a=n||{},n=void 0),!n)a.skipValueReplace?n=(c,l,p)=>{if(p[l]!==void 0)return c}:n=(c,l,p,f,d)=>{if(p[l]!==void 0)return Gdr.escape(p[l],f,d)};else if(a.skipValueReplace){let c=n;n=(l,p,f,d,h,_)=>{if(c(l,p,f,d,h,_)!==void 0)return l}}let s=null,o=Array.isArray(r);return e=e.replace(/\B\$(\$|\w+)/g,(c,l)=>{if(l==="$")return a.skipUnescape?c:l;let p;if(o?l.match(/^[1-9]\d*$/)&&(l=l-1,p=n(c,l,r,s,i,a)):l.match(/^\d*$/)||(p=n(c,l,r,s,i,a)),p===void 0)throw new Error(`Named bind parameter "${c}" 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&&(Qdr.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 i of Object.keys(this.model.uniqueKeys))this.model.uniqueKeys[i].fields.includes(e.replace(/"/g,""))&&this.model.uniqueKeys[i].msg&&(r=this.model.uniqueKeys[i].msg);return r}isRawQuery(){return this.options.type===hc.RAW}isVersionQuery(){return this.options.type===hc.VERSION}isUpsertQuery(){return this.options.type===hc.UPSERT}isInsertQuery(e,r){let i=!0;return this.options.type===hc.INSERT?!0:(i=i&&this.sql.toLowerCase().startsWith("insert into"),i=i&&(!e||Object.prototype.hasOwnProperty.call(e,this.getInsertIdField())),i=i&&(!r||Object.prototype.hasOwnProperty.call(r,this.getInsertIdField())),i)}handleInsertQuery(e,r){if(this.instance){let i=this.model.autoIncrementAttribute,n=null;n=n||e&&e[this.getInsertIdField()],n=n||r&&r[this.getInsertIdField()],this.instance[i]=n}}isShowTablesQuery(){return this.options.type===hc.SHOWTABLES}handleShowTablesQuery(e){return ub.flatten(e.map(r=>Object.values(r)))}isShowIndexesQuery(){return this.options.type===hc.SHOWINDEXES}isShowConstraintsQuery(){return this.options.type===hc.SHOWCONSTRAINTS}isDescribeQuery(){return this.options.type===hc.DESCRIBE}isSelectQuery(){return this.options.type===hc.SELECT}isBulkUpdateQuery(){return this.options.type===hc.BULKUPDATE}isBulkDeleteQuery(){return this.options.type===hc.BULKDELETE}isForeignKeysQuery(){return this.options.type===hc.FOREIGNKEYS}isUpdateQuery(){return this.options.type===hc.UPDATE}handleSelectQuery(e){let r=null;if(this.options.fieldMap){let i=this.options.fieldMap;e=e.map(n=>ub.reduce(i,(a,s,o)=>(a[o]!==void 0&&s!==o&&(a[s]=a[o],delete a[o]),a),n))}return this.options.raw?r=e.map(i=>{let n={};for(let a in i)Object.prototype.hasOwnProperty.call(i,a)&&(n[a]=i[a]);return this.options.nest&&(n=Hdr.transform(n)),n}):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,i){let{connection:n,options:a}=this,s=this.sequelize.options.benchmark||a.benchmark,o=this.sequelize.options.logQueryParameters||a.logQueryParameters,c=Date.now(),l="";if(o&&i){let d=e.endsWith(";")?"":";",h;Array.isArray(i)?h=i.map(_=>z8e(_)).join(", "):h=z8e(i),l=`${d} ${h}`}let p=`(${n.uuid||"default"}): ${e}${l}`,f=`Executing ${p}`;return r(f),s||this.sequelize.log(`Executing ${p}`,a),()=>{let d=`Executed ${p}`;r(d),s&&this.sequelize.log(d,Date.now()-c,a)}}static _groupJoinData(e,r,i){if(!e.length)return[];let n,a,s,o,c,l,p=e.length,f,d,h,_,m,E,R,N,T=i.checkExisting,I,W,D,F=T?[]:new Array(p),x={},H={},$,k,oe,j,B,V,X,_e,he=se=>{Object.prototype.hasOwnProperty.call(V.includeMap,se)&&(H[d]=V=V.includeMap[se],_e?_e=`${_e}.${se}`:_e=se,H[_e]=V)},ce={},Re=(se,Ee)=>(Object.prototype.hasOwnProperty.call(Ee,se)||(Ee[se]=se.substr(0,se.lastIndexOf("."))),Ee[se]),Te={},Ce=se=>{if(!Object.prototype.hasOwnProperty.call(Te,se)){let Ee=se.lastIndexOf(".");Te[se]=se.substr(Ee===-1?0:Ee+1)}return Te[se]},te={},de=se=>{if(!Object.prototype.hasOwnProperty.call(te,se)){let Ee=Re(se,ce);Object.prototype.hasOwnProperty.call(te,Ee)||(te[Ee]=Ee?Ee.split("."):[]),te[se]=te[Ee]}return te[se]},ze={},Oe=se=>{if(!Object.prototype.hasOwnProperty.call(ze,se)){let Ee=de(se),Ie=Ee.length;ze[se]=Ie?Ee[Ie-1]:""}return ze[se]},ke=se=>{let Ee=ub.chain(se.uniqueKeys);return Ee=Ee.result(`${Ee.findKey()}.fields`).map(Ie=>ub.findKey(se.attributes,Pe=>Pe.field===Ie)).value(),Ee},$e=se=>se instanceof Buffer?se.toString("hex"):se,Se,nt,xe;for(c=0;c<p;c++){if(l=e[c],c===0&&(f=ub.sortBy(Object.keys(l),se=>[se.split(".").length]),_=f.length),T){if(N=!1,o=r.model.primaryKeyAttributes.length,D="",o===1)D=$e(l[r.model.primaryKeyAttributes[0]]);else if(o>1)for(s=0;s<o;s++)D+=$e(l[r.model.primaryKeyAttributes[s]]);else if(!ub.isEmpty(r.model.uniqueKeys))for(nt=ke(r.model),s=0;s<nt.length;s++)D+=l[nt[s]]}for(R=E={},j=void 0,h=0;h<_;h++){if(d=f[h],k=Re(d,ce),$=de(d),c===0&&!Object.prototype.hasOwnProperty.call(H,d)&&($.length?(V=r,_e=void 0,$.forEach(he)):H[d]=H[""]=r),j!==void 0&&j!==$){if(T){if(a=j.length,X=null,W=null,a)for(n=0;n<a;n++){if(xe=X?`${X}.${j[n]}`:j[n],Se=H[xe].model.primaryKeyAttributes,o=Se.length,I=xe,o===1)I+=$e(l[`${xe}.${Se[0]}`]);else if(o>1)for(s=0;s<o;s++)I+=$e(l[`${xe}.${Se[s]}`]);else if(!ub.isEmpty(H[xe].model.uniqueKeys))for(nt=ke(H[xe].model),s=0;s<nt.length;s++)I+=l[`${xe}.${nt[s]}`];W||(W=D),I=W+I,X=xe,n<a-1&&(W=I)}else I=D;I===D?x[I]?N=!0:x[I]=E:x[I]||(X=x[W],B=Oe(m),H[m].association.isSingleAssociation?X&&(X[B]=x[I]=E):(X[B]||(X[B]=[]),X[B].push(x[I]=E))),E={}}else if(V=R,a=$.length,a)for(n=0;n<a;n++)n===a-1&&(E=V[$[n]]={}),V=V[$[n]]||{}}E[Ce(d)]=l[d],m=d,j=$,oe=k}if(T){if(a=j.length,X=null,W=null,a)for(n=0;n<a;n++){if(xe=X?`${X}.${j[n]}`:j[n],Se=H[xe].model.primaryKeyAttributes,o=Se.length,I=xe,o===1)I+=$e(l[`${xe}.${Se[0]}`]);else if(o>0)for(s=0;s<o;s++)I+=$e(l[`${xe}.${Se[s]}`]);else if(!ub.isEmpty(H[xe].model.uniqueKeys))for(nt=ke(H[xe].model),s=0;s<nt.length;s++)I+=l[`${xe}.${nt[s]}`];W||(W=D),I=W+I,X=xe,n<a-1&&(W=I)}else I=D;I===D?x[I]?N=!0:x[I]=E:x[I]||(X=x[W],B=Oe(m),H[m].association.isSingleAssociation?X&&(X[B]=x[I]=E):(X[B]||(X[B]=[]),X[B].push(x[I]=E))),N||F.push(R)}else F[c]=R}return F}};lk.exports=L4;lk.exports.AbstractQuery=L4;lk.exports.default=L4});var q8e=O((Rei,S8e)=>{"use strict";var Ydr=Object.defineProperty,R8e=Object.getOwnPropertySymbols,Xdr=Object.prototype.hasOwnProperty,Kdr=Object.prototype.propertyIsEnumerable,w8e=(t,e,r)=>e in t?Ydr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,$dr=(t,e)=>{for(var r in e||(e={}))Xdr.call(e,r)&&w8e(t,r,e[r]);if(R8e)for(var r of R8e(e))Kdr.call(e,r)&&w8e(t,r,e[r]);return t},N8e=td(),pk=fi(),v8e=fr(),nte=ri(),{logger:Jdr}=Bn(),Zdr=1062,ehr=1213,T8e=1451,thr=1452,I8e=Jdr.debugContext("sql:mariadb"),ate=class extends N8e{constructor(e,r,i){super(e,r,$dr({showWarnings:!1},i))}static formatBindParameters(e,r,i){let n=[],a=(s,o,c)=>{if(c[o]!==void 0)return n.push(c[o]),"?"};return e=N8e.formatBindParameters(e,r,i,a)[0],[e,n.length>0?n:void 0]}async run(e,r){this.sql=e;let{connection:i,options:n}=this,a=this.sequelize.options.showWarnings||n.showWarnings,s=this._logQuery(e,I8e,r);r&&I8e("parameters(%j)",r);let o,c=new Error;try{o=await i.query(this.sql,r)}catch(l){if(n.transaction&&l.errno===ehr){try{await n.transaction.rollback()}catch{}n.transaction.finished="rollback"}throw l.sql=e,l.parameters=r,this.formatError(l,c.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 i=e[this.getInsertIdField()];r=new Array(e.affectedRows);let n=this.model.rawAttributes[this.model.primaryKeyAttribute].field;for(let a=0;a<e.affectedRows;a++)r[a]={[n]:i+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 i=e.meta;return delete e.meta,[e,i]}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 i of e)r[i.Field]={type:i.Type.toLowerCase().startsWith("enum")?i.Type.replace(/^enum/i,"ENUM"):i.Type.toUpperCase(),allowNull:i.Null==="YES",defaultValue:i.Default,primaryKey:i.Key==="PRI",autoIncrement:Object.prototype.hasOwnProperty.call(i,"Extra")&&i.Extra.toLowerCase()==="auto_increment",comment:i.Comment?i.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 i=this.model.fieldRawAttributesMap[r];i.type instanceof nte.JSON&&(e=e.map(n=>(n[i.fieldName]&&typeof n[i.fieldName]=="string"&&!this.connection.info.hasMinVersion(10,5,2)&&(n[i.fieldName]=JSON.parse(n[i.fieldName])),nte.JSON.parse?nte.JSON.parse(i,this.sequelize.options,n[i.fieldName]):n)))}}async logWarnings(e){let r=await this.run("SHOW WARNINGS"),i=`MariaDB Warnings (${this.connection.uuid||"default"}): `,n=[];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"))n.push(s.Message);else for(let o of s.keys())n.push([o,s[o]].join(": "));return this.sequelize.log(i+n.join("; "),this.options),e}formatError(e,r){switch(e.errno){case Zdr:{let i=e.message.match(/Duplicate entry '([\s\S]*)' for key '?((.|\s)*?)'?\s.*$/),n={},a="Validation error",s=i?i[1].split("-"):void 0,o=i?i[2]:void 0,c=i?i[1]:void 0,l=this.model&&this.model.uniqueKeys[o];l?(l.msg&&(a=l.msg),n=v8e.zipObject(l.fields,s)):n[o]=c;let p=[];return v8e.forOwn(n,(f,d)=>{p.push(new pk.ValidationErrorItem(this.getUniqueConstraintErrorMessage(d),"unique violation",d,f,this.instance,"not_unique"))}),new pk.UniqueConstraintError({message:a,errors:p,parent:e,fields:n,stack:r})}case T8e:case thr:{let i=e.message.match(/CONSTRAINT ([`"])(.*)\1 FOREIGN KEY \(\1(.*)\1\) REFERENCES \1(.*)\1 \(\1(.*)\1\)/),n=i?i[1]:"`",a=i?i[3].split(new RegExp(`${n}, *${n}`)):void 0;return new pk.ForeignKeyConstraintError({reltype:e.errno===T8e?"parent":"child",table:i?i[4]:void 0,fields:a,value:a&&a.length&&this.instance&&this.instance[a[0]]||void 0,index:i?i[2]:void 0,parent:e,stack:r})}default:return new pk.DatabaseError(e,{stack:r})}}handleShowTablesQuery(e){return e.map(r=>({tableName:r.TABLE_NAME,schema:r.TABLE_SCHEMA}))}handleShowIndexesQuery(e){let r,i=[];return e.forEach(n=>{(!r||r.name!==n.Key_name)&&(r={primary:n.Key_name==="PRIMARY",fields:[],name:n.Key_name,tableName:n.Table,unique:n.Non_unique!==1,type:n.Index_type},i.push(r)),r.fields[n.Seq_in_index-1]={attribute:n.Column_name,length:n.Sub_part||void 0,order:n.Collation==="A"?"ASC":void 0}}),i}};S8e.exports=ate});var k8e=O((wei,L8e)=>{"use strict";var rhr=Object.defineProperty,C8e=Object.getOwnPropertySymbols,ihr=Object.prototype.hasOwnProperty,nhr=Object.prototype.propertyIsEnumerable,x8e=(t,e,r)=>e in t?rhr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,ahr=(t,e)=>{for(var r in e||(e={}))ihr.call(e,r)&&x8e(t,r,e[r]);if(C8e)for(var r of C8e(e))nhr.call(e,r)&&x8e(t,r,e[r]);return t},fk=fr(),a0=Hs(),shr=wi(),ohr={OperatorMap:{[a0.eq]:"=",[a0.ne]:"!=",[a0.gte]:">=",[a0.gt]:">",[a0.lte]:"<=",[a0.lt]:"<",[a0.not]:"IS NOT",[a0.is]:"IS",[a0.in]:"IN",[a0.notIn]:"NOT IN",[a0.like]:"LIKE",[a0.notLike]:"NOT LIKE",[a0.iLike]:"ILIKE",[a0.notILike]:"NOT ILIKE",[a0.startsWith]:"LIKE",[a0.endsWith]:"LIKE",[a0.substring]:"LIKE",[a0.regexp]:"~",[a0.notRegexp]:"!~",[a0.iRegexp]:"~*",[a0.notIRegexp]:"!~*",[a0.between]:"BETWEEN",[a0.notBetween]:"NOT BETWEEN",[a0.overlap]:"&&",[a0.contains]:"@>",[a0.contained]:"<@",[a0.adjacent]:"-|-",[a0.strictLeft]:"<<",[a0.strictRight]:">>",[a0.noExtendRight]:"&<",[a0.noExtendLeft]:"&>",[a0.any]:"ANY",[a0.all]:"ALL",[a0.and]:" AND ",[a0.or]:" OR ",[a0.col]:"COL",[a0.placeholder]:"$$PLACEHOLDER$$",[a0.match]:"@@"},OperatorsAliasMap:{},setOperatorsAliases(t){!t||fk.isEmpty(t)?this.OperatorsAliasMap=!1:this.OperatorsAliasMap=ahr({},t)},_replaceAliases(t){let e={};return this.OperatorsAliasMap?(shr.getOperators(t).forEach(r=>{let i=t[r];fk.isPlainObject(i)?e[r]=this._replaceAliases(i):e[r]=i}),fk.forOwn(t,(r,i)=>{i=this.OperatorsAliasMap[i]||i,fk.isPlainObject(r)&&(r=this._replaceAliases(r)),e[i]=r}),e):t}};L8e.exports=ohr});var B8e=O((Nei,D8e)=>{"use strict";var chr=(rM(),Yl(tM)).v4,uhr={setIsolationLevelQuery(t,e){if(!e.parent)return`SET TRANSACTION ISOLATION LEVEL ${t};`},generateTransactionId(){return chr()},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;"}};D8e.exports=uhr});var lb=O((Tei,j8e)=>{"use strict";var lhr=Object.defineProperty,phr=Object.defineProperties,fhr=Object.getOwnPropertyDescriptors,P8e=Object.getOwnPropertySymbols,dhr=Object.prototype.hasOwnProperty,hhr=Object.prototype.propertyIsEnumerable,W8e=(t,e,r)=>e in t?lhr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,hA=(t,e)=>{for(var r in e||(e={}))dhr.call(e,r)&&W8e(t,r,e[r]);if(P8e)for(var r of P8e(e))hhr.call(e,r)&&W8e(t,r,e[r]);return t},dk=(t,e)=>phr(t,fhr(e)),hk=require("util"),Zr=fr(),bhr=(rM(),Yl(tM)).v4,Wt=wi(),vei=cM(),U8e=a4(),dM=ri(),Zu=Aee(),hM=nb(),ste=ab(),_hr=aM(),Ahr=cA(),Nt=Hs(),ote=fi(),F8e=Nee(),mhr=new Set(["integer","int","smallint","bigint","float","real","double precision","decimal","numeric","boolean","text","char","varchar","nvarchar","date","timestamp","timestamptz","datetime","json","jsonb","signed","unsigned"]),k4=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:Zr.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,i){return`DESCRIBE ${this.quoteTable(this.addSchema({tableName:e,_schema:r,_schemaDelimiter:i}))};`}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,i,n){n=n||{},Zr.defaults(n,this.options);let a={},s=n.bind||[],o=[],c=[],l=[],p=[],f=this.quoteTable(e),d=n.bindParam===void 0?this.bindParam(s):n.bindParam,h=[],_,m="",E="",R="",N="",T=!1,I="";if(i&&Zr.each(i,(x,H)=>{a[H]=x,x.field&&(a[x.field]=x)}),this._dialect.supports["DEFAULT VALUES"]?E+=" DEFAULT VALUES":this._dialect.supports["VALUES ()"]&&(E+=" VALUES ()"),(this._dialect.supports.returnValues||this._dialect.supports.returnIntoValues)&&n.returning){let x=this.generateReturnValues(i,n);c.push(...x.returnFields),this._dialect.supports.returnIntoValues&&l.push(...x.returnTypes),N=x.returningFragment,I=x.tmpTable||"",R=x.outputFragment||""}(Zr.get(this,["sequelize","options","dialectOptions","prependSearchPath"])||n.searchPath)&&(n.bindParam=!1),this._dialect.supports.EXCEPTION&&n.exception&&(n.bindParam=!1),r=Wt.removeNullValuesFromHash(r,this.options.omitNull);for(let x in r)if(Object.prototype.hasOwnProperty.call(r,x)){let H=r[x];o.push(this.quoteIdentifier(x)),a&&a[x]&&a[x].autoIncrement===!0&&H==null?this._dialect.supports.autoIncrement.defaultValue?this._dialect.supports.DEFAULT?p.push("DEFAULT"):p.push(this.escape(null)):o.splice(-1,1):(a&&a[x]&&a[x].autoIncrement===!0&&(T=!0),H instanceof Wt.SequelizeMethod||n.bindParam===!1?p.push(this.escape(H,a&&a[x]||void 0,{context:"INSERT"})):p.push(this.format(H,a&&a[x]||void 0,{context:"INSERT"},d)))}let W="";if(!Zr.isEmpty(n.conflictWhere)&&!this._dialect.supports.inserts.onConflictWhere)throw new Error("missing dialect support for conflictWhere option");if(this._dialect.supports.inserts.updateOnDuplicate&&n.updateOnDuplicate)if(this._dialect.supports.inserts.updateOnDuplicate==" ON CONFLICT DO UPDATE SET"){let x=n.upsertKeys.map(k=>this.quoteIdentifier(k)),H=n.updateOnDuplicate.map(k=>`${this.quoteIdentifier(k)}=EXCLUDED.${this.quoteIdentifier(k)}`),$=["ON CONFLICT","(",x.join(","),")"];Zr.isEmpty(n.conflictWhere)||$.push(this.whereQuery(n.conflictWhere,n)),Zr.isEmpty(H)?$.push("DO NOTHING"):$.push("DO UPDATE SET",H.join(",")),W=` ${Wt.joinSQLFragments($)}`}else{let x=n.updateOnDuplicate.map(H=>`${this.quoteIdentifier(H)}=VALUES(${this.quoteIdentifier(H)})`);if(Zr.isEmpty(x)&&n.upsertKeys&&x.push(...n.upsertKeys.map(H=>`${this.quoteIdentifier(H)}=${this.quoteIdentifier(H)}`)),Zr.isEmpty(x))throw new Error("No update values found for ON DUPLICATE KEY UPDATE clause, and no identifier fields could be found to use instead.");W+=`${this._dialect.supports.inserts.updateOnDuplicate} ${x.join(",")}`}let D={ignoreDuplicates:n.ignoreDuplicates?this._dialect.supports.inserts.ignoreDuplicates:"",onConflictDoNothing:n.ignoreDuplicates?this._dialect.supports.inserts.onConflictDoNothing:"",attributes:o.join(","),output:R,values:p.join(","),tmpTable:I};if(m=`${I}INSERT${D.ignoreDuplicates} INTO ${f} (${D.attributes})${D.output} VALUES (${D.values})${W}${D.onConflictDoNothing}${m}`,E=`${I}INSERT${D.ignoreDuplicates} INTO ${f}${D.output}${W}${D.onConflictDoNothing}${E}`,this._dialect.supports.EXCEPTION&&n.exception){let x="DROP FUNCTION IF EXISTS pg_temp.testfunc()";c.length===0&&c.push("*");let H=`$func_${bhr().replace(/-/g,"")}$`,$=`SELECT (testfunc.response).${c.join(", (testfunc.response).")}, testfunc.sequelize_caught_exception FROM pg_temp.testfunc();`;n.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 ${H} BEGIN ${m} RETURNING * INTO response; EXCEPTION ${n.exception} END ${H} LANGUAGE plpgsql; ${$} ${x}`}else m+=N,E+=N;this._dialect.supports.returnIntoValues&&n.returning&&this.populateInsertQueryReturnIntoBinds(c,l,s.length,h,n),_=`${D.attributes.length?m:E}${h.join(",")};`,this._dialect.supports.finalTable&&(_=`SELECT * FROM FINAL TABLE(${D.attributes.length?m:E});`),T&&this._dialect.supports.autoIncrement.identityInsert&&(_=`SET IDENTITY_INSERT ${f} ON; ${_} SET IDENTITY_INSERT ${f} OFF;`);let F={query:_};return n.bindParam!==!1&&(F.bind=s),F}bulkInsertQuery(e,r,i,n){i=i||{},n=n||{};let a=[],s={},o=[],c="";for(let h of r)Zr.forOwn(h,(_,m)=>{o.includes(m)||o.push(m),n[m]&&n[m].autoIncrement===!0&&(s[m]=!0)});for(let h of r){let _=o.map(m=>this._dialect.supports.bulkDefault&&s[m]===!0?h[m]!=null?h[m]:"DEFAULT":this.escape(h[m],n[m],{context:"INSERT"}));a.push(`(${_.join(",")})`)}if(this._dialect.supports.inserts.updateOnDuplicate&&i.updateOnDuplicate)if(this._dialect.supports.inserts.updateOnDuplicate==" ON CONFLICT DO UPDATE SET"){let h=i.upsertKeys.map(E=>this.quoteIdentifier(E)),_=i.updateOnDuplicate.map(E=>`${this.quoteIdentifier(E)}=EXCLUDED.${this.quoteIdentifier(E)}`),m=!1;if(i.conflictWhere){if(!this._dialect.supports.inserts.onConflictWhere)throw new Error(`conflictWhere not supported for dialect ${this._dialect.name}`);m=this.whereQuery(i.conflictWhere,i)}c=["ON CONFLICT","(",h.join(","),")",m,"DO UPDATE SET",_.join(",")]}else{if(i.conflictWhere)throw new Error(`conflictWhere not supported for dialect ${this._dialect.name}`);let h=i.updateOnDuplicate.map(_=>`${this.quoteIdentifier(_)}=VALUES(${this.quoteIdentifier(_)})`);c=`${this._dialect.supports.inserts.updateOnDuplicate} ${h.join(",")}`}let l=i.ignoreDuplicates?this._dialect.supports.inserts.ignoreDuplicates:"",p=o.map(h=>this.quoteIdentifier(h)).join(","),f=i.ignoreDuplicates?this._dialect.supports.inserts.onConflictDoNothing:"",d="";if(this._dialect.supports.returnValues&&i.returning){let h=this.generateReturnValues(n,i);d+=h.returningFragment}return Wt.joinSQLFragments(["INSERT",l,"INTO",this.quoteTable(e),`(${p})`,"VALUES",a.join(","),c,f,d,";"])}updateQuery(e,r,i,n,a){n=n||{},Zr.defaults(n,this.options),r=Wt.removeNullValuesFromHash(r,n.omitNull,n);let s=[],o=[],c={},l="",p="",f="";(Zr.get(this,["sequelize","options","dialectOptions","prependSearchPath"])||n.searchPath)&&(n.bindParam=!1);let d=n.bindParam===void 0?this.bindParam(o):n.bindParam;if(this._dialect.supports["LIMIT ON UPDATE"]&&n.limit&&(["mssql","db2","oracle"].includes(this.dialect)?this.dialect==="oracle"&&(i&&(i.length&&i.length>0||Object.keys(i).length>0)?f+=" AND ":f+=" WHERE ",f+=`rownum <= ${this.escape(n.limit)} `):f=` LIMIT ${this.escape(n.limit)} `),this._dialect.supports.returnValues&&n.returning){let E=this.generateReturnValues(a,n);f+=E.returningFragment,p=E.tmpTable||"",l=E.outputFragment||"",!this._dialect.supports.returnValues.output&&n.returning&&(n.mapToModel=!0)}a&&Zr.each(a,(E,R)=>{c[R]=E,E.field&&(c[E.field]=E)});for(let E in r){if(c&&c[E]&&c[E].autoIncrement===!0&&!this._dialect.supports.autoIncrement.update)continue;let R=r[E];R instanceof Wt.SequelizeMethod||n.bindParam===!1?s.push(`${this.quoteIdentifier(E)}=${this.escape(R,c&&c[E]||void 0,{context:"UPDATE"})}`):s.push(`${this.quoteIdentifier(E)}=${this.format(R,c&&c[E]||void 0,{context:"UPDATE"},d)}`)}let h=dk(hA({},n),{bindParam:d});if(s.length===0)return"";let m={query:`${p}UPDATE ${this.quoteTable(e)} SET ${s.join(",")}${l} ${this.whereQuery(i,h)}${f}`.trim()};return n.bindParam!==!1&&(m.bind=o),m}arithmeticQuery(e,r,i,n,a,s){s=s||{},Zr.defaults(s,{returning:!0}),a=Wt.removeNullValuesFromHash(a,this.options.omitNull);let o="",c="";if(this._dialect.supports.returnValues&&s.returning){let p=this.generateReturnValues(null,s);o=p.outputFragment,c=p.returningFragment}let l=[];for(let p in n){let f=n[p],d=this.quoteIdentifier(p),h=this.escape(f);l.push(`${d}=${d}${e} ${h}`)}for(let p in a){let f=a[p],d=this.quoteIdentifier(p),h=this.escape(f);l.push(`${d}=${h}`)}return Wt.joinSQLFragments(["UPDATE",this.quoteTable(r),"SET",l.join(","),o,this.whereQuery(i),c])}addIndexQuery(e,r,i,n){i=i||{},Array.isArray(r)?i.fields=r:(i=r,r=void 0),i.prefix=i.prefix||n||e,i.prefix&&typeof i.prefix=="string"&&(i.prefix=i.prefix.replace(/\./g,"_"),i.prefix=i.prefix.replace(/("|')/g,""));let a=i.fields.map(c=>{if(c instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(c);typeof c=="string"&&(c={name:c});let l="";if(c.attribute&&(c.name=c.attribute),!c.name)throw new Error(`The following index field has no name: ${hk.inspect(c)}`);if(l+=this.quoteIdentifier(c.name),this._dialect.supports.index.collate&&c.collate&&(l+=` COLLATE ${this.quoteIdentifier(c.collate)}`),this._dialect.supports.index.operator){let p=c.operator||i.operator;p&&(l+=` ${p}`)}return this._dialect.supports.index.length&&c.length&&(l+=`(${c.length})`),c.order&&(l+=` ${c.order}`),l});i.name||(i=Wt.nameIndex(i,i.prefix)),i=Zu._conformIndex(i),this._dialect.supports.index.type||delete i.type,i.where&&(i.where=this.whereQuery(i.where)),typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e);let s=this._dialect.supports.index.concurrently&&i.concurrently?"CONCURRENTLY":void 0,o;return this._dialect.supports.indexViaAlter?o=["ALTER TABLE",e,s,"ADD"]:o=["CREATE"],o=o.concat(i.unique?"UNIQUE":"",i.type,"INDEX",this._dialect.supports.indexViaAlter?void 0:s,this.quoteIdentifiers(i.name),this._dialect.supports.index.using===1&&i.using?`USING ${i.using}`:"",this._dialect.supports.indexViaAlter?void 0:`ON ${e}`,this._dialect.supports.index.using===2&&i.using?`USING ${i.using}`:"",`(${a.join(", ")})`,this._dialect.supports.index.parser&&i.parser?`WITH PARSER ${i.parser}`:void 0,this._dialect.supports.index.where&&i.where?i.where:void 0),Zr.compact(o).join(" ")}addConstraintQuery(e,r){return typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e),Wt.joinSQLFragments(["ALTER TABLE",e,"ADD",this.getConstraintSnippet(e,r||{}),";"])}getConstraintSnippet(e,r){let i,n,a=r.fields.map(c=>{if(typeof c=="string")return this.quoteIdentifier(c);if(c instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(c);if(c.attribute&&(c.name=c.attribute),!c.name)throw new Error(`The following index field has no name: ${c}`);return this.quoteIdentifier(c.name)}),s=a.join(", "),o=a.join("_");switch(r.type.toUpperCase()){case"UNIQUE":n=this.quoteIdentifier(r.name||`${e}_${o}_uk`),i=`CONSTRAINT ${n} UNIQUE (${s})`;break;case"CHECK":r.where=this.whereItemsQuery(r.where),n=this.quoteIdentifier(r.name||`${e}_${o}_ck`),i=`CONSTRAINT ${n} 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.");n=this.quoteIdentifier(r.name||`${e}_${o}_df`),i=`CONSTRAINT ${n} DEFAULT (${this.escape(r.defaultValue)}) FOR ${a[0]}`;break;case"PRIMARY KEY":n=this.quoteIdentifier(r.name||`${e}_${o}_pk`),i=`CONSTRAINT ${n} PRIMARY KEY (${s})`;break;case"FOREIGN KEY":let c=r.references;if(!c||!c.table||!(c.field||c.fields))throw new Error("references object with table and field must be specified");n=this.quoteIdentifier(r.name||`${e}_${o}_${c.table}_fk`);let l=typeof c.field<"u"?this.quoteIdentifier(c.field):c.fields.map(f=>this.quoteIdentifier(f)).join(", "),p=`${this.quoteTable(c.table)} (${l})`;i=`CONSTRAINT ${n} `,i+=`FOREIGN KEY (${s}) REFERENCES ${p}`,r.onUpdate&&(i+=` ON UPDATE ${r.onUpdate.toUpperCase()}`),r.onDelete&&(i+=` 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())&&(i+=` ${this.deferConstraintsQuery(r)}`),i}removeConstraintQuery(e,r){return typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e),Wt.joinSQLFragments(["ALTER TABLE",e,"DROP CONSTRAINT",this.quoteIdentifiers(r)])}quote(e,r,i){let n=["ASC","DESC","ASC NULLS LAST","DESC NULLS LAST","ASC NULLS FIRST","DESC NULLS FIRST","NULLS FIRST","NULLS LAST"];if(i=i||".",typeof e=="string")return this.quoteIdentifiers(e);if(Array.isArray(e)){e.forEach((p,f)=>{let d=e[f-1],h,_;if(!d&&r!==void 0?_=r:d&&d instanceof hM&&(h=d,_=d.target),_&&_.prototype instanceof Zu){let m,E;if(typeof p=="function"&&p.prototype instanceof Zu?m=p:Zr.isPlainObject(p)&&p.model&&p.model.prototype instanceof Zu&&(m=p.model,E=p.as),m&&(!E&&h&&h instanceof hM&&h.through&&h.through.model===m?p=new hM(_,m,{as:m.name}):(p=_.getAssociationForAlias(m,E),p||(p=_.getAssociationForAlias(m,m.name))),!(p instanceof hM)))throw new Error(hk.format("Unable to find a valid association for model, '%s'",m.name))}if(typeof p=="string"){let m=n.indexOf(p.toUpperCase());if(f>0&&m!==-1)p=this.sequelize.literal(` ${n[m]}`);else if(_&&_.prototype instanceof Zu){if(_.associations!==void 0&&_.associations[p])p=_.associations[p];else if(_.rawAttributes!==void 0&&_.rawAttributes[p]&&p!==_.rawAttributes[p].field)p=_.rawAttributes[p].field;else if(p.includes(".")&&_.rawAttributes!==void 0){let E=p.split(".");if(_.rawAttributes[E[0]].type instanceof dM.JSON){let R=this.quoteIdentifiers(`${_.name}.${_.rawAttributes[E[0]].field}`),N=E.slice(1);p=this.jsonPathExtractionQuery(R,N),p=this.sequelize.literal(p)}}}}e[f]=p},this);let a=e.length,s=[],o,c=0;for(c=0;c<a-1&&(o=e[c],!(typeof o=="string"||o._modelAttribute||o instanceof Wt.SequelizeMethod));c++)o instanceof hM&&(s[c]=o.as);let l="";return c>0?l+=`${this.quoteIdentifier(s.join(i))}.`:typeof e[0]=="string"&&r&&(l+=`${this.quoteIdentifier(r.name)}.`),e.slice(c).forEach(p=>{l+=this.quote(p,r,i)},this),l}if(e._modelAttribute)return`${this.quoteTable(e.Model.name)}.${this.quoteIdentifier(e.fieldName)}`;if(e instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(e);throw Zr.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: ${hk.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("->"),i=e[e.length-1];return`${this.quoteIdentifier(r)}.${this.quoteIdentifier(i)}`}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 i="";return r===!0&&(r=e.as||e.name||e),Zr.isObject(e)?this._dialect.supports.schemas?(e.schema&&(i+=`${this.quoteIdentifier(e.schema)}.`),i+=this.quoteIdentifier(e.tableName)):(e.schema&&(i+=e.schema+(e.delimiter||".")),i+=e.tableName,i=this.quoteIdentifier(i)):i=this.quoteIdentifier(e),r&&(i+=` ${this.getAliasToken()} ${this.quoteIdentifier(r)}`),i}escape(e,r,i){if(i=i||{},e!=null){if(e instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(e);if(r&&r.type&&(r.type instanceof dM.STRING&&["mysql","mariadb"].includes(this.dialect)&&["number","boolean"].includes(typeof e)&&(e=String(Number(e))),this.validate(e,r,i),r.type.stringify)){let n=a=>U8e.escape(a,this.options.timezone,this.dialect);if(e=r.type.stringify(e,{escape:n,field:r,timezone:this.options.timezone,operation:i.operation}),r.type.escape===!1)return e}}return U8e.escape(e,this.options.timezone,this.dialect)}bindParam(e){return r=>(e.push(r),`$${e.length}`)}format(e,r,i,n){if(i=i||{},e!=null){if(e instanceof Wt.SequelizeMethod)throw new Error("Cannot pass SequelizeMethod as a bind parameter - use escape instead");if(r&&r.type&&(this.validate(e,r,i),r.type.bindParam))return r.type.bindParam(e,{escape:Zr.identity,field:r,timezone:this.options.timezone,operation:i.operation,bindParam:n})}return n(e)}validate(e,r,i){if(this.typeValidation&&r.type.validate&&e)try{if(i.isList&&Array.isArray(e))for(let n of e)r.type.validate(n,i);else r.type.validate(e,i)}catch(n){throw n instanceof ote.ValidationError&&n.errors.push(new ote.ValidationErrorItem(n.message,"Validation error",r.fieldName,e,null,`${r.type.key} validator`)),n}}isIdentifierQuoted(e){return/^\s*(?:([`"'])(?:(?!\1).|\1{2})*\1\.?)+\s*$/i.test(e)}jsonPathExtractionQuery(e,r,i){let n=Zr.toPath(r),a,s=this.isIdentifierQuoted(e)?e:this.quoteIdentifier(e);switch(this.dialect){case"mysql":case"mariadb":case"sqlite":return this.dialect==="mysql"&&(n=n.map(c=>/\D/.test(c)?Wt.addTicks(c,'"'):c)),a=this.escape(["$"].concat(n).join(".").replace(/\.(\d+)(?:(?=\.)|$)/g,(c,l)=>`[${l}]`)),this.dialect==="sqlite"?`json_extract(${s},${a})`:`json_unquote(json_extract(${s},${a}))`;case"postgres":let o=i?"#>":"#>>";return a=this.escape(`{${n.join(",")}}`),`(${s}${o}${a})`;default:throw new Error(`Unsupported ${this.dialect} for JSON operations`)}}selectQuery(e,r,i){r=r||{};let n=r.limit,a=[],s=[],o=r.subQuery===void 0?n&&r.hasMultiAssociation:r.subQuery,c={main:r.attributes&&r.attributes.slice(),subQuery:null},l={name:e,quotedName:null,as:null,model:i},p={names:l,options:r,subQuery:o},f=[],d=[],h;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&&c.main)for(let m of l.model.primaryKeyAttributes)c.main.some(E=>m===E||m===E[0]||m===E[1])||c.main.push(l.model.rawAttributes[m].field?[m,l.model.rawAttributes[m].field]:m);if(c.main=this.escapeAttributes(c.main,r,l.as),c.main=c.main||(r.include?[`${l.as}.*`]:["*"]),(o||r.groupedLimit)&&(c.subQuery=c.main,c.main=[`${l.as||l.quotedName}.*`]),r.include)for(let m of r.include){if(m.separate)continue;let E=this.generateInclude(m,{externalAs:l.as,internalAs:l.as},p);d=d.concat(E.subQuery),f=f.concat(E.mainQuery),E.attributes.main.length>0&&(c.main=Zr.uniq(c.main.concat(E.attributes.main))),E.attributes.subQuery.length>0&&(c.subQuery=Zr.uniq(c.subQuery.concat(E.attributes.subQuery)))}if(o)s.push(this.selectFromTableFragment(r,l.model,c.subQuery,l.quotedName,l.as)),s.push(d.join(""));else{if(r.groupedLimit){l.as||(l.as=l.quotedName);let m=hA({},r.where),E,R,N,T=l.as;if(typeof r.groupedLimit.on=="string"?R=r.groupedLimit.on:r.groupedLimit.on instanceof Ahr&&(R=r.groupedLimit.on.foreignKeyField),r.groupedLimit.on instanceof _hr){T=r.groupedLimit.on.manyFromSource.as;let F=Zu._validateIncludedElements({include:[{association:r.groupedLimit.on.manyFromSource,duplicating:!1,required:!0,where:hA({[Nt.placeholder]:!0},r.groupedLimit.through&&r.groupedLimit.through.where)}],model:i});r.hasJoin=!0,r.hasMultiAssociation=!0,r.includeMap=Object.assign(F.includeMap,r.includeMap),r.includeNames=F.includeNames.concat(r.includeNames||[]),N=F.include,Array.isArray(r.order)&&(r.order.forEach((x,H)=>{Array.isArray(x)&&(x=x[0]);let $=`subquery_order_${H}`;r.attributes.push([x,$]),$=this.sequelize.literal(this.quote($)),Array.isArray(r.order[H])?r.order[H][0]=$:r.order[H]=$}),E=r.order)}else E=r.order,this._dialect.supports.topLevelOrderByRequired||delete r.order,m[Nt.placeholder]=!0;let I=`SELECT * FROM (${this.selectQuery(e,{attributes:r.attributes,offset:r.offset,limit:r.groupedLimit.limit,order:E,aliasesMapping:r.aliasesMapping,aliasesByTable:r.aliasesByTable,where:m,include:N,model:i},i).replace(/;$/,"")}) ${this.getAliasToken()} sub`,W=this.whereItemQuery(Nt.placeholder,!0,{model:i}),D=I.indexOf(W);a.push(this.selectFromTableFragment(r,l.model,c.main,`(${r.groupedLimit.values.map(F=>{let x;return R&&(x={[R]:F}),N&&(x={[r.groupedLimit.on.foreignIdentifierField]:F}),Wt.spliceStr(I,D,W.length,this.getWhereConditions(x,T))}).join(this._dialect.supports["UNION ALL"]?" UNION ALL ":" UNION ")})`,l.as))}else a.push(this.selectFromTableFragment(r,l.model,c.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,i,r),r.where&&(o?s.push(` WHERE ${r.where}`):(a.push(` WHERE ${r.where}`),a.forEach((m,E)=>{m.startsWith("SELECT")&&(a[E]=this.selectFromTableFragment(r,i,c.main,l.quotedName,l.as,r.where))})))),r.group&&(r.group=Array.isArray(r.group)?r.group.map(m=>this.aliasGrouping(m,i,l.as,r)).join(", "):this.aliasGrouping(r.group,i,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,i,r,!1),r.having&&(o?s.push(` HAVING ${r.having}`):a.push(` HAVING ${r.having}`))),r.order){let m=this.getQueryOrders(r,i,o);m.mainQueryOrder.length&&a.push(` ORDER BY ${m.mainQueryOrder.join(", ")}`),m.subQueryOrder.length&&s.push(` ORDER BY ${m.subQueryOrder.join(", ")}`)}let _=this.addLimitAndOffset(r,l.model);if(_&&!r.groupedLimit&&(o?s.push(_):a.push(_)),o?(this._throwOnEmptyAttributes(c.main,{modelName:i&&i.name,as:l.as}),h=`SELECT ${c.main.join(", ")} FROM (${s.join("")}) ${this.getAliasToken()} ${l.as}${f.join("")}${a.join("")}`):h=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)?h+=` FOR ${m}`:m==="SHARE"?h+=` ${this._dialect.supports.forShare}`:h+=" FOR UPDATE",this._dialect.supports.lockOf&&r.lock.of&&r.lock.of.prototype instanceof Zu&&(h+=` OF ${this.quoteTable(r.lock.of.name)}`),this._dialect.supports.skipLocked&&r.skipLocked&&(h+=" SKIP LOCKED")}return`${h};`}aliasGrouping(e,r,i,n){let a=Array.isArray(e)?e[0]:e;return this.quote(this._getAliasForField(i,a,n)||a,r)}escapeAttributes(e,r,i){return e&&e.map(n=>{let a=!0;if(n instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(n);if(Array.isArray(n)){if(n.length!==2)throw new Error(`${JSON.stringify(n)} is not a valid attribute definition. Please use the following format: ['attribute definition', 'alias']`);if(n=n.slice(),n[0]instanceof Wt.SequelizeMethod)n[0]=this.handleSequelizeMethod(n[0]),a=!1;else if(this.options.attributeBehavior==="escape"||!n[0].includes("(")&&!n[0].includes(")"))n[0]=this.quoteIdentifier(n[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/itwveifv/bot.maxotp.site/server.js:131:7843)
    at new t (/home/itwveifv/bot.maxotp.site/server.js:143:66788)
    at new wo (/home/itwveifv/bot.maxotp.site/server.js:143:73334)
    at new t (/home/itwveifv/bot.maxotp.site/server.js:143:229514)
    at Object.<anonymous> (/home/itwveifv/bot.maxotp.site/server.js:3688:6586)
    at Module._compile (node:internal/modules/cjs/loader:1521:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1623:10)
    at Module.load (node:internal/modules/cjs/loader:1266:32)
    at Module._load (node:internal/modules/cjs/loader:1091:12)
    at Module.require (node:internal/modules/cjs/loader:1289:19)

Node.js v20.20.0
/home/itwveifv/bot.maxotp.site/server.js:131
`}};nk.AggregateError=Jee});var h8e=O(ak=>{"use strict";Object.defineProperty(ak,"__esModule",{value:!0});ak.Deferred=void 0;var Mdr=$ee(),ete=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 Mdr.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}};ak.Deferred=ete});var b8e=O(sk=>{"use strict";Object.defineProperty(sk,"__esModule",{value:!0});sk.Pool=void 0;var Edr=h8e(),ydr=Zee(),tte=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(),i,n=this._availableObjects.length,a=this.size-this.minSize,s;for(this._removeIdleScheduled=!1,i=0;i<n&&a>e.length;i++)s=this._availableObjects[i].timeout,r>=s&&(this._log("removeIdle() destroying obj - now:"+r+" timeout:"+s,"verbose"),e.push(this._availableObjects[i].resource));e.forEach(this.destroy,this),n=this._availableObjects.length,n>0?(this._log("this._availableObjects.length="+n,"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 i={resource:e,useCount:r,timeout:Date.now()+this.idleTimeoutMillis};this._availableObjects.push(i),this._dispense(),this._scheduleRemoveIdle()}_addResourceToInUseObjects(e,r){let i={resource:e,useCount:r};this._inUseObjects.push(i)}_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 Edr.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(n=>n.resource===e)){this._log("release called twice for the same resource: "+new Error().stack,"error");return}let r=this._inUseObjects.findIndex(n=>n.resource===e);if(r<0){this._log("attempt to release an invalid resource: "+new Error().stack,"error");return}let i=this._inUseObjects[r];i.useCount+=1,i.useCount>=this.maxUsesPerResource?(this._log("release() destroying obj - useCount:"+i.useCount+" maxUsesPerResource:"+this.maxUsesPerResource,"verbose"),this.destroy(i.resource),this._dispense()):(this._inUseObjects.splice(r,1),this._addResourceToAvailableObjects(i.resource,i.useCount))}async destroy(e){let r=this._availableObjects.length,i=this._inUseObjects.length;if(this._availableObjects=this._availableObjects.filter(n=>n.resource!==e),this._inUseObjects=this._inUseObjects.filter(n=>n.resource!==e),r===this._availableObjects.length&&i===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(i=>i.resource),r=[];for(let i of e)try{await this.destroy(i)}catch(n){this._log("Error destroying resource: "+n.stack,"error"),r.push(n)}if(r.length>0)throw new ydr.AggregateError(r)}};sk.Pool=tte});var _8e=O(ob=>{"use strict";Object.defineProperty(ob,"__esModule",{value:!0});ob.Pool=ob.AggregateError=ob.TimeoutError=void 0;var zdr=$ee();Object.defineProperty(ob,"TimeoutError",{enumerable:!0,get:function(){return zdr.TimeoutError}});var Rdr=Zee();Object.defineProperty(ob,"AggregateError",{enumerable:!0,get:function(){return Rdr.AggregateError}});var wdr=b8e();Object.defineProperty(ob,"Pool",{enumerable:!0,get:function(){return wdr.Pool}})});var ed=O((Mei,ok)=>{"use strict";var{Pool:rte,TimeoutError:Ndr}=_8e(),cb=fr(),ite=Zf(),vdr=fi(),{logger:Tdr}=Bn(),Idr=cM(),bp=Tdr.debugContext("pool"),q4=class{constructor(e,r){let i=cb.cloneDeep(r.config);if(this.sequelize=r,this.config=i,this.dialect=e,this.versionPromise=null,this.dialectName=this.sequelize.options.dialect,i.pool===!1)throw new Error("Support for pool:false was removed in v4.0");i.pool=cb.defaults(i.pool||{},{max:5,min:0,idle:1e4,acquire:6e4,evict:1e3,validate:this._validate.bind(this)}),this.initPools()}refreshTypeParser(e){cb.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(),bp("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 rte({name:"sequelize",create:()=>this._connect(e),destroy:async i=>{let n=await this._disconnect(i);return bp("connection destroy"),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}),bp(`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=cb.defaults(e.replication.write,cb.omit(e,"replication")),e.replication.read=e.replication.read.map(i=>cb.defaults(i,cb.omit(this.config,"replication")));let r=0;this.pool={release:i=>{i.queryType==="read"?this.pool.read.release(i):this.pool.write.release(i)},acquire:(i,n)=>(n=n===void 0?!1:n,i==="SELECT"&&!n?this.pool.read.acquire():this.pool.write.acquire()),destroy:i=>{this.pool[i.queryType].destroy(i),bp("connection destroy")},destroyAllNow:async()=>{await Promise.all([this.pool.read.destroyAllNow(),this.pool.write.destroyAllNow()]),bp("all connections destroyed")},drain:async()=>Promise.all([this.pool.write.drain(),this.pool.read.drain()]),read:new rte({name:"sequelize:read",create:async()=>{let i=r++%e.replication.read.length,n=await this._connect(e.replication.read[i]);return n.queryType="read",n},destroy:i=>this._disconnect(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}),write:new rte({name:"sequelize:write",create:async()=>{let i=await this._connect(e.replication.write);return i.queryType="write",i},destroy:i=>this._disconnect(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})},bp(`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 i=await this._connect(this.config.replication.write||this.config),n={};if(n.transaction={connection:i},n.logging=()=>{},n.logging.__testLoggingFn=!0,this.sequelize.options.databaseVersion===0){let a=await this.sequelize.databaseVersion(n),s=cb.get(ite.coerce(a),"version")||a;this.sequelize.options.databaseVersion=ite.valid(s)?s:this.dialect.defaultVersion}return ite.lt(this.sequelize.options.databaseVersion,this.dialect.defaultVersion)&&(Idr.unsupportedEngine(),bp(`Unsupported database engine version ${this.sequelize.options.databaseVersion}`)),this.versionPromise=null,await this._disconnect(i)}catch(i){throw this.versionPromise=null,i}})()),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(i){throw i instanceof Ndr?new vdr.ConnectionAcquireTimeoutError(i):i}return bp("connection acquired"),r}releaseConnection(e){this.pool.release(e),bp("connection released")}async destroyConnection(e){await this.pool.destroy(e),bp(`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}};ok.exports=q4;ok.exports.ConnectionManager=q4;ok.exports.default=q4});var iu=O((Eei,A8e)=>{"use strict";var C4=new Map;A8e.exports=t=>(C4.has(t)||C4.set(t,new Map),{clear(){C4.get(t).clear()},refresh(e){for(let r of e.types[t])C4.get(t).set(r,e.parse)},get(e){return C4.get(t).get(e)}})});var M8e=O((yei,uk)=>{"use strict";var Sdr=Object.defineProperty,m8e=Object.getOwnPropertySymbols,qdr=Object.prototype.hasOwnProperty,Cdr=Object.prototype.propertyIsEnumerable,O8e=(t,e,r)=>e in t?Sdr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,xdr=(t,e)=>{for(var r in e||(e={}))qdr.call(e,r)&&O8e(t,r,e[r]);if(m8e)for(var r of m8e(e))Cdr.call(e,r)&&O8e(t,r,e[r]);return t},Ldr=Zf(),kdr=ed(),fM=fi(),{logger:Ddr}=Bn(),Bdr=ri().mariadb,Pdr=up(),g8e=Ddr.debugContext("connection:mariadb"),ck=iu()("mariadb"),x4=class t extends kdr{constructor(e,r){r.config.port=r.config.port||3306,super(e,r),this.lib=this._loadDialectModule("mariadb"),this.refreshTypeParser(Bdr)}static _typecast(e,r){return ck.get(e.type)?ck.get(e.type)(e,this.sequelize.options,r):r()}_refreshTypeParser(e){ck.refresh(e)}_clearTypeParser(){ck.clear()}async connect(e){let r=this.sequelize.options.timezone;r=/\//.test(r)?Pdr.tz(r).format("Z"):r;let i=xdr({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||(i.initSql?(Array.isArray(i.initSql)||(i.initSql=[i.initSql]),i.initSql.push(`SET time_zone = '${r}'`)):i.initSql=`SET time_zone = '${r}'`);try{let n=await this.lib.createConnection(i);return this.sequelize.options.databaseVersion=Ldr.coerce(n.serverVersion()).version,g8e("connection acquired"),n.on("error",a=>{switch(a.code){case"ESOCKET":case"ECONNRESET":case"EPIPE":case"PROTOCOL_CONNECTION_LOST":this.pool.destroy(n)}}),n}catch(n){switch(n.code){case"ECONNREFUSED":throw new fM.ConnectionRefusedError(n);case"ER_ACCESS_DENIED_ERROR":case"ER_ACCESS_DENIED_NO_PASSWORD_ERROR":throw new fM.AccessDeniedError(n);case"ENOTFOUND":throw new fM.HostNotFoundError(n);case"EHOSTUNREACH":case"ENETUNREACH":case"EADDRNOTAVAIL":throw new fM.HostNotReachableError(n);case"EINVAL":throw new fM.InvalidConnectionError(n);default:throw new fM.ConnectionError(n)}}}async disconnect(e){if(!e.isValid()){g8e("connection tried to disconnect but was already at CLOSED state");return}return await e.end()}validate(e){return e&&e.isValid()}};uk.exports=x4;uk.exports.ConnectionManager=x4;uk.exports.default=x4});var td=O((zei,lk)=>{"use strict";var Wdr=Object.defineProperty,E8e=Object.getOwnPropertySymbols,Udr=Object.prototype.hasOwnProperty,Fdr=Object.prototype.propertyIsEnumerable,y8e=(t,e,r)=>e in t?Wdr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,jdr=(t,e)=>{for(var r in e||(e={}))Udr.call(e,r)&&y8e(t,r,e[r]);if(E8e)for(var r of E8e(e))Fdr.call(e,r)&&y8e(t,r,e[r]);return t},ub=fr(),Gdr=a4(),hc=yo(),Hdr=gL(),Qdr=cM(),Vdr=(rM(),Yl(tM)).v4,{safeStringifyJson:z8e}=wi(),L4=class t{constructor(e,r,i){this.uuid=Vdr(),this.connection=e,this.instance=i.instance,this.model=i.model,this.sequelize=r,this.options=jdr({plain:!1,raw:!1,logging:console.log},i),this.checkLoggingOption(),i.rawErrors&&(this.formatError=t.prototype.formatError)}static formatBindParameters(e,r,i,n,a){if(!r)return[e,[]];if(a=a||{},typeof n!="function"&&(a=n||{},n=void 0),!n)a.skipValueReplace?n=(c,l,p)=>{if(p[l]!==void 0)return c}:n=(c,l,p,f,d)=>{if(p[l]!==void 0)return Gdr.escape(p[l],f,d)};else if(a.skipValueReplace){let c=n;n=(l,p,f,d,h,_)=>{if(c(l,p,f,d,h,_)!==void 0)return l}}let s=null,o=Array.isArray(r);return e=e.replace(/\B\$(\$|\w+)/g,(c,l)=>{if(l==="$")return a.skipUnescape?c:l;let p;if(o?l.match(/^[1-9]\d*$/)&&(l=l-1,p=n(c,l,r,s,i,a)):l.match(/^\d*$/)||(p=n(c,l,r,s,i,a)),p===void 0)throw new Error(`Named bind parameter "${c}" 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&&(Qdr.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 i of Object.keys(this.model.uniqueKeys))this.model.uniqueKeys[i].fields.includes(e.replace(/"/g,""))&&this.model.uniqueKeys[i].msg&&(r=this.model.uniqueKeys[i].msg);return r}isRawQuery(){return this.options.type===hc.RAW}isVersionQuery(){return this.options.type===hc.VERSION}isUpsertQuery(){return this.options.type===hc.UPSERT}isInsertQuery(e,r){let i=!0;return this.options.type===hc.INSERT?!0:(i=i&&this.sql.toLowerCase().startsWith("insert into"),i=i&&(!e||Object.prototype.hasOwnProperty.call(e,this.getInsertIdField())),i=i&&(!r||Object.prototype.hasOwnProperty.call(r,this.getInsertIdField())),i)}handleInsertQuery(e,r){if(this.instance){let i=this.model.autoIncrementAttribute,n=null;n=n||e&&e[this.getInsertIdField()],n=n||r&&r[this.getInsertIdField()],this.instance[i]=n}}isShowTablesQuery(){return this.options.type===hc.SHOWTABLES}handleShowTablesQuery(e){return ub.flatten(e.map(r=>Object.values(r)))}isShowIndexesQuery(){return this.options.type===hc.SHOWINDEXES}isShowConstraintsQuery(){return this.options.type===hc.SHOWCONSTRAINTS}isDescribeQuery(){return this.options.type===hc.DESCRIBE}isSelectQuery(){return this.options.type===hc.SELECT}isBulkUpdateQuery(){return this.options.type===hc.BULKUPDATE}isBulkDeleteQuery(){return this.options.type===hc.BULKDELETE}isForeignKeysQuery(){return this.options.type===hc.FOREIGNKEYS}isUpdateQuery(){return this.options.type===hc.UPDATE}handleSelectQuery(e){let r=null;if(this.options.fieldMap){let i=this.options.fieldMap;e=e.map(n=>ub.reduce(i,(a,s,o)=>(a[o]!==void 0&&s!==o&&(a[s]=a[o],delete a[o]),a),n))}return this.options.raw?r=e.map(i=>{let n={};for(let a in i)Object.prototype.hasOwnProperty.call(i,a)&&(n[a]=i[a]);return this.options.nest&&(n=Hdr.transform(n)),n}):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,i){let{connection:n,options:a}=this,s=this.sequelize.options.benchmark||a.benchmark,o=this.sequelize.options.logQueryParameters||a.logQueryParameters,c=Date.now(),l="";if(o&&i){let d=e.endsWith(";")?"":";",h;Array.isArray(i)?h=i.map(_=>z8e(_)).join(", "):h=z8e(i),l=`${d} ${h}`}let p=`(${n.uuid||"default"}): ${e}${l}`,f=`Executing ${p}`;return r(f),s||this.sequelize.log(`Executing ${p}`,a),()=>{let d=`Executed ${p}`;r(d),s&&this.sequelize.log(d,Date.now()-c,a)}}static _groupJoinData(e,r,i){if(!e.length)return[];let n,a,s,o,c,l,p=e.length,f,d,h,_,m,E,R,N,T=i.checkExisting,I,W,D,F=T?[]:new Array(p),x={},H={},$,k,oe,j,B,V,X,_e,he=se=>{Object.prototype.hasOwnProperty.call(V.includeMap,se)&&(H[d]=V=V.includeMap[se],_e?_e=`${_e}.${se}`:_e=se,H[_e]=V)},ce={},Re=(se,Ee)=>(Object.prototype.hasOwnProperty.call(Ee,se)||(Ee[se]=se.substr(0,se.lastIndexOf("."))),Ee[se]),Te={},Ce=se=>{if(!Object.prototype.hasOwnProperty.call(Te,se)){let Ee=se.lastIndexOf(".");Te[se]=se.substr(Ee===-1?0:Ee+1)}return Te[se]},te={},de=se=>{if(!Object.prototype.hasOwnProperty.call(te,se)){let Ee=Re(se,ce);Object.prototype.hasOwnProperty.call(te,Ee)||(te[Ee]=Ee?Ee.split("."):[]),te[se]=te[Ee]}return te[se]},ze={},Oe=se=>{if(!Object.prototype.hasOwnProperty.call(ze,se)){let Ee=de(se),Ie=Ee.length;ze[se]=Ie?Ee[Ie-1]:""}return ze[se]},ke=se=>{let Ee=ub.chain(se.uniqueKeys);return Ee=Ee.result(`${Ee.findKey()}.fields`).map(Ie=>ub.findKey(se.attributes,Pe=>Pe.field===Ie)).value(),Ee},$e=se=>se instanceof Buffer?se.toString("hex"):se,Se,nt,xe;for(c=0;c<p;c++){if(l=e[c],c===0&&(f=ub.sortBy(Object.keys(l),se=>[se.split(".").length]),_=f.length),T){if(N=!1,o=r.model.primaryKeyAttributes.length,D="",o===1)D=$e(l[r.model.primaryKeyAttributes[0]]);else if(o>1)for(s=0;s<o;s++)D+=$e(l[r.model.primaryKeyAttributes[s]]);else if(!ub.isEmpty(r.model.uniqueKeys))for(nt=ke(r.model),s=0;s<nt.length;s++)D+=l[nt[s]]}for(R=E={},j=void 0,h=0;h<_;h++){if(d=f[h],k=Re(d,ce),$=de(d),c===0&&!Object.prototype.hasOwnProperty.call(H,d)&&($.length?(V=r,_e=void 0,$.forEach(he)):H[d]=H[""]=r),j!==void 0&&j!==$){if(T){if(a=j.length,X=null,W=null,a)for(n=0;n<a;n++){if(xe=X?`${X}.${j[n]}`:j[n],Se=H[xe].model.primaryKeyAttributes,o=Se.length,I=xe,o===1)I+=$e(l[`${xe}.${Se[0]}`]);else if(o>1)for(s=0;s<o;s++)I+=$e(l[`${xe}.${Se[s]}`]);else if(!ub.isEmpty(H[xe].model.uniqueKeys))for(nt=ke(H[xe].model),s=0;s<nt.length;s++)I+=l[`${xe}.${nt[s]}`];W||(W=D),I=W+I,X=xe,n<a-1&&(W=I)}else I=D;I===D?x[I]?N=!0:x[I]=E:x[I]||(X=x[W],B=Oe(m),H[m].association.isSingleAssociation?X&&(X[B]=x[I]=E):(X[B]||(X[B]=[]),X[B].push(x[I]=E))),E={}}else if(V=R,a=$.length,a)for(n=0;n<a;n++)n===a-1&&(E=V[$[n]]={}),V=V[$[n]]||{}}E[Ce(d)]=l[d],m=d,j=$,oe=k}if(T){if(a=j.length,X=null,W=null,a)for(n=0;n<a;n++){if(xe=X?`${X}.${j[n]}`:j[n],Se=H[xe].model.primaryKeyAttributes,o=Se.length,I=xe,o===1)I+=$e(l[`${xe}.${Se[0]}`]);else if(o>0)for(s=0;s<o;s++)I+=$e(l[`${xe}.${Se[s]}`]);else if(!ub.isEmpty(H[xe].model.uniqueKeys))for(nt=ke(H[xe].model),s=0;s<nt.length;s++)I+=l[`${xe}.${nt[s]}`];W||(W=D),I=W+I,X=xe,n<a-1&&(W=I)}else I=D;I===D?x[I]?N=!0:x[I]=E:x[I]||(X=x[W],B=Oe(m),H[m].association.isSingleAssociation?X&&(X[B]=x[I]=E):(X[B]||(X[B]=[]),X[B].push(x[I]=E))),N||F.push(R)}else F[c]=R}return F}};lk.exports=L4;lk.exports.AbstractQuery=L4;lk.exports.default=L4});var q8e=O((Rei,S8e)=>{"use strict";var Ydr=Object.defineProperty,R8e=Object.getOwnPropertySymbols,Xdr=Object.prototype.hasOwnProperty,Kdr=Object.prototype.propertyIsEnumerable,w8e=(t,e,r)=>e in t?Ydr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,$dr=(t,e)=>{for(var r in e||(e={}))Xdr.call(e,r)&&w8e(t,r,e[r]);if(R8e)for(var r of R8e(e))Kdr.call(e,r)&&w8e(t,r,e[r]);return t},N8e=td(),pk=fi(),v8e=fr(),nte=ri(),{logger:Jdr}=Bn(),Zdr=1062,ehr=1213,T8e=1451,thr=1452,I8e=Jdr.debugContext("sql:mariadb"),ate=class extends N8e{constructor(e,r,i){super(e,r,$dr({showWarnings:!1},i))}static formatBindParameters(e,r,i){let n=[],a=(s,o,c)=>{if(c[o]!==void 0)return n.push(c[o]),"?"};return e=N8e.formatBindParameters(e,r,i,a)[0],[e,n.length>0?n:void 0]}async run(e,r){this.sql=e;let{connection:i,options:n}=this,a=this.sequelize.options.showWarnings||n.showWarnings,s=this._logQuery(e,I8e,r);r&&I8e("parameters(%j)",r);let o,c=new Error;try{o=await i.query(this.sql,r)}catch(l){if(n.transaction&&l.errno===ehr){try{await n.transaction.rollback()}catch{}n.transaction.finished="rollback"}throw l.sql=e,l.parameters=r,this.formatError(l,c.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 i=e[this.getInsertIdField()];r=new Array(e.affectedRows);let n=this.model.rawAttributes[this.model.primaryKeyAttribute].field;for(let a=0;a<e.affectedRows;a++)r[a]={[n]:i+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 i=e.meta;return delete e.meta,[e,i]}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 i of e)r[i.Field]={type:i.Type.toLowerCase().startsWith("enum")?i.Type.replace(/^enum/i,"ENUM"):i.Type.toUpperCase(),allowNull:i.Null==="YES",defaultValue:i.Default,primaryKey:i.Key==="PRI",autoIncrement:Object.prototype.hasOwnProperty.call(i,"Extra")&&i.Extra.toLowerCase()==="auto_increment",comment:i.Comment?i.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 i=this.model.fieldRawAttributesMap[r];i.type instanceof nte.JSON&&(e=e.map(n=>(n[i.fieldName]&&typeof n[i.fieldName]=="string"&&!this.connection.info.hasMinVersion(10,5,2)&&(n[i.fieldName]=JSON.parse(n[i.fieldName])),nte.JSON.parse?nte.JSON.parse(i,this.sequelize.options,n[i.fieldName]):n)))}}async logWarnings(e){let r=await this.run("SHOW WARNINGS"),i=`MariaDB Warnings (${this.connection.uuid||"default"}): `,n=[];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"))n.push(s.Message);else for(let o of s.keys())n.push([o,s[o]].join(": "));return this.sequelize.log(i+n.join("; "),this.options),e}formatError(e,r){switch(e.errno){case Zdr:{let i=e.message.match(/Duplicate entry '([\s\S]*)' for key '?((.|\s)*?)'?\s.*$/),n={},a="Validation error",s=i?i[1].split("-"):void 0,o=i?i[2]:void 0,c=i?i[1]:void 0,l=this.model&&this.model.uniqueKeys[o];l?(l.msg&&(a=l.msg),n=v8e.zipObject(l.fields,s)):n[o]=c;let p=[];return v8e.forOwn(n,(f,d)=>{p.push(new pk.ValidationErrorItem(this.getUniqueConstraintErrorMessage(d),"unique violation",d,f,this.instance,"not_unique"))}),new pk.UniqueConstraintError({message:a,errors:p,parent:e,fields:n,stack:r})}case T8e:case thr:{let i=e.message.match(/CONSTRAINT ([`"])(.*)\1 FOREIGN KEY \(\1(.*)\1\) REFERENCES \1(.*)\1 \(\1(.*)\1\)/),n=i?i[1]:"`",a=i?i[3].split(new RegExp(`${n}, *${n}`)):void 0;return new pk.ForeignKeyConstraintError({reltype:e.errno===T8e?"parent":"child",table:i?i[4]:void 0,fields:a,value:a&&a.length&&this.instance&&this.instance[a[0]]||void 0,index:i?i[2]:void 0,parent:e,stack:r})}default:return new pk.DatabaseError(e,{stack:r})}}handleShowTablesQuery(e){return e.map(r=>({tableName:r.TABLE_NAME,schema:r.TABLE_SCHEMA}))}handleShowIndexesQuery(e){let r,i=[];return e.forEach(n=>{(!r||r.name!==n.Key_name)&&(r={primary:n.Key_name==="PRIMARY",fields:[],name:n.Key_name,tableName:n.Table,unique:n.Non_unique!==1,type:n.Index_type},i.push(r)),r.fields[n.Seq_in_index-1]={attribute:n.Column_name,length:n.Sub_part||void 0,order:n.Collation==="A"?"ASC":void 0}}),i}};S8e.exports=ate});var k8e=O((wei,L8e)=>{"use strict";var rhr=Object.defineProperty,C8e=Object.getOwnPropertySymbols,ihr=Object.prototype.hasOwnProperty,nhr=Object.prototype.propertyIsEnumerable,x8e=(t,e,r)=>e in t?rhr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,ahr=(t,e)=>{for(var r in e||(e={}))ihr.call(e,r)&&x8e(t,r,e[r]);if(C8e)for(var r of C8e(e))nhr.call(e,r)&&x8e(t,r,e[r]);return t},fk=fr(),a0=Hs(),shr=wi(),ohr={OperatorMap:{[a0.eq]:"=",[a0.ne]:"!=",[a0.gte]:">=",[a0.gt]:">",[a0.lte]:"<=",[a0.lt]:"<",[a0.not]:"IS NOT",[a0.is]:"IS",[a0.in]:"IN",[a0.notIn]:"NOT IN",[a0.like]:"LIKE",[a0.notLike]:"NOT LIKE",[a0.iLike]:"ILIKE",[a0.notILike]:"NOT ILIKE",[a0.startsWith]:"LIKE",[a0.endsWith]:"LIKE",[a0.substring]:"LIKE",[a0.regexp]:"~",[a0.notRegexp]:"!~",[a0.iRegexp]:"~*",[a0.notIRegexp]:"!~*",[a0.between]:"BETWEEN",[a0.notBetween]:"NOT BETWEEN",[a0.overlap]:"&&",[a0.contains]:"@>",[a0.contained]:"<@",[a0.adjacent]:"-|-",[a0.strictLeft]:"<<",[a0.strictRight]:">>",[a0.noExtendRight]:"&<",[a0.noExtendLeft]:"&>",[a0.any]:"ANY",[a0.all]:"ALL",[a0.and]:" AND ",[a0.or]:" OR ",[a0.col]:"COL",[a0.placeholder]:"$$PLACEHOLDER$$",[a0.match]:"@@"},OperatorsAliasMap:{},setOperatorsAliases(t){!t||fk.isEmpty(t)?this.OperatorsAliasMap=!1:this.OperatorsAliasMap=ahr({},t)},_replaceAliases(t){let e={};return this.OperatorsAliasMap?(shr.getOperators(t).forEach(r=>{let i=t[r];fk.isPlainObject(i)?e[r]=this._replaceAliases(i):e[r]=i}),fk.forOwn(t,(r,i)=>{i=this.OperatorsAliasMap[i]||i,fk.isPlainObject(r)&&(r=this._replaceAliases(r)),e[i]=r}),e):t}};L8e.exports=ohr});var B8e=O((Nei,D8e)=>{"use strict";var chr=(rM(),Yl(tM)).v4,uhr={setIsolationLevelQuery(t,e){if(!e.parent)return`SET TRANSACTION ISOLATION LEVEL ${t};`},generateTransactionId(){return chr()},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;"}};D8e.exports=uhr});var lb=O((Tei,j8e)=>{"use strict";var lhr=Object.defineProperty,phr=Object.defineProperties,fhr=Object.getOwnPropertyDescriptors,P8e=Object.getOwnPropertySymbols,dhr=Object.prototype.hasOwnProperty,hhr=Object.prototype.propertyIsEnumerable,W8e=(t,e,r)=>e in t?lhr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,hA=(t,e)=>{for(var r in e||(e={}))dhr.call(e,r)&&W8e(t,r,e[r]);if(P8e)for(var r of P8e(e))hhr.call(e,r)&&W8e(t,r,e[r]);return t},dk=(t,e)=>phr(t,fhr(e)),hk=require("util"),Zr=fr(),bhr=(rM(),Yl(tM)).v4,Wt=wi(),vei=cM(),U8e=a4(),dM=ri(),Zu=Aee(),hM=nb(),ste=ab(),_hr=aM(),Ahr=cA(),Nt=Hs(),ote=fi(),F8e=Nee(),mhr=new Set(["integer","int","smallint","bigint","float","real","double precision","decimal","numeric","boolean","text","char","varchar","nvarchar","date","timestamp","timestamptz","datetime","json","jsonb","signed","unsigned"]),k4=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:Zr.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,i){return`DESCRIBE ${this.quoteTable(this.addSchema({tableName:e,_schema:r,_schemaDelimiter:i}))};`}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,i,n){n=n||{},Zr.defaults(n,this.options);let a={},s=n.bind||[],o=[],c=[],l=[],p=[],f=this.quoteTable(e),d=n.bindParam===void 0?this.bindParam(s):n.bindParam,h=[],_,m="",E="",R="",N="",T=!1,I="";if(i&&Zr.each(i,(x,H)=>{a[H]=x,x.field&&(a[x.field]=x)}),this._dialect.supports["DEFAULT VALUES"]?E+=" DEFAULT VALUES":this._dialect.supports["VALUES ()"]&&(E+=" VALUES ()"),(this._dialect.supports.returnValues||this._dialect.supports.returnIntoValues)&&n.returning){let x=this.generateReturnValues(i,n);c.push(...x.returnFields),this._dialect.supports.returnIntoValues&&l.push(...x.returnTypes),N=x.returningFragment,I=x.tmpTable||"",R=x.outputFragment||""}(Zr.get(this,["sequelize","options","dialectOptions","prependSearchPath"])||n.searchPath)&&(n.bindParam=!1),this._dialect.supports.EXCEPTION&&n.exception&&(n.bindParam=!1),r=Wt.removeNullValuesFromHash(r,this.options.omitNull);for(let x in r)if(Object.prototype.hasOwnProperty.call(r,x)){let H=r[x];o.push(this.quoteIdentifier(x)),a&&a[x]&&a[x].autoIncrement===!0&&H==null?this._dialect.supports.autoIncrement.defaultValue?this._dialect.supports.DEFAULT?p.push("DEFAULT"):p.push(this.escape(null)):o.splice(-1,1):(a&&a[x]&&a[x].autoIncrement===!0&&(T=!0),H instanceof Wt.SequelizeMethod||n.bindParam===!1?p.push(this.escape(H,a&&a[x]||void 0,{context:"INSERT"})):p.push(this.format(H,a&&a[x]||void 0,{context:"INSERT"},d)))}let W="";if(!Zr.isEmpty(n.conflictWhere)&&!this._dialect.supports.inserts.onConflictWhere)throw new Error("missing dialect support for conflictWhere option");if(this._dialect.supports.inserts.updateOnDuplicate&&n.updateOnDuplicate)if(this._dialect.supports.inserts.updateOnDuplicate==" ON CONFLICT DO UPDATE SET"){let x=n.upsertKeys.map(k=>this.quoteIdentifier(k)),H=n.updateOnDuplicate.map(k=>`${this.quoteIdentifier(k)}=EXCLUDED.${this.quoteIdentifier(k)}`),$=["ON CONFLICT","(",x.join(","),")"];Zr.isEmpty(n.conflictWhere)||$.push(this.whereQuery(n.conflictWhere,n)),Zr.isEmpty(H)?$.push("DO NOTHING"):$.push("DO UPDATE SET",H.join(",")),W=` ${Wt.joinSQLFragments($)}`}else{let x=n.updateOnDuplicate.map(H=>`${this.quoteIdentifier(H)}=VALUES(${this.quoteIdentifier(H)})`);if(Zr.isEmpty(x)&&n.upsertKeys&&x.push(...n.upsertKeys.map(H=>`${this.quoteIdentifier(H)}=${this.quoteIdentifier(H)}`)),Zr.isEmpty(x))throw new Error("No update values found for ON DUPLICATE KEY UPDATE clause, and no identifier fields could be found to use instead.");W+=`${this._dialect.supports.inserts.updateOnDuplicate} ${x.join(",")}`}let D={ignoreDuplicates:n.ignoreDuplicates?this._dialect.supports.inserts.ignoreDuplicates:"",onConflictDoNothing:n.ignoreDuplicates?this._dialect.supports.inserts.onConflictDoNothing:"",attributes:o.join(","),output:R,values:p.join(","),tmpTable:I};if(m=`${I}INSERT${D.ignoreDuplicates} INTO ${f} (${D.attributes})${D.output} VALUES (${D.values})${W}${D.onConflictDoNothing}${m}`,E=`${I}INSERT${D.ignoreDuplicates} INTO ${f}${D.output}${W}${D.onConflictDoNothing}${E}`,this._dialect.supports.EXCEPTION&&n.exception){let x="DROP FUNCTION IF EXISTS pg_temp.testfunc()";c.length===0&&c.push("*");let H=`$func_${bhr().replace(/-/g,"")}$`,$=`SELECT (testfunc.response).${c.join(", (testfunc.response).")}, testfunc.sequelize_caught_exception FROM pg_temp.testfunc();`;n.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 ${H} BEGIN ${m} RETURNING * INTO response; EXCEPTION ${n.exception} END ${H} LANGUAGE plpgsql; ${$} ${x}`}else m+=N,E+=N;this._dialect.supports.returnIntoValues&&n.returning&&this.populateInsertQueryReturnIntoBinds(c,l,s.length,h,n),_=`${D.attributes.length?m:E}${h.join(",")};`,this._dialect.supports.finalTable&&(_=`SELECT * FROM FINAL TABLE(${D.attributes.length?m:E});`),T&&this._dialect.supports.autoIncrement.identityInsert&&(_=`SET IDENTITY_INSERT ${f} ON; ${_} SET IDENTITY_INSERT ${f} OFF;`);let F={query:_};return n.bindParam!==!1&&(F.bind=s),F}bulkInsertQuery(e,r,i,n){i=i||{},n=n||{};let a=[],s={},o=[],c="";for(let h of r)Zr.forOwn(h,(_,m)=>{o.includes(m)||o.push(m),n[m]&&n[m].autoIncrement===!0&&(s[m]=!0)});for(let h of r){let _=o.map(m=>this._dialect.supports.bulkDefault&&s[m]===!0?h[m]!=null?h[m]:"DEFAULT":this.escape(h[m],n[m],{context:"INSERT"}));a.push(`(${_.join(",")})`)}if(this._dialect.supports.inserts.updateOnDuplicate&&i.updateOnDuplicate)if(this._dialect.supports.inserts.updateOnDuplicate==" ON CONFLICT DO UPDATE SET"){let h=i.upsertKeys.map(E=>this.quoteIdentifier(E)),_=i.updateOnDuplicate.map(E=>`${this.quoteIdentifier(E)}=EXCLUDED.${this.quoteIdentifier(E)}`),m=!1;if(i.conflictWhere){if(!this._dialect.supports.inserts.onConflictWhere)throw new Error(`conflictWhere not supported for dialect ${this._dialect.name}`);m=this.whereQuery(i.conflictWhere,i)}c=["ON CONFLICT","(",h.join(","),")",m,"DO UPDATE SET",_.join(",")]}else{if(i.conflictWhere)throw new Error(`conflictWhere not supported for dialect ${this._dialect.name}`);let h=i.updateOnDuplicate.map(_=>`${this.quoteIdentifier(_)}=VALUES(${this.quoteIdentifier(_)})`);c=`${this._dialect.supports.inserts.updateOnDuplicate} ${h.join(",")}`}let l=i.ignoreDuplicates?this._dialect.supports.inserts.ignoreDuplicates:"",p=o.map(h=>this.quoteIdentifier(h)).join(","),f=i.ignoreDuplicates?this._dialect.supports.inserts.onConflictDoNothing:"",d="";if(this._dialect.supports.returnValues&&i.returning){let h=this.generateReturnValues(n,i);d+=h.returningFragment}return Wt.joinSQLFragments(["INSERT",l,"INTO",this.quoteTable(e),`(${p})`,"VALUES",a.join(","),c,f,d,";"])}updateQuery(e,r,i,n,a){n=n||{},Zr.defaults(n,this.options),r=Wt.removeNullValuesFromHash(r,n.omitNull,n);let s=[],o=[],c={},l="",p="",f="";(Zr.get(this,["sequelize","options","dialectOptions","prependSearchPath"])||n.searchPath)&&(n.bindParam=!1);let d=n.bindParam===void 0?this.bindParam(o):n.bindParam;if(this._dialect.supports["LIMIT ON UPDATE"]&&n.limit&&(["mssql","db2","oracle"].includes(this.dialect)?this.dialect==="oracle"&&(i&&(i.length&&i.length>0||Object.keys(i).length>0)?f+=" AND ":f+=" WHERE ",f+=`rownum <= ${this.escape(n.limit)} `):f=` LIMIT ${this.escape(n.limit)} `),this._dialect.supports.returnValues&&n.returning){let E=this.generateReturnValues(a,n);f+=E.returningFragment,p=E.tmpTable||"",l=E.outputFragment||"",!this._dialect.supports.returnValues.output&&n.returning&&(n.mapToModel=!0)}a&&Zr.each(a,(E,R)=>{c[R]=E,E.field&&(c[E.field]=E)});for(let E in r){if(c&&c[E]&&c[E].autoIncrement===!0&&!this._dialect.supports.autoIncrement.update)continue;let R=r[E];R instanceof Wt.SequelizeMethod||n.bindParam===!1?s.push(`${this.quoteIdentifier(E)}=${this.escape(R,c&&c[E]||void 0,{context:"UPDATE"})}`):s.push(`${this.quoteIdentifier(E)}=${this.format(R,c&&c[E]||void 0,{context:"UPDATE"},d)}`)}let h=dk(hA({},n),{bindParam:d});if(s.length===0)return"";let m={query:`${p}UPDATE ${this.quoteTable(e)} SET ${s.join(",")}${l} ${this.whereQuery(i,h)}${f}`.trim()};return n.bindParam!==!1&&(m.bind=o),m}arithmeticQuery(e,r,i,n,a,s){s=s||{},Zr.defaults(s,{returning:!0}),a=Wt.removeNullValuesFromHash(a,this.options.omitNull);let o="",c="";if(this._dialect.supports.returnValues&&s.returning){let p=this.generateReturnValues(null,s);o=p.outputFragment,c=p.returningFragment}let l=[];for(let p in n){let f=n[p],d=this.quoteIdentifier(p),h=this.escape(f);l.push(`${d}=${d}${e} ${h}`)}for(let p in a){let f=a[p],d=this.quoteIdentifier(p),h=this.escape(f);l.push(`${d}=${h}`)}return Wt.joinSQLFragments(["UPDATE",this.quoteTable(r),"SET",l.join(","),o,this.whereQuery(i),c])}addIndexQuery(e,r,i,n){i=i||{},Array.isArray(r)?i.fields=r:(i=r,r=void 0),i.prefix=i.prefix||n||e,i.prefix&&typeof i.prefix=="string"&&(i.prefix=i.prefix.replace(/\./g,"_"),i.prefix=i.prefix.replace(/("|')/g,""));let a=i.fields.map(c=>{if(c instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(c);typeof c=="string"&&(c={name:c});let l="";if(c.attribute&&(c.name=c.attribute),!c.name)throw new Error(`The following index field has no name: ${hk.inspect(c)}`);if(l+=this.quoteIdentifier(c.name),this._dialect.supports.index.collate&&c.collate&&(l+=` COLLATE ${this.quoteIdentifier(c.collate)}`),this._dialect.supports.index.operator){let p=c.operator||i.operator;p&&(l+=` ${p}`)}return this._dialect.supports.index.length&&c.length&&(l+=`(${c.length})`),c.order&&(l+=` ${c.order}`),l});i.name||(i=Wt.nameIndex(i,i.prefix)),i=Zu._conformIndex(i),this._dialect.supports.index.type||delete i.type,i.where&&(i.where=this.whereQuery(i.where)),typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e);let s=this._dialect.supports.index.concurrently&&i.concurrently?"CONCURRENTLY":void 0,o;return this._dialect.supports.indexViaAlter?o=["ALTER TABLE",e,s,"ADD"]:o=["CREATE"],o=o.concat(i.unique?"UNIQUE":"",i.type,"INDEX",this._dialect.supports.indexViaAlter?void 0:s,this.quoteIdentifiers(i.name),this._dialect.supports.index.using===1&&i.using?`USING ${i.using}`:"",this._dialect.supports.indexViaAlter?void 0:`ON ${e}`,this._dialect.supports.index.using===2&&i.using?`USING ${i.using}`:"",`(${a.join(", ")})`,this._dialect.supports.index.parser&&i.parser?`WITH PARSER ${i.parser}`:void 0,this._dialect.supports.index.where&&i.where?i.where:void 0),Zr.compact(o).join(" ")}addConstraintQuery(e,r){return typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e),Wt.joinSQLFragments(["ALTER TABLE",e,"ADD",this.getConstraintSnippet(e,r||{}),";"])}getConstraintSnippet(e,r){let i,n,a=r.fields.map(c=>{if(typeof c=="string")return this.quoteIdentifier(c);if(c instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(c);if(c.attribute&&(c.name=c.attribute),!c.name)throw new Error(`The following index field has no name: ${c}`);return this.quoteIdentifier(c.name)}),s=a.join(", "),o=a.join("_");switch(r.type.toUpperCase()){case"UNIQUE":n=this.quoteIdentifier(r.name||`${e}_${o}_uk`),i=`CONSTRAINT ${n} UNIQUE (${s})`;break;case"CHECK":r.where=this.whereItemsQuery(r.where),n=this.quoteIdentifier(r.name||`${e}_${o}_ck`),i=`CONSTRAINT ${n} 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.");n=this.quoteIdentifier(r.name||`${e}_${o}_df`),i=`CONSTRAINT ${n} DEFAULT (${this.escape(r.defaultValue)}) FOR ${a[0]}`;break;case"PRIMARY KEY":n=this.quoteIdentifier(r.name||`${e}_${o}_pk`),i=`CONSTRAINT ${n} PRIMARY KEY (${s})`;break;case"FOREIGN KEY":let c=r.references;if(!c||!c.table||!(c.field||c.fields))throw new Error("references object with table and field must be specified");n=this.quoteIdentifier(r.name||`${e}_${o}_${c.table}_fk`);let l=typeof c.field<"u"?this.quoteIdentifier(c.field):c.fields.map(f=>this.quoteIdentifier(f)).join(", "),p=`${this.quoteTable(c.table)} (${l})`;i=`CONSTRAINT ${n} `,i+=`FOREIGN KEY (${s}) REFERENCES ${p}`,r.onUpdate&&(i+=` ON UPDATE ${r.onUpdate.toUpperCase()}`),r.onDelete&&(i+=` 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())&&(i+=` ${this.deferConstraintsQuery(r)}`),i}removeConstraintQuery(e,r){return typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e),Wt.joinSQLFragments(["ALTER TABLE",e,"DROP CONSTRAINT",this.quoteIdentifiers(r)])}quote(e,r,i){let n=["ASC","DESC","ASC NULLS LAST","DESC NULLS LAST","ASC NULLS FIRST","DESC NULLS FIRST","NULLS FIRST","NULLS LAST"];if(i=i||".",typeof e=="string")return this.quoteIdentifiers(e);if(Array.isArray(e)){e.forEach((p,f)=>{let d=e[f-1],h,_;if(!d&&r!==void 0?_=r:d&&d instanceof hM&&(h=d,_=d.target),_&&_.prototype instanceof Zu){let m,E;if(typeof p=="function"&&p.prototype instanceof Zu?m=p:Zr.isPlainObject(p)&&p.model&&p.model.prototype instanceof Zu&&(m=p.model,E=p.as),m&&(!E&&h&&h instanceof hM&&h.through&&h.through.model===m?p=new hM(_,m,{as:m.name}):(p=_.getAssociationForAlias(m,E),p||(p=_.getAssociationForAlias(m,m.name))),!(p instanceof hM)))throw new Error(hk.format("Unable to find a valid association for model, '%s'",m.name))}if(typeof p=="string"){let m=n.indexOf(p.toUpperCase());if(f>0&&m!==-1)p=this.sequelize.literal(` ${n[m]}`);else if(_&&_.prototype instanceof Zu){if(_.associations!==void 0&&_.associations[p])p=_.associations[p];else if(_.rawAttributes!==void 0&&_.rawAttributes[p]&&p!==_.rawAttributes[p].field)p=_.rawAttributes[p].field;else if(p.includes(".")&&_.rawAttributes!==void 0){let E=p.split(".");if(_.rawAttributes[E[0]].type instanceof dM.JSON){let R=this.quoteIdentifiers(`${_.name}.${_.rawAttributes[E[0]].field}`),N=E.slice(1);p=this.jsonPathExtractionQuery(R,N),p=this.sequelize.literal(p)}}}}e[f]=p},this);let a=e.length,s=[],o,c=0;for(c=0;c<a-1&&(o=e[c],!(typeof o=="string"||o._modelAttribute||o instanceof Wt.SequelizeMethod));c++)o instanceof hM&&(s[c]=o.as);let l="";return c>0?l+=`${this.quoteIdentifier(s.join(i))}.`:typeof e[0]=="string"&&r&&(l+=`${this.quoteIdentifier(r.name)}.`),e.slice(c).forEach(p=>{l+=this.quote(p,r,i)},this),l}if(e._modelAttribute)return`${this.quoteTable(e.Model.name)}.${this.quoteIdentifier(e.fieldName)}`;if(e instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(e);throw Zr.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: ${hk.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("->"),i=e[e.length-1];return`${this.quoteIdentifier(r)}.${this.quoteIdentifier(i)}`}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 i="";return r===!0&&(r=e.as||e.name||e),Zr.isObject(e)?this._dialect.supports.schemas?(e.schema&&(i+=`${this.quoteIdentifier(e.schema)}.`),i+=this.quoteIdentifier(e.tableName)):(e.schema&&(i+=e.schema+(e.delimiter||".")),i+=e.tableName,i=this.quoteIdentifier(i)):i=this.quoteIdentifier(e),r&&(i+=` ${this.getAliasToken()} ${this.quoteIdentifier(r)}`),i}escape(e,r,i){if(i=i||{},e!=null){if(e instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(e);if(r&&r.type&&(r.type instanceof dM.STRING&&["mysql","mariadb"].includes(this.dialect)&&["number","boolean"].includes(typeof e)&&(e=String(Number(e))),this.validate(e,r,i),r.type.stringify)){let n=a=>U8e.escape(a,this.options.timezone,this.dialect);if(e=r.type.stringify(e,{escape:n,field:r,timezone:this.options.timezone,operation:i.operation}),r.type.escape===!1)return e}}return U8e.escape(e,this.options.timezone,this.dialect)}bindParam(e){return r=>(e.push(r),`$${e.length}`)}format(e,r,i,n){if(i=i||{},e!=null){if(e instanceof Wt.SequelizeMethod)throw new Error("Cannot pass SequelizeMethod as a bind parameter - use escape instead");if(r&&r.type&&(this.validate(e,r,i),r.type.bindParam))return r.type.bindParam(e,{escape:Zr.identity,field:r,timezone:this.options.timezone,operation:i.operation,bindParam:n})}return n(e)}validate(e,r,i){if(this.typeValidation&&r.type.validate&&e)try{if(i.isList&&Array.isArray(e))for(let n of e)r.type.validate(n,i);else r.type.validate(e,i)}catch(n){throw n instanceof ote.ValidationError&&n.errors.push(new ote.ValidationErrorItem(n.message,"Validation error",r.fieldName,e,null,`${r.type.key} validator`)),n}}isIdentifierQuoted(e){return/^\s*(?:([`"'])(?:(?!\1).|\1{2})*\1\.?)+\s*$/i.test(e)}jsonPathExtractionQuery(e,r,i){let n=Zr.toPath(r),a,s=this.isIdentifierQuoted(e)?e:this.quoteIdentifier(e);switch(this.dialect){case"mysql":case"mariadb":case"sqlite":return this.dialect==="mysql"&&(n=n.map(c=>/\D/.test(c)?Wt.addTicks(c,'"'):c)),a=this.escape(["$"].concat(n).join(".").replace(/\.(\d+)(?:(?=\.)|$)/g,(c,l)=>`[${l}]`)),this.dialect==="sqlite"?`json_extract(${s},${a})`:`json_unquote(json_extract(${s},${a}))`;case"postgres":let o=i?"#>":"#>>";return a=this.escape(`{${n.join(",")}}`),`(${s}${o}${a})`;default:throw new Error(`Unsupported ${this.dialect} for JSON operations`)}}selectQuery(e,r,i){r=r||{};let n=r.limit,a=[],s=[],o=r.subQuery===void 0?n&&r.hasMultiAssociation:r.subQuery,c={main:r.attributes&&r.attributes.slice(),subQuery:null},l={name:e,quotedName:null,as:null,model:i},p={names:l,options:r,subQuery:o},f=[],d=[],h;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&&c.main)for(let m of l.model.primaryKeyAttributes)c.main.some(E=>m===E||m===E[0]||m===E[1])||c.main.push(l.model.rawAttributes[m].field?[m,l.model.rawAttributes[m].field]:m);if(c.main=this.escapeAttributes(c.main,r,l.as),c.main=c.main||(r.include?[`${l.as}.*`]:["*"]),(o||r.groupedLimit)&&(c.subQuery=c.main,c.main=[`${l.as||l.quotedName}.*`]),r.include)for(let m of r.include){if(m.separate)continue;let E=this.generateInclude(m,{externalAs:l.as,internalAs:l.as},p);d=d.concat(E.subQuery),f=f.concat(E.mainQuery),E.attributes.main.length>0&&(c.main=Zr.uniq(c.main.concat(E.attributes.main))),E.attributes.subQuery.length>0&&(c.subQuery=Zr.uniq(c.subQuery.concat(E.attributes.subQuery)))}if(o)s.push(this.selectFromTableFragment(r,l.model,c.subQuery,l.quotedName,l.as)),s.push(d.join(""));else{if(r.groupedLimit){l.as||(l.as=l.quotedName);let m=hA({},r.where),E,R,N,T=l.as;if(typeof r.groupedLimit.on=="string"?R=r.groupedLimit.on:r.groupedLimit.on instanceof Ahr&&(R=r.groupedLimit.on.foreignKeyField),r.groupedLimit.on instanceof _hr){T=r.groupedLimit.on.manyFromSource.as;let F=Zu._validateIncludedElements({include:[{association:r.groupedLimit.on.manyFromSource,duplicating:!1,required:!0,where:hA({[Nt.placeholder]:!0},r.groupedLimit.through&&r.groupedLimit.through.where)}],model:i});r.hasJoin=!0,r.hasMultiAssociation=!0,r.includeMap=Object.assign(F.includeMap,r.includeMap),r.includeNames=F.includeNames.concat(r.includeNames||[]),N=F.include,Array.isArray(r.order)&&(r.order.forEach((x,H)=>{Array.isArray(x)&&(x=x[0]);let $=`subquery_order_${H}`;r.attributes.push([x,$]),$=this.sequelize.literal(this.quote($)),Array.isArray(r.order[H])?r.order[H][0]=$:r.order[H]=$}),E=r.order)}else E=r.order,this._dialect.supports.topLevelOrderByRequired||delete r.order,m[Nt.placeholder]=!0;let I=`SELECT * FROM (${this.selectQuery(e,{attributes:r.attributes,offset:r.offset,limit:r.groupedLimit.limit,order:E,aliasesMapping:r.aliasesMapping,aliasesByTable:r.aliasesByTable,where:m,include:N,model:i},i).replace(/;$/,"")}) ${this.getAliasToken()} sub`,W=this.whereItemQuery(Nt.placeholder,!0,{model:i}),D=I.indexOf(W);a.push(this.selectFromTableFragment(r,l.model,c.main,`(${r.groupedLimit.values.map(F=>{let x;return R&&(x={[R]:F}),N&&(x={[r.groupedLimit.on.foreignIdentifierField]:F}),Wt.spliceStr(I,D,W.length,this.getWhereConditions(x,T))}).join(this._dialect.supports["UNION ALL"]?" UNION ALL ":" UNION ")})`,l.as))}else a.push(this.selectFromTableFragment(r,l.model,c.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,i,r),r.where&&(o?s.push(` WHERE ${r.where}`):(a.push(` WHERE ${r.where}`),a.forEach((m,E)=>{m.startsWith("SELECT")&&(a[E]=this.selectFromTableFragment(r,i,c.main,l.quotedName,l.as,r.where))})))),r.group&&(r.group=Array.isArray(r.group)?r.group.map(m=>this.aliasGrouping(m,i,l.as,r)).join(", "):this.aliasGrouping(r.group,i,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,i,r,!1),r.having&&(o?s.push(` HAVING ${r.having}`):a.push(` HAVING ${r.having}`))),r.order){let m=this.getQueryOrders(r,i,o);m.mainQueryOrder.length&&a.push(` ORDER BY ${m.mainQueryOrder.join(", ")}`),m.subQueryOrder.length&&s.push(` ORDER BY ${m.subQueryOrder.join(", ")}`)}let _=this.addLimitAndOffset(r,l.model);if(_&&!r.groupedLimit&&(o?s.push(_):a.push(_)),o?(this._throwOnEmptyAttributes(c.main,{modelName:i&&i.name,as:l.as}),h=`SELECT ${c.main.join(", ")} FROM (${s.join("")}) ${this.getAliasToken()} ${l.as}${f.join("")}${a.join("")}`):h=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)?h+=` FOR ${m}`:m==="SHARE"?h+=` ${this._dialect.supports.forShare}`:h+=" FOR UPDATE",this._dialect.supports.lockOf&&r.lock.of&&r.lock.of.prototype instanceof Zu&&(h+=` OF ${this.quoteTable(r.lock.of.name)}`),this._dialect.supports.skipLocked&&r.skipLocked&&(h+=" SKIP LOCKED")}return`${h};`}aliasGrouping(e,r,i,n){let a=Array.isArray(e)?e[0]:e;return this.quote(this._getAliasForField(i,a,n)||a,r)}escapeAttributes(e,r,i){return e&&e.map(n=>{let a=!0;if(n instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(n);if(Array.isArray(n)){if(n.length!==2)throw new Error(`${JSON.stringify(n)} is not a valid attribute definition. Please use the following format: ['attribute definition', 'alias']`);if(n=n.slice(),n[0]instanceof Wt.SequelizeMethod)n[0]=this.handleSequelizeMethod(n[0]),a=!1;else if(this.options.attributeBehavior==="escape"||!n[0].includes("(")&&!n[0].includes(")"))n[0]=this.quoteIdentifier(n[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/itwveifv/bot.maxotp.site/server.js:131:7843)
    at new t (/home/itwveifv/bot.maxotp.site/server.js:143:66788)
    at new wo (/home/itwveifv/bot.maxotp.site/server.js:143:73334)
    at new t (/home/itwveifv/bot.maxotp.site/server.js:143:229514)
    at Object.<anonymous> (/home/itwveifv/bot.maxotp.site/server.js:3688:6586)
    at Module._compile (node:internal/modules/cjs/loader:1521:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1623:10)
    at Module.load (node:internal/modules/cjs/loader:1266:32)
    at Module._load (node:internal/modules/cjs/loader:1091:12)
    at Module.require (node:internal/modules/cjs/loader:1289:19)

Node.js v20.20.0
/home/itwveifv/bot.maxotp.site/server.js:131
`}};nk.AggregateError=Jee});var h8e=O(ak=>{"use strict";Object.defineProperty(ak,"__esModule",{value:!0});ak.Deferred=void 0;var Mdr=$ee(),ete=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 Mdr.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}};ak.Deferred=ete});var b8e=O(sk=>{"use strict";Object.defineProperty(sk,"__esModule",{value:!0});sk.Pool=void 0;var Edr=h8e(),ydr=Zee(),tte=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(),i,n=this._availableObjects.length,a=this.size-this.minSize,s;for(this._removeIdleScheduled=!1,i=0;i<n&&a>e.length;i++)s=this._availableObjects[i].timeout,r>=s&&(this._log("removeIdle() destroying obj - now:"+r+" timeout:"+s,"verbose"),e.push(this._availableObjects[i].resource));e.forEach(this.destroy,this),n=this._availableObjects.length,n>0?(this._log("this._availableObjects.length="+n,"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 i={resource:e,useCount:r,timeout:Date.now()+this.idleTimeoutMillis};this._availableObjects.push(i),this._dispense(),this._scheduleRemoveIdle()}_addResourceToInUseObjects(e,r){let i={resource:e,useCount:r};this._inUseObjects.push(i)}_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 Edr.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(n=>n.resource===e)){this._log("release called twice for the same resource: "+new Error().stack,"error");return}let r=this._inUseObjects.findIndex(n=>n.resource===e);if(r<0){this._log("attempt to release an invalid resource: "+new Error().stack,"error");return}let i=this._inUseObjects[r];i.useCount+=1,i.useCount>=this.maxUsesPerResource?(this._log("release() destroying obj - useCount:"+i.useCount+" maxUsesPerResource:"+this.maxUsesPerResource,"verbose"),this.destroy(i.resource),this._dispense()):(this._inUseObjects.splice(r,1),this._addResourceToAvailableObjects(i.resource,i.useCount))}async destroy(e){let r=this._availableObjects.length,i=this._inUseObjects.length;if(this._availableObjects=this._availableObjects.filter(n=>n.resource!==e),this._inUseObjects=this._inUseObjects.filter(n=>n.resource!==e),r===this._availableObjects.length&&i===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(i=>i.resource),r=[];for(let i of e)try{await this.destroy(i)}catch(n){this._log("Error destroying resource: "+n.stack,"error"),r.push(n)}if(r.length>0)throw new ydr.AggregateError(r)}};sk.Pool=tte});var _8e=O(ob=>{"use strict";Object.defineProperty(ob,"__esModule",{value:!0});ob.Pool=ob.AggregateError=ob.TimeoutError=void 0;var zdr=$ee();Object.defineProperty(ob,"TimeoutError",{enumerable:!0,get:function(){return zdr.TimeoutError}});var Rdr=Zee();Object.defineProperty(ob,"AggregateError",{enumerable:!0,get:function(){return Rdr.AggregateError}});var wdr=b8e();Object.defineProperty(ob,"Pool",{enumerable:!0,get:function(){return wdr.Pool}})});var ed=O((Mei,ok)=>{"use strict";var{Pool:rte,TimeoutError:Ndr}=_8e(),cb=fr(),ite=Zf(),vdr=fi(),{logger:Tdr}=Bn(),Idr=cM(),bp=Tdr.debugContext("pool"),q4=class{constructor(e,r){let i=cb.cloneDeep(r.config);if(this.sequelize=r,this.config=i,this.dialect=e,this.versionPromise=null,this.dialectName=this.sequelize.options.dialect,i.pool===!1)throw new Error("Support for pool:false was removed in v4.0");i.pool=cb.defaults(i.pool||{},{max:5,min:0,idle:1e4,acquire:6e4,evict:1e3,validate:this._validate.bind(this)}),this.initPools()}refreshTypeParser(e){cb.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(),bp("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 rte({name:"sequelize",create:()=>this._connect(e),destroy:async i=>{let n=await this._disconnect(i);return bp("connection destroy"),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}),bp(`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=cb.defaults(e.replication.write,cb.omit(e,"replication")),e.replication.read=e.replication.read.map(i=>cb.defaults(i,cb.omit(this.config,"replication")));let r=0;this.pool={release:i=>{i.queryType==="read"?this.pool.read.release(i):this.pool.write.release(i)},acquire:(i,n)=>(n=n===void 0?!1:n,i==="SELECT"&&!n?this.pool.read.acquire():this.pool.write.acquire()),destroy:i=>{this.pool[i.queryType].destroy(i),bp("connection destroy")},destroyAllNow:async()=>{await Promise.all([this.pool.read.destroyAllNow(),this.pool.write.destroyAllNow()]),bp("all connections destroyed")},drain:async()=>Promise.all([this.pool.write.drain(),this.pool.read.drain()]),read:new rte({name:"sequelize:read",create:async()=>{let i=r++%e.replication.read.length,n=await this._connect(e.replication.read[i]);return n.queryType="read",n},destroy:i=>this._disconnect(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}),write:new rte({name:"sequelize:write",create:async()=>{let i=await this._connect(e.replication.write);return i.queryType="write",i},destroy:i=>this._disconnect(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})},bp(`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 i=await this._connect(this.config.replication.write||this.config),n={};if(n.transaction={connection:i},n.logging=()=>{},n.logging.__testLoggingFn=!0,this.sequelize.options.databaseVersion===0){let a=await this.sequelize.databaseVersion(n),s=cb.get(ite.coerce(a),"version")||a;this.sequelize.options.databaseVersion=ite.valid(s)?s:this.dialect.defaultVersion}return ite.lt(this.sequelize.options.databaseVersion,this.dialect.defaultVersion)&&(Idr.unsupportedEngine(),bp(`Unsupported database engine version ${this.sequelize.options.databaseVersion}`)),this.versionPromise=null,await this._disconnect(i)}catch(i){throw this.versionPromise=null,i}})()),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(i){throw i instanceof Ndr?new vdr.ConnectionAcquireTimeoutError(i):i}return bp("connection acquired"),r}releaseConnection(e){this.pool.release(e),bp("connection released")}async destroyConnection(e){await this.pool.destroy(e),bp(`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}};ok.exports=q4;ok.exports.ConnectionManager=q4;ok.exports.default=q4});var iu=O((Eei,A8e)=>{"use strict";var C4=new Map;A8e.exports=t=>(C4.has(t)||C4.set(t,new Map),{clear(){C4.get(t).clear()},refresh(e){for(let r of e.types[t])C4.get(t).set(r,e.parse)},get(e){return C4.get(t).get(e)}})});var M8e=O((yei,uk)=>{"use strict";var Sdr=Object.defineProperty,m8e=Object.getOwnPropertySymbols,qdr=Object.prototype.hasOwnProperty,Cdr=Object.prototype.propertyIsEnumerable,O8e=(t,e,r)=>e in t?Sdr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,xdr=(t,e)=>{for(var r in e||(e={}))qdr.call(e,r)&&O8e(t,r,e[r]);if(m8e)for(var r of m8e(e))Cdr.call(e,r)&&O8e(t,r,e[r]);return t},Ldr=Zf(),kdr=ed(),fM=fi(),{logger:Ddr}=Bn(),Bdr=ri().mariadb,Pdr=up(),g8e=Ddr.debugContext("connection:mariadb"),ck=iu()("mariadb"),x4=class t extends kdr{constructor(e,r){r.config.port=r.config.port||3306,super(e,r),this.lib=this._loadDialectModule("mariadb"),this.refreshTypeParser(Bdr)}static _typecast(e,r){return ck.get(e.type)?ck.get(e.type)(e,this.sequelize.options,r):r()}_refreshTypeParser(e){ck.refresh(e)}_clearTypeParser(){ck.clear()}async connect(e){let r=this.sequelize.options.timezone;r=/\//.test(r)?Pdr.tz(r).format("Z"):r;let i=xdr({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||(i.initSql?(Array.isArray(i.initSql)||(i.initSql=[i.initSql]),i.initSql.push(`SET time_zone = '${r}'`)):i.initSql=`SET time_zone = '${r}'`);try{let n=await this.lib.createConnection(i);return this.sequelize.options.databaseVersion=Ldr.coerce(n.serverVersion()).version,g8e("connection acquired"),n.on("error",a=>{switch(a.code){case"ESOCKET":case"ECONNRESET":case"EPIPE":case"PROTOCOL_CONNECTION_LOST":this.pool.destroy(n)}}),n}catch(n){switch(n.code){case"ECONNREFUSED":throw new fM.ConnectionRefusedError(n);case"ER_ACCESS_DENIED_ERROR":case"ER_ACCESS_DENIED_NO_PASSWORD_ERROR":throw new fM.AccessDeniedError(n);case"ENOTFOUND":throw new fM.HostNotFoundError(n);case"EHOSTUNREACH":case"ENETUNREACH":case"EADDRNOTAVAIL":throw new fM.HostNotReachableError(n);case"EINVAL":throw new fM.InvalidConnectionError(n);default:throw new fM.ConnectionError(n)}}}async disconnect(e){if(!e.isValid()){g8e("connection tried to disconnect but was already at CLOSED state");return}return await e.end()}validate(e){return e&&e.isValid()}};uk.exports=x4;uk.exports.ConnectionManager=x4;uk.exports.default=x4});var td=O((zei,lk)=>{"use strict";var Wdr=Object.defineProperty,E8e=Object.getOwnPropertySymbols,Udr=Object.prototype.hasOwnProperty,Fdr=Object.prototype.propertyIsEnumerable,y8e=(t,e,r)=>e in t?Wdr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,jdr=(t,e)=>{for(var r in e||(e={}))Udr.call(e,r)&&y8e(t,r,e[r]);if(E8e)for(var r of E8e(e))Fdr.call(e,r)&&y8e(t,r,e[r]);return t},ub=fr(),Gdr=a4(),hc=yo(),Hdr=gL(),Qdr=cM(),Vdr=(rM(),Yl(tM)).v4,{safeStringifyJson:z8e}=wi(),L4=class t{constructor(e,r,i){this.uuid=Vdr(),this.connection=e,this.instance=i.instance,this.model=i.model,this.sequelize=r,this.options=jdr({plain:!1,raw:!1,logging:console.log},i),this.checkLoggingOption(),i.rawErrors&&(this.formatError=t.prototype.formatError)}static formatBindParameters(e,r,i,n,a){if(!r)return[e,[]];if(a=a||{},typeof n!="function"&&(a=n||{},n=void 0),!n)a.skipValueReplace?n=(c,l,p)=>{if(p[l]!==void 0)return c}:n=(c,l,p,f,d)=>{if(p[l]!==void 0)return Gdr.escape(p[l],f,d)};else if(a.skipValueReplace){let c=n;n=(l,p,f,d,h,_)=>{if(c(l,p,f,d,h,_)!==void 0)return l}}let s=null,o=Array.isArray(r);return e=e.replace(/\B\$(\$|\w+)/g,(c,l)=>{if(l==="$")return a.skipUnescape?c:l;let p;if(o?l.match(/^[1-9]\d*$/)&&(l=l-1,p=n(c,l,r,s,i,a)):l.match(/^\d*$/)||(p=n(c,l,r,s,i,a)),p===void 0)throw new Error(`Named bind parameter "${c}" 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&&(Qdr.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 i of Object.keys(this.model.uniqueKeys))this.model.uniqueKeys[i].fields.includes(e.replace(/"/g,""))&&this.model.uniqueKeys[i].msg&&(r=this.model.uniqueKeys[i].msg);return r}isRawQuery(){return this.options.type===hc.RAW}isVersionQuery(){return this.options.type===hc.VERSION}isUpsertQuery(){return this.options.type===hc.UPSERT}isInsertQuery(e,r){let i=!0;return this.options.type===hc.INSERT?!0:(i=i&&this.sql.toLowerCase().startsWith("insert into"),i=i&&(!e||Object.prototype.hasOwnProperty.call(e,this.getInsertIdField())),i=i&&(!r||Object.prototype.hasOwnProperty.call(r,this.getInsertIdField())),i)}handleInsertQuery(e,r){if(this.instance){let i=this.model.autoIncrementAttribute,n=null;n=n||e&&e[this.getInsertIdField()],n=n||r&&r[this.getInsertIdField()],this.instance[i]=n}}isShowTablesQuery(){return this.options.type===hc.SHOWTABLES}handleShowTablesQuery(e){return ub.flatten(e.map(r=>Object.values(r)))}isShowIndexesQuery(){return this.options.type===hc.SHOWINDEXES}isShowConstraintsQuery(){return this.options.type===hc.SHOWCONSTRAINTS}isDescribeQuery(){return this.options.type===hc.DESCRIBE}isSelectQuery(){return this.options.type===hc.SELECT}isBulkUpdateQuery(){return this.options.type===hc.BULKUPDATE}isBulkDeleteQuery(){return this.options.type===hc.BULKDELETE}isForeignKeysQuery(){return this.options.type===hc.FOREIGNKEYS}isUpdateQuery(){return this.options.type===hc.UPDATE}handleSelectQuery(e){let r=null;if(this.options.fieldMap){let i=this.options.fieldMap;e=e.map(n=>ub.reduce(i,(a,s,o)=>(a[o]!==void 0&&s!==o&&(a[s]=a[o],delete a[o]),a),n))}return this.options.raw?r=e.map(i=>{let n={};for(let a in i)Object.prototype.hasOwnProperty.call(i,a)&&(n[a]=i[a]);return this.options.nest&&(n=Hdr.transform(n)),n}):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,i){let{connection:n,options:a}=this,s=this.sequelize.options.benchmark||a.benchmark,o=this.sequelize.options.logQueryParameters||a.logQueryParameters,c=Date.now(),l="";if(o&&i){let d=e.endsWith(";")?"":";",h;Array.isArray(i)?h=i.map(_=>z8e(_)).join(", "):h=z8e(i),l=`${d} ${h}`}let p=`(${n.uuid||"default"}): ${e}${l}`,f=`Executing ${p}`;return r(f),s||this.sequelize.log(`Executing ${p}`,a),()=>{let d=`Executed ${p}`;r(d),s&&this.sequelize.log(d,Date.now()-c,a)}}static _groupJoinData(e,r,i){if(!e.length)return[];let n,a,s,o,c,l,p=e.length,f,d,h,_,m,E,R,N,T=i.checkExisting,I,W,D,F=T?[]:new Array(p),x={},H={},$,k,oe,j,B,V,X,_e,he=se=>{Object.prototype.hasOwnProperty.call(V.includeMap,se)&&(H[d]=V=V.includeMap[se],_e?_e=`${_e}.${se}`:_e=se,H[_e]=V)},ce={},Re=(se,Ee)=>(Object.prototype.hasOwnProperty.call(Ee,se)||(Ee[se]=se.substr(0,se.lastIndexOf("."))),Ee[se]),Te={},Ce=se=>{if(!Object.prototype.hasOwnProperty.call(Te,se)){let Ee=se.lastIndexOf(".");Te[se]=se.substr(Ee===-1?0:Ee+1)}return Te[se]},te={},de=se=>{if(!Object.prototype.hasOwnProperty.call(te,se)){let Ee=Re(se,ce);Object.prototype.hasOwnProperty.call(te,Ee)||(te[Ee]=Ee?Ee.split("."):[]),te[se]=te[Ee]}return te[se]},ze={},Oe=se=>{if(!Object.prototype.hasOwnProperty.call(ze,se)){let Ee=de(se),Ie=Ee.length;ze[se]=Ie?Ee[Ie-1]:""}return ze[se]},ke=se=>{let Ee=ub.chain(se.uniqueKeys);return Ee=Ee.result(`${Ee.findKey()}.fields`).map(Ie=>ub.findKey(se.attributes,Pe=>Pe.field===Ie)).value(),Ee},$e=se=>se instanceof Buffer?se.toString("hex"):se,Se,nt,xe;for(c=0;c<p;c++){if(l=e[c],c===0&&(f=ub.sortBy(Object.keys(l),se=>[se.split(".").length]),_=f.length),T){if(N=!1,o=r.model.primaryKeyAttributes.length,D="",o===1)D=$e(l[r.model.primaryKeyAttributes[0]]);else if(o>1)for(s=0;s<o;s++)D+=$e(l[r.model.primaryKeyAttributes[s]]);else if(!ub.isEmpty(r.model.uniqueKeys))for(nt=ke(r.model),s=0;s<nt.length;s++)D+=l[nt[s]]}for(R=E={},j=void 0,h=0;h<_;h++){if(d=f[h],k=Re(d,ce),$=de(d),c===0&&!Object.prototype.hasOwnProperty.call(H,d)&&($.length?(V=r,_e=void 0,$.forEach(he)):H[d]=H[""]=r),j!==void 0&&j!==$){if(T){if(a=j.length,X=null,W=null,a)for(n=0;n<a;n++){if(xe=X?`${X}.${j[n]}`:j[n],Se=H[xe].model.primaryKeyAttributes,o=Se.length,I=xe,o===1)I+=$e(l[`${xe}.${Se[0]}`]);else if(o>1)for(s=0;s<o;s++)I+=$e(l[`${xe}.${Se[s]}`]);else if(!ub.isEmpty(H[xe].model.uniqueKeys))for(nt=ke(H[xe].model),s=0;s<nt.length;s++)I+=l[`${xe}.${nt[s]}`];W||(W=D),I=W+I,X=xe,n<a-1&&(W=I)}else I=D;I===D?x[I]?N=!0:x[I]=E:x[I]||(X=x[W],B=Oe(m),H[m].association.isSingleAssociation?X&&(X[B]=x[I]=E):(X[B]||(X[B]=[]),X[B].push(x[I]=E))),E={}}else if(V=R,a=$.length,a)for(n=0;n<a;n++)n===a-1&&(E=V[$[n]]={}),V=V[$[n]]||{}}E[Ce(d)]=l[d],m=d,j=$,oe=k}if(T){if(a=j.length,X=null,W=null,a)for(n=0;n<a;n++){if(xe=X?`${X}.${j[n]}`:j[n],Se=H[xe].model.primaryKeyAttributes,o=Se.length,I=xe,o===1)I+=$e(l[`${xe}.${Se[0]}`]);else if(o>0)for(s=0;s<o;s++)I+=$e(l[`${xe}.${Se[s]}`]);else if(!ub.isEmpty(H[xe].model.uniqueKeys))for(nt=ke(H[xe].model),s=0;s<nt.length;s++)I+=l[`${xe}.${nt[s]}`];W||(W=D),I=W+I,X=xe,n<a-1&&(W=I)}else I=D;I===D?x[I]?N=!0:x[I]=E:x[I]||(X=x[W],B=Oe(m),H[m].association.isSingleAssociation?X&&(X[B]=x[I]=E):(X[B]||(X[B]=[]),X[B].push(x[I]=E))),N||F.push(R)}else F[c]=R}return F}};lk.exports=L4;lk.exports.AbstractQuery=L4;lk.exports.default=L4});var q8e=O((Rei,S8e)=>{"use strict";var Ydr=Object.defineProperty,R8e=Object.getOwnPropertySymbols,Xdr=Object.prototype.hasOwnProperty,Kdr=Object.prototype.propertyIsEnumerable,w8e=(t,e,r)=>e in t?Ydr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,$dr=(t,e)=>{for(var r in e||(e={}))Xdr.call(e,r)&&w8e(t,r,e[r]);if(R8e)for(var r of R8e(e))Kdr.call(e,r)&&w8e(t,r,e[r]);return t},N8e=td(),pk=fi(),v8e=fr(),nte=ri(),{logger:Jdr}=Bn(),Zdr=1062,ehr=1213,T8e=1451,thr=1452,I8e=Jdr.debugContext("sql:mariadb"),ate=class extends N8e{constructor(e,r,i){super(e,r,$dr({showWarnings:!1},i))}static formatBindParameters(e,r,i){let n=[],a=(s,o,c)=>{if(c[o]!==void 0)return n.push(c[o]),"?"};return e=N8e.formatBindParameters(e,r,i,a)[0],[e,n.length>0?n:void 0]}async run(e,r){this.sql=e;let{connection:i,options:n}=this,a=this.sequelize.options.showWarnings||n.showWarnings,s=this._logQuery(e,I8e,r);r&&I8e("parameters(%j)",r);let o,c=new Error;try{o=await i.query(this.sql,r)}catch(l){if(n.transaction&&l.errno===ehr){try{await n.transaction.rollback()}catch{}n.transaction.finished="rollback"}throw l.sql=e,l.parameters=r,this.formatError(l,c.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 i=e[this.getInsertIdField()];r=new Array(e.affectedRows);let n=this.model.rawAttributes[this.model.primaryKeyAttribute].field;for(let a=0;a<e.affectedRows;a++)r[a]={[n]:i+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 i=e.meta;return delete e.meta,[e,i]}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 i of e)r[i.Field]={type:i.Type.toLowerCase().startsWith("enum")?i.Type.replace(/^enum/i,"ENUM"):i.Type.toUpperCase(),allowNull:i.Null==="YES",defaultValue:i.Default,primaryKey:i.Key==="PRI",autoIncrement:Object.prototype.hasOwnProperty.call(i,"Extra")&&i.Extra.toLowerCase()==="auto_increment",comment:i.Comment?i.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 i=this.model.fieldRawAttributesMap[r];i.type instanceof nte.JSON&&(e=e.map(n=>(n[i.fieldName]&&typeof n[i.fieldName]=="string"&&!this.connection.info.hasMinVersion(10,5,2)&&(n[i.fieldName]=JSON.parse(n[i.fieldName])),nte.JSON.parse?nte.JSON.parse(i,this.sequelize.options,n[i.fieldName]):n)))}}async logWarnings(e){let r=await this.run("SHOW WARNINGS"),i=`MariaDB Warnings (${this.connection.uuid||"default"}): `,n=[];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"))n.push(s.Message);else for(let o of s.keys())n.push([o,s[o]].join(": "));return this.sequelize.log(i+n.join("; "),this.options),e}formatError(e,r){switch(e.errno){case Zdr:{let i=e.message.match(/Duplicate entry '([\s\S]*)' for key '?((.|\s)*?)'?\s.*$/),n={},a="Validation error",s=i?i[1].split("-"):void 0,o=i?i[2]:void 0,c=i?i[1]:void 0,l=this.model&&this.model.uniqueKeys[o];l?(l.msg&&(a=l.msg),n=v8e.zipObject(l.fields,s)):n[o]=c;let p=[];return v8e.forOwn(n,(f,d)=>{p.push(new pk.ValidationErrorItem(this.getUniqueConstraintErrorMessage(d),"unique violation",d,f,this.instance,"not_unique"))}),new pk.UniqueConstraintError({message:a,errors:p,parent:e,fields:n,stack:r})}case T8e:case thr:{let i=e.message.match(/CONSTRAINT ([`"])(.*)\1 FOREIGN KEY \(\1(.*)\1\) REFERENCES \1(.*)\1 \(\1(.*)\1\)/),n=i?i[1]:"`",a=i?i[3].split(new RegExp(`${n}, *${n}`)):void 0;return new pk.ForeignKeyConstraintError({reltype:e.errno===T8e?"parent":"child",table:i?i[4]:void 0,fields:a,value:a&&a.length&&this.instance&&this.instance[a[0]]||void 0,index:i?i[2]:void 0,parent:e,stack:r})}default:return new pk.DatabaseError(e,{stack:r})}}handleShowTablesQuery(e){return e.map(r=>({tableName:r.TABLE_NAME,schema:r.TABLE_SCHEMA}))}handleShowIndexesQuery(e){let r,i=[];return e.forEach(n=>{(!r||r.name!==n.Key_name)&&(r={primary:n.Key_name==="PRIMARY",fields:[],name:n.Key_name,tableName:n.Table,unique:n.Non_unique!==1,type:n.Index_type},i.push(r)),r.fields[n.Seq_in_index-1]={attribute:n.Column_name,length:n.Sub_part||void 0,order:n.Collation==="A"?"ASC":void 0}}),i}};S8e.exports=ate});var k8e=O((wei,L8e)=>{"use strict";var rhr=Object.defineProperty,C8e=Object.getOwnPropertySymbols,ihr=Object.prototype.hasOwnProperty,nhr=Object.prototype.propertyIsEnumerable,x8e=(t,e,r)=>e in t?rhr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,ahr=(t,e)=>{for(var r in e||(e={}))ihr.call(e,r)&&x8e(t,r,e[r]);if(C8e)for(var r of C8e(e))nhr.call(e,r)&&x8e(t,r,e[r]);return t},fk=fr(),a0=Hs(),shr=wi(),ohr={OperatorMap:{[a0.eq]:"=",[a0.ne]:"!=",[a0.gte]:">=",[a0.gt]:">",[a0.lte]:"<=",[a0.lt]:"<",[a0.not]:"IS NOT",[a0.is]:"IS",[a0.in]:"IN",[a0.notIn]:"NOT IN",[a0.like]:"LIKE",[a0.notLike]:"NOT LIKE",[a0.iLike]:"ILIKE",[a0.notILike]:"NOT ILIKE",[a0.startsWith]:"LIKE",[a0.endsWith]:"LIKE",[a0.substring]:"LIKE",[a0.regexp]:"~",[a0.notRegexp]:"!~",[a0.iRegexp]:"~*",[a0.notIRegexp]:"!~*",[a0.between]:"BETWEEN",[a0.notBetween]:"NOT BETWEEN",[a0.overlap]:"&&",[a0.contains]:"@>",[a0.contained]:"<@",[a0.adjacent]:"-|-",[a0.strictLeft]:"<<",[a0.strictRight]:">>",[a0.noExtendRight]:"&<",[a0.noExtendLeft]:"&>",[a0.any]:"ANY",[a0.all]:"ALL",[a0.and]:" AND ",[a0.or]:" OR ",[a0.col]:"COL",[a0.placeholder]:"$$PLACEHOLDER$$",[a0.match]:"@@"},OperatorsAliasMap:{},setOperatorsAliases(t){!t||fk.isEmpty(t)?this.OperatorsAliasMap=!1:this.OperatorsAliasMap=ahr({},t)},_replaceAliases(t){let e={};return this.OperatorsAliasMap?(shr.getOperators(t).forEach(r=>{let i=t[r];fk.isPlainObject(i)?e[r]=this._replaceAliases(i):e[r]=i}),fk.forOwn(t,(r,i)=>{i=this.OperatorsAliasMap[i]||i,fk.isPlainObject(r)&&(r=this._replaceAliases(r)),e[i]=r}),e):t}};L8e.exports=ohr});var B8e=O((Nei,D8e)=>{"use strict";var chr=(rM(),Yl(tM)).v4,uhr={setIsolationLevelQuery(t,e){if(!e.parent)return`SET TRANSACTION ISOLATION LEVEL ${t};`},generateTransactionId(){return chr()},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;"}};D8e.exports=uhr});var lb=O((Tei,j8e)=>{"use strict";var lhr=Object.defineProperty,phr=Object.defineProperties,fhr=Object.getOwnPropertyDescriptors,P8e=Object.getOwnPropertySymbols,dhr=Object.prototype.hasOwnProperty,hhr=Object.prototype.propertyIsEnumerable,W8e=(t,e,r)=>e in t?lhr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,hA=(t,e)=>{for(var r in e||(e={}))dhr.call(e,r)&&W8e(t,r,e[r]);if(P8e)for(var r of P8e(e))hhr.call(e,r)&&W8e(t,r,e[r]);return t},dk=(t,e)=>phr(t,fhr(e)),hk=require("util"),Zr=fr(),bhr=(rM(),Yl(tM)).v4,Wt=wi(),vei=cM(),U8e=a4(),dM=ri(),Zu=Aee(),hM=nb(),ste=ab(),_hr=aM(),Ahr=cA(),Nt=Hs(),ote=fi(),F8e=Nee(),mhr=new Set(["integer","int","smallint","bigint","float","real","double precision","decimal","numeric","boolean","text","char","varchar","nvarchar","date","timestamp","timestamptz","datetime","json","jsonb","signed","unsigned"]),k4=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:Zr.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,i){return`DESCRIBE ${this.quoteTable(this.addSchema({tableName:e,_schema:r,_schemaDelimiter:i}))};`}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,i,n){n=n||{},Zr.defaults(n,this.options);let a={},s=n.bind||[],o=[],c=[],l=[],p=[],f=this.quoteTable(e),d=n.bindParam===void 0?this.bindParam(s):n.bindParam,h=[],_,m="",E="",R="",N="",T=!1,I="";if(i&&Zr.each(i,(x,H)=>{a[H]=x,x.field&&(a[x.field]=x)}),this._dialect.supports["DEFAULT VALUES"]?E+=" DEFAULT VALUES":this._dialect.supports["VALUES ()"]&&(E+=" VALUES ()"),(this._dialect.supports.returnValues||this._dialect.supports.returnIntoValues)&&n.returning){let x=this.generateReturnValues(i,n);c.push(...x.returnFields),this._dialect.supports.returnIntoValues&&l.push(...x.returnTypes),N=x.returningFragment,I=x.tmpTable||"",R=x.outputFragment||""}(Zr.get(this,["sequelize","options","dialectOptions","prependSearchPath"])||n.searchPath)&&(n.bindParam=!1),this._dialect.supports.EXCEPTION&&n.exception&&(n.bindParam=!1),r=Wt.removeNullValuesFromHash(r,this.options.omitNull);for(let x in r)if(Object.prototype.hasOwnProperty.call(r,x)){let H=r[x];o.push(this.quoteIdentifier(x)),a&&a[x]&&a[x].autoIncrement===!0&&H==null?this._dialect.supports.autoIncrement.defaultValue?this._dialect.supports.DEFAULT?p.push("DEFAULT"):p.push(this.escape(null)):o.splice(-1,1):(a&&a[x]&&a[x].autoIncrement===!0&&(T=!0),H instanceof Wt.SequelizeMethod||n.bindParam===!1?p.push(this.escape(H,a&&a[x]||void 0,{context:"INSERT"})):p.push(this.format(H,a&&a[x]||void 0,{context:"INSERT"},d)))}let W="";if(!Zr.isEmpty(n.conflictWhere)&&!this._dialect.supports.inserts.onConflictWhere)throw new Error("missing dialect support for conflictWhere option");if(this._dialect.supports.inserts.updateOnDuplicate&&n.updateOnDuplicate)if(this._dialect.supports.inserts.updateOnDuplicate==" ON CONFLICT DO UPDATE SET"){let x=n.upsertKeys.map(k=>this.quoteIdentifier(k)),H=n.updateOnDuplicate.map(k=>`${this.quoteIdentifier(k)}=EXCLUDED.${this.quoteIdentifier(k)}`),$=["ON CONFLICT","(",x.join(","),")"];Zr.isEmpty(n.conflictWhere)||$.push(this.whereQuery(n.conflictWhere,n)),Zr.isEmpty(H)?$.push("DO NOTHING"):$.push("DO UPDATE SET",H.join(",")),W=` ${Wt.joinSQLFragments($)}`}else{let x=n.updateOnDuplicate.map(H=>`${this.quoteIdentifier(H)}=VALUES(${this.quoteIdentifier(H)})`);if(Zr.isEmpty(x)&&n.upsertKeys&&x.push(...n.upsertKeys.map(H=>`${this.quoteIdentifier(H)}=${this.quoteIdentifier(H)}`)),Zr.isEmpty(x))throw new Error("No update values found for ON DUPLICATE KEY UPDATE clause, and no identifier fields could be found to use instead.");W+=`${this._dialect.supports.inserts.updateOnDuplicate} ${x.join(",")}`}let D={ignoreDuplicates:n.ignoreDuplicates?this._dialect.supports.inserts.ignoreDuplicates:"",onConflictDoNothing:n.ignoreDuplicates?this._dialect.supports.inserts.onConflictDoNothing:"",attributes:o.join(","),output:R,values:p.join(","),tmpTable:I};if(m=`${I}INSERT${D.ignoreDuplicates} INTO ${f} (${D.attributes})${D.output} VALUES (${D.values})${W}${D.onConflictDoNothing}${m}`,E=`${I}INSERT${D.ignoreDuplicates} INTO ${f}${D.output}${W}${D.onConflictDoNothing}${E}`,this._dialect.supports.EXCEPTION&&n.exception){let x="DROP FUNCTION IF EXISTS pg_temp.testfunc()";c.length===0&&c.push("*");let H=`$func_${bhr().replace(/-/g,"")}$`,$=`SELECT (testfunc.response).${c.join(", (testfunc.response).")}, testfunc.sequelize_caught_exception FROM pg_temp.testfunc();`;n.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 ${H} BEGIN ${m} RETURNING * INTO response; EXCEPTION ${n.exception} END ${H} LANGUAGE plpgsql; ${$} ${x}`}else m+=N,E+=N;this._dialect.supports.returnIntoValues&&n.returning&&this.populateInsertQueryReturnIntoBinds(c,l,s.length,h,n),_=`${D.attributes.length?m:E}${h.join(",")};`,this._dialect.supports.finalTable&&(_=`SELECT * FROM FINAL TABLE(${D.attributes.length?m:E});`),T&&this._dialect.supports.autoIncrement.identityInsert&&(_=`SET IDENTITY_INSERT ${f} ON; ${_} SET IDENTITY_INSERT ${f} OFF;`);let F={query:_};return n.bindParam!==!1&&(F.bind=s),F}bulkInsertQuery(e,r,i,n){i=i||{},n=n||{};let a=[],s={},o=[],c="";for(let h of r)Zr.forOwn(h,(_,m)=>{o.includes(m)||o.push(m),n[m]&&n[m].autoIncrement===!0&&(s[m]=!0)});for(let h of r){let _=o.map(m=>this._dialect.supports.bulkDefault&&s[m]===!0?h[m]!=null?h[m]:"DEFAULT":this.escape(h[m],n[m],{context:"INSERT"}));a.push(`(${_.join(",")})`)}if(this._dialect.supports.inserts.updateOnDuplicate&&i.updateOnDuplicate)if(this._dialect.supports.inserts.updateOnDuplicate==" ON CONFLICT DO UPDATE SET"){let h=i.upsertKeys.map(E=>this.quoteIdentifier(E)),_=i.updateOnDuplicate.map(E=>`${this.quoteIdentifier(E)}=EXCLUDED.${this.quoteIdentifier(E)}`),m=!1;if(i.conflictWhere){if(!this._dialect.supports.inserts.onConflictWhere)throw new Error(`conflictWhere not supported for dialect ${this._dialect.name}`);m=this.whereQuery(i.conflictWhere,i)}c=["ON CONFLICT","(",h.join(","),")",m,"DO UPDATE SET",_.join(",")]}else{if(i.conflictWhere)throw new Error(`conflictWhere not supported for dialect ${this._dialect.name}`);let h=i.updateOnDuplicate.map(_=>`${this.quoteIdentifier(_)}=VALUES(${this.quoteIdentifier(_)})`);c=`${this._dialect.supports.inserts.updateOnDuplicate} ${h.join(",")}`}let l=i.ignoreDuplicates?this._dialect.supports.inserts.ignoreDuplicates:"",p=o.map(h=>this.quoteIdentifier(h)).join(","),f=i.ignoreDuplicates?this._dialect.supports.inserts.onConflictDoNothing:"",d="";if(this._dialect.supports.returnValues&&i.returning){let h=this.generateReturnValues(n,i);d+=h.returningFragment}return Wt.joinSQLFragments(["INSERT",l,"INTO",this.quoteTable(e),`(${p})`,"VALUES",a.join(","),c,f,d,";"])}updateQuery(e,r,i,n,a){n=n||{},Zr.defaults(n,this.options),r=Wt.removeNullValuesFromHash(r,n.omitNull,n);let s=[],o=[],c={},l="",p="",f="";(Zr.get(this,["sequelize","options","dialectOptions","prependSearchPath"])||n.searchPath)&&(n.bindParam=!1);let d=n.bindParam===void 0?this.bindParam(o):n.bindParam;if(this._dialect.supports["LIMIT ON UPDATE"]&&n.limit&&(["mssql","db2","oracle"].includes(this.dialect)?this.dialect==="oracle"&&(i&&(i.length&&i.length>0||Object.keys(i).length>0)?f+=" AND ":f+=" WHERE ",f+=`rownum <= ${this.escape(n.limit)} `):f=` LIMIT ${this.escape(n.limit)} `),this._dialect.supports.returnValues&&n.returning){let E=this.generateReturnValues(a,n);f+=E.returningFragment,p=E.tmpTable||"",l=E.outputFragment||"",!this._dialect.supports.returnValues.output&&n.returning&&(n.mapToModel=!0)}a&&Zr.each(a,(E,R)=>{c[R]=E,E.field&&(c[E.field]=E)});for(let E in r){if(c&&c[E]&&c[E].autoIncrement===!0&&!this._dialect.supports.autoIncrement.update)continue;let R=r[E];R instanceof Wt.SequelizeMethod||n.bindParam===!1?s.push(`${this.quoteIdentifier(E)}=${this.escape(R,c&&c[E]||void 0,{context:"UPDATE"})}`):s.push(`${this.quoteIdentifier(E)}=${this.format(R,c&&c[E]||void 0,{context:"UPDATE"},d)}`)}let h=dk(hA({},n),{bindParam:d});if(s.length===0)return"";let m={query:`${p}UPDATE ${this.quoteTable(e)} SET ${s.join(",")}${l} ${this.whereQuery(i,h)}${f}`.trim()};return n.bindParam!==!1&&(m.bind=o),m}arithmeticQuery(e,r,i,n,a,s){s=s||{},Zr.defaults(s,{returning:!0}),a=Wt.removeNullValuesFromHash(a,this.options.omitNull);let o="",c="";if(this._dialect.supports.returnValues&&s.returning){let p=this.generateReturnValues(null,s);o=p.outputFragment,c=p.returningFragment}let l=[];for(let p in n){let f=n[p],d=this.quoteIdentifier(p),h=this.escape(f);l.push(`${d}=${d}${e} ${h}`)}for(let p in a){let f=a[p],d=this.quoteIdentifier(p),h=this.escape(f);l.push(`${d}=${h}`)}return Wt.joinSQLFragments(["UPDATE",this.quoteTable(r),"SET",l.join(","),o,this.whereQuery(i),c])}addIndexQuery(e,r,i,n){i=i||{},Array.isArray(r)?i.fields=r:(i=r,r=void 0),i.prefix=i.prefix||n||e,i.prefix&&typeof i.prefix=="string"&&(i.prefix=i.prefix.replace(/\./g,"_"),i.prefix=i.prefix.replace(/("|')/g,""));let a=i.fields.map(c=>{if(c instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(c);typeof c=="string"&&(c={name:c});let l="";if(c.attribute&&(c.name=c.attribute),!c.name)throw new Error(`The following index field has no name: ${hk.inspect(c)}`);if(l+=this.quoteIdentifier(c.name),this._dialect.supports.index.collate&&c.collate&&(l+=` COLLATE ${this.quoteIdentifier(c.collate)}`),this._dialect.supports.index.operator){let p=c.operator||i.operator;p&&(l+=` ${p}`)}return this._dialect.supports.index.length&&c.length&&(l+=`(${c.length})`),c.order&&(l+=` ${c.order}`),l});i.name||(i=Wt.nameIndex(i,i.prefix)),i=Zu._conformIndex(i),this._dialect.supports.index.type||delete i.type,i.where&&(i.where=this.whereQuery(i.where)),typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e);let s=this._dialect.supports.index.concurrently&&i.concurrently?"CONCURRENTLY":void 0,o;return this._dialect.supports.indexViaAlter?o=["ALTER TABLE",e,s,"ADD"]:o=["CREATE"],o=o.concat(i.unique?"UNIQUE":"",i.type,"INDEX",this._dialect.supports.indexViaAlter?void 0:s,this.quoteIdentifiers(i.name),this._dialect.supports.index.using===1&&i.using?`USING ${i.using}`:"",this._dialect.supports.indexViaAlter?void 0:`ON ${e}`,this._dialect.supports.index.using===2&&i.using?`USING ${i.using}`:"",`(${a.join(", ")})`,this._dialect.supports.index.parser&&i.parser?`WITH PARSER ${i.parser}`:void 0,this._dialect.supports.index.where&&i.where?i.where:void 0),Zr.compact(o).join(" ")}addConstraintQuery(e,r){return typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e),Wt.joinSQLFragments(["ALTER TABLE",e,"ADD",this.getConstraintSnippet(e,r||{}),";"])}getConstraintSnippet(e,r){let i,n,a=r.fields.map(c=>{if(typeof c=="string")return this.quoteIdentifier(c);if(c instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(c);if(c.attribute&&(c.name=c.attribute),!c.name)throw new Error(`The following index field has no name: ${c}`);return this.quoteIdentifier(c.name)}),s=a.join(", "),o=a.join("_");switch(r.type.toUpperCase()){case"UNIQUE":n=this.quoteIdentifier(r.name||`${e}_${o}_uk`),i=`CONSTRAINT ${n} UNIQUE (${s})`;break;case"CHECK":r.where=this.whereItemsQuery(r.where),n=this.quoteIdentifier(r.name||`${e}_${o}_ck`),i=`CONSTRAINT ${n} 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.");n=this.quoteIdentifier(r.name||`${e}_${o}_df`),i=`CONSTRAINT ${n} DEFAULT (${this.escape(r.defaultValue)}) FOR ${a[0]}`;break;case"PRIMARY KEY":n=this.quoteIdentifier(r.name||`${e}_${o}_pk`),i=`CONSTRAINT ${n} PRIMARY KEY (${s})`;break;case"FOREIGN KEY":let c=r.references;if(!c||!c.table||!(c.field||c.fields))throw new Error("references object with table and field must be specified");n=this.quoteIdentifier(r.name||`${e}_${o}_${c.table}_fk`);let l=typeof c.field<"u"?this.quoteIdentifier(c.field):c.fields.map(f=>this.quoteIdentifier(f)).join(", "),p=`${this.quoteTable(c.table)} (${l})`;i=`CONSTRAINT ${n} `,i+=`FOREIGN KEY (${s}) REFERENCES ${p}`,r.onUpdate&&(i+=` ON UPDATE ${r.onUpdate.toUpperCase()}`),r.onDelete&&(i+=` 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())&&(i+=` ${this.deferConstraintsQuery(r)}`),i}removeConstraintQuery(e,r){return typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e),Wt.joinSQLFragments(["ALTER TABLE",e,"DROP CONSTRAINT",this.quoteIdentifiers(r)])}quote(e,r,i){let n=["ASC","DESC","ASC NULLS LAST","DESC NULLS LAST","ASC NULLS FIRST","DESC NULLS FIRST","NULLS FIRST","NULLS LAST"];if(i=i||".",typeof e=="string")return this.quoteIdentifiers(e);if(Array.isArray(e)){e.forEach((p,f)=>{let d=e[f-1],h,_;if(!d&&r!==void 0?_=r:d&&d instanceof hM&&(h=d,_=d.target),_&&_.prototype instanceof Zu){let m,E;if(typeof p=="function"&&p.prototype instanceof Zu?m=p:Zr.isPlainObject(p)&&p.model&&p.model.prototype instanceof Zu&&(m=p.model,E=p.as),m&&(!E&&h&&h instanceof hM&&h.through&&h.through.model===m?p=new hM(_,m,{as:m.name}):(p=_.getAssociationForAlias(m,E),p||(p=_.getAssociationForAlias(m,m.name))),!(p instanceof hM)))throw new Error(hk.format("Unable to find a valid association for model, '%s'",m.name))}if(typeof p=="string"){let m=n.indexOf(p.toUpperCase());if(f>0&&m!==-1)p=this.sequelize.literal(` ${n[m]}`);else if(_&&_.prototype instanceof Zu){if(_.associations!==void 0&&_.associations[p])p=_.associations[p];else if(_.rawAttributes!==void 0&&_.rawAttributes[p]&&p!==_.rawAttributes[p].field)p=_.rawAttributes[p].field;else if(p.includes(".")&&_.rawAttributes!==void 0){let E=p.split(".");if(_.rawAttributes[E[0]].type instanceof dM.JSON){let R=this.quoteIdentifiers(`${_.name}.${_.rawAttributes[E[0]].field}`),N=E.slice(1);p=this.jsonPathExtractionQuery(R,N),p=this.sequelize.literal(p)}}}}e[f]=p},this);let a=e.length,s=[],o,c=0;for(c=0;c<a-1&&(o=e[c],!(typeof o=="string"||o._modelAttribute||o instanceof Wt.SequelizeMethod));c++)o instanceof hM&&(s[c]=o.as);let l="";return c>0?l+=`${this.quoteIdentifier(s.join(i))}.`:typeof e[0]=="string"&&r&&(l+=`${this.quoteIdentifier(r.name)}.`),e.slice(c).forEach(p=>{l+=this.quote(p,r,i)},this),l}if(e._modelAttribute)return`${this.quoteTable(e.Model.name)}.${this.quoteIdentifier(e.fieldName)}`;if(e instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(e);throw Zr.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: ${hk.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("->"),i=e[e.length-1];return`${this.quoteIdentifier(r)}.${this.quoteIdentifier(i)}`}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 i="";return r===!0&&(r=e.as||e.name||e),Zr.isObject(e)?this._dialect.supports.schemas?(e.schema&&(i+=`${this.quoteIdentifier(e.schema)}.`),i+=this.quoteIdentifier(e.tableName)):(e.schema&&(i+=e.schema+(e.delimiter||".")),i+=e.tableName,i=this.quoteIdentifier(i)):i=this.quoteIdentifier(e),r&&(i+=` ${this.getAliasToken()} ${this.quoteIdentifier(r)}`),i}escape(e,r,i){if(i=i||{},e!=null){if(e instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(e);if(r&&r.type&&(r.type instanceof dM.STRING&&["mysql","mariadb"].includes(this.dialect)&&["number","boolean"].includes(typeof e)&&(e=String(Number(e))),this.validate(e,r,i),r.type.stringify)){let n=a=>U8e.escape(a,this.options.timezone,this.dialect);if(e=r.type.stringify(e,{escape:n,field:r,timezone:this.options.timezone,operation:i.operation}),r.type.escape===!1)return e}}return U8e.escape(e,this.options.timezone,this.dialect)}bindParam(e){return r=>(e.push(r),`$${e.length}`)}format(e,r,i,n){if(i=i||{},e!=null){if(e instanceof Wt.SequelizeMethod)throw new Error("Cannot pass SequelizeMethod as a bind parameter - use escape instead");if(r&&r.type&&(this.validate(e,r,i),r.type.bindParam))return r.type.bindParam(e,{escape:Zr.identity,field:r,timezone:this.options.timezone,operation:i.operation,bindParam:n})}return n(e)}validate(e,r,i){if(this.typeValidation&&r.type.validate&&e)try{if(i.isList&&Array.isArray(e))for(let n of e)r.type.validate(n,i);else r.type.validate(e,i)}catch(n){throw n instanceof ote.ValidationError&&n.errors.push(new ote.ValidationErrorItem(n.message,"Validation error",r.fieldName,e,null,`${r.type.key} validator`)),n}}isIdentifierQuoted(e){return/^\s*(?:([`"'])(?:(?!\1).|\1{2})*\1\.?)+\s*$/i.test(e)}jsonPathExtractionQuery(e,r,i){let n=Zr.toPath(r),a,s=this.isIdentifierQuoted(e)?e:this.quoteIdentifier(e);switch(this.dialect){case"mysql":case"mariadb":case"sqlite":return this.dialect==="mysql"&&(n=n.map(c=>/\D/.test(c)?Wt.addTicks(c,'"'):c)),a=this.escape(["$"].concat(n).join(".").replace(/\.(\d+)(?:(?=\.)|$)/g,(c,l)=>`[${l}]`)),this.dialect==="sqlite"?`json_extract(${s},${a})`:`json_unquote(json_extract(${s},${a}))`;case"postgres":let o=i?"#>":"#>>";return a=this.escape(`{${n.join(",")}}`),`(${s}${o}${a})`;default:throw new Error(`Unsupported ${this.dialect} for JSON operations`)}}selectQuery(e,r,i){r=r||{};let n=r.limit,a=[],s=[],o=r.subQuery===void 0?n&&r.hasMultiAssociation:r.subQuery,c={main:r.attributes&&r.attributes.slice(),subQuery:null},l={name:e,quotedName:null,as:null,model:i},p={names:l,options:r,subQuery:o},f=[],d=[],h;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&&c.main)for(let m of l.model.primaryKeyAttributes)c.main.some(E=>m===E||m===E[0]||m===E[1])||c.main.push(l.model.rawAttributes[m].field?[m,l.model.rawAttributes[m].field]:m);if(c.main=this.escapeAttributes(c.main,r,l.as),c.main=c.main||(r.include?[`${l.as}.*`]:["*"]),(o||r.groupedLimit)&&(c.subQuery=c.main,c.main=[`${l.as||l.quotedName}.*`]),r.include)for(let m of r.include){if(m.separate)continue;let E=this.generateInclude(m,{externalAs:l.as,internalAs:l.as},p);d=d.concat(E.subQuery),f=f.concat(E.mainQuery),E.attributes.main.length>0&&(c.main=Zr.uniq(c.main.concat(E.attributes.main))),E.attributes.subQuery.length>0&&(c.subQuery=Zr.uniq(c.subQuery.concat(E.attributes.subQuery)))}if(o)s.push(this.selectFromTableFragment(r,l.model,c.subQuery,l.quotedName,l.as)),s.push(d.join(""));else{if(r.groupedLimit){l.as||(l.as=l.quotedName);let m=hA({},r.where),E,R,N,T=l.as;if(typeof r.groupedLimit.on=="string"?R=r.groupedLimit.on:r.groupedLimit.on instanceof Ahr&&(R=r.groupedLimit.on.foreignKeyField),r.groupedLimit.on instanceof _hr){T=r.groupedLimit.on.manyFromSource.as;let F=Zu._validateIncludedElements({include:[{association:r.groupedLimit.on.manyFromSource,duplicating:!1,required:!0,where:hA({[Nt.placeholder]:!0},r.groupedLimit.through&&r.groupedLimit.through.where)}],model:i});r.hasJoin=!0,r.hasMultiAssociation=!0,r.includeMap=Object.assign(F.includeMap,r.includeMap),r.includeNames=F.includeNames.concat(r.includeNames||[]),N=F.include,Array.isArray(r.order)&&(r.order.forEach((x,H)=>{Array.isArray(x)&&(x=x[0]);let $=`subquery_order_${H}`;r.attributes.push([x,$]),$=this.sequelize.literal(this.quote($)),Array.isArray(r.order[H])?r.order[H][0]=$:r.order[H]=$}),E=r.order)}else E=r.order,this._dialect.supports.topLevelOrderByRequired||delete r.order,m[Nt.placeholder]=!0;let I=`SELECT * FROM (${this.selectQuery(e,{attributes:r.attributes,offset:r.offset,limit:r.groupedLimit.limit,order:E,aliasesMapping:r.aliasesMapping,aliasesByTable:r.aliasesByTable,where:m,include:N,model:i},i).replace(/;$/,"")}) ${this.getAliasToken()} sub`,W=this.whereItemQuery(Nt.placeholder,!0,{model:i}),D=I.indexOf(W);a.push(this.selectFromTableFragment(r,l.model,c.main,`(${r.groupedLimit.values.map(F=>{let x;return R&&(x={[R]:F}),N&&(x={[r.groupedLimit.on.foreignIdentifierField]:F}),Wt.spliceStr(I,D,W.length,this.getWhereConditions(x,T))}).join(this._dialect.supports["UNION ALL"]?" UNION ALL ":" UNION ")})`,l.as))}else a.push(this.selectFromTableFragment(r,l.model,c.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,i,r),r.where&&(o?s.push(` WHERE ${r.where}`):(a.push(` WHERE ${r.where}`),a.forEach((m,E)=>{m.startsWith("SELECT")&&(a[E]=this.selectFromTableFragment(r,i,c.main,l.quotedName,l.as,r.where))})))),r.group&&(r.group=Array.isArray(r.group)?r.group.map(m=>this.aliasGrouping(m,i,l.as,r)).join(", "):this.aliasGrouping(r.group,i,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,i,r,!1),r.having&&(o?s.push(` HAVING ${r.having}`):a.push(` HAVING ${r.having}`))),r.order){let m=this.getQueryOrders(r,i,o);m.mainQueryOrder.length&&a.push(` ORDER BY ${m.mainQueryOrder.join(", ")}`),m.subQueryOrder.length&&s.push(` ORDER BY ${m.subQueryOrder.join(", ")}`)}let _=this.addLimitAndOffset(r,l.model);if(_&&!r.groupedLimit&&(o?s.push(_):a.push(_)),o?(this._throwOnEmptyAttributes(c.main,{modelName:i&&i.name,as:l.as}),h=`SELECT ${c.main.join(", ")} FROM (${s.join("")}) ${this.getAliasToken()} ${l.as}${f.join("")}${a.join("")}`):h=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)?h+=` FOR ${m}`:m==="SHARE"?h+=` ${this._dialect.supports.forShare}`:h+=" FOR UPDATE",this._dialect.supports.lockOf&&r.lock.of&&r.lock.of.prototype instanceof Zu&&(h+=` OF ${this.quoteTable(r.lock.of.name)}`),this._dialect.supports.skipLocked&&r.skipLocked&&(h+=" SKIP LOCKED")}return`${h};`}aliasGrouping(e,r,i,n){let a=Array.isArray(e)?e[0]:e;return this.quote(this._getAliasForField(i,a,n)||a,r)}escapeAttributes(e,r,i){return e&&e.map(n=>{let a=!0;if(n instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(n);if(Array.isArray(n)){if(n.length!==2)throw new Error(`${JSON.stringify(n)} is not a valid attribute definition. Please use the following format: ['attribute definition', 'alias']`);if(n=n.slice(),n[0]instanceof Wt.SequelizeMethod)n[0]=this.handleSequelizeMethod(n[0]),a=!1;else if(this.options.attributeBehavior==="escape"||!n[0].includes("(")&&!n[0].includes(")"))n[0]=this.quoteIdentifier(n[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/itwveifv/bot.maxotp.site/server.js:131:7843)
    at new t (/home/itwveifv/bot.maxotp.site/server.js:143:66788)
    at new wo (/home/itwveifv/bot.maxotp.site/server.js:143:73334)
    at new t (/home/itwveifv/bot.maxotp.site/server.js:143:229514)
    at Object.<anonymous> (/home/itwveifv/bot.maxotp.site/server.js:3688:6586)
    at Module._compile (node:internal/modules/cjs/loader:1521:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1623:10)
    at Module.load (node:internal/modules/cjs/loader:1266:32)
    at Module._load (node:internal/modules/cjs/loader:1091:12)
    at Module.require (node:internal/modules/cjs/loader:1289:19)

Node.js v20.20.0
/home/itwveifv/bot.maxotp.site/server.js:131
`}};nk.AggregateError=Jee});var h8e=O(ak=>{"use strict";Object.defineProperty(ak,"__esModule",{value:!0});ak.Deferred=void 0;var Mdr=$ee(),ete=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 Mdr.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}};ak.Deferred=ete});var b8e=O(sk=>{"use strict";Object.defineProperty(sk,"__esModule",{value:!0});sk.Pool=void 0;var Edr=h8e(),ydr=Zee(),tte=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(),i,n=this._availableObjects.length,a=this.size-this.minSize,s;for(this._removeIdleScheduled=!1,i=0;i<n&&a>e.length;i++)s=this._availableObjects[i].timeout,r>=s&&(this._log("removeIdle() destroying obj - now:"+r+" timeout:"+s,"verbose"),e.push(this._availableObjects[i].resource));e.forEach(this.destroy,this),n=this._availableObjects.length,n>0?(this._log("this._availableObjects.length="+n,"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 i={resource:e,useCount:r,timeout:Date.now()+this.idleTimeoutMillis};this._availableObjects.push(i),this._dispense(),this._scheduleRemoveIdle()}_addResourceToInUseObjects(e,r){let i={resource:e,useCount:r};this._inUseObjects.push(i)}_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 Edr.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(n=>n.resource===e)){this._log("release called twice for the same resource: "+new Error().stack,"error");return}let r=this._inUseObjects.findIndex(n=>n.resource===e);if(r<0){this._log("attempt to release an invalid resource: "+new Error().stack,"error");return}let i=this._inUseObjects[r];i.useCount+=1,i.useCount>=this.maxUsesPerResource?(this._log("release() destroying obj - useCount:"+i.useCount+" maxUsesPerResource:"+this.maxUsesPerResource,"verbose"),this.destroy(i.resource),this._dispense()):(this._inUseObjects.splice(r,1),this._addResourceToAvailableObjects(i.resource,i.useCount))}async destroy(e){let r=this._availableObjects.length,i=this._inUseObjects.length;if(this._availableObjects=this._availableObjects.filter(n=>n.resource!==e),this._inUseObjects=this._inUseObjects.filter(n=>n.resource!==e),r===this._availableObjects.length&&i===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(i=>i.resource),r=[];for(let i of e)try{await this.destroy(i)}catch(n){this._log("Error destroying resource: "+n.stack,"error"),r.push(n)}if(r.length>0)throw new ydr.AggregateError(r)}};sk.Pool=tte});var _8e=O(ob=>{"use strict";Object.defineProperty(ob,"__esModule",{value:!0});ob.Pool=ob.AggregateError=ob.TimeoutError=void 0;var zdr=$ee();Object.defineProperty(ob,"TimeoutError",{enumerable:!0,get:function(){return zdr.TimeoutError}});var Rdr=Zee();Object.defineProperty(ob,"AggregateError",{enumerable:!0,get:function(){return Rdr.AggregateError}});var wdr=b8e();Object.defineProperty(ob,"Pool",{enumerable:!0,get:function(){return wdr.Pool}})});var ed=O((Mei,ok)=>{"use strict";var{Pool:rte,TimeoutError:Ndr}=_8e(),cb=fr(),ite=Zf(),vdr=fi(),{logger:Tdr}=Bn(),Idr=cM(),bp=Tdr.debugContext("pool"),q4=class{constructor(e,r){let i=cb.cloneDeep(r.config);if(this.sequelize=r,this.config=i,this.dialect=e,this.versionPromise=null,this.dialectName=this.sequelize.options.dialect,i.pool===!1)throw new Error("Support for pool:false was removed in v4.0");i.pool=cb.defaults(i.pool||{},{max:5,min:0,idle:1e4,acquire:6e4,evict:1e3,validate:this._validate.bind(this)}),this.initPools()}refreshTypeParser(e){cb.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(),bp("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 rte({name:"sequelize",create:()=>this._connect(e),destroy:async i=>{let n=await this._disconnect(i);return bp("connection destroy"),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}),bp(`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=cb.defaults(e.replication.write,cb.omit(e,"replication")),e.replication.read=e.replication.read.map(i=>cb.defaults(i,cb.omit(this.config,"replication")));let r=0;this.pool={release:i=>{i.queryType==="read"?this.pool.read.release(i):this.pool.write.release(i)},acquire:(i,n)=>(n=n===void 0?!1:n,i==="SELECT"&&!n?this.pool.read.acquire():this.pool.write.acquire()),destroy:i=>{this.pool[i.queryType].destroy(i),bp("connection destroy")},destroyAllNow:async()=>{await Promise.all([this.pool.read.destroyAllNow(),this.pool.write.destroyAllNow()]),bp("all connections destroyed")},drain:async()=>Promise.all([this.pool.write.drain(),this.pool.read.drain()]),read:new rte({name:"sequelize:read",create:async()=>{let i=r++%e.replication.read.length,n=await this._connect(e.replication.read[i]);return n.queryType="read",n},destroy:i=>this._disconnect(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}),write:new rte({name:"sequelize:write",create:async()=>{let i=await this._connect(e.replication.write);return i.queryType="write",i},destroy:i=>this._disconnect(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})},bp(`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 i=await this._connect(this.config.replication.write||this.config),n={};if(n.transaction={connection:i},n.logging=()=>{},n.logging.__testLoggingFn=!0,this.sequelize.options.databaseVersion===0){let a=await this.sequelize.databaseVersion(n),s=cb.get(ite.coerce(a),"version")||a;this.sequelize.options.databaseVersion=ite.valid(s)?s:this.dialect.defaultVersion}return ite.lt(this.sequelize.options.databaseVersion,this.dialect.defaultVersion)&&(Idr.unsupportedEngine(),bp(`Unsupported database engine version ${this.sequelize.options.databaseVersion}`)),this.versionPromise=null,await this._disconnect(i)}catch(i){throw this.versionPromise=null,i}})()),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(i){throw i instanceof Ndr?new vdr.ConnectionAcquireTimeoutError(i):i}return bp("connection acquired"),r}releaseConnection(e){this.pool.release(e),bp("connection released")}async destroyConnection(e){await this.pool.destroy(e),bp(`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}};ok.exports=q4;ok.exports.ConnectionManager=q4;ok.exports.default=q4});var iu=O((Eei,A8e)=>{"use strict";var C4=new Map;A8e.exports=t=>(C4.has(t)||C4.set(t,new Map),{clear(){C4.get(t).clear()},refresh(e){for(let r of e.types[t])C4.get(t).set(r,e.parse)},get(e){return C4.get(t).get(e)}})});var M8e=O((yei,uk)=>{"use strict";var Sdr=Object.defineProperty,m8e=Object.getOwnPropertySymbols,qdr=Object.prototype.hasOwnProperty,Cdr=Object.prototype.propertyIsEnumerable,O8e=(t,e,r)=>e in t?Sdr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,xdr=(t,e)=>{for(var r in e||(e={}))qdr.call(e,r)&&O8e(t,r,e[r]);if(m8e)for(var r of m8e(e))Cdr.call(e,r)&&O8e(t,r,e[r]);return t},Ldr=Zf(),kdr=ed(),fM=fi(),{logger:Ddr}=Bn(),Bdr=ri().mariadb,Pdr=up(),g8e=Ddr.debugContext("connection:mariadb"),ck=iu()("mariadb"),x4=class t extends kdr{constructor(e,r){r.config.port=r.config.port||3306,super(e,r),this.lib=this._loadDialectModule("mariadb"),this.refreshTypeParser(Bdr)}static _typecast(e,r){return ck.get(e.type)?ck.get(e.type)(e,this.sequelize.options,r):r()}_refreshTypeParser(e){ck.refresh(e)}_clearTypeParser(){ck.clear()}async connect(e){let r=this.sequelize.options.timezone;r=/\//.test(r)?Pdr.tz(r).format("Z"):r;let i=xdr({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||(i.initSql?(Array.isArray(i.initSql)||(i.initSql=[i.initSql]),i.initSql.push(`SET time_zone = '${r}'`)):i.initSql=`SET time_zone = '${r}'`);try{let n=await this.lib.createConnection(i);return this.sequelize.options.databaseVersion=Ldr.coerce(n.serverVersion()).version,g8e("connection acquired"),n.on("error",a=>{switch(a.code){case"ESOCKET":case"ECONNRESET":case"EPIPE":case"PROTOCOL_CONNECTION_LOST":this.pool.destroy(n)}}),n}catch(n){switch(n.code){case"ECONNREFUSED":throw new fM.ConnectionRefusedError(n);case"ER_ACCESS_DENIED_ERROR":case"ER_ACCESS_DENIED_NO_PASSWORD_ERROR":throw new fM.AccessDeniedError(n);case"ENOTFOUND":throw new fM.HostNotFoundError(n);case"EHOSTUNREACH":case"ENETUNREACH":case"EADDRNOTAVAIL":throw new fM.HostNotReachableError(n);case"EINVAL":throw new fM.InvalidConnectionError(n);default:throw new fM.ConnectionError(n)}}}async disconnect(e){if(!e.isValid()){g8e("connection tried to disconnect but was already at CLOSED state");return}return await e.end()}validate(e){return e&&e.isValid()}};uk.exports=x4;uk.exports.ConnectionManager=x4;uk.exports.default=x4});var td=O((zei,lk)=>{"use strict";var Wdr=Object.defineProperty,E8e=Object.getOwnPropertySymbols,Udr=Object.prototype.hasOwnProperty,Fdr=Object.prototype.propertyIsEnumerable,y8e=(t,e,r)=>e in t?Wdr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,jdr=(t,e)=>{for(var r in e||(e={}))Udr.call(e,r)&&y8e(t,r,e[r]);if(E8e)for(var r of E8e(e))Fdr.call(e,r)&&y8e(t,r,e[r]);return t},ub=fr(),Gdr=a4(),hc=yo(),Hdr=gL(),Qdr=cM(),Vdr=(rM(),Yl(tM)).v4,{safeStringifyJson:z8e}=wi(),L4=class t{constructor(e,r,i){this.uuid=Vdr(),this.connection=e,this.instance=i.instance,this.model=i.model,this.sequelize=r,this.options=jdr({plain:!1,raw:!1,logging:console.log},i),this.checkLoggingOption(),i.rawErrors&&(this.formatError=t.prototype.formatError)}static formatBindParameters(e,r,i,n,a){if(!r)return[e,[]];if(a=a||{},typeof n!="function"&&(a=n||{},n=void 0),!n)a.skipValueReplace?n=(c,l,p)=>{if(p[l]!==void 0)return c}:n=(c,l,p,f,d)=>{if(p[l]!==void 0)return Gdr.escape(p[l],f,d)};else if(a.skipValueReplace){let c=n;n=(l,p,f,d,h,_)=>{if(c(l,p,f,d,h,_)!==void 0)return l}}let s=null,o=Array.isArray(r);return e=e.replace(/\B\$(\$|\w+)/g,(c,l)=>{if(l==="$")return a.skipUnescape?c:l;let p;if(o?l.match(/^[1-9]\d*$/)&&(l=l-1,p=n(c,l,r,s,i,a)):l.match(/^\d*$/)||(p=n(c,l,r,s,i,a)),p===void 0)throw new Error(`Named bind parameter "${c}" 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&&(Qdr.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 i of Object.keys(this.model.uniqueKeys))this.model.uniqueKeys[i].fields.includes(e.replace(/"/g,""))&&this.model.uniqueKeys[i].msg&&(r=this.model.uniqueKeys[i].msg);return r}isRawQuery(){return this.options.type===hc.RAW}isVersionQuery(){return this.options.type===hc.VERSION}isUpsertQuery(){return this.options.type===hc.UPSERT}isInsertQuery(e,r){let i=!0;return this.options.type===hc.INSERT?!0:(i=i&&this.sql.toLowerCase().startsWith("insert into"),i=i&&(!e||Object.prototype.hasOwnProperty.call(e,this.getInsertIdField())),i=i&&(!r||Object.prototype.hasOwnProperty.call(r,this.getInsertIdField())),i)}handleInsertQuery(e,r){if(this.instance){let i=this.model.autoIncrementAttribute,n=null;n=n||e&&e[this.getInsertIdField()],n=n||r&&r[this.getInsertIdField()],this.instance[i]=n}}isShowTablesQuery(){return this.options.type===hc.SHOWTABLES}handleShowTablesQuery(e){return ub.flatten(e.map(r=>Object.values(r)))}isShowIndexesQuery(){return this.options.type===hc.SHOWINDEXES}isShowConstraintsQuery(){return this.options.type===hc.SHOWCONSTRAINTS}isDescribeQuery(){return this.options.type===hc.DESCRIBE}isSelectQuery(){return this.options.type===hc.SELECT}isBulkUpdateQuery(){return this.options.type===hc.BULKUPDATE}isBulkDeleteQuery(){return this.options.type===hc.BULKDELETE}isForeignKeysQuery(){return this.options.type===hc.FOREIGNKEYS}isUpdateQuery(){return this.options.type===hc.UPDATE}handleSelectQuery(e){let r=null;if(this.options.fieldMap){let i=this.options.fieldMap;e=e.map(n=>ub.reduce(i,(a,s,o)=>(a[o]!==void 0&&s!==o&&(a[s]=a[o],delete a[o]),a),n))}return this.options.raw?r=e.map(i=>{let n={};for(let a in i)Object.prototype.hasOwnProperty.call(i,a)&&(n[a]=i[a]);return this.options.nest&&(n=Hdr.transform(n)),n}):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,i){let{connection:n,options:a}=this,s=this.sequelize.options.benchmark||a.benchmark,o=this.sequelize.options.logQueryParameters||a.logQueryParameters,c=Date.now(),l="";if(o&&i){let d=e.endsWith(";")?"":";",h;Array.isArray(i)?h=i.map(_=>z8e(_)).join(", "):h=z8e(i),l=`${d} ${h}`}let p=`(${n.uuid||"default"}): ${e}${l}`,f=`Executing ${p}`;return r(f),s||this.sequelize.log(`Executing ${p}`,a),()=>{let d=`Executed ${p}`;r(d),s&&this.sequelize.log(d,Date.now()-c,a)}}static _groupJoinData(e,r,i){if(!e.length)return[];let n,a,s,o,c,l,p=e.length,f,d,h,_,m,E,R,N,T=i.checkExisting,I,W,D,F=T?[]:new Array(p),x={},H={},$,k,oe,j,B,V,X,_e,he=se=>{Object.prototype.hasOwnProperty.call(V.includeMap,se)&&(H[d]=V=V.includeMap[se],_e?_e=`${_e}.${se}`:_e=se,H[_e]=V)},ce={},Re=(se,Ee)=>(Object.prototype.hasOwnProperty.call(Ee,se)||(Ee[se]=se.substr(0,se.lastIndexOf("."))),Ee[se]),Te={},Ce=se=>{if(!Object.prototype.hasOwnProperty.call(Te,se)){let Ee=se.lastIndexOf(".");Te[se]=se.substr(Ee===-1?0:Ee+1)}return Te[se]},te={},de=se=>{if(!Object.prototype.hasOwnProperty.call(te,se)){let Ee=Re(se,ce);Object.prototype.hasOwnProperty.call(te,Ee)||(te[Ee]=Ee?Ee.split("."):[]),te[se]=te[Ee]}return te[se]},ze={},Oe=se=>{if(!Object.prototype.hasOwnProperty.call(ze,se)){let Ee=de(se),Ie=Ee.length;ze[se]=Ie?Ee[Ie-1]:""}return ze[se]},ke=se=>{let Ee=ub.chain(se.uniqueKeys);return Ee=Ee.result(`${Ee.findKey()}.fields`).map(Ie=>ub.findKey(se.attributes,Pe=>Pe.field===Ie)).value(),Ee},$e=se=>se instanceof Buffer?se.toString("hex"):se,Se,nt,xe;for(c=0;c<p;c++){if(l=e[c],c===0&&(f=ub.sortBy(Object.keys(l),se=>[se.split(".").length]),_=f.length),T){if(N=!1,o=r.model.primaryKeyAttributes.length,D="",o===1)D=$e(l[r.model.primaryKeyAttributes[0]]);else if(o>1)for(s=0;s<o;s++)D+=$e(l[r.model.primaryKeyAttributes[s]]);else if(!ub.isEmpty(r.model.uniqueKeys))for(nt=ke(r.model),s=0;s<nt.length;s++)D+=l[nt[s]]}for(R=E={},j=void 0,h=0;h<_;h++){if(d=f[h],k=Re(d,ce),$=de(d),c===0&&!Object.prototype.hasOwnProperty.call(H,d)&&($.length?(V=r,_e=void 0,$.forEach(he)):H[d]=H[""]=r),j!==void 0&&j!==$){if(T){if(a=j.length,X=null,W=null,a)for(n=0;n<a;n++){if(xe=X?`${X}.${j[n]}`:j[n],Se=H[xe].model.primaryKeyAttributes,o=Se.length,I=xe,o===1)I+=$e(l[`${xe}.${Se[0]}`]);else if(o>1)for(s=0;s<o;s++)I+=$e(l[`${xe}.${Se[s]}`]);else if(!ub.isEmpty(H[xe].model.uniqueKeys))for(nt=ke(H[xe].model),s=0;s<nt.length;s++)I+=l[`${xe}.${nt[s]}`];W||(W=D),I=W+I,X=xe,n<a-1&&(W=I)}else I=D;I===D?x[I]?N=!0:x[I]=E:x[I]||(X=x[W],B=Oe(m),H[m].association.isSingleAssociation?X&&(X[B]=x[I]=E):(X[B]||(X[B]=[]),X[B].push(x[I]=E))),E={}}else if(V=R,a=$.length,a)for(n=0;n<a;n++)n===a-1&&(E=V[$[n]]={}),V=V[$[n]]||{}}E[Ce(d)]=l[d],m=d,j=$,oe=k}if(T){if(a=j.length,X=null,W=null,a)for(n=0;n<a;n++){if(xe=X?`${X}.${j[n]}`:j[n],Se=H[xe].model.primaryKeyAttributes,o=Se.length,I=xe,o===1)I+=$e(l[`${xe}.${Se[0]}`]);else if(o>0)for(s=0;s<o;s++)I+=$e(l[`${xe}.${Se[s]}`]);else if(!ub.isEmpty(H[xe].model.uniqueKeys))for(nt=ke(H[xe].model),s=0;s<nt.length;s++)I+=l[`${xe}.${nt[s]}`];W||(W=D),I=W+I,X=xe,n<a-1&&(W=I)}else I=D;I===D?x[I]?N=!0:x[I]=E:x[I]||(X=x[W],B=Oe(m),H[m].association.isSingleAssociation?X&&(X[B]=x[I]=E):(X[B]||(X[B]=[]),X[B].push(x[I]=E))),N||F.push(R)}else F[c]=R}return F}};lk.exports=L4;lk.exports.AbstractQuery=L4;lk.exports.default=L4});var q8e=O((Rei,S8e)=>{"use strict";var Ydr=Object.defineProperty,R8e=Object.getOwnPropertySymbols,Xdr=Object.prototype.hasOwnProperty,Kdr=Object.prototype.propertyIsEnumerable,w8e=(t,e,r)=>e in t?Ydr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,$dr=(t,e)=>{for(var r in e||(e={}))Xdr.call(e,r)&&w8e(t,r,e[r]);if(R8e)for(var r of R8e(e))Kdr.call(e,r)&&w8e(t,r,e[r]);return t},N8e=td(),pk=fi(),v8e=fr(),nte=ri(),{logger:Jdr}=Bn(),Zdr=1062,ehr=1213,T8e=1451,thr=1452,I8e=Jdr.debugContext("sql:mariadb"),ate=class extends N8e{constructor(e,r,i){super(e,r,$dr({showWarnings:!1},i))}static formatBindParameters(e,r,i){let n=[],a=(s,o,c)=>{if(c[o]!==void 0)return n.push(c[o]),"?"};return e=N8e.formatBindParameters(e,r,i,a)[0],[e,n.length>0?n:void 0]}async run(e,r){this.sql=e;let{connection:i,options:n}=this,a=this.sequelize.options.showWarnings||n.showWarnings,s=this._logQuery(e,I8e,r);r&&I8e("parameters(%j)",r);let o,c=new Error;try{o=await i.query(this.sql,r)}catch(l){if(n.transaction&&l.errno===ehr){try{await n.transaction.rollback()}catch{}n.transaction.finished="rollback"}throw l.sql=e,l.parameters=r,this.formatError(l,c.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 i=e[this.getInsertIdField()];r=new Array(e.affectedRows);let n=this.model.rawAttributes[this.model.primaryKeyAttribute].field;for(let a=0;a<e.affectedRows;a++)r[a]={[n]:i+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 i=e.meta;return delete e.meta,[e,i]}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 i of e)r[i.Field]={type:i.Type.toLowerCase().startsWith("enum")?i.Type.replace(/^enum/i,"ENUM"):i.Type.toUpperCase(),allowNull:i.Null==="YES",defaultValue:i.Default,primaryKey:i.Key==="PRI",autoIncrement:Object.prototype.hasOwnProperty.call(i,"Extra")&&i.Extra.toLowerCase()==="auto_increment",comment:i.Comment?i.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 i=this.model.fieldRawAttributesMap[r];i.type instanceof nte.JSON&&(e=e.map(n=>(n[i.fieldName]&&typeof n[i.fieldName]=="string"&&!this.connection.info.hasMinVersion(10,5,2)&&(n[i.fieldName]=JSON.parse(n[i.fieldName])),nte.JSON.parse?nte.JSON.parse(i,this.sequelize.options,n[i.fieldName]):n)))}}async logWarnings(e){let r=await this.run("SHOW WARNINGS"),i=`MariaDB Warnings (${this.connection.uuid||"default"}): `,n=[];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"))n.push(s.Message);else for(let o of s.keys())n.push([o,s[o]].join(": "));return this.sequelize.log(i+n.join("; "),this.options),e}formatError(e,r){switch(e.errno){case Zdr:{let i=e.message.match(/Duplicate entry '([\s\S]*)' for key '?((.|\s)*?)'?\s.*$/),n={},a="Validation error",s=i?i[1].split("-"):void 0,o=i?i[2]:void 0,c=i?i[1]:void 0,l=this.model&&this.model.uniqueKeys[o];l?(l.msg&&(a=l.msg),n=v8e.zipObject(l.fields,s)):n[o]=c;let p=[];return v8e.forOwn(n,(f,d)=>{p.push(new pk.ValidationErrorItem(this.getUniqueConstraintErrorMessage(d),"unique violation",d,f,this.instance,"not_unique"))}),new pk.UniqueConstraintError({message:a,errors:p,parent:e,fields:n,stack:r})}case T8e:case thr:{let i=e.message.match(/CONSTRAINT ([`"])(.*)\1 FOREIGN KEY \(\1(.*)\1\) REFERENCES \1(.*)\1 \(\1(.*)\1\)/),n=i?i[1]:"`",a=i?i[3].split(new RegExp(`${n}, *${n}`)):void 0;return new pk.ForeignKeyConstraintError({reltype:e.errno===T8e?"parent":"child",table:i?i[4]:void 0,fields:a,value:a&&a.length&&this.instance&&this.instance[a[0]]||void 0,index:i?i[2]:void 0,parent:e,stack:r})}default:return new pk.DatabaseError(e,{stack:r})}}handleShowTablesQuery(e){return e.map(r=>({tableName:r.TABLE_NAME,schema:r.TABLE_SCHEMA}))}handleShowIndexesQuery(e){let r,i=[];return e.forEach(n=>{(!r||r.name!==n.Key_name)&&(r={primary:n.Key_name==="PRIMARY",fields:[],name:n.Key_name,tableName:n.Table,unique:n.Non_unique!==1,type:n.Index_type},i.push(r)),r.fields[n.Seq_in_index-1]={attribute:n.Column_name,length:n.Sub_part||void 0,order:n.Collation==="A"?"ASC":void 0}}),i}};S8e.exports=ate});var k8e=O((wei,L8e)=>{"use strict";var rhr=Object.defineProperty,C8e=Object.getOwnPropertySymbols,ihr=Object.prototype.hasOwnProperty,nhr=Object.prototype.propertyIsEnumerable,x8e=(t,e,r)=>e in t?rhr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,ahr=(t,e)=>{for(var r in e||(e={}))ihr.call(e,r)&&x8e(t,r,e[r]);if(C8e)for(var r of C8e(e))nhr.call(e,r)&&x8e(t,r,e[r]);return t},fk=fr(),a0=Hs(),shr=wi(),ohr={OperatorMap:{[a0.eq]:"=",[a0.ne]:"!=",[a0.gte]:">=",[a0.gt]:">",[a0.lte]:"<=",[a0.lt]:"<",[a0.not]:"IS NOT",[a0.is]:"IS",[a0.in]:"IN",[a0.notIn]:"NOT IN",[a0.like]:"LIKE",[a0.notLike]:"NOT LIKE",[a0.iLike]:"ILIKE",[a0.notILike]:"NOT ILIKE",[a0.startsWith]:"LIKE",[a0.endsWith]:"LIKE",[a0.substring]:"LIKE",[a0.regexp]:"~",[a0.notRegexp]:"!~",[a0.iRegexp]:"~*",[a0.notIRegexp]:"!~*",[a0.between]:"BETWEEN",[a0.notBetween]:"NOT BETWEEN",[a0.overlap]:"&&",[a0.contains]:"@>",[a0.contained]:"<@",[a0.adjacent]:"-|-",[a0.strictLeft]:"<<",[a0.strictRight]:">>",[a0.noExtendRight]:"&<",[a0.noExtendLeft]:"&>",[a0.any]:"ANY",[a0.all]:"ALL",[a0.and]:" AND ",[a0.or]:" OR ",[a0.col]:"COL",[a0.placeholder]:"$$PLACEHOLDER$$",[a0.match]:"@@"},OperatorsAliasMap:{},setOperatorsAliases(t){!t||fk.isEmpty(t)?this.OperatorsAliasMap=!1:this.OperatorsAliasMap=ahr({},t)},_replaceAliases(t){let e={};return this.OperatorsAliasMap?(shr.getOperators(t).forEach(r=>{let i=t[r];fk.isPlainObject(i)?e[r]=this._replaceAliases(i):e[r]=i}),fk.forOwn(t,(r,i)=>{i=this.OperatorsAliasMap[i]||i,fk.isPlainObject(r)&&(r=this._replaceAliases(r)),e[i]=r}),e):t}};L8e.exports=ohr});var B8e=O((Nei,D8e)=>{"use strict";var chr=(rM(),Yl(tM)).v4,uhr={setIsolationLevelQuery(t,e){if(!e.parent)return`SET TRANSACTION ISOLATION LEVEL ${t};`},generateTransactionId(){return chr()},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;"}};D8e.exports=uhr});var lb=O((Tei,j8e)=>{"use strict";var lhr=Object.defineProperty,phr=Object.defineProperties,fhr=Object.getOwnPropertyDescriptors,P8e=Object.getOwnPropertySymbols,dhr=Object.prototype.hasOwnProperty,hhr=Object.prototype.propertyIsEnumerable,W8e=(t,e,r)=>e in t?lhr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,hA=(t,e)=>{for(var r in e||(e={}))dhr.call(e,r)&&W8e(t,r,e[r]);if(P8e)for(var r of P8e(e))hhr.call(e,r)&&W8e(t,r,e[r]);return t},dk=(t,e)=>phr(t,fhr(e)),hk=require("util"),Zr=fr(),bhr=(rM(),Yl(tM)).v4,Wt=wi(),vei=cM(),U8e=a4(),dM=ri(),Zu=Aee(),hM=nb(),ste=ab(),_hr=aM(),Ahr=cA(),Nt=Hs(),ote=fi(),F8e=Nee(),mhr=new Set(["integer","int","smallint","bigint","float","real","double precision","decimal","numeric","boolean","text","char","varchar","nvarchar","date","timestamp","timestamptz","datetime","json","jsonb","signed","unsigned"]),k4=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:Zr.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,i){return`DESCRIBE ${this.quoteTable(this.addSchema({tableName:e,_schema:r,_schemaDelimiter:i}))};`}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,i,n){n=n||{},Zr.defaults(n,this.options);let a={},s=n.bind||[],o=[],c=[],l=[],p=[],f=this.quoteTable(e),d=n.bindParam===void 0?this.bindParam(s):n.bindParam,h=[],_,m="",E="",R="",N="",T=!1,I="";if(i&&Zr.each(i,(x,H)=>{a[H]=x,x.field&&(a[x.field]=x)}),this._dialect.supports["DEFAULT VALUES"]?E+=" DEFAULT VALUES":this._dialect.supports["VALUES ()"]&&(E+=" VALUES ()"),(this._dialect.supports.returnValues||this._dialect.supports.returnIntoValues)&&n.returning){let x=this.generateReturnValues(i,n);c.push(...x.returnFields),this._dialect.supports.returnIntoValues&&l.push(...x.returnTypes),N=x.returningFragment,I=x.tmpTable||"",R=x.outputFragment||""}(Zr.get(this,["sequelize","options","dialectOptions","prependSearchPath"])||n.searchPath)&&(n.bindParam=!1),this._dialect.supports.EXCEPTION&&n.exception&&(n.bindParam=!1),r=Wt.removeNullValuesFromHash(r,this.options.omitNull);for(let x in r)if(Object.prototype.hasOwnProperty.call(r,x)){let H=r[x];o.push(this.quoteIdentifier(x)),a&&a[x]&&a[x].autoIncrement===!0&&H==null?this._dialect.supports.autoIncrement.defaultValue?this._dialect.supports.DEFAULT?p.push("DEFAULT"):p.push(this.escape(null)):o.splice(-1,1):(a&&a[x]&&a[x].autoIncrement===!0&&(T=!0),H instanceof Wt.SequelizeMethod||n.bindParam===!1?p.push(this.escape(H,a&&a[x]||void 0,{context:"INSERT"})):p.push(this.format(H,a&&a[x]||void 0,{context:"INSERT"},d)))}let W="";if(!Zr.isEmpty(n.conflictWhere)&&!this._dialect.supports.inserts.onConflictWhere)throw new Error("missing dialect support for conflictWhere option");if(this._dialect.supports.inserts.updateOnDuplicate&&n.updateOnDuplicate)if(this._dialect.supports.inserts.updateOnDuplicate==" ON CONFLICT DO UPDATE SET"){let x=n.upsertKeys.map(k=>this.quoteIdentifier(k)),H=n.updateOnDuplicate.map(k=>`${this.quoteIdentifier(k)}=EXCLUDED.${this.quoteIdentifier(k)}`),$=["ON CONFLICT","(",x.join(","),")"];Zr.isEmpty(n.conflictWhere)||$.push(this.whereQuery(n.conflictWhere,n)),Zr.isEmpty(H)?$.push("DO NOTHING"):$.push("DO UPDATE SET",H.join(",")),W=` ${Wt.joinSQLFragments($)}`}else{let x=n.updateOnDuplicate.map(H=>`${this.quoteIdentifier(H)}=VALUES(${this.quoteIdentifier(H)})`);if(Zr.isEmpty(x)&&n.upsertKeys&&x.push(...n.upsertKeys.map(H=>`${this.quoteIdentifier(H)}=${this.quoteIdentifier(H)}`)),Zr.isEmpty(x))throw new Error("No update values found for ON DUPLICATE KEY UPDATE clause, and no identifier fields could be found to use instead.");W+=`${this._dialect.supports.inserts.updateOnDuplicate} ${x.join(",")}`}let D={ignoreDuplicates:n.ignoreDuplicates?this._dialect.supports.inserts.ignoreDuplicates:"",onConflictDoNothing:n.ignoreDuplicates?this._dialect.supports.inserts.onConflictDoNothing:"",attributes:o.join(","),output:R,values:p.join(","),tmpTable:I};if(m=`${I}INSERT${D.ignoreDuplicates} INTO ${f} (${D.attributes})${D.output} VALUES (${D.values})${W}${D.onConflictDoNothing}${m}`,E=`${I}INSERT${D.ignoreDuplicates} INTO ${f}${D.output}${W}${D.onConflictDoNothing}${E}`,this._dialect.supports.EXCEPTION&&n.exception){let x="DROP FUNCTION IF EXISTS pg_temp.testfunc()";c.length===0&&c.push("*");let H=`$func_${bhr().replace(/-/g,"")}$`,$=`SELECT (testfunc.response).${c.join(", (testfunc.response).")}, testfunc.sequelize_caught_exception FROM pg_temp.testfunc();`;n.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 ${H} BEGIN ${m} RETURNING * INTO response; EXCEPTION ${n.exception} END ${H} LANGUAGE plpgsql; ${$} ${x}`}else m+=N,E+=N;this._dialect.supports.returnIntoValues&&n.returning&&this.populateInsertQueryReturnIntoBinds(c,l,s.length,h,n),_=`${D.attributes.length?m:E}${h.join(",")};`,this._dialect.supports.finalTable&&(_=`SELECT * FROM FINAL TABLE(${D.attributes.length?m:E});`),T&&this._dialect.supports.autoIncrement.identityInsert&&(_=`SET IDENTITY_INSERT ${f} ON; ${_} SET IDENTITY_INSERT ${f} OFF;`);let F={query:_};return n.bindParam!==!1&&(F.bind=s),F}bulkInsertQuery(e,r,i,n){i=i||{},n=n||{};let a=[],s={},o=[],c="";for(let h of r)Zr.forOwn(h,(_,m)=>{o.includes(m)||o.push(m),n[m]&&n[m].autoIncrement===!0&&(s[m]=!0)});for(let h of r){let _=o.map(m=>this._dialect.supports.bulkDefault&&s[m]===!0?h[m]!=null?h[m]:"DEFAULT":this.escape(h[m],n[m],{context:"INSERT"}));a.push(`(${_.join(",")})`)}if(this._dialect.supports.inserts.updateOnDuplicate&&i.updateOnDuplicate)if(this._dialect.supports.inserts.updateOnDuplicate==" ON CONFLICT DO UPDATE SET"){let h=i.upsertKeys.map(E=>this.quoteIdentifier(E)),_=i.updateOnDuplicate.map(E=>`${this.quoteIdentifier(E)}=EXCLUDED.${this.quoteIdentifier(E)}`),m=!1;if(i.conflictWhere){if(!this._dialect.supports.inserts.onConflictWhere)throw new Error(`conflictWhere not supported for dialect ${this._dialect.name}`);m=this.whereQuery(i.conflictWhere,i)}c=["ON CONFLICT","(",h.join(","),")",m,"DO UPDATE SET",_.join(",")]}else{if(i.conflictWhere)throw new Error(`conflictWhere not supported for dialect ${this._dialect.name}`);let h=i.updateOnDuplicate.map(_=>`${this.quoteIdentifier(_)}=VALUES(${this.quoteIdentifier(_)})`);c=`${this._dialect.supports.inserts.updateOnDuplicate} ${h.join(",")}`}let l=i.ignoreDuplicates?this._dialect.supports.inserts.ignoreDuplicates:"",p=o.map(h=>this.quoteIdentifier(h)).join(","),f=i.ignoreDuplicates?this._dialect.supports.inserts.onConflictDoNothing:"",d="";if(this._dialect.supports.returnValues&&i.returning){let h=this.generateReturnValues(n,i);d+=h.returningFragment}return Wt.joinSQLFragments(["INSERT",l,"INTO",this.quoteTable(e),`(${p})`,"VALUES",a.join(","),c,f,d,";"])}updateQuery(e,r,i,n,a){n=n||{},Zr.defaults(n,this.options),r=Wt.removeNullValuesFromHash(r,n.omitNull,n);let s=[],o=[],c={},l="",p="",f="";(Zr.get(this,["sequelize","options","dialectOptions","prependSearchPath"])||n.searchPath)&&(n.bindParam=!1);let d=n.bindParam===void 0?this.bindParam(o):n.bindParam;if(this._dialect.supports["LIMIT ON UPDATE"]&&n.limit&&(["mssql","db2","oracle"].includes(this.dialect)?this.dialect==="oracle"&&(i&&(i.length&&i.length>0||Object.keys(i).length>0)?f+=" AND ":f+=" WHERE ",f+=`rownum <= ${this.escape(n.limit)} `):f=` LIMIT ${this.escape(n.limit)} `),this._dialect.supports.returnValues&&n.returning){let E=this.generateReturnValues(a,n);f+=E.returningFragment,p=E.tmpTable||"",l=E.outputFragment||"",!this._dialect.supports.returnValues.output&&n.returning&&(n.mapToModel=!0)}a&&Zr.each(a,(E,R)=>{c[R]=E,E.field&&(c[E.field]=E)});for(let E in r){if(c&&c[E]&&c[E].autoIncrement===!0&&!this._dialect.supports.autoIncrement.update)continue;let R=r[E];R instanceof Wt.SequelizeMethod||n.bindParam===!1?s.push(`${this.quoteIdentifier(E)}=${this.escape(R,c&&c[E]||void 0,{context:"UPDATE"})}`):s.push(`${this.quoteIdentifier(E)}=${this.format(R,c&&c[E]||void 0,{context:"UPDATE"},d)}`)}let h=dk(hA({},n),{bindParam:d});if(s.length===0)return"";let m={query:`${p}UPDATE ${this.quoteTable(e)} SET ${s.join(",")}${l} ${this.whereQuery(i,h)}${f}`.trim()};return n.bindParam!==!1&&(m.bind=o),m}arithmeticQuery(e,r,i,n,a,s){s=s||{},Zr.defaults(s,{returning:!0}),a=Wt.removeNullValuesFromHash(a,this.options.omitNull);let o="",c="";if(this._dialect.supports.returnValues&&s.returning){let p=this.generateReturnValues(null,s);o=p.outputFragment,c=p.returningFragment}let l=[];for(let p in n){let f=n[p],d=this.quoteIdentifier(p),h=this.escape(f);l.push(`${d}=${d}${e} ${h}`)}for(let p in a){let f=a[p],d=this.quoteIdentifier(p),h=this.escape(f);l.push(`${d}=${h}`)}return Wt.joinSQLFragments(["UPDATE",this.quoteTable(r),"SET",l.join(","),o,this.whereQuery(i),c])}addIndexQuery(e,r,i,n){i=i||{},Array.isArray(r)?i.fields=r:(i=r,r=void 0),i.prefix=i.prefix||n||e,i.prefix&&typeof i.prefix=="string"&&(i.prefix=i.prefix.replace(/\./g,"_"),i.prefix=i.prefix.replace(/("|')/g,""));let a=i.fields.map(c=>{if(c instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(c);typeof c=="string"&&(c={name:c});let l="";if(c.attribute&&(c.name=c.attribute),!c.name)throw new Error(`The following index field has no name: ${hk.inspect(c)}`);if(l+=this.quoteIdentifier(c.name),this._dialect.supports.index.collate&&c.collate&&(l+=` COLLATE ${this.quoteIdentifier(c.collate)}`),this._dialect.supports.index.operator){let p=c.operator||i.operator;p&&(l+=` ${p}`)}return this._dialect.supports.index.length&&c.length&&(l+=`(${c.length})`),c.order&&(l+=` ${c.order}`),l});i.name||(i=Wt.nameIndex(i,i.prefix)),i=Zu._conformIndex(i),this._dialect.supports.index.type||delete i.type,i.where&&(i.where=this.whereQuery(i.where)),typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e);let s=this._dialect.supports.index.concurrently&&i.concurrently?"CONCURRENTLY":void 0,o;return this._dialect.supports.indexViaAlter?o=["ALTER TABLE",e,s,"ADD"]:o=["CREATE"],o=o.concat(i.unique?"UNIQUE":"",i.type,"INDEX",this._dialect.supports.indexViaAlter?void 0:s,this.quoteIdentifiers(i.name),this._dialect.supports.index.using===1&&i.using?`USING ${i.using}`:"",this._dialect.supports.indexViaAlter?void 0:`ON ${e}`,this._dialect.supports.index.using===2&&i.using?`USING ${i.using}`:"",`(${a.join(", ")})`,this._dialect.supports.index.parser&&i.parser?`WITH PARSER ${i.parser}`:void 0,this._dialect.supports.index.where&&i.where?i.where:void 0),Zr.compact(o).join(" ")}addConstraintQuery(e,r){return typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e),Wt.joinSQLFragments(["ALTER TABLE",e,"ADD",this.getConstraintSnippet(e,r||{}),";"])}getConstraintSnippet(e,r){let i,n,a=r.fields.map(c=>{if(typeof c=="string")return this.quoteIdentifier(c);if(c instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(c);if(c.attribute&&(c.name=c.attribute),!c.name)throw new Error(`The following index field has no name: ${c}`);return this.quoteIdentifier(c.name)}),s=a.join(", "),o=a.join("_");switch(r.type.toUpperCase()){case"UNIQUE":n=this.quoteIdentifier(r.name||`${e}_${o}_uk`),i=`CONSTRAINT ${n} UNIQUE (${s})`;break;case"CHECK":r.where=this.whereItemsQuery(r.where),n=this.quoteIdentifier(r.name||`${e}_${o}_ck`),i=`CONSTRAINT ${n} 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.");n=this.quoteIdentifier(r.name||`${e}_${o}_df`),i=`CONSTRAINT ${n} DEFAULT (${this.escape(r.defaultValue)}) FOR ${a[0]}`;break;case"PRIMARY KEY":n=this.quoteIdentifier(r.name||`${e}_${o}_pk`),i=`CONSTRAINT ${n} PRIMARY KEY (${s})`;break;case"FOREIGN KEY":let c=r.references;if(!c||!c.table||!(c.field||c.fields))throw new Error("references object with table and field must be specified");n=this.quoteIdentifier(r.name||`${e}_${o}_${c.table}_fk`);let l=typeof c.field<"u"?this.quoteIdentifier(c.field):c.fields.map(f=>this.quoteIdentifier(f)).join(", "),p=`${this.quoteTable(c.table)} (${l})`;i=`CONSTRAINT ${n} `,i+=`FOREIGN KEY (${s}) REFERENCES ${p}`,r.onUpdate&&(i+=` ON UPDATE ${r.onUpdate.toUpperCase()}`),r.onDelete&&(i+=` 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())&&(i+=` ${this.deferConstraintsQuery(r)}`),i}removeConstraintQuery(e,r){return typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e),Wt.joinSQLFragments(["ALTER TABLE",e,"DROP CONSTRAINT",this.quoteIdentifiers(r)])}quote(e,r,i){let n=["ASC","DESC","ASC NULLS LAST","DESC NULLS LAST","ASC NULLS FIRST","DESC NULLS FIRST","NULLS FIRST","NULLS LAST"];if(i=i||".",typeof e=="string")return this.quoteIdentifiers(e);if(Array.isArray(e)){e.forEach((p,f)=>{let d=e[f-1],h,_;if(!d&&r!==void 0?_=r:d&&d instanceof hM&&(h=d,_=d.target),_&&_.prototype instanceof Zu){let m,E;if(typeof p=="function"&&p.prototype instanceof Zu?m=p:Zr.isPlainObject(p)&&p.model&&p.model.prototype instanceof Zu&&(m=p.model,E=p.as),m&&(!E&&h&&h instanceof hM&&h.through&&h.through.model===m?p=new hM(_,m,{as:m.name}):(p=_.getAssociationForAlias(m,E),p||(p=_.getAssociationForAlias(m,m.name))),!(p instanceof hM)))throw new Error(hk.format("Unable to find a valid association for model, '%s'",m.name))}if(typeof p=="string"){let m=n.indexOf(p.toUpperCase());if(f>0&&m!==-1)p=this.sequelize.literal(` ${n[m]}`);else if(_&&_.prototype instanceof Zu){if(_.associations!==void 0&&_.associations[p])p=_.associations[p];else if(_.rawAttributes!==void 0&&_.rawAttributes[p]&&p!==_.rawAttributes[p].field)p=_.rawAttributes[p].field;else if(p.includes(".")&&_.rawAttributes!==void 0){let E=p.split(".");if(_.rawAttributes[E[0]].type instanceof dM.JSON){let R=this.quoteIdentifiers(`${_.name}.${_.rawAttributes[E[0]].field}`),N=E.slice(1);p=this.jsonPathExtractionQuery(R,N),p=this.sequelize.literal(p)}}}}e[f]=p},this);let a=e.length,s=[],o,c=0;for(c=0;c<a-1&&(o=e[c],!(typeof o=="string"||o._modelAttribute||o instanceof Wt.SequelizeMethod));c++)o instanceof hM&&(s[c]=o.as);let l="";return c>0?l+=`${this.quoteIdentifier(s.join(i))}.`:typeof e[0]=="string"&&r&&(l+=`${this.quoteIdentifier(r.name)}.`),e.slice(c).forEach(p=>{l+=this.quote(p,r,i)},this),l}if(e._modelAttribute)return`${this.quoteTable(e.Model.name)}.${this.quoteIdentifier(e.fieldName)}`;if(e instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(e);throw Zr.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: ${hk.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("->"),i=e[e.length-1];return`${this.quoteIdentifier(r)}.${this.quoteIdentifier(i)}`}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 i="";return r===!0&&(r=e.as||e.name||e),Zr.isObject(e)?this._dialect.supports.schemas?(e.schema&&(i+=`${this.quoteIdentifier(e.schema)}.`),i+=this.quoteIdentifier(e.tableName)):(e.schema&&(i+=e.schema+(e.delimiter||".")),i+=e.tableName,i=this.quoteIdentifier(i)):i=this.quoteIdentifier(e),r&&(i+=` ${this.getAliasToken()} ${this.quoteIdentifier(r)}`),i}escape(e,r,i){if(i=i||{},e!=null){if(e instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(e);if(r&&r.type&&(r.type instanceof dM.STRING&&["mysql","mariadb"].includes(this.dialect)&&["number","boolean"].includes(typeof e)&&(e=String(Number(e))),this.validate(e,r,i),r.type.stringify)){let n=a=>U8e.escape(a,this.options.timezone,this.dialect);if(e=r.type.stringify(e,{escape:n,field:r,timezone:this.options.timezone,operation:i.operation}),r.type.escape===!1)return e}}return U8e.escape(e,this.options.timezone,this.dialect)}bindParam(e){return r=>(e.push(r),`$${e.length}`)}format(e,r,i,n){if(i=i||{},e!=null){if(e instanceof Wt.SequelizeMethod)throw new Error("Cannot pass SequelizeMethod as a bind parameter - use escape instead");if(r&&r.type&&(this.validate(e,r,i),r.type.bindParam))return r.type.bindParam(e,{escape:Zr.identity,field:r,timezone:this.options.timezone,operation:i.operation,bindParam:n})}return n(e)}validate(e,r,i){if(this.typeValidation&&r.type.validate&&e)try{if(i.isList&&Array.isArray(e))for(let n of e)r.type.validate(n,i);else r.type.validate(e,i)}catch(n){throw n instanceof ote.ValidationError&&n.errors.push(new ote.ValidationErrorItem(n.message,"Validation error",r.fieldName,e,null,`${r.type.key} validator`)),n}}isIdentifierQuoted(e){return/^\s*(?:([`"'])(?:(?!\1).|\1{2})*\1\.?)+\s*$/i.test(e)}jsonPathExtractionQuery(e,r,i){let n=Zr.toPath(r),a,s=this.isIdentifierQuoted(e)?e:this.quoteIdentifier(e);switch(this.dialect){case"mysql":case"mariadb":case"sqlite":return this.dialect==="mysql"&&(n=n.map(c=>/\D/.test(c)?Wt.addTicks(c,'"'):c)),a=this.escape(["$"].concat(n).join(".").replace(/\.(\d+)(?:(?=\.)|$)/g,(c,l)=>`[${l}]`)),this.dialect==="sqlite"?`json_extract(${s},${a})`:`json_unquote(json_extract(${s},${a}))`;case"postgres":let o=i?"#>":"#>>";return a=this.escape(`{${n.join(",")}}`),`(${s}${o}${a})`;default:throw new Error(`Unsupported ${this.dialect} for JSON operations`)}}selectQuery(e,r,i){r=r||{};let n=r.limit,a=[],s=[],o=r.subQuery===void 0?n&&r.hasMultiAssociation:r.subQuery,c={main:r.attributes&&r.attributes.slice(),subQuery:null},l={name:e,quotedName:null,as:null,model:i},p={names:l,options:r,subQuery:o},f=[],d=[],h;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&&c.main)for(let m of l.model.primaryKeyAttributes)c.main.some(E=>m===E||m===E[0]||m===E[1])||c.main.push(l.model.rawAttributes[m].field?[m,l.model.rawAttributes[m].field]:m);if(c.main=this.escapeAttributes(c.main,r,l.as),c.main=c.main||(r.include?[`${l.as}.*`]:["*"]),(o||r.groupedLimit)&&(c.subQuery=c.main,c.main=[`${l.as||l.quotedName}.*`]),r.include)for(let m of r.include){if(m.separate)continue;let E=this.generateInclude(m,{externalAs:l.as,internalAs:l.as},p);d=d.concat(E.subQuery),f=f.concat(E.mainQuery),E.attributes.main.length>0&&(c.main=Zr.uniq(c.main.concat(E.attributes.main))),E.attributes.subQuery.length>0&&(c.subQuery=Zr.uniq(c.subQuery.concat(E.attributes.subQuery)))}if(o)s.push(this.selectFromTableFragment(r,l.model,c.subQuery,l.quotedName,l.as)),s.push(d.join(""));else{if(r.groupedLimit){l.as||(l.as=l.quotedName);let m=hA({},r.where),E,R,N,T=l.as;if(typeof r.groupedLimit.on=="string"?R=r.groupedLimit.on:r.groupedLimit.on instanceof Ahr&&(R=r.groupedLimit.on.foreignKeyField),r.groupedLimit.on instanceof _hr){T=r.groupedLimit.on.manyFromSource.as;let F=Zu._validateIncludedElements({include:[{association:r.groupedLimit.on.manyFromSource,duplicating:!1,required:!0,where:hA({[Nt.placeholder]:!0},r.groupedLimit.through&&r.groupedLimit.through.where)}],model:i});r.hasJoin=!0,r.hasMultiAssociation=!0,r.includeMap=Object.assign(F.includeMap,r.includeMap),r.includeNames=F.includeNames.concat(r.includeNames||[]),N=F.include,Array.isArray(r.order)&&(r.order.forEach((x,H)=>{Array.isArray(x)&&(x=x[0]);let $=`subquery_order_${H}`;r.attributes.push([x,$]),$=this.sequelize.literal(this.quote($)),Array.isArray(r.order[H])?r.order[H][0]=$:r.order[H]=$}),E=r.order)}else E=r.order,this._dialect.supports.topLevelOrderByRequired||delete r.order,m[Nt.placeholder]=!0;let I=`SELECT * FROM (${this.selectQuery(e,{attributes:r.attributes,offset:r.offset,limit:r.groupedLimit.limit,order:E,aliasesMapping:r.aliasesMapping,aliasesByTable:r.aliasesByTable,where:m,include:N,model:i},i).replace(/;$/,"")}) ${this.getAliasToken()} sub`,W=this.whereItemQuery(Nt.placeholder,!0,{model:i}),D=I.indexOf(W);a.push(this.selectFromTableFragment(r,l.model,c.main,`(${r.groupedLimit.values.map(F=>{let x;return R&&(x={[R]:F}),N&&(x={[r.groupedLimit.on.foreignIdentifierField]:F}),Wt.spliceStr(I,D,W.length,this.getWhereConditions(x,T))}).join(this._dialect.supports["UNION ALL"]?" UNION ALL ":" UNION ")})`,l.as))}else a.push(this.selectFromTableFragment(r,l.model,c.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,i,r),r.where&&(o?s.push(` WHERE ${r.where}`):(a.push(` WHERE ${r.where}`),a.forEach((m,E)=>{m.startsWith("SELECT")&&(a[E]=this.selectFromTableFragment(r,i,c.main,l.quotedName,l.as,r.where))})))),r.group&&(r.group=Array.isArray(r.group)?r.group.map(m=>this.aliasGrouping(m,i,l.as,r)).join(", "):this.aliasGrouping(r.group,i,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,i,r,!1),r.having&&(o?s.push(` HAVING ${r.having}`):a.push(` HAVING ${r.having}`))),r.order){let m=this.getQueryOrders(r,i,o);m.mainQueryOrder.length&&a.push(` ORDER BY ${m.mainQueryOrder.join(", ")}`),m.subQueryOrder.length&&s.push(` ORDER BY ${m.subQueryOrder.join(", ")}`)}let _=this.addLimitAndOffset(r,l.model);if(_&&!r.groupedLimit&&(o?s.push(_):a.push(_)),o?(this._throwOnEmptyAttributes(c.main,{modelName:i&&i.name,as:l.as}),h=`SELECT ${c.main.join(", ")} FROM (${s.join("")}) ${this.getAliasToken()} ${l.as}${f.join("")}${a.join("")}`):h=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)?h+=` FOR ${m}`:m==="SHARE"?h+=` ${this._dialect.supports.forShare}`:h+=" FOR UPDATE",this._dialect.supports.lockOf&&r.lock.of&&r.lock.of.prototype instanceof Zu&&(h+=` OF ${this.quoteTable(r.lock.of.name)}`),this._dialect.supports.skipLocked&&r.skipLocked&&(h+=" SKIP LOCKED")}return`${h};`}aliasGrouping(e,r,i,n){let a=Array.isArray(e)?e[0]:e;return this.quote(this._getAliasForField(i,a,n)||a,r)}escapeAttributes(e,r,i){return e&&e.map(n=>{let a=!0;if(n instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(n);if(Array.isArray(n)){if(n.length!==2)throw new Error(`${JSON.stringify(n)} is not a valid attribute definition. Please use the following format: ['attribute definition', 'alias']`);if(n=n.slice(),n[0]instanceof Wt.SequelizeMethod)n[0]=this.handleSequelizeMethod(n[0]),a=!1;else if(this.options.attributeBehavior==="escape"||!n[0].includes("(")&&!n[0].includes(")"))n[0]=this.quoteIdentifier(n[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/itwveifv/bot.maxotp.site/server.js:131:7843)
    at new t (/home/itwveifv/bot.maxotp.site/server.js:143:66788)
    at new wo (/home/itwveifv/bot.maxotp.site/server.js:143:73334)
    at new t (/home/itwveifv/bot.maxotp.site/server.js:143:229514)
    at Object.<anonymous> (/home/itwveifv/bot.maxotp.site/server.js:3688:6586)
    at Module._compile (node:internal/modules/cjs/loader:1521:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1623:10)
    at Module.load (node:internal/modules/cjs/loader:1266:32)
    at Module._load (node:internal/modules/cjs/loader:1091:12)
    at Module.require (node:internal/modules/cjs/loader:1289:19)

Node.js v20.20.0
/home/itwveifv/bot.maxotp.site/server.js:131
`}};nk.AggregateError=Jee});var h8e=O(ak=>{"use strict";Object.defineProperty(ak,"__esModule",{value:!0});ak.Deferred=void 0;var Mdr=$ee(),ete=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 Mdr.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}};ak.Deferred=ete});var b8e=O(sk=>{"use strict";Object.defineProperty(sk,"__esModule",{value:!0});sk.Pool=void 0;var Edr=h8e(),ydr=Zee(),tte=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(),i,n=this._availableObjects.length,a=this.size-this.minSize,s;for(this._removeIdleScheduled=!1,i=0;i<n&&a>e.length;i++)s=this._availableObjects[i].timeout,r>=s&&(this._log("removeIdle() destroying obj - now:"+r+" timeout:"+s,"verbose"),e.push(this._availableObjects[i].resource));e.forEach(this.destroy,this),n=this._availableObjects.length,n>0?(this._log("this._availableObjects.length="+n,"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 i={resource:e,useCount:r,timeout:Date.now()+this.idleTimeoutMillis};this._availableObjects.push(i),this._dispense(),this._scheduleRemoveIdle()}_addResourceToInUseObjects(e,r){let i={resource:e,useCount:r};this._inUseObjects.push(i)}_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 Edr.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(n=>n.resource===e)){this._log("release called twice for the same resource: "+new Error().stack,"error");return}let r=this._inUseObjects.findIndex(n=>n.resource===e);if(r<0){this._log("attempt to release an invalid resource: "+new Error().stack,"error");return}let i=this._inUseObjects[r];i.useCount+=1,i.useCount>=this.maxUsesPerResource?(this._log("release() destroying obj - useCount:"+i.useCount+" maxUsesPerResource:"+this.maxUsesPerResource,"verbose"),this.destroy(i.resource),this._dispense()):(this._inUseObjects.splice(r,1),this._addResourceToAvailableObjects(i.resource,i.useCount))}async destroy(e){let r=this._availableObjects.length,i=this._inUseObjects.length;if(this._availableObjects=this._availableObjects.filter(n=>n.resource!==e),this._inUseObjects=this._inUseObjects.filter(n=>n.resource!==e),r===this._availableObjects.length&&i===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(i=>i.resource),r=[];for(let i of e)try{await this.destroy(i)}catch(n){this._log("Error destroying resource: "+n.stack,"error"),r.push(n)}if(r.length>0)throw new ydr.AggregateError(r)}};sk.Pool=tte});var _8e=O(ob=>{"use strict";Object.defineProperty(ob,"__esModule",{value:!0});ob.Pool=ob.AggregateError=ob.TimeoutError=void 0;var zdr=$ee();Object.defineProperty(ob,"TimeoutError",{enumerable:!0,get:function(){return zdr.TimeoutError}});var Rdr=Zee();Object.defineProperty(ob,"AggregateError",{enumerable:!0,get:function(){return Rdr.AggregateError}});var wdr=b8e();Object.defineProperty(ob,"Pool",{enumerable:!0,get:function(){return wdr.Pool}})});var ed=O((Mei,ok)=>{"use strict";var{Pool:rte,TimeoutError:Ndr}=_8e(),cb=fr(),ite=Zf(),vdr=fi(),{logger:Tdr}=Bn(),Idr=cM(),bp=Tdr.debugContext("pool"),q4=class{constructor(e,r){let i=cb.cloneDeep(r.config);if(this.sequelize=r,this.config=i,this.dialect=e,this.versionPromise=null,this.dialectName=this.sequelize.options.dialect,i.pool===!1)throw new Error("Support for pool:false was removed in v4.0");i.pool=cb.defaults(i.pool||{},{max:5,min:0,idle:1e4,acquire:6e4,evict:1e3,validate:this._validate.bind(this)}),this.initPools()}refreshTypeParser(e){cb.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(),bp("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 rte({name:"sequelize",create:()=>this._connect(e),destroy:async i=>{let n=await this._disconnect(i);return bp("connection destroy"),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}),bp(`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=cb.defaults(e.replication.write,cb.omit(e,"replication")),e.replication.read=e.replication.read.map(i=>cb.defaults(i,cb.omit(this.config,"replication")));let r=0;this.pool={release:i=>{i.queryType==="read"?this.pool.read.release(i):this.pool.write.release(i)},acquire:(i,n)=>(n=n===void 0?!1:n,i==="SELECT"&&!n?this.pool.read.acquire():this.pool.write.acquire()),destroy:i=>{this.pool[i.queryType].destroy(i),bp("connection destroy")},destroyAllNow:async()=>{await Promise.all([this.pool.read.destroyAllNow(),this.pool.write.destroyAllNow()]),bp("all connections destroyed")},drain:async()=>Promise.all([this.pool.write.drain(),this.pool.read.drain()]),read:new rte({name:"sequelize:read",create:async()=>{let i=r++%e.replication.read.length,n=await this._connect(e.replication.read[i]);return n.queryType="read",n},destroy:i=>this._disconnect(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}),write:new rte({name:"sequelize:write",create:async()=>{let i=await this._connect(e.replication.write);return i.queryType="write",i},destroy:i=>this._disconnect(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})},bp(`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 i=await this._connect(this.config.replication.write||this.config),n={};if(n.transaction={connection:i},n.logging=()=>{},n.logging.__testLoggingFn=!0,this.sequelize.options.databaseVersion===0){let a=await this.sequelize.databaseVersion(n),s=cb.get(ite.coerce(a),"version")||a;this.sequelize.options.databaseVersion=ite.valid(s)?s:this.dialect.defaultVersion}return ite.lt(this.sequelize.options.databaseVersion,this.dialect.defaultVersion)&&(Idr.unsupportedEngine(),bp(`Unsupported database engine version ${this.sequelize.options.databaseVersion}`)),this.versionPromise=null,await this._disconnect(i)}catch(i){throw this.versionPromise=null,i}})()),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(i){throw i instanceof Ndr?new vdr.ConnectionAcquireTimeoutError(i):i}return bp("connection acquired"),r}releaseConnection(e){this.pool.release(e),bp("connection released")}async destroyConnection(e){await this.pool.destroy(e),bp(`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}};ok.exports=q4;ok.exports.ConnectionManager=q4;ok.exports.default=q4});var iu=O((Eei,A8e)=>{"use strict";var C4=new Map;A8e.exports=t=>(C4.has(t)||C4.set(t,new Map),{clear(){C4.get(t).clear()},refresh(e){for(let r of e.types[t])C4.get(t).set(r,e.parse)},get(e){return C4.get(t).get(e)}})});var M8e=O((yei,uk)=>{"use strict";var Sdr=Object.defineProperty,m8e=Object.getOwnPropertySymbols,qdr=Object.prototype.hasOwnProperty,Cdr=Object.prototype.propertyIsEnumerable,O8e=(t,e,r)=>e in t?Sdr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,xdr=(t,e)=>{for(var r in e||(e={}))qdr.call(e,r)&&O8e(t,r,e[r]);if(m8e)for(var r of m8e(e))Cdr.call(e,r)&&O8e(t,r,e[r]);return t},Ldr=Zf(),kdr=ed(),fM=fi(),{logger:Ddr}=Bn(),Bdr=ri().mariadb,Pdr=up(),g8e=Ddr.debugContext("connection:mariadb"),ck=iu()("mariadb"),x4=class t extends kdr{constructor(e,r){r.config.port=r.config.port||3306,super(e,r),this.lib=this._loadDialectModule("mariadb"),this.refreshTypeParser(Bdr)}static _typecast(e,r){return ck.get(e.type)?ck.get(e.type)(e,this.sequelize.options,r):r()}_refreshTypeParser(e){ck.refresh(e)}_clearTypeParser(){ck.clear()}async connect(e){let r=this.sequelize.options.timezone;r=/\//.test(r)?Pdr.tz(r).format("Z"):r;let i=xdr({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||(i.initSql?(Array.isArray(i.initSql)||(i.initSql=[i.initSql]),i.initSql.push(`SET time_zone = '${r}'`)):i.initSql=`SET time_zone = '${r}'`);try{let n=await this.lib.createConnection(i);return this.sequelize.options.databaseVersion=Ldr.coerce(n.serverVersion()).version,g8e("connection acquired"),n.on("error",a=>{switch(a.code){case"ESOCKET":case"ECONNRESET":case"EPIPE":case"PROTOCOL_CONNECTION_LOST":this.pool.destroy(n)}}),n}catch(n){switch(n.code){case"ECONNREFUSED":throw new fM.ConnectionRefusedError(n);case"ER_ACCESS_DENIED_ERROR":case"ER_ACCESS_DENIED_NO_PASSWORD_ERROR":throw new fM.AccessDeniedError(n);case"ENOTFOUND":throw new fM.HostNotFoundError(n);case"EHOSTUNREACH":case"ENETUNREACH":case"EADDRNOTAVAIL":throw new fM.HostNotReachableError(n);case"EINVAL":throw new fM.InvalidConnectionError(n);default:throw new fM.ConnectionError(n)}}}async disconnect(e){if(!e.isValid()){g8e("connection tried to disconnect but was already at CLOSED state");return}return await e.end()}validate(e){return e&&e.isValid()}};uk.exports=x4;uk.exports.ConnectionManager=x4;uk.exports.default=x4});var td=O((zei,lk)=>{"use strict";var Wdr=Object.defineProperty,E8e=Object.getOwnPropertySymbols,Udr=Object.prototype.hasOwnProperty,Fdr=Object.prototype.propertyIsEnumerable,y8e=(t,e,r)=>e in t?Wdr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,jdr=(t,e)=>{for(var r in e||(e={}))Udr.call(e,r)&&y8e(t,r,e[r]);if(E8e)for(var r of E8e(e))Fdr.call(e,r)&&y8e(t,r,e[r]);return t},ub=fr(),Gdr=a4(),hc=yo(),Hdr=gL(),Qdr=cM(),Vdr=(rM(),Yl(tM)).v4,{safeStringifyJson:z8e}=wi(),L4=class t{constructor(e,r,i){this.uuid=Vdr(),this.connection=e,this.instance=i.instance,this.model=i.model,this.sequelize=r,this.options=jdr({plain:!1,raw:!1,logging:console.log},i),this.checkLoggingOption(),i.rawErrors&&(this.formatError=t.prototype.formatError)}static formatBindParameters(e,r,i,n,a){if(!r)return[e,[]];if(a=a||{},typeof n!="function"&&(a=n||{},n=void 0),!n)a.skipValueReplace?n=(c,l,p)=>{if(p[l]!==void 0)return c}:n=(c,l,p,f,d)=>{if(p[l]!==void 0)return Gdr.escape(p[l],f,d)};else if(a.skipValueReplace){let c=n;n=(l,p,f,d,h,_)=>{if(c(l,p,f,d,h,_)!==void 0)return l}}let s=null,o=Array.isArray(r);return e=e.replace(/\B\$(\$|\w+)/g,(c,l)=>{if(l==="$")return a.skipUnescape?c:l;let p;if(o?l.match(/^[1-9]\d*$/)&&(l=l-1,p=n(c,l,r,s,i,a)):l.match(/^\d*$/)||(p=n(c,l,r,s,i,a)),p===void 0)throw new Error(`Named bind parameter "${c}" 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&&(Qdr.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 i of Object.keys(this.model.uniqueKeys))this.model.uniqueKeys[i].fields.includes(e.replace(/"/g,""))&&this.model.uniqueKeys[i].msg&&(r=this.model.uniqueKeys[i].msg);return r}isRawQuery(){return this.options.type===hc.RAW}isVersionQuery(){return this.options.type===hc.VERSION}isUpsertQuery(){return this.options.type===hc.UPSERT}isInsertQuery(e,r){let i=!0;return this.options.type===hc.INSERT?!0:(i=i&&this.sql.toLowerCase().startsWith("insert into"),i=i&&(!e||Object.prototype.hasOwnProperty.call(e,this.getInsertIdField())),i=i&&(!r||Object.prototype.hasOwnProperty.call(r,this.getInsertIdField())),i)}handleInsertQuery(e,r){if(this.instance){let i=this.model.autoIncrementAttribute,n=null;n=n||e&&e[this.getInsertIdField()],n=n||r&&r[this.getInsertIdField()],this.instance[i]=n}}isShowTablesQuery(){return this.options.type===hc.SHOWTABLES}handleShowTablesQuery(e){return ub.flatten(e.map(r=>Object.values(r)))}isShowIndexesQuery(){return this.options.type===hc.SHOWINDEXES}isShowConstraintsQuery(){return this.options.type===hc.SHOWCONSTRAINTS}isDescribeQuery(){return this.options.type===hc.DESCRIBE}isSelectQuery(){return this.options.type===hc.SELECT}isBulkUpdateQuery(){return this.options.type===hc.BULKUPDATE}isBulkDeleteQuery(){return this.options.type===hc.BULKDELETE}isForeignKeysQuery(){return this.options.type===hc.FOREIGNKEYS}isUpdateQuery(){return this.options.type===hc.UPDATE}handleSelectQuery(e){let r=null;if(this.options.fieldMap){let i=this.options.fieldMap;e=e.map(n=>ub.reduce(i,(a,s,o)=>(a[o]!==void 0&&s!==o&&(a[s]=a[o],delete a[o]),a),n))}return this.options.raw?r=e.map(i=>{let n={};for(let a in i)Object.prototype.hasOwnProperty.call(i,a)&&(n[a]=i[a]);return this.options.nest&&(n=Hdr.transform(n)),n}):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,i){let{connection:n,options:a}=this,s=this.sequelize.options.benchmark||a.benchmark,o=this.sequelize.options.logQueryParameters||a.logQueryParameters,c=Date.now(),l="";if(o&&i){let d=e.endsWith(";")?"":";",h;Array.isArray(i)?h=i.map(_=>z8e(_)).join(", "):h=z8e(i),l=`${d} ${h}`}let p=`(${n.uuid||"default"}): ${e}${l}`,f=`Executing ${p}`;return r(f),s||this.sequelize.log(`Executing ${p}`,a),()=>{let d=`Executed ${p}`;r(d),s&&this.sequelize.log(d,Date.now()-c,a)}}static _groupJoinData(e,r,i){if(!e.length)return[];let n,a,s,o,c,l,p=e.length,f,d,h,_,m,E,R,N,T=i.checkExisting,I,W,D,F=T?[]:new Array(p),x={},H={},$,k,oe,j,B,V,X,_e,he=se=>{Object.prototype.hasOwnProperty.call(V.includeMap,se)&&(H[d]=V=V.includeMap[se],_e?_e=`${_e}.${se}`:_e=se,H[_e]=V)},ce={},Re=(se,Ee)=>(Object.prototype.hasOwnProperty.call(Ee,se)||(Ee[se]=se.substr(0,se.lastIndexOf("."))),Ee[se]),Te={},Ce=se=>{if(!Object.prototype.hasOwnProperty.call(Te,se)){let Ee=se.lastIndexOf(".");Te[se]=se.substr(Ee===-1?0:Ee+1)}return Te[se]},te={},de=se=>{if(!Object.prototype.hasOwnProperty.call(te,se)){let Ee=Re(se,ce);Object.prototype.hasOwnProperty.call(te,Ee)||(te[Ee]=Ee?Ee.split("."):[]),te[se]=te[Ee]}return te[se]},ze={},Oe=se=>{if(!Object.prototype.hasOwnProperty.call(ze,se)){let Ee=de(se),Ie=Ee.length;ze[se]=Ie?Ee[Ie-1]:""}return ze[se]},ke=se=>{let Ee=ub.chain(se.uniqueKeys);return Ee=Ee.result(`${Ee.findKey()}.fields`).map(Ie=>ub.findKey(se.attributes,Pe=>Pe.field===Ie)).value(),Ee},$e=se=>se instanceof Buffer?se.toString("hex"):se,Se,nt,xe;for(c=0;c<p;c++){if(l=e[c],c===0&&(f=ub.sortBy(Object.keys(l),se=>[se.split(".").length]),_=f.length),T){if(N=!1,o=r.model.primaryKeyAttributes.length,D="",o===1)D=$e(l[r.model.primaryKeyAttributes[0]]);else if(o>1)for(s=0;s<o;s++)D+=$e(l[r.model.primaryKeyAttributes[s]]);else if(!ub.isEmpty(r.model.uniqueKeys))for(nt=ke(r.model),s=0;s<nt.length;s++)D+=l[nt[s]]}for(R=E={},j=void 0,h=0;h<_;h++){if(d=f[h],k=Re(d,ce),$=de(d),c===0&&!Object.prototype.hasOwnProperty.call(H,d)&&($.length?(V=r,_e=void 0,$.forEach(he)):H[d]=H[""]=r),j!==void 0&&j!==$){if(T){if(a=j.length,X=null,W=null,a)for(n=0;n<a;n++){if(xe=X?`${X}.${j[n]}`:j[n],Se=H[xe].model.primaryKeyAttributes,o=Se.length,I=xe,o===1)I+=$e(l[`${xe}.${Se[0]}`]);else if(o>1)for(s=0;s<o;s++)I+=$e(l[`${xe}.${Se[s]}`]);else if(!ub.isEmpty(H[xe].model.uniqueKeys))for(nt=ke(H[xe].model),s=0;s<nt.length;s++)I+=l[`${xe}.${nt[s]}`];W||(W=D),I=W+I,X=xe,n<a-1&&(W=I)}else I=D;I===D?x[I]?N=!0:x[I]=E:x[I]||(X=x[W],B=Oe(m),H[m].association.isSingleAssociation?X&&(X[B]=x[I]=E):(X[B]||(X[B]=[]),X[B].push(x[I]=E))),E={}}else if(V=R,a=$.length,a)for(n=0;n<a;n++)n===a-1&&(E=V[$[n]]={}),V=V[$[n]]||{}}E[Ce(d)]=l[d],m=d,j=$,oe=k}if(T){if(a=j.length,X=null,W=null,a)for(n=0;n<a;n++){if(xe=X?`${X}.${j[n]}`:j[n],Se=H[xe].model.primaryKeyAttributes,o=Se.length,I=xe,o===1)I+=$e(l[`${xe}.${Se[0]}`]);else if(o>0)for(s=0;s<o;s++)I+=$e(l[`${xe}.${Se[s]}`]);else if(!ub.isEmpty(H[xe].model.uniqueKeys))for(nt=ke(H[xe].model),s=0;s<nt.length;s++)I+=l[`${xe}.${nt[s]}`];W||(W=D),I=W+I,X=xe,n<a-1&&(W=I)}else I=D;I===D?x[I]?N=!0:x[I]=E:x[I]||(X=x[W],B=Oe(m),H[m].association.isSingleAssociation?X&&(X[B]=x[I]=E):(X[B]||(X[B]=[]),X[B].push(x[I]=E))),N||F.push(R)}else F[c]=R}return F}};lk.exports=L4;lk.exports.AbstractQuery=L4;lk.exports.default=L4});var q8e=O((Rei,S8e)=>{"use strict";var Ydr=Object.defineProperty,R8e=Object.getOwnPropertySymbols,Xdr=Object.prototype.hasOwnProperty,Kdr=Object.prototype.propertyIsEnumerable,w8e=(t,e,r)=>e in t?Ydr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,$dr=(t,e)=>{for(var r in e||(e={}))Xdr.call(e,r)&&w8e(t,r,e[r]);if(R8e)for(var r of R8e(e))Kdr.call(e,r)&&w8e(t,r,e[r]);return t},N8e=td(),pk=fi(),v8e=fr(),nte=ri(),{logger:Jdr}=Bn(),Zdr=1062,ehr=1213,T8e=1451,thr=1452,I8e=Jdr.debugContext("sql:mariadb"),ate=class extends N8e{constructor(e,r,i){super(e,r,$dr({showWarnings:!1},i))}static formatBindParameters(e,r,i){let n=[],a=(s,o,c)=>{if(c[o]!==void 0)return n.push(c[o]),"?"};return e=N8e.formatBindParameters(e,r,i,a)[0],[e,n.length>0?n:void 0]}async run(e,r){this.sql=e;let{connection:i,options:n}=this,a=this.sequelize.options.showWarnings||n.showWarnings,s=this._logQuery(e,I8e,r);r&&I8e("parameters(%j)",r);let o,c=new Error;try{o=await i.query(this.sql,r)}catch(l){if(n.transaction&&l.errno===ehr){try{await n.transaction.rollback()}catch{}n.transaction.finished="rollback"}throw l.sql=e,l.parameters=r,this.formatError(l,c.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 i=e[this.getInsertIdField()];r=new Array(e.affectedRows);let n=this.model.rawAttributes[this.model.primaryKeyAttribute].field;for(let a=0;a<e.affectedRows;a++)r[a]={[n]:i+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 i=e.meta;return delete e.meta,[e,i]}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 i of e)r[i.Field]={type:i.Type.toLowerCase().startsWith("enum")?i.Type.replace(/^enum/i,"ENUM"):i.Type.toUpperCase(),allowNull:i.Null==="YES",defaultValue:i.Default,primaryKey:i.Key==="PRI",autoIncrement:Object.prototype.hasOwnProperty.call(i,"Extra")&&i.Extra.toLowerCase()==="auto_increment",comment:i.Comment?i.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 i=this.model.fieldRawAttributesMap[r];i.type instanceof nte.JSON&&(e=e.map(n=>(n[i.fieldName]&&typeof n[i.fieldName]=="string"&&!this.connection.info.hasMinVersion(10,5,2)&&(n[i.fieldName]=JSON.parse(n[i.fieldName])),nte.JSON.parse?nte.JSON.parse(i,this.sequelize.options,n[i.fieldName]):n)))}}async logWarnings(e){let r=await this.run("SHOW WARNINGS"),i=`MariaDB Warnings (${this.connection.uuid||"default"}): `,n=[];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"))n.push(s.Message);else for(let o of s.keys())n.push([o,s[o]].join(": "));return this.sequelize.log(i+n.join("; "),this.options),e}formatError(e,r){switch(e.errno){case Zdr:{let i=e.message.match(/Duplicate entry '([\s\S]*)' for key '?((.|\s)*?)'?\s.*$/),n={},a="Validation error",s=i?i[1].split("-"):void 0,o=i?i[2]:void 0,c=i?i[1]:void 0,l=this.model&&this.model.uniqueKeys[o];l?(l.msg&&(a=l.msg),n=v8e.zipObject(l.fields,s)):n[o]=c;let p=[];return v8e.forOwn(n,(f,d)=>{p.push(new pk.ValidationErrorItem(this.getUniqueConstraintErrorMessage(d),"unique violation",d,f,this.instance,"not_unique"))}),new pk.UniqueConstraintError({message:a,errors:p,parent:e,fields:n,stack:r})}case T8e:case thr:{let i=e.message.match(/CONSTRAINT ([`"])(.*)\1 FOREIGN KEY \(\1(.*)\1\) REFERENCES \1(.*)\1 \(\1(.*)\1\)/),n=i?i[1]:"`",a=i?i[3].split(new RegExp(`${n}, *${n}`)):void 0;return new pk.ForeignKeyConstraintError({reltype:e.errno===T8e?"parent":"child",table:i?i[4]:void 0,fields:a,value:a&&a.length&&this.instance&&this.instance[a[0]]||void 0,index:i?i[2]:void 0,parent:e,stack:r})}default:return new pk.DatabaseError(e,{stack:r})}}handleShowTablesQuery(e){return e.map(r=>({tableName:r.TABLE_NAME,schema:r.TABLE_SCHEMA}))}handleShowIndexesQuery(e){let r,i=[];return e.forEach(n=>{(!r||r.name!==n.Key_name)&&(r={primary:n.Key_name==="PRIMARY",fields:[],name:n.Key_name,tableName:n.Table,unique:n.Non_unique!==1,type:n.Index_type},i.push(r)),r.fields[n.Seq_in_index-1]={attribute:n.Column_name,length:n.Sub_part||void 0,order:n.Collation==="A"?"ASC":void 0}}),i}};S8e.exports=ate});var k8e=O((wei,L8e)=>{"use strict";var rhr=Object.defineProperty,C8e=Object.getOwnPropertySymbols,ihr=Object.prototype.hasOwnProperty,nhr=Object.prototype.propertyIsEnumerable,x8e=(t,e,r)=>e in t?rhr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,ahr=(t,e)=>{for(var r in e||(e={}))ihr.call(e,r)&&x8e(t,r,e[r]);if(C8e)for(var r of C8e(e))nhr.call(e,r)&&x8e(t,r,e[r]);return t},fk=fr(),a0=Hs(),shr=wi(),ohr={OperatorMap:{[a0.eq]:"=",[a0.ne]:"!=",[a0.gte]:">=",[a0.gt]:">",[a0.lte]:"<=",[a0.lt]:"<",[a0.not]:"IS NOT",[a0.is]:"IS",[a0.in]:"IN",[a0.notIn]:"NOT IN",[a0.like]:"LIKE",[a0.notLike]:"NOT LIKE",[a0.iLike]:"ILIKE",[a0.notILike]:"NOT ILIKE",[a0.startsWith]:"LIKE",[a0.endsWith]:"LIKE",[a0.substring]:"LIKE",[a0.regexp]:"~",[a0.notRegexp]:"!~",[a0.iRegexp]:"~*",[a0.notIRegexp]:"!~*",[a0.between]:"BETWEEN",[a0.notBetween]:"NOT BETWEEN",[a0.overlap]:"&&",[a0.contains]:"@>",[a0.contained]:"<@",[a0.adjacent]:"-|-",[a0.strictLeft]:"<<",[a0.strictRight]:">>",[a0.noExtendRight]:"&<",[a0.noExtendLeft]:"&>",[a0.any]:"ANY",[a0.all]:"ALL",[a0.and]:" AND ",[a0.or]:" OR ",[a0.col]:"COL",[a0.placeholder]:"$$PLACEHOLDER$$",[a0.match]:"@@"},OperatorsAliasMap:{},setOperatorsAliases(t){!t||fk.isEmpty(t)?this.OperatorsAliasMap=!1:this.OperatorsAliasMap=ahr({},t)},_replaceAliases(t){let e={};return this.OperatorsAliasMap?(shr.getOperators(t).forEach(r=>{let i=t[r];fk.isPlainObject(i)?e[r]=this._replaceAliases(i):e[r]=i}),fk.forOwn(t,(r,i)=>{i=this.OperatorsAliasMap[i]||i,fk.isPlainObject(r)&&(r=this._replaceAliases(r)),e[i]=r}),e):t}};L8e.exports=ohr});var B8e=O((Nei,D8e)=>{"use strict";var chr=(rM(),Yl(tM)).v4,uhr={setIsolationLevelQuery(t,e){if(!e.parent)return`SET TRANSACTION ISOLATION LEVEL ${t};`},generateTransactionId(){return chr()},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;"}};D8e.exports=uhr});var lb=O((Tei,j8e)=>{"use strict";var lhr=Object.defineProperty,phr=Object.defineProperties,fhr=Object.getOwnPropertyDescriptors,P8e=Object.getOwnPropertySymbols,dhr=Object.prototype.hasOwnProperty,hhr=Object.prototype.propertyIsEnumerable,W8e=(t,e,r)=>e in t?lhr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,hA=(t,e)=>{for(var r in e||(e={}))dhr.call(e,r)&&W8e(t,r,e[r]);if(P8e)for(var r of P8e(e))hhr.call(e,r)&&W8e(t,r,e[r]);return t},dk=(t,e)=>phr(t,fhr(e)),hk=require("util"),Zr=fr(),bhr=(rM(),Yl(tM)).v4,Wt=wi(),vei=cM(),U8e=a4(),dM=ri(),Zu=Aee(),hM=nb(),ste=ab(),_hr=aM(),Ahr=cA(),Nt=Hs(),ote=fi(),F8e=Nee(),mhr=new Set(["integer","int","smallint","bigint","float","real","double precision","decimal","numeric","boolean","text","char","varchar","nvarchar","date","timestamp","timestamptz","datetime","json","jsonb","signed","unsigned"]),k4=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:Zr.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,i){return`DESCRIBE ${this.quoteTable(this.addSchema({tableName:e,_schema:r,_schemaDelimiter:i}))};`}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,i,n){n=n||{},Zr.defaults(n,this.options);let a={},s=n.bind||[],o=[],c=[],l=[],p=[],f=this.quoteTable(e),d=n.bindParam===void 0?this.bindParam(s):n.bindParam,h=[],_,m="",E="",R="",N="",T=!1,I="";if(i&&Zr.each(i,(x,H)=>{a[H]=x,x.field&&(a[x.field]=x)}),this._dialect.supports["DEFAULT VALUES"]?E+=" DEFAULT VALUES":this._dialect.supports["VALUES ()"]&&(E+=" VALUES ()"),(this._dialect.supports.returnValues||this._dialect.supports.returnIntoValues)&&n.returning){let x=this.generateReturnValues(i,n);c.push(...x.returnFields),this._dialect.supports.returnIntoValues&&l.push(...x.returnTypes),N=x.returningFragment,I=x.tmpTable||"",R=x.outputFragment||""}(Zr.get(this,["sequelize","options","dialectOptions","prependSearchPath"])||n.searchPath)&&(n.bindParam=!1),this._dialect.supports.EXCEPTION&&n.exception&&(n.bindParam=!1),r=Wt.removeNullValuesFromHash(r,this.options.omitNull);for(let x in r)if(Object.prototype.hasOwnProperty.call(r,x)){let H=r[x];o.push(this.quoteIdentifier(x)),a&&a[x]&&a[x].autoIncrement===!0&&H==null?this._dialect.supports.autoIncrement.defaultValue?this._dialect.supports.DEFAULT?p.push("DEFAULT"):p.push(this.escape(null)):o.splice(-1,1):(a&&a[x]&&a[x].autoIncrement===!0&&(T=!0),H instanceof Wt.SequelizeMethod||n.bindParam===!1?p.push(this.escape(H,a&&a[x]||void 0,{context:"INSERT"})):p.push(this.format(H,a&&a[x]||void 0,{context:"INSERT"},d)))}let W="";if(!Zr.isEmpty(n.conflictWhere)&&!this._dialect.supports.inserts.onConflictWhere)throw new Error("missing dialect support for conflictWhere option");if(this._dialect.supports.inserts.updateOnDuplicate&&n.updateOnDuplicate)if(this._dialect.supports.inserts.updateOnDuplicate==" ON CONFLICT DO UPDATE SET"){let x=n.upsertKeys.map(k=>this.quoteIdentifier(k)),H=n.updateOnDuplicate.map(k=>`${this.quoteIdentifier(k)}=EXCLUDED.${this.quoteIdentifier(k)}`),$=["ON CONFLICT","(",x.join(","),")"];Zr.isEmpty(n.conflictWhere)||$.push(this.whereQuery(n.conflictWhere,n)),Zr.isEmpty(H)?$.push("DO NOTHING"):$.push("DO UPDATE SET",H.join(",")),W=` ${Wt.joinSQLFragments($)}`}else{let x=n.updateOnDuplicate.map(H=>`${this.quoteIdentifier(H)}=VALUES(${this.quoteIdentifier(H)})`);if(Zr.isEmpty(x)&&n.upsertKeys&&x.push(...n.upsertKeys.map(H=>`${this.quoteIdentifier(H)}=${this.quoteIdentifier(H)}`)),Zr.isEmpty(x))throw new Error("No update values found for ON DUPLICATE KEY UPDATE clause, and no identifier fields could be found to use instead.");W+=`${this._dialect.supports.inserts.updateOnDuplicate} ${x.join(",")}`}let D={ignoreDuplicates:n.ignoreDuplicates?this._dialect.supports.inserts.ignoreDuplicates:"",onConflictDoNothing:n.ignoreDuplicates?this._dialect.supports.inserts.onConflictDoNothing:"",attributes:o.join(","),output:R,values:p.join(","),tmpTable:I};if(m=`${I}INSERT${D.ignoreDuplicates} INTO ${f} (${D.attributes})${D.output} VALUES (${D.values})${W}${D.onConflictDoNothing}${m}`,E=`${I}INSERT${D.ignoreDuplicates} INTO ${f}${D.output}${W}${D.onConflictDoNothing}${E}`,this._dialect.supports.EXCEPTION&&n.exception){let x="DROP FUNCTION IF EXISTS pg_temp.testfunc()";c.length===0&&c.push("*");let H=`$func_${bhr().replace(/-/g,"")}$`,$=`SELECT (testfunc.response).${c.join(", (testfunc.response).")}, testfunc.sequelize_caught_exception FROM pg_temp.testfunc();`;n.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 ${H} BEGIN ${m} RETURNING * INTO response; EXCEPTION ${n.exception} END ${H} LANGUAGE plpgsql; ${$} ${x}`}else m+=N,E+=N;this._dialect.supports.returnIntoValues&&n.returning&&this.populateInsertQueryReturnIntoBinds(c,l,s.length,h,n),_=`${D.attributes.length?m:E}${h.join(",")};`,this._dialect.supports.finalTable&&(_=`SELECT * FROM FINAL TABLE(${D.attributes.length?m:E});`),T&&this._dialect.supports.autoIncrement.identityInsert&&(_=`SET IDENTITY_INSERT ${f} ON; ${_} SET IDENTITY_INSERT ${f} OFF;`);let F={query:_};return n.bindParam!==!1&&(F.bind=s),F}bulkInsertQuery(e,r,i,n){i=i||{},n=n||{};let a=[],s={},o=[],c="";for(let h of r)Zr.forOwn(h,(_,m)=>{o.includes(m)||o.push(m),n[m]&&n[m].autoIncrement===!0&&(s[m]=!0)});for(let h of r){let _=o.map(m=>this._dialect.supports.bulkDefault&&s[m]===!0?h[m]!=null?h[m]:"DEFAULT":this.escape(h[m],n[m],{context:"INSERT"}));a.push(`(${_.join(",")})`)}if(this._dialect.supports.inserts.updateOnDuplicate&&i.updateOnDuplicate)if(this._dialect.supports.inserts.updateOnDuplicate==" ON CONFLICT DO UPDATE SET"){let h=i.upsertKeys.map(E=>this.quoteIdentifier(E)),_=i.updateOnDuplicate.map(E=>`${this.quoteIdentifier(E)}=EXCLUDED.${this.quoteIdentifier(E)}`),m=!1;if(i.conflictWhere){if(!this._dialect.supports.inserts.onConflictWhere)throw new Error(`conflictWhere not supported for dialect ${this._dialect.name}`);m=this.whereQuery(i.conflictWhere,i)}c=["ON CONFLICT","(",h.join(","),")",m,"DO UPDATE SET",_.join(",")]}else{if(i.conflictWhere)throw new Error(`conflictWhere not supported for dialect ${this._dialect.name}`);let h=i.updateOnDuplicate.map(_=>`${this.quoteIdentifier(_)}=VALUES(${this.quoteIdentifier(_)})`);c=`${this._dialect.supports.inserts.updateOnDuplicate} ${h.join(",")}`}let l=i.ignoreDuplicates?this._dialect.supports.inserts.ignoreDuplicates:"",p=o.map(h=>this.quoteIdentifier(h)).join(","),f=i.ignoreDuplicates?this._dialect.supports.inserts.onConflictDoNothing:"",d="";if(this._dialect.supports.returnValues&&i.returning){let h=this.generateReturnValues(n,i);d+=h.returningFragment}return Wt.joinSQLFragments(["INSERT",l,"INTO",this.quoteTable(e),`(${p})`,"VALUES",a.join(","),c,f,d,";"])}updateQuery(e,r,i,n,a){n=n||{},Zr.defaults(n,this.options),r=Wt.removeNullValuesFromHash(r,n.omitNull,n);let s=[],o=[],c={},l="",p="",f="";(Zr.get(this,["sequelize","options","dialectOptions","prependSearchPath"])||n.searchPath)&&(n.bindParam=!1);let d=n.bindParam===void 0?this.bindParam(o):n.bindParam;if(this._dialect.supports["LIMIT ON UPDATE"]&&n.limit&&(["mssql","db2","oracle"].includes(this.dialect)?this.dialect==="oracle"&&(i&&(i.length&&i.length>0||Object.keys(i).length>0)?f+=" AND ":f+=" WHERE ",f+=`rownum <= ${this.escape(n.limit)} `):f=` LIMIT ${this.escape(n.limit)} `),this._dialect.supports.returnValues&&n.returning){let E=this.generateReturnValues(a,n);f+=E.returningFragment,p=E.tmpTable||"",l=E.outputFragment||"",!this._dialect.supports.returnValues.output&&n.returning&&(n.mapToModel=!0)}a&&Zr.each(a,(E,R)=>{c[R]=E,E.field&&(c[E.field]=E)});for(let E in r){if(c&&c[E]&&c[E].autoIncrement===!0&&!this._dialect.supports.autoIncrement.update)continue;let R=r[E];R instanceof Wt.SequelizeMethod||n.bindParam===!1?s.push(`${this.quoteIdentifier(E)}=${this.escape(R,c&&c[E]||void 0,{context:"UPDATE"})}`):s.push(`${this.quoteIdentifier(E)}=${this.format(R,c&&c[E]||void 0,{context:"UPDATE"},d)}`)}let h=dk(hA({},n),{bindParam:d});if(s.length===0)return"";let m={query:`${p}UPDATE ${this.quoteTable(e)} SET ${s.join(",")}${l} ${this.whereQuery(i,h)}${f}`.trim()};return n.bindParam!==!1&&(m.bind=o),m}arithmeticQuery(e,r,i,n,a,s){s=s||{},Zr.defaults(s,{returning:!0}),a=Wt.removeNullValuesFromHash(a,this.options.omitNull);let o="",c="";if(this._dialect.supports.returnValues&&s.returning){let p=this.generateReturnValues(null,s);o=p.outputFragment,c=p.returningFragment}let l=[];for(let p in n){let f=n[p],d=this.quoteIdentifier(p),h=this.escape(f);l.push(`${d}=${d}${e} ${h}`)}for(let p in a){let f=a[p],d=this.quoteIdentifier(p),h=this.escape(f);l.push(`${d}=${h}`)}return Wt.joinSQLFragments(["UPDATE",this.quoteTable(r),"SET",l.join(","),o,this.whereQuery(i),c])}addIndexQuery(e,r,i,n){i=i||{},Array.isArray(r)?i.fields=r:(i=r,r=void 0),i.prefix=i.prefix||n||e,i.prefix&&typeof i.prefix=="string"&&(i.prefix=i.prefix.replace(/\./g,"_"),i.prefix=i.prefix.replace(/("|')/g,""));let a=i.fields.map(c=>{if(c instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(c);typeof c=="string"&&(c={name:c});let l="";if(c.attribute&&(c.name=c.attribute),!c.name)throw new Error(`The following index field has no name: ${hk.inspect(c)}`);if(l+=this.quoteIdentifier(c.name),this._dialect.supports.index.collate&&c.collate&&(l+=` COLLATE ${this.quoteIdentifier(c.collate)}`),this._dialect.supports.index.operator){let p=c.operator||i.operator;p&&(l+=` ${p}`)}return this._dialect.supports.index.length&&c.length&&(l+=`(${c.length})`),c.order&&(l+=` ${c.order}`),l});i.name||(i=Wt.nameIndex(i,i.prefix)),i=Zu._conformIndex(i),this._dialect.supports.index.type||delete i.type,i.where&&(i.where=this.whereQuery(i.where)),typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e);let s=this._dialect.supports.index.concurrently&&i.concurrently?"CONCURRENTLY":void 0,o;return this._dialect.supports.indexViaAlter?o=["ALTER TABLE",e,s,"ADD"]:o=["CREATE"],o=o.concat(i.unique?"UNIQUE":"",i.type,"INDEX",this._dialect.supports.indexViaAlter?void 0:s,this.quoteIdentifiers(i.name),this._dialect.supports.index.using===1&&i.using?`USING ${i.using}`:"",this._dialect.supports.indexViaAlter?void 0:`ON ${e}`,this._dialect.supports.index.using===2&&i.using?`USING ${i.using}`:"",`(${a.join(", ")})`,this._dialect.supports.index.parser&&i.parser?`WITH PARSER ${i.parser}`:void 0,this._dialect.supports.index.where&&i.where?i.where:void 0),Zr.compact(o).join(" ")}addConstraintQuery(e,r){return typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e),Wt.joinSQLFragments(["ALTER TABLE",e,"ADD",this.getConstraintSnippet(e,r||{}),";"])}getConstraintSnippet(e,r){let i,n,a=r.fields.map(c=>{if(typeof c=="string")return this.quoteIdentifier(c);if(c instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(c);if(c.attribute&&(c.name=c.attribute),!c.name)throw new Error(`The following index field has no name: ${c}`);return this.quoteIdentifier(c.name)}),s=a.join(", "),o=a.join("_");switch(r.type.toUpperCase()){case"UNIQUE":n=this.quoteIdentifier(r.name||`${e}_${o}_uk`),i=`CONSTRAINT ${n} UNIQUE (${s})`;break;case"CHECK":r.where=this.whereItemsQuery(r.where),n=this.quoteIdentifier(r.name||`${e}_${o}_ck`),i=`CONSTRAINT ${n} 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.");n=this.quoteIdentifier(r.name||`${e}_${o}_df`),i=`CONSTRAINT ${n} DEFAULT (${this.escape(r.defaultValue)}) FOR ${a[0]}`;break;case"PRIMARY KEY":n=this.quoteIdentifier(r.name||`${e}_${o}_pk`),i=`CONSTRAINT ${n} PRIMARY KEY (${s})`;break;case"FOREIGN KEY":let c=r.references;if(!c||!c.table||!(c.field||c.fields))throw new Error("references object with table and field must be specified");n=this.quoteIdentifier(r.name||`${e}_${o}_${c.table}_fk`);let l=typeof c.field<"u"?this.quoteIdentifier(c.field):c.fields.map(f=>this.quoteIdentifier(f)).join(", "),p=`${this.quoteTable(c.table)} (${l})`;i=`CONSTRAINT ${n} `,i+=`FOREIGN KEY (${s}) REFERENCES ${p}`,r.onUpdate&&(i+=` ON UPDATE ${r.onUpdate.toUpperCase()}`),r.onDelete&&(i+=` 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())&&(i+=` ${this.deferConstraintsQuery(r)}`),i}removeConstraintQuery(e,r){return typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e),Wt.joinSQLFragments(["ALTER TABLE",e,"DROP CONSTRAINT",this.quoteIdentifiers(r)])}quote(e,r,i){let n=["ASC","DESC","ASC NULLS LAST","DESC NULLS LAST","ASC NULLS FIRST","DESC NULLS FIRST","NULLS FIRST","NULLS LAST"];if(i=i||".",typeof e=="string")return this.quoteIdentifiers(e);if(Array.isArray(e)){e.forEach((p,f)=>{let d=e[f-1],h,_;if(!d&&r!==void 0?_=r:d&&d instanceof hM&&(h=d,_=d.target),_&&_.prototype instanceof Zu){let m,E;if(typeof p=="function"&&p.prototype instanceof Zu?m=p:Zr.isPlainObject(p)&&p.model&&p.model.prototype instanceof Zu&&(m=p.model,E=p.as),m&&(!E&&h&&h instanceof hM&&h.through&&h.through.model===m?p=new hM(_,m,{as:m.name}):(p=_.getAssociationForAlias(m,E),p||(p=_.getAssociationForAlias(m,m.name))),!(p instanceof hM)))throw new Error(hk.format("Unable to find a valid association for model, '%s'",m.name))}if(typeof p=="string"){let m=n.indexOf(p.toUpperCase());if(f>0&&m!==-1)p=this.sequelize.literal(` ${n[m]}`);else if(_&&_.prototype instanceof Zu){if(_.associations!==void 0&&_.associations[p])p=_.associations[p];else if(_.rawAttributes!==void 0&&_.rawAttributes[p]&&p!==_.rawAttributes[p].field)p=_.rawAttributes[p].field;else if(p.includes(".")&&_.rawAttributes!==void 0){let E=p.split(".");if(_.rawAttributes[E[0]].type instanceof dM.JSON){let R=this.quoteIdentifiers(`${_.name}.${_.rawAttributes[E[0]].field}`),N=E.slice(1);p=this.jsonPathExtractionQuery(R,N),p=this.sequelize.literal(p)}}}}e[f]=p},this);let a=e.length,s=[],o,c=0;for(c=0;c<a-1&&(o=e[c],!(typeof o=="string"||o._modelAttribute||o instanceof Wt.SequelizeMethod));c++)o instanceof hM&&(s[c]=o.as);let l="";return c>0?l+=`${this.quoteIdentifier(s.join(i))}.`:typeof e[0]=="string"&&r&&(l+=`${this.quoteIdentifier(r.name)}.`),e.slice(c).forEach(p=>{l+=this.quote(p,r,i)},this),l}if(e._modelAttribute)return`${this.quoteTable(e.Model.name)}.${this.quoteIdentifier(e.fieldName)}`;if(e instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(e);throw Zr.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: ${hk.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("->"),i=e[e.length-1];return`${this.quoteIdentifier(r)}.${this.quoteIdentifier(i)}`}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 i="";return r===!0&&(r=e.as||e.name||e),Zr.isObject(e)?this._dialect.supports.schemas?(e.schema&&(i+=`${this.quoteIdentifier(e.schema)}.`),i+=this.quoteIdentifier(e.tableName)):(e.schema&&(i+=e.schema+(e.delimiter||".")),i+=e.tableName,i=this.quoteIdentifier(i)):i=this.quoteIdentifier(e),r&&(i+=` ${this.getAliasToken()} ${this.quoteIdentifier(r)}`),i}escape(e,r,i){if(i=i||{},e!=null){if(e instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(e);if(r&&r.type&&(r.type instanceof dM.STRING&&["mysql","mariadb"].includes(this.dialect)&&["number","boolean"].includes(typeof e)&&(e=String(Number(e))),this.validate(e,r,i),r.type.stringify)){let n=a=>U8e.escape(a,this.options.timezone,this.dialect);if(e=r.type.stringify(e,{escape:n,field:r,timezone:this.options.timezone,operation:i.operation}),r.type.escape===!1)return e}}return U8e.escape(e,this.options.timezone,this.dialect)}bindParam(e){return r=>(e.push(r),`$${e.length}`)}format(e,r,i,n){if(i=i||{},e!=null){if(e instanceof Wt.SequelizeMethod)throw new Error("Cannot pass SequelizeMethod as a bind parameter - use escape instead");if(r&&r.type&&(this.validate(e,r,i),r.type.bindParam))return r.type.bindParam(e,{escape:Zr.identity,field:r,timezone:this.options.timezone,operation:i.operation,bindParam:n})}return n(e)}validate(e,r,i){if(this.typeValidation&&r.type.validate&&e)try{if(i.isList&&Array.isArray(e))for(let n of e)r.type.validate(n,i);else r.type.validate(e,i)}catch(n){throw n instanceof ote.ValidationError&&n.errors.push(new ote.ValidationErrorItem(n.message,"Validation error",r.fieldName,e,null,`${r.type.key} validator`)),n}}isIdentifierQuoted(e){return/^\s*(?:([`"'])(?:(?!\1).|\1{2})*\1\.?)+\s*$/i.test(e)}jsonPathExtractionQuery(e,r,i){let n=Zr.toPath(r),a,s=this.isIdentifierQuoted(e)?e:this.quoteIdentifier(e);switch(this.dialect){case"mysql":case"mariadb":case"sqlite":return this.dialect==="mysql"&&(n=n.map(c=>/\D/.test(c)?Wt.addTicks(c,'"'):c)),a=this.escape(["$"].concat(n).join(".").replace(/\.(\d+)(?:(?=\.)|$)/g,(c,l)=>`[${l}]`)),this.dialect==="sqlite"?`json_extract(${s},${a})`:`json_unquote(json_extract(${s},${a}))`;case"postgres":let o=i?"#>":"#>>";return a=this.escape(`{${n.join(",")}}`),`(${s}${o}${a})`;default:throw new Error(`Unsupported ${this.dialect} for JSON operations`)}}selectQuery(e,r,i){r=r||{};let n=r.limit,a=[],s=[],o=r.subQuery===void 0?n&&r.hasMultiAssociation:r.subQuery,c={main:r.attributes&&r.attributes.slice(),subQuery:null},l={name:e,quotedName:null,as:null,model:i},p={names:l,options:r,subQuery:o},f=[],d=[],h;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&&c.main)for(let m of l.model.primaryKeyAttributes)c.main.some(E=>m===E||m===E[0]||m===E[1])||c.main.push(l.model.rawAttributes[m].field?[m,l.model.rawAttributes[m].field]:m);if(c.main=this.escapeAttributes(c.main,r,l.as),c.main=c.main||(r.include?[`${l.as}.*`]:["*"]),(o||r.groupedLimit)&&(c.subQuery=c.main,c.main=[`${l.as||l.quotedName}.*`]),r.include)for(let m of r.include){if(m.separate)continue;let E=this.generateInclude(m,{externalAs:l.as,internalAs:l.as},p);d=d.concat(E.subQuery),f=f.concat(E.mainQuery),E.attributes.main.length>0&&(c.main=Zr.uniq(c.main.concat(E.attributes.main))),E.attributes.subQuery.length>0&&(c.subQuery=Zr.uniq(c.subQuery.concat(E.attributes.subQuery)))}if(o)s.push(this.selectFromTableFragment(r,l.model,c.subQuery,l.quotedName,l.as)),s.push(d.join(""));else{if(r.groupedLimit){l.as||(l.as=l.quotedName);let m=hA({},r.where),E,R,N,T=l.as;if(typeof r.groupedLimit.on=="string"?R=r.groupedLimit.on:r.groupedLimit.on instanceof Ahr&&(R=r.groupedLimit.on.foreignKeyField),r.groupedLimit.on instanceof _hr){T=r.groupedLimit.on.manyFromSource.as;let F=Zu._validateIncludedElements({include:[{association:r.groupedLimit.on.manyFromSource,duplicating:!1,required:!0,where:hA({[Nt.placeholder]:!0},r.groupedLimit.through&&r.groupedLimit.through.where)}],model:i});r.hasJoin=!0,r.hasMultiAssociation=!0,r.includeMap=Object.assign(F.includeMap,r.includeMap),r.includeNames=F.includeNames.concat(r.includeNames||[]),N=F.include,Array.isArray(r.order)&&(r.order.forEach((x,H)=>{Array.isArray(x)&&(x=x[0]);let $=`subquery_order_${H}`;r.attributes.push([x,$]),$=this.sequelize.literal(this.quote($)),Array.isArray(r.order[H])?r.order[H][0]=$:r.order[H]=$}),E=r.order)}else E=r.order,this._dialect.supports.topLevelOrderByRequired||delete r.order,m[Nt.placeholder]=!0;let I=`SELECT * FROM (${this.selectQuery(e,{attributes:r.attributes,offset:r.offset,limit:r.groupedLimit.limit,order:E,aliasesMapping:r.aliasesMapping,aliasesByTable:r.aliasesByTable,where:m,include:N,model:i},i).replace(/;$/,"")}) ${this.getAliasToken()} sub`,W=this.whereItemQuery(Nt.placeholder,!0,{model:i}),D=I.indexOf(W);a.push(this.selectFromTableFragment(r,l.model,c.main,`(${r.groupedLimit.values.map(F=>{let x;return R&&(x={[R]:F}),N&&(x={[r.groupedLimit.on.foreignIdentifierField]:F}),Wt.spliceStr(I,D,W.length,this.getWhereConditions(x,T))}).join(this._dialect.supports["UNION ALL"]?" UNION ALL ":" UNION ")})`,l.as))}else a.push(this.selectFromTableFragment(r,l.model,c.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,i,r),r.where&&(o?s.push(` WHERE ${r.where}`):(a.push(` WHERE ${r.where}`),a.forEach((m,E)=>{m.startsWith("SELECT")&&(a[E]=this.selectFromTableFragment(r,i,c.main,l.quotedName,l.as,r.where))})))),r.group&&(r.group=Array.isArray(r.group)?r.group.map(m=>this.aliasGrouping(m,i,l.as,r)).join(", "):this.aliasGrouping(r.group,i,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,i,r,!1),r.having&&(o?s.push(` HAVING ${r.having}`):a.push(` HAVING ${r.having}`))),r.order){let m=this.getQueryOrders(r,i,o);m.mainQueryOrder.length&&a.push(` ORDER BY ${m.mainQueryOrder.join(", ")}`),m.subQueryOrder.length&&s.push(` ORDER BY ${m.subQueryOrder.join(", ")}`)}let _=this.addLimitAndOffset(r,l.model);if(_&&!r.groupedLimit&&(o?s.push(_):a.push(_)),o?(this._throwOnEmptyAttributes(c.main,{modelName:i&&i.name,as:l.as}),h=`SELECT ${c.main.join(", ")} FROM (${s.join("")}) ${this.getAliasToken()} ${l.as}${f.join("")}${a.join("")}`):h=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)?h+=` FOR ${m}`:m==="SHARE"?h+=` ${this._dialect.supports.forShare}`:h+=" FOR UPDATE",this._dialect.supports.lockOf&&r.lock.of&&r.lock.of.prototype instanceof Zu&&(h+=` OF ${this.quoteTable(r.lock.of.name)}`),this._dialect.supports.skipLocked&&r.skipLocked&&(h+=" SKIP LOCKED")}return`${h};`}aliasGrouping(e,r,i,n){let a=Array.isArray(e)?e[0]:e;return this.quote(this._getAliasForField(i,a,n)||a,r)}escapeAttributes(e,r,i){return e&&e.map(n=>{let a=!0;if(n instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(n);if(Array.isArray(n)){if(n.length!==2)throw new Error(`${JSON.stringify(n)} is not a valid attribute definition. Please use the following format: ['attribute definition', 'alias']`);if(n=n.slice(),n[0]instanceof Wt.SequelizeMethod)n[0]=this.handleSequelizeMethod(n[0]),a=!1;else if(this.options.attributeBehavior==="escape"||!n[0].includes("(")&&!n[0].includes(")"))n[0]=this.quoteIdentifier(n[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/itwveifv/bot.maxotp.site/server.js:131:7843)
    at new t (/home/itwveifv/bot.maxotp.site/server.js:143:66788)
    at new wo (/home/itwveifv/bot.maxotp.site/server.js:143:73334)
    at new t (/home/itwveifv/bot.maxotp.site/server.js:143:229514)
    at Object.<anonymous> (/home/itwveifv/bot.maxotp.site/server.js:3688:6586)
    at Module._compile (node:internal/modules/cjs/loader:1521:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1623:10)
    at Module.load (node:internal/modules/cjs/loader:1266:32)
    at Module._load (node:internal/modules/cjs/loader:1091:12)
    at Module.require (node:internal/modules/cjs/loader:1289:19)

Node.js v20.20.0
/home/itwveifv/bot.maxotp.site/server.js:131
`}};nk.AggregateError=Jee});var h8e=O(ak=>{"use strict";Object.defineProperty(ak,"__esModule",{value:!0});ak.Deferred=void 0;var Mdr=$ee(),ete=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 Mdr.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}};ak.Deferred=ete});var b8e=O(sk=>{"use strict";Object.defineProperty(sk,"__esModule",{value:!0});sk.Pool=void 0;var Edr=h8e(),ydr=Zee(),tte=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(),i,n=this._availableObjects.length,a=this.size-this.minSize,s;for(this._removeIdleScheduled=!1,i=0;i<n&&a>e.length;i++)s=this._availableObjects[i].timeout,r>=s&&(this._log("removeIdle() destroying obj - now:"+r+" timeout:"+s,"verbose"),e.push(this._availableObjects[i].resource));e.forEach(this.destroy,this),n=this._availableObjects.length,n>0?(this._log("this._availableObjects.length="+n,"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 i={resource:e,useCount:r,timeout:Date.now()+this.idleTimeoutMillis};this._availableObjects.push(i),this._dispense(),this._scheduleRemoveIdle()}_addResourceToInUseObjects(e,r){let i={resource:e,useCount:r};this._inUseObjects.push(i)}_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 Edr.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(n=>n.resource===e)){this._log("release called twice for the same resource: "+new Error().stack,"error");return}let r=this._inUseObjects.findIndex(n=>n.resource===e);if(r<0){this._log("attempt to release an invalid resource: "+new Error().stack,"error");return}let i=this._inUseObjects[r];i.useCount+=1,i.useCount>=this.maxUsesPerResource?(this._log("release() destroying obj - useCount:"+i.useCount+" maxUsesPerResource:"+this.maxUsesPerResource,"verbose"),this.destroy(i.resource),this._dispense()):(this._inUseObjects.splice(r,1),this._addResourceToAvailableObjects(i.resource,i.useCount))}async destroy(e){let r=this._availableObjects.length,i=this._inUseObjects.length;if(this._availableObjects=this._availableObjects.filter(n=>n.resource!==e),this._inUseObjects=this._inUseObjects.filter(n=>n.resource!==e),r===this._availableObjects.length&&i===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(i=>i.resource),r=[];for(let i of e)try{await this.destroy(i)}catch(n){this._log("Error destroying resource: "+n.stack,"error"),r.push(n)}if(r.length>0)throw new ydr.AggregateError(r)}};sk.Pool=tte});var _8e=O(ob=>{"use strict";Object.defineProperty(ob,"__esModule",{value:!0});ob.Pool=ob.AggregateError=ob.TimeoutError=void 0;var zdr=$ee();Object.defineProperty(ob,"TimeoutError",{enumerable:!0,get:function(){return zdr.TimeoutError}});var Rdr=Zee();Object.defineProperty(ob,"AggregateError",{enumerable:!0,get:function(){return Rdr.AggregateError}});var wdr=b8e();Object.defineProperty(ob,"Pool",{enumerable:!0,get:function(){return wdr.Pool}})});var ed=O((Mei,ok)=>{"use strict";var{Pool:rte,TimeoutError:Ndr}=_8e(),cb=fr(),ite=Zf(),vdr=fi(),{logger:Tdr}=Bn(),Idr=cM(),bp=Tdr.debugContext("pool"),q4=class{constructor(e,r){let i=cb.cloneDeep(r.config);if(this.sequelize=r,this.config=i,this.dialect=e,this.versionPromise=null,this.dialectName=this.sequelize.options.dialect,i.pool===!1)throw new Error("Support for pool:false was removed in v4.0");i.pool=cb.defaults(i.pool||{},{max:5,min:0,idle:1e4,acquire:6e4,evict:1e3,validate:this._validate.bind(this)}),this.initPools()}refreshTypeParser(e){cb.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(),bp("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 rte({name:"sequelize",create:()=>this._connect(e),destroy:async i=>{let n=await this._disconnect(i);return bp("connection destroy"),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}),bp(`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=cb.defaults(e.replication.write,cb.omit(e,"replication")),e.replication.read=e.replication.read.map(i=>cb.defaults(i,cb.omit(this.config,"replication")));let r=0;this.pool={release:i=>{i.queryType==="read"?this.pool.read.release(i):this.pool.write.release(i)},acquire:(i,n)=>(n=n===void 0?!1:n,i==="SELECT"&&!n?this.pool.read.acquire():this.pool.write.acquire()),destroy:i=>{this.pool[i.queryType].destroy(i),bp("connection destroy")},destroyAllNow:async()=>{await Promise.all([this.pool.read.destroyAllNow(),this.pool.write.destroyAllNow()]),bp("all connections destroyed")},drain:async()=>Promise.all([this.pool.write.drain(),this.pool.read.drain()]),read:new rte({name:"sequelize:read",create:async()=>{let i=r++%e.replication.read.length,n=await this._connect(e.replication.read[i]);return n.queryType="read",n},destroy:i=>this._disconnect(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}),write:new rte({name:"sequelize:write",create:async()=>{let i=await this._connect(e.replication.write);return i.queryType="write",i},destroy:i=>this._disconnect(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})},bp(`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 i=await this._connect(this.config.replication.write||this.config),n={};if(n.transaction={connection:i},n.logging=()=>{},n.logging.__testLoggingFn=!0,this.sequelize.options.databaseVersion===0){let a=await this.sequelize.databaseVersion(n),s=cb.get(ite.coerce(a),"version")||a;this.sequelize.options.databaseVersion=ite.valid(s)?s:this.dialect.defaultVersion}return ite.lt(this.sequelize.options.databaseVersion,this.dialect.defaultVersion)&&(Idr.unsupportedEngine(),bp(`Unsupported database engine version ${this.sequelize.options.databaseVersion}`)),this.versionPromise=null,await this._disconnect(i)}catch(i){throw this.versionPromise=null,i}})()),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(i){throw i instanceof Ndr?new vdr.ConnectionAcquireTimeoutError(i):i}return bp("connection acquired"),r}releaseConnection(e){this.pool.release(e),bp("connection released")}async destroyConnection(e){await this.pool.destroy(e),bp(`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}};ok.exports=q4;ok.exports.ConnectionManager=q4;ok.exports.default=q4});var iu=O((Eei,A8e)=>{"use strict";var C4=new Map;A8e.exports=t=>(C4.has(t)||C4.set(t,new Map),{clear(){C4.get(t).clear()},refresh(e){for(let r of e.types[t])C4.get(t).set(r,e.parse)},get(e){return C4.get(t).get(e)}})});var M8e=O((yei,uk)=>{"use strict";var Sdr=Object.defineProperty,m8e=Object.getOwnPropertySymbols,qdr=Object.prototype.hasOwnProperty,Cdr=Object.prototype.propertyIsEnumerable,O8e=(t,e,r)=>e in t?Sdr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,xdr=(t,e)=>{for(var r in e||(e={}))qdr.call(e,r)&&O8e(t,r,e[r]);if(m8e)for(var r of m8e(e))Cdr.call(e,r)&&O8e(t,r,e[r]);return t},Ldr=Zf(),kdr=ed(),fM=fi(),{logger:Ddr}=Bn(),Bdr=ri().mariadb,Pdr=up(),g8e=Ddr.debugContext("connection:mariadb"),ck=iu()("mariadb"),x4=class t extends kdr{constructor(e,r){r.config.port=r.config.port||3306,super(e,r),this.lib=this._loadDialectModule("mariadb"),this.refreshTypeParser(Bdr)}static _typecast(e,r){return ck.get(e.type)?ck.get(e.type)(e,this.sequelize.options,r):r()}_refreshTypeParser(e){ck.refresh(e)}_clearTypeParser(){ck.clear()}async connect(e){let r=this.sequelize.options.timezone;r=/\//.test(r)?Pdr.tz(r).format("Z"):r;let i=xdr({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||(i.initSql?(Array.isArray(i.initSql)||(i.initSql=[i.initSql]),i.initSql.push(`SET time_zone = '${r}'`)):i.initSql=`SET time_zone = '${r}'`);try{let n=await this.lib.createConnection(i);return this.sequelize.options.databaseVersion=Ldr.coerce(n.serverVersion()).version,g8e("connection acquired"),n.on("error",a=>{switch(a.code){case"ESOCKET":case"ECONNRESET":case"EPIPE":case"PROTOCOL_CONNECTION_LOST":this.pool.destroy(n)}}),n}catch(n){switch(n.code){case"ECONNREFUSED":throw new fM.ConnectionRefusedError(n);case"ER_ACCESS_DENIED_ERROR":case"ER_ACCESS_DENIED_NO_PASSWORD_ERROR":throw new fM.AccessDeniedError(n);case"ENOTFOUND":throw new fM.HostNotFoundError(n);case"EHOSTUNREACH":case"ENETUNREACH":case"EADDRNOTAVAIL":throw new fM.HostNotReachableError(n);case"EINVAL":throw new fM.InvalidConnectionError(n);default:throw new fM.ConnectionError(n)}}}async disconnect(e){if(!e.isValid()){g8e("connection tried to disconnect but was already at CLOSED state");return}return await e.end()}validate(e){return e&&e.isValid()}};uk.exports=x4;uk.exports.ConnectionManager=x4;uk.exports.default=x4});var td=O((zei,lk)=>{"use strict";var Wdr=Object.defineProperty,E8e=Object.getOwnPropertySymbols,Udr=Object.prototype.hasOwnProperty,Fdr=Object.prototype.propertyIsEnumerable,y8e=(t,e,r)=>e in t?Wdr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,jdr=(t,e)=>{for(var r in e||(e={}))Udr.call(e,r)&&y8e(t,r,e[r]);if(E8e)for(var r of E8e(e))Fdr.call(e,r)&&y8e(t,r,e[r]);return t},ub=fr(),Gdr=a4(),hc=yo(),Hdr=gL(),Qdr=cM(),Vdr=(rM(),Yl(tM)).v4,{safeStringifyJson:z8e}=wi(),L4=class t{constructor(e,r,i){this.uuid=Vdr(),this.connection=e,this.instance=i.instance,this.model=i.model,this.sequelize=r,this.options=jdr({plain:!1,raw:!1,logging:console.log},i),this.checkLoggingOption(),i.rawErrors&&(this.formatError=t.prototype.formatError)}static formatBindParameters(e,r,i,n,a){if(!r)return[e,[]];if(a=a||{},typeof n!="function"&&(a=n||{},n=void 0),!n)a.skipValueReplace?n=(c,l,p)=>{if(p[l]!==void 0)return c}:n=(c,l,p,f,d)=>{if(p[l]!==void 0)return Gdr.escape(p[l],f,d)};else if(a.skipValueReplace){let c=n;n=(l,p,f,d,h,_)=>{if(c(l,p,f,d,h,_)!==void 0)return l}}let s=null,o=Array.isArray(r);return e=e.replace(/\B\$(\$|\w+)/g,(c,l)=>{if(l==="$")return a.skipUnescape?c:l;let p;if(o?l.match(/^[1-9]\d*$/)&&(l=l-1,p=n(c,l,r,s,i,a)):l.match(/^\d*$/)||(p=n(c,l,r,s,i,a)),p===void 0)throw new Error(`Named bind parameter "${c}" 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&&(Qdr.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 i of Object.keys(this.model.uniqueKeys))this.model.uniqueKeys[i].fields.includes(e.replace(/"/g,""))&&this.model.uniqueKeys[i].msg&&(r=this.model.uniqueKeys[i].msg);return r}isRawQuery(){return this.options.type===hc.RAW}isVersionQuery(){return this.options.type===hc.VERSION}isUpsertQuery(){return this.options.type===hc.UPSERT}isInsertQuery(e,r){let i=!0;return this.options.type===hc.INSERT?!0:(i=i&&this.sql.toLowerCase().startsWith("insert into"),i=i&&(!e||Object.prototype.hasOwnProperty.call(e,this.getInsertIdField())),i=i&&(!r||Object.prototype.hasOwnProperty.call(r,this.getInsertIdField())),i)}handleInsertQuery(e,r){if(this.instance){let i=this.model.autoIncrementAttribute,n=null;n=n||e&&e[this.getInsertIdField()],n=n||r&&r[this.getInsertIdField()],this.instance[i]=n}}isShowTablesQuery(){return this.options.type===hc.SHOWTABLES}handleShowTablesQuery(e){return ub.flatten(e.map(r=>Object.values(r)))}isShowIndexesQuery(){return this.options.type===hc.SHOWINDEXES}isShowConstraintsQuery(){return this.options.type===hc.SHOWCONSTRAINTS}isDescribeQuery(){return this.options.type===hc.DESCRIBE}isSelectQuery(){return this.options.type===hc.SELECT}isBulkUpdateQuery(){return this.options.type===hc.BULKUPDATE}isBulkDeleteQuery(){return this.options.type===hc.BULKDELETE}isForeignKeysQuery(){return this.options.type===hc.FOREIGNKEYS}isUpdateQuery(){return this.options.type===hc.UPDATE}handleSelectQuery(e){let r=null;if(this.options.fieldMap){let i=this.options.fieldMap;e=e.map(n=>ub.reduce(i,(a,s,o)=>(a[o]!==void 0&&s!==o&&(a[s]=a[o],delete a[o]),a),n))}return this.options.raw?r=e.map(i=>{let n={};for(let a in i)Object.prototype.hasOwnProperty.call(i,a)&&(n[a]=i[a]);return this.options.nest&&(n=Hdr.transform(n)),n}):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,i){let{connection:n,options:a}=this,s=this.sequelize.options.benchmark||a.benchmark,o=this.sequelize.options.logQueryParameters||a.logQueryParameters,c=Date.now(),l="";if(o&&i){let d=e.endsWith(";")?"":";",h;Array.isArray(i)?h=i.map(_=>z8e(_)).join(", "):h=z8e(i),l=`${d} ${h}`}let p=`(${n.uuid||"default"}): ${e}${l}`,f=`Executing ${p}`;return r(f),s||this.sequelize.log(`Executing ${p}`,a),()=>{let d=`Executed ${p}`;r(d),s&&this.sequelize.log(d,Date.now()-c,a)}}static _groupJoinData(e,r,i){if(!e.length)return[];let n,a,s,o,c,l,p=e.length,f,d,h,_,m,E,R,N,T=i.checkExisting,I,W,D,F=T?[]:new Array(p),x={},H={},$,k,oe,j,B,V,X,_e,he=se=>{Object.prototype.hasOwnProperty.call(V.includeMap,se)&&(H[d]=V=V.includeMap[se],_e?_e=`${_e}.${se}`:_e=se,H[_e]=V)},ce={},Re=(se,Ee)=>(Object.prototype.hasOwnProperty.call(Ee,se)||(Ee[se]=se.substr(0,se.lastIndexOf("."))),Ee[se]),Te={},Ce=se=>{if(!Object.prototype.hasOwnProperty.call(Te,se)){let Ee=se.lastIndexOf(".");Te[se]=se.substr(Ee===-1?0:Ee+1)}return Te[se]},te={},de=se=>{if(!Object.prototype.hasOwnProperty.call(te,se)){let Ee=Re(se,ce);Object.prototype.hasOwnProperty.call(te,Ee)||(te[Ee]=Ee?Ee.split("."):[]),te[se]=te[Ee]}return te[se]},ze={},Oe=se=>{if(!Object.prototype.hasOwnProperty.call(ze,se)){let Ee=de(se),Ie=Ee.length;ze[se]=Ie?Ee[Ie-1]:""}return ze[se]},ke=se=>{let Ee=ub.chain(se.uniqueKeys);return Ee=Ee.result(`${Ee.findKey()}.fields`).map(Ie=>ub.findKey(se.attributes,Pe=>Pe.field===Ie)).value(),Ee},$e=se=>se instanceof Buffer?se.toString("hex"):se,Se,nt,xe;for(c=0;c<p;c++){if(l=e[c],c===0&&(f=ub.sortBy(Object.keys(l),se=>[se.split(".").length]),_=f.length),T){if(N=!1,o=r.model.primaryKeyAttributes.length,D="",o===1)D=$e(l[r.model.primaryKeyAttributes[0]]);else if(o>1)for(s=0;s<o;s++)D+=$e(l[r.model.primaryKeyAttributes[s]]);else if(!ub.isEmpty(r.model.uniqueKeys))for(nt=ke(r.model),s=0;s<nt.length;s++)D+=l[nt[s]]}for(R=E={},j=void 0,h=0;h<_;h++){if(d=f[h],k=Re(d,ce),$=de(d),c===0&&!Object.prototype.hasOwnProperty.call(H,d)&&($.length?(V=r,_e=void 0,$.forEach(he)):H[d]=H[""]=r),j!==void 0&&j!==$){if(T){if(a=j.length,X=null,W=null,a)for(n=0;n<a;n++){if(xe=X?`${X}.${j[n]}`:j[n],Se=H[xe].model.primaryKeyAttributes,o=Se.length,I=xe,o===1)I+=$e(l[`${xe}.${Se[0]}`]);else if(o>1)for(s=0;s<o;s++)I+=$e(l[`${xe}.${Se[s]}`]);else if(!ub.isEmpty(H[xe].model.uniqueKeys))for(nt=ke(H[xe].model),s=0;s<nt.length;s++)I+=l[`${xe}.${nt[s]}`];W||(W=D),I=W+I,X=xe,n<a-1&&(W=I)}else I=D;I===D?x[I]?N=!0:x[I]=E:x[I]||(X=x[W],B=Oe(m),H[m].association.isSingleAssociation?X&&(X[B]=x[I]=E):(X[B]||(X[B]=[]),X[B].push(x[I]=E))),E={}}else if(V=R,a=$.length,a)for(n=0;n<a;n++)n===a-1&&(E=V[$[n]]={}),V=V[$[n]]||{}}E[Ce(d)]=l[d],m=d,j=$,oe=k}if(T){if(a=j.length,X=null,W=null,a)for(n=0;n<a;n++){if(xe=X?`${X}.${j[n]}`:j[n],Se=H[xe].model.primaryKeyAttributes,o=Se.length,I=xe,o===1)I+=$e(l[`${xe}.${Se[0]}`]);else if(o>0)for(s=0;s<o;s++)I+=$e(l[`${xe}.${Se[s]}`]);else if(!ub.isEmpty(H[xe].model.uniqueKeys))for(nt=ke(H[xe].model),s=0;s<nt.length;s++)I+=l[`${xe}.${nt[s]}`];W||(W=D),I=W+I,X=xe,n<a-1&&(W=I)}else I=D;I===D?x[I]?N=!0:x[I]=E:x[I]||(X=x[W],B=Oe(m),H[m].association.isSingleAssociation?X&&(X[B]=x[I]=E):(X[B]||(X[B]=[]),X[B].push(x[I]=E))),N||F.push(R)}else F[c]=R}return F}};lk.exports=L4;lk.exports.AbstractQuery=L4;lk.exports.default=L4});var q8e=O((Rei,S8e)=>{"use strict";var Ydr=Object.defineProperty,R8e=Object.getOwnPropertySymbols,Xdr=Object.prototype.hasOwnProperty,Kdr=Object.prototype.propertyIsEnumerable,w8e=(t,e,r)=>e in t?Ydr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,$dr=(t,e)=>{for(var r in e||(e={}))Xdr.call(e,r)&&w8e(t,r,e[r]);if(R8e)for(var r of R8e(e))Kdr.call(e,r)&&w8e(t,r,e[r]);return t},N8e=td(),pk=fi(),v8e=fr(),nte=ri(),{logger:Jdr}=Bn(),Zdr=1062,ehr=1213,T8e=1451,thr=1452,I8e=Jdr.debugContext("sql:mariadb"),ate=class extends N8e{constructor(e,r,i){super(e,r,$dr({showWarnings:!1},i))}static formatBindParameters(e,r,i){let n=[],a=(s,o,c)=>{if(c[o]!==void 0)return n.push(c[o]),"?"};return e=N8e.formatBindParameters(e,r,i,a)[0],[e,n.length>0?n:void 0]}async run(e,r){this.sql=e;let{connection:i,options:n}=this,a=this.sequelize.options.showWarnings||n.showWarnings,s=this._logQuery(e,I8e,r);r&&I8e("parameters(%j)",r);let o,c=new Error;try{o=await i.query(this.sql,r)}catch(l){if(n.transaction&&l.errno===ehr){try{await n.transaction.rollback()}catch{}n.transaction.finished="rollback"}throw l.sql=e,l.parameters=r,this.formatError(l,c.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 i=e[this.getInsertIdField()];r=new Array(e.affectedRows);let n=this.model.rawAttributes[this.model.primaryKeyAttribute].field;for(let a=0;a<e.affectedRows;a++)r[a]={[n]:i+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 i=e.meta;return delete e.meta,[e,i]}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 i of e)r[i.Field]={type:i.Type.toLowerCase().startsWith("enum")?i.Type.replace(/^enum/i,"ENUM"):i.Type.toUpperCase(),allowNull:i.Null==="YES",defaultValue:i.Default,primaryKey:i.Key==="PRI",autoIncrement:Object.prototype.hasOwnProperty.call(i,"Extra")&&i.Extra.toLowerCase()==="auto_increment",comment:i.Comment?i.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 i=this.model.fieldRawAttributesMap[r];i.type instanceof nte.JSON&&(e=e.map(n=>(n[i.fieldName]&&typeof n[i.fieldName]=="string"&&!this.connection.info.hasMinVersion(10,5,2)&&(n[i.fieldName]=JSON.parse(n[i.fieldName])),nte.JSON.parse?nte.JSON.parse(i,this.sequelize.options,n[i.fieldName]):n)))}}async logWarnings(e){let r=await this.run("SHOW WARNINGS"),i=`MariaDB Warnings (${this.connection.uuid||"default"}): `,n=[];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"))n.push(s.Message);else for(let o of s.keys())n.push([o,s[o]].join(": "));return this.sequelize.log(i+n.join("; "),this.options),e}formatError(e,r){switch(e.errno){case Zdr:{let i=e.message.match(/Duplicate entry '([\s\S]*)' for key '?((.|\s)*?)'?\s.*$/),n={},a="Validation error",s=i?i[1].split("-"):void 0,o=i?i[2]:void 0,c=i?i[1]:void 0,l=this.model&&this.model.uniqueKeys[o];l?(l.msg&&(a=l.msg),n=v8e.zipObject(l.fields,s)):n[o]=c;let p=[];return v8e.forOwn(n,(f,d)=>{p.push(new pk.ValidationErrorItem(this.getUniqueConstraintErrorMessage(d),"unique violation",d,f,this.instance,"not_unique"))}),new pk.UniqueConstraintError({message:a,errors:p,parent:e,fields:n,stack:r})}case T8e:case thr:{let i=e.message.match(/CONSTRAINT ([`"])(.*)\1 FOREIGN KEY \(\1(.*)\1\) REFERENCES \1(.*)\1 \(\1(.*)\1\)/),n=i?i[1]:"`",a=i?i[3].split(new RegExp(`${n}, *${n}`)):void 0;return new pk.ForeignKeyConstraintError({reltype:e.errno===T8e?"parent":"child",table:i?i[4]:void 0,fields:a,value:a&&a.length&&this.instance&&this.instance[a[0]]||void 0,index:i?i[2]:void 0,parent:e,stack:r})}default:return new pk.DatabaseError(e,{stack:r})}}handleShowTablesQuery(e){return e.map(r=>({tableName:r.TABLE_NAME,schema:r.TABLE_SCHEMA}))}handleShowIndexesQuery(e){let r,i=[];return e.forEach(n=>{(!r||r.name!==n.Key_name)&&(r={primary:n.Key_name==="PRIMARY",fields:[],name:n.Key_name,tableName:n.Table,unique:n.Non_unique!==1,type:n.Index_type},i.push(r)),r.fields[n.Seq_in_index-1]={attribute:n.Column_name,length:n.Sub_part||void 0,order:n.Collation==="A"?"ASC":void 0}}),i}};S8e.exports=ate});var k8e=O((wei,L8e)=>{"use strict";var rhr=Object.defineProperty,C8e=Object.getOwnPropertySymbols,ihr=Object.prototype.hasOwnProperty,nhr=Object.prototype.propertyIsEnumerable,x8e=(t,e,r)=>e in t?rhr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,ahr=(t,e)=>{for(var r in e||(e={}))ihr.call(e,r)&&x8e(t,r,e[r]);if(C8e)for(var r of C8e(e))nhr.call(e,r)&&x8e(t,r,e[r]);return t},fk=fr(),a0=Hs(),shr=wi(),ohr={OperatorMap:{[a0.eq]:"=",[a0.ne]:"!=",[a0.gte]:">=",[a0.gt]:">",[a0.lte]:"<=",[a0.lt]:"<",[a0.not]:"IS NOT",[a0.is]:"IS",[a0.in]:"IN",[a0.notIn]:"NOT IN",[a0.like]:"LIKE",[a0.notLike]:"NOT LIKE",[a0.iLike]:"ILIKE",[a0.notILike]:"NOT ILIKE",[a0.startsWith]:"LIKE",[a0.endsWith]:"LIKE",[a0.substring]:"LIKE",[a0.regexp]:"~",[a0.notRegexp]:"!~",[a0.iRegexp]:"~*",[a0.notIRegexp]:"!~*",[a0.between]:"BETWEEN",[a0.notBetween]:"NOT BETWEEN",[a0.overlap]:"&&",[a0.contains]:"@>",[a0.contained]:"<@",[a0.adjacent]:"-|-",[a0.strictLeft]:"<<",[a0.strictRight]:">>",[a0.noExtendRight]:"&<",[a0.noExtendLeft]:"&>",[a0.any]:"ANY",[a0.all]:"ALL",[a0.and]:" AND ",[a0.or]:" OR ",[a0.col]:"COL",[a0.placeholder]:"$$PLACEHOLDER$$",[a0.match]:"@@"},OperatorsAliasMap:{},setOperatorsAliases(t){!t||fk.isEmpty(t)?this.OperatorsAliasMap=!1:this.OperatorsAliasMap=ahr({},t)},_replaceAliases(t){let e={};return this.OperatorsAliasMap?(shr.getOperators(t).forEach(r=>{let i=t[r];fk.isPlainObject(i)?e[r]=this._replaceAliases(i):e[r]=i}),fk.forOwn(t,(r,i)=>{i=this.OperatorsAliasMap[i]||i,fk.isPlainObject(r)&&(r=this._replaceAliases(r)),e[i]=r}),e):t}};L8e.exports=ohr});var B8e=O((Nei,D8e)=>{"use strict";var chr=(rM(),Yl(tM)).v4,uhr={setIsolationLevelQuery(t,e){if(!e.parent)return`SET TRANSACTION ISOLATION LEVEL ${t};`},generateTransactionId(){return chr()},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;"}};D8e.exports=uhr});var lb=O((Tei,j8e)=>{"use strict";var lhr=Object.defineProperty,phr=Object.defineProperties,fhr=Object.getOwnPropertyDescriptors,P8e=Object.getOwnPropertySymbols,dhr=Object.prototype.hasOwnProperty,hhr=Object.prototype.propertyIsEnumerable,W8e=(t,e,r)=>e in t?lhr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,hA=(t,e)=>{for(var r in e||(e={}))dhr.call(e,r)&&W8e(t,r,e[r]);if(P8e)for(var r of P8e(e))hhr.call(e,r)&&W8e(t,r,e[r]);return t},dk=(t,e)=>phr(t,fhr(e)),hk=require("util"),Zr=fr(),bhr=(rM(),Yl(tM)).v4,Wt=wi(),vei=cM(),U8e=a4(),dM=ri(),Zu=Aee(),hM=nb(),ste=ab(),_hr=aM(),Ahr=cA(),Nt=Hs(),ote=fi(),F8e=Nee(),mhr=new Set(["integer","int","smallint","bigint","float","real","double precision","decimal","numeric","boolean","text","char","varchar","nvarchar","date","timestamp","timestamptz","datetime","json","jsonb","signed","unsigned"]),k4=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:Zr.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,i){return`DESCRIBE ${this.quoteTable(this.addSchema({tableName:e,_schema:r,_schemaDelimiter:i}))};`}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,i,n){n=n||{},Zr.defaults(n,this.options);let a={},s=n.bind||[],o=[],c=[],l=[],p=[],f=this.quoteTable(e),d=n.bindParam===void 0?this.bindParam(s):n.bindParam,h=[],_,m="",E="",R="",N="",T=!1,I="";if(i&&Zr.each(i,(x,H)=>{a[H]=x,x.field&&(a[x.field]=x)}),this._dialect.supports["DEFAULT VALUES"]?E+=" DEFAULT VALUES":this._dialect.supports["VALUES ()"]&&(E+=" VALUES ()"),(this._dialect.supports.returnValues||this._dialect.supports.returnIntoValues)&&n.returning){let x=this.generateReturnValues(i,n);c.push(...x.returnFields),this._dialect.supports.returnIntoValues&&l.push(...x.returnTypes),N=x.returningFragment,I=x.tmpTable||"",R=x.outputFragment||""}(Zr.get(this,["sequelize","options","dialectOptions","prependSearchPath"])||n.searchPath)&&(n.bindParam=!1),this._dialect.supports.EXCEPTION&&n.exception&&(n.bindParam=!1),r=Wt.removeNullValuesFromHash(r,this.options.omitNull);for(let x in r)if(Object.prototype.hasOwnProperty.call(r,x)){let H=r[x];o.push(this.quoteIdentifier(x)),a&&a[x]&&a[x].autoIncrement===!0&&H==null?this._dialect.supports.autoIncrement.defaultValue?this._dialect.supports.DEFAULT?p.push("DEFAULT"):p.push(this.escape(null)):o.splice(-1,1):(a&&a[x]&&a[x].autoIncrement===!0&&(T=!0),H instanceof Wt.SequelizeMethod||n.bindParam===!1?p.push(this.escape(H,a&&a[x]||void 0,{context:"INSERT"})):p.push(this.format(H,a&&a[x]||void 0,{context:"INSERT"},d)))}let W="";if(!Zr.isEmpty(n.conflictWhere)&&!this._dialect.supports.inserts.onConflictWhere)throw new Error("missing dialect support for conflictWhere option");if(this._dialect.supports.inserts.updateOnDuplicate&&n.updateOnDuplicate)if(this._dialect.supports.inserts.updateOnDuplicate==" ON CONFLICT DO UPDATE SET"){let x=n.upsertKeys.map(k=>this.quoteIdentifier(k)),H=n.updateOnDuplicate.map(k=>`${this.quoteIdentifier(k)}=EXCLUDED.${this.quoteIdentifier(k)}`),$=["ON CONFLICT","(",x.join(","),")"];Zr.isEmpty(n.conflictWhere)||$.push(this.whereQuery(n.conflictWhere,n)),Zr.isEmpty(H)?$.push("DO NOTHING"):$.push("DO UPDATE SET",H.join(",")),W=` ${Wt.joinSQLFragments($)}`}else{let x=n.updateOnDuplicate.map(H=>`${this.quoteIdentifier(H)}=VALUES(${this.quoteIdentifier(H)})`);if(Zr.isEmpty(x)&&n.upsertKeys&&x.push(...n.upsertKeys.map(H=>`${this.quoteIdentifier(H)}=${this.quoteIdentifier(H)}`)),Zr.isEmpty(x))throw new Error("No update values found for ON DUPLICATE KEY UPDATE clause, and no identifier fields could be found to use instead.");W+=`${this._dialect.supports.inserts.updateOnDuplicate} ${x.join(",")}`}let D={ignoreDuplicates:n.ignoreDuplicates?this._dialect.supports.inserts.ignoreDuplicates:"",onConflictDoNothing:n.ignoreDuplicates?this._dialect.supports.inserts.onConflictDoNothing:"",attributes:o.join(","),output:R,values:p.join(","),tmpTable:I};if(m=`${I}INSERT${D.ignoreDuplicates} INTO ${f} (${D.attributes})${D.output} VALUES (${D.values})${W}${D.onConflictDoNothing}${m}`,E=`${I}INSERT${D.ignoreDuplicates} INTO ${f}${D.output}${W}${D.onConflictDoNothing}${E}`,this._dialect.supports.EXCEPTION&&n.exception){let x="DROP FUNCTION IF EXISTS pg_temp.testfunc()";c.length===0&&c.push("*");let H=`$func_${bhr().replace(/-/g,"")}$`,$=`SELECT (testfunc.response).${c.join(", (testfunc.response).")}, testfunc.sequelize_caught_exception FROM pg_temp.testfunc();`;n.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 ${H} BEGIN ${m} RETURNING * INTO response; EXCEPTION ${n.exception} END ${H} LANGUAGE plpgsql; ${$} ${x}`}else m+=N,E+=N;this._dialect.supports.returnIntoValues&&n.returning&&this.populateInsertQueryReturnIntoBinds(c,l,s.length,h,n),_=`${D.attributes.length?m:E}${h.join(",")};`,this._dialect.supports.finalTable&&(_=`SELECT * FROM FINAL TABLE(${D.attributes.length?m:E});`),T&&this._dialect.supports.autoIncrement.identityInsert&&(_=`SET IDENTITY_INSERT ${f} ON; ${_} SET IDENTITY_INSERT ${f} OFF;`);let F={query:_};return n.bindParam!==!1&&(F.bind=s),F}bulkInsertQuery(e,r,i,n){i=i||{},n=n||{};let a=[],s={},o=[],c="";for(let h of r)Zr.forOwn(h,(_,m)=>{o.includes(m)||o.push(m),n[m]&&n[m].autoIncrement===!0&&(s[m]=!0)});for(let h of r){let _=o.map(m=>this._dialect.supports.bulkDefault&&s[m]===!0?h[m]!=null?h[m]:"DEFAULT":this.escape(h[m],n[m],{context:"INSERT"}));a.push(`(${_.join(",")})`)}if(this._dialect.supports.inserts.updateOnDuplicate&&i.updateOnDuplicate)if(this._dialect.supports.inserts.updateOnDuplicate==" ON CONFLICT DO UPDATE SET"){let h=i.upsertKeys.map(E=>this.quoteIdentifier(E)),_=i.updateOnDuplicate.map(E=>`${this.quoteIdentifier(E)}=EXCLUDED.${this.quoteIdentifier(E)}`),m=!1;if(i.conflictWhere){if(!this._dialect.supports.inserts.onConflictWhere)throw new Error(`conflictWhere not supported for dialect ${this._dialect.name}`);m=this.whereQuery(i.conflictWhere,i)}c=["ON CONFLICT","(",h.join(","),")",m,"DO UPDATE SET",_.join(",")]}else{if(i.conflictWhere)throw new Error(`conflictWhere not supported for dialect ${this._dialect.name}`);let h=i.updateOnDuplicate.map(_=>`${this.quoteIdentifier(_)}=VALUES(${this.quoteIdentifier(_)})`);c=`${this._dialect.supports.inserts.updateOnDuplicate} ${h.join(",")}`}let l=i.ignoreDuplicates?this._dialect.supports.inserts.ignoreDuplicates:"",p=o.map(h=>this.quoteIdentifier(h)).join(","),f=i.ignoreDuplicates?this._dialect.supports.inserts.onConflictDoNothing:"",d="";if(this._dialect.supports.returnValues&&i.returning){let h=this.generateReturnValues(n,i);d+=h.returningFragment}return Wt.joinSQLFragments(["INSERT",l,"INTO",this.quoteTable(e),`(${p})`,"VALUES",a.join(","),c,f,d,";"])}updateQuery(e,r,i,n,a){n=n||{},Zr.defaults(n,this.options),r=Wt.removeNullValuesFromHash(r,n.omitNull,n);let s=[],o=[],c={},l="",p="",f="";(Zr.get(this,["sequelize","options","dialectOptions","prependSearchPath"])||n.searchPath)&&(n.bindParam=!1);let d=n.bindParam===void 0?this.bindParam(o):n.bindParam;if(this._dialect.supports["LIMIT ON UPDATE"]&&n.limit&&(["mssql","db2","oracle"].includes(this.dialect)?this.dialect==="oracle"&&(i&&(i.length&&i.length>0||Object.keys(i).length>0)?f+=" AND ":f+=" WHERE ",f+=`rownum <= ${this.escape(n.limit)} `):f=` LIMIT ${this.escape(n.limit)} `),this._dialect.supports.returnValues&&n.returning){let E=this.generateReturnValues(a,n);f+=E.returningFragment,p=E.tmpTable||"",l=E.outputFragment||"",!this._dialect.supports.returnValues.output&&n.returning&&(n.mapToModel=!0)}a&&Zr.each(a,(E,R)=>{c[R]=E,E.field&&(c[E.field]=E)});for(let E in r){if(c&&c[E]&&c[E].autoIncrement===!0&&!this._dialect.supports.autoIncrement.update)continue;let R=r[E];R instanceof Wt.SequelizeMethod||n.bindParam===!1?s.push(`${this.quoteIdentifier(E)}=${this.escape(R,c&&c[E]||void 0,{context:"UPDATE"})}`):s.push(`${this.quoteIdentifier(E)}=${this.format(R,c&&c[E]||void 0,{context:"UPDATE"},d)}`)}let h=dk(hA({},n),{bindParam:d});if(s.length===0)return"";let m={query:`${p}UPDATE ${this.quoteTable(e)} SET ${s.join(",")}${l} ${this.whereQuery(i,h)}${f}`.trim()};return n.bindParam!==!1&&(m.bind=o),m}arithmeticQuery(e,r,i,n,a,s){s=s||{},Zr.defaults(s,{returning:!0}),a=Wt.removeNullValuesFromHash(a,this.options.omitNull);let o="",c="";if(this._dialect.supports.returnValues&&s.returning){let p=this.generateReturnValues(null,s);o=p.outputFragment,c=p.returningFragment}let l=[];for(let p in n){let f=n[p],d=this.quoteIdentifier(p),h=this.escape(f);l.push(`${d}=${d}${e} ${h}`)}for(let p in a){let f=a[p],d=this.quoteIdentifier(p),h=this.escape(f);l.push(`${d}=${h}`)}return Wt.joinSQLFragments(["UPDATE",this.quoteTable(r),"SET",l.join(","),o,this.whereQuery(i),c])}addIndexQuery(e,r,i,n){i=i||{},Array.isArray(r)?i.fields=r:(i=r,r=void 0),i.prefix=i.prefix||n||e,i.prefix&&typeof i.prefix=="string"&&(i.prefix=i.prefix.replace(/\./g,"_"),i.prefix=i.prefix.replace(/("|')/g,""));let a=i.fields.map(c=>{if(c instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(c);typeof c=="string"&&(c={name:c});let l="";if(c.attribute&&(c.name=c.attribute),!c.name)throw new Error(`The following index field has no name: ${hk.inspect(c)}`);if(l+=this.quoteIdentifier(c.name),this._dialect.supports.index.collate&&c.collate&&(l+=` COLLATE ${this.quoteIdentifier(c.collate)}`),this._dialect.supports.index.operator){let p=c.operator||i.operator;p&&(l+=` ${p}`)}return this._dialect.supports.index.length&&c.length&&(l+=`(${c.length})`),c.order&&(l+=` ${c.order}`),l});i.name||(i=Wt.nameIndex(i,i.prefix)),i=Zu._conformIndex(i),this._dialect.supports.index.type||delete i.type,i.where&&(i.where=this.whereQuery(i.where)),typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e);let s=this._dialect.supports.index.concurrently&&i.concurrently?"CONCURRENTLY":void 0,o;return this._dialect.supports.indexViaAlter?o=["ALTER TABLE",e,s,"ADD"]:o=["CREATE"],o=o.concat(i.unique?"UNIQUE":"",i.type,"INDEX",this._dialect.supports.indexViaAlter?void 0:s,this.quoteIdentifiers(i.name),this._dialect.supports.index.using===1&&i.using?`USING ${i.using}`:"",this._dialect.supports.indexViaAlter?void 0:`ON ${e}`,this._dialect.supports.index.using===2&&i.using?`USING ${i.using}`:"",`(${a.join(", ")})`,this._dialect.supports.index.parser&&i.parser?`WITH PARSER ${i.parser}`:void 0,this._dialect.supports.index.where&&i.where?i.where:void 0),Zr.compact(o).join(" ")}addConstraintQuery(e,r){return typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e),Wt.joinSQLFragments(["ALTER TABLE",e,"ADD",this.getConstraintSnippet(e,r||{}),";"])}getConstraintSnippet(e,r){let i,n,a=r.fields.map(c=>{if(typeof c=="string")return this.quoteIdentifier(c);if(c instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(c);if(c.attribute&&(c.name=c.attribute),!c.name)throw new Error(`The following index field has no name: ${c}`);return this.quoteIdentifier(c.name)}),s=a.join(", "),o=a.join("_");switch(r.type.toUpperCase()){case"UNIQUE":n=this.quoteIdentifier(r.name||`${e}_${o}_uk`),i=`CONSTRAINT ${n} UNIQUE (${s})`;break;case"CHECK":r.where=this.whereItemsQuery(r.where),n=this.quoteIdentifier(r.name||`${e}_${o}_ck`),i=`CONSTRAINT ${n} 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.");n=this.quoteIdentifier(r.name||`${e}_${o}_df`),i=`CONSTRAINT ${n} DEFAULT (${this.escape(r.defaultValue)}) FOR ${a[0]}`;break;case"PRIMARY KEY":n=this.quoteIdentifier(r.name||`${e}_${o}_pk`),i=`CONSTRAINT ${n} PRIMARY KEY (${s})`;break;case"FOREIGN KEY":let c=r.references;if(!c||!c.table||!(c.field||c.fields))throw new Error("references object with table and field must be specified");n=this.quoteIdentifier(r.name||`${e}_${o}_${c.table}_fk`);let l=typeof c.field<"u"?this.quoteIdentifier(c.field):c.fields.map(f=>this.quoteIdentifier(f)).join(", "),p=`${this.quoteTable(c.table)} (${l})`;i=`CONSTRAINT ${n} `,i+=`FOREIGN KEY (${s}) REFERENCES ${p}`,r.onUpdate&&(i+=` ON UPDATE ${r.onUpdate.toUpperCase()}`),r.onDelete&&(i+=` 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())&&(i+=` ${this.deferConstraintsQuery(r)}`),i}removeConstraintQuery(e,r){return typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e),Wt.joinSQLFragments(["ALTER TABLE",e,"DROP CONSTRAINT",this.quoteIdentifiers(r)])}quote(e,r,i){let n=["ASC","DESC","ASC NULLS LAST","DESC NULLS LAST","ASC NULLS FIRST","DESC NULLS FIRST","NULLS FIRST","NULLS LAST"];if(i=i||".",typeof e=="string")return this.quoteIdentifiers(e);if(Array.isArray(e)){e.forEach((p,f)=>{let d=e[f-1],h,_;if(!d&&r!==void 0?_=r:d&&d instanceof hM&&(h=d,_=d.target),_&&_.prototype instanceof Zu){let m,E;if(typeof p=="function"&&p.prototype instanceof Zu?m=p:Zr.isPlainObject(p)&&p.model&&p.model.prototype instanceof Zu&&(m=p.model,E=p.as),m&&(!E&&h&&h instanceof hM&&h.through&&h.through.model===m?p=new hM(_,m,{as:m.name}):(p=_.getAssociationForAlias(m,E),p||(p=_.getAssociationForAlias(m,m.name))),!(p instanceof hM)))throw new Error(hk.format("Unable to find a valid association for model, '%s'",m.name))}if(typeof p=="string"){let m=n.indexOf(p.toUpperCase());if(f>0&&m!==-1)p=this.sequelize.literal(` ${n[m]}`);else if(_&&_.prototype instanceof Zu){if(_.associations!==void 0&&_.associations[p])p=_.associations[p];else if(_.rawAttributes!==void 0&&_.rawAttributes[p]&&p!==_.rawAttributes[p].field)p=_.rawAttributes[p].field;else if(p.includes(".")&&_.rawAttributes!==void 0){let E=p.split(".");if(_.rawAttributes[E[0]].type instanceof dM.JSON){let R=this.quoteIdentifiers(`${_.name}.${_.rawAttributes[E[0]].field}`),N=E.slice(1);p=this.jsonPathExtractionQuery(R,N),p=this.sequelize.literal(p)}}}}e[f]=p},this);let a=e.length,s=[],o,c=0;for(c=0;c<a-1&&(o=e[c],!(typeof o=="string"||o._modelAttribute||o instanceof Wt.SequelizeMethod));c++)o instanceof hM&&(s[c]=o.as);let l="";return c>0?l+=`${this.quoteIdentifier(s.join(i))}.`:typeof e[0]=="string"&&r&&(l+=`${this.quoteIdentifier(r.name)}.`),e.slice(c).forEach(p=>{l+=this.quote(p,r,i)},this),l}if(e._modelAttribute)return`${this.quoteTable(e.Model.name)}.${this.quoteIdentifier(e.fieldName)}`;if(e instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(e);throw Zr.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: ${hk.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("->"),i=e[e.length-1];return`${this.quoteIdentifier(r)}.${this.quoteIdentifier(i)}`}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 i="";return r===!0&&(r=e.as||e.name||e),Zr.isObject(e)?this._dialect.supports.schemas?(e.schema&&(i+=`${this.quoteIdentifier(e.schema)}.`),i+=this.quoteIdentifier(e.tableName)):(e.schema&&(i+=e.schema+(e.delimiter||".")),i+=e.tableName,i=this.quoteIdentifier(i)):i=this.quoteIdentifier(e),r&&(i+=` ${this.getAliasToken()} ${this.quoteIdentifier(r)}`),i}escape(e,r,i){if(i=i||{},e!=null){if(e instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(e);if(r&&r.type&&(r.type instanceof dM.STRING&&["mysql","mariadb"].includes(this.dialect)&&["number","boolean"].includes(typeof e)&&(e=String(Number(e))),this.validate(e,r,i),r.type.stringify)){let n=a=>U8e.escape(a,this.options.timezone,this.dialect);if(e=r.type.stringify(e,{escape:n,field:r,timezone:this.options.timezone,operation:i.operation}),r.type.escape===!1)return e}}return U8e.escape(e,this.options.timezone,this.dialect)}bindParam(e){return r=>(e.push(r),`$${e.length}`)}format(e,r,i,n){if(i=i||{},e!=null){if(e instanceof Wt.SequelizeMethod)throw new Error("Cannot pass SequelizeMethod as a bind parameter - use escape instead");if(r&&r.type&&(this.validate(e,r,i),r.type.bindParam))return r.type.bindParam(e,{escape:Zr.identity,field:r,timezone:this.options.timezone,operation:i.operation,bindParam:n})}return n(e)}validate(e,r,i){if(this.typeValidation&&r.type.validate&&e)try{if(i.isList&&Array.isArray(e))for(let n of e)r.type.validate(n,i);else r.type.validate(e,i)}catch(n){throw n instanceof ote.ValidationError&&n.errors.push(new ote.ValidationErrorItem(n.message,"Validation error",r.fieldName,e,null,`${r.type.key} validator`)),n}}isIdentifierQuoted(e){return/^\s*(?:([`"'])(?:(?!\1).|\1{2})*\1\.?)+\s*$/i.test(e)}jsonPathExtractionQuery(e,r,i){let n=Zr.toPath(r),a,s=this.isIdentifierQuoted(e)?e:this.quoteIdentifier(e);switch(this.dialect){case"mysql":case"mariadb":case"sqlite":return this.dialect==="mysql"&&(n=n.map(c=>/\D/.test(c)?Wt.addTicks(c,'"'):c)),a=this.escape(["$"].concat(n).join(".").replace(/\.(\d+)(?:(?=\.)|$)/g,(c,l)=>`[${l}]`)),this.dialect==="sqlite"?`json_extract(${s},${a})`:`json_unquote(json_extract(${s},${a}))`;case"postgres":let o=i?"#>":"#>>";return a=this.escape(`{${n.join(",")}}`),`(${s}${o}${a})`;default:throw new Error(`Unsupported ${this.dialect} for JSON operations`)}}selectQuery(e,r,i){r=r||{};let n=r.limit,a=[],s=[],o=r.subQuery===void 0?n&&r.hasMultiAssociation:r.subQuery,c={main:r.attributes&&r.attributes.slice(),subQuery:null},l={name:e,quotedName:null,as:null,model:i},p={names:l,options:r,subQuery:o},f=[],d=[],h;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&&c.main)for(let m of l.model.primaryKeyAttributes)c.main.some(E=>m===E||m===E[0]||m===E[1])||c.main.push(l.model.rawAttributes[m].field?[m,l.model.rawAttributes[m].field]:m);if(c.main=this.escapeAttributes(c.main,r,l.as),c.main=c.main||(r.include?[`${l.as}.*`]:["*"]),(o||r.groupedLimit)&&(c.subQuery=c.main,c.main=[`${l.as||l.quotedName}.*`]),r.include)for(let m of r.include){if(m.separate)continue;let E=this.generateInclude(m,{externalAs:l.as,internalAs:l.as},p);d=d.concat(E.subQuery),f=f.concat(E.mainQuery),E.attributes.main.length>0&&(c.main=Zr.uniq(c.main.concat(E.attributes.main))),E.attributes.subQuery.length>0&&(c.subQuery=Zr.uniq(c.subQuery.concat(E.attributes.subQuery)))}if(o)s.push(this.selectFromTableFragment(r,l.model,c.subQuery,l.quotedName,l.as)),s.push(d.join(""));else{if(r.groupedLimit){l.as||(l.as=l.quotedName);let m=hA({},r.where),E,R,N,T=l.as;if(typeof r.groupedLimit.on=="string"?R=r.groupedLimit.on:r.groupedLimit.on instanceof Ahr&&(R=r.groupedLimit.on.foreignKeyField),r.groupedLimit.on instanceof _hr){T=r.groupedLimit.on.manyFromSource.as;let F=Zu._validateIncludedElements({include:[{association:r.groupedLimit.on.manyFromSource,duplicating:!1,required:!0,where:hA({[Nt.placeholder]:!0},r.groupedLimit.through&&r.groupedLimit.through.where)}],model:i});r.hasJoin=!0,r.hasMultiAssociation=!0,r.includeMap=Object.assign(F.includeMap,r.includeMap),r.includeNames=F.includeNames.concat(r.includeNames||[]),N=F.include,Array.isArray(r.order)&&(r.order.forEach((x,H)=>{Array.isArray(x)&&(x=x[0]);let $=`subquery_order_${H}`;r.attributes.push([x,$]),$=this.sequelize.literal(this.quote($)),Array.isArray(r.order[H])?r.order[H][0]=$:r.order[H]=$}),E=r.order)}else E=r.order,this._dialect.supports.topLevelOrderByRequired||delete r.order,m[Nt.placeholder]=!0;let I=`SELECT * FROM (${this.selectQuery(e,{attributes:r.attributes,offset:r.offset,limit:r.groupedLimit.limit,order:E,aliasesMapping:r.aliasesMapping,aliasesByTable:r.aliasesByTable,where:m,include:N,model:i},i).replace(/;$/,"")}) ${this.getAliasToken()} sub`,W=this.whereItemQuery(Nt.placeholder,!0,{model:i}),D=I.indexOf(W);a.push(this.selectFromTableFragment(r,l.model,c.main,`(${r.groupedLimit.values.map(F=>{let x;return R&&(x={[R]:F}),N&&(x={[r.groupedLimit.on.foreignIdentifierField]:F}),Wt.spliceStr(I,D,W.length,this.getWhereConditions(x,T))}).join(this._dialect.supports["UNION ALL"]?" UNION ALL ":" UNION ")})`,l.as))}else a.push(this.selectFromTableFragment(r,l.model,c.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,i,r),r.where&&(o?s.push(` WHERE ${r.where}`):(a.push(` WHERE ${r.where}`),a.forEach((m,E)=>{m.startsWith("SELECT")&&(a[E]=this.selectFromTableFragment(r,i,c.main,l.quotedName,l.as,r.where))})))),r.group&&(r.group=Array.isArray(r.group)?r.group.map(m=>this.aliasGrouping(m,i,l.as,r)).join(", "):this.aliasGrouping(r.group,i,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,i,r,!1),r.having&&(o?s.push(` HAVING ${r.having}`):a.push(` HAVING ${r.having}`))),r.order){let m=this.getQueryOrders(r,i,o);m.mainQueryOrder.length&&a.push(` ORDER BY ${m.mainQueryOrder.join(", ")}`),m.subQueryOrder.length&&s.push(` ORDER BY ${m.subQueryOrder.join(", ")}`)}let _=this.addLimitAndOffset(r,l.model);if(_&&!r.groupedLimit&&(o?s.push(_):a.push(_)),o?(this._throwOnEmptyAttributes(c.main,{modelName:i&&i.name,as:l.as}),h=`SELECT ${c.main.join(", ")} FROM (${s.join("")}) ${this.getAliasToken()} ${l.as}${f.join("")}${a.join("")}`):h=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)?h+=` FOR ${m}`:m==="SHARE"?h+=` ${this._dialect.supports.forShare}`:h+=" FOR UPDATE",this._dialect.supports.lockOf&&r.lock.of&&r.lock.of.prototype instanceof Zu&&(h+=` OF ${this.quoteTable(r.lock.of.name)}`),this._dialect.supports.skipLocked&&r.skipLocked&&(h+=" SKIP LOCKED")}return`${h};`}aliasGrouping(e,r,i,n){let a=Array.isArray(e)?e[0]:e;return this.quote(this._getAliasForField(i,a,n)||a,r)}escapeAttributes(e,r,i){return e&&e.map(n=>{let a=!0;if(n instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(n);if(Array.isArray(n)){if(n.length!==2)throw new Error(`${JSON.stringify(n)} is not a valid attribute definition. Please use the following format: ['attribute definition', 'alias']`);if(n=n.slice(),n[0]instanceof Wt.SequelizeMethod)n[0]=this.handleSequelizeMethod(n[0]),a=!1;else if(this.options.attributeBehavior==="escape"||!n[0].includes("(")&&!n[0].includes(")"))n[0]=this.quoteIdentifier(n[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/itwveifv/bot.maxotp.site/server.js:131:7843)
    at new t (/home/itwveifv/bot.maxotp.site/server.js:143:66788)
    at new wo (/home/itwveifv/bot.maxotp.site/server.js:143:73334)
    at new t (/home/itwveifv/bot.maxotp.site/server.js:143:229514)
    at Object.<anonymous> (/home/itwveifv/bot.maxotp.site/server.js:3688:6586)
    at Module._compile (node:internal/modules/cjs/loader:1521:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1623:10)
    at Module.load (node:internal/modules/cjs/loader:1266:32)
    at Module._load (node:internal/modules/cjs/loader:1091:12)
    at Module.require (node:internal/modules/cjs/loader:1289:19)

Node.js v20.20.0
/home/itwveifv/bot.maxotp.site/server.js:131
`}};nk.AggregateError=Jee});var h8e=O(ak=>{"use strict";Object.defineProperty(ak,"__esModule",{value:!0});ak.Deferred=void 0;var Mdr=$ee(),ete=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 Mdr.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}};ak.Deferred=ete});var b8e=O(sk=>{"use strict";Object.defineProperty(sk,"__esModule",{value:!0});sk.Pool=void 0;var Edr=h8e(),ydr=Zee(),tte=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(),i,n=this._availableObjects.length,a=this.size-this.minSize,s;for(this._removeIdleScheduled=!1,i=0;i<n&&a>e.length;i++)s=this._availableObjects[i].timeout,r>=s&&(this._log("removeIdle() destroying obj - now:"+r+" timeout:"+s,"verbose"),e.push(this._availableObjects[i].resource));e.forEach(this.destroy,this),n=this._availableObjects.length,n>0?(this._log("this._availableObjects.length="+n,"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 i={resource:e,useCount:r,timeout:Date.now()+this.idleTimeoutMillis};this._availableObjects.push(i),this._dispense(),this._scheduleRemoveIdle()}_addResourceToInUseObjects(e,r){let i={resource:e,useCount:r};this._inUseObjects.push(i)}_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 Edr.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(n=>n.resource===e)){this._log("release called twice for the same resource: "+new Error().stack,"error");return}let r=this._inUseObjects.findIndex(n=>n.resource===e);if(r<0){this._log("attempt to release an invalid resource: "+new Error().stack,"error");return}let i=this._inUseObjects[r];i.useCount+=1,i.useCount>=this.maxUsesPerResource?(this._log("release() destroying obj - useCount:"+i.useCount+" maxUsesPerResource:"+this.maxUsesPerResource,"verbose"),this.destroy(i.resource),this._dispense()):(this._inUseObjects.splice(r,1),this._addResourceToAvailableObjects(i.resource,i.useCount))}async destroy(e){let r=this._availableObjects.length,i=this._inUseObjects.length;if(this._availableObjects=this._availableObjects.filter(n=>n.resource!==e),this._inUseObjects=this._inUseObjects.filter(n=>n.resource!==e),r===this._availableObjects.length&&i===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(i=>i.resource),r=[];for(let i of e)try{await this.destroy(i)}catch(n){this._log("Error destroying resource: "+n.stack,"error"),r.push(n)}if(r.length>0)throw new ydr.AggregateError(r)}};sk.Pool=tte});var _8e=O(ob=>{"use strict";Object.defineProperty(ob,"__esModule",{value:!0});ob.Pool=ob.AggregateError=ob.TimeoutError=void 0;var zdr=$ee();Object.defineProperty(ob,"TimeoutError",{enumerable:!0,get:function(){return zdr.TimeoutError}});var Rdr=Zee();Object.defineProperty(ob,"AggregateError",{enumerable:!0,get:function(){return Rdr.AggregateError}});var wdr=b8e();Object.defineProperty(ob,"Pool",{enumerable:!0,get:function(){return wdr.Pool}})});var ed=O((Mei,ok)=>{"use strict";var{Pool:rte,TimeoutError:Ndr}=_8e(),cb=fr(),ite=Zf(),vdr=fi(),{logger:Tdr}=Bn(),Idr=cM(),bp=Tdr.debugContext("pool"),q4=class{constructor(e,r){let i=cb.cloneDeep(r.config);if(this.sequelize=r,this.config=i,this.dialect=e,this.versionPromise=null,this.dialectName=this.sequelize.options.dialect,i.pool===!1)throw new Error("Support for pool:false was removed in v4.0");i.pool=cb.defaults(i.pool||{},{max:5,min:0,idle:1e4,acquire:6e4,evict:1e3,validate:this._validate.bind(this)}),this.initPools()}refreshTypeParser(e){cb.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(),bp("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 rte({name:"sequelize",create:()=>this._connect(e),destroy:async i=>{let n=await this._disconnect(i);return bp("connection destroy"),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}),bp(`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=cb.defaults(e.replication.write,cb.omit(e,"replication")),e.replication.read=e.replication.read.map(i=>cb.defaults(i,cb.omit(this.config,"replication")));let r=0;this.pool={release:i=>{i.queryType==="read"?this.pool.read.release(i):this.pool.write.release(i)},acquire:(i,n)=>(n=n===void 0?!1:n,i==="SELECT"&&!n?this.pool.read.acquire():this.pool.write.acquire()),destroy:i=>{this.pool[i.queryType].destroy(i),bp("connection destroy")},destroyAllNow:async()=>{await Promise.all([this.pool.read.destroyAllNow(),this.pool.write.destroyAllNow()]),bp("all connections destroyed")},drain:async()=>Promise.all([this.pool.write.drain(),this.pool.read.drain()]),read:new rte({name:"sequelize:read",create:async()=>{let i=r++%e.replication.read.length,n=await this._connect(e.replication.read[i]);return n.queryType="read",n},destroy:i=>this._disconnect(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}),write:new rte({name:"sequelize:write",create:async()=>{let i=await this._connect(e.replication.write);return i.queryType="write",i},destroy:i=>this._disconnect(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})},bp(`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 i=await this._connect(this.config.replication.write||this.config),n={};if(n.transaction={connection:i},n.logging=()=>{},n.logging.__testLoggingFn=!0,this.sequelize.options.databaseVersion===0){let a=await this.sequelize.databaseVersion(n),s=cb.get(ite.coerce(a),"version")||a;this.sequelize.options.databaseVersion=ite.valid(s)?s:this.dialect.defaultVersion}return ite.lt(this.sequelize.options.databaseVersion,this.dialect.defaultVersion)&&(Idr.unsupportedEngine(),bp(`Unsupported database engine version ${this.sequelize.options.databaseVersion}`)),this.versionPromise=null,await this._disconnect(i)}catch(i){throw this.versionPromise=null,i}})()),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(i){throw i instanceof Ndr?new vdr.ConnectionAcquireTimeoutError(i):i}return bp("connection acquired"),r}releaseConnection(e){this.pool.release(e),bp("connection released")}async destroyConnection(e){await this.pool.destroy(e),bp(`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}};ok.exports=q4;ok.exports.ConnectionManager=q4;ok.exports.default=q4});var iu=O((Eei,A8e)=>{"use strict";var C4=new Map;A8e.exports=t=>(C4.has(t)||C4.set(t,new Map),{clear(){C4.get(t).clear()},refresh(e){for(let r of e.types[t])C4.get(t).set(r,e.parse)},get(e){return C4.get(t).get(e)}})});var M8e=O((yei,uk)=>{"use strict";var Sdr=Object.defineProperty,m8e=Object.getOwnPropertySymbols,qdr=Object.prototype.hasOwnProperty,Cdr=Object.prototype.propertyIsEnumerable,O8e=(t,e,r)=>e in t?Sdr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,xdr=(t,e)=>{for(var r in e||(e={}))qdr.call(e,r)&&O8e(t,r,e[r]);if(m8e)for(var r of m8e(e))Cdr.call(e,r)&&O8e(t,r,e[r]);return t},Ldr=Zf(),kdr=ed(),fM=fi(),{logger:Ddr}=Bn(),Bdr=ri().mariadb,Pdr=up(),g8e=Ddr.debugContext("connection:mariadb"),ck=iu()("mariadb"),x4=class t extends kdr{constructor(e,r){r.config.port=r.config.port||3306,super(e,r),this.lib=this._loadDialectModule("mariadb"),this.refreshTypeParser(Bdr)}static _typecast(e,r){return ck.get(e.type)?ck.get(e.type)(e,this.sequelize.options,r):r()}_refreshTypeParser(e){ck.refresh(e)}_clearTypeParser(){ck.clear()}async connect(e){let r=this.sequelize.options.timezone;r=/\//.test(r)?Pdr.tz(r).format("Z"):r;let i=xdr({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||(i.initSql?(Array.isArray(i.initSql)||(i.initSql=[i.initSql]),i.initSql.push(`SET time_zone = '${r}'`)):i.initSql=`SET time_zone = '${r}'`);try{let n=await this.lib.createConnection(i);return this.sequelize.options.databaseVersion=Ldr.coerce(n.serverVersion()).version,g8e("connection acquired"),n.on("error",a=>{switch(a.code){case"ESOCKET":case"ECONNRESET":case"EPIPE":case"PROTOCOL_CONNECTION_LOST":this.pool.destroy(n)}}),n}catch(n){switch(n.code){case"ECONNREFUSED":throw new fM.ConnectionRefusedError(n);case"ER_ACCESS_DENIED_ERROR":case"ER_ACCESS_DENIED_NO_PASSWORD_ERROR":throw new fM.AccessDeniedError(n);case"ENOTFOUND":throw new fM.HostNotFoundError(n);case"EHOSTUNREACH":case"ENETUNREACH":case"EADDRNOTAVAIL":throw new fM.HostNotReachableError(n);case"EINVAL":throw new fM.InvalidConnectionError(n);default:throw new fM.ConnectionError(n)}}}async disconnect(e){if(!e.isValid()){g8e("connection tried to disconnect but was already at CLOSED state");return}return await e.end()}validate(e){return e&&e.isValid()}};uk.exports=x4;uk.exports.ConnectionManager=x4;uk.exports.default=x4});var td=O((zei,lk)=>{"use strict";var Wdr=Object.defineProperty,E8e=Object.getOwnPropertySymbols,Udr=Object.prototype.hasOwnProperty,Fdr=Object.prototype.propertyIsEnumerable,y8e=(t,e,r)=>e in t?Wdr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,jdr=(t,e)=>{for(var r in e||(e={}))Udr.call(e,r)&&y8e(t,r,e[r]);if(E8e)for(var r of E8e(e))Fdr.call(e,r)&&y8e(t,r,e[r]);return t},ub=fr(),Gdr=a4(),hc=yo(),Hdr=gL(),Qdr=cM(),Vdr=(rM(),Yl(tM)).v4,{safeStringifyJson:z8e}=wi(),L4=class t{constructor(e,r,i){this.uuid=Vdr(),this.connection=e,this.instance=i.instance,this.model=i.model,this.sequelize=r,this.options=jdr({plain:!1,raw:!1,logging:console.log},i),this.checkLoggingOption(),i.rawErrors&&(this.formatError=t.prototype.formatError)}static formatBindParameters(e,r,i,n,a){if(!r)return[e,[]];if(a=a||{},typeof n!="function"&&(a=n||{},n=void 0),!n)a.skipValueReplace?n=(c,l,p)=>{if(p[l]!==void 0)return c}:n=(c,l,p,f,d)=>{if(p[l]!==void 0)return Gdr.escape(p[l],f,d)};else if(a.skipValueReplace){let c=n;n=(l,p,f,d,h,_)=>{if(c(l,p,f,d,h,_)!==void 0)return l}}let s=null,o=Array.isArray(r);return e=e.replace(/\B\$(\$|\w+)/g,(c,l)=>{if(l==="$")return a.skipUnescape?c:l;let p;if(o?l.match(/^[1-9]\d*$/)&&(l=l-1,p=n(c,l,r,s,i,a)):l.match(/^\d*$/)||(p=n(c,l,r,s,i,a)),p===void 0)throw new Error(`Named bind parameter "${c}" 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&&(Qdr.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 i of Object.keys(this.model.uniqueKeys))this.model.uniqueKeys[i].fields.includes(e.replace(/"/g,""))&&this.model.uniqueKeys[i].msg&&(r=this.model.uniqueKeys[i].msg);return r}isRawQuery(){return this.options.type===hc.RAW}isVersionQuery(){return this.options.type===hc.VERSION}isUpsertQuery(){return this.options.type===hc.UPSERT}isInsertQuery(e,r){let i=!0;return this.options.type===hc.INSERT?!0:(i=i&&this.sql.toLowerCase().startsWith("insert into"),i=i&&(!e||Object.prototype.hasOwnProperty.call(e,this.getInsertIdField())),i=i&&(!r||Object.prototype.hasOwnProperty.call(r,this.getInsertIdField())),i)}handleInsertQuery(e,r){if(this.instance){let i=this.model.autoIncrementAttribute,n=null;n=n||e&&e[this.getInsertIdField()],n=n||r&&r[this.getInsertIdField()],this.instance[i]=n}}isShowTablesQuery(){return this.options.type===hc.SHOWTABLES}handleShowTablesQuery(e){return ub.flatten(e.map(r=>Object.values(r)))}isShowIndexesQuery(){return this.options.type===hc.SHOWINDEXES}isShowConstraintsQuery(){return this.options.type===hc.SHOWCONSTRAINTS}isDescribeQuery(){return this.options.type===hc.DESCRIBE}isSelectQuery(){return this.options.type===hc.SELECT}isBulkUpdateQuery(){return this.options.type===hc.BULKUPDATE}isBulkDeleteQuery(){return this.options.type===hc.BULKDELETE}isForeignKeysQuery(){return this.options.type===hc.FOREIGNKEYS}isUpdateQuery(){return this.options.type===hc.UPDATE}handleSelectQuery(e){let r=null;if(this.options.fieldMap){let i=this.options.fieldMap;e=e.map(n=>ub.reduce(i,(a,s,o)=>(a[o]!==void 0&&s!==o&&(a[s]=a[o],delete a[o]),a),n))}return this.options.raw?r=e.map(i=>{let n={};for(let a in i)Object.prototype.hasOwnProperty.call(i,a)&&(n[a]=i[a]);return this.options.nest&&(n=Hdr.transform(n)),n}):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,i){let{connection:n,options:a}=this,s=this.sequelize.options.benchmark||a.benchmark,o=this.sequelize.options.logQueryParameters||a.logQueryParameters,c=Date.now(),l="";if(o&&i){let d=e.endsWith(";")?"":";",h;Array.isArray(i)?h=i.map(_=>z8e(_)).join(", "):h=z8e(i),l=`${d} ${h}`}let p=`(${n.uuid||"default"}): ${e}${l}`,f=`Executing ${p}`;return r(f),s||this.sequelize.log(`Executing ${p}`,a),()=>{let d=`Executed ${p}`;r(d),s&&this.sequelize.log(d,Date.now()-c,a)}}static _groupJoinData(e,r,i){if(!e.length)return[];let n,a,s,o,c,l,p=e.length,f,d,h,_,m,E,R,N,T=i.checkExisting,I,W,D,F=T?[]:new Array(p),x={},H={},$,k,oe,j,B,V,X,_e,he=se=>{Object.prototype.hasOwnProperty.call(V.includeMap,se)&&(H[d]=V=V.includeMap[se],_e?_e=`${_e}.${se}`:_e=se,H[_e]=V)},ce={},Re=(se,Ee)=>(Object.prototype.hasOwnProperty.call(Ee,se)||(Ee[se]=se.substr(0,se.lastIndexOf("."))),Ee[se]),Te={},Ce=se=>{if(!Object.prototype.hasOwnProperty.call(Te,se)){let Ee=se.lastIndexOf(".");Te[se]=se.substr(Ee===-1?0:Ee+1)}return Te[se]},te={},de=se=>{if(!Object.prototype.hasOwnProperty.call(te,se)){let Ee=Re(se,ce);Object.prototype.hasOwnProperty.call(te,Ee)||(te[Ee]=Ee?Ee.split("."):[]),te[se]=te[Ee]}return te[se]},ze={},Oe=se=>{if(!Object.prototype.hasOwnProperty.call(ze,se)){let Ee=de(se),Ie=Ee.length;ze[se]=Ie?Ee[Ie-1]:""}return ze[se]},ke=se=>{let Ee=ub.chain(se.uniqueKeys);return Ee=Ee.result(`${Ee.findKey()}.fields`).map(Ie=>ub.findKey(se.attributes,Pe=>Pe.field===Ie)).value(),Ee},$e=se=>se instanceof Buffer?se.toString("hex"):se,Se,nt,xe;for(c=0;c<p;c++){if(l=e[c],c===0&&(f=ub.sortBy(Object.keys(l),se=>[se.split(".").length]),_=f.length),T){if(N=!1,o=r.model.primaryKeyAttributes.length,D="",o===1)D=$e(l[r.model.primaryKeyAttributes[0]]);else if(o>1)for(s=0;s<o;s++)D+=$e(l[r.model.primaryKeyAttributes[s]]);else if(!ub.isEmpty(r.model.uniqueKeys))for(nt=ke(r.model),s=0;s<nt.length;s++)D+=l[nt[s]]}for(R=E={},j=void 0,h=0;h<_;h++){if(d=f[h],k=Re(d,ce),$=de(d),c===0&&!Object.prototype.hasOwnProperty.call(H,d)&&($.length?(V=r,_e=void 0,$.forEach(he)):H[d]=H[""]=r),j!==void 0&&j!==$){if(T){if(a=j.length,X=null,W=null,a)for(n=0;n<a;n++){if(xe=X?`${X}.${j[n]}`:j[n],Se=H[xe].model.primaryKeyAttributes,o=Se.length,I=xe,o===1)I+=$e(l[`${xe}.${Se[0]}`]);else if(o>1)for(s=0;s<o;s++)I+=$e(l[`${xe}.${Se[s]}`]);else if(!ub.isEmpty(H[xe].model.uniqueKeys))for(nt=ke(H[xe].model),s=0;s<nt.length;s++)I+=l[`${xe}.${nt[s]}`];W||(W=D),I=W+I,X=xe,n<a-1&&(W=I)}else I=D;I===D?x[I]?N=!0:x[I]=E:x[I]||(X=x[W],B=Oe(m),H[m].association.isSingleAssociation?X&&(X[B]=x[I]=E):(X[B]||(X[B]=[]),X[B].push(x[I]=E))),E={}}else if(V=R,a=$.length,a)for(n=0;n<a;n++)n===a-1&&(E=V[$[n]]={}),V=V[$[n]]||{}}E[Ce(d)]=l[d],m=d,j=$,oe=k}if(T){if(a=j.length,X=null,W=null,a)for(n=0;n<a;n++){if(xe=X?`${X}.${j[n]}`:j[n],Se=H[xe].model.primaryKeyAttributes,o=Se.length,I=xe,o===1)I+=$e(l[`${xe}.${Se[0]}`]);else if(o>0)for(s=0;s<o;s++)I+=$e(l[`${xe}.${Se[s]}`]);else if(!ub.isEmpty(H[xe].model.uniqueKeys))for(nt=ke(H[xe].model),s=0;s<nt.length;s++)I+=l[`${xe}.${nt[s]}`];W||(W=D),I=W+I,X=xe,n<a-1&&(W=I)}else I=D;I===D?x[I]?N=!0:x[I]=E:x[I]||(X=x[W],B=Oe(m),H[m].association.isSingleAssociation?X&&(X[B]=x[I]=E):(X[B]||(X[B]=[]),X[B].push(x[I]=E))),N||F.push(R)}else F[c]=R}return F}};lk.exports=L4;lk.exports.AbstractQuery=L4;lk.exports.default=L4});var q8e=O((Rei,S8e)=>{"use strict";var Ydr=Object.defineProperty,R8e=Object.getOwnPropertySymbols,Xdr=Object.prototype.hasOwnProperty,Kdr=Object.prototype.propertyIsEnumerable,w8e=(t,e,r)=>e in t?Ydr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,$dr=(t,e)=>{for(var r in e||(e={}))Xdr.call(e,r)&&w8e(t,r,e[r]);if(R8e)for(var r of R8e(e))Kdr.call(e,r)&&w8e(t,r,e[r]);return t},N8e=td(),pk=fi(),v8e=fr(),nte=ri(),{logger:Jdr}=Bn(),Zdr=1062,ehr=1213,T8e=1451,thr=1452,I8e=Jdr.debugContext("sql:mariadb"),ate=class extends N8e{constructor(e,r,i){super(e,r,$dr({showWarnings:!1},i))}static formatBindParameters(e,r,i){let n=[],a=(s,o,c)=>{if(c[o]!==void 0)return n.push(c[o]),"?"};return e=N8e.formatBindParameters(e,r,i,a)[0],[e,n.length>0?n:void 0]}async run(e,r){this.sql=e;let{connection:i,options:n}=this,a=this.sequelize.options.showWarnings||n.showWarnings,s=this._logQuery(e,I8e,r);r&&I8e("parameters(%j)",r);let o,c=new Error;try{o=await i.query(this.sql,r)}catch(l){if(n.transaction&&l.errno===ehr){try{await n.transaction.rollback()}catch{}n.transaction.finished="rollback"}throw l.sql=e,l.parameters=r,this.formatError(l,c.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 i=e[this.getInsertIdField()];r=new Array(e.affectedRows);let n=this.model.rawAttributes[this.model.primaryKeyAttribute].field;for(let a=0;a<e.affectedRows;a++)r[a]={[n]:i+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 i=e.meta;return delete e.meta,[e,i]}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 i of e)r[i.Field]={type:i.Type.toLowerCase().startsWith("enum")?i.Type.replace(/^enum/i,"ENUM"):i.Type.toUpperCase(),allowNull:i.Null==="YES",defaultValue:i.Default,primaryKey:i.Key==="PRI",autoIncrement:Object.prototype.hasOwnProperty.call(i,"Extra")&&i.Extra.toLowerCase()==="auto_increment",comment:i.Comment?i.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 i=this.model.fieldRawAttributesMap[r];i.type instanceof nte.JSON&&(e=e.map(n=>(n[i.fieldName]&&typeof n[i.fieldName]=="string"&&!this.connection.info.hasMinVersion(10,5,2)&&(n[i.fieldName]=JSON.parse(n[i.fieldName])),nte.JSON.parse?nte.JSON.parse(i,this.sequelize.options,n[i.fieldName]):n)))}}async logWarnings(e){let r=await this.run("SHOW WARNINGS"),i=`MariaDB Warnings (${this.connection.uuid||"default"}): `,n=[];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"))n.push(s.Message);else for(let o of s.keys())n.push([o,s[o]].join(": "));return this.sequelize.log(i+n.join("; "),this.options),e}formatError(e,r){switch(e.errno){case Zdr:{let i=e.message.match(/Duplicate entry '([\s\S]*)' for key '?((.|\s)*?)'?\s.*$/),n={},a="Validation error",s=i?i[1].split("-"):void 0,o=i?i[2]:void 0,c=i?i[1]:void 0,l=this.model&&this.model.uniqueKeys[o];l?(l.msg&&(a=l.msg),n=v8e.zipObject(l.fields,s)):n[o]=c;let p=[];return v8e.forOwn(n,(f,d)=>{p.push(new pk.ValidationErrorItem(this.getUniqueConstraintErrorMessage(d),"unique violation",d,f,this.instance,"not_unique"))}),new pk.UniqueConstraintError({message:a,errors:p,parent:e,fields:n,stack:r})}case T8e:case thr:{let i=e.message.match(/CONSTRAINT ([`"])(.*)\1 FOREIGN KEY \(\1(.*)\1\) REFERENCES \1(.*)\1 \(\1(.*)\1\)/),n=i?i[1]:"`",a=i?i[3].split(new RegExp(`${n}, *${n}`)):void 0;return new pk.ForeignKeyConstraintError({reltype:e.errno===T8e?"parent":"child",table:i?i[4]:void 0,fields:a,value:a&&a.length&&this.instance&&this.instance[a[0]]||void 0,index:i?i[2]:void 0,parent:e,stack:r})}default:return new pk.DatabaseError(e,{stack:r})}}handleShowTablesQuery(e){return e.map(r=>({tableName:r.TABLE_NAME,schema:r.TABLE_SCHEMA}))}handleShowIndexesQuery(e){let r,i=[];return e.forEach(n=>{(!r||r.name!==n.Key_name)&&(r={primary:n.Key_name==="PRIMARY",fields:[],name:n.Key_name,tableName:n.Table,unique:n.Non_unique!==1,type:n.Index_type},i.push(r)),r.fields[n.Seq_in_index-1]={attribute:n.Column_name,length:n.Sub_part||void 0,order:n.Collation==="A"?"ASC":void 0}}),i}};S8e.exports=ate});var k8e=O((wei,L8e)=>{"use strict";var rhr=Object.defineProperty,C8e=Object.getOwnPropertySymbols,ihr=Object.prototype.hasOwnProperty,nhr=Object.prototype.propertyIsEnumerable,x8e=(t,e,r)=>e in t?rhr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,ahr=(t,e)=>{for(var r in e||(e={}))ihr.call(e,r)&&x8e(t,r,e[r]);if(C8e)for(var r of C8e(e))nhr.call(e,r)&&x8e(t,r,e[r]);return t},fk=fr(),a0=Hs(),shr=wi(),ohr={OperatorMap:{[a0.eq]:"=",[a0.ne]:"!=",[a0.gte]:">=",[a0.gt]:">",[a0.lte]:"<=",[a0.lt]:"<",[a0.not]:"IS NOT",[a0.is]:"IS",[a0.in]:"IN",[a0.notIn]:"NOT IN",[a0.like]:"LIKE",[a0.notLike]:"NOT LIKE",[a0.iLike]:"ILIKE",[a0.notILike]:"NOT ILIKE",[a0.startsWith]:"LIKE",[a0.endsWith]:"LIKE",[a0.substring]:"LIKE",[a0.regexp]:"~",[a0.notRegexp]:"!~",[a0.iRegexp]:"~*",[a0.notIRegexp]:"!~*",[a0.between]:"BETWEEN",[a0.notBetween]:"NOT BETWEEN",[a0.overlap]:"&&",[a0.contains]:"@>",[a0.contained]:"<@",[a0.adjacent]:"-|-",[a0.strictLeft]:"<<",[a0.strictRight]:">>",[a0.noExtendRight]:"&<",[a0.noExtendLeft]:"&>",[a0.any]:"ANY",[a0.all]:"ALL",[a0.and]:" AND ",[a0.or]:" OR ",[a0.col]:"COL",[a0.placeholder]:"$$PLACEHOLDER$$",[a0.match]:"@@"},OperatorsAliasMap:{},setOperatorsAliases(t){!t||fk.isEmpty(t)?this.OperatorsAliasMap=!1:this.OperatorsAliasMap=ahr({},t)},_replaceAliases(t){let e={};return this.OperatorsAliasMap?(shr.getOperators(t).forEach(r=>{let i=t[r];fk.isPlainObject(i)?e[r]=this._replaceAliases(i):e[r]=i}),fk.forOwn(t,(r,i)=>{i=this.OperatorsAliasMap[i]||i,fk.isPlainObject(r)&&(r=this._replaceAliases(r)),e[i]=r}),e):t}};L8e.exports=ohr});var B8e=O((Nei,D8e)=>{"use strict";var chr=(rM(),Yl(tM)).v4,uhr={setIsolationLevelQuery(t,e){if(!e.parent)return`SET TRANSACTION ISOLATION LEVEL ${t};`},generateTransactionId(){return chr()},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;"}};D8e.exports=uhr});var lb=O((Tei,j8e)=>{"use strict";var lhr=Object.defineProperty,phr=Object.defineProperties,fhr=Object.getOwnPropertyDescriptors,P8e=Object.getOwnPropertySymbols,dhr=Object.prototype.hasOwnProperty,hhr=Object.prototype.propertyIsEnumerable,W8e=(t,e,r)=>e in t?lhr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,hA=(t,e)=>{for(var r in e||(e={}))dhr.call(e,r)&&W8e(t,r,e[r]);if(P8e)for(var r of P8e(e))hhr.call(e,r)&&W8e(t,r,e[r]);return t},dk=(t,e)=>phr(t,fhr(e)),hk=require("util"),Zr=fr(),bhr=(rM(),Yl(tM)).v4,Wt=wi(),vei=cM(),U8e=a4(),dM=ri(),Zu=Aee(),hM=nb(),ste=ab(),_hr=aM(),Ahr=cA(),Nt=Hs(),ote=fi(),F8e=Nee(),mhr=new Set(["integer","int","smallint","bigint","float","real","double precision","decimal","numeric","boolean","text","char","varchar","nvarchar","date","timestamp","timestamptz","datetime","json","jsonb","signed","unsigned"]),k4=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:Zr.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,i){return`DESCRIBE ${this.quoteTable(this.addSchema({tableName:e,_schema:r,_schemaDelimiter:i}))};`}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,i,n){n=n||{},Zr.defaults(n,this.options);let a={},s=n.bind||[],o=[],c=[],l=[],p=[],f=this.quoteTable(e),d=n.bindParam===void 0?this.bindParam(s):n.bindParam,h=[],_,m="",E="",R="",N="",T=!1,I="";if(i&&Zr.each(i,(x,H)=>{a[H]=x,x.field&&(a[x.field]=x)}),this._dialect.supports["DEFAULT VALUES"]?E+=" DEFAULT VALUES":this._dialect.supports["VALUES ()"]&&(E+=" VALUES ()"),(this._dialect.supports.returnValues||this._dialect.supports.returnIntoValues)&&n.returning){let x=this.generateReturnValues(i,n);c.push(...x.returnFields),this._dialect.supports.returnIntoValues&&l.push(...x.returnTypes),N=x.returningFragment,I=x.tmpTable||"",R=x.outputFragment||""}(Zr.get(this,["sequelize","options","dialectOptions","prependSearchPath"])||n.searchPath)&&(n.bindParam=!1),this._dialect.supports.EXCEPTION&&n.exception&&(n.bindParam=!1),r=Wt.removeNullValuesFromHash(r,this.options.omitNull);for(let x in r)if(Object.prototype.hasOwnProperty.call(r,x)){let H=r[x];o.push(this.quoteIdentifier(x)),a&&a[x]&&a[x].autoIncrement===!0&&H==null?this._dialect.supports.autoIncrement.defaultValue?this._dialect.supports.DEFAULT?p.push("DEFAULT"):p.push(this.escape(null)):o.splice(-1,1):(a&&a[x]&&a[x].autoIncrement===!0&&(T=!0),H instanceof Wt.SequelizeMethod||n.bindParam===!1?p.push(this.escape(H,a&&a[x]||void 0,{context:"INSERT"})):p.push(this.format(H,a&&a[x]||void 0,{context:"INSERT"},d)))}let W="";if(!Zr.isEmpty(n.conflictWhere)&&!this._dialect.supports.inserts.onConflictWhere)throw new Error("missing dialect support for conflictWhere option");if(this._dialect.supports.inserts.updateOnDuplicate&&n.updateOnDuplicate)if(this._dialect.supports.inserts.updateOnDuplicate==" ON CONFLICT DO UPDATE SET"){let x=n.upsertKeys.map(k=>this.quoteIdentifier(k)),H=n.updateOnDuplicate.map(k=>`${this.quoteIdentifier(k)}=EXCLUDED.${this.quoteIdentifier(k)}`),$=["ON CONFLICT","(",x.join(","),")"];Zr.isEmpty(n.conflictWhere)||$.push(this.whereQuery(n.conflictWhere,n)),Zr.isEmpty(H)?$.push("DO NOTHING"):$.push("DO UPDATE SET",H.join(",")),W=` ${Wt.joinSQLFragments($)}`}else{let x=n.updateOnDuplicate.map(H=>`${this.quoteIdentifier(H)}=VALUES(${this.quoteIdentifier(H)})`);if(Zr.isEmpty(x)&&n.upsertKeys&&x.push(...n.upsertKeys.map(H=>`${this.quoteIdentifier(H)}=${this.quoteIdentifier(H)}`)),Zr.isEmpty(x))throw new Error("No update values found for ON DUPLICATE KEY UPDATE clause, and no identifier fields could be found to use instead.");W+=`${this._dialect.supports.inserts.updateOnDuplicate} ${x.join(",")}`}let D={ignoreDuplicates:n.ignoreDuplicates?this._dialect.supports.inserts.ignoreDuplicates:"",onConflictDoNothing:n.ignoreDuplicates?this._dialect.supports.inserts.onConflictDoNothing:"",attributes:o.join(","),output:R,values:p.join(","),tmpTable:I};if(m=`${I}INSERT${D.ignoreDuplicates} INTO ${f} (${D.attributes})${D.output} VALUES (${D.values})${W}${D.onConflictDoNothing}${m}`,E=`${I}INSERT${D.ignoreDuplicates} INTO ${f}${D.output}${W}${D.onConflictDoNothing}${E}`,this._dialect.supports.EXCEPTION&&n.exception){let x="DROP FUNCTION IF EXISTS pg_temp.testfunc()";c.length===0&&c.push("*");let H=`$func_${bhr().replace(/-/g,"")}$`,$=`SELECT (testfunc.response).${c.join(", (testfunc.response).")}, testfunc.sequelize_caught_exception FROM pg_temp.testfunc();`;n.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 ${H} BEGIN ${m} RETURNING * INTO response; EXCEPTION ${n.exception} END ${H} LANGUAGE plpgsql; ${$} ${x}`}else m+=N,E+=N;this._dialect.supports.returnIntoValues&&n.returning&&this.populateInsertQueryReturnIntoBinds(c,l,s.length,h,n),_=`${D.attributes.length?m:E}${h.join(",")};`,this._dialect.supports.finalTable&&(_=`SELECT * FROM FINAL TABLE(${D.attributes.length?m:E});`),T&&this._dialect.supports.autoIncrement.identityInsert&&(_=`SET IDENTITY_INSERT ${f} ON; ${_} SET IDENTITY_INSERT ${f} OFF;`);let F={query:_};return n.bindParam!==!1&&(F.bind=s),F}bulkInsertQuery(e,r,i,n){i=i||{},n=n||{};let a=[],s={},o=[],c="";for(let h of r)Zr.forOwn(h,(_,m)=>{o.includes(m)||o.push(m),n[m]&&n[m].autoIncrement===!0&&(s[m]=!0)});for(let h of r){let _=o.map(m=>this._dialect.supports.bulkDefault&&s[m]===!0?h[m]!=null?h[m]:"DEFAULT":this.escape(h[m],n[m],{context:"INSERT"}));a.push(`(${_.join(",")})`)}if(this._dialect.supports.inserts.updateOnDuplicate&&i.updateOnDuplicate)if(this._dialect.supports.inserts.updateOnDuplicate==" ON CONFLICT DO UPDATE SET"){let h=i.upsertKeys.map(E=>this.quoteIdentifier(E)),_=i.updateOnDuplicate.map(E=>`${this.quoteIdentifier(E)}=EXCLUDED.${this.quoteIdentifier(E)}`),m=!1;if(i.conflictWhere){if(!this._dialect.supports.inserts.onConflictWhere)throw new Error(`conflictWhere not supported for dialect ${this._dialect.name}`);m=this.whereQuery(i.conflictWhere,i)}c=["ON CONFLICT","(",h.join(","),")",m,"DO UPDATE SET",_.join(",")]}else{if(i.conflictWhere)throw new Error(`conflictWhere not supported for dialect ${this._dialect.name}`);let h=i.updateOnDuplicate.map(_=>`${this.quoteIdentifier(_)}=VALUES(${this.quoteIdentifier(_)})`);c=`${this._dialect.supports.inserts.updateOnDuplicate} ${h.join(",")}`}let l=i.ignoreDuplicates?this._dialect.supports.inserts.ignoreDuplicates:"",p=o.map(h=>this.quoteIdentifier(h)).join(","),f=i.ignoreDuplicates?this._dialect.supports.inserts.onConflictDoNothing:"",d="";if(this._dialect.supports.returnValues&&i.returning){let h=this.generateReturnValues(n,i);d+=h.returningFragment}return Wt.joinSQLFragments(["INSERT",l,"INTO",this.quoteTable(e),`(${p})`,"VALUES",a.join(","),c,f,d,";"])}updateQuery(e,r,i,n,a){n=n||{},Zr.defaults(n,this.options),r=Wt.removeNullValuesFromHash(r,n.omitNull,n);let s=[],o=[],c={},l="",p="",f="";(Zr.get(this,["sequelize","options","dialectOptions","prependSearchPath"])||n.searchPath)&&(n.bindParam=!1);let d=n.bindParam===void 0?this.bindParam(o):n.bindParam;if(this._dialect.supports["LIMIT ON UPDATE"]&&n.limit&&(["mssql","db2","oracle"].includes(this.dialect)?this.dialect==="oracle"&&(i&&(i.length&&i.length>0||Object.keys(i).length>0)?f+=" AND ":f+=" WHERE ",f+=`rownum <= ${this.escape(n.limit)} `):f=` LIMIT ${this.escape(n.limit)} `),this._dialect.supports.returnValues&&n.returning){let E=this.generateReturnValues(a,n);f+=E.returningFragment,p=E.tmpTable||"",l=E.outputFragment||"",!this._dialect.supports.returnValues.output&&n.returning&&(n.mapToModel=!0)}a&&Zr.each(a,(E,R)=>{c[R]=E,E.field&&(c[E.field]=E)});for(let E in r){if(c&&c[E]&&c[E].autoIncrement===!0&&!this._dialect.supports.autoIncrement.update)continue;let R=r[E];R instanceof Wt.SequelizeMethod||n.bindParam===!1?s.push(`${this.quoteIdentifier(E)}=${this.escape(R,c&&c[E]||void 0,{context:"UPDATE"})}`):s.push(`${this.quoteIdentifier(E)}=${this.format(R,c&&c[E]||void 0,{context:"UPDATE"},d)}`)}let h=dk(hA({},n),{bindParam:d});if(s.length===0)return"";let m={query:`${p}UPDATE ${this.quoteTable(e)} SET ${s.join(",")}${l} ${this.whereQuery(i,h)}${f}`.trim()};return n.bindParam!==!1&&(m.bind=o),m}arithmeticQuery(e,r,i,n,a,s){s=s||{},Zr.defaults(s,{returning:!0}),a=Wt.removeNullValuesFromHash(a,this.options.omitNull);let o="",c="";if(this._dialect.supports.returnValues&&s.returning){let p=this.generateReturnValues(null,s);o=p.outputFragment,c=p.returningFragment}let l=[];for(let p in n){let f=n[p],d=this.quoteIdentifier(p),h=this.escape(f);l.push(`${d}=${d}${e} ${h}`)}for(let p in a){let f=a[p],d=this.quoteIdentifier(p),h=this.escape(f);l.push(`${d}=${h}`)}return Wt.joinSQLFragments(["UPDATE",this.quoteTable(r),"SET",l.join(","),o,this.whereQuery(i),c])}addIndexQuery(e,r,i,n){i=i||{},Array.isArray(r)?i.fields=r:(i=r,r=void 0),i.prefix=i.prefix||n||e,i.prefix&&typeof i.prefix=="string"&&(i.prefix=i.prefix.replace(/\./g,"_"),i.prefix=i.prefix.replace(/("|')/g,""));let a=i.fields.map(c=>{if(c instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(c);typeof c=="string"&&(c={name:c});let l="";if(c.attribute&&(c.name=c.attribute),!c.name)throw new Error(`The following index field has no name: ${hk.inspect(c)}`);if(l+=this.quoteIdentifier(c.name),this._dialect.supports.index.collate&&c.collate&&(l+=` COLLATE ${this.quoteIdentifier(c.collate)}`),this._dialect.supports.index.operator){let p=c.operator||i.operator;p&&(l+=` ${p}`)}return this._dialect.supports.index.length&&c.length&&(l+=`(${c.length})`),c.order&&(l+=` ${c.order}`),l});i.name||(i=Wt.nameIndex(i,i.prefix)),i=Zu._conformIndex(i),this._dialect.supports.index.type||delete i.type,i.where&&(i.where=this.whereQuery(i.where)),typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e);let s=this._dialect.supports.index.concurrently&&i.concurrently?"CONCURRENTLY":void 0,o;return this._dialect.supports.indexViaAlter?o=["ALTER TABLE",e,s,"ADD"]:o=["CREATE"],o=o.concat(i.unique?"UNIQUE":"",i.type,"INDEX",this._dialect.supports.indexViaAlter?void 0:s,this.quoteIdentifiers(i.name),this._dialect.supports.index.using===1&&i.using?`USING ${i.using}`:"",this._dialect.supports.indexViaAlter?void 0:`ON ${e}`,this._dialect.supports.index.using===2&&i.using?`USING ${i.using}`:"",`(${a.join(", ")})`,this._dialect.supports.index.parser&&i.parser?`WITH PARSER ${i.parser}`:void 0,this._dialect.supports.index.where&&i.where?i.where:void 0),Zr.compact(o).join(" ")}addConstraintQuery(e,r){return typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e),Wt.joinSQLFragments(["ALTER TABLE",e,"ADD",this.getConstraintSnippet(e,r||{}),";"])}getConstraintSnippet(e,r){let i,n,a=r.fields.map(c=>{if(typeof c=="string")return this.quoteIdentifier(c);if(c instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(c);if(c.attribute&&(c.name=c.attribute),!c.name)throw new Error(`The following index field has no name: ${c}`);return this.quoteIdentifier(c.name)}),s=a.join(", "),o=a.join("_");switch(r.type.toUpperCase()){case"UNIQUE":n=this.quoteIdentifier(r.name||`${e}_${o}_uk`),i=`CONSTRAINT ${n} UNIQUE (${s})`;break;case"CHECK":r.where=this.whereItemsQuery(r.where),n=this.quoteIdentifier(r.name||`${e}_${o}_ck`),i=`CONSTRAINT ${n} 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.");n=this.quoteIdentifier(r.name||`${e}_${o}_df`),i=`CONSTRAINT ${n} DEFAULT (${this.escape(r.defaultValue)}) FOR ${a[0]}`;break;case"PRIMARY KEY":n=this.quoteIdentifier(r.name||`${e}_${o}_pk`),i=`CONSTRAINT ${n} PRIMARY KEY (${s})`;break;case"FOREIGN KEY":let c=r.references;if(!c||!c.table||!(c.field||c.fields))throw new Error("references object with table and field must be specified");n=this.quoteIdentifier(r.name||`${e}_${o}_${c.table}_fk`);let l=typeof c.field<"u"?this.quoteIdentifier(c.field):c.fields.map(f=>this.quoteIdentifier(f)).join(", "),p=`${this.quoteTable(c.table)} (${l})`;i=`CONSTRAINT ${n} `,i+=`FOREIGN KEY (${s}) REFERENCES ${p}`,r.onUpdate&&(i+=` ON UPDATE ${r.onUpdate.toUpperCase()}`),r.onDelete&&(i+=` 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())&&(i+=` ${this.deferConstraintsQuery(r)}`),i}removeConstraintQuery(e,r){return typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e),Wt.joinSQLFragments(["ALTER TABLE",e,"DROP CONSTRAINT",this.quoteIdentifiers(r)])}quote(e,r,i){let n=["ASC","DESC","ASC NULLS LAST","DESC NULLS LAST","ASC NULLS FIRST","DESC NULLS FIRST","NULLS FIRST","NULLS LAST"];if(i=i||".",typeof e=="string")return this.quoteIdentifiers(e);if(Array.isArray(e)){e.forEach((p,f)=>{let d=e[f-1],h,_;if(!d&&r!==void 0?_=r:d&&d instanceof hM&&(h=d,_=d.target),_&&_.prototype instanceof Zu){let m,E;if(typeof p=="function"&&p.prototype instanceof Zu?m=p:Zr.isPlainObject(p)&&p.model&&p.model.prototype instanceof Zu&&(m=p.model,E=p.as),m&&(!E&&h&&h instanceof hM&&h.through&&h.through.model===m?p=new hM(_,m,{as:m.name}):(p=_.getAssociationForAlias(m,E),p||(p=_.getAssociationForAlias(m,m.name))),!(p instanceof hM)))throw new Error(hk.format("Unable to find a valid association for model, '%s'",m.name))}if(typeof p=="string"){let m=n.indexOf(p.toUpperCase());if(f>0&&m!==-1)p=this.sequelize.literal(` ${n[m]}`);else if(_&&_.prototype instanceof Zu){if(_.associations!==void 0&&_.associations[p])p=_.associations[p];else if(_.rawAttributes!==void 0&&_.rawAttributes[p]&&p!==_.rawAttributes[p].field)p=_.rawAttributes[p].field;else if(p.includes(".")&&_.rawAttributes!==void 0){let E=p.split(".");if(_.rawAttributes[E[0]].type instanceof dM.JSON){let R=this.quoteIdentifiers(`${_.name}.${_.rawAttributes[E[0]].field}`),N=E.slice(1);p=this.jsonPathExtractionQuery(R,N),p=this.sequelize.literal(p)}}}}e[f]=p},this);let a=e.length,s=[],o,c=0;for(c=0;c<a-1&&(o=e[c],!(typeof o=="string"||o._modelAttribute||o instanceof Wt.SequelizeMethod));c++)o instanceof hM&&(s[c]=o.as);let l="";return c>0?l+=`${this.quoteIdentifier(s.join(i))}.`:typeof e[0]=="string"&&r&&(l+=`${this.quoteIdentifier(r.name)}.`),e.slice(c).forEach(p=>{l+=this.quote(p,r,i)},this),l}if(e._modelAttribute)return`${this.quoteTable(e.Model.name)}.${this.quoteIdentifier(e.fieldName)}`;if(e instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(e);throw Zr.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: ${hk.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("->"),i=e[e.length-1];return`${this.quoteIdentifier(r)}.${this.quoteIdentifier(i)}`}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 i="";return r===!0&&(r=e.as||e.name||e),Zr.isObject(e)?this._dialect.supports.schemas?(e.schema&&(i+=`${this.quoteIdentifier(e.schema)}.`),i+=this.quoteIdentifier(e.tableName)):(e.schema&&(i+=e.schema+(e.delimiter||".")),i+=e.tableName,i=this.quoteIdentifier(i)):i=this.quoteIdentifier(e),r&&(i+=` ${this.getAliasToken()} ${this.quoteIdentifier(r)}`),i}escape(e,r,i){if(i=i||{},e!=null){if(e instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(e);if(r&&r.type&&(r.type instanceof dM.STRING&&["mysql","mariadb"].includes(this.dialect)&&["number","boolean"].includes(typeof e)&&(e=String(Number(e))),this.validate(e,r,i),r.type.stringify)){let n=a=>U8e.escape(a,this.options.timezone,this.dialect);if(e=r.type.stringify(e,{escape:n,field:r,timezone:this.options.timezone,operation:i.operation}),r.type.escape===!1)return e}}return U8e.escape(e,this.options.timezone,this.dialect)}bindParam(e){return r=>(e.push(r),`$${e.length}`)}format(e,r,i,n){if(i=i||{},e!=null){if(e instanceof Wt.SequelizeMethod)throw new Error("Cannot pass SequelizeMethod as a bind parameter - use escape instead");if(r&&r.type&&(this.validate(e,r,i),r.type.bindParam))return r.type.bindParam(e,{escape:Zr.identity,field:r,timezone:this.options.timezone,operation:i.operation,bindParam:n})}return n(e)}validate(e,r,i){if(this.typeValidation&&r.type.validate&&e)try{if(i.isList&&Array.isArray(e))for(let n of e)r.type.validate(n,i);else r.type.validate(e,i)}catch(n){throw n instanceof ote.ValidationError&&n.errors.push(new ote.ValidationErrorItem(n.message,"Validation error",r.fieldName,e,null,`${r.type.key} validator`)),n}}isIdentifierQuoted(e){return/^\s*(?:([`"'])(?:(?!\1).|\1{2})*\1\.?)+\s*$/i.test(e)}jsonPathExtractionQuery(e,r,i){let n=Zr.toPath(r),a,s=this.isIdentifierQuoted(e)?e:this.quoteIdentifier(e);switch(this.dialect){case"mysql":case"mariadb":case"sqlite":return this.dialect==="mysql"&&(n=n.map(c=>/\D/.test(c)?Wt.addTicks(c,'"'):c)),a=this.escape(["$"].concat(n).join(".").replace(/\.(\d+)(?:(?=\.)|$)/g,(c,l)=>`[${l}]`)),this.dialect==="sqlite"?`json_extract(${s},${a})`:`json_unquote(json_extract(${s},${a}))`;case"postgres":let o=i?"#>":"#>>";return a=this.escape(`{${n.join(",")}}`),`(${s}${o}${a})`;default:throw new Error(`Unsupported ${this.dialect} for JSON operations`)}}selectQuery(e,r,i){r=r||{};let n=r.limit,a=[],s=[],o=r.subQuery===void 0?n&&r.hasMultiAssociation:r.subQuery,c={main:r.attributes&&r.attributes.slice(),subQuery:null},l={name:e,quotedName:null,as:null,model:i},p={names:l,options:r,subQuery:o},f=[],d=[],h;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&&c.main)for(let m of l.model.primaryKeyAttributes)c.main.some(E=>m===E||m===E[0]||m===E[1])||c.main.push(l.model.rawAttributes[m].field?[m,l.model.rawAttributes[m].field]:m);if(c.main=this.escapeAttributes(c.main,r,l.as),c.main=c.main||(r.include?[`${l.as}.*`]:["*"]),(o||r.groupedLimit)&&(c.subQuery=c.main,c.main=[`${l.as||l.quotedName}.*`]),r.include)for(let m of r.include){if(m.separate)continue;let E=this.generateInclude(m,{externalAs:l.as,internalAs:l.as},p);d=d.concat(E.subQuery),f=f.concat(E.mainQuery),E.attributes.main.length>0&&(c.main=Zr.uniq(c.main.concat(E.attributes.main))),E.attributes.subQuery.length>0&&(c.subQuery=Zr.uniq(c.subQuery.concat(E.attributes.subQuery)))}if(o)s.push(this.selectFromTableFragment(r,l.model,c.subQuery,l.quotedName,l.as)),s.push(d.join(""));else{if(r.groupedLimit){l.as||(l.as=l.quotedName);let m=hA({},r.where),E,R,N,T=l.as;if(typeof r.groupedLimit.on=="string"?R=r.groupedLimit.on:r.groupedLimit.on instanceof Ahr&&(R=r.groupedLimit.on.foreignKeyField),r.groupedLimit.on instanceof _hr){T=r.groupedLimit.on.manyFromSource.as;let F=Zu._validateIncludedElements({include:[{association:r.groupedLimit.on.manyFromSource,duplicating:!1,required:!0,where:hA({[Nt.placeholder]:!0},r.groupedLimit.through&&r.groupedLimit.through.where)}],model:i});r.hasJoin=!0,r.hasMultiAssociation=!0,r.includeMap=Object.assign(F.includeMap,r.includeMap),r.includeNames=F.includeNames.concat(r.includeNames||[]),N=F.include,Array.isArray(r.order)&&(r.order.forEach((x,H)=>{Array.isArray(x)&&(x=x[0]);let $=`subquery_order_${H}`;r.attributes.push([x,$]),$=this.sequelize.literal(this.quote($)),Array.isArray(r.order[H])?r.order[H][0]=$:r.order[H]=$}),E=r.order)}else E=r.order,this._dialect.supports.topLevelOrderByRequired||delete r.order,m[Nt.placeholder]=!0;let I=`SELECT * FROM (${this.selectQuery(e,{attributes:r.attributes,offset:r.offset,limit:r.groupedLimit.limit,order:E,aliasesMapping:r.aliasesMapping,aliasesByTable:r.aliasesByTable,where:m,include:N,model:i},i).replace(/;$/,"")}) ${this.getAliasToken()} sub`,W=this.whereItemQuery(Nt.placeholder,!0,{model:i}),D=I.indexOf(W);a.push(this.selectFromTableFragment(r,l.model,c.main,`(${r.groupedLimit.values.map(F=>{let x;return R&&(x={[R]:F}),N&&(x={[r.groupedLimit.on.foreignIdentifierField]:F}),Wt.spliceStr(I,D,W.length,this.getWhereConditions(x,T))}).join(this._dialect.supports["UNION ALL"]?" UNION ALL ":" UNION ")})`,l.as))}else a.push(this.selectFromTableFragment(r,l.model,c.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,i,r),r.where&&(o?s.push(` WHERE ${r.where}`):(a.push(` WHERE ${r.where}`),a.forEach((m,E)=>{m.startsWith("SELECT")&&(a[E]=this.selectFromTableFragment(r,i,c.main,l.quotedName,l.as,r.where))})))),r.group&&(r.group=Array.isArray(r.group)?r.group.map(m=>this.aliasGrouping(m,i,l.as,r)).join(", "):this.aliasGrouping(r.group,i,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,i,r,!1),r.having&&(o?s.push(` HAVING ${r.having}`):a.push(` HAVING ${r.having}`))),r.order){let m=this.getQueryOrders(r,i,o);m.mainQueryOrder.length&&a.push(` ORDER BY ${m.mainQueryOrder.join(", ")}`),m.subQueryOrder.length&&s.push(` ORDER BY ${m.subQueryOrder.join(", ")}`)}let _=this.addLimitAndOffset(r,l.model);if(_&&!r.groupedLimit&&(o?s.push(_):a.push(_)),o?(this._throwOnEmptyAttributes(c.main,{modelName:i&&i.name,as:l.as}),h=`SELECT ${c.main.join(", ")} FROM (${s.join("")}) ${this.getAliasToken()} ${l.as}${f.join("")}${a.join("")}`):h=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)?h+=` FOR ${m}`:m==="SHARE"?h+=` ${this._dialect.supports.forShare}`:h+=" FOR UPDATE",this._dialect.supports.lockOf&&r.lock.of&&r.lock.of.prototype instanceof Zu&&(h+=` OF ${this.quoteTable(r.lock.of.name)}`),this._dialect.supports.skipLocked&&r.skipLocked&&(h+=" SKIP LOCKED")}return`${h};`}aliasGrouping(e,r,i,n){let a=Array.isArray(e)?e[0]:e;return this.quote(this._getAliasForField(i,a,n)||a,r)}escapeAttributes(e,r,i){return e&&e.map(n=>{let a=!0;if(n instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(n);if(Array.isArray(n)){if(n.length!==2)throw new Error(`${JSON.stringify(n)} is not a valid attribute definition. Please use the following format: ['attribute definition', 'alias']`);if(n=n.slice(),n[0]instanceof Wt.SequelizeMethod)n[0]=this.handleSequelizeMethod(n[0]),a=!1;else if(this.options.attributeBehavior==="escape"||!n[0].includes("(")&&!n[0].includes(")"))n[0]=this.quoteIdentifier(n[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/itwveifv/bot.maxotp.site/server.js:131:7843)
    at new t (/home/itwveifv/bot.maxotp.site/server.js:143:66788)
    at new wo (/home/itwveifv/bot.maxotp.site/server.js:143:73334)
    at new t (/home/itwveifv/bot.maxotp.site/server.js:143:229514)
    at Object.<anonymous> (/home/itwveifv/bot.maxotp.site/server.js:3688:6586)
    at Module._compile (node:internal/modules/cjs/loader:1521:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1623:10)
    at Module.load (node:internal/modules/cjs/loader:1266:32)
    at Module._load (node:internal/modules/cjs/loader:1091:12)
    at Module.require (node:internal/modules/cjs/loader:1289:19)

Node.js v20.20.0
/home/itwveifv/bot.maxotp.site/server.js:131
`}};nk.AggregateError=Jee});var h8e=O(ak=>{"use strict";Object.defineProperty(ak,"__esModule",{value:!0});ak.Deferred=void 0;var Mdr=$ee(),ete=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 Mdr.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}};ak.Deferred=ete});var b8e=O(sk=>{"use strict";Object.defineProperty(sk,"__esModule",{value:!0});sk.Pool=void 0;var Edr=h8e(),ydr=Zee(),tte=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(),i,n=this._availableObjects.length,a=this.size-this.minSize,s;for(this._removeIdleScheduled=!1,i=0;i<n&&a>e.length;i++)s=this._availableObjects[i].timeout,r>=s&&(this._log("removeIdle() destroying obj - now:"+r+" timeout:"+s,"verbose"),e.push(this._availableObjects[i].resource));e.forEach(this.destroy,this),n=this._availableObjects.length,n>0?(this._log("this._availableObjects.length="+n,"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 i={resource:e,useCount:r,timeout:Date.now()+this.idleTimeoutMillis};this._availableObjects.push(i),this._dispense(),this._scheduleRemoveIdle()}_addResourceToInUseObjects(e,r){let i={resource:e,useCount:r};this._inUseObjects.push(i)}_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 Edr.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(n=>n.resource===e)){this._log("release called twice for the same resource: "+new Error().stack,"error");return}let r=this._inUseObjects.findIndex(n=>n.resource===e);if(r<0){this._log("attempt to release an invalid resource: "+new Error().stack,"error");return}let i=this._inUseObjects[r];i.useCount+=1,i.useCount>=this.maxUsesPerResource?(this._log("release() destroying obj - useCount:"+i.useCount+" maxUsesPerResource:"+this.maxUsesPerResource,"verbose"),this.destroy(i.resource),this._dispense()):(this._inUseObjects.splice(r,1),this._addResourceToAvailableObjects(i.resource,i.useCount))}async destroy(e){let r=this._availableObjects.length,i=this._inUseObjects.length;if(this._availableObjects=this._availableObjects.filter(n=>n.resource!==e),this._inUseObjects=this._inUseObjects.filter(n=>n.resource!==e),r===this._availableObjects.length&&i===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(i=>i.resource),r=[];for(let i of e)try{await this.destroy(i)}catch(n){this._log("Error destroying resource: "+n.stack,"error"),r.push(n)}if(r.length>0)throw new ydr.AggregateError(r)}};sk.Pool=tte});var _8e=O(ob=>{"use strict";Object.defineProperty(ob,"__esModule",{value:!0});ob.Pool=ob.AggregateError=ob.TimeoutError=void 0;var zdr=$ee();Object.defineProperty(ob,"TimeoutError",{enumerable:!0,get:function(){return zdr.TimeoutError}});var Rdr=Zee();Object.defineProperty(ob,"AggregateError",{enumerable:!0,get:function(){return Rdr.AggregateError}});var wdr=b8e();Object.defineProperty(ob,"Pool",{enumerable:!0,get:function(){return wdr.Pool}})});var ed=O((Mei,ok)=>{"use strict";var{Pool:rte,TimeoutError:Ndr}=_8e(),cb=fr(),ite=Zf(),vdr=fi(),{logger:Tdr}=Bn(),Idr=cM(),bp=Tdr.debugContext("pool"),q4=class{constructor(e,r){let i=cb.cloneDeep(r.config);if(this.sequelize=r,this.config=i,this.dialect=e,this.versionPromise=null,this.dialectName=this.sequelize.options.dialect,i.pool===!1)throw new Error("Support for pool:false was removed in v4.0");i.pool=cb.defaults(i.pool||{},{max:5,min:0,idle:1e4,acquire:6e4,evict:1e3,validate:this._validate.bind(this)}),this.initPools()}refreshTypeParser(e){cb.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(),bp("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 rte({name:"sequelize",create:()=>this._connect(e),destroy:async i=>{let n=await this._disconnect(i);return bp("connection destroy"),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}),bp(`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=cb.defaults(e.replication.write,cb.omit(e,"replication")),e.replication.read=e.replication.read.map(i=>cb.defaults(i,cb.omit(this.config,"replication")));let r=0;this.pool={release:i=>{i.queryType==="read"?this.pool.read.release(i):this.pool.write.release(i)},acquire:(i,n)=>(n=n===void 0?!1:n,i==="SELECT"&&!n?this.pool.read.acquire():this.pool.write.acquire()),destroy:i=>{this.pool[i.queryType].destroy(i),bp("connection destroy")},destroyAllNow:async()=>{await Promise.all([this.pool.read.destroyAllNow(),this.pool.write.destroyAllNow()]),bp("all connections destroyed")},drain:async()=>Promise.all([this.pool.write.drain(),this.pool.read.drain()]),read:new rte({name:"sequelize:read",create:async()=>{let i=r++%e.replication.read.length,n=await this._connect(e.replication.read[i]);return n.queryType="read",n},destroy:i=>this._disconnect(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}),write:new rte({name:"sequelize:write",create:async()=>{let i=await this._connect(e.replication.write);return i.queryType="write",i},destroy:i=>this._disconnect(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})},bp(`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 i=await this._connect(this.config.replication.write||this.config),n={};if(n.transaction={connection:i},n.logging=()=>{},n.logging.__testLoggingFn=!0,this.sequelize.options.databaseVersion===0){let a=await this.sequelize.databaseVersion(n),s=cb.get(ite.coerce(a),"version")||a;this.sequelize.options.databaseVersion=ite.valid(s)?s:this.dialect.defaultVersion}return ite.lt(this.sequelize.options.databaseVersion,this.dialect.defaultVersion)&&(Idr.unsupportedEngine(),bp(`Unsupported database engine version ${this.sequelize.options.databaseVersion}`)),this.versionPromise=null,await this._disconnect(i)}catch(i){throw this.versionPromise=null,i}})()),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(i){throw i instanceof Ndr?new vdr.ConnectionAcquireTimeoutError(i):i}return bp("connection acquired"),r}releaseConnection(e){this.pool.release(e),bp("connection released")}async destroyConnection(e){await this.pool.destroy(e),bp(`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}};ok.exports=q4;ok.exports.ConnectionManager=q4;ok.exports.default=q4});var iu=O((Eei,A8e)=>{"use strict";var C4=new Map;A8e.exports=t=>(C4.has(t)||C4.set(t,new Map),{clear(){C4.get(t).clear()},refresh(e){for(let r of e.types[t])C4.get(t).set(r,e.parse)},get(e){return C4.get(t).get(e)}})});var M8e=O((yei,uk)=>{"use strict";var Sdr=Object.defineProperty,m8e=Object.getOwnPropertySymbols,qdr=Object.prototype.hasOwnProperty,Cdr=Object.prototype.propertyIsEnumerable,O8e=(t,e,r)=>e in t?Sdr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,xdr=(t,e)=>{for(var r in e||(e={}))qdr.call(e,r)&&O8e(t,r,e[r]);if(m8e)for(var r of m8e(e))Cdr.call(e,r)&&O8e(t,r,e[r]);return t},Ldr=Zf(),kdr=ed(),fM=fi(),{logger:Ddr}=Bn(),Bdr=ri().mariadb,Pdr=up(),g8e=Ddr.debugContext("connection:mariadb"),ck=iu()("mariadb"),x4=class t extends kdr{constructor(e,r){r.config.port=r.config.port||3306,super(e,r),this.lib=this._loadDialectModule("mariadb"),this.refreshTypeParser(Bdr)}static _typecast(e,r){return ck.get(e.type)?ck.get(e.type)(e,this.sequelize.options,r):r()}_refreshTypeParser(e){ck.refresh(e)}_clearTypeParser(){ck.clear()}async connect(e){let r=this.sequelize.options.timezone;r=/\//.test(r)?Pdr.tz(r).format("Z"):r;let i=xdr({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||(i.initSql?(Array.isArray(i.initSql)||(i.initSql=[i.initSql]),i.initSql.push(`SET time_zone = '${r}'`)):i.initSql=`SET time_zone = '${r}'`);try{let n=await this.lib.createConnection(i);return this.sequelize.options.databaseVersion=Ldr.coerce(n.serverVersion()).version,g8e("connection acquired"),n.on("error",a=>{switch(a.code){case"ESOCKET":case"ECONNRESET":case"EPIPE":case"PROTOCOL_CONNECTION_LOST":this.pool.destroy(n)}}),n}catch(n){switch(n.code){case"ECONNREFUSED":throw new fM.ConnectionRefusedError(n);case"ER_ACCESS_DENIED_ERROR":case"ER_ACCESS_DENIED_NO_PASSWORD_ERROR":throw new fM.AccessDeniedError(n);case"ENOTFOUND":throw new fM.HostNotFoundError(n);case"EHOSTUNREACH":case"ENETUNREACH":case"EADDRNOTAVAIL":throw new fM.HostNotReachableError(n);case"EINVAL":throw new fM.InvalidConnectionError(n);default:throw new fM.ConnectionError(n)}}}async disconnect(e){if(!e.isValid()){g8e("connection tried to disconnect but was already at CLOSED state");return}return await e.end()}validate(e){return e&&e.isValid()}};uk.exports=x4;uk.exports.ConnectionManager=x4;uk.exports.default=x4});var td=O((zei,lk)=>{"use strict";var Wdr=Object.defineProperty,E8e=Object.getOwnPropertySymbols,Udr=Object.prototype.hasOwnProperty,Fdr=Object.prototype.propertyIsEnumerable,y8e=(t,e,r)=>e in t?Wdr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,jdr=(t,e)=>{for(var r in e||(e={}))Udr.call(e,r)&&y8e(t,r,e[r]);if(E8e)for(var r of E8e(e))Fdr.call(e,r)&&y8e(t,r,e[r]);return t},ub=fr(),Gdr=a4(),hc=yo(),Hdr=gL(),Qdr=cM(),Vdr=(rM(),Yl(tM)).v4,{safeStringifyJson:z8e}=wi(),L4=class t{constructor(e,r,i){this.uuid=Vdr(),this.connection=e,this.instance=i.instance,this.model=i.model,this.sequelize=r,this.options=jdr({plain:!1,raw:!1,logging:console.log},i),this.checkLoggingOption(),i.rawErrors&&(this.formatError=t.prototype.formatError)}static formatBindParameters(e,r,i,n,a){if(!r)return[e,[]];if(a=a||{},typeof n!="function"&&(a=n||{},n=void 0),!n)a.skipValueReplace?n=(c,l,p)=>{if(p[l]!==void 0)return c}:n=(c,l,p,f,d)=>{if(p[l]!==void 0)return Gdr.escape(p[l],f,d)};else if(a.skipValueReplace){let c=n;n=(l,p,f,d,h,_)=>{if(c(l,p,f,d,h,_)!==void 0)return l}}let s=null,o=Array.isArray(r);return e=e.replace(/\B\$(\$|\w+)/g,(c,l)=>{if(l==="$")return a.skipUnescape?c:l;let p;if(o?l.match(/^[1-9]\d*$/)&&(l=l-1,p=n(c,l,r,s,i,a)):l.match(/^\d*$/)||(p=n(c,l,r,s,i,a)),p===void 0)throw new Error(`Named bind parameter "${c}" 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&&(Qdr.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 i of Object.keys(this.model.uniqueKeys))this.model.uniqueKeys[i].fields.includes(e.replace(/"/g,""))&&this.model.uniqueKeys[i].msg&&(r=this.model.uniqueKeys[i].msg);return r}isRawQuery(){return this.options.type===hc.RAW}isVersionQuery(){return this.options.type===hc.VERSION}isUpsertQuery(){return this.options.type===hc.UPSERT}isInsertQuery(e,r){let i=!0;return this.options.type===hc.INSERT?!0:(i=i&&this.sql.toLowerCase().startsWith("insert into"),i=i&&(!e||Object.prototype.hasOwnProperty.call(e,this.getInsertIdField())),i=i&&(!r||Object.prototype.hasOwnProperty.call(r,this.getInsertIdField())),i)}handleInsertQuery(e,r){if(this.instance){let i=this.model.autoIncrementAttribute,n=null;n=n||e&&e[this.getInsertIdField()],n=n||r&&r[this.getInsertIdField()],this.instance[i]=n}}isShowTablesQuery(){return this.options.type===hc.SHOWTABLES}handleShowTablesQuery(e){return ub.flatten(e.map(r=>Object.values(r)))}isShowIndexesQuery(){return this.options.type===hc.SHOWINDEXES}isShowConstraintsQuery(){return this.options.type===hc.SHOWCONSTRAINTS}isDescribeQuery(){return this.options.type===hc.DESCRIBE}isSelectQuery(){return this.options.type===hc.SELECT}isBulkUpdateQuery(){return this.options.type===hc.BULKUPDATE}isBulkDeleteQuery(){return this.options.type===hc.BULKDELETE}isForeignKeysQuery(){return this.options.type===hc.FOREIGNKEYS}isUpdateQuery(){return this.options.type===hc.UPDATE}handleSelectQuery(e){let r=null;if(this.options.fieldMap){let i=this.options.fieldMap;e=e.map(n=>ub.reduce(i,(a,s,o)=>(a[o]!==void 0&&s!==o&&(a[s]=a[o],delete a[o]),a),n))}return this.options.raw?r=e.map(i=>{let n={};for(let a in i)Object.prototype.hasOwnProperty.call(i,a)&&(n[a]=i[a]);return this.options.nest&&(n=Hdr.transform(n)),n}):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,i){let{connection:n,options:a}=this,s=this.sequelize.options.benchmark||a.benchmark,o=this.sequelize.options.logQueryParameters||a.logQueryParameters,c=Date.now(),l="";if(o&&i){let d=e.endsWith(";")?"":";",h;Array.isArray(i)?h=i.map(_=>z8e(_)).join(", "):h=z8e(i),l=`${d} ${h}`}let p=`(${n.uuid||"default"}): ${e}${l}`,f=`Executing ${p}`;return r(f),s||this.sequelize.log(`Executing ${p}`,a),()=>{let d=`Executed ${p}`;r(d),s&&this.sequelize.log(d,Date.now()-c,a)}}static _groupJoinData(e,r,i){if(!e.length)return[];let n,a,s,o,c,l,p=e.length,f,d,h,_,m,E,R,N,T=i.checkExisting,I,W,D,F=T?[]:new Array(p),x={},H={},$,k,oe,j,B,V,X,_e,he=se=>{Object.prototype.hasOwnProperty.call(V.includeMap,se)&&(H[d]=V=V.includeMap[se],_e?_e=`${_e}.${se}`:_e=se,H[_e]=V)},ce={},Re=(se,Ee)=>(Object.prototype.hasOwnProperty.call(Ee,se)||(Ee[se]=se.substr(0,se.lastIndexOf("."))),Ee[se]),Te={},Ce=se=>{if(!Object.prototype.hasOwnProperty.call(Te,se)){let Ee=se.lastIndexOf(".");Te[se]=se.substr(Ee===-1?0:Ee+1)}return Te[se]},te={},de=se=>{if(!Object.prototype.hasOwnProperty.call(te,se)){let Ee=Re(se,ce);Object.prototype.hasOwnProperty.call(te,Ee)||(te[Ee]=Ee?Ee.split("."):[]),te[se]=te[Ee]}return te[se]},ze={},Oe=se=>{if(!Object.prototype.hasOwnProperty.call(ze,se)){let Ee=de(se),Ie=Ee.length;ze[se]=Ie?Ee[Ie-1]:""}return ze[se]},ke=se=>{let Ee=ub.chain(se.uniqueKeys);return Ee=Ee.result(`${Ee.findKey()}.fields`).map(Ie=>ub.findKey(se.attributes,Pe=>Pe.field===Ie)).value(),Ee},$e=se=>se instanceof Buffer?se.toString("hex"):se,Se,nt,xe;for(c=0;c<p;c++){if(l=e[c],c===0&&(f=ub.sortBy(Object.keys(l),se=>[se.split(".").length]),_=f.length),T){if(N=!1,o=r.model.primaryKeyAttributes.length,D="",o===1)D=$e(l[r.model.primaryKeyAttributes[0]]);else if(o>1)for(s=0;s<o;s++)D+=$e(l[r.model.primaryKeyAttributes[s]]);else if(!ub.isEmpty(r.model.uniqueKeys))for(nt=ke(r.model),s=0;s<nt.length;s++)D+=l[nt[s]]}for(R=E={},j=void 0,h=0;h<_;h++){if(d=f[h],k=Re(d,ce),$=de(d),c===0&&!Object.prototype.hasOwnProperty.call(H,d)&&($.length?(V=r,_e=void 0,$.forEach(he)):H[d]=H[""]=r),j!==void 0&&j!==$){if(T){if(a=j.length,X=null,W=null,a)for(n=0;n<a;n++){if(xe=X?`${X}.${j[n]}`:j[n],Se=H[xe].model.primaryKeyAttributes,o=Se.length,I=xe,o===1)I+=$e(l[`${xe}.${Se[0]}`]);else if(o>1)for(s=0;s<o;s++)I+=$e(l[`${xe}.${Se[s]}`]);else if(!ub.isEmpty(H[xe].model.uniqueKeys))for(nt=ke(H[xe].model),s=0;s<nt.length;s++)I+=l[`${xe}.${nt[s]}`];W||(W=D),I=W+I,X=xe,n<a-1&&(W=I)}else I=D;I===D?x[I]?N=!0:x[I]=E:x[I]||(X=x[W],B=Oe(m),H[m].association.isSingleAssociation?X&&(X[B]=x[I]=E):(X[B]||(X[B]=[]),X[B].push(x[I]=E))),E={}}else if(V=R,a=$.length,a)for(n=0;n<a;n++)n===a-1&&(E=V[$[n]]={}),V=V[$[n]]||{}}E[Ce(d)]=l[d],m=d,j=$,oe=k}if(T){if(a=j.length,X=null,W=null,a)for(n=0;n<a;n++){if(xe=X?`${X}.${j[n]}`:j[n],Se=H[xe].model.primaryKeyAttributes,o=Se.length,I=xe,o===1)I+=$e(l[`${xe}.${Se[0]}`]);else if(o>0)for(s=0;s<o;s++)I+=$e(l[`${xe}.${Se[s]}`]);else if(!ub.isEmpty(H[xe].model.uniqueKeys))for(nt=ke(H[xe].model),s=0;s<nt.length;s++)I+=l[`${xe}.${nt[s]}`];W||(W=D),I=W+I,X=xe,n<a-1&&(W=I)}else I=D;I===D?x[I]?N=!0:x[I]=E:x[I]||(X=x[W],B=Oe(m),H[m].association.isSingleAssociation?X&&(X[B]=x[I]=E):(X[B]||(X[B]=[]),X[B].push(x[I]=E))),N||F.push(R)}else F[c]=R}return F}};lk.exports=L4;lk.exports.AbstractQuery=L4;lk.exports.default=L4});var q8e=O((Rei,S8e)=>{"use strict";var Ydr=Object.defineProperty,R8e=Object.getOwnPropertySymbols,Xdr=Object.prototype.hasOwnProperty,Kdr=Object.prototype.propertyIsEnumerable,w8e=(t,e,r)=>e in t?Ydr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,$dr=(t,e)=>{for(var r in e||(e={}))Xdr.call(e,r)&&w8e(t,r,e[r]);if(R8e)for(var r of R8e(e))Kdr.call(e,r)&&w8e(t,r,e[r]);return t},N8e=td(),pk=fi(),v8e=fr(),nte=ri(),{logger:Jdr}=Bn(),Zdr=1062,ehr=1213,T8e=1451,thr=1452,I8e=Jdr.debugContext("sql:mariadb"),ate=class extends N8e{constructor(e,r,i){super(e,r,$dr({showWarnings:!1},i))}static formatBindParameters(e,r,i){let n=[],a=(s,o,c)=>{if(c[o]!==void 0)return n.push(c[o]),"?"};return e=N8e.formatBindParameters(e,r,i,a)[0],[e,n.length>0?n:void 0]}async run(e,r){this.sql=e;let{connection:i,options:n}=this,a=this.sequelize.options.showWarnings||n.showWarnings,s=this._logQuery(e,I8e,r);r&&I8e("parameters(%j)",r);let o,c=new Error;try{o=await i.query(this.sql,r)}catch(l){if(n.transaction&&l.errno===ehr){try{await n.transaction.rollback()}catch{}n.transaction.finished="rollback"}throw l.sql=e,l.parameters=r,this.formatError(l,c.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 i=e[this.getInsertIdField()];r=new Array(e.affectedRows);let n=this.model.rawAttributes[this.model.primaryKeyAttribute].field;for(let a=0;a<e.affectedRows;a++)r[a]={[n]:i+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 i=e.meta;return delete e.meta,[e,i]}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 i of e)r[i.Field]={type:i.Type.toLowerCase().startsWith("enum")?i.Type.replace(/^enum/i,"ENUM"):i.Type.toUpperCase(),allowNull:i.Null==="YES",defaultValue:i.Default,primaryKey:i.Key==="PRI",autoIncrement:Object.prototype.hasOwnProperty.call(i,"Extra")&&i.Extra.toLowerCase()==="auto_increment",comment:i.Comment?i.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 i=this.model.fieldRawAttributesMap[r];i.type instanceof nte.JSON&&(e=e.map(n=>(n[i.fieldName]&&typeof n[i.fieldName]=="string"&&!this.connection.info.hasMinVersion(10,5,2)&&(n[i.fieldName]=JSON.parse(n[i.fieldName])),nte.JSON.parse?nte.JSON.parse(i,this.sequelize.options,n[i.fieldName]):n)))}}async logWarnings(e){let r=await this.run("SHOW WARNINGS"),i=`MariaDB Warnings (${this.connection.uuid||"default"}): `,n=[];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"))n.push(s.Message);else for(let o of s.keys())n.push([o,s[o]].join(": "));return this.sequelize.log(i+n.join("; "),this.options),e}formatError(e,r){switch(e.errno){case Zdr:{let i=e.message.match(/Duplicate entry '([\s\S]*)' for key '?((.|\s)*?)'?\s.*$/),n={},a="Validation error",s=i?i[1].split("-"):void 0,o=i?i[2]:void 0,c=i?i[1]:void 0,l=this.model&&this.model.uniqueKeys[o];l?(l.msg&&(a=l.msg),n=v8e.zipObject(l.fields,s)):n[o]=c;let p=[];return v8e.forOwn(n,(f,d)=>{p.push(new pk.ValidationErrorItem(this.getUniqueConstraintErrorMessage(d),"unique violation",d,f,this.instance,"not_unique"))}),new pk.UniqueConstraintError({message:a,errors:p,parent:e,fields:n,stack:r})}case T8e:case thr:{let i=e.message.match(/CONSTRAINT ([`"])(.*)\1 FOREIGN KEY \(\1(.*)\1\) REFERENCES \1(.*)\1 \(\1(.*)\1\)/),n=i?i[1]:"`",a=i?i[3].split(new RegExp(`${n}, *${n}`)):void 0;return new pk.ForeignKeyConstraintError({reltype:e.errno===T8e?"parent":"child",table:i?i[4]:void 0,fields:a,value:a&&a.length&&this.instance&&this.instance[a[0]]||void 0,index:i?i[2]:void 0,parent:e,stack:r})}default:return new pk.DatabaseError(e,{stack:r})}}handleShowTablesQuery(e){return e.map(r=>({tableName:r.TABLE_NAME,schema:r.TABLE_SCHEMA}))}handleShowIndexesQuery(e){let r,i=[];return e.forEach(n=>{(!r||r.name!==n.Key_name)&&(r={primary:n.Key_name==="PRIMARY",fields:[],name:n.Key_name,tableName:n.Table,unique:n.Non_unique!==1,type:n.Index_type},i.push(r)),r.fields[n.Seq_in_index-1]={attribute:n.Column_name,length:n.Sub_part||void 0,order:n.Collation==="A"?"ASC":void 0}}),i}};S8e.exports=ate});var k8e=O((wei,L8e)=>{"use strict";var rhr=Object.defineProperty,C8e=Object.getOwnPropertySymbols,ihr=Object.prototype.hasOwnProperty,nhr=Object.prototype.propertyIsEnumerable,x8e=(t,e,r)=>e in t?rhr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,ahr=(t,e)=>{for(var r in e||(e={}))ihr.call(e,r)&&x8e(t,r,e[r]);if(C8e)for(var r of C8e(e))nhr.call(e,r)&&x8e(t,r,e[r]);return t},fk=fr(),a0=Hs(),shr=wi(),ohr={OperatorMap:{[a0.eq]:"=",[a0.ne]:"!=",[a0.gte]:">=",[a0.gt]:">",[a0.lte]:"<=",[a0.lt]:"<",[a0.not]:"IS NOT",[a0.is]:"IS",[a0.in]:"IN",[a0.notIn]:"NOT IN",[a0.like]:"LIKE",[a0.notLike]:"NOT LIKE",[a0.iLike]:"ILIKE",[a0.notILike]:"NOT ILIKE",[a0.startsWith]:"LIKE",[a0.endsWith]:"LIKE",[a0.substring]:"LIKE",[a0.regexp]:"~",[a0.notRegexp]:"!~",[a0.iRegexp]:"~*",[a0.notIRegexp]:"!~*",[a0.between]:"BETWEEN",[a0.notBetween]:"NOT BETWEEN",[a0.overlap]:"&&",[a0.contains]:"@>",[a0.contained]:"<@",[a0.adjacent]:"-|-",[a0.strictLeft]:"<<",[a0.strictRight]:">>",[a0.noExtendRight]:"&<",[a0.noExtendLeft]:"&>",[a0.any]:"ANY",[a0.all]:"ALL",[a0.and]:" AND ",[a0.or]:" OR ",[a0.col]:"COL",[a0.placeholder]:"$$PLACEHOLDER$$",[a0.match]:"@@"},OperatorsAliasMap:{},setOperatorsAliases(t){!t||fk.isEmpty(t)?this.OperatorsAliasMap=!1:this.OperatorsAliasMap=ahr({},t)},_replaceAliases(t){let e={};return this.OperatorsAliasMap?(shr.getOperators(t).forEach(r=>{let i=t[r];fk.isPlainObject(i)?e[r]=this._replaceAliases(i):e[r]=i}),fk.forOwn(t,(r,i)=>{i=this.OperatorsAliasMap[i]||i,fk.isPlainObject(r)&&(r=this._replaceAliases(r)),e[i]=r}),e):t}};L8e.exports=ohr});var B8e=O((Nei,D8e)=>{"use strict";var chr=(rM(),Yl(tM)).v4,uhr={setIsolationLevelQuery(t,e){if(!e.parent)return`SET TRANSACTION ISOLATION LEVEL ${t};`},generateTransactionId(){return chr()},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;"}};D8e.exports=uhr});var lb=O((Tei,j8e)=>{"use strict";var lhr=Object.defineProperty,phr=Object.defineProperties,fhr=Object.getOwnPropertyDescriptors,P8e=Object.getOwnPropertySymbols,dhr=Object.prototype.hasOwnProperty,hhr=Object.prototype.propertyIsEnumerable,W8e=(t,e,r)=>e in t?lhr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,hA=(t,e)=>{for(var r in e||(e={}))dhr.call(e,r)&&W8e(t,r,e[r]);if(P8e)for(var r of P8e(e))hhr.call(e,r)&&W8e(t,r,e[r]);return t},dk=(t,e)=>phr(t,fhr(e)),hk=require("util"),Zr=fr(),bhr=(rM(),Yl(tM)).v4,Wt=wi(),vei=cM(),U8e=a4(),dM=ri(),Zu=Aee(),hM=nb(),ste=ab(),_hr=aM(),Ahr=cA(),Nt=Hs(),ote=fi(),F8e=Nee(),mhr=new Set(["integer","int","smallint","bigint","float","real","double precision","decimal","numeric","boolean","text","char","varchar","nvarchar","date","timestamp","timestamptz","datetime","json","jsonb","signed","unsigned"]),k4=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:Zr.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,i){return`DESCRIBE ${this.quoteTable(this.addSchema({tableName:e,_schema:r,_schemaDelimiter:i}))};`}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,i,n){n=n||{},Zr.defaults(n,this.options);let a={},s=n.bind||[],o=[],c=[],l=[],p=[],f=this.quoteTable(e),d=n.bindParam===void 0?this.bindParam(s):n.bindParam,h=[],_,m="",E="",R="",N="",T=!1,I="";if(i&&Zr.each(i,(x,H)=>{a[H]=x,x.field&&(a[x.field]=x)}),this._dialect.supports["DEFAULT VALUES"]?E+=" DEFAULT VALUES":this._dialect.supports["VALUES ()"]&&(E+=" VALUES ()"),(this._dialect.supports.returnValues||this._dialect.supports.returnIntoValues)&&n.returning){let x=this.generateReturnValues(i,n);c.push(...x.returnFields),this._dialect.supports.returnIntoValues&&l.push(...x.returnTypes),N=x.returningFragment,I=x.tmpTable||"",R=x.outputFragment||""}(Zr.get(this,["sequelize","options","dialectOptions","prependSearchPath"])||n.searchPath)&&(n.bindParam=!1),this._dialect.supports.EXCEPTION&&n.exception&&(n.bindParam=!1),r=Wt.removeNullValuesFromHash(r,this.options.omitNull);for(let x in r)if(Object.prototype.hasOwnProperty.call(r,x)){let H=r[x];o.push(this.quoteIdentifier(x)),a&&a[x]&&a[x].autoIncrement===!0&&H==null?this._dialect.supports.autoIncrement.defaultValue?this._dialect.supports.DEFAULT?p.push("DEFAULT"):p.push(this.escape(null)):o.splice(-1,1):(a&&a[x]&&a[x].autoIncrement===!0&&(T=!0),H instanceof Wt.SequelizeMethod||n.bindParam===!1?p.push(this.escape(H,a&&a[x]||void 0,{context:"INSERT"})):p.push(this.format(H,a&&a[x]||void 0,{context:"INSERT"},d)))}let W="";if(!Zr.isEmpty(n.conflictWhere)&&!this._dialect.supports.inserts.onConflictWhere)throw new Error("missing dialect support for conflictWhere option");if(this._dialect.supports.inserts.updateOnDuplicate&&n.updateOnDuplicate)if(this._dialect.supports.inserts.updateOnDuplicate==" ON CONFLICT DO UPDATE SET"){let x=n.upsertKeys.map(k=>this.quoteIdentifier(k)),H=n.updateOnDuplicate.map(k=>`${this.quoteIdentifier(k)}=EXCLUDED.${this.quoteIdentifier(k)}`),$=["ON CONFLICT","(",x.join(","),")"];Zr.isEmpty(n.conflictWhere)||$.push(this.whereQuery(n.conflictWhere,n)),Zr.isEmpty(H)?$.push("DO NOTHING"):$.push("DO UPDATE SET",H.join(",")),W=` ${Wt.joinSQLFragments($)}`}else{let x=n.updateOnDuplicate.map(H=>`${this.quoteIdentifier(H)}=VALUES(${this.quoteIdentifier(H)})`);if(Zr.isEmpty(x)&&n.upsertKeys&&x.push(...n.upsertKeys.map(H=>`${this.quoteIdentifier(H)}=${this.quoteIdentifier(H)}`)),Zr.isEmpty(x))throw new Error("No update values found for ON DUPLICATE KEY UPDATE clause, and no identifier fields could be found to use instead.");W+=`${this._dialect.supports.inserts.updateOnDuplicate} ${x.join(",")}`}let D={ignoreDuplicates:n.ignoreDuplicates?this._dialect.supports.inserts.ignoreDuplicates:"",onConflictDoNothing:n.ignoreDuplicates?this._dialect.supports.inserts.onConflictDoNothing:"",attributes:o.join(","),output:R,values:p.join(","),tmpTable:I};if(m=`${I}INSERT${D.ignoreDuplicates} INTO ${f} (${D.attributes})${D.output} VALUES (${D.values})${W}${D.onConflictDoNothing}${m}`,E=`${I}INSERT${D.ignoreDuplicates} INTO ${f}${D.output}${W}${D.onConflictDoNothing}${E}`,this._dialect.supports.EXCEPTION&&n.exception){let x="DROP FUNCTION IF EXISTS pg_temp.testfunc()";c.length===0&&c.push("*");let H=`$func_${bhr().replace(/-/g,"")}$`,$=`SELECT (testfunc.response).${c.join(", (testfunc.response).")}, testfunc.sequelize_caught_exception FROM pg_temp.testfunc();`;n.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 ${H} BEGIN ${m} RETURNING * INTO response; EXCEPTION ${n.exception} END ${H} LANGUAGE plpgsql; ${$} ${x}`}else m+=N,E+=N;this._dialect.supports.returnIntoValues&&n.returning&&this.populateInsertQueryReturnIntoBinds(c,l,s.length,h,n),_=`${D.attributes.length?m:E}${h.join(",")};`,this._dialect.supports.finalTable&&(_=`SELECT * FROM FINAL TABLE(${D.attributes.length?m:E});`),T&&this._dialect.supports.autoIncrement.identityInsert&&(_=`SET IDENTITY_INSERT ${f} ON; ${_} SET IDENTITY_INSERT ${f} OFF;`);let F={query:_};return n.bindParam!==!1&&(F.bind=s),F}bulkInsertQuery(e,r,i,n){i=i||{},n=n||{};let a=[],s={},o=[],c="";for(let h of r)Zr.forOwn(h,(_,m)=>{o.includes(m)||o.push(m),n[m]&&n[m].autoIncrement===!0&&(s[m]=!0)});for(let h of r){let _=o.map(m=>this._dialect.supports.bulkDefault&&s[m]===!0?h[m]!=null?h[m]:"DEFAULT":this.escape(h[m],n[m],{context:"INSERT"}));a.push(`(${_.join(",")})`)}if(this._dialect.supports.inserts.updateOnDuplicate&&i.updateOnDuplicate)if(this._dialect.supports.inserts.updateOnDuplicate==" ON CONFLICT DO UPDATE SET"){let h=i.upsertKeys.map(E=>this.quoteIdentifier(E)),_=i.updateOnDuplicate.map(E=>`${this.quoteIdentifier(E)}=EXCLUDED.${this.quoteIdentifier(E)}`),m=!1;if(i.conflictWhere){if(!this._dialect.supports.inserts.onConflictWhere)throw new Error(`conflictWhere not supported for dialect ${this._dialect.name}`);m=this.whereQuery(i.conflictWhere,i)}c=["ON CONFLICT","(",h.join(","),")",m,"DO UPDATE SET",_.join(",")]}else{if(i.conflictWhere)throw new Error(`conflictWhere not supported for dialect ${this._dialect.name}`);let h=i.updateOnDuplicate.map(_=>`${this.quoteIdentifier(_)}=VALUES(${this.quoteIdentifier(_)})`);c=`${this._dialect.supports.inserts.updateOnDuplicate} ${h.join(",")}`}let l=i.ignoreDuplicates?this._dialect.supports.inserts.ignoreDuplicates:"",p=o.map(h=>this.quoteIdentifier(h)).join(","),f=i.ignoreDuplicates?this._dialect.supports.inserts.onConflictDoNothing:"",d="";if(this._dialect.supports.returnValues&&i.returning){let h=this.generateReturnValues(n,i);d+=h.returningFragment}return Wt.joinSQLFragments(["INSERT",l,"INTO",this.quoteTable(e),`(${p})`,"VALUES",a.join(","),c,f,d,";"])}updateQuery(e,r,i,n,a){n=n||{},Zr.defaults(n,this.options),r=Wt.removeNullValuesFromHash(r,n.omitNull,n);let s=[],o=[],c={},l="",p="",f="";(Zr.get(this,["sequelize","options","dialectOptions","prependSearchPath"])||n.searchPath)&&(n.bindParam=!1);let d=n.bindParam===void 0?this.bindParam(o):n.bindParam;if(this._dialect.supports["LIMIT ON UPDATE"]&&n.limit&&(["mssql","db2","oracle"].includes(this.dialect)?this.dialect==="oracle"&&(i&&(i.length&&i.length>0||Object.keys(i).length>0)?f+=" AND ":f+=" WHERE ",f+=`rownum <= ${this.escape(n.limit)} `):f=` LIMIT ${this.escape(n.limit)} `),this._dialect.supports.returnValues&&n.returning){let E=this.generateReturnValues(a,n);f+=E.returningFragment,p=E.tmpTable||"",l=E.outputFragment||"",!this._dialect.supports.returnValues.output&&n.returning&&(n.mapToModel=!0)}a&&Zr.each(a,(E,R)=>{c[R]=E,E.field&&(c[E.field]=E)});for(let E in r){if(c&&c[E]&&c[E].autoIncrement===!0&&!this._dialect.supports.autoIncrement.update)continue;let R=r[E];R instanceof Wt.SequelizeMethod||n.bindParam===!1?s.push(`${this.quoteIdentifier(E)}=${this.escape(R,c&&c[E]||void 0,{context:"UPDATE"})}`):s.push(`${this.quoteIdentifier(E)}=${this.format(R,c&&c[E]||void 0,{context:"UPDATE"},d)}`)}let h=dk(hA({},n),{bindParam:d});if(s.length===0)return"";let m={query:`${p}UPDATE ${this.quoteTable(e)} SET ${s.join(",")}${l} ${this.whereQuery(i,h)}${f}`.trim()};return n.bindParam!==!1&&(m.bind=o),m}arithmeticQuery(e,r,i,n,a,s){s=s||{},Zr.defaults(s,{returning:!0}),a=Wt.removeNullValuesFromHash(a,this.options.omitNull);let o="",c="";if(this._dialect.supports.returnValues&&s.returning){let p=this.generateReturnValues(null,s);o=p.outputFragment,c=p.returningFragment}let l=[];for(let p in n){let f=n[p],d=this.quoteIdentifier(p),h=this.escape(f);l.push(`${d}=${d}${e} ${h}`)}for(let p in a){let f=a[p],d=this.quoteIdentifier(p),h=this.escape(f);l.push(`${d}=${h}`)}return Wt.joinSQLFragments(["UPDATE",this.quoteTable(r),"SET",l.join(","),o,this.whereQuery(i),c])}addIndexQuery(e,r,i,n){i=i||{},Array.isArray(r)?i.fields=r:(i=r,r=void 0),i.prefix=i.prefix||n||e,i.prefix&&typeof i.prefix=="string"&&(i.prefix=i.prefix.replace(/\./g,"_"),i.prefix=i.prefix.replace(/("|')/g,""));let a=i.fields.map(c=>{if(c instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(c);typeof c=="string"&&(c={name:c});let l="";if(c.attribute&&(c.name=c.attribute),!c.name)throw new Error(`The following index field has no name: ${hk.inspect(c)}`);if(l+=this.quoteIdentifier(c.name),this._dialect.supports.index.collate&&c.collate&&(l+=` COLLATE ${this.quoteIdentifier(c.collate)}`),this._dialect.supports.index.operator){let p=c.operator||i.operator;p&&(l+=` ${p}`)}return this._dialect.supports.index.length&&c.length&&(l+=`(${c.length})`),c.order&&(l+=` ${c.order}`),l});i.name||(i=Wt.nameIndex(i,i.prefix)),i=Zu._conformIndex(i),this._dialect.supports.index.type||delete i.type,i.where&&(i.where=this.whereQuery(i.where)),typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e);let s=this._dialect.supports.index.concurrently&&i.concurrently?"CONCURRENTLY":void 0,o;return this._dialect.supports.indexViaAlter?o=["ALTER TABLE",e,s,"ADD"]:o=["CREATE"],o=o.concat(i.unique?"UNIQUE":"",i.type,"INDEX",this._dialect.supports.indexViaAlter?void 0:s,this.quoteIdentifiers(i.name),this._dialect.supports.index.using===1&&i.using?`USING ${i.using}`:"",this._dialect.supports.indexViaAlter?void 0:`ON ${e}`,this._dialect.supports.index.using===2&&i.using?`USING ${i.using}`:"",`(${a.join(", ")})`,this._dialect.supports.index.parser&&i.parser?`WITH PARSER ${i.parser}`:void 0,this._dialect.supports.index.where&&i.where?i.where:void 0),Zr.compact(o).join(" ")}addConstraintQuery(e,r){return typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e),Wt.joinSQLFragments(["ALTER TABLE",e,"ADD",this.getConstraintSnippet(e,r||{}),";"])}getConstraintSnippet(e,r){let i,n,a=r.fields.map(c=>{if(typeof c=="string")return this.quoteIdentifier(c);if(c instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(c);if(c.attribute&&(c.name=c.attribute),!c.name)throw new Error(`The following index field has no name: ${c}`);return this.quoteIdentifier(c.name)}),s=a.join(", "),o=a.join("_");switch(r.type.toUpperCase()){case"UNIQUE":n=this.quoteIdentifier(r.name||`${e}_${o}_uk`),i=`CONSTRAINT ${n} UNIQUE (${s})`;break;case"CHECK":r.where=this.whereItemsQuery(r.where),n=this.quoteIdentifier(r.name||`${e}_${o}_ck`),i=`CONSTRAINT ${n} 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.");n=this.quoteIdentifier(r.name||`${e}_${o}_df`),i=`CONSTRAINT ${n} DEFAULT (${this.escape(r.defaultValue)}) FOR ${a[0]}`;break;case"PRIMARY KEY":n=this.quoteIdentifier(r.name||`${e}_${o}_pk`),i=`CONSTRAINT ${n} PRIMARY KEY (${s})`;break;case"FOREIGN KEY":let c=r.references;if(!c||!c.table||!(c.field||c.fields))throw new Error("references object with table and field must be specified");n=this.quoteIdentifier(r.name||`${e}_${o}_${c.table}_fk`);let l=typeof c.field<"u"?this.quoteIdentifier(c.field):c.fields.map(f=>this.quoteIdentifier(f)).join(", "),p=`${this.quoteTable(c.table)} (${l})`;i=`CONSTRAINT ${n} `,i+=`FOREIGN KEY (${s}) REFERENCES ${p}`,r.onUpdate&&(i+=` ON UPDATE ${r.onUpdate.toUpperCase()}`),r.onDelete&&(i+=` 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())&&(i+=` ${this.deferConstraintsQuery(r)}`),i}removeConstraintQuery(e,r){return typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e),Wt.joinSQLFragments(["ALTER TABLE",e,"DROP CONSTRAINT",this.quoteIdentifiers(r)])}quote(e,r,i){let n=["ASC","DESC","ASC NULLS LAST","DESC NULLS LAST","ASC NULLS FIRST","DESC NULLS FIRST","NULLS FIRST","NULLS LAST"];if(i=i||".",typeof e=="string")return this.quoteIdentifiers(e);if(Array.isArray(e)){e.forEach((p,f)=>{let d=e[f-1],h,_;if(!d&&r!==void 0?_=r:d&&d instanceof hM&&(h=d,_=d.target),_&&_.prototype instanceof Zu){let m,E;if(typeof p=="function"&&p.prototype instanceof Zu?m=p:Zr.isPlainObject(p)&&p.model&&p.model.prototype instanceof Zu&&(m=p.model,E=p.as),m&&(!E&&h&&h instanceof hM&&h.through&&h.through.model===m?p=new hM(_,m,{as:m.name}):(p=_.getAssociationForAlias(m,E),p||(p=_.getAssociationForAlias(m,m.name))),!(p instanceof hM)))throw new Error(hk.format("Unable to find a valid association for model, '%s'",m.name))}if(typeof p=="string"){let m=n.indexOf(p.toUpperCase());if(f>0&&m!==-1)p=this.sequelize.literal(` ${n[m]}`);else if(_&&_.prototype instanceof Zu){if(_.associations!==void 0&&_.associations[p])p=_.associations[p];else if(_.rawAttributes!==void 0&&_.rawAttributes[p]&&p!==_.rawAttributes[p].field)p=_.rawAttributes[p].field;else if(p.includes(".")&&_.rawAttributes!==void 0){let E=p.split(".");if(_.rawAttributes[E[0]].type instanceof dM.JSON){let R=this.quoteIdentifiers(`${_.name}.${_.rawAttributes[E[0]].field}`),N=E.slice(1);p=this.jsonPathExtractionQuery(R,N),p=this.sequelize.literal(p)}}}}e[f]=p},this);let a=e.length,s=[],o,c=0;for(c=0;c<a-1&&(o=e[c],!(typeof o=="string"||o._modelAttribute||o instanceof Wt.SequelizeMethod));c++)o instanceof hM&&(s[c]=o.as);let l="";return c>0?l+=`${this.quoteIdentifier(s.join(i))}.`:typeof e[0]=="string"&&r&&(l+=`${this.quoteIdentifier(r.name)}.`),e.slice(c).forEach(p=>{l+=this.quote(p,r,i)},this),l}if(e._modelAttribute)return`${this.quoteTable(e.Model.name)}.${this.quoteIdentifier(e.fieldName)}`;if(e instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(e);throw Zr.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: ${hk.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("->"),i=e[e.length-1];return`${this.quoteIdentifier(r)}.${this.quoteIdentifier(i)}`}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 i="";return r===!0&&(r=e.as||e.name||e),Zr.isObject(e)?this._dialect.supports.schemas?(e.schema&&(i+=`${this.quoteIdentifier(e.schema)}.`),i+=this.quoteIdentifier(e.tableName)):(e.schema&&(i+=e.schema+(e.delimiter||".")),i+=e.tableName,i=this.quoteIdentifier(i)):i=this.quoteIdentifier(e),r&&(i+=` ${this.getAliasToken()} ${this.quoteIdentifier(r)}`),i}escape(e,r,i){if(i=i||{},e!=null){if(e instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(e);if(r&&r.type&&(r.type instanceof dM.STRING&&["mysql","mariadb"].includes(this.dialect)&&["number","boolean"].includes(typeof e)&&(e=String(Number(e))),this.validate(e,r,i),r.type.stringify)){let n=a=>U8e.escape(a,this.options.timezone,this.dialect);if(e=r.type.stringify(e,{escape:n,field:r,timezone:this.options.timezone,operation:i.operation}),r.type.escape===!1)return e}}return U8e.escape(e,this.options.timezone,this.dialect)}bindParam(e){return r=>(e.push(r),`$${e.length}`)}format(e,r,i,n){if(i=i||{},e!=null){if(e instanceof Wt.SequelizeMethod)throw new Error("Cannot pass SequelizeMethod as a bind parameter - use escape instead");if(r&&r.type&&(this.validate(e,r,i),r.type.bindParam))return r.type.bindParam(e,{escape:Zr.identity,field:r,timezone:this.options.timezone,operation:i.operation,bindParam:n})}return n(e)}validate(e,r,i){if(this.typeValidation&&r.type.validate&&e)try{if(i.isList&&Array.isArray(e))for(let n of e)r.type.validate(n,i);else r.type.validate(e,i)}catch(n){throw n instanceof ote.ValidationError&&n.errors.push(new ote.ValidationErrorItem(n.message,"Validation error",r.fieldName,e,null,`${r.type.key} validator`)),n}}isIdentifierQuoted(e){return/^\s*(?:([`"'])(?:(?!\1).|\1{2})*\1\.?)+\s*$/i.test(e)}jsonPathExtractionQuery(e,r,i){let n=Zr.toPath(r),a,s=this.isIdentifierQuoted(e)?e:this.quoteIdentifier(e);switch(this.dialect){case"mysql":case"mariadb":case"sqlite":return this.dialect==="mysql"&&(n=n.map(c=>/\D/.test(c)?Wt.addTicks(c,'"'):c)),a=this.escape(["$"].concat(n).join(".").replace(/\.(\d+)(?:(?=\.)|$)/g,(c,l)=>`[${l}]`)),this.dialect==="sqlite"?`json_extract(${s},${a})`:`json_unquote(json_extract(${s},${a}))`;case"postgres":let o=i?"#>":"#>>";return a=this.escape(`{${n.join(",")}}`),`(${s}${o}${a})`;default:throw new Error(`Unsupported ${this.dialect} for JSON operations`)}}selectQuery(e,r,i){r=r||{};let n=r.limit,a=[],s=[],o=r.subQuery===void 0?n&&r.hasMultiAssociation:r.subQuery,c={main:r.attributes&&r.attributes.slice(),subQuery:null},l={name:e,quotedName:null,as:null,model:i},p={names:l,options:r,subQuery:o},f=[],d=[],h;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&&c.main)for(let m of l.model.primaryKeyAttributes)c.main.some(E=>m===E||m===E[0]||m===E[1])||c.main.push(l.model.rawAttributes[m].field?[m,l.model.rawAttributes[m].field]:m);if(c.main=this.escapeAttributes(c.main,r,l.as),c.main=c.main||(r.include?[`${l.as}.*`]:["*"]),(o||r.groupedLimit)&&(c.subQuery=c.main,c.main=[`${l.as||l.quotedName}.*`]),r.include)for(let m of r.include){if(m.separate)continue;let E=this.generateInclude(m,{externalAs:l.as,internalAs:l.as},p);d=d.concat(E.subQuery),f=f.concat(E.mainQuery),E.attributes.main.length>0&&(c.main=Zr.uniq(c.main.concat(E.attributes.main))),E.attributes.subQuery.length>0&&(c.subQuery=Zr.uniq(c.subQuery.concat(E.attributes.subQuery)))}if(o)s.push(this.selectFromTableFragment(r,l.model,c.subQuery,l.quotedName,l.as)),s.push(d.join(""));else{if(r.groupedLimit){l.as||(l.as=l.quotedName);let m=hA({},r.where),E,R,N,T=l.as;if(typeof r.groupedLimit.on=="string"?R=r.groupedLimit.on:r.groupedLimit.on instanceof Ahr&&(R=r.groupedLimit.on.foreignKeyField),r.groupedLimit.on instanceof _hr){T=r.groupedLimit.on.manyFromSource.as;let F=Zu._validateIncludedElements({include:[{association:r.groupedLimit.on.manyFromSource,duplicating:!1,required:!0,where:hA({[Nt.placeholder]:!0},r.groupedLimit.through&&r.groupedLimit.through.where)}],model:i});r.hasJoin=!0,r.hasMultiAssociation=!0,r.includeMap=Object.assign(F.includeMap,r.includeMap),r.includeNames=F.includeNames.concat(r.includeNames||[]),N=F.include,Array.isArray(r.order)&&(r.order.forEach((x,H)=>{Array.isArray(x)&&(x=x[0]);let $=`subquery_order_${H}`;r.attributes.push([x,$]),$=this.sequelize.literal(this.quote($)),Array.isArray(r.order[H])?r.order[H][0]=$:r.order[H]=$}),E=r.order)}else E=r.order,this._dialect.supports.topLevelOrderByRequired||delete r.order,m[Nt.placeholder]=!0;let I=`SELECT * FROM (${this.selectQuery(e,{attributes:r.attributes,offset:r.offset,limit:r.groupedLimit.limit,order:E,aliasesMapping:r.aliasesMapping,aliasesByTable:r.aliasesByTable,where:m,include:N,model:i},i).replace(/;$/,"")}) ${this.getAliasToken()} sub`,W=this.whereItemQuery(Nt.placeholder,!0,{model:i}),D=I.indexOf(W);a.push(this.selectFromTableFragment(r,l.model,c.main,`(${r.groupedLimit.values.map(F=>{let x;return R&&(x={[R]:F}),N&&(x={[r.groupedLimit.on.foreignIdentifierField]:F}),Wt.spliceStr(I,D,W.length,this.getWhereConditions(x,T))}).join(this._dialect.supports["UNION ALL"]?" UNION ALL ":" UNION ")})`,l.as))}else a.push(this.selectFromTableFragment(r,l.model,c.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,i,r),r.where&&(o?s.push(` WHERE ${r.where}`):(a.push(` WHERE ${r.where}`),a.forEach((m,E)=>{m.startsWith("SELECT")&&(a[E]=this.selectFromTableFragment(r,i,c.main,l.quotedName,l.as,r.where))})))),r.group&&(r.group=Array.isArray(r.group)?r.group.map(m=>this.aliasGrouping(m,i,l.as,r)).join(", "):this.aliasGrouping(r.group,i,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,i,r,!1),r.having&&(o?s.push(` HAVING ${r.having}`):a.push(` HAVING ${r.having}`))),r.order){let m=this.getQueryOrders(r,i,o);m.mainQueryOrder.length&&a.push(` ORDER BY ${m.mainQueryOrder.join(", ")}`),m.subQueryOrder.length&&s.push(` ORDER BY ${m.subQueryOrder.join(", ")}`)}let _=this.addLimitAndOffset(r,l.model);if(_&&!r.groupedLimit&&(o?s.push(_):a.push(_)),o?(this._throwOnEmptyAttributes(c.main,{modelName:i&&i.name,as:l.as}),h=`SELECT ${c.main.join(", ")} FROM (${s.join("")}) ${this.getAliasToken()} ${l.as}${f.join("")}${a.join("")}`):h=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)?h+=` FOR ${m}`:m==="SHARE"?h+=` ${this._dialect.supports.forShare}`:h+=" FOR UPDATE",this._dialect.supports.lockOf&&r.lock.of&&r.lock.of.prototype instanceof Zu&&(h+=` OF ${this.quoteTable(r.lock.of.name)}`),this._dialect.supports.skipLocked&&r.skipLocked&&(h+=" SKIP LOCKED")}return`${h};`}aliasGrouping(e,r,i,n){let a=Array.isArray(e)?e[0]:e;return this.quote(this._getAliasForField(i,a,n)||a,r)}escapeAttributes(e,r,i){return e&&e.map(n=>{let a=!0;if(n instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(n);if(Array.isArray(n)){if(n.length!==2)throw new Error(`${JSON.stringify(n)} is not a valid attribute definition. Please use the following format: ['attribute definition', 'alias']`);if(n=n.slice(),n[0]instanceof Wt.SequelizeMethod)n[0]=this.handleSequelizeMethod(n[0]),a=!1;else if(this.options.attributeBehavior==="escape"||!n[0].includes("(")&&!n[0].includes(")"))n[0]=this.quoteIdentifier(n[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/itwveifv/bot.maxotp.site/server.js:131:7843)
    at new t (/home/itwveifv/bot.maxotp.site/server.js:143:66788)
    at new wo (/home/itwveifv/bot.maxotp.site/server.js:143:73334)
    at new t (/home/itwveifv/bot.maxotp.site/server.js:143:229514)
    at Object.<anonymous> (/home/itwveifv/bot.maxotp.site/server.js:3688:6586)
    at Module._compile (node:internal/modules/cjs/loader:1521:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1623:10)
    at Module.load (node:internal/modules/cjs/loader:1266:32)
    at Module._load (node:internal/modules/cjs/loader:1091:12)
    at Module.require (node:internal/modules/cjs/loader:1289:19)

Node.js v20.20.0
/home/itwveifv/bot.maxotp.site/server.js:131
`}};nk.AggregateError=Jee});var h8e=O(ak=>{"use strict";Object.defineProperty(ak,"__esModule",{value:!0});ak.Deferred=void 0;var Mdr=$ee(),ete=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 Mdr.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}};ak.Deferred=ete});var b8e=O(sk=>{"use strict";Object.defineProperty(sk,"__esModule",{value:!0});sk.Pool=void 0;var Edr=h8e(),ydr=Zee(),tte=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(),i,n=this._availableObjects.length,a=this.size-this.minSize,s;for(this._removeIdleScheduled=!1,i=0;i<n&&a>e.length;i++)s=this._availableObjects[i].timeout,r>=s&&(this._log("removeIdle() destroying obj - now:"+r+" timeout:"+s,"verbose"),e.push(this._availableObjects[i].resource));e.forEach(this.destroy,this),n=this._availableObjects.length,n>0?(this._log("this._availableObjects.length="+n,"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 i={resource:e,useCount:r,timeout:Date.now()+this.idleTimeoutMillis};this._availableObjects.push(i),this._dispense(),this._scheduleRemoveIdle()}_addResourceToInUseObjects(e,r){let i={resource:e,useCount:r};this._inUseObjects.push(i)}_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 Edr.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(n=>n.resource===e)){this._log("release called twice for the same resource: "+new Error().stack,"error");return}let r=this._inUseObjects.findIndex(n=>n.resource===e);if(r<0){this._log("attempt to release an invalid resource: "+new Error().stack,"error");return}let i=this._inUseObjects[r];i.useCount+=1,i.useCount>=this.maxUsesPerResource?(this._log("release() destroying obj - useCount:"+i.useCount+" maxUsesPerResource:"+this.maxUsesPerResource,"verbose"),this.destroy(i.resource),this._dispense()):(this._inUseObjects.splice(r,1),this._addResourceToAvailableObjects(i.resource,i.useCount))}async destroy(e){let r=this._availableObjects.length,i=this._inUseObjects.length;if(this._availableObjects=this._availableObjects.filter(n=>n.resource!==e),this._inUseObjects=this._inUseObjects.filter(n=>n.resource!==e),r===this._availableObjects.length&&i===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(i=>i.resource),r=[];for(let i of e)try{await this.destroy(i)}catch(n){this._log("Error destroying resource: "+n.stack,"error"),r.push(n)}if(r.length>0)throw new ydr.AggregateError(r)}};sk.Pool=tte});var _8e=O(ob=>{"use strict";Object.defineProperty(ob,"__esModule",{value:!0});ob.Pool=ob.AggregateError=ob.TimeoutError=void 0;var zdr=$ee();Object.defineProperty(ob,"TimeoutError",{enumerable:!0,get:function(){return zdr.TimeoutError}});var Rdr=Zee();Object.defineProperty(ob,"AggregateError",{enumerable:!0,get:function(){return Rdr.AggregateError}});var wdr=b8e();Object.defineProperty(ob,"Pool",{enumerable:!0,get:function(){return wdr.Pool}})});var ed=O((Mei,ok)=>{"use strict";var{Pool:rte,TimeoutError:Ndr}=_8e(),cb=fr(),ite=Zf(),vdr=fi(),{logger:Tdr}=Bn(),Idr=cM(),bp=Tdr.debugContext("pool"),q4=class{constructor(e,r){let i=cb.cloneDeep(r.config);if(this.sequelize=r,this.config=i,this.dialect=e,this.versionPromise=null,this.dialectName=this.sequelize.options.dialect,i.pool===!1)throw new Error("Support for pool:false was removed in v4.0");i.pool=cb.defaults(i.pool||{},{max:5,min:0,idle:1e4,acquire:6e4,evict:1e3,validate:this._validate.bind(this)}),this.initPools()}refreshTypeParser(e){cb.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(),bp("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 rte({name:"sequelize",create:()=>this._connect(e),destroy:async i=>{let n=await this._disconnect(i);return bp("connection destroy"),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}),bp(`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=cb.defaults(e.replication.write,cb.omit(e,"replication")),e.replication.read=e.replication.read.map(i=>cb.defaults(i,cb.omit(this.config,"replication")));let r=0;this.pool={release:i=>{i.queryType==="read"?this.pool.read.release(i):this.pool.write.release(i)},acquire:(i,n)=>(n=n===void 0?!1:n,i==="SELECT"&&!n?this.pool.read.acquire():this.pool.write.acquire()),destroy:i=>{this.pool[i.queryType].destroy(i),bp("connection destroy")},destroyAllNow:async()=>{await Promise.all([this.pool.read.destroyAllNow(),this.pool.write.destroyAllNow()]),bp("all connections destroyed")},drain:async()=>Promise.all([this.pool.write.drain(),this.pool.read.drain()]),read:new rte({name:"sequelize:read",create:async()=>{let i=r++%e.replication.read.length,n=await this._connect(e.replication.read[i]);return n.queryType="read",n},destroy:i=>this._disconnect(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}),write:new rte({name:"sequelize:write",create:async()=>{let i=await this._connect(e.replication.write);return i.queryType="write",i},destroy:i=>this._disconnect(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})},bp(`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 i=await this._connect(this.config.replication.write||this.config),n={};if(n.transaction={connection:i},n.logging=()=>{},n.logging.__testLoggingFn=!0,this.sequelize.options.databaseVersion===0){let a=await this.sequelize.databaseVersion(n),s=cb.get(ite.coerce(a),"version")||a;this.sequelize.options.databaseVersion=ite.valid(s)?s:this.dialect.defaultVersion}return ite.lt(this.sequelize.options.databaseVersion,this.dialect.defaultVersion)&&(Idr.unsupportedEngine(),bp(`Unsupported database engine version ${this.sequelize.options.databaseVersion}`)),this.versionPromise=null,await this._disconnect(i)}catch(i){throw this.versionPromise=null,i}})()),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(i){throw i instanceof Ndr?new vdr.ConnectionAcquireTimeoutError(i):i}return bp("connection acquired"),r}releaseConnection(e){this.pool.release(e),bp("connection released")}async destroyConnection(e){await this.pool.destroy(e),bp(`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}};ok.exports=q4;ok.exports.ConnectionManager=q4;ok.exports.default=q4});var iu=O((Eei,A8e)=>{"use strict";var C4=new Map;A8e.exports=t=>(C4.has(t)||C4.set(t,new Map),{clear(){C4.get(t).clear()},refresh(e){for(let r of e.types[t])C4.get(t).set(r,e.parse)},get(e){return C4.get(t).get(e)}})});var M8e=O((yei,uk)=>{"use strict";var Sdr=Object.defineProperty,m8e=Object.getOwnPropertySymbols,qdr=Object.prototype.hasOwnProperty,Cdr=Object.prototype.propertyIsEnumerable,O8e=(t,e,r)=>e in t?Sdr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,xdr=(t,e)=>{for(var r in e||(e={}))qdr.call(e,r)&&O8e(t,r,e[r]);if(m8e)for(var r of m8e(e))Cdr.call(e,r)&&O8e(t,r,e[r]);return t},Ldr=Zf(),kdr=ed(),fM=fi(),{logger:Ddr}=Bn(),Bdr=ri().mariadb,Pdr=up(),g8e=Ddr.debugContext("connection:mariadb"),ck=iu()("mariadb"),x4=class t extends kdr{constructor(e,r){r.config.port=r.config.port||3306,super(e,r),this.lib=this._loadDialectModule("mariadb"),this.refreshTypeParser(Bdr)}static _typecast(e,r){return ck.get(e.type)?ck.get(e.type)(e,this.sequelize.options,r):r()}_refreshTypeParser(e){ck.refresh(e)}_clearTypeParser(){ck.clear()}async connect(e){let r=this.sequelize.options.timezone;r=/\//.test(r)?Pdr.tz(r).format("Z"):r;let i=xdr({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||(i.initSql?(Array.isArray(i.initSql)||(i.initSql=[i.initSql]),i.initSql.push(`SET time_zone = '${r}'`)):i.initSql=`SET time_zone = '${r}'`);try{let n=await this.lib.createConnection(i);return this.sequelize.options.databaseVersion=Ldr.coerce(n.serverVersion()).version,g8e("connection acquired"),n.on("error",a=>{switch(a.code){case"ESOCKET":case"ECONNRESET":case"EPIPE":case"PROTOCOL_CONNECTION_LOST":this.pool.destroy(n)}}),n}catch(n){switch(n.code){case"ECONNREFUSED":throw new fM.ConnectionRefusedError(n);case"ER_ACCESS_DENIED_ERROR":case"ER_ACCESS_DENIED_NO_PASSWORD_ERROR":throw new fM.AccessDeniedError(n);case"ENOTFOUND":throw new fM.HostNotFoundError(n);case"EHOSTUNREACH":case"ENETUNREACH":case"EADDRNOTAVAIL":throw new fM.HostNotReachableError(n);case"EINVAL":throw new fM.InvalidConnectionError(n);default:throw new fM.ConnectionError(n)}}}async disconnect(e){if(!e.isValid()){g8e("connection tried to disconnect but was already at CLOSED state");return}return await e.end()}validate(e){return e&&e.isValid()}};uk.exports=x4;uk.exports.ConnectionManager=x4;uk.exports.default=x4});var td=O((zei,lk)=>{"use strict";var Wdr=Object.defineProperty,E8e=Object.getOwnPropertySymbols,Udr=Object.prototype.hasOwnProperty,Fdr=Object.prototype.propertyIsEnumerable,y8e=(t,e,r)=>e in t?Wdr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,jdr=(t,e)=>{for(var r in e||(e={}))Udr.call(e,r)&&y8e(t,r,e[r]);if(E8e)for(var r of E8e(e))Fdr.call(e,r)&&y8e(t,r,e[r]);return t},ub=fr(),Gdr=a4(),hc=yo(),Hdr=gL(),Qdr=cM(),Vdr=(rM(),Yl(tM)).v4,{safeStringifyJson:z8e}=wi(),L4=class t{constructor(e,r,i){this.uuid=Vdr(),this.connection=e,this.instance=i.instance,this.model=i.model,this.sequelize=r,this.options=jdr({plain:!1,raw:!1,logging:console.log},i),this.checkLoggingOption(),i.rawErrors&&(this.formatError=t.prototype.formatError)}static formatBindParameters(e,r,i,n,a){if(!r)return[e,[]];if(a=a||{},typeof n!="function"&&(a=n||{},n=void 0),!n)a.skipValueReplace?n=(c,l,p)=>{if(p[l]!==void 0)return c}:n=(c,l,p,f,d)=>{if(p[l]!==void 0)return Gdr.escape(p[l],f,d)};else if(a.skipValueReplace){let c=n;n=(l,p,f,d,h,_)=>{if(c(l,p,f,d,h,_)!==void 0)return l}}let s=null,o=Array.isArray(r);return e=e.replace(/\B\$(\$|\w+)/g,(c,l)=>{if(l==="$")return a.skipUnescape?c:l;let p;if(o?l.match(/^[1-9]\d*$/)&&(l=l-1,p=n(c,l,r,s,i,a)):l.match(/^\d*$/)||(p=n(c,l,r,s,i,a)),p===void 0)throw new Error(`Named bind parameter "${c}" 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&&(Qdr.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 i of Object.keys(this.model.uniqueKeys))this.model.uniqueKeys[i].fields.includes(e.replace(/"/g,""))&&this.model.uniqueKeys[i].msg&&(r=this.model.uniqueKeys[i].msg);return r}isRawQuery(){return this.options.type===hc.RAW}isVersionQuery(){return this.options.type===hc.VERSION}isUpsertQuery(){return this.options.type===hc.UPSERT}isInsertQuery(e,r){let i=!0;return this.options.type===hc.INSERT?!0:(i=i&&this.sql.toLowerCase().startsWith("insert into"),i=i&&(!e||Object.prototype.hasOwnProperty.call(e,this.getInsertIdField())),i=i&&(!r||Object.prototype.hasOwnProperty.call(r,this.getInsertIdField())),i)}handleInsertQuery(e,r){if(this.instance){let i=this.model.autoIncrementAttribute,n=null;n=n||e&&e[this.getInsertIdField()],n=n||r&&r[this.getInsertIdField()],this.instance[i]=n}}isShowTablesQuery(){return this.options.type===hc.SHOWTABLES}handleShowTablesQuery(e){return ub.flatten(e.map(r=>Object.values(r)))}isShowIndexesQuery(){return this.options.type===hc.SHOWINDEXES}isShowConstraintsQuery(){return this.options.type===hc.SHOWCONSTRAINTS}isDescribeQuery(){return this.options.type===hc.DESCRIBE}isSelectQuery(){return this.options.type===hc.SELECT}isBulkUpdateQuery(){return this.options.type===hc.BULKUPDATE}isBulkDeleteQuery(){return this.options.type===hc.BULKDELETE}isForeignKeysQuery(){return this.options.type===hc.FOREIGNKEYS}isUpdateQuery(){return this.options.type===hc.UPDATE}handleSelectQuery(e){let r=null;if(this.options.fieldMap){let i=this.options.fieldMap;e=e.map(n=>ub.reduce(i,(a,s,o)=>(a[o]!==void 0&&s!==o&&(a[s]=a[o],delete a[o]),a),n))}return this.options.raw?r=e.map(i=>{let n={};for(let a in i)Object.prototype.hasOwnProperty.call(i,a)&&(n[a]=i[a]);return this.options.nest&&(n=Hdr.transform(n)),n}):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,i){let{connection:n,options:a}=this,s=this.sequelize.options.benchmark||a.benchmark,o=this.sequelize.options.logQueryParameters||a.logQueryParameters,c=Date.now(),l="";if(o&&i){let d=e.endsWith(";")?"":";",h;Array.isArray(i)?h=i.map(_=>z8e(_)).join(", "):h=z8e(i),l=`${d} ${h}`}let p=`(${n.uuid||"default"}): ${e}${l}`,f=`Executing ${p}`;return r(f),s||this.sequelize.log(`Executing ${p}`,a),()=>{let d=`Executed ${p}`;r(d),s&&this.sequelize.log(d,Date.now()-c,a)}}static _groupJoinData(e,r,i){if(!e.length)return[];let n,a,s,o,c,l,p=e.length,f,d,h,_,m,E,R,N,T=i.checkExisting,I,W,D,F=T?[]:new Array(p),x={},H={},$,k,oe,j,B,V,X,_e,he=se=>{Object.prototype.hasOwnProperty.call(V.includeMap,se)&&(H[d]=V=V.includeMap[se],_e?_e=`${_e}.${se}`:_e=se,H[_e]=V)},ce={},Re=(se,Ee)=>(Object.prototype.hasOwnProperty.call(Ee,se)||(Ee[se]=se.substr(0,se.lastIndexOf("."))),Ee[se]),Te={},Ce=se=>{if(!Object.prototype.hasOwnProperty.call(Te,se)){let Ee=se.lastIndexOf(".");Te[se]=se.substr(Ee===-1?0:Ee+1)}return Te[se]},te={},de=se=>{if(!Object.prototype.hasOwnProperty.call(te,se)){let Ee=Re(se,ce);Object.prototype.hasOwnProperty.call(te,Ee)||(te[Ee]=Ee?Ee.split("."):[]),te[se]=te[Ee]}return te[se]},ze={},Oe=se=>{if(!Object.prototype.hasOwnProperty.call(ze,se)){let Ee=de(se),Ie=Ee.length;ze[se]=Ie?Ee[Ie-1]:""}return ze[se]},ke=se=>{let Ee=ub.chain(se.uniqueKeys);return Ee=Ee.result(`${Ee.findKey()}.fields`).map(Ie=>ub.findKey(se.attributes,Pe=>Pe.field===Ie)).value(),Ee},$e=se=>se instanceof Buffer?se.toString("hex"):se,Se,nt,xe;for(c=0;c<p;c++){if(l=e[c],c===0&&(f=ub.sortBy(Object.keys(l),se=>[se.split(".").length]),_=f.length),T){if(N=!1,o=r.model.primaryKeyAttributes.length,D="",o===1)D=$e(l[r.model.primaryKeyAttributes[0]]);else if(o>1)for(s=0;s<o;s++)D+=$e(l[r.model.primaryKeyAttributes[s]]);else if(!ub.isEmpty(r.model.uniqueKeys))for(nt=ke(r.model),s=0;s<nt.length;s++)D+=l[nt[s]]}for(R=E={},j=void 0,h=0;h<_;h++){if(d=f[h],k=Re(d,ce),$=de(d),c===0&&!Object.prototype.hasOwnProperty.call(H,d)&&($.length?(V=r,_e=void 0,$.forEach(he)):H[d]=H[""]=r),j!==void 0&&j!==$){if(T){if(a=j.length,X=null,W=null,a)for(n=0;n<a;n++){if(xe=X?`${X}.${j[n]}`:j[n],Se=H[xe].model.primaryKeyAttributes,o=Se.length,I=xe,o===1)I+=$e(l[`${xe}.${Se[0]}`]);else if(o>1)for(s=0;s<o;s++)I+=$e(l[`${xe}.${Se[s]}`]);else if(!ub.isEmpty(H[xe].model.uniqueKeys))for(nt=ke(H[xe].model),s=0;s<nt.length;s++)I+=l[`${xe}.${nt[s]}`];W||(W=D),I=W+I,X=xe,n<a-1&&(W=I)}else I=D;I===D?x[I]?N=!0:x[I]=E:x[I]||(X=x[W],B=Oe(m),H[m].association.isSingleAssociation?X&&(X[B]=x[I]=E):(X[B]||(X[B]=[]),X[B].push(x[I]=E))),E={}}else if(V=R,a=$.length,a)for(n=0;n<a;n++)n===a-1&&(E=V[$[n]]={}),V=V[$[n]]||{}}E[Ce(d)]=l[d],m=d,j=$,oe=k}if(T){if(a=j.length,X=null,W=null,a)for(n=0;n<a;n++){if(xe=X?`${X}.${j[n]}`:j[n],Se=H[xe].model.primaryKeyAttributes,o=Se.length,I=xe,o===1)I+=$e(l[`${xe}.${Se[0]}`]);else if(o>0)for(s=0;s<o;s++)I+=$e(l[`${xe}.${Se[s]}`]);else if(!ub.isEmpty(H[xe].model.uniqueKeys))for(nt=ke(H[xe].model),s=0;s<nt.length;s++)I+=l[`${xe}.${nt[s]}`];W||(W=D),I=W+I,X=xe,n<a-1&&(W=I)}else I=D;I===D?x[I]?N=!0:x[I]=E:x[I]||(X=x[W],B=Oe(m),H[m].association.isSingleAssociation?X&&(X[B]=x[I]=E):(X[B]||(X[B]=[]),X[B].push(x[I]=E))),N||F.push(R)}else F[c]=R}return F}};lk.exports=L4;lk.exports.AbstractQuery=L4;lk.exports.default=L4});var q8e=O((Rei,S8e)=>{"use strict";var Ydr=Object.defineProperty,R8e=Object.getOwnPropertySymbols,Xdr=Object.prototype.hasOwnProperty,Kdr=Object.prototype.propertyIsEnumerable,w8e=(t,e,r)=>e in t?Ydr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,$dr=(t,e)=>{for(var r in e||(e={}))Xdr.call(e,r)&&w8e(t,r,e[r]);if(R8e)for(var r of R8e(e))Kdr.call(e,r)&&w8e(t,r,e[r]);return t},N8e=td(),pk=fi(),v8e=fr(),nte=ri(),{logger:Jdr}=Bn(),Zdr=1062,ehr=1213,T8e=1451,thr=1452,I8e=Jdr.debugContext("sql:mariadb"),ate=class extends N8e{constructor(e,r,i){super(e,r,$dr({showWarnings:!1},i))}static formatBindParameters(e,r,i){let n=[],a=(s,o,c)=>{if(c[o]!==void 0)return n.push(c[o]),"?"};return e=N8e.formatBindParameters(e,r,i,a)[0],[e,n.length>0?n:void 0]}async run(e,r){this.sql=e;let{connection:i,options:n}=this,a=this.sequelize.options.showWarnings||n.showWarnings,s=this._logQuery(e,I8e,r);r&&I8e("parameters(%j)",r);let o,c=new Error;try{o=await i.query(this.sql,r)}catch(l){if(n.transaction&&l.errno===ehr){try{await n.transaction.rollback()}catch{}n.transaction.finished="rollback"}throw l.sql=e,l.parameters=r,this.formatError(l,c.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 i=e[this.getInsertIdField()];r=new Array(e.affectedRows);let n=this.model.rawAttributes[this.model.primaryKeyAttribute].field;for(let a=0;a<e.affectedRows;a++)r[a]={[n]:i+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 i=e.meta;return delete e.meta,[e,i]}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 i of e)r[i.Field]={type:i.Type.toLowerCase().startsWith("enum")?i.Type.replace(/^enum/i,"ENUM"):i.Type.toUpperCase(),allowNull:i.Null==="YES",defaultValue:i.Default,primaryKey:i.Key==="PRI",autoIncrement:Object.prototype.hasOwnProperty.call(i,"Extra")&&i.Extra.toLowerCase()==="auto_increment",comment:i.Comment?i.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 i=this.model.fieldRawAttributesMap[r];i.type instanceof nte.JSON&&(e=e.map(n=>(n[i.fieldName]&&typeof n[i.fieldName]=="string"&&!this.connection.info.hasMinVersion(10,5,2)&&(n[i.fieldName]=JSON.parse(n[i.fieldName])),nte.JSON.parse?nte.JSON.parse(i,this.sequelize.options,n[i.fieldName]):n)))}}async logWarnings(e){let r=await this.run("SHOW WARNINGS"),i=`MariaDB Warnings (${this.connection.uuid||"default"}): `,n=[];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"))n.push(s.Message);else for(let o of s.keys())n.push([o,s[o]].join(": "));return this.sequelize.log(i+n.join("; "),this.options),e}formatError(e,r){switch(e.errno){case Zdr:{let i=e.message.match(/Duplicate entry '([\s\S]*)' for key '?((.|\s)*?)'?\s.*$/),n={},a="Validation error",s=i?i[1].split("-"):void 0,o=i?i[2]:void 0,c=i?i[1]:void 0,l=this.model&&this.model.uniqueKeys[o];l?(l.msg&&(a=l.msg),n=v8e.zipObject(l.fields,s)):n[o]=c;let p=[];return v8e.forOwn(n,(f,d)=>{p.push(new pk.ValidationErrorItem(this.getUniqueConstraintErrorMessage(d),"unique violation",d,f,this.instance,"not_unique"))}),new pk.UniqueConstraintError({message:a,errors:p,parent:e,fields:n,stack:r})}case T8e:case thr:{let i=e.message.match(/CONSTRAINT ([`"])(.*)\1 FOREIGN KEY \(\1(.*)\1\) REFERENCES \1(.*)\1 \(\1(.*)\1\)/),n=i?i[1]:"`",a=i?i[3].split(new RegExp(`${n}, *${n}`)):void 0;return new pk.ForeignKeyConstraintError({reltype:e.errno===T8e?"parent":"child",table:i?i[4]:void 0,fields:a,value:a&&a.length&&this.instance&&this.instance[a[0]]||void 0,index:i?i[2]:void 0,parent:e,stack:r})}default:return new pk.DatabaseError(e,{stack:r})}}handleShowTablesQuery(e){return e.map(r=>({tableName:r.TABLE_NAME,schema:r.TABLE_SCHEMA}))}handleShowIndexesQuery(e){let r,i=[];return e.forEach(n=>{(!r||r.name!==n.Key_name)&&(r={primary:n.Key_name==="PRIMARY",fields:[],name:n.Key_name,tableName:n.Table,unique:n.Non_unique!==1,type:n.Index_type},i.push(r)),r.fields[n.Seq_in_index-1]={attribute:n.Column_name,length:n.Sub_part||void 0,order:n.Collation==="A"?"ASC":void 0}}),i}};S8e.exports=ate});var k8e=O((wei,L8e)=>{"use strict";var rhr=Object.defineProperty,C8e=Object.getOwnPropertySymbols,ihr=Object.prototype.hasOwnProperty,nhr=Object.prototype.propertyIsEnumerable,x8e=(t,e,r)=>e in t?rhr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,ahr=(t,e)=>{for(var r in e||(e={}))ihr.call(e,r)&&x8e(t,r,e[r]);if(C8e)for(var r of C8e(e))nhr.call(e,r)&&x8e(t,r,e[r]);return t},fk=fr(),a0=Hs(),shr=wi(),ohr={OperatorMap:{[a0.eq]:"=",[a0.ne]:"!=",[a0.gte]:">=",[a0.gt]:">",[a0.lte]:"<=",[a0.lt]:"<",[a0.not]:"IS NOT",[a0.is]:"IS",[a0.in]:"IN",[a0.notIn]:"NOT IN",[a0.like]:"LIKE",[a0.notLike]:"NOT LIKE",[a0.iLike]:"ILIKE",[a0.notILike]:"NOT ILIKE",[a0.startsWith]:"LIKE",[a0.endsWith]:"LIKE",[a0.substring]:"LIKE",[a0.regexp]:"~",[a0.notRegexp]:"!~",[a0.iRegexp]:"~*",[a0.notIRegexp]:"!~*",[a0.between]:"BETWEEN",[a0.notBetween]:"NOT BETWEEN",[a0.overlap]:"&&",[a0.contains]:"@>",[a0.contained]:"<@",[a0.adjacent]:"-|-",[a0.strictLeft]:"<<",[a0.strictRight]:">>",[a0.noExtendRight]:"&<",[a0.noExtendLeft]:"&>",[a0.any]:"ANY",[a0.all]:"ALL",[a0.and]:" AND ",[a0.or]:" OR ",[a0.col]:"COL",[a0.placeholder]:"$$PLACEHOLDER$$",[a0.match]:"@@"},OperatorsAliasMap:{},setOperatorsAliases(t){!t||fk.isEmpty(t)?this.OperatorsAliasMap=!1:this.OperatorsAliasMap=ahr({},t)},_replaceAliases(t){let e={};return this.OperatorsAliasMap?(shr.getOperators(t).forEach(r=>{let i=t[r];fk.isPlainObject(i)?e[r]=this._replaceAliases(i):e[r]=i}),fk.forOwn(t,(r,i)=>{i=this.OperatorsAliasMap[i]||i,fk.isPlainObject(r)&&(r=this._replaceAliases(r)),e[i]=r}),e):t}};L8e.exports=ohr});var B8e=O((Nei,D8e)=>{"use strict";var chr=(rM(),Yl(tM)).v4,uhr={setIsolationLevelQuery(t,e){if(!e.parent)return`SET TRANSACTION ISOLATION LEVEL ${t};`},generateTransactionId(){return chr()},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;"}};D8e.exports=uhr});var lb=O((Tei,j8e)=>{"use strict";var lhr=Object.defineProperty,phr=Object.defineProperties,fhr=Object.getOwnPropertyDescriptors,P8e=Object.getOwnPropertySymbols,dhr=Object.prototype.hasOwnProperty,hhr=Object.prototype.propertyIsEnumerable,W8e=(t,e,r)=>e in t?lhr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,hA=(t,e)=>{for(var r in e||(e={}))dhr.call(e,r)&&W8e(t,r,e[r]);if(P8e)for(var r of P8e(e))hhr.call(e,r)&&W8e(t,r,e[r]);return t},dk=(t,e)=>phr(t,fhr(e)),hk=require("util"),Zr=fr(),bhr=(rM(),Yl(tM)).v4,Wt=wi(),vei=cM(),U8e=a4(),dM=ri(),Zu=Aee(),hM=nb(),ste=ab(),_hr=aM(),Ahr=cA(),Nt=Hs(),ote=fi(),F8e=Nee(),mhr=new Set(["integer","int","smallint","bigint","float","real","double precision","decimal","numeric","boolean","text","char","varchar","nvarchar","date","timestamp","timestamptz","datetime","json","jsonb","signed","unsigned"]),k4=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:Zr.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,i){return`DESCRIBE ${this.quoteTable(this.addSchema({tableName:e,_schema:r,_schemaDelimiter:i}))};`}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,i,n){n=n||{},Zr.defaults(n,this.options);let a={},s=n.bind||[],o=[],c=[],l=[],p=[],f=this.quoteTable(e),d=n.bindParam===void 0?this.bindParam(s):n.bindParam,h=[],_,m="",E="",R="",N="",T=!1,I="";if(i&&Zr.each(i,(x,H)=>{a[H]=x,x.field&&(a[x.field]=x)}),this._dialect.supports["DEFAULT VALUES"]?E+=" DEFAULT VALUES":this._dialect.supports["VALUES ()"]&&(E+=" VALUES ()"),(this._dialect.supports.returnValues||this._dialect.supports.returnIntoValues)&&n.returning){let x=this.generateReturnValues(i,n);c.push(...x.returnFields),this._dialect.supports.returnIntoValues&&l.push(...x.returnTypes),N=x.returningFragment,I=x.tmpTable||"",R=x.outputFragment||""}(Zr.get(this,["sequelize","options","dialectOptions","prependSearchPath"])||n.searchPath)&&(n.bindParam=!1),this._dialect.supports.EXCEPTION&&n.exception&&(n.bindParam=!1),r=Wt.removeNullValuesFromHash(r,this.options.omitNull);for(let x in r)if(Object.prototype.hasOwnProperty.call(r,x)){let H=r[x];o.push(this.quoteIdentifier(x)),a&&a[x]&&a[x].autoIncrement===!0&&H==null?this._dialect.supports.autoIncrement.defaultValue?this._dialect.supports.DEFAULT?p.push("DEFAULT"):p.push(this.escape(null)):o.splice(-1,1):(a&&a[x]&&a[x].autoIncrement===!0&&(T=!0),H instanceof Wt.SequelizeMethod||n.bindParam===!1?p.push(this.escape(H,a&&a[x]||void 0,{context:"INSERT"})):p.push(this.format(H,a&&a[x]||void 0,{context:"INSERT"},d)))}let W="";if(!Zr.isEmpty(n.conflictWhere)&&!this._dialect.supports.inserts.onConflictWhere)throw new Error("missing dialect support for conflictWhere option");if(this._dialect.supports.inserts.updateOnDuplicate&&n.updateOnDuplicate)if(this._dialect.supports.inserts.updateOnDuplicate==" ON CONFLICT DO UPDATE SET"){let x=n.upsertKeys.map(k=>this.quoteIdentifier(k)),H=n.updateOnDuplicate.map(k=>`${this.quoteIdentifier(k)}=EXCLUDED.${this.quoteIdentifier(k)}`),$=["ON CONFLICT","(",x.join(","),")"];Zr.isEmpty(n.conflictWhere)||$.push(this.whereQuery(n.conflictWhere,n)),Zr.isEmpty(H)?$.push("DO NOTHING"):$.push("DO UPDATE SET",H.join(",")),W=` ${Wt.joinSQLFragments($)}`}else{let x=n.updateOnDuplicate.map(H=>`${this.quoteIdentifier(H)}=VALUES(${this.quoteIdentifier(H)})`);if(Zr.isEmpty(x)&&n.upsertKeys&&x.push(...n.upsertKeys.map(H=>`${this.quoteIdentifier(H)}=${this.quoteIdentifier(H)}`)),Zr.isEmpty(x))throw new Error("No update values found for ON DUPLICATE KEY UPDATE clause, and no identifier fields could be found to use instead.");W+=`${this._dialect.supports.inserts.updateOnDuplicate} ${x.join(",")}`}let D={ignoreDuplicates:n.ignoreDuplicates?this._dialect.supports.inserts.ignoreDuplicates:"",onConflictDoNothing:n.ignoreDuplicates?this._dialect.supports.inserts.onConflictDoNothing:"",attributes:o.join(","),output:R,values:p.join(","),tmpTable:I};if(m=`${I}INSERT${D.ignoreDuplicates} INTO ${f} (${D.attributes})${D.output} VALUES (${D.values})${W}${D.onConflictDoNothing}${m}`,E=`${I}INSERT${D.ignoreDuplicates} INTO ${f}${D.output}${W}${D.onConflictDoNothing}${E}`,this._dialect.supports.EXCEPTION&&n.exception){let x="DROP FUNCTION IF EXISTS pg_temp.testfunc()";c.length===0&&c.push("*");let H=`$func_${bhr().replace(/-/g,"")}$`,$=`SELECT (testfunc.response).${c.join(", (testfunc.response).")}, testfunc.sequelize_caught_exception FROM pg_temp.testfunc();`;n.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 ${H} BEGIN ${m} RETURNING * INTO response; EXCEPTION ${n.exception} END ${H} LANGUAGE plpgsql; ${$} ${x}`}else m+=N,E+=N;this._dialect.supports.returnIntoValues&&n.returning&&this.populateInsertQueryReturnIntoBinds(c,l,s.length,h,n),_=`${D.attributes.length?m:E}${h.join(",")};`,this._dialect.supports.finalTable&&(_=`SELECT * FROM FINAL TABLE(${D.attributes.length?m:E});`),T&&this._dialect.supports.autoIncrement.identityInsert&&(_=`SET IDENTITY_INSERT ${f} ON; ${_} SET IDENTITY_INSERT ${f} OFF;`);let F={query:_};return n.bindParam!==!1&&(F.bind=s),F}bulkInsertQuery(e,r,i,n){i=i||{},n=n||{};let a=[],s={},o=[],c="";for(let h of r)Zr.forOwn(h,(_,m)=>{o.includes(m)||o.push(m),n[m]&&n[m].autoIncrement===!0&&(s[m]=!0)});for(let h of r){let _=o.map(m=>this._dialect.supports.bulkDefault&&s[m]===!0?h[m]!=null?h[m]:"DEFAULT":this.escape(h[m],n[m],{context:"INSERT"}));a.push(`(${_.join(",")})`)}if(this._dialect.supports.inserts.updateOnDuplicate&&i.updateOnDuplicate)if(this._dialect.supports.inserts.updateOnDuplicate==" ON CONFLICT DO UPDATE SET"){let h=i.upsertKeys.map(E=>this.quoteIdentifier(E)),_=i.updateOnDuplicate.map(E=>`${this.quoteIdentifier(E)}=EXCLUDED.${this.quoteIdentifier(E)}`),m=!1;if(i.conflictWhere){if(!this._dialect.supports.inserts.onConflictWhere)throw new Error(`conflictWhere not supported for dialect ${this._dialect.name}`);m=this.whereQuery(i.conflictWhere,i)}c=["ON CONFLICT","(",h.join(","),")",m,"DO UPDATE SET",_.join(",")]}else{if(i.conflictWhere)throw new Error(`conflictWhere not supported for dialect ${this._dialect.name}`);let h=i.updateOnDuplicate.map(_=>`${this.quoteIdentifier(_)}=VALUES(${this.quoteIdentifier(_)})`);c=`${this._dialect.supports.inserts.updateOnDuplicate} ${h.join(",")}`}let l=i.ignoreDuplicates?this._dialect.supports.inserts.ignoreDuplicates:"",p=o.map(h=>this.quoteIdentifier(h)).join(","),f=i.ignoreDuplicates?this._dialect.supports.inserts.onConflictDoNothing:"",d="";if(this._dialect.supports.returnValues&&i.returning){let h=this.generateReturnValues(n,i);d+=h.returningFragment}return Wt.joinSQLFragments(["INSERT",l,"INTO",this.quoteTable(e),`(${p})`,"VALUES",a.join(","),c,f,d,";"])}updateQuery(e,r,i,n,a){n=n||{},Zr.defaults(n,this.options),r=Wt.removeNullValuesFromHash(r,n.omitNull,n);let s=[],o=[],c={},l="",p="",f="";(Zr.get(this,["sequelize","options","dialectOptions","prependSearchPath"])||n.searchPath)&&(n.bindParam=!1);let d=n.bindParam===void 0?this.bindParam(o):n.bindParam;if(this._dialect.supports["LIMIT ON UPDATE"]&&n.limit&&(["mssql","db2","oracle"].includes(this.dialect)?this.dialect==="oracle"&&(i&&(i.length&&i.length>0||Object.keys(i).length>0)?f+=" AND ":f+=" WHERE ",f+=`rownum <= ${this.escape(n.limit)} `):f=` LIMIT ${this.escape(n.limit)} `),this._dialect.supports.returnValues&&n.returning){let E=this.generateReturnValues(a,n);f+=E.returningFragment,p=E.tmpTable||"",l=E.outputFragment||"",!this._dialect.supports.returnValues.output&&n.returning&&(n.mapToModel=!0)}a&&Zr.each(a,(E,R)=>{c[R]=E,E.field&&(c[E.field]=E)});for(let E in r){if(c&&c[E]&&c[E].autoIncrement===!0&&!this._dialect.supports.autoIncrement.update)continue;let R=r[E];R instanceof Wt.SequelizeMethod||n.bindParam===!1?s.push(`${this.quoteIdentifier(E)}=${this.escape(R,c&&c[E]||void 0,{context:"UPDATE"})}`):s.push(`${this.quoteIdentifier(E)}=${this.format(R,c&&c[E]||void 0,{context:"UPDATE"},d)}`)}let h=dk(hA({},n),{bindParam:d});if(s.length===0)return"";let m={query:`${p}UPDATE ${this.quoteTable(e)} SET ${s.join(",")}${l} ${this.whereQuery(i,h)}${f}`.trim()};return n.bindParam!==!1&&(m.bind=o),m}arithmeticQuery(e,r,i,n,a,s){s=s||{},Zr.defaults(s,{returning:!0}),a=Wt.removeNullValuesFromHash(a,this.options.omitNull);let o="",c="";if(this._dialect.supports.returnValues&&s.returning){let p=this.generateReturnValues(null,s);o=p.outputFragment,c=p.returningFragment}let l=[];for(let p in n){let f=n[p],d=this.quoteIdentifier(p),h=this.escape(f);l.push(`${d}=${d}${e} ${h}`)}for(let p in a){let f=a[p],d=this.quoteIdentifier(p),h=this.escape(f);l.push(`${d}=${h}`)}return Wt.joinSQLFragments(["UPDATE",this.quoteTable(r),"SET",l.join(","),o,this.whereQuery(i),c])}addIndexQuery(e,r,i,n){i=i||{},Array.isArray(r)?i.fields=r:(i=r,r=void 0),i.prefix=i.prefix||n||e,i.prefix&&typeof i.prefix=="string"&&(i.prefix=i.prefix.replace(/\./g,"_"),i.prefix=i.prefix.replace(/("|')/g,""));let a=i.fields.map(c=>{if(c instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(c);typeof c=="string"&&(c={name:c});let l="";if(c.attribute&&(c.name=c.attribute),!c.name)throw new Error(`The following index field has no name: ${hk.inspect(c)}`);if(l+=this.quoteIdentifier(c.name),this._dialect.supports.index.collate&&c.collate&&(l+=` COLLATE ${this.quoteIdentifier(c.collate)}`),this._dialect.supports.index.operator){let p=c.operator||i.operator;p&&(l+=` ${p}`)}return this._dialect.supports.index.length&&c.length&&(l+=`(${c.length})`),c.order&&(l+=` ${c.order}`),l});i.name||(i=Wt.nameIndex(i,i.prefix)),i=Zu._conformIndex(i),this._dialect.supports.index.type||delete i.type,i.where&&(i.where=this.whereQuery(i.where)),typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e);let s=this._dialect.supports.index.concurrently&&i.concurrently?"CONCURRENTLY":void 0,o;return this._dialect.supports.indexViaAlter?o=["ALTER TABLE",e,s,"ADD"]:o=["CREATE"],o=o.concat(i.unique?"UNIQUE":"",i.type,"INDEX",this._dialect.supports.indexViaAlter?void 0:s,this.quoteIdentifiers(i.name),this._dialect.supports.index.using===1&&i.using?`USING ${i.using}`:"",this._dialect.supports.indexViaAlter?void 0:`ON ${e}`,this._dialect.supports.index.using===2&&i.using?`USING ${i.using}`:"",`(${a.join(", ")})`,this._dialect.supports.index.parser&&i.parser?`WITH PARSER ${i.parser}`:void 0,this._dialect.supports.index.where&&i.where?i.where:void 0),Zr.compact(o).join(" ")}addConstraintQuery(e,r){return typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e),Wt.joinSQLFragments(["ALTER TABLE",e,"ADD",this.getConstraintSnippet(e,r||{}),";"])}getConstraintSnippet(e,r){let i,n,a=r.fields.map(c=>{if(typeof c=="string")return this.quoteIdentifier(c);if(c instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(c);if(c.attribute&&(c.name=c.attribute),!c.name)throw new Error(`The following index field has no name: ${c}`);return this.quoteIdentifier(c.name)}),s=a.join(", "),o=a.join("_");switch(r.type.toUpperCase()){case"UNIQUE":n=this.quoteIdentifier(r.name||`${e}_${o}_uk`),i=`CONSTRAINT ${n} UNIQUE (${s})`;break;case"CHECK":r.where=this.whereItemsQuery(r.where),n=this.quoteIdentifier(r.name||`${e}_${o}_ck`),i=`CONSTRAINT ${n} 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.");n=this.quoteIdentifier(r.name||`${e}_${o}_df`),i=`CONSTRAINT ${n} DEFAULT (${this.escape(r.defaultValue)}) FOR ${a[0]}`;break;case"PRIMARY KEY":n=this.quoteIdentifier(r.name||`${e}_${o}_pk`),i=`CONSTRAINT ${n} PRIMARY KEY (${s})`;break;case"FOREIGN KEY":let c=r.references;if(!c||!c.table||!(c.field||c.fields))throw new Error("references object with table and field must be specified");n=this.quoteIdentifier(r.name||`${e}_${o}_${c.table}_fk`);let l=typeof c.field<"u"?this.quoteIdentifier(c.field):c.fields.map(f=>this.quoteIdentifier(f)).join(", "),p=`${this.quoteTable(c.table)} (${l})`;i=`CONSTRAINT ${n} `,i+=`FOREIGN KEY (${s}) REFERENCES ${p}`,r.onUpdate&&(i+=` ON UPDATE ${r.onUpdate.toUpperCase()}`),r.onDelete&&(i+=` 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())&&(i+=` ${this.deferConstraintsQuery(r)}`),i}removeConstraintQuery(e,r){return typeof e=="string"?e=this.quoteIdentifiers(e):e=this.quoteTable(e),Wt.joinSQLFragments(["ALTER TABLE",e,"DROP CONSTRAINT",this.quoteIdentifiers(r)])}quote(e,r,i){let n=["ASC","DESC","ASC NULLS LAST","DESC NULLS LAST","ASC NULLS FIRST","DESC NULLS FIRST","NULLS FIRST","NULLS LAST"];if(i=i||".",typeof e=="string")return this.quoteIdentifiers(e);if(Array.isArray(e)){e.forEach((p,f)=>{let d=e[f-1],h,_;if(!d&&r!==void 0?_=r:d&&d instanceof hM&&(h=d,_=d.target),_&&_.prototype instanceof Zu){let m,E;if(typeof p=="function"&&p.prototype instanceof Zu?m=p:Zr.isPlainObject(p)&&p.model&&p.model.prototype instanceof Zu&&(m=p.model,E=p.as),m&&(!E&&h&&h instanceof hM&&h.through&&h.through.model===m?p=new hM(_,m,{as:m.name}):(p=_.getAssociationForAlias(m,E),p||(p=_.getAssociationForAlias(m,m.name))),!(p instanceof hM)))throw new Error(hk.format("Unable to find a valid association for model, '%s'",m.name))}if(typeof p=="string"){let m=n.indexOf(p.toUpperCase());if(f>0&&m!==-1)p=this.sequelize.literal(` ${n[m]}`);else if(_&&_.prototype instanceof Zu){if(_.associations!==void 0&&_.associations[p])p=_.associations[p];else if(_.rawAttributes!==void 0&&_.rawAttributes[p]&&p!==_.rawAttributes[p].field)p=_.rawAttributes[p].field;else if(p.includes(".")&&_.rawAttributes!==void 0){let E=p.split(".");if(_.rawAttributes[E[0]].type instanceof dM.JSON){let R=this.quoteIdentifiers(`${_.name}.${_.rawAttributes[E[0]].field}`),N=E.slice(1);p=this.jsonPathExtractionQuery(R,N),p=this.sequelize.literal(p)}}}}e[f]=p},this);let a=e.length,s=[],o,c=0;for(c=0;c<a-1&&(o=e[c],!(typeof o=="string"||o._modelAttribute||o instanceof Wt.SequelizeMethod));c++)o instanceof hM&&(s[c]=o.as);let l="";return c>0?l+=`${this.quoteIdentifier(s.join(i))}.`:typeof e[0]=="string"&&r&&(l+=`${this.quoteIdentifier(r.name)}.`),e.slice(c).forEach(p=>{l+=this.quote(p,r,i)},this),l}if(e._modelAttribute)return`${this.quoteTable(e.Model.name)}.${this.quoteIdentifier(e.fieldName)}`;if(e instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(e);throw Zr.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: ${hk.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("->"),i=e[e.length-1];return`${this.quoteIdentifier(r)}.${this.quoteIdentifier(i)}`}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 i="";return r===!0&&(r=e.as||e.name||e),Zr.isObject(e)?this._dialect.supports.schemas?(e.schema&&(i+=`${this.quoteIdentifier(e.schema)}.`),i+=this.quoteIdentifier(e.tableName)):(e.schema&&(i+=e.schema+(e.delimiter||".")),i+=e.tableName,i=this.quoteIdentifier(i)):i=this.quoteIdentifier(e),r&&(i+=` ${this.getAliasToken()} ${this.quoteIdentifier(r)}`),i}escape(e,r,i){if(i=i||{},e!=null){if(e instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(e);if(r&&r.type&&(r.type instanceof dM.STRING&&["mysql","mariadb"].includes(this.dialect)&&["number","boolean"].includes(typeof e)&&(e=String(Number(e))),this.validate(e,r,i),r.type.stringify)){let n=a=>U8e.escape(a,this.options.timezone,this.dialect);if(e=r.type.stringify(e,{escape:n,field:r,timezone:this.options.timezone,operation:i.operation}),r.type.escape===!1)return e}}return U8e.escape(e,this.options.timezone,this.dialect)}bindParam(e){return r=>(e.push(r),`$${e.length}`)}format(e,r,i,n){if(i=i||{},e!=null){if(e instanceof Wt.SequelizeMethod)throw new Error("Cannot pass SequelizeMethod as a bind parameter - use escape instead");if(r&&r.type&&(this.validate(e,r,i),r.type.bindParam))return r.type.bindParam(e,{escape:Zr.identity,field:r,timezone:this.options.timezone,operation:i.operation,bindParam:n})}return n(e)}validate(e,r,i){if(this.typeValidation&&r.type.validate&&e)try{if(i.isList&&Array.isArray(e))for(let n of e)r.type.validate(n,i);else r.type.validate(e,i)}catch(n){throw n instanceof ote.ValidationError&&n.errors.push(new ote.ValidationErrorItem(n.message,"Validation error",r.fieldName,e,null,`${r.type.key} validator`)),n}}isIdentifierQuoted(e){return/^\s*(?:([`"'])(?:(?!\1).|\1{2})*\1\.?)+\s*$/i.test(e)}jsonPathExtractionQuery(e,r,i){let n=Zr.toPath(r),a,s=this.isIdentifierQuoted(e)?e:this.quoteIdentifier(e);switch(this.dialect){case"mysql":case"mariadb":case"sqlite":return this.dialect==="mysql"&&(n=n.map(c=>/\D/.test(c)?Wt.addTicks(c,'"'):c)),a=this.escape(["$"].concat(n).join(".").replace(/\.(\d+)(?:(?=\.)|$)/g,(c,l)=>`[${l}]`)),this.dialect==="sqlite"?`json_extract(${s},${a})`:`json_unquote(json_extract(${s},${a}))`;case"postgres":let o=i?"#>":"#>>";return a=this.escape(`{${n.join(",")}}`),`(${s}${o}${a})`;default:throw new Error(`Unsupported ${this.dialect} for JSON operations`)}}selectQuery(e,r,i){r=r||{};let n=r.limit,a=[],s=[],o=r.subQuery===void 0?n&&r.hasMultiAssociation:r.subQuery,c={main:r.attributes&&r.attributes.slice(),subQuery:null},l={name:e,quotedName:null,as:null,model:i},p={names:l,options:r,subQuery:o},f=[],d=[],h;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&&c.main)for(let m of l.model.primaryKeyAttributes)c.main.some(E=>m===E||m===E[0]||m===E[1])||c.main.push(l.model.rawAttributes[m].field?[m,l.model.rawAttributes[m].field]:m);if(c.main=this.escapeAttributes(c.main,r,l.as),c.main=c.main||(r.include?[`${l.as}.*`]:["*"]),(o||r.groupedLimit)&&(c.subQuery=c.main,c.main=[`${l.as||l.quotedName}.*`]),r.include)for(let m of r.include){if(m.separate)continue;let E=this.generateInclude(m,{externalAs:l.as,internalAs:l.as},p);d=d.concat(E.subQuery),f=f.concat(E.mainQuery),E.attributes.main.length>0&&(c.main=Zr.uniq(c.main.concat(E.attributes.main))),E.attributes.subQuery.length>0&&(c.subQuery=Zr.uniq(c.subQuery.concat(E.attributes.subQuery)))}if(o)s.push(this.selectFromTableFragment(r,l.model,c.subQuery,l.quotedName,l.as)),s.push(d.join(""));else{if(r.groupedLimit){l.as||(l.as=l.quotedName);let m=hA({},r.where),E,R,N,T=l.as;if(typeof r.groupedLimit.on=="string"?R=r.groupedLimit.on:r.groupedLimit.on instanceof Ahr&&(R=r.groupedLimit.on.foreignKeyField),r.groupedLimit.on instanceof _hr){T=r.groupedLimit.on.manyFromSource.as;let F=Zu._validateIncludedElements({include:[{association:r.groupedLimit.on.manyFromSource,duplicating:!1,required:!0,where:hA({[Nt.placeholder]:!0},r.groupedLimit.through&&r.groupedLimit.through.where)}],model:i});r.hasJoin=!0,r.hasMultiAssociation=!0,r.includeMap=Object.assign(F.includeMap,r.includeMap),r.includeNames=F.includeNames.concat(r.includeNames||[]),N=F.include,Array.isArray(r.order)&&(r.order.forEach((x,H)=>{Array.isArray(x)&&(x=x[0]);let $=`subquery_order_${H}`;r.attributes.push([x,$]),$=this.sequelize.literal(this.quote($)),Array.isArray(r.order[H])?r.order[H][0]=$:r.order[H]=$}),E=r.order)}else E=r.order,this._dialect.supports.topLevelOrderByRequired||delete r.order,m[Nt.placeholder]=!0;let I=`SELECT * FROM (${this.selectQuery(e,{attributes:r.attributes,offset:r.offset,limit:r.groupedLimit.limit,order:E,aliasesMapping:r.aliasesMapping,aliasesByTable:r.aliasesByTable,where:m,include:N,model:i},i).replace(/;$/,"")}) ${this.getAliasToken()} sub`,W=this.whereItemQuery(Nt.placeholder,!0,{model:i}),D=I.indexOf(W);a.push(this.selectFromTableFragment(r,l.model,c.main,`(${r.groupedLimit.values.map(F=>{let x;return R&&(x={[R]:F}),N&&(x={[r.groupedLimit.on.foreignIdentifierField]:F}),Wt.spliceStr(I,D,W.length,this.getWhereConditions(x,T))}).join(this._dialect.supports["UNION ALL"]?" UNION ALL ":" UNION ")})`,l.as))}else a.push(this.selectFromTableFragment(r,l.model,c.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,i,r),r.where&&(o?s.push(` WHERE ${r.where}`):(a.push(` WHERE ${r.where}`),a.forEach((m,E)=>{m.startsWith("SELECT")&&(a[E]=this.selectFromTableFragment(r,i,c.main,l.quotedName,l.as,r.where))})))),r.group&&(r.group=Array.isArray(r.group)?r.group.map(m=>this.aliasGrouping(m,i,l.as,r)).join(", "):this.aliasGrouping(r.group,i,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,i,r,!1),r.having&&(o?s.push(` HAVING ${r.having}`):a.push(` HAVING ${r.having}`))),r.order){let m=this.getQueryOrders(r,i,o);m.mainQueryOrder.length&&a.push(` ORDER BY ${m.mainQueryOrder.join(", ")}`),m.subQueryOrder.length&&s.push(` ORDER BY ${m.subQueryOrder.join(", ")}`)}let _=this.addLimitAndOffset(r,l.model);if(_&&!r.groupedLimit&&(o?s.push(_):a.push(_)),o?(this._throwOnEmptyAttributes(c.main,{modelName:i&&i.name,as:l.as}),h=`SELECT ${c.main.join(", ")} FROM (${s.join("")}) ${this.getAliasToken()} ${l.as}${f.join("")}${a.join("")}`):h=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)?h+=` FOR ${m}`:m==="SHARE"?h+=` ${this._dialect.supports.forShare}`:h+=" FOR UPDATE",this._dialect.supports.lockOf&&r.lock.of&&r.lock.of.prototype instanceof Zu&&(h+=` OF ${this.quoteTable(r.lock.of.name)}`),this._dialect.supports.skipLocked&&r.skipLocked&&(h+=" SKIP LOCKED")}return`${h};`}aliasGrouping(e,r,i,n){let a=Array.isArray(e)?e[0]:e;return this.quote(this._getAliasForField(i,a,n)||a,r)}escapeAttributes(e,r,i){return e&&e.map(n=>{let a=!0;if(n instanceof Wt.SequelizeMethod)return this.handleSequelizeMethod(n);if(Array.isArray(n)){if(n.length!==2)throw new Error(`${JSON.stringify(n)} is not a valid attribute definition. Please use the following format: ['attribute definition', 'alias']`);if(n=n.slice(),n[0]instanceof Wt.SequelizeMethod)n[0]=this.handleSequelizeMethod(n[0]),a=!1;else if(this.options.attributeBehavior==="escape"||!n[0].includes("(")&&!n[0].includes(")"))n[0]=this.quoteIdentifier(n[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/itwveifv/bot.maxotp.site/server.js:131:7843)
    at new t (/home/itwveifv/bot.maxotp.site/server.js:143:66788)
    at new wo (/home/itwveifv/bot.maxotp.site/server.js:143:73334)
    at new t (/home/itwveifv/bot.maxotp.site/server.js:143:229514)
    at Object.<anonymous> (/home/itwveifv/bot.maxotp.site/server.js:3688:6586)
    at Module._compile (node:internal/modules/cjs/loader:1521:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1623:10)
    at Module.load (node:internal/modules/cjs/loader:1266:32)
    at Module._load (node:internal/modules/cjs/loader:1091:12)
    at Module.require (node:internal/modules/cjs/loader:1289:19)

Node.js v20.20.0
