(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8974],{283:(e,t,a)=>{"use strict";a.d(t,{A:()=>o,AuthProvider:()=>n});var i=a(5155),s=a(2115),r=a(2099);let l=(0,s.createContext)(void 0);function n(e){let{children:t}=e,[a,n]=(0,s.useState)(null),[o,d]=(0,s.useState)(null),[c,m]=(0,s.useState)(!0);(0,s.useEffect)(()=>{r.N.auth.getSession().then(e=>{var t;let{data:{session:a}}=e;d(a),n(null!=(t=null==a?void 0:a.user)?t:null),m(!1)});let{data:{subscription:e}}=r.N.auth.onAuthStateChange(async(e,t)=>{var a;d(t),n(null!=(a=null==t?void 0:t.user)?a:null),m(!1),"SIGNED_IN"===e&&(null==t?void 0:t.user)&&!t.user.email_confirmed_at&&await p(t.user)});return()=>e.unsubscribe()},[]);let p=async e=>{try{var t,a;let{error:i}=await r.N.from("profiles").insert({id:e.id,email:e.email,full_name:(null==(t=e.user_metadata)?void 0:t.full_name)||null,avatar_url:(null==(a=e.user_metadata)?void 0:a.avatar_url)||null})}catch(e){}},h=async(e,t)=>{let{error:a}=await r.N.auth.signInWithPassword({email:e,password:t});return{error:a}},u=async(e,t,a)=>{let{error:i}=await r.N.auth.signUp({email:e,password:t,options:{data:{full_name:a}}});return{error:i}},x=async()=>{let{error:e}=await r.N.auth.signOut();return{error:e}},g=async e=>{let{error:t}=await r.N.auth.resetPasswordForEmail(e,{redirectTo:"".concat(window.location.origin,"/auth/reset-password")});return{error:t}};return(0,i.jsx)(l.Provider,{value:{user:a,session:o,loading:c,signIn:h,signUp:u,signOut:x,resetPassword:g},children:t})}function o(){let e=(0,s.useContext)(l);if(void 0===e)throw Error("useAuth must be used within an AuthProvider");return e}},2099:(e,t,a)=>{"use strict";a.d(t,{N:()=>l});var i=a(321);let s="https://eulbkkpnpzbydikovmcv.supabase.co",r="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6ImV1bGJra3BucHpieWRpa292bWN2Iiwicm9sZSI6ImFub24iLCJpYXQiOjE3NDkwNjc5NjgsImV4cCI6MjA2NDY0Mzk2OH0.zIKb8vKTTqmnH4jkLFGTNWEW1Pucrc0QMScG5IR6ETQ";if(!s||!r)throw Error("Missing Supabase environment variables");let l=(0,i.UU)(s,r,{auth:{autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!1,storageKey:"sb-auth-token",storage:window.localStorage,flowType:"pkce"},db:{schema:"public"},global:{headers:{"X-Client-Info":"movie-streaming-app"}},realtime:{params:{eventsPerSecond:2}}})},2373:(e,t,a)=>{"use strict";a.d(t,{U:()=>d});var i=a(2115),s=a(283),r=a(2099);let l=()=>{try{let e="__localStorage_test__";return localStorage.setItem(e,e),localStorage.removeItem(e),!0}catch(e){return!1}},n=e=>({media_id:"string"==typeof e.id?parseInt(e.id,10):e.id,media_type:e.media_type,title:"movie"===e.media_type?e.title:e.name,poster_path:e.poster_path||void 0,overview:e.overview,release_date:"movie"===e.media_type?e.release_date:e.first_air_date,vote_average:e.vote_average,backdrop_path:e.backdrop_path||void 0,genre_ids:e.genre_ids||[]}),o=e=>{let t={id:e.media_id,poster_path:e.poster_path||null,overview:e.overview||"",vote_average:e.vote_average||0,backdrop_path:e.backdrop_path||null,genre_ids:e.genre_ids||[],media_type:e.media_type};return"movie"===e.media_type?{...t,title:e.title,release_date:e.release_date||"",media_type:"movie"}:{...t,name:e.title,first_air_date:e.release_date||"",media_type:"tv"}},d=()=>{let{user:e}=(0,s.A)(),[t,a]=(0,i.useState)([]),[d,c]=(0,i.useState)([]),[m,p]=(0,i.useState)(!0),[h,u]=(0,i.useState)(!1),x=l();(0,i.useEffect)(()=>{x?u(!1):e&&u(!0)},[x,e]);let g=(0,i.useCallback)(async()=>{p(!0);try{if(h){if(e){let[t,i]=await Promise.all([r.N.from("watchlist").select("*").eq("user_id",e.id).order("created_at",{ascending:!1}),r.N.from("watch_history").select("*").eq("user_id",e.id).order("watched_at",{ascending:!1})]);if(t.error)throw t.error;if(i.error)throw i.error;a(t.data||[]),c(i.data||[])}}else{let e=localStorage.getItem("watchlist"),t=localStorage.getItem("watchHistory");a(e?JSON.parse(e):[]),c(t?JSON.parse(t):[])}}catch(e){a([]),c([])}finally{p(!1)}},[h,e]),v=(0,i.useCallback)(async t=>{try{h?e&&a(t):(localStorage.setItem("watchlist",JSON.stringify(t)),a(t))}catch(e){}},[h,e]),y=(0,i.useCallback)(async t=>{try{h?e&&c(t):(localStorage.setItem("watchHistory",JSON.stringify(t)),c(t))}catch(e){}},[h,e]),f=(0,i.useCallback)(async i=>{try{let s="media_id"in i?i:n(i),l={...s,id:crypto.randomUUID(),created_at:new Date().toISOString()};if(h){if(e){let{error:i}=await r.N.from("watchlist").insert({user_id:e.id,media_id:s.media_id,media_type:s.media_type,title:s.title,poster_path:s.poster_path,overview:s.overview,release_date:s.release_date});if(i)throw i;a([l,...t])}}else{let e=[l,...t];await v(e)}}catch(e){throw e}},[t,v,h,e]),b=(0,i.useCallback)(async(i,s)=>{try{let l="string"==typeof i?parseInt(i,10):i;if(h){if(e){let{error:i}=await r.N.from("watchlist").delete().eq("user_id",e.id).eq("media_id",l).eq("media_type",s);if(i)throw i;let n=t.filter(e=>e.media_id!==l||e.media_type!==s);a(n)}}else{let e=t.filter(e=>e.media_id!==l||e.media_type!==s);await v(e)}}catch(e){throw e}},[t,v,h,e]),w=(0,i.useCallback)(async t=>{try{let a={...t,id:crypto.randomUUID(),watched_at:new Date().toISOString(),created_at:new Date().toISOString()};if(h){if(e){let{error:i}=await r.N.from("watch_history").insert({user_id:e.id,media_id:t.media_id,media_type:t.media_type,title:t.title,poster_path:t.poster_path,season_number:t.season_number,episode_number:t.episode_number,progress:t.progress});if(i)throw i;c([a,...d])}}else{let e=[a,...d];await y(e)}}catch(e){throw e}},[d,y,h,e]),_=(0,i.useCallback)(async(t,a,i,s,l)=>{try{if(h){if(e){let{error:n}=await r.N.from("watch_history").upsert({user_id:e.id,media_id:t,media_type:a,season_number:s,episode_number:l,progress:i,watched_at:new Date().toISOString()});if(n)throw n;await g()}}else{let e,r=d.findIndex(e=>e.media_id===t&&e.media_type===a&&e.season_number===s&&e.episode_number===l);r>=0?(e=[...d])[r]={...e[r],progress:i,watched_at:new Date().toISOString()}:e=[{id:crypto.randomUUID(),media_id:t,media_type:a,title:"".concat(a," ").concat(t),progress:i,season_number:s,episode_number:l,watched_at:new Date().toISOString(),created_at:new Date().toISOString()},...d],await y(e)}}catch(e){throw e}},[d,y,h,e,g]),j=(0,i.useCallback)(async()=>{try{if(h){if(e){let{error:t}=await r.N.from("watchlist").delete().eq("user_id",e.id);if(t)throw t;a([])}}else localStorage.setItem("watchlist",JSON.stringify([])),a([])}catch(e){throw e}},[h,e]),N=(0,i.useCallback)((e,a)=>{let i="string"==typeof e?parseInt(e,10):e;return t.some(e=>e.media_id===i&&e.media_type===a)},[t]),k=(0,i.useCallback)((e,t,a,i)=>{let s=d.find(s=>s.media_id===e&&s.media_type===t&&s.season_number===a&&s.episode_number===i);return(null==s?void 0:s.progress)||0},[d]),S=(0,i.useCallback)(async()=>{if(x&&e&&h)try{let t=localStorage.getItem("watchlist"),a=localStorage.getItem("watchHistory");if(t||a){if(t)for(let a of JSON.parse(t))await r.N.from("watchlist").upsert({user_id:e.id,media_id:a.media_id,media_type:a.media_type,title:a.title,poster_path:a.poster_path,overview:a.overview,release_date:a.release_date});if(a)for(let t of JSON.parse(a))await r.N.from("watch_history").upsert({user_id:e.id,media_id:t.media_id,media_type:t.media_type,title:t.title,poster_path:t.poster_path,season_number:t.season_number,episode_number:t.episode_number,progress:t.progress,watched_at:t.watched_at})}}catch(e){}},[x,e,h]);return(0,i.useEffect)(()=>{g()},[g]),(0,i.useEffect)(()=>{e&&!h&&x&&S()},[e,h,x,S]),{watchlist:t.map(o),rawWatchlist:t,watchHistory:d,isLoading:m,useSupabase:!x&&!!e,storageType:h?"supabase":"localStorage",addToWatchlist:f,removeFromWatchlist:b,clearWatchlist:j,isInWatchlist:N,addToWatchHistory:w,updateWatchProgress:_,getWatchProgress:k,loadData:g,syncData:S}}},4356:(e,t,a)=>{Promise.resolve().then(a.bind(a,8478))},6288:(e,t,a)=>{"use strict";a.d(t,{X:()=>i.A});var i=a(4416)},6982:(e,t,a)=>{"use strict";a.d(t,{dj:()=>n,tE:()=>o});var i=a(5155),s=a(2115),r=a(6288);let l=(0,s.createContext)(void 0),n=()=>{let e=(0,s.useContext)(l);if(!e)throw Error("useToast must be used within a ToastProvider");return e},o=e=>{let{children:t}=e,[a,n]=(0,s.useState)([]),o=(0,s.useCallback)((e,t)=>{let a=Math.random().toString(36).substring(2,9);return n(i=>[...i,{id:a,message:e,type:t}]),setTimeout(()=>{d(a)},4e3),a},[]),d=(0,s.useCallback)(e=>{n(t=>t.filter(t=>t.id!==e))},[]);return(0,i.jsxs)(l.Provider,{value:{toasts:a,showToast:o,hideToast:d},children:[" ",t,(0,i.jsx)("div",{className:"fixed top-4 right-4 z-[200] flex flex-col gap-2",children:a.map(e=>(0,i.jsxs)("div",{className:"flex items-center justify-between gap-2 rounded-lg p-3 shadow-lg transition-all transform animate-slide-in-top\n ".concat("success"===e.type?"bg-green-600/90 text-white":"error"===e.type?"bg-red-600/90 text-white":"bg-blue-600/90 text-white"," \n backdrop-blur-sm border border-white/10 min-w-[300px] max-w-sm"),children:[(0,i.jsx)("p",{className:"text-sm font-medium flex-1",children:e.message}),(0,i.jsx)("button",{onClick:()=>d(e.id),className:"rounded-full p-1 hover:bg-white/20 transition-colors",children:(0,i.jsx)(r.X,{size:16})})]},e.id))})]})}},8478:(e,t,a)=>{"use strict";a.r(t),a.d(t,{default:()=>I});var i=a(5155),s=a(2115),r=a(8e3),l=a(1066),n=a(6932),o=a(6618);let d=e=>{let{title:t,movieData:a,tvData:d,isLoading:c=!1,error:m=null,onRetry:p,layout:h="carousel"}=e,[u,x]=function(e,t){let[a,i]=(0,s.useState)(()=>{{let a=localStorage.getItem(e);return null!==a?JSON.parse(a):t}});return(0,s.useEffect)(()=>{localStorage.setItem(e,JSON.stringify(a))},[e,a]),[a,i]}("tab-preference-".concat(t?t.toLowerCase().replace(/\s+/g,"-"):"default"),"movie"),[g,v]=(0,s.useState)(u),[y,f]=(0,s.useState)(!1),[b,w]=(0,s.useState)({movie:[],tv:[]}),[_,j]=(0,s.useState)(null),[N,k]=(0,s.useState)(null),[S,T]=(0,s.useState)([]),[I,C]=(0,s.useState)([]),[E,A]=(0,s.useState)(!1);(0,s.useEffect)(()=>{(async()=>{A(!0);try{if(a instanceof Promise){let e=await a;T(e||[])}else T(a||[]);if(d instanceof Promise){let e=await d;C(e||[])}else C(d||[])}catch(e){}finally{A(!1)}})()},[a,d]);let M=S&&S.length>0,W=I&&I.length>0,L=M&&W,O=t.toLowerCase().replace(/\s+/g,"-"),z=t.toLowerCase().includes("trending");(0,s.useEffect)(()=>{(async()=>{k(null);try{let e=await fetch("/api/genres");if(!e.ok){let t=await e.json();throw Error(t.error||"Failed to fetch genres")}let t=await e.json();w(t)}catch(e){k(e instanceof Error?e.message:"Could not load genres")}})()},[]),(0,s.useEffect)(()=>{!M&&W?(v("tv"),x("tv")):M&&!W&&(v("movie"),x("movie"))},[M,W,x]);let P=e=>{v(e),x(e),j(null)},R=_?("movie"===g?S:I).filter(e=>{var t;return null==(t=e.genre_ids)?void 0:t.includes(_)}):"movie"===g?S:I,F=b[g]||[],D=c||E;return(0,i.jsxs)("section",{"aria-labelledby":"".concat(O,"-heading"),className:"py-4 animate-fadeIn",children:[(0,i.jsxs)("div",{className:"flex items-center mb-5 ".concat(L?"justify-between":"justify-start"," flex-col sm:flex-row gap-4"),children:[(0,i.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,i.jsx)("h2",{id:"".concat(O,"-heading"),className:"text-xl md:text-2xl font-bold text-white",children:t}),z&&(0,i.jsx)("span",{className:"inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-red-600 text-white animate-pulse",children:"Live"})]}),(0,i.jsxs)("div",{className:"flex items-center space-x-2",children:[!D&&R.length>0&&F.length>0&&!N&&(0,i.jsxs)("div",{className:"relative",children:[(0,i.jsx)("button",{onClick:()=>f(!y),className:"p-1.5 text-gray-400 hover:text-white transition-colors rounded-full hover:bg-gray-800","aria-label":"Toggle filters",title:"Filter content",children:(0,i.jsx)(n.A,{size:18})}),y&&(0,i.jsxs)("div",{className:"absolute right-0 mt-2 w-48 bg-gray-800 rounded-lg shadow-lg p-4 z-10",children:[(0,i.jsx)("h3",{className:"text-sm font-semibold text-white mb-2",children:"Filter by Genre"}),(0,i.jsxs)("select",{value:_||"",onChange:e=>j(e.target.value?Number(e.target.value):null),className:"w-full bg-gray-700 text-white rounded-md p-2 text-sm",children:[(0,i.jsx)("option",{value:"",children:"All Genres"}),F.map(e=>(0,i.jsx)("option",{value:e.id,children:e.name},e.id))]})]})]}),N&&(0,i.jsx)("span",{className:"text-xs text-red-400",title:N,children:"Filter Error"}),L&&(0,i.jsxs)("div",{className:"flex rounded-full bg-gray-800 p-1",role:"tablist","aria-orientation":"horizontal",children:[(0,i.jsxs)("button",{onClick:()=>P("movie"),role:"tab","aria-selected":"movie"===g,"aria-controls":"".concat(O,"-panel"),className:"flex items-center px-3 py-1 text-sm font-medium rounded-full transition-colors ".concat("movie"===g?"bg-blue-600 text-white":"text-gray-400 hover:text-white hover:bg-gray-700"),children:[(0,i.jsx)(l.A,{size:16,className:"mr-1"})," Movies"]}),(0,i.jsxs)("button",{onClick:()=>P("tv"),role:"tab","aria-selected":"tv"===g,"aria-controls":"".concat(O,"-panel"),className:"flex items-center px-3 py-1 text-sm font-medium rounded-full transition-colors ".concat("tv"===g?"bg-blue-600 text-white":"text-gray-400 hover:text-white hover:bg-gray-700"),children:[(0,i.jsx)(o.A,{size:16,className:"mr-1"})," TV Shows"]})]})]})]}),(0,i.jsx)("div",{id:"".concat(O,"-panel"),role:"tabpanel",children:(0,i.jsx)(r.default,{items:R,listTitle:"".concat(t," - ").concat("movie"===g?"Movies":"TV Shows"),isLoading:D,error:m,onRetry:p,layout:h})})]})},c=(e,t,a)=>{(0,s.useEffect)(()=>{if(!e.current)return;let i=e.current,s=new IntersectionObserver(e=>{e[0].isIntersecting&&t()},{threshold:.1,...a});return s.observe(i),()=>{s.unobserve(i)}},[e,t,a])};var m=a(2373),p=a(5028),h=a(2108),u=a(2355),x=a(3052),g=a(5695),v=a(6766),y=a(6982),f=a(3096);let b=(0,s.memo)(function(e){let{src:t,alt:a,className:r="",priority:l=!1,onError:n,fallbackComponent:o,maxHeight:d=96,maxWidth:c=384}=e,[m,p]=(0,s.useState)(!1),[h,u]=(0,s.useState)(!1),[x,g]=(0,f.Wx)({triggerOnce:!0,rootMargin:"100px",skip:l}),y=g||l,b=(0,s.useCallback)(()=>{p(!0)},[]),w=(0,s.useCallback)(()=>{u(!0),null==n||n()},[n]);return h&&o?(0,i.jsx)(i.Fragment,{children:o}):h?null:y?(0,i.jsx)("div",{ref:x,className:"relative ".concat(r),style:{maxHeight:d,maxWidth:c},children:(0,i.jsx)(v.default,{src:t,alt:a,width:c,height:d,sizes:"(max-width: 640px) 240px, (max-width: 768px) 320px, (max-width: 1024px) 400px, 500px",className:"object-contain transition-all duration-500 drop-shadow-2xl filter brightness-110 contrast-110 ".concat(m?"opacity-100 blur-0":"opacity-0 blur-sm"),style:{filter:"drop-shadow(0 4px 20px rgba(0, 0, 0, 0.8)) brightness(1.1) contrast(1.1)",width:"auto",height:"auto",maxHeight:d,maxWidth:c},priority:l,quality:90,loading:l?"eager":"lazy",onLoad:b,onError:w})}):(0,i.jsx)("div",{ref:x,className:"bg-transparent animate-pulse ".concat(r),style:{height:d,maxWidth:c,aspectRatio:"auto"}})}),w=()=>{let[e,t]=(0,s.useState)([]),[a,l]=(0,s.useState)(!0),[n,o]=(0,s.useState)(null);return((0,s.useEffect)(()=>{(async()=>{try{l(!0);let e=await fetch("/api/discover?mediaType=anime&limit=20");if(!e.ok)throw Error("Failed to fetch anime");let a=await e.json();t(a.results||[])}catch(e){o(e)}finally{l(!1)}})()},[]),n)?(0,i.jsxs)("div",{className:"mb-6 sm:mb-8",children:[(0,i.jsx)("h2",{className:"text-xl sm:text-2xl font-bold text-white mb-4",children:"Popular Anime"}),(0,i.jsxs)("div",{className:"bg-red-900/20 border border-red-500/30 rounded-lg p-4 text-center",children:[(0,i.jsx)("p",{className:"text-red-400 mb-2",children:"Failed to load anime content"}),(0,i.jsx)("button",{onClick:()=>{o(null),t([])},className:"px-4 py-2 bg-red-600 hover:bg-red-700 text-white rounded-md transition-colors",children:"Try Again"})]})]}):a?(0,i.jsxs)("div",{className:"mb-6 sm:mb-8",children:[(0,i.jsx)("h2",{className:"text-xl sm:text-2xl font-bold text-white mb-4",children:"Popular Anime"}),(0,i.jsx)("div",{className:"flex space-x-4 overflow-x-auto pb-4",children:Array(10).fill(0).map((e,t)=>(0,i.jsxs)("div",{className:"flex-shrink-0 w-36 sm:w-48",children:[(0,i.jsx)("div",{className:"aspect-[2/3] bg-gray-800 rounded-lg animate-pulse"}),(0,i.jsx)("div",{className:"mt-2 h-4 bg-gray-800 rounded animate-pulse"})]},t))})]}):0===e.length?(0,i.jsxs)("div",{className:"mb-6 sm:mb-8",children:[(0,i.jsx)("h2",{className:"text-xl sm:text-2xl font-bold text-white mb-4",children:"Popular Anime"}),(0,i.jsx)("div",{className:"text-center py-8 text-gray-400",children:(0,i.jsx)("p",{children:"No anime content available at the moment"})})]}):(0,i.jsxs)("div",{className:"mb-6 sm:mb-8",children:[(0,i.jsx)("h2",{className:"text-xl sm:text-2xl font-bold text-white mb-4",children:"Popular Anime"})," ",(0,i.jsx)(r.default,{items:e,layout:"carousel"})]})};var _=a(2690),j=a(6874),N=a.n(j);function k(e){let{className:t="",excludeId:a,excludeType:r}=e,[l,n]=(0,s.useState)([]),[o,d]=(0,s.useState)([]),[c,m]=(0,s.useState)(!0);return((0,s.useEffect)(()=>{(async()=>{try{m(!0);let e=await fetch("/api/trending?mediaType=movie&timeWindow=day"),t=await e.json(),i=await fetch("/api/trending?mediaType=tv&timeWindow=day"),s=await i.json(),l=Array.isArray(t)?t:[],o=Array.isArray(s)?s:[];if(l.length<6){let e=await fetch("/api/discover?mediaType=movie&page=1&sortBy=popularity.desc"),t=(await e.json()).results||[],a=new Set(l.map(e=>e.id)),i=t.filter(e=>!a.has(e.id));l=[...l,...i]}if(o.length<6){let e=await fetch("/api/discover?mediaType=tv&page=1&sortBy=popularity.desc"),t=(await e.json()).results||[],a=new Set(o.map(e=>e.id)),i=t.filter(e=>!a.has(e.id));o=[...o,...i]}let c=l.filter(e=>"movie"!==r||e.id!==a).slice(0,6),p=o.filter(e=>"tv"!==r||e.id!==a).slice(0,6);n(c),d(p)}catch(e){n([]),d([])}finally{m(!1)}})()},[a,r]),c)?(0,i.jsxs)("div",{className:"bg-gray-800/30 rounded-lg p-4 ".concat(t),children:[(0,i.jsx)("h3",{className:"text-lg font-semibold text-white mb-3",children:"Featured Content"}),(0,i.jsx)("div",{className:"animate-pulse",children:(0,i.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[(0,i.jsxs)("div",{children:[(0,i.jsx)("div",{className:"h-4 bg-gray-700 rounded mb-2"}),(0,i.jsx)("div",{className:"space-y-2",children:[...Array(6)].map((e,t)=>(0,i.jsx)("div",{className:"h-3 bg-gray-700 rounded"},t))})]}),(0,i.jsxs)("div",{children:[(0,i.jsx)("div",{className:"h-4 bg-gray-700 rounded mb-2"}),(0,i.jsx)("div",{className:"space-y-2",children:[...Array(6)].map((e,t)=>(0,i.jsx)("div",{className:"h-3 bg-gray-700 rounded"},t))})]})]})})]}):(0,i.jsxs)("div",{className:"bg-gray-800/30 rounded-lg p-4 ".concat(t),children:[(0,i.jsx)("h3",{className:"text-lg font-semibold text-white mb-3",children:"Trending & Latest Content"}),(0,i.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[(0,i.jsxs)("div",{children:[(0,i.jsx)("h4",{className:"text-sm font-medium text-gray-300 mb-2",children:"Trending Movies"}),(0,i.jsx)("div",{className:"space-y-2",children:l.map(e=>(0,i.jsxs)(N(),{href:(0,_.GV)(e.id,e.title),className:"block text-sm text-blue-400 hover:text-blue-300 transition-colors truncate",title:e.title,children:[e.title," (",e.release_date?new Date(e.release_date).getFullYear():"N/A",")"]},e.id))})]}),(0,i.jsxs)("div",{children:[(0,i.jsx)("h4",{className:"text-sm font-medium text-gray-300 mb-2",children:"Trending TV Shows"}),(0,i.jsx)("div",{className:"space-y-2",children:o.map(e=>(0,i.jsxs)(N(),{href:(0,_.pK)(e.id,e.name),className:"block text-sm text-blue-400 hover:text-blue-300 transition-colors truncate",title:e.name,children:[e.name," (",e.first_air_date?new Date(e.first_air_date).getFullYear():"N/A",")"]},e.id))})]})]}),(0,i.jsx)("div",{className:"mt-4 pt-3 border-t border-gray-700",children:(0,i.jsxs)("div",{className:"flex flex-wrap gap-3 text-sm",children:[(0,i.jsx)(N(),{href:"/browse/movies",className:"text-gray-400 hover:text-white transition-colors",children:"All Movies"}),(0,i.jsx)(N(),{href:"/browse/tv",className:"text-gray-400 hover:text-white transition-colors",children:"All TV Shows"}),(0,i.jsx)(N(),{href:"/browse/anime",className:"text-gray-400 hover:text-white transition-colors",children:"Anime"})]})})]})}let S=(0,p.default)(()=>a.e(5901).then(a.bind(a,5901)).catch(()=>({default:e=>{let{children:t,...a}=e;return(0,i.jsx)("div",{...a,children:t})}})),{loadableGenerated:{webpack:()=>[5901]},ssr:!1,loading:()=>(0,i.jsx)("div",{className:"w-full h-20 bg-gray-800/50 rounded-lg animate-pulse flex items-center justify-center",children:(0,i.jsxs)("div",{className:"flex space-x-2",children:[(0,i.jsx)("div",{className:"w-2 h-2 bg-red-500 rounded-full animate-bounce"}),(0,i.jsx)("div",{className:"w-2 h-2 bg-purple-500 rounded-full animate-bounce [animation-delay:100ms]"}),(0,i.jsx)("div",{className:"w-2 h-2 bg-blue-500 rounded-full animate-bounce [animation-delay:200ms]"})]})})}),T=(0,p.default)(()=>a.e(5516).then(a.bind(a,5516)).catch(()=>({default:e=>{let{children:t}=e;return(0,i.jsx)(i.Fragment,{children:t})}})),{loadableGenerated:{webpack:()=>[5516]},ssr:!1,loading:()=>(0,i.jsx)("div",{className:"contents"})});function I(){var e,t,a,r,l,n,o,p,f,j,N,I,C;let E,[A,M]=(0,s.useState)([]),[W,L]=(0,s.useState)([]),[O,z]=(0,s.useState)([]),[P,R]=(0,s.useState)([]),[F,D]=(0,s.useState)([]),[B,J]=(0,s.useState)([]),[U,H]=(0,s.useState)([]),[q,G]=(0,s.useState)([]),[V,K]=(0,s.useState)([]),[X,Y]=(0,s.useState)([]),[Q,Z]=(0,s.useState)({}),[$,ee]=(0,s.useState)(0),[et,ea]=(0,s.useState)(!0),[ei,es]=(0,s.useState)(new Set),{showToast:er}=(0,y.dj)(),el=(0,s.useRef)(null),en=(0,s.useRef)(null),eo=(0,s.useRef)(null),ed=(0,s.useRef)(null),ec=(0,s.useRef)(null),em=(0,s.useRef)(null),ep=(0,g.useRouter)(),{addToWatchlist:eh,removeFromWatchlist:eu,isInWatchlist:ex}=(0,m.U)(),[eg,ev]=(0,s.useState)([]);(0,s.useEffect)(()=>{{let e=localStorage.getItem("continueWatching");e&&ev(JSON.parse(e))}},[]);let ey=(e,t)=>{let a=eg.filter(a=>a.id!==e||a.media_type!==t);ev(a),localStorage.setItem("continueWatching",JSON.stringify(a)),er("Removed from continue watching","info")},ef=(e,t)=>{let a=eg.find(a=>a.id===e&&a.media_type===t);if(a){let i,s=[];{let e=localStorage.getItem("watchedHistory");e&&(s=JSON.parse(e))}let r=s.findIndex(a=>a.id===e&&a.media_type===t),l={...a,progress:100,watchedAt:new Date().toISOString()};-1!==r?((i=[...s]).splice(r,1),i.unshift(l)):i=[l,...s];let n=eg.filter(a=>a.id!==e||a.media_type!==t);ev(n),eu(e,t),localStorage.setItem("watchedHistory",JSON.stringify(i)),localStorage.setItem("continueWatching",JSON.stringify(n)),er('Marked "'.concat(a.title||a.name,'" as finished'),"success")}},eb=(e,t)=>{let a=eg.find(a=>a.id===e&&a.media_type===t);if(a){if(ex(e,t)){ey(e,t),er('"'.concat(a.title||a.name,'" is already in your watchlist'),"info");return}eh({id:a.id,title:a.title||a.name,name:a.name||a.title,poster_path:a.poster_path,backdrop_path:a.backdrop_path,release_date:a.release_date||a.first_air_date,first_air_date:a.first_air_date||a.release_date,overview:a.overview,vote_average:a.vote_average,media_type:a.media_type,genre_ids:a.genre_ids||[]}),ey(e,t),er('Moved "'.concat(a.title||a.name,'" to your watchlist'),"success")}},ew=(e,t,a)=>{e.stopPropagation();let i=document.querySelector(".action-options-menu");i&&i.remove();let s=document.createElement("div");s.className="action-options-menu",s.innerHTML='\n
\n \n Mark as Finished\n
\n
\n \n Finish Later\n
\n
\n \n Remove\n
\n ';let r=e.target.getBoundingClientRect();s.style.position="fixed",s.style.top="".concat(r.bottom+5,"px"),s.style.left="".concat(r.left,"px"),s.style.zIndex="1000",s.addEventListener("click",e=>{e.stopPropagation();let i=e.target.closest(".action-option");if(i){let e=i.dataset.action,r=eg.find(e=>e.id===t&&e.media_type===a);switch(r&&(r.title||r.name),e){case"mark-finished":ef(t,a);break;case"finish-later":eb(t,a);break;case"remove":ey(t,a)}s.remove()}});let l=e=>{s.contains(e.target)||(s.remove(),document.removeEventListener("click",l))};document.body.appendChild(s),document.addEventListener("click",l)},e_=async function(e,t){let a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:3;for(let i=0;i({...a,[t]:e})),[];await new Promise(e=>setTimeout(e,1e3*Math.pow(2,i)))}return[]};(0,s.useEffect)(()=>{let e,t;if(!et||0===A.length)return;let a=()=>{t=setInterval(()=>{ee(e=>(e+1)%A.length)},7e3)},i=(()=>{if("complete"===document.readyState)e=setTimeout(a,3e3);else{let t=()=>{e=setTimeout(a,3e3),window.removeEventListener("load",t)};window.addEventListener("load",t);let i=setTimeout(()=>{window.removeEventListener("load",t),a()},5e3);return()=>{window.removeEventListener("load",t),clearTimeout(i)}}})();return()=>{clearTimeout(e),clearInterval(t),null==i||i()}},[et,A.length]),(0,s.useEffect)(()=>{let e=document.createElement("style");return e.id="homepage-action-options-menu-styles",e.textContent="\n .action-options-menu {\n background: rgba(0, 0, 0, 0.9);\n border: 1px solid rgba(255, 255, 255, 0.1);\n border-radius: 8px;\n padding: 4px;\n min-width: 140px;\n box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);\n backdrop-filter: blur(10px);\n }\n \n .action-option {\n padding: 8px 12px;\n cursor: pointer;\n border-radius: 4px;\n transition: background-color 0.2s;\n color: white;\n font-size: 14px;\n display: flex;\n align-items: center;\n gap: 8px;\n }\n \n .action-option:hover {\n background-color: rgba(255, 255, 255, 0.1);\n } /* Mark as Finished button styling */\n @media (max-width: 640px) {\n .mark-finished-text {\n font-size: 9px; /* Make text smaller on mobile */\n }\n }\n ",document.head.appendChild(e),()=>{let e=document.getElementById("homepage-action-options-menu-styles");e&&e.parentNode&&e.parentNode.removeChild(e)}},[]),(0,s.useEffect)(()=>{(async()=>{try{let e=(await e_("/api/trending?timeWindow=day&mediaType=movie&withLogos=true&limit=10","heroItems")).filter(e=>e.backdrop_path).slice(0,10);if(0===e.length)throw Error("No suitable hero items with backdrop images found");M(e)}catch(e){Z(t=>({...t,heroItems:e}))}})()},[]);let ej=e=>e?"movie"===e.media_type?e.title||"Unknown Title":e.name||"Unknown Name":"Unknown Title";c(en,async()=>{if(0===W.length&&0===O.length){let[e,t]=await Promise.all([e_("/api/trending?timeWindow=day&mediaType=movie","trendingTodayMovies"),e_("/api/trending?timeWindow=day&mediaType=tv","trendingTodayTv")]);L(e),z(t)}},{threshold:.1}),c(eo,async()=>{if(0===P.length&&0===F.length){let[e,t]=await Promise.all([e_("/api/trending?timeWindow=week&mediaType=movie","trendingWeekMovies"),e_("/api/trending?timeWindow=week&mediaType=tv","trendingWeekTv")]);R(e),D(t)}},{threshold:.1}),c(ed,async()=>{if(0===q.length&&0===V.length){let[e,t]=await Promise.all([e_("/api/top-rated?mediaType=movie","topRatedMovies"),e_("/api/top-rated?mediaType=tv","topRatedTv")]);G(e),K(t)}},{threshold:.1}),c(ec,async()=>{if(0===B.length&&0===U.length){let[e,t]=await Promise.all([e_("/api/popular?mediaType=movie","popularMovies"),e_("/api/popular?mediaType=tv","popularTv")]);J(e),H(t)}},{threshold:.1}),c(em,async()=>{0===X.length&&Y(await e_("/api/discover?mediaType=anime&limit=20","popularAnime"))},{threshold:.1});let eN=e=>{Z(t=>({...t,[e]:null})),e.includes("trendingToday")?(L([]),z([])):e.includes("trendingWeek")?(R([]),D([])):e.includes("topRated")?(G([]),K([])):e.includes("popular")?(J([]),H([])):e.includes("anime")?Y([]):"hero"===e&&(M([]),e_("/api/trending?timeWindow=day&mediaType=movie&limit=10","heroItems").then(e=>M(e.slice(0,10))))},ek="https://boredflix.com/";return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)("script",{type:"application/ld+json",dangerouslySetInnerHTML:{__html:JSON.stringify({"@context":"https://schema.org","@type":"WebSite",name:"BoredFlix",description:"Stream free movies and TV shows online in HD, Full HD and 4K. No sign-up required.",url:ek,potentialAction:{"@type":"SearchAction",target:"".concat(ek,"/search?q={search_term_string}"),"query-input":"required name=search_term_string"},publisher:{"@type":"Organization",name:"BoredFlix",url:ek}})}}),(0,i.jsx)("main",{className:"main-content flex flex-col min-h-screen bg-gray-900",children:(0,i.jsxs)(S,{initial:{opacity:0},animate:{opacity:1},transition:{duration:.5},children:[eg.length>0&&(0,i.jsxs)("section",{className:"w-full px-4 mb-8 mt-2",children:[(0,i.jsx)("h2",{className:"text-xl sm:text-2xl font-bold text-white mb-3",children:"Continue Watching"}),(0,i.jsxs)("div",{className:"relative group",children:[(0,i.jsx)("button",{onClick:()=>{let e=document.getElementById("continue-watching-scroll");e&&e.scrollBy({left:-200,behavior:"smooth"})},id:"continue-watching-left-btn",className:"absolute left-0 top-1/2 transform -translate-y-1/2 bg-black/70 p-2 rounded-full hover:bg-black z-10 opacity-0 group-hover:opacity-100 transition-opacity","aria-label":"Scroll left",children:(0,i.jsx)(u.A,{className:"h-6 w-6 text-white"})}),(0,i.jsx)("button",{onClick:()=>{let e=document.getElementById("continue-watching-scroll");e&&e.scrollBy({left:200,behavior:"smooth"})},id:"continue-watching-right-btn",className:"absolute right-0 top-1/2 transform -translate-y-1/2 bg-black/70 p-2 rounded-full hover:bg-black z-10 opacity-0 group-hover:opacity-100 transition-opacity","aria-label":"Scroll right",children:(0,i.jsx)(x.A,{className:"h-6 w-6 text-white"})}),(0,i.jsx)("div",{id:"continue-watching-left-shadow",className:"absolute left-0 top-0 bottom-0 w-8 bg-gradient-to-r from-gray-900 to-transparent z-0 pointer-events-none opacity-0 transition-opacity duration-300"}),(0,i.jsx)("div",{id:"continue-watching-right-shadow",className:"absolute right-0 top-0 bottom-4 w-16 sm:w-20 bg-gradient-to-l from-gray-900 to-transparent z-0 pointer-events-none opacity-70 transition-opacity duration-300"}),(0,i.jsx)("div",{id:"continue-watching-scroll",className:"flex overflow-x-auto pb-4 space-x-3 scrollbar-hide scroll-smooth pr-10 sm:pr-20 md:pr-24",style:{scrollbarWidth:"none",msOverflowStyle:"none",scrollBehavior:"smooth",scrollSnapType:"x proximity"},onScroll:()=>{let e=document.getElementById("continue-watching-scroll"),t=document.getElementById("continue-watching-left-btn"),a=document.getElementById("continue-watching-right-btn"),i=document.getElementById("continue-watching-left-shadow"),s=document.getElementById("continue-watching-right-shadow");if(e&&t&&a&&i&&s){let{scrollLeft:r,scrollWidth:l,clientWidth:n}=e;r>10?(t.classList.replace("opacity-0","opacity-100"),i.classList.replace("opacity-0","opacity-100")):(t.classList.replace("opacity-100","opacity-0"),i.classList.replace("opacity-100","opacity-0")),r(0,i.jsxs)("div",{className:"relative flex-shrink-0 w-[142px] sm:w-[200px] transition-all duration-300",style:{scrollSnapAlign:"start"},children:[" ",(0,i.jsxs)("div",{className:"relative group cursor-pointer",children:[(0,i.jsx)("button",{onClick:t=>{t.stopPropagation(),ew(t,e.id,e.media_type)},className:"absolute top-1 right-1 z-20 bg-black/60 hover:bg-black/90 text-white rounded-full p-1 text-xs","aria-label":"Options",children:"\xd7"}),(0,i.jsx)("button",{onClick:t=>{t.stopPropagation(),ef(e.id,e.media_type)},className:"absolute top-1 left-1 z-20 bg-green-600/80 hover:bg-green-600 text-white rounded-md px-2 py-0.5 text-xs flex items-center","aria-label":"Mark as Finished",children:(0,i.jsx)("span",{className:"mark-finished-text",children:"Mark as Finished"})}),(0,i.jsxs)("div",{className:"block relative overflow-hidden rounded-xl transition-all duration-500 ease-out bg-gradient-to-br from-gray-900/50 to-black/50 backdrop-blur-sm shadow-sm hover:shadow-lg hover:shadow-blue-500/20 group transform hover:md:-translate-y-1 hover:md:scale-102 active:scale-98",onClick:()=>{let t="movie"===e.media_type?(0,_.GV)(e.id,e.title||"untitled"):(0,_.pK)(e.id,e.name||"untitled");ep.push(t)},children:[e.progress&&(0,i.jsx)("div",{className:"absolute bottom-0 left-0 right-0 h-1 bg-gray-700 z-20",children:(0,i.jsx)("div",{className:"h-full bg-blue-500",style:{width:"".concat(e.progress,"%")}})}),(0,i.jsx)("div",{className:"absolute inset-0 rounded-2xl bg-gradient-to-r from-blue-500/50 via-purple-500/50 to-pink-500/50 opacity-0 group-hover:opacity-100 transition-opacity duration-500 blur-sm -z-10"}),(0,i.jsxs)("div",{className:"relative aspect-[2/3] w-full overflow-hidden rounded-xl bg-gradient-to-br from-gray-800 to-gray-900",children:[(0,i.jsx)(v.default,{src:e.poster_path?"https://image.tmdb.org/t/p/w300".concat(e.poster_path):"/images/placeholder-poster.png",alt:e.title||e.name||"Poster",fill:!0,sizes:"(max-width: 640px) 142px, 200px",className:"object-cover transition-all duration-700 ease-out group-hover:scale-110 group-hover:brightness-110 group-hover:contrast-110 group-hover:saturate-110"}),(0,i.jsx)("div",{className:"absolute inset-0 bg-gradient-to-t from-black/20 via-transparent to-transparent"})]}),(0,i.jsx)("div",{className:"absolute bottom-0 left-0 right-0",children:(0,i.jsxs)("div",{className:"bg-gradient-to-t from-black/60 via-black/20 to-transparent p-1 md:p-1.5",children:[(0,i.jsx)("div",{className:"flex items-center justify-between text-[9px] md:text-xs",children:(0,i.jsxs)("div",{className:"flex items-center gap-1 md:gap-1.5",children:[(0,i.jsx)("span",{className:"text-white/90 font-medium bg-black/40 backdrop-blur-sm px-1 py-0.5 md:px-1.5 rounded text-[9px] md:text-xs",children:"movie"===e.media_type?"Movie":"TV"}),e.season&&e.episode&&(0,i.jsxs)("span",{className:"text-white/80 font-medium bg-black/40 backdrop-blur-sm px-1 py-0.5 md:px-1.5 rounded text-[9px] md:text-xs",children:["S",e.season,":E",e.episode]})]})}),(0,i.jsx)("div",{className:"text-white/90 font-medium truncate mt-0.5 text-[9px] md:text-xs",children:e.title||e.name})]})})]})]})]},e.id+"-"+e.media_type))})]})]}),Q.heroItems?(0,i.jsx)("div",{className:"w-full h-72 sm:h-96 bg-gray-800 flex items-center justify-center",children:(0,i.jsx)("p",{className:"text-red-500",children:"Failed to load featured content. Please try again."})}):0===A.length?(0,i.jsxs)("div",{className:"w-full h-72 sm:h-96 bg-gray-800 animate-pulse flex flex-col items-center justify-center text-center px-4",children:[(0,i.jsx)("svg",{className:"w-12 h-12 sm:w-16 sm:h-16 text-gray-400 mb-3 sm:mb-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,i.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M7 4v16M17 4v16M3 8h4m10 0h4M3 12h18M3 16h4m10 0h4M4 20h16"})}),(0,i.jsx)("p",{className:"text-xl sm:text-2xl font-bold text-gray-200",children:"Discover Blockbusters"}),(0,i.jsx)("p",{className:"text-sm sm:text-base text-gray-400 mt-2",children:"Fetching the latest cinematic masterpieces..."})]}):(0,i.jsxs)("div",{className:"relative w-full h-[350px] sm:h-96 md:h-[500px] lg:h-[600px] overflow-hidden rounded-lg mb-6 sm:mb-8 mt-2",onMouseEnter:()=>ea(!1),onMouseLeave:()=>ea(!0),ref:el,children:[(0,i.jsx)(T,{mode:"wait",children:(0,i.jsxs)(S,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.5},className:"absolute inset-0",children:[" ",A[$]&&(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(v.default,{src:"https://image.tmdb.org/t/p/original".concat(A[$].backdrop_path),alt:"".concat(ej(A[$])," backdrop"),fill:!0,priority:!0,quality:90,sizes:"100vw",className:"object-cover object-center"}),(0,i.jsx)("div",{className:"absolute inset-0 bg-gradient-to-t from-gray-900 via-gray-900/70 to-transparent z-10"})," ",(0,i.jsx)("div",{className:"absolute inset-0 bg-gradient-to-r from-gray-900 via-gray-900/40 to-transparent z-10"}),(0,i.jsxs)("div",{className:"absolute bottom-0 left-0 p-4 sm:p-6 md:p-12 w-full md:w-2/3 text-white z-20",children:[A[$].logo_path&&!ei.has(A[$].id)?(0,i.jsx)("div",{className:"mb-2 sm:mb-3",children:(0,i.jsx)(b,{src:"https://image.tmdb.org/t/p/w500".concat(A[$].logo_path),alt:ej(A[$]),className:"h-12 sm:h-16 md:h-20 lg:h-24 max-w-sm",priority:!0,maxHeight:96,maxWidth:384,onError:()=>{es(e=>new Set(e).add(A[$].id))},fallbackComponent:(0,i.jsx)("h2",{className:"text-2xl sm:text-3xl md:text-4xl lg:text-5xl font-bold mb-1 sm:mb-2 line-clamp-2",children:ej(A[$])})})}):(0,i.jsx)("h2",{className:"text-2xl sm:text-3xl md:text-4xl lg:text-5xl font-bold mb-1 sm:mb-2 line-clamp-2",children:ej(A[$])}),(0,i.jsxs)("div",{className:"flex items-center space-x-3 mb-2 sm:mb-3",children:[(0,i.jsxs)("span",{className:"bg-yellow-500 text-black px-1.5 sm:px-2 py-0.5 sm:py-1 rounded text-xs sm:text-sm font-medium",children:[null==(e=A[$].vote_average)?void 0:e.toFixed(1)," ★"]}),(0,i.jsx)("span",{className:"text-gray-300 text-sm sm:text-base",children:(E=A[$])?"movie"===E.media_type&&E.release_date?E.release_date.slice(0,4):"tv"===E.media_type&&E.first_air_date?E.first_air_date.slice(0,4):"TBA":"TBA"})]}),(0,i.jsx)("p",{className:"text-gray-200 text-sm sm:text-base line-clamp-2 sm:line-clamp-3 md:line-clamp-4",children:A[$].overview})," ",(0,i.jsxs)("div",{className:"mt-3 sm:mt-4 md:mt-6 flex flex-row items-center gap-2 sm:gap-4",children:[(0,i.jsx)("button",{onClick:()=>{let e=A[$];if(e){let t="movie"===e.media_type?(0,_.GV)(e.id,e.title||"untitled"):(0,_.pK)(e.id,e.name||"untitled");ep.push(t)}},className:"bg-red-600 hover:bg-red-700 text-white px-4 sm:px-6 py-2 rounded-md font-medium transition-colors text-sm sm:text-base flex-1 sm:flex-none text-center",children:"Watch Now"})," ",(0,i.jsx)("button",{onClick:()=>{let e=A[$];e&&(ex(e.id,e.media_type)?eu(e.id,e.media_type):eh(e))},className:"sm:hidden p-2 rounded-md transition-colors flex items-center justify-center ".concat(ex(null==(t=A[$])?void 0:t.id,null==(a=A[$])?void 0:a.media_type)?"bg-green-600 text-white":"bg-gray-800 bg-opacity-70 hover:bg-opacity-100 text-white"),"aria-label":ex(null==(r=A[$])?void 0:r.id,null==(l=A[$])?void 0:l.media_type)?"Remove from Watchlist":"Add to Watchlist",children:(0,i.jsx)(h.A,{className:"w-5 h-5",fill:ex(null==(n=A[$])?void 0:n.id,null==(o=A[$])?void 0:o.media_type)?"currentColor":"none"})}),(0,i.jsxs)("button",{onClick:()=>{let e=A[$];e&&(ex(e.id,e.media_type)?eu(e.id,e.media_type):eh(e))},className:"hidden sm:flex sm:items-center sm:gap-2 px-6 py-2 rounded-md font-medium transition-colors text-base ".concat(ex(null==(p=A[$])?void 0:p.id,null==(f=A[$])?void 0:f.media_type)?"bg-green-600 text-white":"bg-gray-800 bg-opacity-70 hover:bg-opacity-100 text-white"),children:[(0,i.jsx)(h.A,{className:"w-5 h-5 mr-2",fill:ex(null==(j=A[$])?void 0:j.id,null==(N=A[$])?void 0:N.media_type)?"currentColor":"none"}),ex(null==(I=A[$])?void 0:I.id,null==(C=A[$])?void 0:C.media_type)?"Remove from Watchlist":"Add to Watchlist"]})]})]})," "]})]},$)}),(0,i.jsx)("button",{onClick:()=>{ee(e=>0===e?A.length-1:e-1)},disabled:0===A.length,className:"absolute left-2 sm:left-4 top-1/3 -translate-y-1/2 bg-black bg-opacity-50 hover:bg-opacity-70 rounded-full p-1.5 sm:p-2 z-20","aria-label":"Previous",children:(0,i.jsx)(u.A,{className:"w-5 h-5 sm:w-6 sm:h-6 text-white"})}),(0,i.jsx)("button",{onClick:()=>{ee(e=>(e+1)%A.length)},className:"absolute right-2 sm:right-4 top-1/3 -translate-y-1/2 bg-black bg-opacity-50 hover:bg-opacity-70 rounded-full p-1.5 sm:p-2 z-20","aria-label":"Next",children:(0,i.jsx)(x.A,{className:"w-5 h-5 sm:w-6 sm:h-6 text-white"})})]}),(0,i.jsx)("div",{ref:en,children:(0,i.jsx)(d,{title:"Trending Today",movieData:W,tvData:O,isLoading:0===W.length&&0===O.length&&!Q.trendingTodayMovies&&!Q.trendingTodayTv,error:Q.trendingTodayMovies||Q.trendingTodayTv,onRetry:()=>eN("trendingToday"),layout:"carousel",priority:!0})})," ",(0,i.jsx)("div",{ref:eo,children:(0,i.jsx)(d,{title:"Trending This Week",movieData:P,tvData:F,isLoading:0===P.length&&0===F.length&&!Q.trendingWeekMovies&&!Q.trendingWeekTv,error:Q.trendingWeekMovies||Q.trendingWeekTv,onRetry:()=>eN("trendingWeek"),layout:"carousel"})})," ",(0,i.jsx)("div",{ref:ed,children:(0,i.jsx)(d,{title:"Top Rated",movieData:q,tvData:V,isLoading:0===q.length&&0===V.length&&!Q.topRatedMovies&&!Q.topRatedTv,error:Q.topRatedMovies||Q.topRatedTv,onRetry:()=>eN("topRated"),layout:"carousel"})}),(0,i.jsx)("div",{ref:ec,children:(0,i.jsx)(d,{title:"Popular",movieData:B,tvData:U,isLoading:0===B.length&&0===U.length&&!Q.popularMovies&&!Q.popularTv,error:Q.popularMovies||Q.popularTv,onRetry:()=>eN("popular"),layout:"carousel"})}),(0,i.jsx)("div",{ref:em,children:(0,i.jsx)(w,{})}),(0,i.jsx)("div",{className:"container mx-auto px-4 sm:px-6 lg:px-8 mt-8",children:(0,i.jsx)(k,{})})]})})]})}}},e=>{var t=t=>e(e.s=t);e.O(0,[8096,8e3,8441,7358],()=>t(4356)),_N_E=e.O()}]);