"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[257],{7206:function(e,s,l){l.d(s,{Z:function(){return o}});var r=l(5893),t=l(8089),a=l(1664),n=l.n(a),o=(0,l(4511).Pf)(e=>{let{children:s,href:l="/",...t}=e;return(0,r.jsx)(n(),{href:l,legacyBehavior:!0,children:(0,r.jsx)("a",{...t,children:s})})},{FallbackComponent:t.Z})},2328:function(e,s,l){var r=l(5893);s.Z=e=>{let{...s}=e;return(0,r.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",width:28,height:28,...s,children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})}},9513:function(e,s,l){var r=l(5893);l(7294),s.Z=e=>(0,r.jsx)("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:(0,r.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M22 3H20V21H22V3ZM4.28615 3.61729C3.28674 3.00228 2 3.7213 2 4.89478V19.1052C2 20.2787 3.28674 20.9977 4.28615 20.3827L15.8321 13.2775C16.7839 12.6918 16.7839 11.3082 15.8321 10.7225L4.28615 3.61729ZM4 18.2104V5.78956L14.092 12L4 18.2104Z",fill:"currentColor"})})},8025:function(e,s,l){var r=l(5893),t=l(9458),a=l(7294);s.Z=()=>{let[e,s]=(0,a.useState)("true"===localStorage.getItem(t.Fe.autoplay));return(0,r.jsxs)("div",{className:"flex items-center font-semibold gap-x-2",children:[(0,r.jsxs)("label",{className:"inline-flex items-center cursor-pointer",children:[(0,r.jsx)("input",{type:"checkbox",checked:e,onClick:()=>{s(e=>e?(localStorage.setItem(t.Fe.autoplay,"false"),!1):(localStorage.setItem(t.Fe.autoplay,"true"),!0))},className:"sr-only peer"}),(0,r.jsx)("div",{className:"relative w-11 h-6 bg-gray-200 peer-focus:outline-none peer-focus:ring-4 peer-focus:ring-red-300 dark:peer-focus:ring-red-800 rounded-full peer dark:bg-gray-700 peer-checked:after:translate-x-full rtl:peer-checked:after:-translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:start-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all dark:border-gray-600 peer-checked:bg-red-600"})]}),"Autoplay"]})}},2383:function(e,s,l){l.r(s),l.d(s,{default:function(){return G}});var r=l(5893),t=l(8465),a=l(2588),n=l(8089),o=l(7206),i=l(360),c=l(9458),d=l(4756),u=l(2900),p=l(9513),h=l(5754),x=l(6389),m=l(3758),v=l(7104),f=l(886),g=l(7837),b=l(5152),j=l.n(b),y=l(1163),w=l(7294),k=l(4511),N=l(2328),C=e=>{let{...s}=e;return(0,r.jsx)("svg",{stroke:"#fff",fill:"#fff",strokeWidth:"0",viewBox:"0 0 16 16",height:"16px",width:"16px",xmlns:"http://www.w3.org/2000/svg",style:{filter:"drop-shadow(rgba(0, 0, 0, 0.4) 1px 1px 1px)"},...s,children:(0,r.jsx)("path",{fillRule:"evenodd",d:"M15 8a.5.5 0 0 0-.5-.5H2.707l3.147-3.146a.5.5 0 1 0-.708-.708l-4 4a.5.5 0 0 0 0 .708l4 4a.5.5 0 0 0 .708-.708L2.707 8.5H14.5A.5.5 0 0 0 15 8z"})})},Z=l(8487),S=l(3894),R=l(7605),_=l(2746),q=l(5518),V=l(6970),L=l.n(V),F=l(8025);let H=e=>{var s;let{selectedSeason:l}=e,[t]=(0,y.useRouter)().query.params,{isLoading:n,data:i}=(0,g.a)({queryKey:["seasons",t,l],queryFn:async()=>await (0,a.Z)("/tv/".concat(t,"/season/").concat(l),{parseResponse:JSON.parse}),staleTime:9e5,cacheTime:12e5,keepPreviousData:!0});return n||(null==i?void 0:null===(s=i.episodes)||void 0===s?void 0:s.length)!==0?(0,r.jsx)(L(),{itemRenderer:e=>{let s=null==i?void 0:i.episodes[e],l="E".concat(s.episode_number||e+1," - ").concat(s.name);return(0,r.jsx)(o.Z,{title:l,className:"block overflow-hidden transition-all duration-150 hover:bg-white/20",href:"/".concat(f.D.TV,"/").concat(t,"/").concat(null==i?void 0:i.season_number,"/").concat(s.episode_number),children:(0,r.jsx)("div",{className:"px-5 py-3 cursor-pointer",children:(0,r.jsx)("h4",{className:"text-graycb line-clamp-1",children:l})})},s.id)},length:null==i?void 0:i.episodes.length,type:"simple",minSize:10,pageSize:10}):(0,r.jsx)("div",{className:"px-5 py-1 text-graycb",children:"Not found episode"})},T=e=>{let{handleChangeSeason:s}=e,{details:l}=(0,m.G)();return(0,r.jsx)(L(),{itemRenderer:e=>{let t=null==l?void 0:l.seasons[e];return(0,r.jsx)("div",{onClick:()=>s(t.season_number),className:"w-full overflow-hidden transition-all duration-150 hover:bg-white/20",children:(0,r.jsx)("div",{className:"px-5 py-3 cursor-pointer ",children:(0,r.jsx)("h4",{className:"text-graycb line-clamp-1",children:null==t?void 0:t.name})})},t.id)},length:null==l?void 0:l.seasons.length,type:"simple",minSize:10,pageSize:5})},E=e=>{let s=(0,_.useTranslations)("Player"),{details:l}=(0,m.G)(),[t,a="1"]=(0,y.useRouter)().query.params,[n,o]=(0,w.useState)(Number(a)),[i,c]=(0,w.useState)(!0);return(0,r.jsxs)("div",{className:(0,R.Z)("lg:max-h-[550px] bg-[var(--background)] border border-muted max-h-screen overflow-y-auto lg:rounded-md h-[80vh]",q.tq?"w-full":"w-[500px]"),children:[(0,r.jsxs)("div",{className:"flex items-center justify-between px-5 pt-5 pb-3 gap-x-5",children:[(0,r.jsx)("span",{onClick:()=>c(e=>!e),className:"flex-shrink-0 text-lg font-semibold cursor-pointer line-clamp-2",children:i?(0,r.jsx)(C,{className:"w-7 h-7"}):null==l?void 0:l.title}),i?(0,r.jsxs)("div",{className:"flex-1 text-lg font-semibold",children:[s("seasons")," ",n]}):null,(0,r.jsx)(F.Z,{}),(0,r.jsx)("button",{className:"flex items-center flex-shrink-0 gap-x-1",onClick:e.closePopover,children:(0,r.jsx)(N.Z,{className:"w-6 h-6"})})]}),(0,r.jsx)("div",{className:"lg:max-h-[490px] scrollbar-styles",children:i?(0,r.jsx)(H,{selectedSeason:n}):(0,r.jsx)(T,{handleChangeSeason:e=>{o(e),c(!0)}})})]})};var M=()=>{let e=(0,Z.C)();return(0,r.jsx)(S.Z,{reference:(0,r.jsx)("button",{className:"videasy-scale","data-tooltip":e.episodes,children:(0,r.jsxs)("svg",{className:"cursor-pointer videasy-icon-lg videasy-scale",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[(0,r.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M3 4C1.34315 4 0 5.34314 0 7V13.9496C0 15.6065 1.34315 16.9496 3 16.9496H5.86645V14.9496H3C2.44772 14.9496 2 14.5019 2 13.9496V7C2 6.44771 2.44771 6 3 6H16.0327C16.585 6 17.0327 6.44772 17.0327 7V9.86645H19.0327V7C19.0327 5.34315 17.6896 4 16.0327 4H3Z",fill:"currentColor"}),(0,r.jsx)("rect",{x:"5.89929",y:"10.5444",width:17,height:10,rx:2,stroke:"currentColor",strokeWidth:2})]})}),children:(0,r.jsx)(E,{})})},z=l(6933);let B=j()(()=>l.e(244).then(l.bind(l,244)),{loadableGenerated:{webpack:()=>[244]},ssr:!1}),P=()=>{var e,s;let{details:l}=(0,m.G)(),n=(0,y.useRouter)(),i=n.query.params,b=(null===(e=n.query)||void 0===e?void 0:e.nextEpisode)==="true",j=(null===(s=n.query)||void 0===s?void 0:s.episodeSelector)==="true",[w,k=1,N=1]=i,{isLoading:C,data:Z=c.Cm}=(0,t.B)(),S=(0,v.Z)(e=>e.servers),R=u.y[n.locale],{startTime:_,handleSaveProgressWatched:q}=(0,d.Z)(),{data:V}=(0,g.a)({enabled:b||j,queryKey:["seasons",w,k],queryFn:async()=>await (0,a.Z)("/tv/".concat(w,"/season/").concat(k),{parseResponse:JSON.parse}),staleTime:9e5,cacheTime:12e5,keepPreviousData:!0}),L=(null==V?void 0:V.episodes.find(e=>e.episode_number===Number(N)+1))||void 0;return(0,r.jsx)("div",{className:"fixed inset-0",id:x.W,children:(0,r.jsx)(B,{startTime:_,onTimeUpdate:q,isCouldNotFoundStream:S.every(e=>!e.isSuccess),heading:l&&"E".concat(N," - ")+l[R],poster:null==l?void 0:l.background,sources:Z.sources,subtitles:(0,h.fL)(Z.subtitles,n.locale),meta:{title:null==l?void 0:l.titleEnglish,imdb_id:null==l?void 0:l.imdbId},rightControlsComponent:(0,r.jsxs)(r.Fragment,{children:[b&&L?(0,r.jsx)(o.Z,{href:"/".concat(f.D.TV,"/").concat(w,"/").concat(null==V?void 0:V.season_number,"/").concat(null==L?void 0:L.episode_number).concat(window.location.search),children:(0,r.jsx)("button",{className:"videasy-scale","data-tooltip":"E".concat(L.episode_number),children:(0,r.jsx)(p.Z,{className:"flex-shrink-0 w-10 h-10 cursor-pointer videasy-icon-lg videasy-scale"})})}):null,j?(0,r.jsx)(M,{}):null,(0,r.jsx)(z.Z,{isLoading:C})]})})})};var G=(0,k.Pf)(()=>{let{details:e}=(0,m.G)(),[s,l]=(0,w.useState)(!1),[t,a=1,n=1]=(0,y.useRouter)().query.params;return s?(0,r.jsx)(P,{}):(0,r.jsxs)("div",{id:"fixed-container",children:[(0,r.jsx)("div",{className:"absolute z-20 w-full h-screen bg-black/60"}),(0,r.jsxs)("div",{className:"flex flex-col items-center gap-y-3 title-year",children:[(0,r.jsx)("button",{onClick:()=>l(!0),children:(0,r.jsx)(i.Z,{className:"md:w-[44px] w-10 md:h-[44px] h-10 play-icon-main"})}),e?(0,r.jsxs)("p",{children:["S",a," E",n," - ",e.title," ",(null==e?void 0:e.year)?"(".concat(e.year,")"):null]}):null]}),(0,r.jsx)("div",{id:"backdrop",style:{backgroundImage:'url("'.concat(e.background,'")')}})]})},{FallbackComponent:n.Z})}}]);