"use strict";(()=>{vare={};e.id=7714,e.ids=[7714],e.modules={75600:e=>{e.exports=require("next/dist/compiled/next-server/pages-api.runtime.prod.js")},21572:e=>{e.exports=require("nodemailer")},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}}})},10942:(e,r,t)=>{t.r(r),t.d(r,{config:()=>p,default:()=>f,routeModule:()=>E});varn={};t.r(n),t.d(n,{default:()=>_});vars=t(89947),i=t(2706),o=t(96762),a=t(29021),c=t.n(a),l=t(69842),u=t(96052),d=t(68829);asyncfunction_(e,r){if("GET"===e.method){lett=await(0,l.A)(e,r);if(!t)returnr.redirect(307,"/logout");letn=(0,d.A)({data:JSON.stringify({id:t.id,email:t.email,dateCode:Date.now()})}),s=process.env.DSQL_HOST;if(!await(0,u.A)({to:t.email,subject:"Verify Email Address",text:"Please click the link to verify your email address",html:c().readFileSync("./email/send-email-verification-link.html","utf8").replace(/{{host}}/,s||"").replace(/{{token}}/,n||"")}))returnr.json({success:!1});r.json({success:!0})}}letf=(0,o.M)(n,"default"),p=(0,o.M)(n,"config"),E=news.PagesAPIRouteModule({definition:{kind:i.A.PAGES_API,page:"/api/sendEmailVerificationLink",pathname:"/api/sendEmailVerificationLink",bundlePath:"",filename:""},userland:n})},69842:(e,r,t)=>{t.d(r,{A:()=>c});varn=t(48786),s=t(95969),i=t(29021),o=t.n(i),a=t(89159);asyncfunctionc(e,r,t){try{let{keyCookieName:i,csrfCookieName:c}=(0,a.A)();if(!e.cookies?.[i]?.match(/./))throwError("Request Cookies not Found!");letl=(0,s.A)({encryptedString:e.cookies[i]});if(!l)throwError("Couldn't decrypt auth cookie!");letu=JSON.parse(l);if(!u.csrf_k)throwError("No `csrf_k` present in user Object!");if(t&&!Object.keys(e.headers).find(e=>e.includes(u.csrf_k)))throwError("Deep Auth Failed. `csrf` key not found in request headers!");letd=process.env.DSQL_USER_LOGIN_KEYS_PATH;if(!d)throwError("DSQL_USER_LOGIN_KEYS_PATH env variable not found. Please set this variable.");if(t&&!o().existsSync(`${d}/${u.csrf_k}`))throwError("Key not found in Auth Keys Folder!");if(0==u.verification_status&&!t){lete=await(0,n.A)(`SELECT verification_status FROM users WHERE id='${u.id}'`);e&&e[0]&&1==e[0].verification_status&&r.setHeader("Set-Cookie",["user_refresh=1"])}if(u?.date&&Date.now()-u.date>6048e5)throwError("Key expired!");returnu}catch(r){returnconsole.log(`userAuth Error for ${e.url}: ${r.message}`),null}}},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;leta=r;e?.userId&&(a+=`user_${e.userId}_`),i&&(a+=`${i}_`),a+=n;letc=r;returne?.userId&&(c+=`user_${e.userId}_`),i&&(c+=`${i}_`),{keyCookieName:o,csrfCookieName:a,oneTimeCodeName:c+=s}}},96052:(e,r,t)=>{t.d(r,{A:()=>a});varn=t(29021),s=t.n(n),i=t(21572);leto=t.n(i)().createTransport({host:process.env.DSQL_MAIL_HOST,port:465,secure:!0,auth:{user:process.env.DSQL_MAIL_EMAIL,pass:process.env.DSQL_MAIL_PASSWORD}});asyncfunctiona({to:e,subject:r,text:t,html:n,alias:i,senderName:a}){letc;if(!process.env.DSQL_MAIL_HOST||!process.env.DSQL_MAIL_EMAIL||!process.env.DSQL_MAIL_PASSWORD)returnnull;letl=(i?.match(/support/i),process.env.DSQL_MAIL_EMAIL);if(!s().existsSync("./email/index.html"))return;letu=s().readFileSync("./email/index.html","utf8").replace(/{{email_body}}/,n||"").replace(/{{issue_date}}/,Date().substring(0,24));try{letn={};n.from=`"${a||"Datasquirel"}" <${l}>`,n.sender=l,i&&(n.replyTo=l),n.to=e,n.subject=r,n.text=t,n.html=u,c=awaito.sendMail(n)}catch(e){console.log("ERROR in handleNodemailer Function =>",e.message)}returnc}},95