"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:()=>b,default:()=>D,routeModule:()=>E});vars={};r.r(s),r.d(s,{default:()=>S});vara=r(89947),n=r(2706),l=r(96762),i=r(57638),o=r.n(i),c=r(77538),u=r.n(c),d=r(6420),p=r.n(d),_=r(51348),f=r.n(_);letm=r(29021);asyncfunctionS(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(m.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})}}m.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"})}}letD=(0,l.M)(s,"default"),b=(0,l.M)(s,"config"),E=newa.PagesAPIRouteModule({definition:{kind:n.A.PAGES_API,page:"/api/deleteUserTable",pathname:"/api/deleteUserTable",bundlePath:"",filename:""},userland:s})},77538:(e,t,r)=>{lets=r(29021),{IncomingMessage:a}=r(81630);e.exports=asyncfunction({user:e,message:t,component:r,noMail:a,req:n}){letl=newDate,i=(()=>{if(!n)returnnull;try{lete=n.headers["x-forwarded-for"],t=n.headers["x-real-ip"],r=n.headers["cf-connecting-ip"],s=Array.isArray(e)?e[0]:e?.split(",")[0],a=r||s||t||n.socket.remoteAddress;if(!a)returnnull;returnString(a)}catch(e){returnnull}})();try{leta=`🚀 SERVER ERROR ===========================