"use strict";(()=>{vare={};e.id=1658,e.ids=[1658],e.modules={39908:e=>{e.exports=require("@moduletrace/datasquirel/dist/users/user-auth")},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")},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}}})},17675:(e,r,t)=>{t.r(r),t.d(r,{config:()=>f,default:()=>p,routeModule:()=>S});vars={};t.r(s),t.d(s,{default:()=>_});varn=t(89947),a=t(2706),o=t(96762),i=t(61932),l=t(31495),u=t(60125),c=t(67619),d=t(69842);asyncfunction_(e,r){if("POST"!==e.method)returnr.json({msg:"Failed!"});lett=await(0,d.A)(e,r,!0);if(!t)returnr.json({success:!1,msg:"Unauthorized"});let{dbFullName:s,tableName:n,entryId:a,dbSlug:o,dbId:_,delegated:p}=e.body;try{letc=await(0,u.A)({databaseSlug:o,request:e,user:t,query:e.query});if(!await(0,l.A)({user:t,confirmedDelegetedUser:c,database:o,table:n,dbId:_,priviledgeRegex:/Delete Entries/i}))returnr.json({success:!1,msg:"Unauthorized"});await(0,i.A)({dbContext:"Dsql User",paradigm:"Full Access",dbFullName:s,tableName:n,identifierColumnName:"id",identifierValue:a}),r.json({success:!0})}catch(e){(0,c.A)({component:"/api/deleteTableEntry/main-catch-error",message:e.message,user:t}),r.json({success:!1,msg:"Deletion Failed!"})}}letp=(0,o.M)(s,"default"),f=(0,o.M)(s,"config"),S=newn.PagesAPIRouteModule({definition:{kind:a.A.PAGES_API,page:"/api/deleteTableEntry",pathname:"/api/deleteTableEntry",bundlePath:"",filename:""},userland:s})},31495:(e,r,t)=>{t.d(r,{A:()=>a});vars=t(48786),n=t(67619);asyncfunctiona({user:e,confirmedDelegetedUser:r,database:t,table:a,priviledgeRegex:o,dbId:i}){letl,u;try{r?.delegated?(l=await(0,s.A)("SELECT priviledge FROM delegated_user_tables WHERE root_user_id=? AND delegated_user_id=? AND `database`=? AND `table`=?",[r.rootUserId,e.id,t,a]),u=l[0]?.priviledge?.match(o)):(l=await(0,s.A)("SELECT table_slug FROM user_database_tables WHERE user_id=? AND table_slug=? AND db_id=?",[e.id,a,i]),u=!0)}catch(r){(0,n.A)({component:"checkUserRights",message:r.message,user:e})}return!!l&&!!l[0]&&!!u}},60125:(e,r,t)=>{t.d(r,{A:()=>n});vars=t(95969);asyncfunctionn({request:e,databaseSlug:r,user:t,query:n}){try{leta=t.id,o=null;if(!n?.delegated)return{dbUserId:a};leti=n.dbUserId,l=`${process.env.DSQL_USER_DB_PREFIX}${i}_${r}`,u=`${process.env.DSQL_USER_DELEGATED_DB_COOKIE_PREFIX}${l}`;try{if(!e.cookies?.[u])throwError("Cookie not present");lett=(0,s.A)({encryptedString:e.cookies[u]});if(!t)throwError("Invalid Token");if((o=JSON.parse(t)).databaseSlug===r)return{dbUserId:a=o.rootUserId,rootUserId:o.rootUserId,rootUserName:o.rootUserName,rootUserEmail:o.rootUserEmail,rootUserImage:o.rootUserImage,databaseFullName:o.databaseFullName,databaseSlug:o.databaseSlug,allowedTables:o.allowedTables,priviledges:o.priviledges,database:o.databaseSlug,delegated:!0}}catch(e){}return{dbUserId:a}}catch(e){returnnull}}},69842:(e,r,t)=>{t.d(r,{A:()=>a});vars=t(39908),n=t.n(s);asyncfunctiona(e,r,t){lets=n()({req:e,level:t?"deep":void0});returnconsole.log(s),s.payload}},61932:(e,r,t)=>{t.d(r,{A:()=>o});vars=t(48786),n=t(37897),a=t(62050);asyncfunctiono({dbContext:e,paradigm:r,dbFullName:t,tableName:o,identifierColumnName:i,identifierValue:l,useLocal:u}){try{letc=!!u||!e?.match(/dsql.user/i)&&(!t||!!t.match(/^datasquirel$/)),d=u?a.A:c?s.A:n.A,_=`DELETE FROM \`${t}\`.\`${o}\` WHERE \`${i}\`=?`;returnc?awaitd(_,[l]):awaitd({paradigm:r,queryString:_,queryValues:[l]})}catch(e){returnnull}}},67619:(e,r,t)=>{t.d(r,{A:()=>a});vars=t(29021),n=t.n(s);asyncfunctiona({user:e,message:r,component:t,noMail:s,req:a}){leto=newDate,i=(()=>{if(!a)returnnull;try{lete=a.headers["x-forwarded-for"],r=a.headers["x-real-ip"],t=a.headers["cf-connecting-ip"],s=Array.isArray(e)?e[0]:e?.split(",")[0],n=t