import{d as e,f as t,h as n,l as r,r as i,t as a,u as o}from"./src-C0xjWfnx.js";import{t as s}from"./useNavigate-VRicZWJI.js";import{t as c}from"./shopping-cart-BBNoSjWE.js";import{t as l}from"./zap-CufcM84a.js";import{n as u}from"./index-BXnbw4dQ.js";import{n as d}from"./cart-query-hooks-BCr0eax3.js";import{t as f}from"./central-product-store-DGoerB5U.js";var p=n(t()),m=e();function h(){let{id:e}=u.useParams(),t=Number(e),n=s(),[h,g]=(0,p.useState)(1),_=f(e=>e.productsById)[t],v=d(`flash`),y=()=>{_&&v.mutate({productId:_.id,quantity:h,storeId:_.storeId},{onSuccess:()=>n({to:`/flash/cart`})})};if(!_)return(0,m.jsx)(a,{children:(0,m.jsx)(o,{children:`Product not found`})});let b=_.discountedPrice??_.price,x=_.images?.[0];return(0,m.jsxs)(a,{children:[(0,m.jsxs)(`div`,{className:`mb-4 flex items-center gap-2`,children:[(0,m.jsx)(l,{className:`h-5 w-5 text-yellow-500`}),(0,m.jsx)(o,{className:`text-sm font-semibold text-yellow-600`,children:`1 Hr Delivery`})]}),x&&(0,m.jsx)(`div`,{className:`mb-4 aspect-square w-full overflow-hidden rounded-xl bg-gray-100`,children:(0,m.jsx)(`img`,{src:x,alt:_.name,className:`h-full w-full object-cover`})}),(0,m.jsx)(o,{weight:`bold`,className:`mb-1 text-xl`,children:_.name}),(0,m.jsxs)(o,{className:`mb-4 text-sm text-gray-500`,children:[_.unitValue,_.unit]}),(0,m.jsxs)(`div`,{className:`mb-4 flex items-baseline gap-2`,children:[(0,m.jsxs)(o,{weight:`bold`,className:`text-2xl text-brand-600`,children:[`₹`,b]}),_.discountedPrice&&(0,m.jsxs)(o,{className:`text-sm text-gray-400 line-through`,children:[`₹`,_.price]})]}),(0,m.jsx)(`div`,{className:`mb-6`,children:(0,m.jsx)(i,{value:h,setValue:g,max:10})}),(0,m.jsxs)(r,{fullWidth:!0,onClick:y,disabled:v.isPending,className:`flex items-center justify-center gap-2 bg-brand-500 text-white`,children:[(0,m.jsx)(c,{className:`h-4 w-4`}),v.isPending?`Adding...`:`Add to Cart`]})]})}export{h as component};