1import{y as g,r as i,h as b,j as e,H as m,L as j,B as w,az as v,s as y,D as N}from"./index-huytJiXS.js";import{L as S}from"./loader-circle-D1wxHvn7.js";import{C as k}from"./chevron-left-DuTsmdA6.js";import{S as I}from"./share-2-Be9uMjY2.js";const B=()=>{const{slug:n}=g(),c=n||"",[l,h]=i.useState([]),[o,u]=i.useState(""),[x,f]=i.useState(!0),[r,d]=i.useState(null);i.useEffect(()=>{c&&(async()=>{try{const{data:t}=await y.functions.invoke("youtube-playlist",{body:{playlistId:c}});t!=null&&t.success&&(t!=null&&t.videos)&&(h(t.videos),u(t.title||"Sermon Series"),t.videos.length>0&&d(t.videos[0].videoId))}catch(t){console.error("Failed to fetch playlist:",t)}finally{f(!1)}})()},[c]);const a=l.find(s=>s.videoId===r);b({title:o||"Sermon Series",description:`Watch the "${o}" sermon series from Christ Culture Church.`,image:a==null?void 0:a.thumbnail,type:"video.other",url:n?`/sermons/${n}`:void 0});const p=async()=>{const s=window.location.href;if(navigator.share)try{await navigator.share({title:o,url:s});return}catch{}await navigator.clipboard.writeText(s),N({title:"Link copied!",description:"Series link copied to clipboard."})};return x?e.jsxs("div",{className:"min-h-screen bg-background",children:[e.jsx(m,{}),e.jsx("div",{className:"flex items-center justify-center py-32",children:e.jsx(S,{className:"h-8 w-8 animate-spin text-muted-foreground"})})]}):e.jsxs("div",{className:"min-h-screen bg-background",children:[e.jsx(m,{}),r&&e.jsx("section",{className:"bg-black",children:e.jsx("div",{className:"container mx-auto max-w-5xl",children:e.jsx("div",{className:"relative w-full",style:{paddingBottom:"56.25%"},children:e.jsx("iframe",{className:"absolute inset-0 w-full h-full",src:`https://www.youtube.com/embed/${r}?rel=0`,title:(a==null?void 0:a.title)||"Sermon",allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",allowFullScreen:!0})})})}),e.jsx("section",{className:"py-10 md:py-16",children:e.jsxs("div",{className:"container mx-auto px-4 max-w-5xl",children:[e.jsxs(j,{to:"/sermons",className:"inline-flex items-center text-muted-foreground hover:text-foreground mb-6 text-sm transition-colors",children:[e.jsx(k,{className:"h-4 w-4 mr-1"})," Back to Sermon Series"]}),e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-start sm:justify-between gap-4 mb-8",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-3xl md:text-4xl font-display font-bold text-foreground mb-1",children:o}),e.jsxs("p",{className:"text-muted-foreground text-sm",children:[l.length," sermon",l.length!==1?"s":""," in this series"]})]}),e.jsxs(w,{variant:"outline",className:"rounded-full text-sm shrink-0",onClick:p,children:[e.jsx(I,{className:"h-4 w-4 mr-1"})," Share Series"]})]}),e.jsx("div",{className:"space-y-3",children:l.map((s,t)=>e.jsxs("button",{onClick:()=>{d(s.videoId),window.scrollTo({top:0,behavior:"smooth"})},className:`w-full flex items-start gap-4 p-3 rounded-xl text-left transition-colors ${s.videoId===r?"bg-church-orange/10 border border-church-orange/30":"bg-card hover:bg-secondary/50 border border-transparent"}`,children:[e.jsx("span",{className:"text-sm text-muted-foreground font-medium pt-1 w-6 text-center shrink-0",children:s.videoId===r?e.jsx(v,{className:"h-4 w-4 text-church-orange mx-auto"}):t+1}),e.jsxs("div",{className:"relative w-32 h-20 rounded-lg overflow-hidden shrink-0",children:[e.jsx("img",{src:s.thumbnail,alt:s.title,className:"w-full h-full object-cover"}),s.duration&&e.jsx("span",{className:"absolute bottom-1 right-1 bg-black/80 text-white text-[10px] px-1 rounded",children:s.duration})]}),e.jsx("div",{className:"flex-1 min-w-0",children:e.jsx("h3",{className:`font-semibold text-sm line-clamp-2 ${s.videoId===r?"text-church-orange":"text-foreground"}`,children:s.title})})]},s.videoId))})]})})]})};export{B 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.