"use strict";(()=>{var e={};e.id=965,e.ids=[965],e.modules={72934:e=>{e.exports=require("next/dist/client/components/action-async-storage.external.js")},54580:e=>{e.exports=require("next/dist/client/components/request-async-storage.external.js")},45869:e=>{e.exports=require("next/dist/client/components/static-generation-async-storage.external.js")},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")},6005:e=>{e.exports=require("node:crypto")},96127:(e,t,n)=>{n.r(t),n.d(t,{originalPathname:()=>g,patchFetch:()=>x,requestAsyncStorage:()=>y,routeModule:()=>l,serverHooks:()=>h,staticGenerationAsyncStorage:()=>m});var s={};n.r(s),n.d(s,{POST:()=>p});var a=n(49303),o=n(88716),r=n(60670),i=n(87070),u=n(78632),c=n(19191),d=n(70446);async function p(e){let{username:t,password:n}=await e.json();if(!t||!n)return i.NextResponse.json({error:"Username and password are required"},{status:400});try{let s=await (0,c.q)("/authenticationuser/v2/authentication",{apiBase:"sysadmin",method:"POST",body:{username:t,password:n,userType:0},cache:"no-store"});if(200!==s.statusMessage.status)return i.NextResponse.json({error:"Invalid credentials"},{status:403});let{user:a,token:o}=s.data,r=i.NextResponse.json({success:!0}),p=await (0,u.iW)(e,r,d.l7);return p.authenticated=!0,p.user=a,p.token=o,p.userType=a.type,p.username=t,p.password=n,await p.save(),r}catch{return i.NextResponse.json({error:"Login failed"},{status:500})}}let l=new a.AppRouteRouteModule({definition:{kind:o.x.APP_ROUTE,page:"/api/auth/sysadmin-login/route",pathname:"/api/auth/sysadmin-login",filename:"route",bundlePath:"app/api/auth/sysadmin-login/route"},resolvedPagePath:"/Users/ferlando/Desktop/baboon-nextjs/app/api/auth/sysadmin-login/route.ts",nextConfigOutput:"standalone",userland:s}),{requestAsyncStorage:y,staticGenerationAsyncStorage:m,serverHooks:h}=l,g="/api/auth/sysadmin-login/route";function x(){return(0,r.patchFetch)({serverHooks:h,staticGenerationAsyncStorage:m})}},19191:(e,t,n)=>{n.d(t,{F:()=>r,q:()=>o});var s=n(47090),a=n(70446);async function o(e,t={}){let{apiBase:n="mobile",method:o="GET",body:r,token:i,langCode:u,notificationToken:c,headers:d={},revalidate:p,cache:l}=t,y=s.Y8[n],m=`${y}${e.startsWith("/")?e:"/"+e}`,h={"Content-Type":"application/json","User-Agent":"BaboonWeb",...d};i&&(h.Authorization=i),u&&(h.langCode=u);let g=c;if(!g)try{g=(await (0,a.Gg)()).fcmToken}catch{}g&&(h.notificationToken=g);let x={method:o,headers:h};r&&"GET"!==o&&(x.body=JSON.stringify(r)),void 0!==p&&(x.next={revalidate:p}),l&&(x.cache=l);let f=await fetch(m,x);if(!f.ok)throw Error(`API request failed: ${f.status} ${f.statusText}`);return f.json()}async function r(e,t={}){let{apiBase:n="mobile",method:o="GET",body:r,token:i,langCode:u,notificationToken:c,headers:d={}}=t,p=s.Y8[n],l=`${p}${e.startsWith("/")?e:"/"+e}`,y={"Content-Type":"application/json","User-Agent":"BaboonWeb",...d};i&&(y.Authorization=i),u&&(y.langCode=u);let m=c;if(!m)try{m=(await (0,a.Gg)()).fcmToken}catch{}m&&(y.notificationToken=m);let h={method:o,headers:y};return r&&"GET"!==o&&(h.body=JSON.stringify(r)),fetch(l,h)}},47090:(e,t,n)=>{n.d(t,{RF:()=>s,Y8:()=>o,pH:()=>a});let s=["al","en","it"],a={AL:{latitude:41.327546,longitude:19.818698,cityId:1,countryId:1},XK:{latitude:42.662914,longitude:21.165503,cityId:2,countryId:2}},o={mobile:process.env.BABOON_API_MOBILE_URL,legacy:process.env.BABOON_API_URL,sysadmin:process.env.BABOON_API_SYSADMIN_URL,payment:process.env.BABOON_API_PAYMENT_URL}},70446:(e,t,n)=>{n.d(t,{Gg:()=>i,dx:()=>o,l7:()=>r,yK:()=>u});var s=n(78632),a=n(71615);let o={password:process.env.SESSION_SECRET,cookieName:"baboon-session",cookieOptions:{secure:!0,httpOnly:!0,sameSite:"lax",maxAge:604800}},r={...o,cookieName:"baboon-admin-session"};async function i(){let e=await (0,a.cookies)();return(0,s.iW)(e,o)}async function u(){let e=await (0,a.cookies)();return(0,s.iW)(e,r)}}};var t=require("../../../../webpack-runtime.js");t.C(e);var n=e=>t(t.s=e),s=t.X(0,[8948,3314,8632,5972],()=>n(96127));module.exports=s})();