"use strict";(()=>{vare={};e.id=8105,e.ids=[8105],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")},81630:e=>{e.exports=require("http")},33873:e=>{e.exports=require("path")},96762:(e,r)=>{Object.defineProperty(r,"M",{enumerable:!0,get:function(){returnfunctione(r,s){returnsinr?r[s]:"then"inr&&"function"==typeofr.then?r.then(r=>e(r,s)):"function"==typeofr&&"default"===s?r:void0}}})},71405:(e,r,s)=>{s.r(r),s.d(r,{config:()=>v,default:()=>g,routeModule:()=>y});vart={};s.r(t),s.d(t,{default:()=>D});varn=s(89947),o=s(2706),a=s(96762),i=s(33873),c=s.n(i),l=s(48225),u=s.n(l),_=s(6420),d=s.n(_),S=s(48227),p=s.n(S),f=s(64122),E=s.n(f);letm=s(29021);asyncfunctionD(e,r){if("POST"!==e.method)returnr.json({msg:"Failed!"});lets=awaitd()(e,r,!0);if(!s)returnr.json({success:!1,msg:"Unauthorized"});lett=e.body,{media_name:n,media_url:o,media_thumbnail_url:a,media_path:i,media_thumbnail_path:l,folder:_}=t;"production".match(/production/);try{lete=t?.private==1;if(!process.env.DSQL_STATIC_SERVER_DIR)throwconsole.log("Static File ENV not Found!"),Error("No Static Path!");letn=p()({isPrivate:e,userId:s.id,folder:t.folder?t.folder+"/":"",video:!!t.media_type?.match(/video/i)});if(!n)throwError("Couldn't grab paths!");let{fileRootPath:i,urlRootPath:l,relativePath:u}=n;_?.match(/./);letd=o.match(/[^\/]+$/)[0],S=a.match(/[^\/]+$/)[0],f=c().normalize(i+d),D=c().normalize(i+S);m.unlinkSync(f);try{m.unlinkSync(D)}catch(e){}awaitE()({dbFullName:"datasquirel",tableName:"user_media",identifierColumnName:"id",identifierValue:t.id}),r.json({success:!0})}catch(e){console.log("ERROR in deleting user media =>",e.message),u()({component:"/api/deleteUserMedia/main-catch-error",message:e.message,user:s}),r.json({success:!1,msg:"Database Files could not be written!"})}}letg=(0,a.M)(t,"default"),v=(0,a.M)(t,"config"),y=newn.PagesAPIRouteModule({definition:{kind:o.A.PAGES_API,page:"/api/deleteUserMedia",pathname:"/api/deleteUserMedia",bundlePath:"",filename:""},userland:t})},48227:(e,r,s)=>{lett=s(29021),n=s(33873);e.exports=function({isPrivate:e,userId:r,folder:s,video:o,pathOnly:a}){"production".match(/production/);leti=process.env.DSQL_STATIC_SERVER_DIR;if(!i)returnconsole.log("Static File ENV not Found!"),null;letc=e?`@/${o?"videos":"media"}/${s?s+"/":""}`:o?`/videos/user-videos/user-${r}/${s?s+"/":""}`:`/images/user-images/user-${r}/${s?s+"/":""}`,l=e?`${process.env.DSQL_USER_DB_SCHEMA_PATH}/user-${r}/media/${s?s+"/":""}`:n.join(i,c);returnt.existsSync(l)||a||t.mkdirSync(l,{recursive:!0}),{fileRootPath:l,urlRootPath:e?`@/media/${s?s+"/":""}`:`${process.env.DSQL_STATIC_HOST}${c}`,relativePath:c}}},6420:(e,r,s)=>{s(81630);lett=s(51348),n=s(72835),o=s(29021),a=s(31341);asyncfunctioni(e,r,s,i){let{keyCookieName:c,csrfCookieName:l}=a();if(!e.cookies?.[c]?.match(/./))returnnull;letu=n({encryptedString:e.cookies[c]});if(!u)returnnull;let_=JSON.parse(u);if(!_.csrf_k||s&&!e.headers["x-csrf-auth"]?.match(RegExp(`${_.csrf_k}`)))returnnull;letd=process.env.DSQL_USER_LOGIN_KEYS_PATH;if(!d)returnconsole.log("DSQL_USER_LOGIN_KEYS_PATH env variable not found. Please set this variable."),null;if(s&&!o.existsSync(`${d}/${_.csrf_k}`))returnnull;if(0==_.verification_status&&!s){lete=awaitt(`SELECT verification_status FROM users WHERE id='${_.id}'`);e&&e[0]&&1==e[0].verification_status&&r.setHeader("Set-Cookie",["user_refresh=1"])}return_?.date&&Date.now()-_.date>6048e5?null:_}e.exports=i},31341:e=>{e.exports=function(e){letr=process.env.DSQL_COOKIES_PREFIX||"dsql_",s=process.env.DSQL_COOKIES_KEY_NAME||"key",t=process.env.DSQL_COOKIES_CSRF_NAME||"csrf",n=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+_/,""),a=r;e?.userId&&(a+=`user_${e.userId}_`),o&&(a+=`${o}_`),a+=s;leti=r;e?.userId&&(i+=`user_${e.us