"use strict";(()=>{vare={};e.id=3319,e.ids=[3319],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,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}}})},62229:(e,r,t)=>{t.r(r),t.d(r,{config:()=>m,default:()=>S,routeModule:()=>f});vars={};t.r(s),t.d(s,{default:()=>_});vara=t(89947),n=t(2706),o=t(96762),l=t(57638),i=t.n(l);letc=t(73677),u=t(39831),d=t(77538),p=t(6420);asyncfunction_(e,r){if("POST"!==e.method)returnr.json({msg:"Failed!"});lett=awaitp(e,r,!0);if(!t)returnr.json({success:!1,msg:"User Auth Failed"});let{tableName:s,dbSlug:a,dbId:n,isTitle:o,isSlug:l,isFullName:_,defaultField:S}=e.body;try{letd=awaitu({databaseSlug:a,request:e,user:t,query:e.query});if(!awaitc({user:t,confirmedDelegetedUser:d,database:a,table:s,dbId:n,priviledgeRegex:/Update Entries/i}))returnr.json({success:!1,msg:"Unauthorized"});letp=d?.rootUserId?`datasquirel_user_${d.rootUserId}_${a}`:`datasquirel_user_${t.id}_${a}`,m=`SELECT id${o?",title":l?",slug":_?",CONCAT(first_name, ' ', last_name) AS full_name":S?","+S:""} FROM ${s}`,f=awaiti()({database:p,queryString:m});r.json({success:!0,entries:f})}catch(e){d({component:"/api/addTableEntry/catch-error",message:e.message,user:t}),r.json({success:!1,msg:"Database Files could not be written!",err:e.message})}}letS=(0,o.M)(s,"default"),m=(0,o.M)(s,"config"),f=newa.PagesAPIRouteModule({definition:{kind:n.A.PAGES_API,page:"/api/fetch-entries-basic",pathname:"/api/fetch-entries-basic",bundlePath:"",filename:""},userland:s})},73677:(e,r,t)=>{lets=t(51348),a=t(77538);e.exports=asyncfunction({user:e,confirmedDelegetedUser:r,database:t,table:n,priviledgeRegex:o,dbId:l}){leti,c;try{r?.delegated?(i=awaits("SELECT priviledge FROM delegated_user_tables WHERE root_user_id=? AND delegated_user_id=? AND `database`=? AND `table`=?",[r.rootUserId,e.id,t,n]),c=i[0]?.priviledge?.match(o)):(i=awaits("SELECT table_slug FROM user_database_tables WHERE user_id=? AND table_slug=? AND db_id=?",[e.id,n,l]),c=!0)}catch(r){a({component:"checkUserRights",message:r.message,user:e})}return!!i&&!!i[0]&&!!c}},39831:(e,r,t)=>{t(81630);lets=t(72907);e.exports=asyncfunction({request:e,databaseSlug:r,user:t,query:a}){try{letn=t.id,o=null;if(!a?.delegated)return{dbUserId:n};letl=a.dbUserId,i=`${process.env.DSQL_USER_DB_PREFIX}${l}_${r}`,c=`${process.env.DSQL_USER_DELEGATED_DB_COOKIE_PREFIX}${i}`;try{if(!e.cookies?.[c])throwError("Cookie not present");lett=s(e.cookies[c]);if(!t)throwError("Invalid Token");if((o=JSON.parse(t)).databaseSlug===r)return{dbUserId:n=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:n}}catch(e){returnnull}}},77538:(e,r,t)=>{lets=t(29021),{IncomingMessage:a}=t(81630);e.exports=asyncfunction({user:e,message:r,component:t,noMail:a,req:n}){leto=newDate,l=(()=>{if(!n)returnnull;try{lete=n.headers["x-forwarded-for"],r=n.headers["x-real-ip"],t=n.headers["cf-connecting-ip"],s=Array.isArray(e)?e[0]:e?.split(",")[0],a=t||s||r||n.socket.remoteAddress;if(!a)returnnull;returnString(a)}catch(e){returnnull}})();try{leta=`🚀 SERVER ERROR ===========================