1import{j as e,m as o}from"./vendor-motion-DEChu8RX.js";import{l as n,u as b,H as h,S as v,B as c,A as w,F as f,P as C,L as k,t as F}from"./index-BmJBNlQp.js";import{r as d,L as x}from"./vendor-react-j-mrhLhJ.js";import{A as S}from"./arrow-left-BkEmzGWc.js";import{T as q,L as T}from"./trash-2-Ds39G0xo.js";import{M as L}from"./minus-B3wXoV22.js";import{S as R}from"./star-CEI5JshD.js";import"./vendor-radix-C1wOSltO.js";import"./vendor-query-CEvb3ijA.js";const m=d.forwardRef(({className:a,...r},t)=>e.jsx("div",{ref:t,className:n("rounded-lg border bg-card text-card-foreground shadow-sm",a),...r}));m.displayName="Card";const I=d.forwardRef(({className:a,...r},t)=>e.jsx("div",{ref:t,className:n("flex flex-col space-y-1.5 p-6",a),...r}));I.displayName="CardHeader";const P=d.forwardRef(({className:a,...r},t)=>e.jsx("h3",{ref:t,className:n("text-2xl font-semibold leading-none tracking-tight",a),...r}));P.displayName="CardTitle";const z=d.forwardRef(({className:a,...r},t)=>e.jsx("p",{ref:t,className:n("text-sm text-muted-foreground",a),...r}));z.displayName="CardDescription";const u=d.forwardRef(({className:a,...r},t)=>e.jsx("div",{ref:t,className:n("p-6 pt-0",a),...r}));u.displayName="CardContent";const A=d.forwardRef(({className:a,...r},t)=>e.jsx("div",{ref:t,className:n("flex items-center p-6 pt-0",a),...r}));A.displayName="CardFooter";const K=()=>{const{items:a,removeItem:r,updateQuantity:t,clearCart:j,isLoading:i,isSyncing:p,getCheckoutUrl:g}=b(),N=a.reduce((s,l)=>s+parseFloat(l.price.amount)*l.quantity,0),y=()=>{const s=g();s&&(F(a.map(l=>({item_id:l.variantId,item_name:l.product.node.title,price:parseFloat(l.price.amount),quantity:l.quantity}))),window.open(s,"_blank"))};return a.length===0?e.jsxs("div",{className:"min-h-screen bg-background",children:[e.jsx(h,{}),e.jsx("main",{className:"pt-32 pb-20",children:e.jsx("div",{className:"container mx-auto px-4 lg:px-8 max-w-3xl",children:e.jsxs(o.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},className:"text-center py-20",children:[e.jsx("div",{className:"w-20 h-20 bg-muted rounded-full flex items-center justify-center mx-auto mb-6",children:e.jsx(v,{className:"w-10 h-10 text-muted-foreground"})}),e.jsx("h1",{className:"font-display text-3xl text-foreground mb-4",children:"Your Cart is Empty"}),e.jsx("p",{className:"text-muted-foreground mb-8",children:"Browse our sleep essentials to find your perfect routine."}),e.jsxs("div",{className:"flex flex-col sm:flex-row gap-4 justify-center",children:[e.jsx(c,{variant:"calm",size:"lg",asChild:!0,children:e.jsxs(x,{to:"/sleep-quiz",children:["Take the Sleep Quiz",e.jsx(w,{className:"w-4 h-4 ml-2"})]})}),e.jsx(c,{variant:"outline",size:"lg",asChild:!0,children:e.jsx(x,{to:"/shop",children:"Browse Products"})})]})]})})}),e.jsx(f,{})]}):e.jsxs("div",{className:"min-h-screen bg-background",children:[e.jsx(h,{}),e.jsx("main",{className:"pt-32 pb-20",children:e.jsx("div",{className:"container mx-auto px-4 lg:px-8 max-w-4xl",children:e.jsxs(o.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},children:[e.jsxs("div",{className:"mb-10",children:[e.jsxs(x,{to:"/shop",className:"inline-flex items-center text-sm text-muted-foreground hover:text-foreground transition-colors mb-6",children:[e.jsx(S,{className:"w-4 h-4 mr-2"}),"Continue Shopping"]}),e.jsx("h1",{className:"font-display text-4xl text-foreground",children:"Your Cart"})]}),e.jsxs("div",{className:"grid lg:grid-cols-3 gap-8",children:[e.jsxs("div",{className:"lg:col-span-2 space-y-4",children:[a.map((s,l)=>e.jsx(o.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{delay:l*.1},children:e.jsx(m,{className:"border-border/50",children:e.jsx(u,{className:"p-4 lg:p-6",children:e.jsxs("div",{className:"flex gap-4",children:[e.jsx("div",{className:"w-24 h-24 lg:w-28 lg:h-28 flex-shrink-0 bg-muted rounded overflow-hidden",children:s.product.node.images?.edges?.[0]?.node&&e.jsx("img",{src:s.product.node.images.edges[0].node.url,alt:`${s.product.node.title} in your cart`,loading:"lazy",decoding:"async",className:"w-full h-full object-cover"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsx("h3",{className:"font-display text-lg text-foreground",children:s.product.node.title}),e.jsx("button",{onClick:()=>r(s.variantId),className:"text-muted-foreground hover:text-foreground transition-colors p-1",disabled:i,children:e.jsx(q,{className:"w-4 h-4"})})]}),s.variantTitle!=="Default Title"&&e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:s.variantTitle}),e.jsxs("div",{className:"flex items-end justify-between mt-4",children:[e.jsxs("div",{className:"flex items-center border border-border rounded",children:[e.jsx("button",{onClick:()=>t(s.variantId,s.quantity-1),className:"p-2 hover:bg-muted transition-colors",disabled:i,children:e.jsx(L,{className:"w-3 h-3"})}),e.jsx("span",{className:"px-4 text-sm font-medium",children:s.quantity}),e.jsx("button",{onClick:()=>t(s.variantId,s.quantity+1),className:"p-2 hover:bg-muted transition-colors",disabled:i,children:e.jsx(C,{className:"w-3 h-3"})})]}),e.jsxs("p",{className:"font-medium text-foreground",children:["£",(parseFloat(s.price.amount)*s.quantity).toFixed(2)]})]})]})]})})})},s.variantId)),e.jsx("button",{onClick:j,className:"text-sm text-muted-foreground hover:text-foreground transition-colors",children:"Clear cart"})]}),e.jsx("div",{className:"lg:col-span-1",children:e.jsx(m,{className:"border-foreground
1/20 bg-muted/30 sticky top-32",children:e.jsxs(u,{className:"p-6",children:[e.jsx("h3",{className:"font-display text-xl text-foreground mb-6",children:"Order Summary"}),e.jsx("div",{className:"space-y-3 mb-6",children:a.map(s=>e.jsxs("div",{className:"flex justify-between text-sm",children:[e.jsxs("span",{className:"text-muted-foreground",children:[s.product.node.title," à ",s.quantity]}),e.jsxs("span",{className:"text-foreground",children:["£",(parseFloat(s.price.amount)*s.quantity).toFixed(2)]})]},s.variantId))}),e.jsxs("div",{className:"border-t border-border pt-4 mb-6",children:[e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("span",{className:"font-display text-lg text-foreground",children:"Total"}),e.jsxs("span",{className:"font-display text-2xl text-foreground",children:["£",N.toFixed(2)]})]}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Shipping calculated at checkout"})]}),e.jsx(c,{variant:"calm",size:"xl",className:"w-full gap-2",onClick:y,disabled:i||p,children:i||p?e.jsx(k,{className:"w-4 h-4 animate-spin"}):e.jsxs(e.Fragment,{children:[e.jsx(T,{className:"w-4 h-4"}),"Checkout Securely"]})}),e.jsx("div",{className:"flex items-center justify-center gap-3 mt-4",children:["Visa","Mastercard","PayPal","Apple Pay","Klarna"].map(s=>e.jsx("span",{className:"text-[10px] text-muted-foreground/70 border border-border/60 px-2 py-0.5 rounded",children:s},s))}),e.jsx("p",{className:"text-[11px] text-muted-foreground/70 text-center mt-2",children:"30-day money-back guarantee · Free shipping over £20"}),e.jsxs("div",{className:"flex items-center justify-center gap-1.5 mt-3",children:[e.jsx("div",{className:"flex items-center gap-0.5",children:[...Array(5)].map((s,l)=>e.jsx(R,{className:"w-3 h-3 fill-star text-star"},l))}),e.jsx("span",{className:"text-[10px] text-muted-foreground/80",children:"Trusted by 250,000+ customers"})]})]})})})]})]})})}),e.jsx(f,{})]})};export{K 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.