module.exports=[80180,a=>{"use strict";let b=(0,a.i(64831).default)("trash-2",[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]]);a.s(["Trash2",0,b],80180)},25105,a=>{"use strict";var b=a.i(87924),c=a.i(67379),d=a.i(90195),e=a.i(72131),f=a.i(80180);function g({item:a,onRemove:c,onMoveToCart:d}){let e=a.product_id;return(0,b.jsxs)("div",{className:"flex items-center gap-4 bg-white rounded-xl border p-3 mb-3 md:mb-4 transition",children:[(0,b.jsx)("div",{className:"relative w-20 h-20 flex-shrink-0 rounded-lg overflow-hidden",children:(0,b.jsx)("img",{src:e.defaultImage,alt:e.name,className:"object-cover"})}),(0,b.jsxs)("div",{className:"w-full",children:[(0,b.jsx)("h3",{className:"text-base md:text-lg font-semibold text-gray-800 line-clamp-2",children:e.name}),(0,b.jsxs)("p",{className:"text-sm text-gray-500 mt-1",children:["₹",e.price.toLocaleString("en-IN")]})]}),(0,b.jsx)("div",{className:"flex items-center justify-between text-nowrap mt-0",children:(0,b.jsx)("button",{onClick:()=>c?.(a._id),className:"w-10 h-10 inline-flex justify-center items-center rounded-full bg-red-500/25 hover:bg-red-500 text-red-500 hover:text-white transition duration-300",children:(0,b.jsx)(f.Trash2,{size:18})})})]})}var h=a.i(32636);a.s(["default",0,function(){let[a,f]=(0,e.useState)([]),[i,j]=(0,e.useState)(0),{clienttotken:k}=(0,h.default)(),l=async()=>{try{let a=localStorage.getItem("customer"),b=localStorage.getItem("guestId"),d=a?JSON.parse(a):null,e=d?.id,g="/clientapi/wishlist?";if(e)g+=`user_id=${e}`;else{if(!b)return void console.log("No user or guest found");g+=`guest_id=${b}`}let h=await (0,c.apiCall)(g,{headers:{Authorization:`Bearer ${k}`}});h?.data?.success&&(f(h.data?.data),j(h.data?.count))}catch(a){console.error("Error fetching wishlist",a)}},m=async({product_id:a})=>{try{let b=localStorage.getItem("customer"),d=localStorage.getItem("guestId"),e=b?JSON.parse(b):null,f={product_id:a};if(e?.id)f.user_id=e.id;else{if(!d)return void console.log("No user or guest found");f.guest_id=d}let g=await (0,c.apiCall)("/clientapi/wishlist",{method:"DELETE",body:f,headers:{Authorization:`Bearer ${k}`}});g?.data?.success&&l()}catch(a){throw console.error("Error removing wishlist item:",a),a}};return(0,e.useEffect)(()=>{l()},[]),(0,b.jsxs)("div",{children:[(0,b.jsxs)("h1",{className:"text-2xl font-semibold mb-4",children:["My Wishlist ",i??`(${i} Items)`]}),a?.length===0?(0,b.jsxs)("div",{className:"bg-white rounded-xl shadow p-8 text-center",children:[(0,b.jsx)(d.Heart,{size:48,className:"mx-auto text-gray-400 mb-4"}),(0,b.jsx)("p",{className:"text-gray-500",children:"Your wishlist is empty"})]}):a?.map(a=>(0,b.jsx)(g,{item:a,onRemove:()=>m({product_id:a?.product_id?._id})}))]})}],25105)}];

//# sourceMappingURL=_0lc304d._.js.map