"use strict";(()=>{vare={};e.id=2998,e.ids=[2998],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}}})},55896:(e,r,t)=>{t.r(r),t.d(r,{config:()=>m,default:()=>S,routeModule:()=>g});varn={};t.r(n),t.d(n,{default:()=>E});vars=t(89947),i=t(2706),a=t(96762),o=t(69842),l=t(29021),u=t.n(l),c=t(67619),_=t(48786),d=t(68829),f=t(89159);asyncfunctionp({userId:e,res:r,csrf:t}){try{letn=process.env.DSQL_USER_LOGIN_KEYS_PATH;if(!n)returnconsole.log("DSQL_USER_LOGIN_KEYS_PATH env variable not found. Please set this variable."),null;lets=await(0,_.A)("SELECT * FROM users WHERE id=?",[e]);u().unlinkSync(`${n}/${t}`);leti=Math.random().toString(36).substring(2)+"-"+Math.random().toString(36).substring(2),a={id:s[0].id,stripe_id:s[0].stripe_id||"",first_name:s[0].first_name,last_name:s[0].last_name,email:s[0].email,social_id:s[0].social_id,image:s[0].image,image_thumbnail:s[0].image_thumbnail,verification_status:s[0].verification_status,social_login:s[0].social_login,social_platform:s[0].social_platform,csrf_k:i,logged_in_status:!0,date:Date.now()},o=(0,d.default)({data:JSON.stringify(a)});u().writeFileSync(`${n}/${i}`,JSON.stringify(a));let{keyCookieName:l,csrfCookieName:c}=(0,f.A)();returnr.setHeader("Set-Cookie",[`${l}=${o};samesite=strict;path=/;HttpOnly=true;Secure=true`,`${c}=${i};samesite=strict;path=/;HttpOnly=true;Secure=true`,"user_refresh=1"]),a}catch(r){return(0,c.default)({component:"reAuthUser",message:r.message,user:{id:e}}),null}}asyncfunctionE(e,r){"POST"!==e.method&&r.json({msg:"Failed!"});lett=await(0,o.A)(e,r,!0);if(!t){console.log("No user Found"),r.redirect(307,"/logout");return}letn=awaitp({userId:t.id,res:r,csrf:t.csrf_k}),s={status:!!n,csrf:n?.csrf_k,user:n};r.json(s)}letS=(0,a.M)(n,"default"),m=(0,a.M)(n,"config"),g=news.PagesAPIRouteModule({definition:{kind:i.A.PAGES_API,page:"/api/reAuthenticateUser",pathname:"/api/reAuthenticateUser",bundlePath:"",filename:""},userland:n})},69842:(e,r,t)=>{t.d(r,{A:()=>l});varn=t(48786),s=t(95969),i=t(29021),a=t.n(i),o=t(89159);asyncfunctionl(e,r,t){let{keyCookieName:i,csrfCookieName:l}=(0,o.A)();if(!e.cookies?.[i]?.match(/./))returnnull;letu=(0,s.A)({encryptedString:e.cookies[i]});if(!u)returnnull;letc=JSON.parse(u);if(!c.csrf_k||t&&!Object.keys(e.headers).find(e=>e.includes(c.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&&!a().existsSync(`${_}/${c.csrf_k}`))returnnull;if(0==c.verification_status&&!t){lete=await(0,n.A)(`SELECT verification_status FROM users WHERE id='${c.id}'`);e&&e[0]&&1==e[0].verification_status&&r.setHeader("Set-Cookie",["user_refresh=1"])}returnc?.date&&Date.now()-c.date>6048e5?null:c}},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+_/,""),a=r;e?.userId&&(a+=`user_${e.userId}_`),i&&(a+=`${i}_`),a+=t;leto=r;e?.userId&&(o+=`user_${e.userId}_`),i&&(o+=`${i}_`),o+=n;letl=r;returne?.userId&&(l+=`user_${e.userId}_`),i&&(l+=`${i}_`),{keyCookieName:a,csrfCookieName:o,oneTimeCodeName:l+=s}}},67619:(e,r,t)=>{t.r(r),t.d(r,{default:()=>i});varn=t(29021),s=t.n(n);asyncfunctioni({user:e,message:r,component:t,noMail:n,req:i}){leta=newDate,o=(()=>{if(!i)returnnull;try{lete=i.headers["x-forwarded-for"],r=i.headers["x-real-ip"],t=i.headers["cf-connecting-ip"],n=Array.isArray(e)?e[0]:e?.split(",")[0],s=t||n||r||i.socket.remoteAddr