1import{a as p,j as e,A as H,m as N}from"./vendor-framer-Bi1qEhT1.js";import{u as X,a as ee,A as b}from"./index-Do3puBAy.js";import"./vendor-tiptap-DCrKpgXq.js";import"./vendor-gsap-C0eCJjti.js";const re=({onLogout:D,onHomeClick:A,onAddToCart:k,onProductClick:$})=>{var z,M,W;const{user:l,checkAuth:U}=X(),{showToast:w}=ee(),[f,S]=p.useState("overview"),[n,I]=p.useState([]),[V,q]=p.useState(!0),[y,F]=p.useState(1),[m,v]=p.useState(null),[E,J]=p.useState([]),[O,G]=p.useState([]),[P,T]=p.useState([]),[Q,Z]=p.useState(!0),[c,u]=p.useState({firstName:"",lastName:"",phone:"",address:"",city:"",state:"",pin_code:"",birthDate:""}),[L,R]=p.useState(!1),[C,_]=p.useState({type:"",text:""});p.useEffect(()=>{var t,s,d,h,a,r;l&&u({firstName:l.first_name||"",lastName:l.last_name||"",phone:((t=l.profile)==null?void 0:t.phone)||"",address:((s=l.profile)==null?void 0:s.address)||"",city:((d=l.profile)==null?void 0:d.city)||"",state:((h=l.profile)==null?void 0:h.state)||"",pin_code:((a=l.profile)==null?void 0:a.pin_code)||"",birthDate:((r=l.profile)==null?void 0:r.birth_date)||""})},[l]),p.useEffect(()=>{const t=async()=>{try{const a=localStorage.getItem("access_token");if(!a)return;const r=await fetch(`${b}/api/orders/`,{headers:{Authorization:`Bearer ${a}`}});if(r.ok){const i=await r.json();Array.isArray(i)?I(i.sort((g,x)=>new Date(x.created_at).getTime()-new Date(g.created_at).getTime())):(console.error("Orders data is not an array:",i),I([]))}}catch(a){console.error("Failed to fetch orders",a)}finally{q(!1)}},s=async()=>{try{const a=localStorage.getItem("access_token");if(!a)return;const r=await fetch(`${b}/api/reward-transactions/`,{headers:{Authorization:`Bearer ${a}`}});if(r.ok){const i=await r.json();Array.isArray(i)&&J(i)}}catch(a){console.error("Failed to fetch reward transactions:",a)}},d=async()=>{try{const a=await fetch(`${b}/api/reward-rules/`);if(a.ok){const r=await a.json();Array.isArray(r)&&G(r.filter(i=>i.is_enabled))}}catch(a){console.error("Failed to fetch reward rules:",a)}},h=async()=>{try{const a=localStorage.getItem("access_token");if(!a)return;const r=await fetch(`${b}/api/wishlist/`,{headers:{Authorization:`Bearer ${a}`}});if(r.ok){const i=await r.json();Array.isArray(i)&&T(i)}}catch(a){console.error("Failed to fetch wishlist",a)}finally{Z(!1)}};l&&(t(),s(),d(),h())},[l]);const K=async t=>{t.preventDefault(),R(!0),_({type:"",text:""});try{const s=localStorage.getItem("access_token");(await fetch(`${b}/api/users/update_profile/`,{method:"PATCH",headers:{"Content-Type":"application/json",Authorization:`Bearer ${s}`},body:JSON.stringify({first_name:c.firstName,last_name:c.lastName,phone:c.phone,address:c.address,city:c.city,state:c.state,pin_code:c.pin_code,birth_date:c.birthDate||null})})).ok?(_({type:"success",text:"Profile updated successfully! â¨"}),await U()):_({type:"error",text:"Failed to update profile. Please try again."})}catch{_({type:"error",text:"Something went wrong."})}finally{R(!1)}};if(!l)return null;const o={name:l.first_name?`${l.first_name} ${l.last_name}`:l.username,email:l.email,points:((z=l.profile)==null?void 0:z.points)||0,tier:((M=l.profile)==null?void 0:M.tier)||"Member",savings:((W=l.profile)==null?void 0:W.savings)||0,totalSpent:Number((Array.isArray(n)?n:[]).reduce((t,s)=>t+Number(s.total_amount||0),0)||0).toFixed(2)},B=[{id:"overview",label:"Overview",icon:"dashboard"},{id:"orders",label:"My Orders",icon:"shopping_bag"},{id:"rewards",label:"Rewards & Tiers",icon:"workspace_premium"},{id:"profile",label:"Edit Profile",icon:"person_edit"}];return e.jsxs("div",{className:"customer-dashboard min-h-screen bg-[#f2f2ec] relative overflow-x-hidden pb-24 lg:pb-0",children:[e.jsx("div",{className:"w-full mx-auto px-4 sm:px-6 lg:px-8 pt-4 pb-6 sm:py-8 relative z-10",children:e.jsxs("div",{className:"lg:grid lg:grid-cols-[280px_1fr] gap-8 items-start",children:[e.jsxs("aside",{className:"hidden lg:block bg-white rounded-[32px] p-6 shadow-sm border border-slate-100 sticky top-8 space-y-8",children:[e.jsxs("div",{className:"flex flex-col items-center text-center pb-6 border-b border-slate-100",children:[e.jsx("div",{className:"w-20 h-20 bg-[#0b3d2e] text-white rounded-full flex items-center justify-center font-black text-3xl shadow-xl shadow-[#0b3d2e]/20 mb-4 ring-4 ring-slate-50",children:(o.name||" ")[0]}),e.jsx("h3",{className:"force-anton text-3xl tracking-wide uppercase truncate leading-none text-[#0b3d2e] w-full",children:o.name}),e.jsx("p",{className:"text-xs font-black text-primary uppercase tracking-widest mt-2 bg-[#0b3d2e]/5 px-3 py-1 rounded-full",children:o.tier})]}),e.jsx("nav",{className:"space-y-2",children:B.map(t=>e.jsxs("button",{onClick:()=>S(t.id),className:`w-full flex items-center gap-3.5 py-4 px-5 font-bold text-sm uppercase tracking-widest transition-all rounded-2xl ${f===t.id?"bg-[#0b3d2e] !text-white shadow-xl shadow-[#0b3d2e]/20 scale-[1.02]":"text-slate-500 hover:bg-[#0b3d2e]/5 hover:text-[#0b3d2e]"}`,children:[e.jsx("span",{className:"material-symbols-outlined text-[20px]",children:t.icon}),t.label]},t.id))}),e.jsxs("button",{onClick:D,className:"w-full flex items-center gap-3 px-5 py-4 rounded-xl font-bold text-sm uppercase tracking-widest text-red-400 hover:text-red-600 hover:bg-red-50 transition-all mt-4 border-t border-slate-100 pt-6",children:[e.jsx("span",{className:"material-symbols-outlined text-[20px]",children:"logout"}),"Sign Out"]})]}),e.jsxs("main",{className:"min-h-[400px] lg:min-h-[600px] w-full min-w-0 space-y-4 sm:sp
1ace-y-6",children:[e.jsxs("div",{className:"lg:hidden flex overflow-x-auto hide-scrollbar gap-2 pb-2 -mx-4 px-4 sm:mx-0 sm:px-0",children:[B.map(t=>e.jsxs("button",{onClick:()=>S(t.id),className:`flex-shrink-0 flex items-center gap-2 py-2.5 px-4 rounded-full font-bold text-[10px] uppercase tracking-widest transition-all border ${f===t.id?"bg-[#0b3d2e] text-white border-[#0b3d2e] shadow-md":"bg-white text-slate-500 border-slate-200 shadow-sm"}`,children:[e.jsx("span",{className:"material-symbols-outlined text-[16px]",children:t.icon}),t.label]},t.id)),e.jsxs("button",{onClick:D,className:"flex-shrink-0 flex items-center gap-2 py-2.5 px-4 rounded-full font-bold text-[10px] uppercase tracking-widest bg-red-50 text-red-500 border border-red-100 transition-all shadow-sm",children:[e.jsx("span",{className:"material-symbols-outlined text-[16px]",children:"logout"}),"Logout"]})]}),e.jsxs(H,{mode:"wait",children:[f==="overview"&&e.jsxs(N.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:"space-y-8",children:[e.jsxs("div",{className:"relative overflow-hidden rounded-2xl sm:rounded-3xl bg-gradient-to-br from-[#0b3d2e] to-[#145a3e] p-5 sm:p-7 text-white shadow-xl",children:[e.jsxs("div",{className:"relative z-10",children:[e.jsxs("div",{className:"flex items-center justify-between mb-3",children:[e.jsx("span",{className:"bg-white/15 backdrop-blur-sm px-3 py-1 rounded-full text-[9px] font-black uppercase tracking-widest",children:o.tier}),e.jsxs("span",{className:"text-[10px] text-white/50 font-bold uppercase tracking-widest",children:["since ",new Date(l.date_joined||Date.now()).getFullYear()]})]}),e.jsxs("h2",{className:"text-2xl sm:text-3xl font-anton uppercase tracking-wide leading-tight mb-1",children:["Welcome back, ",l.first_name||l.username]}),e.jsx("p",{className:"text-sm text-white/60 font-medium",children:"Your health journey at a glance"})]}),e.jsx("div",{className:"absolute -right-8 -bottom-8 w-40 h-40 bg-white/5 rounded-full blur-2xl"})]}),e.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-4",children:[{label:"PinoPoints",val:o.points,icon:"workspace_premium",iconColor:"text-amber-500",iconBg:"bg-amber-50"},{label:"Orders",val:n.length,icon:"shopping_bag",iconColor:"text-emerald-500",iconBg:"bg-emerald-50"},{label:"Savings",val:`â¹${o.savings}`,icon:"savings",iconColor:"text-sky-500",iconBg:"bg-sky-50"},{label:"Spent",val:`â¹${o.totalSpent}`,icon:"wallet",iconColor:"text-violet-500",iconBg:"bg-violet-50"}].map((t,s)=>e.jsxs("div",{className:"flex flex-col items-start bg-white rounded-[24px] p-5 shadow-sm border border-slate-100",children:[e.jsx("div",{className:`w-12 h-12 rounded-full ${t.iconBg} flex items-center justify-center ${t.iconColor} mb-4`,children:e.jsx("span",{className:"material-symbols-outlined text-[24px]",children:t.icon})}),e.jsx("p",{className:"text-[11px] font-black text-slate-400 uppercase tracking-widest mb-1",children:t.label}),e.jsx("p",{className:"force-anton text-3xl tracking-wide text-[#0b3d2e] leading-none truncate w-full",children:t.val})]},s))}),e.jsxs("div",{className:"grid sm:grid-cols-2 gap-4",children:[e.jsxs("div",{className:"bg-white rounded-[24px] p-6 border border-slate-100 shadow-sm",children:[e.jsxs("div",{className:"flex justify-between items-end mb-6 border-b border-slate-50 pb-4",children:[e.jsx("h3",{className:"force-anton text-3xl tracking-wide uppercase leading-none text-[#0b3d2e]",children:"Points"}),e.jsx("span",{className:"text-[10px] text-slate-400 font-black uppercase tracking-widest bg-slate-50 px-3 py-1 rounded-full mb-1",children:"Recent"})]}),e.jsx("div",{className:"space-y-4",children:E.length>0?E.slice(0,5).map(t=>e.jsxs("div",{className:"flex items-center justify-between pb-4 border-b border-slate-50 last:border-0 last:pb-0",children:[e.jsxs("div",{className:"min-w-0 mr-3",children:[e.jsx("p",{className:"text-base font-bold text-slate-800 truncate mb-0.5",children:t.reason}),e.jsx("p",{className:"text-[11px] font-black text-slate-400 uppercase tracking-widest",children:new Date(t.timestamp).toLocaleDateString()})]}),e.jsxs("span",{className:`force-anton text-2xl tracking-wide flex-shrink-0 ${t.points_change>0?"text-emerald-500":"text-red-400"}`,children:[t.points_change>0?"+":"",t.points_change]})]},t.id)):e.jsxs("div",{className:"text-center py-8 text-slate-300",children:[e.jsx("span",{className:"material-symbols-outlined text-4xl block mb-2",children:"history"}),e.jsx("p",{className:"text-[11px] font-black uppercase tracking-widest",children:"No activity"})]})})]}),e.jsxs("div",{className:"bg-white rounded-[24px] p-6 border border-slate-100 shadow-sm flex flex-col",children:[e.jsxs("div",{className:"flex justify-between items-end mb-6 border-b border-slate-50 pb-4",children:[e.jsx("h3",{className:"force-anton text-3xl tracking-wide uppercase leading-none text-[#0b3d2e]",children:"Last Order"}),e.jsx("button",{onClick:()=>S("orders"),className:"text-[10px] text-[#0b3d2e] font-black uppercase tracking-widest bg-[#0b3d2e]/5 px-3 py-1 rounded-full hover:bg-[#0b3d2e]/10 transition-colors mb-1",children:"All â"})]}),n.length>0?e.jsxs("div",{onClick:()=>v(n[0]),className:"p-5 bg-slate-50 rounded-[20px] cursor-pointer hover:bg-slate-100 transition-colors",children:[e.jsxs("div",{className:"flex justify-between items-start mb-5",children:[e.jsxs("div",{children:[e.jsxs("p",{className:"text-[11px] font-black text-slate-400 uppercase tracking-widest mb-1.5",children:["#",n[0].id]}),e.jsxs("p",{className:"force-anton text-4xl tracking-wide text-[#0b3d2e] leading-none",children:["â¹",n[0].total_amount]})]}),e.jsx("span",{className:"bg-emerald-100 text-emerald-600 px-3 py-1 rounded-full text-[10px] font-black uppercase tracking-widest",children:n[0].status})]}),e.jsx("div",{className:"flex gap-2",children:n[0].items.slice(0,4).map((t,s)=>{var d;return e.jsx("div",{className:"w-12 h-12 bg-white rounded-[12px] overflow-hidden shadow-sm border border-slate-100",children:e.jsx("img",{src:(d=t.product_image)!=null&&d.startsWith("http")?t.product_image:`${b}${t.product_image}`,className:"w-full h-full object-cover"})},s)})})]}):e.jsxs("div",{className:"text-center py-8 text-slate-300",children:[e.jsx("span",{className:"material-symbols-outlined text-4xl block mb-2",children:"shopping_basket"}),e.jsx("p",{className:"text-[11px] font-black uppercase tracking-widest",children:"No orders yet"})]})]})]})]}),f==="orders"&&e.jsxs(N.div,{initial:{opacity:0,x:20}
1,animate:{opacity:1,x:0},exit:{opacity:0,x:-20},className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between bg-white p-5 rounded-2xl border border-slate-100 shadow-sm",children:[e.jsx("h2",{className:"text-xl sm:text-2xl font-black uppercase tracking-tight text-slate-900",children:"Orders"}),e.jsx("span",{className:"bg-slate-100 text-slate-500 px-3 py-1 rounded-full text-[10px] font-black uppercase",children:n.length})]}),V?e.jsxs("div",{className:"text-center py-24",children:[e.jsx("div",{className:"w-12 h-12 border-4 border-primary border-t-transparent rounded-full animate-spin mx-auto mb-4"}),e.jsx("p",{className:"text-slate-400 font-bold uppercase tracking-widest text-xs",children:"Fetching your history..."})]}):n.length>0?e.jsxs("div",{className:"space-y-4",children:[n.slice((y-1)*7,y*7).map(t=>e.jsxs("div",{onClick:()=>v(t),className:"bg-white p-4 rounded-2xl border border-slate-100 shadow-sm hover:shadow-lg hover:scale-[1.01] transition-all cursor-pointer group flex items-center gap-4",children:[e.jsx("div",{className:"w-20 h-20 bg-slate-50 rounded-2xl flex items-center justify-center text-slate-300 group-hover:text-primary transition-colors",children:e.jsx("span",{className:"material-symbols-outlined text-4xl",children:"package_2"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-1",children:[e.jsxs("h3",{className:"font-black text-lg uppercase tracking-tight text-[#008a45]",children:["Order #",t.id]}),e.jsx("div",{className:"flex -space-x-3",children:t.items.slice(0,4).map((s,d)=>{var h;return e.jsx("div",{className:"w-8 h-8 rounded-full border-2 border-white bg-white overflow-hidden shadow-sm",children:e.jsx("img",{src:(h=s.product_image)!=null&&h.startsWith("http")?s.product_image:`${b}${s.product_image}`,className:"w-full h-full object-cover"})},d)})})]}),e.jsx("p",{className:"text-xs text-slate-400 font-bold uppercase tracking-widest",children:new Date(t.created_at).toLocaleDateString("en-GB",{day:"numeric",month:"long",year:"numeric"})})]}),e.jsxs("div",{className:"text-right",children:[e.jsxs("p",{className:"text-2xl font-black text-slate-900 tracking-tighter",children:["â¹",t.total_amount]}),e.jsx("span",{className:`inline-block px-3 py-1 rounded-full text-[10px] font-black uppercase tracking-wider mt-1 ${t.status==="DELIVERED"?"bg-green-100 text-green-600":t.status==="SHIPPED"?"bg-blue-100 text-blue-600":t.status==="PAID"?"bg-emerald-100 text-emerald-600":t.status==="CANCELLED"?"bg-red-100 text-red-500":"bg-orange-100 text-accent-brown"}`,children:t.status==="PAID"?"Processing":t.status})]})]},t.id)),n.length>7&&e.jsxs("div",{className:"flex justify-center items-center gap-4 pt-6",children:[e.jsx("button",{onClick:()=>F(t=>Math.max(1,t-1)),disabled:y===1,className:"w-10 h-10 rounded-full bg-white border border-slate-200 flex items-center justify-center text-slate-400 hover:text-[#0b3d2e] hover:border-[#0b3d2e] disabled:opacity-50 disabled:pointer-events-none transition-all shadow-sm",children:e.jsx("span",{className:"material-symbols-outlined text-lg",children:"chevron_left"})}),e.jsxs("span",{className:"text-xs font-black uppercase tracking-widest text-slate-400",children:["Page ",y," of ",Math.
1ceil(n.length/7)]}),e.jsx("button",{onClick:()=>F(t=>Math.min(Math.ceil(n.length/7),t+1)),disabled:y===Math.ceil(n.length/7),className:"w-10 h-10 rounded-full bg-white border border-slate-200 flex items-center justify-center text-slate-400 hover:text-[#0b3d2e] hover:border-[#0b3d2e] disabled:opacity-50 disabled:pointer-events-none transition-all shadow-sm",children:e.jsx("span",{className:"material-symbols-outlined text-lg",children:"chevron_right"})})]})]}):e.jsxs("div",{className:"bg-white p-24 rounded-[40px] text-center border-2 border-dashed border-slate-100 flex flex-col items-center",children:[e.jsx("span",{className:"material-symbols-outlined text-8xl text-slate-200 mb-6 block leading-none",children:"shopping_cart_off"}),e.jsx("h3",{className:"text-2xl font-black text-slate-400 uppercase tracking-tight",children:"No orders yet!"}),e.jsx("p",{className:"text-slate-400 mt-2 mb-8 uppercase tracking-widest font-bold text-xs",children:"Start your health journey today"}),e.jsx("button",{onClick:A,className:"bg-primary text-white px-8 py-3 rounded-full font-black uppercase tracking-widest hover:scale-105 transition-transform",children:"Shop Now"})]}),e.jsxs("div",{className:"flex items-center justify-between bg-white p-5 rounded-2xl border border-slate-100 shadow-sm mt-8",children:[e.jsx("h2",{className:"text-xl sm:text-2xl font-black uppercase tracking-tight text-slate-900",children:"Wishlist"}),P.length>0&&e.jsxs("button",{onClick:async()=>{var t,s,d,h,a;try{const r=localStorage.getItem("access_token"),g=await(await fetch(`${b}/api/wishlist/`,{headers:{Authorization:`Bearer ${r}`}})).json();if(k){for(const x of g){const j={id:String(x.product),name:((t=x.product_details)==null?void 0:t.name)||"",price:parseFloat((s=x.product_details)==null?void 0:s.price)||0,originalPrice:(d=x.product_details)!=null&&d.original_price?parseFloat(x.product_details.original_price):void 0,image:((h=x.product_details)==null?void 0:h.image)||"",category:((a=x.product_details)==null?void 0:a.category_name)||""};k(j)}w("All items added to cart!","success")}else w("Cart function not available","error")}catch{w("Failed to add items to cart","error")}},className:"flex items-center gap-2 px-4 py-2 bg-[#0b3d2e] text-white rounded-xl text-[10px] font-black uppercase tracking-widest hover:bg-emerald-900 transition-all shadow-sm active:scale-95",children:[e.jsx("span",{className:"material-symbols-outlined text-[14px]",children:"shopping_cart"}),e.jsx("span",{className:"hidden sm:inline",children:"Add All to Cart"}),e.jsx("span",{className:"sm:hidden",children:"Add All"})]})]}),Q?e.jsx("div",{className:"flex justify-center py-20",children:e.jsx("div",{className:"w-12 h-12 border-4 border-slate-100 border-t-primary rounded-full animate-spin"})}):P.length>0?e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6 mt-6",children:P.map(t=>{var s,d,h,a;return e.jsxs("div",{onClick:()=>{$&&$({...t.product_details,id:String(t.product),price:parseFloat(t.product_details.price),originalPrice:t.product_details.original_price?parseFloat(t.product_details.original_price):void 0})},className:"group relative bg-white border border-slate-100 rounded-[24px] overflow-hidden hover:shadow-xl hover:-translate-y-1 transition-all duration-300 flex flex-col cursor-pointer p-4",children:[e.jsx("button",{onClick:async r=>{r.stopPropagation();try{const i=localStorage.getItem("access_token");(await fetch(`${b}/api/wishlist/toggle/`,{method:"POST",headers:{Authorization:`Bearer ${i}`,"Content-Type":"application/json"},body:JSON.stringify({product_id:t.product})})).ok&&T(x=>x.filter(j=>j.id!==t.id))}catch{}},className:"absolute top-7 right-7 z-20 w-9 h-9 bg-white text-slate-400 rounded-full flex items-center justify-center transition-all hover:bg-red-50 hover:text-red-500 shadow-sm border border-slate-100",children:e.jsx("span",{className:"material-symbols-outlined text-[18px]",children:"delete"})}),e.jsx("button",{onClick:async r=>{r.stopPropagation();try{const i=`${window.location.origin}/product/${t.product}`;await navigator.clipboard.writeText(i),w("Product link copied!","success")}catch{}},className:"absolute top-7 right-18 z-20 w-9 h-9 bg-white text-slate-600 rounded-full flex items-center justify-center transition-all hover:bg-slate-100 shadow-sm border border-slate-100",style:{right:"4.5rem"},children:e.jsx("span",{className:"material-symbols-outlined text-[16px]",children:"share"})}),e.jsx("div",{className:"relative aspect-[4/5] bg-slate-50 rounded-2xl p-6 flex-shrink-0 mb-4 overflow-hidden",children:(s=t.product_details)!=null&&s.image?e.jsx("img",{src:t.product_details.image.startsWith("http")?t.product_details.image:`${b}${t.product_details.image}`,alt:t.product_details.name,className:"w-full h-full object-contain group-hover:scale-110 transition-transform duration-500 mix-blend-multiply"}):e.jsx("div",{className:"w-full h-full flex items-center justify-center text-slate-200",children:e.jsx("span",{className:"material-symbols-outlined text-5xl",children:"inventory_2"})})}),e.jsxs("div",{className:"flex flex-col flex-1 px-1",children:[e.jsxs("div",{className:"mb-auto",children:[e.jsx("p",{className:"text-[10px] font-black text-slate-400 uppercase tracking-widest mb-1.5 truncate",children:(d=t.product_details)==null?void 0:d.category_name}),e.jsx("h3",{className:"force-anton text-2xl uppercase leading-tight tracking-wide text-[#0b3d2e] line-clamp-2",children:(h=t.product_details)==null?void 0:h.name})]}),e.jsxs("div",{className:"flex items-center justify-between mt-5 gap-3",children:[e.jsxs("div",{className:"flex flex-col",children:[e.jsx("span",{className:"text-[10px] font-black text-slate-400 uppercase tracking-widest leading-none mb-1",children:"Price"}),e.jsxs("span",{className:"force-anton text-2xl tracking-wide text-[#0b3d2e] leading-none",children:["â¹",(a=t.product_details)==null?void 0:a.price]})]}),e.jsx("button",{onClick:r=>{var i,g,x,j,Y;r.stopPropagation(),k&&(k({id:String(t.product),name:((i=t.product_details)==null?void 0:i.name)||"",price:parseFloat((g=t.product_details)==null?void 0:g.price)||0,originalPrice
1:(x=t.product_details)!=null&&x.original_price?parseFloat(t.product_details.original_price):void 0,image:((j=t.product_details)==null?void 0:j.image)||"",category:((Y=t.product_details)==null?void 0:Y.category_name)||""}),w("Added to cart!","success"))},className:"w-10 h-10 bg-[#0b3d2e] text-white rounded-full flex items-center justify-center transition-all active:scale-95 shadow-sm hover:opacity-90 flex-shrink-0",children:e.jsx("span",{className:"material-symbols-outlined text-[18px]",children:"shopping_cart"})})]})]})]},t.id)})}):e.jsxs("div",{className:"text-center py-20 px-4",children:[e.jsx("div",{className:"w-24 h-24 bg-slate-50 rounded-full flex items-center justify-center mx-auto mb-6",children:e.jsx("span",{className:"material-symbols-outlined text-4xl text-slate-300",children:"favorite_border"})}),e.jsx("h3",{className:"text-2xl font-black uppercase tracking-tight text-slate-900 mb-2",children:"Your wishlist is empty"}),e.jsx("p",{className:"text-sm font-bold text-slate-400 uppercase tracking-widest mb-8",children:"Save items
1you love to view them later."})]})]}),f==="profile"&&e.jsxs(N.div,{initial:{opacity:0,scale:.95},animate:{opacity:1,scale:1},className:"bg-white rounded-2xl p-5 sm:p-8 border border-slate-100 shadow-sm",children:[e.jsxs("div",{className:"mb-8 pb-5 border-b border-slate-100",children:[e.jsx("h2",{className:"text-xl sm:text-2xl font-black uppercase tracking-tight text-slate-900",children:"Profile"}),e.jsx("p",{className:"text-sm text-slate-400 mt-1",children:"Manage your personal information"})]}),e.jsxs("form",{onSubmit:K,className:"space-y-12",children:[e.jsxs("div",{className:"grid md:grid-cols-2 gap-8",children:[e.jsxs("div",{className:"space-y-6",children:[e.jsxs("h3",{className:"text-xs font-black uppercase tracking-[0.2em] text-primary flex items-center gap-2",children:[e.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-primary"}),"Personal Details"]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("label",{className:"text-[10px] font-black text-slate-400 uppercase tracking-widest ml-1",children:"First Name"}),e.jsx("input",{type:"text",value:c.firstName,onChange:t=>u(s=>({...s,firstName:t.target.value})),className:"w-full px-5 py-4 bg-slate-50 border-2 border-transparent focus:border-primary/20 focus:bg-white rounded-2xl outline-none font-bold transition-all !text-[#008a45]"})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("label",{className:"text-[10px] font-black text-slate-400 uppercase tracking-widest ml-1",children:"Last Name"}),e.jsx("input",{type:"text",value:c.lastName,onChange:t=>u(s=>({...s,lastName:t.target.value})),className:"w-full px-5 py-4 bg-slate-50 border-2 border-transparent focus:border-primary/20 focus:bg-white rounded-2xl outline-none font-bold transition-all !text-[#008a45]"})]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("label",{className:"text-[10px] font-black text-slate-400 uppercase tracking-widest ml-1",children:"Phone Number"}),e.jsx("input",{type:"tel",value:c.phone,onChange:t=>u(s=>({...s,phone:t.target.value})),className:"w-full px-5 py-4 bg-slate-50 border-2 border-transparent focus:border-primary/20 focus:bg-white rounded-2xl outline-none font-bold transition-all !text-[#008a45]"})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("label",{className:"text-[10px] font-black text-slate-400 uppercase tracking-widest ml-1",children:"Birth Date"}),e.jsx("input",{type:"date",value:c.birthDate,onChange:t=>u(s=>({...s,birthDate:t.target.value})),className:"w-full px-5 py-4 bg-slate-50 border-2 border-transparent focus:border-primary/20 focus:bg-white rounded-2xl outline-none font-bold transition-all !text-[#008a45]"})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("label",{className:"text-[10px] font-black text-slate-400 uppercase tracking-widest ml-1 opacity-50",children:"Email (Cannot be changed)"}),e.jsx("input",{type:"email",value:o.email,disabled:!0,className:"w-full px-5 py-4 bg-slate-100 border-2 border-transparent rounded-2xl cursor-not-allowed font-bold !text-[#008a45]/60"})]})]})]}),e.jsxs("div",{className:"space-y-6",children:[e.jsxs("h3",{className:"text-xs font-black uppercase tracking-[0.2em] text-primary flex items-center gap-2",children:[e.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-primary"}),"Shipping Defaults"]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("label",{className:"text-[10px] font-black text-slate-400 uppercase tracking-widest ml-1",children:"Street Address"}),e.jsx("input",{type:"text",value:c.address,onChange:t=>u(s=>({...s,address:t.target.value})),className:"w-full px-5 py-4 bg-slate-50 border-2 border-transparent focus:border-primary/20 focus:bg-white rounded-2xl outline-none font-bold transition-all !text-[#008a45]"})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("label",{className:"text-[10px] font-black text-slate-400 uppercase tracking-widest ml-1",children:"City"}),e.jsx("input",{type:"text",value:c.city,onChange:t=>u(s=>({...s,city:t.target.value})),className:"w-full px-5 py-4 bg-slate-50 border-2 border-transparent focus:border-primary/20 focus:bg-white rounded-2xl outline-none font-bold transition-all !text-[#008a45]"})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("label",{className:"text-[10px] font-black text-slate-400 uppercase tracking-widest ml-1",children:"ZIP Co
1de"}),e.jsx("input",{type:"text",value:c.pin_code,onChange:t=>u(s=>({...s,pin_code:t.target.value})),className:"w-full px-5 py-4 bg-slate-50 border-2 border-transparent focus:border-primary/20 focus:bg-white rounded-2xl outline-none font-bold transition-all !text-[#008a45]"})]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("label",{className:"text-[10px] font-black text-slate-400 uppercase tracking-widest ml-1",children:"State"}),e.jsx("input",{type:"text",value:c.state,onChange:t=>u(s=>({...s,state:t.target.value})),className:"w-full px-5 py-4 bg-slate-50 border-2 border-transparent focus:border-primary/20 focus:bg-white rounded-2xl outline-none font-bold transition-all !text-[#008a45]"})]})]})]})]}),e.jsxs("div",{className:"flex flex-col items-center gap-6 pt-6 border-t border-slate-100",children:[C.text&&e.jsx("p",{className:`text-xs font-black uppercase tracking-widest ${C.type==="success"?"text-green-500":"text-red-500"}`,children:C.text}),e.jsx("button",{type:"submit",disabled:L,className:"bg-slate-900 text-white px-12 py-5 rounded-2xl font-black uppercase tracking-[0.2em] hover:bg-primary hover:scale-[1.02] active:scale-95 transition-all shadow-xl disabled:opacity-50 !text-white",children:L?"Saving Changes...":"Save Profile"})]})]})]}),f==="rewards"&&e.jsxs(N.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},className:"space-y-8",children:[e.jsxs("div",{className:"bg-white p-5 sm:p-8 rounded-2xl border border-slate-100 shadow-sm overflow-hidden relative",children:[e.jsxs("div",{className:"relative z-10 max-w-xl",children:[e.jsx("h2",{className:"text-xl sm:text-2xl font-black uppercase tracking-tight text-slate-900",children:"Rewards"}),e.jsx("p",{className:"text-sm text-slate-400 mt-1",children:"The more you fuel, the more you save!"}),e.jsxs("div",{className:"mt-6 sm:mt-8 space-y-6",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex justify-between items-end",children:[e.jsxs("p",{className:"text-[10px] font-black text-slate-400 uppercase tracking-widest",children:["Balance: ",e.jsxs("span",{className:"text-slate-900",children:[o.points," Pts"]})]}),e.jsxs("p",{className:"text-[10px] font-black text-primary uppercase tracking-widest",children:["Next: ",o.tier==="Legend Tier"?"Max Tier":o.tier==="Pro Elite"?"Legend Tier":o.tier==="Pro Member"?"Pro Elite":"Pro Member"]})]}),e.jsx("div",{className:"h-6 bg-slate-100 rounded-full border-4 border-white shadow-inner p-1",children:e.jsx("div",{className:"h-full bg-primary rounded-full transition-all duration-1000",style:{width:`${Math.min(o.points/3e3*100,100)}%`}})})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"p-4 bg-orange-50 rounded-3xl border border-orange-100",children:[e.jsx("p",{className:"text-[10px] font-bold text-orange-600 uppercase tracking-widest mb-1",children:"Conversion Rate"}),e.jsx("p",{className:"text-xl font-black text-orange-900",children:"10 Pts = â¹1"})]}),e.jsxs("div",{className:"p-4 bg-primary/5 rounded-3xl border border-primary/10",children:[e.jsx("p",{className:"text-[10px] font-bold text-primary uppercase tracking-widest mb-1",children:"Reward Multiplier"}),e.jsx("p",{className:"text-xl font-black text-slate-900",children:"1x Base"})]})]})]})]}),e.jsx("span",{className:"absolute -right-20 -bottom-20 material-symbols-outlined text-[300px] text-primary/5 select-none -rotate-12",children:"loyalty"})]}),e.jsxs("div",{className:"grid sm:grid-cols-2 gap-4",children:[e.jsxs("div",{className:"bg-white p-5 rounded-2xl border border-slate-100 shadow-sm",children:[e.jsx("h3",{className:"text-base font-black uppercase tracking-tight mb-4 text-slate-900",children:"How to earn"}),e.jsx("div",{className:"space-y-3",children:O.length>0?O.map((t,s)=>e.jsxs("div",{className:"flex items-center gap-3 p-3 bg-slate-50 rounded-xl group hover:bg-emerald-50 transition-colors",children:[e.jsx("div",{className:"w-9 h-9 rounded-lg bg-white flex items-center justify-center text-[#0b3d2e] shadow-sm flex-shrink-0",children:e.jsx("span",{className:"material-symbols-outlined text-[16px]",children:t.event_name==="purchase"?"shopping_cart":t.event_name==="signup"?"person_add":t.event_name==="review"?"rate_review":"stars"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"text-xs font-black uppercase text-slate-700 truncate",children:t.event_name.replace("_"," ")}),e.jsx("p",{className:"text-[9px] text-slate-400 font-bold uppercase tracking-wider truncate",children:t.description})]}),e.jsxs("span",{className:"font-black text-sm text-emerald-500 flex-shrink-0",children:["+",t.points]})]},s)):e.jsx("div",{className:"text-center py-6 text-slate-300",children:e.jsx("p",{className:"text-[10px] font-bold uppercase",children:"No rules configured"})})})]}),e.jsxs("div",{className:"bg-white p-5 rounded-2xl border border-slate-100 shadow-sm",children:[e.jsx("h3",{className:"text-base font-black uppercase tracking-tight mb-4 text-slate-900",children:"Tier Benefits"}),e.jsxs("div",{className:"flex flex-col items-center justify-center py-10 text-center",children:[e.jsx("span",{className:"material-symbols-outlined text-4xl text-slate-200 mb-3",children:"lock"}),e.jsx("p",{className:"text-sm font-black uppercase text-slate-400",children:"Coming Soon"}),e.jsx("p",{className:"text-[10px] font-bold text-slate-300 uppercase tracking-wider mt-1",children:"Tier benefits launching soon"})]})]})]}),e.jsxs("div",{className:"bg-[#0b3d2e] p-5 sm:p-8 rounded-2xl text-white overflow-hidden relative",children:[e.jsxs("div",{className:"relative z-10",children:[e.jsx("h3",{className:"text-lg sm:text-xl font-black uppercase tracking-tight mb-1",children:"Redeem Points"}),e.jsx("p",{className:"text-white/50 font-bold uppercase tracking-wider text-[10px] mb-5",children:"Convert points into instant discounts"}),e.jsxs("div",{className:"flex flex-col md:flex-row gap-5 items-start md:items-center",children:[e.jsxs("div",{className:"flex-1 space-y-4",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-[10px] font-black uppercase tracking-[0.2em] text-emerald-400",children:"Redeemable Value"}),e.jsxs("div",{className:"flex items-baseline gap-2 mt-1",children:[e.jsxs("span",{className:"text-4xl sm:text-5xl font-black tracking-tighter",children:["â¹",(Number(o.points||0)/10).toFixed(2)]}),e.jsx("span",{className:"text-white/60 font-bold uppercase tracking-widest text-[10px]",children:"OFF next order"})]})]}),e.jsxs("p",{className:"text-[11px] sm:text-xs text-white/70 flex items-start gap-2 bg-white/5 p-3 rounded-xl border border-white/10",children:[e.jsx("span",{className:"material-symbols-outlined text-emerald-400 text-sm",children:"info"}),e.jsx("span",{children:"Points are redeemed directly on the checkout page for an instant discount. No codes required!"})]})]}),e.jsx("div",{className:"w-full md:w-auto mt-2 md:mt-0",children:e.jsx("button",{onClick:A,className:"w-full bg-white text-[#0b3d2e] px-6 py-4 rounded-xl font-black uppercase tracking-widest hover:bg-slate-50 transition-all shadow-xl active:scale-95",children:"Shop Now"})})]})]}),e.jsx("div",{className:"absolute top-0 right-0 w-64 h-64 bg-emerald-500/20 blur-[100px] rounded-full"})]})]})]})]})]})}),e.jsx(H,{children:m&&e.jsxs("div",{className:"fixed inset-0 z-[3000] flex items-center justify-center p-4",children:[e.jsx(N.div,{initial:{opacity:0}
1,animate:{opacity:1},exit:{opacity:0},className:"absolute inset-0 bg-slate-900/60 backdrop-blur-md",onClick:()=>v(null)}),e.jsxs(N.div,{initial:{opacity:0,scale:.9,y:20},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.9,y:20},className:"bg-white w-full max-w-xl rounded-3xl overflow-hidden relative shadow-2xl p-6 sm:p-8 md:p-10 max-h-[90vh] overflow-y-auto z-10",children:[e.jsx("button",{onClick:()=>v(null),className:"absolute top-8 right-8 z-10 w-10 h-10 bg-slate-50 rounded-full flex items-center justify-center hover:bg-slate-100 transition-colors",children:e.jsx("span",{className:"material-symbols-outlined",children:"close"})}),e.jsxs("div",{className:"space-y-6 sm:space-y-8",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2 mb-3",children:[e.jsxs("span",{className:"bg-[#0b3d2e]/10 text-[#0b3d2e] px-3 py-1 rounded-full text-[10px] font-black uppercase tracking-widest",children:["Order #",m.id]}),e.jsx("span",{className:`text-[10px] font-black uppercase px-3 py-1 rounded-full ${m.status==="DELIVERED"?"bg-emerald-100 text-emerald-600":m.status==="SHIPPED"?"bg-blue-100 text-blue-600":m.status==="PAID"?"bg-emerald-100 text-emerald-600":m.status==="CANCELLED"?"bg-red-100 text-red-500":"bg-amber-100 text-amber-700"}`,children:m.status==="PAID"?"Processing":m.status})]}),e.jsx("h2",{className:"text-2xl sm:text-3xl md:text-4xl font-black text-slate-900 uppercase tracking-tight leading-none",children:"Order Details"}),e.jsxs("p",{className:"text-slate-400 font-bold uppercase tracking-wider text-[10px] mt-2",children:["Placed on ",new Date(m.created_at).toLocaleDateString()]})]}),e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-3 gap-3",children:[e.jsxs("div",{className:"p-4 bg-slate-50 rounded-2xl border border-slate-100",children:[e.jsx("p",{className:"text-[9px] font-bold text-slate-400 uppercase tracking-widest mb-1",children:"Total"}),e.jsxs("p",{className:"text-xl font-black text-slate-900",children:["â¹",m.total_amount]})]}),e.jsxs("div",{className:"p-4 bg-slate-50 rounded-2xl border border-slate-100",children:[e.jsx("p",{className:"text-[9px] font-bold text-slate-400 uppercase tracking-widest mb-1",children:"Items"}),e.jsx("p",{className:"text-xl font-black text-slate-900",children:m.items.length})]}),e.jsxs("div",{className:"p-4 bg-slate-50 rounded-2xl border border-slate-100 col-span-2 md:col-span-1",children:[e.jsx("p",{className:"text-[9px] font-bold text-slate-400 uppercase tracking-widest mb-1",children:"Delivery"}),e.jsx("p",{className:"text-sm font-black text-slate-900 truncate",children:m.city||"Standard Delivery"})]})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx("h3",{className:"text-base font-black uppercase tracking-tight text-slate-900 mb-2",children:"Purchased Items"}),e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:m.items.map((t,s)=>e.jsxs("div",{className:"flex gap-3 p-3 bg-white border border-slate-100 rounded-2xl items-center shadow-sm",children:[e.jsx("div",{className:"w-14 h-14 bg-slate-50 rounded-xl overflow-hidden flex-shrink-0",children:t.product_image?e.jsx("img",{src:t.product_image.startsWith("http")?t.product_image:`${b}${t.product_image}`,alt:t.product_name,className:"w-full h-full object-cover"}):e.jsx("div",{className:"w-full h-full flex items-center justify-center text-slate-200",children:e.jsx("span",{className:"material-symbols-outlined text-2xl",children:"image"})})}),e.jsxs("div",{className:"overflow-hidden min-w-0",children:[e.jsx("h4",{className:"font-black text-xs uppercase leading-tight truncate text-slate-900",children:t.product_name}),e.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[e.jsxs("span",{className:"text-[9px] font-bold text-slate-500 bg-slate-100 px-2 py-0.5 rounded-full",children:["QTY: ",t.quantity]}),e.jsxs("p",{className:"text-[10px] font-bold text-slate-400 uppercase tracking-widest",children:["â¹",t.price]})]})]})]},s))})]}),e.jsxs("div",{className:"pt-6 mt-6 border-t border-slate-100 flex flex-col items-center",children:[e.jsx("p",{className:"text-center text-slate-400 font-satoshi text-sm sm:text-base",children:"Fueling your ambition, one bite at a time! ð"}),e.jsx("button",{onClick:()=>v(null),className:"mt-4 text-[9px] font-black uppercase tracking-widest text-slate-400 hover:text-slate-600 transition-colors",children:"Close Details"})]})]})]})]})})]})};export{re as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.