import{j as e}from"./vendor-ui-CUslpDkL.js";import{i as o,L as l}from"./vendor-react-Dg0Tra3e.js";import{u as c}from"./vendor-query-CN1EccJz.js";import{B as a,C as d,E as x,s as u}from"./index-CJqEbhJN.js";import{A as n}from"./arrow-left-DtOv4JyO.js";import{f as h}from"./format-BrSaXzvW.js";import"./vendor-supabase-yzuDJZPy.js";import"./vendor-motion-CiNtJfg1.js";function w(){const{id:t}=o(),{data:s,isLoading:m}=c({queryKey:["article",t],queryFn:async()=>{const{data:r,error:i}=await u.from("articles").select("*").eq("id",t).single();if(i)throw i;return r}});return m?e.jsx("div",{className:"min-h-screen flex items-center justify-center",children:e.jsx("div",{className:"animate-pulse text-muted-foreground",children:"Loading article..."})}):s?e.jsx("div",{className:"min-h-screen",children:e.jsxs("div",{className:"mx-auto max-w-4xl px-4 py-12",children:[e.jsx(l,{to:"/",className:"inline-block mb-6",children:e.jsxs(a,{variant:"ghost",size:"sm",children:[e.jsx(n,{className:"w-4 h-4 mr-2"}),"Back to Home"]})}),s.image_url&&e.jsxs("div",{className:"relative h-[400px] w-full overflow-hidden rounded-lg mb-8",children:[e.jsx("img",{src:s.image_url,alt:s.title,className:"w-full h-full object-cover"}),e.jsx("div",{className:"absolute inset-0 bg-gradient-to-t from-card via-card/50 to-transparent"})]}),e.jsxs("div",{className:"glass-card p-8",children:[s.topics&&s.topics.length>0&&e.jsx("div",{className:"flex flex-wrap gap-2 mb-4",children:s.topics.map(r=>e.jsx("span",{className:"px-3 py-1 text-xs font-semibold rounded-full bg-primary/20 text-primary",children:r},r))}),e.jsx("h1",{className:"text-4xl font-bold mb-4",children:s.title}),s.published_at&&e.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground mb-6",children:[e.jsx(d,{className:"w-4 h-4"}),h(new Date(s.published_at),"MMMM d, yyyy")]}),s.summary&&e.jsxs("div",{className:"mb-6 pb-6 border-b border-white/10",children:[e.jsx("h3",{className:"text-xl font-semibold mb-3 text-primary",children:"Summary"}),e.jsx("p",{className:"text-lg text-muted-foreground leading-relaxed",children:s.summary})]}),s.content&&e.jsx("div",{className:"prose prose-invert prose-lg max-w-none mb-8",children:e.jsx("div",{className:"whitespace-pre-wrap leading-relaxed text-foreground",children:s.content})}),s.url&&e.jsxs("div",{className:"mt-8 pt-6 border-t border-white/10",children:[e.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:"Want to learn more? Visit the original source for additional details."}),e.jsx("a",{href:s.url,target:"_blank",rel:"noopener noreferrer",className:"inline-block",children:e.jsxs(a,{variant:"outline",className:"glass-card border-primary/30",children:["View Original Source",e.jsx(x,{className:"w-4 h-4 ml-2"})]})})]})]})]})}):e.jsxs("div",{className:"min-h-screen flex flex-col items-center justify-center gap-4",children:[e.jsx("p",{className:"text-muted-foreground",children:"Article not found"}),e.jsx(l,{to:"/",children:e.jsxs(a,{variant:"outline",children:[e.jsx(n,{className:"w-4 h-4 mr-2"}),"Back to Home"]})})]})}export{w as default};