import{d as R,n as B,c as I,r,e as E,p as z,a as o,f as w,u as D,h as O,w as M,b as e,i as u,o as l,t as i,q as N,v as X,s as Y,F as g,g as j,l as k,T as Z}from"./app-CClrM5Yi.js";import{_ as H}from"./AppLayout.vue_vue_type_script_setup_true_lang-DESMBqxz.js";import{_ as W}from"./_plugin-vue_export-helper-DlAUqK2U.js";import"./AppLogoIcon.vue_vue_type_script_setup_true_lang-7XZAfK5W.js";import"./useForwardExpose-BhawR5VU.js";import"./VisuallyHidden-Cu70tzB6.js";import"./RovingFocusGroup-CNFroA6Y.js";import"./useArrowNavigation-C6Y-ieo6.js";import"./index-C4J_hXM0.js";import"./createLucideIcon-ZFd4jktC.js";const G={class:"flex h-full flex-1 flex-col gap-4 overflow-x-auto rounded-xl p-4"},J={key:0,class:"flex items-center gap-3"},K={class:"flex items-center gap-3"},Q={class:"min-w-0 flex-1"},ee={class:"truncate text-lg font-semibold"},te={class:"flex items-center gap-2"},se={key:1,class:"rounded-md border border-red-300 bg-red-50 p-3 text-red-800 dark:border-red-800 dark:bg-red-950 dark:text-red-200"},ae=["aria-busy"],oe=["href"],le={class:"h-20 w-14 shrink-0 overflow-hidden rounded bg-muted"},re=["src","alt"],ne={class:"flex min-w-0 flex-1 flex-col"},ue={class:"flex items-center justify-between gap-2"},ie={class:"truncate font-medium"},de={class:"text-xs text-muted-foreground"},ce={class:"mt-1 text-xs text-muted-foreground"},ve={key:0,class:"mr-2 rounded border px-1 py-0.5"},fe={key:1},pe={class:"mt-2 text-sm text-foreground/90"},me={key:0,class:"fixed bottom-4 left-1/2 z-50 -translate-x-1/2 rounded bg-foreground px-3 py-2 text-sm text-background shadow-lg"},ge=R({__name:"Show",setup(he){const A=B(),T=I(()=>A.props.entityId),d=r(""),c=r("title_asc"),v=r([]),C=r(0),P=r(1),h=r(1),n=r(!1),_=r(null),b=r(!1),S=r(""),p=r(null);let $=null;const q=I(()=>h.valueb.value=!1,2500)}finally{n.value=!1}}}function U(){clearTimeout($),$=setTimeout(()=>{h.value=1,x(!0)},300)}function V(){const a=new URL(window.location.href);d.value?a.searchParams.set("q",d.value):a.searchParams.delete("q"),c.value?a.searchParams.set("sort",c.value):a.searchParams.delete("sort"),window.history.replaceState({},"",a.toString()),h.value=1,x(!0)}async function F(){q.value&&(h.value+=1,await x(!1))}const y=r(null);let m=null;return E(()=>{const a=new URL(window.location.href);d.value=a.searchParams.get("q")??"",c.value=a.searchParams.get("sort")??"title_asc",x(!0),m=new IntersectionObserver(t=>{for(const s of t)s.isIntersecting&&F()},{root:null,rootMargin:"200px",threshold:0}),y.value&&m.observe(y.value)}),z(y,(a,t)=>{t&&m&&m.unobserve(t),a&&m&&m.observe(a)}),(a,t)=>(l(),o(g,null,[w(D(O),{title:p.value?.name?`${p.value.name} · Actor`:"Actor"},null,8,["title"]),w(H,{breadcrumbs:[{title:"Actors",href:"/actors"},{title:p.value?.name??"…",href:`/actors/${T.value}`}]},{default:M(()=>[e("div",G,[!p.value&&n.value?(l(),o("div",J,[...t[2]||(t[2]=[e("div",{class:"h-12 w-12 shrink-0 rounded-full bg-muted animate-pulse"},null,-1),e("div",{class:"h-4 w-40 rounded bg-muted animate-pulse"},null,-1)])])):u("",!0),e("div",K,[t[3]||(t[3]=e("div",{class:"h-12 w-12 shrink-0 rounded-full bg-muted"},null,-1)),e("div",Q,[e("h1",ee,i(p.value?.name??"…"),1)])]),e("div",te,[N(e("input",{class:"w-full rounded-md border border-gray-300 bg-background px-3 py-2 text-sm outline-none focus:ring-2 focus:ring-primary",type:"text",placeholder:"Filter movies by title…","aria-label":"Filter movies by title","onUpdate:modelValue":t[0]||(t[0]=s=>d.value=s),onInput:U},null,544),[[X,d.value]]),N(e("select",{"onUpdate:modelValue":t[1]||(t[1]=s=>c.value=s),onChange:V,class:"w-44 shrink-0 rounded-md border px-3 py-2 text-sm","aria-label":"Sort movies"},[...t[4]||(t[4]=[e("option",{value:"title_asc"},"Title A → Z",-1),e("option",{value:"title_desc"},"Title Z → A",-1),e("option",{value:"newest"},"Newest",-1),e("option",{value:"oldest"},"Oldest",-1),e("option",{value:"year_asc"},"Year ↑",-1),e("option",{value:"year_desc"},"Year ↓",-1)])],544),[[Y,c.value]])]),_.value?(l(),o("div",se,i(_.value),1)):u("",!0),e("ul",{class:"divide-y divide-muted-foreground/20","aria-busy":n.value?"true":"false"},[(l(!0),o(g,null,j(v.value,s=>(l(),o("li",{key:s.id,class:"py-1"},[e("a",{href:`/movies/${s.id}`,class:"flex gap-3 rounded px-2 py-2 hover:bg-muted/40 focus:bg-muted/40 focus:outline-none"},[e("div",le,[s.poster_url?(l(),o("img",{key:0,src:s.poster_url,alt:`Poster for ${s.title}`,loading:"lazy",class:"h-full w-full object-cover"},null,8,re)):u("",!0)]),e("div",ne,[e("div",ue,[e("div",ie,i(s.title),1),e("div",de,i(s.year??""),1)]),e("div",ce,[s.rating?(l(),o("span",ve,i(s.rating),1)):u("",!0),s.genres?.length?(l(),o("span",fe,i(s.genres.map(f=>f.name).join(", ")),1)):u("",!0)]),e("div",pe,i(L(s.description)),1)])],8,oe)]))),128)),n.value&&v.value.length===0?(l(),o(g,{key:0},j(5,s=>e("li",{key:`s-${s}`,class:"py-1"},[...t[5]||(t[5]=[e("div",{class:"flex gap-3 rounded px-2 py-2"},[e("div",{class:"h-20 w-14 shrink-0 overflow-hidden rounded bg-muted animate-pulse"}),e("div",{class:"flex min-w-0 flex-1 flex-col gap-2"},[e("div",{class:"h-4 w-1/3 rounded bg-muted animate-pulse"}),e("div",{class:"h-3 w-1/2 rounded bg-muted animate-pulse"}),e("div",{class:"h-3 w-2/3 rounded bg-muted animate-pulse"})])],-1)])])),64)):u("",!0)],8,ae),e("div",{ref_key:"sentinel",ref:y,class:"py-6 text-center text-sm text-muted-foreground"},[n.value?(l(),o(g,{key:0},[k("Loading…")],64)):!q.value&&v.value.length>0?(l(),o(g,{key:1},[k("End of results")],64)):!v.value.length&&!n.value?(l(),o(g,{key:2},[k("No results")],64)):u("",!0)],512),w(Z,{name:"fade"},{default:M(()=>[b.value?(l(),o("div",me,i(S.value),1)):u("",!0)]),_:1})])]),_:1},8,["breadcrumbs"])],64))}}),qe=W(ge,[["__scopeId","data-v-57497e98"]]);export{qe as default};