"use strict";(()=>{vare={};e.id=3319,e.ids=[3319],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}}})},3034:(e,r,t)=>{t.r(r),t.d(r,{config:()=>f,default:()=>p,routeModule:()=>S});vars={};t.r(s),t.d(s,{default:()=>_});vara=t(89947),n=t(2706),o=t(96762),l=t(30944),i=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:"User Auth Failed"});let{tableName:s,dbSlug:a,dbId:n,isTitle:o,isSlug:_,isFullName:p,defaultField:f}=e.body;try{letc=await(0,u.A)({databaseSlug:a,request:e,user:t,query:e.query});if(!await(0,i.A)({user:t,confirmedDelegetedUser:c,database:a,table:s,dbId:n,priviledgeRegex:/Update Entries/i}))returnr.json({success:!1,msg:"Unauthorized"});letd=c?.rootUserId?`datasquirel_user_${c.rootUserId}_${a}`:`datasquirel_user_${t.id}_${a}`,S=`SELECT id${o?",title":_?",slug":p?",CONCAT(first_name, ' ', last_name) AS full_name":f?","+f:""} FROM ${d}.${s}`,g=await(0,l.A)({database:d,queryString:S});r.json({success:!0,entries:g})}catch(e){(0,c.A)({component:"/api/addTableEntry/catch-error",message:e.message,user:t}),r.json({success:!1,msg:"Database Files could not be written!",err:e.message})}}letp=(0,o.M)(s,"default"),f=(0,o.M)(s,"config"),S=newa.PagesAPIRouteModule({definition:{kind:n.A.PAGES_API,page:"/api/fetch-entries-basic",pathname:"/api/fetch-entries-basic",bundlePath:"",filename:""},userland:s})},31495:(e,r,t)=>{t.d(r,{A:()=>n});vars=t(48786),a=t(67619);asyncfunctionn({user:e,confirmedDelegetedUser:r,database:t,table:n,priviledgeRegex:o,dbId:l}){leti,u;try{r?.delegated?(i=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,n]),u=i[0]?.priviledge?.match(o)):(i=await(0,s.A)("SELECT table_slug FROM user_database_tables WHERE user_id=? AND table_slug=? AND db_id=?",[e.id,n,l]),u=!0)}catch(r){(0,a.A)({component:"checkUserRights",message:r.message,user:e})}return!!i&&!!i[0]&&!!u}},60125:(e,r,t)=>{t.d(r,{A:()=>a});vars=t(95969);asyncfunctiona({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}`,u=`${process.env.DSQL_USER_DELEGATED_DB_COOKIE_PREFIX}${i}`;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: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}}},69842:(e,r,t)=>{t.d(r,{A:()=>n});vars=t(39908),a=t.n(s);asyncfunctionn(e,r,t){lets=a()({req:e,level:t?"deep":void0});returnconsole.log(s),s.payload}},43775:(e,r,t)=>{t.d(r,{A:()=>n});vars=t(95969);leta=/^id$|^uuid$|^date_created$|^date_created_code$|^date_created_timestamp$|^date_updated$|^date_updated_code$|^date_updated_timestamp$/;asyncfunctionn({unparsedResults:e,tableSchema:r}){lett=[];try{for(letn=0;n<e.length;n++){leto=e[n],l=Object.keys(o);for(lete=0;e<l.length;e++){lett=l[e],n=r?.fields[e];if(t?.match(a))continue;leti=o[t];("number"==typeofi||i)&&n?.encrypted&&i?.match(/./)&&(o[t]=(0,s.A)({encryptedString:i}))}t.push(o)}returnt}catch(r){returnconsole.log("ERRORinparseDbResu