"use strict";(()=>{vare={};e.id=3338,e.ids=[3338],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")},33873:e=>{e.exports=require("path")},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}}})},670:(e,r,t)=>{t.r(r),t.d(r,{config:()=>p,default:()=>E,routeModule:()=>S});varn={};t.r(n),t.d(n,{default:()=>f});vars=t(89947),o=t(2706),i=t(96762),a=t(29021),c=t.n(a),l=t(48786),u=t(69842),_=t(33873),d=t.n(_);asyncfunctionf(e,r){if("POST"!==e.method)returnr.json({msg:"Failed!"});if(!await(0,u.A)(e,r,!0))returnr.json({success:!1,msg:"Unauthorized"});let{paradigm:t,payload:n}=e.body;try{console.log("Deleting media =>",n.id);lete=n.media_url,t=process.env.DSQL_STATIC_SERVER_DIR,s=process.env.DSQL_STATIC_HOST;if(!t){console.log("No Static Root Path"),r.json({success:!1,msg:"No Static Root Path"});return}leto=e.replace(s,""),i=d().join(t,o),a=c().existsSync(i);if(console.log("relativePath",o),console.log("STATIC_ROOT",t),console.log("STATIC_HOST",s),console.log("filePath",i),console.log("fileExist",a),a){r.json({success:!1});return}}catch(e){console.log("File verification Error =>",e.message),console.log("File Truly doesn't exist, cotinuing ...")}"user_media"===t&&await(0,l.A)(`DELETE FROM user_media WHERE id='${n.id}'`),r.json({success:!0})}letE=(0,i.M)(n,"default"),p=(0,i.M)(n,"config"),S=news.PagesAPIRouteModule({definition:{kind:o.A.PAGES_API,page:"/api/purgeDb",pathname:"/api/purgeDb",bundlePath:"",filename:""},userland:n})},69842:(e,r,t)=>{t.d(r,{A:()=>c});varn=t(48786),s=t(95969),o=t(29021),i=t.n(o),a=t(89159);asyncfunctionc(e,r,t){let{keyCookieName:o,csrfCookieName:c}=(0,a.A)();if(!e.cookies?.[o]?.match(/./))returnnull;letl=(0,s.A)({encryptedString:e.cookies[o]});if(!l)returnnull;letu=JSON.parse(l);if(!u.csrf_k||t&&!Object.keys(e.headers).find(e=>e.includes(u.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&&!i().existsSync(`${_}/${u.csrf_k}`))returnnull;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"])}returnu?.date&&Date.now()-u.date>6048e5?null:u}},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",o=e?.database?.replace(/^datasquirel_user_\d+_/,"")||process.env.DSQL_DB_NAME?.replace(/^datasquirel_user_\d+_/,""),i=r;e?.userId&&(i+=`user_${e.userId}_`),o&&(i+=`${o}_`),i+=t;leta=r;e?.userId&&(a+=`user_${e.userId}_`),o&&(a+=`${o}_`),a+=n;letc=r;returne?.userId&&(c+=`user_${e.userId}_`),o&&(c+=`${o}_`),{keyCookieName:i,csrfCookieName:a,oneTimeCodeName:c+=s}}},95969:(e,r,t)=>{t.d(r,{A:()=>o});varn=t(55511),s=t(79428);functiono({encryptedString:e,encryptionKey:r,encryptionSalt:t}){if(!e?.match(/./))returnconsole.log("Encrypted string is invalid"),e;leto=r||process.env.DSQL_ENCRYPTION_PASSWORD,i=t||process.env.DSQL_ENCRYPTION_SALT,a=process.env.DSQL_ENCRYPTION_KEY_LENGTH?Number(process.env.DSQL_ENCRYPTION_KEY_LENGTH):24;if(!o?.match(/.{8,}/))returnconsole.log("Decrption key is invalid"),e;if(!i?.match(/.{8,}/))returnconsole.log("Decrption salt is invalid"),e;letc=(0,n.scryptSync)(o,i,a),l=s.Buffer.alloc(16,0),u=(0,n.createDecipheriv)("aes-192-cbc",c,l);try{letr=u.update(e,"hex","utf8");returnr+=u.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("NoConnectionprovidedtoDB_HANDLE