"use strict";(()=>{var e={};e.id=8272,e.ids=[8272],e.modules={53524:e=>{e.exports=require("@prisma/client")},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")},92048:e=>{e.exports=require("fs")},55315:e=>{e.exports=require("path")},38146:(e,r,a)=>{a.r(r),a.d(r,{originalPathname:()=>g,patchFetch:()=>w,requestAsyncStorage:()=>v,routeModule:()=>m,serverHooks:()=>x,staticGenerationAsyncStorage:()=>f});var t={};a.r(t),a.d(t,{POST:()=>c});var s=a(49303),o=a(88716),i=a(60670),u=a(87070),n=a(72331);let p=require("fs/promises");var d=a(55315),l=a.n(d);async function c(e){try{let r=await e.formData(),t=r.get("file"),s=r.get("userId");if(!t||!s)return u.NextResponse.json({error:"File and userId required"},{status:400});let o=Buffer.from(await t.arrayBuffer()),i=`avatar-${s}-${Date.now()}${l().extname(t.name)}`,d=l().join(process.cwd(),"public","uploads"),c=a(92048);c.existsSync(d)||c.mkdirSync(d,{recursive:!0});let m=l().join(d,i);await (0,p.writeFile)(m,o);let v=`/uploads/${i}`,f=await n._.user.update({where:{id:s},data:{image:v}});return u.NextResponse.json({success:!0,user:f})}catch(e){return console.error("Upload error:",e),u.NextResponse.json({error:e.message||"Upload failed"},{status:500})}}let m=new s.AppRouteRouteModule({definition:{kind:o.x.APP_ROUTE,page:"/api/user/avatar/route",pathname:"/api/user/avatar",filename:"route",bundlePath:"app/api/user/avatar/route"},resolvedPagePath:"C:\\Users\\MSI\\Downloads\\film\\app\\api\\user\\avatar\\route.ts",nextConfigOutput:"standalone",userland:t}),{requestAsyncStorage:v,staticGenerationAsyncStorage:f,serverHooks:x}=m,g="/api/user/avatar/route";function w(){return(0,i.patchFetch)({serverHooks:x,staticGenerationAsyncStorage:f})}},72331:(e,r,a)=>{a.d(r,{_:()=>s});var t=a(53524);let s=global.prisma||new t.PrismaClient}};var r=require("../../../../webpack-runtime.js");r.C(e);var a=e=>r(r.s=e),t=r.X(0,[8948,5972],()=>a(38146));module.exports=t})();