"use strict";(()=>{var e={};e.id=2655,e.ids=[2655],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,t)=>{Object.defineProperty(t,"M",{enumerable:!0,get:function(){return function e(t,r){return r in t?t[r]:"then"in t&&"function"==typeof t.then?t.then(t=>e(t,r)):"function"==typeof t&&"default"===r?t:void 0}}})},67136:(e,t,r)=>{r.r(t),r.d(t,{config:()=>f,default:()=>m,routeModule:()=>A});var s={};r.r(s),r.d(s,{default:()=>d});var n=r(89947),o=r(2706),i=r(96762),a=r(91766),l=r.n(a);let c=r(29021),u=r(59474),p=r(20503);async function d(e,t){if("GET"===e.method){let r=p({data:JSON.stringify({email:e.query.email,dateCode:Date.now()})}),s=process.env.DSQL_HOST,n=e.query.email;if(!String(n).match(/.*@.*\..*/))return t.json({user:null,msg:"Invalid Email"});let o=e.headers["x-real-ip"]||e.headers["x-forwarded-for"]||e.connection.remoteAddress,i=process.env.DSQL_HOST||"https://datasquirel.com",a=await u({to:e.query.email?.toString()||process.env.DSQL_CONTACT_EMAIL,subject:"Reset Your Password",text:"Please click the link to reset your password",html:c.readFileSync("./email/send-password-reset-link.html","utf8").replace(/{{host}}/,s||"").replace(/{{ip}}/,String(o)).replace(/{{token}}/,r||""),alias:"Support"});if(await l()(),u({to:process.env.DSQL_CONTACT_EMAIL,subject:`Password Reset Attempt for ${n}`,html:`<h1><u>${n}</u> tried to reset password</h1><p><b>${n}</b> attempted a password reset on ${i} from ${o} with a wrong password.</p>`}),!a)return t.json({success:!1});t.json({success:!0})}}let m=(0,i.M)(s,"default"),f=(0,i.M)(s,"config"),A=new n.PagesAPIRouteModule({definition:{kind:o.A.PAGES_API,page:"/api/sendPasswordResetLink",pathname:"/api/sendPasswordResetLink",bundlePath:"",filename:""},userland:s})},91766:e=>{e.exports=async function(e){return await new Promise((t,r)=>{setTimeout(()=>{t(!0)},e||1e3)}),!0}},59474:(e,t,r)=>{let s=r(29021),n=r(21572).createTransport({host:process.env.DSQL_MAIL_HOST,port:465,secure:!0,auth:{user:process.env.DSQL_MAIL_EMAIL,pass:process.env.DSQL_MAIL_PASSWORD}});e.exports=async function({to:e,subject:t,text:r,html:o,alias:i}){let a;if(!process.env.DSQL_MAIL_HOST||!process.env.DSQL_MAIL_EMAIL||!process.env.DSQL_MAIL_PASSWORD)return null;let l=(i?.match(/support/i),process.env.DSQL_MAIL_EMAIL);if(!s.existsSync("./email/index.html"))return;let c=s.readFileSync("./email/index.html","utf8").replace(/{{email_body}}/,o||"").replace(/{{issue_date}}/,Date().substring(0,24));try{let s={};s.from=`"Datasquirel" <${l}>`,s.sender=l,i&&(s["replyTo "]=l),s.to=e,s.subject=t,s.text=r,s.html=c,a=await n.sendMail(s)}catch(e){console.log("ERROR in handleNodemailer Function =>",e.message)}return a}},20503:(e,t,r)=>{let{scryptSync:s,createCipheriv:n}=r(55511),{Buffer:o}=r(79428);e.exports=({data:e,encryptionKey:t,encryptionSalt:r})=>{if(!e?.match(/./))return console.log("Encryption string is invalid"),e;let i=t||process.env.DSQL_ENCRYPTION_PASSWORD,a=r||process.env.DSQL_ENCRYPTION_SALT,l=process.env.DSQL_ENCRYPTION_KEY_LENGTH?Number(process.env.DSQL_ENCRYPTION_KEY_LENGTH):24;if(!i?.match(/.{8,}/))return console.log("Encryption key is invalid"),e;if(!a?.match(/.{8,}/))return console.log("Encryption salt is invalid"),e;let c=n("aes-192-cbc",s(i,a,l),o.alloc(16,0));try{let t=c.update(e,"utf8","hex");return t+=c.final("hex")}catch(t){return console.log("Error in encrypting =>",t.message),e}}},2706:(e,t)=>{var r;Object.defineProperty(t,"A",{enumerable:!0,get:function(){return r}}),function(e){e.PAGES="PAGES",e.PAGES_API="PAGES_API",e.APP_PAGE="APP_PAGE",e.APP_ROUTE="APP_ROUTE",e.IMAGE="IMAGE"}(r||(r={}))},89947:(e,t,r)=>{e.exports=r(75600)}};var t=require("../../webpack-api-runtime.js");t.C(e);var r=t(t.s=67136);module.exports=r})();