@serifpersia/dango 3.5.3 → 3.5.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/client/dist/assets/{AnimeCard-B-Oa1rwo.js → AnimeCard-DL4pRPH6.js} +1 -1
- package/client/dist/assets/{AnimeInfo-ChlZYgUR.js → AnimeInfo-CLewxbSs.js} +1 -1
- package/client/dist/assets/{AnimeInfoPage-c5D-TJex.js → AnimeInfoPage-BikMjWpN.js} +2 -2
- package/client/dist/assets/{Asmr-DXqSpC1N.js → Asmr-BrmjfXIH.js} +1 -1
- package/client/dist/assets/{AsmrResetProgressModal-CMpmRa0N.js → AsmrResetProgressModal-DpzeJ2Rr.js} +1 -1
- package/client/dist/assets/AvSyncCalibrator-DJAEqz-M.js +10 -0
- package/client/dist/assets/{AvSyncCalibrator-gEONBv5a.css → AvSyncCalibrator-ieaRTs3u.css} +1 -1
- package/client/dist/assets/{Home-BU6A-hSp.js → Home-CilHItyY.js} +1 -1
- package/client/dist/assets/{Insights-C2tEbstb.js → Insights-s8DVFPrC.js} +1 -1
- package/client/dist/assets/{LibraryListPage-BORCPjkW.js → LibraryListPage-D_MD0Lhp.js} +1 -1
- package/client/dist/assets/{ListeningList-2m-nFdkp.js → ListeningList-C4a0Ol9h.js} +1 -1
- package/client/dist/assets/{Manga-D5Jc19s1.js → Manga-CQoL5WSO.js} +1 -1
- package/client/dist/assets/{MangaInfoPage-D4Yhgxsy.js → MangaInfoPage-DfeBy1k9.js} +1 -1
- package/client/dist/assets/{MangaReadPage-CSu-78zV.js → MangaReadPage-Dv_xXU-Z.js} +1 -1
- package/client/dist/assets/{MangaResetProgressModal-CPzxCgcw.js → MangaResetProgressModal-B5I9WY5s.js} +1 -1
- package/client/dist/assets/{Mature-x0I86Cnl.js → Mature-Bq6ALnj_.js} +1 -1
- package/client/dist/assets/{MediaCard-BNKk3aKd.js → MediaCard-C6sSx_z5.js} +1 -1
- package/client/dist/assets/{Music-CX8iz56E.js → Music-TZrbVAdg.js} +1 -1
- package/client/dist/assets/OptionListMenu-DxXGdXOU.js +1 -0
- package/client/dist/assets/{Player-qmH7gErX.js → Player-D0mA2vaS.js} +6 -6
- package/client/dist/assets/{Player-B036Ic3m.css → Player-DBLl-bj_.css} +1 -1
- package/client/dist/assets/{PlayerSettings-C5IY-55v.js → PlayerSettings-Ch7dW6WE.js} +1 -1
- package/client/dist/assets/{QueueOptionsButton-CUt4vxlJ.js → QueueOptionsButton-BZ5BUytu.js} +1 -1
- package/client/dist/assets/{QueueRail-DR9j0mJ7.js → QueueRail-C6IHy4CH.js} +1 -1
- package/client/dist/assets/{Radio-DRNP3-Ug.js → Radio-CnEWiyV2.js} +1 -1
- package/client/dist/assets/{ReadingList-1UBbcIwL.js → ReadingList-Dz9vI26P.js} +1 -1
- package/client/dist/assets/{ResetProgressModal-CxuA9Z7G.js → ResetProgressModal-C7FNcb2X.js} +1 -1
- package/client/dist/assets/{Search-hVoQWcPJ.js → Search-Cdw5UVEX.js} +1 -1
- package/client/dist/assets/{Settings-Bao74HiY.js → Settings-BCAkVsGp.js} +1 -1
- package/client/dist/assets/{SkeletonGrid-B-ot2T5l.js → SkeletonGrid-B3Pkkwtb.js} +1 -1
- package/client/dist/assets/{Trackers-RoIuI_sy.js → Trackers-ukVLEBtx.js} +1 -1
- package/client/dist/assets/{Tv-Bx7tGS57.css → Tv-BlVIanQL.css} +1 -1
- package/client/dist/assets/Tv-CpWQUSuu.js +4 -0
- package/client/dist/assets/{TvInfo-DaIK2hX4.js → TvInfo-CSRGklYN.js} +1 -1
- package/client/dist/assets/{TvPopup-kZmcSBvG.js → TvPopup-DNQkT6qy.js} +1 -1
- package/client/dist/assets/{TvSearch-_tF8ou7f.js → TvSearch-ZG7Q3kMG.js} +1 -1
- package/client/dist/assets/{TvWatchlist-B5rZ7zIT.js → TvWatchlist-DnJfwYv0.js} +1 -1
- package/client/dist/assets/{Watchlist-aQitaI7a.js → Watchlist-DN8VKfef.js} +1 -1
- package/client/dist/assets/{hls-hQKRlWEn.js → hls-BIOzsLUy.js} +1 -1
- package/client/dist/assets/{index-mwdRstuO.js → index-D46PzcOL.js} +2 -2
- package/client/dist/assets/{useAnimeInfoData-Cs0pIdnP.js → useAnimeInfoData-BF4WF2s4.js} +1 -1
- package/client/dist/assets/{useAsmr-D8s--Tjy.js → useAsmr-C2ttSbxb.js} +1 -1
- package/client/dist/assets/{useAsmrPopup-Bf8gDlT6.js → useAsmrPopup-CZ6UNRJH.js} +1 -1
- package/client/dist/assets/{useMangaLibrary-Mm8wandT.js → useMangaLibrary-ChwDhlyo.js} +1 -1
- package/client/dist/assets/{useMangaPopup-DgtQ9fg4.js → useMangaPopup-Zxm1nSmS.js} +1 -1
- package/client/dist/assets/{useProviders-B-x6Wq6v.js → useProviders-CguDlK81.js} +1 -1
- package/client/dist/assets/{useTv-B2zlWz3p.js → useTv-HLJmTVvH.js} +1 -1
- package/client/dist/assets/{useTvLibrary-DDW03W6A.js → useTvLibrary-340c9BPM.js} +1 -1
- package/client/dist/index.html +1 -1
- package/package.json +2 -2
- package/server/dist/hono/tv.js +31 -14
- package/server/dist/trpc/routers/tv.js +1 -0
- package/server/package.json +1 -1
- package/client/dist/assets/AvSyncCalibrator-CuSfq8JX.js +0 -10
- package/client/dist/assets/OptionListMenu-C6gay-Rv.js +0 -1
- package/client/dist/assets/Tv-CstPX8fN.js +0 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as u,c as b,u as g,a as c}from"./vendor-query-BBT5_sHx.js";import{t as p,h as i,z as s}from"./index-
|
|
1
|
+
import{b as u,c as b,u as g,a as c}from"./vendor-query-BBT5_sHx.js";import{t as p,h as i,z as s}from"./index-D46PzcOL.js";import{T as Q}from"./vendor-core-DfaOB3Rn.js";const v=300*1e3,M={mangadex:"https://mangadex.org/",mangapill:"https://www.mangapill.com/"},f=(e,a)=>`/api/proxy?url=${encodeURIComponent(a)}&referer=${encodeURIComponent(M[e])}`,T=(e,a)=>a&&(e==="mangapill"?f(e,a):a),k=(e,a=!0)=>{const{provider:r,query:n,page:o,sort:t,status:m,type:d,rating:y,mature:l}=e;return u({queryKey:["mangaBrowse",r,n,o,t,m,d,y,l],queryFn:()=>p.manga.search.query({provider:r,q:n.trim()||void 0,page:o,sort:t||void 0,status:m||void 0,type:d||void 0,rating:y||void 0,mature:l?"1":void 0}),staleTime:v,enabled:a&&!!r})},E=(e,a=14)=>{const{provider:r,query:n,sort:o,status:t,type:m,rating:d,mature:y}=e;return b({queryKey:["mangaBrowseInfinite",r,n,o,t,m,d,y,a],queryFn:({pageParam:l=1})=>p.manga.search.query({provider:r,q:n.trim()||void 0,page:l,limit:a,sort:o||void 0,status:t||void 0,type:m||void 0,rating:d||void 0,mature:y?"1":void 0}),initialPageParam:1,getNextPageParam:(l,q)=>l.hasNext?q.length+1:void 0,staleTime:v,enabled:!!r})},O=(e,a,r="safe",n=!1)=>u({queryKey:["mangaDetail",e,a,r,n],queryFn:()=>p.manga.info.query({provider:e||"",id:a||"",rating:r,mature:n?"1":void 0}),enabled:!!e&&!!a,staleTime:v}),$=(e,a,r)=>u({queryKey:["mangaPages",e,a],queryFn:()=>p.manga.pages.query({provider:e||"",id:a||""}),enabled:!!e&&!!a,staleTime:1800*1e3}),B=()=>{const e=i();return u({...e.manga.trending.queryOptions(),staleTime:600*1e3,retry:1})},I=e=>e.contentRating==="erotica"||e.contentRating==="pornographic"||e.type==="doujinshi";function N(e,a){const r=e.titles??{};return a==="englishName"?r.en||e.title:a==="nativeName"&&(r.native||r.romaji||e.altTitle)||e.title}function A(e){return{englishName:e.titles?.en??e.title,nativeName:e.titles?.native??e.titles?.romaji??e.altTitle??void 0}}const h=/^anilist:ch:(\d+)$/;function w(e){if(!e)return null;const a=h.exec(e.trim());if(!a)return null;const r=Number.parseInt(a[1],10);return Number.isFinite(r)?r:null}function x(e,a){const r=String(a),n=e.find(o=>(o.number??"").trim()===r);return n||(e.find(o=>{const t=Number.parseFloat((o.number??"").trim());return Number.isFinite(t)&&t===a})??null)}const _=["Reading","Completed","On-Hold","Dropped","Planned"],L=(e,a)=>`${e.toLowerCase()}:${a}`,D=(e="All",a=1,r=24)=>{const n=i();return u(n.mangaLibrary.list.queryOptions({status:e,page:a,limit:r}))},P=()=>{const e=i();return u({...e.mangaLibrary.ids.queryOptions(),staleTime:1e3*60})},U=e=>{const a=i();return u({...a.mangaLibrary.check.queryOptions({id:e??""}),enabled:!!e,staleTime:1e3*60})},j=e=>{const a=i();return u({...a.mangaLibrary.entry.queryOptions({id:e??""}),enabled:!!e,staleTime:1e3*60})},H=()=>{const e=i(),a=g();return c(e.mangaLibrary.link.mutationOptions({onSuccess:r=>{s.success(r?.progressMigrated?"Linked — chapter progress carried over":"Linked to AniList entry"),a.invalidateQueries(e.mangaLibrary.pathFilter()),a.invalidateQueries({queryKey:["manga-library"]}),a.invalidateQueries({queryKey:["manga-continue-reading"]})},onError:r=>{s.error(`Failed to link: ${r.message}`)}}))},z=(e=24)=>{const a=i();return u(a.mangaProgress.continueReading.queryOptions({limit:e}))},V=e=>{const a=i();return u({...a.mangaProgress.byManga.queryOptions({mangaId:e??""}),enabled:!!e})},S=()=>{const e=i(),a=g();return c(e.mangaLibrary.add.mutationOptions({onSuccess:(r,n)=>{n.silent||s.success("Bookmarked"),a.invalidateQueries(e.mangaLibrary.pathFilter()),a.invalidateQueries({queryKey:["manga-library"]})},onError:r=>{s.error(`Failed to bookmark: ${r.message}`)}}))},F=()=>{const e=i(),a=g();return c(e.mangaLibrary.remove.mutationOptions({onSuccess:()=>{s.success("Bookmark removed"),a.invalidateQueries(e.mangaLibrary.pathFilter()),a.invalidateQueries({queryKey:["manga-library"]}),a.invalidateQueries({queryKey:["manga-continue-reading"]})},onError:r=>{s.error(`Failed to remove: ${r.message}`)}}))},Y=()=>{const e=i(),a=g();return c(e.mangaLibrary.setStatus.mutationOptions({onSuccess:()=>{s.success("Status updated"),a.invalidateQueries(e.mangaLibrary.pathFilter()),a.invalidateQueries({queryKey:["manga-library"]}),a.invalidateQueries({queryKey:["manga-continue-reading"]})},onError:r=>{s.error(`Failed to update status: ${r.message}`)}}))},G=()=>{const e=i(),a=g();return c(e.mangaProgress.save.mutationOptions({onSuccess:(r,n)=>{a.invalidateQueries({queryKey:["manga-progress",n.mangaId]}),a.invalidateQueries({queryKey:["manga-continue-reading"]}),a.invalidateQueries({queryKey:["manga-library"]}),a.invalidateQueries(e.mangaProgress.pathFilter())}}))},J=()=>{const e=i(),a=g();return c(e.mangaProgress.remove.mutationOptions({onSuccess:()=>{s.success("Progress reset"),a.invalidateQueries({queryKey:["manga-progress"]}),a.invalidateQueries({queryKey:["manga-continue-reading"]}),a.invalidateQueries({queryKey:["manga-library"]}),a.invalidateQueries(e.mangaProgress.pathFilter())},onError:r=>{s.error(`Failed to reset progress: ${r.message}`)}}))},W=()=>{const e=i(),a=g();return c(e.mangaLibrary.batchStatus.mutationOptions({onSuccess:r=>{s.success(`Status updated for ${r.updated??0} items`),a.invalidateQueries(e.mangaLibrary.pathFilter()),a.invalidateQueries({queryKey:["manga-library"]}),a.invalidateQueries({queryKey:["manga-continue-reading"]})},onError:r=>{s.error(`Failed to update statuses: ${r.message}`)}}))},X=()=>{const e=i(),a=g();return c(e.mangaLibrary.removeMany.mutationOptions({onSuccess:r=>{const n=r.removed??0;s.success(`Removed ${n} ${n===1?"item":"items"} from reading list`),a.invalidateQueries(e.mangaLibrary.pathFilter()),a.invalidateQueries({queryKey:["manga-library"]}),a.invalidateQueries({queryKey:["manga-continue-reading"]})},onError:r=>{s.error(`Failed to remove: ${r.message}`)}}))},Z=()=>{const e=i(),a=g();return c(e.mangaProgress.removeMany.mutationOptions({onSuccess:r=>{const n=r.removed??0;s.success(`Reset progress for ${n} ${n===1?"item":"items"}`),a.invalidateQueries({queryKey:["manga-progress"]}),a.invalidateQueries({queryKey:["manga-continue-reading"]}),a.invalidateQueries({queryKey:["manga-library"]}),a.invalidateQueries(e.mangaProgress.pathFilter())},onError:r=>{s.error(`Failed to reset progress: ${r.message}`)}}))},ee=()=>{const e=S(),a=F(),{data:r}=P(),n=Q(()=>new Set(r?.ids||[]),[r]);return{toggle:t=>{const m=L(t.provider,t.id);n.has(m)?a.mutate(m):e.mutate({provider:t.provider,mangaId:t.id,title:t.title,cover:t.cover,altTitle:t.altTitle,contentRating:t.contentRating})},bookmarkedIds:n,pending:e.isPending||a.isPending}};export{Z as A,J as B,_ as M,E as a,T as b,A as c,z as d,B as e,k as f,j as g,S as h,I as i,H as j,O as k,U as l,L as m,V as n,F as o,Y as p,w as q,N as r,x as s,$ as t,ee as u,f as v,G as w,D as x,W as y,X as z};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{u as e,S as f,L as m}from"./vendor-core-DfaOB3Rn.js";import{I as l}from"./vendor-icons-DrybRNxP.js";import{k as y,r as T}from"./useMangaLibrary-
|
|
1
|
+
import{u as e,S as f,L as m}from"./vendor-core-DfaOB3Rn.js";import{I as l}from"./vendor-icons-DrybRNxP.js";import{k as y,r as T}from"./useMangaLibrary-ChwDhlyo.js";import{d as I}from"./index-D46PzcOL.js";import{p as s,a as k}from"./MediaCard-C6sSx_z5.js";import{u as P}from"./usePopup-DS9jMzp6.js";const R=({data:i,anchorRect:d,bookmarked:r,onToggleBookmark:p,onMouseEnter:h,onMouseLeave:v,onRequestClose:g})=>{const{data:a,isLoading:N}=y(i.provider,i.mangaId,i.rating||"safe",i.mature||!1),{titlePreference:u}=I(),t=a?.chapters.length??0,c=[a?.status,a?.type].filter(Boolean).join(" · "),o=T({title:i.title,altTitle:a?.altTitle??i.altTitle},u);return e(k,{anchorRect:d,onMouseEnter:h,onMouseLeave:v,onRequestClose:g,children:N?e("div",{className:s.loading,children:[e("div",{className:s.spinner}),e("span",{children:"Fetching details..."})]}):e(f,{children:[e("div",{className:s.header,children:[e("div",{className:s.title,children:o}),a?.altTitle&&a.altTitle!==o&&e("div",{className:s.synopsis,children:["Also known as: ",a.altTitle]})]}),e("div",{className:s.body,children:[e("div",{className:s.metaRow,children:[c&&e("div",{className:s.metaItem,children:[e(l,{name:"book",size:14}),e("span",{children:c})]}),t>0&&e("div",{className:s.metaItem,children:e("span",{children:[t," chapter",t===1?"":"s"]})}),i.progressLabel&&e("div",{className:s.metaItem,children:[e(l,{name:"bookmark",size:12}),e("span",{children:i.progressLabel})]})]}),e("div",{className:s.synopsis,children:a?.description?a.description:"No synopsis available."}),Array.isArray(a?.genres)&&(a?.genres?.length??0)>0&&e("div",{className:s.details,children:e("div",{className:s.genres,children:a.genres.filter(Boolean).slice(0,4).map(n=>e("span",{className:s.genre,children:n},n))})})]}),e("div",{className:s.footer,children:[e("div",{className:s.primaryAction,children:e(m,{to:i.readTarget,className:s.watchBtn,children:[e(l,{name:"book",size:14}),"Read now"]})}),e("div",{className:s.secondaryActions,children:[e("button",{className:`${s.watchlistBtn} ${r?s.active:""}`,onClick:n=>{n.preventDefault(),n.stopPropagation(),p()},children:[r?e(l,{name:"check",size:12}):e(l,{name:"plus",size:12}),e("span",{children:r?"Remove":"Bookmark"})]}),e(m,{to:`/manga/${i.provider}/${encodeURIComponent(i.mangaId)}`,className:s.detailsBtn,children:"Read more"})]})]})]})})},$=()=>P();export{R as M,$ as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{T as o}from"./vendor-core-DfaOB3Rn.js";import{b as a}from"./vendor-query-BBT5_sHx.js";import{U as i}from"./index-
|
|
1
|
+
import{T as o}from"./vendor-core-DfaOB3Rn.js";import{b as a}from"./vendor-query-BBT5_sHx.js";import{U as i}from"./index-D46PzcOL.js";const n=300*1e3;function u(r){return{value:r.id,label:r.label,mature:r.mature,kind:r.kind,sub:r.sub,tier:r.tier,browse:r.browse,facets:r.facets,servers:r.servers}}const d=()=>{const r=a({queryKey:["providers"],queryFn:()=>i("/api/providers"),staleTime:n,retry:1}),e=Array.isArray(r.data)?r.data:null,t=o(()=>e&&e.length>0?e.filter(s=>s.loaded).map(u):[],[e]);return{...r,options:t,isFallback:!e||e.length===0}};export{d as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{N as c,u as r,S as d}from"./vendor-core-DfaOB3Rn.js";import{I as v}from"./vendor-icons-DrybRNxP.js";import{M as T}from"./MediaCard-
|
|
1
|
+
import{N as c,u as r,S as d}from"./vendor-core-DfaOB3Rn.js";import{I as v}from"./vendor-icons-DrybRNxP.js";import{M as T}from"./MediaCard-C6sSx_z5.js";import{T as g}from"./TvPopup-DNQkT6qy.js";import{c as m,i as f}from"./useTvLibrary-340c9BPM.js";import{b as i}from"./vendor-query-BBT5_sHx.js";import{h as p}from"./index-D46PzcOL.js";const _=c(({item:e})=>{const o=e.type==="tv"||e.type==="tvSeries"||e.type==="tvMiniSeries",s=m(e.type,e.id);return r(T,{item:{id:String(e.id),title:e.title,thumbnail:e.image,typeBadge:o?"TV":"Movie",isAdult:f(e)},linkTo:s,hoverIcon:"info",showInfoButton:!0,metaRow:r(d,{children:[e.year&&r("span",{style:{opacity:.75},children:e.year}),e.vote_average!=null&&r("span",{style:{display:"inline-flex",alignItems:"center",gap:3},children:[r(v,{name:"star",size:10}),Number(e.vote_average).toFixed(1)]})]}),renderPopup:(a,t)=>r(g,{item:e,anchorRect:a,onMouseEnter:t.onMouseEnter,onMouseLeave:t.onMouseLeave,onRequestClose:t.close})})}),u=1e3*60*5,b=e=>{const o=p(),{query:s,type:a,genre:t,year:n,sort_by:l,page:y}=e;return i({...o.tv.search.queryOptions({q:s?.trim()||"",type:a||"multi",genre:t||"",year:n&&n!=="ALL"?n:"",sortBy:l||"popularity.desc",page:y||1}),staleTime:u,retry:1})},A=(e="all",o="week",s=1,a=!0)=>{const t=p();return i({...t.tv.trending.queryOptions({mediaType:e,timeWindow:o,page:s}),enabled:a,staleTime:u,retry:1})};export{_ as T,b as a,A as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{T as y}from"./vendor-core-DfaOB3Rn.js";import{b as v,u as o,a as n}from"./vendor-query-BBT5_sHx.js";import{h as a,z as i,t as p}from"./index-
|
|
1
|
+
import{T as y}from"./vendor-core-DfaOB3Rn.js";import{b as v,u as o,a as n}from"./vendor-query-BBT5_sHx.js";import{h as a,z as i,t as p}from"./index-D46PzcOL.js";const d=t=>String(t).toLowerCase()==="movie"?"movie":"tv",m=(t,e)=>`${d(t)}:${e}`,L=(t,e)=>{const r=d(t);return`/tv/${e}?type=${r}`},S=(t,e,r,s)=>{const u=new URLSearchParams;return u.set("type",d(t)),r!==void 0&&u.set("s",String(r)),s!==void 0&&u.set("e",String(s)),`/tv/${e}/watch?${u.toString()}`},F=t=>t.adult===!0||t.adult===1,K=["Watching","Completed","On-Hold","Dropped","Planned"],g=(t,e)=>m(t,e),$=(t="All",e=1,r=24)=>{const s=a();return v(s.tvLibrary.list.queryOptions({status:t,page:e,limit:r}))},h=()=>{const t=a();return v({...t.tvLibrary.ids.queryOptions(),staleTime:1e3*60})},C=t=>{const e=a();return v({...e.tvLibrary.check.queryOptions({id:t||""}),enabled:!!t,staleTime:1e3*60})},w=(t=24)=>{const e=a();return v(e.tvProgress.continueWatching.queryOptions({limit:t}))},O=t=>{const e=a();return v({...e.tvProgress.getByMedia.queryOptions({mediaId:t||""}),enabled:!!t})},f=(t,e,r)=>{const s=a();return v({...s.tvProgress.latest.queryOptions({mediaId:t||"",season:e,episode:r}),enabled:!!t,staleTime:0})},b=()=>{const t=a(),e=o();return n({mutationFn:async r=>{const{silent:s,...u}=r;return p.tvLibrary.add.mutate(u)},onSuccess:(r,s)=>{s.silent||i.success("Added to TV watchlist"),e.invalidateQueries({queryKey:["tv-library"]}),e.invalidateQueries(t.tvLibrary.pathFilter())},onError:r=>{i.error(`Failed to add: ${r.message}`)}})},Q=()=>{const t=a(),e=o();return n(t.tvLibrary.remove.mutationOptions({onSuccess:()=>{i.success("Removed from TV watchlist"),e.invalidateQueries({queryKey:["tv-library"]}),e.invalidateQueries({queryKey:["tv-continue-watching"]}),e.invalidateQueries(t.tvLibrary.pathFilter()),e.invalidateQueries(t.tvProgress.pathFilter())},onError:r=>{i.error(`Failed to remove: ${r.message}`)}}))},k=()=>{const t=a(),e=o();return n(t.tvLibrary.setStatus.mutationOptions({onSuccess:()=>{i.success("Status updated"),e.invalidateQueries({queryKey:["tv-library"]}),e.invalidateQueries({queryKey:["tv-continue-watching"]}),e.invalidateQueries(t.tvLibrary.pathFilter()),e.invalidateQueries(t.tvProgress.pathFilter())},onError:r=>{i.error(`Failed to update status: ${r.message}`)}}))},R=()=>{const t=a(),e=o();return n(t.tvProgress.save.mutationOptions({onSuccess:(r,s)=>{e.invalidateQueries({queryKey:["tv-progress",s.mediaId]}),e.invalidateQueries({queryKey:["tv-continue-watching"]}),e.invalidateQueries({queryKey:["tv-library"]}),e.invalidateQueries(t.tvLibrary.pathFilter()),e.invalidateQueries(t.tvProgress.pathFilter())}}))},B=()=>{const t=a(),e=o();return n(t.tvProgress.remove.mutationOptions({onSuccess:()=>{i.success("Progress reset"),e.invalidateQueries({queryKey:["tv-progress"]}),e.invalidateQueries({queryKey:["tv-continue-watching"]}),e.invalidateQueries({queryKey:["tv-library"]}),e.invalidateQueries(t.tvLibrary.pathFilter()),e.invalidateQueries(t.tvProgress.pathFilter())},onError:r=>{i.error(`Failed to reset progress: ${r.message}`)}}))},E=()=>{const t=a(),e=o();return n(t.tvLibrary.batchStatus.mutationOptions({onSuccess:r=>{i.success(`Status updated for ${r.updated??0} items`),e.invalidateQueries({queryKey:["tv-library"]}),e.invalidateQueries({queryKey:["tv-continue-watching"]}),e.invalidateQueries(t.tvLibrary.pathFilter()),e.invalidateQueries(t.tvProgress.pathFilter())},onError:r=>{i.error(`Failed to update statuses: ${r.message}`)}}))},I=()=>{const t=a(),e=o();return n(t.tvLibrary.removeMany.mutationOptions({onSuccess:r=>{const s=r.removed??0;i.success(`Removed ${s} ${s===1?"item":"items"} from TV watchlist`),e.invalidateQueries({queryKey:["tv-library"]}),e.invalidateQueries({queryKey:["tv-continue-watching"]}),e.invalidateQueries(t.tvLibrary.pathFilter()),e.invalidateQueries(t.tvProgress.pathFilter())},onError:r=>{i.error(`Failed to remove: ${r.message}`)}}))},A=()=>{const t=a(),e=o();return n(t.tvProgress.removeMany.mutationOptions({onSuccess:r=>{const s=r.removed??0;i.success(`Reset progress for ${s} ${s===1?"item":"items"}`),e.invalidateQueries({queryKey:["tv-progress"]}),e.invalidateQueries({queryKey:["tv-continue-watching"]}),e.invalidateQueries({queryKey:["tv-library"]}),e.invalidateQueries(t.tvLibrary.pathFilter()),e.invalidateQueries(t.tvProgress.pathFilter())},onError:r=>{i.error(`Failed to reset progress: ${r.message}`)}}))},M=()=>{const t=b(),e=Q(),{data:r}=h(),s=y(()=>new Set(r?.ids||[]),[r]);return{toggle:c=>{const l=g(c.mediaType,c.tmdbId);s.has(l)?e.mutate(l):t.mutate({...c,poster:c.poster||""})},bookmarkedIds:s,pending:t.isPending||e.isPending}};export{K as T,Q as a,B as b,L as c,m as d,C as e,M as f,R as g,k as h,F as i,f as j,O as k,$ as l,E as m,d as n,I as o,A as p,S as t,w as u};
|
package/client/dist/index.html
CHANGED
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
background-color: #0c0d12;
|
|
34
34
|
}
|
|
35
35
|
</style>
|
|
36
|
-
<script type="module" crossorigin src="/assets/index-
|
|
36
|
+
<script type="module" crossorigin src="/assets/index-D46PzcOL.js"></script>
|
|
37
37
|
<link rel="modulepreload" crossorigin href="/assets/vendor-core-DfaOB3Rn.js">
|
|
38
38
|
<link rel="modulepreload" crossorigin href="/assets/vendor-query-BBT5_sHx.js">
|
|
39
39
|
<link rel="modulepreload" crossorigin href="/assets/vendor-icons-DrybRNxP.js">
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@serifpersia/dango",
|
|
3
|
-
"version": "3.5.
|
|
3
|
+
"version": "3.5.5",
|
|
4
4
|
"description": "A web application for watching anime.",
|
|
5
5
|
"main": "orchestrator.js",
|
|
6
6
|
"repository": {
|
|
@@ -83,5 +83,5 @@
|
|
|
83
83
|
"allowScripts": {
|
|
84
84
|
"esbuild@0.28.2": true
|
|
85
85
|
},
|
|
86
|
-
"versionDate": "2026-10-
|
|
86
|
+
"versionDate": "2026-10-11T15:58:41.003Z"
|
|
87
87
|
}
|
package/server/dist/hono/tv.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import logger from '../logger.js';
|
|
2
|
-
import { linkAbort, setProxyHeaders } from '../utils/http.utils.js';
|
|
2
|
+
import { fetchWithRetry, linkAbort, setProxyHeaders } from '../utils/http.utils.js';
|
|
3
3
|
import { URL } from 'url';
|
|
4
4
|
import { isSafeExternalUrl } from '../utils/security.utils.js';
|
|
5
5
|
function proxiedMediaUrl(targetUrl, refererStr) {
|
|
@@ -83,11 +83,10 @@ export function registerTv(app, getTvProvider) {
|
|
|
83
83
|
};
|
|
84
84
|
if (refererStr)
|
|
85
85
|
headers['Referer'] = refererStr;
|
|
86
|
-
const fetchResp = await
|
|
86
|
+
const fetchResp = await fetchWithRetry(urlStr, {
|
|
87
87
|
headers,
|
|
88
|
-
signal: abort.signal,
|
|
89
88
|
redirect: 'follow',
|
|
90
|
-
});
|
|
89
|
+
}, { retries: 3, baseDelayMs: 750, signal: abort.signal });
|
|
91
90
|
const status = fetchResp.status;
|
|
92
91
|
if (status !== 200 && status !== 206) {
|
|
93
92
|
return c.text('Upstream error', (status || 502));
|
|
@@ -106,21 +105,23 @@ export function registerTv(app, getTvProvider) {
|
|
|
106
105
|
outHeaders.set('Content-Length', String(bodyBuffer.length));
|
|
107
106
|
return new Response(bodyBuffer, { status, headers: outHeaders });
|
|
108
107
|
}
|
|
109
|
-
const chunks = [];
|
|
110
108
|
const reader = fetchResp.body?.getReader();
|
|
111
109
|
if (!reader) {
|
|
112
110
|
logger.warn({ host: safeCheck.url?.hostname }, 'tv stream-proxy: upstream sent no body');
|
|
113
111
|
return c.text('Upstream sent no body', 502);
|
|
114
112
|
}
|
|
115
113
|
try {
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
114
|
+
const first = await reader.read();
|
|
115
|
+
const head = first.done ? Buffer.alloc(0) : Buffer.from(first.value);
|
|
116
|
+
if (isPlaylistBody(head)) {
|
|
117
|
+
const chunks = [head];
|
|
118
|
+
while (true) {
|
|
119
|
+
const { done, value } = await reader.read();
|
|
120
|
+
if (done)
|
|
121
|
+
break;
|
|
122
|
+
chunks.push(Buffer.from(value));
|
|
123
|
+
}
|
|
124
|
+
const body = Buffer.concat(chunks);
|
|
124
125
|
const baseUrl = new URL(fetchResp.url || urlStr);
|
|
125
126
|
const rewritten = rewriteTvPlaylist(body.toString('utf8'), baseUrl, refererStr);
|
|
126
127
|
const bodyBuffer = Buffer.from(rewritten, 'utf8');
|
|
@@ -128,7 +129,23 @@ export function registerTv(app, getTvProvider) {
|
|
|
128
129
|
outHeaders.set('Content-Length', String(bodyBuffer.length));
|
|
129
130
|
return new Response(bodyBuffer, { status, headers: outHeaders });
|
|
130
131
|
}
|
|
131
|
-
|
|
132
|
+
const stream = new ReadableStream({
|
|
133
|
+
start(controller) {
|
|
134
|
+
if (head.length)
|
|
135
|
+
controller.enqueue(head);
|
|
136
|
+
},
|
|
137
|
+
async pull(controller) {
|
|
138
|
+
const { done, value } = await reader.read();
|
|
139
|
+
if (done)
|
|
140
|
+
controller.close();
|
|
141
|
+
else
|
|
142
|
+
controller.enqueue(value);
|
|
143
|
+
},
|
|
144
|
+
cancel(reason) {
|
|
145
|
+
return reader.cancel(reason);
|
|
146
|
+
},
|
|
147
|
+
});
|
|
148
|
+
return new Response(stream, { status, headers: outHeaders });
|
|
132
149
|
}
|
|
133
150
|
catch (err) {
|
|
134
151
|
logger.warn({ err, host: safeCheck.url?.hostname }, 'tv stream-proxy: upstream body stream failed');
|
package/server/package.json
CHANGED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import{u as r,A as b,d as C,h as A,q as B,T as pe,$ as At}from"./vendor-core-DfaOB3Rn.js";import{B as re,M as $t,S as ye,h as Ft,R as Rt,t as Je,O as Dt,g as Ot}from"./index-mwdRstuO.js";import{I as Q}from"./vendor-icons-DrybRNxP.js";import{u as qt}from"./vendor-query-BBT5_sHx.js";const Ht="_controls_ov6ol_1",Vt="_titleContainer_ov6ol_9",Wt="_scheduleInfo_ov6ol_15",Ut="_status_ov6ol_23",zt="_nextEpisode_ov6ol_35",Kt="_watchlistBtn_ov6ol_45",Gt="_inList_ov6ol_72",Xt="_queueBtn_ov6ol_83",Jt="_queueActive_ov6ol_95",Qt="_modeToggleBtn_ov6ol_101",jt="_modeToggleActive_ov6ol_108",Yt="_nativeToggleBtn_ov6ol_119",Zt="_nativeToggleActive_ov6ol_132",en="_markWatchedBtn_ov6ol_153",tn="_markWatchedDone_ov6ol_167",nn="_completeSeriesBtn_ov6ol_178",rn="_providerAndEpisodeRow_ov6ol_192",on="_episodeActions_ov6ol_199",sn="_desktopEpisodeActions_ov6ol_206",an="_mobileEpisodeActions_ov6ol_213",cn="_episodeNavBtn_ov6ol_217",ln="_primary_ov6ol_247",un="_secondary_ov6ol_257",dn="_episodePickerBtn_ov6ol_261",pn="_queueCountdown_ov6ol_265",fn="_speedBoostBadge_ov6ol_280",mn="_videoContainer_ov6ol_311",hn="_loadingOverlay_ov6ol_324",vn="_loadingDots_ov6ol_338",_n="_dot_ov6ol_343",gn="_bounce_ov6ol_1",yn="_bufferingOverlay_ov6ol_372",bn="_bufferingSpinner_ov6ol_381",wn="_spin_ov6ol_921",Sn="_videoIframe_ov6ol_396",Cn="_videoElementHidden_ov6ol_419",kn="_upscalerCanvas_ov6ol_424",En="_upscalerActive_ov6ol_437",Ln="_upscalerStatusBadge_ov6ol_441",Tn="_subtitleOverlay_ov6ol_456",xn="_controlsOverlay_ov6ol_468",Bn="_hidden_ov6ol_498",Nn="_centerPlayPause_ov6ol_504",In="_bottomControls_ov6ol_536",Pn="_progressBarContainer_ov6ol_553",Mn="_progressBar_ov6ol_553",An="_scrubbing_ov6ol_576",$n="_watchedBar_ov6ol_581",Fn="_bufferedBar_ov6ol_582",Rn="_thumb_ov6ol_604",Dn="_timeBubble_ov6ol_625",On="_skipSegment_ov6ol_648",qn="_op_ov6ol_662",Hn="_ed_ov6ol_666",Vn="_recap_ov6ol_670",Wn="_bottomControlsRow_ov6ol_674",Un="_controlBtn_ov6ol_682",zn="_timeDisplay_ov6ol_706",Kn="_leftControls_ov6ol_715",Gn="_rightControls_ov6ol_716",Xn="_middleControls_ov6ol_717",Jn="_skipControls_ov6ol_723",Qn="_skipBtn_ov6ol_729",jn="_volumeContainer_ov6ol_753",Yn="_volumeSlider_ov6ol_760",Zn="_settingsMenu_ov6ol_838",er="_slideUp_ov6ol_1",tr="_qualityListInMenu_ov6ol_877",nr="_ccOptionsContainer_ov6ol_878",rr="_qualityItemInMenu_ov6ol_886",or="_ccItem_ov6ol_887",sr="_active_ov6ol_908",ar="_sourceLoader_ov6ol_915",cr="_spinner_ov6ol_921",ir="_watchBtn_ov6ol_980",lr="_errorOverlay_ov6ol_1026",ur="_retryButton_ov6ol_1036",dr="_sourceSelectionContainer_ov6ol_1064",pr="_slideUpIn_ov6ol_1",fr="_providerSelectContainer_ov6ol_1079",mr="_providerSelect_ov6ol_1079",hr="_sourceSelect_ov6ol_1064",vr="_sourceButtons_ov6ol_1135",_r="_sourceButton_ov6ol_1135",gr="_detailsBox_ov6ol_1167",yr="_detailsToggleBtn_ov6ol_1180",br="_detailsGridContainer_ov6ol_1204",wr="_fadeIn_ov6ol_1",Sr="_detailItem_ov6ol_1216",Cr="_animeStatus_ov6ol_1236",kr="_genresList_ov6ol_1249",Er="_genreTag_ov6ol_1256",Lr="_loadingDetails_ov6ol_1274",Tr="_descriptionSection_ov6ol_1281",xr="_description_ov6ol_1281",Br="_epJumpControls_ov6ol_1317",Nr="_epRangeButtons_ov6ol_1328",Ir="_metaTags_ov6ol_1334",Pr="_epRangeBtn_ov6ol_1341",Mr="_epJumpInputGroup_ov6ol_1356",Ar="_fullscreenActive_ov6ol_1388",$r="_errorSubtext_ov6ol_1432",bs={controls:Ht,titleContainer:Vt,scheduleInfo:Wt,status:Ut,nextEpisode:zt,watchlistBtn:Kt,inList:Gt,queueBtn:Xt,queueActive:Jt,modeToggleBtn:Qt,modeToggleActive:jt,nativeToggleBtn:Yt,nativeToggleActive:Zt,markWatchedBtn:en,markWatchedDone:tn,completeSeriesBtn:nn,providerAndEpisodeRow:rn,episodeActions:on,desktopEpisodeActions:sn,mobileEpisodeActions:an,episodeNavBtn:cn,primary:ln,secondary:un,episodePickerBtn:dn,queueCountdown:pn,speedBoostBadge:fn,videoContainer:mn,loadingOverlay:hn,loadingDots:vn,dot:_n,bounce:gn,bufferingOverlay:yn,bufferingSpinner:bn,spin:wn,videoIframe:Sn,videoElementHidden:Cn,upscalerCanvas:kn,upscalerActive:En,upscalerStatusBadge:Ln,subtitleOverlay:Tn,controlsOverlay:xn,hidden:Bn,centerPlayPause:Nn,bottomControls:In,progressBarContainer:Pn,progressBar:Mn,scrubbing:An,watchedBar:$n,bufferedBar:Fn,thumb:Rn,timeBubble:Dn,skipSegment:On,op:qn,ed:Hn,recap:Vn,bottomControlsRow:Wn,controlBtn:Un,timeDisplay:zn,leftControls:Kn,rightControls:Gn,middleControls:Xn,skipControls:Jn,skipBtn:Qn,volumeContainer:jn,volumeSlider:Yn,settingsMenu:Zn,slideUp:er,qualityListInMenu:tr,ccOptionsContainer:nr,qualityItemInMenu:rr,ccItem:or,active:sr,sourceLoader:ar,spinner:cr,watchBtn:ir,errorOverlay:lr,retryButton:ur,sourceSelectionContainer:dr,slideUpIn:pr,providerSelectContainer:fr,providerSelect:mr,sourceSelect:hr,sourceButtons:vr,sourceButton:_r,detailsBox:gr,detailsToggleBtn:yr,detailsGridContainer:br,fadeIn:wr,detailItem:Sr,animeStatus:Cr,genresList:kr,genreTag:Er,loadingDetails:Lr,descriptionSection:Tr,description:xr,epJumpControls:Br,epRangeButtons:Nr,metaTags:Ir,epRangeBtn:Pr,epJumpInputGroup:Mr,fullscreenActive:Ar,errorSubtext:$r},Fr="_playerPageLayout_6lomc_1",Rr="_episodeSidebar_6lomc_15",Dr="_playerMain_6lomc_28",Or="_videoPlayerWrapper_6lomc_36",qr="_playerInfoHeader_6lomc_52",Hr="_playerAnimeCard_6lomc_58",Vr="_playerInfoContainer_6lomc_70",Wr="_videoTitleSection_6lomc_94",Ur="_theaterMode_6lomc_276",zr="_theaterAmbient_6lomc_310",Kr={playerPageLayout:Fr,episodeSidebar:Rr,playerMain:Dr,videoPlayerWrapper:Or,playerInfoHeader:qr,playerAnimeCard:Hr,playerInfoContainer:Vr,videoTitleSection:Wr,theaterMode:Ur,theaterAmbient:zr},Gr="_shell_41rxp_1",Xr="_stage_41rxp_37",Jr="_shellFill_41rxp_85",Qr="_shellFullscreen_41rxp_93",jr="_uiLayer_41rxp_107",Yr="_volumeWrap_41rxp_118",Zr="_volumeSlider_41rxp_124",ae={shell:Gr,stage:Xr,shellFill:Jr,shellFullscreen:Qr,uiLayer:jr,volumeWrap:Yr,volumeSlider:Zr},eo=.8,to=5,ws=2e3,Ze="autoplayEnabled",no=(e,n)=>n>0&&e>=n*eo,Ss=(e,n)=>e>to&&!no(e,n),Cs=()=>{try{return localStorage.getItem(Ze)==="true"}catch{return!1}},ks=e=>{try{localStorage.setItem(Ze,String(e))}catch{}},ro=["finished","completed","complete","ended"],Es=(e,n,t)=>e.length>0&&!!n&&e[e.length-1]===n&&ro.some(s=>String(t||"").trim().toLowerCase().includes(s)),Ls=e=>e.seekInduced?"none":e.autoplayEnabled&&e.hasNext?"advance":e.hasNext?"prompt-next":e.isFinal?"prompt-complete":"none",oo=e=>(e.language??e.lang??"").toLowerCase(),so=e=>(e.label??"").toLowerCase(),ao=e=>`${e.language??e.lang??""}|||${e.label??""}`,co=e=>oo(e).startsWith("en")||so(e).includes("english");function Ts(e,n){if(e.length===0||n?.enabled===!1)return-1;const t=n?.lastKey??null;if(t){const o=e.findIndex(i=>ao(i)===t);if(o>=0)return o}const s=e.findIndex(co);return s>=0?s:0}const Z={fontSize:1.8,position:0,bgOpacity:.5,bgColor:"#000000",textColor:"#ffffff",edge:"shadow",bold:!1},Be=(e,n,t)=>Math.max(n,Math.min(t,e)),Ne=e=>typeof e=="string"&&/^#[0-9a-fA-F]{6}$/.test(e),ke=(e,n,t,s)=>{try{const o=localStorage.getItem(e);if(o===null)return n;const i=parseFloat(o);return Number.isFinite(i)?Be(i,t,s):n}catch{return n}};function io(){let e=Z.edge,n=Z.bgColor,t=Z.textColor,s=Z.bold;try{const o=localStorage.getItem("subtitleEdge");(o==="shadow"||o==="outline"||o==="none")&&(e=o);const i=localStorage.getItem("subtitleBgColor");Ne(i)&&(n=i);const p=localStorage.getItem("subtitleTextColor");Ne(p)&&(t=p);const _=localStorage.getItem("subtitleBold");_!==null&&(s=_==="true")}catch{}return{fontSize:ke("subtitleFontSize",Z.fontSize,.5,10),position:ke("subtitlePosition",Z.position,0,100),bgOpacity:ke("subtitleBgOpacity",Z.bgOpacity,0,1),bgColor:n,textColor:t,edge:e,bold:s}}function et(e,n){const t=`rgba(0, 0, 0, ${Be(n,0,1)})`;if(!Ne(e))return t;const s=parseInt(e.slice(1,3),16),o=parseInt(e.slice(3,5),16),i=parseInt(e.slice(5,7),16);return`rgba(${s}, ${o}, ${i}, ${Be(n,0,1)})`}function tt(e,n){return e==="none"?n<=0?"0 1px 3px rgba(0, 0, 0, 0.9)":"none":e==="outline"?["-1px 0 0 black","1px 0 0 black","0 -1px 0 black","0 1px 0 black","-1px -1px 0 black","1px -1px 0 black","-1px 1px 0 black","1px 1px 0 black","0 0 6px rgba(0, 0, 0, 0.9)"].join(", "):"0 0 4px black, 0 1px 2px rgba(0, 0, 0, 0.8)"}function xs(e){return`
|
|
2
|
-
video::cue {
|
|
3
|
-
font-size: ${e.fontSize}rem !important;
|
|
4
|
-
color: ${e.textColor} !important;
|
|
5
|
-
background-color: ${et(e.bgColor,e.bgOpacity)} !important;
|
|
6
|
-
font-weight: ${e.bold?"bold":"normal"} !important;
|
|
7
|
-
text-shadow: ${tt(e.edge,e.bgOpacity)} !important;
|
|
8
|
-
}
|
|
9
|
-
`}function Bs(e){return[`font-size: ${e.fontSize}rem`,`color: ${e.textColor}`,`background-color: ${et(e.bgColor,e.bgOpacity)}`,`font-weight: ${e.bold?"700":"400"}`,`text-shadow: ${tt(e.edge,e.bgOpacity)}`,"padding: 0.2em 0.5em","border-radius: 0.25em","text-align: center","position: absolute","left: 50%","transform: translateX(-50%)","max-width: 92%","white-space: pre-wrap","overflow-wrap: break-word","line-height: 1.4"].join(`;
|
|
10
|
-
`)+";"}const lo=new Set(["b","i","u","strong","em"]);function Ns(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/<(\/?)([a-zA-Z]+)>/g,(t,s,o)=>lo.has(o.toLowerCase())?`<${s}${o.toLowerCase()}>`:t)}function Is(e){return e.replace(/<[^>]*>/g,"")}const Ps=["#ffffff","#ffff00","#7CFC00","#00e5ff","#ff9ff3","#ffa502"],Ms=["#000000","#1e272e","#2f3542","#3d0c02","#0c3d2e","#ffffff"];function As(e,n){const t=Number.isFinite(e)?e*16:Z.fontSize*16;return!Number.isFinite(n)||n<=0?t/16:Math.min(t,Math.max(13,n*.07))/16}function $s(e){const n=Math.abs(e/1e3).toFixed(1);return e>0?`+${n}s`:e<0?`-${n}s`:"0.0s"}function Fs(e,n){const t=e.clientWidth||0,s=e.clientHeight||0,o=e.videoWidth>0&&e.videoHeight>0?e.videoWidth/e.videoHeight:0;let i=s;o>0&&t>0&&s>0&&(i=t/s>o?s:t/o);const p=Math.max(0,(s-i)/2),_=Math.max(0,Math.min(100,Number(n)||0))/100*i;return p+_}const Rs=({isOpen:e,onClose:n,title:t,message:s,resumeLabel:o="Resume",restartLabel:i="Start Over",onResume:p,onRestart:_})=>r($t,{isOpen:e,onClose:n,title:t,width:"sm",children:r("div",{style:{padding:"1rem",textAlign:"center"},children:[r("p",{children:s}),r("div",{style:{marginTop:"1rem",display:"flex",gap:"10px",justifyContent:"center"},children:[r(re,{variant:"secondary",onClick:_,children:i}),r(re,{onClick:p,children:o})]})]})}),uo="_centerControls_61n7k_1",po="_centerSkipBtn_61n7k_15",fo="_centerPlayPause_61n7k_40",mo="_playIconOffset_61n7k_71",de={centerControls:uo,centerSkipBtn:po,centerPlayPause:fo,playIconOffset:mo},Ds=({isPlaying:e,onTogglePlay:n,onSkipBack:t,onSkipForward:s,skipSeconds:o=10})=>r("div",{className:de.centerControls,onClick:i=>i.stopPropagation(),children:[r("button",{className:de.centerSkipBtn,onClick:t,title:`Skip back ${o}s`,"aria-label":`Skip back ${o} seconds`,children:r(Q,{name:"replay-10"})}),r("button",{className:de.centerPlayPause,"data-speed-boost-ignore":"true",onClick:n,"aria-label":e?"Pause":"Play",children:e?r(Q,{name:"pause"}):r(Q,{name:"play",className:de.playIconOffset})}),r("button",{className:de.centerSkipBtn,onClick:s,title:`Skip forward ${o}s`,"aria-label":`Skip forward ${o} seconds`,children:r(Q,{name:"forward-10"})})]}),Os=({visible:e,title:n,episode:t,onBack:s,classes:o})=>r("div",{className:`${o.overlay} ${e?"":o.hidden} `,"data-speed-boost-ignore":"true",style:{pointerEvents:"none",background:"none"},children:r("div",{className:o.top,onClick:i=>i.stopPropagation(),children:[r("button",{className:o.backBtn,onClick:i=>{i.stopPropagation(),s()},title:"Back","aria-label":"Back",children:r(Q,{name:"chevron-left"})}),r("div",{className:o.titleInfo,children:[r("span",{className:o.title,children:n}),t&&r("span",{className:o.episode,children:t})]})]})}),qs=({classes:e,videoRef:n,duration:t,formatTime:s,isScrubbing:o,buffered:i="auto",onSeek:p,onScrubStart:_,onScrubMove:c,onScrubEnd:h,timeLabelRef:l,children:E})=>{const v=b(null),L=b(null),f=b(null),g=b(null),S=b(null),u=b(!1),y=b(o);y.current=o;const d=b({onScrubMove:c,onScrubEnd:h});d.current={onScrubMove:c,onScrubEnd:h};const[N,$]=C({time:0,position:null});A(()=>{const m=n.current;if(!m)return;const w=j=>{const D=j/t*100||0;L.current&&(L.current.style.width=`${D}%`),f.current&&(f.current.style.left=`${D}%`),l?.current&&(l.current.innerText=`${s(j)} / ${s(t)}`)},R=()=>{o||w(m.currentTime)},U=()=>{if(i==="auto"&&m.buffered.length>0){const D=m.buffered.end(m.buffered.length-1)/t*100||0;g.current&&(g.current.style.width=`${D}%`)}};return w(m.currentTime),U(),m.addEventListener("timeupdate",R),m.addEventListener("progress",U),()=>{m.removeEventListener("timeupdate",R),m.removeEventListener("progress",U)}},[n,t,o,i,s,l]);const W=m=>{if(!v.current)return 0;const w=v.current.getBoundingClientRect();return Math.min(1,Math.max(0,(m-w.left)/w.width))},G=m=>{const w=m*t,R=w/t*100||0;L.current&&(L.current.style.width=`${R}%`),f.current&&(f.current.style.left=`${R}%`),l?.current&&(l.current.innerText=`${s(w)} / ${s(t)}`);const U=v.current?.getBoundingClientRect();$({time:w,position:U?m*U.width:null})};A(()=>{if(!o){S.current=null;return}const m=R=>{if(S.current!==null&&R.pointerId!==S.current||!t)return;const U=W(R.clientX);d.current.onScrubMove(U);const j=U*t,D=j/t*100||0;L.current&&(L.current.style.width=`${D}%`),f.current&&(f.current.style.left=`${D}%`),l?.current&&(l.current.innerText=`${s(j)} / ${s(t)}`);const ee=v.current?.getBoundingClientRect();$({time:j,position:ee?U*ee.width:null})},w=R=>{S.current!==null&&R.pointerId!==S.current||(S.current=null,u.current=!0,R.pointerType!=="mouse"&&$({time:0,position:null}),d.current.onScrubEnd())};return document.addEventListener("pointermove",m),document.addEventListener("pointerup",w),document.addEventListener("pointercancel",w),()=>{document.removeEventListener("pointermove",m),document.removeEventListener("pointerup",w),document.removeEventListener("pointercancel",w)}},[o,t,s,l]);const x=m=>{if(m.pointerType==="mouse"&&m.button!==0||!n.current||!t)return;m.preventDefault(),S.current=m.pointerId;try{v.current?.setPointerCapture(m.pointerId)}catch{}y.current||_();const w=W(m.clientX);c(w),G(w)},q=m=>{if(!t||y.current||m.pointerType!=="mouse")return;const w=W(m.clientX);$({time:w*t,position:m.clientX-(v.current?.getBoundingClientRect().left??0)})},z=m=>{if(!(S.current!==null&&m.pointerId!==S.current)&&y.current){S.current=null,u.current=!0,m.pointerType!=="mouse"&&$({time:0,position:null});try{v.current?.hasPointerCapture(m.pointerId)&&v.current.releasePointerCapture(m.pointerId)}catch{}h()}};return r("div",{className:`${e.container} ${o&&e.scrubbing?e.scrubbing:""}`,ref:v,role:"slider","aria-label":"Seek","aria-valuemin":0,"aria-valuemax":Math.round(t||0),"aria-valuenow":Math.round((Number(L.current?.style.width?.replace("%",""))||0)*(t||0)/100),tabIndex:0,onClick:m=>{if(u.current){u.current=!1;return}!n.current||isNaN(t)||t===0||p(W(m.clientX))},onPointerDown:x,onPointerMove:q,onPointerUp:z,onPointerCancel:z,onMouseMove:m=>{if(o||!t)return;const w=W(m.clientX);$({time:w*t,position:m.clientX-(v.current?.getBoundingClientRect().left??0)})},onMouseLeave:()=>{o||$({time:0,position:null})},onKeyDown:m=>{if(!(!n.current||!t)&&(m.key==="ArrowRight"||m.key==="ArrowLeft")){m.preventDefault();const w=(m.key==="ArrowRight"?5:-5)/t,R=n.current.currentTime/t||0;p(Math.min(1,Math.max(0,R+w)))}},children:[N.position!==null&&r("div",{className:e.timeBubble,style:{left:N.position},children:s(N.time)}),r("div",{className:e.bar,children:[r("div",{className:e.buffered,ref:g,style:i==="full"?{width:"100%"}:void 0}),r("div",{className:e.watched,ref:L}),r("div",{className:e.thumb,ref:f,onMouseDown:m=>{m.preventDefault(),n.current&&(y.current||_())}}),E]})]})};function Ee(){try{if(typeof window>"u")return!1;const e=window.matchMedia?.("(pointer: coarse)").matches??!1,t=(navigator.maxTouchPoints??0)>0||"ontouchstart"in window;return e||t}catch{return!1}}function nt(){const[e,n]=C(Ee);return A(()=>{n(Ee());let t=null;const s=()=>n(Ee());try{t=window.matchMedia("(pointer: coarse)"),t.addEventListener?t.addEventListener("change",s):t.addListener(s)}catch{}return window.addEventListener("touchstart",s,{passive:!0,once:!0}),()=>{try{t&&(t.removeEventListener?t.removeEventListener("change",s):t.removeListener(s))}catch{}window.removeEventListener("touchstart",s)}},[]),e}const ho=450,Hs=({muted:e,volume:n,volumeIcon:t,buttonClassName:s,sliderClassName:o,onToggleMute:i,onVolumeChange:p,onExpandedChange:_})=>{const c=nt(),[h,l]=C(!1),E=b(null),v=b(!1),L=b(null),f=B(d=>{l(d),_?.(d)},[_]);A(()=>()=>{E.current&&window.clearTimeout(E.current)},[]),A(()=>{if(!h)return;const d=N=>{L.current&&!L.current.contains(N.target)&&f(!1)};return document.addEventListener("pointerdown",d),()=>document.removeEventListener("pointerdown",d)},[h,f]);const g=e?0:n,S=()=>{v.current=!1,E.current&&window.clearTimeout(E.current),E.current=window.setTimeout(()=>{v.current=!0,f(!0)},ho)},u=()=>{E.current&&(window.clearTimeout(E.current),E.current=null)},y=d=>{if(d.stopPropagation(),v.current){v.current=!1;return}if(c){h?i():f(!0);return}i()};return r("div",{ref:L,className:ae.volumeWrap,"data-expanded":h?"true":"false",onContextMenu:d=>d.preventDefault(),children:[r("button",{type:"button",className:s,onClick:y,onPointerDown:S,onPointerUp:u,onPointerLeave:u,onContextMenu:d=>d.preventDefault(),"aria-label":e?"Unmute":"Mute","aria-expanded":h,children:t}),r("input",{type:"range",min:"0",max:"1",step:"0.05",value:g,onChange:d=>p(parseFloat(d.target.value)),onClick:d=>d.stopPropagation(),onPointerDown:d=>d.stopPropagation(),onContextMenu:d=>d.preventDefault(),className:`${ae.volumeSlider} ${o??""}`,style:{"--volume-percent":`${g*100}%`},"aria-label":"Volume"})]})},Qe=280;function vo(e){return e?!!e.closest('button, input, select, textarea, a, [role="button"], [data-player-ui="true"]'):!1}const Vs=({player:e,topBar:n,centerControls:t,bottomBar:s,settingsPanel:o,overlays:i,isInteracting:p=!1,className:_,chromeDisabled:c=!1,children:h})=>{const{state:l,refs:E,actions:v}=e,L=E.playerContainerRef,g=nt()?5e3:3e3,S=b(0),u=b(null),y=b(p);y.current=p;const d=B(()=>{const x=v.inactivityTimer.current;x&&(window.clearTimeout(x),v.inactivityTimer.current=null)},[v]),N=B(()=>{d(),l.isPlaying&&(y.current||l.useNativeControls||(v.inactivityTimer.current=window.setTimeout(()=>{if(y.current)return;v.setShowControls(!1);const x=L.current;x&&l.isFullscreen&&(x.style.cursor="none")},g)))},[v,d,L,g,l.isFullscreen,l.isPlaying,l.useNativeControls]),$=B(()=>{const x=L.current;x&&(x.style.cursor="default"),!l.showControls&&!l.useNativeControls&&v.setShowControls(!0),N()},[v,L,N,l.showControls,l.useNativeControls]);A(()=>{if(l.showControls){if(!l.isPlaying){d();return}if(p||l.isScrubbing||l.showSettings||l.showVolumeSlider){v.setShowControls(!0),d();return}N()}},[v,d,p,N,l.isPlaying,l.isScrubbing,l.showControls,l.showSettings,l.showVolumeSlider]),A(()=>()=>d(),[d]);const W=B(x=>{const q=x.target;if(vo(q))return;const z=Date.now(),m=z-S.current<Qe;if(S.current=z,m){u.current&&(window.clearTimeout(u.current),u.current=null),v.toggleFullscreen();return}u.current&&window.clearTimeout(u.current),u.current=window.setTimeout(()=>{u.current=null,v.setShowControls(!l.showControls),l.showControls?N():$()},Qe)},[v,N,l.showControls,$]);A(()=>()=>{u.current&&window.clearTimeout(u.current)},[]);const G=l.showControls||l.isScrubbing||l.showSettings||l.showVolumeSlider;return r("div",{ref:L,className:`${ae.shell} ${l.isFullscreen?ae.shellFullscreen:""} ${_??""}`,onContextMenu:x=>x.preventDefault(),onPointerMove:x=>{x.pointerType==="mouse"&&$()},onMouseLeave:()=>{window.matchMedia?.("(hover: hover) and (pointer: fine)").matches&&l.isPlaying&&!y.current&&v.setShowControls(!1)},children:[r("div",{className:ae.stage,onClick:W,onContextMenu:x=>x.preventDefault(),children:h}),i,!c&&!l.useNativeControls&&r("div",{className:ae.uiLayer,onContextMenu:x=>x.preventDefault(),children:[r("div",{"data-player-ui":"true",children:n}),G&&t&&r("div",{"data-player-ui":"true",children:t}),r("div",{"data-player-ui":"true",children:s}),o&&r("div",{"data-player-ui":"true",children:o})]})]})},_o="_statusArea_1xccu_1",go="_toggleBtn_1xccu_20",yo="_shortcuts_1xccu_46",bo="_shortcutGroup_1xccu_56",wo="_shortcut_1xccu_46",So="_key_1xccu_70",Co="_label_1xccu_91",P={statusArea:_o,toggleBtn:go,shortcuts:yo,shortcutGroup:bo,shortcut:wo,key:So,label:Co},Ws=({showTheater:e=!0})=>{const[n,t]=C(!1);return r("div",{className:P.statusArea,children:[r("button",{type:"button",className:P.toggleBtn,onClick:()=>t(s=>!s),"aria-expanded":n,"aria-controls":"player-shortcuts",children:[r(Q,{name:"keyboard",size:14}),r("span",{children:"Keyboard Shortcuts"}),n?r(Q,{name:"chevron-up",size:12}):r(Q,{name:"chevron-down",size:12})]}),n&&r("div",{id:"player-shortcuts",className:P.shortcuts,children:[r("div",{className:P.shortcutGroup,children:[r("div",{className:P.shortcut,children:[r("span",{className:P.key,children:"↑"}),r("span",{className:P.key,children:"↓"}),r("span",{className:P.label,children:"Volume"})]}),r("div",{className:P.shortcut,children:[r("span",{className:P.key,children:"←"}),r("span",{className:P.key,children:"→"}),r("span",{className:P.label,children:"Seek"})]})]}),r("div",{className:P.shortcutGroup,children:[r("div",{className:P.shortcut,children:[r("span",{className:P.key,children:"Space"}),r("span",{className:P.label,children:"Play/Pause"})]}),r("div",{className:P.shortcut,children:[r("span",{className:P.key,children:"F"}),r("span",{className:P.label,children:"Fullscreen"})]}),r("div",{className:P.shortcut,children:[r("span",{className:P.key,children:"M"}),r("span",{className:P.label,children:"Mute"})]}),e&&r("div",{className:P.shortcut,children:[r("span",{className:P.key,children:"T"}),r("span",{className:P.label,children:"Theater"})]}),r("div",{className:P.shortcut,children:[r("span",{className:P.key,children:"N"}),r("span",{className:P.label,children:"Next"})]})]})]})]})},ko="_episodeListContainer_9tyin_1",Eo="_drawerContainer_9tyin_9",Lo="_episodeListHeader_9tyin_14",To="_drawerHeader_9tyin_20",xo="_episodeListTitle_9tyin_29",Bo="_rangeSelector_9tyin_41",No="_rangeButton_9tyin_47",Io="_active_9tyin_70",Po="_episodeList_9tyin_1",Mo="_drawerList_9tyin_89",Ao="_episodeItem_9tyin_118",$o="_watched_9tyin_145",Fo="_episodeThumb_9tyin_167",Ro="_episodeText_9tyin_176",Do="_episodeLabel_9tyin_184",Oo="_episodeSub_9tyin_189",M={episodeListContainer:ko,drawerContainer:Eo,episodeListHeader:Lo,drawerHeader:To,episodeListTitle:xo,rangeSelector:Bo,rangeButton:No,active:Io,episodeList:Po,drawerList:Mo,episodeItem:Ao,watched:$o,episodeThumb:Fo,episodeText:Ro,episodeLabel:Do,episodeSub:Oo},qo=({episodes:e,currentEpisode:n,watchedEpisodes:t=[],onEpisodeClick:s,variant:o="sidebar",title:i="Episodes",header:p})=>{const[_,c]=C(0),h=b(null),l=pe(()=>e.map(f=>typeof f=="string"?{id:f,label:`Episode ${f}`}:f),[e]),E=pe(()=>new Set(t),[t]);A(()=>{const f=h.current;if(!f)return;let g=f.parentElement;for(;g;){const y=window.getComputedStyle(g);if((y.overflowY==="auto"||y.overflowY==="scroll")&&g.scrollHeight>g.clientHeight)break;g=g.parentElement}if(!g)return;const S=g.getBoundingClientRect(),u=f.getBoundingClientRect();g.scrollTop+=u.top+u.height/2-(S.top+g.clientHeight/2)},[n,_]);const v=pe(()=>{if(l.length<=100)return[];const f=[];for(let g=0;g<l.length;g+=100){const S=g+1,u=Math.min(g+100,l.length);f.push(`${S}-${u}`)}return f},[l]),L=pe(()=>{if(v.length===0)return l;const f=v[_];if(!f)return l;const[g,S]=f.split("-"),u=parseInt(g,10),y=parseInt(S,10);return l.slice(u-1,y)},[l,v,_]);return r("div",{className:`${M.episodeListContainer} ${o==="drawer"?M.drawerContainer:""}`,children:[r("div",{className:`${M.episodeListHeader} ${o==="drawer"?M.drawerHeader:""}`,children:[p,r("h3",{className:M.episodeListTitle,children:i}),v.length>0&&r("div",{className:M.rangeSelector,children:v.map((f,g)=>r("button",{className:`${M.rangeButton} ${_===g?M.active:""}`,onClick:()=>c(g),children:f},f))})]}),r("div",{className:`${M.episodeList} ${o==="drawer"?M.drawerList:""}`,children:L.map(f=>{const g=f.id===n,S=E.has(f.id)||f.watched===!0;return r("div",{ref:g?h:void 0,className:`${M.episodeItem} ${S?M.watched:""} ${g?M.active:""}`,onClick:()=>s(f.id),children:[f.thumbnail&&r("img",{src:f.thumbnail,alt:"",loading:"lazy",decoding:"async",className:M.episodeThumb}),r("span",{className:M.episodeText,children:[r("span",{className:M.episodeLabel,children:f.label??`Episode ${f.id}`}),f.sublabel&&r("span",{className:M.episodeSub,children:f.sublabel})]})]},f.id)})})]})},Us=({variant:e="sidebar",count:n=12})=>r("div",{className:`${M.episodeListContainer} ${e==="drawer"?M.drawerContainer:""}`,children:[r("div",{className:`${M.episodeListHeader} ${e==="drawer"?M.drawerHeader:""}`,children:[r("h3",{className:M.episodeListTitle,children:"Episodes"}),r("div",{className:M.rangeSelector,children:[r(ye,{width:"60px",height:"28px",variant:"rectangular"}),r(ye,{width:"60px",height:"28px",variant:"rectangular"}),r(ye,{width:"60px",height:"28px",variant:"rectangular"})]})]}),r("div",{className:`${M.episodeList} ${e==="drawer"?M.drawerList:""}`,children:Array.from({length:n}).map((t,s)=>r("div",{className:M.episodeItem,style:{border:"none",background:"transparent"},children:r(ye,{width:"120px",height:"1.2rem",variant:"text"})},s))})]}),Ho="_shell_cys6s_1",Vo="_overlay_cys6s_10",Wo="_drawer_cys6s_21",Uo="_handle_cys6s_56",zo="_header_cys6s_64",Ko="_headerCopy_cys6s_73",Go="_kicker_cys6s_79",Xo="_title_cys6s_87",Jo="_closeBtn_cys6s_94",Qo="_body_cys6s_116",J={shell:Ho,overlay:Vo,drawer:Wo,handle:Uo,header:zo,headerCopy:Ko,kicker:Go,title:Xo,closeBtn:Jo,body:Qo};function zs({isOpen:e,onClose:n,episodes:t,currentEpisode:s,watchedEpisodes:o=[],onEpisodeClick:i,title:p,header:_}){return A(()=>{if(!e)return;const c=l=>{l.key==="Escape"&&n()},h=document.body.style.overflow;return document.body.style.overflow="hidden",document.addEventListener("keydown",c),()=>{document.body.style.overflow=h,document.removeEventListener("keydown",c)}},[e,n]),e?At(r("div",{className:J.shell,role:"dialog","aria-modal":"true","aria-label":"Episode picker",children:[r("button",{className:J.overlay,type:"button",onClick:n,"aria-label":"Close episodes"}),r("aside",{className:J.drawer,children:[r("div",{className:J.handle}),r("div",{className:J.header,children:[r("div",{className:J.headerCopy,children:[r("span",{className:J.kicker,children:"Episode picker"}),r("h3",{className:J.title,children:"Choose an episode"})]}),r("button",{className:J.closeBtn,type:"button",onClick:n,"aria-label":"Close",children:r(Q,{name:"times"})})]}),r("div",{className:J.body,children:r(qo,{episodes:t,currentEpisode:s,watchedEpisodes:o,onEpisodeClick:i,variant:"drawer",title:p,header:_})})]})]}),document.body):null}function Pe(){return document}function rt(e){const n=Pe();if(document.fullscreenElement)return document.fullscreenElement;if(n.webkitFullscreenElement)return n.webkitFullscreenElement;const t=e;return t?.webkitDisplayingFullscreen?t:null}function ce(e){return rt(e)!==null}async function jo(e,n){if(rt(n))return;const t=e;try{if(typeof e.requestFullscreen=="function"){await e.requestFullscreen();return}if(typeof t.webkitRequestFullscreen=="function"){await t.webkitRequestFullscreen();return}if(typeof t.webkitRequestFullScreen=="function"){await t.webkitRequestFullScreen();return}}catch{}const s=n;if(s&&typeof s.webkitEnterFullscreen=="function"){if(s.webkitSupportsFullscreen===!1)return;try{await s.webkitEnterFullscreen()}catch{}}}async function Yo(e){const n=Pe();try{if(document.fullscreenElement&&typeof document.exitFullscreen=="function"){await document.exitFullscreen();return}if(n.webkitFullscreenElement&&typeof n.webkitExitFullscreen=="function"){await n.webkitExitFullscreen();return}}catch{}const t=e;if(t?.webkitDisplayingFullscreen&&typeof t.webkitExitFullscreen=="function"){try{t.webkitExitFullscreen()}catch{}return}try{typeof n.webkitCancelFullScreen=="function"?n.webkitCancelFullScreen():!document.fullscreenElement&&typeof document.exitFullscreen=="function"&&(document.fullscreenElement??n.webkitFullscreenElement)&&await document.exitFullscreen()}catch{}}async function Zo(e,n){!e&&!n||(ce(n)?await Yo(n):e&&await jo(e,n))}function es(e,n){const t=()=>{try{n(ce(e()))}catch{}},s=Pe(),o=t;s.addEventListener("fullscreenchange",t),s.addEventListener("webkitfullscreenchange",o),s.addEventListener("webkitbeginfullscreen",o,!0),s.addEventListener("webkitendfullscreen",o,!0);const i=e();return i?.addEventListener("webkitbeginfullscreen",o),i?.addEventListener("webkitendfullscreen",o),()=>{s.removeEventListener("fullscreenchange",t),s.removeEventListener("webkitfullscreenchange",o),s.removeEventListener("webkitbeginfullscreen",o,!0),s.removeEventListener("webkitendfullscreen",o,!0),i?.removeEventListener("webkitbeginfullscreen",o),i?.removeEventListener("webkitendfullscreen",o)}}const Ks=({skipIntervals:e,showId:n,episodeNumber:t,episodeCount:s,sourceType:o,showMeta:i})=>{const p=qt(),_=Ft(),c=b(null),h=b(null),l=b(null),E=b(null),v=b(!1),L=b(null),f=b(0),g=b(1),S=b({mouse:!1,keyboard:!1}),u=b(null),y=b(null),d=b(!1),N=b(Math.random().toString(36).substring(2)),[$,W]=C(!1),[G,x]=C(()=>{try{return localStorage.getItem("playerMuted")==="true"}catch{return!1}}),[q,z]=C(()=>{try{const a=parseFloat(localStorage.getItem("playerVolume")||"");return isNaN(a)?1:Math.max(0,Math.min(1,a))}catch{return 1}}),[m,w]=C(!1),[R,U]=C(0),[j,D]=C(!0),[ee,Me]=C(!1),[ot,Ae]=C({time:0,position:null}),[we,st]=C(localStorage.getItem("autoSkipEnabled")==="true"),[at,Se]=C(null),[ct,it]=C(!1),[te]=C(io),[lt,ut]=C(te.fontSize),[dt,pt]=C(te.position),[ft,mt]=C(te.bgOpacity),[ht,vt]=C(te.bgColor),[_t,gt]=C(te.textColor),[yt,bt]=C(te.edge),[wt,St]=C(te.bold),[Ct,kt]=C([]),[Et,Lt]=C(null),[Tt,xt]=C(!1),[Bt,Nt]=C(!1),[fe,X]=C(!1),[It,me]=C(!1),[Pt,$e]=C(()=>{try{return localStorage.getItem("playerUseNativeControls")==="true"}catch{return!1}}),ie=b(!1),Ce=b(-1),he=B(()=>{const a=c.current;return!n||!t||!i?.name?null:{showId:n,episodeNumber:t,episodeCount:s,currentTime:a?a.currentTime:0,duration:a?a.duration:0,showName:i.name,showThumbnail:i.thumbnail,nativeName:i.names?.native,englishName:i.names?.english,genres:Array.isArray(i.genres)?i.genres.map(T=>typeof T=="string"?T:T?.name).filter(Boolean):void 0,popularityScore:i.score,type:i.type,isPlaying:a?!a.paused:!0,sessionId:N.current,isAdult:i.isAdult}},[n,t,s,i]),O=B((a=!1,T=!1)=>{if(ie.current)return!1;const I=he();if(!I)return!1;const k=c.current;if(!k&&o!=="iframe")return!1;const F=k?k.currentTime>=k.duration*.8:!1;let H=k?k.currentTime:0;if(a&&F&&(H=k?k.duration:0),!T){if(H===0&&!F)return!1;const K=k?Math.abs(H-Ce.current):0;if(!a&&k&&H!==k.duration&&K<5)return!1}return I.currentTime=H,Ce.current=H,a?(async()=>{try{await Je.progress.updateProgress.mutate(I),p.invalidateQueries({queryKey:["video-sources",n,t]}),p.invalidateQueries({queryKey:["allContinueWatching"]}),p.invalidateQueries({queryKey:["thisWeekSchedule"]}),p.invalidateQueries(_.continueWatching.pathFilter())}catch(K){console.error("Failed to update progress:",K)}})():Rt("progress.updateProgress",I).catch(K=>console.error("Failed to update progress:",K)),!0},[he,o,p,n,t,_.continueWatching]);A(()=>{const a=c.current;a&&(a.volume=q,a.muted=G)},[c,q,G]),A(()=>{const a=()=>{ie.current||O(!0)};window.addEventListener("beforeunload",a);const T=L,I=E;return()=>{window.removeEventListener("beforeunload",a),ie.current||O(!0),T.current&&clearTimeout(T.current),I.current&&clearTimeout(I.current)}},[O]);const ve=B(()=>{const a=h.current;a&&Zo(a,c.current).catch(T=>{console.error(`Error attempting to toggle full-screen mode: ${T?.message} (${T?.name})`)})},[]),_e=B(()=>{c.current&&(c.current.paused?c.current.play().catch(()=>console.warn("Autoplay was prevented.")):(c.current.pause(),D(!0)))},[D]),oe=B(()=>{const a=c.current;if(!a)return;const T=S.current.mouse||S.current.keyboard;a.playbackRate=T?2:g.current},[]),le=B(a=>{S.current.mouse!==a&&(S.current.mouse=a,me(a||S.current.keyboard),oe())},[oe]),se=B(a=>{S.current.keyboard!==a&&(S.current.keyboard=a,me(S.current.mouse||a),oe())},[oe]),ue=B(a=>{c.current&&(c.current.currentTime+=a,L.current&&clearTimeout(L.current),L.current=setTimeout(()=>{O(!1,!0)},1500),D(!0))},[O,D]),ge=B(()=>{if(!c.current)return;const a=!c.current.muted;c.current.muted=a,x(a),localStorage.setItem("playerMuted",String(a)),!a&&c.current.volume===0&&(c.current.volume=.5,z(.5),localStorage.setItem("playerVolume",String(.5))),D(!0)},[D]);A(()=>{const a=()=>c.current,T=es(a,I=>{w(I),I&&D(!0)});return w(ce(a())),T},[D]),A(()=>{const a=I=>{if(!I.target.closest('input, textarea, button, select, a, [role="button"], [contenteditable="true"]')){if(I.code==="Space"){if(I.preventDefault(),d.current)return;d.current=!0,y.current&&clearTimeout(y.current),y.current=window.setTimeout(()=>{y.current=null,d.current&&se(!0)},180);return}switch(I.key.toLowerCase()){case"f":ve();break;case"m":ge();break;case"arrowright":ue(10);break;case"arrowleft":ue(-10);break;case"arrowup":if(I.preventDefault(),c.current){const F=Math.min(1,c.current.volume+.1);c.current.volume=F,z(F)}break;case"arrowdown":if(I.preventDefault(),c.current){const F=Math.max(0,c.current.volume-.1);c.current.volume=F,z(F)}break}}},T=I=>{if(I.code==="Space"){if(I.preventDefault(),d.current=!1,S.current.keyboard){se(!1);return}y.current&&(clearTimeout(y.current),y.current=null,_e())}};return document.addEventListener("keydown",a),document.addEventListener("keyup",T),()=>{document.removeEventListener("keydown",a),document.removeEventListener("keyup",T),y.current&&(clearTimeout(y.current),y.current=null),d.current=!1,se(!1),me(!1)}},[se,_e,ve,ge,ue]),A(()=>{const a=H=>H?!!H.closest('[data-speed-boost-ignore="true"], [data-player-ui="true"], button, input, select, textarea, a, [role="button"], [role="slider"], [contenteditable="true"]'):!0,T=H=>{if(H.button!==0)return;const Y=H.target;if(!Y||a(Y))return;const K=h.current;!K||!K.contains(Y)||(u.current&&clearTimeout(u.current),u.current=window.setTimeout(()=>{u.current=null,le(!0)},180))},I=H=>{const Y=H.target;if(!Y||a(Y))return;const K=h.current;!K||!K.contains(Y)||(u.current&&clearTimeout(u.current),u.current=window.setTimeout(()=>{u.current=null,le(!0)},180))},k=()=>{u.current&&(clearTimeout(u.current),u.current=null),le(!1)},F=()=>{u.current&&(clearTimeout(u.current),u.current=null),d.current=!1,y.current&&(clearTimeout(y.current),y.current=null),se(!1),le(!1),me(!1)};return document.addEventListener("mousedown",T),document.addEventListener("mouseup",k),document.addEventListener("touchstart",I,{passive:!0}),document.addEventListener("touchend",k),document.addEventListener("touchcancel",k),document.addEventListener("pointerup",k),document.addEventListener("pointercancel",k),window.addEventListener("blur",F),()=>{document.removeEventListener("mousedown",T),document.removeEventListener("mouseup",k),document.removeEventListener("touchstart",I),document.removeEventListener("touchend",k),document.removeEventListener("touchcancel",k),document.removeEventListener("pointerup",k),document.removeEventListener("pointercancel",k),window.removeEventListener("blur",F),u.current&&(clearTimeout(u.current),u.current=null)}},[se,le]);const Fe=B(()=>{W(!0),X(!1),setTimeout(()=>O(!1,!0),50)},[O]),Re=B(()=>{W(!0),X(!1)},[]),De=B(()=>{const a=c.current;a&&!a.paused&&a.readyState>=3&&!a.seeking||X(!0)},[]),Oe=B(()=>{X(!1)},[]),qe=B(()=>{W(!1),X(!1),D(!0),setTimeout(()=>O(!1,!0),50)},[O]),He=b(!1);He.current=fe,A(()=>{if(!fe)return;let a=c.current?.currentTime??0,T=0;const I=window.setInterval(()=>{const k=c.current;if(!k)return;T+=1;const F=k.currentTime,H=F!==a;if(a=F,!(k.paused||k.seeking)){if(H||k.readyState>=3){X(!1);return}T>=24&&k.readyState>=2&&!k.ended&&X(!1)}},500);return()=>window.clearInterval(I)},[fe]),A(()=>{ie.current=!1,Ce.current=-1,f.current=0,N.current=Math.random().toString(36).substring(2),U(0),X(!1)},[n,t]);const Ve=B(()=>{U(0),X(!1)},[]);A(()=>{const a=N.current;return()=>{Dt(a)}},[n,t]),A(()=>{if(o!=="iframe")return;O(!1,!0);const a=setInterval(()=>{O(!1,!0)},6e4);return()=>clearInterval(a)},[o,O]);const We=B(()=>{U(c.current?.duration||0),oe()},[oe]),Ue=B(()=>{if(c.current){const a=c.current.muted,T=c.current.volume;x(a),z(T),localStorage.setItem("playerMuted",String(a)),localStorage.setItem("playerVolume",String(T))}},[]),ze=B(()=>{},[]),Ke=B(()=>{const a=c.current;if(!a)return;He.current&&!a.paused&&!a.seeking&&X(!1);const T=a.currentTime||0,I=Date.now();I-f.current>6e4&&O()&&(f.current=I);const k=e.find(F=>T>=F.start_time&&T<F.end_time)||null;Se(F=>F?.skip_id!==k?.skip_id?k:F),we&&k&&!a.paused&&(a.currentTime=k.end_time,Se(null))},[e,we,O]),Ge=B(()=>{const a=he();a&&(a.currentTime=a.duration,Je.progress.updateProgress.mutate(a).then(()=>{p.invalidateQueries({queryKey:["video-sources",n,t]}),p.invalidateQueries({queryKey:["allContinueWatching"]})}).catch(T=>console.error("Failed to send final progress:",T)))},[he,p,n,t]),Xe=B(()=>{ie.current=!0,Ge()},[Ge]);A(()=>{const a=()=>{ee&&(Me(!1),Ae({time:0,position:null}),v.current&&c.current?.play(),O(!1,!0))};return ee&&(document.addEventListener("mouseup",a),document.addEventListener("pointerup",a),document.addEventListener("touchend",a),document.addEventListener("pointercancel",a),document.addEventListener("touchcancel",a)),()=>{document.removeEventListener("mouseup",a),document.removeEventListener("pointerup",a),document.removeEventListener("touchend",a),document.removeEventListener("pointercancel",a),document.removeEventListener("touchcancel",a)}},[ee,O]);const Mt=pe(()=>({togglePlay:_e,seek:ue,toggleMute:ge,toggleFullscreen:ve,onPlay:Fe,onPause:qe,onLoadedMetadata:We,formatTime:Ot,onVolumeChange:Ue,onProgress:ze,onTimeUpdate:Ke,onEnded:Xe,setShowControls:D,setIsScrubbing:Me,setHoverTime:Ae,setIsAutoSkipEnabled:st,setCurrentSkipInterval:Se,setShowCCMenu:it,setSubtitleFontSize:ut,setSubtitlePosition:pt,setSubtitleBgOpacity:mt,setSubtitleBgColor:vt,setSubtitleTextColor:gt,setSubtitleEdge:bt,setSubtitleBold:St,setAvailableSubtitles:kt,setActiveSubtitleTrack:Lt,setShowSettings:xt,setShowVolumeSlider:Nt,wasPlayingBeforeScrub:v,inactivityTimer:E,setIsFullscreen:w,onWaiting:De,onPlaying:Re,onCanPlay:Oe,sendProgressUpdate:O,setUseNativeControls:$e,resetMediaState:Ve}),[_e,ue,ge,ve,Fe,qe,We,Ue,ze,Ke,Xe,w,De,Re,Oe,O,$e,Ve]);return{refs:{videoRef:c,playerContainerRef:h,progressBarRef:l},state:{isPlaying:$,isMuted:G,volume:q,isFullscreen:m,duration:R,showControls:j,isScrubbing:ee,hoverTime:ot,isAutoSkipEnabled:we,currentSkipInterval:at,showCCMenu:ct,subtitleFontSize:lt,subtitlePosition:dt,subtitleBgOpacity:ft,subtitleBgColor:ht,subtitleTextColor:_t,subtitleEdge:yt,subtitleBold:wt,availableSubtitles:Ct,activeSubtitleTrack:Et,showSettings:Tt,showVolumeSlider:Bt,isBuffering:fe,isSpeedBoostActive:It,useNativeControls:Pt},actions:Mt}};function ts(){try{return typeof navigator<"u"&&/android/i.test(navigator.userAgent)}catch{return!1}}function Gs(e,n){const{refs:t,actions:s}=e,o=b(n);o.current=n;const i=b(!1),p=b(!1),_=c=>{try{if(c)return c.matches}catch{}try{return window.innerWidth>window.innerHeight}catch{return!1}};A(()=>{if(!ts())return;let c=null;const h=()=>{const l=t.playerContainerRef.current;if(_(c)){if(!o.current||!l||ce(t.videoRef.current)||p.current)return;i.current=!0,s.toggleFullscreen()}else p.current=!1,i.current&&(i.current=!1,ce(t.videoRef.current)&&s.toggleFullscreen())};try{c=window.matchMedia("(orientation: landscape)"),c.addEventListener?c.addEventListener("change",h):c.addListener(h)}catch{}return h(),()=>{try{c&&(c.removeEventListener?c.removeEventListener("change",h):c.removeListener(h))}catch{}}},[s,t.playerContainerRef,t.videoRef,n]),A(()=>{const c=()=>{if(!ce(t.videoRef.current)){i.current=!1;try{window.matchMedia("(orientation: landscape)").matches&&(p.current=!0)}catch{p.current=!0}}};return document.addEventListener("fullscreenchange",c),document.addEventListener("webkitfullscreenchange",c),()=>{document.removeEventListener("fullscreenchange",c),document.removeEventListener("webkitfullscreenchange",c)}},[t.videoRef])}const ns=e=>Math.max(8,Math.min(40,Math.ceil(e/16.7)+4));function Xs({videoRef:e,canvasRef:n,delayMs:t,enabled:s}){const o=b(t);o.current=t;const i=b([]),p=b(-1),_=b(-1),c=b(!1),h=b(0),l=b(null);A(()=>{const E=u=>{if(u)try{u.close()}catch{}},v=()=>{for(const u of i.current)E(u.bitmap);i.current=[]};if(!s){v(),p.current=-1,_.current=-1,c.current=!1,h.current=0;return}let L=!1;const f=()=>{l.current!==null&&(cancelAnimationFrame(l.current),l.current=null)},g=()=>{L||(f(),l.current=requestAnimationFrame(()=>{S()}))};async function S(){if(L)return;const u=e.current,y=n.current;if(!u||!y||u.videoWidth===0){g();return}if(u.paused||u.ended||document.hidden||u.readyState<HTMLMediaElement.HAVE_CURRENT_DATA){g();return}const d=u.getVideoPlaybackQuality().totalVideoFrames;if(d===p.current){g();return}(u.seeking||_.current>=0&&Math.abs(u.currentTime-_.current)>.5)&&(v(),c.current=!1,h.current=0,p.current=-1),_.current=u.currentTime,(y.width!==u.videoWidth||y.height!==u.videoHeight)&&(y.width=u.videoWidth,y.height=u.videoHeight);const N=Math.max(0,o.current||0);N>h.current&&(c.current=!1);try{const $=await createImageBitmap(u);if(L){E($);return}p.current=d;const W=performance.now(),G=y.getContext("2d"),x=w=>{G&&G.drawImage(w,0,0,y.width,y.height)};if(N<=0){v(),c.current=!1,h.current=0,x($),E($),g();return}const q=i.current;q.push({bitmap:$,capture:W});const z=ns(N);for(;q.length>z;)E(q.shift()?.bitmap);let m=-1;for(let w=q.length-1;w>=0;w--)if(W-q[w].capture>=N){m=w;break}if(m!==-1){for(let R=0;R<m;R++)E(q.shift()?.bitmap);const w=q.shift();w?(x(w.bitmap),E(w.bitmap),c.current=!0,h.current=N):x($)}else if(!c.current)x($);else{const w=q.shift();w?(x(w.bitmap),E(w.bitmap)):x($)}}catch{}g()}return g(),()=>{L=!0,f();for(const u of i.current)try{u.bitmap.close()}catch{}i.current=[]}},[s,e,n])}const je=(e,n)=>{try{localStorage.setItem("playerVideoDelayMs",String(e)),localStorage.setItem("playerVideoDelayEnabled",String(n))}catch{}},Ye=e=>{try{localStorage.setItem("playerVideoDelayEnabled",String(e))}catch{}};function Js(e,n){const[t,s]=C(()=>{try{const d=Number(localStorage.getItem("playerVideoDelayMs"));if(Number.isFinite(d)&&d>=0&&d<=500)return Math.round(d)}catch{}return 180}),[o,i]=C(()=>{try{return localStorage.getItem("playerVideoDelayEnabled")==="true"}catch{return!1}}),[p,_]=C(!1),[c,h]=C(!1),l=b(null),E=b(null),v=d=>{const N=Math.max(0,Math.min(500,Math.round(d)));s(N);try{localStorage.setItem("playerVideoDelayMs",String(N))}catch{}},L=d=>{i(d),Ye(d)},f=B(()=>{h(!1),_(!1)},[]);return{videoDelayMs:t,videoDelayEnabled:o,setDelayEnabled:L,handleVideoDelayChange:v,isCalibrating:p,testClipActive:c,stopCalibration:f,openAvSyncCalibrator:()=>{l.current={enabled:o,ms:t},i(!0),Ye(!0),n?.(),_(!0)},cancelAvSyncCalibrator:()=>{const d=l.current;l.current=null,d&&(s(d.ms),i(d.enabled),je(d.ms,d.enabled)),h(!1),_(!1)},applyAvSyncCalibrator:()=>{l.current=null,i(!0),je(t,!0),h(!1),_(!1)},toggleTestClip:()=>{if(c){h(!1);return}const d=e.current;d&&!isNaN(d.currentTime)&&(E.current=d.currentTime),h(!0)},calibReturnRef:E,effectiveVideoDelayMs:o?t:0}}function Qs(){const[e,n]=C(()=>{try{return localStorage.getItem("playerTheaterMode")==="true"}catch{return!1}});A(()=>{try{e?document.body.classList.add("theater-mode"):document.body.classList.remove("theater-mode")}catch(o){console.error(o)}return()=>{try{document.body.classList.remove("theater-mode")}catch(o){console.error(o)}}},[e]);const t=B(()=>{n(o=>{const i=!o;try{localStorage.setItem("playerTheaterMode",i.toString())}catch{}return i})},[]),s=B(o=>{if(e&&o.target===o.currentTarget){n(!1);try{localStorage.setItem("playerTheaterMode","false")}catch{}}},[e]);return{isTheaterMode:e,toggleTheaterMode:t,handleLayoutClick:s}}const ne={enabled:!0,blur:60,saturation:150,brightness:70,opacity:60};function rs(){try{const e=localStorage.getItem("playerAmbientLight");if(!e)return ne;const n=JSON.parse(e),t=(s,o,i,p)=>{const _=Number(s);return Number.isFinite(_)?Math.max(i,Math.min(p,_)):o};return{enabled:n.enabled??ne.enabled,blur:t(n.blur,ne.blur,0,120),saturation:t(n.saturation,ne.saturation,0,200),brightness:t(n.brightness,ne.brightness,20,120),opacity:t(n.opacity,ne.opacity,10,100)}}catch{return ne}}function js(){const[e,n]=C(rs),t=B(s=>{n(o=>{const i={...o,...s};try{localStorage.setItem("playerAmbientLight",JSON.stringify(i))}catch{}return i})},[]);return{settings:e,update:t}}const Le=160,Te=90,os=120,Ys=({videoRef:e,active:n,settings:t,className:s})=>{const o=b(null);return A(()=>{if(!n)return;const i=o.current,p=e.current;if(!i||!p)return;const _=i.getContext("2d",{alpha:!1});if(!_)return;let c=0,h=0,l=!1;const E=()=>{if(!(p.readyState<2||!p.videoWidth))try{const f=p.videoWidth,g=p.videoHeight,S=Le/Te,u=f/g;let y=f,d=g,N=0,$=0;u>S?(y=g*S,N=(f-y)/2):(d=f/S,$=(g-d)/2),_.drawImage(p,N,$,y,d,0,0,Le,Te)}catch{}},v=f=>{l||p.paused||(c=requestAnimationFrame(v),!(f-h<os)&&(h=f,E()))},L=()=>{l||(cancelAnimationFrame(c),h=0,c=requestAnimationFrame(v))};return p.addEventListener("play",L),p.addEventListener("seeked",E),p.addEventListener("loadeddata",E),c=requestAnimationFrame(v),()=>{l=!0,cancelAnimationFrame(c),p.removeEventListener("play",L),p.removeEventListener("seeked",E),p.removeEventListener("loadeddata",E)}},[n,e]),n?r("canvas",{ref:o,width:Le,height:Te,"aria-hidden":"true",className:s??Kr.theaterAmbient,style:{filter:`blur(${t.blur}px) saturate(${t.saturation}%) brightness(${t.brightness}%)`,opacity:t.opacity/100}}):null},ss="_row_1fq55_1",as="_rowHeader_1fq55_9",cs="_rowLabel_1fq55_17",is="_rowValue_1fq55_28",ls="_slider_1fq55_36",us="_swatches_1fq55_99",ds="_swatch_1fq55_99",ps="_swatchPicked_1fq55_114",fs="_colorInput_1fq55_120",ms="_segmented_1fq55_131",V={row:ss,rowHeader:as,rowLabel:cs,rowValue:is,slider:ls,swatches:us,swatch:ds,swatchPicked:ps,colorInput:fs,segmented:ms},hs=({label:e,display:n,min:t,max:s,step:o,value:i,percent:p,onChange:_,onCommit:c})=>r("div",{className:V.row,children:[r("div",{className:V.rowHeader,children:[r("span",{className:V.rowLabel,children:e}),r("span",{className:V.rowValue,children:n})]}),r("input",{type:"range",className:V.slider,min:t,max:s,step:o,value:i,"aria-label":e,"data-speed-boost-ignore":"true",onInput:h=>_(Number(h.target.value)),onMouseDown:h=>h.stopPropagation(),onPointerDown:h=>h.stopPropagation(),onTouchStart:h=>h.stopPropagation(),onPointerUp:c,onPointerCancel:c,onTouchEnd:c,onKeyUp:c,onBlur:c,style:{"--slider-percent":`${p}%`}})]}),Zs=({label:e,colors:n,value:t,onChange:s})=>r("div",{className:V.row,children:[r("div",{className:V.rowHeader,children:r("span",{className:V.rowLabel,children:e})}),r("div",{className:V.swatches,children:[n.map(o=>r("button",{type:"button","aria-label":`${e} ${o}`,"aria-pressed":t.toLowerCase()===o.toLowerCase(),onClick:()=>s(o),className:`${V.swatch} ${t.toLowerCase()===o.toLowerCase()?V.swatchPicked:""}`,style:{backgroundColor:o}},o)),r("input",{type:"color","aria-label":`Custom ${e.toLowerCase()}`,className:V.colorInput,value:t,"data-speed-boost-ignore":"true",onInput:o=>s(o.target.value),onMouseDown:o=>o.stopPropagation(),onPointerDown:o=>o.stopPropagation(),onTouchStart:o=>o.stopPropagation()})]})]});function ea({label:e,options:n,value:t,onChange:s}){return r("div",{className:V.row,children:[r("div",{className:V.rowHeader,children:r("span",{className:V.rowLabel,children:e})}),r("div",{className:V.segmented,role:"group","aria-label":e,children:n.map(o=>r("button",{type:"button","aria-pressed":t===o,onClick:()=>s(o),children:[r("span",{children:o}),t===o&&r(Q,{name:"check",size:10})]},o))})]})}const be=10,Ie=500,xe=e=>Math.max(0,Math.min(Ie,Math.round(e))),ta=({isOpen:e,ms:n,onChange:t,onApply:s,onClose:o,testClipActive:i,onTestClip:p})=>e?r("div",{role:"dialog","aria-label":"Calibrate audio video sync","data-speed-boost-ignore":"true",onClick:_=>_.stopPropagation(),style:{position:"absolute",right:8,bottom:112,width:"min(260px, calc(100% - 16px))",maxHeight:"calc(100% - 124px)",overflowY:"auto",overflowX:"hidden",zIndex:60,display:"flex",flexDirection:"column",alignItems:"center",gap:8,padding:12,borderRadius:"var(--radius-lg)",border:"1px solid var(--glass-border)",background:"rgba(18, 18, 22, 0.95)",boxShadow:"var(--glass-shadow)",backdropFilter:"blur(14px)",WebkitBackdropFilter:"blur(14px)",boxSizing:"border-box"},children:[r("div",{style:{fontSize:"0.8rem",fontWeight:800,color:"var(--text-primary)"},children:"A/V sync"}),r("div",{children:r(re,{size:"sm",variant:"secondary",onClick:p,children:i?"Back to video":"Preview test clip"})}),r("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",gap:6,flexWrap:"wrap"},children:[r(re,{size:"sm",onClick:()=>t(xe(n-be)),"aria-label":"Decrease delay by 10 milliseconds",children:["− ",be,"ms"]}),r("div",{style:{fontSize:"1.1rem",fontWeight:800,minWidth:64,textAlign:"center"},children:[n,"ms"]}),r(re,{size:"sm",onClick:()=>t(xe(n+be)),"aria-label":"Increase delay by 10 milliseconds",children:["+ ",be,"ms"]})]}),r(hs,{label:"Video delay",display:`${n}ms`,min:0,max:Ie,step:5,value:n,percent:n/Ie*100,onChange:_=>t(xe(_))}),r("div",{style:{display:"flex",gap:8,justifyContent:"center",flexWrap:"wrap"},children:[r(re,{size:"sm",variant:"secondary",onClick:o,children:"Cancel"}),r(re,{size:"sm",onClick:s,children:["Apply ",n,"ms"]})]})]}):null;export{Ys as A,$s as B,Ds as C,Ls as D,Us as E,ws as F,Ss as G,Zs as H,Ms as I,ea as J,Z as K,ne as L,hs as M,Ws as P,Rs as R,qs as S,Ps as T,Hs as U,Vs as a,Os as b,Js as c,Xs as d,Qs as e,Es as f,Gs as g,js as h,no as i,xs as j,As as k,Cs as l,Bs as m,Fs as n,Is as o,Ts as p,Kr as q,Ns as r,ao as s,qo as t,Ks as u,bs as v,ae as w,ta as x,zs as y,ks as z};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{u as e,S as s,d as y,h as g}from"./vendor-core-DfaOB3Rn.js";import{I as p}from"./vendor-icons-DrybRNxP.js";import{M as l,H as m,T as S,I as f,J as k,K as x,L as N}from"./AvSyncCalibrator-CuSfq8JX.js";const C=({classes:o,title:t,titleTag:i="span",showBack:a=!0,onBack:n,panelRef:b,onPanelClick:r,children:c})=>{const d=i;return e("div",{ref:b,className:o.panel,onClick:r,"data-speed-boost-ignore":"true",children:[e("div",{className:o.header,children:[a&&e("button",{className:o.backBtn,onClick:n,children:e(p,{name:"chevron-left"})}),e(d,{className:o.title||void 0,children:t})]}),e("div",{className:o.content,children:c})]})},$=({classes:o,values:t,onChange:i})=>{const a=()=>{const n=x;i("fontSize",n.fontSize),i("position",n.position),i("bgOpacity",n.bgOpacity),i("bgColor",n.bgColor),i("textColor",n.textColor),i("edge",n.edge),i("bold",n.bold)};return e(s,{children:[e(l,{label:"Font Size",display:t.fontSize.toFixed(1),min:.5,max:10,step:.5,value:t.fontSize,percent:(t.fontSize-.5)/9.5*100,onChange:n=>{Number.isFinite(n)&&i("fontSize",n)}}),e(l,{label:"Vertical Position",display:`${t.position}`,min:0,max:100,step:1,value:t.position,percent:t.position,onChange:n=>{Number.isFinite(n)&&i("position",Math.round(n))}}),e(l,{label:"Background Opacity",display:`${Math.round(t.bgOpacity*100)}%`,min:0,max:1,step:.05,value:t.bgOpacity,percent:t.bgOpacity*100,onChange:n=>{Number.isFinite(n)&&i("bgOpacity",n)}}),e(m,{label:"Text Color",colors:S,value:t.textColor,onChange:n=>i("textColor",n)}),e(m,{label:"Background Color",colors:f,value:t.bgColor,onChange:n=>i("bgColor",n)}),e(k,{label:"Text Edge",options:["shadow","outline","none"],value:t.edge,onChange:n=>i("edge",n)}),e("button",{type:"button",className:`${o.item} ${t.bold?o.active:""}`,onClick:()=>i("bold",!t.bold),children:[e("span",{children:"Bold Text"}),t.bold&&e(p,{name:"check",size:12})]}),e("button",{type:"button",className:o.item,onClick:a,children:e("span",{children:"Reset to Defaults"})})]})},z=({classes:o,enabled:t,delayMs:i,onToggle:a,onDelayChange:n,onCalibrate:b})=>{const[r,c]=y(null),d=r??i;g(()=>{c(null)},[i]);const h=()=>{r!==null&&(n(r),c(null))};return e(s,{children:[e("button",{type:"button",className:`${o.item} ${t?o.active:""}`,onClick:()=>a(!t),children:[e("span",{children:"Video delay"}),t&&e(p,{name:"check",size:12})]}),e(l,{label:"Video delay",display:`${d}ms`,min:0,max:500,step:5,value:d,percent:d/500*100,onChange:u=>c(Math.round(u)),onCommit:h}),e("div",{className:o.note,children:"For Bluetooth headsets where audio arrives late. Video is held back via canvas; audio plays untouched."}),b&&e("button",{type:"button",className:o.item,onClick:b,children:e("span",{children:"Calibrate…"})})]})},E=({classes:o,values:t,onChange:i})=>e(s,{children:[e("button",{type:"button",className:`${o.item} ${t.enabled?o.active:""}`,onClick:()=>i({enabled:!t.enabled}),"aria-pressed":t.enabled,children:[e("span",{children:"Ambient light"}),e("span",{style:{display:"flex",alignItems:"center",gap:6},children:[t.enabled?"On":"Off",t.enabled&&e(p,{name:"check",size:12})]})]}),e(l,{label:"Blur",display:`${t.blur}px`,min:0,max:120,step:2,value:t.blur,percent:t.blur/120*100,onChange:a=>i({blur:Math.round(a)})}),e(l,{label:"Saturation",display:`${t.saturation}%`,min:0,max:200,step:5,value:t.saturation,percent:t.saturation/200*100,onChange:a=>i({saturation:Math.round(a)})}),e(l,{label:"Brightness",display:`${t.brightness}%`,min:20,max:120,step:5,value:t.brightness,percent:(t.brightness-20)/100*100,onChange:a=>i({brightness:Math.round(a)})}),e(l,{label:"Opacity",display:`${t.opacity}%`,min:10,max:100,step:5,value:t.opacity,percent:(t.opacity-10)/90*100,onChange:a=>i({opacity:Math.round(a)})}),e("div",{className:o.note,children:"Mirrors the video onto the backdrop behind the player. Turn off for pure black."}),e("button",{type:"button",className:o.item,onClick:()=>i({...N}),children:e("span",{children:"Reset to defaults"})})]}),B=({classes:o,options:t,onSelect:i})=>e(s,{children:t.map(a=>e("button",{type:"button",className:`${o.item} ${a.selected?o.active:""}`,onClick:()=>i(a.key),children:[e("span",{children:a.label}),a.selected&&e(p,{name:"check",size:12})]},a.key))});export{z as A,B as O,C as S,$ as a,E as b};
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import{u as t,d as k,A as B,h as S,S as Oe,o as $r,p as Or,a as Dr,T as $e,q as C}from"./vendor-core-DfaOB3Rn.js";import{u as Fr}from"./vendor-query-BBT5_sHx.js";import{g as dn,e as jr,t as St,z as Vr,O as zr,M as Nn,B as Ke}from"./index-mwdRstuO.js";import{I as $}from"./vendor-icons-DrybRNxP.js";import{S as Wr,U as Hr,p as Pn,M as Ur,B as ir,k as An,j as Kr,C as qr,a as Yr,b as Qr,u as Gr,c as Xr,d as Jr,h as Zr,e as es,g as ts,l as ns,z as rs,i as In,D as ss,F as as,G as sr,s as Bn,m as os,n as is,o as ls,r as cs,q as Ze,A as ds,t as us,E as ms,x as hs,P as ps,v as ke,y as gs,R as fs}from"./AvSyncCalibrator-CuSfq8JX.js";import{S as vs,O as ln,a as bs,A as ys,b as _s}from"./OptionListMenu-C6gay-Rv.js";import{u as Ss}from"./useProviders-B-x6Wq6v.js";import{d as Cs,g as Ts,h as ks,f as Es,e as xs,j as Ns,k as Is}from"./useTvLibrary-DDW03W6A.js";import{l as Bs,c as ws}from"./hls-hQKRlWEn.js";import{u as Ps}from"./useIsMobile-Dvx1uJ82.js";import{S as As}from"./SynopsisText-B3Sa5pRv.js";const Ms="_fullscreenFlat_1xij1_1",Ls="_timeDisplay_1xij1_15",Rs="_bottomControls_1xij1_19",$s="_leftControls_1xij1_23",Os="_rightControls_1xij1_24",Ds="_controlBtn_1xij1_28",Fs="_controlsOverlay_1xij1_47",js="_hidden_1xij1_67",Vs="_topControls_1xij1_73",zs="_backBtn_1xij1_93",Ws="_videoTitleInfo_1xij1_113",Hs="_animeTitle_1xij1_119",Us="_episodeLabel_1xij1_127",Ks="_speedBoostBadge_1xij1_134",qs="_progressBarContainer_1xij1_180",Ys="_progressBar_1xij1_180",Qs="_thumb_1xij1_199",Gs="_bufferedBar_1xij1_217",Xs="_watchedBar_1xij1_227",Js="_scrubbing_1xij1_252",Zs="_timeBubble_1xij1_256",ea="_bottomControlsRow_1xij1_270",ta="_nextEpisodeBtn_1xij1_293",na="_active_1xij1_346",ra="_settingsPanel_1xij1_421",sa="_settingsHeader_1xij1_440",aa="_settingsBackBtn_1xij1_448",oa="_settingsTitle_1xij1_466",ia="_settingsContent_1xij1_477",la="_currentValue_1xij1_486",ca="_menuItem_1xij1_501",da="_menuNote_1xij1_534",ua="_loadingOverlay_1xij1_547",ma="_loadingDots_1xij1_558",ha="_dot_1xij1_563",pa="_bufferingOverlay_1xij1_592",ga="_bufferingSpinner_1xij1_601",a={fullscreenFlat:Ms,timeDisplay:Ls,bottomControls:Rs,leftControls:$s,rightControls:Os,controlBtn:Ds,controlsOverlay:Fs,hidden:js,topControls:Vs,backBtn:zs,videoTitleInfo:Ws,animeTitle:Hs,episodeLabel:Us,speedBoostBadge:Ks,progressBarContainer:qs,progressBar:Ys,thumb:Qs,bufferedBar:Gs,watchedBar:Xs,scrubbing:Js,timeBubble:Zs,bottomControlsRow:ea,nextEpisodeBtn:ta,active:na,settingsPanel:ra,settingsHeader:sa,settingsBackBtn:aa,settingsTitle:oa,settingsContent:ia,currentValue:la,menuItem:ca,menuNote:da,loadingOverlay:ua,loadingDots:ma,dot:ha,bufferingOverlay:pa,bufferingSpinner:ga},fa=({player:o,visible:g,settingsOpen:D,onOpenSettings:F,onCloseSettings:H,hasSubtitles:T,isSubtitleActive:r,subtitles:I,onSubtitleChange:i,showNextEpisodeButton:ee,onNextEpisode:Y,isTheaterMode:P,onTheaterModeToggle:u,timeLabelRef:q})=>{const{state:m,refs:De,actions:A}=o,j=De.videoRef,Ne=L=>{const te=j.current;!te||isNaN(m.duration)||m.duration===0||(te.currentTime=L*m.duration)},Fe=()=>{j.current&&(A.setIsScrubbing(!0),A.wasPlayingBeforeScrub.current=!j.current.paused,j.current.pause())},je=L=>{const te=j.current;te&&m.duration&&(te.currentTime=L*m.duration)},et=()=>{A.setIsScrubbing(!1),A.wasPlayingBeforeScrub.current&&j.current?.play().catch(()=>{})},qe=L=>{const te=j.current;te&&(te.volume=L,te.muted=L===0)},Ye=()=>{if(r){i(-1);return}let L=null;try{L=localStorage.getItem("tvLastSubtitle")}catch{}i(Pn(I,{lastKey:L,enabled:!0}))},Q=m.isMuted?t($,{name:"volume-mute"}):m.volume<.5?t($,{name:"volume-down"}):t($,{name:"volume-up"});return t("div",{className:`${a.controlsOverlay} ${g?"":a.hidden}`,"data-speed-boost-ignore":"true",style:{pointerEvents:"none",background:"none",justifyContent:"flex-end"},children:t("div",{className:a.bottomControls,onClick:L=>L.stopPropagation(),children:[t(Wr,{classes:{container:a.progressBarContainer,scrubbing:a.scrubbing,timeBubble:a.timeBubble,bar:a.progressBar,buffered:a.bufferedBar,watched:a.watchedBar,thumb:a.thumb},videoRef:j,duration:m.duration,formatTime:dn,isScrubbing:m.isScrubbing,buffered:"full",onSeek:Ne,onScrubStart:Fe,onScrubMove:je,onScrubEnd:et,timeLabelRef:q}),t("div",{className:a.bottomControlsRow,children:[t("div",{className:a.leftControls,children:[t("button",{className:a.controlBtn,onClick:A.togglePlay,"aria-label":m.isPlaying?"Pause":"Play",children:m.isPlaying?t($,{name:"pause"}):t($,{name:"play"})}),t(Hr,{muted:m.isMuted,volume:m.volume,volumeIcon:Q,buttonClassName:a.controlBtn,onToggleMute:A.toggleMute,onVolumeChange:qe,onExpandedChange:L=>A.setShowVolumeSlider(L)}),t("span",{className:a.timeDisplay,ref:q,children:[dn(0)," / ",dn(m.duration)]})]}),t("div",{className:a.rightControls,children:[ee&&t("button",{className:a.nextEpisodeBtn,onClick:Y,title:"Play next episode",children:"Next EP"}),T&&t("button",{className:`${a.controlBtn} ${r?a.active:""}`,onClick:Ye,"aria-label":r?"Turn subtitles off":"Turn subtitles on",children:t($,{name:"closed-captioning"})}),t("button",{className:`${a.controlBtn} ${D?a.active:""}`,onClick:()=>D?H():F(),"aria-label":"Settings",children:t($,{name:"cog"})}),t("button",{className:`${a.controlBtn} ${P?a.active:""}`,onClick:L=>{L.stopPropagation(),u()},title:P?"Exit Theater Mode":"Theater Mode","aria-label":P?"Exit Theater Mode":"Theater Mode",children:t($,{name:"tv"})}),t("button",{className:a.controlBtn,onClick:A.toggleFullscreen,"aria-label":m.isFullscreen?"Exit Fullscreen":"Fullscreen",children:m.isFullscreen?t($,{name:"compress"}):t($,{name:"expand"})})]})]})]})})},cn=-6e4,wn=6e4,ar=500,va=({classes:o,delayMs:g,onDelayChange:D})=>{const[F,H]=k(null),T=F??g,r=B(D);r.current=D;const I=B(g);I.current=g;const i=B(null);i.current=F,S(()=>{H(null)},[g]),S(()=>()=>{const P=i.current;P!==null&&P!==I.current&&r.current(P)},[]);const ee=P=>{I.current=P,i.current=null,r.current(P),H(null)},Y=P=>{const u=i.current??I.current,q=Math.max(cn,Math.min(wn,u+P));ee(q)};return t(Oe,{children:[t("div",{style:{display:"flex",gap:6,padding:"0.5rem 0.75rem 0.25rem"},children:[t("button",{type:"button",className:o.item,onClick:()=>Y(-ar),"aria-label":"Show subtitles 0.5 seconds earlier",style:{flex:1,justifyContent:"center"},children:t("span",{children:"-0.5s"})}),t("button",{type:"button",className:o.item,onClick:()=>Y(ar),"aria-label":"Show subtitles 0.5 seconds later",style:{flex:1,justifyContent:"center"},children:t("span",{children:"+0.5s"})}),t("button",{type:"button",className:o.item,onClick:()=>ee(0),disabled:T===0,"aria-label":"Reset subtitle timing",style:{flex:1,justifyContent:"center"},children:t("span",{children:"Reset"})})]}),t(Ur,{label:"Subtitle timing",display:ir(T),min:cn,max:wn,step:100,value:T,percent:(T-cn)/(wn-cn)*100,onChange:P=>{const u=Math.round(P);i.current=u,H(u)},onCommit:()=>{const P=i.current;P!==null&&ee(P)}}),t("div",{className:o.note,children:"Positive delays subtitles (show later). Negative shows them earlier. 0.0s is default."})]})},ba=({view:o,onSelectView:g,onClose:D,player:F,onSubtitleStyleChange:H,streams:T,qualityIdx:r,onQualityChange:I,isMovySource:i,movyServers:ee,selectedMovyServer:Y,onMovyServerSelect:P,hasSubtitles:u,subtitles:q,selectedSubtitle:m,isSubtitleActive:De,onSubtitleChange:A,audioTracks:j,selectedAudioTrack:Ne,onAudioTrackChange:Fe,videoDelayEnabled:je,onVideoDelayToggle:et,videoDelayMs:qe,onVideoDelayChange:Ye,onCalibrate:Q,subtitleDelayMs:L,onSubtitleDelayChange:te,ambientSettings:me,onAmbientChange:Se})=>{const{state:U}=F,G=()=>t(Oe,{children:[T.length>1&&t("button",{className:a.menuItem,onClick:()=>g("quality"),children:[t("span",{children:"Quality"}),t("span",{className:a.currentValue,children:T[r]?.quality||"Auto"})]}),i&&ee.length>0&&t("button",{className:a.menuItem,onClick:()=>g("server"),children:[t("span",{style:{display:"flex",alignItems:"center",gap:6},children:[t($,{name:"server",size:12})," Movy Server"]}),t("span",{className:a.currentValue,style:{textTransform:"capitalize"},children:Y})]}),u&&t("button",{className:a.menuItem,onClick:()=>g("subtitles"),children:[t("span",{children:"Subtitles"}),t("span",{className:a.currentValue,children:De?q[m]?.label||q[m]?.language:"Off"})]}),u&&t("button",{className:a.menuItem,onClick:()=>g("subtitle-style"),children:[t("span",{children:"Subtitle Style"}),t("span",{className:a.currentValue,children:[U.subtitleFontSize.toFixed(1),"x · ",U.subtitlePosition]})]}),u&&t("button",{className:a.menuItem,onClick:()=>g("subtitle-timing"),children:[t("span",{children:"Subtitle Timing"}),t("span",{className:a.currentValue,children:ir(L)})]}),j.length>0&&t("button",{className:a.menuItem,onClick:()=>g("audio"),children:[t("span",{children:"Audio Track"}),t("span",{className:a.currentValue,children:j[Ne]?.label||j[Ne]?.language})]}),t("button",{className:a.menuItem,onClick:()=>g("av-sync"),children:[t("span",{children:"A/V Sync"}),t("span",{className:a.currentValue,children:je?`${qe}ms`:"Off"})]}),me&&Se&&t("button",{className:a.menuItem,onClick:()=>g("ambient"),children:[t("span",{children:"Ambient Light"}),t("span",{className:a.currentValue,children:me.enabled?"On":"Off"})]})]}),ht=()=>t(ln,{classes:{item:a.menuItem,active:a.active},options:T.map((b,ne)=>({key:String(ne),label:b.quality,selected:ne===r})),onSelect:b=>I(Number(b))}),he=()=>t(ln,{classes:{item:a.menuItem,active:a.active},options:[{key:"off",label:"Off",selected:!De},...q.map((b,ne)=>({key:String(ne),label:b.label||b.language,selected:ne===m}))],onSelect:b=>A(b==="off"?-1:Number(b))}),Ie=()=>t(bs,{classes:{item:a.menuItem,active:a.active},values:{fontSize:U.subtitleFontSize,position:U.subtitlePosition,bgOpacity:U.subtitleBgOpacity,bgColor:U.subtitleBgColor,textColor:U.subtitleTextColor,edge:U.subtitleEdge,bold:U.subtitleBold},onChange:H}),X=()=>t(va,{classes:{item:a.menuItem,active:a.active,note:a.menuNote},delayMs:L,onDelayChange:b=>te?.(b)}),oe=()=>t(ln,{classes:{item:a.menuItem,active:a.active},options:j.map((b,ne)=>({key:String(ne),label:b.label||b.language,selected:ne===Ne})),onSelect:b=>Fe(Number(b))}),Ve=()=>t(ln,{classes:{item:a.menuItem,active:a.active},options:ee.map(b=>({key:b,label:t("span",{style:{textTransform:"capitalize"},children:b}),selected:Y===b})),onSelect:b=>P?.(b)}),J=()=>t(ys,{classes:{item:a.menuItem,active:a.active,note:a.menuNote},enabled:je,delayMs:qe,onToggle:b=>et?.(b),onDelayChange:b=>Ye?.(b),onCalibrate:Q}),Ee=()=>me&&Se?t(_s,{classes:{item:a.menuItem,active:a.active,note:a.menuNote},values:me,onChange:Se}):null;return t("div",{"data-speed-boost-ignore":"true",onClick:b=>b.stopPropagation(),children:t(vs,{classes:{panel:a.settingsPanel,header:a.settingsHeader,backBtn:a.settingsBackBtn,title:a.settingsTitle,content:a.settingsContent},title:o==="main"?"Settings":o==="subtitle-style"?"Subtitle Style":o==="subtitle-timing"?"Subtitle Timing":o==="audio"?"Audio Track":o==="server"?"Movy Server":o==="av-sync"?"A/V Sync":o==="ambient"?"Ambient Light":o.charAt(0).toUpperCase()+o.slice(1),onBack:()=>o==="main"?D():g("main"),children:[o==="main"&&G(),o==="quality"&&ht(),o==="subtitles"&&he(),o==="subtitle-style"&&Ie(),o==="subtitle-timing"&&X(),o==="audio"&&oe(),o==="server"&&Ve(),o==="av-sync"&&J(),o==="ambient"&&Ee()]})})},ya=({player:o,title:g,episodeLabel:D,audioTracks:F,selectedAudioTrack:H,onAudioTrackChange:T,subtitles:r,selectedSubtitle:I,onSubtitleChange:i,streams:ee,qualityIdx:Y,onQualityChange:P,onBack:u,children:q,movyServers:m=[],selectedMovyServer:De="atlanta",onMovyServerSelect:A,isMovySource:j=!1,videoDelayEnabled:Ne=!1,onVideoDelayToggle:Fe,videoDelayMs:je=0,onVideoDelayChange:et,onCalibrateAvSync:qe,subtitleDelayMs:Ye=0,onSubtitleDelayChange:Q,showNextEpisodeButton:L=!1,onNextEpisode:te,isLoading:me=!1,isTheaterMode:Se,onTheaterModeToggle:U,ambientSettings:G,onAmbientChange:ht})=>{const{state:he,refs:Ie,actions:X}=o,oe=Ie.videoRef,{subtitleFontSize:Ve,subtitlePosition:J,subtitleBgOpacity:Ee,subtitleBgColor:b,subtitleTextColor:ne,subtitleEdge:tt,subtitleBold:Dt}=he,[ze,Be]=k(null),pe=B(null),[Ct,Tt]=k(0);S(()=>{const ge=oe.current;if(!ge)return;const _=()=>Tt(ge.clientHeight||0);_();const nt=new ResizeObserver(_);return nt.observe(ge),()=>nt.disconnect()},[oe,ee]);const E=(ge,_)=>{try{localStorage.setItem(ge,String(_))}catch{}},ie=(ge,_)=>{switch(ge){case"fontSize":typeof _=="number"&&(X.setSubtitleFontSize(_),E("subtitleFontSize",_));break;case"position":typeof _=="number"&&(X.setSubtitlePosition(_),E("subtitlePosition",_));break;case"bgOpacity":typeof _=="number"&&(X.setSubtitleBgOpacity(_),E("subtitleBgOpacity",_));break;case"bgColor":typeof _=="string"&&(X.setSubtitleBgColor(_),E("subtitleBgColor",_));break;case"textColor":typeof _=="string"&&(X.setSubtitleTextColor(_),E("subtitleTextColor",_));break;case"edge":(_==="shadow"||_==="outline"||_==="none")&&(X.setSubtitleEdge(_),E("subtitleEdge",_));break;case"bold":typeof _=="boolean"&&(X.setSubtitleBold(_),E("subtitleBold",_));break}};S(()=>{const ge="tv-player-subtitle-style";let _=document.getElementById(ge);_||(_=document.createElement("style"),_.id=ge,document.head.appendChild(_));const nt={fontSize:Ve,position:J,bgOpacity:Ee,bgColor:b,textColor:ne,edge:tt,bold:Dt},le=oe.current,xe=An(Ve,Ct||le?.clientHeight||720);if(_.textContent=Kr({...nt,fontSize:xe}),le){const Nt=()=>{const x=Number(J);return isNaN(x)?0:Math.max(0,Math.min(100,x))},It=(x,re)=>{try{const se=x;se.snapToLines=!1,se.line=re}catch{}},un=()=>{const x=xe*16,re=le.videoHeight||le.clientHeight||720,se=le.videoWidth||le.clientWidth||1280;return{step:x*1.3/re*100,chars:Math.max(20,Math.floor(se/(x*.55)))}},zt=x=>{const re=Math.max(0,Math.min(100,100-Nt())),se=Array.from(x.activeCues??[]);if(se.length<=1){se.forEach(we=>It(we,re));return}const{step:de,chars:wt}=un();let Ht=re;for(let we=se.length-1;we>=0;we--){const rt=String(se[we].text??"").replace(/<[^>]*>/g,"").split(`
|
|
2
|
-
`).reduce((st,h)=>st+Math.max(1,Math.ceil(h.length/wt)),0),Kt=Ht-rt*de;It(se[we],Math.max(0,Kt)),Ht=Kt-de*.4}},Bt=()=>{const x=Math.max(0,Math.min(100,100-Nt()));Array.from(le.textTracks).forEach(re=>{re.cues&&(Array.from(re.cues).forEach(se=>It(se,x)),re.mode==="showing"&&zt(re))})};Bt();const ce=x=>{const re=x.target;re.mode==="showing"&&zt(re)},pt=()=>{Array.from(le.textTracks).forEach(x=>{x.removeEventListener("cuechange",ce),x.addEventListener("cuechange",ce)}),Bt()};Array.from(le.textTracks).forEach(x=>{x.addEventListener("cuechange",ce)}),le.textTracks.addEventListener("addtrack",pt);const We=Array.from(le.querySelectorAll("track")),Wt=()=>Bt();return We.forEach(x=>x.addEventListener("load",Wt)),()=>{Array.from(le.textTracks).forEach(x=>{x.removeEventListener("cuechange",ce)}),le.textTracks.removeEventListener("addtrack",pt),We.forEach(x=>x.removeEventListener("load",Wt))}}},[Ve,J,Ee,b,ne,tt,Dt,I,r,oe,Ct]);const kt=r.length>0,Et=I>=0,xt=()=>{Be("main"),X.setShowControls(!0)},y=()=>{Be(null)},l=he.showControls||!!ze,fe=t(Qr,{visible:l,title:g,episode:D,onBack:u,classes:{overlay:a.controlsOverlay,hidden:a.hidden,top:a.topControls,backBtn:a.backBtn,titleInfo:a.videoTitleInfo,title:a.animeTitle,episode:a.episodeLabel}}),ve=!me&&!he.isBuffering&&he.duration>0?t(qr,{isPlaying:he.isPlaying,onTogglePlay:X.togglePlay,onSkipBack:()=>X.seek(-10),onSkipForward:()=>X.seek(10)}):null,Ft=t(fa,{player:o,visible:l,settingsOpen:!!ze,onOpenSettings:xt,onCloseSettings:y,hasSubtitles:kt,isSubtitleActive:Et,subtitles:r,onSubtitleChange:i,showNextEpisodeButton:L,onNextEpisode:te,isTheaterMode:Se,onTheaterModeToggle:U,timeLabelRef:pe}),jt=ze?t(ba,{view:ze,onSelectView:Be,onClose:y,player:o,onSubtitleStyleChange:ie,streams:ee,qualityIdx:Y,onQualityChange:P,isMovySource:j,movyServers:m,selectedMovyServer:De,onMovyServerSelect:A,hasSubtitles:kt,subtitles:r,selectedSubtitle:I,isSubtitleActive:Et,onSubtitleChange:i,audioTracks:F,selectedAudioTrack:H,onAudioTrackChange:T,videoDelayEnabled:Ne,onVideoDelayToggle:Fe,videoDelayMs:je,onVideoDelayChange:et,onCalibrate:()=>{Be(null),qe?.()},subtitleDelayMs:Ye,onSubtitleDelayChange:Q,ambientSettings:G,onAmbientChange:ht}):null,Vt=t(Oe,{children:[me&&t("div",{className:a.loadingOverlay,"aria-hidden":"true",children:t("div",{className:a.loadingDots,children:[t("div",{className:a.dot}),t("div",{className:a.dot}),t("div",{className:a.dot})]})}),he.isBuffering&&!me&&t("div",{className:a.bufferingOverlay,"aria-hidden":"true",children:t("div",{className:a.bufferingSpinner})}),he.isSpeedBoostActive&&t("div",{className:a.speedBoostBadge,"aria-hidden":"true",children:[t("span",{children:"2x"}),t($,{name:"forward",size:12})]})]});return t(Yr,{player:o,topBar:fe,centerControls:ve,bottomBar:!me&&he.duration>0?Ft:null,settingsPanel:jt,overlays:Vt,isInteracting:!!ze,className:he.isFullscreen?a.fullscreenFlat:"",children:q})};function _a(o,g,D){const F=()=>{const T=Array.isArray(o.audioTracks)?o.audioTracks.length:0,r=D.getWant(),I=T>0?Math.min(Math.max(0,r),T-1):r;o.audioTrack=I,I!==r&&D.onResolve(I)},H=(T,r)=>{const I=D.getWant(),i=Array.isArray(o.audioTracks)?o.audioTracks.length:0;if(r.id!==I&&I>=0&&I<i){o.audioTrack!==I&&(o.audioTrack=I);return}D.onResolve(r.id)};return o.on(g.MANIFEST_PARSED,F),o.on(g.AUDIO_TRACK_SWITCHED,H),()=>{o.off(g.MANIFEST_PARSED,F),o.off(g.AUDIO_TRACK_SWITCHED,H)}}const Sa="_page_263ma_1",Ca="_header_263ma_7",Ta="_pageTitle_263ma_11",ka="_searchForm_263ma_21",Ea="_searchInput_263ma_27",xa="_searchBtn_263ma_42",Na="_suggestions_263ma_58",Ia="_suggestionPill_263ma_65",Ba="_statusMsg_263ma_81",wa="_error_263ma_87",Pa="_textOnly_263ma_91",Aa="_spinner_263ma_96",Ma="_spin_263ma_96",La="_grid_263ma_110",Ra="_skeletonCard_263ma_116",$a="_skeletonThumb_263ma_121",Oa="_skeletonLine_263ma_127",Da="_shimmer_263ma_134",Fa="_backBtn_263ma_154",ja="_meta_263ma_172",Va="_headerActions_263ma_180",za="_watchlistBtn_263ma_187",Wa="_active_263ma_205",Ha="_year_263ma_215",Ua="_rating_263ma_220",Ka="_typeBadge_263ma_229",qa="_tv_263ma_237",Ya="_movie_263ma_242",Qa="_tvSeries_263ma_247",Ga="_tvMiniSeries_263ma_252",Xa="_overview_263ma_257",Ja="_controls_263ma_264",Za="_controlLabel_263ma_272",eo="_select_263ma_282",to="_playerSection_263ma_293",no="_video_263ma_297",ro="_videoHidden_263ma_319",so="_delayCanvas_263ma_324",ao="_delayCanvasActive_263ma_337",oo="_subtitleOverlay_263ma_341",io="_videoIframe_263ma_360",lo="_retryButton_263ma_368",co="_sidebarSeason_263ma_383",uo="_mobileSeasonRow_263ma_399",mo="_sidebarPosterCard_263ma_413",ho="_sidebarPosterMeta_263ma_428",po="_providerSelectWrap_263ma_445",go="_genreRow_263ma_457",fo="_genreChip_263ma_464",vo="_metaRow_263ma_474",bo="_detailGrid_263ma_483",yo="_detailItem_263ma_490",_o="_imdbLink_263ma_512",v={page:Sa,header:Ca,pageTitle:Ta,searchForm:ka,searchInput:Ea,searchBtn:xa,suggestions:Na,suggestionPill:Ia,statusMsg:Ba,error:wa,textOnly:Pa,spinner:Aa,spin:Ma,grid:La,skeletonCard:Ra,skeletonThumb:$a,skeletonLine:Oa,shimmer:Da,backBtn:Fa,meta:ja,headerActions:Va,watchlistBtn:za,active:Wa,year:Ha,rating:Ua,typeBadge:Ka,tv:qa,movie:Ya,tvSeries:Qa,tvMiniSeries:Ga,overview:Xa,controls:Ja,controlLabel:Za,select:eo,playerSection:to,video:no,videoHidden:ro,delayCanvas:so,delayCanvasActive:ao,subtitleOverlay:oo,videoIframe:io,retryButton:lo,sidebarSeason:co,mobileSeasonRow:uo,sidebarPosterCard:mo,sidebarPosterMeta:ho,providerSelectWrap:po,genreRow:go,genreChip:fo,metaRow:vo,detailGrid:bo,detailItem:yo,imdbLink:_o},So=[],Co=[];function or({error:o,servers:g,selectedServer:D,onRetry:F,onSelect:H}){return t("div",{className:`${v.statusMsg} ${v.error}`,style:{flexDirection:"column",alignItems:"stretch",gap:8},children:[t("div",{style:{display:"flex",alignItems:"center",gap:8,flexWrap:"wrap"},children:[t("span",{style:{flex:1},children:o}),t("button",{className:v.retryButton,onClick:F,children:"Retry"})]}),g.length>0&&t("div",{style:{display:"flex",flexWrap:"wrap",gap:6,alignItems:"center",marginTop:4},children:[t("span",{style:{fontSize:"0.8rem",opacity:.9,fontWeight:600},children:"Servers:"}),g.map(T=>t("button",{onClick:()=>H(T),className:v.retryButton,style:{padding:"4px 8px",fontSize:"0.75rem",textTransform:"capitalize",background:D===T?"var(--accent)":void 0,color:D===T?"white":void 0},children:T},T))]})]})}const Ro=()=>{const{id:o}=$r(),[g]=Or(),D=B(g);D.current=g;const F=Dr(),H=Fr(),T=g.get("type"),[r,I]=k(null),[i,ee]=k(()=>parseInt(g.get("s")||"1",10)||1),[Y,P]=k([]),[u,q]=k(()=>parseInt(g.get("e")||"1",10)||1),[m,De]=k(()=>{try{return localStorage.getItem("tvProvider")||""}catch{return""}}),[A,j]=k([]),[Ne,Fe]=k(""),{options:je,isFallback:et,isLoading:qe}=Ss(),Ye=$e(()=>je.filter(e=>(e.kind??"tv")==="tv").map(e=>({id:e.value,label:e.label,tier:e.tier==="embed"?"embed":"direct",servers:e.servers})),[je]),Q=et||Ye.length===0?So:Ye,L=Q.filter(e=>e.tier==="direct"),te=Q.filter(e=>e.tier==="embed"),[me,Se]=k(!1),[U,G]=k(""),[ht,he]=k([]),[Ie,X]=k(0),[oe,Ve]=k([]),[J,Ee]=k(-1),[b,ne]=k(0),[tt,Dt]=k(""),[ze,Be]=k(""),[pe,Ct]=k(()=>{try{return localStorage.getItem("movyServer")||""}catch{return""}}),Tt=$e(()=>Q.find(e=>e.id===m),[Q,m]),E=Tt?.tier==="embed",ie=$e(()=>Tt?.servers??[],[Tt]),kt=B([]);S(()=>{kt.current=A},[A]);const Et=B(Ie);S(()=>{Et.current=Ie},[Ie]);const xt=B(J);S(()=>{xt.current=J},[J]);const y=Gr({skipIntervals:Co}),l=y.refs.videoRef,fe=B(null),ve=B([]),Ft=B(null),jt=B(null),{videoDelayMs:Vt,videoDelayEnabled:ge,setDelayEnabled:_,handleVideoDelayChange:nt,isCalibrating:le,testClipActive:xe,stopCalibration:Nt,openAvSyncCalibrator:It,cancelAvSyncCalibrator:un,applyAvSyncCalibrator:zt,toggleTestClip:Bt,calibReturnRef:ce,effectiveVideoDelayMs:pt}=Xr(l),[We,Wt]=k(()=>{try{const e=Number(localStorage.getItem("tvSubtitleDelayMs"));if(Number.isFinite(e)&&e>=-6e4&&e<=6e4)return Math.round(e)}catch{}return 0}),x=B(We);x.current=We;const re=C(e=>{const n=Math.max(-6e4,Math.min(6e4,Math.round(e)));if(x.current!==n){x.current=n,Wt(n);try{localStorage.setItem("tvSubtitleDelayMs",String(n))}catch{}}},[]);Jr({videoRef:l,canvasRef:Ft,delayMs:pt,enabled:ge});const se=ge,de=se||We!==0,{settings:wt,update:Ht}=Zr(),we=B(de);we.current=de;const Ut=C(()=>{if(!we.current)return;const e=l.current;e&&Array.from(e.textTracks).forEach(n=>{n.mode!=="hidden"&&(n.mode="hidden")})},[l]),{hasConsent:rt,grant:Kt}=jr(),st=B("");st.current||(st.current=`tv-${Date.now()}-${Math.random().toString(36).slice(2)}`);const h=T==="movie",qt=o?Cs(T||"tv",o):"",V=qt,Mn=Ts(),Yt=ks(),{toggle:Ln,bookmarkedIds:lr,pending:cr}=Es(),{data:Rn}=xs(r?qt:void 0),Qt=Rn?!!Rn.inLibrary:qt?lr.has(qt):!1,dr=C(()=>{!r||!o||Ln({tmdbId:Number(o),mediaType:T||"tv",title:r.title,poster:r.poster,year:r.year,adult:r.adult})},[r,o,T,Ln]),{data:at,isFetched:$n,isPending:On}=Ns(V||void 0,i,u),Gt=$e(()=>Y.map(e=>e.episode_number).sort((e,n)=>e-n),[Y]),ot=Gt.indexOf(u),mn=ot>0?Gt[ot-1]:null,N=ot>=0&&ot<Gt.length-1?Gt[ot+1]:null,Xt=$e(()=>(r?.seasons??[]).map(e=>e.season_number).filter(e=>Number.isFinite(e)).sort((e,n)=>e-n),[r]),Ce=$e(()=>{if(h||N!=null)return null;const e=Xt.indexOf(i);return e>=0&&e<Xt.length-1?Xt[e+1]:(r?.number_of_seasons??0)>i?i+1:null},[h,N,Xt,i,r?.number_of_seasons]),Dn=at?.currentTime??0,Fn=at?.duration??0,hn=at?.completed===!0||at?.completed===1||In(Dn,Fn),[Pe,He]=k(!1),Ae=B(!1),pn=B(null),Pt=B(null);S(()=>{Ae.current=!1,Pt.current=null,He(!1)},[V,i,u]);const[Me,Jt]=k(!1),[gt,jn]=k(0),[it,Vn]=k(!1),[Qe,lt]=k(!1),[ur,gn]=k(!1),[mr,zn]=k(""),[Zt,hr]=k(!1),[pr,fn]=k(!1),{isTheaterMode:Ue,toggleTheaterMode:vn,handleLayoutClick:gr}=es();S(()=>{const e=n=>{n.target.closest('input, textarea, button, select, a, [role="button"], [contenteditable="true"]')||n.key.toLowerCase()==="t"&&vn()};return document.addEventListener("keydown",e),()=>{document.removeEventListener("keydown",e)}},[vn]),ts(y,(A.length>0||ze!=="")&&!Ue&&!Me&&!Pe&&!Qe);const fr=Ps(),[ft,vr]=k(ns),br=C(e=>{vr(e),rs(e)},[]),be=B(!1),ct=B(null),bn=B(0),Wn=B(!1),Hn=B(0),ue=B(null),At=B(""),yr=sr(Dn,Fn),Mt=!be.current&&!Ae.current&&(Me||Pe||Qe||hn||yr),vt=B(Mt);vt.current=Mt;const bt=B(!1);S(()=>{bt.current=it},[it]);const Ge=C((e,n)=>{if(!V||!n||n<30)return;const s=In(e,n),c=s?n:e;Math.abs(c-bn.current)<10&&!s||(bn.current=c,Mn.mutate({mediaId:V,season:i,episode:u,currentTime:Math.floor(c),duration:Math.floor(n),completed:s,title:r?.title??null,poster:r?.poster??null,backdrop:r?.backdrop??null,year:r?.year??null,overview:r?.overview??null,tmdbId:r?.id??null,mediaType:T||"tv",adult:r?.adult?1:0}))},[V,i,u,Mn,r,T]),Le=C((e,n)=>{Nt();const s=new URLSearchParams(g);s.set("type",g.get("type")||"tv"),s.set("s",String(e)),s.set("e",String(n)),F(`${window.location.pathname}?${s.toString()}`)},[g,F,Nt]),Lt=C(()=>{const e=l.current;if(!e||h||N==null){gn(!1);return}const n=e.duration||0,s=e.currentTime||0;gn(n>0&&s/n>=.8)},[h,N,l]),en=C((e,n)=>["tv-sources",m,h?"movie":"tv",o,e,n,pe],[m,h,o,pe]),tn=C(async(e,n)=>{if(!r||!o||!m)return{valid:!1,sources:[]};const s=h?"movie":"tv",c=await St.tv.sources.query({provider:m,type:s,tmdbId:String(o),season:e,episode:n,title:r.title||"",year:r.year||"",totalSeasons:String(r.number_of_seasons||1),imdbId:r.imdb_id||"",...ie.length>0&&pe?{server:pe}:{}});return{valid:"valid"in c?c.valid:!1,error:"error"in c?c.error:void 0,sources:c.sources,referer:"referer"in c?c.referer:void 0,audioTracks:c.audioTracks,subtitles:"subtitles"in c?c.subtitles:void 0}},[r,o,m,h,ie,pe]),Un=C(()=>{if(h||!r||!o||!m||E||N==null)return;const e=en(i,N);H.getQueryState(e)?.status!=="success"&&H.prefetchQuery({queryKey:e,queryFn:()=>tn(i,N),staleTime:300*1e3,gcTime:1800*1e3})},[h,r,o,m,E,N,i,H,en,tn]),_r=C(()=>{if(xe)return;Lt();const e=l.current;!e||e.paused||e.ended||(e.duration>0&&e.duration-e.currentTime<=60&&Un(),ct.current&&clearTimeout(ct.current),ct.current=setTimeout(()=>{Ge(e.currentTime,e.duration||0)},5e3))},[Ge,l,xe,Lt,Un]),Sr=C(()=>{const e=l.current;if(!e||!r)return;ct.current&&clearTimeout(ct.current),Ge(e.currentTime,e.duration||0),Wn.current=!0;const n=ss({seekInduced:Date.now()-Hn.current<as,autoplayEnabled:ft,hasNext:!h&&N!=null,isFinal:h||N==null});n==="advance"&&N!=null?(q(N),Le(i,N)):n==="prompt-next"?(Ae.current=!1,be.current=!0,He(!0)):n==="prompt-complete"&&(zn(h?r.title:`${r.title} — Season ${i}`),lt(!0),Ae.current=!0,be.current=!0)},[h,r,i,N,ft,Ge,Le,l]),Cr=C(()=>{Wn.current=!1,y.actions.onPlay()},[y.actions]),Tr=C(()=>{y.actions.onPause();const e=l.current;e&&!e.ended&&Ge(e.currentTime,e.duration||0)},[y.actions,Ge,l]),kr=C(()=>{y.actions.onLoadedMetadata();const e=l.current;if(e){try{const n=parseFloat(localStorage.getItem("playerVolume")||"");isNaN(n)||(e.volume=Math.max(0,Math.min(1,n))),e.muted=localStorage.getItem("playerMuted")==="true"}catch{}if(ue.current!=null&&ue.current>0){try{e.currentTime=ue.current}catch{}ue.current=null}Lt()}},[y.actions,l,Lt]),yt=C(()=>{const e=l.current;if(e&&ue.current!=null&&ue.current>0){try{e.currentTime=ue.current}catch{}ue.current=null}},[l]),Er=C(()=>{gt>0&&(ue.current=gt);const e=l.current;if(e&>>0){try{e.currentTime=gt,ue.current=null}catch{}e.play().catch(()=>{})}Jt(!1),be.current=!0},[gt,l]),Kn=C(()=>{ue.current=null;const e=l.current;e&&(e.currentTime=0,e.play().catch(()=>{})),Jt(!1),be.current=!0},[l]),xr=C(()=>{Ae.current=!0,He(!1),be.current=!0},[]),Nr=C(()=>{Ae.current=!0,He(!1),be.current=!0,ue.current=null;const e=l.current;if(e){try{e.currentTime=0}catch{}e.play().catch(()=>{})}},[l]),qn=C(()=>{N!=null&&(Ae.current=!0,He(!1),be.current=!0,q(N),Le(i,N))},[N,i,Le]),Yn=C(()=>{Ce!=null&&(Ae.current=!0,He(!1),lt(!1),be.current=!0,ee(Ce),q(1),Le(Ce,1))},[Ce,Le]),Ir=C(async()=>{if(V)try{await Yt.mutateAsync({id:V,status:"Completed"}),lt(!1),He(!1),F("/")}catch{}},[V,Yt,F]);S(()=>{be.current=!1,pn.current=null,Jt(!1),gn(!1),jn(0),Vn(!1),bt.current=!1,ue.current=null,At.current=`${V}:${i}:${u}`,bn.current=0},[V,i,u]),S(()=>{$n&&(Vn(!0),bt.current=!0)},[$n,V,i,u]),S(()=>{if(!at||be.current)return;const e=`${V}:${i}:${u}`;if(pn.current===e)return;pn.current=e;const n=at,s=n.currentTime??0,c=n.duration??0;sr(s,c)&&(jn(s),Jt(!0))},[at,V,i,u]),S(()=>{if(!it||be.current||Ae.current||Me||Qe||Pe)return;const e=`${V}:${i}:${u}`;if(Pt.current!==e){if(!hn){On||(Pt.current=e);return}if(h){Pt.current=e,He(!0);return}if(!(!r||ot<0||Y.length===0)){if(Pt.current=e,N==null&&Ce==null){r&&Y.length>0&&(zn(`${r.title} — Season ${i}`),lt(!0),Ae.current=!0,be.current=!0);return}He(!0)}}},[it,hn,On,Me,Qe,Pe,h,N,Ce,r,ot,Y.length,V,i,u]),S(()=>{(Me||Pe)&&l.current&&l.current.pause()},[Me,Pe,l]),S(()=>{const e=l.current;return()=>{ct.current&&clearTimeout(ct.current),e&&!e.ended&&Ge(e.currentTime,e.duration||0)}},[Ge,l]);const yn=C(e=>{let n=null,s=!0;try{n=localStorage.getItem("tvLastSubtitle"),s=localStorage.getItem("tvSubtitlesEnabled")!=="false"}catch{}return Pn(e,{lastKey:n,enabled:s})},[]),_n=C(e=>{if(!(e<0))try{localStorage.setItem("tvSubtitlesEnabled","true"),localStorage.setItem("tvSelectedSubtitle",String(e))}catch{}},[]),Qn=C(e=>{if(e.length===0)return 0;let n=null;try{n=localStorage.getItem("tvLastAudio")}catch{}if(n){const s=e.findIndex(O=>Bn(O)===n);if(s>=0)return s;const c=n.indexOf("|||"),d=c>=0?n.slice(0,c):n,p=c>=0?n.slice(c+3):n,f=e.findIndex(O=>O.language===d||O.label===p);if(f>=0)return f}return Pn(e,{lastKey:null,enabled:!0})},[]),{data:Gn}=Is(V||void 0),Xn=$e(()=>(Gn?.progress??[]).filter(n=>n.season===i&&(n.completed===!0||n.completed===1||In(n.currentTime,n.duration))).map(n=>String(n.episode)),[Gn,i]),Jn=$e(()=>Y.map(e=>({id:String(e.episode_number),label:`Episode ${e.episode_number}`,sublabel:e.name||void 0,thumbnail:e.still_path?`https://image.tmdb.org/t/p/w185${e.still_path}`:void 0})),[Y]),Zn=$e(()=>(r?.genres??[]).map(e=>e.name).slice(0,5),[r]),Sn=$e(()=>[r?.year,r?.status,r?.number_of_seasons?`${r.number_of_seasons} Season${r.number_of_seasons>1?"s":""}`:null,r?.number_of_episodes?`${r.number_of_episodes} Episodes`:null].filter(Boolean),[r]);S(()=>{if(Q.length!==0&&!Q.some(e=>e.id===m)){const e=Q.find(n=>n.tier==="direct")?.id??Q[0].id;De(e);try{localStorage.setItem("tvProvider",e)}catch{}}},[Q,m]),S(()=>{if(ie.length!==0&&!ie.includes(pe)){Ct(ie[0]);try{localStorage.setItem("movyServer",ie[0])}catch{}}},[ie,pe]),S(()=>{if(!o){I(null),j([]),Fe(""),G(""),Be("");return}const e=Number(o),n=T||"tv";I(null),j([]),Fe(""),G(""),Be("");const s=parseInt(D.current.get("s")||"",10),c=parseInt(D.current.get("e")||"",10);ee(isNaN(s)?1:s),q(isNaN(c)?1:c),ne(0),St.tv.details.query({type:n,id:String(e)}).then(d=>{const p={id:d.id,title:d.title||"",overview:d.overview||"",vote_average:d.vote_average,year:d.year,poster:d.poster,backdrop:d.backdrop,imdb_id:d.imdb_id||void 0,adult:d.adult,seasons:d.seasons,number_of_seasons:d.number_of_seasons};I(p),p.seasons&&p.seasons.length>0&&isNaN(s)&&ee(p.seasons[0].season_number)}).catch(()=>{})},[o,T]),S(()=>{if(!r||!o)return;if(!(r.seasons!==void 0||r.number_of_seasons!==void 0)){P([]);return}const n=parseInt(g.get("e")||"",10);St.tv.episodes.query({id:String(o),season:String(i)}).then(s=>{const c=(s.episodes||[]).map(d=>({episode_number:d.episode_number,name:d.name||"",vote_average:d.vote_average,overview:d.overview||"",still_path:d.still_path||""}));P(c),c.length!==0&&q(d=>!isNaN(n)&&c.some(p=>p.episode_number===n)?n:c.some(p=>p.episode_number===d)?d:c[0].episode_number)}).catch(()=>{})},[r,o,i,g]),S(()=>{if(!E||!r||!o)return;fetch(`/api/tv/embed/${m}/${h?"movie":"tv"}/${o}?season=${i}&episode=${u}`).then(n=>n.json()).then(n=>{if(n.url)return Be(n.url),fetch(`/api/resolve?url=${encodeURIComponent(n.url)}`).then(s=>s.json()).then(s=>{s.finalUrl&&Be(s.finalUrl)})}).catch(()=>{})},[m,r,o,i,u,h,E]);const nn=C(async()=>{if(!r||!o||!m||E||r.adult&&!rt)return;const e=`${V}:${i}:${u}`;kt.current.length>0?G(""):(Se(!0),G(""),j([]),ne(0),he([]),Ve([]));try{const s=await H.fetchQuery({queryKey:en(i,u),queryFn:()=>tn(i,u),staleTime:3e5,gcTime:18e5});if(At.current!==e)return;if(Se(!1),!s.valid||!s.sources?.length){G(s.error?`${s.error}`:ie.length>0?`No streams from ${pe}. Try another server.`:"No streams available.");return}j(s.sources),Fe(e),ne(0),s.referer&&Dt(s.referer);const c=s.audioTracks||[];he(c),X(c.length>0?Qn(c):0);const d=s.subtitles||[];if(Ve(d),d.length>0){const O=yn(d);Ee(O),_n(O)}else Ee(-1);const p=h?"movie":"tv",f=o;St.tv.subtitles.query({type:p,tmdbId:String(f),season:String(i),episode:String(u)}).then(O=>{if(At.current!==e)return;const Te=Array.isArray(O.subtitles)?O.subtitles:[];Te.length!==0&&Ve(K=>{const w=[...K,...Te.filter(R=>!K.some(M=>M.url===R.url))];if(K.length===0){const R=yn(w);Ee(R),_n(R)}return w})}).catch(()=>{}),G("")}catch{if(At.current!==e)return;Se(!1),G("Failed to load streams.")}},[r,o,m,i,u,h,E,rt,ie,pe,yn,_n,Qn,V,H,en,tn]),Cn=C(e=>{const n=e.toLowerCase();Ct(n);try{localStorage.setItem("movyServer",n)}catch{}G("")},[]),Br=C(e=>{De(e);try{localStorage.setItem("tvProvider",e)}catch{}},[]);S(()=>{m&&r&&!E&&nn()},[m,r,nn,E]),S(()=>{if(!l.current||(fe.current&&(fe.current.destroy(),fe.current=null),E))return;let e=!1;if(xe){const p=l.current;return p&&(p.pause(),p.removeAttribute("src"),p.load(),p.src="/av-sync-test.mp4",vt.current||p.play().catch(()=>{})),()=>{e=!0}}const n=Ne===`${V}:${i}:${u}`&&A[b]?.url||"";if(!n){try{l.current?.pause()}catch{}return}const s=l.current;if(At.current===`${V}:${i}:${u}`&&ue.current==null&&!vt.current)try{!s.ended&&s.currentTime>1&&(ue.current=s.currentTime)}catch{}s.pause(),s.removeAttribute("src"),s.load(),y.actions.resetMediaState();const c=`/api/tv/stream-proxy?url=${encodeURIComponent(n)}&referer=${encodeURIComponent(tt)}`;A[b]?.type==="hls"?(async()=>{const p=await Bs();if(!e)if(p&&p.isSupported()){const f=new p({enableWorker:!0});fe.current=f,f.on(p.Events.ERROR,(K,w)=>{w.fatal&&(G(`Stream failed (${w.details}). Try another source or reload.`),Se(!1),f.destroy(),fe.current=null)}),f.loadSource(c),f.attachMedia(s);const O=()=>{let K=!1,w=0;try{K=localStorage.getItem("tvSubtitlesEnabled")==="true";const R=parseInt(localStorage.getItem("tvSelectedSubtitle")||"0",10);!isNaN(R)&&R>=0&&(w=R)}catch{}return{enabled:K,index:w}},Te=()=>{if(typeof f.subtitleTrack!="number")return;if(ve.current.length>0){f.subtitleTrack=-1;return}const K=Array.isArray(f.subtitleTracks)?f.subtitleTracks:[];if(K.length===0){f.subtitleTrack=-1;return}const w=O();if(w.enabled){const R=w.index<K.length?w.index:0;f.subtitleTrack=R,Ee(R),Ut()}else f.subtitleTrack=-1};_a(f,p.Events,{getWant:()=>Et.current,onResolve:K=>X(K)}),f.on(p.Events.MANIFEST_PARSED,()=>{Te(),ce.current!=null&&(s.currentTime=ce.current,ce.current=null),yt(),!vt.current&&bt.current&&s.play().catch(()=>{})}),f.on(p.Events.SUBTITLE_TRACKS_UPDATED,()=>{Te()}),f.on(p.Events.SUBTITLE_TRACK_SWITCH,(K,w)=>{if(ve.current.length>0){if(w.id!==-1)try{f.subtitleTrack=-1}catch{}return}const R=Array.isArray(f.subtitleTracks)?f.subtitleTracks:[];if(R.length!==0){if(w.id===-1){const M=O();if(M.enabled){const Z=M.index<R.length?M.index:0;f.subtitleTrack=Z;return}}Ee(w.id),Ut()}})}else ws(s)&&(s.src=c,ce.current!=null&&(s.currentTime=ce.current,ce.current=null),yt(),!vt.current&&bt.current&&s.play().catch(()=>{G("Failed to play stream. Try another source.")}))})():(s.src=c,ce.current!=null&&(s.currentTime=ce.current,ce.current=null),yt(),!vt.current&&bt.current&&s.play().catch(()=>{G("Failed to play stream. Try another source.")}));const d=()=>{const O=s.error?.code===4?"Video source not supported or not found":"Failed to load video stream";G(`${O}. The source may be invalid or expired. Try switching source or reloading.`),Se(!1)};return s.addEventListener("error",d),()=>{e=!0,s.removeEventListener("error",d)}},[A,Ne,b,m,tt,E,l,ce,xe,V,i,u,yt,Ut,y.actions]),S(()=>{if(!it||Me||Pe||Qe||Mt||E||xe)return;const e=l.current;!e||!e.paused||e.ended||e.readyState<1||(yt(),e.play().catch(()=>{}))},[it,Me,Pe,Qe,Mt,E,xe,yt,l]),S(()=>{const e=fe.current;!e||typeof e.audioTrack!="number"||(e.audioTrack=Ie)},[Ie]),S(()=>{const e=fe.current;!e||typeof e.subtitleTrack!="number"||!Array.isArray(e.subtitleTracks)||e.subtitleTracks.length===0||ve.current.length>0||(J>=0?e.subtitleTrack=J:e.subtitleTrack=-1)},[J]),S(()=>{const e=l.current;if(!(!e||E)&&(e.querySelectorAll("track").forEach(n=>n.remove()),ve.current=[],oe.length!==0&&(oe.forEach(n=>{const s=document.createElement("track");s.kind="subtitles",s.label=n.label||n.language||"Unknown",s.srclang=n.language||n.label||"en";const c=`/api/subtitle-proxy?url=${encodeURIComponent(n.url)}&referer=${encodeURIComponent(tt)}`;s.src=c,s.addEventListener("load",()=>{const d=ve.current.indexOf(s),p=s.track;if(p&&d>=0){const f=d===xt.current;p.mode=f&&!we.current?"showing":"hidden"}}),e.appendChild(s),ve.current.push(s)}),oe.length>0)))try{const n=fe.current;n&&typeof n.subtitleTrack=="number"&&n.subtitleTrack!==-1&&(n.subtitleTrack=-1)}catch{}},[oe,tt,E,m,l]),S(()=>{const e=l.current;if(!e||E)return;const n=fe.current;ve.current.length>0&&n&&typeof n.subtitleTrack=="number"&&Array.isArray(n.subtitleTracks)&&n.subtitleTracks.length>0&&(n.subtitleTrack=-1);const s=()=>{const p=An(y.state.subtitleFontSize,e.clientHeight||720),f=Math.max(0,Math.min(100,100-y.state.subtitlePosition)),O=()=>{const M=p*16,Z=e.videoHeight||e.clientHeight||720,ae=e.videoWidth||e.clientWidth||1280;return{step:M*1.3/Z*100,chars:Math.max(20,Math.floor(ae/(M*.55)))}},Te=(M,Z)=>{const ae=M;ae.snapToLines=!1,ae.line=Z},K=M=>{if(!M.cues)return;Array.from(M.cues).forEach(ye=>Te(ye,f));const Z=Array.from(M.activeCues??[]);if(Z.length<=1){Z.forEach(ye=>Te(ye,f));return}const{step:ae,chars:z}=O();let dt=f;for(let ye=Z.length-1;ye>=0;ye--){const Xe=String(Z[ye].text??"").replace(/<[^>]*>/g,"").split(`
|
|
3
|
-
`).reduce((an,$t)=>an+Math.max(1,Math.ceil($t.length/z)),0);dt=Math.max(0,dt-Xe*ae),Te(Z[ye],dt),dt-=ae*.4}},w=ve.current;if(w.length>0){w.forEach((M,Z)=>{const ae=M.track;if(!ae)return;const z=Z===J;ae.mode=z&&!de?"showing":"hidden",z&&!de&&K(ae)});return}const R=Array.from(e.textTracks);R.length!==0&&R.forEach((M,Z)=>{const ae=Z===J;M.mode=ae&&!de?"showing":"hidden",ae&&!de&&K(M)})};s();const c=()=>s();e.textTracks.addEventListener("addtrack",c),e.addEventListener("loadedmetadata",s,{once:!0});const d=window.setTimeout(s,600);return()=>{e.textTracks.removeEventListener("addtrack",c),e.removeEventListener("loadedmetadata",s),window.clearTimeout(d)}},[J,oe,E,m,l,de,y.state.subtitleFontSize,y.state.subtitlePosition]),S(()=>{if(!de)return;const e=l.current,n=jt.current;if(!e||!n)return;const s=We/1e3,c=pt/1e3,d=new Set;let p=[],f=-1,O=-1,Te=-1,K=-1,w=0,R=0,M=!1;const Z=()=>{const W=xt.current;if(W<0)return null;const Je=ve.current;return Je.length>0?Je[W]?.track??null:Array.from(e.textTracks)[W]??null},ae=(W,Je)=>{const _e=W.cues;if(!_e||_e.length===0)return Array.from(W.activeCues??[]);let ut=0,mt=_e.length;for(;ut<mt;){const Re=ut+mt>>>1;_e[Re].endTime+s<Je?ut=Re+1:mt=Re}const Ot=[];for(let Re=ut;Re<_e.length;Re++){const on=_e[Re];if(on.startTime+s>Je)break;on.endTime+s>=Je&&Ot.push(on)}return Ot},z=()=>{const W=Z(),Je=e.currentTime-c,_e=W?ae(W,Je):[],ut=e.clientWidth,mt=e.clientHeight,Ot=e.videoWidth,Re=e.videoHeight;if(_e.length===p.length&&_e.every((kn,En)=>kn===p[En])&&ut===f&&mt===O&&Ot===Te&&Re===K||(p=_e,f=ut,O=mt,Te=Ot,K=Re,n.textContent="",_e.length===0))return;const nr={fontSize:An(y.state.subtitleFontSize,mt),position:y.state.subtitlePosition,bgOpacity:y.state.subtitleBgOpacity,bgColor:y.state.subtitleBgColor,textColor:y.state.subtitleTextColor,edge:y.state.subtitleEdge,bold:y.state.subtitleBold},Mr=os(nr),Lr=is(e,nr.position);_e.forEach((kn,En)=>{const rr=String(kn.text??"");if(!ls(rr).trim())return;const xn=document.createElement("div"),Rr=(_e.length-1-En)*1.7;xn.style.cssText=`${Mr}
|
|
4
|
-
bottom: calc(${Lr}px + ${Rr}em);`,xn.innerHTML=cs(rr),n.appendChild(xn)})},dt=()=>{Array.from(e.textTracks).forEach(W=>{d.has(W)||(d.add(W),W.addEventListener("cuechange",z))})},ye=()=>{dt(),z()},Tn=()=>{if(M||R)return;const W=()=>{R=0,!(M||e.paused||e.ended)&&(z(),Tn())};R=window.requestAnimationFrame(W)},Xe=e,an=()=>{w=0,z(),!M&&Xe.requestVideoFrameCallback&&(w=Xe.requestVideoFrameCallback(an))},$t=()=>{z(),Xe.requestVideoFrameCallback?w||(w=Xe.requestVideoFrameCallback(an)):Tn()};dt(),e.textTracks.addEventListener("addtrack",ye),e.textTracks.addEventListener("removetrack",ye),e.addEventListener("timeupdate",z),e.addEventListener("seeked",z),e.addEventListener("loadedmetadata",z),e.addEventListener("play",$t);const er=Array.from(e.querySelectorAll("track"));er.forEach(W=>W.addEventListener("load",z));const tr=typeof ResizeObserver>"u"?null:new ResizeObserver(()=>z());return tr?.observe(e),z(),$t(),()=>{M=!0,d.forEach(W=>W.removeEventListener("cuechange",z)),e.textTracks.removeEventListener("addtrack",ye),e.textTracks.removeEventListener("removetrack",ye),e.removeEventListener("timeupdate",z),e.removeEventListener("seeked",z),e.removeEventListener("loadedmetadata",z),e.removeEventListener("play",$t),er.forEach(W=>W.removeEventListener("load",z)),tr?.disconnect(),R&&window.cancelAnimationFrame(R),w&&Xe.cancelVideoFrameCallback&&Xe.cancelVideoFrameCallback(w),n.textContent=""}},[de,We,J,oe,pt,l,y.state.subtitleFontSize,y.state.subtitlePosition,y.state.subtitleBgOpacity,y.state.subtitleBgColor,y.state.subtitleTextColor,y.state.subtitleEdge,y.state.subtitleBold]);const rn=()=>{I(null),j([]),Be(""),F(-1)},wr=C(e=>{ee(e),q(1),Le(e,1)},[Le]),sn=!h&&r?.seasons&&r.seasons.length>1?t("label",{className:v.sidebarSeason,children:[t("span",{children:"Season"}),t("select",{value:i,onChange:e=>wr(parseInt(e.target.value,10)||1),className:v.select,children:r.seasons.map(e=>t("option",{value:e.season_number,children:["Season ",e.season_number," (",e.episode_count," ep)"]},e.season_number))})]}):null,_t=C(e=>{const n=parseInt(e,10);if(!isNaN(n)){try{l.current?.pause()}catch{}q(n),Le(i,n)}fn(!1)},[i,Le,l]);S(()=>{if(h)return;const e=n=>{n.target.closest('input, textarea, button, select, a, [role="button"], [contenteditable="true"]')||n.key.toLowerCase()==="n"&&(N!=null?_t(String(N)):Vr.error("No next episode available"))};return document.addEventListener("keydown",e),()=>{document.removeEventListener("keydown",e)}},[h,N,_t]);const Pr=e=>{X(e);try{const s=ht[e];s&&localStorage.setItem("tvLastAudio",Bn(s))}catch{}const n=fe.current;n&&n.audioTrack!==void 0&&(n.audioTrack=e)},Ar=e=>{Ee(e);try{if(e===-1)localStorage.setItem("tvSubtitlesEnabled","false");else{localStorage.setItem("tvSubtitlesEnabled","true"),localStorage.setItem("tvSelectedSubtitle",String(e));const d=oe[e];d&&localStorage.setItem("tvLastSubtitle",Bn(d))}}catch{}const n=l.current,s=fe.current;if(s&&typeof s.subtitleTrack=="number"&&Array.isArray(s.subtitleTracks)&&s.subtitleTracks.length>0&&(s.subtitleTrack=ve.current.length>0||e<0?-1:e),!n)return;const c=ve.current;if(c.length>0){c.forEach((d,p)=>{const f=d.track;if(!f)return;const O=p===e;f.mode=O&&!de?"showing":"hidden"});return}Array.from(n.textTracks).forEach((d,p)=>{const f=p===e;d.mode=f&&!de?"showing":"hidden"})},Rt=C(()=>{if(!r)return;const e=l.current,n=h?"":`S${String(i).padStart(2,"0")}E${String(u).padStart(2,"0")}`;St.discord.tvPresence.mutate({title:r.title,episodeLabel:n,isPlaying:e?!e.paused&&!e.ended:!0,thumbnail:r.poster,currentTime:e?e.currentTime:0,duration:e&&e.duration||0,isAdult:r.adult===!0,sessionId:st.current}).catch(()=>{}),St.discord.heartbeat.mutate({sessionId:st.current}).catch(()=>{})},[r,h,i,u,l]);return S(()=>{if(!r)return;Rt();const e=window.setInterval(()=>{const n=l.current;(!n||!n.paused)&&Rt()},15e3);return()=>window.clearInterval(e)},[Rt,r,l]),S(()=>{if(!r||E||me||U||A.length===0)return;const e=l.current;if(!e)return;const n=()=>Rt();return e.addEventListener("play",n),e.addEventListener("pause",n),e.addEventListener("seeked",n),()=>{e.removeEventListener("play",n),e.removeEventListener("pause",n),e.removeEventListener("seeked",n)}},[r,E,me,U,A,Rt,l]),S(()=>{const e=st.current,n=()=>zr(e),s=()=>n();return window.addEventListener("pagehide",s),window.addEventListener("beforeunload",s),()=>{window.removeEventListener("pagehide",s),window.removeEventListener("beforeunload",s),n()}},[]),S(()=>{if(!r){document.title="TV & Movies - dango";return}document.title=h?`${r.title} - dango`:`${r.title} - Season ${i} Episode ${u} - dango`},[r,h,i,u]),S(()=>{if(!r||h)return;const e=new URLSearchParams(g),n=e.get("s"),s=e.get("e"),c=String(i),d=String(u);n===c&&s===d||(e.set("type",g.get("type")||"tv"),e.set("s",c),e.set("e",d),F(`${window.location.pathname}?${e.toString()}`,{replace:!0}))},[r,h,i,u,g,F]),t("div",{className:`${Ze.playerPageLayout} ${Ue?Ze.theaterMode:""}`,onClick:gr,children:[Ue&&t(ds,{videoRef:l,active:wt.enabled&&!E&&A.length>0&&!U&&!(r?.adult&&!rt),settings:wt}),!Ue&&t("aside",{className:Ze.episodeSidebar,children:r?h?t("div",{className:v.sidebarPosterCard,children:[r.poster&&t("img",{src:`https://image.tmdb.org/t/p/w342${r.poster}`,alt:r.title,loading:"lazy",decoding:"async"}),t("div",{className:v.sidebarPosterMeta,children:[t("strong",{children:r.title}),t("span",{children:r.year})]})]}):t(us,{episodes:Jn,currentEpisode:String(u),watchedEpisodes:Xn,onEpisodeClick:_t,header:sn}):h?t("div",{className:v.statusMsg,children:[t($,{name:"spinner",className:v.spinner})," Loading..."]}):t(ms,{variant:"sidebar"})}),t("div",{className:Ze.playerMain,children:[r&&t("div",{className:v.playerSection,onContextMenu:e=>e.preventDefault(),style:r.adult&&!rt?{filter:"blur(14px)",pointerEvents:"none",userSelect:"none"}:void 0,children:E&&ze?t("iframe",{src:ze,className:v.videoIframe,allow:"autoplay; fullscreen",allowFullScreen:!0}):!E&&(A.length>0||me)?t(Oe,{children:[U&&t(or,{error:U,servers:ie,selectedServer:pe,onRetry:nn,onSelect:Cn}),t(ya,{player:y,title:r.title,episodeLabel:h?void 0:`S${i} E${u}`,audioTracks:ht,selectedAudioTrack:Ie,onAudioTrackChange:Pr,subtitles:oe,selectedSubtitle:J,onSubtitleChange:Ar,streams:A,qualityIdx:b,onQualityChange:ne,onBack:rn,movyServers:ie,selectedMovyServer:pe,onMovyServerSelect:Cn,isMovySource:ie.length>0,videoDelayEnabled:ge,onVideoDelayToggle:_,videoDelayMs:Vt,onVideoDelayChange:nt,onCalibrateAvSync:It,subtitleDelayMs:We,onSubtitleDelayChange:re,showNextEpisodeButton:ur&&!Me&&!Pe&&!Qe,onNextEpisode:qn,isLoading:me,isTheaterMode:Ue,onTheaterModeToggle:vn,ambientSettings:wt,onAmbientChange:Ht,children:[t("video",{ref:l,autoPlay:it&&!Mt,playsInline:!0,disablePictureInPicture:!0,className:`${v.video} ${se?v.videoHidden:""}`,onTimeUpdate:_r,onEnded:()=>{xe||Sr()},onPlay:Cr,onPause:Tr,onSeeked:()=>{Hn.current=Date.now(),Lt()},onLoadedMetadata:kr,onVolumeChange:y.actions.onVolumeChange,onWaiting:y.actions.onWaiting,onPlaying:y.actions.onPlaying,onCanPlay:y.actions.onCanPlay,onContextMenu:e=>e.preventDefault(),onError:()=>{G("Video failed to load. Try another server or reload."),Se(!1)}}),t("canvas",{ref:Ft,className:`${v.delayCanvas} ${se?v.delayCanvasActive:""}`}),de&&t("div",{ref:jt,className:v.subtitleOverlay}),t(hs,{isOpen:le,ms:Vt,onChange:nt,onApply:zt,onClose:un,testClipActive:xe,onTestClip:Bt})]})]}):U&&!E?t(or,{error:U,servers:ie,selectedServer:pe,onRetry:nn,onSelect:Cn}):null}),!Ue&&r&&t(ps,{}),!Ue&&sn&&t("div",{className:v.mobileSeasonRow,children:sn}),!Ue&&r&&t("div",{className:v.providerSelectWrap,children:t("label",{className:v.controlLabel,children:["Source",t("select",{value:m,onChange:e=>Br(e.target.value),className:v.select,disabled:Q.length===0,children:qe?t("option",{value:"",children:"Loading…"}):Q.length===0?t("option",{value:"",children:"No providers available"}):t(Oe,{children:[L.length>0&&t("optgroup",{label:"Direct HLS",children:L.map(e=>t("option",{value:e.id,children:e.label},e.id))}),te.length>0&&t("optgroup",{label:"Embeds",children:te.map(e=>t("option",{value:e.id,children:e.label},e.id))})]})})]})}),!Ue&&r&&t("div",{className:Ze.playerInfoContainer,children:[t("div",{className:Ze.playerInfoHeader,children:[t("div",{className:Ze.playerAnimeCard,children:r.poster&&t("img",{src:`https://image.tmdb.org/t/p/w342${r.poster}`,alt:r.title,loading:"lazy",decoding:"async"})}),t("div",{className:Ze.videoTitleSection,children:[t("div",{className:ke.titleContainer,children:[t("h1",{children:r.title}),t("div",{className:v.meta,children:[t("span",{className:v.year,children:r.year}),r.vote_average!=null&&r.vote_average>0&&t("span",{className:v.rating,children:[t($,{name:"star",size:12}),Number(r.vote_average).toFixed(1)]}),t("span",{className:`${v.typeBadge} ${v[h?"movie":"tv"]}`,children:h?"Movie":"TV Show"})]}),Zn.length>0&&t("div",{className:v.genreRow,children:Zn.map(e=>t("span",{className:v.genreChip,children:e},e))}),Sn.length>0&&t("div",{className:v.metaRow,children:Sn.map((e,n)=>t("span",{children:[e,n<Sn.length-1?" · ":""]},`${e}-${n}`))})]}),t("div",{className:ke.controls,children:[t("button",{className:`${ke.watchlistBtn} ${Qt?ke.inList:""}`,onClick:dr,disabled:cr,type:"button",children:[Qt?t($,{name:"check",size:14}):t($,{name:"plus",size:14}),Qt?"In Watchlist":"Add to Watchlist"]}),!h&&t(Oe,{children:[t("button",{className:`${ke.watchlistBtn}`,onClick:()=>mn!=null&&_t(String(mn)),disabled:mn==null,type:"button",children:[t($,{name:"chevron-left",size:14}),"Prev EP"]}),t("button",{className:`${ke.watchlistBtn}`,onClick:()=>N!=null&&_t(String(N)),disabled:N==null,type:"button",children:["Next EP",t($,{name:"chevron-right",size:14})]}),!h&&t("button",{className:`${ke.watchlistBtn} ${ke.modeToggleBtn} ${ft?ke.modeToggleActive:""}`,onClick:()=>br(!ft),type:"button","aria-pressed":ft,children:ft?"AUTOPLAY: ON":"AUTOPLAY: OFF"}),fr&&t("button",{className:`${ke.watchlistBtn}`,onClick:()=>fn(!0),type:"button",children:[t($,{name:"list-ul",size:14}),"Episodes"]})]})]})]})]}),t("div",{className:ke.descriptionSection,children:[t("h3",{children:"Synopsis"}),t(As,{text:r.overview,emptyText:"No description available."})]}),t("button",{className:ke.detailsToggleBtn,onClick:()=>hr(!Zt),type:"button",children:[Zt?t($,{name:"chevron-up"}):t($,{name:"chevron-down"}),Zt?"Hide Details":"Show Details"]}),Zt&&t("div",{className:v.detailGrid,children:[r.first_air_date&&t("div",{className:v.detailItem,children:[t("strong",{children:h?"Release Date":"First Air Date"}),t("span",{children:r.first_air_date})]}),r.last_air_date&&t("div",{className:v.detailItem,children:[t("strong",{children:"Last Air Date"}),t("span",{children:r.last_air_date})]}),r.networks&&r.networks.length>0&&t("div",{className:v.detailItem,children:[t("strong",{children:"Networks"}),t("span",{children:r.networks.map(e=>e.name).join(", ")})]}),r.created_by&&r.created_by.length>0&&t("div",{className:v.detailItem,children:[t("strong",{children:"Created By"}),t("span",{children:r.created_by.map(e=>e.name).join(", ")})]}),r.episode_run_time&&r.episode_run_time.length>0&&t("div",{className:v.detailItem,children:[t("strong",{children:"Episode Runtime"}),t("span",{children:[r.episode_run_time[0]," min"]})]}),r.imdb_id&&t("div",{className:v.detailItem,children:[t("strong",{children:"IMDb"}),t("a",{href:`https://www.imdb.com/title/${r.imdb_id}`,target:"_blank",rel:"noopener noreferrer",className:v.imdbLink,children:"View on IMDb"})]})]})]}),!h&&t(gs,{isOpen:pr,onClose:()=>fn(!1),episodes:Jn,currentEpisode:String(u),watchedEpisodes:Xn,onEpisodeClick:_t,header:sn}),r?.adult&&!rt&&t(Nn,{isOpen:!0,title:"Content Warning",onClose:rn,children:t("div",{style:{padding:"1rem",textAlign:"center"},children:[t("p",{children:"This title contains mature content intended for adult audiences."}),t("p",{children:["By proceeding, you confirm that you are ",t("strong",{children:"18 years of age or older"})," ","(or the age of majority in your jurisdiction) and wish to view this content."]}),t("div",{style:{marginTop:"1rem",display:"flex",gap:"10px",justifyContent:"center"},children:[t(Ke,{variant:"secondary",onClick:rn,children:"Go Back"}),t(Ke,{onClick:Kt,children:"I'm 18+, Continue"})]})]})}),t(fs,{isOpen:Me,onClose:Kn,title:"Resume Watching",message:t(Oe,{children:["You were at ",t("strong",{children:dn(gt)})]}),restartLabel:"Start from Beginning",onResume:Er,onRestart:Kn}),t(Nn,{isOpen:Pe,onClose:xr,title:h?"Movie Completed":"Episode Completed",children:t("div",{style:{padding:"1rem",textAlign:"center"},children:[t("p",{children:h?t(Oe,{children:"You've already watched this movie."}):t(Oe,{children:["You've already watched"," ",t("strong",{children:["Season ",i," Episode ",u]}),". Would you like to continue?"]})}),t("div",{style:{marginTop:"1rem",display:"flex",gap:"10px",justifyContent:"center",flexWrap:"wrap"},children:[t(Ke,{variant:"secondary",onClick:Nr,children:"Replay"}),N!=null?t(Ke,{onClick:qn,children:["Watch EP ",N]}):Ce!=null?t(Ke,{onClick:Yn,children:["Start Season ",Ce]}):null]})]})}),t(Nn,{isOpen:Qe,onClose:()=>lt(!1),title:h?"Movie Completed!":Ce!=null?"Season Complete!":"Show Completed!",children:t("div",{style:{padding:"1rem",textAlign:"center"},children:[t($,{name:"check-circle",size:48,style:{color:"var(--accent-lighter)",marginBottom:"0.5rem"}}),t("p",{style:{fontSize:"1.1rem",fontWeight:600},children:mr}),t("p",{style:{color:"var(--text-secondary)"},children:h?"You finished this movie!":Ce!=null?`You finished Season ${i}.`:"Congratulations! You finished all available episodes."}),t("div",{style:{marginTop:"1rem",display:"flex",gap:"10px",justifyContent:"center",flexWrap:"wrap"},children:[t(Ke,{variant:"secondary",onClick:()=>lt(!1),children:"Close"}),Ce!=null?t(Ke,{onClick:Yn,children:["Start Season ",Ce]}):t(Oe,{children:[t(Ke,{onClick:()=>{lt(!1),rn()},children:"Back to Details"}),Qt&&t(Ke,{onClick:Ir,disabled:Yt.isPending,children:Yt.isPending?"Saving...":"Move to Completed"})]})]})]})}),!r&&t("div",{className:v.statusMsg,children:[t($,{name:"spinner",className:v.spinner})," Loading..."]})]})]})};export{Ro as default};
|