"use strict";(()=>{var e={};e.id=9664,e.ids=[9664],e.modules={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")},96762:(e,r)=>{Object.defineProperty(r,"M",{enumerable:!0,get:function(){return function e(r,s){return s in r?r[s]:"then"in r&&"function"==typeof r.then?r.then(r=>e(r,s)):"function"==typeof r&&"default"===s?r:void 0}}})},75461:(e,r,s)=>{s.r(r),s.d(r,{config:()=>d,default:()=>p,routeModule:()=>S});var o={};s.r(o),s.d(o,{default:()=>l});var n=s(89947),t=s(2706),a=s(96762),_=s(48786),c=s(87369),i=s(29021),u=s.n(i);async function l(e,r){if("POST"!==e.method)return r.json({success:!1,msg:"Wrong Method"});let s=await (0,c.A)(e);if(!s?.logged_in_status)return r.json({success:!1,log:"No Logs"});let o=e.body.user,n=o?.id.toString().replace(/[^0-9]/g,"").replace(/\//g,""),t=`${process.env.DSQL_USER_DB_SCHEMA_PATH}/user-${n}`,a=[];!function e({originArray:r,rootPath:s}){let o=u().readdirSync(s);for(let n=0;nObject.values(e)[0])})}let p=(0,a.M)(o,"default"),d=(0,a.M)(o,"config"),S=new n.PagesAPIRouteModule({definition:{kind:t.A.PAGES_API,page:"/api/admin/getUserData",pathname:"/api/admin/getUserData",bundlePath:"",filename:""},userland:o})},87369:(e,r,s)=>{s.d(r,{A:()=>t});var o=s(95969),n=s(89159);async function t(e){let{keyCookieName:r,csrfCookieName:s}=(0,n.A)(),t=`${r}_su`;if(!e.cookies?.[t])return console.log("No auth key cookie found"),null;let a=(0,o.A)({encryptedString:e.cookies[t]});if(!a)return console.log("No user payload found"),null;let _=JSON.parse(a);return _.password!==process.env.DSQL_USER_KEY?(console.log("Invalid password"),null):_.authKey!==process.env.DSQL_SPECIAL_KEY?(console.log("Invalid auth key"),null):_}},89159:(e,r,s)=>{s.d(r,{A:()=>o});function o(e){let r=process.env.DSQL_COOKIES_PREFIX||"dsql_",s=process.env.DSQL_COOKIES_KEY_NAME||"key",o=process.env.DSQL_COOKIES_CSRF_NAME||"csrf",n=process.env.DSQL_COOKIES_ONE_TIME_CODE_NAME||"one-time-code",t=e?.database?.replace(/^datasquirel_user_\d+_/,"")||process.env.DSQL_DB_NAME?.replace(/^datasquirel_user_\d+_/,""),a=r;e?.userId&&(a+=`user_${e.userId}_`),t&&(a+=`${t}_`),a+=s;let _=r;e?.userId&&(_+=`user_${e.userId}_`),t&&(_+=`${t}_`),_+=o;let c=r;return e?.userId&&(c+=`user_${e.userId}_`),t&&(c+=`${t}_`),{keyCookieName:a,csrfCookieName:_,oneTimeCodeName:c+=n}}},95969:(e,r,s)=>{s.d(r,{A:()=>a});var o=s(55511),n=s(79428),t=s(32443);function a({encryptedString:e,encryptionKey:r,encryptionSalt:s}){if(!e?.match(/./))return console.log("Encrypted string is invalid"),e;let{key:a,salt:_,keyLen:c,algorithm:i,bufferAllocSize:u}=(0,t.A)({encryptionKey:r});if(!a?.match(/.{8,}/))return console.log("Decrption key is invalid"),e;if(!_?.match(/.{8,}/))return console.log("Decrption salt is invalid"),e;let l=(0,o.scryptSync)(a,_,c),p=n.Buffer.alloc(u,0),d=(0,o.createDecipheriv)(i,l,p);try{let r=d.update(e,"hex","utf8");return r+=d.final("utf8")}catch(r){return console.log("Error in decrypting =>",r.message),e}}},48786:(e,r,s)=>{s.d(r,{A:()=>n});var o=s(7447);async function n(...e){let r=(0,o.A)();try{if(!r)throw Error("No Connection provided to DB_HANDLER function!");let s=await r.query(...e);return JSON.parse(JSON.stringify(s))}catch(e){return console.log("DB Error =>",e),{success:!1,error:e.message}}finally{await r?.end()}}},7447:(e,r,s)=>{s.d(r,{A:()=>t});var o=s(9973),n=s.n(o);function t(e){return e?.ro?DSQL_READ_ONLY_DB_CONN||n()({config:{host:process.env.DSQL_DB_HOST,user:process.env.DSQL_DB_READ_ONLY_USERNAME,password:process.env.DSQL_DB_READ_ONLY_PASSWORD,port:process.env.DSQL_DB_PORT?Number(process.env.DSQL_DB_PORT):void 0,charset:"utf8mb4"}}):e?.fa?global.DSQL_FULL_ACCESS_DB_CONN||n()({config:{host:process.env.DSQL_DB_HOST,user:process.env.DSQL_DB_FULL_ACCESS_USERNAME,password:process.env.DSQL_DB_FULL_ACCESS_PASSWORD,port:process.env.DSQL_DB_PORT?Number(process.env.DSQL_DB_PORT):void 0,charset:"utf8mb4"}}):global.DSQL_DB_CONN||n()({config:{host:process.env.DSQL_DB_HOST,user:process.env.DSQL_DB_USERNAME,password:process.env.DSQL_DB_PASSWORD,database:e?.noDb?void 0:process.env.DSQL_DB_NAME,port:process.env.DSQL_DB_PORT?Number(process.env.DSQL_DB_PORT):void 0,charset:"utf8mb4"}})}},32443:(e,r,s)=>{s.d(r,{A:()=>o});function o(e){return{key:e?.encryptionKey||process.env.DSQL_ENCRYPTION_PASSWORD,keyLen:process.env.DSQL_ENCRYPTION_KEY_LENGTH?Number(process.env.DSQL_ENCRYPTION_KEY_LENGTH):24,salt:e?.encryptionSalt||process.env.DSQL_ENCRYPTION_SALT,apiKey:e?.apiKey||process.env.DSQL_API_KEY,algorithm:e?.algorithm||process.env.DSQL_ENCRYPTION_ALGORITHM||"aes-192-cbc",bufferAllocSize:e?.bufferAllocSize||(process.env.DSQL_ENCRYPTION_BUFFER_ALLOCATION_SIZE?function(e,r){try{let r=Number(e);if("number"!=typeof r||isNaN(r))return 0;return Math.round(r)}catch(e){return console.log(`Numberfy ERROR: ${e.message}`),0}}(process.env.DSQL_ENCRYPTION_BUFFER_ALLOCATION_SIZE):void 0)||16}}},2706:(e,r)=>{Object.defineProperty(r,"A",{enumerable:!0,get:function(){return s}});var s=function(e){return e.PAGES="PAGES",e.PAGES_API="PAGES_API",e.APP_PAGE="APP_PAGE",e.APP_ROUTE="APP_ROUTE",e.IMAGE="IMAGE",e}({})},89947:(e,r,s)=>{e.exports=s(75600)}};var r=require("../../../webpack-api-runtime.js");r.C(e);var s=r(r.s=75461);module.exports=s})();