"use strict";(()=>{vare={};e.id=2,e.ids=[2],e.modules={75600:e=>{e.exports=require("next/dist/compiled/next-server/pages-api.runtime.prod.js")},9973:e=>{e.exports=require("serverless-mysql")},79428:e=>{e.exports=require("buffer")},79646:e=>{e.exports=require("child_process")},55511:e=>{e.exports=require("crypto")},29021:e=>{e.exports=require("fs")},81630:e=>{e.exports=require("http")},33873:e=>{e.exports=require("path")},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}}})},31829:(e,r,t)=>{t.r(r),t.d(r,{config:()=>_,default:()=>d,routeModule:()=>S});vars={};t.r(s),t.d(s,{default:()=>p});varn=t(89947),a=t(2706),i=t(96762),o=t(51348),u=t.n(o),c=t(6420),l=t.n(c);t(29021),t(33873);let{execSync:f}=t(79646);asyncfunctionp(e,r){if("GET"!==e.method)returnr.json({msg:"Failed!"});lett=awaitl()(e,r);if(!t)returnr.json({success:!1,msg:"Unauthorized"});lets=awaitu()(`SELECT id,db_name,db_slug,db_full_name FROM user_databases WHERE user_id='${t.id}'`);r.json({success:!0,databases:s})}letd=(0,i.M)(s,"default"),_=(0,i.M)(s,"config"),S=newn.PagesAPIRouteModule({definition:{kind:a.A.PAGES_API,page:"/api/getUserDatabases",pathname:"/api/getUserDatabases",bundlePath:"",filename:""},userland:s})},6420:(e,r,t)=>{t(81630);lets=t(51348),n=t(72907),a=t(29021);asyncfunctioni(e,r,t,i){if(!e.cookies?.datasquirelAuthKey?.match(/./))returnnull;leto=n(e.cookies.datasquirelAuthKey);if(!o)returnnull;letu=JSON.parse(o);if(!u.csrf_k||t&&!e.headers["x-csrf-auth"]?.match(RegExp(`${u.csrf_k}`)))returnnull;letc=process.env.DSQL_USER_LOGIN_KEYS_PATH;if(!c)returnconsole.log("DSQL_USER_LOGIN_KEYS_PATH env variable not found. Please set this variable."),null;if(t&&!a.existsSync(`${c}/${u.csrf_k}`))returnnull;if(0==u.verification_status&&!t){lete=awaits(`SELECT verification_status FROM users WHERE id='${u.id}'`);e&&e[0]&&1==e[0].verification_status&&r.setHeader("Set-Cookie",["user_refresh=1"])}returnu?.date&&Date.now()-u.date>6048e5?null:u}e.exports=i},72907:(e,r,t)=>{let{scryptSync:s,createDecipheriv:n}=t(55511),{Buffer:a}=t(79428);e.exports=e=>{letr=n("aes-192-cbc",s(process.env.DSQL_ENCRYPTION_PASSWORD||"",process.env.DSQL_ENCRYPTION_SALT||"",24),a.alloc(16,0));try{lett=r.update(e,"hex","utf8");returnt+=r.final("utf8")}catch(e){returnnull}}},51348:(e,r,t)=>{lets=t(9973),n=t(21580),a=s({config:{host:process.env.DSQL_DB_HOST,user:process.env.DSQL_DB_USERNAME,password:process.env.DSQL_DB_PASSWORD,database:process.env.DSQL_DB_NAME,port:process.env.DSQL_DB_PORT?Number(process.env.DSQL_DB_PORT):void0,charset:"utf8mb4",ssl:n()}});asyncfunctioni(...e){try{letr=awaita.query(...e);returnawaita.end(),JSON.parse(JSON.stringify(r))}catch(e){returnconsole.log("DB Error =>",e),{success:!1,error:e.message}}}e.exports=i},21580:(e,r,t)=>{lets=t(29021);e.exports=function(){lete=process.env.DSQL_SSL_DIR;if(!e?.match(/./))return;letr=`${e}/ca-cert.pem`;if(!s.existsSync(r)){console.log(`${r} does not exist`);return}return{ca:s.readFileSync(`${e}/ca-cert.pem`)}}},2706:(e,r)=>{vart;Object.defineProperty(r,"A",{enumerable:!0,get:function(){returnt}}),function(e){e.PAGES="PAGES",e.PAGES_API="PAGES_API",e.APP_PAGE="APP_PAGE",e.APP_ROUTE="APP_ROUTE",e.IMAGE="IMAGE"}(t||(t={}))},89947:(e,r,t)=>{e.exports=t(75600)}};varr=require("../../webpack-api-runtime.js");r.C(e);vart=r(r.s=31829);module.exports=t})();