@serifpersia/dango 3.4.7 → 3.4.9
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-Cll26FQe.js → AnimeCard-Dnps_uQ4.js} +1 -1
- package/client/dist/assets/{AnimeInfo-zMQgNycF.js → AnimeInfo-pfps3FSr.js} +1 -1
- package/client/dist/assets/{AnimeInfoPage-DEPX3FFf.js → AnimeInfoPage-CN99oEZn.js} +2 -2
- package/client/dist/assets/{Asmr-BbHVH9pC.js → Asmr-D_IQfb8x.js} +1 -1
- package/client/dist/assets/{AsmrResetProgressModal-D4zRL_b8.js → AsmrResetProgressModal-BYtWVQA9.js} +1 -1
- package/client/dist/assets/AvSyncCalibrator-jI6WLW45.js +10 -0
- package/client/dist/assets/{Home-q7a1RjQM.js → Home-CpaYOxPA.js} +1 -1
- package/client/dist/assets/{Insights-6H3qK9Q_.js → Insights-07y8ViuK.js} +1 -1
- package/client/dist/assets/{LibraryListPage-Cc-I_48d.js → LibraryListPage-DW0HqYwj.js} +1 -1
- package/client/dist/assets/{ListeningList-CxfHV13T.js → ListeningList-NIRGPFnw.js} +1 -1
- package/client/dist/assets/{Manga-BmNPKJB8.js → Manga-c2X095B3.js} +1 -1
- package/client/dist/assets/{MangaInfoPage-Csyq4TAu.js → MangaInfoPage-3Ah2UkzA.js} +1 -1
- package/client/dist/assets/{MangaReadPage-jaSR2qX6.js → MangaReadPage-DpLMkSK1.js} +1 -1
- package/client/dist/assets/{MangaResetProgressModal-DrfFCtDE.js → MangaResetProgressModal-CXyMR31_.js} +1 -1
- package/client/dist/assets/Mature-Ii7NKE5X.js +1 -0
- package/client/dist/assets/{MediaCard-CoRm07Vb.js → MediaCard-DcB-RhSF.js} +1 -1
- package/client/dist/assets/{Music-Yry6890T.js → Music-CeiL8cZv.js} +1 -1
- package/client/dist/assets/{OptionListMenu-DSTuvk6i.js → OptionListMenu-B3xlVT-D.js} +1 -1
- package/client/dist/assets/Player-CF7briPT.js +56 -0
- package/client/dist/assets/{PlayerSettings-CiazXo-J.js → PlayerSettings-g4xFrRiD.js} +1 -1
- package/client/dist/assets/{QueueOptionsButton-CpyBvbsh.js → QueueOptionsButton-B3cSHa0L.js} +1 -1
- package/client/dist/assets/{QueueRail-DRxByiUx.js → QueueRail-wmxRrTaD.js} +1 -1
- package/client/dist/assets/{Radio-DxL91QOj.js → Radio-DdGONwsq.js} +1 -1
- package/client/dist/assets/{ReadingList-CNm6nFC1.js → ReadingList-BZtJHLAG.js} +1 -1
- package/client/dist/assets/{ResetProgressModal-DiYoRAaR.js → ResetProgressModal-CzJaHmde.js} +1 -1
- package/client/dist/assets/{Search-BBRaD1PE.js → Search-CUHWC7IZ.js} +1 -1
- package/client/dist/assets/{Settings-C3ZhNo9P.js → Settings-Bxqc5fmz.js} +1 -1
- package/client/dist/assets/{SkeletonGrid-BAQn8Rru.js → SkeletonGrid-BnRGuRMg.js} +1 -1
- package/client/dist/assets/{Trackers-CZd3KCwM.js → Trackers-m2fBLuJo.js} +1 -1
- package/client/dist/assets/Tv-C7mRP4gg.js +4 -0
- package/client/dist/assets/{TvInfo-oMcOTrSG.js → TvInfo-D8zdqjdN.js} +1 -1
- package/client/dist/assets/{TvPopup-BaAmlbH4.js → TvPopup-_GPNroa1.js} +1 -1
- package/client/dist/assets/{TvSearch-CjGUazdR.js → TvSearch-CiFB0G_Y.js} +1 -1
- package/client/dist/assets/{TvWatchlist-W51KZDQP.js → TvWatchlist-6tIsBVyA.js} +1 -1
- package/client/dist/assets/{Watchlist-DBtN7kPt.js → Watchlist-YyxXLuno.js} +1 -1
- package/client/dist/assets/{hls-CSxWA5I-.js → hls-DpOQmcQm.js} +1 -1
- package/client/dist/assets/{index-CQWyVhME.js → index-Dyiy_9L6.js} +2 -2
- package/client/dist/assets/{useAnimeInfoData-CthDMEMc.js → useAnimeInfoData-DJrFWjlu.js} +1 -1
- package/client/dist/assets/{useAsmr-DH8inTBw.js → useAsmr-XJn2_7ol.js} +1 -1
- package/client/dist/assets/{useAsmrPopup-BfkGmSSw.js → useAsmrPopup-DmZ3Np3r.js} +1 -1
- package/client/dist/assets/{useMangaLibrary-CpQLCvkU.js → useMangaLibrary-COua_Bkn.js} +1 -1
- package/client/dist/assets/{useMangaPopup-B5LXZINf.js → useMangaPopup-o6xoB0uh.js} +1 -1
- package/client/dist/assets/{useProviders-DYy7lHj6.js → useProviders-DIy3z1fe.js} +1 -1
- package/client/dist/assets/{useTv-DvKLIudk.js → useTv-Y_cF_10L.js} +1 -1
- package/client/dist/assets/{useTvLibrary-ChI7tnUw.js → useTvLibrary-DpqGf6Bp.js} +1 -1
- package/client/dist/index.html +1 -1
- package/package.json +2 -2
- package/server/package.json +1 -1
- package/client/dist/assets/AvSyncCalibrator-CbzA-56T.js +0 -10
- package/client/dist/assets/Mature-20QVU1lQ.js +0 -1
- package/client/dist/assets/Player-yVWIsyOS.js +0 -56
- package/client/dist/assets/Tv-O1-yrBt9.js +0 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
import{T as k}from"./vendor-core-DfaOB3Rn.js";import{b as y,u as l,a as d,e as F}from"./vendor-query-BBT5_sHx.js";import{h as n,z as a,t as v}from"./index-
|
|
1
|
+
import{T as k}from"./vendor-core-DfaOB3Rn.js";import{b as y,u as l,a as d,e as F}from"./vendor-query-BBT5_sHx.js";import{h as n,z as a,t as v}from"./index-Dyiy_9L6.js";function P(e){return String(e||"").trim().toUpperCase()}function M(e){return P(e.id||e._id||"")}function N(e){return!!e.isAdult}const D=["Listening","Completed","On-Hold","Dropped","Planned"],E=e=>P(e),G=(e="All",s=1,r=24)=>{const t=n();return y(t.asmrLibrary.list.queryOptions({status:e,page:s,limit:r}))},O=()=>{const e=n();return y({...e.asmrLibrary.ids.queryOptions(),staleTime:1e3*60})},H=e=>{const s=n();return y({...s.asmrLibrary.check.queryOptions({id:e||""}),enabled:!!e,staleTime:1e3*60})},U=(e=24)=>{const s=n();return y(s.asmrProgress.continueListening.queryOptions({limit:e}))},W=e=>{const s=n();return y({...s.asmrProgress.getByWork.queryOptions({workId:e||""}),enabled:!!e})},T=()=>{const e=n(),s=l();return d({mutationFn:async r=>{const{silent:t,...m}=r;return v.asmrLibrary.add.mutate(m)},onSuccess:(r,t)=>{t.silent||a.success("Added to listening list"),s.invalidateQueries({queryKey:["asmr-library"]}),s.invalidateQueries(e.asmrLibrary.pathFilter())},onError:r=>{a.error(`Failed to add: ${r.message}`)}})},_=()=>{const e=n(),s=l();return d(e.asmrLibrary.remove.mutationOptions({onSuccess:()=>{a.success("Removed from listening list"),s.invalidateQueries({queryKey:["asmr-library"]}),s.invalidateQueries({queryKey:["asmr-continue-listening"]}),s.invalidateQueries(e.asmrLibrary.pathFilter()),s.invalidateQueries(e.asmrProgress.pathFilter())},onError:r=>{a.error(`Failed to remove: ${r.message}`)}}))},x=()=>{const e=n(),s=l();return d(e.asmrLibrary.setStatus.mutationOptions({onSuccess:()=>{a.success("Status updated"),s.invalidateQueries({queryKey:["asmr-library"]}),s.invalidateQueries({queryKey:["asmr-continue-listening"]}),s.invalidateQueries(e.asmrLibrary.pathFilter()),s.invalidateQueries(e.asmrProgress.pathFilter())},onError:r=>{a.error(`Failed to update status: ${r.message}`)}}))},z=()=>{const e=n(),s=l();return d(e.asmrProgress.save.mutationOptions({onSuccess:(r,t)=>{s.invalidateQueries({queryKey:["asmr-progress",t.workId]}),s.invalidateQueries({queryKey:["asmr-continue-listening"]}),s.invalidateQueries({queryKey:["asmr-library"]}),s.invalidateQueries(e.asmrLibrary.pathFilter()),s.invalidateQueries(e.asmrProgress.pathFilter())}}))},j=()=>{const e=n(),s=l();return d(e.asmrProgress.remove.mutationOptions({onSuccess:()=>{a.success("Progress reset"),s.invalidateQueries({queryKey:["asmr-progress"]}),s.invalidateQueries({queryKey:["asmr-continue-listening"]}),s.invalidateQueries({queryKey:["asmr-library"]}),s.invalidateQueries(e.asmrLibrary.pathFilter()),s.invalidateQueries(e.asmrProgress.pathFilter())},onError:r=>{a.error(`Failed to reset progress: ${r.message}`)}}))},Y=()=>{const e=n(),s=l();return d(e.asmrLibrary.batchStatus.mutationOptions({onSuccess:r=>{a.success(`Status updated for ${r.updated??0} items`),s.invalidateQueries({queryKey:["asmr-library"]}),s.invalidateQueries({queryKey:["asmr-continue-listening"]}),s.invalidateQueries(e.asmrLibrary.pathFilter()),s.invalidateQueries(e.asmrProgress.pathFilter())},onError:r=>{a.error(`Failed to update statuses: ${r.message}`)}}))},J=()=>{const e=n(),s=l();return d(e.asmrLibrary.removeMany.mutationOptions({onSuccess:r=>{const t=r.removed??0;a.success(`Removed ${t} ${t===1?"item":"items"} from listening list`),s.invalidateQueries({queryKey:["asmr-library"]}),s.invalidateQueries({queryKey:["asmr-continue-listening"]}),s.invalidateQueries(e.asmrLibrary.pathFilter()),s.invalidateQueries(e.asmrProgress.pathFilter())},onError:r=>{a.error(`Failed to remove: ${r.message}`)}}))},V=()=>{const e=n(),s=l();return d(e.asmrProgress.removeMany.mutationOptions({onSuccess:r=>{const t=r.removed??0;a.success(`Reset progress for ${t} ${t===1?"item":"items"}`),s.invalidateQueries({queryKey:["asmr-progress"]}),s.invalidateQueries({queryKey:["asmr-continue-listening"]}),s.invalidateQueries({queryKey:["asmr-library"]}),s.invalidateQueries(e.asmrLibrary.pathFilter()),s.invalidateQueries(e.asmrProgress.pathFilter())},onError:r=>{a.error(`Failed to reset progress: ${r.message}`)}}))},X=()=>{const e=T(),s=_(),{data:r}=O(),t=k(()=>new Set(r?.ids||[]),[r]);return{toggle:i=>{const o=E(i.rjCode);t.has(o)?s.mutate({id:o}):e.mutate({...i,thumbnail:i.thumbnail||""})},bookmarkedIds:t,pending:e.isPending||s.isPending}},h=300*1e3,A=15,Z=(e,s,r,t)=>{const m=s+1,i=F({queries:Array.from({length:m},(u,w)=>{const L=w+1;return{queryKey:["asmrBrowse",e,L,r,t],queryFn:()=>{const K=e.trim();return v.asmr.browse.query({q:K||void 0,page:L,sort:r&&r!=="latest"?r:void 0,rating:t||void 0})},staleTime:h}})}),o=i.flatMap(u=>u.data?.shows??[]),q=o.slice((s-1)*A,s*A),p=i[i.length-1]?.data,b=!!(p&&(p.hasNext||o.length>s*A)),f=i.some(u=>u.isLoading),c=i.some(u=>u.isFetching),Q=i.some(u=>u.isError);return{data:{shows:q,hasNext:b},isLoading:f,isError:Q,isFetching:c}},ee=e=>y({queryKey:["asmrWork",e],queryFn:()=>v.asmr.work.query({rj:e}),enabled:!!e,staleTime:h,refetchOnMount:"always"}),C=15,g=6;function B(e){if(e.isAdult||!e.thumbnail)return!1;const s=(e.rating||"").toLowerCase();return s===""||s==="sfw"}function S(e,s){const r=new Set,t=[];for(const m of e)for(const i of m){if(t.length>=s)return t;const o=i.id||i._id;!o||r.has(o)||(r.add(o),B(i)&&t.push(i))}return t}const se=(e=!0)=>{const s=F({queries:Array.from({length:C},(c,Q)=>{const u=Q+1;return{queryKey:["asmrBrowse","",u,"popular_month",""],queryFn:()=>v.asmr.browse.query({page:u,sort:"popular_month"}),staleTime:h,enabled:e,retry:1}})}),r=s.map(c=>c.data?.shows??[]),t=S(r,g),m=s.every(c=>c.isFetched),i=e&&m&&t.length<g,o=y({queryKey:["asmrBrowse","",1,"popular","sfw"],queryFn:()=>v.asmr.browse.query({page:1,sort:"popular",rating:"sfw"}),staleTime:h,enabled:i,retry:1}),q=o.data?.shows??[],p=t.length>=g?t.slice(0,g):S([t,q],g),b=e&&(s.some(c=>c.isLoading)||i&&o.isLoading),f=e&&m&&p.length===0&&s.some(c=>c.isError);return{data:p,isLoading:b,isError:f}};export{D as A,M as a,se as b,ee as c,H as d,X as e,W as f,P as g,z as h,T as i,Z as j,E as k,N as l,G as m,_ as n,x as o,Y as p,J as q,V as r,j as s,U as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{u as e,S as g,L as m}from"./vendor-core-DfaOB3Rn.js";import{I as a}from"./vendor-icons-DrybRNxP.js";import{c as y}from"./useAsmr-
|
|
1
|
+
import{u as e,S as g,L as m}from"./vendor-core-DfaOB3Rn.js";import{I as a}from"./vendor-icons-DrybRNxP.js";import{c as y}from"./useAsmr-XJn2_7ol.js";import{p as s,a as k}from"./MediaCard-DcB-RhSF.js";import{a as L}from"./Asmr.module-CdWlioTY.js";import{u as f}from"./usePopup-DS9jMzp6.js";const P=({data:i,anchorRect:d,bookmarked:n,onToggleBookmark:p,onMouseEnter:h,onMouseLeave:u,onRequestClose:N})=>{const{data:c,isLoading:v}=y(i.rjCode||null),r=c?.tracks.length??0,l=r>0,t=!v;return e(k,{anchorRect:d,onMouseEnter:h,onMouseLeave:u,onRequestClose:N,children:[e("div",{className:s.header,children:[i.thumbnail&&e("img",{src:i.thumbnail,alt:i.title,loading:"lazy",decoding:"async",className:L.popupCover}),e("div",{className:s.title,children:i.title}),e("div",{className:s.synopsis,children:i.rjCode})]}),e("div",{className:s.body,children:[e("div",{className:s.metaRow,children:[e("div",{className:s.metaItem,children:[e(a,{name:"headphones",size:14}),e("span",{children:t?l?e(g,{children:[r," track",r===1?"":"s"]}):"No tracks":"Loading tracks…"})]}),i.rating&&e("div",{className:s.metaItem,children:e("span",{children:i.rating.toUpperCase()})}),i.isAdult&&e("div",{className:s.metaItem,children:e("span",{children:"18+"})}),i.progressLabel&&e("div",{className:s.metaItem,children:[e(a,{name:"bookmark",size:12}),e("span",{children:i.progressLabel})]})]}),e("div",{className:s.synopsis,children:!t&&!c?.description?"Loading description…":c?.description??"No description available."})]}),e("div",{className:s.footer,children:[e("div",{className:s.primaryAction,children:l?e(m,{to:i.listenTarget,className:s.watchBtn,children:[e(a,{name:"play",size:14}),"Listen now"]}):e("span",{className:s.watchBtn,"aria-disabled":"true",style:{opacity:.5,pointerEvents:"none"},children:[e(a,{name:"play",size:14}),t?"No tracks":"Loading…"]})}),e("div",{className:s.secondaryActions,children:[e("button",{className:`${s.watchlistBtn} ${n?s.active:""}`,onClick:o=>{o.preventDefault(),o.stopPropagation(),p()},children:[n?e(a,{name:"check",size:12}):e(a,{name:"plus",size:12}),e("span",{children:n?"Remove":"Bookmark"})]}),e(m,{to:i.listenTarget,className:s.detailsBtn,children:"Details"})]})]})]})},S=()=>f();export{P as A,S as u};
|
|
@@ -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-Dyiy_9L6.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-COua_Bkn.js";import{d as I}from"./index-Dyiy_9L6.js";import{p as s,a as k}from"./MediaCard-DcB-RhSF.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{$ 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{$ as i}from"./index-Dyiy_9L6.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-DcB-RhSF.js";import{T as g}from"./TvPopup-_GPNroa1.js";import{c as m,i as f}from"./useTvLibrary-DpqGf6Bp.js";import{b as i}from"./vendor-query-BBT5_sHx.js";import{h as p}from"./index-Dyiy_9L6.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-Dyiy_9L6.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-Dyiy_9L6.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.4.
|
|
3
|
+
"version": "3.4.9",
|
|
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-03T15:46:33.503Z"
|
|
87
87
|
}
|
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,Z as Rt,t as Je,W as Dt,g as Ot}from"./index-CQWyVhME.js";import{I as j}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",In="_centerPlayPause_ov6ol_504",Nn="_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",Ir="_epRangeButtons_ov6ol_1328",Nr="_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:In,bottomControls:Nn,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:Ir,metaTags:Nr,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)),Ie=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");Ie(i)&&(n=i);const p=localStorage.getItem("subtitleTextColor");Ie(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(!Ie(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 Is(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 Ns(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(j,{name:"replay-10"})}),r("button",{className:de.centerPlayPause,"data-speed-boost-ignore":"true",onClick:n,"aria-label":e?"Pause":"Play",children:e?r(j,{name:"pause"}):r(j,{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(j,{name:"forward-10"})})]}),Os=({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[I,$]=C({time:0,position:null});A(()=>{const m=n.current;if(!m)return;const w=Q=>{const D=Q/t*100||0;L.current&&(L.current.style.width=`${D}%`),f.current&&(f.current.style.left=`${D}%`),l?.current&&(l.current.innerText=`${s(Q)} / ${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 Q=U*t,D=Q/t*100||0;L.current&&(L.current.style.width=`${D}%`),f.current&&(f.current.style.left=`${D}%`),l?.current&&(l.current.innerText=`${s(Q)} / ${s(t)}`);const ee=v.current?.getBoundingClientRect();$({time:Q,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:[I.position!==null&&r("div",{className:e.timeBubble,style:{left:I.position},children:s(I.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 Qe=280;function ho(e){return e?!!e.closest('button, input, select, textarea, a, [role="button"], [data-player-ui="true"]'):!1}const qs=({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]),I=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),I()},[v,L,I,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}I()}},[v,d,p,I,l.isPlaying,l.isScrubbing,l.showControls,l.showSettings,l.showVolumeSlider]),A(()=>()=>d(),[d]);const W=B(x=>{const q=x.target;if(ho(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?I():$()},Qe)},[v,I,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})]})]})},vo=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=I=>{L.current&&!L.current.contains(I.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)},vo)},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"})]})},_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},Vs=({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(j,{name:"keyboard",size:14}),r("span",{children:"Keyboard Shortcuts"}),n?r(j,{name:"chevron-up",size:12}):r(j,{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",Io="_rangeButton_9tyin_47",No="_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:Io,active:No,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)})})]})},Ws=({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 Us({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(j,{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 zs=({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),I=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),[Q,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,It]=C(!1),[fe,X]=C(!1),[Nt,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:I.current,isAdult:i.isAdult}},[n,t,s,i]),O=B((a=!1,T=!1)=>{if(ie.current)return!1;const N=he();if(!N)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 N.currentTime=H,Ce.current=H,a?(async()=>{try{await Je.progress.updateProgress.mutate(N),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",N).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,N=E;return()=>{window.removeEventListener("beforeunload",a),ie.current||O(!0),T.current&&clearTimeout(T.current),N.current&&clearTimeout(N.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,N=>{w(N),N&&D(!0)});return w(ce(a())),T},[D]),A(()=>{const a=N=>{if(!N.target.closest('input, textarea, button, select, a, [role="button"], [contenteditable="true"]')){if(N.code==="Space"){if(N.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(N.key.toLowerCase()){case"f":ve();break;case"m":ge();break;case"arrowright":ue(10);break;case"arrowleft":ue(-10);break;case"arrowup":if(N.preventDefault(),c.current){const F=Math.min(1,c.current.volume+.1);c.current.volume=F,z(F)}break;case"arrowdown":if(N.preventDefault(),c.current){const F=Math.max(0,c.current.volume-.1);c.current.volume=F,z(F)}break}}},T=N=>{if(N.code==="Space"){if(N.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))},N=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",N,{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",N),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 N=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(N)},[fe]),A(()=>{ie.current=!1,Ce.current=-1,f.current=0,I.current=Math.random().toString(36).substring(2),U(0),X(!1)},[n,t]);const Ve=B(()=>{U(0),X(!1)},[]);A(()=>{const a=I.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,N=Date.now();N-f.current>6e4&&O()&&(f.current=N);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:It,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:Q,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:Nt,useNativeControls:Pt},actions:Mt}};function ts(){try{return typeof navigator<"u"&&/android/i.test(navigator.userAgent)}catch{return!1}}function Ks(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 Gs({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 I=Math.max(0,o.current||0);I>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(I<=0){v(),c.current=!1,h.current=0,x($),E($),g();return}const q=i.current;q.push({bitmap:$,capture:W});const z=ns(I);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>=I){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=I):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 Xs(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 I=Math.max(0,Math.min(500,Math.round(d)));s(I);try{localStorage.setItem("playerVideoDelayMs",String(I))}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 Js(){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 Qs(){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,js=({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,I=0,$=0;u>S?(y=g*S,I=(f-y)/2):(d=f/S,$=(g-d)/2),_.drawImage(p,I,$,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}%`}})]}),Ys=({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 Zs({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(j,{name:"check",size:10})]},o))})]})}const be=10,Ne=500,xe=e=>Math.max(0,Math.min(Ne,Math.round(e))),ea=({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:Ne,step:5,value:n,percent:n/Ne*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{js as A,Ls as B,Ds as C,ws as D,Ws as E,Ss as F,Ys as G,Ms as H,Zs as I,Z as J,ne as K,hs as M,Vs as P,Rs as R,Os as S,Ps as T,Hs as U,qs as a,Xs as b,Gs as c,Js as d,Es as e,Ks as f,Qs as g,xs as h,no as i,As as j,Bs as k,Cs as l,Fs as m,Ns as n,Kr as o,Ts as p,qo as q,Is as r,ao as s,bs as t,zs as u,ae as v,ea as w,Us as x,ks as y,$s as z};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{u as t,a as we,p as ke,h as de,d as l,T as ue,S as me}from"./vendor-core-DfaOB3Rn.js";import{b as he}from"./vendor-query-BBT5_sHx.js";import{B as O,M as $e,h as qe,e as Fe,U as xe,t as x,z as Ue}from"./index-CQWyVhME.js";import{I as ge}from"./vendor-icons-DrybRNxP.js";import{S as Ye,P as pe}from"./SkeletonGrid-BAQn8Rru.js";import{A as Ve}from"./AnimeCard-Cll26FQe.js";import{E as We}from"./ErrorMessage-DAxegITP.js";import{u as je}from"./useProviders-DYy7lHj6.js";import{s as a}from"./Search.module-CMEai-B-.js";import"./useAnimeInfoData-CthDMEMc.js";import"./QueueOptionsButton-CpyBvbsh.js";import"./vendor-ui-3qrARCPr.js";import"./MediaCard-CoRm07Vb.js";import"./useIsMobile-Dvx1uJ82.js";const He=({isOpen:u,onClose:c,onGrant:s})=>t($e,{isOpen:u,title:"Content Warning",onClose:c,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(O,{variant:"secondary",onClick:c,children:"Go Back"}),t(O,{onClick:s,children:"I'm 18+, Continue"})]})]})}),Ke="_shrinkSelect_130sm_1",Qe="_tightGrid_130sm_7",Q={shrinkSelect:Ke,tightGrid:Qe},ze=[{value:"anilist",label:"AniList"},{value:"mal",label:"MAL"}],Ze=[{value:"POPULARITY_DESC",label:"Popularity"},{value:"TRENDING_DESC",label:"Trending"},{value:"SCORE_DESC",label:"Score"},{value:"START_DATE_DESC",label:"Newest"},{value:"FAVOURITES_DESC",label:"Favourites"}],Je=[{value:"",label:"All Status"},{value:"RELEASING",label:"Currently Airing"},{value:"FINISHED",label:"Finished"},{value:"NOT_YET_RELEASED",label:"Not Yet Released"}],Xe=[{value:"",label:"Relevance"},{value:"visits:desc",label:"Most Visited"},{value:"title:asc",label:"Title A-Z"}],et={recent:"Latest",popular:"Popular",views:"Most Viewed",rating:"Top Rated",random:"Random"},tt=[{value:"ALL",label:"All Seasons"},{value:"Winter",label:"Winter"},{value:"Spring",label:"Spring"},{value:"Summer",label:"Summer"},{value:"Fall",label:"Fall"}],ve=u=>u.split("-").map(c=>c&&c[0].toUpperCase()+c.slice(1)).join(" "),at=new Set(["page","limit","year","minScore","minEpisodes"]),rt=new Set(["provider","query","page","limit","type","status","season","year","country","genres","genre","excludeGenres","sortBy","order","studio","blacklist","minScore","minEpisodes"]);function st(u){const c=new URLSearchParams(u),s={};for(const[y,b]of c.entries())rt.has(y)&&(at.has(y)?s[y]=Number(b)||0:s[y]=b);return s}function bt(){const u=we(),c=qe(),[s,y]=ke(),{hasConsent:b,grant:fe}=Fe();de(()=>{document.title="Mature - dango"},[]);const[i,Se]=l(s.get("provider")||"anilist"),[C,z]=l(s.get("query")||""),[T,U]=l(s.get("query")||""),[I,g]=l(parseInt(s.get("page")||"1",10)||1),[_,Y]=l(()=>{const e=s.get("sortBy");return e||(i==="mal"?"SCORE_DESC":"POPULARITY_DESC")}),[M,Z]=l(s.get("sortBy")||""),[N,ye]=l(s.get("status")||""),[D,be]=l(s.get("season")||"ALL"),[G,Ce]=l(s.get("year")||"ALL"),[p,B]=l(s.get("genre")||s.get("genres")||""),[V,Ne]=l(s.get("order")||"recent"),[W,Ae]=l(s.get("studio")||""),[w,Ee]=l(s.get("studio")||""),[J,X]=l([]),[j,Pe]=l(!1),[Re,ee]=l(null),{options:te}=je(),ae=ue(()=>te.filter(e=>e.mature&&(e.kind??"anime")==="anime"),[te]),re=ue(()=>[...ze,...ae.map(e=>({value:e.value,label:e.label}))],[ae]),{data:k}=he({...c.data.matureFilters.queryOptions(),enabled:b,staleTime:1/0}),d=i==="anilist"||i==="mal",H=d?void 0:k?.providers?.[i],P=H?.browse,R=H?.genres??[],A=H?.orders??[],se=A.length>0&&!A.includes(V)?A[0]:V,$=!d&&(P?.genre===!0||R.length>0||J.length>0),v=!d&&(P?.order===!0||A.length>0),E=!d&&P?.studio===!0,ie=!d&&P?.sort===!0,q=d?14:P?.pageSize??14,f=e=>{const r=new URLSearchParams;if(e.provider!=="anilist"&&r.set("provider",e.provider),e.query.trim()&&r.set("query",e.query.trim()),e.page>1&&r.set("page",String(e.page)),e.provider==="anilist")e.sort!=="POPULARITY_DESC"&&r.set("sortBy",e.sort),e.status&&r.set("status",e.status),e.season!=="ALL"&&r.set("season",e.season),e.year!=="ALL"&&r.set("year",e.year);else if(e.provider==="mal")e.sort!=="SCORE_DESC"&&r.set("sortBy",e.sort),e.status&&r.set("status",e.status);else{const n=k?.providers?.[e.provider]?.browse,m=k?.providers?.[e.provider]?.orders??[],o=m.length>0&&!m.includes(e.remoteOrder)?m[0]:e.remoteOrder;(!n||n.sort)&&e.remoteSort&&r.set("sortBy",e.remoteSort),(!n||n.genre)&&e.genre&&r.set("genre",e.genre),(!n||n.order)&&o!==(m[0]??"recent")&&r.set("order",o),(!n||n.studio)&&e.studio.trim()&&r.set("studio",e.studio.trim())}y(r,{replace:!0})},S=(e={})=>({provider:i,query:T,page:I,sort:_,remoteSort:M,status:N,season:D,year:G,genre:p,remoteOrder:V,studio:w,...e}),Le=(()=>{const e=new URLSearchParams;return e.set("provider",i),T.trim()&&e.set("query",T.trim()),e.set("page",String(I)),e.set("limit",String(q)),i==="anilist"&&(e.set("sortBy",_),N&&e.set("status",N),D!=="ALL"&&e.set("season",D),G!=="ALL"&&e.set("year",G)),i==="mal"?(e.set("sortBy",_),N&&e.set("status",N)):d||($&&p&&e.set("genre",p),v&&e.set("order",se),ie&&M&&e.set("sortBy",M),E&&w.trim()&&e.set("studio",w.trim())),e.toString()})(),{data:h,isLoading:Oe,isError:Te,error:Ie}=he({...c.data.matureSearch.queryOptions(st(Le)),enabled:b});de(()=>{const e=h?.genres;!d&&R.length===0&&e&&e.length>0&&X(r=>{const n=new Set(r.map(o=>o.slug)),m=[...r];for(const o of e)o.slug&&!n.has(o.slug)&&(n.add(o.slug),m.push(o));return m.length===r.length?r:m})},[h,i,d,R.length]);const F=(h?.data||[]).map(e=>({...e,isAdult:!0})),le=h?.hasMore??!1,L=()=>{xe(),g(1);let e=p;!d&&!v&&C.trim()&&(e=""),B(e),E&&Ee(W),U(C),f(S({query:C,page:1,genre:e,studio:E?W:w}))},_e=e=>{Se(e),g(1),Z(""),B(""),X([]),e==="mal"?Y("SCORE_DESC"):e==="anilist"&&Y("POPULARITY_DESC"),U(C),f(S({provider:e,page:1,remoteSort:"",genre:"",query:C}))},Me=e=>{B(e),g(1),e&&(z(""),U("")),f(S({genre:e,page:1,query:e?"":T}))},ne=e=>{g(e),f(S({page:e})),window.scrollTo({top:0,behavior:"smooth"})},De=async(e,r)=>{const n=r.id||r._id;if(i!=="mal"&&!/^\d+$/.test(n)&&(e.preventDefault(),e.stopPropagation(),!Re)){ee(n);try{if(i!=="anilist"){let o=!1;try{o=(await x.data.anilistStatus.query())?.available===!0}catch{o=!1}if(o){const ce=await x.data.matureResolve.query({title:r.name});u(`/anime/${ce.id}`);return}const oe=await x.data.matureAllocate.mutate({provider:i,nativeId:n,title:r.name,thumbnail:r.thumbnail});if(!oe?.id)throw new Error("Allocate failed");u(`/anime/${oe.id}`);return}const m=await x.data.matureResolve.query({title:r.name});u(`/anime/${m.id}`)}catch{Ue.error("Could not match this title on AniList")}finally{ee(null)}}},K=new Date().getFullYear(),Ge=[{value:"ALL",label:"All Years"},...Array.from({length:K-1980+1},(e,r)=>({value:String(K-r),label:String(K-r)}))],Be=R.length>0?R.map(e=>({value:e,label:ve(e)})):J.map(e=>({value:e.slug,label:e.name}));return b?t("div",{className:"page-container",children:[t("div",{className:a.header,children:[t("h1",{className:a.pageTitle,children:"Mature"}),t("p",{className:a.pageSubtitle,children:"Browse 18+ titles across AniList and streaming providers"})]}),t("div",{className:a.filterContainer,children:[t("div",{className:a.searchBarWrapper,children:[t("div",{className:a.inputIconWrapper,children:[t(ge,{name:"search",className:a.searchIcon}),t("input",{type:"text",placeholder:`Search ${re.find(e=>e.value===i)?.label}...`,value:C,onChange:e=>z(e.target.value),onKeyDown:e=>{e.key==="Enter"&&L()},className:a.searchInput})]}),t("div",{className:a.searchActions,children:[t("select",{value:i,onChange:e=>_e(e.target.value),className:a.providerSelect,"aria-label":"Provider",children:re.map(e=>t("option",{value:e.value,children:e.label},e.value))}),t(O,{onClick:L,className:a.searchBtn,children:"Search"}),d&&t("button",{onClick:()=>Pe(!j),className:`${a.filterToggleBtn} ${j?a.active:""}`,children:[t(ge,{name:"filter"})," Filters"]}),ie&&t("select",{value:M,onChange:e=>{Z(e.target.value),g(1),f(S({remoteSort:e.target.value,page:1}))},className:a.providerSelect,"aria-label":"Sort",children:Xe.map(e=>t("option",{value:e.value,children:e.label},e.value))})]})]}),(i==="anilist"||i==="mal")&&t("div",{className:`${a.advancedFilters} ${j?a.show:""}`,children:[t("div",{className:a.filterDivider}),t("div",{className:a.filterGrid,children:[t("div",{className:a.filterItem,children:[t("label",{children:"Sort By"}),t("select",{value:_,onChange:e=>Y(e.currentTarget.value),children:Ze.map(e=>t("option",{value:e.value,children:e.label},e.value))})]}),t("div",{className:a.filterItem,children:[t("label",{children:"Status"}),t("select",{value:N,onChange:e=>ye(e.currentTarget.value),children:Je.map(e=>t("option",{value:e.value,children:e.label},e.value))})]}),i==="anilist"&&t(me,{children:[t("div",{className:a.filterItem,children:[t("label",{children:"Season"}),t("select",{value:D,onChange:e=>be(e.currentTarget.value),children:tt.map(e=>t("option",{value:e.value,children:e.label},e.value))})]}),t("div",{className:a.filterItem,children:[t("label",{children:"Year"}),t("select",{value:G,onChange:e=>Ce(e.currentTarget.value),children:Ge.map(e=>t("option",{value:e.value,children:e.label},e.value))})]})]})]}),t("div",{className:a.filterActions,children:t(O,{onClick:L,className:a.searchBtn,children:"Apply Filters"})})]}),!d&&!!k&&($||v||E)&&t("div",{className:`${a.advancedFilters} ${a.show}`,children:[t("div",{className:a.filterDivider}),t("div",{className:`${a.filterGrid} ${Q.tightGrid}`,children:[v&&t("div",{className:`${a.filterItem} ${Q.shrinkSelect}`,children:[t("label",{children:"Order"}),t("select",{value:se,onChange:e=>{Ne(e.target.value),g(1),f(S({remoteOrder:e.target.value,page:1}))},children:(A.length>0?A:["recent"]).map(e=>t("option",{value:e,children:et[e]||e},e))})]}),$&&t("div",{className:`${a.filterItem} ${Q.shrinkSelect}`,children:[t("label",{children:"Genre"}),t("select",{value:p,onChange:e=>{v?(B(e.target.value),g(1),f(S({genre:e.target.value,page:1}))):Me(e.target.value)},children:[t("option",{value:"",children:"All Genres"}),Be.map(e=>t("option",{value:e.value,children:e.label},e.value))]})]}),E&&t("div",{className:a.filterItem,children:[t("label",{children:"Studio"}),t("input",{type:"text",placeholder:"Studio name...",value:W,onChange:e=>Ae(e.target.value),onKeyDown:e=>{e.key==="Enter"&&L()},className:a.searchInput})]})]}),p&&$&&!v&&t("p",{className:a.pageSubtitle,children:["Browsing the ",ve(p)," genre — search text is ignored while a genre is selected."]}),(v||E)&&t("div",{className:a.filterActions,children:t(O,{onClick:L,className:a.searchBtn,children:"Apply Filters"})})]})]}),Te&&t(We,{message:Ie?.message||"Search failed"}),Oe?t(Ye,{count:q}):F.length===0?t("div",{className:a.noResults,children:[t("h3",{children:"No results found"}),t("p",{children:"Try a different query, genre or provider"})]}):t(me,{children:[t("div",{className:a.resultsHeader,children:[t("h2",{className:a.resultsTitle,children:[h?.total??F.length," result",(h?.total??F.length)===1?"":"s"]}),t("div",{className:a.pagination,children:t(pe,{page:I,totalPages:Math.max(1,Math.ceil((h?.total??0)/q)),canGoNext:le,onChange:ne,variant:"labeled"})})]}),t("div",{className:a.resultsGrid,children:F.map(e=>t("div",{onClickCapture:r=>De(r,e),children:t(Ve,{anime:e})},`${i}-${e._id}`))}),t("div",{className:a.bottomPagination,children:t("div",{className:a.pagination,children:t(pe,{page:I,totalPages:Math.max(1,Math.ceil((h?.total??0)/q)),canGoNext:le,onChange:ne,variant:"labeled"})})})]})]}):t(He,{isOpen:!0,onClose:()=>u("/"),onGrant:fe})}export{bt as default};
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/PlayerSettings-CiazXo-J.js","assets/vendor-core-DfaOB3Rn.js","assets/vendor-icons-DrybRNxP.js","assets/OptionListMenu-DSTuvk6i.js","assets/AvSyncCalibrator-CbzA-56T.js","assets/index-CQWyVhME.js","assets/vendor-query-BBT5_sHx.js","assets/index-Cc1Up_NI.css","assets/AvSyncCalibrator-gEONBv5a.css","assets/PlayerSettings-Bj6SsmQ2.css"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{g as Ot,h as A,u as r,P as Br,z as Lr,d as ue,A as f,q as z,y as Ir,T as nt,o as Dr,a as $r,c as Fr,_ as Wr,S as _t}from"./vendor-core-DfaOB3Rn.js";import{_ as mr,S as Nt,h as Or,t as Ee,z as Ve,P as Ur,e as Vr,l as qr,m as Qr,n as zr,o as Gr,d as Kr,u as Hr,M as Oe,B as pt,Q as jr,f as Yr}from"./index-CQWyVhME.js";import{u as fr,b as lr,a as jt}from"./vendor-query-BBT5_sHx.js";import{C as Xr,S as Jr,U as Zr,a as en,p as Yt,s as tn,l as rn,u as nn,b as sn,c as on,d as an,i as ln,e as cr,f as cn,g as un,h as ur,j as dr,k as dn,m as pn,n as mn,r as fn,o as Ue,A as hn,R as vn,E as bn,q as gn,t as p,v as yn,w as Sn,P as En,x as wn,y as kn}from"./AvSyncCalibrator-CbzA-56T.js";import{I as J}from"./vendor-icons-DrybRNxP.js";import{l as Tn}from"./hls-CSxWA5I-.js";import{u as Cn}from"./useIsMobile-Dvx1uJ82.js";import{s as He,Q as Rn}from"./QueueRail-DRxByiUx.js";import{u as Mn,Q as _n}from"./QueueOptionsButton-CpyBvbsh.js";import{u as hr}from"./useProviders-DYy7lHj6.js";import{A as Nn}from"./AnimeMetaDetails-BogOi_bM.js";import{S as Pn}from"./SynopsisText-B3Sa5pRv.js";import"./vendor-ui-3qrARCPr.js";const xn={soft:"Softsub",hard:"Hardsub",mixed:"Mixed"},An={direct:"Direct",embed:"Embed",cookie:"Needs cookie"},Bn=["direct","cookie","embed"],Ln="_controlsOverlay_1b7ea_1",In="_hidden_1b7ea_21",Dn="_topControls_1b7ea_27",$n="_backBtn_1b7ea_47",Fn="_videoTitleInfo_1b7ea_67",Wn="_animeTitle_1b7ea_73",On="_episodeNumber_1b7ea_81",Un="_bottomControls_1b7ea_89",Vn="_progressBarContainer_1b7ea_108",qn="_progressBar_1b7ea_108",Qn="_thumb_1b7ea_127",zn="_scrubbing_1b7ea_142",Gn="_watchedBar_1b7ea_146",Kn="_bufferedBar_1b7ea_147",Hn="_timeBubble_1b7ea_185",jn="_skipSegment_1b7ea_219",Yn="_op_1b7ea_229",Xn="_ed_1b7ea_232",Jn="_recap_1b7ea_235",Zn="_bottomControlsRow_1b7ea_239",es="_leftControls_1b7ea_247",ts="_rightControls_1b7ea_248",rs="_controlBtn_1b7ea_255",ns="_theaterBtn_1b7ea_296",ss="_nextEpisodeBtn_1b7ea_300",os="_active_1b7ea_317",as="_timeDisplay_1b7ea_321",is="_skipControls_1b7ea_329",ls="_skipBtn_1b7ea_335",cs="_volumeContainer_1b7ea_376",us="_volumeSlider_1b7ea_382",ds="_playerPageLayout_1b7ea_440",ps="_videoPlayerWrapper_1b7ea_444",ms="_playerInfoContainer_1b7ea_449",fs="_visible_1b7ea_566",hs="_shortcuts_1b7ea_584",k={controlsOverlay:Ln,hidden:In,topControls:Dn,backBtn:$n,videoTitleInfo:Fn,animeTitle:Wn,episodeNumber:On,bottomControls:Un,progressBarContainer:Vn,progressBar:qn,thumb:Qn,scrubbing:zn,watchedBar:Gn,bufferedBar:Kn,timeBubble:Hn,skipSegment:jn,op:Yn,ed:Xn,recap:Jn,bottomControlsRow:Zn,leftControls:es,rightControls:ts,controlBtn:rs,theaterBtn:ns,nextEpisodeBtn:ss,active:os,timeDisplay:as,skipControls:is,skipBtn:ls,volumeContainer:cs,volumeSlider:us,playerPageLayout:ds,videoPlayerWrapper:ps,playerInfoContainer:ms,visible:fs,shortcuts:hs},vs=Lr(()=>mr(()=>import("./PlayerSettings-CiazXo-J.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9]))),bs=({player:n,isAutoplayEnabled:v,onAutoplayChange:T,showNextEpisodeButton:Z,onNextEpisode:b,videoSources:R,selectedSource:E,selectedLink:$,onSourceChange:L,loadingVideo:Y,skipIntervals:we,animeTitle:e,episodeNumber:m,isTheaterMode:ge,onTheaterModeToggle:N,anime4kEnabled:le,onAnime4kToggle:xe,anime4kSupported:G,anime4kProfile:B,onAnime4kProfileChange:V,anime4kInitializing:Ae,anime4kError:qe,videoDelayEnabled:o,onVideoDelayToggle:d,videoDelayMs:w,onVideoDelayChange:he,onCalibrateAvSync:Be,fallbackChoice:Me,onFallbackChoiceChange:_e,ambientSettings:Qe,onAmbientChange:oe,children:ke,overlays:l,isInteractingExtra:g=!1,className:h,hideChrome:I=!1})=>{const{state:a,refs:D,actions:x}=n,{showSettings:W}=a,{setShowSettings:U,setShowVolumeSlider:Le}=x,Ie=Ot.useRef(null),st=Ot.useRef(null);A(()=>{const c=P=>{Ie.current&&!Ie.current.contains(P.target)&&st.current&&!st.current.contains(P.target)&&W&&U(!1)};return W&&document.addEventListener("mousedown",c),()=>{document.removeEventListener("mousedown",c)}},[W,U]);const ot=Ot.useRef(null),wt=c=>{D.videoRef.current&&(D.videoRef.current.volume=c,D.videoRef.current.muted=c===0)},K=c=>{!D.videoRef.current||isNaN(a.duration)||a.duration===0||(D.videoRef.current.currentTime=c*a.duration,x.sendProgressUpdate(!1,!0))},Ne=()=>{D.videoRef.current&&(x.setIsScrubbing(!0),x.wasPlayingBeforeScrub.current=!D.videoRef.current.paused,D.videoRef.current.pause())},ft=c=>{!D.videoRef.current||!a.duration||(D.videoRef.current.currentTime=c*a.duration)},M=()=>{x.setIsScrubbing(!1),x.wasPlayingBeforeScrub.current&&D.videoRef.current?.play()},j=c=>{if(!D.videoRef.current)return;x.setActiveSubtitleTrack(c);try{if(c===null||c==="off")localStorage.setItem("playerSubtitlesEnabled","false");else{localStorage.setItem("playerSubtitlesEnabled","true");const F=a.availableSubtitles.find(De=>De.label===c||De.lang===c);F?localStorage.setItem("playerLastSubtitle",tn(F)):localStorage.setItem("playerLastSubtitle",c)}}catch{}let P=!1;Array.from(D.videoRef.current.textTracks).forEach(F=>{const $e=c!==null&&c!=="off"&&(F.language===c||F.label===c)&&!P;F.mode=$e?"showing":"hidden",$e&&(P=!0)})},ye=a.activeSubtitleTrack!==null&&a.activeSubtitleTrack!=="off",ht=()=>{if(!D.videoRef.current)return;if(ye){j("off");return}if(a.availableSubtitles.length===0)return;let c=null;try{c=localStorage.getItem("playerLastSubtitle")}catch{}const P=Yt(a.availableSubtitles,{lastKey:c,enabled:!0});if(P<0)return;const F=a.availableSubtitles[P];j(F.label||F.lang)},ze=()=>a.isMuted||a.volume===0?r(J,{name:"volume-mute"}):a.volume<.5?r(J,{name:"volume-down"}):r(J,{name:"volume-up"}),je=r("div",{className:`${k.controlsOverlay} ${!a.showControls&&!W&&!a.isScrubbing?k.hidden:""} `,"data-speed-boost-ignore":"true",style:{pointerEvents:"none",background:"none"},children:r("div",{className:k.topControls,onClick:c=>c.stopPropagation(),children:[r("button",{className:k.backBtn,onClick:c=>{c.stopPropagation(),window.history.back()},title:"Back","aria-label":"Back",children:r(J,{name:"chevron-left"})}),r("div",{className:k.videoTitleInfo,children:[r("span",{className:k.animeTitle,children:e}),m&&r("span",{className:k.episodeNumber,children:["Episode ",m]})]})]})}),Ye=!Y&&!a.isBuffering&&a.duration>0?r(Xr,{isPlaying:a.isPlaying,onTogglePlay:x.togglePlay,onSkipBack:()=>x.seek(-10),onSkipForward:()=>x.seek(10)}):null,Xe=r("div",{className:`${k.controlsOverlay} ${!a.showControls&&!W&&!a.isScrubbing?k.hidden:""} `,"data-speed-boost-ignore":"true",style:{pointerEvents:"none",background:"none",justifyContent:"flex-end"},children:r("div",{className:k.bottomControls,"data-speed-boost-ignore":"true",onClick:c=>c.stopPropagation(),children:[r(Jr,{classes:{container:k.progressBarContainer,scrubbing:k.scrubbing,timeBubble:k.timeBubble,bar:k.progressBar,buffered:k.bufferedBar,watched:k.watchedBar,thumb:k.thumb},videoRef:D.videoRef,duration:a.duration,formatTime:x.formatTime,isScrubbing:a.isScrubbing,onSeek:K,onScrubStart:Ne,onScrubMove:ft,onScrubEnd:M,timeLabelRef:ot,children:[a.duration>0&&n.state.currentSkipInterval&&r("div",{className:`${k.skipSegment} ${k[n.state.currentSkipInterval.skip_type]} `,style:{left:`${n.state.currentSkipInterval.start_time/a.duration*100}% `,width:`${(n.state.currentSkipInterval.end_time-n.state.currentSkipInterval.start_time)/a.duration*100}% `}}),we.map(c=>{const P=c.start_time/a.duration*100,F=(c.end_time-c.start_time)/a.duration*100;return r("div",{className:`${k.skipSegment} ${k[c.skip_type]} `,style:{left:`${P}% `,width:`${F}% `},title:c.skip_type.toUpperCase()},c.skip_id)})]}),r("div",{className:k.bottomControlsRow,children:[r("div",{className:k.leftControls,children:[r("button",{className:k.controlBtn,onClick:x.togglePlay,"aria-label":a.isPlaying?"Pause":"Play",children:a.isPlaying?r(J,{name:"pause"}):r(J,{name:"play"})}),r(Zr,{muted:a.isMuted,volume:a.volume,volumeIcon:ze(),buttonClassName:k.controlBtn,onToggleMute:x.toggleMute,onVolumeChange:wt,onExpandedChange:c=>Le(c)}),r("span",{className:k.timeDisplay,ref:ot,children:[x.formatTime(0)," / ",x.formatTime(a.duration)]}),a.currentSkipInterval&&!a.isAutoSkipEnabled&&r("button",{className:k.controlBtn,onClick:()=>{D.videoRef.current&&a.currentSkipInterval&&(D.videoRef.current.currentTime=a.currentSkipInterval.end_time,x.setCurrentSkipInterval(null))},children:["Skip ",a.currentSkipInterval.skip_type==="op"?"Opening":"Ending"]})]}),r("div",{className:k.rightControls,children:[r("div",{className:k.skipControls,children:Z&&r("button",{className:k.nextEpisodeBtn,onClick:b,title:"Play next episode",children:"Next EP"})}),r("button",{className:`${k.controlBtn} ${ye?k.active:""}`,onClick:ht,title:ye?"Disable Subtitles":"Enable Subtitles","aria-label":"Toggle Subtitles",children:r(J,{name:"closed-captioning",size:22})}),r("button",{ref:st,className:`${k.controlBtn} ${W?k.active:""} `,onClick:()=>U(!W),"aria-label":"Settings",children:r(J,{name:"cog"})}),r("button",{className:`${k.controlBtn} ${k.theaterBtn} ${ge?k.active:""} `,onClick:c=>{c.stopPropagation(),N()},title:ge?"Exit Theater Mode":"Theater Mode","aria-label":ge?"Exit Theater Mode":"Theater Mode",children:r(J,{name:"tv"})}),r("button",{className:k.controlBtn,onClick:x.toggleFullscreen,"aria-label":a.isFullscreen?"Exit Fullscreen":"Fullscreen",children:a.isFullscreen?r(J,{name:"compress"}):r(J,{name:"expand"})})]})]})]})}),Je=r(Br,{fallback:null,children:r(vs,{ref:Ie,isOpen:W,onClose:()=>U(!1),videoSources:R,currentSource:E,currentLink:$,onSourceChange:L,subtitles:a.availableSubtitles,activeSubtitleTrack:a.activeSubtitleTrack,onSubtitleChange:j,subtitleSettings:{fontSize:a.subtitleFontSize,position:a.subtitlePosition,bgOpacity:a.subtitleBgOpacity,bgColor:a.subtitleBgColor,textColor:a.subtitleTextColor,edge:a.subtitleEdge,bold:a.subtitleBold},onSubtitleSettingsChange:(c,P)=>{const F=(De,$e)=>{try{localStorage.setItem(De,String($e))}catch{}};switch(c){case"fontSize":x.setSubtitleFontSize(P),F("subtitleFontSize",P);break;case"position":x.setSubtitlePosition(P),F("subtitlePosition",P);break;case"bgOpacity":x.setSubtitleBgOpacity(P),F("subtitleBgOpacity",P);break;case"bgColor":x.setSubtitleBgColor(P),F("subtitleBgColor",P);break;case"textColor":x.setSubtitleTextColor(P),F("subtitleTextColor",P);break;case"edge":x.setSubtitleEdge(P),F("subtitleEdge",P);break;case"bold":x.setSubtitleBold(P),F("subtitleBold",P);break}},useNativeControls:a.useNativeControls,onNativeControlsToggle:x.setUseNativeControls,anime4kEnabled:le,onAnime4kToggle:xe,anime4kSupported:G,anime4kProfile:B,onAnime4kProfileChange:V,anime4kInitializing:Ae,anime4kError:qe,videoDelayEnabled:o,onVideoDelayToggle:d,videoDelayMs:w,onVideoDelayChange:he,onCalibrateAvSync:Be,isAutoSkipEnabled:a.isAutoSkipEnabled,onAutoSkipChange:c=>{x.setIsAutoSkipEnabled(c);try{localStorage.setItem("autoSkipEnabled",c.toString())}catch{}},isAutoplayEnabled:v,onAutoplayChange:T,fallbackChoice:Me,onFallbackChoiceChange:_e,isTheaterMode:ge,ambientSettings:Qe,onAmbientChange:oe})}),Ze=W?r("div",{"data-speed-boost-ignore":"true",onClick:c=>c.stopPropagation(),children:Je}):null;return r(en,{player:n,topBar:je,centerControls:Ye,bottomBar:!Y&&a.duration>0?Xe:null,settingsPanel:Ze,overlays:l,isInteracting:g,className:h,chromeDisabled:I,children:ke})},gs=({count:n=3})=>r("section",{className:He.section,children:[r("div",{className:He.header,children:r("button",{className:He.headerToggle,disabled:!0,children:[r("span",{className:He.title,children:r(Nt,{width:"60px",height:"1.2rem",variant:"text"})}),r(J,{name:"chevron-down",style:{opacity:.3}})]})}),r("div",{className:He.list,children:Array.from({length:n}).map((v,T)=>r("div",{className:He.item,style:{pointerEvents:"none"},children:[r("div",{className:He.dragHandle,style:{opacity:.2},children:r(Nt,{width:"16px",height:"16px",variant:"rectangular"})}),r("div",{className:He.thumbnail,style:{overflow:"hidden",background:"transparent"},children:r(Nt,{width:"100%",height:"100%",variant:"rectangular"})}),r("div",{className:He.meta,children:[r(Nt,{width:"80%",height:"1.2rem",variant:"text",className:"mb-2"}),r(Nt,{width:"40%",height:"0.8rem",variant:"rectangular",style:{borderRadius:"var(--radius-sm)"}})]})]},T))})]}),ys="_sourceSelectionContainer_c5tub_76",Ss="_providerSelectContainer_c5tub_89",Es="_providerSelect_c5tub_89",ws="_sourceSelect_c5tub_76",ks="_sourceButtons_c5tub_145",Ts="_sourceButton_c5tub_145",Cs="_active_c5tub_170",mt={sourceSelectionContainer:ys,providerSelectContainer:Ss,providerSelect:Es,sourceSelect:ws,sourceButtons:ks,sourceButton:Ts,active:Cs},Rs=({selectedProvider:n,onProviderChange:v,isAdult:T,options:Z})=>{const b=Z&&Z.length>0?Z:[],R=T===void 0?b:b.filter(E=>E.mature===T);return r("div",{className:mt.providerSelectContainer,children:[r("h4",{children:"Provider"}),r("select",{className:mt.providerSelect,value:n,onChange:E=>v(E.target.value),children:Bn.map(E=>{const $=R.filter(L=>(L.tier??"direct")===E);return $.length===0?null:r("optgroup",{label:An[E],children:$.map(L=>r("option",{value:L.value,children:L.sub?`${L.label} (${xn[L.sub]})`:L.label},L.value))},E)})})]})},Ms=({videoSources:n,selectedSource:v,selectedLink:T,onSourceChange:Z,onLinkChange:b})=>{const R=Array.isArray(n)?n:[];if(R.length===0)return null;const E=v?.type==="iframe"&&(v.links?.length??0)>1;return r("div",{className:mt.sourceSelectionContainer,children:[r("h4",{children:"Source"}),r("div",{className:mt.sourceButtons,children:R.map(($,L)=>r("button",{className:`${mt.sourceButton} ${v?.sourceName===$.sourceName?mt.active:""} `,onClick:()=>Z($),children:$.sourceName},`${$.sourceName}-${L}`))}),E&&r("select",{className:mt.sourceSelect,"aria-label":"Fallback embed quality",value:T?.link??v.links[0]?.link??"",onChange:$=>{const L=v.links.find(Y=>Y.link===$.target.value);L&&b(L)},children:v.links.map($=>r("option",{value:$.link,children:$.resolutionStr},$.link))})]})},_s=Ot.memo(Ms,(n,v)=>n.selectedSource?.sourceName===v.selectedSource?.sourceName&&n.selectedLink?.link===v.selectedLink?.link&&n.videoSources===v.videoSources),Ns={low:{sd:1.5,hd:1.3,fhd:1.25},balanced:{sd:2,hd:1.5,fhd:1.25},high:{sd:2.5,hd:2,fhd:1.5},denoise:{sd:1.5,hd:1.5,fhd:1.5}},Ps={low:"ModeB",balanced:"ModeA",high:"ModeAA",denoise:"ModeC"},xs=5,As=15e3,Bs=`
|
|
3
|
-
@group(0) @binding(0) var extTex: texture_external;
|
|
4
|
-
@group(0) @binding(1) var extSamp: sampler;
|
|
5
|
-
struct VSOut {
|
|
6
|
-
@builtin(position) pos: vec4f,
|
|
7
|
-
@location(0) uv: vec2f,
|
|
8
|
-
};
|
|
9
|
-
@vertex
|
|
10
|
-
fn vs(@builtin(vertex_index) idx: u32) -> VSOut {
|
|
11
|
-
var positions = array<vec2f, 6>(
|
|
12
|
-
vec2f(-1.0, -1.0), vec2f(1.0, -1.0), vec2f(-1.0, 1.0),
|
|
13
|
-
vec2f(-1.0, 1.0), vec2f(1.0, -1.0), vec2f(1.0, 1.0)
|
|
14
|
-
);
|
|
15
|
-
var uvs = array<vec2f, 6>(
|
|
16
|
-
vec2f(0.0, 1.0), vec2f(1.0, 1.0), vec2f(0.0, 0.0),
|
|
17
|
-
vec2f(0.0, 0.0), vec2f(1.0, 1.0), vec2f(1.0, 0.0)
|
|
18
|
-
);
|
|
19
|
-
var out: VSOut;
|
|
20
|
-
out.pos = vec4f(positions[idx], 0.0, 1.0);
|
|
21
|
-
out.uv = uvs[idx];
|
|
22
|
-
return out;
|
|
23
|
-
}
|
|
24
|
-
@fragment
|
|
25
|
-
fn fs(@location(0) uv: vec2f) -> @location(0) vec4f {
|
|
26
|
-
return textureSampleBaseClampToEdge(extTex, extSamp, uv);
|
|
27
|
-
}
|
|
28
|
-
`;function Ls({videoRef:n,canvasRef:v,profile:T="balanced",delayMs:Z=0}){const[b,R]=ue(!1),[E,$]=ue(()=>{try{return localStorage.getItem("anime4kEnabled")==="true"}catch{return!1}}),[L,Y]=ue(!1),[we,e]=ue(null),[m,ge]=ue(0),N=f(0),le=f(null),xe=f(null),G=f(null),B=f(null),V=f(null),Ae=f(null),qe=f(null),o=f(null),d=f(null),w=f(!1),he=f(-1),Be=f(0),Me=f(Z);Me.current=Z;const _e=f([]),Qe=f(!1),oe=f(!1),ke=f(!1),l=f(null),g=f(-1),h=f(-1),I=f(!1),a=f(0);A(()=>{async function W(){if(typeof navigator>"u"||!navigator.gpu){R(!1);return}try{const U=await navigator.gpu.requestAdapter();R(!!U)}catch{R(!1)}}W()},[]),A(()=>{if(!E||!b)return;let W=!1;const U=++N.current,Le=K=>{if(K)try{K.close()}catch{}},Ie=()=>{for(const K of _e.current)Le(K.bitmap);_e.current=[]},st=K=>Math.max(8,Math.min(40,Math.ceil(K/16.7)+4));function ot(){d.current!==null&&(cancelAnimationFrame(d.current),d.current=null)}async function wt(){let K=n.current;const Ne=v.current;if(!K||!Ne||N.current!==U)return;const ft=performance.now()+As;for(;(!K||K.videoWidth===0)&&performance.now()<ft;){if(await new Promise(c=>requestAnimationFrame(c)),W||N.current!==U)return;K=n.current}if(!K||K.videoWidth===0){!W&&N.current===U&&(e("Timed out waiting for video metadata"),Y(!1),$(!1));return}const M=K.videoWidth,j=K.videoHeight,ye=Math.max(M,j),ht=window.innerWidth,ze=window.innerHeight,je=Math.max(ht,ze),Ye=ye<je?je/ye:1,Xe=Ns[T],Je=ye<=480?Xe.sd:ye<=720?Xe.hd:ye<=1080?Xe.fhd:1,Ze=Math.min(Je,Ye);Ne.width=Math.round(M*Ze),Ne.height=Math.round(j*Ze),Y(!0),e(null),Be.current=0,he.current=-1,g.current=-1,h.current=-1,I.current=!1,a.current=0,Ie(),w.current=!1;try{let c=function(){W||N.current!==U||(ot(),d.current=requestAnimationFrame(()=>{At()}))};const{ModeA:P,ModeB:F,ModeC:De,ModeAA:$e}=await mr(async()=>{const{ModeA:O,ModeB:q,ModeC:be,ModeAA:de}=await import("./index-BOKlZEHq.js").then(y=>y.i);return{ModeA:O,ModeB:q,ModeC:be,ModeAA:de}},[]);if(!navigator.gpu)throw new Error("WebGPU not available");const et=await navigator.gpu.requestAdapter();if(!et)throw new Error("No GPU adapter found");const C=await et.requestDevice();if(!C)throw new Error("Failed to get GPU device");const Fe=Ne.getContext("webgpu");if(!Fe)throw new Error("Failed to get WebGPU context");const We=navigator.gpu.getPreferredCanvasFormat();Fe.configure({device:C,format:We,alphaMode:"premultiplied"});const ee=C.createTexture({size:[M,j],format:"rgba16float",usage:GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_DST|GPUTextureUsage.RENDER_ATTACHMENT}),tt=Ps[T],at=Math.round(M*Ze),ve=Math.round(j*Ze),vt=(()=>{switch(tt){case"ModeB":return new F({device:C,inputTexture:ee,nativeDimensions:{width:M,height:j},targetDimensions:{width:at,height:ve}});case"ModeC":return new De({device:C,inputTexture:ee,nativeDimensions:{width:M,height:j},targetDimensions:{width:at,height:ve}});case"ModeAA":return new $e({device:C,inputTexture:ee,nativeDimensions:{width:M,height:j},targetDimensions:{width:at,height:ve}});default:return new P({device:C,inputTexture:ee,nativeDimensions:{width:M,height:j},targetDimensions:{width:at,height:ve}})}})(),bt=vt.getOutputTexture(),Ge=C.createSampler({magFilter:"linear",minFilter:"linear"}),kt=C.createShaderModule({code:`
|
|
29
|
-
@group(0) @binding(0) var tex: texture_2d<f32>;
|
|
30
|
-
@group(0) @binding(1) var samp: sampler;
|
|
31
|
-
struct VertexOutput {
|
|
32
|
-
@builtin(position) pos: vec4f,
|
|
33
|
-
@location(0) uv: vec2f,
|
|
34
|
-
}
|
|
35
|
-
@vertex
|
|
36
|
-
fn vs(@builtin(vertex_index) idx: u32) -> VertexOutput {
|
|
37
|
-
var positions = array<vec2f, 6>(
|
|
38
|
-
vec2f(-1.0, -1.0), vec2f(1.0, -1.0), vec2f(-1.0, 1.0),
|
|
39
|
-
vec2f(-1.0, 1.0), vec2f(1.0, -1.0), vec2f(1.0, 1.0)
|
|
40
|
-
);
|
|
41
|
-
var uvs = array<vec2f, 6>(
|
|
42
|
-
vec2f(0.0, 1.0), vec2f(1.0, 1.0), vec2f(0.0, 0.0),
|
|
43
|
-
vec2f(0.0, 0.0), vec2f(1.0, 1.0), vec2f(1.0, 0.0)
|
|
44
|
-
);
|
|
45
|
-
var out: VertexOutput;
|
|
46
|
-
out.pos = vec4f(positions[idx], 0.0, 1.0);
|
|
47
|
-
out.uv = uvs[idx];
|
|
48
|
-
return out;
|
|
49
|
-
}
|
|
50
|
-
@fragment
|
|
51
|
-
fn fs(@location(0) uv: vec2f) -> @location(0) vec4f {
|
|
52
|
-
return textureSample(tex, samp, uv);
|
|
53
|
-
}
|
|
54
|
-
`}),it=C.createBindGroupLayout({entries:[{binding:0,visibility:GPUShaderStage.FRAGMENT,texture:{sampleType:"float"}},{binding:1,visibility:GPUShaderStage.FRAGMENT,sampler:{type:"filtering"}}]}),Pt=C.createRenderPipeline({layout:C.createPipelineLayout({bindGroupLayouts:[it]}),vertex:{module:kt,entryPoint:"vs"},fragment:{module:kt,entryPoint:"fs",targets:[{format:We}]},primitive:{topology:"triangle-list"}}),lt=C.createBindGroup({layout:it,entries:[{binding:0,resource:bt.createView()},{binding:1,resource:Ge}]});try{const O=C.createBindGroupLayout({entries:[{binding:0,visibility:GPUShaderStage.FRAGMENT,externalTexture:{}},{binding:1,visibility:GPUShaderStage.FRAGMENT,sampler:{type:"filtering"}}]}),q=C.createShaderModule({code:Bs}),be=C.createRenderPipeline({layout:C.createPipelineLayout({bindGroupLayouts:[O]}),vertex:{module:q,entryPoint:"vs"},fragment:{module:q,entryPoint:"fs",targets:[{format:"rgba16float"}]},primitive:{topology:"triangle-list"}});l.current={pipeline:be,layout:O,inputView:ee.createView()}}catch{l.current=null}if(N.current!==U){ee.destroy(),C.destroy();return}le.current=C,xe.current=Fe,G.current=vt,B.current=ee,V.current=bt,Ae.current=Pt,qe.current=Ge,o.current=it,oe.current=!1,ke.current=!1;async function xt(){const O=l.current;if(!O||oe.current)return!1;const q=n.current;if(!q)return!1;const be=!ke.current;be&&C.pushErrorScope("validation");try{const de=C.importExternalTexture({source:q}),y=C.createBindGroup({layout:O.layout,entries:[{binding:0,resource:de},{binding:1,resource:Ge}]}),Te=C.createCommandEncoder(),pe=Te.beginRenderPass({colorAttachments:[{view:O.inputView,loadOp:"load",storeOp:"store"}]});pe.setPipeline(O.pipeline),pe.setBindGroup(0,y),pe.draw(6),pe.end(),C.queue.submit([Te.finish()])}catch{return oe.current=!0,l.current=null,!1}if(be){const de=await C.popErrorScope().catch(()=>null);if(de)return console.warn("[anime4k] blit probe failed:",de.message),oe.current=!0,l.current=null,!1;ke.current=!0}return!0}Y(!1);async function At(){if(W||N.current!==U)return;const O=n.current;if(!O||O.videoWidth===0){c();return}if(O!==K||O.videoWidth!==M||O.videoHeight!==j){ge(y=>y+1);return}if(O.paused||O.ended||document.hidden||O.readyState<HTMLMediaElement.HAVE_CURRENT_DATA){c();return}const q=O.getVideoPlaybackQuality().totalVideoFrames;if(q===h.current){c();return}if(w.current){c();return}const be=O.currentTime;(O.seeking||g.current>=0&&Math.abs(be-g.current)>.5)&&(Ie(),I.current=!1,a.current=0,h.current=-1),g.current=be;const de=Math.max(0,Me.current||0);de>a.current&&(I.current=!1),w.current=!0;try{const y=performance.now();let Te=null,pe=!1;if(de<=0){_e.current.length>0&&Ie(),I.current=!1,a.current=0;let Pe=!1;if(!Qe.current)try{C.queue.copyExternalImageToTexture({source:O},{texture:ee},[M,j]),h.current=q,Pe=!0}catch(Q){if(Q instanceof TypeError)Qe.current=!0;else throw Q}if(!Pe&&!oe.current&&l.current&&await xt()&&(h.current=q,Pe=!0),!Pe){const Q=await createImageBitmap(O);h.current=q,C.queue.copyExternalImageToTexture({source:Q},{texture:ee},[M,j]),Le(Q)}}else{const Pe=await createImageBitmap(O);h.current=q;const Q=_e.current;Q.push({bitmap:Pe,capture:y});const Tt=st(de);for(;Q.length>Tt;)Le(Q.shift()?.bitmap);let Ct=-1;for(let te=Q.length-1;te>=0;te--)if(y-Q[te].capture>=de){Ct=te;break}if(Ct!==-1){for(let yt=0;yt<Ct;yt++)Le(Q.shift()?.bitmap);const te=Q.shift();te?(Te=te.bitmap,I.current=!0,a.current=de):(Te=Pe,pe=!0)}else if(!I.current)Te=Pe,pe=!0;else{const te=Q.shift();Te=te?te.bitmap:Pe,te||(pe=!0)}if(!Te){w.current=!1,c();return}C.queue.copyExternalImageToTexture({source:Te},{texture:ee},[M,j]),pe||Le(Te)}const ct=C.createCommandEncoder();await vt.pass(ct);const gt=ct.beginRenderPass({colorAttachments:[{view:Fe.getCurrentTexture().createView(),clearValue:{r:0,g:0,b:0,a:1},loadOp:"clear",storeOp:"store"}]});gt.setPipeline(Pt),gt.setBindGroup(0,lt),gt.draw(6),gt.end(),C.queue.submit([ct.finish()]),he.current=q,Be.current=0,C.queue.onSubmittedWorkDone().then(()=>{N.current===U&&(w.current=!1)})}catch(y){if(w.current=!1,Be.current+=1,Be.current>=xs&&!W&&N.current===U){console.error(y),e(y instanceof Error?y.message:"Render error"),$(!1);return}}c()}c()}catch(c){!W&&N.current===U&&(e(c instanceof Error?c.message:"Failed to initialize upscaler"),Y(!1),$(!1))}}return wt(),()=>{W=!0,N.current+=1,ot(),Ie(),B.current&&(B.current.destroy(),B.current=null),V.current&&(V.current.destroy(),V.current=null),le.current&&(le.current.destroy(),le.current=null),G.current=null,Ae.current=null,qe.current=null,o.current=null,l.current=null,xe.current=null,w.current=!1}},[E,b,n,v,T,m]);const D=z(W=>{$(W);try{localStorage.setItem("anime4kEnabled",String(W))}catch{}},[]),x=z(()=>{$(W=>{const U=!W;try{localStorage.setItem("anime4kEnabled",String(U))}catch{}return U})},[]);return{isWebGPUSupported:b,isEnabled:E,isInitializing:L,error:we,toggle:x,setEnabled:D}}const Is=()=>localStorage.getItem("preferredMode")==="dub"?"dub":"sub",Ds=()=>{const n=localStorage.getItem("preferredProvider");return n&&/^[a-z0-9-]+$/i.test(n)?n:"megaplay"},$s=()=>({showMeta:{},episodes:[],watchedEpisodes:[],watchlistStatus:null,showCombinedDetails:!1,currentMode:Is(),inWatchlist:!1,videoSources:[],selectedSource:null,selectedLink:null,isAutoplayEnabled:rn(),showResumeModal:!0,resumeTime:0,resumeDuration:0,skipIntervals:[],selectedProvider:Ds(),loadingShowData:!0,loadingVideo:!1,error:null,showCookieModal:!1,cookieProvider:null});function Fs(n,v){switch(v.type){case"SET_STATE":return{...n,...v.payload};case"SET_MODE":return{...n,currentMode:v.payload,videoSources:[],selectedSource:null,selectedLink:null};case"SET_PROVIDER":return{...n,selectedProvider:v.payload};default:return n}}async function pr(n,v,T,Z,b=!1){if(!n||!v)throw new Error("Missing params");try{const[R,E,$,L]=await Promise.all([Ee.data.video.query({showId:n,episodeNumber:v,mode:T.currentMode,provider:T.selectedProvider}).catch(()=>null),Ee.progress.getEpisode.query({showId:n,episodeNumber:v}).catch(()=>null),Ee.settings.getByKey.query({key:"preferredSource"}).catch(()=>null),Ee.data.skipTimes.query({showId:n,episodeNumber:v}).catch(()=>[])]),Y=$?.value,we=R?.filter(B=>{const V=B.sourceName.toLowerCase();return T.currentMode==="dub"?V.includes("eng")||V.includes("dub"):V.includes("jpn")||V.includes("sub")||!V.includes("eng")&&!V.includes("dub")})??[],e=we.length>0?we:R??[];let m=e.length>0?e[0]:null;if(Y){const B=e.find(V=>V.sourceName===Y);B&&(m=B)}const ge=m&&m.links.length>0?m.links.sort((B,V)=>(parseInt(V.resolutionStr)||0)-(parseInt(B.resolutionStr)||0))[0]:null,N=E?.currentTime||0,le=E?.duration||0,G=(Array.isArray(L)?L:L?.results||[]).map(B=>({skip_id:B.skip_id||"",skip_type:B.skip_type||"",start_time:B.interval?.start_time??B.start_time??0,end_time:B.interval?.end_time??B.end_time??0})).filter(B=>B.end_time>0);return(!R||R.length===0)&&(b||Ve.error(`No video sources found for ${T.selectedProvider}`)),{videoSources:R,selectedSource:m,selectedLink:ge,resumeTime:N,resumeDuration:le,showResumeModal:N>5&&m?.type!=="iframe",skipIntervals:G,fetchedEpisodeNumber:v}}catch(R){const E=R;if(E.message==="AUTH_REQUIRED")return Z({type:"SET_STATE",payload:{showCookieModal:!0,cookieProvider:E.provider}}),{videoSources:[],selectedSource:null,selectedLink:null,resumeTime:0,resumeDuration:0,showResumeModal:!1,skipIntervals:[],fetchedEpisodeNumber:v};throw R}}const Ws=(n,v,T,Z)=>{const[b,R]=Ir(Fs,T,l=>({...$s(),showMeta:l?.name?{name:l.name,thumbnail:l.thumbnail,nativeName:l.nativeName,englishName:l.englishName,names:{romaji:l.name||l.englishName,english:l.englishName||l.name,native:l.nativeName}}:{}})),E=fr(),$=Or(),L=f(null),Y=f(null),{options:we}=hr(),e=nt(()=>we.filter(l=>(l.kind??"anime")==="anime"),[we]),m=v||b.initialEpisode,ge=f(m);A(()=>{ge.current!==m&&(ge.current=m,R({type:"SET_STATE",payload:{selectedSource:null,selectedLink:null}}))},[m,R]),A(()=>{n&&/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(n)&&b.selectedProvider!=="animepahe"&&L.current!==n&&(L.current=n,R({type:"SET_PROVIDER",payload:"animepahe"}))},[n,b.selectedProvider]);const{data:N,isLoading:le,error:xe}=Mn(n),{data:G}=lr({queryKey:["player-data",n,b.currentMode,b.selectedProvider],queryFn:async()=>{if(!n)throw new Error("No showId");const l=async()=>{try{const D=await Ee.data.episodes.query({showId:n,mode:b.currentMode,provider:b.selectedProvider}).catch(()=>null);if(D?.episodes?.length)return D}catch{}return null},[g,h,I]=await Promise.all([l(),Ee.watchlist.check.query({showId:n}).catch(()=>({inWatchlist:!1,status:null})),Ee.progress.getWatchedEpisodes.query({showId:n}).catch(()=>[])]),a=g?.episodes?g.episodes.sort((D,x)=>parseFloat(D)-parseFloat(x)):[];return{description:g?.description||"",episodes:a,inWatchlist:h.inWatchlist,watchlistStatus:h.status??null,watchedEpisodes:I}},enabled:!!n});A(()=>{!v&&G?.episodes&&G.episodes.length>0&&!v&&R({type:"SET_STATE",payload:{initialEpisode:G.episodes[0]}})},[G,v]),A(()=>{if(N?.isAdult===void 0)return;const g=new Set(e.filter(h=>h.mature).map(h=>h.value)).has(b.selectedProvider);if(Y.current!==n){if(N.isAdult&&!g){const h=e.find(I=>I.mature);if(!h)return;Y.current=n,R({type:"SET_PROVIDER",payload:h.value}),localStorage.setItem("preferredProvider",h.value)}if(!N.isAdult&&g){const h=e.find(I=>!I.mature);if(!h)return;Y.current=n,R({type:"SET_PROVIDER",payload:h.value}),localStorage.setItem("preferredProvider",h.value)}}},[N?.isAdult,b.selectedProvider,n,e]),A(()=>{if(!n||!/^dango-mt-\d+$/.test(n)||Y.current===`temp:${n}`)return;const l=N?.provider;l&&(Y.current=`temp:${n}`,l!==b.selectedProvider&&R({type:"SET_PROVIDER",payload:l}))},[n,N,b.selectedProvider]);const{data:B,isLoading:V,error:Ae}=lr({queryKey:["video-sources",n,m,b.selectedProvider,b.currentMode],queryFn:()=>pr(n,m,b,R),enabled:!!n&&!!m&&!(b.showMeta?.isAdult===!0&&!Z?.hasMatureConsent)}),{mutateAsync:qe}=jt({mutationFn:async({wasIn:l,showMeta:g})=>{if(!n)throw new Error("Missing showId");if(l)await Ee.watchlist.remove.mutate({id:n});else{const h=g.name||g.names?.romaji;if(!h)throw new Error("Missing show name");await Ee.watchlist.add.mutate({id:n,name:h,thumbnail:g.thumbnail,nativeName:g.names?.native,englishName:g.names?.english,type:g.type,isAdult:g.isAdult})}return!l},onSuccess:l=>{Ve.success(l?"Added to watchlist":"Removed from watchlist"),E.invalidateQueries({queryKey:["player-data",n]}),E.invalidateQueries({queryKey:["show-data",n]}),E.invalidateQueries({queryKey:["watchlist"]})},onError:l=>Ve.error(l instanceof Error?l.message:"Failed to update watchlist")}),o=z(async()=>{!n||!N||await qe({wasIn:!!G?.inWatchlist,showMeta:N})},[n,N,G?.inWatchlist,qe]),d=z(async l=>{try{await Ee.settings.set.mutate({key:"preferredSource",value:l})}catch(g){console.error(g)}},[]),{mutateAsync:w,isPending:he}=jt({mutationFn:async({status:l})=>{if(!n)throw new Error("Missing showId");return await Ee.watchlist.setStatus.mutate({id:n,status:l}),l},onSuccess:l=>{R({type:"SET_STATE",payload:{inWatchlist:!0,watchlistStatus:l}}),Ve.success(`Moved to ${l}`),E.invalidateQueries({queryKey:["show-data",n]}),E.invalidateQueries({queryKey:["watchlist"]}),E.invalidateQueries({queryKey:["allContinueWatching"]})},onError:()=>Ve.error("Failed to update watchlist status")}),Be=z(async()=>{await w({status:"Completed"})},[w]),{mutateAsync:Me}=jt({mutationFn:async({episodeNumber:l,duration:g,showMeta:h,episodes:I})=>{await Ee.progress.updateProgress.mutate({showId:n,episodeNumber:l,currentTime:g,duration:g,showName:h.name,showThumbnail:h.thumbnail,nativeName:h.names?.native,englishName:h.names?.english,genres:h.genres?.map(a=>a.name),popularityScore:Ur(h.score??h.stats?.averageScore),type:h.type,status:h.status,episodeCount:I.length,isAdult:h.isAdult})},onSuccess:(l,g)=>{Ve.success(`Episode ${g.episodeNumber} marked as watched`),E.invalidateQueries({queryKey:["player-data",n]}),E.invalidateQueries({queryKey:["show-meta",n]}),E.invalidateQueries({queryKey:["video-sources",n,g.episodeNumber]}),E.invalidateQueries({queryKey:["allContinueWatching"]}),E.invalidateQueries({queryKey:["thisWeekSchedule"]}),E.invalidateQueries($.continueWatching.pathFilter())},onError:()=>Ve.error("Failed to mark episode as watched")}),_e=z(async(l,g)=>{!n||!N||await Me({episodeNumber:l,duration:g,showMeta:N,episodes:G?.episodes||[]})},[n,N,G?.episodes,Me]),Qe=z(async()=>{R({type:"SET_STATE",payload:{showCombinedDetails:!b.showCombinedDetails}})},[b.showCombinedDetails]),oe=nt(()=>{const l=xe||Ae,g=l?l.message:null,h=g==="AUTH_REQUIRED"?null:g,I=B&&B.fetchedEpisodeNumber===m?B:null,a=!!B&&!I;return{...b,currentEpisode:m,showMeta:{...b.showMeta||{},...N||{}},episodes:G?.episodes||[],watchedEpisodes:G?.watchedEpisodes||[],inWatchlist:!!G?.inWatchlist,watchlistStatus:G?.watchlistStatus??b.watchlistStatus??null,videoSources:I?.videoSources||[],selectedSource:b.selectedSource||I?.selectedSource||null,selectedLink:b.selectedLink||I?.selectedLink||null,resumeTime:I?.resumeTime||0,resumeDuration:I?.resumeDuration||0,showResumeModal:b.showResumeModal&&(I?.showResumeModal??!1),skipIntervals:I?.skipIntervals||[],loadingShowData:le,loadingVideo:V||a,error:h,fetchedEpisodeNumber:I?.fetchedEpisodeNumber}},[b,N,G,B,le,V,xe,Ae,m]),ke=z((l,g)=>{const h=g||n;if(!h||!l||h===n&&l===m)return;const a=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(h)&&b.selectedProvider!=="animepahe"?"animepahe":b.selectedProvider,D=["video-sources",h,l,a,b.currentMode];E.getQueryState(D)?.status!=="success"&&E.prefetchQuery({queryKey:D,queryFn:()=>pr(h,l,{selectedProvider:a,currentMode:b.currentMode},R,!0),staleTime:300*1e3,gcTime:1800*1e3})},[n,m,E,b,R]);return{state:oe,dispatch:R,toggleWatchlist:o,moveToCompleted:Be,setPreferredSource:d,handleToggleDetails:Qe,markEpisodeWatched:_e,prefetchEpisodeSources:ke,isMarkingWatched:Me.isPending,isUpdatingWatchlistStatus:he}},Xt="fallbackChoice";function Os(){try{const n=localStorage.getItem(Xt);return n==="iframe"||n==="retry"?n:null}catch{return null}}function Us(n){try{n===null?localStorage.removeItem(Xt):localStorage.setItem(Xt,n)}catch{}}const oo=()=>{const{id:n,episodeNumber:v}=Dr(),T=$r(),Z=fr(),b=Fr(),{hasConsent:R,grant:E}=Vr(),{options:$}=hr(),L=nt(()=>$.filter(t=>(t.kind??"anime")==="anime"),[$]),Y=nt(()=>L.map(t=>t.value),[L]),we=nt(()=>new Set(L.filter(t=>t.mature).map(t=>t.value)),[L]),{state:e,dispatch:m,toggleWatchlist:ge,moveToCompleted:N,setPreferredSource:le,handleToggleDetails:xe,markEpisodeWatched:G,prefetchEpisodeSources:B,isMarkingWatched:V,isUpdatingWatchlistStatus:Ae}=Ws(n,v,b.state||null,{hasMatureConsent:R});A(()=>{if(n&&e.showMeta?.id&&e.showMeta.id!==n){const t=v?`/watch/${e.showMeta.id}/${v}${window.location.search}`:`/watch/${e.showMeta.id}${window.location.search}`;T(t,{replace:!0})}},[n,e.showMeta?.id,v,T]);const qe=nt(()=>{if(e.showMeta.name)return{name:e.showMeta.name,thumbnail:e.showMeta.thumbnail,names:e.showMeta.names,genres:e.showMeta.genres,score:e.showMeta.score,isAdult:e.showMeta.isAdult}},[e.showMeta.name,e.showMeta.thumbnail,e.showMeta.names,e.showMeta.genres,e.showMeta.score,e.showMeta.isAdult]),o=nn({skipIntervals:e.skipIntervals,showId:n,episodeNumber:e.currentEpisode?.toString(),episodeCount:e.episodes.length||void 0,sourceType:e.selectedSource?.type,showMeta:qe}),{refs:d,actions:w}=o,he=f(null),Be=Cn(),Me=f(null),_e=f(null),Qe=f(null),oe=f(0),ke=f(e.resumeTime),l=f(e.showResumeModal),[g,h]=ue(()=>{try{const t=localStorage.getItem("anime4kProfile");return["low","balanced","high","denoise"].includes(t)?t:"balanced"}catch{return"balanced"}}),{videoDelayMs:I,videoDelayEnabled:a,setDelayEnabled:D,handleVideoDelayChange:x,isCalibrating:W,testClipActive:U,stopCalibration:Le,openAvSyncCalibrator:Ie,cancelAvSyncCalibrator:st,applyAvSyncCalibrator:ot,toggleTestClip:wt,calibReturnRef:K,effectiveVideoDelayMs:Ne}=sn(d.videoRef,()=>w.setShowSettings(!1)),ft=f(null),M=Ls({videoRef:d.videoRef,canvasRef:_e,profile:g,delayMs:Ne}),j=M.isEnabled&&M.isWebGPUSupported,ye=`${n??""}:${e.currentEpisode??""}`,ht=f(null),ze=f(!1),je=f(!1),Ye=f(M.setEnabled);Ye.current=M.setEnabled,A(()=>{const t=ht.current;ht.current=ye,!(t===null||t===ye)&&(!M.isEnabled||!M.isWebGPUSupported||(ze.current=!0,je.current=!1,Ye.current(!1)))},[ye,M.isEnabled,M.isWebGPUSupported]),A(()=>{if(!ze.current)return;if(M.isEnabled){je.current&&(ze.current=!1);return}if(je.current=!0,e.loadingVideo||!e.selectedLink)return;if(e.selectedSource?.type==="iframe"){ze.current=!1,Ye.current(!0);return}const t=d.videoRef.current;if(!t)return;let s,i=!1;const u=()=>{i||(i=!0,ze.current=!1,Ye.current(!0))};if(t.readyState>=2)return s=window.setTimeout(u,500),()=>window.clearTimeout(s);const _=()=>{window.setTimeout(u,500)};return t.addEventListener("canplay",_,{once:!0}),t.addEventListener("playing",_,{once:!0}),s=window.setTimeout(u,5e3),()=>{window.clearTimeout(s),t.removeEventListener("canplay",_),t.removeEventListener("playing",_)}},[M.isEnabled,e.loadingVideo,e.selectedLink,e.selectedSource?.type,d.videoRef]),on({videoRef:d.videoRef,canvasRef:ft,delayMs:Ne,enabled:a&&!j});const Xe=a&&!j,Je=j||Xe;A(()=>{ke.current=e.resumeTime,l.current=e.showResumeModal},[e.resumeTime,e.showResumeModal]);const[Ze,c]=ue(!1),[P,F]=ue(!1),[De,$e]=ue(!1),et=f(!1),[C,Fe]=ue(null),We=f(!1),ee=f([]),tt=f(!1),[at,ve]=ue(null),[vt,bt]=ue(!1),[Ge,kt]=ue(!1),[it,Pt]=ue(()=>Os()??"ask"),lt=z(t=>{Pt(t),Us(t==="ask"?null:t)},[]),xt=f(it);xt.current=it;const At=f(e.videoSources);At.current=e.videoSources;const O=f(()=>{}),[q,be]=ue(null),de=f(v);A(()=>{de.current!==v&&(de.current=v,be(null),Fe(null),et.current=!1,Le())},[v,Le]),A(()=>{We.current=!1,ee.current=[],tt.current=!1,ve(null),bt(!1)},[n,e.currentEpisode]),A(()=>{P||(et.current=!1)},[P]);const{data:y=[],isLoading:Te}=qr(),pe=Qr(),ct=f(pe);ct.current=pe;const gt=zr(),Pe=Gr(),{isTheaterMode:Q,toggleTheaterMode:Tt,handleLayoutClick:Ct}=an();Wr(()=>{if(o.state.isFullscreen||Q)return;const t=d.playerContainerRef.current,s=Me.current;if(!t||!s)return;const i=()=>{const _=t.getBoundingClientRect().height;s.style.height=`${_}px`};i();const u=new ResizeObserver(i);return u.observe(t),()=>u.disconnect()},[o.state.isFullscreen,Q,d.playerContainerRef]);const te=nt(()=>e.episodes.findIndex(t=>t===e.currentEpisode),[e.episodes,e.currentEpisode]),yt=te>0?e.episodes[te-1]:null,Ce=te>=0&&te<e.episodes.length-1?e.episodes[te+1]:null,Ut=te>-1&&te<e.episodes.length-1,Vt=ln(e.resumeTime,e.resumeDuration)||P,rt=Vt&&cr(e.episodes,e.currentEpisode,e.showMeta.status),qt=e.showResumeModal&&(rt||!Vt),Bt=Vt&&!rt&&y.length===0&&!q&&(e.showResumeModal||P),ut=qt||Bt;cn(o,!!e.selectedLink&&!Q&&!ut),A(()=>{const t=d.videoRef.current;if(!t)return;let s=!1;for(he.current&&(he.current.destroy(),he.current=null),(e.loadingVideo||e.selectedSource)&&(t.pause(),t.removeAttribute("src"),t.load());t.firstChild;)t.removeChild(t.firstChild);if(U)return t.src="/av-sync-test.mp4",t.play().catch(()=>{w.setShowControls(!0)}),()=>{s=!0};if(!e.selectedSource||!e.selectedLink)return;if(e.selectedSource.type==="iframe"){oe.current=0;return}K.current!=null?(oe.current=K.current,K.current=null):ke.current>5&&!l.current?oe.current=ke.current:l.current&&(oe.current=0);let i=e.selectedLink.link;if(i.startsWith("/api/proxy")||(i=`/api/proxy?url=${encodeURIComponent(i)}`,e.selectedLink.headers?.Referer&&(i+=`&referer=${encodeURIComponent(e.selectedLink.headers.Referer)}`)),e.selectedSource.subtitles){const ce=localStorage.getItem("playerSubtitlesEnabled")!=="false";let Se=null;try{Se=localStorage.getItem("playerLastSubtitle")}catch{}const re=Yt(e.selectedSource.subtitles,{lastKey:Se,enabled:ce}),Re=re>=0?e.selectedSource.subtitles[re]:null;e.selectedSource.subtitles.forEach(fe=>{const ne=document.createElement("track");ne.kind="subtitles",ne.label=fe.label,ne.srclang=fe.lang;const S=fe.src??fe.url;if(S){let se=`/api/subtitle-proxy?url=${encodeURIComponent(S)}`;const ie=e.selectedLink?.headers?.Referer,St=S.includes("anilight.live")?"https://anilight.live/":"",Wt=ie||St;Wt&&(se+=`&referer=${encodeURIComponent(Wt)}`),ne.src=se}Re&&fe.label===Re.label&&fe.lang===Re.lang&&(ne.default=!0),t.appendChild(ne)}),ce||w.setActiveSubtitleTrack("off"),w.setAvailableSubtitles(e.selectedSource.subtitles)}const u=oe.current;oe.current=0;const _=()=>{u>0&&(t.currentTime=u)};t.addEventListener("loadedmetadata",_,{once:!0});const me=!(l.current&&ke.current>5),X=()=>{me&&t.play().catch(()=>{w.setShowControls(!0)})};e.selectedLink.hls?(async()=>{const ce=await Tn();if(s)return;if(!ce||!ce.isSupported()){t.src=i,X();return}const Se=document.body.classList.contains("low-end"),re=new ce({maxBufferLength:Se?15:30,maxMaxBufferLength:Se?30:60,maxBufferSize:Se?25*1e3*1e3:60*1e3*1e3,startLevel:-1,enableWorker:!0});he.current=re,re.on(ce.Events.ERROR,(ne,S)=>{S.fatal&&!We.current&&O.current()});const Re=(e.selectedSource?.subtitles?.length??0)>0,fe=()=>{try{Re&&typeof re.subtitleTrack=="number"&&re.subtitleTrack!==-1&&(re.subtitleTrack=-1)}catch{}};re.on(ce.Events.SUBTITLE_TRACK_SWITCH,(ne,S)=>{S?.id!==-1&&fe()}),fe(),re.loadSource(i),re.attachMedia(t),re.once(ce.Events.MANIFEST_PARSED,()=>{s||X()})})():(t.src=i,X());const H=localStorage.getItem("playerVolume"),ae=localStorage.getItem("playerMuted");return H!==null&&(t.volume=parseFloat(H)),ae!==null&&(t.muted=ae==="true"),()=>{s=!0,t.removeEventListener("loadedmetadata",_),he.current&&(he.current.destroy(),he.current=null)}},[e.selectedSource,e.selectedLink,d.videoRef,K,w,e.loadingVideo,U]);const Lt=z(t=>{if(We.current)return;We.current=!0;const s=t.links[0];le(t.sourceName),m({type:"SET_STATE",payload:{selectedSource:t,selectedLink:s}}),ve(null)},[m,le]),It=z(()=>{const s=At.current.find(i=>i.type==="iframe");return s?.links?.length?s:null},[]),Dt=z(async()=>{const t=e.showMeta?.isAdult,s=Y.filter(i=>{if(ee.current.includes(i))return!1;const u=we.has(i);return t===void 0?!0:u===t});bt(!0);try{for(const i of s){ee.current.push(i);let u=null;try{u=await Ee.data.video.query({showId:n,episodeNumber:e.currentEpisode,mode:e.currentMode,provider:i})}catch{continue}const _=(u??[]).filter(H=>{const ae=H.sourceName.toLowerCase();return e.currentMode==="dub"?ae.includes("eng")||ae.includes("dub"):ae.includes("jpn")||ae.includes("sub")||!ae.includes("eng")&&!ae.includes("dub")});if((_.length>0?_:u??[]).find(H=>H.type!=="iframe"&&H.links?.length)){ee.current=[e.selectedProvider],tt.current=!1,m({type:"SET_STATE",payload:{selectedProvider:i,videoSources:[],selectedSource:null,selectedLink:null,loadingVideo:!0}}),localStorage.setItem("preferredProvider",i),ve(null),Ve.success(`Switched to ${i} (direct stream)`);return}}ve({retryFailed:!0}),Ve.error("No working direct stream found on other providers")}finally{bt(!1)}},[n,e.currentEpisode,e.currentMode,e.showMeta?.isAdult,e.selectedProvider,m,Y,we]),Jt=z(()=>{if(We.current||tt.current||e.selectedSource?.type!=="player")return;const t=It();if(!t)return;ee.current.includes(e.selectedProvider)||ee.current.push(e.selectedProvider);const s=xt.current;if(s==="iframe"){Lt(t);return}if(s==="retry"){Dt();return}w.setShowControls(!0),ve({retryFailed:!1})},[e.selectedSource,e.selectedProvider,It,Lt,Dt,w]);O.current=Jt;const vr=z(()=>{tt.current=!0,ve(null),kt(!1)},[]),br=z(()=>{Ge&<("iframe");const t=It();t?Lt(t):ve(null)},[Ge,lt,It,Lt]),gr=z(()=>{Ge&<("retry"),Dt()},[Ge,lt,Dt]),Rt=(t,s,i)=>t.showId===s||!!i&&t.showId===i,$t=z(()=>{w.onEnded();const t=y.find(i=>Rt(i,n,e.showMeta?.id)&&i.episodeNumber===e.currentEpisode);if(y.length>0){const i=y.findIndex(_=>Rt(_,n,e.showMeta?.id)&&_.episodeNumber===e.currentEpisode),u=i>=0?y[i+1]||null:y[0];be({nextItem:u,playedItem:t||null}),Fe(2)}else t&&ct.current.mutate({showId:t.showId,episodeNumber:t.episodeNumber});let s=!1;if(e.isAutoplayEnabled&&y.length===0){const i=e.episodes.findIndex(u=>u===e.currentEpisode);if(i>-1&&i<e.episodes.length-1){const u=e.episodes[i+1];Z.invalidateQueries({queryKey:["allContinueWatching"]}),T(`/watch/${n}/${u}`),s=!0}}!s&&y.length===0&&!q&&!et.current&&cr(e.episodes,e.currentEpisode,e.showMeta.status)&&m({type:"SET_STATE",payload:{showResumeModal:!0}})},[w,T,y,n,e.showMeta?.id,e.showMeta?.status,e.currentEpisode,e.episodes,e.isAutoplayEnabled,q,m,Z]),Qt=z(()=>{if(y.length===0)return;w.onEnded();const t=y.find(u=>Rt(u,n,e.showMeta?.id)&&u.episodeNumber===e.currentEpisode),s=y.findIndex(u=>Rt(u,n,e.showMeta?.id)&&u.episodeNumber===e.currentEpisode),i=s>=0?y[s+1]||null:y[0];t&&pe.mutate({showId:t.showId,episodeNumber:t.episodeNumber}),i?T(`/watch/${i.showId}/${i.episodeNumber}`):t&&m({type:"SET_STATE",payload:{showResumeModal:!0}})},[w,T,y,pe,n,e.showMeta?.id,e.currentEpisode,m]),Mt=z(()=>{Ce&&(Z.invalidateQueries({queryKey:["allContinueWatching"]}),F(!1),T(`/watch/${n}/${Ce}`)),m({type:"SET_STATE",payload:{showResumeModal:!1}})},[Ce,T,n,m,Z]),Zt=z(()=>{y.length>0?Qt():Ce?Mt():Ve.error("No next episode available")},[y.length,Qt,Mt,Ce]),yr=()=>{yt&&T(`/watch/${n}/${yt}`)};A(()=>{const t=d.videoRef.current;if(!t)return;const s=()=>{U||$t()};return t.addEventListener("ended",s),()=>{t&&t.removeEventListener("ended",s)}},[$t,d.videoRef,U]),A(()=>{const t=s=>{s.origin===window.location.origin&&e.selectedSource?.type==="iframe"&&s.data?.type==="ANI_WEB_MEDIA_ENDED"&&$t()};return window.addEventListener("message",t),()=>window.removeEventListener("message",t)},[$t,e.selectedSource?.type]),A(()=>{if(!q||C===null)return;if(C<=0){const{nextItem:s,playedItem:i}=q;be(null),Fe(null),i&&ct.current.mutate({showId:i.showId,episodeNumber:i.episodeNumber}),s?T(`/watch/${s.showId}/${s.episodeNumber}`):i&&m({type:"SET_STATE",payload:{showResumeModal:!0}});return}const t=window.setTimeout(()=>{Fe(s=>s===null?null:s-1)},1e3);return()=>window.clearTimeout(t)},[q,C,T,m]),A(()=>{ut&&o.state.isFullscreen&&o.actions.toggleFullscreen()},[ut,o.state.isFullscreen,o.actions]),A(()=>{ut&&d.videoRef.current&&d.videoRef.current.pause()},[ut,d.videoRef]);const{titlePreference:Ft}=Kr(),{lowEndMode:er}=Hr(),{settings:zt,update:Sr}=un(),Er=Q&&zt.enabled&&!er&&e.selectedSource?.type!=="iframe"&&!!e.selectedLink,dt=nt(()=>{if(!e.showMeta||e.loadingShowData)return"Loading...";const{name:t,names:s}=e.showMeta;return Ft==="name"?t||"Loading...":Ft==="nativeName"?s?.native||t||"Loading...":Ft==="englishName"?s?.english||t||"Loading...":t||"Loading..."},[e.showMeta,Ft,e.loadingShowData]);A(()=>{dt&&dt!=="Loading..."&&e.currentEpisode&&(document.title=`► ${dt} Episode ${e.currentEpisode} - dango`)},[dt,e.currentEpisode]),A(()=>{const t=s=>{s.target.closest('input, textarea, button, select, a, [role="button"], [contenteditable="true"]')||(["arrowup","arrowdown","arrowleft","arrowright"].includes(s.key.toLowerCase())&&(w.setShowControls(!0),o.actions.inactivityTimer.current&&clearTimeout(o.actions.inactivityTimer.current),o.actions.inactivityTimer.current=window.setTimeout(()=>{w.setShowControls(!1)},1e3)),s.key.toLowerCase()==="n"&&Zt(),s.key.toLowerCase()==="t"&&Tt())};return document.addEventListener("keydown",t),()=>{document.removeEventListener("keydown",t)}},[w,o.actions.inactivityTimer,Zt,Tt]);const{setAvailableSubtitles:tr,setActiveSubtitleTrack:Gt}=w;A(()=>{const t=d.videoRef.current;if(!t)return;const s=()=>{const i=Array.from(t.textTracks).map(u=>({label:u.label,lang:u.language,src:void 0,mode:u.mode}));tr(i)};return t.textTracks.addEventListener("addtrack",s),t.textTracks.addEventListener("removetrack",s),s(),()=>{t&&(t.textTracks.removeEventListener("addtrack",s),t.textTracks.removeEventListener("removetrack",s))}},[d.videoRef,tr]),A(()=>{if(o.state.activeSubtitleTrack===null&&o.state.availableSubtitles.length>0&&localStorage.getItem("playerSubtitlesEnabled")!=="false"){let t=null;try{t=localStorage.getItem("playerLastSubtitle")}catch{}const s=Yt(o.state.availableSubtitles,{lastKey:t,enabled:!0});if(s<0){Gt("off");return}const i=o.state.availableSubtitles[s];Gt(i.lang||i.label)}},[o.state.activeSubtitleTrack,o.state.availableSubtitles,Gt]),A(()=>{const t=d.videoRef.current;if(!t||o.state.availableSubtitles.length===0)return;const s=o.state.activeSubtitleTrack;if(!(localStorage.getItem("playerSubtitlesEnabled")!=="false")||s==="off"||s===null){Array.from(t.textTracks).forEach(_=>{_.mode="hidden"});return}let u=!1;if(Array.from(t.textTracks).forEach(_=>{const X=(_.language===s||_.label===s)&&!u;_.mode=X?"showing":"hidden",X&&(u=!0)}),!u&&t.textTracks.length>0){const _=Array.from(t.textTracks).find(me=>me.language==="en"||me.label==="English")||t.textTracks[0];_&&(_.mode="showing")}},[o.state.activeSubtitleTrack,o.state.availableSubtitles,d.videoRef]);const[rr,wr]=ue(0);A(()=>{const t=d.videoRef.current;if(!t)return;const s=()=>wr(t.clientHeight||0);s();const i=new ResizeObserver(s);return i.observe(t),()=>i.disconnect()},[d.videoRef,e.selectedSource,e.selectedLink]),A(()=>{const t="dynamic-subtitle-styles";let s=document.getElementById(t);s||(s=document.createElement("style"),s.id=t,document.head.appendChild(s));const i={fontSize:o.state.subtitleFontSize,position:o.state.subtitlePosition,bgOpacity:o.state.subtitleBgOpacity,bgColor:o.state.subtitleBgColor,textColor:o.state.subtitleTextColor,edge:o.state.subtitleEdge,bold:o.state.subtitleBold};s.textContent=ur(i);const u=d.videoRef.current;if(!u)return;const _=dr(o.state.subtitleFontSize,rr||u.clientHeight||720);s.textContent=ur({...i,fontSize:_});const me=()=>{const S=Number(o.state.subtitlePosition),se=isNaN(S)?0:Math.max(0,Math.min(100,S));return Math.max(0,Math.min(100,100-se))},X=(S,se)=>{try{const ie=S;ie.snapToLines=!1,ie.line=se}catch{}},H=()=>{const S=_*16,se=u.videoHeight||u.clientHeight||720,ie=u.videoWidth||u.clientWidth||1280;return{step:S*1.3/se*100,chars:Math.max(20,Math.floor(ie/(S*.55)))}},ae=S=>{const se=me(),ie=Array.from(S.activeCues??[]);if(ie.length<=1){ie.forEach(Et=>X(Et,se));return}const{step:St,chars:Wt}=H();let ar=se;for(let Et=ie.length-1;Et>=0;Et--){const Pr=String(ie[Et].text??"").replace(/<[^>]*>/g,"").split(`
|
|
55
|
-
`).reduce((xr,Ar)=>xr+Math.max(1,Math.ceil(Ar.length/Wt)),0),ir=ar-Pr*St;X(ie[Et],Math.max(0,ir)),ar=ir-St*.4}},ce=S=>{if(!S.cues)return;const se=me();Array.from(S.cues).forEach(ie=>X(ie,se)),S.mode==="showing"&&ae(S)},Se=()=>{Array.from(u.textTracks).forEach(ce)};Se();const re=S=>{const se=S.target;se.mode==="showing"&&ae(se)};Array.from(u.textTracks).forEach(S=>{S.addEventListener("cuechange",re)});const Re=()=>{Array.from(u.textTracks).forEach(S=>{S.removeEventListener("cuechange",re),S.addEventListener("cuechange",re)}),Se()};u.textTracks.addEventListener("addtrack",Re),u.textTracks.addEventListener("removetrack",Re);const fe=Array.from(u.querySelectorAll("track")),ne=()=>{Se()};return fe.forEach(S=>{S.addEventListener("load",ne)}),()=>{Array.from(u.textTracks).forEach(S=>{S.removeEventListener("cuechange",re)}),u.textTracks.removeEventListener("addtrack",Re),u.textTracks.removeEventListener("removetrack",Re),fe.forEach(S=>{S.removeEventListener("load",ne)})}},[o.state.subtitleFontSize,o.state.subtitlePosition,o.state.subtitleBgOpacity,o.state.subtitleBgColor,o.state.subtitleTextColor,o.state.subtitleEdge,o.state.subtitleBold,o.state.activeSubtitleTrack,o.state.availableSubtitles,e.selectedSource,e.selectedLink,d.videoRef,rr]),A(()=>{if(!Je)return;const t=d.videoRef.current,s=Qe.current;if(!t||!s)return;const i=localStorage.getItem("playerSubtitlesEnabled")!=="false",u=o.state.activeSubtitleTrack;function _(){if(s.innerHTML="",!i||u==="off"||u===null)return;const H=Array.from(t.textTracks).find(ne=>ne.language===u||ne.label===u);if(!H||H.mode!=="showing")return;const ae=Ne/1e3;let ce;if(ae>0&&H.cues){const ne=t.currentTime-ae;ce=Array.from(H.cues).filter(S=>S.startTime<=ne&&ne<=S.endTime)}else ce=Array.from(H.activeCues??[]);if(ce.length===0)return;const Se={fontSize:dr(o.state.subtitleFontSize,t.clientHeight||0),position:o.state.subtitlePosition,bgOpacity:o.state.subtitleBgOpacity,bgColor:o.state.subtitleBgColor,textColor:o.state.subtitleTextColor,edge:o.state.subtitleEdge,bold:o.state.subtitleBold},re=dn(Se),Re=pn(t,Se.position),fe=Array.from(ce);fe.forEach((ne,S)=>{const se=String(ne.text??"");if(!mn(se).trim())return;const ie=document.createElement("div"),St=(fe.length-1-S)*1.7;ie.style.cssText=`${re}
|
|
56
|
-
bottom: calc(${Re}px + ${St}em);`,ie.innerHTML=fn(se),s.appendChild(ie)})}const me=()=>_(),X=()=>_();return Array.from(t.textTracks).forEach(H=>{H.addEventListener("cuechange",me)}),t.addEventListener("timeupdate",X),_(),()=>{Array.from(t.textTracks).forEach(H=>{H.removeEventListener("cuechange",me)}),t.removeEventListener("timeupdate",X),s.innerHTML=""}},[M.isEnabled,M.isWebGPUSupported,o.state.subtitleFontSize,o.state.subtitlePosition,o.state.subtitleBgOpacity,o.state.subtitleBgColor,o.state.subtitleTextColor,o.state.subtitleEdge,o.state.subtitleBold,o.state.activeSubtitleTrack,d.videoRef,Je,Ne]),A(()=>{try{localStorage.setItem("anime4kProfile",g)}catch{}},[g]);const kr=()=>{d.videoRef.current&&(d.videoRef.current.currentTime=e.resumeTime,d.videoRef.current.play()),m({type:"SET_STATE",payload:{showResumeModal:!1}})},Tr=()=>{d.videoRef.current&&(d.videoRef.current.currentTime=0,d.videoRef.current.play()),m({type:"SET_STATE",payload:{showResumeModal:!1}})},Kt=z(()=>{rt&&(et.current=!0),Bt&&F(!1),m({type:"SET_STATE",payload:{showResumeModal:!1}})},[m,rt,Bt]),Cr=z(()=>{if(F(!1),d.videoRef.current)try{d.videoRef.current.currentTime=0,d.videoRef.current.play().catch(()=>{})}catch{}m({type:"SET_STATE",payload:{showResumeModal:!1}})},[m,d]),Rr=z(async()=>{try{await N(),m({type:"SET_STATE",payload:{showResumeModal:!1}}),T("/")}catch{}},[N,m,T]),nr=(t,s)=>r("div",{className:t,children:[r("button",{className:`${p.episodeNavBtn} ${p.secondary}`,onClick:yr,disabled:!yt,type:"button",children:[r(J,{name:"chevron-left",size:12}),"Prev EP"]}),r("button",{className:`${p.episodeNavBtn} ${p.primary}`,onClick:Mt,disabled:!Ce,type:"button",children:["Next EP",r(J,{name:"chevron-right",size:12})]}),s==="mobile"&&Be&&r("button",{className:`${p.episodeNavBtn} ${p.episodePickerBtn}`,onClick:()=>$e(!0),type:"button",children:[r(J,{name:"list-ul",size:12}),"Episodes"]})]});A(()=>{P&&(e.showResumeModal||y.length>0||q||et.current||rt&&m({type:"SET_STATE",payload:{showResumeModal:!0}}))},[P,rt,e.showResumeModal,y.length,q,m]);const Mr=t=>{m({type:"SET_STATE",payload:{isAutoplayEnabled:t}}),kn(t)},sr=!!(e.currentEpisode&&e.watchedEpisodes.includes(e.currentEpisode)),_r=e.selectedProvider!=="megaplay"||e.selectedSource?.type==="iframe",Ht=f(B);Ht.current=B;const or=f("");A(()=>{const t=d.videoRef.current;if(c(!1),F(!1),!t||e.selectedSource?.type==="iframe")return;const s=()=>{const i=t.duration,u=t.currentTime;if(!i||Number.isNaN(i)){c(!1),F(!1);return}const _=u/i;if(i-u<=60){const me=y.findIndex(ae=>Rt(ae,n,e.showMeta?.id)&&ae.episodeNumber===e.currentEpisode),X=y.length>0?me>=0?y[me+1]||null:y[0]:null,H=X?`${X.showId}:${X.episodeNumber}`:Ut?`${n}:${Ce}`:"";H&&or.current!==H&&(or.current=H,X?Ht.current(X.episodeNumber,X.showId):Ht.current(Ce))}c(Ut&&_>=.8),F(u>=Math.max(i*.98,i-10))};return s(),t.addEventListener("timeupdate",s),t.addEventListener("loadedmetadata",s),()=>{t.removeEventListener("timeupdate",s),t.removeEventListener("loadedmetadata",s)}},[d.videoRef,Ut,e.currentEpisode,e.selectedSource,Ce,n,y,e.showMeta?.id]);const Nr=z(async()=>{if(!n||!e.currentEpisode||!e.showMeta.name||V)return;const t=d.videoRef.current?.duration,s=Math.max(t||0,e.resumeDuration||0,(e.showMeta.lengthMin||0)*60,1);await G(e.currentEpisode,s)},[n,e.currentEpisode,e.showMeta,e.resumeDuration,G,V,d.videoRef]);if(e.error&&!e.showMeta.name&&e.videoSources.length===0&&e.episodes.length===0)return r("p",{className:"error-message",children:["Error: ",e.error]});const Ke=e.loadingShowData||e.loadingVideo;return e.showMeta?.isAdult===!0&&!R?r("div",{className:Ue.playerPageLayout,children:r(Oe,{isOpen:!0,title:"Content Warning",onClose:()=>T("/home"),children:r("div",{style:{padding:"1rem",textAlign:"center"},children:[r("p",{children:"This title contains mature content intended for adult audiences."}),r("p",{children:["By proceeding, you confirm that you are ",r("strong",{children:"18 years of age or older"})," (or the age of majority in your jurisdiction) and wish to view this content."]}),r("div",{style:{marginTop:"1rem",display:"flex",gap:"10px",justifyContent:"center"},children:[r(pt,{variant:"secondary",onClick:()=>T("/home"),children:"Go Back"}),r(pt,{onClick:E,children:"I'm 18+, Continue"})]})]})})}):r("div",{className:`${Ue.playerPageLayout} ${Q?Ue.theaterMode:""}`,onClick:Ct,children:[Q&&r(hn,{videoRef:d.videoRef,active:Er,settings:zt}),r(Oe,{isOpen:qt&&rt,onClose:Kt,title:"Show Completed!",width:"sm",children:[r(Oe.Body,{children:r("p",{children:"Congratulations! You've finished the final episode of this series."})}),r(Oe.Actions,{children:r(pt,{onClick:Rr,disabled:Ae,children:Ae?"Saving...":"Move to Completed"})})]}),r(vn,{isOpen:qt&&!rt,onClose:Kt,title:"Resume Playback?",message:r(_t,{children:["You were watching at ",r("strong",{children:o.actions.formatTime(e.resumeTime)}),". Would you like to continue?"]}),onResume:kr,onRestart:Tr}),r(Oe,{isOpen:Bt,onClose:Kt,title:"Episode Completed",width:"sm",children:[r(Oe.Body,{children:r("p",{children:["You've already watched Episode ",r("strong",{children:e.currentEpisode}),".",Ce?" Would you like to watch the next episode?":""]})}),r(Oe.Actions,{children:[r(pt,{variant:"secondary",onClick:Cr,children:"Replay"}),Ce&&r(pt,{onClick:Mt,children:`Watch EP ${Ce}`})]})]}),r(Oe,{isOpen:!!at,onClose:vr,title:"Direct stream failed",width:"sm",children:[r(Oe.Body,{children:[r("p",{children:[r("strong",{children:e.selectedProvider}),"'s direct stream failed for this episode."]}),at?.retryFailed&&r("p",{children:"No working direct stream was found on the other providers either."}),r("p",{children:["You can continue with the embedded (iframe) player, but embedded players may show"," ",r("strong",{children:"ads and pop-ups"}),"."]}),r("label",{style:{display:"flex",alignItems:"center",gap:"8px",marginTop:"0.75rem",cursor:"pointer"},children:[r("input",{type:"checkbox",checked:Ge,onChange:t=>kt(t.target.checked)}),"Remember my choice"]})]}),r(Oe.Actions,{children:[r(pt,{variant:"secondary",onClick:br,children:"Continue with iframe"}),r(pt,{onClick:gr,disabled:vt,children:vt?"Searching…":"Try another provider"})]})]}),r(jr,{isOpen:!!e.showCookieModal,onClose:()=>m({type:"SET_STATE",payload:{showCookieModal:!1}}),onSuccess:()=>{Z.invalidateQueries({queryKey:["video-sources",n,e.currentEpisode,e.selectedProvider,e.currentMode]})}}),!Q&&r("aside",{ref:Me,className:Ue.episodeSidebar,children:e.loadingShowData?r(bn,{variant:"sidebar"}):r(gn,{episodes:e.episodes,currentEpisode:e.currentEpisode,watchedEpisodes:e.watchedEpisodes,onEpisodeClick:t=>T(`/watch/${n}/${t}`)})}),r("div",{className:Ue.playerMain,children:[r("div",{className:`${p.videoContainer} ${o.state.isFullscreen?"":Ue.videoPlayerWrapper} ${o.state.isFullscreen?p.fullscreenActive:""}`,style:{...ut?{visibility:"hidden"}:{}},onContextMenu:t=>t.preventDefault(),children:r(bs,{player:o,isAutoplayEnabled:e.isAutoplayEnabled,onAutoplayChange:Mr,fallbackChoice:it,onFallbackChoiceChange:lt,ambientSettings:zt,onAmbientChange:Sr,showNextEpisodeButton:!ut&&Ze&&y.length===0,onNextEpisode:Mt,videoSources:e.videoSources,selectedSource:e.selectedSource,selectedLink:e.selectedLink,onSourceChange:(t,s)=>{d.videoRef.current&&!isNaN(d.videoRef.current.currentTime)&&(oe.current=d.videoRef.current.currentTime),le(t.sourceName),m({type:"SET_STATE",payload:{selectedSource:t,selectedLink:s,showResumeModal:e.showResumeModal&&t.type!=="iframe"}})},loadingVideo:Ke,skipIntervals:e.skipIntervals,animeTitle:dt,episodeNumber:e.currentEpisode,isTheaterMode:Q,onTheaterModeToggle:Tt,anime4kEnabled:M.isEnabled,onAnime4kToggle:M.toggle,anime4kSupported:M.isWebGPUSupported,anime4kProfile:g,onAnime4kProfileChange:h,anime4kInitializing:M.isInitializing,anime4kError:M.error,videoDelayEnabled:a,onVideoDelayToggle:D,videoDelayMs:I,onVideoDelayChange:x,onCalibrateAvSync:Ie,isInteractingExtra:De||W,className:yn.shellFill,hideChrome:e.selectedSource?.type==="iframe",overlays:r(_t,{children:[o.state.isSpeedBoostActive&&r("div",{className:p.speedBoostBadge,"aria-hidden":"true",children:[r("span",{children:"2x"}),r(J,{name:"forward",size:12})]}),C!==null&&q?.nextItem&&r("div",{className:p.queueCountdown,children:["Queue next in ",C,"s"]})]}),children:[Ke&&r("div",{className:p.loadingOverlay,children:r("div",{className:p.loadingDots,children:[r("div",{className:p.dot}),r("div",{className:p.dot}),r("div",{className:p.dot})]})}),o.state.isBuffering&&!Ke&&e.selectedSource?.type!=="iframe"&&r("div",{className:p.bufferingOverlay,children:r("div",{className:p.bufferingSpinner})}),e.selectedSource?.type==="iframe"?!Ke&&r("iframe",{src:e.selectedLink?.link,className:p.videoIframe,allow:"autoplay; fullscreen; picture-in-picture",allowFullScreen:!0,sandbox:e.selectedSource.sandbox?`${e.selectedSource.sandbox} allow-fullscreen allow-popups allow-popups-to-escape-sandbox`:void 0}):r(_t,{children:[!Ke&&e.videoSources.length===0&&r("div",{className:p.errorOverlay,children:[r("p",{children:["No sources found for this episode with ",e.selectedProvider,"."]}),r("p",{className:p.errorSubtext,children:"Please try selecting a different provider below."}),r("button",{className:p.retryButton,onClick:()=>window.location.reload(),"data-speed-boost-ignore":"true",style:{marginTop:8},children:"Retry"})]}),!Ke&&e.videoSources.length>0&&r("video",{ref:d.videoRef,controls:o.state.useNativeControls,playsInline:!0,"webkit-playsinline":"true",disablePictureInPicture:!0,disableRemotePlayback:!0,onPlay:w.onPlay,onPause:w.onPause,onLoadedMetadata:w.onLoadedMetadata,onTimeUpdate:()=>{U||(w.onTimeUpdate(),q&&d.videoRef.current&&d.videoRef.current.currentTime<d.videoRef.current.duration-1&&(be(null),Fe(null)))},onProgress:w.onProgress,onVolumeChange:w.onVolumeChange,onWaiting:w.onWaiting,onPlaying:w.onPlaying,onCanPlay:w.onCanPlay,onError:Jt,onContextMenu:t=>t.preventDefault(),className:Je?p.videoElementHidden:""}),M.isWebGPUSupported&&!Ke&&e.videoSources.length>0&&r("canvas",{ref:_e,className:`${p.upscalerCanvas} ${j?p.upscalerActive:""}`}),!j&&!Ke&&e.videoSources.length>0&&r("canvas",{ref:ft,className:`${p.upscalerCanvas} ${Xe?p.upscalerActive:""}`}),M.isEnabled&&M.isWebGPUSupported&&M.isInitializing&&r("div",{className:p.upscalerStatusBadge,children:"Preparing upscaler…"}),Je&&r("div",{ref:Qe,className:p.subtitleOverlay}),r(Sn,{isOpen:W,ms:I,onChange:x,onApply:ot,onClose:st,testClipActive:U,onTestClip:wt})]})]})}),!Q&&r(En,{}),!Q&&r(_t,{children:[Te&&y.length===0?r(gs,{count:3}):r(Rn,{title:"Queue",items:y,currentShowId:n,currentEpisode:e.currentEpisode,onNextQueue:Qt,onRemove:t=>pe.mutate({showId:t.showId,episodeNumber:t.episodeNumber}),onClear:()=>gt.mutate(),showClearAll:!0,onReorder:t=>Pe.mutate(t.map(s=>({id:s.id,showId:s.showId,episodeNumber:s.episodeNumber})))}),r("div",{className:p.providerAndEpisodeRow,children:[r(Rs,{selectedProvider:e.selectedProvider,isAdult:e.showMeta?.isAdult,options:L,onProviderChange:t=>{We.current=!1,ee.current=[],tt.current=!1,ve(null),m({type:"SET_STATE",payload:{selectedProvider:t,videoSources:[],selectedSource:null,selectedLink:null,loadingVideo:!0}}),localStorage.setItem("preferredProvider",t)}}),nr(`${p.episodeActions} ${p.desktopEpisodeActions}`,"desktop")]}),Ke?r("div",{className:p.sourceLoader,children:r("div",{className:p.spinner})}):r(_t,{children:r(_s,{videoSources:e.videoSources,selectedSource:e.selectedSource,selectedLink:e.selectedLink,onSourceChange:t=>{d.videoRef.current&&!isNaN(d.videoRef.current.currentTime)&&(oe.current=d.videoRef.current.currentTime);const i=(t.links||[]).sort((u,_)=>(parseInt(_.resolutionStr)||0)-(parseInt(u.resolutionStr)||0))[0]||null;le(t.sourceName),m({type:"SET_STATE",payload:{selectedSource:t,selectedLink:i,showResumeModal:e.showResumeModal&&t.type!=="iframe"}})},onLinkChange:t=>{e.selectedSource&&(le(e.selectedSource.sourceName),m({type:"SET_STATE",payload:{selectedLink:t}}))}})}),r("div",{className:Ue.playerInfoContainer,children:[r("div",{className:Ue.playerInfoHeader,children:[r("div",{className:Ue.playerAnimeCard,children:r("img",{src:Yr(e.showMeta.thumbnail||""),alt:dt,loading:"lazy",decoding:"async",onError:t=>{t.target.src="/placeholder.svg"}})}),r("div",{className:Ue.videoTitleSection,children:[r("div",{className:p.titleContainer,children:[r("h1",{children:dt}),r("div",{className:p.scheduleInfo,children:[e.showMeta.status&&r("span",{className:p.status,children:e.showMeta.status}),e.showMeta.nextEpisodeAirDate&&r("span",{className:p.nextEpisode,children:["Next episode: ",e.showMeta.nextEpisodeAirDate]})]})]}),r("div",{className:p.controls,children:[r("button",{className:`${p.watchlistBtn} ${e.inWatchlist?p.inList:""}`,onClick:ge,children:[e.inWatchlist?r(J,{name:"check",size:14}):r(J,{name:"plus",size:14}),e.inWatchlist?"In Watchlist":"Add to Watchlist"]}),r(_n,{showId:n,showName:e.showMeta.name||e.showMeta.names?.romaji,showThumbnail:e.showMeta.thumbnail,nativeName:e.showMeta.names?.native,englishName:e.showMeta.names?.english,showType:e.showMeta.type,className:`${p.watchlistBtn} ${p.queueBtn}`,activeClassName:p.queueActive}),_r&&r("button",{className:`${p.watchlistBtn} ${p.markWatchedBtn} ${sr?p.markWatchedDone:""}`,onClick:Nr,disabled:V||!e.currentEpisode,children:[r(J,{name:"check",size:14}),V?"Saving...":sr?"Watched":"Mark Watched"]}),r("button",{className:`${p.watchlistBtn} ${p.modeToggleBtn} ${e.currentMode==="dub"?p.modeToggleActive:""}`,onClick:()=>{const t=e.currentMode==="dub"?"sub":"dub";We.current=!1,ee.current=[],tt.current=!1,ve(null),m({type:"SET_MODE",payload:t}),localStorage.setItem("preferredMode",t)},type:"button","aria-pressed":e.currentMode==="dub",children:e.currentMode==="dub"?"DUB":"SUB"}),er&&r("button",{className:`${p.watchlistBtn} ${p.modeToggleBtn} ${o.state.useNativeControls?p.modeToggleActive:""}`,onClick:()=>{const t=!o.state.useNativeControls;o.actions.setUseNativeControls(t),localStorage.setItem("playerUseNativeControls",t.toString())},type:"button",children:o.state.useNativeControls?"NATIVE: ON":"NATIVE: OFF"})]})]})]}),nr(`${p.episodeActions} ${p.mobileEpisodeActions}`,"mobile"),r("div",{className:p.descriptionSection,children:[r("h3",{children:"Synopsis"}),r(Pn,{text:e.showMeta.description?e.showMeta.description.replace(/<[^>]*>?/gm,""):"",emptyText:"No description available."})]}),r("button",{className:p.detailsToggleBtn,onClick:xe,children:[e.showCombinedDetails?r(J,{name:"chevron-up"}):r(J,{name:"chevron-down"}),e.showCombinedDetails?"Hide Details":"Show Details"]}),e.showCombinedDetails&&r(Nn,{showMeta:e.showMeta,styles:p})]})]})]}),r(wn,{isOpen:De,onClose:()=>$e(!1),episodes:e.episodes,currentEpisode:e.currentEpisode,watchedEpisodes:e.watchedEpisodes,onEpisodeClick:t=>{$e(!1),T(`/watch/${n}/${t}`)}})]})};export{oo as default};
|