"use strict";(()=>{vare={};e.id=8925,e.ids=[8925],e.modules={75600:e=>{e.exports=require("next/dist/compiled/next-server/pages-api.runtime.prod.js")},72583:e=>{e.exports=require("sanitize-html")},9973:e=>{e.exports=require("serverless-mysql")},9288:e=>{e.exports=require("sharp")},79428:e=>{e.exports=require("buffer")},79646:e=>{e.exports=require("child_process")},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}}})},58240:(e,r,t)=>{t.r(r),t.d(r,{config:()=>A,default:()=>E,routeModule:()=>N});varn={};t.r(n),t.d(n,{default:()=>y});vars=t(89947),i=t(2706),a=t(96762),o=t(48786);letl=require("node-fetch");varc=t.n(l),u=t(9288),d=t.n(u),p=t(67619);asyncfunctionf({imageSourceUrl:e,imageWritePath:r,maxSize:t,sourceType:n}){try{asyncfunctions(){letr;if(n?.match("url")){if(e.match(/^http/i)){lett=awaitc()(e,{});r=awaitt.buffer()}elser=`./public${e}`}elsen?.match("base64")&&(r=Buffer.from(e,"base64"));returnr}leti=awaits(),a=t||650,o=d()(i),{width:l,height:u,format:p}=awaito.metadata();if(l&&u&&l>a){lete=a/l;o.resize(a,Math.round(u*e),{fit:"cover"})}p&&o.toFormat(p,{quality:80}),awaito.toFile(r)}catch(e){(0,p.A)({component:"functions/backend/fsWriteImageToDisk",message:e.message})}}var_=t(69842),g=t(33873),m=t.n(g),S=t(79646),h=t(30802);asyncfunctiony(e,r){if("POST"!==e.method)returnr.json({user:null,msg:"Registration Failed!"});lett=await(0,_.A)(e,r,!0);if(!t)returnr.json({success:!1,msg:"Unauthorized"});let{first_name:n,last_name:s,image:i}=e.body;try{lete=(await(0,o.A)(`SELECT image FROM users WHERE id='${t.id}'`))[0].image===i,a=process.env.DSQL_STATIC_SERVER_DIR;if(!a)throwconsole.log("Static File ENV not Found!"),Error("No Static Path!");letl=m().join(a,`images/user-images/user-${t.id}/user-${t.id}-profile.jpg`),c=m().join(a,`images/user-images/user-${t.id}/user-${t.id}-profile-thumbnail.jpg`);e||(awaitf({imageSourceUrl:"string"==typeofi?i:i.imageBase64,imageWritePath:l,sourceType:"string"==typeofi?"url":"base64"}),awaitf({imageSourceUrl:"string"==typeofi?i:i.imageBase64,imageWritePath:c,maxSize:250,sourceType:"string"==typeofi?"url":"base64"}),(0,S.execSync)(`chmod 644 ${l}${c}`));letu=l.replace(a,process.env.DSQL_STATIC_HOST||""),d=c.replace(a,process.env.DSQL_STATIC_HOST||"");await(0,h.A)({dbFullName:"datasquirel",tableName:"users",identifierColumnName:"id",identifierValue:t.id,data:{first_name:n,last_name:s,image:u,image_thumbnail:d}}),await(0,h.A)({dbFullName:"datasquirel",tableName:"user_users",identifierColumnName:"invited_user_id",identifierValue:t.id,data:{first_name:n,last_name:s,image:u,image_thumbnail:d}}),r.json({user:!0})}catch(e){(0,p.A)({component:"/api/updateUser/main-catch-error",message:e.message,user:t}),r.json({user:null})}}letE=(0,a.M)(n,"default"),A=(0,a.M)(n,"config"),N=news.PagesAPIRouteModule({definition:{kind:i.A.PAGES_API,page:"/api/updateUser",pathname:"/api/updateUser",bundlePath:"",filename:""},userland:n})},69842:(e,r,t)=>{t.d(r,{A:()=>l});varn=t(48786),s=t(95969),i=t(29021),a=t.n(i),o=t(89159);asyncfunctionl(e,r,t){try{let{keyCookieName:i,csrfCookieName:l}=(0,o.A)();if(!e.cookies?.[i]?.match(/./))throwError("Request Cookies not Found!");letc=(0,s.A)({encryptedString:e.cookies[i]});if(!c)throwError("Couldn't decrypt auth cookie!");letu=JSON.parse(c);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&&!a().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=