"use strict";(()=>{var e={};e.id=535,e.ids=[535],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")},60884:(e,t,s)=>{s.r(t),s.d(t,{originalPathname:()=>x,patchFetch:()=>f,requestAsyncStorage:()=>m,routeModule:()=>l,serverHooks:()=>y,staticGenerationAsyncStorage:()=>g});var a={};s.r(a),s.d(a,{PUT:()=>p});var n=s(49303),o=s(88716),r=s(60670),i=s(87070),c=s(19191),u=s(70446),d=s(90455);async function p(e,{params:t}){let{cartId:s}=await t,a=await (0,u.Gg)(),n=(0,d.LP)(a)||(0,d.I2)(),o=await e.json(),r=a.langCode||"al",{itemId:p,quantity:l,price:m}=o;if(!p||null==l)return i.NextResponse.json({success:!1,message:"itemId and quantity are required"},{status:400});try{let e=await (0,c.q)(`/carts/v1/${s}/items/${p}/quantity/${l}`,{apiBase:"mobile",method:"PUT",token:n,langCode:r,body:{menuItem:{id:p},itemPrice:m||0},cache:"no-store"});if(e.statusMessage?.status===200||e.statusMessage?.success)return i.NextResponse.json({success:!0,data:e.data});return i.NextResponse.json({success:!1,message:e.statusMessage?.message||"Failed to update cart"},{status:400})}catch(e){return console.error("[cart/update] ERROR:",e),i.NextResponse.json({success:!1,message:e.message||"Cart update failed"},{status:500})}}let l=new n.AppRouteRouteModule({definition:{kind:o.x.APP_ROUTE,page:"/api/cart/[cartId]/route",pathname:"/api/cart/[cartId]",filename:"route",bundlePath:"app/api/cart/[cartId]/route"},resolvedPagePath:"/Users/ferlando/Desktop/baboon-nextjs/app/api/cart/[cartId]/route.ts",nextConfigOutput:"standalone",userland:a}),{requestAsyncStorage:m,staticGenerationAsyncStorage:g,serverHooks:y}=l,x="/api/cart/[cartId]/route";function f(){return(0,r.patchFetch)({serverHooks:y,staticGenerationAsyncStorage:g})}},19191:(e,t,s)=>{s.d(t,{F:()=>r,q:()=>o});var a=s(47090),n=s(70446);async function o(e,t={}){let{apiBase:s="mobile",method:o="GET",body:r,token:i,langCode:c,notificationToken:u,headers:d={},revalidate:p,cache:l}=t,m=a.Y8[s],g=`${m}${e.startsWith("/")?e:"/"+e}`,y={"Content-Type":"application/json","User-Agent":"BaboonWeb",...d};i&&(y.Authorization=i),c&&(y.langCode=c);let x=u;if(!x)try{x=(await (0,n.Gg)()).fcmToken}catch{}x&&(y.notificationToken=x);let f={method:o,headers:y};r&&"GET"!==o&&(f.body=JSON.stringify(r)),void 0!==p&&(f.next={revalidate:p}),l&&(f.cache=l);let A=await fetch(g,f);if(!A.ok)throw Error(`API request failed: ${A.status} ${A.statusText}`);return A.json()}async function r(e,t={}){let{apiBase:s="mobile",method:o="GET",body:r,token:i,langCode:c,notificationToken:u,headers:d={}}=t,p=a.Y8[s],l=`${p}${e.startsWith("/")?e:"/"+e}`,m={"Content-Type":"application/json","User-Agent":"BaboonWeb",...d};i&&(m.Authorization=i),c&&(m.langCode=c);let g=u;if(!g)try{g=(await (0,n.Gg)()).fcmToken}catch{}g&&(m.notificationToken=g);let y={method:o,headers:m};return r&&"GET"!==o&&(y.body=JSON.stringify(r)),fetch(l,y)}},90455:(e,t,s)=>{function a(e){return e.token?e.token:e.user?.token?e.user.token:process.env.BABOON_APP_BUSINESS_TOKEN||""}function n(){return process.env.BABOON_APP_BUSINESS_TOKEN||""}s.d(t,{I2:()=>n,LP:()=>a})},47090:(e,t,s)=>{s.d(t,{RF:()=>a,Y8:()=>o,pH:()=>n});let a=["al","en","it"],n={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,s)=>{s.d(t,{Gg:()=>i,dx:()=>o,l7:()=>r,yK:()=>c});var a=s(78632),n=s(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,n.cookies)();return(0,a.iW)(e,o)}async function c(){let e=await (0,n.cookies)();return(0,a.iW)(e,r)}}};var t=require("../../../../webpack-runtime.js");t.C(e);var s=e=>t(t.s=e),a=t.X(0,[8948,3314,8632,5972],()=>s(60884));module.exports=a})();