import{r as i,p as g,j as s,n as c,L as p,a1 as j}from"./vendor-DyCecx-5.js";import{e as n,t as l}from"./index-BFnDPF9i.js";import{H as v,R as N}from"./RecentlyViewed-DBkZzCIP.js";const k=()=>{const[t,a]=i.useState([]),[d,r]=i.useState(!0),o=g();i.useEffect(()=>{m()},[]);const m=async()=>{r(!0);const e=await n.getWishlist();e.success&&e.data?a(e.data):l.error("Failed to load wishlist"),r(!1)},h=async e=>{const x=[...t];a(u=>u.filter(f=>f.id!==e)),(await n.removeFromWishlist(e)).success?l.success("Removed from wishlist"):(a(x),l.error("Failed to remove from wishlist"))};return s.jsx("div",{className:"min-h-screen bg-slate-50/50 py-12 px-6",children:s.jsxs("div",{className:"max-w-7xl mx-auto",children:[s.jsxs("header",{className:"mb-12",children:[s.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[s.jsx("div",{className:"p-3 bg-rose-50 text-rose-500 rounded",children:s.jsx(c,{className:"w-6 h-6 fill-rose-500"})}),s.jsx("h1",{className:"text-4xl font-black text-slate-900 tracking-tight",children:"Your Wishlist"})]}),s.jsx("p",{className:"text-slate-500 font-medium",children:"Keep track of the hotels you'd love to visit."})]}),d?s.jsx("div",{className:"flex justify-center py-20",children:s.jsx(p,{className:"w-10 h-10 text-slate-200 animate-spin"})}):!Array.isArray(t)||t.length===0?s.jsxs("div",{className:"bg-white rounded p-20 text-center border border-slate-100 shadow-sm",children:[s.jsx("div",{className:"w-24 h-24 bg-slate-50 text-slate-200 rounded-full flex items-center justify-center mx-auto mb-8",children:s.jsx(c,{className:"w-12 h-12"})}),s.jsx("h3",{className:"text-2xl font-black text-slate-900 mb-2",children:"Your wishlist is empty"}),s.jsx("p",{className:"text-slate-500 font-medium mb-10",children:"Start exploring and save your favorite hotels!"}),s.jsxs("button",{onClick:()=>o("/customer/search"),className:"bg-slate-900 text-white px-10 py-4 rounded font-black shadow-sm flex items-center gap-2 mx-auto hover:bg-slate-800 transition-all",children:[s.jsx(j,{className:"w-5 h-5"}),"Explore Hotels"]})]}):s.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-8",children:t.map(e=>s.jsx(v,{hotel:e,isInWishlist:!0,onToggleWishlist:h,onClick:()=>o(`/customer/hotel/${e.id}`)},e.id))}),s.jsx(N,{})]})})};export{k as default};
