"use strict";(()=>{vare={};e.id=6237,e.ids=[6237],e.modules={75600:e=>{e.exports=require("next/dist/compiled/next-server/pages-api.runtime.prod.js")},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}}})},27215:(e,r,t)=>{t.r(r),t.d(r,{config:()=>l,default:()=>c,routeModule:()=>_});varn={};t.r(n),t.d(n,{default:()=>a});vars=t(89947),i=t(2706),o=t(96762),u=t(69842);asyncfunctiona(e,r){if("POST"!==e.method)returnr.json({msg:"Failed!"});lett=await(0,u.A)(e,r,!0);r.json({user:t})}letc=(0,o.M)(n,"default"),l=(0,o.M)(n,"config"),_=news.PagesAPIRouteModule({definition:{kind:i.A.PAGES_API,page:"/api/clientSideAuth",pathname:"/api/clientSideAuth",bundlePath:"",filename:""},userland:n})},69842:(e,r,t)=>{t.d(r,{A:()=>a});varn=t(48786),s=t(95969),i=t(29021),o=t.n(i),u=t(89159);asyncfunctiona(e,r,t){let{keyCookieName:i,csrfCookieName:a}=(0,u.A)();if(!e.cookies?.[i]?.match(/./))returnnull;letc=(0,s.A)({encryptedString:e.cookies[i]});if(!c)returnnull;letl=JSON.parse(c);if(!l.csrf_k||t&&!Object.keys(e.headers).find(e=>e.includes(l.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&&!o().existsSync(`${_}/${l.csrf_k}`))returnnull;if(0==l.verification_status&&!t){lete=await(0,n.A)(`SELECT verification_status FROM users WHERE id='${l.id}'`);e&&e[0]&&1==e[0].verification_status&&r.setHeader("Set-Cookie",["user_refresh=1"])}returnl?.date&&Date.now()-l.date>6048e5?null:l}},89159:(e,r,t)=>{t.d(r,{A:()=>n});functionn(e){letr=process.env.DSQL_COOKIES_PREFIX||"dsql_",t=process.env.DSQL_COOKIES_KEY_NAME||"key",n=process.env.DSQL_COOKIES_CSRF_NAME||"csrf",s=process.env.DSQL_COOKIES_ONE_TIME_CODE_NAME||"one-time-code",i=e?.database?.replace(/^datasquirel_user_\d+_/,"")||process.env.DSQL_DB_NAME?.replace(/^datasquirel_user_\d+_/,""),o=r;e?.userId&&(o+=`user_${e.userId}_`),i&&(o+=`${i}_`),o+=t;letu=r;e?.userId&&(u+=`user_${e.userId}_`),i&&(u+=`${i}_`),u+=n;leta=r;returne?.userId&&(a+=`user_${e.userId}_`),i&&(a+=`${i}_`),{keyCookieName:o,csrfCookieName:u,oneTimeCodeName:a+=s}}},95969:(e,r,t)=>{t.d(r,{A:()=>i});varn=t(55511),s=t(79428);functioni({encryptedString:e,encryptionKey:r,encryptionSalt:t}){if(!e?.match(/./))returnconsole.log("Encrypted string is invalid"),e;leti=r||process.env.DSQL_ENCRYPTION_PASSWORD,o=t||process.env.DSQL_ENCRYPTION_SALT,u=process.env.DSQL_ENCRYPTION_KEY_LENGTH?Number(process.env.DSQL_ENCRYPTION_KEY_LENGTH):24;if(!i?.match(/.{8,}/))returnconsole.log("Decrption key is invalid"),e;if(!o?.match(/.{8,}/))returnconsole.log("Decrption salt is invalid"),e;leta=(0,n.scryptSync)(i,o,u),c=s.Buffer.alloc(16,0),l=(0,n.createDecipheriv)("aes-192-cbc",a,c);try{letr=l.update(e,"hex","utf8");returnr+=l.final("utf8")}catch(r){returnconsole.log("Error in decrypting =>",r.message),e}}},48786:(e,r,t)=>{t.d(r,{A:()=>n});asyncfunctionn(...e){letr=global.DSQL_DB_CONN;try{if(!r)throwError("No Connection provided to DB_HANDLER function!");lett=awaitr.query(...e);returnJSON.parse(JSON.stringify(t))}catch(e){returnconsole.log("DB Error =>",e),{success:!1,error:e.message}}finally{awaitr?.end()}}},2706:(e,r)=>{Object.defineProperty(r,"A",{enumerable:!0,get:function(){returnt}});vart=function(e){returne.PAGES="PAGES",e.PAGES_API="PAGES_API",e.APP_PAGE="APP_PAGE",e.APP_ROUTE="APP_ROUTE",e.IMAGE="IMAGE",e}({})},89947:(e,r,t)=>{e.exports=t(75600)}};varr=require("../../webpack-api-runtime.js");r.C(e);vart=r(r.s=27215);module.exports=t})();