import{r as u,j as e,B as k,u as A,x as R,z as B,I as T,O as U,l as w,C as _}from"./index-OGHjpQkG.js";import{g as L,b as M,c as E,C as D}from"./blogArticles-CgRMy2AW.js";import{g as P}from"./blogAuthors-DbgqyNiY.js";import F from"./NotFoundPage-C2s77dZi.js";import{A as q}from"./arrow-left-LN6wfIGZ.js";import{U as $}from"./user-ClQGwE79.js";function O({content:i}){const[a,c]=u.useState([]),[t,h]=u.useState("");return u.useEffect(()=>{const l=document.createElement("div");l.innerHTML=i;const s=Array.from(l.querySelectorAll("h2, h3")).map(r=>({id:r.id,text:r.textContent,level:r.tagName.toLowerCase()}));c(s)},[i]),u.useEffect(()=>{if(a.length===0)return;const l=new IntersectionObserver(s=>{for(const r of s)if(r.isIntersecting){h(r.target.id);break}},{rootMargin:"-80px 0px -60% 0px"});for(const s of a){const r=document.getElementById(s.id);r&&l.observe(r)}return()=>l.disconnect()},[a]),a.length<2?null:e.jsxs("nav",{className:"za-card rounded-xl p-5 mb-8 sticky top-24","aria-label":"Table of Contents",children:[e.jsx("h4",{className:"text-xs uppercase tracking-widest za-gold mb-3 za-display",children:"On This Page"}),e.jsx("ul",{className:"space-y-1.5",children:a.map((l,s)=>e.jsx("li",{children:e.jsx("a",{href:`#${l.id}`,onClick:r=>{r.preventDefault();const f=document.getElementById(l.id);f&&f.scrollIntoView({behavior:"smooth",block:"start"})},className:`block text-sm py-1 transition-colors ${l.level==="h3"?"pl-4":""} ${t===l.id?"za-gold":"za-ink-dim hover:text-current"}`,children:l.text})},`${l.id}-${s}`))})]})}function S({title:i,url:a,description:c}){const t={url:encodeURIComponent(`${k}${a}`),title:encodeURIComponent(i),desc:encodeURIComponent(c||"")},h=[{name:"Twitter",href:`https://twitter.com/intent/tweet?text=${t.title}&url=${t.url}`},{name:"Facebook",href:`https://www.facebook.com/sharer/sharer.php?u=${t.url}`},{name:"Pinterest",href:`https://pinterest.com/pin/create/button/?url=${t.url}&description=${t.desc}`},{name:"Copy Link",href:"#",copy:!0}],l=s=>{var r;s.preventDefault(),(r=navigator.clipboard)==null||r.writeText(`${k}${a}`)};return e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-xs za-ink-dim uppercase tracking-wider",children:"Share"}),h.map(s=>e.jsx("a",{href:s.copy?"#":s.href,target:s.copy?void 0:"_blank",rel:s.copy?void 0:"noopener noreferrer",onClick:s.copy?l:void 0,className:"za-focus za-surface2 hover:za-bg-gold hover:text-white rounded-full px-3 py-1.5 text-xs transition-colors",children:s.name},s.name))]})}function H({articles:i,onNav:a}){return i.length===0?null:e.jsxs("div",{className:"mb-10",children:[e.jsx("h3",{className:"za-display text-xl mb-4",children:"Related Articles"}),e.jsx("div",{className:"grid sm:grid-cols-3 gap-4",children:i.map(c=>e.jsxs("button",{onClick:()=>a("blog-article",{slug:c.slug}),className:"za-focus za-card za-card-hover rounded-xl p-4 text-left",children:[e.jsx("p",{className:"text-xs za-ink-dim uppercase tracking-wider mb-1",children:c.category.replace(/-/g," ")}),e.jsx("p",{className:"za-display text-sm leading-snug",children:c.title}),e.jsx("p",{className:"text-xs za-ink-dim mt-2 line-clamp-2",children:c.excerpt})]},c.id))})]})}function W({slugs:i,onNav:a,heading:c,max:t=8}){const{products:h}=A(),l=i.map(s=>h.find(r=>r.slug===s&&r.enabled)).filter(Boolean).slice(0,t);return l.length===0?null:e.jsxs("div",{className:"mb-12",children:[e.jsx("h3",{className:"za-display text-2xl mb-6 flex items-center gap-2",children:e.jsx("span",{className:"za-gold",children:c||"Related Collections"})}),e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-4",children:l.map(s=>{var r,f,p,y,x,d,g,m,o;return e.jsxs("div",{className:"za-focus za-card za-card-hover rounded-2xl p-4 text-left group flex flex-col",children:[e.jsx("div",{className:"w-full aspect-[2/3] rounded-xl border border-[rgba(255,255,255,0.06)] mb-3 overflow-hidden",style:{backgroundColor:((r=s.palette)==null?void 0:r[0])||"#1e1b2e"},children:s.coverUrl?e.jsx("img",{src:s.coverUrl,alt:s.displayTitle,className:"w-full h-full object-cover",loading:"lazy"}):e.jsxs("div",{className:"w-full h-full flex flex-col items-center justify-center p-3",style:{background:`linear-gradient(135deg, ${((f=s.palette)==null?void 0:f[0])||"#1e1b2e"}88, ${((p=s.palette)==null?void 0:p[1])||"#8b5cf6"}44)`},children:[e.jsx("span",{className:"za-display text-lg text-center leading-tight group-hover:za-gold transition-colors",style:{color:((y=s.palette)==null?void 0:y[1])||"#c6a15b"},children:s.displayTitle}),((x=s.genres)==null?void 0:x[0])&&e.jsx("span",{className:"text-[10px] opacity-60 mt-2 uppercase tracking-wider",children:s.genres[0]})]})}),e.jsx("p",{className:"za-display text-sm leading-snug line-clamp-2 mb-1",children:s.displayTitle}),e.jsxs("p",{className:"text-xs za-ink-dim mb-1",children:[s.years," · ",s.episodes||s.seasons," ",s.episodes?"episodes":"seasons"]}),e.jsxs("p",{className:"za-display text-sm za-gold mt-auto mb-3",children:["From $",Math.min(((g=(d=s.formats)==null?void 0:d.digital)==null?void 0:g.price)??1/0,((o=(m=s.formats)==null?void 0:m.usb)==null?void 0:o.price)??1/0).toFixed(2)]}),e.jsx("button",{onClick:()=>a("detail",{slug:s.slug}),className:"za-focus za-bg-gold text-white rounded-full px-4 py-2 text-xs za-display w-full text-center shadow-[0_8px_24px_rgba(109,74,255,0.25)] hover:shadow-[0_12px_32px_rgba(109,74,255,0.35)] transition-shadow",children:"View Collection"})]},s.id)})})]})}function G({prev:i,next:a,onNav:c}){return!i&&!a?null:e.jsxs("div",{className:"flex justify-between gap-4 mt-10 pt-8 border-t za-border",children:[e.jsx("div",{className:"flex-1",children:i?e.jsxs("button",{onClick:()=>c("blog-article",{slug:i.slug}),className:"za-focus za-card za-card-hover rounded-xl p-4 text-left w-full",children:[e.jsx("p",{className:"text-xs za-ink-dim uppercase tracking-wider mb-1",children:"Previous"}),e.jsx("p",{className:"za-display text-sm leading-snug",children:i.title})]}):e.jsx("div",{})}),e.jsx("div",{className:"flex-1",children:a?e.jsxs("button",{onClick:()=>c("blog-article",{slug:a.slug}),className:"za-focus za-card za-card-hover rounded-xl p-4 text-right w-full",children:[e.jsx("p",{className:"text-xs za-ink-dim uppercase tracking-wider mb-1",children:"Next"}),e.jsx("p",{className:"za-display text-sm leading-snug",children:a.title})]}):e.jsx("div",{})})]})}function Z({slug:i,onNav:a}){const{products:c}=A(),t=L(i),h=u.useMemo(()=>t?M(t):[],[t]),l=u.useMemo(()=>E((t==null?void 0:t.category)||"").sort((g,m)=>new Date(m.publishedDate)-new Date(g.publishedDate)),[t]),s=u.useMemo(()=>l.findIndex(d=>d.slug===i),[l,i]),r=s>0?l[s-1]:null,f=s>=0&&s<l.length-1?l[s+1]:null,p=u.useMemo(()=>{var m;if(!t)return null;const d=t.relatedProductSlugs||[],g=new Set(["Drama","Comedy","Action","Adventure","Kids","Family"]);for(const o of d){const j=c.find(n=>n.slug===o&&n.enabled);if(j&&((m=j.genres)!=null&&m.length)){const n=j.genres.find(z=>!g.has(z));if(n)return n}}return t.slug==="top-10-classic-sitcoms-every-collector-needs"?"Sitcom":null},[t,c]),y=u.useCallback(d=>{const g=d.target.closest("a");if(!g)return;const m=g.getAttribute("href");if(!m||m.startsWith("http")||m.startsWith("mailto")||m.startsWith("#"))return;d.preventDefault();const[o,j]=m.split("?"),n=new URLSearchParams(j||""),z=o.match(/^\/show\/([^/]+)$/);if(z)return a("detail",{slug:decodeURIComponent(z[1])});const N=o.match(/^\/blog\/([^/]+)$/);if(N)return a("blog-article",{slug:decodeURIComponent(N[1])});const v=o.match(/^\/blog\/category\/([^/]+)$/);if(v)return a("blog-category",{slug:decodeURIComponent(v[1])});const C=o.match(/^\/blog\/tag\/([^/]+)$/);if(C)return a("blog-tag",{slug:decodeURIComponent(C[1])});if(o==="/blog")return a("blog");if(o==="/collections"){const b={};return n.get("genre")&&(b.genre=n.get("genre")),n.get("decade")&&(b.decade=n.get("decade")),n.get("format")&&(b.format=n.get("format")),n.get("sort")&&(b.sort=n.get("sort")),n.get("q")&&(b.query=n.get("q")),n.get("wishlist")&&(b.wishlistOnly=!0),a("listing",b)}const I=o.match(/^\/pages\/([^/]+)$/);if(I)return a("trust",{page:I[1]});if(o==="/"||o==="")return a("home");if(o==="/checkout")return a("checkout");if(o==="/my-orders")return a("myorders");a("listing",{query:m.replace(/^\//,"")})},[a]);if(!t)return e.jsx(F,{onNav:a});R({title:t.seoTitle||t.title,description:t.excerpt,path:`/blog/${i}`,image:t.featuredImage?t.featuredImage.startsWith("http")?t.featuredImage:`${k}${t.featuredImage}`:U,keywords:t.tags.join(", "),jsonLd:T(t),jsonLdExtra:[B([{name:"Home",url:"/"},{name:"Blog",url:"/blog"},{name:t.category.replace(/-/g," "),url:`/blog/category/${t.category}`},{name:t.title}])]});const x=P(t.author);return e.jsx("div",{className:"za-fade-view",children:e.jsxs("div",{className:"max-w-[1400px] mx-auto px-5 sm:px-8 lg:px-12 py-10 sm:py-14",children:[e.jsxs("nav",{"aria-label":"Breadcrumb",className:"flex items-center gap-2 text-xs za-ink-dim mb-8 flex-wrap",children:[e.jsx("button",{onClick:()=>a("home"),className:"za-focus hover:text-current",children:"Home"}),e.jsx(w,{size:12}),e.jsx("button",{onClick:()=>a("blog"),className:"za-focus hover:text-current",children:"Blog"}),e.jsx(w,{size:12}),e.jsx("button",{onClick:()=>a("blog-category",{slug:t.category}),className:"za-focus hover:text-current",children:t.category.replace(/-/g," ")}),e.jsx(w,{size:12}),e.jsx("span",{"aria-current":"page",className:"truncate max-w-[200px] sm:max-w-[400px]",children:t.title})]}),e.jsxs("div",{className:"flex flex-col lg:flex-row gap-10",children:[e.jsxs("article",{className:"flex-1 min-w-0 max-w-[860px]",children:[e.jsxs("button",{onClick:()=>a("blog"),className:"za-focus flex items-center gap-1.5 text-xs za-ink-dim hover:text-current mb-6",children:[e.jsx(q,{size:13})," Back to Blog"]}),t.featuredImage&&e.jsx("div",{className:"w-full rounded-2xl mb-8 aspect-[16/9] shadow-lg overflow-hidden bg-black/20 flex items-center justify-center",children:e.jsx("img",{src:t.featuredImage,alt:t.featuredImageAlt||t.title,className:"max-w-full max-h-full object-contain",loading:"eager"})}),e.jsx("h1",{className:"za-display text-3xl sm:text-4xl lg:text-5xl leading-[1.05] mb-6",children:t.title}),e.jsxs("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-1.5 text-sm za-ink-dim mb-8",children:[e.jsxs("button",{onClick:()=>a("blog-author",{slug:x.slug}),className:"za-focus flex items-center gap-1.5 hover:text-current",children:[e.jsx($,{size:14})," ",t.author]}),e.jsx("span",{children:"·"}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(D,{size:13})," ",new Date(t.publishedDate).toLocaleDateString("en-US",{month:"long",day:"numeric",year:"numeric"})]}),e.jsx("span",{children:"·"}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(_,{size:13})," ",t.readingTime," min read"]}),e.jsx("span",{children:"·"}),e.jsx("button",{onClick:()=>a("blog-category",{slug:t.category}),className:"za-focus za-gold uppercase tracking-wider text-xs",children:t.category.replace(/-/g," ")})]}),e.jsx("div",{className:"flex flex-wrap gap-1.5 mb-10",children:t.tags.map(d=>e.jsx("button",{onClick:()=>a("blog-tag",{slug:d.toLowerCase().replace(/\s+/g,"-")}),className:"za-focus za-surface2 rounded-full px-3 py-1 text-xs za-ink-dim hover:za-bg-gold hover:text-white transition-colors",children:d},d))}),p&&e.jsxs("div",{className:"mb-10 za-card rounded-2xl p-5 sm:p-6 flex items-center justify-between flex-wrap gap-4",children:[e.jsxs("div",{children:[e.jsxs("p",{className:"za-display text-lg",children:["Browse ",p," Collections"]}),e.jsxs("p",{className:"za-ink-dim text-xs mt-1",children:["Explore complete classic ",p.toLowerCase()," collections available in digital and USB formats."]})]}),e.jsxs("button",{onClick:()=>a("listing",{genre:p}),className:"za-focus za-bg-gold text-white rounded-full px-5 py-2.5 text-sm za-display shrink-0 shadow-[0_10px_30px_rgba(109,74,255,0.30)]",children:["Explore ",p," Series"]})]}),e.jsx("div",{className:"mb-8",children:e.jsx(S,{title:t.title,url:`/blog/${t.slug}`,description:t.excerpt})}),e.jsx("div",{className:"blog-content",onClick:y,children:e.jsx("div",{dangerouslySetInnerHTML:{__html:t.content}})}),e.jsx("div",{className:"mt-10 mb-10",children:e.jsx(S,{title:t.title,url:`/blog/${t.slug}`,description:t.excerpt})}),e.jsx(G,{prev:r,next:f,onNav:a})]}),e.jsx("aside",{className:"w-full lg:w-80 shrink-0 order-first lg:order-last",children:e.jsx(O,{content:t.content})})]}),e.jsxs("div",{className:"mt-16 max-w-[860px]",children:[e.jsx(W,{slugs:t.relatedProductSlugs,onNav:a,heading:"Shop the Sitcoms Featured in This Article",max:8}),e.jsx(H,{articles:h,onNav:a})]}),e.jsxs("div",{className:"max-w-[860px] mt-12 za-card rounded-2xl p-6 sm:p-8 flex items-center gap-5 flex-wrap",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("p",{className:"flex items-center gap-1.5 text-sm za-ink-dim mb-2",children:[e.jsx($,{size:14})," Written by"]}),e.jsx("p",{className:"za-display text-xl",children:x.name}),x.bio&&e.jsx("p",{className:"text-sm za-ink-dim mt-2 leading-relaxed",children:x.bio})]}),e.jsxs("button",{onClick:()=>a("blog-author",{slug:x.slug}),className:"za-focus za-surface2 rounded-full px-5 py-2.5 text-sm shrink-0 hover:za-bg-gold hover:text-white",children:["View all articles by ",x.name.split(" ")[0]]})]})]})})}export{Z as default};