"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[5051],{1176:(e,t,r)=>{r.d(t,{S:()=>a});var s=r(2690);function a(e,t){let r=function(e){try{let t=new URL(e),r=t.pathname.split("/").filter(e=>e);if(r.length>=2){let e=r[0],s=r[1];if("movie"===e)return{mediaType:"movie",mediaId:s};if("tv"===e)if(r.length>=4)return{mediaType:"tv",mediaId:s,seasonNumber:parseInt(r[2],10),episodeNumber:parseInt(r[3],10)};else{let e=t.searchParams.get("season"),r=t.searchParams.get("episode");if(e&&r)return{mediaType:"tv",mediaId:s,seasonNumber:parseInt(e,10),episodeNumber:parseInt(r,10)};return{mediaType:"tv",mediaId:s}}}return null}catch(e){return null}}(e);if(!r)return null;let a="movie"===r.mediaType?(0,s.GV)(r.mediaId,"watch"):(0,s.pK)(r.mediaId,"watch"),l=new URLSearchParams;"tv"===r.mediaType&&r.seasonNumber&&r.episodeNumber&&(l.set("season",r.seasonNumber.toString()),l.set("episode",r.episodeNumber.toString())),"number"==typeof t&&l.set("source",t.toString());let i=l.toString();return i?"".concat(a,"?").concat(i):a}},1236:(e,t,r)=>{r.d(t,{A:()=>x});var s=r(5155),a=r(2115),l=r(1976),i=r(1366),n=r(429),o=r(4416);let d=e=>("string"==typeof e&&(e=parseInt(e)),isNaN(e)||null===e)?"0":e>=1e6?"".concat((e/1e6).toFixed(1),"M"):e>=1e3?"".concat((e/1e3).toFixed(1),"K"):e.toString(),c=e=>{let t=Math.floor((new Date().getTime()-e.getTime())/1e3),r=Math.floor(t/60),s=Math.floor(r/60),a=Math.floor(s/24),l=Math.floor(a/30),i=Math.floor(a/365);return t<60?"just now":r<60?"".concat(r,"m ago"):s<24?"".concat(s,"h ago"):a<30?"".concat(a,"d ago"):l<12?"".concat(l,"mo ago"):"".concat(i,"y ago")},m=function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=e.replace(/<[^>]*>/g,"").trim();return 0!==r.length&&(!!(/\d+:\d{2}(?::\d{2})?\b/.test(r)||/where can I watch this movie\?/i.test(r)||/\btrailer(s)?\b/i.test(r)||/[\u3040-\u309F\u30A0-\u30FF\u4E00-\u9FFF\uAC00-\uD7AF]/.test(r)||t&&/\d/.test(r))||!1)},x=e=>{let{videoId:t,inline:r=!1,likeCount:x,showLikes:u=!1}=e,[p,h]=(0,a.useState)(null),[b,g]=(0,a.useState)(x?d(x):null),[v,f]=(0,a.useState)([]),[w,y]=(0,a.useState)([]),[j,N]=(0,a.useState)(null),[k,S]=(0,a.useState)(!1),[C,L]=(0,a.useState)(!0),[A,E]=(0,a.useState)(!1),[D,F]=(0,a.useState)(null),[_,I]=(0,a.useState)(!1),[P,z]=(0,a.useState)(!1),[R,M]=(0,a.useState)("translate-y-full"),[T,U]=(0,a.useState)(!1),W=(0,a.useRef)(null),B=(0,a.useRef)(null),V=(0,a.useMemo)(()=>null===p||"N/A"===p?"0":d(p),[p]),H=(0,a.useCallback)(async()=>{try{L(!0);let e=await fetch("/api/youtube?action=videoInfo&videoId=".concat(t));if(!e.ok){let t=await e.json().catch(()=>({}));throw Error(t.error||"Failed to fetch video statistics: ".concat(e.status))}let r=await e.json();r.items&&r.items.length>0&&r.items[0].statistics?(h(r.items[0].statistics.commentCount||"0"),!x&&r.items[0].statistics.likeCount&&g(d(r.items[0].statistics.likeCount))):(h("N/A"),x||g("N/A"))}catch(e){F(t=>t?"".concat(t,"\n").concat(e.message):e.message),h("N/A"),x||g("N/A")}finally{L(!1)}},[t,x]);(0,a.useEffect)(()=>{y(v.filter(e=>!m(e.snippet.topLevelComment.snippet.textDisplay,!1)))},[v]);let O=(0,a.useCallback)(async function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;if(null===e&&v.length>0||A)return;let r=null!==e;r?E(!0):(L(!0),f([])),F(null);try{let a="/api/youtube?action=comments&videoId=".concat(t,"&maxResults=").concat(20);e&&(a+="&pageToken=".concat(e));let l=await fetch(a);if(!l.ok){var s;let e=await l.json().catch(()=>({}));throw Error((null==(s=e.error)?void 0:s.message)||"Failed to fetch comments: ".concat(l.status))}let i=await l.json();if(!i.items||!Array.isArray(i.items))throw Error("Invalid response format from API");f(e=>r?[...e,...i.items]:i.items),i.nextPageToken?(N(i.nextPageToken),I(!1)):(N(null),I(!0))}catch(e){F(t=>t?"".concat(t,"\n").concat(e.message):e.message)}finally{r?E(!1):L(!1)}},[t,v.length,A]);(0,a.useEffect)(()=>{if(!t){F("Video ID missing."),L(!1);return}H()},[t,H]),(0,a.useEffect)(()=>{if(!P||!B.current||!j||A||_)return;let e=new IntersectionObserver(e=>{e[0].isIntersecting&&!A&&j&&O(j)},{threshold:.1});return e.observe(B.current),()=>{B.current&&e.unobserve(B.current)}},[P,j,A,_,O]),(0,a.useEffect)(()=>{let e="showBottomNav";return k?(z(!0),setTimeout(()=>{M("translate-y-0")},10),document.body.style.overflow="hidden",window.dispatchEvent(new Event("hideBottomNav"))):(M("translate-y-full"),setTimeout(()=>{z(!1),document.body.style.overflow="",window.dispatchEvent(new Event(e))},300)),()=>{document.body.style.overflow="",window.dispatchEvent(new Event(e))}},[k]);let J=()=>{let e=!k;S(e),e&&!T&&0===w.length&&(O(),U(!0))},K=async()=>{f([]),await O()};return!C||T||k?D&&0===w.length&&!k?(0,s.jsxs)("div",{className:"p-4 bg-red-900/20 border border-red-500 text-red-400 rounded-lg w-full md:max-w-2xl mx-auto",children:[(0,s.jsx)("p",{className:"font-medium",children:"Failed to load video information"}),(0,s.jsx)("p",{className:"text-sm",children:D})]}):(0,s.jsxs)(s.Fragment,{children:[r?(0,s.jsxs)("button",{onClick:J,className:"relative inline-flex items-center justify-center gap-2 w-auto px-2 py-2 sm:px-3 sm:py-3 rounded-lg sm:rounded-xl bg-white/10 backdrop-blur-md border border-white/20 text-white font-semibold shadow-lg hover:bg-white/20 hover:border-white/30 hover:shadow-xl hover:scale-[1.02] transition-all duration-300 ease-out group group-hover:ring-2 group-hover:ring-white/30","aria-label":"Show Comments",title:"View Comments",children:[" ",(0,s.jsxs)("div",{className:"flex items-center gap-0.5 sm:gap-1",children:[(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:"w-4 h-4 sm:w-5 sm:h-5 text-blue-400 group-hover:text-blue-300",children:(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8.625 12a.375.375 0 11-.75 0 .375.375 0 01.75 0zm0 0H8.25m4.125 0a.375.375 0 11-.75 0 .375.375 0 01.75 0zm0 0H12m4.125 0a.375.375 0 11-.75 0 .375.375 0 01.75 0zm0 0h-.375M21 12c0 4.556-4.03 8.25-9 8.25a9.764 9.764 0 01-2.555-.337A5.972 5.972 0 015.41 20.97a5.969 5.969 0 01-.474-.065 4.48 4.48 0 00.978-2.025c.09-.457-.133-.901-.467-1.226C3.93 16.178 3 14.189 3 12c0-4.556 4.03-8.25 9-8.25s9 3.694 9 8.25z"})}),(0,s.jsx)("span",{className:"text-xs sm:text-sm font-medium",children:V})]}),u&&b&&"N/A"!==b&&(0,s.jsx)("div",{className:"h-4 w-px bg-white/30 mx-1 sm:mx-2"}),u&&b&&"N/A"!==b&&(0,s.jsxs)("div",{className:"flex items-center gap-0.5 sm:gap-1",children:[(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",className:"w-4 h-4 sm:w-5 sm:h-5 text-red-400 group-hover:text-red-300",children:(0,s.jsx)("path",{d:"M11.645 20.91l-.007-.003-.022-.012a15.247 15.247 0 01-.383-.218 25.18 25.18 0 01-4.244-3.17C4.688 15.36 2.25 12.174 2.25 8.25 2.25 5.322 4.714 3 7.688 3A5.5 5.5 0 0112 5.052 5.5 5.5 0 0116.313 3c2.973 0 5.437 2.322 5.437 5.25 0 3.925-2.438 7.111-4.739 9.256a25.175 25.175 0 01-4.244 3.17 15.247 15.247 0 01-.383.218l-.022.012-.007.004-.004.001a.752.752 0 01-.704 0l-.003-.001z"})}),(0,s.jsx)("span",{className:"text-xs sm:text-sm font-medium",children:b})]})]}):(0,s.jsx)("div",{className:"flex justify-center mt-4",children:(0,s.jsxs)("button",{onClick:J,className:"group relative flex flex-col items-center gap-2 transition-transform hover:scale-110 duration-300 ease-in-out","aria-label":"Show comments",children:[(0,s.jsxs)("div",{className:"relative w-14 h-14 flex items-center justify-center bg-gradient-to-br from-blue-700 to-blue-900 rounded-full shadow-lg border-2 border-blue-500/40 overflow-hidden hover:border-blue-400 transition-all",children:[(0,s.jsx)("div",{className:"absolute inset-0 bg-gradient-to-br from-red-600/30 to-red-800/30 opacity-0 group-hover:opacity-100 transition-opacity duration-300"}),(0,s.jsx)(i.A,{className:"w-7 h-7 text-white group-hover:text-white transition-colors duration-300",strokeWidth:1.5}),(0,s.jsx)("span",{className:"absolute -top-2 -right-2 flex items-center justify-center min-w-[22px] h-[22px] text-[10px] font-bold bg-blue-600 text-white rounded-full px-1 border-2 border-blue-400/50 shadow-lg",children:V})]}),(0,s.jsxs)("div",{className:"flex flex-wrap items-center justify-center gap-2",children:[(0,s.jsx)("div",{className:"flex items-center justify-center px-2.5 py-1 bg-gradient-to-r from-blue-700 to-blue-900 backdrop-blur-sm text-white font-medium text-xs rounded-full shadow-lg border border-blue-500/50 transform transition-all duration-300 group-hover:scale-105 group-hover:border-blue-400",children:(0,s.jsx)("span",{children:V})}),u&&b&&"N/A"!==b&&(0,s.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,s.jsx)("div",{className:"flex items-center justify-center px-2.5 py-1 bg-gradient-to-r from-red-700 to-red-900 backdrop-blur-sm text-white font-medium text-xs rounded-full shadow-lg border border-red-500/50 transform transition-all duration-300 group-hover:scale-105 group-hover:border-red-400",children:(0,s.jsx)("span",{children:b})}),(0,s.jsx)(l.A,{className:"w-3.5 h-3.5 text-red-300 fill-red-300",strokeWidth:0})]})]})]})}),P&&(0,s.jsx)("div",{className:"fixed inset-0 z-50 bg-black/80 backdrop-blur-md",onClick:()=>S(!1),children:(0,s.jsx)("div",{className:"fixed bottom-0 inset-x-0 mx-auto max-w-3xl z-50 bg-gradient-to-b from-gray-900 to-black rounded-t-3xl shadow-2xl transform transition-transform duration-300 ease-out ".concat(R," border-t-2 border-blue-500/50"),style:{maxHeight:"85vh",height:"85vh"},onClick:e=>e.stopPropagation(),children:(0,s.jsxs)("div",{className:"w-full h-full flex flex-col relative",children:[(0,s.jsxs)("div",{className:"sticky top-0 z-10 rounded-t-3xl border-b border-gray-800 bg-gradient-to-r from-blue-900/30 to-blue-800/20",children:[(0,s.jsx)("div",{className:"w-12 h-1.5 bg-blue-500/60 rounded-full mx-auto mt-3 mb-2"}),(0,s.jsxs)("div",{className:"flex items-center justify-between p-4",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)(i.A,{className:"w-5 h-5 text-blue-400"}),(0,s.jsx)("h3",{className:"font-semibold text-white",children:null!==p&&"N/A"!==p?"".concat(Number(p).toLocaleString()," Comments"):"Comments"}),u&&b&&"N/A"!==b&&(0,s.jsxs)("div",{className:"flex items-center gap-1.5 ml-2 bg-red-900/40 rounded-full px-2 py-0.5 border border-red-500/30",children:[(0,s.jsx)(l.A,{className:"w-3 h-3 text-red-400 fill-red-400"}),(0,s.jsx)("span",{className:"text-xs text-red-200",children:b})]})]}),(0,s.jsx)("div",{className:"flex items-center gap-2",children:(0,s.jsx)("button",{onClick:()=>S(!1),className:"p-2 hover:bg-blue-800/30 rounded-full transition-colors","aria-label":"Close comments",children:(0,s.jsx)(o.A,{className:"w-5 h-5 text-gray-300 hover:text-white"})})})]})]}),(0,s.jsxs)("div",{ref:W,className:"overflow-y-auto h-full pb-20 flex-grow",style:{maxHeight:"calc(85vh - 80px)"},children:[C&&0===w.length&&(0,s.jsxs)("div",{className:"flex flex-col items-center justify-center py-12",children:[(0,s.jsx)("div",{className:"w-12 h-12 border-4 border-blue-500 border-t-transparent rounded-full animate-spin mb-4"}),(0,s.jsx)("p",{className:"text-blue-300 font-medium",children:"Loading comments..."})]})," ",D&&0===w.length&&!C&&(0,s.jsx)("div",{className:"p-8 text-center",children:(0,s.jsxs)("div",{className:"bg-red-800/20 border border-red-500/30 rounded-lg p-4 max-w-md mx-auto",children:[(0,s.jsx)("p",{className:"text-red-400 font-medium mb-2",children:"Failed to load comments"}),(0,s.jsx)("p",{className:"text-red-300/70 text-sm",children:D}),(0,s.jsx)("button",{onClick:K,className:"mt-3 px-4 py-2 bg-red-700/30 hover:bg-red-700/50 rounded-md text-red-200 text-sm font-medium transition-colors",children:"Try Again"})]})}),w.length>0?(0,s.jsxs)("div",{className:"divide-y divide-gray-800/50",children:[w.map(e=>{let t=new Date(e.snippet.topLevelComment.snippet.publishedAt),r=e.snippet.topLevelComment.snippet.likeCount||0;return(0,s.jsx)("div",{className:"p-4 hover:bg-blue-900/20 transition-colors",children:(0,s.jsxs)("div",{className:"flex items-start gap-3",children:[(0,s.jsxs)("div",{className:"relative",children:[(0,s.jsx)("div",{className:"absolute inset-0 rounded-full bg-gradient-to-br from-blue-500 to-blue-700 opacity-50 blur-[1px]"}),(0,s.jsx)("img",{src:e.snippet.topLevelComment.snippet.authorProfileImageUrl,alt:"".concat(e.snippet.topLevelComment.snippet.authorDisplayName,"'s avatar"),className:"relative w-9 h-9 rounded-full bg-gray-700 object-cover border border-blue-500/40",onError:e=>e.currentTarget.src="https://via.placeholder.com/36"})]}),(0,s.jsxs)("div",{className:"flex-1",children:[(0,s.jsxs)("div",{className:"flex items-baseline flex-wrap gap-x-2",children:[(0,s.jsx)("span",{className:"font-medium text-white",children:e.snippet.topLevelComment.snippet.authorDisplayName}),(0,s.jsx)("span",{className:"text-xs text-blue-400/70",children:c(t)})]}),(0,s.jsx)("p",{className:"mt-1 text-gray-200 whitespace-pre-line text-sm",children:e.snippet.topLevelComment.snippet.textDisplay}),(0,s.jsxs)("div",{className:"flex items-center gap-6 mt-2 text-xs",children:[(0,s.jsxs)("button",{className:"flex items-center gap-2 text-red-400/70 hover:text-red-400 transition-colors group",children:[(0,s.jsx)(l.A,{className:"w-4 h-4 group-hover:fill-red-400/30 transition-all"}),(0,s.jsx)("span",{children:d(r)})]}),(0,s.jsxs)("button",{className:"flex items-center gap-2 text-blue-400/70 hover:text-blue-400 transition-colors",children:[(0,s.jsx)(i.A,{className:"w-4 h-4"}),(0,s.jsx)("span",{children:"Reply"})]})]})]})]})},e.id)}),(0,s.jsx)("div",{ref:B,className:"p-4 flex justify-center",children:A&&(0,s.jsxs)("div",{className:"flex flex-col items-center",children:[(0,s.jsx)("div",{className:"w-8 h-8 relative mb-2",children:(0,s.jsxs)("svg",{className:"animate-spin w-full h-full text-blue-500",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[(0,s.jsx)("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"2"}),(0,s.jsx)("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]})}),(0,s.jsx)("span",{className:"text-sm text-blue-400 font-medium",children:"Loading more comments..."})]})}),_&&!A&&(0,s.jsx)("div",{className:"p-8 text-center",children:(0,s.jsx)("div",{className:"inline-block bg-gradient-to-r from-blue-900/40 to-blue-800/30 rounded-full px-5 py-2 border border-blue-500/30",children:(0,s.jsx)("span",{className:"text-sm font-medium bg-gradient-to-r from-blue-400 to-white bg-clip-text text-transparent",children:"End of comments"})})})]}):!C&&(0,s.jsxs)("div",{className:"p-12 text-center",children:[(0,s.jsx)("div",{className:"w-16 h-16 rounded-full bg-blue-900/30 border border-blue-500/30 flex items-center justify-center mx-auto mb-4",children:(0,s.jsx)(i.A,{className:"w-8 h-8 text-blue-400/70"})}),(0,s.jsx)("p",{className:"text-blue-200 font-medium",children:"No comments to display"}),(0,s.jsx)("p",{className:"text-gray-400 text-sm mt-1",children:"Be the first to comment on this video"})]})]}),(0,s.jsxs)("div",{className:"absolute bottom-0 left-0 right-0 bg-gradient-to-r from-blue-900/30 to-blue-800/20 backdrop-blur-sm border-t border-blue-500/30 px-4 py-3 flex items-center gap-3",children:[(0,s.jsx)("div",{className:"flex-1 bg-black/50 rounded-full px-4 py-2.5 text-gray-300 text-sm border border-blue-500/30 focus-within:border-blue-400/70 transition-colors",children:"Add a comment..."}),(0,s.jsx)("button",{className:"bg-blue-600 hover:bg-blue-500 p-2.5 rounded-full text-white transition-colors shadow-lg shadow-blue-900/40",children:(0,s.jsx)(n.A,{className:"w-4 h-4"})})]})]})})})]}):(0,s.jsx)("div",{className:"p-4 rounded-lg bg-gray-800/50 animate-pulse flex items-center justify-center w-full md:max-w-2xl mx-auto",children:(0,s.jsx)("div",{className:"w-6 h-6 border-2 border-blue-500 border-t-transparent rounded-full animate-spin mr-2"})})}},2540:(e,t,r)=>{r.d(t,{A:()=>h});var s=r(5155),a=r(2115),l=r(3786),i=r(7580),n=r(5695),o=r(4869),d=r(2919),c=r(4416),m=r(3226);function x(e){let{isOpen:t,onClose:r,media:l,currentVideoUrl:x,selectedSourceIndex:u,onPartyCreated:p}=e,h=(0,n.useRouter)(),{createParty:b,loading:g}=(0,m.x)(),v=e=>"title"in e?e.title:e.name,[f,w]=(0,a.useState)({title:"".concat(v(l)," Watch Party"),description:"",is_public:!1,max_participants:10}),y=async e=>{e.preventDefault();let t=await b({title:f.title,media_id:l.id,media_type:l.media_type||"movie",poster_path:l.poster_path||void 0,description:f.description,is_public:f.is_public,max_participants:f.max_participants,video_url:x,selected_source_index:u||0});t&&(p&&p(),r(),h.push("/party/".concat(t)))};return t?(0,s.jsxs)("div",{className:"fixed inset-0 z-[9999] flex items-center justify-center p-3 sm:p-4 md:p-6 lg:p-8",style:{display:"flex",alignItems:"center",justifyContent:"center",minHeight:"100vh",width:"100vw"},children:[(0,s.jsx)("div",{className:"absolute inset-0 bg-gradient-to-br from-gray-900/95 via-gray-800/90 to-black/98 backdrop-blur-3xl",onClick:r,style:{background:"linear-gradient(135deg, rgba(17, 24, 39, 0.95) 0%, rgba(31, 41, 55, 0.90) 35%, rgba(55, 65, 81, 0.85) 70%, rgba(0, 0, 0, 0.98) 100%)",backdropFilter:"blur(50px) saturate(200%)"}}),(0,s.jsxs)("div",{className:"relative w-full max-w-[320px] sm:max-w-sm md:max-w-md overflow-hidden mx-auto",style:{background:"linear-gradient(145deg, rgba(31, 41, 55, 0.8) 0%, rgba(17, 24, 39, 0.9) 100%)",backdropFilter:"blur(40px) saturate(200%)",border:"1px solid rgba(99, 102, 241, 0.3)",borderRadius:"20px",margin:"0 auto",transform:"translateY(0)",minHeight:"auto",maxHeight:"90vh",overflowY:"auto",boxShadow:"\n 0 32px 64px rgba(0, 0, 0, 0.9),\n 0 16px 32px rgba(99, 102, 241, 0.4),\n 0 8px 16px rgba(147, 51, 234, 0.3),\n inset 0 1px 0 rgba(99, 102, 241, 0.2),\n inset 0 -1px 0 rgba(0, 0, 0, 0.8)\n "},children:[" ",(0,s.jsx)("div",{className:"relative p-4 sm:p-6 border-b border-gray-700/50",style:{background:"linear-gradient(135deg, rgba(55, 65, 81, 0.7) 0%, rgba(31, 41, 55, 0.8) 100%)",backdropFilter:"blur(30px)",borderRadius:"20px 20px 0 0"},children:(0,s.jsxs)("div",{className:"flex items-center justify-between",children:[(0,s.jsx)("h2",{className:"text-lg sm:text-xl md:text-2xl font-bold text-white leading-tight",children:"\uD83C\uDFAC Create Watch Party"}),(0,s.jsx)("button",{onClick:r,className:"group relative p-2 sm:p-3 rounded-xl sm:rounded-2xl transition-all duration-300 hover:scale-110",style:{background:"linear-gradient(135deg, rgba(99, 102, 241, 0.3) 0%, rgba(147, 51, 234, 0.2) 100%)",backdropFilter:"blur(10px)",border:"1px solid rgba(99, 102, 241, 0.4)"},disabled:g,children:(0,s.jsx)(c.A,{className:"w-5 h-5 sm:w-6 sm:h-6 text-gray-300 group-hover:text-white transition-colors duration-300"})})]})})," ",(0,s.jsxs)("div",{className:"p-4 sm:p-5 md:p-6",children:[(0,s.jsxs)("div",{className:"flex items-start space-x-3 sm:space-x-4 mb-5 sm:mb-6 p-3 sm:p-4 rounded-xl sm:rounded-2xl",style:{background:"linear-gradient(135deg, rgba(55, 65, 81, 0.6) 0%, rgba(31, 41, 55, 0.7) 100%)",backdropFilter:"blur(20px) saturate(150%)",border:"1px solid rgba(99, 102, 241, 0.2)",boxShadow:"inset 0 1px 0 rgba(99, 102, 241, 0.1), 0 8px 32px rgba(0, 0, 0, 0.3)"},children:[" ",(0,s.jsx)("img",{src:l.poster_path?"https://image.tmdb.org/t/p/w200".concat(l.poster_path):"/images/placeholder-poster.png",alt:v(l),className:"w-14 h-20 sm:w-16 sm:h-24 object-cover rounded-lg"}),(0,s.jsxs)("div",{children:[(0,s.jsx)("h3",{className:"font-semibold text-white text-sm sm:text-base",children:v(l)}),(0,s.jsx)("p",{className:"text-xs sm:text-sm text-gray-300 mt-1",children:(e=>{let t="release_date"in e?e.release_date:e.first_air_date;return t?new Date(t).getFullYear():""})(l)}),(0,s.jsx)("p",{className:"text-xs sm:text-sm text-gray-400",children:"tv"===l.media_type?"TV Series":"Movie"})]})]})," ",(0,s.jsxs)("form",{onSubmit:y,className:"space-y-5 sm:space-y-6",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"block text-xs sm:text-sm font-medium text-gray-300 mb-2 sm:mb-3",children:"\uD83C\uDFAC Party Title"}),(0,s.jsx)("div",{className:"relative",children:(0,s.jsx)("input",{type:"text",value:f.title,onChange:e=>w(t=>({...t,title:e.target.value})),className:"w-full text-sm sm:text-base text-white placeholder-gray-400 rounded-xl sm:rounded-2xl transition-all duration-300 focus:scale-[1.02] disabled:opacity-50",style:{background:"linear-gradient(135deg, rgba(55, 65, 81, 0.6) 0%, rgba(31, 41, 55, 0.7) 100%)",backdropFilter:"blur(20px) saturate(150%)",border:"1px solid rgba(99, 102, 241, 0.3)",padding:"16px 20px",boxShadow:"\n 0 8px 32px rgba(99, 102, 241, 0.2),\n inset 0 1px 0 rgba(255, 255, 255, 0.1),\n inset 0 -1px 0 rgba(0, 0, 0, 0.2)\n "},required:!0,disabled:g,placeholder:"Enter party title..."})})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"block text-xs sm:text-sm font-medium text-gray-300 mb-2 sm:mb-3",children:"\uD83D\uDCDD Description (Optional)"}),(0,s.jsx)("div",{className:"relative",children:(0,s.jsx)("textarea",{value:f.description,onChange:e=>w(t=>({...t,description:e.target.value})),className:"w-full text-sm sm:text-base text-white placeholder-gray-400 rounded-xl sm:rounded-2xl transition-all duration-300 focus:scale-[1.02] disabled:opacity-50 resize-none",style:{background:"linear-gradient(135deg, rgba(55, 65, 81, 0.6) 0%, rgba(31, 41, 55, 0.7) 100%)",backdropFilter:"blur(20px) saturate(150%)",border:"1px solid rgba(99, 102, 241, 0.3)",padding:"16px 20px",boxShadow:"\n 0 8px 32px rgba(99, 102, 241, 0.2),\n inset 0 1px 0 rgba(255, 255, 255, 0.1),\n inset 0 -1px 0 rgba(0, 0, 0, 0.2)\n ",minHeight:"80px"},rows:3,placeholder:"Tell people what this party is about...",disabled:g})})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"block text-xs sm:text-sm font-medium text-gray-300 mb-3 sm:mb-4",children:"\uD83D\uDD12 Privacy Settings"}),(0,s.jsxs)("div",{className:"flex space-x-3 sm:space-x-4",children:[(0,s.jsxs)("button",{type:"button",onClick:()=>w(e=>({...e,is_public:!1})),className:"flex-1 p-3 sm:p-4 rounded-xl sm:rounded-2xl transition-all duration-300 hover:scale-[1.02] ".concat(f.is_public?"":"scale-[1.02]"),style:{background:f.is_public?"linear-gradient(135deg, rgba(55, 65, 81, 0.4) 0%, rgba(31, 41, 55, 0.5) 100%)":"linear-gradient(135deg, rgba(99, 102, 241, 0.4) 0%, rgba(147, 51, 234, 0.3) 100%)",backdropFilter:"blur(20px) saturate(150%)",border:"1px solid ".concat(f.is_public?"rgba(99, 102, 241, 0.2)":"rgba(99, 102, 241, 0.5)"),boxShadow:f.is_public?"0 4px 16px rgba(0, 0, 0, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.05)":"0 8px 32px rgba(99, 102, 241, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.1)"},disabled:g,children:[(0,s.jsx)(d.A,{className:"w-4 h-4 sm:w-5 sm:h-5 text-gray-300 mx-auto mb-2"}),(0,s.jsx)("div",{className:"text-xs sm:text-sm font-medium text-white",children:"Private"}),(0,s.jsx)("div",{className:"text-xs text-gray-400",children:"Invite only"})]}),(0,s.jsxs)("button",{type:"button",onClick:()=>w(e=>({...e,is_public:!0})),className:"flex-1 p-3 sm:p-4 rounded-xl sm:rounded-2xl transition-all duration-300 hover:scale-[1.02] ".concat(f.is_public?"scale-[1.02]":""),style:{background:f.is_public?"linear-gradient(135deg, rgba(99, 102, 241, 0.4) 0%, rgba(147, 51, 234, 0.3) 100%)":"linear-gradient(135deg, rgba(55, 65, 81, 0.4) 0%, rgba(31, 41, 55, 0.5) 100%)",backdropFilter:"blur(20px) saturate(150%)",border:"1px solid ".concat(f.is_public?"rgba(99, 102, 241, 0.5)":"rgba(99, 102, 241, 0.2)"),boxShadow:f.is_public?"0 8px 32px rgba(99, 102, 241, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.1)":"0 4px 16px rgba(0, 0, 0, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.05)"},disabled:g,children:[(0,s.jsx)(o.A,{className:"w-4 h-4 sm:w-5 sm:h-5 text-gray-300 mx-auto mb-2"}),(0,s.jsx)("div",{className:"text-xs sm:text-sm font-medium text-white",children:"Public"}),(0,s.jsx)("div",{className:"text-xs text-gray-400",children:"Anyone can join"})]})]})]}),(0,s.jsxs)("div",{children:[(0,s.jsxs)("label",{className:"block text-xs sm:text-sm font-medium text-gray-300 mb-2 sm:mb-3",children:[(0,s.jsx)(i.A,{className:"w-3 h-3 sm:w-4 sm:h-4 inline mr-1"}),"\uD83D\uDC65 Max Participants"]}),(0,s.jsxs)("div",{className:"relative",children:[(0,s.jsxs)("select",{value:f.max_participants,onChange:e=>w(t=>({...t,max_participants:parseInt(e.target.value)})),className:"w-full text-sm sm:text-base text-white rounded-xl sm:rounded-2xl transition-all duration-300 focus:scale-[1.02] disabled:opacity-50 appearance-none cursor-pointer",style:{background:"linear-gradient(135deg, rgba(55, 65, 81, 0.6) 0%, rgba(31, 41, 55, 0.7) 100%)",backdropFilter:"blur(20px) saturate(150%)",border:"1px solid rgba(99, 102, 241, 0.3)",padding:"16px 20px",boxShadow:"\n 0 8px 32px rgba(99, 102, 241, 0.2),\n inset 0 1px 0 rgba(255, 255, 255, 0.1),\n inset 0 -1px 0 rgba(0, 0, 0, 0.2)\n "},disabled:g,children:[(0,s.jsx)("option",{value:5,style:{background:"rgba(31, 41, 55, 0.95)",color:"white"},children:"5 people"}),(0,s.jsx)("option",{value:10,style:{background:"rgba(31, 41, 55, 0.95)",color:"white"},children:"10 people"}),(0,s.jsx)("option",{value:20,style:{background:"rgba(31, 41, 55, 0.95)",color:"white"},children:"20 people"}),(0,s.jsx)("option",{value:50,style:{background:"rgba(31, 41, 55, 0.95)",color:"white"},children:"50 people"})]}),(0,s.jsx)("div",{className:"absolute inset-y-0 right-4 flex items-center pointer-events-none",children:(0,s.jsx)("svg",{className:"w-4 h-4 text-gray-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})})]})]})," ",(0,s.jsxs)("div",{className:"flex space-x-3 sm:space-x-4 pt-6",children:[(0,s.jsx)("button",{type:"button",onClick:r,className:"flex-1 py-3 sm:py-4 md:py-5 text-xs sm:text-sm font-medium text-gray-300 rounded-xl sm:rounded-2xl transition-all duration-300 hover:scale-[1.02] hover:text-white disabled:opacity-50",style:{background:"linear-gradient(135deg, rgba(55, 65, 81, 0.6) 0%, rgba(31, 41, 55, 0.7) 100%)",backdropFilter:"blur(20px) saturate(150%)",border:"1px solid rgba(99, 102, 241, 0.2)",boxShadow:"\n 0 8px 32px rgba(0, 0, 0, 0.2),\n inset 0 1px 0 rgba(255, 255, 255, 0.1),\n inset 0 -1px 0 rgba(0, 0, 0, 0.2)\n "},disabled:g,children:"Cancel"}),(0,s.jsxs)("button",{type:"submit",className:"flex-1 py-3 sm:py-4 md:py-5 text-xs sm:text-sm font-bold text-white rounded-xl sm:rounded-2xl transition-all duration-300 hover:scale-[1.02] disabled:opacity-50 disabled:cursor-not-allowed relative overflow-hidden group",style:{background:"\n linear-gradient(135deg, \n rgba(99, 102, 241, 0.8) 0%, \n rgba(147, 51, 234, 0.8) 35%, \n rgba(59, 130, 246, 0.8) 100%\n )\n ",backdropFilter:"blur(20px) saturate(200%)",border:"1px solid rgba(99, 102, 241, 0.5)",boxShadow:"\n 0 16px 64px rgba(99, 102, 241, 0.4),\n 0 8px 32px rgba(147, 51, 234, 0.3),\n 0 4px 16px rgba(59, 130, 246, 0.2),\n inset 0 1px 0 rgba(255, 255, 255, 0.2),\n inset 0 -1px 0 rgba(0, 0, 0, 0.2)\n "},disabled:g,children:[(0,s.jsx)("div",{className:"absolute inset-0 opacity-0 group-hover:opacity-100 transition-opacity duration-300",style:{background:"\n linear-gradient(135deg, \n rgba(139, 69, 255, 0.9) 0%, \n rgba(59, 130, 246, 0.9) 50%, \n rgba(16, 185, 129, 0.9) 100%\n )\n "}}),(0,s.jsx)("span",{className:"relative z-10 flex items-center justify-center",children:g?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("svg",{className:"animate-spin -ml-1 mr-2 h-4 w-4 text-white",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[(0,s.jsx)("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),(0,s.jsx)("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),"Creating..."]}):"\uD83D\uDE80 Create Party"})]})]})]})]})]})]}):null}var u=r(1176);function p(e){let{isOpen:t,onClose:r}=e,l=(0,n.useRouter)(),{joinPartyByCode:o,loading:d,error:x}=(0,m.x)(),[p,h]=(0,a.useState)(""),b=async e=>{if(e.preventDefault(),!p.trim())return;let t=await o(p.trim());if(t)if(r(),h(""),t.videoUrl){let e=(0,u.S)(t.videoUrl,t.selectedSourceIndex);e?l.push(e):l.push("/party/".concat(t.partyId))}else l.push("/party/".concat(t.partyId))};return t?(0,s.jsxs)("div",{className:"fixed inset-0 z-[9999] flex items-center justify-center p-3 sm:p-4 md:p-6 lg:p-8",style:{display:"flex",alignItems:"center",justifyContent:"center",minHeight:"100vh",width:"100vw"},children:[(0,s.jsx)("div",{className:"absolute inset-0 bg-gradient-to-br from-gray-900/95 via-gray-800/90 to-black/98 backdrop-blur-3xl",onClick:r,style:{background:"linear-gradient(135deg, rgba(17, 24, 39, 0.95) 0%, rgba(31, 41, 55, 0.90) 35%, rgba(55, 65, 81, 0.85) 70%, rgba(0, 0, 0, 0.98) 100%)",backdropFilter:"blur(50px) saturate(200%)"}}),(0,s.jsxs)("div",{className:"relative w-full max-w-[320px] sm:max-w-sm md:max-w-md overflow-hidden mx-auto",style:{background:"linear-gradient(145deg, rgba(31, 41, 55, 0.8) 0%, rgba(17, 24, 39, 0.9) 100%)",backdropFilter:"blur(40px) saturate(200%)",border:"1px solid rgba(99, 102, 241, 0.3)",borderRadius:"20px",margin:"0 auto",transform:"translateY(0)",minHeight:"auto",maxHeight:"90vh",overflowY:"auto",boxShadow:"\n 0 32px 64px rgba(0, 0, 0, 0.9),\n 0 16px 32px rgba(99, 102, 241, 0.4),\n 0 8px 16px rgba(147, 51, 234, 0.3),\n inset 0 1px 0 rgba(99, 102, 241, 0.2),\n inset 0 -1px 0 rgba(0, 0, 0, 0.8)\n "},children:[(0,s.jsx)("div",{className:"relative p-4 sm:p-6 border-b border-gray-700/50",style:{background:"linear-gradient(135deg, rgba(55, 65, 81, 0.7) 0%, rgba(31, 41, 55, 0.8) 100%)",backdropFilter:"blur(30px)",borderRadius:"20px 20px 0 0"},children:(0,s.jsxs)("div",{className:"flex items-center justify-between",children:[(0,s.jsx)("h2",{className:"text-lg sm:text-xl md:text-2xl font-bold text-white leading-tight",children:"\uD83C\uDFAE Join Watch Party"}),(0,s.jsx)("button",{onClick:r,className:"group relative p-2 sm:p-3 rounded-xl sm:rounded-2xl transition-all duration-300 hover:scale-110",style:{background:"linear-gradient(135deg, rgba(99, 102, 241, 0.3) 0%, rgba(147, 51, 234, 0.2) 100%)",backdropFilter:"blur(10px)",border:"1px solid rgba(99, 102, 241, 0.4)"},disabled:d,children:(0,s.jsx)(c.A,{className:"w-5 h-5 sm:w-6 sm:h-6 text-gray-300 group-hover:text-white transition-colors duration-300"})})]})}),(0,s.jsxs)("div",{className:"p-4 sm:p-5 md:p-6",children:[(0,s.jsxs)("div",{className:"text-center mb-5 sm:mb-6 p-4 sm:p-6 rounded-xl sm:rounded-2xl",style:{background:"linear-gradient(135deg, rgba(55, 65, 81, 0.6) 0%, rgba(31, 41, 55, 0.7) 100%)",backdropFilter:"blur(20px) saturate(150%)",border:"1px solid rgba(99, 102, 241, 0.2)",boxShadow:"inset 0 1px 0 rgba(99, 102, 241, 0.1), 0 8px 32px rgba(0, 0, 0, 0.3)"},children:[(0,s.jsx)("div",{className:"w-16 h-16 sm:w-20 sm:h-20 rounded-full flex items-center justify-center mx-auto mb-4",style:{background:"linear-gradient(135deg, rgba(99, 102, 241, 0.4) 0%, rgba(147, 51, 234, 0.3) 100%)",backdropFilter:"blur(20px)",border:"1px solid rgba(99, 102, 241, 0.5)",boxShadow:"0 8px 32px rgba(99, 102, 241, 0.3)"},children:(0,s.jsx)(i.A,{className:"w-8 h-8 sm:w-10 sm:h-10 text-blue-300"})}),(0,s.jsx)("p",{className:"text-sm sm:text-base text-gray-300 leading-relaxed",children:"Enter the invite code shared by your friend to join their watch party"})]}),(0,s.jsxs)("form",{onSubmit:b,className:"space-y-5 sm:space-y-6",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"block text-xs sm:text-sm font-medium text-gray-300 mb-2 sm:mb-3",children:"\uD83D\uDD11 Invite Code"}),(0,s.jsx)("div",{className:"relative",children:(0,s.jsx)("input",{type:"text",value:p,onChange:e=>h(e.target.value.toUpperCase()),className:"w-full text-lg sm:text-xl text-white placeholder-gray-400 text-center font-mono tracking-wider rounded-xl sm:rounded-2xl transition-all duration-300 focus:scale-[1.02] disabled:opacity-50",style:{background:"linear-gradient(135deg, rgba(55, 65, 81, 0.6) 0%, rgba(31, 41, 55, 0.7) 100%)",backdropFilter:"blur(20px) saturate(150%)",border:"1px solid rgba(99, 102, 241, 0.3)",padding:"16px 20px",boxShadow:"\n 0 8px 32px rgba(99, 102, 241, 0.2),\n inset 0 1px 0 rgba(255, 255, 255, 0.1),\n inset 0 -1px 0 rgba(0, 0, 0, 0.2)\n "},placeholder:"ABC123",required:!0,disabled:d,maxLength:6})}),(0,s.jsx)("p",{className:"text-xs sm:text-sm text-gray-400 mt-2 text-center",children:"Invite codes are 6 characters long"})]}),x&&(0,s.jsx)("div",{className:"p-3 sm:p-4 rounded-xl border text-red-300",style:{background:"linear-gradient(135deg, rgba(220, 38, 38, 0.2) 0%, rgba(153, 27, 27, 0.3) 100%)",backdropFilter:"blur(20px)",border:"1px solid rgba(220, 38, 38, 0.4)",boxShadow:"0 8px 32px rgba(220, 38, 38, 0.2)"},children:(0,s.jsx)("p",{className:"text-sm font-medium",children:x})}),(0,s.jsxs)("div",{className:"flex space-x-3 sm:space-x-4 pt-6",children:[(0,s.jsx)("button",{type:"button",onClick:r,className:"flex-1 py-3 sm:py-4 md:py-5 text-xs sm:text-sm font-medium text-gray-300 rounded-xl sm:rounded-2xl transition-all duration-300 hover:scale-[1.02] hover:text-white disabled:opacity-50",style:{background:"linear-gradient(135deg, rgba(55, 65, 81, 0.6) 0%, rgba(31, 41, 55, 0.7) 100%)",backdropFilter:"blur(20px) saturate(150%)",border:"1px solid rgba(99, 102, 241, 0.2)",boxShadow:"\n 0 8px 32px rgba(0, 0, 0, 0.2),\n inset 0 1px 0 rgba(255, 255, 255, 0.1),\n inset 0 -1px 0 rgba(0, 0, 0, 0.2)\n "},disabled:d,children:"Cancel"}),(0,s.jsxs)("button",{type:"submit",className:"flex-1 py-3 sm:py-4 md:py-5 text-xs sm:text-sm font-bold text-white rounded-xl sm:rounded-2xl transition-all duration-300 hover:scale-[1.02] disabled:opacity-50 disabled:cursor-not-allowed relative overflow-hidden group",style:{background:"\n linear-gradient(135deg, \n rgba(99, 102, 241, 0.8) 0%, \n rgba(147, 51, 234, 0.8) 35%, \n rgba(59, 130, 246, 0.8) 100%\n )\n ",backdropFilter:"blur(20px) saturate(200%)",border:"1px solid rgba(99, 102, 241, 0.5)",boxShadow:"\n 0 16px 64px rgba(99, 102, 241, 0.4),\n 0 8px 32px rgba(147, 51, 234, 0.3),\n 0 4px 16px rgba(59, 130, 246, 0.2),\n inset 0 1px 0 rgba(255, 255, 255, 0.2),\n inset 0 -1px 0 rgba(0, 0, 0, 0.2)\n "},disabled:d||!p.trim(),children:[(0,s.jsx)("div",{className:"absolute inset-0 opacity-0 group-hover:opacity-100 transition-opacity duration-300",style:{background:"\n linear-gradient(135deg, \n rgba(139, 69, 255, 0.9) 0%, \n rgba(59, 130, 246, 0.9) 50%, \n rgba(16, 185, 129, 0.9) 100%\n )\n "}}),(0,s.jsx)("span",{className:"relative z-10 flex items-center justify-center",children:d?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("svg",{className:"animate-spin -ml-1 mr-2 h-4 w-4 text-white",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[(0,s.jsx)("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),(0,s.jsx)("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),"Joining..."]}):"\uD83D\uDE80 Join Party"})]})]})]}),(0,s.jsxs)("div",{className:"mt-6 p-4 sm:p-5 rounded-xl sm:rounded-2xl",style:{background:"linear-gradient(135deg, rgba(55, 65, 81, 0.5) 0%, rgba(31, 41, 55, 0.6) 100%)",backdropFilter:"blur(20px) saturate(150%)",border:"1px solid rgba(99, 102, 241, 0.2)",boxShadow:"inset 0 1px 0 rgba(99, 102, 241, 0.1), 0 8px 32px rgba(0, 0, 0, 0.2)"},children:[(0,s.jsx)("h3",{className:"text-sm sm:text-base font-medium text-white mb-3 flex items-center",children:"\uD83D\uDCA1 How to get an invite code:"}),(0,s.jsxs)("ul",{className:"text-xs sm:text-sm text-gray-300 space-y-2",children:[(0,s.jsxs)("li",{className:"flex items-center space-x-2",children:[(0,s.jsx)("div",{className:"w-1.5 h-1.5 bg-blue-400 rounded-full flex-shrink-0"}),(0,s.jsx)("span",{children:"Ask a friend to share their party's invite code"})]}),(0,s.jsxs)("li",{className:"flex items-center space-x-2",children:[(0,s.jsx)("div",{className:"w-1.5 h-1.5 bg-purple-400 rounded-full flex-shrink-0"}),(0,s.jsx)("span",{children:"Look for party links shared on social media"})]}),(0,s.jsxs)("li",{className:"flex items-center space-x-2",children:[(0,s.jsx)("div",{className:"w-1.5 h-1.5 bg-green-400 rounded-full flex-shrink-0"}),(0,s.jsx)("span",{children:"Browse public parties (coming soon)"})]})]})]})]})]})]}):null}let h=e=>{let{mediaId:t,mediaType:r,title:o,posterPath:d,seasonNumber:c,episodeNumber:u,currentVideoUrl:h,selectedSourceIndex:b}=e,g=(0,n.useRouter)(),{checkExistingPartyForMedia:v}=(0,m.x)(),[f,w]=(0,a.useState)(!1),[y,j]=(0,a.useState)(!1),[N,k]=(0,a.useState)(!1),[S,C]=(0,a.useState)(null),[L,A]=(0,a.useState)(!1);return(0,a.useEffect)(()=>{(async()=>{A(!0);try{let e=await v(Number(t),r);C(e)}catch(e){}finally{A(!1)}})()},[t,r,v]),(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("div",{className:"flex-shrink-0 relative",children:[S?(0,s.jsxs)("button",{onClick:()=>{S&&g.push("/party/".concat(S.id))},disabled:L,className:"relative inline-flex items-center justify-center gap-2 px-2 py-2 sm:px-3 sm:py-3 rounded-lg sm:rounded-xl bg-green-500/20 backdrop-blur-md border border-green-400/30 text-green-300 font-semibold shadow-lg hover:bg-green-500/30 hover:border-green-400/50 hover:shadow-xl hover:scale-[1.02] transition-all duration-300 ease-out group disabled:opacity-50 disabled:cursor-not-allowed",title:"Go to your existing party",children:[(0,s.jsx)(l.A,{className:"w-4 h-4 sm:w-5 sm:h-5 flex-shrink-0"}),(0,s.jsx)("span",{className:"hidden sm:inline text-xs sm:text-sm font-medium",children:"Go to Party"})]}):(0,s.jsxs)("button",{onClick:()=>k(!N),disabled:L,className:"relative inline-flex items-center justify-center gap-2 px-2 py-2 sm:px-3 sm:py-3 rounded-lg sm:rounded-xl bg-white/10 backdrop-blur-md border border-white/20 text-white font-semibold shadow-lg hover:bg-white/20 hover:border-white/30 hover:shadow-xl hover:scale-[1.02] transition-all duration-300 ease-out group disabled:opacity-50 disabled:cursor-not-allowed",title:"Watch with Friends",children:[(0,s.jsx)(i.A,{className:"w-4 h-4 sm:w-5 sm:h-5 flex-shrink-0"}),(0,s.jsx)("span",{className:"hidden sm:inline text-xs sm:text-sm font-medium",children:L?"Loading...":"Party"}),!L&&(0,s.jsx)("svg",{className:"w-3 h-3 transition-transform duration-200 ".concat(N?"rotate-180":""),fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]})," ",N&&!S&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("div",{className:"fixed inset-0 z-40",onClick:()=>k(!1)}),(0,s.jsxs)("div",{className:"absolute top-full left-0 mt-2 w-48 bg-gray-900/95 backdrop-blur-md border border-white/20 rounded-lg shadow-xl z-50 overflow-hidden",children:[(0,s.jsxs)("button",{onClick:()=>{k(!1),w(!0)},className:"w-full px-4 py-3 text-left text-white hover:bg-white/10 transition-colors duration-200 flex items-center gap-3",children:[(0,s.jsx)("div",{className:"w-2 h-2 bg-green-400 rounded-full flex-shrink-0"}),(0,s.jsxs)("div",{children:[(0,s.jsx)("div",{className:"font-medium text-sm",children:"Create Party"}),(0,s.jsx)("div",{className:"text-xs text-gray-400",children:"Start a new watch party"})]})]}),(0,s.jsx)("div",{className:"border-t border-white/10"}),(0,s.jsxs)("button",{onClick:()=>{k(!1),j(!0)},className:"w-full px-4 py-3 text-left text-white hover:bg-white/10 transition-colors duration-200 flex items-center gap-3",children:[(0,s.jsx)("div",{className:"w-2 h-2 bg-blue-400 rounded-full flex-shrink-0"}),(0,s.jsxs)("div",{children:[(0,s.jsx)("div",{className:"font-medium text-sm",children:"Join Party"}),(0,s.jsx)("div",{className:"text-xs text-gray-400",children:"Enter invite code"})]})]})]})]})]})," "," ",f&&(0,s.jsx)(x,{isOpen:f,onClose:()=>w(!1),media:{id:Number(t),media_type:r,title:"movie"===r?o:"",name:"tv"===r?o:"",poster_path:d||null,backdrop_path:null,vote_average:0,release_date:"",first_air_date:"",overview:""},currentVideoUrl:h,selectedSourceIndex:b,onPartyCreated:()=>{(async()=>{try{let e=await v(Number(t),r);C(e)}catch(e){}})()}}),y&&(0,s.jsx)(p,{isOpen:y,onClose:()=>j(!1)})]})}},2771:(e,t,r)=>{r.d(t,{A:()=>x});var s=r(5155),a=r(2115);class l extends a.Component{static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(e,t){}render(){return this.state.hasError?this.props.fallback||(0,s.jsx)("div",{children:"Something went wrong."}):this.props.children}constructor(e){super(e),this.state={hasError:!1}}}var i=r(1236),n=r(2373),o=r(5305);r(9434);var d=r(2540),c=r(7390),m=r(4768);let x=e=>{let{sources:t=[],mediaType:r,mediaId:m,title:x,seasonNumber:u,episodeNumber:p,selectedSourceIndex:h,setSelectedSourceIndex:b,trailerId:g,likeCount:v,hideVideoPlayer:f=!1,is4KAvailable:w=!1,is4KSelected:y=!1,onToggle4K:j}=e,{dimensions:N,isMobile:k,orientation:S}=(0,o.K)(),[C,L]=(0,a.useState)(null),A=(0,a.useRef)(null),[E,D]=(0,a.useState)(!1),[F,_]=(0,a.useState)(!0),{addToWatchlist:I,isInWatchlist:P,removeFromWatchlist:z,isLoading:R}=(0,n.U)(),[M,T]=(0,a.useState)(!1),[U,W]=(0,a.useState)(!1);(0,a.useEffect)(()=>{if(!R){let e=P(m,r);e!==U&&W(e)}},[R,m,r,P,U]),(0,a.useEffect)(()=>{if(!M&&!R){let e=P(m,r);e!==U&&W(e)}},[M,R,m,r,P,U]);let B=async()=>{try{let e={title:x?"Watch ".concat(x):"Watch now",text:"movie"===r?"Check out this movie: ".concat(x):"Check out this TV show: ".concat(x).concat(u?" S".concat(u):"").concat(p?" E".concat(p):""),url:window.location.href};navigator.share?await navigator.share(e):(await navigator.clipboard.writeText("".concat(e.text," - ").concat(window.location.href)),alert("Link copied to clipboard!"))}catch(e){}},V=(0,a.useMemo)(()=>{if(!t||0===t.length)return[];let e=e=>{var t,s,a,l,i,n,o,d;if(!m)return"";let c="?color=B20710&colour=B20710&autoPlay=true&primarycolor=B20710&autoNext=true&nextButton=true&poster=true&autoplayNextEpisode=true&nextEpisode=true&adFree=true";if((null==(s=e.baseUrls)||null==(t=s.movie)?void 0:t.includes("bludclart.com"))||(null==(l=e.baseUrls)||null==(a=l.tv)?void 0:a.includes("bludclart.com"))){if("movie"===r&&(null==(o=e.baseUrls)?void 0:o.movie))return"".concat(e.baseUrls.movie).concat(m,"/watch").concat(c);if("tv"===r&&(null==(d=e.baseUrls)?void 0:d.tv)&&u&&p)return"".concat(e.baseUrls.tv).concat(m,"/watch?season=").concat(u,"&episode=").concat(p).concat(c.replace("?","&"))}else if("movie"===r&&(null==(i=e.baseUrls)?void 0:i.movie))return"".concat(e.baseUrls.movie).concat(m).concat(c);else if("tv"===r&&(null==(n=e.baseUrls)?void 0:n.tv)&&u&&p)return"".concat(e.baseUrls.tv).concat(m,"/").concat(u,"/").concat(p).concat(c);return""};return t.map(t=>({name:t.name,url:e(t)})).filter(e=>e.url)},[t,m,r,u,p]),[H,O]=(0,a.useState)("");(0,a.useEffect)(()=>{if(V.length>0){var e;let t=h0&&L("Could not generate valid URLs from the available sources")},[V,h,t,m,r,x]),(0,a.useEffect)(()=>{let e=()=>{if(A.current){let{scrollLeft:e,scrollWidth:t,clientWidth:r}=A.current;D(e>0),_(e{t.removeEventListener("scroll",e)}},[V]),(0,a.useEffect)(()=>{if(A.current){let e=A.current.querySelector('[data-source-index="'.concat(h,'"]'));e&&e.scrollIntoView({behavior:"smooth",block:"nearest",inline:"center"})}},[h]);let J=(e,t)=>{e&&(b(t),y&&j&&j(),O(e))};return C?(0,s.jsxs)("div",{className:"text-center text-red-500 my-2 md:my-4 p-2 md:p-4 -mx-4 md:mx-0",children:[(0,s.jsxs)("p",{children:["Error: ",C]}),(0,s.jsx)("p",{children:"Please try again later or choose a different source."})]}):V&&0!==V.length?(0,s.jsxs)(l,{fallback:(0,s.jsx)("div",{className:"text-center text-red-500",children:"Failed to load the player. Please try again later."}),children:[" ",(0,s.jsxs)("div",{className:"my-4 md:my-8 p-0 md:p-4 -mx-4 md:mx-0",children:[" ",H&&!f&&(0,s.jsxs)(s.Fragment,{children:[" ",(0,s.jsxs)("div",{className:"relative mb-2 md:mb-4 ".concat(N.className),children:[" ",(()=>{try{return(0,c.qm)({src:H,title:x?"".concat(x," Player (").concat(r,")"):"Stream Player",className:"absolute top-0 left-0 w-full h-full md:rounded-lg shadow-xl"})}catch(e){return(0,s.jsx)("div",{className:"absolute top-0 left-0 w-full h-full flex items-center justify-center bg-gray-900 rounded-lg",children:(0,s.jsxs)("div",{className:"text-center text-white p-4",children:[(0,s.jsx)("p",{className:"text-red-400 mb-2",children:"Failed to load player"}),(0,s.jsx)("p",{className:"text-sm text-gray-300",children:e instanceof Error?e.message:"Unknown error occurred"})]})})}})()]})," ",(0,s.jsxs)("div",{className:"flex justify-center gap-1.5 sm:gap-3 md:gap-4 lg:gap-5 mb-4 md:mb-6 px-2 md:px-2",style:{overflow:"visible",scrollbarWidth:"none",msOverflowStyle:"none"},children:[w&&!y&&(0,s.jsx)("div",{className:"flex-shrink-0",children:(0,s.jsxs)("button",{onClick:j,className:"relative inline-flex items-center justify-center gap-2 px-2 py-2 sm:px-3 sm:py-3 rounded-lg sm:rounded-xl bg-gradient-to-r from-blue-600/20 to-purple-600/20 backdrop-blur-md border border-blue-400/30 text-blue-300 font-semibold shadow-lg hover:from-blue-600/30 hover:to-purple-600/30 hover:border-blue-400/50 hover:shadow-xl hover:scale-[1.02] transition-all duration-300 ease-out group",title:"Switch to 4K Ultra HD streaming",children:[(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",className:"w-4 h-4 sm:w-5 sm:h-5 flex-shrink-0",children:(0,s.jsx)("path",{d:"M12 2L13.09 8.26L22 9L13.09 9.74L12 16L10.91 9.74L2 9L10.91 8.26L12 2Z"})}),(0,s.jsx)("span",{className:"hidden sm:inline text-xs sm:text-sm font-medium",children:"4K Ultra"})]})}),(0,s.jsxs)("div",{className:"flex-shrink-0",children:["movie"===r?(0,s.jsxs)("a",{href:"https://dl.vidsrc.vip/movie/".concat(m),target:"_blank",rel:"noopener noreferrer",className:"relative inline-flex items-center justify-center gap-2 px-2 py-2 sm:px-3 sm:py-3 rounded-lg sm:rounded-xl bg-white/10 backdrop-blur-md border border-white/20 text-white font-semibold shadow-lg hover:bg-white/20 hover:border-white/30 hover:shadow-xl hover:scale-[1.02] transition-all duration-300 ease-out group",title:"Download Movie",children:[(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor",className:"w-4 h-4 sm:w-5 sm:h-5 flex-shrink-0",children:(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 4.5v11m0 0l-4-4m4 4l4-4m-9 7.5h10.5"})}),(0,s.jsx)("span",{className:"hidden sm:inline text-xs sm:text-sm font-medium",children:"Download"})]}):(0,s.jsxs)("a",{href:"https://dl.vidsrc.vip/tv/".concat(m,"/").concat(u||1,"/").concat(p||1),target:"_blank",rel:"noopener noreferrer",className:"relative inline-flex items-center justify-center gap-2 px-2 py-2 sm:px-3 sm:py-3 rounded-lg sm:rounded-xl bg-white/10 backdrop-blur-md border border-white/20 text-white font-semibold shadow-lg hover:bg-white/20 hover:border-white/30 hover:shadow-xl hover:scale-[1.02] transition-all duration-300 ease-out group",title:"Download Episode",children:[(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor",className:"w-4 h-4 sm:w-5 sm:h-5 flex-shrink-0",children:(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 4.5v11m0 0l-4-4m4 4l4-4m-9 7.5h10.5"})}),(0,s.jsx)("span",{className:"hidden sm:inline text-xs sm:text-sm font-medium",children:"Download"})]})," "]}),(0,s.jsxs)("div",{className:"flex-shrink-0",children:[" ",(0,s.jsxs)("button",{onClick:B,className:"relative inline-flex items-center justify-center gap-2 px-2 py-2 sm:px-3 sm:py-3 rounded-lg sm:rounded-xl bg-white/10 backdrop-blur-md border border-white/20 text-white font-semibold shadow-lg hover:bg-white/20 hover:border-white/30 hover:shadow-xl hover:scale-[1.02] transition-all duration-300 ease-out group",title:"Share this content",children:[(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",className:"w-4 h-4 sm:w-5 sm:h-5",children:(0,s.jsx)("path",{fillRule:"evenodd",d:"M15.75 4.5a3 3 0 11.825 2.066l-8.421 4.679a3.002 3.002 0 010 1.51l8.421 4.679a3 3 0 11-.729 1.31l-8.421-4.678a3 3 0 110-4.132l8.421-4.679a3 3 0 01-.096-.755z",clipRule:"evenodd"})}),(0,s.jsx)("span",{className:"hidden sm:inline text-xs sm:text-sm font-medium",children:"Share"})]})]})," ",(0,s.jsx)("div",{className:"flex-shrink-0",children:(0,s.jsxs)("button",{onClick:async()=>{if(!M&&!R){T(!0);try{if(U)z(m,r),W(!1);else{let e={id:"string"==typeof m?parseInt(m,10):m,media_type:r,title:"movie"===r?x:"",name:"tv"===r?x:"",poster_path:null,backdrop_path:null,vote_average:0,release_date:"",first_air_date:"",overview:""};await I(e),W(!0)}}finally{T(!1)}}},disabled:M||R,className:"relative inline-flex items-center justify-center gap-2 px-2 py-2 sm:px-3 sm:py-3 rounded-lg sm:rounded-xl backdrop-blur-md border font-semibold shadow-lg hover:shadow-xl hover:scale-[1.02] transition-all duration-300 ease-out group disabled:opacity-50\n ".concat(U?"bg-green-500/20 border-green-400/30 text-green-300 hover:bg-green-500/30 hover:border-green-400/50":"bg-white/10 border-white/20 text-white hover:bg-white/20 hover:border-white/30"),title:R?"Loading...":U?"Remove from Watchlist":"Add to Watchlist",children:[M||R?(0,s.jsx)("div",{className:"w-4 h-4 sm:w-5 sm:h-5 border-2 border-current border-t-transparent rounded-full animate-spin"}):U?(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",className:"w-4 h-4 sm:w-5 sm:h-5",children:(0,s.jsx)("path",{fillRule:"evenodd",d:"M6.32 2.577a49.255 49.255 0 0111.36 0c1.497.174 2.57 1.46 2.57 2.93V21a.75.75 0 01-1.085.67L12 18.089l-7.165 3.583A.75.75 0 013.75 21V5.507c0-1.47 1.073-2.756 2.57-2.93z",clipRule:"evenodd"})}):(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"w-4 h-4 sm:w-5 sm:h-5",children:(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M17.593 3.322c1.1.128 1.907 1.077 1.907 2.185V21L12 17.25 4.5 21V5.507c0-1.108.806-2.057 1.907-2.185a48.507 48.507 0 0111.186 0z"})})," ",(0,s.jsx)("span",{className:"hidden sm:inline text-xs sm:text-sm font-medium",children:M?"Processing...":R?"Loading...":U?"Saved":"Save"})," "]})})," ",(0,s.jsx)(d.A,{mediaId:m,mediaType:r,title:x,posterPath:null,seasonNumber:u,episodeNumber:p,currentVideoUrl:H,selectedSourceIndex:h})," ",g&&(0,s.jsx)("div",{className:"flex-shrink-0",children:(0,s.jsx)(i.A,{videoId:g,likeCount:v,inline:!0,showLikes:!1})})]})]}),!H&&!f&&(0,s.jsx)("div",{className:"border border-dashed border-gray-600 p-4 md:p-8 rounded-none md:rounded bg-gray-900 mb-2 md:mb-4",children:(0,s.jsx)("p",{className:"text-center text-gray-500",children:"No streaming sources available or configured correctly."})}),(V.length>0||w)&&(0,s.jsxs)("div",{className:"mb-2 md:mb-4 mx-1 md:mx-0",children:[(0,s.jsxs)("div",{className:"relative",children:[E&&(0,s.jsx)("button",{onClick:()=>{A.current&&A.current.scrollBy({left:-200,behavior:"smooth"})},className:"absolute left-0 top-1/3 -translate-y-1/2 z-10 pr-4 sm:pr-6 pl-0 sm:pl-1 py-6 sm:py-8 flex items-center justify-center group","aria-label":"Scroll left",children:(0,s.jsx)("div",{className:"bg-gray-800/90 hover:bg-blue-600/90 rounded-full p-1 sm:p-1.5 transition-colors duration-200 backdrop-blur-sm",children:(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor",className:"w-4 h-4 sm:w-5 sm:h-5 text-white",children:(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.75 19.5L8.25 12l7.5-7.5"})})})}),F&&(0,s.jsx)("button",{onClick:()=>{A.current&&A.current.scrollBy({left:200,behavior:"smooth"})},className:"absolute right-0 top-1/3 -translate-y-1/2 z-10 pl-4 sm:pl-6 pr-0 sm:pr-1 py-6 sm:py-8 flex items-center justify-center group","aria-label":"Scroll right",children:(0,s.jsx)("div",{className:"bg-gray-800/90 hover:bg-blue-600/90 rounded-full p-1 sm:p-1.5 transition-colors duration-200 backdrop-blur-sm",children:(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor",className:"w-4 h-4 sm:w-5 sm:h-5 text-white",children:(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8.25 4.5l7.5 7.5-7.5 7.5"})})})}),E&&(0,s.jsx)("div",{className:"absolute left-0 top-0 bottom-0 w-16 z-0 pointer-events-none"}),F&&(0,s.jsx)("div",{className:"absolute right-0 top-0 bottom-0 w-16 z-0 pointer-events-none"})," ",(0,s.jsxs)("div",{ref:A,className:"overflow-x-auto pb-2 md:pb-4 scrollbar-hide",style:{scrollbarWidth:"none",msOverflowStyle:"none",scrollBehavior:"smooth"},children:[" ",(0,s.jsx)("div",{className:"flex justify-center space-x-2 sm:space-x-3 px-1 py-2 sm:py-3 min-w-min",children:V.map((e,t)=>{let r="Premium ".concat(t+1);return(0,s.jsxs)("button",{"data-source-index":t,onClick:()=>J(e.url,t),disabled:h===t&&!y||!e.url,className:"\n flex-shrink-0 px-1 py-1 sm:px-1.5 sm:py-1.5 md:px-3 md:py-2 lg:px-4 lg:py-2.5 rounded sm:rounded-md transition-all duration-300 relative overflow-hidden\n ".concat(h===t&&!y?"bg-gradient-to-r from-yellow-400 via-amber-500 to-orange-500 text-black shadow-lg shadow-amber-500/50 ring-2 ring-yellow-300/50 scale-105 relative z-10":"bg-gradient-to-r from-amber-600/70 via-orange-600/70 to-yellow-600/70 backdrop-blur-sm border border-amber-400/40 hover:border-orange-400/60 text-amber-100 hover:text-white hover:from-amber-500/80 hover:via-orange-500/80 hover:to-yellow-500/80","\n ").concat("","\n "),children:[(0,s.jsx)("div",{className:"absolute inset-0 bg-gradient-to-r from-transparent via-white/20 to-transparent -skew-x-12 animate-pulse"})," ",(0,s.jsxs)("div",{className:"flex items-center gap-0.5 sm:gap-0.5 md:gap-1 lg:gap-1.5 whitespace-nowrap relative z-10",children:[" ",(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",className:"w-2 h-2 sm:w-2.5 sm:h-2.5 md:w-3 md:h-3 lg:w-4 lg:h-4 flex-shrink-0 text-yellow-300",children:(0,s.jsx)("path",{fillRule:"evenodd",d:"M10.788 3.21c.448-1.077 1.976-1.077 2.424 0l2.082 5.007 5.404.433c1.164.093 1.636 1.545.749 2.305l-4.117 3.527 1.257 5.273c.271 1.136-.964 2.033-1.96 1.425L12 18.354 7.373 21.18c-.996.608-2.231-.29-1.96-1.425l1.257-5.273-4.117-3.527c-.887-.76-.415-2.212.749-2.305l5.404-.433 2.082-5.006z",clipRule:"evenodd"})}),(0,s.jsxs)("span",{className:"text-[8px] sm:text-[9px] md:text-[10px] lg:text-xs font-medium hidden sm:inline",children:[r,(0,s.jsx)("span",{className:"ml-0.5 text-[5px] sm:text-[6px] md:text-[7px] lg:text-[8px] font-bold px-0.5 py-0.5 bg-green-500 text-white rounded-full animate-pulse",children:"⚡"}),!1]})," ",(0,s.jsxs)("span",{className:"text-[8px] sm:text-[9px] font-medium sm:hidden",children:["Premium ",t+1]})]})]},"source-".concat(t))})})]})]})," "]})]})]}):(0,s.jsx)("div",{className:"text-center text-gray-500 my-2 md:my-4 p-2 md:p-4 -mx-4 md:mx-0",children:(0,s.jsx)("p",{children:"No streaming sources available."})})}},2962:(e,t,r)=>{r.d(t,{EpisodesLoading:()=>n,MoviePlayerLoading:()=>i,StreamingSourcesLoading:()=>l});var s=r(5155);function a(e){let{title:t="Loading Streaming Sources",subtitle:r="Preparing your viewing experience...",className:a=""}=e;return(0,s.jsx)("div",{className:"flex justify-center items-center min-h-[200px] ".concat(a),children:(0,s.jsxs)("div",{className:"text-center space-y-4",children:[(0,s.jsxs)("div",{className:"relative mx-auto",children:[(0,s.jsx)("div",{className:"w-12 h-12 border-4 border-transparent border-t-blue-500 border-r-blue-500 rounded-full animate-spin"}),(0,s.jsx)("div",{className:"absolute inset-1 w-10 h-10 border-4 border-transparent border-b-purple-500 border-l-purple-500 rounded-full animate-spin [animation-direction:reverse]"}),(0,s.jsx)("div",{className:"absolute inset-0 w-12 h-12 rounded-full bg-gradient-to-r from-blue-500/20 to-purple-500/20 animate-pulse"})]}),(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)("h3",{className:"text-xl font-semibold text-white",children:t}),(0,s.jsx)("p",{className:"text-gray-400",children:r})]})]})})}let l=()=>(0,s.jsx)(a,{title:"Loading Streaming Sources",subtitle:"Preparing your viewing experience..."}),i=()=>(0,s.jsx)(a,{title:"Loading Movie Player",subtitle:"Preparing streaming interface..."}),n=()=>(0,s.jsx)(a,{title:"Loading Episodes",subtitle:"Preparing season browser..."})},4768:(e,t,r)=>{r.d(t,{A:()=>i});var s=r(5155),a=r(2115),l=r(5305);let i=e=>{let{vastUrl:t,onAdComplete:r,onAdSkipped:i}=e,n=(0,a.useRef)(null),o=(0,a.useRef)(null),d=(0,a.useRef)(null),{getVideoJSConfig:c,isMobile:m}=(0,l.K)(),[x,u]=(0,a.useState)(!1),[p,h]=(0,a.useState)(!1),[b,g]=(0,a.useState)(7),[v,f]=(0,a.useState)(!1),[w,y]=(0,a.useState)(0),[j,N]=(0,a.useState)(0),[k,S]=(0,a.useState)(!1),[C,L]=(0,a.useState)([]),A=e=>{L(t=>[...t.slice(-4),"".concat(new Date().toLocaleTimeString(),": ").concat(e)])};(0,a.useEffect)(()=>{(async()=>{try{if(A("Loading VideoJS scripts..."),!document.querySelector('link[href*="video-js.css"]')){let e=document.createElement("link");e.rel="stylesheet",e.href="https://vjs.zencdn.net/8.6.1/video-js.css",document.head.appendChild(e)}if(!document.querySelector("#custom-ad-player-styles")){let e=document.createElement("style");e.id="custom-ad-player-styles",e.textContent="\n .ad-player .vjs-big-play-button{display:none!important}\n .ad-player .vjs-control-bar{display:none!important}\n .ad-player .vjs-loading-spinner{display:none!important}\n .ad-player .vjs-poster{display:none!important}\n .ad-player .vjs-tech{object-fit:cover}\n .ad-player:hover .vjs-control-bar{display:none!important}\n .ad-player .vjs-error-display{display:none!important}\n .ad-player{width:100%!important;height:100%!important;position:absolute!important;top:0!important;left:0!important}\n .ad-player.vjs-fluid{padding-top:0!important}\n ",document.head.appendChild(e)}window.videojs||await new Promise((e,t)=>{let r=document.createElement("script");r.src="https://vjs.zencdn.net/8.6.1/video.min.js",r.onload=e,r.onerror=()=>t(Error("Failed to load VideoJS")),document.head.appendChild(r)}),A("VideoJS loaded successfully!"),u(!0)}catch(e){A("Error loading scripts: ".concat(e)),setTimeout(i,1e3)}})()},[i]),(0,a.useEffect)(()=>{if(x&&n.current&&!o.current)return(async()=>{try{if(A("Initializing player..."),!n.current){A("ERROR: Video element not found"),i();return}let e=c(),t=window.videojs(n.current,{...e,controls:!1,muted:!1});t.ready(async()=>{A("Player ready - loading ad..."),o.current=t,await E()})}catch(e){A("Error initializing player: ".concat(e)),i()}})(),()=>{d.current&&clearInterval(d.current),o.current&&(o.current.dispose(),o.current=null)}},[x]);let E=async()=>{try{A("Fetching VAST ad..."),A("VAST URL: ".concat(t));let e=await fetch(t),s=await e.text();if(A("VAST Response: ".concat(s.length," chars")),!s.includes("{var t;let r=null==(t=e.textContent)?void 0:t.trim(),s=e.getAttribute("type");"video/mp4"===s&&!m&&r&&(m=r)}),m){A("Playing ad..."),o.current.src({src:m,type:"video/mp4"}),o.current.on("play",()=>{f(!0),S(o.current.muted()),D(d)}),o.current.on("loadedmetadata",()=>{let e=o.current.duration();N(e)}),o.current.on("timeupdate",()=>{let e=o.current.currentTime(),t=o.current.duration();t>0&&y(e/t*100)}),o.current.on("ended",()=>{A("Ad completed"),r()}),o.current.on("error",()=>{A("Ad playback error - skipping"),i()});let e=o.current.play();e&&e.then(()=>{A("Ad playback started successfully!"),S(o.current.muted())}).catch(e=>{A("Ad playback error: ".concat(e.message)),i()})}else A("No suitable video found - skipping"),i()}catch(e){A("Error loading ad: ".concat(e)),i()}},D=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:5,t=e;g(t),A("Starting skip countdown: ".concat(e,"s (from VAST)")),d.current=setInterval(()=>{g(--t),t<=0&&(h(!0),d.current&&clearInterval(d.current))},1e3)};return(0,s.jsxs)("div",{className:"relative w-full h-full bg-black",children:[" "," ",(0,s.jsx)("video",{ref:n,className:"video-js vjs-default-skin ad-player w-full h-full","data-setup":"{}",playsInline:!0,autoPlay:!0,children:(0,s.jsxs)("p",{className:"vjs-no-js",children:["To view this video please enable JavaScript, and consider upgrading to a web browser that"," ",(0,s.jsx)("a",{href:"https://videojs.com/html5-video-support/",target:"_blank",rel:"noopener noreferrer",children:"supports HTML5 video"}),"."]})})," ",v&&(0,s.jsx)("div",{className:"absolute bottom-4 right-4 z-20",children:p?(0,s.jsx)("button",{onClick:()=>{A("Ad skipped by user"),i()},className:"px-6 py-3 bg-black bg-opacity-80 text-white font-bold rounded-lg hover:bg-opacity-100 transition-all duration-200 border border-white border-opacity-30 shadow-lg backdrop-blur-sm",children:"Skip Ad →"}):(0,s.jsxs)("div",{className:"px-4 py-2 bg-black bg-opacity-70 text-white rounded-lg border border-white border-opacity-20 backdrop-blur-sm",children:["Skip in ",b,"s"]})})," ",v&&(0,s.jsx)("div",{className:"absolute top-4 left-4 z-10",children:(0,s.jsx)("div",{className:"px-4 py-2 bg-yellow-400 text-black text-sm font-bold rounded-lg shadow-lg",children:"AD"})})," ",v&&(0,s.jsx)("div",{className:"absolute bottom-0 left-0 right-0 h-1 bg-black bg-opacity-30 z-10",children:(0,s.jsx)("div",{className:"h-full bg-yellow-400 transition-all duration-100",style:{width:"".concat(w,"%")}})})]})}},5305:(e,t,r)=>{r.d(t,{K:()=>a});var s=r(2115);let a=()=>{let[e,t]=(0,s.useState)({height:"aspect-video",aspectRatio:"16/9",className:"w-full aspect-video min-h-[350px] sm:min-h-[400px] md:min-h-[450px]"}),[r,a]=(0,s.useState)(!1),[l,i]=(0,s.useState)("portrait");return(0,s.useEffect)(()=>{let e=()=>{let e=window.innerWidth,r=window.innerHeight,s=navigator.userAgent.toLowerCase(),l=e<=768||/mobile|android|iphone|ipod|blackberry|iemobile|opera mini/i.test(s),n=e>r?"landscape":"portrait";a(l),i(n);let o="w-full";l?"landscape"===n?o+=" h-[90vh] max-h-[500px]":o+=" aspect-video min-h-[350px] max-h-[500px]":o+=" aspect-video min-h-[400px] sm:min-h-[450px] md:min-h-[550px]",t({height:l&&"landscape"===n?"90vh":"auto",aspectRatio:"16/9",className:o})};return e(),window.addEventListener("resize",e),window.addEventListener("orientationchange",e),()=>{window.removeEventListener("resize",e),window.removeEventListener("orientationchange",e)}},[]),{dimensions:e,isMobile:r,orientation:l,getVideoJSConfig:()=>{let e={controls:!1,autoplay:!0,playsinline:!0,preload:"auto",aspectRatio:"16:9"};return r?{...e,fluid:!1,responsive:!1,fill:!0,width:"100%",height:"100%"}:{...e,fluid:!0,responsive:!0}}}}},6015:(e,t,r)=>{r.d(t,{default:()=>l});var s=r(5155),a=r(2115);function l(e){let{overview:t}=e,[r,l]=(0,a.useState)(!1),[i,n]=(0,a.useState)(!1),o=i?10:75;if((0,a.useEffect)(()=>{let e=()=>{n(window.innerWidth<640)};return e(),window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[]),!t)return(0,s.jsx)("p",{className:"text-sm text-gray-500",children:"No overview available."});let d=t.length>o,c=d&&!r?"".concat(t.substring(0,o),"..."):t;return(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"text-sm text-gray-300 leading-relaxed",children:c}),d&&(0,s.jsx)("button",{onClick:()=>l(!r),className:"mt-2 text-blue-500 text-sm font-medium hover:underline focus:outline-none focus:ring-2 focus:ring-blue-500","aria-expanded":r,"aria-label":r?"Collapse overview":"Expand overview",children:r?"Read Less":"Read More"})]})}},7021:(e,t,r)=>{r.d(t,{default:()=>d});var s=r(5155),a=r(2115),l=r(6766),i=r(3096);let n=e=>{switch(e){case"poster":return"(max-width: 640px) 112px, (max-width: 768px) 144px, (max-width: 1024px) 192px, 240px";case"backdrop":return"(max-width: 640px) 300px, (max-width: 768px) 500px, (max-width: 1024px) 780px, 1280px";case"profile":return"(max-width: 640px) 45px, 185px";default:return"(max-width: 640px) 100vw, (max-width: 1024px) 50vw, 33vw"}},o=async e=>(e.includes("placeholder"),"data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTAwIiBoZWlnaHQ9IjE1MCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cmVjdCB3aWR0aD0iMTAwJSIgaGVpZ2h0PSIxMDAlIiBmaWxsPSIjMWExYTFhIi8+PC9zdmc+"),d=(0,a.memo)(function(e){let{src:t,alt:r,width:d,height:c,imageType:m="poster",lazyBoundary:x="200px",lowQualityPlaceholder:u=!0,withBlur:p=!0,priority:h=!1,className:b,crossOrigin:g,...v}=e,[f,w]=(0,a.useState)(!1),[y,j]=(0,a.useState)(!1),[N,k]=(0,a.useState)(void 0),[S,C]=(0,i.Wx)({triggerOnce:!0,rootMargin:x,skip:h}),L=C||h,A={transition:f?"none":"filter 0.3s ease-in-out",filter:f?"blur(0)":"blur(20px)",...v.style},E=v.sizes||n(m),D=(0,a.useCallback)(()=>{w(!0)},[]),F=(0,a.useCallback)(()=>{j(!0)},[]);(0,a.useEffect)(()=>{p&&"string"==typeof t&&!N&&o(t).then(e=>k(e)).catch(()=>console.log("Failed to generate blur placeholder"))},[t,p,N]),(0,a.useEffect)(()=>{h&&"string"==typeof t&&(new window.Image().src=t)},[h,t]);let _=v.fill||!d&&!c,I=!_&&d&&c?"".concat(d," / ").concat(c):void 0;return _?L?(0,s.jsx)(l.default,{ref:S,src:y?"/images/placeholder-poster.png":t,alt:r,className:b,sizes:E,priority:h,style:A,onLoad:D,onError:F,placeholder:p&&N?"blur":"empty",blurDataURL:p?N:void 0,fetchPriority:h?"high":"auto",loading:h?"eager":"lazy",crossOrigin:g,...v}):(0,s.jsx)("div",{ref:S,className:b,style:{position:"absolute",inset:0,backgroundColor:"#1a1a1a",...A}}):(0,s.jsxs)("div",{ref:S,className:"overflow-hidden",style:{position:"relative",aspectRatio:I},children:[L&&(0,s.jsx)(l.default,{src:y?"/images/placeholder-poster.png":t,alt:r,width:d,height:c,className:b,sizes:E,priority:h,style:A,onLoad:D,onError:F,placeholder:p&&N?"blur":"empty",blurDataURL:p?N:void 0,fetchPriority:h?"high":"auto",loading:h?"eager":"lazy",crossOrigin:g}),!L&&(0,s.jsx)("div",{style:{width:"100%",height:"100%",backgroundColor:"#1a1a1a",position:"absolute",top:0,left:0}})]})})},7390:(e,t,r)=>{r.d(t,{PK:()=>i,h4:()=>o,qm:()=>d});var s=r(2115);let a=["vidsrc.me","vidsrc.to","vidsrc.cc","vidsrc.su","vidsrc.vip","vidora.su","videasy.net","vidlink.pro","multiembed.mov","player.vidsrc.co","bludclart.com","watch.bludclart.com","111movies.com","www.111movies.com","youtube.com","www.youtube.com","veloratv.ru","spencerdevs.xyz","vidjoy.pro","vidfast.pro"],l=["vidora.su","veloratv.ru","watch.bludclart.com","vidfast.pro","111movies.com","vidlink.pro"];function i(e){try{if(e.startsWith("/api/proxy"))return!0;let t=new URL(e).hostname.toLowerCase();return a.some(e=>t===e||t.endsWith(".".concat(e)))}catch(e){return!1}}function n(e){try{if(e.startsWith("/api/proxy"))return!1;let t=new URL(e).hostname.toLowerCase();return l.some(e=>t===e||t.endsWith(".".concat(e)))}catch(e){return!1}}function o(e,t){new Date().toISOString(),navigator.userAgent}function d(e){try{if(!e.src||""===e.src.trim())throw Error("Empty iframe src provided");let t=function(e,t,r){if(!e||""===e.trim())throw Error("Empty iframe URL provided");if(!i(e)){try{new URL(e)}catch(e){}throw Error("Untrusted streaming domain")}let s=function(e){try{if(e.startsWith("/api/proxy"))return e;let t=new URL(e);return["javascript","vbscript","onload","onerror","onclick","eval","script","redirect_uri","callback"].forEach(e=>{t.searchParams.delete(e)}),"http:"!==t.protocol||t.hostname.includes("localhost")||(t.protocol="https:"),t.toString()}catch(e){return""}}(e);if(!s)throw Error("Invalid iframe URL after sanitization");let a=n(e),l={src:s,title:a?"".concat(t," - Player"):"".concat(t," - Secure Player"),className:r||"",loading:"lazy",referrerPolicy:a?"no-referrer-when-downgrade":"strict-origin-when-cross-origin"};!a&&(l.sandbox="allow-scripts allow-same-origin allow-presentation allow-fullscreen allow-forms",l.allow="accelerometer; autoplay; encrypted-media; fullscreen; picture-in-picture; gyroscope; web-share");return l}(e.src,e.title,e.className),r=n(e.src),a="unknown";try{a=e.src.startsWith("/api/proxy")?"proxy":new URL(e.src).hostname}catch(e){a="malformed-url"}return o("iframe_created",{domain:a,detectsSandbox:r,sandbox:t.sandbox||"DISABLED (sandbox detection bypass)",mode:r?"compatibility":"secure"}),s.createElement("iframe",{key:e.src,src:t.src,title:t.title,className:t.className,sandbox:t.sandbox,allow:t.allow,referrerPolicy:t.referrerPolicy,loading:t.loading,allowFullScreen:!0})}catch(t){throw o("domain_blocked",{url:e.src,error:t instanceof Error?t.message:"Unknown error"}),t}}},7582:(e,t,r)=>{r.d(t,{b2:()=>a,i2:()=>l,k3:()=>i});let s={574475:8},a={},l=(e,t)=>{let r=e.toString();if(null==t?void 0:t.movieOverrides){let e=t.movieOverrides[r];if(void 0!==e){var a,l;return(null==(a=t.emergencyDisabledSources)?void 0:a.includes(e))?null!=(l=t.defaultMovieSource)?l:0:e}if(void 0!==t.defaultMovieSource)return t.defaultMovieSource}let i=s[r];return void 0!==i?i:0},i=(e,t)=>{let r=e.toString();if(null==t?void 0:t.tvOverrides){let e=t.tvOverrides[r];if(void 0!==e){var s,l;return(null==(s=t.emergencyDisabledSources)?void 0:s.includes(e))?null!=(l=t.defaultTvSource)?l:0:e}if(void 0!==t.defaultTvSource)return t.defaultTvSource}let i=a[r];return void 0!==i?i:0}},9006:(e,t,r)=>{function s(e){if(!e)return!1;try{let t=new Date(e),r=new Date;return t.setHours(0,0,0,0),r.setHours(0,0,0,0),t>r}catch(e){return!1}}function a(e){if(!e)return!1;try{let t=new Date(e),r=new Date;return t.setHours(0,0,0,0),r.setHours(0,0,0,0),t>r}catch(e){return!1}}r.d(t,{FJ:()=>s,mp:()=>a})},9838:(e,t,r)=>{r.d(t,{A:()=>d});var s=r(5155),a=r(2115),l=r(9074),i=r(4186),n=r(4416);let o=(0,r(5028).default)(()=>Promise.all([r.e(8096),r.e(4541)]).then(r.bind(r,4541)).catch(()=>Promise.all([r.e(8096),r.e(1579)]).then(r.bind(r,1579))),{loadableGenerated:{webpack:()=>[1579]},ssr:!1,loading:()=>(0,s.jsx)("div",{className:"flex items-center justify-center w-full bg-gray-800 rounded-lg",style:{paddingBottom:"56.25%",position:"relative"},children:(0,s.jsxs)("div",{className:"absolute inset-0 flex flex-col items-center justify-center",children:[(0,s.jsx)("div",{className:"w-8 h-8 border-2 border-t-blue-500 border-r-transparent border-b-blue-500 border-l-transparent rounded-full animate-spin"}),(0,s.jsx)("p",{className:"text-white mt-2 font-medium text-xs",children:"Loading..."})]})})});function d(e){let{title:t,releaseDate:r,isMovie:d=!0,posterUrl:c,overview:m,trailerId:x,isOpen:u,onClose:p}=e,h=(0,a.useCallback)(e=>{try{return new Date(e).toLocaleDateString("en-US",{year:"numeric",month:"long",day:"numeric"})}catch(t){return e}},[]),b=(0,a.useMemo)(()=>{try{let e=new Date(r),t=new Date,s=e.getTime()-t.getTime(),a=Math.ceil(s/864e5);if(a<0)return"Recently released";if(0===a)return"Releases today";if(1===a)return"Releases tomorrow";if(a<30)return"Releases in ".concat(a," days");if(a<365){let e=Math.ceil(a/30);return"Releases in ".concat(e," month").concat(e>1?"s":"")}let l=Math.ceil(a/365);return"Releases in ".concat(l," year").concat(l>1?"s":"")}catch(e){return"Release date pending"}},[r]),g=(0,a.useMemo)(()=>h(r),[r,h]);return u?(0,s.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-3 sm:p-4 bg-black/60 backdrop-blur-sm",children:(0,s.jsxs)("div",{className:"relative w-full max-w-md sm:max-w-lg bg-gray-900 rounded-xl shadow-2xl border border-gray-700 overflow-hidden max-h-[95vh] sm:max-h-[85vh] mx-auto",children:[(0,s.jsxs)("div",{className:"relative",children:[(0,s.jsx)("button",{onClick:p,className:"absolute top-2 right-2 z-10 p-1 rounded-full bg-black/50 hover:bg-black/70 transition-colors","aria-label":"Close dialog",children:(0,s.jsx)(n.A,{size:16,className:"text-white"})}),(0,s.jsx)("div",{className:"bg-gradient-to-r from-gray-800 to-gray-900 p-3 border-b border-gray-700",children:(0,s.jsxs)("div",{className:"flex flex-col items-center text-center",children:[(0,s.jsx)("h2",{className:"text-base sm:text-lg font-bold text-white mb-2 leading-tight line-clamp-2 max-w-full",children:t}),(0,s.jsxs)("div",{className:"flex flex-wrap items-center justify-center gap-2 text-xs sm:text-sm",children:[(0,s.jsxs)("div",{className:"inline-flex items-center px-2 py-0.5 rounded-full bg-yellow-500/20 border border-yellow-500/30",children:[(0,s.jsx)(i.A,{size:12,className:"text-yellow-400 mr-1"}),(0,s.jsx)("span",{className:"text-yellow-400 font-medium",children:"Coming Soon"})]}),(0,s.jsxs)("div",{className:"flex items-center text-gray-300",children:[(0,s.jsx)(l.A,{size:12,className:"mr-1"}),(0,s.jsx)("span",{children:g})]}),(0,s.jsx)("span",{className:"text-blue-400 font-medium",children:b})]})]})})]}),(0,s.jsxs)("div",{className:"p-3 sm:p-4",children:[" ",x?(0,s.jsx)("div",{className:"mb-3",children:(0,s.jsx)("div",{className:"rounded-lg overflow-hidden bg-black",children:(0,s.jsx)("div",{className:"relative w-full",style:{paddingBottom:"56.25%"},children:(0,s.jsx)("div",{className:"absolute inset-0",children:(0,s.jsx)(o,{trailerKey:x,trailerName:"".concat(t," - Official Trailer")})})})})}):m&&(0,s.jsx)("div",{className:"mb-3",children:(0,s.jsx)("p",{className:"text-xs sm:text-sm text-gray-400 leading-relaxed line-clamp-3 text-center",children:m})}),(0,s.jsx)("button",{onClick:p,className:"w-full px-3 py-2 bg-blue-600 hover:bg-blue-700 active:bg-blue-800 text-white font-medium rounded-lg transition-colors text-xs sm:text-sm",children:"Got it"})]})]})}):null}}}]);