"use strict";(()=>{vare={};e.id=964,e.ids=[964],e.modules={75600:e=>{e.exports=require("next/dist/compiled/next-server/pages-api.runtime.prod.js")},72583:e=>{e.exports=require("sanitize-html")},9973:e=>{e.exports=require("serverless-mysql")},79428:e=>{e.exports=require("buffer")},55511:e=>{e.exports=require("crypto")},29021:e=>{e.exports=require("fs")},81630:e=>{e.exports=require("http")},33873:e=>{e.exports=require("path")},79551:e=>{e.exports=require("url")},28354:e=>{e.exports=require("util")},96762:(e,r)=>{Object.defineProperty(r,"M",{enumerable:!0,get:function(){returnfunctione(r,t){returntinr?r[t]:"then"inr&&"function"==typeofr.then?r.then(r=>e(r,t)):"function"==typeofr&&"default"===t?r:void0}}})},85617:(e,r,t)=>{t.r(r),t.d(r,{config:()=>g,default:()=>f,routeModule:()=>E});vars={};t.r(s),t.d(s,{default:()=>S});varn=t(89947),o=t(2706),a=t(96762),i=t(48225),c=t.n(i),l=t(6420),u=t.n(l),p=t(33364),_=t.n(p);t(29021),t(28354);let{URL:d}=t(79551);asyncfunctionS(e,r){if("POST"!==e.method)returnr.json({msg:"Failed!"});lett=awaitu()(e,r,!0);if(!t)returnr.json({success:!1,msg:"Unauthorized"});let{dbId:s}=e.body;try{if(!s)throwError("No Target Database ID provided");await_()({tableName:"user_databases",data:{remote_connected:0,remote_connection_host:"",remote_connection_key:"",remote_connection_type:"",remote_db_full_name:""},identifierColumnName:"id",identifierValue:s}),r.json({success:!0})}catch(e){console.log("Disconnect Error, =>",e.message),c()({component:"/api/connect/verify/main-catch-error",message:e.message,user:t}),r.json({success:!1,msg:"Operation Failed!"})}}letf=(0,a.M)(s,"default"),g=(0,a.M)(s,"config"),E=newn.PagesAPIRouteModule({definition:{kind:o.A.PAGES_API,page:"/api/connect/disconnect",pathname:"/api/connect/disconnect",bundlePath:"",filename:""},userland:s})},6420:(e,r,t)=>{t(81630);lets=t(51348),n=t(72835),o=t(29021),a=t(31341);asyncfunctioni(e,r,t,i){let{keyCookieName:c,csrfCookieName:l}=a();if(!e.cookies?.[c]?.match(/./))returnnull;letu=n({encryptedString:e.cookies[c]});if(!u)returnnull;letp=JSON.parse(u);if(!p.csrf_k||t&&!e.headers["x-csrf-auth"]?.match(RegExp(`${p.csrf_k}`)))returnnull;let_=process.env.DSQL_USER_LOGIN_KEYS_PATH;if(!_)returnconsole.log("DSQL_USER_LOGIN_KEYS_PATH env variable not found. Please set this variable."),null;if(t&&!o.existsSync(`${_}/${p.csrf_k}`))returnnull;if(0==p.verification_status&&!t){lete=awaits(`SELECT verification_status FROM users WHERE id='${p.id}'`);e&&e[0]&&1==e[0].verification_status&&r.setHeader("Set-Cookie",["user_refresh=1"])}returnp?.date&&Date.now()-p.date>6048e5?null:p}e.exports=i},31341:e=>{e.exports=function(e){letr=process.env.DSQL_COOKIES_PREFIX||"dsql_",t=process.env.DSQL_COOKIES_KEY_NAME||"key",s=process.env.DSQL_COOKIES_CSRF_NAME||"csrf",n=e?.database||process.env.DSQL_DB_NAME?.replace(/^datasquirel_user_\d+_/,""),o=r;e?.userId&&(o+=`user_${e.userId}_`),n&&(o+=`${n}_`),o+=t;leta=r;returne?.userId&&(a+=`user_${e.userId}_`),n&&(a+=`${n}_`),{keyCookieName:o,csrfCookieName:a+=s}}},33364:(e,r,t)=>{lets=t(72583),n=t(16570),o=t(51348),a=t(21339),i=t(20503),c=t(44900);asyncfunctionl({dbContext:e,paradigm:r,dbFullName:t,tableName:l,data:u,tableSchema:p,identifierColumnName:_,identifierValue:d,encryptionKey:S,encryptionSalt:f,useLocal:g}){if(!u||!Object.keys(u).length)returnnull;letE=!!g||!e?.match(/dsql.user/i)&&(!t||!!t.match(/^datasquirel$/)),m=g?c:E?o:a,D=Object.keys(u),h=[],y=[];for(lete=0;e<D.length;e++)try{letr=D[e],t=u[r],o=p?p?.fields?.filter(e=>e.fieldName===r):null,a=o&&o[0]?o[0]:null;if(null==t||void0==t)continue;a?.richText&&(t=s(t,n)),a?.encrypted&&(t=i({data:t,encryptionKey:S,encryptionSalt:f})),"object"==typeoft&&(t=JSON.stringify(t)),a?.pattern&&!newRegExp(a.pattern,a.patternFlags||"").test(t)&&(console.log("DSQL: Pattern not matched =>",t),t=""),"string"==typeoft&&t.match(/^null$/i)&&(t={toSqlString:function(){return"NULL"}}),"string"!=typeoft||t.match(/./i)||(t={toSqlString:function(){return"NULL"}}),h.push(`\`${r}\`=?`),"number"==typeoft?y.push(String(t)):y.push(t)}catch(e){console.log("