"use strict";(()=>{vare={};e.id=8932,e.ids=[8932],e.modules={27825:e=>{e.exports=require("lodash")},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}}})},22790:(e,r,t)=>{t.r(r),t.d(r,{config:()=>m,default:()=>E,routeModule:()=>D});vars={};t.r(s),t.d(s,{default:()=>f});vara=t(89947),n=t(2706),o=t(96762),l=t(6420),c=t.n(l),i=t(48225),u=t.n(i);t(27825);vard=t(39831),_=t.n(d),p=t(57638),S=t.n(p);asyncfunctionf(e,r){if("POST"!==e.method)returnr.json({user:null,msg:"Registration Failed!"});lett=awaitc()(e,r,!0);if(!t)returnr.json({success:!1,msg:"Unauthorized"});lets=e.body;try{leta=await_()({databaseSlug:s.dbName,request:e,user:t,query:e.query}),n=a?a?.rootUserId?a.rootUserId:a.dbUserId:null;if(!n)throwError("User not Found!");leto=`datasquirel_user_${n}_${s.dbName}`,l=s.tableName,c=s.page,i=20*c,u=`SELECT * FROM ${l}`,d=[];s.search&&s.searchField&&(u+=` WHERE LOWER(\`${s.searchField.toLowerCase().replace(/ /g,"_")}\`) LIKE ?`,d.push(`%${s.search.toLowerCase()}%`)),u+=` ORDER BY id DESC LIMIT 20 OFFSET ${i}`;letp=awaitS()({database:o,queryString:u,queryValuesArray:d,tableSchema:s.tableSchema}),f={success:!0,data:p,page:Number(c)+1};r.json(f)}catch(e){u()({component:"/api/infiniteScroll/catch-error",message:e.message,user:t}),r.json({success:!1,data:null})}}t(29021);letE=(0,o.M)(s,"default"),m=(0,o.M)(s,"config"),D=newa.PagesAPIRouteModule({definition:{kind:n.A.PAGES_API,page:"/api/infiniteScroll",pathname:"/api/infiniteScroll",bundlePath:"",filename:""},userland:s})},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};letl=a.dbUserId,c=`${process.env.DSQL_USER_DB_PREFIX}${l}_${r}`,i=`${process.env.DSQL_USER_DELEGATED_DB_COOKIE_PREFIX}${c}`;try{if(!e.cookies?.[i])throwError("Cookie not present");lett=s({encryptedString:e.cookies[i]});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}}},6420:(e,r,t)=>{t(81630);lets=t(51348),a=t(72835),n=t(29021),o=t(31341);asyncfunctionl(e,r,t,l){let{keyCookieName:c,csrfCookieName:i}=o();if(!e.cookies?.[c]?.match(/./))returnnull;letu=a({encryptedString:e.cookies[c]});if(!u)returnnull;letd=JSON.parse(u);if(!d.csrf_k||t&&!e.headers["x-csrf-auth"]?.match(RegExp(`${d.csrf_k}`)))returnnull;let_=process.env.DSQL_USER_LOGIN_KEYS_PATH;if(!_)returnconsole.log("DSQL_USER_LOGIN_KEYS_PATH env variable not found. Please set this variable."),null;if(t&&!n.existsSync(`${_}/${d.csrf_k}`))returnnull;if(0==d.verification_status&&!t){lete=awaits(`SELECT verification_status FROM users WHERE id='${d.id}'`);e&&e[0]&&1==e[0].verification_status&&r.setHeader("Set-Cookie",["user_refresh=1"])}returnd?.date&&Date.now()-d.date>6048e5?null:d}e.exports=l},31341:e=>{e.exports=function(e){letr=process.env.DSQL_COOKIES_PREFIX||"dsql_",t=process.env.DSQL_COOKIES_KEY_NAME||"key",s=process.env.DSQL_COOKIES_CSRF_NAME||"csrf",a=process.env.DSQL_COOKIES_ONE_TIME_CODE_NAME||"one-time-code",n=e?.database?.replace(/^datasquirel_user_\d+_/,"")||process.env.DSQL_DB_NAME?.replace(/^datasquirel_user_\d+_/,""),o=r;e?.userId&&(o+=`user_${e.userId}_`),n&&(o+=`${n}_`),o+=t;letl=r;e?.userId&&(l+=`user_${e.userId}_`),n&&(l+=`${n}_`),l+=s;letc=r;re