(()=>{var e={};e.id=2502,e.ids=[2502],e.modules={3295:e=>{"use strict";e.exports=require("next/dist/server/app-render/after-task-async-storage.external.js")},5486:e=>{"use strict";e.exports=require("bcrypt")},10846:e=>{"use strict";e.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},12909:(e,r,t)=>{"use strict";function s(){let e=process.env.JWT_SECRET;if(!e)throw Error("JWT_SECRET is not set");return e}function i(e){let r=e.headers.get("authorization");if(r&&r.startsWith("Bearer "))return r.slice(7);let t=e.cookies.get("admin_token")?.value;if(t)return t;let s=e.cookies.get("token")?.value;return s||null}t.d(r,{V:()=>i,u:()=>s})},27910:e=>{"use strict";e.exports=require("stream")},28354:e=>{"use strict";e.exports=require("util")},29294:e=>{"use strict";e.exports=require("next/dist/server/app-render/work-async-storage.external.js")},44870:e=>{"use strict";e.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},50542:(e,r,t)=>{"use strict";t.r(r),t.d(r,{patchFetch:()=>w,routeModule:()=>f,serverHooks:()=>q,workAsyncStorage:()=>v,workUnitAsyncStorage:()=>k});var s={};t.r(s),t.d(s,{POST:()=>h});var i=t(96559),n=t(48088),a=t(37719),o=t(32190),u=t(43205),p=t.n(u),l=t(5486),d=t.n(l),c=t(96330),m=t(12909);let x=new c.PrismaClient,g=(0,m.u)();async function h(e){try{let{email:r,password:t}=await e.json();if(!r||!t)return o.NextResponse.json({error:"Email ve şifre gereklidir"},{status:400});let s=await x.globalAdmin.findUnique({where:{email:r}});if(!s||!await d().compare(t,s.password))return o.NextResponse.json({error:"Ge\xe7ersiz email veya şifre"},{status:401});let i=p().sign({globalAdminId:s.id,email:s.email,isGlobalAdmin:!0},g,{expiresIn:"7d"}),n={access_token:i,user:{id:s.id,email:s.email,name:s.name,surname:s.surname,isSuperAdmin:s.isSuperAdmin,isGlobalAdmin:!0}},a=o.NextResponse.json(n);return a.cookies.set("admin_token",i,{httpOnly:!0,sameSite:"lax",path:"/",secure:!0,maxAge:604800}),a}catch(e){return console.error("Global admin login error:",e),o.NextResponse.json({error:"Sunucu hatası"},{status:500})}}let f=new i.AppRouteRouteModule({definition:{kind:n.RouteKind.APP_ROUTE,page:"/api/admin/auth/login/route",pathname:"/api/admin/auth/login",filename:"route",bundlePath:"app/api/admin/auth/login/route"},resolvedPagePath:"/Users/mustafaseyhan/Project/PazarAnalist/src/app/api/admin/auth/login/route.ts",nextConfigOutput:"standalone",userland:s}),{workAsyncStorage:v,workUnitAsyncStorage:k,serverHooks:q}=f;function w(){return(0,a.patchFetch)({workAsyncStorage:v,workUnitAsyncStorage:k})}},55511:e=>{"use strict";e.exports=require("crypto")},63033:e=>{"use strict";e.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},78335:()=>{},79428:e=>{"use strict";e.exports=require("buffer")},96330:e=>{"use strict";e.exports=require("@prisma/client")},96487:()=>{}};var r=require("../../../../../webpack-runtime.js");r.C(e);var t=e=>r(r.s=e),s=r.X(0,[4447,580,3205],()=>t(50542));module.exports=s})();