"use strict";(()=>{var e={};e.id=6617,e.ids=[6617],e.modules={20399:e=>{e.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},30517:e=>{e.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},39491:e=>{e.exports=require("assert")},14300:e=>{e.exports=require("buffer")},32081:e=>{e.exports=require("child_process")},6113:e=>{e.exports=require("crypto")},82361:e=>{e.exports=require("events")},57147:e=>{e.exports=require("fs")},13685:e=>{e.exports=require("http")},85158:e=>{e.exports=require("http2")},95687:e=>{e.exports=require("https")},41808:e=>{e.exports=require("net")},15673:e=>{e.exports=require("node:events")},97742:e=>{e.exports=require("node:process")},47261:e=>{e.exports=require("node:util")},22037:e=>{e.exports=require("os")},71017:e=>{e.exports=require("path")},77282:e=>{e.exports=require("process")},85477:e=>{e.exports=require("punycode")},63477:e=>{e.exports=require("querystring")},12781:e=>{e.exports=require("stream")},24404:e=>{e.exports=require("tls")},76224:e=>{e.exports=require("tty")},57310:e=>{e.exports=require("url")},73837:e=>{e.exports=require("util")},59796:e=>{e.exports=require("zlib")},52775:(e,r,t)=>{t.r(r),t.d(r,{originalPathname:()=>g,patchFetch:()=>h,requestAsyncStorage:()=>x,routeModule:()=>f,serverHooks:()=>y,staticGenerationAsyncStorage:()=>q});var s={};t.r(s),t.d(s,{POST:()=>m,runtime:()=>c});var a=t(49303),i=t(88716),o=t(60670),n=t(97816),p=t(12781),u=t(71017),l=t.n(u),d=t(57147);let c="nodejs";async function m(e){try{let r,t;let s=await e.json();s.created_at=new Date().toISOString();let a=l().join(process.cwd(),"json-service.json"),i=await d.promises.readFile(a,"utf-8"),o=JSON.parse(i),u=new n.lkr.auth.GoogleAuth({credentials:{client_email:o.client_email,private_key:o.private_key},scopes:["https://www.googleapis.com/auth/drive"]}),c=n.lkr.drive({version:"v3",auth:u}),m="users",f="user_data.json",x=await c.files.list({q:`name='${m}' and mimeType='application/vnd.google-apps.folder' and trashed=false`,fields:"files(id, name)"});r=x.data.files.length>0?x.data.files[0].id:(await c.files.create({requestBody:{name:m,mimeType:"application/vnd.google-apps.folder"}})).data.id;let q=await c.files.list({q:`'${r}' in parents and name='${f}' and trashed=false`,fields:"files(id, name)"}),y=[];if(q.data.files.length>0){t=q.data.files[0].id;let e=await c.files.get({fileId:t,alt:"media"},{responseType:"stream"}),r="";await new Promise((t,s)=>{e.data.on("data",e=>r+=e).on("end",t).on("error",s)});try{y=JSON.parse(r),Array.isArray(y)||(y=[])}catch{y=[]}let a=y.findIndex(e=>e.email===s.email);if(-1!==a){let e=y[a];if(JSON.stringify(e)===JSON.stringify(s))return new Response(JSON.stringify({message:"Data already saved"}),{status:200});y[a]={...e,...s,updated_at:new Date().toISOString()}}else y.push(s)}else y=[s];let g=JSON.stringify(y,null,2),h=new p.Readable;return h.push(g),h.push(null),t?await c.files.update({fileId:t,media:{mimeType:"application/json",body:h}}):await c.files.create({requestBody:{name:f,mimeType:"application/json",parents:[r]},media:{mimeType:"application/json",body:h}}),new Response(JSON.stringify({message:"Data saved/updated successfully"}),{status:200})}catch(e){return new Response(JSON.stringify({error:"F_T_U",details:e.message}),{status:500})}}let f=new a.AppRouteRouteModule({definition:{kind:i.x.APP_ROUTE,page:"/api/s_user/route",pathname:"/api/s_user",filename:"route",bundlePath:"app/api/s_user/route"},resolvedPagePath:"C:\\Users\\Design Collection\\OneDrive\\Desktop\\Jitendra Vishwakarma\\Next Dashboard\\web crawler for user dev\\Scrape Genius\\app\\api\\s_user\\route.js",nextConfigOutput:"",userland:s}),{requestAsyncStorage:x,staticGenerationAsyncStorage:q,serverHooks:y}=f,g="/api/s_user/route";function h(){return(0,o.patchFetch)({serverHooks:y,staticGenerationAsyncStorage:q})}},49303:(e,r,t)=>{e.exports=t(30517)}};var r=require("../../../webpack-runtime.js");r.C(e);var t=e=>r(r.s=e),s=r.X(0,[8948,6577,820,7816],()=>t(52775));module.exports=s})();