import{j as e}from"./vendor-ui-CUslpDkL.js";import{u as j}from"./vendor-query-CN1EccJz.js";import{c as u,C as b,b as y,w as N,x as v,B as d,n as w,s as k}from"./index-CJqEbhJN.js";import{r as h,L as p,i as _}from"./vendor-react-Dg0Tra3e.js";import{S as B}from"./SEOBreadcrumbs-D0bs6Ngm.js";import{B as I}from"./badge-But4vkun.js";import{U as f}from"./upload-DQzlkcfH.js";import{S}from"./share-2-CprN_Tkl.js";import{A as M}from"./arrow-left-DtOv4JyO.js";import"./vendor-supabase-yzuDJZPy.js";import"./vendor-motion-CiNtJfg1.js";/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const C=u("Bookmark",[["path",{d:"m19 21-7-4-7 4V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2v16z",key:"1fy3hk"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const A=u("List",[["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 18h.01",key:"1tta3j"}],["path",{d:"M3 6h.01",key:"1rqtza"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 18h13",key:"1lx6n3"}],["path",{d:"M8 6h13",key:"ik3vkj"}]]);function L({post:r}){return e.jsxs("header",{className:"relative",children:[r.cover_image_url&&e.jsxs("div",{className:"absolute inset-0 h-[520px] overflow-hidden",children:[e.jsx("img",{src:r.cover_image_url,alt:"","aria-hidden":"true",className:"w-full h-full object-cover opacity-25 scale-105"}),e.jsx("div",{className:"absolute inset-0 bg-gradient-to-b from-background/40 via-background/80 to-background"})]}),e.jsx("div",{className:"relative max-w-7xl mx-auto px-4 pt-4 pb-10",children:e.jsxs("div",{className:"max-w-prose space-y-5",children:[e.jsx(I,{variant:"secondary",className:"bg-primary/20 text-primary border-primary/30 uppercase tracking-wider text-xs",children:r.category}),e.jsx("h1",{className:"text-3xl sm:text-4xl md:text-5xl lg:text-6xl font-bold leading-tight",children:e.jsx("span",{className:"bg-gradient-to-r from-primary via-primary-glow to-accent bg-clip-text text-transparent",children:r.title})}),e.jsx("p",{className:"text-lg text-muted-foreground leading-relaxed max-w-xl",children:r.excerpt}),e.jsxs("div",{className:"flex flex-wrap items-center gap-5 text-sm text-muted-foreground pt-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(b,{className:"h-4 w-4 text-primary"}),e.jsx("time",{dateTime:r.created_at,children:new Date(r.created_at).toLocaleDateString("en-US",{year:"numeric",month:"long",day:"numeric"})})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(y,{className:"h-4 w-4 text-primary"}),e.jsxs("span",{children:[r.read_time_minutes," min read"]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(N,{className:"h-4 w-4 text-primary"}),e.jsx("span",{children:"What-Anime Team"})]})]})]})}),r.cover_image_url&&e.jsx("div",{className:"max-w-5xl mx-auto px-4 -mt-2 mb-10",children:e.jsxs("div",{className:"relative rounded-xl overflow-hidden border border-white/10 shadow-2xl",children:[e.jsx("img",{src:r.cover_image_url,alt:r.title,className:"w-full h-auto max-h-[480px] object-cover",loading:"eager"}),e.jsx("div",{className:"absolute inset-0 bg-gradient-to-t from-background/20 to-transparent pointer-events-none"})]})})]})}function z({headings:r}){const[t,s]=h.useState("");return h.useEffect(()=>{if(r.length===0)return;const n=new IntersectionObserver(a=>{const o=a.find(i=>i.isIntersecting);o&&s(o.target.id)},{rootMargin:"-80px 0px -60% 0px",threshold:.1});return r.forEach(({id:a})=>{const o=document.getElementById(a);o&&n.observe(o)}),()=>n.disconnect()},[r]),r.length<3?null:e.jsx("aside",{className:"hidden lg:block w-64 shrink-0","aria-label":"Table of contents",children:e.jsx("nav",{className:"sticky top-24",children:e.jsxs("div",{className:"glass-card p-5 border border-white/10",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-4 text-sm font-semibold text-foreground uppercase tracking-wider",children:[e.jsx(A,{className:"h-4 w-4 text-primary"}),"Contents"]}),e.jsx("ul",{className:"space-y-1.5",children:r.map(({id:n,text:a})=>e.jsx("li",{children:e.jsx("a",{href:`#${n}`,onClick:o=>{o.preventDefault(),document.getElementById(n)?.scrollIntoView({behavior:"smooth"})},className:`block text-sm py-1.5 px-3 rounded-md transition-all duration-200 leading-snug ${t===n?"text-primary bg-primary/10 font-medium":"text-muted-foreground hover:text-foreground hover:bg-white/5"}`,children:a})},n))})]})})})}const m=r=>{const t=[];let s=r,n=0;for(;s.length>0;){const a=s.match(/^(\*\*|__)(.+?)\1/);if(a){t.push(e.jsx("strong",{className:"font-semibold text-foreground",children:a[2]},n++)),s=s.slice(a[0].length);continue}const o=s.match(/^(\*|_)(?!\1)(.+?)\1(?!\1)/);if(o){t.push(e.jsx("em",{className:"italic",children:o[2]},n++)),s=s.slice(o[0].length);continue}const i=s.match(/^\[([^\]]+)\]\(([^)]+)\)/);if(i){t.push(e.jsx("a",{href:i[2],target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:i[1]},n++)),s=s.slice(i[0].length);continue}const l=s.search(/[\*_\[]/);if(l===-1){t.push(s);break}else l===0?(t.push(s[0]),s=s.slice(1)):(t.push(s.slice(0,l)),s=s.slice(l))}return t},g=({content:r})=>{const t=r.split(`
`),s=[];let n=0,a=0;for(;a<t.length;){const i=t[a].trim();if(i===""){a++;continue}if(i==="---"||i==="***"||i==="___"){s.push(e.jsx("hr",{className:"my-8 border-t border-white/10"},n++)),a++;continue}if(i.startsWith("## ")){const l=i.slice(3),c=l.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/(^-|-$)/g,"");s.push(e.jsxs("h2",{id:c,className:"text-2xl md:text-3xl font-bold mt-10 mb-4 text-foreground flex items-center gap-3 scroll-mt-24",children:[e.jsx("span",{className:"h-8 w-1 bg-gradient-to-b from-primary to-secondary rounded-full"}),m(l)]},n++)),a++;continue}if(i.startsWith("### ")){const l=i.slice(4),c=l.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/(^-|-$)/g,"");s.push(e.jsx("h3",{id:c,className:"text-xl md:text-2xl font-semibold mt-8 mb-3 text-foreground scroll-mt-24",children:m(l)},n++)),a++;continue}if(i.startsWith("#### ")){s.push(e.jsx("h4",{className:"text-lg md:text-xl font-semibold mt-6 mb-2 text-foreground",children:m(i.slice(5))},n++)),a++;continue}if(/^[-*]\s/.test(i)){const l=[];for(;a<t.length&&/^[-*]\s/.test(t[a].trim());){const c=t[a].trim().slice(2);l.push(e.jsxs("li",{className:"flex items-start gap-3 mb-3",children:[e.jsx("span",{className:"mt-2 h-2 w-2 rounded-full bg-primary shrink-0"}),e.jsx("span",{children:m(c)})]},l.length)),a++}s.push(e.jsx("ul",{className:"my-6 space-y-1 text-muted-foreground",children:l},n++));continue}if(/^\d+\.\s/.test(i)){const l=[];let c=1;for(;a<t.length&&/^\d+\.\s/.test(t[a].trim());){const x=t[a].trim().replace(/^\d+\.\s/,"");l.push(e.jsxs("li",{className:"flex items-start gap-4 mb-3",children:[e.jsx("span",{className:"flex-shrink-0 w-7 h-7 rounded-full bg-primary/20 text-primary text-sm font-bold flex items-center justify-center",children:c}),e.jsx("span",{className:"pt-0.5",children:m(x)})]},l.length)),a++,c++}s.push(e.jsx("ol",{className:"my-6 space-y-2 text-muted-foreground",children:l},n++));continue}if(i.startsWith("> ")){const l=[];for(;a<t.length&&t[a].trim().startsWith("> ");)l.push(t[a].trim().slice(2)),a++;s.push(e.jsx("blockquote",{className:"my-8 p-6 glass-card border-l-4 border-primary/50 italic text-muted-foreground rounded-r-lg",children:l.map((c,x)=>e.jsx("p",{className:"mb-2 last:mb-0",children:m(c)},x))},n++));continue}if(/^(tip|note|pro tip):/i.test(i)){const l=i.replace(/^(tip|note|pro tip):\s*/i,"");s.push(e.jsx("div",{className:"my-6 p-5 glass-card border border-primary/30 rounded-lg",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("span",{className:"text-primary text-xl",children:"💡"}),e.jsxs("div",{children:[e.jsx("span",{className:"text-primary font-semibold text-sm uppercase tracking-wider",children:"Pro Tip"}),e.jsx("p",{className:"mt-1 text-muted-foreground",children:m(l)})]})]})},n++)),a++;continue}s.push(e.jsx("p",{className:"mb-5 text-muted-foreground leading-relaxed text-lg",children:m(i)},n++)),a++}return e.jsx("div",{className:"space-y-1",children:s})};function T({content:r}){const t=r.split(`
`),s=Math.floor(t.length/2);let n=s;for(let i=s;i<Math.min(s+20,t.length);i++)if(t[i].trim()===""){n=i;break}const a=t.slice(0,n).join(`
`),o=t.slice(n).join(`
`);return e.jsxs("section",{className:"space-y-1",children:[e.jsx("div",{className:"prose prose-invert prose-lg max-w-none [&>p]:leading-relaxed [&>p]:text-lg",children:e.jsx(g,{content:a})}),e.jsxs("div",{className:"my-12 relative overflow-hidden rounded-xl border border-primary/30 bg-gradient-to-r from-primary/10 via-card to-secondary/10 p-6 sm:p-8",children:[e.jsx("div",{className:"absolute inset-0 bg-[radial-gradient(ellipse_at_top_right,hsl(335_100%_68%/0.08),transparent_60%)]"}),e.jsxs("div",{className:"relative flex flex-col sm:flex-row items-center gap-5",children:[e.jsx("div",{className:"flex-shrink-0 w-14 h-14 rounded-full bg-primary/20 flex items-center justify-center",children:e.jsx(v,{className:"h-7 w-7 text-primary animate-glow-pulse"})}),e.jsxs("div",{className:"flex-1 text-center sm:text-left",children:[e.jsx("p",{className:"text-lg font-bold text-foreground mb-1",children:"Can't remember the name of an anime?"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Initiate a scan — our AI identifies any anime from a single screenshot in seconds."})]}),e.jsx(p,{to:"/",className:"shrink-0",children:e.jsxs(d,{size:"lg",className:"bg-gradient-to-r from-primary to-secondary hover:opacity-90 text-primary-foreground font-semibold neon-glow-pink gap-2",children:[e.jsx(f,{className:"h-5 w-5"}),"Upload Screenshot"]})})]})]}),e.jsx("div",{className:"prose prose-invert prose-lg max-w-none [&>p]:leading-relaxed [&>p]:text-lg",children:e.jsx(g,{content:o})})]})}function W({post:r}){const t=async()=>{const s=`https://www.what-anime.com/blog/${r.slug}`;if(navigator.share)try{await navigator.share({title:r.title,url:s})}catch{}else await navigator.clipboard.writeText(s)};return e.jsxs("footer",{className:"mt-16 space-y-10",children:[e.jsxs("div",{className:"flex items-center justify-between pb-6 border-b border-white/10",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"h-1 w-16 bg-gradient-to-r from-primary to-secondary rounded-full"}),e.jsx("span",{className:"text-sm text-muted-foreground",children:"End of Article"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(d,{variant:"ghost",size:"sm",onClick:t,className:"text-muted-foreground hover:text-primary",children:[e.jsx(S,{className:"h-4 w-4 mr-1"}),"Share"]}),e.jsxs(d,{variant:"ghost",size:"sm",className:"text-muted-foreground hover:text-primary",children:[e.jsx(C,{className:"h-4 w-4 mr-1"}),"Save"]})]})]}),e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("div",{className:"w-14 h-14 rounded-full bg-gradient-to-br from-primary to-secondary flex items-center justify-center text-primary-foreground font-bold text-xl",children:"WA"}),e.jsxs("div",{children:[e.jsx("p",{className:"font-semibold text-foreground",children:"What-Anime Team"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Passionate about helping fans discover anime"})]})]}),e.jsxs("div",{className:"glass-card p-8 text-center border border-primary/20",children:[e.jsx("h3",{className:"text-xl font-bold mb-2",children:"Identify Any Anime Scene"}),e.jsx("p",{className:"text-muted-foreground mb-4",children:"Upload a screenshot and find out which anime it's from instantly."}),e.jsx(p,{to:"/",children:e.jsxs(d,{className:"bg-gradient-to-r from-primary to-secondary hover:opacity-90 gap-2",children:[e.jsx(f,{className:"h-4 w-4"}),"Try Scene Search"]})})]})]})}function E(r){return r.split(`
`).filter(s=>s.trim().startsWith("## ")).map(s=>{const n=s.trim().slice(3);return{id:n.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/(^-|-$)/g,""),text:n.replace(/\*\*/g,"")}})}function K(){const{slug:r}=_(),{data:t,isLoading:s}=j({queryKey:["blog-post",r],queryFn:async()=>{const{data:i,error:l}=await k.from("blog_posts").select("*").eq("slug",r).maybeSingle();if(l)throw l;return i}}),n=h.useMemo(()=>t?.content?E(t.content):[],[t?.content]);if(s)return e.jsx("div",{className:"min-h-screen py-8 px-4",children:e.jsx("div",{className:"max-w-4xl mx-auto",children:e.jsxs("div",{className:"animate-pulse space-y-8",children:[e.jsx("div",{className:"h-8 bg-muted rounded w-3/4"}),e.jsx("div",{className:"h-4 bg-muted rounded w-1/4"}),e.jsx("div",{className:"h-96 bg-muted rounded"}),e.jsxs("div",{className:"space-y-4",children:[e.jsx("div",{className:"h-4 bg-muted rounded"}),e.jsx("div",{className:"h-4 bg-muted rounded"}),e.jsx("div",{className:"h-4 bg-muted rounded w-5/6"})]})]})})});if(!t)return e.jsx("div",{className:"min-h-screen py-8 px-4",children:e.jsxs("div",{className:"max-w-4xl mx-auto text-center",children:[e.jsx("h1",{className:"text-3xl font-bold mb-4",children:"Post Not Found"}),e.jsx("p",{className:"text-muted-foreground mb-8",children:"The blog post you're looking for doesn't exist."}),e.jsx(p,{to:"/blog",children:e.jsxs(d,{children:[e.jsx(M,{className:"mr-2 h-4 w-4"}),"Back to Blog"]})})]})});const a=`https://www.what-anime.com/blog/${t.slug}`,o={"@context":"https://schema.org","@type":"BlogPosting",headline:t.title,description:t.excerpt,image:t.cover_image_url||"",datePublished:t.created_at,dateModified:t.updated_at,author:{"@type":"Organization",name:"What-Anime.com"},publisher:{"@type":"Organization",name:"What-Anime.com",logo:{"@type":"ImageObject",url:"https://www.what-anime.com/favicon.ico"}},mainEntityOfPage:{"@type":"WebPage","@id":a}};return e.jsxs(e.Fragment,{children:[e.jsxs(w,{children:[e.jsxs("title",{children:[t.title," | What-Anime.com"]}),e.jsx("meta",{name:"description",content:t.excerpt}),e.jsx("meta",{property:"og:title",content:t.title}),e.jsx("meta",{property:"og:description",content:t.excerpt}),e.jsx("meta",{property:"og:type",content:"article"}),e.jsx("meta",{property:"og:url",content:a}),t.cover_image_url&&e.jsx("meta",{property:"og:image",content:t.cover_image_url}),e.jsx("meta",{name:"twitter:card",content:"summary_large_image"}),e.jsx("meta",{name:"twitter:title",content:t.title}),e.jsx("meta",{name:"twitter:description",content:t.excerpt}),t.cover_image_url&&e.jsx("meta",{name:"twitter:image",content:t.cover_image_url}),e.jsx("link",{rel:"canonical",href:a}),e.jsx("script",{type:"application/ld+json",children:JSON.stringify(o)})]}),e.jsxs("article",{className:"min-h-screen",children:[e.jsx("div",{className:"max-w-7xl mx-auto px-4 pt-6",children:e.jsx(B,{items:[{label:"Blog",href:"/blog"},{label:t.category,href:`/blog?category=${encodeURIComponent(t.category)}`},{label:t.title}]})}),e.jsx(L,{post:t}),e.jsx("div",{className:"max-w-7xl mx-auto px-4 pb-16",children:e.jsxs("div",{className:"flex gap-10",children:[e.jsx(z,{headings:n}),e.jsxs("div",{className:"flex-1 min-w-0 max-w-prose mx-auto lg:mx-0",children:[e.jsx(T,{content:t.content}),e.jsx(W,{post:t})]})]})})]})]})}export{K as default};