"use strict";(()=>{vare={};e.id=5757,e.ids=[5757],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")},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,t)=>{Object.defineProperty(t,"M",{enumerable:!0,get:function(){returnfunctione(t,r){returnrint?t[r]:"then"int&&"function"==typeoft.then?t.then(t=>e(t,r)):"function"==typeoft&&"default"===r?t:void0}}})},77379:(e,t,r)=>{r.r(t),r.d(t,{config:()=>D,default:()=>E,routeModule:()=>b});vars={};r.r(s),r.d(s,{default:()=>m});vara=r(89947),n=r(2706),l=r(96762),i=r(57638),o=r.n(i),c=r(48225),u=r.n(c),d=r(6420),p=r.n(d),_=r(51348),f=r.n(_);letS=r(29021);asyncfunctionm(e,t){if("POST"!==e.method)returnt.json({msg:"Failed!"});letr=awaitp()(e,t,!0);if(!r)returnt.json({success:!1,msg:"Unauthorized"});lets=e.body,{id:a,user_id:n,table_name:l,table_slug:i,table_description:c}=s.table,{db_full_name:d}=s.database;awaito()({database:d,queryString:`DROP TABLE \`${i}\``});let_=a?[a]:[i,r.id,s.database.id];awaitf()(a?"DELETE FROM user_database_tables WHERE id=?":"DELETE FROM user_database_tables WHERE table_slug=? AND user_id=? AND db_id=?",_);try{lete;lets=`${process.env.DSQL_USER_DB_SCHEMA_PATH}/user-${r.id}/main.json`,a=JSON.parse(S.readFileSync(s,"utf8")),n=a.filter((e,t)=>{if(e.dbFullName===d)return!0}),l=n[0].tables.filter((t,r)=>{if(t?.tableName===i)returne=r,!0});if(l[0].childTable){lete;lett=a.filter(e=>e.dbFullName===l[0].childTableDbFullName)[0].tables.filter(e=>{if(e.tableName===l[0].childTableName)return!0})[0];t.childrenTables?.filter((t,r)=>{t.tableName===i&&(e=r)}),"number"==typeofe&&t.childrenTables?.splice(e,1)}if(n[0].tables.splice(e,1),n[0].childrenDatabases)for(lete=0;e<n[0].childrenDatabases.length;e++){lett=n[0].childrenDatabases[e];try{lete=a.filter(e=>e.dbFullName===t.dbFullName)[0];e.tables=n[0].tables,awaitf()("DELETE FROM user_database_tables WHERE table_slug=? AND user_id=? AND db_slug=?",[i,r.id,e.dbSlug])}catch(e){u()({component:"/api/deleteUserTable/lines-125-128",message:e.message,user:r})}}S.writeFileSync(`${s}`,JSON.stringify(a),"utf8"),t.json({success:!0})}catch(e){u()({component:"/api/deleteUserTable/main-catch-error",message:e.message,user:r}),t.json({success:!1,msg:"File Updates Failed"})}}letE=(0,l.M)(s,"default"),D=(0,l.M)(s,"config"),b=newa.PagesAPIRouteModule({definition:{kind:n.A.PAGES_API,page:"/api/deleteUserTable",pathname:"/api/deleteUserTable",bundlePath:"",filename:""},userland:s})},6420:(e,t,r)=>{r(81630);lets=r(51348),a=r(72835),n=r(29021),l=r(31341);asyncfunctioni(e,t,r,i){let{keyCookieName:o,csrfCookieName:c}=l();if(!e.cookies?.[o]?.match(/./))returnnull;letu=a({encryptedString:e.cookies[o]});if(!u)returnnull;letd=JSON.parse(u);if(!d.csrf_k||r&&!e.headers["x-csrf-auth"]?.match(RegExp(`${d.csrf_k}`)))returnnull;letp=process.env.DSQL_USER_LOGIN_KEYS_PATH;if(!p)returnconsole.log("DSQL_USER_LOGIN_KEYS_PATH env variable not found. Please set this variable."),null;if(r&&!n.existsSync(`${p}/${d.csrf_k}`))returnnull;if(0==d.verification_status&&!r){lete=awaits(`SELECT verification_status FROM users WHERE id='${d.id}'`);e&&e[0]&&1==e[0].verification_status&&t.setHeader("Set-Cookie",["user_refresh=1"])}returnd?.date&&Date.now()-d.date>6048e5?null:d}e.exports=i},31341:e=>{e.exports=function(){lete=process.env.DSQL_COOKIES_PREFIX||"dsql_";return{keyCookieName:e+(process.env.DSQL_COOKIES_KEY_NAME||"key"),csrfCookieName:e+(process.env.DSQL_COOKIES_CSRF_NAME||"csrf")}}},30003:e=>{e.exports=/^id$|^uuid$|^date_created$|^date_created_code$|^date_created_timestamp$|^date_updated$|^date_updated_code$|^date_updated_timestamp$/},6061:(e,t,r)=>{lets=r(72835),a=r(30003);e.exports=asyncfunction({unparsedResults:e,tableSchema:t}){letr=[];try{for(letn=0;n<e.length;n++){letl=e[n],i=Object.keys(l);for(lete=0;e<i.length;e++){letr=i[e],n=t?.fields[e];if(r?.match(a))continue;leto=