"use strict";(()=>{vare={};e.id=1132,e.ids=[1132],e.modules={75600:e=>{e.exports=require("next/dist/compiled/next-server/pages-api.runtime.prod.js")},72583:e=>{e.exports=require("sanitize-html")},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}}})},82595:(e,r,t)=>{t.r(r),t.d(r,{config:()=>y,default:()=>h,routeModule:()=>N});vars={};t.r(s),t.d(s,{default:()=>D});vara=t(89947),n=t(2706),o=t(96762),i=t(96771),l=t.n(i),c=t(73677),u=t.n(c),d=t(39831),p=t.n(d),_=t(48225),S=t.n(_),g=t(6420),E=t.n(g),f=t(33364),m=t.n(f);asyncfunctionD(e,r){if("POST"!==e.method)returnr.json({msg:"Failed!"});lett=awaitE()(e,r,!0);if(!t)returnr.json({success:!1,msg:"Unauthorized"});let{dbSlug:s,tableName:a,payload:n,entryId:o,tableSchema:i,delegated:c,dbId:d}=e.body;deleten.id,deleten.uuid,deleten.date_created,deleten.date_created_code,deleten.date_created_timestamp,deleten.date_updated,deleten.date_updated_code,deleten.date_updated_timestamp;try{letc=awaitp()({databaseSlug:s,request:e,user:t,query:e.query}),_=c?.rootUserId?`datasquirel_user_${c.rootUserId}_${s}`:`datasquirel_user_${t.id}_${s}`;if(!awaitu()({user:t,confirmedDelegetedUser:c,database:s,table:a,dbId:d,priviledgeRegex:/Update Entries/i}))returnr.json({success:!1,msg:"Unauthorized"});letS=awaitm()({dbContext:"Dsql User",paradigm:"Full Access",dbFullName:_,tableName:a,identifierColumnName:"id",identifierValue:o,data:n,tableSchema:i});if(S?.error)throwError(S.error);if(!S)throwError("No result returned!");awaitl()({dbName:_,entryId:o,entryOrder:n.order,tableName:a,tableSchema:i}),r.json({success:!0,payload:S})}catch(e){S()({component:"/api/updateTableEntry/main-catch-error",message:e.message,user:t}),r.json({success:!1,msg:"Database Files could not be written!",err:e.message})}}leth=(0,o.M)(s,"default"),y=(0,o.M)(s,"config"),N=newa.PagesAPIRouteModule({definition:{kind:n.A.PAGES_API,page:"/api/updateTableEntry",pathname:"/api/updateTableEntry",bundlePath:"",filename:""},userland:s})},73677:(e,r,t)=>{lets=t(51348),a=t(48225);e.exports=asyncfunction({user:e,confirmedDelegetedUser:r,database:t,table:n,priviledgeRegex:o,dbId:i}){letl,c;try{r?.delegated?(l=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=l[0]?.priviledge?.match(o)):(l=awaits("SELECT table_slug FROM user_database_tables WHERE user_id=? AND table_slug=? AND db_id=?",[e.id,n,i]),c=!0)}catch(r){a({component:"checkUserRights",message:r.message,user:e})}return!!l&&!!l[0]&&!!c}},39831:(e,r,t)=>{t(81630);lets=t(72835);e.exports=asyncfunction({request:e,databaseSlug:r,user:t,query:a}){try{letn=t.id,o=null;if(!a?.delegated)return{dbUserId:n};leti=a.dbUserId,l=`${process.env.DSQL_USER_DB_PREFIX}${i}_${r}`,c=`${process.env.DSQL_USER_DELEGATED_DB_COOKIE_PREFIX}${l}`;try{if(!e.cookies?.[c])throwError("Cookie not present");lett=s({encryptedString: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}}},96771:(e,r,t)=>{lets=t(21339);e.exports=asyncfunction({dbName:e,entryId:r,entryOrder:t,tableName:a,tableSchema:n}){try{if(n.fields.find(e=>!!e.fieldName?.match(/^order$/i))&&t){letn=awaits({database:e,paradigm:"Full Access",queryString:`SELECT * FROM ${a} WHERE \`order\` = '${t}' AND id != ?`,queryValues:[String(r)]});if(!